From: support Date: Tue, 13 Sep 2022 06:20:55 +0000 (+0000) Subject: Built motion from commit 6ae5c09c.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=1f8d975136afbfa0e7d8e34c7d560abe7b02be0e;p=motion2.git Built motion from commit 6ae5c09c.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4427f1e..cec64f6 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-09-12T09:26:32.890Z", + "time": "2022-09-13T06:12:56.114Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ae80f8d..aa47b38 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-12T09:26:32.890Z", + "time": "2022-09-13T06:12:56.114Z", "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 675b899..680d183 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 _0xb58d=['action','contactManager','motionbar','jscripty','urlForward','browser','script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0x39aec5,_0x2c0b3b){var _0x27d1c3=function(_0x205748){while(--_0x205748){_0x39aec5['push'](_0x39aec5['shift']());}};_0x27d1c3(++_0x2c0b3b);}(_0xb58d,0x141));var _0xdb58=function(_0x4cf1ad,_0x2929f0){_0x4cf1ad=_0x4cf1ad-0x0;var _0x3b210f=_0xb58d[_0x4cf1ad];return _0x3b210f;};'use strict';var Sequelize=require(_0xdb58('0x0'));module[_0xdb58('0x1')]={'name':{'type':Sequelize[_0xdb58('0x2')],'get':function(_0x4e9eea){return this['getDataValue'](_0xdb58('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xdb58('0x4'),'integration',_0xdb58('0x5'),_0xdb58('0x6'),_0xdb58('0x7'),_0xdb58('0x8'),'bot',_0xdb58('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xdb58('0xa')](0x1000),'comment':_0xdb58('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xdb58('0xc')},'data4':{'type':Sequelize[_0xdb58('0xa')](0x1000),'comments':_0xdb58('0xd')},'data5':{'type':Sequelize[_0xdb58('0xa')](0x1000),'comments':_0xdb58('0xe')},'data6':{'type':Sequelize[_0xdb58('0xa')],'comments':_0xdb58('0xf')},'data7':{'type':Sequelize[_0xdb58('0x10')],'comments':_0xdb58('0x11')}}; \ No newline at end of file +var _0x414c=['jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','STRING','contactManager','integration','motionbar'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x414c,0x175));var _0xc414=function(_0x1954d7,_0x4f8aba){_0x1954d7=_0x1954d7-0x0;var _0x161a3c=_0x414c[_0x1954d7];return _0x161a3c;};'use strict';var Sequelize=require(_0xc414('0x0'));module[_0xc414('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a9982){return this[_0xc414('0x2')]('action');}},'action':{'type':Sequelize[_0xc414('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xc414('0x4'),_0xc414('0x5'),_0xc414('0x6'),_0xc414('0x7'),_0xc414('0x8'),'browser',_0xc414('0x9'),_0xc414('0xa')]],'msg':_0xc414('0xb')}},'comment':_0xc414('0xb')},'data1':{'type':Sequelize[_0xc414('0x3')](0x1000),'comment':_0xc414('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xc414('0xd')},'data3':{'type':Sequelize[_0xc414('0x3')](0x1000),'comment':_0xc414('0xe')},'data4':{'type':Sequelize[_0xc414('0x3')](0x1000),'comments':_0xc414('0xf')},'data5':{'type':Sequelize[_0xc414('0x3')](0x1000),'comments':_0xc414('0x10')},'data6':{'type':Sequelize[_0xc414('0x3')],'comments':_0xc414('0x11')},'data7':{'type':Sequelize[_0xc414('0x12')],'comments':_0xc414('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6d53f63..15718d9 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 _0xe9ff=['request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x331c5a,_0x5d85f4){var _0x34fda5=function(_0x2e9d35){while(--_0x2e9d35){_0x331c5a['push'](_0x331c5a['shift']());}};_0x34fda5(++_0x5d85f4);}(_0xe9ff,0x1be));var _0xfe9f=function(_0x75a383,_0x265b4b){_0x75a383=_0x75a383-0x0;var _0x2f70a0=_0xe9ff[_0x75a383];return _0x2f70a0;};'use strict';var emlformat=require(_0xfe9f('0x0'));var rimraf=require(_0xfe9f('0x1'));var zipdir=require(_0xfe9f('0x2'));var jsonpatch=require(_0xfe9f('0x3'));var rp=require(_0xfe9f('0x4'));var moment=require(_0xfe9f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe9f('0x6'));var path=require('path');var sox=require(_0xfe9f('0x7'));var csv=require(_0xfe9f('0x8'));var ejs=require(_0xfe9f('0x9'));var fs=require('fs');var fs_extra=require(_0xfe9f('0xa'));var _=require(_0xfe9f('0xb'));var squel=require(_0xfe9f('0xc'));var crypto=require(_0xfe9f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfe9f('0xe'));var toCsv=require(_0xfe9f('0x8'));var querystring=require(_0xfe9f('0xf'));var Papa=require('papaparse');var Redis=require(_0xfe9f('0x10'));var authService=require(_0xfe9f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfe9f('0x12'));var hardwareService=require(_0xfe9f('0x13'));var logger=require(_0xfe9f('0x14'))(_0xfe9f('0x15'));var utils=require(_0xfe9f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfe9f('0x17'))['db'];function respondWithStatusCode(_0x3e7898,_0x2adba8){_0x2adba8=_0x2adba8||0xcc;return function(_0x315bcb){if(_0x315bcb){return _0x3e7898[_0xfe9f('0x18')](_0x2adba8);}return _0x3e7898[_0xfe9f('0x19')](_0x2adba8)[_0xfe9f('0x1a')]();};}function respondWithResult(_0x16086b,_0x44fa17){_0x44fa17=_0x44fa17||0xc8;return function(_0x48be7f){if(_0x48be7f){return _0x16086b[_0xfe9f('0x19')](_0x44fa17)[_0xfe9f('0x1b')](_0x48be7f);}};}function respondWithFilteredResult(_0x538bf6,_0xd21849){return function(_0x4de0c8){if(_0x4de0c8){var _0x294a52=typeof _0xd21849['offset']===_0xfe9f('0x1c')&&typeof _0xd21849[_0xfe9f('0x1d')]==='undefined';var _0x2531fb=_0x4de0c8[_0xfe9f('0x1e')];var _0x39463a=_0x294a52?0x0:_0xd21849[_0xfe9f('0x1f')];var _0xe70804=_0x294a52?_0x4de0c8[_0xfe9f('0x1e')]:_0xd21849['offset']+_0xd21849['limit'];var _0x9d686e;if(_0xe70804>=_0x2531fb){_0xe70804=_0x2531fb;_0x9d686e=0xc8;}else{_0x9d686e=0xce;}_0x538bf6['status'](_0x9d686e);return _0x538bf6[_0xfe9f('0x20')](_0xfe9f('0x21'),_0x39463a+'-'+_0xe70804+'/'+_0x2531fb)[_0xfe9f('0x1b')](_0x4de0c8);}return null;};}function patchUpdates(_0x242c72){return function(_0x28212c){try{jsonpatch[_0xfe9f('0x22')](_0x28212c,_0x242c72,!![]);}catch(_0x4e6179){return BPromise['reject'](_0x4e6179);}return _0x28212c[_0xfe9f('0x23')]();};}function saveUpdates(_0x2932e5,_0x245b4b){return function(_0x5d37e1){if(_0x5d37e1){return _0x5d37e1[_0xfe9f('0x24')](_0x2932e5)[_0xfe9f('0x25')](function(_0x4d7eb2){return _0x4d7eb2;});}return null;};}function removeEntity(_0x1ff2e8,_0x37163d){return function(_0xb2ae03){if(_0xb2ae03){return _0xb2ae03['destroy']()[_0xfe9f('0x25')](function(){_0x1ff2e8['status'](0xcc)[_0xfe9f('0x1a')]();});}};}function handleEntityNotFound(_0x5d804b,_0x239049){return function(_0x2e2970){if(!_0x2e2970){_0x5d804b[_0xfe9f('0x18')](0x194);}return _0x2e2970;};}function handleError(_0x288dbb,_0x450478){_0x450478=_0x450478||0x1f4;return function(_0x4d5fdd){logger['error'](_0x4d5fdd['stack']);if(_0x4d5fdd[_0xfe9f('0x26')]){delete _0x4d5fdd[_0xfe9f('0x26')];}_0x288dbb[_0xfe9f('0x19')](_0x450478)[_0xfe9f('0x27')](_0x4d5fdd);};}exports[_0xfe9f('0x24')]=function(_0x5b0030,_0xbacc12){if(_0x5b0030[_0xfe9f('0x28')]['id']){delete _0x5b0030[_0xfe9f('0x28')]['id'];}return db[_0xfe9f('0x29')][_0xfe9f('0x2a')]({'where':{'id':_0x5b0030[_0xfe9f('0x2b')]['id']}})[_0xfe9f('0x25')](handleEntityNotFound(_0xbacc12,null))[_0xfe9f('0x25')](saveUpdates(_0x5b0030[_0xfe9f('0x28')],null))[_0xfe9f('0x25')](respondWithResult(_0xbacc12,null))[_0xfe9f('0x2c')](handleError(_0xbacc12,null));};exports['destroy']=function(_0x2b5ed3,_0x5111e5){return db[_0xfe9f('0x29')][_0xfe9f('0x2a')]({'where':{'id':_0x2b5ed3['params']['id']}})['then'](handleEntityNotFound(_0x5111e5,null))['then'](removeEntity(_0x5111e5,null))['catch'](handleError(_0x5111e5,null));}; \ No newline at end of file +var _0xb473=['find','params','catch','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','save','then','destroy','stack','name','send','update','body','Action'];(function(_0x2c70fa,_0x35f7bd){var _0x413a81=function(_0x413727){while(--_0x413727){_0x2c70fa['push'](_0x2c70fa['shift']());}};_0x413a81(++_0x35f7bd);}(_0xb473,0x14c));var _0x3b47=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xb473[_0x15ea09];return _0x3e9c78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b47('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b47('0x1'));var rp=require('request-promise');var moment=require(_0x3b47('0x2'));var BPromise=require(_0x3b47('0x3'));var Mustache=require(_0x3b47('0x4'));var util=require(_0x3b47('0x5'));var path=require(_0x3b47('0x6'));var sox=require(_0x3b47('0x7'));var csv=require(_0x3b47('0x8'));var ejs=require(_0x3b47('0x9'));var fs=require('fs');var fs_extra=require(_0x3b47('0xa'));var _=require(_0x3b47('0xb'));var squel=require(_0x3b47('0xc'));var crypto=require(_0x3b47('0xd'));var jsforce=require(_0x3b47('0xe'));var deskjs=require(_0x3b47('0xf'));var toCsv=require(_0x3b47('0x8'));var querystring=require('querystring');var Papa=require(_0x3b47('0x10'));var Redis=require('ioredis');var authService=require(_0x3b47('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3b47('0x12'));var hardwareService=require(_0x3b47('0x13'));var logger=require(_0x3b47('0x14'))(_0x3b47('0x15'));var utils=require(_0x3b47('0x16'));var config=require(_0x3b47('0x17'));var licenseUtil=require(_0x3b47('0x18'));var db=require(_0x3b47('0x19'))['db'];function respondWithStatusCode(_0x40f32f,_0x1960d8){_0x1960d8=_0x1960d8||0xcc;return function(_0x421a53){if(_0x421a53){return _0x40f32f[_0x3b47('0x1a')](_0x1960d8);}return _0x40f32f['status'](_0x1960d8)['end']();};}function respondWithResult(_0x2549e4,_0x2364ec){_0x2364ec=_0x2364ec||0xc8;return function(_0x463344){if(_0x463344){return _0x2549e4[_0x3b47('0x1b')](_0x2364ec)['json'](_0x463344);}};}function respondWithFilteredResult(_0x32b9a6,_0x59cc37){return function(_0x3d6f03){if(_0x3d6f03){var _0x21f832=typeof _0x59cc37[_0x3b47('0x1c')]===_0x3b47('0x1d')&&typeof _0x59cc37['limit']===_0x3b47('0x1d');var _0x5b3731=_0x3d6f03['count'];var _0x319a94=_0x21f832?0x0:_0x59cc37[_0x3b47('0x1c')];var _0x1dfc3e=_0x21f832?_0x3d6f03['count']:_0x59cc37[_0x3b47('0x1c')]+_0x59cc37[_0x3b47('0x1e')];var _0x3e2d88;if(_0x1dfc3e>=_0x5b3731){_0x1dfc3e=_0x5b3731;_0x3e2d88=0xc8;}else{_0x3e2d88=0xce;}_0x32b9a6['status'](_0x3e2d88);return _0x32b9a6[_0x3b47('0x1f')](_0x3b47('0x20'),_0x319a94+'-'+_0x1dfc3e+'/'+_0x5b3731)[_0x3b47('0x21')](_0x3d6f03);}return null;};}function patchUpdates(_0x73c4bd){return function(_0x21d9dd){try{jsonpatch['apply'](_0x21d9dd,_0x73c4bd,!![]);}catch(_0x2343ad){return BPromise[_0x3b47('0x22')](_0x2343ad);}return _0x21d9dd[_0x3b47('0x23')]();};}function saveUpdates(_0x39b469,_0x5e1344){return function(_0x1a2ba9){if(_0x1a2ba9){return _0x1a2ba9['update'](_0x39b469)[_0x3b47('0x24')](function(_0x1bb637){return _0x1bb637;});}return null;};}function removeEntity(_0x4b1fcd,_0x2524ac){return function(_0x1ce51d){if(_0x1ce51d){return _0x1ce51d[_0x3b47('0x25')]()[_0x3b47('0x24')](function(){_0x4b1fcd[_0x3b47('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x212228,_0x43a7c6){return function(_0xdf9722){if(!_0xdf9722){_0x212228[_0x3b47('0x1a')](0x194);}return _0xdf9722;};}function handleError(_0x44934c,_0x44ba1f){_0x44ba1f=_0x44ba1f||0x1f4;return function(_0x4db628){logger['error'](_0x4db628[_0x3b47('0x26')]);if(_0x4db628[_0x3b47('0x27')]){delete _0x4db628[_0x3b47('0x27')];}_0x44934c['status'](_0x44ba1f)[_0x3b47('0x28')](_0x4db628);};}exports[_0x3b47('0x29')]=function(_0x5cd574,_0x129dd2){if(_0x5cd574[_0x3b47('0x2a')]['id']){delete _0x5cd574[_0x3b47('0x2a')]['id'];}return db[_0x3b47('0x2b')][_0x3b47('0x2c')]({'where':{'id':_0x5cd574[_0x3b47('0x2d')]['id']}})[_0x3b47('0x24')](handleEntityNotFound(_0x129dd2,null))[_0x3b47('0x24')](saveUpdates(_0x5cd574[_0x3b47('0x2a')],null))[_0x3b47('0x24')](respondWithResult(_0x129dd2,null))[_0x3b47('0x2e')](handleError(_0x129dd2,null));};exports[_0x3b47('0x25')]=function(_0x3df5da,_0x555c87){return db[_0x3b47('0x2b')]['find']({'where':{'id':_0x3df5da[_0x3b47('0x2d')]['id']}})[_0x3b47('0x24')](handleEntityNotFound(_0x555c87,null))[_0x3b47('0x24')](removeEntity(_0x555c87,null))['catch'](handleError(_0x555c87,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 01d5ecd..a84986f 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 _0x7677=['exports','Action','tools_actions','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x3ac552,_0x257348){var _0xcb4fb9=function(_0x120f0a){while(--_0x120f0a){_0x3ac552['push'](_0x3ac552['shift']());}};_0xcb4fb9(++_0x257348);}(_0x7677,0x18f));var _0x7767=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7677[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7767('0x0'));var util=require('util');var logger=require(_0x7767('0x1'))(_0x7767('0x2'));var moment=require(_0x7767('0x3'));var BPromise=require('bluebird');var rp=require(_0x7767('0x4'));var fs=require('fs');var path=require(_0x7767('0x5'));var rimraf=require(_0x7767('0x6'));var config=require(_0x7767('0x7'));var attributes=require(_0x7767('0x8'));module[_0x7767('0x9')]=function(_0x40ebd6,_0x12cc0c){return _0x40ebd6['define'](_0x7767('0xa'),attributes,{'tableName':_0x7767('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9175=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9175,0x1ad));var _0x5917=function(_0x5bac46,_0x34d07f){_0x5bac46=_0x5bac46-0x0;var _0x407ef3=_0x9175[_0x5bac46];return _0x407ef3;};'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('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5917('0x6'));var config=require(_0x5917('0x7'));var attributes=require(_0x5917('0x8'));module[_0x5917('0x9')]=function(_0x4d2f4e,_0x4f6da3){return _0x4d2f4e[_0x5917('0xa')](_0x5917('0xb'),attributes,{'tableName':_0x5917('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index de1b76c..de47ed1 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x15a0c4,_0x3ceeca){var _0x1abadf=function(_0x2a047b){while(--_0x2a047b){_0x15a0c4['push'](_0x15a0c4['shift']());}};_0x1abadf(++_0x3ceeca);}(_0x8ef6,0xf2));var _0x68ef=function(_0x327da6,_0x2c1c80){_0x327da6=_0x327da6-0x0;var _0x4f1297=_0x8ef6[_0x327da6];return _0x4f1297;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ 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(_0x33401b,_0x587247){var _0x49fc6b=function(_0x3f18ca){while(--_0x3f18ca){_0x33401b['push'](_0x33401b['shift']());}};_0x49fc6b(++_0x587247);}(_0x1261,0x144));var _0x1126=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x1261[_0x16938f];return _0x5c66e9;};'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 9940f83..fdacf95 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 _0x79cb=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x13f731,_0x1c061a){var _0x3ac7d7=function(_0x347227){while(--_0x347227){_0x13f731['push'](_0x13f731['shift']());}};_0x3ac7d7(++_0x1c061a);}(_0x79cb,0xf4));var _0xb79c=function(_0x291578,_0x23098a){_0x291578=_0x291578-0x0;var _0x58bf79=_0x79cb[_0x291578];return _0x58bf79;};'use strict';var multer=require('multer');var util=require(_0xb79c('0x0'));var path=require(_0xb79c('0x1'));var timeout=require(_0xb79c('0x2'));var express=require(_0xb79c('0x3'));var router=express['Router']();var fs_extra=require(_0xb79c('0x4'));var auth=require(_0xb79c('0x5'));var interaction=require(_0xb79c('0x6'));var config=require(_0xb79c('0x7'));var controller=require(_0xb79c('0x8'));router[_0xb79c('0x9')](_0xb79c('0xa'),auth['isAuthenticated'](),controller[_0xb79c('0xb')]);router[_0xb79c('0xc')](_0xb79c('0xa'),auth['isAuthenticated'](),controller[_0xb79c('0xd')]);module[_0xb79c('0xe')]=router; \ No newline at end of file +var _0x22a2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','delete','destroy'];(function(_0xe67418,_0x445c58){var _0x58f718=function(_0x35d357){while(--_0x35d357){_0xe67418['push'](_0xe67418['shift']());}};_0x58f718(++_0x445c58);}(_0x22a2,0xf7));var _0x222a=function(_0x262c73,_0x5150be){_0x262c73=_0x262c73-0x0;var _0x4e9d07=_0x22a2[_0x262c73];return _0x4e9d07;};'use strict';var multer=require(_0x222a('0x0'));var util=require(_0x222a('0x1'));var path=require(_0x222a('0x2'));var timeout=require(_0x222a('0x3'));var express=require(_0x222a('0x4'));var router=express[_0x222a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x222a('0x6'));var interaction=require(_0x222a('0x7'));var config=require(_0x222a('0x8'));var controller=require('./action.controller');router[_0x222a('0x9')]('/:id',auth[_0x222a('0xa')](),controller['update']);router[_0x222a('0xb')]('/:id',auth[_0x222a('0xa')](),controller[_0x222a('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 81b6e53..df414e7 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x4ccb98,_0x50bbf6){var _0x2385aa=function(_0x40c1e5){while(--_0x40c1e5){_0x4ccb98['push'](_0x4ccb98['shift']());}};_0x2385aa(++_0x50bbf6);}(_0x98a8,0x12c));var _0x898a=function(_0x5ed353,_0x1dff87){_0x5ed353=_0x5ed353-0x0;var _0x59f15f=_0x98a8[_0x5ed353];return _0x59f15f;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5df5e8,_0x1eff29){_0x5df5e8=_0x5df5e8-0x0;var _0x4954b5=_0xdc97[_0x5df5e8];return _0x4954b5;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index dd9c5fa..1066d8d 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 _0x3aee=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','dbH','sendStatus','end','status','offset','undefined','count','limit','json','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','MetricId','metric','field','function','replace','format','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','value','Please\x20insert\x20at\x20least\x20one\x20field','select','from','groupBy','clone','web','%s-%s.%s','randomstring','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','runReport','AVG(%s)','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware'];(function(_0x492375,_0xcdc033){var _0x507fd7=function(_0x184211){while(--_0x184211){_0x492375['push'](_0x492375['shift']());}};_0x507fd7(++_0xcdc033);}(_0x3aee,0x131));var _0xe3ae=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x3aee[_0x255ac0];return _0x437bf1;};'use strict';var emlformat=require(_0xe3ae('0x0'));var rimraf=require(_0xe3ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3ae('0x2'));var rp=require(_0xe3ae('0x3'));var moment=require(_0xe3ae('0x4'));var BPromise=require(_0xe3ae('0x5'));var Mustache=require(_0xe3ae('0x6'));var util=require(_0xe3ae('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe3ae('0x8'));var ejs=require(_0xe3ae('0x9'));var fs=require('fs');var fs_extra=require(_0xe3ae('0xa'));var _=require(_0xe3ae('0xb'));var squel=require(_0xe3ae('0xc'));var crypto=require(_0xe3ae('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe3ae('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe3ae('0xf'));var Papa=require(_0xe3ae('0x10'));var Redis=require(_0xe3ae('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3ae('0x12'));var logger=require(_0xe3ae('0x13'))(_0xe3ae('0x14'));var utils=require(_0xe3ae('0x15'));var config=require(_0xe3ae('0x16'));var licenseUtil=require(_0xe3ae('0x17'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xe3ae('0x18')];function respondWithStatusCode(_0x3b4915,_0x51fb1d){_0x51fb1d=_0x51fb1d||0xcc;return function(_0x4c07b6){if(_0x4c07b6){return _0x3b4915[_0xe3ae('0x19')](_0x51fb1d);}return _0x3b4915['status'](_0x51fb1d)[_0xe3ae('0x1a')]();};}function respondWithResult(_0x16eb0d,_0x6ecd9b){_0x6ecd9b=_0x6ecd9b||0xc8;return function(_0x22c790){if(_0x22c790){return _0x16eb0d[_0xe3ae('0x1b')](_0x6ecd9b)['json'](_0x22c790);}};}function respondWithFilteredResult(_0xc17690,_0x4b5826){return function(_0x4e505a){if(_0x4e505a){var _0x34ba70=typeof _0x4b5826[_0xe3ae('0x1c')]===_0xe3ae('0x1d')&&typeof _0x4b5826['limit']===_0xe3ae('0x1d');var _0x1cd220=_0x4e505a['count'];var _0x34f11f=_0x34ba70?0x0:_0x4b5826['offset'];var _0x3522c0=_0x34ba70?_0x4e505a[_0xe3ae('0x1e')]:_0x4b5826[_0xe3ae('0x1c')]+_0x4b5826[_0xe3ae('0x1f')];var _0x2272c0;if(_0x3522c0>=_0x1cd220){_0x3522c0=_0x1cd220;_0x2272c0=0xc8;}else{_0x2272c0=0xce;}_0xc17690[_0xe3ae('0x1b')](_0x2272c0);return _0xc17690['set']('Content-Range',_0x34f11f+'-'+_0x3522c0+'/'+_0x1cd220)[_0xe3ae('0x20')](_0x4e505a);}return null;};}function patchUpdates(_0x45b2c4){return function(_0x42ce83){try{jsonpatch['apply'](_0x42ce83,_0x45b2c4,!![]);}catch(_0x28b092){return BPromise[_0xe3ae('0x21')](_0x28b092);}return _0x42ce83[_0xe3ae('0x22')]();};}function saveUpdates(_0x14aa59,_0x2b07e8){return function(_0x451ec1){if(_0x451ec1){return _0x451ec1[_0xe3ae('0x23')](_0x14aa59)[_0xe3ae('0x24')](function(_0x42b68f){return _0x42b68f;});}return null;};}function removeEntity(_0x36225b,_0x56b4f2){return function(_0x9e7ce0){if(_0x9e7ce0){return _0x9e7ce0[_0xe3ae('0x25')]()[_0xe3ae('0x24')](function(){var _0x5c1efa=_0x9e7ce0[_0xe3ae('0x26')]({'plain':!![]});var _0x2eaeed=_0xe3ae('0x27');return db[_0xe3ae('0x28')]['destroy']({'where':{'type':_0x2eaeed,'resourceId':_0x5c1efa['id']}})[_0xe3ae('0x24')](function(){return _0x9e7ce0;});})[_0xe3ae('0x24')](function(){_0x36225b[_0xe3ae('0x1b')](0xcc)[_0xe3ae('0x1a')]();});}};}function handleEntityNotFound(_0x52b822,_0x4c0a5c){return function(_0x156b78){if(!_0x156b78){_0x52b822[_0xe3ae('0x19')](0x194);}return _0x156b78;};}function handleError(_0x2ed03a,_0x540bd5){_0x540bd5=_0x540bd5||0x1f4;return function(_0x3d67e1){logger['error'](_0x3d67e1[_0xe3ae('0x29')]);if(_0x3d67e1['name']){delete _0x3d67e1[_0xe3ae('0x2a')];}_0x2ed03a[_0xe3ae('0x1b')](_0x540bd5)[_0xe3ae('0x2b')](_0x3d67e1);};}exports[_0xe3ae('0x2c')]=function(_0x2d5b70,_0x99520e){var _0x312454={},_0x26f52e={},_0x234c08={'count':0x0,'rows':[]};var _0x14d09d=_[_0xe3ae('0x2d')](db[_0xe3ae('0x2e')][_0xe3ae('0x2f')],function(_0x265f8e){return{'name':_0x265f8e['fieldName'],'type':_0x265f8e[_0xe3ae('0x30')][_0xe3ae('0x31')]};});_0x26f52e[_0xe3ae('0x32')]=_['map'](_0x14d09d,'name');_0x26f52e[_0xe3ae('0x33')]=_['keys'](_0x2d5b70[_0xe3ae('0x33')]);_0x26f52e[_0xe3ae('0x34')]=_[_0xe3ae('0x35')](_0x26f52e['model'],_0x26f52e[_0xe3ae('0x33')]);_0x312454[_0xe3ae('0x36')]=_[_0xe3ae('0x35')](_0x26f52e[_0xe3ae('0x32')],qs[_0xe3ae('0x37')](_0x2d5b70[_0xe3ae('0x33')]['fields']));_0x312454[_0xe3ae('0x36')]=_0x312454[_0xe3ae('0x36')][_0xe3ae('0x38')]?_0x312454[_0xe3ae('0x36')]:_0x26f52e[_0xe3ae('0x32')];if(!_0x2d5b70['query']['hasOwnProperty'](_0xe3ae('0x39'))){_0x312454[_0xe3ae('0x1f')]=qs[_0xe3ae('0x1f')](_0x2d5b70[_0xe3ae('0x33')][_0xe3ae('0x1f')]);_0x312454[_0xe3ae('0x1c')]=qs[_0xe3ae('0x1c')](_0x2d5b70[_0xe3ae('0x33')][_0xe3ae('0x1c')]);}_0x312454['order']=qs[_0xe3ae('0x3a')](_0x2d5b70['query'][_0xe3ae('0x3a')]);_0x312454[_0xe3ae('0x3b')]=qs[_0xe3ae('0x34')](_[_0xe3ae('0x3c')](_0x2d5b70[_0xe3ae('0x33')],_0x26f52e[_0xe3ae('0x34')]),_0x14d09d);if(_0x2d5b70[_0xe3ae('0x33')]['filter']){_0x312454[_0xe3ae('0x3b')]=_[_0xe3ae('0x3d')](_0x312454[_0xe3ae('0x3b')],{'$or':_[_0xe3ae('0x2d')](_0x14d09d,function(_0x2271a1){if(_0x2271a1[_0xe3ae('0x30')]!==_0xe3ae('0x3e')){var _0x83b798={};_0x83b798[_0x2271a1[_0xe3ae('0x2a')]]={'$like':'%'+_0x2d5b70[_0xe3ae('0x33')]['filter']+'%'};return _0x83b798;}})});}_0x312454=_[_0xe3ae('0x3d')]({},_0x312454,_0x2d5b70['options']);var _0x151fa6={'where':_0x312454[_0xe3ae('0x3b')]};return db[_0xe3ae('0x2e')][_0xe3ae('0x1e')](_0x151fa6)['then'](function(_0x27080f){_0x234c08[_0xe3ae('0x1e')]=_0x27080f;if(_0x2d5b70[_0xe3ae('0x33')][_0xe3ae('0x3f')]){_0x312454[_0xe3ae('0x40')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xe3ae('0x41')](_0x312454);})[_0xe3ae('0x24')](function(_0x38d643){_0x234c08['rows']=_0x38d643;return _0x234c08;})[_0xe3ae('0x24')](respondWithFilteredResult(_0x99520e,_0x312454))[_0xe3ae('0x42')](handleError(_0x99520e,null));};exports['show']=function(_0x3e2de9,_0x28f8eb){var _0x5b00a9={'raw':![],'where':{'id':_0x3e2de9[_0xe3ae('0x43')]['id']}},_0xcbd164={};_0xcbd164[_0xe3ae('0x32')]=_['keys'](db['AnalyticCustomReport']['rawAttributes']);_0xcbd164['query']=_[_0xe3ae('0x44')](_0x3e2de9[_0xe3ae('0x33')]);_0xcbd164[_0xe3ae('0x34')]=_['intersection'](_0xcbd164['model'],_0xcbd164['query']);_0x5b00a9[_0xe3ae('0x36')]=_[_0xe3ae('0x35')](_0xcbd164['model'],qs[_0xe3ae('0x37')](_0x3e2de9[_0xe3ae('0x33')][_0xe3ae('0x37')]));_0x5b00a9[_0xe3ae('0x36')]=_0x5b00a9['attributes'][_0xe3ae('0x38')]?_0x5b00a9['attributes']:_0xcbd164['model'];if(_0x3e2de9[_0xe3ae('0x33')][_0xe3ae('0x3f')]){_0x5b00a9['include']=[{'all':!![]}];}_0x5b00a9=_[_0xe3ae('0x3d')]({},_0x5b00a9,_0x3e2de9[_0xe3ae('0x45')]);return db[_0xe3ae('0x2e')]['find'](_0x5b00a9)['then'](handleEntityNotFound(_0x28f8eb,null))[_0xe3ae('0x24')](respondWithResult(_0x28f8eb,null))[_0xe3ae('0x42')](handleError(_0x28f8eb,null));};exports['create']=function(_0x206234,_0x11681f){return db['AnalyticCustomReport'][_0xe3ae('0x46')](_0x206234[_0xe3ae('0x47')],{})['then'](function(_0x46bc95){var _0x41f07d=_0x206234['user'][_0xe3ae('0x26')]({'plain':!![]});if(!_0x41f07d)throw new Error(_0xe3ae('0x48'));if(_0x41f07d[_0xe3ae('0x49')]==='user'){var _0x42e987=_0x46bc95[_0xe3ae('0x26')]({'plain':!![]});var _0x2b1c17=_0xe3ae('0x4a');return db[_0xe3ae('0x4b')][_0xe3ae('0x4c')]({'where':{'name':_0x2b1c17,'userProfileId':_0x41f07d[_0xe3ae('0x4d')]},'raw':!![]})['then'](function(_0x59fd0e){if(_0x59fd0e&&_0x59fd0e['autoAssociation']===0x0){return db[_0xe3ae('0x28')][_0xe3ae('0x46')]({'name':_0x42e987['name'],'resourceId':_0x42e987['id'],'type':_0xe3ae('0x27'),'sectionId':_0x59fd0e['id']},{})['then'](function(){return _0x46bc95;});}else{return _0x46bc95;}})[_0xe3ae('0x42')](function(_0x1dd124){logger['error'](_0xe3ae('0x4e'),_0x1dd124);throw _0x1dd124;});}return _0x46bc95;})[_0xe3ae('0x24')](respondWithResult(_0x11681f,0xc9))[_0xe3ae('0x42')](handleError(_0x11681f,null));};exports[_0xe3ae('0x23')]=function(_0xe599a7,_0x3cf9e6){if(_0xe599a7[_0xe3ae('0x47')]['id']){delete _0xe599a7[_0xe3ae('0x47')]['id'];}return db[_0xe3ae('0x2e')]['find']({'where':{'id':_0xe599a7['params']['id']}})[_0xe3ae('0x24')](handleEntityNotFound(_0x3cf9e6,null))[_0xe3ae('0x24')](saveUpdates(_0xe599a7[_0xe3ae('0x47')],null))[_0xe3ae('0x24')](respondWithResult(_0x3cf9e6,null))[_0xe3ae('0x42')](handleError(_0x3cf9e6,null));};exports[_0xe3ae('0x25')]=function(_0x37737e,_0x3c0fca){return db[_0xe3ae('0x2e')][_0xe3ae('0x4c')]({'where':{'id':_0x37737e[_0xe3ae('0x43')]['id']}})[_0xe3ae('0x24')](handleEntityNotFound(_0x3c0fca,null))[_0xe3ae('0x24')](removeEntity(_0x3c0fca,null))[_0xe3ae('0x42')](handleError(_0x3c0fca,null));};exports['preview']=function(_0x40be3c,_0x1f03e9){var _0x21772e=0xa;var _0x52f49f=[_0xe3ae('0x4f'),_0xe3ae('0x50'),'right_join',_0xe3ae('0x51')];var _0x47a824={'SUM':_0xe3ae('0x52'),'COUNT':_0xe3ae('0x53'),'COUNT DISTINCT':_0xe3ae('0x54'),'MAX':'MAX(%s)','MIN':_0xe3ae('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe3ae('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe3ae('0x57')};var _0x1a889e={'SEC_TO_TIME':_0xe3ae('0x58'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xe3ae('0x59'),'UNIX_TIMESTAMP':_0xe3ae('0x5a')};var _0x58f361=function(_0x4d8daf){return!_[_0xe3ae('0x5b')](['IS\x20NULL',_0xe3ae('0x5c'),_0xe3ae('0x5d'),'IS\x20NOT\x20EMPTY'],_0x4d8daf);};var _0x454160=function(_0x34e85f){if(!_0x34e85f||!_0x34e85f[_0xe3ae('0x5e')][_0xe3ae('0x38')]){return'';}for(var _0x4b153d='(',_0x21b6bf=0x0;_0x21b6bf<_0x34e85f['rules'][_0xe3ae('0x38')];_0x21b6bf+=0x1){_0x21b6bf>0x0&&(_0x4b153d+='\x20'+_0x34e85f[_0xe3ae('0x5f')]+'\x20');_0x4b153d+=_0x34e85f['rules'][_0x21b6bf][_0xe3ae('0x60')]?_0x454160(_0x34e85f['rules'][_0x21b6bf]['group']):_0x34e85f['rules'][_0x21b6bf]['field']+'\x20'+_0x34e85f[_0xe3ae('0x5e')][_0x21b6bf][_0xe3ae('0x61')]+(_0x58f361(_0x34e85f[_0xe3ae('0x5e')][_0x21b6bf][_0xe3ae('0x61')])?'\x20'+_0x34e85f[_0xe3ae('0x5e')][_0x21b6bf]['value']:'');}return _0x4b153d+')';};var _0x226533={'where':{'id':_0x40be3c[_0xe3ae('0x43')]['id']}},_0x170745,_0x1c63ed,_0x4f2671,_0x6b7d1e,_0x5d8fb0;_0x226533=_[_0xe3ae('0x3d')]({},_0x226533,_0x40be3c[_0xe3ae('0x45')]);return db['AnalyticCustomReport'][_0xe3ae('0x4c')](_0x226533)['then'](function(_0x46ecf3){if(_0x46ecf3){_0x170745=_0x46ecf3;return _0x46ecf3['getFields']();}return null;})[_0xe3ae('0x24')](function(_0xc54a58){if(_0xc54a58){if(!_0xc54a58[_0xe3ae('0x38')]){throw new db[(_0xe3ae('0x62'))][(_0xe3ae('0x63'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1c63ed=_0xc54a58;return db[_0xe3ae('0x64')][_0xe3ae('0x41')]({'raw':!![]});}return null;})[_0xe3ae('0x24')](function(_0x6c558b){if(_0x6c558b){_0x4f2671=_[_0xe3ae('0x65')](_0x6c558b,'id');var _0x3041b3;var _0x1e0703=squel['select']();_0x1e0703['from'](_0x170745['table']);for(var _0x293345=0x0;_0x293345<_0x1c63ed['length'];_0x293345+=0x1){_0x3041b3=_0x1c63ed[_0x293345][_0xe3ae('0x66')]?_0x4f2671[_0x1c63ed[_0x293345][_0xe3ae('0x66')]][_0xe3ae('0x67')]:_0x1c63ed[_0x293345][_0xe3ae('0x68')];_0x3041b3=_0x1c63ed[_0x293345][_0xe3ae('0x69')]?_[_0xe3ae('0x6a')](_0x47a824[_0x1c63ed[_0x293345][_0xe3ae('0x69')]],'%s',_0x3041b3):_0x3041b3;_0x3041b3=_0x1c63ed[_0x293345][_0xe3ae('0x6b')]?_[_0xe3ae('0x6a')](_0x1a889e[_0x1c63ed[_0x293345]['format']],'%s',_0x3041b3):_0x3041b3;if(_0x1c63ed[_0x293345]['groupBy']){_0x1e0703['group'](_0x3041b3);}_0x1c63ed[_0x293345][_0xe3ae('0x6c')]&&_0x1e0703[_0xe3ae('0x6d')](_0x3041b3,_0x1c63ed[_0x293345][_0xe3ae('0x6c')]===_0xe3ae('0x6e')?![]:!![]);_0x1e0703[_0xe3ae('0x68')](_0x3041b3,_0x1c63ed[_0x293345][_0xe3ae('0x6f')]||_0x3041b3);}if(_0x170745[_0xe3ae('0x70')]){_0x170745[_0xe3ae('0x70')]=JSON[_0xe3ae('0x71')](_0x170745[_0xe3ae('0x70')]);for(var _0x40bf63=0x0;_0x40bf63<_0x170745[_0xe3ae('0x70')][_0xe3ae('0x38')];_0x40bf63+=0x1){if(_0x170745[_0xe3ae('0x70')][_0x40bf63][_0xe3ae('0x30')]&&_[_0xe3ae('0x5b')](_0x52f49f,_0x170745[_0xe3ae('0x70')][_0x40bf63]['type'])&&_0x170745[_0xe3ae('0x70')][_0x40bf63][_0xe3ae('0x72')]&&_0x170745[_0xe3ae('0x70')][_0x40bf63][_0xe3ae('0x73')]&&_0x170745[_0xe3ae('0x70')][_0x40bf63]['foreignKey']){_0x1e0703[_0x170745[_0xe3ae('0x70')][_0x40bf63][_0xe3ae('0x30')]](_0x170745['joins'][_0x40bf63]['foreignTable'],null,util[_0xe3ae('0x6b')](_0xe3ae('0x74'),_0x170745[_0xe3ae('0x75')],_0x170745['joins'][_0x40bf63][_0xe3ae('0x72')],_0x170745[_0xe3ae('0x70')][_0x40bf63][_0xe3ae('0x73')],_0x170745[_0xe3ae('0x70')][_0x40bf63][_0xe3ae('0x76')]));}}}if(_0x170745[_0xe3ae('0x77')]){_0x170745[_0xe3ae('0x77')]=JSON[_0xe3ae('0x71')](_0x170745[_0xe3ae('0x77')]);_0x1e0703['where'](_0x454160(_0x170745[_0xe3ae('0x77')][_0xe3ae('0x60')]));}_0x5d8fb0=_0x1e0703['clone']();_0x1e0703[_0xe3ae('0x1f')](_0x21772e);_0x1e0703['offset'](0x0);logger[_0xe3ae('0x78')](_0xe3ae('0x79'),_0x1e0703[_0xe3ae('0x7a')]());return dbH['sequelize']['query'](_0x1e0703[_0xe3ae('0x7a')](),{'type':dbH[_0xe3ae('0x7b')][_0xe3ae('0x7c')][_0xe3ae('0x7d')]});}})[_0xe3ae('0x24')](respondWithResult(_0x1f03e9,null))[_0xe3ae('0x42')](handleError(_0x1f03e9,null));};function runReport(_0x5dc21d,_0x390a2a,_0x35aeac){var _0x30824a=_0x390a2a['name'];var _0x5cbabe=0xa;var _0x5aba03=[_0xe3ae('0x4f'),_0xe3ae('0x50'),_0xe3ae('0x7e'),_0xe3ae('0x51')];var _0x58e092={'SUM':_0xe3ae('0x52'),'COUNT':_0xe3ae('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe3ae('0x7f'),'MIN':_0xe3ae('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe3ae('0x80'),'GROUP_CONCAT DESC':_0xe3ae('0x57')};var _0xe139a6={'SEC_TO_TIME':_0xe3ae('0x58'),'DATE':_0xe3ae('0x81'),'HOUR':_0xe3ae('0x82'),'ROUND':_0xe3ae('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1e8e29=function(_0x167eb3){return!_[_0xe3ae('0x5b')]([_0xe3ae('0x83'),_0xe3ae('0x5c'),_0xe3ae('0x5d'),_0xe3ae('0x84')],_0x167eb3);};var _0x379986=function(_0x4f0532){if(!_0x4f0532||!_0x4f0532['rules'][_0xe3ae('0x38')]){return'';}for(var _0x2c54e7='(',_0x3ad5ca=0x0;_0x3ad5ca<_0x4f0532['rules'][_0xe3ae('0x38')];_0x3ad5ca+=0x1){_0x3ad5ca>0x0&&(_0x2c54e7+='\x20'+_0x4f0532[_0xe3ae('0x5f')]+'\x20');_0x2c54e7+=_0x4f0532[_0xe3ae('0x5e')][_0x3ad5ca][_0xe3ae('0x60')]?_0x379986(_0x4f0532[_0xe3ae('0x5e')][_0x3ad5ca]['group']):_0x4f0532[_0xe3ae('0x5e')][_0x3ad5ca]['field']+'\x20'+_0x4f0532[_0xe3ae('0x5e')][_0x3ad5ca][_0xe3ae('0x61')]+(_0x1e8e29(_0x4f0532[_0xe3ae('0x5e')][_0x3ad5ca]['condition'])?'\x20'+_0x4f0532[_0xe3ae('0x5e')][_0x3ad5ca][_0xe3ae('0x85')]:'');}return _0x2c54e7+')';};var _0x4164bd={'where':{'id':_0x5dc21d['id']}},_0x5eb360,_0x55e634,_0x5070b0,_0x3ffab1,_0x1e9b60;_0x4164bd=_[_0xe3ae('0x3d')]({},_0x4164bd,_0x35aeac);return db[_0xe3ae('0x2e')][_0xe3ae('0x4c')](_0x4164bd)[_0xe3ae('0x24')](function(_0x4cb140){if(_0x4cb140){_0x5eb360=_0x4cb140;return _0x4cb140['getFields']();}return null;})[_0xe3ae('0x24')](function(_0x9b68fb){if(_0x9b68fb){if(!_0x9b68fb['length']){throw new db[(_0xe3ae('0x62'))]['ValidationErrorItem'](_0xe3ae('0x86'),0x193);}_0x55e634=_0x9b68fb;return db[_0xe3ae('0x64')][_0xe3ae('0x41')]({'raw':!![]});}return null;})[_0xe3ae('0x24')](function(_0x405609){if(_0x405609){_0x5070b0=_[_0xe3ae('0x65')](_0x405609,'id');var _0x5381ee;var _0xaf2da4=squel[_0xe3ae('0x87')]();_0xaf2da4[_0xe3ae('0x88')](_0x5eb360[_0xe3ae('0x75')]);for(var _0x40e21d=0x0;_0x40e21d<_0x55e634[_0xe3ae('0x38')];_0x40e21d+=0x1){_0x5381ee=_0x55e634[_0x40e21d][_0xe3ae('0x66')]?_0x5070b0[_0x55e634[_0x40e21d]['MetricId']][_0xe3ae('0x67')]:_0x55e634[_0x40e21d][_0xe3ae('0x68')];_0x5381ee=_0x55e634[_0x40e21d]['function']?_[_0xe3ae('0x6a')](_0x58e092[_0x55e634[_0x40e21d][_0xe3ae('0x69')]],'%s',_0x5381ee):_0x5381ee;_0x5381ee=_0x55e634[_0x40e21d]['format']?_[_0xe3ae('0x6a')](_0xe139a6[_0x55e634[_0x40e21d][_0xe3ae('0x6b')]],'%s',_0x5381ee):_0x5381ee;if(_0x55e634[_0x40e21d][_0xe3ae('0x89')]){_0xaf2da4[_0xe3ae('0x60')](_0x5381ee);}_0x55e634[_0x40e21d]['orderBy']&&_0xaf2da4['order'](_0x5381ee,_0x55e634[_0x40e21d]['orderBy']==='DESC'?![]:!![]);_0xaf2da4[_0xe3ae('0x68')](_0x5381ee,_0x55e634[_0x40e21d][_0xe3ae('0x6f')]||_0x5381ee);}if(_0x5eb360[_0xe3ae('0x70')]){_0x5eb360['joins']=JSON['parse'](_0x5eb360[_0xe3ae('0x70')]);for(var _0x40c6c0=0x0;_0x40c6c0<_0x5eb360[_0xe3ae('0x70')][_0xe3ae('0x38')];_0x40c6c0+=0x1){if(_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x30')]&&_[_0xe3ae('0x5b')](_0x5aba03,_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x30')])&&_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x72')]&&_0x5eb360[_0xe3ae('0x70')][_0x40c6c0]['foreignTable']&&_0x5eb360[_0xe3ae('0x70')][_0x40c6c0]['foreignKey']){_0xaf2da4[_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x30')]](_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x73')],null,util[_0xe3ae('0x6b')](_0xe3ae('0x74'),_0x5eb360['table'],_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x72')],_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x73')],_0x5eb360[_0xe3ae('0x70')][_0x40c6c0][_0xe3ae('0x76')]));}}}if(_0x5eb360[_0xe3ae('0x77')]){_0x5eb360[_0xe3ae('0x77')]=JSON[_0xe3ae('0x71')](_0x5eb360[_0xe3ae('0x77')]);_0xaf2da4['where'](_0x379986(_0x5eb360[_0xe3ae('0x77')]['group']));}_0x1e9b60=_0xaf2da4[_0xe3ae('0x8a')]();_0xaf2da4[_0xe3ae('0x1f')](_0x5cbabe);_0xaf2da4[_0xe3ae('0x1c')](0x0);return;}})['then'](function(){if(_0x390a2a['output']===_0xe3ae('0x8b')){return null;}var _0x136196=_[_0xe3ae('0x3d')](_0x390a2a,{'name':_0x390a2a['fullPath']||_0x390a2a[_0xe3ae('0x2a')]||_0x5eb360[_0xe3ae('0x2a')],'basename':_0x30824a,'savename':util[_0xe3ae('0x6b')](_0xe3ae('0x8c'),_0x390a2a[_0xe3ae('0x2a')]||_0x5eb360[_0xe3ae('0x2a')],require(_0xe3ae('0x8d'))[_0xe3ae('0x8e')](0x4),_0x390a2a[_0xe3ae('0x8f')]||_0xe3ae('0x90')),'reportId':_0x5eb360['id'],'reportType':'custom'});return db[_0xe3ae('0x91')]['create'](_0x136196,{'raw':!![]});})[_0xe3ae('0x24')](function(_0x1ce822){if(_0x5eb360[_0xe3ae('0x75')]===_0xe3ae('0x92')){_0x1e9b60[_0xe3ae('0x3b')](_0x5eb360[_0xe3ae('0x75')]+_0xe3ae('0x93'),_0x390a2a[_0xe3ae('0x94')],_0x390a2a[_0xe3ae('0x95')]);}else{_0x1e9b60[_0xe3ae('0x3b')](_0x5eb360[_0xe3ae('0x75')]+_0xe3ae('0x96'),_0x390a2a[_0xe3ae('0x94')],_0x390a2a[_0xe3ae('0x95')]);}if(_0x1ce822){logger[_0xe3ae('0x97')](_0xe3ae('0x98'),_0x1e9b60[_0xe3ae('0x7a')]());require(_0xe3ae('0x99'))[_0xe3ae('0x9a')](path['join'](__dirname,_0xe3ae('0x9b'),_0x1ce822[_0xe3ae('0x8f')]),[_0x1ce822['id'],_0x1e9b60[_0xe3ae('0x7a')](),path[_0xe3ae('0x4f')](__dirname,_0xe3ae('0x9c'),_0x1ce822[_0xe3ae('0x9d')]),_0x30824a]);return _0x1ce822;}else{var _0x341ffd=squel[_0xe3ae('0x87')]();_0x341ffd[_0xe3ae('0x88')]('('+_0x1e9b60['toString']()+')',_0xe3ae('0x9e'));_0x341ffd[_0xe3ae('0x68')]('COUNT(*)',_0xe3ae('0x1e'));_0x1e9b60[_0xe3ae('0x1f')](_0x390a2a[_0xe3ae('0x1f')]||_0x5cbabe);_0x1e9b60[_0xe3ae('0x1c')](_0x390a2a['offset']||0x0);return dbH[_0xe3ae('0x7b')][_0xe3ae('0x33')](_0x341ffd[_0xe3ae('0x7a')](),{'type':dbH[_0xe3ae('0x7b')][_0xe3ae('0x7c')][_0xe3ae('0x7d')]})[_0xe3ae('0x24')](function(_0xfe9e73){if(!_0xfe9e73['length']){_0x3ffab1=0x0;}else{_0x3ffab1=_0xfe9e73[0x0][_0xe3ae('0x1e')]||0x0;}return dbH[_0xe3ae('0x7b')][_0xe3ae('0x33')](_0x1e9b60['toString'](),{'type':dbH[_0xe3ae('0x7b')]['QueryTypes'][_0xe3ae('0x7d')]});})[_0xe3ae('0x24')](function(_0x2d23a9){return{'rows':_0x2d23a9||[],'count':_0x3ffab1};});}});}exports['run']=function(_0x323040,_0x1563f8){return runReport(_0x323040['params'],_0x323040[_0xe3ae('0x33')],_0x323040[_0xe3ae('0x45')])['then'](respondWithResult(_0x1563f8,null))[_0xe3ae('0x42')](handleError(_0x1563f8,null));};exports[_0xe3ae('0x9f')]=runReport;exports[_0xe3ae('0x33')]=function(_0x9d3d22,_0x3c3d81){var _0x5b5042=0xa;var _0x4785ea=[_0xe3ae('0x4f'),_0xe3ae('0x50'),_0xe3ae('0x7e'),_0xe3ae('0x51')];var _0x4f394c={'SUM':_0xe3ae('0x52'),'COUNT':_0xe3ae('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe3ae('0x7f'),'MIN':_0xe3ae('0x55'),'AVG':_0xe3ae('0xa0'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe3ae('0x80'),'GROUP_CONCAT DESC':_0xe3ae('0x57')};var _0x84d115={'SEC_TO_TIME':_0xe3ae('0x58'),'DATE':_0xe3ae('0x81'),'HOUR':_0xe3ae('0x82'),'ROUND':_0xe3ae('0x59'),'UNIX_TIMESTAMP':_0xe3ae('0x5a')};var _0x5a7f29=function(_0x5431e5){return!_[_0xe3ae('0x5b')]([_0xe3ae('0x83'),_0xe3ae('0x5c'),'IS\x20EMPTY',_0xe3ae('0x84')],_0x5431e5);};var _0x2c2e8e=function(_0x22c379){if(!_0x22c379||!_0x22c379[_0xe3ae('0x5e')][_0xe3ae('0x38')]){return'';}for(var _0xb8869d='(',_0x3be6cb=0x0;_0x3be6cb<_0x22c379[_0xe3ae('0x5e')][_0xe3ae('0x38')];_0x3be6cb+=0x1){_0x3be6cb>0x0&&(_0xb8869d+='\x20'+_0x22c379[_0xe3ae('0x5f')]+'\x20');_0xb8869d+=_0x22c379[_0xe3ae('0x5e')][_0x3be6cb][_0xe3ae('0x60')]?_0x2c2e8e(_0x22c379[_0xe3ae('0x5e')][_0x3be6cb][_0xe3ae('0x60')]):_0x22c379[_0xe3ae('0x5e')][_0x3be6cb][_0xe3ae('0x68')]+'\x20'+_0x22c379[_0xe3ae('0x5e')][_0x3be6cb][_0xe3ae('0x61')]+(_0x5a7f29(_0x22c379['rules'][_0x3be6cb][_0xe3ae('0x61')])?'\x20'+_0x22c379['rules'][_0x3be6cb]['value']:'');}return _0xb8869d+')';};var _0x158a85={'where':{'id':_0x9d3d22['params']['id']}},_0x32bb6d,_0x2094c7,_0x2588ef,_0x6c6485,_0x2f3702;_0x158a85=_['merge']({},_0x158a85,_0x9d3d22['options']);return db['AnalyticCustomReport'][_0xe3ae('0x4c')](_0x158a85)[_0xe3ae('0x24')](function(_0x441e52){if(_0x441e52){_0x32bb6d=_0x441e52;return _0x441e52[_0xe3ae('0xa1')]();}return null;})[_0xe3ae('0x24')](function(_0x3898a0){if(_0x3898a0){if(!_0x3898a0[_0xe3ae('0x38')]){throw new db[(_0xe3ae('0x62'))][(_0xe3ae('0x63'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2094c7=_0x3898a0;return db[_0xe3ae('0x64')][_0xe3ae('0x41')]({'raw':!![]});}return null;})[_0xe3ae('0x24')](function(_0x201400){if(_0x201400){_0x2588ef=_[_0xe3ae('0x65')](_0x201400,'id');var _0x3fb853;var _0x401da5=squel[_0xe3ae('0x87')]();_0x401da5['from'](_0x32bb6d[_0xe3ae('0x75')]);for(var _0x8c8dd0=0x0;_0x8c8dd0<_0x2094c7[_0xe3ae('0x38')];_0x8c8dd0+=0x1){_0x3fb853=_0x2094c7[_0x8c8dd0][_0xe3ae('0x66')]?_0x2588ef[_0x2094c7[_0x8c8dd0][_0xe3ae('0x66')]][_0xe3ae('0x67')]:_0x2094c7[_0x8c8dd0][_0xe3ae('0x68')];_0x3fb853=_0x2094c7[_0x8c8dd0]['function']?_[_0xe3ae('0x6a')](_0x4f394c[_0x2094c7[_0x8c8dd0][_0xe3ae('0x69')]],'%s',_0x3fb853):_0x3fb853;_0x3fb853=_0x2094c7[_0x8c8dd0]['format']?_[_0xe3ae('0x6a')](_0x84d115[_0x2094c7[_0x8c8dd0]['format']],'%s',_0x3fb853):_0x3fb853;if(_0x2094c7[_0x8c8dd0]['groupBy']){_0x401da5[_0xe3ae('0x60')](_0x3fb853);}_0x2094c7[_0x8c8dd0][_0xe3ae('0x6c')]&&_0x401da5[_0xe3ae('0x6d')](_0x3fb853,_0x2094c7[_0x8c8dd0][_0xe3ae('0x6c')]===_0xe3ae('0x6e')?![]:!![]);_0x401da5['field'](_0x3fb853,_0x2094c7[_0x8c8dd0][_0xe3ae('0x6f')]||_0x3fb853);}if(_0x32bb6d['joins']){_0x32bb6d[_0xe3ae('0x70')]=JSON[_0xe3ae('0x71')](_0x32bb6d[_0xe3ae('0x70')]);for(var _0x4ebbd4=0x0;_0x4ebbd4<_0x32bb6d['joins'][_0xe3ae('0x38')];_0x4ebbd4+=0x1){if(_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4][_0xe3ae('0x30')]&&_['includes'](_0x4785ea,_0x32bb6d['joins'][_0x4ebbd4]['type'])&&_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4][_0xe3ae('0x72')]&&_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4]['foreignTable']&&_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4][_0xe3ae('0x76')]){_0x401da5[_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4][_0xe3ae('0x30')]](_0x32bb6d['joins'][_0x4ebbd4][_0xe3ae('0x73')],null,util[_0xe3ae('0x6b')](_0xe3ae('0x74'),_0x32bb6d[_0xe3ae('0x75')],_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4][_0xe3ae('0x72')],_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4]['foreignTable'],_0x32bb6d[_0xe3ae('0x70')][_0x4ebbd4][_0xe3ae('0x76')]));}}}if(_0x32bb6d[_0xe3ae('0x77')]){_0x32bb6d[_0xe3ae('0x77')]=JSON[_0xe3ae('0x71')](_0x32bb6d[_0xe3ae('0x77')]);_0x401da5['where'](_0x2c2e8e(_0x32bb6d['conditions'][_0xe3ae('0x60')]));}_0x2f3702=_0x401da5[_0xe3ae('0x8a')]();_0x401da5['limit'](_0x5b5042);_0x401da5[_0xe3ae('0x1c')](0x0);logger[_0xe3ae('0x78')](_0xe3ae('0x79'),_0x401da5[_0xe3ae('0x7a')]());return dbH[_0xe3ae('0x7b')]['query'](_0x401da5[_0xe3ae('0x7a')](),{'type':dbH['sequelize'][_0xe3ae('0x7c')][_0xe3ae('0x7d')]});}})[_0xe3ae('0x24')](function(){return{'sql':_0x2f3702[_0xe3ae('0x7a')]()};})[_0xe3ae('0x24')](respondWithResult(_0x3c3d81,null))[_0xe3ae('0x42')](handleError(_0x3c3d81,null));}; \ No newline at end of file +var _0xdee7=['right_join','cross_join','SUM(%s)','COUNT(%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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','type','includes','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','operator','ValidationErrorItem','%s.%s\x20=\x20%s.%s','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','countTable','COUNT(*)','run','runReport','ROUND(%s)','Sequelize','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','fields','length','find','create','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','left_join'];(function(_0x2e3153,_0x558652){var _0x12b2ab=function(_0x5e36fc){while(--_0x5e36fc){_0x2e3153['push'](_0x2e3153['shift']());}};_0x12b2ab(++_0x558652);}(_0xdee7,0xf1));var _0x7dee=function(_0x66a658,_0x592749){_0x66a658=_0x66a658-0x0;var _0x21331f=_0xdee7[_0x66a658];return _0x21331f;};'use strict';var emlformat=require(_0x7dee('0x0'));var rimraf=require(_0x7dee('0x1'));var zipdir=require(_0x7dee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dee('0x3'));var moment=require(_0x7dee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7dee('0x5'));var util=require(_0x7dee('0x6'));var path=require(_0x7dee('0x7'));var sox=require(_0x7dee('0x8'));var csv=require(_0x7dee('0x9'));var ejs=require(_0x7dee('0xa'));var fs=require('fs');var fs_extra=require(_0x7dee('0xb'));var _=require(_0x7dee('0xc'));var squel=require(_0x7dee('0xd'));var crypto=require(_0x7dee('0xe'));var jsforce=require(_0x7dee('0xf'));var deskjs=require(_0x7dee('0x10'));var toCsv=require(_0x7dee('0x9'));var querystring=require('querystring');var Papa=require(_0x7dee('0x11'));var Redis=require(_0x7dee('0x12'));var authService=require(_0x7dee('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7dee('0x14'))('api');var utils=require(_0x7dee('0x15'));var config=require(_0x7dee('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7dee('0x17'))['db'];var dbH=require(_0x7dee('0x17'))[_0x7dee('0x18')];function respondWithStatusCode(_0x15cab1,_0x3596e4){_0x3596e4=_0x3596e4||0xcc;return function(_0x52ed3){if(_0x52ed3){return _0x15cab1[_0x7dee('0x19')](_0x3596e4);}return _0x15cab1[_0x7dee('0x1a')](_0x3596e4)[_0x7dee('0x1b')]();};}function respondWithResult(_0xb158c0,_0x3cfc94){_0x3cfc94=_0x3cfc94||0xc8;return function(_0x461470){if(_0x461470){return _0xb158c0[_0x7dee('0x1a')](_0x3cfc94)['json'](_0x461470);}};}function respondWithFilteredResult(_0x1b39f1,_0xcfda31){return function(_0x15c3ab){if(_0x15c3ab){var _0xaff14f=typeof _0xcfda31[_0x7dee('0x1c')]===_0x7dee('0x1d')&&typeof _0xcfda31[_0x7dee('0x1e')]===_0x7dee('0x1d');var _0x1a8b0b=_0x15c3ab[_0x7dee('0x1f')];var _0x2352be=_0xaff14f?0x0:_0xcfda31[_0x7dee('0x1c')];var _0x55e8e7=_0xaff14f?_0x15c3ab[_0x7dee('0x1f')]:_0xcfda31[_0x7dee('0x1c')]+_0xcfda31['limit'];var _0x281558;if(_0x55e8e7>=_0x1a8b0b){_0x55e8e7=_0x1a8b0b;_0x281558=0xc8;}else{_0x281558=0xce;}_0x1b39f1[_0x7dee('0x1a')](_0x281558);return _0x1b39f1[_0x7dee('0x20')](_0x7dee('0x21'),_0x2352be+'-'+_0x55e8e7+'/'+_0x1a8b0b)[_0x7dee('0x22')](_0x15c3ab);}return null;};}function patchUpdates(_0x11e1af){return function(_0x136251){try{jsonpatch[_0x7dee('0x23')](_0x136251,_0x11e1af,!![]);}catch(_0x1be151){return BPromise[_0x7dee('0x24')](_0x1be151);}return _0x136251[_0x7dee('0x25')]();};}function saveUpdates(_0x4a57fd,_0x360214){return function(_0x3a5b0a){if(_0x3a5b0a){return _0x3a5b0a[_0x7dee('0x26')](_0x4a57fd)[_0x7dee('0x27')](function(_0x370b4e){return _0x370b4e;});}return null;};}function removeEntity(_0x4763d6,_0x526277){return function(_0x247528){if(_0x247528){return _0x247528['destroy']()['then'](function(){var _0x5af77b=_0x247528[_0x7dee('0x28')]({'plain':!![]});var _0xcd2c61=_0x7dee('0x29');return db[_0x7dee('0x2a')][_0x7dee('0x2b')]({'where':{'type':_0xcd2c61,'resourceId':_0x5af77b['id']}})[_0x7dee('0x27')](function(){return _0x247528;});})['then'](function(){_0x4763d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35ab7a,_0x237157){return function(_0x562477){if(!_0x562477){_0x35ab7a[_0x7dee('0x19')](0x194);}return _0x562477;};}function handleError(_0x52b9a7,_0x50a03f){_0x50a03f=_0x50a03f||0x1f4;return function(_0x4aa96f){logger['error'](_0x4aa96f[_0x7dee('0x2c')]);if(_0x4aa96f[_0x7dee('0x2d')]){delete _0x4aa96f[_0x7dee('0x2d')];}_0x52b9a7['status'](_0x50a03f)['send'](_0x4aa96f);};}exports[_0x7dee('0x2e')]=function(_0x432afb,_0x42a12e){var _0x5f4dc2={},_0x402933={},_0x483ad8={'count':0x0,'rows':[]};var _0x4688a7=_[_0x7dee('0x2f')](db[_0x7dee('0x30')][_0x7dee('0x31')],function(_0x23bd91){return{'name':_0x23bd91[_0x7dee('0x32')],'type':_0x23bd91['type']['key']};});_0x402933[_0x7dee('0x33')]=_[_0x7dee('0x2f')](_0x4688a7,'name');_0x402933[_0x7dee('0x34')]=_[_0x7dee('0x35')](_0x432afb[_0x7dee('0x34')]);_0x402933[_0x7dee('0x36')]=_[_0x7dee('0x37')](_0x402933['model'],_0x402933['query']);_0x5f4dc2[_0x7dee('0x38')]=_[_0x7dee('0x37')](_0x402933['model'],qs['fields'](_0x432afb[_0x7dee('0x34')]['fields']));_0x5f4dc2[_0x7dee('0x38')]=_0x5f4dc2['attributes']['length']?_0x5f4dc2[_0x7dee('0x38')]:_0x402933['model'];if(!_0x432afb[_0x7dee('0x34')]['hasOwnProperty']('nolimit')){_0x5f4dc2[_0x7dee('0x1e')]=qs[_0x7dee('0x1e')](_0x432afb['query'][_0x7dee('0x1e')]);_0x5f4dc2['offset']=qs[_0x7dee('0x1c')](_0x432afb['query'][_0x7dee('0x1c')]);}_0x5f4dc2[_0x7dee('0x39')]=qs['sort'](_0x432afb['query'][_0x7dee('0x3a')]);_0x5f4dc2[_0x7dee('0x3b')]=qs[_0x7dee('0x36')](_[_0x7dee('0x3c')](_0x432afb[_0x7dee('0x34')],_0x402933[_0x7dee('0x36')]),_0x4688a7);if(_0x432afb['query']['filter']){_0x5f4dc2[_0x7dee('0x3b')]=_['merge'](_0x5f4dc2['where'],{'$or':_[_0x7dee('0x2f')](_0x4688a7,function(_0x3f7722){if(_0x3f7722['type']!=='VIRTUAL'){var _0x25b912={};_0x25b912[_0x3f7722['name']]={'$like':'%'+_0x432afb[_0x7dee('0x34')][_0x7dee('0x3d')]+'%'};return _0x25b912;}})});}_0x5f4dc2=_[_0x7dee('0x3e')]({},_0x5f4dc2,_0x432afb[_0x7dee('0x3f')]);var _0x4e8857={'where':_0x5f4dc2['where']};return db['AnalyticCustomReport'][_0x7dee('0x1f')](_0x4e8857)['then'](function(_0x5ac8c1){_0x483ad8[_0x7dee('0x1f')]=_0x5ac8c1;if(_0x432afb['query'][_0x7dee('0x40')]){_0x5f4dc2[_0x7dee('0x41')]=[{'all':!![]}];}return db[_0x7dee('0x30')][_0x7dee('0x42')](_0x5f4dc2);})[_0x7dee('0x27')](function(_0x4b2904){_0x483ad8[_0x7dee('0x43')]=_0x4b2904;return _0x483ad8;})['then'](respondWithFilteredResult(_0x42a12e,_0x5f4dc2))[_0x7dee('0x44')](handleError(_0x42a12e,null));};exports['show']=function(_0x1aa69b,_0x9df904){var _0x23e4df={'raw':![],'where':{'id':_0x1aa69b['params']['id']}},_0x20e8d9={};_0x20e8d9[_0x7dee('0x33')]=_[_0x7dee('0x35')](db[_0x7dee('0x30')][_0x7dee('0x31')]);_0x20e8d9[_0x7dee('0x34')]=_[_0x7dee('0x35')](_0x1aa69b['query']);_0x20e8d9[_0x7dee('0x36')]=_[_0x7dee('0x37')](_0x20e8d9[_0x7dee('0x33')],_0x20e8d9[_0x7dee('0x34')]);_0x23e4df[_0x7dee('0x38')]=_[_0x7dee('0x37')](_0x20e8d9[_0x7dee('0x33')],qs[_0x7dee('0x45')](_0x1aa69b[_0x7dee('0x34')][_0x7dee('0x45')]));_0x23e4df[_0x7dee('0x38')]=_0x23e4df[_0x7dee('0x38')][_0x7dee('0x46')]?_0x23e4df[_0x7dee('0x38')]:_0x20e8d9[_0x7dee('0x33')];if(_0x1aa69b[_0x7dee('0x34')][_0x7dee('0x40')]){_0x23e4df[_0x7dee('0x41')]=[{'all':!![]}];}_0x23e4df=_[_0x7dee('0x3e')]({},_0x23e4df,_0x1aa69b['options']);return db[_0x7dee('0x30')][_0x7dee('0x47')](_0x23e4df)['then'](handleEntityNotFound(_0x9df904,null))['then'](respondWithResult(_0x9df904,null))[_0x7dee('0x44')](handleError(_0x9df904,null));};exports[_0x7dee('0x48')]=function(_0x1f895a,_0x1f796c){return db['AnalyticCustomReport'][_0x7dee('0x48')](_0x1f895a['body'],{})[_0x7dee('0x27')](function(_0x5746ae){var _0x79334a=_0x1f895a[_0x7dee('0x49')][_0x7dee('0x28')]({'plain':!![]});if(!_0x79334a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x79334a[_0x7dee('0x4a')]===_0x7dee('0x49')){var _0x50f182=_0x5746ae[_0x7dee('0x28')]({'plain':!![]});var _0x374f55=_0x7dee('0x4b');return db[_0x7dee('0x4c')][_0x7dee('0x47')]({'where':{'name':_0x374f55,'userProfileId':_0x79334a[_0x7dee('0x4d')]},'raw':!![]})[_0x7dee('0x27')](function(_0x35c36c){if(_0x35c36c&&_0x35c36c[_0x7dee('0x4e')]===0x0){return db['UserProfileResource'][_0x7dee('0x48')]({'name':_0x50f182[_0x7dee('0x2d')],'resourceId':_0x50f182['id'],'type':_0x7dee('0x29'),'sectionId':_0x35c36c['id']},{})[_0x7dee('0x27')](function(){return _0x5746ae;});}else{return _0x5746ae;}})['catch'](function(_0x27446f){logger['error'](_0x7dee('0x4f'),_0x27446f);throw _0x27446f;});}return _0x5746ae;})[_0x7dee('0x27')](respondWithResult(_0x1f796c,0xc9))[_0x7dee('0x44')](handleError(_0x1f796c,null));};exports['update']=function(_0x57a289,_0x21e871){if(_0x57a289['body']['id']){delete _0x57a289[_0x7dee('0x50')]['id'];}return db[_0x7dee('0x30')]['find']({'where':{'id':_0x57a289[_0x7dee('0x51')]['id']}})['then'](handleEntityNotFound(_0x21e871,null))[_0x7dee('0x27')](saveUpdates(_0x57a289['body'],null))[_0x7dee('0x27')](respondWithResult(_0x21e871,null))['catch'](handleError(_0x21e871,null));};exports[_0x7dee('0x2b')]=function(_0x1d673b,_0x3ab822){return db[_0x7dee('0x30')]['find']({'where':{'id':_0x1d673b[_0x7dee('0x51')]['id']}})[_0x7dee('0x27')](handleEntityNotFound(_0x3ab822,null))[_0x7dee('0x27')](removeEntity(_0x3ab822,null))['catch'](handleError(_0x3ab822,null));};exports['preview']=function(_0x375a84,_0x37c1ef){var _0xa14e19=0xa;var _0x39df83=['join',_0x7dee('0x52'),_0x7dee('0x53'),_0x7dee('0x54')];var _0x68c824={'SUM':_0x7dee('0x55'),'COUNT':_0x7dee('0x56'),'COUNT DISTINCT':_0x7dee('0x57'),'MAX':_0x7dee('0x58'),'MIN':_0x7dee('0x59'),'AVG':_0x7dee('0x5a'),'GROUP_CONCAT':_0x7dee('0x5b'),'GROUP_CONCAT ASC':_0x7dee('0x5c'),'GROUP_CONCAT DESC':_0x7dee('0x5d')};var _0x50d6ab={'SEC_TO_TIME':_0x7dee('0x5e'),'DATE':_0x7dee('0x5f'),'HOUR':_0x7dee('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7dee('0x61')};var _0x4ee908=function(_0x294a94){return!_['includes']([_0x7dee('0x62'),_0x7dee('0x63'),_0x7dee('0x64'),_0x7dee('0x65')],_0x294a94);};var _0x40946a=function(_0x3b50cc){if(!_0x3b50cc||!_0x3b50cc[_0x7dee('0x66')][_0x7dee('0x46')]){return'';}for(var _0x4a98be='(',_0x57fa6b=0x0;_0x57fa6b<_0x3b50cc['rules'][_0x7dee('0x46')];_0x57fa6b+=0x1){_0x57fa6b>0x0&&(_0x4a98be+='\x20'+_0x3b50cc['operator']+'\x20');_0x4a98be+=_0x3b50cc[_0x7dee('0x66')][_0x57fa6b]['group']?_0x40946a(_0x3b50cc[_0x7dee('0x66')][_0x57fa6b][_0x7dee('0x67')]):_0x3b50cc[_0x7dee('0x66')][_0x57fa6b][_0x7dee('0x68')]+'\x20'+_0x3b50cc[_0x7dee('0x66')][_0x57fa6b][_0x7dee('0x69')]+(_0x4ee908(_0x3b50cc[_0x7dee('0x66')][_0x57fa6b][_0x7dee('0x69')])?'\x20'+_0x3b50cc[_0x7dee('0x66')][_0x57fa6b][_0x7dee('0x6a')]:'');}return _0x4a98be+')';};var _0x328b53={'where':{'id':_0x375a84[_0x7dee('0x51')]['id']}},_0x4d687b,_0x342011,_0x14ef0d,_0x1a99c2,_0x2043be;_0x328b53=_[_0x7dee('0x3e')]({},_0x328b53,_0x375a84[_0x7dee('0x3f')]);return db['AnalyticCustomReport'][_0x7dee('0x47')](_0x328b53)[_0x7dee('0x27')](function(_0x43997d){if(_0x43997d){_0x4d687b=_0x43997d;return _0x43997d[_0x7dee('0x6b')]();}return null;})[_0x7dee('0x27')](function(_0x19353c){if(_0x19353c){if(!_0x19353c[_0x7dee('0x46')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7dee('0x6c'),0x193);}_0x342011=_0x19353c;return db[_0x7dee('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3e03a5){if(_0x3e03a5){_0x14ef0d=_[_0x7dee('0x6e')](_0x3e03a5,'id');var _0x125717;var _0x28f691=squel[_0x7dee('0x6f')]();_0x28f691[_0x7dee('0x70')](_0x4d687b[_0x7dee('0x71')]);for(var _0x5d21ed=0x0;_0x5d21ed<_0x342011[_0x7dee('0x46')];_0x5d21ed+=0x1){_0x125717=_0x342011[_0x5d21ed][_0x7dee('0x72')]?_0x14ef0d[_0x342011[_0x5d21ed]['MetricId']][_0x7dee('0x73')]:_0x342011[_0x5d21ed][_0x7dee('0x68')];_0x125717=_0x342011[_0x5d21ed][_0x7dee('0x74')]?_['replace'](_0x68c824[_0x342011[_0x5d21ed][_0x7dee('0x74')]],'%s',_0x125717):_0x125717;_0x125717=_0x342011[_0x5d21ed][_0x7dee('0x75')]?_[_0x7dee('0x76')](_0x50d6ab[_0x342011[_0x5d21ed][_0x7dee('0x75')]],'%s',_0x125717):_0x125717;if(_0x342011[_0x5d21ed][_0x7dee('0x77')]){_0x28f691['group'](_0x125717);}_0x342011[_0x5d21ed][_0x7dee('0x78')]&&_0x28f691[_0x7dee('0x39')](_0x125717,_0x342011[_0x5d21ed]['orderBy']===_0x7dee('0x79')?![]:!![]);_0x28f691['field'](_0x125717,_0x342011[_0x5d21ed][_0x7dee('0x7a')]||_0x125717);}if(_0x4d687b['joins']){_0x4d687b[_0x7dee('0x7b')]=JSON[_0x7dee('0x7c')](_0x4d687b['joins']);for(var _0x277881=0x0;_0x277881<_0x4d687b[_0x7dee('0x7b')]['length'];_0x277881+=0x1){if(_0x4d687b['joins'][_0x277881][_0x7dee('0x7d')]&&_[_0x7dee('0x7e')](_0x39df83,_0x4d687b[_0x7dee('0x7b')][_0x277881][_0x7dee('0x7d')])&&_0x4d687b[_0x7dee('0x7b')][_0x277881][_0x7dee('0x7f')]&&_0x4d687b['joins'][_0x277881][_0x7dee('0x80')]&&_0x4d687b[_0x7dee('0x7b')][_0x277881][_0x7dee('0x81')]){_0x28f691[_0x4d687b[_0x7dee('0x7b')][_0x277881][_0x7dee('0x7d')]](_0x4d687b[_0x7dee('0x7b')][_0x277881]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4d687b[_0x7dee('0x71')],_0x4d687b[_0x7dee('0x7b')][_0x277881][_0x7dee('0x7f')],_0x4d687b[_0x7dee('0x7b')][_0x277881]['foreignTable'],_0x4d687b[_0x7dee('0x7b')][_0x277881][_0x7dee('0x81')]));}}}if(_0x4d687b[_0x7dee('0x82')]){_0x4d687b[_0x7dee('0x82')]=JSON[_0x7dee('0x7c')](_0x4d687b[_0x7dee('0x82')]);_0x28f691[_0x7dee('0x3b')](_0x40946a(_0x4d687b[_0x7dee('0x82')][_0x7dee('0x67')]));}_0x2043be=_0x28f691[_0x7dee('0x83')]();_0x28f691[_0x7dee('0x1e')](_0xa14e19);_0x28f691[_0x7dee('0x1c')](0x0);logger['debug'](_0x7dee('0x84'),_0x28f691[_0x7dee('0x85')]());return dbH['sequelize'][_0x7dee('0x34')](_0x28f691[_0x7dee('0x85')](),{'type':dbH[_0x7dee('0x86')][_0x7dee('0x87')][_0x7dee('0x88')]});}})[_0x7dee('0x27')](respondWithResult(_0x37c1ef,null))[_0x7dee('0x44')](handleError(_0x37c1ef,null));};function runReport(_0x885049,_0x514377,_0x24a6c2){var _0x68743c=_0x514377[_0x7dee('0x2d')];var _0x3a70d2=0xa;var _0x35ff3a=[_0x7dee('0x89'),_0x7dee('0x52'),'right_join',_0x7dee('0x54')];var _0x313eb2={'SUM':_0x7dee('0x55'),'COUNT':_0x7dee('0x56'),'COUNT DISTINCT':_0x7dee('0x57'),'MAX':_0x7dee('0x58'),'MIN':_0x7dee('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7dee('0x5c'),'GROUP_CONCAT DESC':_0x7dee('0x5d')};var _0x44f8d8={'SEC_TO_TIME':_0x7dee('0x5e'),'DATE':_0x7dee('0x5f'),'HOUR':_0x7dee('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7dee('0x61')};var _0x46b3b0=function(_0x3b9127){return!_[_0x7dee('0x7e')]([_0x7dee('0x62'),'IS\x20NOT\x20NULL',_0x7dee('0x64'),_0x7dee('0x65')],_0x3b9127);};var _0x3f6b2d=function(_0x20dfb8){if(!_0x20dfb8||!_0x20dfb8[_0x7dee('0x66')][_0x7dee('0x46')]){return'';}for(var _0x584e73='(',_0x5c7c82=0x0;_0x5c7c82<_0x20dfb8[_0x7dee('0x66')]['length'];_0x5c7c82+=0x1){_0x5c7c82>0x0&&(_0x584e73+='\x20'+_0x20dfb8[_0x7dee('0x8a')]+'\x20');_0x584e73+=_0x20dfb8[_0x7dee('0x66')][_0x5c7c82]['group']?_0x3f6b2d(_0x20dfb8[_0x7dee('0x66')][_0x5c7c82][_0x7dee('0x67')]):_0x20dfb8[_0x7dee('0x66')][_0x5c7c82][_0x7dee('0x68')]+'\x20'+_0x20dfb8[_0x7dee('0x66')][_0x5c7c82][_0x7dee('0x69')]+(_0x46b3b0(_0x20dfb8[_0x7dee('0x66')][_0x5c7c82][_0x7dee('0x69')])?'\x20'+_0x20dfb8[_0x7dee('0x66')][_0x5c7c82][_0x7dee('0x6a')]:'');}return _0x584e73+')';};var _0x377915={'where':{'id':_0x885049['id']}},_0x1ec875,_0xafa3ef,_0x1913de,_0x4ff4b3,_0x1d7e04;_0x377915=_[_0x7dee('0x3e')]({},_0x377915,_0x24a6c2);return db[_0x7dee('0x30')]['find'](_0x377915)['then'](function(_0x2b9cfd){if(_0x2b9cfd){_0x1ec875=_0x2b9cfd;return _0x2b9cfd['getFields']();}return null;})[_0x7dee('0x27')](function(_0x47349d){if(_0x47349d){if(!_0x47349d[_0x7dee('0x46')]){throw new db['Sequelize'][(_0x7dee('0x8b'))](_0x7dee('0x6c'),0x193);}_0xafa3ef=_0x47349d;return db[_0x7dee('0x6d')][_0x7dee('0x42')]({'raw':!![]});}return null;})[_0x7dee('0x27')](function(_0x19613b){if(_0x19613b){_0x1913de=_['keyBy'](_0x19613b,'id');var _0x4b12a1;var _0x2882c6=squel[_0x7dee('0x6f')]();_0x2882c6['from'](_0x1ec875['table']);for(var _0x29f8d9=0x0;_0x29f8d9<_0xafa3ef['length'];_0x29f8d9+=0x1){_0x4b12a1=_0xafa3ef[_0x29f8d9]['MetricId']?_0x1913de[_0xafa3ef[_0x29f8d9][_0x7dee('0x72')]][_0x7dee('0x73')]:_0xafa3ef[_0x29f8d9]['field'];_0x4b12a1=_0xafa3ef[_0x29f8d9][_0x7dee('0x74')]?_[_0x7dee('0x76')](_0x313eb2[_0xafa3ef[_0x29f8d9][_0x7dee('0x74')]],'%s',_0x4b12a1):_0x4b12a1;_0x4b12a1=_0xafa3ef[_0x29f8d9]['format']?_[_0x7dee('0x76')](_0x44f8d8[_0xafa3ef[_0x29f8d9][_0x7dee('0x75')]],'%s',_0x4b12a1):_0x4b12a1;if(_0xafa3ef[_0x29f8d9][_0x7dee('0x77')]){_0x2882c6[_0x7dee('0x67')](_0x4b12a1);}_0xafa3ef[_0x29f8d9][_0x7dee('0x78')]&&_0x2882c6[_0x7dee('0x39')](_0x4b12a1,_0xafa3ef[_0x29f8d9]['orderBy']===_0x7dee('0x79')?![]:!![]);_0x2882c6[_0x7dee('0x68')](_0x4b12a1,_0xafa3ef[_0x29f8d9][_0x7dee('0x7a')]||_0x4b12a1);}if(_0x1ec875['joins']){_0x1ec875[_0x7dee('0x7b')]=JSON[_0x7dee('0x7c')](_0x1ec875[_0x7dee('0x7b')]);for(var _0x51d78f=0x0;_0x51d78f<_0x1ec875['joins'][_0x7dee('0x46')];_0x51d78f+=0x1){if(_0x1ec875['joins'][_0x51d78f]['type']&&_[_0x7dee('0x7e')](_0x35ff3a,_0x1ec875['joins'][_0x51d78f][_0x7dee('0x7d')])&&_0x1ec875['joins'][_0x51d78f][_0x7dee('0x7f')]&&_0x1ec875[_0x7dee('0x7b')][_0x51d78f]['foreignTable']&&_0x1ec875['joins'][_0x51d78f][_0x7dee('0x81')]){_0x2882c6[_0x1ec875[_0x7dee('0x7b')][_0x51d78f][_0x7dee('0x7d')]](_0x1ec875[_0x7dee('0x7b')][_0x51d78f][_0x7dee('0x80')],null,util[_0x7dee('0x75')](_0x7dee('0x8c'),_0x1ec875[_0x7dee('0x71')],_0x1ec875[_0x7dee('0x7b')][_0x51d78f][_0x7dee('0x7f')],_0x1ec875[_0x7dee('0x7b')][_0x51d78f]['foreignTable'],_0x1ec875[_0x7dee('0x7b')][_0x51d78f][_0x7dee('0x81')]));}}}if(_0x1ec875[_0x7dee('0x82')]){_0x1ec875[_0x7dee('0x82')]=JSON[_0x7dee('0x7c')](_0x1ec875[_0x7dee('0x82')]);_0x2882c6[_0x7dee('0x3b')](_0x3f6b2d(_0x1ec875[_0x7dee('0x82')][_0x7dee('0x67')]));}_0x1d7e04=_0x2882c6['clone']();_0x2882c6[_0x7dee('0x1e')](_0x3a70d2);_0x2882c6['offset'](0x0);return;}})[_0x7dee('0x27')](function(){if(_0x514377['output']==='web'){return null;}var _0x1a8ad7=_[_0x7dee('0x3e')](_0x514377,{'name':_0x514377['fullPath']||_0x514377['name']||_0x1ec875['name'],'basename':_0x68743c,'savename':util[_0x7dee('0x75')](_0x7dee('0x8d'),_0x514377[_0x7dee('0x2d')]||_0x1ec875[_0x7dee('0x2d')],require(_0x7dee('0x8e'))[_0x7dee('0x8f')](0x4),_0x514377[_0x7dee('0x90')]||_0x7dee('0x91')),'reportId':_0x1ec875['id'],'reportType':_0x7dee('0x92')});return db[_0x7dee('0x93')][_0x7dee('0x48')](_0x1a8ad7,{'raw':!![]});})[_0x7dee('0x27')](function(_0x5b5cab){if(_0x1ec875[_0x7dee('0x71')]==='cdr'){_0x1d7e04[_0x7dee('0x3b')](_0x1ec875[_0x7dee('0x71')]+_0x7dee('0x94'),_0x514377[_0x7dee('0x95')],_0x514377['endDate']);}else{_0x1d7e04[_0x7dee('0x3b')](_0x1ec875[_0x7dee('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514377[_0x7dee('0x95')],_0x514377[_0x7dee('0x96')]);}if(_0x5b5cab){logger[_0x7dee('0x97')](_0x7dee('0x98'),_0x1d7e04[_0x7dee('0x85')]());require(_0x7dee('0x99'))[_0x7dee('0x9a')](path[_0x7dee('0x89')](__dirname,'../../components/export/',_0x5b5cab[_0x7dee('0x90')]),[_0x5b5cab['id'],_0x1d7e04[_0x7dee('0x85')](),path[_0x7dee('0x89')](__dirname,_0x7dee('0x9b'),_0x5b5cab['savename']),_0x68743c]);return _0x5b5cab;}else{var _0x1c782d=squel[_0x7dee('0x6f')]();_0x1c782d[_0x7dee('0x70')]('('+_0x1d7e04['toString']()+')',_0x7dee('0x9c'));_0x1c782d[_0x7dee('0x68')](_0x7dee('0x9d'),'count');_0x1d7e04[_0x7dee('0x1e')](_0x514377[_0x7dee('0x1e')]||_0x3a70d2);_0x1d7e04[_0x7dee('0x1c')](_0x514377[_0x7dee('0x1c')]||0x0);return dbH[_0x7dee('0x86')][_0x7dee('0x34')](_0x1c782d[_0x7dee('0x85')](),{'type':dbH[_0x7dee('0x86')]['QueryTypes']['SELECT']})[_0x7dee('0x27')](function(_0x12c870){if(!_0x12c870['length']){_0x4ff4b3=0x0;}else{_0x4ff4b3=_0x12c870[0x0][_0x7dee('0x1f')]||0x0;}return dbH[_0x7dee('0x86')][_0x7dee('0x34')](_0x1d7e04[_0x7dee('0x85')](),{'type':dbH['sequelize'][_0x7dee('0x87')]['SELECT']});})[_0x7dee('0x27')](function(_0x11b958){return{'rows':_0x11b958||[],'count':_0x4ff4b3};});}});}exports[_0x7dee('0x9e')]=function(_0x5dbf2d,_0x459fd2){return runReport(_0x5dbf2d[_0x7dee('0x51')],_0x5dbf2d[_0x7dee('0x34')],_0x5dbf2d[_0x7dee('0x3f')])[_0x7dee('0x27')](respondWithResult(_0x459fd2,null))['catch'](handleError(_0x459fd2,null));};exports[_0x7dee('0x9f')]=runReport;exports['query']=function(_0x22976e,_0x36c01b){var _0x5e6eaf=0xa;var _0x17adfb=[_0x7dee('0x89'),_0x7dee('0x52'),'right_join',_0x7dee('0x54')];var _0x5ee6f7={'SUM':'SUM(%s)','COUNT':_0x7dee('0x56'),'COUNT DISTINCT':_0x7dee('0x57'),'MAX':_0x7dee('0x58'),'MIN':_0x7dee('0x59'),'AVG':_0x7dee('0x5a'),'GROUP_CONCAT':_0x7dee('0x5b'),'GROUP_CONCAT ASC':_0x7dee('0x5c'),'GROUP_CONCAT DESC':_0x7dee('0x5d')};var _0x1692c2={'SEC_TO_TIME':_0x7dee('0x5e'),'DATE':_0x7dee('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x7dee('0xa0'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x54524b=function(_0x30fb98){return!_[_0x7dee('0x7e')]([_0x7dee('0x62'),_0x7dee('0x63'),_0x7dee('0x64'),'IS\x20NOT\x20EMPTY'],_0x30fb98);};var _0x57ead9=function(_0x17af9f){if(!_0x17af9f||!_0x17af9f[_0x7dee('0x66')][_0x7dee('0x46')]){return'';}for(var _0x1fdc70='(',_0x331a12=0x0;_0x331a12<_0x17af9f[_0x7dee('0x66')]['length'];_0x331a12+=0x1){_0x331a12>0x0&&(_0x1fdc70+='\x20'+_0x17af9f[_0x7dee('0x8a')]+'\x20');_0x1fdc70+=_0x17af9f[_0x7dee('0x66')][_0x331a12]['group']?_0x57ead9(_0x17af9f[_0x7dee('0x66')][_0x331a12][_0x7dee('0x67')]):_0x17af9f['rules'][_0x331a12][_0x7dee('0x68')]+'\x20'+_0x17af9f[_0x7dee('0x66')][_0x331a12][_0x7dee('0x69')]+(_0x54524b(_0x17af9f['rules'][_0x331a12][_0x7dee('0x69')])?'\x20'+_0x17af9f[_0x7dee('0x66')][_0x331a12][_0x7dee('0x6a')]:'');}return _0x1fdc70+')';};var _0x2f819d={'where':{'id':_0x22976e[_0x7dee('0x51')]['id']}},_0x61bfba,_0x1665f7,_0x785395,_0x33ecf7,_0x1bebb9;_0x2f819d=_['merge']({},_0x2f819d,_0x22976e['options']);return db[_0x7dee('0x30')]['find'](_0x2f819d)[_0x7dee('0x27')](function(_0x4801c9){if(_0x4801c9){_0x61bfba=_0x4801c9;return _0x4801c9[_0x7dee('0x6b')]();}return null;})['then'](function(_0x468a20){if(_0x468a20){if(!_0x468a20[_0x7dee('0x46')]){throw new db[(_0x7dee('0xa1'))][(_0x7dee('0x8b'))](_0x7dee('0x6c'),0x193);}_0x1665f7=_0x468a20;return db[_0x7dee('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x7dee('0x27')](function(_0x5647b2){if(_0x5647b2){_0x785395=_['keyBy'](_0x5647b2,'id');var _0x5835b1;var _0x279ba0=squel[_0x7dee('0x6f')]();_0x279ba0[_0x7dee('0x70')](_0x61bfba[_0x7dee('0x71')]);for(var _0x1e3ca9=0x0;_0x1e3ca9<_0x1665f7[_0x7dee('0x46')];_0x1e3ca9+=0x1){_0x5835b1=_0x1665f7[_0x1e3ca9][_0x7dee('0x72')]?_0x785395[_0x1665f7[_0x1e3ca9]['MetricId']][_0x7dee('0x73')]:_0x1665f7[_0x1e3ca9]['field'];_0x5835b1=_0x1665f7[_0x1e3ca9][_0x7dee('0x74')]?_[_0x7dee('0x76')](_0x5ee6f7[_0x1665f7[_0x1e3ca9]['function']],'%s',_0x5835b1):_0x5835b1;_0x5835b1=_0x1665f7[_0x1e3ca9][_0x7dee('0x75')]?_[_0x7dee('0x76')](_0x1692c2[_0x1665f7[_0x1e3ca9][_0x7dee('0x75')]],'%s',_0x5835b1):_0x5835b1;if(_0x1665f7[_0x1e3ca9][_0x7dee('0x77')]){_0x279ba0['group'](_0x5835b1);}_0x1665f7[_0x1e3ca9]['orderBy']&&_0x279ba0[_0x7dee('0x39')](_0x5835b1,_0x1665f7[_0x1e3ca9][_0x7dee('0x78')]===_0x7dee('0x79')?![]:!![]);_0x279ba0[_0x7dee('0x68')](_0x5835b1,_0x1665f7[_0x1e3ca9][_0x7dee('0x7a')]||_0x5835b1);}if(_0x61bfba['joins']){_0x61bfba[_0x7dee('0x7b')]=JSON['parse'](_0x61bfba[_0x7dee('0x7b')]);for(var _0x867a23=0x0;_0x867a23<_0x61bfba[_0x7dee('0x7b')][_0x7dee('0x46')];_0x867a23+=0x1){if(_0x61bfba[_0x7dee('0x7b')][_0x867a23][_0x7dee('0x7d')]&&_[_0x7dee('0x7e')](_0x17adfb,_0x61bfba['joins'][_0x867a23][_0x7dee('0x7d')])&&_0x61bfba[_0x7dee('0x7b')][_0x867a23]['parentKey']&&_0x61bfba['joins'][_0x867a23][_0x7dee('0x80')]&&_0x61bfba[_0x7dee('0x7b')][_0x867a23][_0x7dee('0x81')]){_0x279ba0[_0x61bfba['joins'][_0x867a23][_0x7dee('0x7d')]](_0x61bfba[_0x7dee('0x7b')][_0x867a23][_0x7dee('0x80')],null,util['format'](_0x7dee('0x8c'),_0x61bfba['table'],_0x61bfba[_0x7dee('0x7b')][_0x867a23]['parentKey'],_0x61bfba[_0x7dee('0x7b')][_0x867a23][_0x7dee('0x80')],_0x61bfba['joins'][_0x867a23][_0x7dee('0x81')]));}}}if(_0x61bfba[_0x7dee('0x82')]){_0x61bfba['conditions']=JSON['parse'](_0x61bfba[_0x7dee('0x82')]);_0x279ba0[_0x7dee('0x3b')](_0x57ead9(_0x61bfba['conditions'][_0x7dee('0x67')]));}_0x1bebb9=_0x279ba0['clone']();_0x279ba0[_0x7dee('0x1e')](_0x5e6eaf);_0x279ba0[_0x7dee('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x279ba0[_0x7dee('0x85')]());return dbH[_0x7dee('0x86')][_0x7dee('0x34')](_0x279ba0[_0x7dee('0x85')](),{'type':dbH['sequelize'][_0x7dee('0x87')][_0x7dee('0x88')]});}})[_0x7dee('0x27')](function(){return{'sql':_0x1bebb9[_0x7dee('0x85')]()};})['then'](respondWithResult(_0x36c01b,null))['catch'](handleError(_0x36c01b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 392bd8d..87e9214 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 _0x7372=['define','analytics_custom_reports','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x298b53,_0x3f830d){var _0x370c14=function(_0x16a8d7){while(--_0x16a8d7){_0x298b53['push'](_0x298b53['shift']());}};_0x370c14(++_0x3f830d);}(_0x7372,0xe9));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2737('0x0'));var logger=require(_0x2737('0x1'))(_0x2737('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2737('0x3'));var fs=require('fs');var path=require(_0x2737('0x4'));var rimraf=require(_0x2737('0x5'));var config=require(_0x2737('0x6'));var attributes=require(_0x2737('0x7'));module[_0x2737('0x8')]=function(_0x21d3ac,_0x56634c){return _0x21d3ac[_0x2737('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x2737('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x001d=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0x001d,0xf8));var _0xd001=function(_0x44c01a,_0x102504){_0x44c01a=_0x44c01a-0x0;var _0x2d701c=_0x001d[_0x44c01a];return _0x2d701c;};'use strict';var _=require(_0xd001('0x0'));var util=require(_0xd001('0x1'));var logger=require(_0xd001('0x2'))(_0xd001('0x3'));var moment=require(_0xd001('0x4'));var BPromise=require(_0xd001('0x5'));var rp=require(_0xd001('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd001('0x7'));var attributes=require(_0xd001('0x8'));module[_0xd001('0x9')]=function(_0x8d4bb,_0x13dd5a){return _0x8d4bb[_0xd001('0xa')](_0xd001('0xb'),attributes,{'tableName':_0xd001('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 289ad0f..b215be7 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 _0xc400=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x3b49f8,_0x567194){var _0x1bc638=function(_0xbb3a87){while(--_0xbb3a87){_0x3b49f8['push'](_0x3b49f8['shift']());}};_0x1bc638(++_0x567194);}(_0xc400,0xf9));var _0x0c40=function(_0x493a9a,_0x44a487){_0x493a9a=_0x493a9a-0x0;var _0x2ff0a6=_0xc400[_0x493a9a];return _0x2ff0a6;};'use strict';var _=require(_0x0c40('0x0'));var util=require('util');var moment=require(_0x0c40('0x1'));var BPromise=require(_0x0c40('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c40('0x3'));var db=require(_0x0c40('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c40('0x5'))(_0x0c40('0x6'));var config=require('../../config/environment');var jayson=require(_0x0c40('0x7'));var client=jayson[_0x0c40('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a8f6,_0x57b6ec,_0x3657fa){return new BPromise(function(_0x21af46,_0x30815a){return client[_0x0c40('0x9')](_0x31a8f6,_0x3657fa)[_0x0c40('0xa')](function(_0x21d20a){logger[_0x0c40('0xb')](_0x0c40('0xc'),_0x57b6ec,_0x0c40('0xd'));logger[_0x0c40('0xe')](_0x0c40('0xf'),_0x57b6ec,_0x0c40('0xd'),JSON['stringify'](_0x21d20a));if(_0x21d20a[_0x0c40('0x10')]){if(_0x21d20a[_0x0c40('0x10')][_0x0c40('0x11')]===0x1f4){logger[_0x0c40('0x10')](_0x0c40('0xc'),_0x57b6ec,_0x21d20a[_0x0c40('0x10')][_0x0c40('0x12')]);return _0x30815a(_0x21d20a[_0x0c40('0x10')][_0x0c40('0x12')]);}logger[_0x0c40('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57b6ec,_0x21d20a['error']['message']);return _0x21af46(_0x21d20a['error']['message']);}else{logger[_0x0c40('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57b6ec,_0x0c40('0xd'));_0x21af46(_0x21d20a[_0x0c40('0x13')]['message']);}})[_0x0c40('0x14')](function(_0x23ce6a){logger['error'](_0x0c40('0xc'),_0x57b6ec,_0x23ce6a);_0x30815a(_0x23ce6a);});});} \ No newline at end of file +var _0x58db=['rpc','../../config/environment','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2ed00e,_0x15cad0){var _0x4d6819=function(_0x2b7afa){while(--_0x2b7afa){_0x2ed00e['push'](_0x2ed00e['shift']());}};_0x4d6819(++_0x15cad0);}(_0x58db,0x176));var _0xb58d=function(_0x5f322f,_0x1f2cde){_0x5f322f=_0x5f322f-0x0;var _0x43499c=_0x58db[_0x5f322f];return _0x43499c;};'use strict';var _=require('lodash');var util=require(_0xb58d('0x0'));var moment=require(_0xb58d('0x1'));var BPromise=require(_0xb58d('0x2'));var rs=require(_0xb58d('0x3'));var fs=require('fs');var Redis=require(_0xb58d('0x4'));var db=require(_0xb58d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb58d('0x6'));var config=require(_0xb58d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb58d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17bfb3,_0x1aa8bd,_0x43ebae){return new BPromise(function(_0x481860,_0x35442e){return client[_0xb58d('0x9')](_0x17bfb3,_0x43ebae)[_0xb58d('0xa')](function(_0xe2bf6b){logger[_0xb58d('0xb')](_0xb58d('0xc'),_0x1aa8bd,'request\x20sent');logger[_0xb58d('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1aa8bd,_0xb58d('0xe'),JSON[_0xb58d('0xf')](_0xe2bf6b));if(_0xe2bf6b['error']){if(_0xe2bf6b[_0xb58d('0x10')][_0xb58d('0x11')]===0x1f4){logger[_0xb58d('0x10')](_0xb58d('0xc'),_0x1aa8bd,_0xe2bf6b[_0xb58d('0x10')][_0xb58d('0x12')]);return _0x35442e(_0xe2bf6b[_0xb58d('0x10')][_0xb58d('0x12')]);}logger['error'](_0xb58d('0xc'),_0x1aa8bd,_0xe2bf6b[_0xb58d('0x10')][_0xb58d('0x12')]);return _0x481860(_0xe2bf6b[_0xb58d('0x10')][_0xb58d('0x12')]);}else{logger[_0xb58d('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1aa8bd,_0xb58d('0xe'));_0x481860(_0xe2bf6b[_0xb58d('0x13')][_0xb58d('0x12')]);}})['catch'](function(_0x4378c0){logger['error'](_0xb58d('0xc'),_0x1aa8bd,_0x4378c0);_0x35442e(_0x4378c0);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index e9be345..5266a80 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 _0xf55e=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy'];(function(_0x47729a,_0x197fdd){var _0x4dedd1=function(_0x467912){while(--_0x467912){_0x47729a['push'](_0x47729a['shift']());}};_0x4dedd1(++_0x197fdd);}(_0xf55e,0x191));var _0xef55=function(_0x4452d6,_0x2c1d0f){_0x4452d6=_0x4452d6-0x0;var _0x2c7fa1=_0xf55e[_0x4452d6];return _0x2c7fa1;};'use strict';var multer=require(_0xef55('0x0'));var util=require(_0xef55('0x1'));var path=require(_0xef55('0x2'));var timeout=require(_0xef55('0x3'));var express=require(_0xef55('0x4'));var router=express['Router']();var fs_extra=require(_0xef55('0x5'));var auth=require(_0xef55('0x6'));var interaction=require(_0xef55('0x7'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xef55('0x8')]('/',auth[_0xef55('0x9')](),controller[_0xef55('0xa')]);router[_0xef55('0x8')](_0xef55('0xb'),auth[_0xef55('0x9')](),controller[_0xef55('0xc')]);router[_0xef55('0x8')](_0xef55('0xd'),auth['isAuthenticated'](),controller[_0xef55('0xe')]);router['get'](_0xef55('0xf'),auth[_0xef55('0x9')](),controller[_0xef55('0x10')]);router[_0xef55('0x8')](_0xef55('0x11'),auth[_0xef55('0x9')](),controller[_0xef55('0x12')]);router[_0xef55('0x13')]('/',auth[_0xef55('0x9')](),controller[_0xef55('0x14')]);router[_0xef55('0x15')](_0xef55('0xb'),auth['isAuthenticated'](),controller[_0xef55('0x16')]);router['delete'](_0xef55('0xb'),auth[_0xef55('0x9')](),controller[_0xef55('0x17')]);module[_0xef55('0x18')]=router; \ No newline at end of file +var _0xebd8=['../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','create','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4341ab,_0x2c9c79){var _0x4fa920=function(_0x2409dc){while(--_0x2409dc){_0x4341ab['push'](_0x4341ab['shift']());}};_0x4fa920(++_0x2c9c79);}(_0xebd8,0x127));var _0x8ebd=function(_0xe98f87,_0x2ca314){_0xe98f87=_0xe98f87-0x0;var _0x54c53f=_0xebd8[_0xe98f87];return _0x54c53f;};'use strict';var multer=require(_0x8ebd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ebd('0x1'));var express=require('express');var router=express[_0x8ebd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8ebd('0x3'));var interaction=require(_0x8ebd('0x4'));var config=require(_0x8ebd('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x8ebd('0x6')]('/',auth[_0x8ebd('0x7')](),controller[_0x8ebd('0x8')]);router[_0x8ebd('0x6')](_0x8ebd('0x9'),auth['isAuthenticated'](),controller[_0x8ebd('0xa')]);router[_0x8ebd('0x6')]('/:id/preview',auth['isAuthenticated'](),controller[_0x8ebd('0xb')]);router[_0x8ebd('0x6')](_0x8ebd('0xc'),auth[_0x8ebd('0x7')](),controller[_0x8ebd('0xd')]);router['get'](_0x8ebd('0xe'),auth[_0x8ebd('0x7')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x8ebd('0xf')]);router[_0x8ebd('0x10')](_0x8ebd('0x9'),auth[_0x8ebd('0x7')](),controller[_0x8ebd('0x11')]);router[_0x8ebd('0x12')](_0x8ebd('0x9'),auth[_0x8ebd('0x7')](),controller['destroy']);module[_0x8ebd('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 38ad115..99c68c0 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0xbd51=['sequelize','STRING'];(function(_0xc3050a,_0x3f50b5){var _0x433e7a=function(_0x1fd962){while(--_0x1fd962){_0xc3050a['push'](_0xc3050a['shift']());}};_0x433e7a(++_0x3f50b5);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1fd8b5,_0x7d9ee6){_0x1fd8b5=_0x1fd8b5-0x0;var _0x1001eb=_0xbd51[_0x1fd8b5];return _0x1001eb;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 4d67d76..65b8831 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x5dbb0a,_0x2daefa){var _0x2100e9=function(_0x261959){while(--_0x261959){_0x5dbb0a['push'](_0x5dbb0a['shift']());}};_0x2100e9(++_0x2daefa);}(_0x5fab,0x177));var _0xb5fa=function(_0x27c69b,_0x4cbe55){_0x27c69b=_0x27c69b-0x0;var _0x198ac4=_0x5fab[_0x27c69b];return _0x198ac4;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x2bdcfd,_0x32697d){var _0x53a635=function(_0x5de676){while(--_0x5de676){_0x2bdcfd['push'](_0x2bdcfd['shift']());}};_0x53a635(++_0x32697d);}(_0x7a54,0x106));var _0x47a5=function(_0xef8159,_0x5da201){_0xef8159=_0xef8159-0x0;var _0x2e1798=_0x7a54[_0xef8159];return _0x2e1798;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ce5237b..8d2bf15 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 _0xf716=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define'];(function(_0x5e586d,_0x2c47de){var _0x4aa612=function(_0x471241){while(--_0x471241){_0x5e586d['push'](_0x5e586d['shift']());}};_0x4aa612(++_0x2c47de);}(_0xf716,0x91));var _0x6f71=function(_0x355bc3,_0x7a93f7){_0x355bc3=_0x355bc3-0x0;var _0x34a9b3=_0xf716[_0x355bc3];return _0x34a9b3;};'use strict';var _=require(_0x6f71('0x0'));var util=require(_0x6f71('0x1'));var logger=require(_0x6f71('0x2'))(_0x6f71('0x3'));var moment=require(_0x6f71('0x4'));var BPromise=require('bluebird');var rp=require(_0x6f71('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f71('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x6f71('0x7')]=function(_0x5dbf3b,_0x7accc9){return _0x5dbf3b[_0x6f71('0x8')](_0x6f71('0x9'),attributes,{'tableName':_0x6f71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48c4=['moment','request-promise','path','rimraf','./analyticDefaultReport.attributes','define','analytics_default_reports','lodash','../../config/logger','api'];(function(_0x97eeef,_0xab42c5){var _0x5d8a3b=function(_0xeb3910){while(--_0xeb3910){_0x97eeef['push'](_0x97eeef['shift']());}};_0x5d8a3b(++_0xab42c5);}(_0x48c4,0x197));var _0x448c=function(_0x2e5a5b,_0x46bbee){_0x2e5a5b=_0x2e5a5b-0x0;var _0xbbf868=_0x48c4[_0x2e5a5b];return _0xbbf868;};'use strict';var _=require(_0x448c('0x0'));var util=require('util');var logger=require(_0x448c('0x1'))(_0x448c('0x2'));var moment=require(_0x448c('0x3'));var BPromise=require('bluebird');var rp=require(_0x448c('0x4'));var fs=require('fs');var path=require(_0x448c('0x5'));var rimraf=require(_0x448c('0x6'));var config=require('../../config/environment');var attributes=require(_0x448c('0x7'));module['exports']=function(_0x28f5cf,_0x5ccbc4){return _0x28f5cf[_0x448c('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x448c('0x9'),'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 3279cb2..ad16564 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 _0x1310=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then'];(function(_0x1444b0,_0x187724){var _0x29617b=function(_0x58a705){while(--_0x58a705){_0x1444b0['push'](_0x1444b0['shift']());}};_0x29617b(++_0x187724);}(_0x1310,0x7c));var _0x0131=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1310[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0131('0x0'));var util=require(_0x0131('0x1'));var moment=require(_0x0131('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0131('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0131('0x4'));var logger=require(_0x0131('0x5'))('rpc');var config=require(_0x0131('0x6'));var jayson=require(_0x0131('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d56ee,_0x48aea9,_0x13f525){return new BPromise(function(_0x2cee2f,_0x267601){return client['request'](_0x4d56ee,_0x13f525)[_0x0131('0x8')](function(_0xe1e68c){logger[_0x0131('0x9')](_0x0131('0xa'),_0x48aea9,_0x0131('0xb'));logger[_0x0131('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x48aea9,_0x0131('0xb'),JSON[_0x0131('0xd')](_0xe1e68c));if(_0xe1e68c['error']){if(_0xe1e68c[_0x0131('0xe')][_0x0131('0xf')]===0x1f4){logger[_0x0131('0xe')](_0x0131('0xa'),_0x48aea9,_0xe1e68c[_0x0131('0xe')][_0x0131('0x10')]);return _0x267601(_0xe1e68c['error'][_0x0131('0x10')]);}logger[_0x0131('0xe')](_0x0131('0xa'),_0x48aea9,_0xe1e68c[_0x0131('0xe')][_0x0131('0x10')]);return _0x2cee2f(_0xe1e68c[_0x0131('0xe')][_0x0131('0x10')]);}else{logger['info'](_0x0131('0xa'),_0x48aea9,'request\x20sent');_0x2cee2f(_0xe1e68c[_0x0131('0x11')][_0x0131('0x10')]);}})[_0x0131('0x12')](function(_0x12dcc6){logger[_0x0131('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x48aea9,_0x12dcc6);_0x267601(_0x12dcc6);});});} \ No newline at end of file +var _0x051e=['jayson/promise','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x334372,_0x2fefaf){var _0x44bf72=function(_0x880df6){while(--_0x880df6){_0x334372['push'](_0x334372['shift']());}};_0x44bf72(++_0x2fefaf);}(_0x051e,0x133));var _0xe051=function(_0x5b3eec,_0x4d2208){_0x5b3eec=_0x5b3eec-0x0;var _0x4e7fb1=_0x051e[_0x5b3eec];return _0x4e7fb1;};'use strict';var _=require('lodash');var util=require(_0xe051('0x0'));var moment=require(_0xe051('0x1'));var BPromise=require(_0xe051('0x2'));var rs=require(_0xe051('0x3'));var fs=require('fs');var Redis=require(_0xe051('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe051('0x5'));var logger=require(_0xe051('0x6'))(_0xe051('0x7'));var config=require('../../config/environment');var jayson=require(_0xe051('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6a5936,_0x2b0dc3,_0x5d78fd){return new BPromise(function(_0x441ebd,_0x59f96c){return client[_0xe051('0x9')](_0x6a5936,_0x5d78fd)[_0xe051('0xa')](function(_0x19bf52){logger[_0xe051('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2b0dc3,_0xe051('0xc'));logger[_0xe051('0xd')](_0xe051('0xe'),_0x2b0dc3,_0xe051('0xc'),JSON[_0xe051('0xf')](_0x19bf52));if(_0x19bf52[_0xe051('0x10')]){if(_0x19bf52['error'][_0xe051('0x11')]===0x1f4){logger[_0xe051('0x10')](_0xe051('0x12'),_0x2b0dc3,_0x19bf52[_0xe051('0x10')][_0xe051('0x13')]);return _0x59f96c(_0x19bf52[_0xe051('0x10')][_0xe051('0x13')]);}logger[_0xe051('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2b0dc3,_0x19bf52['error'][_0xe051('0x13')]);return _0x441ebd(_0x19bf52[_0xe051('0x10')][_0xe051('0x13')]);}else{logger['info'](_0xe051('0x12'),_0x2b0dc3,_0xe051('0xc'));_0x441ebd(_0x19bf52['result'][_0xe051('0x13')]);}})[_0xe051('0x14')](function(_0x3dd969){logger[_0xe051('0x10')](_0xe051('0x12'),_0x2b0dc3,_0x3dd969);_0x59f96c(_0x3dd969);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a9297f8..c3faf6a 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 _0x0ab3=['get','isAuthenticated','/:id','show','/:id/run','/:id/query','query','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0ab3,0x111));var _0x30ab=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0ab3[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x30ab('0x0'));var path=require(_0x30ab('0x1'));var timeout=require(_0x30ab('0x2'));var express=require(_0x30ab('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x30ab('0x4'));var interaction=require(_0x30ab('0x5'));var config=require('../../config/environment');var controller=require(_0x30ab('0x6'));router[_0x30ab('0x7')]('/',auth[_0x30ab('0x8')](),controller['index']);router[_0x30ab('0x7')](_0x30ab('0x9'),auth[_0x30ab('0x8')](),controller[_0x30ab('0xa')]);router[_0x30ab('0x7')]('/:id/preview',auth[_0x30ab('0x8')](),controller['preview']);router[_0x30ab('0x7')](_0x30ab('0xb'),auth[_0x30ab('0x8')](),controller['run']);router[_0x30ab('0x7')](_0x30ab('0xc'),auth[_0x30ab('0x8')](),controller[_0x30ab('0xd')]);router[_0x30ab('0xe')]('/',auth[_0x30ab('0x8')](),controller[_0x30ab('0xf')]);router[_0x30ab('0x10')](_0x30ab('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x30ab('0x11')](_0x30ab('0x9'),auth[_0x30ab('0x8')](),controller[_0x30ab('0x12')]);module[_0x30ab('0x13')]=router; \ No newline at end of file +var _0xdcd0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','put','destroy','multer','util','connect-timeout','express','fs-extra'];(function(_0x7784a8,_0x24c8ed){var _0xa82040=function(_0x223f58){while(--_0x223f58){_0x7784a8['push'](_0x7784a8['shift']());}};_0xa82040(++_0x24c8ed);}(_0xdcd0,0x1cf));var _0x0dcd=function(_0x2e50b0,_0x54b097){_0x2e50b0=_0x2e50b0-0x0;var _0x5462e5=_0xdcd0[_0x2e50b0];return _0x5462e5;};'use strict';var multer=require(_0x0dcd('0x0'));var util=require(_0x0dcd('0x1'));var path=require('path');var timeout=require(_0x0dcd('0x2'));var express=require(_0x0dcd('0x3'));var router=express['Router']();var fs_extra=require(_0x0dcd('0x4'));var auth=require(_0x0dcd('0x5'));var interaction=require(_0x0dcd('0x6'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x0dcd('0x7')]('/',auth[_0x0dcd('0x8')](),controller['index']);router['get'](_0x0dcd('0x9'),auth['isAuthenticated'](),controller[_0x0dcd('0xa')]);router[_0x0dcd('0x7')](_0x0dcd('0xb'),auth['isAuthenticated'](),controller[_0x0dcd('0xc')]);router['get'](_0x0dcd('0xd'),auth[_0x0dcd('0x8')](),controller['run']);router[_0x0dcd('0x7')](_0x0dcd('0xe'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0xf')]);router['post']('/',auth[_0x0dcd('0x8')](),controller['create']);router[_0x0dcd('0x10')](_0x0dcd('0x9'),auth[_0x0dcd('0x8')](),controller['update']);router['delete'](_0x0dcd('0x9'),auth[_0x0dcd('0x8')](),controller[_0x0dcd('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f04514a..1c9af1e 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 _0xd183=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','INTEGER','UNSIGNED'];(function(_0x129046,_0x519448){var _0x4d06d9=function(_0x425c26){while(--_0x425c26){_0x129046['push'](_0x129046['shift']());}};_0x4d06d9(++_0x519448);}(_0xd183,0xb0));var _0x3d18=function(_0x5e2b95,_0x45e3a2){_0x5e2b95=_0x5e2b95-0x0;var _0x23aebd=_0xd183[_0x5e2b95];return _0x23aebd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3d18('0x0'));module[_0x3d18('0x1')]={'name':{'type':Sequelize[_0x3d18('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x3d18('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x3d18('0x3')](_0x3d18('0x4'),_0x3d18('0x5'),_0x3d18('0x6')),'allowNull':![],'defaultValue':_0x3d18('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x3d18('0x7')]},'endDate':{'type':Sequelize[_0x3d18('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x3d18('0x3')](_0x3d18('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x3d18('0x9')](0xb)[_0x3d18('0xa')]},'reportType':{'type':Sequelize[_0x3d18('0x2')]}}; \ No newline at end of file +var _0xdb89=['UNSIGNED','sequelize','moment','exports','STRING','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x449fb0,_0xf691a2){var _0x10bb91=function(_0x86e613){while(--_0x86e613){_0x449fb0['push'](_0x449fb0['shift']());}};_0x10bb91(++_0xf691a2);}(_0xdb89,0x1a5));var _0x9db8=function(_0x10cccd,_0x293ecd){_0x10cccd=_0x10cccd-0x0;var _0x4a378c=_0xdb89[_0x10cccd];return _0x4a378c;};'use strict';var Sequelize=require(_0x9db8('0x0'));var moment=require(_0x9db8('0x1'));module[_0x9db8('0x2')]={'name':{'type':Sequelize[_0x9db8('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x9db8('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x9db8('0x4'),'pdf',_0x9db8('0x5')),'allowNull':![],'defaultValue':_0x9db8('0x4')},'savename':{'type':Sequelize[_0x9db8('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9db8('0x6')]},'endDate':{'type':Sequelize[_0x9db8('0x6')]},'status':{'type':Sequelize[_0x9db8('0x3')],'defaultValue':_0x9db8('0x7')},'type':{'type':Sequelize['ENUM'](_0x9db8('0x8'),_0x9db8('0x9')),'allowNull':![],'defaultValue':_0x9db8('0x8')},'reportId':{'type':Sequelize[_0x9db8('0xa')](0xb)[_0x9db8('0xb')]},'reportType':{'type':Sequelize[_0x9db8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2fdcdd1..ecc8c98 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 _0x0399=['fs-extra','lodash','squel','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','end','error','name','send','map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x39cbb3,_0x5e1877){var _0xb6aea2=function(_0x4e6f49){while(--_0x4e6f49){_0x39cbb3['push'](_0x39cbb3['shift']());}};_0xb6aea2(++_0x5e1877);}(_0x0399,0x1de));var _0x9039=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0399[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x9039('0x0'));var rimraf=require(_0x9039('0x1'));var zipdir=require(_0x9039('0x2'));var jsonpatch=require(_0x9039('0x3'));var rp=require(_0x9039('0x4'));var moment=require(_0x9039('0x5'));var BPromise=require(_0x9039('0x6'));var Mustache=require(_0x9039('0x7'));var util=require(_0x9039('0x8'));var path=require(_0x9039('0x9'));var sox=require(_0x9039('0xa'));var csv=require(_0x9039('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9039('0xc'));var _=require(_0x9039('0xd'));var squel=require(_0x9039('0xe'));var crypto=require('crypto');var jsforce=require(_0x9039('0xf'));var deskjs=require(_0x9039('0x10'));var toCsv=require(_0x9039('0xb'));var querystring=require(_0x9039('0x11'));var Papa=require(_0x9039('0x12'));var Redis=require(_0x9039('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9039('0x14'));var as=require(_0x9039('0x15'));var hardwareService=require(_0x9039('0x16'));var logger=require(_0x9039('0x17'))(_0x9039('0x18'));var utils=require(_0x9039('0x19'));var config=require(_0x9039('0x1a'));var licenseUtil=require(_0x9039('0x1b'));var db=require(_0x9039('0x1c'))['db'];function respondWithStatusCode(_0x4a674b,_0x56e270){_0x56e270=_0x56e270||0xcc;return function(_0x1b2195){if(_0x1b2195){return _0x4a674b['sendStatus'](_0x56e270);}return _0x4a674b[_0x9039('0x1d')](_0x56e270)['end']();};}function respondWithResult(_0x2486c9,_0x4fdcab){_0x4fdcab=_0x4fdcab||0xc8;return function(_0x15f9b4){if(_0x15f9b4){return _0x2486c9['status'](_0x4fdcab)[_0x9039('0x1e')](_0x15f9b4);}};}function respondWithFilteredResult(_0x1be16c,_0x375575){return function(_0xef61a9){if(_0xef61a9){var _0x46ae7e=typeof _0x375575[_0x9039('0x1f')]===_0x9039('0x20')&&typeof _0x375575[_0x9039('0x21')]===_0x9039('0x20');var _0x5df6bd=_0xef61a9[_0x9039('0x22')];var _0x1ea359=_0x46ae7e?0x0:_0x375575[_0x9039('0x1f')];var _0x1b6fb5=_0x46ae7e?_0xef61a9['count']:_0x375575[_0x9039('0x1f')]+_0x375575['limit'];var _0x38e6df;if(_0x1b6fb5>=_0x5df6bd){_0x1b6fb5=_0x5df6bd;_0x38e6df=0xc8;}else{_0x38e6df=0xce;}_0x1be16c['status'](_0x38e6df);return _0x1be16c[_0x9039('0x23')](_0x9039('0x24'),_0x1ea359+'-'+_0x1b6fb5+'/'+_0x5df6bd)[_0x9039('0x1e')](_0xef61a9);}return null;};}function patchUpdates(_0x9dc205){return function(_0x18aaf5){try{jsonpatch[_0x9039('0x25')](_0x18aaf5,_0x9dc205,!![]);}catch(_0x1aea83){return BPromise[_0x9039('0x26')](_0x1aea83);}return _0x18aaf5[_0x9039('0x27')]();};}function saveUpdates(_0x55919a,_0xe85dae){return function(_0x37e2bf){if(_0x37e2bf){return _0x37e2bf[_0x9039('0x28')](_0x55919a)[_0x9039('0x29')](function(_0x3ae0b4){return _0x3ae0b4;});}return null;};}function removeEntity(_0x50e093,_0x37614f){return function(_0x465b64){if(_0x465b64){return _0x465b64['destroy']()[_0x9039('0x29')](function(){var _0x337399=_0x465b64[_0x9039('0x2a')]({'plain':!![]});var _0x38c8ec=_0x9039('0x2b');return db[_0x9039('0x2c')][_0x9039('0x2d')]({'where':{'type':_0x38c8ec,'resourceId':_0x337399['id']}})[_0x9039('0x29')](function(){return _0x465b64;});})['then'](function(){_0x50e093[_0x9039('0x1d')](0xcc)[_0x9039('0x2e')]();});}};}function handleEntityNotFound(_0x3ec235,_0x35ae1c){return function(_0x4cdd30){if(!_0x4cdd30){_0x3ec235['sendStatus'](0x194);}return _0x4cdd30;};}function handleError(_0x310682,_0x4d1a46){_0x4d1a46=_0x4d1a46||0x1f4;return function(_0x6f6139){logger[_0x9039('0x2f')](_0x6f6139['stack']);if(_0x6f6139[_0x9039('0x30')]){delete _0x6f6139['name'];}_0x310682['status'](_0x4d1a46)[_0x9039('0x31')](_0x6f6139);};}exports['index']=function(_0x120618,_0x57ceed){var _0x2c58a4={},_0xa9e7ee={},_0x987607={'count':0x0,'rows':[]};var _0x938dbd=_[_0x9039('0x32')](db[_0x9039('0x33')][_0x9039('0x34')],function(_0x56f572){return{'name':_0x56f572['fieldName'],'type':_0x56f572[_0x9039('0x35')]['key']};});_0xa9e7ee[_0x9039('0x36')]=_[_0x9039('0x32')](_0x938dbd,'name');_0xa9e7ee[_0x9039('0x37')]=_[_0x9039('0x38')](_0x120618[_0x9039('0x37')]);_0xa9e7ee[_0x9039('0x39')]=_[_0x9039('0x3a')](_0xa9e7ee['model'],_0xa9e7ee[_0x9039('0x37')]);_0x2c58a4['attributes']=_[_0x9039('0x3a')](_0xa9e7ee[_0x9039('0x36')],qs[_0x9039('0x3b')](_0x120618[_0x9039('0x37')]['fields']));_0x2c58a4[_0x9039('0x3c')]=_0x2c58a4[_0x9039('0x3c')][_0x9039('0x3d')]?_0x2c58a4[_0x9039('0x3c')]:_0xa9e7ee[_0x9039('0x36')];if(!_0x120618['query'][_0x9039('0x3e')]('nolimit')){_0x2c58a4[_0x9039('0x21')]=qs['limit'](_0x120618[_0x9039('0x37')]['limit']);_0x2c58a4['offset']=qs[_0x9039('0x1f')](_0x120618[_0x9039('0x37')][_0x9039('0x1f')]);}_0x2c58a4['order']=qs[_0x9039('0x3f')](_0x120618[_0x9039('0x37')][_0x9039('0x3f')]);_0x2c58a4[_0x9039('0x40')]=qs[_0x9039('0x39')](_[_0x9039('0x41')](_0x120618[_0x9039('0x37')],_0xa9e7ee[_0x9039('0x39')]),_0x938dbd);if(_0x120618['query'][_0x9039('0x42')]){_0x2c58a4[_0x9039('0x40')]=_['merge'](_0x2c58a4[_0x9039('0x40')],{'$or':_['map'](_0x938dbd,function(_0x4fada9){if(_0x4fada9[_0x9039('0x35')]!==_0x9039('0x43')){var _0x44b187={};_0x44b187[_0x4fada9[_0x9039('0x30')]]={'$like':'%'+_0x120618[_0x9039('0x37')][_0x9039('0x42')]+'%'};return _0x44b187;}})});}_0x2c58a4=_[_0x9039('0x44')]({},_0x2c58a4,_0x120618[_0x9039('0x45')]);var _0x4cea03={'where':_0x2c58a4[_0x9039('0x40')]};return db[_0x9039('0x33')][_0x9039('0x22')](_0x4cea03)[_0x9039('0x29')](function(_0x41776c){_0x987607[_0x9039('0x22')]=_0x41776c;if(_0x120618[_0x9039('0x37')]['includeAll']){_0x2c58a4['include']=[{'all':!![]}];}return db[_0x9039('0x33')][_0x9039('0x46')](_0x2c58a4);})[_0x9039('0x29')](function(_0x5880a8){_0x987607[_0x9039('0x47')]=_0x5880a8;return _0x987607;})['then'](respondWithFilteredResult(_0x57ceed,_0x2c58a4))[_0x9039('0x48')](handleError(_0x57ceed,null));};exports['show']=function(_0x24ea2e,_0x21ad96){var _0x2eabdc={'raw':!![],'where':{'id':_0x24ea2e[_0x9039('0x49')]['id']}},_0x3da029={};_0x3da029[_0x9039('0x36')]=_[_0x9039('0x38')](db[_0x9039('0x33')][_0x9039('0x34')]);_0x3da029[_0x9039('0x37')]=_[_0x9039('0x38')](_0x24ea2e[_0x9039('0x37')]);_0x3da029[_0x9039('0x39')]=_['intersection'](_0x3da029[_0x9039('0x36')],_0x3da029[_0x9039('0x37')]);_0x2eabdc[_0x9039('0x3c')]=_[_0x9039('0x3a')](_0x3da029[_0x9039('0x36')],qs['fields'](_0x24ea2e['query'][_0x9039('0x3b')]));_0x2eabdc[_0x9039('0x3c')]=_0x2eabdc[_0x9039('0x3c')][_0x9039('0x3d')]?_0x2eabdc[_0x9039('0x3c')]:_0x3da029[_0x9039('0x36')];if(_0x24ea2e['query'][_0x9039('0x4a')]){_0x2eabdc[_0x9039('0x4b')]=[{'all':!![]}];}_0x2eabdc=_[_0x9039('0x44')]({},_0x2eabdc,_0x24ea2e[_0x9039('0x45')]);return db[_0x9039('0x33')][_0x9039('0x4c')](_0x2eabdc)[_0x9039('0x29')](handleEntityNotFound(_0x21ad96,null))[_0x9039('0x29')](respondWithResult(_0x21ad96,null))[_0x9039('0x48')](handleError(_0x21ad96,null));};exports[_0x9039('0x4d')]=function(_0x370555,_0x904df8){return db[_0x9039('0x33')]['create'](_0x370555[_0x9039('0x4e')],{})['then'](function(_0x4591e5){var _0x3c10a4=_0x370555['user'][_0x9039('0x2a')]({'plain':!![]});if(!_0x3c10a4)throw new Error(_0x9039('0x4f'));if(_0x3c10a4[_0x9039('0x50')]===_0x9039('0x51')){var _0x1484d1=_0x4591e5[_0x9039('0x2a')]({'plain':!![]});var _0x7712aa=_0x9039('0x2b');return db[_0x9039('0x52')][_0x9039('0x4c')]({'where':{'name':_0x7712aa,'userProfileId':_0x3c10a4['userProfileId']},'raw':!![]})['then'](function(_0xbf7a75){if(_0xbf7a75&&_0xbf7a75['autoAssociation']===0x0){return db[_0x9039('0x2c')][_0x9039('0x4d')]({'name':_0x1484d1[_0x9039('0x30')],'resourceId':_0x1484d1['id'],'type':_0xbf7a75['name'],'sectionId':_0xbf7a75['id']},{})['then'](function(){return _0x4591e5;});}else{return _0x4591e5;}})[_0x9039('0x48')](function(_0x3dedb4){logger[_0x9039('0x2f')](_0x9039('0x53'),_0x3dedb4);throw _0x3dedb4;});}return _0x4591e5;})['then'](respondWithResult(_0x904df8,0xc9))[_0x9039('0x48')](handleError(_0x904df8,null));};exports['update']=function(_0x2d2aa2,_0x3f9e46){if(_0x2d2aa2[_0x9039('0x4e')]['id']){delete _0x2d2aa2['body']['id'];}return db[_0x9039('0x33')][_0x9039('0x4c')]({'where':{'id':_0x2d2aa2[_0x9039('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f9e46,null))[_0x9039('0x29')](saveUpdates(_0x2d2aa2['body'],null))[_0x9039('0x29')](respondWithResult(_0x3f9e46,null))[_0x9039('0x48')](handleError(_0x3f9e46,null));};exports['destroy']=function(_0x3df798,_0x183ea9){return db[_0x9039('0x33')][_0x9039('0x4c')]({'where':{'id':_0x3df798[_0x9039('0x49')]['id']}})[_0x9039('0x29')](handleEntityNotFound(_0x183ea9,null))[_0x9039('0x29')](removeEntity(_0x183ea9,null))[_0x9039('0x48')](handleError(_0x183ea9,null));};exports[_0x9039('0x54')]=function(_0x488511,_0x1014c4,_0x22b98c){return db[_0x9039('0x33')][_0x9039('0x4c')]({'where':{'id':_0x488511['params']['id']},'attributes':['name',_0x9039('0x55'),_0x9039('0x56'),_0x9039('0x57')],'raw':!![]})[_0x9039('0x29')](handleEntityNotFound(_0x1014c4,null))['then'](function(_0x256106){if(_0x256106){if(!fs[_0x9039('0x58')](path[_0x9039('0x59')](config['root'],_0x9039('0x5a'),_0x256106[_0x9039('0x56')]))){throw new db[(_0x9039('0x5b'))][(_0x9039('0x5c'))](_0x9039('0x5d'));}if(_0x488511[_0x9039('0x37')][_0x9039('0x5e')]){return _0x1014c4[_0x9039('0x5f')](0xc8);}return _0x1014c4['download'](path[_0x9039('0x59')](config['root'],_0x9039('0x5a'),_0x256106[_0x9039('0x56')]),util[_0x9039('0x60')](_0x9039('0x61'),_0x256106[_0x9039('0x55')]||_0x256106[_0x9039('0x30')],_0x256106['output']['toLowerCase']()));}})[_0x9039('0x48')](handleError(_0x1014c4,null));}; \ No newline at end of file +var _0x0640=['join','server/files/reports','format','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','name','index','map','AnalyticExtractedReport','fieldName','type','model','keys','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','savename','output','existsSync','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists'];(function(_0x1fa387,_0x40e45f){var _0x2f0101=function(_0x55e833){while(--_0x55e833){_0x1fa387['push'](_0x1fa387['shift']());}};_0x2f0101(++_0x40e45f);}(_0x0640,0xbc));var _0x0064=function(_0xc191c8,_0x2098f9){_0xc191c8=_0xc191c8-0x0;var _0x2d8373=_0x0640[_0xc191c8];return _0x2d8373;};'use strict';var emlformat=require(_0x0064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0064('0x1'));var jsonpatch=require(_0x0064('0x2'));var rp=require(_0x0064('0x3'));var moment=require(_0x0064('0x4'));var BPromise=require(_0x0064('0x5'));var Mustache=require(_0x0064('0x6'));var util=require(_0x0064('0x7'));var path=require(_0x0064('0x8'));var sox=require('sox');var csv=require(_0x0064('0x9'));var ejs=require(_0x0064('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0064('0xb'));var squel=require(_0x0064('0xc'));var crypto=require(_0x0064('0xd'));var jsforce=require(_0x0064('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0064('0xf'));var Papa=require('papaparse');var Redis=require(_0x0064('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0064('0x11'));var logger=require(_0x0064('0x12'))(_0x0064('0x13'));var utils=require(_0x0064('0x14'));var config=require(_0x0064('0x15'));var licenseUtil=require(_0x0064('0x16'));var db=require(_0x0064('0x17'))['db'];function respondWithStatusCode(_0x472765,_0x4564b0){_0x4564b0=_0x4564b0||0xcc;return function(_0x36ec05){if(_0x36ec05){return _0x472765[_0x0064('0x18')](_0x4564b0);}return _0x472765[_0x0064('0x19')](_0x4564b0)['end']();};}function respondWithResult(_0x2a83b0,_0x1a15c8){_0x1a15c8=_0x1a15c8||0xc8;return function(_0x236974){if(_0x236974){return _0x2a83b0[_0x0064('0x19')](_0x1a15c8)[_0x0064('0x1a')](_0x236974);}};}function respondWithFilteredResult(_0x165833,_0x176fc8){return function(_0x2f8a79){if(_0x2f8a79){var _0x4fccba=typeof _0x176fc8[_0x0064('0x1b')]===_0x0064('0x1c')&&typeof _0x176fc8[_0x0064('0x1d')]==='undefined';var _0x5cce14=_0x2f8a79[_0x0064('0x1e')];var _0x1bb51d=_0x4fccba?0x0:_0x176fc8[_0x0064('0x1b')];var _0x356aeb=_0x4fccba?_0x2f8a79['count']:_0x176fc8[_0x0064('0x1b')]+_0x176fc8['limit'];var _0x264f50;if(_0x356aeb>=_0x5cce14){_0x356aeb=_0x5cce14;_0x264f50=0xc8;}else{_0x264f50=0xce;}_0x165833[_0x0064('0x19')](_0x264f50);return _0x165833[_0x0064('0x1f')](_0x0064('0x20'),_0x1bb51d+'-'+_0x356aeb+'/'+_0x5cce14)[_0x0064('0x1a')](_0x2f8a79);}return null;};}function patchUpdates(_0x56bcf2){return function(_0x2c7fe4){try{jsonpatch[_0x0064('0x21')](_0x2c7fe4,_0x56bcf2,!![]);}catch(_0x3595dc){return BPromise[_0x0064('0x22')](_0x3595dc);}return _0x2c7fe4[_0x0064('0x23')]();};}function saveUpdates(_0xf216fb,_0x2ead4d){return function(_0x2673bd){if(_0x2673bd){return _0x2673bd[_0x0064('0x24')](_0xf216fb)[_0x0064('0x25')](function(_0xd93470){return _0xd93470;});}return null;};}function removeEntity(_0x19caca,_0x435d3b){return function(_0x6580c7){if(_0x6580c7){return _0x6580c7[_0x0064('0x26')]()[_0x0064('0x25')](function(){var _0x3455ec=_0x6580c7['get']({'plain':!![]});var _0x4875ab=_0x0064('0x27');return db[_0x0064('0x28')][_0x0064('0x26')]({'where':{'type':_0x4875ab,'resourceId':_0x3455ec['id']}})[_0x0064('0x25')](function(){return _0x6580c7;});})[_0x0064('0x25')](function(){_0x19caca[_0x0064('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bb512,_0x1b3a51){return function(_0x4cb28c){if(!_0x4cb28c){_0x5bb512[_0x0064('0x18')](0x194);}return _0x4cb28c;};}function handleError(_0x527e10,_0xf2ae5f){_0xf2ae5f=_0xf2ae5f||0x1f4;return function(_0x48114d){logger['error'](_0x48114d['stack']);if(_0x48114d[_0x0064('0x29')]){delete _0x48114d['name'];}_0x527e10[_0x0064('0x19')](_0xf2ae5f)['send'](_0x48114d);};}exports[_0x0064('0x2a')]=function(_0x510f95,_0x44da95){var _0x38f523={},_0x192caf={},_0x28dbab={'count':0x0,'rows':[]};var _0xdca530=_[_0x0064('0x2b')](db[_0x0064('0x2c')]['rawAttributes'],function(_0x2eb78a){return{'name':_0x2eb78a[_0x0064('0x2d')],'type':_0x2eb78a[_0x0064('0x2e')]['key']};});_0x192caf[_0x0064('0x2f')]=_[_0x0064('0x2b')](_0xdca530,_0x0064('0x29'));_0x192caf['query']=_[_0x0064('0x30')](_0x510f95['query']);_0x192caf[_0x0064('0x31')]=_[_0x0064('0x32')](_0x192caf[_0x0064('0x2f')],_0x192caf[_0x0064('0x33')]);_0x38f523[_0x0064('0x34')]=_['intersection'](_0x192caf[_0x0064('0x2f')],qs['fields'](_0x510f95[_0x0064('0x33')]['fields']));_0x38f523[_0x0064('0x34')]=_0x38f523['attributes'][_0x0064('0x35')]?_0x38f523[_0x0064('0x34')]:_0x192caf['model'];if(!_0x510f95['query']['hasOwnProperty'](_0x0064('0x36'))){_0x38f523[_0x0064('0x1d')]=qs[_0x0064('0x1d')](_0x510f95[_0x0064('0x33')][_0x0064('0x1d')]);_0x38f523['offset']=qs[_0x0064('0x1b')](_0x510f95['query'][_0x0064('0x1b')]);}_0x38f523[_0x0064('0x37')]=qs[_0x0064('0x38')](_0x510f95[_0x0064('0x33')][_0x0064('0x38')]);_0x38f523[_0x0064('0x39')]=qs[_0x0064('0x31')](_[_0x0064('0x3a')](_0x510f95[_0x0064('0x33')],_0x192caf[_0x0064('0x31')]),_0xdca530);if(_0x510f95[_0x0064('0x33')][_0x0064('0x3b')]){_0x38f523['where']=_[_0x0064('0x3c')](_0x38f523[_0x0064('0x39')],{'$or':_[_0x0064('0x2b')](_0xdca530,function(_0x428776){if(_0x428776[_0x0064('0x2e')]!==_0x0064('0x3d')){var _0x121ff9={};_0x121ff9[_0x428776[_0x0064('0x29')]]={'$like':'%'+_0x510f95[_0x0064('0x33')]['filter']+'%'};return _0x121ff9;}})});}_0x38f523=_[_0x0064('0x3c')]({},_0x38f523,_0x510f95['options']);var _0x79a574={'where':_0x38f523[_0x0064('0x39')]};return db[_0x0064('0x2c')]['count'](_0x79a574)[_0x0064('0x25')](function(_0x4a8f07){_0x28dbab[_0x0064('0x1e')]=_0x4a8f07;if(_0x510f95['query'][_0x0064('0x3e')]){_0x38f523[_0x0064('0x3f')]=[{'all':!![]}];}return db[_0x0064('0x2c')][_0x0064('0x40')](_0x38f523);})[_0x0064('0x25')](function(_0xa4a71d){_0x28dbab['rows']=_0xa4a71d;return _0x28dbab;})[_0x0064('0x25')](respondWithFilteredResult(_0x44da95,_0x38f523))[_0x0064('0x41')](handleError(_0x44da95,null));};exports[_0x0064('0x42')]=function(_0x456930,_0x2cde53){var _0x4cef8a={'raw':!![],'where':{'id':_0x456930[_0x0064('0x43')]['id']}},_0xfb6b77={};_0xfb6b77[_0x0064('0x2f')]=_[_0x0064('0x30')](db[_0x0064('0x2c')]['rawAttributes']);_0xfb6b77['query']=_[_0x0064('0x30')](_0x456930[_0x0064('0x33')]);_0xfb6b77[_0x0064('0x31')]=_['intersection'](_0xfb6b77['model'],_0xfb6b77[_0x0064('0x33')]);_0x4cef8a[_0x0064('0x34')]=_['intersection'](_0xfb6b77[_0x0064('0x2f')],qs[_0x0064('0x44')](_0x456930[_0x0064('0x33')][_0x0064('0x44')]));_0x4cef8a[_0x0064('0x34')]=_0x4cef8a['attributes'][_0x0064('0x35')]?_0x4cef8a[_0x0064('0x34')]:_0xfb6b77[_0x0064('0x2f')];if(_0x456930['query'][_0x0064('0x3e')]){_0x4cef8a[_0x0064('0x3f')]=[{'all':!![]}];}_0x4cef8a=_['merge']({},_0x4cef8a,_0x456930[_0x0064('0x45')]);return db[_0x0064('0x2c')][_0x0064('0x46')](_0x4cef8a)['then'](handleEntityNotFound(_0x2cde53,null))[_0x0064('0x25')](respondWithResult(_0x2cde53,null))['catch'](handleError(_0x2cde53,null));};exports[_0x0064('0x47')]=function(_0x416b64,_0x591876){return db[_0x0064('0x2c')][_0x0064('0x47')](_0x416b64[_0x0064('0x48')],{})[_0x0064('0x25')](function(_0x3dce4d){var _0x2db0b5=_0x416b64[_0x0064('0x49')]['get']({'plain':!![]});if(!_0x2db0b5)throw new Error(_0x0064('0x4a'));if(_0x2db0b5[_0x0064('0x4b')]===_0x0064('0x49')){var _0x215a67=_0x3dce4d[_0x0064('0x4c')]({'plain':!![]});var _0x13f9c1='ExtractedReports';return db[_0x0064('0x4d')][_0x0064('0x46')]({'where':{'name':_0x13f9c1,'userProfileId':_0x2db0b5[_0x0064('0x4e')]},'raw':!![]})[_0x0064('0x25')](function(_0x4c9fce){if(_0x4c9fce&&_0x4c9fce[_0x0064('0x4f')]===0x0){return db[_0x0064('0x28')][_0x0064('0x47')]({'name':_0x215a67[_0x0064('0x29')],'resourceId':_0x215a67['id'],'type':_0x4c9fce[_0x0064('0x29')],'sectionId':_0x4c9fce['id']},{})[_0x0064('0x25')](function(){return _0x3dce4d;});}else{return _0x3dce4d;}})[_0x0064('0x41')](function(_0x44769e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44769e);throw _0x44769e;});}return _0x3dce4d;})['then'](respondWithResult(_0x591876,0xc9))[_0x0064('0x41')](handleError(_0x591876,null));};exports[_0x0064('0x24')]=function(_0x143e51,_0xc9d1c7){if(_0x143e51[_0x0064('0x48')]['id']){delete _0x143e51[_0x0064('0x48')]['id'];}return db[_0x0064('0x2c')][_0x0064('0x46')]({'where':{'id':_0x143e51[_0x0064('0x43')]['id']}})[_0x0064('0x25')](handleEntityNotFound(_0xc9d1c7,null))[_0x0064('0x25')](saveUpdates(_0x143e51[_0x0064('0x48')],null))[_0x0064('0x25')](respondWithResult(_0xc9d1c7,null))[_0x0064('0x41')](handleError(_0xc9d1c7,null));};exports[_0x0064('0x26')]=function(_0x398c7b,_0x71607f){return db['AnalyticExtractedReport'][_0x0064('0x46')]({'where':{'id':_0x398c7b[_0x0064('0x43')]['id']}})[_0x0064('0x25')](handleEntityNotFound(_0x71607f,null))['then'](removeEntity(_0x71607f,null))[_0x0064('0x41')](handleError(_0x71607f,null));};exports['download']=function(_0xcd3b70,_0x467b69,_0x4ef031){return db[_0x0064('0x2c')][_0x0064('0x46')]({'where':{'id':_0xcd3b70[_0x0064('0x43')]['id']},'attributes':[_0x0064('0x29'),'basename',_0x0064('0x50'),_0x0064('0x51')],'raw':!![]})[_0x0064('0x25')](handleEntityNotFound(_0x467b69,null))[_0x0064('0x25')](function(_0x72c238){if(_0x72c238){if(!fs[_0x0064('0x52')](path['join'](config[_0x0064('0x53')],'server/files/reports',_0x72c238[_0x0064('0x50')]))){throw new db[(_0x0064('0x54'))][(_0x0064('0x55'))](_0x0064('0x56'));}if(_0xcd3b70[_0x0064('0x33')][_0x0064('0x57')]){return _0x467b69[_0x0064('0x18')](0xc8);}return _0x467b69['download'](path[_0x0064('0x58')](config[_0x0064('0x53')],_0x0064('0x59'),_0x72c238[_0x0064('0x50')]),util[_0x0064('0x5a')]('%s.%s',_0x72c238['basename']||_0x72c238[_0x0064('0x29')],_0x72c238['output'][_0x0064('0x5b')]()));}})[_0x0064('0x41')](handleError(_0x467b69,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0d8b5cb..284ea56 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 _0x86ca=['analytics_extracted_reports','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x86ca,0x119));var _0xa86c=function(_0x349b26,_0x5b560b){_0x349b26=_0x349b26-0x0;var _0x2c1235=_0x86ca[_0x349b26];return _0x2c1235;};'use strict';var _=require(_0xa86c('0x0'));var util=require('util');var logger=require(_0xa86c('0x1'))(_0xa86c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa86c('0x3'));var fs=require('fs');var path=require(_0xa86c('0x4'));var rimraf=require(_0xa86c('0x5'));var config=require(_0xa86c('0x6'));var attributes=require(_0xa86c('0x7'));module[_0xa86c('0x8')]=function(_0x448dfb,_0x30a5d6){return _0x448dfb['define']('AnalyticExtractedReport',attributes,{'tableName':_0xa86c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd052=['../../config/logger','api','moment','bluebird','path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util'];(function(_0x31e4d8,_0x1222e3){var _0xc2ec79=function(_0x900f07){while(--_0x900f07){_0x31e4d8['push'](_0x31e4d8['shift']());}};_0xc2ec79(++_0x1222e3);}(_0xd052,0x1d2));var _0x2d05=function(_0x329ab8,_0x3295c7){_0x329ab8=_0x329ab8-0x0;var _0x5f3aa8=_0xd052[_0x329ab8];return _0x5f3aa8;};'use strict';var _=require(_0x2d05('0x0'));var util=require(_0x2d05('0x1'));var logger=require(_0x2d05('0x2'))(_0x2d05('0x3'));var moment=require(_0x2d05('0x4'));var BPromise=require(_0x2d05('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d05('0x6'));var rimraf=require(_0x2d05('0x7'));var config=require('../../config/environment');var attributes=require(_0x2d05('0x8'));module[_0x2d05('0x9')]=function(_0x55a964,_0x1b47ef){return _0x55a964[_0x2d05('0xa')](_0x2d05('0xb'),attributes,{'tableName':'analytics_extracted_reports','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 27db164..1405960 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 _0x7948=['jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e2135,_0x55d94e){var _0x39ac3d=function(_0xb3c8f6){while(--_0xb3c8f6){_0x5e2135['push'](_0x5e2135['shift']());}};_0x39ac3d(++_0x55d94e);}(_0x7948,0x185));var _0x8794=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0x7948[_0x35f83e];return _0x249b05;};'use strict';var _=require(_0x8794('0x0'));var util=require(_0x8794('0x1'));var moment=require(_0x8794('0x2'));var BPromise=require(_0x8794('0x3'));var rs=require(_0x8794('0x4'));var fs=require('fs');var Redis=require(_0x8794('0x5'));var db=require(_0x8794('0x6'))['db'];var utils=require(_0x8794('0x7'));var logger=require(_0x8794('0x8'))(_0x8794('0x9'));var config=require(_0x8794('0xa'));var jayson=require(_0x8794('0xb'));var client=jayson[_0x8794('0xc')][_0x8794('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x28d12e,_0x2276f2,_0x22b452){return new BPromise(function(_0x27f31e,_0x6d7e86){return client[_0x8794('0xe')](_0x28d12e,_0x22b452)[_0x8794('0xf')](function(_0x2305d8){logger[_0x8794('0x10')](_0x8794('0x11'),_0x2276f2,_0x8794('0x12'));logger[_0x8794('0x13')](_0x8794('0x14'),_0x2276f2,_0x8794('0x12'),JSON[_0x8794('0x15')](_0x2305d8));if(_0x2305d8[_0x8794('0x16')]){if(_0x2305d8[_0x8794('0x16')]['code']===0x1f4){logger[_0x8794('0x16')](_0x8794('0x11'),_0x2276f2,_0x2305d8[_0x8794('0x16')][_0x8794('0x17')]);return _0x6d7e86(_0x2305d8[_0x8794('0x16')][_0x8794('0x17')]);}logger[_0x8794('0x16')](_0x8794('0x11'),_0x2276f2,_0x2305d8[_0x8794('0x16')][_0x8794('0x17')]);return _0x27f31e(_0x2305d8[_0x8794('0x16')][_0x8794('0x17')]);}else{logger[_0x8794('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2276f2,_0x8794('0x12'));_0x27f31e(_0x2305d8['result']['message']);}})[_0x8794('0x18')](function(_0x8b862a){logger[_0x8794('0x16')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2276f2,_0x8b862a);_0x6d7e86(_0x8b862a);});});} \ No newline at end of file +var _0x5dc7=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x17ebb6,_0x465af7){var _0x32ec22=function(_0x160ff0){while(--_0x160ff0){_0x17ebb6['push'](_0x17ebb6['shift']());}};_0x32ec22(++_0x465af7);}(_0x5dc7,0x148));var _0x75dc=function(_0x589639,_0x5ae3db){_0x589639=_0x589639-0x0;var _0x2ade0e=_0x5dc7[_0x589639];return _0x2ade0e;};'use strict';var _=require(_0x75dc('0x0'));var util=require(_0x75dc('0x1'));var moment=require('moment');var BPromise=require(_0x75dc('0x2'));var rs=require(_0x75dc('0x3'));var fs=require('fs');var Redis=require(_0x75dc('0x4'));var db=require(_0x75dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x75dc('0x6'));var config=require(_0x75dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x75dc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8196a0,_0x335263,_0x24f85d){return new BPromise(function(_0x2d951e,_0x1d17ee){return client[_0x75dc('0x9')](_0x8196a0,_0x24f85d)['then'](function(_0x5ef7c8){logger[_0x75dc('0xa')](_0x75dc('0xb'),_0x335263,'request\x20sent');logger[_0x75dc('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x335263,_0x75dc('0xd'),JSON[_0x75dc('0xe')](_0x5ef7c8));if(_0x5ef7c8[_0x75dc('0xf')]){if(_0x5ef7c8[_0x75dc('0xf')][_0x75dc('0x10')]===0x1f4){logger[_0x75dc('0xf')](_0x75dc('0xb'),_0x335263,_0x5ef7c8[_0x75dc('0xf')]['message']);return _0x1d17ee(_0x5ef7c8[_0x75dc('0xf')][_0x75dc('0x11')]);}logger[_0x75dc('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x335263,_0x5ef7c8[_0x75dc('0xf')]['message']);return _0x2d951e(_0x5ef7c8[_0x75dc('0xf')][_0x75dc('0x11')]);}else{logger[_0x75dc('0xa')](_0x75dc('0xb'),_0x335263,_0x75dc('0xd'));_0x2d951e(_0x5ef7c8[_0x75dc('0x12')][_0x75dc('0x11')]);}})[_0x75dc('0x13')](function(_0xd68462){logger[_0x75dc('0xf')](_0x75dc('0xb'),_0x335263,_0xd68462);_0x1d17ee(_0xd68462);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2a28f6d..410c48d 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 _0x97ef=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','download','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2ea262,_0x58ada0){var _0x4f51ad=function(_0xd0ba71){while(--_0xd0ba71){_0x2ea262['push'](_0x2ea262['shift']());}};_0x4f51ad(++_0x58ada0);}(_0x97ef,0x71));var _0xf97e=function(_0xc7ef13,_0x5366b9){_0xc7ef13=_0xc7ef13-0x0;var _0x368264=_0x97ef[_0xc7ef13];return _0x368264;};'use strict';var multer=require(_0xf97e('0x0'));var util=require(_0xf97e('0x1'));var path=require(_0xf97e('0x2'));var timeout=require(_0xf97e('0x3'));var express=require(_0xf97e('0x4'));var router=express[_0xf97e('0x5')]();var fs_extra=require(_0xf97e('0x6'));var auth=require(_0xf97e('0x7'));var interaction=require(_0xf97e('0x8'));var config=require(_0xf97e('0x9'));var controller=require(_0xf97e('0xa'));router[_0xf97e('0xb')]('/',auth['isAuthenticated'](),controller[_0xf97e('0xc')]);router[_0xf97e('0xb')](_0xf97e('0xd'),auth[_0xf97e('0xe')](),controller[_0xf97e('0xf')]);router[_0xf97e('0xb')]('/:id/download',auth[_0xf97e('0xe')](),controller[_0xf97e('0x10')]);router['post']('/',auth[_0xf97e('0xe')](),controller[_0xf97e('0x11')]);router[_0xf97e('0x12')](_0xf97e('0xd'),auth[_0xf97e('0xe')](),controller[_0xf97e('0x13')]);router[_0xf97e('0x14')](_0xf97e('0xd'),auth[_0xf97e('0xe')](),controller[_0xf97e('0x15')]);module[_0xf97e('0x16')]=router; \ No newline at end of file +var _0x3485=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','put','update','delete','destroy','exports','multer'];(function(_0x3f0800,_0x5b61b3){var _0x287ea5=function(_0xf078e6){while(--_0xf078e6){_0x3f0800['push'](_0x3f0800['shift']());}};_0x287ea5(++_0x5b61b3);}(_0x3485,0x155));var _0x5348=function(_0xca19c4,_0x407602){_0xca19c4=_0xca19c4-0x0;var _0xd5c216=_0x3485[_0xca19c4];return _0xd5c216;};'use strict';var multer=require(_0x5348('0x0'));var util=require('util');var path=require(_0x5348('0x1'));var timeout=require(_0x5348('0x2'));var express=require('express');var router=express[_0x5348('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5348('0x4'));var interaction=require(_0x5348('0x5'));var config=require(_0x5348('0x6'));var controller=require(_0x5348('0x7'));router[_0x5348('0x8')]('/',auth[_0x5348('0x9')](),controller[_0x5348('0xa')]);router[_0x5348('0x8')](_0x5348('0xb'),auth[_0x5348('0x9')](),controller['show']);router[_0x5348('0x8')](_0x5348('0xc'),auth[_0x5348('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5348('0xd')](_0x5348('0xb'),auth[_0x5348('0x9')](),controller[_0x5348('0xe')]);router[_0x5348('0xf')](_0x5348('0xb'),auth['isAuthenticated'](),controller[_0x5348('0x10')]);module[_0x5348('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 28effe5..9ab1904 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 _0xd94e=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x50d46c,_0x17ea61){var _0x18d2eb=function(_0x2599b3){while(--_0x2599b3){_0x50d46c['push'](_0x50d46c['shift']());}};_0x18d2eb(++_0x17ea61);}(_0xd94e,0xc3));var _0xed94=function(_0x4c6058,_0x4b5868){_0x4c6058=_0x4c6058-0x0;var _0x8d1b4c=_0xd94e[_0x4c6058];return _0x8d1b4c;};'use strict';var Sequelize=require(_0xed94('0x0'));module[_0xed94('0x1')]={'field':{'type':Sequelize[_0xed94('0x2')]},'alias':{'type':Sequelize[_0xed94('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xed94('0x3')]},'groupBy':{'type':Sequelize[_0xed94('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xed94('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6fdd=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1c0630,_0x11f37a){var _0x1125a3=function(_0x26db31){while(--_0x26db31){_0x1c0630['push'](_0x1c0630['shift']());}};_0x1125a3(++_0x11f37a);}(_0x6fdd,0x189));var _0xd6fd=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x6fdd[_0x3a2e49];return _0x257140;};'use strict';var Sequelize=require(_0xd6fd('0x0'));module[_0xd6fd('0x1')]={'field':{'type':Sequelize[_0xd6fd('0x2')]},'alias':{'type':Sequelize[_0xd6fd('0x3')]},'function':{'type':Sequelize[_0xd6fd('0x3')]},'format':{'type':Sequelize[_0xd6fd('0x3')]},'groupBy':{'type':Sequelize[_0xd6fd('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd6fd('0x3')]},'custom':{'type':Sequelize[_0xd6fd('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f97b2a1..b55cecf 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 _0xb9e4=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','params','create','bulkCreate','body','find','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x39758e,_0x1c4f9e){var _0x467281=function(_0x14ba8e){while(--_0x14ba8e){_0x39758e['push'](_0x39758e['shift']());}};_0x467281(++_0x1c4f9e);}(_0xb9e4,0x1a9));var _0x4b9e=function(_0x456392,_0x1b2b72){_0x456392=_0x456392-0x0;var _0x4a8c6b=_0xb9e4[_0x456392];return _0x4a8c6b;};'use strict';var emlformat=require(_0x4b9e('0x0'));var rimraf=require(_0x4b9e('0x1'));var zipdir=require(_0x4b9e('0x2'));var jsonpatch=require(_0x4b9e('0x3'));var rp=require(_0x4b9e('0x4'));var moment=require(_0x4b9e('0x5'));var BPromise=require(_0x4b9e('0x6'));var Mustache=require(_0x4b9e('0x7'));var util=require(_0x4b9e('0x8'));var path=require(_0x4b9e('0x9'));var sox=require(_0x4b9e('0xa'));var csv=require(_0x4b9e('0xb'));var ejs=require(_0x4b9e('0xc'));var fs=require('fs');var fs_extra=require(_0x4b9e('0xd'));var _=require(_0x4b9e('0xe'));var squel=require(_0x4b9e('0xf'));var crypto=require(_0x4b9e('0x10'));var jsforce=require(_0x4b9e('0x11'));var deskjs=require(_0x4b9e('0x12'));var toCsv=require('to-csv');var querystring=require(_0x4b9e('0x13'));var Papa=require(_0x4b9e('0x14'));var Redis=require(_0x4b9e('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x4b9e('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b9e('0x17'));var logger=require(_0x4b9e('0x18'))(_0x4b9e('0x19'));var utils=require('../../config/utils');var config=require(_0x4b9e('0x1a'));var licenseUtil=require(_0x4b9e('0x1b'));var db=require(_0x4b9e('0x1c'))['db'];function respondWithStatusCode(_0x577e6f,_0x375559){_0x375559=_0x375559||0xcc;return function(_0x49f6c0){if(_0x49f6c0){return _0x577e6f[_0x4b9e('0x1d')](_0x375559);}return _0x577e6f[_0x4b9e('0x1e')](_0x375559)[_0x4b9e('0x1f')]();};}function respondWithResult(_0xd4346d,_0x1e5715){_0x1e5715=_0x1e5715||0xc8;return function(_0x36eacb){if(_0x36eacb){return _0xd4346d[_0x4b9e('0x1e')](_0x1e5715)[_0x4b9e('0x20')](_0x36eacb);}};}function respondWithFilteredResult(_0x5e1022,_0x508bc2){return function(_0x1a2300){if(_0x1a2300){var _0x321902=typeof _0x508bc2['offset']===_0x4b9e('0x21')&&typeof _0x508bc2[_0x4b9e('0x22')]===_0x4b9e('0x21');var _0x2be27f=_0x1a2300[_0x4b9e('0x23')];var _0x17172a=_0x321902?0x0:_0x508bc2['offset'];var _0x46fc88=_0x321902?_0x1a2300[_0x4b9e('0x23')]:_0x508bc2[_0x4b9e('0x24')]+_0x508bc2['limit'];var _0xa5a995;if(_0x46fc88>=_0x2be27f){_0x46fc88=_0x2be27f;_0xa5a995=0xc8;}else{_0xa5a995=0xce;}_0x5e1022['status'](_0xa5a995);return _0x5e1022[_0x4b9e('0x25')](_0x4b9e('0x26'),_0x17172a+'-'+_0x46fc88+'/'+_0x2be27f)[_0x4b9e('0x20')](_0x1a2300);}return null;};}function patchUpdates(_0x33abd1){return function(_0xeafdfa){try{jsonpatch['apply'](_0xeafdfa,_0x33abd1,!![]);}catch(_0x2d453a){return BPromise['reject'](_0x2d453a);}return _0xeafdfa['save']();};}function saveUpdates(_0x3d7a4f,_0x5926f2){return function(_0x199be3){if(_0x199be3){return _0x199be3[_0x4b9e('0x27')](_0x3d7a4f)[_0x4b9e('0x28')](function(_0x539ce0){return _0x539ce0;});}return null;};}function removeEntity(_0x6423ae,_0x3ea343){return function(_0x4aa7ff){if(_0x4aa7ff){return _0x4aa7ff[_0x4b9e('0x29')]()[_0x4b9e('0x28')](function(){_0x6423ae[_0x4b9e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f631d,_0x3eaa40){return function(_0x217a98){if(!_0x217a98){_0x2f631d[_0x4b9e('0x1d')](0x194);}return _0x217a98;};}function handleError(_0x57f7d3,_0x10e5b2){_0x10e5b2=_0x10e5b2||0x1f4;return function(_0x5029cd){logger[_0x4b9e('0x2a')](_0x5029cd[_0x4b9e('0x2b')]);if(_0x5029cd[_0x4b9e('0x2c')]){delete _0x5029cd['name'];}_0x57f7d3[_0x4b9e('0x1e')](_0x10e5b2)[_0x4b9e('0x2d')](_0x5029cd);};}exports[_0x4b9e('0x2e')]=function(_0xa2c0c8,_0x593b34){var _0x233c08={},_0x54ba7d={},_0x3a4126={'count':0x0,'rows':[]};var _0x261726=_[_0x4b9e('0x2f')](db[_0x4b9e('0x30')][_0x4b9e('0x31')],function(_0x428097){return{'name':_0x428097[_0x4b9e('0x32')],'type':_0x428097[_0x4b9e('0x33')][_0x4b9e('0x34')]};});_0x54ba7d['model']=_['map'](_0x261726,'name');_0x54ba7d[_0x4b9e('0x35')]=_[_0x4b9e('0x36')](_0xa2c0c8[_0x4b9e('0x35')]);_0x54ba7d['filters']=_['intersection'](_0x54ba7d[_0x4b9e('0x37')],_0x54ba7d[_0x4b9e('0x35')]);_0x233c08[_0x4b9e('0x38')]=_[_0x4b9e('0x39')](_0x54ba7d[_0x4b9e('0x37')],qs[_0x4b9e('0x3a')](_0xa2c0c8[_0x4b9e('0x35')][_0x4b9e('0x3a')]));_0x233c08[_0x4b9e('0x38')]=_0x233c08[_0x4b9e('0x38')][_0x4b9e('0x3b')]?_0x233c08['attributes']:_0x54ba7d[_0x4b9e('0x37')];if(!_0xa2c0c8[_0x4b9e('0x35')][_0x4b9e('0x3c')](_0x4b9e('0x3d'))){_0x233c08['limit']=qs['limit'](_0xa2c0c8['query'][_0x4b9e('0x22')]);_0x233c08[_0x4b9e('0x24')]=qs[_0x4b9e('0x24')](_0xa2c0c8[_0x4b9e('0x35')][_0x4b9e('0x24')]);}_0x233c08[_0x4b9e('0x3e')]=qs[_0x4b9e('0x3f')](_0xa2c0c8['query']['sort']);_0x233c08['where']=qs['filters'](_[_0x4b9e('0x40')](_0xa2c0c8[_0x4b9e('0x35')],_0x54ba7d[_0x4b9e('0x41')]),_0x261726);if(_0xa2c0c8['query'][_0x4b9e('0x42')]){_0x233c08[_0x4b9e('0x43')]=_[_0x4b9e('0x44')](_0x233c08['where'],{'$or':_['map'](_0x261726,function(_0x388080){if(_0x388080[_0x4b9e('0x33')]!==_0x4b9e('0x45')){var _0x2f3b20={};_0x2f3b20[_0x388080[_0x4b9e('0x2c')]]={'$like':'%'+_0xa2c0c8['query'][_0x4b9e('0x42')]+'%'};return _0x2f3b20;}})});}_0x233c08=_[_0x4b9e('0x44')]({},_0x233c08,_0xa2c0c8[_0x4b9e('0x46')]);var _0x3c176e={'where':_0x233c08[_0x4b9e('0x43')]};return db[_0x4b9e('0x30')][_0x4b9e('0x23')](_0x3c176e)['then'](function(_0x35f3e2){_0x3a4126[_0x4b9e('0x23')]=_0x35f3e2;if(_0xa2c0c8[_0x4b9e('0x35')][_0x4b9e('0x47')]){_0x233c08[_0x4b9e('0x48')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x233c08);})[_0x4b9e('0x28')](function(_0x286798){_0x3a4126['rows']=_0x286798;return _0x3a4126;})['then'](respondWithFilteredResult(_0x593b34,_0x233c08))[_0x4b9e('0x49')](handleError(_0x593b34,null));};exports['show']=function(_0x335ebf,_0x349940){var _0x52cddf={'raw':![],'where':{'id':_0x335ebf[_0x4b9e('0x4a')]['id']}},_0x4ed67e={};_0x4ed67e['model']=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x4ed67e[_0x4b9e('0x35')]=_[_0x4b9e('0x36')](_0x335ebf[_0x4b9e('0x35')]);_0x4ed67e['filters']=_[_0x4b9e('0x39')](_0x4ed67e['model'],_0x4ed67e[_0x4b9e('0x35')]);_0x52cddf[_0x4b9e('0x38')]=_[_0x4b9e('0x39')](_0x4ed67e['model'],qs['fields'](_0x335ebf[_0x4b9e('0x35')][_0x4b9e('0x3a')]));_0x52cddf[_0x4b9e('0x38')]=_0x52cddf[_0x4b9e('0x38')][_0x4b9e('0x3b')]?_0x52cddf[_0x4b9e('0x38')]:_0x4ed67e[_0x4b9e('0x37')];if(_0x335ebf[_0x4b9e('0x35')][_0x4b9e('0x47')]){_0x52cddf[_0x4b9e('0x48')]=[{'all':!![]}];}_0x52cddf=_[_0x4b9e('0x44')]({},_0x52cddf,_0x335ebf[_0x4b9e('0x46')]);return db[_0x4b9e('0x30')]['find'](_0x52cddf)[_0x4b9e('0x28')](handleEntityNotFound(_0x349940,null))['then'](respondWithResult(_0x349940,null))[_0x4b9e('0x49')](handleError(_0x349940,null));};exports[_0x4b9e('0x4b')]=function(_0x342614,_0x1104bd){return db[_0x4b9e('0x30')]['create'](_0x342614['body'],{})['then'](respondWithResult(_0x1104bd,0xc9))['catch'](handleError(_0x1104bd,null));};exports[_0x4b9e('0x4c')]=function(_0x47e87e,_0x295848){return db['AnalyticFieldReport'][_0x4b9e('0x4c')](_0x47e87e[_0x4b9e('0x4d')],{'raw':![],'individualHooks':!![]})[_0x4b9e('0x28')](respondWithResult(_0x295848,0xc9))[_0x4b9e('0x49')](handleError(_0x295848,null));};exports[_0x4b9e('0x27')]=function(_0x3528dd,_0x45b285){if(_0x3528dd[_0x4b9e('0x4d')]['id']){delete _0x3528dd['body']['id'];}return db[_0x4b9e('0x30')]['find']({'where':{'id':_0x3528dd[_0x4b9e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45b285,null))[_0x4b9e('0x28')](saveUpdates(_0x3528dd[_0x4b9e('0x4d')],null))['then'](respondWithResult(_0x45b285,null))[_0x4b9e('0x49')](handleError(_0x45b285,null));};exports['destroy']=function(_0x25ec27,_0x112add){return db[_0x4b9e('0x30')][_0x4b9e('0x4e')]({'where':{'id':_0x25ec27['params']['id']}})[_0x4b9e('0x28')](handleEntityNotFound(_0x112add,null))[_0x4b9e('0x28')](removeEntity(_0x112add,null))[_0x4b9e('0x49')](handleError(_0x112add,null));};exports[_0x4b9e('0x4f')]=function(_0x4e3c68,_0x3eb8c5){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x4e3c68[_0x4b9e('0x35')][_0x4b9e('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x4b9e('0x28')](respondWithResult(_0x3eb8c5,0xcc))[_0x4b9e('0x49')](handleError(_0x3eb8c5,null));};exports[_0x4b9e('0x51')]=function(_0x24698b,_0x47b292,_0x396bd6){return db['AnalyticCustomReport'][_0x4b9e('0x52')]({'where':{'id':_0x24698b['params']['id']}})[_0x4b9e('0x28')](handleEntityNotFound(_0x47b292,null))[_0x4b9e('0x28')](function(_0x166932){if(_0x166932){return db[_0x4b9e('0x53')][_0x4b9e('0x54')](function(_0x17c3d7){return db['AnalyticFieldReport'][_0x4b9e('0x29')]({'where':{'CustomReportId':_0x24698b['params']['id']},'transaction':_0x17c3d7})[_0x4b9e('0x28')](function(_0x4147f1){var _0x55aa10=_[_0x4b9e('0x2f')](_0x24698b['body'],function(_0x358ecd){delete _0x358ecd['id'];_0x358ecd[_0x4b9e('0x55')]=_0x24698b[_0x4b9e('0x4a')]['id'];return _0x358ecd;});return db[_0x4b9e('0x30')][_0x4b9e('0x4c')](_0x55aa10,{'transaction':_0x17c3d7});});})[_0x4b9e('0x28')](function(){return db[_0x4b9e('0x30')][_0x4b9e('0x56')]({'where':{'CustomReportId':_0x24698b['params']['id']}});});}})[_0x4b9e('0x28')](respondWithResult(_0x47b292,null))['catch'](handleError(_0x47b292,null));}; \ No newline at end of file +var _0xf596=['rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','AnalyticFieldReport'];(function(_0x1fad12,_0x1764ea){var _0x6ef56b=function(_0xd684e8){while(--_0xd684e8){_0x1fad12['push'](_0x1fad12['shift']());}};_0x6ef56b(++_0x1764ea);}(_0xf596,0xd3));var _0x6f59=function(_0x3c866e,_0x39ad83){_0x3c866e=_0x3c866e-0x0;var _0x4e0c60=_0xf596[_0x3c866e];return _0x4e0c60;};'use strict';var emlformat=require(_0x6f59('0x0'));var rimraf=require(_0x6f59('0x1'));var zipdir=require(_0x6f59('0x2'));var jsonpatch=require(_0x6f59('0x3'));var rp=require(_0x6f59('0x4'));var moment=require(_0x6f59('0x5'));var BPromise=require(_0x6f59('0x6'));var Mustache=require(_0x6f59('0x7'));var util=require(_0x6f59('0x8'));var path=require(_0x6f59('0x9'));var sox=require(_0x6f59('0xa'));var csv=require(_0x6f59('0xb'));var ejs=require(_0x6f59('0xc'));var fs=require('fs');var fs_extra=require(_0x6f59('0xd'));var _=require(_0x6f59('0xe'));var squel=require('squel');var crypto=require(_0x6f59('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6f59('0x10'));var toCsv=require(_0x6f59('0xb'));var querystring=require(_0x6f59('0x11'));var Papa=require(_0x6f59('0x12'));var Redis=require('ioredis');var authService=require(_0x6f59('0x13'));var qs=require(_0x6f59('0x14'));var as=require(_0x6f59('0x15'));var hardwareService=require(_0x6f59('0x16'));var logger=require(_0x6f59('0x17'))(_0x6f59('0x18'));var utils=require(_0x6f59('0x19'));var config=require(_0x6f59('0x1a'));var licenseUtil=require(_0x6f59('0x1b'));var db=require(_0x6f59('0x1c'))['db'];function respondWithStatusCode(_0x103acd,_0x54da27){_0x54da27=_0x54da27||0xcc;return function(_0x5861a1){if(_0x5861a1){return _0x103acd[_0x6f59('0x1d')](_0x54da27);}return _0x103acd['status'](_0x54da27)[_0x6f59('0x1e')]();};}function respondWithResult(_0x678993,_0x32c385){_0x32c385=_0x32c385||0xc8;return function(_0x18e7b6){if(_0x18e7b6){return _0x678993[_0x6f59('0x1f')](_0x32c385)[_0x6f59('0x20')](_0x18e7b6);}};}function respondWithFilteredResult(_0x25f611,_0x541ae3){return function(_0x4337dc){if(_0x4337dc){var _0x3161a0=typeof _0x541ae3[_0x6f59('0x21')]==='undefined'&&typeof _0x541ae3[_0x6f59('0x22')]===_0x6f59('0x23');var _0x3801e0=_0x4337dc[_0x6f59('0x24')];var _0x5c5da4=_0x3161a0?0x0:_0x541ae3[_0x6f59('0x21')];var _0x32c3ec=_0x3161a0?_0x4337dc['count']:_0x541ae3[_0x6f59('0x21')]+_0x541ae3[_0x6f59('0x22')];var _0x1ce4c6;if(_0x32c3ec>=_0x3801e0){_0x32c3ec=_0x3801e0;_0x1ce4c6=0xc8;}else{_0x1ce4c6=0xce;}_0x25f611[_0x6f59('0x1f')](_0x1ce4c6);return _0x25f611[_0x6f59('0x25')](_0x6f59('0x26'),_0x5c5da4+'-'+_0x32c3ec+'/'+_0x3801e0)[_0x6f59('0x20')](_0x4337dc);}return null;};}function patchUpdates(_0xe58eba){return function(_0x4aec45){try{jsonpatch[_0x6f59('0x27')](_0x4aec45,_0xe58eba,!![]);}catch(_0x255fbd){return BPromise[_0x6f59('0x28')](_0x255fbd);}return _0x4aec45[_0x6f59('0x29')]();};}function saveUpdates(_0x872ca3,_0x5dfc0d){return function(_0x579932){if(_0x579932){return _0x579932[_0x6f59('0x2a')](_0x872ca3)[_0x6f59('0x2b')](function(_0x25461a){return _0x25461a;});}return null;};}function removeEntity(_0x1b7213,_0x50d81e){return function(_0x55fd9f){if(_0x55fd9f){return _0x55fd9f[_0x6f59('0x2c')]()[_0x6f59('0x2b')](function(){_0x1b7213[_0x6f59('0x1f')](0xcc)[_0x6f59('0x1e')]();});}};}function handleEntityNotFound(_0x46acd1,_0x29f076){return function(_0x56bc60){if(!_0x56bc60){_0x46acd1[_0x6f59('0x1d')](0x194);}return _0x56bc60;};}function handleError(_0x1f6502,_0x902f2b){_0x902f2b=_0x902f2b||0x1f4;return function(_0x1a97ab){logger[_0x6f59('0x2d')](_0x1a97ab[_0x6f59('0x2e')]);if(_0x1a97ab[_0x6f59('0x2f')]){delete _0x1a97ab['name'];}_0x1f6502[_0x6f59('0x1f')](_0x902f2b)[_0x6f59('0x30')](_0x1a97ab);};}exports['index']=function(_0x2268b5,_0x8593eb){var _0x4bdb03={},_0x4733a7={},_0x517409={'count':0x0,'rows':[]};var _0x188a2f=_['map'](db[_0x6f59('0x31')][_0x6f59('0x32')],function(_0xb04b2d){return{'name':_0xb04b2d[_0x6f59('0x33')],'type':_0xb04b2d[_0x6f59('0x34')][_0x6f59('0x35')]};});_0x4733a7['model']=_[_0x6f59('0x36')](_0x188a2f,_0x6f59('0x2f'));_0x4733a7[_0x6f59('0x37')]=_[_0x6f59('0x38')](_0x2268b5[_0x6f59('0x37')]);_0x4733a7[_0x6f59('0x39')]=_['intersection'](_0x4733a7['model'],_0x4733a7[_0x6f59('0x37')]);_0x4bdb03[_0x6f59('0x3a')]=_[_0x6f59('0x3b')](_0x4733a7['model'],qs[_0x6f59('0x3c')](_0x2268b5['query']['fields']));_0x4bdb03[_0x6f59('0x3a')]=_0x4bdb03['attributes']['length']?_0x4bdb03[_0x6f59('0x3a')]:_0x4733a7[_0x6f59('0x3d')];if(!_0x2268b5[_0x6f59('0x37')][_0x6f59('0x3e')](_0x6f59('0x3f'))){_0x4bdb03['limit']=qs[_0x6f59('0x22')](_0x2268b5[_0x6f59('0x37')]['limit']);_0x4bdb03[_0x6f59('0x21')]=qs[_0x6f59('0x21')](_0x2268b5['query'][_0x6f59('0x21')]);}_0x4bdb03[_0x6f59('0x40')]=qs[_0x6f59('0x41')](_0x2268b5[_0x6f59('0x37')][_0x6f59('0x41')]);_0x4bdb03[_0x6f59('0x42')]=qs[_0x6f59('0x39')](_[_0x6f59('0x43')](_0x2268b5[_0x6f59('0x37')],_0x4733a7[_0x6f59('0x39')]),_0x188a2f);if(_0x2268b5['query'][_0x6f59('0x44')]){_0x4bdb03[_0x6f59('0x42')]=_[_0x6f59('0x45')](_0x4bdb03['where'],{'$or':_['map'](_0x188a2f,function(_0x2a90f7){if(_0x2a90f7[_0x6f59('0x34')]!=='VIRTUAL'){var _0x3c5cdc={};_0x3c5cdc[_0x2a90f7['name']]={'$like':'%'+_0x2268b5[_0x6f59('0x37')]['filter']+'%'};return _0x3c5cdc;}})});}_0x4bdb03=_[_0x6f59('0x45')]({},_0x4bdb03,_0x2268b5[_0x6f59('0x46')]);var _0x311592={'where':_0x4bdb03[_0x6f59('0x42')]};return db[_0x6f59('0x31')][_0x6f59('0x24')](_0x311592)['then'](function(_0x4666a9){_0x517409[_0x6f59('0x24')]=_0x4666a9;if(_0x2268b5['query'][_0x6f59('0x47')]){_0x4bdb03[_0x6f59('0x48')]=[{'all':!![]}];}return db[_0x6f59('0x31')][_0x6f59('0x49')](_0x4bdb03);})[_0x6f59('0x2b')](function(_0x4c8d65){_0x517409['rows']=_0x4c8d65;return _0x517409;})[_0x6f59('0x2b')](respondWithFilteredResult(_0x8593eb,_0x4bdb03))[_0x6f59('0x4a')](handleError(_0x8593eb,null));};exports[_0x6f59('0x4b')]=function(_0x3c7bc4,_0x127c73){var _0x24d67f={'raw':![],'where':{'id':_0x3c7bc4[_0x6f59('0x4c')]['id']}},_0x20ec19={};_0x20ec19[_0x6f59('0x3d')]=_[_0x6f59('0x38')](db[_0x6f59('0x31')][_0x6f59('0x32')]);_0x20ec19[_0x6f59('0x37')]=_[_0x6f59('0x38')](_0x3c7bc4['query']);_0x20ec19[_0x6f59('0x39')]=_[_0x6f59('0x3b')](_0x20ec19['model'],_0x20ec19[_0x6f59('0x37')]);_0x24d67f[_0x6f59('0x3a')]=_['intersection'](_0x20ec19[_0x6f59('0x3d')],qs[_0x6f59('0x3c')](_0x3c7bc4[_0x6f59('0x37')][_0x6f59('0x3c')]));_0x24d67f[_0x6f59('0x3a')]=_0x24d67f['attributes']['length']?_0x24d67f['attributes']:_0x20ec19[_0x6f59('0x3d')];if(_0x3c7bc4[_0x6f59('0x37')]['includeAll']){_0x24d67f[_0x6f59('0x48')]=[{'all':!![]}];}_0x24d67f=_[_0x6f59('0x45')]({},_0x24d67f,_0x3c7bc4[_0x6f59('0x46')]);return db[_0x6f59('0x31')][_0x6f59('0x4d')](_0x24d67f)[_0x6f59('0x2b')](handleEntityNotFound(_0x127c73,null))[_0x6f59('0x2b')](respondWithResult(_0x127c73,null))[_0x6f59('0x4a')](handleError(_0x127c73,null));};exports[_0x6f59('0x4e')]=function(_0xedcc15,_0x4732e6){return db[_0x6f59('0x31')][_0x6f59('0x4e')](_0xedcc15[_0x6f59('0x4f')],{})[_0x6f59('0x2b')](respondWithResult(_0x4732e6,0xc9))['catch'](handleError(_0x4732e6,null));};exports[_0x6f59('0x50')]=function(_0x3210e1,_0x2ee324){return db[_0x6f59('0x31')][_0x6f59('0x50')](_0x3210e1[_0x6f59('0x4f')],{'raw':![],'individualHooks':!![]})[_0x6f59('0x2b')](respondWithResult(_0x2ee324,0xc9))[_0x6f59('0x4a')](handleError(_0x2ee324,null));};exports[_0x6f59('0x2a')]=function(_0x22e53d,_0x2e22fc){if(_0x22e53d['body']['id']){delete _0x22e53d[_0x6f59('0x4f')]['id'];}return db[_0x6f59('0x31')]['find']({'where':{'id':_0x22e53d[_0x6f59('0x4c')]['id']}})[_0x6f59('0x2b')](handleEntityNotFound(_0x2e22fc,null))[_0x6f59('0x2b')](saveUpdates(_0x22e53d[_0x6f59('0x4f')],null))['then'](respondWithResult(_0x2e22fc,null))[_0x6f59('0x4a')](handleError(_0x2e22fc,null));};exports[_0x6f59('0x2c')]=function(_0x2a4021,_0x3b01ae){return db[_0x6f59('0x31')][_0x6f59('0x4d')]({'where':{'id':_0x2a4021['params']['id']}})['then'](handleEntityNotFound(_0x3b01ae,null))[_0x6f59('0x2b')](removeEntity(_0x3b01ae,null))[_0x6f59('0x4a')](handleError(_0x3b01ae,null));};exports[_0x6f59('0x51')]=function(_0x18ff5f,_0xfb061d){return db[_0x6f59('0x31')][_0x6f59('0x2c')]({'where':{'id':_0x18ff5f['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xfb061d,0xcc))[_0x6f59('0x4a')](handleError(_0xfb061d,null));};exports[_0x6f59('0x52')]=function(_0x520244,_0x368596,_0x34b32f){return db[_0x6f59('0x53')]['findOne']({'where':{'id':_0x520244[_0x6f59('0x4c')]['id']}})['then'](handleEntityNotFound(_0x368596,null))[_0x6f59('0x2b')](function(_0xdba50){if(_0xdba50){return db[_0x6f59('0x54')][_0x6f59('0x55')](function(_0x524ac7){return db[_0x6f59('0x31')][_0x6f59('0x2c')]({'where':{'CustomReportId':_0x520244[_0x6f59('0x4c')]['id']},'transaction':_0x524ac7})[_0x6f59('0x2b')](function(_0x1bb3dd){var _0xcec0c1=_[_0x6f59('0x36')](_0x520244['body'],function(_0x29f7f1){delete _0x29f7f1['id'];_0x29f7f1[_0x6f59('0x56')]=_0x520244[_0x6f59('0x4c')]['id'];return _0x29f7f1;});return db['AnalyticFieldReport'][_0x6f59('0x50')](_0xcec0c1,{'transaction':_0x524ac7});});})[_0x6f59('0x2b')](function(){return db[_0x6f59('0x31')][_0x6f59('0x49')]({'where':{'CustomReportId':_0x520244[_0x6f59('0x4c')]['id']}});});}})['then'](respondWithResult(_0x368596,null))['catch'](handleError(_0x368596,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e1da2ad..8781cef 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 _0x0a07=['api','bluebird','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','util','../../config/logger'];(function(_0x4eab11,_0x420bfb){var _0x417a63=function(_0x35f378){while(--_0x35f378){_0x4eab11['push'](_0x4eab11['shift']());}};_0x417a63(++_0x420bfb);}(_0x0a07,0x7b));var _0x70a0=function(_0x4c3184,_0x52ea70){_0x4c3184=_0x4c3184-0x0;var _0x2ff62b=_0x0a07[_0x4c3184];return _0x2ff62b;};'use strict';var _=require(_0x70a0('0x0'));var util=require(_0x70a0('0x1'));var logger=require(_0x70a0('0x2'))(_0x70a0('0x3'));var moment=require('moment');var BPromise=require(_0x70a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x70a0('0x5'));var attributes=require(_0x70a0('0x6'));module['exports']=function(_0x3d06d3,_0x50fa55){return _0x3d06d3[_0x70a0('0x7')](_0x70a0('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x143d=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','util'];(function(_0x2517ef,_0x2769da){var _0x452311=function(_0xafc35d){while(--_0xafc35d){_0x2517ef['push'](_0x2517ef['shift']());}};_0x452311(++_0x2769da);}(_0x143d,0xfc));var _0xd143=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0x143d[_0x810025];return _0x4dbc81;};'use strict';var _=require('lodash');var util=require(_0xd143('0x0'));var logger=require(_0xd143('0x1'))(_0xd143('0x2'));var moment=require(_0xd143('0x3'));var BPromise=require('bluebird');var rp=require(_0xd143('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd143('0x5'));var config=require(_0xd143('0x6'));var attributes=require(_0xd143('0x7'));module[_0xd143('0x8')]=function(_0x5f2549,_0xb4a74c){return _0x5f2549['define'](_0xd143('0x9'),attributes,{'tableName':_0xd143('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 8782aa7..6e1bf77 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 _0xe319=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x1e5a0c,_0x3a16fc){var _0x5cc15b=function(_0x39e08f){while(--_0x39e08f){_0x1e5a0c['push'](_0x1e5a0c['shift']());}};_0x5cc15b(++_0x3a16fc);}(_0xe319,0xac));var _0x9e31=function(_0x3f5002,_0x51cd58){_0x3f5002=_0x3f5002-0x0;var _0x357b9e=_0xe319[_0x3f5002];return _0x357b9e;};'use strict';var _=require(_0x9e31('0x0'));var util=require('util');var moment=require(_0x9e31('0x1'));var BPromise=require(_0x9e31('0x2'));var rs=require(_0x9e31('0x3'));var fs=require('fs');var Redis=require(_0x9e31('0x4'));var db=require(_0x9e31('0x5'))['db'];var utils=require(_0x9e31('0x6'));var logger=require(_0x9e31('0x7'))('rpc');var config=require(_0x9e31('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e31('0x9')][_0x9e31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2965ee,_0x3ba86a,_0x5ebbe1){return new BPromise(function(_0x500d47,_0x54a522){return client['request'](_0x2965ee,_0x5ebbe1)[_0x9e31('0xb')](function(_0x1177df){logger[_0x9e31('0xc')](_0x9e31('0xd'),_0x3ba86a,_0x9e31('0xe'));logger[_0x9e31('0xf')](_0x9e31('0x10'),_0x3ba86a,_0x9e31('0xe'),JSON[_0x9e31('0x11')](_0x1177df));if(_0x1177df[_0x9e31('0x12')]){if(_0x1177df[_0x9e31('0x12')][_0x9e31('0x13')]===0x1f4){logger[_0x9e31('0x12')](_0x9e31('0xd'),_0x3ba86a,_0x1177df[_0x9e31('0x12')]['message']);return _0x54a522(_0x1177df['error'][_0x9e31('0x14')]);}logger[_0x9e31('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3ba86a,_0x1177df[_0x9e31('0x12')][_0x9e31('0x14')]);return _0x500d47(_0x1177df[_0x9e31('0x12')][_0x9e31('0x14')]);}else{logger[_0x9e31('0xc')](_0x9e31('0xd'),_0x3ba86a,_0x9e31('0xe'));_0x500d47(_0x1177df[_0x9e31('0x15')]['message']);}})[_0x9e31('0x16')](function(_0x4bcf6e){logger['error'](_0x9e31('0xd'),_0x3ba86a,_0x4bcf6e);_0x54a522(_0x4bcf6e);});});} \ No newline at end of file +var _0x18c7=['client','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x18c7,0x64));var _0x718c=function(_0x14d993,_0x26e5dc){_0x14d993=_0x14d993-0x0;var _0x66af08=_0x18c7[_0x14d993];return _0x66af08;};'use strict';var _=require(_0x718c('0x0'));var util=require(_0x718c('0x1'));var moment=require('moment');var BPromise=require(_0x718c('0x2'));var rs=require(_0x718c('0x3'));var fs=require('fs');var Redis=require(_0x718c('0x4'));var db=require(_0x718c('0x5'))['db'];var utils=require(_0x718c('0x6'));var logger=require(_0x718c('0x7'))(_0x718c('0x8'));var config=require(_0x718c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x718c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48d71d,_0x5a5049,_0xa7553b){return new BPromise(function(_0x1ce2e1,_0x1089ef){return client['request'](_0x48d71d,_0xa7553b)[_0x718c('0xb')](function(_0x13d48a){logger[_0x718c('0xc')](_0x718c('0xd'),_0x5a5049,_0x718c('0xe'));logger['debug'](_0x718c('0xf'),_0x5a5049,_0x718c('0xe'),JSON[_0x718c('0x10')](_0x13d48a));if(_0x13d48a['error']){if(_0x13d48a['error'][_0x718c('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5a5049,_0x13d48a[_0x718c('0x12')][_0x718c('0x13')]);return _0x1089ef(_0x13d48a[_0x718c('0x12')][_0x718c('0x13')]);}logger[_0x718c('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5a5049,_0x13d48a[_0x718c('0x12')][_0x718c('0x13')]);return _0x1ce2e1(_0x13d48a[_0x718c('0x12')][_0x718c('0x13')]);}else{logger[_0x718c('0xc')](_0x718c('0xd'),_0x5a5049,_0x718c('0xe'));_0x1ce2e1(_0x13d48a[_0x718c('0x14')][_0x718c('0x13')]);}})[_0x718c('0x15')](function(_0xfd5408){logger[_0x718c('0x12')](_0x718c('0xd'),_0x5a5049,_0xfd5408);_0x1089ef(_0xfd5408);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0da01b0..c4654aa 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(_0x1450b6,_0xa089aa){var _0x29d3a8=function(_0x18a928){while(--_0x18a928){_0x1450b6['push'](_0x1450b6['shift']());}};_0x29d3a8(++_0xa089aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x2d08d2,_0x1d5c45){var _0x4f2b0c=function(_0x339c9d){while(--_0x339c9d){_0x2d08d2['push'](_0x2d08d2['shift']());}};_0x4f2b0c(++_0x1d5c45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index ae0f096..cc6601e 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 _0x6c63=['exports','STRING','name','TEXT','sequelize'];(function(_0x4c78c6,_0x3d6889){var _0x5431b8=function(_0x192846){while(--_0x192846){_0x4c78c6['push'](_0x4c78c6['shift']());}};_0x5431b8(++_0x3d6889);}(_0x6c63,0x1ee));var _0x36c6=function(_0x5bf329,_0x5379ae){_0x5bf329=_0x5bf329-0x0;var _0x1b7005=_0x6c63[_0x5bf329];return _0x1b7005;};'use strict';var Sequelize=require(_0x36c6('0x0'));module[_0x36c6('0x1')]={'name':{'type':Sequelize[_0x36c6('0x2')],'allowNull':![],'unique':_0x36c6('0x3')},'table':{'type':Sequelize[_0x36c6('0x2')]},'metric':{'type':Sequelize[_0x36c6('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f8b=['sequelize','exports','name','STRING','TEXT'];(function(_0x486224,_0x519bad){var _0x303931=function(_0x5f3246){while(--_0x5f3246){_0x486224['push'](_0x486224['shift']());}};_0x303931(++_0x519bad);}(_0x2f8b,0x96));var _0xb2f8=function(_0x1eecf6,_0x28ebba){_0x1eecf6=_0x1eecf6-0x0;var _0x84c3d8=_0x2f8b[_0x1eecf6];return _0x84c3d8;};'use strict';var Sequelize=require(_0xb2f8('0x0'));module[_0xb2f8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb2f8('0x2')},'table':{'type':Sequelize[_0xb2f8('0x3')]},'metric':{'type':Sequelize[_0xb2f8('0x4')]},'description':{'type':Sequelize[_0xb2f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3f3ca3b..f921a9b 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x4deac3,_0x49a143){var _0x190902=function(_0x55a521){while(--_0x55a521){_0x4deac3['push'](_0x4deac3['shift']());}};_0x190902(++_0x49a143);}(_0x9a19,0x114));var _0x99a1=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9a19[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +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(_0x1235a8,_0x2db48e){var _0x41a2cf=function(_0x2c30df){while(--_0x2c30df){_0x1235a8['push'](_0x1235a8['shift']());}};_0x41a2cf(++_0x2db48e);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4a29d7,_0x19eaee){_0x4a29d7=_0x4a29d7-0x0;var _0x1bec46=_0x9c5a[_0x4a29d7];return _0x1bec46;};'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 diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5275479..189ff84 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 _0x13c5=['exports','analytics_metrics','lodash','path','./analyticMetric.attributes'];(function(_0x8b06f7,_0x2afcff){var _0x30d20a=function(_0x2388ed){while(--_0x2388ed){_0x8b06f7['push'](_0x8b06f7['shift']());}};_0x30d20a(++_0x2afcff);}(_0x13c5,0x7a));var _0x513c=function(_0x3e5eda,_0x156d80){_0x3e5eda=_0x3e5eda-0x0;var _0x482d3f=_0x13c5[_0x3e5eda];return _0x482d3f;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513c('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x513c('0x2'));module[_0x513c('0x3')]=function(_0x982017,_0x2ad2db){return _0x982017['define']('AnalyticMetric',attributes,{'tableName':_0x513c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x539d=['../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x233e6f,_0x4019ac){var _0x1deeb0=function(_0x43f942){while(--_0x43f942){_0x233e6f['push'](_0x233e6f['shift']());}};_0x1deeb0(++_0x4019ac);}(_0x539d,0x17b));var _0xd539=function(_0x212579,_0xdb4d5a){_0x212579=_0x212579-0x0;var _0x55d50e=_0x539d[_0x212579];return _0x55d50e;};'use strict';var _=require(_0xd539('0x0'));var util=require('util');var logger=require(_0xd539('0x1'))(_0xd539('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd539('0x3'));var fs=require('fs');var path=require(_0xd539('0x4'));var rimraf=require(_0xd539('0x5'));var config=require(_0xd539('0x6'));var attributes=require(_0xd539('0x7'));module['exports']=function(_0x341dd4,_0x158719){return _0x341dd4[_0xd539('0x8')](_0xd539('0x9'),attributes,{'tableName':_0xd539('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 17c7482..8655e02 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 _0x7295=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s'];(function(_0x410464,_0x31b526){var _0x2dbece=function(_0x5966c6){while(--_0x5966c6){_0x410464['push'](_0x410464['shift']());}};_0x2dbece(++_0x31b526);}(_0x7295,0x10b));var _0x5729=function(_0x47cc41,_0x11e552){_0x47cc41=_0x47cc41-0x0;var _0x580c72=_0x7295[_0x47cc41];return _0x580c72;};'use strict';var _=require(_0x5729('0x0'));var util=require(_0x5729('0x1'));var moment=require(_0x5729('0x2'));var BPromise=require(_0x5729('0x3'));var rs=require(_0x5729('0x4'));var fs=require('fs');var Redis=require(_0x5729('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5729('0x6'));var logger=require(_0x5729('0x7'))('rpc');var config=require(_0x5729('0x8'));var jayson=require(_0x5729('0x9'));var client=jayson['client'][_0x5729('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x321f77,_0x55f6cd,_0xa8dd21){return new BPromise(function(_0x58d51e,_0x27fa78){return client['request'](_0x321f77,_0xa8dd21)['then'](function(_0x423f17){logger[_0x5729('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x55f6cd,_0x5729('0xc'));logger[_0x5729('0xd')](_0x5729('0xe'),_0x55f6cd,_0x5729('0xc'),JSON[_0x5729('0xf')](_0x423f17));if(_0x423f17[_0x5729('0x10')]){if(_0x423f17['error']['code']===0x1f4){logger['error'](_0x5729('0x11'),_0x55f6cd,_0x423f17[_0x5729('0x10')]['message']);return _0x27fa78(_0x423f17['error'][_0x5729('0x12')]);}logger[_0x5729('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x55f6cd,_0x423f17[_0x5729('0x10')][_0x5729('0x12')]);return _0x58d51e(_0x423f17[_0x5729('0x10')][_0x5729('0x12')]);}else{logger[_0x5729('0xb')](_0x5729('0x11'),_0x55f6cd,_0x5729('0xc'));_0x58d51e(_0x423f17['result'][_0x5729('0x12')]);}})['catch'](function(_0x5cc425){logger[_0x5729('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x55f6cd,_0x5cc425);_0x27fa78(_0x5cc425);});});} \ No newline at end of file +var _0xbdc2=['http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1d7f9d,_0x529ab8){var _0x396d51=function(_0x1b9fed){while(--_0x1b9fed){_0x1d7f9d['push'](_0x1d7f9d['shift']());}};_0x396d51(++_0x529ab8);}(_0xbdc2,0xac));var _0x2bdc=function(_0x1b6057,_0x43ac7e){_0x1b6057=_0x1b6057-0x0;var _0x19ed50=_0xbdc2[_0x1b6057];return _0x19ed50;};'use strict';var _=require('lodash');var util=require(_0x2bdc('0x0'));var moment=require(_0x2bdc('0x1'));var BPromise=require(_0x2bdc('0x2'));var rs=require(_0x2bdc('0x3'));var fs=require('fs');var Redis=require(_0x2bdc('0x4'));var db=require(_0x2bdc('0x5'))['db'];var utils=require(_0x2bdc('0x6'));var logger=require(_0x2bdc('0x7'))(_0x2bdc('0x8'));var config=require(_0x2bdc('0x9'));var jayson=require(_0x2bdc('0xa'));var client=jayson[_0x2bdc('0xb')][_0x2bdc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21b5d2,_0x56f25d,_0x2f4a88){return new BPromise(function(_0x5053f7,_0x3e09f6){return client['request'](_0x21b5d2,_0x2f4a88)[_0x2bdc('0xd')](function(_0x484ecf){logger[_0x2bdc('0xe')](_0x2bdc('0xf'),_0x56f25d,_0x2bdc('0x10'));logger[_0x2bdc('0x11')](_0x2bdc('0x12'),_0x56f25d,_0x2bdc('0x10'),JSON[_0x2bdc('0x13')](_0x484ecf));if(_0x484ecf[_0x2bdc('0x14')]){if(_0x484ecf[_0x2bdc('0x14')]['code']===0x1f4){logger[_0x2bdc('0x14')](_0x2bdc('0xf'),_0x56f25d,_0x484ecf[_0x2bdc('0x14')][_0x2bdc('0x15')]);return _0x3e09f6(_0x484ecf['error'][_0x2bdc('0x15')]);}logger['error'](_0x2bdc('0xf'),_0x56f25d,_0x484ecf[_0x2bdc('0x14')][_0x2bdc('0x15')]);return _0x5053f7(_0x484ecf[_0x2bdc('0x14')]['message']);}else{logger[_0x2bdc('0xe')](_0x2bdc('0xf'),_0x56f25d,'request\x20sent');_0x5053f7(_0x484ecf[_0x2bdc('0x16')]['message']);}})['catch'](function(_0x432db0){logger[_0x2bdc('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x56f25d,_0x432db0);_0x3e09f6(_0x432db0);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8350541..e0e3b4e 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 _0x56da=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb16083,_0xa1e4c5){var _0x5b1a52=function(_0x36b703){while(--_0x36b703){_0xb16083['push'](_0xb16083['shift']());}};_0x5b1a52(++_0xa1e4c5);}(_0x56da,0x119));var _0xa56d=function(_0x18daeb,_0x1b8ff3){_0x18daeb=_0x18daeb-0x0;var _0x425a30=_0x56da[_0x18daeb];return _0x425a30;};'use strict';var multer=require(_0xa56d('0x0'));var util=require('util');var path=require(_0xa56d('0x1'));var timeout=require(_0xa56d('0x2'));var express=require('express');var router=express[_0xa56d('0x3')]();var fs_extra=require(_0xa56d('0x4'));var auth=require(_0xa56d('0x5'));var interaction=require(_0xa56d('0x6'));var config=require(_0xa56d('0x7'));var controller=require(_0xa56d('0x8'));router[_0xa56d('0x9')]('/',auth[_0xa56d('0xa')](),controller[_0xa56d('0xb')]);router[_0xa56d('0x9')](_0xa56d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa56d('0xd')]('/',auth[_0xa56d('0xa')](),controller[_0xa56d('0xe')]);router[_0xa56d('0xf')](_0xa56d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa56d('0x10')](_0xa56d('0xc'),auth[_0xa56d('0xa')](),controller['destroy']);module[_0xa56d('0x11')]=router; \ No newline at end of file +var _0xd8fb=['get','index','/:id','show','post','put','isAuthenticated','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller'];(function(_0x173aca,_0x4cfe9f){var _0x5dbf81=function(_0x10c012){while(--_0x10c012){_0x173aca['push'](_0x173aca['shift']());}};_0x5dbf81(++_0x4cfe9f);}(_0xd8fb,0x99));var _0xbd8f=function(_0x55452f,_0x534f02){_0x55452f=_0x55452f-0x0;var _0xc7354d=_0xd8fb[_0x55452f];return _0xc7354d;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd8f('0xc')](_0xbd8f('0x9'),auth[_0xbd8f('0xd')](),controller['update']);router[_0xbd8f('0xe')](_0xbd8f('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xbd8f('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f8b47ae..2027767 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 _0xe62b=['sequelize','TEXT'];(function(_0xbb17d0,_0x597619){var _0x5238b0=function(_0x55f29c){while(--_0x55f29c){_0xbb17d0['push'](_0xbb17d0['shift']());}};_0x5238b0(++_0x597619);}(_0xe62b,0x180));var _0xbe62=function(_0x528b92,_0x2a3971){_0x528b92=_0x528b92-0x0;var _0x171eba=_0xe62b[_0x528b92];return _0x171eba;};'use strict';var Sequelize=require(_0xbe62('0x0'));module['exports']={'tree':{'type':Sequelize[_0xbe62('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2499=['sequelize','exports','TEXT'];(function(_0x3677fc,_0x187168){var _0x183fc3=function(_0x3d51c0){while(--_0x3d51c0){_0x3677fc['push'](_0x3677fc['shift']());}};_0x183fc3(++_0x187168);}(_0x2499,0x108));var _0x9249=function(_0x5dad14,_0x49ee81){_0x5dad14=_0x5dad14-0x0;var _0x5379da=_0x2499[_0x5dad14];return _0x5379da;};'use strict';var Sequelize=require(_0x9249('0x0'));module[_0x9249('0x1')]={'tree':{'type':Sequelize[_0x9249('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 0e1ff5d..9cc7916 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 _0xf298=['status','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','includeAll','include','AnalyticTreeReport','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xfa0d6,_0x2feed0){var _0x543b26=function(_0x410d31){while(--_0x410d31){_0xfa0d6['push'](_0xfa0d6['shift']());}};_0x543b26(++_0x2feed0);}(_0xf298,0xf6));var _0x8f29=function(_0x42bdaf,_0x510fb2){_0x42bdaf=_0x42bdaf-0x0;var _0x96cc6b=_0xf298[_0x42bdaf];return _0x96cc6b;};'use strict';var emlformat=require(_0x8f29('0x0'));var rimraf=require(_0x8f29('0x1'));var zipdir=require(_0x8f29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f29('0x3'));var moment=require(_0x8f29('0x4'));var BPromise=require(_0x8f29('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8f29('0x6'));var csv=require(_0x8f29('0x7'));var ejs=require(_0x8f29('0x8'));var fs=require('fs');var fs_extra=require(_0x8f29('0x9'));var _=require(_0x8f29('0xa'));var squel=require('squel');var crypto=require(_0x8f29('0xb'));var jsforce=require(_0x8f29('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8f29('0xd'));var Papa=require(_0x8f29('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8f29('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f29('0x10'));var utils=require(_0x8f29('0x11'));var config=require(_0x8f29('0x12'));var licenseUtil=require(_0x8f29('0x13'));var db=require(_0x8f29('0x14'))['db'];function respondWithStatusCode(_0x4ab8bb,_0xd636c6){_0xd636c6=_0xd636c6||0xcc;return function(_0x48a4d8){if(_0x48a4d8){return _0x4ab8bb[_0x8f29('0x15')](_0xd636c6);}return _0x4ab8bb[_0x8f29('0x16')](_0xd636c6)['end']();};}function respondWithResult(_0x36f34c,_0x49b891){_0x49b891=_0x49b891||0xc8;return function(_0x3771ba){if(_0x3771ba){return _0x36f34c[_0x8f29('0x16')](_0x49b891)['json'](_0x3771ba);}};}function respondWithFilteredResult(_0x386590,_0x10daa7){return function(_0xa882ba){if(_0xa882ba){var _0x1269ad=typeof _0x10daa7['offset']==='undefined'&&typeof _0x10daa7[_0x8f29('0x17')]===_0x8f29('0x18');var _0x4eb4f1=_0xa882ba[_0x8f29('0x19')];var _0x17906c=_0x1269ad?0x0:_0x10daa7['offset'];var _0x7fd74=_0x1269ad?_0xa882ba[_0x8f29('0x19')]:_0x10daa7['offset']+_0x10daa7[_0x8f29('0x17')];var _0x560960;if(_0x7fd74>=_0x4eb4f1){_0x7fd74=_0x4eb4f1;_0x560960=0xc8;}else{_0x560960=0xce;}_0x386590[_0x8f29('0x16')](_0x560960);return _0x386590[_0x8f29('0x1a')](_0x8f29('0x1b'),_0x17906c+'-'+_0x7fd74+'/'+_0x4eb4f1)[_0x8f29('0x1c')](_0xa882ba);}return null;};}function patchUpdates(_0x337f00){return function(_0x2aace8){try{jsonpatch[_0x8f29('0x1d')](_0x2aace8,_0x337f00,!![]);}catch(_0xd9672a){return BPromise[_0x8f29('0x1e')](_0xd9672a);}return _0x2aace8['save']();};}function saveUpdates(_0x5e418e,_0x1deecd){return function(_0x63abb7){if(_0x63abb7){return _0x63abb7[_0x8f29('0x1f')](_0x5e418e)['then'](function(_0x47df32){return _0x47df32;});}return null;};}function removeEntity(_0x4c9d6f,_0x3ff104){return function(_0x19135a){if(_0x19135a){return _0x19135a['destroy']()[_0x8f29('0x20')](function(){_0x4c9d6f[_0x8f29('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d77a2,_0xa52716){return function(_0x2bbe8b){if(!_0x2bbe8b){_0x4d77a2[_0x8f29('0x15')](0x194);}return _0x2bbe8b;};}function handleError(_0x1765e7,_0x430852){_0x430852=_0x430852||0x1f4;return function(_0x5809ef){logger[_0x8f29('0x21')](_0x5809ef[_0x8f29('0x22')]);if(_0x5809ef['name']){delete _0x5809ef[_0x8f29('0x23')];}_0x1765e7[_0x8f29('0x16')](_0x430852)[_0x8f29('0x24')](_0x5809ef);};}exports['index']=function(_0x28cb42,_0xd8d6ba){var _0x2f6c58={},_0x5f0a7d={},_0xe35d6e={'count':0x0,'rows':[]};var _0x3ea003=_[_0x8f29('0x25')](db['AnalyticTreeReport'][_0x8f29('0x26')],function(_0x7785c3){return{'name':_0x7785c3['fieldName'],'type':_0x7785c3[_0x8f29('0x27')]['key']};});_0x5f0a7d[_0x8f29('0x28')]=_['map'](_0x3ea003,_0x8f29('0x23'));_0x5f0a7d[_0x8f29('0x29')]=_[_0x8f29('0x2a')](_0x28cb42[_0x8f29('0x29')]);_0x5f0a7d['filters']=_[_0x8f29('0x2b')](_0x5f0a7d[_0x8f29('0x28')],_0x5f0a7d[_0x8f29('0x29')]);_0x2f6c58[_0x8f29('0x2c')]=_[_0x8f29('0x2b')](_0x5f0a7d[_0x8f29('0x28')],qs[_0x8f29('0x2d')](_0x28cb42[_0x8f29('0x29')]['fields']));_0x2f6c58[_0x8f29('0x2c')]=_0x2f6c58[_0x8f29('0x2c')][_0x8f29('0x2e')]?_0x2f6c58[_0x8f29('0x2c')]:_0x5f0a7d[_0x8f29('0x28')];if(!_0x28cb42['query']['hasOwnProperty'](_0x8f29('0x2f'))){_0x2f6c58[_0x8f29('0x17')]=qs[_0x8f29('0x17')](_0x28cb42['query']['limit']);_0x2f6c58[_0x8f29('0x30')]=qs[_0x8f29('0x30')](_0x28cb42[_0x8f29('0x29')][_0x8f29('0x30')]);}_0x2f6c58[_0x8f29('0x31')]=qs[_0x8f29('0x32')](_0x28cb42[_0x8f29('0x29')][_0x8f29('0x32')]);_0x2f6c58[_0x8f29('0x33')]=qs[_0x8f29('0x34')](_[_0x8f29('0x35')](_0x28cb42[_0x8f29('0x29')],_0x5f0a7d[_0x8f29('0x34')]),_0x3ea003);if(_0x28cb42[_0x8f29('0x29')][_0x8f29('0x36')]){_0x2f6c58[_0x8f29('0x33')]=_[_0x8f29('0x37')](_0x2f6c58[_0x8f29('0x33')],{'$or':_['map'](_0x3ea003,function(_0xf86c0c){if(_0xf86c0c['type']!=='VIRTUAL'){var _0x3cb183={};_0x3cb183[_0xf86c0c[_0x8f29('0x23')]]={'$like':'%'+_0x28cb42[_0x8f29('0x29')][_0x8f29('0x36')]+'%'};return _0x3cb183;}})});}_0x2f6c58=_[_0x8f29('0x37')]({},_0x2f6c58,_0x28cb42['options']);var _0x60980b={'where':_0x2f6c58[_0x8f29('0x33')]};return db['AnalyticTreeReport'][_0x8f29('0x19')](_0x60980b)[_0x8f29('0x20')](function(_0x4eefaf){_0xe35d6e['count']=_0x4eefaf;if(_0x28cb42[_0x8f29('0x29')][_0x8f29('0x38')]){_0x2f6c58[_0x8f29('0x39')]=[{'all':!![]}];}return db[_0x8f29('0x3a')][_0x8f29('0x3b')](_0x2f6c58);})[_0x8f29('0x20')](function(_0x3f20d2){_0xe35d6e['rows']=_0x3f20d2;return _0xe35d6e;})['then'](respondWithFilteredResult(_0xd8d6ba,_0x2f6c58))[_0x8f29('0x3c')](handleError(_0xd8d6ba,null));};exports[_0x8f29('0x3d')]=function(_0xfcbcff,_0x4bfa06){var _0x56f25b={'raw':!![],'where':{'id':_0xfcbcff[_0x8f29('0x3e')]['id']}},_0x3c8d6d={};_0x3c8d6d['model']=_[_0x8f29('0x2a')](db[_0x8f29('0x3a')][_0x8f29('0x26')]);_0x3c8d6d[_0x8f29('0x29')]=_[_0x8f29('0x2a')](_0xfcbcff[_0x8f29('0x29')]);_0x3c8d6d[_0x8f29('0x34')]=_[_0x8f29('0x2b')](_0x3c8d6d['model'],_0x3c8d6d[_0x8f29('0x29')]);_0x56f25b[_0x8f29('0x2c')]=_[_0x8f29('0x2b')](_0x3c8d6d[_0x8f29('0x28')],qs[_0x8f29('0x2d')](_0xfcbcff[_0x8f29('0x29')][_0x8f29('0x2d')]));_0x56f25b[_0x8f29('0x2c')]=_0x56f25b[_0x8f29('0x2c')][_0x8f29('0x2e')]?_0x56f25b['attributes']:_0x3c8d6d['model'];if(_0xfcbcff[_0x8f29('0x29')][_0x8f29('0x38')]){_0x56f25b['include']=[{'all':!![]}];}_0x56f25b=_[_0x8f29('0x37')]({},_0x56f25b,_0xfcbcff[_0x8f29('0x3f')]);return db[_0x8f29('0x3a')][_0x8f29('0x40')](_0x56f25b)['then'](handleEntityNotFound(_0x4bfa06,null))[_0x8f29('0x20')](respondWithResult(_0x4bfa06,null))[_0x8f29('0x3c')](handleError(_0x4bfa06,null));};exports['create']=function(_0x1d2a4b,_0x388601){return db[_0x8f29('0x3a')][_0x8f29('0x41')](_0x1d2a4b[_0x8f29('0x42')],{})[_0x8f29('0x20')](respondWithResult(_0x388601,0xc9))['catch'](handleError(_0x388601,null));};exports[_0x8f29('0x1f')]=function(_0x3fb6c7,_0x178e90){if(_0x3fb6c7['body']['id']){delete _0x3fb6c7['body']['id'];}return db[_0x8f29('0x3a')][_0x8f29('0x40')]({'where':{'id':_0x3fb6c7[_0x8f29('0x3e')]['id']}})['then'](handleEntityNotFound(_0x178e90,null))['then'](saveUpdates(_0x3fb6c7[_0x8f29('0x42')],null))[_0x8f29('0x20')](respondWithResult(_0x178e90,null))[_0x8f29('0x3c')](handleError(_0x178e90,null));};exports['destroy']=function(_0xace800,_0xdf0cd6){return db[_0x8f29('0x3a')][_0x8f29('0x40')]({'where':{'id':_0xace800[_0x8f29('0x3e')]['id']}})['then'](handleEntityNotFound(_0xdf0cd6,null))[_0x8f29('0x20')](removeEntity(_0xdf0cd6,null))[_0x8f29('0x3c')](handleError(_0xdf0cd6,null));}; \ No newline at end of file +var _0xc190=['create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','Content-Range','save','update','destroy','then','sendStatus','stack','name','index','map','AnalyticTreeReport','fieldName','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','catch','keys','rawAttributes','fields','find'];(function(_0x1c01f7,_0x580546){var _0x241f6f=function(_0xcdbad){while(--_0xcdbad){_0x1c01f7['push'](_0x1c01f7['shift']());}};_0x241f6f(++_0x580546);}(_0xc190,0x1f4));var _0x0c19=function(_0xefc3a0,_0x3e792e){_0xefc3a0=_0xefc3a0-0x0;var _0x5c681f=_0xc190[_0xefc3a0];return _0x5c681f;};'use strict';var emlformat=require(_0x0c19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c19('0x1'));var jsonpatch=require(_0x0c19('0x2'));var rp=require(_0x0c19('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0c19('0x4'));var util=require('util');var path=require(_0x0c19('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c19('0x6'));var _=require(_0x0c19('0x7'));var squel=require(_0x0c19('0x8'));var crypto=require(_0x0c19('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0c19('0xa'));var toCsv=require(_0x0c19('0xb'));var querystring=require(_0x0c19('0xc'));var Papa=require(_0x0c19('0xd'));var Redis=require(_0x0c19('0xe'));var authService=require(_0x0c19('0xf'));var qs=require(_0x0c19('0x10'));var as=require(_0x0c19('0x11'));var hardwareService=require(_0x0c19('0x12'));var logger=require(_0x0c19('0x13'))(_0x0c19('0x14'));var utils=require('../../config/utils');var config=require(_0x0c19('0x15'));var licenseUtil=require(_0x0c19('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x534e74,_0x4c2740){_0x4c2740=_0x4c2740||0xcc;return function(_0x27cfae){if(_0x27cfae){return _0x534e74['sendStatus'](_0x4c2740);}return _0x534e74[_0x0c19('0x17')](_0x4c2740)[_0x0c19('0x18')]();};}function respondWithResult(_0x1b6a84,_0x263ef7){_0x263ef7=_0x263ef7||0xc8;return function(_0x408684){if(_0x408684){return _0x1b6a84[_0x0c19('0x17')](_0x263ef7)[_0x0c19('0x19')](_0x408684);}};}function respondWithFilteredResult(_0x4cdd75,_0x52c705){return function(_0xd05879){if(_0xd05879){var _0x573f34=typeof _0x52c705[_0x0c19('0x1a')]===_0x0c19('0x1b')&&typeof _0x52c705['limit']==='undefined';var _0x47f51f=_0xd05879['count'];var _0x3bf708=_0x573f34?0x0:_0x52c705['offset'];var _0x3724a6=_0x573f34?_0xd05879['count']:_0x52c705[_0x0c19('0x1a')]+_0x52c705[_0x0c19('0x1c')];var _0x287b90;if(_0x3724a6>=_0x47f51f){_0x3724a6=_0x47f51f;_0x287b90=0xc8;}else{_0x287b90=0xce;}_0x4cdd75['status'](_0x287b90);return _0x4cdd75['set'](_0x0c19('0x1d'),_0x3bf708+'-'+_0x3724a6+'/'+_0x47f51f)[_0x0c19('0x19')](_0xd05879);}return null;};}function patchUpdates(_0x30ac8f){return function(_0x4ba6a6){try{jsonpatch['apply'](_0x4ba6a6,_0x30ac8f,!![]);}catch(_0x31d81b){return BPromise['reject'](_0x31d81b);}return _0x4ba6a6[_0x0c19('0x1e')]();};}function saveUpdates(_0xb612a3,_0x43ab9b){return function(_0x5bec7c){if(_0x5bec7c){return _0x5bec7c[_0x0c19('0x1f')](_0xb612a3)['then'](function(_0x5f2e8c){return _0x5f2e8c;});}return null;};}function removeEntity(_0x499c78,_0x1288b3){return function(_0x442922){if(_0x442922){return _0x442922[_0x0c19('0x20')]()[_0x0c19('0x21')](function(){_0x499c78[_0x0c19('0x17')](0xcc)[_0x0c19('0x18')]();});}};}function handleEntityNotFound(_0x1e2f8c,_0x52d893){return function(_0x243b3e){if(!_0x243b3e){_0x1e2f8c[_0x0c19('0x22')](0x194);}return _0x243b3e;};}function handleError(_0x3d4390,_0x52849a){_0x52849a=_0x52849a||0x1f4;return function(_0x25dc22){logger['error'](_0x25dc22[_0x0c19('0x23')]);if(_0x25dc22[_0x0c19('0x24')]){delete _0x25dc22['name'];}_0x3d4390['status'](_0x52849a)['send'](_0x25dc22);};}exports[_0x0c19('0x25')]=function(_0x4ac493,_0x35803a){var _0xbe3f48={},_0x145f57={},_0x3e9261={'count':0x0,'rows':[]};var _0x5c5217=_[_0x0c19('0x26')](db[_0x0c19('0x27')]['rawAttributes'],function(_0x487896){return{'name':_0x487896[_0x0c19('0x28')],'type':_0x487896['type'][_0x0c19('0x29')]};});_0x145f57['model']=_[_0x0c19('0x26')](_0x5c5217,_0x0c19('0x24'));_0x145f57[_0x0c19('0x2a')]=_['keys'](_0x4ac493[_0x0c19('0x2a')]);_0x145f57[_0x0c19('0x2b')]=_[_0x0c19('0x2c')](_0x145f57[_0x0c19('0x2d')],_0x145f57[_0x0c19('0x2a')]);_0xbe3f48['attributes']=_['intersection'](_0x145f57[_0x0c19('0x2d')],qs['fields'](_0x4ac493['query']['fields']));_0xbe3f48['attributes']=_0xbe3f48[_0x0c19('0x2e')][_0x0c19('0x2f')]?_0xbe3f48['attributes']:_0x145f57[_0x0c19('0x2d')];if(!_0x4ac493['query'][_0x0c19('0x30')](_0x0c19('0x31'))){_0xbe3f48[_0x0c19('0x1c')]=qs[_0x0c19('0x1c')](_0x4ac493[_0x0c19('0x2a')][_0x0c19('0x1c')]);_0xbe3f48['offset']=qs[_0x0c19('0x1a')](_0x4ac493[_0x0c19('0x2a')][_0x0c19('0x1a')]);}_0xbe3f48[_0x0c19('0x32')]=qs[_0x0c19('0x33')](_0x4ac493['query'][_0x0c19('0x33')]);_0xbe3f48[_0x0c19('0x34')]=qs[_0x0c19('0x2b')](_[_0x0c19('0x35')](_0x4ac493['query'],_0x145f57['filters']),_0x5c5217);if(_0x4ac493[_0x0c19('0x2a')]['filter']){_0xbe3f48['where']=_['merge'](_0xbe3f48[_0x0c19('0x34')],{'$or':_['map'](_0x5c5217,function(_0x505a16){if(_0x505a16[_0x0c19('0x36')]!==_0x0c19('0x37')){var _0x4c9857={};_0x4c9857[_0x505a16[_0x0c19('0x24')]]={'$like':'%'+_0x4ac493[_0x0c19('0x2a')][_0x0c19('0x38')]+'%'};return _0x4c9857;}})});}_0xbe3f48=_[_0x0c19('0x39')]({},_0xbe3f48,_0x4ac493[_0x0c19('0x3a')]);var _0x4bf832={'where':_0xbe3f48[_0x0c19('0x34')]};return db[_0x0c19('0x27')][_0x0c19('0x3b')](_0x4bf832)['then'](function(_0x48ea55){_0x3e9261['count']=_0x48ea55;if(_0x4ac493[_0x0c19('0x2a')][_0x0c19('0x3c')]){_0xbe3f48[_0x0c19('0x3d')]=[{'all':!![]}];}return db[_0x0c19('0x27')][_0x0c19('0x3e')](_0xbe3f48);})['then'](function(_0x46ae93){_0x3e9261['rows']=_0x46ae93;return _0x3e9261;})[_0x0c19('0x21')](respondWithFilteredResult(_0x35803a,_0xbe3f48))[_0x0c19('0x3f')](handleError(_0x35803a,null));};exports['show']=function(_0x15ca96,_0x59d4e8){var _0x597fb5={'raw':!![],'where':{'id':_0x15ca96['params']['id']}},_0x499689={};_0x499689[_0x0c19('0x2d')]=_[_0x0c19('0x40')](db[_0x0c19('0x27')][_0x0c19('0x41')]);_0x499689['query']=_[_0x0c19('0x40')](_0x15ca96['query']);_0x499689['filters']=_[_0x0c19('0x2c')](_0x499689[_0x0c19('0x2d')],_0x499689[_0x0c19('0x2a')]);_0x597fb5[_0x0c19('0x2e')]=_[_0x0c19('0x2c')](_0x499689['model'],qs[_0x0c19('0x42')](_0x15ca96[_0x0c19('0x2a')]['fields']));_0x597fb5[_0x0c19('0x2e')]=_0x597fb5[_0x0c19('0x2e')]['length']?_0x597fb5[_0x0c19('0x2e')]:_0x499689[_0x0c19('0x2d')];if(_0x15ca96[_0x0c19('0x2a')][_0x0c19('0x3c')]){_0x597fb5[_0x0c19('0x3d')]=[{'all':!![]}];}_0x597fb5=_[_0x0c19('0x39')]({},_0x597fb5,_0x15ca96[_0x0c19('0x3a')]);return db[_0x0c19('0x27')][_0x0c19('0x43')](_0x597fb5)[_0x0c19('0x21')](handleEntityNotFound(_0x59d4e8,null))['then'](respondWithResult(_0x59d4e8,null))['catch'](handleError(_0x59d4e8,null));};exports[_0x0c19('0x44')]=function(_0x1fb92c,_0x574743){return db['AnalyticTreeReport'][_0x0c19('0x44')](_0x1fb92c[_0x0c19('0x45')],{})['then'](respondWithResult(_0x574743,0xc9))[_0x0c19('0x3f')](handleError(_0x574743,null));};exports[_0x0c19('0x1f')]=function(_0xd672d3,_0x71ccf8){if(_0xd672d3[_0x0c19('0x45')]['id']){delete _0xd672d3[_0x0c19('0x45')]['id'];}return db[_0x0c19('0x27')][_0x0c19('0x43')]({'where':{'id':_0xd672d3[_0x0c19('0x46')]['id']}})[_0x0c19('0x21')](handleEntityNotFound(_0x71ccf8,null))[_0x0c19('0x21')](saveUpdates(_0xd672d3[_0x0c19('0x45')],null))['then'](respondWithResult(_0x71ccf8,null))[_0x0c19('0x3f')](handleError(_0x71ccf8,null));};exports[_0x0c19('0x20')]=function(_0x249d8e,_0x544f24){return db['AnalyticTreeReport'][_0x0c19('0x43')]({'where':{'id':_0x249d8e[_0x0c19('0x46')]['id']}})[_0x0c19('0x21')](handleEntityNotFound(_0x544f24,null))[_0x0c19('0x21')](removeEntity(_0x544f24,null))[_0x0c19('0x3f')](handleError(_0x544f24,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c8ad5ed..8e3458d 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 _0xb8f3=['request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x33f34e,_0x4fde5b){var _0x58dc01=function(_0x36e155){while(--_0x36e155){_0x33f34e['push'](_0x33f34e['shift']());}};_0x58dc01(++_0x4fde5b);}(_0xb8f3,0xbe));var _0x3b8f=function(_0x3f4568,_0x9eb0ee){_0x3f4568=_0x3f4568-0x0;var _0xee2340=_0xb8f3[_0x3f4568];return _0xee2340;};'use strict';var _=require(_0x3b8f('0x0'));var util=require(_0x3b8f('0x1'));var logger=require(_0x3b8f('0x2'))(_0x3b8f('0x3'));var moment=require(_0x3b8f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b8f('0x5'));var fs=require('fs');var path=require(_0x3b8f('0x6'));var rimraf=require(_0x3b8f('0x7'));var config=require('../../config/environment');var attributes=require(_0x3b8f('0x8'));module[_0x3b8f('0x9')]=function(_0x321272,_0x1dc460){return _0x321272[_0x3b8f('0xa')](_0x3b8f('0xb'),attributes,{'tableName':_0x3b8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf81=['path','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3173a5,_0x150e7c){var _0x26c94c=function(_0x11e335){while(--_0x11e335){_0x3173a5['push'](_0x3173a5['shift']());}};_0x26c94c(++_0x150e7c);}(_0xbf81,0x13a));var _0x1bf8=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0xbf81[_0x216d45];return _0xbaac0b;};'use strict';var _=require('lodash');var util=require(_0x1bf8('0x0'));var logger=require(_0x1bf8('0x1'))(_0x1bf8('0x2'));var moment=require('moment');var BPromise=require(_0x1bf8('0x3'));var rp=require(_0x1bf8('0x4'));var fs=require('fs');var path=require(_0x1bf8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bf8('0x6'));module[_0x1bf8('0x7')]=function(_0x3cda6e,_0x136e47){return _0x3cda6e[_0x1bf8('0x8')](_0x1bf8('0x9'),attributes,{'tableName':_0x1bf8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 7a43fdb..e9c851d 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(_0x367b96,_0x2bc5d5){var _0x19fd6e=function(_0x12681c){while(--_0x12681c){_0x367b96['push'](_0x367b96['shift']());}};_0x19fd6e(++_0x2bc5d5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x284609,_0x386b54){_0x284609=_0x284609-0x0;var _0x55116b=_0x5f2f[_0x284609];return _0x55116b;};'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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x2d101d,_0x814e7){var _0xa02f7b=function(_0x1075d5){while(--_0x1075d5){_0x2d101d['push'](_0x2d101d['shift']());}};_0xa02f7b(++_0x814e7);}(_0xdb28,0x106));var _0x8db2=function(_0x52921f,_0x43d3da){_0x52921f=_0x52921f-0x0;var _0x4a2f05=_0xdb28[_0x52921f];return _0x4a2f05;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 72b3cc2..cbb28bb 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 _0xc0a1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','put','update','delete','destroy','exports'];(function(_0x4fd6d0,_0x55451a){var _0x2452de=function(_0x517b1a){while(--_0x517b1a){_0x4fd6d0['push'](_0x4fd6d0['shift']());}};_0x2452de(++_0x55451a);}(_0xc0a1,0x90));var _0x1c0a=function(_0xc31458,_0x45ee76){_0xc31458=_0xc31458-0x0;var _0x1b4a90=_0xc0a1[_0xc31458];return _0x1b4a90;};'use strict';var multer=require('multer');var util=require(_0x1c0a('0x0'));var path=require(_0x1c0a('0x1'));var timeout=require(_0x1c0a('0x2'));var express=require(_0x1c0a('0x3'));var router=express[_0x1c0a('0x4')]();var fs_extra=require(_0x1c0a('0x5'));var auth=require(_0x1c0a('0x6'));var interaction=require(_0x1c0a('0x7'));var config=require(_0x1c0a('0x8'));var controller=require(_0x1c0a('0x9'));router[_0x1c0a('0xa')]('/',auth[_0x1c0a('0xb')](),controller['index']);router[_0x1c0a('0xa')](_0x1c0a('0xc'),auth[_0x1c0a('0xb')](),controller['show']);router['post']('/',auth[_0x1c0a('0xb')](),controller['create']);router[_0x1c0a('0xd')](_0x1c0a('0xc'),auth['isAuthenticated'](),controller[_0x1c0a('0xe')]);router[_0x1c0a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1c0a('0x10')]);module[_0x1c0a('0x11')]=router; \ No newline at end of file +var _0x2368=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','show','create','put','/:id','destroy','exports','multer','util','path'];(function(_0x34067a,_0x510624){var _0xc2e868=function(_0x3df173){while(--_0x3df173){_0x34067a['push'](_0x34067a['shift']());}};_0xc2e868(++_0x510624);}(_0x2368,0x1d1));var _0x8236=function(_0x43016e,_0x3ee132){_0x43016e=_0x43016e-0x0;var _0x161949=_0x2368[_0x43016e];return _0x161949;};'use strict';var multer=require(_0x8236('0x0'));var util=require(_0x8236('0x1'));var path=require(_0x8236('0x2'));var timeout=require('connect-timeout');var express=require(_0x8236('0x3'));var router=express['Router']();var fs_extra=require(_0x8236('0x4'));var auth=require(_0x8236('0x5'));var interaction=require(_0x8236('0x6'));var config=require(_0x8236('0x7'));var controller=require(_0x8236('0x8'));router['get']('/',auth[_0x8236('0x9')](),controller[_0x8236('0xa')]);router[_0x8236('0xb')]('/:id',auth[_0x8236('0x9')](),controller[_0x8236('0xc')]);router['post']('/',auth[_0x8236('0x9')](),controller[_0x8236('0xd')]);router[_0x8236('0xe')]('/:id',auth[_0x8236('0x9')](),controller['update']);router['delete'](_0x8236('0xf'),auth[_0x8236('0x9')](),controller[_0x8236('0x10')]);module[_0x8236('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 5dfab70..b21f25f 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 _0x83f1=['STRING','sequelize','exports'];(function(_0xea86b9,_0x55f73f){var _0x340174=function(_0x5c6350){while(--_0x5c6350){_0xea86b9['push'](_0xea86b9['shift']());}};_0x340174(++_0x55f73f);}(_0x83f1,0x1cc));var _0x183f=function(_0x1c55ed,_0x485ab0){_0x1c55ed=_0x1c55ed-0x0;var _0x3174bd=_0x83f1[_0x1c55ed];return _0x3174bd;};'use strict';var Sequelize=require(_0x183f('0x0'));module[_0x183f('0x1')]={'name':{'type':Sequelize[_0x183f('0x2')]},'basename':{'type':Sequelize[_0x183f('0x2')]},'type':{'type':Sequelize[_0x183f('0x2')]}}; \ No newline at end of file +var _0xaa7c=['sequelize'];(function(_0x25bcf7,_0x283759){var _0x2ee920=function(_0xecbdd9){while(--_0xecbdd9){_0x25bcf7['push'](_0x25bcf7['shift']());}};_0x2ee920(++_0x283759);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x5e84ec,_0x5ba3bb){_0x5e84ec=_0x5e84ec-0x0;var _0x41f73c=_0xaa7c[_0x5e84ec];return _0x41f73c;};'use strict';var Sequelize=require(_0xcaa7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ad863b7..c574007 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 _0xc697=['filter','options','includeAll','include','catch','show','params','rawAttributes','clone','find','get','updatedAt','body','omit','createdAt','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','Attachment','fieldName','key','keys','filters','intersection','model','attributes','query','fields','length','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL'];(function(_0x4489b6,_0x47c466){var _0x13a4bb=function(_0x25092f){while(--_0x25092f){_0x4489b6['push'](_0x4489b6['shift']());}};_0x13a4bb(++_0x47c466);}(_0xc697,0xcd));var _0x7c69=function(_0x1ca099,_0x1a03c9){_0x1ca099=_0x1ca099-0x0;var _0x16e20d=_0xc697[_0x1ca099];return _0x16e20d;};'use strict';var emlformat=require(_0x7c69('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c69('0x1'));var rp=require(_0x7c69('0x2'));var moment=require(_0x7c69('0x3'));var BPromise=require(_0x7c69('0x4'));var Mustache=require(_0x7c69('0x5'));var util=require('util');var path=require(_0x7c69('0x6'));var sox=require(_0x7c69('0x7'));var csv=require(_0x7c69('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c69('0x9'));var squel=require(_0x7c69('0xa'));var crypto=require(_0x7c69('0xb'));var jsforce=require(_0x7c69('0xc'));var deskjs=require(_0x7c69('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7c69('0xe'));var Papa=require(_0x7c69('0xf'));var Redis=require(_0x7c69('0x10'));var authService=require(_0x7c69('0x11'));var qs=require(_0x7c69('0x12'));var as=require(_0x7c69('0x13'));var hardwareService=require(_0x7c69('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7c69('0x15'));var config=require(_0x7c69('0x16'));var licenseUtil=require(_0x7c69('0x17'));var db=require(_0x7c69('0x18'))['db'];function respondWithStatusCode(_0x113219,_0x4eea62){_0x4eea62=_0x4eea62||0xcc;return function(_0x3476c9){if(_0x3476c9){return _0x113219[_0x7c69('0x19')](_0x4eea62);}return _0x113219[_0x7c69('0x1a')](_0x4eea62)[_0x7c69('0x1b')]();};}function respondWithResult(_0x29a551,_0xdd1861){_0xdd1861=_0xdd1861||0xc8;return function(_0x5ac9c4){if(_0x5ac9c4){return _0x29a551[_0x7c69('0x1a')](_0xdd1861)[_0x7c69('0x1c')](_0x5ac9c4);}};}function respondWithFilteredResult(_0x7f1d73,_0x4e3a5f){return function(_0x5dfe2d){if(_0x5dfe2d){var _0x405d5d=typeof _0x4e3a5f[_0x7c69('0x1d')]===_0x7c69('0x1e')&&typeof _0x4e3a5f[_0x7c69('0x1f')]===_0x7c69('0x1e');var _0x471867=_0x5dfe2d[_0x7c69('0x20')];var _0x37a30e=_0x405d5d?0x0:_0x4e3a5f[_0x7c69('0x1d')];var _0x34323c=_0x405d5d?_0x5dfe2d['count']:_0x4e3a5f[_0x7c69('0x1d')]+_0x4e3a5f[_0x7c69('0x1f')];var _0x18a9f5;if(_0x34323c>=_0x471867){_0x34323c=_0x471867;_0x18a9f5=0xc8;}else{_0x18a9f5=0xce;}_0x7f1d73[_0x7c69('0x1a')](_0x18a9f5);return _0x7f1d73['set'](_0x7c69('0x21'),_0x37a30e+'-'+_0x34323c+'/'+_0x471867)[_0x7c69('0x1c')](_0x5dfe2d);}return null;};}function patchUpdates(_0x564e67){return function(_0x1658ea){try{jsonpatch[_0x7c69('0x22')](_0x1658ea,_0x564e67,!![]);}catch(_0xc0b66d){return BPromise[_0x7c69('0x23')](_0xc0b66d);}return _0x1658ea['save']();};}function saveUpdates(_0x29ce73,_0x310e67){return function(_0x542b24){if(_0x542b24){return _0x542b24['update'](_0x29ce73)[_0x7c69('0x24')](function(_0x5ad83c){return _0x5ad83c;});}return null;};}function removeEntity(_0x4f0cd3,_0x53fe2b){return function(_0x393a0c){if(_0x393a0c){return _0x393a0c[_0x7c69('0x25')]()[_0x7c69('0x24')](function(){_0x4f0cd3[_0x7c69('0x1a')](0xcc)[_0x7c69('0x1b')]();});}};}function handleEntityNotFound(_0x52b018,_0x208e12){return function(_0x21f0b0){if(!_0x21f0b0){_0x52b018[_0x7c69('0x19')](0x194);}return _0x21f0b0;};}function handleError(_0x22f2dd,_0x19bea4){_0x19bea4=_0x19bea4||0x1f4;return function(_0x158b4c){logger[_0x7c69('0x26')](_0x158b4c[_0x7c69('0x27')]);if(_0x158b4c[_0x7c69('0x28')]){delete _0x158b4c[_0x7c69('0x28')];}_0x22f2dd[_0x7c69('0x1a')](_0x19bea4)[_0x7c69('0x29')](_0x158b4c);};}exports['index']=function(_0x52b84b,_0x1a0b64){var _0x2944a7={},_0x3f1de6={},_0x40beb5={'count':0x0,'rows':[]};var _0x491e03=_['map'](db[_0x7c69('0x2a')]['rawAttributes'],function(_0x2ffe1a){return{'name':_0x2ffe1a[_0x7c69('0x2b')],'type':_0x2ffe1a['type'][_0x7c69('0x2c')]};});_0x3f1de6['model']=_['map'](_0x491e03,'name');_0x3f1de6['query']=_[_0x7c69('0x2d')](_0x52b84b['query']);_0x3f1de6[_0x7c69('0x2e')]=_[_0x7c69('0x2f')](_0x3f1de6[_0x7c69('0x30')],_0x3f1de6['query']);_0x2944a7[_0x7c69('0x31')]=_['intersection'](_0x3f1de6['model'],qs['fields'](_0x52b84b[_0x7c69('0x32')][_0x7c69('0x33')]));_0x2944a7['attributes']=_0x2944a7[_0x7c69('0x31')][_0x7c69('0x34')]?_0x2944a7[_0x7c69('0x31')]:_0x3f1de6[_0x7c69('0x30')];if(!_0x52b84b[_0x7c69('0x32')]['hasOwnProperty'](_0x7c69('0x35'))){_0x2944a7[_0x7c69('0x1f')]=qs['limit'](_0x52b84b['query'][_0x7c69('0x1f')]);_0x2944a7[_0x7c69('0x1d')]=qs[_0x7c69('0x1d')](_0x52b84b[_0x7c69('0x32')][_0x7c69('0x1d')]);}_0x2944a7[_0x7c69('0x36')]=qs['sort'](_0x52b84b[_0x7c69('0x32')][_0x7c69('0x37')]);_0x2944a7[_0x7c69('0x38')]=qs[_0x7c69('0x2e')](_[_0x7c69('0x39')](_0x52b84b['query'],_0x3f1de6[_0x7c69('0x2e')]),_0x491e03);if(_0x52b84b['query']['filter']){_0x2944a7[_0x7c69('0x38')]=_[_0x7c69('0x3a')](_0x2944a7['where'],{'$or':_[_0x7c69('0x3b')](_0x491e03,function(_0x44c7b8){if(_0x44c7b8[_0x7c69('0x3c')]!==_0x7c69('0x3d')){var _0x144a45={};_0x144a45[_0x44c7b8[_0x7c69('0x28')]]={'$like':'%'+_0x52b84b[_0x7c69('0x32')][_0x7c69('0x3e')]+'%'};return _0x144a45;}})});}_0x2944a7=_[_0x7c69('0x3a')]({},_0x2944a7,_0x52b84b[_0x7c69('0x3f')]);var _0x5de3={'where':_0x2944a7['where']};return db['Attachment']['count'](_0x5de3)[_0x7c69('0x24')](function(_0xff121a){_0x40beb5[_0x7c69('0x20')]=_0xff121a;if(_0x52b84b[_0x7c69('0x32')][_0x7c69('0x40')]){_0x2944a7[_0x7c69('0x41')]=[{'all':!![]}];}return db[_0x7c69('0x2a')]['findAll'](_0x2944a7);})[_0x7c69('0x24')](function(_0x2e4a04){_0x40beb5['rows']=_0x2e4a04;return _0x40beb5;})['then'](respondWithFilteredResult(_0x1a0b64,_0x2944a7))[_0x7c69('0x42')](handleError(_0x1a0b64,null));};exports[_0x7c69('0x43')]=function(_0x499a4a,_0x5c4cf1){var _0x369ea9={'raw':!![],'where':{'id':_0x499a4a[_0x7c69('0x44')]['id']}},_0x20e7d7={};_0x20e7d7['model']=_[_0x7c69('0x2d')](db['Attachment'][_0x7c69('0x45')]);_0x20e7d7['query']=_['keys'](_0x499a4a[_0x7c69('0x32')]);_0x20e7d7['filters']=_[_0x7c69('0x2f')](_0x20e7d7[_0x7c69('0x30')],_0x20e7d7[_0x7c69('0x32')]);_0x369ea9['attributes']=_[_0x7c69('0x2f')](_0x20e7d7[_0x7c69('0x30')],qs[_0x7c69('0x33')](_0x499a4a[_0x7c69('0x32')][_0x7c69('0x33')]));_0x369ea9[_0x7c69('0x31')]=_0x369ea9[_0x7c69('0x31')][_0x7c69('0x34')]?_0x369ea9[_0x7c69('0x31')]:_0x20e7d7[_0x7c69('0x30')];if(_0x499a4a['query'][_0x7c69('0x40')]){_0x369ea9['include']=[{'all':!![]}];}_0x369ea9=_[_0x7c69('0x3a')]({},_0x369ea9,_0x499a4a['options']);return db[_0x7c69('0x2a')]['find'](_0x369ea9)[_0x7c69('0x24')](handleEntityNotFound(_0x5c4cf1,null))[_0x7c69('0x24')](respondWithResult(_0x5c4cf1,null))[_0x7c69('0x42')](handleError(_0x5c4cf1,null));};exports[_0x7c69('0x46')]=function(_0x563b13,_0x50b906){var _0x4ef6ff={'where':{'id':_0x563b13[_0x7c69('0x44')]['id']}},_0x3f72f0={};_0x3f72f0[_0x7c69('0x30')]=_[_0x7c69('0x2d')](db['Attachment'][_0x7c69('0x45')]);_0x4ef6ff[_0x7c69('0x31')]=_[_0x7c69('0x2f')](_0x3f72f0[_0x7c69('0x30')],qs['fields'](_0x563b13['query'][_0x7c69('0x33')]));_0x4ef6ff['attributes']=_0x4ef6ff[_0x7c69('0x31')]['length']?_0x4ef6ff[_0x7c69('0x31')]:_0x3f72f0['model'];if(_0x563b13['query'][_0x7c69('0x40')]){_0x4ef6ff[_0x7c69('0x41')]=[{'all':!![]}];}_0x4ef6ff=_[_0x7c69('0x3a')]({},_0x4ef6ff,_0x563b13[_0x7c69('0x3f')]);return db[_0x7c69('0x2a')][_0x7c69('0x47')](_0x4ef6ff)[_0x7c69('0x24')](handleEntityNotFound(_0x50b906,null))[_0x7c69('0x24')](function(_0x442730){if(_0x442730){var _0x327fd7=_0x442730[_0x7c69('0x48')]({'plain':!![]});_0x327fd7=qs['omit'](_0x327fd7,['id','createdAt',_0x7c69('0x49')]);_0x563b13[_0x7c69('0x4a')]=_[_0x7c69('0x4b')](_0x563b13['body'],['id',_0x7c69('0x4c'),'updatedAt']);return db['Attachment']['create'](_[_0x7c69('0x3a')](_0x327fd7,_0x563b13[_0x7c69('0x4a')]),{'include':_0x563b13[_0x7c69('0x32')][_0x7c69('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x50b906,0xc9))[_0x7c69('0x42')](handleError(_0x50b906,null));};exports['update']=function(_0x375abd,_0x274384){if(_0x375abd[_0x7c69('0x4a')]['id']){delete _0x375abd['body']['id'];}return db[_0x7c69('0x2a')]['find']({'where':{'id':_0x375abd[_0x7c69('0x44')]['id']}})[_0x7c69('0x24')](handleEntityNotFound(_0x274384,null))['then'](saveUpdates(_0x375abd[_0x7c69('0x4a')],null))[_0x7c69('0x24')](respondWithResult(_0x274384,null))['catch'](handleError(_0x274384,null));};exports[_0x7c69('0x25')]=function(_0x3b587c,_0x23bcdc){return db['Attachment'][_0x7c69('0x47')]({'where':{'id':_0x3b587c[_0x7c69('0x44')]['id']}})['then'](handleEntityNotFound(_0x23bcdc,null))['then'](removeEntity(_0x23bcdc,null))[_0x7c69('0x42')](handleError(_0x23bcdc,null));};exports[_0x7c69('0x4d')]=function(_0x35bfde,_0xeb3a02,_0x4c7954){_0x35bfde['body']['name']=_0x35bfde[_0x7c69('0x4e')][_0x7c69('0x4f')];_0x35bfde[_0x7c69('0x4a')][_0x7c69('0x50')]=_0x35bfde[_0x7c69('0x4e')][_0x7c69('0x51')];_0x35bfde[_0x7c69('0x4a')][_0x7c69('0x3c')]=_0x35bfde['file'][_0x7c69('0x52')];return db[_0x7c69('0x2a')][_0x7c69('0x4d')](_0x35bfde[_0x7c69('0x4a')])[_0x7c69('0x24')](respondWithResult(_0xeb3a02,0xc9))[_0x7c69('0x42')](handleError(_0xeb3a02,null));};exports[_0x7c69('0x53')]=function(_0x33ccb8,_0x58e5f7,_0x4499a7){return db[_0x7c69('0x2a')][_0x7c69('0x54')]({'where':{'id':_0x33ccb8[_0x7c69('0x44')]['id']},'raw':!![]})[_0x7c69('0x24')](handleEntityNotFound(_0x58e5f7,null))['then'](function(_0x22669d){if(_0x22669d){var _0x5384c6=_0x22669d[_0x7c69('0x55')]!==null;var _0x5053ed=path[_0x7c69('0x56')](config['root'],_0x7c69('0x57'));if(_0x5384c6){_0x5053ed=path[_0x7c69('0x56')](_0x5053ed,_0x7c69('0x58'));}var _0x364fed=path[_0x7c69('0x56')](_0x5053ed,_0x22669d[_0x7c69('0x50')]);return _0x58e5f7[_0x7c69('0x53')](_0x364fed);}})[_0x7c69('0x42')](handleError(_0x58e5f7,null));}; \ No newline at end of file +var _0xa98b=['createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','query','filters','attributes','intersection','model','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','keys','length','find','clone','params','includeAll','get','omit'];(function(_0x5e7ede,_0xb4f04f){var _0x14efe4=function(_0x34ddc7){while(--_0x34ddc7){_0x5e7ede['push'](_0x5e7ede['shift']());}};_0x14efe4(++_0xb4f04f);}(_0xa98b,0x69));var _0xba98=function(_0x4048d6,_0x46a36d){_0x4048d6=_0x4048d6-0x0;var _0x35a7f5=_0xa98b[_0x4048d6];return _0x35a7f5;};'use strict';var emlformat=require(_0xba98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba98('0x1'));var jsonpatch=require(_0xba98('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba98('0x3'));var Mustache=require(_0xba98('0x4'));var util=require('util');var path=require(_0xba98('0x5'));var sox=require(_0xba98('0x6'));var csv=require(_0xba98('0x7'));var ejs=require(_0xba98('0x8'));var fs=require('fs');var fs_extra=require(_0xba98('0x9'));var _=require('lodash');var squel=require(_0xba98('0xa'));var crypto=require('crypto');var jsforce=require(_0xba98('0xb'));var deskjs=require(_0xba98('0xc'));var toCsv=require(_0xba98('0x7'));var querystring=require(_0xba98('0xd'));var Papa=require(_0xba98('0xe'));var Redis=require(_0xba98('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba98('0x10'));var as=require(_0xba98('0x11'));var hardwareService=require(_0xba98('0x12'));var logger=require('../../config/logger')(_0xba98('0x13'));var utils=require('../../config/utils');var config=require(_0xba98('0x14'));var licenseUtil=require(_0xba98('0x15'));var db=require(_0xba98('0x16'))['db'];function respondWithStatusCode(_0x74ca78,_0x6c0d1b){_0x6c0d1b=_0x6c0d1b||0xcc;return function(_0x196fc1){if(_0x196fc1){return _0x74ca78[_0xba98('0x17')](_0x6c0d1b);}return _0x74ca78[_0xba98('0x18')](_0x6c0d1b)[_0xba98('0x19')]();};}function respondWithResult(_0x34484e,_0x3fafa8){_0x3fafa8=_0x3fafa8||0xc8;return function(_0x38cbbc){if(_0x38cbbc){return _0x34484e[_0xba98('0x18')](_0x3fafa8)[_0xba98('0x1a')](_0x38cbbc);}};}function respondWithFilteredResult(_0x359a3a,_0x3a15d2){return function(_0x5d6ffd){if(_0x5d6ffd){var _0x40edfd=typeof _0x3a15d2[_0xba98('0x1b')]===_0xba98('0x1c')&&typeof _0x3a15d2[_0xba98('0x1d')]===_0xba98('0x1c');var _0x30d24d=_0x5d6ffd[_0xba98('0x1e')];var _0x26ce3e=_0x40edfd?0x0:_0x3a15d2['offset'];var _0x4c7670=_0x40edfd?_0x5d6ffd['count']:_0x3a15d2[_0xba98('0x1b')]+_0x3a15d2[_0xba98('0x1d')];var _0x15eed5;if(_0x4c7670>=_0x30d24d){_0x4c7670=_0x30d24d;_0x15eed5=0xc8;}else{_0x15eed5=0xce;}_0x359a3a[_0xba98('0x18')](_0x15eed5);return _0x359a3a[_0xba98('0x1f')](_0xba98('0x20'),_0x26ce3e+'-'+_0x4c7670+'/'+_0x30d24d)['json'](_0x5d6ffd);}return null;};}function patchUpdates(_0x549797){return function(_0x1a9104){try{jsonpatch[_0xba98('0x21')](_0x1a9104,_0x549797,!![]);}catch(_0x3a4822){return BPromise[_0xba98('0x22')](_0x3a4822);}return _0x1a9104['save']();};}function saveUpdates(_0x457be7,_0x4f73da){return function(_0x2d10c8){if(_0x2d10c8){return _0x2d10c8[_0xba98('0x23')](_0x457be7)[_0xba98('0x24')](function(_0x5729a2){return _0x5729a2;});}return null;};}function removeEntity(_0x317d7f,_0x412901){return function(_0x4be6e5){if(_0x4be6e5){return _0x4be6e5[_0xba98('0x25')]()['then'](function(){_0x317d7f['status'](0xcc)[_0xba98('0x19')]();});}};}function handleEntityNotFound(_0x2078b5,_0x14b19f){return function(_0x1a786f){if(!_0x1a786f){_0x2078b5[_0xba98('0x17')](0x194);}return _0x1a786f;};}function handleError(_0x5e6b2b,_0x1b9f93){_0x1b9f93=_0x1b9f93||0x1f4;return function(_0x11b4ba){logger[_0xba98('0x26')](_0x11b4ba[_0xba98('0x27')]);if(_0x11b4ba[_0xba98('0x28')]){delete _0x11b4ba['name'];}_0x5e6b2b[_0xba98('0x18')](_0x1b9f93)[_0xba98('0x29')](_0x11b4ba);};}exports[_0xba98('0x2a')]=function(_0x275b52,_0x420c15){var _0xb2109={},_0x363e0b={},_0x1b79d9={'count':0x0,'rows':[]};var _0x5a75f7=_[_0xba98('0x2b')](db[_0xba98('0x2c')][_0xba98('0x2d')],function(_0x59012c){return{'name':_0x59012c['fieldName'],'type':_0x59012c[_0xba98('0x2e')][_0xba98('0x2f')]};});_0x363e0b['model']=_[_0xba98('0x2b')](_0x5a75f7,_0xba98('0x28'));_0x363e0b[_0xba98('0x30')]=_['keys'](_0x275b52['query']);_0x363e0b[_0xba98('0x31')]=_['intersection'](_0x363e0b['model'],_0x363e0b[_0xba98('0x30')]);_0xb2109[_0xba98('0x32')]=_[_0xba98('0x33')](_0x363e0b[_0xba98('0x34')],qs[_0xba98('0x35')](_0x275b52['query'][_0xba98('0x35')]));_0xb2109['attributes']=_0xb2109[_0xba98('0x32')]['length']?_0xb2109[_0xba98('0x32')]:_0x363e0b[_0xba98('0x34')];if(!_0x275b52[_0xba98('0x30')]['hasOwnProperty'](_0xba98('0x36'))){_0xb2109[_0xba98('0x1d')]=qs['limit'](_0x275b52[_0xba98('0x30')][_0xba98('0x1d')]);_0xb2109[_0xba98('0x1b')]=qs[_0xba98('0x1b')](_0x275b52[_0xba98('0x30')][_0xba98('0x1b')]);}_0xb2109[_0xba98('0x37')]=qs['sort'](_0x275b52[_0xba98('0x30')][_0xba98('0x38')]);_0xb2109[_0xba98('0x39')]=qs[_0xba98('0x31')](_[_0xba98('0x3a')](_0x275b52[_0xba98('0x30')],_0x363e0b[_0xba98('0x31')]),_0x5a75f7);if(_0x275b52[_0xba98('0x30')]['filter']){_0xb2109[_0xba98('0x39')]=_[_0xba98('0x3b')](_0xb2109['where'],{'$or':_[_0xba98('0x2b')](_0x5a75f7,function(_0x2a60b0){if(_0x2a60b0[_0xba98('0x2e')]!==_0xba98('0x3c')){var _0x4bda0e={};_0x4bda0e[_0x2a60b0[_0xba98('0x28')]]={'$like':'%'+_0x275b52[_0xba98('0x30')][_0xba98('0x3d')]+'%'};return _0x4bda0e;}})});}_0xb2109=_[_0xba98('0x3b')]({},_0xb2109,_0x275b52[_0xba98('0x3e')]);var _0x18be67={'where':_0xb2109[_0xba98('0x39')]};return db[_0xba98('0x2c')]['count'](_0x18be67)['then'](function(_0x5c88de){_0x1b79d9[_0xba98('0x1e')]=_0x5c88de;if(_0x275b52[_0xba98('0x30')]['includeAll']){_0xb2109[_0xba98('0x3f')]=[{'all':!![]}];}return db[_0xba98('0x2c')][_0xba98('0x40')](_0xb2109);})['then'](function(_0x2d0efe){_0x1b79d9[_0xba98('0x41')]=_0x2d0efe;return _0x1b79d9;})[_0xba98('0x24')](respondWithFilteredResult(_0x420c15,_0xb2109))[_0xba98('0x42')](handleError(_0x420c15,null));};exports['show']=function(_0x5969df,_0x4067ca){var _0x365836={'raw':!![],'where':{'id':_0x5969df['params']['id']}},_0x181120={};_0x181120[_0xba98('0x34')]=_[_0xba98('0x43')](db[_0xba98('0x2c')][_0xba98('0x2d')]);_0x181120[_0xba98('0x30')]=_[_0xba98('0x43')](_0x5969df[_0xba98('0x30')]);_0x181120['filters']=_[_0xba98('0x33')](_0x181120[_0xba98('0x34')],_0x181120[_0xba98('0x30')]);_0x365836[_0xba98('0x32')]=_[_0xba98('0x33')](_0x181120['model'],qs[_0xba98('0x35')](_0x5969df[_0xba98('0x30')][_0xba98('0x35')]));_0x365836[_0xba98('0x32')]=_0x365836['attributes'][_0xba98('0x44')]?_0x365836[_0xba98('0x32')]:_0x181120[_0xba98('0x34')];if(_0x5969df[_0xba98('0x30')]['includeAll']){_0x365836[_0xba98('0x3f')]=[{'all':!![]}];}_0x365836=_[_0xba98('0x3b')]({},_0x365836,_0x5969df[_0xba98('0x3e')]);return db[_0xba98('0x2c')][_0xba98('0x45')](_0x365836)[_0xba98('0x24')](handleEntityNotFound(_0x4067ca,null))[_0xba98('0x24')](respondWithResult(_0x4067ca,null))[_0xba98('0x42')](handleError(_0x4067ca,null));};exports[_0xba98('0x46')]=function(_0x411554,_0x4560a2){var _0x5a8fba={'where':{'id':_0x411554[_0xba98('0x47')]['id']}},_0x53fc8c={};_0x53fc8c['model']=_['keys'](db['Attachment']['rawAttributes']);_0x5a8fba[_0xba98('0x32')]=_[_0xba98('0x33')](_0x53fc8c[_0xba98('0x34')],qs[_0xba98('0x35')](_0x411554[_0xba98('0x30')][_0xba98('0x35')]));_0x5a8fba[_0xba98('0x32')]=_0x5a8fba[_0xba98('0x32')][_0xba98('0x44')]?_0x5a8fba[_0xba98('0x32')]:_0x53fc8c[_0xba98('0x34')];if(_0x411554['query'][_0xba98('0x48')]){_0x5a8fba['include']=[{'all':!![]}];}_0x5a8fba=_[_0xba98('0x3b')]({},_0x5a8fba,_0x411554[_0xba98('0x3e')]);return db[_0xba98('0x2c')][_0xba98('0x45')](_0x5a8fba)[_0xba98('0x24')](handleEntityNotFound(_0x4560a2,null))['then'](function(_0x1e24ca){if(_0x1e24ca){var _0x1dea40=_0x1e24ca[_0xba98('0x49')]({'plain':!![]});_0x1dea40=qs[_0xba98('0x4a')](_0x1dea40,['id',_0xba98('0x4b'),_0xba98('0x4c')]);_0x411554[_0xba98('0x4d')]=_[_0xba98('0x4a')](_0x411554['body'],['id','createdAt','updatedAt']);return db[_0xba98('0x2c')][_0xba98('0x4e')](_[_0xba98('0x3b')](_0x1dea40,_0x411554['body']),{'include':_0x411554[_0xba98('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xba98('0x24')](respondWithResult(_0x4560a2,0xc9))['catch'](handleError(_0x4560a2,null));};exports['update']=function(_0x511f2d,_0x498de4){if(_0x511f2d[_0xba98('0x4d')]['id']){delete _0x511f2d[_0xba98('0x4d')]['id'];}return db['Attachment']['find']({'where':{'id':_0x511f2d['params']['id']}})['then'](handleEntityNotFound(_0x498de4,null))[_0xba98('0x24')](saveUpdates(_0x511f2d['body'],null))[_0xba98('0x24')](respondWithResult(_0x498de4,null))[_0xba98('0x42')](handleError(_0x498de4,null));};exports[_0xba98('0x25')]=function(_0x4b0014,_0x1b3504){return db[_0xba98('0x2c')][_0xba98('0x45')]({'where':{'id':_0x4b0014['params']['id']}})[_0xba98('0x24')](handleEntityNotFound(_0x1b3504,null))[_0xba98('0x24')](removeEntity(_0x1b3504,null))['catch'](handleError(_0x1b3504,null));};exports[_0xba98('0x4e')]=function(_0x13270a,_0x11ec71,_0x5ccfff){_0x13270a['body'][_0xba98('0x28')]=_0x13270a[_0xba98('0x4f')][_0xba98('0x50')];_0x13270a[_0xba98('0x4d')][_0xba98('0x51')]=_0x13270a[_0xba98('0x4f')][_0xba98('0x52')];_0x13270a[_0xba98('0x4d')][_0xba98('0x2e')]=_0x13270a[_0xba98('0x4f')][_0xba98('0x53')];return db[_0xba98('0x2c')][_0xba98('0x4e')](_0x13270a[_0xba98('0x4d')])['then'](respondWithResult(_0x11ec71,0xc9))['catch'](handleError(_0x11ec71,null));};exports[_0xba98('0x54')]=function(_0x15416a,_0xcbba73,_0x5adb83){return db[_0xba98('0x2c')][_0xba98('0x55')]({'where':{'id':_0x15416a[_0xba98('0x47')]['id']},'raw':!![]})[_0xba98('0x24')](handleEntityNotFound(_0xcbba73,null))[_0xba98('0x24')](function(_0x35a3ed){if(_0x35a3ed){var _0x4aa856=_0x35a3ed[_0xba98('0x56')]!==null;var _0x4ee806=path[_0xba98('0x57')](config[_0xba98('0x58')],'server/files/attachments/');if(_0x4aa856){_0x4ee806=path[_0xba98('0x57')](_0x4ee806,_0xba98('0x59'));}var _0x597823=path[_0xba98('0x57')](_0x4ee806,_0x35a3ed[_0xba98('0x51')]);return _0xcbba73['download'](_0x597823);}})['catch'](handleError(_0xcbba73,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index bb8c4c9..f40ea31 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 _0x089a=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','define','attachments'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x089a,0x174));var _0xa089=function(_0x492707,_0x3e65dd){_0x492707=_0x492707-0x0;var _0x299c4d=_0x089a[_0x492707];return _0x299c4d;};'use strict';var _=require(_0xa089('0x0'));var util=require(_0xa089('0x1'));var logger=require(_0xa089('0x2'))('api');var moment=require(_0xa089('0x3'));var BPromise=require(_0xa089('0x4'));var rp=require(_0xa089('0x5'));var fs=require('fs');var path=require(_0xa089('0x6'));var rimraf=require('rimraf');var config=require(_0xa089('0x7'));var attributes=require(_0xa089('0x8'));module[_0xa089('0x9')]=function(_0x110ffa,_0x56cb50){return _0x110ffa[_0xa089('0xa')]('Attachment',attributes,{'tableName':_0xa089('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab1b=['api','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments'];(function(_0x459d66,_0x57c91c){var _0x204a52=function(_0x5101a6){while(--_0x5101a6){_0x459d66['push'](_0x459d66['shift']());}};_0x204a52(++_0x57c91c);}(_0xab1b,0x70));var _0xbab1=function(_0x5a0311,_0xefddfc){_0x5a0311=_0x5a0311-0x0;var _0x16d47a=_0xab1b[_0x5a0311];return _0x16d47a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbab1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbab1('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbab1('0x2'));var config=require(_0xbab1('0x3'));var attributes=require(_0xbab1('0x4'));module[_0xbab1('0x5')]=function(_0xb2cad6,_0x1d7c6b){return _0xb2cad6[_0xbab1('0x6')]('Attachment',attributes,{'tableName':_0xbab1('0x7'),'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 6e28688..4f28650 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 _0xc964=['request\x20sent','stringify','error','Attachment,\x20%s,\x20%s','message','result','Attachment','create','body','options','raw','then','catch','CreateAttachment','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x268d8b,_0xde6a32){var _0x4ee10b=function(_0x10fd20){while(--_0x10fd20){_0x268d8b['push'](_0x268d8b['shift']());}};_0x4ee10b(++_0xde6a32);}(_0xc964,0x7e));var _0x4c96=function(_0x37c648,_0x3f1fe7){_0x37c648=_0x37c648-0x0;var _0x57fb7a=_0xc964[_0x37c648];return _0x57fb7a;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var moment=require('moment');var BPromise=require(_0x4c96('0x2'));var rs=require(_0x4c96('0x3'));var fs=require('fs');var Redis=require(_0x4c96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c96('0x5'));var logger=require('../../config/logger')(_0x4c96('0x6'));var config=require(_0x4c96('0x7'));var jayson=require(_0x4c96('0x8'));var client=jayson[_0x4c96('0x9')][_0x4c96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fa8a0,_0x4070a5,_0x493618){return new BPromise(function(_0x19ed76,_0xaa3f20){return client[_0x4c96('0xb')](_0x1fa8a0,_0x493618)['then'](function(_0x208911){logger[_0x4c96('0xc')]('Attachment,\x20%s,\x20%s',_0x4070a5,'request\x20sent');logger['debug'](_0x4c96('0xd'),_0x4070a5,_0x4c96('0xe'),JSON[_0x4c96('0xf')](_0x208911));if(_0x208911['error']){if(_0x208911[_0x4c96('0x10')]['code']===0x1f4){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);return _0xaa3f20(_0x208911['error']['message']);}logger[_0x4c96('0x10')](_0x4c96('0x11'),_0x4070a5,_0x208911[_0x4c96('0x10')]['message']);return _0x19ed76(_0x208911[_0x4c96('0x10')][_0x4c96('0x12')]);}else{logger[_0x4c96('0xc')](_0x4c96('0x11'),_0x4070a5,_0x4c96('0xe'));_0x19ed76(_0x208911[_0x4c96('0x13')][_0x4c96('0x12')]);}})['catch'](function(_0x388237){logger['error'](_0x4c96('0x11'),_0x4070a5,_0x388237);_0xaa3f20(_0x388237);});});}exports['CreateAttachment']=function(_0x2453e0){var _0x494a26=this;return new Promise(function(_0x17891b,_0x1807b6){return db[_0x4c96('0x14')][_0x4c96('0x15')](_0x2453e0[_0x4c96('0x16')],{'raw':_0x2453e0[_0x4c96('0x17')]?_0x2453e0[_0x4c96('0x17')][_0x4c96('0x18')]===undefined?!![]:![]:!![]})[_0x4c96('0x19')](function(_0x9546c5){logger[_0x4c96('0xc')]('CreateAttachment',_0x2453e0);logger['debug']('CreateAttachment',_0x2453e0,JSON[_0x4c96('0xf')](_0x9546c5));_0x17891b(_0x9546c5);})[_0x4c96('0x1a')](function(_0x29f3a3){logger[_0x4c96('0x10')](_0x4c96('0x1b'),_0x29f3a3[_0x4c96('0x12')],_0x2453e0);_0x1807b6(_0x494a26['error'](0x1f4,_0x29f3a3[_0x4c96('0x12')]));});});}; \ No newline at end of file +var _0x702d=['message','result','Attachment','create','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x2ff38f,_0xefceba){var _0x19a75f=function(_0x22c3b1){while(--_0x22c3b1){_0x2ff38f['push'](_0x2ff38f['shift']());}};_0x19a75f(++_0xefceba);}(_0x702d,0x147));var _0xd702=function(_0x53fb8a,_0x1cf6f8){_0x53fb8a=_0x53fb8a-0x0;var _0x2f0a6a=_0x702d[_0x53fb8a];return _0x2f0a6a;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});}exports['CreateAttachment']=function(_0x5b3b1d){var _0x2205de=this;return new Promise(function(_0x5a296e,_0x3fbcec){return db[_0xd702('0x17')][_0xd702('0x18')](_0x5b3b1d[_0xd702('0x19')],{'raw':_0x5b3b1d[_0xd702('0x1a')]?_0x5b3b1d[_0xd702('0x1a')][_0xd702('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4be140){logger['info'](_0xd702('0x1c'),_0x5b3b1d);logger[_0xd702('0x10')]('CreateAttachment',_0x5b3b1d,JSON[_0xd702('0x12')](_0x4be140));_0x5a296e(_0x4be140);})['catch'](function(_0xc4c246){logger['error']('CreateAttachment',_0xc4c246['message'],_0x5b3b1d);_0x3fbcec(_0x2205de[_0xd702('0x14')](0x1f4,_0xc4c246[_0xd702('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b2fa122..04c255a 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1622a0,_0x2b55a9){_0x1622a0=_0x1622a0-0x0;var _0x2a2308=_0x0b0e[_0x1622a0];return _0x2a2308;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x5f2c50,_0x2fd64f){var _0x481961=function(_0x1ba1ee){while(--_0x1ba1ee){_0x5f2c50['push'](_0x5f2c50['shift']());}};_0x481961(++_0x2fd64f);}(_0xadb5,0xad));var _0x5adb=function(_0x1699d8,_0x24b741){_0x1699d8=_0x1699d8-0x0;var _0xf49e31=_0xadb5[_0x1699d8];return _0xf49e31;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index f24ac56..e4b7dd7 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 _0xd966=['blockedAt','online','admin','user','agent','then','getLicense','catch','status','send','login','ad-login','use','passport-local','moment','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','undefined','activedirectory','baseDN','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked'];(function(_0x4f0b31,_0x2ffd23){var _0x202c4f=function(_0x287fbb){while(--_0x287fbb){_0x4f0b31['push'](_0x4f0b31['shift']());}};_0x202c4f(++_0x2ffd23);}(_0xd966,0xad));var _0x6d96=function(_0x34365b,_0x418c5a){_0x34365b=_0x34365b-0x0;var _0x12d73a=_0xd966[_0x34365b];return _0x12d73a;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x6d96('0x0'))['Strategy'];var moment=require(_0x6d96('0x1'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x6d96('0x2'));var util=require('util');var db=require(_0x6d96('0x3'))['db'];var authService=require(_0x6d96('0x4'));var utils=require(_0x6d96('0x5'));var config=require(_0x6d96('0x6'));var logger=require(_0x6d96('0x7'))('api');function isActiveDirectoryConfigured(_0x198db2){var _0x49f13a=![];if(typeof _0x198db2['activedirectory']!==_0x6d96('0x8')){_0x49f13a=_0x198db2[_0x6d96('0x9')][_0x6d96('0xa')]&&_0x198db2['activedirectory'][_0x6d96('0xb')]&&_0x198db2[_0x6d96('0x9')][_0x6d96('0xc')];}return _0x49f13a;}function adAuthenticate(_0x5dcefc,_0x5da8e1,_0x144ba9){return new BPromise(function(_0x5dde43,_0x5e05ca){try{var _0x2d3ec4=new ActiveDirectory(_0x5dcefc);_0x2d3ec4[_0x6d96('0xd')](_0x5da8e1,_0x144ba9,function(_0xd90bf2,_0x4c7535){if(_0xd90bf2){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x5da8e1,util['inspect'](_0xd90bf2,{'showHidden':![],'depth':null}));_0x5e05ca('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x4c7535){logger[_0x6d96('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x5da8e1);_0x5e05ca(_0x6d96('0xf'));}else{_0x5dde43(_0x4c7535);}});}catch(_0x581ae8){_0x5e05ca(_0x581ae8);}});}function ActiveDirectoryAuthenticate(_0x3c4008,_0x487be5,_0x1f500f,_0x3f7509){var _0x18b257,_0x189cb2;if(!isActiveDirectoryConfigured(config)){logger[_0x6d96('0xe')](_0x6d96('0x10'),_0x487be5);return _0x3f7509(null,![],{'message':_0x6d96('0xf')});}return db[_0x6d96('0x11')][_0x6d96('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x6d96('0x13')],'raw':!![]})['then'](function(_0x2fe330){_0x18b257=_0x2fe330;if(!_0x18b257[_0x6d96('0x14')]){logger['error'](_0x6d96('0x15'),_0x487be5);throw new Error(_0x6d96('0xf'));}return _0x3c4008['findOne']({'attributes':['id',_0x6d96('0x16'),_0x6d96('0x17'),'salt',_0x6d96('0x18'),_0x6d96('0x19'),_0x6d96('0x1a'),_0x6d96('0x1b'),_0x6d96('0x1c')],'where':{'name':_0x487be5,'role':{'$or':[_0x6d96('0x1d'),_0x6d96('0x1e'),_0x6d96('0x1f')]},'adSsoEnabled':!![]}});})[_0x6d96('0x20')](function(_0x1662f1){if(!_0x1662f1||_0x1662f1&&_0x1662f1[_0x6d96('0x16')]!==_0x487be5){throw new Error(_0x6d96('0xf'));}_0x189cb2=_0x1662f1;var _0x243b1d=_0x189cb2['name']+'@'+config[_0x6d96('0x9')][_0x6d96('0xc')];return adAuthenticate(config[_0x6d96('0x9')],_0x243b1d,_0x1f500f);})[_0x6d96('0x20')](function(_0x59f267){if(_0x189cb2['disabled']){throw new Error(_0x6d96('0xf'));}if(_0x18b257['blockDuration']>0x0){if(_0x189cb2[_0x6d96('0x1a')]){if(moment(_0x189cb2[_0x6d96('0x1b')])['add'](_0x18b257[_0x6d96('0x13')],'minutes')>moment()){throw new Error(_0x6d96('0xf'));}return utils['clearBlockUser'](_0x189cb2,0x0,![],null)['then'](function(){return utils['getLicense'](_0x189cb2);})['then'](function(){return _0x3f7509(null,_0x189cb2);});}else{return utils[_0x6d96('0x21')](_0x189cb2)[_0x6d96('0x20')](function(){return _0x3f7509(null,_0x189cb2);});}}else{return utils[_0x6d96('0x21')](_0x189cb2)[_0x6d96('0x20')](function(){return _0x3f7509(null,_0x189cb2);});}})[_0x6d96('0x22')](function(_0x9ceac7){return _0x3f7509(null,![],_0x9ceac7);});}function handleError(_0x1c299f,_0x2849e7,_0x3d36ca){return _0x1c299f[_0x6d96('0x23')](_0x2849e7||0x1f4)[_0x6d96('0x24')]({'message':_0x3d36ca?_0x3d36ca['message']||_0x3d36ca:''});}exports[_0x6d96('0x25')]=function(_0x2d8ae1,_0x4ebbed,_0x5500bf){passport['authenticate'](_0x6d96('0x26'),function(_0x48c9ce,_0x163a65,_0x5aacda){var _0x1e226d=_0x48c9ce||_0x5aacda;if(_0x1e226d){return handleError(_0x4ebbed,0x191,_0x1e226d);}if(!_0x163a65){return handleError(_0x4ebbed,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x414ec9={'payload':{'id':_0x163a65['id'],'role':_0x163a65['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x414ec9)['then'](function(_0x1a85c3){_0x4ebbed['json']({'id':_0x163a65['id'],'token':_0x1a85c3,'statusCall':'','isAlreadyLogged':_0x163a65[_0x6d96('0x1c')]});});}})(_0x2d8ae1,_0x4ebbed,_0x5500bf);};passport[_0x6d96('0x27')](_0x6d96('0x26'),new LocalStrategy({'usernameField':'name','passwordField':_0x6d96('0x17')},function(_0x193a56,_0x19a511,_0x423f82){return ActiveDirectoryAuthenticate(db['User'],_0x193a56,_0x19a511,_0x423f82);})); \ No newline at end of file +var _0xc24f=['online','admin','user','domain','blocked','blockedAt','clearBlockUser','getLicense','catch','message','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport-local','Strategy','bluebird','util','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled'];(function(_0x4da69c,_0x12eb04){var _0x5ac5d5=function(_0x1b4947){while(--_0x1b4947){_0x4da69c['push'](_0x4da69c['shift']());}};_0x5ac5d5(++_0x12eb04);}(_0xc24f,0x70));var _0xfc24=function(_0x582fde,_0xd38326){_0x582fde=_0x582fde-0x0;var _0x15d99d=_0xc24f[_0x582fde];return _0x15d99d;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xfc24('0x0'))[_0xfc24('0x1')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xfc24('0x2'));var util=require(_0xfc24('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0xfc24('0x4'));var utils=require('../../config/utils');var config=require(_0xfc24('0x5'));var logger=require(_0xfc24('0x6'))(_0xfc24('0x7'));function isActiveDirectoryConfigured(_0x4116af){var _0xe3036d=![];if(typeof _0x4116af[_0xfc24('0x8')]!==_0xfc24('0x9')){_0xe3036d=_0x4116af[_0xfc24('0x8')][_0xfc24('0xa')]&&_0x4116af['activedirectory'][_0xfc24('0xb')]&&_0x4116af[_0xfc24('0x8')]['domain'];}return _0xe3036d;}function adAuthenticate(_0x2bb60a,_0x3b52d0,_0xf078b4){return new BPromise(function(_0x448efd,_0x477a58){try{var _0x2b3400=new ActiveDirectory(_0x2bb60a);_0x2b3400['authenticate'](_0x3b52d0,_0xf078b4,function(_0x181a92,_0x45bd13){if(_0x181a92){logger[_0xfc24('0xc')](_0xfc24('0xd'),_0x3b52d0,util[_0xfc24('0xe')](_0x181a92,{'showHidden':![],'depth':null}));_0x477a58(_0xfc24('0xf'));}else if(!_0x45bd13){logger[_0xfc24('0xc')](_0xfc24('0x10'),_0x3b52d0);_0x477a58(_0xfc24('0xf'));}else{_0x448efd(_0x45bd13);}});}catch(_0x5c1f0c){_0x477a58(_0x5c1f0c);}});}function ActiveDirectoryAuthenticate(_0x50ae6c,_0x244740,_0xa3b09c,_0x4cf401){var _0x173744,_0x13571c;if(!isActiveDirectoryConfigured(config)){logger[_0xfc24('0xc')](_0xfc24('0x11'),_0x244740);return _0x4cf401(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xfc24('0x12')][_0xfc24('0x13')]({'where':{'id':0x1},'attributes':[_0xfc24('0x14'),_0xfc24('0x15')],'raw':!![]})[_0xfc24('0x16')](function(_0x1a02c1){_0x173744=_0x1a02c1;if(!_0x173744[_0xfc24('0x14')]){logger[_0xfc24('0xc')](_0xfc24('0x17'),_0x244740);throw new Error(_0xfc24('0xf'));}return _0x50ae6c[_0xfc24('0x13')]({'attributes':['id',_0xfc24('0x18'),_0xfc24('0x19'),_0xfc24('0x1a'),_0xfc24('0x1b'),_0xfc24('0x1c'),'blocked','blockedAt',_0xfc24('0x1d')],'where':{'name':_0x244740,'role':{'$or':[_0xfc24('0x1e'),_0xfc24('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0xfc24('0x16')](function(_0x14ab90){if(!_0x14ab90||_0x14ab90&&_0x14ab90[_0xfc24('0x18')]!==_0x244740){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x13571c=_0x14ab90;var _0x24883=_0x13571c['name']+'@'+config[_0xfc24('0x8')][_0xfc24('0x20')];return adAuthenticate(config['activedirectory'],_0x24883,_0xa3b09c);})[_0xfc24('0x16')](function(_0xde8a15){if(_0x13571c[_0xfc24('0x1c')]){throw new Error(_0xfc24('0xf'));}if(_0x173744[_0xfc24('0x15')]>0x0){if(_0x13571c[_0xfc24('0x21')]){if(moment(_0x13571c[_0xfc24('0x22')])['add'](_0x173744[_0xfc24('0x15')],'minutes')>moment()){throw new Error(_0xfc24('0xf'));}return utils[_0xfc24('0x23')](_0x13571c,0x0,![],null)['then'](function(){return utils[_0xfc24('0x24')](_0x13571c);})['then'](function(){return _0x4cf401(null,_0x13571c);});}else{return utils[_0xfc24('0x24')](_0x13571c)[_0xfc24('0x16')](function(){return _0x4cf401(null,_0x13571c);});}}else{return utils[_0xfc24('0x24')](_0x13571c)['then'](function(){return _0x4cf401(null,_0x13571c);});}})[_0xfc24('0x25')](function(_0x25ebdf){return _0x4cf401(null,![],_0x25ebdf);});}function handleError(_0x50ea6f,_0x293a9f,_0xbd6e8d){return _0x50ea6f['status'](_0x293a9f||0x1f4)['send']({'message':_0xbd6e8d?_0xbd6e8d[_0xfc24('0x26')]||_0xbd6e8d:''});}exports[_0xfc24('0x27')]=function(_0x258385,_0x23e9a0,_0x50286e){passport[_0xfc24('0x28')]('ad-login',function(_0x530a2b,_0x2161b0,_0x4cd2a6){var _0x7c184e=_0x530a2b||_0x4cd2a6;if(_0x7c184e){return handleError(_0x23e9a0,0x191,_0x7c184e);}if(!_0x2161b0){return handleError(_0x23e9a0,0x194,{'message':_0xfc24('0x29')});}else{var _0x2b7ae8={'payload':{'id':_0x2161b0['id'],'role':_0x2161b0['role']},'options':{'expiresIn':0x15180}};return authService[_0xfc24('0x2a')](_0x2b7ae8)[_0xfc24('0x16')](function(_0x44c402){_0x23e9a0[_0xfc24('0x2b')]({'id':_0x2161b0['id'],'token':_0x44c402,'statusCall':'','isAlreadyLogged':_0x2161b0[_0xfc24('0x1d')]});});}})(_0x258385,_0x23e9a0,_0x50286e);};passport[_0xfc24('0x2c')](_0xfc24('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':_0xfc24('0x19')},function(_0x4d3ddf,_0x2d8efe,_0x17ed63){return ActiveDirectoryAuthenticate(db[_0xfc24('0x2e')],_0x4d3ddf,_0x2d8efe,_0x17ed63);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 4e16ed0..869b579 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 _0x109c=['post','login','exports','Router','./authActiveDirectory.controller'];(function(_0x1b6e9c,_0xb7dc58){var _0x101b7c=function(_0xaa159c){while(--_0xaa159c){_0x1b6e9c['push'](_0x1b6e9c['shift']());}};_0x101b7c(++_0xb7dc58);}(_0x109c,0xda));var _0xc109=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x109c[_0x397e5f];return _0x5302b8;};'use strict';var express=require('express');var router=express[_0xc109('0x0')]();var controller=require(_0xc109('0x1'));router[_0xc109('0x2')]('/',controller[_0xc109('0x3')]);module[_0xc109('0x4')]=router; \ No newline at end of file +var _0xd8bf=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x120279,_0xb71cb0){var _0x22b763=function(_0x1442c8){while(--_0x1442c8){_0x120279['push'](_0x120279['shift']());}};_0x22b763(++_0xb71cb0);}(_0xd8bf,0x157));var _0xfd8b=function(_0x143550,_0x441332){_0x143550=_0x143550-0x0;var _0x4d54ee=_0xd8bf[_0x143550];return _0x4d54ee;};'use strict';var express=require(_0xfd8b('0x0'));var router=express[_0xfd8b('0x1')]();var controller=require(_0xfd8b('0x2'));router[_0xfd8b('0x3')]('/',controller[_0xfd8b('0x4')]);module[_0xfd8b('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 49d7662..7901cd3 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(_0x411e96,_0x3f7c9a){var _0x87b13c=function(_0x3f1421){while(--_0x3f1421){_0x411e96['push'](_0x411e96['shift']());}};_0x87b13c(++_0x3f7c9a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x4099d4,_0x38671e){var _0x4171b1=function(_0x34209d){while(--_0x34209d){_0x4099d4['push'](_0x4099d4['shift']());}};_0x4171b1(++_0x38671e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 126b3a2..4c837fb 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 _0xae1c=['isMiddleware','setTokenCookie','exports','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x374a2c,_0x4563cc){var _0x2811a2=function(_0x182761){while(--_0x182761){_0x374a2c['push'](_0x374a2c['shift']());}};_0x2811a2(++_0x4563cc);}(_0xae1c,0xff));var _0xcae1=function(_0x18fbcc,_0x3a3020){_0x18fbcc=_0x18fbcc-0x0;var _0x609604=_0xae1c[_0x18fbcc];return _0x609604;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xcae1('0x0'));var authService=require(_0xcae1('0x1'));router[_0xcae1('0x2')]('/',controller[_0xcae1('0x3')]);router[_0xcae1('0x2')](_0xcae1('0x4'),controller[_0xcae1('0x5')],authService[_0xcae1('0x6')],userController[_0xcae1('0x3')],authService[_0xcae1('0x7')]);module[_0xcae1('0x8')]=router; \ No newline at end of file +var _0x217a=['Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','setTokenCookie','express','passport'];(function(_0x369995,_0x4a0694){var _0x12d55b=function(_0x3062ef){while(--_0x3062ef){_0x369995['push'](_0x369995['shift']());}};_0x12d55b(++_0x4a0694);}(_0x217a,0x1ac));var _0xa217=function(_0x26e2aa,_0x1bc233){_0x26e2aa=_0x26e2aa-0x0;var _0x1a8813=_0x217a[_0x26e2aa];return _0x1a8813;};'use strict';var express=require(_0xa217('0x0'));var passport=require(_0xa217('0x1'));var router=express[_0xa217('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xa217('0x3'));var authService=require(_0xa217('0x4'));router[_0xa217('0x5')]('/',controller[_0xa217('0x6')]);router[_0xa217('0x5')](_0xa217('0x7'),controller[_0xa217('0x8')],authService['isMiddleware'],userController[_0xa217('0x6')],authService[_0xa217('0x9')]);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 97f048a..d41bf8f 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 _0xc11c=['previousPasswords','Password\x20reset!','use','local-login','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','name','role','disabled','blocked','blockedAt','user','agent','then','authenticate','loginAttempts','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password'];(function(_0x5e499f,_0x46daa9){var _0x5995b1=function(_0x54f226){while(--_0x54f226){_0x5e499f['push'](_0x5e499f['shift']());}};_0x5995b1(++_0x46daa9);}(_0xc11c,0x144));var _0xcc11=function(_0x42777b,_0x29d3fb){_0x42777b=_0x42777b-0x0;var _0x2fb268=_0xc11c[_0x42777b];return _0x2fb268;};'use strict';var util=require('util');var passport=require(_0xcc11('0x0'));var LocalStrategy=require(_0xcc11('0x1'))[_0xcc11('0x2')];var jayson=require(_0xcc11('0x3'));var _=require('lodash');var rs=require(_0xcc11('0x4'));var moment=require(_0xcc11('0x5'));var db=require(_0xcc11('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xcc11('0x7'));var client=jayson[_0xcc11('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x1b4110,_0xe54839,_0x5108b7,_0x54104e){var _0x5a1be7,_0x161fa9;return db[_0xcc11('0x9')][_0xcc11('0xa')]({'where':{'id':0x1},'attributes':[_0xcc11('0xb'),_0xcc11('0xc')],'raw':!![]})['then'](function(_0x343145){_0x5a1be7=_0x343145;return _0x1b4110[_0xcc11('0xa')]({'attributes':['id',_0xcc11('0xd'),'password','salt',_0xcc11('0xe'),_0xcc11('0xf'),_0xcc11('0x10'),_0xcc11('0x11'),'loginAttempts'],'where':{'name':_0xe54839,'role':{'$or':['admin',_0xcc11('0x12'),_0xcc11('0x13')]}}});})[_0xcc11('0x14')](function(_0x391930){if(!_0x391930||_0x391930&&_0x391930['name']!==_0xe54839){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x161fa9=_0x391930;return _0x161fa9;}})['then'](function(){_0x161fa9[_0xcc11('0x15')](_0x5108b7,function(_0x5a3d23,_0x5522ca){var _0x325b4b=_0x161fa9[_0xcc11('0x16')]+0x1;if(_0x5a3d23){return _0x54104e(_0x5a3d23);}else if(!_0x5522ca){if(_0x161fa9[_0xcc11('0xf')]){return _0x54104e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5a1be7[_0xcc11('0xb')]>0x0){if(_0x161fa9['blocked']){if(_0x5a1be7[_0xcc11('0xc')]>0x0){if(moment(_0x161fa9[_0xcc11('0x11')])[_0xcc11('0x17')](_0x5a1be7['blockDuration'],'minutes')>moment()){return _0x54104e(null,![],{'message':_0xcc11('0x18')});}else{return utils[_0xcc11('0x19')](_0x161fa9,_0x325b4b,![],null)['then'](function(){return _0x54104e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x54104e(null,![],{'message':_0xcc11('0x18')});}}else{if(_0x325b4b>=_0x5a1be7[_0xcc11('0xb')]){return utils[_0xcc11('0x19')](_0x161fa9,0x0,!![],moment())[_0xcc11('0x14')](function(){return _0x54104e(null,![],{'message':_0xcc11('0x18')});});}else{return utils[_0xcc11('0x19')](_0x161fa9,_0x325b4b,![],null)[_0xcc11('0x14')](function(){return _0x54104e(null,![],{'message':_0xcc11('0x18')});});}}}else{return _0x54104e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x161fa9[_0xcc11('0xf')]){return _0x54104e(null,![],{'message':_0xcc11('0x18')});}else if(_0x5a1be7[_0xcc11('0xb')]>0x0){if(_0x161fa9[_0xcc11('0x10')]){if(_0x5a1be7[_0xcc11('0xc')]>0x0){if(moment(_0x161fa9[_0xcc11('0x11')])[_0xcc11('0x17')](_0x5a1be7[_0xcc11('0xc')],_0xcc11('0x1a'))>moment()){return _0x54104e(null,![],{'message':_0xcc11('0x18')});}else{return utils[_0xcc11('0x19')](_0x161fa9,0x0,![],null)['then'](function(){return utils[_0xcc11('0x1b')](_0x161fa9);})[_0xcc11('0x14')](function(){return _0x54104e(null,_0x161fa9);});}}else{return _0x54104e(null,![],{'message':_0xcc11('0x18')});}}else{return utils[_0xcc11('0x19')](_0x161fa9,0x0,![],null)[_0xcc11('0x14')](function(){return utils[_0xcc11('0x1b')](_0x161fa9);})[_0xcc11('0x14')](function(){return _0x54104e(null,_0x161fa9);})[_0xcc11('0x1c')](function(_0x9230ab){return _0x54104e(null,![],_0x9230ab);});}}else{if(_0x161fa9[_0xcc11('0x10')]){return _0x54104e(null,![],{'message':_0xcc11('0x18')});}else{return utils[_0xcc11('0x1b')](_0x161fa9)['then'](function(){return _0x54104e(null,_0x161fa9);});}}}});})[_0xcc11('0x1c')](function(_0x4231f3){return _0x54104e(null,![],_0x4231f3);});}function sendServiceMail(_0x20f14b){return db['MailAccount'][_0xcc11('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xcc11('0xd'),_0xcc11('0x1e')],'include':[{'model':db[_0xcc11('0x1f')],'as':_0xcc11('0x20'),'include':[{'model':db[_0xcc11('0x21')],'as':_0xcc11('0x21')}]}]})[_0xcc11('0x14')](function(_0x3887f4){if(!_0x3887f4){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5e8109=_0x3887f4['getSmtpOptions']();var _0x177622={'account':_0x5e8109,'message':_['merge']({'from':util[_0xcc11('0x22')](_0xcc11('0x23'),_0x3887f4[_0xcc11('0xd')],_0x3887f4[_0xcc11('0x1e')]||_0x3887f4['Smtp'][_0xcc11('0x12')])},_0x20f14b)};return client[_0xcc11('0x24')](_0xcc11('0x25'),_0x177622);})['then'](function(_0x43fa93){if(_0x43fa93[_0xcc11('0x26')]){throw new Error(util[_0xcc11('0x22')](_0xcc11('0x27'),_0x43fa93[_0xcc11('0x26')][_0xcc11('0x28')]||JSON[_0xcc11('0x29')](_0x43fa93[_0xcc11('0x26')])));}return!![];});}function handleError(_0x162a5b,_0x3eb20c,_0x2fe433){return _0x162a5b['status'](_0x3eb20c||0x1f4)['send']({'message':_0x2fe433?_0x2fe433['message']||_0x2fe433:''});}exports['login']=function(_0x2fd5ce,_0x24fa0d,_0x5a3f0e){passport[_0xcc11('0x15')]('local-login',function(_0x4d67c6,_0x965ace,_0x49750c){var _0x212f99=_0x4d67c6||_0x49750c;if(_0x212f99){return handleError(_0x24fa0d,0x191,_0x212f99);}if(!_0x965ace){return handleError(_0x24fa0d,0x194,{'message':_0xcc11('0x2a')});}else{var _0x599301={'payload':{'id':_0x965ace['id'],'role':_0x965ace[_0xcc11('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xcc11('0x2b')](_0x599301)[_0xcc11('0x14')](function(_0x206412){_0x24fa0d[_0xcc11('0x2c')]({'id':_0x965ace['id'],'token':_0x206412,'statusCall':'','isAlreadyLogged':_0x965ace[_0xcc11('0x2d')]});});}})(_0x2fd5ce,_0x24fa0d,_0x5a3f0e);};exports[_0xcc11('0x2e')]=function(_0x37fc3d,_0x3bb5d6){if(!_0x37fc3d['body'][_0xcc11('0x1e')]){return handleError(_0x3bb5d6,0x1f4,{'message':_0xcc11('0x2f')});}var _0x32d345=rs['generate']();_0x37fc3d[_0xcc11('0x30')][_0xcc11('0x1e')]=_0x37fc3d[_0xcc11('0x30')][_0xcc11('0x1e')][_0xcc11('0x31')]()['toLowerCase']();var _0x991037;return db['Setting'][_0xcc11('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xcc11('0x14')](function(_0x8e50dc){_0x991037=_0x8e50dc;return db[_0xcc11('0x32')][_0xcc11('0x1d')]({'where':{'email':_0x37fc3d[_0xcc11('0x30')][_0xcc11('0x1e')]}});})[_0xcc11('0x14')](function(_0x7ddce3){if(!_0x7ddce3){throw new Error(_0xcc11('0x33'));}if(_0x7ddce3[_0xcc11('0xf')]){throw new Error(_0xcc11('0x34'));}if(_0x7ddce3['blocked']){if(moment(_0x7ddce3['blockedAt'])['add'](_0x991037[_0xcc11('0xc')],_0xcc11('0x1a'))>moment()){throw new Error(_0xcc11('0x35'));}else{_0x7ddce3[_0xcc11('0x10')]=![];_0x7ddce3[_0xcc11('0x11')]=null;}}_0x7ddce3[_0xcc11('0x36')]=_0x32d345;_0x7ddce3[_0xcc11('0x37')]=Date[_0xcc11('0x38')]()+0x36ee80;return _0x7ddce3[_0xcc11('0x39')]();})[_0xcc11('0x14')](function(){return sendServiceMail({'to':_0x37fc3d[_0xcc11('0x30')]['email'],'subject':_0xcc11('0x3a'),'text':_0xcc11('0x3b')+_0xcc11('0x3c')+_0xcc11('0x3d')+_0x37fc3d[_0xcc11('0x3e')][_0xcc11('0x3f')]+_0xcc11('0x40')+_0x32d345+'\x0a\x0a'+_0xcc11('0x41')});})[_0xcc11('0x14')](function(){_0x3bb5d6[_0xcc11('0x42')](0xc8)[_0xcc11('0x43')]({'message':_0xcc11('0x44')});})[_0xcc11('0x1c')](function(_0x5efd70){return handleError(_0x3bb5d6,0x1f4,_0x5efd70);});};exports['reset']=function(_0x14bed9,_0x49b6e3){return db[_0xcc11('0x32')]['find']({'where':{'resetPasswordToken':_0x14bed9['params'][_0xcc11('0x45')],'resetPasswordExpires':{'$gt':Date[_0xcc11('0x38')]()}}})[_0xcc11('0x14')](function(_0x7669be){if(!_0x7669be){throw new Error(_0xcc11('0x46'));}return db[_0xcc11('0x9')][_0xcc11('0xa')]({'attributes':['id',_0xcc11('0x47'),_0xcc11('0x48'),_0xcc11('0x49')]})[_0xcc11('0x14')](function(_0x41f0f3){if(_0x41f0f3[_0xcc11('0x47')])authService[_0xcc11('0x4a')](_0x14bed9[_0xcc11('0x30')][_0xcc11('0x4b')]);if(!_0x41f0f3[_0xcc11('0x48')]||!_0x7669be[_0xcc11('0x4c')])return _0x7669be;authService['validatePasswordHistory'](_0x14bed9[_0xcc11('0x30')][_0xcc11('0x4b')],_0x7669be['previousPasswords'],_0x41f0f3['passwordHistoryLimit']);return _0x7669be;})[_0xcc11('0x14')](function(){_0x7669be[_0xcc11('0x4b')]=_0x14bed9[_0xcc11('0x30')][_0xcc11('0x4b')];_0x7669be[_0xcc11('0x36')]=null;_0x7669be[_0xcc11('0x37')]=null;return _0x7669be['save']();});})[_0xcc11('0x14')](function(){_0x49b6e3[_0xcc11('0x42')](0xc8)[_0xcc11('0x43')]({'message':_0xcc11('0x4d')});})[_0xcc11('0x1c')](function(_0x205473){return handleError(_0x49b6e3,0x1f4,_0x205473);});};passport[_0xcc11('0x4e')](_0xcc11('0x4f'),new LocalStrategy({'usernameField':_0xcc11('0xd'),'passwordField':_0xcc11('0x4b')},function(_0x139688,_0x2cbd3a,_0x289916){return localAuthenticate(db[_0xcc11('0x32')],_0x139688,_0x2cbd3a,_0x289916);})); \ No newline at end of file +var _0x1fb5=['catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','login','signToken','json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','User','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','save','Password\x20reset!','local-login','passport','passport-local','Strategy','jayson/promise','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense'];(function(_0x29c8e5,_0x16823c){var _0x59d791=function(_0x4fc51e){while(--_0x4fc51e){_0x29c8e5['push'](_0x29c8e5['shift']());}};_0x59d791(++_0x16823c);}(_0x1fb5,0x126));var _0x51fb=function(_0x5a5536,_0x57a88c){_0x5a5536=_0x5a5536-0x0;var _0x3c82aa=_0x1fb5[_0x5a5536];return _0x3c82aa;};'use strict';var util=require('util');var passport=require(_0x51fb('0x0'));var LocalStrategy=require(_0x51fb('0x1'))[_0x51fb('0x2')];var jayson=require(_0x51fb('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require('moment');var db=require(_0x51fb('0x4'))['db'];var authService=require(_0x51fb('0x5'));var utils=require(_0x51fb('0x6'));var client=jayson[_0x51fb('0x7')][_0x51fb('0x8')]({'port':0x232b});function localAuthenticate(_0x46bb3c,_0x1f2b3a,_0x2a7486,_0x5305c4){var _0x2e5054,_0x2dcd4c;return db[_0x51fb('0x9')][_0x51fb('0xa')]({'where':{'id':0x1},'attributes':[_0x51fb('0xb'),_0x51fb('0xc')],'raw':!![]})[_0x51fb('0xd')](function(_0x128467){_0x2e5054=_0x128467;return _0x46bb3c[_0x51fb('0xa')]({'attributes':['id',_0x51fb('0xe'),_0x51fb('0xf'),_0x51fb('0x10'),_0x51fb('0x11'),_0x51fb('0x12'),_0x51fb('0x13'),_0x51fb('0x14'),_0x51fb('0x15')],'where':{'name':_0x1f2b3a,'role':{'$or':['admin',_0x51fb('0x16'),_0x51fb('0x17')]}}});})['then'](function(_0x3aeaa8){if(!_0x3aeaa8||_0x3aeaa8&&_0x3aeaa8[_0x51fb('0xe')]!==_0x1f2b3a){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2dcd4c=_0x3aeaa8;return _0x2dcd4c;}})['then'](function(){_0x2dcd4c[_0x51fb('0x18')](_0x2a7486,function(_0x8a7b4b,_0x56d04e){var _0x13dacd=_0x2dcd4c[_0x51fb('0x15')]+0x1;if(_0x8a7b4b){return _0x5305c4(_0x8a7b4b);}else if(!_0x56d04e){if(_0x2dcd4c[_0x51fb('0x12')]){return _0x5305c4(null,![],{'message':_0x51fb('0x19')});}else if(_0x2e5054[_0x51fb('0xb')]>0x0){if(_0x2dcd4c['blocked']){if(_0x2e5054['blockDuration']>0x0){if(moment(_0x2dcd4c[_0x51fb('0x14')])[_0x51fb('0x1a')](_0x2e5054[_0x51fb('0xc')],_0x51fb('0x1b'))>moment()){return _0x5305c4(null,![],{'message':_0x51fb('0x19')});}else{return utils[_0x51fb('0x1c')](_0x2dcd4c,_0x13dacd,![],null)[_0x51fb('0xd')](function(){return _0x5305c4(null,![],{'message':_0x51fb('0x19')});});}}else{return _0x5305c4(null,![],{'message':_0x51fb('0x19')});}}else{if(_0x13dacd>=_0x2e5054[_0x51fb('0xb')]){return utils['clearBlockUser'](_0x2dcd4c,0x0,!![],moment())[_0x51fb('0xd')](function(){return _0x5305c4(null,![],{'message':_0x51fb('0x19')});});}else{return utils[_0x51fb('0x1c')](_0x2dcd4c,_0x13dacd,![],null)[_0x51fb('0xd')](function(){return _0x5305c4(null,![],{'message':_0x51fb('0x19')});});}}}else{return _0x5305c4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2dcd4c[_0x51fb('0x12')]){return _0x5305c4(null,![],{'message':_0x51fb('0x19')});}else if(_0x2e5054[_0x51fb('0xb')]>0x0){if(_0x2dcd4c[_0x51fb('0x13')]){if(_0x2e5054['blockDuration']>0x0){if(moment(_0x2dcd4c['blockedAt'])[_0x51fb('0x1a')](_0x2e5054[_0x51fb('0xc')],'minutes')>moment()){return _0x5305c4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x51fb('0x1c')](_0x2dcd4c,0x0,![],null)['then'](function(){return utils[_0x51fb('0x1d')](_0x2dcd4c);})['then'](function(){return _0x5305c4(null,_0x2dcd4c);});}}else{return _0x5305c4(null,![],{'message':_0x51fb('0x19')});}}else{return utils[_0x51fb('0x1c')](_0x2dcd4c,0x0,![],null)[_0x51fb('0xd')](function(){return utils[_0x51fb('0x1d')](_0x2dcd4c);})[_0x51fb('0xd')](function(){return _0x5305c4(null,_0x2dcd4c);})[_0x51fb('0x1e')](function(_0xb7732d){return _0x5305c4(null,![],_0xb7732d);});}}else{if(_0x2dcd4c[_0x51fb('0x13')]){return _0x5305c4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x2dcd4c)[_0x51fb('0xd')](function(){return _0x5305c4(null,_0x2dcd4c);});}}}});})[_0x51fb('0x1e')](function(_0x452616){return _0x5305c4(null,![],_0x452616);});}function sendServiceMail(_0x74ff5c){return db['MailAccount'][_0x51fb('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x51fb('0xe'),_0x51fb('0x20')],'include':[{'model':db[_0x51fb('0x21')],'as':'Smtp','include':[{'model':db[_0x51fb('0x22')],'as':'CloudProvider'}]}]})['then'](function(_0x309e1a){if(!_0x309e1a){throw new Error(_0x51fb('0x23'));}var _0x4726e7=_0x309e1a[_0x51fb('0x24')]();var _0x2303cc={'account':_0x4726e7,'message':_[_0x51fb('0x25')]({'from':util[_0x51fb('0x26')](_0x51fb('0x27'),_0x309e1a['name'],_0x309e1a['email']||_0x309e1a[_0x51fb('0x28')][_0x51fb('0x16')])},_0x74ff5c)};return client['request'](_0x51fb('0x29'),_0x2303cc);})[_0x51fb('0xd')](function(_0x4f431b){if(_0x4f431b['error']){throw new Error(util[_0x51fb('0x26')](_0x51fb('0x2a'),_0x4f431b[_0x51fb('0x2b')][_0x51fb('0x2c')]||JSON[_0x51fb('0x2d')](_0x4f431b['error'])));}return!![];});}function handleError(_0x53fd6b,_0x23fe02,_0x49a446){return _0x53fd6b[_0x51fb('0x2e')](_0x23fe02||0x1f4)['send']({'message':_0x49a446?_0x49a446['message']||_0x49a446:''});}exports[_0x51fb('0x2f')]=function(_0x4284ae,_0x459042,_0x6e2118){passport[_0x51fb('0x18')]('local-login',function(_0x5e2e52,_0x2ebb94,_0x523ab6){var _0x5d9c16=_0x5e2e52||_0x523ab6;if(_0x5d9c16){return handleError(_0x459042,0x191,_0x5d9c16);}if(!_0x2ebb94){return handleError(_0x459042,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x250f31={'payload':{'id':_0x2ebb94['id'],'role':_0x2ebb94['role']},'options':{'expiresIn':0x15180}};return authService[_0x51fb('0x30')](_0x250f31)['then'](function(_0x18ae39){_0x459042[_0x51fb('0x31')]({'id':_0x2ebb94['id'],'token':_0x18ae39,'statusCall':'','isAlreadyLogged':_0x2ebb94[_0x51fb('0x32')]});});}})(_0x4284ae,_0x459042,_0x6e2118);};exports['forgot']=function(_0x31ec91,_0x59f39e){if(!_0x31ec91[_0x51fb('0x33')][_0x51fb('0x20')]){return handleError(_0x59f39e,0x1f4,{'message':_0x51fb('0x34')});}var _0x519aae=rs['generate']();_0x31ec91['body']['email']=_0x31ec91[_0x51fb('0x33')][_0x51fb('0x20')][_0x51fb('0x35')]()[_0x51fb('0x36')]();var _0x16f069;return db['Setting'][_0x51fb('0xa')]({'where':{'id':0x1},'attributes':[_0x51fb('0xb'),_0x51fb('0xc')],'raw':!![]})['then'](function(_0x86377d){_0x16f069=_0x86377d;return db['User'][_0x51fb('0x1f')]({'where':{'email':_0x31ec91[_0x51fb('0x33')][_0x51fb('0x20')]}});})[_0x51fb('0xd')](function(_0x5ddaf8){if(!_0x5ddaf8){throw new Error(_0x51fb('0x37'));}if(_0x5ddaf8[_0x51fb('0x12')]){throw new Error(_0x51fb('0x38'));}if(_0x5ddaf8['blocked']){if(moment(_0x5ddaf8[_0x51fb('0x14')])[_0x51fb('0x1a')](_0x16f069[_0x51fb('0xc')],_0x51fb('0x1b'))>moment()){throw new Error(_0x51fb('0x39'));}else{_0x5ddaf8[_0x51fb('0x13')]=![];_0x5ddaf8[_0x51fb('0x14')]=null;}}_0x5ddaf8['resetPasswordToken']=_0x519aae;_0x5ddaf8['resetPasswordExpires']=Date[_0x51fb('0x3a')]()+0x36ee80;return _0x5ddaf8['save']();})[_0x51fb('0xd')](function(){return sendServiceMail({'to':_0x31ec91['body'][_0x51fb('0x20')],'subject':_0x51fb('0x3b'),'text':_0x51fb('0x3c')+_0x51fb('0x3d')+_0x51fb('0x3e')+_0x31ec91[_0x51fb('0x3f')][_0x51fb('0x40')]+_0x51fb('0x41')+_0x519aae+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x51fb('0xd')](function(){_0x59f39e[_0x51fb('0x2e')](0xc8)['send']({'message':_0x51fb('0x42')});})[_0x51fb('0x1e')](function(_0xb2bea3){return handleError(_0x59f39e,0x1f4,_0xb2bea3);});};exports[_0x51fb('0x43')]=function(_0x429bc8,_0x2635ed){return db[_0x51fb('0x44')][_0x51fb('0x1f')]({'where':{'resetPasswordToken':_0x429bc8['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x51fb('0x3a')]()}}})[_0x51fb('0xd')](function(_0x23ef2b){if(!_0x23ef2b){throw new Error(_0x51fb('0x45'));}return db[_0x51fb('0x9')][_0x51fb('0xa')]({'attributes':['id',_0x51fb('0x46'),_0x51fb('0x47'),_0x51fb('0x48')]})[_0x51fb('0xd')](function(_0x319a26){if(_0x319a26['securePassword'])authService[_0x51fb('0x49')](_0x429bc8['body'][_0x51fb('0xf')]);if(!_0x319a26['enforcePasswordHistory']||!_0x23ef2b[_0x51fb('0x4a')])return _0x23ef2b;authService[_0x51fb('0x4b')](_0x429bc8[_0x51fb('0x33')][_0x51fb('0xf')],_0x23ef2b[_0x51fb('0x4a')],_0x319a26[_0x51fb('0x48')]);return _0x23ef2b;})['then'](function(){_0x23ef2b['password']=_0x429bc8[_0x51fb('0x33')]['password'];_0x23ef2b[_0x51fb('0x4c')]=null;_0x23ef2b[_0x51fb('0x4d')]=null;return _0x23ef2b[_0x51fb('0x4e')]();});})[_0x51fb('0xd')](function(){_0x2635ed[_0x51fb('0x2e')](0xc8)['send']({'message':_0x51fb('0x4f')});})[_0x51fb('0x1e')](function(_0x4c1fc6){return handleError(_0x2635ed,0x1f4,_0x4c1fc6);});};passport['use'](_0x51fb('0x50'),new LocalStrategy({'usernameField':_0x51fb('0xe'),'passwordField':_0x51fb('0xf')},function(_0x4fc699,_0x25fd75,_0x489d00){return localAuthenticate(db['User'],_0x4fc699,_0x25fd75,_0x489d00);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5fd6ceb..23f2db1 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 _0x6c40=['post','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0xc88a95,_0x132392){var _0x5ae1b2=function(_0x5458aa){while(--_0x5458aa){_0xc88a95['push'](_0xc88a95['shift']());}};_0x5ae1b2(++_0x132392);}(_0x6c40,0x19d));var _0x06c4=function(_0x31459c,_0x898143){_0x31459c=_0x31459c-0x0;var _0x7aba2b=_0x6c40[_0x31459c];return _0x7aba2b;};'use strict';var express=require(_0x06c4('0x0'));var router=express[_0x06c4('0x1')]();var controller=require(_0x06c4('0x2'));router[_0x06c4('0x3')]('/',controller['login']);router['post']('/forgot',controller[_0x06c4('0x4')]);router[_0x06c4('0x3')](_0x06c4('0x5'),controller[_0x06c4('0x6')]);module[_0x06c4('0x7')]=router; \ No newline at end of file +var _0xf75e=['post','login','forgot','/reset/:token','reset','express','Router'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xf75e,0x11d));var _0xef75=function(_0x51b53f,_0x1d7216){_0x51b53f=_0x51b53f-0x0;var _0x46312e=_0xf75e[_0x51b53f];return _0x46312e;};'use strict';var express=require(_0xef75('0x0'));var router=express[_0xef75('0x1')]();var controller=require('./authLocal.controller');router[_0xef75('0x2')]('/',controller[_0xef75('0x3')]);router[_0xef75('0x2')]('/forgot',controller[_0xef75('0x4')]);router[_0xef75('0x2')](_0xef75('0x5'),controller[_0xef75('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 5ce23ea..9c96bf7 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 _0x7c7d=['INTEGER','exports','STRING'];(function(_0x2f0622,_0x3aad7f){var _0x3ec353=function(_0xc8784a){while(--_0xc8784a){_0x2f0622['push'](_0x2f0622['shift']());}};_0x3ec353(++_0x3aad7f);}(_0x7c7d,0xfa));var _0xd7c7=function(_0x2bfc42,_0x5a9e74){_0x2bfc42=_0x2bfc42-0x0;var _0x1630ef=_0x7c7d[_0x2bfc42];return _0x1630ef;};'use strict';var Sequelize=require('sequelize');module[_0xd7c7('0x0')]={'name':{'type':Sequelize[_0xd7c7('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xd7c7('0x1')]},'description':{'type':Sequelize[_0xd7c7('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd7c7('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x2ddb=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd339,_0x1b5e74){var _0x37c682=function(_0x4d74e5){while(--_0x4d74e5){_0x3dd339['push'](_0x3dd339['shift']());}};_0x37c682(++_0x1b5e74);}(_0x2ddb,0x17e));var _0xb2dd=function(_0x27702c,_0xad309d){_0x27702c=_0x27702c-0x0;var _0xc775ad=_0x2ddb[_0x27702c];return _0xc775ad;};'use strict';var Sequelize=require(_0xb2dd('0x0'));module[_0xb2dd('0x1')]={'name':{'type':Sequelize[_0xb2dd('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb2dd('0x2')]},'description':{'type':Sequelize[_0xb2dd('0x2')]},'status':{'type':Sequelize[_0xb2dd('0x3')],'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 ac7cddd..fec8429 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 _0xe4f3=['addConditions','Condition','omit','ids','getConditions','findOne','merge','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','catch','rawAttributes','include','find','create','body','params'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xe4f3,0x1a9));var _0x3e4f=function(_0x45c96a,_0x4cfc11){_0x45c96a=_0x45c96a-0x0;var _0x314fed=_0xe4f3[_0x45c96a];return _0x314fed;};'use strict';var emlformat=require(_0x3e4f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e4f('0x1'));var jsonpatch=require(_0x3e4f('0x2'));var rp=require(_0x3e4f('0x3'));var moment=require(_0x3e4f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3e4f('0x5'));var util=require(_0x3e4f('0x6'));var path=require(_0x3e4f('0x7'));var sox=require(_0x3e4f('0x8'));var csv=require(_0x3e4f('0x9'));var ejs=require(_0x3e4f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3e4f('0xb'));var crypto=require(_0x3e4f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3e4f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3e4f('0xe'));var Papa=require(_0x3e4f('0xf'));var Redis=require(_0x3e4f('0x10'));var authService=require(_0x3e4f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e4f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3e4f('0x13'));var config=require(_0x3e4f('0x14'));var licenseUtil=require(_0x3e4f('0x15'));var db=require(_0x3e4f('0x16'))['db'];function respondWithStatusCode(_0x3b1209,_0xfae52d){_0xfae52d=_0xfae52d||0xcc;return function(_0x46fba1){if(_0x46fba1){return _0x3b1209[_0x3e4f('0x17')](_0xfae52d);}return _0x3b1209[_0x3e4f('0x18')](_0xfae52d)[_0x3e4f('0x19')]();};}function respondWithResult(_0x386231,_0x9f797c){_0x9f797c=_0x9f797c||0xc8;return function(_0x4b15cf){if(_0x4b15cf){return _0x386231[_0x3e4f('0x18')](_0x9f797c)['json'](_0x4b15cf);}};}function respondWithFilteredResult(_0x536456,_0x3dfe89){return function(_0xff912){if(_0xff912){var _0x70d5c1=typeof _0x3dfe89[_0x3e4f('0x1a')]===_0x3e4f('0x1b')&&typeof _0x3dfe89[_0x3e4f('0x1c')]===_0x3e4f('0x1b');var _0x20b221=_0xff912[_0x3e4f('0x1d')];var _0x2a050f=_0x70d5c1?0x0:_0x3dfe89[_0x3e4f('0x1a')];var _0x292cb9=_0x70d5c1?_0xff912[_0x3e4f('0x1d')]:_0x3dfe89[_0x3e4f('0x1a')]+_0x3dfe89[_0x3e4f('0x1c')];var _0x141132;if(_0x292cb9>=_0x20b221){_0x292cb9=_0x20b221;_0x141132=0xc8;}else{_0x141132=0xce;}_0x536456[_0x3e4f('0x18')](_0x141132);return _0x536456[_0x3e4f('0x1e')](_0x3e4f('0x1f'),_0x2a050f+'-'+_0x292cb9+'/'+_0x20b221)[_0x3e4f('0x20')](_0xff912);}return null;};}function patchUpdates(_0x46a7b1){return function(_0x467f05){try{jsonpatch[_0x3e4f('0x21')](_0x467f05,_0x46a7b1,!![]);}catch(_0x2a404e){return BPromise[_0x3e4f('0x22')](_0x2a404e);}return _0x467f05[_0x3e4f('0x23')]();};}function saveUpdates(_0x20d559,_0x25b68c){return function(_0x48f0ff){if(_0x48f0ff){return _0x48f0ff[_0x3e4f('0x24')](_0x20d559)[_0x3e4f('0x25')](function(_0x4904a9){return _0x4904a9;});}return null;};}function removeEntity(_0x1ef0fd,_0x4eb89a){return function(_0x46bd12){if(_0x46bd12){return _0x46bd12[_0x3e4f('0x26')]()['then'](function(){_0x1ef0fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xec7dde,_0x544f5){return function(_0x40e487){if(!_0x40e487){_0xec7dde[_0x3e4f('0x17')](0x194);}return _0x40e487;};}function handleError(_0x45c11c,_0xade20b){_0xade20b=_0xade20b||0x1f4;return function(_0x126d68){logger[_0x3e4f('0x27')](_0x126d68['stack']);if(_0x126d68[_0x3e4f('0x28')]){delete _0x126d68[_0x3e4f('0x28')];}_0x45c11c[_0x3e4f('0x18')](_0xade20b)['send'](_0x126d68);};}exports[_0x3e4f('0x29')]=function(_0x275495,_0x4739bf){var _0x5c5cb6={},_0xa969de={},_0x4d3f9d={'count':0x0,'rows':[]};var _0x34e929=_[_0x3e4f('0x2a')](db[_0x3e4f('0x2b')]['rawAttributes'],function(_0xc59956){return{'name':_0xc59956[_0x3e4f('0x2c')],'type':_0xc59956[_0x3e4f('0x2d')][_0x3e4f('0x2e')]};});_0xa969de[_0x3e4f('0x2f')]=_['map'](_0x34e929,_0x3e4f('0x28'));_0xa969de[_0x3e4f('0x30')]=_[_0x3e4f('0x31')](_0x275495[_0x3e4f('0x30')]);_0xa969de[_0x3e4f('0x32')]=_[_0x3e4f('0x33')](_0xa969de[_0x3e4f('0x2f')],_0xa969de['query']);_0x5c5cb6[_0x3e4f('0x34')]=_['intersection'](_0xa969de[_0x3e4f('0x2f')],qs[_0x3e4f('0x35')](_0x275495['query'][_0x3e4f('0x35')]));_0x5c5cb6['attributes']=_0x5c5cb6[_0x3e4f('0x34')][_0x3e4f('0x36')]?_0x5c5cb6[_0x3e4f('0x34')]:_0xa969de[_0x3e4f('0x2f')];if(!_0x275495[_0x3e4f('0x30')][_0x3e4f('0x37')](_0x3e4f('0x38'))){_0x5c5cb6[_0x3e4f('0x1c')]=qs[_0x3e4f('0x1c')](_0x275495[_0x3e4f('0x30')][_0x3e4f('0x1c')]);_0x5c5cb6[_0x3e4f('0x1a')]=qs[_0x3e4f('0x1a')](_0x275495[_0x3e4f('0x30')][_0x3e4f('0x1a')]);}_0x5c5cb6[_0x3e4f('0x39')]=qs['sort'](_0x275495[_0x3e4f('0x30')][_0x3e4f('0x3a')]);_0x5c5cb6[_0x3e4f('0x3b')]=qs['filters'](_[_0x3e4f('0x3c')](_0x275495['query'],_0xa969de[_0x3e4f('0x32')]),_0x34e929);if(_0x275495[_0x3e4f('0x30')]['filter']){_0x5c5cb6[_0x3e4f('0x3b')]=_['merge'](_0x5c5cb6['where'],{'$or':_[_0x3e4f('0x2a')](_0x34e929,function(_0x4960fc){if(_0x4960fc[_0x3e4f('0x2d')]!==_0x3e4f('0x3d')){var _0x60fa89={};_0x60fa89[_0x4960fc[_0x3e4f('0x28')]]={'$like':'%'+_0x275495['query'][_0x3e4f('0x3e')]+'%'};return _0x60fa89;}})});}_0x5c5cb6=_['merge']({},_0x5c5cb6,_0x275495[_0x3e4f('0x3f')]);var _0x393ce2={'where':_0x5c5cb6[_0x3e4f('0x3b')]};return db[_0x3e4f('0x2b')]['count'](_0x393ce2)[_0x3e4f('0x25')](function(_0x12eb83){_0x4d3f9d[_0x3e4f('0x1d')]=_0x12eb83;if(_0x275495['query'][_0x3e4f('0x40')]){_0x5c5cb6['include']=[{'all':!![]}];}return db[_0x3e4f('0x2b')][_0x3e4f('0x41')](_0x5c5cb6);})[_0x3e4f('0x25')](function(_0x416cf9){_0x4d3f9d['rows']=_0x416cf9;return _0x4d3f9d;})[_0x3e4f('0x25')](respondWithFilteredResult(_0x4739bf,_0x5c5cb6))[_0x3e4f('0x42')](handleError(_0x4739bf,null));};exports['show']=function(_0x2a363d,_0x2ac78e){var _0x6456e6={'raw':![],'where':{'id':_0x2a363d['params']['id']}},_0x373ce2={};_0x373ce2['model']=_[_0x3e4f('0x31')](db[_0x3e4f('0x2b')][_0x3e4f('0x43')]);_0x373ce2[_0x3e4f('0x30')]=_[_0x3e4f('0x31')](_0x2a363d['query']);_0x373ce2[_0x3e4f('0x32')]=_[_0x3e4f('0x33')](_0x373ce2['model'],_0x373ce2[_0x3e4f('0x30')]);_0x6456e6[_0x3e4f('0x34')]=_[_0x3e4f('0x33')](_0x373ce2[_0x3e4f('0x2f')],qs[_0x3e4f('0x35')](_0x2a363d['query'][_0x3e4f('0x35')]));_0x6456e6[_0x3e4f('0x34')]=_0x6456e6[_0x3e4f('0x34')]['length']?_0x6456e6[_0x3e4f('0x34')]:_0x373ce2[_0x3e4f('0x2f')];if(_0x2a363d[_0x3e4f('0x30')][_0x3e4f('0x40')]){_0x6456e6[_0x3e4f('0x44')]=[{'all':!![]}];}_0x6456e6=_['merge']({},_0x6456e6,_0x2a363d[_0x3e4f('0x3f')]);return db[_0x3e4f('0x2b')][_0x3e4f('0x45')](_0x6456e6)['then'](handleEntityNotFound(_0x2ac78e,null))[_0x3e4f('0x25')](respondWithResult(_0x2ac78e,null))[_0x3e4f('0x42')](handleError(_0x2ac78e,null));};exports[_0x3e4f('0x46')]=function(_0x5136a2,_0x290c0b){return db[_0x3e4f('0x2b')][_0x3e4f('0x46')](_0x5136a2[_0x3e4f('0x47')],{})[_0x3e4f('0x25')](respondWithResult(_0x290c0b,0xc9))[_0x3e4f('0x42')](handleError(_0x290c0b,null));};exports['update']=function(_0x5f5270,_0x263805){if(_0x5f5270[_0x3e4f('0x47')]['id']){delete _0x5f5270[_0x3e4f('0x47')]['id'];}return db['Automation'][_0x3e4f('0x45')]({'where':{'id':_0x5f5270[_0x3e4f('0x48')]['id']}})[_0x3e4f('0x25')](handleEntityNotFound(_0x263805,null))[_0x3e4f('0x25')](saveUpdates(_0x5f5270[_0x3e4f('0x47')],null))[_0x3e4f('0x25')](respondWithResult(_0x263805,null))[_0x3e4f('0x42')](handleError(_0x263805,null));};exports[_0x3e4f('0x26')]=function(_0x33e381,_0x51b1a6){return db['Automation'][_0x3e4f('0x45')]({'where':{'id':_0x33e381['params']['id']}})['then'](handleEntityNotFound(_0x51b1a6,null))['then'](removeEntity(_0x51b1a6,null))[_0x3e4f('0x42')](handleError(_0x51b1a6,null));};exports[_0x3e4f('0x49')]=function(_0x445f90,_0x52e5cc,_0x41ee82){return db[_0x3e4f('0x4a')][_0x3e4f('0x45')]({'where':{'id':_0x445f90[_0x3e4f('0x48')]['id']}})[_0x3e4f('0x25')](handleEntityNotFound(_0x52e5cc,null))[_0x3e4f('0x25')](function(_0x548e6c){if(_0x548e6c){return _0x548e6c[_0x3e4f('0x49')](_0x445f90[_0x3e4f('0x47')]['ids'],_[_0x3e4f('0x4b')](_0x445f90[_0x3e4f('0x47')],[_0x3e4f('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x52e5cc,null))[_0x3e4f('0x42')](handleError(_0x52e5cc,null));};exports[_0x3e4f('0x4d')]=function(_0x287d10,_0x858ac,_0x3482b4){var _0xbc27f7={};var _0x48a670={};var _0x16af7e;var _0x6e625a;return db['Automation'][_0x3e4f('0x4e')]({'where':{'id':_0x287d10[_0x3e4f('0x48')]['id']}})[_0x3e4f('0x25')](handleEntityNotFound(_0x858ac,null))['then'](function(_0x3044e3){if(_0x3044e3){_0x16af7e=_0x3044e3;_0x48a670[_0x3e4f('0x2f')]=_[_0x3e4f('0x31')](db[_0x3e4f('0x4a')][_0x3e4f('0x43')]);_0x48a670['query']=_[_0x3e4f('0x31')](_0x287d10[_0x3e4f('0x30')]);_0x48a670[_0x3e4f('0x32')]=_[_0x3e4f('0x33')](_0x48a670[_0x3e4f('0x2f')],_0x48a670['query']);_0xbc27f7[_0x3e4f('0x34')]=_[_0x3e4f('0x33')](_0x48a670[_0x3e4f('0x2f')],qs['fields'](_0x287d10[_0x3e4f('0x30')][_0x3e4f('0x35')]));_0xbc27f7['attributes']=_0xbc27f7['attributes'][_0x3e4f('0x36')]?_0xbc27f7[_0x3e4f('0x34')]:_0x48a670[_0x3e4f('0x2f')];_0xbc27f7[_0x3e4f('0x39')]=qs[_0x3e4f('0x3a')](_0x287d10[_0x3e4f('0x30')][_0x3e4f('0x3a')]);_0xbc27f7['where']=qs[_0x3e4f('0x32')](_[_0x3e4f('0x3c')](_0x287d10['query'],_0x48a670[_0x3e4f('0x32')]));if(_0x287d10[_0x3e4f('0x30')][_0x3e4f('0x3e')]){_0xbc27f7[_0x3e4f('0x3b')]=_['merge'](_0xbc27f7['where'],{'$or':_[_0x3e4f('0x2a')](_0xbc27f7['attributes'],function(_0x4b1d30){var _0x763508={};_0x763508[_0x4b1d30]={'$like':'%'+_0x287d10['query'][_0x3e4f('0x3e')]+'%'};return _0x763508;})});}_0xbc27f7=_[_0x3e4f('0x4f')]({},_0xbc27f7,_0x287d10[_0x3e4f('0x3f')]);return _0x16af7e[_0x3e4f('0x4d')](_0xbc27f7);}})[_0x3e4f('0x25')](function(_0x225c8f){if(_0x225c8f){_0x6e625a=_0x225c8f[_0x3e4f('0x36')];if(!_0x287d10[_0x3e4f('0x30')]['hasOwnProperty'](_0x3e4f('0x38'))){_0xbc27f7['limit']=qs[_0x3e4f('0x1c')](_0x287d10[_0x3e4f('0x30')][_0x3e4f('0x1c')]);_0xbc27f7[_0x3e4f('0x1a')]=qs[_0x3e4f('0x1a')](_0x287d10[_0x3e4f('0x30')][_0x3e4f('0x1a')]);}return _0x16af7e['getConditions'](_0xbc27f7);}})[_0x3e4f('0x25')](function(_0x1b4a10){if(_0x1b4a10){return _0x1b4a10?{'count':_0x6e625a,'rows':_0x1b4a10}:null;}})[_0x3e4f('0x25')](respondWithResult(_0x858ac,null))[_0x3e4f('0x42')](handleError(_0x858ac,null));};exports[_0x3e4f('0x50')]=function(_0x2f04e9,_0x895589,_0x1db8e0){return db[_0x3e4f('0x51')]['find']({'where':{'id':_0x2f04e9[_0x3e4f('0x48')]['id']}})[_0x3e4f('0x25')](handleEntityNotFound(_0x895589,null))[_0x3e4f('0x25')](function(_0x5834c5){if(_0x5834c5){return _0x5834c5['addActions'](_0x2f04e9[_0x3e4f('0x47')][_0x3e4f('0x4c')],_[_0x3e4f('0x4b')](_0x2f04e9['body'],[_0x3e4f('0x4c'),'id'])||{});}})[_0x3e4f('0x25')](respondWithResult(_0x895589,null))[_0x3e4f('0x42')](handleError(_0x895589,null));};exports[_0x3e4f('0x52')]=function(_0x39b55f,_0x5bab1e,_0x2545d8){var _0x45b34a={};var _0x1460ef={};var _0x4e89c3;var _0x28b995;return db[_0x3e4f('0x2b')][_0x3e4f('0x4e')]({'where':{'id':_0x39b55f[_0x3e4f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bab1e,null))['then'](function(_0x148bda){if(_0x148bda){_0x4e89c3=_0x148bda;_0x1460ef['model']=_[_0x3e4f('0x31')](db[_0x3e4f('0x51')][_0x3e4f('0x43')]);_0x1460ef[_0x3e4f('0x30')]=_[_0x3e4f('0x31')](_0x39b55f[_0x3e4f('0x30')]);_0x1460ef[_0x3e4f('0x32')]=_[_0x3e4f('0x33')](_0x1460ef[_0x3e4f('0x2f')],_0x1460ef[_0x3e4f('0x30')]);_0x45b34a[_0x3e4f('0x34')]=_['intersection'](_0x1460ef['model'],qs[_0x3e4f('0x35')](_0x39b55f[_0x3e4f('0x30')]['fields']));_0x45b34a[_0x3e4f('0x34')]=_0x45b34a[_0x3e4f('0x34')]['length']?_0x45b34a[_0x3e4f('0x34')]:_0x1460ef['model'];_0x45b34a[_0x3e4f('0x39')]=qs[_0x3e4f('0x3a')](_0x39b55f[_0x3e4f('0x30')][_0x3e4f('0x3a')]);_0x45b34a['where']=qs[_0x3e4f('0x32')](_[_0x3e4f('0x3c')](_0x39b55f[_0x3e4f('0x30')],_0x1460ef[_0x3e4f('0x32')]));if(_0x39b55f['query']['filter']){_0x45b34a[_0x3e4f('0x3b')]=_['merge'](_0x45b34a[_0x3e4f('0x3b')],{'$or':_[_0x3e4f('0x2a')](_0x45b34a[_0x3e4f('0x34')],function(_0xc483ba){var _0x4a72e4={};_0x4a72e4[_0xc483ba]={'$like':'%'+_0x39b55f[_0x3e4f('0x30')][_0x3e4f('0x3e')]+'%'};return _0x4a72e4;})});}_0x45b34a=_[_0x3e4f('0x4f')]({},_0x45b34a,_0x39b55f[_0x3e4f('0x3f')]);return _0x4e89c3[_0x3e4f('0x52')](_0x45b34a);}})[_0x3e4f('0x25')](function(_0x33bd89){if(_0x33bd89){_0x28b995=_0x33bd89['length'];if(!_0x39b55f[_0x3e4f('0x30')][_0x3e4f('0x37')](_0x3e4f('0x38'))){_0x45b34a['limit']=qs[_0x3e4f('0x1c')](_0x39b55f['query']['limit']);_0x45b34a[_0x3e4f('0x1a')]=qs[_0x3e4f('0x1a')](_0x39b55f[_0x3e4f('0x30')][_0x3e4f('0x1a')]);}return _0x4e89c3['getActions'](_0x45b34a);}})['then'](function(_0x3e25b0){if(_0x3e25b0){return _0x3e25b0?{'count':_0x28b995,'rows':_0x3e25b0}:null;}})['then'](respondWithResult(_0x5bab1e,null))[_0x3e4f('0x42')](handleError(_0x5bab1e,null));}; \ No newline at end of file +var _0x017c=['set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','Automation','rawAttributes','model','map','query','keys','filters','attributes','intersection','fields','sort','where','pick','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','params','length','find','create','body','addConditions','omit','ids','getConditions','Condition','filter','hasOwnProperty','addActions','Action','getActions','findOne','order','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x017c,0x17c));var _0xc017=function(_0x8c6eee,_0x21f601){_0x8c6eee=_0x8c6eee-0x0;var _0x5a03b5=_0x017c[_0x8c6eee];return _0x5a03b5;};'use strict';var emlformat=require(_0xc017('0x0'));var rimraf=require(_0xc017('0x1'));var zipdir=require(_0xc017('0x2'));var jsonpatch=require(_0xc017('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc017('0x4'));var Mustache=require('mustache');var util=require(_0xc017('0x5'));var path=require(_0xc017('0x6'));var sox=require(_0xc017('0x7'));var csv=require(_0xc017('0x8'));var ejs=require(_0xc017('0x9'));var fs=require('fs');var fs_extra=require(_0xc017('0xa'));var _=require('lodash');var squel=require(_0xc017('0xb'));var crypto=require('crypto');var jsforce=require(_0xc017('0xc'));var deskjs=require(_0xc017('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc017('0xe'));var Papa=require(_0xc017('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc017('0x10'));var as=require(_0xc017('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc017('0x12'));var utils=require(_0xc017('0x13'));var config=require(_0xc017('0x14'));var licenseUtil=require(_0xc017('0x15'));var db=require(_0xc017('0x16'))['db'];function respondWithStatusCode(_0x839c2f,_0x3cbe46){_0x3cbe46=_0x3cbe46||0xcc;return function(_0x34cf87){if(_0x34cf87){return _0x839c2f['sendStatus'](_0x3cbe46);}return _0x839c2f[_0xc017('0x17')](_0x3cbe46)[_0xc017('0x18')]();};}function respondWithResult(_0xdfcae7,_0x12f8a3){_0x12f8a3=_0x12f8a3||0xc8;return function(_0x1aa92e){if(_0x1aa92e){return _0xdfcae7[_0xc017('0x17')](_0x12f8a3)[_0xc017('0x19')](_0x1aa92e);}};}function respondWithFilteredResult(_0x492fc7,_0x41f1ee){return function(_0x5ed83d){if(_0x5ed83d){var _0x369920=typeof _0x41f1ee[_0xc017('0x1a')]==='undefined'&&typeof _0x41f1ee[_0xc017('0x1b')]===_0xc017('0x1c');var _0x57f429=_0x5ed83d[_0xc017('0x1d')];var _0x2e4dc7=_0x369920?0x0:_0x41f1ee[_0xc017('0x1a')];var _0x28d68d=_0x369920?_0x5ed83d[_0xc017('0x1d')]:_0x41f1ee['offset']+_0x41f1ee[_0xc017('0x1b')];var _0x51d156;if(_0x28d68d>=_0x57f429){_0x28d68d=_0x57f429;_0x51d156=0xc8;}else{_0x51d156=0xce;}_0x492fc7[_0xc017('0x17')](_0x51d156);return _0x492fc7[_0xc017('0x1e')](_0xc017('0x1f'),_0x2e4dc7+'-'+_0x28d68d+'/'+_0x57f429)['json'](_0x5ed83d);}return null;};}function patchUpdates(_0x4f6b0a){return function(_0x29892b){try{jsonpatch[_0xc017('0x20')](_0x29892b,_0x4f6b0a,!![]);}catch(_0x4fad7a){return BPromise[_0xc017('0x21')](_0x4fad7a);}return _0x29892b[_0xc017('0x22')]();};}function saveUpdates(_0x383cd4,_0x4db67e){return function(_0x5ee307){if(_0x5ee307){return _0x5ee307[_0xc017('0x23')](_0x383cd4)['then'](function(_0x1334f3){return _0x1334f3;});}return null;};}function removeEntity(_0x51ab13,_0x1b2f24){return function(_0x1cbbc9){if(_0x1cbbc9){return _0x1cbbc9[_0xc017('0x24')]()['then'](function(){_0x51ab13['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eca27,_0x5f1127){return function(_0x8e55db){if(!_0x8e55db){_0x1eca27[_0xc017('0x25')](0x194);}return _0x8e55db;};}function handleError(_0x151efe,_0x4afd1d){_0x4afd1d=_0x4afd1d||0x1f4;return function(_0x718ee8){logger[_0xc017('0x26')](_0x718ee8[_0xc017('0x27')]);if(_0x718ee8[_0xc017('0x28')]){delete _0x718ee8['name'];}_0x151efe[_0xc017('0x17')](_0x4afd1d)[_0xc017('0x29')](_0x718ee8);};}exports[_0xc017('0x2a')]=function(_0x196ec7,_0x48b9ca){var _0x5c8a8c={},_0x16684c={},_0x2dd0d8={'count':0x0,'rows':[]};var _0x1cbba5=_['map'](db[_0xc017('0x2b')][_0xc017('0x2c')],function(_0x40a95c){return{'name':_0x40a95c['fieldName'],'type':_0x40a95c['type']['key']};});_0x16684c[_0xc017('0x2d')]=_[_0xc017('0x2e')](_0x1cbba5,_0xc017('0x28'));_0x16684c[_0xc017('0x2f')]=_[_0xc017('0x30')](_0x196ec7['query']);_0x16684c[_0xc017('0x31')]=_['intersection'](_0x16684c['model'],_0x16684c[_0xc017('0x2f')]);_0x5c8a8c[_0xc017('0x32')]=_[_0xc017('0x33')](_0x16684c[_0xc017('0x2d')],qs['fields'](_0x196ec7[_0xc017('0x2f')][_0xc017('0x34')]));_0x5c8a8c[_0xc017('0x32')]=_0x5c8a8c['attributes']['length']?_0x5c8a8c['attributes']:_0x16684c[_0xc017('0x2d')];if(!_0x196ec7[_0xc017('0x2f')]['hasOwnProperty']('nolimit')){_0x5c8a8c[_0xc017('0x1b')]=qs[_0xc017('0x1b')](_0x196ec7['query'][_0xc017('0x1b')]);_0x5c8a8c[_0xc017('0x1a')]=qs[_0xc017('0x1a')](_0x196ec7['query'][_0xc017('0x1a')]);}_0x5c8a8c['order']=qs['sort'](_0x196ec7[_0xc017('0x2f')][_0xc017('0x35')]);_0x5c8a8c[_0xc017('0x36')]=qs[_0xc017('0x31')](_[_0xc017('0x37')](_0x196ec7[_0xc017('0x2f')],_0x16684c[_0xc017('0x31')]),_0x1cbba5);if(_0x196ec7[_0xc017('0x2f')]['filter']){_0x5c8a8c['where']=_[_0xc017('0x38')](_0x5c8a8c[_0xc017('0x36')],{'$or':_[_0xc017('0x2e')](_0x1cbba5,function(_0x56ad8e){if(_0x56ad8e['type']!==_0xc017('0x39')){var _0x1b76b5={};_0x1b76b5[_0x56ad8e['name']]={'$like':'%'+_0x196ec7[_0xc017('0x2f')]['filter']+'%'};return _0x1b76b5;}})});}_0x5c8a8c=_[_0xc017('0x38')]({},_0x5c8a8c,_0x196ec7[_0xc017('0x3a')]);var _0x13aa67={'where':_0x5c8a8c[_0xc017('0x36')]};return db[_0xc017('0x2b')]['count'](_0x13aa67)[_0xc017('0x3b')](function(_0x30cd1c){_0x2dd0d8[_0xc017('0x1d')]=_0x30cd1c;if(_0x196ec7[_0xc017('0x2f')][_0xc017('0x3c')]){_0x5c8a8c[_0xc017('0x3d')]=[{'all':!![]}];}return db[_0xc017('0x2b')][_0xc017('0x3e')](_0x5c8a8c);})[_0xc017('0x3b')](function(_0x1a152c){_0x2dd0d8['rows']=_0x1a152c;return _0x2dd0d8;})[_0xc017('0x3b')](respondWithFilteredResult(_0x48b9ca,_0x5c8a8c))[_0xc017('0x3f')](handleError(_0x48b9ca,null));};exports['show']=function(_0x688092,_0x115b27){var _0x3a1ec6={'raw':![],'where':{'id':_0x688092[_0xc017('0x40')]['id']}},_0x327249={};_0x327249['model']=_[_0xc017('0x30')](db[_0xc017('0x2b')][_0xc017('0x2c')]);_0x327249[_0xc017('0x2f')]=_[_0xc017('0x30')](_0x688092[_0xc017('0x2f')]);_0x327249[_0xc017('0x31')]=_[_0xc017('0x33')](_0x327249[_0xc017('0x2d')],_0x327249['query']);_0x3a1ec6[_0xc017('0x32')]=_[_0xc017('0x33')](_0x327249[_0xc017('0x2d')],qs[_0xc017('0x34')](_0x688092[_0xc017('0x2f')][_0xc017('0x34')]));_0x3a1ec6[_0xc017('0x32')]=_0x3a1ec6[_0xc017('0x32')][_0xc017('0x41')]?_0x3a1ec6['attributes']:_0x327249[_0xc017('0x2d')];if(_0x688092[_0xc017('0x2f')][_0xc017('0x3c')]){_0x3a1ec6['include']=[{'all':!![]}];}_0x3a1ec6=_[_0xc017('0x38')]({},_0x3a1ec6,_0x688092['options']);return db[_0xc017('0x2b')][_0xc017('0x42')](_0x3a1ec6)[_0xc017('0x3b')](handleEntityNotFound(_0x115b27,null))[_0xc017('0x3b')](respondWithResult(_0x115b27,null))['catch'](handleError(_0x115b27,null));};exports[_0xc017('0x43')]=function(_0xdac4a5,_0x125259){return db[_0xc017('0x2b')][_0xc017('0x43')](_0xdac4a5[_0xc017('0x44')],{})[_0xc017('0x3b')](respondWithResult(_0x125259,0xc9))[_0xc017('0x3f')](handleError(_0x125259,null));};exports[_0xc017('0x23')]=function(_0x2e189b,_0x3c8d90){if(_0x2e189b['body']['id']){delete _0x2e189b[_0xc017('0x44')]['id'];}return db['Automation'][_0xc017('0x42')]({'where':{'id':_0x2e189b[_0xc017('0x40')]['id']}})[_0xc017('0x3b')](handleEntityNotFound(_0x3c8d90,null))[_0xc017('0x3b')](saveUpdates(_0x2e189b['body'],null))['then'](respondWithResult(_0x3c8d90,null))[_0xc017('0x3f')](handleError(_0x3c8d90,null));};exports[_0xc017('0x24')]=function(_0x4e7f31,_0x1fbc7a){return db[_0xc017('0x2b')][_0xc017('0x42')]({'where':{'id':_0x4e7f31['params']['id']}})[_0xc017('0x3b')](handleEntityNotFound(_0x1fbc7a,null))[_0xc017('0x3b')](removeEntity(_0x1fbc7a,null))[_0xc017('0x3f')](handleError(_0x1fbc7a,null));};exports[_0xc017('0x45')]=function(_0xb0f608,_0x38239f,_0x36b6ef){return db['Condition']['find']({'where':{'id':_0xb0f608['params']['id']}})['then'](handleEntityNotFound(_0x38239f,null))[_0xc017('0x3b')](function(_0x2685ff){if(_0x2685ff){return _0x2685ff[_0xc017('0x45')](_0xb0f608[_0xc017('0x44')]['ids'],_[_0xc017('0x46')](_0xb0f608[_0xc017('0x44')],[_0xc017('0x47'),'id'])||{});}})['then'](respondWithResult(_0x38239f,null))[_0xc017('0x3f')](handleError(_0x38239f,null));};exports[_0xc017('0x48')]=function(_0x55a187,_0x3c3341,_0x330606){var _0x213bd={};var _0x3b0c55={};var _0x44d86c;var _0x122e18;return db[_0xc017('0x2b')]['findOne']({'where':{'id':_0x55a187['params']['id']}})[_0xc017('0x3b')](handleEntityNotFound(_0x3c3341,null))[_0xc017('0x3b')](function(_0x43fd4c){if(_0x43fd4c){_0x44d86c=_0x43fd4c;_0x3b0c55['model']=_[_0xc017('0x30')](db[_0xc017('0x49')][_0xc017('0x2c')]);_0x3b0c55[_0xc017('0x2f')]=_[_0xc017('0x30')](_0x55a187[_0xc017('0x2f')]);_0x3b0c55[_0xc017('0x31')]=_[_0xc017('0x33')](_0x3b0c55[_0xc017('0x2d')],_0x3b0c55[_0xc017('0x2f')]);_0x213bd[_0xc017('0x32')]=_[_0xc017('0x33')](_0x3b0c55[_0xc017('0x2d')],qs[_0xc017('0x34')](_0x55a187[_0xc017('0x2f')][_0xc017('0x34')]));_0x213bd['attributes']=_0x213bd[_0xc017('0x32')][_0xc017('0x41')]?_0x213bd['attributes']:_0x3b0c55[_0xc017('0x2d')];_0x213bd['order']=qs[_0xc017('0x35')](_0x55a187['query'][_0xc017('0x35')]);_0x213bd['where']=qs[_0xc017('0x31')](_['pick'](_0x55a187[_0xc017('0x2f')],_0x3b0c55['filters']));if(_0x55a187[_0xc017('0x2f')][_0xc017('0x4a')]){_0x213bd[_0xc017('0x36')]=_[_0xc017('0x38')](_0x213bd['where'],{'$or':_[_0xc017('0x2e')](_0x213bd['attributes'],function(_0x460c19){var _0x4347f7={};_0x4347f7[_0x460c19]={'$like':'%'+_0x55a187['query']['filter']+'%'};return _0x4347f7;})});}_0x213bd=_[_0xc017('0x38')]({},_0x213bd,_0x55a187[_0xc017('0x3a')]);return _0x44d86c['getConditions'](_0x213bd);}})['then'](function(_0x13ee09){if(_0x13ee09){_0x122e18=_0x13ee09[_0xc017('0x41')];if(!_0x55a187['query'][_0xc017('0x4b')]('nolimit')){_0x213bd['limit']=qs[_0xc017('0x1b')](_0x55a187[_0xc017('0x2f')][_0xc017('0x1b')]);_0x213bd[_0xc017('0x1a')]=qs[_0xc017('0x1a')](_0x55a187[_0xc017('0x2f')][_0xc017('0x1a')]);}return _0x44d86c[_0xc017('0x48')](_0x213bd);}})[_0xc017('0x3b')](function(_0x70899a){if(_0x70899a){return _0x70899a?{'count':_0x122e18,'rows':_0x70899a}:null;}})[_0xc017('0x3b')](respondWithResult(_0x3c3341,null))[_0xc017('0x3f')](handleError(_0x3c3341,null));};exports[_0xc017('0x4c')]=function(_0x170126,_0x57d432,_0x22cca4){return db[_0xc017('0x4d')]['find']({'where':{'id':_0x170126[_0xc017('0x40')]['id']}})[_0xc017('0x3b')](handleEntityNotFound(_0x57d432,null))['then'](function(_0x3fb2b9){if(_0x3fb2b9){return _0x3fb2b9['addActions'](_0x170126['body']['ids'],_['omit'](_0x170126['body'],[_0xc017('0x47'),'id'])||{});}})[_0xc017('0x3b')](respondWithResult(_0x57d432,null))[_0xc017('0x3f')](handleError(_0x57d432,null));};exports[_0xc017('0x4e')]=function(_0x5d2a71,_0x3e74ab,_0x3fd8e9){var _0xbccd3a={};var _0x3c8e98={};var _0x1dea91;var _0x244d4f;return db[_0xc017('0x2b')][_0xc017('0x4f')]({'where':{'id':_0x5d2a71[_0xc017('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e74ab,null))[_0xc017('0x3b')](function(_0x26dc32){if(_0x26dc32){_0x1dea91=_0x26dc32;_0x3c8e98[_0xc017('0x2d')]=_['keys'](db[_0xc017('0x4d')][_0xc017('0x2c')]);_0x3c8e98[_0xc017('0x2f')]=_[_0xc017('0x30')](_0x5d2a71['query']);_0x3c8e98[_0xc017('0x31')]=_[_0xc017('0x33')](_0x3c8e98[_0xc017('0x2d')],_0x3c8e98[_0xc017('0x2f')]);_0xbccd3a['attributes']=_[_0xc017('0x33')](_0x3c8e98[_0xc017('0x2d')],qs['fields'](_0x5d2a71[_0xc017('0x2f')]['fields']));_0xbccd3a[_0xc017('0x32')]=_0xbccd3a[_0xc017('0x32')][_0xc017('0x41')]?_0xbccd3a['attributes']:_0x3c8e98[_0xc017('0x2d')];_0xbccd3a[_0xc017('0x50')]=qs[_0xc017('0x35')](_0x5d2a71[_0xc017('0x2f')][_0xc017('0x35')]);_0xbccd3a[_0xc017('0x36')]=qs[_0xc017('0x31')](_[_0xc017('0x37')](_0x5d2a71[_0xc017('0x2f')],_0x3c8e98['filters']));if(_0x5d2a71[_0xc017('0x2f')]['filter']){_0xbccd3a[_0xc017('0x36')]=_[_0xc017('0x38')](_0xbccd3a[_0xc017('0x36')],{'$or':_['map'](_0xbccd3a['attributes'],function(_0x5927ef){var _0x251470={};_0x251470[_0x5927ef]={'$like':'%'+_0x5d2a71['query'][_0xc017('0x4a')]+'%'};return _0x251470;})});}_0xbccd3a=_[_0xc017('0x38')]({},_0xbccd3a,_0x5d2a71[_0xc017('0x3a')]);return _0x1dea91[_0xc017('0x4e')](_0xbccd3a);}})['then'](function(_0x55fc89){if(_0x55fc89){_0x244d4f=_0x55fc89[_0xc017('0x41')];if(!_0x5d2a71['query']['hasOwnProperty'](_0xc017('0x51'))){_0xbccd3a[_0xc017('0x1b')]=qs[_0xc017('0x1b')](_0x5d2a71[_0xc017('0x2f')]['limit']);_0xbccd3a[_0xc017('0x1a')]=qs[_0xc017('0x1a')](_0x5d2a71[_0xc017('0x2f')]['offset']);}return _0x1dea91['getActions'](_0xbccd3a);}})['then'](function(_0x724831){if(_0x724831){return _0x724831?{'count':_0x244d4f,'rows':_0x724831}:null;}})[_0xc017('0x3b')](respondWithResult(_0x3e74ab,null))[_0xc017('0x3f')](handleError(_0x3e74ab,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 89d3bbe..b73fe54 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 _0xac06=['Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./automation.attributes','exports','define'];(function(_0x4ab311,_0x51ac35){var _0x2c56c0=function(_0x17186d){while(--_0x17186d){_0x4ab311['push'](_0x4ab311['shift']());}};_0x2c56c0(++_0x51ac35);}(_0xac06,0x147));var _0x6ac0=function(_0x32dee9,_0x1d1b20){_0x32dee9=_0x32dee9-0x0;var _0x12b69d=_0xac06[_0x32dee9];return _0x12b69d;};'use strict';var _=require(_0x6ac0('0x0'));var util=require(_0x6ac0('0x1'));var logger=require(_0x6ac0('0x2'))(_0x6ac0('0x3'));var moment=require(_0x6ac0('0x4'));var BPromise=require(_0x6ac0('0x5'));var rp=require(_0x6ac0('0x6'));var fs=require('fs');var path=require(_0x6ac0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ac0('0x8'));module[_0x6ac0('0x9')]=function(_0x428ce6,_0x5770a0){return _0x428ce6[_0x6ac0('0xa')](_0x6ac0('0xb'),attributes,{'tableName':_0x6ac0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce4b=['lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations'];(function(_0x7e2e19,_0x272911){var _0x9d32cb=function(_0x15ff1a){while(--_0x15ff1a){_0x7e2e19['push'](_0x7e2e19['shift']());}};_0x9d32cb(++_0x272911);}(_0xce4b,0x1d6));var _0xbce4=function(_0x4b3e12,_0x4a1bdc){_0x4b3e12=_0x4b3e12-0x0;var _0xec0991=_0xce4b[_0x4b3e12];return _0xec0991;};'use strict';var _=require(_0xbce4('0x0'));var util=require('util');var logger=require(_0xbce4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbce4('0x2'));var fs=require('fs');var path=require(_0xbce4('0x3'));var rimraf=require(_0xbce4('0x4'));var config=require(_0xbce4('0x5'));var attributes=require(_0xbce4('0x6'));module[_0xbce4('0x7')]=function(_0x3734b4,_0x47ff1f){return _0x3734b4[_0xbce4('0x8')]('Automation',attributes,{'tableName':_0xbce4('0x9'),'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 e437c88..ed9c77e 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 _0x9ab8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x9ab8,0x81));var _0x89ab=function(_0x5995e1,_0x5282b8){_0x5995e1=_0x5995e1-0x0;var _0x4a4f39=_0x9ab8[_0x5995e1];return _0x4a4f39;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a984,_0x3ecaa0,_0x366c32){return new BPromise(function(_0x5fd99f,_0x42da87){return client[_0x89ab('0xa')](_0x29a984,_0x366c32)[_0x89ab('0xb')](function(_0x36dc63){logger['info']('Automation,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3ecaa0,_0x89ab('0xc'),JSON[_0x89ab('0xd')](_0x36dc63));if(_0x36dc63[_0x89ab('0xe')]){if(_0x36dc63[_0x89ab('0xe')][_0x89ab('0xf')]===0x1f4){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x42da87(_0x36dc63[_0x89ab('0xe')][_0x89ab('0x11')]);}logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x5fd99f(_0x36dc63[_0x89ab('0xe')]['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');_0x5fd99f(_0x36dc63['result']['message']);}})[_0x89ab('0x12')](function(_0x1ce918){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x1ce918);_0x42da87(_0x1ce918);});});} \ No newline at end of file +var _0x349e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x349e,0xcb));var _0xe349=function(_0x40ad1d,_0x22e1e4){_0x40ad1d=_0x40ad1d-0x0;var _0x88ae7d=_0x349e[_0x40ad1d];return _0x88ae7d;};'use strict';var _=require(_0xe349('0x0'));var util=require(_0xe349('0x1'));var moment=require(_0xe349('0x2'));var BPromise=require(_0xe349('0x3'));var rs=require(_0xe349('0x4'));var fs=require('fs');var Redis=require(_0xe349('0x5'));var db=require(_0xe349('0x6'))['db'];var utils=require(_0xe349('0x7'));var logger=require(_0xe349('0x8'))('rpc');var config=require(_0xe349('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe349('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494605,_0xcb9b49,_0x6efb47){return new BPromise(function(_0x535968,_0x114c1b){return client[_0xe349('0xb')](_0x494605,_0x6efb47)[_0xe349('0xc')](function(_0x7b08d2){logger[_0xe349('0xd')]('Automation,\x20%s,\x20%s',_0xcb9b49,_0xe349('0xe'));logger[_0xe349('0xf')](_0xe349('0x10'),_0xcb9b49,_0xe349('0xe'),JSON[_0xe349('0x11')](_0x7b08d2));if(_0x7b08d2[_0xe349('0x12')]){if(_0x7b08d2[_0xe349('0x12')][_0xe349('0x13')]===0x1f4){logger[_0xe349('0x12')](_0xe349('0x14'),_0xcb9b49,_0x7b08d2[_0xe349('0x12')][_0xe349('0x15')]);return _0x114c1b(_0x7b08d2[_0xe349('0x12')][_0xe349('0x15')]);}logger[_0xe349('0x12')](_0xe349('0x14'),_0xcb9b49,_0x7b08d2[_0xe349('0x12')]['message']);return _0x535968(_0x7b08d2[_0xe349('0x12')]['message']);}else{logger[_0xe349('0xd')](_0xe349('0x14'),_0xcb9b49,_0xe349('0xe'));_0x535968(_0x7b08d2['result']['message']);}})[_0xe349('0x16')](function(_0x3ff17c){logger[_0xe349('0x12')](_0xe349('0x14'),_0xcb9b49,_0x3ff17c);_0x114c1b(_0x3ff17c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 101c8b6..f8a4925 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 _0xd33b=['/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd33b,0x1af));var _0xbd33=function(_0x5e20f3,_0x53bc46){_0x5e20f3=_0x5e20f3-0x0;var _0x3442ae=_0xd33b[_0x5e20f3];return _0x3442ae;};'use strict';var multer=require(_0xbd33('0x0'));var util=require(_0xbd33('0x1'));var path=require('path');var timeout=require(_0xbd33('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd33('0x3'));var interaction=require(_0xbd33('0x4'));var config=require('../../config/environment');var controller=require(_0xbd33('0x5'));router[_0xbd33('0x6')]('/',auth[_0xbd33('0x7')](),controller[_0xbd33('0x8')]);router['get'](_0xbd33('0x9'),auth['isAuthenticated'](),controller[_0xbd33('0xa')]);router[_0xbd33('0x6')](_0xbd33('0xb'),auth[_0xbd33('0x7')](),controller[_0xbd33('0xc')]);router[_0xbd33('0x6')](_0xbd33('0xd'),auth['isAuthenticated'](),controller[_0xbd33('0xe')]);router[_0xbd33('0xf')]('/',auth['isAuthenticated'](),controller[_0xbd33('0x10')]);router[_0xbd33('0xf')](_0xbd33('0xb'),auth['isAuthenticated'](),controller[_0xbd33('0x11')]);router[_0xbd33('0xf')](_0xbd33('0xd'),auth[_0xbd33('0x7')](),controller[_0xbd33('0x12')]);router[_0xbd33('0x13')](_0xbd33('0x9'),auth['isAuthenticated'](),controller[_0xbd33('0x14')]);router[_0xbd33('0x15')](_0xbd33('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeac6=['getActions','create','post','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xeac6,0xc0));var _0x6eac=function(_0x34785b,_0x503b3d){_0x34785b=_0x34785b-0x0;var _0x4f4d83=_0xeac6[_0x34785b];return _0x4f4d83;};'use strict';var multer=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var path=require(_0x6eac('0x2'));var timeout=require('connect-timeout');var express=require(_0x6eac('0x3'));var router=express[_0x6eac('0x4')]();var fs_extra=require(_0x6eac('0x5'));var auth=require(_0x6eac('0x6'));var interaction=require(_0x6eac('0x7'));var config=require(_0x6eac('0x8'));var controller=require(_0x6eac('0x9'));router[_0x6eac('0xa')]('/',auth[_0x6eac('0xb')](),controller[_0x6eac('0xc')]);router[_0x6eac('0xa')](_0x6eac('0xd'),auth['isAuthenticated'](),controller[_0x6eac('0xe')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller[_0x6eac('0xf')]);router[_0x6eac('0xa')]('/:id/actions',auth['isAuthenticated'](),controller[_0x6eac('0x10')]);router['post']('/',auth[_0x6eac('0xb')](),controller[_0x6eac('0x11')]);router[_0x6eac('0x12')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x6eac('0x13')]);router[_0x6eac('0x12')]('/:id/actions',auth[_0x6eac('0xb')](),controller[_0x6eac('0x14')]);router[_0x6eac('0x15')]('/:id',auth[_0x6eac('0xb')](),controller[_0x6eac('0x16')]);router[_0x6eac('0x17')](_0x6eac('0xd'),auth[_0x6eac('0xb')](),controller[_0x6eac('0x18')]);module[_0x6eac('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 8d59d3d..9bd8909 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 _0x834c=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','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\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x57a75f,_0x4c764d){var _0x1b7bda=function(_0x3d200e){while(--_0x3d200e){_0x57a75f['push'](_0x57a75f['shift']());}};_0x1b7bda(++_0x4c764d);}(_0x834c,0x73));var _0xc834=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x834c[_0x514c15];return _0x16283e;};'use strict';var Sequelize=require(_0xc834('0x0'));module[_0xc834('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc834('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc834('0x3')](_0xc834('0x4')),'allowNull':![],'defaultValue':_0xc834('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc834('0x5')],'defaultValue':0x0,'comment':_0xc834('0x6')},'limitCalls':{'type':Sequelize[_0xc834('0x7')](0x4)[_0xc834('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc834('0x9')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc834('0x9')]},'dialOriginateTimeout':{'type':Sequelize[_0xc834('0x7')](0x3)[_0xc834('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc834('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc834('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc834('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc834('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc834('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc834('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc834('0x7')](0x3)[_0xc834('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc834('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc834('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc834('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc834('0x9')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc834('0x9')],'defaultValue':_0xc834('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xc834('0x3')](_0xc834('0x10'),_0xc834('0x11'),'onlyIfOpen'),'defaultValue':_0xc834('0x10')},'dialAMDActive':{'type':Sequelize[_0xc834('0x5')],'defaultValue':0x0,'comment':_0xc834('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xc834('0x7')](0x9)[_0xc834('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc834('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc834('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc834('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc834('0x7')](0x9)[_0xc834('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc834('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc834('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc834('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xc834('0x7')](0x9)[_0xc834('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc834('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc834('0x7')](0x9)[_0xc834('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc834('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc834('0x7')](0x9)[_0xc834('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc834('0x7')](0x5)[_0xc834('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc834('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc834('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc834('0x3')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xc834('0x9')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xc834('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc834('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc834('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc834('0x7')](0x3)[_0xc834('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc834('0x7')](0x5)[_0xc834('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc834('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xc834('0x7')](0x3)[_0xc834('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc834('0x1c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc834('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc834('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc834('0x7')](0x3)[_0xc834('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc834('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc834('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc834('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc834('0x7')](0x5)[_0xc834('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc834('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc834('0x7')](0x3)[_0xc834('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc834('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc834('0x7')](0x5)[_0xc834('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x1021=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1021,0xaf));var _0x1102=function(_0x44198b,_0x4cedcc){_0x44198b=_0x44198b-0x0;var _0x28367c=_0x1021[_0x44198b];return _0x28367c;};'use strict';var Sequelize=require(_0x1102('0x0'));module[_0x1102('0x1')]={'name':{'type':Sequelize[_0x1102('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1102('0x3')](_0x1102('0x4')),'allowNull':![],'defaultValue':_0x1102('0x4')},'description':{'type':Sequelize[_0x1102('0x2')]},'active':{'type':Sequelize[_0x1102('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1102('0x6')](0x4)[_0x1102('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1102('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1102('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1102('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1102('0x6')](0x5)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1102('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1102('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1102('0x6')](0x5)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1102('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'defaultValue':0x3,'comment':_0x1102('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1102('0x6')](0x5)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1102('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1102('0xf')},'dialTimezone':{'type':Sequelize[_0x1102('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1102('0x2')],'defaultValue':_0x1102('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x1102('0x3')](_0x1102('0x11'),_0x1102('0x12'),_0x1102('0x13')),'defaultValue':_0x1102('0x11')},'dialAMDActive':{'type':Sequelize[_0x1102('0x5')],'defaultValue':0x0,'comment':_0x1102('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x1102('0x6')](0x9)[_0x1102('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1102('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x1102('0x6')](0x9)[_0x1102('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1102('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1102('0x6')](0x9)[_0x1102('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1102('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1102('0x6')](0x9)[_0x1102('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1102('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1102('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1102('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1102('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1102('0x6')](0x9)[_0x1102('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1102('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1102('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1102('0x6')](0x9)[_0x1102('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1102('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1102('0x3')](_0x1102('0x1c'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1102('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1102('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1102('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1102('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1102('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1102('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1102('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1102('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1102('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1102('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)[_0x1102('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1102('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1102('0x6')](0x5)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1102('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1102('0x6')](0x5)[_0x1102('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1102('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f067576..778566f 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 _0x565c=['save','update','destroy','then','IvrCampaigns','UserProfileResource','end','sendStatus','error','stack','name','send','map','Campaign','fieldName','type','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','intersection','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','omit','createdAt','updatedAt','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','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(?)','onlyIfOpen','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x484f58,_0x521a54){var _0x87ee76=function(_0x5290f7){while(--_0x5290f7){_0x484f58['push'](_0x484f58['shift']());}};_0x87ee76(++_0x521a54);}(_0x565c,0x73));var _0xc565=function(_0x47ec78,_0x9eadfa){_0x47ec78=_0x47ec78-0x0;var _0x1e032d=_0x565c[_0x47ec78];return _0x1e032d;};'use strict';var emlformat=require(_0xc565('0x0'));var rimraf=require(_0xc565('0x1'));var zipdir=require(_0xc565('0x2'));var jsonpatch=require(_0xc565('0x3'));var rp=require(_0xc565('0x4'));var moment=require(_0xc565('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc565('0x6'));var sox=require(_0xc565('0x7'));var csv=require(_0xc565('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc565('0x9'));var squel=require('squel');var crypto=require(_0xc565('0xa'));var jsforce=require(_0xc565('0xb'));var deskjs=require(_0xc565('0xc'));var toCsv=require(_0xc565('0x8'));var querystring=require(_0xc565('0xd'));var Papa=require(_0xc565('0xe'));var Redis=require('ioredis');var authService=require(_0xc565('0xf'));var qs=require(_0xc565('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc565('0x11'));var logger=require(_0xc565('0x12'))(_0xc565('0x13'));var utils=require(_0xc565('0x14'));var config=require(_0xc565('0x15'));var licenseUtil=require(_0xc565('0x16'));var db=require(_0xc565('0x17'))['db'];function respondWithStatusCode(_0x214f27,_0x3ca9a6){_0x3ca9a6=_0x3ca9a6||0xcc;return function(_0x54d900){if(_0x54d900){return _0x214f27['sendStatus'](_0x3ca9a6);}return _0x214f27['status'](_0x3ca9a6)['end']();};}function respondWithResult(_0x11853a,_0x26c026){_0x26c026=_0x26c026||0xc8;return function(_0x543d68){if(_0x543d68){return _0x11853a[_0xc565('0x18')](_0x26c026)[_0xc565('0x19')](_0x543d68);}};}function respondWithFilteredResult(_0x297d35,_0x200ebb){return function(_0x66c6cb){if(_0x66c6cb){var _0x11d3f1=typeof _0x200ebb[_0xc565('0x1a')]===_0xc565('0x1b')&&typeof _0x200ebb[_0xc565('0x1c')]===_0xc565('0x1b');var _0x1de92c=_0x66c6cb[_0xc565('0x1d')];var _0x16cabe=_0x11d3f1?0x0:_0x200ebb[_0xc565('0x1a')];var _0x275e7b=_0x11d3f1?_0x66c6cb['count']:_0x200ebb['offset']+_0x200ebb[_0xc565('0x1c')];var _0x3b88b4;if(_0x275e7b>=_0x1de92c){_0x275e7b=_0x1de92c;_0x3b88b4=0xc8;}else{_0x3b88b4=0xce;}_0x297d35[_0xc565('0x18')](_0x3b88b4);return _0x297d35[_0xc565('0x1e')]('Content-Range',_0x16cabe+'-'+_0x275e7b+'/'+_0x1de92c)[_0xc565('0x19')](_0x66c6cb);}return null;};}function patchUpdates(_0x166fa7){return function(_0x1ab8ec){try{jsonpatch[_0xc565('0x1f')](_0x1ab8ec,_0x166fa7,!![]);}catch(_0x4d6939){return BPromise[_0xc565('0x20')](_0x4d6939);}return _0x1ab8ec[_0xc565('0x21')]();};}function saveUpdates(_0x404b39,_0x43769e){return function(_0x36a386){if(_0x36a386){return _0x36a386[_0xc565('0x22')](_0x404b39)['then'](function(_0x4a2807){return _0x4a2807;});}return null;};}function removeEntity(_0xefedf6,_0x422a6c){return function(_0x2d91b0){if(_0x2d91b0){return _0x2d91b0[_0xc565('0x23')]()[_0xc565('0x24')](function(){var _0x4eee02=_0x2d91b0['get']({'plain':!![]});var _0x2d3961=_0xc565('0x25');return db[_0xc565('0x26')]['destroy']({'where':{'type':_0x2d3961,'resourceId':_0x4eee02['id']}})[_0xc565('0x24')](function(){return _0x2d91b0;});})[_0xc565('0x24')](function(){_0xefedf6[_0xc565('0x18')](0xcc)[_0xc565('0x27')]();});}};}function handleEntityNotFound(_0x175d05,_0x5722da){return function(_0x42a0c9){if(!_0x42a0c9){_0x175d05[_0xc565('0x28')](0x194);}return _0x42a0c9;};}function handleError(_0xf4272c,_0x512d68){_0x512d68=_0x512d68||0x1f4;return function(_0x2149ee){logger[_0xc565('0x29')](_0x2149ee[_0xc565('0x2a')]);if(_0x2149ee[_0xc565('0x2b')]){delete _0x2149ee[_0xc565('0x2b')];}_0xf4272c[_0xc565('0x18')](_0x512d68)[_0xc565('0x2c')](_0x2149ee);};}exports['index']=function(_0x3c2ed3,_0x1fd840){var _0x31f1c6={},_0x2553a5={},_0x2f8671={'count':0x0,'rows':[]};var _0x270b63=_[_0xc565('0x2d')](db[_0xc565('0x2e')]['rawAttributes'],function(_0x54d14e){return{'name':_0x54d14e[_0xc565('0x2f')],'type':_0x54d14e[_0xc565('0x30')]['key']};});_0x2553a5[_0xc565('0x31')]=_[_0xc565('0x2d')](_0x270b63,_0xc565('0x2b'));_0x2553a5[_0xc565('0x32')]=_[_0xc565('0x33')](_0x3c2ed3[_0xc565('0x32')]);_0x2553a5[_0xc565('0x34')]=_['intersection'](_0x2553a5[_0xc565('0x31')],_0x2553a5[_0xc565('0x32')]);_0x31f1c6[_0xc565('0x35')]=_['intersection'](_0x2553a5[_0xc565('0x31')],qs['fields'](_0x3c2ed3[_0xc565('0x32')]['fields']));_0x31f1c6[_0xc565('0x35')]=_0x31f1c6[_0xc565('0x35')][_0xc565('0x36')]?_0x31f1c6[_0xc565('0x35')]:_0x2553a5[_0xc565('0x31')];if(!_0x3c2ed3[_0xc565('0x32')][_0xc565('0x37')](_0xc565('0x38'))){_0x31f1c6[_0xc565('0x1c')]=qs['limit'](_0x3c2ed3[_0xc565('0x32')][_0xc565('0x1c')]);_0x31f1c6[_0xc565('0x1a')]=qs[_0xc565('0x1a')](_0x3c2ed3[_0xc565('0x32')][_0xc565('0x1a')]);}_0x31f1c6[_0xc565('0x39')]=qs['sort'](_0x3c2ed3['query'][_0xc565('0x3a')]);_0x31f1c6[_0xc565('0x3b')]=qs[_0xc565('0x34')](_[_0xc565('0x3c')](_0x3c2ed3[_0xc565('0x32')],_0x2553a5[_0xc565('0x34')]),_0x270b63);if(_0x3c2ed3[_0xc565('0x32')]['filter']){_0x31f1c6[_0xc565('0x3b')]=_['merge'](_0x31f1c6[_0xc565('0x3b')],{'$or':_[_0xc565('0x2d')](_0x270b63,function(_0xe43c87){if(_0xe43c87['type']!=='VIRTUAL'){var _0x197419={};_0x197419[_0xe43c87[_0xc565('0x2b')]]={'$like':'%'+_0x3c2ed3[_0xc565('0x32')][_0xc565('0x3d')]+'%'};return _0x197419;}})});}_0x31f1c6=_[_0xc565('0x3e')]({},_0x31f1c6,_0x3c2ed3[_0xc565('0x3f')]);var _0x2fa276={'where':_0x31f1c6[_0xc565('0x3b')]};return db['Campaign'][_0xc565('0x1d')](_0x2fa276)[_0xc565('0x24')](function(_0x3fd0ad){_0x2f8671[_0xc565('0x1d')]=_0x3fd0ad;if(_0x3c2ed3[_0xc565('0x32')][_0xc565('0x40')]){_0x31f1c6[_0xc565('0x41')]=[{'all':!![]}];}return db['Campaign'][_0xc565('0x42')](_0x31f1c6);})[_0xc565('0x24')](function(_0x533793){_0x2f8671['rows']=_0x533793;return _0x2f8671;})[_0xc565('0x24')](respondWithFilteredResult(_0x1fd840,_0x31f1c6))['catch'](handleError(_0x1fd840,null));};exports[_0xc565('0x43')]=function(_0x43af71,_0x1f898e){var _0x18e4cb={'raw':![],'where':{'id':_0x43af71[_0xc565('0x44')]['id']}},_0x1e4810={};_0x1e4810[_0xc565('0x31')]=_['keys'](db['Campaign'][_0xc565('0x45')]);_0x1e4810[_0xc565('0x32')]=_[_0xc565('0x33')](_0x43af71[_0xc565('0x32')]);_0x1e4810['filters']=_[_0xc565('0x46')](_0x1e4810[_0xc565('0x31')],_0x1e4810[_0xc565('0x32')]);_0x18e4cb[_0xc565('0x35')]=_[_0xc565('0x46')](_0x1e4810[_0xc565('0x31')],qs[_0xc565('0x47')](_0x43af71['query'][_0xc565('0x47')]));_0x18e4cb[_0xc565('0x35')]=_0x18e4cb[_0xc565('0x35')][_0xc565('0x36')]?_0x18e4cb[_0xc565('0x35')]:_0x1e4810['model'];if(_0x43af71['query'][_0xc565('0x40')]){_0x18e4cb[_0xc565('0x41')]=[{'all':!![]}];}_0x18e4cb=_['merge']({},_0x18e4cb,_0x43af71[_0xc565('0x3f')]);return db[_0xc565('0x2e')][_0xc565('0x48')](_0x18e4cb)[_0xc565('0x24')](handleEntityNotFound(_0x1f898e,null))[_0xc565('0x24')](respondWithResult(_0x1f898e,null))['catch'](handleError(_0x1f898e,null));};exports['create']=function(_0x42b435,_0x296816){return db['Campaign'][_0xc565('0x49')](_0x42b435[_0xc565('0x4a')],{})[_0xc565('0x24')](function(_0x329615){var _0x3bdb55=_0x42b435[_0xc565('0x4b')][_0xc565('0x4c')]({'plain':!![]});if(!_0x3bdb55)throw new Error(_0xc565('0x4d'));if(_0x3bdb55['role']===_0xc565('0x4b')){var _0x4f4f7d=_0x329615['get']({'plain':!![]});var _0x21128d=_0xc565('0x25');return db[_0xc565('0x4e')]['find']({'where':{'name':_0x21128d,'userProfileId':_0x3bdb55[_0xc565('0x4f')]},'raw':!![]})[_0xc565('0x24')](function(_0x5d93f7){if(_0x5d93f7&&_0x5d93f7[_0xc565('0x50')]===0x0){return db[_0xc565('0x26')][_0xc565('0x49')]({'name':_0x4f4f7d['name'],'resourceId':_0x4f4f7d['id'],'type':_0x5d93f7[_0xc565('0x2b')],'sectionId':_0x5d93f7['id']},{})[_0xc565('0x24')](function(){return _0x329615;});}else{return _0x329615;}})['catch'](function(_0x39267f){logger[_0xc565('0x29')](_0xc565('0x51'),_0x39267f);throw _0x39267f;});}return _0x329615;})['then'](respondWithResult(_0x296816,0xc9))[_0xc565('0x52')](handleError(_0x296816,null));};exports[_0xc565('0x53')]=function(_0x3c4b60,_0x315ee4){var _0x3505b5={'where':{'id':_0x3c4b60['params']['id']}},_0x13d28c={};_0x13d28c[_0xc565('0x31')]=_[_0xc565('0x33')](db[_0xc565('0x2e')][_0xc565('0x45')]);_0x3505b5[_0xc565('0x35')]=_[_0xc565('0x46')](_0x13d28c[_0xc565('0x31')],qs[_0xc565('0x47')](_0x3c4b60[_0xc565('0x32')][_0xc565('0x47')]));_0x3505b5[_0xc565('0x35')]=_0x3505b5['attributes'][_0xc565('0x36')]?_0x3505b5[_0xc565('0x35')]:_0x13d28c[_0xc565('0x31')];if(_0x3c4b60[_0xc565('0x32')][_0xc565('0x40')]){_0x3505b5['include']=[{'all':!![]}];}_0x3505b5=_[_0xc565('0x3e')]({},_0x3505b5,_0x3c4b60[_0xc565('0x3f')]);return db['Campaign'][_0xc565('0x48')](_0x3505b5)[_0xc565('0x24')](handleEntityNotFound(_0x315ee4,null))[_0xc565('0x24')](function(_0x571b62){if(_0x571b62){var _0x54c02a=_0x571b62[_0xc565('0x4c')]({'plain':!![]});_0x54c02a=qs[_0xc565('0x54')](_0x54c02a,['id',_0xc565('0x55'),'updatedAt']);_0x3c4b60[_0xc565('0x4a')]=_[_0xc565('0x54')](_0x3c4b60[_0xc565('0x4a')],['id',_0xc565('0x55'),_0xc565('0x56')]);return db[_0xc565('0x2e')][_0xc565('0x49')](_['merge'](_0x54c02a,_0x3c4b60['body']),{'include':_0x3c4b60[_0xc565('0x32')][_0xc565('0x40')]?[{'all':!![]}]:undefined})[_0xc565('0x24')](function(_0x2b9bd7){var _0x11210f=_0x3c4b60[_0xc565('0x4b')][_0xc565('0x4c')]({'plain':!![]});if(!_0x11210f)throw new Error(_0xc565('0x4d'));if(_0x11210f['role']===_0xc565('0x4b')){var _0x51e40c=_0x2b9bd7[_0xc565('0x4c')]({'plain':!![]});var _0x240fbd=_0xc565('0x25');return db['UserProfileSection'][_0xc565('0x48')]({'where':{'name':_0x240fbd,'userProfileId':_0x11210f[_0xc565('0x4f')]},'raw':!![]})[_0xc565('0x24')](function(_0x32b4f1){if(_0x32b4f1&&_0x32b4f1[_0xc565('0x50')]===0x0){return db[_0xc565('0x26')][_0xc565('0x49')]({'name':_0x51e40c[_0xc565('0x2b')],'resourceId':_0x51e40c['id'],'type':_0x32b4f1[_0xc565('0x2b')],'sectionId':_0x32b4f1['id']},{})[_0xc565('0x24')](function(){return _0x2b9bd7;});}else{return _0x2b9bd7;}})[_0xc565('0x52')](function(_0x7537be){logger['error'](_0xc565('0x51'),_0x7537be);throw _0x7537be;});}return _0x2b9bd7;});}})['then'](respondWithResult(_0x315ee4,0xc9))[_0xc565('0x52')](handleError(_0x315ee4,null));};exports[_0xc565('0x22')]=function(_0x4d1a01,_0x49cb51){if(_0x4d1a01['body']['id']){delete _0x4d1a01[_0xc565('0x4a')]['id'];}return db[_0xc565('0x2e')][_0xc565('0x48')]({'where':{'id':_0x4d1a01[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x49cb51,null))['then'](saveUpdates(_0x4d1a01[_0xc565('0x4a')],null))[_0xc565('0x24')](respondWithResult(_0x49cb51,null))[_0xc565('0x52')](handleError(_0x49cb51,null));};exports['destroy']=function(_0x425e1c,_0x425a9c){return db[_0xc565('0x2e')][_0xc565('0x48')]({'where':{'id':_0x425e1c['params']['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x425a9c,null))['then'](removeEntity(_0x425a9c,null))['catch'](handleError(_0x425a9c,null));};exports['getHoppers']=function(_0x47004b,_0x5d8233,_0x233a16){var _0x37a93c={'raw':!![],'where':{}};var _0x3f7dd0={};var _0x1e1e75={'count':0x0,'rows':[]};return db[_0xc565('0x2e')][_0xc565('0x57')]({'where':{'id':_0x47004b[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x5d8233,null))[_0xc565('0x24')](function(_0x28b54e){if(_0x28b54e){_0x3f7dd0['model']=_[_0xc565('0x33')](db[_0xc565('0x58')][_0xc565('0x45')]);_0x3f7dd0[_0xc565('0x32')]=_['keys'](_0x47004b[_0xc565('0x32')]);_0x3f7dd0[_0xc565('0x34')]=_['intersection'](_0x3f7dd0[_0xc565('0x31')],_0x3f7dd0[_0xc565('0x32')]);_0x37a93c[_0xc565('0x35')]=_[_0xc565('0x46')](_0x3f7dd0[_0xc565('0x31')],qs[_0xc565('0x47')](_0x47004b['query'][_0xc565('0x47')]));_0x37a93c[_0xc565('0x35')]=_0x37a93c[_0xc565('0x35')][_0xc565('0x36')]?_0x37a93c[_0xc565('0x35')]:_0x3f7dd0['model'];if(!_0x47004b[_0xc565('0x32')]['hasOwnProperty']('nolimit')){_0x37a93c['limit']=qs['limit'](_0x47004b['query']['limit']);_0x37a93c['offset']=qs['offset'](_0x47004b[_0xc565('0x32')][_0xc565('0x1a')]);}_0x37a93c[_0xc565('0x39')]=qs[_0xc565('0x3a')](_0x47004b[_0xc565('0x32')][_0xc565('0x3a')]);_0x37a93c[_0xc565('0x3b')]=qs[_0xc565('0x34')](_[_0xc565('0x3c')](_0x47004b[_0xc565('0x32')],_0x3f7dd0[_0xc565('0x34')]));_0x37a93c[_0xc565('0x3b')][_0xc565('0x59')]=_0x28b54e['id'];if(_0x47004b['query'][_0xc565('0x3d')]){_0x37a93c[_0xc565('0x3b')]=_['merge'](_0x37a93c[_0xc565('0x3b')],{'$or':_[_0xc565('0x2d')](_0x37a93c[_0xc565('0x35')],function(_0x5e8b12){var _0x8dff3e={};_0x8dff3e[_0x5e8b12]={'$like':'%'+_0x47004b[_0xc565('0x32')]['filter']+'%'};return _0x8dff3e;})});}_0x37a93c=_['merge']({},_0x37a93c,_0x47004b[_0xc565('0x3f')]);return db[_0xc565('0x58')]['count']({'where':_0x37a93c[_0xc565('0x3b')]})[_0xc565('0x24')](function(_0x27f5d9){_0x1e1e75['count']=_0x27f5d9;if(_0x47004b[_0xc565('0x32')][_0xc565('0x40')]){_0x37a93c[_0xc565('0x41')]=[{'all':!![]}];}return db[_0xc565('0x58')][_0xc565('0x42')](_0x37a93c);})[_0xc565('0x24')](function(_0x4a816b){_0x1e1e75['rows']=_0x4a816b;return _0x1e1e75;});}})[_0xc565('0x24')](respondWithFilteredResult(_0x5d8233,_0x37a93c))[_0xc565('0x52')](handleError(_0x5d8233,null));};exports[_0xc565('0x5a')]=function(_0x25a42c,_0x1c42e7,_0x115de6){var _0x5ec2e0={'raw':!![],'where':{}};var _0x519e44={};var _0x194202={'count':0x0,'rows':[]};return db[_0xc565('0x2e')][_0xc565('0x57')]({'where':{'id':_0x25a42c[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x1c42e7,null))['then'](function(_0xc99864){if(_0xc99864){_0x519e44[_0xc565('0x31')]=_[_0xc565('0x33')](db[_0xc565('0x5b')]['rawAttributes']);_0x519e44[_0xc565('0x32')]=_['keys'](_0x25a42c[_0xc565('0x32')]);_0x519e44[_0xc565('0x34')]=_['intersection'](_0x519e44[_0xc565('0x31')],_0x519e44[_0xc565('0x32')]);_0x5ec2e0[_0xc565('0x35')]=_[_0xc565('0x46')](_0x519e44[_0xc565('0x31')],qs['fields'](_0x25a42c[_0xc565('0x32')]['fields']));_0x5ec2e0[_0xc565('0x35')]=_0x5ec2e0['attributes']['length']?_0x5ec2e0[_0xc565('0x35')]:_0x519e44[_0xc565('0x31')];if(!_0x25a42c[_0xc565('0x32')][_0xc565('0x37')]('nolimit')){_0x5ec2e0[_0xc565('0x1c')]=qs['limit'](_0x25a42c[_0xc565('0x32')]['limit']);_0x5ec2e0[_0xc565('0x1a')]=qs[_0xc565('0x1a')](_0x25a42c[_0xc565('0x32')][_0xc565('0x1a')]);}_0x5ec2e0[_0xc565('0x39')]=qs['sort'](_0x25a42c['query'][_0xc565('0x3a')]);_0x5ec2e0['where']=qs[_0xc565('0x34')](_[_0xc565('0x3c')](_0x25a42c['query'],_0x519e44[_0xc565('0x34')]));_0x5ec2e0[_0xc565('0x3b')][_0xc565('0x59')]=_0xc99864['id'];if(_0x25a42c[_0xc565('0x32')][_0xc565('0x3d')]){_0x5ec2e0[_0xc565('0x3b')]=_[_0xc565('0x3e')](_0x5ec2e0[_0xc565('0x3b')],{'$or':_['map'](_0x5ec2e0[_0xc565('0x35')],function(_0x234a51){var _0x4c74e5={};_0x4c74e5[_0x234a51]={'$like':'%'+_0x25a42c[_0xc565('0x32')][_0xc565('0x3d')]+'%'};return _0x4c74e5;})});}_0x5ec2e0=_[_0xc565('0x3e')]({},_0x5ec2e0,_0x25a42c[_0xc565('0x3f')]);return db[_0xc565('0x5b')][_0xc565('0x1d')]({'where':_0x5ec2e0[_0xc565('0x3b')]})[_0xc565('0x24')](function(_0x735821){_0x194202[_0xc565('0x1d')]=_0x735821;if(_0x25a42c[_0xc565('0x32')][_0xc565('0x40')]){_0x5ec2e0[_0xc565('0x41')]=[{'all':!![]}];}return db[_0xc565('0x5b')][_0xc565('0x42')](_0x5ec2e0);})[_0xc565('0x24')](function(_0x32c630){_0x194202[_0xc565('0x5c')]=_0x32c630;return _0x194202;});}})['then'](respondWithFilteredResult(_0x1c42e7,_0x5ec2e0))['catch'](handleError(_0x1c42e7,null));};exports[_0xc565('0x5d')]=function(_0x3a2217,_0xaf4f7f,_0x2b4fb2){var _0x454664={'raw':!![],'where':{}};var _0x3f083d={};var _0x10e7b4={'count':0x0,'rows':[]};return db[_0xc565('0x2e')]['findOne']({'where':{'id':_0x3a2217['params']['id']}})[_0xc565('0x24')](handleEntityNotFound(_0xaf4f7f,null))['then'](function(_0x312027){if(_0x312027){_0x3f083d[_0xc565('0x31')]=_[_0xc565('0x33')](db['CmHopperFinal'][_0xc565('0x45')]);_0x3f083d[_0xc565('0x32')]=_[_0xc565('0x33')](_0x3a2217[_0xc565('0x32')]);_0x3f083d[_0xc565('0x34')]=_[_0xc565('0x46')](_0x3f083d[_0xc565('0x31')],_0x3f083d[_0xc565('0x32')]);_0x454664[_0xc565('0x35')]=_[_0xc565('0x46')](_0x3f083d[_0xc565('0x31')],qs[_0xc565('0x47')](_0x3a2217['query']['fields']));_0x454664[_0xc565('0x35')]=_0x454664[_0xc565('0x35')][_0xc565('0x36')]?_0x454664[_0xc565('0x35')]:_0x3f083d[_0xc565('0x31')];if(!_0x3a2217[_0xc565('0x32')][_0xc565('0x37')](_0xc565('0x38'))){_0x454664[_0xc565('0x1c')]=qs[_0xc565('0x1c')](_0x3a2217[_0xc565('0x32')][_0xc565('0x1c')]);_0x454664[_0xc565('0x1a')]=qs['offset'](_0x3a2217['query'][_0xc565('0x1a')]);}_0x454664['order']=qs[_0xc565('0x3a')](_0x3a2217[_0xc565('0x32')]['sort']);_0x454664[_0xc565('0x3b')]=qs[_0xc565('0x34')](_['pick'](_0x3a2217[_0xc565('0x32')],_0x3f083d[_0xc565('0x34')]));_0x454664['where'][_0xc565('0x59')]=_0x312027['id'];if(_0x3a2217[_0xc565('0x32')][_0xc565('0x3d')]){_0x454664[_0xc565('0x3b')]=_[_0xc565('0x3e')](_0x454664[_0xc565('0x3b')],{'$or':_[_0xc565('0x2d')](_0x454664[_0xc565('0x35')],function(_0x2326fa){var _0x75b9f3={};_0x75b9f3[_0x2326fa]={'$like':'%'+_0x3a2217['query']['filter']+'%'};return _0x75b9f3;})});}_0x454664=_[_0xc565('0x3e')]({},_0x454664,_0x3a2217[_0xc565('0x3f')]);return db[_0xc565('0x5e')]['count']({'where':_0x454664[_0xc565('0x3b')]})[_0xc565('0x24')](function(_0x4131f6){_0x10e7b4[_0xc565('0x1d')]=_0x4131f6;if(_0x3a2217[_0xc565('0x32')][_0xc565('0x40')]){_0x454664['include']=[{'all':!![]}];}return db[_0xc565('0x5e')][_0xc565('0x42')](_0x454664);})['then'](function(_0x1d7106){_0x10e7b4[_0xc565('0x5c')]=_0x1d7106;return _0x10e7b4;});}})[_0xc565('0x24')](respondWithFilteredResult(_0xaf4f7f,_0x454664))[_0xc565('0x52')](handleError(_0xaf4f7f,null));};exports[_0xc565('0x5f')]=function(_0x31c579,_0x43f0b3,_0x115a26){var _0x5bc838={'raw':!![],'where':{}};var _0x353d6e={};var _0x146a9c={'count':0x0,'rows':[]};return db[_0xc565('0x2e')]['findOne']({'where':{'id':_0x31c579[_0xc565('0x44')]['id']}})['then'](handleEntityNotFound(_0x43f0b3,null))[_0xc565('0x24')](function(_0x24509f){if(_0x24509f){_0x353d6e[_0xc565('0x31')]=_['keys'](db[_0xc565('0x60')][_0xc565('0x45')]);_0x353d6e[_0xc565('0x32')]=_[_0xc565('0x33')](_0x31c579[_0xc565('0x32')]);_0x353d6e['filters']=_['intersection'](_0x353d6e[_0xc565('0x31')],_0x353d6e[_0xc565('0x32')]);_0x5bc838[_0xc565('0x35')]=_[_0xc565('0x46')](_0x353d6e[_0xc565('0x31')],qs[_0xc565('0x47')](_0x31c579[_0xc565('0x32')][_0xc565('0x47')]));_0x5bc838[_0xc565('0x35')]=_0x5bc838['attributes'][_0xc565('0x36')]?_0x5bc838['attributes']:_0x353d6e['model'];if(!_0x31c579['query'][_0xc565('0x37')]('nolimit')){_0x5bc838[_0xc565('0x1c')]=qs[_0xc565('0x1c')](_0x31c579['query'][_0xc565('0x1c')]);_0x5bc838[_0xc565('0x1a')]=qs['offset'](_0x31c579[_0xc565('0x32')][_0xc565('0x1a')]);}_0x5bc838[_0xc565('0x39')]=qs['sort'](_0x31c579['query'][_0xc565('0x3a')]);_0x5bc838[_0xc565('0x3b')]=qs[_0xc565('0x34')](_[_0xc565('0x3c')](_0x31c579[_0xc565('0x32')],_0x353d6e[_0xc565('0x34')]));_0x5bc838[_0xc565('0x3b')]['CampaignId']=_0x24509f['id'];if(_0x31c579[_0xc565('0x32')][_0xc565('0x3d')]){_0x5bc838['where']=_[_0xc565('0x3e')](_0x5bc838[_0xc565('0x3b')],{'$or':_['map'](_0x5bc838[_0xc565('0x35')],function(_0x1711e2){var _0x5e1a86={};_0x5e1a86[_0x1711e2]={'$like':'%'+_0x31c579[_0xc565('0x32')]['filter']+'%'};return _0x5e1a86;})});}_0x5bc838=_[_0xc565('0x3e')]({},_0x5bc838,_0x31c579['options']);return db[_0xc565('0x60')][_0xc565('0x1d')]({'where':_0x5bc838[_0xc565('0x3b')]})[_0xc565('0x24')](function(_0x38d32c){_0x146a9c['count']=_0x38d32c;if(_0x31c579[_0xc565('0x32')][_0xc565('0x40')]){_0x5bc838[_0xc565('0x41')]=[{'all':!![]}];}return db[_0xc565('0x60')]['findAll'](_0x5bc838);})[_0xc565('0x24')](function(_0xcb16e){_0x146a9c[_0xc565('0x5c')]=_0xcb16e;return _0x146a9c;});}})['then'](respondWithFilteredResult(_0x43f0b3,_0x5bc838))[_0xc565('0x52')](handleError(_0x43f0b3,null));};exports['getLists']=function(_0x337bb9,_0x54dfb4,_0x426ea8){var _0x201b2e={};var _0x358407={};var _0x2446cb;var _0x8f9f02;return db[_0xc565('0x2e')][_0xc565('0x57')]({'where':{'id':_0x337bb9[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x54dfb4,null))[_0xc565('0x24')](function(_0x36cd5c){if(_0x36cd5c){_0x2446cb=_0x36cd5c;_0x358407['model']=_[_0xc565('0x33')](db[_0xc565('0x61')]['rawAttributes']);_0x358407[_0xc565('0x32')]=_['keys'](_0x337bb9[_0xc565('0x32')]);_0x358407[_0xc565('0x34')]=_[_0xc565('0x46')](_0x358407['model'],_0x358407['query']);_0x201b2e[_0xc565('0x35')]=_[_0xc565('0x46')](_0x358407['model'],qs[_0xc565('0x47')](_0x337bb9['query']['fields']));_0x201b2e[_0xc565('0x35')]=_0x201b2e[_0xc565('0x35')]['length']?_0x201b2e['attributes']:_0x358407[_0xc565('0x31')];_0x201b2e['order']=qs[_0xc565('0x3a')](_0x337bb9[_0xc565('0x32')][_0xc565('0x3a')]);_0x201b2e[_0xc565('0x3b')]=qs[_0xc565('0x34')](_['pick'](_0x337bb9[_0xc565('0x32')],_0x358407[_0xc565('0x34')]));if(_0x337bb9['query'][_0xc565('0x3d')]){_0x201b2e['where']=_[_0xc565('0x3e')](_0x201b2e[_0xc565('0x3b')],{'$or':_['map'](_0x201b2e[_0xc565('0x35')],function(_0x4180dc){var _0x50938f={};_0x50938f[_0x4180dc]={'$like':'%'+_0x337bb9['query'][_0xc565('0x3d')]+'%'};return _0x50938f;})});}_0x201b2e=_[_0xc565('0x3e')]({},_0x201b2e,_0x337bb9[_0xc565('0x3f')]);return _0x2446cb[_0xc565('0x62')](_0x201b2e);}})['then'](function(_0x70a69d){if(_0x70a69d){_0x8f9f02=_0x70a69d[_0xc565('0x36')];if(!_0x337bb9[_0xc565('0x32')][_0xc565('0x37')](_0xc565('0x38'))){_0x201b2e[_0xc565('0x1c')]=qs[_0xc565('0x1c')](_0x337bb9[_0xc565('0x32')]['limit']);_0x201b2e[_0xc565('0x1a')]=qs[_0xc565('0x1a')](_0x337bb9[_0xc565('0x32')]['offset']);}return _0x2446cb[_0xc565('0x62')](_0x201b2e);}})['then'](function(_0x29c54b){if(_0x29c54b){return _0x29c54b?{'count':_0x8f9f02,'rows':_0x29c54b}:null;}})[_0xc565('0x24')](respondWithResult(_0x54dfb4,null))[_0xc565('0x52')](handleError(_0x54dfb4,null));};exports[_0xc565('0x63')]=function(_0x1ee4d6,_0x21f094,_0x15a7f8){var _0x3f5685,_0x1721e4;var _0xd3059e=[];var _0x58f233=moment()[_0xc565('0x64')](_0xc565('0x65'));return db[_0xc565('0x2e')][_0xc565('0x48')]({'where':{'id':_0x1ee4d6[_0xc565('0x44')]['id']}})['then'](handleEntityNotFound(_0x21f094,null))[_0xc565('0x24')](function(_0x5d1787){if(_0x5d1787){_0x1721e4=_0x5d1787;return _0x5d1787[_0xc565('0x63')](_0x1ee4d6[_0xc565('0x4a')][_0xc565('0x66')],_[_0xc565('0x54')](_0x1ee4d6[_0xc565('0x4a')],[_0xc565('0x66'),'id'])||{});}return null;})[_0xc565('0x67')](function(_0x3f6764){var _0x17dda1;var _0x44ed4e;_0x3f5685=_0x3f6764||[];var _0x504a6c=[];if(_0x3f6764){for(var _0x1e1598=0x0;_0x1e1598<_0x3f6764[_0xc565('0x36')];_0x1e1598+=0x1){var _0x1fc403=_0x3f6764[_0x1e1598][_0xc565('0x4c')]({'plain':!![]});_0x1721e4[_0xc565('0x68')]=_0x1ee4d6[_0xc565('0x4a')][_0xc565('0x68')]?_0x1ee4d6['body'][_0xc565('0x68')]:_0x1721e4['dialCheckDuplicateType'];switch(_0x1721e4[_0xc565('0x68')]){case _0xc565('0x69'):_0x17dda1=squel[_0xc565('0x6a')]()[_0xc565('0x6b')](_0xc565('0x6c'))[_0xc565('0x6d')]([_0xc565('0x6e'),_0xc565('0x6f'),_0xc565('0x70'),_0xc565('0x71'),'CampaignId',_0xc565('0x55'),_0xc565('0x56')],squel[_0xc565('0x72')]()[_0xc565('0x73')]('phone','phone')['field'](_0xc565('0x74'),_0xc565('0x6f'))['field']('id',_0xc565('0x70'))[_0xc565('0x73')](_0x1fc403[_0xc565('0x75')][_0xc565('0x76')](),_0xc565('0x71'))[_0xc565('0x73')](_0x1ee4d6['params']['id']['toString'](),_0xc565('0x59'))[_0xc565('0x73')]('\x27'+_0x58f233+'\x27','createdAt')['field']('\x27'+_0x58f233+'\x27',_0xc565('0x56'))[_0xc565('0x77')](_0xc565('0x78'))[_0xc565('0x3b')](_0xc565('0x79'))[_0xc565('0x3b')](_0xc565('0x7a'),_0x1fc403['CmListId'][_0xc565('0x76')]())['where'](_0xc565('0x7b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xc565('0x72')]()[_0xc565('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0xc565('0x77')](_0xc565('0x7c'))['where'](_0xc565('0x7d'),_0x1ee4d6[_0xc565('0x44')]['id'][_0xc565('0x76')]()))[_0xc565('0x3b')](_0xc565('0x7e'),squel['select']()[_0xc565('0x73')]('COALESCE(phone,\x27\x27)')[_0xc565('0x77')](_0xc565('0x6c'))[_0xc565('0x3b')](_0xc565('0x7d'),_0x1ee4d6['params']['id'][_0xc565('0x76')]())))[_0xc565('0x76')]();break;case _0xc565('0x7f'):_0x17dda1=squel['insert']()[_0xc565('0x6b')](_0xc565('0x6c'))[_0xc565('0x6d')]([_0xc565('0x6e'),_0xc565('0x6f'),_0xc565('0x70'),_0xc565('0x71'),_0xc565('0x59'),_0xc565('0x55'),_0xc565('0x56')],squel[_0xc565('0x72')]()[_0xc565('0x73')](_0xc565('0x6e'),_0xc565('0x6e'))[_0xc565('0x73')]('NOW()',_0xc565('0x6f'))[_0xc565('0x73')]('id',_0xc565('0x70'))[_0xc565('0x73')](_0x1fc403['CmListId']['toString'](),'ListId')[_0xc565('0x73')](_0x1ee4d6['params']['id']['toString'](),'CampaignId')[_0xc565('0x73')]('\x27'+_0x58f233+'\x27',_0xc565('0x55'))[_0xc565('0x73')]('\x27'+_0x58f233+'\x27',_0xc565('0x56'))[_0xc565('0x77')]('cm_contacts')['where'](_0xc565('0x79'))[_0xc565('0x3b')](_0xc565('0x7a'),_0x1fc403[_0xc565('0x75')][_0xc565('0x76')]())[_0xc565('0x3b')](_0xc565('0x7b'))[_0xc565('0x3b')](_0xc565('0x7e'),squel['select']()['field'](_0xc565('0x80'))[_0xc565('0x77')](_0xc565('0x6c'))['where'](_0xc565('0x7d'),_0x1ee4d6['params']['id'][_0xc565('0x76')]())))[_0xc565('0x76')]();break;default:_0x17dda1=squel['insert']()[_0xc565('0x6b')](_0xc565('0x6c'))[_0xc565('0x6d')](['phone',_0xc565('0x6f'),_0xc565('0x70'),'ListId',_0xc565('0x59'),_0xc565('0x55'),_0xc565('0x56')],squel[_0xc565('0x72')]()[_0xc565('0x73')](_0xc565('0x6e'),'phone')[_0xc565('0x73')](_0xc565('0x74'),_0xc565('0x6f'))[_0xc565('0x73')]('id',_0xc565('0x70'))[_0xc565('0x73')](_0x1fc403['CmListId'][_0xc565('0x76')](),_0xc565('0x71'))[_0xc565('0x73')](_0x1ee4d6[_0xc565('0x44')]['id'][_0xc565('0x76')](),_0xc565('0x59'))['field']('\x27'+_0x58f233+'\x27',_0xc565('0x55'))[_0xc565('0x73')]('\x27'+_0x58f233+'\x27',_0xc565('0x56'))[_0xc565('0x77')](_0xc565('0x78'))[_0xc565('0x3b')](_0xc565('0x79'))[_0xc565('0x3b')](_0xc565('0x7a'),_0x1fc403[_0xc565('0x75')][_0xc565('0x76')]())[_0xc565('0x3b')](_0xc565('0x7b')))[_0xc565('0x76')]();}_0x44ed4e=squel[_0xc565('0x6a')]()[_0xc565('0x6b')](_0xc565('0x81'))['fromQuery']([_0xc565('0x82'),'scheduledAt','phone','OrderBy','createdAt',_0xc565('0x56')],squel[_0xc565('0x72')]()[_0xc565('0x73')](_0xc565('0x83'),'id')[_0xc565('0x73')](_0xc565('0x74'),_0xc565('0x6f'))['field']('ci.item','phone')[_0xc565('0x73')](_0xc565('0x84'),_0xc565('0x85'))['field']('\x27'+_0x58f233+'\x27',_0xc565('0x55'))[_0xc565('0x73')]('\x27'+_0x58f233+'\x27',_0xc565('0x56'))[_0xc565('0x77')](_0xc565('0x86'),'ci')[_0xc565('0x87')](_0xc565('0x6c'),'h',_0xc565('0x88'))[_0xc565('0x3b')](_0xc565('0x89'),_0x1fc403[_0xc565('0x75')][_0xc565('0x76')]())[_0xc565('0x3b')](_0xc565('0x8a'),_0x1ee4d6[_0xc565('0x44')]['id']['toString']())[_0xc565('0x3b')](_0xc565('0x8b'),_0x58f233))[_0xc565('0x76')]();_0x504a6c[_0xc565('0x8c')](db[_0xc565('0x8d')][_0xc565('0x32')](_0x17dda1));_0xd3059e[_0xc565('0x8c')](db[_0xc565('0x8d')][_0xc565('0x32')](_0x44ed4e));}return BPromise[_0xc565('0x8e')](_0x504a6c);}})[_0xc565('0x24')](function(){return BPromise['all'](_0xd3059e);})['then'](function(){return _0x3f5685;})['then'](respondWithResult(_0x21f094,null))[_0xc565('0x52')](handleError(_0x21f094,null));};exports[_0xc565('0x8f')]=function(_0x5c3c8e,_0x1dfebf,_0x2077f3){return db[_0xc565('0x2e')][_0xc565('0x48')]({'where':{'id':_0x5c3c8e[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x1dfebf,null))[_0xc565('0x24')](function(_0x5c08bd){if(_0x5c08bd){return _0x5c08bd[_0xc565('0x8f')](_0x5c3c8e[_0xc565('0x32')][_0xc565('0x66')]);}})[_0xc565('0x24')](function(_0x4cfe25){if(_0x4cfe25){return db['CmHopper']['destroy']({'where':{'ListId':_0x5c3c8e[_0xc565('0x32')][_0xc565('0x66')],'CampaignId':_0x5c3c8e[_0xc565('0x44')]['id']}})[_0xc565('0x24')](function(){return _0x4cfe25;});}})[_0xc565('0x24')](respondWithStatusCode(_0x1dfebf,null))[_0xc565('0x52')](handleError(_0x1dfebf,null));};exports[_0xc565('0x90')]=function(_0x4ea3a9,_0x2b7e29,_0x1a86ff){var _0x582096={};var _0x5f089e={};var _0x39bebb;var _0x3609f0;return db[_0xc565('0x2e')][_0xc565('0x57')]({'where':{'id':_0x4ea3a9[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x2b7e29,null))[_0xc565('0x24')](function(_0x46b6b3){if(_0x46b6b3){_0x39bebb=_0x46b6b3;_0x5f089e[_0xc565('0x31')]=_['keys'](db['CmList'][_0xc565('0x45')]);_0x5f089e[_0xc565('0x32')]=_[_0xc565('0x33')](_0x4ea3a9['query']);_0x5f089e[_0xc565('0x34')]=_[_0xc565('0x46')](_0x5f089e[_0xc565('0x31')],_0x5f089e[_0xc565('0x32')]);_0x582096[_0xc565('0x35')]=_[_0xc565('0x46')](_0x5f089e[_0xc565('0x31')],qs[_0xc565('0x47')](_0x4ea3a9['query']['fields']));_0x582096[_0xc565('0x35')]=_0x582096['attributes'][_0xc565('0x36')]?_0x582096[_0xc565('0x35')]:_0x5f089e[_0xc565('0x31')];_0x582096['order']=qs[_0xc565('0x3a')](_0x4ea3a9[_0xc565('0x32')][_0xc565('0x3a')]);_0x582096[_0xc565('0x3b')]=qs[_0xc565('0x34')](_[_0xc565('0x3c')](_0x4ea3a9[_0xc565('0x32')],_0x5f089e[_0xc565('0x34')]));if(_0x4ea3a9[_0xc565('0x32')][_0xc565('0x3d')]){_0x582096[_0xc565('0x3b')]=_[_0xc565('0x3e')](_0x582096[_0xc565('0x3b')],{'$or':_[_0xc565('0x2d')](_0x582096[_0xc565('0x35')],function(_0x2f0b73){var _0x26f43e={};_0x26f43e[_0x2f0b73]={'$like':'%'+_0x4ea3a9[_0xc565('0x32')][_0xc565('0x3d')]+'%'};return _0x26f43e;})});}_0x582096=_[_0xc565('0x3e')]({},_0x582096,_0x4ea3a9['options']);return _0x39bebb[_0xc565('0x90')](_0x582096);}})['then'](function(_0x3d1a0a){if(_0x3d1a0a){_0x3609f0=_0x3d1a0a[_0xc565('0x36')];if(!_0x4ea3a9[_0xc565('0x32')]['hasOwnProperty'](_0xc565('0x38'))){_0x582096[_0xc565('0x1c')]=qs['limit'](_0x4ea3a9[_0xc565('0x32')][_0xc565('0x1c')]);_0x582096[_0xc565('0x1a')]=qs[_0xc565('0x1a')](_0x4ea3a9[_0xc565('0x32')][_0xc565('0x1a')]);}return _0x39bebb[_0xc565('0x90')](_0x582096);}})[_0xc565('0x24')](function(_0x178a31){if(_0x178a31){return _0x178a31?{'count':_0x3609f0,'rows':_0x178a31}:null;}})[_0xc565('0x24')](respondWithResult(_0x2b7e29,null))['catch'](handleError(_0x2b7e29,null));};exports[_0xc565('0x91')]=function(_0x277480,_0x2915b0,_0x231bb4){var _0x369380,_0x4d4d60;var _0x582431=[];var _0x3a3231=moment()[_0xc565('0x64')](_0xc565('0x65'));return db[_0xc565('0x2e')][_0xc565('0x48')]({'where':{'id':_0x277480['params']['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x2915b0,null))['then'](function(_0x3bb885){if(_0x3bb885){_0x4d4d60=_0x3bb885;return _0x3bb885[_0xc565('0x91')](_0x277480[_0xc565('0x4a')][_0xc565('0x66')],_[_0xc565('0x54')](_0x277480[_0xc565('0x4a')],[_0xc565('0x66'),'id'])||{});}return null;})[_0xc565('0x67')](function(_0x4e9adb){var _0x3118f4;var _0xe2d1cb;_0x369380=_0x4e9adb||[];var _0x4ef476=[];if(_0x4e9adb){for(var _0x211cc8=0x0;_0x211cc8<_0x4e9adb[_0xc565('0x36')];_0x211cc8+=0x1){var _0x1cb366=_0x4e9adb[_0x211cc8][_0xc565('0x4c')]({'plain':!![]});_0x3118f4=squel[_0xc565('0x6a')]()['into'](_0xc565('0x92'))[_0xc565('0x6d')]([_0xc565('0x6e'),_0xc565('0x70'),_0xc565('0x71'),_0xc565('0x59'),'createdAt','updatedAt'],squel[_0xc565('0x72')]()[_0xc565('0x73')]('phone',_0xc565('0x6e'))['field']('id',_0xc565('0x70'))['field'](_0x1cb366[_0xc565('0x75')][_0xc565('0x76')](),'ListId')['field'](_0x277480[_0xc565('0x44')]['id'][_0xc565('0x76')](),_0xc565('0x59'))[_0xc565('0x73')]('NOW()',_0xc565('0x55'))[_0xc565('0x73')](_0xc565('0x74'),_0xc565('0x56'))['from']('cm_contacts')[_0xc565('0x3b')](_0xc565('0x79'))[_0xc565('0x3b')](_0xc565('0x7a'),_0x1cb366[_0xc565('0x75')][_0xc565('0x76')]())[_0xc565('0x3b')](_0xc565('0x7b')))[_0xc565('0x76')]();_0x4ef476['push'](db[_0xc565('0x8d')][_0xc565('0x32')](_0x3118f4));}return BPromise[_0xc565('0x8e')](_0x4ef476);}})[_0xc565('0x24')](function(){return _0x369380;})[_0xc565('0x24')](respondWithResult(_0x2915b0,null))[_0xc565('0x52')](handleError(_0x2915b0,null));};exports[_0xc565('0x93')]=function(_0x40f562,_0x1ee15d,_0x48d094){return db[_0xc565('0x2e')]['find']({'where':{'id':_0x40f562[_0xc565('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ee15d,null))[_0xc565('0x24')](function(_0x397435){if(_0x397435){return _0x397435[_0xc565('0x93')](_0x40f562[_0xc565('0x32')][_0xc565('0x66')]);}})[_0xc565('0x24')](function(_0x2f4bce){if(_0x2f4bce){return db['CmHopperBlack'][_0xc565('0x23')]({'where':{'ListId':_0x40f562[_0xc565('0x32')][_0xc565('0x66')],'CampaignId':_0x40f562[_0xc565('0x44')]['id']}})[_0xc565('0x24')](function(){return _0x2f4bce;});}})[_0xc565('0x24')](respondWithStatusCode(_0x1ee15d,null))[_0xc565('0x52')](handleError(_0x1ee15d,null));}; \ No newline at end of file +var _0x4ffe=['show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','push','sequelize','all','removeLists','ids','getBlackLists','format','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','index','map','Campaign','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x335e24,_0x3fbd76){var _0x3e3b08=function(_0x19ee98){while(--_0x19ee98){_0x335e24['push'](_0x335e24['shift']());}};_0x3e3b08(++_0x3fbd76);}(_0x4ffe,0x172));var _0xe4ff=function(_0x513835,_0x93de04){_0x513835=_0x513835-0x0;var _0x567b24=_0x4ffe[_0x513835];return _0x567b24;};'use strict';var emlformat=require(_0xe4ff('0x0'));var rimraf=require(_0xe4ff('0x1'));var zipdir=require(_0xe4ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4ff('0x3'));var moment=require(_0xe4ff('0x4'));var BPromise=require(_0xe4ff('0x5'));var Mustache=require('mustache');var util=require(_0xe4ff('0x6'));var path=require(_0xe4ff('0x7'));var sox=require(_0xe4ff('0x8'));var csv=require(_0xe4ff('0x9'));var ejs=require(_0xe4ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4ff('0xb'));var squel=require(_0xe4ff('0xc'));var crypto=require(_0xe4ff('0xd'));var jsforce=require(_0xe4ff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe4ff('0x9'));var querystring=require('querystring');var Papa=require(_0xe4ff('0xf'));var Redis=require(_0xe4ff('0x10'));var authService=require(_0xe4ff('0x11'));var qs=require(_0xe4ff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4ff('0x13'))(_0xe4ff('0x14'));var utils=require(_0xe4ff('0x15'));var config=require(_0xe4ff('0x16'));var licenseUtil=require(_0xe4ff('0x17'));var db=require(_0xe4ff('0x18'))['db'];function respondWithStatusCode(_0x4d6721,_0x40b932){_0x40b932=_0x40b932||0xcc;return function(_0x20c8c1){if(_0x20c8c1){return _0x4d6721['sendStatus'](_0x40b932);}return _0x4d6721[_0xe4ff('0x19')](_0x40b932)['end']();};}function respondWithResult(_0xb6c406,_0x2d5182){_0x2d5182=_0x2d5182||0xc8;return function(_0x5702dc){if(_0x5702dc){return _0xb6c406[_0xe4ff('0x19')](_0x2d5182)[_0xe4ff('0x1a')](_0x5702dc);}};}function respondWithFilteredResult(_0x1d0664,_0x30db8f){return function(_0x2b7212){if(_0x2b7212){var _0x416889=typeof _0x30db8f['offset']===_0xe4ff('0x1b')&&typeof _0x30db8f[_0xe4ff('0x1c')]===_0xe4ff('0x1b');var _0x5da39b=_0x2b7212['count'];var _0x342bad=_0x416889?0x0:_0x30db8f[_0xe4ff('0x1d')];var _0x2f89d0=_0x416889?_0x2b7212[_0xe4ff('0x1e')]:_0x30db8f['offset']+_0x30db8f[_0xe4ff('0x1c')];var _0x39c753;if(_0x2f89d0>=_0x5da39b){_0x2f89d0=_0x5da39b;_0x39c753=0xc8;}else{_0x39c753=0xce;}_0x1d0664[_0xe4ff('0x19')](_0x39c753);return _0x1d0664[_0xe4ff('0x1f')](_0xe4ff('0x20'),_0x342bad+'-'+_0x2f89d0+'/'+_0x5da39b)['json'](_0x2b7212);}return null;};}function patchUpdates(_0x323864){return function(_0xfa6146){try{jsonpatch[_0xe4ff('0x21')](_0xfa6146,_0x323864,!![]);}catch(_0x3a7511){return BPromise[_0xe4ff('0x22')](_0x3a7511);}return _0xfa6146[_0xe4ff('0x23')]();};}function saveUpdates(_0x5df979,_0xb7c50){return function(_0x57f868){if(_0x57f868){return _0x57f868[_0xe4ff('0x24')](_0x5df979)[_0xe4ff('0x25')](function(_0x47d9c3){return _0x47d9c3;});}return null;};}function removeEntity(_0x2044ca,_0x5c9345){return function(_0xf8e190){if(_0xf8e190){return _0xf8e190[_0xe4ff('0x26')]()[_0xe4ff('0x25')](function(){var _0x1a0f3c=_0xf8e190[_0xe4ff('0x27')]({'plain':!![]});var _0xfa00a5=_0xe4ff('0x28');return db[_0xe4ff('0x29')][_0xe4ff('0x26')]({'where':{'type':_0xfa00a5,'resourceId':_0x1a0f3c['id']}})[_0xe4ff('0x25')](function(){return _0xf8e190;});})[_0xe4ff('0x25')](function(){_0x2044ca[_0xe4ff('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e28a,_0x768c03){return function(_0x1fd9e3){if(!_0x1fd9e3){_0x28e28a[_0xe4ff('0x2a')](0x194);}return _0x1fd9e3;};}function handleError(_0x320a5c,_0x240892){_0x240892=_0x240892||0x1f4;return function(_0x49c9a3){logger[_0xe4ff('0x2b')](_0x49c9a3[_0xe4ff('0x2c')]);if(_0x49c9a3[_0xe4ff('0x2d')]){delete _0x49c9a3['name'];}_0x320a5c[_0xe4ff('0x19')](_0x240892)['send'](_0x49c9a3);};}exports[_0xe4ff('0x2e')]=function(_0x1334b2,_0x59c3dc){var _0x56a5cc={},_0x4439be={},_0x1fd76b={'count':0x0,'rows':[]};var _0x295531=_[_0xe4ff('0x2f')](db[_0xe4ff('0x30')][_0xe4ff('0x31')],function(_0x37ac7d){return{'name':_0x37ac7d[_0xe4ff('0x32')],'type':_0x37ac7d['type'][_0xe4ff('0x33')]};});_0x4439be[_0xe4ff('0x34')]=_[_0xe4ff('0x2f')](_0x295531,_0xe4ff('0x2d'));_0x4439be[_0xe4ff('0x35')]=_['keys'](_0x1334b2['query']);_0x4439be[_0xe4ff('0x36')]=_[_0xe4ff('0x37')](_0x4439be[_0xe4ff('0x34')],_0x4439be[_0xe4ff('0x35')]);_0x56a5cc[_0xe4ff('0x38')]=_['intersection'](_0x4439be[_0xe4ff('0x34')],qs['fields'](_0x1334b2[_0xe4ff('0x35')]['fields']));_0x56a5cc[_0xe4ff('0x38')]=_0x56a5cc['attributes'][_0xe4ff('0x39')]?_0x56a5cc['attributes']:_0x4439be[_0xe4ff('0x34')];if(!_0x1334b2[_0xe4ff('0x35')][_0xe4ff('0x3a')](_0xe4ff('0x3b'))){_0x56a5cc['limit']=qs[_0xe4ff('0x1c')](_0x1334b2['query'][_0xe4ff('0x1c')]);_0x56a5cc[_0xe4ff('0x1d')]=qs[_0xe4ff('0x1d')](_0x1334b2[_0xe4ff('0x35')]['offset']);}_0x56a5cc[_0xe4ff('0x3c')]=qs[_0xe4ff('0x3d')](_0x1334b2[_0xe4ff('0x35')][_0xe4ff('0x3d')]);_0x56a5cc[_0xe4ff('0x3e')]=qs[_0xe4ff('0x36')](_[_0xe4ff('0x3f')](_0x1334b2[_0xe4ff('0x35')],_0x4439be[_0xe4ff('0x36')]),_0x295531);if(_0x1334b2[_0xe4ff('0x35')]['filter']){_0x56a5cc[_0xe4ff('0x3e')]=_[_0xe4ff('0x40')](_0x56a5cc[_0xe4ff('0x3e')],{'$or':_[_0xe4ff('0x2f')](_0x295531,function(_0x459246){if(_0x459246[_0xe4ff('0x41')]!==_0xe4ff('0x42')){var _0x4374d3={};_0x4374d3[_0x459246[_0xe4ff('0x2d')]]={'$like':'%'+_0x1334b2[_0xe4ff('0x35')][_0xe4ff('0x43')]+'%'};return _0x4374d3;}})});}_0x56a5cc=_[_0xe4ff('0x40')]({},_0x56a5cc,_0x1334b2[_0xe4ff('0x44')]);var _0x4bebe7={'where':_0x56a5cc['where']};return db[_0xe4ff('0x30')]['count'](_0x4bebe7)[_0xe4ff('0x25')](function(_0x2ac135){_0x1fd76b['count']=_0x2ac135;if(_0x1334b2['query'][_0xe4ff('0x45')]){_0x56a5cc[_0xe4ff('0x46')]=[{'all':!![]}];}return db[_0xe4ff('0x30')][_0xe4ff('0x47')](_0x56a5cc);})[_0xe4ff('0x25')](function(_0x222434){_0x1fd76b[_0xe4ff('0x48')]=_0x222434;return _0x1fd76b;})['then'](respondWithFilteredResult(_0x59c3dc,_0x56a5cc))[_0xe4ff('0x49')](handleError(_0x59c3dc,null));};exports[_0xe4ff('0x4a')]=function(_0x5b7d8f,_0x38ab43){var _0x31adb6={'raw':![],'where':{'id':_0x5b7d8f[_0xe4ff('0x4b')]['id']}},_0x55cfdf={};_0x55cfdf[_0xe4ff('0x34')]=_[_0xe4ff('0x4c')](db[_0xe4ff('0x30')][_0xe4ff('0x31')]);_0x55cfdf['query']=_[_0xe4ff('0x4c')](_0x5b7d8f['query']);_0x55cfdf[_0xe4ff('0x36')]=_[_0xe4ff('0x37')](_0x55cfdf[_0xe4ff('0x34')],_0x55cfdf['query']);_0x31adb6[_0xe4ff('0x38')]=_[_0xe4ff('0x37')](_0x55cfdf[_0xe4ff('0x34')],qs['fields'](_0x5b7d8f['query'][_0xe4ff('0x4d')]));_0x31adb6['attributes']=_0x31adb6[_0xe4ff('0x38')][_0xe4ff('0x39')]?_0x31adb6[_0xe4ff('0x38')]:_0x55cfdf['model'];if(_0x5b7d8f[_0xe4ff('0x35')][_0xe4ff('0x45')]){_0x31adb6[_0xe4ff('0x46')]=[{'all':!![]}];}_0x31adb6=_[_0xe4ff('0x40')]({},_0x31adb6,_0x5b7d8f[_0xe4ff('0x44')]);return db[_0xe4ff('0x30')][_0xe4ff('0x4e')](_0x31adb6)[_0xe4ff('0x25')](handleEntityNotFound(_0x38ab43,null))[_0xe4ff('0x25')](respondWithResult(_0x38ab43,null))['catch'](handleError(_0x38ab43,null));};exports[_0xe4ff('0x4f')]=function(_0x1676c9,_0x1ee66f){return db[_0xe4ff('0x30')][_0xe4ff('0x4f')](_0x1676c9[_0xe4ff('0x50')],{})[_0xe4ff('0x25')](function(_0x4c1ca1){var _0x3d5a48=_0x1676c9[_0xe4ff('0x51')][_0xe4ff('0x27')]({'plain':!![]});if(!_0x3d5a48)throw new Error(_0xe4ff('0x52'));if(_0x3d5a48[_0xe4ff('0x53')]===_0xe4ff('0x51')){var _0x2d73f4=_0x4c1ca1[_0xe4ff('0x27')]({'plain':!![]});var _0x2590c6='IvrCampaigns';return db[_0xe4ff('0x54')]['find']({'where':{'name':_0x2590c6,'userProfileId':_0x3d5a48[_0xe4ff('0x55')]},'raw':!![]})[_0xe4ff('0x25')](function(_0x578c6c){if(_0x578c6c&&_0x578c6c[_0xe4ff('0x56')]===0x0){return db[_0xe4ff('0x29')][_0xe4ff('0x4f')]({'name':_0x2d73f4[_0xe4ff('0x2d')],'resourceId':_0x2d73f4['id'],'type':_0x578c6c[_0xe4ff('0x2d')],'sectionId':_0x578c6c['id']},{})['then'](function(){return _0x4c1ca1;});}else{return _0x4c1ca1;}})[_0xe4ff('0x49')](function(_0x557249){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557249);throw _0x557249;});}return _0x4c1ca1;})[_0xe4ff('0x25')](respondWithResult(_0x1ee66f,0xc9))[_0xe4ff('0x49')](handleError(_0x1ee66f,null));};exports[_0xe4ff('0x57')]=function(_0x28cc81,_0xb710f0){var _0x494281={'where':{'id':_0x28cc81[_0xe4ff('0x4b')]['id']}},_0x1e2008={};_0x1e2008[_0xe4ff('0x34')]=_[_0xe4ff('0x4c')](db[_0xe4ff('0x30')][_0xe4ff('0x31')]);_0x494281[_0xe4ff('0x38')]=_['intersection'](_0x1e2008['model'],qs['fields'](_0x28cc81[_0xe4ff('0x35')][_0xe4ff('0x4d')]));_0x494281['attributes']=_0x494281[_0xe4ff('0x38')][_0xe4ff('0x39')]?_0x494281[_0xe4ff('0x38')]:_0x1e2008[_0xe4ff('0x34')];if(_0x28cc81[_0xe4ff('0x35')]['includeAll']){_0x494281[_0xe4ff('0x46')]=[{'all':!![]}];}_0x494281=_['merge']({},_0x494281,_0x28cc81[_0xe4ff('0x44')]);return db[_0xe4ff('0x30')]['find'](_0x494281)[_0xe4ff('0x25')](handleEntityNotFound(_0xb710f0,null))[_0xe4ff('0x25')](function(_0x70f68a){if(_0x70f68a){var _0x27dd00=_0x70f68a[_0xe4ff('0x27')]({'plain':!![]});_0x27dd00=qs[_0xe4ff('0x58')](_0x27dd00,['id',_0xe4ff('0x59'),_0xe4ff('0x5a')]);_0x28cc81[_0xe4ff('0x50')]=_[_0xe4ff('0x58')](_0x28cc81[_0xe4ff('0x50')],['id',_0xe4ff('0x59'),_0xe4ff('0x5a')]);return db[_0xe4ff('0x30')][_0xe4ff('0x4f')](_[_0xe4ff('0x40')](_0x27dd00,_0x28cc81[_0xe4ff('0x50')]),{'include':_0x28cc81[_0xe4ff('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xe4ff('0x25')](function(_0x11cb09){var _0x30cfcb=_0x28cc81['user'][_0xe4ff('0x27')]({'plain':!![]});if(!_0x30cfcb)throw new Error(_0xe4ff('0x52'));if(_0x30cfcb['role']==='user'){var _0x443d4f=_0x11cb09[_0xe4ff('0x27')]({'plain':!![]});var _0xc744a2=_0xe4ff('0x28');return db[_0xe4ff('0x54')][_0xe4ff('0x4e')]({'where':{'name':_0xc744a2,'userProfileId':_0x30cfcb['userProfileId']},'raw':!![]})[_0xe4ff('0x25')](function(_0x2c701c){if(_0x2c701c&&_0x2c701c[_0xe4ff('0x56')]===0x0){return db[_0xe4ff('0x29')][_0xe4ff('0x4f')]({'name':_0x443d4f[_0xe4ff('0x2d')],'resourceId':_0x443d4f['id'],'type':_0x2c701c[_0xe4ff('0x2d')],'sectionId':_0x2c701c['id']},{})[_0xe4ff('0x25')](function(){return _0x11cb09;});}else{return _0x11cb09;}})[_0xe4ff('0x49')](function(_0x444f31){logger['error'](_0xe4ff('0x5b'),_0x444f31);throw _0x444f31;});}return _0x11cb09;});}})[_0xe4ff('0x25')](respondWithResult(_0xb710f0,0xc9))[_0xe4ff('0x49')](handleError(_0xb710f0,null));};exports[_0xe4ff('0x24')]=function(_0x2711d9,_0x283d37){if(_0x2711d9[_0xe4ff('0x50')]['id']){delete _0x2711d9[_0xe4ff('0x50')]['id'];}return db['Campaign'][_0xe4ff('0x4e')]({'where':{'id':_0x2711d9[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x283d37,null))[_0xe4ff('0x25')](saveUpdates(_0x2711d9[_0xe4ff('0x50')],null))[_0xe4ff('0x25')](respondWithResult(_0x283d37,null))['catch'](handleError(_0x283d37,null));};exports[_0xe4ff('0x26')]=function(_0x17077b,_0x404547){return db['Campaign']['find']({'where':{'id':_0x17077b[_0xe4ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x404547,null))[_0xe4ff('0x25')](removeEntity(_0x404547,null))[_0xe4ff('0x49')](handleError(_0x404547,null));};exports[_0xe4ff('0x5c')]=function(_0x46f633,_0x324723,_0x133ab0){var _0x186bd0={'raw':!![],'where':{}};var _0x147444={};var _0x134506={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x46f633[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x324723,null))[_0xe4ff('0x25')](function(_0x2c1855){if(_0x2c1855){_0x147444[_0xe4ff('0x34')]=_['keys'](db[_0xe4ff('0x5d')][_0xe4ff('0x31')]);_0x147444['query']=_[_0xe4ff('0x4c')](_0x46f633['query']);_0x147444[_0xe4ff('0x36')]=_['intersection'](_0x147444[_0xe4ff('0x34')],_0x147444[_0xe4ff('0x35')]);_0x186bd0['attributes']=_[_0xe4ff('0x37')](_0x147444[_0xe4ff('0x34')],qs['fields'](_0x46f633[_0xe4ff('0x35')][_0xe4ff('0x4d')]));_0x186bd0[_0xe4ff('0x38')]=_0x186bd0[_0xe4ff('0x38')][_0xe4ff('0x39')]?_0x186bd0[_0xe4ff('0x38')]:_0x147444[_0xe4ff('0x34')];if(!_0x46f633[_0xe4ff('0x35')][_0xe4ff('0x3a')]('nolimit')){_0x186bd0['limit']=qs[_0xe4ff('0x1c')](_0x46f633[_0xe4ff('0x35')]['limit']);_0x186bd0['offset']=qs[_0xe4ff('0x1d')](_0x46f633[_0xe4ff('0x35')][_0xe4ff('0x1d')]);}_0x186bd0['order']=qs[_0xe4ff('0x3d')](_0x46f633[_0xe4ff('0x35')][_0xe4ff('0x3d')]);_0x186bd0[_0xe4ff('0x3e')]=qs[_0xe4ff('0x36')](_[_0xe4ff('0x3f')](_0x46f633[_0xe4ff('0x35')],_0x147444[_0xe4ff('0x36')]));_0x186bd0[_0xe4ff('0x3e')][_0xe4ff('0x5e')]=_0x2c1855['id'];if(_0x46f633['query'][_0xe4ff('0x43')]){_0x186bd0['where']=_[_0xe4ff('0x40')](_0x186bd0[_0xe4ff('0x3e')],{'$or':_['map'](_0x186bd0[_0xe4ff('0x38')],function(_0x4d90d7){var _0x3f2b36={};_0x3f2b36[_0x4d90d7]={'$like':'%'+_0x46f633[_0xe4ff('0x35')]['filter']+'%'};return _0x3f2b36;})});}_0x186bd0=_[_0xe4ff('0x40')]({},_0x186bd0,_0x46f633['options']);return db[_0xe4ff('0x5d')][_0xe4ff('0x1e')]({'where':_0x186bd0[_0xe4ff('0x3e')]})[_0xe4ff('0x25')](function(_0x1cafdc){_0x134506['count']=_0x1cafdc;if(_0x46f633[_0xe4ff('0x35')]['includeAll']){_0x186bd0[_0xe4ff('0x46')]=[{'all':!![]}];}return db[_0xe4ff('0x5d')][_0xe4ff('0x47')](_0x186bd0);})[_0xe4ff('0x25')](function(_0x49f1fa){_0x134506['rows']=_0x49f1fa;return _0x134506;});}})['then'](respondWithFilteredResult(_0x324723,_0x186bd0))['catch'](handleError(_0x324723,null));};exports[_0xe4ff('0x5f')]=function(_0x18639e,_0x458b0c,_0x178e21){var _0x1feabc={'raw':!![],'where':{}};var _0x40d24f={};var _0x1c9813={'count':0x0,'rows':[]};return db[_0xe4ff('0x30')][_0xe4ff('0x60')]({'where':{'id':_0x18639e['params']['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x458b0c,null))[_0xe4ff('0x25')](function(_0x49659d){if(_0x49659d){_0x40d24f[_0xe4ff('0x34')]=_['keys'](db[_0xe4ff('0x61')][_0xe4ff('0x31')]);_0x40d24f[_0xe4ff('0x35')]=_[_0xe4ff('0x4c')](_0x18639e['query']);_0x40d24f[_0xe4ff('0x36')]=_[_0xe4ff('0x37')](_0x40d24f[_0xe4ff('0x34')],_0x40d24f['query']);_0x1feabc['attributes']=_['intersection'](_0x40d24f[_0xe4ff('0x34')],qs[_0xe4ff('0x4d')](_0x18639e[_0xe4ff('0x35')]['fields']));_0x1feabc[_0xe4ff('0x38')]=_0x1feabc[_0xe4ff('0x38')][_0xe4ff('0x39')]?_0x1feabc[_0xe4ff('0x38')]:_0x40d24f[_0xe4ff('0x34')];if(!_0x18639e['query'][_0xe4ff('0x3a')](_0xe4ff('0x3b'))){_0x1feabc[_0xe4ff('0x1c')]=qs[_0xe4ff('0x1c')](_0x18639e['query'][_0xe4ff('0x1c')]);_0x1feabc[_0xe4ff('0x1d')]=qs[_0xe4ff('0x1d')](_0x18639e['query'][_0xe4ff('0x1d')]);}_0x1feabc[_0xe4ff('0x3c')]=qs['sort'](_0x18639e[_0xe4ff('0x35')]['sort']);_0x1feabc[_0xe4ff('0x3e')]=qs['filters'](_[_0xe4ff('0x3f')](_0x18639e[_0xe4ff('0x35')],_0x40d24f['filters']));_0x1feabc[_0xe4ff('0x3e')][_0xe4ff('0x5e')]=_0x49659d['id'];if(_0x18639e[_0xe4ff('0x35')][_0xe4ff('0x43')]){_0x1feabc[_0xe4ff('0x3e')]=_[_0xe4ff('0x40')](_0x1feabc[_0xe4ff('0x3e')],{'$or':_[_0xe4ff('0x2f')](_0x1feabc[_0xe4ff('0x38')],function(_0x4017ac){var _0x354efa={};_0x354efa[_0x4017ac]={'$like':'%'+_0x18639e['query'][_0xe4ff('0x43')]+'%'};return _0x354efa;})});}_0x1feabc=_[_0xe4ff('0x40')]({},_0x1feabc,_0x18639e['options']);return db[_0xe4ff('0x61')][_0xe4ff('0x1e')]({'where':_0x1feabc[_0xe4ff('0x3e')]})[_0xe4ff('0x25')](function(_0xb23fc5){_0x1c9813[_0xe4ff('0x1e')]=_0xb23fc5;if(_0x18639e[_0xe4ff('0x35')][_0xe4ff('0x45')]){_0x1feabc[_0xe4ff('0x46')]=[{'all':!![]}];}return db[_0xe4ff('0x61')][_0xe4ff('0x47')](_0x1feabc);})[_0xe4ff('0x25')](function(_0x61dec9){_0x1c9813[_0xe4ff('0x48')]=_0x61dec9;return _0x1c9813;});}})['then'](respondWithFilteredResult(_0x458b0c,_0x1feabc))[_0xe4ff('0x49')](handleError(_0x458b0c,null));};exports[_0xe4ff('0x62')]=function(_0x1316c2,_0x39e82e,_0x2fcfb7){var _0x55b5b4={'raw':!![],'where':{}};var _0x338521={};var _0xc5390c={'count':0x0,'rows':[]};return db['Campaign'][_0xe4ff('0x60')]({'where':{'id':_0x1316c2[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x39e82e,null))[_0xe4ff('0x25')](function(_0x47034e){if(_0x47034e){_0x338521[_0xe4ff('0x34')]=_['keys'](db[_0xe4ff('0x63')]['rawAttributes']);_0x338521[_0xe4ff('0x35')]=_['keys'](_0x1316c2['query']);_0x338521[_0xe4ff('0x36')]=_[_0xe4ff('0x37')](_0x338521[_0xe4ff('0x34')],_0x338521[_0xe4ff('0x35')]);_0x55b5b4[_0xe4ff('0x38')]=_[_0xe4ff('0x37')](_0x338521[_0xe4ff('0x34')],qs[_0xe4ff('0x4d')](_0x1316c2[_0xe4ff('0x35')][_0xe4ff('0x4d')]));_0x55b5b4[_0xe4ff('0x38')]=_0x55b5b4[_0xe4ff('0x38')][_0xe4ff('0x39')]?_0x55b5b4['attributes']:_0x338521[_0xe4ff('0x34')];if(!_0x1316c2[_0xe4ff('0x35')][_0xe4ff('0x3a')]('nolimit')){_0x55b5b4[_0xe4ff('0x1c')]=qs[_0xe4ff('0x1c')](_0x1316c2[_0xe4ff('0x35')][_0xe4ff('0x1c')]);_0x55b5b4[_0xe4ff('0x1d')]=qs[_0xe4ff('0x1d')](_0x1316c2['query'][_0xe4ff('0x1d')]);}_0x55b5b4[_0xe4ff('0x3c')]=qs[_0xe4ff('0x3d')](_0x1316c2[_0xe4ff('0x35')][_0xe4ff('0x3d')]);_0x55b5b4[_0xe4ff('0x3e')]=qs['filters'](_[_0xe4ff('0x3f')](_0x1316c2['query'],_0x338521[_0xe4ff('0x36')]));_0x55b5b4['where']['CampaignId']=_0x47034e['id'];if(_0x1316c2[_0xe4ff('0x35')][_0xe4ff('0x43')]){_0x55b5b4['where']=_[_0xe4ff('0x40')](_0x55b5b4['where'],{'$or':_[_0xe4ff('0x2f')](_0x55b5b4['attributes'],function(_0x34bd60){var _0x2c8aef={};_0x2c8aef[_0x34bd60]={'$like':'%'+_0x1316c2[_0xe4ff('0x35')][_0xe4ff('0x43')]+'%'};return _0x2c8aef;})});}_0x55b5b4=_[_0xe4ff('0x40')]({},_0x55b5b4,_0x1316c2['options']);return db[_0xe4ff('0x63')]['count']({'where':_0x55b5b4[_0xe4ff('0x3e')]})[_0xe4ff('0x25')](function(_0x156ecf){_0xc5390c['count']=_0x156ecf;if(_0x1316c2['query'][_0xe4ff('0x45')]){_0x55b5b4[_0xe4ff('0x46')]=[{'all':!![]}];}return db[_0xe4ff('0x63')]['findAll'](_0x55b5b4);})['then'](function(_0x24d042){_0xc5390c[_0xe4ff('0x48')]=_0x24d042;return _0xc5390c;});}})[_0xe4ff('0x25')](respondWithFilteredResult(_0x39e82e,_0x55b5b4))[_0xe4ff('0x49')](handleError(_0x39e82e,null));};exports[_0xe4ff('0x64')]=function(_0x4176d4,_0x241f55,_0x4de2a3){var _0x268dbd={'raw':!![],'where':{}};var _0x950fea={};var _0x4e46f8={'count':0x0,'rows':[]};return db[_0xe4ff('0x30')][_0xe4ff('0x60')]({'where':{'id':_0x4176d4['params']['id']}})['then'](handleEntityNotFound(_0x241f55,null))['then'](function(_0x99792a){if(_0x99792a){_0x950fea[_0xe4ff('0x34')]=_['keys'](db[_0xe4ff('0x65')][_0xe4ff('0x31')]);_0x950fea[_0xe4ff('0x35')]=_[_0xe4ff('0x4c')](_0x4176d4[_0xe4ff('0x35')]);_0x950fea['filters']=_[_0xe4ff('0x37')](_0x950fea[_0xe4ff('0x34')],_0x950fea[_0xe4ff('0x35')]);_0x268dbd[_0xe4ff('0x38')]=_[_0xe4ff('0x37')](_0x950fea[_0xe4ff('0x34')],qs[_0xe4ff('0x4d')](_0x4176d4[_0xe4ff('0x35')][_0xe4ff('0x4d')]));_0x268dbd[_0xe4ff('0x38')]=_0x268dbd[_0xe4ff('0x38')][_0xe4ff('0x39')]?_0x268dbd[_0xe4ff('0x38')]:_0x950fea[_0xe4ff('0x34')];if(!_0x4176d4['query']['hasOwnProperty']('nolimit')){_0x268dbd[_0xe4ff('0x1c')]=qs[_0xe4ff('0x1c')](_0x4176d4[_0xe4ff('0x35')][_0xe4ff('0x1c')]);_0x268dbd[_0xe4ff('0x1d')]=qs[_0xe4ff('0x1d')](_0x4176d4[_0xe4ff('0x35')][_0xe4ff('0x1d')]);}_0x268dbd['order']=qs[_0xe4ff('0x3d')](_0x4176d4['query'][_0xe4ff('0x3d')]);_0x268dbd[_0xe4ff('0x3e')]=qs[_0xe4ff('0x36')](_[_0xe4ff('0x3f')](_0x4176d4[_0xe4ff('0x35')],_0x950fea[_0xe4ff('0x36')]));_0x268dbd['where'][_0xe4ff('0x5e')]=_0x99792a['id'];if(_0x4176d4[_0xe4ff('0x35')][_0xe4ff('0x43')]){_0x268dbd[_0xe4ff('0x3e')]=_['merge'](_0x268dbd['where'],{'$or':_[_0xe4ff('0x2f')](_0x268dbd[_0xe4ff('0x38')],function(_0x50c2f0){var _0x3cd5b0={};_0x3cd5b0[_0x50c2f0]={'$like':'%'+_0x4176d4[_0xe4ff('0x35')][_0xe4ff('0x43')]+'%'};return _0x3cd5b0;})});}_0x268dbd=_[_0xe4ff('0x40')]({},_0x268dbd,_0x4176d4[_0xe4ff('0x44')]);return db[_0xe4ff('0x65')][_0xe4ff('0x1e')]({'where':_0x268dbd[_0xe4ff('0x3e')]})[_0xe4ff('0x25')](function(_0x15ded9){_0x4e46f8[_0xe4ff('0x1e')]=_0x15ded9;if(_0x4176d4[_0xe4ff('0x35')][_0xe4ff('0x45')]){_0x268dbd[_0xe4ff('0x46')]=[{'all':!![]}];}return db[_0xe4ff('0x65')][_0xe4ff('0x47')](_0x268dbd);})[_0xe4ff('0x25')](function(_0x2c2477){_0x4e46f8[_0xe4ff('0x48')]=_0x2c2477;return _0x4e46f8;});}})[_0xe4ff('0x25')](respondWithFilteredResult(_0x241f55,_0x268dbd))[_0xe4ff('0x49')](handleError(_0x241f55,null));};exports[_0xe4ff('0x66')]=function(_0x5d9de8,_0x54781c,_0x708d1e){var _0x12fee4={};var _0xd01167={};var _0x20c743;var _0x30e61e;return db[_0xe4ff('0x30')][_0xe4ff('0x60')]({'where':{'id':_0x5d9de8[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x54781c,null))[_0xe4ff('0x25')](function(_0x3edbff){if(_0x3edbff){_0x20c743=_0x3edbff;_0xd01167[_0xe4ff('0x34')]=_[_0xe4ff('0x4c')](db[_0xe4ff('0x67')][_0xe4ff('0x31')]);_0xd01167['query']=_[_0xe4ff('0x4c')](_0x5d9de8[_0xe4ff('0x35')]);_0xd01167[_0xe4ff('0x36')]=_[_0xe4ff('0x37')](_0xd01167[_0xe4ff('0x34')],_0xd01167[_0xe4ff('0x35')]);_0x12fee4[_0xe4ff('0x38')]=_['intersection'](_0xd01167['model'],qs['fields'](_0x5d9de8['query'][_0xe4ff('0x4d')]));_0x12fee4[_0xe4ff('0x38')]=_0x12fee4['attributes'][_0xe4ff('0x39')]?_0x12fee4[_0xe4ff('0x38')]:_0xd01167[_0xe4ff('0x34')];_0x12fee4['order']=qs[_0xe4ff('0x3d')](_0x5d9de8[_0xe4ff('0x35')][_0xe4ff('0x3d')]);_0x12fee4[_0xe4ff('0x3e')]=qs['filters'](_[_0xe4ff('0x3f')](_0x5d9de8['query'],_0xd01167[_0xe4ff('0x36')]));if(_0x5d9de8['query']['filter']){_0x12fee4['where']=_[_0xe4ff('0x40')](_0x12fee4[_0xe4ff('0x3e')],{'$or':_['map'](_0x12fee4['attributes'],function(_0x240c4d){var _0x3f2fa8={};_0x3f2fa8[_0x240c4d]={'$like':'%'+_0x5d9de8[_0xe4ff('0x35')][_0xe4ff('0x43')]+'%'};return _0x3f2fa8;})});}_0x12fee4=_['merge']({},_0x12fee4,_0x5d9de8[_0xe4ff('0x44')]);return _0x20c743[_0xe4ff('0x66')](_0x12fee4);}})[_0xe4ff('0x25')](function(_0x2cba06){if(_0x2cba06){_0x30e61e=_0x2cba06[_0xe4ff('0x39')];if(!_0x5d9de8[_0xe4ff('0x35')][_0xe4ff('0x3a')](_0xe4ff('0x3b'))){_0x12fee4[_0xe4ff('0x1c')]=qs[_0xe4ff('0x1c')](_0x5d9de8[_0xe4ff('0x35')][_0xe4ff('0x1c')]);_0x12fee4[_0xe4ff('0x1d')]=qs[_0xe4ff('0x1d')](_0x5d9de8[_0xe4ff('0x35')][_0xe4ff('0x1d')]);}return _0x20c743['getLists'](_0x12fee4);}})['then'](function(_0x55c1fd){if(_0x55c1fd){return _0x55c1fd?{'count':_0x30e61e,'rows':_0x55c1fd}:null;}})['then'](respondWithResult(_0x54781c,null))[_0xe4ff('0x49')](handleError(_0x54781c,null));};exports[_0xe4ff('0x68')]=function(_0xd02b37,_0x13e1ea,_0x395302){var _0x58c19b,_0x1a57a4;var _0x144c0f=[];var _0x1f3598=moment()['format'](_0xe4ff('0x69'));return db['Campaign']['find']({'where':{'id':_0xd02b37[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x13e1ea,null))[_0xe4ff('0x25')](function(_0x12457b){if(_0x12457b){_0x1a57a4=_0x12457b;return _0x12457b[_0xe4ff('0x68')](_0xd02b37[_0xe4ff('0x50')]['ids'],_[_0xe4ff('0x58')](_0xd02b37[_0xe4ff('0x50')],['ids','id'])||{});}return null;})[_0xe4ff('0x6a')](function(_0x27c06c){var _0x41ee5e;var _0x246d53;_0x58c19b=_0x27c06c||[];var _0x218d6b=[];if(_0x27c06c){for(var _0x4e31b4=0x0;_0x4e31b4<_0x27c06c['length'];_0x4e31b4+=0x1){var _0x5039a3=_0x27c06c[_0x4e31b4]['get']({'plain':!![]});_0x1a57a4[_0xe4ff('0x6b')]=_0xd02b37['body'][_0xe4ff('0x6b')]?_0xd02b37[_0xe4ff('0x50')][_0xe4ff('0x6b')]:_0x1a57a4[_0xe4ff('0x6b')];switch(_0x1a57a4[_0xe4ff('0x6b')]){case _0xe4ff('0x6c'):_0x41ee5e=squel[_0xe4ff('0x6d')]()[_0xe4ff('0x6e')]('cm_hopper')[_0xe4ff('0x6f')]([_0xe4ff('0x70'),'scheduledAt',_0xe4ff('0x71'),_0xe4ff('0x72'),_0xe4ff('0x5e'),'createdAt',_0xe4ff('0x5a')],squel['select']()['field'](_0xe4ff('0x70'),_0xe4ff('0x70'))[_0xe4ff('0x73')](_0xe4ff('0x74'),_0xe4ff('0x75'))[_0xe4ff('0x73')]('id',_0xe4ff('0x71'))['field'](_0x5039a3['CmListId']['toString'](),_0xe4ff('0x72'))[_0xe4ff('0x73')](_0xd02b37[_0xe4ff('0x4b')]['id'][_0xe4ff('0x76')](),_0xe4ff('0x5e'))[_0xe4ff('0x73')]('\x27'+_0x1f3598+'\x27',_0xe4ff('0x59'))[_0xe4ff('0x73')]('\x27'+_0x1f3598+'\x27',_0xe4ff('0x5a'))[_0xe4ff('0x77')](_0xe4ff('0x78'))[_0xe4ff('0x3e')](_0xe4ff('0x79'))[_0xe4ff('0x3e')](_0xe4ff('0x7a'),_0x5039a3[_0xe4ff('0x7b')][_0xe4ff('0x76')]())[_0xe4ff('0x3e')](_0xe4ff('0x7c'))[_0xe4ff('0x3e')](_0xe4ff('0x7d'),squel['select']()[_0xe4ff('0x73')]('COALESCE(calleridnum,\x27\x27)')['from'](_0xe4ff('0x7e'))[_0xe4ff('0x3e')](_0xe4ff('0x7f'),_0xd02b37[_0xe4ff('0x4b')]['id'][_0xe4ff('0x76')]()))[_0xe4ff('0x3e')](_0xe4ff('0x7d'),squel[_0xe4ff('0x80')]()[_0xe4ff('0x73')](_0xe4ff('0x81'))[_0xe4ff('0x77')](_0xe4ff('0x82'))['where']('CampaignId\x20=\x20?',_0xd02b37[_0xe4ff('0x4b')]['id'][_0xe4ff('0x76')]())))[_0xe4ff('0x76')]();break;case _0xe4ff('0x83'):_0x41ee5e=squel['insert']()['into'](_0xe4ff('0x82'))[_0xe4ff('0x6f')]([_0xe4ff('0x70'),_0xe4ff('0x75'),_0xe4ff('0x71'),_0xe4ff('0x72'),_0xe4ff('0x5e'),_0xe4ff('0x59'),_0xe4ff('0x5a')],squel['select']()[_0xe4ff('0x73')]('phone','phone')['field'](_0xe4ff('0x74'),_0xe4ff('0x75'))['field']('id',_0xe4ff('0x71'))['field'](_0x5039a3[_0xe4ff('0x7b')][_0xe4ff('0x76')](),_0xe4ff('0x72'))['field'](_0xd02b37[_0xe4ff('0x4b')]['id'][_0xe4ff('0x76')](),_0xe4ff('0x5e'))[_0xe4ff('0x73')]('\x27'+_0x1f3598+'\x27','createdAt')['field']('\x27'+_0x1f3598+'\x27',_0xe4ff('0x5a'))[_0xe4ff('0x77')](_0xe4ff('0x78'))[_0xe4ff('0x3e')](_0xe4ff('0x79'))[_0xe4ff('0x3e')](_0xe4ff('0x7a'),_0x5039a3[_0xe4ff('0x7b')][_0xe4ff('0x76')]())[_0xe4ff('0x3e')](_0xe4ff('0x7c'))['where'](_0xe4ff('0x7d'),squel[_0xe4ff('0x80')]()[_0xe4ff('0x73')](_0xe4ff('0x81'))[_0xe4ff('0x77')](_0xe4ff('0x82'))['where'](_0xe4ff('0x7f'),_0xd02b37[_0xe4ff('0x4b')]['id'][_0xe4ff('0x76')]())))[_0xe4ff('0x76')]();break;default:_0x41ee5e=squel[_0xe4ff('0x6d')]()[_0xe4ff('0x6e')](_0xe4ff('0x82'))[_0xe4ff('0x6f')]([_0xe4ff('0x70'),_0xe4ff('0x75'),_0xe4ff('0x71'),_0xe4ff('0x72'),_0xe4ff('0x5e'),_0xe4ff('0x59'),'updatedAt'],squel[_0xe4ff('0x80')]()[_0xe4ff('0x73')](_0xe4ff('0x70'),_0xe4ff('0x70'))[_0xe4ff('0x73')](_0xe4ff('0x74'),_0xe4ff('0x75'))[_0xe4ff('0x73')]('id',_0xe4ff('0x71'))[_0xe4ff('0x73')](_0x5039a3[_0xe4ff('0x7b')][_0xe4ff('0x76')](),'ListId')[_0xe4ff('0x73')](_0xd02b37[_0xe4ff('0x4b')]['id'][_0xe4ff('0x76')](),'CampaignId')[_0xe4ff('0x73')]('\x27'+_0x1f3598+'\x27',_0xe4ff('0x59'))[_0xe4ff('0x73')]('\x27'+_0x1f3598+'\x27','updatedAt')[_0xe4ff('0x77')](_0xe4ff('0x78'))[_0xe4ff('0x3e')]('deletedAt\x20IS\x20NULL')[_0xe4ff('0x3e')](_0xe4ff('0x7a'),_0x5039a3[_0xe4ff('0x7b')][_0xe4ff('0x76')]())['where'](_0xe4ff('0x7c')))['toString']();}_0x246d53=squel[_0xe4ff('0x6d')]()[_0xe4ff('0x6e')]('cm_hopper_additional_phones')[_0xe4ff('0x6f')]([_0xe4ff('0x84'),_0xe4ff('0x75'),_0xe4ff('0x70'),_0xe4ff('0x85'),_0xe4ff('0x59'),_0xe4ff('0x5a')],squel[_0xe4ff('0x80')]()[_0xe4ff('0x73')](_0xe4ff('0x86'),'id')[_0xe4ff('0x73')](_0xe4ff('0x74'),_0xe4ff('0x75'))[_0xe4ff('0x73')](_0xe4ff('0x87'),_0xe4ff('0x70'))[_0xe4ff('0x73')]('ci.OrderBY','OrderBy')[_0xe4ff('0x73')]('\x27'+_0x1f3598+'\x27',_0xe4ff('0x59'))[_0xe4ff('0x73')]('\x27'+_0x1f3598+'\x27',_0xe4ff('0x5a'))['from'](_0xe4ff('0x88'),'ci')['join']('cm_hopper','h',_0xe4ff('0x89'))[_0xe4ff('0x3e')]('h.ListId\x20=\x20?',_0x5039a3[_0xe4ff('0x7b')][_0xe4ff('0x76')]())[_0xe4ff('0x3e')](_0xe4ff('0x8a'),_0xd02b37[_0xe4ff('0x4b')]['id'][_0xe4ff('0x76')]())[_0xe4ff('0x3e')]('h.createdAt\x20=\x20?',_0x1f3598))['toString']();_0x218d6b[_0xe4ff('0x8b')](db[_0xe4ff('0x8c')][_0xe4ff('0x35')](_0x41ee5e));_0x144c0f[_0xe4ff('0x8b')](db[_0xe4ff('0x8c')][_0xe4ff('0x35')](_0x246d53));}return BPromise[_0xe4ff('0x8d')](_0x218d6b);}})[_0xe4ff('0x25')](function(){return BPromise[_0xe4ff('0x8d')](_0x144c0f);})[_0xe4ff('0x25')](function(){return _0x58c19b;})[_0xe4ff('0x25')](respondWithResult(_0x13e1ea,null))[_0xe4ff('0x49')](handleError(_0x13e1ea,null));};exports[_0xe4ff('0x8e')]=function(_0x3782d6,_0x1fe698,_0x11470f){return db[_0xe4ff('0x30')][_0xe4ff('0x4e')]({'where':{'id':_0x3782d6['params']['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x1fe698,null))['then'](function(_0xc913a){if(_0xc913a){return _0xc913a[_0xe4ff('0x8e')](_0x3782d6[_0xe4ff('0x35')][_0xe4ff('0x8f')]);}})[_0xe4ff('0x25')](function(_0x5a2ac4){if(_0x5a2ac4){return db[_0xe4ff('0x5d')][_0xe4ff('0x26')]({'where':{'ListId':_0x3782d6['query'][_0xe4ff('0x8f')],'CampaignId':_0x3782d6[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x25')](function(){return _0x5a2ac4;});}})[_0xe4ff('0x25')](respondWithStatusCode(_0x1fe698,null))['catch'](handleError(_0x1fe698,null));};exports['getBlackLists']=function(_0x4a0f14,_0x579758,_0x510c83){var _0x1a299d={};var _0x19f5dc={};var _0x115820;var _0x3f3f01;return db['Campaign'][_0xe4ff('0x60')]({'where':{'id':_0x4a0f14['params']['id']}})['then'](handleEntityNotFound(_0x579758,null))['then'](function(_0x2b8cd3){if(_0x2b8cd3){_0x115820=_0x2b8cd3;_0x19f5dc[_0xe4ff('0x34')]=_[_0xe4ff('0x4c')](db[_0xe4ff('0x67')][_0xe4ff('0x31')]);_0x19f5dc[_0xe4ff('0x35')]=_[_0xe4ff('0x4c')](_0x4a0f14['query']);_0x19f5dc[_0xe4ff('0x36')]=_[_0xe4ff('0x37')](_0x19f5dc['model'],_0x19f5dc[_0xe4ff('0x35')]);_0x1a299d[_0xe4ff('0x38')]=_['intersection'](_0x19f5dc[_0xe4ff('0x34')],qs['fields'](_0x4a0f14[_0xe4ff('0x35')][_0xe4ff('0x4d')]));_0x1a299d[_0xe4ff('0x38')]=_0x1a299d[_0xe4ff('0x38')][_0xe4ff('0x39')]?_0x1a299d[_0xe4ff('0x38')]:_0x19f5dc[_0xe4ff('0x34')];_0x1a299d[_0xe4ff('0x3c')]=qs[_0xe4ff('0x3d')](_0x4a0f14[_0xe4ff('0x35')]['sort']);_0x1a299d['where']=qs[_0xe4ff('0x36')](_[_0xe4ff('0x3f')](_0x4a0f14[_0xe4ff('0x35')],_0x19f5dc[_0xe4ff('0x36')]));if(_0x4a0f14[_0xe4ff('0x35')][_0xe4ff('0x43')]){_0x1a299d[_0xe4ff('0x3e')]=_[_0xe4ff('0x40')](_0x1a299d[_0xe4ff('0x3e')],{'$or':_['map'](_0x1a299d['attributes'],function(_0x21d857){var _0x4a3ea4={};_0x4a3ea4[_0x21d857]={'$like':'%'+_0x4a0f14[_0xe4ff('0x35')]['filter']+'%'};return _0x4a3ea4;})});}_0x1a299d=_[_0xe4ff('0x40')]({},_0x1a299d,_0x4a0f14[_0xe4ff('0x44')]);return _0x115820[_0xe4ff('0x90')](_0x1a299d);}})[_0xe4ff('0x25')](function(_0x214154){if(_0x214154){_0x3f3f01=_0x214154[_0xe4ff('0x39')];if(!_0x4a0f14[_0xe4ff('0x35')]['hasOwnProperty'](_0xe4ff('0x3b'))){_0x1a299d[_0xe4ff('0x1c')]=qs['limit'](_0x4a0f14[_0xe4ff('0x35')]['limit']);_0x1a299d[_0xe4ff('0x1d')]=qs['offset'](_0x4a0f14[_0xe4ff('0x35')][_0xe4ff('0x1d')]);}return _0x115820[_0xe4ff('0x90')](_0x1a299d);}})[_0xe4ff('0x25')](function(_0x1186ef){if(_0x1186ef){return _0x1186ef?{'count':_0x3f3f01,'rows':_0x1186ef}:null;}})[_0xe4ff('0x25')](respondWithResult(_0x579758,null))['catch'](handleError(_0x579758,null));};exports['addBlackLists']=function(_0x181664,_0x51c41a,_0x144ae1){var _0x5414b2,_0x1a0410;var _0x132f75=[];var _0x5a8d48=moment()[_0xe4ff('0x91')](_0xe4ff('0x69'));return db[_0xe4ff('0x30')]['find']({'where':{'id':_0x181664[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x51c41a,null))['then'](function(_0x129cf7){if(_0x129cf7){_0x1a0410=_0x129cf7;return _0x129cf7[_0xe4ff('0x92')](_0x181664[_0xe4ff('0x50')][_0xe4ff('0x8f')],_[_0xe4ff('0x58')](_0x181664[_0xe4ff('0x50')],[_0xe4ff('0x8f'),'id'])||{});}return null;})[_0xe4ff('0x6a')](function(_0x371801){var _0x3a0a2c;var _0x49f8e0;_0x5414b2=_0x371801||[];var _0x5b8598=[];if(_0x371801){for(var _0x218739=0x0;_0x218739<_0x371801[_0xe4ff('0x39')];_0x218739+=0x1){var _0xf623a2=_0x371801[_0x218739][_0xe4ff('0x27')]({'plain':!![]});_0x3a0a2c=squel[_0xe4ff('0x6d')]()[_0xe4ff('0x6e')](_0xe4ff('0x93'))[_0xe4ff('0x6f')](['phone',_0xe4ff('0x71'),_0xe4ff('0x72'),_0xe4ff('0x5e'),'createdAt',_0xe4ff('0x5a')],squel[_0xe4ff('0x80')]()[_0xe4ff('0x73')]('phone',_0xe4ff('0x70'))[_0xe4ff('0x73')]('id',_0xe4ff('0x71'))[_0xe4ff('0x73')](_0xf623a2[_0xe4ff('0x7b')][_0xe4ff('0x76')](),_0xe4ff('0x72'))['field'](_0x181664[_0xe4ff('0x4b')]['id']['toString'](),'CampaignId')[_0xe4ff('0x73')](_0xe4ff('0x74'),_0xe4ff('0x59'))[_0xe4ff('0x73')](_0xe4ff('0x74'),_0xe4ff('0x5a'))[_0xe4ff('0x77')]('cm_contacts')[_0xe4ff('0x3e')](_0xe4ff('0x79'))[_0xe4ff('0x3e')](_0xe4ff('0x7a'),_0xf623a2['CmListId']['toString']())[_0xe4ff('0x3e')](_0xe4ff('0x7c')))['toString']();_0x5b8598[_0xe4ff('0x8b')](db['sequelize'][_0xe4ff('0x35')](_0x3a0a2c));}return BPromise[_0xe4ff('0x8d')](_0x5b8598);}})[_0xe4ff('0x25')](function(){return _0x5414b2;})[_0xe4ff('0x25')](respondWithResult(_0x51c41a,null))[_0xe4ff('0x49')](handleError(_0x51c41a,null));};exports['removeBlackLists']=function(_0x21d5ac,_0x266a54,_0x214a3b){return db[_0xe4ff('0x30')]['find']({'where':{'id':_0x21d5ac['params']['id']}})[_0xe4ff('0x25')](handleEntityNotFound(_0x266a54,null))[_0xe4ff('0x25')](function(_0x1a3265){if(_0x1a3265){return _0x1a3265['removeBlackLists'](_0x21d5ac[_0xe4ff('0x35')][_0xe4ff('0x8f')]);}})['then'](function(_0x5b5882){if(_0x5b5882){return db[_0xe4ff('0x65')][_0xe4ff('0x26')]({'where':{'ListId':_0x21d5ac['query']['ids'],'CampaignId':_0x21d5ac[_0xe4ff('0x4b')]['id']}})['then'](function(){return _0x5b5882;});}})['then'](respondWithStatusCode(_0x266a54,null))[_0xe4ff('0x49')](handleError(_0x266a54,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index abad4c3..4d1d26e 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(_0x26b30a,_0xfb3217){var _0x269187=function(_0x468148){while(--_0x468148){_0x26b30a['push'](_0x26b30a['shift']());}};_0x269187(++_0xfb3217);}(_0x7a54,0x106));var _0x47a5=function(_0x47b928,_0x3c8344){_0x47b928=_0x47b928-0x0;var _0xa64cea=_0x7a54[_0x47b928];return _0xa64cea;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index fb9942d..dfaecd2 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 _0xaf80=['then','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCampaign','options','raw','attributes','limit','include','map','model'];(function(_0xa1b5fb,_0x41a2bd){var _0x123597=function(_0x1b3157){while(--_0x1b3157){_0xa1b5fb['push'](_0xa1b5fb['shift']());}};_0x123597(++_0x41a2bd);}(_0xaf80,0x1ef));var _0x0af8=function(_0x31c8fb,_0x3cf630){_0x31c8fb=_0x31c8fb-0x0;var _0x3c0773=_0xaf80[_0x31c8fb];return _0x3c0773;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bce2c,_0x28f555,_0x538c1c){return new BPromise(function(_0x207a9b,_0x430bd4){return client[_0x0af8('0xa')](_0x4bce2c,_0x538c1c)['then'](function(_0xc0d5eb){logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,'request\x20sent');logger['debug'](_0x0af8('0xd'),_0x28f555,_0x0af8('0xe'),JSON[_0x0af8('0xf')](_0xc0d5eb));if(_0xc0d5eb[_0x0af8('0x10')]){if(_0xc0d5eb[_0x0af8('0x10')]['code']===0x1f4){logger[_0x0af8('0x10')](_0x0af8('0xc'),_0x28f555,_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);return _0x430bd4(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}logger[_0x0af8('0x10')]('Campaign,\x20%s,\x20%s',_0x28f555,_0xc0d5eb['error'][_0x0af8('0x11')]);return _0x207a9b(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}else{logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,_0x0af8('0xe'));_0x207a9b(_0xc0d5eb[_0x0af8('0x12')][_0x0af8('0x11')]);}})['catch'](function(_0x5f4275){logger['error'](_0x0af8('0xc'),_0x28f555,_0x5f4275);_0x430bd4(_0x5f4275);});});}exports[_0x0af8('0x13')]=function(_0x54e946){var _0x2ace30=this;return new Promise(function(_0x230a68,_0x38068d){return db['Campaign']['findAll']({'raw':_0x54e946['options']?_0x54e946[_0x0af8('0x14')][_0x0af8('0x15')]===undefined?!![]:![]:!![],'where':_0x54e946['options']?_0x54e946[_0x0af8('0x14')]['where']||null:null,'attributes':_0x54e946['options']?_0x54e946[_0x0af8('0x14')][_0x0af8('0x16')]||null:null,'limit':_0x54e946[_0x0af8('0x14')]?_0x54e946[_0x0af8('0x14')][_0x0af8('0x17')]||null:null,'include':_0x54e946['options']?_0x54e946['options'][_0x0af8('0x18')]?_[_0x0af8('0x19')](_0x54e946[_0x0af8('0x14')][_0x0af8('0x18')],function(_0x320d0c){return{'model':db[_0x320d0c[_0x0af8('0x1a')]],'as':_0x320d0c['as'],'attributes':_0x320d0c[_0x0af8('0x16')],'include':_0x320d0c[_0x0af8('0x18')]?_['map'](_0x320d0c['include'],function(_0x1c6306){return{'model':db[_0x1c6306[_0x0af8('0x1a')]],'as':_0x1c6306['as'],'attributes':_0x1c6306[_0x0af8('0x16')],'include':_0x1c6306[_0x0af8('0x18')]?_['map'](_0x1c6306['include'],function(_0x315ad){return{'model':db[_0x315ad[_0x0af8('0x1a')]],'as':_0x315ad['as'],'attributes':_0x315ad[_0x0af8('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0af8('0x1b')](function(_0x2e8853){logger[_0x0af8('0xb')](_0x0af8('0x13'),_0x54e946);logger['debug'](_0x0af8('0x13'),_0x54e946,JSON[_0x0af8('0xf')](_0x2e8853));_0x230a68(_0x2e8853);})[_0x0af8('0x1c')](function(_0x20eab4){logger[_0x0af8('0x10')](_0x0af8('0x13'),_0x20eab4[_0x0af8('0x11')],_0x54e946);_0x38068d(_0x2ace30[_0x0af8('0x10')](0x1f4,_0x20eab4[_0x0af8('0x11')]));});});}; \ No newline at end of file +var _0x130d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetCampaign','Campaign','options','raw','where','attributes','include','map','model','stringify','lodash','moment','randomstring','ioredis'];(function(_0x1e2447,_0x5fea89){var _0x306f03=function(_0x11ac2c){while(--_0x11ac2c){_0x1e2447['push'](_0x1e2447['shift']());}};_0x306f03(++_0x5fea89);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var moment=require(_0xd130('0x1'));var BPromise=require('bluebird');var rs=require(_0xd130('0x2'));var fs=require('fs');var Redis=require(_0xd130('0x3'));var db=require(_0xd130('0x4'))['db'];var utils=require(_0xd130('0x5'));var logger=require(_0xd130('0x6'))(_0xd130('0x7'));var config=require(_0xd130('0x8'));var jayson=require(_0xd130('0x9'));var client=jayson[_0xd130('0xa')][_0xd130('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c215,_0x168ee7,_0x3f77e1){return new BPromise(function(_0x1b9875,_0x4a3818){return client[_0xd130('0xc')](_0x44c215,_0x3f77e1)['then'](function(_0x1cec3b){logger[_0xd130('0xd')](_0xd130('0xe'),_0x168ee7,'request\x20sent');logger[_0xd130('0xf')](_0xd130('0x10'),_0x168ee7,'request\x20sent',JSON['stringify'](_0x1cec3b));if(_0x1cec3b[_0xd130('0x11')]){if(_0x1cec3b['error'][_0xd130('0x12')]===0x1f4){logger[_0xd130('0x11')]('Campaign,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x4a3818(_0x1cec3b[_0xd130('0x11')]['message']);}logger['error']('Campaign,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x1b9875(_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);}else{logger[_0xd130('0xd')]('Campaign,\x20%s,\x20%s',_0x168ee7,_0xd130('0x14'));_0x1b9875(_0x1cec3b[_0xd130('0x15')][_0xd130('0x13')]);}})[_0xd130('0x16')](function(_0x57930b){logger[_0xd130('0x11')](_0xd130('0xe'),_0x168ee7,_0x57930b);_0x4a3818(_0x57930b);});});}exports[_0xd130('0x17')]=function(_0xce6d93){var _0x342eb2=this;return new Promise(function(_0xc1c504,_0x43ed26){return db[_0xd130('0x18')]['findAll']({'raw':_0xce6d93['options']?_0xce6d93[_0xd130('0x19')][_0xd130('0x1a')]===undefined?!![]:![]:!![],'where':_0xce6d93[_0xd130('0x19')]?_0xce6d93['options'][_0xd130('0x1b')]||null:null,'attributes':_0xce6d93[_0xd130('0x19')]?_0xce6d93[_0xd130('0x19')][_0xd130('0x1c')]||null:null,'limit':_0xce6d93[_0xd130('0x19')]?_0xce6d93[_0xd130('0x19')]['limit']||null:null,'include':_0xce6d93[_0xd130('0x19')]?_0xce6d93[_0xd130('0x19')][_0xd130('0x1d')]?_[_0xd130('0x1e')](_0xce6d93[_0xd130('0x19')][_0xd130('0x1d')],function(_0x15208f){return{'model':db[_0x15208f[_0xd130('0x1f')]],'as':_0x15208f['as'],'attributes':_0x15208f[_0xd130('0x1c')],'include':_0x15208f[_0xd130('0x1d')]?_['map'](_0x15208f[_0xd130('0x1d')],function(_0x44c560){return{'model':db[_0x44c560[_0xd130('0x1f')]],'as':_0x44c560['as'],'attributes':_0x44c560[_0xd130('0x1c')],'include':_0x44c560[_0xd130('0x1d')]?_[_0xd130('0x1e')](_0x44c560['include'],function(_0x31efe6){return{'model':db[_0x31efe6['model']],'as':_0x31efe6['as'],'attributes':_0x31efe6[_0xd130('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d31af){logger['info'](_0xd130('0x17'),_0xce6d93);logger[_0xd130('0xf')](_0xd130('0x17'),_0xce6d93,JSON[_0xd130('0x20')](_0x5d31af));_0xc1c504(_0x5d31af);})['catch'](function(_0x1d8d1c){logger[_0xd130('0x11')](_0xd130('0x17'),_0x1d8d1c['message'],_0xce6d93);_0x43ed26(_0x342eb2[_0xd130('0x11')](0x1f4,_0x1d8d1c['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index ceb618c..4b32c08 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 _0xe827=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','post','create','clone','addLists','addBlackLists','destroy','delete','removeBlackLists','multer','util','path'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0xe827,0x1dd));var _0x7e82=function(_0x3a2d49,_0x53d190){_0x3a2d49=_0x3a2d49-0x0;var _0x277b78=_0xe827[_0x3a2d49];return _0x277b78;};'use strict';var multer=require(_0x7e82('0x0'));var util=require(_0x7e82('0x1'));var path=require(_0x7e82('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e82('0x3'));var router=express[_0x7e82('0x4')]();var fs_extra=require(_0x7e82('0x5'));var auth=require(_0x7e82('0x6'));var interaction=require(_0x7e82('0x7'));var config=require(_0x7e82('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x7e82('0x9')](),controller[_0x7e82('0xa')]);router[_0x7e82('0xb')](_0x7e82('0xc'),auth['isAuthenticated'](),controller[_0x7e82('0xd')]);router['get'](_0x7e82('0xe'),auth[_0x7e82('0x9')](),controller[_0x7e82('0xf')]);router['get'](_0x7e82('0x10'),auth['isAuthenticated'](),controller[_0x7e82('0x11')]);router[_0x7e82('0xb')](_0x7e82('0x12'),auth[_0x7e82('0x9')](),controller[_0x7e82('0x13')]);router['get'](_0x7e82('0x14'),auth[_0x7e82('0x9')](),controller['getHopperBlacks']);router['get'](_0x7e82('0x15'),auth[_0x7e82('0x9')](),controller[_0x7e82('0x16')]);router[_0x7e82('0xb')](_0x7e82('0x17'),auth[_0x7e82('0x9')](),controller['getBlackLists']);router[_0x7e82('0x18')]('/',auth[_0x7e82('0x9')](),controller[_0x7e82('0x19')]);router[_0x7e82('0x18')]('/:id/clone',auth[_0x7e82('0x9')](),controller[_0x7e82('0x1a')]);router['post'](_0x7e82('0x15'),auth[_0x7e82('0x9')](),controller[_0x7e82('0x1b')]);router[_0x7e82('0x18')](_0x7e82('0x17'),auth[_0x7e82('0x9')](),controller[_0x7e82('0x1c')]);router['put'](_0x7e82('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x7e82('0x9')](),controller[_0x7e82('0x1d')]);router[_0x7e82('0x1e')](_0x7e82('0x15'),auth[_0x7e82('0x9')](),controller['removeLists']);router[_0x7e82('0x1e')]('/:id/blacklists',auth[_0x7e82('0x9')](),controller[_0x7e82('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x6e12=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','/:id','destroy','/:id/lists','removeLists','removeBlackLists','exports'];(function(_0x258c5e,_0x407908){var _0x4ce92e=function(_0x1fd85e){while(--_0x1fd85e){_0x258c5e['push'](_0x258c5e['shift']());}};_0x4ce92e(++_0x407908);}(_0x6e12,0x154));var _0x26e1=function(_0xe240db,_0x1740a9){_0xe240db=_0xe240db-0x0;var _0x30de38=_0x6e12[_0xe240db];return _0x30de38;};'use strict';var multer=require(_0x26e1('0x0'));var util=require(_0x26e1('0x1'));var path=require(_0x26e1('0x2'));var timeout=require(_0x26e1('0x3'));var express=require('express');var router=express[_0x26e1('0x4')]();var fs_extra=require(_0x26e1('0x5'));var auth=require(_0x26e1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x26e1('0x7'));router[_0x26e1('0x8')]('/',auth[_0x26e1('0x9')](),controller[_0x26e1('0xa')]);router[_0x26e1('0x8')]('/:id',auth[_0x26e1('0x9')](),controller[_0x26e1('0xb')]);router[_0x26e1('0x8')](_0x26e1('0xc'),auth[_0x26e1('0x9')](),controller['getHoppers']);router[_0x26e1('0x8')](_0x26e1('0xd'),auth[_0x26e1('0x9')](),controller['getHopperHistories']);router[_0x26e1('0x8')](_0x26e1('0xe'),auth[_0x26e1('0x9')](),controller[_0x26e1('0xf')]);router[_0x26e1('0x8')]('/:id/hopper_black',auth[_0x26e1('0x9')](),controller[_0x26e1('0x10')]);router[_0x26e1('0x8')]('/:id/lists',auth[_0x26e1('0x9')](),controller[_0x26e1('0x11')]);router[_0x26e1('0x8')](_0x26e1('0x12'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x26e1('0x13')]('/',auth[_0x26e1('0x9')](),controller[_0x26e1('0x14')]);router[_0x26e1('0x13')](_0x26e1('0x15'),auth['isAuthenticated'](),controller[_0x26e1('0x16')]);router[_0x26e1('0x13')]('/:id/lists',auth[_0x26e1('0x9')](),controller[_0x26e1('0x17')]);router[_0x26e1('0x13')](_0x26e1('0x12'),auth[_0x26e1('0x9')](),controller[_0x26e1('0x18')]);router[_0x26e1('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x26e1('0x1a')]);router[_0x26e1('0x1b')](_0x26e1('0x1c'),auth['isAuthenticated'](),controller[_0x26e1('0x1d')]);router['delete'](_0x26e1('0x1e'),auth['isAuthenticated'](),controller[_0x26e1('0x1f')]);router[_0x26e1('0x1b')](_0x26e1('0x12'),auth['isAuthenticated'](),controller[_0x26e1('0x20')]);module[_0x26e1('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f316bb7..72c1c9b 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 _0x415f=['sequelize','exports','STRING','TEXT'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x415f,0x70));var _0xf415=function(_0x32007b,_0x29939e){_0x32007b=_0x32007b-0x0;var _0x596b8b=_0x415f[_0x32007b];return _0x596b8b;};'use strict';var Sequelize=require(_0xf415('0x0'));module[_0xf415('0x1')]={'key':{'type':Sequelize[_0xf415('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xf415('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xf415('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x002b=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0x002b,0x11b));var _0xb002=function(_0x493985,_0xabbee5){_0x493985=_0x493985-0x0;var _0x532b94=_0x002b[_0x493985];return _0x532b94;};'use strict';var Sequelize=require(_0xb002('0x0'));module[_0xb002('0x1')]={'key':{'type':Sequelize[_0xb002('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb002('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb002('0x2')]},'name':{'type':Sequelize[_0xb002('0x4')],'get':function(){return this[_0xb002('0x5')](_0xb002('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c59ee3e..b78e7b3 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 _0x197e=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','CannedAnswers','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','CannedAnswer','count','include','rows','catch','show','rawAttributes','includeAll','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x197e,0x1cc));var _0xe197=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x197e[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xe197('0x0'));var rimraf=require(_0xe197('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe197('0x2'));var moment=require(_0xe197('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe197('0x4'));var util=require('util');var path=require(_0xe197('0x5'));var sox=require(_0xe197('0x6'));var csv=require(_0xe197('0x7'));var ejs=require(_0xe197('0x8'));var fs=require('fs');var fs_extra=require(_0xe197('0x9'));var _=require(_0xe197('0xa'));var squel=require('squel');var crypto=require(_0xe197('0xb'));var jsforce=require(_0xe197('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe197('0x7'));var querystring=require(_0xe197('0xd'));var Papa=require(_0xe197('0xe'));var Redis=require(_0xe197('0xf'));var authService=require(_0xe197('0x10'));var qs=require(_0xe197('0x11'));var as=require(_0xe197('0x12'));var hardwareService=require(_0xe197('0x13'));var logger=require(_0xe197('0x14'))(_0xe197('0x15'));var utils=require(_0xe197('0x16'));var config=require(_0xe197('0x17'));var licenseUtil=require(_0xe197('0x18'));var db=require(_0xe197('0x19'))['db'];function respondWithStatusCode(_0x4450a5,_0x5e4779){_0x5e4779=_0x5e4779||0xcc;return function(_0x53a002){if(_0x53a002){return _0x4450a5['sendStatus'](_0x5e4779);}return _0x4450a5[_0xe197('0x1a')](_0x5e4779)[_0xe197('0x1b')]();};}function respondWithResult(_0x5f3b94,_0x74641c){_0x74641c=_0x74641c||0xc8;return function(_0xd700aa){if(_0xd700aa){return _0x5f3b94[_0xe197('0x1a')](_0x74641c)[_0xe197('0x1c')](_0xd700aa);}};}function respondWithFilteredResult(_0x23763c,_0x36cac1){return function(_0x320314){if(_0x320314){var _0x12628d=typeof _0x36cac1[_0xe197('0x1d')]===_0xe197('0x1e')&&typeof _0x36cac1[_0xe197('0x1f')]===_0xe197('0x1e');var _0x479df4=_0x320314['count'];var _0x1c0b7c=_0x12628d?0x0:_0x36cac1[_0xe197('0x1d')];var _0x112283=_0x12628d?_0x320314['count']:_0x36cac1[_0xe197('0x1d')]+_0x36cac1['limit'];var _0x447472;if(_0x112283>=_0x479df4){_0x112283=_0x479df4;_0x447472=0xc8;}else{_0x447472=0xce;}_0x23763c[_0xe197('0x1a')](_0x447472);return _0x23763c[_0xe197('0x20')](_0xe197('0x21'),_0x1c0b7c+'-'+_0x112283+'/'+_0x479df4)[_0xe197('0x1c')](_0x320314);}return null;};}function patchUpdates(_0x23df4b){return function(_0x259a2b){try{jsonpatch[_0xe197('0x22')](_0x259a2b,_0x23df4b,!![]);}catch(_0xf81da8){return BPromise[_0xe197('0x23')](_0xf81da8);}return _0x259a2b[_0xe197('0x24')]();};}function saveUpdates(_0x1cb871,_0x3f6b11){return function(_0x5b9f3d){if(_0x5b9f3d){return _0x5b9f3d[_0xe197('0x25')](_0x1cb871)[_0xe197('0x26')](function(_0x47617b){return _0x47617b;});}return null;};}function removeEntity(_0x410c79,_0x43b1ae){return function(_0x1f43e2){if(_0x1f43e2){return _0x1f43e2['destroy']()[_0xe197('0x26')](function(){var _0x3e3cd3=_0x1f43e2['get']({'plain':!![]});var _0x427fcc=_0xe197('0x27');return db[_0xe197('0x28')][_0xe197('0x29')]({'where':{'type':_0x427fcc,'resourceId':_0x3e3cd3['id']}})[_0xe197('0x26')](function(){return _0x1f43e2;});})[_0xe197('0x26')](function(){_0x410c79[_0xe197('0x1a')](0xcc)[_0xe197('0x1b')]();});}};}function handleEntityNotFound(_0x36c44c,_0x1b3d79){return function(_0x55d253){if(!_0x55d253){_0x36c44c[_0xe197('0x2a')](0x194);}return _0x55d253;};}function handleError(_0x1d4b9b,_0x31b57b){_0x31b57b=_0x31b57b||0x1f4;return function(_0x312196){logger[_0xe197('0x2b')](_0x312196[_0xe197('0x2c')]);if(_0x312196[_0xe197('0x2d')]){delete _0x312196[_0xe197('0x2d')];}_0x1d4b9b[_0xe197('0x1a')](_0x31b57b)[_0xe197('0x2e')](_0x312196);};}exports[_0xe197('0x2f')]=function(_0x4e7fe8,_0x36c9fb){var _0x463d5b={},_0x5496bc={},_0x49c201={'count':0x0,'rows':[]};var _0x16e6ea=_[_0xe197('0x30')](db['CannedAnswer']['rawAttributes'],function(_0x1813ca){return{'name':_0x1813ca[_0xe197('0x31')],'type':_0x1813ca['type'][_0xe197('0x32')]};});_0x5496bc[_0xe197('0x33')]=_[_0xe197('0x30')](_0x16e6ea,_0xe197('0x2d'));_0x5496bc[_0xe197('0x34')]=_[_0xe197('0x35')](_0x4e7fe8[_0xe197('0x34')]);_0x5496bc['filters']=_[_0xe197('0x36')](_0x5496bc[_0xe197('0x33')],_0x5496bc[_0xe197('0x34')]);_0x463d5b['attributes']=_[_0xe197('0x36')](_0x5496bc[_0xe197('0x33')],qs[_0xe197('0x37')](_0x4e7fe8[_0xe197('0x34')][_0xe197('0x37')]));_0x463d5b[_0xe197('0x38')]=_0x463d5b['attributes'][_0xe197('0x39')]?_0x463d5b[_0xe197('0x38')]:_0x5496bc[_0xe197('0x33')];if(!_0x4e7fe8[_0xe197('0x34')][_0xe197('0x3a')](_0xe197('0x3b'))){_0x463d5b[_0xe197('0x1f')]=qs['limit'](_0x4e7fe8[_0xe197('0x34')][_0xe197('0x1f')]);_0x463d5b[_0xe197('0x1d')]=qs[_0xe197('0x1d')](_0x4e7fe8['query'][_0xe197('0x1d')]);}_0x463d5b[_0xe197('0x3c')]=qs[_0xe197('0x3d')](_0x4e7fe8[_0xe197('0x34')][_0xe197('0x3d')]);_0x463d5b[_0xe197('0x3e')]=qs[_0xe197('0x3f')](_[_0xe197('0x40')](_0x4e7fe8[_0xe197('0x34')],_0x5496bc[_0xe197('0x3f')]),_0x16e6ea);if(_0x4e7fe8[_0xe197('0x34')][_0xe197('0x41')]){_0x463d5b[_0xe197('0x3e')]=_['merge'](_0x463d5b['where'],{'$or':[{'key':{'$like':'%'+_0x4e7fe8[_0xe197('0x34')][_0xe197('0x41')]+'%'}},{'value':{'$like':'%'+_0x4e7fe8['query']['filter']+'%'}}]});}_0x463d5b=_[_0xe197('0x42')]({},_0x463d5b,_0x4e7fe8[_0xe197('0x43')]);var _0xdd4f7c={'where':_0x463d5b[_0xe197('0x3e')]};return db[_0xe197('0x44')][_0xe197('0x45')](_0xdd4f7c)[_0xe197('0x26')](function(_0x283c7e){_0x49c201['count']=_0x283c7e;if(_0x4e7fe8[_0xe197('0x34')]['includeAll']){_0x463d5b[_0xe197('0x46')]=[{'all':!![]}];}return db[_0xe197('0x44')]['findAll'](_0x463d5b);})[_0xe197('0x26')](function(_0x28c027){_0x49c201[_0xe197('0x47')]=_0x28c027;return _0x49c201;})[_0xe197('0x26')](respondWithFilteredResult(_0x36c9fb,_0x463d5b))[_0xe197('0x48')](handleError(_0x36c9fb,null));};exports[_0xe197('0x49')]=function(_0x16ec13,_0x5de306){var _0x53bd79={'raw':!![],'where':{'id':_0x16ec13['params']['id']}},_0x2ca1be={};_0x2ca1be[_0xe197('0x33')]=_[_0xe197('0x35')](db[_0xe197('0x44')][_0xe197('0x4a')]);_0x2ca1be[_0xe197('0x34')]=_[_0xe197('0x35')](_0x16ec13[_0xe197('0x34')]);_0x2ca1be['filters']=_[_0xe197('0x36')](_0x2ca1be[_0xe197('0x33')],_0x2ca1be[_0xe197('0x34')]);_0x53bd79[_0xe197('0x38')]=_[_0xe197('0x36')](_0x2ca1be[_0xe197('0x33')],qs[_0xe197('0x37')](_0x16ec13[_0xe197('0x34')][_0xe197('0x37')]));_0x53bd79[_0xe197('0x38')]=_0x53bd79[_0xe197('0x38')]['length']?_0x53bd79[_0xe197('0x38')]:_0x2ca1be[_0xe197('0x33')];if(_0x16ec13[_0xe197('0x34')][_0xe197('0x4b')]){_0x53bd79[_0xe197('0x46')]=[{'all':!![]}];}_0x53bd79=_[_0xe197('0x42')]({},_0x53bd79,_0x16ec13['options']);return db[_0xe197('0x44')][_0xe197('0x4c')](_0x53bd79)['then'](handleEntityNotFound(_0x5de306,null))[_0xe197('0x26')](respondWithResult(_0x5de306,null))[_0xe197('0x48')](handleError(_0x5de306,null));};exports[_0xe197('0x25')]=function(_0x3326f6,_0x1b8952){if(_0x3326f6[_0xe197('0x4d')]['id']){delete _0x3326f6[_0xe197('0x4d')]['id'];}return db[_0xe197('0x44')]['find']({'where':{'id':_0x3326f6[_0xe197('0x4e')]['id']}})[_0xe197('0x26')](handleEntityNotFound(_0x1b8952,null))[_0xe197('0x26')](saveUpdates(_0x3326f6[_0xe197('0x4d')],null))[_0xe197('0x26')](respondWithResult(_0x1b8952,null))[_0xe197('0x48')](handleError(_0x1b8952,null));};exports[_0xe197('0x29')]=function(_0x204918,_0x931929){return db[_0xe197('0x44')][_0xe197('0x4c')]({'where':{'id':_0x204918[_0xe197('0x4e')]['id']}})[_0xe197('0x26')](handleEntityNotFound(_0x931929,null))[_0xe197('0x26')](removeEntity(_0x931929,null))[_0xe197('0x48')](handleError(_0x931929,null));};exports[_0xe197('0x4f')]=function(_0x4ba528,_0x5cdbd5){var _0xd6b302={'key':_0x4ba528[_0xe197('0x4d')][_0xe197('0x32')]};if(_0x4ba528[_0xe197('0x4d')][_0xe197('0x50')]){_0xd6b302[_0xe197('0x50')]=_0x4ba528[_0xe197('0x4d')][_0xe197('0x50')];}else if(_0x4ba528[_0xe197('0x4d')][_0xe197('0x51')]){_0xd6b302['SmsAccountId']=_0x4ba528[_0xe197('0x4d')][_0xe197('0x51')];}else if(_0x4ba528[_0xe197('0x4d')][_0xe197('0x52')]){_0xd6b302[_0xe197('0x52')]=_0x4ba528[_0xe197('0x4d')][_0xe197('0x52')];}else if(_0x4ba528[_0xe197('0x4d')][_0xe197('0x53')]){_0xd6b302['ChatWebsiteId']=_0x4ba528['body']['ChatWebsiteId'];}return db[_0xe197('0x44')]['find']({'where':_0xd6b302})['then'](function(_0x596d82){if(_0x596d82){throw new db[(_0xe197('0x54'))]['ValidationError'](_0xe197('0x55'));}return db['CannedAnswer'][_0xe197('0x4f')](_0x4ba528[_0xe197('0x4d')]);})[_0xe197('0x26')](function(_0x1f8b31){var _0x2a1de0=_0x4ba528['user'][_0xe197('0x56')]({'plain':!![]});if(!_0x2a1de0)throw new Error(_0xe197('0x57'));if(_0x2a1de0['role']==='user'){var _0x3d35c3=_0x1f8b31[_0xe197('0x56')]({'plain':!![]});return db[_0xe197('0x58')]['find']({'where':{'name':_0xe197('0x27'),'userProfileId':_0x2a1de0[_0xe197('0x59')]},'raw':!![]})['then'](function(_0x40ccfb){if(_0x40ccfb&&_0x40ccfb[_0xe197('0x5a')]===0x0){return db[_0xe197('0x28')][_0xe197('0x4f')]({'name':_0x3d35c3[_0xe197('0x2d')],'resourceId':_0x3d35c3['id'],'type':_0x40ccfb[_0xe197('0x2d')],'sectionId':_0x40ccfb['id']},{})[_0xe197('0x26')](function(){return _0x1f8b31;});}else{return _0x1f8b31;}})['catch'](function(_0x4ed6eb){logger[_0xe197('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ed6eb);throw _0x4ed6eb;});}return _0x1f8b31;})[_0xe197('0x26')](respondWithResult(_0x5cdbd5,0xc9))[_0xe197('0x48')](handleError(_0x5cdbd5,null));}; \ No newline at end of file +var _0x7812=['map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','CannedAnswer','includeAll','findAll','rows','catch','show','params','keys','include','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','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','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','index'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x7812,0x18f));var _0x2781=function(_0x978359,_0x5755b9){_0x978359=_0x978359-0x0;var _0x4c1f55=_0x7812[_0x978359];return _0x4c1f55;};'use strict';var emlformat=require(_0x2781('0x0'));var rimraf=require(_0x2781('0x1'));var zipdir=require(_0x2781('0x2'));var jsonpatch=require(_0x2781('0x3'));var rp=require(_0x2781('0x4'));var moment=require(_0x2781('0x5'));var BPromise=require(_0x2781('0x6'));var Mustache=require(_0x2781('0x7'));var util=require(_0x2781('0x8'));var path=require(_0x2781('0x9'));var sox=require(_0x2781('0xa'));var csv=require('to-csv');var ejs=require(_0x2781('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2781('0xc'));var squel=require(_0x2781('0xd'));var crypto=require(_0x2781('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2781('0xf'));var querystring=require(_0x2781('0x10'));var Papa=require(_0x2781('0x11'));var Redis=require('ioredis');var authService=require(_0x2781('0x12'));var qs=require(_0x2781('0x13'));var as=require(_0x2781('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2781('0x15'));var utils=require('../../config/utils');var config=require(_0x2781('0x16'));var licenseUtil=require(_0x2781('0x17'));var db=require(_0x2781('0x18'))['db'];function respondWithStatusCode(_0x522c78,_0x10f2e3){_0x10f2e3=_0x10f2e3||0xcc;return function(_0x2ad274){if(_0x2ad274){return _0x522c78['sendStatus'](_0x10f2e3);}return _0x522c78[_0x2781('0x19')](_0x10f2e3)[_0x2781('0x1a')]();};}function respondWithResult(_0x449e1e,_0x494a20){_0x494a20=_0x494a20||0xc8;return function(_0x71033){if(_0x71033){return _0x449e1e['status'](_0x494a20)[_0x2781('0x1b')](_0x71033);}};}function respondWithFilteredResult(_0x330f81,_0x3cfca7){return function(_0x17e5d9){if(_0x17e5d9){var _0x45e68b=typeof _0x3cfca7[_0x2781('0x1c')]===_0x2781('0x1d')&&typeof _0x3cfca7[_0x2781('0x1e')]===_0x2781('0x1d');var _0x2c0f27=_0x17e5d9[_0x2781('0x1f')];var _0x1add23=_0x45e68b?0x0:_0x3cfca7[_0x2781('0x1c')];var _0x4c7409=_0x45e68b?_0x17e5d9[_0x2781('0x1f')]:_0x3cfca7[_0x2781('0x1c')]+_0x3cfca7[_0x2781('0x1e')];var _0x1805e7;if(_0x4c7409>=_0x2c0f27){_0x4c7409=_0x2c0f27;_0x1805e7=0xc8;}else{_0x1805e7=0xce;}_0x330f81['status'](_0x1805e7);return _0x330f81['set'](_0x2781('0x20'),_0x1add23+'-'+_0x4c7409+'/'+_0x2c0f27)[_0x2781('0x1b')](_0x17e5d9);}return null;};}function patchUpdates(_0x2059a9){return function(_0x755500){try{jsonpatch[_0x2781('0x21')](_0x755500,_0x2059a9,!![]);}catch(_0x9b1a80){return BPromise['reject'](_0x9b1a80);}return _0x755500[_0x2781('0x22')]();};}function saveUpdates(_0x5b9ee7,_0x3fc979){return function(_0x296e42){if(_0x296e42){return _0x296e42[_0x2781('0x23')](_0x5b9ee7)[_0x2781('0x24')](function(_0x5d5bcb){return _0x5d5bcb;});}return null;};}function removeEntity(_0x425b8a,_0x532d1b){return function(_0x527f5d){if(_0x527f5d){return _0x527f5d[_0x2781('0x25')]()[_0x2781('0x24')](function(){var _0x29e297=_0x527f5d[_0x2781('0x26')]({'plain':!![]});var _0x1b0d94=_0x2781('0x27');return db[_0x2781('0x28')][_0x2781('0x25')]({'where':{'type':_0x1b0d94,'resourceId':_0x29e297['id']}})[_0x2781('0x24')](function(){return _0x527f5d;});})[_0x2781('0x24')](function(){_0x425b8a[_0x2781('0x19')](0xcc)[_0x2781('0x1a')]();});}};}function handleEntityNotFound(_0x17c9f3,_0x3cd61e){return function(_0x967f86){if(!_0x967f86){_0x17c9f3[_0x2781('0x29')](0x194);}return _0x967f86;};}function handleError(_0x2aaa74,_0xc5bebb){_0xc5bebb=_0xc5bebb||0x1f4;return function(_0x1c3119){logger[_0x2781('0x2a')](_0x1c3119[_0x2781('0x2b')]);if(_0x1c3119[_0x2781('0x2c')]){delete _0x1c3119[_0x2781('0x2c')];}_0x2aaa74[_0x2781('0x19')](_0xc5bebb)['send'](_0x1c3119);};}exports[_0x2781('0x2d')]=function(_0xc3149e,_0xca5d0f){var _0x2bee73={},_0x492eaa={},_0x2abac3={'count':0x0,'rows':[]};var _0x1de59e=_[_0x2781('0x2e')](db['CannedAnswer'][_0x2781('0x2f')],function(_0x556809){return{'name':_0x556809[_0x2781('0x30')],'type':_0x556809[_0x2781('0x31')][_0x2781('0x32')]};});_0x492eaa[_0x2781('0x33')]=_[_0x2781('0x2e')](_0x1de59e,_0x2781('0x2c'));_0x492eaa[_0x2781('0x34')]=_['keys'](_0xc3149e[_0x2781('0x34')]);_0x492eaa[_0x2781('0x35')]=_['intersection'](_0x492eaa[_0x2781('0x33')],_0x492eaa[_0x2781('0x34')]);_0x2bee73[_0x2781('0x36')]=_[_0x2781('0x37')](_0x492eaa[_0x2781('0x33')],qs[_0x2781('0x38')](_0xc3149e[_0x2781('0x34')]['fields']));_0x2bee73['attributes']=_0x2bee73[_0x2781('0x36')][_0x2781('0x39')]?_0x2bee73[_0x2781('0x36')]:_0x492eaa[_0x2781('0x33')];if(!_0xc3149e[_0x2781('0x34')][_0x2781('0x3a')](_0x2781('0x3b'))){_0x2bee73[_0x2781('0x1e')]=qs[_0x2781('0x1e')](_0xc3149e[_0x2781('0x34')]['limit']);_0x2bee73[_0x2781('0x1c')]=qs[_0x2781('0x1c')](_0xc3149e['query']['offset']);}_0x2bee73['order']=qs[_0x2781('0x3c')](_0xc3149e['query'][_0x2781('0x3c')]);_0x2bee73[_0x2781('0x3d')]=qs[_0x2781('0x35')](_[_0x2781('0x3e')](_0xc3149e['query'],_0x492eaa['filters']),_0x1de59e);if(_0xc3149e[_0x2781('0x34')]['filter']){_0x2bee73[_0x2781('0x3d')]=_[_0x2781('0x3f')](_0x2bee73[_0x2781('0x3d')],{'$or':[{'key':{'$like':'%'+_0xc3149e[_0x2781('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0xc3149e[_0x2781('0x34')][_0x2781('0x40')]+'%'}}]});}_0x2bee73=_[_0x2781('0x3f')]({},_0x2bee73,_0xc3149e[_0x2781('0x41')]);var _0x3a2b35={'where':_0x2bee73[_0x2781('0x3d')]};return db[_0x2781('0x42')][_0x2781('0x1f')](_0x3a2b35)['then'](function(_0x2a85a5){_0x2abac3[_0x2781('0x1f')]=_0x2a85a5;if(_0xc3149e[_0x2781('0x34')][_0x2781('0x43')]){_0x2bee73['include']=[{'all':!![]}];}return db[_0x2781('0x42')][_0x2781('0x44')](_0x2bee73);})[_0x2781('0x24')](function(_0x307bb9){_0x2abac3[_0x2781('0x45')]=_0x307bb9;return _0x2abac3;})[_0x2781('0x24')](respondWithFilteredResult(_0xca5d0f,_0x2bee73))[_0x2781('0x46')](handleError(_0xca5d0f,null));};exports[_0x2781('0x47')]=function(_0x24085e,_0x4f4468){var _0x10e9fa={'raw':!![],'where':{'id':_0x24085e[_0x2781('0x48')]['id']}},_0x4b19f0={};_0x4b19f0['model']=_[_0x2781('0x49')](db['CannedAnswer'][_0x2781('0x2f')]);_0x4b19f0[_0x2781('0x34')]=_[_0x2781('0x49')](_0x24085e['query']);_0x4b19f0['filters']=_[_0x2781('0x37')](_0x4b19f0[_0x2781('0x33')],_0x4b19f0[_0x2781('0x34')]);_0x10e9fa[_0x2781('0x36')]=_[_0x2781('0x37')](_0x4b19f0[_0x2781('0x33')],qs[_0x2781('0x38')](_0x24085e[_0x2781('0x34')]['fields']));_0x10e9fa[_0x2781('0x36')]=_0x10e9fa[_0x2781('0x36')][_0x2781('0x39')]?_0x10e9fa[_0x2781('0x36')]:_0x4b19f0[_0x2781('0x33')];if(_0x24085e[_0x2781('0x34')][_0x2781('0x43')]){_0x10e9fa[_0x2781('0x4a')]=[{'all':!![]}];}_0x10e9fa=_[_0x2781('0x3f')]({},_0x10e9fa,_0x24085e[_0x2781('0x41')]);return db['CannedAnswer'][_0x2781('0x4b')](_0x10e9fa)[_0x2781('0x24')](handleEntityNotFound(_0x4f4468,null))[_0x2781('0x24')](respondWithResult(_0x4f4468,null))[_0x2781('0x46')](handleError(_0x4f4468,null));};exports[_0x2781('0x23')]=function(_0x50c4bb,_0x54a710){if(_0x50c4bb[_0x2781('0x4c')]['id']){delete _0x50c4bb[_0x2781('0x4c')]['id'];}return db[_0x2781('0x42')][_0x2781('0x4b')]({'where':{'id':_0x50c4bb['params']['id']}})[_0x2781('0x24')](handleEntityNotFound(_0x54a710,null))[_0x2781('0x24')](saveUpdates(_0x50c4bb[_0x2781('0x4c')],null))['then'](respondWithResult(_0x54a710,null))[_0x2781('0x46')](handleError(_0x54a710,null));};exports[_0x2781('0x25')]=function(_0x1f0320,_0x7587f3){return db[_0x2781('0x42')][_0x2781('0x4b')]({'where':{'id':_0x1f0320['params']['id']}})[_0x2781('0x24')](handleEntityNotFound(_0x7587f3,null))[_0x2781('0x24')](removeEntity(_0x7587f3,null))[_0x2781('0x46')](handleError(_0x7587f3,null));};exports['create']=function(_0x3c5d12,_0x2d0c8b){var _0x6e5dda={'key':_0x3c5d12[_0x2781('0x4c')][_0x2781('0x32')]};if(_0x3c5d12[_0x2781('0x4c')][_0x2781('0x4d')]){_0x6e5dda['MailAccountId']=_0x3c5d12[_0x2781('0x4c')][_0x2781('0x4d')];}else if(_0x3c5d12[_0x2781('0x4c')][_0x2781('0x4e')]){_0x6e5dda[_0x2781('0x4e')]=_0x3c5d12['body'][_0x2781('0x4e')];}else if(_0x3c5d12[_0x2781('0x4c')][_0x2781('0x4f')]){_0x6e5dda[_0x2781('0x4f')]=_0x3c5d12['body'][_0x2781('0x4f')];}else if(_0x3c5d12[_0x2781('0x4c')][_0x2781('0x50')]){_0x6e5dda['ChatWebsiteId']=_0x3c5d12[_0x2781('0x4c')][_0x2781('0x50')];}return db['CannedAnswer'][_0x2781('0x4b')]({'where':_0x6e5dda})[_0x2781('0x24')](function(_0xbcb0d5){if(_0xbcb0d5){throw new db['Sequelize']['ValidationError'](_0x2781('0x51'));}return db[_0x2781('0x42')][_0x2781('0x52')](_0x3c5d12[_0x2781('0x4c')]);})['then'](function(_0x1f8ceb){var _0x299b46=_0x3c5d12[_0x2781('0x53')][_0x2781('0x26')]({'plain':!![]});if(!_0x299b46)throw new Error(_0x2781('0x54'));if(_0x299b46[_0x2781('0x55')]===_0x2781('0x53')){var _0x9d3218=_0x1f8ceb[_0x2781('0x26')]({'plain':!![]});return db[_0x2781('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x299b46[_0x2781('0x57')]},'raw':!![]})[_0x2781('0x24')](function(_0x52fb10){if(_0x52fb10&&_0x52fb10['autoAssociation']===0x0){return db[_0x2781('0x28')][_0x2781('0x52')]({'name':_0x9d3218[_0x2781('0x2c')],'resourceId':_0x9d3218['id'],'type':_0x52fb10[_0x2781('0x2c')],'sectionId':_0x52fb10['id']},{})['then'](function(){return _0x1f8ceb;});}else{return _0x1f8ceb;}})['catch'](function(_0x2a1b30){logger[_0x2781('0x2a')](_0x2781('0x58'),_0x2a1b30);throw _0x2a1b30;});}return _0x1f8ceb;})[_0x2781('0x24')](respondWithResult(_0x2d0c8b,0xc9))[_0x2781('0x46')](handleError(_0x2d0c8b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index af35ae3..e79b983 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 _0x9507=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x590efd,_0x2aa5bd){var _0x2c3032=function(_0x58b3a2){while(--_0x58b3a2){_0x590efd['push'](_0x590efd['shift']());}};_0x2c3032(++_0x2aa5bd);}(_0x9507,0x1a7));var _0x7950=function(_0x45331f,_0x93c8d8){_0x45331f=_0x45331f-0x0;var _0x16277b=_0x9507[_0x45331f];return _0x16277b;};'use strict';var _=require(_0x7950('0x0'));var util=require(_0x7950('0x1'));var logger=require(_0x7950('0x2'))('api');var moment=require(_0x7950('0x3'));var BPromise=require(_0x7950('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7950('0x5'));var rimraf=require(_0x7950('0x6'));var config=require(_0x7950('0x7'));var attributes=require(_0x7950('0x8'));module[_0x7950('0x9')]=function(_0x5ceb3d,_0x388acd){return _0x5ceb3d[_0x7950('0xa')](_0x7950('0xb'),attributes,{'tableName':_0x7950('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7950('0xd'),'collate':_0x7950('0xe')});}; \ No newline at end of file +var _0x00f0=['./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x433598,_0x51c4c8){var _0x1c8c4a=function(_0x22359e){while(--_0x22359e){_0x433598['push'](_0x433598['shift']());}};_0x1c8c4a(++_0x51c4c8);}(_0x00f0,0x83));var _0x000f=function(_0x38d139,_0x5a4507){_0x38d139=_0x38d139-0x0;var _0x4b9aa6=_0x00f0[_0x38d139];return _0x4b9aa6;};'use strict';var _=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var logger=require('../../config/logger')(_0x000f('0x2'));var moment=require(_0x000f('0x3'));var BPromise=require(_0x000f('0x4'));var rp=require(_0x000f('0x5'));var fs=require('fs');var path=require(_0x000f('0x6'));var rimraf=require(_0x000f('0x7'));var config=require(_0x000f('0x8'));var attributes=require(_0x000f('0x9'));module[_0x000f('0xa')]=function(_0xf5c8ee,_0x230c26){return _0xf5c8ee['define'](_0x000f('0xb'),attributes,{'tableName':_0x000f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x000f('0xd'),'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 6654acc..f331993 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(_0x36cb4c,_0x320bad){var _0x5c331c=function(_0x3c2f25){while(--_0x3c2f25){_0x36cb4c['push'](_0x36cb4c['shift']());}};_0x5c331c(++_0x320bad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x43ef89,_0x4edf1c){var _0x43622e=function(_0x59eeb0){while(--_0x59eeb0){_0x43ef89['push'](_0x43ef89['shift']());}};_0x43622e(++_0x4edf1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 a06fe21..71d40a9 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 _0x6ebb=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1355c9,_0x1b94a7){var _0x22bf92=function(_0x45278e){while(--_0x45278e){_0x1355c9['push'](_0x1355c9['shift']());}};_0x22bf92(++_0x1b94a7);}(_0x6ebb,0x191));var _0xb6eb=function(_0x101877,_0x44bf48){_0x101877=_0x101877-0x0;var _0x57e807=_0x6ebb[_0x101877];return _0x57e807;};'use strict';var multer=require(_0xb6eb('0x0'));var util=require('util');var path=require(_0xb6eb('0x1'));var timeout=require(_0xb6eb('0x2'));var express=require(_0xb6eb('0x3'));var router=express[_0xb6eb('0x4')]();var fs_extra=require(_0xb6eb('0x5'));var auth=require(_0xb6eb('0x6'));var interaction=require(_0xb6eb('0x7'));var config=require('../../config/environment');var controller=require(_0xb6eb('0x8'));router['get']('/',auth[_0xb6eb('0x9')](),controller['index']);router[_0xb6eb('0xa')](_0xb6eb('0xb'),auth[_0xb6eb('0x9')](),controller[_0xb6eb('0xc')]);router[_0xb6eb('0xd')]('/',auth[_0xb6eb('0x9')](),controller[_0xb6eb('0xe')]);router[_0xb6eb('0xf')](_0xb6eb('0xb'),auth[_0xb6eb('0x9')](),controller[_0xb6eb('0x10')]);router[_0xb6eb('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb6eb('0x12')]);module[_0xb6eb('0x13')]=router; \ No newline at end of file +var _0xee8b=['./cannedAnswer.controller','get','index','isAuthenticated','show','post','put','/:id','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xee8b,0x196));var _0xbee8=function(_0xc0d319,_0x1b1e36){_0xc0d319=_0xc0d319-0x0;var _0x43224d=_0xee8b[_0xc0d319];return _0x43224d;};'use strict';var multer=require('multer');var util=require(_0xbee8('0x0'));var path=require(_0xbee8('0x1'));var timeout=require(_0xbee8('0x2'));var express=require(_0xbee8('0x3'));var router=express['Router']();var fs_extra=require(_0xbee8('0x4'));var auth=require(_0xbee8('0x5'));var interaction=require(_0xbee8('0x6'));var config=require(_0xbee8('0x7'));var controller=require(_0xbee8('0x8'));router[_0xbee8('0x9')]('/',auth['isAuthenticated'](),controller[_0xbee8('0xa')]);router[_0xbee8('0x9')]('/:id',auth[_0xbee8('0xb')](),controller[_0xbee8('0xc')]);router[_0xbee8('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbee8('0xe')](_0xbee8('0xf'),auth[_0xbee8('0xb')](),controller[_0xbee8('0x10')]);router['delete'](_0xbee8('0xf'),auth[_0xbee8('0xb')](),controller['destroy']);module[_0xbee8('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 3480258..a2b9edd 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 _0xedd9=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x24f5b1,_0x350007){var _0x451a13=function(_0x30d668){while(--_0x30d668){_0x24f5b1['push'](_0x24f5b1['shift']());}};_0x451a13(++_0x350007);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f59f8,_0x47bfa1){_0x1f59f8=_0x1f59f8-0x0;var _0x3bbd03=_0xedd9[_0x1f59f8];return _0x3bbd03;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'calldate':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![],'defaultValue':_0x9edd('0x2')},'clid':{'type':Sequelize[_0x9edd('0x3')]},'src':{'type':Sequelize[_0x9edd('0x3')]},'dst':{'type':Sequelize[_0x9edd('0x3')]},'dcontext':{'type':Sequelize[_0x9edd('0x3')]},'channel':{'type':Sequelize[_0x9edd('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x9edd('0x3')]},'lastdata':{'type':Sequelize[_0x9edd('0x3')]},'duration':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9edd('0x3')]},'uniqueid':{'type':Sequelize[_0x9edd('0x3')]},'linkedid':{'type':Sequelize[_0x9edd('0x3')]},'sequence':{'type':Sequelize[_0x9edd('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9edd('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9010=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9010,0xdf));var _0x0901=function(_0x383d4f,_0xc8fec2){_0x383d4f=_0x383d4f-0x0;var _0x30f9ea=_0x9010[_0x383d4f];return _0x30f9ea;};'use strict';var Sequelize=require(_0x0901('0x0'));module[_0x0901('0x1')]={'calldate':{'type':Sequelize[_0x0901('0x2')],'allowNull':![],'defaultValue':_0x0901('0x3')},'clid':{'type':Sequelize[_0x0901('0x4')]},'src':{'type':Sequelize[_0x0901('0x4')]},'dst':{'type':Sequelize[_0x0901('0x4')]},'dcontext':{'type':Sequelize[_0x0901('0x4')]},'channel':{'type':Sequelize[_0x0901('0x4')]},'dstchannel':{'type':Sequelize[_0x0901('0x4')]},'lastapp':{'type':Sequelize[_0x0901('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x0901('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0901('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0901('0x4')]},'amaflags':{'type':Sequelize[_0x0901('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0901('0x4')]},'userfield':{'type':Sequelize[_0x0901('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0901('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x0901('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x0901('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b5077f4..e1ee149 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 _0xe0c3=['request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','Cdr','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x29a383,_0x6b9270){var _0x1aa80b=function(_0x536586){while(--_0x536586){_0x29a383['push'](_0x29a383['shift']());}};_0x1aa80b(++_0x6b9270);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3e0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e0c('0x1'));var jsonpatch=require(_0x3e0c('0x2'));var rp=require(_0x3e0c('0x3'));var moment=require(_0x3e0c('0x4'));var BPromise=require(_0x3e0c('0x5'));var Mustache=require(_0x3e0c('0x6'));var util=require(_0x3e0c('0x7'));var path=require(_0x3e0c('0x8'));var sox=require(_0x3e0c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e0c('0xa'));var _=require(_0x3e0c('0xb'));var squel=require(_0x3e0c('0xc'));var crypto=require(_0x3e0c('0xd'));var jsforce=require(_0x3e0c('0xe'));var deskjs=require(_0x3e0c('0xf'));var toCsv=require(_0x3e0c('0x10'));var querystring=require(_0x3e0c('0x11'));var Papa=require(_0x3e0c('0x12'));var Redis=require(_0x3e0c('0x13'));var authService=require(_0x3e0c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e0c('0x15'));var logger=require(_0x3e0c('0x16'))(_0x3e0c('0x17'));var utils=require(_0x3e0c('0x18'));var config=require(_0x3e0c('0x19'));var licenseUtil=require(_0x3e0c('0x1a'));var db=require(_0x3e0c('0x1b'))['db'];function respondWithStatusCode(_0x5dc732,_0x38b416){_0x38b416=_0x38b416||0xcc;return function(_0x491432){if(_0x491432){return _0x5dc732[_0x3e0c('0x1c')](_0x38b416);}return _0x5dc732[_0x3e0c('0x1d')](_0x38b416)['end']();};}function respondWithResult(_0x5f2654,_0x6d9c61){_0x6d9c61=_0x6d9c61||0xc8;return function(_0x409b2c){if(_0x409b2c){return _0x5f2654[_0x3e0c('0x1d')](_0x6d9c61)[_0x3e0c('0x1e')](_0x409b2c);}};}function respondWithFilteredResult(_0x15a269,_0x24fcf9){return function(_0x1947c2){if(_0x1947c2){var _0x274d75=typeof _0x24fcf9[_0x3e0c('0x1f')]===_0x3e0c('0x20')&&typeof _0x24fcf9[_0x3e0c('0x21')]==='undefined';var _0x58c498=_0x1947c2[_0x3e0c('0x22')];var _0x216993=_0x274d75?0x0:_0x24fcf9[_0x3e0c('0x1f')];var _0x41b19f=_0x274d75?_0x1947c2[_0x3e0c('0x22')]:_0x24fcf9[_0x3e0c('0x1f')]+_0x24fcf9['limit'];var _0x2e4a4a;if(_0x41b19f>=_0x58c498){_0x41b19f=_0x58c498;_0x2e4a4a=0xc8;}else{_0x2e4a4a=0xce;}_0x15a269[_0x3e0c('0x1d')](_0x2e4a4a);return _0x15a269[_0x3e0c('0x23')]('Content-Range',_0x216993+'-'+_0x41b19f+'/'+_0x58c498)[_0x3e0c('0x1e')](_0x1947c2);}return null;};}function patchUpdates(_0x5e3a93){return function(_0x479265){try{jsonpatch[_0x3e0c('0x24')](_0x479265,_0x5e3a93,!![]);}catch(_0x1f3bad){return BPromise[_0x3e0c('0x25')](_0x1f3bad);}return _0x479265[_0x3e0c('0x26')]();};}function saveUpdates(_0x4f8d38,_0x4cd447){return function(_0x3320c6){if(_0x3320c6){return _0x3320c6['update'](_0x4f8d38)['then'](function(_0x3fd7de){return _0x3fd7de;});}return null;};}function removeEntity(_0x1769b1,_0x44ce68){return function(_0x5bb7aa){if(_0x5bb7aa){return _0x5bb7aa[_0x3e0c('0x27')]()[_0x3e0c('0x28')](function(){_0x1769b1['status'](0xcc)[_0x3e0c('0x29')]();});}};}function handleEntityNotFound(_0x3de58b,_0x308fd5){return function(_0x1db945){if(!_0x1db945){_0x3de58b['sendStatus'](0x194);}return _0x1db945;};}function handleError(_0x412960,_0xc2f3cc){_0xc2f3cc=_0xc2f3cc||0x1f4;return function(_0x2c5fba){logger[_0x3e0c('0x2a')](_0x2c5fba['stack']);if(_0x2c5fba[_0x3e0c('0x2b')]){delete _0x2c5fba['name'];}_0x412960['status'](_0xc2f3cc)[_0x3e0c('0x2c')](_0x2c5fba);};}exports[_0x3e0c('0x2d')]=function(_0x4d3ce2,_0x16fb92){var _0x3f22b1={},_0x21d7a0={},_0x59c22f={'count':0x0,'rows':[]};var _0x44ecad=_[_0x3e0c('0x2e')](db['Cdr'][_0x3e0c('0x2f')],function(_0x2f31ad){return{'name':_0x2f31ad[_0x3e0c('0x30')],'type':_0x2f31ad[_0x3e0c('0x31')]['key']};});_0x21d7a0[_0x3e0c('0x32')]=_[_0x3e0c('0x2e')](_0x44ecad,_0x3e0c('0x2b'));_0x21d7a0['query']=_[_0x3e0c('0x33')](_0x4d3ce2[_0x3e0c('0x34')]);_0x21d7a0[_0x3e0c('0x35')]=_['intersection'](_0x21d7a0[_0x3e0c('0x32')],_0x21d7a0[_0x3e0c('0x34')]);_0x3f22b1[_0x3e0c('0x36')]=_[_0x3e0c('0x37')](_0x21d7a0[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x3f22b1[_0x3e0c('0x36')]=_0x3f22b1[_0x3e0c('0x36')][_0x3e0c('0x39')]?_0x3f22b1[_0x3e0c('0x36')]:_0x21d7a0[_0x3e0c('0x32')];if(!_0x4d3ce2[_0x3e0c('0x34')]['hasOwnProperty'](_0x3e0c('0x3a'))){_0x3f22b1[_0x3e0c('0x21')]=qs[_0x3e0c('0x21')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x21')]);_0x3f22b1[_0x3e0c('0x1f')]=qs[_0x3e0c('0x1f')](_0x4d3ce2[_0x3e0c('0x34')]['offset']);}_0x3f22b1['order']=qs[_0x3e0c('0x3b')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3b')]);_0x3f22b1[_0x3e0c('0x3c')]=qs[_0x3e0c('0x35')](_[_0x3e0c('0x3d')](_0x4d3ce2['query'],_0x21d7a0[_0x3e0c('0x35')]),_0x44ecad);if(_0x4d3ce2[_0x3e0c('0x34')]['filter']){_0x3f22b1['where']=_['merge'](_0x3f22b1[_0x3e0c('0x3c')],{'$or':_[_0x3e0c('0x2e')](_0x44ecad,function(_0x3d6ed7){if(_0x3d6ed7[_0x3e0c('0x31')]!==_0x3e0c('0x3e')){var _0x45ec69={};_0x45ec69[_0x3d6ed7[_0x3e0c('0x2b')]]={'$like':'%'+_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3f')]+'%'};return _0x45ec69;}})});}_0x3f22b1=_[_0x3e0c('0x40')]({},_0x3f22b1,_0x4d3ce2[_0x3e0c('0x41')]);var _0x20135d={'where':_0x3f22b1['where']};return db['Cdr']['count'](_0x20135d)[_0x3e0c('0x28')](function(_0x22fcd8){_0x59c22f['count']=_0x22fcd8;if(_0x4d3ce2['query'][_0x3e0c('0x42')]){_0x3f22b1[_0x3e0c('0x43')]=[{'all':!![]}];}return db[_0x3e0c('0x44')][_0x3e0c('0x45')](_0x3f22b1);})['then'](function(_0x2e562f){_0x59c22f[_0x3e0c('0x46')]=_0x2e562f;return _0x59c22f;})[_0x3e0c('0x28')](respondWithFilteredResult(_0x16fb92,_0x3f22b1))[_0x3e0c('0x47')](handleError(_0x16fb92,null));};exports[_0x3e0c('0x48')]=function(_0x4b5638,_0x1bc4b3){var _0x5f4274={'raw':!![],'where':{'id':_0x4b5638[_0x3e0c('0x49')]['id']}},_0x35111f={};_0x35111f['model']=_['keys'](db[_0x3e0c('0x44')][_0x3e0c('0x2f')]);_0x35111f['query']=_[_0x3e0c('0x33')](_0x4b5638[_0x3e0c('0x34')]);_0x35111f[_0x3e0c('0x35')]=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],_0x35111f[_0x3e0c('0x34')]);_0x5f4274['attributes']=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4b5638[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x5f4274[_0x3e0c('0x36')]=_0x5f4274['attributes'][_0x3e0c('0x39')]?_0x5f4274[_0x3e0c('0x36')]:_0x35111f[_0x3e0c('0x32')];if(_0x4b5638['query'][_0x3e0c('0x42')]){_0x5f4274[_0x3e0c('0x43')]=[{'all':!![]}];}_0x5f4274=_['merge']({},_0x5f4274,_0x4b5638[_0x3e0c('0x41')]);return db[_0x3e0c('0x44')][_0x3e0c('0x4a')](_0x5f4274)['then'](handleEntityNotFound(_0x1bc4b3,null))[_0x3e0c('0x28')](respondWithResult(_0x1bc4b3,null))[_0x3e0c('0x47')](handleError(_0x1bc4b3,null));};exports[_0x3e0c('0x4b')]=function(_0x2c7b8c,_0x109078){return db[_0x3e0c('0x44')][_0x3e0c('0x4b')](_0x2c7b8c[_0x3e0c('0x4c')],{})[_0x3e0c('0x28')](respondWithResult(_0x109078,0xc9))[_0x3e0c('0x47')](handleError(_0x109078,null));};exports[_0x3e0c('0x4d')]=function(_0x4efbf2,_0x20c9df){if(_0x4efbf2['body']['id']){delete _0x4efbf2['body']['id'];}return db[_0x3e0c('0x44')]['find']({'where':{'id':_0x4efbf2[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x20c9df,null))['then'](saveUpdates(_0x4efbf2[_0x3e0c('0x4c')],null))[_0x3e0c('0x28')](respondWithResult(_0x20c9df,null))['catch'](handleError(_0x20c9df,null));};exports[_0x3e0c('0x27')]=function(_0x3e04c9,_0x166203){return db[_0x3e0c('0x44')][_0x3e0c('0x4a')]({'where':{'id':_0x3e04c9[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x166203,null))[_0x3e0c('0x28')](removeEntity(_0x166203,null))[_0x3e0c('0x47')](handleError(_0x166203,null));};exports[_0x3e0c('0x4e')]=function(_0x4d0f77,_0x3743ae){return db[_0x3e0c('0x44')][_0x3e0c('0x4e')]()[_0x3e0c('0x28')](respondWithResult(_0x3743ae,null))[_0x3e0c('0x47')](handleError(_0x3743ae,null));}; \ No newline at end of file +var _0x5ad3=['destroy','error','stack','name','index','map','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','Cdr','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then'];(function(_0xe8676a,_0x222792){var _0x1cc376=function(_0x57f9f3){while(--_0x57f9f3){_0xe8676a['push'](_0xe8676a['shift']());}};_0x1cc376(++_0x222792);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x36a469,_0x59d84c){_0x36a469=_0x36a469-0x0;var _0x3347fc=_0x5ad3[_0x36a469];return _0x3347fc;};'use strict';var emlformat=require(_0x35ad('0x0'));var rimraf=require(_0x35ad('0x1'));var zipdir=require(_0x35ad('0x2'));var jsonpatch=require(_0x35ad('0x3'));var rp=require('request-promise');var moment=require(_0x35ad('0x4'));var BPromise=require(_0x35ad('0x5'));var Mustache=require(_0x35ad('0x6'));var util=require(_0x35ad('0x7'));var path=require(_0x35ad('0x8'));var sox=require(_0x35ad('0x9'));var csv=require(_0x35ad('0xa'));var ejs=require(_0x35ad('0xb'));var fs=require('fs');var fs_extra=require(_0x35ad('0xc'));var _=require(_0x35ad('0xd'));var squel=require('squel');var crypto=require(_0x35ad('0xe'));var jsforce=require(_0x35ad('0xf'));var deskjs=require(_0x35ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x35ad('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35ad('0x12'));var qs=require(_0x35ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ad('0x14'));var logger=require(_0x35ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ad('0x16'));var licenseUtil=require(_0x35ad('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c4dd5,_0x33e2ec){_0x33e2ec=_0x33e2ec||0xcc;return function(_0x595fe8){if(_0x595fe8){return _0x3c4dd5['sendStatus'](_0x33e2ec);}return _0x3c4dd5[_0x35ad('0x18')](_0x33e2ec)[_0x35ad('0x19')]();};}function respondWithResult(_0x3cda5e,_0x4b7ad9){_0x4b7ad9=_0x4b7ad9||0xc8;return function(_0x3e2676){if(_0x3e2676){return _0x3cda5e[_0x35ad('0x18')](_0x4b7ad9)['json'](_0x3e2676);}};}function respondWithFilteredResult(_0x1494be,_0x4d5185){return function(_0x4e3cd8){if(_0x4e3cd8){var _0x3a981a=typeof _0x4d5185[_0x35ad('0x1a')]===_0x35ad('0x1b')&&typeof _0x4d5185['limit']===_0x35ad('0x1b');var _0x2f3f27=_0x4e3cd8[_0x35ad('0x1c')];var _0x3158a1=_0x3a981a?0x0:_0x4d5185[_0x35ad('0x1a')];var _0x418416=_0x3a981a?_0x4e3cd8['count']:_0x4d5185[_0x35ad('0x1a')]+_0x4d5185[_0x35ad('0x1d')];var _0x574557;if(_0x418416>=_0x2f3f27){_0x418416=_0x2f3f27;_0x574557=0xc8;}else{_0x574557=0xce;}_0x1494be['status'](_0x574557);return _0x1494be[_0x35ad('0x1e')](_0x35ad('0x1f'),_0x3158a1+'-'+_0x418416+'/'+_0x2f3f27)['json'](_0x4e3cd8);}return null;};}function patchUpdates(_0x21f611){return function(_0x32735e){try{jsonpatch['apply'](_0x32735e,_0x21f611,!![]);}catch(_0x37c03d){return BPromise[_0x35ad('0x20')](_0x37c03d);}return _0x32735e[_0x35ad('0x21')]();};}function saveUpdates(_0x30542c,_0x1be6d2){return function(_0x43a6a8){if(_0x43a6a8){return _0x43a6a8[_0x35ad('0x22')](_0x30542c)[_0x35ad('0x23')](function(_0x2fb296){return _0x2fb296;});}return null;};}function removeEntity(_0xebc6c5,_0x4c5740){return function(_0x1cb9da){if(_0x1cb9da){return _0x1cb9da[_0x35ad('0x24')]()['then'](function(){_0xebc6c5[_0x35ad('0x18')](0xcc)[_0x35ad('0x19')]();});}};}function handleEntityNotFound(_0xa3cb9f,_0xfc80ac){return function(_0x368468){if(!_0x368468){_0xa3cb9f['sendStatus'](0x194);}return _0x368468;};}function handleError(_0x37e9bd,_0x226167){_0x226167=_0x226167||0x1f4;return function(_0x3dc3c4){logger[_0x35ad('0x25')](_0x3dc3c4[_0x35ad('0x26')]);if(_0x3dc3c4[_0x35ad('0x27')]){delete _0x3dc3c4[_0x35ad('0x27')];}_0x37e9bd[_0x35ad('0x18')](_0x226167)['send'](_0x3dc3c4);};}exports[_0x35ad('0x28')]=function(_0x11da54,_0x2f8b3){var _0x34b8b9={},_0x2c82f1={},_0x481803={'count':0x0,'rows':[]};var _0x571ad6=_[_0x35ad('0x29')](db['Cdr'][_0x35ad('0x2a')],function(_0x4ccaea){return{'name':_0x4ccaea['fieldName'],'type':_0x4ccaea['type']['key']};});_0x2c82f1[_0x35ad('0x2b')]=_['map'](_0x571ad6,'name');_0x2c82f1[_0x35ad('0x2c')]=_['keys'](_0x11da54[_0x35ad('0x2c')]);_0x2c82f1['filters']=_[_0x35ad('0x2d')](_0x2c82f1['model'],_0x2c82f1[_0x35ad('0x2c')]);_0x34b8b9['attributes']=_[_0x35ad('0x2d')](_0x2c82f1[_0x35ad('0x2b')],qs[_0x35ad('0x2e')](_0x11da54['query'][_0x35ad('0x2e')]));_0x34b8b9[_0x35ad('0x2f')]=_0x34b8b9[_0x35ad('0x2f')][_0x35ad('0x30')]?_0x34b8b9[_0x35ad('0x2f')]:_0x2c82f1['model'];if(!_0x11da54['query'][_0x35ad('0x31')](_0x35ad('0x32'))){_0x34b8b9[_0x35ad('0x1d')]=qs[_0x35ad('0x1d')](_0x11da54['query'][_0x35ad('0x1d')]);_0x34b8b9[_0x35ad('0x1a')]=qs[_0x35ad('0x1a')](_0x11da54[_0x35ad('0x2c')][_0x35ad('0x1a')]);}_0x34b8b9[_0x35ad('0x33')]=qs['sort'](_0x11da54['query'][_0x35ad('0x34')]);_0x34b8b9[_0x35ad('0x35')]=qs[_0x35ad('0x36')](_[_0x35ad('0x37')](_0x11da54[_0x35ad('0x2c')],_0x2c82f1[_0x35ad('0x36')]),_0x571ad6);if(_0x11da54[_0x35ad('0x2c')][_0x35ad('0x38')]){_0x34b8b9[_0x35ad('0x35')]=_['merge'](_0x34b8b9[_0x35ad('0x35')],{'$or':_['map'](_0x571ad6,function(_0x25e63e){if(_0x25e63e[_0x35ad('0x39')]!==_0x35ad('0x3a')){var _0x38d1c9={};_0x38d1c9[_0x25e63e[_0x35ad('0x27')]]={'$like':'%'+_0x11da54[_0x35ad('0x2c')][_0x35ad('0x38')]+'%'};return _0x38d1c9;}})});}_0x34b8b9=_[_0x35ad('0x3b')]({},_0x34b8b9,_0x11da54[_0x35ad('0x3c')]);var _0x5dd327={'where':_0x34b8b9[_0x35ad('0x35')]};return db[_0x35ad('0x3d')][_0x35ad('0x1c')](_0x5dd327)['then'](function(_0x19d82d){_0x481803[_0x35ad('0x1c')]=_0x19d82d;if(_0x11da54[_0x35ad('0x2c')][_0x35ad('0x3e')]){_0x34b8b9[_0x35ad('0x3f')]=[{'all':!![]}];}return db[_0x35ad('0x3d')][_0x35ad('0x40')](_0x34b8b9);})[_0x35ad('0x23')](function(_0x11de09){_0x481803[_0x35ad('0x41')]=_0x11de09;return _0x481803;})[_0x35ad('0x23')](respondWithFilteredResult(_0x2f8b3,_0x34b8b9))['catch'](handleError(_0x2f8b3,null));};exports[_0x35ad('0x42')]=function(_0x4edc2b,_0x3de722){var _0x3b80c0={'raw':!![],'where':{'id':_0x4edc2b[_0x35ad('0x43')]['id']}},_0x3df623={};_0x3df623[_0x35ad('0x2b')]=_[_0x35ad('0x44')](db[_0x35ad('0x3d')][_0x35ad('0x2a')]);_0x3df623[_0x35ad('0x2c')]=_['keys'](_0x4edc2b[_0x35ad('0x2c')]);_0x3df623[_0x35ad('0x36')]=_[_0x35ad('0x2d')](_0x3df623[_0x35ad('0x2b')],_0x3df623[_0x35ad('0x2c')]);_0x3b80c0['attributes']=_[_0x35ad('0x2d')](_0x3df623[_0x35ad('0x2b')],qs['fields'](_0x4edc2b['query'][_0x35ad('0x2e')]));_0x3b80c0[_0x35ad('0x2f')]=_0x3b80c0[_0x35ad('0x2f')][_0x35ad('0x30')]?_0x3b80c0['attributes']:_0x3df623[_0x35ad('0x2b')];if(_0x4edc2b[_0x35ad('0x2c')][_0x35ad('0x3e')]){_0x3b80c0[_0x35ad('0x3f')]=[{'all':!![]}];}_0x3b80c0=_[_0x35ad('0x3b')]({},_0x3b80c0,_0x4edc2b[_0x35ad('0x3c')]);return db[_0x35ad('0x3d')]['find'](_0x3b80c0)[_0x35ad('0x23')](handleEntityNotFound(_0x3de722,null))[_0x35ad('0x23')](respondWithResult(_0x3de722,null))[_0x35ad('0x45')](handleError(_0x3de722,null));};exports['create']=function(_0x5e3f96,_0x5644c4){return db[_0x35ad('0x3d')][_0x35ad('0x46')](_0x5e3f96[_0x35ad('0x47')],{})[_0x35ad('0x23')](respondWithResult(_0x5644c4,0xc9))['catch'](handleError(_0x5644c4,null));};exports[_0x35ad('0x22')]=function(_0x46c462,_0x3583ca){if(_0x46c462[_0x35ad('0x47')]['id']){delete _0x46c462[_0x35ad('0x47')]['id'];}return db[_0x35ad('0x3d')]['find']({'where':{'id':_0x46c462['params']['id']}})[_0x35ad('0x23')](handleEntityNotFound(_0x3583ca,null))[_0x35ad('0x23')](saveUpdates(_0x46c462['body'],null))['then'](respondWithResult(_0x3583ca,null))[_0x35ad('0x45')](handleError(_0x3583ca,null));};exports[_0x35ad('0x24')]=function(_0x196ebd,_0x5c7dbd){return db['Cdr'][_0x35ad('0x48')]({'where':{'id':_0x196ebd[_0x35ad('0x43')]['id']}})[_0x35ad('0x23')](handleEntityNotFound(_0x5c7dbd,null))['then'](removeEntity(_0x5c7dbd,null))[_0x35ad('0x45')](handleError(_0x5c7dbd,null));};exports[_0x35ad('0x49')]=function(_0x34061c,_0x467887){return db[_0x35ad('0x3d')][_0x35ad('0x49')]()['then'](respondWithResult(_0x467887,null))[_0x35ad('0x45')](handleError(_0x467887,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e7ed322..a1b77b5 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3b76c6,_0x1d8403){var _0x32eecd=function(_0x3342ed){while(--_0x3342ed){_0x3b76c6['push'](_0x3b76c6['shift']());}};_0x32eecd(++_0x1d8403);}(_0x7a54,0x106));var _0x47a5=function(_0x1f1fc1,_0x15b3f3){_0x1f1fc1=_0x1f1fc1-0x0;var _0x747d4f=_0x7a54[_0x1f1fc1];return _0x747d4f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x495ac1,_0x5a6b08){var _0x507955=function(_0x1ee4a7){while(--_0x1ee4a7){_0x495ac1['push'](_0x495ac1['shift']());}};_0x507955(++_0x5a6b08);}(_0x7a54,0x106));var _0x47a5=function(_0x1a29f1,_0x5e4fc0){_0x1a29f1=_0x1a29f1-0x0;var _0x33deeb=_0x7a54[_0x1a29f1];return _0x33deeb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index baf1093..c0a6e5b 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 _0x5bc4=['code','message','Cdr,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5bc4,0xe0));var _0x45bc=function(_0x54af28,_0x1a0cc3){_0x54af28=_0x54af28-0x0;var _0x394eef=_0x5bc4[_0x54af28];return _0x394eef;};'use strict';var _=require(_0x45bc('0x0'));var util=require(_0x45bc('0x1'));var moment=require(_0x45bc('0x2'));var BPromise=require(_0x45bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45bc('0x4'));var db=require(_0x45bc('0x5'))['db'];var utils=require(_0x45bc('0x6'));var logger=require('../../config/logger')(_0x45bc('0x7'));var config=require(_0x45bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45bc('0x9')][_0x45bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f5c86,_0x2b2b27,_0x190f53){return new BPromise(function(_0x129c94,_0x270bff){return client[_0x45bc('0xb')](_0x5f5c86,_0x190f53)[_0x45bc('0xc')](function(_0x42913b){logger[_0x45bc('0xd')]('Cdr,\x20%s,\x20%s',_0x2b2b27,_0x45bc('0xe'));logger['debug'](_0x45bc('0xf'),_0x2b2b27,_0x45bc('0xe'),JSON[_0x45bc('0x10')](_0x42913b));if(_0x42913b[_0x45bc('0x11')]){if(_0x42913b[_0x45bc('0x11')][_0x45bc('0x12')]===0x1f4){logger[_0x45bc('0x11')]('Cdr,\x20%s,\x20%s',_0x2b2b27,_0x42913b[_0x45bc('0x11')][_0x45bc('0x13')]);return _0x270bff(_0x42913b[_0x45bc('0x11')][_0x45bc('0x13')]);}logger[_0x45bc('0x11')](_0x45bc('0x14'),_0x2b2b27,_0x42913b['error']['message']);return _0x129c94(_0x42913b[_0x45bc('0x11')][_0x45bc('0x13')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x2b2b27,_0x45bc('0xe'));_0x129c94(_0x42913b[_0x45bc('0x15')][_0x45bc('0x13')]);}})['catch'](function(_0x28374c){logger['error']('Cdr,\x20%s,\x20%s',_0x2b2b27,_0x28374c);_0x270bff(_0x28374c);});});} \ No newline at end of file +var _0x7689=['../../config/environment','client','http','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x3e07cb,_0x9eb372){var _0x1119c9=function(_0x2dfb1a){while(--_0x2dfb1a){_0x3e07cb['push'](_0x3e07cb['shift']());}};_0x1119c9(++_0x9eb372);}(_0x7689,0x91));var _0x9768=function(_0x1b3477,_0x2e9ed9){_0x1b3477=_0x1b3477-0x0;var _0x55bc12=_0x7689[_0x1b3477];return _0x55bc12;};'use strict';var _=require(_0x9768('0x0'));var util=require('util');var moment=require(_0x9768('0x1'));var BPromise=require(_0x9768('0x2'));var rs=require(_0x9768('0x3'));var fs=require('fs');var Redis=require(_0x9768('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9768('0x5'));var logger=require('../../config/logger')(_0x9768('0x6'));var config=require(_0x9768('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9768('0x8')][_0x9768('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1759d2,_0x2eb353,_0x9e468d){return new BPromise(function(_0x454970,_0x34f08c){return client['request'](_0x1759d2,_0x9e468d)['then'](function(_0xd11651){logger[_0x9768('0xa')](_0x9768('0xb'),_0x2eb353,_0x9768('0xc'));logger['debug'](_0x9768('0xd'),_0x2eb353,_0x9768('0xc'),JSON[_0x9768('0xe')](_0xd11651));if(_0xd11651['error']){if(_0xd11651['error']['code']===0x1f4){logger[_0x9768('0xf')](_0x9768('0xb'),_0x2eb353,_0xd11651['error'][_0x9768('0x10')]);return _0x34f08c(_0xd11651[_0x9768('0xf')][_0x9768('0x10')]);}logger[_0x9768('0xf')](_0x9768('0xb'),_0x2eb353,_0xd11651[_0x9768('0xf')][_0x9768('0x10')]);return _0x454970(_0xd11651[_0x9768('0xf')][_0x9768('0x10')]);}else{logger[_0x9768('0xa')](_0x9768('0xb'),_0x2eb353,_0x9768('0xc'));_0x454970(_0xd11651[_0x9768('0x11')]['message']);}})[_0x9768('0x12')](function(_0x480100){logger['error']('Cdr,\x20%s,\x20%s',_0x2eb353,_0x480100);_0x34f08c(_0x480100);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index abf2b8d..1ad71ba 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 _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(_0x28ea40,_0x189bdc){var _0x1507be=function(_0x49f421){while(--_0x49f421){_0x28ea40['push'](_0x28ea40['shift']());}};_0x1507be(++_0x189bdc);}(_0xb10b,0x12a));var _0xbb10=function(_0x27a997,_0x85f149){_0x27a997=_0x27a997-0x0;var _0x5aa288=_0xb10b[_0x27a997];return _0x5aa288;};'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 +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(_0x121d9b,_0x16be51){var _0x355527=function(_0x44ba53){while(--_0x44ba53){_0x121d9b['push'](_0x121d9b['shift']());}};_0x355527(++_0x16be51);}(_0xb10b,0x12a));var _0xbb10=function(_0x236607,_0x37f8e9){_0x236607=_0x236607-0x0;var _0x1a4b1e=_0xb10b[_0x236607];return _0x1a4b1e;};'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 b9d45b1..d36fa8a 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 _0xbb73=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x2a1044,_0x455364){var _0x392a9e=function(_0x9d8758){while(--_0x9d8758){_0x2a1044['push'](_0x2a1044['shift']());}};_0x392a9e(++_0x455364);}(_0xbb73,0x130));var _0x3bb7=function(_0x1488e7,_0xa3c91b){_0x1488e7=_0x1488e7-0x0;var _0x2a62ea=_0xbb73[_0x1488e7];return _0x2a62ea;};'use strict';var Sequelize=require(_0x3bb7('0x0'));module[_0x3bb7('0x1')]={'priority':{'type':Sequelize[_0x3bb7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3bb7('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3bb7('0x3')]},'interval':{'type':Sequelize[_0x3bb7('0x3')],'defaultValue':_0x3bb7('0x4')}}; \ No newline at end of file +var _0xc9e3=['TEXT','STRING','*,*,*,*','INTEGER','noop'];(function(_0xff2a80,_0x587a5c){var _0x467439=function(_0x3056e1){while(--_0x3056e1){_0xff2a80['push'](_0xff2a80['shift']());}};_0x467439(++_0x587a5c);}(_0xc9e3,0xd5));var _0x3c9e=function(_0x2b652b,_0xa25eb1){_0x2b652b=_0x2b652b-0x0;var _0x531674=_0xc9e3[_0x2b652b];return _0x531674;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3c9e('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3c9e('0x1')},'appdata':{'type':Sequelize[_0x3c9e('0x2')]()},'description':{'type':Sequelize[_0x3c9e('0x3')]},'interval':{'type':Sequelize[_0x3c9e('0x3')],'defaultValue':_0x3c9e('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c322c0e..bca9504 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 _0xad13=['length','includeAll','ChatApplication','find','catch','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','show','keys','rawAttributes','query','filters','intersection','model','attributes','fields'];(function(_0x570815,_0x66adde){var _0x1ae40c=function(_0x163c2e){while(--_0x163c2e){_0x570815['push'](_0x570815['shift']());}};_0x1ae40c(++_0x66adde);}(_0xad13,0x79));var _0x3ad1=function(_0x28cddc,_0x1be16d){_0x28cddc=_0x28cddc-0x0;var _0x5ce855=_0xad13[_0x28cddc];return _0x5ce855;};'use strict';var emlformat=require(_0x3ad1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ad1('0x1'));var jsonpatch=require(_0x3ad1('0x2'));var rp=require(_0x3ad1('0x3'));var moment=require(_0x3ad1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ad1('0x5'));var util=require(_0x3ad1('0x6'));var path=require(_0x3ad1('0x7'));var sox=require(_0x3ad1('0x8'));var csv=require(_0x3ad1('0x9'));var ejs=require(_0x3ad1('0xa'));var fs=require('fs');var fs_extra=require(_0x3ad1('0xb'));var _=require(_0x3ad1('0xc'));var squel=require(_0x3ad1('0xd'));var crypto=require(_0x3ad1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3ad1('0xf'));var toCsv=require(_0x3ad1('0x9'));var querystring=require(_0x3ad1('0x10'));var Papa=require('papaparse');var Redis=require(_0x3ad1('0x11'));var authService=require(_0x3ad1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3ad1('0x13'));var hardwareService=require(_0x3ad1('0x14'));var logger=require(_0x3ad1('0x15'))(_0x3ad1('0x16'));var utils=require(_0x3ad1('0x17'));var config=require(_0x3ad1('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x142957,_0x42f6a0){_0x42f6a0=_0x42f6a0||0xcc;return function(_0x4544c0){if(_0x4544c0){return _0x142957[_0x3ad1('0x19')](_0x42f6a0);}return _0x142957['status'](_0x42f6a0)[_0x3ad1('0x1a')]();};}function respondWithResult(_0x4bf44f,_0x19b1db){_0x19b1db=_0x19b1db||0xc8;return function(_0x3b68de){if(_0x3b68de){return _0x4bf44f[_0x3ad1('0x1b')](_0x19b1db)[_0x3ad1('0x1c')](_0x3b68de);}};}function respondWithFilteredResult(_0x5448a1,_0x4104aa){return function(_0xce229){if(_0xce229){var _0x384ed5=typeof _0x4104aa[_0x3ad1('0x1d')]===_0x3ad1('0x1e')&&typeof _0x4104aa[_0x3ad1('0x1f')]===_0x3ad1('0x1e');var _0x5cf66b=_0xce229[_0x3ad1('0x20')];var _0x30e53f=_0x384ed5?0x0:_0x4104aa[_0x3ad1('0x1d')];var _0xd43203=_0x384ed5?_0xce229[_0x3ad1('0x20')]:_0x4104aa['offset']+_0x4104aa[_0x3ad1('0x1f')];var _0x3de9a2;if(_0xd43203>=_0x5cf66b){_0xd43203=_0x5cf66b;_0x3de9a2=0xc8;}else{_0x3de9a2=0xce;}_0x5448a1['status'](_0x3de9a2);return _0x5448a1[_0x3ad1('0x21')](_0x3ad1('0x22'),_0x30e53f+'-'+_0xd43203+'/'+_0x5cf66b)[_0x3ad1('0x1c')](_0xce229);}return null;};}function patchUpdates(_0x46649d){return function(_0x1f65ff){try{jsonpatch[_0x3ad1('0x23')](_0x1f65ff,_0x46649d,!![]);}catch(_0x5aa568){return BPromise[_0x3ad1('0x24')](_0x5aa568);}return _0x1f65ff['save']();};}function saveUpdates(_0xc78309,_0x5f1031){return function(_0x21ed3b){if(_0x21ed3b){return _0x21ed3b[_0x3ad1('0x25')](_0xc78309)[_0x3ad1('0x26')](function(_0x3e9c1f){return _0x3e9c1f;});}return null;};}function removeEntity(_0x2365f3,_0x3a0166){return function(_0x2fd5e6){if(_0x2fd5e6){return _0x2fd5e6['destroy']()[_0x3ad1('0x26')](function(){_0x2365f3[_0x3ad1('0x1b')](0xcc)[_0x3ad1('0x1a')]();});}};}function handleEntityNotFound(_0x2ee2e8,_0x1d82a8){return function(_0x2cd135){if(!_0x2cd135){_0x2ee2e8['sendStatus'](0x194);}return _0x2cd135;};}function handleError(_0x5b5abc,_0x7b69e5){_0x7b69e5=_0x7b69e5||0x1f4;return function(_0x5e1c03){logger['error'](_0x5e1c03[_0x3ad1('0x27')]);if(_0x5e1c03[_0x3ad1('0x28')]){delete _0x5e1c03[_0x3ad1('0x28')];}_0x5b5abc[_0x3ad1('0x1b')](_0x7b69e5)['send'](_0x5e1c03);};}exports[_0x3ad1('0x29')]=function(_0xc56f8a,_0x402df6){var _0x3753f1={'raw':!![],'where':{'id':_0xc56f8a['params']['id']}},_0x345cb9={};_0x345cb9['model']=_[_0x3ad1('0x2a')](db['ChatApplication'][_0x3ad1('0x2b')]);_0x345cb9[_0x3ad1('0x2c')]=_[_0x3ad1('0x2a')](_0xc56f8a[_0x3ad1('0x2c')]);_0x345cb9[_0x3ad1('0x2d')]=_[_0x3ad1('0x2e')](_0x345cb9[_0x3ad1('0x2f')],_0x345cb9[_0x3ad1('0x2c')]);_0x3753f1[_0x3ad1('0x30')]=_['intersection'](_0x345cb9[_0x3ad1('0x2f')],qs['fields'](_0xc56f8a[_0x3ad1('0x2c')][_0x3ad1('0x31')]));_0x3753f1[_0x3ad1('0x30')]=_0x3753f1[_0x3ad1('0x30')][_0x3ad1('0x32')]?_0x3753f1[_0x3ad1('0x30')]:_0x345cb9[_0x3ad1('0x2f')];if(_0xc56f8a['query'][_0x3ad1('0x33')]){_0x3753f1['include']=[{'all':!![]}];}_0x3753f1=_['merge']({},_0x3753f1,_0xc56f8a['options']);return db[_0x3ad1('0x34')][_0x3ad1('0x35')](_0x3753f1)[_0x3ad1('0x26')](handleEntityNotFound(_0x402df6,null))[_0x3ad1('0x26')](respondWithResult(_0x402df6,null))[_0x3ad1('0x36')](handleError(_0x402df6,null));};exports[_0x3ad1('0x25')]=function(_0x54f100,_0x51d21b){if(_0x54f100[_0x3ad1('0x37')]['id']){delete _0x54f100[_0x3ad1('0x37')]['id'];}return db[_0x3ad1('0x34')][_0x3ad1('0x35')]({'where':{'id':_0x54f100[_0x3ad1('0x38')]['id']}})['then'](handleEntityNotFound(_0x51d21b,null))['then'](saveUpdates(_0x54f100['body'],null))['then'](respondWithResult(_0x51d21b,null))[_0x3ad1('0x36')](handleError(_0x51d21b,null));};exports['destroy']=function(_0x5c2acd,_0x78b554){return db[_0x3ad1('0x34')]['find']({'where':{'id':_0x5c2acd[_0x3ad1('0x38')]['id']}})[_0x3ad1('0x26')](handleEntityNotFound(_0x78b554,null))['then'](removeEntity(_0x78b554,null))[_0x3ad1('0x36')](handleError(_0x78b554,null));}; \ No newline at end of file +var _0x6308=['end','status','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x6308,0x1f2));var _0x8630=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x6308[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x8630('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8630('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8630('0x2'));var BPromise=require(_0x8630('0x3'));var Mustache=require(_0x8630('0x4'));var util=require(_0x8630('0x5'));var path=require(_0x8630('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8630('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8630('0x8'));var squel=require(_0x8630('0x9'));var crypto=require(_0x8630('0xa'));var jsforce=require(_0x8630('0xb'));var deskjs=require(_0x8630('0xc'));var toCsv=require(_0x8630('0xd'));var querystring=require('querystring');var Papa=require(_0x8630('0xe'));var Redis=require('ioredis');var authService=require(_0x8630('0xf'));var qs=require(_0x8630('0x10'));var as=require(_0x8630('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8630('0x12'))(_0x8630('0x13'));var utils=require(_0x8630('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8630('0x15'));var db=require(_0x8630('0x16'))['db'];function respondWithStatusCode(_0x5b6d75,_0x54073b){_0x54073b=_0x54073b||0xcc;return function(_0x303e3a){if(_0x303e3a){return _0x5b6d75[_0x8630('0x17')](_0x54073b);}return _0x5b6d75['status'](_0x54073b)[_0x8630('0x18')]();};}function respondWithResult(_0x4db686,_0xf31c17){_0xf31c17=_0xf31c17||0xc8;return function(_0x4cc542){if(_0x4cc542){return _0x4db686[_0x8630('0x19')](_0xf31c17)['json'](_0x4cc542);}};}function respondWithFilteredResult(_0x53f236,_0x29a42d){return function(_0x86c262){if(_0x86c262){var _0x49fce1=typeof _0x29a42d['offset']===_0x8630('0x1a')&&typeof _0x29a42d['limit']===_0x8630('0x1a');var _0x18a874=_0x86c262[_0x8630('0x1b')];var _0x20f462=_0x49fce1?0x0:_0x29a42d[_0x8630('0x1c')];var _0x1e9780=_0x49fce1?_0x86c262[_0x8630('0x1b')]:_0x29a42d[_0x8630('0x1c')]+_0x29a42d[_0x8630('0x1d')];var _0x5dd2e0;if(_0x1e9780>=_0x18a874){_0x1e9780=_0x18a874;_0x5dd2e0=0xc8;}else{_0x5dd2e0=0xce;}_0x53f236['status'](_0x5dd2e0);return _0x53f236[_0x8630('0x1e')](_0x8630('0x1f'),_0x20f462+'-'+_0x1e9780+'/'+_0x18a874)['json'](_0x86c262);}return null;};}function patchUpdates(_0x5cff5c){return function(_0x1325dc){try{jsonpatch[_0x8630('0x20')](_0x1325dc,_0x5cff5c,!![]);}catch(_0x1ac046){return BPromise['reject'](_0x1ac046);}return _0x1325dc['save']();};}function saveUpdates(_0xcc7454,_0x58c0b5){return function(_0x30fb4d){if(_0x30fb4d){return _0x30fb4d[_0x8630('0x21')](_0xcc7454)[_0x8630('0x22')](function(_0x469de3){return _0x469de3;});}return null;};}function removeEntity(_0x4c2851,_0x37c224){return function(_0xf24c11){if(_0xf24c11){return _0xf24c11[_0x8630('0x23')]()[_0x8630('0x22')](function(){_0x4c2851[_0x8630('0x19')](0xcc)[_0x8630('0x18')]();});}};}function handleEntityNotFound(_0x37b7aa,_0x5c0a22){return function(_0x5b2823){if(!_0x5b2823){_0x37b7aa[_0x8630('0x17')](0x194);}return _0x5b2823;};}function handleError(_0x41b79d,_0x439b33){_0x439b33=_0x439b33||0x1f4;return function(_0xf97e31){logger[_0x8630('0x24')](_0xf97e31[_0x8630('0x25')]);if(_0xf97e31[_0x8630('0x26')]){delete _0xf97e31[_0x8630('0x26')];}_0x41b79d[_0x8630('0x19')](_0x439b33)[_0x8630('0x27')](_0xf97e31);};}exports[_0x8630('0x28')]=function(_0x41f74c,_0xc18164){var _0x4285ee={'raw':!![],'where':{'id':_0x41f74c[_0x8630('0x29')]['id']}},_0xbb1a58={};_0xbb1a58[_0x8630('0x2a')]=_['keys'](db[_0x8630('0x2b')][_0x8630('0x2c')]);_0xbb1a58[_0x8630('0x2d')]=_[_0x8630('0x2e')](_0x41f74c['query']);_0xbb1a58[_0x8630('0x2f')]=_[_0x8630('0x30')](_0xbb1a58[_0x8630('0x2a')],_0xbb1a58[_0x8630('0x2d')]);_0x4285ee[_0x8630('0x31')]=_[_0x8630('0x30')](_0xbb1a58['model'],qs[_0x8630('0x32')](_0x41f74c[_0x8630('0x2d')][_0x8630('0x32')]));_0x4285ee['attributes']=_0x4285ee[_0x8630('0x31')][_0x8630('0x33')]?_0x4285ee[_0x8630('0x31')]:_0xbb1a58[_0x8630('0x2a')];if(_0x41f74c[_0x8630('0x2d')][_0x8630('0x34')]){_0x4285ee['include']=[{'all':!![]}];}_0x4285ee=_[_0x8630('0x35')]({},_0x4285ee,_0x41f74c[_0x8630('0x36')]);return db[_0x8630('0x2b')][_0x8630('0x37')](_0x4285ee)[_0x8630('0x22')](handleEntityNotFound(_0xc18164,null))[_0x8630('0x22')](respondWithResult(_0xc18164,null))[_0x8630('0x38')](handleError(_0xc18164,null));};exports[_0x8630('0x21')]=function(_0x141d05,_0x355a2f){if(_0x141d05[_0x8630('0x39')]['id']){delete _0x141d05[_0x8630('0x39')]['id'];}return db[_0x8630('0x2b')][_0x8630('0x37')]({'where':{'id':_0x141d05[_0x8630('0x29')]['id']}})[_0x8630('0x22')](handleEntityNotFound(_0x355a2f,null))[_0x8630('0x22')](saveUpdates(_0x141d05['body'],null))[_0x8630('0x22')](respondWithResult(_0x355a2f,null))[_0x8630('0x38')](handleError(_0x355a2f,null));};exports['destroy']=function(_0x5d97e1,_0x24e5d9){return db[_0x8630('0x2b')][_0x8630('0x37')]({'where':{'id':_0x5d97e1[_0x8630('0x29')]['id']}})[_0x8630('0x22')](handleEntityNotFound(_0x24e5d9,null))['then'](removeEntity(_0x24e5d9,null))[_0x8630('0x38')](handleError(_0x24e5d9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a7ea468..1a9318b 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 _0x75e0=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x75e0,0x1c8));var _0x075e=function(_0x37c1d2,_0x33b3da){_0x37c1d2=_0x37c1d2-0x0;var _0x67375=_0x75e0[_0x37c1d2];return _0x67375;};'use strict';var _=require(_0x075e('0x0'));var util=require(_0x075e('0x1'));var logger=require(_0x075e('0x2'))('api');var moment=require(_0x075e('0x3'));var BPromise=require(_0x075e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x075e('0x5'));var rimraf=require('rimraf');var config=require(_0x075e('0x6'));var attributes=require(_0x075e('0x7'));module[_0x075e('0x8')]=function(_0x17a2ff,_0x379b0e){return _0x17a2ff[_0x075e('0x9')](_0x075e('0xa'),attributes,{'tableName':_0x075e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x075e('0xc'),'collate':_0x075e('0xd')});}; \ No newline at end of file +var _0x5704=['chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x1fa633,_0x30cd2c){var _0x2cc486=function(_0xa44dcf){while(--_0xa44dcf){_0x1fa633['push'](_0x1fa633['shift']());}};_0x2cc486(++_0x30cd2c);}(_0x5704,0x1e3));var _0x4570=function(_0x137d0c,_0x133d7e){_0x137d0c=_0x137d0c-0x0;var _0x51f5ea=_0x5704[_0x137d0c];return _0x51f5ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4570('0x0'))(_0x4570('0x1'));var moment=require(_0x4570('0x2'));var BPromise=require(_0x4570('0x3'));var rp=require(_0x4570('0x4'));var fs=require('fs');var path=require(_0x4570('0x5'));var rimraf=require(_0x4570('0x6'));var config=require(_0x4570('0x7'));var attributes=require(_0x4570('0x8'));module[_0x4570('0x9')]=function(_0x535a6d,_0x4e9ea8){return _0x535a6d[_0x4570('0xa')](_0x4570('0xb'),attributes,{'tableName':_0x4570('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4570('0xd'),'collate':_0x4570('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a7b7c79..1b705c1 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 _0x7731=['debug','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/environment','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x11691e,_0x148f26){var _0x35fd19=function(_0x3324ea){while(--_0x3324ea){_0x11691e['push'](_0x11691e['shift']());}};_0x35fd19(++_0x148f26);}(_0x7731,0x1a6));var _0x1773=function(_0x4d883e,_0x3f74fd){_0x4d883e=_0x4d883e-0x0;var _0x2f7fc9=_0x7731[_0x4d883e];return _0x2f7fc9;};'use strict';var _=require(_0x1773('0x0'));var util=require(_0x1773('0x1'));var moment=require(_0x1773('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1773('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1773('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf83acc,_0x368043,_0x2f6b4f){return new BPromise(function(_0x238043,_0x57d81c){return client[_0x1773('0x5')](_0xf83acc,_0x2f6b4f)[_0x1773('0x6')](function(_0x10857a){logger[_0x1773('0x7')](_0x1773('0x8'),_0x368043,_0x1773('0x9'));logger[_0x1773('0xa')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x368043,_0x1773('0x9'),JSON[_0x1773('0xb')](_0x10857a));if(_0x10857a[_0x1773('0xc')]){if(_0x10857a['error']['code']===0x1f4){logger[_0x1773('0xc')](_0x1773('0x8'),_0x368043,_0x10857a[_0x1773('0xc')]['message']);return _0x57d81c(_0x10857a['error']['message']);}logger[_0x1773('0xc')](_0x1773('0x8'),_0x368043,_0x10857a[_0x1773('0xc')][_0x1773('0xd')]);return _0x238043(_0x10857a[_0x1773('0xc')][_0x1773('0xd')]);}else{logger[_0x1773('0x7')]('ChatApplication,\x20%s,\x20%s',_0x368043,_0x1773('0x9'));_0x238043(_0x10857a[_0x1773('0xe')][_0x1773('0xd')]);}})[_0x1773('0xf')](function(_0x232508){logger['error'](_0x1773('0x8'),_0x368043,_0x232508);_0x57d81c(_0x232508);});});} \ No newline at end of file +var _0xdc0d=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x284321,_0x4e0767){var _0x4b184d=function(_0x2eaab5){while(--_0x2eaab5){_0x284321['push'](_0x284321['shift']());}};_0x4b184d(++_0x4e0767);}(_0xdc0d,0xfc));var _0xddc0=function(_0x3d7812,_0x584fad){_0x3d7812=_0x3d7812-0x0;var _0x3286d7=_0xdc0d[_0x3d7812];return _0x3286d7;};'use strict';var _=require('lodash');var util=require(_0xddc0('0x0'));var moment=require(_0xddc0('0x1'));var BPromise=require(_0xddc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddc0('0x3'))['db'];var utils=require(_0xddc0('0x4'));var logger=require(_0xddc0('0x5'))(_0xddc0('0x6'));var config=require('../../config/environment');var jayson=require(_0xddc0('0x7'));var client=jayson[_0xddc0('0x8')][_0xddc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d2871,_0x507447,_0x34fc24){return new BPromise(function(_0x2d7195,_0x3298ee){return client[_0xddc0('0xa')](_0x1d2871,_0x34fc24)['then'](function(_0x3572ff){logger[_0xddc0('0xb')]('ChatApplication,\x20%s,\x20%s',_0x507447,_0xddc0('0xc'));logger[_0xddc0('0xd')](_0xddc0('0xe'),_0x507447,_0xddc0('0xc'),JSON['stringify'](_0x3572ff));if(_0x3572ff[_0xddc0('0xf')]){if(_0x3572ff['error'][_0xddc0('0x10')]===0x1f4){logger[_0xddc0('0xf')](_0xddc0('0x11'),_0x507447,_0x3572ff[_0xddc0('0xf')][_0xddc0('0x12')]);return _0x3298ee(_0x3572ff[_0xddc0('0xf')][_0xddc0('0x12')]);}logger[_0xddc0('0xf')](_0xddc0('0x11'),_0x507447,_0x3572ff[_0xddc0('0xf')][_0xddc0('0x12')]);return _0x2d7195(_0x3572ff['error'][_0xddc0('0x12')]);}else{logger[_0xddc0('0xb')](_0xddc0('0x11'),_0x507447,_0xddc0('0xc'));_0x2d7195(_0x3572ff[_0xddc0('0x13')][_0xddc0('0x12')]);}})[_0xddc0('0x14')](function(_0x558799){logger[_0xddc0('0xf')](_0xddc0('0x11'),_0x507447,_0x558799);_0x3298ee(_0x558799);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index da50f17..b531bec 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 _0xde40=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x433c2e,_0x3338c6){var _0x40acfa=function(_0x5adc05){while(--_0x5adc05){_0x433c2e['push'](_0x433c2e['shift']());}};_0x40acfa(++_0x3338c6);}(_0xde40,0xca));var _0x0de4=function(_0x25c85b,_0x4b3358){_0x25c85b=_0x25c85b-0x0;var _0x78f460=_0xde40[_0x25c85b];return _0x78f460;};'use strict';var multer=require(_0x0de4('0x0'));var util=require(_0x0de4('0x1'));var path=require(_0x0de4('0x2'));var timeout=require(_0x0de4('0x3'));var express=require('express');var router=express[_0x0de4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0de4('0x5'));var interaction=require(_0x0de4('0x6'));var config=require(_0x0de4('0x7'));var controller=require(_0x0de4('0x8'));router[_0x0de4('0x9')](_0x0de4('0xa'),auth['isAuthenticated'](),controller['show']);router['put'](_0x0de4('0xa'),auth['isAuthenticated'](),controller[_0x0de4('0xb')]);router[_0x0de4('0xc')](_0x0de4('0xa'),auth[_0x0de4('0xd')](),controller[_0x0de4('0xe')]);module[_0x0de4('0xf')]=router; \ No newline at end of file +var _0x3881=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','/:id','update','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x3881,0x117));var _0x1388=function(_0x14f02f,_0x74773b){_0x14f02f=_0x14f02f-0x0;var _0x364ff5=_0x3881[_0x14f02f];return _0x364ff5;};'use strict';var multer=require(_0x1388('0x0'));var util=require(_0x1388('0x1'));var path=require(_0x1388('0x2'));var timeout=require('connect-timeout');var express=require(_0x1388('0x3'));var router=express[_0x1388('0x4')]();var fs_extra=require(_0x1388('0x5'));var auth=require(_0x1388('0x6'));var interaction=require(_0x1388('0x7'));var config=require(_0x1388('0x8'));var controller=require(_0x1388('0x9'));router[_0x1388('0xa')]('/:id',auth[_0x1388('0xb')](),controller['show']);router['put'](_0x1388('0xc'),auth[_0x1388('0xb')](),controller[_0x1388('0xd')]);router['delete'](_0x1388('0xc'),auth[_0x1388('0xb')](),controller[_0x1388('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4df3fd2..5de27cb 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 _0xd600=['STRING','BOOLEAN','exports'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0xd600,0x1d6));var _0x0d60=function(_0x107c3f,_0x5334ee){_0x107c3f=_0x107c3f-0x0;var _0x23032d=_0xd600[_0x107c3f];return _0x23032d;};'use strict';var Sequelize=require('sequelize');module[_0x0d60('0x0')]={'name':{'type':Sequelize[_0x0d60('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0d60('0x1')]},'write':{'type':Sequelize[_0x0d60('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3c54=['BOOLEAN','sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3c54,0x14d));var _0x43c5=function(_0x1a46f9,_0x4275a9){_0x1a46f9=_0x1a46f9-0x0;var _0x4e8def=_0x3c54[_0x1a46f9];return _0x4e8def;};'use strict';var Sequelize=require(_0x43c5('0x0'));module[_0x43c5('0x1')]={'name':{'type':Sequelize[_0x43c5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x43c5('0x2')]},'write':{'type':Sequelize[_0x43c5('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 4e49d98..d2ab255 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 _0x9906=['merge','VIRTUAL','options','ChatGroup','includeAll','include','rows','catch','show','params','keys','fields','find','create','body','destroy','describe','getUnread','toInteger','addMembers','omit','getMembers','User','pick','removeMembers','ids','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x9906,0x1b3));var _0x6990=function(_0x541880,_0x27f2aa){_0x541880=_0x541880-0x0;var _0x2ff9ac=_0x9906[_0x541880];return _0x2ff9ac;};'use strict';var emlformat=require(_0x6990('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6990('0x1'));var jsonpatch=require(_0x6990('0x2'));var rp=require(_0x6990('0x3'));var moment=require(_0x6990('0x4'));var BPromise=require(_0x6990('0x5'));var Mustache=require(_0x6990('0x6'));var util=require(_0x6990('0x7'));var path=require(_0x6990('0x8'));var sox=require(_0x6990('0x9'));var csv=require('to-csv');var ejs=require(_0x6990('0xa'));var fs=require('fs');var fs_extra=require(_0x6990('0xb'));var _=require(_0x6990('0xc'));var squel=require(_0x6990('0xd'));var crypto=require(_0x6990('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6990('0xf'));var toCsv=require(_0x6990('0x10'));var querystring=require(_0x6990('0x11'));var Papa=require(_0x6990('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6990('0x13'));var as=require(_0x6990('0x14'));var hardwareService=require(_0x6990('0x15'));var logger=require(_0x6990('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6990('0x17'));var db=require(_0x6990('0x18'))['db'];config[_0x6990('0x19')]=_['defaults'](config['redis'],{'host':_0x6990('0x1a'),'port':0x18eb});var socket=require(_0x6990('0x1b'))(new Redis(config[_0x6990('0x19')]));require(_0x6990('0x1c'))[_0x6990('0x1d')](socket);function respondWithStatusCode(_0x41016a,_0x5d7296){_0x5d7296=_0x5d7296||0xcc;return function(_0x9e6faf){if(_0x9e6faf){return _0x41016a['sendStatus'](_0x5d7296);}return _0x41016a[_0x6990('0x1e')](_0x5d7296)[_0x6990('0x1f')]();};}function respondWithResult(_0x500b47,_0x4e8999){_0x4e8999=_0x4e8999||0xc8;return function(_0x5e35e9){if(_0x5e35e9){return _0x500b47['status'](_0x4e8999)[_0x6990('0x20')](_0x5e35e9);}};}function respondWithFilteredResult(_0xb2bb00,_0x4bae84){return function(_0x580656){if(_0x580656){var _0x3aac68=typeof _0x4bae84['offset']===_0x6990('0x21')&&typeof _0x4bae84['limit']===_0x6990('0x21');var _0x3c42ef=_0x580656[_0x6990('0x22')];var _0x185f0f=_0x3aac68?0x0:_0x4bae84[_0x6990('0x23')];var _0x55a454=_0x3aac68?_0x580656[_0x6990('0x22')]:_0x4bae84['offset']+_0x4bae84['limit'];var _0x264008;if(_0x55a454>=_0x3c42ef){_0x55a454=_0x3c42ef;_0x264008=0xc8;}else{_0x264008=0xce;}_0xb2bb00[_0x6990('0x1e')](_0x264008);return _0xb2bb00[_0x6990('0x24')](_0x6990('0x25'),_0x185f0f+'-'+_0x55a454+'/'+_0x3c42ef)[_0x6990('0x20')](_0x580656);}return null;};}function patchUpdates(_0x490f31){return function(_0x48163e){try{jsonpatch['apply'](_0x48163e,_0x490f31,!![]);}catch(_0x29b564){return BPromise[_0x6990('0x26')](_0x29b564);}return _0x48163e[_0x6990('0x27')]();};}function saveUpdates(_0x4347df,_0x1402c0){return function(_0x21c456){if(_0x21c456){return _0x21c456[_0x6990('0x28')](_0x4347df)[_0x6990('0x29')](function(_0x4d17ca){return _0x4d17ca;});}return null;};}function removeEntity(_0x308d88,_0xdddf5){return function(_0x19a6ff){if(_0x19a6ff){return _0x19a6ff['destroy']()[_0x6990('0x29')](function(){_0x308d88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x481e57,_0x260f3e){return function(_0x166bb2){if(!_0x166bb2){_0x481e57[_0x6990('0x2a')](0x194);}return _0x166bb2;};}function handleError(_0x47352e,_0x5b0f40){_0x5b0f40=_0x5b0f40||0x1f4;return function(_0x371039){logger['error'](_0x371039[_0x6990('0x2b')]);if(_0x371039[_0x6990('0x2c')]){delete _0x371039[_0x6990('0x2c')];}_0x47352e[_0x6990('0x1e')](_0x5b0f40)[_0x6990('0x2d')](_0x371039);};}exports[_0x6990('0x2e')]=function(_0x4a5212,_0x535945){var _0x43d9fb={},_0x5b5091={},_0x4d2395={'count':0x0,'rows':[]};var _0x77a7f2=_[_0x6990('0x2f')](db['ChatGroup'][_0x6990('0x30')],function(_0x34f8c5){return{'name':_0x34f8c5[_0x6990('0x31')],'type':_0x34f8c5[_0x6990('0x32')][_0x6990('0x33')]};});_0x5b5091[_0x6990('0x34')]=_[_0x6990('0x2f')](_0x77a7f2,_0x6990('0x2c'));_0x5b5091[_0x6990('0x35')]=_['keys'](_0x4a5212[_0x6990('0x35')]);_0x5b5091['filters']=_[_0x6990('0x36')](_0x5b5091['model'],_0x5b5091['query']);_0x43d9fb[_0x6990('0x37')]=_[_0x6990('0x36')](_0x5b5091[_0x6990('0x34')],qs['fields'](_0x4a5212[_0x6990('0x35')]['fields']));_0x43d9fb[_0x6990('0x37')]=_0x43d9fb[_0x6990('0x37')][_0x6990('0x38')]?_0x43d9fb[_0x6990('0x37')]:_0x5b5091[_0x6990('0x34')];if(!_0x4a5212[_0x6990('0x35')][_0x6990('0x39')](_0x6990('0x3a'))){_0x43d9fb[_0x6990('0x3b')]=qs['limit'](_0x4a5212[_0x6990('0x35')]['limit']);_0x43d9fb[_0x6990('0x23')]=qs[_0x6990('0x23')](_0x4a5212[_0x6990('0x35')][_0x6990('0x23')]);}_0x43d9fb[_0x6990('0x3c')]=qs[_0x6990('0x3d')](_0x4a5212['query'][_0x6990('0x3d')]);_0x43d9fb[_0x6990('0x3e')]=qs['filters'](_['pick'](_0x4a5212[_0x6990('0x35')],_0x5b5091[_0x6990('0x3f')]),_0x77a7f2);if(_0x4a5212[_0x6990('0x35')][_0x6990('0x40')]){_0x43d9fb['where']=_[_0x6990('0x41')](_0x43d9fb[_0x6990('0x3e')],{'$or':_[_0x6990('0x2f')](_0x77a7f2,function(_0x321b2e){if(_0x321b2e[_0x6990('0x32')]!==_0x6990('0x42')){var _0x36fe4d={};_0x36fe4d[_0x321b2e[_0x6990('0x2c')]]={'$like':'%'+_0x4a5212[_0x6990('0x35')]['filter']+'%'};return _0x36fe4d;}})});}_0x43d9fb=_[_0x6990('0x41')]({},_0x43d9fb,_0x4a5212[_0x6990('0x43')]);var _0x5b5a61={'where':_0x43d9fb[_0x6990('0x3e')]};return db[_0x6990('0x44')][_0x6990('0x22')](_0x5b5a61)[_0x6990('0x29')](function(_0x37d071){_0x4d2395[_0x6990('0x22')]=_0x37d071;if(_0x4a5212[_0x6990('0x35')][_0x6990('0x45')]){_0x43d9fb[_0x6990('0x46')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x43d9fb);})[_0x6990('0x29')](function(_0x52efab){_0x4d2395[_0x6990('0x47')]=_0x52efab;return _0x4d2395;})['then'](respondWithFilteredResult(_0x535945,_0x43d9fb))[_0x6990('0x48')](handleError(_0x535945,null));};exports[_0x6990('0x49')]=function(_0xae4747,_0x3ad938){var _0x4cddf9={'raw':!![],'where':{'id':_0xae4747[_0x6990('0x4a')]['id']}},_0x2bc71a={};_0x2bc71a['model']=_[_0x6990('0x4b')](db[_0x6990('0x44')][_0x6990('0x30')]);_0x2bc71a[_0x6990('0x35')]=_[_0x6990('0x4b')](_0xae4747[_0x6990('0x35')]);_0x2bc71a[_0x6990('0x3f')]=_['intersection'](_0x2bc71a[_0x6990('0x34')],_0x2bc71a[_0x6990('0x35')]);_0x4cddf9[_0x6990('0x37')]=_['intersection'](_0x2bc71a[_0x6990('0x34')],qs[_0x6990('0x4c')](_0xae4747['query'][_0x6990('0x4c')]));_0x4cddf9[_0x6990('0x37')]=_0x4cddf9[_0x6990('0x37')][_0x6990('0x38')]?_0x4cddf9['attributes']:_0x2bc71a['model'];if(_0xae4747[_0x6990('0x35')]['includeAll']){_0x4cddf9['include']=[{'all':!![]}];}_0x4cddf9=_[_0x6990('0x41')]({},_0x4cddf9,_0xae4747['options']);return db[_0x6990('0x44')][_0x6990('0x4d')](_0x4cddf9)['then'](handleEntityNotFound(_0x3ad938,null))['then'](respondWithResult(_0x3ad938,null))[_0x6990('0x48')](handleError(_0x3ad938,null));};exports[_0x6990('0x4e')]=function(_0x8a22e3,_0x49e268){return db[_0x6990('0x44')][_0x6990('0x4e')](_0x8a22e3[_0x6990('0x4f')],{})[_0x6990('0x29')](respondWithResult(_0x49e268,0xc9))[_0x6990('0x48')](handleError(_0x49e268,null));};exports[_0x6990('0x28')]=function(_0x4ffc87,_0x488b7f){if(_0x4ffc87[_0x6990('0x4f')]['id']){delete _0x4ffc87['body']['id'];}return db[_0x6990('0x44')][_0x6990('0x4d')]({'where':{'id':_0x4ffc87[_0x6990('0x4a')]['id']}})[_0x6990('0x29')](handleEntityNotFound(_0x488b7f,null))['then'](saveUpdates(_0x4ffc87[_0x6990('0x4f')],null))['then'](respondWithResult(_0x488b7f,null))[_0x6990('0x48')](handleError(_0x488b7f,null));};exports[_0x6990('0x50')]=function(_0x4f2ba9,_0x365f2e){return db[_0x6990('0x44')][_0x6990('0x4d')]({'where':{'id':_0x4f2ba9['params']['id']}})['then'](handleEntityNotFound(_0x365f2e,null))['then'](removeEntity(_0x365f2e,null))[_0x6990('0x48')](handleError(_0x365f2e,null));};exports[_0x6990('0x51')]=function(_0x5c3877,_0x183a4e){return db['ChatGroup'][_0x6990('0x51')]()[_0x6990('0x29')](respondWithResult(_0x183a4e,null))[_0x6990('0x48')](handleError(_0x183a4e,null));};exports[_0x6990('0x52')]=function(_0x2d9faa,_0x24b41c,_0x46cf25){return db['ChatInternalMessage'][_0x6990('0x22')]({'where':{'ChatGroupId':_0x2d9faa[_0x6990('0x4a')]['id'],'ToId':_0x2d9faa['user']['id'],'read':![]}})[_0x6990('0x29')](function(_0x5e816a){return{'id':_[_0x6990('0x53')](_0x2d9faa[_0x6990('0x4a')]['id']),'count':_0x5e816a};})['then'](respondWithResult(_0x24b41c,null))[_0x6990('0x48')](handleError(_0x24b41c,null));};exports[_0x6990('0x54')]=function(_0x11ea34,_0x8f7b5a,_0x274c65){return db['ChatGroup'][_0x6990('0x4d')]({'where':{'id':_0x11ea34['params']['id']}})[_0x6990('0x29')](handleEntityNotFound(_0x8f7b5a,null))['then'](function(_0x1528ef){if(_0x1528ef){return _0x1528ef['addMembers'](_0x11ea34['body']['ids'],_[_0x6990('0x55')](_0x11ea34[_0x6990('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x8f7b5a,null))[_0x6990('0x48')](handleError(_0x8f7b5a,null));};exports[_0x6990('0x56')]=function(_0x2fdee,_0x8852a5,_0x3b3e10){var _0x442659={};var _0x67c9c7={};var _0xfc7d6b;var _0x3f7eb9;return db['ChatGroup']['findOne']({'where':{'id':_0x2fdee['params']['id']}})[_0x6990('0x29')](handleEntityNotFound(_0x8852a5,null))[_0x6990('0x29')](function(_0x458e45){if(_0x458e45){_0xfc7d6b=_0x458e45;_0x67c9c7[_0x6990('0x34')]=_['keys'](db[_0x6990('0x57')][_0x6990('0x30')]);_0x67c9c7[_0x6990('0x35')]=_['keys'](_0x2fdee[_0x6990('0x35')]);_0x67c9c7[_0x6990('0x3f')]=_['intersection'](_0x67c9c7['model'],_0x67c9c7['query']);_0x442659[_0x6990('0x37')]=_['intersection'](_0x67c9c7[_0x6990('0x34')],qs[_0x6990('0x4c')](_0x2fdee['query'][_0x6990('0x4c')]));_0x442659['attributes']=_0x442659[_0x6990('0x37')][_0x6990('0x38')]?_0x442659[_0x6990('0x37')]:_0x67c9c7[_0x6990('0x34')];_0x442659[_0x6990('0x3c')]=qs[_0x6990('0x3d')](_0x2fdee[_0x6990('0x35')]['sort']);_0x442659[_0x6990('0x3e')]=qs[_0x6990('0x3f')](_[_0x6990('0x58')](_0x2fdee[_0x6990('0x35')],_0x67c9c7['filters']));if(_0x2fdee[_0x6990('0x35')][_0x6990('0x40')]){_0x442659[_0x6990('0x3e')]=_[_0x6990('0x41')](_0x442659[_0x6990('0x3e')],{'$or':_[_0x6990('0x2f')](_0x442659[_0x6990('0x37')],function(_0x5cf827){var _0x15f470={};_0x15f470[_0x5cf827]={'$like':'%'+_0x2fdee[_0x6990('0x35')][_0x6990('0x40')]+'%'};return _0x15f470;})});}_0x442659=_[_0x6990('0x41')]({},_0x442659,_0x2fdee[_0x6990('0x43')]);return _0xfc7d6b[_0x6990('0x56')](_0x442659);}})['then'](function(_0x530600){if(_0x530600){_0x3f7eb9=_0x530600[_0x6990('0x38')];if(!_0x2fdee[_0x6990('0x35')]['hasOwnProperty']('nolimit')){_0x442659[_0x6990('0x3b')]=qs[_0x6990('0x3b')](_0x2fdee[_0x6990('0x35')][_0x6990('0x3b')]);_0x442659[_0x6990('0x23')]=qs[_0x6990('0x23')](_0x2fdee[_0x6990('0x35')][_0x6990('0x23')]);}return _0xfc7d6b['getMembers'](_0x442659);}})['then'](function(_0x42522b){if(_0x42522b){return _0x42522b?{'count':_0x3f7eb9,'rows':_0x42522b}:null;}})['then'](respondWithResult(_0x8852a5,null))[_0x6990('0x48')](handleError(_0x8852a5,null));};exports[_0x6990('0x59')]=function(_0x53a104,_0x939b84,_0x36b70e){return db[_0x6990('0x44')][_0x6990('0x4d')]({'where':{'id':_0x53a104[_0x6990('0x4a')]['id']}})[_0x6990('0x29')](handleEntityNotFound(_0x939b84,null))[_0x6990('0x29')](function(_0x316156){if(_0x316156){return _0x316156[_0x6990('0x59')](_0x53a104[_0x6990('0x35')][_0x6990('0x5a')]);}})[_0x6990('0x29')](respondWithStatusCode(_0x939b84,null))[_0x6990('0x48')](handleError(_0x939b84,null));};exports[_0x6990('0x5b')]=function(_0xea3295,_0x2459e3,_0x487785){if(_0xea3295['body']['id']){delete _0xea3295[_0x6990('0x4f')]['id'];}return db[_0x6990('0x44')][_0x6990('0x4d')]({'where':{'id':_0xea3295[_0x6990('0x4a')]['id']}})[_0x6990('0x29')](handleEntityNotFound(_0x2459e3,null))['then'](function(_0x475925){if(_0x475925){_0xea3295[_0x6990('0x4f')][_0x6990('0x5c')]=_0x475925['id'];return db[_0x6990('0x5d')]['create'](_0xea3295[_0x6990('0x4f')]);}})[_0x6990('0x29')](respondWithResult(_0x2459e3,null))['catch'](handleError(_0x2459e3,null));};exports[_0x6990('0x5e')]=function(_0x4deb3e,_0x481508,_0x3db33d){var _0x32ac39={};var _0xb912ab={};var _0x118ad2;var _0x359729;return db[_0x6990('0x44')][_0x6990('0x5f')]({'where':{'id':_0x4deb3e[_0x6990('0x4a')]['id']}})[_0x6990('0x29')](handleEntityNotFound(_0x481508,null))[_0x6990('0x29')](function(_0x3424fc){if(_0x3424fc){_0x118ad2=_0x3424fc;_0xb912ab[_0x6990('0x34')]=_[_0x6990('0x4b')](db['ChatInternalMessage'][_0x6990('0x30')]);_0xb912ab[_0x6990('0x35')]=_[_0x6990('0x4b')](_0x4deb3e[_0x6990('0x35')]);_0xb912ab[_0x6990('0x3f')]=_[_0x6990('0x36')](_0xb912ab[_0x6990('0x34')],_0xb912ab[_0x6990('0x35')]);_0x32ac39[_0x6990('0x37')]=_[_0x6990('0x36')](_0xb912ab[_0x6990('0x34')],qs[_0x6990('0x4c')](_0x4deb3e[_0x6990('0x35')]['fields']));_0x32ac39['attributes']=_0x32ac39[_0x6990('0x37')][_0x6990('0x38')]?_0x32ac39[_0x6990('0x37')]:_0xb912ab[_0x6990('0x34')];_0x32ac39[_0x6990('0x3c')]=qs[_0x6990('0x3d')](_0x4deb3e['query'][_0x6990('0x3d')]);_0x32ac39[_0x6990('0x3e')]=qs['filters'](_[_0x6990('0x58')](_0x4deb3e[_0x6990('0x35')],_0xb912ab[_0x6990('0x3f')]));if(_0x4deb3e[_0x6990('0x35')][_0x6990('0x40')]){_0x32ac39[_0x6990('0x3e')]=_[_0x6990('0x41')](_0x32ac39[_0x6990('0x3e')],{'$or':_[_0x6990('0x2f')](_0x32ac39[_0x6990('0x37')],function(_0x2802da){var _0x6ad376={};_0x6ad376[_0x2802da]={'$like':'%'+_0x4deb3e[_0x6990('0x35')][_0x6990('0x40')]+'%'};return _0x6ad376;})});}if(_0x4deb3e['query'][_0x6990('0x60')]){var _0x30c134=_0x4deb3e['query']['$gte'][_0x6990('0x61')](',');var _0x3085bd={};_0x3085bd[_0x30c134[0x0]]={'$gte':moment(_0x30c134[0x1])[_0x6990('0x62')](_0x6990('0x63'))};_0x32ac39[_0x6990('0x3e')]=_[_0x6990('0x41')](_0x32ac39['where'],_0x3085bd);}_0x32ac39=_[_0x6990('0x41')]({},_0x32ac39,_0x4deb3e['options']);return _0x118ad2[_0x6990('0x5e')](_0x32ac39);}})['then'](function(_0x494bd3){if(_0x494bd3){_0x359729=_0x494bd3[_0x6990('0x38')];if(!_0x4deb3e['query'][_0x6990('0x39')](_0x6990('0x3a'))){_0x32ac39[_0x6990('0x3b')]=qs[_0x6990('0x3b')](_0x4deb3e[_0x6990('0x35')][_0x6990('0x3b')]);_0x32ac39[_0x6990('0x23')]=qs['offset'](_0x4deb3e[_0x6990('0x35')][_0x6990('0x23')]);}return _0x118ad2[_0x6990('0x5e')](_0x32ac39);}})[_0x6990('0x29')](function(_0x3a6fb9){if(_0x3a6fb9){return _0x3a6fb9?{'count':_0x359729,'rows':_0x3a6fb9}:null;}})[_0x6990('0x29')](respondWithResult(_0x481508,null))[_0x6990('0x48')](handleError(_0x481508,null));}; \ No newline at end of file +var _0x182a=['filters','intersection','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','keys','include','create','body','find','describe','getUnread','user','addMembers','ids','omit','getMembers','findOne','length','sort','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query'];(function(_0x14ba90,_0x916176){var _0x4337a3=function(_0x470ded){while(--_0x470ded){_0x14ba90['push'](_0x14ba90['shift']());}};_0x4337a3(++_0x916176);}(_0x182a,0x1b8));var _0xa182=function(_0x16522a,_0x187509){_0x16522a=_0x16522a-0x0;var _0x32fce2=_0x182a[_0x16522a];return _0x32fce2;};'use strict';var emlformat=require(_0xa182('0x0'));var rimraf=require(_0xa182('0x1'));var zipdir=require(_0xa182('0x2'));var jsonpatch=require(_0xa182('0x3'));var rp=require(_0xa182('0x4'));var moment=require(_0xa182('0x5'));var BPromise=require(_0xa182('0x6'));var Mustache=require(_0xa182('0x7'));var util=require(_0xa182('0x8'));var path=require(_0xa182('0x9'));var sox=require(_0xa182('0xa'));var csv=require('to-csv');var ejs=require(_0xa182('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa182('0xc'));var crypto=require(_0xa182('0xd'));var jsforce=require(_0xa182('0xe'));var deskjs=require(_0xa182('0xf'));var toCsv=require(_0xa182('0x10'));var querystring=require('querystring');var Papa=require(_0xa182('0x11'));var Redis=require(_0xa182('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa182('0x13'));var as=require(_0xa182('0x14'));var hardwareService=require(_0xa182('0x15'));var logger=require(_0xa182('0x16'))(_0xa182('0x17'));var utils=require(_0xa182('0x18'));var config=require(_0xa182('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa182('0x1a'))['db'];config[_0xa182('0x1b')]=_[_0xa182('0x1c')](config[_0xa182('0x1b')],{'host':_0xa182('0x1d'),'port':0x18eb});var socket=require(_0xa182('0x1e'))(new Redis(config[_0xa182('0x1b')]));require(_0xa182('0x1f'))[_0xa182('0x20')](socket);function respondWithStatusCode(_0x198194,_0xfb94bf){_0xfb94bf=_0xfb94bf||0xcc;return function(_0x158e26){if(_0x158e26){return _0x198194[_0xa182('0x21')](_0xfb94bf);}return _0x198194['status'](_0xfb94bf)['end']();};}function respondWithResult(_0x3e32bf,_0xc3b38f){_0xc3b38f=_0xc3b38f||0xc8;return function(_0x315c0c){if(_0x315c0c){return _0x3e32bf[_0xa182('0x22')](_0xc3b38f)[_0xa182('0x23')](_0x315c0c);}};}function respondWithFilteredResult(_0x4e4b25,_0x47b080){return function(_0x12fd33){if(_0x12fd33){var _0x42c835=typeof _0x47b080[_0xa182('0x24')]===_0xa182('0x25')&&typeof _0x47b080[_0xa182('0x26')]==='undefined';var _0x874cf=_0x12fd33[_0xa182('0x27')];var _0x5b67e1=_0x42c835?0x0:_0x47b080['offset'];var _0x2aa5b8=_0x42c835?_0x12fd33['count']:_0x47b080[_0xa182('0x24')]+_0x47b080[_0xa182('0x26')];var _0x42889a;if(_0x2aa5b8>=_0x874cf){_0x2aa5b8=_0x874cf;_0x42889a=0xc8;}else{_0x42889a=0xce;}_0x4e4b25[_0xa182('0x22')](_0x42889a);return _0x4e4b25[_0xa182('0x28')](_0xa182('0x29'),_0x5b67e1+'-'+_0x2aa5b8+'/'+_0x874cf)['json'](_0x12fd33);}return null;};}function patchUpdates(_0x536f6d){return function(_0xf91b7c){try{jsonpatch[_0xa182('0x2a')](_0xf91b7c,_0x536f6d,!![]);}catch(_0x31449f){return BPromise['reject'](_0x31449f);}return _0xf91b7c[_0xa182('0x2b')]();};}function saveUpdates(_0x3c23b2,_0x208ce4){return function(_0x52b966){if(_0x52b966){return _0x52b966[_0xa182('0x2c')](_0x3c23b2)[_0xa182('0x2d')](function(_0xf6192){return _0xf6192;});}return null;};}function removeEntity(_0x26f19b,_0xc89763){return function(_0x2d53ec){if(_0x2d53ec){return _0x2d53ec[_0xa182('0x2e')]()[_0xa182('0x2d')](function(){_0x26f19b[_0xa182('0x22')](0xcc)[_0xa182('0x2f')]();});}};}function handleEntityNotFound(_0x112c40,_0x5a1754){return function(_0x1416ae){if(!_0x1416ae){_0x112c40[_0xa182('0x21')](0x194);}return _0x1416ae;};}function handleError(_0x305ea3,_0x191605){_0x191605=_0x191605||0x1f4;return function(_0x39ee0f){logger[_0xa182('0x30')](_0x39ee0f[_0xa182('0x31')]);if(_0x39ee0f[_0xa182('0x32')]){delete _0x39ee0f[_0xa182('0x32')];}_0x305ea3[_0xa182('0x22')](_0x191605)['send'](_0x39ee0f);};}exports[_0xa182('0x33')]=function(_0x41a6bd,_0x599019){var _0x52a908={},_0x2a8026={},_0x522519={'count':0x0,'rows':[]};var _0x101944=_[_0xa182('0x34')](db[_0xa182('0x35')][_0xa182('0x36')],function(_0x20ab5b){return{'name':_0x20ab5b[_0xa182('0x37')],'type':_0x20ab5b[_0xa182('0x38')][_0xa182('0x39')]};});_0x2a8026[_0xa182('0x3a')]=_[_0xa182('0x34')](_0x101944,_0xa182('0x32'));_0x2a8026[_0xa182('0x3b')]=_['keys'](_0x41a6bd[_0xa182('0x3b')]);_0x2a8026[_0xa182('0x3c')]=_['intersection'](_0x2a8026['model'],_0x2a8026[_0xa182('0x3b')]);_0x52a908['attributes']=_[_0xa182('0x3d')](_0x2a8026[_0xa182('0x3a')],qs[_0xa182('0x3e')](_0x41a6bd[_0xa182('0x3b')]['fields']));_0x52a908['attributes']=_0x52a908[_0xa182('0x3f')]['length']?_0x52a908[_0xa182('0x3f')]:_0x2a8026['model'];if(!_0x41a6bd[_0xa182('0x3b')][_0xa182('0x40')]('nolimit')){_0x52a908[_0xa182('0x26')]=qs[_0xa182('0x26')](_0x41a6bd['query'][_0xa182('0x26')]);_0x52a908[_0xa182('0x24')]=qs['offset'](_0x41a6bd['query']['offset']);}_0x52a908[_0xa182('0x41')]=qs['sort'](_0x41a6bd['query']['sort']);_0x52a908[_0xa182('0x42')]=qs[_0xa182('0x3c')](_[_0xa182('0x43')](_0x41a6bd[_0xa182('0x3b')],_0x2a8026['filters']),_0x101944);if(_0x41a6bd[_0xa182('0x3b')][_0xa182('0x44')]){_0x52a908['where']=_[_0xa182('0x45')](_0x52a908['where'],{'$or':_[_0xa182('0x34')](_0x101944,function(_0x506c80){if(_0x506c80[_0xa182('0x38')]!==_0xa182('0x46')){var _0x4e88c2={};_0x4e88c2[_0x506c80[_0xa182('0x32')]]={'$like':'%'+_0x41a6bd[_0xa182('0x3b')][_0xa182('0x44')]+'%'};return _0x4e88c2;}})});}_0x52a908=_[_0xa182('0x45')]({},_0x52a908,_0x41a6bd[_0xa182('0x47')]);var _0x2c32dd={'where':_0x52a908['where']};return db[_0xa182('0x35')]['count'](_0x2c32dd)[_0xa182('0x2d')](function(_0xca115b){_0x522519['count']=_0xca115b;if(_0x41a6bd['query']['includeAll']){_0x52a908['include']=[{'all':!![]}];}return db[_0xa182('0x35')]['findAll'](_0x52a908);})[_0xa182('0x2d')](function(_0x27e3b5){_0x522519[_0xa182('0x48')]=_0x27e3b5;return _0x522519;})[_0xa182('0x2d')](respondWithFilteredResult(_0x599019,_0x52a908))[_0xa182('0x49')](handleError(_0x599019,null));};exports[_0xa182('0x4a')]=function(_0x17270b,_0x35044e){var _0x35c0df={'raw':!![],'where':{'id':_0x17270b[_0xa182('0x4b')]['id']}},_0x53b268={};_0x53b268[_0xa182('0x3a')]=_[_0xa182('0x4c')](db['ChatGroup'][_0xa182('0x36')]);_0x53b268[_0xa182('0x3b')]=_[_0xa182('0x4c')](_0x17270b[_0xa182('0x3b')]);_0x53b268[_0xa182('0x3c')]=_[_0xa182('0x3d')](_0x53b268[_0xa182('0x3a')],_0x53b268[_0xa182('0x3b')]);_0x35c0df[_0xa182('0x3f')]=_[_0xa182('0x3d')](_0x53b268[_0xa182('0x3a')],qs[_0xa182('0x3e')](_0x17270b[_0xa182('0x3b')]['fields']));_0x35c0df[_0xa182('0x3f')]=_0x35c0df[_0xa182('0x3f')]['length']?_0x35c0df[_0xa182('0x3f')]:_0x53b268[_0xa182('0x3a')];if(_0x17270b['query']['includeAll']){_0x35c0df[_0xa182('0x4d')]=[{'all':!![]}];}_0x35c0df=_[_0xa182('0x45')]({},_0x35c0df,_0x17270b[_0xa182('0x47')]);return db[_0xa182('0x35')]['find'](_0x35c0df)[_0xa182('0x2d')](handleEntityNotFound(_0x35044e,null))[_0xa182('0x2d')](respondWithResult(_0x35044e,null))[_0xa182('0x49')](handleError(_0x35044e,null));};exports[_0xa182('0x4e')]=function(_0x2136e0,_0x20f871){return db[_0xa182('0x35')][_0xa182('0x4e')](_0x2136e0[_0xa182('0x4f')],{})[_0xa182('0x2d')](respondWithResult(_0x20f871,0xc9))[_0xa182('0x49')](handleError(_0x20f871,null));};exports['update']=function(_0x41ef0d,_0x465210){if(_0x41ef0d[_0xa182('0x4f')]['id']){delete _0x41ef0d[_0xa182('0x4f')]['id'];}return db[_0xa182('0x35')][_0xa182('0x50')]({'where':{'id':_0x41ef0d[_0xa182('0x4b')]['id']}})[_0xa182('0x2d')](handleEntityNotFound(_0x465210,null))['then'](saveUpdates(_0x41ef0d[_0xa182('0x4f')],null))[_0xa182('0x2d')](respondWithResult(_0x465210,null))[_0xa182('0x49')](handleError(_0x465210,null));};exports[_0xa182('0x2e')]=function(_0x2e7bae,_0x57cc97){return db[_0xa182('0x35')][_0xa182('0x50')]({'where':{'id':_0x2e7bae['params']['id']}})['then'](handleEntityNotFound(_0x57cc97,null))[_0xa182('0x2d')](removeEntity(_0x57cc97,null))[_0xa182('0x49')](handleError(_0x57cc97,null));};exports[_0xa182('0x51')]=function(_0x271ac2,_0x34a46d){return db[_0xa182('0x35')][_0xa182('0x51')]()[_0xa182('0x2d')](respondWithResult(_0x34a46d,null))['catch'](handleError(_0x34a46d,null));};exports[_0xa182('0x52')]=function(_0x2605a6,_0x4ef82f,_0x12fcb5){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x2605a6[_0xa182('0x4b')]['id'],'ToId':_0x2605a6[_0xa182('0x53')]['id'],'read':![]}})[_0xa182('0x2d')](function(_0x40074e){return{'id':_['toInteger'](_0x2605a6['params']['id']),'count':_0x40074e};})[_0xa182('0x2d')](respondWithResult(_0x4ef82f,null))[_0xa182('0x49')](handleError(_0x4ef82f,null));};exports['addMembers']=function(_0x2b76cf,_0x1744e4,_0x47b387){return db[_0xa182('0x35')][_0xa182('0x50')]({'where':{'id':_0x2b76cf['params']['id']}})[_0xa182('0x2d')](handleEntityNotFound(_0x1744e4,null))[_0xa182('0x2d')](function(_0x3dba2a){if(_0x3dba2a){return _0x3dba2a[_0xa182('0x54')](_0x2b76cf['body'][_0xa182('0x55')],_[_0xa182('0x56')](_0x2b76cf[_0xa182('0x4f')],[_0xa182('0x55'),'id'])||{});}})[_0xa182('0x2d')](respondWithResult(_0x1744e4,null))[_0xa182('0x49')](handleError(_0x1744e4,null));};exports[_0xa182('0x57')]=function(_0x3d48e0,_0x3be141,_0x162ffd){var _0x11cdd4={};var _0x593999={};var _0x2c7522;var _0x137a6c;return db[_0xa182('0x35')][_0xa182('0x58')]({'where':{'id':_0x3d48e0[_0xa182('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3be141,null))[_0xa182('0x2d')](function(_0xd84e41){if(_0xd84e41){_0x2c7522=_0xd84e41;_0x593999[_0xa182('0x3a')]=_[_0xa182('0x4c')](db['User'][_0xa182('0x36')]);_0x593999[_0xa182('0x3b')]=_[_0xa182('0x4c')](_0x3d48e0[_0xa182('0x3b')]);_0x593999['filters']=_[_0xa182('0x3d')](_0x593999[_0xa182('0x3a')],_0x593999[_0xa182('0x3b')]);_0x11cdd4[_0xa182('0x3f')]=_[_0xa182('0x3d')](_0x593999[_0xa182('0x3a')],qs['fields'](_0x3d48e0[_0xa182('0x3b')][_0xa182('0x3e')]));_0x11cdd4[_0xa182('0x3f')]=_0x11cdd4[_0xa182('0x3f')][_0xa182('0x59')]?_0x11cdd4[_0xa182('0x3f')]:_0x593999[_0xa182('0x3a')];_0x11cdd4[_0xa182('0x41')]=qs[_0xa182('0x5a')](_0x3d48e0[_0xa182('0x3b')]['sort']);_0x11cdd4[_0xa182('0x42')]=qs[_0xa182('0x3c')](_[_0xa182('0x43')](_0x3d48e0[_0xa182('0x3b')],_0x593999[_0xa182('0x3c')]));if(_0x3d48e0['query'][_0xa182('0x44')]){_0x11cdd4[_0xa182('0x42')]=_[_0xa182('0x45')](_0x11cdd4[_0xa182('0x42')],{'$or':_[_0xa182('0x34')](_0x11cdd4[_0xa182('0x3f')],function(_0x458deb){var _0x258df5={};_0x258df5[_0x458deb]={'$like':'%'+_0x3d48e0[_0xa182('0x3b')][_0xa182('0x44')]+'%'};return _0x258df5;})});}_0x11cdd4=_[_0xa182('0x45')]({},_0x11cdd4,_0x3d48e0[_0xa182('0x47')]);return _0x2c7522[_0xa182('0x57')](_0x11cdd4);}})[_0xa182('0x2d')](function(_0x556e06){if(_0x556e06){_0x137a6c=_0x556e06[_0xa182('0x59')];if(!_0x3d48e0[_0xa182('0x3b')][_0xa182('0x40')](_0xa182('0x5b'))){_0x11cdd4[_0xa182('0x26')]=qs[_0xa182('0x26')](_0x3d48e0[_0xa182('0x3b')]['limit']);_0x11cdd4[_0xa182('0x24')]=qs['offset'](_0x3d48e0[_0xa182('0x3b')][_0xa182('0x24')]);}return _0x2c7522[_0xa182('0x57')](_0x11cdd4);}})[_0xa182('0x2d')](function(_0x134a4a){if(_0x134a4a){return _0x134a4a?{'count':_0x137a6c,'rows':_0x134a4a}:null;}})[_0xa182('0x2d')](respondWithResult(_0x3be141,null))[_0xa182('0x49')](handleError(_0x3be141,null));};exports[_0xa182('0x5c')]=function(_0x1dd72d,_0x43a062,_0x147a3f){return db[_0xa182('0x35')][_0xa182('0x50')]({'where':{'id':_0x1dd72d[_0xa182('0x4b')]['id']}})['then'](handleEntityNotFound(_0x43a062,null))[_0xa182('0x2d')](function(_0x33ecec){if(_0x33ecec){return _0x33ecec[_0xa182('0x5c')](_0x1dd72d[_0xa182('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x43a062,null))['catch'](handleError(_0x43a062,null));};exports[_0xa182('0x5d')]=function(_0x4d1f23,_0x372982,_0x1f2b8e){if(_0x4d1f23[_0xa182('0x4f')]['id']){delete _0x4d1f23[_0xa182('0x4f')]['id'];}return db[_0xa182('0x35')][_0xa182('0x50')]({'where':{'id':_0x4d1f23['params']['id']}})[_0xa182('0x2d')](handleEntityNotFound(_0x372982,null))[_0xa182('0x2d')](function(_0x399046){if(_0x399046){_0x4d1f23[_0xa182('0x4f')][_0xa182('0x5e')]=_0x399046['id'];return db[_0xa182('0x5f')][_0xa182('0x4e')](_0x4d1f23[_0xa182('0x4f')]);}})[_0xa182('0x2d')](respondWithResult(_0x372982,null))['catch'](handleError(_0x372982,null));};exports[_0xa182('0x60')]=function(_0x34f2c5,_0x55c53a,_0xa877a8){var _0x300b97={};var _0x506d07={};var _0x93e745;var _0x44abdf;return db[_0xa182('0x35')][_0xa182('0x58')]({'where':{'id':_0x34f2c5[_0xa182('0x4b')]['id']}})['then'](handleEntityNotFound(_0x55c53a,null))[_0xa182('0x2d')](function(_0xf57134){if(_0xf57134){_0x93e745=_0xf57134;_0x506d07[_0xa182('0x3a')]=_[_0xa182('0x4c')](db[_0xa182('0x5f')][_0xa182('0x36')]);_0x506d07[_0xa182('0x3b')]=_[_0xa182('0x4c')](_0x34f2c5[_0xa182('0x3b')]);_0x506d07['filters']=_[_0xa182('0x3d')](_0x506d07['model'],_0x506d07[_0xa182('0x3b')]);_0x300b97[_0xa182('0x3f')]=_[_0xa182('0x3d')](_0x506d07[_0xa182('0x3a')],qs[_0xa182('0x3e')](_0x34f2c5[_0xa182('0x3b')][_0xa182('0x3e')]));_0x300b97[_0xa182('0x3f')]=_0x300b97[_0xa182('0x3f')][_0xa182('0x59')]?_0x300b97[_0xa182('0x3f')]:_0x506d07['model'];_0x300b97[_0xa182('0x41')]=qs['sort'](_0x34f2c5[_0xa182('0x3b')][_0xa182('0x5a')]);_0x300b97[_0xa182('0x42')]=qs[_0xa182('0x3c')](_['pick'](_0x34f2c5[_0xa182('0x3b')],_0x506d07[_0xa182('0x3c')]));if(_0x34f2c5[_0xa182('0x3b')]['filter']){_0x300b97['where']=_[_0xa182('0x45')](_0x300b97[_0xa182('0x42')],{'$or':_[_0xa182('0x34')](_0x300b97[_0xa182('0x3f')],function(_0x3828c8){var _0x3cc3fd={};_0x3cc3fd[_0x3828c8]={'$like':'%'+_0x34f2c5[_0xa182('0x3b')]['filter']+'%'};return _0x3cc3fd;})});}if(_0x34f2c5[_0xa182('0x3b')][_0xa182('0x61')]){var _0x2b875d=_0x34f2c5['query'][_0xa182('0x61')][_0xa182('0x62')](',');var _0x415734={};_0x415734[_0x2b875d[0x0]]={'$gte':moment(_0x2b875d[0x1])[_0xa182('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x300b97['where']=_['merge'](_0x300b97[_0xa182('0x42')],_0x415734);}_0x300b97=_['merge']({},_0x300b97,_0x34f2c5[_0xa182('0x47')]);return _0x93e745[_0xa182('0x60')](_0x300b97);}})['then'](function(_0xeef625){if(_0xeef625){_0x44abdf=_0xeef625['length'];if(!_0x34f2c5[_0xa182('0x3b')][_0xa182('0x40')]('nolimit')){_0x300b97[_0xa182('0x26')]=qs[_0xa182('0x26')](_0x34f2c5[_0xa182('0x3b')][_0xa182('0x26')]);_0x300b97[_0xa182('0x24')]=qs['offset'](_0x34f2c5[_0xa182('0x3b')][_0xa182('0x24')]);}return _0x93e745['getMessages'](_0x300b97);}})[_0xa182('0x2d')](function(_0x402a37){if(_0x402a37){return _0x402a37?{'count':_0x44abdf,'rows':_0x402a37}:null;}})[_0xa182('0x2d')](respondWithResult(_0x55c53a,null))[_0xa182('0x49')](handleError(_0x55c53a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b62b227..53c0699 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 _0x4c50=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x34528f,_0x540ca4){var _0x11861b=function(_0x26233f){while(--_0x26233f){_0x34528f['push'](_0x34528f['shift']());}};_0x11861b(++_0x540ca4);}(_0x4c50,0x10f));var _0x04c5=function(_0x33f820,_0x2587c2){_0x33f820=_0x33f820-0x0;var _0x378b18=_0x4c50[_0x33f820];return _0x378b18;};'use strict';var EventEmitter=require(_0x04c5('0x0'));var ChatGroup=require(_0x04c5('0x1'))['db'][_0x04c5('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x04c5('0x3')](0x0);var events={'afterCreate':_0x04c5('0x4'),'afterUpdate':_0x04c5('0x5'),'afterDestroy':_0x04c5('0x6')};function emitEvent(_0x5a0501){return function(_0x4fd529,_0x1ae103,_0x1d623d){ChatGroupEvents['emit'](_0x5a0501+':'+_0x4fd529['id'],_0x4fd529);ChatGroupEvents[_0x04c5('0x7')](_0x5a0501,_0x4fd529);_0x1d623d(null);};}for(var e in events){if(events[_0x04c5('0x8')](e)){var event=events[e];ChatGroup[_0x04c5('0x9')](e,emitEvent(event));}}module[_0x04c5('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x1f20=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x10fe94,_0x215308){var _0x12c354=function(_0x5e95b9){while(--_0x5e95b9){_0x10fe94['push'](_0x10fe94['shift']());}};_0x12c354(++_0x215308);}(_0x1f20,0x11c));var _0x01f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f20[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x01f2('0x0'));var ChatGroup=require(_0x01f2('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x01f2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x01f2('0x3'),'afterDestroy':_0x01f2('0x4')};function emitEvent(_0x537683){return function(_0x132488,_0x5a9278,_0x5508a8){ChatGroupEvents[_0x01f2('0x5')](_0x537683+':'+_0x132488['id'],_0x132488);ChatGroupEvents[_0x01f2('0x5')](_0x537683,_0x132488);_0x5508a8(null);};}for(var e in events){if(events[_0x01f2('0x6')](e)){var event=events[e];ChatGroup[_0x01f2('0x7')](e,emitEvent(event));}}module[_0x01f2('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c0fa63d..f85a6b1 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 _0x1b8f=['util','../../config/logger','bluebird','path','rimraf','./chatGroup.attributes','exports','define','chat_groups','lodash'];(function(_0xfd5475,_0x59217c){var _0x599901=function(_0x5271f1){while(--_0x5271f1){_0xfd5475['push'](_0xfd5475['shift']());}};_0x599901(++_0x59217c);}(_0x1b8f,0xb3));var _0xf1b8=function(_0xa83fe4,_0x5841ca){_0xa83fe4=_0xa83fe4-0x0;var _0x4804da=_0x1b8f[_0xa83fe4];return _0x4804da;};'use strict';var _=require(_0xf1b8('0x0'));var util=require(_0xf1b8('0x1'));var logger=require(_0xf1b8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf1b8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1b8('0x4'));var rimraf=require(_0xf1b8('0x5'));var config=require('../../config/environment');var attributes=require(_0xf1b8('0x6'));module[_0xf1b8('0x7')]=function(_0x5a4289,_0x5efc4a){return _0x5a4289[_0xf1b8('0x8')]('ChatGroup',attributes,{'tableName':_0xf1b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f17=['path','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x372518,_0x4c98a7){var _0x24af70=function(_0x33312e){while(--_0x33312e){_0x372518['push'](_0x372518['shift']());}};_0x24af70(++_0x4c98a7);}(_0x1f17,0x12d));var _0x71f1=function(_0x32c83f,_0x4cb2d6){_0x32c83f=_0x32c83f-0x0;var _0x15e3cd=_0x1f17[_0x32c83f];return _0x15e3cd;};'use strict';var _=require(_0x71f1('0x0'));var util=require(_0x71f1('0x1'));var logger=require(_0x71f1('0x2'))(_0x71f1('0x3'));var moment=require(_0x71f1('0x4'));var BPromise=require(_0x71f1('0x5'));var rp=require(_0x71f1('0x6'));var fs=require('fs');var path=require(_0x71f1('0x7'));var rimraf=require('rimraf');var config=require(_0x71f1('0x8'));var attributes=require('./chatGroup.attributes');module[_0x71f1('0x9')]=function(_0x149d0f,_0x2e5c47){return _0x149d0f[_0x71f1('0xa')]('ChatGroup',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 8b3e2e4..e178b5f 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 _0x72b1=['error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4488e2,_0x41ac44){var _0x37f4be=function(_0x424dc7){while(--_0x424dc7){_0x4488e2['push'](_0x4488e2['shift']());}};_0x37f4be(++_0x41ac44);}(_0x72b1,0x16e));var _0x172b=function(_0x47f356,_0x2974b9){_0x47f356=_0x47f356-0x0;var _0x26c706=_0x72b1[_0x47f356];return _0x26c706;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var moment=require(_0x172b('0x1'));var BPromise=require(_0x172b('0x2'));var rs=require(_0x172b('0x3'));var fs=require('fs');var Redis=require(_0x172b('0x4'));var db=require(_0x172b('0x5'))['db'];var utils=require(_0x172b('0x6'));var logger=require(_0x172b('0x7'))('rpc');var config=require(_0x172b('0x8'));var jayson=require(_0x172b('0x9'));var client=jayson[_0x172b('0xa')][_0x172b('0xb')]({'port':0x232a});config['redis']=_[_0x172b('0xc')](config['redis'],{'host':_0x172b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x172b('0xe')]));require(_0x172b('0xf'))[_0x172b('0x10')](socket);function respondWithRpcPromise(_0x392f1e,_0x50e58a,_0x3b6daf){return new BPromise(function(_0x375bde,_0x28aaad){return client[_0x172b('0x11')](_0x392f1e,_0x3b6daf)[_0x172b('0x12')](function(_0x131762){logger[_0x172b('0x13')]('ChatGroup,\x20%s,\x20%s',_0x50e58a,_0x172b('0x14'));logger[_0x172b('0x15')](_0x172b('0x16'),_0x50e58a,'request\x20sent',JSON[_0x172b('0x17')](_0x131762));if(_0x131762['error']){if(_0x131762[_0x172b('0x18')][_0x172b('0x19')]===0x1f4){logger['error'](_0x172b('0x1a'),_0x50e58a,_0x131762[_0x172b('0x18')][_0x172b('0x1b')]);return _0x28aaad(_0x131762[_0x172b('0x18')]['message']);}logger['error'](_0x172b('0x1a'),_0x50e58a,_0x131762[_0x172b('0x18')][_0x172b('0x1b')]);return _0x375bde(_0x131762[_0x172b('0x18')]['message']);}else{logger['info'](_0x172b('0x1a'),_0x50e58a,_0x172b('0x14'));_0x375bde(_0x131762[_0x172b('0x1c')][_0x172b('0x1b')]);}})[_0x172b('0x1d')](function(_0x4e7cb9){logger[_0x172b('0x18')](_0x172b('0x1a'),_0x50e58a,_0x4e7cb9);_0x28aaad(_0x4e7cb9);});});} \ No newline at end of file +var _0x8d0a=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x58060b,_0x307839){var _0xaaa72b=function(_0x227ce6){while(--_0x227ce6){_0x58060b['push'](_0x58060b['shift']());}};_0xaaa72b(++_0x307839);}(_0x8d0a,0x65));var _0xa8d0=function(_0x31f795,_0x24ca2a){_0x31f795=_0x31f795-0x0;var _0x1e4b93=_0x8d0a[_0x31f795];return _0x1e4b93;};'use strict';var _=require(_0xa8d0('0x0'));var util=require('util');var moment=require(_0xa8d0('0x1'));var BPromise=require(_0xa8d0('0x2'));var rs=require(_0xa8d0('0x3'));var fs=require('fs');var Redis=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];var utils=require(_0xa8d0('0x6'));var logger=require(_0xa8d0('0x7'))(_0xa8d0('0x8'));var config=require(_0xa8d0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa8d0('0xa')][_0xa8d0('0xb')]({'port':0x232a});config[_0xa8d0('0xc')]=_[_0xa8d0('0xd')](config[_0xa8d0('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8d0('0xc')]));require(_0xa8d0('0xe'))['register'](socket);function respondWithRpcPromise(_0x5362af,_0x4fbfb3,_0x296b54){return new BPromise(function(_0x5091f3,_0x4633c4){return client[_0xa8d0('0xf')](_0x5362af,_0x296b54)[_0xa8d0('0x10')](function(_0x1a7b95){logger[_0xa8d0('0x11')](_0xa8d0('0x12'),_0x4fbfb3,_0xa8d0('0x13'));logger[_0xa8d0('0x14')](_0xa8d0('0x15'),_0x4fbfb3,_0xa8d0('0x13'),JSON[_0xa8d0('0x16')](_0x1a7b95));if(_0x1a7b95['error']){if(_0x1a7b95[_0xa8d0('0x17')]['code']===0x1f4){logger['error'](_0xa8d0('0x12'),_0x4fbfb3,_0x1a7b95[_0xa8d0('0x17')]['message']);return _0x4633c4(_0x1a7b95[_0xa8d0('0x17')][_0xa8d0('0x18')]);}logger[_0xa8d0('0x17')](_0xa8d0('0x12'),_0x4fbfb3,_0x1a7b95[_0xa8d0('0x17')][_0xa8d0('0x18')]);return _0x5091f3(_0x1a7b95['error'][_0xa8d0('0x18')]);}else{logger[_0xa8d0('0x11')]('ChatGroup,\x20%s,\x20%s',_0x4fbfb3,_0xa8d0('0x13'));_0x5091f3(_0x1a7b95[_0xa8d0('0x19')]['message']);}})[_0xa8d0('0x1a')](function(_0xf9267d){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4fbfb3,_0xf9267d);_0x4633c4(_0xf9267d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 36102e7..b6bfe24 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 _0x991a=['./chatGroup.events','save','update','removeListener','length','chatGroup:'];(function(_0x23bcf2,_0x1c6764){var _0x16dff4=function(_0x585464){while(--_0x585464){_0x23bcf2['push'](_0x23bcf2['shift']());}};_0x16dff4(++_0x1c6764);}(_0x991a,0x1ec));var _0xa991=function(_0x5733d6,_0x3fede9){_0x5733d6=_0x5733d6-0x0;var _0x5b4755=_0x991a[_0x5733d6];return _0x5b4755;};'use strict';var ChatGroupEvents=require(_0xa991('0x0'));var events=[_0xa991('0x1'),'remove',_0xa991('0x2')];function createListener(_0x45f6ed,_0x3d9e39){return function(_0x3991fd){_0x3d9e39['emit'](_0x45f6ed,_0x3991fd);};}function removeListener(_0x37a5b0,_0x5e723a){return function(){ChatGroupEvents[_0xa991('0x3')](_0x37a5b0,_0x5e723a);};}exports['register']=function(_0x57ecc5){for(var _0x36842f=0x0,_0x50d2cb=events[_0xa991('0x4')];_0x36842f<_0x50d2cb;_0x36842f++){var _0x3e1972=events[_0x36842f];var _0x13bd2a=createListener(_0xa991('0x5')+_0x3e1972,_0x57ecc5);ChatGroupEvents['on'](_0x3e1972,_0x13bd2a);}}; \ No newline at end of file +var _0x5da6=['chatGroup:','./chatGroup.events','save','emit','register','length'];(function(_0x21387c,_0x46ae58){var _0x306579=function(_0x1ae261){while(--_0x1ae261){_0x21387c['push'](_0x21387c['shift']());}};_0x306579(++_0x46ae58);}(_0x5da6,0x1cf));var _0x65da=function(_0x54de48,_0x2310da){_0x54de48=_0x54de48-0x0;var _0x4e8dec=_0x5da6[_0x54de48];return _0x4e8dec;};'use strict';var ChatGroupEvents=require(_0x65da('0x0'));var events=[_0x65da('0x1'),'remove','update'];function createListener(_0x1ef833,_0x5ed20f){return function(_0xca202b){_0x5ed20f[_0x65da('0x2')](_0x1ef833,_0xca202b);};}function removeListener(_0x10049f,_0x27fbc5){return function(){ChatGroupEvents['removeListener'](_0x10049f,_0x27fbc5);};}exports[_0x65da('0x3')]=function(_0x53c677){for(var _0x5b145a=0x0,_0x1d8771=events[_0x65da('0x4')];_0x5b145a<_0x1d8771;_0x5b145a++){var _0x306c74=events[_0x5b145a];var _0x12eb69=createListener(_0x65da('0x5')+_0x306c74,_0x53c677);ChatGroupEvents['on'](_0x306c74,_0x12eb69);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index bcfcdce..f91682f 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 _0x995f=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','/:id','update','destroy','delete','removeMembers'];(function(_0x7748a6,_0x450b0f){var _0x2aa04c=function(_0x532ed3){while(--_0x532ed3){_0x7748a6['push'](_0x7748a6['shift']());}};_0x2aa04c(++_0x450b0f);}(_0x995f,0x1e1));var _0xf995=function(_0x4b0c3e,_0x50754a){_0x4b0c3e=_0x4b0c3e-0x0;var _0xa99d4e=_0x995f[_0x4b0c3e];return _0xa99d4e;};'use strict';var multer=require(_0xf995('0x0'));var util=require(_0xf995('0x1'));var path=require(_0xf995('0x2'));var timeout=require(_0xf995('0x3'));var express=require(_0xf995('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf995('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf995('0x6'));var controller=require(_0xf995('0x7'));router['get']('/',auth[_0xf995('0x8')](),controller[_0xf995('0x9')]);router[_0xf995('0xa')](_0xf995('0xb'),auth['isAuthenticated'](),controller[_0xf995('0xc')]);router[_0xf995('0xa')]('/:id',auth[_0xf995('0x8')](),controller[_0xf995('0xd')]);router[_0xf995('0xa')](_0xf995('0xe'),auth[_0xf995('0x8')](),controller[_0xf995('0xf')]);router[_0xf995('0xa')](_0xf995('0x10'),auth[_0xf995('0x8')](),controller[_0xf995('0x11')]);router['get'](_0xf995('0x12'),auth[_0xf995('0x8')](),controller[_0xf995('0x13')]);router[_0xf995('0x14')]('/',auth[_0xf995('0x8')](),controller[_0xf995('0x15')]);router[_0xf995('0x14')](_0xf995('0x10'),auth[_0xf995('0x8')](),controller['addMembers']);router['post'](_0xf995('0x12'),auth['isAuthenticated'](),controller[_0xf995('0x16')]);router[_0xf995('0x17')](_0xf995('0x18'),auth[_0xf995('0x8')](),controller[_0xf995('0x19')]);router['delete'](_0xf995('0x18'),auth['isAuthenticated'](),controller[_0xf995('0x1a')]);router[_0xf995('0x1b')](_0xf995('0x10'),auth[_0xf995('0x8')](),controller[_0xf995('0x1c')]);module[_0xf995('0x1d')]=router; \ No newline at end of file +var _0x8ff0=['./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','addMessage','update','delete','removeMembers','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xdebfbb,_0x5e5026){var _0x20fd80=function(_0x41b895){while(--_0x41b895){_0xdebfbb['push'](_0xdebfbb['shift']());}};_0x20fd80(++_0x5e5026);}(_0x8ff0,0xe0));var _0x08ff=function(_0x47199b,_0x16e824){_0x47199b=_0x47199b-0x0;var _0x390911=_0x8ff0[_0x47199b];return _0x390911;};'use strict';var multer=require('multer');var util=require(_0x08ff('0x0'));var path=require('path');var timeout=require(_0x08ff('0x1'));var express=require(_0x08ff('0x2'));var router=express['Router']();var fs_extra=require(_0x08ff('0x3'));var auth=require(_0x08ff('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x08ff('0x5'));var controller=require(_0x08ff('0x6'));router[_0x08ff('0x7')]('/',auth[_0x08ff('0x8')](),controller[_0x08ff('0x9')]);router[_0x08ff('0x7')]('/describe',auth[_0x08ff('0x8')](),controller['describe']);router['get'](_0x08ff('0xa'),auth[_0x08ff('0x8')](),controller[_0x08ff('0xb')]);router[_0x08ff('0x7')](_0x08ff('0xc'),auth[_0x08ff('0x8')](),controller[_0x08ff('0xd')]);router['get'](_0x08ff('0xe'),auth[_0x08ff('0x8')](),controller['getMembers']);router[_0x08ff('0x7')](_0x08ff('0xf'),auth['isAuthenticated'](),controller[_0x08ff('0x10')]);router[_0x08ff('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x08ff('0x11')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x08ff('0x11')](_0x08ff('0xf'),auth[_0x08ff('0x8')](),controller[_0x08ff('0x12')]);router['put'](_0x08ff('0xa'),auth['isAuthenticated'](),controller[_0x08ff('0x13')]);router['delete'](_0x08ff('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0x08ff('0x14')](_0x08ff('0xe'),auth['isAuthenticated'](),controller[_0x08ff('0x15')]);module[_0x08ff('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index d813647..98013a9 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 _0x9ffd=['TEXT','STRING','long','DATE','out','sequelize','exports','BOOLEAN','ENUM','star','thumb'];(function(_0x90aafe,_0x54198f){var _0x4f486c=function(_0xb647af){while(--_0xb647af){_0x90aafe['push'](_0x90aafe['shift']());}};_0x4f486c(++_0x54198f);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x7847b9,_0x188e55){_0x7847b9=_0x7847b9-0x0;var _0x59082c=_0x9ffd[_0x7847b9];return _0x59082c;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'closed':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xd9ff('0x3')](_0xd9ff('0x4'),_0xd9ff('0x5')),'defaultValue':_0xd9ff('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xd9ff('0x6')]},'mailTranscript':{'type':Sequelize[_0xd9ff('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd9ff('0x7')]},'secondDisposition':{'type':Sequelize[_0xd9ff('0x7')]},'thirdDisposition':{'type':Sequelize[_0xd9ff('0x7')]},'note':{'type':Sequelize[_0xd9ff('0x7')]},'browserName':{'type':Sequelize[_0xd9ff('0x7')]},'browserVersion':{'type':Sequelize[_0xd9ff('0x7')]},'osName':{'type':Sequelize[_0xd9ff('0x7')]},'osVersion':{'type':Sequelize[_0xd9ff('0x7')]},'deviceModel':{'type':Sequelize[_0xd9ff('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xd9ff('0x6')](_0xd9ff('0x8'))},'read1stAt':{'type':Sequelize[_0xd9ff('0x9')]},'lastMsgAt':{'type':Sequelize[_0xd9ff('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xd9ff('0x3')]('in',_0xd9ff('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd9ff('0x7')]},'customerPort':{'type':Sequelize[_0xd9ff('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa149=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x62bec0,_0x440263){var _0x21b604=function(_0x18a0ac){while(--_0x18a0ac){_0x62bec0['push'](_0x62bec0['shift']());}};_0x21b604(++_0x440263);}(_0xa149,0x18c));var _0x9a14=function(_0x510ef4,_0x1fd0f9){_0x510ef4=_0x510ef4-0x0;var _0x137b5a=_0xa149[_0x510ef4];return _0x137b5a;};'use strict';var Sequelize=require(_0x9a14('0x0'));module[_0x9a14('0x1')]={'closed':{'type':Sequelize[_0x9a14('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9a14('0x3')]},'ratingType':{'type':Sequelize[_0x9a14('0x4')](_0x9a14('0x5'),_0x9a14('0x6')),'defaultValue':_0x9a14('0x5')},'ratingMessage':{'type':Sequelize[_0x9a14('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x9a14('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9a14('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9a14('0x8')]},'thirdDisposition':{'type':Sequelize[_0x9a14('0x8')]},'note':{'type':Sequelize[_0x9a14('0x8')]},'browserName':{'type':Sequelize[_0x9a14('0x8')]},'browserVersion':{'type':Sequelize[_0x9a14('0x8')]},'osName':{'type':Sequelize[_0x9a14('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x9a14('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x9a14('0x8')]},'referer':{'type':Sequelize[_0x9a14('0x7')]},'customerIp':{'type':Sequelize[_0x9a14('0x8')]},'formData':{'type':Sequelize[_0x9a14('0x7')](_0x9a14('0xa'))},'read1stAt':{'type':Sequelize[_0x9a14('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x9a14('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x9a14('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e81c5f4..a1fbe20 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 _0x065a=['closedAt','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','tail','createReadStream','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','firstName','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','util','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','end','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','catch','show','params','model','keys','intersection','attributes','fields','include','options','find','create','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','closed','AbandonInteraction','attachmentUpload','file','basename','mimetype','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','ChatWebsite','ContactId','Messages','length','%s%d','agentAlias','System','Visitor','agentIdentifier','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','filters','hasOwnProperty','order','sort','where','filter','$gte','includeAll','rows','nolimit','includeAgent','push','addTags','setTags','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','direction','secret','read','Owner','get','mkdirSync','Chat','Account'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x065a,0xe9));var _0xa065=function(_0x1d26d1,_0x2294e4){_0x1d26d1=_0x1d26d1-0x0;var _0x2d3fb2=_0x065a[_0x1d26d1];return _0x2d3fb2;};'use strict';var rimraf=require(_0xa065('0x0'));var zipdir=require(_0xa065('0x1'));var rp=require(_0xa065('0x2'));var moment=require(_0xa065('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa065('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa065('0x5'));var Redis=require(_0xa065('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xa065('0x7'));var pdf=require(_0xa065('0x8'));var logger=require(_0xa065('0x9'))(_0xa065('0xa'));var config=require(_0xa065('0xb'));var db=require(_0xa065('0xc'))['db'];config[_0xa065('0xd')]=_['defaults'](config['redis'],{'host':_0xa065('0xe'),'port':0x18eb});var socket=require(_0xa065('0xf'))(new Redis(config[_0xa065('0xd')]));require(_0xa065('0x10'))['register'](socket);var jayson=require(_0xa065('0x11'));var client=jayson[_0xa065('0x12')][_0xa065('0x13')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2abd0a,_0xe85152,_0x376794,_0x140d59){return new BPromise(function(_0x5d2ef5,_0x13d87d){var _0x1e586b=_0x140d59||client;return _0x1e586b['request'](_0x2abd0a,_0x376794)[_0xa065('0x14')](function(_0x2f6eda){logger['info'](_0xa065('0x15'),_0xe85152,_0xa065('0x16'));logger[_0xa065('0x17')](_0xa065('0x18'),_0xe85152,_0xa065('0x16'),JSON[_0xa065('0x19')](_0x2f6eda));if(_0x2f6eda[_0xa065('0x1a')]){if(_0x2f6eda['error'][_0xa065('0x1b')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xe85152,_0x2f6eda[_0xa065('0x1a')][_0xa065('0x1c')]);return _0x13d87d(_0x2f6eda[_0xa065('0x1a')][_0xa065('0x1c')]);}logger[_0xa065('0x1a')](_0xa065('0x15'),_0xe85152,_0x2f6eda['error'][_0xa065('0x1c')]);return _0x5d2ef5(_0x2f6eda[_0xa065('0x1a')][_0xa065('0x1c')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0xe85152,'request\x20sent');_0x5d2ef5(_0x2f6eda[_0xa065('0x1d')][_0xa065('0x1c')]);}})['catch'](function(_0x134e18){logger[_0xa065('0x1a')](_0xa065('0x15'),_0xe85152,_0x134e18);_0x13d87d(_0x134e18);});});}function respondWithStatusCode(_0x163620,_0x53e880){_0x53e880=_0x53e880||0xcc;return function(_0x5109fb){if(_0x5109fb){return _0x163620[_0xa065('0x1e')](_0x53e880);}return _0x163620[_0xa065('0x1f')](_0x53e880)['end']();};}function respondWithResult(_0x3073f7,_0x2c991d){_0x2c991d=_0x2c991d||0xc8;return function(_0x18a712){if(_0x18a712){return _0x3073f7[_0xa065('0x1f')](_0x2c991d)[_0xa065('0x20')](_0x18a712);}};}function respondWithFilteredResult(_0x633f1f,_0x2b57f5){return function(_0x5d18aa){if(_0x5d18aa){var _0x1748ad=typeof _0x2b57f5['offset']===_0xa065('0x21')&&typeof _0x2b57f5[_0xa065('0x22')]==='undefined';var _0x221a1d=_0x5d18aa[_0xa065('0x23')];var _0x6cad56=_0x1748ad?0x0:_0x2b57f5[_0xa065('0x24')];var _0x3b972c=_0x1748ad?_0x5d18aa[_0xa065('0x23')]:_0x2b57f5[_0xa065('0x24')]+_0x2b57f5['limit'];var _0x5289a0;if(_0x3b972c>=_0x221a1d){_0x3b972c=_0x221a1d;_0x5289a0=0xc8;}else{_0x5289a0=0xce;}_0x633f1f[_0xa065('0x1f')](_0x5289a0);return _0x633f1f[_0xa065('0x25')](_0xa065('0x26'),_0x6cad56+'-'+_0x3b972c+'/'+_0x221a1d)[_0xa065('0x20')](_0x5d18aa);}return null;};}function saveUpdates(_0x4a3464){return function(_0x3d0234){if(_0x3d0234){return _0x3d0234[_0xa065('0x27')](_0x4a3464)['then'](function(_0x119c7d){return _0x119c7d;});}return null;};}function removeEntity(_0x41fc86){return function(_0x809592){if(_0x809592){return _0x809592['destroy']()[_0xa065('0x14')](function(){_0x41fc86[_0xa065('0x1f')](0xcc)[_0xa065('0x28')]();});}};}function handleEntityNotFound(_0x497ba2){return function(_0x2f744b){if(!_0x2f744b){_0x497ba2['sendStatus'](0x194);}return _0x2f744b;};}function handleError(_0x3568dc,_0xca6563){_0xca6563=_0xca6563||0x1f4;return function(_0x25416e){logger[_0xa065('0x1a')](_0x25416e['stack']);if(_0x25416e[_0xa065('0x29')]){delete _0x25416e[_0xa065('0x29')];}_0x3568dc['status'](_0xca6563)[_0xa065('0x2a')](_0x25416e);};}function getMustacheRender(_0x36f72b,_0x1b7a4a){return Mustache[_0xa065('0x2b')](_0x36f72b,_[_0xa065('0x2c')](_0x1b7a4a[_0xa065('0x2d')],{'contact':_0x1b7a4a[_0xa065('0x2e')],'message':_0x1b7a4a[_0xa065('0x1c')],'agent':_0x1b7a4a[_0xa065('0x2f')],'interaction':_0x1b7a4a[_0xa065('0x30')],'account':_0x1b7a4a[_0xa065('0x31')]}))||'';}exports[_0xa065('0x32')]=function(_0x3ac2a0,_0x2ee3f6){var _0x1343f={};var _0x3cf498=_[_0xa065('0x33')](db[_0xa065('0x34')]['rawAttributes'],function(_0x15e836){return{'name':_0x15e836[_0xa065('0x35')],'type':_0x15e836[_0xa065('0x36')][_0xa065('0x37')]};});_0x1343f=qs[_0xa065('0x38')](_0x3cf498,_0x3ac2a0);return interaction[_0xa065('0x39')](_0xa065('0x3a'),_0x3ac2a0[_0xa065('0x3b')],_0x3ac2a0[_0xa065('0x3c')],_0x1343f,_0x3cf498)['then'](respondWithFilteredResult(_0x2ee3f6,_0x1343f))[_0xa065('0x3d')](handleError(_0x2ee3f6,null));};exports[_0xa065('0x3e')]=function(_0x18ce27,_0x3a0fbe){var _0x3d910c={'raw':![],'where':{'id':_0x18ce27[_0xa065('0x3f')]['id']}},_0x555703={};_0x555703[_0xa065('0x40')]=_[_0xa065('0x41')](db[_0xa065('0x34')]['rawAttributes']);_0x555703[_0xa065('0x3b')]=_[_0xa065('0x41')](_0x18ce27[_0xa065('0x3b')]);_0x555703['filters']=_[_0xa065('0x42')](_0x555703[_0xa065('0x40')],_0x555703[_0xa065('0x3b')]);_0x3d910c[_0xa065('0x43')]=_[_0xa065('0x42')](_0x555703[_0xa065('0x40')],qs[_0xa065('0x44')](_0x18ce27[_0xa065('0x3b')][_0xa065('0x44')]));_0x3d910c[_0xa065('0x43')]=_0x3d910c[_0xa065('0x43')]['length']?_0x3d910c[_0xa065('0x43')]:_0x555703[_0xa065('0x40')];if(_0x18ce27['query']['includeAll']){_0x3d910c[_0xa065('0x45')]=[{'all':!![]}];}_0x3d910c=_[_0xa065('0x2c')]({},_0x3d910c,_0x18ce27[_0xa065('0x46')]);return db['ChatInteraction'][_0xa065('0x47')](_0x3d910c)[_0xa065('0x14')](handleEntityNotFound(_0x3a0fbe,null))[_0xa065('0x14')](respondWithResult(_0x3a0fbe,null))[_0xa065('0x3d')](handleError(_0x3a0fbe,null));};exports[_0xa065('0x48')]=function(_0x4e483b,_0x315b2d){return db[_0xa065('0x34')][_0xa065('0x48')](_0x4e483b['body'],{})[_0xa065('0x14')](respondWithResult(_0x315b2d,0xc9))[_0xa065('0x3d')](handleError(_0x315b2d,null));};exports[_0xa065('0x27')]=function(_0x164be5,_0x423e57){if(_0x164be5['body']['id']){delete _0x164be5['body']['id'];}return db[_0xa065('0x34')][_0xa065('0x47')]({'where':{'id':_0x164be5[_0xa065('0x3f')]['id']}})[_0xa065('0x14')](handleEntityNotFound(_0x423e57,null))['then'](saveUpdates(_0x164be5[_0xa065('0x2d')],null))[_0xa065('0x14')](respondWithResult(_0x423e57,null))[_0xa065('0x3d')](handleError(_0x423e57,null));};exports[_0xa065('0x49')]=function(_0x585c99,_0xf7d9f3){return db[_0xa065('0x34')][_0xa065('0x47')]({'where':{'id':_0x585c99[_0xa065('0x3f')]['id']}})[_0xa065('0x14')](handleEntityNotFound(_0xf7d9f3,null))[_0xa065('0x14')](removeEntity(_0xf7d9f3,null))[_0xa065('0x3d')](handleError(_0xf7d9f3,null));};exports[_0xa065('0x4a')]=function(_0x56b850,_0x3c11c3){return db['ChatInteraction'][_0xa065('0x4a')]()[_0xa065('0x14')](respondWithResult(_0x3c11c3,null))['catch'](handleError(_0x3c11c3,null));};exports[_0xa065('0x4b')]=function(_0x234246,_0x4a6d4e){var _0x4d4666=_0x234246[_0xa065('0x3f')]['id'];var _0x3ca7c7;var _0x51b0bd;var _0x4b3e8b;return db[_0xa065('0x34')]['findOne']({'where':{'id':_0x4d4666}})['then'](function(_0x5e45b0){_0x3ca7c7=_0x5e45b0;return db['ChatWebsite'][_0xa065('0x4c')]({'where':{'id':_0x5e45b0[_0xa065('0x4d')]},'attributes':['id',_0xa065('0x4e'),_0xa065('0x4f'),_0xa065('0x50'),_0xa065('0x51'),'vidaooMetadata'],'raw':!![]});})[_0xa065('0x14')](function(_0x36bb53){if(_0x36bb53&&_0x36bb53[_0xa065('0x4e')]&&_0x36bb53[_0xa065('0x4f')]){_0x51b0bd=_0x36bb53;var _0x3bf8d7={'interaction':{'id':_0x4d4666},'agent':{'id':_0x234246['user']['id'],'name':_0x234246[_0xa065('0x3c')][_0xa065('0x29')],'fullname':_0x234246['user'][_0xa065('0x52')],'email':_0x234246['user']['email']},'contact':_0x234246[_0xa065('0x2d')]['contact'],'account':_0x234246[_0xa065('0x2d')][_0xa065('0x31')]};var _0x1eb8ce={'rejectUnauthorized':![],'method':_0xa065('0x53'),'url':_0xa065('0x54'),'headers':{'X-APIKEY':_0x36bb53[_0xa065('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x234246['user'][_0xa065('0x55')]],'buttons':null,'topic':_0x51b0bd[_0xa065('0x50')],'note':_[_0xa065('0x56')](_0x51b0bd[_0xa065('0x51')])?null:getMustacheRender(_0x51b0bd[_0xa065('0x51')],_0x3bf8d7),'metadata':null},'redirect':_0xa065('0x57'),'json':!![]};try{if(!_['isNull'](_0x51b0bd[_0xa065('0x58')])){var _0x5e8a8=getMustacheRender(_0x51b0bd[_0xa065('0x58')],_0x3bf8d7);var _0x22ff7f=JSON[_0xa065('0x59')](_0x5e8a8);_0x1eb8ce[_0xa065('0x2d')][_0xa065('0x5a')]=_0x22ff7f;}}catch(_0x5c0790){throw new db[(_0xa065('0x5b'))][(_0xa065('0x5c'))](_0xa065('0x5d'));}return rp(_0x1eb8ce);}else{throw new db['Sequelize'][(_0xa065('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa065('0x14')](function(_0x424743){_0x4b3e8b=_0x424743;if(_0x4b3e8b['id']){var _0x2c3323={'body':_0x4b3e8b[_0xa065('0x5e')],'ChatWebsiteId':_0x51b0bd['id'],'ChatInteractionId':_0x3ca7c7['id'],'direction':'out','UserId':_0x234246['user']['id']};return db[_0xa065('0x5f')][_0xa065('0x48')](_0x2c3323,{});}else{throw new db[(_0xa065('0x5b'))][(_0xa065('0x5c'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa065('0x14')](function(){return _0x3ca7c7[_0xa065('0x60')]({'vidaooSessionId':_0x4b3e8b['id']});})[_0xa065('0x14')](respondWithResult(_0x4a6d4e,null))['catch'](handleError(_0x4a6d4e,null));};exports[_0xa065('0x61')]=function(_0x259d56,_0x47e50f){if(_0x259d56['body']['id']){delete _0x259d56[_0xa065('0x2d')]['id'];}return db[_0xa065('0x34')][_0xa065('0x47')]({'where':{'id':_0x259d56['params']['id']},'include':[{'model':db[_0xa065('0x62')],'as':_0xa065('0x63')}]})[_0xa065('0x14')](handleEntityNotFound(_0x47e50f,null))['then'](saveUpdates(_0x259d56['body'],null))['then'](respondWithResult(_0x47e50f,null))[_0xa065('0x3d')](handleError(_0x47e50f,null));};exports[_0xa065('0x64')]=function(_0x4f6b79,_0xc4e68f){if(_0x4f6b79['body']['id']){delete _0x4f6b79['body']['id'];}return db[_0xa065('0x34')][_0xa065('0x47')]({'where':{'id':_0x4f6b79[_0xa065('0x3f')]['id']}})[_0xa065('0x14')](function(_0x2d24f2){if(!_0x2d24f2){logger[_0xa065('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xa065('0x64'),0x194,_0xa065('0x65'));_0xc4e68f[_0xa065('0x1e')](0x194);}else{if(_0x2d24f2[_0xa065('0x66')]){throw new db[(_0xa065('0x5b'))][(_0xa065('0x5c'))]('Interaction\x20already\x20assigned');}}return _0x2d24f2;})[_0xa065('0x14')](function(_0x51f82a){if(_0x51f82a){return _0x51f82a[_0xa065('0x27')]({'closed':_0x4f6b79[_0xa065('0x2d')][_0xa065('0x67')],'disposition':_0x4f6b79[_0xa065('0x2d')]['disposition']})[_0xa065('0x14')](function(_0x36f887){return _0x36f887;});}})[_0xa065('0x14')](function(){return respondWithRpcPromise(_0xa065('0x68'),'abandon',_0x4f6b79[_0xa065('0x2d')],client9004);})[_0xa065('0x14')](respondWithResult(_0xc4e68f,null))[_0xa065('0x3d')](handleError(_0xc4e68f,null));};exports[_0xa065('0x69')]=function(_0x435dec,_0x1c3dc4){_0x435dec[_0xa065('0x2d')][_0xa065('0x29')]=_0x435dec[_0xa065('0x6a')]['originalname'];_0x435dec['body'][_0xa065('0x6b')]=_0x435dec[_0xa065('0x6a')]['filename'];_0x435dec[_0xa065('0x2d')]['type']=_0x435dec['file'][_0xa065('0x6c')];return db['Attachment'][_0xa065('0x48')](_0x435dec[_0xa065('0x2d')])[_0xa065('0x14')](respondWithResult(_0x1c3dc4,0xc9))[_0xa065('0x3d')](handleError(_0x1c3dc4,null));};exports['attachmentDownload']=function(_0x2a94d5,_0x2efc4c){return db[_0xa065('0x34')][_0xa065('0x4c')]({'where':{'id':_0x2a94d5[_0xa065('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2efc4c,null))[_0xa065('0x14')](function(_0x5eb3db){if(_0x5eb3db){if(_0x5eb3db[_0xa065('0x67')]){return _0x2efc4c[_0xa065('0x1f')](0x193)[_0xa065('0x20')]({'status':0x193,'message':_0xa065('0x6d')});}return db[_0xa065('0x6e')][_0xa065('0x4c')]({'where':{'id':_0x2a94d5['query'][_0xa065('0x6f')]},'raw':!![]})[_0xa065('0x14')](handleEntityNotFound(_0x2efc4c,null));}})[_0xa065('0x14')](function(_0x8d5581){if(_0x8d5581){var _0x2ab43f=_0x8d5581[_0xa065('0x70')]!==null;var _0x2431bb=path[_0xa065('0x71')](config[_0xa065('0x72')],_0xa065('0x73'));if(_0x2ab43f){_0x2431bb=path['join'](_0x2431bb,_0xa065('0x74'));}var _0x4f4f4f=path[_0xa065('0x71')](_0x2431bb,_0x8d5581[_0xa065('0x6b')]);return _0x2efc4c[_0xa065('0x75')](_0x4f4f4f);}})[_0xa065('0x3d')](handleError(_0x2efc4c,null));};exports[_0xa065('0x76')]=function(_0x50f700,_0x498598){var _0x13abaa=null;var _0x3a06a1=null;var _0x3aafb4=null;if(_0x50f700['body']['id']){delete _0x50f700[_0xa065('0x2d')]['id'];}if(_0x50f700['body'][_0xa065('0x77')]){_0x3aafb4=path['join'](config['root'],_0xa065('0x78'),util[_0xa065('0x79')](_0xa065('0x7a'),Date[_0xa065('0x7b')]()));_0x50f700['body'][_0xa065('0x7c')]=_0x3aafb4;}return db[_0xa065('0x34')][_0xa065('0x47')]({'where':{'id':_0x50f700['params']['id']},'include':[{'model':db[_0xa065('0x5f')],'as':'Messages','include':[{'model':db[_0xa065('0x7d')],'as':_0xa065('0x7d')}]}]})[_0xa065('0x14')](handleEntityNotFound(_0x498598,null))[_0xa065('0x14')](saveUpdates(_0x50f700[_0xa065('0x2d')],null))[_0xa065('0x14')](function(_0x8d1845){if(_0x8d1845){_0x13abaa=_0x8d1845;return db[_0xa065('0x7e')][_0xa065('0x47')]({'where':{'id':_0x13abaa[_0xa065('0x4d')]}});}})[_0xa065('0x14')](function(_0x550ea0){if(_0x550ea0){_0x3a06a1=_0x550ea0;return db[_0xa065('0x62')][_0xa065('0x47')]({'where':{'id':_0x13abaa[_0xa065('0x7f')]}});}})[_0xa065('0x14')](function(_0x3a743c){if(_0x3a743c){if(_0x3aafb4){var _0xfa1e14=null;for(var _0x59e601=0x1;_0x59e601<_0x13abaa[_0xa065('0x80')][_0xa065('0x81')];++_0x59e601){_0xfa1e14=_0x13abaa[_0xa065('0x80')][_0x59e601];var _0x3415c7=_0xfa1e14[_0xa065('0x66')]?util[_0xa065('0x79')](_0xa065('0x82'),_0x3a06a1[_0xa065('0x83')],_0xfa1e14['UserId']):_0xa065('0x84');var _0x18749c=_0x50f700[_0xa065('0x2d')]['customer']||util[_0xa065('0x79')](_0xa065('0x82'),_0xa065('0x85'),_0xfa1e14[_0xa065('0x7f')]);switch(_0x3a06a1[_0xa065('0x86')]){case'website_alias':_0x3415c7=_0xfa1e14[_0xa065('0x66')]?util['format'](_0xa065('0x82'),_0x3a06a1['agentAlias'],_0xfa1e14[_0xa065('0x66')]):'System';break;case'agent_alias':_0x3415c7=_0xfa1e14['UserId']?_0xfa1e14[_0xa065('0x7d')][_0xa065('0x87')]||_0xfa1e14[_0xa065('0x7d')][_0xa065('0x52')]:_0xa065('0x84');break;case _0xa065('0x88'):_0x3415c7=_0xfa1e14['UserId']?_0xfa1e14['User']['fullname']:_0xa065('0x84');break;default:_0x3415c7=_0xfa1e14[_0xa065('0x66')]?util[_0xa065('0x79')](_0xa065('0x82'),_0x3a06a1['agentAlias'],_0xfa1e14[_0xa065('0x66')]):_0xa065('0x84');}var _0x398105=util[_0xa065('0x79')](_0xa065('0x89'),moment(_0xfa1e14[_0xa065('0x8a')])[_0xa065('0x79')](_0xa065('0x8b')),_0xfa1e14['direction']==='in'?_0x18749c:_0x3415c7,_0xfa1e14[_0xa065('0x2d')]);if(!_0xfa1e14['secret']){fs[_0xa065('0x8c')](_0x3aafb4,_0x398105);}}return db[_0xa065('0x8d')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa065('0x8e')],'as':_0xa065('0x8f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa065('0x90'),'raw':!![]}]}]});}}})[_0xa065('0x14')](function(_0x2287ef){if(!_0x2287ef||!_0x2287ef[_0xa065('0x8f')]||!_0x50f700[_0xa065('0x2d')])return _0x13abaa;var _0x1db119=_0x2287ef[_0xa065('0x91')]();return respondWithRpcPromise('SendMail',_0xa065('0x92'),{'account':_0x1db119,'message':{'from':util[_0xa065('0x79')](_0xa065('0x93'),_0x2287ef[_0xa065('0x29')],_0x2287ef['email']||_0x2287ef['Smtp'][_0xa065('0x3c')]),'to':_0x50f700[_0xa065('0x2d')][_0xa065('0x77')],'subject':'Mail\x20Transcript','text':util['format'](_0xa065('0x94'),_0x50f700[_0xa065('0x2d')]['mailTranscript']),'attachments':[{'path':_0x3aafb4}]}})['then'](function(){return _0x13abaa;})['catch'](function(_0x2982b9){logger[_0xa065('0x1a')](_0x2982b9);});})[_0xa065('0x14')](respondWithStatusCode(_0x498598,0xc8))['catch'](handleError(_0x498598,null));};exports[_0xa065('0x95')]=function(_0x840dba,_0x5b4b16){return db[_0xa065('0x5f')][_0xa065('0x47')]({'where':{'id':_0x840dba[_0xa065('0x3f')]['id']}})[_0xa065('0x14')](handleEntityNotFound(_0x5b4b16,null))[_0xa065('0x14')](function(_0x116fd3){if(_0x116fd3){return _0x116fd3[_0xa065('0x95')](_0x840dba['body'][_0xa065('0x96')],_[_0xa065('0x97')](_0x840dba[_0xa065('0x2d')],[_0xa065('0x96'),'id'])||{});}})[_0xa065('0x14')](respondWithResult(_0x5b4b16,null))['catch'](handleError(_0x5b4b16,null));};exports[_0xa065('0x98')]=function(_0x5e8d48,_0x2cc5e6){var _0x98ffe5={'raw':![],'where':{}};var _0x28cf05={};var _0x553d4e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa065('0x4c')]({'where':{'id':_0x5e8d48[_0xa065('0x3f')]['id']}})[_0xa065('0x14')](handleEntityNotFound(_0x2cc5e6,null))[_0xa065('0x14')](function(_0x1c4b74){if(_0x1c4b74){_0x28cf05[_0xa065('0x40')]=_[_0xa065('0x41')](db[_0xa065('0x5f')][_0xa065('0x99')]);_0x28cf05[_0xa065('0x3b')]=_['keys'](_0x5e8d48['query']);_0x28cf05[_0xa065('0x9a')]=_[_0xa065('0x42')](_0x28cf05[_0xa065('0x40')],_0x28cf05['query']);_0x98ffe5[_0xa065('0x43')]=_[_0xa065('0x42')](_0x28cf05['model'],qs['fields'](_0x5e8d48[_0xa065('0x3b')][_0xa065('0x44')]));_0x98ffe5[_0xa065('0x43')]=_0x98ffe5['attributes'][_0xa065('0x81')]?_0x98ffe5[_0xa065('0x43')]:_0x28cf05[_0xa065('0x40')];if(!_0x5e8d48[_0xa065('0x3b')][_0xa065('0x9b')]('nolimit')){_0x98ffe5[_0xa065('0x22')]=qs[_0xa065('0x22')](_0x5e8d48['query'][_0xa065('0x22')]);_0x98ffe5[_0xa065('0x24')]=qs[_0xa065('0x24')](_0x5e8d48[_0xa065('0x3b')][_0xa065('0x24')]);}_0x98ffe5[_0xa065('0x9c')]=qs['sort'](_0x5e8d48[_0xa065('0x3b')][_0xa065('0x9d')]);_0x98ffe5[_0xa065('0x9e')]=qs[_0xa065('0x9a')](_['pick'](_0x5e8d48[_0xa065('0x3b')],_0x28cf05[_0xa065('0x9a')]));_0x98ffe5[_0xa065('0x9e')]['ChatInteractionId']=_0x1c4b74['id'];if(_0x5e8d48['query']['filter']){_0x98ffe5['where']=_['merge'](_0x98ffe5['where'],{'$or':_[_0xa065('0x33')](_0x98ffe5[_0xa065('0x43')],function(_0x473c33){var _0x65f2cd={};_0x65f2cd[_0x473c33]={'$like':'%'+_0x5e8d48[_0xa065('0x3b')][_0xa065('0x9f')]+'%'};return _0x65f2cd;})});}if(_0x5e8d48[_0xa065('0x3b')][_0xa065('0xa0')]){var _0x2066bf=_0x5e8d48[_0xa065('0x3b')][_0xa065('0xa0')]['split'](',');var _0x21c234={};_0x21c234[_0x2066bf[0x0]]={'$gte':moment(_0x2066bf[0x1])[_0xa065('0x79')]('YYYY-MM-DD\x20HH:mm:ss')};_0x98ffe5['where']=_[_0xa065('0x2c')](_0x98ffe5[_0xa065('0x9e')],_0x21c234);}_0x98ffe5=_['merge']({},_0x98ffe5,_0x5e8d48[_0xa065('0x46')]);return db[_0xa065('0x5f')][_0xa065('0x23')]({'where':_0x98ffe5[_0xa065('0x9e')]})[_0xa065('0x14')](function(_0x8f5cd4){_0x553d4e['count']=_0x8f5cd4;if(_0x5e8d48[_0xa065('0x3b')][_0xa065('0xa1')]){_0x98ffe5[_0xa065('0x45')]=[{'all':!![]}];}return db[_0xa065('0x5f')][_0xa065('0x39')](_0x98ffe5);})[_0xa065('0x14')](function(_0x527f85){_0x553d4e[_0xa065('0xa2')]=_0x527f85;return _0x553d4e;});}})[_0xa065('0x14')](respondWithFilteredResult(_0x2cc5e6,_0x98ffe5))[_0xa065('0x3d')](handleError(_0x2cc5e6,null));};exports['getMyMessages']=function(_0xaaf172,_0x50144f){var _0x1e9f0b={'where':{}},_0x52173b={},_0x17ab75={'count':0x0,'rows':[]};return db[_0xa065('0x34')][_0xa065('0x4c')]({'where':{'id':_0xaaf172[_0xa065('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50144f,null))[_0xa065('0x14')](function(_0x2262d2){if(_0x2262d2){_0x52173b[_0xa065('0x40')]=_[_0xa065('0x41')](db[_0xa065('0x5f')][_0xa065('0x99')]);_0x52173b[_0xa065('0x3b')]=_[_0xa065('0x41')](_0xaaf172['query']);_0x52173b[_0xa065('0x9a')]=_[_0xa065('0x42')](_0x52173b[_0xa065('0x40')],_0x52173b[_0xa065('0x3b')]);_0x1e9f0b[_0xa065('0x43')]=_[_0xa065('0x42')](_0x52173b[_0xa065('0x40')],qs[_0xa065('0x44')](_0xaaf172[_0xa065('0x3b')]['fields']));_0x1e9f0b['attributes']=_0x1e9f0b[_0xa065('0x43')][_0xa065('0x81')]?_0x1e9f0b[_0xa065('0x43')]:_0x52173b[_0xa065('0x40')];if(!_0xaaf172['query'][_0xa065('0x9b')](_0xa065('0xa3'))){_0x1e9f0b[_0xa065('0x22')]=qs['limit'](_0xaaf172[_0xa065('0x3b')][_0xa065('0x22')]);_0x1e9f0b[_0xa065('0x24')]=qs['offset'](_0xaaf172[_0xa065('0x3b')][_0xa065('0x24')]);}_0x1e9f0b[_0xa065('0x9c')]=qs['sort'](_0xaaf172['query']['sort']);_0x1e9f0b['where']=qs[_0xa065('0x9a')](_['pick'](_0xaaf172['query'],_0x52173b[_0xa065('0x9a')]));_0x1e9f0b['where']['ChatInteractionId']=_0x2262d2['id'];if(_0xaaf172[_0xa065('0x3b')][_0xa065('0x9f')]){_0x1e9f0b[_0xa065('0x9e')]=_[_0xa065('0x2c')](_0x1e9f0b[_0xa065('0x9e')],{'$or':_[_0xa065('0x33')](_0x1e9f0b[_0xa065('0x43')],function(_0x218823){var _0x119834={};_0x119834[_0x218823]={'$like':'%'+_0xaaf172[_0xa065('0x3b')]['filter']+'%'};return _0x119834;})});}_0x1e9f0b['where']['secret']=![];if(_0xaaf172[_0xa065('0x3b')]['id']){_0x1e9f0b[_0xa065('0x9e')]['id']={'$gt':_0xaaf172[_0xa065('0x3b')]['id']};}_0x1e9f0b=_['merge']({},_0x1e9f0b,_0xaaf172[_0xa065('0x46')]);return db[_0xa065('0x5f')][_0xa065('0x23')]({'where':_0x1e9f0b[_0xa065('0x9e')]})['then'](function(_0x1e0c2f){_0x17ab75[_0xa065('0x23')]=_0x1e0c2f;_0x1e9f0b[_0xa065('0x45')]=[];if(_0xaaf172[_0xa065('0x3b')][_0xa065('0xa4')]){_0x1e9f0b[_0xa065('0x45')][_0xa065('0xa5')]({'model':db[_0xa065('0x7d')],'as':_0xa065('0x7d'),'attributes':['id',_0xa065('0x52'),_0xa065('0x87')]});}if(_0xaaf172[_0xa065('0x3b')][_0xa065('0xa1')]){_0x1e9f0b[_0xa065('0x45')]=[{'all':!![]}];}return db[_0xa065('0x5f')][_0xa065('0x39')](_0x1e9f0b);})[_0xa065('0x14')](function(_0x397bde){_0x17ab75[_0xa065('0xa2')]=_0x397bde;return _0x17ab75;});}})[_0xa065('0x14')](respondWithFilteredResult(_0x50144f,_0x1e9f0b))[_0xa065('0x3d')](handleError(_0x50144f,null));};exports[_0xa065('0xa6')]=function(_0x2c8ebd,_0x298d57){return db['ChatInteraction']['find']({'where':{'id':_0x2c8ebd[_0xa065('0x3f')]['id']}})['then'](handleEntityNotFound(_0x298d57,null))[_0xa065('0x14')](function(_0x447a4e){if(_0x447a4e){return _0x447a4e[_0xa065('0xa7')](_0x2c8ebd[_0xa065('0x2d')][_0xa065('0x96')],_[_0xa065('0x97')](_0x2c8ebd[_0xa065('0x2d')],[_0xa065('0x96'),'id'])||{})['spread'](function(){return db['Tag'][_0xa065('0x39')]({'attributes':['id',_0xa065('0x29'),_0xa065('0xa8')],'where':{'id':_0x2c8ebd[_0xa065('0x2d')][_0xa065('0x96')]}});})['then'](function(_0x3c4b77){socket[_0xa065('0xa9')](_0xa065('0xaa'),{'id':Number(_0x2c8ebd[_0xa065('0x3f')]['id']),'tags':_0x3c4b77||[]});return{'id':Number(_0x2c8ebd[_0xa065('0x3f')]['id']),'tags':_0x3c4b77||[]};});}})['then'](respondWithResult(_0x298d57,null))[_0xa065('0x3d')](handleError(_0x298d57,null));};exports[_0xa065('0xab')]=function(_0x4f3542,_0x418141){return db[_0xa065('0x34')][_0xa065('0x47')]({'where':{'id':_0x4f3542[_0xa065('0x3f')]['id']}})[_0xa065('0x14')](handleEntityNotFound(_0x418141,null))[_0xa065('0x14')](function(_0x285611){if(_0x285611){return _0x285611[_0xa065('0xab')](_0x4f3542[_0xa065('0x3b')][_0xa065('0x96')]);}})[_0xa065('0x14')](respondWithStatusCode(_0x418141,null))[_0xa065('0x3d')](handleError(_0x418141,null));};exports[_0xa065('0x75')]=function(_0x481cce,_0x39a495){var _0x1f0e3c=moment()[_0xa065('0xac')]()[_0xa065('0xad')]();var _0x30bb8f=path['join'](config[_0xa065('0x72')],_0xa065('0xae'),_0xa065('0xaf'),_0xa065('0xb0'));var _0x53f325=path[_0xa065('0x71')](config[_0xa065('0x72')],'server','files',_0xa065('0xb1'));var _0x538358=path['join'](_0x30bb8f,_0x1f0e3c);var _0x29d909=util[_0xa065('0x79')](_0xa065('0xb2'),_0x481cce[_0xa065('0x3f')]['id'],_0x1f0e3c);var _0x338c4a=path[_0xa065('0x71')](_0x30bb8f,_0x29d909);var _0xff7ad2=[];_0xff7ad2['push']({'model':db[_0xa065('0x7d')],'as':_0xa065('0x7d'),'attributes':['id',_0xa065('0x52')],'raw':!![]});_0xff7ad2[_0xa065('0xa5')]({'model':db[_0xa065('0x62')],'as':_0xa065('0x63'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x481cce[_0xa065('0x3b')][_0xa065('0xb1')]){_0xff7ad2[_0xa065('0xa5')]({'model':db['Attachment'],'as':_0xa065('0x6e'),'raw':!![]});}var _0x2abe04=[{'model':db[_0xa065('0x5f')],'as':_0xa065('0x80'),'attributes':['id',_0xa065('0x2d'),'createdAt',_0xa065('0xb3'),_0xa065('0xb4'),_0xa065('0xb5')],'include':_0xff7ad2}];_0x2abe04[_0xa065('0xa5')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0xa065('0x29')]});_0x2abe04[_0xa065('0xa5')]({'model':db[_0xa065('0x7d')],'as':_0xa065('0xb6'),'attributes':['id','fullname']});return db[_0xa065('0x34')]['find']({'where':{'id':_0x481cce[_0xa065('0x3f')]['id']},'include':_0x2abe04})[_0xa065('0x14')](handleEntityNotFound(_0x39a495,null))[_0xa065('0x14')](function(_0x1438f6){if(_0x1438f6){var _0x590aa3=_0x1438f6[_0xa065('0xb7')]({'plain':!![]});fs[_0xa065('0xb8')](_0x538358);var _0x534ab4={'channel':_0xa065('0xb9'),'account':_0x590aa3[_0xa065('0xba')][_0xa065('0x29')],'agent':_0x590aa3[_0xa065('0xb6')]?_0x590aa3['Owner'][_0xa065('0x52')]:'N.A.','createdAt':moment(_0x590aa3['createdAt'])[_0xa065('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa065('0xad')](),'closedAt':_0x590aa3[_0xa065('0x67')]?moment(_0x590aa3[_0xa065('0xbb')])[_0xa065('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa065('0xad')]():'','disposition':_0x590aa3[_0xa065('0xbc')],'chatInfo':{'browser':_0x590aa3[_0xa065('0xbd')],'os':_0x590aa3[_0xa065('0xbe')],'referer':_0x590aa3[_0xa065('0xbf')],'customerIp':_0x590aa3[_0xa065('0xc0')],'customerPort':_0x590aa3['customerPort']?_0x590aa3[_0xa065('0xc1')]:_0xa065('0xc2')},'messages':_(_0x590aa3[_0xa065('0x80')])[_0xa065('0xc3')]()[_0xa065('0x9f')]({'secret':![]})['map'](function(_0x409759){if(_0x409759[_0xa065('0x6e')]){var _0x3de1b2=path[_0xa065('0x71')](_0x53f325,_0x409759[_0xa065('0x6e')]['basename']);if(fs['existsSync'](_0x3de1b2)){fs[_0xa065('0xc4')](_0x3de1b2)['pipe'](fs[_0xa065('0xc5')](path[_0xa065('0x71')](_0x538358,_0x409759['Attachment']['basename'])));}}return{'date':moment(_0x409759['createdAt'])[_0xa065('0x79')](_0xa065('0xc6'))['toString'](),'sender':_0x409759['direction']===_0xa065('0xc7')?_0x409759['User']?_0x409759['User'][_0xa065('0x52')]:_0xa065('0x84'):_0x409759[_0xa065('0x63')][_0xa065('0xc8')]+(_0x409759['Contact'][_0xa065('0xc9')]?'\x20'+_0x409759[_0xa065('0x63')][_0xa065('0xc9')]:''),'body':_0x409759[_0xa065('0x6e')]?_0x409759[_0xa065('0x6e')][_0xa065('0x6b')]:_0x409759[_0xa065('0x2d')],'direction':_0x409759[_0xa065('0xb3')]==='out'?'A':'C','secret':_0x409759[_0xa065('0xb4')],'read':_0x409759[_0xa065('0xb5')],'attachment':_0x409759[_0xa065('0x6e')]};})[_0xa065('0xca')]()};return ejs[_0xa065('0xcb')](path[_0xa065('0x71')](config[_0xa065('0x72')],_0xa065('0xae'),_0xa065('0xcc'),_0xa065('0xcd')),{'interaction':_0x534ab4})[_0xa065('0x14')](function(_0xcbb09b){var _0x59885c=path[_0xa065('0x71')](_0x538358,_0xa065('0xce')+_0x590aa3['id']+'-'+_0x1f0e3c+_0xa065('0xcf'));var _0x21ad24={'path':_0x59885c,'channel':_0xa065('0xb9'),'interactionId':_0x590aa3['id']};return pdf['createPdfFromHTML'](_0xcbb09b,_0x21ad24);})[_0xa065('0x14')](function(){return new Promise(function(_0x5d5a25,_0xa07c6d){zipdir(_0x538358,{'saveTo':_0x338c4a},function(_0x57b779,_0x365ece){if(_0x57b779)return _0xa07c6d(_0x57b779);return _0x5d5a25(_0x365ece);});})[_0xa065('0x14')](function(){return new BPromise(function(_0x1c2fc9,_0x55734d){rimraf(_0x538358,function(_0x8a6890){if(_0x8a6890)_0x55734d(_0x8a6890);return _0x1c2fc9();});});})[_0xa065('0x14')](function(){return _0x39a495['download'](_0x338c4a,_0x29d909,function(_0x38aa42){if(_0x38aa42){logger[_0xa065('0x1a')](_0xa065('0xd0'),_0x38aa42);}else{fs[_0xa065('0xd1')](_0x338c4a);}});});});}else{return _0x39a495['sendStatus'](0xc8);}})[_0xa065('0x3d')](handleError(_0x39a495,null));}; \ No newline at end of file +var _0x3db5=['$gte','split','includeAll','findAll','rows','getMyMessages','secret','includeAgent','push','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','existsSync','createReadStream','createWriteStream','value','renderFile','server','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','request-promise','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','undefined','limit','offset','count','update','destroy','then','status','stack','name','send','render','contact','agent','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','chat','user','show','params','model','keys','query','intersection','attributes','length','include','merge','options','create','body','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','email','POST','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','file','originalname','basename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','Messages','%s%d','agentAlias','UserId','System','customer','Visitor','ContactId','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','filters','fields','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter'];(function(_0x5bb0ba,_0x3a1803){var _0x551a4e=function(_0x46de11){while(--_0x46de11){_0x5bb0ba['push'](_0x5bb0ba['shift']());}};_0x551a4e(++_0x3a1803);}(_0x3db5,0x1cf));var _0x53db=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x3db5[_0x4169d8];return _0x32084a;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x53db('0x0'));var moment=require('moment');var BPromise=require(_0x53db('0x1'));var Mustache=require(_0x53db('0x2'));var util=require(_0x53db('0x3'));var path=require(_0x53db('0x4'));var ejs=require(_0x53db('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x53db('0x6'));var interaction=require(_0x53db('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x53db('0x8'));var logger=require(_0x53db('0x9'))(_0x53db('0xa'));var config=require('../../config/environment');var db=require(_0x53db('0xb'))['db'];config['redis']=_[_0x53db('0xc')](config[_0x53db('0xd')],{'host':_0x53db('0xe'),'port':0x18eb});var socket=require(_0x53db('0xf'))(new Redis(config[_0x53db('0xd')]));require(_0x53db('0x10'))[_0x53db('0x11')](socket);var jayson=require(_0x53db('0x12'));var client=jayson[_0x53db('0x13')][_0x53db('0x14')]({'port':0x232b});var client9004=jayson['client'][_0x53db('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x3bd641,_0x577b4e,_0x45341b,_0x31a15d){return new BPromise(function(_0x3652ca,_0x480c91){var _0x426d4c=_0x31a15d||client;return _0x426d4c[_0x53db('0x15')](_0x3bd641,_0x45341b)['then'](function(_0x77f4fa){logger[_0x53db('0x16')](_0x53db('0x17'),_0x577b4e,_0x53db('0x18'));logger[_0x53db('0x19')](_0x53db('0x1a'),_0x577b4e,'request\x20sent',JSON[_0x53db('0x1b')](_0x77f4fa));if(_0x77f4fa[_0x53db('0x1c')]){if(_0x77f4fa['error'][_0x53db('0x1d')]===0x1f4){logger[_0x53db('0x1c')](_0x53db('0x17'),_0x577b4e,_0x77f4fa[_0x53db('0x1c')]['message']);return _0x480c91(_0x77f4fa[_0x53db('0x1c')][_0x53db('0x1e')]);}logger[_0x53db('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x577b4e,_0x77f4fa[_0x53db('0x1c')][_0x53db('0x1e')]);return _0x3652ca(_0x77f4fa[_0x53db('0x1c')][_0x53db('0x1e')]);}else{logger[_0x53db('0x16')](_0x53db('0x17'),_0x577b4e,'request\x20sent');_0x3652ca(_0x77f4fa['result']['message']);}})[_0x53db('0x1f')](function(_0xa6ffb9){logger[_0x53db('0x1c')](_0x53db('0x17'),_0x577b4e,_0xa6ffb9);_0x480c91(_0xa6ffb9);});});}function respondWithStatusCode(_0x53eecd,_0x163aae){_0x163aae=_0x163aae||0xcc;return function(_0x4ebccf){if(_0x4ebccf){return _0x53eecd[_0x53db('0x20')](_0x163aae);}return _0x53eecd['status'](_0x163aae)[_0x53db('0x21')]();};}function respondWithResult(_0x45ff9b,_0x2be53e){_0x2be53e=_0x2be53e||0xc8;return function(_0x1292d1){if(_0x1292d1){return _0x45ff9b['status'](_0x2be53e)[_0x53db('0x22')](_0x1292d1);}};}function respondWithFilteredResult(_0x59a692,_0x5dda8e){return function(_0x5bea95){if(_0x5bea95){var _0x1c4401=typeof _0x5dda8e['offset']===_0x53db('0x23')&&typeof _0x5dda8e[_0x53db('0x24')]===_0x53db('0x23');var _0x4fa7b0=_0x5bea95['count'];var _0x11569c=_0x1c4401?0x0:_0x5dda8e[_0x53db('0x25')];var _0x1412a5=_0x1c4401?_0x5bea95[_0x53db('0x26')]:_0x5dda8e[_0x53db('0x25')]+_0x5dda8e[_0x53db('0x24')];var _0x78f706;if(_0x1412a5>=_0x4fa7b0){_0x1412a5=_0x4fa7b0;_0x78f706=0xc8;}else{_0x78f706=0xce;}_0x59a692['status'](_0x78f706);return _0x59a692['set']('Content-Range',_0x11569c+'-'+_0x1412a5+'/'+_0x4fa7b0)[_0x53db('0x22')](_0x5bea95);}return null;};}function saveUpdates(_0x68f662){return function(_0xd5aaef){if(_0xd5aaef){return _0xd5aaef[_0x53db('0x27')](_0x68f662)['then'](function(_0x5a4a27){return _0x5a4a27;});}return null;};}function removeEntity(_0x29d43b){return function(_0x54fa2d){if(_0x54fa2d){return _0x54fa2d[_0x53db('0x28')]()[_0x53db('0x29')](function(){_0x29d43b[_0x53db('0x2a')](0xcc)[_0x53db('0x21')]();});}};}function handleEntityNotFound(_0x574cbb){return function(_0x375de4){if(!_0x375de4){_0x574cbb[_0x53db('0x20')](0x194);}return _0x375de4;};}function handleError(_0x3b1639,_0x2988f6){_0x2988f6=_0x2988f6||0x1f4;return function(_0x13941d){logger[_0x53db('0x1c')](_0x13941d[_0x53db('0x2b')]);if(_0x13941d[_0x53db('0x2c')]){delete _0x13941d[_0x53db('0x2c')];}_0x3b1639['status'](_0x2988f6)[_0x53db('0x2d')](_0x13941d);};}function getMustacheRender(_0x393af1,_0x1c0293){return Mustache[_0x53db('0x2e')](_0x393af1,_['merge'](_0x1c0293['body'],{'contact':_0x1c0293[_0x53db('0x2f')],'message':_0x1c0293[_0x53db('0x1e')],'agent':_0x1c0293[_0x53db('0x30')],'interaction':_0x1c0293['interaction'],'account':_0x1c0293[_0x53db('0x31')]}))||'';}exports[_0x53db('0x32')]=function(_0x1dc62e,_0x9ed845){var _0x580c55={};var _0xf4c15d=_[_0x53db('0x33')](db[_0x53db('0x34')][_0x53db('0x35')],function(_0x3a44c9){return{'name':_0x3a44c9[_0x53db('0x36')],'type':_0x3a44c9[_0x53db('0x37')][_0x53db('0x38')]};});_0x580c55=qs['getOptions'](_0xf4c15d,_0x1dc62e);return interaction['findAll'](_0x53db('0x39'),_0x1dc62e['query'],_0x1dc62e[_0x53db('0x3a')],_0x580c55,_0xf4c15d)['then'](respondWithFilteredResult(_0x9ed845,_0x580c55))[_0x53db('0x1f')](handleError(_0x9ed845,null));};exports[_0x53db('0x3b')]=function(_0x318563,_0x467eae){var _0x48ac8b={'raw':![],'where':{'id':_0x318563[_0x53db('0x3c')]['id']}},_0x4c1939={};_0x4c1939[_0x53db('0x3d')]=_[_0x53db('0x3e')](db[_0x53db('0x34')][_0x53db('0x35')]);_0x4c1939['query']=_['keys'](_0x318563[_0x53db('0x3f')]);_0x4c1939['filters']=_[_0x53db('0x40')](_0x4c1939[_0x53db('0x3d')],_0x4c1939['query']);_0x48ac8b[_0x53db('0x41')]=_[_0x53db('0x40')](_0x4c1939[_0x53db('0x3d')],qs['fields'](_0x318563[_0x53db('0x3f')]['fields']));_0x48ac8b[_0x53db('0x41')]=_0x48ac8b[_0x53db('0x41')][_0x53db('0x42')]?_0x48ac8b['attributes']:_0x4c1939[_0x53db('0x3d')];if(_0x318563[_0x53db('0x3f')]['includeAll']){_0x48ac8b[_0x53db('0x43')]=[{'all':!![]}];}_0x48ac8b=_[_0x53db('0x44')]({},_0x48ac8b,_0x318563[_0x53db('0x45')]);return db['ChatInteraction']['find'](_0x48ac8b)[_0x53db('0x29')](handleEntityNotFound(_0x467eae,null))[_0x53db('0x29')](respondWithResult(_0x467eae,null))[_0x53db('0x1f')](handleError(_0x467eae,null));};exports[_0x53db('0x46')]=function(_0x2b2bb3,_0x9f666){return db['ChatInteraction'][_0x53db('0x46')](_0x2b2bb3[_0x53db('0x47')],{})[_0x53db('0x29')](respondWithResult(_0x9f666,0xc9))[_0x53db('0x1f')](handleError(_0x9f666,null));};exports[_0x53db('0x27')]=function(_0x67409,_0xf5ae4c){if(_0x67409['body']['id']){delete _0x67409[_0x53db('0x47')]['id'];}return db[_0x53db('0x34')][_0x53db('0x48')]({'where':{'id':_0x67409[_0x53db('0x3c')]['id']}})[_0x53db('0x29')](handleEntityNotFound(_0xf5ae4c,null))[_0x53db('0x29')](saveUpdates(_0x67409[_0x53db('0x47')],null))[_0x53db('0x29')](respondWithResult(_0xf5ae4c,null))['catch'](handleError(_0xf5ae4c,null));};exports[_0x53db('0x28')]=function(_0x1d788f,_0x2fe772){return db[_0x53db('0x34')]['find']({'where':{'id':_0x1d788f[_0x53db('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2fe772,null))['then'](removeEntity(_0x2fe772,null))['catch'](handleError(_0x2fe772,null));};exports[_0x53db('0x49')]=function(_0x22ebf6,_0x951552){return db[_0x53db('0x34')][_0x53db('0x49')]()['then'](respondWithResult(_0x951552,null))[_0x53db('0x1f')](handleError(_0x951552,null));};exports[_0x53db('0x4a')]=function(_0x3cd527,_0x31e0af){var _0x2612da=_0x3cd527[_0x53db('0x3c')]['id'];var _0x4c9cd0;var _0x5ae5a8;var _0x1e87c8;return db[_0x53db('0x34')][_0x53db('0x4b')]({'where':{'id':_0x2612da}})[_0x53db('0x29')](function(_0x3cb7b6){_0x4c9cd0=_0x3cb7b6;return db[_0x53db('0x4c')][_0x53db('0x4b')]({'where':{'id':_0x3cb7b6[_0x53db('0x4d')]},'attributes':['id',_0x53db('0x4e'),_0x53db('0x4f'),_0x53db('0x50'),'vidaooNote',_0x53db('0x51')],'raw':!![]});})[_0x53db('0x29')](function(_0x487ad9){if(_0x487ad9&&_0x487ad9[_0x53db('0x4e')]&&_0x487ad9[_0x53db('0x4f')]){_0x5ae5a8=_0x487ad9;var _0x5ad859={'interaction':{'id':_0x2612da},'agent':{'id':_0x3cd527[_0x53db('0x3a')]['id'],'name':_0x3cd527['user'][_0x53db('0x2c')],'fullname':_0x3cd527['user'][_0x53db('0x52')],'email':_0x3cd527[_0x53db('0x3a')][_0x53db('0x53')]},'contact':_0x3cd527['body'][_0x53db('0x2f')],'account':_0x3cd527[_0x53db('0x47')][_0x53db('0x31')]};var _0x31b9f0={'rejectUnauthorized':![],'method':_0x53db('0x54'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x487ad9['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3cd527[_0x53db('0x3a')][_0x53db('0x53')]],'buttons':null,'topic':_0x5ae5a8[_0x53db('0x50')],'note':_[_0x53db('0x55')](_0x5ae5a8[_0x53db('0x56')])?null:getMustacheRender(_0x5ae5a8[_0x53db('0x56')],_0x5ad859),'metadata':null},'redirect':_0x53db('0x57'),'json':!![]};try{if(!_[_0x53db('0x55')](_0x5ae5a8[_0x53db('0x51')])){var _0x3f38fd=getMustacheRender(_0x5ae5a8[_0x53db('0x51')],_0x5ad859);var _0x3509f0=JSON['parse'](_0x3f38fd);_0x31b9f0[_0x53db('0x47')][_0x53db('0x58')]=_0x3509f0;}}catch(_0x308663){throw new db[(_0x53db('0x59'))][(_0x53db('0x5a'))](_0x53db('0x5b'));}return rp(_0x31b9f0);}else{throw new db['Sequelize'][(_0x53db('0x5a'))](_0x53db('0x5c'));}})['then'](function(_0x2d395a){_0x1e87c8=_0x2d395a;if(_0x1e87c8['id']){var _0x4ce60a={'body':_0x1e87c8[_0x53db('0x5d')],'ChatWebsiteId':_0x5ae5a8['id'],'ChatInteractionId':_0x4c9cd0['id'],'direction':_0x53db('0x5e'),'UserId':_0x3cd527['user']['id']};return db[_0x53db('0x5f')][_0x53db('0x46')](_0x4ce60a,{});}else{throw new db['Sequelize'][(_0x53db('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x53db('0x29')](function(){return _0x4c9cd0[_0x53db('0x60')]({'vidaooSessionId':_0x1e87c8['id']});})[_0x53db('0x29')](respondWithResult(_0x31e0af,null))[_0x53db('0x1f')](handleError(_0x31e0af,null));};exports[_0x53db('0x61')]=function(_0x1cb100,_0x4a99a1){if(_0x1cb100[_0x53db('0x47')]['id']){delete _0x1cb100[_0x53db('0x47')]['id'];}return db[_0x53db('0x34')][_0x53db('0x48')]({'where':{'id':_0x1cb100[_0x53db('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0x53db('0x62')}]})['then'](handleEntityNotFound(_0x4a99a1,null))['then'](saveUpdates(_0x1cb100['body'],null))['then'](respondWithResult(_0x4a99a1,null))[_0x53db('0x1f')](handleError(_0x4a99a1,null));};exports[_0x53db('0x63')]=function(_0xea039f,_0x2d3c4d){if(_0xea039f[_0x53db('0x47')]['id']){delete _0xea039f[_0x53db('0x47')]['id'];}return db[_0x53db('0x34')][_0x53db('0x48')]({'where':{'id':_0xea039f['params']['id']}})[_0x53db('0x29')](function(_0x3ecff3){if(!_0x3ecff3){logger[_0x53db('0x1c')](_0x53db('0x64'),_0x53db('0x63'),0x194,_0x53db('0x65'));_0x2d3c4d[_0x53db('0x20')](0x194);}else{if(_0x3ecff3['UserId']){throw new db[(_0x53db('0x59'))][(_0x53db('0x5a'))](_0x53db('0x66'));}}return _0x3ecff3;})['then'](function(_0x34979f){if(_0x34979f){return _0x34979f[_0x53db('0x27')]({'closed':_0xea039f[_0x53db('0x47')][_0x53db('0x67')],'disposition':_0xea039f['body'][_0x53db('0x68')]})[_0x53db('0x29')](function(_0x4efcd6){return _0x4efcd6;});}})[_0x53db('0x29')](function(){return respondWithRpcPromise('AbandonInteraction',_0x53db('0x63'),_0xea039f[_0x53db('0x47')],client9004);})[_0x53db('0x29')](respondWithResult(_0x2d3c4d,null))[_0x53db('0x1f')](handleError(_0x2d3c4d,null));};exports['attachmentUpload']=function(_0x355c4f,_0x3df06e){_0x355c4f[_0x53db('0x47')][_0x53db('0x2c')]=_0x355c4f[_0x53db('0x69')][_0x53db('0x6a')];_0x355c4f[_0x53db('0x47')][_0x53db('0x6b')]=_0x355c4f['file']['filename'];_0x355c4f[_0x53db('0x47')]['type']=_0x355c4f[_0x53db('0x69')][_0x53db('0x6c')];return db['Attachment'][_0x53db('0x46')](_0x355c4f[_0x53db('0x47')])['then'](respondWithResult(_0x3df06e,0xc9))[_0x53db('0x1f')](handleError(_0x3df06e,null));};exports[_0x53db('0x6d')]=function(_0x54da36,_0x2c3f2a){return db[_0x53db('0x34')][_0x53db('0x4b')]({'where':{'id':_0x54da36[_0x53db('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2c3f2a,null))[_0x53db('0x29')](function(_0x14c6eb){if(_0x14c6eb){if(_0x14c6eb['closed']){return _0x2c3f2a[_0x53db('0x2a')](0x193)[_0x53db('0x22')]({'status':0x193,'message':_0x53db('0x6e')});}return db[_0x53db('0x6f')][_0x53db('0x4b')]({'where':{'id':_0x54da36[_0x53db('0x3f')][_0x53db('0x70')]},'raw':!![]})[_0x53db('0x29')](handleEntityNotFound(_0x2c3f2a,null));}})[_0x53db('0x29')](function(_0x4dee79){if(_0x4dee79){var _0x1ea1c3=_0x4dee79['ChatOfflineMessageId']!==null;var _0x4c7a1a=path[_0x53db('0x71')](config[_0x53db('0x72')],_0x53db('0x73'));if(_0x1ea1c3){_0x4c7a1a=path[_0x53db('0x71')](_0x4c7a1a,_0x53db('0x74'));}var _0x3ec60a=path[_0x53db('0x71')](_0x4c7a1a,_0x4dee79['basename']);return _0x2c3f2a['download'](_0x3ec60a);}})[_0x53db('0x1f')](handleError(_0x2c3f2a,null));};exports[_0x53db('0x75')]=function(_0x14e293,_0x18ff31){var _0x26d515=null;var _0x4d6008=null;var _0x2e6c59=null;if(_0x14e293[_0x53db('0x47')]['id']){delete _0x14e293[_0x53db('0x47')]['id'];}if(_0x14e293[_0x53db('0x47')][_0x53db('0x76')]){_0x2e6c59=path['join'](config[_0x53db('0x72')],_0x53db('0x77'),util[_0x53db('0x78')](_0x53db('0x79'),Date[_0x53db('0x7a')]()));_0x14e293[_0x53db('0x47')][_0x53db('0x7b')]=_0x2e6c59;}return db['ChatInteraction']['find']({'where':{'id':_0x14e293['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x53db('0x7c')],'as':_0x53db('0x7c')}]}]})['then'](handleEntityNotFound(_0x18ff31,null))['then'](saveUpdates(_0x14e293[_0x53db('0x47')],null))[_0x53db('0x29')](function(_0x4739a5){if(_0x4739a5){_0x26d515=_0x4739a5;return db[_0x53db('0x4c')][_0x53db('0x48')]({'where':{'id':_0x26d515[_0x53db('0x4d')]}});}})[_0x53db('0x29')](function(_0x9988d3){if(_0x9988d3){_0x4d6008=_0x9988d3;return db['CmContact'][_0x53db('0x48')]({'where':{'id':_0x26d515['ContactId']}});}})[_0x53db('0x29')](function(_0x5ace92){if(_0x5ace92){if(_0x2e6c59){var _0x4359d1=null;for(var _0x468ad5=0x1;_0x468ad5<_0x26d515[_0x53db('0x7d')][_0x53db('0x42')];++_0x468ad5){_0x4359d1=_0x26d515[_0x53db('0x7d')][_0x468ad5];var _0x41f711=_0x4359d1['UserId']?util[_0x53db('0x78')](_0x53db('0x7e'),_0x4d6008[_0x53db('0x7f')],_0x4359d1[_0x53db('0x80')]):_0x53db('0x81');var _0x46d9e4=_0x14e293['body'][_0x53db('0x82')]||util[_0x53db('0x78')]('%s%d',_0x53db('0x83'),_0x4359d1[_0x53db('0x84')]);switch(_0x4d6008['agentIdentifier']){case _0x53db('0x85'):_0x41f711=_0x4359d1[_0x53db('0x80')]?util['format'](_0x53db('0x7e'),_0x4d6008['agentAlias'],_0x4359d1[_0x53db('0x80')]):_0x53db('0x81');break;case _0x53db('0x86'):_0x41f711=_0x4359d1['UserId']?_0x4359d1[_0x53db('0x7c')][_0x53db('0x87')]||_0x4359d1[_0x53db('0x7c')][_0x53db('0x52')]:_0x53db('0x81');break;case'agent_fullname':_0x41f711=_0x4359d1[_0x53db('0x80')]?_0x4359d1[_0x53db('0x7c')][_0x53db('0x52')]:_0x53db('0x81');break;default:_0x41f711=_0x4359d1[_0x53db('0x80')]?util[_0x53db('0x78')](_0x53db('0x7e'),_0x4d6008[_0x53db('0x7f')],_0x4359d1[_0x53db('0x80')]):_0x53db('0x81');}var _0x4f3001=util[_0x53db('0x78')](_0x53db('0x88'),moment(_0x4359d1[_0x53db('0x89')])[_0x53db('0x78')](_0x53db('0x8a')),_0x4359d1[_0x53db('0x8b')]==='in'?_0x46d9e4:_0x41f711,_0x4359d1['body']);if(!_0x4359d1['secret']){fs['appendFileSync'](_0x2e6c59,_0x4f3001);}}return db[_0x53db('0x8c')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x53db('0x8d')],'as':_0x53db('0x8e'),'raw':!![],'include':[{'model':db[_0x53db('0x8f')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x53db('0x29')](function(_0x190f36){if(!_0x190f36||!_0x190f36[_0x53db('0x8e')]||!_0x14e293[_0x53db('0x47')])return _0x26d515;var _0x17674e=_0x190f36['getSmtpOptions']();return respondWithRpcPromise(_0x53db('0x90'),_0x53db('0x91'),{'account':_0x17674e,'message':{'from':util[_0x53db('0x78')](_0x53db('0x92'),_0x190f36[_0x53db('0x2c')],_0x190f36['email']||_0x190f36[_0x53db('0x8e')][_0x53db('0x3a')]),'to':_0x14e293[_0x53db('0x47')][_0x53db('0x76')],'subject':_0x53db('0x93'),'text':util[_0x53db('0x78')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x14e293[_0x53db('0x47')][_0x53db('0x76')]),'attachments':[{'path':_0x2e6c59}]}})['then'](function(){return _0x26d515;})['catch'](function(_0x2871d4){logger[_0x53db('0x1c')](_0x2871d4);});})[_0x53db('0x29')](respondWithStatusCode(_0x18ff31,0xc8))['catch'](handleError(_0x18ff31,null));};exports['addMessage']=function(_0x5080d8,_0x5eb15d){return db[_0x53db('0x5f')][_0x53db('0x48')]({'where':{'id':_0x5080d8[_0x53db('0x3c')]['id']}})[_0x53db('0x29')](handleEntityNotFound(_0x5eb15d,null))[_0x53db('0x29')](function(_0xc46662){if(_0xc46662){return _0xc46662[_0x53db('0x94')](_0x5080d8['body'][_0x53db('0x95')],_[_0x53db('0x96')](_0x5080d8['body'],[_0x53db('0x95'),'id'])||{});}})[_0x53db('0x29')](respondWithResult(_0x5eb15d,null))[_0x53db('0x1f')](handleError(_0x5eb15d,null));};exports['getMessages']=function(_0x54cd78,_0xce3bd6){var _0x51f543={'raw':![],'where':{}};var _0x5a13f6={};var _0x43842e={'count':0x0,'rows':[]};return db[_0x53db('0x34')][_0x53db('0x4b')]({'where':{'id':_0x54cd78[_0x53db('0x3c')]['id']}})[_0x53db('0x29')](handleEntityNotFound(_0xce3bd6,null))['then'](function(_0x2b4986){if(_0x2b4986){_0x5a13f6[_0x53db('0x3d')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x5a13f6[_0x53db('0x3f')]=_[_0x53db('0x3e')](_0x54cd78['query']);_0x5a13f6[_0x53db('0x97')]=_['intersection'](_0x5a13f6[_0x53db('0x3d')],_0x5a13f6[_0x53db('0x3f')]);_0x51f543[_0x53db('0x41')]=_[_0x53db('0x40')](_0x5a13f6[_0x53db('0x3d')],qs[_0x53db('0x98')](_0x54cd78['query']['fields']));_0x51f543[_0x53db('0x41')]=_0x51f543[_0x53db('0x41')][_0x53db('0x42')]?_0x51f543['attributes']:_0x5a13f6['model'];if(!_0x54cd78[_0x53db('0x3f')][_0x53db('0x99')](_0x53db('0x9a'))){_0x51f543[_0x53db('0x24')]=qs['limit'](_0x54cd78[_0x53db('0x3f')][_0x53db('0x24')]);_0x51f543[_0x53db('0x25')]=qs[_0x53db('0x25')](_0x54cd78['query'][_0x53db('0x25')]);}_0x51f543[_0x53db('0x9b')]=qs['sort'](_0x54cd78['query'][_0x53db('0x9c')]);_0x51f543['where']=qs[_0x53db('0x97')](_[_0x53db('0x9d')](_0x54cd78[_0x53db('0x3f')],_0x5a13f6[_0x53db('0x97')]));_0x51f543[_0x53db('0x9e')][_0x53db('0x9f')]=_0x2b4986['id'];if(_0x54cd78[_0x53db('0x3f')][_0x53db('0xa0')]){_0x51f543[_0x53db('0x9e')]=_['merge'](_0x51f543[_0x53db('0x9e')],{'$or':_['map'](_0x51f543['attributes'],function(_0x99004){var _0x14d576={};_0x14d576[_0x99004]={'$like':'%'+_0x54cd78[_0x53db('0x3f')][_0x53db('0xa0')]+'%'};return _0x14d576;})});}if(_0x54cd78[_0x53db('0x3f')][_0x53db('0xa1')]){var _0x560bc6=_0x54cd78['query'][_0x53db('0xa1')][_0x53db('0xa2')](',');var _0x4349bf={};_0x4349bf[_0x560bc6[0x0]]={'$gte':moment(_0x560bc6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x51f543[_0x53db('0x9e')]=_[_0x53db('0x44')](_0x51f543[_0x53db('0x9e')],_0x4349bf);}_0x51f543=_[_0x53db('0x44')]({},_0x51f543,_0x54cd78[_0x53db('0x45')]);return db[_0x53db('0x5f')][_0x53db('0x26')]({'where':_0x51f543['where']})[_0x53db('0x29')](function(_0x256974){_0x43842e[_0x53db('0x26')]=_0x256974;if(_0x54cd78[_0x53db('0x3f')][_0x53db('0xa3')]){_0x51f543[_0x53db('0x43')]=[{'all':!![]}];}return db[_0x53db('0x5f')][_0x53db('0xa4')](_0x51f543);})[_0x53db('0x29')](function(_0x4a6c5e){_0x43842e[_0x53db('0xa5')]=_0x4a6c5e;return _0x43842e;});}})['then'](respondWithFilteredResult(_0xce3bd6,_0x51f543))[_0x53db('0x1f')](handleError(_0xce3bd6,null));};exports[_0x53db('0xa6')]=function(_0x2546e0,_0x148751){var _0x4da08b={'where':{}},_0x17d8d3={},_0x6fcc07={'count':0x0,'rows':[]};return db[_0x53db('0x34')][_0x53db('0x4b')]({'where':{'id':_0x2546e0['params']['id']}})['then'](handleEntityNotFound(_0x148751,null))[_0x53db('0x29')](function(_0x405c4b){if(_0x405c4b){_0x17d8d3[_0x53db('0x3d')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x17d8d3[_0x53db('0x3f')]=_[_0x53db('0x3e')](_0x2546e0[_0x53db('0x3f')]);_0x17d8d3['filters']=_[_0x53db('0x40')](_0x17d8d3[_0x53db('0x3d')],_0x17d8d3['query']);_0x4da08b[_0x53db('0x41')]=_['intersection'](_0x17d8d3['model'],qs[_0x53db('0x98')](_0x2546e0[_0x53db('0x3f')][_0x53db('0x98')]));_0x4da08b[_0x53db('0x41')]=_0x4da08b[_0x53db('0x41')][_0x53db('0x42')]?_0x4da08b[_0x53db('0x41')]:_0x17d8d3['model'];if(!_0x2546e0[_0x53db('0x3f')][_0x53db('0x99')]('nolimit')){_0x4da08b[_0x53db('0x24')]=qs[_0x53db('0x24')](_0x2546e0[_0x53db('0x3f')][_0x53db('0x24')]);_0x4da08b[_0x53db('0x25')]=qs[_0x53db('0x25')](_0x2546e0['query'][_0x53db('0x25')]);}_0x4da08b[_0x53db('0x9b')]=qs['sort'](_0x2546e0[_0x53db('0x3f')][_0x53db('0x9c')]);_0x4da08b[_0x53db('0x9e')]=qs[_0x53db('0x97')](_[_0x53db('0x9d')](_0x2546e0[_0x53db('0x3f')],_0x17d8d3[_0x53db('0x97')]));_0x4da08b[_0x53db('0x9e')][_0x53db('0x9f')]=_0x405c4b['id'];if(_0x2546e0[_0x53db('0x3f')][_0x53db('0xa0')]){_0x4da08b[_0x53db('0x9e')]=_[_0x53db('0x44')](_0x4da08b['where'],{'$or':_[_0x53db('0x33')](_0x4da08b[_0x53db('0x41')],function(_0x6bcde){var _0x14b17d={};_0x14b17d[_0x6bcde]={'$like':'%'+_0x2546e0['query'][_0x53db('0xa0')]+'%'};return _0x14b17d;})});}_0x4da08b[_0x53db('0x9e')][_0x53db('0xa7')]=![];if(_0x2546e0[_0x53db('0x3f')]['id']){_0x4da08b[_0x53db('0x9e')]['id']={'$gt':_0x2546e0['query']['id']};}_0x4da08b=_[_0x53db('0x44')]({},_0x4da08b,_0x2546e0[_0x53db('0x45')]);return db[_0x53db('0x5f')][_0x53db('0x26')]({'where':_0x4da08b[_0x53db('0x9e')]})['then'](function(_0x5dd7c2){_0x6fcc07[_0x53db('0x26')]=_0x5dd7c2;_0x4da08b[_0x53db('0x43')]=[];if(_0x2546e0[_0x53db('0x3f')][_0x53db('0xa8')]){_0x4da08b[_0x53db('0x43')][_0x53db('0xa9')]({'model':db[_0x53db('0x7c')],'as':_0x53db('0x7c'),'attributes':['id',_0x53db('0x52'),'alias']});}if(_0x2546e0[_0x53db('0x3f')][_0x53db('0xa3')]){_0x4da08b[_0x53db('0x43')]=[{'all':!![]}];}return db['ChatMessage'][_0x53db('0xa4')](_0x4da08b);})[_0x53db('0x29')](function(_0x51593f){_0x6fcc07['rows']=_0x51593f;return _0x6fcc07;});}})[_0x53db('0x29')](respondWithFilteredResult(_0x148751,_0x4da08b))[_0x53db('0x1f')](handleError(_0x148751,null));};exports['addTags']=function(_0x1af81a,_0x39b42b){return db[_0x53db('0x34')]['find']({'where':{'id':_0x1af81a[_0x53db('0x3c')]['id']}})['then'](handleEntityNotFound(_0x39b42b,null))[_0x53db('0x29')](function(_0x271eaa){if(_0x271eaa){return _0x271eaa[_0x53db('0xaa')](_0x1af81a[_0x53db('0x47')][_0x53db('0x95')],_['omit'](_0x1af81a[_0x53db('0x47')],[_0x53db('0x95'),'id'])||{})[_0x53db('0xab')](function(){return db[_0x53db('0xac')][_0x53db('0xa4')]({'attributes':['id',_0x53db('0x2c'),_0x53db('0xad')],'where':{'id':_0x1af81a['body'][_0x53db('0x95')]}});})['then'](function(_0x4df2e9){socket[_0x53db('0xae')](_0x53db('0xaf'),{'id':Number(_0x1af81a['params']['id']),'tags':_0x4df2e9||[]});return{'id':Number(_0x1af81a['params']['id']),'tags':_0x4df2e9||[]};});}})['then'](respondWithResult(_0x39b42b,null))[_0x53db('0x1f')](handleError(_0x39b42b,null));};exports[_0x53db('0xb0')]=function(_0x2d02cf,_0x1e07f7){return db[_0x53db('0x34')][_0x53db('0x48')]({'where':{'id':_0x2d02cf[_0x53db('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1e07f7,null))[_0x53db('0x29')](function(_0x3f6cae){if(_0x3f6cae){return _0x3f6cae[_0x53db('0xb0')](_0x2d02cf[_0x53db('0x3f')][_0x53db('0x95')]);}})[_0x53db('0x29')](respondWithStatusCode(_0x1e07f7,null))['catch'](handleError(_0x1e07f7,null));};exports[_0x53db('0xb1')]=function(_0x4ce03d,_0x277f80){var _0x27b787=moment()[_0x53db('0xb2')]()[_0x53db('0xb3')]();var _0x148836=path['join'](config['root'],'server',_0x53db('0xb4'),_0x53db('0xb5'));var _0x17651f=path[_0x53db('0x71')](config[_0x53db('0x72')],'server','files',_0x53db('0xb6'));var _0x167803=path[_0x53db('0x71')](_0x148836,_0x27b787);var _0x3f9f7c=util['format'](_0x53db('0xb7'),_0x4ce03d[_0x53db('0x3c')]['id'],_0x27b787);var _0x18e9be=path[_0x53db('0x71')](_0x148836,_0x3f9f7c);var _0x513077=[];_0x513077[_0x53db('0xa9')]({'model':db[_0x53db('0x7c')],'as':_0x53db('0x7c'),'attributes':['id',_0x53db('0x52')],'raw':!![]});_0x513077[_0x53db('0xa9')]({'model':db[_0x53db('0xb8')],'as':'Contact','attributes':['id',_0x53db('0xb9'),_0x53db('0xba')],'raw':!![]});if(_0x4ce03d['query'][_0x53db('0xb6')]){_0x513077[_0x53db('0xa9')]({'model':db[_0x53db('0x6f')],'as':_0x53db('0x6f'),'raw':!![]});}var _0x13946c=[{'model':db[_0x53db('0x5f')],'as':'Messages','attributes':['id',_0x53db('0x47'),_0x53db('0x89'),_0x53db('0x8b'),_0x53db('0xa7'),_0x53db('0xbb')],'include':_0x513077}];_0x13946c[_0x53db('0xa9')]({'model':db['ChatWebsite'],'as':_0x53db('0xbc'),'attributes':['id',_0x53db('0x2c')]});_0x13946c['push']({'model':db['User'],'as':_0x53db('0xbd'),'attributes':['id',_0x53db('0x52')]});return db[_0x53db('0x34')][_0x53db('0x48')]({'where':{'id':_0x4ce03d[_0x53db('0x3c')]['id']},'include':_0x13946c})[_0x53db('0x29')](handleEntityNotFound(_0x277f80,null))[_0x53db('0x29')](function(_0x3efaed){if(_0x3efaed){var _0x563e2c=_0x3efaed['get']({'plain':!![]});fs['mkdirSync'](_0x167803);var _0x191c0c={'channel':_0x53db('0xbe'),'account':_0x563e2c[_0x53db('0xbc')][_0x53db('0x2c')],'agent':_0x563e2c[_0x53db('0xbd')]?_0x563e2c[_0x53db('0xbd')]['fullname']:_0x53db('0xbf'),'createdAt':moment(_0x563e2c['createdAt'])[_0x53db('0x78')](_0x53db('0xc0'))['toString'](),'closedAt':_0x563e2c[_0x53db('0x67')]?moment(_0x563e2c['closedAt'])['format'](_0x53db('0xc0'))[_0x53db('0xb3')]():'','disposition':_0x563e2c[_0x53db('0x68')],'chatInfo':{'browser':_0x563e2c[_0x53db('0xc1')],'os':_0x563e2c[_0x53db('0xc2')],'referer':_0x563e2c[_0x53db('0xc3')],'customerIp':_0x563e2c[_0x53db('0xc4')],'customerPort':_0x563e2c['customerPort']?_0x563e2c['customerPort']:_0x53db('0xbf')},'messages':_(_0x563e2c[_0x53db('0x7d')])['tail']()[_0x53db('0xa0')]({'secret':![]})[_0x53db('0x33')](function(_0x1176cb){if(_0x1176cb['Attachment']){var _0x4325fb=path[_0x53db('0x71')](_0x17651f,_0x1176cb[_0x53db('0x6f')]['basename']);if(fs[_0x53db('0xc5')](_0x4325fb)){fs[_0x53db('0xc6')](_0x4325fb)['pipe'](fs[_0x53db('0xc7')](path['join'](_0x167803,_0x1176cb['Attachment']['basename'])));}}return{'date':moment(_0x1176cb[_0x53db('0x89')])[_0x53db('0x78')](_0x53db('0xc0'))[_0x53db('0xb3')](),'sender':_0x1176cb[_0x53db('0x8b')]==='out'?_0x1176cb['User']?_0x1176cb[_0x53db('0x7c')]['fullname']:'System':_0x1176cb[_0x53db('0x62')]['firstName']+(_0x1176cb[_0x53db('0x62')][_0x53db('0xba')]?'\x20'+_0x1176cb[_0x53db('0x62')][_0x53db('0xba')]:''),'body':_0x1176cb[_0x53db('0x6f')]?_0x1176cb['Attachment'][_0x53db('0x6b')]:_0x1176cb[_0x53db('0x47')],'direction':_0x1176cb[_0x53db('0x8b')]===_0x53db('0x5e')?'A':'C','secret':_0x1176cb['secret'],'read':_0x1176cb['read'],'attachment':_0x1176cb['Attachment']};})[_0x53db('0xc8')]()};return ejs[_0x53db('0xc9')](path[_0x53db('0x71')](config[_0x53db('0x72')],_0x53db('0xca'),'views','downloadInteraction.ejs'),{'interaction':_0x191c0c})[_0x53db('0x29')](function(_0x57da9f){var _0x32e109=path[_0x53db('0x71')](_0x167803,_0x53db('0xcb')+_0x563e2c['id']+'-'+_0x27b787+_0x53db('0xcc'));var _0x4b04f2={'path':_0x32e109,'channel':'Chat','interactionId':_0x563e2c['id']};return pdf[_0x53db('0xcd')](_0x57da9f,_0x4b04f2);})[_0x53db('0x29')](function(){return new Promise(function(_0x2533f6,_0xb98e2){zipdir(_0x167803,{'saveTo':_0x18e9be},function(_0x92c075,_0x419b91){if(_0x92c075)return _0xb98e2(_0x92c075);return _0x2533f6(_0x419b91);});})[_0x53db('0x29')](function(){return new BPromise(function(_0x524c74,_0x5b1a70){rimraf(_0x167803,function(_0x43e856){if(_0x43e856)_0x5b1a70(_0x43e856);return _0x524c74();});});})[_0x53db('0x29')](function(){return _0x277f80[_0x53db('0xb1')](_0x18e9be,_0x3f9f7c,function(_0x4710ed){if(_0x4710ed){logger[_0x53db('0x1c')](_0x53db('0xce'),_0x4710ed);}else{fs[_0x53db('0xcf')](_0x18e9be);}});});});}else{return _0x277f80['sendStatus'](0xc8);}})[_0x53db('0x1f')](handleError(_0x277f80,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 679681f..9884d7b 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 _0x5529=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','Users','map','findAll','then'];(function(_0x5c6712,_0x36ef0c){var _0x4bb74e=function(_0x4e1fb2){while(--_0x4e1fb2){_0x5c6712['push'](_0x5c6712['shift']());}};_0x4bb74e(++_0x36ef0c);}(_0x5529,0xdf));var _0x9552=function(_0x2701bb,_0x29c1cc){_0x2701bb=_0x2701bb-0x0;var _0x2779db=_0x5529[_0x2701bb];return _0x2779db;};'use strict';var EventEmitter=require(_0x9552('0x0'));var ChatInteraction=require(_0x9552('0x1'))['db'][_0x9552('0x2')];var ChatMessage=require(_0x9552('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9552('0x3')](0x0);var events={'afterCreate':_0x9552('0x4'),'afterUpdate':_0x9552('0x5'),'afterDestroy':_0x9552('0x6')};function emitEvent(_0x4ae26c){return function(_0x5487f0,_0x53ecae,_0x3d4ebf){_0x5487f0['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1b4695){_0x5487f0['setDataValue'](_0x9552('0x7'),_0x1b4695[_0x9552('0x8')](function(_0x490346){return{'id':_0x490346['id']};}));return ChatMessage[_0x9552('0x9')]({'where':{'ChatInteractionId':_0x5487f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9552('0xa')](function(_0x50842a){_0x5487f0[_0x9552('0xb')](_0x9552('0xc'),_0x50842a[_0x9552('0xd')]);ChatInteractionEvents[_0x9552('0xe')](_0x4ae26c+':'+_0x5487f0['id'],_0x5487f0);ChatInteractionEvents[_0x9552('0xe')](_0x4ae26c,_0x5487f0);_0x3d4ebf(null);})[_0x9552('0xf')](_0x3d4ebf(null));};}for(var e in events){if(events[_0x9552('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x9552('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x69ab=['save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x51fb04,_0x2b5804){var _0x442480=function(_0x4e5973){while(--_0x4e5973){_0x51fb04['push'](_0x51fb04['shift']());}};_0x442480(++_0x2b5804);}(_0x69ab,0x12d));var _0xb69a=function(_0x49673c,_0x163aa4){_0x49673c=_0x49673c-0x0;var _0x42714b=_0x69ab[_0x49673c];return _0x42714b;};'use strict';var EventEmitter=require(_0xb69a('0x0'));var ChatInteraction=require(_0xb69a('0x1'))['db'][_0xb69a('0x2')];var ChatMessage=require(_0xb69a('0x1'))['db'][_0xb69a('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb69a('0x4')](0x0);var events={'afterCreate':_0xb69a('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ffcc7){return function(_0x4a8606,_0x348552,_0x3eca67){_0x4a8606[_0xb69a('0x6')]({'attributes':['id'],'raw':!![]})[_0xb69a('0x7')](function(_0xb6b1e7){_0x4a8606[_0xb69a('0x8')](_0xb69a('0x9'),_0xb6b1e7[_0xb69a('0xa')](function(_0x5696fd){return{'id':_0x5696fd['id']};}));return ChatMessage[_0xb69a('0xb')]({'where':{'ChatInteractionId':_0x4a8606['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb69a('0x7')](function(_0x28394b){_0x4a8606[_0xb69a('0x8')](_0xb69a('0xc'),_0x28394b['length']);ChatInteractionEvents[_0xb69a('0xd')](_0x1ffcc7+':'+_0x4a8606['id'],_0x4a8606);ChatInteractionEvents['emit'](_0x1ffcc7,_0x4a8606);_0x3eca67(null);})['catch'](_0x3eca67(null));};}for(var e in events){if(events[_0xb69a('0xe')](e)){var event=events[e];ChatInteraction[_0xb69a('0xf')](e,emitEvent(event));}}module[_0xb69a('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5245385..d03fcfe 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 _0x15d0=['request-promise','path','rimraf','exports','define','ChatInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x2999c7,_0x50c6cc){var _0xc521f0=function(_0x2b624b){while(--_0x2b624b){_0x2999c7['push'](_0x2999c7['shift']());}};_0xc521f0(++_0x50c6cc);}(_0x15d0,0x14c));var _0x015d=function(_0x6bfd84,_0x5d5e05){_0x6bfd84=_0x6bfd84-0x0;var _0xf3b43a=_0x15d0[_0x6bfd84];return _0xf3b43a;};'use strict';var _=require(_0x015d('0x0'));var util=require('util');var logger=require(_0x015d('0x1'))(_0x015d('0x2'));var moment=require(_0x015d('0x3'));var BPromise=require('bluebird');var rp=require(_0x015d('0x4'));var fs=require('fs');var path=require(_0x015d('0x5'));var rimraf=require(_0x015d('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x015d('0x7')]=function(_0x52def4,_0x14c8a6){return _0x52def4[_0x015d('0x8')](_0x015d('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4adc26,_0xa9cf24,_0x34d298){if(_0x4adc26[_0x015d('0xa')](_0x015d('0xb'))){_0x4adc26['closedAt']=moment()[_0x015d('0xc')](_0x015d('0xd'));}_0x34d298(null,_0x4adc26);}},'charset':_0x015d('0xe'),'collate':_0x015d('0xf')});}; \ No newline at end of file +var _0x50d2=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','closed','closedAt','format'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x50d2,0xe3));var _0x250d=function(_0x1faf02,_0x472953){_0x1faf02=_0x1faf02-0x0;var _0x363aaf=_0x50d2[_0x1faf02];return _0x363aaf;};'use strict';var _=require('lodash');var util=require(_0x250d('0x0'));var logger=require(_0x250d('0x1'))(_0x250d('0x2'));var moment=require(_0x250d('0x3'));var BPromise=require(_0x250d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x250d('0x5'));var rimraf=require('rimraf');var config=require(_0x250d('0x6'));var attributes=require(_0x250d('0x7'));module['exports']=function(_0x11bfc2,_0x24d3c8){return _0x11bfc2[_0x250d('0x8')](_0x250d('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5165f4,_0x1a1be7,_0x1cec54){if(_0x5165f4['changed'](_0x250d('0xa'))){_0x5165f4[_0x250d('0xb')]=moment()[_0x250d('0xc')](_0x250d('0xd'));}_0x1cec54(null,_0x5165f4);}},'charset':_0x250d('0xe'),'collate':_0x250d('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3806bdb..00c9cc6 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 _0x17bf=['spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','addTags','ids','omit'];(function(_0x35747a,_0x5763f4){var _0x224e75=function(_0x16e3dd){while(--_0x16e3dd){_0x35747a['push'](_0x35747a['shift']());}};_0x224e75(++_0x5763f4);}(_0x17bf,0xae));var _0xf17b=function(_0x166362,_0x349328){_0x166362=_0x166362-0x0;var _0x1225ed=_0x17bf[_0x166362];return _0x1225ed;};'use strict';var _=require(_0xf17b('0x0'));var util=require(_0xf17b('0x1'));var moment=require('moment');var BPromise=require(_0xf17b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf17b('0x3'));var db=require(_0xf17b('0x4'))['db'];var utils=require(_0xf17b('0x5'));var logger=require('../../config/logger')(_0xf17b('0x6'));var config=require(_0xf17b('0x7'));var jayson=require(_0xf17b('0x8'));var client=jayson[_0xf17b('0x9')][_0xf17b('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf17b('0xb')],{'host':_0xf17b('0xc'),'port':0x18eb});var socket=require(_0xf17b('0xd'))(new Redis(config['redis']));require(_0xf17b('0xe'))['register'](socket);function respondWithRpcPromise(_0x189258,_0x2cdd92,_0x22d2db){return new BPromise(function(_0x4e7cb0,_0x2c3c03){return client[_0xf17b('0xf')](_0x189258,_0x22d2db)[_0xf17b('0x10')](function(_0x589fd7){logger['info'](_0xf17b('0x11'),_0x2cdd92,_0xf17b('0x12'));logger[_0xf17b('0x13')](_0xf17b('0x14'),_0x2cdd92,_0xf17b('0x12'),JSON[_0xf17b('0x15')](_0x589fd7));if(_0x589fd7[_0xf17b('0x16')]){if(_0x589fd7[_0xf17b('0x16')][_0xf17b('0x17')]===0x1f4){logger['error'](_0xf17b('0x11'),_0x2cdd92,_0x589fd7[_0xf17b('0x16')]['message']);return _0x2c3c03(_0x589fd7[_0xf17b('0x16')][_0xf17b('0x18')]);}logger[_0xf17b('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x2cdd92,_0x589fd7[_0xf17b('0x16')]['message']);return _0x4e7cb0(_0x589fd7['error']['message']);}else{logger[_0xf17b('0x19')](_0xf17b('0x11'),_0x2cdd92,_0xf17b('0x12'));_0x4e7cb0(_0x589fd7[_0xf17b('0x1a')][_0xf17b('0x18')]);}})['catch'](function(_0x38e4cb){logger[_0xf17b('0x16')](_0xf17b('0x11'),_0x2cdd92,_0x38e4cb);_0x2c3c03(_0x38e4cb);});});}exports[_0xf17b('0x1b')]=function(_0x41db4e){var _0x895ebf=this;return new Promise(function(_0x23fca0,_0x4b86a5){return db[_0xf17b('0x1c')][_0xf17b('0x1d')](_0x41db4e[_0xf17b('0x1e')],{'raw':_0x41db4e[_0xf17b('0x1f')]?_0x41db4e['options'][_0xf17b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41db4e[_0xf17b('0x1f')]?_0x41db4e[_0xf17b('0x1f')][_0xf17b('0x21')]||null:null,'attributes':_0x41db4e[_0xf17b('0x1f')]?_0x41db4e[_0xf17b('0x1f')][_0xf17b('0x22')]||null:null,'limit':_0x41db4e[_0xf17b('0x1f')]?_0x41db4e['options'][_0xf17b('0x23')]||null:null})[_0xf17b('0x10')](function(_0x28489f){logger[_0xf17b('0x19')](_0xf17b('0x1b'),_0x41db4e);logger[_0xf17b('0x13')]('UpdateChatInteraction',_0x41db4e,JSON[_0xf17b('0x15')](_0x28489f));_0x23fca0(_0x28489f);})[_0xf17b('0x24')](function(_0x3e6964){logger[_0xf17b('0x16')](_0xf17b('0x1b'),_0x3e6964[_0xf17b('0x18')],_0x41db4e);_0x4b86a5(_0x895ebf['error'](0x1f4,_0x3e6964[_0xf17b('0x18')]));});});};exports[_0xf17b('0x25')]=function(_0x1549e7){return new Promise(function(_0x1459ee,_0x3ea855){return db[_0xf17b('0x1c')]['find']({'where':_0x1549e7['options']?_0x1549e7[_0xf17b('0x1f')][_0xf17b('0x21')]||null:null})[_0xf17b('0x10')](function(_0x30d703){if(_0x30d703){return _0x30d703[_0xf17b('0x26')](_0x1549e7['body'][_0xf17b('0x27')],_[_0xf17b('0x28')](_0x1549e7[_0xf17b('0x1e')],[_0xf17b('0x27'),'id'])||{});}})[_0xf17b('0x29')](function(_0x3a9d3c){logger['info'](_0xf17b('0x2a'),_0x1549e7);logger[_0xf17b('0x13')](_0xf17b('0x2a'),_0x1549e7,JSON[_0xf17b('0x15')](_0x3a9d3c));_0x1459ee(_0x3a9d3c);})[_0xf17b('0x24')](function(_0x1822d3){logger[_0xf17b('0x16')](_0xf17b('0x2a'),_0x1822d3[_0xf17b('0x18')],_0x1549e7);_0x3ea855(_this[_0xf17b('0x16')](0x1f4,_0x1822d3[_0xf17b('0x18')]));});});}; \ No newline at end of file +var _0xc640=['client','http','redis','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateChatInteraction','ChatInteraction','options','raw','where','attributes','limit','AddTagsToChatInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xc640,0xf6));var _0x0c64=function(_0x415ddc,_0x1f832b){_0x415ddc=_0x415ddc-0x0;var _0x1bb3f0=_0xc640[_0x415ddc];return _0x1bb3f0;};'use strict';var _=require(_0x0c64('0x0'));var util=require(_0x0c64('0x1'));var moment=require(_0x0c64('0x2'));var BPromise=require(_0x0c64('0x3'));var rs=require(_0x0c64('0x4'));var fs=require('fs');var Redis=require(_0x0c64('0x5'));var db=require(_0x0c64('0x6'))['db'];var utils=require(_0x0c64('0x7'));var logger=require(_0x0c64('0x8'))(_0x0c64('0x9'));var config=require(_0x0c64('0xa'));var jayson=require(_0x0c64('0xb'));var client=jayson[_0x0c64('0xc')][_0x0c64('0xd')]({'port':0x232a});config[_0x0c64('0xe')]=_['defaults'](config[_0x0c64('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c64('0xf'))(new Redis(config[_0x0c64('0xe')]));require('./chatInteraction.socket')[_0x0c64('0x10')](socket);function respondWithRpcPromise(_0x258c55,_0x4249d5,_0x5a1d17){return new BPromise(function(_0x5d2a4a,_0x3ab5fb){return client[_0x0c64('0x11')](_0x258c55,_0x5a1d17)[_0x0c64('0x12')](function(_0x2f1fb7){logger[_0x0c64('0x13')](_0x0c64('0x14'),_0x4249d5,'request\x20sent');logger[_0x0c64('0x15')](_0x0c64('0x16'),_0x4249d5,'request\x20sent',JSON[_0x0c64('0x17')](_0x2f1fb7));if(_0x2f1fb7['error']){if(_0x2f1fb7[_0x0c64('0x18')]['code']===0x1f4){logger[_0x0c64('0x18')](_0x0c64('0x14'),_0x4249d5,_0x2f1fb7[_0x0c64('0x18')][_0x0c64('0x19')]);return _0x3ab5fb(_0x2f1fb7['error'][_0x0c64('0x19')]);}logger[_0x0c64('0x18')](_0x0c64('0x14'),_0x4249d5,_0x2f1fb7['error'][_0x0c64('0x19')]);return _0x5d2a4a(_0x2f1fb7['error'][_0x0c64('0x19')]);}else{logger[_0x0c64('0x13')](_0x0c64('0x14'),_0x4249d5,_0x0c64('0x1a'));_0x5d2a4a(_0x2f1fb7[_0x0c64('0x1b')]['message']);}})[_0x0c64('0x1c')](function(_0x26f309){logger[_0x0c64('0x18')](_0x0c64('0x14'),_0x4249d5,_0x26f309);_0x3ab5fb(_0x26f309);});});}exports[_0x0c64('0x1d')]=function(_0x189ed9){var _0x5b649c=this;return new Promise(function(_0x4a27d5,_0x336b1a){return db[_0x0c64('0x1e')]['update'](_0x189ed9['body'],{'raw':_0x189ed9[_0x0c64('0x1f')]?_0x189ed9[_0x0c64('0x1f')][_0x0c64('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x189ed9['options']?_0x189ed9[_0x0c64('0x1f')][_0x0c64('0x21')]||null:null,'attributes':_0x189ed9['options']?_0x189ed9[_0x0c64('0x1f')][_0x0c64('0x22')]||null:null,'limit':_0x189ed9['options']?_0x189ed9[_0x0c64('0x1f')][_0x0c64('0x23')]||null:null})[_0x0c64('0x12')](function(_0x16f4b6){logger[_0x0c64('0x13')](_0x0c64('0x1d'),_0x189ed9);logger[_0x0c64('0x15')](_0x0c64('0x1d'),_0x189ed9,JSON[_0x0c64('0x17')](_0x16f4b6));_0x4a27d5(_0x16f4b6);})[_0x0c64('0x1c')](function(_0x475c51){logger[_0x0c64('0x18')](_0x0c64('0x1d'),_0x475c51['message'],_0x189ed9);_0x336b1a(_0x5b649c[_0x0c64('0x18')](0x1f4,_0x475c51[_0x0c64('0x19')]));});});};exports[_0x0c64('0x24')]=function(_0x1cb256){return new Promise(function(_0x2ee14c,_0x5cb48d){return db[_0x0c64('0x1e')]['find']({'where':_0x1cb256[_0x0c64('0x1f')]?_0x1cb256['options']['where']||null:null})['then'](function(_0x1a046a){if(_0x1a046a){return _0x1a046a[_0x0c64('0x25')](_0x1cb256[_0x0c64('0x26')][_0x0c64('0x27')],_[_0x0c64('0x28')](_0x1cb256[_0x0c64('0x26')],['ids','id'])||{});}})[_0x0c64('0x29')](function(_0x4c9828){logger['info'](_0x0c64('0x2a'),_0x1cb256);logger[_0x0c64('0x15')](_0x0c64('0x2a'),_0x1cb256,JSON[_0x0c64('0x17')](_0x4c9828));_0x2ee14c(_0x4c9828);})[_0x0c64('0x1c')](function(_0x310fa6){logger[_0x0c64('0x18')](_0x0c64('0x2a'),_0x310fa6[_0x0c64('0x19')],_0x1cb256);_0x5cb48d(_this[_0x0c64('0x18')](0x1f4,_0x310fa6[_0x0c64('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 42fc06f..d877519 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 _0x4fb6=['remove','update','length'];(function(_0x28016b,_0x1affb6){var _0x13d511=function(_0x1ec008){while(--_0x1ec008){_0x28016b['push'](_0x28016b['shift']());}};_0x13d511(++_0x1affb6);}(_0x4fb6,0x15f));var _0x64fb=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0x4fb6[_0x4697fa];return _0x390950;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x64fb('0x0'),_0x64fb('0x1')];function createListener(_0x18cd78,_0x186470){return function(_0x5e0d28){_0x186470['emit'](_0x18cd78,_0x5e0d28);};}function removeListener(_0x5f45f7,_0x1b04ea){return function(){ChatInteractionEvents['removeListener'](_0x5f45f7,_0x1b04ea);};}exports['register']=function(_0x2588cb){for(var _0x40ac85=0x0,_0x25599c=events[_0x64fb('0x2')];_0x40ac85<_0x25599c;_0x40ac85++){var _0x2e0297=events[_0x40ac85];var _0x1b3ba0=createListener('chatInteraction:'+_0x2e0297,_0x2588cb);ChatInteractionEvents['on'](_0x2e0297,_0x1b3ba0);}}; \ No newline at end of file +var _0x49d6=['update','emit','removeListener','length','chatInteraction:','save'];(function(_0x58c840,_0x33176e){var _0x339a94=function(_0x552426){while(--_0x552426){_0x58c840['push'](_0x58c840['shift']());}};_0x339a94(++_0x33176e);}(_0x49d6,0x12b));var _0x649d=function(_0x38b21a,_0x57aa3f){_0x38b21a=_0x38b21a-0x0;var _0x6ac674=_0x49d6[_0x38b21a];return _0x6ac674;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x649d('0x0'),'remove',_0x649d('0x1')];function createListener(_0x88108f,_0x53aca8){return function(_0x1be0cb){_0x53aca8[_0x649d('0x2')](_0x88108f,_0x1be0cb);};}function removeListener(_0x2dbf51,_0x2b6e1b){return function(){ChatInteractionEvents[_0x649d('0x3')](_0x2dbf51,_0x2b6e1b);};}exports['register']=function(_0x1e46a8){for(var _0x556245=0x0,_0x1d5603=events[_0x649d('0x4')];_0x556245<_0x1d5603;_0x556245++){var _0x33c699=events[_0x556245];var _0x582493=createListener(_0x649d('0x5')+_0x33c699,_0x1e46a8);ChatInteractionEvents['on'](_0x33c699,_0x582493);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a068725..f6770b6 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 _0x420f=['describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','now','originalname','/:id/attachment_upload','single','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe'];(function(_0x3eefec,_0x3dfab2){var _0x1de7b4=function(_0x188817){while(--_0x188817){_0x3eefec['push'](_0x3eefec['shift']());}};_0x1de7b4(++_0x3dfab2);}(_0x420f,0xbb));var _0xf420=function(_0x4cd7bd,_0x33b3e1){_0x4cd7bd=_0x4cd7bd-0x0;var _0x3833b7=_0x420f[_0x4cd7bd];return _0x3833b7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf420('0x0'));var express=require('express');var router=express[_0xf420('0x1')]();var fs_extra=require(_0xf420('0x2'));var auth=require(_0xf420('0x3'));var interaction=require(_0xf420('0x4'));var config=require('../../config/environment');var controller=require(_0xf420('0x5'));router[_0xf420('0x6')]('/',auth[_0xf420('0x7')](),controller['index']);router['get'](_0xf420('0x8'),auth[_0xf420('0x7')](),controller[_0xf420('0x9')]);router[_0xf420('0x6')](_0xf420('0xa'),auth[_0xf420('0xb')](),controller[_0xf420('0xc')]);router[_0xf420('0x6')](_0xf420('0xd'),auth[_0xf420('0xb')](),controller[_0xf420('0xe')]);router[_0xf420('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf420('0xf')]);router[_0xf420('0x6')](_0xf420('0x10'),auth[_0xf420('0xb')](),controller[_0xf420('0x11')]);router[_0xf420('0x6')]('/:id/download',auth[_0xf420('0x7')](),controller[_0xf420('0x12')]);router[_0xf420('0x13')]('/',auth['isAuthenticated'](),controller[_0xf420('0x14')]);router[_0xf420('0x13')](_0xf420('0x15'),auth['isAuthenticated'](),controller[_0xf420('0x16')]);var upload=multer({'storage':multer[_0xf420('0x17')]({'destination':function(_0x1cb842,_0x534eb1,_0x3f9d9f){_0x3f9d9f(null,path['join'](config[_0xf420('0x18')],_0xf420('0x19')));},'filename':function(_0x493e3e,_0x5dc7fb,_0x88a946){_0x88a946(null,util['format']('%s-%s',Date[_0xf420('0x1a')](),_0x5dc7fb[_0xf420('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf420('0x13')](_0xf420('0x1c'),upload[_0xf420('0x1d')]('file'),controller[_0xf420('0x1e')]);router[_0xf420('0x13')](_0xf420('0x1f'),auth[_0xf420('0xb')](),controller[_0xf420('0x20')]);router[_0xf420('0x13')]('/:id/tags',auth[_0xf420('0x7')](),interaction[_0xf420('0x21')](_0xf420('0x22'),_0xf420('0x23')),controller[_0xf420('0x24')]);router[_0xf420('0x25')](_0xf420('0xa'),auth[_0xf420('0x7')](),interaction[_0xf420('0x21')](_0xf420('0x22'),'chatinteraction:update'),controller[_0xf420('0x26')]);router['put'](_0xf420('0x27'),controller['customUpdate']);router[_0xf420('0x25')](_0xf420('0x28'),auth[_0xf420('0xb')](),controller[_0xf420('0x29')]);router['put'](_0xf420('0x2a'),controller['close']);router['delete'](_0xf420('0xa'),auth[_0xf420('0x7')](),interaction['tracked'](_0xf420('0x22'),_0xf420('0x2b')),controller[_0xf420('0x2c')]);router[_0xf420('0x2d')](_0xf420('0x2e'),auth[_0xf420('0x7')](),controller[_0xf420('0x2f')]);module[_0xf420('0x30')]=router; \ No newline at end of file +var _0x7005=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','/:id/messages','addMessage','tracked','chatinteraction:addtags','addTags','put','chat','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7005,0x15d));var _0x5700=function(_0x651dd,_0x3e3f31){_0x651dd=_0x651dd-0x0;var _0x17ddfe=_0x7005[_0x651dd];return _0x17ddfe;};'use strict';var multer=require('multer');var util=require(_0x5700('0x0'));var path=require(_0x5700('0x1'));var timeout=require(_0x5700('0x2'));var express=require(_0x5700('0x3'));var router=express[_0x5700('0x4')]();var fs_extra=require(_0x5700('0x5'));var auth=require(_0x5700('0x6'));var interaction=require(_0x5700('0x7'));var config=require('../../config/environment');var controller=require(_0x5700('0x8'));router['get']('/',auth[_0x5700('0x9')](),controller[_0x5700('0xa')]);router[_0x5700('0xb')](_0x5700('0xc'),auth[_0x5700('0x9')](),controller['describe']);router[_0x5700('0xb')](_0x5700('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x5700('0xe')]);router[_0x5700('0xb')](_0x5700('0xf'),auth[_0x5700('0x10')](),controller['attachmentDownload']);router[_0x5700('0xb')]('/:id/messages',auth[_0x5700('0x9')](),controller[_0x5700('0x11')]);router[_0x5700('0xb')](_0x5700('0x12'),auth[_0x5700('0x10')](),controller[_0x5700('0x13')]);router[_0x5700('0xb')](_0x5700('0x14'),auth[_0x5700('0x9')](),controller['download']);router[_0x5700('0x15')]('/',auth[_0x5700('0x9')](),controller[_0x5700('0x16')]);router['post'](_0x5700('0x17'),auth[_0x5700('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x5700('0x18')]({'destination':function(_0x4409e9,_0x1b3ab5,_0x52928d){_0x52928d(null,path['join'](config[_0x5700('0x19')],_0x5700('0x1a')));},'filename':function(_0x27083a,_0x2011e2,_0x4ee61b){_0x4ee61b(null,util[_0x5700('0x1b')](_0x5700('0x1c'),Date[_0x5700('0x1d')](),_0x2011e2[_0x5700('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5700('0x15')](_0x5700('0x1f'),upload['single']('file'),controller['attachmentUpload']);router[_0x5700('0x15')](_0x5700('0x20'),auth[_0x5700('0x10')](),controller[_0x5700('0x21')]);router[_0x5700('0x15')]('/:id/tags',auth[_0x5700('0x9')](),interaction[_0x5700('0x22')]('chat',_0x5700('0x23')),controller[_0x5700('0x24')]);router[_0x5700('0x25')]('/:id',auth[_0x5700('0x9')](),interaction[_0x5700('0x22')](_0x5700('0x26'),'chatinteraction:update'),controller[_0x5700('0x27')]);router[_0x5700('0x25')](_0x5700('0x28'),controller[_0x5700('0x29')]);router[_0x5700('0x25')](_0x5700('0x2a'),auth['isChatInteractionAuthorized'](),controller[_0x5700('0x2b')]);router[_0x5700('0x25')](_0x5700('0x2c'),controller['close']);router[_0x5700('0x2d')](_0x5700('0xd'),auth['isAuthenticated'](),interaction[_0x5700('0x22')](_0x5700('0x26'),_0x5700('0x2e')),controller[_0x5700('0x2f')]);router['delete'](_0x5700('0x30'),auth[_0x5700('0x9')](),controller['removeTags']);module[_0x5700('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 51132b0..b08e07c 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 _0xcbf0=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x55f562,_0x3f96c4){var _0x55922b=function(_0x246460){while(--_0x246460){_0x55f562['push'](_0x55f562['shift']());}};_0x55922b(++_0x3f96c4);}(_0xcbf0,0x12e));var _0x0cbf=function(_0x4ae340,_0x459aaa){_0x4ae340=_0x4ae340-0x0;var _0xfa456=_0xcbf0[_0x4ae340];return _0xfa456;};'use strict';var Sequelize=require(_0x0cbf('0x0'));module[_0x0cbf('0x1')]={'body':{'type':Sequelize[_0x0cbf('0x2')](_0x0cbf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0cbf('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x0cbf('0x5')]}}; \ No newline at end of file +var _0x7ab4=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x7ab4,0x10c));var _0x47ab=function(_0x52cbe0,_0x332b2e){_0x52cbe0=_0x52cbe0-0x0;var _0x4bb9da=_0x7ab4[_0x52cbe0];return _0x4bb9da;};'use strict';var Sequelize=require(_0x47ab('0x0'));module[_0x47ab('0x1')]={'body':{'type':Sequelize[_0x47ab('0x2')](_0x47ab('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x47ab('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47ab('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 23c6c8d..8bd446c 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 _0x341f=['createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','push','messages','ToId','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','then','includeAll','include','rows','catch','show','options','find','create','body','params','describe','get','lastMessageAt'];(function(_0x25d4ab,_0x307164){var _0x3b31f3=function(_0x12f56c){while(--_0x12f56c){_0x25d4ab['push'](_0x25d4ab['shift']());}};_0x3b31f3(++_0x307164);}(_0x341f,0xf5));var _0xf341=function(_0x2e2056,_0x2e55a0){_0x2e2056=_0x2e2056-0x0;var _0x235b7a=_0x341f[_0x2e2056];return _0x235b7a;};'use strict';var emlformat=require(_0xf341('0x0'));var rimraf=require(_0xf341('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf341('0x2'));var rp=require(_0xf341('0x3'));var moment=require(_0xf341('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf341('0x5'));var csv=require('to-csv');var ejs=require(_0xf341('0x6'));var fs=require('fs');var fs_extra=require(_0xf341('0x7'));var _=require(_0xf341('0x8'));var squel=require(_0xf341('0x9'));var crypto=require(_0xf341('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf341('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf341('0xc'));var Papa=require(_0xf341('0xd'));var Redis=require(_0xf341('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf341('0xf'));var as=require(_0xf341('0x10'));var hardwareService=require(_0xf341('0x11'));var logger=require(_0xf341('0x12'))(_0xf341('0x13'));var utils=require(_0xf341('0x14'));var config=require(_0xf341('0x15'));var licenseUtil=require(_0xf341('0x16'));var db=require(_0xf341('0x17'))['db'];config['redis']=_[_0xf341('0x18')](config[_0xf341('0x19')],{'host':_0xf341('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf341('0x19')]));require(_0xf341('0x1b'))[_0xf341('0x1c')](socket);function respondWithStatusCode(_0x2d244a,_0x124fa8){_0x124fa8=_0x124fa8||0xcc;return function(_0x4991de){if(_0x4991de){return _0x2d244a[_0xf341('0x1d')](_0x124fa8);}return _0x2d244a[_0xf341('0x1e')](_0x124fa8)[_0xf341('0x1f')]();};}function respondWithResult(_0x154018,_0x4ae94c){_0x4ae94c=_0x4ae94c||0xc8;return function(_0x360616){if(_0x360616){return _0x154018[_0xf341('0x1e')](_0x4ae94c)[_0xf341('0x20')](_0x360616);}};}function respondWithFilteredResult(_0x2ff88e,_0x47d2ef){return function(_0x1d2832){if(_0x1d2832){var _0x26e3a1=typeof _0x47d2ef[_0xf341('0x21')]===_0xf341('0x22')&&typeof _0x47d2ef[_0xf341('0x23')]==='undefined';var _0x4d6757=_0x1d2832['count'];var _0x442ceb=_0x26e3a1?0x0:_0x47d2ef[_0xf341('0x21')];var _0x909f85=_0x26e3a1?_0x1d2832['count']:_0x47d2ef[_0xf341('0x21')]+_0x47d2ef[_0xf341('0x23')];var _0xc4ec7;if(_0x909f85>=_0x4d6757){_0x909f85=_0x4d6757;_0xc4ec7=0xc8;}else{_0xc4ec7=0xce;}_0x2ff88e[_0xf341('0x1e')](_0xc4ec7);return _0x2ff88e['set'](_0xf341('0x24'),_0x442ceb+'-'+_0x909f85+'/'+_0x4d6757)[_0xf341('0x20')](_0x1d2832);}return null;};}function patchUpdates(_0x7b1731){return function(_0x1b640c){try{jsonpatch[_0xf341('0x25')](_0x1b640c,_0x7b1731,!![]);}catch(_0x2f4566){return BPromise['reject'](_0x2f4566);}return _0x1b640c[_0xf341('0x26')]();};}function saveUpdates(_0x5b4f30,_0x46c4fc){return function(_0x1f3b08){if(_0x1f3b08){return _0x1f3b08[_0xf341('0x27')](_0x5b4f30)['then'](function(_0x5490a2){return _0x5490a2;});}return null;};}function removeEntity(_0x3fa14b,_0x12e5bf){return function(_0x4d4903){if(_0x4d4903){return _0x4d4903[_0xf341('0x28')]()['then'](function(){_0x3fa14b[_0xf341('0x1e')](0xcc)[_0xf341('0x1f')]();});}};}function handleEntityNotFound(_0x268575,_0x47245a){return function(_0x5c6ce1){if(!_0x5c6ce1){_0x268575[_0xf341('0x1d')](0x194);}return _0x5c6ce1;};}function handleError(_0x38c835,_0x4ff47f){_0x4ff47f=_0x4ff47f||0x1f4;return function(_0x3c65b6){logger[_0xf341('0x29')](_0x3c65b6[_0xf341('0x2a')]);if(_0x3c65b6['name']){delete _0x3c65b6[_0xf341('0x2b')];}_0x38c835[_0xf341('0x1e')](_0x4ff47f)[_0xf341('0x2c')](_0x3c65b6);};}exports[_0xf341('0x2d')]=function(_0x2b3a48,_0x3fdbec){var _0x2037b5={},_0x39bdb4={},_0x50509c={'count':0x0,'rows':[]};var _0xc91abb=_[_0xf341('0x2e')](db[_0xf341('0x2f')][_0xf341('0x30')],function(_0x53d02f){return{'name':_0x53d02f[_0xf341('0x31')],'type':_0x53d02f[_0xf341('0x32')][_0xf341('0x33')]};});_0x39bdb4[_0xf341('0x34')]=_[_0xf341('0x2e')](_0xc91abb,'name');_0x39bdb4[_0xf341('0x35')]=_[_0xf341('0x36')](_0x2b3a48['query']);_0x39bdb4[_0xf341('0x37')]=_[_0xf341('0x38')](_0x39bdb4[_0xf341('0x34')],_0x39bdb4[_0xf341('0x35')]);_0x2037b5['attributes']=_[_0xf341('0x38')](_0x39bdb4[_0xf341('0x34')],qs[_0xf341('0x39')](_0x2b3a48[_0xf341('0x35')][_0xf341('0x39')]));_0x2037b5[_0xf341('0x3a')]=_0x2037b5[_0xf341('0x3a')]['length']?_0x2037b5['attributes']:_0x39bdb4['model'];if(!_0x2b3a48[_0xf341('0x35')][_0xf341('0x3b')](_0xf341('0x3c'))){_0x2037b5[_0xf341('0x23')]=qs['limit'](_0x2b3a48['query'][_0xf341('0x23')]);_0x2037b5[_0xf341('0x21')]=qs['offset'](_0x2b3a48[_0xf341('0x35')][_0xf341('0x21')]);}_0x2037b5[_0xf341('0x3d')]=qs[_0xf341('0x3e')](_0x2b3a48[_0xf341('0x35')]['sort']);_0x2037b5[_0xf341('0x3f')]=qs['filters'](_[_0xf341('0x40')](_0x2b3a48[_0xf341('0x35')],_0x39bdb4['filters']),_0xc91abb);if(_0x2b3a48['query'][_0xf341('0x41')]){_0x2037b5[_0xf341('0x3f')]=_[_0xf341('0x42')](_0x2037b5[_0xf341('0x3f')],{'$or':_[_0xf341('0x2e')](_0xc91abb,function(_0xd4e5e9){if(_0xd4e5e9[_0xf341('0x32')]!=='VIRTUAL'){var _0x24e036={};_0x24e036[_0xd4e5e9[_0xf341('0x2b')]]={'$like':'%'+_0x2b3a48[_0xf341('0x35')][_0xf341('0x41')]+'%'};return _0x24e036;}})});}_0x2037b5=_[_0xf341('0x42')]({},_0x2037b5,_0x2b3a48['options']);var _0x3d943e={'where':_0x2037b5['where']};return db[_0xf341('0x2f')][_0xf341('0x43')](_0x3d943e)[_0xf341('0x44')](function(_0x44c8a3){_0x50509c[_0xf341('0x43')]=_0x44c8a3;if(_0x2b3a48[_0xf341('0x35')][_0xf341('0x45')]){_0x2037b5[_0xf341('0x46')]=[{'all':!![]}];}return db[_0xf341('0x2f')]['findAll'](_0x2037b5);})[_0xf341('0x44')](function(_0x46e5d6){_0x50509c[_0xf341('0x47')]=_0x46e5d6;return _0x50509c;})[_0xf341('0x44')](respondWithFilteredResult(_0x3fdbec,_0x2037b5))[_0xf341('0x48')](handleError(_0x3fdbec,null));};exports[_0xf341('0x49')]=function(_0x275a2c,_0x5c7df7){var _0x4d109a={'raw':!![],'where':{'id':_0x275a2c['params']['id']}},_0x49b93c={};_0x49b93c[_0xf341('0x34')]=_[_0xf341('0x36')](db['ChatInternalMessage'][_0xf341('0x30')]);_0x49b93c[_0xf341('0x35')]=_[_0xf341('0x36')](_0x275a2c[_0xf341('0x35')]);_0x49b93c['filters']=_['intersection'](_0x49b93c[_0xf341('0x34')],_0x49b93c[_0xf341('0x35')]);_0x4d109a[_0xf341('0x3a')]=_[_0xf341('0x38')](_0x49b93c['model'],qs[_0xf341('0x39')](_0x275a2c[_0xf341('0x35')]['fields']));_0x4d109a['attributes']=_0x4d109a[_0xf341('0x3a')]['length']?_0x4d109a['attributes']:_0x49b93c[_0xf341('0x34')];if(_0x275a2c[_0xf341('0x35')][_0xf341('0x45')]){_0x4d109a[_0xf341('0x46')]=[{'all':!![]}];}_0x4d109a=_[_0xf341('0x42')]({},_0x4d109a,_0x275a2c[_0xf341('0x4a')]);return db[_0xf341('0x2f')][_0xf341('0x4b')](_0x4d109a)[_0xf341('0x44')](handleEntityNotFound(_0x5c7df7,null))[_0xf341('0x44')](respondWithResult(_0x5c7df7,null))[_0xf341('0x48')](handleError(_0x5c7df7,null));};exports[_0xf341('0x4c')]=function(_0x4e8254,_0x47792b){return db[_0xf341('0x2f')]['create'](_0x4e8254[_0xf341('0x4d')],{})['then'](respondWithResult(_0x47792b,0xc9))[_0xf341('0x48')](handleError(_0x47792b,null));};exports['update']=function(_0x538a3d,_0x37e83a){if(_0x538a3d[_0xf341('0x4d')]['id']){delete _0x538a3d['body']['id'];}return db['ChatInternalMessage'][_0xf341('0x4b')]({'where':{'id':_0x538a3d['params']['id']}})['then'](handleEntityNotFound(_0x37e83a,null))[_0xf341('0x44')](saveUpdates(_0x538a3d[_0xf341('0x4d')],null))['then'](respondWithResult(_0x37e83a,null))[_0xf341('0x48')](handleError(_0x37e83a,null));};exports[_0xf341('0x28')]=function(_0x2a6460,_0x3735d4){return db[_0xf341('0x2f')][_0xf341('0x4b')]({'where':{'id':_0x2a6460[_0xf341('0x4e')]['id']}})[_0xf341('0x44')](handleEntityNotFound(_0x3735d4,null))[_0xf341('0x44')](removeEntity(_0x3735d4,null))[_0xf341('0x48')](handleError(_0x3735d4,null));};exports[_0xf341('0x4f')]=function(_0x53efd0,_0x30f58e){return db[_0xf341('0x2f')][_0xf341('0x4f')]()[_0xf341('0x44')](respondWithResult(_0x30f58e,null))[_0xf341('0x48')](handleError(_0x30f58e,null));};function wrapUser(_0x3d9da3){return function(_0x2df7cf){var _0x3066fa=_0x3d9da3[_0xf341('0x50')]({'plain':!![]});_0x3066fa['messages']=[];if(_0x2df7cf){_0x3066fa[_0xf341('0x51')]=_0x2df7cf[_0xf341('0x52')];_0x3066fa[_0xf341('0x53')]=_0x2df7cf;}else{_0x3066fa[_0xf341('0x51')]=moment(0x0)[_0xf341('0x54')](_0xf341('0x55'));_0x3066fa['lastMessage']={};}return _0x3066fa;};}exports['getUsers']=function(_0x25ed74,_0x410aaf,_0x3ccbdb){var _0x164987=[];return db[_0xf341('0x56')][_0xf341('0x57')]({'where':{'role':[_0xf341('0x58'),_0xf341('0x59'),'user']},'attributes':['id',_0xf341('0x5a'),_0xf341('0x2b'),_0xf341('0x5b'),'userpic',_0xf341('0x5c'),'online',_0xf341('0x5d'),_0xf341('0x5e'),_0xf341('0x5f')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xf341('0x60'),'attributes':['id',_0xf341('0x2b'),_0xf341('0x32')],'through':{'attributes':[]}}]})[_0xf341('0x44')](function(_0x55eda7){if(_0x55eda7){var _0x319be2=_0x25ed74[_0xf341('0x61')][_0xf341('0x50')]({'plain':!![]});if(!_0x319be2)throw new Error(_0xf341('0x62'));if(_0x319be2[_0xf341('0x5b')]===_0xf341('0x61')){return db['UserProfileSection'][_0xf341('0x4b')]({'where':{'name':'Agents','userProfileId':_0x319be2[_0xf341('0x63')]},'raw':!![]})['then'](function(_0x4f9b30){if(_0x4f9b30){if(_0x4f9b30[_0xf341('0x64')]===0x0){return db[_0xf341('0x65')][_0xf341('0x57')]({'where':{'sectionId':_0x4f9b30['id']},'raw':!![]})['then'](function(_0x5bfd26){var _0x413f87=[];if(_[_0xf341('0x66')](_0x5bfd26)){_0x413f87=_[_0xf341('0x41')](_0x55eda7,function(_0x1f1f20){if(_0x1f1f20['role']!==_0xf341('0x58')){return _0x1f1f20;}});return _0x413f87;}else{for(var _0x192c69=0x0;_0x192c69<_0x55eda7[_0xf341('0x67')];_0x192c69++){var _0x13ba0c=_0x55eda7[_0x192c69];if(_0x13ba0c[_0xf341('0x5b')]==='agent'){var _0x14b84b=_['find'](_0x5bfd26,function(_0x45edea){return _0x45edea['resourceId']===_0x13ba0c['id'];});if(_0x14b84b)_0x413f87[_0xf341('0x68')](_0x13ba0c);}else{_0x413f87['push'](_0x13ba0c);}}return _0x413f87;}});}else{return _0x55eda7;}}else{var _0x7bb594=_[_0xf341('0x41')](_0x55eda7,function(_0x5d8340){if(_0x5d8340[_0xf341('0x5b')]!==_0xf341('0x58')){return _0x5d8340;}});return _0x7bb594;}});}else{return _0x55eda7;}}})['then'](function(_0x26d95f){var _0x2dc6d2=[];if(_0x26d95f){_0x164987=_0x26d95f;for(var _0x2c4e78=0x0;_0x2c4e78<_0x26d95f[_0xf341('0x67')];_0x2c4e78+=0x1){_0x164987[_0x2c4e78][_0xf341('0x69')]=[];_0x2dc6d2[_0xf341('0x68')](db[_0xf341('0x2f')][_0xf341('0x4b')]({'where':{'FromId':[_0x25ed74['user']['id'],_0x26d95f[_0x2c4e78]['id']],'ToId':[_0x25ed74[_0xf341('0x61')]['id'],_0x26d95f[_0x2c4e78]['id']],'ChatGroupId':null},'attributes':['id',_0xf341('0x52'),'FromId',_0xf341('0x6a'),'read',_0xf341('0x4d')],'order':qs['sort'](_0xf341('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf341('0x44')](wrapUser(_0x26d95f[_0x2c4e78])));}return BPromise[_0xf341('0x6c')](_0x2dc6d2);}return[];})[_0xf341('0x44')](function(_0x348e21){return{'rows':_0x348e21,'count':_0x348e21[_0xf341('0x67')]};})[_0xf341('0x44')](respondWithResult(_0x410aaf,null))[_0xf341('0x48')](handleError(_0x410aaf,null));}; \ No newline at end of file +var _0x5d05=['map','ChatInternalMessage','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','params','keys','options','catch','body','find','describe','get','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','userpic','internal','online','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','isEmpty','length','resourceId','push','messages','createdAt','FromId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','end','sendStatus','stack','name'];(function(_0x163439,_0x6885ca){var _0x552333=function(_0x31ed5e){while(--_0x31ed5e){_0x163439['push'](_0x163439['shift']());}};_0x552333(++_0x6885ca);}(_0x5d05,0x179));var _0x55d0=function(_0x40bad6,_0x1a5dc8){_0x40bad6=_0x40bad6-0x0;var _0xdfd3f2=_0x5d05[_0x40bad6];return _0xdfd3f2;};'use strict';var emlformat=require(_0x55d0('0x0'));var rimraf=require(_0x55d0('0x1'));var zipdir=require(_0x55d0('0x2'));var jsonpatch=require(_0x55d0('0x3'));var rp=require(_0x55d0('0x4'));var moment=require('moment');var BPromise=require(_0x55d0('0x5'));var Mustache=require('mustache');var util=require(_0x55d0('0x6'));var path=require(_0x55d0('0x7'));var sox=require(_0x55d0('0x8'));var csv=require(_0x55d0('0x9'));var ejs=require(_0x55d0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55d0('0xb'));var squel=require(_0x55d0('0xc'));var crypto=require(_0x55d0('0xd'));var jsforce=require(_0x55d0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x55d0('0x9'));var querystring=require(_0x55d0('0xf'));var Papa=require(_0x55d0('0x10'));var Redis=require(_0x55d0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x55d0('0x12'));var as=require(_0x55d0('0x13'));var hardwareService=require(_0x55d0('0x14'));var logger=require(_0x55d0('0x15'))(_0x55d0('0x16'));var utils=require(_0x55d0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x55d0('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x55d0('0x19'))(new Redis(config[_0x55d0('0x18')]));require(_0x55d0('0x1a'))[_0x55d0('0x1b')](socket);function respondWithStatusCode(_0x3cb5ea,_0x283c17){_0x283c17=_0x283c17||0xcc;return function(_0x51b350){if(_0x51b350){return _0x3cb5ea['sendStatus'](_0x283c17);}return _0x3cb5ea[_0x55d0('0x1c')](_0x283c17)['end']();};}function respondWithResult(_0x401453,_0x561cdc){_0x561cdc=_0x561cdc||0xc8;return function(_0x25d76b){if(_0x25d76b){return _0x401453['status'](_0x561cdc)[_0x55d0('0x1d')](_0x25d76b);}};}function respondWithFilteredResult(_0x372168,_0xdee8e9){return function(_0x458e93){if(_0x458e93){var _0x7f3494=typeof _0xdee8e9[_0x55d0('0x1e')]===_0x55d0('0x1f')&&typeof _0xdee8e9[_0x55d0('0x20')]==='undefined';var _0x485ed9=_0x458e93[_0x55d0('0x21')];var _0x26cf9f=_0x7f3494?0x0:_0xdee8e9[_0x55d0('0x1e')];var _0x1bb321=_0x7f3494?_0x458e93[_0x55d0('0x21')]:_0xdee8e9[_0x55d0('0x1e')]+_0xdee8e9[_0x55d0('0x20')];var _0x4ab214;if(_0x1bb321>=_0x485ed9){_0x1bb321=_0x485ed9;_0x4ab214=0xc8;}else{_0x4ab214=0xce;}_0x372168[_0x55d0('0x1c')](_0x4ab214);return _0x372168[_0x55d0('0x22')](_0x55d0('0x23'),_0x26cf9f+'-'+_0x1bb321+'/'+_0x485ed9)[_0x55d0('0x1d')](_0x458e93);}return null;};}function patchUpdates(_0x1dd142){return function(_0x496bc8){try{jsonpatch[_0x55d0('0x24')](_0x496bc8,_0x1dd142,!![]);}catch(_0x4246d6){return BPromise[_0x55d0('0x25')](_0x4246d6);}return _0x496bc8['save']();};}function saveUpdates(_0x5ed6bc,_0x262a6b){return function(_0xd92ff5){if(_0xd92ff5){return _0xd92ff5[_0x55d0('0x26')](_0x5ed6bc)['then'](function(_0x383a78){return _0x383a78;});}return null;};}function removeEntity(_0x9342d3,_0x12745b){return function(_0x397448){if(_0x397448){return _0x397448['destroy']()['then'](function(){_0x9342d3[_0x55d0('0x1c')](0xcc)[_0x55d0('0x27')]();});}};}function handleEntityNotFound(_0xfa940f,_0x38da26){return function(_0x599f8d){if(!_0x599f8d){_0xfa940f[_0x55d0('0x28')](0x194);}return _0x599f8d;};}function handleError(_0xf0aac6,_0x95f966){_0x95f966=_0x95f966||0x1f4;return function(_0x55075f){logger['error'](_0x55075f[_0x55d0('0x29')]);if(_0x55075f[_0x55d0('0x2a')]){delete _0x55075f['name'];}_0xf0aac6['status'](_0x95f966)['send'](_0x55075f);};}exports['index']=function(_0x3aedb3,_0x2b9ed5){var _0x4c6528={},_0x42874d={},_0x40f3fe={'count':0x0,'rows':[]};var _0x176534=_[_0x55d0('0x2b')](db[_0x55d0('0x2c')][_0x55d0('0x2d')],function(_0xbf64a1){return{'name':_0xbf64a1['fieldName'],'type':_0xbf64a1[_0x55d0('0x2e')]['key']};});_0x42874d[_0x55d0('0x2f')]=_['map'](_0x176534,'name');_0x42874d[_0x55d0('0x30')]=_['keys'](_0x3aedb3['query']);_0x42874d[_0x55d0('0x31')]=_[_0x55d0('0x32')](_0x42874d[_0x55d0('0x2f')],_0x42874d[_0x55d0('0x30')]);_0x4c6528['attributes']=_[_0x55d0('0x32')](_0x42874d[_0x55d0('0x2f')],qs[_0x55d0('0x33')](_0x3aedb3[_0x55d0('0x30')][_0x55d0('0x33')]));_0x4c6528['attributes']=_0x4c6528[_0x55d0('0x34')]['length']?_0x4c6528['attributes']:_0x42874d[_0x55d0('0x2f')];if(!_0x3aedb3[_0x55d0('0x30')][_0x55d0('0x35')](_0x55d0('0x36'))){_0x4c6528[_0x55d0('0x20')]=qs[_0x55d0('0x20')](_0x3aedb3['query'][_0x55d0('0x20')]);_0x4c6528[_0x55d0('0x1e')]=qs[_0x55d0('0x1e')](_0x3aedb3['query'][_0x55d0('0x1e')]);}_0x4c6528[_0x55d0('0x37')]=qs[_0x55d0('0x38')](_0x3aedb3['query'][_0x55d0('0x38')]);_0x4c6528[_0x55d0('0x39')]=qs[_0x55d0('0x31')](_[_0x55d0('0x3a')](_0x3aedb3['query'],_0x42874d[_0x55d0('0x31')]),_0x176534);if(_0x3aedb3['query'][_0x55d0('0x3b')]){_0x4c6528[_0x55d0('0x39')]=_[_0x55d0('0x3c')](_0x4c6528[_0x55d0('0x39')],{'$or':_['map'](_0x176534,function(_0x1e4407){if(_0x1e4407[_0x55d0('0x2e')]!==_0x55d0('0x3d')){var _0x388cab={};_0x388cab[_0x1e4407['name']]={'$like':'%'+_0x3aedb3[_0x55d0('0x30')][_0x55d0('0x3b')]+'%'};return _0x388cab;}})});}_0x4c6528=_[_0x55d0('0x3c')]({},_0x4c6528,_0x3aedb3['options']);var _0x212c2d={'where':_0x4c6528[_0x55d0('0x39')]};return db['ChatInternalMessage']['count'](_0x212c2d)[_0x55d0('0x3e')](function(_0x47f78d){_0x40f3fe['count']=_0x47f78d;if(_0x3aedb3[_0x55d0('0x30')][_0x55d0('0x3f')]){_0x4c6528[_0x55d0('0x40')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x55d0('0x41')](_0x4c6528);})[_0x55d0('0x3e')](function(_0x53a50b){_0x40f3fe[_0x55d0('0x42')]=_0x53a50b;return _0x40f3fe;})[_0x55d0('0x3e')](respondWithFilteredResult(_0x2b9ed5,_0x4c6528))['catch'](handleError(_0x2b9ed5,null));};exports[_0x55d0('0x43')]=function(_0xa14588,_0x5e9782){var _0x5da37f={'raw':!![],'where':{'id':_0xa14588[_0x55d0('0x44')]['id']}},_0x1d928d={};_0x1d928d['model']=_[_0x55d0('0x45')](db[_0x55d0('0x2c')][_0x55d0('0x2d')]);_0x1d928d[_0x55d0('0x30')]=_['keys'](_0xa14588[_0x55d0('0x30')]);_0x1d928d[_0x55d0('0x31')]=_[_0x55d0('0x32')](_0x1d928d[_0x55d0('0x2f')],_0x1d928d[_0x55d0('0x30')]);_0x5da37f[_0x55d0('0x34')]=_[_0x55d0('0x32')](_0x1d928d['model'],qs['fields'](_0xa14588[_0x55d0('0x30')][_0x55d0('0x33')]));_0x5da37f[_0x55d0('0x34')]=_0x5da37f[_0x55d0('0x34')]['length']?_0x5da37f[_0x55d0('0x34')]:_0x1d928d[_0x55d0('0x2f')];if(_0xa14588['query'][_0x55d0('0x3f')]){_0x5da37f[_0x55d0('0x40')]=[{'all':!![]}];}_0x5da37f=_[_0x55d0('0x3c')]({},_0x5da37f,_0xa14588[_0x55d0('0x46')]);return db[_0x55d0('0x2c')]['find'](_0x5da37f)['then'](handleEntityNotFound(_0x5e9782,null))[_0x55d0('0x3e')](respondWithResult(_0x5e9782,null))[_0x55d0('0x47')](handleError(_0x5e9782,null));};exports['create']=function(_0x8676a9,_0x3b72ce){return db[_0x55d0('0x2c')]['create'](_0x8676a9[_0x55d0('0x48')],{})['then'](respondWithResult(_0x3b72ce,0xc9))[_0x55d0('0x47')](handleError(_0x3b72ce,null));};exports['update']=function(_0x47cdc1,_0x519d0b){if(_0x47cdc1[_0x55d0('0x48')]['id']){delete _0x47cdc1['body']['id'];}return db[_0x55d0('0x2c')][_0x55d0('0x49')]({'where':{'id':_0x47cdc1[_0x55d0('0x44')]['id']}})[_0x55d0('0x3e')](handleEntityNotFound(_0x519d0b,null))['then'](saveUpdates(_0x47cdc1[_0x55d0('0x48')],null))['then'](respondWithResult(_0x519d0b,null))[_0x55d0('0x47')](handleError(_0x519d0b,null));};exports['destroy']=function(_0x1a57a5,_0xad2079){return db['ChatInternalMessage'][_0x55d0('0x49')]({'where':{'id':_0x1a57a5[_0x55d0('0x44')]['id']}})['then'](handleEntityNotFound(_0xad2079,null))[_0x55d0('0x3e')](removeEntity(_0xad2079,null))[_0x55d0('0x47')](handleError(_0xad2079,null));};exports[_0x55d0('0x4a')]=function(_0x11878a,_0x3348b1){return db[_0x55d0('0x2c')][_0x55d0('0x4a')]()['then'](respondWithResult(_0x3348b1,null))['catch'](handleError(_0x3348b1,null));};function wrapUser(_0x53b3c9){return function(_0x37c120){var _0x3b4391=_0x53b3c9[_0x55d0('0x4b')]({'plain':!![]});_0x3b4391['messages']=[];if(_0x37c120){_0x3b4391[_0x55d0('0x4c')]=_0x37c120['createdAt'];_0x3b4391['lastMessage']=_0x37c120;}else{_0x3b4391[_0x55d0('0x4c')]=moment(0x0)[_0x55d0('0x4d')](_0x55d0('0x4e'));_0x3b4391[_0x55d0('0x4f')]={};}return _0x3b4391;};}exports['getUsers']=function(_0x40256a,_0x1bcc2b,_0x11b50f){var _0x198be4=[];return db[_0x55d0('0x50')][_0x55d0('0x41')]({'where':{'role':[_0x55d0('0x51'),_0x55d0('0x52'),_0x55d0('0x53')]},'attributes':['id','fullname',_0x55d0('0x2a'),'role',_0x55d0('0x54'),_0x55d0('0x55'),_0x55d0('0x56'),'lastLoginAt',_0x55d0('0x57'),_0x55d0('0x58')],'order':qs[_0x55d0('0x38')]('-online'),'include':[{'model':db[_0x55d0('0x59')],'as':_0x55d0('0x5a'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x55d0('0x3e')](function(_0x13f8b4){if(_0x13f8b4){var _0x438772=_0x40256a[_0x55d0('0x53')]['get']({'plain':!![]});if(!_0x438772)throw new Error(_0x55d0('0x5b'));if(_0x438772[_0x55d0('0x5c')]==='user'){return db[_0x55d0('0x5d')]['find']({'where':{'name':_0x55d0('0x5e'),'userProfileId':_0x438772[_0x55d0('0x5f')]},'raw':!![]})['then'](function(_0x307a07){if(_0x307a07){if(_0x307a07['autoAssociation']===0x0){return db['UserProfileResource'][_0x55d0('0x41')]({'where':{'sectionId':_0x307a07['id']},'raw':!![]})[_0x55d0('0x3e')](function(_0x2d1423){var _0x24add5=[];if(_[_0x55d0('0x60')](_0x2d1423)){_0x24add5=_[_0x55d0('0x3b')](_0x13f8b4,function(_0x45f0cf){if(_0x45f0cf[_0x55d0('0x5c')]!==_0x55d0('0x51')){return _0x45f0cf;}});return _0x24add5;}else{for(var _0x5689d2=0x0;_0x5689d2<_0x13f8b4[_0x55d0('0x61')];_0x5689d2++){var _0x4eff43=_0x13f8b4[_0x5689d2];if(_0x4eff43['role']===_0x55d0('0x51')){var _0x412e31=_[_0x55d0('0x49')](_0x2d1423,function(_0x33fe2a){return _0x33fe2a[_0x55d0('0x62')]===_0x4eff43['id'];});if(_0x412e31)_0x24add5[_0x55d0('0x63')](_0x4eff43);}else{_0x24add5[_0x55d0('0x63')](_0x4eff43);}}return _0x24add5;}});}else{return _0x13f8b4;}}else{var _0xbe9a2c=_[_0x55d0('0x3b')](_0x13f8b4,function(_0x551b3d){if(_0x551b3d[_0x55d0('0x5c')]!=='agent'){return _0x551b3d;}});return _0xbe9a2c;}});}else{return _0x13f8b4;}}})[_0x55d0('0x3e')](function(_0x2ea35a){var _0x74f148=[];if(_0x2ea35a){_0x198be4=_0x2ea35a;for(var _0x5b945e=0x0;_0x5b945e<_0x2ea35a[_0x55d0('0x61')];_0x5b945e+=0x1){_0x198be4[_0x5b945e][_0x55d0('0x64')]=[];_0x74f148[_0x55d0('0x63')](db[_0x55d0('0x2c')][_0x55d0('0x49')]({'where':{'FromId':[_0x40256a[_0x55d0('0x53')]['id'],_0x2ea35a[_0x5b945e]['id']],'ToId':[_0x40256a[_0x55d0('0x53')]['id'],_0x2ea35a[_0x5b945e]['id']],'ChatGroupId':null},'attributes':['id',_0x55d0('0x65'),_0x55d0('0x66'),'ToId','read',_0x55d0('0x48')],'order':qs[_0x55d0('0x38')](_0x55d0('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x55d0('0x3e')](wrapUser(_0x2ea35a[_0x5b945e])));}return BPromise[_0x55d0('0x68')](_0x74f148);}return[];})[_0x55d0('0x3e')](function(_0x17b452){return{'rows':_0x17b452,'count':_0x17b452[_0x55d0('0x61')]};})[_0x55d0('0x3e')](respondWithResult(_0x1bcc2b,null))[_0x55d0('0x47')](handleError(_0x1bcc2b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2e5e30f..561a7e1 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 _0x254e=['ChatInternalMessage','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5c66c1,_0x31eafd){var _0x54ffd2=function(_0x3141dd){while(--_0x3141dd){_0x5c66c1['push'](_0x5c66c1['shift']());}};_0x54ffd2(++_0x31eafd);}(_0x254e,0x19c));var _0xe254=function(_0x214de5,_0x2662e9){_0x214de5=_0x214de5-0x0;var _0x808650=_0x254e[_0x214de5];return _0x808650;};'use strict';var EventEmitter=require(_0xe254('0x0'));var ChatInternalMessage=require(_0xe254('0x1'))['db'][_0xe254('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe254('0x3'),'afterUpdate':_0xe254('0x4'),'afterDestroy':_0xe254('0x5')};function emitEvent(_0x4defa5){return function(_0xfe5d3d,_0x33bb5b,_0x4c4775){ChatInternalMessageEvents[_0xe254('0x6')](_0x4defa5+':'+_0xfe5d3d['id'],_0xfe5d3d);ChatInternalMessageEvents[_0xe254('0x6')](_0x4defa5,_0xfe5d3d);_0x4c4775(null);};}for(var e in events){if(events[_0xe254('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xe254('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xde44=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x7611ce,_0x4a4441){var _0x67d3ab=function(_0x1456d8){while(--_0x1456d8){_0x7611ce['push'](_0x7611ce['shift']());}};_0x67d3ab(++_0x4a4441);}(_0xde44,0x160));var _0x4de4=function(_0x3c84aa,_0x36bde9){_0x3c84aa=_0x3c84aa-0x0;var _0x2e6756=_0xde44[_0x3c84aa];return _0x2e6756;};'use strict';var EventEmitter=require(_0x4de4('0x0'));var ChatInternalMessage=require(_0x4de4('0x1'))['db'][_0x4de4('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4de4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4de4('0x4'),'afterDestroy':_0x4de4('0x5')};function emitEvent(_0x2b2e21){return function(_0x34fb68,_0x85c4fe,_0x4c906b){ChatInternalMessageEvents[_0x4de4('0x6')](_0x2b2e21+':'+_0x34fb68['id'],_0x34fb68);ChatInternalMessageEvents['emit'](_0x2b2e21,_0x34fb68);_0x4c906b(null);};}for(var e in events){if(events[_0x4de4('0x7')](e)){var event=events[e];ChatInternalMessage[_0x4de4('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5cc0ac6..5246490 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 _0xea88=['chat_internal_messages','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0xea88,0x106));var _0x8ea8=function(_0x47abd5,_0x522f85){_0x47abd5=_0x47abd5-0x0;var _0x35bb61=_0xea88[_0x47abd5];return _0x35bb61;};'use strict';var _=require(_0x8ea8('0x0'));var util=require('util');var logger=require(_0x8ea8('0x1'))(_0x8ea8('0x2'));var moment=require(_0x8ea8('0x3'));var BPromise=require('bluebird');var rp=require(_0x8ea8('0x4'));var fs=require('fs');var path=require(_0x8ea8('0x5'));var rimraf=require(_0x8ea8('0x6'));var config=require(_0x8ea8('0x7'));var attributes=require(_0x8ea8('0x8'));module['exports']=function(_0x4504d8,_0x2e884a){return _0x4504d8[_0x8ea8('0x9')](_0x8ea8('0xa'),attributes,{'tableName':_0x8ea8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ea8('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x91d3=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x94dab3,_0xaf6778){var _0x542342=function(_0x4f7185){while(--_0x4f7185){_0x94dab3['push'](_0x94dab3['shift']());}};_0x542342(++_0xaf6778);}(_0x91d3,0x17e));var _0x391d=function(_0x5aa259,_0x1b5f87){_0x5aa259=_0x5aa259-0x0;var _0x107ffd=_0x91d3[_0x5aa259];return _0x107ffd;};'use strict';var _=require(_0x391d('0x0'));var util=require(_0x391d('0x1'));var logger=require(_0x391d('0x2'))('api');var moment=require(_0x391d('0x3'));var BPromise=require(_0x391d('0x4'));var rp=require(_0x391d('0x5'));var fs=require('fs');var path=require(_0x391d('0x6'));var rimraf=require(_0x391d('0x7'));var config=require(_0x391d('0x8'));var attributes=require(_0x391d('0x9'));module[_0x391d('0xa')]=function(_0x6d8a68,_0x18b1c5){return _0x6d8a68[_0x391d('0xb')](_0x391d('0xc'),attributes,{'tableName':_0x391d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x391d('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 90b4e4b..421f365 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 _0xdafa=['jayson/promise','redis','localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0xdafa,0x1c5));var _0xadaf=function(_0x42951e,_0x3ecd95){_0x42951e=_0x42951e-0x0;var _0x3cf693=_0xdafa[_0x42951e];return _0x3cf693;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xadaf('0x0'));var rs=require(_0xadaf('0x1'));var fs=require('fs');var Redis=require(_0xadaf('0x2'));var db=require(_0xadaf('0x3'))['db'];var utils=require(_0xadaf('0x4'));var logger=require(_0xadaf('0x5'))(_0xadaf('0x6'));var config=require('../../config/environment');var jayson=require(_0xadaf('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xadaf('0x8')]=_['defaults'](config[_0xadaf('0x8')],{'host':_0xadaf('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadaf('0x8')]));require(_0xadaf('0xa'))[_0xadaf('0xb')](socket);function respondWithRpcPromise(_0x5a5886,_0x1a08e5,_0x2cd59f){return new BPromise(function(_0x38a83b,_0x11c061){return client[_0xadaf('0xc')](_0x5a5886,_0x2cd59f)['then'](function(_0x3329ca){logger[_0xadaf('0xd')](_0xadaf('0xe'),_0x1a08e5,_0xadaf('0xf'));logger['debug'](_0xadaf('0x10'),_0x1a08e5,_0xadaf('0xf'),JSON[_0xadaf('0x11')](_0x3329ca));if(_0x3329ca['error']){if(_0x3329ca[_0xadaf('0x12')][_0xadaf('0x13')]===0x1f4){logger[_0xadaf('0x12')](_0xadaf('0xe'),_0x1a08e5,_0x3329ca[_0xadaf('0x12')][_0xadaf('0x14')]);return _0x11c061(_0x3329ca[_0xadaf('0x12')]['message']);}logger[_0xadaf('0x12')](_0xadaf('0xe'),_0x1a08e5,_0x3329ca['error'][_0xadaf('0x14')]);return _0x38a83b(_0x3329ca['error'][_0xadaf('0x14')]);}else{logger['info'](_0xadaf('0xe'),_0x1a08e5,_0xadaf('0xf'));_0x38a83b(_0x3329ca[_0xadaf('0x15')][_0xadaf('0x14')]);}})[_0xadaf('0x16')](function(_0x32506f){logger[_0xadaf('0x12')](_0xadaf('0xe'),_0x1a08e5,_0x32506f);_0x11c061(_0x32506f);});});} \ No newline at end of file +var _0x6e86=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3556fe,_0xd7a32d){var _0x29f885=function(_0x2294c3){while(--_0x2294c3){_0x3556fe['push'](_0x3556fe['shift']());}};_0x29f885(++_0xd7a32d);}(_0x6e86,0x1e5));var _0x66e8=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x6e86[_0x15cdcb];return _0x37b069;};'use strict';var _=require(_0x66e8('0x0'));var util=require(_0x66e8('0x1'));var moment=require(_0x66e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e8('0x3'))['db'];var utils=require(_0x66e8('0x4'));var logger=require(_0x66e8('0x5'))(_0x66e8('0x6'));var config=require(_0x66e8('0x7'));var jayson=require(_0x66e8('0x8'));var client=jayson['client'][_0x66e8('0x9')]({'port':0x232a});config[_0x66e8('0xa')]=_['defaults'](config[_0x66e8('0xa')],{'host':_0x66e8('0xb'),'port':0x18eb});var socket=require(_0x66e8('0xc'))(new Redis(config[_0x66e8('0xa')]));require('./chatInternalMessage.socket')[_0x66e8('0xd')](socket);function respondWithRpcPromise(_0x31f984,_0x3056fd,_0x3a1d8c){return new BPromise(function(_0x304f3f,_0x30eb25){return client[_0x66e8('0xe')](_0x31f984,_0x3a1d8c)['then'](function(_0x530541){logger[_0x66e8('0xf')](_0x66e8('0x10'),_0x3056fd,_0x66e8('0x11'));logger[_0x66e8('0x12')](_0x66e8('0x13'),_0x3056fd,_0x66e8('0x11'),JSON[_0x66e8('0x14')](_0x530541));if(_0x530541[_0x66e8('0x15')]){if(_0x530541['error']['code']===0x1f4){logger[_0x66e8('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x3056fd,_0x530541[_0x66e8('0x15')][_0x66e8('0x16')]);return _0x30eb25(_0x530541['error'][_0x66e8('0x16')]);}logger[_0x66e8('0x15')](_0x66e8('0x10'),_0x3056fd,_0x530541[_0x66e8('0x15')]['message']);return _0x304f3f(_0x530541['error']['message']);}else{logger['info'](_0x66e8('0x10'),_0x3056fd,'request\x20sent');_0x304f3f(_0x530541[_0x66e8('0x17')]['message']);}})['catch'](function(_0xac3377){logger[_0x66e8('0x15')](_0x66e8('0x10'),_0x3056fd,_0xac3377);_0x30eb25(_0xac3377);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c45379b..4c55e6c 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 _0xca97=['register','length','chatInternalMessage:','save','remove','update','emit','removeListener'];(function(_0x3b2e06,_0x4f2695){var _0x53fa2d=function(_0xc94883){while(--_0xc94883){_0x3b2e06['push'](_0x3b2e06['shift']());}};_0x53fa2d(++_0x4f2695);}(_0xca97,0x163));var _0x7ca9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xca97[_0x5ddb1c];return _0x354adc;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x7ca9('0x0'),_0x7ca9('0x1'),_0x7ca9('0x2')];function createListener(_0x237aca,_0xbb63a0){return function(_0x3267ff){_0xbb63a0[_0x7ca9('0x3')](_0x237aca,_0x3267ff);};}function removeListener(_0x4d241f,_0x584cf1){return function(){ChatInternalMessageEvents[_0x7ca9('0x4')](_0x4d241f,_0x584cf1);};}exports[_0x7ca9('0x5')]=function(_0x3616c5){for(var _0x556181=0x0,_0x9e2e3=events[_0x7ca9('0x6')];_0x556181<_0x9e2e3;_0x556181++){var _0x1eeeeb=events[_0x556181];var _0x40f1a6=createListener(_0x7ca9('0x7')+_0x1eeeeb,_0x3616c5);ChatInternalMessageEvents['on'](_0x1eeeeb,_0x40f1a6);}}; \ No newline at end of file +var _0x37ac=['./chatInternalMessage.events','save','remove','update','removeListener','register','length'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x37ac,0x70));var _0xc37a=function(_0x1115c4,_0x3e3e6a){_0x1115c4=_0x1115c4-0x0;var _0x5c90bd=_0x37ac[_0x1115c4];return _0x5c90bd;};'use strict';var ChatInternalMessageEvents=require(_0xc37a('0x0'));var events=[_0xc37a('0x1'),_0xc37a('0x2'),_0xc37a('0x3')];function createListener(_0x21ac1a,_0xbcc7d2){return function(_0x15b9a4){_0xbcc7d2['emit'](_0x21ac1a,_0x15b9a4);};}function removeListener(_0x2120ec,_0x2bfd51){return function(){ChatInternalMessageEvents[_0xc37a('0x4')](_0x2120ec,_0x2bfd51);};}exports[_0xc37a('0x5')]=function(_0x3b60e8){for(var _0x31da12=0x0,_0x5f3bc7=events[_0xc37a('0x6')];_0x31da12<_0x5f3bc7;_0x31da12++){var _0xdeefaf=events[_0x31da12];var _0x422fe8=createListener('chatInternalMessage:'+_0xdeefaf,_0x3b60e8);ChatInternalMessageEvents['on'](_0xdeefaf,_0x422fe8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 36372e0..efbaab9 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 _0xd99c=['put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create'];(function(_0x17e0ff,_0x4dbd1e){var _0x357979=function(_0x443276){while(--_0x443276){_0x17e0ff['push'](_0x17e0ff['shift']());}};_0x357979(++_0x4dbd1e);}(_0xd99c,0x9d));var _0xcd99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd99c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcd99('0x0'));var util=require('util');var path=require(_0xcd99('0x1'));var timeout=require(_0xcd99('0x2'));var express=require(_0xcd99('0x3'));var router=express[_0xcd99('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd99('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd99('0x6'));var controller=require(_0xcd99('0x7'));router[_0xcd99('0x8')]('/',auth[_0xcd99('0x9')](),controller[_0xcd99('0xa')]);router['get'](_0xcd99('0xb'),auth['isAuthenticated'](),controller[_0xcd99('0xc')]);router['get'](_0xcd99('0xd'),auth['isAuthenticated'](),controller[_0xcd99('0xe')]);router[_0xcd99('0x8')](_0xcd99('0xf'),auth[_0xcd99('0x9')](),controller[_0xcd99('0x10')]);router[_0xcd99('0x11')]('/',auth[_0xcd99('0x9')](),controller[_0xcd99('0x12')]);router[_0xcd99('0x13')](_0xcd99('0xf'),controller['update']);router[_0xcd99('0x14')]('/:id',auth[_0xcd99('0x9')](),controller[_0xcd99('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5224=['post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','/:id','show'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x5224,0xb9));var _0x4522=function(_0x5499ab,_0x4c1128){_0x5499ab=_0x5499ab-0x0;var _0x344478=_0x5224[_0x5499ab];return _0x344478;};'use strict';var multer=require(_0x4522('0x0'));var util=require(_0x4522('0x1'));var path=require('path');var timeout=require(_0x4522('0x2'));var express=require(_0x4522('0x3'));var router=express[_0x4522('0x4')]();var fs_extra=require(_0x4522('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4522('0x6'));var config=require(_0x4522('0x7'));var controller=require('./chatInternalMessage.controller');router[_0x4522('0x8')]('/',auth[_0x4522('0x9')](),controller[_0x4522('0xa')]);router[_0x4522('0x8')]('/describe',auth[_0x4522('0x9')](),controller[_0x4522('0xb')]);router['get'](_0x4522('0xc'),auth[_0x4522('0x9')](),controller['getUsers']);router[_0x4522('0x8')](_0x4522('0xd'),auth[_0x4522('0x9')](),controller[_0x4522('0xe')]);router[_0x4522('0xf')]('/',auth[_0x4522('0x9')](),controller[_0x4522('0x10')]);router['put'](_0x4522('0xd'),controller[_0x4522('0x11')]);router[_0x4522('0x12')](_0x4522('0xd'),auth[_0x4522('0x9')](),controller[_0x4522('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b574437..b31d878 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 _0xd0e4=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x2d66b6,_0x38c46e){var _0x4649e7=function(_0x5230b1){while(--_0x5230b1){_0x2d66b6['push'](_0x2d66b6['shift']());}};_0x4649e7(++_0x38c46e);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x5b5960,_0x2bab09){_0x5b5960=_0x5b5960-0x0;var _0x16b671=_0xd0e4[_0x5b5960];return _0x16b671;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'body':{'type':Sequelize[_0x4d0e('0x2')](_0x4d0e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d0e('0x4')]('in',_0x4d0e('0x5')),'defaultValue':_0x4d0e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d0e('0x6')]},'providerName':{'type':Sequelize[_0x4d0e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x02ce=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x2eb4a9,_0x16744f){var _0x1d972f=function(_0x133a1c){while(--_0x133a1c){_0x2eb4a9['push'](_0x2eb4a9['shift']());}};_0x1d972f(++_0x16744f);}(_0x02ce,0x1ac));var _0xe02c=function(_0x775ba7,_0x12589b){_0x775ba7=_0x775ba7-0x0;var _0xee3c41=_0x02ce[_0x775ba7];return _0xee3c41;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'body':{'type':Sequelize[_0xe02c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe02c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe02c('0x4')]('in',_0xe02c('0x5')),'defaultValue':_0xe02c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe02c('0x6')]},'providerName':{'type':Sequelize[_0xe02c('0x7')]},'providerResponse':{'type':Sequelize[_0xe02c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 578b454..98916cc 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 _0x3a6b=['format','UserId','agent','get','ChatInteraction','ChatInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','Sequelize','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','ChatMessage','findAll','show','params','keys','length','find','create','body','describe','chat-interactions','accept','readAt'];(function(_0x1fa20a,_0x1a127c){var _0xe73e93=function(_0x55b6d8){while(--_0x55b6d8){_0x1fa20a['push'](_0x1fa20a['shift']());}};_0xe73e93(++_0x1a127c);}(_0x3a6b,0xb5));var _0xb3a6=function(_0x283b39,_0x5ade81){_0x283b39=_0x283b39-0x0;var _0x27414c=_0x3a6b[_0x283b39];return _0x27414c;};'use strict';var emlformat=require(_0xb3a6('0x0'));var rimraf=require(_0xb3a6('0x1'));var zipdir=require(_0xb3a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3a6('0x3'));var moment=require(_0xb3a6('0x4'));var BPromise=require(_0xb3a6('0x5'));var Mustache=require('mustache');var util=require(_0xb3a6('0x6'));var path=require(_0xb3a6('0x7'));var sox=require('sox');var csv=require(_0xb3a6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3a6('0x9'));var _=require('lodash');var squel=require(_0xb3a6('0xa'));var crypto=require(_0xb3a6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb3a6('0xc'));var toCsv=require(_0xb3a6('0x8'));var querystring=require('querystring');var Papa=require(_0xb3a6('0xd'));var Redis=require(_0xb3a6('0xe'));var authService=require(_0xb3a6('0xf'));var qs=require(_0xb3a6('0x10'));var as=require(_0xb3a6('0x11'));var hardwareService=require(_0xb3a6('0x12'));var logger=require(_0xb3a6('0x13'))(_0xb3a6('0x14'));var utils=require(_0xb3a6('0x15'));var config=require(_0xb3a6('0x16'));var licenseUtil=require(_0xb3a6('0x17'));var db=require(_0xb3a6('0x18'))['db'];config[_0xb3a6('0x19')]=_[_0xb3a6('0x1a')](config[_0xb3a6('0x19')],{'host':_0xb3a6('0x1b'),'port':0x18eb});var socket=require(_0xb3a6('0x1c'))(new Redis(config[_0xb3a6('0x19')]));require(_0xb3a6('0x1d'))[_0xb3a6('0x1e')](socket);var jayson=require(_0xb3a6('0x1f'));var client=jayson[_0xb3a6('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xb3a6('0x20')][_0xb3a6('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x52176a,_0x406b9c,_0x3a087c,_0x4e6c32){return new BPromise(function(_0x2ed9a4,_0x47b82a){var _0x2c33f9=_0x4e6c32||client;return _0x2c33f9['request'](_0x52176a,_0x3a087c)['then'](function(_0x29bacf){logger['info'](_0xb3a6('0x22'),_0x406b9c,_0xb3a6('0x23'));logger['debug'](_0xb3a6('0x24'),_0x406b9c,_0xb3a6('0x23'),JSON[_0xb3a6('0x25')](_0x29bacf));if(_0x29bacf[_0xb3a6('0x26')]){if(_0x29bacf[_0xb3a6('0x26')][_0xb3a6('0x27')]===0x1f4){logger[_0xb3a6('0x26')](_0xb3a6('0x22'),_0x406b9c,_0x29bacf[_0xb3a6('0x26')][_0xb3a6('0x28')]);return _0x47b82a(_0x29bacf[_0xb3a6('0x26')][_0xb3a6('0x28')]);}logger[_0xb3a6('0x26')](_0xb3a6('0x22'),_0x406b9c,_0x29bacf['error']['message']);return _0x2ed9a4(_0x29bacf['error'][_0xb3a6('0x28')]);}else{logger[_0xb3a6('0x29')](_0xb3a6('0x22'),_0x406b9c,_0xb3a6('0x23'));_0x2ed9a4(_0x29bacf[_0xb3a6('0x2a')]['message']);}})[_0xb3a6('0x2b')](function(_0xb7360a){logger['error'](_0xb3a6('0x22'),_0x406b9c,_0xb7360a);_0x47b82a(_0xb7360a);});});}function respondWithStatusCode(_0x2aa0ad,_0x4f0d71){_0x4f0d71=_0x4f0d71||0xcc;return function(_0x168ffb){if(_0x168ffb){return _0x2aa0ad['sendStatus'](_0x4f0d71);}return _0x2aa0ad[_0xb3a6('0x2c')](_0x4f0d71)[_0xb3a6('0x2d')]();};}function respondWithResult(_0xf78a3b,_0x48b907){_0x48b907=_0x48b907||0xc8;return function(_0x18727e){if(_0x18727e){return _0xf78a3b['status'](_0x48b907)[_0xb3a6('0x2e')](_0x18727e);}};}function respondWithFilteredResult(_0x54903d,_0x3fdb49){return function(_0x119108){if(_0x119108){var _0x198b49=typeof _0x3fdb49['offset']===_0xb3a6('0x2f')&&typeof _0x3fdb49['limit']===_0xb3a6('0x2f');var _0x1da17c=_0x119108[_0xb3a6('0x30')];var _0x58df66=_0x198b49?0x0:_0x3fdb49[_0xb3a6('0x31')];var _0x163dff=_0x198b49?_0x119108[_0xb3a6('0x30')]:_0x3fdb49[_0xb3a6('0x31')]+_0x3fdb49[_0xb3a6('0x32')];var _0x631eeb;if(_0x163dff>=_0x1da17c){_0x163dff=_0x1da17c;_0x631eeb=0xc8;}else{_0x631eeb=0xce;}_0x54903d[_0xb3a6('0x2c')](_0x631eeb);return _0x54903d['set'](_0xb3a6('0x33'),_0x58df66+'-'+_0x163dff+'/'+_0x1da17c)[_0xb3a6('0x2e')](_0x119108);}return null;};}function patchUpdates(_0x372066){return function(_0x149adc){try{jsonpatch[_0xb3a6('0x34')](_0x149adc,_0x372066,!![]);}catch(_0x29c850){return BPromise[_0xb3a6('0x35')](_0x29c850);}return _0x149adc[_0xb3a6('0x36')]();};}function saveUpdates(_0x3c9617,_0x286037){return function(_0x3023aa){if(_0x3023aa){return _0x3023aa['update'](_0x3c9617)[_0xb3a6('0x37')](function(_0x3491ba){return _0x3491ba;});}return null;};}function removeEntity(_0x140d43,_0x3358a3){return function(_0x2299e7){if(_0x2299e7){return _0x2299e7[_0xb3a6('0x38')]()[_0xb3a6('0x37')](function(){_0x140d43[_0xb3a6('0x2c')](0xcc)[_0xb3a6('0x2d')]();});}};}function handleEntityNotFound(_0x4c4cbf,_0x404d77){return function(_0x364406){if(!_0x364406){_0x4c4cbf[_0xb3a6('0x39')](0x194);}return _0x364406;};}function handleError(_0x4cc1eb,_0x3bcb73){_0x3bcb73=_0x3bcb73||0x1f4;return function(_0x3f3f54){logger[_0xb3a6('0x26')](_0x3f3f54[_0xb3a6('0x3a')]);if(_0x3f3f54[_0xb3a6('0x3b')]){delete _0x3f3f54[_0xb3a6('0x3b')];}_0x4cc1eb[_0xb3a6('0x2c')](_0x3bcb73)[_0xb3a6('0x3c')](_0x3f3f54);};}exports['index']=function(_0x5fa761,_0x56ca94){var _0x56b6d1={},_0x3daa7c={},_0x1ee49e={'count':0x0,'rows':[]};var _0x52aed2=_[_0xb3a6('0x3d')](db['ChatMessage'][_0xb3a6('0x3e')],function(_0x38dda1){return{'name':_0x38dda1[_0xb3a6('0x3f')],'type':_0x38dda1['type'][_0xb3a6('0x40')]};});_0x3daa7c[_0xb3a6('0x41')]=_['map'](_0x52aed2,_0xb3a6('0x3b'));_0x3daa7c[_0xb3a6('0x42')]=_['keys'](_0x5fa761[_0xb3a6('0x42')]);_0x3daa7c['filters']=_[_0xb3a6('0x43')](_0x3daa7c[_0xb3a6('0x41')],_0x3daa7c[_0xb3a6('0x42')]);_0x56b6d1['attributes']=_['intersection'](_0x3daa7c[_0xb3a6('0x41')],qs[_0xb3a6('0x44')](_0x5fa761[_0xb3a6('0x42')][_0xb3a6('0x44')]));_0x56b6d1[_0xb3a6('0x45')]=_0x56b6d1['attributes']['length']?_0x56b6d1[_0xb3a6('0x45')]:_0x3daa7c['model'];if(!_0x5fa761[_0xb3a6('0x42')][_0xb3a6('0x46')]('nolimit')){_0x56b6d1[_0xb3a6('0x32')]=qs['limit'](_0x5fa761[_0xb3a6('0x42')][_0xb3a6('0x32')]);_0x56b6d1[_0xb3a6('0x31')]=qs[_0xb3a6('0x31')](_0x5fa761['query'][_0xb3a6('0x31')]);}_0x56b6d1[_0xb3a6('0x47')]=qs['sort'](_0x5fa761[_0xb3a6('0x42')][_0xb3a6('0x48')]);_0x56b6d1[_0xb3a6('0x49')]=qs[_0xb3a6('0x4a')](_['pick'](_0x5fa761[_0xb3a6('0x42')],_0x3daa7c[_0xb3a6('0x4a')]),_0x52aed2);if(_0x5fa761[_0xb3a6('0x42')][_0xb3a6('0x4b')]){_0x56b6d1[_0xb3a6('0x49')]=_[_0xb3a6('0x4c')](_0x56b6d1[_0xb3a6('0x49')],{'$or':_[_0xb3a6('0x3d')](_0x52aed2,function(_0xe44f22){if(_0xe44f22[_0xb3a6('0x4d')]!==_0xb3a6('0x4e')){var _0x179511={};_0x179511[_0xe44f22[_0xb3a6('0x3b')]]={'$like':'%'+_0x5fa761[_0xb3a6('0x42')][_0xb3a6('0x4b')]+'%'};return _0x179511;}})});}_0x56b6d1=_[_0xb3a6('0x4c')]({},_0x56b6d1,_0x5fa761[_0xb3a6('0x4f')]);var _0x5f11b4={'where':_0x56b6d1[_0xb3a6('0x49')]};return db['ChatMessage'][_0xb3a6('0x30')](_0x5f11b4)[_0xb3a6('0x37')](function(_0x224cb8){_0x1ee49e[_0xb3a6('0x30')]=_0x224cb8;if(_0x5fa761[_0xb3a6('0x42')][_0xb3a6('0x50')]){_0x56b6d1[_0xb3a6('0x51')]=[{'all':!![]}];}return db[_0xb3a6('0x52')][_0xb3a6('0x53')](_0x56b6d1);})[_0xb3a6('0x37')](function(_0x516115){_0x1ee49e['rows']=_0x516115;return _0x1ee49e;})[_0xb3a6('0x37')](respondWithFilteredResult(_0x56ca94,_0x56b6d1))[_0xb3a6('0x2b')](handleError(_0x56ca94,null));};exports[_0xb3a6('0x54')]=function(_0xdf1069,_0x1ed498){var _0x42668b={'raw':!![],'where':{'id':_0xdf1069[_0xb3a6('0x55')]['id']}},_0x5109ae={};_0x5109ae[_0xb3a6('0x41')]=_[_0xb3a6('0x56')](db[_0xb3a6('0x52')][_0xb3a6('0x3e')]);_0x5109ae[_0xb3a6('0x42')]=_[_0xb3a6('0x56')](_0xdf1069[_0xb3a6('0x42')]);_0x5109ae[_0xb3a6('0x4a')]=_[_0xb3a6('0x43')](_0x5109ae[_0xb3a6('0x41')],_0x5109ae['query']);_0x42668b[_0xb3a6('0x45')]=_[_0xb3a6('0x43')](_0x5109ae[_0xb3a6('0x41')],qs['fields'](_0xdf1069[_0xb3a6('0x42')][_0xb3a6('0x44')]));_0x42668b[_0xb3a6('0x45')]=_0x42668b[_0xb3a6('0x45')][_0xb3a6('0x57')]?_0x42668b[_0xb3a6('0x45')]:_0x5109ae[_0xb3a6('0x41')];if(_0xdf1069[_0xb3a6('0x42')][_0xb3a6('0x50')]){_0x42668b['include']=[{'all':!![]}];}_0x42668b=_[_0xb3a6('0x4c')]({},_0x42668b,_0xdf1069['options']);return db[_0xb3a6('0x52')][_0xb3a6('0x58')](_0x42668b)['then'](handleEntityNotFound(_0x1ed498,null))['then'](respondWithResult(_0x1ed498,null))['catch'](handleError(_0x1ed498,null));};exports['create']=function(_0x94988d,_0x53ac8d){return db[_0xb3a6('0x52')][_0xb3a6('0x59')](_0x94988d[_0xb3a6('0x5a')],{})['then'](respondWithResult(_0x53ac8d,0xc9))[_0xb3a6('0x2b')](handleError(_0x53ac8d,null));};exports['update']=function(_0x2d8d77,_0x1e8b9c){if(_0x2d8d77[_0xb3a6('0x5a')]['id']){delete _0x2d8d77['body']['id'];}return db['ChatMessage'][_0xb3a6('0x58')]({'where':{'id':_0x2d8d77[_0xb3a6('0x55')]['id']}})['then'](handleEntityNotFound(_0x1e8b9c,null))[_0xb3a6('0x37')](saveUpdates(_0x2d8d77[_0xb3a6('0x5a')],null))[_0xb3a6('0x37')](respondWithResult(_0x1e8b9c,null))[_0xb3a6('0x2b')](handleError(_0x1e8b9c,null));};exports[_0xb3a6('0x38')]=function(_0x289aa0,_0xbd378){return db[_0xb3a6('0x52')]['find']({'where':{'id':_0x289aa0[_0xb3a6('0x55')]['id']}})['then'](handleEntityNotFound(_0xbd378,null))[_0xb3a6('0x37')](removeEntity(_0xbd378,null))[_0xb3a6('0x2b')](handleError(_0xbd378,null));};exports[_0xb3a6('0x5b')]=function(_0x3d2af5,_0x162681){return db[_0xb3a6('0x52')]['describe']()[_0xb3a6('0x37')](respondWithResult(_0x162681,null))['catch'](handleError(_0x162681,null));};var interaction_log=require('../../config/logger')(_0xb3a6('0x5c'));exports[_0xb3a6('0x5d')]=function(_0x4fdbf4,_0xf69f2b,_0x502fdd){var _0x16078a={'agent':{},'channel':'chat'};if(_0x4fdbf4[_0xb3a6('0x5a')]['id']){delete _0x4fdbf4[_0xb3a6('0x5a')]['id'];}_0x4fdbf4[_0xb3a6('0x5a')]['read']=!![];_0x4fdbf4[_0xb3a6('0x5a')][_0xb3a6('0x5e')]=moment()[_0xb3a6('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4fdbf4[_0xb3a6('0x5a')]['UserId']=_0x4fdbf4[_0xb3a6('0x5a')][_0xb3a6('0x60')]||_0x4fdbf4['user']['id'];_0x16078a[_0xb3a6('0x61')]['id']=_0x4fdbf4[_0xb3a6('0x5a')][_0xb3a6('0x60')];return db[_0xb3a6('0x52')]['find']({'where':{'id':_0x4fdbf4[_0xb3a6('0x55')]['id'],'UserId':null}})[_0xb3a6('0x37')](handleEntityNotFound(_0xf69f2b,null))[_0xb3a6('0x37')](saveUpdates(_0x4fdbf4[_0xb3a6('0x5a')],null))[_0xb3a6('0x37')](function(_0x20fc3c){if(_0x20fc3c){_0x16078a['message']=_0x20fc3c[_0xb3a6('0x62')]({'plain':!![]});return db[_0xb3a6('0x63')][_0xb3a6('0x58')]({'where':{'id':_0x20fc3c[_0xb3a6('0x64')]}});}return null;})[_0xb3a6('0x37')](handleEntityNotFound(_0xf69f2b,null))[_0xb3a6('0x37')](function(_0x44788d){if(_0x44788d){return _0x44788d[_0xb3a6('0x65')]({'UserId':_0x4fdbf4[_0xb3a6('0x5a')][_0xb3a6('0x60')],'read1stAt':_[_0xb3a6('0x66')](_0x44788d[_0xb3a6('0x67')])?moment()['format'](_0xb3a6('0x68')):undefined});}return null;})[_0xb3a6('0x37')](function(_0x3a9c28){if(_0x3a9c28){_0x16078a[_0xb3a6('0x69')]=_0x3a9c28['get']({'plain':!![]});interaction_log[_0xb3a6('0x29')](_0xb3a6('0x6a'),_0x4fdbf4['user']['id'],_0x4fdbf4['user'][_0xb3a6('0x3b')],_0x4fdbf4[_0xb3a6('0x6b')][_0xb3a6('0x6c')],_0x16078a['interaction']['id'],_0x4fdbf4[_0xb3a6('0x5a')]?JSON['stringify'](_0x4fdbf4['body']):_0xb3a6('0x6d'));return respondWithRpcPromise(_0xb3a6('0x6e'),_0xb3a6('0x6f'),_0x16078a);}return null;})[_0xb3a6('0x37')](function(_0x2bbb17){var _0x50d564='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2bbb17[_0xb3a6('0x28')]['ContactId'];return db['sequelize'][_0xb3a6('0x42')](_0x50d564,{'type':db[_0xb3a6('0x70')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x520b48){return _0x520b48;});})['then'](function(_0x51ed21){if(_0x51ed21){_0x16078a['message'][_0xb3a6('0x71')]=_0x51ed21[0x0];if(!_0x4fdbf4[_0xb3a6('0x5a')][_0xb3a6('0x60')])return;return db[_0xb3a6('0x72')]['find']({'where':{'id':_0x4fdbf4[_0xb3a6('0x5a')]['UserId'],'role':_0xb3a6('0x61')},'attributes':['id','name','fullname',_0xb3a6('0x73'),_0xb3a6('0x74')],'raw':!![]});}return null;})['then'](function(_0x1e651c){if(!_0x1e651c)return null;_0x16078a['message']['agent']=_0x1e651c;return _0x16078a;})['then'](function(_0x3fefcb){if(_0x3fefcb){if(_0x4fdbf4[_0xb3a6('0x5a')][_0xb3a6('0x75')]){_0x16078a[_0xb3a6('0x28')][_0xb3a6('0x76')]=util[_0xb3a6('0x5f')](_0xb3a6('0x77'),_0x4fdbf4[_0xb3a6('0x6b')][_0xb3a6('0x3b')]);_0x16078a[_0xb3a6('0x28')][_0xb3a6('0x78')]=_0x16078a[_0xb3a6('0x78')];_0x16078a[_0xb3a6('0x28')][_0xb3a6('0x79')]=_0x16078a[_0xb3a6('0x78')];_0x16078a[_0xb3a6('0x28')][_0xb3a6('0x7a')]=_0xb3a6('0x5d');return respondWithRpcPromise(_0xb3a6('0x7b'),_0xb3a6('0x7b'),{'event':_0xb3a6('0x7c'),'message':_[_0xb3a6('0x4c')](_0x16078a[_0xb3a6('0x28')],JSON[_0xb3a6('0x7d')](_0x16078a[_0xb3a6('0x69')][_0xb3a6('0x7e')]))},client9002)[_0xb3a6('0x37')](function(){return _0x16078a;});}return _0x16078a;}return null;})['then'](respondWithResult(_0xf69f2b,null))['catch'](handleError(_0xf69f2b,null));};var interaction_log=require(_0xb3a6('0x13'))(_0xb3a6('0x5c'));exports[_0xb3a6('0x35')]=function(_0x523667,_0xba9453,_0x1ae8d1){var _0x2d8b47={'agent':{},'channel':_0xb3a6('0x7f')};if(_0x523667['body']['id']){delete _0x523667[_0xb3a6('0x5a')]['id'];}_0x523667[_0xb3a6('0x5a')][_0xb3a6('0x60')]=_0x523667[_0xb3a6('0x5a')][_0xb3a6('0x60')]||_0x523667[_0xb3a6('0x6b')]['id'];_0x2d8b47['agent']['id']=_0x523667[_0xb3a6('0x5a')][_0xb3a6('0x60')];return db[_0xb3a6('0x52')][_0xb3a6('0x58')]({'where':{'id':_0x523667[_0xb3a6('0x55')]['id'],'UserId':null}})[_0xb3a6('0x37')](handleEntityNotFound(_0xba9453,null))[_0xb3a6('0x37')](function(_0x430e44){if(_0x430e44){_0x2d8b47[_0xb3a6('0x28')]=_0x430e44[_0xb3a6('0x62')]({'plain':!![]});return db[_0xb3a6('0x63')][_0xb3a6('0x58')]({'where':{'id':_0x430e44[_0xb3a6('0x64')]}});}return null;})[_0xb3a6('0x37')](handleEntityNotFound(_0xba9453,null))[_0xb3a6('0x37')](function(_0x589cce){if(_0x589cce){_0x2d8b47['interaction']=_0x589cce['get']({'plain':!![]});interaction_log[_0xb3a6('0x29')](_0xb3a6('0x80'),_0x523667[_0xb3a6('0x6b')]['id'],_0x523667[_0xb3a6('0x6b')][_0xb3a6('0x3b')],_0x523667[_0xb3a6('0x6b')][_0xb3a6('0x6c')],_0x2d8b47[_0xb3a6('0x69')]['id'],_0x523667[_0xb3a6('0x5a')]?JSON[_0xb3a6('0x25')](_0x523667[_0xb3a6('0x5a')]):'null');return respondWithRpcPromise(_0xb3a6('0x81'),_0xb3a6('0x82'),_0x2d8b47);}return null;})[_0xb3a6('0x37')](function(_0x1e4762){var _0x83b369=_0xb3a6('0x83')+_0x1e4762[_0xb3a6('0x28')][_0xb3a6('0x84')];return db[_0xb3a6('0x85')][_0xb3a6('0x42')](_0x83b369,{'type':db[_0xb3a6('0x70')][_0xb3a6('0x86')][_0xb3a6('0x87')],'raw':!![]})[_0xb3a6('0x37')](function(_0x1c8d31){return _0x1c8d31;});})['then'](function(_0x1c06ee){if(_0x1c06ee){_0x2d8b47[_0xb3a6('0x28')][_0xb3a6('0x71')]=_0x1c06ee[0x0];if(!_0x523667['body'][_0xb3a6('0x60')])return;return db[_0xb3a6('0x72')][_0xb3a6('0x58')]({'where':{'id':_0x523667[_0xb3a6('0x5a')][_0xb3a6('0x60')],'role':_0xb3a6('0x61')},'attributes':['id',_0xb3a6('0x3b'),_0xb3a6('0x88'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x396269){if(!_0x396269)return null;_0x2d8b47[_0xb3a6('0x28')][_0xb3a6('0x61')]=_0x396269;return _0x2d8b47;})[_0xb3a6('0x37')](function(_0x51e52c){if(_0x51e52c){_0x51e52c[_0xb3a6('0x28')]['interface']=util[_0xb3a6('0x5f')](_0xb3a6('0x77'),_0x523667[_0xb3a6('0x6b')][_0xb3a6('0x3b')]);_0x51e52c[_0xb3a6('0x28')][_0xb3a6('0x78')]=_0x2d8b47['channel'];_0x51e52c[_0xb3a6('0x28')][_0xb3a6('0x79')]=_0x2d8b47[_0xb3a6('0x78')];_0x51e52c[_0xb3a6('0x28')][_0xb3a6('0x7a')]='reject';respondWithRpcPromise(_0xb3a6('0x7b'),'EventManager',{'event':_0xb3a6('0x89'),'message':_[_0xb3a6('0x4c')](_0x2d8b47[_0xb3a6('0x28')],JSON['parse'](_0x2d8b47['interaction'][_0xb3a6('0x7e')]))},client9002);return _0x2d8b47;}return null;})['then'](respondWithResult(_0xba9453,null))[_0xb3a6('0x2b')](handleError(_0xba9453,null));}; \ No newline at end of file +var _0x8f57=['fullname','email','manual','interface','channel','event','EventManager','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','QueryTypes','contact','SIP/%s','motionChannel','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','set','json','reject','save','update','end','sendStatus','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','params','keys','length','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','User','agent'];(function(_0x26115c,_0x5584dc){var _0x563c4f=function(_0x19a021){while(--_0x19a021){_0x26115c['push'](_0x26115c['shift']());}};_0x563c4f(++_0x5584dc);}(_0x8f57,0x11c));var _0x78f5=function(_0x4d3924,_0x327b56){_0x4d3924=_0x4d3924-0x0;var _0x844555=_0x8f57[_0x4d3924];return _0x844555;};'use strict';var emlformat=require(_0x78f5('0x0'));var rimraf=require(_0x78f5('0x1'));var zipdir=require(_0x78f5('0x2'));var jsonpatch=require(_0x78f5('0x3'));var rp=require(_0x78f5('0x4'));var moment=require(_0x78f5('0x5'));var BPromise=require(_0x78f5('0x6'));var Mustache=require(_0x78f5('0x7'));var util=require(_0x78f5('0x8'));var path=require(_0x78f5('0x9'));var sox=require(_0x78f5('0xa'));var csv=require(_0x78f5('0xb'));var ejs=require(_0x78f5('0xc'));var fs=require('fs');var fs_extra=require(_0x78f5('0xd'));var _=require(_0x78f5('0xe'));var squel=require(_0x78f5('0xf'));var crypto=require(_0x78f5('0x10'));var jsforce=require(_0x78f5('0x11'));var deskjs=require(_0x78f5('0x12'));var toCsv=require(_0x78f5('0xb'));var querystring=require(_0x78f5('0x13'));var Papa=require(_0x78f5('0x14'));var Redis=require(_0x78f5('0x15'));var authService=require(_0x78f5('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x78f5('0x17'));var hardwareService=require(_0x78f5('0x18'));var logger=require(_0x78f5('0x19'))(_0x78f5('0x1a'));var utils=require(_0x78f5('0x1b'));var config=require(_0x78f5('0x1c'));var licenseUtil=require(_0x78f5('0x1d'));var db=require(_0x78f5('0x1e'))['db'];config[_0x78f5('0x1f')]=_[_0x78f5('0x20')](config[_0x78f5('0x1f')],{'host':_0x78f5('0x21'),'port':0x18eb});var socket=require(_0x78f5('0x22'))(new Redis(config[_0x78f5('0x1f')]));require('./chatMessage.socket')[_0x78f5('0x23')](socket);var jayson=require(_0x78f5('0x24'));var client=jayson[_0x78f5('0x25')][_0x78f5('0x26')]({'port':0x232c});var client9002=jayson[_0x78f5('0x25')][_0x78f5('0x26')]({'port':0x232a});function respondWithRpcPromise(_0x12d4b2,_0x3deeec,_0x2a98d7,_0x3a389c){return new BPromise(function(_0x300261,_0x3869ae){var _0xb0366d=_0x3a389c||client;return _0xb0366d[_0x78f5('0x27')](_0x12d4b2,_0x2a98d7)[_0x78f5('0x28')](function(_0x20f0da){logger[_0x78f5('0x29')](_0x78f5('0x2a'),_0x3deeec,_0x78f5('0x2b'));logger[_0x78f5('0x2c')](_0x78f5('0x2d'),_0x3deeec,_0x78f5('0x2b'),JSON[_0x78f5('0x2e')](_0x20f0da));if(_0x20f0da[_0x78f5('0x2f')]){if(_0x20f0da['error'][_0x78f5('0x30')]===0x1f4){logger[_0x78f5('0x2f')](_0x78f5('0x2a'),_0x3deeec,_0x20f0da[_0x78f5('0x2f')][_0x78f5('0x31')]);return _0x3869ae(_0x20f0da[_0x78f5('0x2f')]['message']);}logger[_0x78f5('0x2f')]('ChatMessage,\x20%s,\x20%s',_0x3deeec,_0x20f0da[_0x78f5('0x2f')]['message']);return _0x300261(_0x20f0da['error'][_0x78f5('0x31')]);}else{logger[_0x78f5('0x29')]('ChatMessage,\x20%s,\x20%s',_0x3deeec,_0x78f5('0x2b'));_0x300261(_0x20f0da[_0x78f5('0x32')][_0x78f5('0x31')]);}})[_0x78f5('0x33')](function(_0x581285){logger[_0x78f5('0x2f')](_0x78f5('0x2a'),_0x3deeec,_0x581285);_0x3869ae(_0x581285);});});}function respondWithStatusCode(_0x4e1a49,_0x4ed8f0){_0x4ed8f0=_0x4ed8f0||0xcc;return function(_0x5b53a6){if(_0x5b53a6){return _0x4e1a49['sendStatus'](_0x4ed8f0);}return _0x4e1a49[_0x78f5('0x34')](_0x4ed8f0)['end']();};}function respondWithResult(_0x3b65ea,_0x7d7d4f){_0x7d7d4f=_0x7d7d4f||0xc8;return function(_0x3c01c7){if(_0x3c01c7){return _0x3b65ea[_0x78f5('0x34')](_0x7d7d4f)['json'](_0x3c01c7);}};}function respondWithFilteredResult(_0x6766d,_0x40a239){return function(_0x599c11){if(_0x599c11){var _0x16c3b9=typeof _0x40a239[_0x78f5('0x35')]==='undefined'&&typeof _0x40a239[_0x78f5('0x36')]===_0x78f5('0x37');var _0xafdf57=_0x599c11[_0x78f5('0x38')];var _0x46662b=_0x16c3b9?0x0:_0x40a239[_0x78f5('0x35')];var _0x1028e4=_0x16c3b9?_0x599c11['count']:_0x40a239[_0x78f5('0x35')]+_0x40a239[_0x78f5('0x36')];var _0x237a5e;if(_0x1028e4>=_0xafdf57){_0x1028e4=_0xafdf57;_0x237a5e=0xc8;}else{_0x237a5e=0xce;}_0x6766d[_0x78f5('0x34')](_0x237a5e);return _0x6766d[_0x78f5('0x39')]('Content-Range',_0x46662b+'-'+_0x1028e4+'/'+_0xafdf57)[_0x78f5('0x3a')](_0x599c11);}return null;};}function patchUpdates(_0x558280){return function(_0x23959f){try{jsonpatch['apply'](_0x23959f,_0x558280,!![]);}catch(_0x5dcb32){return BPromise[_0x78f5('0x3b')](_0x5dcb32);}return _0x23959f[_0x78f5('0x3c')]();};}function saveUpdates(_0x5eca9f,_0x409617){return function(_0x41ed2a){if(_0x41ed2a){return _0x41ed2a[_0x78f5('0x3d')](_0x5eca9f)[_0x78f5('0x28')](function(_0x775f7c){return _0x775f7c;});}return null;};}function removeEntity(_0x4ee2a9,_0x41c864){return function(_0x3789f3){if(_0x3789f3){return _0x3789f3['destroy']()['then'](function(){_0x4ee2a9[_0x78f5('0x34')](0xcc)[_0x78f5('0x3e')]();});}};}function handleEntityNotFound(_0x20812d,_0x5ae353){return function(_0x2d5c19){if(!_0x2d5c19){_0x20812d[_0x78f5('0x3f')](0x194);}return _0x2d5c19;};}function handleError(_0x330a7a,_0x5c9425){_0x5c9425=_0x5c9425||0x1f4;return function(_0x426d76){logger[_0x78f5('0x2f')](_0x426d76['stack']);if(_0x426d76[_0x78f5('0x40')]){delete _0x426d76[_0x78f5('0x40')];}_0x330a7a[_0x78f5('0x34')](_0x5c9425)[_0x78f5('0x41')](_0x426d76);};}exports['index']=function(_0x12b6e1,_0x44d51f){var _0x454825={},_0x3c6a61={},_0x10522d={'count':0x0,'rows':[]};var _0x37e6c7=_[_0x78f5('0x42')](db['ChatMessage'][_0x78f5('0x43')],function(_0x421d00){return{'name':_0x421d00['fieldName'],'type':_0x421d00[_0x78f5('0x44')][_0x78f5('0x45')]};});_0x3c6a61[_0x78f5('0x46')]=_[_0x78f5('0x42')](_0x37e6c7,_0x78f5('0x40'));_0x3c6a61[_0x78f5('0x47')]=_['keys'](_0x12b6e1[_0x78f5('0x47')]);_0x3c6a61[_0x78f5('0x48')]=_[_0x78f5('0x49')](_0x3c6a61[_0x78f5('0x46')],_0x3c6a61[_0x78f5('0x47')]);_0x454825[_0x78f5('0x4a')]=_[_0x78f5('0x49')](_0x3c6a61[_0x78f5('0x46')],qs[_0x78f5('0x4b')](_0x12b6e1['query'][_0x78f5('0x4b')]));_0x454825['attributes']=_0x454825['attributes']['length']?_0x454825['attributes']:_0x3c6a61[_0x78f5('0x46')];if(!_0x12b6e1[_0x78f5('0x47')][_0x78f5('0x4c')](_0x78f5('0x4d'))){_0x454825[_0x78f5('0x36')]=qs['limit'](_0x12b6e1[_0x78f5('0x47')][_0x78f5('0x36')]);_0x454825[_0x78f5('0x35')]=qs['offset'](_0x12b6e1[_0x78f5('0x47')]['offset']);}_0x454825[_0x78f5('0x4e')]=qs['sort'](_0x12b6e1[_0x78f5('0x47')][_0x78f5('0x4f')]);_0x454825[_0x78f5('0x50')]=qs['filters'](_[_0x78f5('0x51')](_0x12b6e1[_0x78f5('0x47')],_0x3c6a61['filters']),_0x37e6c7);if(_0x12b6e1['query'][_0x78f5('0x52')]){_0x454825[_0x78f5('0x50')]=_[_0x78f5('0x53')](_0x454825[_0x78f5('0x50')],{'$or':_[_0x78f5('0x42')](_0x37e6c7,function(_0x3a5bbb){if(_0x3a5bbb[_0x78f5('0x44')]!==_0x78f5('0x54')){var _0x147b9e={};_0x147b9e[_0x3a5bbb[_0x78f5('0x40')]]={'$like':'%'+_0x12b6e1[_0x78f5('0x47')][_0x78f5('0x52')]+'%'};return _0x147b9e;}})});}_0x454825=_[_0x78f5('0x53')]({},_0x454825,_0x12b6e1[_0x78f5('0x55')]);var _0x52b5ff={'where':_0x454825[_0x78f5('0x50')]};return db[_0x78f5('0x56')][_0x78f5('0x38')](_0x52b5ff)[_0x78f5('0x28')](function(_0x349287){_0x10522d['count']=_0x349287;if(_0x12b6e1[_0x78f5('0x47')][_0x78f5('0x57')]){_0x454825[_0x78f5('0x58')]=[{'all':!![]}];}return db[_0x78f5('0x56')][_0x78f5('0x59')](_0x454825);})['then'](function(_0x48e49b){_0x10522d['rows']=_0x48e49b;return _0x10522d;})[_0x78f5('0x28')](respondWithFilteredResult(_0x44d51f,_0x454825))['catch'](handleError(_0x44d51f,null));};exports['show']=function(_0x8528d,_0x1e4de5){var _0x36bacd={'raw':!![],'where':{'id':_0x8528d[_0x78f5('0x5a')]['id']}},_0x382f81={};_0x382f81['model']=_[_0x78f5('0x5b')](db[_0x78f5('0x56')]['rawAttributes']);_0x382f81['query']=_[_0x78f5('0x5b')](_0x8528d['query']);_0x382f81[_0x78f5('0x48')]=_[_0x78f5('0x49')](_0x382f81[_0x78f5('0x46')],_0x382f81[_0x78f5('0x47')]);_0x36bacd[_0x78f5('0x4a')]=_[_0x78f5('0x49')](_0x382f81[_0x78f5('0x46')],qs[_0x78f5('0x4b')](_0x8528d[_0x78f5('0x47')][_0x78f5('0x4b')]));_0x36bacd[_0x78f5('0x4a')]=_0x36bacd[_0x78f5('0x4a')][_0x78f5('0x5c')]?_0x36bacd['attributes']:_0x382f81[_0x78f5('0x46')];if(_0x8528d[_0x78f5('0x47')]['includeAll']){_0x36bacd[_0x78f5('0x58')]=[{'all':!![]}];}_0x36bacd=_[_0x78f5('0x53')]({},_0x36bacd,_0x8528d[_0x78f5('0x55')]);return db[_0x78f5('0x56')][_0x78f5('0x5d')](_0x36bacd)['then'](handleEntityNotFound(_0x1e4de5,null))[_0x78f5('0x28')](respondWithResult(_0x1e4de5,null))[_0x78f5('0x33')](handleError(_0x1e4de5,null));};exports[_0x78f5('0x5e')]=function(_0x1ebcb7,_0x5e5158){return db[_0x78f5('0x56')][_0x78f5('0x5e')](_0x1ebcb7[_0x78f5('0x5f')],{})[_0x78f5('0x28')](respondWithResult(_0x5e5158,0xc9))[_0x78f5('0x33')](handleError(_0x5e5158,null));};exports[_0x78f5('0x3d')]=function(_0x533dff,_0x2c2364){if(_0x533dff[_0x78f5('0x5f')]['id']){delete _0x533dff[_0x78f5('0x5f')]['id'];}return db[_0x78f5('0x56')][_0x78f5('0x5d')]({'where':{'id':_0x533dff[_0x78f5('0x5a')]['id']}})[_0x78f5('0x28')](handleEntityNotFound(_0x2c2364,null))[_0x78f5('0x28')](saveUpdates(_0x533dff[_0x78f5('0x5f')],null))['then'](respondWithResult(_0x2c2364,null))[_0x78f5('0x33')](handleError(_0x2c2364,null));};exports['destroy']=function(_0x571693,_0x1dcc3d){return db[_0x78f5('0x56')][_0x78f5('0x5d')]({'where':{'id':_0x571693[_0x78f5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1dcc3d,null))[_0x78f5('0x28')](removeEntity(_0x1dcc3d,null))[_0x78f5('0x33')](handleError(_0x1dcc3d,null));};exports[_0x78f5('0x60')]=function(_0x55360b,_0x863c8f){return db['ChatMessage'][_0x78f5('0x60')]()['then'](respondWithResult(_0x863c8f,null))[_0x78f5('0x33')](handleError(_0x863c8f,null));};var interaction_log=require(_0x78f5('0x19'))(_0x78f5('0x61'));exports[_0x78f5('0x62')]=function(_0x186ee3,_0x4d1a5c,_0x2c958d){var _0x26fdcd={'agent':{},'channel':_0x78f5('0x63')};if(_0x186ee3[_0x78f5('0x5f')]['id']){delete _0x186ee3[_0x78f5('0x5f')]['id'];}_0x186ee3[_0x78f5('0x5f')][_0x78f5('0x64')]=!![];_0x186ee3[_0x78f5('0x5f')]['readAt']=moment()[_0x78f5('0x65')](_0x78f5('0x66'));_0x186ee3[_0x78f5('0x5f')][_0x78f5('0x67')]=_0x186ee3[_0x78f5('0x5f')][_0x78f5('0x67')]||_0x186ee3[_0x78f5('0x68')]['id'];_0x26fdcd['agent']['id']=_0x186ee3[_0x78f5('0x5f')][_0x78f5('0x67')];return db['ChatMessage'][_0x78f5('0x5d')]({'where':{'id':_0x186ee3[_0x78f5('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d1a5c,null))[_0x78f5('0x28')](saveUpdates(_0x186ee3['body'],null))[_0x78f5('0x28')](function(_0x3c0f91){if(_0x3c0f91){_0x26fdcd[_0x78f5('0x31')]=_0x3c0f91[_0x78f5('0x69')]({'plain':!![]});return db[_0x78f5('0x6a')][_0x78f5('0x5d')]({'where':{'id':_0x3c0f91[_0x78f5('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x4d1a5c,null))['then'](function(_0x1f2610){if(_0x1f2610){return _0x1f2610['update']({'UserId':_0x186ee3['body'][_0x78f5('0x67')],'read1stAt':_['isNil'](_0x1f2610[_0x78f5('0x6c')])?moment()[_0x78f5('0x65')](_0x78f5('0x66')):undefined});}return null;})[_0x78f5('0x28')](function(_0x2e0ca7){if(_0x2e0ca7){_0x26fdcd[_0x78f5('0x6d')]=_0x2e0ca7[_0x78f5('0x69')]({'plain':!![]});interaction_log[_0x78f5('0x29')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x186ee3[_0x78f5('0x68')]['id'],_0x186ee3[_0x78f5('0x68')][_0x78f5('0x40')],_0x186ee3['user'][_0x78f5('0x6e')],_0x26fdcd[_0x78f5('0x6d')]['id'],_0x186ee3[_0x78f5('0x5f')]?JSON[_0x78f5('0x2e')](_0x186ee3[_0x78f5('0x5f')]):'null');return respondWithRpcPromise(_0x78f5('0x6f'),_0x78f5('0x70'),_0x26fdcd);}return null;})[_0x78f5('0x28')](function(_0x4bdccd){var _0x442a63='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4bdccd['message'][_0x78f5('0x71')];return db[_0x78f5('0x72')][_0x78f5('0x47')](_0x442a63,{'type':db[_0x78f5('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0x78f5('0x28')](function(_0x4b0b93){return _0x4b0b93;});})[_0x78f5('0x28')](function(_0x24ddb5){if(_0x24ddb5){_0x26fdcd['message']['contact']=_0x24ddb5[0x0];if(!_0x186ee3[_0x78f5('0x5f')]['UserId'])return;return db[_0x78f5('0x74')][_0x78f5('0x5d')]({'where':{'id':_0x186ee3[_0x78f5('0x5f')]['UserId'],'role':_0x78f5('0x75')},'attributes':['id',_0x78f5('0x40'),_0x78f5('0x76'),_0x78f5('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x396a62){if(!_0x396a62)return null;_0x26fdcd[_0x78f5('0x31')][_0x78f5('0x75')]=_0x396a62;return _0x26fdcd;})[_0x78f5('0x28')](function(_0xb41502){if(_0xb41502){if(_0x186ee3[_0x78f5('0x5f')][_0x78f5('0x78')]){_0x26fdcd[_0x78f5('0x31')][_0x78f5('0x79')]=util['format']('SIP/%s',_0x186ee3['user']['name']);_0x26fdcd[_0x78f5('0x31')]['channel']=_0x26fdcd[_0x78f5('0x7a')];_0x26fdcd[_0x78f5('0x31')]['motionChannel']=_0x26fdcd[_0x78f5('0x7a')];_0x26fdcd['message'][_0x78f5('0x7b')]=_0x78f5('0x62');return respondWithRpcPromise(_0x78f5('0x7c'),_0x78f5('0x7c'),{'event':'acceptmessage','message':_['merge'](_0x26fdcd[_0x78f5('0x31')],JSON['parse'](_0x26fdcd[_0x78f5('0x6d')][_0x78f5('0x7d')]))},client9002)[_0x78f5('0x28')](function(){return _0x26fdcd;});}return _0x26fdcd;}return null;})[_0x78f5('0x28')](respondWithResult(_0x4d1a5c,null))[_0x78f5('0x33')](handleError(_0x4d1a5c,null));};var interaction_log=require(_0x78f5('0x19'))(_0x78f5('0x61'));exports[_0x78f5('0x3b')]=function(_0x35799a,_0x500c3d,_0x7c1ae6){var _0x17ff1b={'agent':{},'channel':_0x78f5('0x63')};if(_0x35799a[_0x78f5('0x5f')]['id']){delete _0x35799a['body']['id'];}_0x35799a['body'][_0x78f5('0x67')]=_0x35799a[_0x78f5('0x5f')][_0x78f5('0x67')]||_0x35799a[_0x78f5('0x68')]['id'];_0x17ff1b[_0x78f5('0x75')]['id']=_0x35799a['body'][_0x78f5('0x67')];return db['ChatMessage']['find']({'where':{'id':_0x35799a['params']['id'],'UserId':null}})[_0x78f5('0x28')](handleEntityNotFound(_0x500c3d,null))[_0x78f5('0x28')](function(_0x97736f){if(_0x97736f){_0x17ff1b[_0x78f5('0x31')]=_0x97736f[_0x78f5('0x69')]({'plain':!![]});return db[_0x78f5('0x6a')][_0x78f5('0x5d')]({'where':{'id':_0x97736f['ChatInteractionId']}});}return null;})[_0x78f5('0x28')](handleEntityNotFound(_0x500c3d,null))['then'](function(_0x44da86){if(_0x44da86){_0x17ff1b[_0x78f5('0x6d')]=_0x44da86[_0x78f5('0x69')]({'plain':!![]});interaction_log[_0x78f5('0x29')](_0x78f5('0x7e'),_0x35799a[_0x78f5('0x68')]['id'],_0x35799a['user'][_0x78f5('0x40')],_0x35799a['user'][_0x78f5('0x6e')],_0x17ff1b[_0x78f5('0x6d')]['id'],_0x35799a[_0x78f5('0x5f')]?JSON['stringify'](_0x35799a[_0x78f5('0x5f')]):_0x78f5('0x7f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x17ff1b);}return null;})[_0x78f5('0x28')](function(_0xecbde5){var _0x1f872e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xecbde5['message'][_0x78f5('0x71')];return db['sequelize'][_0x78f5('0x47')](_0x1f872e,{'type':db[_0x78f5('0x73')][_0x78f5('0x80')]['SELECT'],'raw':!![]})[_0x78f5('0x28')](function(_0x2968d0){return _0x2968d0;});})['then'](function(_0x54c6bd){if(_0x54c6bd){_0x17ff1b[_0x78f5('0x31')][_0x78f5('0x81')]=_0x54c6bd[0x0];if(!_0x35799a[_0x78f5('0x5f')][_0x78f5('0x67')])return;return db['User']['find']({'where':{'id':_0x35799a['body'][_0x78f5('0x67')],'role':_0x78f5('0x75')},'attributes':['id',_0x78f5('0x40'),_0x78f5('0x76'),_0x78f5('0x77'),'internal'],'raw':!![]});}return null;})[_0x78f5('0x28')](function(_0x307265){if(!_0x307265)return null;_0x17ff1b[_0x78f5('0x31')][_0x78f5('0x75')]=_0x307265;return _0x17ff1b;})[_0x78f5('0x28')](function(_0x4f3769){if(_0x4f3769){_0x4f3769['message'][_0x78f5('0x79')]=util[_0x78f5('0x65')](_0x78f5('0x82'),_0x35799a[_0x78f5('0x68')][_0x78f5('0x40')]);_0x4f3769[_0x78f5('0x31')][_0x78f5('0x7a')]=_0x17ff1b[_0x78f5('0x7a')];_0x4f3769[_0x78f5('0x31')][_0x78f5('0x83')]=_0x17ff1b[_0x78f5('0x7a')];_0x4f3769[_0x78f5('0x31')][_0x78f5('0x7b')]=_0x78f5('0x3b');respondWithRpcPromise(_0x78f5('0x7c'),'EventManager',{'event':_0x78f5('0x84'),'message':_[_0x78f5('0x53')](_0x17ff1b[_0x78f5('0x31')],JSON[_0x78f5('0x85')](_0x17ff1b['interaction'][_0x78f5('0x7d')]))},client9002);return _0x17ff1b;}return null;})[_0x78f5('0x28')](respondWithResult(_0x500c3d,null))[_0x78f5('0x33')](handleError(_0x500c3d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 259134b..f8e95c7 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 _0x4bef=['events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1ce919,_0x1bbb96){var _0x34ec94=function(_0x3f7a6f){while(--_0x3f7a6f){_0x1ce919['push'](_0x1ce919['shift']());}};_0x34ec94(++_0x1bbb96);}(_0x4bef,0x82));var _0xf4be=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x4bef[_0x8b8564];return _0x360c61;};'use strict';var EventEmitter=require(_0xf4be('0x0'));var ChatMessage=require(_0xf4be('0x1'))['db'][_0xf4be('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf4be('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4be('0x4'),'afterDestroy':_0xf4be('0x5')};function emitEvent(_0x5920f1){return function(_0x94fa24,_0x10b8f1,_0x170be8){ChatMessageEvents[_0xf4be('0x6')](_0x5920f1+':'+_0x94fa24['id'],_0x94fa24);ChatMessageEvents[_0xf4be('0x6')](_0x5920f1,_0x94fa24);_0x170be8(null);};}for(var e in events){if(events[_0xf4be('0x7')](e)){var event=events[e];ChatMessage[_0xf4be('0x8')](e,emitEvent(event));}}module[_0xf4be('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x5232=['../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x5232,0x171));var _0x2523=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x5232[_0x4605dc];return _0x5d3e81;};'use strict';var EventEmitter=require(_0x2523('0x0'));var ChatMessage=require(_0x2523('0x1'))['db'][_0x2523('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2523('0x3')](0x0);var events={'afterCreate':_0x2523('0x4'),'afterUpdate':'update','afterDestroy':_0x2523('0x5')};function emitEvent(_0x541d6e){return function(_0x5a14ac,_0x1a34ad,_0x4c9c1f){ChatMessageEvents[_0x2523('0x6')](_0x541d6e+':'+_0x5a14ac['id'],_0x5a14ac);ChatMessageEvents[_0x2523('0x6')](_0x541d6e,_0x5a14ac);_0x4c9c1f(null);};}for(var e in events){if(events[_0x2523('0x7')](e)){var event=events[e];ChatMessage[_0x2523('0x8')](e,emitEvent(event));}}module[_0x2523('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 8359650..7dc4285 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 _0x8796=['error','utf8mb4','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch'];(function(_0x98ee7c,_0x499bff){var _0xe4d709=function(_0x12791a){while(--_0x12791a){_0x98ee7c['push'](_0x98ee7c['shift']());}};_0xe4d709(++_0x499bff);}(_0x8796,0xcd));var _0x6879=function(_0x3d5416,_0x28a599){_0x3d5416=_0x3d5416-0x0;var _0x17712c=_0x8796[_0x3d5416];return _0x17712c;};'use strict';var _=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var logger=require(_0x6879('0x2'))(_0x6879('0x3'));var moment=require('moment');var BPromise=require(_0x6879('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6879('0x5'));var config=require(_0x6879('0x6'));var attributes=require(_0x6879('0x7'));module[_0x6879('0x8')]=function(_0x505d7e,_0x3ecef8){return _0x505d7e[_0x6879('0x9')](_0x6879('0xa'),attributes,{'tableName':_0x6879('0xb'),'paranoid':![],'indexes':[{'name':_0x6879('0xc'),'fields':[_0x6879('0xd')],'type':_0x6879('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32886e,_0x15fd3e,_0x1c718b){var _0x5e731c=_0x505d7e[_0x6879('0xf')];var _0xa9aceb=_0x32886e['get']({'plain':!![]});if(_0xa9aceb[_0x6879('0x10')][_0x6879('0x11')]()==='in'||_0xa9aceb[_0x6879('0x10')][_0x6879('0x11')]()==='out'&&!_0xa9aceb[_0x6879('0x12')]&&!_[_0x6879('0x13')](_0xa9aceb[_0x6879('0x14')])){_0x5e731c[_0x6879('0x15')][_0x6879('0x16')]({'where':{'id':_0xa9aceb[_0x6879('0x17')]}})[_0x6879('0x18')](function(_0x4edb5d){if(_0x4edb5d){_0x4edb5d['update']({'lastMsgAt':_0xa9aceb[_0x6879('0x19')],'lastMsgDirection':_0xa9aceb[_0x6879('0x10')][_0x6879('0x11')]()});}})[_0x6879('0x1a')](function(_0x15dc85){console[_0x6879('0x1b')](_0x15dc85);});}_0x1c718b();}},'charset':_0x6879('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x39d5=['update','createdAt','catch','error','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction'];(function(_0x70bb8,_0x1da278){var _0x48ba84=function(_0xb567b9){while(--_0xb567b9){_0x70bb8['push'](_0x70bb8['shift']());}};_0x48ba84(++_0x1da278);}(_0x39d5,0x11c));var _0x539d=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x39d5[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x539d('0x0'));var util=require(_0x539d('0x1'));var logger=require(_0x539d('0x2'))(_0x539d('0x3'));var moment=require(_0x539d('0x4'));var BPromise=require('bluebird');var rp=require(_0x539d('0x5'));var fs=require('fs');var path=require(_0x539d('0x6'));var rimraf=require(_0x539d('0x7'));var config=require(_0x539d('0x8'));var attributes=require(_0x539d('0x9'));module[_0x539d('0xa')]=function(_0x1f86e4,_0x4f7097){return _0x1f86e4[_0x539d('0xb')]('ChatMessage',attributes,{'tableName':_0x539d('0xc'),'paranoid':![],'indexes':[{'name':_0x539d('0xd'),'fields':[_0x539d('0xe')],'type':_0x539d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57d6a8,_0x4abb66,_0x226144){var _0x31b577=_0x1f86e4[_0x539d('0x10')];var _0x548f93=_0x57d6a8[_0x539d('0x11')]({'plain':!![]});if(_0x548f93[_0x539d('0x12')][_0x539d('0x13')]()==='in'||_0x548f93[_0x539d('0x12')]['toLowerCase']()===_0x539d('0x14')&&!_0x548f93[_0x539d('0x15')]&&!_['isNil'](_0x548f93[_0x539d('0x16')])){_0x31b577[_0x539d('0x17')]['findOne']({'where':{'id':_0x548f93['ChatInteractionId']}})['then'](function(_0x559b1c){if(_0x559b1c){_0x559b1c[_0x539d('0x18')]({'lastMsgAt':_0x548f93[_0x539d('0x19')],'lastMsgDirection':_0x548f93[_0x539d('0x12')]['toLowerCase']()});}})[_0x539d('0x1a')](function(_0x2c77c4){console[_0x539d('0x1b')](_0x2c77c4);});}_0x226144();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bf2c235..7f4e641 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 _0x6f7a=['request','then','info','ChatMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateChatMessage','ChatMessage','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x6f7a,0x117));var _0xa6f7=function(_0xcdf41,_0x3abe4f){_0xcdf41=_0xcdf41-0x0;var _0x457537=_0x6f7a[_0xcdf41];return _0x457537;};'use strict';var _=require('lodash');var util=require(_0xa6f7('0x0'));var moment=require(_0xa6f7('0x1'));var BPromise=require(_0xa6f7('0x2'));var rs=require(_0xa6f7('0x3'));var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6f7('0x5'));var logger=require(_0xa6f7('0x6'))(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var jayson=require(_0xa6f7('0x9'));var client=jayson[_0xa6f7('0xa')][_0xa6f7('0xb')]({'port':0x232a});config[_0xa6f7('0xc')]=_[_0xa6f7('0xd')](config[_0xa6f7('0xc')],{'host':_0xa6f7('0xe'),'port':0x18eb});var socket=require(_0xa6f7('0xf'))(new Redis(config['redis']));require(_0xa6f7('0x10'))[_0xa6f7('0x11')](socket);function respondWithRpcPromise(_0x4f0b3d,_0x1fa009,_0xc430ca){return new BPromise(function(_0x3be18a,_0x13d6e3){return client[_0xa6f7('0x12')](_0x4f0b3d,_0xc430ca)[_0xa6f7('0x13')](function(_0x341b48){logger[_0xa6f7('0x14')](_0xa6f7('0x15'),_0x1fa009,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1fa009,'request\x20sent',JSON[_0xa6f7('0x16')](_0x341b48));if(_0x341b48[_0xa6f7('0x17')]){if(_0x341b48[_0xa6f7('0x17')][_0xa6f7('0x18')]===0x1f4){logger[_0xa6f7('0x17')](_0xa6f7('0x15'),_0x1fa009,_0x341b48['error']['message']);return _0x13d6e3(_0x341b48['error'][_0xa6f7('0x19')]);}logger[_0xa6f7('0x17')](_0xa6f7('0x15'),_0x1fa009,_0x341b48[_0xa6f7('0x17')]['message']);return _0x3be18a(_0x341b48[_0xa6f7('0x17')][_0xa6f7('0x19')]);}else{logger['info'](_0xa6f7('0x15'),_0x1fa009,_0xa6f7('0x1a'));_0x3be18a(_0x341b48['result'][_0xa6f7('0x19')]);}})[_0xa6f7('0x1b')](function(_0xa72087){logger[_0xa6f7('0x17')]('ChatMessage,\x20%s,\x20%s',_0x1fa009,_0xa72087);_0x13d6e3(_0xa72087);});});}exports[_0xa6f7('0x1c')]=function(_0x55957b){var _0x57d4f2=this;return new Promise(function(_0x30752c,_0x2907aa){return db[_0xa6f7('0x1d')][_0xa6f7('0x1e')](_0x55957b['body'],{'raw':_0x55957b[_0xa6f7('0x1f')]?_0x55957b['options'][_0xa6f7('0x20')]===undefined?!![]:![]:!![]})[_0xa6f7('0x13')](function(_0x2eaeaa){logger[_0xa6f7('0x14')](_0xa6f7('0x1c'),_0x55957b);logger['debug']('CreateChatMessage',_0x55957b,JSON[_0xa6f7('0x16')](_0x2eaeaa));_0x30752c(_0x2eaeaa);})[_0xa6f7('0x1b')](function(_0x326fc4){logger[_0xa6f7('0x17')](_0xa6f7('0x1c'),_0x326fc4['message'],_0x55957b);_0x2907aa(_0x57d4f2[_0xa6f7('0x17')](0x1f4,_0x326fc4[_0xa6f7('0x19')]));});});}; \ No newline at end of file +var _0x46e4=['./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateChatMessage','ChatMessage','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x498226,_0x139ddb){var _0x3a13d7=function(_0x257dc7){while(--_0x257dc7){_0x498226['push'](_0x498226['shift']());}};_0x3a13d7(++_0x139ddb);}(_0x46e4,0xdd));var _0x446e=function(_0xcc26d2,_0x20c921){_0xcc26d2=_0xcc26d2-0x0;var _0x3841e2=_0x46e4[_0xcc26d2];return _0x3841e2;};'use strict';var _=require(_0x446e('0x0'));var util=require('util');var moment=require(_0x446e('0x1'));var BPromise=require(_0x446e('0x2'));var rs=require(_0x446e('0x3'));var fs=require('fs');var Redis=require(_0x446e('0x4'));var db=require(_0x446e('0x5'))['db'];var utils=require(_0x446e('0x6'));var logger=require(_0x446e('0x7'))(_0x446e('0x8'));var config=require(_0x446e('0x9'));var jayson=require(_0x446e('0xa'));var client=jayson[_0x446e('0xb')][_0x446e('0xc')]({'port':0x232a});config[_0x446e('0xd')]=_[_0x446e('0xe')](config[_0x446e('0xd')],{'host':_0x446e('0xf'),'port':0x18eb});var socket=require(_0x446e('0x10'))(new Redis(config[_0x446e('0xd')]));require(_0x446e('0x11'))['register'](socket);function respondWithRpcPromise(_0x5da6cb,_0x49c3dc,_0x11ebe5){return new BPromise(function(_0x590708,_0x202c9a){return client[_0x446e('0x12')](_0x5da6cb,_0x11ebe5)[_0x446e('0x13')](function(_0x28ae1d){logger['info'](_0x446e('0x14'),_0x49c3dc,_0x446e('0x15'));logger[_0x446e('0x16')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x49c3dc,_0x446e('0x15'),JSON[_0x446e('0x17')](_0x28ae1d));if(_0x28ae1d[_0x446e('0x18')]){if(_0x28ae1d[_0x446e('0x18')]['code']===0x1f4){logger[_0x446e('0x18')](_0x446e('0x14'),_0x49c3dc,_0x28ae1d[_0x446e('0x18')][_0x446e('0x19')]);return _0x202c9a(_0x28ae1d['error'][_0x446e('0x19')]);}logger['error'](_0x446e('0x14'),_0x49c3dc,_0x28ae1d[_0x446e('0x18')][_0x446e('0x19')]);return _0x590708(_0x28ae1d[_0x446e('0x18')][_0x446e('0x19')]);}else{logger[_0x446e('0x1a')](_0x446e('0x14'),_0x49c3dc,_0x446e('0x15'));_0x590708(_0x28ae1d[_0x446e('0x1b')][_0x446e('0x19')]);}})[_0x446e('0x1c')](function(_0x3bfcdb){logger[_0x446e('0x18')](_0x446e('0x14'),_0x49c3dc,_0x3bfcdb);_0x202c9a(_0x3bfcdb);});});}exports[_0x446e('0x1d')]=function(_0x249b04){var _0x170776=this;return new Promise(function(_0x489950,_0x33b7fa){return db[_0x446e('0x1e')]['create'](_0x249b04[_0x446e('0x1f')],{'raw':_0x249b04['options']?_0x249b04[_0x446e('0x20')][_0x446e('0x21')]===undefined?!![]:![]:!![]})[_0x446e('0x13')](function(_0x2f63cc){logger['info'](_0x446e('0x1d'),_0x249b04);logger[_0x446e('0x16')](_0x446e('0x1d'),_0x249b04,JSON[_0x446e('0x17')](_0x2f63cc));_0x489950(_0x2f63cc);})['catch'](function(_0x1e836d){logger[_0x446e('0x18')](_0x446e('0x1d'),_0x1e836d[_0x446e('0x19')],_0x249b04);_0x33b7fa(_0x170776[_0x446e('0x18')](0x1f4,_0x1e836d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 19469e9..28bfa2c 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 _0x2123=['./chatMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x15b3d6,_0x3dc9ac){var _0x4c124a=function(_0x1b7ba4){while(--_0x1b7ba4){_0x15b3d6['push'](_0x15b3d6['shift']());}};_0x4c124a(++_0x3dc9ac);}(_0x2123,0x190));var _0x3212=function(_0x3e84f0,_0x447cf5){_0x3e84f0=_0x3e84f0-0x0;var _0x49165f=_0x2123[_0x3e84f0];return _0x49165f;};'use strict';var ChatMessageEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x7158b8,_0x2ff863){return function(_0x8c047){_0x2ff863[_0x3212('0x4')](_0x7158b8,_0x8c047);};}function removeListener(_0x304f80,_0x6ca653){return function(){ChatMessageEvents[_0x3212('0x5')](_0x304f80,_0x6ca653);};}exports[_0x3212('0x6')]=function(_0x5d9d36){for(var _0x3859e4=0x0,_0x2b1302=events[_0x3212('0x7')];_0x3859e4<_0x2b1302;_0x3859e4++){var _0x4b35e9=events[_0x3859e4];var _0x3e17a3=createListener('chatMessage:'+_0x4b35e9,_0x5d9d36);ChatMessageEvents['on'](_0x4b35e9,_0x3e17a3);}}; \ No newline at end of file +var _0x0a52=['removeListener','register','length','chatMessage:','./chatMessage.events','save','update','emit'];(function(_0x8f528e,_0x54e531){var _0x412176=function(_0x542d2e){while(--_0x542d2e){_0x8f528e['push'](_0x8f528e['shift']());}};_0x412176(++_0x54e531);}(_0x0a52,0xe4));var _0x20a5=function(_0x88087e,_0x318a01){_0x88087e=_0x88087e-0x0;var _0x354d9e=_0x0a52[_0x88087e];return _0x354d9e;};'use strict';var ChatMessageEvents=require(_0x20a5('0x0'));var events=[_0x20a5('0x1'),'remove',_0x20a5('0x2')];function createListener(_0x396070,_0xe4dbc9){return function(_0x5a71da){_0xe4dbc9[_0x20a5('0x3')](_0x396070,_0x5a71da);};}function removeListener(_0x16e604,_0x243305){return function(){ChatMessageEvents[_0x20a5('0x4')](_0x16e604,_0x243305);};}exports[_0x20a5('0x5')]=function(_0x1fcc72){for(var _0x4acc66=0x0,_0x56b172=events[_0x20a5('0x6')];_0x4acc66<_0x56b172;_0x4acc66++){var _0x1f44fd=events[_0x4acc66];var _0x478779=createListener(_0x20a5('0x7')+_0x1f44fd,_0x1fcc72);ChatMessageEvents['on'](_0x1f44fd,_0x478779);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 74c5059..03e9cd9 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 _0x45e3=['index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0xb98d8d,_0x481423){var _0x489b15=function(_0x409a13){while(--_0x409a13){_0xb98d8d['push'](_0xb98d8d['shift']());}};_0x489b15(++_0x481423);}(_0x45e3,0x145));var _0x345e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x45e3[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x345e('0x0'));var util=require(_0x345e('0x1'));var path=require(_0x345e('0x2'));var timeout=require(_0x345e('0x3'));var express=require(_0x345e('0x4'));var router=express[_0x345e('0x5')]();var fs_extra=require(_0x345e('0x6'));var auth=require(_0x345e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x345e('0x8'));var controller=require('./chatMessage.controller');router[_0x345e('0x9')]('/',auth[_0x345e('0xa')](),controller[_0x345e('0xb')]);router[_0x345e('0x9')](_0x345e('0xc'),auth[_0x345e('0xa')](),controller[_0x345e('0xd')]);router[_0x345e('0x9')](_0x345e('0xe'),auth['isAuthenticated'](),controller[_0x345e('0xf')]);router[_0x345e('0x10')]('/',auth[_0x345e('0xa')](),interaction['tracked'](_0x345e('0x11'),_0x345e('0x12')),controller[_0x345e('0x13')]);router[_0x345e('0x14')]('/:id',controller[_0x345e('0x15')]);router[_0x345e('0x14')](_0x345e('0x16'),auth[_0x345e('0xa')](),controller[_0x345e('0x17')]);router[_0x345e('0x14')](_0x345e('0x18'),auth[_0x345e('0xa')](),controller[_0x345e('0x19')]);router['delete'](_0x345e('0xe'),auth[_0x345e('0xa')](),controller[_0x345e('0x1a')]);module[_0x345e('0x1b')]=router; \ No newline at end of file +var _0x440c=['express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x29cc33,_0x2ed3ec){var _0x21c25a=function(_0x26d513){while(--_0x26d513){_0x29cc33['push'](_0x29cc33['shift']());}};_0x21c25a(++_0x2ed3ec);}(_0x440c,0xc0));var _0xc440=function(_0x693387,_0x5e058a){_0x693387=_0x693387-0x0;var _0x5365e4=_0x440c[_0x693387];return _0x5365e4;};'use strict';var multer=require(_0xc440('0x0'));var util=require(_0xc440('0x1'));var path=require(_0xc440('0x2'));var timeout=require(_0xc440('0x3'));var express=require(_0xc440('0x4'));var router=express[_0xc440('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc440('0x6'));var config=require(_0xc440('0x7'));var controller=require(_0xc440('0x8'));router[_0xc440('0x9')]('/',auth[_0xc440('0xa')](),controller[_0xc440('0xb')]);router['get'](_0xc440('0xc'),auth['isAuthenticated'](),controller[_0xc440('0xd')]);router[_0xc440('0x9')](_0xc440('0xe'),auth[_0xc440('0xa')](),controller[_0xc440('0xf')]);router[_0xc440('0x10')]('/',auth[_0xc440('0xa')](),interaction[_0xc440('0x11')](_0xc440('0x12'),_0xc440('0x13')),controller[_0xc440('0x14')]);router[_0xc440('0x15')](_0xc440('0xe'),controller['update']);router[_0xc440('0x15')](_0xc440('0x16'),auth[_0xc440('0xa')](),controller[_0xc440('0x17')]);router['put']('/:id/reject',auth[_0xc440('0xa')](),controller[_0xc440('0x18')]);router[_0xc440('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xc440('0x1a')]);module[_0xc440('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ef47712..9b4f7ab 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['medium','TEXT','exports'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xadb5,0xad));var _0x5adb=function(_0x21a5d3,_0x3dcffd){_0x21a5d3=_0x21a5d3-0x0;var _0x3dfc60=_0xadb5[_0x21a5d3];return _0x3dfc60;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0xa24f2c,_0x1b6950){var _0x1ad53c=function(_0x3c00e7){while(--_0x3c00e7){_0xa24f2c['push'](_0xa24f2c['shift']());}};_0x1ad53c(++_0x1b6950);}(_0xadb5,0xad));var _0x5adb=function(_0x3ffa3d,_0x9d0612){_0x3ffa3d=_0x3ffa3d-0x0;var _0x1766ed=_0xadb5[_0x3ffa3d];return _0x1766ed;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 7497e00..2af5d4d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x375db0,_0xec03ce){var _0x1eaf0c=function(_0x3b3c52){while(--_0x3b3c52){_0x375db0['push'](_0x375db0['shift']());}};_0x1eaf0c(++_0xec03ce);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7a54,0x106));var _0x47a5=function(_0x2414c9,_0x342924){_0x2414c9=_0x2414c9-0x0;var _0x6797eb=_0x7a54[_0x2414c9];return _0x6797eb;};'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 b33cfe1..d867c13 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 _0x4b66=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x1dad92,_0x2f948c){var _0x90a9f6=function(_0x5644db){while(--_0x5644db){_0x1dad92['push'](_0x1dad92['shift']());}};_0x90a9f6(++_0x2f948c);}(_0x4b66,0x1dc));var _0x64b6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4b66[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x64b6('0x0'));var ChatOfflineMessage=require(_0x64b6('0x1'))['db'][_0x64b6('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x64b6('0x3')](0x0);var events={'afterCreate':_0x64b6('0x4'),'afterUpdate':_0x64b6('0x5'),'afterDestroy':_0x64b6('0x6')};function emitEvent(_0x8d82d1){return function(_0xa00e7f,_0xf885f2,_0x4780bd){ChatOfflineMessageEvents[_0x64b6('0x7')](_0x8d82d1+':'+_0xa00e7f['id'],_0xa00e7f);ChatOfflineMessageEvents[_0x64b6('0x7')](_0x8d82d1,_0xa00e7f);_0x4780bd(null);};}for(var e in events){if(events[_0x64b6('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x64b6('0x9')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xe6b4=['hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe6b4,0x188));var _0x4e6b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe6b4[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x4e6b('0x0'));var ChatOfflineMessage=require(_0x4e6b('0x1'))['db'][_0x4e6b('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4e6b('0x3')](0x0);var events={'afterCreate':_0x4e6b('0x4'),'afterUpdate':_0x4e6b('0x5'),'afterDestroy':_0x4e6b('0x6')};function emitEvent(_0x5abac4){return function(_0x3b143f,_0x5aebd2,_0x44e2eb){ChatOfflineMessageEvents[_0x4e6b('0x7')](_0x5abac4+':'+_0x3b143f['id'],_0x3b143f);ChatOfflineMessageEvents[_0x4e6b('0x7')](_0x5abac4,_0x3b143f);_0x44e2eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x4e6b('0x8')](e,emitEvent(event));}}module[_0x4e6b('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index cf4faba..2f439cd 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 _0xd235=['ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define'];(function(_0x18703c,_0x125f2a){var _0x29d475=function(_0x156808){while(--_0x156808){_0x18703c['push'](_0x18703c['shift']());}};_0x29d475(++_0x125f2a);}(_0xd235,0x177));var _0x5d23=function(_0x479eca,_0x4aa570){_0x479eca=_0x479eca-0x0;var _0x30ccaf=_0xd235[_0x479eca];return _0x30ccaf;};'use strict';var attributes=require(_0x5d23('0x0'));module[_0x5d23('0x1')]=function(_0x3f7da6){return _0x3f7da6[_0x5d23('0x2')](_0x5d23('0x3'),attributes,{'tableName':_0x5d23('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d23('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7440=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x7440,0xf9));var _0x0744=function(_0x1e9154,_0x51946f){_0x1e9154=_0x1e9154-0x0;var _0x40bb76=_0x7440[_0x1e9154];return _0x40bb76;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x0744('0x0')]=function(_0x5d90f0){return _0x5d90f0[_0x0744('0x1')](_0x0744('0x2'),attributes,{'tableName':_0x0744('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0744('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f821cd9..6c0f658 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 _0xb681=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0xb681,0x153));var _0x1b68=function(_0x27b436,_0x5b1fc3){_0x27b436=_0x27b436-0x0;var _0x1e2f0f=_0xb681[_0x27b436];return _0x1e2f0f;};'use strict';var _=require(_0x1b68('0x0'));var util=require(_0x1b68('0x1'));var moment=require(_0x1b68('0x2'));var BPromise=require(_0x1b68('0x3'));var rs=require(_0x1b68('0x4'));var fs=require('fs');var Redis=require(_0x1b68('0x5'));var db=require(_0x1b68('0x6'))['db'];var utils=require(_0x1b68('0x7'));var logger=require(_0x1b68('0x8'))(_0x1b68('0x9'));var config=require('../../config/environment');var jayson=require(_0x1b68('0xa'));var client=jayson['client'][_0x1b68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x103d40,_0x1166ab,_0x536e88){return new BPromise(function(_0x5b3ebb,_0x54c76f){return client['request'](_0x103d40,_0x536e88)['then'](function(_0x1f0f1b){logger[_0x1b68('0xc')](_0x1b68('0xd'),_0x1166ab,_0x1b68('0xe'));logger[_0x1b68('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1166ab,_0x1b68('0xe'),JSON['stringify'](_0x1f0f1b));if(_0x1f0f1b[_0x1b68('0x10')]){if(_0x1f0f1b[_0x1b68('0x10')][_0x1b68('0x11')]===0x1f4){logger[_0x1b68('0x10')](_0x1b68('0xd'),_0x1166ab,_0x1f0f1b[_0x1b68('0x10')][_0x1b68('0x12')]);return _0x54c76f(_0x1f0f1b[_0x1b68('0x10')][_0x1b68('0x12')]);}logger[_0x1b68('0x10')](_0x1b68('0xd'),_0x1166ab,_0x1f0f1b[_0x1b68('0x10')][_0x1b68('0x12')]);return _0x5b3ebb(_0x1f0f1b[_0x1b68('0x10')][_0x1b68('0x12')]);}else{logger['info'](_0x1b68('0xd'),_0x1166ab,_0x1b68('0xe'));_0x5b3ebb(_0x1f0f1b[_0x1b68('0x13')][_0x1b68('0x12')]);}})[_0x1b68('0x14')](function(_0x2255cf){logger[_0x1b68('0x10')](_0x1b68('0xd'),_0x1166ab,_0x2255cf);_0x54c76f(_0x2255cf);});});} \ No newline at end of file +var _0x1ed1=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1ed1,0x134));var _0x11ed=function(_0x36a7e1,_0x13f911){_0x36a7e1=_0x36a7e1-0x0;var _0x21dd47=_0x1ed1[_0x36a7e1];return _0x21dd47;};'use strict';var _=require(_0x11ed('0x0'));var util=require('util');var moment=require(_0x11ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x11ed('0x2'));var fs=require('fs');var Redis=require(_0x11ed('0x3'));var db=require(_0x11ed('0x4'))['db'];var utils=require(_0x11ed('0x5'));var logger=require(_0x11ed('0x6'))('rpc');var config=require(_0x11ed('0x7'));var jayson=require(_0x11ed('0x8'));var client=jayson[_0x11ed('0x9')][_0x11ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e632,_0x490a26,_0x391846){return new BPromise(function(_0x135b0d,_0x353472){return client['request'](_0x19e632,_0x391846)[_0x11ed('0xb')](function(_0xd9e012){logger['info'](_0x11ed('0xc'),_0x490a26,_0x11ed('0xd'));logger['debug'](_0x11ed('0xe'),_0x490a26,_0x11ed('0xd'),JSON[_0x11ed('0xf')](_0xd9e012));if(_0xd9e012[_0x11ed('0x10')]){if(_0xd9e012[_0x11ed('0x10')][_0x11ed('0x11')]===0x1f4){logger[_0x11ed('0x10')](_0x11ed('0xc'),_0x490a26,_0xd9e012[_0x11ed('0x10')][_0x11ed('0x12')]);return _0x353472(_0xd9e012[_0x11ed('0x10')]['message']);}logger[_0x11ed('0x10')](_0x11ed('0xc'),_0x490a26,_0xd9e012[_0x11ed('0x10')][_0x11ed('0x12')]);return _0x135b0d(_0xd9e012['error'][_0x11ed('0x12')]);}else{logger[_0x11ed('0x13')](_0x11ed('0xc'),_0x490a26,'request\x20sent');_0x135b0d(_0xd9e012[_0x11ed('0x14')][_0x11ed('0x12')]);}})[_0x11ed('0x15')](function(_0x12d2b6){logger[_0x11ed('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x490a26,_0x12d2b6);_0x353472(_0x12d2b6);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 55f63a4..35a166e 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 _0xec87=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xec87,0x19b));var _0x7ec8=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0xec87[_0x52c4e9];return _0x252a03;};'use strict';var multer=require(_0x7ec8('0x0'));var util=require(_0x7ec8('0x1'));var path=require(_0x7ec8('0x2'));var timeout=require(_0x7ec8('0x3'));var express=require(_0x7ec8('0x4'));var router=express[_0x7ec8('0x5')]();var fs_extra=require(_0x7ec8('0x6'));var auth=require(_0x7ec8('0x7'));var interaction=require(_0x7ec8('0x8'));var config=require(_0x7ec8('0x9'));var controller=require(_0x7ec8('0xa'));router[_0x7ec8('0xb')]('/',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0xd')]);router[_0x7ec8('0xb')](_0x7ec8('0xe'),auth[_0x7ec8('0xc')](),controller[_0x7ec8('0xf')]);router[_0x7ec8('0xb')](_0x7ec8('0x10'),auth['isAuthenticated'](),controller[_0x7ec8('0x11')]);router[_0x7ec8('0x12')]('/',auth[_0x7ec8('0xc')](),controller['create']);router[_0x7ec8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7ec8('0x14')]);router['delete']('/:id',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0x15')]);module[_0x7ec8('0x16')]=router; \ No newline at end of file +var _0x4001=['express','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy','connect-timeout'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0x4001,0x99));var _0x1400=function(_0x552192,_0x4d9370){_0x552192=_0x552192-0x0;var _0x6b7953=_0x4001[_0x552192];return _0x6b7953;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1400('0x0'));var express=require(_0x1400('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1400('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1400('0x3'));router[_0x1400('0x4')]('/',auth[_0x1400('0x5')](),controller[_0x1400('0x6')]);router[_0x1400('0x4')](_0x1400('0x7'),auth[_0x1400('0x5')](),controller[_0x1400('0x8')]);router['get'](_0x1400('0x9'),auth[_0x1400('0x5')](),controller[_0x1400('0xa')]);router[_0x1400('0xb')]('/',auth['isAuthenticated'](),controller[_0x1400('0xc')]);router['put'](_0x1400('0x9'),auth[_0x1400('0x5')](),controller['update']);router['delete'](_0x1400('0x9'),auth[_0x1400('0x5')](),controller[_0x1400('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 24cf100..e415df7 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 _0x69e7=['ENUM','mouseOver','timeout','STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69e7,0x11c));var _0x769e=function(_0x5e66b0,_0x5bef62){_0x5e66b0=_0x5e66b0-0x0;var _0x9a3372=_0x69e7[_0x5e66b0];return _0x9a3372;};'use strict';var Sequelize=require('sequelize');module[_0x769e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x769e('0x1')](_0x769e('0x2'),_0x769e('0x3')),'defaultValue':_0x769e('0x2')},'selector':{'type':Sequelize[_0x769e('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4782=['sequelize','exports','ENUM','mouseOver','timeout','STRING','INTEGER'];(function(_0x389c80,_0x5977d5){var _0x3f643e=function(_0x56dcf6){while(--_0x56dcf6){_0x389c80['push'](_0x389c80['shift']());}};_0x3f643e(++_0x5977d5);}(_0x4782,0x19d));var _0x2478=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x4782[_0xcfeda9];return _0x4826c7;};'use strict';var Sequelize=require(_0x2478('0x0'));module[_0x2478('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2478('0x2')](_0x2478('0x3'),_0x2478('0x4')),'defaultValue':_0x2478('0x3')},'selector':{'type':Sequelize[_0x2478('0x5')]},'timeout':{'type':Sequelize[_0x2478('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3af3d90..ea2ba33 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 _0x72b1=['include','options','find','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72b1,0x16e));var _0x172b=function(_0x57beb4,_0x45dbe1){_0x57beb4=_0x57beb4-0x0;var _0x4a547d=_0x72b1[_0x57beb4];return _0x4a547d;};'use strict';var emlformat=require(_0x172b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x172b('0x1'));var jsonpatch=require(_0x172b('0x2'));var rp=require(_0x172b('0x3'));var moment=require(_0x172b('0x4'));var BPromise=require(_0x172b('0x5'));var Mustache=require(_0x172b('0x6'));var util=require(_0x172b('0x7'));var path=require('path');var sox=require(_0x172b('0x8'));var csv=require(_0x172b('0x9'));var ejs=require(_0x172b('0xa'));var fs=require('fs');var fs_extra=require(_0x172b('0xb'));var _=require('lodash');var squel=require(_0x172b('0xc'));var crypto=require('crypto');var jsforce=require(_0x172b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x172b('0x9'));var querystring=require(_0x172b('0xe'));var Papa=require(_0x172b('0xf'));var Redis=require(_0x172b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x172b('0x11'));var as=require(_0x172b('0x12'));var hardwareService=require(_0x172b('0x13'));var logger=require(_0x172b('0x14'))(_0x172b('0x15'));var utils=require(_0x172b('0x16'));var config=require(_0x172b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x172b('0x18'))['db'];function respondWithStatusCode(_0x82727f,_0xdf832e){_0xdf832e=_0xdf832e||0xcc;return function(_0x4970f8){if(_0x4970f8){return _0x82727f[_0x172b('0x19')](_0xdf832e);}return _0x82727f['status'](_0xdf832e)[_0x172b('0x1a')]();};}function respondWithResult(_0x81e11e,_0x5239b9){_0x5239b9=_0x5239b9||0xc8;return function(_0x1b7247){if(_0x1b7247){return _0x81e11e[_0x172b('0x1b')](_0x5239b9)[_0x172b('0x1c')](_0x1b7247);}};}function respondWithFilteredResult(_0xa28463,_0x5b0ab1){return function(_0x5293ef){if(_0x5293ef){var _0x3625bb=typeof _0x5b0ab1[_0x172b('0x1d')]===_0x172b('0x1e')&&typeof _0x5b0ab1[_0x172b('0x1f')]==='undefined';var _0x4f369b=_0x5293ef[_0x172b('0x20')];var _0x3b2701=_0x3625bb?0x0:_0x5b0ab1[_0x172b('0x1d')];var _0xba7825=_0x3625bb?_0x5293ef[_0x172b('0x20')]:_0x5b0ab1['offset']+_0x5b0ab1[_0x172b('0x1f')];var _0x2d24f9;if(_0xba7825>=_0x4f369b){_0xba7825=_0x4f369b;_0x2d24f9=0xc8;}else{_0x2d24f9=0xce;}_0xa28463[_0x172b('0x1b')](_0x2d24f9);return _0xa28463[_0x172b('0x21')](_0x172b('0x22'),_0x3b2701+'-'+_0xba7825+'/'+_0x4f369b)[_0x172b('0x1c')](_0x5293ef);}return null;};}function patchUpdates(_0x296aa6){return function(_0x5c7e17){try{jsonpatch['apply'](_0x5c7e17,_0x296aa6,!![]);}catch(_0x562db9){return BPromise['reject'](_0x562db9);}return _0x5c7e17[_0x172b('0x23')]();};}function saveUpdates(_0x4c8090,_0x721d07){return function(_0x25ee62){if(_0x25ee62){return _0x25ee62[_0x172b('0x24')](_0x4c8090)[_0x172b('0x25')](function(_0x32419a){return _0x32419a;});}return null;};}function removeEntity(_0x24e4ff,_0x507b99){return function(_0x1cefd1){if(_0x1cefd1){return _0x1cefd1[_0x172b('0x26')]()['then'](function(){_0x24e4ff[_0x172b('0x1b')](0xcc)[_0x172b('0x1a')]();});}};}function handleEntityNotFound(_0x3df490,_0x29e1d4){return function(_0x356c83){if(!_0x356c83){_0x3df490[_0x172b('0x19')](0x194);}return _0x356c83;};}function handleError(_0x39bdc5,_0x5ee442){_0x5ee442=_0x5ee442||0x1f4;return function(_0x1deb7e){logger[_0x172b('0x27')](_0x1deb7e['stack']);if(_0x1deb7e[_0x172b('0x28')]){delete _0x1deb7e[_0x172b('0x28')];}_0x39bdc5[_0x172b('0x1b')](_0x5ee442)[_0x172b('0x29')](_0x1deb7e);};}exports[_0x172b('0x2a')]=function(_0x4bea8e,_0x9624f5){var _0x37acc5={'raw':!![],'where':{'id':_0x4bea8e['params']['id']}},_0x596b4c={};_0x596b4c[_0x172b('0x2b')]=_[_0x172b('0x2c')](db[_0x172b('0x2d')][_0x172b('0x2e')]);_0x596b4c[_0x172b('0x2f')]=_[_0x172b('0x2c')](_0x4bea8e[_0x172b('0x2f')]);_0x596b4c[_0x172b('0x30')]=_[_0x172b('0x31')](_0x596b4c[_0x172b('0x2b')],_0x596b4c[_0x172b('0x2f')]);_0x37acc5[_0x172b('0x32')]=_[_0x172b('0x31')](_0x596b4c[_0x172b('0x2b')],qs[_0x172b('0x33')](_0x4bea8e[_0x172b('0x2f')][_0x172b('0x33')]));_0x37acc5[_0x172b('0x32')]=_0x37acc5[_0x172b('0x32')][_0x172b('0x34')]?_0x37acc5[_0x172b('0x32')]:_0x596b4c[_0x172b('0x2b')];if(_0x4bea8e[_0x172b('0x2f')][_0x172b('0x35')]){_0x37acc5[_0x172b('0x36')]=[{'all':!![]}];}_0x37acc5=_['merge']({},_0x37acc5,_0x4bea8e[_0x172b('0x37')]);return db[_0x172b('0x2d')][_0x172b('0x38')](_0x37acc5)['then'](handleEntityNotFound(_0x9624f5,null))[_0x172b('0x25')](respondWithResult(_0x9624f5,null))['catch'](handleError(_0x9624f5,null));};exports['create']=function(_0x5cc073,_0x1009ae){return db['ChatProactiveAction']['create'](_0x5cc073[_0x172b('0x39')],{})[_0x172b('0x25')](respondWithResult(_0x1009ae,0xc9))[_0x172b('0x3a')](handleError(_0x1009ae,null));};exports['update']=function(_0x6e07a2,_0x1f5516){if(_0x6e07a2[_0x172b('0x39')]['id']){delete _0x6e07a2[_0x172b('0x39')]['id'];}return db[_0x172b('0x2d')][_0x172b('0x38')]({'where':{'id':_0x6e07a2[_0x172b('0x3b')]['id']}})[_0x172b('0x25')](handleEntityNotFound(_0x1f5516,null))[_0x172b('0x25')](saveUpdates(_0x6e07a2[_0x172b('0x39')],null))[_0x172b('0x25')](respondWithResult(_0x1f5516,null))[_0x172b('0x3a')](handleError(_0x1f5516,null));};exports[_0x172b('0x26')]=function(_0x45ee12,_0x51ac71){return db[_0x172b('0x2d')][_0x172b('0x38')]({'where':{'id':_0x45ee12[_0x172b('0x3b')]['id']}})[_0x172b('0x25')](handleEntityNotFound(_0x51ac71,null))['then'](removeEntity(_0x51ac71,null))['catch'](handleError(_0x51ac71,null));}; \ No newline at end of file +var _0x55d2=['ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','catch','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x58329d,_0x405132){var _0x5c08bd=function(_0x2b0278){while(--_0x2b0278){_0x58329d['push'](_0x58329d['shift']());}};_0x5c08bd(++_0x405132);}(_0x55d2,0x9f));var _0x255d=function(_0x1bdda0,_0x29dedf){_0x1bdda0=_0x1bdda0-0x0;var _0x269a8f=_0x55d2[_0x1bdda0];return _0x269a8f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x255d('0x0'));var jsonpatch=require(_0x255d('0x1'));var rp=require(_0x255d('0x2'));var moment=require(_0x255d('0x3'));var BPromise=require(_0x255d('0x4'));var Mustache=require(_0x255d('0x5'));var util=require('util');var path=require(_0x255d('0x6'));var sox=require(_0x255d('0x7'));var csv=require(_0x255d('0x8'));var ejs=require(_0x255d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x255d('0xa'));var crypto=require(_0x255d('0xb'));var jsforce=require(_0x255d('0xc'));var deskjs=require(_0x255d('0xd'));var toCsv=require(_0x255d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x255d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x255d('0xf'));var logger=require(_0x255d('0x10'))(_0x255d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x255d('0x12'));var db=require(_0x255d('0x13'))['db'];function respondWithStatusCode(_0x8d6d98,_0xcf1cb3){_0xcf1cb3=_0xcf1cb3||0xcc;return function(_0xf8abb3){if(_0xf8abb3){return _0x8d6d98[_0x255d('0x14')](_0xcf1cb3);}return _0x8d6d98[_0x255d('0x15')](_0xcf1cb3)[_0x255d('0x16')]();};}function respondWithResult(_0xce7ab2,_0x2b21fd){_0x2b21fd=_0x2b21fd||0xc8;return function(_0xbb7a35){if(_0xbb7a35){return _0xce7ab2[_0x255d('0x15')](_0x2b21fd)[_0x255d('0x17')](_0xbb7a35);}};}function respondWithFilteredResult(_0x500002,_0x29bf44){return function(_0x1be65e){if(_0x1be65e){var _0x58f0fa=typeof _0x29bf44[_0x255d('0x18')]===_0x255d('0x19')&&typeof _0x29bf44[_0x255d('0x1a')]===_0x255d('0x19');var _0x201313=_0x1be65e[_0x255d('0x1b')];var _0x2b7ed7=_0x58f0fa?0x0:_0x29bf44[_0x255d('0x18')];var _0x464f6a=_0x58f0fa?_0x1be65e[_0x255d('0x1b')]:_0x29bf44['offset']+_0x29bf44[_0x255d('0x1a')];var _0x46b939;if(_0x464f6a>=_0x201313){_0x464f6a=_0x201313;_0x46b939=0xc8;}else{_0x46b939=0xce;}_0x500002[_0x255d('0x15')](_0x46b939);return _0x500002[_0x255d('0x1c')](_0x255d('0x1d'),_0x2b7ed7+'-'+_0x464f6a+'/'+_0x201313)[_0x255d('0x17')](_0x1be65e);}return null;};}function patchUpdates(_0x417079){return function(_0x24b7b9){try{jsonpatch[_0x255d('0x1e')](_0x24b7b9,_0x417079,!![]);}catch(_0x48a380){return BPromise[_0x255d('0x1f')](_0x48a380);}return _0x24b7b9[_0x255d('0x20')]();};}function saveUpdates(_0x3aa6d9,_0x288175){return function(_0xb9d98e){if(_0xb9d98e){return _0xb9d98e[_0x255d('0x21')](_0x3aa6d9)[_0x255d('0x22')](function(_0x1c1c96){return _0x1c1c96;});}return null;};}function removeEntity(_0xd69061,_0x35e396){return function(_0x29291f){if(_0x29291f){return _0x29291f[_0x255d('0x23')]()[_0x255d('0x22')](function(){_0xd69061[_0x255d('0x15')](0xcc)[_0x255d('0x16')]();});}};}function handleEntityNotFound(_0x17f38b,_0x911934){return function(_0x28a795){if(!_0x28a795){_0x17f38b[_0x255d('0x14')](0x194);}return _0x28a795;};}function handleError(_0x57c167,_0x16d6d2){_0x16d6d2=_0x16d6d2||0x1f4;return function(_0xff763b){logger[_0x255d('0x24')](_0xff763b[_0x255d('0x25')]);if(_0xff763b[_0x255d('0x26')]){delete _0xff763b[_0x255d('0x26')];}_0x57c167[_0x255d('0x15')](_0x16d6d2)[_0x255d('0x27')](_0xff763b);};}exports['show']=function(_0x3ed01d,_0xb4bd1a){var _0x144dd0={'raw':!![],'where':{'id':_0x3ed01d[_0x255d('0x28')]['id']}},_0x547502={};_0x547502[_0x255d('0x29')]=_[_0x255d('0x2a')](db[_0x255d('0x2b')][_0x255d('0x2c')]);_0x547502[_0x255d('0x2d')]=_['keys'](_0x3ed01d[_0x255d('0x2d')]);_0x547502['filters']=_['intersection'](_0x547502[_0x255d('0x29')],_0x547502[_0x255d('0x2d')]);_0x144dd0[_0x255d('0x2e')]=_[_0x255d('0x2f')](_0x547502['model'],qs[_0x255d('0x30')](_0x3ed01d[_0x255d('0x2d')][_0x255d('0x30')]));_0x144dd0['attributes']=_0x144dd0[_0x255d('0x2e')]['length']?_0x144dd0['attributes']:_0x547502[_0x255d('0x29')];if(_0x3ed01d[_0x255d('0x2d')][_0x255d('0x31')]){_0x144dd0[_0x255d('0x32')]=[{'all':!![]}];}_0x144dd0=_[_0x255d('0x33')]({},_0x144dd0,_0x3ed01d['options']);return db[_0x255d('0x2b')]['find'](_0x144dd0)[_0x255d('0x22')](handleEntityNotFound(_0xb4bd1a,null))[_0x255d('0x22')](respondWithResult(_0xb4bd1a,null))[_0x255d('0x34')](handleError(_0xb4bd1a,null));};exports[_0x255d('0x35')]=function(_0x4ebcf4,_0x4d3084){return db['ChatProactiveAction']['create'](_0x4ebcf4[_0x255d('0x36')],{})['then'](respondWithResult(_0x4d3084,0xc9))[_0x255d('0x34')](handleError(_0x4d3084,null));};exports['update']=function(_0x2ce9a2,_0x16a389){if(_0x2ce9a2['body']['id']){delete _0x2ce9a2[_0x255d('0x36')]['id'];}return db[_0x255d('0x2b')][_0x255d('0x37')]({'where':{'id':_0x2ce9a2[_0x255d('0x28')]['id']}})[_0x255d('0x22')](handleEntityNotFound(_0x16a389,null))[_0x255d('0x22')](saveUpdates(_0x2ce9a2[_0x255d('0x36')],null))[_0x255d('0x22')](respondWithResult(_0x16a389,null))['catch'](handleError(_0x16a389,null));};exports[_0x255d('0x23')]=function(_0x40b498,_0x2e9b34){return db['ChatProactiveAction'][_0x255d('0x37')]({'where':{'id':_0x40b498[_0x255d('0x28')]['id']}})[_0x255d('0x22')](handleEntityNotFound(_0x2e9b34,null))[_0x255d('0x22')](removeEntity(_0x2e9b34,null))['catch'](handleError(_0x2e9b34,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ccf2a7d..ea06cd8 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 _0xfc35=['chat_proactive_actions','lodash','moment','path','rimraf','../../config/environment','exports','define','ChatProactiveAction'];(function(_0x23774a,_0x4a5bed){var _0x29c41c=function(_0xc4f0cf){while(--_0xc4f0cf){_0x23774a['push'](_0x23774a['shift']());}};_0x29c41c(++_0x4a5bed);}(_0xfc35,0x196));var _0x5fc3=function(_0x423d72,_0x23b4b1){_0x423d72=_0x423d72-0x0;var _0x502c2a=_0xfc35[_0x423d72];return _0x502c2a;};'use strict';var _=require(_0x5fc3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5fc3('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fc3('0x2'));var rimraf=require(_0x5fc3('0x3'));var config=require(_0x5fc3('0x4'));var attributes=require('./chatProactiveAction.attributes');module[_0x5fc3('0x5')]=function(_0x320f80,_0x4c07ae){return _0x320f80[_0x5fc3('0x6')](_0x5fc3('0x7'),attributes,{'tableName':_0x5fc3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d82=['rimraf','./chatProactiveAction.attributes','define','chat_proactive_actions','util','moment','path'];(function(_0x22d68a,_0x3f6978){var _0x131c53=function(_0x1781dc){while(--_0x1781dc){_0x22d68a['push'](_0x22d68a['shift']());}};_0x131c53(++_0x3f6978);}(_0x9d82,0x15b));var _0x29d8=function(_0x1a3a2a,_0x52ce7c){_0x1a3a2a=_0x1a3a2a-0x0;var _0x1746c9=_0x9d82[_0x1a3a2a];return _0x1746c9;};'use strict';var _=require('lodash');var util=require(_0x29d8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x29d8('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29d8('0x2'));var rimraf=require(_0x29d8('0x3'));var config=require('../../config/environment');var attributes=require(_0x29d8('0x4'));module['exports']=function(_0xf0b68c,_0x3a78fc){return _0xf0b68c[_0x29d8('0x5')]('ChatProactiveAction',attributes,{'tableName':_0x29d8('0x6'),'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 b05030d..2c34e19 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 _0xfa69=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x143a6a,_0x560e0f){var _0x4bbe68=function(_0x200889){while(--_0x200889){_0x143a6a['push'](_0x143a6a['shift']());}};_0x4bbe68(++_0x560e0f);}(_0xfa69,0x17e));var _0x9fa6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfa69[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9fa6('0x0'));var util=require(_0x9fa6('0x1'));var moment=require(_0x9fa6('0x2'));var BPromise=require(_0x9fa6('0x3'));var rs=require(_0x9fa6('0x4'));var fs=require('fs');var Redis=require(_0x9fa6('0x5'));var db=require(_0x9fa6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fa6('0x7'))(_0x9fa6('0x8'));var config=require(_0x9fa6('0x9'));var jayson=require(_0x9fa6('0xa'));var client=jayson[_0x9fa6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x505a79,_0x20db51,_0x150927){return new BPromise(function(_0x5565f6,_0x9b63f1){return client[_0x9fa6('0xc')](_0x505a79,_0x150927)[_0x9fa6('0xd')](function(_0x2bc8d4){logger[_0x9fa6('0xe')](_0x9fa6('0xf'),_0x20db51,_0x9fa6('0x10'));logger[_0x9fa6('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x20db51,'request\x20sent',JSON[_0x9fa6('0x12')](_0x2bc8d4));if(_0x2bc8d4[_0x9fa6('0x13')]){if(_0x2bc8d4[_0x9fa6('0x13')][_0x9fa6('0x14')]===0x1f4){logger[_0x9fa6('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x20db51,_0x2bc8d4[_0x9fa6('0x13')][_0x9fa6('0x15')]);return _0x9b63f1(_0x2bc8d4[_0x9fa6('0x13')][_0x9fa6('0x15')]);}logger[_0x9fa6('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x20db51,_0x2bc8d4['error']['message']);return _0x5565f6(_0x2bc8d4[_0x9fa6('0x13')][_0x9fa6('0x15')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x20db51,_0x9fa6('0x10'));_0x5565f6(_0x2bc8d4[_0x9fa6('0x16')][_0x9fa6('0x15')]);}})[_0x9fa6('0x17')](function(_0x5aae1d){logger[_0x9fa6('0x13')](_0x9fa6('0xf'),_0x20db51,_0x5aae1d);_0x9b63f1(_0x5aae1d);});});} \ No newline at end of file +var _0xe17f=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4df260,_0x73fe86){var _0x9d4246=function(_0x38447e){while(--_0x38447e){_0x4df260['push'](_0x4df260['shift']());}};_0x9d4246(++_0x73fe86);}(_0xe17f,0x1ce));var _0xfe17=function(_0x560a15,_0x104f71){_0x560a15=_0x560a15-0x0;var _0x38365f=_0xe17f[_0x560a15];return _0x38365f;};'use strict';var _=require(_0xfe17('0x0'));var util=require(_0xfe17('0x1'));var moment=require(_0xfe17('0x2'));var BPromise=require(_0xfe17('0x3'));var rs=require(_0xfe17('0x4'));var fs=require('fs');var Redis=require(_0xfe17('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe17('0x6'));var logger=require(_0xfe17('0x7'))(_0xfe17('0x8'));var config=require('../../config/environment');var jayson=require(_0xfe17('0x9'));var client=jayson[_0xfe17('0xa')][_0xfe17('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb9de,_0x139942,_0xd0e777){return new BPromise(function(_0x2ba31b,_0x34d02f){return client[_0xfe17('0xc')](_0x1eb9de,_0xd0e777)['then'](function(_0x3304ba){logger[_0xfe17('0xd')](_0xfe17('0xe'),_0x139942,_0xfe17('0xf'));logger[_0xfe17('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x139942,_0xfe17('0xf'),JSON[_0xfe17('0x11')](_0x3304ba));if(_0x3304ba[_0xfe17('0x12')]){if(_0x3304ba[_0xfe17('0x12')][_0xfe17('0x13')]===0x1f4){logger[_0xfe17('0x12')](_0xfe17('0xe'),_0x139942,_0x3304ba['error'][_0xfe17('0x14')]);return _0x34d02f(_0x3304ba[_0xfe17('0x12')][_0xfe17('0x14')]);}logger['error'](_0xfe17('0xe'),_0x139942,_0x3304ba[_0xfe17('0x12')]['message']);return _0x2ba31b(_0x3304ba[_0xfe17('0x12')][_0xfe17('0x14')]);}else{logger[_0xfe17('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x139942,_0xfe17('0xf'));_0x2ba31b(_0x3304ba[_0xfe17('0x15')][_0xfe17('0x14')]);}})[_0xfe17('0x16')](function(_0x2a4b05){logger[_0xfe17('0x12')](_0xfe17('0xe'),_0x139942,_0x2a4b05);_0x34d02f(_0x2a4b05);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 54cce54..f39b971 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 _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xeff8,0x186));var _0x8eff=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xeff8[_0x45f951];return _0x24756c;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file +var _0x31f0=['fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x7dfb59,_0x2db32f){var _0x326c4a=function(_0x4764e6){while(--_0x4764e6){_0x7dfb59['push'](_0x7dfb59['shift']());}};_0x326c4a(++_0x2db32f);}(_0x31f0,0xb7));var _0x031f=function(_0x5c4a47,_0x37d962){_0x5c4a47=_0x5c4a47-0x0;var _0x1c95c1=_0x31f0[_0x5c4a47];return _0x1c95c1;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x031f('0x8')]);router['post']('/',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0xb')](_0x031f('0xc'),auth['isAuthenticated'](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0xc'),auth[_0x031f('0x9')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ebabff0..2f8789e 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 _0x9ac6=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5b4657,_0x3cf2d7){var _0x484a5f=function(_0x54f6a6){while(--_0x54f6a6){_0x5b4657['push'](_0x5b4657['shift']());}};_0x484a5f(++_0x3cf2d7);}(_0x9ac6,0xe6));var _0x69ac=function(_0x2c3ee4,_0x1009ea){_0x2c3ee4=_0x2c3ee4-0x0;var _0x12fefa=_0x9ac6[_0x2c3ee4];return _0x12fefa;};'use strict';var Sequelize=require(_0x69ac('0x0'));module[_0x69ac('0x1')]={'name':{'type':Sequelize[_0x69ac('0x2')],'unique':_0x69ac('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x69ac('0x2')]},'timeout':{'type':Sequelize[_0x69ac('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x69ac('0x5'),_0x69ac('0x6'),_0x69ac('0x7'))}}; \ No newline at end of file +var _0x69f8=['exports','STRING','INTEGER','ENUM','beepall','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69f8,0x107));var _0x869f=function(_0x122b97,_0x7b0963){_0x122b97=_0x122b97-0x0;var _0x338a16=_0x69f8[_0x122b97];return _0x338a16;};'use strict';var Sequelize=require(_0x869f('0x0'));module[_0x869f('0x1')]={'name':{'type':Sequelize[_0x869f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x869f('0x2')]},'timeout':{'type':Sequelize[_0x869f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x869f('0x4')]('rrmemory',_0x869f('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index fa2fca7..2331641 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 _0xe130=['to-csv','ejs','fs-extra','squel','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','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','params','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','order','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','path'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0xe130,0x94));var _0x0e13=function(_0x4607fd,_0x53c0d5){_0x4607fd=_0x4607fd-0x0;var _0x1452ed=_0xe130[_0x4607fd];return _0x1452ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e13('0x0'));var zipdir=require(_0x0e13('0x1'));var jsonpatch=require(_0x0e13('0x2'));var rp=require(_0x0e13('0x3'));var moment=require(_0x0e13('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0e13('0x5'));var sox=require('sox');var csv=require(_0x0e13('0x6'));var ejs=require(_0x0e13('0x7'));var fs=require('fs');var fs_extra=require(_0x0e13('0x8'));var _=require('lodash');var squel=require(_0x0e13('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0e13('0xa'));var toCsv=require(_0x0e13('0x6'));var querystring=require(_0x0e13('0xb'));var Papa=require('papaparse');var Redis=require(_0x0e13('0xc'));var authService=require(_0x0e13('0xd'));var qs=require(_0x0e13('0xe'));var as=require(_0x0e13('0xf'));var hardwareService=require(_0x0e13('0x10'));var logger=require(_0x0e13('0x11'))(_0x0e13('0x12'));var utils=require(_0x0e13('0x13'));var config=require(_0x0e13('0x14'));var licenseUtil=require(_0x0e13('0x15'));var db=require('../../mysqldb')['db'];config[_0x0e13('0x16')]=_[_0x0e13('0x17')](config[_0x0e13('0x16')],{'host':_0x0e13('0x18'),'port':0x18eb});var socket=require(_0x0e13('0x19'))(new Redis(config['redis']));require(_0x0e13('0x1a'))[_0x0e13('0x1b')](socket);var jayson=require(_0x0e13('0x1c'));var client=jayson[_0x0e13('0x1d')][_0x0e13('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x209313,_0x2b0768,_0x28f699,_0x3a6366){return new BPromise(function(_0x43700a,_0x1eaf1c){var _0x24f9b8=_0x3a6366||client;return _0x24f9b8['request'](_0x209313,_0x28f699)[_0x0e13('0x1f')](function(_0x1d5a3c){logger[_0x0e13('0x20')](_0x0e13('0x21'),_0x2b0768,_0x0e13('0x22'));logger[_0x0e13('0x23')](_0x0e13('0x24'),_0x2b0768,_0x0e13('0x22'),JSON[_0x0e13('0x25')](_0x1d5a3c));if(_0x1d5a3c['error']){if(_0x1d5a3c['error']['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2b0768,_0x1d5a3c[_0x0e13('0x26')][_0x0e13('0x27')]);return _0x1eaf1c(_0x1d5a3c[_0x0e13('0x26')]['message']);}logger['error'](_0x0e13('0x21'),_0x2b0768,_0x1d5a3c[_0x0e13('0x26')]['message']);return _0x43700a(_0x1d5a3c['error'][_0x0e13('0x27')]);}else{logger[_0x0e13('0x20')](_0x0e13('0x21'),_0x2b0768,_0x0e13('0x22'));_0x43700a(_0x1d5a3c[_0x0e13('0x28')]['message']);}})['catch'](function(_0x301c86){logger[_0x0e13('0x26')](_0x0e13('0x21'),_0x2b0768,_0x301c86);_0x1eaf1c(_0x301c86);});});}function respondWithStatusCode(_0x362bf0,_0x1f00ba){_0x1f00ba=_0x1f00ba||0xcc;return function(_0x5b54ac){if(_0x5b54ac){return _0x362bf0[_0x0e13('0x29')](_0x1f00ba);}return _0x362bf0[_0x0e13('0x2a')](_0x1f00ba)[_0x0e13('0x2b')]();};}function respondWithResult(_0x520f61,_0x26b33d){_0x26b33d=_0x26b33d||0xc8;return function(_0x1dfbfb){if(_0x1dfbfb){return _0x520f61[_0x0e13('0x2a')](_0x26b33d)[_0x0e13('0x2c')](_0x1dfbfb);}};}function respondWithFilteredResult(_0x40fe33,_0x4d313d){return function(_0x166d90){if(_0x166d90){var _0x402e30=typeof _0x4d313d[_0x0e13('0x2d')]===_0x0e13('0x2e')&&typeof _0x4d313d[_0x0e13('0x2f')]===_0x0e13('0x2e');var _0x435668=_0x166d90[_0x0e13('0x30')];var _0x575dad=_0x402e30?0x0:_0x4d313d[_0x0e13('0x2d')];var _0x85fd70=_0x402e30?_0x166d90[_0x0e13('0x30')]:_0x4d313d[_0x0e13('0x2d')]+_0x4d313d[_0x0e13('0x2f')];var _0x34b990;if(_0x85fd70>=_0x435668){_0x85fd70=_0x435668;_0x34b990=0xc8;}else{_0x34b990=0xce;}_0x40fe33[_0x0e13('0x2a')](_0x34b990);return _0x40fe33[_0x0e13('0x31')]('Content-Range',_0x575dad+'-'+_0x85fd70+'/'+_0x435668)[_0x0e13('0x2c')](_0x166d90);}return null;};}function patchUpdates(_0x26b62d){return function(_0x63a23c){try{jsonpatch[_0x0e13('0x32')](_0x63a23c,_0x26b62d,!![]);}catch(_0x21432b){return BPromise[_0x0e13('0x33')](_0x21432b);}return _0x63a23c[_0x0e13('0x34')]();};}function saveUpdates(_0x40a632,_0x5c4328){return function(_0x36f92e){if(_0x36f92e){return _0x36f92e[_0x0e13('0x35')](_0x40a632)[_0x0e13('0x1f')](function(_0x2e29b2){return _0x2e29b2;});}return null;};}function removeEntity(_0x3a7bb0,_0x27c31c){return function(_0x3d5fd9){if(_0x3d5fd9){return _0x3d5fd9[_0x0e13('0x36')]()['then'](function(){var _0x39b60a=_0x3d5fd9['get']({'plain':!![]});var _0x21b3c6='ChatQueues';return db[_0x0e13('0x37')][_0x0e13('0x36')]({'where':{'type':_0x21b3c6,'resourceId':_0x39b60a['id']}})['then'](function(){return _0x3d5fd9;});})['then'](function(){_0x3a7bb0[_0x0e13('0x2a')](0xcc)[_0x0e13('0x2b')]();});}};}function handleEntityNotFound(_0x174bea,_0x43ed48){return function(_0x31aa2a){if(!_0x31aa2a){_0x174bea[_0x0e13('0x29')](0x194);}return _0x31aa2a;};}function handleError(_0x39054c,_0x31d636){_0x31d636=_0x31d636||0x1f4;return function(_0x573bf7){logger[_0x0e13('0x26')](_0x573bf7[_0x0e13('0x38')]);if(_0x573bf7[_0x0e13('0x39')]){delete _0x573bf7[_0x0e13('0x39')];}_0x39054c[_0x0e13('0x2a')](_0x31d636)[_0x0e13('0x3a')](_0x573bf7);};}exports[_0x0e13('0x3b')]=function(_0x4848d8,_0x4cc70e){var _0x5dc3dd={},_0x159914={},_0x2e448d={'count':0x0,'rows':[]};var _0x28c368=_[_0x0e13('0x3c')](db[_0x0e13('0x3d')][_0x0e13('0x3e')],function(_0x1940f4){return{'name':_0x1940f4[_0x0e13('0x3f')],'type':_0x1940f4['type'][_0x0e13('0x40')]};});_0x159914[_0x0e13('0x41')]=_[_0x0e13('0x3c')](_0x28c368,_0x0e13('0x39'));_0x159914['query']=_[_0x0e13('0x42')](_0x4848d8[_0x0e13('0x43')]);_0x159914[_0x0e13('0x44')]=_[_0x0e13('0x45')](_0x159914[_0x0e13('0x41')],_0x159914[_0x0e13('0x43')]);_0x5dc3dd[_0x0e13('0x46')]=_['intersection'](_0x159914['model'],qs[_0x0e13('0x47')](_0x4848d8['query']['fields']));_0x5dc3dd[_0x0e13('0x46')]=_0x5dc3dd['attributes'][_0x0e13('0x48')]?_0x5dc3dd[_0x0e13('0x46')]:_0x159914[_0x0e13('0x41')];if(!_0x4848d8[_0x0e13('0x43')][_0x0e13('0x49')](_0x0e13('0x4a'))){_0x5dc3dd[_0x0e13('0x2f')]=qs[_0x0e13('0x2f')](_0x4848d8[_0x0e13('0x43')][_0x0e13('0x2f')]);_0x5dc3dd[_0x0e13('0x2d')]=qs['offset'](_0x4848d8['query'][_0x0e13('0x2d')]);}_0x5dc3dd['order']=qs[_0x0e13('0x4b')](_0x4848d8[_0x0e13('0x43')][_0x0e13('0x4b')]);_0x5dc3dd[_0x0e13('0x4c')]=qs[_0x0e13('0x44')](_[_0x0e13('0x4d')](_0x4848d8[_0x0e13('0x43')],_0x159914[_0x0e13('0x44')]),_0x28c368);if(_0x4848d8[_0x0e13('0x43')][_0x0e13('0x4e')]){_0x5dc3dd[_0x0e13('0x4c')]=_[_0x0e13('0x4f')](_0x5dc3dd['where'],{'$or':_[_0x0e13('0x3c')](_0x28c368,function(_0x3f3d83){if(_0x3f3d83[_0x0e13('0x50')]!==_0x0e13('0x51')){var _0x4b0b18={};_0x4b0b18[_0x3f3d83[_0x0e13('0x39')]]={'$like':'%'+_0x4848d8[_0x0e13('0x43')]['filter']+'%'};return _0x4b0b18;}})});}_0x5dc3dd=_[_0x0e13('0x4f')]({},_0x5dc3dd,_0x4848d8['options']);var _0x166b4d={'where':_0x5dc3dd[_0x0e13('0x4c')]};return db['ChatQueue'][_0x0e13('0x30')](_0x166b4d)[_0x0e13('0x1f')](function(_0x8ce237){_0x2e448d[_0x0e13('0x30')]=_0x8ce237;if(_0x4848d8[_0x0e13('0x43')][_0x0e13('0x52')]){_0x5dc3dd['include']=[{'all':!![]}];}return db[_0x0e13('0x3d')][_0x0e13('0x53')](_0x5dc3dd);})[_0x0e13('0x1f')](function(_0x3b495c){_0x2e448d['rows']=_0x3b495c;return _0x2e448d;})['then'](respondWithFilteredResult(_0x4cc70e,_0x5dc3dd))[_0x0e13('0x54')](handleError(_0x4cc70e,null));};exports['show']=function(_0x2d5154,_0x594910){var _0x3df5c9={'raw':!![],'where':{'id':_0x2d5154[_0x0e13('0x55')]['id']}},_0x28d4ad={};_0x28d4ad[_0x0e13('0x41')]=_[_0x0e13('0x42')](db['ChatQueue'][_0x0e13('0x3e')]);_0x28d4ad[_0x0e13('0x43')]=_[_0x0e13('0x42')](_0x2d5154[_0x0e13('0x43')]);_0x28d4ad[_0x0e13('0x44')]=_[_0x0e13('0x45')](_0x28d4ad[_0x0e13('0x41')],_0x28d4ad['query']);_0x3df5c9[_0x0e13('0x46')]=_[_0x0e13('0x45')](_0x28d4ad[_0x0e13('0x41')],qs[_0x0e13('0x47')](_0x2d5154[_0x0e13('0x43')][_0x0e13('0x47')]));_0x3df5c9[_0x0e13('0x46')]=_0x3df5c9[_0x0e13('0x46')][_0x0e13('0x48')]?_0x3df5c9[_0x0e13('0x46')]:_0x28d4ad[_0x0e13('0x41')];if(_0x2d5154[_0x0e13('0x43')][_0x0e13('0x52')]){_0x3df5c9[_0x0e13('0x56')]=[{'all':!![]}];}_0x3df5c9=_['merge']({},_0x3df5c9,_0x2d5154[_0x0e13('0x57')]);return db[_0x0e13('0x3d')][_0x0e13('0x58')](_0x3df5c9)[_0x0e13('0x1f')](handleEntityNotFound(_0x594910,null))[_0x0e13('0x1f')](respondWithResult(_0x594910,null))[_0x0e13('0x54')](handleError(_0x594910,null));};exports['create']=function(_0xa140a2,_0x1730e2){return db[_0x0e13('0x3d')][_0x0e13('0x59')](_0xa140a2[_0x0e13('0x5a')],{})[_0x0e13('0x1f')](function(_0x306962){var _0x591e59=_0xa140a2[_0x0e13('0x5b')][_0x0e13('0x5c')]({'plain':!![]});if(!_0x591e59)throw new Error(_0x0e13('0x5d'));if(_0x591e59[_0x0e13('0x5e')]==='user'){var _0x14bdd8=_0x306962[_0x0e13('0x5c')]({'plain':!![]});var _0x35585a=_0x0e13('0x5f');return db['UserProfileSection'][_0x0e13('0x58')]({'where':{'name':_0x35585a,'userProfileId':_0x591e59['userProfileId']},'raw':!![]})[_0x0e13('0x1f')](function(_0xf2389b){if(_0xf2389b&&_0xf2389b[_0x0e13('0x60')]===0x0){return db[_0x0e13('0x37')][_0x0e13('0x59')]({'name':_0x14bdd8[_0x0e13('0x39')],'resourceId':_0x14bdd8['id'],'type':_0xf2389b['name'],'sectionId':_0xf2389b['id']},{})[_0x0e13('0x1f')](function(){return _0x306962;});}else{return _0x306962;}})[_0x0e13('0x54')](function(_0x503d01){logger['error'](_0x0e13('0x61'),_0x503d01);throw _0x503d01;});}return _0x306962;})[_0x0e13('0x1f')](respondWithResult(_0x1730e2,0xc9))[_0x0e13('0x54')](handleError(_0x1730e2,null));};exports['update']=function(_0x7826e,_0x2740ba){if(_0x7826e[_0x0e13('0x5a')]['id']){delete _0x7826e['body']['id'];}return db[_0x0e13('0x3d')][_0x0e13('0x58')]({'where':{'id':_0x7826e[_0x0e13('0x55')]['id']}})[_0x0e13('0x1f')](handleEntityNotFound(_0x2740ba,null))[_0x0e13('0x1f')](saveUpdates(_0x7826e['body'],null))[_0x0e13('0x1f')](respondWithResult(_0x2740ba,null))['catch'](handleError(_0x2740ba,null));};exports[_0x0e13('0x36')]=function(_0x4ee433,_0xe0cc64){return db[_0x0e13('0x3d')][_0x0e13('0x58')]({'where':{'id':_0x4ee433[_0x0e13('0x55')]['id']}})[_0x0e13('0x1f')](handleEntityNotFound(_0xe0cc64,null))[_0x0e13('0x1f')](removeEntity(_0xe0cc64,null))[_0x0e13('0x54')](handleError(_0xe0cc64,null));};exports[_0x0e13('0x62')]=function(_0x5610f5,_0x58dc47){return db[_0x0e13('0x3d')][_0x0e13('0x62')]()[_0x0e13('0x1f')](respondWithResult(_0x58dc47,null))[_0x0e13('0x54')](handleError(_0x58dc47,null));};exports[_0x0e13('0x63')]=function(_0x410f39,_0x2c799d,_0x3a7092){var _0x31ff72={'raw':!![],'where':{}},_0x36921c={},_0x48a221;return db[_0x0e13('0x3d')]['findOne']({'where':{'id':_0x410f39[_0x0e13('0x55')]['id']}})[_0x0e13('0x1f')](handleEntityNotFound(_0x2c799d,null))[_0x0e13('0x1f')](function(_0x21bba6){if(_0x21bba6){_0x48a221=_0x21bba6['get']({'plain':!![]});_0x36921c[_0x0e13('0x41')]=_['keys'](db[_0x0e13('0x64')][_0x0e13('0x3e')]);_0x36921c[_0x0e13('0x43')]=_['keys'](_0x410f39[_0x0e13('0x43')]);_0x36921c[_0x0e13('0x44')]=_[_0x0e13('0x45')](_0x36921c[_0x0e13('0x41')],_0x36921c[_0x0e13('0x43')]);_0x31ff72[_0x0e13('0x46')]=_[_0x0e13('0x45')](_0x36921c['model'],qs[_0x0e13('0x47')](_0x410f39['query']['fields']));_0x31ff72['attributes']=_0x31ff72[_0x0e13('0x46')][_0x0e13('0x48')]?_0x31ff72[_0x0e13('0x46')]:_0x36921c[_0x0e13('0x41')];if(!_0x410f39[_0x0e13('0x43')][_0x0e13('0x49')](_0x0e13('0x4a'))){_0x31ff72['limit']=qs[_0x0e13('0x2f')](_0x410f39[_0x0e13('0x43')][_0x0e13('0x2f')]);_0x31ff72[_0x0e13('0x2d')]=qs[_0x0e13('0x2d')](_0x410f39[_0x0e13('0x43')]['offset']);}_0x31ff72[_0x0e13('0x65')]=qs[_0x0e13('0x4b')](_0x410f39[_0x0e13('0x43')][_0x0e13('0x4b')]);_0x31ff72[_0x0e13('0x4c')]=qs['filters'](_['pick'](_0x410f39[_0x0e13('0x43')],_0x36921c[_0x0e13('0x44')]));_0x31ff72[_0x0e13('0x4c')][_0x0e13('0x66')]=_0x21bba6['id'];if(_0x410f39[_0x0e13('0x43')][_0x0e13('0x4e')]){_0x31ff72[_0x0e13('0x4c')]=_[_0x0e13('0x4f')](_0x31ff72[_0x0e13('0x4c')],{'$or':_[_0x0e13('0x3c')](_0x31ff72['attributes'],function(_0x1351b3){var _0x26241d={};_0x26241d[_0x1351b3]={'$like':'%'+_0x410f39[_0x0e13('0x43')][_0x0e13('0x4e')]+'%'};return _0x26241d;})});}_0x31ff72=_['merge']({},_0x31ff72,_0x410f39[_0x0e13('0x57')]);return db[_0x0e13('0x64')][_0x0e13('0x53')](_0x31ff72);}})['then'](function(_0x426e0f){if(_0x426e0f){return db[_0x0e13('0x67')][_0x0e13('0x68')]({'where':{'id':_[_0x0e13('0x3c')](_0x426e0f,_0x0e13('0x69')),'role':_0x0e13('0x6a')},'attributes':['id',_0x0e13('0x39'),'chatPause',_0x0e13('0x6b'),_0x0e13('0x6c')]});}})[_0x0e13('0x1f')](function(_0x1e7522){if(_0x1e7522){return{'count':_0x1e7522[_0x0e13('0x30')],'rows':_[_0x0e13('0x3c')](_0x1e7522['rows'],function(_0x149795){return{'membername':_0x149795['name'],'UserId':_0x149795['id'],'queue_name':_0x48a221[_0x0e13('0x39')],'ChatQueueId':_0x48a221['id'],'interface':util[_0x0e13('0x6d')](_0x0e13('0x6e'),_0x0e13('0x6f'),_0x149795[_0x0e13('0x39')]),'penalty':0x0,'paused':_0x149795[_0x0e13('0x70')],'createdAt':_0x149795[_0x0e13('0x6c')],'updatedAt':_0x149795[_0x0e13('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2c799d,_0x31ff72))['catch'](handleError(_0x2c799d,null));};exports[_0x0e13('0x71')]=function(_0x2a58c7,_0x5c02a8,_0x25a0e5){var _0x56eda9={};var _0x5d0a82={};var _0x36b5d9;var _0x26e14b;return db[_0x0e13('0x3d')][_0x0e13('0x72')]({'where':{'id':_0x2a58c7[_0x0e13('0x55')]['id']}})[_0x0e13('0x1f')](handleEntityNotFound(_0x5c02a8,null))['then'](function(_0x4edd43){if(_0x4edd43){_0x36b5d9=_0x4edd43;_0x5d0a82['model']=_[_0x0e13('0x42')](db[_0x0e13('0x73')][_0x0e13('0x3e')]);_0x5d0a82[_0x0e13('0x43')]=_[_0x0e13('0x42')](_0x2a58c7[_0x0e13('0x43')]);_0x5d0a82[_0x0e13('0x44')]=_[_0x0e13('0x45')](_0x5d0a82[_0x0e13('0x41')],_0x5d0a82[_0x0e13('0x43')]);_0x56eda9['attributes']=_[_0x0e13('0x45')](_0x5d0a82[_0x0e13('0x41')],qs[_0x0e13('0x47')](_0x2a58c7[_0x0e13('0x43')][_0x0e13('0x47')]));_0x56eda9['attributes']=_0x56eda9[_0x0e13('0x46')][_0x0e13('0x48')]?_0x56eda9['attributes']:_0x5d0a82['model'];_0x56eda9[_0x0e13('0x65')]=qs[_0x0e13('0x4b')](_0x2a58c7[_0x0e13('0x43')][_0x0e13('0x4b')]);_0x56eda9['where']=qs[_0x0e13('0x44')](_[_0x0e13('0x4d')](_0x2a58c7[_0x0e13('0x43')],_0x5d0a82[_0x0e13('0x44')]));if(_0x2a58c7[_0x0e13('0x43')][_0x0e13('0x4e')]){_0x56eda9[_0x0e13('0x4c')]=_['merge'](_0x56eda9[_0x0e13('0x4c')],{'$or':_[_0x0e13('0x3c')](_0x56eda9[_0x0e13('0x46')],function(_0x403641){var _0xff10bc={};_0xff10bc[_0x403641]={'$like':'%'+_0x2a58c7[_0x0e13('0x43')][_0x0e13('0x4e')]+'%'};return _0xff10bc;})});}_0x56eda9=_[_0x0e13('0x4f')]({},_0x56eda9,_0x2a58c7[_0x0e13('0x57')]);return _0x36b5d9[_0x0e13('0x71')](_0x56eda9);}})[_0x0e13('0x1f')](function(_0x382897){if(_0x382897){_0x26e14b=_0x382897[_0x0e13('0x48')];if(!_0x2a58c7['query'][_0x0e13('0x49')](_0x0e13('0x4a'))){_0x56eda9[_0x0e13('0x2f')]=qs[_0x0e13('0x2f')](_0x2a58c7[_0x0e13('0x43')][_0x0e13('0x2f')]);_0x56eda9[_0x0e13('0x2d')]=qs[_0x0e13('0x2d')](_0x2a58c7[_0x0e13('0x43')][_0x0e13('0x2d')]);}return _0x36b5d9[_0x0e13('0x71')](_0x56eda9);}})[_0x0e13('0x1f')](function(_0x31eb07){if(_0x31eb07){return _0x31eb07?{'count':_0x26e14b,'rows':_0x31eb07}:null;}})[_0x0e13('0x1f')](respondWithResult(_0x5c02a8,null))['catch'](handleError(_0x5c02a8,null));};exports[_0x0e13('0x74')]=function(_0x4a74ce,_0x4c4228,_0x4f67a2){var _0x2dbf20=_0x4a74ce[_0x0e13('0x5a')][_0x0e13('0x75')];return db[_0x0e13('0x73')]['findAll']({'where':{'id':_0x2dbf20},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e13('0x76'),'attributes':['id',_0x0e13('0x39'),_0x0e13('0x77'),_0x0e13('0x78'),_0x0e13('0x79')],'raw':!![]}]})[_0x0e13('0x1f')](function(_0x2891f3){if(_0x2891f3){var _0x165db1=_[_0x0e13('0x7a')](_0x2891f3,function(_0x5a6a3d){var _0x44e022=_0x5a6a3d[_0x0e13('0x5c')]({'plain':!![]});return _0x44e022['Agents'];});return db['ChatQueue']['find']({'where':{'id':_0x4a74ce[_0x0e13('0x55')]['id']}})[_0x0e13('0x1f')](function(_0x400d90){return db[_0x0e13('0x7b')][_0x0e13('0x7c')](function(_0x25fff1){return _0x400d90[_0x0e13('0x74')](_0x2dbf20,{'transaction':_0x25fff1})[_0x0e13('0x1f')](function(){return BPromise[_0x0e13('0x7d')](_0x165db1,function(_0x36d7b2){return db['UserChatQueue'][_0x0e13('0x7e')]({'where':{'UserId':_0x36d7b2['id'],'ChatQueueId':_0x4a74ce[_0x0e13('0x55')]['id']},'transaction':_0x25fff1});});})[_0x0e13('0x1f')](function(){_0x165db1[_0x0e13('0x7f')](function(_0x37a25e){socket[_0x0e13('0x80')](_0x0e13('0x81'),{'UserId':_0x37a25e['id'],'ChatQueueId':_0x400d90['id']});});});});});}})[_0x0e13('0x1f')](respondWithStatusCode(_0x4c4228,null))['catch'](handleError(_0x4c4228,null));};exports[_0x0e13('0x82')]=function(_0x5645c8,_0x4ce16d,_0xe6bd31){return db[_0x0e13('0x73')][_0x0e13('0x53')]({'where':{'id':_0x5645c8['query'][_0x0e13('0x75')]},'attributes':['id'],'include':[{'model':db[_0x0e13('0x67')],'as':_0x0e13('0x76'),'attributes':['id'],'raw':!![]}]})[_0x0e13('0x1f')](handleEntityNotFound(_0x4ce16d,null))[_0x0e13('0x1f')](function(_0x1aca9b){var _0x1e1cd0=_[_0x0e13('0x3c')](_0x1aca9b,'id');var _0x201cf1=[];var _0x36d270=[];var _0x3576be=squel[_0x0e13('0x83')]();_0x3576be[_0x0e13('0x84')](_0x0e13('0x85'))[_0x0e13('0x86')](_0x0e13('0x87'),'tq')['join'](_0x0e13('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0e13('0x4c')](_0x0e13('0x89'),_0x5645c8[_0x0e13('0x55')]['id']);for(var _0x2618dc=0x0;_0x2618dc<_0x1aca9b['length'];_0x2618dc+=0x1){let _0x1f7a35=_0x1aca9b[_0x2618dc];for(var _0x13bb89=0x0;_0x13bb89<_0x1f7a35[_0x0e13('0x76')][_0x0e13('0x48')];_0x13bb89+=0x1){let _0x1e057e=_0x1f7a35[_0x0e13('0x76')][_0x13bb89];var _0x208edf=_0x3576be[_0x0e13('0x8a')]();_0x208edf[_0x0e13('0x4c')](_0x0e13('0x8b'),_0x1e057e['id']);_0x36d270[_0x0e13('0x8c')](db[_0x0e13('0x7b')]['query'](_0x208edf[_0x0e13('0x8d')](),{'type':db[_0x0e13('0x7b')]['QueryTypes'][_0x0e13('0x8e')]})[_0x0e13('0x1f')](function(_0x3f6b26){if(_0x3f6b26[_0x0e13('0x48')]===0x1){return _0x1e057e['id'];}else{var _0x54d955=_['every'](_[_0x0e13('0x3c')](_0x3f6b26,_0x0e13('0x8f')),function(_0x1fc1b9){return _['includes'](_0x1e1cd0,_0x1fc1b9);});if(_0x54d955){return _0x1e057e['id'];}}}));}}return BPromise[_0x0e13('0x90')](_0x36d270)[_0x0e13('0x1f')](function(_0x3ef2db){_0x201cf1=_(_0x201cf1)[_0x0e13('0x91')](_0x3ef2db)['compact']()[_0x0e13('0x92')]();return db[_0x0e13('0x3d')][_0x0e13('0x58')]({'where':{'id':_0x5645c8[_0x0e13('0x55')]['id']}})[_0x0e13('0x1f')](function(_0x4bcf6e){return db['sequelize'][_0x0e13('0x7c')](function(_0x59afe7){return _0x4bcf6e['removeTeams'](_0x5645c8[_0x0e13('0x43')]['ids'],{'transaction':_0x59afe7})[_0x0e13('0x1f')](function(){if(!_[_0x0e13('0x93')](_0x201cf1)){return _0x4bcf6e[_0x0e13('0x94')](_0x201cf1,{'transaction':_0x59afe7});}})[_0x0e13('0x1f')](function(){_0x201cf1['forEach'](function(_0x1ca348){socket[_0x0e13('0x80')](_0x0e13('0x95'),{'UserId':_0x1ca348,'ChatQueueId':_0x4bcf6e['id']});});});});});});})['then'](respondWithStatusCode(_0x4ce16d,null))[_0x0e13('0x54')](handleError(_0x4ce16d,null));};exports['addAgents']=function(_0x4e2340,_0x261337,_0x12e630){return db['ChatQueue'][_0x0e13('0x58')]({'where':{'id':_0x4e2340[_0x0e13('0x55')]['id']}})[_0x0e13('0x1f')](handleEntityNotFound(_0x261337,null))[_0x0e13('0x1f')](function(_0x1662d9){if(_0x1662d9){return _0x1662d9[_0x0e13('0x96')](_0x4e2340[_0x0e13('0x5a')]['ids'],_[_0x0e13('0x97')](_0x4e2340[_0x0e13('0x5a')],[_0x0e13('0x75'),'id'])||{})[_0x0e13('0x98')](function(_0x3a2f86){for(var _0x200b25=0x0;_0x200b25<_0x4e2340[_0x0e13('0x5a')][_0x0e13('0x75')][_0x0e13('0x48')];_0x200b25+=0x1){socket[_0x0e13('0x80')](_0x0e13('0x81'),{'UserId':Number(_0x4e2340['body']['ids'][_0x200b25]),'ChatQueueId':Number(_0x4e2340[_0x0e13('0x55')]['id'])});}return _0x3a2f86;});}})[_0x0e13('0x1f')](respondWithResult(_0x261337,null))[_0x0e13('0x54')](handleError(_0x261337,null));};exports['removeAgents']=function(_0xad0494,_0x2ae831,_0x4bc2ac){return db['ChatQueue']['find']({'where':{'id':_0xad0494['params']['id']}})['then'](handleEntityNotFound(_0x2ae831,null))[_0x0e13('0x1f')](function(_0x18a0b3){if(_0x18a0b3){return _0x18a0b3[_0x0e13('0x94')](_0xad0494[_0x0e13('0x43')][_0x0e13('0x75')])['then'](function(){if(_['isArray'](_0xad0494[_0x0e13('0x43')][_0x0e13('0x75')])){for(var _0x1ff884=0x0;_0x1ff884<_0xad0494[_0x0e13('0x43')][_0x0e13('0x75')][_0x0e13('0x48')];_0x1ff884+=0x1){socket['emit'](_0x0e13('0x95'),{'UserId':Number(_0xad0494[_0x0e13('0x43')][_0x0e13('0x75')][_0x1ff884]),'ChatQueueId':Number(_0xad0494[_0x0e13('0x55')]['id'])});}}else{socket[_0x0e13('0x80')]('userChatQueue:remove',{'UserId':Number(_0xad0494['query'][_0x0e13('0x75')]),'ChatQueueId':Number(_0xad0494[_0x0e13('0x55')]['id'])});}});}})[_0x0e13('0x1f')](respondWithStatusCode(_0x2ae831,null))['catch'](handleError(_0x2ae831,null));};exports[_0x0e13('0x99')]=function(_0x2be267,_0x373be8,_0x166004){var _0x450ace={};var _0xb0b82b={};var _0x366b4e;var _0x407011;return db['ChatQueue'][_0x0e13('0x72')]({'where':{'id':_0x2be267['params']['id']}})[_0x0e13('0x1f')](handleEntityNotFound(_0x373be8,null))[_0x0e13('0x1f')](function(_0x32a999){if(_0x32a999){_0x366b4e=_0x32a999;_0xb0b82b[_0x0e13('0x41')]=_[_0x0e13('0x42')](db[_0x0e13('0x67')][_0x0e13('0x3e')]);_0xb0b82b['query']=_[_0x0e13('0x42')](_0x2be267[_0x0e13('0x43')]);_0xb0b82b[_0x0e13('0x44')]=_['intersection'](_0xb0b82b[_0x0e13('0x41')],_0xb0b82b[_0x0e13('0x43')]);_0x450ace[_0x0e13('0x46')]=_['intersection'](_0xb0b82b[_0x0e13('0x41')],qs[_0x0e13('0x47')](_0x2be267[_0x0e13('0x43')][_0x0e13('0x47')]));_0x450ace['attributes']=_0x450ace[_0x0e13('0x46')][_0x0e13('0x48')]?_0x450ace[_0x0e13('0x46')]:_0xb0b82b[_0x0e13('0x41')];_0x450ace[_0x0e13('0x65')]=qs[_0x0e13('0x4b')](_0x2be267['query']['sort']);_0x450ace[_0x0e13('0x4c')]=qs[_0x0e13('0x44')](_[_0x0e13('0x4d')](_0x2be267[_0x0e13('0x43')],_0xb0b82b[_0x0e13('0x44')]));if(_0x2be267[_0x0e13('0x43')][_0x0e13('0x4e')]){_0x450ace[_0x0e13('0x4c')]=_[_0x0e13('0x4f')](_0x450ace['where'],{'$or':_['map'](_0x450ace[_0x0e13('0x46')],function(_0xa4c983){var _0x280b8b={};_0x280b8b[_0xa4c983]={'$like':'%'+_0x2be267[_0x0e13('0x43')][_0x0e13('0x4e')]+'%'};return _0x280b8b;})});}_0x450ace=_[_0x0e13('0x4f')]({},_0x450ace,_0x2be267[_0x0e13('0x57')]);return _0x366b4e['getAgents'](_0x450ace);}})[_0x0e13('0x1f')](function(_0x1ac2a6){if(_0x1ac2a6){_0x407011=_0x1ac2a6[_0x0e13('0x48')];if(!_0x2be267[_0x0e13('0x43')][_0x0e13('0x49')](_0x0e13('0x4a'))){_0x450ace[_0x0e13('0x2f')]=qs[_0x0e13('0x2f')](_0x2be267[_0x0e13('0x43')][_0x0e13('0x2f')]);_0x450ace['offset']=qs['offset'](_0x2be267['query'][_0x0e13('0x2d')]);}return _0x366b4e[_0x0e13('0x99')](_0x450ace);}})[_0x0e13('0x1f')](function(_0x2fe6e3){if(_0x2fe6e3){return _0x2fe6e3?{'count':_0x407011,'rows':_0x2fe6e3}:null;}})[_0x0e13('0x1f')](respondWithResult(_0x373be8,null))[_0x0e13('0x54')](handleError(_0x373be8,null));}; \ No newline at end of file +var _0xb49a=['includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','voicePause','Agents','sequelize','transaction','each','UserChatQueue','findOrCreate','forEach','emit','userChatQueue:save','field','from','ut.UserId\x20=\x20?','push','QueryTypes','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','getAgents','User','rimraf','request-promise','moment','mustache','util','path','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','get','ChatQueues','UserProfileResource','end','stack','name','map','ChatQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0xb49a,0xc8));var _0xab49=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0xb49a[_0x4dbdda];return _0x1acbf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xab49('0x3'));var util=require(_0xab49('0x4'));var path=require(_0xab49('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab49('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xab49('0x7'));var jsforce=require(_0xab49('0x8'));var deskjs=require(_0xab49('0x9'));var toCsv=require('to-csv');var querystring=require(_0xab49('0xa'));var Papa=require(_0xab49('0xb'));var Redis=require(_0xab49('0xc'));var authService=require(_0xab49('0xd'));var qs=require(_0xab49('0xe'));var as=require(_0xab49('0xf'));var hardwareService=require(_0xab49('0x10'));var logger=require('../../config/logger')(_0xab49('0x11'));var utils=require(_0xab49('0x12'));var config=require(_0xab49('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xab49('0x14')](config[_0xab49('0x15')],{'host':_0xab49('0x16'),'port':0x18eb});var socket=require(_0xab49('0x17'))(new Redis(config['redis']));require(_0xab49('0x18'))[_0xab49('0x19')](socket);var jayson=require(_0xab49('0x1a'));var client=jayson[_0xab49('0x1b')][_0xab49('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x35d8e8,_0x2027da,_0x55483d,_0x1096fd){return new BPromise(function(_0x3718a8,_0x5b60de){var _0x568ac6=_0x1096fd||client;return _0x568ac6[_0xab49('0x1d')](_0x35d8e8,_0x55483d)[_0xab49('0x1e')](function(_0x252ece){logger[_0xab49('0x1f')](_0xab49('0x20'),_0x2027da,_0xab49('0x21'));logger[_0xab49('0x22')](_0xab49('0x23'),_0x2027da,'request\x20sent',JSON['stringify'](_0x252ece));if(_0x252ece[_0xab49('0x24')]){if(_0x252ece[_0xab49('0x24')][_0xab49('0x25')]===0x1f4){logger[_0xab49('0x24')](_0xab49('0x20'),_0x2027da,_0x252ece[_0xab49('0x24')][_0xab49('0x26')]);return _0x5b60de(_0x252ece['error']['message']);}logger[_0xab49('0x24')](_0xab49('0x20'),_0x2027da,_0x252ece[_0xab49('0x24')][_0xab49('0x26')]);return _0x3718a8(_0x252ece['error'][_0xab49('0x26')]);}else{logger['info'](_0xab49('0x20'),_0x2027da,'request\x20sent');_0x3718a8(_0x252ece[_0xab49('0x27')][_0xab49('0x26')]);}})['catch'](function(_0x3f987f){logger[_0xab49('0x24')](_0xab49('0x20'),_0x2027da,_0x3f987f);_0x5b60de(_0x3f987f);});});}function respondWithStatusCode(_0x2ad20e,_0x485ebe){_0x485ebe=_0x485ebe||0xcc;return function(_0x3bd0c1){if(_0x3bd0c1){return _0x2ad20e[_0xab49('0x28')](_0x485ebe);}return _0x2ad20e[_0xab49('0x29')](_0x485ebe)['end']();};}function respondWithResult(_0x24c47f,_0x13869b){_0x13869b=_0x13869b||0xc8;return function(_0x33306b){if(_0x33306b){return _0x24c47f[_0xab49('0x29')](_0x13869b)[_0xab49('0x2a')](_0x33306b);}};}function respondWithFilteredResult(_0x4c02e2,_0x36c3ac){return function(_0x449448){if(_0x449448){var _0x602234=typeof _0x36c3ac[_0xab49('0x2b')]===_0xab49('0x2c')&&typeof _0x36c3ac['limit']===_0xab49('0x2c');var _0x513bef=_0x449448['count'];var _0x55e7e1=_0x602234?0x0:_0x36c3ac[_0xab49('0x2b')];var _0x2e5707=_0x602234?_0x449448[_0xab49('0x2d')]:_0x36c3ac['offset']+_0x36c3ac[_0xab49('0x2e')];var _0xa96fcb;if(_0x2e5707>=_0x513bef){_0x2e5707=_0x513bef;_0xa96fcb=0xc8;}else{_0xa96fcb=0xce;}_0x4c02e2['status'](_0xa96fcb);return _0x4c02e2[_0xab49('0x2f')](_0xab49('0x30'),_0x55e7e1+'-'+_0x2e5707+'/'+_0x513bef)[_0xab49('0x2a')](_0x449448);}return null;};}function patchUpdates(_0x43ec41){return function(_0x4de9e6){try{jsonpatch['apply'](_0x4de9e6,_0x43ec41,!![]);}catch(_0x127187){return BPromise[_0xab49('0x31')](_0x127187);}return _0x4de9e6[_0xab49('0x32')]();};}function saveUpdates(_0x394096,_0x505a91){return function(_0x6b14ab){if(_0x6b14ab){return _0x6b14ab['update'](_0x394096)['then'](function(_0x44e4f2){return _0x44e4f2;});}return null;};}function removeEntity(_0x3e84d2,_0xbfd8b5){return function(_0x92b20b){if(_0x92b20b){return _0x92b20b[_0xab49('0x33')]()[_0xab49('0x1e')](function(){var _0x1aaaab=_0x92b20b[_0xab49('0x34')]({'plain':!![]});var _0x482255=_0xab49('0x35');return db[_0xab49('0x36')][_0xab49('0x33')]({'where':{'type':_0x482255,'resourceId':_0x1aaaab['id']}})[_0xab49('0x1e')](function(){return _0x92b20b;});})[_0xab49('0x1e')](function(){_0x3e84d2[_0xab49('0x29')](0xcc)[_0xab49('0x37')]();});}};}function handleEntityNotFound(_0x48f92a,_0x50c690){return function(_0x29bb10){if(!_0x29bb10){_0x48f92a[_0xab49('0x28')](0x194);}return _0x29bb10;};}function handleError(_0x25a2c4,_0x244cad){_0x244cad=_0x244cad||0x1f4;return function(_0x203869){logger['error'](_0x203869[_0xab49('0x38')]);if(_0x203869['name']){delete _0x203869[_0xab49('0x39')];}_0x25a2c4[_0xab49('0x29')](_0x244cad)['send'](_0x203869);};}exports['index']=function(_0x29ad4b,_0x1b1368){var _0x23c91d={},_0xe99896={},_0x4c7da9={'count':0x0,'rows':[]};var _0x12ce43=_[_0xab49('0x3a')](db[_0xab49('0x3b')][_0xab49('0x3c')],function(_0x586ea5){return{'name':_0x586ea5['fieldName'],'type':_0x586ea5[_0xab49('0x3d')][_0xab49('0x3e')]};});_0xe99896[_0xab49('0x3f')]=_['map'](_0x12ce43,_0xab49('0x39'));_0xe99896[_0xab49('0x40')]=_[_0xab49('0x41')](_0x29ad4b[_0xab49('0x40')]);_0xe99896[_0xab49('0x42')]=_[_0xab49('0x43')](_0xe99896[_0xab49('0x3f')],_0xe99896['query']);_0x23c91d[_0xab49('0x44')]=_['intersection'](_0xe99896[_0xab49('0x3f')],qs[_0xab49('0x45')](_0x29ad4b[_0xab49('0x40')][_0xab49('0x45')]));_0x23c91d[_0xab49('0x44')]=_0x23c91d['attributes'][_0xab49('0x46')]?_0x23c91d[_0xab49('0x44')]:_0xe99896[_0xab49('0x3f')];if(!_0x29ad4b[_0xab49('0x40')][_0xab49('0x47')](_0xab49('0x48'))){_0x23c91d[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x29ad4b[_0xab49('0x40')][_0xab49('0x2e')]);_0x23c91d[_0xab49('0x2b')]=qs[_0xab49('0x2b')](_0x29ad4b[_0xab49('0x40')][_0xab49('0x2b')]);}_0x23c91d['order']=qs['sort'](_0x29ad4b[_0xab49('0x40')][_0xab49('0x49')]);_0x23c91d[_0xab49('0x4a')]=qs[_0xab49('0x42')](_[_0xab49('0x4b')](_0x29ad4b[_0xab49('0x40')],_0xe99896[_0xab49('0x42')]),_0x12ce43);if(_0x29ad4b[_0xab49('0x40')][_0xab49('0x4c')]){_0x23c91d['where']=_[_0xab49('0x4d')](_0x23c91d['where'],{'$or':_['map'](_0x12ce43,function(_0x18da78){if(_0x18da78[_0xab49('0x3d')]!==_0xab49('0x4e')){var _0xbf41bf={};_0xbf41bf[_0x18da78[_0xab49('0x39')]]={'$like':'%'+_0x29ad4b['query'][_0xab49('0x4c')]+'%'};return _0xbf41bf;}})});}_0x23c91d=_['merge']({},_0x23c91d,_0x29ad4b[_0xab49('0x4f')]);var _0x165862={'where':_0x23c91d[_0xab49('0x4a')]};return db[_0xab49('0x3b')][_0xab49('0x2d')](_0x165862)[_0xab49('0x1e')](function(_0x3f396c){_0x4c7da9[_0xab49('0x2d')]=_0x3f396c;if(_0x29ad4b['query'][_0xab49('0x50')]){_0x23c91d['include']=[{'all':!![]}];}return db[_0xab49('0x3b')][_0xab49('0x51')](_0x23c91d);})[_0xab49('0x1e')](function(_0x3e24d4){_0x4c7da9[_0xab49('0x52')]=_0x3e24d4;return _0x4c7da9;})[_0xab49('0x1e')](respondWithFilteredResult(_0x1b1368,_0x23c91d))[_0xab49('0x53')](handleError(_0x1b1368,null));};exports[_0xab49('0x54')]=function(_0x2d0142,_0x34d3fa){var _0x3882b7={'raw':!![],'where':{'id':_0x2d0142[_0xab49('0x55')]['id']}},_0x40a1c2={};_0x40a1c2[_0xab49('0x3f')]=_[_0xab49('0x41')](db[_0xab49('0x3b')]['rawAttributes']);_0x40a1c2['query']=_[_0xab49('0x41')](_0x2d0142[_0xab49('0x40')]);_0x40a1c2['filters']=_[_0xab49('0x43')](_0x40a1c2[_0xab49('0x3f')],_0x40a1c2[_0xab49('0x40')]);_0x3882b7['attributes']=_[_0xab49('0x43')](_0x40a1c2[_0xab49('0x3f')],qs[_0xab49('0x45')](_0x2d0142[_0xab49('0x40')]['fields']));_0x3882b7[_0xab49('0x44')]=_0x3882b7[_0xab49('0x44')][_0xab49('0x46')]?_0x3882b7[_0xab49('0x44')]:_0x40a1c2[_0xab49('0x3f')];if(_0x2d0142['query']['includeAll']){_0x3882b7[_0xab49('0x56')]=[{'all':!![]}];}_0x3882b7=_[_0xab49('0x4d')]({},_0x3882b7,_0x2d0142[_0xab49('0x4f')]);return db[_0xab49('0x3b')][_0xab49('0x57')](_0x3882b7)[_0xab49('0x1e')](handleEntityNotFound(_0x34d3fa,null))[_0xab49('0x1e')](respondWithResult(_0x34d3fa,null))[_0xab49('0x53')](handleError(_0x34d3fa,null));};exports[_0xab49('0x58')]=function(_0x5b1241,_0x56122f){return db[_0xab49('0x3b')][_0xab49('0x58')](_0x5b1241[_0xab49('0x59')],{})[_0xab49('0x1e')](function(_0x356491){var _0x2f5c20=_0x5b1241[_0xab49('0x5a')][_0xab49('0x34')]({'plain':!![]});if(!_0x2f5c20)throw new Error(_0xab49('0x5b'));if(_0x2f5c20['role']==='user'){var _0x152dc0=_0x356491['get']({'plain':!![]});var _0x268238=_0xab49('0x35');return db['UserProfileSection'][_0xab49('0x57')]({'where':{'name':_0x268238,'userProfileId':_0x2f5c20[_0xab49('0x5c')]},'raw':!![]})[_0xab49('0x1e')](function(_0x2ffa2d){if(_0x2ffa2d&&_0x2ffa2d['autoAssociation']===0x0){return db['UserProfileResource'][_0xab49('0x58')]({'name':_0x152dc0[_0xab49('0x39')],'resourceId':_0x152dc0['id'],'type':_0x2ffa2d['name'],'sectionId':_0x2ffa2d['id']},{})[_0xab49('0x1e')](function(){return _0x356491;});}else{return _0x356491;}})[_0xab49('0x53')](function(_0x1ed318){logger['error'](_0xab49('0x5d'),_0x1ed318);throw _0x1ed318;});}return _0x356491;})[_0xab49('0x1e')](respondWithResult(_0x56122f,0xc9))[_0xab49('0x53')](handleError(_0x56122f,null));};exports['update']=function(_0x5cd477,_0x143eb6){if(_0x5cd477[_0xab49('0x59')]['id']){delete _0x5cd477[_0xab49('0x59')]['id'];}return db[_0xab49('0x3b')]['find']({'where':{'id':_0x5cd477[_0xab49('0x55')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x143eb6,null))[_0xab49('0x1e')](saveUpdates(_0x5cd477[_0xab49('0x59')],null))[_0xab49('0x1e')](respondWithResult(_0x143eb6,null))['catch'](handleError(_0x143eb6,null));};exports[_0xab49('0x33')]=function(_0x4d0e05,_0x4a91fd){return db[_0xab49('0x3b')][_0xab49('0x57')]({'where':{'id':_0x4d0e05[_0xab49('0x55')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x4a91fd,null))[_0xab49('0x1e')](removeEntity(_0x4a91fd,null))['catch'](handleError(_0x4a91fd,null));};exports['describe']=function(_0x5ba211,_0x31c046){return db[_0xab49('0x3b')][_0xab49('0x5e')]()['then'](respondWithResult(_0x31c046,null))[_0xab49('0x53')](handleError(_0x31c046,null));};exports[_0xab49('0x5f')]=function(_0x4a3346,_0x481a14,_0x2552b2){var _0x2967b6={'raw':!![],'where':{}},_0x4a0ca0={},_0xfa678;return db[_0xab49('0x3b')][_0xab49('0x60')]({'where':{'id':_0x4a3346[_0xab49('0x55')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x481a14,null))['then'](function(_0x5171d3){if(_0x5171d3){_0xfa678=_0x5171d3[_0xab49('0x34')]({'plain':!![]});_0x4a0ca0[_0xab49('0x3f')]=_[_0xab49('0x41')](db['UserChatQueue'][_0xab49('0x3c')]);_0x4a0ca0[_0xab49('0x40')]=_[_0xab49('0x41')](_0x4a3346[_0xab49('0x40')]);_0x4a0ca0[_0xab49('0x42')]=_[_0xab49('0x43')](_0x4a0ca0[_0xab49('0x3f')],_0x4a0ca0[_0xab49('0x40')]);_0x2967b6[_0xab49('0x44')]=_[_0xab49('0x43')](_0x4a0ca0[_0xab49('0x3f')],qs[_0xab49('0x45')](_0x4a3346[_0xab49('0x40')]['fields']));_0x2967b6[_0xab49('0x44')]=_0x2967b6['attributes'][_0xab49('0x46')]?_0x2967b6[_0xab49('0x44')]:_0x4a0ca0[_0xab49('0x3f')];if(!_0x4a3346['query'][_0xab49('0x47')]('nolimit')){_0x2967b6[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x4a3346[_0xab49('0x40')][_0xab49('0x2e')]);_0x2967b6[_0xab49('0x2b')]=qs[_0xab49('0x2b')](_0x4a3346['query'][_0xab49('0x2b')]);}_0x2967b6[_0xab49('0x61')]=qs[_0xab49('0x49')](_0x4a3346[_0xab49('0x40')]['sort']);_0x2967b6[_0xab49('0x4a')]=qs[_0xab49('0x42')](_[_0xab49('0x4b')](_0x4a3346[_0xab49('0x40')],_0x4a0ca0[_0xab49('0x42')]));_0x2967b6['where'][_0xab49('0x62')]=_0x5171d3['id'];if(_0x4a3346['query'][_0xab49('0x4c')]){_0x2967b6[_0xab49('0x4a')]=_[_0xab49('0x4d')](_0x2967b6[_0xab49('0x4a')],{'$or':_[_0xab49('0x3a')](_0x2967b6[_0xab49('0x44')],function(_0x2e6303){var _0x18a095={};_0x18a095[_0x2e6303]={'$like':'%'+_0x4a3346[_0xab49('0x40')]['filter']+'%'};return _0x18a095;})});}_0x2967b6=_[_0xab49('0x4d')]({},_0x2967b6,_0x4a3346[_0xab49('0x4f')]);return db['UserChatQueue'][_0xab49('0x51')](_0x2967b6);}})['then'](function(_0x280f9f){if(_0x280f9f){return db['User'][_0xab49('0x63')]({'where':{'id':_['map'](_0x280f9f,_0xab49('0x64')),'role':_0xab49('0x65')},'attributes':['id',_0xab49('0x39'),_0xab49('0x66'),_0xab49('0x67'),'createdAt']});}})['then'](function(_0x47da69){if(_0x47da69){return{'count':_0x47da69[_0xab49('0x2d')],'rows':_[_0xab49('0x3a')](_0x47da69[_0xab49('0x52')],function(_0x25d5ac){return{'membername':_0x25d5ac[_0xab49('0x39')],'UserId':_0x25d5ac['id'],'queue_name':_0xfa678['name'],'ChatQueueId':_0xfa678['id'],'interface':util[_0xab49('0x68')](_0xab49('0x69'),_0xab49('0x6a'),_0x25d5ac['name']),'penalty':0x0,'paused':_0x25d5ac[_0xab49('0x66')],'createdAt':_0x25d5ac[_0xab49('0x6b')],'updatedAt':_0x25d5ac['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xab49('0x1e')](respondWithFilteredResult(_0x481a14,_0x2967b6))[_0xab49('0x53')](handleError(_0x481a14,null));};exports[_0xab49('0x6c')]=function(_0x250581,_0x59591d,_0x32891c){var _0x417a1f={};var _0x2f0231={};var _0xc82491;var _0x27c2b5;return db[_0xab49('0x3b')]['findOne']({'where':{'id':_0x250581['params']['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x59591d,null))[_0xab49('0x1e')](function(_0x40b66a){if(_0x40b66a){_0xc82491=_0x40b66a;_0x2f0231['model']=_[_0xab49('0x41')](db[_0xab49('0x6d')][_0xab49('0x3c')]);_0x2f0231[_0xab49('0x40')]=_[_0xab49('0x41')](_0x250581[_0xab49('0x40')]);_0x2f0231[_0xab49('0x42')]=_[_0xab49('0x43')](_0x2f0231['model'],_0x2f0231[_0xab49('0x40')]);_0x417a1f[_0xab49('0x44')]=_['intersection'](_0x2f0231[_0xab49('0x3f')],qs[_0xab49('0x45')](_0x250581[_0xab49('0x40')][_0xab49('0x45')]));_0x417a1f[_0xab49('0x44')]=_0x417a1f[_0xab49('0x44')][_0xab49('0x46')]?_0x417a1f[_0xab49('0x44')]:_0x2f0231[_0xab49('0x3f')];_0x417a1f[_0xab49('0x61')]=qs[_0xab49('0x49')](_0x250581[_0xab49('0x40')][_0xab49('0x49')]);_0x417a1f[_0xab49('0x4a')]=qs[_0xab49('0x42')](_[_0xab49('0x4b')](_0x250581[_0xab49('0x40')],_0x2f0231[_0xab49('0x42')]));if(_0x250581[_0xab49('0x40')]['filter']){_0x417a1f[_0xab49('0x4a')]=_[_0xab49('0x4d')](_0x417a1f[_0xab49('0x4a')],{'$or':_[_0xab49('0x3a')](_0x417a1f[_0xab49('0x44')],function(_0x155375){var _0x5b061e={};_0x5b061e[_0x155375]={'$like':'%'+_0x250581[_0xab49('0x40')][_0xab49('0x4c')]+'%'};return _0x5b061e;})});}_0x417a1f=_[_0xab49('0x4d')]({},_0x417a1f,_0x250581[_0xab49('0x4f')]);return _0xc82491[_0xab49('0x6c')](_0x417a1f);}})[_0xab49('0x1e')](function(_0x18b8aa){if(_0x18b8aa){_0x27c2b5=_0x18b8aa[_0xab49('0x46')];if(!_0x250581[_0xab49('0x40')][_0xab49('0x47')](_0xab49('0x48'))){_0x417a1f[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x250581[_0xab49('0x40')]['limit']);_0x417a1f[_0xab49('0x2b')]=qs[_0xab49('0x2b')](_0x250581[_0xab49('0x40')][_0xab49('0x2b')]);}return _0xc82491['getTeams'](_0x417a1f);}})[_0xab49('0x1e')](function(_0x741874){if(_0x741874){return _0x741874?{'count':_0x27c2b5,'rows':_0x741874}:null;}})[_0xab49('0x1e')](respondWithResult(_0x59591d,null))[_0xab49('0x53')](handleError(_0x59591d,null));};exports[_0xab49('0x6e')]=function(_0x17424d,_0xf7ae4e,_0x4281d2){var _0x3953c7=_0x17424d[_0xab49('0x59')][_0xab49('0x6f')];return db['Team']['findAll']({'where':{'id':_0x3953c7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xab49('0x70'),'interface'],'raw':!![]}]})['then'](function(_0x5de209){if(_0x5de209){var _0x244c89=_['flatMap'](_0x5de209,function(_0x41c3b9){var _0x409112=_0x41c3b9[_0xab49('0x34')]({'plain':!![]});return _0x409112[_0xab49('0x71')];});return db[_0xab49('0x3b')][_0xab49('0x57')]({'where':{'id':_0x17424d[_0xab49('0x55')]['id']}})['then'](function(_0x17419f){return db[_0xab49('0x72')][_0xab49('0x73')](function(_0x452bdc){return _0x17419f[_0xab49('0x6e')](_0x3953c7,{'transaction':_0x452bdc})['then'](function(){return BPromise[_0xab49('0x74')](_0x244c89,function(_0x2df410){return db[_0xab49('0x75')][_0xab49('0x76')]({'where':{'UserId':_0x2df410['id'],'ChatQueueId':_0x17424d[_0xab49('0x55')]['id']},'transaction':_0x452bdc});});})[_0xab49('0x1e')](function(){_0x244c89[_0xab49('0x77')](function(_0x398c15){socket[_0xab49('0x78')](_0xab49('0x79'),{'UserId':_0x398c15['id'],'ChatQueueId':_0x17419f['id']});});});});});}})[_0xab49('0x1e')](respondWithStatusCode(_0xf7ae4e,null))['catch'](handleError(_0xf7ae4e,null));};exports['removeTeams']=function(_0x17fee8,_0xec4b97,_0x52c698){return db['Team'][_0xab49('0x51')]({'where':{'id':_0x17fee8['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xab49('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xec4b97,null))[_0xab49('0x1e')](function(_0x547ad9){var _0x4e90b1=_[_0xab49('0x3a')](_0x547ad9,'id');var _0x58dbf0=[];var _0x3e2043=[];var _0xa3fead=squel['select']();_0xa3fead[_0xab49('0x7a')]('tq.TeamId')[_0xab49('0x7b')]('team_has_chat_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xab49('0x4a')]('ChatQueueId\x20=\x20?',_0x17fee8[_0xab49('0x55')]['id']);for(var _0x25a917=0x0;_0x25a917<_0x547ad9['length'];_0x25a917+=0x1){let _0x32221c=_0x547ad9[_0x25a917];for(var _0x3f9afa=0x0;_0x3f9afa<_0x32221c['Agents'][_0xab49('0x46')];_0x3f9afa+=0x1){let _0x514f34=_0x32221c[_0xab49('0x71')][_0x3f9afa];var _0x14ae40=_0xa3fead['clone']();_0x14ae40[_0xab49('0x4a')](_0xab49('0x7c'),_0x514f34['id']);_0x3e2043[_0xab49('0x7d')](db[_0xab49('0x72')][_0xab49('0x40')](_0x14ae40['toString'](),{'type':db[_0xab49('0x72')][_0xab49('0x7e')]['SELECT']})[_0xab49('0x1e')](function(_0x2a8e79){if(_0x2a8e79[_0xab49('0x46')]===0x1){return _0x514f34['id'];}else{var _0x40fd7e=_['every'](_['map'](_0x2a8e79,'TeamId'),function(_0x22536b){return _[_0xab49('0x7f')](_0x4e90b1,_0x22536b);});if(_0x40fd7e){return _0x514f34['id'];}}}));}}return BPromise[_0xab49('0x80')](_0x3e2043)['then'](function(_0x219800){_0x58dbf0=_(_0x58dbf0)[_0xab49('0x81')](_0x219800)[_0xab49('0x82')]()[_0xab49('0x83')]();return db[_0xab49('0x3b')][_0xab49('0x57')]({'where':{'id':_0x17fee8[_0xab49('0x55')]['id']}})[_0xab49('0x1e')](function(_0x1699cb){return db[_0xab49('0x72')][_0xab49('0x73')](function(_0x553e93){return _0x1699cb[_0xab49('0x84')](_0x17fee8[_0xab49('0x40')][_0xab49('0x6f')],{'transaction':_0x553e93})[_0xab49('0x1e')](function(){if(!_[_0xab49('0x85')](_0x58dbf0)){return _0x1699cb[_0xab49('0x86')](_0x58dbf0,{'transaction':_0x553e93});}})[_0xab49('0x1e')](function(){_0x58dbf0[_0xab49('0x77')](function(_0x36bffb){socket[_0xab49('0x78')](_0xab49('0x87'),{'UserId':_0x36bffb,'ChatQueueId':_0x1699cb['id']});});});});});});})['then'](respondWithStatusCode(_0xec4b97,null))[_0xab49('0x53')](handleError(_0xec4b97,null));};exports[_0xab49('0x88')]=function(_0x195177,_0x5361f6,_0x5ab220){return db[_0xab49('0x3b')][_0xab49('0x57')]({'where':{'id':_0x195177[_0xab49('0x55')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x5361f6,null))['then'](function(_0xf28e16){if(_0xf28e16){return _0xf28e16[_0xab49('0x88')](_0x195177[_0xab49('0x59')][_0xab49('0x6f')],_['omit'](_0x195177[_0xab49('0x59')],[_0xab49('0x6f'),'id'])||{})[_0xab49('0x89')](function(_0x4013f5){for(var _0x4b58e9=0x0;_0x4b58e9<_0x195177[_0xab49('0x59')][_0xab49('0x6f')][_0xab49('0x46')];_0x4b58e9+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x195177[_0xab49('0x59')]['ids'][_0x4b58e9]),'ChatQueueId':Number(_0x195177['params']['id'])});}return _0x4013f5;});}})[_0xab49('0x1e')](respondWithResult(_0x5361f6,null))[_0xab49('0x53')](handleError(_0x5361f6,null));};exports[_0xab49('0x86')]=function(_0x1a99af,_0x24c44e,_0x237695){return db['ChatQueue'][_0xab49('0x57')]({'where':{'id':_0x1a99af['params']['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x24c44e,null))[_0xab49('0x1e')](function(_0x59a35f){if(_0x59a35f){return _0x59a35f[_0xab49('0x86')](_0x1a99af[_0xab49('0x40')][_0xab49('0x6f')])[_0xab49('0x1e')](function(){if(_['isArray'](_0x1a99af[_0xab49('0x40')]['ids'])){for(var _0x240dda=0x0;_0x240dda<_0x1a99af[_0xab49('0x40')][_0xab49('0x6f')][_0xab49('0x46')];_0x240dda+=0x1){socket['emit'](_0xab49('0x87'),{'UserId':Number(_0x1a99af[_0xab49('0x40')][_0xab49('0x6f')][_0x240dda]),'ChatQueueId':Number(_0x1a99af['params']['id'])});}}else{socket['emit'](_0xab49('0x87'),{'UserId':Number(_0x1a99af[_0xab49('0x40')][_0xab49('0x6f')]),'ChatQueueId':Number(_0x1a99af[_0xab49('0x55')]['id'])});}});}})[_0xab49('0x1e')](respondWithStatusCode(_0x24c44e,null))[_0xab49('0x53')](handleError(_0x24c44e,null));};exports[_0xab49('0x8a')]=function(_0x22d66e,_0x551b95,_0x26ec0e){var _0x584c48={};var _0x58b0d2={};var _0x99f5c8;var _0x48e99c;return db[_0xab49('0x3b')][_0xab49('0x60')]({'where':{'id':_0x22d66e[_0xab49('0x55')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x551b95,null))[_0xab49('0x1e')](function(_0xc4331e){if(_0xc4331e){_0x99f5c8=_0xc4331e;_0x58b0d2[_0xab49('0x3f')]=_[_0xab49('0x41')](db[_0xab49('0x8b')][_0xab49('0x3c')]);_0x58b0d2[_0xab49('0x40')]=_[_0xab49('0x41')](_0x22d66e[_0xab49('0x40')]);_0x58b0d2[_0xab49('0x42')]=_['intersection'](_0x58b0d2[_0xab49('0x3f')],_0x58b0d2[_0xab49('0x40')]);_0x584c48['attributes']=_[_0xab49('0x43')](_0x58b0d2['model'],qs[_0xab49('0x45')](_0x22d66e[_0xab49('0x40')][_0xab49('0x45')]));_0x584c48['attributes']=_0x584c48[_0xab49('0x44')][_0xab49('0x46')]?_0x584c48[_0xab49('0x44')]:_0x58b0d2[_0xab49('0x3f')];_0x584c48[_0xab49('0x61')]=qs[_0xab49('0x49')](_0x22d66e['query'][_0xab49('0x49')]);_0x584c48['where']=qs[_0xab49('0x42')](_[_0xab49('0x4b')](_0x22d66e[_0xab49('0x40')],_0x58b0d2[_0xab49('0x42')]));if(_0x22d66e[_0xab49('0x40')][_0xab49('0x4c')]){_0x584c48[_0xab49('0x4a')]=_[_0xab49('0x4d')](_0x584c48['where'],{'$or':_[_0xab49('0x3a')](_0x584c48['attributes'],function(_0x3c8bb5){var _0x5ac50f={};_0x5ac50f[_0x3c8bb5]={'$like':'%'+_0x22d66e[_0xab49('0x40')][_0xab49('0x4c')]+'%'};return _0x5ac50f;})});}_0x584c48=_[_0xab49('0x4d')]({},_0x584c48,_0x22d66e[_0xab49('0x4f')]);return _0x99f5c8[_0xab49('0x8a')](_0x584c48);}})[_0xab49('0x1e')](function(_0x6bc02b){if(_0x6bc02b){_0x48e99c=_0x6bc02b[_0xab49('0x46')];if(!_0x22d66e[_0xab49('0x40')][_0xab49('0x47')](_0xab49('0x48'))){_0x584c48[_0xab49('0x2e')]=qs[_0xab49('0x2e')](_0x22d66e[_0xab49('0x40')]['limit']);_0x584c48[_0xab49('0x2b')]=qs[_0xab49('0x2b')](_0x22d66e[_0xab49('0x40')][_0xab49('0x2b')]);}return _0x99f5c8['getAgents'](_0x584c48);}})[_0xab49('0x1e')](function(_0x4db3d0){if(_0x4db3d0){return _0x4db3d0?{'count':_0x48e99c,'rows':_0x4db3d0}:null;}})[_0xab49('0x1e')](respondWithResult(_0x551b95,null))['catch'](handleError(_0x551b95,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 2b5e7ef..485344c 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 _0xc1d9=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x4e9b9a,_0x53510c){var _0x1a7167=function(_0x3d0f53){while(--_0x3d0f53){_0x4e9b9a['push'](_0x4e9b9a['shift']());}};_0x1a7167(++_0x53510c);}(_0xc1d9,0xd7));var _0x9c1d=function(_0x97ecd,_0x1d82c1){_0x97ecd=_0x97ecd-0x0;var _0x5a0903=_0xc1d9[_0x97ecd];return _0x5a0903;};'use strict';var EventEmitter=require(_0x9c1d('0x0'));var ChatQueue=require(_0x9c1d('0x1'))['db'][_0x9c1d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9c1d('0x3')](0x0);var events={'afterCreate':_0x9c1d('0x4'),'afterUpdate':_0x9c1d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x358db5){return function(_0x3076a5,_0x165598,_0x29df1a){ChatQueueEvents[_0x9c1d('0x6')](_0x358db5+':'+_0x3076a5['id'],_0x3076a5);ChatQueueEvents[_0x9c1d('0x6')](_0x358db5,_0x3076a5);_0x29df1a(null);};}for(var e in events){if(events[_0x9c1d('0x7')](e)){var event=events[e];ChatQueue[_0x9c1d('0x8')](e,emitEvent(event));}}module[_0x9c1d('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xb2b4=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xb2b4,0x1b4));var _0x4b2b=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0xb2b4[_0x32e649];return _0x14d386;};'use strict';var EventEmitter=require(_0x4b2b('0x0'));var ChatQueue=require(_0x4b2b('0x1'))['db'][_0x4b2b('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4b2b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b2b('0x4'),'afterDestroy':_0x4b2b('0x5')};function emitEvent(_0x64420){return function(_0x1aa3b8,_0x5ed07b,_0x637cd3){ChatQueueEvents[_0x4b2b('0x6')](_0x64420+':'+_0x1aa3b8['id'],_0x1aa3b8);ChatQueueEvents[_0x4b2b('0x6')](_0x64420,_0x1aa3b8);_0x637cd3(null);};}for(var e in events){if(events[_0x4b2b('0x7')](e)){var event=events[e];ChatQueue[_0x4b2b('0x8')](e,emitEvent(event));}}module[_0x4b2b('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 0003046..48528b5 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 _0xb645=['exports','define','ChatQueue','chat_queues','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x41f0c7,_0x7e3c){var _0x37606d=function(_0x13e3fe){while(--_0x13e3fe){_0x41f0c7['push'](_0x41f0c7['shift']());}};_0x37606d(++_0x7e3c);}(_0xb645,0x154));var _0x5b64=function(_0x5ca232,_0x398303){_0x5ca232=_0x5ca232-0x0;var _0x2f98b4=_0xb645[_0x5ca232];return _0x2f98b4;};'use strict';var _=require('lodash');var util=require(_0x5b64('0x0'));var logger=require(_0x5b64('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5b64('0x2'));var rp=require(_0x5b64('0x3'));var fs=require('fs');var path=require(_0x5b64('0x4'));var rimraf=require(_0x5b64('0x5'));var config=require(_0x5b64('0x6'));var attributes=require(_0x5b64('0x7'));module[_0x5b64('0x8')]=function(_0x5a7601,_0x14f558){return _0x5a7601[_0x5b64('0x9')](_0x5b64('0xa'),attributes,{'tableName':_0x5b64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29bc=['rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3fb427,_0x1a1fe3){var _0x46d5ab=function(_0x36d81c){while(--_0x36d81c){_0x3fb427['push'](_0x3fb427['shift']());}};_0x46d5ab(++_0x1a1fe3);}(_0x29bc,0x165));var _0xc29b=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x29bc[_0x34843e];return _0x598f7f;};'use strict';var _=require('lodash');var util=require(_0xc29b('0x0'));var logger=require(_0xc29b('0x1'))(_0xc29b('0x2'));var moment=require(_0xc29b('0x3'));var BPromise=require(_0xc29b('0x4'));var rp=require(_0xc29b('0x5'));var fs=require('fs');var path=require(_0xc29b('0x6'));var rimraf=require(_0xc29b('0x7'));var config=require(_0xc29b('0x8'));var attributes=require('./chatQueue.attributes');module[_0xc29b('0x9')]=function(_0xf5d9d6,_0x4a0703){return _0xf5d9d6[_0xc29b('0xa')](_0xc29b('0xb'),attributes,{'tableName':_0xc29b('0xc'),'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 dd3af22..5773a71 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 _0xba26=['socket.io-emitter','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetChatQueue','ShowChatQueue','ChatQueue','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xba26,0x1c9));var _0x6ba2=function(_0x55d46b,_0xbd504c){_0x55d46b=_0x55d46b-0x0;var _0x4a1f2d=_0xba26[_0x55d46b];return _0x4a1f2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ba2('0x0'));var BPromise=require(_0x6ba2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ba2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ba2('0x3'));var logger=require(_0x6ba2('0x4'))('rpc');var config=require(_0x6ba2('0x5'));var jayson=require(_0x6ba2('0x6'));var client=jayson[_0x6ba2('0x7')][_0x6ba2('0x8')]({'port':0x232a});config[_0x6ba2('0x9')]=_['defaults'](config[_0x6ba2('0x9')],{'host':_0x6ba2('0xa'),'port':0x18eb});var socket=require(_0x6ba2('0xb'))(new Redis(config[_0x6ba2('0x9')]));require(_0x6ba2('0xc'))[_0x6ba2('0xd')](socket);function respondWithRpcPromise(_0x27a505,_0x1b0e9b,_0x4b840b){return new BPromise(function(_0x192bc1,_0x37dd49){return client['request'](_0x27a505,_0x4b840b)['then'](function(_0x54574f){logger[_0x6ba2('0xe')](_0x6ba2('0xf'),_0x1b0e9b,_0x6ba2('0x10'));logger[_0x6ba2('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1b0e9b,'request\x20sent',JSON[_0x6ba2('0x12')](_0x54574f));if(_0x54574f[_0x6ba2('0x13')]){if(_0x54574f[_0x6ba2('0x13')][_0x6ba2('0x14')]===0x1f4){logger[_0x6ba2('0x13')]('ChatQueue,\x20%s,\x20%s',_0x1b0e9b,_0x54574f[_0x6ba2('0x13')][_0x6ba2('0x15')]);return _0x37dd49(_0x54574f['error'][_0x6ba2('0x15')]);}logger[_0x6ba2('0x13')](_0x6ba2('0xf'),_0x1b0e9b,_0x54574f[_0x6ba2('0x13')][_0x6ba2('0x15')]);return _0x192bc1(_0x54574f[_0x6ba2('0x13')][_0x6ba2('0x15')]);}else{logger['info'](_0x6ba2('0xf'),_0x1b0e9b,_0x6ba2('0x10'));_0x192bc1(_0x54574f['result']['message']);}})[_0x6ba2('0x16')](function(_0x3f09f3){logger[_0x6ba2('0x13')](_0x6ba2('0xf'),_0x1b0e9b,_0x3f09f3);_0x37dd49(_0x3f09f3);});});}exports['GetChatQueue']=function(_0x56e627){var _0x256feb=this;return new Promise(function(_0x431bd2,_0x420163){return db['ChatQueue'][_0x6ba2('0x17')]({'raw':_0x56e627[_0x6ba2('0x18')]?_0x56e627[_0x6ba2('0x18')][_0x6ba2('0x19')]===undefined?!![]:![]:!![],'where':_0x56e627[_0x6ba2('0x18')]?_0x56e627['options'][_0x6ba2('0x1a')]||null:null,'attributes':_0x56e627['options']?_0x56e627[_0x6ba2('0x18')][_0x6ba2('0x1b')]||null:null,'limit':_0x56e627[_0x6ba2('0x18')]?_0x56e627[_0x6ba2('0x18')][_0x6ba2('0x1c')]||null:null,'include':_0x56e627[_0x6ba2('0x18')]?_0x56e627[_0x6ba2('0x18')][_0x6ba2('0x1d')]?_[_0x6ba2('0x1e')](_0x56e627[_0x6ba2('0x18')][_0x6ba2('0x1d')],function(_0x51c30c){return{'model':db[_0x51c30c[_0x6ba2('0x1f')]],'as':_0x51c30c['as'],'attributes':_0x51c30c[_0x6ba2('0x1b')],'include':_0x51c30c['include']?_['map'](_0x51c30c[_0x6ba2('0x1d')],function(_0x150688){return{'model':db[_0x150688[_0x6ba2('0x1f')]],'as':_0x150688['as'],'attributes':_0x150688['attributes'],'include':_0x150688[_0x6ba2('0x1d')]?_['map'](_0x150688[_0x6ba2('0x1d')],function(_0x3777b8){return{'model':db[_0x3777b8['model']],'as':_0x3777b8['as'],'attributes':_0x3777b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ba2('0x20')](function(_0x508cac){logger[_0x6ba2('0xe')](_0x6ba2('0x21'),_0x56e627);logger[_0x6ba2('0x11')](_0x6ba2('0x21'),_0x56e627,JSON[_0x6ba2('0x12')](_0x508cac));_0x431bd2(_0x508cac);})[_0x6ba2('0x16')](function(_0x5459c8){logger[_0x6ba2('0x13')](_0x6ba2('0x21'),_0x5459c8['message'],_0x56e627);_0x420163(_0x256feb[_0x6ba2('0x13')](0x1f4,_0x5459c8['message']));});});};exports[_0x6ba2('0x22')]=function(_0x59d6b9){var _0x589e49=this;return new Promise(function(_0x3537ec,_0x3b4674){return db[_0x6ba2('0x23')]['find']({'raw':_0x59d6b9['options']?_0x59d6b9['options']['raw']===undefined?!![]:![]:!![],'where':_0x59d6b9[_0x6ba2('0x18')]?_0x59d6b9[_0x6ba2('0x18')][_0x6ba2('0x1a')]||null:null,'attributes':_0x59d6b9[_0x6ba2('0x18')]?_0x59d6b9['options']['attributes']||null:null,'include':_0x59d6b9[_0x6ba2('0x18')]?_0x59d6b9[_0x6ba2('0x18')][_0x6ba2('0x1d')]?_['map'](_0x59d6b9[_0x6ba2('0x18')][_0x6ba2('0x1d')],function(_0xe3b17f){return{'model':db[_0xe3b17f[_0x6ba2('0x1f')]],'as':_0xe3b17f['as'],'attributes':_0xe3b17f['attributes'],'include':_0xe3b17f['include']?_[_0x6ba2('0x1e')](_0xe3b17f[_0x6ba2('0x1d')],function(_0x565f17){return{'model':db[_0x565f17['model']],'as':_0x565f17['as'],'attributes':_0x565f17[_0x6ba2('0x1b')],'include':_0x565f17[_0x6ba2('0x1d')]?_[_0x6ba2('0x1e')](_0x565f17[_0x6ba2('0x1d')],function(_0x3fef03){return{'model':db[_0x3fef03[_0x6ba2('0x1f')]],'as':_0x3fef03['as'],'attributes':_0x3fef03[_0x6ba2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ba2('0x20')](function(_0x3ffdc8){logger[_0x6ba2('0xe')](_0x6ba2('0x22'),_0x59d6b9);logger[_0x6ba2('0x11')](_0x6ba2('0x22'),_0x59d6b9,JSON[_0x6ba2('0x12')](_0x3ffdc8));_0x3537ec(_0x3ffdc8);})[_0x6ba2('0x16')](function(_0x495838){logger[_0x6ba2('0x13')](_0x6ba2('0x22'),_0x495838[_0x6ba2('0x15')],_0x59d6b9);_0x3b4674(_0x589e49[_0x6ba2('0x13')](0x1f4,_0x495838[_0x6ba2('0x15')]));});});}; \ No newline at end of file +var _0xdc9c=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowChatQueue','find','where','bluebird','ioredis'];(function(_0x3af6f8,_0x1e631e){var _0x1d3a09=function(_0x50f012){while(--_0x50f012){_0x3af6f8['push'](_0x3af6f8['shift']());}};_0x1d3a09(++_0x1e631e);}(_0xdc9c,0xe2));var _0xcdc9=function(_0x4ac26d,_0x42eba7){_0x4ac26d=_0x4ac26d-0x0;var _0x151b8f=_0xdc9c[_0x4ac26d];return _0x151b8f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcdc9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdc9('0x1'));var db=require(_0xcdc9('0x2'))['db'];var utils=require(_0xcdc9('0x3'));var logger=require(_0xcdc9('0x4'))('rpc');var config=require(_0xcdc9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xcdc9('0x6')][_0xcdc9('0x7')]({'port':0x232a});config[_0xcdc9('0x8')]=_[_0xcdc9('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcdc9('0xa'))[_0xcdc9('0xb')](socket);function respondWithRpcPromise(_0x1efa14,_0x3feb96,_0x3ee1a5){return new BPromise(function(_0x1afa92,_0x3a7cb4){return client[_0xcdc9('0xc')](_0x1efa14,_0x3ee1a5)[_0xcdc9('0xd')](function(_0x5db48d){logger[_0xcdc9('0xe')](_0xcdc9('0xf'),_0x3feb96,_0xcdc9('0x10'));logger['debug'](_0xcdc9('0x11'),_0x3feb96,_0xcdc9('0x10'),JSON[_0xcdc9('0x12')](_0x5db48d));if(_0x5db48d[_0xcdc9('0x13')]){if(_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x14')]===0x1f4){logger[_0xcdc9('0x13')](_0xcdc9('0xf'),_0x3feb96,_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x15')]);return _0x3a7cb4(_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x15')]);}logger[_0xcdc9('0x13')](_0xcdc9('0xf'),_0x3feb96,_0x5db48d[_0xcdc9('0x13')]['message']);return _0x1afa92(_0x5db48d[_0xcdc9('0x13')][_0xcdc9('0x15')]);}else{logger['info'](_0xcdc9('0xf'),_0x3feb96,_0xcdc9('0x10'));_0x1afa92(_0x5db48d[_0xcdc9('0x16')]['message']);}})[_0xcdc9('0x17')](function(_0x39667e){logger[_0xcdc9('0x13')](_0xcdc9('0xf'),_0x3feb96,_0x39667e);_0x3a7cb4(_0x39667e);});});}exports[_0xcdc9('0x18')]=function(_0x216a90){var _0x36c0db=this;return new Promise(function(_0x12e828,_0x22a5fe){return db[_0xcdc9('0x19')][_0xcdc9('0x1a')]({'raw':_0x216a90[_0xcdc9('0x1b')]?_0x216a90[_0xcdc9('0x1b')][_0xcdc9('0x1c')]===undefined?!![]:![]:!![],'where':_0x216a90[_0xcdc9('0x1b')]?_0x216a90[_0xcdc9('0x1b')]['where']||null:null,'attributes':_0x216a90[_0xcdc9('0x1b')]?_0x216a90['options'][_0xcdc9('0x1d')]||null:null,'limit':_0x216a90[_0xcdc9('0x1b')]?_0x216a90[_0xcdc9('0x1b')][_0xcdc9('0x1e')]||null:null,'include':_0x216a90[_0xcdc9('0x1b')]?_0x216a90['options'][_0xcdc9('0x1f')]?_[_0xcdc9('0x20')](_0x216a90[_0xcdc9('0x1b')]['include'],function(_0x2c565c){return{'model':db[_0x2c565c[_0xcdc9('0x21')]],'as':_0x2c565c['as'],'attributes':_0x2c565c[_0xcdc9('0x1d')],'include':_0x2c565c[_0xcdc9('0x1f')]?_[_0xcdc9('0x20')](_0x2c565c['include'],function(_0x55545e){return{'model':db[_0x55545e[_0xcdc9('0x21')]],'as':_0x55545e['as'],'attributes':_0x55545e[_0xcdc9('0x1d')],'include':_0x55545e[_0xcdc9('0x1f')]?_[_0xcdc9('0x20')](_0x55545e[_0xcdc9('0x1f')],function(_0x2d8c91){return{'model':db[_0x2d8c91[_0xcdc9('0x21')]],'as':_0x2d8c91['as'],'attributes':_0x2d8c91[_0xcdc9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdc9('0xd')](function(_0x464058){logger['info'](_0xcdc9('0x18'),_0x216a90);logger[_0xcdc9('0x22')](_0xcdc9('0x18'),_0x216a90,JSON[_0xcdc9('0x12')](_0x464058));_0x12e828(_0x464058);})['catch'](function(_0x1fb964){logger[_0xcdc9('0x13')](_0xcdc9('0x18'),_0x1fb964[_0xcdc9('0x15')],_0x216a90);_0x22a5fe(_0x36c0db[_0xcdc9('0x13')](0x1f4,_0x1fb964['message']));});});};exports[_0xcdc9('0x23')]=function(_0x2a30da){var _0x511d2c=this;return new Promise(function(_0x50137c,_0x329a91){return db['ChatQueue'][_0xcdc9('0x24')]({'raw':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da['options'][_0xcdc9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x25')]||null:null,'attributes':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x1d')]||null:null,'include':_0x2a30da[_0xcdc9('0x1b')]?_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x1f')]?_['map'](_0x2a30da[_0xcdc9('0x1b')][_0xcdc9('0x1f')],function(_0x23040f){return{'model':db[_0x23040f[_0xcdc9('0x21')]],'as':_0x23040f['as'],'attributes':_0x23040f['attributes'],'include':_0x23040f[_0xcdc9('0x1f')]?_['map'](_0x23040f['include'],function(_0x50205c){return{'model':db[_0x50205c['model']],'as':_0x50205c['as'],'attributes':_0x50205c[_0xcdc9('0x1d')],'include':_0x50205c['include']?_[_0xcdc9('0x20')](_0x50205c[_0xcdc9('0x1f')],function(_0x20b75a){return{'model':db[_0x20b75a[_0xcdc9('0x21')]],'as':_0x20b75a['as'],'attributes':_0x20b75a[_0xcdc9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcdc9('0xd')](function(_0x51fded){logger['info'](_0xcdc9('0x23'),_0x2a30da);logger[_0xcdc9('0x22')](_0xcdc9('0x23'),_0x2a30da,JSON['stringify'](_0x51fded));_0x50137c(_0x51fded);})[_0xcdc9('0x17')](function(_0x27d4ce){logger[_0xcdc9('0x13')]('ShowChatQueue',_0x27d4ce[_0xcdc9('0x15')],_0x2a30da);_0x329a91(_0x511d2c['error'](0x1f4,_0x27d4ce[_0xcdc9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index dc8d940..7eb7797 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 _0x702d=['remove','update','emit','register','length','./chatQueue.events','save'];(function(_0x3008b9,_0x3ef5f1){var _0x2798c4=function(_0x5d0e99){while(--_0x5d0e99){_0x3008b9['push'](_0x3008b9['shift']());}};_0x2798c4(++_0x3ef5f1);}(_0x702d,0x147));var _0xd702=function(_0x242e1a,_0x58dbf7){_0x242e1a=_0x242e1a-0x0;var _0x40c562=_0x702d[_0x242e1a];return _0x40c562;};'use strict';var ChatQueueEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatQueueEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatQueue:'+_0x5af246,_0x544e94);ChatQueueEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file +var _0x9c44=['emit','removeListener','length','chatQueue:','remove','update'];(function(_0x20e4c6,_0x595993){var _0x4da2c3=function(_0x29cb8b){while(--_0x29cb8b){_0x20e4c6['push'](_0x20e4c6['shift']());}};_0x4da2c3(++_0x595993);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){ChatQueueEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);ChatQueueEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index cb10719..1fb5980 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0xbdead3,_0x3d5499){var _0x3685cf=function(_0x2071bf){while(--_0x2071bf){_0xbdead3['push'](_0xbdead3['shift']());}};_0x3685cf(++_0x3d5499);}(_0x55ca,0x126));var _0xa55c=function(_0x1ed034,_0x5d495d){_0x1ed034=_0x1ed034-0x0;var _0x4a82b7=_0x55ca[_0x1ed034];return _0x4a82b7;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c6846,_0x7d577f){var _0x5050a5=function(_0x177e12){while(--_0x177e12){_0x4c6846['push'](_0x4c6846['shift']());}};_0x5050a5(++_0x7d577f);}(_0x008c,0x188));var _0xc008=function(_0xedde59,_0x50d9b1){_0xedde59=_0xedde59-0x0;var _0x4db279=_0x008c[_0xedde59];return _0x4db279;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0742420..c97e7c2 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 _0x99c8=['STRING','DATE','exports'];(function(_0x547030,_0x5ac365){var _0x20dd29=function(_0x138efd){while(--_0x138efd){_0x547030['push'](_0x547030['shift']());}};_0x20dd29(++_0x5ac365);}(_0x99c8,0x10d));var _0x899c=function(_0x48604b,_0x518ed1){_0x48604b=_0x48604b-0x0;var _0x874edb=_0x99c8[_0x48604b];return _0x874edb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x899c('0x0')]={'uniqueid':{'type':Sequelize[_0x899c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x899c('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x899c('0x2')]},'acceptAt':{'type':Sequelize[_0x899c('0x2')]},'exitAt':{'type':Sequelize[_0x899c('0x2')]},'reason':{'type':Sequelize[_0x899c('0x1')]}}; \ No newline at end of file +var _0xa34e=['STRING','DATE','moment','sequelize'];(function(_0x504322,_0x1efbec){var _0x751a39=function(_0x58ef96){while(--_0x58ef96){_0x504322['push'](_0x504322['shift']());}};_0x751a39(++_0x1efbec);}(_0xa34e,0x17a));var _0xea34=function(_0x2fc1f6,_0x51543e){_0x2fc1f6=_0x2fc1f6-0x0;var _0x7a3346=_0xa34e[_0x2fc1f6];return _0x7a3346;};'use strict';var moment=require(_0xea34('0x0'));var Sequelize=require(_0xea34('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xea34('0x2')]},'joinAt':{'type':Sequelize[_0xea34('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xea34('0x3')]},'exitAt':{'type':Sequelize[_0xea34('0x3')]},'reason':{'type':Sequelize[_0xea34('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0df36e5..0cc9f00 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 _0xa4bd=['count','set','reject','save','update','then','destroy','stack','name','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa4bd,0x1e4));var _0xda4b=function(_0x5b23f2,_0x9d16ef){_0x5b23f2=_0x5b23f2-0x0;var _0x19986d=_0xa4bd[_0x5b23f2];return _0x19986d;};'use strict';var emlformat=require(_0xda4b('0x0'));var rimraf=require(_0xda4b('0x1'));var zipdir=require(_0xda4b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda4b('0x3'));var moment=require(_0xda4b('0x4'));var BPromise=require(_0xda4b('0x5'));var Mustache=require(_0xda4b('0x6'));var util=require(_0xda4b('0x7'));var path=require(_0xda4b('0x8'));var sox=require(_0xda4b('0x9'));var csv=require(_0xda4b('0xa'));var ejs=require(_0xda4b('0xb'));var fs=require('fs');var fs_extra=require(_0xda4b('0xc'));var _=require('lodash');var squel=require(_0xda4b('0xd'));var crypto=require(_0xda4b('0xe'));var jsforce=require(_0xda4b('0xf'));var deskjs=require(_0xda4b('0x10'));var toCsv=require('to-csv');var querystring=require(_0xda4b('0x11'));var Papa=require(_0xda4b('0x12'));var Redis=require(_0xda4b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xda4b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda4b('0x15'));var logger=require(_0xda4b('0x16'))(_0xda4b('0x17'));var utils=require(_0xda4b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xda4b('0x19'));var db=require(_0xda4b('0x1a'))['db'];function respondWithStatusCode(_0x2781d3,_0x2f9554){_0x2f9554=_0x2f9554||0xcc;return function(_0x2d3243){if(_0x2d3243){return _0x2781d3[_0xda4b('0x1b')](_0x2f9554);}return _0x2781d3[_0xda4b('0x1c')](_0x2f9554)[_0xda4b('0x1d')]();};}function respondWithResult(_0xb5881c,_0xb70e25){_0xb70e25=_0xb70e25||0xc8;return function(_0x4c25db){if(_0x4c25db){return _0xb5881c[_0xda4b('0x1c')](_0xb70e25)[_0xda4b('0x1e')](_0x4c25db);}};}function respondWithFilteredResult(_0xb7ec2c,_0x2fb875){return function(_0x1a3115){if(_0x1a3115){var _0x12e7fc=typeof _0x2fb875[_0xda4b('0x1f')]===_0xda4b('0x20')&&typeof _0x2fb875[_0xda4b('0x21')]===_0xda4b('0x20');var _0x30185e=_0x1a3115[_0xda4b('0x22')];var _0x5ed049=_0x12e7fc?0x0:_0x2fb875[_0xda4b('0x1f')];var _0x56c65e=_0x12e7fc?_0x1a3115['count']:_0x2fb875[_0xda4b('0x1f')]+_0x2fb875[_0xda4b('0x21')];var _0x42834c;if(_0x56c65e>=_0x30185e){_0x56c65e=_0x30185e;_0x42834c=0xc8;}else{_0x42834c=0xce;}_0xb7ec2c[_0xda4b('0x1c')](_0x42834c);return _0xb7ec2c[_0xda4b('0x23')]('Content-Range',_0x5ed049+'-'+_0x56c65e+'/'+_0x30185e)['json'](_0x1a3115);}return null;};}function patchUpdates(_0x2397de){return function(_0x139bfa){try{jsonpatch['apply'](_0x139bfa,_0x2397de,!![]);}catch(_0x2a8425){return BPromise[_0xda4b('0x24')](_0x2a8425);}return _0x139bfa[_0xda4b('0x25')]();};}function saveUpdates(_0x56566a,_0x48d8a8){return function(_0x3e9f20){if(_0x3e9f20){return _0x3e9f20[_0xda4b('0x26')](_0x56566a)[_0xda4b('0x27')](function(_0x1c57ce){return _0x1c57ce;});}return null;};}function removeEntity(_0x318d48,_0x606e86){return function(_0x108adf){if(_0x108adf){return _0x108adf[_0xda4b('0x28')]()[_0xda4b('0x27')](function(){_0x318d48[_0xda4b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6ecc,_0x5f19ef){return function(_0x3046dc){if(!_0x3046dc){_0x2f6ecc[_0xda4b('0x1b')](0x194);}return _0x3046dc;};}function handleError(_0x4a7cac,_0x5ecf1a){_0x5ecf1a=_0x5ecf1a||0x1f4;return function(_0x1b03f1){logger['error'](_0x1b03f1[_0xda4b('0x29')]);if(_0x1b03f1[_0xda4b('0x2a')]){delete _0x1b03f1[_0xda4b('0x2a')];}_0x4a7cac[_0xda4b('0x1c')](_0x5ecf1a)['send'](_0x1b03f1);};}exports[_0xda4b('0x2b')]=function(_0x1ce977,_0x18f78a){var _0x550ec4={},_0x52022b={},_0x218bb2={'count':0x0,'rows':[]};var _0x1277cc=_['map'](db[_0xda4b('0x2c')][_0xda4b('0x2d')],function(_0x5312ab){return{'name':_0x5312ab[_0xda4b('0x2e')],'type':_0x5312ab[_0xda4b('0x2f')]['key']};});_0x52022b[_0xda4b('0x30')]=_[_0xda4b('0x31')](_0x1277cc,_0xda4b('0x2a'));_0x52022b['query']=_['keys'](_0x1ce977[_0xda4b('0x32')]);_0x52022b[_0xda4b('0x33')]=_[_0xda4b('0x34')](_0x52022b['model'],_0x52022b[_0xda4b('0x32')]);_0x550ec4['attributes']=_[_0xda4b('0x34')](_0x52022b[_0xda4b('0x30')],qs['fields'](_0x1ce977[_0xda4b('0x32')][_0xda4b('0x35')]));_0x550ec4[_0xda4b('0x36')]=_0x550ec4[_0xda4b('0x36')]['length']?_0x550ec4['attributes']:_0x52022b['model'];if(!_0x1ce977[_0xda4b('0x32')][_0xda4b('0x37')]('nolimit')){_0x550ec4['limit']=qs[_0xda4b('0x21')](_0x1ce977[_0xda4b('0x32')]['limit']);_0x550ec4[_0xda4b('0x1f')]=qs[_0xda4b('0x1f')](_0x1ce977['query'][_0xda4b('0x1f')]);}_0x550ec4[_0xda4b('0x38')]=qs[_0xda4b('0x39')](_0x1ce977[_0xda4b('0x32')][_0xda4b('0x39')]);_0x550ec4['where']=qs[_0xda4b('0x33')](_['pick'](_0x1ce977[_0xda4b('0x32')],_0x52022b[_0xda4b('0x33')]),_0x1277cc);if(_0x1ce977['query'][_0xda4b('0x3a')]){_0x550ec4['where']=_[_0xda4b('0x3b')](_0x550ec4[_0xda4b('0x3c')],{'$or':_[_0xda4b('0x31')](_0x1277cc,function(_0x46b8e1){if(_0x46b8e1[_0xda4b('0x2f')]!==_0xda4b('0x3d')){var _0x5b7350={};_0x5b7350[_0x46b8e1[_0xda4b('0x2a')]]={'$like':'%'+_0x1ce977[_0xda4b('0x32')][_0xda4b('0x3a')]+'%'};return _0x5b7350;}})});}_0x550ec4=_[_0xda4b('0x3b')]({},_0x550ec4,_0x1ce977[_0xda4b('0x3e')]);var _0x710929={'where':_0x550ec4['where']};return db['ChatQueueReport'][_0xda4b('0x22')](_0x710929)[_0xda4b('0x27')](function(_0x18b7bb){_0x218bb2[_0xda4b('0x22')]=_0x18b7bb;if(_0x1ce977[_0xda4b('0x32')][_0xda4b('0x3f')]){_0x550ec4[_0xda4b('0x40')]=[{'all':!![]}];}return db[_0xda4b('0x2c')]['findAll'](_0x550ec4);})['then'](function(_0x5a7988){_0x218bb2[_0xda4b('0x41')]=_0x5a7988;return _0x218bb2;})[_0xda4b('0x27')](respondWithFilteredResult(_0x18f78a,_0x550ec4))[_0xda4b('0x42')](handleError(_0x18f78a,null));};exports[_0xda4b('0x43')]=function(_0x1b0f58,_0x1d875b){var _0x59f5a8={'raw':!![],'where':{'id':_0x1b0f58[_0xda4b('0x44')]['id']}},_0x1b1abb={};_0x1b1abb[_0xda4b('0x30')]=_[_0xda4b('0x45')](db[_0xda4b('0x2c')][_0xda4b('0x2d')]);_0x1b1abb[_0xda4b('0x32')]=_[_0xda4b('0x45')](_0x1b0f58[_0xda4b('0x32')]);_0x1b1abb[_0xda4b('0x33')]=_[_0xda4b('0x34')](_0x1b1abb[_0xda4b('0x30')],_0x1b1abb[_0xda4b('0x32')]);_0x59f5a8[_0xda4b('0x36')]=_[_0xda4b('0x34')](_0x1b1abb[_0xda4b('0x30')],qs[_0xda4b('0x35')](_0x1b0f58[_0xda4b('0x32')][_0xda4b('0x35')]));_0x59f5a8[_0xda4b('0x36')]=_0x59f5a8[_0xda4b('0x36')]['length']?_0x59f5a8[_0xda4b('0x36')]:_0x1b1abb[_0xda4b('0x30')];if(_0x1b0f58[_0xda4b('0x32')][_0xda4b('0x3f')]){_0x59f5a8['include']=[{'all':!![]}];}_0x59f5a8=_[_0xda4b('0x3b')]({},_0x59f5a8,_0x1b0f58[_0xda4b('0x3e')]);return db[_0xda4b('0x2c')][_0xda4b('0x46')](_0x59f5a8)[_0xda4b('0x27')](handleEntityNotFound(_0x1d875b,null))[_0xda4b('0x27')](respondWithResult(_0x1d875b,null))[_0xda4b('0x42')](handleError(_0x1d875b,null));};exports[_0xda4b('0x47')]=function(_0x633f12,_0x579261){return db[_0xda4b('0x2c')][_0xda4b('0x47')](_0x633f12[_0xda4b('0x48')],{})[_0xda4b('0x27')](respondWithResult(_0x579261,0xc9))[_0xda4b('0x42')](handleError(_0x579261,null));};exports[_0xda4b('0x26')]=function(_0x5c8aef,_0x2311be){if(_0x5c8aef[_0xda4b('0x48')]['id']){delete _0x5c8aef[_0xda4b('0x48')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5c8aef[_0xda4b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2311be,null))[_0xda4b('0x27')](saveUpdates(_0x5c8aef['body'],null))[_0xda4b('0x27')](respondWithResult(_0x2311be,null))[_0xda4b('0x42')](handleError(_0x2311be,null));};exports[_0xda4b('0x28')]=function(_0x4c139e,_0x50fd28){return db[_0xda4b('0x2c')][_0xda4b('0x46')]({'where':{'id':_0x4c139e['params']['id']}})[_0xda4b('0x27')](handleEntityNotFound(_0x50fd28,null))[_0xda4b('0x27')](removeEntity(_0x50fd28,null))[_0xda4b('0x42')](handleError(_0x50fd28,null));};exports['describe']=function(_0x521cd4,_0x162d6f){return db['ChatQueueReport'][_0xda4b('0x49')]()[_0xda4b('0x27')](respondWithResult(_0x162d6f,null))[_0xda4b('0x42')](handleError(_0x162d6f,null));}; \ No newline at end of file +var _0x0650=['path','sox','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0650,0x1aa));var _0x0065=function(_0x40a85a,_0x5393c8){_0x40a85a=_0x40a85a-0x0;var _0x4c1213=_0x0650[_0x40a85a];return _0x4c1213;};'use strict';var emlformat=require(_0x0065('0x0'));var rimraf=require(_0x0065('0x1'));var zipdir=require(_0x0065('0x2'));var jsonpatch=require(_0x0065('0x3'));var rp=require('request-promise');var moment=require(_0x0065('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0065('0x5'));var path=require(_0x0065('0x6'));var sox=require(_0x0065('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0065('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0065('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0065('0xa'));var Papa=require(_0x0065('0xb'));var Redis=require('ioredis');var authService=require(_0x0065('0xc'));var qs=require(_0x0065('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0065('0xe'))(_0x0065('0xf'));var utils=require(_0x0065('0x10'));var config=require(_0x0065('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x243902,_0x4e4f7a){_0x4e4f7a=_0x4e4f7a||0xcc;return function(_0x58893d){if(_0x58893d){return _0x243902[_0x0065('0x12')](_0x4e4f7a);}return _0x243902['status'](_0x4e4f7a)[_0x0065('0x13')]();};}function respondWithResult(_0x5a0bb6,_0x4db9b8){_0x4db9b8=_0x4db9b8||0xc8;return function(_0x40c8c5){if(_0x40c8c5){return _0x5a0bb6[_0x0065('0x14')](_0x4db9b8)[_0x0065('0x15')](_0x40c8c5);}};}function respondWithFilteredResult(_0x4722bf,_0x2788c3){return function(_0x16fffb){if(_0x16fffb){var _0x375861=typeof _0x2788c3[_0x0065('0x16')]==='undefined'&&typeof _0x2788c3[_0x0065('0x17')]===_0x0065('0x18');var _0x359f1f=_0x16fffb[_0x0065('0x19')];var _0x20adaa=_0x375861?0x0:_0x2788c3[_0x0065('0x16')];var _0x244937=_0x375861?_0x16fffb[_0x0065('0x19')]:_0x2788c3[_0x0065('0x16')]+_0x2788c3[_0x0065('0x17')];var _0x4bca8f;if(_0x244937>=_0x359f1f){_0x244937=_0x359f1f;_0x4bca8f=0xc8;}else{_0x4bca8f=0xce;}_0x4722bf['status'](_0x4bca8f);return _0x4722bf[_0x0065('0x1a')](_0x0065('0x1b'),_0x20adaa+'-'+_0x244937+'/'+_0x359f1f)[_0x0065('0x15')](_0x16fffb);}return null;};}function patchUpdates(_0x2efd09){return function(_0x436a85){try{jsonpatch[_0x0065('0x1c')](_0x436a85,_0x2efd09,!![]);}catch(_0x59e771){return BPromise[_0x0065('0x1d')](_0x59e771);}return _0x436a85[_0x0065('0x1e')]();};}function saveUpdates(_0x24af6c,_0x502c7a){return function(_0x1590c8){if(_0x1590c8){return _0x1590c8['update'](_0x24af6c)[_0x0065('0x1f')](function(_0x2711d4){return _0x2711d4;});}return null;};}function removeEntity(_0xb5758,_0x5578da){return function(_0x372ffc){if(_0x372ffc){return _0x372ffc[_0x0065('0x20')]()[_0x0065('0x1f')](function(){_0xb5758[_0x0065('0x14')](0xcc)[_0x0065('0x13')]();});}};}function handleEntityNotFound(_0x4cbd31,_0xc562ce){return function(_0x5536dc){if(!_0x5536dc){_0x4cbd31[_0x0065('0x12')](0x194);}return _0x5536dc;};}function handleError(_0x3b39e7,_0x2cea74){_0x2cea74=_0x2cea74||0x1f4;return function(_0x234fb2){logger[_0x0065('0x21')](_0x234fb2[_0x0065('0x22')]);if(_0x234fb2['name']){delete _0x234fb2[_0x0065('0x23')];}_0x3b39e7[_0x0065('0x14')](_0x2cea74)[_0x0065('0x24')](_0x234fb2);};}exports[_0x0065('0x25')]=function(_0x2f177e,_0x54c4c3){var _0x4ad7e2={},_0x432dbf={},_0x5aafd9={'count':0x0,'rows':[]};var _0x56b59b=_[_0x0065('0x26')](db[_0x0065('0x27')][_0x0065('0x28')],function(_0x515019){return{'name':_0x515019[_0x0065('0x29')],'type':_0x515019[_0x0065('0x2a')][_0x0065('0x2b')]};});_0x432dbf[_0x0065('0x2c')]=_[_0x0065('0x26')](_0x56b59b,_0x0065('0x23'));_0x432dbf[_0x0065('0x2d')]=_[_0x0065('0x2e')](_0x2f177e[_0x0065('0x2d')]);_0x432dbf[_0x0065('0x2f')]=_['intersection'](_0x432dbf['model'],_0x432dbf[_0x0065('0x2d')]);_0x4ad7e2['attributes']=_[_0x0065('0x30')](_0x432dbf['model'],qs[_0x0065('0x31')](_0x2f177e[_0x0065('0x2d')]['fields']));_0x4ad7e2['attributes']=_0x4ad7e2[_0x0065('0x32')][_0x0065('0x33')]?_0x4ad7e2['attributes']:_0x432dbf['model'];if(!_0x2f177e[_0x0065('0x2d')]['hasOwnProperty'](_0x0065('0x34'))){_0x4ad7e2[_0x0065('0x17')]=qs[_0x0065('0x17')](_0x2f177e[_0x0065('0x2d')]['limit']);_0x4ad7e2[_0x0065('0x16')]=qs[_0x0065('0x16')](_0x2f177e[_0x0065('0x2d')][_0x0065('0x16')]);}_0x4ad7e2[_0x0065('0x35')]=qs[_0x0065('0x36')](_0x2f177e['query'][_0x0065('0x36')]);_0x4ad7e2[_0x0065('0x37')]=qs[_0x0065('0x2f')](_[_0x0065('0x38')](_0x2f177e[_0x0065('0x2d')],_0x432dbf['filters']),_0x56b59b);if(_0x2f177e[_0x0065('0x2d')][_0x0065('0x39')]){_0x4ad7e2[_0x0065('0x37')]=_[_0x0065('0x3a')](_0x4ad7e2[_0x0065('0x37')],{'$or':_[_0x0065('0x26')](_0x56b59b,function(_0x84017f){if(_0x84017f[_0x0065('0x2a')]!==_0x0065('0x3b')){var _0x59dd96={};_0x59dd96[_0x84017f[_0x0065('0x23')]]={'$like':'%'+_0x2f177e[_0x0065('0x2d')][_0x0065('0x39')]+'%'};return _0x59dd96;}})});}_0x4ad7e2=_['merge']({},_0x4ad7e2,_0x2f177e[_0x0065('0x3c')]);var _0x43146f={'where':_0x4ad7e2[_0x0065('0x37')]};return db[_0x0065('0x27')]['count'](_0x43146f)[_0x0065('0x1f')](function(_0x4db53a){_0x5aafd9['count']=_0x4db53a;if(_0x2f177e[_0x0065('0x2d')][_0x0065('0x3d')]){_0x4ad7e2['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x0065('0x3e')](_0x4ad7e2);})['then'](function(_0x273d5c){_0x5aafd9[_0x0065('0x3f')]=_0x273d5c;return _0x5aafd9;})[_0x0065('0x1f')](respondWithFilteredResult(_0x54c4c3,_0x4ad7e2))[_0x0065('0x40')](handleError(_0x54c4c3,null));};exports[_0x0065('0x41')]=function(_0x57ca09,_0x572891){var _0x4b4974={'raw':!![],'where':{'id':_0x57ca09[_0x0065('0x42')]['id']}},_0x1ac131={};_0x1ac131['model']=_[_0x0065('0x2e')](db[_0x0065('0x27')][_0x0065('0x28')]);_0x1ac131[_0x0065('0x2d')]=_['keys'](_0x57ca09['query']);_0x1ac131['filters']=_['intersection'](_0x1ac131[_0x0065('0x2c')],_0x1ac131[_0x0065('0x2d')]);_0x4b4974[_0x0065('0x32')]=_[_0x0065('0x30')](_0x1ac131[_0x0065('0x2c')],qs[_0x0065('0x31')](_0x57ca09['query'][_0x0065('0x31')]));_0x4b4974['attributes']=_0x4b4974[_0x0065('0x32')][_0x0065('0x33')]?_0x4b4974[_0x0065('0x32')]:_0x1ac131[_0x0065('0x2c')];if(_0x57ca09['query'][_0x0065('0x3d')]){_0x4b4974[_0x0065('0x43')]=[{'all':!![]}];}_0x4b4974=_[_0x0065('0x3a')]({},_0x4b4974,_0x57ca09[_0x0065('0x3c')]);return db[_0x0065('0x27')]['find'](_0x4b4974)['then'](handleEntityNotFound(_0x572891,null))[_0x0065('0x1f')](respondWithResult(_0x572891,null))[_0x0065('0x40')](handleError(_0x572891,null));};exports['create']=function(_0x959896,_0x14864b){return db[_0x0065('0x27')]['create'](_0x959896[_0x0065('0x44')],{})['then'](respondWithResult(_0x14864b,0xc9))[_0x0065('0x40')](handleError(_0x14864b,null));};exports[_0x0065('0x45')]=function(_0x3b0bbc,_0x59c3f2){if(_0x3b0bbc[_0x0065('0x44')]['id']){delete _0x3b0bbc[_0x0065('0x44')]['id'];}return db[_0x0065('0x27')][_0x0065('0x46')]({'where':{'id':_0x3b0bbc[_0x0065('0x42')]['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x59c3f2,null))[_0x0065('0x1f')](saveUpdates(_0x3b0bbc[_0x0065('0x44')],null))['then'](respondWithResult(_0x59c3f2,null))[_0x0065('0x40')](handleError(_0x59c3f2,null));};exports['destroy']=function(_0x1217bc,_0x534cd0){return db['ChatQueueReport'][_0x0065('0x46')]({'where':{'id':_0x1217bc[_0x0065('0x42')]['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x534cd0,null))[_0x0065('0x1f')](removeEntity(_0x534cd0,null))[_0x0065('0x40')](handleError(_0x534cd0,null));};exports[_0x0065('0x47')]=function(_0x2f1b4e,_0x1500d7){return db[_0x0065('0x27')]['describe']()[_0x0065('0x1f')](respondWithResult(_0x1500d7,null))['catch'](handleError(_0x1500d7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e158940..eb5507d 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xde8d6d,_0x36f308){var _0x3a880d=function(_0x5c340f){while(--_0x5c340f){_0xde8d6d['push'](_0xde8d6d['shift']());}};_0x3a880d(++_0x36f308);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfbf1f3,_0x23a64a){var _0x356ed3=function(_0x259e18){while(--_0x259e18){_0xfbf1f3['push'](_0xfbf1f3['shift']());}};_0x356ed3(++_0x23a64a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index ecd60a5..714eed5 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 _0x7a27=['ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','info','stringify','where','attributes','UpdateChatQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x7a27,0x172));var _0x77a2=function(_0x191d1c,_0x11b4a0){_0x191d1c=_0x191d1c-0x0;var _0x5d2bac=_0x7a27[_0x191d1c];return _0x5d2bac;};'use strict';var _=require(_0x77a2('0x0'));var util=require(_0x77a2('0x1'));var moment=require(_0x77a2('0x2'));var BPromise=require(_0x77a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77a2('0x4'));var db=require(_0x77a2('0x5'))['db'];var utils=require(_0x77a2('0x6'));var logger=require(_0x77a2('0x7'))('rpc');var config=require(_0x77a2('0x8'));var jayson=require(_0x77a2('0x9'));var client=jayson[_0x77a2('0xa')][_0x77a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b6037,_0x4a0fe4,_0x4e41b2){return new BPromise(function(_0x144d6e,_0xedb0bf){return client[_0x77a2('0xc')](_0x5b6037,_0x4e41b2)[_0x77a2('0xd')](function(_0x1379b0){logger['info'](_0x77a2('0xe'),_0x4a0fe4,'request\x20sent');logger['debug'](_0x77a2('0xf'),_0x4a0fe4,_0x77a2('0x10'),JSON['stringify'](_0x1379b0));if(_0x1379b0['error']){if(_0x1379b0[_0x77a2('0x11')][_0x77a2('0x12')]===0x1f4){logger[_0x77a2('0x11')](_0x77a2('0xe'),_0x4a0fe4,_0x1379b0[_0x77a2('0x11')][_0x77a2('0x13')]);return _0xedb0bf(_0x1379b0['error'][_0x77a2('0x13')]);}logger[_0x77a2('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4a0fe4,_0x1379b0[_0x77a2('0x11')]['message']);return _0x144d6e(_0x1379b0[_0x77a2('0x11')][_0x77a2('0x13')]);}else{logger['info'](_0x77a2('0xe'),_0x4a0fe4,_0x77a2('0x10'));_0x144d6e(_0x1379b0['result'][_0x77a2('0x13')]);}})[_0x77a2('0x14')](function(_0x48c438){logger[_0x77a2('0x11')](_0x77a2('0xe'),_0x4a0fe4,_0x48c438);_0xedb0bf(_0x48c438);});});}exports[_0x77a2('0x15')]=function(_0x49fd4d){var _0x403b03=this;return new Promise(function(_0x76196d,_0x390b91){return db[_0x77a2('0x16')][_0x77a2('0x17')](_0x49fd4d[_0x77a2('0x18')],{'raw':_0x49fd4d[_0x77a2('0x19')]?_0x49fd4d[_0x77a2('0x19')][_0x77a2('0x1a')]===undefined?!![]:![]:!![]})[_0x77a2('0xd')](function(_0x52fe6c){logger[_0x77a2('0x1b')](_0x77a2('0x15'),_0x49fd4d);logger['debug'](_0x77a2('0x15'),_0x49fd4d,JSON[_0x77a2('0x1c')](_0x52fe6c));_0x76196d(_0x52fe6c);})['catch'](function(_0x3a05b0){logger[_0x77a2('0x11')](_0x77a2('0x15'),_0x3a05b0[_0x77a2('0x13')],_0x49fd4d);_0x390b91(_0x403b03[_0x77a2('0x11')](0x1f4,_0x3a05b0[_0x77a2('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x236ef8){var _0x1b4c14=this;return new Promise(function(_0x33e386,_0x480c9b){return db[_0x77a2('0x16')]['update'](_0x236ef8[_0x77a2('0x18')],{'raw':_0x236ef8[_0x77a2('0x19')]?_0x236ef8[_0x77a2('0x19')][_0x77a2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x236ef8[_0x77a2('0x19')]?_0x236ef8['options'][_0x77a2('0x1d')]||null:null,'attributes':_0x236ef8[_0x77a2('0x19')]?_0x236ef8['options'][_0x77a2('0x1e')]||null:null,'limit':_0x236ef8['options']?_0x236ef8['options']['limit']||null:null})[_0x77a2('0xd')](function(_0x49b1a6){logger['info'](_0x77a2('0x1f'),_0x236ef8);logger['debug'](_0x77a2('0x1f'),_0x236ef8,JSON[_0x77a2('0x1c')](_0x49b1a6));_0x33e386(_0x49b1a6);})['catch'](function(_0x3452a3){logger[_0x77a2('0x11')](_0x77a2('0x1f'),_0x3452a3[_0x77a2('0x13')],_0x236ef8);_0x480c9b(_0x1b4c14[_0x77a2('0x11')](0x1f4,_0x3452a3['message']));});});}; \ No newline at end of file +var _0x5755=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','stringify','UpdateChatQueueReport','update','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x19db1a,_0x2acde1){var _0x434a28=function(_0x37f05b){while(--_0x37f05b){_0x19db1a['push'](_0x19db1a['shift']());}};_0x434a28(++_0x2acde1);}(_0x5755,0x8f));var _0x5575=function(_0x162f4b,_0x31b569){_0x162f4b=_0x162f4b-0x0;var _0x57b00b=_0x5755[_0x162f4b];return _0x57b00b;};'use strict';var _=require('lodash');var util=require(_0x5575('0x0'));var moment=require(_0x5575('0x1'));var BPromise=require(_0x5575('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5575('0x3'));var db=require(_0x5575('0x4'))['db'];var utils=require(_0x5575('0x5'));var logger=require(_0x5575('0x6'))(_0x5575('0x7'));var config=require(_0x5575('0x8'));var jayson=require(_0x5575('0x9'));var client=jayson[_0x5575('0xa')][_0x5575('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1919cf,_0x22e768,_0x418953){return new BPromise(function(_0x8d007e,_0x500805){return client['request'](_0x1919cf,_0x418953)[_0x5575('0xc')](function(_0x7aa9ca){logger[_0x5575('0xd')](_0x5575('0xe'),_0x22e768,_0x5575('0xf'));logger[_0x5575('0x10')](_0x5575('0x11'),_0x22e768,_0x5575('0xf'),JSON['stringify'](_0x7aa9ca));if(_0x7aa9ca[_0x5575('0x12')]){if(_0x7aa9ca[_0x5575('0x12')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x22e768,_0x7aa9ca['error'][_0x5575('0x13')]);return _0x500805(_0x7aa9ca[_0x5575('0x12')][_0x5575('0x13')]);}logger[_0x5575('0x12')](_0x5575('0xe'),_0x22e768,_0x7aa9ca['error']['message']);return _0x8d007e(_0x7aa9ca[_0x5575('0x12')]['message']);}else{logger['info'](_0x5575('0xe'),_0x22e768,_0x5575('0xf'));_0x8d007e(_0x7aa9ca[_0x5575('0x14')][_0x5575('0x13')]);}})[_0x5575('0x15')](function(_0x55c668){logger['error'](_0x5575('0xe'),_0x22e768,_0x55c668);_0x500805(_0x55c668);});});}exports[_0x5575('0x16')]=function(_0x11772b){var _0x3953b6=this;return new Promise(function(_0x319e31,_0x3b5384){return db[_0x5575('0x17')][_0x5575('0x18')](_0x11772b['body'],{'raw':_0x11772b[_0x5575('0x19')]?_0x11772b[_0x5575('0x19')][_0x5575('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x48d631){logger['info']('CreateChatQueueReport',_0x11772b);logger['debug'](_0x5575('0x16'),_0x11772b,JSON[_0x5575('0x1b')](_0x48d631));_0x319e31(_0x48d631);})[_0x5575('0x15')](function(_0x3380e7){logger['error'](_0x5575('0x16'),_0x3380e7[_0x5575('0x13')],_0x11772b);_0x3b5384(_0x3953b6[_0x5575('0x12')](0x1f4,_0x3380e7[_0x5575('0x13')]));});});};exports[_0x5575('0x1c')]=function(_0x195c20){var _0x4e989a=this;return new Promise(function(_0x5bba14,_0x579a46){return db[_0x5575('0x17')][_0x5575('0x1d')](_0x195c20['body'],{'raw':_0x195c20[_0x5575('0x19')]?_0x195c20[_0x5575('0x19')][_0x5575('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x195c20['options']?_0x195c20[_0x5575('0x19')][_0x5575('0x1e')]||null:null,'attributes':_0x195c20['options']?_0x195c20[_0x5575('0x19')]['attributes']||null:null,'limit':_0x195c20[_0x5575('0x19')]?_0x195c20['options']['limit']||null:null})[_0x5575('0xc')](function(_0xaf93f2){logger[_0x5575('0xd')](_0x5575('0x1c'),_0x195c20);logger['debug'](_0x5575('0x1c'),_0x195c20,JSON[_0x5575('0x1b')](_0xaf93f2));_0x5bba14(_0xaf93f2);})[_0x5575('0x15')](function(_0x155e9d){logger[_0x5575('0x12')]('UpdateChatQueueReport',_0x155e9d[_0x5575('0x13')],_0x195c20);_0x579a46(_0x4e989a[_0x5575('0x12')](0x1f4,_0x155e9d[_0x5575('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a971159..60384c2 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 _0x385f=['post','update','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x56321f,_0x1c41eb){var _0x5aa129=function(_0x5cab95){while(--_0x5cab95){_0x56321f['push'](_0x56321f['shift']());}};_0x5aa129(++_0x1c41eb);}(_0x385f,0x191));var _0xf385=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x385f[_0x3c51d4];return _0x53c45f;};'use strict';var multer=require('multer');var util=require(_0xf385('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf385('0x1')]();var fs_extra=require(_0xf385('0x2'));var auth=require(_0xf385('0x3'));var interaction=require(_0xf385('0x4'));var config=require('../../config/environment');var controller=require(_0xf385('0x5'));router['get']('/',auth[_0xf385('0x6')](),controller[_0xf385('0x7')]);router[_0xf385('0x8')](_0xf385('0x9'),auth[_0xf385('0x6')](),controller[_0xf385('0xa')]);router[_0xf385('0x8')](_0xf385('0xb'),auth[_0xf385('0x6')](),controller[_0xf385('0xc')]);router[_0xf385('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xf385('0x6')](),controller[_0xf385('0xe')]);router[_0xf385('0xf')](_0xf385('0xb'),auth[_0xf385('0x6')](),controller[_0xf385('0x10')]);module[_0xf385('0x11')]=router; \ No newline at end of file +var _0x9275=['../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9275,0x177));var _0x5927=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x9275[_0x9307ea];return _0x295554;};'use strict';var multer=require('multer');var util=require(_0x5927('0x0'));var path=require(_0x5927('0x1'));var timeout=require(_0x5927('0x2'));var express=require(_0x5927('0x3'));var router=express['Router']();var fs_extra=require(_0x5927('0x4'));var auth=require(_0x5927('0x5'));var interaction=require(_0x5927('0x6'));var config=require('../../config/environment');var controller=require(_0x5927('0x7'));router[_0x5927('0x8')]('/',auth[_0x5927('0x9')](),controller[_0x5927('0xa')]);router[_0x5927('0x8')](_0x5927('0xb'),auth[_0x5927('0x9')](),controller['describe']);router[_0x5927('0x8')]('/:id',auth[_0x5927('0x9')](),controller['show']);router['post']('/',auth[_0x5927('0x9')](),controller[_0x5927('0xc')]);router[_0x5927('0xd')](_0x5927('0xe'),auth[_0x5927('0x9')](),controller[_0x5927('0xf')]);router[_0x5927('0x10')](_0x5927('0xe'),auth[_0x5927('0x9')](),controller[_0x5927('0x11')]);module[_0x5927('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5d24e72..6ab9eed 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x54d624,_0x481973){var _0x2de0dc=function(_0x2d8385){while(--_0x2d8385){_0x54d624['push'](_0x54d624['shift']());}};_0x2de0dc(++_0x481973);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x203983,_0x34d62e){var _0x212285=function(_0x22147e){while(--_0x22147e){_0x203983['push'](_0x203983['shift']());}};_0x212285(++_0x34d62e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x592d62,_0xa9c0b9){_0x592d62=_0x592d62-0x0;var _0x519075=_0xf4eb[_0x592d62];return _0x519075;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1590d16..131dd6d 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 _0x9fc4=['include','findAll','rows','catch','show','length','find','create','body','update','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','Content-Range','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','count','includeAll'];(function(_0x1f4074,_0x18dbab){var _0x196b7a=function(_0x46328c){while(--_0x46328c){_0x1f4074['push'](_0x1f4074['shift']());}};_0x196b7a(++_0x18dbab);}(_0x9fc4,0xf3));var _0x49fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fc4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x49fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49fc('0x2'));var moment=require(_0x49fc('0x3'));var BPromise=require(_0x49fc('0x4'));var Mustache=require('mustache');var util=require(_0x49fc('0x5'));var path=require(_0x49fc('0x6'));var sox=require('sox');var csv=require(_0x49fc('0x7'));var ejs=require(_0x49fc('0x8'));var fs=require('fs');var fs_extra=require(_0x49fc('0x9'));var _=require(_0x49fc('0xa'));var squel=require('squel');var crypto=require(_0x49fc('0xb'));var jsforce=require(_0x49fc('0xc'));var deskjs=require(_0x49fc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x49fc('0xe'));var Papa=require(_0x49fc('0xf'));var Redis=require(_0x49fc('0x10'));var authService=require(_0x49fc('0x11'));var qs=require(_0x49fc('0x12'));var as=require(_0x49fc('0x13'));var hardwareService=require(_0x49fc('0x14'));var logger=require(_0x49fc('0x15'))(_0x49fc('0x16'));var utils=require(_0x49fc('0x17'));var config=require(_0x49fc('0x18'));var licenseUtil=require(_0x49fc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d34e5,_0x4b52b8){_0x4b52b8=_0x4b52b8||0xcc;return function(_0x26a0a1){if(_0x26a0a1){return _0x2d34e5['sendStatus'](_0x4b52b8);}return _0x2d34e5[_0x49fc('0x1a')](_0x4b52b8)['end']();};}function respondWithResult(_0x1546ed,_0x2fe96e){_0x2fe96e=_0x2fe96e||0xc8;return function(_0x2e31b8){if(_0x2e31b8){return _0x1546ed[_0x49fc('0x1a')](_0x2fe96e)[_0x49fc('0x1b')](_0x2e31b8);}};}function respondWithFilteredResult(_0x1c8e66,_0x3eeab0){return function(_0xfadf3f){if(_0xfadf3f){var _0x3026f5=typeof _0x3eeab0[_0x49fc('0x1c')]===_0x49fc('0x1d')&&typeof _0x3eeab0[_0x49fc('0x1e')]===_0x49fc('0x1d');var _0x3c9aef=_0xfadf3f['count'];var _0x13cffb=_0x3026f5?0x0:_0x3eeab0[_0x49fc('0x1c')];var _0x3f4cde=_0x3026f5?_0xfadf3f['count']:_0x3eeab0[_0x49fc('0x1c')]+_0x3eeab0[_0x49fc('0x1e')];var _0x31ab06;if(_0x3f4cde>=_0x3c9aef){_0x3f4cde=_0x3c9aef;_0x31ab06=0xc8;}else{_0x31ab06=0xce;}_0x1c8e66[_0x49fc('0x1a')](_0x31ab06);return _0x1c8e66[_0x49fc('0x1f')](_0x49fc('0x20'),_0x13cffb+'-'+_0x3f4cde+'/'+_0x3c9aef)[_0x49fc('0x1b')](_0xfadf3f);}return null;};}function patchUpdates(_0x347a1e){return function(_0x2a5aa9){try{jsonpatch['apply'](_0x2a5aa9,_0x347a1e,!![]);}catch(_0x4f3354){return BPromise['reject'](_0x4f3354);}return _0x2a5aa9[_0x49fc('0x21')]();};}function saveUpdates(_0x359173,_0x765111){return function(_0xd63a92){if(_0xd63a92){return _0xd63a92['update'](_0x359173)[_0x49fc('0x22')](function(_0x592447){return _0x592447;});}return null;};}function removeEntity(_0x21c3f7,_0x43a381){return function(_0x3cbd06){if(_0x3cbd06){return _0x3cbd06[_0x49fc('0x23')]()[_0x49fc('0x22')](function(){_0x21c3f7[_0x49fc('0x1a')](0xcc)[_0x49fc('0x24')]();});}};}function handleEntityNotFound(_0x2e4f43,_0x13ed55){return function(_0x529ded){if(!_0x529ded){_0x2e4f43[_0x49fc('0x25')](0x194);}return _0x529ded;};}function handleError(_0xbe1da,_0x53f5a7){_0x53f5a7=_0x53f5a7||0x1f4;return function(_0x1c6881){logger[_0x49fc('0x26')](_0x1c6881[_0x49fc('0x27')]);if(_0x1c6881[_0x49fc('0x28')]){delete _0x1c6881['name'];}_0xbe1da[_0x49fc('0x1a')](_0x53f5a7)[_0x49fc('0x29')](_0x1c6881);};}exports[_0x49fc('0x2a')]=function(_0x5b9c7c,_0xdea5c1){var _0x1976ef={},_0x1773d4={},_0x5d955b={'count':0x0,'rows':[]};var _0x513350=_[_0x49fc('0x2b')](db[_0x49fc('0x2c')][_0x49fc('0x2d')],function(_0x4170fd){return{'name':_0x4170fd[_0x49fc('0x2e')],'type':_0x4170fd['type']['key']};});_0x1773d4[_0x49fc('0x2f')]=_[_0x49fc('0x2b')](_0x513350,_0x49fc('0x28'));_0x1773d4['query']=_[_0x49fc('0x30')](_0x5b9c7c[_0x49fc('0x31')]);_0x1773d4['filters']=_['intersection'](_0x1773d4['model'],_0x1773d4['query']);_0x1976ef['attributes']=_[_0x49fc('0x32')](_0x1773d4[_0x49fc('0x2f')],qs['fields'](_0x5b9c7c[_0x49fc('0x31')][_0x49fc('0x33')]));_0x1976ef[_0x49fc('0x34')]=_0x1976ef[_0x49fc('0x34')]['length']?_0x1976ef[_0x49fc('0x34')]:_0x1773d4[_0x49fc('0x2f')];if(!_0x5b9c7c[_0x49fc('0x31')]['hasOwnProperty'](_0x49fc('0x35'))){_0x1976ef[_0x49fc('0x1e')]=qs[_0x49fc('0x1e')](_0x5b9c7c[_0x49fc('0x31')][_0x49fc('0x1e')]);_0x1976ef[_0x49fc('0x1c')]=qs[_0x49fc('0x1c')](_0x5b9c7c[_0x49fc('0x31')][_0x49fc('0x1c')]);}_0x1976ef[_0x49fc('0x36')]=qs['sort'](_0x5b9c7c[_0x49fc('0x31')][_0x49fc('0x37')]);_0x1976ef[_0x49fc('0x38')]=qs[_0x49fc('0x39')](_['pick'](_0x5b9c7c[_0x49fc('0x31')],_0x1773d4[_0x49fc('0x39')]),_0x513350);if(_0x5b9c7c[_0x49fc('0x31')][_0x49fc('0x3a')]){_0x1976ef['where']=_['merge'](_0x1976ef['where'],{'$or':_[_0x49fc('0x2b')](_0x513350,function(_0x585c26){if(_0x585c26[_0x49fc('0x3b')]!==_0x49fc('0x3c')){var _0x5c87e9={};_0x5c87e9[_0x585c26['name']]={'$like':'%'+_0x5b9c7c[_0x49fc('0x31')]['filter']+'%'};return _0x5c87e9;}})});}_0x1976ef=_[_0x49fc('0x3d')]({},_0x1976ef,_0x5b9c7c[_0x49fc('0x3e')]);var _0x1fc7fd={'where':_0x1976ef['where']};return db[_0x49fc('0x2c')]['count'](_0x1fc7fd)['then'](function(_0x19d218){_0x5d955b[_0x49fc('0x3f')]=_0x19d218;if(_0x5b9c7c[_0x49fc('0x31')][_0x49fc('0x40')]){_0x1976ef[_0x49fc('0x41')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x49fc('0x42')](_0x1976ef);})[_0x49fc('0x22')](function(_0x2eb54a){_0x5d955b[_0x49fc('0x43')]=_0x2eb54a;return _0x5d955b;})['then'](respondWithFilteredResult(_0xdea5c1,_0x1976ef))[_0x49fc('0x44')](handleError(_0xdea5c1,null));};exports[_0x49fc('0x45')]=function(_0x2ae3fd,_0x4613fc){var _0x5da60a={'raw':!![],'where':{'id':_0x2ae3fd['params']['id']}},_0x15f065={};_0x15f065[_0x49fc('0x2f')]=_[_0x49fc('0x30')](db[_0x49fc('0x2c')]['rawAttributes']);_0x15f065[_0x49fc('0x31')]=_[_0x49fc('0x30')](_0x2ae3fd[_0x49fc('0x31')]);_0x15f065['filters']=_['intersection'](_0x15f065[_0x49fc('0x2f')],_0x15f065['query']);_0x5da60a[_0x49fc('0x34')]=_['intersection'](_0x15f065[_0x49fc('0x2f')],qs['fields'](_0x2ae3fd[_0x49fc('0x31')]['fields']));_0x5da60a['attributes']=_0x5da60a[_0x49fc('0x34')][_0x49fc('0x46')]?_0x5da60a[_0x49fc('0x34')]:_0x15f065[_0x49fc('0x2f')];if(_0x2ae3fd[_0x49fc('0x31')]['includeAll']){_0x5da60a['include']=[{'all':!![]}];}_0x5da60a=_[_0x49fc('0x3d')]({},_0x5da60a,_0x2ae3fd['options']);return db[_0x49fc('0x2c')][_0x49fc('0x47')](_0x5da60a)[_0x49fc('0x22')](handleEntityNotFound(_0x4613fc,null))[_0x49fc('0x22')](respondWithResult(_0x4613fc,null))[_0x49fc('0x44')](handleError(_0x4613fc,null));};exports[_0x49fc('0x48')]=function(_0x1b7f64,_0x59cfb3){return db[_0x49fc('0x2c')]['create'](_0x1b7f64[_0x49fc('0x49')],{})[_0x49fc('0x22')](respondWithResult(_0x59cfb3,0xc9))[_0x49fc('0x44')](handleError(_0x59cfb3,null));};exports[_0x49fc('0x4a')]=function(_0x30640c,_0x401a64){if(_0x30640c[_0x49fc('0x49')]['id']){delete _0x30640c[_0x49fc('0x49')]['id'];}return db[_0x49fc('0x2c')][_0x49fc('0x47')]({'where':{'id':_0x30640c['params']['id']}})['then'](handleEntityNotFound(_0x401a64,null))[_0x49fc('0x22')](saveUpdates(_0x30640c[_0x49fc('0x49')],null))['then'](respondWithResult(_0x401a64,null))[_0x49fc('0x44')](handleError(_0x401a64,null));};exports[_0x49fc('0x23')]=function(_0xeb247e,_0x202dbc){return db['ChatTransferReport'][_0x49fc('0x47')]({'where':{'id':_0xeb247e[_0x49fc('0x4b')]['id']}})[_0x49fc('0x22')](handleEntityNotFound(_0x202dbc,null))[_0x49fc('0x22')](removeEntity(_0x202dbc,null))[_0x49fc('0x44')](handleError(_0x202dbc,null));};exports['describe']=function(_0x24a817,_0x272be9){return db[_0x49fc('0x2c')][_0x49fc('0x4c')]()['then'](respondWithResult(_0x272be9,null))[_0x49fc('0x44')](handleError(_0x272be9,null));}; \ No newline at end of file +var _0x7262=['fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x14ed0a,_0x41a9cc){var _0x23566d=function(_0x140f2f){while(--_0x140f2f){_0x14ed0a['push'](_0x14ed0a['shift']());}};_0x23566d(++_0x41a9cc);}(_0x7262,0x120));var _0x2726=function(_0x276512,_0x3c6d80){_0x276512=_0x276512-0x0;var _0xae81f1=_0x7262[_0x276512];return _0xae81f1;};'use strict';var emlformat=require(_0x2726('0x0'));var rimraf=require(_0x2726('0x1'));var zipdir=require(_0x2726('0x2'));var jsonpatch=require(_0x2726('0x3'));var rp=require(_0x2726('0x4'));var moment=require(_0x2726('0x5'));var BPromise=require(_0x2726('0x6'));var Mustache=require(_0x2726('0x7'));var util=require('util');var path=require(_0x2726('0x8'));var sox=require(_0x2726('0x9'));var csv=require(_0x2726('0xa'));var ejs=require(_0x2726('0xb'));var fs=require('fs');var fs_extra=require(_0x2726('0xc'));var _=require('lodash');var squel=require(_0x2726('0xd'));var crypto=require(_0x2726('0xe'));var jsforce=require(_0x2726('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2726('0xa'));var querystring=require(_0x2726('0x10'));var Papa=require('papaparse');var Redis=require(_0x2726('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2726('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2726('0x13'))('api');var utils=require(_0x2726('0x14'));var config=require(_0x2726('0x15'));var licenseUtil=require(_0x2726('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d220c,_0x24d8b9){_0x24d8b9=_0x24d8b9||0xcc;return function(_0x27f423){if(_0x27f423){return _0x2d220c['sendStatus'](_0x24d8b9);}return _0x2d220c[_0x2726('0x17')](_0x24d8b9)[_0x2726('0x18')]();};}function respondWithResult(_0x295837,_0xa52e62){_0xa52e62=_0xa52e62||0xc8;return function(_0x1e2dc5){if(_0x1e2dc5){return _0x295837[_0x2726('0x17')](_0xa52e62)[_0x2726('0x19')](_0x1e2dc5);}};}function respondWithFilteredResult(_0x246b94,_0x5effb3){return function(_0x306b7f){if(_0x306b7f){var _0x1a5de2=typeof _0x5effb3[_0x2726('0x1a')]===_0x2726('0x1b')&&typeof _0x5effb3[_0x2726('0x1c')]===_0x2726('0x1b');var _0x4ffd4b=_0x306b7f[_0x2726('0x1d')];var _0x47cc7a=_0x1a5de2?0x0:_0x5effb3[_0x2726('0x1a')];var _0x34c2a6=_0x1a5de2?_0x306b7f[_0x2726('0x1d')]:_0x5effb3[_0x2726('0x1a')]+_0x5effb3[_0x2726('0x1c')];var _0x15e1ce;if(_0x34c2a6>=_0x4ffd4b){_0x34c2a6=_0x4ffd4b;_0x15e1ce=0xc8;}else{_0x15e1ce=0xce;}_0x246b94[_0x2726('0x17')](_0x15e1ce);return _0x246b94[_0x2726('0x1e')](_0x2726('0x1f'),_0x47cc7a+'-'+_0x34c2a6+'/'+_0x4ffd4b)['json'](_0x306b7f);}return null;};}function patchUpdates(_0x3c32d2){return function(_0x9368b){try{jsonpatch[_0x2726('0x20')](_0x9368b,_0x3c32d2,!![]);}catch(_0xe9c800){return BPromise[_0x2726('0x21')](_0xe9c800);}return _0x9368b[_0x2726('0x22')]();};}function saveUpdates(_0x57c633,_0x5f1b9b){return function(_0x261669){if(_0x261669){return _0x261669['update'](_0x57c633)['then'](function(_0xe0b30d){return _0xe0b30d;});}return null;};}function removeEntity(_0x1d570e,_0xd819e0){return function(_0x5b75fa){if(_0x5b75fa){return _0x5b75fa[_0x2726('0x23')]()[_0x2726('0x24')](function(){_0x1d570e[_0x2726('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x512bff,_0x2d1eef){return function(_0x33fd7d){if(!_0x33fd7d){_0x512bff['sendStatus'](0x194);}return _0x33fd7d;};}function handleError(_0x1ee2ed,_0x9be158){_0x9be158=_0x9be158||0x1f4;return function(_0x54da61){logger[_0x2726('0x25')](_0x54da61[_0x2726('0x26')]);if(_0x54da61[_0x2726('0x27')]){delete _0x54da61['name'];}_0x1ee2ed['status'](_0x9be158)[_0x2726('0x28')](_0x54da61);};}exports[_0x2726('0x29')]=function(_0x41ed14,_0x36a715){var _0x1bdbe8={},_0x4e7ff9={},_0x17e457={'count':0x0,'rows':[]};var _0x12c7ce=_[_0x2726('0x2a')](db[_0x2726('0x2b')][_0x2726('0x2c')],function(_0xd5a3db){return{'name':_0xd5a3db['fieldName'],'type':_0xd5a3db[_0x2726('0x2d')][_0x2726('0x2e')]};});_0x4e7ff9['model']=_[_0x2726('0x2a')](_0x12c7ce,_0x2726('0x27'));_0x4e7ff9[_0x2726('0x2f')]=_[_0x2726('0x30')](_0x41ed14[_0x2726('0x2f')]);_0x4e7ff9[_0x2726('0x31')]=_[_0x2726('0x32')](_0x4e7ff9[_0x2726('0x33')],_0x4e7ff9[_0x2726('0x2f')]);_0x1bdbe8[_0x2726('0x34')]=_[_0x2726('0x32')](_0x4e7ff9[_0x2726('0x33')],qs[_0x2726('0x35')](_0x41ed14[_0x2726('0x2f')][_0x2726('0x35')]));_0x1bdbe8[_0x2726('0x34')]=_0x1bdbe8['attributes'][_0x2726('0x36')]?_0x1bdbe8['attributes']:_0x4e7ff9[_0x2726('0x33')];if(!_0x41ed14[_0x2726('0x2f')][_0x2726('0x37')]('nolimit')){_0x1bdbe8[_0x2726('0x1c')]=qs[_0x2726('0x1c')](_0x41ed14[_0x2726('0x2f')]['limit']);_0x1bdbe8['offset']=qs[_0x2726('0x1a')](_0x41ed14[_0x2726('0x2f')][_0x2726('0x1a')]);}_0x1bdbe8[_0x2726('0x38')]=qs['sort'](_0x41ed14[_0x2726('0x2f')][_0x2726('0x39')]);_0x1bdbe8[_0x2726('0x3a')]=qs[_0x2726('0x31')](_[_0x2726('0x3b')](_0x41ed14[_0x2726('0x2f')],_0x4e7ff9['filters']),_0x12c7ce);if(_0x41ed14['query'][_0x2726('0x3c')]){_0x1bdbe8[_0x2726('0x3a')]=_['merge'](_0x1bdbe8['where'],{'$or':_[_0x2726('0x2a')](_0x12c7ce,function(_0x3d6ccf){if(_0x3d6ccf[_0x2726('0x2d')]!=='VIRTUAL'){var _0x87423d={};_0x87423d[_0x3d6ccf[_0x2726('0x27')]]={'$like':'%'+_0x41ed14[_0x2726('0x2f')][_0x2726('0x3c')]+'%'};return _0x87423d;}})});}_0x1bdbe8=_[_0x2726('0x3d')]({},_0x1bdbe8,_0x41ed14[_0x2726('0x3e')]);var _0x3b8f4c={'where':_0x1bdbe8['where']};return db[_0x2726('0x2b')][_0x2726('0x1d')](_0x3b8f4c)[_0x2726('0x24')](function(_0x3fe09b){_0x17e457[_0x2726('0x1d')]=_0x3fe09b;if(_0x41ed14[_0x2726('0x2f')]['includeAll']){_0x1bdbe8[_0x2726('0x3f')]=[{'all':!![]}];}return db[_0x2726('0x2b')][_0x2726('0x40')](_0x1bdbe8);})['then'](function(_0x2de53f){_0x17e457[_0x2726('0x41')]=_0x2de53f;return _0x17e457;})[_0x2726('0x24')](respondWithFilteredResult(_0x36a715,_0x1bdbe8))[_0x2726('0x42')](handleError(_0x36a715,null));};exports[_0x2726('0x43')]=function(_0x3be49,_0x3bf628){var _0x353cf0={'raw':!![],'where':{'id':_0x3be49[_0x2726('0x44')]['id']}},_0xcaf0fe={};_0xcaf0fe['model']=_[_0x2726('0x30')](db['ChatTransferReport']['rawAttributes']);_0xcaf0fe[_0x2726('0x2f')]=_['keys'](_0x3be49['query']);_0xcaf0fe[_0x2726('0x31')]=_[_0x2726('0x32')](_0xcaf0fe[_0x2726('0x33')],_0xcaf0fe['query']);_0x353cf0[_0x2726('0x34')]=_[_0x2726('0x32')](_0xcaf0fe['model'],qs['fields'](_0x3be49[_0x2726('0x2f')]['fields']));_0x353cf0[_0x2726('0x34')]=_0x353cf0['attributes'][_0x2726('0x36')]?_0x353cf0[_0x2726('0x34')]:_0xcaf0fe[_0x2726('0x33')];if(_0x3be49[_0x2726('0x2f')][_0x2726('0x45')]){_0x353cf0[_0x2726('0x3f')]=[{'all':!![]}];}_0x353cf0=_['merge']({},_0x353cf0,_0x3be49['options']);return db[_0x2726('0x2b')][_0x2726('0x46')](_0x353cf0)[_0x2726('0x24')](handleEntityNotFound(_0x3bf628,null))[_0x2726('0x24')](respondWithResult(_0x3bf628,null))['catch'](handleError(_0x3bf628,null));};exports[_0x2726('0x47')]=function(_0x1cf1bc,_0x1425fd){return db['ChatTransferReport'][_0x2726('0x47')](_0x1cf1bc[_0x2726('0x48')],{})[_0x2726('0x24')](respondWithResult(_0x1425fd,0xc9))[_0x2726('0x42')](handleError(_0x1425fd,null));};exports[_0x2726('0x49')]=function(_0x5835a3,_0x1f0a10){if(_0x5835a3[_0x2726('0x48')]['id']){delete _0x5835a3[_0x2726('0x48')]['id'];}return db['ChatTransferReport'][_0x2726('0x46')]({'where':{'id':_0x5835a3[_0x2726('0x44')]['id']}})[_0x2726('0x24')](handleEntityNotFound(_0x1f0a10,null))['then'](saveUpdates(_0x5835a3['body'],null))[_0x2726('0x24')](respondWithResult(_0x1f0a10,null))[_0x2726('0x42')](handleError(_0x1f0a10,null));};exports[_0x2726('0x23')]=function(_0x3aba2e,_0x58da79){return db[_0x2726('0x2b')]['find']({'where':{'id':_0x3aba2e['params']['id']}})['then'](handleEntityNotFound(_0x58da79,null))[_0x2726('0x24')](removeEntity(_0x58da79,null))['catch'](handleError(_0x58da79,null));};exports['describe']=function(_0x9a0b68,_0x54d60e){return db[_0x2726('0x2b')][_0x2726('0x4a')]()[_0x2726('0x24')](respondWithResult(_0x54d60e,null))['catch'](handleError(_0x54d60e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4c6dbc1..859f066 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 _0x2db6=['exports','define','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./chatTransferReport.attributes'];(function(_0x2bd408,_0x4c5659){var _0x54c9f1=function(_0x11e6e3){while(--_0x11e6e3){_0x2bd408['push'](_0x2bd408['shift']());}};_0x54c9f1(++_0x4c5659);}(_0x2db6,0xa8));var _0x62db=function(_0x38b7fc,_0xe48357){_0x38b7fc=_0x38b7fc-0x0;var _0x43b19a=_0x2db6[_0x38b7fc];return _0x43b19a;};'use strict';var _=require(_0x62db('0x0'));var util=require(_0x62db('0x1'));var logger=require(_0x62db('0x2'))(_0x62db('0x3'));var moment=require(_0x62db('0x4'));var BPromise=require('bluebird');var rp=require(_0x62db('0x5'));var fs=require('fs');var path=require(_0x62db('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62db('0x7'));module[_0x62db('0x8')]=function(_0x131989,_0x571f6d){return _0x131989[_0x62db('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x62db('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd39=['path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x35c465,_0x145c45){var _0x265c03=function(_0x37281b){while(--_0x37281b){_0x35c465['push'](_0x35c465['shift']());}};_0x265c03(++_0x145c45);}(_0xfd39,0x80));var _0x9fd3=function(_0x2807e0,_0x5a47a9){_0x2807e0=_0x2807e0-0x0;var _0xdb0595=_0xfd39[_0x2807e0];return _0xdb0595;};'use strict';var _=require(_0x9fd3('0x0'));var util=require(_0x9fd3('0x1'));var logger=require(_0x9fd3('0x2'))(_0x9fd3('0x3'));var moment=require(_0x9fd3('0x4'));var BPromise=require(_0x9fd3('0x5'));var rp=require(_0x9fd3('0x6'));var fs=require('fs');var path=require(_0x9fd3('0x7'));var rimraf=require(_0x9fd3('0x8'));var config=require('../../config/environment');var attributes=require(_0x9fd3('0x9'));module[_0x9fd3('0xa')]=function(_0x32d60b,_0x37073c){return _0x32d60b[_0x9fd3('0xb')](_0x9fd3('0xc'),attributes,{'tableName':_0x9fd3('0xd'),'paranoid':![],'indexes':[{'name':_0x9fd3('0xe'),'fields':[_0x9fd3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 890eda4..89e1818 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 _0x07b8=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x36ed40,_0x13d2fc){var _0x1069ab=function(_0x19289f){while(--_0x19289f){_0x36ed40['push'](_0x36ed40['shift']());}};_0x1069ab(++_0x13d2fc);}(_0x07b8,0x1ae));var _0x807b=function(_0x5621b4,_0x49c7bd){_0x5621b4=_0x5621b4-0x0;var _0x54bb44=_0x07b8[_0x5621b4];return _0x54bb44;};'use strict';var _=require('lodash');var util=require(_0x807b('0x0'));var moment=require('moment');var BPromise=require(_0x807b('0x1'));var rs=require(_0x807b('0x2'));var fs=require('fs');var Redis=require(_0x807b('0x3'));var db=require(_0x807b('0x4'))['db'];var utils=require(_0x807b('0x5'));var logger=require(_0x807b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x807b('0x7'));var client=jayson[_0x807b('0x8')][_0x807b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x226fa5,_0xb5f2cb,_0x353cfc){return new BPromise(function(_0x6167b5,_0x385586){return client[_0x807b('0xa')](_0x226fa5,_0x353cfc)[_0x807b('0xb')](function(_0x299ee8){logger[_0x807b('0xc')](_0x807b('0xd'),_0xb5f2cb,_0x807b('0xe'));logger[_0x807b('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xb5f2cb,_0x807b('0xe'),JSON['stringify'](_0x299ee8));if(_0x299ee8[_0x807b('0x10')]){if(_0x299ee8[_0x807b('0x10')][_0x807b('0x11')]===0x1f4){logger[_0x807b('0x10')](_0x807b('0xd'),_0xb5f2cb,_0x299ee8[_0x807b('0x10')][_0x807b('0x12')]);return _0x385586(_0x299ee8[_0x807b('0x10')][_0x807b('0x12')]);}logger[_0x807b('0x10')](_0x807b('0xd'),_0xb5f2cb,_0x299ee8['error'][_0x807b('0x12')]);return _0x6167b5(_0x299ee8[_0x807b('0x10')][_0x807b('0x12')]);}else{logger[_0x807b('0xc')](_0x807b('0xd'),_0xb5f2cb,'request\x20sent');_0x6167b5(_0x299ee8[_0x807b('0x13')][_0x807b('0x12')]);}})[_0x807b('0x14')](function(_0x41c122){logger[_0x807b('0x10')](_0x807b('0xd'),_0xb5f2cb,_0x41c122);_0x385586(_0x41c122);});});} \ No newline at end of file +var _0x0762=['client','http','request','then','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x2ae0af,_0x2ba5f2){var _0xbd8402=function(_0x417762){while(--_0x417762){_0x2ae0af['push'](_0x2ae0af['shift']());}};_0xbd8402(++_0x2ba5f2);}(_0x0762,0x10b));var _0x2076=function(_0x4530a5,_0x3c4e64){_0x4530a5=_0x4530a5-0x0;var _0x24026a=_0x0762[_0x4530a5];return _0x24026a;};'use strict';var _=require(_0x2076('0x0'));var util=require(_0x2076('0x1'));var moment=require('moment');var BPromise=require(_0x2076('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2076('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2076('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2076('0x5'));var client=jayson[_0x2076('0x6')][_0x2076('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f8ceb,_0x799b56,_0x180fd3){return new BPromise(function(_0x31fc04,_0x493b1d){return client[_0x2076('0x8')](_0x2f8ceb,_0x180fd3)[_0x2076('0x9')](function(_0xc1161f){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x799b56,'request\x20sent');logger[_0x2076('0xa')](_0x2076('0xb'),_0x799b56,'request\x20sent',JSON[_0x2076('0xc')](_0xc1161f));if(_0xc1161f[_0x2076('0xd')]){if(_0xc1161f['error'][_0x2076('0xe')]===0x1f4){logger[_0x2076('0xd')](_0x2076('0xf'),_0x799b56,_0xc1161f[_0x2076('0xd')][_0x2076('0x10')]);return _0x493b1d(_0xc1161f[_0x2076('0xd')][_0x2076('0x10')]);}logger['error'](_0x2076('0xf'),_0x799b56,_0xc1161f[_0x2076('0xd')][_0x2076('0x10')]);return _0x31fc04(_0xc1161f[_0x2076('0xd')]['message']);}else{logger[_0x2076('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x799b56,_0x2076('0x12'));_0x31fc04(_0xc1161f[_0x2076('0x13')]['message']);}})[_0x2076('0x14')](function(_0x4de1f6){logger[_0x2076('0xd')](_0x2076('0xf'),_0x799b56,_0x4de1f6);_0x493b1d(_0x4de1f6);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 13c6b46..7b3cb65 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 _0x8983=['../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0x43555b,_0x1774ce){var _0x46291d=function(_0xd9bf4a){while(--_0xd9bf4a){_0x43555b['push'](_0x43555b['shift']());}};_0x46291d(++_0x1774ce);}(_0x8983,0x13e));var _0x3898=function(_0x51f950,_0x3ecf51){_0x51f950=_0x51f950-0x0;var _0x3941d9=_0x8983[_0x51f950];return _0x3941d9;};'use strict';var multer=require(_0x3898('0x0'));var util=require(_0x3898('0x1'));var path=require('path');var timeout=require(_0x3898('0x2'));var express=require(_0x3898('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3898('0x4'));var config=require(_0x3898('0x5'));var controller=require(_0x3898('0x6'));router['get']('/',auth[_0x3898('0x7')](),controller[_0x3898('0x8')]);router[_0x3898('0x9')](_0x3898('0xa'),auth[_0x3898('0x7')](),controller[_0x3898('0xb')]);router[_0x3898('0x9')]('/:id',auth[_0x3898('0x7')](),controller[_0x3898('0xc')]);router[_0x3898('0xd')]('/',auth[_0x3898('0x7')](),controller['create']);router[_0x3898('0xe')](_0x3898('0xf'),auth[_0x3898('0x7')](),controller[_0x3898('0x10')]);router[_0x3898('0x11')](_0x3898('0xf'),auth[_0x3898('0x7')](),controller[_0x3898('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc58b=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x382a9d,_0x470845){var _0xc14eda=function(_0x4b6445){while(--_0x4b6445){_0x382a9d['push'](_0x382a9d['shift']());}};_0xc14eda(++_0x470845);}(_0xc58b,0x179));var _0xbc58=function(_0x573400,_0x585d43){_0x573400=_0x573400-0x0;var _0x47d31a=_0xc58b[_0x573400];return _0x47d31a;};'use strict';var multer=require(_0xbc58('0x0'));var util=require(_0xbc58('0x1'));var path=require(_0xbc58('0x2'));var timeout=require(_0xbc58('0x3'));var express=require(_0xbc58('0x4'));var router=express['Router']();var fs_extra=require(_0xbc58('0x5'));var auth=require(_0xbc58('0x6'));var interaction=require(_0xbc58('0x7'));var config=require(_0xbc58('0x8'));var controller=require(_0xbc58('0x9'));router[_0xbc58('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbc58('0xa')]('/describe',auth[_0xbc58('0xb')](),controller['describe']);router[_0xbc58('0xa')](_0xbc58('0xc'),auth[_0xbc58('0xb')](),controller[_0xbc58('0xd')]);router['post']('/',auth[_0xbc58('0xb')](),controller[_0xbc58('0xe')]);router[_0xbc58('0xf')](_0xbc58('0xc'),auth[_0xbc58('0xb')](),controller[_0xbc58('0x10')]);router[_0xbc58('0x11')]('/:id',auth[_0xbc58('0xb')](),controller[_0xbc58('0x12')]);module[_0xbc58('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 bfe7296..e61e2c2 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 _0x41bb=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','name','text','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion'];(function(_0x3e9092,_0x2b7060){var _0x47e452=function(_0x2f93dc){while(--_0x2f93dc){_0x3e9092['push'](_0x3e9092['shift']());}};_0x47e452(++_0x2b7060);}(_0x41bb,0xc5));var _0xb41b=function(_0xd45615,_0x1eee52){_0xd45615=_0xd45615-0x0;var _0xde4c1c=_0x41bb[_0xd45615];return _0xde4c1c;};'use strict';var Sequelize=require(_0xb41b('0x0'));var rs=require(_0xb41b('0x1'));module['exports']={'name':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb41b('0x3')},'description':{'type':Sequelize[_0xb41b('0x2')]},'mapKey':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x4')},'key':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb41b('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':_0xb41b('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':_0xb41b('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb41b('0x2')]},'animation':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xb41b('0x9'),'squared'),'defaultValue':_0xb41b('0x9')},'header_online':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xa')},'start_chat_button':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0xc')},'header_offline':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xd')},'download_transcript':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb41b('0xe')]},'closingQuestion':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x11')},'noteTitle':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x12')},'placeholderMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x13')},'closingMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xb41b('0x16')](_0xb41b('0x17'),_0xb41b('0x18')),'defaultValue':_0xb41b('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xb41b('0x19'),'type':_0xb41b('0x1a'),'required':!![]},'props':{'title':_0xb41b('0x19'),'helpText':''}},{'type':'input','props':{'title':_0xb41b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb41b('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb41b('0x1b')](_0xb41b('0x1c'))?JSON['parse'](this[_0xb41b('0x1b')]('onlineForm')):{};},'set':function(_0x2d0f27){return this[_0xb41b('0x1d')]('onlineForm',JSON[_0xb41b('0x1e')](_0x2d0f27));}},'offlineForm':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xb41b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb41b('0x4'),'type':_0xb41b('0x4')},'variable':null},{'type':_0xb41b('0x1f'),'config':{'placeholder':_0xb41b('0x20')},'props':{'title':_0xb41b('0x20'),'helpText':_0xb41b('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xb41b('0x22'))?JSON[_0xb41b('0x23')](this['getDataValue'](_0xb41b('0x22'))):{};},'set':function(_0x482764){return this[_0xb41b('0x1d')](_0xb41b('0x22'),JSON['stringify'](_0x482764));}},'token':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb41b('0x2')]},'forwardOffline':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb41b('0x2')]},'waitingTitle':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x24')},'waitingMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x26')},'offlineMessageBody':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x15')},'sendUnmanaged':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb41b('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb41b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':function(){return _0xb41b('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x2a')},'defaultTitle':{'type':Sequelize[_0xb41b('0x2')]},'customerAvatar':{'type':Sequelize[_0xb41b('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb41b('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x2c')},'systemAvatar':{'type':Sequelize[_0xb41b('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb41b('0x7')],'comment':_0xb41b('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x49e8c4){if(!_0x49e8c4)this['setDataValue'](_0xb41b('0x2e'),null);this['setDataValue']('mandatoryDisposition',_0x49e8c4);}},'vidaooEscalation':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':_0xb41b('0x2f')},'vidaooNote':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':function(){return _0xb41b('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb41b('0xe')]}}; \ No newline at end of file +var _0x55e0=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x3e4b17,_0x1398fd){var _0xa2914=function(_0xd33528){while(--_0xd33528){_0x3e4b17['push'](_0x3e4b17['shift']());}};_0xa2914(++_0x1398fd);}(_0x55e0,0xdc));var _0x055e=function(_0x5c7dc6,_0x2f7fe2){_0x5c7dc6=_0x5c7dc6-0x0;var _0x3d0dc4=_0x55e0[_0x5c7dc6];return _0x3d0dc4;};'use strict';var Sequelize=require(_0x055e('0x0'));var rs=require(_0x055e('0x1'));module[_0x055e('0x2')]={'name':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x055e('0x3')]},'mapKey':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'key':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x055e('0x3')]},'animation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x055e('0x9')]('rounded','squared'),'defaultValue':_0x055e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0xb')},'start_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xc')},'offline_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'header_offline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x055e('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x13')},'noteTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x14')},'placeholderMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x16')},'closingMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'skipMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x17')},'ratingType':{'type':Sequelize[_0x055e('0x9')](_0x055e('0x18'),_0x055e('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON[_0x055e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x055e('0x1b'),'type':_0x055e('0x1c'),'required':!![]},'props':{'title':_0x055e('0x1b'),'helpText':''}},{'type':_0x055e('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x1f'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')](_0x055e('0x1f'))):{};},'set':function(_0x4c653c){return this['setDataValue'](_0x055e('0x1f'),JSON[_0x055e('0x1a')](_0x4c653c));}},'offlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x055e('0x1d'),'props':{'title':_0x055e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':_0x055e('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x055e('0x21')},'props':{'title':'Comments','helpText':_0x055e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x23'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')]('offlineForm')):{};},'set':function(_0x99a372){return this[_0x055e('0x24')](_0x055e('0x23'),JSON[_0x055e('0x1a')](_0x99a372));}},'token':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return rs[_0x055e('0x25')]();}},'autoclose':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x055e('0x3')]},'forwardOffline':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x26')},'waitingMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x29')},'sendUnmanaged':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x055e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x055e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return _0x055e('0x2a');}},'notificationSound':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2c')},'verticalAlignment':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2e')},'defaultTitle':{'type':Sequelize[_0x055e('0x3')]},'customerAvatar':{'type':Sequelize[_0x055e('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x30')},'systemAvatar':{'type':Sequelize[_0x055e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x055e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1012a4){if(!_0x1012a4)this[_0x055e('0x24')](_0x055e('0x32'),null);this['setDataValue'](_0x055e('0x33'),_0x1012a4);}},'vidaooEscalation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x34')},'vidaooNote':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x055e('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x055e('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 17e98d5..47f8d20 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 _0x51a8=['sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','ChatApplication','Applications','account','applications','list','List','orderBy','priority','headers','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','ONLINE','OFFLINE','No\x20timezone','Interval','getProactiveActions','../../config/license/util','virtual','custom','chatLicenseExceeded','Intervals','push','all','some','readFileSync','server/files/chat/iframe.ejs','URL','3.1.0','x-forwarded-for','x-real-ip','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','omit','getFields','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','get','ChatWebsites','UserProfileResource','destroy','stack','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','map','name','keys','filters','intersection','model','query','fields','attributes','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','ChatWebsite','include','findAll','rows','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','getAnswers','CannedAnswer','includeAll','removeAnswers','ids','addLogo'];(function(_0x2b704a,_0x7c5ca9){var _0x41eb36=function(_0x1bbc21){while(--_0x1bbc21){_0x2b704a['push'](_0x2b704a['shift']());}};_0x41eb36(++_0x7c5ca9);}(_0x51a8,0xc5));var _0x851a=function(_0x16c02d,_0x24d20d){_0x16c02d=_0x16c02d-0x0;var _0x27f7ec=_0x51a8[_0x16c02d];return _0x27f7ec;};'use strict';var BPromise=require(_0x851a('0x0'));var Mustache=require('mustache');var util=require(_0x851a('0x1'));var path=require('path');var ejs=require(_0x851a('0x2'));var fs=require('fs');var fs_extra=require(_0x851a('0x3'));var _=require(_0x851a('0x4'));var querystring=require(_0x851a('0x5'));var Redis=require('ioredis');var qs=require(_0x851a('0x6'));var logger=require(_0x851a('0x7'))(_0x851a('0x8'));var config=require(_0x851a('0x9'));var url=require(_0x851a('0xa'));var db=require(_0x851a('0xb'))['db'];config[_0x851a('0xc')]=_[_0x851a('0xd')](config['redis'],{'host':_0x851a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x851a('0xc')]));require(_0x851a('0xf'))[_0x851a('0x10')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x851a('0x11'));var client=jayson[_0x851a('0x12')][_0x851a('0x13')]({'port':0x232c});var client9002=jayson['client'][_0x851a('0x13')]({'port':0x232a});var client9003=jayson[_0x851a('0x12')][_0x851a('0x13')]({'port':0x232b});var client9001=jayson[_0x851a('0x12')]['http']({'port':0x2329});function respondWithRpcPromise(_0x250074,_0x5c4373,_0x4dc52f,_0x5af44a){return new BPromise(function(_0x1c334f,_0xc1ef83){var _0x42f8eb=_0x5af44a||client;return _0x42f8eb[_0x851a('0x14')](_0x250074,_0x4dc52f)[_0x851a('0x15')](function(_0x343f1f){logger[_0x851a('0x16')](_0x851a('0x17'),_0x5c4373,_0x851a('0x18'));logger[_0x851a('0x19')](_0x851a('0x1a'),_0x5c4373,_0x851a('0x18'),JSON[_0x851a('0x1b')](_0x343f1f));if(_0x343f1f[_0x851a('0x1c')]){if(_0x343f1f['error'][_0x851a('0x1d')]===0x1f4){logger['error'](_0x851a('0x17'),_0x5c4373,_0x343f1f['error'][_0x851a('0x1e')]);return _0xc1ef83(_0x343f1f['error'][_0x851a('0x1e')]);}logger[_0x851a('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5c4373,_0x343f1f[_0x851a('0x1c')]['message']);return _0x1c334f(_0x343f1f[_0x851a('0x1c')][_0x851a('0x1e')]);}else{logger[_0x851a('0x16')](_0x851a('0x17'),_0x5c4373,'request\x20sent');_0x1c334f(_0x343f1f[_0x851a('0x1f')]['message']);}})[_0x851a('0x20')](function(_0x39fa52){logger[_0x851a('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5c4373,_0x39fa52);_0xc1ef83(_0x39fa52);});});}function respondWithStatusCode(_0x207128,_0x32e55c){_0x32e55c=_0x32e55c||0xcc;return function(_0x13a92c){if(_0x13a92c){return _0x207128[_0x851a('0x21')](_0x32e55c);}return _0x207128[_0x851a('0x22')](_0x32e55c)[_0x851a('0x23')]();};}function respondWithResult(_0x46579c,_0x1b9eb4){_0x1b9eb4=_0x1b9eb4||0xc8;return function(_0x14bc9b){if(_0x14bc9b){return _0x46579c[_0x851a('0x22')](_0x1b9eb4)[_0x851a('0x24')](_0x14bc9b);}};}function respondWithFilteredResult(_0x146bd5,_0x382f7c){return function(_0x139cb2){if(_0x139cb2){var _0x15d3f9=typeof _0x382f7c[_0x851a('0x25')]===_0x851a('0x26')&&typeof _0x382f7c[_0x851a('0x27')]===_0x851a('0x26');var _0x46ef07=_0x139cb2[_0x851a('0x28')];var _0x1443f0=_0x15d3f9?0x0:_0x382f7c[_0x851a('0x25')];var _0xa0ff11=_0x15d3f9?_0x139cb2[_0x851a('0x28')]:_0x382f7c['offset']+_0x382f7c[_0x851a('0x27')];var _0x1459e8;if(_0xa0ff11>=_0x46ef07){_0xa0ff11=_0x46ef07;_0x1459e8=0xc8;}else{_0x1459e8=0xce;}_0x146bd5[_0x851a('0x22')](_0x1459e8);return _0x146bd5[_0x851a('0x29')]('Content-Range',_0x1443f0+'-'+_0xa0ff11+'/'+_0x46ef07)[_0x851a('0x24')](_0x139cb2);}return null;};}function saveUpdates(_0x1e176b){return function(_0x3db25e){if(_0x3db25e){return _0x3db25e[_0x851a('0x2a')](_0x1e176b)[_0x851a('0x15')](function(_0x392704){return _0x392704;});}return null;};}function removeEntity(_0x2b70ac){return function(_0x2f5490){if(_0x2f5490){return _0x2f5490['destroy']()[_0x851a('0x15')](function(){var _0x360c82=_0x2f5490[_0x851a('0x2b')]({'plain':!![]});var _0x5daea4=_0x851a('0x2c');return db[_0x851a('0x2d')][_0x851a('0x2e')]({'where':{'type':_0x5daea4,'resourceId':_0x360c82['id']}})[_0x851a('0x15')](function(){return _0x2f5490;});})[_0x851a('0x15')](function(){_0x2b70ac[_0x851a('0x22')](0xcc)[_0x851a('0x23')]();});}};}function handleEntityNotFound(_0x348d53){return function(_0x3139f2){if(!_0x3139f2){_0x348d53[_0x851a('0x21')](0x194);}return _0x3139f2;};}function handleError(_0x3dbce1,_0x5adbcc){_0x5adbcc=_0x5adbcc||0x1f4;return function(_0xca90ef){logger[_0x851a('0x1c')](_0xca90ef[_0x851a('0x2f')]);if(_0xca90ef['name']){delete _0xca90ef['name'];}_0x3dbce1[_0x851a('0x22')](_0x5adbcc)[_0x851a('0x30')](_0xca90ef);};}exports[_0x851a('0x31')]=function(_0x1619ea,_0x3c7e54){var _0x4c629f={'include':[{'model':db[_0x851a('0x32')],'as':_0x851a('0x33')}]},_0x584ec2={},_0x5dec4d={'count':0x0,'rows':[]};var _0x143bb0=_['map'](db['ChatWebsite'][_0x851a('0x34')],function(_0xdfce00){return{'name':_0xdfce00[_0x851a('0x35')],'type':_0xdfce00['type'][_0x851a('0x36')]};});_0x584ec2['model']=_[_0x851a('0x37')](_0x143bb0,_0x851a('0x38'));_0x584ec2['query']=_[_0x851a('0x39')](_0x1619ea['query']);_0x584ec2[_0x851a('0x3a')]=_[_0x851a('0x3b')](_0x584ec2[_0x851a('0x3c')],_0x584ec2[_0x851a('0x3d')]);_0x4c629f['attributes']=_[_0x851a('0x3b')](_0x584ec2['model'],qs[_0x851a('0x3e')](_0x1619ea[_0x851a('0x3d')]['fields']));_0x4c629f['attributes']=_0x4c629f[_0x851a('0x3f')]['length']?_0x4c629f[_0x851a('0x3f')]:_0x584ec2['model'];if(!_0x1619ea[_0x851a('0x3d')]['hasOwnProperty'](_0x851a('0x40'))){_0x4c629f['limit']=qs[_0x851a('0x27')](_0x1619ea[_0x851a('0x3d')]['limit']);_0x4c629f[_0x851a('0x25')]=qs[_0x851a('0x25')](_0x1619ea['query']['offset']);}_0x4c629f[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x1619ea['query'][_0x851a('0x42')]);_0x4c629f[_0x851a('0x43')]=qs['filters'](_['pick'](_0x1619ea[_0x851a('0x3d')],_0x584ec2['filters']),_0x143bb0);if(_0x1619ea[_0x851a('0x3d')]['filter']){_0x4c629f[_0x851a('0x43')]=_[_0x851a('0x44')](_0x4c629f[_0x851a('0x43')],{'$or':_[_0x851a('0x37')](_0x143bb0,function(_0x55f374){if(_0x55f374[_0x851a('0x45')]!==_0x851a('0x46')){var _0x67f951={};_0x67f951[_0x55f374[_0x851a('0x38')]]={'$like':'%'+_0x1619ea['query'][_0x851a('0x47')]+'%'};return _0x67f951;}})});}_0x4c629f=_[_0x851a('0x44')]({},_0x4c629f,_0x1619ea[_0x851a('0x48')]);var _0x46e392={'where':_0x4c629f['where']};return db[_0x851a('0x49')]['count'](_0x46e392)[_0x851a('0x15')](function(_0x46965e){_0x5dec4d[_0x851a('0x28')]=_0x46965e;if(_0x1619ea['query']['includeAll']){_0x4c629f[_0x851a('0x4a')]=[{'all':!![]}];}return db[_0x851a('0x49')][_0x851a('0x4b')](_0x4c629f);})[_0x851a('0x15')](function(_0x4e173e){_0x5dec4d[_0x851a('0x4c')]=_0x4e173e;return _0x5dec4d;})[_0x851a('0x15')](respondWithFilteredResult(_0x3c7e54,_0x4c629f))[_0x851a('0x20')](handleError(_0x3c7e54,null));};exports[_0x851a('0x4d')]=function(_0x1eacbe,_0x345856){var _0x5a0e71={'raw':![],'where':{'id':_0x1eacbe['params']['id']},'include':[{'model':db[_0x851a('0x32')],'as':'mandatoryDispositionPause'}]},_0x4e46b9={};_0x4e46b9['model']=_[_0x851a('0x39')](db[_0x851a('0x49')]['rawAttributes']);_0x4e46b9[_0x851a('0x3d')]=_[_0x851a('0x39')](_0x1eacbe[_0x851a('0x3d')]);_0x4e46b9['filters']=_[_0x851a('0x3b')](_0x4e46b9[_0x851a('0x3c')],_0x4e46b9['query']);_0x5a0e71['attributes']=_[_0x851a('0x3b')](_0x4e46b9[_0x851a('0x3c')],qs['fields'](_0x1eacbe[_0x851a('0x3d')][_0x851a('0x3e')]));_0x5a0e71[_0x851a('0x3f')]=_0x5a0e71[_0x851a('0x3f')][_0x851a('0x4e')]?_0x5a0e71[_0x851a('0x3f')]:_0x4e46b9[_0x851a('0x3c')];if(_0x1eacbe[_0x851a('0x3d')]['includeAll']){_0x5a0e71[_0x851a('0x4a')]=[{'all':!![]}];}_0x5a0e71=_[_0x851a('0x44')]({},_0x5a0e71,_0x1eacbe['options']);return db[_0x851a('0x49')][_0x851a('0x4f')](_0x5a0e71)[_0x851a('0x15')](handleEntityNotFound(_0x345856,null))[_0x851a('0x15')](respondWithResult(_0x345856,null))['catch'](handleError(_0x345856,null));};exports[_0x851a('0x50')]=function(_0x4b443a,_0x523557){return db[_0x851a('0x49')][_0x851a('0x50')](_0x4b443a['body'],{})[_0x851a('0x15')](function(_0x2871fd){var _0x40776c=_0x4b443a[_0x851a('0x51')][_0x851a('0x2b')]({'plain':!![]});if(!_0x40776c)throw new Error(_0x851a('0x52'));if(_0x40776c['role']===_0x851a('0x51')){var _0x3e338c=_0x2871fd['get']({'plain':!![]});var _0x7ddca1=_0x851a('0x2c');return db['UserProfileSection'][_0x851a('0x4f')]({'where':{'name':_0x7ddca1,'userProfileId':_0x40776c[_0x851a('0x53')]},'raw':!![]})[_0x851a('0x15')](function(_0xe30d06){if(_0xe30d06&&_0xe30d06[_0x851a('0x54')]===0x0){return db[_0x851a('0x2d')][_0x851a('0x50')]({'name':_0x3e338c['name'],'resourceId':_0x3e338c['id'],'type':_0xe30d06[_0x851a('0x38')],'sectionId':_0xe30d06['id']},{})['then'](function(){return _0x2871fd;});}else{return _0x2871fd;}})[_0x851a('0x20')](function(_0xd09372){logger[_0x851a('0x1c')](_0x851a('0x55'),_0xd09372);throw _0xd09372;});}return _0x2871fd;})[_0x851a('0x15')](respondWithResult(_0x523557,0xc9))[_0x851a('0x20')](handleError(_0x523557,null));};exports[_0x851a('0x2a')]=function(_0x483db1,_0x185ce0){if(_0x483db1[_0x851a('0x56')]['id']){delete _0x483db1['body']['id'];}return db[_0x851a('0x49')]['find']({'where':{'id':_0x483db1[_0x851a('0x57')]['id']},'include':[{'model':db[_0x851a('0x32')],'as':_0x851a('0x33')}]})[_0x851a('0x15')](handleEntityNotFound(_0x185ce0,null))['then'](saveUpdates(_0x483db1[_0x851a('0x56')],null))[_0x851a('0x15')](respondWithResult(_0x185ce0,null))['catch'](handleError(_0x185ce0,null));};exports[_0x851a('0x2e')]=function(_0x301ccd,_0x2b3af8){return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x301ccd[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x2b3af8,null))[_0x851a('0x15')](removeEntity(_0x2b3af8,null))[_0x851a('0x20')](handleError(_0x2b3af8,null));};exports[_0x851a('0x58')]=function(_0x45d402,_0xc4b06a){return db[_0x851a('0x49')][_0x851a('0x58')]()[_0x851a('0x15')](respondWithResult(_0xc4b06a,null))['catch'](handleError(_0xc4b06a,null));};exports[_0x851a('0x59')]=function(_0x8364fa,_0x4ec994){if(_0x8364fa['body']['id']){delete _0x8364fa[_0x851a('0x56')]['id'];}return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x8364fa[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x4ec994,null))[_0x851a('0x15')](function(_0x30ce3a){if(_0x30ce3a){_0x8364fa[_0x851a('0x56')][_0x851a('0x5a')]=_0x30ce3a['id'];return db[_0x851a('0x5b')][_0x851a('0x50')](_0x8364fa[_0x851a('0x56')]);}})[_0x851a('0x15')](respondWithResult(_0x4ec994,null))[_0x851a('0x20')](handleError(_0x4ec994,null));};exports[_0x851a('0x5c')]=function(_0x30945c,_0x3c1dce){var _0x15b3f9={'raw':![],'where':{}};var _0x280bb7={};var _0x4b8de9={'count':0x0,'rows':[]};return db[_0x851a('0x49')][_0x851a('0x5d')]({'where':{'id':_0x30945c[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x3c1dce,null))[_0x851a('0x15')](function(_0xe5f964){if(_0xe5f964){_0x280bb7[_0x851a('0x3c')]=_[_0x851a('0x39')](db[_0x851a('0x5b')]['rawAttributes']);_0x280bb7[_0x851a('0x3d')]=_[_0x851a('0x39')](_0x30945c['query']);_0x280bb7[_0x851a('0x3a')]=_['intersection'](_0x280bb7[_0x851a('0x3c')],_0x280bb7[_0x851a('0x3d')]);_0x15b3f9['attributes']=_[_0x851a('0x3b')](_0x280bb7['model'],qs[_0x851a('0x3e')](_0x30945c[_0x851a('0x3d')]['fields']));_0x15b3f9['attributes']=_0x15b3f9[_0x851a('0x3f')][_0x851a('0x4e')]?_0x15b3f9[_0x851a('0x3f')]:_0x280bb7['model'];if(!_0x30945c['query'][_0x851a('0x5e')](_0x851a('0x40'))){_0x15b3f9[_0x851a('0x27')]=qs[_0x851a('0x27')](_0x30945c[_0x851a('0x3d')][_0x851a('0x27')]);_0x15b3f9[_0x851a('0x25')]=qs[_0x851a('0x25')](_0x30945c[_0x851a('0x3d')]['offset']);}_0x15b3f9[_0x851a('0x41')]=qs['sort'](_0x30945c[_0x851a('0x3d')][_0x851a('0x42')]);_0x15b3f9[_0x851a('0x43')]=qs[_0x851a('0x3a')](_[_0x851a('0x5f')](_0x30945c[_0x851a('0x3d')],_0x280bb7[_0x851a('0x3a')]));_0x15b3f9[_0x851a('0x43')]['ChatWebsiteId']=_0xe5f964['id'];if(_0x30945c[_0x851a('0x3d')][_0x851a('0x47')]){_0x15b3f9[_0x851a('0x43')]=_['merge'](_0x15b3f9[_0x851a('0x43')],{'$or':_[_0x851a('0x37')](_0x15b3f9[_0x851a('0x3f')],function(_0x312cce){var _0x55aeba={};_0x55aeba[_0x312cce]={'$like':'%'+_0x30945c['query'][_0x851a('0x47')]+'%'};return _0x55aeba;})});}_0x15b3f9=_[_0x851a('0x44')]({},_0x15b3f9,_0x30945c['options']);return db[_0x851a('0x5b')][_0x851a('0x28')]({'where':_0x15b3f9['where']})[_0x851a('0x15')](function(_0x41be52){_0x4b8de9['count']=_0x41be52;if(_0x30945c[_0x851a('0x3d')]['includeAll']){_0x15b3f9[_0x851a('0x4a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x15b3f9);})[_0x851a('0x15')](function(_0x19ff3b){_0x4b8de9[_0x851a('0x4c')]=_0x19ff3b;return _0x4b8de9;});}})[_0x851a('0x15')](respondWithFilteredResult(_0x3c1dce,_0x15b3f9))[_0x851a('0x20')](handleError(_0x3c1dce,null));};exports[_0x851a('0x60')]=function(_0x3b00c7,_0x197ec4){return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x3b00c7['params']['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x197ec4,null))[_0x851a('0x15')](function(_0x5d0ecb){if(_0x5d0ecb){return _0x5d0ecb[_0x851a('0x60')](_0x3b00c7[_0x851a('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x197ec4,null))[_0x851a('0x20')](handleError(_0x197ec4,null));};exports['addAnswer']=function(_0x1c3c23,_0x2a4868){if(_0x1c3c23[_0x851a('0x56')]['id']){delete _0x1c3c23['body']['id'];}return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x1c3c23['params']['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x2a4868,null))[_0x851a('0x15')](function(_0x3b7344){if(_0x3b7344){_0x1c3c23[_0x851a('0x56')][_0x851a('0x5a')]=_0x3b7344['id'];return db['CannedAnswer'][_0x851a('0x50')](_0x1c3c23[_0x851a('0x56')]);}})[_0x851a('0x15')](respondWithResult(_0x2a4868,null))[_0x851a('0x20')](handleError(_0x2a4868,null));};exports[_0x851a('0x61')]=function(_0x15501d,_0x32aa0e){var _0x23ad5f={'raw':![],'where':{}};var _0x2d0edf={};var _0xc510ff={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x15501d['params']['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x32aa0e,null))[_0x851a('0x15')](function(_0x5bb466){if(_0x5bb466){_0x2d0edf[_0x851a('0x3c')]=_[_0x851a('0x39')](db[_0x851a('0x62')][_0x851a('0x34')]);_0x2d0edf[_0x851a('0x3d')]=_[_0x851a('0x39')](_0x15501d[_0x851a('0x3d')]);_0x2d0edf['filters']=_[_0x851a('0x3b')](_0x2d0edf[_0x851a('0x3c')],_0x2d0edf[_0x851a('0x3d')]);_0x23ad5f['attributes']=_[_0x851a('0x3b')](_0x2d0edf[_0x851a('0x3c')],qs[_0x851a('0x3e')](_0x15501d['query'][_0x851a('0x3e')]));_0x23ad5f[_0x851a('0x3f')]=_0x23ad5f[_0x851a('0x3f')][_0x851a('0x4e')]?_0x23ad5f[_0x851a('0x3f')]:_0x2d0edf['model'];if(!_0x15501d[_0x851a('0x3d')][_0x851a('0x5e')](_0x851a('0x40'))){_0x23ad5f[_0x851a('0x27')]=qs[_0x851a('0x27')](_0x15501d['query'][_0x851a('0x27')]);_0x23ad5f['offset']=qs[_0x851a('0x25')](_0x15501d['query']['offset']);}_0x23ad5f[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x15501d['query'][_0x851a('0x42')]);_0x23ad5f['where']=qs[_0x851a('0x3a')](_[_0x851a('0x5f')](_0x15501d[_0x851a('0x3d')],_0x2d0edf[_0x851a('0x3a')]));_0x23ad5f['where'][_0x851a('0x5a')]=_0x5bb466['id'];if(_0x15501d[_0x851a('0x3d')][_0x851a('0x47')]){_0x23ad5f[_0x851a('0x43')]=_[_0x851a('0x44')](_0x23ad5f[_0x851a('0x43')],{'$or':_['map'](_0x23ad5f[_0x851a('0x3f')],function(_0x303da2){var _0x87702c={};_0x87702c[_0x303da2]={'$like':'%'+_0x15501d[_0x851a('0x3d')][_0x851a('0x47')]+'%'};return _0x87702c;})});}_0x23ad5f=_[_0x851a('0x44')]({},_0x23ad5f,_0x15501d[_0x851a('0x48')]);return db[_0x851a('0x62')][_0x851a('0x28')]({'where':_0x23ad5f['where']})[_0x851a('0x15')](function(_0x42e99a){_0xc510ff['count']=_0x42e99a;if(_0x15501d['query'][_0x851a('0x63')]){_0x23ad5f[_0x851a('0x4a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x851a('0x4b')](_0x23ad5f);})[_0x851a('0x15')](function(_0x4f6a48){_0xc510ff[_0x851a('0x4c')]=_0x4f6a48;return _0xc510ff;});}})[_0x851a('0x15')](respondWithFilteredResult(_0x32aa0e,_0x23ad5f))[_0x851a('0x20')](handleError(_0x32aa0e,null));};exports[_0x851a('0x64')]=function(_0x4d2755,_0x10eded){return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x4d2755[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x10eded,null))['then'](function(_0x528748){if(_0x528748){return _0x528748['removeAnswers'](_0x4d2755[_0x851a('0x3d')][_0x851a('0x65')]);}})[_0x851a('0x15')](respondWithStatusCode(_0x10eded,null))['catch'](handleError(_0x10eded,null));};exports[_0x851a('0x66')]=function(_0x38d369,_0x173ea1){_0x38d369[_0x851a('0x56')][_0x851a('0x67')]=_0x38d369[_0x851a('0x68')]['filename'];return db['ChatWebsite'][_0x851a('0x4f')]({'where':{'id':_0x38d369[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x173ea1,null))[_0x851a('0x15')](saveUpdates(_0x38d369['body'],null))[_0x851a('0x15')](respondWithResult(_0x173ea1,null))[_0x851a('0x20')](handleError(_0x173ea1,null));};exports[_0x851a('0x69')]=function(_0x26a89b,_0x283c08){_0x26a89b['body'][_0x851a('0x6a')]=_0x26a89b[_0x851a('0x68')][_0x851a('0x6b')];return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x26a89b[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x283c08,null))[_0x851a('0x15')](saveUpdates(_0x26a89b['body'],null))[_0x851a('0x15')](respondWithResult(_0x283c08,null))[_0x851a('0x20')](handleError(_0x283c08,null));};exports[_0x851a('0x6c')]=function(_0x59d614,_0x4acc17){_0x59d614['body'][_0x851a('0x6d')]=_0x59d614[_0x851a('0x68')][_0x851a('0x6b')];return db['ChatWebsite']['find']({'where':{'id':_0x59d614[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x4acc17,null))[_0x851a('0x15')](saveUpdates(_0x59d614[_0x851a('0x56')],null))[_0x851a('0x15')](respondWithResult(_0x4acc17,null))[_0x851a('0x20')](handleError(_0x4acc17,null));};exports[_0x851a('0x6e')]=function(_0x53d478,_0xde5079){_0x53d478[_0x851a('0x56')][_0x851a('0x6f')]=_0x53d478[_0x851a('0x68')][_0x851a('0x6b')];return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x53d478[_0x851a('0x57')]['id']}})['then'](handleEntityNotFound(_0xde5079,null))[_0x851a('0x15')](saveUpdates(_0x53d478[_0x851a('0x56')],null))[_0x851a('0x15')](respondWithResult(_0xde5079,null))[_0x851a('0x20')](handleError(_0xde5079,null));};exports['getLogo']=function(_0x141acd,_0x47fdb2){var _0x30d555=path[_0x851a('0x70')](config[_0x851a('0x71')],_0x851a('0x72'));var _0x25be7b={'where':{'id':_0x141acd[_0x851a('0x57')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5e45b4=![];return require('../../config/license/util')[_0x851a('0x73')]()[_0x851a('0x15')](function(_0x3b0fcb){if(_0x3b0fcb){_0x5e45b4=_0x3b0fcb['custom'];}})[_0x851a('0x15')](function(){return db[_0x851a('0x49')]['find'](_0x25be7b);})['then'](handleEntityNotFound(_0x47fdb2,null))[_0x851a('0x15')](function(_0x56a309){if(_0x56a309){if(!_['isNil'](_0x56a309[_0x851a('0x67')])){if(fs[_0x851a('0x74')](path[_0x851a('0x70')](config[_0x851a('0x71')],_0x851a('0x75'),_0x56a309[_0x851a('0x67')]))&&_0x5e45b4){_0x30d555=path[_0x851a('0x70')](config['root'],_0x851a('0x75'),_0x56a309[_0x851a('0x67')]);}}return _0x47fdb2['download'](_0x30d555);}})['catch'](handleError(_0x47fdb2,null));};exports[_0x851a('0x76')]=function(_0x4e32f5,_0x11405b){var _0x54c15b=path[_0x851a('0x70')](config[_0x851a('0x71')],_0x851a('0x77'));var _0x298b9c={'where':{'id':_0x4e32f5[_0x851a('0x57')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x851a('0x49')][_0x851a('0x4f')](_0x298b9c)[_0x851a('0x15')](handleEntityNotFound(_0x11405b,null))['then'](function(_0x2dc29e){if(_0x2dc29e){if(!_[_0x851a('0x78')](_0x2dc29e[_0x851a('0x6a')])){if(fs['existsSync'](path[_0x851a('0x70')](config['root'],_0x851a('0x79'),_0x2dc29e['agentAvatar']))){_0x54c15b=path[_0x851a('0x70')](config[_0x851a('0x71')],'server/files/images/avatars/',_0x2dc29e[_0x851a('0x6a')]);}}return _0x11405b[_0x851a('0x7a')](_0x54c15b);}})[_0x851a('0x20')](handleError(_0x11405b,null));};exports['getCustomerAvatar']=function(_0x1692c7,_0x1664ac){var _0x5300fe=path[_0x851a('0x70')](config['root'],_0x851a('0x7b'));var _0xbbde0d={'where':{'id':_0x1692c7[_0x851a('0x57')]['id']},'attributes':['id',_0x851a('0x6d'),_0x851a('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x851a('0x4f')](_0xbbde0d)[_0x851a('0x15')](handleEntityNotFound(_0x1664ac,null))[_0x851a('0x15')](function(_0x4f6c53){if(_0x4f6c53){if(!_['isNil'](_0x4f6c53[_0x851a('0x6d')])){if(fs[_0x851a('0x74')](path['join'](config[_0x851a('0x71')],'server/files/images/avatars/',_0x4f6c53[_0x851a('0x6d')]))&&_0x4f6c53[_0x851a('0x7c')]){_0x5300fe=path['join'](config[_0x851a('0x71')],_0x851a('0x79'),_0x4f6c53[_0x851a('0x6d')]);}}return _0x1664ac[_0x851a('0x7a')](_0x5300fe);}})['catch'](handleError(_0x1664ac,null));};exports[_0x851a('0x7d')]=function(_0x5e6fa7,_0x270fe2){var _0x39fffd=path[_0x851a('0x70')](config[_0x851a('0x71')],_0x851a('0x7e'));var _0x43e182={'where':{'id':_0x5e6fa7['params']['id']},'attributes':['id',_0x851a('0x6f')],'raw':!![]};return db[_0x851a('0x49')][_0x851a('0x4f')](_0x43e182)[_0x851a('0x15')](handleEntityNotFound(_0x270fe2,null))['then'](function(_0xe6dcd5){if(_0xe6dcd5){if(!_['isNil'](_0xe6dcd5[_0x851a('0x6f')])){if(fs['existsSync'](path['join'](config[_0x851a('0x71')],_0x851a('0x79'),_0xe6dcd5['systemAvatar']))){_0x39fffd=path[_0x851a('0x70')](config[_0x851a('0x71')],_0x851a('0x79'),_0xe6dcd5[_0x851a('0x6f')]);}}return _0x270fe2[_0x851a('0x7a')](_0x39fffd);}})[_0x851a('0x20')](handleError(_0x270fe2,null));};exports[_0x851a('0x7f')]=function(_0x485022,_0x153b7c){var _0x47b390=require('user-agent-parser');var _0x1addad=new _0x47b390();var _0x2c088a=_0x1addad[_0x851a('0x80')](_0x485022['headers'][_0x851a('0x81')])[_0x851a('0x82')]();var _0x57b5f8={'body':_0x485022[_0x851a('0x56')],'channel':_0x851a('0x83')};var _0x266472=[];var _0x39e8a5=[];var _0x437c62={};var _0x4379c6=![];return db[_0x851a('0x84')][_0x851a('0x58')]()[_0x851a('0x15')](function(_0x207794){if(!_0x207794){throw new db['Sequelize']['ValidationError'](_0x851a('0x85'));}_0x266472=_[_0x851a('0x86')](_[_0x851a('0x39')](_0x207794),['createdAt',_0x851a('0x87')]);_0x39e8a5=_['difference'](_[_0x851a('0x39')](_0x207794),[_0x851a('0x88'),_0x851a('0x87'),_0x851a('0x89'),_0x851a('0x8a')]);if(_0x485022[_0x851a('0x56')]['id']){delete _0x485022[_0x851a('0x56')]['id'];}if(_['isNil'](_0x485022[_0x851a('0x56')][_0x851a('0x8b')])){throw new db[(_0x851a('0x8c'))]['ValidationError'](_0x851a('0x8d'));}if(_[_0x851a('0x78')](_0x485022[_0x851a('0x56')][_0x851a('0x56')])||_0x485022['body'][_0x851a('0x56')]===''){throw new db[(_0x851a('0x8c'))][(_0x851a('0x8e'))](_0x851a('0x8f'));}if(_[_0x851a('0x78')](_0x485022[_0x851a('0x56')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x39e8a5);}if(!_[_0x851a('0x90')](_0x39e8a5,_0x485022[_0x851a('0x56')][_0x851a('0x91')])){throw new db[(_0x851a('0x8c'))][(_0x851a('0x8e'))](_0x851a('0x92')+_0x39e8a5);}_0x437c62[_0x485022[_0x851a('0x56')][_0x851a('0x91')]]=_0x485022['body'][_0x851a('0x8b')];})[_0x851a('0x15')](function(){return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x485022[_0x851a('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x851a('0x84')],'as':_0x851a('0x93'),'where':_0x437c62,'limit':0x1,'order':[[_0x851a('0x87'),_0x851a('0x94')]]}]},{'model':db[_0x851a('0x95')],'as':_0x851a('0x96')}]});})[_0x851a('0x15')](handleEntityNotFound(_0x153b7c,null))[_0x851a('0x15')](function(_0xa1b06b){if(_0xa1b06b&&_0xa1b06b['List']){_0x57b5f8[_0x851a('0x97')]=_0xa1b06b;_0x57b5f8[_0x851a('0x98')]=_0xa1b06b[_0x851a('0x96')];_0x57b5f8[_0x851a('0x99')]=_0xa1b06b[_0x851a('0x9a')];_0x57b5f8[_0x851a('0x98')]=_[_0x851a('0x9b')](_0x57b5f8[_0x851a('0x98')],[_0x851a('0x9c')],['asc']);if(_0x57b5f8['account'][_0x851a('0x96')]){delete _0x57b5f8[_0x851a('0x97')][_0x851a('0x96')];}if(_0x57b5f8[_0x851a('0x97')][_0x851a('0x9a')]&&_0x57b5f8[_0x851a('0x97')]['List'][_0x851a('0x93')][_0x851a('0x4e')]){return _0x57b5f8[_0x851a('0x97')][_0x851a('0x9a')][_0x851a('0x93')][0x0];}var _0x3d4b3d=_[_0x851a('0xd')](_0x485022[_0x851a('0x56')],{'firstName':_0x485022['body']['from'],'ListId':_0xa1b06b[_0x851a('0x8a')]});_0x3d4b3d[_0x485022['body'][_0x851a('0x91')]]=_0x485022[_0x851a('0x56')][_0x851a('0x8b')];return db[_0x851a('0x84')]['create'](_0x3d4b3d,{'fields':_0x266472,'raw':!![]});}})[_0x851a('0x15')](handleEntityNotFound(_0x153b7c,null))[_0x851a('0x15')](function(_0x306de5){_0x57b5f8['contact']=_0x306de5;var _0x251cb1=_0x485022[_0x851a('0x56')]['customerIp'];if(_0x485022[_0x851a('0x9d')]['cf-connecting-ip']){_0x251cb1=_0x485022['headers'][_0x851a('0x9e')];}else if(_0x485022[_0x851a('0x9d')]['x-forwarded-for']){_0x251cb1=_[_0x851a('0x9f')](_0x485022[_0x851a('0x9d')]['x-forwarded-for'][_0x851a('0xa0')](','));}if(_0x306de5){var _0x1eecb9={'ContactId':_0x306de5['id'],'ChatWebsiteId':_0x485022[_0x851a('0x57')]['id'],'from':(_0x306de5[_0x851a('0xa1')]||'')+'\x20'+(_0x306de5[_0x851a('0xa2')]||''),'customerIp':_0x251cb1,'customerPort':_0x485022['headers'][_0x851a('0xa3')]?_0x485022['headers'][_0x851a('0xa3')]:null,'referer':_0x485022['body'][_0x851a('0xa4')],'browserName':_0x2c088a[_0x851a('0xa5')][_0x851a('0x38')]&&_0x2c088a[_0x851a('0xa5')][_0x851a('0xa6')]?util[_0x851a('0xa7')](_0x851a('0xa8'),_0x2c088a[_0x851a('0xa5')][_0x851a('0x38')],_0x2c088a[_0x851a('0xa5')]['version']):_0x851a('0xa9'),'browserVersion':_0x2c088a[_0x851a('0xa5')][_0x851a('0xa6')]||_0x851a('0xa9'),'osName':util['format'](_0x851a('0xa8'),_0x2c088a['os']['name'],_0x2c088a['os'][_0x851a('0xa6')]),'osVersion':_0x2c088a['os'][_0x851a('0xa6')],'deviceModel':_0x2c088a[_0x851a('0xaa')][_0x851a('0x3c')]&&_0x2c088a['device'][_0x851a('0xab')]?util[_0x851a('0xa7')]('%s\x20%s\x20%s',_0x2c088a[_0x851a('0xaa')][_0x851a('0x3c')],_0x2c088a['device'][_0x851a('0xab')],_0x2c088a[_0x851a('0xaa')]['type']):null,'deviceVendor':_0x2c088a['device'][_0x851a('0xab')],'deviceType':_0x2c088a[_0x851a('0xaa')]['type'],'formData':JSON[_0x851a('0x1b')](_0x485022[_0x851a('0x56')])};var _0x157781={'ChatWebsiteId':_0x485022[_0x851a('0x57')]['id'],'closed':![]};if(_0x485022[_0x851a('0x56')][_0x851a('0xac')]){_0x157781['threadId']=_0x485022[_0x851a('0x56')][_0x851a('0xac')];return db[_0x851a('0xad')][_0x851a('0x4f')]({'where':_0x157781})['then'](function(_0x4f5b34){if(_0x4f5b34){return[_0x4f5b34,![]];}_0x1eecb9[_0x851a('0xac')]=_0x485022[_0x851a('0x56')][_0x851a('0xac')];_0x1eecb9[_0x851a('0xae')]=_0x485022['body'][_0x851a('0xae')];return db['ChatInteraction'][_0x851a('0x50')](_0x1eecb9)[_0x851a('0x15')](function(_0x405a15){return[_0x405a15,!![]];});});}_0x157781[_0x851a('0xaf')]=_0x306de5['id'];if(_0x485022[_0x851a('0x56')][_0x851a('0xb0')]&&_0x485022['body'][_0x851a('0xb0')]['id']){_0x157781['id']=_0x485022[_0x851a('0x56')][_0x851a('0xb0')]['id'];return db[_0x851a('0xad')][_0x851a('0x4f')]({'where':_0x157781})[_0x851a('0x15')](function(_0x369a90){if(_0x369a90){return[_0x369a90,![]];}return db[_0x851a('0xad')][_0x851a('0x50')](_0x1eecb9)[_0x851a('0x15')](function(_0x36a9f3){return[_0x36a9f3,!![]];});});}return db[_0x851a('0xad')][_0x851a('0x50')](_0x1eecb9)[_0x851a('0x15')](function(_0x3f3317){return[_0x3f3317,!![]];});}})[_0x851a('0xb1')](function(_0x241ed0,_0x207718){if(_0x241ed0){_0x4379c6=_0x207718;if(!_0x207718){var _0x11c762={'from':(_0x57b5f8[_0x851a('0xb2')][_0x851a('0xa1')]||'')+'\x20'+(_0x57b5f8[_0x851a('0xb2')][_0x851a('0xa2')]||'')};if(_0x485022[_0x851a('0x56')][_0x851a('0xac')]&&_0x485022['body'][_0x851a('0xb3')]&&_0x485022[_0x851a('0x56')][_0x851a('0xac')]!=_0x485022[_0x851a('0x56')][_0x851a('0xb3')]){_0x11c762[_0x851a('0xac')]=_0x485022[_0x851a('0x56')][_0x851a('0xb3')];}return _0x241ed0['update'](_0x11c762);}else{return _0x241ed0;}}})['then'](function(_0x4ad7df){_0x57b5f8['interaction']=_0x4ad7df['get']({'plain':!![]});_0x57b5f8['interaction'][_0x851a('0xb4')]=_0x4379c6;if(_0x57b5f8['interaction'][_0x851a('0xb4')]){if(_0x57b5f8[_0x851a('0x97')][_0x851a('0xb5')]){_0x57b5f8[_0x851a('0x98')]['push']({'id':0x0,'priority':_0x57b5f8[_0x851a('0x98')][_0x851a('0x4e')]+0x1,'app':_0x851a('0xb6'),'appdata':'unmanaged','interval':_0x851a('0xb7')});}}return db['ChatMessage']['create']({'body':_0x485022['body']['body'],'ChatWebsiteId':_0x485022[_0x851a('0x57')]['id'],'ChatInteractionId':_0x4ad7df['id'],'direction':'in','ContactId':_0x57b5f8[_0x851a('0xb2')]['id'],'AttachmentId':_0x485022[_0x851a('0x56')][_0x851a('0xb8')]});})[_0x851a('0x15')](function(_0x5adf26){_0x57b5f8['message']=_0x5adf26;if(_0x57b5f8[_0x851a('0xb0')][_0x851a('0xb9')]){return db[_0x851a('0xba')][_0x851a('0x4f')]({'attributes':['id',_0x851a('0x38')],'where':{'id':_0x57b5f8[_0x851a('0xb0')][_0x851a('0xb9')]}})[_0x851a('0x15')](function(_0x3b944d){if(_0x3b944d){_0x57b5f8[_0x851a('0x98')][_0x851a('0xbb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b944d['name']+','+(_0x57b5f8[_0x851a('0x97')][_0x851a('0xbc')]||0xa),'interval':_0x851a('0xb7')});_0x57b5f8[_0x851a('0xbd')]=!![];}return respondWithRpcPromise(_0x851a('0xbe'),_0x851a('0xbf'),_0x57b5f8);});}return respondWithRpcPromise('Start',_0x851a('0xbf'),_0x57b5f8);})[_0x851a('0x15')](function(_0x33171e){respondWithRpcPromise(_0x851a('0xc0'),_0x851a('0xc0'),{'event':'notify','message':_0x33171e},client9002);return _0x33171e;})[_0x851a('0x15')](respondWithResult(_0x153b7c,null))[_0x851a('0x20')](handleError(_0x153b7c,null));};exports[_0x851a('0xc1')]=function(_0x3540bc,_0x493f72){var _0x5c7ae0,_0x489175,_0x53cc62;var _0x28be31=[];var _0x2f283e={};var _0x1bf607=_0x3540bc[_0x851a('0xc2')]||[];var _0x2ee0dc=[];var _0x56f6aa;return db[_0x851a('0x84')][_0x851a('0x58')]()[_0x851a('0x15')](function(_0x434deb){if(!_0x434deb){throw new db[(_0x851a('0x8c'))]['ValidationError'](_0x851a('0x85'));}_0x28be31=_['difference'](_[_0x851a('0x39')](_0x434deb),['createdAt',_0x851a('0x87'),'CompanyId',_0x851a('0x8a')]);if(_0x3540bc['body']['id']){delete _0x3540bc[_0x851a('0x56')]['id'];}if(_[_0x851a('0x78')](_0x3540bc[_0x851a('0x56')]['from'])){throw _0x493f72[_0x851a('0x22')](0x1f4)[_0x851a('0x30')](new db[(_0x851a('0x8c'))][(_0x851a('0x8e'))]('from\x20is\x20mandatory'));}if(_[_0x851a('0x78')](_0x3540bc[_0x851a('0x56')][_0x851a('0x56')])||_0x3540bc[_0x851a('0x56')]['body']===''){throw _0x493f72[_0x851a('0x22')](0x1f4)[_0x851a('0x30')](new db['Sequelize'][(_0x851a('0x8e'))](_0x851a('0x8f')));}if(_[_0x851a('0x78')](_0x3540bc[_0x851a('0x56')]['mapKeyOffline'])){throw _0x493f72[_0x851a('0x22')](0x1f4)[_0x851a('0x30')](new db[(_0x851a('0x8c'))][(_0x851a('0x8e'))](_0x851a('0xc3')+_0x28be31));}if(!_[_0x851a('0x90')](_0x28be31,_0x3540bc[_0x851a('0x56')][_0x851a('0xc4')])){throw _0x493f72['status'](0x1f4)[_0x851a('0x30')](new db[(_0x851a('0x8c'))]['ValidationError'](_0x851a('0xc5')+_0x28be31));}_0x2f283e[_0x3540bc[_0x851a('0x56')][_0x851a('0xc4')]]=_0x3540bc[_0x851a('0x56')][_0x851a('0x8b')];})[_0x851a('0x15')](function(){return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x3540bc[_0x851a('0x57')]['id']},'include':[{'model':db[_0x851a('0xc6')],'as':'List'},{'model':db[_0x851a('0xc7')],'as':'MailAccount'}]});})[_0x851a('0x15')](handleEntityNotFound(_0x493f72,null))['then'](function(_0x45900d){if(_0x45900d&&_0x45900d[_0x851a('0x9a')]){_0x489175=_0x45900d;var _0x5dca45=_[_0x851a('0xd')](_0x3540bc[_0x851a('0x56')],{'firstName':_0x3540bc['body'][_0x851a('0x8b')],'phone':_0x3540bc[_0x851a('0x56')][_0x851a('0x8b')],'ListId':_0x45900d[_0x851a('0x8a')]});_0x5dca45[_0x3540bc[_0x851a('0x56')][_0x851a('0xc4')]]=_0x3540bc['body']['from'];return db[_0x851a('0x84')][_0x851a('0xc8')]({'where':_0x2f283e,'defaults':_0x5dca45});}})['spread'](function(_0x6ec71a){if(_0x6ec71a){_0x53cc62=_0x6ec71a;var _0x1deee7=fs['readFileSync'](path[_0x851a('0x70')](config[_0x851a('0x71')],'server/files/templates/chatOfflineMessage.ejs'),_0x851a('0xc9'));var _0x413f22=ejs[_0x851a('0xca')](_0x1deee7,{'body':_[_0x851a('0xcb')](_0x3540bc['body'][_0x851a('0x56')]),'bodyTitle':_0x489175[_0x851a('0xcc')]});return db[_0x851a('0xcd')][_0x851a('0x50')]({'body':_0x413f22,'plainBody':htmlToText[_0x851a('0xce')](_0x413f22),'ContactId':_0x6ec71a['id'],'ChatWebsiteId':_0x489175['id']});}})[_0x851a('0x15')](function(_0x1fa089){_0x56f6aa=_0x1fa089;if(_0x1bf607['length']){var _0x4332cb=_0x1bf607[_0x851a('0x37')](function(_0x55d87f){return{'name':_0x55d87f[_0x851a('0xcf')],'basename':_0x55d87f[_0x851a('0x6b')],'type':_0x55d87f[_0x851a('0xd0')],'ChatOfflineMessageId':_0x1fa089['id']};});_0x2ee0dc=_0x4332cb['map'](_0x1c6da2=>{var _0x4278b2={'filename':_0x1c6da2[_0x851a('0x38')],'path':path[_0x851a('0x70')](config[_0x851a('0x71')],'server',_0x851a('0xc2'),_0x851a('0xd1'),_0x851a('0xd2'),_0x1c6da2[_0x851a('0xd3')])};return _0x4278b2;});if(!_0x489175[_0x851a('0xd4')]){return db[_0x851a('0xd5')]['transaction'](function(_0x5bfb02){return db[_0x851a('0xd6')][_0x851a('0xd7')](_0x4332cb,{'transaction':_0x5bfb02});});}}})[_0x851a('0x15')](function(){if(_0x56f6aa){_0x5c7ae0=_0x56f6aa;return db[_0x851a('0xc7')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x851a('0xd8')],'as':_0x851a('0xd9'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x851a('0x15')](function(_0x303bf1){if(_0x303bf1&&_0x303bf1['Smtp']&&_0x489175['forwardOffline']&&_0x489175[_0x851a('0xda')]){var _0x95ce8=_0x303bf1[_0x851a('0xdb')]();return respondWithRpcPromise('SendMail',_0x851a('0xdc'),{'account':_0x95ce8,'message':{'from':util[_0x851a('0xa7')](_0x851a('0xdd'),_0x303bf1[_0x851a('0x38')],_0x303bf1[_0x851a('0xde')]||_0x303bf1['Smtp'][_0x851a('0x51')]),'to':_0x489175['forwardOfflineAddress'],'subject':_0x489175['offlineMessageSubject'],'html':_0x5c7ae0[_0x851a('0x56')],'attachments':_0x2ee0dc}},client9003)[_0x851a('0x15')](function(){return _0x5c7ae0;})[_0x851a('0x20')](function(_0x3a01a1){logger[_0x851a('0x1c')](_0x3a01a1);});}})[_0x851a('0x15')](function(){if(_0x489175&&_0x489175[_0x851a('0xd4')]&&_0x489175[_0x851a('0xdf')]){var _0x41c958=[];if(_0x1bf607[_0x851a('0x4e')]){_0x41c958=_0x1bf607[_0x851a('0x37')](function(_0x49ca12){return{'name':_0x49ca12[_0x851a('0xcf')],'basename':_0x49ca12[_0x851a('0x6b')],'type':_0x49ca12['mimetype'],'ChatOfflineMessageId':_0x56f6aa['id']};});}var _0x3c453b;if(!_['isNil'](_0x489175[_0x851a('0xe0')])){var _0x7dece0=_[_0x851a('0x37')](_0x3540bc[_0x851a('0x56')],function(_0x137577){return _0x137577;});var _0x45884f=_[_0x851a('0xe1')](_0x7dece0)[0x0];var _0x3004ae=_[_0x851a('0xe2')](_0x45884f,function(_0x134142){return _0x134142;});_0x3c453b=_0x3004ae[0x1][_0x489175['subjectOffline']];}var _0x177eaf={'from':_0x53cc62[_0x851a('0xde')],'firstName':_0x53cc62['firstName'],'lastName':_0x53cc62[_0x851a('0xa2')],'mapKey':_0x851a('0xde'),'message':{'from':_0x53cc62[_0x851a('0xde')],'to':_0x489175[_0x851a('0xc7')][_0x851a('0xde')],'cc':'','subject':_[_0x851a('0x78')](_0x3c453b)?_0x489175[_0x851a('0xe3')]:_0x3c453b,'messageId':'','sentAt':new Date(),'attach':_0x41c958[_0x851a('0x4e')],'attachments':_0x41c958,'originChannel':_0x851a('0xe4'),'ChatWebsiteId':_0x489175['id'],'ChatOfflineMessageId':_0x5c7ae0['id'],'originTo':_0x489175[_0x851a('0xc7')]['email']},'body':_0x5c7ae0[_0x851a('0x56')]};var _0x3d2fac={'account':{'id':_0x489175['MailAccountId']},'body':_0x177eaf,'log':_0x851a('0xe5')};return respondWithRpcPromise(_0x851a('0xe5'),_0x851a('0xe6'),_0x3d2fac,client9001)[_0x851a('0x15')](function(){return _0x5c7ae0;})[_0x851a('0x20')](function(_0x35acdf){logger[_0x851a('0x1c')](_0x35acdf);});}return;})['then'](function(){if(_0x5c7ae0){return _0x5c7ae0;}})['then'](respondWithResult(_0x493f72,null))[_0x851a('0x20')](function(_0xa998d3){logger[_0x851a('0x1c')]('catch',_0xa998d3);for(var _0x578d87 of _0x1bf607){var _0x3a0919=path[_0x851a('0x70')](config['root'],_0x851a('0xe7'),_0x851a('0xc2'),_0x851a('0xd1'),'offline-chat',_0x578d87[_0x851a('0x6b')]);fs_extra[_0x851a('0xe8')](_0x3a0919)['catch'](function(_0x514e7c){logger[_0x851a('0x1c')](_0x851a('0xe9'),_0x3a0919,_0x514e7c);});}});};exports[_0x851a('0xea')]=function(_0x151492,_0x2607d3){return db[_0x851a('0xad')][_0x851a('0x4f')]({'where':{'id':_0x151492[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x2607d3,null))[_0x851a('0x15')](function(_0x50396a){if(_0x50396a){return _0x50396a[_0x851a('0xea')](_0x151492[_0x851a('0x56')]['ids'],_['omit'](_0x151492[_0x851a('0x56')],[_0x851a('0x65'),'id'])||{});}})[_0x851a('0x15')](respondWithResult(_0x2607d3,null))[_0x851a('0x20')](handleError(_0x2607d3,null));};exports[_0x851a('0xeb')]=function(_0x339004,_0x42e7e4){var _0x428df0={'raw':![],'where':{}};var _0x29b289={};var _0x4ddb16={'count':0x0,'rows':[]};return db[_0x851a('0x49')][_0x851a('0x5d')]({'where':{'id':_0x339004[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x42e7e4,null))['then'](function(_0x55ae16){if(_0x55ae16){_0x29b289[_0x851a('0x3c')]=_['keys'](db[_0x851a('0xad')][_0x851a('0x34')]);_0x29b289['query']=_[_0x851a('0x39')](_0x339004['query']);_0x29b289['filters']=_['intersection'](_0x29b289[_0x851a('0x3c')],_0x29b289[_0x851a('0x3d')]);_0x428df0[_0x851a('0x3f')]=_[_0x851a('0x3b')](_0x29b289['model'],qs['fields'](_0x339004[_0x851a('0x3d')][_0x851a('0x3e')]));_0x428df0[_0x851a('0x3f')]=_0x428df0[_0x851a('0x3f')][_0x851a('0x4e')]?_0x428df0['attributes']:_0x29b289[_0x851a('0x3c')];if(!_0x339004[_0x851a('0x3d')][_0x851a('0x5e')](_0x851a('0x40'))){_0x428df0[_0x851a('0x27')]=qs[_0x851a('0x27')](_0x339004[_0x851a('0x3d')][_0x851a('0x27')]);_0x428df0['offset']=qs[_0x851a('0x25')](_0x339004['query']['offset']);}_0x428df0[_0x851a('0x41')]=qs['sort'](_0x339004[_0x851a('0x3d')][_0x851a('0x42')]);_0x428df0[_0x851a('0x43')]=qs[_0x851a('0x3a')](_[_0x851a('0x5f')](_0x339004['query'],_0x29b289[_0x851a('0x3a')]));_0x428df0[_0x851a('0x43')][_0x851a('0x5a')]=_0x55ae16['id'];if(_0x339004['query'][_0x851a('0x47')]){_0x428df0['where']=_['merge'](_0x428df0[_0x851a('0x43')],{'$or':_[_0x851a('0x37')](_0x428df0[_0x851a('0x3f')],function(_0x409ef3){var _0x1d7c71={};_0x1d7c71[_0x409ef3]={'$like':'%'+_0x339004[_0x851a('0x3d')][_0x851a('0x47')]+'%'};return _0x1d7c71;})});}_0x428df0=_[_0x851a('0x44')]({},_0x428df0,_0x339004[_0x851a('0x48')]);return db[_0x851a('0xad')][_0x851a('0x28')]({'where':_0x428df0[_0x851a('0x43')]})['then'](function(_0x59dd8f){_0x4ddb16['count']=_0x59dd8f;if(_0x339004[_0x851a('0x3d')][_0x851a('0x63')]){_0x428df0[_0x851a('0x4a')]=[{'model':db['CmContact'],'as':_0x851a('0xec'),'required':![]},{'model':db['User'],'as':_0x851a('0xed'),'attributes':[_0x851a('0x38'),'fullname',_0x851a('0xee')],'required':![]},{'model':db['Tag'],'as':_0x851a('0xef'),'attributes':['id','name',_0x851a('0xf0')],'where':_0x339004[_0x851a('0x3d')][_0x851a('0xf1')]?{'id':_0x339004['query']['tag']}:undefined,'required':_0x339004[_0x851a('0x3d')]['tag']?!![]:![]}];}return db[_0x851a('0xad')][_0x851a('0x4b')](_0x428df0);})[_0x851a('0x15')](function(_0x3ce82f){_0x4ddb16['rows']=_0x3ce82f;return _0x4ddb16;});}})['then'](respondWithFilteredResult(_0x42e7e4,_0x428df0))[_0x851a('0x20')](handleError(_0x42e7e4,null));};function iftimePromise(_0x2d91f2,_0x2044e8){return respondWithRpcPromise(_0x851a('0xf2'),_0x851a('0xf3'),{'command':_0x2044e8[_0x851a('0xf4')]?util['format'](_0x851a('0xf5'),_0x2d91f2[_0x851a('0xf6')],_0x2044e8['timezone']):util[_0x851a('0xa7')]('iftime\x20%s',_0x2d91f2[_0x851a('0xf6')])},client9002)[_0x851a('0x15')](function(_0x535150){var _0x5cedb2=_0x535150&&_0x535150[_0x851a('0xf7')](_0x851a('0xf8'))>=0x0?!![]:![];logger[_0x851a('0x16')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2044e8['id'],_0x2d91f2['id'],_0x2d91f2[_0x851a('0xf6')],_0x5cedb2?_0x851a('0xf9'):_0x851a('0xfa'),_0x2044e8[_0x851a('0xf4')]?_0x2044e8[_0x851a('0xf4')]:_0x851a('0xfb'));return _0x5cedb2;})[_0x851a('0x20')](function(_0x3c3e72){logger[_0x851a('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2044e8['id'],_0x2d91f2['id'],_0x2d91f2[_0x851a('0xf6')],util['inspect'](_0x3c3e72,{'showHidden':![],'depth':null}),_0x2044e8[_0x851a('0xf4')]?_0x2044e8[_0x851a('0xf4')]:_0x851a('0xfb'));return![];});}exports[_0x851a('0xf3')]=function(_0x7101ea,_0x3bd222){var _0x130c19=0x0;var _0x20d54a=0x0;var _0x52bb61=![];var _0x3142df;var _0x57d064;return db[_0x851a('0x49')]['find']({'where':{'id':_0x7101ea[_0x851a('0x57')]['id']},'include':[{'model':db[_0x851a('0xfc')],'as':'Interval','include':[{'model':db[_0x851a('0xfc')],'as':'Intervals','attributes':['id',_0x851a('0xf6')],'raw':!![]}]}]})[_0x851a('0x15')](handleEntityNotFound(_0x3bd222,null))[_0x851a('0x15')](function(_0x544878){if(_0x544878){_0x3142df=_0x544878;return _0x544878[_0x851a('0xfd')]({'raw':!![]});}})[_0x851a('0x15')](function(_0x3c7773){if(_0x3142df){if(_0x3c7773){_0x57d064=_0x3c7773;}}return require(_0x851a('0xfe'))[_0x851a('0x73')]();})[_0x851a('0x15')](function(_0x325a6){if(_0x325a6){_0x20d54a=_0x325a6[_0x851a('0xff')];_0x52bb61=_0x325a6[_0x851a('0x100')];}})[_0x851a('0x15')](function(){return db[_0x851a('0xad')][_0x851a('0x28')]({'where':{'closed':![]}});})['then'](function(_0x3d10fd){_0x130c19=_0x3d10fd;if(_0x20d54a&&_0x3d10fd>_0x20d54a){return db['License'][_0x851a('0x5d')]({'where':{'id':0x1}})['then'](function(_0x3c2f7){if(_0x3c2f7){_0x3c2f7['increment'](_0x851a('0x101'));}});}})[_0x851a('0x15')](function(){if(_0x3142df[_0x851a('0xfc')]&&_0x3142df[_0x851a('0xfc')][_0x851a('0x102')]){var _0x48dce4=[];for(var _0x5cc5ae=0x0;_0x5cc5ae<_0x3142df[_0x851a('0xfc')][_0x851a('0x102')]['length'];_0x5cc5ae++){var _0x3f06eb=_0x3142df[_0x851a('0xfc')]['Intervals'][_0x5cc5ae]['get']({'plain':!![]});_0x48dce4[_0x851a('0x103')](iftimePromise(_0x3f06eb,_0x3142df));}return BPromise[_0x851a('0x104')](_0x48dce4)[_0x851a('0x15')](function(_0x474daf){return _[_0x851a('0x105')](_0x474daf);});}else{return!![];}})[_0x851a('0x15')](function(_0x1179bf){var _0x14ea2b=fs[_0x851a('0x106')](path[_0x851a('0x70')](config[_0x851a('0x71')],_0x851a('0x107')),'utf8');var _0x28ac85=new url[(_0x851a('0x108'))](_0x3142df['address'])['origin'];var _0x2bd4cd=_0x851a('0x109');var _0x4a1ca7=![];var _0xac4d12={'chatVersion':_0x2bd4cd,'chatWebsiteAddressOrigin':_0x28ac85,'remote':_0x3142df['remote'],'query':querystring[_0x851a('0x1b')](_['merge'](_0x3142df[_0x851a('0x2b')]({'plain':!![]}),{'customerIp':_0x7101ea['headers'][_0x851a('0x10a')]||_0x7101ea['headers'][_0x851a('0x10b')]||_0x7101ea['connection']['remoteAddress']||_0x7101ea['ip'],'referer':_0x7101ea['headers'][_0x851a('0xa4')],'openedInteractions':_0x130c19,'maxInteractions':_0x20d54a,'virtual':_0x52bb61[_0x851a('0xff')],'online':_0x1179bf,'custom':_0x52bb61}))[_0x851a('0x10c')](/'/g,'\x5c\x27')};_0x3bd222['send'](ejs[_0x851a('0xca')](Mustache[_0x851a('0xca')](_0x14ea2b,_0xac4d12),{'proactiveActions':_0x57d064,'alignment':_0x3142df[_0x851a('0x10d')],'verticalAlignment':_0x3142df[_0x851a('0x10e')],'div_color':_0x3142df[_0x851a('0xf0')],'labelText':_0x3142df[_0x851a('0x10f')],'text_color':_0x3142df[_0x851a('0x110')],'text_button_color':_0x3142df[_0x851a('0x111')],'button_color':_0x3142df['color_button'],'background_color':_0x3142df['backgroundColor'],'hideWhenOffline':_0x3142df[_0x851a('0x112')],'intervalId':_0x3142df[_0x851a('0x113')],'isDevelopment':_0x4a1ca7,'chatVersion':_0x2bd4cd}));})[_0x851a('0x20')](handleError(_0x3bd222,null));};exports[_0x851a('0x114')]=function(_0x3917ba,_0xacdbb2){var _0x39456c=_0x3917ba[_0x851a('0x57')]['id'];var _0x2df645=_0x3917ba[_0x851a('0x56')];var _0x8d688f=0xc8;var _0x4f3dd5=null;return db[_0x851a('0xd5')][_0x851a('0x115')]({'isolationLevel':db[_0x851a('0xd5')][_0x851a('0x116')][_0x851a('0x117')][_0x851a('0x118')]},function(_0x52db77){return db[_0x851a('0x49')][_0x851a('0x5d')]({'where':{'id':_0x39456c},'transaction':_0x52db77})[_0x851a('0x15')](function(_0x27690f){if(_0x27690f){return db[_0x851a('0x95')]['destroy']({'where':{'ChatWebsiteId':_0x39456c},'transaction':_0x52db77})[_0x851a('0x15')](function(){var _0x326d43=_[_0x851a('0x37')](_0x2df645,function(_0x1321c9){_0x1321c9[_0x851a('0x5a')]=_0x39456c;return _0x1321c9;});return db[_0x851a('0x95')][_0x851a('0xd7')](_0x326d43,{'transaction':_0x52db77});});}else{_0x8d688f=0x194;_0x4f3dd5=[];}});})[_0x851a('0x15')](function(){if(_0x8d688f!==0x194){return db[_0x851a('0x95')][_0x851a('0x119')]({'where':{'ChatWebsiteId':_0x39456c},'order':_0x851a('0x9c')})[_0x851a('0x15')](function(_0x4e5758){_0x4f3dd5=_0x4e5758;});}})[_0x851a('0x20')](function(_0x1eaeb0){_0x8d688f=0x1f4;logger[_0x851a('0x1c')](_0x1eaeb0[_0x851a('0x2f')]);if(_0x1eaeb0[_0x851a('0x38')]){delete _0x1eaeb0[_0x851a('0x38')];}_0x4f3dd5=_0x1eaeb0;})[_0x851a('0x11a')](function(){if(_0x4f3dd5===null){_0xacdbb2[_0x851a('0x21')](_0x8d688f);}else{if(_0x8d688f===0x1f4){_0xacdbb2[_0x851a('0x22')](_0x8d688f)[_0x851a('0x30')](_0x4f3dd5);}else{_0xacdbb2[_0x851a('0x22')](_0x8d688f)['json'](_0x4f3dd5);}}});};exports[_0x851a('0x11b')]=function(_0x3f8bc7,_0x4e6468){var _0xea7707={};var _0x28f4d2={};var _0x271f28;var _0x41fedf;return db[_0x851a('0x49')][_0x851a('0x5d')]({'where':{'id':_0x3f8bc7[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x4e6468,null))[_0x851a('0x15')](function(_0x144777){if(_0x144777){_0x271f28=_0x144777;_0x28f4d2['model']=_[_0x851a('0x39')](db[_0x851a('0x95')][_0x851a('0x34')]);_0x28f4d2['query']=_[_0x851a('0x39')](_0x3f8bc7[_0x851a('0x3d')]);_0x28f4d2[_0x851a('0x3a')]=_[_0x851a('0x3b')](_0x28f4d2[_0x851a('0x3c')],_0x28f4d2[_0x851a('0x3d')]);_0xea7707[_0x851a('0x3f')]=_['intersection'](_0x28f4d2[_0x851a('0x3c')],qs[_0x851a('0x3e')](_0x3f8bc7[_0x851a('0x3d')][_0x851a('0x3e')]));_0xea7707[_0x851a('0x3f')]=_0xea7707['attributes'][_0x851a('0x4e')]?_0xea7707['attributes']:_0x28f4d2[_0x851a('0x3c')];_0xea7707[_0x851a('0x41')]=qs['sort'](_0x3f8bc7[_0x851a('0x3d')]['sort']);_0xea7707[_0x851a('0x43')]=qs['filters'](_[_0x851a('0x5f')](_0x3f8bc7[_0x851a('0x3d')],_0x28f4d2['filters']));if(_0x3f8bc7[_0x851a('0x3d')]['filter']){_0xea7707[_0x851a('0x43')]=_[_0x851a('0x44')](_0xea7707[_0x851a('0x43')],{'$or':_[_0x851a('0x37')](_0xea7707[_0x851a('0x3f')],function(_0x26cd55){var _0x3c6de7={};_0x3c6de7[_0x26cd55]={'$like':'%'+_0x3f8bc7[_0x851a('0x3d')][_0x851a('0x47')]+'%'};return _0x3c6de7;})});}_0xea7707=_[_0x851a('0x44')]({},_0xea7707,_0x3f8bc7[_0x851a('0x48')]);return _0x271f28[_0x851a('0x11b')](_0xea7707);}})[_0x851a('0x15')](function(_0x1e393c){if(_0x1e393c){_0x41fedf=_0x1e393c[_0x851a('0x4e')];if(!_0x3f8bc7['query']['hasOwnProperty'](_0x851a('0x40'))){_0xea7707[_0x851a('0x27')]=qs[_0x851a('0x27')](_0x3f8bc7['query'][_0x851a('0x27')]);_0xea7707[_0x851a('0x25')]=qs[_0x851a('0x25')](_0x3f8bc7['query']['offset']);}return _0x271f28[_0x851a('0x11b')](_0xea7707);}})[_0x851a('0x15')](function(_0x34643a){if(_0x34643a){return _0x34643a?{'count':_0x41fedf,'rows':_0x34643a}:null;}})[_0x851a('0x15')](respondWithResult(_0x4e6468,null))[_0x851a('0x20')](handleError(_0x4e6468,null));};exports['addProactiveActions']=function(_0x46b996,_0x2b12c0){return db[_0x851a('0x11c')][_0x851a('0x4f')]({'where':{'id':_0x46b996[_0x851a('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b12c0,null))[_0x851a('0x15')](function(_0x53a030){if(_0x53a030){return _0x53a030[_0x851a('0x11d')](_0x46b996[_0x851a('0x56')][_0x851a('0x65')],_[_0x851a('0x11e')](_0x46b996[_0x851a('0x56')],[_0x851a('0x65'),'id'])||{});}})[_0x851a('0x15')](respondWithResult(_0x2b12c0,null))[_0x851a('0x20')](handleError(_0x2b12c0,null));};exports['getProactiveActions']=function(_0x35d70a,_0xab74fb){var _0x324395={};var _0x18c479={};var _0x5b922b;var _0x2c22e5;return db[_0x851a('0x49')][_0x851a('0x5d')]({'where':{'id':_0x35d70a[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0xab74fb,null))[_0x851a('0x15')](function(_0x484a37){if(_0x484a37){_0x5b922b=_0x484a37;_0x18c479[_0x851a('0x3c')]=_[_0x851a('0x39')](db['ChatProactiveAction'][_0x851a('0x34')]);_0x18c479['query']=_[_0x851a('0x39')](_0x35d70a['query']);_0x18c479[_0x851a('0x3a')]=_[_0x851a('0x3b')](_0x18c479[_0x851a('0x3c')],_0x18c479[_0x851a('0x3d')]);_0x324395[_0x851a('0x3f')]=_['intersection'](_0x18c479['model'],qs[_0x851a('0x3e')](_0x35d70a[_0x851a('0x3d')][_0x851a('0x3e')]));_0x324395['attributes']=_0x324395[_0x851a('0x3f')][_0x851a('0x4e')]?_0x324395[_0x851a('0x3f')]:_0x18c479[_0x851a('0x3c')];_0x324395[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x35d70a[_0x851a('0x3d')][_0x851a('0x42')]);_0x324395['where']=qs[_0x851a('0x3a')](_['pick'](_0x35d70a[_0x851a('0x3d')],_0x18c479[_0x851a('0x3a')]));if(_0x35d70a[_0x851a('0x3d')][_0x851a('0x47')]){_0x324395['where']=_[_0x851a('0x44')](_0x324395[_0x851a('0x43')],{'$or':_[_0x851a('0x37')](_0x324395[_0x851a('0x3f')],function(_0x5c3e02){var _0x4bdb71={};_0x4bdb71[_0x5c3e02]={'$like':'%'+_0x35d70a['query']['filter']+'%'};return _0x4bdb71;})});}_0x324395=_[_0x851a('0x44')]({},_0x324395,_0x35d70a[_0x851a('0x48')]);return _0x5b922b[_0x851a('0xfd')](_0x324395);}})[_0x851a('0x15')](function(_0x53851a){if(_0x53851a){_0x2c22e5=_0x53851a[_0x851a('0x4e')];if(!_0x35d70a[_0x851a('0x3d')][_0x851a('0x5e')](_0x851a('0x40'))){_0x324395[_0x851a('0x27')]=qs[_0x851a('0x27')](_0x35d70a['query']['limit']);_0x324395[_0x851a('0x25')]=qs['offset'](_0x35d70a[_0x851a('0x3d')][_0x851a('0x25')]);}return _0x5b922b[_0x851a('0xfd')](_0x324395);}})[_0x851a('0x15')](function(_0x1e9126){if(_0x1e9126){return _0x1e9126?{'count':_0x2c22e5,'rows':_0x1e9126}:null;}})[_0x851a('0x15')](respondWithResult(_0xab74fb,null))[_0x851a('0x20')](handleError(_0xab74fb,null));};exports[_0x851a('0x11f')]=function(_0x463123,_0x1dc255){var _0x28e51d=_0x463123[_0x851a('0x3d')]['online']===_0x851a('0x120')?_0x851a('0x121'):_0x851a('0x122');return db[_0x851a('0x49')][_0x851a('0x4f')]({'attributes':['id',_0x28e51d],'where':{'id':_0x463123[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x1dc255,null))['then'](function(_0x14abaf){if(_0x14abaf){var _0x76a32a=_0x14abaf[_0x28e51d];var _0x5afbec=_0x76a32a&&_0x76a32a[_0x851a('0x123')]?_0x76a32a[_0x851a('0x123')]:[];_0x1dc255[_0x851a('0x30')]({'fromKey':_[_0x851a('0x78')](_0x76a32a['fromKey'])?undefined:_0x76a32a[_0x851a('0x124')],'count':_0x5afbec[_0x851a('0x4e')],'rows':_0x5afbec});}})['catch'](handleError(_0x1dc255,null));};exports['getOfflineMessages']=function(_0x3368d6,_0x292391){var _0x330c86={'raw':![],'where':{}};var _0x781b29={};var _0x2350fb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x851a('0x5d')]({'where':{'id':_0x3368d6['params']['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x292391,null))[_0x851a('0x15')](function(_0x98e3b3){if(_0x98e3b3){_0x781b29['model']=_[_0x851a('0x39')](db[_0x851a('0xcd')][_0x851a('0x34')]);_0x781b29['query']=_[_0x851a('0x39')](_0x3368d6[_0x851a('0x3d')]);_0x781b29[_0x851a('0x3a')]=_[_0x851a('0x3b')](_0x781b29[_0x851a('0x3c')],_0x781b29[_0x851a('0x3d')]);_0x330c86[_0x851a('0x3f')]=_[_0x851a('0x3b')](_0x781b29['model'],qs[_0x851a('0x3e')](_0x3368d6['query'][_0x851a('0x3e')]));_0x330c86['attributes']=_0x330c86['attributes'][_0x851a('0x4e')]?_0x330c86[_0x851a('0x3f')]:_0x781b29[_0x851a('0x3c')];if(!_0x3368d6[_0x851a('0x3d')][_0x851a('0x5e')]('nolimit')){_0x330c86['limit']=qs[_0x851a('0x27')](_0x3368d6['query'][_0x851a('0x27')]);_0x330c86[_0x851a('0x25')]=qs[_0x851a('0x25')](_0x3368d6['query']['offset']);}_0x330c86['order']=qs['sort'](_0x3368d6[_0x851a('0x3d')][_0x851a('0x42')]);_0x330c86[_0x851a('0x43')]=qs[_0x851a('0x3a')](_[_0x851a('0x5f')](_0x3368d6[_0x851a('0x3d')],_0x781b29[_0x851a('0x3a')]));_0x330c86['where']['ChatWebsiteId']=_0x98e3b3['id'];if(_0x3368d6['query'][_0x851a('0x47')]){_0x330c86[_0x851a('0x43')]=_[_0x851a('0x44')](_0x330c86[_0x851a('0x43')],{'$or':_[_0x851a('0x37')](_0x330c86[_0x851a('0x3f')],function(_0x309d6d){var _0x3753fc={};_0x3753fc[_0x309d6d]={'$like':'%'+_0x3368d6[_0x851a('0x3d')][_0x851a('0x47')]+'%'};return _0x3753fc;})});}_0x330c86=_[_0x851a('0x44')]({},_0x330c86,_0x3368d6[_0x851a('0x48')]);return db['ChatOfflineMessage']['count']({'where':_0x330c86[_0x851a('0x43')]})[_0x851a('0x15')](function(_0x403225){_0x2350fb[_0x851a('0x28')]=_0x403225;if(_0x3368d6['query'][_0x851a('0x63')]){_0x330c86[_0x851a('0x4a')]=[{'all':!![]}];}else{_0x330c86['include']=[{'model':db['CmContact'],'as':_0x851a('0xec'),'required':![]},{'model':db[_0x851a('0xd6')],'as':_0x851a('0x125'),'required':![]}];}return db[_0x851a('0xcd')][_0x851a('0x4b')](_0x330c86);})[_0x851a('0x15')](function(_0x292154){_0x2350fb[_0x851a('0x4c')]=_0x292154;return _0x2350fb;});}})[_0x851a('0x15')](respondWithFilteredResult(_0x292391,_0x330c86))[_0x851a('0x20')](handleError(_0x292391,null));};exports['addAgents']=function(_0x4beedf,_0x541ab6){return db[_0x851a('0x49')][_0x851a('0x4f')]({'where':{'id':_0x4beedf[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x541ab6,null))[_0x851a('0x15')](function(_0x28c869){if(_0x28c869){return _0x28c869[_0x851a('0x126')](_0x4beedf[_0x851a('0x56')][_0x851a('0x65')],_[_0x851a('0x11e')](_0x4beedf[_0x851a('0x56')],[_0x851a('0x65'),'id'])||{})[_0x851a('0xb1')](function(_0x29f3e3){for(var _0x2ae8eb=0x0;_0x2ae8eb<_0x4beedf[_0x851a('0x56')][_0x851a('0x65')]['length'];_0x2ae8eb+=0x1){socket[_0x851a('0x127')](_0x851a('0x128'),{'UserId':Number(_0x4beedf['body'][_0x851a('0x65')][_0x2ae8eb]),'ChatWebsiteId':Number(_0x4beedf['params']['id'])});}return _0x29f3e3;});}})[_0x851a('0x15')](respondWithResult(_0x541ab6,null))['catch'](handleError(_0x541ab6,null));};exports[_0x851a('0x129')]=function(_0x441c98,_0x13765e){return db[_0x851a('0x49')]['find']({'where':{'id':_0x441c98[_0x851a('0x57')]['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x13765e,null))[_0x851a('0x15')](function(_0x43f5c7){if(_0x43f5c7){return _0x43f5c7['removeAgents'](_0x441c98['query'][_0x851a('0x65')])[_0x851a('0x15')](function(){if(_['isArray'](_0x441c98[_0x851a('0x3d')][_0x851a('0x65')])){for(var _0x19d809=0x0;_0x19d809<_0x441c98[_0x851a('0x3d')][_0x851a('0x65')][_0x851a('0x4e')];_0x19d809+=0x1){socket['emit'](_0x851a('0x12a'),{'UserId':Number(_0x441c98[_0x851a('0x3d')][_0x851a('0x65')][_0x19d809]),'ChatWebsiteId':Number(_0x441c98['params']['id'])});}}else{socket[_0x851a('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x441c98[_0x851a('0x3d')]['ids']),'ChatWebsiteId':Number(_0x441c98[_0x851a('0x57')]['id'])});}});}})[_0x851a('0x15')](respondWithStatusCode(_0x13765e,null))[_0x851a('0x20')](handleError(_0x13765e,null));};exports[_0x851a('0x12b')]=function(_0x2af7b8,_0x107a14){var _0x41a840={};var _0x5f064c={};var _0x190650;var _0x1c7ce3;return db[_0x851a('0x49')][_0x851a('0x5d')]({'where':{'id':_0x2af7b8['params']['id']}})[_0x851a('0x15')](handleEntityNotFound(_0x107a14,null))['then'](function(_0x3471d6){if(_0x3471d6){_0x190650=_0x3471d6;_0x5f064c[_0x851a('0x3c')]=_['keys'](db[_0x851a('0xba')]['rawAttributes']);_0x5f064c[_0x851a('0x3d')]=_['keys'](_0x2af7b8[_0x851a('0x3d')]);_0x5f064c['filters']=_['intersection'](_0x5f064c[_0x851a('0x3c')],_0x5f064c[_0x851a('0x3d')]);_0x41a840[_0x851a('0x3f')]=_[_0x851a('0x3b')](_0x5f064c[_0x851a('0x3c')],qs['fields'](_0x2af7b8['query'][_0x851a('0x3e')]));_0x41a840[_0x851a('0x3f')]=_0x41a840[_0x851a('0x3f')][_0x851a('0x4e')]?_0x41a840['attributes']:_0x5f064c[_0x851a('0x3c')];_0x41a840[_0x851a('0x41')]=qs[_0x851a('0x42')](_0x2af7b8[_0x851a('0x3d')]['sort']);_0x41a840['where']=qs['filters'](_[_0x851a('0x5f')](_0x2af7b8[_0x851a('0x3d')],_0x5f064c[_0x851a('0x3a')]));if(_0x2af7b8[_0x851a('0x3d')][_0x851a('0x47')]){_0x41a840[_0x851a('0x43')]=_[_0x851a('0x44')](_0x41a840['where'],{'$or':_[_0x851a('0x37')](_0x41a840[_0x851a('0x3f')],function(_0x246479){var _0x24e759={};_0x24e759[_0x246479]={'$like':'%'+_0x2af7b8[_0x851a('0x3d')]['filter']+'%'};return _0x24e759;})});}_0x41a840=_[_0x851a('0x44')]({},_0x41a840,_0x2af7b8['options']);return _0x190650[_0x851a('0x12b')](_0x41a840);}})[_0x851a('0x15')](function(_0x1b79c1){if(_0x1b79c1){_0x1c7ce3=_0x1b79c1[_0x851a('0x4e')];if(!_0x2af7b8['query']['hasOwnProperty'](_0x851a('0x40'))){_0x41a840['limit']=qs[_0x851a('0x27')](_0x2af7b8['query'][_0x851a('0x27')]);_0x41a840[_0x851a('0x25')]=qs[_0x851a('0x25')](_0x2af7b8['query']['offset']);}return _0x190650[_0x851a('0x12b')](_0x41a840);}})[_0x851a('0x15')](function(_0x2707cb){if(_0x2707cb){return _0x2707cb?{'count':_0x1c7ce3,'rows':_0x2707cb}:null;}})['then'](respondWithResult(_0x107a14,null))[_0x851a('0x20')](handleError(_0x107a14,null));}; \ No newline at end of file +var _0xf5b0=['format','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','color','tag','Command','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','address','origin','3.1.0','remote','stringify','x-real-ip','connection','virtual','replace','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','READ_COMMITTED','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','index','Pause','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','getLicense','isNil','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','applications','list','orderBy','priority','asc','Applications','account','contact','customerIp','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','unknown','%s\x20%s','device','vendor'];(function(_0x5f4e41,_0x2202e4){var _0x17fe7a=function(_0x50ec25){while(--_0x50ec25){_0x5f4e41['push'](_0x5f4e41['shift']());}};_0x17fe7a(++_0x2202e4);}(_0xf5b0,0x1b0));var _0x0f5b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf5b0[_0x2d7f0e];return _0x110b07;};'use strict';var BPromise=require(_0x0f5b('0x0'));var Mustache=require(_0x0f5b('0x1'));var util=require(_0x0f5b('0x2'));var path=require(_0x0f5b('0x3'));var ejs=require(_0x0f5b('0x4'));var fs=require('fs');var fs_extra=require(_0x0f5b('0x5'));var _=require(_0x0f5b('0x6'));var querystring=require(_0x0f5b('0x7'));var Redis=require(_0x0f5b('0x8'));var qs=require(_0x0f5b('0x9'));var logger=require(_0x0f5b('0xa'))(_0x0f5b('0xb'));var config=require(_0x0f5b('0xc'));var url=require(_0x0f5b('0xd'));var db=require(_0x0f5b('0xe'))['db'];config[_0x0f5b('0xf')]=_[_0x0f5b('0x10')](config['redis'],{'host':_0x0f5b('0x11'),'port':0x18eb});var socket=require(_0x0f5b('0x12'))(new Redis(config['redis']));require(_0x0f5b('0x13'))[_0x0f5b('0x14')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x0f5b('0x15'));var client=jayson[_0x0f5b('0x16')][_0x0f5b('0x17')]({'port':0x232c});var client9002=jayson[_0x0f5b('0x16')]['http']({'port':0x232a});var client9003=jayson[_0x0f5b('0x16')]['http']({'port':0x232b});var client9001=jayson[_0x0f5b('0x16')][_0x0f5b('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x4ab5c4,_0x14b2bc,_0x1fc930,_0xf67b58){return new BPromise(function(_0x1f4994,_0x1409ed){var _0x37bd40=_0xf67b58||client;return _0x37bd40[_0x0f5b('0x18')](_0x4ab5c4,_0x1fc930)[_0x0f5b('0x19')](function(_0x586203){logger[_0x0f5b('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x14b2bc,_0x0f5b('0x1b'));logger[_0x0f5b('0x1c')](_0x0f5b('0x1d'),_0x14b2bc,'request\x20sent',JSON['stringify'](_0x586203));if(_0x586203[_0x0f5b('0x1e')]){if(_0x586203[_0x0f5b('0x1e')][_0x0f5b('0x1f')]===0x1f4){logger[_0x0f5b('0x1e')](_0x0f5b('0x20'),_0x14b2bc,_0x586203[_0x0f5b('0x1e')][_0x0f5b('0x21')]);return _0x1409ed(_0x586203['error'][_0x0f5b('0x21')]);}logger[_0x0f5b('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x14b2bc,_0x586203[_0x0f5b('0x1e')]['message']);return _0x1f4994(_0x586203[_0x0f5b('0x1e')][_0x0f5b('0x21')]);}else{logger[_0x0f5b('0x1a')](_0x0f5b('0x20'),_0x14b2bc,_0x0f5b('0x1b'));_0x1f4994(_0x586203[_0x0f5b('0x22')]['message']);}})[_0x0f5b('0x23')](function(_0x1d568b){logger[_0x0f5b('0x1e')](_0x0f5b('0x20'),_0x14b2bc,_0x1d568b);_0x1409ed(_0x1d568b);});});}function respondWithStatusCode(_0x3c1b65,_0x10ca85){_0x10ca85=_0x10ca85||0xcc;return function(_0xca9a5e){if(_0xca9a5e){return _0x3c1b65[_0x0f5b('0x24')](_0x10ca85);}return _0x3c1b65[_0x0f5b('0x25')](_0x10ca85)[_0x0f5b('0x26')]();};}function respondWithResult(_0x1ab07e,_0x55b5ad){_0x55b5ad=_0x55b5ad||0xc8;return function(_0x5c0f76){if(_0x5c0f76){return _0x1ab07e[_0x0f5b('0x25')](_0x55b5ad)[_0x0f5b('0x27')](_0x5c0f76);}};}function respondWithFilteredResult(_0x1e5dcd,_0x1f72f9){return function(_0x47876b){if(_0x47876b){var _0x435ba4=typeof _0x1f72f9['offset']===_0x0f5b('0x28')&&typeof _0x1f72f9[_0x0f5b('0x29')]===_0x0f5b('0x28');var _0x563dbb=_0x47876b[_0x0f5b('0x2a')];var _0x8276ca=_0x435ba4?0x0:_0x1f72f9[_0x0f5b('0x2b')];var _0x47f7a2=_0x435ba4?_0x47876b[_0x0f5b('0x2a')]:_0x1f72f9[_0x0f5b('0x2b')]+_0x1f72f9[_0x0f5b('0x29')];var _0x9afef3;if(_0x47f7a2>=_0x563dbb){_0x47f7a2=_0x563dbb;_0x9afef3=0xc8;}else{_0x9afef3=0xce;}_0x1e5dcd[_0x0f5b('0x25')](_0x9afef3);return _0x1e5dcd[_0x0f5b('0x2c')](_0x0f5b('0x2d'),_0x8276ca+'-'+_0x47f7a2+'/'+_0x563dbb)[_0x0f5b('0x27')](_0x47876b);}return null;};}function saveUpdates(_0x4b5c95){return function(_0x4c40d0){if(_0x4c40d0){return _0x4c40d0[_0x0f5b('0x2e')](_0x4b5c95)[_0x0f5b('0x19')](function(_0x2dea93){return _0x2dea93;});}return null;};}function removeEntity(_0x103e5a){return function(_0x239d9b){if(_0x239d9b){return _0x239d9b[_0x0f5b('0x2f')]()[_0x0f5b('0x19')](function(){var _0x25c19b=_0x239d9b[_0x0f5b('0x30')]({'plain':!![]});var _0x22a52d=_0x0f5b('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x22a52d,'resourceId':_0x25c19b['id']}})[_0x0f5b('0x19')](function(){return _0x239d9b;});})['then'](function(){_0x103e5a[_0x0f5b('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x330eee){return function(_0x4d3710){if(!_0x4d3710){_0x330eee['sendStatus'](0x194);}return _0x4d3710;};}function handleError(_0x47d1ee,_0x2d1ff4){_0x2d1ff4=_0x2d1ff4||0x1f4;return function(_0x3ce13d){logger[_0x0f5b('0x1e')](_0x3ce13d[_0x0f5b('0x32')]);if(_0x3ce13d['name']){delete _0x3ce13d[_0x0f5b('0x33')];}_0x47d1ee['status'](_0x2d1ff4)['send'](_0x3ce13d);};}exports[_0x0f5b('0x34')]=function(_0x4a5044,_0x18db3e){var _0x36eeef={'include':[{'model':db[_0x0f5b('0x35')],'as':'mandatoryDispositionPause'}]},_0x143edf={},_0x251350={'count':0x0,'rows':[]};var _0x3eba05=_['map'](db[_0x0f5b('0x36')][_0x0f5b('0x37')],function(_0x1bd1f3){return{'name':_0x1bd1f3[_0x0f5b('0x38')],'type':_0x1bd1f3[_0x0f5b('0x39')][_0x0f5b('0x3a')]};});_0x143edf[_0x0f5b('0x3b')]=_['map'](_0x3eba05,'name');_0x143edf[_0x0f5b('0x3c')]=_['keys'](_0x4a5044[_0x0f5b('0x3c')]);_0x143edf[_0x0f5b('0x3d')]=_['intersection'](_0x143edf[_0x0f5b('0x3b')],_0x143edf[_0x0f5b('0x3c')]);_0x36eeef[_0x0f5b('0x3e')]=_['intersection'](_0x143edf[_0x0f5b('0x3b')],qs[_0x0f5b('0x3f')](_0x4a5044[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x36eeef[_0x0f5b('0x3e')]=_0x36eeef[_0x0f5b('0x3e')][_0x0f5b('0x40')]?_0x36eeef[_0x0f5b('0x3e')]:_0x143edf[_0x0f5b('0x3b')];if(!_0x4a5044['query'][_0x0f5b('0x41')](_0x0f5b('0x42'))){_0x36eeef[_0x0f5b('0x29')]=qs['limit'](_0x4a5044[_0x0f5b('0x3c')]['limit']);_0x36eeef[_0x0f5b('0x2b')]=qs[_0x0f5b('0x2b')](_0x4a5044[_0x0f5b('0x3c')][_0x0f5b('0x2b')]);}_0x36eeef[_0x0f5b('0x43')]=qs[_0x0f5b('0x44')](_0x4a5044['query']['sort']);_0x36eeef[_0x0f5b('0x45')]=qs[_0x0f5b('0x3d')](_[_0x0f5b('0x46')](_0x4a5044[_0x0f5b('0x3c')],_0x143edf['filters']),_0x3eba05);if(_0x4a5044[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x36eeef['where']=_[_0x0f5b('0x48')](_0x36eeef['where'],{'$or':_[_0x0f5b('0x49')](_0x3eba05,function(_0x15e57b){if(_0x15e57b[_0x0f5b('0x39')]!=='VIRTUAL'){var _0x2eb6bb={};_0x2eb6bb[_0x15e57b[_0x0f5b('0x33')]]={'$like':'%'+_0x4a5044[_0x0f5b('0x3c')][_0x0f5b('0x47')]+'%'};return _0x2eb6bb;}})});}_0x36eeef=_[_0x0f5b('0x48')]({},_0x36eeef,_0x4a5044[_0x0f5b('0x4a')]);var _0x589f31={'where':_0x36eeef[_0x0f5b('0x45')]};return db[_0x0f5b('0x36')][_0x0f5b('0x2a')](_0x589f31)[_0x0f5b('0x19')](function(_0x5d495f){_0x251350[_0x0f5b('0x2a')]=_0x5d495f;if(_0x4a5044['query'][_0x0f5b('0x4b')]){_0x36eeef[_0x0f5b('0x4c')]=[{'all':!![]}];}return db[_0x0f5b('0x36')][_0x0f5b('0x4d')](_0x36eeef);})[_0x0f5b('0x19')](function(_0x4e5396){_0x251350[_0x0f5b('0x4e')]=_0x4e5396;return _0x251350;})['then'](respondWithFilteredResult(_0x18db3e,_0x36eeef))[_0x0f5b('0x23')](handleError(_0x18db3e,null));};exports[_0x0f5b('0x4f')]=function(_0x10d64c,_0x1625e2){var _0x14aaa3={'raw':![],'where':{'id':_0x10d64c[_0x0f5b('0x50')]['id']},'include':[{'model':db[_0x0f5b('0x35')],'as':_0x0f5b('0x51')}]},_0x3dcb37={};_0x3dcb37[_0x0f5b('0x3b')]=_[_0x0f5b('0x52')](db[_0x0f5b('0x36')]['rawAttributes']);_0x3dcb37[_0x0f5b('0x3c')]=_[_0x0f5b('0x52')](_0x10d64c[_0x0f5b('0x3c')]);_0x3dcb37[_0x0f5b('0x3d')]=_[_0x0f5b('0x53')](_0x3dcb37[_0x0f5b('0x3b')],_0x3dcb37[_0x0f5b('0x3c')]);_0x14aaa3[_0x0f5b('0x3e')]=_[_0x0f5b('0x53')](_0x3dcb37['model'],qs[_0x0f5b('0x3f')](_0x10d64c[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x14aaa3[_0x0f5b('0x3e')]=_0x14aaa3[_0x0f5b('0x3e')]['length']?_0x14aaa3[_0x0f5b('0x3e')]:_0x3dcb37['model'];if(_0x10d64c[_0x0f5b('0x3c')][_0x0f5b('0x4b')]){_0x14aaa3[_0x0f5b('0x4c')]=[{'all':!![]}];}_0x14aaa3=_['merge']({},_0x14aaa3,_0x10d64c[_0x0f5b('0x4a')]);return db[_0x0f5b('0x36')][_0x0f5b('0x54')](_0x14aaa3)[_0x0f5b('0x19')](handleEntityNotFound(_0x1625e2,null))['then'](respondWithResult(_0x1625e2,null))[_0x0f5b('0x23')](handleError(_0x1625e2,null));};exports[_0x0f5b('0x55')]=function(_0x4c5423,_0x2aae97){return db['ChatWebsite'][_0x0f5b('0x55')](_0x4c5423[_0x0f5b('0x56')],{})['then'](function(_0x12634c){var _0x50ff40=_0x4c5423[_0x0f5b('0x57')][_0x0f5b('0x30')]({'plain':!![]});if(!_0x50ff40)throw new Error(_0x0f5b('0x58'));if(_0x50ff40['role']==='user'){var _0x331fd4=_0x12634c[_0x0f5b('0x30')]({'plain':!![]});var _0x5a1f5b=_0x0f5b('0x31');return db[_0x0f5b('0x59')][_0x0f5b('0x54')]({'where':{'name':_0x5a1f5b,'userProfileId':_0x50ff40[_0x0f5b('0x5a')]},'raw':!![]})[_0x0f5b('0x19')](function(_0x40ed14){if(_0x40ed14&&_0x40ed14['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x331fd4[_0x0f5b('0x33')],'resourceId':_0x331fd4['id'],'type':_0x40ed14[_0x0f5b('0x33')],'sectionId':_0x40ed14['id']},{})['then'](function(){return _0x12634c;});}else{return _0x12634c;}})[_0x0f5b('0x23')](function(_0x38dcb8){logger[_0x0f5b('0x1e')](_0x0f5b('0x5b'),_0x38dcb8);throw _0x38dcb8;});}return _0x12634c;})[_0x0f5b('0x19')](respondWithResult(_0x2aae97,0xc9))['catch'](handleError(_0x2aae97,null));};exports[_0x0f5b('0x2e')]=function(_0x3c390d,_0x27abb8){if(_0x3c390d[_0x0f5b('0x56')]['id']){delete _0x3c390d[_0x0f5b('0x56')]['id'];}return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x3c390d[_0x0f5b('0x50')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x27abb8,null))['then'](saveUpdates(_0x3c390d[_0x0f5b('0x56')],null))[_0x0f5b('0x19')](respondWithResult(_0x27abb8,null))[_0x0f5b('0x23')](handleError(_0x27abb8,null));};exports[_0x0f5b('0x2f')]=function(_0x680490,_0x35e2e6){return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x680490[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x35e2e6,null))['then'](removeEntity(_0x35e2e6,null))[_0x0f5b('0x23')](handleError(_0x35e2e6,null));};exports[_0x0f5b('0x5c')]=function(_0x1210f8,_0x2c3689){return db[_0x0f5b('0x36')][_0x0f5b('0x5c')]()[_0x0f5b('0x19')](respondWithResult(_0x2c3689,null))[_0x0f5b('0x23')](handleError(_0x2c3689,null));};exports[_0x0f5b('0x5d')]=function(_0x530d9a,_0x555e5e){if(_0x530d9a['body']['id']){delete _0x530d9a['body']['id'];}return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x530d9a[_0x0f5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x555e5e,null))['then'](function(_0x359a77){if(_0x359a77){_0x530d9a[_0x0f5b('0x56')][_0x0f5b('0x5e')]=_0x359a77['id'];return db[_0x0f5b('0x5f')]['create'](_0x530d9a['body']);}})[_0x0f5b('0x19')](respondWithResult(_0x555e5e,null))['catch'](handleError(_0x555e5e,null));};exports[_0x0f5b('0x60')]=function(_0x39ef7b,_0x2fe92c){var _0x1bec81={'raw':![],'where':{}};var _0x7a9ffd={};var _0x3ed37c={'count':0x0,'rows':[]};return db[_0x0f5b('0x36')]['findOne']({'where':{'id':_0x39ef7b[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x2fe92c,null))[_0x0f5b('0x19')](function(_0x1f116c){if(_0x1f116c){_0x7a9ffd[_0x0f5b('0x3b')]=_[_0x0f5b('0x52')](db[_0x0f5b('0x5f')][_0x0f5b('0x37')]);_0x7a9ffd['query']=_['keys'](_0x39ef7b[_0x0f5b('0x3c')]);_0x7a9ffd[_0x0f5b('0x3d')]=_['intersection'](_0x7a9ffd[_0x0f5b('0x3b')],_0x7a9ffd[_0x0f5b('0x3c')]);_0x1bec81[_0x0f5b('0x3e')]=_[_0x0f5b('0x53')](_0x7a9ffd[_0x0f5b('0x3b')],qs['fields'](_0x39ef7b[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x1bec81[_0x0f5b('0x3e')]=_0x1bec81[_0x0f5b('0x3e')]['length']?_0x1bec81['attributes']:_0x7a9ffd[_0x0f5b('0x3b')];if(!_0x39ef7b[_0x0f5b('0x3c')][_0x0f5b('0x41')](_0x0f5b('0x42'))){_0x1bec81['limit']=qs['limit'](_0x39ef7b['query'][_0x0f5b('0x29')]);_0x1bec81[_0x0f5b('0x2b')]=qs[_0x0f5b('0x2b')](_0x39ef7b[_0x0f5b('0x3c')][_0x0f5b('0x2b')]);}_0x1bec81['order']=qs['sort'](_0x39ef7b[_0x0f5b('0x3c')][_0x0f5b('0x44')]);_0x1bec81[_0x0f5b('0x45')]=qs[_0x0f5b('0x3d')](_[_0x0f5b('0x46')](_0x39ef7b['query'],_0x7a9ffd[_0x0f5b('0x3d')]));_0x1bec81[_0x0f5b('0x45')][_0x0f5b('0x5e')]=_0x1f116c['id'];if(_0x39ef7b[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x1bec81[_0x0f5b('0x45')]=_[_0x0f5b('0x48')](_0x1bec81['where'],{'$or':_[_0x0f5b('0x49')](_0x1bec81[_0x0f5b('0x3e')],function(_0x1de2f6){var _0x39ae60={};_0x39ae60[_0x1de2f6]={'$like':'%'+_0x39ef7b[_0x0f5b('0x3c')]['filter']+'%'};return _0x39ae60;})});}_0x1bec81=_[_0x0f5b('0x48')]({},_0x1bec81,_0x39ef7b[_0x0f5b('0x4a')]);return db['Disposition'][_0x0f5b('0x2a')]({'where':_0x1bec81['where']})[_0x0f5b('0x19')](function(_0x1dd95d){_0x3ed37c[_0x0f5b('0x2a')]=_0x1dd95d;if(_0x39ef7b[_0x0f5b('0x3c')][_0x0f5b('0x4b')]){_0x1bec81[_0x0f5b('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0x0f5b('0x4d')](_0x1bec81);})[_0x0f5b('0x19')](function(_0x433e3d){_0x3ed37c[_0x0f5b('0x4e')]=_0x433e3d;return _0x3ed37c;});}})[_0x0f5b('0x19')](respondWithFilteredResult(_0x2fe92c,_0x1bec81))[_0x0f5b('0x23')](handleError(_0x2fe92c,null));};exports[_0x0f5b('0x61')]=function(_0x2aacbe,_0x247e12){return db['ChatWebsite'][_0x0f5b('0x54')]({'where':{'id':_0x2aacbe[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x247e12,null))['then'](function(_0x2c7ee4){if(_0x2c7ee4){return _0x2c7ee4['removeDispositions'](_0x2aacbe['query'][_0x0f5b('0x62')]);}})[_0x0f5b('0x19')](respondWithStatusCode(_0x247e12,null))[_0x0f5b('0x23')](handleError(_0x247e12,null));};exports[_0x0f5b('0x63')]=function(_0x16fc42,_0x1e1865){if(_0x16fc42[_0x0f5b('0x56')]['id']){delete _0x16fc42['body']['id'];}return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x16fc42['params']['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x1e1865,null))['then'](function(_0x479af2){if(_0x479af2){_0x16fc42[_0x0f5b('0x56')][_0x0f5b('0x5e')]=_0x479af2['id'];return db[_0x0f5b('0x64')][_0x0f5b('0x55')](_0x16fc42[_0x0f5b('0x56')]);}})[_0x0f5b('0x19')](respondWithResult(_0x1e1865,null))[_0x0f5b('0x23')](handleError(_0x1e1865,null));};exports[_0x0f5b('0x65')]=function(_0x318b8f,_0x5ddd29){var _0x46a973={'raw':![],'where':{}};var _0x5bc8c5={};var _0x2c3144={'count':0x0,'rows':[]};return db[_0x0f5b('0x36')][_0x0f5b('0x66')]({'where':{'id':_0x318b8f[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x5ddd29,null))[_0x0f5b('0x19')](function(_0x2501c7){if(_0x2501c7){_0x5bc8c5['model']=_[_0x0f5b('0x52')](db['CannedAnswer'][_0x0f5b('0x37')]);_0x5bc8c5[_0x0f5b('0x3c')]=_[_0x0f5b('0x52')](_0x318b8f[_0x0f5b('0x3c')]);_0x5bc8c5['filters']=_[_0x0f5b('0x53')](_0x5bc8c5['model'],_0x5bc8c5[_0x0f5b('0x3c')]);_0x46a973[_0x0f5b('0x3e')]=_[_0x0f5b('0x53')](_0x5bc8c5['model'],qs[_0x0f5b('0x3f')](_0x318b8f[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x46a973[_0x0f5b('0x3e')]=_0x46a973[_0x0f5b('0x3e')][_0x0f5b('0x40')]?_0x46a973['attributes']:_0x5bc8c5[_0x0f5b('0x3b')];if(!_0x318b8f['query']['hasOwnProperty'](_0x0f5b('0x42'))){_0x46a973[_0x0f5b('0x29')]=qs['limit'](_0x318b8f[_0x0f5b('0x3c')][_0x0f5b('0x29')]);_0x46a973[_0x0f5b('0x2b')]=qs[_0x0f5b('0x2b')](_0x318b8f[_0x0f5b('0x3c')]['offset']);}_0x46a973[_0x0f5b('0x43')]=qs['sort'](_0x318b8f[_0x0f5b('0x3c')]['sort']);_0x46a973[_0x0f5b('0x45')]=qs[_0x0f5b('0x3d')](_[_0x0f5b('0x46')](_0x318b8f['query'],_0x5bc8c5['filters']));_0x46a973[_0x0f5b('0x45')][_0x0f5b('0x5e')]=_0x2501c7['id'];if(_0x318b8f[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x46a973[_0x0f5b('0x45')]=_[_0x0f5b('0x48')](_0x46a973[_0x0f5b('0x45')],{'$or':_[_0x0f5b('0x49')](_0x46a973[_0x0f5b('0x3e')],function(_0xf3c836){var _0x3896a4={};_0x3896a4[_0xf3c836]={'$like':'%'+_0x318b8f['query'][_0x0f5b('0x47')]+'%'};return _0x3896a4;})});}_0x46a973=_['merge']({},_0x46a973,_0x318b8f[_0x0f5b('0x4a')]);return db[_0x0f5b('0x64')]['count']({'where':_0x46a973[_0x0f5b('0x45')]})[_0x0f5b('0x19')](function(_0x93fc01){_0x2c3144['count']=_0x93fc01;if(_0x318b8f['query'][_0x0f5b('0x4b')]){_0x46a973[_0x0f5b('0x4c')]=[{'all':!![]}];}return db[_0x0f5b('0x64')][_0x0f5b('0x4d')](_0x46a973);})[_0x0f5b('0x19')](function(_0x5f380a){_0x2c3144[_0x0f5b('0x4e')]=_0x5f380a;return _0x2c3144;});}})[_0x0f5b('0x19')](respondWithFilteredResult(_0x5ddd29,_0x46a973))[_0x0f5b('0x23')](handleError(_0x5ddd29,null));};exports[_0x0f5b('0x67')]=function(_0x1aebc9,_0x437842){return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x1aebc9[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x437842,null))[_0x0f5b('0x19')](function(_0x614418){if(_0x614418){return _0x614418[_0x0f5b('0x67')](_0x1aebc9['query']['ids']);}})[_0x0f5b('0x19')](respondWithStatusCode(_0x437842,null))[_0x0f5b('0x23')](handleError(_0x437842,null));};exports['addLogo']=function(_0x110bea,_0x2f80b6){_0x110bea['body'][_0x0f5b('0x68')]=_0x110bea[_0x0f5b('0x69')][_0x0f5b('0x6a')];return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x110bea[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x2f80b6,null))[_0x0f5b('0x19')](saveUpdates(_0x110bea['body'],null))[_0x0f5b('0x19')](respondWithResult(_0x2f80b6,null))[_0x0f5b('0x23')](handleError(_0x2f80b6,null));};exports[_0x0f5b('0x6b')]=function(_0x3753ff,_0x5f17d5){_0x3753ff[_0x0f5b('0x56')][_0x0f5b('0x6c')]=_0x3753ff['file']['filename'];return db['ChatWebsite'][_0x0f5b('0x54')]({'where':{'id':_0x3753ff[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x5f17d5,null))[_0x0f5b('0x19')](saveUpdates(_0x3753ff[_0x0f5b('0x56')],null))[_0x0f5b('0x19')](respondWithResult(_0x5f17d5,null))[_0x0f5b('0x23')](handleError(_0x5f17d5,null));};exports[_0x0f5b('0x6d')]=function(_0x468f23,_0x2893c5){_0x468f23[_0x0f5b('0x56')][_0x0f5b('0x6e')]=_0x468f23[_0x0f5b('0x69')]['filename'];return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x468f23['params']['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x2893c5,null))['then'](saveUpdates(_0x468f23[_0x0f5b('0x56')],null))['then'](respondWithResult(_0x2893c5,null))['catch'](handleError(_0x2893c5,null));};exports[_0x0f5b('0x6f')]=function(_0xe774e0,_0x523af1){_0xe774e0[_0x0f5b('0x56')][_0x0f5b('0x70')]=_0xe774e0[_0x0f5b('0x69')][_0x0f5b('0x6a')];return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0xe774e0[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x523af1,null))[_0x0f5b('0x19')](saveUpdates(_0xe774e0[_0x0f5b('0x56')],null))['then'](respondWithResult(_0x523af1,null))[_0x0f5b('0x23')](handleError(_0x523af1,null));};exports[_0x0f5b('0x71')]=function(_0x4b2714,_0x12d81c){var _0x326921=path['join'](config[_0x0f5b('0x72')],'server/files/images/logos/default_logo.svg');var _0x98f0e4={'where':{'id':_0x4b2714[_0x0f5b('0x50')]['id']},'attributes':['id',_0x0f5b('0x68')],'raw':!![]};var _0x13fe04=![];return require('../../config/license/util')[_0x0f5b('0x73')]()[_0x0f5b('0x19')](function(_0x341fe1){if(_0x341fe1){_0x13fe04=_0x341fe1['custom'];}})[_0x0f5b('0x19')](function(){return db[_0x0f5b('0x36')][_0x0f5b('0x54')](_0x98f0e4);})[_0x0f5b('0x19')](handleEntityNotFound(_0x12d81c,null))[_0x0f5b('0x19')](function(_0x13a183){if(_0x13a183){if(!_[_0x0f5b('0x74')](_0x13a183[_0x0f5b('0x68')])){if(fs['existsSync'](path['join'](config['root'],_0x0f5b('0x75'),_0x13a183[_0x0f5b('0x68')]))&&_0x13fe04){_0x326921=path[_0x0f5b('0x76')](config['root'],_0x0f5b('0x75'),_0x13a183['sitepic']);}}return _0x12d81c[_0x0f5b('0x77')](_0x326921);}})[_0x0f5b('0x23')](handleError(_0x12d81c,null));};exports[_0x0f5b('0x78')]=function(_0x18f3b3,_0x57c484){var _0x5a4a24=path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],_0x0f5b('0x79'));var _0x15c201={'where':{'id':_0x18f3b3[_0x0f5b('0x50')]['id']},'attributes':['id',_0x0f5b('0x6c')],'raw':!![]};return db[_0x0f5b('0x36')]['find'](_0x15c201)['then'](handleEntityNotFound(_0x57c484,null))['then'](function(_0x2c9b19){if(_0x2c9b19){if(!_['isNil'](_0x2c9b19[_0x0f5b('0x6c')])){if(fs['existsSync'](path[_0x0f5b('0x76')](config['root'],'server/files/images/avatars/',_0x2c9b19[_0x0f5b('0x6c')]))){_0x5a4a24=path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],_0x0f5b('0x7a'),_0x2c9b19[_0x0f5b('0x6c')]);}}return _0x57c484[_0x0f5b('0x77')](_0x5a4a24);}})['catch'](handleError(_0x57c484,null));};exports['getCustomerAvatar']=function(_0x1a1648,_0x40f1ab){var _0x180823=path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],_0x0f5b('0x7b'));var _0x38f120={'where':{'id':_0x1a1648[_0x0f5b('0x50')]['id']},'attributes':['id',_0x0f5b('0x6e'),_0x0f5b('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x0f5b('0x54')](_0x38f120)['then'](handleEntityNotFound(_0x40f1ab,null))[_0x0f5b('0x19')](function(_0x52a482){if(_0x52a482){if(!_[_0x0f5b('0x74')](_0x52a482[_0x0f5b('0x6e')])){if(fs[_0x0f5b('0x7d')](path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],_0x0f5b('0x7a'),_0x52a482[_0x0f5b('0x6e')]))&&_0x52a482[_0x0f5b('0x7c')]){_0x180823=path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],'server/files/images/avatars/',_0x52a482[_0x0f5b('0x6e')]);}}return _0x40f1ab[_0x0f5b('0x77')](_0x180823);}})[_0x0f5b('0x23')](handleError(_0x40f1ab,null));};exports[_0x0f5b('0x7e')]=function(_0x4acbce,_0x40d90f){var _0x443fae=path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],_0x0f5b('0x7f'));var _0xf9bb40={'where':{'id':_0x4acbce['params']['id']},'attributes':['id',_0x0f5b('0x70')],'raw':!![]};return db['ChatWebsite'][_0x0f5b('0x54')](_0xf9bb40)[_0x0f5b('0x19')](handleEntityNotFound(_0x40d90f,null))['then'](function(_0x43c1bb){if(_0x43c1bb){if(!_[_0x0f5b('0x74')](_0x43c1bb[_0x0f5b('0x70')])){if(fs[_0x0f5b('0x7d')](path['join'](config['root'],'server/files/images/avatars/',_0x43c1bb['systemAvatar']))){_0x443fae=path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],'server/files/images/avatars/',_0x43c1bb['systemAvatar']);}}return _0x40d90f['download'](_0x443fae);}})[_0x0f5b('0x23')](handleError(_0x40d90f,null));};exports[_0x0f5b('0x80')]=function(_0x15d8f3,_0x3f4f5d){var _0x1e4ef5=require('user-agent-parser');var _0x9ba9a=new _0x1e4ef5();var _0x7f2e83=_0x9ba9a[_0x0f5b('0x81')](_0x15d8f3[_0x0f5b('0x82')]['user-agent'])['getResult']();var _0x1d5e41={'body':_0x15d8f3[_0x0f5b('0x56')],'channel':_0x0f5b('0x83')};var _0xdc477=[];var _0x37b81b=[];var _0x29c2b8={};var _0x4affb6=![];return db[_0x0f5b('0x84')][_0x0f5b('0x5c')]()[_0x0f5b('0x19')](function(_0xf5b62){if(!_0xf5b62){throw new db['Sequelize'][(_0x0f5b('0x85'))](_0x0f5b('0x86'));}_0xdc477=_[_0x0f5b('0x87')](_[_0x0f5b('0x52')](_0xf5b62),[_0x0f5b('0x88'),_0x0f5b('0x89')]);_0x37b81b=_[_0x0f5b('0x87')](_[_0x0f5b('0x52')](_0xf5b62),[_0x0f5b('0x88'),_0x0f5b('0x89'),_0x0f5b('0x8a'),_0x0f5b('0x8b')]);if(_0x15d8f3[_0x0f5b('0x56')]['id']){delete _0x15d8f3[_0x0f5b('0x56')]['id'];}if(_['isNil'](_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x8c')])){throw new db[(_0x0f5b('0x8d'))][(_0x0f5b('0x85'))](_0x0f5b('0x8e'));}if(_[_0x0f5b('0x74')](_0x15d8f3['body']['body'])||_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x56')]===''){throw new db[(_0x0f5b('0x8d'))][(_0x0f5b('0x85'))](_0x0f5b('0x8f'));}if(_['isNil'](_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x90')])){throw new db[(_0x0f5b('0x8d'))][(_0x0f5b('0x85'))](_0x0f5b('0x91')+_0x37b81b);}if(!_[_0x0f5b('0x92')](_0x37b81b,_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x90')])){throw new db[(_0x0f5b('0x8d'))]['ValidationError'](_0x0f5b('0x93')+_0x37b81b);}_0x29c2b8[_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x90')]]=_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x8c')];})[_0x0f5b('0x19')](function(){return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x15d8f3[_0x0f5b('0x50')]['id']},'include':[{'model':db[_0x0f5b('0x94')],'as':_0x0f5b('0x95'),'include':[{'model':db[_0x0f5b('0x84')],'as':_0x0f5b('0x96'),'where':_0x29c2b8,'limit':0x1,'order':[[_0x0f5b('0x89'),'DESC']]}]},{'model':db[_0x0f5b('0x97')],'as':'Applications'}]});})[_0x0f5b('0x19')](handleEntityNotFound(_0x3f4f5d,null))[_0x0f5b('0x19')](function(_0x8e4d63){if(_0x8e4d63&&_0x8e4d63[_0x0f5b('0x95')]){_0x1d5e41['account']=_0x8e4d63;_0x1d5e41[_0x0f5b('0x98')]=_0x8e4d63['Applications'];_0x1d5e41[_0x0f5b('0x99')]=_0x8e4d63[_0x0f5b('0x95')];_0x1d5e41[_0x0f5b('0x98')]=_[_0x0f5b('0x9a')](_0x1d5e41[_0x0f5b('0x98')],[_0x0f5b('0x9b')],[_0x0f5b('0x9c')]);if(_0x1d5e41['account'][_0x0f5b('0x9d')]){delete _0x1d5e41[_0x0f5b('0x9e')][_0x0f5b('0x9d')];}if(_0x1d5e41['account']['List']&&_0x1d5e41[_0x0f5b('0x9e')][_0x0f5b('0x95')][_0x0f5b('0x96')][_0x0f5b('0x40')]){return _0x1d5e41[_0x0f5b('0x9e')][_0x0f5b('0x95')][_0x0f5b('0x96')][0x0];}var _0x49c206=_[_0x0f5b('0x10')](_0x15d8f3[_0x0f5b('0x56')],{'firstName':_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x8c')],'ListId':_0x8e4d63[_0x0f5b('0x8b')]});_0x49c206[_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x90')]]=_0x15d8f3['body'][_0x0f5b('0x8c')];return db['CmContact'][_0x0f5b('0x55')](_0x49c206,{'fields':_0xdc477,'raw':!![]});}})[_0x0f5b('0x19')](handleEntityNotFound(_0x3f4f5d,null))[_0x0f5b('0x19')](function(_0x5b186e){_0x1d5e41[_0x0f5b('0x9f')]=_0x5b186e;var _0x2c842d=_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xa0')];if(_0x15d8f3[_0x0f5b('0x82')]['cf-connecting-ip']){_0x2c842d=_0x15d8f3[_0x0f5b('0x82')]['cf-connecting-ip'];}else if(_0x15d8f3[_0x0f5b('0x82')][_0x0f5b('0xa1')]){_0x2c842d=_[_0x0f5b('0xa2')](_0x15d8f3['headers']['x-forwarded-for'][_0x0f5b('0xa3')](','));}if(_0x5b186e){var _0x46afe9={'ContactId':_0x5b186e['id'],'ChatWebsiteId':_0x15d8f3[_0x0f5b('0x50')]['id'],'from':(_0x5b186e[_0x0f5b('0xa4')]||'')+'\x20'+(_0x5b186e[_0x0f5b('0xa5')]||''),'customerIp':_0x2c842d,'customerPort':_0x15d8f3['headers'][_0x0f5b('0xa6')]?_0x15d8f3[_0x0f5b('0x82')]['x-real-port']:null,'referer':_0x15d8f3['body'][_0x0f5b('0xa7')],'browserName':_0x7f2e83[_0x0f5b('0xa8')][_0x0f5b('0x33')]&&_0x7f2e83['browser']['version']?util['format']('%s\x20%s',_0x7f2e83[_0x0f5b('0xa8')]['name'],_0x7f2e83['browser'][_0x0f5b('0xa9')]):_0x0f5b('0xaa'),'browserVersion':_0x7f2e83[_0x0f5b('0xa8')][_0x0f5b('0xa9')]||'unknown','osName':util['format'](_0x0f5b('0xab'),_0x7f2e83['os'][_0x0f5b('0x33')],_0x7f2e83['os']['version']),'osVersion':_0x7f2e83['os']['version'],'deviceModel':_0x7f2e83[_0x0f5b('0xac')][_0x0f5b('0x3b')]&&_0x7f2e83[_0x0f5b('0xac')][_0x0f5b('0xad')]?util[_0x0f5b('0xae')](_0x0f5b('0xaf'),_0x7f2e83['device'][_0x0f5b('0x3b')],_0x7f2e83[_0x0f5b('0xac')][_0x0f5b('0xad')],_0x7f2e83[_0x0f5b('0xac')][_0x0f5b('0x39')]):null,'deviceVendor':_0x7f2e83[_0x0f5b('0xac')][_0x0f5b('0xad')],'deviceType':_0x7f2e83['device'][_0x0f5b('0x39')],'formData':JSON['stringify'](_0x15d8f3[_0x0f5b('0x56')])};var _0x8ea050={'ChatWebsiteId':_0x15d8f3['params']['id'],'closed':![]};if(_0x15d8f3['body']['threadId']){_0x8ea050['threadId']=_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb0')];return db[_0x0f5b('0xb1')]['find']({'where':_0x8ea050})[_0x0f5b('0x19')](function(_0x28deda){if(_0x28deda){return[_0x28deda,![]];}_0x46afe9[_0x0f5b('0xb0')]=_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb0')];_0x46afe9[_0x0f5b('0xb2')]=_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb2')];return db['ChatInteraction'][_0x0f5b('0x55')](_0x46afe9)[_0x0f5b('0x19')](function(_0x53da6e){return[_0x53da6e,!![]];});});}_0x8ea050[_0x0f5b('0xb3')]=_0x5b186e['id'];if(_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb4')]&&_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb4')]['id']){_0x8ea050['id']=_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb4')]['id'];return db['ChatInteraction'][_0x0f5b('0x54')]({'where':_0x8ea050})['then'](function(_0x1be906){if(_0x1be906){return[_0x1be906,![]];}return db[_0x0f5b('0xb1')][_0x0f5b('0x55')](_0x46afe9)['then'](function(_0x3e1205){return[_0x3e1205,!![]];});});}return db[_0x0f5b('0xb1')][_0x0f5b('0x55')](_0x46afe9)[_0x0f5b('0x19')](function(_0x1986e3){return[_0x1986e3,!![]];});}})['spread'](function(_0x2d5cac,_0x456de5){if(_0x2d5cac){_0x4affb6=_0x456de5;if(!_0x456de5){var _0x907cc4={'from':(_0x1d5e41['contact']['firstName']||'')+'\x20'+(_0x1d5e41[_0x0f5b('0x9f')][_0x0f5b('0xa5')]||'')};if(_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb0')]&&_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb5')]&&_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb0')]!=_0x15d8f3['body'][_0x0f5b('0xb5')]){_0x907cc4[_0x0f5b('0xb0')]=_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xb5')];}return _0x2d5cac[_0x0f5b('0x2e')](_0x907cc4);}else{return _0x2d5cac;}}})['then'](function(_0xf8fc2c){_0x1d5e41['interaction']=_0xf8fc2c[_0x0f5b('0x30')]({'plain':!![]});_0x1d5e41['interaction'][_0x0f5b('0xb6')]=_0x4affb6;if(_0x1d5e41[_0x0f5b('0xb4')][_0x0f5b('0xb6')]){if(_0x1d5e41[_0x0f5b('0x9e')][_0x0f5b('0xb7')]){_0x1d5e41['applications']['push']({'id':0x0,'priority':_0x1d5e41['applications'][_0x0f5b('0x40')]+0x1,'app':_0x0f5b('0xb8'),'appdata':_0x0f5b('0xb9'),'interval':_0x0f5b('0xba')});}}return db[_0x0f5b('0xbb')][_0x0f5b('0x55')]({'body':_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0x56')],'ChatWebsiteId':_0x15d8f3[_0x0f5b('0x50')]['id'],'ChatInteractionId':_0xf8fc2c['id'],'direction':'in','ContactId':_0x1d5e41['contact']['id'],'AttachmentId':_0x15d8f3[_0x0f5b('0x56')][_0x0f5b('0xbc')]});})[_0x0f5b('0x19')](function(_0x3f1e36){_0x1d5e41[_0x0f5b('0x21')]=_0x3f1e36;if(_0x1d5e41[_0x0f5b('0xb4')][_0x0f5b('0xbd')]){return db[_0x0f5b('0xbe')]['find']({'attributes':['id',_0x0f5b('0x33')],'where':{'id':_0x1d5e41[_0x0f5b('0xb4')]['UserId']}})[_0x0f5b('0x19')](function(_0x358579){if(_0x358579){_0x1d5e41['applications'][_0x0f5b('0xbf')]({'id':0x0,'priority':0x0,'app':_0x0f5b('0xc0'),'appdata':_0x358579[_0x0f5b('0x33')]+','+(_0x1d5e41[_0x0f5b('0x9e')][_0x0f5b('0xc1')]||0xa),'interval':_0x0f5b('0xba')});_0x1d5e41[_0x0f5b('0xc2')]=!![];}return respondWithRpcPromise(_0x0f5b('0xc3'),_0x0f5b('0xc4'),_0x1d5e41);});}return respondWithRpcPromise(_0x0f5b('0xc3'),_0x0f5b('0xc4'),_0x1d5e41);})['then'](function(_0x206b73){respondWithRpcPromise('EventManager',_0x0f5b('0xc5'),{'event':_0x0f5b('0x80'),'message':_0x206b73},client9002);return _0x206b73;})[_0x0f5b('0x19')](respondWithResult(_0x3f4f5d,null))[_0x0f5b('0x23')](handleError(_0x3f4f5d,null));};exports['offline']=function(_0x3fc6e3,_0x42ab2b){var _0x78bfc2,_0x55cb30,_0x54f466;var _0x4b5a0a=[];var _0x39f8ee={};var _0x2c55c1=_0x3fc6e3[_0x0f5b('0xc6')]||[];var _0x45d76b=[];var _0x55659c;return db[_0x0f5b('0x84')][_0x0f5b('0x5c')]()[_0x0f5b('0x19')](function(_0x20a2b8){if(!_0x20a2b8){throw new db['Sequelize'][(_0x0f5b('0x85'))]('no\x20available\x20attributes');}_0x4b5a0a=_['difference'](_[_0x0f5b('0x52')](_0x20a2b8),['createdAt','updatedAt',_0x0f5b('0x8a'),'ListId']);if(_0x3fc6e3[_0x0f5b('0x56')]['id']){delete _0x3fc6e3[_0x0f5b('0x56')]['id'];}if(_['isNil'](_0x3fc6e3[_0x0f5b('0x56')]['from'])){throw _0x42ab2b[_0x0f5b('0x25')](0x1f4)[_0x0f5b('0xc7')](new db[(_0x0f5b('0x8d'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x0f5b('0x74')](_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0x56')])||_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0x56')]===''){throw _0x42ab2b['status'](0x1f4)[_0x0f5b('0xc7')](new db['Sequelize'][(_0x0f5b('0x85'))](_0x0f5b('0x8f')));}if(_[_0x0f5b('0x74')](_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0xc8')])){throw _0x42ab2b['status'](0x1f4)[_0x0f5b('0xc7')](new db[(_0x0f5b('0x8d'))]['ValidationError'](_0x0f5b('0xc9')+_0x4b5a0a));}if(!_[_0x0f5b('0x92')](_0x4b5a0a,_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0xc8')])){throw _0x42ab2b[_0x0f5b('0x25')](0x1f4)[_0x0f5b('0xc7')](new db[(_0x0f5b('0x8d'))][(_0x0f5b('0x85'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b5a0a));}_0x39f8ee[_0x3fc6e3[_0x0f5b('0x56')]['mapKeyOffline']]=_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0x8c')];})['then'](function(){return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x3fc6e3[_0x0f5b('0x50')]['id']},'include':[{'model':db[_0x0f5b('0x94')],'as':_0x0f5b('0x95')},{'model':db['MailAccount'],'as':_0x0f5b('0xca')}]});})[_0x0f5b('0x19')](handleEntityNotFound(_0x42ab2b,null))[_0x0f5b('0x19')](function(_0x2d63cd){if(_0x2d63cd&&_0x2d63cd[_0x0f5b('0x95')]){_0x55cb30=_0x2d63cd;var _0x1e2d67=_['defaults'](_0x3fc6e3['body'],{'firstName':_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0x8c')],'phone':_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0x8c')],'ListId':_0x2d63cd[_0x0f5b('0x8b')]});_0x1e2d67[_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0xc8')]]=_0x3fc6e3[_0x0f5b('0x56')]['from'];return db[_0x0f5b('0x84')][_0x0f5b('0xcb')]({'where':_0x39f8ee,'defaults':_0x1e2d67});}})[_0x0f5b('0xcc')](function(_0x5f42f7){if(_0x5f42f7){_0x54f466=_0x5f42f7;var _0x2782d5=fs[_0x0f5b('0xcd')](path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],'server/files/templates/chatOfflineMessage.ejs'),_0x0f5b('0xce'));var _0x19d4dc=ejs[_0x0f5b('0xcf')](_0x2782d5,{'body':_[_0x0f5b('0xd0')](_0x3fc6e3[_0x0f5b('0x56')][_0x0f5b('0x56')]),'bodyTitle':_0x55cb30[_0x0f5b('0xd1')]});return db[_0x0f5b('0xd2')][_0x0f5b('0x55')]({'body':_0x19d4dc,'plainBody':htmlToText[_0x0f5b('0xd3')](_0x19d4dc),'ContactId':_0x5f42f7['id'],'ChatWebsiteId':_0x55cb30['id']});}})[_0x0f5b('0x19')](function(_0x5ad446){_0x55659c=_0x5ad446;if(_0x2c55c1['length']){var _0x2ab0bd=_0x2c55c1[_0x0f5b('0x49')](function(_0x56a8f2){return{'name':_0x56a8f2[_0x0f5b('0xd4')],'basename':_0x56a8f2[_0x0f5b('0x6a')],'type':_0x56a8f2[_0x0f5b('0xd5')],'ChatOfflineMessageId':_0x5ad446['id']};});_0x45d76b=_0x2ab0bd[_0x0f5b('0x49')](_0x325a0f=>{var _0x1a420b={'filename':_0x325a0f['name'],'path':path['join'](config[_0x0f5b('0x72')],_0x0f5b('0xd6'),'files','attachments',_0x0f5b('0xd7'),_0x325a0f['basename'])};return _0x1a420b;});if(!_0x55cb30[_0x0f5b('0xd8')]){return db[_0x0f5b('0xd9')][_0x0f5b('0xda')](function(_0x2a9dbb){return db[_0x0f5b('0xdb')][_0x0f5b('0xdc')](_0x2ab0bd,{'transaction':_0x2a9dbb});});}}})[_0x0f5b('0x19')](function(){if(_0x55659c){_0x78bfc2=_0x55659c;return db['MailAccount'][_0x0f5b('0x66')]({'where':{'service':!![]},'include':[{'model':db[_0x0f5b('0xdd')],'as':_0x0f5b('0xde'),'raw':!![],'include':[{'model':db[_0x0f5b('0xdf')],'as':_0x0f5b('0xdf'),'raw':!![]}]}]});}})[_0x0f5b('0x19')](function(_0x208bbe){if(_0x208bbe&&_0x208bbe[_0x0f5b('0xde')]&&_0x55cb30[_0x0f5b('0xe0')]&&_0x55cb30[_0x0f5b('0xe1')]){var _0x5a5830=_0x208bbe['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x0f5b('0xe2'),{'account':_0x5a5830,'message':{'from':util[_0x0f5b('0xae')](_0x0f5b('0xe3'),_0x208bbe[_0x0f5b('0x33')],_0x208bbe[_0x0f5b('0xe4')]||_0x208bbe['Smtp'][_0x0f5b('0x57')]),'to':_0x55cb30[_0x0f5b('0xe1')],'subject':_0x55cb30[_0x0f5b('0xe5')],'html':_0x78bfc2[_0x0f5b('0x56')],'attachments':_0x45d76b}},client9003)[_0x0f5b('0x19')](function(){return _0x78bfc2;})[_0x0f5b('0x23')](function(_0x1cff2d){logger[_0x0f5b('0x1e')](_0x1cff2d);});}})['then'](function(){if(_0x55cb30&&_0x55cb30[_0x0f5b('0xd8')]&&_0x55cb30[_0x0f5b('0xe6')]){var _0x51204f=[];if(_0x2c55c1['length']){_0x51204f=_0x2c55c1[_0x0f5b('0x49')](function(_0x21debe){return{'name':_0x21debe[_0x0f5b('0xd4')],'basename':_0x21debe['filename'],'type':_0x21debe[_0x0f5b('0xd5')],'ChatOfflineMessageId':_0x55659c['id']};});}var _0x153e60;if(!_[_0x0f5b('0x74')](_0x55cb30['subjectOffline'])){var _0x4161ea=_['map'](_0x3fc6e3[_0x0f5b('0x56')],function(_0x50ec01){return _0x50ec01;});var _0x5d232a=_['toPairsIn'](_0x4161ea)[0x0];var _0x2867d8=_[_0x0f5b('0xe7')](_0x5d232a,function(_0x1dca9d){return _0x1dca9d;});_0x153e60=_0x2867d8[0x1][_0x55cb30['subjectOffline']];}var _0x3c39ba={'from':_0x54f466[_0x0f5b('0xe4')],'firstName':_0x54f466[_0x0f5b('0xa4')],'lastName':_0x54f466['lastName'],'mapKey':_0x0f5b('0xe4'),'message':{'from':_0x54f466[_0x0f5b('0xe4')],'to':_0x55cb30[_0x0f5b('0xca')][_0x0f5b('0xe4')],'cc':'','subject':_['isNil'](_0x153e60)?_0x55cb30[_0x0f5b('0xe5')]:_0x153e60,'messageId':'','sentAt':new Date(),'attach':_0x51204f['length'],'attachments':_0x51204f,'originChannel':_0x0f5b('0xe8'),'ChatWebsiteId':_0x55cb30['id'],'ChatOfflineMessageId':_0x78bfc2['id'],'originTo':_0x55cb30[_0x0f5b('0xca')][_0x0f5b('0xe4')]},'body':_0x78bfc2[_0x0f5b('0x56')]};var _0x179ab2={'account':{'id':_0x55cb30[_0x0f5b('0xe6')]},'body':_0x3c39ba,'log':_0x0f5b('0xe9')};return respondWithRpcPromise(_0x0f5b('0xe9'),_0x0f5b('0xea'),_0x179ab2,client9001)[_0x0f5b('0x19')](function(){return _0x78bfc2;})[_0x0f5b('0x23')](function(_0x10e4c5){logger['error'](_0x10e4c5);});}return;})[_0x0f5b('0x19')](function(){if(_0x78bfc2){return _0x78bfc2;}})[_0x0f5b('0x19')](respondWithResult(_0x42ab2b,null))[_0x0f5b('0x23')](function(_0x4017c3){logger['error'](_0x0f5b('0x23'),_0x4017c3);for(var _0x2dd493 of _0x2c55c1){var _0x5df8ff=path[_0x0f5b('0x76')](config[_0x0f5b('0x72')],_0x0f5b('0xd6'),_0x0f5b('0xc6'),_0x0f5b('0xeb'),_0x0f5b('0xd7'),_0x2dd493['filename']);fs_extra[_0x0f5b('0xec')](_0x5df8ff)[_0x0f5b('0x23')](function(_0x72a065){logger[_0x0f5b('0x1e')](_0x0f5b('0xed'),_0x5df8ff,_0x72a065);});}});};exports[_0x0f5b('0xee')]=function(_0x1e6c7e,_0x4f57e4){return db[_0x0f5b('0xb1')][_0x0f5b('0x54')]({'where':{'id':_0x1e6c7e[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x4f57e4,null))[_0x0f5b('0x19')](function(_0x3a7365){if(_0x3a7365){return _0x3a7365[_0x0f5b('0xee')](_0x1e6c7e[_0x0f5b('0x56')][_0x0f5b('0x62')],_[_0x0f5b('0xef')](_0x1e6c7e[_0x0f5b('0x56')],[_0x0f5b('0x62'),'id'])||{});}})['then'](respondWithResult(_0x4f57e4,null))['catch'](handleError(_0x4f57e4,null));};exports['getInteractions']=function(_0x2e22a1,_0x56ff52){var _0x5b728a={'raw':![],'where':{}};var _0x155553={};var _0x216a32={'count':0x0,'rows':[]};return db[_0x0f5b('0x36')][_0x0f5b('0x66')]({'where':{'id':_0x2e22a1[_0x0f5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x56ff52,null))[_0x0f5b('0x19')](function(_0x240316){if(_0x240316){_0x155553['model']=_[_0x0f5b('0x52')](db[_0x0f5b('0xb1')][_0x0f5b('0x37')]);_0x155553[_0x0f5b('0x3c')]=_[_0x0f5b('0x52')](_0x2e22a1[_0x0f5b('0x3c')]);_0x155553[_0x0f5b('0x3d')]=_[_0x0f5b('0x53')](_0x155553['model'],_0x155553['query']);_0x5b728a[_0x0f5b('0x3e')]=_[_0x0f5b('0x53')](_0x155553[_0x0f5b('0x3b')],qs[_0x0f5b('0x3f')](_0x2e22a1[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x5b728a[_0x0f5b('0x3e')]=_0x5b728a['attributes']['length']?_0x5b728a[_0x0f5b('0x3e')]:_0x155553['model'];if(!_0x2e22a1[_0x0f5b('0x3c')][_0x0f5b('0x41')]('nolimit')){_0x5b728a['limit']=qs['limit'](_0x2e22a1[_0x0f5b('0x3c')][_0x0f5b('0x29')]);_0x5b728a['offset']=qs['offset'](_0x2e22a1['query'][_0x0f5b('0x2b')]);}_0x5b728a[_0x0f5b('0x43')]=qs['sort'](_0x2e22a1[_0x0f5b('0x3c')]['sort']);_0x5b728a[_0x0f5b('0x45')]=qs[_0x0f5b('0x3d')](_[_0x0f5b('0x46')](_0x2e22a1[_0x0f5b('0x3c')],_0x155553[_0x0f5b('0x3d')]));_0x5b728a[_0x0f5b('0x45')][_0x0f5b('0x5e')]=_0x240316['id'];if(_0x2e22a1[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x5b728a[_0x0f5b('0x45')]=_['merge'](_0x5b728a[_0x0f5b('0x45')],{'$or':_['map'](_0x5b728a['attributes'],function(_0x32a58b){var _0x514ef4={};_0x514ef4[_0x32a58b]={'$like':'%'+_0x2e22a1[_0x0f5b('0x3c')]['filter']+'%'};return _0x514ef4;})});}_0x5b728a=_[_0x0f5b('0x48')]({},_0x5b728a,_0x2e22a1['options']);return db['ChatInteraction'][_0x0f5b('0x2a')]({'where':_0x5b728a['where']})[_0x0f5b('0x19')](function(_0x553b46){_0x216a32[_0x0f5b('0x2a')]=_0x553b46;if(_0x2e22a1[_0x0f5b('0x3c')][_0x0f5b('0x4b')]){_0x5b728a[_0x0f5b('0x4c')]=[{'model':db[_0x0f5b('0x84')],'as':_0x0f5b('0xf0'),'required':![]},{'model':db['User'],'as':_0x0f5b('0xf1'),'attributes':[_0x0f5b('0x33'),_0x0f5b('0xf2'),_0x0f5b('0xf3')],'required':![]},{'model':db[_0x0f5b('0xf4')],'as':'Tags','attributes':['id','name',_0x0f5b('0xf5')],'where':_0x2e22a1[_0x0f5b('0x3c')][_0x0f5b('0xf6')]?{'id':_0x2e22a1[_0x0f5b('0x3c')]['tag']}:undefined,'required':_0x2e22a1[_0x0f5b('0x3c')]['tag']?!![]:![]}];}return db[_0x0f5b('0xb1')]['findAll'](_0x5b728a);})[_0x0f5b('0x19')](function(_0x1e6f95){_0x216a32[_0x0f5b('0x4e')]=_0x1e6f95;return _0x216a32;});}})[_0x0f5b('0x19')](respondWithFilteredResult(_0x56ff52,_0x5b728a))['catch'](handleError(_0x56ff52,null));};function iftimePromise(_0x394333,_0xfc6875){return respondWithRpcPromise(_0x0f5b('0xf7'),'getSnippet',{'command':_0xfc6875[_0x0f5b('0xf8')]?util[_0x0f5b('0xae')](_0x0f5b('0xf9'),_0x394333['interval'],_0xfc6875[_0x0f5b('0xf8')]):util[_0x0f5b('0xae')](_0x0f5b('0xfa'),_0x394333[_0x0f5b('0xfb')])},client9002)[_0x0f5b('0x19')](function(_0x2e6d86){var _0x3a220e=_0x2e6d86&&_0x2e6d86[_0x0f5b('0xfc')](_0x0f5b('0xfd'))>=0x0?!![]:![];logger[_0x0f5b('0x1a')](_0x0f5b('0xfe'),_0xfc6875['id'],_0x394333['id'],_0x394333[_0x0f5b('0xfb')],_0x3a220e?_0x0f5b('0xff'):_0x0f5b('0x100'),_0xfc6875['timezone']?_0xfc6875[_0x0f5b('0xf8')]:_0x0f5b('0x101'));return _0x3a220e;})[_0x0f5b('0x23')](function(_0x3e0d18){logger['error'](_0x0f5b('0xfe'),_0xfc6875['id'],_0x394333['id'],_0x394333[_0x0f5b('0xfb')],util[_0x0f5b('0x102')](_0x3e0d18,{'showHidden':![],'depth':null}),_0xfc6875['timezone']?_0xfc6875[_0x0f5b('0xf8')]:_0x0f5b('0x101'));return![];});}exports['getSnippet']=function(_0x5a20bb,_0x104178){var _0x52cafa=0x0;var _0x4df76e=0x0;var _0x18ac4a=![];var _0x127c63;var _0x43fee1;return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x5a20bb['params']['id']},'include':[{'model':db['Interval'],'as':_0x0f5b('0x103'),'include':[{'model':db[_0x0f5b('0x103')],'as':_0x0f5b('0x104'),'attributes':['id',_0x0f5b('0xfb')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x104178,null))[_0x0f5b('0x19')](function(_0x57736c){if(_0x57736c){_0x127c63=_0x57736c;return _0x57736c[_0x0f5b('0x105')]({'raw':!![]});}})[_0x0f5b('0x19')](function(_0x48bc12){if(_0x127c63){if(_0x48bc12){_0x43fee1=_0x48bc12;}}return require('../../config/license/util')[_0x0f5b('0x73')]();})[_0x0f5b('0x19')](function(_0x3f9dd6){if(_0x3f9dd6){_0x4df76e=_0x3f9dd6['virtual'];_0x18ac4a=_0x3f9dd6['custom'];}})[_0x0f5b('0x19')](function(){return db[_0x0f5b('0xb1')][_0x0f5b('0x2a')]({'where':{'closed':![]}});})[_0x0f5b('0x19')](function(_0x528d45){_0x52cafa=_0x528d45;if(_0x4df76e&&_0x528d45>_0x4df76e){return db[_0x0f5b('0x106')][_0x0f5b('0x66')]({'where':{'id':0x1}})[_0x0f5b('0x19')](function(_0x5c7106){if(_0x5c7106){_0x5c7106[_0x0f5b('0x107')](_0x0f5b('0x108'));}});}})[_0x0f5b('0x19')](function(){if(_0x127c63['Interval']&&_0x127c63['Interval'][_0x0f5b('0x104')]){var _0x589623=[];for(var _0x1387f9=0x0;_0x1387f9<_0x127c63['Interval'][_0x0f5b('0x104')][_0x0f5b('0x40')];_0x1387f9++){var _0x51a329=_0x127c63['Interval']['Intervals'][_0x1387f9][_0x0f5b('0x30')]({'plain':!![]});_0x589623[_0x0f5b('0x109')](iftimePromise(_0x51a329,_0x127c63));}return BPromise[_0x0f5b('0x10a')](_0x589623)['then'](function(_0x244fc3){return _[_0x0f5b('0x10b')](_0x244fc3);});}else{return!![];}})[_0x0f5b('0x19')](function(_0x7d462c){var _0x8e938a=fs[_0x0f5b('0xcd')](path['join'](config[_0x0f5b('0x72')],_0x0f5b('0x10c')),_0x0f5b('0xce'));var _0x219a72=new url['URL'](_0x127c63[_0x0f5b('0x10d')])[_0x0f5b('0x10e')];var _0x488fa1=_0x0f5b('0x10f');var _0x498007=![];var _0x2f002c={'chatVersion':_0x488fa1,'chatWebsiteAddressOrigin':_0x219a72,'remote':_0x127c63[_0x0f5b('0x110')],'query':querystring[_0x0f5b('0x111')](_[_0x0f5b('0x48')](_0x127c63[_0x0f5b('0x30')]({'plain':!![]}),{'customerIp':_0x5a20bb[_0x0f5b('0x82')][_0x0f5b('0xa1')]||_0x5a20bb[_0x0f5b('0x82')][_0x0f5b('0x112')]||_0x5a20bb[_0x0f5b('0x113')]['remoteAddress']||_0x5a20bb['ip'],'referer':_0x5a20bb[_0x0f5b('0x82')][_0x0f5b('0xa7')],'openedInteractions':_0x52cafa,'maxInteractions':_0x4df76e,'virtual':_0x18ac4a[_0x0f5b('0x114')],'online':_0x7d462c,'custom':_0x18ac4a}))[_0x0f5b('0x115')](/'/g,'\x5c\x27')};_0x104178['send'](ejs[_0x0f5b('0xcf')](Mustache[_0x0f5b('0xcf')](_0x8e938a,_0x2f002c),{'proactiveActions':_0x43fee1,'alignment':_0x127c63['alignment'],'verticalAlignment':_0x127c63['verticalAlignment'],'div_color':_0x127c63[_0x0f5b('0xf5')],'labelText':_0x127c63[_0x0f5b('0x116')],'text_color':_0x127c63[_0x0f5b('0x117')],'text_button_color':_0x127c63[_0x0f5b('0x118')],'button_color':_0x127c63[_0x0f5b('0x119')],'background_color':_0x127c63[_0x0f5b('0x11a')],'hideWhenOffline':_0x127c63['hideWhenOffline'],'intervalId':_0x127c63[_0x0f5b('0x11b')],'isDevelopment':_0x498007,'chatVersion':_0x488fa1}));})[_0x0f5b('0x23')](handleError(_0x104178,null));};exports[_0x0f5b('0x11c')]=function(_0x5561ec,_0x801eab){var _0x3dad79=_0x5561ec['params']['id'];var _0x1f16b2=_0x5561ec[_0x0f5b('0x56')];var _0x17f9e2=0xc8;var _0x42a0d4=null;return db[_0x0f5b('0xd9')][_0x0f5b('0xda')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x0f5b('0x11d')]},function(_0x4c8c57){return db['ChatWebsite'][_0x0f5b('0x66')]({'where':{'id':_0x3dad79},'transaction':_0x4c8c57})['then'](function(_0x4726f3){if(_0x4726f3){return db[_0x0f5b('0x97')][_0x0f5b('0x2f')]({'where':{'ChatWebsiteId':_0x3dad79},'transaction':_0x4c8c57})['then'](function(){var _0x1acdd5=_[_0x0f5b('0x49')](_0x1f16b2,function(_0x2736d8){_0x2736d8[_0x0f5b('0x5e')]=_0x3dad79;return _0x2736d8;});return db[_0x0f5b('0x97')][_0x0f5b('0xdc')](_0x1acdd5,{'transaction':_0x4c8c57});});}else{_0x17f9e2=0x194;_0x42a0d4=[];}});})[_0x0f5b('0x19')](function(){if(_0x17f9e2!==0x194){return db[_0x0f5b('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3dad79},'order':_0x0f5b('0x9b')})['then'](function(_0x3cb98a){_0x42a0d4=_0x3cb98a;});}})[_0x0f5b('0x23')](function(_0x580d0d){_0x17f9e2=0x1f4;logger[_0x0f5b('0x1e')](_0x580d0d[_0x0f5b('0x32')]);if(_0x580d0d[_0x0f5b('0x33')]){delete _0x580d0d[_0x0f5b('0x33')];}_0x42a0d4=_0x580d0d;})['finally'](function(){if(_0x42a0d4===null){_0x801eab[_0x0f5b('0x24')](_0x17f9e2);}else{if(_0x17f9e2===0x1f4){_0x801eab[_0x0f5b('0x25')](_0x17f9e2)[_0x0f5b('0xc7')](_0x42a0d4);}else{_0x801eab['status'](_0x17f9e2)[_0x0f5b('0x27')](_0x42a0d4);}}});};exports['getApplications']=function(_0x6ab2e5,_0x2702ed){var _0x478848={};var _0x41aaf5={};var _0x7e8c6;var _0x4a6720;return db['ChatWebsite']['findOne']({'where':{'id':_0x6ab2e5['params']['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x2702ed,null))['then'](function(_0x3cfcd2){if(_0x3cfcd2){_0x7e8c6=_0x3cfcd2;_0x41aaf5[_0x0f5b('0x3b')]=_[_0x0f5b('0x52')](db[_0x0f5b('0x97')][_0x0f5b('0x37')]);_0x41aaf5[_0x0f5b('0x3c')]=_[_0x0f5b('0x52')](_0x6ab2e5[_0x0f5b('0x3c')]);_0x41aaf5[_0x0f5b('0x3d')]=_['intersection'](_0x41aaf5[_0x0f5b('0x3b')],_0x41aaf5[_0x0f5b('0x3c')]);_0x478848[_0x0f5b('0x3e')]=_['intersection'](_0x41aaf5[_0x0f5b('0x3b')],qs[_0x0f5b('0x3f')](_0x6ab2e5[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x478848[_0x0f5b('0x3e')]=_0x478848['attributes']['length']?_0x478848['attributes']:_0x41aaf5[_0x0f5b('0x3b')];_0x478848[_0x0f5b('0x43')]=qs[_0x0f5b('0x44')](_0x6ab2e5['query'][_0x0f5b('0x44')]);_0x478848[_0x0f5b('0x45')]=qs['filters'](_[_0x0f5b('0x46')](_0x6ab2e5[_0x0f5b('0x3c')],_0x41aaf5[_0x0f5b('0x3d')]));if(_0x6ab2e5[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x478848[_0x0f5b('0x45')]=_[_0x0f5b('0x48')](_0x478848[_0x0f5b('0x45')],{'$or':_[_0x0f5b('0x49')](_0x478848['attributes'],function(_0x4b5292){var _0x4c2cde={};_0x4c2cde[_0x4b5292]={'$like':'%'+_0x6ab2e5['query'][_0x0f5b('0x47')]+'%'};return _0x4c2cde;})});}_0x478848=_[_0x0f5b('0x48')]({},_0x478848,_0x6ab2e5[_0x0f5b('0x4a')]);return _0x7e8c6['getApplications'](_0x478848);}})[_0x0f5b('0x19')](function(_0x22d1bf){if(_0x22d1bf){_0x4a6720=_0x22d1bf[_0x0f5b('0x40')];if(!_0x6ab2e5[_0x0f5b('0x3c')][_0x0f5b('0x41')](_0x0f5b('0x42'))){_0x478848['limit']=qs['limit'](_0x6ab2e5[_0x0f5b('0x3c')][_0x0f5b('0x29')]);_0x478848[_0x0f5b('0x2b')]=qs[_0x0f5b('0x2b')](_0x6ab2e5[_0x0f5b('0x3c')][_0x0f5b('0x2b')]);}return _0x7e8c6[_0x0f5b('0x11e')](_0x478848);}})[_0x0f5b('0x19')](function(_0x3a2d22){if(_0x3a2d22){return _0x3a2d22?{'count':_0x4a6720,'rows':_0x3a2d22}:null;}})[_0x0f5b('0x19')](respondWithResult(_0x2702ed,null))['catch'](handleError(_0x2702ed,null));};exports[_0x0f5b('0x11f')]=function(_0x25116c,_0x14bb99){return db[_0x0f5b('0x120')][_0x0f5b('0x54')]({'where':{'id':_0x25116c[_0x0f5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x14bb99,null))[_0x0f5b('0x19')](function(_0x3d823a){if(_0x3d823a){return _0x3d823a[_0x0f5b('0x11f')](_0x25116c[_0x0f5b('0x56')][_0x0f5b('0x62')],_['omit'](_0x25116c[_0x0f5b('0x56')],[_0x0f5b('0x62'),'id'])||{});}})[_0x0f5b('0x19')](respondWithResult(_0x14bb99,null))[_0x0f5b('0x23')](handleError(_0x14bb99,null));};exports[_0x0f5b('0x105')]=function(_0x3ee514,_0xef79fe){var _0x555e7d={};var _0x401fec={};var _0x1835bc;var _0x44d856;return db[_0x0f5b('0x36')]['findOne']({'where':{'id':_0x3ee514[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0xef79fe,null))['then'](function(_0xc19716){if(_0xc19716){_0x1835bc=_0xc19716;_0x401fec[_0x0f5b('0x3b')]=_[_0x0f5b('0x52')](db[_0x0f5b('0x121')][_0x0f5b('0x37')]);_0x401fec[_0x0f5b('0x3c')]=_['keys'](_0x3ee514[_0x0f5b('0x3c')]);_0x401fec[_0x0f5b('0x3d')]=_[_0x0f5b('0x53')](_0x401fec[_0x0f5b('0x3b')],_0x401fec[_0x0f5b('0x3c')]);_0x555e7d[_0x0f5b('0x3e')]=_[_0x0f5b('0x53')](_0x401fec[_0x0f5b('0x3b')],qs[_0x0f5b('0x3f')](_0x3ee514[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x555e7d[_0x0f5b('0x3e')]=_0x555e7d[_0x0f5b('0x3e')][_0x0f5b('0x40')]?_0x555e7d[_0x0f5b('0x3e')]:_0x401fec[_0x0f5b('0x3b')];_0x555e7d[_0x0f5b('0x43')]=qs[_0x0f5b('0x44')](_0x3ee514['query'][_0x0f5b('0x44')]);_0x555e7d[_0x0f5b('0x45')]=qs[_0x0f5b('0x3d')](_[_0x0f5b('0x46')](_0x3ee514[_0x0f5b('0x3c')],_0x401fec[_0x0f5b('0x3d')]));if(_0x3ee514[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x555e7d[_0x0f5b('0x45')]=_[_0x0f5b('0x48')](_0x555e7d[_0x0f5b('0x45')],{'$or':_[_0x0f5b('0x49')](_0x555e7d[_0x0f5b('0x3e')],function(_0x102b29){var _0x2555f7={};_0x2555f7[_0x102b29]={'$like':'%'+_0x3ee514[_0x0f5b('0x3c')][_0x0f5b('0x47')]+'%'};return _0x2555f7;})});}_0x555e7d=_[_0x0f5b('0x48')]({},_0x555e7d,_0x3ee514[_0x0f5b('0x4a')]);return _0x1835bc[_0x0f5b('0x105')](_0x555e7d);}})['then'](function(_0x196bf3){if(_0x196bf3){_0x44d856=_0x196bf3[_0x0f5b('0x40')];if(!_0x3ee514[_0x0f5b('0x3c')][_0x0f5b('0x41')](_0x0f5b('0x42'))){_0x555e7d[_0x0f5b('0x29')]=qs[_0x0f5b('0x29')](_0x3ee514[_0x0f5b('0x3c')][_0x0f5b('0x29')]);_0x555e7d[_0x0f5b('0x2b')]=qs[_0x0f5b('0x2b')](_0x3ee514[_0x0f5b('0x3c')][_0x0f5b('0x2b')]);}return _0x1835bc[_0x0f5b('0x105')](_0x555e7d);}})['then'](function(_0x37b190){if(_0x37b190){return _0x37b190?{'count':_0x44d856,'rows':_0x37b190}:null;}})[_0x0f5b('0x19')](respondWithResult(_0xef79fe,null))['catch'](handleError(_0xef79fe,null));};exports[_0x0f5b('0x122')]=function(_0xf262e5,_0x3335e7){var _0x2e9240=_0xf262e5['query'][_0x0f5b('0x123')]==='false'?_0x0f5b('0x124'):'onlineForm';return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'attributes':['id',_0x2e9240],'where':{'id':_0xf262e5[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x3335e7,null))[_0x0f5b('0x19')](function(_0x1f21b0){if(_0x1f21b0){var _0x436936=_0x1f21b0[_0x2e9240];var _0x43fb71=_0x436936&&_0x436936[_0x0f5b('0x125')]?_0x436936['items']:[];_0x3335e7['send']({'fromKey':_[_0x0f5b('0x74')](_0x436936['fromKey'])?undefined:_0x436936[_0x0f5b('0x126')],'count':_0x43fb71[_0x0f5b('0x40')],'rows':_0x43fb71});}})[_0x0f5b('0x23')](handleError(_0x3335e7,null));};exports['getOfflineMessages']=function(_0x51301a,_0x31e7e7){var _0x5214fb={'raw':![],'where':{}};var _0x377e19={};var _0xca9c46={'count':0x0,'rows':[]};return db[_0x0f5b('0x36')]['findOne']({'where':{'id':_0x51301a[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x31e7e7,null))['then'](function(_0x19fb1f){if(_0x19fb1f){_0x377e19[_0x0f5b('0x3b')]=_[_0x0f5b('0x52')](db['ChatOfflineMessage'][_0x0f5b('0x37')]);_0x377e19[_0x0f5b('0x3c')]=_[_0x0f5b('0x52')](_0x51301a[_0x0f5b('0x3c')]);_0x377e19[_0x0f5b('0x3d')]=_[_0x0f5b('0x53')](_0x377e19['model'],_0x377e19['query']);_0x5214fb[_0x0f5b('0x3e')]=_['intersection'](_0x377e19['model'],qs[_0x0f5b('0x3f')](_0x51301a[_0x0f5b('0x3c')][_0x0f5b('0x3f')]));_0x5214fb['attributes']=_0x5214fb[_0x0f5b('0x3e')][_0x0f5b('0x40')]?_0x5214fb[_0x0f5b('0x3e')]:_0x377e19[_0x0f5b('0x3b')];if(!_0x51301a[_0x0f5b('0x3c')][_0x0f5b('0x41')]('nolimit')){_0x5214fb[_0x0f5b('0x29')]=qs[_0x0f5b('0x29')](_0x51301a[_0x0f5b('0x3c')]['limit']);_0x5214fb[_0x0f5b('0x2b')]=qs[_0x0f5b('0x2b')](_0x51301a[_0x0f5b('0x3c')][_0x0f5b('0x2b')]);}_0x5214fb['order']=qs[_0x0f5b('0x44')](_0x51301a['query'][_0x0f5b('0x44')]);_0x5214fb[_0x0f5b('0x45')]=qs[_0x0f5b('0x3d')](_[_0x0f5b('0x46')](_0x51301a[_0x0f5b('0x3c')],_0x377e19[_0x0f5b('0x3d')]));_0x5214fb['where']['ChatWebsiteId']=_0x19fb1f['id'];if(_0x51301a[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x5214fb[_0x0f5b('0x45')]=_['merge'](_0x5214fb[_0x0f5b('0x45')],{'$or':_['map'](_0x5214fb[_0x0f5b('0x3e')],function(_0x1cc1df){var _0x33b63f={};_0x33b63f[_0x1cc1df]={'$like':'%'+_0x51301a[_0x0f5b('0x3c')][_0x0f5b('0x47')]+'%'};return _0x33b63f;})});}_0x5214fb=_['merge']({},_0x5214fb,_0x51301a[_0x0f5b('0x4a')]);return db[_0x0f5b('0xd2')][_0x0f5b('0x2a')]({'where':_0x5214fb['where']})[_0x0f5b('0x19')](function(_0x4724dd){_0xca9c46['count']=_0x4724dd;if(_0x51301a['query']['includeAll']){_0x5214fb['include']=[{'all':!![]}];}else{_0x5214fb[_0x0f5b('0x4c')]=[{'model':db['CmContact'],'as':_0x0f5b('0xf0'),'required':![]},{'model':db[_0x0f5b('0xdb')],'as':_0x0f5b('0x127'),'required':![]}];}return db[_0x0f5b('0xd2')][_0x0f5b('0x4d')](_0x5214fb);})[_0x0f5b('0x19')](function(_0x3a1b0a){_0xca9c46[_0x0f5b('0x4e')]=_0x3a1b0a;return _0xca9c46;});}})[_0x0f5b('0x19')](respondWithFilteredResult(_0x31e7e7,_0x5214fb))[_0x0f5b('0x23')](handleError(_0x31e7e7,null));};exports[_0x0f5b('0x128')]=function(_0x402d29,_0x27429e){return db[_0x0f5b('0x36')][_0x0f5b('0x54')]({'where':{'id':_0x402d29[_0x0f5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x27429e,null))[_0x0f5b('0x19')](function(_0x49dbb5){if(_0x49dbb5){return _0x49dbb5['addAgents'](_0x402d29['body'][_0x0f5b('0x62')],_[_0x0f5b('0xef')](_0x402d29['body'],[_0x0f5b('0x62'),'id'])||{})[_0x0f5b('0xcc')](function(_0x1706f5){for(var _0x712c6e=0x0;_0x712c6e<_0x402d29[_0x0f5b('0x56')][_0x0f5b('0x62')][_0x0f5b('0x40')];_0x712c6e+=0x1){socket[_0x0f5b('0x129')](_0x0f5b('0x12a'),{'UserId':Number(_0x402d29[_0x0f5b('0x56')]['ids'][_0x712c6e]),'ChatWebsiteId':Number(_0x402d29[_0x0f5b('0x50')]['id'])});}return _0x1706f5;});}})[_0x0f5b('0x19')](respondWithResult(_0x27429e,null))['catch'](handleError(_0x27429e,null));};exports[_0x0f5b('0x12b')]=function(_0x4c32a7,_0x2c5e87){return db['ChatWebsite'][_0x0f5b('0x54')]({'where':{'id':_0x4c32a7[_0x0f5b('0x50')]['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0x2c5e87,null))[_0x0f5b('0x19')](function(_0x51fe13){if(_0x51fe13){return _0x51fe13[_0x0f5b('0x12b')](_0x4c32a7['query'][_0x0f5b('0x62')])[_0x0f5b('0x19')](function(){if(_[_0x0f5b('0x12c')](_0x4c32a7[_0x0f5b('0x3c')][_0x0f5b('0x62')])){for(var _0x5b0335=0x0;_0x5b0335<_0x4c32a7['query'][_0x0f5b('0x62')][_0x0f5b('0x40')];_0x5b0335+=0x1){socket[_0x0f5b('0x129')](_0x0f5b('0x12d'),{'UserId':Number(_0x4c32a7[_0x0f5b('0x3c')][_0x0f5b('0x62')][_0x5b0335]),'ChatWebsiteId':Number(_0x4c32a7[_0x0f5b('0x50')]['id'])});}}else{socket[_0x0f5b('0x129')]('userChatWebsite:remove',{'UserId':Number(_0x4c32a7[_0x0f5b('0x3c')][_0x0f5b('0x62')]),'ChatWebsiteId':Number(_0x4c32a7['params']['id'])});}});}})[_0x0f5b('0x19')](respondWithStatusCode(_0x2c5e87,null))[_0x0f5b('0x23')](handleError(_0x2c5e87,null));};exports['getAgents']=function(_0x1cc2f0,_0xcb3ee1){var _0x388729={};var _0x1de426={};var _0xa19687;var _0x55e7dc;return db['ChatWebsite'][_0x0f5b('0x66')]({'where':{'id':_0x1cc2f0['params']['id']}})[_0x0f5b('0x19')](handleEntityNotFound(_0xcb3ee1,null))[_0x0f5b('0x19')](function(_0x2ad382){if(_0x2ad382){_0xa19687=_0x2ad382;_0x1de426[_0x0f5b('0x3b')]=_['keys'](db['User'][_0x0f5b('0x37')]);_0x1de426[_0x0f5b('0x3c')]=_['keys'](_0x1cc2f0[_0x0f5b('0x3c')]);_0x1de426[_0x0f5b('0x3d')]=_[_0x0f5b('0x53')](_0x1de426[_0x0f5b('0x3b')],_0x1de426[_0x0f5b('0x3c')]);_0x388729[_0x0f5b('0x3e')]=_['intersection'](_0x1de426[_0x0f5b('0x3b')],qs[_0x0f5b('0x3f')](_0x1cc2f0['query'][_0x0f5b('0x3f')]));_0x388729[_0x0f5b('0x3e')]=_0x388729[_0x0f5b('0x3e')][_0x0f5b('0x40')]?_0x388729['attributes']:_0x1de426[_0x0f5b('0x3b')];_0x388729[_0x0f5b('0x43')]=qs[_0x0f5b('0x44')](_0x1cc2f0[_0x0f5b('0x3c')][_0x0f5b('0x44')]);_0x388729['where']=qs[_0x0f5b('0x3d')](_[_0x0f5b('0x46')](_0x1cc2f0['query'],_0x1de426[_0x0f5b('0x3d')]));if(_0x1cc2f0[_0x0f5b('0x3c')][_0x0f5b('0x47')]){_0x388729[_0x0f5b('0x45')]=_['merge'](_0x388729[_0x0f5b('0x45')],{'$or':_[_0x0f5b('0x49')](_0x388729[_0x0f5b('0x3e')],function(_0x307d2a){var _0x3a9841={};_0x3a9841[_0x307d2a]={'$like':'%'+_0x1cc2f0[_0x0f5b('0x3c')]['filter']+'%'};return _0x3a9841;})});}_0x388729=_[_0x0f5b('0x48')]({},_0x388729,_0x1cc2f0[_0x0f5b('0x4a')]);return _0xa19687[_0x0f5b('0x12e')](_0x388729);}})[_0x0f5b('0x19')](function(_0x141a7f){if(_0x141a7f){_0x55e7dc=_0x141a7f['length'];if(!_0x1cc2f0['query']['hasOwnProperty'](_0x0f5b('0x42'))){_0x388729[_0x0f5b('0x29')]=qs[_0x0f5b('0x29')](_0x1cc2f0['query'][_0x0f5b('0x29')]);_0x388729[_0x0f5b('0x2b')]=qs[_0x0f5b('0x2b')](_0x1cc2f0[_0x0f5b('0x3c')][_0x0f5b('0x2b')]);}return _0xa19687[_0x0f5b('0x12e')](_0x388729);}})[_0x0f5b('0x19')](function(_0x8455da){if(_0x8455da){return _0x8455da?{'count':_0x55e7dc,'rows':_0x8455da}:null;}})[_0x0f5b('0x19')](respondWithResult(_0xcb3ee1,null))[_0x0f5b('0x23')](handleError(_0xcb3ee1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 77cfca9..5d5729f 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 _0x6631=['ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1a209f,_0x1b35e6){var _0x376b56=function(_0x5ed729){while(--_0x5ed729){_0x1a209f['push'](_0x1a209f['shift']());}};_0x376b56(++_0x1b35e6);}(_0x6631,0x134));var _0x1663=function(_0x4cf818,_0x3e74b2){_0x4cf818=_0x4cf818-0x0;var _0x414c5e=_0x6631[_0x4cf818];return _0x414c5e;};'use strict';var EventEmitter=require(_0x1663('0x0'));var ChatWebsite=require(_0x1663('0x1'))['db'][_0x1663('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1663('0x3')](0x0);var events={'afterCreate':_0x1663('0x4'),'afterUpdate':_0x1663('0x5'),'afterDestroy':'remove'};function emitEvent(_0x492d72){return function(_0x1e2fcc,_0x232bfe,_0x2b5af7){ChatWebsiteEvents[_0x1663('0x6')](_0x492d72+':'+_0x1e2fcc['id'],_0x1e2fcc);ChatWebsiteEvents[_0x1663('0x6')](_0x492d72,_0x1e2fcc);_0x2b5af7(null);};}for(var e in events){if(events[_0x1663('0x7')](e)){var event=events[e];ChatWebsite[_0x1663('0x8')](e,emitEvent(event));}}module[_0x1663('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xff3c=['../../mysqldb','setMaxListeners','save','emit','exports','events'];(function(_0x58e6b7,_0xb08f8d){var _0x1f62f9=function(_0x41a777){while(--_0x41a777){_0x58e6b7['push'](_0x58e6b7['shift']());}};_0x1f62f9(++_0xb08f8d);}(_0xff3c,0x179));var _0xcff3=function(_0x1a1f55,_0x104f1f){_0x1a1f55=_0x1a1f55-0x0;var _0xc11b2b=_0xff3c[_0x1a1f55];return _0xc11b2b;};'use strict';var EventEmitter=require(_0xcff3('0x0'));var ChatWebsite=require(_0xcff3('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcff3('0x2')](0x0);var events={'afterCreate':_0xcff3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28f6e0){return function(_0x17ae92,_0x45c7f6,_0x312858){ChatWebsiteEvents[_0xcff3('0x4')](_0x28f6e0+':'+_0x17ae92['id'],_0x17ae92);ChatWebsiteEvents[_0xcff3('0x4')](_0x28f6e0,_0x17ae92);_0x312858(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xcff3('0x5')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2f989a0..8fb892a 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 _0xbba9=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','lodash'];(function(_0x5b135a,_0x5402b2){var _0x5dd0d8=function(_0x167bed){while(--_0x167bed){_0x5b135a['push'](_0x5b135a['shift']());}};_0x5dd0d8(++_0x5402b2);}(_0xbba9,0x121));var _0x9bba=function(_0xcd20e,_0xd4e78e){_0xcd20e=_0xcd20e-0x0;var _0x8e2f3c=_0xbba9[_0xcd20e];return _0x8e2f3c;};'use strict';var _=require(_0x9bba('0x0'));var util=require('util');var logger=require(_0x9bba('0x1'))('api');var moment=require(_0x9bba('0x2'));var BPromise=require(_0x9bba('0x3'));var rp=require(_0x9bba('0x4'));var fs=require('fs');var path=require(_0x9bba('0x5'));var rimraf=require('rimraf');var config=require(_0x9bba('0x6'));var attributes=require(_0x9bba('0x7'));module[_0x9bba('0x8')]=function(_0x5a720a,_0x60688a){return _0x5a720a['define'](_0x9bba('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5853=['define','ChatWebsite','chat_websites','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0xeb5938,_0x227b17){var _0x4d48db=function(_0xb76f3a){while(--_0xb76f3a){_0xeb5938['push'](_0xeb5938['shift']());}};_0x4d48db(++_0x227b17);}(_0x5853,0xdb));var _0x3585=function(_0xce44ee,_0x387d70){_0xce44ee=_0xce44ee-0x0;var _0xf97a49=_0x5853[_0xce44ee];return _0xf97a49;};'use strict';var _=require('lodash');var util=require(_0x3585('0x0'));var logger=require(_0x3585('0x1'))(_0x3585('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3585('0x3'));var fs=require('fs');var path=require(_0x3585('0x4'));var rimraf=require(_0x3585('0x5'));var config=require(_0x3585('0x6'));var attributes=require(_0x3585('0x7'));module[_0x3585('0x8')]=function(_0x3f038d,_0x51ca20){return _0x3f038d[_0x3585('0x9')](_0x3585('0xa'),attributes,{'tableName':_0x3585('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 0391355..693c31b 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 _0x3569=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x1af362,_0x3e13a8){var _0x278343=function(_0x27148a){while(--_0x27148a){_0x1af362['push'](_0x1af362['shift']());}};_0x278343(++_0x3e13a8);}(_0x3569,0x140));var _0x9356=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x3569[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0x9356('0x0'));var util=require(_0x9356('0x1'));var moment=require(_0x9356('0x2'));var BPromise=require(_0x9356('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9356('0x4'))['db'];var utils=require(_0x9356('0x5'));var logger=require('../../config/logger')(_0x9356('0x6'));var config=require(_0x9356('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9356('0x8')][_0x9356('0x9')]({'port':0x232a});config[_0x9356('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9356('0xb'))(new Redis(config['redis']));require(_0x9356('0xc'))[_0x9356('0xd')](socket);function respondWithRpcPromise(_0x113d86,_0x32551f,_0x40ffdb){return new BPromise(function(_0x2e641a,_0x3edb6a){return client[_0x9356('0xe')](_0x113d86,_0x40ffdb)[_0x9356('0xf')](function(_0x3b7a7c){logger[_0x9356('0x10')](_0x9356('0x11'),_0x32551f,_0x9356('0x12'));logger[_0x9356('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x32551f,_0x9356('0x12'),JSON[_0x9356('0x14')](_0x3b7a7c));if(_0x3b7a7c[_0x9356('0x15')]){if(_0x3b7a7c[_0x9356('0x15')][_0x9356('0x16')]===0x1f4){logger['error'](_0x9356('0x11'),_0x32551f,_0x3b7a7c[_0x9356('0x15')][_0x9356('0x17')]);return _0x3edb6a(_0x3b7a7c[_0x9356('0x15')][_0x9356('0x17')]);}logger[_0x9356('0x15')](_0x9356('0x11'),_0x32551f,_0x3b7a7c['error'][_0x9356('0x17')]);return _0x2e641a(_0x3b7a7c[_0x9356('0x15')][_0x9356('0x17')]);}else{logger[_0x9356('0x10')](_0x9356('0x11'),_0x32551f,_0x9356('0x12'));_0x2e641a(_0x3b7a7c[_0x9356('0x18')][_0x9356('0x17')]);}})[_0x9356('0x19')](function(_0x4fd53f){logger[_0x9356('0x15')](_0x9356('0x11'),_0x32551f,_0x4fd53f);_0x3edb6a(_0x4fd53f);});});} \ No newline at end of file +var _0x609a=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x2ea05c,_0x5d3bec){var _0x28d6f3=function(_0x107893){while(--_0x107893){_0x2ea05c['push'](_0x2ea05c['shift']());}};_0x28d6f3(++_0x5d3bec);}(_0x609a,0x8e));var _0xa609=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x609a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xa609('0x0'));var moment=require(_0xa609('0x1'));var BPromise=require(_0xa609('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa609('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa609('0x4'))(_0xa609('0x5'));var config=require(_0xa609('0x6'));var jayson=require(_0xa609('0x7'));var client=jayson[_0xa609('0x8')][_0xa609('0x9')]({'port':0x232a});config['redis']=_[_0xa609('0xa')](config[_0xa609('0xb')],{'host':_0xa609('0xc'),'port':0x18eb});var socket=require(_0xa609('0xd'))(new Redis(config[_0xa609('0xb')]));require(_0xa609('0xe'))[_0xa609('0xf')](socket);function respondWithRpcPromise(_0x4c233e,_0x189301,_0x5a396f){return new BPromise(function(_0x5a8449,_0xcc9276){return client[_0xa609('0x10')](_0x4c233e,_0x5a396f)[_0xa609('0x11')](function(_0x21fc7c){logger['info'](_0xa609('0x12'),_0x189301,_0xa609('0x13'));logger[_0xa609('0x14')](_0xa609('0x15'),_0x189301,'request\x20sent',JSON[_0xa609('0x16')](_0x21fc7c));if(_0x21fc7c['error']){if(_0x21fc7c[_0xa609('0x17')][_0xa609('0x18')]===0x1f4){logger[_0xa609('0x17')](_0xa609('0x12'),_0x189301,_0x21fc7c['error'][_0xa609('0x19')]);return _0xcc9276(_0x21fc7c['error'][_0xa609('0x19')]);}logger['error'](_0xa609('0x12'),_0x189301,_0x21fc7c[_0xa609('0x17')][_0xa609('0x19')]);return _0x5a8449(_0x21fc7c[_0xa609('0x17')][_0xa609('0x19')]);}else{logger[_0xa609('0x1a')](_0xa609('0x12'),_0x189301,'request\x20sent');_0x5a8449(_0x21fc7c[_0xa609('0x1b')][_0xa609('0x19')]);}})[_0xa609('0x1c')](function(_0x3e7ad1){logger[_0xa609('0x17')](_0xa609('0x12'),_0x189301,_0x3e7ad1);_0xcc9276(_0x3e7ad1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 90487b0..1eed3d9 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 _0x204e=['register','length','chatWebsite:','save','remove','update','emit','removeListener'];(function(_0x1dbc31,_0x4c550c){var _0x256e5b=function(_0xc511bc){while(--_0xc511bc){_0x1dbc31['push'](_0x1dbc31['shift']());}};_0x256e5b(++_0x4c550c);}(_0x204e,0x10b));var _0xe204=function(_0x1f0ba3,_0xd0d300){_0x1f0ba3=_0x1f0ba3-0x0;var _0x370c4b=_0x204e[_0x1f0ba3];return _0x370c4b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xe204('0x0'),_0xe204('0x1'),_0xe204('0x2')];function createListener(_0x1cbab1,_0x54affd){return function(_0x2b20c0){_0x54affd[_0xe204('0x3')](_0x1cbab1,_0x2b20c0);};}function removeListener(_0x1d3f19,_0x5d6d99){return function(){ChatWebsiteEvents[_0xe204('0x4')](_0x1d3f19,_0x5d6d99);};}exports[_0xe204('0x5')]=function(_0x267a0e){for(var _0x5ae7d5=0x0,_0x39953c=events[_0xe204('0x6')];_0x5ae7d5<_0x39953c;_0x5ae7d5++){var _0x2f40f2=events[_0x5ae7d5];var _0x3b911b=createListener(_0xe204('0x7')+_0x2f40f2,_0x267a0e);ChatWebsiteEvents['on'](_0x2f40f2,_0x3b911b);}}; \ No newline at end of file +var _0x991e=['length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener','register'];(function(_0x295937,_0x2e250f){var _0x45ec54=function(_0x595465){while(--_0x595465){_0x295937['push'](_0x295937['shift']());}};_0x45ec54(++_0x2e250f);}(_0x991e,0x18a));var _0xe991=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x991e[_0x278e3c];return _0x3e2d9b;};'use strict';var ChatWebsiteEvents=require(_0xe991('0x0'));var events=[_0xe991('0x1'),'remove',_0xe991('0x2')];function createListener(_0x1056ed,_0x25e073){return function(_0x3bcf2b){_0x25e073[_0xe991('0x3')](_0x1056ed,_0x3bcf2b);};}function removeListener(_0x2009c8,_0x4cea33){return function(){ChatWebsiteEvents[_0xe991('0x4')](_0x2009c8,_0x4cea33);};}exports[_0xe991('0x5')]=function(_0x176f56){for(var _0x9a570f=0x0,_0x11089=events[_0xe991('0x6')];_0x9a570f<_0x11089;_0x9a570f++){var _0x755ada=events[_0x9a570f];var _0x14c71a=createListener(_0xe991('0x7')+_0x755ada,_0x176f56);ChatWebsiteEvents['on'](_0x755ada,_0x14c71a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 0882dcc..bb6eba9 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 _0x4b98=['removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','../../config/environment','./chatWebsite.controller','isAuthenticated','/describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','getAgents','create','post','addAnswer','diskStorage','join','format','%s-%s','now','originalname','single','file','addLogo','root','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','/:id','update','delete'];(function(_0x2ec40b,_0x59a29c){var _0x28ba77=function(_0x7e5046){while(--_0x7e5046){_0x2ec40b['push'](_0x2ec40b['shift']());}};_0x28ba77(++_0x59a29c);}(_0x4b98,0xcc));var _0x84b9=function(_0x136ed6,_0x1df16d){_0x136ed6=_0x136ed6-0x0;var _0x3bbfb9=_0x4b98[_0x136ed6];return _0x3bbfb9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x84b9('0x0'));var timeout=require(_0x84b9('0x1'));var express=require(_0x84b9('0x2'));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(_0x84b9('0x3'));var controller=require(_0x84b9('0x4'));router['get']('/',auth[_0x84b9('0x5')](),controller['index']);router['get'](_0x84b9('0x6'),auth[_0x84b9('0x5')](),controller['describe']);router[_0x84b9('0x7')]('/:id',auth[_0x84b9('0x5')](),controller[_0x84b9('0x8')]);router[_0x84b9('0x7')](_0x84b9('0x9'),auth[_0x84b9('0x5')](),controller[_0x84b9('0xa')]);router['get'](_0x84b9('0xb'),auth[_0x84b9('0x5')](),controller['getAnswers']);router['get'](_0x84b9('0xc'),controller[_0x84b9('0xd')]);router[_0x84b9('0x7')](_0x84b9('0xe'),controller[_0x84b9('0xf')]);router['get'](_0x84b9('0x10'),controller[_0x84b9('0x11')]);router[_0x84b9('0x7')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x84b9('0x7')](_0x84b9('0x12'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x13')]);router[_0x84b9('0x7')](_0x84b9('0x14'),controller[_0x84b9('0x15')]);router[_0x84b9('0x7')](_0x84b9('0x16'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x17')]);router[_0x84b9('0x7')](_0x84b9('0x18'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x19')]);router[_0x84b9('0x7')](_0x84b9('0x1a'),controller[_0x84b9('0x1b')]);router[_0x84b9('0x7')]('/:id/offline_messages',auth[_0x84b9('0x5')](),controller['getOfflineMessages']);router[_0x84b9('0x7')](_0x84b9('0x1c'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x1d')]);router['post']('/',auth[_0x84b9('0x5')](),controller[_0x84b9('0x1e')]);router[_0x84b9('0x1f')](_0x84b9('0x9'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x84b9('0x1f')](_0x84b9('0xb'),auth['isAuthenticated'](),controller[_0x84b9('0x20')]);var upload=multer({'storage':multer[_0x84b9('0x21')]({'destination':function(_0x24423a,_0x5ad94a,_0x11841d){_0x11841d(null,path[_0x84b9('0x22')](config['root'],'server/files/images/logos/'));},'filename':function(_0x23d6ca,_0x94cf27,_0x6bf1c){_0x6bf1c(null,util[_0x84b9('0x23')](_0x84b9('0x24'),Date[_0x84b9('0x25')](),_0x94cf27[_0x84b9('0x26')]));}})});router[_0x84b9('0x1f')](_0x84b9('0xc'),upload[_0x84b9('0x27')](_0x84b9('0x28')),controller[_0x84b9('0x29')]);var upload=multer({'storage':multer[_0x84b9('0x21')]({'destination':function(_0x42bc95,_0x583620,_0xeacb71){_0xeacb71(null,path[_0x84b9('0x22')](config[_0x84b9('0x2a')],_0x84b9('0x2b')));},'filename':function(_0x253d7f,_0xfa1cfe,_0x469855){_0x469855(null,util['format']('%s-%s',Date[_0x84b9('0x25')](),_0xfa1cfe['originalname']));}})});router[_0x84b9('0x1f')](_0x84b9('0xe'),upload[_0x84b9('0x27')](_0x84b9('0x28')),controller[_0x84b9('0x2c')]);var upload=multer({'storage':multer[_0x84b9('0x21')]({'destination':function(_0x31d400,_0x146733,_0x51ab53){_0x51ab53(null,path[_0x84b9('0x22')](config['root'],_0x84b9('0x2b')));},'filename':function(_0x566072,_0x57456c,_0x1199f6){_0x1199f6(null,util[_0x84b9('0x23')]('%s-%s',Date[_0x84b9('0x25')](),_0x57456c[_0x84b9('0x26')]));}})});router[_0x84b9('0x1f')](_0x84b9('0x10'),upload[_0x84b9('0x27')](_0x84b9('0x28')),controller[_0x84b9('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32387d,_0x4ae5ac,_0x2bdd98){_0x2bdd98(null,path['join'](config[_0x84b9('0x2a')],_0x84b9('0x2b')));},'filename':function(_0x3e7cbf,_0x3af292,_0x397a10){_0x397a10(null,util[_0x84b9('0x23')](_0x84b9('0x24'),Date[_0x84b9('0x25')](),_0x3af292[_0x84b9('0x26')]));}})});router['post']('/:id/system_avatar',upload[_0x84b9('0x27')](_0x84b9('0x28')),controller[_0x84b9('0x2e')]);router['post'](_0x84b9('0x2f'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x84b9('0x21')]({'destination':function(_0x8a4624,_0x313dbf,_0x1209c4){const _0x167054=path[_0x84b9('0x22')](config[_0x84b9('0x2a')],_0x84b9('0x30'),_0x84b9('0x31'),_0x84b9('0x32'));fs_extra[_0x84b9('0x33')](_0x167054,function(){_0x1209c4(null,_0x167054);});},'filename':function(_0xb850a1,_0x3fc44a,_0x1ad198){const _0x27c6bd=_0x3fc44a[_0x84b9('0x26')][_0x84b9('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x320587=path[_0x84b9('0x35')](_0x27c6bd);const _0x313a82=Date[_0x84b9('0x25')]()+'-'+_0x27c6bd[_0x84b9('0x34')](_0x320587,'')+_0x320587;_0x1ad198(null,_0x313a82);}})});router[_0x84b9('0x1f')](_0x84b9('0x36'),offlineUploadMulter[_0x84b9('0x37')](),controller[_0x84b9('0x38')]);router[_0x84b9('0x1f')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x84b9('0x39')]);router['post'](_0x84b9('0x16'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x3a')]);router[_0x84b9('0x1f')](_0x84b9('0x18'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x3b')]);router[_0x84b9('0x1f')](_0x84b9('0x1c'),auth['isAuthenticated'](),controller[_0x84b9('0x3c')]);router['put'](_0x84b9('0x3d'),auth['isAuthenticated'](),controller[_0x84b9('0x3e')]);router['delete']('/:id',auth[_0x84b9('0x5')](),controller['destroy']);router[_0x84b9('0x3f')](_0x84b9('0x9'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x40')]);router[_0x84b9('0x3f')](_0x84b9('0xb'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x41')]);router[_0x84b9('0x3f')](_0x84b9('0x1c'),auth[_0x84b9('0x5')](),controller[_0x84b9('0x42')]);module['exports']=router; \ No newline at end of file +var _0x3f51=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','root','server/files/images/logos/','format','%s-%s','originalname','single','file','addLogo','diskStorage','join','addAvatar','now','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','notify','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util'];(function(_0x16ffdf,_0x15240c){var _0x10287c=function(_0x21531d){while(--_0x21531d){_0x16ffdf['push'](_0x16ffdf['shift']());}};_0x10287c(++_0x15240c);}(_0x3f51,0x1ba));var _0x13f5=function(_0x21d7b9,_0x5572d9){_0x21d7b9=_0x21d7b9-0x0;var _0xf2840=_0x3f51[_0x21d7b9];return _0xf2840;};'use strict';var multer=require(_0x13f5('0x0'));var util=require(_0x13f5('0x1'));var path=require(_0x13f5('0x2'));var timeout=require(_0x13f5('0x3'));var express=require(_0x13f5('0x4'));var router=express[_0x13f5('0x5')]();var fs_extra=require(_0x13f5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x13f5('0x7'));var config=require(_0x13f5('0x8'));var controller=require(_0x13f5('0x9'));router[_0x13f5('0xa')]('/',auth[_0x13f5('0xb')](),controller[_0x13f5('0xc')]);router[_0x13f5('0xa')]('/describe',auth[_0x13f5('0xb')](),controller[_0x13f5('0xd')]);router[_0x13f5('0xa')](_0x13f5('0xe'),auth[_0x13f5('0xb')](),controller['show']);router[_0x13f5('0xa')](_0x13f5('0xf'),auth[_0x13f5('0xb')](),controller['getDispositions']);router[_0x13f5('0xa')](_0x13f5('0x10'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x11')]);router[_0x13f5('0xa')](_0x13f5('0x12'),controller['getLogo']);router[_0x13f5('0xa')](_0x13f5('0x13'),controller[_0x13f5('0x14')]);router[_0x13f5('0xa')](_0x13f5('0x15'),controller[_0x13f5('0x16')]);router[_0x13f5('0xa')](_0x13f5('0x17'),controller[_0x13f5('0x18')]);router[_0x13f5('0xa')](_0x13f5('0x19'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x1a')]);router[_0x13f5('0xa')](_0x13f5('0x1b'),controller[_0x13f5('0x1c')]);router[_0x13f5('0xa')](_0x13f5('0x1d'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x1e')]);router[_0x13f5('0xa')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x13f5('0x1f')]);router['get'](_0x13f5('0x20'),controller[_0x13f5('0x21')]);router[_0x13f5('0xa')](_0x13f5('0x22'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x23')]);router[_0x13f5('0xa')](_0x13f5('0x24'),auth[_0x13f5('0xb')](),controller['getAgents']);router[_0x13f5('0x25')]('/',auth[_0x13f5('0xb')](),controller[_0x13f5('0x26')]);router[_0x13f5('0x25')]('/:id/dispositions',auth[_0x13f5('0xb')](),controller[_0x13f5('0x27')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x13f5('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22680f,_0x2b1216,_0x133a52){_0x133a52(null,path['join'](config[_0x13f5('0x29')],_0x13f5('0x2a')));},'filename':function(_0x3b6acb,_0x42a933,_0x4af2de){_0x4af2de(null,util[_0x13f5('0x2b')](_0x13f5('0x2c'),Date['now'](),_0x42a933[_0x13f5('0x2d')]));}})});router[_0x13f5('0x25')](_0x13f5('0x12'),upload[_0x13f5('0x2e')](_0x13f5('0x2f')),controller[_0x13f5('0x30')]);var upload=multer({'storage':multer[_0x13f5('0x31')]({'destination':function(_0x5031f9,_0x143f37,_0x2d5016){_0x2d5016(null,path[_0x13f5('0x32')](config[_0x13f5('0x29')],'server/files/images/avatars/'));},'filename':function(_0x5e15a1,_0x4c7ee6,_0x37eaa6){_0x37eaa6(null,util[_0x13f5('0x2b')](_0x13f5('0x2c'),Date['now'](),_0x4c7ee6[_0x13f5('0x2d')]));}})});router[_0x13f5('0x25')](_0x13f5('0x13'),upload[_0x13f5('0x2e')](_0x13f5('0x2f')),controller[_0x13f5('0x33')]);var upload=multer({'storage':multer[_0x13f5('0x31')]({'destination':function(_0x5e87eb,_0x471b12,_0x523c3d){_0x523c3d(null,path[_0x13f5('0x32')](config[_0x13f5('0x29')],'server/files/images/avatars/'));},'filename':function(_0x40a19d,_0x40c1da,_0x26001b){_0x26001b(null,util[_0x13f5('0x2b')]('%s-%s',Date[_0x13f5('0x34')](),_0x40c1da['originalname']));}})});router[_0x13f5('0x25')](_0x13f5('0x15'),upload[_0x13f5('0x2e')]('file'),controller[_0x13f5('0x35')]);var upload=multer({'storage':multer[_0x13f5('0x31')]({'destination':function(_0x3caa05,_0x582d4b,_0x2bea7e){_0x2bea7e(null,path[_0x13f5('0x32')](config[_0x13f5('0x29')],_0x13f5('0x36')));},'filename':function(_0x4e07f8,_0xf518cc,_0x396f6c){_0x396f6c(null,util['format'](_0x13f5('0x2c'),Date[_0x13f5('0x34')](),_0xf518cc[_0x13f5('0x2d')]));}})});router[_0x13f5('0x25')](_0x13f5('0x17'),upload[_0x13f5('0x2e')](_0x13f5('0x2f')),controller[_0x13f5('0x37')]);router[_0x13f5('0x25')]('/:id/notify',controller[_0x13f5('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x13f5('0x31')]({'destination':function(_0x5aee49,_0x20d0c5,_0x23bf77){const _0x55ef73=path['join'](config['root'],'server/files','attachments',_0x13f5('0x39'));fs_extra[_0x13f5('0x3a')](_0x55ef73,function(){_0x23bf77(null,_0x55ef73);});},'filename':function(_0x5353cf,_0xa96244,_0x29643d){const _0xc2f69a=_0xa96244['originalname'][_0x13f5('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2d692c=path[_0x13f5('0x3c')](_0xc2f69a);const _0x5a781a=Date[_0x13f5('0x34')]()+'-'+_0xc2f69a[_0x13f5('0x3b')](_0x2d692c,'')+_0x2d692c;_0x29643d(null,_0x5a781a);}})});router[_0x13f5('0x25')]('/:id/offline',offlineUploadMulter[_0x13f5('0x3d')](),controller[_0x13f5('0x3e')]);router[_0x13f5('0x25')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x13f5('0x3f')]);router[_0x13f5('0x25')](_0x13f5('0x1d'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x40')]);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x13f5('0x41')]);router['post'](_0x13f5('0x24'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x42')]);router[_0x13f5('0x43')](_0x13f5('0xe'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x44')]);router[_0x13f5('0x45')](_0x13f5('0xe'),auth[_0x13f5('0xb')](),controller[_0x13f5('0x46')]);router[_0x13f5('0x45')](_0x13f5('0xf'),auth['isAuthenticated'](),controller[_0x13f5('0x47')]);router[_0x13f5('0x45')]('/:id/canned_answers',auth[_0x13f5('0xb')](),controller[_0x13f5('0x48')]);router[_0x13f5('0x45')](_0x13f5('0x24'),auth[_0x13f5('0xb')](),controller['removeAgents']);module[_0x13f5('0x49')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index ee3c922..c6638e4 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 _0x6a33=['client-side-logger','Client-Side\x20logger\x20not\x20found!','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','production','app','get'];(function(_0x45b858,_0x25b131){var _0x5304cd=function(_0x795c6c){while(--_0x795c6c){_0x45b858['push'](_0x45b858['shift']());}};_0x5304cd(++_0x25b131);}(_0x6a33,0x171));var _0x36a3=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x6a33[_0x87b0ff];return _0x3bc0b2;};var beaverLogger=require(_0x36a3('0x0'));var express=require(_0x36a3('0x1'));var auth=require(_0x36a3('0x2'));var config=require(_0x36a3('0x3'));var router=express[_0x36a3('0x4')]();var isProduction=config['env']===_0x36a3('0x5')||![];function clientSideLogs(_0x4f5fbf,_0x1b0a7b,_0x65d9a9){var _0x239233=_0x4f5fbf[_0x36a3('0x6')][_0x36a3('0x7')](_0x36a3('0x8'));if(!_0x239233){throw new Error(_0x36a3('0x9'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x239233,'enableCors':!isProduction})(_0x4f5fbf,_0x1b0a7b,_0x65d9a9);}router[_0x36a3('0xa')](auth[_0x36a3('0xb')](),clientSideLogs);module[_0x36a3('0xc')]=router; \ No newline at end of file +var _0xd224=['isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','production','client-side-logger','expressEndpoint','/client-logs','use'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd224,0x70));var _0x4d22=function(_0x4353ff,_0xeb2cf6){_0x4353ff=_0x4353ff-0x0;var _0x530440=_0xd224[_0x4353ff];return _0x530440;};var beaverLogger=require(_0x4d22('0x0'));var express=require(_0x4d22('0x1'));var auth=require(_0x4d22('0x2'));var config=require(_0x4d22('0x3'));var router=express['Router']();var isProduction=config['env']===_0x4d22('0x4')||![];function clientSideLogs(_0x230d17,_0x435c21,_0x2c77c1){var _0x4193a8=_0x230d17['app']['get'](_0x4d22('0x5'));if(!_0x4193a8){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x4d22('0x6')]({'uri':_0x4d22('0x7'),'logger':_0x4193a8,'enableCors':!isProduction})(_0x230d17,_0x435c21,_0x2c77c1);}router[_0x4d22('0x8')](auth[_0x4d22('0x9')](),clientSideLogs);module[_0x4d22('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 86f82b6..51845ae 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 _0xff01=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x2fb6c7,_0xe46307){var _0x38b589=function(_0x53edf8){while(--_0x53edf8){_0x2fb6c7['push'](_0x2fb6c7['shift']());}};_0x38b589(++_0xe46307);}(_0xff01,0xa1));var _0x1ff0=function(_0x3a3538,_0x1e2c65){_0x3a3538=_0x3a3538-0x0;var _0x34fcf7=_0xff01[_0x3a3538];return _0x34fcf7;};'use strict';var Sequelize=require(_0x1ff0('0x0'));module[_0x1ff0('0x1')]={'name':{'type':Sequelize[_0x1ff0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1ff0('0x3')](_0x1ff0('0x4'),'Google',_0x1ff0('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x1ff0('0x3')](_0x1ff0('0x6'),_0x1ff0('0x7'))},'data1':{'type':Sequelize[_0x1ff0('0x2')],'comment':_0x1ff0('0x8')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x1ff0('0x9')},'data4':{'type':Sequelize[_0x1ff0('0x2')],'comment':_0x1ff0('0xa')},'data5':{'type':Sequelize[_0x1ff0('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x1ff0('0xb')],'comment':_0x1ff0('0xc')},'data7':{'type':Sequelize[_0x1ff0('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x47ff=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47ff,0x17e));var _0xf47f=function(_0x25d6db,_0x51b7f8){_0x25d6db=_0x25d6db-0x0;var _0x2abc0c=_0x47ff[_0x25d6db];return _0x2abc0c;};'use strict';var Sequelize=require(_0xf47f('0x0'));module[_0xf47f('0x1')]={'name':{'type':Sequelize[_0xf47f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xf47f('0x3'),_0xf47f('0x4'),_0xf47f('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf47f('0x6')](_0xf47f('0x7'),_0xf47f('0x8'))},'data1':{'type':Sequelize[_0xf47f('0x2')],'comment':_0xf47f('0x9')},'data2':{'type':Sequelize[_0xf47f('0x2')],'comment':_0xf47f('0xa')},'data3':{'type':Sequelize[_0xf47f('0x2')],'comment':_0xf47f('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0xf47f('0xc')},'data5':{'type':Sequelize[_0xf47f('0xd')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xf47f('0xd')],'comment':_0xf47f('0xe')},'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 bd9df7f..e43f33d 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 _0x23fc=['redis','defaults','localhost','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','error','name','send','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','find','create','Name\x20parameter\x20not\x20specified','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data6','refresh_token','data5','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../mysqldb','./cloudProvider.oauth'];(function(_0x3b8e86,_0x31b2c2){var _0x3f18e5=function(_0x40fb98){while(--_0x40fb98){_0x3b8e86['push'](_0x3b8e86['shift']());}};_0x3f18e5(++_0x31b2c2);}(_0x23fc,0x1bd));var _0xc23f=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x23fc[_0x2e6dbf];return _0x2680e5;};'use strict';var _=require(_0xc23f('0x0'));var Redis=require('ioredis');var qs=require(_0xc23f('0x1'));var encryptor=require(_0xc23f('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');var db=require(_0xc23f('0x3'))['db'];var oauth=require(_0xc23f('0x4'));config[_0xc23f('0x5')]=_[_0xc23f('0x6')](config[_0xc23f('0x5')],{'host':_0xc23f('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0xc23f('0x5')]);function respondWithStatusCode(_0x1651d5,_0x441fc9){_0x441fc9=_0x441fc9||0xcc;return function(_0x128ba2){if(_0x128ba2){return _0x1651d5[_0xc23f('0x8')](_0x441fc9);}return _0x1651d5[_0xc23f('0x9')](_0x441fc9)[_0xc23f('0xa')]();};}function respondWithResult(_0x80d4b8,_0x49cedc){_0x49cedc=_0x49cedc||0xc8;return function(_0x26739f){if(_0x26739f){return _0x80d4b8[_0xc23f('0x9')](_0x49cedc)['json'](_0x26739f);}};}function respondWithFilteredResult(_0x5acc8e,_0x279412){return function(_0x29b086){if(_0x29b086){var _0x110266=typeof _0x279412[_0xc23f('0xb')]==='undefined'&&typeof _0x279412[_0xc23f('0xc')]===_0xc23f('0xd');var _0x2fb928=_0x29b086['count'];var _0x5c12da=_0x110266?0x0:_0x279412[_0xc23f('0xb')];var _0x548c06=_0x110266?_0x29b086[_0xc23f('0xe')]:_0x279412[_0xc23f('0xb')]+_0x279412[_0xc23f('0xc')];var _0x193b9f;if(_0x548c06>=_0x2fb928){_0x548c06=_0x2fb928;_0x193b9f=0xc8;}else{_0x193b9f=0xce;}_0x5acc8e[_0xc23f('0x9')](_0x193b9f);return _0x5acc8e[_0xc23f('0xf')](_0xc23f('0x10'),_0x5c12da+'-'+_0x548c06+'/'+_0x2fb928)[_0xc23f('0x11')](_0x29b086);}return null;};}function saveUpdates(_0x549f62){return function(_0x356189){if(_0x356189){return _0x356189[_0xc23f('0x12')](_0x549f62)[_0xc23f('0x13')](function(_0x24ef15){return _0x24ef15;});}return null;};}function removeEntity(_0x2d9b1f){return function(_0x635c42){if(_0x635c42){return _0x635c42[_0xc23f('0x14')]()[_0xc23f('0x13')](function(){_0x2d9b1f[_0xc23f('0x9')](0xcc)[_0xc23f('0xa')]();});}};}function handleEntityNotFound(_0x134586){return function(_0x347067){if(!_0x347067){_0x134586[_0xc23f('0x8')](0x194);}return _0x347067;};}function handleError(_0x1d0340,_0x1d2c0f){_0x1d2c0f=_0x1d2c0f||0x1f4;return function(_0x1b548b){logger[_0xc23f('0x15')](_0x1b548b['stack']);if(_0x1b548b[_0xc23f('0x16')]){delete _0x1b548b[_0xc23f('0x16')];}_0x1d0340['status'](_0x1d2c0f)[_0xc23f('0x17')](_0x1b548b);};}function maskClientSecret(_0x539a04){return _[_0xc23f('0x18')](_0x539a04[_0xc23f('0x19')](0x0,0x3),0x14,'*');}exports[_0xc23f('0x1a')]=function(_0x372ba1,_0x39fd05){var _0x2b23b9={},_0x151b15={},_0x487d97={'count':0x0,'rows':[]};var _0x2222f5=_['map'](db[_0xc23f('0x1b')][_0xc23f('0x1c')],function(_0x1ebb95){return{'name':_0x1ebb95[_0xc23f('0x1d')],'type':_0x1ebb95[_0xc23f('0x1e')]['key']};});_0x151b15[_0xc23f('0x1f')]=_[_0xc23f('0x20')](_0x2222f5,_0xc23f('0x16'));_0x151b15[_0xc23f('0x21')]=_[_0xc23f('0x22')](_0x372ba1[_0xc23f('0x21')]);_0x151b15[_0xc23f('0x23')]=_[_0xc23f('0x24')](_0x151b15[_0xc23f('0x1f')],_0x151b15[_0xc23f('0x21')]);_0x2b23b9['attributes']=_[_0xc23f('0x24')](_0x151b15[_0xc23f('0x1f')],qs[_0xc23f('0x25')](_0x372ba1[_0xc23f('0x21')][_0xc23f('0x25')]));_0x2b23b9[_0xc23f('0x26')]=_0x2b23b9[_0xc23f('0x26')][_0xc23f('0x27')]?_0x2b23b9[_0xc23f('0x26')]:_0x151b15[_0xc23f('0x1f')];if(!_0x372ba1[_0xc23f('0x21')]['hasOwnProperty'](_0xc23f('0x28'))){_0x2b23b9['limit']=qs[_0xc23f('0xc')](_0x372ba1[_0xc23f('0x21')][_0xc23f('0xc')]);_0x2b23b9[_0xc23f('0xb')]=qs[_0xc23f('0xb')](_0x372ba1[_0xc23f('0x21')]['offset']);}_0x2b23b9[_0xc23f('0x29')]=qs[_0xc23f('0x2a')](_0x372ba1[_0xc23f('0x21')][_0xc23f('0x2a')]);_0x2b23b9[_0xc23f('0x2b')]=qs[_0xc23f('0x23')](_[_0xc23f('0x2c')](_0x372ba1[_0xc23f('0x21')],_0x151b15['filters']),_0x2222f5);if(_0x372ba1[_0xc23f('0x21')][_0xc23f('0x2d')]){_0x2b23b9['where']=_[_0xc23f('0x2e')](_0x2b23b9[_0xc23f('0x2b')],{'$or':_['map'](_0x2222f5,function(_0x52b83f){if(_0x52b83f[_0xc23f('0x1e')]!==_0xc23f('0x2f')){var _0x23f9cb={};_0x23f9cb[_0x52b83f['name']]={'$like':'%'+_0x372ba1[_0xc23f('0x21')]['filter']+'%'};return _0x23f9cb;}})});}_0x2b23b9=_[_0xc23f('0x2e')]({},_0x2b23b9,_0x372ba1[_0xc23f('0x30')]);var _0x2e071f={'where':_0x2b23b9[_0xc23f('0x2b')]};return db[_0xc23f('0x1b')][_0xc23f('0xe')](_0x2e071f)[_0xc23f('0x13')](function(_0x286041){_0x487d97[_0xc23f('0xe')]=_0x286041;if(_0x372ba1['query'][_0xc23f('0x31')]){_0x2b23b9['include']=[{'all':!![]}];}return db[_0xc23f('0x1b')][_0xc23f('0x32')](_0x2b23b9);})[_0xc23f('0x13')](function(_0x3c26a8){_0x487d97[_0xc23f('0x33')]=_[_0xc23f('0x20')](_0x3c26a8,function(_0x5e541c){if(_0x5e541c[_0xc23f('0x34')]===_0xc23f('0x35')){var _0x4f7bad=encryptor['decryptString'](_0x5e541c[_0xc23f('0x36')]);_0x5e541c[_0xc23f('0x36')]=maskClientSecret(_0x4f7bad);}return _0x5e541c;});return _0x487d97;})['then'](respondWithFilteredResult(_0x39fd05,_0x2b23b9))[_0xc23f('0x37')](handleError(_0x39fd05,null));};exports[_0xc23f('0x38')]=function(_0x5da204,_0x1ec7cb){var _0x3825c5={'raw':!![],'where':{'id':_0x5da204[_0xc23f('0x39')]['id']}},_0x526e3d={};_0x526e3d['model']=_[_0xc23f('0x22')](db['CloudProvider']['rawAttributes']);_0x526e3d[_0xc23f('0x21')]=_[_0xc23f('0x22')](_0x5da204[_0xc23f('0x21')]);_0x526e3d[_0xc23f('0x23')]=_[_0xc23f('0x24')](_0x526e3d[_0xc23f('0x1f')],_0x526e3d[_0xc23f('0x21')]);_0x3825c5[_0xc23f('0x26')]=_[_0xc23f('0x24')](_0x526e3d['model'],qs[_0xc23f('0x25')](_0x5da204[_0xc23f('0x21')]['fields']));_0x3825c5[_0xc23f('0x26')]=_0x3825c5[_0xc23f('0x26')]['length']?_0x3825c5[_0xc23f('0x26')]:_0x526e3d[_0xc23f('0x1f')];if(_0x5da204[_0xc23f('0x21')]['includeAll']){_0x3825c5['include']=[{'all':!![]}];}_0x3825c5=_[_0xc23f('0x2e')]({},_0x3825c5,_0x5da204[_0xc23f('0x30')]);return db[_0xc23f('0x1b')][_0xc23f('0x3a')](_0x3825c5)[_0xc23f('0x13')](handleEntityNotFound(_0x1ec7cb,null))[_0xc23f('0x13')](function(_0x3695c1){if(_0x3695c1[_0xc23f('0x34')]===_0xc23f('0x35')){var _0x2c97f4=encryptor['decryptString'](_0x3695c1[_0xc23f('0x36')]);_0x3695c1[_0xc23f('0x36')]=maskClientSecret(_0x2c97f4);}return _0x3695c1;})[_0xc23f('0x13')](respondWithResult(_0x1ec7cb,null))[_0xc23f('0x37')](handleError(_0x1ec7cb,null));};exports[_0xc23f('0x3b')]=function(_0x1b6835,_0x5ccb1b){if(!_0x1b6835['body'][_0xc23f('0x16')])throw new Error(_0xc23f('0x3c'));if(!_0x1b6835['body'][_0xc23f('0x34')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x38cd9d=db[_0xc23f('0x1b')][_0xc23f('0x1c')][_0xc23f('0x34')]['values'];if(!_0x38cd9d[_0xc23f('0x3d')](_0x1b6835[_0xc23f('0x3e')][_0xc23f('0x34')]))throw new Error(_0xc23f('0x3f')+_0x38cd9d['join'](',\x20'));if(_0x1b6835['body'][_0xc23f('0x34')]===_0xc23f('0x35')&&_0x1b6835[_0xc23f('0x3e')][_0xc23f('0x36')]){_0x1b6835['body'][_0xc23f('0x36')]=encryptor[_0xc23f('0x40')](_0x1b6835[_0xc23f('0x3e')][_0xc23f('0x36')]);}return db[_0xc23f('0x1b')][_0xc23f('0x3b')](_0x1b6835[_0xc23f('0x3e')],{})[_0xc23f('0x13')](respondWithResult(_0x5ccb1b,0xc9))[_0xc23f('0x37')](handleError(_0x5ccb1b,null));};exports[_0xc23f('0x12')]=function(_0x1d973b,_0x50af21){if(_0x1d973b['body']['id']){delete _0x1d973b[_0xc23f('0x3e')]['id'];}return db[_0xc23f('0x1b')][_0xc23f('0x3a')]({'where':{'id':_0x1d973b[_0xc23f('0x39')]['id']}})[_0xc23f('0x13')](handleEntityNotFound(_0x50af21,null))[_0xc23f('0x13')](function(_0x358d51){if(_0x358d51[_0xc23f('0x34')]===_0xc23f('0x35')&&_0x1d973b['body']['data3']){_0x1d973b[_0xc23f('0x3e')]['data3']=encryptor[_0xc23f('0x40')](_0x1d973b['body']['data3']);}return _0x358d51;})['then'](saveUpdates(_0x1d973b[_0xc23f('0x3e')],null))[_0xc23f('0x13')](respondWithResult(_0x50af21,null))['catch'](handleError(_0x50af21,null));};exports[_0xc23f('0x14')]=function(_0x273357,_0x55eb41){return db[_0xc23f('0x1b')][_0xc23f('0x3a')]({'where':{'id':_0x273357[_0xc23f('0x39')]['id']}})[_0xc23f('0x13')](handleEntityNotFound(_0x55eb41,null))[_0xc23f('0x13')](removeEntity(_0x55eb41,null))[_0xc23f('0x37')](handleError(_0x55eb41,null));};exports[_0xc23f('0x41')]=function(_0x43ca2b,_0x3c0732){return db['CloudProvider'][_0xc23f('0x42')]({'where':{'id':_0x43ca2b['params']['id']},'raw':!![]})['then'](function(_0xdd4954){if(!_0xdd4954)return _0x3c0732[_0xc23f('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0xdd4954,_0x43ca2b[_0xc23f('0x43')]['id'])};})[_0xc23f('0x13')](respondWithResult(_0x3c0732,null))[_0xc23f('0x37')](handleError(_0x3c0732,null));};exports[_0xc23f('0x44')]=function(_0x584ef9,_0x5eb7d9){var _0x213659=_0x584ef9[_0xc23f('0x3e')];var _0x10f60f;var _0x285989;if(_0x213659[_0xc23f('0x15')])throw _0x213659;redis[_0xc23f('0x45')](_0x213659['state'])[_0xc23f('0x13')](function(_0x224e0e){if(!_0x224e0e)throw new Error(_0xc23f('0x46'));_0x10f60f=JSON[_0xc23f('0x47')](_0x224e0e);var _0x47c9f6=Buffer[_0xc23f('0x48')](_0x213659[_0xc23f('0x49')],_0xc23f('0x4a'))['toString'](_0xc23f('0x4b'));_0x285989=JSON[_0xc23f('0x47')](_0x47c9f6);if(!oauth[_0xc23f('0x4c')](_0x213659[_0xc23f('0x4d')],_0x10f60f[_0xc23f('0x4e')]))throw new Error(_0xc23f('0x4f'));redis['del'](_0x213659['state']);return oauth[_0xc23f('0x50')](_0x213659[_0xc23f('0x51')],_0x10f60f);})[_0xc23f('0x13')](function(_0x160cf9){_0x10f60f['data5']=_0x160cf9['access_token'];_0x10f60f[_0xc23f('0x52')]=_0x160cf9[_0xc23f('0x53')];return db[_0xc23f('0x1b')][_0xc23f('0x12')]({'data5':_0x10f60f[_0xc23f('0x54')],'data6':_0x10f60f[_0xc23f('0x52')]},{'where':{'id':_0x10f60f['id']}});})[_0xc23f('0x13')](function(){oauth['startRefreshInterval'](_0x10f60f);socket[_0xc23f('0x55')](_0xc23f('0x56'),{'id':_0x285989['id']});return;})[_0xc23f('0x13')](respondWithStatusCode(_0x5eb7d9,null))[_0xc23f('0x37')](function(_0xe8d9dd){if(_0x285989){socket[_0xc23f('0x55')]('microsoftAuthorization:error',{'id':_0x285989['id']});}if(!_0x10f60f){logger[_0xc23f('0x15')](_0xc23f('0x57'),_0xe8d9dd);return _0x5eb7d9['status'](0x1f4)[_0xc23f('0x17')](_0xe8d9dd['message']);}logger[_0xc23f('0x15')](_0xc23f('0x58'),_0x10f60f['id'],JSON[_0xc23f('0x59')](_0xe8d9dd));});}; \ No newline at end of file +var _0xab13=['get','state','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','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','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','error','stack','name','send','slice','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','service','MicrosoftAzure','data3','catch','params','fields','length','includeAll','find','create','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','destroy','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback'];(function(_0x2bef7e,_0xc397d3){var _0x4231bc=function(_0x4f2fbe){while(--_0x4f2fbe){_0x2bef7e['push'](_0x2bef7e['shift']());}};_0x4231bc(++_0xc397d3);}(_0xab13,0x195));var _0x3ab1=function(_0x578a25,_0x368f7a){_0x578a25=_0x578a25-0x0;var _0x2a6ec0=_0xab13[_0x578a25];return _0x2a6ec0;};'use strict';var _=require(_0x3ab1('0x0'));var Redis=require(_0x3ab1('0x1'));var qs=require(_0x3ab1('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x3ab1('0x3'));var logger=require(_0x3ab1('0x4'))('api');var db=require(_0x3ab1('0x5'))['db'];var oauth=require(_0x3ab1('0x6'));config[_0x3ab1('0x7')]=_[_0x3ab1('0x8')](config[_0x3ab1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ab1('0x9'))(new Redis(config[_0x3ab1('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x29c195,_0x3c1ca2){_0x3c1ca2=_0x3c1ca2||0xcc;return function(_0x207ab9){if(_0x207ab9){return _0x29c195[_0x3ab1('0xa')](_0x3c1ca2);}return _0x29c195[_0x3ab1('0xb')](_0x3c1ca2)[_0x3ab1('0xc')]();};}function respondWithResult(_0x10b7e6,_0x475c01){_0x475c01=_0x475c01||0xc8;return function(_0x714140){if(_0x714140){return _0x10b7e6['status'](_0x475c01)[_0x3ab1('0xd')](_0x714140);}};}function respondWithFilteredResult(_0x40e293,_0x1b20bb){return function(_0x49c875){if(_0x49c875){var _0x2cabd7=typeof _0x1b20bb[_0x3ab1('0xe')]===_0x3ab1('0xf')&&typeof _0x1b20bb[_0x3ab1('0x10')]==='undefined';var _0x21a876=_0x49c875[_0x3ab1('0x11')];var _0x4fd81f=_0x2cabd7?0x0:_0x1b20bb['offset'];var _0x13cca6=_0x2cabd7?_0x49c875[_0x3ab1('0x11')]:_0x1b20bb[_0x3ab1('0xe')]+_0x1b20bb['limit'];var _0x1fa817;if(_0x13cca6>=_0x21a876){_0x13cca6=_0x21a876;_0x1fa817=0xc8;}else{_0x1fa817=0xce;}_0x40e293[_0x3ab1('0xb')](_0x1fa817);return _0x40e293['set'](_0x3ab1('0x12'),_0x4fd81f+'-'+_0x13cca6+'/'+_0x21a876)[_0x3ab1('0xd')](_0x49c875);}return null;};}function saveUpdates(_0x53d83e){return function(_0x2eaf7f){if(_0x2eaf7f){return _0x2eaf7f['update'](_0x53d83e)['then'](function(_0x315c77){return _0x315c77;});}return null;};}function removeEntity(_0xe034ea){return function(_0x538fb6){if(_0x538fb6){return _0x538fb6['destroy']()[_0x3ab1('0x13')](function(){_0xe034ea['status'](0xcc)[_0x3ab1('0xc')]();});}};}function handleEntityNotFound(_0x46c343){return function(_0x324682){if(!_0x324682){_0x46c343[_0x3ab1('0xa')](0x194);}return _0x324682;};}function handleError(_0x5291e3,_0x44f489){_0x44f489=_0x44f489||0x1f4;return function(_0x30f6a1){logger[_0x3ab1('0x14')](_0x30f6a1[_0x3ab1('0x15')]);if(_0x30f6a1[_0x3ab1('0x16')]){delete _0x30f6a1['name'];}_0x5291e3[_0x3ab1('0xb')](_0x44f489)[_0x3ab1('0x17')](_0x30f6a1);};}function maskClientSecret(_0x389750){return _['padEnd'](_0x389750[_0x3ab1('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x548559,_0x57e54f){var _0xeb5ecb={},_0x5818a1={},_0x51adbf={'count':0x0,'rows':[]};var _0x50de35=_[_0x3ab1('0x19')](db[_0x3ab1('0x1a')][_0x3ab1('0x1b')],function(_0x28fefc){return{'name':_0x28fefc[_0x3ab1('0x1c')],'type':_0x28fefc[_0x3ab1('0x1d')][_0x3ab1('0x1e')]};});_0x5818a1[_0x3ab1('0x1f')]=_[_0x3ab1('0x19')](_0x50de35,_0x3ab1('0x16'));_0x5818a1[_0x3ab1('0x20')]=_[_0x3ab1('0x21')](_0x548559['query']);_0x5818a1[_0x3ab1('0x22')]=_[_0x3ab1('0x23')](_0x5818a1[_0x3ab1('0x1f')],_0x5818a1[_0x3ab1('0x20')]);_0xeb5ecb['attributes']=_[_0x3ab1('0x23')](_0x5818a1[_0x3ab1('0x1f')],qs['fields'](_0x548559[_0x3ab1('0x20')]['fields']));_0xeb5ecb['attributes']=_0xeb5ecb[_0x3ab1('0x24')]['length']?_0xeb5ecb[_0x3ab1('0x24')]:_0x5818a1[_0x3ab1('0x1f')];if(!_0x548559[_0x3ab1('0x20')][_0x3ab1('0x25')](_0x3ab1('0x26'))){_0xeb5ecb['limit']=qs[_0x3ab1('0x10')](_0x548559[_0x3ab1('0x20')][_0x3ab1('0x10')]);_0xeb5ecb[_0x3ab1('0xe')]=qs[_0x3ab1('0xe')](_0x548559[_0x3ab1('0x20')]['offset']);}_0xeb5ecb['order']=qs[_0x3ab1('0x27')](_0x548559['query'][_0x3ab1('0x27')]);_0xeb5ecb[_0x3ab1('0x28')]=qs[_0x3ab1('0x22')](_[_0x3ab1('0x29')](_0x548559[_0x3ab1('0x20')],_0x5818a1[_0x3ab1('0x22')]),_0x50de35);if(_0x548559[_0x3ab1('0x20')][_0x3ab1('0x2a')]){_0xeb5ecb[_0x3ab1('0x28')]=_[_0x3ab1('0x2b')](_0xeb5ecb[_0x3ab1('0x28')],{'$or':_[_0x3ab1('0x19')](_0x50de35,function(_0x2fd186){if(_0x2fd186[_0x3ab1('0x1d')]!=='VIRTUAL'){var _0x1e7410={};_0x1e7410[_0x2fd186['name']]={'$like':'%'+_0x548559[_0x3ab1('0x20')][_0x3ab1('0x2a')]+'%'};return _0x1e7410;}})});}_0xeb5ecb=_[_0x3ab1('0x2b')]({},_0xeb5ecb,_0x548559[_0x3ab1('0x2c')]);var _0x474ab9={'where':_0xeb5ecb[_0x3ab1('0x28')]};return db[_0x3ab1('0x1a')]['count'](_0x474ab9)['then'](function(_0x5b50ed){_0x51adbf['count']=_0x5b50ed;if(_0x548559[_0x3ab1('0x20')]['includeAll']){_0xeb5ecb[_0x3ab1('0x2d')]=[{'all':!![]}];}return db[_0x3ab1('0x1a')][_0x3ab1('0x2e')](_0xeb5ecb);})[_0x3ab1('0x13')](function(_0x2f8530){_0x51adbf[_0x3ab1('0x2f')]=_[_0x3ab1('0x19')](_0x2f8530,function(_0x469ce9){if(_0x469ce9[_0x3ab1('0x30')]===_0x3ab1('0x31')){var _0x5afbb3=encryptor['decryptString'](_0x469ce9[_0x3ab1('0x32')]);_0x469ce9['data3']=maskClientSecret(_0x5afbb3);}return _0x469ce9;});return _0x51adbf;})[_0x3ab1('0x13')](respondWithFilteredResult(_0x57e54f,_0xeb5ecb))[_0x3ab1('0x33')](handleError(_0x57e54f,null));};exports['show']=function(_0x12b7ef,_0xbcf030){var _0xe6ac02={'raw':!![],'where':{'id':_0x12b7ef[_0x3ab1('0x34')]['id']}},_0x6b90e6={};_0x6b90e6['model']=_[_0x3ab1('0x21')](db['CloudProvider'][_0x3ab1('0x1b')]);_0x6b90e6['query']=_[_0x3ab1('0x21')](_0x12b7ef[_0x3ab1('0x20')]);_0x6b90e6[_0x3ab1('0x22')]=_[_0x3ab1('0x23')](_0x6b90e6[_0x3ab1('0x1f')],_0x6b90e6['query']);_0xe6ac02['attributes']=_[_0x3ab1('0x23')](_0x6b90e6[_0x3ab1('0x1f')],qs[_0x3ab1('0x35')](_0x12b7ef[_0x3ab1('0x20')][_0x3ab1('0x35')]));_0xe6ac02['attributes']=_0xe6ac02[_0x3ab1('0x24')][_0x3ab1('0x36')]?_0xe6ac02[_0x3ab1('0x24')]:_0x6b90e6[_0x3ab1('0x1f')];if(_0x12b7ef['query'][_0x3ab1('0x37')]){_0xe6ac02[_0x3ab1('0x2d')]=[{'all':!![]}];}_0xe6ac02=_[_0x3ab1('0x2b')]({},_0xe6ac02,_0x12b7ef[_0x3ab1('0x2c')]);return db[_0x3ab1('0x1a')][_0x3ab1('0x38')](_0xe6ac02)[_0x3ab1('0x13')](handleEntityNotFound(_0xbcf030,null))[_0x3ab1('0x13')](function(_0x17bdb8){if(_0x17bdb8[_0x3ab1('0x30')]===_0x3ab1('0x31')){var _0x4a26f5=encryptor['decryptString'](_0x17bdb8[_0x3ab1('0x32')]);_0x17bdb8[_0x3ab1('0x32')]=maskClientSecret(_0x4a26f5);}return _0x17bdb8;})[_0x3ab1('0x13')](respondWithResult(_0xbcf030,null))[_0x3ab1('0x33')](handleError(_0xbcf030,null));};exports[_0x3ab1('0x39')]=function(_0x43ee69,_0x4c63ea){if(!_0x43ee69['body'][_0x3ab1('0x16')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x43ee69[_0x3ab1('0x3a')]['service'])throw new Error(_0x3ab1('0x3b'));var _0x36279f=db[_0x3ab1('0x1a')]['rawAttributes'][_0x3ab1('0x30')]['values'];if(!_0x36279f[_0x3ab1('0x3c')](_0x43ee69[_0x3ab1('0x3a')][_0x3ab1('0x30')]))throw new Error(_0x3ab1('0x3d')+_0x36279f[_0x3ab1('0x3e')](',\x20'));if(_0x43ee69[_0x3ab1('0x3a')][_0x3ab1('0x30')]==='MicrosoftAzure'&&_0x43ee69[_0x3ab1('0x3a')][_0x3ab1('0x32')]){_0x43ee69[_0x3ab1('0x3a')][_0x3ab1('0x32')]=encryptor[_0x3ab1('0x3f')](_0x43ee69[_0x3ab1('0x3a')][_0x3ab1('0x32')]);}return db[_0x3ab1('0x1a')][_0x3ab1('0x39')](_0x43ee69[_0x3ab1('0x3a')],{})[_0x3ab1('0x13')](respondWithResult(_0x4c63ea,0xc9))[_0x3ab1('0x33')](handleError(_0x4c63ea,null));};exports[_0x3ab1('0x40')]=function(_0x565308,_0x13d359){if(_0x565308[_0x3ab1('0x3a')]['id']){delete _0x565308[_0x3ab1('0x3a')]['id'];}return db['CloudProvider'][_0x3ab1('0x38')]({'where':{'id':_0x565308[_0x3ab1('0x34')]['id']}})[_0x3ab1('0x13')](handleEntityNotFound(_0x13d359,null))[_0x3ab1('0x13')](function(_0x4cc6d4){if(_0x4cc6d4[_0x3ab1('0x30')]===_0x3ab1('0x31')&&_0x565308[_0x3ab1('0x3a')]['data3']){_0x565308[_0x3ab1('0x3a')][_0x3ab1('0x32')]=encryptor[_0x3ab1('0x3f')](_0x565308['body'][_0x3ab1('0x32')]);}return _0x4cc6d4;})['then'](saveUpdates(_0x565308[_0x3ab1('0x3a')],null))[_0x3ab1('0x13')](respondWithResult(_0x13d359,null))[_0x3ab1('0x33')](handleError(_0x13d359,null));};exports[_0x3ab1('0x41')]=function(_0x20496b,_0x35a638){return db['CloudProvider']['find']({'where':{'id':_0x20496b[_0x3ab1('0x34')]['id']}})[_0x3ab1('0x13')](handleEntityNotFound(_0x35a638,null))[_0x3ab1('0x13')](removeEntity(_0x35a638,null))[_0x3ab1('0x33')](handleError(_0x35a638,null));};exports[_0x3ab1('0x42')]=function(_0x2f5498,_0x450f1e){return db['CloudProvider'][_0x3ab1('0x43')]({'where':{'id':_0x2f5498[_0x3ab1('0x34')]['id']},'raw':!![]})[_0x3ab1('0x13')](function(_0x347998){if(!_0x347998)return _0x450f1e[_0x3ab1('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x347998,_0x2f5498[_0x3ab1('0x44')]['id'])};})[_0x3ab1('0x13')](respondWithResult(_0x450f1e,null))[_0x3ab1('0x33')](handleError(_0x450f1e,null));};exports[_0x3ab1('0x45')]=function(_0x5d67ba,_0x99d568){var _0x2370b6=_0x5d67ba[_0x3ab1('0x3a')];var _0x2bd12b;var _0xc583f4;if(_0x2370b6[_0x3ab1('0x14')])throw _0x2370b6;redis[_0x3ab1('0x46')](_0x2370b6[_0x3ab1('0x47')])[_0x3ab1('0x13')](function(_0x57af08){if(!_0x57af08)throw new Error('Invalid\x20state\x20parameter');_0x2bd12b=JSON[_0x3ab1('0x48')](_0x57af08);var _0x157859=Buffer[_0x3ab1('0x49')](_0x2370b6[_0x3ab1('0x47')],_0x3ab1('0x4a'))[_0x3ab1('0x4b')](_0x3ab1('0x4c'));_0xc583f4=JSON[_0x3ab1('0x48')](_0x157859);if(!oauth[_0x3ab1('0x4d')](_0x2370b6[_0x3ab1('0x4e')],_0x2bd12b[_0x3ab1('0x4f')]))throw new Error(_0x3ab1('0x50'));redis[_0x3ab1('0x51')](_0x2370b6[_0x3ab1('0x47')]);return oauth[_0x3ab1('0x52')](_0x2370b6[_0x3ab1('0x53')],_0x2bd12b);})['then'](function(_0x183abd){_0x2bd12b[_0x3ab1('0x54')]=_0x183abd['access_token'];_0x2bd12b[_0x3ab1('0x55')]=_0x183abd[_0x3ab1('0x56')];return db[_0x3ab1('0x1a')][_0x3ab1('0x40')]({'data5':_0x2bd12b['data5'],'data6':_0x2bd12b[_0x3ab1('0x55')]},{'where':{'id':_0x2bd12b['id']}});})[_0x3ab1('0x13')](function(){oauth[_0x3ab1('0x57')](_0x2bd12b);socket[_0x3ab1('0x58')](_0x3ab1('0x59'),{'id':_0xc583f4['id']});return;})[_0x3ab1('0x13')](respondWithStatusCode(_0x99d568,null))[_0x3ab1('0x33')](function(_0x2648ff){if(_0xc583f4){socket['emit'](_0x3ab1('0x5a'),{'id':_0xc583f4['id']});}if(!_0x2bd12b){logger['error'](_0x3ab1('0x5b'),_0x2648ff);return _0x99d568['status'](0x1f4)[_0x3ab1('0x17')](_0x2648ff[_0x3ab1('0x5c')]);}logger[_0x3ab1('0x14')](_0x3ab1('0x5d'),_0x2bd12b['id'],JSON[_0x3ab1('0x5e')](_0x2648ff));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c5cba57..da42e8c 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 _0x0fd2=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x6f4e6e,_0x231a01){var _0x1167ff=function(_0xa2427b){while(--_0xa2427b){_0x6f4e6e['push'](_0x6f4e6e['shift']());}};_0x1167ff(++_0x231a01);}(_0x0fd2,0xf8));var _0x20fd=function(_0x5090cb,_0x3ce576){_0x5090cb=_0x5090cb-0x0;var _0x40f648=_0x0fd2[_0x5090cb];return _0x40f648;};'use strict';var _=require(_0x20fd('0x0'));var util=require('util');var logger=require(_0x20fd('0x1'))(_0x20fd('0x2'));var moment=require(_0x20fd('0x3'));var BPromise=require(_0x20fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x20fd('0x5'));var attributes=require(_0x20fd('0x6'));module[_0x20fd('0x7')]=function(_0x1f9a39,_0x54dcf){return _0x1f9a39['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3352=['define','CloudProvider','cloud_providers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports'];(function(_0x3b64dd,_0x4391d1){var _0x1fa21d=function(_0x38403a){while(--_0x38403a){_0x3b64dd['push'](_0x3b64dd['shift']());}};_0x1fa21d(++_0x4391d1);}(_0x3352,0xff));var _0x2335=function(_0x51293c,_0x1a01e8){_0x51293c=_0x51293c-0x0;var _0x2cabbe=_0x3352[_0x51293c];return _0x2cabbe;};'use strict';var _=require(_0x2335('0x0'));var util=require('util');var logger=require(_0x2335('0x1'))(_0x2335('0x2'));var moment=require('moment');var BPromise=require(_0x2335('0x3'));var rp=require(_0x2335('0x4'));var fs=require('fs');var path=require(_0x2335('0x5'));var rimraf=require(_0x2335('0x6'));var config=require('../../config/environment');var attributes=require(_0x2335('0x7'));module[_0x2335('0x8')]=function(_0x54ca92,_0x1b3e0f){return _0x54ca92[_0x2335('0x9')](_0x2335('0xa'),attributes,{'tableName':_0x2335('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 8f8762d..2d4ebc7 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 _0xbe27=['client_id','data1','response_type','redirect_uri','data4','state','prompt','login','key','value','replace','set','iss','audience','nonce','isAfter','unix','exp','data3','refresh_token','data6','POST','then','access_token','CloudProvider','update','data5','catch','error','decryptString','bind','intervals','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','Dynamics365','data7','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','hex'];(function(_0x283be8,_0xea1092){var _0x15e6db=function(_0x500fc8){while(--_0x500fc8){_0x283be8['push'](_0x283be8['shift']());}};_0x15e6db(++_0xea1092);}(_0xbe27,0xb5));var _0x7be2=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbe27[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7be2('0x0'));var crypto=require(_0x7be2('0x1'));var jwt=require(_0x7be2('0x2'));var moment=require(_0x7be2('0x3'));var Redis=require(_0x7be2('0x4'));var rp=require(_0x7be2('0x5'));var util=require(_0x7be2('0x6'));var encryptor=require(_0x7be2('0x7'));var config=require('../../config/environment');var logger=require(_0x7be2('0x8'))(_0x7be2('0x9'));var schedule=require(_0x7be2('0xa'));var db=require(_0x7be2('0xb'))['db'];config[_0x7be2('0xc')]=_[_0x7be2('0xd')](config['redis'],{'host':_0x7be2('0xe'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x7be2('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0x7be2('0x10'),_0x7be2('0x11'),'email','offline_access',_0x7be2('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x7be2('0x13')],'Dynamics365':['openid',_0x7be2('0x14')]};var MICROSOFT_AUTH_ENDPOINT=_0x7be2('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x7be2('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x23366a){var _0x38b8b6=_[_0x7be2('0x17')](AZURE_AUTH_SCOPES[_0x23366a[_0x7be2('0x18')]]);if(_0x23366a['type']===_0x7be2('0x19'))_0x38b8b6['push'](_0x23366a[_0x7be2('0x1a')]+_0x7be2('0x1b'));return _0x38b8b6[_0x7be2('0x1c')]('\x20');}function getAccessTokenScope(_0x28de9b){if(_0x28de9b[_0x7be2('0x18')]===_0x7be2('0x1d'))return _0x7be2('0x12');if(_0x28de9b['type']==='Dynamics365')return _0x28de9b['data7']+_0x7be2('0x1b');}function generateMicrosoftAuthorizationUrl(_0x3773e4,_0x4c1546){var _0x2cdfd5=MICROSOFT_AUTH_URL['replace'](_0x7be2('0x1e'),_0x3773e4[_0x7be2('0x1f')]);var _0x56e82e=[_0x7be2('0x20'),_0x7be2('0x21')];var _0x1e4dc6=Buffer[_0x7be2('0x22')](JSON[_0x7be2('0x23')]({'id':_0x4c1546}))['toString']('base64');var _0x5c5220=crypto[_0x7be2('0x24')](0x10)['toString'](_0x7be2('0x25'));var _0x47e7aa=getAuthorizationScopes(_0x3773e4);var _0x5142e4=[{'key':_0x7be2('0x26'),'value':_0x3773e4[_0x7be2('0x27')]},{'key':_0x7be2('0x28'),'value':encodeURIComponent(_0x56e82e[_0x7be2('0x1c')]('\x20'))},{'key':_0x7be2('0x29'),'value':_0x3773e4[_0x7be2('0x2a')]},{'key':'response_mode','value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x47e7aa)},{'key':_0x7be2('0x2b'),'value':_0x1e4dc6},{'key':'nonce','value':_0x5c5220},{'key':_0x7be2('0x2c'),'value':_0x7be2('0x2d')}];var _0x546553=_0x2cdfd5+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7be2('0x17')](_0x5142e4,function(_0x4e1f42){return _0x4e1f42[_0x7be2('0x2e')]+'='+_0x4e1f42[_0x7be2('0x2f')];})[_0x7be2('0x1c')]('&');_0x3773e4['oauth2Claims']={'issuer':_0x2cdfd5[_0x7be2('0x30')]('oauth2/',''),'audience':_0x3773e4[_0x7be2('0x27')],'state':_0x1e4dc6,'nonce':_0x5c5220};redis[_0x7be2('0x31')](_0x1e4dc6,JSON[_0x7be2('0x23')](_0x3773e4));return _0x546553;}function isValidIdToken(_0x2a7273,_0x1ddd4e){try{var _0xab8c17=jwt['decode'](_0x2a7273,{'complete':!![]});var _0x5bdd2c=_0xab8c17['payload'];if(_0x5bdd2c[_0x7be2('0x32')]!==_0x1ddd4e['issuer'])return![];if(_0x5bdd2c['aud']!==_0x1ddd4e[_0x7be2('0x33')])return![];if(_0x5bdd2c[_0x7be2('0x34')]!==_0x1ddd4e[_0x7be2('0x34')])return![];if(moment()[_0x7be2('0x35')](moment[_0x7be2('0x36')](_0x5bdd2c[_0x7be2('0x37')])))return![];return!![];}catch(_0x4d5203){throw _0x4d5203;}}function refreshOauth2MicrosoftAccessToken(_0x1ebbfc){return Promise['resolve']()['then'](function(){if(_0x1ebbfc[_0x7be2('0x38')])return _0x1ebbfc;return db['CloudProvider']['findOne']({'where':{'id':_0x1ebbfc['id']},'raw':!![]});})['then'](function(_0x6d057a){var _0x315353={'grant_type':_0x7be2('0x39'),'refresh_token':_0x6d057a[_0x7be2('0x3a')],'scope':getAccessTokenScope(_0x6d057a),'redirect_uri':_0x6d057a[_0x7be2('0x2a')],'client_id':_0x6d057a['data1'],'client_secret':encryptor['decryptString'](_0x6d057a[_0x7be2('0x38')])};var _0x408f76={'method':_0x7be2('0x3b'),'uri':MICROSOFT_AUTH_URL[_0x7be2('0x30')](_0x7be2('0x1e'),_0x6d057a[_0x7be2('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x315353,'json':!![]};return rp(_0x408f76);})[_0x7be2('0x3c')](function(_0x734a13){_0x1ebbfc['data5']=_0x734a13[_0x7be2('0x3d')];_0x1ebbfc[_0x7be2('0x3a')]=_0x734a13[_0x7be2('0x39')];return db[_0x7be2('0x3e')][_0x7be2('0x3f')]({'data5':_0x1ebbfc[_0x7be2('0x40')],'data6':_0x1ebbfc[_0x7be2('0x3a')]},{'where':{'id':_0x1ebbfc['id']}});})[_0x7be2('0x3c')](function(){return _0x1ebbfc;})[_0x7be2('0x41')](function(_0x3e6e34){logger[_0x7be2('0x42')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x1ebbfc['id'],_0x3e6e34);});}function getOauth2MicrosoftAccessToken(_0x334212,_0x57e296){var _0x207368={'grant_type':'authorization_code','code':_0x334212,'scope':getAccessTokenScope(_0x57e296),'redirect_uri':_0x57e296['data4'],'client_id':_0x57e296['data1'],'client_secret':encryptor[_0x7be2('0x43')](_0x57e296[_0x7be2('0x38')])};var _0xb43ab7={'method':_0x7be2('0x3b'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7be2('0x1e'),_0x57e296['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x207368,'json':!![]};return rp(_0xb43ab7);}function startRefreshInterval(_0x11e585){var _0x6745cc=schedule['intervals'];if(_0x6745cc[_0x11e585['id']])clearInterval(_0x6745cc[_0x11e585['id']]);_0x6745cc[_0x11e585['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7be2('0x44')](this,{'id':_0x11e585['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7be2('0x45')]=_0x6745cc;}function startAllRefreshIntervals(){return db[_0x7be2('0x3e')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x41e00a){var _0x542c5b=_0x41e00a[_0x7be2('0x17')](function(_0x535844){return refreshOauth2MicrosoftAccessToken(_0x535844)[_0x7be2('0x3c')](function(_0x10db97){startRefreshInterval(_0x10db97);});});return Promise['all'](_0x542c5b);})[_0x7be2('0x41')](function(_0x1fddb5){var _0x362f1c=_0x1fddb5?util[_0x7be2('0x46')](_0x1fddb5,{'showHidden':![],'depth':null}):'';logger[_0x7be2('0x42')](_0x7be2('0x47'),_0x362f1c);});}module[_0x7be2('0x48')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x2ac4=['key','value','oauth2Claims','decode','payload','iss','aud','isAfter','unix','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','data5','update','catch','error','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','hex','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login'];(function(_0xe5a2a5,_0x46f77f){var _0x4a9c68=function(_0x45cfb9){while(--_0x45cfb9){_0xe5a2a5['push'](_0xe5a2a5['shift']());}};_0x4a9c68(++_0x46f77f);}(_0x2ac4,0x6b));var _0x42ac=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x2ac4[_0x2a5b3b];return _0xae665a;};'use strict';var _=require(_0x42ac('0x0'));var crypto=require(_0x42ac('0x1'));var jwt=require(_0x42ac('0x2'));var moment=require(_0x42ac('0x3'));var Redis=require(_0x42ac('0x4'));var rp=require(_0x42ac('0x5'));var util=require('util');var encryptor=require(_0x42ac('0x6'));var config=require(_0x42ac('0x7'));var logger=require(_0x42ac('0x8'))(_0x42ac('0x9'));var schedule=require(_0x42ac('0xa'));var db=require(_0x42ac('0xb'))['db'];config['redis']=_['defaults'](config[_0x42ac('0xc')],{'host':_0x42ac('0xd'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x42ac('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x42ac('0xf'),_0x42ac('0x10'),_0x42ac('0x11'),_0x42ac('0x12'),_0x42ac('0x13'),_0x42ac('0x14'),_0x42ac('0x15')],'Dynamics365':[_0x42ac('0xf'),_0x42ac('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x42ac('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0x42ac('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x49c15b){var _0xa1c487=_[_0x42ac('0x18')](AZURE_AUTH_SCOPES[_0x49c15b[_0x42ac('0x19')]]);if(_0x49c15b[_0x42ac('0x19')]===_0x42ac('0x1a'))_0xa1c487[_0x42ac('0x1b')](_0x49c15b[_0x42ac('0x1c')]+'/.default');return _0xa1c487['join']('\x20');}function getAccessTokenScope(_0x460d4e){if(_0x460d4e['type']==='Outlook365')return _0x42ac('0x13');if(_0x460d4e['type']===_0x42ac('0x1a'))return _0x460d4e[_0x42ac('0x1c')]+_0x42ac('0x1d');}function generateMicrosoftAuthorizationUrl(_0x56f9e2,_0x3105bd){var _0x288a07=MICROSOFT_AUTH_URL[_0x42ac('0x1e')](_0x42ac('0x1f'),_0x56f9e2[_0x42ac('0x20')]);var _0x5a0c8c=[_0x42ac('0x21'),_0x42ac('0x22')];var _0x2c81f6=Buffer[_0x42ac('0x23')](JSON[_0x42ac('0x24')]({'id':_0x3105bd}))[_0x42ac('0x25')](_0x42ac('0x26'));var _0x196613=crypto['randomBytes'](0x10)[_0x42ac('0x25')](_0x42ac('0x27'));var _0x3ffc22=getAuthorizationScopes(_0x56f9e2);var _0x3ba736=[{'key':'client_id','value':_0x56f9e2[_0x42ac('0x28')]},{'key':_0x42ac('0x29'),'value':encodeURIComponent(_0x5a0c8c[_0x42ac('0x2a')]('\x20'))},{'key':_0x42ac('0x2b'),'value':_0x56f9e2[_0x42ac('0x2c')]},{'key':_0x42ac('0x2d'),'value':_0x42ac('0x2e')},{'key':_0x42ac('0x2f'),'value':encodeURIComponent(_0x3ffc22)},{'key':'state','value':_0x2c81f6},{'key':_0x42ac('0x30'),'value':_0x196613},{'key':_0x42ac('0x31'),'value':_0x42ac('0x32')}];var _0x39df6f=_0x288a07+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x42ac('0x18')](_0x3ba736,function(_0x5ee29d){return _0x5ee29d[_0x42ac('0x33')]+'='+_0x5ee29d[_0x42ac('0x34')];})['join']('&');_0x56f9e2[_0x42ac('0x35')]={'issuer':_0x288a07[_0x42ac('0x1e')]('oauth2/',''),'audience':_0x56f9e2[_0x42ac('0x28')],'state':_0x2c81f6,'nonce':_0x196613};redis['set'](_0x2c81f6,JSON[_0x42ac('0x24')](_0x56f9e2));return _0x39df6f;}function isValidIdToken(_0x290702,_0x3fd743){try{var _0x5218bc=jwt[_0x42ac('0x36')](_0x290702,{'complete':!![]});var _0x38e593=_0x5218bc[_0x42ac('0x37')];if(_0x38e593[_0x42ac('0x38')]!==_0x3fd743['issuer'])return![];if(_0x38e593[_0x42ac('0x39')]!==_0x3fd743['audience'])return![];if(_0x38e593[_0x42ac('0x30')]!==_0x3fd743[_0x42ac('0x30')])return![];if(moment()[_0x42ac('0x3a')](moment[_0x42ac('0x3b')](_0x38e593['exp'])))return![];return!![];}catch(_0x1247a9){throw _0x1247a9;}}function refreshOauth2MicrosoftAccessToken(_0x33c231){return Promise[_0x42ac('0x3c')]()[_0x42ac('0x3d')](function(){if(_0x33c231['data3'])return _0x33c231;return db[_0x42ac('0x3e')][_0x42ac('0x3f')]({'where':{'id':_0x33c231['id']},'raw':!![]});})[_0x42ac('0x3d')](function(_0x168b3a){var _0x382ace={'grant_type':_0x42ac('0x40'),'refresh_token':_0x168b3a[_0x42ac('0x41')],'scope':getAccessTokenScope(_0x168b3a),'redirect_uri':_0x168b3a[_0x42ac('0x2c')],'client_id':_0x168b3a[_0x42ac('0x28')],'client_secret':encryptor[_0x42ac('0x42')](_0x168b3a[_0x42ac('0x43')])};var _0x5ea092={'method':_0x42ac('0x44'),'uri':MICROSOFT_AUTH_URL[_0x42ac('0x1e')](_0x42ac('0x1f'),_0x168b3a[_0x42ac('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x382ace,'json':!![]};return rp(_0x5ea092);})['then'](function(_0x4211f4){_0x33c231[_0x42ac('0x45')]=_0x4211f4['access_token'];_0x33c231[_0x42ac('0x41')]=_0x4211f4['refresh_token'];return db['CloudProvider'][_0x42ac('0x46')]({'data5':_0x33c231['data5'],'data6':_0x33c231[_0x42ac('0x41')]},{'where':{'id':_0x33c231['id']}});})['then'](function(){return _0x33c231;})[_0x42ac('0x47')](function(_0x2491c2){logger[_0x42ac('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x33c231['id'],_0x2491c2);});}function getOauth2MicrosoftAccessToken(_0x34f57a,_0x1b9922){var _0x1d7753={'grant_type':_0x42ac('0x49'),'code':_0x34f57a,'scope':getAccessTokenScope(_0x1b9922),'redirect_uri':_0x1b9922[_0x42ac('0x2c')],'client_id':_0x1b9922[_0x42ac('0x28')],'client_secret':encryptor[_0x42ac('0x42')](_0x1b9922[_0x42ac('0x43')])};var _0x5ce8e3={'method':_0x42ac('0x44'),'uri':MICROSOFT_AUTH_URL[_0x42ac('0x1e')](_0x42ac('0x1f'),_0x1b9922['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1d7753,'json':!![]};return rp(_0x5ce8e3);}function startRefreshInterval(_0x38d855){var _0x2c89be=schedule[_0x42ac('0x4a')];if(_0x2c89be[_0x38d855['id']])clearInterval(_0x2c89be[_0x38d855['id']]);_0x2c89be[_0x38d855['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x38d855['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x42ac('0x4a')]=_0x2c89be;}function startAllRefreshIntervals(){return db[_0x42ac('0x3e')][_0x42ac('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x42ac('0x3d')](function(_0x55cffc){var _0x53439f=_0x55cffc[_0x42ac('0x18')](function(_0x2c844f){return refreshOauth2MicrosoftAccessToken(_0x2c844f)[_0x42ac('0x3d')](function(_0x3db415){startRefreshInterval(_0x3db415);});});return Promise[_0x42ac('0x4c')](_0x53439f);})[_0x42ac('0x47')](function(_0x4164cd){var _0x5343c5=_0x4164cd?util[_0x42ac('0x4d')](_0x4164cd,{'showHidden':![],'depth':null}):'';logger[_0x42ac('0x48')](_0x42ac('0x4e'),_0x5343c5);});}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 a0a97e3..a521adc 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 _0x97b2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x141a71,_0x53016f){var _0xc615a3=function(_0x3122a9){while(--_0x3122a9){_0x141a71['push'](_0x141a71['shift']());}};_0xc615a3(++_0x53016f);}(_0x97b2,0x1b7));var _0x297b=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0x97b2[_0x2fcf18];return _0x4c68cc;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var moment=require(_0x297b('0x2'));var BPromise=require(_0x297b('0x3'));var rs=require(_0x297b('0x4'));var fs=require('fs');var Redis=require(_0x297b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x297b('0x6'));var logger=require(_0x297b('0x7'))('rpc');var config=require(_0x297b('0x8'));var jayson=require(_0x297b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x541d7b,_0x2c5bf5,_0x18a663){return new BPromise(function(_0x520b38,_0x27a761){return client[_0x297b('0xa')](_0x541d7b,_0x18a663)['then'](function(_0x176f98){logger['info'](_0x297b('0xb'),_0x2c5bf5,'request\x20sent');logger[_0x297b('0xc')](_0x297b('0xd'),_0x2c5bf5,_0x297b('0xe'),JSON[_0x297b('0xf')](_0x176f98));if(_0x176f98[_0x297b('0x10')]){if(_0x176f98[_0x297b('0x10')][_0x297b('0x11')]===0x1f4){logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x176f98[_0x297b('0x10')][_0x297b('0x12')]);return _0x27a761(_0x176f98[_0x297b('0x10')][_0x297b('0x12')]);}logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x176f98['error'][_0x297b('0x12')]);return _0x520b38(_0x176f98[_0x297b('0x10')]['message']);}else{logger[_0x297b('0x13')](_0x297b('0xb'),_0x2c5bf5,_0x297b('0xe'));_0x520b38(_0x176f98[_0x297b('0x14')][_0x297b('0x12')]);}})[_0x297b('0x15')](function(_0x4882a4){logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x4882a4);_0x27a761(_0x4882a4);});});} \ No newline at end of file +var _0x3e22=['http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','CloudProvider,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x3d07f2,_0x19854d){var _0x26052a=function(_0x213834){while(--_0x213834){_0x3d07f2['push'](_0x3d07f2['shift']());}};_0x26052a(++_0x19854d);}(_0x3e22,0xa8));var _0x23e2=function(_0x271191,_0x3486bf){_0x271191=_0x271191-0x0;var _0x2765db=_0x3e22[_0x271191];return _0x2765db;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var moment=require('moment');var BPromise=require(_0x23e2('0x1'));var rs=require(_0x23e2('0x2'));var fs=require('fs');var Redis=require(_0x23e2('0x3'));var db=require(_0x23e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23e2('0x5'));var config=require(_0x23e2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x23e2('0x7')][_0x23e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a8351,_0x927fbb,_0xb71434){return new BPromise(function(_0x4c13ae,_0x64c91b){return client[_0x23e2('0x9')](_0x3a8351,_0xb71434)[_0x23e2('0xa')](function(_0x75da0a){logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));logger[_0x23e2('0xd')](_0x23e2('0xe'),_0x927fbb,_0x23e2('0xc'),JSON[_0x23e2('0xf')](_0x75da0a));if(_0x75da0a['error']){if(_0x75da0a['error'][_0x23e2('0x10')]===0x1f4){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x64c91b(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x4c13ae(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}else{logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));_0x4c13ae(_0x75da0a[_0x23e2('0x14')][_0x23e2('0x13')]);}})[_0x23e2('0x15')](function(_0x276c2d){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x276c2d);_0x64c91b(_0x276c2d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f3f9a61..2aae8bc 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x7a54,0x106));var _0x47a5=function(_0x7379ff,_0x28e37b){_0x7379ff=_0x7379ff-0x0;var _0x261e71=_0x7a54[_0x7379ff];return _0x261e71;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _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(_0x486e22,_0x391ba0){var _0x35b822=function(_0x212e11){while(--_0x212e11){_0x486e22['push'](_0x486e22['shift']());}};_0x35b822(++_0x391ba0);}(_0x2ef3,0xba));var _0x32ef=function(_0x2d7a02,_0x355848){_0x2d7a02=_0x2d7a02-0x0;var _0x2d3275=_0x2ef3[_0x2d7a02];return _0x2d3275;};'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 cb78472..deb9333 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 _0x7e2b=['exports','STRING','name','sequelize'];(function(_0x4c953c,_0x2edbb8){var _0xfa0543=function(_0x2d2cb1){while(--_0x2d2cb1){_0x4c953c['push'](_0x4c953c['shift']());}};_0xfa0543(++_0x2edbb8);}(_0x7e2b,0x67));var _0xb7e2=function(_0x117913,_0x4fd262){_0x117913=_0x117913-0x0;var _0xb8eacb=_0x7e2b[_0x117913];return _0xb8eacb;};'use strict';var Sequelize=require(_0xb7e2('0x0'));module[_0xb7e2('0x1')]={'name':{'type':Sequelize[_0xb7e2('0x2')],'unique':_0xb7e2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb7e2('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb7e2('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb7e2('0x2')]},'street':{'type':Sequelize[_0xb7e2('0x2')]},'postalCode':{'type':Sequelize[_0xb7e2('0x2')]},'city':{'type':Sequelize[_0xb7e2('0x2')]},'country':{'type':Sequelize[_0xb7e2('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb7e2('0x2')]},'sStreet':{'type':Sequelize[_0xb7e2('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xb7e2('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb7e2('0x2')]}}; \ No newline at end of file +var _0x5a1d=['exports','STRING','name','sequelize'];(function(_0x38bb34,_0x2e1c6b){var _0xdf1945=function(_0x24b6ba){while(--_0x24b6ba){_0x38bb34['push'](_0x38bb34['shift']());}};_0xdf1945(++_0x2e1c6b);}(_0x5a1d,0xa3));var _0xd5a1=function(_0x2e3ceb,_0x2fb08d){_0x2e3ceb=_0x2e3ceb-0x0;var _0x39c28f=_0x5a1d[_0x2e3ceb];return _0x39c28f;};'use strict';var Sequelize=require(_0xd5a1('0x0'));module[_0xd5a1('0x1')]={'name':{'type':Sequelize[_0xd5a1('0x2')],'unique':_0xd5a1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd5a1('0x2')]},'companyId':{'type':Sequelize[_0xd5a1('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd5a1('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xd5a1('0x2')]},'email':{'type':Sequelize[_0xd5a1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd5a1('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xd5a1('0x2')]},'sCountry':{'type':Sequelize[_0xd5a1('0x2')]},'description':{'type':Sequelize[_0xd5a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d369e2b..7df6949 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 _0xa0d1=['destroy','get','Companies','UserProfileResource','error','stack','name','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','describe','addContacts','ids','omit','getContacts','CmContact','eml-format','rimraf','request-promise','moment','bluebird','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0xe05e88,_0x54cbaf){var _0x4dde32=function(_0x17deca){while(--_0x17deca){_0xe05e88['push'](_0xe05e88['shift']());}};_0x4dde32(++_0x54cbaf);}(_0xa0d1,0x131));var _0x1a0d=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xa0d1[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x1a0d('0x0'));var rimraf=require(_0x1a0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a0d('0x2'));var moment=require(_0x1a0d('0x3'));var BPromise=require(_0x1a0d('0x4'));var Mustache=require(_0x1a0d('0x5'));var util=require(_0x1a0d('0x6'));var path=require(_0x1a0d('0x7'));var sox=require(_0x1a0d('0x8'));var csv=require(_0x1a0d('0x9'));var ejs=require(_0x1a0d('0xa'));var fs=require('fs');var fs_extra=require(_0x1a0d('0xb'));var _=require('lodash');var squel=require(_0x1a0d('0xc'));var crypto=require(_0x1a0d('0xd'));var jsforce=require(_0x1a0d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1a0d('0x9'));var querystring=require(_0x1a0d('0xf'));var Papa=require(_0x1a0d('0x10'));var Redis=require(_0x1a0d('0x11'));var authService=require(_0x1a0d('0x12'));var qs=require(_0x1a0d('0x13'));var as=require(_0x1a0d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a0d('0x15'))(_0x1a0d('0x16'));var utils=require('../../config/utils');var config=require(_0x1a0d('0x17'));var licenseUtil=require(_0x1a0d('0x18'));var db=require(_0x1a0d('0x19'))['db'];function respondWithStatusCode(_0x18be62,_0x5f47b7){_0x5f47b7=_0x5f47b7||0xcc;return function(_0x5ddc78){if(_0x5ddc78){return _0x18be62[_0x1a0d('0x1a')](_0x5f47b7);}return _0x18be62['status'](_0x5f47b7)[_0x1a0d('0x1b')]();};}function respondWithResult(_0x111e0c,_0xad2c6c){_0xad2c6c=_0xad2c6c||0xc8;return function(_0x403050){if(_0x403050){return _0x111e0c[_0x1a0d('0x1c')](_0xad2c6c)[_0x1a0d('0x1d')](_0x403050);}};}function respondWithFilteredResult(_0x2e0329,_0x140820){return function(_0x369ca0){if(_0x369ca0){var _0x201a77=typeof _0x140820['offset']===_0x1a0d('0x1e')&&typeof _0x140820['limit']===_0x1a0d('0x1e');var _0x5d25d9=_0x369ca0['count'];var _0x4461ee=_0x201a77?0x0:_0x140820[_0x1a0d('0x1f')];var _0x55d881=_0x201a77?_0x369ca0['count']:_0x140820[_0x1a0d('0x1f')]+_0x140820[_0x1a0d('0x20')];var _0x1b7e38;if(_0x55d881>=_0x5d25d9){_0x55d881=_0x5d25d9;_0x1b7e38=0xc8;}else{_0x1b7e38=0xce;}_0x2e0329['status'](_0x1b7e38);return _0x2e0329[_0x1a0d('0x21')](_0x1a0d('0x22'),_0x4461ee+'-'+_0x55d881+'/'+_0x5d25d9)[_0x1a0d('0x1d')](_0x369ca0);}return null;};}function patchUpdates(_0x2e8848){return function(_0x185df4){try{jsonpatch[_0x1a0d('0x23')](_0x185df4,_0x2e8848,!![]);}catch(_0x15a0c1){return BPromise['reject'](_0x15a0c1);}return _0x185df4[_0x1a0d('0x24')]();};}function saveUpdates(_0x341c6c,_0x59e6e9){return function(_0x26e6f9){if(_0x26e6f9){return _0x26e6f9[_0x1a0d('0x25')](_0x341c6c)[_0x1a0d('0x26')](function(_0x3892b4){return _0x3892b4;});}return null;};}function removeEntity(_0x59e0a0,_0x53d740){return function(_0x47ea5d){if(_0x47ea5d){return _0x47ea5d[_0x1a0d('0x27')]()['then'](function(){var _0x408082=_0x47ea5d[_0x1a0d('0x28')]({'plain':!![]});var _0x5d0b13=_0x1a0d('0x29');return db[_0x1a0d('0x2a')][_0x1a0d('0x27')]({'where':{'type':_0x5d0b13,'resourceId':_0x408082['id']}})[_0x1a0d('0x26')](function(){return _0x47ea5d;});})[_0x1a0d('0x26')](function(){_0x59e0a0[_0x1a0d('0x1c')](0xcc)[_0x1a0d('0x1b')]();});}};}function handleEntityNotFound(_0x97e1fd,_0x12ae9e){return function(_0x196769){if(!_0x196769){_0x97e1fd[_0x1a0d('0x1a')](0x194);}return _0x196769;};}function handleError(_0x2f748b,_0x2981f8){_0x2981f8=_0x2981f8||0x1f4;return function(_0x522965){logger[_0x1a0d('0x2b')](_0x522965[_0x1a0d('0x2c')]);if(_0x522965['name']){delete _0x522965[_0x1a0d('0x2d')];}_0x2f748b['status'](_0x2981f8)['send'](_0x522965);};}exports[_0x1a0d('0x2e')]=function(_0x3063c2,_0x3ea4b3){var _0x1980ec={},_0x156e63={},_0x56a848={'count':0x0,'rows':[]};return db[_0x1a0d('0x2f')]['describe']()['then'](function(_0x3e7f90){_0x156e63[_0x1a0d('0x30')]=_[_0x1a0d('0x31')](_0x3e7f90);_0x156e63[_0x1a0d('0x32')]=_['keys'](_0x3063c2[_0x1a0d('0x32')]);_0x156e63[_0x1a0d('0x33')]=_[_0x1a0d('0x34')](_0x156e63[_0x1a0d('0x30')],_0x156e63[_0x1a0d('0x32')]);_0x1980ec[_0x1a0d('0x35')]=_[_0x1a0d('0x34')](_0x156e63[_0x1a0d('0x30')],qs[_0x1a0d('0x36')](_0x3063c2['query'][_0x1a0d('0x36')]));_0x1980ec['attributes']=_0x1980ec[_0x1a0d('0x35')][_0x1a0d('0x37')]?_0x1980ec[_0x1a0d('0x35')]:_0x156e63[_0x1a0d('0x30')];if(!_0x3063c2[_0x1a0d('0x32')][_0x1a0d('0x38')](_0x1a0d('0x39'))){_0x1980ec[_0x1a0d('0x20')]=qs['limit'](_0x3063c2['query']['limit']);_0x1980ec[_0x1a0d('0x1f')]=qs[_0x1a0d('0x1f')](_0x3063c2[_0x1a0d('0x32')][_0x1a0d('0x1f')]);}_0x1980ec[_0x1a0d('0x3a')]=qs[_0x1a0d('0x3b')](_0x3063c2[_0x1a0d('0x32')][_0x1a0d('0x3b')]);_0x1980ec[_0x1a0d('0x3c')]=qs['filters'](_['pick'](_0x3063c2[_0x1a0d('0x32')],_0x156e63[_0x1a0d('0x33')]),_0x3e7f90);if(_0x3063c2[_0x1a0d('0x32')][_0x1a0d('0x3d')]){_0x1980ec['where']=_[_0x1a0d('0x3e')](_0x1980ec[_0x1a0d('0x3c')],{'$or':_[_0x1a0d('0x3f')](_0x1980ec['attributes'],function(_0x1f7362){var _0x5ed23d={};_0x5ed23d[_0x1f7362]={'$like':'%'+_0x3063c2[_0x1a0d('0x32')]['filter']+'%'};return _0x5ed23d;})});}_0x1980ec=_[_0x1a0d('0x3e')]({},_0x1980ec,_0x3063c2[_0x1a0d('0x40')]);var _0x5914a1={'where':_0x1980ec[_0x1a0d('0x3c')]};return db[_0x1a0d('0x2f')][_0x1a0d('0x41')](_0x5914a1)[_0x1a0d('0x26')](function(_0x380dfc){_0x56a848[_0x1a0d('0x41')]=_0x380dfc;if(_0x3063c2['query'][_0x1a0d('0x42')]){_0x1980ec[_0x1a0d('0x43')]=[{'all':!![]}];}return db[_0x1a0d('0x2f')][_0x1a0d('0x44')](_0x1980ec);})[_0x1a0d('0x26')](function(_0xa22b45){_0x56a848[_0x1a0d('0x45')]=_0xa22b45;return _0x56a848;})[_0x1a0d('0x26')](respondWithFilteredResult(_0x3ea4b3,_0x1980ec))['catch'](handleError(_0x3ea4b3,null));})[_0x1a0d('0x46')](handleError(_0x3ea4b3,null));};exports[_0x1a0d('0x47')]=function(_0x2d1c0c,_0x1e52c3){var _0x1b5525={'raw':![],'where':{'id':_0x2d1c0c[_0x1a0d('0x48')]['id']}},_0x28c272={};_0x28c272[_0x1a0d('0x30')]=_[_0x1a0d('0x31')](db[_0x1a0d('0x2f')][_0x1a0d('0x49')]);_0x28c272[_0x1a0d('0x32')]=_[_0x1a0d('0x31')](_0x2d1c0c['query']);_0x28c272[_0x1a0d('0x33')]=_[_0x1a0d('0x34')](_0x28c272['model'],_0x28c272[_0x1a0d('0x32')]);_0x1b5525[_0x1a0d('0x35')]=_[_0x1a0d('0x34')](_0x28c272['model'],qs[_0x1a0d('0x36')](_0x2d1c0c[_0x1a0d('0x32')][_0x1a0d('0x36')]));_0x1b5525[_0x1a0d('0x35')]=_0x1b5525[_0x1a0d('0x35')][_0x1a0d('0x37')]?_0x1b5525[_0x1a0d('0x35')]:_0x28c272[_0x1a0d('0x30')];if(_0x2d1c0c[_0x1a0d('0x32')][_0x1a0d('0x42')]){_0x1b5525[_0x1a0d('0x43')]=[{'all':!![]}];}_0x1b5525=_[_0x1a0d('0x3e')]({},_0x1b5525,_0x2d1c0c['options']);return db[_0x1a0d('0x2f')][_0x1a0d('0x4a')](_0x1b5525)['then'](handleEntityNotFound(_0x1e52c3,null))['then'](respondWithResult(_0x1e52c3,null))[_0x1a0d('0x46')](handleError(_0x1e52c3,null));};exports[_0x1a0d('0x4b')]=function(_0x2cb276,_0x580c78){return db['CmCompany'][_0x1a0d('0x4b')](_0x2cb276[_0x1a0d('0x4c')],{})[_0x1a0d('0x26')](function(_0x2bf37e){var _0x5cb045=_0x2cb276[_0x1a0d('0x4d')][_0x1a0d('0x28')]({'plain':!![]});if(!_0x5cb045)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cb045[_0x1a0d('0x4e')]===_0x1a0d('0x4d')){var _0x3d3abd=_0x2bf37e[_0x1a0d('0x28')]({'plain':!![]});var _0x2b46d3=_0x1a0d('0x29');return db[_0x1a0d('0x4f')][_0x1a0d('0x4a')]({'where':{'name':_0x2b46d3,'userProfileId':_0x5cb045['userProfileId']},'raw':!![]})[_0x1a0d('0x26')](function(_0x554534){if(_0x554534&&_0x554534['autoAssociation']===0x0){return db[_0x1a0d('0x2a')][_0x1a0d('0x4b')]({'name':_0x3d3abd[_0x1a0d('0x2d')],'resourceId':_0x3d3abd['id'],'type':_0x554534[_0x1a0d('0x2d')],'sectionId':_0x554534['id']},{})[_0x1a0d('0x26')](function(){return _0x2bf37e;});}else{return _0x2bf37e;}})[_0x1a0d('0x46')](function(_0x501f80){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x501f80);throw _0x501f80;});}return _0x2bf37e;})[_0x1a0d('0x26')](respondWithResult(_0x580c78,0xc9))['catch'](handleError(_0x580c78,null));};exports[_0x1a0d('0x25')]=function(_0x31a0ab,_0x31923b){if(_0x31a0ab[_0x1a0d('0x4c')]['id']){delete _0x31a0ab[_0x1a0d('0x4c')]['id'];}return db[_0x1a0d('0x2f')][_0x1a0d('0x4a')]({'where':{'id':_0x31a0ab[_0x1a0d('0x48')]['id']}})[_0x1a0d('0x26')](handleEntityNotFound(_0x31923b,null))[_0x1a0d('0x26')](saveUpdates(_0x31a0ab[_0x1a0d('0x4c')],null))[_0x1a0d('0x26')](respondWithResult(_0x31923b,null))[_0x1a0d('0x46')](handleError(_0x31923b,null));};exports['destroy']=function(_0x5242d7,_0x585d79){return db[_0x1a0d('0x2f')][_0x1a0d('0x4a')]({'where':{'id':_0x5242d7['params']['id']}})[_0x1a0d('0x26')](handleEntityNotFound(_0x585d79,null))[_0x1a0d('0x26')](removeEntity(_0x585d79,null))[_0x1a0d('0x46')](handleError(_0x585d79,null));};exports[_0x1a0d('0x50')]=function(_0x1fb454,_0x443d6a){return db[_0x1a0d('0x2f')][_0x1a0d('0x50')]()[_0x1a0d('0x26')](respondWithResult(_0x443d6a,null))['catch'](handleError(_0x443d6a,null));};exports[_0x1a0d('0x51')]=function(_0x48a47a,_0x26a112,_0x1245c4){return db['CmContact'][_0x1a0d('0x4a')]({'where':{'id':_0x48a47a[_0x1a0d('0x48')]['id']}})[_0x1a0d('0x26')](handleEntityNotFound(_0x26a112,null))[_0x1a0d('0x26')](function(_0xce5c64){if(_0xce5c64){return _0xce5c64[_0x1a0d('0x51')](_0x48a47a[_0x1a0d('0x4c')][_0x1a0d('0x52')],_[_0x1a0d('0x53')](_0x48a47a[_0x1a0d('0x4c')],['ids','id'])||{});}})[_0x1a0d('0x26')](respondWithResult(_0x26a112,null))['catch'](handleError(_0x26a112,null));};exports[_0x1a0d('0x54')]=function(_0x257381,_0x28d4bf,_0x14548a){var _0x4707f8={};var _0x3fb6f7={};var _0x4b0ad8;var _0x260cd4;return db['CmCompany']['findOne']({'where':{'id':_0x257381[_0x1a0d('0x48')]['id']}})[_0x1a0d('0x26')](handleEntityNotFound(_0x28d4bf,null))['then'](function(_0x43f9d3){if(_0x43f9d3){_0x4b0ad8=_0x43f9d3;_0x3fb6f7[_0x1a0d('0x30')]=_[_0x1a0d('0x31')](db[_0x1a0d('0x55')][_0x1a0d('0x49')]);_0x3fb6f7[_0x1a0d('0x32')]=_['keys'](_0x257381['query']);_0x3fb6f7[_0x1a0d('0x33')]=_[_0x1a0d('0x34')](_0x3fb6f7[_0x1a0d('0x30')],_0x3fb6f7[_0x1a0d('0x32')]);_0x4707f8[_0x1a0d('0x35')]=_[_0x1a0d('0x34')](_0x3fb6f7[_0x1a0d('0x30')],qs[_0x1a0d('0x36')](_0x257381[_0x1a0d('0x32')][_0x1a0d('0x36')]));_0x4707f8[_0x1a0d('0x35')]=_0x4707f8[_0x1a0d('0x35')][_0x1a0d('0x37')]?_0x4707f8[_0x1a0d('0x35')]:_0x3fb6f7[_0x1a0d('0x30')];_0x4707f8[_0x1a0d('0x3a')]=qs[_0x1a0d('0x3b')](_0x257381[_0x1a0d('0x32')]['sort']);_0x4707f8[_0x1a0d('0x3c')]=qs[_0x1a0d('0x33')](_['pick'](_0x257381[_0x1a0d('0x32')],_0x3fb6f7[_0x1a0d('0x33')]));if(_0x257381[_0x1a0d('0x32')]['filter']){_0x4707f8[_0x1a0d('0x3c')]=_[_0x1a0d('0x3e')](_0x4707f8[_0x1a0d('0x3c')],{'$or':_[_0x1a0d('0x3f')](_0x4707f8['attributes'],function(_0x135c38){var _0x1d76a={};_0x1d76a[_0x135c38]={'$like':'%'+_0x257381[_0x1a0d('0x32')][_0x1a0d('0x3d')]+'%'};return _0x1d76a;})});}_0x4707f8=_[_0x1a0d('0x3e')]({},_0x4707f8,_0x257381[_0x1a0d('0x40')]);return _0x4b0ad8['getContacts'](_0x4707f8);}})[_0x1a0d('0x26')](function(_0x428cc9){if(_0x428cc9){_0x260cd4=_0x428cc9[_0x1a0d('0x37')];if(!_0x257381['query']['hasOwnProperty'](_0x1a0d('0x39'))){_0x4707f8[_0x1a0d('0x20')]=qs['limit'](_0x257381[_0x1a0d('0x32')][_0x1a0d('0x20')]);_0x4707f8[_0x1a0d('0x1f')]=qs[_0x1a0d('0x1f')](_0x257381[_0x1a0d('0x32')][_0x1a0d('0x1f')]);}return _0x4b0ad8[_0x1a0d('0x54')](_0x4707f8);}})[_0x1a0d('0x26')](function(_0x266c8a){if(_0x266c8a){return _0x266c8a?{'count':_0x260cd4,'rows':_0x266c8a}:null;}})[_0x1a0d('0x26')](respondWithResult(_0x28d4bf,null))[_0x1a0d('0x46')](handleError(_0x28d4bf,null));}; \ No newline at end of file +var _0x757a=['getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','undefined','offset','count','set','json','apply','save','update','then','get','Companies','UserProfileResource','end','stack','name','send','index','CmCompany','describe','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','addContacts','ids','omit','CmContact','map'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x757a,0x103));var _0xa757=function(_0x884245,_0x2d5d70){_0x884245=_0x884245-0x0;var _0x187754=_0x757a[_0x884245];return _0x187754;};'use strict';var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require(_0xa757('0x2'));var jsonpatch=require(_0xa757('0x3'));var rp=require(_0xa757('0x4'));var moment=require(_0xa757('0x5'));var BPromise=require(_0xa757('0x6'));var Mustache=require(_0xa757('0x7'));var util=require('util');var path=require(_0xa757('0x8'));var sox=require(_0xa757('0x9'));var csv=require(_0xa757('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0xb'));var _=require(_0xa757('0xc'));var squel=require(_0xa757('0xd'));var crypto=require('crypto');var jsforce=require(_0xa757('0xe'));var deskjs=require(_0xa757('0xf'));var toCsv=require(_0xa757('0xa'));var querystring=require(_0xa757('0x10'));var Papa=require(_0xa757('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa757('0x12'));var as=require(_0xa757('0x13'));var hardwareService=require(_0xa757('0x14'));var logger=require(_0xa757('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa757('0x16'))['db'];function respondWithStatusCode(_0x276198,_0x334302){_0x334302=_0x334302||0xcc;return function(_0x883b33){if(_0x883b33){return _0x276198[_0xa757('0x17')](_0x334302);}return _0x276198[_0xa757('0x18')](_0x334302)['end']();};}function respondWithResult(_0x30ed60,_0x8411c0){_0x8411c0=_0x8411c0||0xc8;return function(_0x4665e8){if(_0x4665e8){return _0x30ed60[_0xa757('0x18')](_0x8411c0)['json'](_0x4665e8);}};}function respondWithFilteredResult(_0x3d1b06,_0x4bbb63){return function(_0x45f486){if(_0x45f486){var _0xdf3f1=typeof _0x4bbb63['offset']===_0xa757('0x19')&&typeof _0x4bbb63['limit']===_0xa757('0x19');var _0x2b1b49=_0x45f486['count'];var _0x10506a=_0xdf3f1?0x0:_0x4bbb63[_0xa757('0x1a')];var _0x4012c6=_0xdf3f1?_0x45f486[_0xa757('0x1b')]:_0x4bbb63[_0xa757('0x1a')]+_0x4bbb63['limit'];var _0x1ac04b;if(_0x4012c6>=_0x2b1b49){_0x4012c6=_0x2b1b49;_0x1ac04b=0xc8;}else{_0x1ac04b=0xce;}_0x3d1b06[_0xa757('0x18')](_0x1ac04b);return _0x3d1b06[_0xa757('0x1c')]('Content-Range',_0x10506a+'-'+_0x4012c6+'/'+_0x2b1b49)[_0xa757('0x1d')](_0x45f486);}return null;};}function patchUpdates(_0x30b6fc){return function(_0x559fb3){try{jsonpatch[_0xa757('0x1e')](_0x559fb3,_0x30b6fc,!![]);}catch(_0x416f7f){return BPromise['reject'](_0x416f7f);}return _0x559fb3[_0xa757('0x1f')]();};}function saveUpdates(_0x32101d,_0x3de435){return function(_0x4b433f){if(_0x4b433f){return _0x4b433f[_0xa757('0x20')](_0x32101d)[_0xa757('0x21')](function(_0x40a07b){return _0x40a07b;});}return null;};}function removeEntity(_0x3ff435,_0x46d1d4){return function(_0x238ff0){if(_0x238ff0){return _0x238ff0['destroy']()[_0xa757('0x21')](function(){var _0x32826e=_0x238ff0[_0xa757('0x22')]({'plain':!![]});var _0x425190=_0xa757('0x23');return db[_0xa757('0x24')]['destroy']({'where':{'type':_0x425190,'resourceId':_0x32826e['id']}})[_0xa757('0x21')](function(){return _0x238ff0;});})[_0xa757('0x21')](function(){_0x3ff435[_0xa757('0x18')](0xcc)[_0xa757('0x25')]();});}};}function handleEntityNotFound(_0x14627b,_0x45d3e3){return function(_0x41fbd3){if(!_0x41fbd3){_0x14627b['sendStatus'](0x194);}return _0x41fbd3;};}function handleError(_0x73d910,_0x38a2da){_0x38a2da=_0x38a2da||0x1f4;return function(_0x17422b){logger['error'](_0x17422b[_0xa757('0x26')]);if(_0x17422b['name']){delete _0x17422b[_0xa757('0x27')];}_0x73d910[_0xa757('0x18')](_0x38a2da)[_0xa757('0x28')](_0x17422b);};}exports[_0xa757('0x29')]=function(_0x9e59c3,_0x5e0d25){var _0x4e8efd={},_0x2b4bdd={},_0x23eba7={'count':0x0,'rows':[]};return db[_0xa757('0x2a')][_0xa757('0x2b')]()['then'](function(_0x123106){_0x2b4bdd['model']=_[_0xa757('0x2c')](_0x123106);_0x2b4bdd[_0xa757('0x2d')]=_[_0xa757('0x2c')](_0x9e59c3[_0xa757('0x2d')]);_0x2b4bdd[_0xa757('0x2e')]=_['intersection'](_0x2b4bdd[_0xa757('0x2f')],_0x2b4bdd[_0xa757('0x2d')]);_0x4e8efd[_0xa757('0x30')]=_[_0xa757('0x31')](_0x2b4bdd[_0xa757('0x2f')],qs[_0xa757('0x32')](_0x9e59c3['query'][_0xa757('0x32')]));_0x4e8efd[_0xa757('0x30')]=_0x4e8efd['attributes'][_0xa757('0x33')]?_0x4e8efd[_0xa757('0x30')]:_0x2b4bdd[_0xa757('0x2f')];if(!_0x9e59c3['query'][_0xa757('0x34')](_0xa757('0x35'))){_0x4e8efd[_0xa757('0x36')]=qs[_0xa757('0x36')](_0x9e59c3['query'][_0xa757('0x36')]);_0x4e8efd[_0xa757('0x1a')]=qs['offset'](_0x9e59c3[_0xa757('0x2d')]['offset']);}_0x4e8efd[_0xa757('0x37')]=qs[_0xa757('0x38')](_0x9e59c3['query']['sort']);_0x4e8efd[_0xa757('0x39')]=qs[_0xa757('0x2e')](_[_0xa757('0x3a')](_0x9e59c3[_0xa757('0x2d')],_0x2b4bdd['filters']),_0x123106);if(_0x9e59c3[_0xa757('0x2d')][_0xa757('0x3b')]){_0x4e8efd[_0xa757('0x39')]=_[_0xa757('0x3c')](_0x4e8efd[_0xa757('0x39')],{'$or':_['map'](_0x4e8efd[_0xa757('0x30')],function(_0x5db16b){var _0x528412={};_0x528412[_0x5db16b]={'$like':'%'+_0x9e59c3[_0xa757('0x2d')][_0xa757('0x3b')]+'%'};return _0x528412;})});}_0x4e8efd=_['merge']({},_0x4e8efd,_0x9e59c3[_0xa757('0x3d')]);var _0x19bd0b={'where':_0x4e8efd[_0xa757('0x39')]};return db[_0xa757('0x2a')][_0xa757('0x1b')](_0x19bd0b)[_0xa757('0x21')](function(_0x244f62){_0x23eba7[_0xa757('0x1b')]=_0x244f62;if(_0x9e59c3[_0xa757('0x2d')][_0xa757('0x3e')]){_0x4e8efd[_0xa757('0x3f')]=[{'all':!![]}];}return db[_0xa757('0x2a')][_0xa757('0x40')](_0x4e8efd);})[_0xa757('0x21')](function(_0x14658d){_0x23eba7['rows']=_0x14658d;return _0x23eba7;})[_0xa757('0x21')](respondWithFilteredResult(_0x5e0d25,_0x4e8efd))[_0xa757('0x41')](handleError(_0x5e0d25,null));})[_0xa757('0x41')](handleError(_0x5e0d25,null));};exports[_0xa757('0x42')]=function(_0x4c58f6,_0x9f4656){var _0x4d7b43={'raw':![],'where':{'id':_0x4c58f6['params']['id']}},_0x1f539c={};_0x1f539c[_0xa757('0x2f')]=_[_0xa757('0x2c')](db[_0xa757('0x2a')][_0xa757('0x43')]);_0x1f539c[_0xa757('0x2d')]=_[_0xa757('0x2c')](_0x4c58f6[_0xa757('0x2d')]);_0x1f539c[_0xa757('0x2e')]=_[_0xa757('0x31')](_0x1f539c[_0xa757('0x2f')],_0x1f539c[_0xa757('0x2d')]);_0x4d7b43[_0xa757('0x30')]=_[_0xa757('0x31')](_0x1f539c['model'],qs[_0xa757('0x32')](_0x4c58f6[_0xa757('0x2d')][_0xa757('0x32')]));_0x4d7b43['attributes']=_0x4d7b43['attributes'][_0xa757('0x33')]?_0x4d7b43[_0xa757('0x30')]:_0x1f539c['model'];if(_0x4c58f6[_0xa757('0x2d')]['includeAll']){_0x4d7b43['include']=[{'all':!![]}];}_0x4d7b43=_[_0xa757('0x3c')]({},_0x4d7b43,_0x4c58f6[_0xa757('0x3d')]);return db[_0xa757('0x2a')][_0xa757('0x44')](_0x4d7b43)[_0xa757('0x21')](handleEntityNotFound(_0x9f4656,null))[_0xa757('0x21')](respondWithResult(_0x9f4656,null))['catch'](handleError(_0x9f4656,null));};exports[_0xa757('0x45')]=function(_0x3a78f6,_0x422bd7){return db[_0xa757('0x2a')]['create'](_0x3a78f6[_0xa757('0x46')],{})[_0xa757('0x21')](function(_0x26d91f){var _0x12debd=_0x3a78f6[_0xa757('0x47')]['get']({'plain':!![]});if(!_0x12debd)throw new Error(_0xa757('0x48'));if(_0x12debd[_0xa757('0x49')]===_0xa757('0x47')){var _0x5e459f=_0x26d91f['get']({'plain':!![]});var _0x2a34c8=_0xa757('0x23');return db[_0xa757('0x4a')][_0xa757('0x44')]({'where':{'name':_0x2a34c8,'userProfileId':_0x12debd['userProfileId']},'raw':!![]})['then'](function(_0x22d329){if(_0x22d329&&_0x22d329[_0xa757('0x4b')]===0x0){return db[_0xa757('0x24')][_0xa757('0x45')]({'name':_0x5e459f[_0xa757('0x27')],'resourceId':_0x5e459f['id'],'type':_0x22d329[_0xa757('0x27')],'sectionId':_0x22d329['id']},{})['then'](function(){return _0x26d91f;});}else{return _0x26d91f;}})['catch'](function(_0x29810b){logger[_0xa757('0x4c')](_0xa757('0x4d'),_0x29810b);throw _0x29810b;});}return _0x26d91f;})[_0xa757('0x21')](respondWithResult(_0x422bd7,0xc9))['catch'](handleError(_0x422bd7,null));};exports[_0xa757('0x20')]=function(_0x12bd5d,_0xc4dad7){if(_0x12bd5d['body']['id']){delete _0x12bd5d[_0xa757('0x46')]['id'];}return db[_0xa757('0x2a')][_0xa757('0x44')]({'where':{'id':_0x12bd5d[_0xa757('0x4e')]['id']}})[_0xa757('0x21')](handleEntityNotFound(_0xc4dad7,null))[_0xa757('0x21')](saveUpdates(_0x12bd5d[_0xa757('0x46')],null))[_0xa757('0x21')](respondWithResult(_0xc4dad7,null))[_0xa757('0x41')](handleError(_0xc4dad7,null));};exports[_0xa757('0x4f')]=function(_0x3becf1,_0x11f018){return db[_0xa757('0x2a')]['find']({'where':{'id':_0x3becf1[_0xa757('0x4e')]['id']}})[_0xa757('0x21')](handleEntityNotFound(_0x11f018,null))[_0xa757('0x21')](removeEntity(_0x11f018,null))[_0xa757('0x41')](handleError(_0x11f018,null));};exports[_0xa757('0x2b')]=function(_0x571c98,_0xf8b4c5){return db[_0xa757('0x2a')][_0xa757('0x2b')]()[_0xa757('0x21')](respondWithResult(_0xf8b4c5,null))['catch'](handleError(_0xf8b4c5,null));};exports[_0xa757('0x50')]=function(_0x35adbb,_0x3ea293,_0x10066c){return db['CmContact'][_0xa757('0x44')]({'where':{'id':_0x35adbb[_0xa757('0x4e')]['id']}})[_0xa757('0x21')](handleEntityNotFound(_0x3ea293,null))['then'](function(_0x48a5f7){if(_0x48a5f7){return _0x48a5f7['addContacts'](_0x35adbb[_0xa757('0x46')][_0xa757('0x51')],_[_0xa757('0x52')](_0x35adbb['body'],[_0xa757('0x51'),'id'])||{});}})[_0xa757('0x21')](respondWithResult(_0x3ea293,null))['catch'](handleError(_0x3ea293,null));};exports['getContacts']=function(_0x107c94,_0x3a2bdf,_0x2e7274){var _0x11db47={};var _0x4bdef6={};var _0x57ca93;var _0x29dddb;return db[_0xa757('0x2a')]['findOne']({'where':{'id':_0x107c94['params']['id']}})[_0xa757('0x21')](handleEntityNotFound(_0x3a2bdf,null))['then'](function(_0x502dfb){if(_0x502dfb){_0x57ca93=_0x502dfb;_0x4bdef6[_0xa757('0x2f')]=_[_0xa757('0x2c')](db[_0xa757('0x53')][_0xa757('0x43')]);_0x4bdef6[_0xa757('0x2d')]=_[_0xa757('0x2c')](_0x107c94['query']);_0x4bdef6[_0xa757('0x2e')]=_[_0xa757('0x31')](_0x4bdef6['model'],_0x4bdef6[_0xa757('0x2d')]);_0x11db47[_0xa757('0x30')]=_['intersection'](_0x4bdef6[_0xa757('0x2f')],qs[_0xa757('0x32')](_0x107c94[_0xa757('0x2d')]['fields']));_0x11db47['attributes']=_0x11db47[_0xa757('0x30')][_0xa757('0x33')]?_0x11db47[_0xa757('0x30')]:_0x4bdef6[_0xa757('0x2f')];_0x11db47[_0xa757('0x37')]=qs[_0xa757('0x38')](_0x107c94[_0xa757('0x2d')][_0xa757('0x38')]);_0x11db47[_0xa757('0x39')]=qs['filters'](_[_0xa757('0x3a')](_0x107c94[_0xa757('0x2d')],_0x4bdef6[_0xa757('0x2e')]));if(_0x107c94[_0xa757('0x2d')][_0xa757('0x3b')]){_0x11db47[_0xa757('0x39')]=_[_0xa757('0x3c')](_0x11db47[_0xa757('0x39')],{'$or':_[_0xa757('0x54')](_0x11db47[_0xa757('0x30')],function(_0x35cb0d){var _0x12723f={};_0x12723f[_0x35cb0d]={'$like':'%'+_0x107c94[_0xa757('0x2d')][_0xa757('0x3b')]+'%'};return _0x12723f;})});}_0x11db47=_['merge']({},_0x11db47,_0x107c94[_0xa757('0x3d')]);return _0x57ca93[_0xa757('0x55')](_0x11db47);}})[_0xa757('0x21')](function(_0x3a4d91){if(_0x3a4d91){_0x29dddb=_0x3a4d91[_0xa757('0x33')];if(!_0x107c94[_0xa757('0x2d')][_0xa757('0x34')](_0xa757('0x35'))){_0x11db47[_0xa757('0x36')]=qs['limit'](_0x107c94['query']['limit']);_0x11db47[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x107c94[_0xa757('0x2d')]['offset']);}return _0x57ca93[_0xa757('0x55')](_0x11db47);}})[_0xa757('0x21')](function(_0x4c8eac){if(_0x4c8eac){return _0x4c8eac?{'count':_0x29dddb,'rows':_0x4c8eac}:null;}})[_0xa757('0x21')](respondWithResult(_0x3a2bdf,null))[_0xa757('0x41')](handleError(_0x3a2bdf,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 590c98b..f7dd02e 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 _0x0f85=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5bcb6c,_0x4d9061){var _0x35f0da=function(_0x301ff6){while(--_0x301ff6){_0x5bcb6c['push'](_0x5bcb6c['shift']());}};_0x35f0da(++_0x4d9061);}(_0x0f85,0xa4));var _0x50f8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0f85[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x50f8('0x0'));var util=require(_0x50f8('0x1'));var logger=require(_0x50f8('0x2'))('api');var moment=require(_0x50f8('0x3'));var BPromise=require(_0x50f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50f8('0x5'));var rimraf=require(_0x50f8('0x6'));var config=require(_0x50f8('0x7'));var attributes=require(_0x50f8('0x8'));module[_0x50f8('0x9')]=function(_0x3366bc,_0x463b7b){return _0x3366bc[_0x50f8('0xa')](_0x50f8('0xb'),attributes,{'tableName':_0x50f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2c3=['request-promise','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','../../config/logger','api','moment','bluebird'];(function(_0x5ab42d,_0x8964fa){var _0x5258b3=function(_0x3f13ca){while(--_0x3f13ca){_0x5ab42d['push'](_0x5ab42d['shift']());}};_0x5258b3(++_0x8964fa);}(_0xf2c3,0x80));var _0x3f2c=function(_0x39725a,_0x35f499){_0x39725a=_0x39725a-0x0;var _0x52ca80=_0xf2c3[_0x39725a];return _0x52ca80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f2c('0x0'))(_0x3f2c('0x1'));var moment=require(_0x3f2c('0x2'));var BPromise=require(_0x3f2c('0x3'));var rp=require(_0x3f2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f2c('0x5'));var config=require(_0x3f2c('0x6'));var attributes=require('./cmCompany.attributes');module[_0x3f2c('0x7')]=function(_0x473432,_0x1ba14c){return _0x473432[_0x3f2c('0x8')](_0x3f2c('0x9'),attributes,{'tableName':_0x3f2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 0fde81e..bf3c71f 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 _0xe8d6=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x39f060,_0xe1b897){var _0x3593e5=function(_0xaa7d0d){while(--_0xaa7d0d){_0x39f060['push'](_0x39f060['shift']());}};_0x3593e5(++_0xe1b897);}(_0xe8d6,0x13b));var _0x6e8d=function(_0xcae260,_0x3bca42){_0xcae260=_0xcae260-0x0;var _0xbb65b8=_0xe8d6[_0xcae260];return _0xbb65b8;};'use strict';var _=require(_0x6e8d('0x0'));var util=require(_0x6e8d('0x1'));var moment=require(_0x6e8d('0x2'));var BPromise=require(_0x6e8d('0x3'));var rs=require(_0x6e8d('0x4'));var fs=require('fs');var Redis=require(_0x6e8d('0x5'));var db=require(_0x6e8d('0x6'))['db'];var utils=require(_0x6e8d('0x7'));var logger=require('../../config/logger')(_0x6e8d('0x8'));var config=require(_0x6e8d('0x9'));var jayson=require(_0x6e8d('0xa'));var client=jayson[_0x6e8d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5884e3,_0x3c09a9,_0x52b406){return new BPromise(function(_0x40fba6,_0x244ae2){return client[_0x6e8d('0xc')](_0x5884e3,_0x52b406)['then'](function(_0x4521a0){logger[_0x6e8d('0xd')](_0x6e8d('0xe'),_0x3c09a9,_0x6e8d('0xf'));logger[_0x6e8d('0x10')](_0x6e8d('0x11'),_0x3c09a9,'request\x20sent',JSON[_0x6e8d('0x12')](_0x4521a0));if(_0x4521a0[_0x6e8d('0x13')]){if(_0x4521a0[_0x6e8d('0x13')][_0x6e8d('0x14')]===0x1f4){logger[_0x6e8d('0x13')]('CmCompany,\x20%s,\x20%s',_0x3c09a9,_0x4521a0['error'][_0x6e8d('0x15')]);return _0x244ae2(_0x4521a0['error'][_0x6e8d('0x15')]);}logger['error'](_0x6e8d('0xe'),_0x3c09a9,_0x4521a0[_0x6e8d('0x13')]['message']);return _0x40fba6(_0x4521a0[_0x6e8d('0x13')]['message']);}else{logger[_0x6e8d('0xd')](_0x6e8d('0xe'),_0x3c09a9,_0x6e8d('0xf'));_0x40fba6(_0x4521a0[_0x6e8d('0x16')][_0x6e8d('0x15')]);}})['catch'](function(_0x395085){logger['error'](_0x6e8d('0xe'),_0x3c09a9,_0x395085);_0x244ae2(_0x395085);});});} \ No newline at end of file +var _0x10cc=['lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','code','error','CmCompany,\x20%s,\x20%s','message','result','catch'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0x10cc,0xe6));var _0xc10c=function(_0x2057be,_0x12efe3){_0x2057be=_0x2057be-0x0;var _0x22c52f=_0x10cc[_0x2057be];return _0x22c52f;};'use strict';var _=require(_0xc10c('0x0'));var util=require('util');var moment=require(_0xc10c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc10c('0x2'));var db=require(_0xc10c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc10c('0x4'))(_0xc10c('0x5'));var config=require(_0xc10c('0x6'));var jayson=require(_0xc10c('0x7'));var client=jayson[_0xc10c('0x8')][_0xc10c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3af985,_0x4fe553,_0x5449e6){return new BPromise(function(_0x4fbb1d,_0x4e009e){return client[_0xc10c('0xa')](_0x3af985,_0x5449e6)[_0xc10c('0xb')](function(_0x3e08e6){logger[_0xc10c('0xc')]('CmCompany,\x20%s,\x20%s',_0x4fe553,_0xc10c('0xd'));logger[_0xc10c('0xe')](_0xc10c('0xf'),_0x4fe553,'request\x20sent',JSON[_0xc10c('0x10')](_0x3e08e6));if(_0x3e08e6['error']){if(_0x3e08e6['error'][_0xc10c('0x11')]===0x1f4){logger[_0xc10c('0x12')](_0xc10c('0x13'),_0x4fe553,_0x3e08e6['error'][_0xc10c('0x14')]);return _0x4e009e(_0x3e08e6[_0xc10c('0x12')][_0xc10c('0x14')]);}logger[_0xc10c('0x12')]('CmCompany,\x20%s,\x20%s',_0x4fe553,_0x3e08e6['error']['message']);return _0x4fbb1d(_0x3e08e6[_0xc10c('0x12')][_0xc10c('0x14')]);}else{logger[_0xc10c('0xc')]('CmCompany,\x20%s,\x20%s',_0x4fe553,_0xc10c('0xd'));_0x4fbb1d(_0x3e08e6[_0xc10c('0x15')]['message']);}})[_0xc10c('0x16')](function(_0x2bb4b3){logger['error'](_0xc10c('0x13'),_0x4fe553,_0x2bb4b3);_0x4e009e(_0x2bb4b3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 97e5433..a358c1d 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 _0xefce=['addContacts','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','/:id/contacts','getContacts','create'];(function(_0xb47828,_0x8665e4){var _0x1f3315=function(_0x42f77a){while(--_0x42f77a){_0xb47828['push'](_0xb47828['shift']());}};_0x1f3315(++_0x8665e4);}(_0xefce,0x1e8));var _0xeefc=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0xefce[_0x3522c8];return _0x22f498;};'use strict';var multer=require('multer');var util=require(_0xeefc('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeefc('0x1'));var router=express[_0xeefc('0x2')]();var fs_extra=require(_0xeefc('0x3'));var auth=require(_0xeefc('0x4'));var interaction=require(_0xeefc('0x5'));var config=require(_0xeefc('0x6'));var controller=require(_0xeefc('0x7'));router[_0xeefc('0x8')]('/',auth[_0xeefc('0x9')](),controller[_0xeefc('0xa')]);router['get']('/describe',auth[_0xeefc('0x9')](),controller[_0xeefc('0xb')]);router[_0xeefc('0x8')](_0xeefc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xeefc('0x8')](_0xeefc('0xd'),auth['isAuthenticated'](),controller[_0xeefc('0xe')]);router['post']('/',auth[_0xeefc('0x9')](),controller[_0xeefc('0xf')]);router['post'](_0xeefc('0xd'),auth[_0xeefc('0x9')](),controller[_0xeefc('0x10')]);router['put'](_0xeefc('0xc'),auth[_0xeefc('0x9')](),controller[_0xeefc('0x11')]);router[_0xeefc('0x12')](_0xeefc('0xc'),auth[_0xeefc('0x9')](),controller[_0xeefc('0x13')]);module[_0xeefc('0x14')]=router; \ No newline at end of file +var _0x4855=['create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','post'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x4855,0xce));var _0x5485=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0x4855[_0x9a7ea6];return _0x1c2040;};'use strict';var multer=require(_0x5485('0x0'));var util=require(_0x5485('0x1'));var path=require(_0x5485('0x2'));var timeout=require(_0x5485('0x3'));var express=require('express');var router=express[_0x5485('0x4')]();var fs_extra=require(_0x5485('0x5'));var auth=require(_0x5485('0x6'));var interaction=require(_0x5485('0x7'));var config=require(_0x5485('0x8'));var controller=require(_0x5485('0x9'));router[_0x5485('0xa')]('/',auth[_0x5485('0xb')](),controller[_0x5485('0xc')]);router[_0x5485('0xa')](_0x5485('0xd'),auth[_0x5485('0xb')](),controller[_0x5485('0xe')]);router[_0x5485('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5485('0xf')]);router[_0x5485('0xa')](_0x5485('0x10'),auth[_0x5485('0xb')](),controller[_0x5485('0x11')]);router[_0x5485('0x12')]('/',auth[_0x5485('0xb')](),controller[_0x5485('0x13')]);router['post'](_0x5485('0x10'),auth[_0x5485('0xb')](),controller['addContacts']);router[_0x5485('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5485('0x15')](_0x5485('0x16'),auth[_0x5485('0xb')](),controller[_0x5485('0x17')]);module[_0x5485('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 9dfa8eb..a1fc913 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 _0x2159=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x2159,0x1e0));var _0x9215=function(_0x4d5cac,_0x5bf7bd){_0x4d5cac=_0x4d5cac-0x0;var _0x513307=_0x2159[_0x4d5cac];return _0x513307;};'use strict';var _=require(_0x9215('0x0'));var Sequelize=require(_0x9215('0x1'));module[_0x9215('0x2')]={'firstName':{'type':Sequelize[_0x9215('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x9215('0x3')]},'postalCode':{'type':Sequelize[_0x9215('0x3')]},'city':{'type':Sequelize[_0x9215('0x3')]},'country':{'type':Sequelize[_0x9215('0x3')]},'dateOfBirth':{'type':Sequelize[_0x9215('0x3')]},'description':{'type':Sequelize[_0x9215('0x4')]},'phone':{'type':Sequelize[_0x9215('0x3')]},'mobile':{'type':Sequelize[_0x9215('0x3')]},'fax':{'type':Sequelize[_0x9215('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x9215('0x3')]},'facebook':{'type':Sequelize[_0x9215('0x3')]},'fb_data':{'type':Sequelize[_0x9215('0x3')]},'twitter':{'type':Sequelize[_0x9215('0x3')]},'skype':{'type':Sequelize[_0x9215('0x3')]},'teams':{'type':Sequelize[_0x9215('0x3')]},'viber':{'type':Sequelize[_0x9215('0x3')]},'line':{'type':Sequelize[_0x9215('0x3')]},'wechat':{'type':Sequelize[_0x9215('0x3')]},'telegram':{'type':Sequelize[_0x9215('0x3')]},'UserId':{'type':Sequelize[_0x9215('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x9215('0x3')]},'priority':{'type':Sequelize[_0x9215('0x5')](0x2)[_0x9215('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9215('0x7')],'defaultValue':Sequelize[_0x9215('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4cd2=['STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x4b48a8,_0x391aed){var _0x4d5ad2=function(_0xa8302b){while(--_0xa8302b){_0x4b48a8['push'](_0x4b48a8['shift']());}};_0x4d5ad2(++_0x391aed);}(_0x4cd2,0x75));var _0x24cd=function(_0x643559,_0x4862f7){_0x643559=_0x643559-0x0;var _0x4d1f21=_0x4cd2[_0x643559];return _0x4d1f21;};'use strict';var _=require(_0x24cd('0x0'));var Sequelize=require(_0x24cd('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x24cd('0x2')]},'street':{'type':Sequelize[_0x24cd('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x24cd('0x2')]},'country':{'type':Sequelize[_0x24cd('0x2')]},'dateOfBirth':{'type':Sequelize[_0x24cd('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x24cd('0x2')]},'mobile':{'type':Sequelize[_0x24cd('0x2')]},'fax':{'type':Sequelize[_0x24cd('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x24cd('0x2')]},'facebook':{'type':Sequelize[_0x24cd('0x2')]},'fb_data':{'type':Sequelize[_0x24cd('0x2')]},'twitter':{'type':Sequelize[_0x24cd('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x24cd('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x24cd('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x24cd('0x2')]},'UserId':{'type':Sequelize[_0x24cd('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x24cd('0x2')]},'priority':{'type':Sequelize[_0x24cd('0x3')](0x2)[_0x24cd('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x24cd('0x5')],'defaultValue':Sequelize[_0x24cd('0x6')]},'dialTimezone':{'type':Sequelize[_0x24cd('0x2')]},'utcOffset':{'type':Sequelize[_0x24cd('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 93a457a..be39423 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 _0x88cc=['Tag','Tags','color','tag','CmContactHasItem','ItemType','sequelize','literal','$and','CmCustomField','map','format','cf_%d','omit','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','filters','attributes','model','fields','order','sort','pick','filter','nolimit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','intersection','ContactId','options','includeAll','rows','getHopperHistories','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','upload','parse','import','agent','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','pid','importUpdates','User','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','UserId','fullname','DESC','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','customerIp','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','Interaction','findAndCountAll','flatten','sortBy','reverse','value','slice','path','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','describe','getOptions','query','catch','find','params','CmContact','keys','length','startsWith','cf_','columnName','displayName','analytics','findAll','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxInteraction','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','spread','push','contact','all','show'];(function(_0x1b2c0e,_0x1fd9fa){var _0x480de=function(_0x47e816){while(--_0x47e816){_0x1b2c0e['push'](_0x1b2c0e['shift']());}};_0x480de(++_0x1fd9fa);}(_0x88cc,0x9b));var _0xc88c=function(_0x11de83,_0x49e1c1){_0x11de83=_0x11de83-0x0;var _0x45bdb0=_0x88cc[_0x11de83];return _0x45bdb0;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0xc88c('0x0'));var fs=require('fs');var _=require(_0xc88c('0x1'));var squel=require('squel');var Papa=require(_0xc88c('0x2'));var Redis=require(_0xc88c('0x3'));var contacts=require(_0xc88c('0x4'));var qs=require(_0xc88c('0x5'));var logger=require(_0xc88c('0x6'))(_0xc88c('0x7'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0xc88c('0x8')]=_[_0xc88c('0x9')](config[_0xc88c('0x8')],{'host':_0xc88c('0xa'),'port':0x18eb});var socket=require(_0xc88c('0xb'))(new Redis(config[_0xc88c('0x8')]));require(_0xc88c('0xc'))[_0xc88c('0xd')](socket);function respondWithResult(_0x247bc1,_0x50aec4){_0x50aec4=_0x50aec4||0xc8;return function(_0x35074b){if(_0x35074b){return _0x247bc1[_0xc88c('0xe')](_0x50aec4)[_0xc88c('0xf')](_0x35074b);}};}function respondWithFilteredResult(_0x43fc5e,_0x19082f){return function(_0x2011fb){if(_0x2011fb){var _0x12217f=typeof _0x19082f[_0xc88c('0x10')]===_0xc88c('0x11')&&typeof _0x19082f[_0xc88c('0x12')]==='undefined';var _0x4a39fe=_0x2011fb['count'];var _0x28b20d=_0x12217f?0x0:_0x19082f[_0xc88c('0x10')];var _0x155ba3=_0x12217f?_0x2011fb[_0xc88c('0x13')]:_0x19082f[_0xc88c('0x10')]+_0x19082f[_0xc88c('0x12')];var _0x269392;if(_0x155ba3>=_0x4a39fe){_0x155ba3=_0x4a39fe;_0x269392=0xc8;}else{_0x269392=0xce;}_0x43fc5e['status'](_0x269392);return _0x43fc5e[_0xc88c('0x14')](_0xc88c('0x15'),_0x28b20d+'-'+_0x155ba3+'/'+_0x4a39fe)[_0xc88c('0xf')](_0x2011fb);}return null;};}function saveUpdates(_0x10180a){return function(_0xc2ecc2){if(_0xc2ecc2){return _0xc2ecc2[_0xc88c('0x16')](_0x10180a)[_0xc88c('0x17')](function(_0x186da9){return _0x186da9;});}return null;};}function removeEntity(_0x155205){return function(_0x259d49){if(_0x259d49){return _0x259d49[_0xc88c('0x18')]()[_0xc88c('0x17')](function(){_0x155205['status'](0xcc)[_0xc88c('0x19')]();});}};}function handleEntityNotFound(_0x49dcd1){return function(_0x5af4ef){if(!_0x5af4ef){_0x49dcd1['sendStatus'](0x194);}return _0x5af4ef;};}function handleError(_0x52c99a,_0xd13209){_0xd13209=_0xd13209||0x1f4;return function(_0xcfa1ca){logger[_0xc88c('0x1a')](_0xcfa1ca[_0xc88c('0x1b')]);if(_0xcfa1ca[_0xc88c('0x1c')]){delete _0xcfa1ca[_0xc88c('0x1c')];}_0x52c99a[_0xc88c('0xe')](_0xd13209)[_0xc88c('0x1d')](_0xcfa1ca);};}exports[_0xc88c('0x1e')]=function(_0x873b5f,_0x3f544b){var _0x260487={};return contacts[_0xc88c('0x1f')]()[_0xc88c('0x17')](function(_0x3007d6){_0x260487=qs[_0xc88c('0x20')](_0x3007d6,_0x873b5f);return contacts['findAll'](_0x873b5f[_0xc88c('0x21')],_0x873b5f['user'],_0x260487,_0x3007d6);})[_0xc88c('0x17')](respondWithFilteredResult(_0x3f544b,_0x260487))[_0xc88c('0x22')](handleError(_0x3f544b,null));};exports[_0xc88c('0x18')]=function(_0x298b50,_0x20673b){return db['CmContact'][_0xc88c('0x23')]({'where':{'id':_0x298b50[_0xc88c('0x24')]['id']}})['then'](handleEntityNotFound(_0x20673b,null))[_0xc88c('0x17')](removeEntity(_0x20673b,null))[_0xc88c('0x22')](handleError(_0x20673b,null));};exports[_0xc88c('0x1f')]=function(_0x21cee4,_0xefe0ca){return db[_0xc88c('0x25')][_0xc88c('0x1f')]()['then'](function(_0x12623c){delete _0x12623c['tags'];for(var _0x9b5579=0x0;_0x9b55790x0){return new Promise(function(_0x52f9ec){var _0x4ddeb1=[];for(var _0x30437d=0x0;_0x30437d<_0x28ef89[_0xc88c('0x27')];_0x30437d++){_0x4ddeb1[_0xc88c('0x61')](insertAdditionalPhones(_0x28ef89[_0x30437d][_0xc88c('0x62')],_0x28ef89[_0x30437d][_0xc88c('0x59')]));}Promise[_0xc88c('0x63')](_0x4ddeb1)[_0xc88c('0x17')](function(){_0x52f9ec(0x1);});})[_0xc88c('0x17')](function(){return{'success':_0x584f25,'failure':_0x451faf,'duplicates':_0xa3438e};});}else{return{'success':_0x584f25,'failure':_0x451faf,'duplicates':_0xa3438e};}}})[_0xc88c('0x17')](respondWithResult(_0x44f6f3,0xc9))['catch'](handleError(_0x44f6f3,null));};exports[_0xc88c('0x64')]=function(_0x120b71,_0x4484a1){var _0x363609;return db[_0xc88c('0x25')][_0xc88c('0x1f')]()[_0xc88c('0x17')](function(_0xe32e57){return db[_0xc88c('0x25')][_0xc88c('0x23')]({'where':{'id':_0x120b71[_0xc88c('0x24')]['id']},'include':[{'model':db[_0xc88c('0x65')],'as':_0xc88c('0x66'),'attributes':['id',_0xc88c('0x1c'),_0xc88c('0x67')],'required':_0x120b71[_0xc88c('0x21')][_0xc88c('0x68')]?!![]:![]},{'model':db[_0xc88c('0x69')],'as':'Phones','where':{'CmContactId':_0x120b71[_0xc88c('0x24')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xc88c('0x6a')}]}],'order':[db[_0xc88c('0x6b')][_0xc88c('0x6c')]('Phones.OrderBy')],'attributes':_['keys'](_0xe32e57)});})[_0xc88c('0x17')](function(_0x26ad15){if(!_[_0xc88c('0x55')](_0x26ad15)){_0x363609=_0x26ad15['get']({'plain':!![]});var _0x2ad073={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x26ad15&&_0x26ad15[_0xc88c('0x5f')]){if(_0x26ad15[_0xc88c('0x5f')]){_0x2ad073[_0xc88c('0x5d')][_0xc88c('0x6d')][_0xc88c('0x61')]({'ListId':{'$ne':_0x26ad15[_0xc88c('0x5f')]}});}}return db[_0xc88c('0x6e')][_0xc88c('0x2d')](_0x2ad073);}})[_0xc88c('0x17')](function(_0x3cce16){if(!_[_0xc88c('0x55')](_0x3cce16)){return _['omit'](_0x363609,_[_0xc88c('0x6f')](_0x3cce16,function(_0x16e5ab){return util[_0xc88c('0x70')](_0xc88c('0x71'),_0x16e5ab['id']);}));}})['then'](handleEntityNotFound(_0x4484a1,null))['then'](respondWithResult(_0x4484a1,null))[_0xc88c('0x22')](handleError(_0x4484a1,null));};exports[_0xc88c('0x16')]=function(_0x56a442,_0x818a0c){var _0x4239f0;if(_0x56a442['body']['id']){delete _0x56a442['body']['id'];}if(!_['isNil'](_0x56a442[_0xc88c('0x37')][_0xc88c('0x56')])){var _0xdb69dc=_0x56a442['body']['dialTimezone'];if(!_['isNil'](shared[_0xc88c('0x57')][_0xdb69dc]))_0x56a442['body']['utcOffset']=shared[_0xc88c('0x57')][_0xdb69dc]['utcOffset'];}return db['CmContact'][_0xc88c('0x23')]({'where':{'id':_0x56a442[_0xc88c('0x24')]['id']}})[_0xc88c('0x17')](handleEntityNotFound(_0x818a0c,null))[_0xc88c('0x17')](saveUpdates(_0x56a442[_0xc88c('0x37')],null))[_0xc88c('0x17')](function(_0x51cff8){_0x4239f0=_0x51cff8;var _0x356f84={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x51cff8&&_0x51cff8[_0xc88c('0x5f')]){if(_0x51cff8[_0xc88c('0x5f')]){_0x356f84[_0xc88c('0x5d')][_0xc88c('0x6d')][_0xc88c('0x61')]({'ListId':{'$ne':_0x51cff8[_0xc88c('0x5f')]}});}}return db[_0xc88c('0x6e')]['findAll'](_0x356f84);})[_0xc88c('0x17')](function(_0x53dc49){if(_0x53dc49){return _[_0xc88c('0x72')](_[_0xc88c('0x73')](_0x56a442[_0xc88c('0x37')],function(_0xa8b4ee,_0x493bd7){return _[_0xc88c('0x28')](_0x493bd7,'cf_');}),_[_0xc88c('0x6f')](_0x53dc49,function(_0x3e90fa){return util[_0xc88c('0x70')]('cf_%d',_0x3e90fa['id']);}));}})[_0xc88c('0x17')](function(_0x36f08f){if(_0x36f08f&&!_[_0xc88c('0x74')](_0x36f08f)){var _0x5c6e44=squel[_0xc88c('0x16')]()[_0xc88c('0x75')](_0xc88c('0x76'))[_0xc88c('0x77')](_0x36f08f)[_0xc88c('0x5d')](_0xc88c('0x78'),_0x56a442[_0xc88c('0x24')]['id'])[_0xc88c('0x79')]();return db['sequelize'][_0xc88c('0x21')](_0x5c6e44[_0xc88c('0x7a')],{'replacements':_0x5c6e44[_0xc88c('0x31')]});}})[_0xc88c('0x17')](function(){if(_0x56a442['body'][_0xc88c('0x7b')]&&_0x4239f0){return db[_0xc88c('0x3f')][_0xc88c('0x16')]({'phone':_0x56a442[_0xc88c('0x37')][_0xc88c('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x4239f0['id']}});}})[_0xc88c('0x17')](function(){return _0x4239f0;})[_0xc88c('0x17')](respondWithResult(_0x818a0c,null))[_0xc88c('0x22')](handleError(_0x818a0c,null));};exports[_0xc88c('0x7c')]=function(_0x363eb6,_0x29db42){var _0x525185={};var _0x3c7ddb={};var _0xf30b86;var _0x5881fe;return db[_0xc88c('0x25')][_0xc88c('0x7d')]({'where':{'id':_0x363eb6[_0xc88c('0x24')]['id']}})[_0xc88c('0x17')](handleEntityNotFound(_0x29db42,null))[_0xc88c('0x17')](function(_0x2c06ca){if(_0x2c06ca){_0xf30b86=_0x2c06ca;_0x3c7ddb['model']=_['keys'](db[_0xc88c('0x65')][_0xc88c('0x7e')]);_0x3c7ddb[_0xc88c('0x21')]=_[_0xc88c('0x26')](_0x363eb6[_0xc88c('0x21')]);_0x3c7ddb[_0xc88c('0x7f')]=_['intersection'](_0x3c7ddb['model'],_0x3c7ddb['query']);_0x525185[_0xc88c('0x80')]=_['intersection'](_0x3c7ddb[_0xc88c('0x81')],qs[_0xc88c('0x82')](_0x363eb6[_0xc88c('0x21')][_0xc88c('0x82')]));_0x525185[_0xc88c('0x80')]=_0x525185[_0xc88c('0x80')][_0xc88c('0x27')]?_0x525185[_0xc88c('0x80')]:_0x3c7ddb['model'];_0x525185[_0xc88c('0x83')]=qs['sort'](_0x363eb6[_0xc88c('0x21')][_0xc88c('0x84')]);_0x525185[_0xc88c('0x5d')]=qs[_0xc88c('0x7f')](_[_0xc88c('0x85')](_0x363eb6['query'],_0x3c7ddb[_0xc88c('0x7f')]));if(_0x363eb6['query'][_0xc88c('0x86')]){_0x525185[_0xc88c('0x5d')]=_[_0xc88c('0x36')](_0x525185[_0xc88c('0x5d')],{'$or':_[_0xc88c('0x6f')](_0x525185[_0xc88c('0x80')],function(_0x4193aa){var _0x1393a7={};_0x1393a7[_0x4193aa]={'$like':'%'+_0x363eb6['query'][_0xc88c('0x86')]+'%'};return _0x1393a7;})});}_0x525185=_[_0xc88c('0x36')]({},_0x525185,_0x363eb6['options']);return _0xf30b86[_0xc88c('0x7c')](_0x525185);}})[_0xc88c('0x17')](function(_0x311ac1){if(_0x311ac1){_0x5881fe=_0x311ac1['length'];if(!_0x363eb6[_0xc88c('0x21')][_0xc88c('0x35')](_0xc88c('0x87'))){_0x525185[_0xc88c('0x12')]=qs[_0xc88c('0x12')](_0x363eb6['query'][_0xc88c('0x12')]);_0x525185[_0xc88c('0x10')]=qs[_0xc88c('0x10')](_0x363eb6['query'][_0xc88c('0x10')]);}return _0xf30b86['getTags'](_0x525185);}})[_0xc88c('0x17')](function(_0x5e4bbd){if(_0x5e4bbd){return _0x5e4bbd?{'count':_0x5881fe,'rows':_0x5e4bbd}:null;}})[_0xc88c('0x17')](respondWithResult(_0x29db42,null))[_0xc88c('0x22')](handleError(_0x29db42,null));};exports[_0xc88c('0x88')]=function(_0x40b216,_0x46395d){if(_0x40b216[_0xc88c('0x37')]['id']){delete _0x40b216[_0xc88c('0x37')]['id'];}return db[_0xc88c('0x25')][_0xc88c('0x7d')]({'where':{'id':_0x40b216[_0xc88c('0x24')]['id']}})['then'](handleEntityNotFound(_0x46395d,null))[_0xc88c('0x17')](function(_0x2d69a3){if(_0x2d69a3){return _0x2d69a3[_0xc88c('0x88')](_0x40b216[_0xc88c('0x37')][_0xc88c('0x89')]||[]);}return null;})['then'](respondWithResult(_0x46395d,null))['catch'](handleError(_0x46395d,null));};exports[_0xc88c('0x8a')]=function(_0xaa9136,_0x3edf26){var _0x1ee518=[];_0x1ee518[_0xc88c('0x61')](addAdditionalPhones(_0xaa9136[_0xc88c('0x37')]));Promise[_0xc88c('0x63')](_0x1ee518)[_0xc88c('0x17')](function(){_0x1ee518=[];_0x1ee518['push'](deleteCmHopperPhones(_0xaa9136['body']['id']));_0x1ee518[_0xc88c('0x61')](addCmHopperPhones(_0xaa9136[_0xc88c('0x37')]['id']));Promise[_0xc88c('0x63')](_0x1ee518)[_0xc88c('0x17')](function(){return[0x1];})[_0xc88c('0x17')](respondWithResult(_0x3edf26,null));});};function addAdditionalPhones(_0x489fc6){var _0x34747f;return new Promise(function(_0x703778){return db[_0xc88c('0x69')]['destroy']({'where':{'CmContactId':_0x489fc6['id']}})['then'](function(){db[_0xc88c('0x8b')][_0xc88c('0x2d')]({'raw':!![],'attributes':['id',_0xc88c('0x8c')]})[_0xc88c('0x17')](function(_0x489bc4){var _0x1fce66=[];for(var _0x1e0e14=0x0;_0x1e0e14<_0x489fc6[_0xc88c('0x8d')][_0xc88c('0x27')];_0x1e0e14++){var _0x184065=_0x489fc6['item_types']?_[_0xc88c('0x55')](_0x489fc6[_0xc88c('0x8e')][_0x1e0e14])?'':_0x489fc6[_0xc88c('0x8e')][_0x1e0e14]:_0x489fc6[_0xc88c('0x8d')][_0x1e0e14][_0xc88c('0x8f')]?_0x489fc6[_0xc88c('0x8d')][_0x1e0e14][_0xc88c('0x8f')]:'';var _0x68ad74=_[_0xc88c('0x55')](_0x489fc6[_0xc88c('0x8d')][_0x1e0e14][_0xc88c('0x90')])?'':_0x489fc6['items'][_0x1e0e14]['description'];var _0x2e91ea=_0x184065+':'+_0x489fc6['items'][_0x1e0e14][_0xc88c('0x7b')]+'§'+_0x68ad74;if(_['isNil'](_0x34747f))_0x34747f=_0x2e91ea;else _0x34747f+=';'+_0x2e91ea;var _0x4dcefc=null;var _0x5a1abc=null;if(_0x489fc6['item_types']){if(!_[_0xc88c('0x55')](_0x489fc6[_0xc88c('0x8e')][_0x1e0e14])){_0x5a1abc=_[_0xc88c('0x23')](_0x489bc4,function(_0x1e78e3){return _0x1e78e3['id']===_0x489fc6[_0xc88c('0x8e')][_0x1e0e14];});if(!_[_0xc88c('0x55')](_0x5a1abc)){_0x4dcefc=_0x5a1abc[_0xc88c('0x8c')];}}}else{if(!_[_0xc88c('0x55')](_0x489fc6[_0xc88c('0x8d')][_0x1e0e14])){_0x5a1abc=_['find'](_0x489bc4,function(_0x438943){return _0x438943['id']===_0x489fc6[_0xc88c('0x8d')][_0x1e0e14]['ItemTypeId'];});if(!_[_0xc88c('0x55')](_0x5a1abc)){_0x4dcefc=_0x1e0e14;}}}if(_[_0xc88c('0x55')](_0x4dcefc)){_0x4dcefc=0x64;}_0x1fce66['push'](addAdditionalPhone(_0x489fc6['id'],_0x489fc6[_0xc88c('0x8d')][_0x1e0e14]['phone'],_0x489fc6[_0xc88c('0x8e')]?_[_0xc88c('0x55')](_0x489fc6[_0xc88c('0x8e')][_0x1e0e14])?null:_0x489fc6[_0xc88c('0x8e')][_0x1e0e14]:_0x489fc6[_0xc88c('0x8d')][_0x1e0e14][_0xc88c('0x8f')]?_0x489fc6[_0xc88c('0x8d')][_0x1e0e14][_0xc88c('0x8f')]:null,_0x4dcefc,_0x68ad74));}Promise[_0xc88c('0x63')](_0x1fce66)[_0xc88c('0x17')](function(){db[_0xc88c('0x25')][_0xc88c('0x16')]({'AdditionalPhones':_0x34747f},{'where':{'id':_0x489fc6['id']}})[_0xc88c('0x17')](function(){_0x703778(0x1);});});});});});}function addAdditionalPhone(_0x4ef7ea,_0x5be4ec,_0x556e18,_0x1839aa,_0x5903ff){return db[_0xc88c('0x69')][_0xc88c('0x23')]({'where':{'CmContactId':_0x4ef7ea,'item':_0x5be4ec}})['then'](function(_0x7c73ea){if(_0x7c73ea)logger['info'](_0xc88c('0x91'),_0x7c73ea);else{db[_0xc88c('0x69')][_0xc88c('0x43')]({'CmContactId':_0x4ef7ea,'item':_0x5be4ec,'ItemTypeId':_0x556e18,'OrderBy':_0x1839aa,'ItemClass':_0xc88c('0x92'),'description':_0x5903ff});}});}function deleteCmHopperPhones(_0x3ab4f7){return new Promise(function(_0x118f38){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3ab4f7}})[_0xc88c('0x17')](function(_0x5c8538){db[_0xc88c('0x93')][_0xc88c('0x18')]({'where':{'CmHopperId':{'$in':_['map'](_0x5c8538,'id')}}});})[_0xc88c('0x17')](function(){_0x118f38(0x1);});});}function addCmHopperPhones(_0x30cbc1){return new Promise(function(_0x1a83a6){return db[_0xc88c('0x3f')][_0xc88c('0x2d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x30cbc1}})[_0xc88c('0x17')](function(_0x48eaa6){var _0x2a88b3=[];_[_0xc88c('0x6f')](_0x48eaa6,function(_0x3abe86){_0x2a88b3[_0xc88c('0x61')](createCmHopperPhone(_0x30cbc1,_0x3abe86['id']));});Promise['all'](_0x2a88b3)[_0xc88c('0x17')](function(){_0x1a83a6(0x1);});});});}function createCmHopperPhone(_0x52e07b,_0x9425e1){return new Promise(function(_0x4008f8){db[_0xc88c('0x69')][_0xc88c('0x2d')]({'raw':!![],'attributes':[_0xc88c('0x94'),'OrderBy'],'where':{'CmContactId':_0x52e07b,'ItemClass':_0xc88c('0x92')},'include':[{'model':db[_0xc88c('0x8b')],'attributes':[_0xc88c('0x8c')],'as':_0xc88c('0x6a')}],'order':[_0xc88c('0x8c'),db[_0xc88c('0x6b')][_0xc88c('0x6c')]('`ItemType`.OrderBy')]})[_0xc88c('0x17')](function(_0x17bb11){var _0x443479=0x1;var _0x230198=_[_0xc88c('0x6f')](_0x17bb11,function(_0x7bc029){_0x7bc029['CmHopperId']=_0x9425e1;_0x7bc029[_0xc88c('0x7b')]=_0x7bc029[_0xc88c('0x94')];_0x7bc029['OrderBy']=_0x443479;delete _0x7bc029['ItemType.OrderBy'];_0x443479=_0x443479+0x1;return _0x7bc029;});return db[_0xc88c('0x93')][_0xc88c('0x5a')](_0x230198,{});})['then'](function(){_0x4008f8(0x1);});});}function insertAdditionalPhones(_0x23227a,_0x5716e4){return new Promise(function(_0x574fe1){var _0x15eaf5=[];for(var _0x1da09b=0x0;_0x1da09b<_0x5716e4[_0xc88c('0x27')];_0x1da09b++){var _0x51522c=_0x5716e4[_0x1da09b];_0x15eaf5['push'](parseContactItemType(_0x51522c));}Promise[_0xc88c('0x63')](_0x15eaf5)[_0xc88c('0x17')](function(){var _0x217500={'id':_0x23227a['id'],'items':_0x5716e4};return addAdditionalPhones(_0x217500)[_0xc88c('0x17')](function(){return addCmHopperPhones(_0x23227a['id']);});})[_0xc88c('0x17')](function(){_0x574fe1(_0x23227a);});});}function parseContactItemType(_0x4e0729){return new Promise(function(_0x95c043){if(_0x4e0729[_0xc88c('0x35')](_0xc88c('0x8f'))){_0x95c043(_0x4e0729);}else{return db['ContactItemType'][_0xc88c('0x23')]({'where':{'name':_0x4e0729[_0xc88c('0x6a')]}})[_0xc88c('0x17')](function(_0x1895af){if(_[_0xc88c('0x55')](_0x1895af))_0x4e0729['ItemTypeId']=null;else _0x4e0729[_0xc88c('0x8f')]=_0x1895af['id'];_0x95c043(_0x4e0729);});}});}exports[_0xc88c('0x95')]=function(_0x29801f,_0x72def2){return db[_0xc88c('0x69')][_0xc88c('0x2d')]({'raw':!![],'where':{'CmContactId':_0x29801f['params']['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xc88c('0x8b')],'as':'ItemType'}],'order':[['OrderBy'],[db[_0xc88c('0x6b')]['literal'](_0xc88c('0x96'))]]})[_0xc88c('0x17')](function(_0x5ea8e0){return _0x5ea8e0;})[_0xc88c('0x17')](respondWithResult(_0x72def2,null))[_0xc88c('0x22')](handleError(_0x72def2,null));};exports[_0xc88c('0x97')]=function(_0x4895a3,_0x3c1150){return db[_0xc88c('0x69')][_0xc88c('0x2d')]({'raw':!![],'where':{'CmContactId':_0x4895a3[_0xc88c('0x37')][_0xc88c('0x98')]}})['then'](function(_0x29d8db){var _0x294793=_[_0xc88c('0x6f')](_0x29d8db,function(_0xe30a02){_0xe30a02[_0xc88c('0x99')]=_0x4895a3[_0xc88c('0x37')][_0xc88c('0x9a')];return _0xe30a02;});return db[_0xc88c('0x69')][_0xc88c('0x5a')](_0x294793,{});})[_0xc88c('0x17')](function(){return addCmHopperPhones(_0x4895a3[_0xc88c('0x37')][_0xc88c('0x9a')]);})[_0xc88c('0x17')](function(){return['ok'];})[_0xc88c('0x17')](respondWithResult(_0x3c1150,null))[_0xc88c('0x22')](handleError(_0x3c1150,null));};exports[_0xc88c('0x9b')]=function(_0x384618,_0x23b76e){var _0x4d1aaa=[];_0x4d1aaa[_0xc88c('0x61')](createCmHopperPhone(_0x384618[_0xc88c('0x37')]['id'],_0x384618[_0xc88c('0x37')][_0xc88c('0x9c')]));Promise[_0xc88c('0x63')](_0x4d1aaa)[_0xc88c('0x17')](function(){return[0x1];})[_0xc88c('0x17')](respondWithResult(_0x23b76e,null));};exports['getHoppers']=function(_0x59f93c,_0x322b97){var _0x3e2855={'raw':![],'where':{}};var _0x18a6bc={};var _0x2d640d={'count':0x0,'rows':[]};return db[_0xc88c('0x25')][_0xc88c('0x7d')]({'where':{'id':_0x59f93c['params']['id']}})['then'](handleEntityNotFound(_0x322b97,null))[_0xc88c('0x17')](function(_0x70f238){if(_0x70f238){_0x18a6bc['model']=_['keys'](db[_0xc88c('0x3f')][_0xc88c('0x7e')]);_0x18a6bc['query']=_[_0xc88c('0x26')](_0x59f93c[_0xc88c('0x21')]);_0x18a6bc[_0xc88c('0x7f')]=_[_0xc88c('0x9d')](_0x18a6bc[_0xc88c('0x81')],_0x18a6bc[_0xc88c('0x21')]);_0x3e2855[_0xc88c('0x80')]=_['intersection'](_0x18a6bc[_0xc88c('0x81')],qs['fields'](_0x59f93c[_0xc88c('0x21')]['fields']));_0x3e2855[_0xc88c('0x80')]=_0x3e2855[_0xc88c('0x80')][_0xc88c('0x27')]?_0x3e2855[_0xc88c('0x80')]:_0x18a6bc[_0xc88c('0x81')];if(!_0x59f93c['query'][_0xc88c('0x35')](_0xc88c('0x87'))){_0x3e2855[_0xc88c('0x12')]=qs[_0xc88c('0x12')](_0x59f93c['query'][_0xc88c('0x12')]);_0x3e2855[_0xc88c('0x10')]=qs['offset'](_0x59f93c[_0xc88c('0x21')]['offset']);}_0x3e2855[_0xc88c('0x83')]=qs[_0xc88c('0x84')](_0x59f93c[_0xc88c('0x21')][_0xc88c('0x84')]);_0x3e2855[_0xc88c('0x5d')]=qs[_0xc88c('0x7f')](_['pick'](_0x59f93c[_0xc88c('0x21')],_0x18a6bc['filters']));_0x3e2855[_0xc88c('0x5d')][_0xc88c('0x9e')]=_0x70f238['id'];if(_0x59f93c[_0xc88c('0x21')][_0xc88c('0x86')]){_0x3e2855[_0xc88c('0x5d')]=_['merge'](_0x3e2855[_0xc88c('0x5d')],{'$or':_[_0xc88c('0x6f')](_0x3e2855['attributes'],function(_0x2b25a4){var _0x571cc3={};_0x571cc3[_0x2b25a4]={'$like':'%'+_0x59f93c[_0xc88c('0x21')]['filter']+'%'};return _0x571cc3;})});}_0x3e2855=_[_0xc88c('0x36')]({},_0x3e2855,_0x59f93c[_0xc88c('0x9f')]);return db[_0xc88c('0x3f')][_0xc88c('0x13')]({'where':_0x3e2855[_0xc88c('0x5d')]})['then'](function(_0x4bb84c){_0x2d640d[_0xc88c('0x13')]=_0x4bb84c;if(_0x59f93c[_0xc88c('0x21')][_0xc88c('0xa0')]){_0x3e2855['include']=[{'all':!![]}];}return db[_0xc88c('0x3f')][_0xc88c('0x2d')](_0x3e2855);})[_0xc88c('0x17')](function(_0x4b7da){_0x2d640d[_0xc88c('0xa1')]=_0x4b7da;return _0x2d640d;});}})[_0xc88c('0x17')](respondWithFilteredResult(_0x322b97,_0x3e2855))['catch'](handleError(_0x322b97,null));};exports[_0xc88c('0xa2')]=function(_0x1c7b51,_0x5c8c19){var _0x180305={'raw':!![],'where':{}};var _0x3ab2e3={};var _0x1253ba={'count':0x0,'rows':[]};return db['CmContact'][_0xc88c('0x7d')]({'where':{'id':_0x1c7b51['params']['id']}})[_0xc88c('0x17')](handleEntityNotFound(_0x5c8c19,null))[_0xc88c('0x17')](function(_0x554fc1){if(_0x554fc1){_0x3ab2e3[_0xc88c('0x81')]=_[_0xc88c('0x26')](db[_0xc88c('0x4c')][_0xc88c('0x7e')]);_0x3ab2e3[_0xc88c('0x21')]=_[_0xc88c('0x26')](_0x1c7b51['query']);_0x3ab2e3['filters']=_[_0xc88c('0x9d')](_0x3ab2e3[_0xc88c('0x81')],_0x3ab2e3[_0xc88c('0x21')]);_0x180305['attributes']=_[_0xc88c('0x9d')](_0x3ab2e3['model'],qs[_0xc88c('0x82')](_0x1c7b51[_0xc88c('0x21')][_0xc88c('0x82')]));_0x180305[_0xc88c('0x80')]=_0x180305['attributes'][_0xc88c('0x27')]?_0x180305[_0xc88c('0x80')]:_0x3ab2e3[_0xc88c('0x81')];if(!_0x1c7b51[_0xc88c('0x21')][_0xc88c('0x35')](_0xc88c('0x87'))){_0x180305[_0xc88c('0x12')]=qs[_0xc88c('0x12')](_0x1c7b51['query'][_0xc88c('0x12')]);_0x180305['offset']=qs['offset'](_0x1c7b51['query']['offset']);}_0x180305['order']=qs[_0xc88c('0x84')](_0x1c7b51['query'][_0xc88c('0x84')]);_0x180305['where']=qs[_0xc88c('0x7f')](_[_0xc88c('0x85')](_0x1c7b51[_0xc88c('0x21')],_0x3ab2e3['filters']));_0x180305[_0xc88c('0x5d')][_0xc88c('0x9e')]=_0x554fc1['id'];if(_0x1c7b51['query'][_0xc88c('0x86')]){_0x180305[_0xc88c('0x5d')]=_[_0xc88c('0x36')](_0x180305[_0xc88c('0x5d')],{'$or':_[_0xc88c('0x6f')](_0x180305['attributes'],function(_0x49ef7f){var _0x44ff59={};_0x44ff59[_0x49ef7f]={'$like':'%'+_0x1c7b51[_0xc88c('0x21')][_0xc88c('0x86')]+'%'};return _0x44ff59;})});}_0x180305=_['merge']({},_0x180305,_0x1c7b51[_0xc88c('0x9f')]);return db[_0xc88c('0x4c')][_0xc88c('0x13')]({'where':_0x180305['where']})['then'](function(_0x705d91){_0x1253ba[_0xc88c('0x13')]=_0x705d91;if(_0x1c7b51[_0xc88c('0x21')][_0xc88c('0xa0')]){_0x180305['include']=[{'all':!![]}];}return db[_0xc88c('0x4c')][_0xc88c('0x2d')](_0x180305);})[_0xc88c('0x17')](function(_0x3e4f61){_0x1253ba['rows']=_0x3e4f61;return _0x1253ba;});}})['then'](respondWithFilteredResult(_0x5c8c19,_0x180305))[_0xc88c('0x22')](handleError(_0x5c8c19,null));};exports[_0xc88c('0xa3')]=function(_0x393d22,_0x47d38c){var _0x3fd9c6={'raw':!![],'where':{}};var _0x2f46e2={};var _0xe935a2={'count':0x0,'rows':[]};return db[_0xc88c('0x25')][_0xc88c('0x7d')]({'where':{'id':_0x393d22[_0xc88c('0x24')]['id']}})[_0xc88c('0x17')](handleEntityNotFound(_0x47d38c,null))[_0xc88c('0x17')](function(_0x39e988){if(_0x39e988){_0x2f46e2[_0xc88c('0x81')]=_[_0xc88c('0x26')](db[_0xc88c('0x4b')][_0xc88c('0x7e')]);_0x2f46e2['query']=_[_0xc88c('0x26')](_0x393d22[_0xc88c('0x21')]);_0x2f46e2[_0xc88c('0x7f')]=_[_0xc88c('0x9d')](_0x2f46e2['model'],_0x2f46e2[_0xc88c('0x21')]);_0x3fd9c6['attributes']=_['intersection'](_0x2f46e2[_0xc88c('0x81')],qs[_0xc88c('0x82')](_0x393d22['query'][_0xc88c('0x82')]));_0x3fd9c6['attributes']=_0x3fd9c6[_0xc88c('0x80')][_0xc88c('0x27')]?_0x3fd9c6[_0xc88c('0x80')]:_0x2f46e2[_0xc88c('0x81')];if(!_0x393d22[_0xc88c('0x21')][_0xc88c('0x35')]('nolimit')){_0x3fd9c6[_0xc88c('0x12')]=qs[_0xc88c('0x12')](_0x393d22[_0xc88c('0x21')]['limit']);_0x3fd9c6[_0xc88c('0x10')]=qs[_0xc88c('0x10')](_0x393d22[_0xc88c('0x21')][_0xc88c('0x10')]);}_0x3fd9c6[_0xc88c('0x83')]=qs['sort'](_0x393d22['query']['sort']);_0x3fd9c6['where']=qs[_0xc88c('0x7f')](_['pick'](_0x393d22[_0xc88c('0x21')],_0x2f46e2[_0xc88c('0x7f')]));_0x3fd9c6[_0xc88c('0x5d')][_0xc88c('0x9e')]=_0x39e988['id'];if(_0x393d22['query'][_0xc88c('0x86')]){_0x3fd9c6[_0xc88c('0x5d')]=_[_0xc88c('0x36')](_0x3fd9c6[_0xc88c('0x5d')],{'$or':_['map'](_0x3fd9c6[_0xc88c('0x80')],function(_0x4edd32){var _0x55de63={};_0x55de63[_0x4edd32]={'$like':'%'+_0x393d22[_0xc88c('0x21')][_0xc88c('0x86')]+'%'};return _0x55de63;})});}_0x3fd9c6=_[_0xc88c('0x36')]({},_0x3fd9c6,_0x393d22[_0xc88c('0x9f')]);return db[_0xc88c('0x4b')]['count']({'where':_0x3fd9c6[_0xc88c('0x5d')]})['then'](function(_0x1fcf03){_0xe935a2[_0xc88c('0x13')]=_0x1fcf03;if(_0x393d22[_0xc88c('0x21')][_0xc88c('0xa0')]){_0x3fd9c6['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3fd9c6);})[_0xc88c('0x17')](function(_0x3bae12){_0xe935a2[_0xc88c('0xa1')]=_0x3bae12;return _0xe935a2;});}})[_0xc88c('0x17')](respondWithFilteredResult(_0x47d38c,_0x3fd9c6))[_0xc88c('0x22')](handleError(_0x47d38c,null));};exports[_0xc88c('0xa4')]=function(_0x10108a,_0x19e67f){var _0x2fb9b0={'raw':!![],'where':{}};var _0x5bb78c={};var _0x298215={'count':0x0,'rows':[]};return db[_0xc88c('0x25')][_0xc88c('0x7d')]({'where':{'id':_0x10108a[_0xc88c('0x24')]['id']}})[_0xc88c('0x17')](handleEntityNotFound(_0x19e67f,null))[_0xc88c('0x17')](function(_0x226537){if(_0x226537){_0x5bb78c['model']=_[_0xc88c('0x26')](db['JscriptySessionReport'][_0xc88c('0x7e')]);_0x5bb78c[_0xc88c('0x21')]=_[_0xc88c('0x26')](_0x10108a[_0xc88c('0x21')]);_0x5bb78c[_0xc88c('0x7f')]=_[_0xc88c('0x9d')](_0x5bb78c['model'],_0x5bb78c[_0xc88c('0x21')]);_0x2fb9b0[_0xc88c('0x80')]=_[_0xc88c('0x9d')](_0x5bb78c[_0xc88c('0x81')],qs[_0xc88c('0x82')](_0x10108a[_0xc88c('0x21')][_0xc88c('0x82')]));_0x2fb9b0[_0xc88c('0x80')]=_0x2fb9b0[_0xc88c('0x80')][_0xc88c('0x27')]?_0x2fb9b0[_0xc88c('0x80')]:_0x5bb78c[_0xc88c('0x81')];if(!_0x10108a[_0xc88c('0x21')][_0xc88c('0x35')]('nolimit')){_0x2fb9b0['limit']=qs[_0xc88c('0x12')](_0x10108a['query'][_0xc88c('0x12')]);_0x2fb9b0[_0xc88c('0x10')]=qs['offset'](_0x10108a[_0xc88c('0x21')][_0xc88c('0x10')]);}_0x2fb9b0['order']=qs[_0xc88c('0x84')](_0x10108a[_0xc88c('0x21')][_0xc88c('0x84')]);_0x2fb9b0[_0xc88c('0x5d')]=qs[_0xc88c('0x7f')](_['pick'](_0x10108a['query'],_0x5bb78c[_0xc88c('0x7f')]));_0x2fb9b0['where'][_0xc88c('0x9e')]=_0x226537['id'];if(_0x10108a['query'][_0xc88c('0x86')]){_0x2fb9b0[_0xc88c('0x5d')]=_[_0xc88c('0x36')](_0x2fb9b0[_0xc88c('0x5d')],{'$or':_[_0xc88c('0x6f')](_0x2fb9b0[_0xc88c('0x80')],function(_0xf31515){var _0x39028f={};_0x39028f[_0xf31515]={'$like':'%'+_0x10108a['query'][_0xc88c('0x86')]+'%'};return _0x39028f;})});}_0x2fb9b0=_['merge']({},_0x2fb9b0,_0x10108a[_0xc88c('0x9f')]);return db['JscriptySessionReport'][_0xc88c('0x13')]({'where':_0x2fb9b0[_0xc88c('0x5d')]})[_0xc88c('0x17')](function(_0x5023cc){_0x298215['count']=_0x5023cc;if(_0x10108a['query'][_0xc88c('0xa0')]){_0x2fb9b0['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc88c('0x2d')](_0x2fb9b0);})[_0xc88c('0x17')](function(_0x3fd91d){_0x298215[_0xc88c('0xa1')]=_0x3fd91d;return _0x298215;});}})[_0xc88c('0x17')](respondWithFilteredResult(_0x19e67f,_0x2fb9b0))['catch'](handleError(_0x19e67f,null));};exports[_0xc88c('0xa5')]=function(_0x41da43,_0xc92ebb){try{if(!_0x41da43['body']['ListId']){throw new Error(_0xc88c('0xa6'));}if(!_0x41da43[_0xc88c('0x37')][_0xc88c('0xa7')]){throw new Error(_0xc88c('0xa8'));}if(!_0x41da43[_0xc88c('0x37')][_0xc88c('0xa9')]){throw new Error(_0xc88c('0xaa'));}if(!_0x41da43['body'][_0xc88c('0xab')]){throw new Error(_0xc88c('0xac'));}var _0x114162=_0x41da43['body']['binding_keys'][_0xc88c('0xad')](',');var _0x390547=_0x41da43[_0xc88c('0x37')]['binding_values']['split'](',');if(!_0x114162[_0xc88c('0x27')]||!_0x390547[_0xc88c('0x27')]||_0x114162[_0xc88c('0x27')]!==_0x390547[_0xc88c('0x27')]){throw new Error(_0xc88c('0xae'));}_0x41da43[_0xc88c('0x37')][_0xc88c('0x82')]=_[_0xc88c('0xaf')](_0x114162,_0x390547);if(!_0x41da43['body'][_0xc88c('0x82')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x41da43[_0xc88c('0x37')]['fields'][_0xc88c('0xb0')]){throw new Error(_0xc88c('0xb1'));}var _0x3b51be=path[_0xc88c('0x3d')](config[_0xc88c('0xb2')],_0xc88c('0xb3'),_0x41da43[_0xc88c('0xb4')][_0xc88c('0xb5')]);fs['chmodSync'](_0x3b51be,parseInt(_0xc88c('0xb6'),0x8));var _0x2cc013=require(_0xc88c('0xb7'))[_0xc88c('0xb8')](path[_0xc88c('0x3d')](__dirname,_0xc88c('0xb9')),[_0x3b51be,_0x41da43[_0xc88c('0x37')][_0xc88c('0xa7')],_0x41da43[_0xc88c('0x37')][_0xc88c('0xa9')],_0x41da43[_0xc88c('0x37')][_0xc88c('0x5f')],_0x41da43[_0xc88c('0x37')][_0xc88c('0xba')],_0x41da43[_0xc88c('0x37')][_0xc88c('0x5c')],_0x41da43['body'][_0xc88c('0xab')]]);return _0xc92ebb['status'](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x2cc013['pid']});}catch(_0x14ed67){return _0xc92ebb['status'](0x1f4)[_0xc88c('0x1d')](_0x14ed67);}};exports[_0xc88c('0xbb')]=function(_0x229af4,_0x117ac2){var _0x3dd67e=fs['createReadStream'](_0x229af4['file'][_0xc88c('0x0')]);Papa[_0xc88c('0xbc')](_0x3dd67e,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3821f7){return _0x117ac2[_0xc88c('0xe')](0xc8)[_0xc88c('0xf')]({'file':_0x229af4[_0xc88c('0xb4')],'fields':_0x3821f7['meta'][_0xc88c('0x82')]});}});};exports[_0xc88c('0xbd')]=function(_0x2c7a6b,_0x4a1f6e){return db['User'][_0xc88c('0x2d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc88c('0xbe')}})[_0xc88c('0x17')](function(_0x220883){var _0x1bce69=![];if(!_0x2c7a6b[_0xc88c('0x37')][_0xc88c('0x5f')]){throw new Error(_0xc88c('0xa6'));}if(!_0x2c7a6b[_0xc88c('0x37')][_0xc88c('0xbf')][_0xc88c('0x7b')]){throw new Error(_0xc88c('0xc0'));}if(!_0x2c7a6b[_0xc88c('0x37')][_0xc88c('0xbf')][_0xc88c('0xb0')]){throw new Error(_0xc88c('0xb1'));}if(!_0x2c7a6b['body'][_0xc88c('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4964e8=require(_0xc88c('0xb7'))[_0xc88c('0xb8')](path[_0xc88c('0x3d')](__dirname,_0xc88c('0xc1')),[_0x2c7a6b[_0xc88c('0x24')]['id'],JSON[_0xc88c('0xc2')](_0x2c7a6b[_0xc88c('0x37')]),JSON[_0xc88c('0xc2')](_0x220883)]);_0x4964e8['on'](_0xc88c('0xc3'),function(){_0x1bce69=!![];return _0x4a1f6e[_0xc88c('0xe')](0xc8)[_0xc88c('0xf')]({'message':_0xc88c('0xc4'),'pid':_0x4964e8['pid']});});_0x4964e8['on'](_0xc88c('0xc5'),function(_0x1a686c){if(_0x1a686c&&!_0x1bce69){return _0x4a1f6e[_0xc88c('0xe')](0x1f4)[_0xc88c('0xf')]({'message':'error\x20child\x20process','pid':_0x4964e8[_0xc88c('0xc6')]});}});})[_0xc88c('0x22')](handleError(_0x4a1f6e,null));};exports[_0xc88c('0xc7')]=function(_0x35ae35,_0x7b8df1){return db[_0xc88c('0xc8')][_0xc88c('0x2d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc88c('0xbe')}})[_0xc88c('0x17')](function(_0x265496){var _0x47b5ce=![];if(!_0x35ae35['body'][_0xc88c('0x5f')]){throw new Error(_0xc88c('0xa6'));}if(!_0x35ae35[_0xc88c('0x37')][_0xc88c('0xbf')]['phone']){throw new Error(_0xc88c('0xc0'));}if(!_0x35ae35['body'][_0xc88c('0xbf')][_0xc88c('0xb0')]){throw new Error(_0xc88c('0xb1'));}if(!_0x35ae35[_0xc88c('0x37')][_0xc88c('0xab')]){throw new Error(_0xc88c('0xac'));}var _0x9184b3=require(_0xc88c('0xb7'))[_0xc88c('0xb8')](path[_0xc88c('0x3d')](__dirname,_0xc88c('0xc9')),[_0x35ae35[_0xc88c('0x24')]['id'],JSON['stringify'](_0x35ae35[_0xc88c('0x37')]),JSON['stringify'](_0x265496)]);_0x9184b3['on'](_0xc88c('0xc3'),function(){_0x47b5ce=!![];return _0x7b8df1[_0xc88c('0xe')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x9184b3[_0xc88c('0xc6')]});});_0x9184b3['on']('exit',function(_0x5b41e0){if(_0x5b41e0&&!_0x47b5ce){return _0x7b8df1[_0xc88c('0xe')](0x1f4)[_0xc88c('0xf')]({'message':_0xc88c('0xca'),'pid':_0x9184b3[_0xc88c('0xc6')]});}});})['catch'](handleError(_0x7b8df1,null));};exports[_0xc88c('0xcb')]=function(_0x134244,_0x3ecad8){var _0x47accc=['mail',_0xc88c('0xcc'),_0xc88c('0xcd'),_0xc88c('0xce'),_0xc88c('0xcf'),_0xc88c('0xd0'),_0xc88c('0xd1')];var _0x3ad5fb={'offset':0x0,'order':qs[_0xc88c('0x84')](_0xc88c('0xd2'))},_0x2f13db={'count':0x0,'rows':[]};Promise[_0xc88c('0xd3')]()[_0xc88c('0x17')](function(){if(_0x134244['query'][_0xc88c('0xd4')]){if(!_[_0xc88c('0xd5')](_0x47accc,_0x134244[_0xc88c('0x21')][_0xc88c('0xd4')][_0xc88c('0xd6')]())){throw new Error('Invalid\x20channel');}_0x47accc=[_0x134244['query'][_0xc88c('0xd4')][_0xc88c('0xd6')]()];}if(_0x134244[_0xc88c('0x21')][_0xc88c('0xd7')]){try{var _0x21801e=JSON[_0xc88c('0xbc')](_0x134244[_0xc88c('0x21')][_0xc88c('0xd7')]);if(!moment(_0x21801e['from'])['isValid']()){throw new Error(_0xc88c('0xd8'));}if(!moment(_0x21801e['to'])['isValid']()){throw new Error(_0xc88c('0xd9'));}}catch(_0x1095da){throw new Error(_0xc88c('0xda'));}}if(!_0x134244[_0xc88c('0x21')][_0xc88c('0x35')]('nolimit')){_0x3ad5fb['limit']=qs['limit'](_0x134244[_0xc88c('0x21')][_0xc88c('0x12')]||0xa);_0x3ad5fb['offset']=qs['offset'](_0x134244[_0xc88c('0x21')][_0xc88c('0x10')]);}var _0x251ca5=_0x47accc[_0xc88c('0x6f')](function(_0x466cf6){if(_0x466cf6===_0xc88c('0xd1')){var _0x53b9a8={'attributes':['id',_0xc88c('0xdb'),_0xc88c('0x30'),_0xc88c('0xdc'),_0xc88c('0xdd'),_0xc88c('0xde'),_0xc88c('0xdf'),'endtime',_0xc88c('0xe0'),_0xc88c('0xe1'),_0xc88c('0xe2'),_0xc88c('0xe3'),'userSecondDisposition','userThirdDisposition',_0xc88c('0xe4')],'where':{'ContactId':_0x134244['params']['id']},'include':[{'model':db[_0xc88c('0xc8')],'as':_0xc88c('0xc8'),'attributes':['id',_0xc88c('0x1c'),_0xc88c('0xe5'),_0xc88c('0x2e')]}],'order':[[_0xc88c('0xe2'),_0xc88c('0xe6')]]};if(_0x134244[_0xc88c('0x21')]['range']){_0x53b9a8[_0xc88c('0x5d')][_0xc88c('0xe2')]={'$gte':_0x21801e[_0xc88c('0x38')],'$lte':_0x21801e['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x53b9a8)[_0xc88c('0x17')](function(_0x3d090d){_0x2f13db[_0xc88c('0x13')]+=_0x3d090d['count'];return _[_0xc88c('0x6f')](_0x3d090d[_0xc88c('0xa1')],function(_0x1d4e6d){var _0x68945a=_0x1d4e6d[_0xc88c('0x39')]({'plain':!![]});_0x68945a[_0xc88c('0xd4')]=_0x466cf6;if(_0x68945a[_0xc88c('0xc8')]){_0x68945a[_0xc88c('0xc8')]={'id':_0x68945a[_0xc88c('0xc8')]['id'],'name':_0x68945a[_0xc88c('0xc8')]['name'],'fullname':_0x68945a[_0xc88c('0xc8')][_0xc88c('0xe5')],'alias':_0x68945a['User'][_0xc88c('0x2e')]};}return _0x68945a;});});}else{var _0x4628b2=_[_0xc88c('0xe7')](_0x466cf6)+(_0x466cf6===_0xc88c('0xcc')?_0xc88c('0xe8'):_0xc88c('0xe9'));var _0x259f38={'attributes':['id',_0xc88c('0xea'),_0xc88c('0xeb'),'createdAt',_0xc88c('0xe1'),_0xc88c('0xec'),_0xc88c('0xed'),_0xc88c('0xee'),_0xc88c('0xe4'),_0x4628b2+'Id'],'where':{'ContactId':_0x134244[_0xc88c('0x24')]['id']},'include':[{'model':db[_0x4628b2],'as':_0xc88c('0xe9'),'attributes':['id',_0xc88c('0x1c'),_0xc88c('0xef')]},{'model':db[_0xc88c('0xc8')],'as':_0xc88c('0xf0'),'attributes':['id',_0xc88c('0x1c'),_0xc88c('0xe5')]},{'model':db[_0xc88c('0x65')],'as':_0xc88c('0x66'),'attributes':['id','name',_0xc88c('0x67')],'through':{'attributes':[]}}],'order':[['createdAt',_0xc88c('0xe6')]]};if(_0x134244[_0xc88c('0x21')][_0xc88c('0xd7')]){_0x259f38[_0xc88c('0x5d')][_0xc88c('0xe2')]={'$gte':_0x21801e[_0xc88c('0x38')],'$lte':_0x21801e['to']};}switch(_0x466cf6){case _0xc88c('0xcc'):_0x259f38[_0xc88c('0x80')][_0xc88c('0x61')]('browserName',_0xc88c('0xf1'),'customerPort','deviceModel','osName',_0xc88c('0xf2'),_0xc88c('0xf3'),_0xc88c('0xf4'),_0xc88c('0xf5'));break;case _0xc88c('0xf6'):_0x259f38[_0xc88c('0x80')][_0xc88c('0x61')](_0xc88c('0xf7'),_0xc88c('0xf8'));break;case _0xc88c('0xce'):_0x259f38['attributes'][_0xc88c('0x61')]('externalUrl','threadId');break;}return db[_['startCase'](_0x466cf6)+_0xc88c('0xf9')][_0xc88c('0xfa')](_0x259f38)[_0xc88c('0x17')](function(_0x4c4d70){_0x2f13db[_0xc88c('0x13')]+=_0x4c4d70[_0xc88c('0x13')];return _[_0xc88c('0x6f')](_0x4c4d70['rows'],function(_0xb4fce6){var _0x472f3d=_0xb4fce6[_0xc88c('0x39')]({'plain':!![]});_0x472f3d[_0xc88c('0xd4')]=_0x466cf6;if(_0x472f3d[_0xc88c('0xf0')]){_0x472f3d[_0xc88c('0xf0')]={'id':_0x472f3d['Owner']['id'],'name':_0x472f3d[_0xc88c('0xf0')][_0xc88c('0x1c')],'fullname':_0x472f3d[_0xc88c('0xf0')]['fullname']};}return _0x472f3d;});});}});return Promise[_0xc88c('0x63')](_0x251ca5);})[_0xc88c('0x17')](function(_0x57bdce){return _(_0x57bdce)[_0xc88c('0xfb')]()[_0xc88c('0xfc')]('createdAt')[_0xc88c('0xfd')]()[_0xc88c('0xfe')]();})['then'](function(_0x20655a){_0x2f13db[_0xc88c('0xa1')]=_0x3ad5fb[_0xc88c('0x12')]?_0x20655a[_0xc88c('0xff')](_0x3ad5fb['offset'],_0x3ad5fb[_0xc88c('0x10')]+_0x3ad5fb['limit']):_0x20655a;return _0x2f13db;})[_0xc88c('0x17')](respondWithFilteredResult(_0x3ecad8,_0x3ad5fb))[_0xc88c('0x22')](handleError(_0x3ecad8,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 178793f..627d6cb 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 _0x296a=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x296a,0x15a));var _0xa296=function(_0x5b3702,_0x55912d){_0x5b3702=_0x5b3702-0x0;var _0x4ba573=_0x296a[_0x5b3702];return _0x4ba573;};'use strict';var EventEmitter=require(_0xa296('0x0'));var CmContact=require(_0xa296('0x1'))['db'][_0xa296('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa296('0x3')](0x0);var events={'afterCreate':_0xa296('0x4'),'afterUpdate':_0xa296('0x5'),'afterDestroy':_0xa296('0x6')};function emitEvent(_0x1cf8c7){return function(_0x223adb,_0x69001a,_0x4dc2c8){CmContactEvents['emit'](_0x1cf8c7+':'+_0x223adb['id'],_0x223adb);CmContactEvents[_0xa296('0x7')](_0x1cf8c7,_0x223adb);_0x4dc2c8(null);};}for(var e in events){if(events[_0xa296('0x8')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xa296('0x9')]=CmContactEvents; \ No newline at end of file +var _0x6c6c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x6c6c,0xa7));var _0xc6c6=function(_0x400ff9,_0x1f8596){_0x400ff9=_0x400ff9-0x0;var _0x5dd79e=_0x6c6c[_0x400ff9];return _0x5dd79e;};'use strict';var EventEmitter=require(_0xc6c6('0x0'));var CmContact=require(_0xc6c6('0x1'))['db'][_0xc6c6('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc6c6('0x3'),'afterUpdate':_0xc6c6('0x4'),'afterDestroy':_0xc6c6('0x5')};function emitEvent(_0x18dd47){return function(_0x5b6620,_0x2cf4d5,_0x2e0327){CmContactEvents[_0xc6c6('0x6')](_0x18dd47+':'+_0x5b6620['id'],_0x5b6620);CmContactEvents[_0xc6c6('0x6')](_0x18dd47,_0x5b6620);_0x2e0327(null);};}for(var e in events){if(events[_0xc6c6('0x7')](e)){var event=events[e];CmContact[_0xc6c6('0x8')](e,emitEvent(event));}}module[_0xc6c6('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index d7a2694..66a7b86 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 _0x25c6=['Campaign','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','models','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','api','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','email','FULLTEXT','utf8mb4','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','minutes','format','ret','CmHopper','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','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','timezones','utcOffset','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','always','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25c6,0x12a));var _0x625c=function(_0x75b2a5,_0x43902a){_0x75b2a5=_0x75b2a5-0x0;var _0x28937a=_0x25c6[_0x75b2a5];return _0x28937a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x625c('0x0'));var moment=require(_0x625c('0x1'));var BPromise=require(_0x625c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x625c('0x3'));var rimraf=require(_0x625c('0x4'));var config=require(_0x625c('0x5'));var shared=require(_0x625c('0x6'));var attributes=require(_0x625c('0x7'));module[_0x625c('0x8')]=function(_0x19441e,_0x155d8b){return _0x19441e[_0x625c('0x9')](_0x625c('0xa'),attributes,{'tableName':_0x625c('0xb'),'paranoid':!![],'indexes':[{'name':_0x625c('0xc'),'fields':[_0x625c('0xc')]},{'name':_0x625c('0xd'),'fields':['firstName',_0x625c('0xe'),'phone','mobile','fax',_0x625c('0xf')],'type':_0x625c('0x10')}],'timestamps':!![],'charset':_0x625c('0x11'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x46285e,_0x5eda50,_0x9b3d99){var _0x49d650=_0x19441e['models'];var _0x4cdcc0=_0x46285e[_0x625c('0x12')]({'plain':!![]});function _0x193fd2(){return function(_0x71d726){logger[_0x625c('0x13')](_0x625c('0x14'),_0x625c('0x15'),util[_0x625c('0x16')](_0x71d726,{'showHidden':![],'depth':null}));};}function _0x1e6e88(_0x4a2647,_0x4ebaaf){var _0x4a02cb=_0x4ebaaf[_0x625c('0x17')]?_0x4ebaaf[_0x625c('0x17')]:moment()['format'](_0x625c('0x18'));return new BPromise(function(_0x432950,_0x59ed06){if(_[_0x625c('0x19')](_0x4ebaaf[_0x625c('0x1a')])){_0x432950({'ret':_0x4a02cb});}else{_0x49d650[_0x625c('0x1b')][_0x625c('0x1c')]({'where':{'id':_0x4a2647['id']}})['then'](function(_0x140d50){if(!_[_0x625c('0x19')](_0x140d50)){var _0x1d65b6=_0x140d50['dialTimezone'];if(!_[_0x625c('0x19')](_0x1d65b6)){var _0x17106e=shared['timezones'];var _0x190d21=_0x17106e[_0x1d65b6];var _0xb25cc1=_0x17106e[_0x4ebaaf['dialTimezone']];if(!_[_0x625c('0x19')](_0x190d21)&&!_[_0x625c('0x19')](_0xb25cc1)){var _0x3b0ddb=_0x190d21['utcOffset']-_0xb25cc1['utcOffset'];_0x4a02cb=_0x4ebaaf['scheduledat']?_0x4ebaaf[_0x625c('0x17')]:moment();var _0x452596=moment(_0x4a02cb)['add'](_0x3b0ddb,_0x625c('0x1d'));_0x432950({'ret':_0x452596[_0x625c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x432950({'ret':_0x4a02cb});}else _0x432950({'ret':_0x4a02cb});}else{_0x432950({'ret':_0x4a02cb});}});}});return 0xa;}var _0xdc127f=function(_0x266554){return new BPromise(function(_0x41cd0a,_0x3e66d9){_0x1e6e88(_0x266554,_0x4cdcc0)['then'](function(_0x5e7134){_0x4cdcc0[_0x625c('0x17')]=_0x5e7134[_0x625c('0x1f')];_0x49d650[_0x625c('0x20')][_0x625c('0x1c')]({'where':{'phone':_0x4cdcc0[_0x625c('0xc')],'VoiceQueueId':_0x266554['id']}})[_0x625c('0x21')](function(_0x31b7e5){if(!_['isNil'](_0x31b7e5)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4cdcc0[_0x625c('0xc')]+_0x625c('0x22')+_0x266554['id']);}return _0x49d650['CmHopper'][_0x625c('0x23')]({'phone':_0x4cdcc0['phone'],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0[_0x625c('0x24')],'priority':_0x4cdcc0[_0x625c('0x25')]?_0x4cdcc0[_0x625c('0x25')]:0x2,'scheduledat':_0x4cdcc0['scheduledat']?_0x4cdcc0[_0x625c('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4cdcc0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4cdcc0['callbackUniqueid']?_0x4cdcc0[_0x625c('0x26')]:undefined,'callbackat':_0x4cdcc0['callbackUniqueid']?moment()['format'](_0x625c('0x18')):undefined,'VoiceQueueId':_0x266554['id']});})[_0x625c('0x27')](function(_0xf06a35){_0x3e66d9(_0xf06a35);});});});};var _0x5be8d9=function(_0x3da187){return new BPromise(function(_0x13c197,_0x1edd76){_0x1e6e88(_0x3da187,_0x4cdcc0)[_0x625c('0x21')](function(_0x154b6c){_0x4cdcc0[_0x625c('0x17')]=_0x154b6c[_0x625c('0x1f')];_0x49d650['CmHopper']['findOne']({'where':{'phone':_0x4cdcc0[_0x625c('0xc')],'VoiceQueueId':_0x3da187['id']}})[_0x625c('0x21')](function(_0x50829a){if(!_[_0x625c('0x19')](_0x50829a)){throw new Error(_0x625c('0x28')+_0x4cdcc0[_0x625c('0xc')]+_0x625c('0x29')+_0x3da187['id']);}return _0x49d650[_0x625c('0x2a')][_0x625c('0x1c')]({'where':{'calleridnum':_0x4cdcc0[_0x625c('0xc')],'VoiceQueueId':_0x3da187['id']}});})[_0x625c('0x21')](function(_0x5ae4f4){if(!_['isNil'](_0x5ae4f4)){throw new Error(_0x625c('0x2b')+_0x4cdcc0[_0x625c('0xc')]+_0x625c('0x2c')+_0x3da187['id']);}return _0x49d650['CmHopper'][_0x625c('0x23')]({'phone':_0x4cdcc0[_0x625c('0xc')],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0[_0x625c('0x24')],'priority':_0x4cdcc0[_0x625c('0x25')]?_0x4cdcc0['priority']:0x2,'scheduledat':_0x4cdcc0[_0x625c('0x17')]?_0x4cdcc0[_0x625c('0x17')]:moment()[_0x625c('0x1e')](_0x625c('0x18')),'callback':_0x4cdcc0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4cdcc0[_0x625c('0x26')]?_0x4cdcc0[_0x625c('0x26')]:undefined,'callbackat':_0x4cdcc0[_0x625c('0x26')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3da187['id']});})[_0x625c('0x27')](function(_0x55faf8){_0x1edd76(_0x55faf8);});});});};function _0x4f95b7(){return function(_0x42863e){logger[_0x625c('0x13')]('cmContact',_0x625c('0x15'),util[_0x625c('0x16')](_0x42863e,{'showHidden':![],'depth':null}));};}function _0x3169d4(_0x34c3fd,_0x439486){var _0x25fdcc=_0x439486[_0x625c('0x17')]?_0x439486['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x1e0d09,_0x51074f){if(_['isNil'](_0x439486[_0x625c('0x1a')])){_0x1e0d09({'ret':_0x25fdcc});}else{_0x49d650['Campaign'][_0x625c('0x1c')]({'where':{'id':_0x34c3fd['id']}})['then'](function(_0x2ec25f){if(!_['isNil'](_0x2ec25f)){var _0x251dee=_0x2ec25f['dialTimezone'];if(!_[_0x625c('0x19')](_0x251dee)){var _0x5e5406=shared[_0x625c('0x2d')];var _0x441e3f=_0x5e5406[_0x251dee];var _0x256f41=_0x5e5406[_0x439486[_0x625c('0x1a')]];if(!_[_0x625c('0x19')](_0x441e3f)&&!_[_0x625c('0x19')](_0x256f41)){var _0x39e800=_0x441e3f[_0x625c('0x2e')]-_0x256f41[_0x625c('0x2e')];_0x25fdcc=_0x439486['scheduledat']?_0x439486['scheduledat']:moment();var _0x31057a=moment(_0x25fdcc)[_0x625c('0x2f')](_0x39e800,_0x625c('0x1d'));_0x1e0d09({'ret':_0x31057a[_0x625c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1e0d09({'ret':_0x25fdcc});}else _0x1e0d09({'ret':_0x25fdcc});}else{_0x1e0d09({'ret':_0x25fdcc});}});}});return 0xa;}var _0x11bbe0=function(_0x16c4e3){return new BPromise(function(_0x24ba34,_0x190c37){_0x3169d4(_0x16c4e3,_0x4cdcc0)['then'](function(_0x493486){_0x4cdcc0[_0x625c('0x17')]=_0x493486[_0x625c('0x1f')];_0x49d650[_0x625c('0x20')][_0x625c('0x1c')]({'where':{'phone':_0x4cdcc0[_0x625c('0xc')],'CampaignId':_0x16c4e3['id']}})[_0x625c('0x21')](function(_0x3b1968){if(!_[_0x625c('0x19')](_0x3b1968)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4cdcc0[_0x625c('0xc')]+_0x625c('0x30')+_0x16c4e3['id']);}return _0x49d650[_0x625c('0x20')]['create']({'phone':_0x4cdcc0[_0x625c('0xc')],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0[_0x625c('0x24')],'priority':_0x4cdcc0[_0x625c('0x25')]?_0x4cdcc0[_0x625c('0x25')]:0x2,'scheduledat':_0x4cdcc0['scheduledat']?_0x4cdcc0[_0x625c('0x17')]:moment()['format'](_0x625c('0x18')),'callback':_0x4cdcc0[_0x625c('0x26')]?!![]:![],'callbackuniqueid':_0x4cdcc0['callbackUniqueid']?_0x4cdcc0['callbackUniqueid']:undefined,'callbackat':_0x4cdcc0[_0x625c('0x26')]?moment()[_0x625c('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x16c4e3['id']});})['catch'](function(_0x4d28d7){_0x190c37(_0x4d28d7);});});});};var _0x267335=function(_0x2f8329){return new BPromise(function(_0x36c967,_0x20fe33){_0x3169d4(_0x2f8329,_0x4cdcc0)[_0x625c('0x21')](function(_0x1f6b50){_0x4cdcc0[_0x625c('0x17')]=_0x1f6b50[_0x625c('0x1f')];_0x49d650['CmHopper'][_0x625c('0x1c')]({'where':{'phone':_0x4cdcc0['phone'],'CampaignId':_0x2f8329['id']}})[_0x625c('0x21')](function(_0x40b1fa){if(!_[_0x625c('0x19')](_0x40b1fa)){throw new Error(_0x625c('0x28')+_0x4cdcc0[_0x625c('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x2f8329['id']);}return _0x49d650[_0x625c('0x2a')][_0x625c('0x1c')]({'where':{'calleridnum':_0x4cdcc0[_0x625c('0xc')],'CampaignId':_0x2f8329['id']}});})[_0x625c('0x21')](function(_0x3fed0a){if(!_[_0x625c('0x19')](_0x3fed0a)){throw new Error(_0x625c('0x2b')+_0x4cdcc0[_0x625c('0xc')]+_0x625c('0x31')+_0x2f8329['id']);}return _0x49d650['CmHopper'][_0x625c('0x23')]({'phone':_0x4cdcc0['phone'],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0['ListId'],'priority':_0x4cdcc0[_0x625c('0x25')]?_0x4cdcc0[_0x625c('0x25')]:0x2,'scheduledat':_0x4cdcc0['scheduledat']?_0x4cdcc0[_0x625c('0x17')]:moment()['format'](_0x625c('0x18')),'callback':_0x4cdcc0[_0x625c('0x26')]?!![]:![],'callbackuniqueid':_0x4cdcc0['callbackUniqueid']?_0x4cdcc0[_0x625c('0x26')]:undefined,'callbackat':_0x4cdcc0[_0x625c('0x26')]?moment()[_0x625c('0x1e')](_0x625c('0x18')):undefined,'CampaignId':_0x2f8329['id']});})['catch'](function(_0xac650f){_0x20fe33(_0xac650f);});});});};if(_0x4cdcc0[_0x625c('0x24')]){_0x49d650['VoiceQueue'][_0x625c('0x32')]({'where':{'type':_0x625c('0x33')},'attributes':['id',_0x625c('0x34'),'dialTimezone'],'include':[{'model':_0x49d650[_0x625c('0x35')],'as':'Lists','where':{'id':_0x4cdcc0[_0x625c('0x24')]}}]})[_0x625c('0x21')](function(_0x3b1818){if(_0x3b1818){var _0x296fda=[];for(var _0x8a97b5=0x0,_0x2b8d09;_0x8a97b5<_0x3b1818[_0x625c('0x36')];_0x8a97b5+=0x1){_0x2b8d09=_0x3b1818[_0x8a97b5]['get']({'plain':!![]});switch(_0x2b8d09['dialCheckDuplicateType']){case _0x625c('0x37'):_0x5be8d9(_0x2b8d09)[_0x625c('0x27')](_0x193fd2());break;case'onlyIfOpen':_0xdc127f(_0x2b8d09)[_0x625c('0x27')](_0x193fd2());break;default:_0x3169d4(_0x2b8d09,_0x4cdcc0)[_0x625c('0x21')](function(_0x2c8433){_0x4cdcc0[_0x625c('0x17')]=_0x2c8433['ret'];_0x49d650[_0x625c('0x20')][_0x625c('0x23')]({'phone':_0x4cdcc0[_0x625c('0xc')],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0['ListId'],'scheduledat':_0x4cdcc0[_0x625c('0x17')]?_0x4cdcc0['scheduledat']:moment()[_0x625c('0x1e')](_0x625c('0x18')),'priority':_0x4cdcc0[_0x625c('0x25')]?_0x4cdcc0['priority']:0x2,'callback':_0x4cdcc0[_0x625c('0x26')]?!![]:![],'callbackuniqueid':_0x4cdcc0['callbackUniqueid']?_0x4cdcc0[_0x625c('0x26')]:undefined,'callbackat':_0x4cdcc0[_0x625c('0x26')]?moment()[_0x625c('0x1e')](_0x625c('0x18')):undefined,'VoiceQueueId':_0x2b8d09['id']})[_0x625c('0x27')](_0x193fd2());});}}}})[_0x625c('0x21')](function(){return _0x49d650['VoiceQueue'][_0x625c('0x32')]({'where':{'type':_0x625c('0x33')},'attributes':['id'],'include':[{'model':_0x49d650[_0x625c('0x35')],'as':'BlackLists','where':{'id':_0x4cdcc0['ListId']}}]})[_0x625c('0x21')](function(_0x5384c2){if(_0x5384c2){var _0x50d891=[];for(var _0x2a3f6f=0x0,_0x292bce;_0x2a3f6f<_0x5384c2[_0x625c('0x36')];_0x2a3f6f+=0x1){_0x292bce=_0x5384c2[_0x2a3f6f][_0x625c('0x12')]({'plain':!![]});_0x49d650['CmHopperBlack'][_0x625c('0x23')]({'phone':_0x4cdcc0[_0x625c('0xc')],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0[_0x625c('0x24')],'VoiceQueueId':_0x292bce['id']})[_0x625c('0x27')](function(_0x4dfd01){logger[_0x625c('0x13')]('cmContact,\x20%s,\x20%s',_0x625c('0x15'),_0x4dfd01[_0x625c('0x38')]);});}}});})['then'](function(){return _0x49d650[_0x625c('0x39')]['findAll']({'attributes':['id',_0x625c('0x34'),_0x625c('0x1a')],'include':[{'model':_0x49d650[_0x625c('0x35')],'as':'Lists','where':{'id':_0x4cdcc0[_0x625c('0x24')]}}]})[_0x625c('0x21')](function(_0xb84b6a){if(_0xb84b6a){var _0x4bfb8f=[];for(var _0x499b62=0x0,_0x3328c0;_0x499b62<_0xb84b6a[_0x625c('0x36')];_0x499b62+=0x1){_0x3328c0=_0xb84b6a[_0x499b62][_0x625c('0x12')]({'plain':!![]});switch(_0x3328c0[_0x625c('0x34')]){case _0x625c('0x37'):_0x267335(_0x3328c0)[_0x625c('0x27')](_0x4f95b7());break;case _0x625c('0x3a'):_0x11bbe0(_0x3328c0)[_0x625c('0x27')](_0x4f95b7());break;default:_0x49d650['CmHopper']['create']({'phone':_0x4cdcc0['phone'],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0['ListId'],'scheduledat':_0x4cdcc0[_0x625c('0x17')]?_0x4cdcc0[_0x625c('0x17')]:moment()[_0x625c('0x1e')](_0x625c('0x18')),'priority':_0x4cdcc0[_0x625c('0x25')]?_0x4cdcc0[_0x625c('0x25')]:0x2,'callback':_0x4cdcc0[_0x625c('0x26')]?!![]:![],'callbackuniqueid':_0x4cdcc0[_0x625c('0x26')]?_0x4cdcc0[_0x625c('0x26')]:undefined,'callbackat':_0x4cdcc0[_0x625c('0x26')]?moment()[_0x625c('0x1e')](_0x625c('0x18')):undefined,'CampaignId':_0x3328c0['id']})['catch'](_0x4f95b7());}}}});})['then'](function(){return _0x49d650['Campaign'][_0x625c('0x32')]({'attributes':['id'],'include':[{'model':_0x49d650[_0x625c('0x35')],'as':_0x625c('0x3b'),'where':{'id':_0x4cdcc0[_0x625c('0x24')]}}]})['then'](function(_0x564fd7){if(_0x564fd7){var _0x4ba73b=[];for(var _0x51e99a=0x0,_0x30b77f;_0x51e99a<_0x564fd7['length'];_0x51e99a+=0x1){_0x30b77f=_0x564fd7[_0x51e99a][_0x625c('0x12')]({'plain':!![]});_0x49d650['CmHopperBlack']['create']({'phone':_0x4cdcc0[_0x625c('0xc')],'ContactId':_0x4cdcc0['id'],'ListId':_0x4cdcc0['ListId'],'CampaignId':_0x30b77f['id']})[_0x625c('0x27')](function(_0x2eda34){logger[_0x625c('0x13')]('cmContact,\x20%s,\x20%s',_0x625c('0x15'),_0x2eda34[_0x625c('0x38')]);});}}});})[_0x625c('0x21')](function(){_0x9b3d99();})[_0x625c('0x27')](function(_0x49728f){logger[_0x625c('0x13')](_0x625c('0x3c'),_0x625c('0x15'),_0x49728f['message']);_0x9b3d99(_0x49728f);});}else{_0x9b3d99(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x7bd06a,_0x378e96,_0x31dd59){var _0x4d7ce3=_0x19441e[_0x625c('0x3d')];var _0x18c0f1=_0x7bd06a[_0x625c('0x12')]({'plain':!![]});return _0x4d7ce3[_0x625c('0x20')][_0x625c('0x32')]({'raw':!![],'where':{'ListId':_0x18c0f1[_0x625c('0x24')],'ContactId':_0x18c0f1['id']}})[_0x625c('0x21')](function(_0x3f7971){if(!_[_0x625c('0x3e')](_0x3f7971)){var _0x456ac8=[];for(var _0x23653b=0x0;_0x23653b<_0x3f7971['length'];_0x23653b+=0x1){var _0x3bd8c3=_0x4d7ce3['CmHopper'][_0x625c('0x3f')]({'where':{'ListId':_0x3f7971[_0x23653b][_0x625c('0x24')],'ContactId':_0x3f7971[_0x23653b]['ContactId'],'VoiceQueueId':_0x3f7971[_0x23653b][_0x625c('0x40')],'CampaignId':_0x3f7971[_0x23653b][_0x625c('0x41')]}});_0x456ac8[_0x625c('0x42')](_0x3bd8c3);}return BPromise[_0x625c('0x43')](_0x456ac8);}})[_0x625c('0x21')](function(_0x4985f9){logger[_0x625c('0x44')](_0x625c('0x45'),util['inspect'](_0x4985f9,{'showHidden':![],'depth':null}));_0x31dd59();})[_0x625c('0x27')](function(_0x3f1f83){logger[_0x625c('0x13')](_0x625c('0x46'),util['inspect'](_0x3f1f83,{'showHidden':![],'depth':null}));_0x31dd59(_0x3f1f83);});}}});}; \ No newline at end of file +var _0xc0b4=['ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT','utf8mb4','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','add','YYYY-MM-DD\x20HH:mm:ss','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','timezones','utcOffset','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','ListId','outbound','dialCheckDuplicateType','CmList','always','findAll','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Lists','Campaign','List\x20not\x20found','isEmpty','destroy'];(function(_0x37e900,_0x42dcae){var _0x5dad9c=function(_0x409075){while(--_0x409075){_0x37e900['push'](_0x37e900['shift']());}};_0x5dad9c(++_0x42dcae);}(_0xc0b4,0x97));var _0x4c0b=function(_0x287957,_0x5909af){_0x287957=_0x287957-0x0;var _0x53b245=_0xc0b4[_0x287957];return _0x53b245;};'use strict';var _=require(_0x4c0b('0x0'));var util=require(_0x4c0b('0x1'));var logger=require(_0x4c0b('0x2'))(_0x4c0b('0x3'));var moment=require('moment');var BPromise=require(_0x4c0b('0x4'));var rp=require(_0x4c0b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4c0b('0x6'));var shared=require(_0x4c0b('0x7'));var attributes=require(_0x4c0b('0x8'));module['exports']=function(_0x1d13cc,_0x2efdea){return _0x1d13cc[_0x4c0b('0x9')](_0x4c0b('0xa'),attributes,{'tableName':_0x4c0b('0xb'),'paranoid':!![],'indexes':[{'name':_0x4c0b('0xc'),'fields':[_0x4c0b('0xc')]},{'name':_0x4c0b('0xd'),'fields':[_0x4c0b('0xe'),_0x4c0b('0xf'),_0x4c0b('0xc'),_0x4c0b('0x10'),'fax',_0x4c0b('0x11')],'type':_0x4c0b('0x12')}],'timestamps':!![],'charset':_0x4c0b('0x13'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x4af3da,_0x4b5fac,_0x237f0c){var _0x5b1cdf=_0x1d13cc[_0x4c0b('0x14')];var _0x34fec6=_0x4af3da[_0x4c0b('0x15')]({'plain':!![]});function _0x4926a5(){return function(_0x24fbfa){logger[_0x4c0b('0x16')](_0x4c0b('0x17'),_0x4c0b('0x18'),util[_0x4c0b('0x19')](_0x24fbfa,{'showHidden':![],'depth':null}));};}function _0x468600(_0x3d0685,_0x484040){var _0x221215=_0x484040['scheduledat']?_0x484040[_0x4c0b('0x1a')]:moment()[_0x4c0b('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x101393,_0x3688fe){if(_[_0x4c0b('0x1c')](_0x484040[_0x4c0b('0x1d')])){_0x101393({'ret':_0x221215});}else{_0x5b1cdf[_0x4c0b('0x1e')]['findOne']({'where':{'id':_0x3d0685['id']}})[_0x4c0b('0x1f')](function(_0x214061){if(!_['isNil'](_0x214061)){var _0x5dd292=_0x214061['dialTimezone'];if(!_[_0x4c0b('0x1c')](_0x5dd292)){var _0x18431e=shared['timezones'];var _0x501678=_0x18431e[_0x5dd292];var _0x1a12fb=_0x18431e[_0x484040[_0x4c0b('0x1d')]];if(!_[_0x4c0b('0x1c')](_0x501678)&&!_['isNil'](_0x1a12fb)){var _0x1c9f3a=_0x501678['utcOffset']-_0x1a12fb['utcOffset'];_0x221215=_0x484040['scheduledat']?_0x484040[_0x4c0b('0x1a')]:moment();var _0x382eec=moment(_0x221215)[_0x4c0b('0x20')](_0x1c9f3a,'minutes');_0x101393({'ret':_0x382eec[_0x4c0b('0x1b')](_0x4c0b('0x21'))});}else _0x101393({'ret':_0x221215});}else _0x101393({'ret':_0x221215});}else{_0x101393({'ret':_0x221215});}});}});return 0xa;}var _0x44a40b=function(_0x1b044a){return new BPromise(function(_0x3e044d,_0x5817d8){_0x468600(_0x1b044a,_0x34fec6)['then'](function(_0x12f2b0){_0x34fec6['scheduledat']=_0x12f2b0[_0x4c0b('0x22')];_0x5b1cdf['CmHopper'][_0x4c0b('0x23')]({'where':{'phone':_0x34fec6[_0x4c0b('0xc')],'VoiceQueueId':_0x1b044a['id']}})[_0x4c0b('0x1f')](function(_0x543b8d){if(!_[_0x4c0b('0x1c')](_0x543b8d)){throw new Error(_0x4c0b('0x24')+_0x34fec6[_0x4c0b('0xc')]+_0x4c0b('0x25')+_0x1b044a['id']);}return _0x5b1cdf[_0x4c0b('0x26')][_0x4c0b('0x27')]({'phone':_0x34fec6[_0x4c0b('0xc')],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6['ListId'],'priority':_0x34fec6[_0x4c0b('0x28')]?_0x34fec6[_0x4c0b('0x28')]:0x2,'scheduledat':_0x34fec6[_0x4c0b('0x1a')]?_0x34fec6[_0x4c0b('0x1a')]:moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')),'callback':_0x34fec6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x34fec6[_0x4c0b('0x29')]?_0x34fec6[_0x4c0b('0x29')]:undefined,'callbackat':_0x34fec6[_0x4c0b('0x29')]?moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')):undefined,'VoiceQueueId':_0x1b044a['id']});})[_0x4c0b('0x2a')](function(_0xd01ff3){_0x5817d8(_0xd01ff3);});});});};var _0x4a824f=function(_0x2c6a69){return new BPromise(function(_0x550e72,_0x49fb69){_0x468600(_0x2c6a69,_0x34fec6)[_0x4c0b('0x1f')](function(_0x10887f){_0x34fec6[_0x4c0b('0x1a')]=_0x10887f[_0x4c0b('0x22')];_0x5b1cdf[_0x4c0b('0x26')][_0x4c0b('0x23')]({'where':{'phone':_0x34fec6['phone'],'VoiceQueueId':_0x2c6a69['id']}})[_0x4c0b('0x1f')](function(_0x230d10){if(!_['isNil'](_0x230d10)){throw new Error(_0x4c0b('0x24')+_0x34fec6['phone']+_0x4c0b('0x2b')+_0x2c6a69['id']);}return _0x5b1cdf[_0x4c0b('0x2c')][_0x4c0b('0x23')]({'where':{'calleridnum':_0x34fec6['phone'],'VoiceQueueId':_0x2c6a69['id']}});})[_0x4c0b('0x1f')](function(_0x1e7fa7){if(!_['isNil'](_0x1e7fa7)){throw new Error(_0x4c0b('0x2d')+_0x34fec6[_0x4c0b('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x2c6a69['id']);}return _0x5b1cdf[_0x4c0b('0x26')][_0x4c0b('0x27')]({'phone':_0x34fec6[_0x4c0b('0xc')],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6['ListId'],'priority':_0x34fec6[_0x4c0b('0x28')]?_0x34fec6['priority']:0x2,'scheduledat':_0x34fec6[_0x4c0b('0x1a')]?_0x34fec6[_0x4c0b('0x1a')]:moment()['format'](_0x4c0b('0x21')),'callback':_0x34fec6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x34fec6[_0x4c0b('0x29')]?_0x34fec6[_0x4c0b('0x29')]:undefined,'callbackat':_0x34fec6[_0x4c0b('0x29')]?moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')):undefined,'VoiceQueueId':_0x2c6a69['id']});})[_0x4c0b('0x2a')](function(_0x477512){_0x49fb69(_0x477512);});});});};function _0x10654d(){return function(_0x3e0344){logger['error'](_0x4c0b('0x17'),_0x4c0b('0x18'),util[_0x4c0b('0x19')](_0x3e0344,{'showHidden':![],'depth':null}));};}function _0x55c135(_0x167b12,_0x253493){var _0x5e64d1=_0x253493[_0x4c0b('0x1a')]?_0x253493[_0x4c0b('0x1a')]:moment()[_0x4c0b('0x1b')](_0x4c0b('0x21'));return new BPromise(function(_0x3e6950,_0x3ccab7){if(_[_0x4c0b('0x1c')](_0x253493[_0x4c0b('0x1d')])){_0x3e6950({'ret':_0x5e64d1});}else{_0x5b1cdf['Campaign']['findOne']({'where':{'id':_0x167b12['id']}})[_0x4c0b('0x1f')](function(_0x52fe2d){if(!_['isNil'](_0x52fe2d)){var _0x18a76e=_0x52fe2d[_0x4c0b('0x1d')];if(!_[_0x4c0b('0x1c')](_0x18a76e)){var _0x502e26=shared[_0x4c0b('0x2e')];var _0x380550=_0x502e26[_0x18a76e];var _0x12f312=_0x502e26[_0x253493[_0x4c0b('0x1d')]];if(!_[_0x4c0b('0x1c')](_0x380550)&&!_[_0x4c0b('0x1c')](_0x12f312)){var _0x2c1ea6=_0x380550[_0x4c0b('0x2f')]-_0x12f312['utcOffset'];_0x5e64d1=_0x253493[_0x4c0b('0x1a')]?_0x253493['scheduledat']:moment();var _0x32165a=moment(_0x5e64d1)[_0x4c0b('0x20')](_0x2c1ea6,'minutes');_0x3e6950({'ret':_0x32165a[_0x4c0b('0x1b')](_0x4c0b('0x21'))});}else _0x3e6950({'ret':_0x5e64d1});}else _0x3e6950({'ret':_0x5e64d1});}else{_0x3e6950({'ret':_0x5e64d1});}});}});return 0xa;}var _0x5501e9=function(_0x30d6e5){return new BPromise(function(_0x581999,_0x59f539){_0x55c135(_0x30d6e5,_0x34fec6)[_0x4c0b('0x1f')](function(_0x3c7052){_0x34fec6[_0x4c0b('0x1a')]=_0x3c7052[_0x4c0b('0x22')];_0x5b1cdf[_0x4c0b('0x26')][_0x4c0b('0x23')]({'where':{'phone':_0x34fec6[_0x4c0b('0xc')],'CampaignId':_0x30d6e5['id']}})[_0x4c0b('0x1f')](function(_0xd78877){if(!_['isNil'](_0xd78877)){throw new Error(_0x4c0b('0x24')+_0x34fec6[_0x4c0b('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x30d6e5['id']);}return _0x5b1cdf[_0x4c0b('0x26')][_0x4c0b('0x27')]({'phone':_0x34fec6['phone'],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6['ListId'],'priority':_0x34fec6['priority']?_0x34fec6[_0x4c0b('0x28')]:0x2,'scheduledat':_0x34fec6[_0x4c0b('0x1a')]?_0x34fec6[_0x4c0b('0x1a')]:moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')),'callback':_0x34fec6[_0x4c0b('0x29')]?!![]:![],'callbackuniqueid':_0x34fec6['callbackUniqueid']?_0x34fec6['callbackUniqueid']:undefined,'callbackat':_0x34fec6[_0x4c0b('0x29')]?moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')):undefined,'CampaignId':_0x30d6e5['id']});})[_0x4c0b('0x2a')](function(_0x424798){_0x59f539(_0x424798);});});});};var _0x40035a=function(_0x32c945){return new BPromise(function(_0xa8909b,_0x506313){_0x55c135(_0x32c945,_0x34fec6)[_0x4c0b('0x1f')](function(_0x54716b){_0x34fec6['scheduledat']=_0x54716b['ret'];_0x5b1cdf[_0x4c0b('0x26')][_0x4c0b('0x23')]({'where':{'phone':_0x34fec6[_0x4c0b('0xc')],'CampaignId':_0x32c945['id']}})[_0x4c0b('0x1f')](function(_0x11a5dc){if(!_[_0x4c0b('0x1c')](_0x11a5dc)){throw new Error('cmContact,\x20afterCreate\x20'+_0x34fec6['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x32c945['id']);}return _0x5b1cdf[_0x4c0b('0x2c')]['findOne']({'where':{'calleridnum':_0x34fec6['phone'],'CampaignId':_0x32c945['id']}});})['then'](function(_0x3511eb){if(!_[_0x4c0b('0x1c')](_0x3511eb)){throw new Error(_0x4c0b('0x2d')+_0x34fec6['phone']+_0x4c0b('0x30')+_0x32c945['id']);}return _0x5b1cdf['CmHopper'][_0x4c0b('0x27')]({'phone':_0x34fec6[_0x4c0b('0xc')],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6[_0x4c0b('0x31')],'priority':_0x34fec6[_0x4c0b('0x28')]?_0x34fec6['priority']:0x2,'scheduledat':_0x34fec6[_0x4c0b('0x1a')]?_0x34fec6['scheduledat']:moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')),'callback':_0x34fec6[_0x4c0b('0x29')]?!![]:![],'callbackuniqueid':_0x34fec6['callbackUniqueid']?_0x34fec6[_0x4c0b('0x29')]:undefined,'callbackat':_0x34fec6['callbackUniqueid']?moment()[_0x4c0b('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x32c945['id']});})[_0x4c0b('0x2a')](function(_0x1962b7){_0x506313(_0x1962b7);});});});};if(_0x34fec6[_0x4c0b('0x31')]){_0x5b1cdf['VoiceQueue']['findAll']({'where':{'type':_0x4c0b('0x32')},'attributes':['id',_0x4c0b('0x33'),'dialTimezone'],'include':[{'model':_0x5b1cdf[_0x4c0b('0x34')],'as':'Lists','where':{'id':_0x34fec6[_0x4c0b('0x31')]}}]})[_0x4c0b('0x1f')](function(_0x55c2b1){if(_0x55c2b1){var _0xae2938=[];for(var _0x99b039=0x0,_0x367a8e;_0x99b039<_0x55c2b1['length'];_0x99b039+=0x1){_0x367a8e=_0x55c2b1[_0x99b039][_0x4c0b('0x15')]({'plain':!![]});switch(_0x367a8e[_0x4c0b('0x33')]){case _0x4c0b('0x35'):_0x4a824f(_0x367a8e)[_0x4c0b('0x2a')](_0x4926a5());break;case'onlyIfOpen':_0x44a40b(_0x367a8e)[_0x4c0b('0x2a')](_0x4926a5());break;default:_0x55c135(_0x367a8e,_0x34fec6)['then'](function(_0x289f48){_0x34fec6['scheduledat']=_0x289f48[_0x4c0b('0x22')];_0x5b1cdf[_0x4c0b('0x26')][_0x4c0b('0x27')]({'phone':_0x34fec6[_0x4c0b('0xc')],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6[_0x4c0b('0x31')],'scheduledat':_0x34fec6['scheduledat']?_0x34fec6[_0x4c0b('0x1a')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x34fec6[_0x4c0b('0x28')]?_0x34fec6[_0x4c0b('0x28')]:0x2,'callback':_0x34fec6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x34fec6[_0x4c0b('0x29')]?_0x34fec6[_0x4c0b('0x29')]:undefined,'callbackat':_0x34fec6['callbackUniqueid']?moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')):undefined,'VoiceQueueId':_0x367a8e['id']})[_0x4c0b('0x2a')](_0x4926a5());});}}}})[_0x4c0b('0x1f')](function(){return _0x5b1cdf[_0x4c0b('0x1e')][_0x4c0b('0x36')]({'where':{'type':_0x4c0b('0x32')},'attributes':['id'],'include':[{'model':_0x5b1cdf[_0x4c0b('0x34')],'as':_0x4c0b('0x37'),'where':{'id':_0x34fec6[_0x4c0b('0x31')]}}]})[_0x4c0b('0x1f')](function(_0x1a020a){if(_0x1a020a){var _0x4b6903=[];for(var _0xb10f7c=0x0,_0x23c591;_0xb10f7c<_0x1a020a[_0x4c0b('0x38')];_0xb10f7c+=0x1){_0x23c591=_0x1a020a[_0xb10f7c]['get']({'plain':!![]});_0x5b1cdf[_0x4c0b('0x39')][_0x4c0b('0x27')]({'phone':_0x34fec6['phone'],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6['ListId'],'VoiceQueueId':_0x23c591['id']})['catch'](function(_0x3a0e8e){logger[_0x4c0b('0x16')](_0x4c0b('0x3a'),_0x4c0b('0x18'),_0x3a0e8e[_0x4c0b('0x3b')]);});}}});})['then'](function(){return _0x5b1cdf['Campaign'][_0x4c0b('0x36')]({'attributes':['id',_0x4c0b('0x33'),_0x4c0b('0x1d')],'include':[{'model':_0x5b1cdf[_0x4c0b('0x34')],'as':_0x4c0b('0x3c'),'where':{'id':_0x34fec6[_0x4c0b('0x31')]}}]})[_0x4c0b('0x1f')](function(_0x2eaa63){if(_0x2eaa63){var _0x520634=[];for(var _0x3ba7a2=0x0,_0x4c1451;_0x3ba7a2<_0x2eaa63['length'];_0x3ba7a2+=0x1){_0x4c1451=_0x2eaa63[_0x3ba7a2]['get']({'plain':!![]});switch(_0x4c1451[_0x4c0b('0x33')]){case _0x4c0b('0x35'):_0x40035a(_0x4c1451)[_0x4c0b('0x2a')](_0x10654d());break;case'onlyIfOpen':_0x5501e9(_0x4c1451)['catch'](_0x10654d());break;default:_0x5b1cdf[_0x4c0b('0x26')]['create']({'phone':_0x34fec6[_0x4c0b('0xc')],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6[_0x4c0b('0x31')],'scheduledat':_0x34fec6[_0x4c0b('0x1a')]?_0x34fec6[_0x4c0b('0x1a')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x34fec6['priority']?_0x34fec6[_0x4c0b('0x28')]:0x2,'callback':_0x34fec6[_0x4c0b('0x29')]?!![]:![],'callbackuniqueid':_0x34fec6[_0x4c0b('0x29')]?_0x34fec6[_0x4c0b('0x29')]:undefined,'callbackat':_0x34fec6[_0x4c0b('0x29')]?moment()[_0x4c0b('0x1b')](_0x4c0b('0x21')):undefined,'CampaignId':_0x4c1451['id']})[_0x4c0b('0x2a')](_0x10654d());}}}});})[_0x4c0b('0x1f')](function(){return _0x5b1cdf[_0x4c0b('0x3d')][_0x4c0b('0x36')]({'attributes':['id'],'include':[{'model':_0x5b1cdf[_0x4c0b('0x34')],'as':_0x4c0b('0x37'),'where':{'id':_0x34fec6[_0x4c0b('0x31')]}}]})['then'](function(_0x57b36d){if(_0x57b36d){var _0x362fca=[];for(var _0x2d7600=0x0,_0x59ebd2;_0x2d7600<_0x57b36d['length'];_0x2d7600+=0x1){_0x59ebd2=_0x57b36d[_0x2d7600][_0x4c0b('0x15')]({'plain':!![]});_0x5b1cdf[_0x4c0b('0x39')]['create']({'phone':_0x34fec6[_0x4c0b('0xc')],'ContactId':_0x34fec6['id'],'ListId':_0x34fec6['ListId'],'CampaignId':_0x59ebd2['id']})[_0x4c0b('0x2a')](function(_0x1d754a){logger[_0x4c0b('0x16')](_0x4c0b('0x3a'),_0x4c0b('0x18'),_0x1d754a['message']);});}}});})[_0x4c0b('0x1f')](function(){_0x237f0c();})['catch'](function(_0x551920){logger[_0x4c0b('0x16')](_0x4c0b('0x3a'),_0x4c0b('0x18'),_0x551920[_0x4c0b('0x3b')]);_0x237f0c(_0x551920);});}else{_0x237f0c(new Error(_0x4c0b('0x3e')));}},'afterDestroy':function(_0xe188b8,_0x2f4dff,_0x125ea6){var _0x13f298=_0x1d13cc[_0x4c0b('0x14')];var _0x482772=_0xe188b8[_0x4c0b('0x15')]({'plain':!![]});return _0x13f298['CmHopper'][_0x4c0b('0x36')]({'raw':!![],'where':{'ListId':_0x482772[_0x4c0b('0x31')],'ContactId':_0x482772['id']}})[_0x4c0b('0x1f')](function(_0x4dfd15){if(!_[_0x4c0b('0x3f')](_0x4dfd15)){var _0x43081c=[];for(var _0x23b049=0x0;_0x23b049<_0x4dfd15[_0x4c0b('0x38')];_0x23b049+=0x1){var _0x472a89=_0x13f298[_0x4c0b('0x26')][_0x4c0b('0x40')]({'where':{'ListId':_0x4dfd15[_0x23b049][_0x4c0b('0x31')],'ContactId':_0x4dfd15[_0x23b049][_0x4c0b('0x41')],'VoiceQueueId':_0x4dfd15[_0x23b049][_0x4c0b('0x42')],'CampaignId':_0x4dfd15[_0x23b049]['CampaignId']}});_0x43081c[_0x4c0b('0x43')](_0x472a89);}return BPromise[_0x4c0b('0x44')](_0x43081c);}})[_0x4c0b('0x1f')](function(_0x4d9238){logger[_0x4c0b('0x45')](_0x4c0b('0x46'),util[_0x4c0b('0x19')](_0x4d9238,{'showHidden':![],'depth':null}));_0x125ea6();})[_0x4c0b('0x2a')](function(_0x7b5ac1){logger[_0x4c0b('0x16')](_0x4c0b('0x47'),util[_0x4c0b('0x19')](_0x7b5ac1,{'showHidden':![],'depth':null}));_0x125ea6(_0x7b5ac1);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 964055f..abae406 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x44f26b,_0x2cd614){var _0x412fef=function(_0x3c3297){while(--_0x3c3297){_0x44f26b['push'](_0x44f26b['shift']());}};_0x412fef(++_0x2cd614);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x2e2f77,_0x19065c){var _0x430e82=function(_0x36deae){while(--_0x36deae){_0x2e2f77['push'](_0x2e2f77['shift']());}};_0x430e82(++_0x19065c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 c372371..b5c1799 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 _0x861c=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x861c,0xdb));var _0xc861=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x861c[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xc861('0x0'));module[_0xc861('0x1')]={'CmContactId':{'type':Sequelize[_0xc861('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc861('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc861('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc861('0x3')],'defaultValue':_0xc861('0x4')},'OrderBy':{'type':Sequelize[_0xc861('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xc861('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xeebe=['INTEGER','STRING','PHONE','sequelize'];(function(_0x4b1a0e,_0x527dcc){var _0x2a0862=function(_0x3782a1){while(--_0x3782a1){_0x4b1a0e['push'](_0x4b1a0e['shift']());}};_0x2a0862(++_0x527dcc);}(_0xeebe,0xff));var _0xeeeb=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xeebe[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xeeeb('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xeeeb('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xeeeb('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xeeeb('0x2')],'defaultValue':_0xeeeb('0x3')},'OrderBy':{'type':Sequelize[_0xeeeb('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xeeeb('0x2')],'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 2f08e60..a0c14e4 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 _0x3741=['fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','UserProfileResource','end','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','findAll','rows','show','params','includeAll','include','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x48f76a,_0x261992){var _0x3ad48c=function(_0x5790e3){while(--_0x5790e3){_0x48f76a['push'](_0x48f76a['shift']());}};_0x3ad48c(++_0x261992);}(_0x3741,0x1b2));var _0x1374=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x3741[_0x1bb58c];return _0x277586;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1374('0x0'));var zipdir=require(_0x1374('0x1'));var jsonpatch=require(_0x1374('0x2'));var rp=require(_0x1374('0x3'));var moment=require(_0x1374('0x4'));var BPromise=require(_0x1374('0x5'));var Mustache=require(_0x1374('0x6'));var util=require(_0x1374('0x7'));var path=require('path');var sox=require(_0x1374('0x8'));var csv=require(_0x1374('0x9'));var ejs=require(_0x1374('0xa'));var fs=require('fs');var fs_extra=require(_0x1374('0xb'));var _=require(_0x1374('0xc'));var squel=require('squel');var crypto=require(_0x1374('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1374('0xe'));var toCsv=require(_0x1374('0x9'));var querystring=require(_0x1374('0xf'));var Papa=require(_0x1374('0x10'));var Redis=require(_0x1374('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1374('0x12'));var as=require(_0x1374('0x13'));var hardwareService=require(_0x1374('0x14'));var logger=require(_0x1374('0x15'))(_0x1374('0x16'));var utils=require(_0x1374('0x17'));var config=require(_0x1374('0x18'));var licenseUtil=require(_0x1374('0x19'));var db=require(_0x1374('0x1a'))['db'];function respondWithStatusCode(_0x2522f9,_0x555a49){_0x555a49=_0x555a49||0xcc;return function(_0x2fb117){if(_0x2fb117){return _0x2522f9[_0x1374('0x1b')](_0x555a49);}return _0x2522f9[_0x1374('0x1c')](_0x555a49)['end']();};}function respondWithResult(_0x579938,_0x1bce6e){_0x1bce6e=_0x1bce6e||0xc8;return function(_0x345067){if(_0x345067){return _0x579938[_0x1374('0x1c')](_0x1bce6e)[_0x1374('0x1d')](_0x345067);}};}function respondWithFilteredResult(_0x253dd5,_0x13f7e0){return function(_0x2c6167){if(_0x2c6167){var _0x5c49b5=typeof _0x13f7e0[_0x1374('0x1e')]===_0x1374('0x1f')&&typeof _0x13f7e0[_0x1374('0x20')]===_0x1374('0x1f');var _0x1973c3=_0x2c6167[_0x1374('0x21')];var _0x4218df=_0x5c49b5?0x0:_0x13f7e0['offset'];var _0x3b8a38=_0x5c49b5?_0x2c6167[_0x1374('0x21')]:_0x13f7e0['offset']+_0x13f7e0[_0x1374('0x20')];var _0x3afff3;if(_0x3b8a38>=_0x1973c3){_0x3b8a38=_0x1973c3;_0x3afff3=0xc8;}else{_0x3afff3=0xce;}_0x253dd5[_0x1374('0x1c')](_0x3afff3);return _0x253dd5[_0x1374('0x22')](_0x1374('0x23'),_0x4218df+'-'+_0x3b8a38+'/'+_0x1973c3)[_0x1374('0x1d')](_0x2c6167);}return null;};}function patchUpdates(_0x33b17d){return function(_0x422878){try{jsonpatch[_0x1374('0x24')](_0x422878,_0x33b17d,!![]);}catch(_0x1616a6){return BPromise['reject'](_0x1616a6);}return _0x422878[_0x1374('0x25')]();};}function saveUpdates(_0x58bfd2,_0x3fad86){return function(_0x298e01){if(_0x298e01){return _0x298e01[_0x1374('0x26')](_0x58bfd2)['then'](function(_0x2e70b5){return _0x2e70b5;});}return null;};}function removeEntity(_0xf9c34f,_0x213d7c){return function(_0x596580){if(_0x596580){return _0x596580[_0x1374('0x27')]()[_0x1374('0x28')](function(){var _0x53caea=_0x596580['get']({'plain':!![]});var _0x38d873='CmContactHasItems';return db[_0x1374('0x29')]['destroy']({'where':{'type':_0x38d873,'resourceId':_0x53caea['id']}})[_0x1374('0x28')](function(){return _0x596580;});})['then'](function(){_0xf9c34f['status'](0xcc)[_0x1374('0x2a')]();});}};}function handleEntityNotFound(_0xc838dd,_0x2906b6){return function(_0x544ed1){if(!_0x544ed1){_0xc838dd[_0x1374('0x1b')](0x194);}return _0x544ed1;};}function handleError(_0x157afb,_0x2176fc){_0x2176fc=_0x2176fc||0x1f4;return function(_0x257b90){logger[_0x1374('0x2b')](_0x257b90[_0x1374('0x2c')]);if(_0x257b90['name']){delete _0x257b90[_0x1374('0x2d')];}_0x157afb['status'](_0x2176fc)[_0x1374('0x2e')](_0x257b90);};}exports[_0x1374('0x2f')]=function(_0x22e90f,_0x1ca46d){var _0x122dbe={},_0x370e10={},_0x3b97ed={'count':0x0,'rows':[]};var _0x2272a2=_[_0x1374('0x30')](db[_0x1374('0x31')][_0x1374('0x32')],function(_0x22233a){return{'name':_0x22233a[_0x1374('0x33')],'type':_0x22233a[_0x1374('0x34')][_0x1374('0x35')]};});_0x370e10[_0x1374('0x36')]=_[_0x1374('0x30')](_0x2272a2,'name');_0x370e10['query']=_[_0x1374('0x37')](_0x22e90f[_0x1374('0x38')]);_0x370e10['filters']=_[_0x1374('0x39')](_0x370e10[_0x1374('0x36')],_0x370e10['query']);_0x122dbe[_0x1374('0x3a')]=_[_0x1374('0x39')](_0x370e10[_0x1374('0x36')],qs['fields'](_0x22e90f[_0x1374('0x38')][_0x1374('0x3b')]));_0x122dbe[_0x1374('0x3a')]=_0x122dbe['attributes'][_0x1374('0x3c')]?_0x122dbe['attributes']:_0x370e10[_0x1374('0x36')];if(!_0x22e90f['query'][_0x1374('0x3d')]('nolimit')){_0x122dbe[_0x1374('0x20')]=qs[_0x1374('0x20')](_0x22e90f[_0x1374('0x38')][_0x1374('0x20')]);_0x122dbe[_0x1374('0x1e')]=qs[_0x1374('0x1e')](_0x22e90f[_0x1374('0x38')][_0x1374('0x1e')]);}_0x122dbe[_0x1374('0x3e')]=qs[_0x1374('0x3f')](_0x22e90f[_0x1374('0x38')][_0x1374('0x3f')]);_0x122dbe[_0x1374('0x40')]=qs[_0x1374('0x41')](_[_0x1374('0x42')](_0x22e90f[_0x1374('0x38')],_0x370e10['filters']),_0x2272a2);if(_0x22e90f[_0x1374('0x38')][_0x1374('0x43')]){_0x122dbe[_0x1374('0x40')]=_['merge'](_0x122dbe[_0x1374('0x40')],{'$or':_[_0x1374('0x30')](_0x2272a2,function(_0x280cf4){if(_0x280cf4[_0x1374('0x34')]!==_0x1374('0x44')){var _0x1905e1={};_0x1905e1[_0x280cf4['name']]={'$like':'%'+_0x22e90f['query'][_0x1374('0x43')]+'%'};return _0x1905e1;}})});}_0x122dbe=_['merge']({},_0x122dbe,_0x22e90f[_0x1374('0x45')]);var _0x4c402f={'where':_0x122dbe[_0x1374('0x40')]};return db[_0x1374('0x31')][_0x1374('0x21')](_0x4c402f)['then'](function(_0x138ad4){_0x3b97ed[_0x1374('0x21')]=_0x138ad4;if(_0x22e90f[_0x1374('0x38')]['includeAll']){_0x122dbe['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x1374('0x46')](_0x122dbe);})[_0x1374('0x28')](function(_0x3f6931){_0x3b97ed[_0x1374('0x47')]=_0x3f6931;return _0x3b97ed;})[_0x1374('0x28')](respondWithFilteredResult(_0x1ca46d,_0x122dbe))['catch'](handleError(_0x1ca46d,null));};exports[_0x1374('0x48')]=function(_0x1a77c5,_0x3da77c){var _0xf67de5={'raw':!![],'where':{'id':_0x1a77c5[_0x1374('0x49')]['id']}},_0x19fc2b={};_0x19fc2b[_0x1374('0x36')]=_[_0x1374('0x37')](db[_0x1374('0x31')][_0x1374('0x32')]);_0x19fc2b[_0x1374('0x38')]=_[_0x1374('0x37')](_0x1a77c5['query']);_0x19fc2b['filters']=_[_0x1374('0x39')](_0x19fc2b[_0x1374('0x36')],_0x19fc2b[_0x1374('0x38')]);_0xf67de5[_0x1374('0x3a')]=_[_0x1374('0x39')](_0x19fc2b[_0x1374('0x36')],qs[_0x1374('0x3b')](_0x1a77c5[_0x1374('0x38')][_0x1374('0x3b')]));_0xf67de5[_0x1374('0x3a')]=_0xf67de5['attributes'][_0x1374('0x3c')]?_0xf67de5[_0x1374('0x3a')]:_0x19fc2b['model'];if(_0x1a77c5[_0x1374('0x38')][_0x1374('0x4a')]){_0xf67de5[_0x1374('0x4b')]=[{'all':!![]}];}_0xf67de5=_[_0x1374('0x4c')]({},_0xf67de5,_0x1a77c5['options']);return db[_0x1374('0x31')][_0x1374('0x4d')](_0xf67de5)[_0x1374('0x28')](handleEntityNotFound(_0x3da77c,null))[_0x1374('0x28')](respondWithResult(_0x3da77c,null))[_0x1374('0x4e')](handleError(_0x3da77c,null));};exports[_0x1374('0x4f')]=function(_0x1a3af2,_0xb71361){return db[_0x1374('0x31')]['create'](_0x1a3af2[_0x1374('0x50')],{})[_0x1374('0x28')](function(_0x245d3d){var _0x3202de=_0x1a3af2[_0x1374('0x51')][_0x1374('0x52')]({'plain':!![]});if(!_0x3202de)throw new Error(_0x1374('0x53'));if(_0x3202de[_0x1374('0x54')]==='user'){var _0x4ba7ea=_0x245d3d[_0x1374('0x52')]({'plain':!![]});var _0x18f79f=_0x1374('0x55');return db[_0x1374('0x56')][_0x1374('0x4d')]({'where':{'name':_0x18f79f,'userProfileId':_0x3202de[_0x1374('0x57')]},'raw':!![]})[_0x1374('0x28')](function(_0x1349b1){if(_0x1349b1&&_0x1349b1['autoAssociation']===0x0){return db[_0x1374('0x29')]['create']({'name':_0x4ba7ea['name'],'resourceId':_0x4ba7ea['id'],'type':_0x1349b1['name'],'sectionId':_0x1349b1['id']},{})[_0x1374('0x28')](function(){return _0x245d3d;});}else{return _0x245d3d;}})[_0x1374('0x4e')](function(_0x1f4172){logger[_0x1374('0x2b')](_0x1374('0x58'),_0x1f4172);throw _0x1f4172;});}return _0x245d3d;})[_0x1374('0x28')](respondWithResult(_0xb71361,0xc9))['catch'](handleError(_0xb71361,null));};exports['update']=function(_0x27e714,_0x3346f2){if(_0x27e714[_0x1374('0x50')]['id']){delete _0x27e714[_0x1374('0x50')]['id'];}return db[_0x1374('0x31')]['find']({'where':{'id':_0x27e714[_0x1374('0x49')]['id']}})[_0x1374('0x28')](handleEntityNotFound(_0x3346f2,null))[_0x1374('0x28')](saveUpdates(_0x27e714[_0x1374('0x50')],null))[_0x1374('0x28')](respondWithResult(_0x3346f2,null))[_0x1374('0x4e')](handleError(_0x3346f2,null));};exports['destroy']=function(_0x5d27c7,_0x6e9a4a){return db['CmContactHasItem'][_0x1374('0x4d')]({'where':{'id':_0x5d27c7[_0x1374('0x49')]['id']}})[_0x1374('0x28')](handleEntityNotFound(_0x6e9a4a,null))[_0x1374('0x28')](removeEntity(_0x6e9a4a,null))[_0x1374('0x4e')](handleError(_0x6e9a4a,null));}; \ No newline at end of file +var _0x033b=['name','send','index','map','CmContactHasItem','fieldName','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','model','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','CmContactHasItems','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack'];(function(_0x2c74ad,_0x24fc99){var _0xdf6f4e=function(_0x55fab4){while(--_0x55fab4){_0x2c74ad['push'](_0x2c74ad['shift']());}};_0xdf6f4e(++_0x24fc99);}(_0x033b,0x15e));var _0xb033=function(_0x27514f,_0xbf28e1){_0x27514f=_0x27514f-0x0;var _0x4d7dd2=_0x033b[_0x27514f];return _0x4d7dd2;};'use strict';var emlformat=require(_0xb033('0x0'));var rimraf=require(_0xb033('0x1'));var zipdir=require(_0xb033('0x2'));var jsonpatch=require(_0xb033('0x3'));var rp=require(_0xb033('0x4'));var moment=require('moment');var BPromise=require(_0xb033('0x5'));var Mustache=require(_0xb033('0x6'));var util=require(_0xb033('0x7'));var path=require('path');var sox=require(_0xb033('0x8'));var csv=require(_0xb033('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb033('0xa'));var _=require(_0xb033('0xb'));var squel=require('squel');var crypto=require(_0xb033('0xc'));var jsforce=require(_0xb033('0xd'));var deskjs=require(_0xb033('0xe'));var toCsv=require(_0xb033('0x9'));var querystring=require(_0xb033('0xf'));var Papa=require(_0xb033('0x10'));var Redis=require(_0xb033('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb033('0x12'));var as=require(_0xb033('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb033('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb033('0x15'));var db=require(_0xb033('0x16'))['db'];function respondWithStatusCode(_0x2b2e66,_0x26ed1b){_0x26ed1b=_0x26ed1b||0xcc;return function(_0x2bf421){if(_0x2bf421){return _0x2b2e66['sendStatus'](_0x26ed1b);}return _0x2b2e66['status'](_0x26ed1b)[_0xb033('0x17')]();};}function respondWithResult(_0x3c08ab,_0x3a00c0){_0x3a00c0=_0x3a00c0||0xc8;return function(_0x50bfc6){if(_0x50bfc6){return _0x3c08ab[_0xb033('0x18')](_0x3a00c0)[_0xb033('0x19')](_0x50bfc6);}};}function respondWithFilteredResult(_0x198d56,_0x111782){return function(_0x239344){if(_0x239344){var _0x314508=typeof _0x111782['offset']===_0xb033('0x1a')&&typeof _0x111782[_0xb033('0x1b')]===_0xb033('0x1a');var _0x329ca3=_0x239344['count'];var _0x3dbc2b=_0x314508?0x0:_0x111782[_0xb033('0x1c')];var _0x5b57d2=_0x314508?_0x239344[_0xb033('0x1d')]:_0x111782[_0xb033('0x1c')]+_0x111782[_0xb033('0x1b')];var _0x37f540;if(_0x5b57d2>=_0x329ca3){_0x5b57d2=_0x329ca3;_0x37f540=0xc8;}else{_0x37f540=0xce;}_0x198d56[_0xb033('0x18')](_0x37f540);return _0x198d56['set'](_0xb033('0x1e'),_0x3dbc2b+'-'+_0x5b57d2+'/'+_0x329ca3)[_0xb033('0x19')](_0x239344);}return null;};}function patchUpdates(_0x56c51d){return function(_0x213811){try{jsonpatch[_0xb033('0x1f')](_0x213811,_0x56c51d,!![]);}catch(_0x1de151){return BPromise[_0xb033('0x20')](_0x1de151);}return _0x213811[_0xb033('0x21')]();};}function saveUpdates(_0x107c33,_0x38e942){return function(_0x202ad0){if(_0x202ad0){return _0x202ad0[_0xb033('0x22')](_0x107c33)[_0xb033('0x23')](function(_0x59342e){return _0x59342e;});}return null;};}function removeEntity(_0x1b169e,_0x307ed4){return function(_0x305d00){if(_0x305d00){return _0x305d00[_0xb033('0x24')]()[_0xb033('0x23')](function(){var _0x565a18=_0x305d00['get']({'plain':!![]});var _0x34c7ce='CmContactHasItems';return db[_0xb033('0x25')][_0xb033('0x24')]({'where':{'type':_0x34c7ce,'resourceId':_0x565a18['id']}})[_0xb033('0x23')](function(){return _0x305d00;});})['then'](function(){_0x1b169e[_0xb033('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9124a0,_0x43ddab){return function(_0x2ade30){if(!_0x2ade30){_0x9124a0[_0xb033('0x26')](0x194);}return _0x2ade30;};}function handleError(_0x4bb0e8,_0x453e10){_0x453e10=_0x453e10||0x1f4;return function(_0x4b073b){logger['error'](_0x4b073b[_0xb033('0x27')]);if(_0x4b073b[_0xb033('0x28')]){delete _0x4b073b[_0xb033('0x28')];}_0x4bb0e8[_0xb033('0x18')](_0x453e10)[_0xb033('0x29')](_0x4b073b);};}exports[_0xb033('0x2a')]=function(_0x5497f9,_0x38a0dc){var _0x37b65f={},_0x2e141e={},_0x2a51ac={'count':0x0,'rows':[]};var _0x4ca83a=_[_0xb033('0x2b')](db[_0xb033('0x2c')]['rawAttributes'],function(_0x106c05){return{'name':_0x106c05[_0xb033('0x2d')],'type':_0x106c05['type']['key']};});_0x2e141e['model']=_[_0xb033('0x2b')](_0x4ca83a,_0xb033('0x28'));_0x2e141e[_0xb033('0x2e')]=_[_0xb033('0x2f')](_0x5497f9[_0xb033('0x2e')]);_0x2e141e[_0xb033('0x30')]=_['intersection'](_0x2e141e['model'],_0x2e141e[_0xb033('0x2e')]);_0x37b65f[_0xb033('0x31')]=_[_0xb033('0x32')](_0x2e141e['model'],qs['fields'](_0x5497f9['query'][_0xb033('0x33')]));_0x37b65f[_0xb033('0x31')]=_0x37b65f[_0xb033('0x31')][_0xb033('0x34')]?_0x37b65f[_0xb033('0x31')]:_0x2e141e['model'];if(!_0x5497f9[_0xb033('0x2e')][_0xb033('0x35')]('nolimit')){_0x37b65f[_0xb033('0x1b')]=qs[_0xb033('0x1b')](_0x5497f9[_0xb033('0x2e')]['limit']);_0x37b65f['offset']=qs[_0xb033('0x1c')](_0x5497f9[_0xb033('0x2e')][_0xb033('0x1c')]);}_0x37b65f['order']=qs[_0xb033('0x36')](_0x5497f9['query']['sort']);_0x37b65f[_0xb033('0x37')]=qs[_0xb033('0x30')](_[_0xb033('0x38')](_0x5497f9[_0xb033('0x2e')],_0x2e141e[_0xb033('0x30')]),_0x4ca83a);if(_0x5497f9[_0xb033('0x2e')][_0xb033('0x39')]){_0x37b65f[_0xb033('0x37')]=_[_0xb033('0x3a')](_0x37b65f[_0xb033('0x37')],{'$or':_[_0xb033('0x2b')](_0x4ca83a,function(_0x471625){if(_0x471625[_0xb033('0x3b')]!=='VIRTUAL'){var _0x2c341f={};_0x2c341f[_0x471625[_0xb033('0x28')]]={'$like':'%'+_0x5497f9[_0xb033('0x2e')][_0xb033('0x39')]+'%'};return _0x2c341f;}})});}_0x37b65f=_[_0xb033('0x3a')]({},_0x37b65f,_0x5497f9[_0xb033('0x3c')]);var _0xc1a2f={'where':_0x37b65f[_0xb033('0x37')]};return db['CmContactHasItem'][_0xb033('0x1d')](_0xc1a2f)['then'](function(_0x110c5a){_0x2a51ac['count']=_0x110c5a;if(_0x5497f9[_0xb033('0x2e')][_0xb033('0x3d')]){_0x37b65f[_0xb033('0x3e')]=[{'all':!![]}];}return db[_0xb033('0x2c')]['findAll'](_0x37b65f);})[_0xb033('0x23')](function(_0x4517dc){_0x2a51ac['rows']=_0x4517dc;return _0x2a51ac;})['then'](respondWithFilteredResult(_0x38a0dc,_0x37b65f))[_0xb033('0x3f')](handleError(_0x38a0dc,null));};exports[_0xb033('0x40')]=function(_0x763325,_0x4ed4af){var _0x5952e8={'raw':!![],'where':{'id':_0x763325[_0xb033('0x41')]['id']}},_0x4a953f={};_0x4a953f[_0xb033('0x42')]=_[_0xb033('0x2f')](db[_0xb033('0x2c')]['rawAttributes']);_0x4a953f['query']=_['keys'](_0x763325[_0xb033('0x2e')]);_0x4a953f[_0xb033('0x30')]=_[_0xb033('0x32')](_0x4a953f[_0xb033('0x42')],_0x4a953f[_0xb033('0x2e')]);_0x5952e8[_0xb033('0x31')]=_[_0xb033('0x32')](_0x4a953f['model'],qs['fields'](_0x763325[_0xb033('0x2e')]['fields']));_0x5952e8[_0xb033('0x31')]=_0x5952e8['attributes'][_0xb033('0x34')]?_0x5952e8[_0xb033('0x31')]:_0x4a953f['model'];if(_0x763325[_0xb033('0x2e')][_0xb033('0x3d')]){_0x5952e8[_0xb033('0x3e')]=[{'all':!![]}];}_0x5952e8=_[_0xb033('0x3a')]({},_0x5952e8,_0x763325[_0xb033('0x3c')]);return db[_0xb033('0x2c')][_0xb033('0x43')](_0x5952e8)[_0xb033('0x23')](handleEntityNotFound(_0x4ed4af,null))['then'](respondWithResult(_0x4ed4af,null))[_0xb033('0x3f')](handleError(_0x4ed4af,null));};exports[_0xb033('0x44')]=function(_0x2aa8b7,_0x155c59){return db[_0xb033('0x2c')][_0xb033('0x44')](_0x2aa8b7[_0xb033('0x45')],{})[_0xb033('0x23')](function(_0x2cb15a){var _0x287462=_0x2aa8b7[_0xb033('0x46')]['get']({'plain':!![]});if(!_0x287462)throw new Error(_0xb033('0x47'));if(_0x287462['role']===_0xb033('0x46')){var _0x54e769=_0x2cb15a[_0xb033('0x48')]({'plain':!![]});var _0x3eece1=_0xb033('0x49');return db[_0xb033('0x4a')][_0xb033('0x43')]({'where':{'name':_0x3eece1,'userProfileId':_0x287462['userProfileId']},'raw':!![]})[_0xb033('0x23')](function(_0xbbc0d3){if(_0xbbc0d3&&_0xbbc0d3[_0xb033('0x4b')]===0x0){return db[_0xb033('0x25')][_0xb033('0x44')]({'name':_0x54e769[_0xb033('0x28')],'resourceId':_0x54e769['id'],'type':_0xbbc0d3[_0xb033('0x28')],'sectionId':_0xbbc0d3['id']},{})[_0xb033('0x23')](function(){return _0x2cb15a;});}else{return _0x2cb15a;}})[_0xb033('0x3f')](function(_0x320679){logger[_0xb033('0x4c')](_0xb033('0x4d'),_0x320679);throw _0x320679;});}return _0x2cb15a;})[_0xb033('0x23')](respondWithResult(_0x155c59,0xc9))[_0xb033('0x3f')](handleError(_0x155c59,null));};exports[_0xb033('0x22')]=function(_0x2e600a,_0x48dd6e){if(_0x2e600a[_0xb033('0x45')]['id']){delete _0x2e600a[_0xb033('0x45')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x2e600a['params']['id']}})[_0xb033('0x23')](handleEntityNotFound(_0x48dd6e,null))[_0xb033('0x23')](saveUpdates(_0x2e600a['body'],null))[_0xb033('0x23')](respondWithResult(_0x48dd6e,null))[_0xb033('0x3f')](handleError(_0x48dd6e,null));};exports[_0xb033('0x24')]=function(_0x2f5e2f,_0xbdaf74){return db['CmContactHasItem'][_0xb033('0x43')]({'where':{'id':_0x2f5e2f['params']['id']}})[_0xb033('0x23')](handleEntityNotFound(_0xbdaf74,null))[_0xb033('0x23')](removeEntity(_0xbdaf74,null))['catch'](handleError(_0xbdaf74,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 39f85ea..7b86b87 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 _0x5b21=['rimraf','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','request-promise'];(function(_0x562cdc,_0x45b977){var _0x3d44df=function(_0x440505){while(--_0x440505){_0x562cdc['push'](_0x562cdc['shift']());}};_0x3d44df(++_0x45b977);}(_0x5b21,0x7f));var _0x15b2=function(_0x245bde,_0x266e9b){_0x245bde=_0x245bde-0x0;var _0x1e7a61=_0x5b21[_0x245bde];return _0x1e7a61;};'use strict';var _=require(_0x15b2('0x0'));var util=require(_0x15b2('0x1'));var logger=require(_0x15b2('0x2'))(_0x15b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15b2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15b2('0x5'));var config=require(_0x15b2('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x15b2('0x7')]=function(_0x334337,_0x144230){return _0x334337[_0x15b2('0x8')](_0x15b2('0x9'),attributes,{'tableName':_0x15b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbd2=['bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','../../config/logger','api','moment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbbd2,0x100));var _0x2bbd=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xbbd2[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x2bbd('0x0'));var util=require('util');var logger=require(_0x2bbd('0x1'))(_0x2bbd('0x2'));var moment=require(_0x2bbd('0x3'));var BPromise=require(_0x2bbd('0x4'));var rp=require(_0x2bbd('0x5'));var fs=require('fs');var path=require(_0x2bbd('0x6'));var rimraf=require(_0x2bbd('0x7'));var config=require(_0x2bbd('0x8'));var attributes=require(_0x2bbd('0x9'));module[_0x2bbd('0xa')]=function(_0x46c406,_0x23567a){return _0x46c406[_0x2bbd('0xb')]('CmContactHasItem',attributes,{'tableName':_0x2bbd('0xc'),'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 99a67ed..0e298f7 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 _0xef5d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','CmContactHasItem,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch'];(function(_0x5c7f5e,_0x362da0){var _0x150446=function(_0x165196){while(--_0x165196){_0x5c7f5e['push'](_0x5c7f5e['shift']());}};_0x150446(++_0x362da0);}(_0xef5d,0xdc));var _0xdef5=function(_0x3cb616,_0x166419){_0x3cb616=_0x3cb616-0x0;var _0x37f4cc=_0xef5d[_0x3cb616];return _0x37f4cc;};'use strict';var _=require(_0xdef5('0x0'));var util=require(_0xdef5('0x1'));var moment=require(_0xdef5('0x2'));var BPromise=require(_0xdef5('0x3'));var rs=require(_0xdef5('0x4'));var fs=require('fs');var Redis=require(_0xdef5('0x5'));var db=require(_0xdef5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdef5('0x7'))('rpc');var config=require(_0xdef5('0x8'));var jayson=require(_0xdef5('0x9'));var client=jayson[_0xdef5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5162c2,_0x41d4de,_0x17b287){return new BPromise(function(_0x4ff4d2,_0x17e5e7){return client['request'](_0x5162c2,_0x17b287)[_0xdef5('0xb')](function(_0x112762){logger['info'](_0xdef5('0xc'),_0x41d4de,'request\x20sent');logger[_0xdef5('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x41d4de,'request\x20sent',JSON[_0xdef5('0xe')](_0x112762));if(_0x112762[_0xdef5('0xf')]){if(_0x112762[_0xdef5('0xf')][_0xdef5('0x10')]===0x1f4){logger[_0xdef5('0xf')](_0xdef5('0xc'),_0x41d4de,_0x112762['error'][_0xdef5('0x11')]);return _0x17e5e7(_0x112762[_0xdef5('0xf')][_0xdef5('0x11')]);}logger[_0xdef5('0xf')](_0xdef5('0xc'),_0x41d4de,_0x112762['error']['message']);return _0x4ff4d2(_0x112762['error']['message']);}else{logger[_0xdef5('0x12')](_0xdef5('0xc'),_0x41d4de,_0xdef5('0x13'));_0x4ff4d2(_0x112762[_0xdef5('0x14')][_0xdef5('0x11')]);}})[_0xdef5('0x15')](function(_0x152952){logger[_0xdef5('0xf')](_0xdef5('0xc'),_0x41d4de,_0x152952);_0x17e5e7(_0x152952);});});} \ No newline at end of file +var _0x12bd=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','CmContactHasItem,\x20%s,\x20%s'];(function(_0x20b2ea,_0x244217){var _0xf18cee=function(_0x28cd36){while(--_0x28cd36){_0x20b2ea['push'](_0x20b2ea['shift']());}};_0xf18cee(++_0x244217);}(_0x12bd,0x1a7));var _0xd12b=function(_0x1ce71c,_0x1f2369){_0x1ce71c=_0x1ce71c-0x0;var _0x38c215=_0x12bd[_0x1ce71c];return _0x38c215;};'use strict';var _=require(_0xd12b('0x0'));var util=require(_0xd12b('0x1'));var moment=require(_0xd12b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd12b('0x3'));var fs=require('fs');var Redis=require(_0xd12b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd12b('0x5'))(_0xd12b('0x6'));var config=require(_0xd12b('0x7'));var jayson=require(_0xd12b('0x8'));var client=jayson['client'][_0xd12b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35ecc0,_0x290824,_0x6c06a){return new BPromise(function(_0xe38cd5,_0x58ad28){return client['request'](_0x35ecc0,_0x6c06a)[_0xd12b('0xa')](function(_0xea2021){logger[_0xd12b('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x290824,_0xd12b('0xc'));logger[_0xd12b('0xd')](_0xd12b('0xe'),_0x290824,_0xd12b('0xc'),JSON['stringify'](_0xea2021));if(_0xea2021[_0xd12b('0xf')]){if(_0xea2021[_0xd12b('0xf')][_0xd12b('0x10')]===0x1f4){logger[_0xd12b('0xf')](_0xd12b('0x11'),_0x290824,_0xea2021[_0xd12b('0xf')][_0xd12b('0x12')]);return _0x58ad28(_0xea2021[_0xd12b('0xf')][_0xd12b('0x12')]);}logger[_0xd12b('0xf')](_0xd12b('0x11'),_0x290824,_0xea2021[_0xd12b('0xf')][_0xd12b('0x12')]);return _0xe38cd5(_0xea2021[_0xd12b('0xf')][_0xd12b('0x12')]);}else{logger['info'](_0xd12b('0x11'),_0x290824,_0xd12b('0xc'));_0xe38cd5(_0xea2021[_0xd12b('0x13')][_0xd12b('0x12')]);}})[_0xd12b('0x14')](function(_0x5ae411){logger[_0xd12b('0xf')](_0xd12b('0x11'),_0x290824,_0x5ae411);_0x58ad28(_0x5ae411);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index dca718c..38302a5 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 _0xb870=['delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','post','create','update'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xb870,0xac));var _0x0b87=function(_0x4abc8f,_0xef597d){_0x4abc8f=_0x4abc8f-0x0;var _0x5d7939=_0xb870[_0x4abc8f];return _0x5d7939;};'use strict';var multer=require(_0x0b87('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0b87('0x1'));var express=require(_0x0b87('0x2'));var router=express[_0x0b87('0x3')]();var fs_extra=require(_0x0b87('0x4'));var auth=require(_0x0b87('0x5'));var interaction=require(_0x0b87('0x6'));var config=require('../../config/environment');var controller=require(_0x0b87('0x7'));router[_0x0b87('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b87('0x9')]);router[_0x0b87('0x8')](_0x0b87('0xa'),auth[_0x0b87('0xb')](),controller['show']);router[_0x0b87('0xc')]('/',auth['isAuthenticated'](),controller[_0x0b87('0xd')]);router['put'](_0x0b87('0xa'),auth['isAuthenticated'](),controller[_0x0b87('0xe')]);router[_0x0b87('0xf')]('/:id',auth[_0x0b87('0xb')](),controller[_0x0b87('0x10')]);module['exports']=router; \ No newline at end of file +var _0x10b8=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','update','delete','/:id'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x10b8,0x17c));var _0x810b=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x10b8[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0x810b('0x0'));var util=require(_0x810b('0x1'));var path=require(_0x810b('0x2'));var timeout=require(_0x810b('0x3'));var express=require(_0x810b('0x4'));var router=express[_0x810b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x810b('0x6'));var interaction=require(_0x810b('0x7'));var config=require(_0x810b('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x810b('0x9')]('/',auth[_0x810b('0xa')](),controller['index']);router[_0x810b('0x9')]('/:id',auth[_0x810b('0xa')](),controller['show']);router[_0x810b('0xb')]('/',auth[_0x810b('0xa')](),controller[_0x810b('0xc')]);router['put']('/:id',auth[_0x810b('0xa')](),controller[_0x810b('0xd')]);router[_0x810b('0xe')](_0x810b('0xf'),auth[_0x810b('0xa')](),controller[_0x810b('0x10')]);module[_0x810b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 381833f..c7b30cc 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 _0x336c=['name','TEXT','getDataValue','type','select','parse','values','isArray','setDataValue','BOOLEAN','voice','sequelize','exports','VIRTUAL','alias','STRING'];(function(_0xc69530,_0x57c174){var _0x148a92=function(_0x409d97){while(--_0x409d97){_0xc69530['push'](_0xc69530['shift']());}};_0x148a92(++_0x57c174);}(_0x336c,0x1bb));var _0xc336=function(_0x48132a,_0x41ebbf){_0x48132a=_0x48132a-0x0;var _0x1fd9c7=_0x336c[_0x48132a];return _0x1fd9c7;};'use strict';var Sequelize=require(_0xc336('0x0'));var _=require('lodash');module[_0xc336('0x1')]={'name':{'type':Sequelize[_0xc336('0x2')],'get':function(_0x929b54){return this['getDataValue'](_0xc336('0x3'));}},'alias':{'type':Sequelize[_0xc336('0x4')],'allowNull':![],'set':function(_0x276ed2){this['setDataValue'](_0xc336('0x3'),_0x276ed2?_0x276ed2:this['getDataValue'](_0xc336('0x5')));}},'type':{'type':Sequelize[_0xc336('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xc336('0x6')]('long'),'get':function(){if(this[_0xc336('0x7')](_0xc336('0x8'))===_0xc336('0x9')){return JSON[_0xc336('0xa')](this['getDataValue'](_0xc336('0xb')));}else{return this[_0xc336('0x7')](_0xc336('0xb'));}},'set':function(_0x41fb88){if(Array[_0xc336('0xc')](_0x41fb88)){this[_0xc336('0xd')](_0xc336('0xb'),JSON['stringify'](_0x41fb88));}else{this[_0xc336('0xd')](_0xc336('0xb'),_0x41fb88);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc336('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xc336('0xf'))}}; \ No newline at end of file +var _0x55d2=['setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','TEXT','long','type','parse','values','isArray'];(function(_0x5a3caf,_0x4af120){var _0x21a5ee=function(_0x15f9f4){while(--_0x15f9f4){_0x5a3caf['push'](_0x5a3caf['shift']());}};_0x21a5ee(++_0x4af120);}(_0x55d2,0x18c));var _0x255d=function(_0x281b4c,_0x2c8ae0){_0x281b4c=_0x281b4c-0x0;var _0x2f32d1=_0x55d2[_0x281b4c];return _0x2f32d1;};'use strict';var Sequelize=require(_0x255d('0x0'));var _=require(_0x255d('0x1'));module[_0x255d('0x2')]={'name':{'type':Sequelize[_0x255d('0x3')],'get':function(_0x54fcb5){return this[_0x255d('0x4')](_0x255d('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x18919c){this['setDataValue'](_0x255d('0x5'),_0x18919c?_0x18919c:this[_0x255d('0x4')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x255d('0x6')](_0x255d('0x7')),'get':function(){if(this['getDataValue'](_0x255d('0x8'))==='select'){return JSON[_0x255d('0x9')](this[_0x255d('0x4')](_0x255d('0xa')));}else{return this[_0x255d('0x4')](_0x255d('0xa'));}},'set':function(_0x3f8502){if(Array[_0x255d('0xb')](_0x3f8502)){this[_0x255d('0xc')](_0x255d('0xa'),JSON[_0x255d('0xd')](_0x3f8502));}else{this[_0x255d('0xc')]('values',_0x3f8502);}}},'required':{'type':Sequelize[_0x255d('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x255d('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x255d('0xf')](_0x255d('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 3473216..0d3bb44 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 _0xd9d7=['offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','sendStatus','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','update','params','create','sequelize','transaction','body','TEXT','type','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd9d7,0xf2));var _0x7d9d=function(_0x76b00b,_0x26e939){_0x76b00b=_0x76b00b-0x0;var _0xc8e4a=_0xd9d7[_0x76b00b];return _0xc8e4a;};'use strict';var emlformat=require(_0x7d9d('0x0'));var rimraf=require(_0x7d9d('0x1'));var zipdir=require(_0x7d9d('0x2'));var jsonpatch=require(_0x7d9d('0x3'));var rp=require(_0x7d9d('0x4'));var moment=require(_0x7d9d('0x5'));var BPromise=require(_0x7d9d('0x6'));var Mustache=require(_0x7d9d('0x7'));var util=require(_0x7d9d('0x8'));var path=require(_0x7d9d('0x9'));var sox=require('sox');var csv=require(_0x7d9d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d9d('0xb'));var _=require('lodash');var squel=require(_0x7d9d('0xc'));var crypto=require(_0x7d9d('0xd'));var jsforce=require(_0x7d9d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d9d('0xa'));var querystring=require(_0x7d9d('0xf'));var Papa=require(_0x7d9d('0x10'));var Redis=require(_0x7d9d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d9d('0x12'));var hardwareService=require(_0x7d9d('0x13'));var logger=require(_0x7d9d('0x14'))(_0x7d9d('0x15'));var utils=require(_0x7d9d('0x16'));var config=require(_0x7d9d('0x17'));var licenseUtil=require(_0x7d9d('0x18'));var db=require(_0x7d9d('0x19'))['db'];function respondWithStatusCode(_0x26c052,_0x21ab30){_0x21ab30=_0x21ab30||0xcc;return function(_0x280595){if(_0x280595){return _0x26c052['sendStatus'](_0x21ab30);}return _0x26c052[_0x7d9d('0x1a')](_0x21ab30)['end']();};}function respondWithResult(_0x3cb2c4,_0x2dc960){_0x2dc960=_0x2dc960||0xc8;return function(_0x283643){if(_0x283643){return _0x3cb2c4[_0x7d9d('0x1a')](_0x2dc960)[_0x7d9d('0x1b')](_0x283643);}};}function respondWithFilteredResult(_0x20d1d7,_0x1ecb48){return function(_0x3a7e69){if(_0x3a7e69){var _0x267483=typeof _0x1ecb48[_0x7d9d('0x1c')]===_0x7d9d('0x1d')&&typeof _0x1ecb48[_0x7d9d('0x1e')]==='undefined';var _0x5c0120=_0x3a7e69[_0x7d9d('0x1f')];var _0x38f4e5=_0x267483?0x0:_0x1ecb48[_0x7d9d('0x1c')];var _0x2e227d=_0x267483?_0x3a7e69['count']:_0x1ecb48[_0x7d9d('0x1c')]+_0x1ecb48[_0x7d9d('0x1e')];var _0x394dae;if(_0x2e227d>=_0x5c0120){_0x2e227d=_0x5c0120;_0x394dae=0xc8;}else{_0x394dae=0xce;}_0x20d1d7['status'](_0x394dae);return _0x20d1d7[_0x7d9d('0x20')](_0x7d9d('0x21'),_0x38f4e5+'-'+_0x2e227d+'/'+_0x5c0120)[_0x7d9d('0x1b')](_0x3a7e69);}return null;};}function patchUpdates(_0x10c243){return function(_0x2c0065){try{jsonpatch[_0x7d9d('0x22')](_0x2c0065,_0x10c243,!![]);}catch(_0x2bc9e9){return BPromise[_0x7d9d('0x23')](_0x2bc9e9);}return _0x2c0065['save']();};}function saveUpdates(_0x5c811e,_0x275afa){return function(_0x4c6247){if(_0x4c6247){return _0x4c6247['update'](_0x5c811e)[_0x7d9d('0x24')](function(_0x2197e7){return _0x2197e7;});}return null;};}function removeEntity(_0x5a8db8,_0x12fe6a){return function(_0x6f464f){if(_0x6f464f){return _0x6f464f[_0x7d9d('0x25')]()[_0x7d9d('0x24')](function(){_0x5a8db8[_0x7d9d('0x1a')](0xcc)[_0x7d9d('0x26')]();});}};}function handleEntityNotFound(_0x1e61e0,_0x7c39f1){return function(_0x46324a){if(!_0x46324a){_0x1e61e0[_0x7d9d('0x27')](0x194);}return _0x46324a;};}function handleError(_0x9de690,_0x37dd8a){_0x37dd8a=_0x37dd8a||0x1f4;return function(_0x509130){logger[_0x7d9d('0x28')](_0x509130['stack']);if(_0x509130[_0x7d9d('0x29')]){delete _0x509130['name'];}_0x9de690[_0x7d9d('0x1a')](_0x37dd8a)[_0x7d9d('0x2a')](_0x509130);};}exports[_0x7d9d('0x2b')]=function(_0x11f940,_0xa7cdda){var _0x2ca21a={},_0x39eab3={},_0x3937e3={'count':0x0,'rows':[]};var _0x405705=_[_0x7d9d('0x2c')](db[_0x7d9d('0x2d')][_0x7d9d('0x2e')],function(_0x11fe4f){return{'name':_0x11fe4f[_0x7d9d('0x2f')],'type':_0x11fe4f['type'][_0x7d9d('0x30')]};});_0x39eab3[_0x7d9d('0x31')]=_[_0x7d9d('0x32')](_[_0x7d9d('0x2c')](_0x405705,_0x7d9d('0x29')),['name']);_0x39eab3['query']=_['keys'](_0x11f940[_0x7d9d('0x33')]);_0x39eab3[_0x7d9d('0x34')]=_[_0x7d9d('0x35')](_0x39eab3[_0x7d9d('0x31')],_0x39eab3[_0x7d9d('0x33')]);_0x2ca21a['attributes']=_[_0x7d9d('0x35')](_0x39eab3['model'],qs[_0x7d9d('0x36')](_0x11f940[_0x7d9d('0x33')]['fields']));_0x2ca21a[_0x7d9d('0x37')]=_0x2ca21a[_0x7d9d('0x37')]['length']?_0x2ca21a[_0x7d9d('0x37')]:_0x39eab3[_0x7d9d('0x31')];if(!_0x11f940[_0x7d9d('0x33')][_0x7d9d('0x38')](_0x7d9d('0x39'))){_0x2ca21a[_0x7d9d('0x1e')]=qs['limit'](_0x11f940[_0x7d9d('0x33')][_0x7d9d('0x1e')]);_0x2ca21a[_0x7d9d('0x1c')]=qs[_0x7d9d('0x1c')](_0x11f940[_0x7d9d('0x33')][_0x7d9d('0x1c')]);}_0x2ca21a[_0x7d9d('0x3a')]=qs[_0x7d9d('0x3b')](_0x11f940[_0x7d9d('0x33')][_0x7d9d('0x3b')]);_0x2ca21a[_0x7d9d('0x3c')]=qs[_0x7d9d('0x34')](_['pick'](_0x11f940[_0x7d9d('0x33')],_0x39eab3[_0x7d9d('0x34')]),_0x405705);if(_0x11f940[_0x7d9d('0x33')]['filter']){_0x2ca21a[_0x7d9d('0x3c')]=_[_0x7d9d('0x3d')](_0x2ca21a[_0x7d9d('0x3c')],{'$or':_[_0x7d9d('0x2c')](_0x405705,function(_0xf7b2da){if(_0xf7b2da['type']!==_0x7d9d('0x3e')){var _0x1ba27a={};_0x1ba27a[_0xf7b2da[_0x7d9d('0x29')]]={'$like':'%'+_0x11f940[_0x7d9d('0x33')]['filter']+'%'};return _0x1ba27a;}})});}_0x2ca21a=_[_0x7d9d('0x3d')]({},_0x2ca21a,_0x11f940[_0x7d9d('0x3f')]);var _0x1c9efe={'where':_0x2ca21a[_0x7d9d('0x3c')]};return db['CmCustomField'][_0x7d9d('0x1f')](_0x1c9efe)[_0x7d9d('0x24')](function(_0x39e9d2){_0x3937e3[_0x7d9d('0x1f')]=_0x39e9d2;if(_0x11f940[_0x7d9d('0x33')][_0x7d9d('0x40')]){_0x2ca21a[_0x7d9d('0x41')]=[{'all':!![]}];}return db['CmCustomField'][_0x7d9d('0x42')](_0x2ca21a);})[_0x7d9d('0x24')](function(_0x4641ab){_0x3937e3[_0x7d9d('0x43')]=_0x4641ab;return _0x3937e3;})[_0x7d9d('0x24')](respondWithFilteredResult(_0xa7cdda,_0x2ca21a))[_0x7d9d('0x44')](handleError(_0xa7cdda,null));};exports[_0x7d9d('0x45')]=function(_0x1a5653,_0x56f74f){var _0x52428e={'raw':!![],'where':{'id':_0x1a5653['params']['id']}},_0x673de5={};_0x673de5[_0x7d9d('0x31')]=_['keys'](db['CmCustomField'][_0x7d9d('0x2e')]);_0x673de5[_0x7d9d('0x33')]=_['keys'](_0x1a5653[_0x7d9d('0x33')]);_0x673de5[_0x7d9d('0x34')]=_[_0x7d9d('0x35')](_0x673de5[_0x7d9d('0x31')],_0x673de5[_0x7d9d('0x33')]);_0x52428e['attributes']=_[_0x7d9d('0x35')](_0x673de5[_0x7d9d('0x31')],qs['fields'](_0x1a5653[_0x7d9d('0x33')][_0x7d9d('0x36')]));_0x52428e[_0x7d9d('0x37')]=_0x52428e[_0x7d9d('0x37')][_0x7d9d('0x46')]?_0x52428e[_0x7d9d('0x37')]:_0x673de5[_0x7d9d('0x31')];if(_0x1a5653[_0x7d9d('0x33')][_0x7d9d('0x40')]){_0x52428e[_0x7d9d('0x41')]=[{'all':!![]}];}_0x52428e=_[_0x7d9d('0x3d')]({},_0x52428e,_0x1a5653[_0x7d9d('0x3f')]);return db[_0x7d9d('0x2d')][_0x7d9d('0x47')](_0x52428e)['then'](handleEntityNotFound(_0x56f74f,null))['then'](respondWithResult(_0x56f74f,null))['catch'](handleError(_0x56f74f,null));};exports[_0x7d9d('0x48')]=function(_0x3dd77f,_0xfdcda2){if(_0x3dd77f['body']['id']){delete _0x3dd77f['body']['id'];}return db[_0x7d9d('0x2d')][_0x7d9d('0x47')]({'where':{'id':_0x3dd77f['params']['id']}})['then'](handleEntityNotFound(_0xfdcda2,null))[_0x7d9d('0x24')](saveUpdates(_0x3dd77f['body'],null))[_0x7d9d('0x24')](respondWithResult(_0xfdcda2,null))[_0x7d9d('0x44')](handleError(_0xfdcda2,null));};exports[_0x7d9d('0x25')]=function(_0x15ae06,_0x319fdc){return db['CmCustomField'][_0x7d9d('0x47')]({'where':{'id':_0x15ae06[_0x7d9d('0x49')]['id']}})[_0x7d9d('0x24')](handleEntityNotFound(_0x319fdc,null))[_0x7d9d('0x24')](removeEntity(_0x319fdc,null))[_0x7d9d('0x44')](handleError(_0x319fdc,null));};exports[_0x7d9d('0x4a')]=function(_0x569d10,_0x53e6f5){var _0x2b1185;return db[_0x7d9d('0x4b')][_0x7d9d('0x4c')](function(_0x33a591){return db[_0x7d9d('0x2d')][_0x7d9d('0x4a')](_0x569d10[_0x7d9d('0x4d')],{'transaction':_0x33a591})[_0x7d9d('0x24')](function(_0x1be5e1){_0x2b1185=_0x1be5e1;var _0x2d5903={'type':db['Sequelize'][_0x7d9d('0x4e')],'transaction':_0x33a591};switch(_0x569d10['body'][_0x7d9d('0x4f')]){case'text':_0x2d5903[_0x7d9d('0x4f')]=db[_0x7d9d('0x50')][_0x7d9d('0x4e')];break;case _0x7d9d('0x51'):_0x2d5903['type']=db[_0x7d9d('0x50')][_0x7d9d('0x52')];break;case'switch':_0x2d5903[_0x7d9d('0x4f')]=db[_0x7d9d('0x50')][_0x7d9d('0x53')];_0x2d5903[_0x7d9d('0x54')]=![];break;default:}return db[_0x7d9d('0x4b')][_0x7d9d('0x55')][_0x7d9d('0x56')](_0x7d9d('0x57'),util[_0x7d9d('0x58')](_0x7d9d('0x59'),_0x2b1185['id']),_0x2d5903);})[_0x7d9d('0x24')](function(){return _0x2b1185;});})[_0x7d9d('0x24')](respondWithResult(_0x53e6f5,0xc9))[_0x7d9d('0x44')](handleError(_0x53e6f5,null));}; \ No newline at end of file +var _0xb804=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','keys','filters','intersection','fields','query','attributes','length','model','order','sort','where','pick','filter','merge','VIRTUAL','include','catch','includeAll','find','update','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format'];(function(_0x9187d6,_0x2a3703){var _0x356827=function(_0x4d538b){while(--_0x4d538b){_0x9187d6['push'](_0x9187d6['shift']());}};_0x356827(++_0x2a3703);}(_0xb804,0x107));var _0x4b80=function(_0x4817db,_0x3b0045){_0x4817db=_0x4817db-0x0;var _0x292bf9=_0xb804[_0x4817db];return _0x292bf9;};'use strict';var emlformat=require(_0x4b80('0x0'));var rimraf=require(_0x4b80('0x1'));var zipdir=require(_0x4b80('0x2'));var jsonpatch=require(_0x4b80('0x3'));var rp=require(_0x4b80('0x4'));var moment=require(_0x4b80('0x5'));var BPromise=require(_0x4b80('0x6'));var Mustache=require(_0x4b80('0x7'));var util=require(_0x4b80('0x8'));var path=require(_0x4b80('0x9'));var sox=require(_0x4b80('0xa'));var csv=require(_0x4b80('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b80('0xc'));var _=require(_0x4b80('0xd'));var squel=require(_0x4b80('0xe'));var crypto=require('crypto');var jsforce=require(_0x4b80('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4b80('0xb'));var querystring=require(_0x4b80('0x10'));var Papa=require(_0x4b80('0x11'));var Redis=require(_0x4b80('0x12'));var authService=require(_0x4b80('0x13'));var qs=require(_0x4b80('0x14'));var as=require(_0x4b80('0x15'));var hardwareService=require(_0x4b80('0x16'));var logger=require('../../config/logger')(_0x4b80('0x17'));var utils=require(_0x4b80('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1866b2,_0x593cf5){_0x593cf5=_0x593cf5||0xcc;return function(_0x252617){if(_0x252617){return _0x1866b2[_0x4b80('0x19')](_0x593cf5);}return _0x1866b2[_0x4b80('0x1a')](_0x593cf5)[_0x4b80('0x1b')]();};}function respondWithResult(_0x290e8a,_0x4bec66){_0x4bec66=_0x4bec66||0xc8;return function(_0x442283){if(_0x442283){return _0x290e8a['status'](_0x4bec66)[_0x4b80('0x1c')](_0x442283);}};}function respondWithFilteredResult(_0x3fdd7d,_0x23f356){return function(_0x59d818){if(_0x59d818){var _0x33c64b=typeof _0x23f356[_0x4b80('0x1d')]===_0x4b80('0x1e')&&typeof _0x23f356[_0x4b80('0x1f')]==='undefined';var _0xba80c5=_0x59d818[_0x4b80('0x20')];var _0x39c6fb=_0x33c64b?0x0:_0x23f356[_0x4b80('0x1d')];var _0x46e38b=_0x33c64b?_0x59d818[_0x4b80('0x20')]:_0x23f356['offset']+_0x23f356[_0x4b80('0x1f')];var _0x189c02;if(_0x46e38b>=_0xba80c5){_0x46e38b=_0xba80c5;_0x189c02=0xc8;}else{_0x189c02=0xce;}_0x3fdd7d[_0x4b80('0x1a')](_0x189c02);return _0x3fdd7d[_0x4b80('0x21')](_0x4b80('0x22'),_0x39c6fb+'-'+_0x46e38b+'/'+_0xba80c5)['json'](_0x59d818);}return null;};}function patchUpdates(_0xae413b){return function(_0x50f740){try{jsonpatch[_0x4b80('0x23')](_0x50f740,_0xae413b,!![]);}catch(_0x5588b3){return BPromise[_0x4b80('0x24')](_0x5588b3);}return _0x50f740[_0x4b80('0x25')]();};}function saveUpdates(_0x447dbb,_0x1ea0bf){return function(_0x4f767b){if(_0x4f767b){return _0x4f767b['update'](_0x447dbb)[_0x4b80('0x26')](function(_0x3dc925){return _0x3dc925;});}return null;};}function removeEntity(_0x4c98d8,_0x3505e9){return function(_0xfca601){if(_0xfca601){return _0xfca601[_0x4b80('0x27')]()[_0x4b80('0x26')](function(){_0x4c98d8[_0x4b80('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f0e1,_0x6d05c6){return function(_0x305f69){if(!_0x305f69){_0x17f0e1[_0x4b80('0x19')](0x194);}return _0x305f69;};}function handleError(_0x369743,_0x4eb530){_0x4eb530=_0x4eb530||0x1f4;return function(_0x4870e7){logger[_0x4b80('0x28')](_0x4870e7[_0x4b80('0x29')]);if(_0x4870e7[_0x4b80('0x2a')]){delete _0x4870e7[_0x4b80('0x2a')];}_0x369743[_0x4b80('0x1a')](_0x4eb530)[_0x4b80('0x2b')](_0x4870e7);};}exports[_0x4b80('0x2c')]=function(_0x225e46,_0x39701e){var _0x2820cc={},_0x2c0818={},_0x4080f5={'count':0x0,'rows':[]};var _0x5e794e=_[_0x4b80('0x2d')](db[_0x4b80('0x2e')][_0x4b80('0x2f')],function(_0x2a0665){return{'name':_0x2a0665[_0x4b80('0x30')],'type':_0x2a0665[_0x4b80('0x31')][_0x4b80('0x32')]};});_0x2c0818['model']=_[_0x4b80('0x33')](_[_0x4b80('0x2d')](_0x5e794e,_0x4b80('0x2a')),['name']);_0x2c0818['query']=_[_0x4b80('0x34')](_0x225e46['query']);_0x2c0818[_0x4b80('0x35')]=_[_0x4b80('0x36')](_0x2c0818['model'],_0x2c0818['query']);_0x2820cc['attributes']=_[_0x4b80('0x36')](_0x2c0818['model'],qs[_0x4b80('0x37')](_0x225e46[_0x4b80('0x38')][_0x4b80('0x37')]));_0x2820cc['attributes']=_0x2820cc[_0x4b80('0x39')][_0x4b80('0x3a')]?_0x2820cc[_0x4b80('0x39')]:_0x2c0818[_0x4b80('0x3b')];if(!_0x225e46[_0x4b80('0x38')]['hasOwnProperty']('nolimit')){_0x2820cc[_0x4b80('0x1f')]=qs[_0x4b80('0x1f')](_0x225e46[_0x4b80('0x38')]['limit']);_0x2820cc[_0x4b80('0x1d')]=qs[_0x4b80('0x1d')](_0x225e46[_0x4b80('0x38')][_0x4b80('0x1d')]);}_0x2820cc[_0x4b80('0x3c')]=qs[_0x4b80('0x3d')](_0x225e46['query'][_0x4b80('0x3d')]);_0x2820cc[_0x4b80('0x3e')]=qs[_0x4b80('0x35')](_[_0x4b80('0x3f')](_0x225e46['query'],_0x2c0818[_0x4b80('0x35')]),_0x5e794e);if(_0x225e46[_0x4b80('0x38')][_0x4b80('0x40')]){_0x2820cc[_0x4b80('0x3e')]=_[_0x4b80('0x41')](_0x2820cc['where'],{'$or':_['map'](_0x5e794e,function(_0x512358){if(_0x512358[_0x4b80('0x31')]!==_0x4b80('0x42')){var _0x38400b={};_0x38400b[_0x512358[_0x4b80('0x2a')]]={'$like':'%'+_0x225e46[_0x4b80('0x38')][_0x4b80('0x40')]+'%'};return _0x38400b;}})});}_0x2820cc=_[_0x4b80('0x41')]({},_0x2820cc,_0x225e46['options']);var _0x4ac947={'where':_0x2820cc[_0x4b80('0x3e')]};return db['CmCustomField']['count'](_0x4ac947)[_0x4b80('0x26')](function(_0x441ec5){_0x4080f5[_0x4b80('0x20')]=_0x441ec5;if(_0x225e46[_0x4b80('0x38')]['includeAll']){_0x2820cc[_0x4b80('0x43')]=[{'all':!![]}];}return db[_0x4b80('0x2e')]['findAll'](_0x2820cc);})[_0x4b80('0x26')](function(_0x193e04){_0x4080f5['rows']=_0x193e04;return _0x4080f5;})['then'](respondWithFilteredResult(_0x39701e,_0x2820cc))[_0x4b80('0x44')](handleError(_0x39701e,null));};exports['show']=function(_0x5038da,_0x165617){var _0x241ded={'raw':!![],'where':{'id':_0x5038da['params']['id']}},_0x14155d={};_0x14155d[_0x4b80('0x3b')]=_[_0x4b80('0x34')](db[_0x4b80('0x2e')]['rawAttributes']);_0x14155d[_0x4b80('0x38')]=_[_0x4b80('0x34')](_0x5038da[_0x4b80('0x38')]);_0x14155d[_0x4b80('0x35')]=_['intersection'](_0x14155d[_0x4b80('0x3b')],_0x14155d['query']);_0x241ded['attributes']=_[_0x4b80('0x36')](_0x14155d['model'],qs[_0x4b80('0x37')](_0x5038da[_0x4b80('0x38')][_0x4b80('0x37')]));_0x241ded['attributes']=_0x241ded[_0x4b80('0x39')][_0x4b80('0x3a')]?_0x241ded['attributes']:_0x14155d[_0x4b80('0x3b')];if(_0x5038da['query'][_0x4b80('0x45')]){_0x241ded['include']=[{'all':!![]}];}_0x241ded=_[_0x4b80('0x41')]({},_0x241ded,_0x5038da['options']);return db[_0x4b80('0x2e')][_0x4b80('0x46')](_0x241ded)[_0x4b80('0x26')](handleEntityNotFound(_0x165617,null))['then'](respondWithResult(_0x165617,null))['catch'](handleError(_0x165617,null));};exports[_0x4b80('0x47')]=function(_0xe76f06,_0xe05b1a){if(_0xe76f06[_0x4b80('0x48')]['id']){delete _0xe76f06[_0x4b80('0x48')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0xe76f06[_0x4b80('0x49')]['id']}})[_0x4b80('0x26')](handleEntityNotFound(_0xe05b1a,null))['then'](saveUpdates(_0xe76f06['body'],null))[_0x4b80('0x26')](respondWithResult(_0xe05b1a,null))[_0x4b80('0x44')](handleError(_0xe05b1a,null));};exports['destroy']=function(_0x265df2,_0x2e2373){return db['CmCustomField'][_0x4b80('0x46')]({'where':{'id':_0x265df2[_0x4b80('0x49')]['id']}})[_0x4b80('0x26')](handleEntityNotFound(_0x2e2373,null))[_0x4b80('0x26')](removeEntity(_0x2e2373,null))[_0x4b80('0x44')](handleError(_0x2e2373,null));};exports[_0x4b80('0x4a')]=function(_0x3b28a4,_0x51837c){var _0x435f81;return db[_0x4b80('0x4b')][_0x4b80('0x4c')](function(_0x349f81){return db['CmCustomField'][_0x4b80('0x4a')](_0x3b28a4[_0x4b80('0x48')],{'transaction':_0x349f81})[_0x4b80('0x26')](function(_0x5f9606){_0x435f81=_0x5f9606;var _0x1a5178={'type':db[_0x4b80('0x4d')][_0x4b80('0x4e')],'transaction':_0x349f81};switch(_0x3b28a4[_0x4b80('0x48')]['type']){case _0x4b80('0x4f'):_0x1a5178[_0x4b80('0x31')]=db['Sequelize'][_0x4b80('0x4e')];break;case _0x4b80('0x50'):_0x1a5178[_0x4b80('0x31')]=db[_0x4b80('0x4d')]['INTEGER'];break;case _0x4b80('0x51'):_0x1a5178[_0x4b80('0x31')]=db[_0x4b80('0x4d')][_0x4b80('0x52')];_0x1a5178[_0x4b80('0x53')]=![];break;default:}return db['sequelize'][_0x4b80('0x54')][_0x4b80('0x55')]('cm_contacts',util[_0x4b80('0x56')](_0x4b80('0x57'),_0x435f81['id']),_0x1a5178);})[_0x4b80('0x26')](function(){return _0x435f81;});})[_0x4b80('0x26')](respondWithResult(_0x51837c,0xc9))[_0x4b80('0x44')](handleError(_0x51837c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9aaf96b..cb1de97 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 _0x161e=['path','rimraf','../../config/environment','exports','CmCustomField','cm_custom_fields','util','../../config/logger','moment','request-promise'];(function(_0x49fa45,_0x59ff71){var _0x488180=function(_0x50779f){while(--_0x50779f){_0x49fa45['push'](_0x49fa45['shift']());}};_0x488180(++_0x59ff71);}(_0x161e,0x196));var _0xe161=function(_0x4aa307,_0x30e045){_0x4aa307=_0x4aa307-0x0;var _0x4be9e9=_0x161e[_0x4aa307];return _0x4be9e9;};'use strict';var _=require('lodash');var util=require(_0xe161('0x0'));var logger=require(_0xe161('0x1'))('api');var moment=require(_0xe161('0x2'));var BPromise=require('bluebird');var rp=require(_0xe161('0x3'));var fs=require('fs');var path=require(_0xe161('0x4'));var rimraf=require(_0xe161('0x5'));var config=require(_0xe161('0x6'));var attributes=require('./cmCustomField.attributes');module[_0xe161('0x7')]=function(_0x3c5c16,_0x59e712){return _0x3c5c16['define'](_0xe161('0x8'),attributes,{'tableName':_0xe161('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x618a=['./cmCustomField.attributes','define','CmCustomField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f4990,_0x188c23){var _0x5c9d9f=function(_0xa2a061){while(--_0xa2a061){_0x5f4990['push'](_0x5f4990['shift']());}};_0x5c9d9f(++_0x188c23);}(_0x618a,0x14d));var _0xa618=function(_0x575c75,_0x120aa9){_0x575c75=_0x575c75-0x0;var _0x436370=_0x618a[_0x575c75];return _0x436370;};'use strict';var _=require('lodash');var util=require(_0xa618('0x0'));var logger=require(_0xa618('0x1'))(_0xa618('0x2'));var moment=require(_0xa618('0x3'));var BPromise=require(_0xa618('0x4'));var rp=require(_0xa618('0x5'));var fs=require('fs');var path=require(_0xa618('0x6'));var rimraf=require(_0xa618('0x7'));var config=require('../../config/environment');var attributes=require(_0xa618('0x8'));module['exports']=function(_0x1b8f88,_0x45ebd2){return _0x1b8f88[_0xa618('0x9')](_0xa618('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 03dbd1b..ea81e4b 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 _0xe25c=['CmCustomField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x48cb3b,_0x770492){var _0x2414f0=function(_0x125c23){while(--_0x125c23){_0x48cb3b['push'](_0x48cb3b['shift']());}};_0x2414f0(++_0x770492);}(_0xe25c,0x75));var _0xce25=function(_0x2a7688,_0xe708d2){_0x2a7688=_0x2a7688-0x0;var _0x3962da=_0xe25c[_0x2a7688];return _0x3962da;};'use strict';var _=require(_0xce25('0x0'));var util=require(_0xce25('0x1'));var moment=require(_0xce25('0x2'));var BPromise=require(_0xce25('0x3'));var rs=require(_0xce25('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce25('0x5'))['db'];var utils=require(_0xce25('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xce25('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1583e3,_0xb14a4e,_0x417557){return new BPromise(function(_0x11ae6a,_0x580ac7){return client[_0xce25('0x9')](_0x1583e3,_0x417557)['then'](function(_0x83fc4e){logger[_0xce25('0xa')]('CmCustomField,\x20%s,\x20%s',_0xb14a4e,_0xce25('0xb'));logger[_0xce25('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0xb14a4e,_0xce25('0xb'),JSON[_0xce25('0xd')](_0x83fc4e));if(_0x83fc4e['error']){if(_0x83fc4e[_0xce25('0xe')][_0xce25('0xf')]===0x1f4){logger['error'](_0xce25('0x10'),_0xb14a4e,_0x83fc4e['error'][_0xce25('0x11')]);return _0x580ac7(_0x83fc4e['error'][_0xce25('0x11')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0xb14a4e,_0x83fc4e[_0xce25('0xe')]['message']);return _0x11ae6a(_0x83fc4e['error'][_0xce25('0x11')]);}else{logger[_0xce25('0xa')](_0xce25('0x10'),_0xb14a4e,_0xce25('0xb'));_0x11ae6a(_0x83fc4e[_0xce25('0x12')][_0xce25('0x11')]);}})['catch'](function(_0x35ed7e){logger['error'](_0xce25('0x10'),_0xb14a4e,_0x35ed7e);_0x580ac7(_0x35ed7e);});});} \ No newline at end of file +var _0x2e01=['CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1f1990,_0x2d8e33){var _0x6be30c=function(_0x4959d4){while(--_0x4959d4){_0x1f1990['push'](_0x1f1990['shift']());}};_0x6be30c(++_0x2d8e33);}(_0x2e01,0x1a6));var _0x12e0=function(_0x6bb43a,_0x40db59){_0x6bb43a=_0x6bb43a-0x0;var _0x116e55=_0x2e01[_0x6bb43a];return _0x116e55;};'use strict';var _=require(_0x12e0('0x0'));var util=require(_0x12e0('0x1'));var moment=require('moment');var BPromise=require(_0x12e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12e0('0x3'));var db=require(_0x12e0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12e0('0x5'))(_0x12e0('0x6'));var config=require('../../config/environment');var jayson=require(_0x12e0('0x7'));var client=jayson[_0x12e0('0x8')][_0x12e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31fb71,_0x350adb,_0x8290ce){return new BPromise(function(_0x4db43b,_0x5d2e2c){return client[_0x12e0('0xa')](_0x31fb71,_0x8290ce)[_0x12e0('0xb')](function(_0x36fabc){logger[_0x12e0('0xc')]('CmCustomField,\x20%s,\x20%s',_0x350adb,'request\x20sent');logger['debug'](_0x12e0('0xd'),_0x350adb,_0x12e0('0xe'),JSON[_0x12e0('0xf')](_0x36fabc));if(_0x36fabc[_0x12e0('0x10')]){if(_0x36fabc[_0x12e0('0x10')][_0x12e0('0x11')]===0x1f4){logger['error'](_0x12e0('0x12'),_0x350adb,_0x36fabc['error']['message']);return _0x5d2e2c(_0x36fabc[_0x12e0('0x10')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x350adb,_0x36fabc['error'][_0x12e0('0x13')]);return _0x4db43b(_0x36fabc[_0x12e0('0x10')][_0x12e0('0x13')]);}else{logger[_0x12e0('0xc')](_0x12e0('0x12'),_0x350adb,_0x12e0('0xe'));_0x4db43b(_0x36fabc[_0x12e0('0x14')][_0x12e0('0x13')]);}})[_0x12e0('0x15')](function(_0x17a0f4){logger[_0x12e0('0x10')](_0x12e0('0x12'),_0x350adb,_0x17a0f4);_0x5d2e2c(_0x17a0f4);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 15bb533..92926f0 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 _0xfafb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3a0ff1,_0x157397){var _0x7092ba=function(_0x5282f9){while(--_0x5282f9){_0x3a0ff1['push'](_0x3a0ff1['shift']());}};_0x7092ba(++_0x157397);}(_0xfafb,0xf2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbfaf('0x0'));var util=require('util');var path=require(_0xbfaf('0x1'));var timeout=require(_0xbfaf('0x2'));var express=require(_0xbfaf('0x3'));var router=express[_0xbfaf('0x4')]();var fs_extra=require(_0xbfaf('0x5'));var auth=require(_0xbfaf('0x6'));var interaction=require(_0xbfaf('0x7'));var config=require(_0xbfaf('0x8'));var controller=require(_0xbfaf('0x9'));router[_0xbfaf('0xa')]('/',auth[_0xbfaf('0xb')](),controller['index']);router[_0xbfaf('0xa')]('/:id',auth[_0xbfaf('0xb')](),controller[_0xbfaf('0xc')]);router[_0xbfaf('0xd')]('/',auth[_0xbfaf('0xb')](),controller[_0xbfaf('0xe')]);router[_0xbfaf('0xf')]('/:id',auth[_0xbfaf('0xb')](),controller['update']);router[_0xbfaf('0x10')]('/:id',auth[_0xbfaf('0xb')](),controller[_0xbfaf('0x11')]);module[_0xbfaf('0x12')]=router; \ No newline at end of file +var _0x320e=['../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','express','Router','fs-extra'];(function(_0x4bb5d5,_0xdbdf58){var _0x7b0473=function(_0x2b529e){while(--_0x2b529e){_0x4bb5d5['push'](_0x4bb5d5['shift']());}};_0x7b0473(++_0xdbdf58);}(_0x320e,0x8c));var _0xe320=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0x320e[_0xa30766];return _0x24e780;};'use strict';var multer=require(_0xe320('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe320('0x1'));var router=express[_0xe320('0x2')]();var fs_extra=require(_0xe320('0x3'));var auth=require(_0xe320('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe320('0x5'));var controller=require(_0xe320('0x6'));router[_0xe320('0x7')]('/',auth[_0xe320('0x8')](),controller[_0xe320('0x9')]);router[_0xe320('0x7')]('/:id',auth[_0xe320('0x8')](),controller[_0xe320('0xa')]);router[_0xe320('0xb')]('/',auth[_0xe320('0x8')](),controller[_0xe320('0xc')]);router[_0xe320('0xd')](_0xe320('0xe'),auth[_0xe320('0x8')](),controller[_0xe320('0xf')]);router[_0xe320('0x10')](_0xe320('0xe'),auth[_0xe320('0x8')](),controller[_0xe320('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7f529a5..bb79a91 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 _0x3e51=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','STRING'];(function(_0x570f9e,_0x136096){var _0x1c4620=function(_0x25c4d){while(--_0x25c4d){_0x570f9e['push'](_0x570f9e['shift']());}};_0x1c4620(++_0x136096);}(_0x3e51,0x1d3));var _0x13e5=function(_0x277ad0,_0x35306c){_0x277ad0=_0x277ad0-0x0;var _0x3d1b66=_0x3e51[_0x277ad0];return _0x3d1b66;};'use strict';var moment=require('moment');var Sequelize=require(_0x13e5('0x0'));module[_0x13e5('0x1')]={'phone':{'type':Sequelize[_0x13e5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x13e5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x13e5('0x4')],'defaultValue':moment()[_0x13e5('0x5')](_0x13e5('0x6'))},'countbusyretry':{'type':Sequelize[_0x13e5('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x13e5('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x13e5('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x13e5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x13e5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x13e5('0x4')]},'priority':{'type':Sequelize[_0x13e5('0x7')](0x2)[_0x13e5('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x13e5('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x13e5('0x7')],'unique':_0x13e5('0x9')},'ListId':{'type':Sequelize[_0x13e5('0x7')],'unique':_0x13e5('0x9')},'UserId':{'type':Sequelize[_0x13e5('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x13e5('0x7')],'unique':_0x13e5('0x9')},'CampaignId':{'type':Sequelize[_0x13e5('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x13e5('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x13e5('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x13e5('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x13e5('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x13e5('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xebc0=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format'];(function(_0x5808d3,_0x4f8862){var _0x38e313=function(_0x18c759){while(--_0x18c759){_0x5808d3['push'](_0x5808d3['shift']());}};_0x38e313(++_0x4f8862);}(_0xebc0,0x17b));var _0x0ebc=function(_0xff20d1,_0x192c83){_0xff20d1=_0xff20d1-0x0;var _0x3e15bb=_0xebc0[_0xff20d1];return _0x3e15bb;};'use strict';var moment=require(_0x0ebc('0x0'));var Sequelize=require(_0x0ebc('0x1'));module[_0x0ebc('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x0ebc('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0ebc('0x4')],'defaultValue':moment()[_0x0ebc('0x5')](_0x0ebc('0x6'))},'countbusyretry':{'type':Sequelize[_0x0ebc('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0ebc('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0ebc('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x0ebc('0x7')](0x2)[_0x0ebc('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0ebc('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0ebc('0x7')],'unique':_0x0ebc('0xa')},'ListId':{'type':Sequelize[_0x0ebc('0x7')],'unique':_0x0ebc('0xa')},'UserId':{'type':Sequelize[_0x0ebc('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x0ebc('0x7')],'unique':_0x0ebc('0xa')},'CampaignId':{'type':Sequelize[_0x0ebc('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x0ebc('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0ebc('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0ebc('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0ebc('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0ebc('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0ebc('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x0ebc('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index f2de2a7..0643ef4 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 _0x4006=['options','find','create','body','catch','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','getPreviewRecall','Company','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','timezones','lodash','../../components/parsers/qs','../../config/logger','api','offset','undefined','count','limit','status','Content-Range','json','update','then','sendStatus','error','name','send','CmHopper','rawAttributes','type','key','model','map','query','keys','filters','intersection','$and','$or','$gt','$lt','$ne','$not','$between','$in','$notIn','$like','$iLike','$overlap','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','params','includeAll'];(function(_0x2fd232,_0x5983f0){var _0x338b88=function(_0x2eadfc){while(--_0x2eadfc){_0x2fd232['push'](_0x2fd232['shift']());}};_0x338b88(++_0x5983f0);}(_0x4006,0x1c7));var _0x6400=function(_0x596332,_0x47c9d4){_0x596332=_0x596332-0x0;var _0x44f15e=_0x4006[_0x596332];return _0x44f15e;};'use strict';var moment=require('moment');var _=require(_0x6400('0x0'));var qs=require(_0x6400('0x1'));var logger=require(_0x6400('0x2'))(_0x6400('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0xee0578,_0x4b0418){_0x4b0418=_0x4b0418||0xc8;return function(_0xd858df){if(_0xd858df){return _0xee0578['status'](_0x4b0418)['json'](_0xd858df);}};}function respondWithFilteredResult(_0x2dbd03,_0x599e6f){return function(_0x32c0db){if(_0x32c0db){var _0x2d365b=typeof _0x599e6f[_0x6400('0x4')]===_0x6400('0x5')&&typeof _0x599e6f['limit']===_0x6400('0x5');var _0x46819e=_0x32c0db[_0x6400('0x6')];var _0x356982=_0x2d365b?0x0:_0x599e6f[_0x6400('0x4')];var _0x1c59d0=_0x2d365b?_0x32c0db[_0x6400('0x6')]:_0x599e6f[_0x6400('0x4')]+_0x599e6f[_0x6400('0x7')];var _0xc510dc;if(_0x1c59d0>=_0x46819e){_0x1c59d0=_0x46819e;_0xc510dc=0xc8;}else{_0xc510dc=0xce;}_0x2dbd03[_0x6400('0x8')](_0xc510dc);return _0x2dbd03['set'](_0x6400('0x9'),_0x356982+'-'+_0x1c59d0+'/'+_0x46819e)[_0x6400('0xa')](_0x32c0db);}return null;};}function saveUpdates(_0x230c94,_0x36bf00){return function(_0x5a6d31){if(_0x5a6d31){return _0x5a6d31[_0x6400('0xb')](_0x230c94)[_0x6400('0xc')](function(_0x4ed062){return _0x4ed062;});}return null;};}function handleEntityNotFound(_0x4f8133,_0x559312){return function(_0x268f93){if(!_0x268f93){_0x4f8133[_0x6400('0xd')](0x194);}return _0x268f93;};}function handleError(_0x5b0492,_0x191696){_0x191696=_0x191696||0x1f4;return function(_0x4ae3ea){logger[_0x6400('0xe')](_0x4ae3ea['stack']);if(_0x4ae3ea[_0x6400('0xf')]){delete _0x4ae3ea[_0x6400('0xf')];}_0x5b0492[_0x6400('0x8')](_0x191696)[_0x6400('0x10')](_0x4ae3ea);};}exports['index']=function(_0x444bce,_0x14c036){var _0xce9fd1={},_0x50524f={},_0x73c470={'count':0x0,'rows':[]};var _0x205f8b=_['map'](db[_0x6400('0x11')][_0x6400('0x12')],function(_0xb4d0ca){return{'name':_0xb4d0ca['fieldName'],'type':_0xb4d0ca[_0x6400('0x13')][_0x6400('0x14')]};});_0x50524f[_0x6400('0x15')]=_[_0x6400('0x16')](_0x205f8b,_0x6400('0xf'));_0x50524f[_0x6400('0x17')]=_[_0x6400('0x18')](_0x444bce[_0x6400('0x17')]);_0x50524f[_0x6400('0x19')]=_[_0x6400('0x1a')](_0x50524f['model'],_0x50524f[_0x6400('0x17')]);_0x50524f['filters']=_['concat'](_0x50524f[_0x6400('0x19')],[_0x6400('0x1b'),_0x6400('0x1c'),_0x6400('0x1d'),'$gte',_0x6400('0x1e'),'$lte',_0x6400('0x1f'),'$eq',_0x6400('0x20'),_0x6400('0x21'),'$notBetween',_0x6400('0x22'),_0x6400('0x23'),_0x6400('0x24'),'$notLike',_0x6400('0x25'),'$notILike','$like',_0x6400('0x26'),'$contains',_0x6400('0x27'),_0x6400('0x28')]);_0xce9fd1['attributes']=_[_0x6400('0x1a')](_0x50524f['model'],qs['fields'](_0x444bce[_0x6400('0x17')][_0x6400('0x29')]));_0xce9fd1[_0x6400('0x2a')]=_0xce9fd1[_0x6400('0x2a')][_0x6400('0x2b')]?_0xce9fd1['attributes']:_0x50524f[_0x6400('0x15')];if(!_0x444bce[_0x6400('0x17')][_0x6400('0x2c')](_0x6400('0x2d'))){_0xce9fd1['limit']=qs[_0x6400('0x7')](_0x444bce[_0x6400('0x17')][_0x6400('0x7')]);_0xce9fd1['offset']=qs[_0x6400('0x4')](_0x444bce[_0x6400('0x17')][_0x6400('0x4')]);}_0xce9fd1[_0x6400('0x2e')]=qs['sort'](_0x444bce[_0x6400('0x17')][_0x6400('0x2f')]);_0xce9fd1['where']=qs[_0x6400('0x19')](_[_0x6400('0x30')](_0x444bce['query'],_0x50524f['filters']),_0x205f8b);if(_0x444bce[_0x6400('0x17')][_0x6400('0x31')]){_0xce9fd1[_0x6400('0x32')]=_['merge'](_0xce9fd1['where'],{'$or':_['map'](_0x205f8b,function(_0x1a6f4e){if(_0x1a6f4e[_0x6400('0x13')]!==_0x6400('0x33')){var _0x1a9e17={};_0x1a9e17[_0x1a6f4e[_0x6400('0xf')]]={'$like':'%'+_0x444bce['query'][_0x6400('0x31')]+'%'};return _0x1a9e17;}})});}_0xce9fd1=_[_0x6400('0x34')]({},_0xce9fd1,_0x444bce['options']);var _0x51425c={'where':_0xce9fd1[_0x6400('0x32')]};return db[_0x6400('0x11')][_0x6400('0x6')](_0x51425c)['then'](function(_0x2693a5){_0x73c470[_0x6400('0x6')]=_0x2693a5;if(_0x444bce[_0x6400('0x17')]['includeAll']){_0xce9fd1[_0x6400('0x35')]=[{'all':!![]}];}return db[_0x6400('0x11')][_0x6400('0x36')](_0xce9fd1);})['then'](function(_0x4df55d){_0x73c470['rows']=_0x4df55d;return _0x73c470;})[_0x6400('0xc')](respondWithFilteredResult(_0x14c036,_0xce9fd1))['catch'](handleError(_0x14c036,null));};exports['show']=function(_0x473cef,_0x139145){var _0x565942={'raw':!![],'where':{'id':_0x473cef[_0x6400('0x37')]['id']}},_0x150158={};_0x150158[_0x6400('0x15')]=_['keys'](db[_0x6400('0x11')][_0x6400('0x12')]);_0x150158[_0x6400('0x17')]=_[_0x6400('0x18')](_0x473cef['query']);_0x150158['filters']=_[_0x6400('0x1a')](_0x150158[_0x6400('0x15')],_0x150158[_0x6400('0x17')]);_0x565942['attributes']=_[_0x6400('0x1a')](_0x150158[_0x6400('0x15')],qs[_0x6400('0x29')](_0x473cef[_0x6400('0x17')][_0x6400('0x29')]));_0x565942['attributes']=_0x565942[_0x6400('0x2a')]['length']?_0x565942[_0x6400('0x2a')]:_0x150158[_0x6400('0x15')];if(_0x473cef[_0x6400('0x17')][_0x6400('0x38')]){_0x565942['include']=[{'all':!![]}];}_0x565942=_[_0x6400('0x34')]({},_0x565942,_0x473cef[_0x6400('0x39')]);return db[_0x6400('0x11')][_0x6400('0x3a')](_0x565942)['then'](handleEntityNotFound(_0x139145,null))[_0x6400('0xc')](respondWithResult(_0x139145,null))['catch'](handleError(_0x139145,null));};exports[_0x6400('0x3b')]=function(_0x52cc77,_0x416307){return db[_0x6400('0x11')][_0x6400('0x3b')](_0x52cc77['body'],{})[_0x6400('0xc')](respondWithResult(_0x416307,0xc9))['catch'](handleError(_0x416307,null));};exports[_0x6400('0xb')]=function(_0x146358,_0x3f444d){if(_0x146358[_0x6400('0x3c')]['id']){delete _0x146358[_0x6400('0x3c')]['id'];}return db[_0x6400('0x11')][_0x6400('0x3a')]({'where':{'id':_0x146358[_0x6400('0x37')]['id']}})[_0x6400('0xc')](handleEntityNotFound(_0x3f444d,null))[_0x6400('0xc')](saveUpdates(_0x146358[_0x6400('0x3c')],null))['then'](respondWithResult(_0x3f444d,null))[_0x6400('0x3d')](handleError(_0x3f444d,null));};exports[_0x6400('0x3e')]=function(_0x59a8f2,_0x50df2e){return db[_0x6400('0x11')][_0x6400('0x3e')]()[_0x6400('0xc')](respondWithResult(_0x50df2e,null))['catch'](handleError(_0x50df2e,null));};exports[_0x6400('0x3f')]=function(_0x54cbfb,_0x518ee4){var _0x539a5f;var _0x32c3d0=_0x54cbfb[_0x6400('0x37')]['id'];return db['CmHopper'][_0x6400('0x3a')]({'where':{'id':_0x54cbfb[_0x6400('0x37')]['id']}})['then'](handleEntityNotFound(_0x518ee4,null))['then'](function(_0x35cd68){if(_0x35cd68){return _0x35cd68[_0x6400('0x3f')]()['then'](function(_0x3421b5){return _0x3421b5;});}})[_0x6400('0xc')](function(_0xfd8d19){_0x539a5f=_0xfd8d19;if(_0xfd8d19){if(_0xfd8d19[_0x6400('0x40')]||_0xfd8d19[_0x6400('0x41')]){return db[_0xfd8d19[_0x6400('0x40')]?_0x6400('0x42'):'Campaign'][_0x6400('0x3a')]({'where':{'id':_0xfd8d19[_0x6400('0x40')]?_0xfd8d19[_0x6400('0x40')]:_0xfd8d19[_0x6400('0x41')]},'attributes':['id',_0x6400('0xf')],'raw':!![]});}}})[_0x6400('0xc')](function(_0x6a3a2d){var _0x49adde={};if(_0x6a3a2d){_[_0x6400('0x34')](_0x49adde,_['omit'](_0x539a5f['dataValues'],[_0x6400('0x43'),_0x6400('0x44'),'id']));_0x49adde[_0x6400('0x45')]=0x15;_0x49adde['statedesc']=_0x6400('0x46');_0x49adde[_0x6400('0x47')]=_0x6a3a2d[_0x6400('0xf')];_0x49adde[_0x6400('0x48')]=_0x54cbfb[_0x6400('0x49')]['name'];_0x49adde[_0x6400('0x4a')]=_0x54cbfb[_0x6400('0x49')]['id'];_0x49adde['deleted']=!![];_0x49adde[_0x6400('0x4b')]=moment()[_0x6400('0x4c')](_0x6400('0x4d'));_0x49adde['calleridnum']=_0x539a5f[_0x6400('0x4e')];_0x49adde['campaigntype']=_0x539a5f[_0x6400('0x40')]?_0x6400('0x4f'):_0x6400('0x50');return db[_0x6400('0x51')][_0x6400('0x3a')]({'where':{'id':_0x49adde[_0x6400('0x52')]},'attributes':['firstName',_0x6400('0x53')]})[_0x6400('0xc')](function(_0x5cbd3c){if(!_[_0x6400('0x54')](_0x518ee4)&&!_[_0x6400('0x54')](_0x5cbd3c[_0x6400('0x55')])){_0x49adde[_0x6400('0x56')]=_0x5cbd3c['firstName'];if(!_[_0x6400('0x54')](_0x5cbd3c[_0x6400('0x53')])){_0x49adde[_0x6400('0x56')]+='\x20'+_0x5cbd3c[_0x6400('0x53')];}}})[_0x6400('0x57')](function(){return db[_0x6400('0x58')][_0x6400('0x3b')](_0x49adde);});}})[_0x6400('0xc')](function(_0x252751){return db[_0x6400('0x59')][_0x6400('0x3f')]({'where':{'CmHopperId':_0x32c3d0}});})[_0x6400('0xc')](function(){return _0x518ee4['status'](0xcc)[_0x6400('0x5a')]();})[_0x6400('0x3d')](handleError(_0x518ee4,null));};exports['getPreview']=function(_0x283ea6,_0x5057ba){var _0x2ab58f=[];return db[_0x6400('0x51')]['describe']()[_0x6400('0xc')](function(_0x4b3d37){_0x2ab58f=_[_0x6400('0x18')](_0x4b3d37);return _0x283ea6['user'][_0x6400('0x5b')]({'where':{'type':_0x6400('0x5c'),'dialActive':!![],'dialMethod':_0x6400('0x5d')},'attributes':['id',_0x6400('0x5e'),_0x6400('0x5f')],'raw':!![]});})[_0x6400('0xc')](function(_0x4c8f71){if(_0x4c8f71&&_0x4c8f71['length']){return db[_0x6400('0x60')][_0x6400('0x61')](function(_0x49b7df){var _0x10d6a8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6400('0x16')](_0x4c8f71,'id')},'$or':[{'UserId':null},{'UserId':_0x283ea6[_0x6400('0x49')]['id']}]};var _0x39285e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4c8f71)[_0x6400('0x31')]([_0x6400('0x5f'),0x0])[_0x6400('0x16')]('id')[_0x6400('0x62')]()},'$or':[{'UserId':null},{'UserId':_0x283ea6['user']['id']}]};var _0x3be82e={'$or':[_0x10d6a8,_0x39285e]};var _0xafff1b=[];if(_0x283ea6[_0x6400('0x3c')]['direction']&&_0x283ea6['body'][_0x6400('0x63')]===_0x6400('0x64')){if(!_[_0x6400('0x65')](_0x283ea6['body'][_0x6400('0x66')])){_0x3be82e['id']={'$in':_0x283ea6['body'][_0x6400('0x66')]};}_0xafff1b=[[_0x6400('0x67'),'ASC'],[_0x6400('0x68'),_0x4c8f71[0x0][_0x6400('0x5e')]===_0x6400('0x69')?_0x6400('0x6a'):_0x6400('0x69')],db[_0x6400('0x60')][_0x6400('0x6b')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x6400('0x6a')]];}else{if(!_[_0x6400('0x65')](_0x283ea6[_0x6400('0x3c')][_0x6400('0x66')])){_0x3be82e['id']={'$notIn':_0x283ea6[_0x6400('0x3c')][_0x6400('0x66')]};}_0xafff1b=[['priority',_0x6400('0x6a')],[_0x6400('0x68'),_0x4c8f71[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6400('0x69')]];}return db[_0x6400('0x11')][_0x6400('0x6c')]({'attributes':['id',_0x6400('0x6d'),'phone',_0x6400('0x6e')],'where':_0x3be82e,'order':_0xafff1b,'transaction':_0x49b7df,'lock':_0x49b7df[_0x6400('0x6f')][_0x6400('0x70')],'include':[{'model':db[_0x6400('0x51')],'as':_0x6400('0x71'),'attributes':_0x2ab58f,'include':[{'model':db[_0x6400('0x72')],'as':'Company','attributes':['id',_0x6400('0xf')]}]},{'model':db[_0x6400('0x73')],'as':_0x6400('0x74'),'attributes':['id',_0x6400('0xf')]},{'model':db[_0x6400('0x42')],'as':_0x6400('0x75'),'attributes':['id',_0x6400('0xf'),'dialActive']}]})[_0x6400('0xc')](function(_0x240600){if(_0x240600){return _0x240600[_0x6400('0xb')]({'UserId':_0x283ea6[_0x6400('0x49')]['id']},{'transaction':_0x49b7df});}});});}})[_0x6400('0xc')](handleEntityNotFound(_0x5057ba,null))[_0x6400('0xc')](respondWithResult(_0x5057ba,null))[_0x6400('0x3d')](handleError(_0x5057ba,null));};exports[_0x6400('0x76')]=function(_0x3c2c95,_0x423abd,_0x1bf9f3){var _0x5eacb8=[];var _0x532e27=_0x3c2c95[_0x6400('0x37')]['id'];var _0x4bf10a=_0x3c2c95['user']['id'];return db[_0x6400('0x51')][_0x6400('0x3e')]()[_0x6400('0xc')](function(_0x433a32){_0x5eacb8=_['keys'](_0x433a32);return db[_0x6400('0x60')]['transaction'](function(_0x11d006){const _0x2fe63f={'id':_0x532e27};return db[_0x6400('0x11')]['findOne']({'attributes':['id',_0x6400('0x6d'),_0x6400('0x6e')],'where':_0x2fe63f,'transaction':_0x11d006,'lock':_0x11d006[_0x6400('0x6f')]['UPDATE'],'include':[{'model':db[_0x6400('0x51')],'as':_0x6400('0x71'),'attributes':_0x5eacb8,'include':[{'model':db['CmCompany'],'as':_0x6400('0x77'),'attributes':['id',_0x6400('0xf')]}]},{'model':db[_0x6400('0x73')],'as':_0x6400('0x74'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x6400('0xf'),_0x6400('0x78')]}]})[_0x6400('0xc')](function(_0xb598f5){if(_0xb598f5){return _0xb598f5['update']({'UserId':_0x4bf10a},{'transaction':_0x11d006});}});});})[_0x6400('0xc')](handleEntityNotFound(_0x423abd,null))[_0x6400('0xc')](respondWithResult(_0x423abd,null))[_0x6400('0x3d')](handleError(_0x423abd,null));};exports[_0x6400('0x79')]=function(_0x43c2c6,_0x59d472){return _0x43c2c6['user'][_0x6400('0x5b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6400('0x5d')},'attributes':['id'],'raw':!![]})[_0x6400('0xc')](function(_0x36a773){if(_0x36a773&&_0x36a773['length']){return db[_0x6400('0x11')][_0x6400('0x6')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6400('0x4c')](_0x6400('0x4d'))},'VoiceQueueId':{'$in':_[_0x6400('0x16')](_0x36a773,'id')},'$or':[{'UserId':null},{'UserId':_0x43c2c6[_0x6400('0x49')]['id']}]}});}return 0x0;})[_0x6400('0xc')](function(_0x283345){if(!_[_0x6400('0x54')](_0x283345)&&_[_0x6400('0x7a')](_0x283345)){return _0x59d472['status'](0xc8)[_0x6400('0xa')]({'contacts':_0x283345});}else{logger['error'](_0x6400('0x7b'),_0x6400('0x79'),0x194,_0x6400('0x7c'));_0x59d472[_0x6400('0xd')](0x194);}})[_0x6400('0x3d')](handleError(_0x59d472,null));};exports[_0x6400('0x7d')]=function(_0x43a887,_0x35bbd4){var _0x41797e=shared['timezones'];var _0x30904b=[];_[_0x6400('0x16')](_0x41797e,function(_0x2665af){_0x30904b[_0x6400('0x7e')]({'id':_0x2665af[_0x6400('0xf')],'name':_0x2665af[_0x6400('0xf')],'utcOffset':_0x2665af['utcOffset']});});return _0x35bbd4[_0x6400('0x8')](0xc8)['json']({'tz':_0x30904b});};exports['getTimezone']=function(_0x26d79a,_0x229ddd){var _0x109d99=shared[_0x6400('0x7f')];var _0x59f24b={};if(!_['isNil'](_0x109d99[_0x26d79a[_0x6400('0x3c')]['id']]))_0x59f24b=_0x109d99[_0x26d79a['body']['id']];return _0x229ddd[_0x6400('0x8')](0xc8)['json'](_0x59f24b);}; \ No newline at end of file +var _0x24ca=['describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','updatedAt','statedesc','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','CmContact','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','dialPreviewAutoRecallMe','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','limit','undefined','count','set','then','sendStatus','error','stack','send','CmHopper','rawAttributes','map','name','query','keys','filters','model','concat','$and','$or','$gt','$lt','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','update','body'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x24ca[_0x2bfe52];return _0x1cf649;};'use strict';var moment=require(_0xa24c('0x0'));var _=require('lodash');var qs=require(_0xa24c('0x1'));var logger=require(_0xa24c('0x2'))(_0xa24c('0x3'));var shared=require('../../config/environment');var db=require(_0xa24c('0x4'))['db'];function respondWithResult(_0x8a54a0,_0x195e60){_0x195e60=_0x195e60||0xc8;return function(_0x28aa2f){if(_0x28aa2f){return _0x8a54a0[_0xa24c('0x5')](_0x195e60)[_0xa24c('0x6')](_0x28aa2f);}};}function respondWithFilteredResult(_0xf0511,_0x3c0aaa){return function(_0x2dd348){if(_0x2dd348){var _0x257264=typeof _0x3c0aaa[_0xa24c('0x7')]==='undefined'&&typeof _0x3c0aaa[_0xa24c('0x8')]===_0xa24c('0x9');var _0x2d645c=_0x2dd348['count'];var _0x399f32=_0x257264?0x0:_0x3c0aaa[_0xa24c('0x7')];var _0x288f76=_0x257264?_0x2dd348[_0xa24c('0xa')]:_0x3c0aaa[_0xa24c('0x7')]+_0x3c0aaa[_0xa24c('0x8')];var _0x1a71a8;if(_0x288f76>=_0x2d645c){_0x288f76=_0x2d645c;_0x1a71a8=0xc8;}else{_0x1a71a8=0xce;}_0xf0511[_0xa24c('0x5')](_0x1a71a8);return _0xf0511[_0xa24c('0xb')]('Content-Range',_0x399f32+'-'+_0x288f76+'/'+_0x2d645c)[_0xa24c('0x6')](_0x2dd348);}return null;};}function saveUpdates(_0x11090c,_0xcee4fe){return function(_0x2c2af8){if(_0x2c2af8){return _0x2c2af8['update'](_0x11090c)[_0xa24c('0xc')](function(_0x3c23fc){return _0x3c23fc;});}return null;};}function handleEntityNotFound(_0x26ff28,_0x2fcd8b){return function(_0x1cb08e){if(!_0x1cb08e){_0x26ff28[_0xa24c('0xd')](0x194);}return _0x1cb08e;};}function handleError(_0x448275,_0x5d4727){_0x5d4727=_0x5d4727||0x1f4;return function(_0x47a063){logger[_0xa24c('0xe')](_0x47a063[_0xa24c('0xf')]);if(_0x47a063['name']){delete _0x47a063['name'];}_0x448275[_0xa24c('0x5')](_0x5d4727)[_0xa24c('0x10')](_0x47a063);};}exports['index']=function(_0x2a64ff,_0x5de3e6){var _0x558dc7={},_0x2a610a={},_0x1fcd4b={'count':0x0,'rows':[]};var _0xefdbd9=_['map'](db[_0xa24c('0x11')][_0xa24c('0x12')],function(_0x773f70){return{'name':_0x773f70['fieldName'],'type':_0x773f70['type']['key']};});_0x2a610a['model']=_[_0xa24c('0x13')](_0xefdbd9,_0xa24c('0x14'));_0x2a610a[_0xa24c('0x15')]=_[_0xa24c('0x16')](_0x2a64ff['query']);_0x2a610a[_0xa24c('0x17')]=_['intersection'](_0x2a610a[_0xa24c('0x18')],_0x2a610a[_0xa24c('0x15')]);_0x2a610a['filters']=_[_0xa24c('0x19')](_0x2a610a[_0xa24c('0x17')],[_0xa24c('0x1a'),_0xa24c('0x1b'),_0xa24c('0x1c'),'$gte',_0xa24c('0x1d'),'$lte',_0xa24c('0x1e'),_0xa24c('0x1f'),_0xa24c('0x20'),'$between',_0xa24c('0x21'),_0xa24c('0x22'),_0xa24c('0x23'),_0xa24c('0x24'),_0xa24c('0x25'),_0xa24c('0x26'),_0xa24c('0x27'),'$like',_0xa24c('0x28'),_0xa24c('0x29'),_0xa24c('0x2a'),_0xa24c('0x2b')]);_0x558dc7['attributes']=_[_0xa24c('0x2c')](_0x2a610a[_0xa24c('0x18')],qs[_0xa24c('0x2d')](_0x2a64ff['query'][_0xa24c('0x2d')]));_0x558dc7[_0xa24c('0x2e')]=_0x558dc7[_0xa24c('0x2e')]['length']?_0x558dc7[_0xa24c('0x2e')]:_0x2a610a['model'];if(!_0x2a64ff[_0xa24c('0x15')][_0xa24c('0x2f')](_0xa24c('0x30'))){_0x558dc7['limit']=qs[_0xa24c('0x8')](_0x2a64ff[_0xa24c('0x15')][_0xa24c('0x8')]);_0x558dc7['offset']=qs[_0xa24c('0x7')](_0x2a64ff['query'][_0xa24c('0x7')]);}_0x558dc7[_0xa24c('0x31')]=qs['sort'](_0x2a64ff['query'][_0xa24c('0x32')]);_0x558dc7[_0xa24c('0x33')]=qs[_0xa24c('0x17')](_[_0xa24c('0x34')](_0x2a64ff[_0xa24c('0x15')],_0x2a610a[_0xa24c('0x17')]),_0xefdbd9);if(_0x2a64ff[_0xa24c('0x15')]['filter']){_0x558dc7[_0xa24c('0x33')]=_[_0xa24c('0x35')](_0x558dc7[_0xa24c('0x33')],{'$or':_[_0xa24c('0x13')](_0xefdbd9,function(_0xc6337b){if(_0xc6337b[_0xa24c('0x36')]!==_0xa24c('0x37')){var _0x81d471={};_0x81d471[_0xc6337b[_0xa24c('0x14')]]={'$like':'%'+_0x2a64ff[_0xa24c('0x15')]['filter']+'%'};return _0x81d471;}})});}_0x558dc7=_[_0xa24c('0x35')]({},_0x558dc7,_0x2a64ff[_0xa24c('0x38')]);var _0x2b362d={'where':_0x558dc7[_0xa24c('0x33')]};return db['CmHopper']['count'](_0x2b362d)[_0xa24c('0xc')](function(_0x56ef4d){_0x1fcd4b[_0xa24c('0xa')]=_0x56ef4d;if(_0x2a64ff[_0xa24c('0x15')][_0xa24c('0x39')]){_0x558dc7[_0xa24c('0x3a')]=[{'all':!![]}];}return db[_0xa24c('0x11')]['findAll'](_0x558dc7);})['then'](function(_0x3121e){_0x1fcd4b[_0xa24c('0x3b')]=_0x3121e;return _0x1fcd4b;})[_0xa24c('0xc')](respondWithFilteredResult(_0x5de3e6,_0x558dc7))[_0xa24c('0x3c')](handleError(_0x5de3e6,null));};exports[_0xa24c('0x3d')]=function(_0x472912,_0x5080d0){var _0x56f392={'raw':!![],'where':{'id':_0x472912[_0xa24c('0x3e')]['id']}},_0x2a9317={};_0x2a9317[_0xa24c('0x18')]=_[_0xa24c('0x16')](db[_0xa24c('0x11')]['rawAttributes']);_0x2a9317[_0xa24c('0x15')]=_[_0xa24c('0x16')](_0x472912['query']);_0x2a9317['filters']=_[_0xa24c('0x2c')](_0x2a9317[_0xa24c('0x18')],_0x2a9317[_0xa24c('0x15')]);_0x56f392['attributes']=_['intersection'](_0x2a9317[_0xa24c('0x18')],qs[_0xa24c('0x2d')](_0x472912[_0xa24c('0x15')][_0xa24c('0x2d')]));_0x56f392[_0xa24c('0x2e')]=_0x56f392[_0xa24c('0x2e')][_0xa24c('0x3f')]?_0x56f392[_0xa24c('0x2e')]:_0x2a9317['model'];if(_0x472912['query'][_0xa24c('0x39')]){_0x56f392[_0xa24c('0x3a')]=[{'all':!![]}];}_0x56f392=_[_0xa24c('0x35')]({},_0x56f392,_0x472912['options']);return db[_0xa24c('0x11')][_0xa24c('0x40')](_0x56f392)[_0xa24c('0xc')](handleEntityNotFound(_0x5080d0,null))[_0xa24c('0xc')](respondWithResult(_0x5080d0,null))[_0xa24c('0x3c')](handleError(_0x5080d0,null));};exports[_0xa24c('0x41')]=function(_0x1e7e97,_0x35ed8a){return db[_0xa24c('0x11')][_0xa24c('0x41')](_0x1e7e97['body'],{})[_0xa24c('0xc')](respondWithResult(_0x35ed8a,0xc9))[_0xa24c('0x3c')](handleError(_0x35ed8a,null));};exports[_0xa24c('0x42')]=function(_0x5aa2b2,_0x3a85cb){if(_0x5aa2b2[_0xa24c('0x43')]['id']){delete _0x5aa2b2[_0xa24c('0x43')]['id'];}return db[_0xa24c('0x11')][_0xa24c('0x40')]({'where':{'id':_0x5aa2b2[_0xa24c('0x3e')]['id']}})[_0xa24c('0xc')](handleEntityNotFound(_0x3a85cb,null))[_0xa24c('0xc')](saveUpdates(_0x5aa2b2[_0xa24c('0x43')],null))[_0xa24c('0xc')](respondWithResult(_0x3a85cb,null))[_0xa24c('0x3c')](handleError(_0x3a85cb,null));};exports['describe']=function(_0x29a84d,_0x96b977){return db[_0xa24c('0x11')][_0xa24c('0x44')]()[_0xa24c('0xc')](respondWithResult(_0x96b977,null))[_0xa24c('0x3c')](handleError(_0x96b977,null));};exports[_0xa24c('0x45')]=function(_0x2250b9,_0x184179){var _0x4f56ae;var _0x540da8=_0x2250b9[_0xa24c('0x3e')]['id'];return db['CmHopper'][_0xa24c('0x40')]({'where':{'id':_0x2250b9[_0xa24c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x184179,null))[_0xa24c('0xc')](function(_0x2bf401){if(_0x2bf401){return _0x2bf401[_0xa24c('0x45')]()['then'](function(_0x55978e){return _0x55978e;});}})[_0xa24c('0xc')](function(_0x5ba726){_0x4f56ae=_0x5ba726;if(_0x5ba726){if(_0x5ba726[_0xa24c('0x46')]||_0x5ba726[_0xa24c('0x47')]){return db[_0x5ba726[_0xa24c('0x46')]?_0xa24c('0x48'):_0xa24c('0x49')][_0xa24c('0x40')]({'where':{'id':_0x5ba726[_0xa24c('0x46')]?_0x5ba726[_0xa24c('0x46')]:_0x5ba726[_0xa24c('0x47')]},'attributes':['id',_0xa24c('0x14')],'raw':!![]});}}})['then'](function(_0xfe488c){var _0x2759c1={};if(_0xfe488c){_[_0xa24c('0x35')](_0x2759c1,_['omit'](_0x4f56ae['dataValues'],['createdAt',_0xa24c('0x4a'),'id']));_0x2759c1['state']=0x15;_0x2759c1[_0xa24c('0x4b')]=_0xa24c('0x4c');_0x2759c1['campaign']=_0xfe488c[_0xa24c('0x14')];_0x2759c1[_0xa24c('0x4d')]=_0x2250b9[_0xa24c('0x4e')][_0xa24c('0x14')];_0x2759c1[_0xa24c('0x4f')]=_0x2250b9[_0xa24c('0x4e')]['id'];_0x2759c1[_0xa24c('0x4c')]=!![];_0x2759c1[_0xa24c('0x50')]=moment()['format'](_0xa24c('0x51'));_0x2759c1['calleridnum']=_0x4f56ae['phone'];_0x2759c1['campaigntype']=_0x4f56ae['VoiceQueueId']?'queue':_0xa24c('0x52');return db['CmContact'][_0xa24c('0x40')]({'where':{'id':_0x2759c1[_0xa24c('0x53')]},'attributes':[_0xa24c('0x54'),_0xa24c('0x55')]})[_0xa24c('0xc')](function(_0x2e1feb){if(!_[_0xa24c('0x56')](_0x184179)&&!_[_0xa24c('0x56')](_0x2e1feb[_0xa24c('0x54')])){_0x2759c1[_0xa24c('0x57')]=_0x2e1feb[_0xa24c('0x54')];if(!_[_0xa24c('0x56')](_0x2e1feb[_0xa24c('0x55')])){_0x2759c1[_0xa24c('0x57')]+='\x20'+_0x2e1feb[_0xa24c('0x55')];}}})['finally'](function(){return db[_0xa24c('0x58')][_0xa24c('0x41')](_0x2759c1);});}})['then'](function(_0x1e08bb){return db[_0xa24c('0x59')][_0xa24c('0x45')]({'where':{'CmHopperId':_0x540da8}});})[_0xa24c('0xc')](function(){return _0x184179['status'](0xcc)['end']();})[_0xa24c('0x3c')](handleError(_0x184179,null));};exports['getPreview']=function(_0x486040,_0x3549fe){var _0x2515b1=[];return db[_0xa24c('0x5a')][_0xa24c('0x44')]()['then'](function(_0x48a7b2){_0x2515b1=_[_0xa24c('0x16')](_0x48a7b2);return _0x486040['user']['getVoiceQueues']({'where':{'type':_0xa24c('0x5b'),'dialActive':!![],'dialMethod':_0xa24c('0x5c')},'attributes':['id',_0xa24c('0x5d'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xa24c('0xc')](function(_0x128e5b){if(_0x128e5b&&_0x128e5b['length']){return db[_0xa24c('0x5e')][_0xa24c('0x5f')](function(_0x3096bf){var _0x4bee5c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa24c('0x60')](_0xa24c('0x51'))},'VoiceQueueId':{'$in':_[_0xa24c('0x13')](_0x128e5b,'id')},'$or':[{'UserId':null},{'UserId':_0x486040[_0xa24c('0x4e')]['id']}]};var _0xe56235={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x128e5b)['filter']([_0xa24c('0x61'),0x0])[_0xa24c('0x13')]('id')[_0xa24c('0x62')]()},'$or':[{'UserId':null},{'UserId':_0x486040[_0xa24c('0x4e')]['id']}]};var _0xab5260={'$or':[_0x4bee5c,_0xe56235]};var _0x2ca3fa=[];if(_0x486040[_0xa24c('0x43')]['direction']&&_0x486040[_0xa24c('0x43')][_0xa24c('0x63')]==='prev'){if(!_[_0xa24c('0x64')](_0x486040[_0xa24c('0x43')][_0xa24c('0x65')])){_0xab5260['id']={'$in':_0x486040[_0xa24c('0x43')][_0xa24c('0x65')]};}_0x2ca3fa=[[_0xa24c('0x66'),_0xa24c('0x67')],[_0xa24c('0x68'),_0x128e5b[0x0][_0xa24c('0x5d')]===_0xa24c('0x67')?'DESC':_0xa24c('0x67')],db[_0xa24c('0x5e')][_0xa24c('0x69')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa24c('0x6a')]];}else{if(!_[_0xa24c('0x64')](_0x486040[_0xa24c('0x43')]['hopperIds'])){_0xab5260['id']={'$notIn':_0x486040[_0xa24c('0x43')][_0xa24c('0x65')]};}_0x2ca3fa=[[_0xa24c('0x66'),_0xa24c('0x6a')],[_0xa24c('0x68'),_0x128e5b[0x0][_0xa24c('0x5d')]],db['sequelize']['literal'](_0xa24c('0x6b')),['id','ASC']];}return db[_0xa24c('0x11')][_0xa24c('0x6c')]({'attributes':['id',_0xa24c('0x6d'),_0xa24c('0x6e'),_0xa24c('0x6f')],'where':_0xab5260,'order':_0x2ca3fa,'transaction':_0x3096bf,'lock':_0x3096bf['LOCK'][_0xa24c('0x70')],'include':[{'model':db[_0xa24c('0x5a')],'as':_0xa24c('0x71'),'attributes':_0x2515b1,'include':[{'model':db[_0xa24c('0x72')],'as':_0xa24c('0x73'),'attributes':['id',_0xa24c('0x14')]}]},{'model':db['CmList'],'as':_0xa24c('0x74'),'attributes':['id',_0xa24c('0x14')]},{'model':db[_0xa24c('0x48')],'as':_0xa24c('0x75'),'attributes':['id','name',_0xa24c('0x76')]}]})['then'](function(_0x2069b3){if(_0x2069b3){return _0x2069b3[_0xa24c('0x42')]({'UserId':_0x486040[_0xa24c('0x4e')]['id']},{'transaction':_0x3096bf});}});});}})[_0xa24c('0xc')](handleEntityNotFound(_0x3549fe,null))['then'](respondWithResult(_0x3549fe,null))[_0xa24c('0x3c')](handleError(_0x3549fe,null));};exports[_0xa24c('0x77')]=function(_0x552b79,_0x8e5e2a,_0x168a8b){var _0x135cef=[];var _0x3e0c08=_0x552b79[_0xa24c('0x3e')]['id'];var _0x288cb7=_0x552b79[_0xa24c('0x4e')]['id'];return db[_0xa24c('0x5a')]['describe']()[_0xa24c('0xc')](function(_0x3c2726){_0x135cef=_[_0xa24c('0x16')](_0x3c2726);return db[_0xa24c('0x5e')][_0xa24c('0x5f')](function(_0x209b42){const _0x118ecf={'id':_0x3e0c08};return db[_0xa24c('0x11')][_0xa24c('0x6c')]({'attributes':['id',_0xa24c('0x6d'),_0xa24c('0x6f')],'where':_0x118ecf,'transaction':_0x209b42,'lock':_0x209b42['LOCK'][_0xa24c('0x70')],'include':[{'model':db[_0xa24c('0x5a')],'as':'Contact','attributes':_0x135cef,'include':[{'model':db[_0xa24c('0x72')],'as':_0xa24c('0x73'),'attributes':['id',_0xa24c('0x14')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa24c('0x14')]},{'model':db[_0xa24c('0x48')],'as':'Queue','attributes':['id',_0xa24c('0x14'),_0xa24c('0x76')]}]})[_0xa24c('0xc')](function(_0x27a666){if(_0x27a666){return _0x27a666[_0xa24c('0x42')]({'UserId':_0x288cb7},{'transaction':_0x209b42});}});});})[_0xa24c('0xc')](handleEntityNotFound(_0x8e5e2a,null))['then'](respondWithResult(_0x8e5e2a,null))['catch'](handleError(_0x8e5e2a,null));};exports['getOpenContacts']=function(_0x263dab,_0x521894){return _0x263dab['user'][_0xa24c('0x78')]({'where':{'type':_0xa24c('0x5b'),'dialActive':!![],'dialMethod':_0xa24c('0x5c')},'attributes':['id'],'raw':!![]})[_0xa24c('0xc')](function(_0x84ddcc){if(_0x84ddcc&&_0x84ddcc[_0xa24c('0x3f')]){return db[_0xa24c('0x11')][_0xa24c('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa24c('0x60')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xa24c('0x13')](_0x84ddcc,'id')},'$or':[{'UserId':null},{'UserId':_0x263dab[_0xa24c('0x4e')]['id']}]}});}return 0x0;})[_0xa24c('0xc')](function(_0x322b51){if(!_[_0xa24c('0x56')](_0x322b51)&&_[_0xa24c('0x79')](_0x322b51)){return _0x521894[_0xa24c('0x5')](0xc8)[_0xa24c('0x6')]({'contacts':_0x322b51});}else{logger[_0xa24c('0xe')](_0xa24c('0x7a'),_0xa24c('0x7b'),0x194,_0xa24c('0x7c'));_0x521894['sendStatus'](0x194);}})[_0xa24c('0x3c')](handleError(_0x521894,null));};exports[_0xa24c('0x7d')]=function(_0x51e256,_0x257941){var _0x1a0afd=shared[_0xa24c('0x7e')];var _0x4af78f=[];_[_0xa24c('0x13')](_0x1a0afd,function(_0x4420c3){_0x4af78f['push']({'id':_0x4420c3[_0xa24c('0x14')],'name':_0x4420c3[_0xa24c('0x14')],'utcOffset':_0x4420c3['utcOffset']});});return _0x257941['status'](0xc8)[_0xa24c('0x6')]({'tz':_0x4af78f});};exports[_0xa24c('0x7f')]=function(_0x22719a,_0x10c89f){var _0x4a9ec2=shared[_0xa24c('0x7e')];var _0x350036={};if(!_[_0xa24c('0x56')](_0x4a9ec2[_0x22719a['body']['id']]))_0x350036=_0x4a9ec2[_0x22719a['body']['id']];return _0x10c89f[_0xa24c('0x5')](0xc8)[_0xa24c('0x6')](_0x350036);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b6f69cf..fd20c15 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 _0xacf4=['define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x2b571a,_0x57e8f3){var _0x554531=function(_0x318204){while(--_0x318204){_0x2b571a['push'](_0x2b571a['shift']());}};_0x554531(++_0x57e8f3);}(_0xacf4,0xe7));var _0x4acf=function(_0x524e23,_0x1e2aa7){_0x524e23=_0x524e23-0x0;var _0x231413=_0xacf4[_0x524e23];return _0x231413;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x4acf('0xd')]},{'name':'priority','fields':[_0x4acf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x344365,_0x15c7ce){var _0x3e9f2b=function(_0x3b3fd4){while(--_0x3b3fd4){_0x344365['push'](_0x344365['shift']());}};_0x3e9f2b(++_0x15c7ce);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x20b0bd,_0x26e296){_0x20b0bd=_0x20b0bd-0x0;var _0x2051c8=_0xc1c6[_0x20b0bd];return _0x2051c8;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8472195..e0a8cba 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 _0xf318=['Agent','name','voicePause','length','update','includes','push','all','dataValues','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','sequelize','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','literal','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','catch','message','error','ShowCmHopper','CmHopper','find','raw','create','body','CreateCmHopper','UpdateCmHopper','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','User'];(function(_0x39050f,_0x2c6fd5){var _0x11ad67=function(_0x540779){while(--_0x540779){_0x39050f['push'](_0x39050f['shift']());}};_0x11ad67(++_0x2c6fd5);}(_0xf318,0x155));var _0x8f31=function(_0xcdbcda,_0x3ec427){_0xcdbcda=_0xcdbcda-0x0;var _0x4474ad=_0xf318[_0xcdbcda];return _0x4474ad;};'use strict';var _=require(_0x8f31('0x0'));var util=require(_0x8f31('0x1'));var moment=require(_0x8f31('0x2'));var BPromise=require(_0x8f31('0x3'));var db=require(_0x8f31('0x4'))['db'];var logger=require(_0x8f31('0x5'))(_0x8f31('0x6'));exports[_0x8f31('0x7')]=function(_0x187fff){var _0x28422b=this;return new Promise(function(_0x2a6fd6,_0x3b5bd7){return db['CmHopper'][_0x8f31('0x8')]({'raw':_0x187fff['options']?_0x187fff['options']['raw']===undefined?!![]:![]:!![],'where':_0x187fff[_0x8f31('0x9')]?_0x187fff[_0x8f31('0x9')][_0x8f31('0xa')]||null:null,'attributes':_0x187fff[_0x8f31('0x9')]?_0x187fff['options'][_0x8f31('0xb')]||null:null,'limit':_0x187fff[_0x8f31('0x9')]?_0x187fff[_0x8f31('0x9')]['limit']||null:null,'include':_0x187fff[_0x8f31('0x9')]?_0x187fff[_0x8f31('0x9')][_0x8f31('0xc')]?_['map'](_0x187fff[_0x8f31('0x9')][_0x8f31('0xc')],function(_0x46987d){return{'model':db[_0x46987d['model']],'as':_0x46987d['as'],'attributes':_0x46987d[_0x8f31('0xb')],'include':_0x46987d[_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x46987d[_0x8f31('0xc')],function(_0x534026){return{'model':db[_0x534026['model']],'as':_0x534026['as'],'attributes':_0x534026['attributes'],'include':_0x534026[_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x534026['include'],function(_0x55b8c3){return{'model':db[_0x55b8c3[_0x8f31('0xe')]],'as':_0x55b8c3['as'],'attributes':_0x55b8c3[_0x8f31('0xb')]};}):[]};}):[]};}):[]:[]})[_0x8f31('0xf')](function(_0x3a9a9c){logger[_0x8f31('0x10')](_0x8f31('0x7'),_0x187fff);logger[_0x8f31('0x11')](_0x8f31('0x7'),_0x187fff,JSON[_0x8f31('0x12')](_0x3a9a9c));_0x2a6fd6(_0x3a9a9c);})[_0x8f31('0x13')](function(_0x35a853){logger['error'](_0x8f31('0x7'),_0x35a853[_0x8f31('0x14')],_0x187fff);_0x3b5bd7(_0x28422b[_0x8f31('0x15')](0x1f4,_0x35a853['message']));});});};exports[_0x8f31('0x16')]=function(_0x57e528){var _0x3d2eea=this;return new Promise(function(_0x2a3e1b,_0x34b17d){return db[_0x8f31('0x17')][_0x8f31('0x18')]({'raw':_0x57e528['options']?_0x57e528[_0x8f31('0x9')][_0x8f31('0x19')]===undefined?!![]:![]:!![],'where':_0x57e528[_0x8f31('0x9')]?_0x57e528['options'][_0x8f31('0xa')]||null:null,'attributes':_0x57e528[_0x8f31('0x9')]?_0x57e528[_0x8f31('0x9')][_0x8f31('0xb')]||null:null,'include':_0x57e528[_0x8f31('0x9')]?_0x57e528['options']['include']?_[_0x8f31('0xd')](_0x57e528[_0x8f31('0x9')][_0x8f31('0xc')],function(_0x5cddbb){return{'model':db[_0x5cddbb['model']],'as':_0x5cddbb['as'],'attributes':_0x5cddbb[_0x8f31('0xb')],'include':_0x5cddbb[_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x5cddbb['include'],function(_0x2e39da){return{'model':db[_0x2e39da[_0x8f31('0xe')]],'as':_0x2e39da['as'],'attributes':_0x2e39da[_0x8f31('0xb')],'include':_0x2e39da[_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x2e39da[_0x8f31('0xc')],function(_0x1941d6){return{'model':db[_0x1941d6[_0x8f31('0xe')]],'as':_0x1941d6['as'],'attributes':_0x1941d6[_0x8f31('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x364d4c){logger[_0x8f31('0x10')]('ShowCmHopper',_0x57e528);logger[_0x8f31('0x11')](_0x8f31('0x16'),_0x57e528,JSON[_0x8f31('0x12')](_0x364d4c));_0x2a3e1b(_0x364d4c);})[_0x8f31('0x13')](function(_0x44c87f){logger['error'](_0x8f31('0x16'),_0x44c87f[_0x8f31('0x14')],_0x57e528);_0x34b17d(_0x3d2eea[_0x8f31('0x15')](0x1f4,_0x44c87f[_0x8f31('0x14')]));});});};exports['CreateCmHopper']=function(_0xf1a47c){var _0x451844=this;return new Promise(function(_0x4f4132,_0x4ae7c7){return db[_0x8f31('0x17')][_0x8f31('0x1a')](_0xf1a47c[_0x8f31('0x1b')],{'raw':_0xf1a47c['options']?_0xf1a47c[_0x8f31('0x9')]['raw']===undefined?!![]:![]:!![]})[_0x8f31('0xf')](function(_0x1e4a97){logger[_0x8f31('0x10')]('CreateCmHopper',_0xf1a47c);logger['debug'](_0x8f31('0x1c'),_0xf1a47c,JSON[_0x8f31('0x12')](_0x1e4a97));_0x4f4132(_0x1e4a97);})[_0x8f31('0x13')](function(_0xea36d9){logger['error']('CreateCmHopper',_0xea36d9[_0x8f31('0x14')],_0xf1a47c);_0x4ae7c7(_0x451844[_0x8f31('0x15')](0x1f4,_0xea36d9[_0x8f31('0x14')]));});});};exports[_0x8f31('0x1d')]=function(_0x3d58d7){var _0x939f42=this;return new Promise(function(_0x168fec,_0x2afc66){return db[_0x8f31('0x17')]['update'](_0x3d58d7['body'],{'raw':_0x3d58d7['options']?_0x3d58d7[_0x8f31('0x9')][_0x8f31('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d58d7['options']?_0x3d58d7[_0x8f31('0x9')][_0x8f31('0xa')]||null:null,'attributes':_0x3d58d7[_0x8f31('0x9')]?_0x3d58d7[_0x8f31('0x9')][_0x8f31('0xb')]||null:null,'limit':_0x3d58d7[_0x8f31('0x9')]?_0x3d58d7[_0x8f31('0x9')][_0x8f31('0x1e')]||null:null})['then'](function(_0xff24d){logger['info'](_0x8f31('0x1d'),_0x3d58d7);logger['info'](_0x8f31('0x1f'),JSON[_0x8f31('0x12')](_0x3d58d7[_0x8f31('0x9')]['where']),_0x3d58d7[_0x8f31('0x1b')][_0x8f31('0x20')]);logger[_0x8f31('0x11')](_0x8f31('0x1d'),_0x3d58d7,JSON['stringify'](_0xff24d));_0x168fec(_0xff24d);})[_0x8f31('0x13')](function(_0xdc30a2){logger[_0x8f31('0x15')](_0x8f31('0x1d'),_0xdc30a2[_0x8f31('0x14')],_0x3d58d7);_0x2afc66(_0x939f42[_0x8f31('0x15')](0x1f4,_0xdc30a2[_0x8f31('0x14')]));});});};exports['DestroyCmHopper']=function(_0x48aada){var _0x59ce0=this;return new Promise(function(_0x212d70,_0xab3d13){return db[_0x8f31('0x17')][_0x8f31('0x21')]({'where':_0x48aada[_0x8f31('0x9')]?_0x48aada[_0x8f31('0x9')][_0x8f31('0xa')]||null:null})[_0x8f31('0xf')](function(_0x4bb0b3){logger['info'](_0x8f31('0x22'),_0x48aada);logger[_0x8f31('0x11')](_0x8f31('0x22'),_0x48aada,JSON['stringify'](_0x4bb0b3));_0x212d70(_0x4bb0b3);})['catch'](function(_0x2e2e66){logger[_0x8f31('0x15')]('DestroyCmHopper',_0x2e2e66[_0x8f31('0x14')],_0x48aada);_0xab3d13(_0x59ce0['error'](0x1f4,_0x2e2e66[_0x8f31('0x14')]));});});};exports['GetContactDialer']=function(_0x3e7e89){var _0x730752=this;return new Promise(function(_0xa333ad,_0x534fe5){return db[_0x8f31('0x23')][_0x8f31('0x24')]()[_0x8f31('0xf')](function(_0x17b2ce){return db['sequelize'][_0x8f31('0x25')](function(_0x250bed){return db['CmHopper']['findAll']({'where':_0x3e7e89[_0x8f31('0x9')]?_0x3e7e89['options'][_0x8f31('0xa')]||null:null,'attributes':_0x3e7e89[_0x8f31('0x9')]?_0x3e7e89[_0x8f31('0x9')][_0x8f31('0xb')]||null:null,'limit':_0x3e7e89['options']?_0x3e7e89['options'][_0x8f31('0x1e')]||null:null,'order':_0x3e7e89[_0x8f31('0x9')]?_0x3e7e89[_0x8f31('0x9')][_0x8f31('0x26')]||null:null,'transaction':_0x250bed,'lock':_0x250bed[_0x8f31('0x27')][_0x8f31('0x28')],'include':[{'model':db[_0x8f31('0x23')],'as':_0x8f31('0x29'),'attributes':_[_0x8f31('0x2a')](_0x17b2ce)},{'model':db[_0x8f31('0x2b')],'as':_0x8f31('0x2c'),'attributes':['id',_0x8f31('0x2d'),_0x8f31('0x2e')]}]})[_0x8f31('0xf')](function(_0x184d9b){var _0x2eed3c=[];var _0x339f72=[];for(var _0x3444b8=0x0;_0x3444b8<_0x184d9b[_0x8f31('0x2f')];_0x3444b8+=0x1){var _0x4728ed=_0x184d9b[_0x3444b8]['UserId'];if(_0x4728ed===null){_0x2eed3c['push'](_0x184d9b[_0x3444b8][_0x8f31('0x30')](_0x3e7e89['body'],{'transaction':_0x250bed}));}else if(!_0x339f72[_0x8f31('0x31')](_0x4728ed)){_0x339f72[_0x8f31('0x32')](_0x4728ed);_0x2eed3c[_0x8f31('0x32')](_0x184d9b[_0x3444b8][_0x8f31('0x30')](_0x3e7e89['body'],{'transaction':_0x250bed}));}}return BPromise[_0x8f31('0x33')](_0x2eed3c);});})[_0x8f31('0xf')](function(_0x5def7b){logger[_0x8f31('0x10')]('GetContactDialer',_0x3e7e89);if(_0x5def7b['length']>0x0){logger[_0x8f31('0x10')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x5def7b[0x0][_0x8f31('0x34')]['id'],_0x5def7b[0x0]['dataValues']['ContactId'],_0x5def7b[0x0]['dataValues'][_0x8f31('0x20')]);}logger[_0x8f31('0x11')](_0x8f31('0x35'),_0x3e7e89,JSON[_0x8f31('0x12')](_0x5def7b));_0xa333ad(_0x5def7b);})[_0x8f31('0x13')](function(_0x509039){logger[_0x8f31('0x15')](_0x8f31('0x35'),_0x509039['message'],_0x3e7e89);_0x534fe5(_0x730752[_0x8f31('0x15')](0x1f4,_0x509039[_0x8f31('0x14')]));});});});};exports[_0x8f31('0x36')]=function(_0x3b3682){var _0x4a3584=this;return new Promise(function(_0x23da25,_0x42d61e){return db['sequelize']['transaction'](function(_0x1bf26f){return db[_0x8f31('0x37')]['create'](_0x3b3682['body'],{'raw':_0x3b3682[_0x8f31('0x9')]?_0x3b3682[_0x8f31('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1bf26f})[_0x8f31('0xf')](function(){logger[_0x8f31('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x8f31('0x12')](_0x3b3682[_0x8f31('0x9')][_0x8f31('0xa')]),_0x3b3682['options']['where']['active']);return db[_0x8f31('0x17')][_0x8f31('0x21')]({'where':_0x3b3682[_0x8f31('0x9')]?_0x3b3682[_0x8f31('0x9')][_0x8f31('0xa')]||null:null,'transaction':_0x1bf26f});});})['then'](function(_0x5a353b){logger[_0x8f31('0x10')](_0x8f31('0x36'),_0x3b3682);logger[_0x8f31('0x11')](_0x8f31('0x36'),_0x3b3682,JSON[_0x8f31('0x12')](_0x5a353b));_0x23da25(_0x5a353b);})[_0x8f31('0x13')](function(_0x3660e4){logger[_0x8f31('0x15')](_0x8f31('0x36'),_0x3660e4[_0x8f31('0x14')],_0x3b3682);_0x42d61e(_0x4a3584['error'](0x1f4,_0x3660e4[_0x8f31('0x14')]));});});};exports[_0x8f31('0x38')]=function(_0x4163d0){var _0x4cd268=this;return new Promise(function(_0x2bc5e8,_0x23a785){return db[_0x8f31('0x17')][_0x8f31('0x8')]({'raw':_0x4163d0[_0x8f31('0x9')]?_0x4163d0[_0x8f31('0x9')][_0x8f31('0x19')]===undefined?!![]:![]:!![],'where':_0x4163d0[_0x8f31('0x9')]?_0x4163d0[_0x8f31('0x9')][_0x8f31('0xa')]||null:null,'attributes':[[db[_0x8f31('0x39')]['fn']('COUNT',db[_0x8f31('0x39')]['fn']('IF',db[_0x8f31('0x39')]['literal'](_0x8f31('0x3a')+util['format']('\x22%s\x22',moment()[_0x8f31('0x3b')](_0x8f31('0x3c')))+'\x20,\x201,\x20null'))),_0x8f31('0x3d')]]})[_0x8f31('0xf')](function(_0x5260cf){logger[_0x8f31('0x10')](_0x8f31('0x38'),_0x4163d0);logger[_0x8f31('0x11')](_0x8f31('0x38'),_0x4163d0,JSON[_0x8f31('0x12')](_0x5260cf));_0x2bc5e8(_0x5260cf);})[_0x8f31('0x13')](function(_0x120a8a){logger[_0x8f31('0x15')]('CountReScheduled',_0x120a8a[_0x8f31('0x14')],_0x4163d0);_0x23a785(_0x4cd268[_0x8f31('0x15')](0x1f4,_0x120a8a['message']));});});};exports[_0x8f31('0x3e')]=function(_0x14f69d){var _0x47378e=this;return new Promise(function(_0x2e3f74,_0x537c42){return db[_0x8f31('0x23')][_0x8f31('0x24')]()['then'](function(){return db['sequelize']['transaction'](function(_0x5ac835){return db[_0x8f31('0x17')][_0x8f31('0x8')]({'where':_0x14f69d[_0x8f31('0x9')]?_0x14f69d[_0x8f31('0x9')][_0x8f31('0xa')]||null:null,'attributes':_0x14f69d[_0x8f31('0x9')]?_0x14f69d[_0x8f31('0x9')]['attributes']||null:null,'limit':0x1,'order':_0x14f69d[_0x8f31('0x9')]?_0x14f69d['options'][_0x8f31('0x26')]||null:null,'group':db[_0x8f31('0x17')][_0x8f31('0x3f')],'transaction':_0x5ac835,'lock':_0x5ac835[_0x8f31('0x27')][_0x8f31('0x28')],'include':_0x14f69d[_0x8f31('0x9')]?_0x14f69d['options'][_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x14f69d[_0x8f31('0x9')][_0x8f31('0xc')],function(_0x5e2584){return{'model':db[_0x5e2584[_0x8f31('0xe')]],'as':_0x5e2584['as'],'attributes':_0x5e2584['attributes'],'include':_0x5e2584[_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x5e2584[_0x8f31('0xc')],function(_0x38c6ea){return{'model':db[_0x38c6ea['model']],'as':_0x38c6ea['as'],'attributes':_0x38c6ea[_0x8f31('0xb')],'include':_0x38c6ea[_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x38c6ea[_0x8f31('0xc')],function(_0x46d146){return{'model':db[_0x46d146[_0x8f31('0xe')]],'as':_0x46d146['as'],'attributes':_0x46d146[_0x8f31('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x100794){var _0x17f653=[];for(var _0x23f05a=0x0;_0x23f05a<_0x100794[_0x8f31('0x2f')];_0x23f05a+=0x1){_0x17f653['push'](_0x100794[_0x23f05a][_0x8f31('0x30')](_0x14f69d[_0x8f31('0x1b')],{'transaction':_0x5ac835}));}return BPromise[_0x8f31('0x33')](_0x17f653);});})[_0x8f31('0xf')](function(_0x1dc640){logger[_0x8f31('0x10')](_0x8f31('0x3e'),_0x14f69d);logger[_0x8f31('0x11')](_0x8f31('0x3e'),_0x14f69d,JSON[_0x8f31('0x12')](_0x1dc640));_0x2e3f74(_0x1dc640);})['catch'](function(_0x1264db){logger['error']('GetContactRecallMe',_0x1264db['message'],_0x14f69d);_0x537c42(_0x47378e['error'](0x1f4,_0x1264db[_0x8f31('0x14')]));});});});};exports[_0x8f31('0x40')]=function(_0x240116){var _0x50e109=this;return new Promise(function(_0x392551,_0x3ae768){db[_0x8f31('0x23')][_0x8f31('0x24')]()[_0x8f31('0xf')](function(_0x27fd75){return db[_0x8f31('0x17')][_0x8f31('0x8')]({'raw':_0x240116[_0x8f31('0x9')]?_0x240116[_0x8f31('0x9')][_0x8f31('0x19')]===undefined?!![]:![]:!![],'where':_0x240116['options']?_0x240116['options'][_0x8f31('0xa')]||null:null,'attributes':_0x240116[_0x8f31('0x9')]?_0x240116[_0x8f31('0x9')]['attributes']||null:null,'limit':_0x240116[_0x8f31('0x9')]?_0x240116[_0x8f31('0x9')]['limit']||null:null,'include':_0x240116['options']?_0x240116[_0x8f31('0x9')][_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x240116[_0x8f31('0x9')][_0x8f31('0xc')],function(_0x36d620){return{'model':db[_0x36d620[_0x8f31('0xe')]],'as':_0x36d620['as'],'attributes':_0x36d620['as']===_0x8f31('0x29')?_[_0x8f31('0x2a')](_0x27fd75):_0x36d620['attributes'],'include':_0x36d620[_0x8f31('0xc')]?_[_0x8f31('0xd')](_0x36d620[_0x8f31('0xc')],function(_0x4cfd9b){return{'model':db[_0x4cfd9b[_0x8f31('0xe')]],'as':_0x4cfd9b['as'],'attributes':_0x4cfd9b['attributes'],'include':_0x4cfd9b[_0x8f31('0xc')]?_['map'](_0x4cfd9b[_0x8f31('0xc')],function(_0x21bf53){return{'model':db[_0x21bf53[_0x8f31('0xe')]],'as':_0x21bf53['as'],'attributes':_0x21bf53[_0x8f31('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3477eb){logger[_0x8f31('0x10')](_0x8f31('0x7'),_0x240116);logger['debug'](_0x8f31('0x7'),_0x240116,JSON['stringify'](_0x3477eb));_0x392551(_0x3477eb);})['catch'](function(_0x89fcba){logger[_0x8f31('0x15')](_0x8f31('0x7'),_0x89fcba[_0x8f31('0x14')],_0x240116);_0x3ae768(_0x50e109[_0x8f31('0x15')](0x1f4,_0x89fcba[_0x8f31('0x14')]));});});});};exports[_0x8f31('0x41')]=function(_0x24ecc4){var _0x49a418=this;return new Promise(function(_0x5a57c2,_0xba7df5){return db[_0x8f31('0x23')]['findOne']({'raw':!![],'where':{'phone':_0x24ecc4[_0x8f31('0x9')][_0x8f31('0xa')][_0x8f31('0x42')]},'attributes':['id','dialTimezone'],'order':[['id',_0x8f31('0x43')]]})[_0x8f31('0xf')](function(_0x3a278c){logger[_0x8f31('0x10')](_0x8f31('0x44'),_0x24ecc4);logger[_0x8f31('0x11')](_0x8f31('0x44'),_0x24ecc4,JSON[_0x8f31('0x12')](_0x3a278c));_0x5a57c2(_0x3a278c);})['catch'](function(_0x37b312){logger[_0x8f31('0x15')](_0x8f31('0x44'),_0x37b312[_0x8f31('0x14')],_0x24ecc4);_0xba7df5(_0x49a418['error'](0x1f4,_0x37b312[_0x8f31('0x14')]));});});};exports[_0x8f31('0x45')]=function(_0x15af13){var _0x4490cb=this;return new Promise(function(_0x59e086,_0xc70fab){return db[_0x8f31('0x39')][_0x8f31('0x25')](function(_0x1a2c09){var _0x51ef41=_0x15af13[_0x8f31('0x9')]&&_0x15af13[_0x8f31('0x9')][_0x8f31('0xa')]?_0x15af13['options'][_0x8f31('0xa')]:{};return db[_0x8f31('0x17')]['update'](_0x15af13[_0x8f31('0x1b')],{'where':_0x51ef41,'transaction':_0x1a2c09})[_0x8f31('0xf')](function(_0x58d0b8){logger[_0x8f31('0x10')](_0x8f31('0x45'),_0x15af13);logger[_0x8f31('0x11')](_0x8f31('0x45'),_0x15af13,JSON[_0x8f31('0x12')](_0x58d0b8));_0x59e086(_0x58d0b8);})[_0x8f31('0x13')](function(_0x175206){logger['error'](_0x8f31('0x45'),_0x175206[_0x8f31('0x14')],_0x15af13);_0xc70fab(_0x4490cb['error'](0x1f4,_0x175206[_0x8f31('0x14')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x20bb5e){var _0x2cd980=this;var _0x290d92=_0x20bb5e[_0x8f31('0x1b')]['where'][_0x8f31('0x46')];var _0x158c62=_0x20bb5e['body']['where'][_0x8f31('0x47')];var _0xb281eb=_0x20bb5e[_0x8f31('0x1b')]['where']['availableAgentsIds'];return new Promise(function(_0x4e7649,_0x2c5d5a){return db['CmHopper'][_0x8f31('0x8')]({'where':{'voiceQueueId':{'$in':_0x290d92},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x8f31('0x48')]('NOW()\x20+\x20INTERVAL\x20'+_0x158c62+_0x8f31('0x49')),'$gt':db[_0x8f31('0x39')]['literal'](_0x8f31('0x4a'))}},'UserId':{'$in':_0xb281eb}},'include':[{'model':db[_0x8f31('0x23')],'as':_0x8f31('0x29')},{'model':db[_0x8f31('0x2b')],'as':_0x8f31('0x2c'),'attributes':['id',_0x8f31('0x2d'),_0x8f31('0x2e')]},{'model':db[_0x8f31('0x4b')],'as':'List'}]})[_0x8f31('0xf')](function(_0xbfa67c){if(_0xbfa67c[_0x8f31('0x2f')]>0x0){return db[_0x8f31('0x39')][_0x8f31('0x25')](function(_0x240fb0){return db[_0x8f31('0x17')][_0x8f31('0x30')]({'recallmeNotifiedDate':db['sequelize'][_0x8f31('0x48')](_0x8f31('0x4a'))},{'where':{'id':{'$in':_[_0x8f31('0xd')](_0xbfa67c,'id')}},'transaction':_0x240fb0})[_0x8f31('0xf')](function(){_0x4e7649(_0xbfa67c);})[_0x8f31('0x13')](function(_0x63e918){logger[_0x8f31('0x15')](_0x8f31('0x4c'),_0x63e918[_0x8f31('0x14')],_0x20bb5e);_0x2c5d5a(_0x2cd980[_0x8f31('0x15')](0x1f4,_0x63e918['message']));});})[_0x8f31('0x13')](function(_0x5cfef4){logger[_0x8f31('0x15')]('CmHopperHandlePreviewRecallNotifications',_0x5cfef4[_0x8f31('0x14')],_0x20bb5e);_0x2c5d5a(_0x2cd980[_0x8f31('0x15')](0x1f4,_0x5cfef4['message']));});}else{_0x4e7649(_0xbfa67c);}});});}; \ No newline at end of file +var _0x50af=['findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','lodash','util','moment','rpc','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','GetCmHopper','stringify','catch','error','message','ShowCmHopper','find','then','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetContactByPhone'];(function(_0x5c4660,_0xb05aee){var _0x1e214f=function(_0x58d32b){while(--_0x58d32b){_0x5c4660['push'](_0x5c4660['shift']());}};_0x1e214f(++_0xb05aee);}(_0x50af,0x1e3));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf50a('0x0'));var util=require(_0xf50a('0x1'));var moment=require(_0xf50a('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf50a('0x3'));exports['GetCmHopper']=function(_0x302d09){var _0x5714e5=this;return new Promise(function(_0x5e921a,_0x477b57){return db[_0xf50a('0x4')][_0xf50a('0x5')]({'raw':_0x302d09[_0xf50a('0x6')]?_0x302d09[_0xf50a('0x6')][_0xf50a('0x7')]===undefined?!![]:![]:!![],'where':_0x302d09[_0xf50a('0x6')]?_0x302d09[_0xf50a('0x6')][_0xf50a('0x8')]||null:null,'attributes':_0x302d09['options']?_0x302d09[_0xf50a('0x6')][_0xf50a('0x9')]||null:null,'limit':_0x302d09[_0xf50a('0x6')]?_0x302d09[_0xf50a('0x6')][_0xf50a('0xa')]||null:null,'include':_0x302d09[_0xf50a('0x6')]?_0x302d09[_0xf50a('0x6')][_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x302d09[_0xf50a('0x6')]['include'],function(_0x3dde40){return{'model':db[_0x3dde40[_0xf50a('0xd')]],'as':_0x3dde40['as'],'attributes':_0x3dde40[_0xf50a('0x9')],'include':_0x3dde40[_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x3dde40['include'],function(_0x17b3c2){return{'model':db[_0x17b3c2[_0xf50a('0xd')]],'as':_0x17b3c2['as'],'attributes':_0x17b3c2[_0xf50a('0x9')],'include':_0x17b3c2[_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x17b3c2[_0xf50a('0xb')],function(_0x2fd74e){return{'model':db[_0x2fd74e[_0xf50a('0xd')]],'as':_0x2fd74e['as'],'attributes':_0x2fd74e[_0xf50a('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40e7f5){logger[_0xf50a('0xe')]('GetCmHopper',_0x302d09);logger[_0xf50a('0xf')](_0xf50a('0x10'),_0x302d09,JSON[_0xf50a('0x11')](_0x40e7f5));_0x5e921a(_0x40e7f5);})[_0xf50a('0x12')](function(_0x350843){logger[_0xf50a('0x13')](_0xf50a('0x10'),_0x350843[_0xf50a('0x14')],_0x302d09);_0x477b57(_0x5714e5[_0xf50a('0x13')](0x1f4,_0x350843['message']));});});};exports[_0xf50a('0x15')]=function(_0x2d8c5f){var _0x9fac96=this;return new Promise(function(_0x8f4316,_0x44876e){return db['CmHopper'][_0xf50a('0x16')]({'raw':_0x2d8c5f[_0xf50a('0x6')]?_0x2d8c5f['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d8c5f['options']?_0x2d8c5f[_0xf50a('0x6')][_0xf50a('0x8')]||null:null,'attributes':_0x2d8c5f[_0xf50a('0x6')]?_0x2d8c5f[_0xf50a('0x6')][_0xf50a('0x9')]||null:null,'include':_0x2d8c5f[_0xf50a('0x6')]?_0x2d8c5f['options']['include']?_['map'](_0x2d8c5f['options'][_0xf50a('0xb')],function(_0x278855){return{'model':db[_0x278855[_0xf50a('0xd')]],'as':_0x278855['as'],'attributes':_0x278855[_0xf50a('0x9')],'include':_0x278855[_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x278855[_0xf50a('0xb')],function(_0x21f9aa){return{'model':db[_0x21f9aa[_0xf50a('0xd')]],'as':_0x21f9aa['as'],'attributes':_0x21f9aa['attributes'],'include':_0x21f9aa[_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x21f9aa['include'],function(_0x5033b4){return{'model':db[_0x5033b4['model']],'as':_0x5033b4['as'],'attributes':_0x5033b4[_0xf50a('0x9')]};}):[]};}):[]};}):[]:[]})[_0xf50a('0x17')](function(_0x2db561){logger[_0xf50a('0xe')]('ShowCmHopper',_0x2d8c5f);logger[_0xf50a('0xf')](_0xf50a('0x15'),_0x2d8c5f,JSON['stringify'](_0x2db561));_0x8f4316(_0x2db561);})[_0xf50a('0x12')](function(_0x1398b3){logger[_0xf50a('0x13')]('ShowCmHopper',_0x1398b3['message'],_0x2d8c5f);_0x44876e(_0x9fac96[_0xf50a('0x13')](0x1f4,_0x1398b3[_0xf50a('0x14')]));});});};exports[_0xf50a('0x18')]=function(_0x3995e2){var _0x406028=this;return new Promise(function(_0x5b1e00,_0x13f6cf){return db[_0xf50a('0x4')][_0xf50a('0x19')](_0x3995e2[_0xf50a('0x1a')],{'raw':_0x3995e2[_0xf50a('0x6')]?_0x3995e2[_0xf50a('0x6')][_0xf50a('0x7')]===undefined?!![]:![]:!![]})[_0xf50a('0x17')](function(_0x4aad90){logger[_0xf50a('0xe')]('CreateCmHopper',_0x3995e2);logger[_0xf50a('0xf')]('CreateCmHopper',_0x3995e2,JSON[_0xf50a('0x11')](_0x4aad90));_0x5b1e00(_0x4aad90);})['catch'](function(_0x274a9e){logger[_0xf50a('0x13')]('CreateCmHopper',_0x274a9e[_0xf50a('0x14')],_0x3995e2);_0x13f6cf(_0x406028['error'](0x1f4,_0x274a9e[_0xf50a('0x14')]));});});};exports['UpdateCmHopper']=function(_0x4d38b8){var _0x3ed563=this;return new Promise(function(_0x5b7c22,_0x501611){return db[_0xf50a('0x4')][_0xf50a('0x1b')](_0x4d38b8[_0xf50a('0x1a')],{'raw':_0x4d38b8[_0xf50a('0x6')]?_0x4d38b8[_0xf50a('0x6')][_0xf50a('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d38b8[_0xf50a('0x6')]?_0x4d38b8[_0xf50a('0x6')][_0xf50a('0x8')]||null:null,'attributes':_0x4d38b8[_0xf50a('0x6')]?_0x4d38b8[_0xf50a('0x6')][_0xf50a('0x9')]||null:null,'limit':_0x4d38b8[_0xf50a('0x6')]?_0x4d38b8['options']['limit']||null:null})[_0xf50a('0x17')](function(_0xcc2f8f){logger[_0xf50a('0xe')](_0xf50a('0x1c'),_0x4d38b8);logger[_0xf50a('0xe')](_0xf50a('0x1d'),JSON[_0xf50a('0x11')](_0x4d38b8['options']['where']),_0x4d38b8['body'][_0xf50a('0x1e')]);logger['debug'](_0xf50a('0x1c'),_0x4d38b8,JSON[_0xf50a('0x11')](_0xcc2f8f));_0x5b7c22(_0xcc2f8f);})['catch'](function(_0x2b4d51){logger['error'](_0xf50a('0x1c'),_0x2b4d51['message'],_0x4d38b8);_0x501611(_0x3ed563['error'](0x1f4,_0x2b4d51['message']));});});};exports['DestroyCmHopper']=function(_0x6ed2ad){var _0x217ed2=this;return new Promise(function(_0x11691b,_0x57cb3f){return db[_0xf50a('0x4')]['destroy']({'where':_0x6ed2ad[_0xf50a('0x6')]?_0x6ed2ad[_0xf50a('0x6')]['where']||null:null})['then'](function(_0x51fff0){logger[_0xf50a('0xe')](_0xf50a('0x1f'),_0x6ed2ad);logger[_0xf50a('0xf')](_0xf50a('0x1f'),_0x6ed2ad,JSON[_0xf50a('0x11')](_0x51fff0));_0x11691b(_0x51fff0);})[_0xf50a('0x12')](function(_0x15f693){logger[_0xf50a('0x13')]('DestroyCmHopper',_0x15f693['message'],_0x6ed2ad);_0x57cb3f(_0x217ed2['error'](0x1f4,_0x15f693['message']));});});};exports[_0xf50a('0x20')]=function(_0x3fc7da){var _0x3041ca=this;return new Promise(function(_0x31079b,_0x35bf27){return db[_0xf50a('0x21')][_0xf50a('0x22')]()[_0xf50a('0x17')](function(_0x5db699){return db['sequelize'][_0xf50a('0x23')](function(_0x341cda){return db[_0xf50a('0x4')]['findAll']({'where':_0x3fc7da[_0xf50a('0x6')]?_0x3fc7da['options'][_0xf50a('0x8')]||null:null,'attributes':_0x3fc7da[_0xf50a('0x6')]?_0x3fc7da['options']['attributes']||null:null,'limit':_0x3fc7da[_0xf50a('0x6')]?_0x3fc7da['options'][_0xf50a('0xa')]||null:null,'order':_0x3fc7da['options']?_0x3fc7da[_0xf50a('0x6')][_0xf50a('0x24')]||null:null,'transaction':_0x341cda,'lock':_0x341cda[_0xf50a('0x25')][_0xf50a('0x26')],'include':[{'model':db[_0xf50a('0x21')],'as':_0xf50a('0x27'),'attributes':_[_0xf50a('0x28')](_0x5db699)},{'model':db['User'],'as':_0xf50a('0x29'),'attributes':['id','name',_0xf50a('0x2a')]}]})[_0xf50a('0x17')](function(_0x84ec8b){var _0x46a3eb=[];var _0x1341f8=[];for(var _0x162527=0x0;_0x162527<_0x84ec8b[_0xf50a('0x2b')];_0x162527+=0x1){var _0x1cdd4b=_0x84ec8b[_0x162527][_0xf50a('0x2c')];if(_0x1cdd4b===null){_0x46a3eb[_0xf50a('0x2d')](_0x84ec8b[_0x162527][_0xf50a('0x1b')](_0x3fc7da['body'],{'transaction':_0x341cda}));}else if(!_0x1341f8[_0xf50a('0x2e')](_0x1cdd4b)){_0x1341f8['push'](_0x1cdd4b);_0x46a3eb['push'](_0x84ec8b[_0x162527][_0xf50a('0x1b')](_0x3fc7da['body'],{'transaction':_0x341cda}));}}return BPromise[_0xf50a('0x2f')](_0x46a3eb);});})[_0xf50a('0x17')](function(_0x1bbb21){logger[_0xf50a('0xe')](_0xf50a('0x20'),_0x3fc7da);if(_0x1bbb21[_0xf50a('0x2b')]>0x0){logger[_0xf50a('0xe')](_0xf50a('0x30'),_0x1bbb21[0x0][_0xf50a('0x31')]['id'],_0x1bbb21[0x0][_0xf50a('0x31')][_0xf50a('0x32')],_0x1bbb21[0x0][_0xf50a('0x31')][_0xf50a('0x1e')]);}logger[_0xf50a('0xf')](_0xf50a('0x20'),_0x3fc7da,JSON[_0xf50a('0x11')](_0x1bbb21));_0x31079b(_0x1bbb21);})[_0xf50a('0x12')](function(_0x117806){logger[_0xf50a('0x13')](_0xf50a('0x20'),_0x117806['message'],_0x3fc7da);_0x35bf27(_0x3041ca[_0xf50a('0x13')](0x1f4,_0x117806[_0xf50a('0x14')]));});});});};exports[_0xf50a('0x33')]=function(_0x540c52){var _0x1d7bc3=this;return new Promise(function(_0x5935b0,_0x569858){return db[_0xf50a('0x34')]['transaction'](function(_0x2027e3){return db[_0xf50a('0x35')][_0xf50a('0x19')](_0x540c52['body'],{'raw':_0x540c52[_0xf50a('0x6')]?_0x540c52['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x2027e3})[_0xf50a('0x17')](function(){logger[_0xf50a('0xe')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xf50a('0x11')](_0x540c52['options']['where']),_0x540c52[_0xf50a('0x6')][_0xf50a('0x8')][_0xf50a('0x1e')]);return db[_0xf50a('0x4')][_0xf50a('0x36')]({'where':_0x540c52[_0xf50a('0x6')]?_0x540c52[_0xf50a('0x6')]['where']||null:null,'transaction':_0x2027e3});});})[_0xf50a('0x17')](function(_0x5d1704){logger['info'](_0xf50a('0x33'),_0x540c52);logger[_0xf50a('0xf')](_0xf50a('0x33'),_0x540c52,JSON['stringify'](_0x5d1704));_0x5935b0(_0x5d1704);})[_0xf50a('0x12')](function(_0xd13d41){logger[_0xf50a('0x13')](_0xf50a('0x33'),_0xd13d41[_0xf50a('0x14')],_0x540c52);_0x569858(_0x1d7bc3[_0xf50a('0x13')](0x1f4,_0xd13d41[_0xf50a('0x14')]));});});};exports[_0xf50a('0x37')]=function(_0x390d99){var _0x36f686=this;return new Promise(function(_0x494f1d,_0x33f7c2){return db['CmHopper'][_0xf50a('0x5')]({'raw':_0x390d99['options']?_0x390d99[_0xf50a('0x6')][_0xf50a('0x7')]===undefined?!![]:![]:!![],'where':_0x390d99[_0xf50a('0x6')]?_0x390d99[_0xf50a('0x6')][_0xf50a('0x8')]||null:null,'attributes':[[db[_0xf50a('0x34')]['fn'](_0xf50a('0x38'),db[_0xf50a('0x34')]['fn']('IF',db[_0xf50a('0x34')][_0xf50a('0x39')]('`scheduledat`\x20>=\x20'+util['format'](_0xf50a('0x3a'),moment()['format'](_0xf50a('0x3b')))+'\x20,\x201,\x20null'))),_0xf50a('0x3c')]]})[_0xf50a('0x17')](function(_0x173017){logger[_0xf50a('0xe')]('CountReScheduled',_0x390d99);logger[_0xf50a('0xf')]('CountReScheduled',_0x390d99,JSON[_0xf50a('0x11')](_0x173017));_0x494f1d(_0x173017);})[_0xf50a('0x12')](function(_0x407d4a){logger['error'](_0xf50a('0x37'),_0x407d4a['message'],_0x390d99);_0x33f7c2(_0x36f686[_0xf50a('0x13')](0x1f4,_0x407d4a['message']));});});};exports['GetContactRecallMe']=function(_0x202d1a){var _0x555c20=this;return new Promise(function(_0x281cd0,_0x1a73d6){return db['CmContact'][_0xf50a('0x22')]()['then'](function(){return db[_0xf50a('0x34')][_0xf50a('0x23')](function(_0x198459){return db[_0xf50a('0x4')][_0xf50a('0x5')]({'where':_0x202d1a[_0xf50a('0x6')]?_0x202d1a['options']['where']||null:null,'attributes':_0x202d1a[_0xf50a('0x6')]?_0x202d1a[_0xf50a('0x6')][_0xf50a('0x9')]||null:null,'limit':0x1,'order':_0x202d1a['options']?_0x202d1a[_0xf50a('0x6')]['order']||null:null,'group':db['CmHopper'][_0xf50a('0x2c')],'transaction':_0x198459,'lock':_0x198459[_0xf50a('0x25')][_0xf50a('0x26')],'include':_0x202d1a[_0xf50a('0x6')]?_0x202d1a[_0xf50a('0x6')]['include']?_['map'](_0x202d1a[_0xf50a('0x6')][_0xf50a('0xb')],function(_0x1fa234){return{'model':db[_0x1fa234[_0xf50a('0xd')]],'as':_0x1fa234['as'],'attributes':_0x1fa234[_0xf50a('0x9')],'include':_0x1fa234[_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x1fa234[_0xf50a('0xb')],function(_0x5a473f){return{'model':db[_0x5a473f[_0xf50a('0xd')]],'as':_0x5a473f['as'],'attributes':_0x5a473f[_0xf50a('0x9')],'include':_0x5a473f['include']?_[_0xf50a('0xc')](_0x5a473f['include'],function(_0x453dca){return{'model':db[_0x453dca[_0xf50a('0xd')]],'as':_0x453dca['as'],'attributes':_0x453dca[_0xf50a('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10893a){var _0x1567c6=[];for(var _0x4934dd=0x0;_0x4934dd<_0x10893a[_0xf50a('0x2b')];_0x4934dd+=0x1){_0x1567c6[_0xf50a('0x2d')](_0x10893a[_0x4934dd][_0xf50a('0x1b')](_0x202d1a[_0xf50a('0x1a')],{'transaction':_0x198459}));}return BPromise[_0xf50a('0x2f')](_0x1567c6);});})['then'](function(_0x23e638){logger[_0xf50a('0xe')](_0xf50a('0x3d'),_0x202d1a);logger[_0xf50a('0xf')](_0xf50a('0x3d'),_0x202d1a,JSON[_0xf50a('0x11')](_0x23e638));_0x281cd0(_0x23e638);})[_0xf50a('0x12')](function(_0xc5c5c7){logger[_0xf50a('0x13')](_0xf50a('0x3d'),_0xc5c5c7[_0xf50a('0x14')],_0x202d1a);_0x1a73d6(_0x555c20[_0xf50a('0x13')](0x1f4,_0xc5c5c7['message']));});});});};exports['GetCmHopperPreview']=function(_0x55830f){var _0x21cd5a=this;return new Promise(function(_0xb395f4,_0x34e9a6){db[_0xf50a('0x21')][_0xf50a('0x22')]()[_0xf50a('0x17')](function(_0x44ca96){return db[_0xf50a('0x4')]['findAll']({'raw':_0x55830f[_0xf50a('0x6')]?_0x55830f[_0xf50a('0x6')][_0xf50a('0x7')]===undefined?!![]:![]:!![],'where':_0x55830f[_0xf50a('0x6')]?_0x55830f['options'][_0xf50a('0x8')]||null:null,'attributes':_0x55830f[_0xf50a('0x6')]?_0x55830f[_0xf50a('0x6')][_0xf50a('0x9')]||null:null,'limit':_0x55830f[_0xf50a('0x6')]?_0x55830f[_0xf50a('0x6')][_0xf50a('0xa')]||null:null,'include':_0x55830f[_0xf50a('0x6')]?_0x55830f['options'][_0xf50a('0xb')]?_['map'](_0x55830f[_0xf50a('0x6')]['include'],function(_0x2bb3f7){return{'model':db[_0x2bb3f7['model']],'as':_0x2bb3f7['as'],'attributes':_0x2bb3f7['as']===_0xf50a('0x27')?_[_0xf50a('0x28')](_0x44ca96):_0x2bb3f7[_0xf50a('0x9')],'include':_0x2bb3f7[_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x2bb3f7[_0xf50a('0xb')],function(_0x62b8f9){return{'model':db[_0x62b8f9['model']],'as':_0x62b8f9['as'],'attributes':_0x62b8f9['attributes'],'include':_0x62b8f9[_0xf50a('0xb')]?_[_0xf50a('0xc')](_0x62b8f9['include'],function(_0x2d2776){return{'model':db[_0x2d2776['model']],'as':_0x2d2776['as'],'attributes':_0x2d2776[_0xf50a('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x421477){logger[_0xf50a('0xe')](_0xf50a('0x10'),_0x55830f);logger['debug'](_0xf50a('0x10'),_0x55830f,JSON[_0xf50a('0x11')](_0x421477));_0xb395f4(_0x421477);})[_0xf50a('0x12')](function(_0xdd2057){logger['error']('GetCmHopper',_0xdd2057['message'],_0x55830f);_0x34e9a6(_0x21cd5a[_0xf50a('0x13')](0x1f4,_0xdd2057[_0xf50a('0x14')]));});});});};exports[_0xf50a('0x3e')]=function(_0x2041db){var _0x7dc4ae=this;return new Promise(function(_0x48cf6d,_0x203b56){return db['CmContact'][_0xf50a('0x3f')]({'raw':!![],'where':{'phone':_0x2041db['options']['where'][_0xf50a('0x40')]},'attributes':['id',_0xf50a('0x41')],'order':[['id',_0xf50a('0x42')]]})['then'](function(_0x458fb7){logger[_0xf50a('0xe')](_0xf50a('0x43'),_0x2041db);logger['debug'](_0xf50a('0x43'),_0x2041db,JSON[_0xf50a('0x11')](_0x458fb7));_0x48cf6d(_0x458fb7);})[_0xf50a('0x12')](function(_0x26b267){logger['error'](_0xf50a('0x43'),_0x26b267['message'],_0x2041db);_0x203b56(_0x7dc4ae[_0xf50a('0x13')](0x1f4,_0x26b267[_0xf50a('0x14')]));});});};exports['ResetActiveCalls']=function(_0x4e8613){var _0x2e6c86=this;return new Promise(function(_0x3abb78,_0x101e33){return db[_0xf50a('0x34')]['transaction'](function(_0x22ffd0){var _0x26a492=_0x4e8613[_0xf50a('0x6')]&&_0x4e8613[_0xf50a('0x6')]['where']?_0x4e8613[_0xf50a('0x6')]['where']:{};return db['CmHopper'][_0xf50a('0x1b')](_0x4e8613[_0xf50a('0x1a')],{'where':_0x26a492,'transaction':_0x22ffd0})[_0xf50a('0x17')](function(_0x329e46){logger[_0xf50a('0xe')](_0xf50a('0x44'),_0x4e8613);logger['debug'](_0xf50a('0x44'),_0x4e8613,JSON['stringify'](_0x329e46));_0x3abb78(_0x329e46);})['catch'](function(_0x29706e){logger['error'](_0xf50a('0x44'),_0x29706e[_0xf50a('0x14')],_0x4e8613);_0x101e33(_0x2e6c86[_0xf50a('0x13')](0x1f4,_0x29706e[_0xf50a('0x14')]));});});});};exports[_0xf50a('0x45')]=function(_0x4dc00f){var _0xf05d0f=this;var _0x335263=_0x4dc00f[_0xf50a('0x1a')]['where']['voiceQueueIds'];var _0xf61867=_0x4dc00f[_0xf50a('0x1a')]['where'][_0xf50a('0x46')];var _0x10404e=_0x4dc00f[_0xf50a('0x1a')][_0xf50a('0x8')][_0xf50a('0x47')];return new Promise(function(_0x1e6620,_0x4eae55){return db[_0xf50a('0x4')][_0xf50a('0x5')]({'where':{'voiceQueueId':{'$in':_0x335263},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xf50a('0x34')]['literal'](_0xf50a('0x48')+_0xf61867+_0xf50a('0x49')),'$gt':db['sequelize'][_0xf50a('0x39')](_0xf50a('0x4a'))}},'UserId':{'$in':_0x10404e}},'include':[{'model':db[_0xf50a('0x21')],'as':_0xf50a('0x27')},{'model':db[_0xf50a('0x4b')],'as':_0xf50a('0x29'),'attributes':['id','name','voicePause']},{'model':db[_0xf50a('0x4c')],'as':_0xf50a('0x4d')}]})[_0xf50a('0x17')](function(_0x8a36ca){if(_0x8a36ca[_0xf50a('0x2b')]>0x0){return db[_0xf50a('0x34')][_0xf50a('0x23')](function(_0x1f8b42){return db[_0xf50a('0x4')][_0xf50a('0x1b')]({'recallmeNotifiedDate':db[_0xf50a('0x34')][_0xf50a('0x39')](_0xf50a('0x4a'))},{'where':{'id':{'$in':_[_0xf50a('0xc')](_0x8a36ca,'id')}},'transaction':_0x1f8b42})[_0xf50a('0x17')](function(){_0x1e6620(_0x8a36ca);})['catch'](function(_0x3a58c7){logger[_0xf50a('0x13')](_0xf50a('0x45'),_0x3a58c7[_0xf50a('0x14')],_0x4dc00f);_0x4eae55(_0xf05d0f[_0xf50a('0x13')](0x1f4,_0x3a58c7['message']));});})[_0xf50a('0x12')](function(_0x5680f0){logger[_0xf50a('0x13')](_0xf50a('0x45'),_0x5680f0[_0xf50a('0x14')],_0x4dc00f);_0x4eae55(_0xf05d0f[_0xf50a('0x13')](0x1f4,_0x5680f0[_0xf50a('0x14')]));});}else{_0x1e6620(_0x8a36ca);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 87e6e8d..ce166b8 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 _0xbf26=['get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','update','delete','destroy','Router','../../components/auth/service','./cmHopper.controller'];(function(_0xc15e30,_0x231639){var _0x5a2d88=function(_0x36893e){while(--_0x36893e){_0xc15e30['push'](_0xc15e30['shift']());}};_0x5a2d88(++_0x231639);}(_0xbf26,0xcf));var _0x6bf2=function(_0x405359,_0x1e86ea){_0x405359=_0x405359-0x0;var _0x2bded1=_0xbf26[_0x405359];return _0x2bded1;};'use strict';var express=require('express');var router=express[_0x6bf2('0x0')]();var auth=require(_0x6bf2('0x1'));var controller=require(_0x6bf2('0x2'));router[_0x6bf2('0x3')]('/',auth[_0x6bf2('0x4')](),controller['index']);router['get'](_0x6bf2('0x5'),auth[_0x6bf2('0x4')](),controller[_0x6bf2('0x6')]);router['get'](_0x6bf2('0x7'),auth[_0x6bf2('0x4')](),controller[_0x6bf2('0x8')]);router[_0x6bf2('0x3')]('/timezones',auth['isAuthenticated'](),controller[_0x6bf2('0x9')]);router['get'](_0x6bf2('0xa'),auth['isAuthenticated'](),controller[_0x6bf2('0xb')]);router['get'](_0x6bf2('0xc'),auth[_0x6bf2('0x4')](),controller[_0x6bf2('0xd')]);router[_0x6bf2('0xe')]('/',auth[_0x6bf2('0x4')](),controller[_0x6bf2('0xf')]);router[_0x6bf2('0xe')]('/preview',auth[_0x6bf2('0x4')](),controller[_0x6bf2('0x10')]);router['post'](_0x6bf2('0x11'),auth[_0x6bf2('0x4')](),controller['getTimezone']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6bf2('0x12')]);router[_0x6bf2('0x13')](_0x6bf2('0xa'),auth[_0x6bf2('0x4')](),controller[_0x6bf2('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe114=['describe','/timezones','/:id','show','/:id/previewrecall','create','post','/preview','/timezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated'];(function(_0x16e47c,_0x28b449){var _0x47a327=function(_0x15bfc3){while(--_0x15bfc3){_0x16e47c['push'](_0x16e47c['shift']());}};_0x47a327(++_0x28b449);}(_0xe114,0x10a));var _0x4e11=function(_0x1512c6,_0x32a589){_0x1512c6=_0x1512c6-0x0;var _0x5774d0=_0xe114[_0x1512c6];return _0x5774d0;};'use strict';var express=require(_0x4e11('0x0'));var router=express[_0x4e11('0x1')]();var auth=require(_0x4e11('0x2'));var controller=require(_0x4e11('0x3'));router[_0x4e11('0x4')]('/',auth['isAuthenticated'](),controller[_0x4e11('0x5')]);router[_0x4e11('0x4')]('/describe',auth[_0x4e11('0x6')](),controller[_0x4e11('0x7')]);router[_0x4e11('0x4')]('/opencontacts',auth[_0x4e11('0x6')](),controller['getOpenContacts']);router[_0x4e11('0x4')](_0x4e11('0x8'),auth[_0x4e11('0x6')](),controller['getTimezones']);router[_0x4e11('0x4')](_0x4e11('0x9'),auth[_0x4e11('0x6')](),controller[_0x4e11('0xa')]);router[_0x4e11('0x4')](_0x4e11('0xb'),auth[_0x4e11('0x6')](),controller['getPreviewRecall']);router['post']('/',auth[_0x4e11('0x6')](),controller[_0x4e11('0xc')]);router[_0x4e11('0xd')](_0x4e11('0xe'),auth[_0x4e11('0x6')](),controller['getPreview']);router[_0x4e11('0xd')](_0x4e11('0xf'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x4e11('0x10')](_0x4e11('0x9'),auth[_0x4e11('0x6')](),controller[_0x4e11('0x11')]);router[_0x4e11('0x12')]('/:id',auth[_0x4e11('0x6')](),controller[_0x4e11('0x13')]);module[_0x4e11('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 1b1508c..1b219c1 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 _0xc2f2=['exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc2f2,0xb9));var _0x2c2f=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xc2f2[_0x13ea00];return _0x1f7347;};'use strict';var moment=require(_0x2c2f('0x0'));var Sequelize=require('sequelize');module[_0x2c2f('0x1')]={'CmHopperId':{'type':Sequelize[_0x2c2f('0x2')]},'phone':{'type':Sequelize[_0x2c2f('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x2c2f('0x4')](_0x2c2f('0x5'))},'countbusyretry':{'type':Sequelize[_0x2c2f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2c2f('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2c2f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2c2f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2c2f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa7ea=['DATE','format','moment','sequelize','exports','INTEGER','STRING'];(function(_0x344128,_0x9b9e88){var _0x693fae=function(_0x3e2b2e){while(--_0x3e2b2e){_0x344128['push'](_0x344128['shift']());}};_0x693fae(++_0x9b9e88);}(_0xa7ea,0x17c));var _0xaa7e=function(_0x3faeb1,_0x2d1ae0){_0x3faeb1=_0x3faeb1-0x0;var _0x162074=_0xa7ea[_0x3faeb1];return _0x162074;};'use strict';var moment=require(_0xaa7e('0x0'));var Sequelize=require(_0xaa7e('0x1'));module[_0xaa7e('0x2')]={'CmHopperId':{'type':Sequelize[_0xaa7e('0x3')]},'phone':{'type':Sequelize[_0xaa7e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xaa7e('0x5')],'defaultValue':moment()[_0xaa7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaa7e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 5bb8b4d..85d25c9 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 _0x5c57=['filter','VIRTUAL','merge','options','CmHopperAdditionalPhone','includeAll','include','rows','catch','show','params','keys','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x580d1b,_0x492f8d){var _0x4c2e49=function(_0x452f8b){while(--_0x452f8b){_0x580d1b['push'](_0x580d1b['shift']());}};_0x4c2e49(++_0x492f8d);}(_0x5c57,0x11b));var _0x75c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c57[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x75c5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75c5('0x1'));var moment=require(_0x75c5('0x2'));var BPromise=require(_0x75c5('0x3'));var Mustache=require(_0x75c5('0x4'));var util=require(_0x75c5('0x5'));var path=require(_0x75c5('0x6'));var sox=require(_0x75c5('0x7'));var csv=require(_0x75c5('0x8'));var ejs=require(_0x75c5('0x9'));var fs=require('fs');var fs_extra=require(_0x75c5('0xa'));var _=require(_0x75c5('0xb'));var squel=require(_0x75c5('0xc'));var crypto=require(_0x75c5('0xd'));var jsforce=require(_0x75c5('0xe'));var deskjs=require(_0x75c5('0xf'));var toCsv=require(_0x75c5('0x8'));var querystring=require(_0x75c5('0x10'));var Papa=require('papaparse');var Redis=require(_0x75c5('0x11'));var authService=require(_0x75c5('0x12'));var qs=require(_0x75c5('0x13'));var as=require(_0x75c5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75c5('0x15'))(_0x75c5('0x16'));var utils=require(_0x75c5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x75c5('0x18'));var db=require(_0x75c5('0x19'))['db'];function respondWithStatusCode(_0x8ea5da,_0x2e7e77){_0x2e7e77=_0x2e7e77||0xcc;return function(_0x344ad9){if(_0x344ad9){return _0x8ea5da[_0x75c5('0x1a')](_0x2e7e77);}return _0x8ea5da[_0x75c5('0x1b')](_0x2e7e77)['end']();};}function respondWithResult(_0xccf87d,_0xec155c){_0xec155c=_0xec155c||0xc8;return function(_0x5a74bc){if(_0x5a74bc){return _0xccf87d[_0x75c5('0x1b')](_0xec155c)[_0x75c5('0x1c')](_0x5a74bc);}};}function respondWithFilteredResult(_0x75338e,_0x5aa513){return function(_0x33ae6d){if(_0x33ae6d){var _0x4be303=typeof _0x5aa513[_0x75c5('0x1d')]===_0x75c5('0x1e')&&typeof _0x5aa513[_0x75c5('0x1f')]==='undefined';var _0x219eab=_0x33ae6d[_0x75c5('0x20')];var _0x1cf60e=_0x4be303?0x0:_0x5aa513[_0x75c5('0x1d')];var _0x302aff=_0x4be303?_0x33ae6d[_0x75c5('0x20')]:_0x5aa513[_0x75c5('0x1d')]+_0x5aa513[_0x75c5('0x1f')];var _0xea0b74;if(_0x302aff>=_0x219eab){_0x302aff=_0x219eab;_0xea0b74=0xc8;}else{_0xea0b74=0xce;}_0x75338e[_0x75c5('0x1b')](_0xea0b74);return _0x75338e[_0x75c5('0x21')]('Content-Range',_0x1cf60e+'-'+_0x302aff+'/'+_0x219eab)['json'](_0x33ae6d);}return null;};}function patchUpdates(_0x7e431a){return function(_0x22e9da){try{jsonpatch[_0x75c5('0x22')](_0x22e9da,_0x7e431a,!![]);}catch(_0x27119a){return BPromise[_0x75c5('0x23')](_0x27119a);}return _0x22e9da[_0x75c5('0x24')]();};}function saveUpdates(_0x419db4,_0x411617){return function(_0xfc7ec5){if(_0xfc7ec5){return _0xfc7ec5['update'](_0x419db4)[_0x75c5('0x25')](function(_0x1ec58a){return _0x1ec58a;});}return null;};}function removeEntity(_0x3974f0,_0x1240d4){return function(_0x30ad3e){if(_0x30ad3e){return _0x30ad3e[_0x75c5('0x26')]()[_0x75c5('0x25')](function(){var _0x159300=_0x30ad3e[_0x75c5('0x27')]({'plain':!![]});var _0x3e431d=_0x75c5('0x28');return db[_0x75c5('0x29')][_0x75c5('0x26')]({'where':{'type':_0x3e431d,'resourceId':_0x159300['id']}})[_0x75c5('0x25')](function(){return _0x30ad3e;});})['then'](function(){_0x3974f0[_0x75c5('0x1b')](0xcc)[_0x75c5('0x2a')]();});}};}function handleEntityNotFound(_0x3aa965,_0x1b00cf){return function(_0x28ef1e){if(!_0x28ef1e){_0x3aa965['sendStatus'](0x194);}return _0x28ef1e;};}function handleError(_0x177058,_0x15ac66){_0x15ac66=_0x15ac66||0x1f4;return function(_0x257a9a){logger[_0x75c5('0x2b')](_0x257a9a[_0x75c5('0x2c')]);if(_0x257a9a[_0x75c5('0x2d')]){delete _0x257a9a['name'];}_0x177058['status'](_0x15ac66)[_0x75c5('0x2e')](_0x257a9a);};}exports[_0x75c5('0x2f')]=function(_0x5d23ec,_0x4b8f02){var _0x18eed7={},_0x4c67a0={},_0x1e71d5={'count':0x0,'rows':[]};var _0x190faa=_[_0x75c5('0x30')](db['CmHopperAdditionalPhone'][_0x75c5('0x31')],function(_0x3ebbd1){return{'name':_0x3ebbd1[_0x75c5('0x32')],'type':_0x3ebbd1[_0x75c5('0x33')][_0x75c5('0x34')]};});_0x4c67a0[_0x75c5('0x35')]=_[_0x75c5('0x30')](_0x190faa,_0x75c5('0x2d'));_0x4c67a0[_0x75c5('0x36')]=_['keys'](_0x5d23ec[_0x75c5('0x36')]);_0x4c67a0[_0x75c5('0x37')]=_['intersection'](_0x4c67a0[_0x75c5('0x35')],_0x4c67a0['query']);_0x18eed7[_0x75c5('0x38')]=_[_0x75c5('0x39')](_0x4c67a0[_0x75c5('0x35')],qs[_0x75c5('0x3a')](_0x5d23ec[_0x75c5('0x36')]['fields']));_0x18eed7[_0x75c5('0x38')]=_0x18eed7[_0x75c5('0x38')]['length']?_0x18eed7[_0x75c5('0x38')]:_0x4c67a0['model'];if(!_0x5d23ec[_0x75c5('0x36')][_0x75c5('0x3b')](_0x75c5('0x3c'))){_0x18eed7[_0x75c5('0x1f')]=qs['limit'](_0x5d23ec[_0x75c5('0x36')][_0x75c5('0x1f')]);_0x18eed7['offset']=qs[_0x75c5('0x1d')](_0x5d23ec[_0x75c5('0x36')]['offset']);}_0x18eed7[_0x75c5('0x3d')]=qs[_0x75c5('0x3e')](_0x5d23ec[_0x75c5('0x36')][_0x75c5('0x3e')]);_0x18eed7[_0x75c5('0x3f')]=qs[_0x75c5('0x37')](_[_0x75c5('0x40')](_0x5d23ec[_0x75c5('0x36')],_0x4c67a0[_0x75c5('0x37')]),_0x190faa);if(_0x5d23ec[_0x75c5('0x36')][_0x75c5('0x41')]){_0x18eed7['where']=_['merge'](_0x18eed7[_0x75c5('0x3f')],{'$or':_[_0x75c5('0x30')](_0x190faa,function(_0x2af4c8){if(_0x2af4c8[_0x75c5('0x33')]!==_0x75c5('0x42')){var _0x5d2c04={};_0x5d2c04[_0x2af4c8['name']]={'$like':'%'+_0x5d23ec['query'][_0x75c5('0x41')]+'%'};return _0x5d2c04;}})});}_0x18eed7=_[_0x75c5('0x43')]({},_0x18eed7,_0x5d23ec[_0x75c5('0x44')]);var _0x8a83d9={'where':_0x18eed7['where']};return db[_0x75c5('0x45')][_0x75c5('0x20')](_0x8a83d9)['then'](function(_0x33a891){_0x1e71d5[_0x75c5('0x20')]=_0x33a891;if(_0x5d23ec[_0x75c5('0x36')][_0x75c5('0x46')]){_0x18eed7[_0x75c5('0x47')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x18eed7);})[_0x75c5('0x25')](function(_0x5aff57){_0x1e71d5[_0x75c5('0x48')]=_0x5aff57;return _0x1e71d5;})['then'](respondWithFilteredResult(_0x4b8f02,_0x18eed7))[_0x75c5('0x49')](handleError(_0x4b8f02,null));};exports[_0x75c5('0x4a')]=function(_0x16182e,_0x47f9da){var _0x4ff83c={'raw':!![],'where':{'id':_0x16182e[_0x75c5('0x4b')]['id']}},_0x8f0601={};_0x8f0601[_0x75c5('0x35')]=_['keys'](db[_0x75c5('0x45')][_0x75c5('0x31')]);_0x8f0601['query']=_[_0x75c5('0x4c')](_0x16182e[_0x75c5('0x36')]);_0x8f0601[_0x75c5('0x37')]=_[_0x75c5('0x39')](_0x8f0601[_0x75c5('0x35')],_0x8f0601['query']);_0x4ff83c[_0x75c5('0x38')]=_[_0x75c5('0x39')](_0x8f0601['model'],qs['fields'](_0x16182e[_0x75c5('0x36')][_0x75c5('0x3a')]));_0x4ff83c['attributes']=_0x4ff83c[_0x75c5('0x38')]['length']?_0x4ff83c['attributes']:_0x8f0601[_0x75c5('0x35')];if(_0x16182e[_0x75c5('0x36')][_0x75c5('0x46')]){_0x4ff83c['include']=[{'all':!![]}];}_0x4ff83c=_[_0x75c5('0x43')]({},_0x4ff83c,_0x16182e['options']);return db[_0x75c5('0x45')]['find'](_0x4ff83c)[_0x75c5('0x25')](handleEntityNotFound(_0x47f9da,null))[_0x75c5('0x25')](respondWithResult(_0x47f9da,null))[_0x75c5('0x49')](handleError(_0x47f9da,null));};exports['create']=function(_0x39de8a,_0x25c0d){return db[_0x75c5('0x45')][_0x75c5('0x4d')](_0x39de8a[_0x75c5('0x4e')],{})[_0x75c5('0x25')](function(_0x59b875){var _0x395cf4=_0x39de8a['user'][_0x75c5('0x27')]({'plain':!![]});if(!_0x395cf4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x395cf4[_0x75c5('0x4f')]===_0x75c5('0x50')){var _0x1cfed0=_0x59b875['get']({'plain':!![]});var _0x46c7b5=_0x75c5('0x28');return db[_0x75c5('0x51')][_0x75c5('0x52')]({'where':{'name':_0x46c7b5,'userProfileId':_0x395cf4[_0x75c5('0x53')]},'raw':!![]})['then'](function(_0x27e597){if(_0x27e597&&_0x27e597[_0x75c5('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1cfed0[_0x75c5('0x2d')],'resourceId':_0x1cfed0['id'],'type':_0x27e597[_0x75c5('0x2d')],'sectionId':_0x27e597['id']},{})['then'](function(){return _0x59b875;});}else{return _0x59b875;}})['catch'](function(_0x354b79){logger['error'](_0x75c5('0x55'),_0x354b79);throw _0x354b79;});}return _0x59b875;})[_0x75c5('0x25')](respondWithResult(_0x25c0d,0xc9))['catch'](handleError(_0x25c0d,null));};exports[_0x75c5('0x56')]=function(_0x3b7c34,_0x3e8753){if(_0x3b7c34[_0x75c5('0x4e')]['id']){delete _0x3b7c34[_0x75c5('0x4e')]['id'];}return db[_0x75c5('0x45')]['find']({'where':{'id':_0x3b7c34['params']['id']}})[_0x75c5('0x25')](handleEntityNotFound(_0x3e8753,null))[_0x75c5('0x25')](saveUpdates(_0x3b7c34[_0x75c5('0x4e')],null))[_0x75c5('0x25')](respondWithResult(_0x3e8753,null))['catch'](handleError(_0x3e8753,null));};exports['destroy']=function(_0x4bc720,_0x72f514){return db[_0x75c5('0x45')][_0x75c5('0x52')]({'where':{'id':_0x4bc720[_0x75c5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x72f514,null))[_0x75c5('0x25')](removeEntity(_0x72f514,null))[_0x75c5('0x49')](handleError(_0x72f514,null));}; \ No newline at end of file +var _0xd5a9=['then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update'];(function(_0x38894d,_0x1883d8){var _0x5614fe=function(_0x181989){while(--_0x181989){_0x38894d['push'](_0x38894d['shift']());}};_0x5614fe(++_0x1883d8);}(_0xd5a9,0x81));var _0x9d5a=function(_0x4cffe7,_0x34ba59){_0x4cffe7=_0x4cffe7-0x0;var _0x2f967d=_0xd5a9[_0x4cffe7];return _0x2f967d;};'use strict';var emlformat=require(_0x9d5a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d5a('0x1'));var rp=require(_0x9d5a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9d5a('0x3'));var util=require(_0x9d5a('0x4'));var path=require(_0x9d5a('0x5'));var sox=require('sox');var csv=require(_0x9d5a('0x6'));var ejs=require(_0x9d5a('0x7'));var fs=require('fs');var fs_extra=require(_0x9d5a('0x8'));var _=require(_0x9d5a('0x9'));var squel=require(_0x9d5a('0xa'));var crypto=require(_0x9d5a('0xb'));var jsforce=require(_0x9d5a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9d5a('0x6'));var querystring=require(_0x9d5a('0xd'));var Papa=require(_0x9d5a('0xe'));var Redis=require(_0x9d5a('0xf'));var authService=require(_0x9d5a('0x10'));var qs=require(_0x9d5a('0x11'));var as=require(_0x9d5a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9d5a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9d5a('0x14'));var db=require(_0x9d5a('0x15'))['db'];function respondWithStatusCode(_0x2b99c2,_0x3aad62){_0x3aad62=_0x3aad62||0xcc;return function(_0x4430bf){if(_0x4430bf){return _0x2b99c2[_0x9d5a('0x16')](_0x3aad62);}return _0x2b99c2['status'](_0x3aad62)[_0x9d5a('0x17')]();};}function respondWithResult(_0x351261,_0x2c28a0){_0x2c28a0=_0x2c28a0||0xc8;return function(_0x4038f8){if(_0x4038f8){return _0x351261['status'](_0x2c28a0)[_0x9d5a('0x18')](_0x4038f8);}};}function respondWithFilteredResult(_0x5ced63,_0x57edc8){return function(_0x461eea){if(_0x461eea){var _0x103c3f=typeof _0x57edc8['offset']===_0x9d5a('0x19')&&typeof _0x57edc8[_0x9d5a('0x1a')]===_0x9d5a('0x19');var _0x4ed1f2=_0x461eea[_0x9d5a('0x1b')];var _0x380ef1=_0x103c3f?0x0:_0x57edc8['offset'];var _0x45e80c=_0x103c3f?_0x461eea[_0x9d5a('0x1b')]:_0x57edc8[_0x9d5a('0x1c')]+_0x57edc8[_0x9d5a('0x1a')];var _0x2eb6a7;if(_0x45e80c>=_0x4ed1f2){_0x45e80c=_0x4ed1f2;_0x2eb6a7=0xc8;}else{_0x2eb6a7=0xce;}_0x5ced63[_0x9d5a('0x1d')](_0x2eb6a7);return _0x5ced63[_0x9d5a('0x1e')](_0x9d5a('0x1f'),_0x380ef1+'-'+_0x45e80c+'/'+_0x4ed1f2)['json'](_0x461eea);}return null;};}function patchUpdates(_0x16ddaf){return function(_0x667b6b){try{jsonpatch['apply'](_0x667b6b,_0x16ddaf,!![]);}catch(_0x92b103){return BPromise[_0x9d5a('0x20')](_0x92b103);}return _0x667b6b[_0x9d5a('0x21')]();};}function saveUpdates(_0x3d2e03,_0x120470){return function(_0x5a7116){if(_0x5a7116){return _0x5a7116[_0x9d5a('0x22')](_0x3d2e03)[_0x9d5a('0x23')](function(_0x34cc43){return _0x34cc43;});}return null;};}function removeEntity(_0x1b7918,_0x58557d){return function(_0x1f87be){if(_0x1f87be){return _0x1f87be[_0x9d5a('0x24')]()['then'](function(){var _0x5d7d8b=_0x1f87be[_0x9d5a('0x25')]({'plain':!![]});var _0x2f387a=_0x9d5a('0x26');return db[_0x9d5a('0x27')]['destroy']({'where':{'type':_0x2f387a,'resourceId':_0x5d7d8b['id']}})['then'](function(){return _0x1f87be;});})[_0x9d5a('0x23')](function(){_0x1b7918[_0x9d5a('0x1d')](0xcc)[_0x9d5a('0x17')]();});}};}function handleEntityNotFound(_0x262f61,_0x5989ae){return function(_0x18f960){if(!_0x18f960){_0x262f61[_0x9d5a('0x16')](0x194);}return _0x18f960;};}function handleError(_0x1680f9,_0x3971ad){_0x3971ad=_0x3971ad||0x1f4;return function(_0x22f620){logger[_0x9d5a('0x28')](_0x22f620['stack']);if(_0x22f620[_0x9d5a('0x29')]){delete _0x22f620['name'];}_0x1680f9[_0x9d5a('0x1d')](_0x3971ad)[_0x9d5a('0x2a')](_0x22f620);};}exports['index']=function(_0x18a9ee,_0x2aa4ec){var _0x185967={},_0x1ab2ba={},_0x10d34f={'count':0x0,'rows':[]};var _0x4e1d22=_['map'](db[_0x9d5a('0x2b')][_0x9d5a('0x2c')],function(_0x19a082){return{'name':_0x19a082[_0x9d5a('0x2d')],'type':_0x19a082[_0x9d5a('0x2e')][_0x9d5a('0x2f')]};});_0x1ab2ba[_0x9d5a('0x30')]=_[_0x9d5a('0x31')](_0x4e1d22,_0x9d5a('0x29'));_0x1ab2ba[_0x9d5a('0x32')]=_[_0x9d5a('0x33')](_0x18a9ee[_0x9d5a('0x32')]);_0x1ab2ba[_0x9d5a('0x34')]=_[_0x9d5a('0x35')](_0x1ab2ba['model'],_0x1ab2ba[_0x9d5a('0x32')]);_0x185967[_0x9d5a('0x36')]=_[_0x9d5a('0x35')](_0x1ab2ba['model'],qs[_0x9d5a('0x37')](_0x18a9ee[_0x9d5a('0x32')][_0x9d5a('0x37')]));_0x185967[_0x9d5a('0x36')]=_0x185967[_0x9d5a('0x36')][_0x9d5a('0x38')]?_0x185967[_0x9d5a('0x36')]:_0x1ab2ba['model'];if(!_0x18a9ee[_0x9d5a('0x32')][_0x9d5a('0x39')](_0x9d5a('0x3a'))){_0x185967[_0x9d5a('0x1a')]=qs['limit'](_0x18a9ee['query'][_0x9d5a('0x1a')]);_0x185967[_0x9d5a('0x1c')]=qs[_0x9d5a('0x1c')](_0x18a9ee['query'][_0x9d5a('0x1c')]);}_0x185967[_0x9d5a('0x3b')]=qs['sort'](_0x18a9ee[_0x9d5a('0x32')][_0x9d5a('0x3c')]);_0x185967[_0x9d5a('0x3d')]=qs['filters'](_[_0x9d5a('0x3e')](_0x18a9ee[_0x9d5a('0x32')],_0x1ab2ba[_0x9d5a('0x34')]),_0x4e1d22);if(_0x18a9ee['query'][_0x9d5a('0x3f')]){_0x185967[_0x9d5a('0x3d')]=_[_0x9d5a('0x40')](_0x185967[_0x9d5a('0x3d')],{'$or':_['map'](_0x4e1d22,function(_0x2b64f8){if(_0x2b64f8[_0x9d5a('0x2e')]!==_0x9d5a('0x41')){var _0x2b7331={};_0x2b7331[_0x2b64f8[_0x9d5a('0x29')]]={'$like':'%'+_0x18a9ee['query'][_0x9d5a('0x3f')]+'%'};return _0x2b7331;}})});}_0x185967=_[_0x9d5a('0x40')]({},_0x185967,_0x18a9ee['options']);var _0x426ecb={'where':_0x185967[_0x9d5a('0x3d')]};return db[_0x9d5a('0x2b')][_0x9d5a('0x1b')](_0x426ecb)[_0x9d5a('0x23')](function(_0x37ed97){_0x10d34f['count']=_0x37ed97;if(_0x18a9ee['query'][_0x9d5a('0x42')]){_0x185967[_0x9d5a('0x43')]=[{'all':!![]}];}return db[_0x9d5a('0x2b')][_0x9d5a('0x44')](_0x185967);})[_0x9d5a('0x23')](function(_0x37534c){_0x10d34f[_0x9d5a('0x45')]=_0x37534c;return _0x10d34f;})[_0x9d5a('0x23')](respondWithFilteredResult(_0x2aa4ec,_0x185967))[_0x9d5a('0x46')](handleError(_0x2aa4ec,null));};exports[_0x9d5a('0x47')]=function(_0x5933f9,_0x11b3f8){var _0x4f6ccb={'raw':!![],'where':{'id':_0x5933f9[_0x9d5a('0x48')]['id']}},_0x3c16dd={};_0x3c16dd['model']=_[_0x9d5a('0x33')](db[_0x9d5a('0x2b')][_0x9d5a('0x2c')]);_0x3c16dd[_0x9d5a('0x32')]=_['keys'](_0x5933f9[_0x9d5a('0x32')]);_0x3c16dd['filters']=_[_0x9d5a('0x35')](_0x3c16dd['model'],_0x3c16dd[_0x9d5a('0x32')]);_0x4f6ccb[_0x9d5a('0x36')]=_[_0x9d5a('0x35')](_0x3c16dd[_0x9d5a('0x30')],qs[_0x9d5a('0x37')](_0x5933f9['query'][_0x9d5a('0x37')]));_0x4f6ccb[_0x9d5a('0x36')]=_0x4f6ccb[_0x9d5a('0x36')][_0x9d5a('0x38')]?_0x4f6ccb[_0x9d5a('0x36')]:_0x3c16dd[_0x9d5a('0x30')];if(_0x5933f9['query']['includeAll']){_0x4f6ccb[_0x9d5a('0x43')]=[{'all':!![]}];}_0x4f6ccb=_[_0x9d5a('0x40')]({},_0x4f6ccb,_0x5933f9['options']);return db[_0x9d5a('0x2b')][_0x9d5a('0x49')](_0x4f6ccb)[_0x9d5a('0x23')](handleEntityNotFound(_0x11b3f8,null))[_0x9d5a('0x23')](respondWithResult(_0x11b3f8,null))[_0x9d5a('0x46')](handleError(_0x11b3f8,null));};exports[_0x9d5a('0x4a')]=function(_0x196ff9,_0xf5ee77){return db['CmHopperAdditionalPhone'][_0x9d5a('0x4a')](_0x196ff9[_0x9d5a('0x4b')],{})['then'](function(_0x56e9a3){var _0x446605=_0x196ff9[_0x9d5a('0x4c')]['get']({'plain':!![]});if(!_0x446605)throw new Error(_0x9d5a('0x4d'));if(_0x446605[_0x9d5a('0x4e')]===_0x9d5a('0x4c')){var _0x5eca7f=_0x56e9a3[_0x9d5a('0x25')]({'plain':!![]});var _0x334b76=_0x9d5a('0x26');return db[_0x9d5a('0x4f')][_0x9d5a('0x49')]({'where':{'name':_0x334b76,'userProfileId':_0x446605[_0x9d5a('0x50')]},'raw':!![]})[_0x9d5a('0x23')](function(_0x1f0e8f){if(_0x1f0e8f&&_0x1f0e8f['autoAssociation']===0x0){return db[_0x9d5a('0x27')][_0x9d5a('0x4a')]({'name':_0x5eca7f[_0x9d5a('0x29')],'resourceId':_0x5eca7f['id'],'type':_0x1f0e8f[_0x9d5a('0x29')],'sectionId':_0x1f0e8f['id']},{})[_0x9d5a('0x23')](function(){return _0x56e9a3;});}else{return _0x56e9a3;}})[_0x9d5a('0x46')](function(_0x1ad786){logger[_0x9d5a('0x28')](_0x9d5a('0x51'),_0x1ad786);throw _0x1ad786;});}return _0x56e9a3;})[_0x9d5a('0x23')](respondWithResult(_0xf5ee77,0xc9))[_0x9d5a('0x46')](handleError(_0xf5ee77,null));};exports[_0x9d5a('0x22')]=function(_0xaf7146,_0x38760c){if(_0xaf7146[_0x9d5a('0x4b')]['id']){delete _0xaf7146[_0x9d5a('0x4b')]['id'];}return db[_0x9d5a('0x2b')][_0x9d5a('0x49')]({'where':{'id':_0xaf7146[_0x9d5a('0x48')]['id']}})['then'](handleEntityNotFound(_0x38760c,null))['then'](saveUpdates(_0xaf7146[_0x9d5a('0x4b')],null))['then'](respondWithResult(_0x38760c,null))[_0x9d5a('0x46')](handleError(_0x38760c,null));};exports[_0x9d5a('0x24')]=function(_0x31cdc3,_0x97de8){return db['CmHopperAdditionalPhone'][_0x9d5a('0x49')]({'where':{'id':_0x31cdc3['params']['id']}})[_0x9d5a('0x23')](handleEntityNotFound(_0x97de8,null))['then'](removeEntity(_0x97de8,null))[_0x9d5a('0x46')](handleError(_0x97de8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 2dd1c67..55531a4 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 _0x1dda=['cm_hopper_additional_phones','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x1dda,0xa3));var _0xa1dd=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0x1dda[_0x7ad6cb];return _0x22a0ba;};'use strict';var _=require('lodash');var util=require(_0xa1dd('0x0'));var logger=require(_0xa1dd('0x1'))(_0xa1dd('0x2'));var moment=require('moment');var BPromise=require(_0xa1dd('0x3'));var rp=require(_0xa1dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1dd('0x5'));var config=require(_0xa1dd('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xa1dd('0x7')]=function(_0x5a6660,_0x23c597){return _0x5a6660['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0xa1dd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x805b=['moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x805b,0x17c));var _0xb805=function(_0x5f5671,_0x4bd986){_0x5f5671=_0x5f5671-0x0;var _0x428f15=_0x805b[_0x5f5671];return _0x428f15;};'use strict';var _=require(_0xb805('0x0'));var util=require(_0xb805('0x1'));var logger=require(_0xb805('0x2'))(_0xb805('0x3'));var moment=require(_0xb805('0x4'));var BPromise=require(_0xb805('0x5'));var rp=require(_0xb805('0x6'));var fs=require('fs');var path=require(_0xb805('0x7'));var rimraf=require('rimraf');var config=require(_0xb805('0x8'));var attributes=require(_0xb805('0x9'));module[_0xb805('0xa')]=function(_0x5c4efb,_0x6319c3){return _0x5c4efb[_0xb805('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index e2b7861..709d33b 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 _0x4122=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countbusyretry','countdropretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','isNil','createdAt','updatedAt','sequelize','transaction','update','phone','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','randomstring','ioredis'];(function(_0x1a5486,_0x26eb12){var _0x432d61=function(_0x2338a1){while(--_0x2338a1){_0x1a5486['push'](_0x1a5486['shift']());}};_0x432d61(++_0x26eb12);}(_0x4122,0x158));var _0x2412=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4122[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2412('0x0'));var util=require(_0x2412('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2412('0x2'));var fs=require('fs');var Redis=require(_0x2412('0x3'));var db=require(_0x2412('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2412('0x5'))('rpc');var config=require(_0x2412('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2412('0x7')][_0x2412('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10f8f0,_0x1efcbc,_0xf160c4){return new BPromise(function(_0x5835af,_0x51dbfa){return client[_0x2412('0x9')](_0x10f8f0,_0xf160c4)['then'](function(_0x244e20){logger[_0x2412('0xa')](_0x2412('0xb'),_0x1efcbc,_0x2412('0xc'));logger[_0x2412('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1efcbc,_0x2412('0xc'),JSON[_0x2412('0xe')](_0x244e20));if(_0x244e20[_0x2412('0xf')]){if(_0x244e20[_0x2412('0xf')][_0x2412('0x10')]===0x1f4){logger[_0x2412('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1efcbc,_0x244e20[_0x2412('0xf')][_0x2412('0x11')]);return _0x51dbfa(_0x244e20[_0x2412('0xf')][_0x2412('0x11')]);}logger[_0x2412('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1efcbc,_0x244e20[_0x2412('0xf')][_0x2412('0x11')]);return _0x5835af(_0x244e20[_0x2412('0xf')][_0x2412('0x11')]);}else{logger['info'](_0x2412('0xb'),_0x1efcbc,_0x2412('0xc'));_0x5835af(_0x244e20[_0x2412('0x12')][_0x2412('0x11')]);}})[_0x2412('0x13')](function(_0x3f0a64){logger[_0x2412('0xf')](_0x2412('0xb'),_0x1efcbc,_0x3f0a64);_0x51dbfa(_0x3f0a64);});});}exports['VerifyAdditionalPhones']=function(_0x2629b2){var _0xae8ba8=this;return new Promise(function(_0x594fa5,_0x4576f7){return db['CmHopper'][_0x2412('0x14')]({'raw':!![],'where':{'ContactId':_0x2629b2[_0x2412('0x15')][_0x2412('0x16')],'ListId':_0x2629b2[_0x2412('0x15')][_0x2412('0x17')],'VoiceQueueId':_0x2629b2[_0x2412('0x15')][_0x2412('0x18')]===undefined?null:_0x2629b2['body'][_0x2412('0x18')],'CampaignId':_0x2629b2['body'][_0x2412('0x19')]===undefined?null:_0x2629b2['body'][_0x2412('0x19')]}})['then'](function(_0x29ff3e){if(_0x29ff3e!=null){return db[_0x2412('0x1a')][_0x2412('0x14')]({'raw':!![],'where':{'CmHopperId':_0x29ff3e['id'],'OrderBy':{'$gt':_0x29ff3e[_0x2412('0x1b')]}},'order':[[_0x2412('0x1b'),_0x2412('0x1c')]]})[_0x2412('0x1d')](function(_0x459f42){var _0x445880=0x0;if(_0x459f42){if(_0x459f42['countbusyretry']+_0x459f42[_0x2412('0x1e')]+_0x459f42[_0x2412('0x1f')]+_0x459f42[_0x2412('0x20')]+_0x459f42['countdropretry']+_0x459f42[_0x2412('0x21')]+_0x459f42[_0x2412('0x22')]+_0x459f42[_0x2412('0x23')]<_0x2629b2[_0x2412('0x24')]['dialGlobalMaxRetry'])_0x445880=0x1;_0x594fa5({'additional':_0x445880});}else{return db['CmHopperAdditionalPhone'][_0x2412('0x14')]({'raw':!![],'where':{'CmHopperId':_0x29ff3e['id']},'order':[[_0x2412('0x1b'),_0x2412('0x1c')]]})[_0x2412('0x1d')](function(_0x205cfb){var _0x4b144f=0x0;if(_0x205cfb){if(_0x205cfb[_0x2412('0x25')]+_0x205cfb[_0x2412('0x1e')]+_0x205cfb[_0x2412('0x1f')]+_0x205cfb[_0x2412('0x20')]+_0x205cfb[_0x2412('0x26')]+_0x205cfb[_0x2412('0x21')]+_0x205cfb['countmachineretry']+_0x205cfb['countagentrejectretry']<_0x2629b2[_0x2412('0x24')][_0x2412('0x27')])_0x4b144f=0x1;_0x594fa5({'additional':_0x4b144f});}else{_0x594fa5({'additional':0x0});}})[_0x2412('0x13')](function(_0x2c0c5f){logger[_0x2412('0xf')](_0x2412('0x28'),_0x2c0c5f[_0x2412('0x11')]);_0x4576f7(_0xae8ba8[_0x2412('0xf')](0x1f4,_0x2c0c5f[_0x2412('0x11')]));});}})['catch'](function(_0x530f99){logger[_0x2412('0xf')](_0x2412('0x28'),_0x530f99[_0x2412('0x11')]);_0x4576f7(_0xae8ba8[_0x2412('0xf')](0x1f4,_0x530f99[_0x2412('0x11')]));});}else _0x594fa5({'additional':0x0});});});};exports[_0x2412('0x29')]=function(_0x4770a8){var _0x28f14=this;return new Promise(function(_0x26365a,_0x77e8dc){return db[_0x2412('0x2a')]['findOne']({'raw':!![],'where':{'ContactId':_0x4770a8['body']['ContactId'],'ListId':_0x4770a8[_0x2412('0x15')][_0x2412('0x17')],'VoiceQueueId':_0x4770a8[_0x2412('0x15')][_0x2412('0x18')]===undefined?null:_0x4770a8['body']['VoiceQueueId'],'CampaignId':_0x4770a8[_0x2412('0x15')][_0x2412('0x19')]===undefined?null:_0x4770a8['body'][_0x2412('0x19')]}})['then'](function(_0x295165){if(_0x295165!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x295165['id'],'OrderBy':{'$gte':_0x295165[_0x2412('0x1b')]}},'order':[[_0x2412('0x1b'),'ASC']]})[_0x2412('0x1d')](function(_0x4a3633){if(_0x4a3633)return activateAdditionalPhone(_0x295165,_0x4770a8[_0x2412('0x15')],_0x4a3633,_0x4770a8[_0x2412('0x2b')],_0x4770a8[_0x2412('0x2c')])[_0x2412('0x1d')](function(_0x29a018){_0x26365a(_0x29a018);});else{return db['CmHopperAdditionalPhone'][_0x2412('0x14')]({'raw':!![],'where':{'CmHopperId':_0x295165['id']},'order':[[_0x2412('0x1b'),_0x2412('0x1c')]]})[_0x2412('0x1d')](function(_0x4b2080){if(_0x4b2080)return activateAdditionalPhone(_0x295165,_0x4770a8[_0x2412('0x15')],_0x4b2080,_0x4770a8[_0x2412('0x2b')],_0x4770a8[_0x2412('0x2c')])['then'](function(_0x426b8f){_0x26365a(_0x426b8f);});else{_0x26365a({'id':_0x295165['id'],'phone':''});}})['catch'](function(_0x22c841){logger['error'](_0x2412('0x28'),_0x22c841['message']);_0x77e8dc(_0x28f14[_0x2412('0xf')](0x1f4,_0x22c841[_0x2412('0x11')]));});}})[_0x2412('0x13')](function(_0x1f1581){logger[_0x2412('0xf')]('VerifyAdditionalPhones',_0x1f1581[_0x2412('0x11')]);_0x77e8dc(_0x28f14[_0x2412('0xf')](0x1f4,_0x1f1581[_0x2412('0x11')]));});}else _0x26365a(0x1);});});};function activateAdditionalPhone(_0x1ddf9d,_0x419cb8,_0x1aad8a,_0x343083,_0x242971){return new Promise(function(_0x22c044,_0x132ff1){var _0x5c3441;if(_['isNil'](_0x1aad8a[_0x2412('0x2d')])){_0x1aad8a[_0x2412('0x2d')]=moment();}if(moment()>moment(_0x1aad8a[_0x2412('0x2d')])){_0x5c3441=moment()[_0x2412('0x2e')](_0x242971||0x3,_0x2412('0x2f'));}else{if(_0x1aad8a['OrderBy']==0x0){_0x5c3441=moment(_0x1aad8a[_0x2412('0x2d')]);}else{_0x5c3441=moment()[_0x2412('0x2e')](_0x242971||0x3,_0x2412('0x2f'));}}if(_[_0x2412('0x30')](_0x5c3441)){_0x5c3441=moment()[_0x2412('0x2e')](_0x242971||0x3,_0x2412('0x2f'));}var _0x557eea={'phone':_0x1ddf9d['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1ddf9d['OrderBy'])?0x0:_0x1ddf9d[_0x2412('0x1b')],'scheduledat':moment()[_0x2412('0x2e')](_0x343083||0x1,_0x2412('0x2f')),'countbusyretry':_0x419cb8[_0x2412('0x25')],'countcongestionretry':_0x419cb8[_0x2412('0x1e')],'countnoanswerretry':_0x419cb8[_0x2412('0x1f')],'countnosuchnumberretry':_0x419cb8[_0x2412('0x20')],'countdropretry':_0x419cb8[_0x2412('0x26')],'countabandonedretry':_0x419cb8['countabandonedretry'],'countmachineretry':_0x419cb8['countmachineretry'],'countagentrejectretry':_0x419cb8[_0x2412('0x23')],'createdAt':_0x419cb8[_0x2412('0x31')],'updatedAt':_0x419cb8[_0x2412('0x32')]};var _0x4d36db={'CmHopperId':_0x1ddf9d['id'],'phone':_0x1aad8a['phone'],'active':0x0,'OrderBy':_[_0x2412('0x30')](_0x1aad8a[_0x2412('0x1b')])?0x0:_0x1aad8a[_0x2412('0x1b')],'scheduledat':_0x5c3441,'countbusyretry':_0x1aad8a[_0x2412('0x25')],'countcongestionretry':_0x1aad8a['countcongestionretry'],'countnoanswerretry':_0x1aad8a[_0x2412('0x1f')],'countnosuchnumberretry':_0x1aad8a[_0x2412('0x20')],'countdropretry':_0x1aad8a[_0x2412('0x26')],'countabandonedretry':_0x1aad8a[_0x2412('0x21')],'countmachineretry':_0x1aad8a[_0x2412('0x22')],'countagentrejectretry':_0x1aad8a[_0x2412('0x23')],'createdAt':_0x1aad8a['createdAt'],'updatedAt':_0x1aad8a['updatedAt']};return db[_0x2412('0x33')][_0x2412('0x34')](function(_0xb51ede){return db[_0x2412('0x1a')][_0x2412('0x35')](_0x557eea,{'where':{'id':_0x1aad8a['id']}},{'transaction':_0xb51ede})[_0x2412('0x1d')](function(){return db[_0x2412('0x2a')][_0x2412('0x35')](_0x4d36db,{'where':{'id':_0x1ddf9d['id']}},{'transaction':_0xb51ede});});})['then'](function(_0x50e1d5){_0x22c044({'id':_0x1ddf9d['id'],'phone':_0x1aad8a[_0x2412('0x36')]});})['catch'](function(_0x139f92){logger[_0x2412('0xf')](_0x2412('0x37'),_0x139f92[_0x2412('0x11')]);_0x132ff1({'error':_0x139f92[_0x2412('0x11')]});});});}exports[_0x2412('0x38')]=function(_0xbe1728){var _0x3d3596=this;return new Promise(function(_0x15744c,_0x2618c9){return db[_0x2412('0x2a')][_0x2412('0x35')](_0xbe1728['body'][_0x2412('0x39')],{'where':{'id':_0xbe1728[_0x2412('0x15')]['id']}})[_0x2412('0x1d')](function(_0x55521b){_0x15744c(_0x55521b);})[_0x2412('0x13')](function(_0x2c550c){logger['error'](_0x2412('0x38'),_0x2c550c[_0x2412('0x11')]);_0x2618c9(_0x3d3596[_0x2412('0xf')](0x1f4,_0x2c550c[_0x2412('0x11')]));});});}; \ No newline at end of file +var _0xc390=['stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','entity','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s'];(function(_0x380ebb,_0x58bffe){var _0x216f70=function(_0xd4c9f3){while(--_0xd4c9f3){_0x380ebb['push'](_0x380ebb['shift']());}};_0x216f70(++_0x58bffe);}(_0xc390,0x9f));var _0x0c39=function(_0x369058,_0x180b2d){_0x369058=_0x369058-0x0;var _0x1a81e4=_0xc390[_0x369058];return _0x1a81e4;};'use strict';var _=require('lodash');var util=require(_0x0c39('0x0'));var moment=require(_0x0c39('0x1'));var BPromise=require(_0x0c39('0x2'));var rs=require(_0x0c39('0x3'));var fs=require('fs');var Redis=require(_0x0c39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c39('0x5'));var logger=require(_0x0c39('0x6'))('rpc');var config=require(_0x0c39('0x7'));var jayson=require(_0x0c39('0x8'));var client=jayson['client'][_0x0c39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36ac32,_0x1c0aff,_0x4ce689){return new BPromise(function(_0x40f62e,_0xeb241a){return client['request'](_0x36ac32,_0x4ce689)['then'](function(_0x28e530){logger[_0x0c39('0xa')](_0x0c39('0xb'),_0x1c0aff,_0x0c39('0xc'));logger[_0x0c39('0xd')](_0x0c39('0xe'),_0x1c0aff,_0x0c39('0xc'),JSON[_0x0c39('0xf')](_0x28e530));if(_0x28e530[_0x0c39('0x10')]){if(_0x28e530[_0x0c39('0x10')][_0x0c39('0x11')]===0x1f4){logger[_0x0c39('0x10')](_0x0c39('0xb'),_0x1c0aff,_0x28e530[_0x0c39('0x10')][_0x0c39('0x12')]);return _0xeb241a(_0x28e530[_0x0c39('0x10')]['message']);}logger[_0x0c39('0x10')](_0x0c39('0xb'),_0x1c0aff,_0x28e530[_0x0c39('0x10')][_0x0c39('0x12')]);return _0x40f62e(_0x28e530[_0x0c39('0x10')][_0x0c39('0x12')]);}else{logger[_0x0c39('0xa')](_0x0c39('0xb'),_0x1c0aff,_0x0c39('0xc'));_0x40f62e(_0x28e530[_0x0c39('0x13')][_0x0c39('0x12')]);}})[_0x0c39('0x14')](function(_0x13bd68){logger['error'](_0x0c39('0xb'),_0x1c0aff,_0x13bd68);_0xeb241a(_0x13bd68);});});}exports[_0x0c39('0x15')]=function(_0x39c8a3){var _0x4ec700=this;return new Promise(function(_0x2f65a3,_0x39e165){return db[_0x0c39('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x39c8a3['body'][_0x0c39('0x17')],'ListId':_0x39c8a3[_0x0c39('0x18')][_0x0c39('0x19')],'VoiceQueueId':_0x39c8a3[_0x0c39('0x18')]['VoiceQueueId']===undefined?null:_0x39c8a3[_0x0c39('0x18')][_0x0c39('0x1a')],'CampaignId':_0x39c8a3[_0x0c39('0x18')]['CampaignId']===undefined?null:_0x39c8a3[_0x0c39('0x18')][_0x0c39('0x1b')]}})[_0x0c39('0x1c')](function(_0x3c0da8){if(_0x3c0da8!=null){return db[_0x0c39('0x1d')][_0x0c39('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x3c0da8['id'],'OrderBy':{'$gt':_0x3c0da8[_0x0c39('0x1f')]}},'order':[[_0x0c39('0x1f'),_0x0c39('0x20')]]})[_0x0c39('0x1c')](function(_0x5eef5e){var _0x1c0d21=0x0;if(_0x5eef5e){if(_0x5eef5e[_0x0c39('0x21')]+_0x5eef5e[_0x0c39('0x22')]+_0x5eef5e[_0x0c39('0x23')]+_0x5eef5e[_0x0c39('0x24')]+_0x5eef5e[_0x0c39('0x25')]+_0x5eef5e[_0x0c39('0x26')]+_0x5eef5e[_0x0c39('0x27')]+_0x5eef5e[_0x0c39('0x28')]<_0x39c8a3['entity'][_0x0c39('0x29')])_0x1c0d21=0x1;_0x2f65a3({'additional':_0x1c0d21});}else{return db[_0x0c39('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3c0da8['id']},'order':[[_0x0c39('0x1f'),'ASC']]})[_0x0c39('0x1c')](function(_0x3484aa){var _0xbc776e=0x0;if(_0x3484aa){if(_0x3484aa[_0x0c39('0x21')]+_0x3484aa['countcongestionretry']+_0x3484aa[_0x0c39('0x23')]+_0x3484aa['countnosuchnumberretry']+_0x3484aa[_0x0c39('0x25')]+_0x3484aa[_0x0c39('0x26')]+_0x3484aa[_0x0c39('0x27')]+_0x3484aa[_0x0c39('0x28')]<_0x39c8a3[_0x0c39('0x2a')]['dialGlobalMaxRetry'])_0xbc776e=0x1;_0x2f65a3({'additional':_0xbc776e});}else{_0x2f65a3({'additional':0x0});}})[_0x0c39('0x14')](function(_0x44c325){logger[_0x0c39('0x10')](_0x0c39('0x15'),_0x44c325['message']);_0x39e165(_0x4ec700['error'](0x1f4,_0x44c325[_0x0c39('0x12')]));});}})[_0x0c39('0x14')](function(_0x354353){logger['error'](_0x0c39('0x15'),_0x354353[_0x0c39('0x12')]);_0x39e165(_0x4ec700['error'](0x1f4,_0x354353[_0x0c39('0x12')]));});}else _0x2f65a3({'additional':0x0});});});};exports[_0x0c39('0x2b')]=function(_0x2cc22d){var _0x433b7c=this;return new Promise(function(_0x1821cd,_0x1419dd){return db[_0x0c39('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x2cc22d[_0x0c39('0x18')][_0x0c39('0x17')],'ListId':_0x2cc22d['body']['ListId'],'VoiceQueueId':_0x2cc22d[_0x0c39('0x18')][_0x0c39('0x1a')]===undefined?null:_0x2cc22d[_0x0c39('0x18')][_0x0c39('0x1a')],'CampaignId':_0x2cc22d[_0x0c39('0x18')][_0x0c39('0x1b')]===undefined?null:_0x2cc22d[_0x0c39('0x18')][_0x0c39('0x1b')]}})[_0x0c39('0x1c')](function(_0x369523){if(_0x369523!=null){return db[_0x0c39('0x1d')][_0x0c39('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x369523['id'],'OrderBy':{'$gte':_0x369523['OrderBy']}},'order':[[_0x0c39('0x1f'),_0x0c39('0x20')]]})[_0x0c39('0x1c')](function(_0x1ff67c){if(_0x1ff67c)return activateAdditionalPhone(_0x369523,_0x2cc22d[_0x0c39('0x18')],_0x1ff67c,_0x2cc22d[_0x0c39('0x2c')],_0x2cc22d[_0x0c39('0x2d')])[_0x0c39('0x1c')](function(_0x240d6e){_0x1821cd(_0x240d6e);});else{return db['CmHopperAdditionalPhone'][_0x0c39('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x369523['id']},'order':[[_0x0c39('0x1f'),_0x0c39('0x20')]]})['then'](function(_0x4383f2){if(_0x4383f2)return activateAdditionalPhone(_0x369523,_0x2cc22d[_0x0c39('0x18')],_0x4383f2,_0x2cc22d[_0x0c39('0x2c')],_0x2cc22d[_0x0c39('0x2d')])['then'](function(_0x38ecf4){_0x1821cd(_0x38ecf4);});else{_0x1821cd({'id':_0x369523['id'],'phone':''});}})[_0x0c39('0x14')](function(_0x278ad4){logger[_0x0c39('0x10')](_0x0c39('0x15'),_0x278ad4[_0x0c39('0x12')]);_0x1419dd(_0x433b7c[_0x0c39('0x10')](0x1f4,_0x278ad4[_0x0c39('0x12')]));});}})[_0x0c39('0x14')](function(_0x59c1af){logger[_0x0c39('0x10')]('VerifyAdditionalPhones',_0x59c1af[_0x0c39('0x12')]);_0x1419dd(_0x433b7c[_0x0c39('0x10')](0x1f4,_0x59c1af[_0x0c39('0x12')]));});}else _0x1821cd(0x1);});});};function activateAdditionalPhone(_0x2467e7,_0x50a59e,_0x144b69,_0x28223f,_0x20184f){return new Promise(function(_0x1c03e8,_0x3f02e2){var _0x4017c8;if(_[_0x0c39('0x2e')](_0x144b69['scheduledat'])){_0x144b69[_0x0c39('0x2f')]=moment();}if(moment()>moment(_0x144b69['scheduledat'])){_0x4017c8=moment()[_0x0c39('0x30')](_0x20184f||0x3,_0x0c39('0x31'));}else{if(_0x144b69[_0x0c39('0x1f')]==0x0){_0x4017c8=moment(_0x144b69['scheduledat']);}else{_0x4017c8=moment()[_0x0c39('0x30')](_0x20184f||0x3,_0x0c39('0x31'));}}if(_[_0x0c39('0x2e')](_0x4017c8)){_0x4017c8=moment()[_0x0c39('0x30')](_0x20184f||0x3,_0x0c39('0x31'));}var _0x188006={'phone':_0x2467e7[_0x0c39('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x2467e7[_0x0c39('0x1f')])?0x0:_0x2467e7[_0x0c39('0x1f')],'scheduledat':moment()['add'](_0x28223f||0x1,_0x0c39('0x31')),'countbusyretry':_0x50a59e['countbusyretry'],'countcongestionretry':_0x50a59e[_0x0c39('0x22')],'countnoanswerretry':_0x50a59e['countnoanswerretry'],'countnosuchnumberretry':_0x50a59e[_0x0c39('0x24')],'countdropretry':_0x50a59e[_0x0c39('0x25')],'countabandonedretry':_0x50a59e[_0x0c39('0x26')],'countmachineretry':_0x50a59e['countmachineretry'],'countagentrejectretry':_0x50a59e[_0x0c39('0x28')],'createdAt':_0x50a59e[_0x0c39('0x33')],'updatedAt':_0x50a59e['updatedAt']};var _0x4ce77b={'CmHopperId':_0x2467e7['id'],'phone':_0x144b69[_0x0c39('0x32')],'active':0x0,'OrderBy':_[_0x0c39('0x2e')](_0x144b69[_0x0c39('0x1f')])?0x0:_0x144b69[_0x0c39('0x1f')],'scheduledat':_0x4017c8,'countbusyretry':_0x144b69[_0x0c39('0x21')],'countcongestionretry':_0x144b69[_0x0c39('0x22')],'countnoanswerretry':_0x144b69[_0x0c39('0x23')],'countnosuchnumberretry':_0x144b69[_0x0c39('0x24')],'countdropretry':_0x144b69[_0x0c39('0x25')],'countabandonedretry':_0x144b69[_0x0c39('0x26')],'countmachineretry':_0x144b69['countmachineretry'],'countagentrejectretry':_0x144b69[_0x0c39('0x28')],'createdAt':_0x144b69[_0x0c39('0x33')],'updatedAt':_0x144b69[_0x0c39('0x34')]};return db[_0x0c39('0x35')][_0x0c39('0x36')](function(_0x4a0a43){return db['CmHopperAdditionalPhone']['update'](_0x188006,{'where':{'id':_0x144b69['id']}},{'transaction':_0x4a0a43})[_0x0c39('0x1c')](function(){return db[_0x0c39('0x16')][_0x0c39('0x37')](_0x4ce77b,{'where':{'id':_0x2467e7['id']}},{'transaction':_0x4a0a43});});})[_0x0c39('0x1c')](function(_0x282b91){_0x1c03e8({'id':_0x2467e7['id'],'phone':_0x144b69['phone']});})['catch'](function(_0x5994e9){logger[_0x0c39('0x10')](_0x0c39('0x38'),_0x5994e9[_0x0c39('0x12')]);_0x3f02e2({'error':_0x5994e9['message']});});});}exports[_0x0c39('0x39')]=function(_0x12cfbc){var _0x457670=this;return new Promise(function(_0x534336,_0x36e534){return db[_0x0c39('0x16')][_0x0c39('0x37')](_0x12cfbc['body']['field'],{'where':{'id':_0x12cfbc[_0x0c39('0x18')]['id']}})[_0x0c39('0x1c')](function(_0x2750bf){_0x534336(_0x2750bf);})[_0x0c39('0x14')](function(_0x32e89e){logger[_0x0c39('0x10')](_0x0c39('0x39'),_0x32e89e[_0x0c39('0x12')]);_0x36e534(_0x457670[_0x0c39('0x10')](0x1f4,_0x32e89e[_0x0c39('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e69aa92..41c6da3 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 _0xea85=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x484a1f,_0x5312ea){var _0xf2f1e1=function(_0x1c36ee){while(--_0x1c36ee){_0x484a1f['push'](_0x484a1f['shift']());}};_0xf2f1e1(++_0x5312ea);}(_0xea85,0x1cd));var _0x5ea8=function(_0x538f13,_0x3518e4){_0x538f13=_0x538f13-0x0;var _0x5b4db2=_0xea85[_0x538f13];return _0x5b4db2;};'use strict';var multer=require(_0x5ea8('0x0'));var util=require('util');var path=require(_0x5ea8('0x1'));var timeout=require(_0x5ea8('0x2'));var express=require(_0x5ea8('0x3'));var router=express[_0x5ea8('0x4')]();var fs_extra=require(_0x5ea8('0x5'));var auth=require(_0x5ea8('0x6'));var interaction=require(_0x5ea8('0x7'));var config=require(_0x5ea8('0x8'));var controller=require(_0x5ea8('0x9'));router[_0x5ea8('0xa')]('/',auth[_0x5ea8('0xb')](),controller[_0x5ea8('0xc')]);router[_0x5ea8('0xa')](_0x5ea8('0xd'),auth[_0x5ea8('0xb')](),controller['show']);router[_0x5ea8('0xe')]('/',auth[_0x5ea8('0xb')](),controller[_0x5ea8('0xf')]);router[_0x5ea8('0x10')]('/:id',auth[_0x5ea8('0xb')](),controller[_0x5ea8('0x11')]);router[_0x5ea8('0x12')](_0x5ea8('0xd'),auth[_0x5ea8('0xb')](),controller[_0x5ea8('0x13')]);module[_0x5ea8('0x14')]=router; \ No newline at end of file +var _0xa6ee=['../../config/environment','get','isAuthenticated','show','create','put','/:id','update','exports','util','path','express','../../components/interaction/service'];(function(_0x515509,_0x22c053){var _0x55fdfb=function(_0x5eb67e){while(--_0x5eb67e){_0x515509['push'](_0x515509['shift']());}};_0x55fdfb(++_0x22c053);}(_0xa6ee,0x1a9));var _0xea6e=function(_0x56b3ad,_0x13cd77){_0x56b3ad=_0x56b3ad-0x0;var _0x2a1033=_0xa6ee[_0x56b3ad];return _0x2a1033;};'use strict';var multer=require('multer');var util=require(_0xea6e('0x0'));var path=require(_0xea6e('0x1'));var timeout=require('connect-timeout');var express=require(_0xea6e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xea6e('0x3'));var config=require(_0xea6e('0x4'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xea6e('0x5')]('/',auth[_0xea6e('0x6')](),controller['index']);router['get']('/:id',auth[_0xea6e('0x6')](),controller[_0xea6e('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0xea6e('0x8')]);router[_0xea6e('0x9')](_0xea6e('0xa'),auth[_0xea6e('0x6')](),controller[_0xea6e('0xb')]);router['delete']('/:id',auth[_0xea6e('0x6')](),controller['destroy']);module[_0xea6e('0xc')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 9ffc21b..13a4be2 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 _0xc903=['moment','exports','contactListQueue'];(function(_0x2f5a33,_0x5d0aa5){var _0x15cfe9=function(_0x34c4b8){while(--_0x34c4b8){_0x2f5a33['push'](_0x2f5a33['shift']());}};_0x15cfe9(++_0x5d0aa5);}(_0xc903,0x177));var _0x3c90=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xc903[_0x4c440b];return _0x2d48cf;};'use strict';var moment=require(_0x3c90('0x0'));var Sequelize=require('sequelize');module[_0x3c90('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x3c90('0x2')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3c90('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x3c90('0x2')}}; \ No newline at end of file +var _0xbdba=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0xbdba,0x107));var _0xabdb=function(_0x2d0a3a,_0x3b837a){_0x2d0a3a=_0x2d0a3a-0x0;var _0x27bcc0=_0xbdba[_0x2d0a3a];return _0x27bcc0;};'use strict';var moment=require(_0xabdb('0x0'));var Sequelize=require('sequelize');module[_0xabdb('0x1')]={'phone':{'type':Sequelize[_0xabdb('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xabdb('0x3')],'unique':_0xabdb('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xabdb('0x4')},'VoiceQueueId':{'type':Sequelize[_0xabdb('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7afddac..b831508 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 _0x8ad6=['sort','pick','where','VIRTUAL','merge','options','CmHopperBlack','includeAll','include','findAll','rows','show','params','keys','length','find','body','catch','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x5db82f,_0x1d9186){var _0x27d541=function(_0x2ebce4){while(--_0x2ebce4){_0x5db82f['push'](_0x5db82f['shift']());}};_0x27d541(++_0x1d9186);}(_0x8ad6,0xfd));var _0x68ad=function(_0x5f45f8,_0x67710f){_0x5f45f8=_0x5f45f8-0x0;var _0x4910ed=_0x8ad6[_0x5f45f8];return _0x4910ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68ad('0x0'));var zipdir=require(_0x68ad('0x1'));var jsonpatch=require(_0x68ad('0x2'));var rp=require('request-promise');var moment=require(_0x68ad('0x3'));var BPromise=require(_0x68ad('0x4'));var Mustache=require(_0x68ad('0x5'));var util=require(_0x68ad('0x6'));var path=require(_0x68ad('0x7'));var sox=require(_0x68ad('0x8'));var csv=require(_0x68ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68ad('0xa'));var _=require(_0x68ad('0xb'));var squel=require(_0x68ad('0xc'));var crypto=require(_0x68ad('0xd'));var jsforce=require(_0x68ad('0xe'));var deskjs=require(_0x68ad('0xf'));var toCsv=require(_0x68ad('0x9'));var querystring=require(_0x68ad('0x10'));var Papa=require('papaparse');var Redis=require(_0x68ad('0x11'));var authService=require(_0x68ad('0x12'));var qs=require(_0x68ad('0x13'));var as=require(_0x68ad('0x14'));var hardwareService=require(_0x68ad('0x15'));var logger=require(_0x68ad('0x16'))(_0x68ad('0x17'));var utils=require(_0x68ad('0x18'));var config=require(_0x68ad('0x19'));var licenseUtil=require(_0x68ad('0x1a'));var db=require(_0x68ad('0x1b'))['db'];function respondWithStatusCode(_0x2874e7,_0x1d019e){_0x1d019e=_0x1d019e||0xcc;return function(_0x1690e4){if(_0x1690e4){return _0x2874e7['sendStatus'](_0x1d019e);}return _0x2874e7[_0x68ad('0x1c')](_0x1d019e)['end']();};}function respondWithResult(_0x40b97d,_0x45babc){_0x45babc=_0x45babc||0xc8;return function(_0x31bed4){if(_0x31bed4){return _0x40b97d[_0x68ad('0x1c')](_0x45babc)[_0x68ad('0x1d')](_0x31bed4);}};}function respondWithFilteredResult(_0x16bc56,_0xfed0da){return function(_0x172b52){if(_0x172b52){var _0x2bdf67=typeof _0xfed0da[_0x68ad('0x1e')]==='undefined'&&typeof _0xfed0da['limit']===_0x68ad('0x1f');var _0x59942e=_0x172b52[_0x68ad('0x20')];var _0x48cf0f=_0x2bdf67?0x0:_0xfed0da[_0x68ad('0x1e')];var _0x288a8d=_0x2bdf67?_0x172b52[_0x68ad('0x20')]:_0xfed0da[_0x68ad('0x1e')]+_0xfed0da[_0x68ad('0x21')];var _0x2ab285;if(_0x288a8d>=_0x59942e){_0x288a8d=_0x59942e;_0x2ab285=0xc8;}else{_0x2ab285=0xce;}_0x16bc56[_0x68ad('0x1c')](_0x2ab285);return _0x16bc56[_0x68ad('0x22')](_0x68ad('0x23'),_0x48cf0f+'-'+_0x288a8d+'/'+_0x59942e)[_0x68ad('0x1d')](_0x172b52);}return null;};}function patchUpdates(_0x285a78){return function(_0x408951){try{jsonpatch['apply'](_0x408951,_0x285a78,!![]);}catch(_0x90a629){return BPromise[_0x68ad('0x24')](_0x90a629);}return _0x408951[_0x68ad('0x25')]();};}function saveUpdates(_0xe2e946,_0x571618){return function(_0x307d28){if(_0x307d28){return _0x307d28[_0x68ad('0x26')](_0xe2e946)[_0x68ad('0x27')](function(_0x50b30f){return _0x50b30f;});}return null;};}function removeEntity(_0x3904de,_0x5cf841){return function(_0x51ad0d){if(_0x51ad0d){return _0x51ad0d['destroy']()[_0x68ad('0x27')](function(){_0x3904de['status'](0xcc)[_0x68ad('0x28')]();});}};}function handleEntityNotFound(_0x14cc21,_0x35bd51){return function(_0x528a2b){if(!_0x528a2b){_0x14cc21['sendStatus'](0x194);}return _0x528a2b;};}function handleError(_0x3f62a1,_0x52027a){_0x52027a=_0x52027a||0x1f4;return function(_0x2a17be){logger[_0x68ad('0x29')](_0x2a17be[_0x68ad('0x2a')]);if(_0x2a17be[_0x68ad('0x2b')]){delete _0x2a17be[_0x68ad('0x2b')];}_0x3f62a1[_0x68ad('0x1c')](_0x52027a)['send'](_0x2a17be);};}exports[_0x68ad('0x2c')]=function(_0x33ac8d,_0x2d53a0){var _0x19b64a={},_0x49f6f5={},_0x3e760a={'count':0x0,'rows':[]};var _0x189511=_[_0x68ad('0x2d')](db['CmHopperBlack'][_0x68ad('0x2e')],function(_0x332d8b){return{'name':_0x332d8b[_0x68ad('0x2f')],'type':_0x332d8b[_0x68ad('0x30')][_0x68ad('0x31')]};});_0x49f6f5['model']=_['map'](_0x189511,_0x68ad('0x2b'));_0x49f6f5[_0x68ad('0x32')]=_['keys'](_0x33ac8d[_0x68ad('0x32')]);_0x49f6f5[_0x68ad('0x33')]=_['intersection'](_0x49f6f5[_0x68ad('0x34')],_0x49f6f5[_0x68ad('0x32')]);_0x19b64a['attributes']=_[_0x68ad('0x35')](_0x49f6f5['model'],qs[_0x68ad('0x36')](_0x33ac8d['query'][_0x68ad('0x36')]));_0x19b64a['attributes']=_0x19b64a[_0x68ad('0x37')]['length']?_0x19b64a['attributes']:_0x49f6f5[_0x68ad('0x34')];if(!_0x33ac8d[_0x68ad('0x32')][_0x68ad('0x38')](_0x68ad('0x39'))){_0x19b64a[_0x68ad('0x21')]=qs['limit'](_0x33ac8d[_0x68ad('0x32')]['limit']);_0x19b64a['offset']=qs[_0x68ad('0x1e')](_0x33ac8d[_0x68ad('0x32')][_0x68ad('0x1e')]);}_0x19b64a[_0x68ad('0x3a')]=qs[_0x68ad('0x3b')](_0x33ac8d[_0x68ad('0x32')][_0x68ad('0x3b')]);_0x19b64a['where']=qs[_0x68ad('0x33')](_[_0x68ad('0x3c')](_0x33ac8d['query'],_0x49f6f5['filters']),_0x189511);if(_0x33ac8d[_0x68ad('0x32')]['filter']){_0x19b64a[_0x68ad('0x3d')]=_['merge'](_0x19b64a[_0x68ad('0x3d')],{'$or':_[_0x68ad('0x2d')](_0x189511,function(_0x253f87){if(_0x253f87[_0x68ad('0x30')]!==_0x68ad('0x3e')){var _0x1b0d7b={};_0x1b0d7b[_0x253f87[_0x68ad('0x2b')]]={'$like':'%'+_0x33ac8d[_0x68ad('0x32')]['filter']+'%'};return _0x1b0d7b;}})});}_0x19b64a=_[_0x68ad('0x3f')]({},_0x19b64a,_0x33ac8d[_0x68ad('0x40')]);var _0x3ef551={'where':_0x19b64a[_0x68ad('0x3d')]};return db[_0x68ad('0x41')][_0x68ad('0x20')](_0x3ef551)['then'](function(_0xee45d){_0x3e760a[_0x68ad('0x20')]=_0xee45d;if(_0x33ac8d[_0x68ad('0x32')][_0x68ad('0x42')]){_0x19b64a[_0x68ad('0x43')]=[{'all':!![]}];}return db[_0x68ad('0x41')][_0x68ad('0x44')](_0x19b64a);})[_0x68ad('0x27')](function(_0x3d2e40){_0x3e760a[_0x68ad('0x45')]=_0x3d2e40;return _0x3e760a;})[_0x68ad('0x27')](respondWithFilteredResult(_0x2d53a0,_0x19b64a))['catch'](handleError(_0x2d53a0,null));};exports[_0x68ad('0x46')]=function(_0x366725,_0x1dd2ae){var _0x3ceb47={'raw':!![],'where':{'id':_0x366725[_0x68ad('0x47')]['id']}},_0xe4a9ef={};_0xe4a9ef[_0x68ad('0x34')]=_[_0x68ad('0x48')](db[_0x68ad('0x41')][_0x68ad('0x2e')]);_0xe4a9ef[_0x68ad('0x32')]=_['keys'](_0x366725[_0x68ad('0x32')]);_0xe4a9ef['filters']=_[_0x68ad('0x35')](_0xe4a9ef['model'],_0xe4a9ef[_0x68ad('0x32')]);_0x3ceb47[_0x68ad('0x37')]=_[_0x68ad('0x35')](_0xe4a9ef['model'],qs[_0x68ad('0x36')](_0x366725[_0x68ad('0x32')][_0x68ad('0x36')]));_0x3ceb47['attributes']=_0x3ceb47[_0x68ad('0x37')][_0x68ad('0x49')]?_0x3ceb47[_0x68ad('0x37')]:_0xe4a9ef[_0x68ad('0x34')];if(_0x366725['query'][_0x68ad('0x42')]){_0x3ceb47['include']=[{'all':!![]}];}_0x3ceb47=_[_0x68ad('0x3f')]({},_0x3ceb47,_0x366725['options']);return db[_0x68ad('0x41')][_0x68ad('0x4a')](_0x3ceb47)[_0x68ad('0x27')](handleEntityNotFound(_0x1dd2ae,null))[_0x68ad('0x27')](respondWithResult(_0x1dd2ae,null))['catch'](handleError(_0x1dd2ae,null));};exports[_0x68ad('0x26')]=function(_0x3490f4,_0x4379ee){if(_0x3490f4[_0x68ad('0x4b')]['id']){delete _0x3490f4[_0x68ad('0x4b')]['id'];}return db[_0x68ad('0x41')][_0x68ad('0x4a')]({'where':{'id':_0x3490f4['params']['id']}})['then'](handleEntityNotFound(_0x4379ee,null))[_0x68ad('0x27')](saveUpdates(_0x3490f4[_0x68ad('0x4b')],null))[_0x68ad('0x27')](respondWithResult(_0x4379ee,null))['catch'](handleError(_0x4379ee,null));};exports['destroy']=function(_0x5ef40e,_0x5e65c7){return db['CmHopperBlack'][_0x68ad('0x4a')]({'where':{'id':_0x5ef40e['params']['id']}})[_0x68ad('0x27')](handleEntityNotFound(_0x5e65c7,null))[_0x68ad('0x27')](removeEntity(_0x5e65c7,null))[_0x68ad('0x4c')](handleError(_0x5e65c7,null));};exports['describe']=function(_0x49c26c,_0x11799c){return db[_0x68ad('0x41')][_0x68ad('0x4d')]()['then'](respondWithResult(_0x11799c,null))[_0x68ad('0x4c')](handleError(_0x11799c,null));}; \ No newline at end of file +var _0xbf10=['moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','update','destroy','then','error','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x96910a,_0x2b7d8c){var _0x3aabd1=function(_0x2c05f3){while(--_0x2c05f3){_0x96910a['push'](_0x96910a['shift']());}};_0x3aabd1(++_0x2b7d8c);}(_0xbf10,0x114));var _0x0bf1=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xbf10[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0x0bf1('0x0'));var rimraf=require(_0x0bf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bf1('0x2'));var rp=require(_0x0bf1('0x3'));var moment=require(_0x0bf1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0bf1('0x5'));var util=require(_0x0bf1('0x6'));var path=require(_0x0bf1('0x7'));var sox=require('sox');var csv=require(_0x0bf1('0x8'));var ejs=require(_0x0bf1('0x9'));var fs=require('fs');var fs_extra=require(_0x0bf1('0xa'));var _=require('lodash');var squel=require(_0x0bf1('0xb'));var crypto=require(_0x0bf1('0xc'));var jsforce=require(_0x0bf1('0xd'));var deskjs=require(_0x0bf1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0bf1('0xf'));var Papa=require(_0x0bf1('0x10'));var Redis=require('ioredis');var authService=require(_0x0bf1('0x11'));var qs=require(_0x0bf1('0x12'));var as=require(_0x0bf1('0x13'));var hardwareService=require(_0x0bf1('0x14'));var logger=require(_0x0bf1('0x15'))('api');var utils=require(_0x0bf1('0x16'));var config=require(_0x0bf1('0x17'));var licenseUtil=require(_0x0bf1('0x18'));var db=require(_0x0bf1('0x19'))['db'];function respondWithStatusCode(_0x3c9fc0,_0x20996b){_0x20996b=_0x20996b||0xcc;return function(_0x46bbc0){if(_0x46bbc0){return _0x3c9fc0['sendStatus'](_0x20996b);}return _0x3c9fc0[_0x0bf1('0x1a')](_0x20996b)[_0x0bf1('0x1b')]();};}function respondWithResult(_0x574a0e,_0x21d366){_0x21d366=_0x21d366||0xc8;return function(_0x5eef49){if(_0x5eef49){return _0x574a0e[_0x0bf1('0x1a')](_0x21d366)[_0x0bf1('0x1c')](_0x5eef49);}};}function respondWithFilteredResult(_0xcbcdf3,_0x2d2ac4){return function(_0x36fa3c){if(_0x36fa3c){var _0x3d5678=typeof _0x2d2ac4[_0x0bf1('0x1d')]===_0x0bf1('0x1e')&&typeof _0x2d2ac4[_0x0bf1('0x1f')]===_0x0bf1('0x1e');var _0x9097d6=_0x36fa3c['count'];var _0x2d0295=_0x3d5678?0x0:_0x2d2ac4[_0x0bf1('0x1d')];var _0x2cff62=_0x3d5678?_0x36fa3c[_0x0bf1('0x20')]:_0x2d2ac4[_0x0bf1('0x1d')]+_0x2d2ac4[_0x0bf1('0x1f')];var _0x347df0;if(_0x2cff62>=_0x9097d6){_0x2cff62=_0x9097d6;_0x347df0=0xc8;}else{_0x347df0=0xce;}_0xcbcdf3[_0x0bf1('0x1a')](_0x347df0);return _0xcbcdf3['set']('Content-Range',_0x2d0295+'-'+_0x2cff62+'/'+_0x9097d6)['json'](_0x36fa3c);}return null;};}function patchUpdates(_0x195301){return function(_0x3e0ad9){try{jsonpatch[_0x0bf1('0x21')](_0x3e0ad9,_0x195301,!![]);}catch(_0x509858){return BPromise['reject'](_0x509858);}return _0x3e0ad9['save']();};}function saveUpdates(_0x14724f,_0x121f04){return function(_0x339d74){if(_0x339d74){return _0x339d74[_0x0bf1('0x22')](_0x14724f)['then'](function(_0x21c7c1){return _0x21c7c1;});}return null;};}function removeEntity(_0x16324c,_0x35bb82){return function(_0x2d1159){if(_0x2d1159){return _0x2d1159[_0x0bf1('0x23')]()[_0x0bf1('0x24')](function(){_0x16324c['status'](0xcc)[_0x0bf1('0x1b')]();});}};}function handleEntityNotFound(_0x16d1ec,_0x13d074){return function(_0x1c1a07){if(!_0x1c1a07){_0x16d1ec['sendStatus'](0x194);}return _0x1c1a07;};}function handleError(_0x29b1e4,_0x4f5b4f){_0x4f5b4f=_0x4f5b4f||0x1f4;return function(_0x1aa393){logger[_0x0bf1('0x25')](_0x1aa393['stack']);if(_0x1aa393[_0x0bf1('0x26')]){delete _0x1aa393[_0x0bf1('0x26')];}_0x29b1e4[_0x0bf1('0x1a')](_0x4f5b4f)[_0x0bf1('0x27')](_0x1aa393);};}exports[_0x0bf1('0x28')]=function(_0x4c41ed,_0x281d77){var _0x2f1e74={},_0x1d7b03={},_0x4a7730={'count':0x0,'rows':[]};var _0x3e3d8c=_[_0x0bf1('0x29')](db[_0x0bf1('0x2a')][_0x0bf1('0x2b')],function(_0x455686){return{'name':_0x455686['fieldName'],'type':_0x455686[_0x0bf1('0x2c')][_0x0bf1('0x2d')]};});_0x1d7b03[_0x0bf1('0x2e')]=_[_0x0bf1('0x29')](_0x3e3d8c,_0x0bf1('0x26'));_0x1d7b03[_0x0bf1('0x2f')]=_[_0x0bf1('0x30')](_0x4c41ed[_0x0bf1('0x2f')]);_0x1d7b03[_0x0bf1('0x31')]=_[_0x0bf1('0x32')](_0x1d7b03[_0x0bf1('0x2e')],_0x1d7b03[_0x0bf1('0x2f')]);_0x2f1e74[_0x0bf1('0x33')]=_[_0x0bf1('0x32')](_0x1d7b03[_0x0bf1('0x2e')],qs['fields'](_0x4c41ed[_0x0bf1('0x2f')][_0x0bf1('0x34')]));_0x2f1e74[_0x0bf1('0x33')]=_0x2f1e74['attributes']['length']?_0x2f1e74[_0x0bf1('0x33')]:_0x1d7b03['model'];if(!_0x4c41ed[_0x0bf1('0x2f')]['hasOwnProperty'](_0x0bf1('0x35'))){_0x2f1e74['limit']=qs[_0x0bf1('0x1f')](_0x4c41ed[_0x0bf1('0x2f')]['limit']);_0x2f1e74['offset']=qs[_0x0bf1('0x1d')](_0x4c41ed[_0x0bf1('0x2f')][_0x0bf1('0x1d')]);}_0x2f1e74[_0x0bf1('0x36')]=qs[_0x0bf1('0x37')](_0x4c41ed[_0x0bf1('0x2f')]['sort']);_0x2f1e74[_0x0bf1('0x38')]=qs[_0x0bf1('0x31')](_['pick'](_0x4c41ed['query'],_0x1d7b03[_0x0bf1('0x31')]),_0x3e3d8c);if(_0x4c41ed[_0x0bf1('0x2f')]['filter']){_0x2f1e74['where']=_[_0x0bf1('0x39')](_0x2f1e74[_0x0bf1('0x38')],{'$or':_[_0x0bf1('0x29')](_0x3e3d8c,function(_0x52f262){if(_0x52f262[_0x0bf1('0x2c')]!=='VIRTUAL'){var _0x2982f3={};_0x2982f3[_0x52f262['name']]={'$like':'%'+_0x4c41ed[_0x0bf1('0x2f')][_0x0bf1('0x3a')]+'%'};return _0x2982f3;}})});}_0x2f1e74=_['merge']({},_0x2f1e74,_0x4c41ed[_0x0bf1('0x3b')]);var _0x210e3e={'where':_0x2f1e74['where']};return db[_0x0bf1('0x2a')]['count'](_0x210e3e)[_0x0bf1('0x24')](function(_0x24263a){_0x4a7730[_0x0bf1('0x20')]=_0x24263a;if(_0x4c41ed['query'][_0x0bf1('0x3c')]){_0x2f1e74[_0x0bf1('0x3d')]=[{'all':!![]}];}return db[_0x0bf1('0x2a')][_0x0bf1('0x3e')](_0x2f1e74);})[_0x0bf1('0x24')](function(_0x38636b){_0x4a7730[_0x0bf1('0x3f')]=_0x38636b;return _0x4a7730;})[_0x0bf1('0x24')](respondWithFilteredResult(_0x281d77,_0x2f1e74))[_0x0bf1('0x40')](handleError(_0x281d77,null));};exports[_0x0bf1('0x41')]=function(_0x1b3046,_0x2899f6){var _0x13d3b2={'raw':!![],'where':{'id':_0x1b3046[_0x0bf1('0x42')]['id']}},_0x253b2a={};_0x253b2a['model']=_[_0x0bf1('0x30')](db['CmHopperBlack']['rawAttributes']);_0x253b2a['query']=_['keys'](_0x1b3046[_0x0bf1('0x2f')]);_0x253b2a[_0x0bf1('0x31')]=_['intersection'](_0x253b2a[_0x0bf1('0x2e')],_0x253b2a[_0x0bf1('0x2f')]);_0x13d3b2[_0x0bf1('0x33')]=_[_0x0bf1('0x32')](_0x253b2a['model'],qs[_0x0bf1('0x34')](_0x1b3046[_0x0bf1('0x2f')][_0x0bf1('0x34')]));_0x13d3b2[_0x0bf1('0x33')]=_0x13d3b2['attributes']['length']?_0x13d3b2[_0x0bf1('0x33')]:_0x253b2a[_0x0bf1('0x2e')];if(_0x1b3046[_0x0bf1('0x2f')][_0x0bf1('0x3c')]){_0x13d3b2[_0x0bf1('0x3d')]=[{'all':!![]}];}_0x13d3b2=_[_0x0bf1('0x39')]({},_0x13d3b2,_0x1b3046[_0x0bf1('0x3b')]);return db[_0x0bf1('0x2a')][_0x0bf1('0x43')](_0x13d3b2)[_0x0bf1('0x24')](handleEntityNotFound(_0x2899f6,null))[_0x0bf1('0x24')](respondWithResult(_0x2899f6,null))[_0x0bf1('0x40')](handleError(_0x2899f6,null));};exports[_0x0bf1('0x22')]=function(_0x4ff898,_0x4831e2){if(_0x4ff898[_0x0bf1('0x44')]['id']){delete _0x4ff898[_0x0bf1('0x44')]['id'];}return db[_0x0bf1('0x2a')][_0x0bf1('0x43')]({'where':{'id':_0x4ff898['params']['id']}})[_0x0bf1('0x24')](handleEntityNotFound(_0x4831e2,null))[_0x0bf1('0x24')](saveUpdates(_0x4ff898['body'],null))[_0x0bf1('0x24')](respondWithResult(_0x4831e2,null))[_0x0bf1('0x40')](handleError(_0x4831e2,null));};exports[_0x0bf1('0x23')]=function(_0x2160fe,_0x36fb30){return db[_0x0bf1('0x2a')][_0x0bf1('0x43')]({'where':{'id':_0x2160fe[_0x0bf1('0x42')]['id']}})['then'](handleEntityNotFound(_0x36fb30,null))[_0x0bf1('0x24')](removeEntity(_0x36fb30,null))['catch'](handleError(_0x36fb30,null));};exports[_0x0bf1('0x45')]=function(_0x574c13,_0x58fbd2){return db[_0x0bf1('0x2a')]['describe']()[_0x0bf1('0x24')](respondWithResult(_0x58fbd2,null))[_0x0bf1('0x40')](handleError(_0x58fbd2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 129d579..bb6cfe5 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 _0x3a1e=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x314b37,_0x1c6986){var _0x17fd1b=function(_0x34e0b0){while(--_0x34e0b0){_0x314b37['push'](_0x314b37['shift']());}};_0x17fd1b(++_0x1c6986);}(_0x3a1e,0x1d8));var _0xe3a1=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0x3a1e[_0xe0b81f];return _0x290e5e;};'use strict';var _=require(_0xe3a1('0x0'));var util=require('util');var logger=require(_0xe3a1('0x1'))(_0xe3a1('0x2'));var moment=require(_0xe3a1('0x3'));var BPromise=require('bluebird');var rp=require(_0xe3a1('0x4'));var fs=require('fs');var path=require(_0xe3a1('0x5'));var rimraf=require(_0xe3a1('0x6'));var config=require(_0xe3a1('0x7'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xad3fb4,_0x1d2f2d){return _0xad3fb4[_0xe3a1('0x8')](_0xe3a1('0x9'),attributes,{'tableName':_0xe3a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d2b=['cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path','./cmHopperBlack.attributes','exports','CmHopperBlack'];(function(_0xbb9cb0,_0x4c1858){var _0x5cfd58=function(_0x28b75c){while(--_0x28b75c){_0xbb9cb0['push'](_0xbb9cb0['shift']());}};_0x5cfd58(++_0x4c1858);}(_0x1d2b,0xa6));var _0xb1d2=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x1d2b[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xb1d2('0x0'));var util=require(_0xb1d2('0x1'));var logger=require(_0xb1d2('0x2'))(_0xb1d2('0x3'));var moment=require(_0xb1d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xb1d2('0x5'));var fs=require('fs');var path=require(_0xb1d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb1d2('0x7'));module[_0xb1d2('0x8')]=function(_0xcd510c,_0xb67747){return _0xcd510c['define'](_0xb1d2('0x9'),attributes,{'tableName':_0xb1d2('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 56f16d3..0cb3e48 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 _0x4fe9=['CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','catch','UpdateCmHopperBlack','body','raw','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x4fe9,0x161));var _0x94fe=function(_0x447170,_0x587db3){_0x447170=_0x447170-0x0;var _0x17553f=_0x4fe9[_0x447170];return _0x17553f;};'use strict';var _=require(_0x94fe('0x0'));var util=require(_0x94fe('0x1'));var moment=require(_0x94fe('0x2'));var BPromise=require(_0x94fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94fe('0x4'));var db=require(_0x94fe('0x5'))['db'];var utils=require(_0x94fe('0x6'));var logger=require(_0x94fe('0x7'))(_0x94fe('0x8'));var config=require(_0x94fe('0x9'));var jayson=require(_0x94fe('0xa'));var client=jayson[_0x94fe('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cb7fd,_0x9118d1,_0x1ebd4d){return new BPromise(function(_0x3058c1,_0x8ab4a4){return client[_0x94fe('0xc')](_0x3cb7fd,_0x1ebd4d)[_0x94fe('0xd')](function(_0x42469e){logger[_0x94fe('0xe')](_0x94fe('0xf'),_0x9118d1,'request\x20sent');logger[_0x94fe('0x10')](_0x94fe('0x11'),_0x9118d1,_0x94fe('0x12'),JSON[_0x94fe('0x13')](_0x42469e));if(_0x42469e['error']){if(_0x42469e[_0x94fe('0x14')][_0x94fe('0x15')]===0x1f4){logger['error'](_0x94fe('0xf'),_0x9118d1,_0x42469e[_0x94fe('0x14')][_0x94fe('0x16')]);return _0x8ab4a4(_0x42469e[_0x94fe('0x14')][_0x94fe('0x16')]);}logger['error'](_0x94fe('0xf'),_0x9118d1,_0x42469e['error'][_0x94fe('0x16')]);return _0x3058c1(_0x42469e[_0x94fe('0x14')]['message']);}else{logger[_0x94fe('0xe')](_0x94fe('0xf'),_0x9118d1,_0x94fe('0x12'));_0x3058c1(_0x42469e[_0x94fe('0x17')][_0x94fe('0x16')]);}})['catch'](function(_0x3b93ee){logger[_0x94fe('0x14')](_0x94fe('0xf'),_0x9118d1,_0x3b93ee);_0x8ab4a4(_0x3b93ee);});});}exports[_0x94fe('0x18')]=function(_0x52a5c4){var _0xa83b5b=this;return new Promise(function(_0x3271b6,_0x1dc492){return db[_0x94fe('0x19')]['findAll']({'raw':_0x52a5c4['options']?_0x52a5c4[_0x94fe('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x52a5c4[_0x94fe('0x1a')]?_0x52a5c4['options'][_0x94fe('0x1b')]||null:null,'attributes':_0x52a5c4['options']?_0x52a5c4[_0x94fe('0x1a')][_0x94fe('0x1c')]||null:null,'limit':_0x52a5c4[_0x94fe('0x1a')]?_0x52a5c4['options'][_0x94fe('0x1d')]||null:null,'include':_0x52a5c4['options']?_0x52a5c4[_0x94fe('0x1a')][_0x94fe('0x1e')]?_[_0x94fe('0x1f')](_0x52a5c4[_0x94fe('0x1a')][_0x94fe('0x1e')],function(_0xdb51e6){return{'model':db[_0xdb51e6['model']],'as':_0xdb51e6['as'],'attributes':_0xdb51e6['attributes'],'include':_0xdb51e6[_0x94fe('0x1e')]?_['map'](_0xdb51e6[_0x94fe('0x1e')],function(_0x106aa3){return{'model':db[_0x106aa3['model']],'as':_0x106aa3['as'],'attributes':_0x106aa3[_0x94fe('0x1c')],'include':_0x106aa3[_0x94fe('0x1e')]?_[_0x94fe('0x1f')](_0x106aa3[_0x94fe('0x1e')],function(_0x6e516b){return{'model':db[_0x6e516b['model']],'as':_0x6e516b['as'],'attributes':_0x6e516b[_0x94fe('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x94fe('0xd')](function(_0x4b256b){logger[_0x94fe('0xe')](_0x94fe('0x18'),_0x52a5c4);logger[_0x94fe('0x10')](_0x94fe('0x18'),_0x52a5c4,JSON[_0x94fe('0x13')](_0x4b256b));_0x3271b6(_0x4b256b);})[_0x94fe('0x20')](function(_0x4f50fa){logger[_0x94fe('0x14')](_0x94fe('0x18'),_0x4f50fa[_0x94fe('0x16')],_0x52a5c4);_0x1dc492(_0xa83b5b['error'](0x1f4,_0x4f50fa[_0x94fe('0x16')]));});});};exports[_0x94fe('0x21')]=function(_0x30975e){var _0x18bee5=this;return new Promise(function(_0x5f5bad,_0x1514e2){return db[_0x94fe('0x19')]['update'](_0x30975e[_0x94fe('0x22')],{'raw':_0x30975e[_0x94fe('0x1a')]?_0x30975e['options'][_0x94fe('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30975e[_0x94fe('0x1a')]?_0x30975e['options'][_0x94fe('0x1b')]||null:null,'attributes':_0x30975e[_0x94fe('0x1a')]?_0x30975e[_0x94fe('0x1a')][_0x94fe('0x1c')]||null:null,'limit':_0x30975e[_0x94fe('0x1a')]?_0x30975e['options'][_0x94fe('0x1d')]||null:null})['then'](function(_0x463123){logger[_0x94fe('0xe')]('UpdateCmHopperBlack',_0x30975e);logger['debug']('UpdateCmHopperBlack',_0x30975e,JSON[_0x94fe('0x13')](_0x463123));_0x5f5bad(_0x463123);})[_0x94fe('0x20')](function(_0x5850c2){logger[_0x94fe('0x14')](_0x94fe('0x21'),_0x5850c2[_0x94fe('0x16')],_0x30975e);_0x1514e2(_0x18bee5['error'](0x1f4,_0x5850c2[_0x94fe('0x16')]));});});};exports['DestroyCmHopperBlack']=function(_0x4b72cf){var _0x4242a3=this;return new Promise(function(_0x23f61c,_0x204e6d){return db[_0x94fe('0x19')]['destroy']({'where':_0x4b72cf[_0x94fe('0x1a')]?_0x4b72cf[_0x94fe('0x1a')][_0x94fe('0x1b')]||null:null})[_0x94fe('0xd')](function(_0x2cf377){logger[_0x94fe('0xe')](_0x94fe('0x24'),_0x4b72cf);logger[_0x94fe('0x10')](_0x94fe('0x24'),_0x4b72cf,JSON[_0x94fe('0x13')](_0x2cf377));_0x23f61c(_0x2cf377);})[_0x94fe('0x20')](function(_0x5e1f9d){logger[_0x94fe('0x14')]('DestroyCmHopperBlack',_0x5e1f9d[_0x94fe('0x16')],_0x4b72cf);_0x204e6d(_0x4242a3[_0x94fe('0x14')](0x1f4,_0x5e1f9d[_0x94fe('0x16')]));});});}; \ No newline at end of file +var _0x388b=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','map','include','model','debug','UpdateCmHopperBlack','raw','DestroyCmHopperBlack','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4c2f17,_0x5c6821){var _0x20919e=function(_0x31eef7){while(--_0x31eef7){_0x4c2f17['push'](_0x4c2f17['shift']());}};_0x20919e(++_0x5c6821);}(_0x388b,0x136));var _0xb388=function(_0x39daba,_0x5edc8d){_0x39daba=_0x39daba-0x0;var _0x34d4ff=_0x388b[_0x39daba];return _0x34d4ff;};'use strict';var _=require(_0xb388('0x0'));var util=require('util');var moment=require(_0xb388('0x1'));var BPromise=require(_0xb388('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb388('0x3'));var db=require(_0xb388('0x4'))['db'];var utils=require(_0xb388('0x5'));var logger=require(_0xb388('0x6'))(_0xb388('0x7'));var config=require(_0xb388('0x8'));var jayson=require(_0xb388('0x9'));var client=jayson[_0xb388('0xa')][_0xb388('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a31f,_0x14f0b2,_0x1f213a){return new BPromise(function(_0x73e096,_0x322adb){return client[_0xb388('0xc')](_0x13a31f,_0x1f213a)[_0xb388('0xd')](function(_0x280c54){logger[_0xb388('0xe')](_0xb388('0xf'),_0x14f0b2,_0xb388('0x10'));logger['debug'](_0xb388('0x11'),_0x14f0b2,_0xb388('0x10'),JSON[_0xb388('0x12')](_0x280c54));if(_0x280c54[_0xb388('0x13')]){if(_0x280c54[_0xb388('0x13')][_0xb388('0x14')]===0x1f4){logger[_0xb388('0x13')](_0xb388('0xf'),_0x14f0b2,_0x280c54[_0xb388('0x13')][_0xb388('0x15')]);return _0x322adb(_0x280c54['error']['message']);}logger[_0xb388('0x13')](_0xb388('0xf'),_0x14f0b2,_0x280c54[_0xb388('0x13')][_0xb388('0x15')]);return _0x73e096(_0x280c54[_0xb388('0x13')]['message']);}else{logger[_0xb388('0xe')](_0xb388('0xf'),_0x14f0b2,_0xb388('0x10'));_0x73e096(_0x280c54[_0xb388('0x16')][_0xb388('0x15')]);}})[_0xb388('0x17')](function(_0x58d6f0){logger[_0xb388('0x13')](_0xb388('0xf'),_0x14f0b2,_0x58d6f0);_0x322adb(_0x58d6f0);});});}exports[_0xb388('0x18')]=function(_0x2d46a8){var _0xfb8b1f=this;return new Promise(function(_0x20720b,_0x1e46bf){return db[_0xb388('0x19')]['findAll']({'raw':_0x2d46a8[_0xb388('0x1a')]?_0x2d46a8[_0xb388('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2d46a8['options']?_0x2d46a8[_0xb388('0x1a')][_0xb388('0x1b')]||null:null,'attributes':_0x2d46a8[_0xb388('0x1a')]?_0x2d46a8[_0xb388('0x1a')][_0xb388('0x1c')]||null:null,'limit':_0x2d46a8[_0xb388('0x1a')]?_0x2d46a8[_0xb388('0x1a')]['limit']||null:null,'include':_0x2d46a8['options']?_0x2d46a8[_0xb388('0x1a')]['include']?_[_0xb388('0x1d')](_0x2d46a8[_0xb388('0x1a')][_0xb388('0x1e')],function(_0x5144e6){return{'model':db[_0x5144e6[_0xb388('0x1f')]],'as':_0x5144e6['as'],'attributes':_0x5144e6['attributes'],'include':_0x5144e6[_0xb388('0x1e')]?_[_0xb388('0x1d')](_0x5144e6[_0xb388('0x1e')],function(_0x149a4e){return{'model':db[_0x149a4e[_0xb388('0x1f')]],'as':_0x149a4e['as'],'attributes':_0x149a4e[_0xb388('0x1c')],'include':_0x149a4e[_0xb388('0x1e')]?_['map'](_0x149a4e[_0xb388('0x1e')],function(_0x13113d){return{'model':db[_0x13113d[_0xb388('0x1f')]],'as':_0x13113d['as'],'attributes':_0x13113d[_0xb388('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb388('0xd')](function(_0xb45329){logger['info'](_0xb388('0x18'),_0x2d46a8);logger[_0xb388('0x20')](_0xb388('0x18'),_0x2d46a8,JSON[_0xb388('0x12')](_0xb45329));_0x20720b(_0xb45329);})[_0xb388('0x17')](function(_0x301201){logger['error']('GetCmHopperBlack',_0x301201[_0xb388('0x15')],_0x2d46a8);_0x1e46bf(_0xfb8b1f[_0xb388('0x13')](0x1f4,_0x301201[_0xb388('0x15')]));});});};exports[_0xb388('0x21')]=function(_0x5f0507){var _0x506c82=this;return new Promise(function(_0x3791fa,_0x5190a1){return db['CmHopperBlack']['update'](_0x5f0507['body'],{'raw':_0x5f0507[_0xb388('0x1a')]?_0x5f0507[_0xb388('0x1a')][_0xb388('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f0507[_0xb388('0x1a')]?_0x5f0507['options']['where']||null:null,'attributes':_0x5f0507[_0xb388('0x1a')]?_0x5f0507[_0xb388('0x1a')][_0xb388('0x1c')]||null:null,'limit':_0x5f0507['options']?_0x5f0507['options']['limit']||null:null})[_0xb388('0xd')](function(_0x52513b){logger[_0xb388('0xe')](_0xb388('0x21'),_0x5f0507);logger[_0xb388('0x20')]('UpdateCmHopperBlack',_0x5f0507,JSON[_0xb388('0x12')](_0x52513b));_0x3791fa(_0x52513b);})[_0xb388('0x17')](function(_0x570e11){logger['error'](_0xb388('0x21'),_0x570e11[_0xb388('0x15')],_0x5f0507);_0x5190a1(_0x506c82[_0xb388('0x13')](0x1f4,_0x570e11[_0xb388('0x15')]));});});};exports[_0xb388('0x23')]=function(_0x500da7){var _0x200ccf=this;return new Promise(function(_0x5f07eb,_0x424329){return db[_0xb388('0x19')]['destroy']({'where':_0x500da7['options']?_0x500da7[_0xb388('0x1a')][_0xb388('0x1b')]||null:null})[_0xb388('0xd')](function(_0xf2be7b){logger[_0xb388('0xe')](_0xb388('0x23'),_0x500da7);logger['debug']('DestroyCmHopperBlack',_0x500da7,JSON[_0xb388('0x12')](_0xf2be7b));_0x5f07eb(_0xf2be7b);})['catch'](function(_0x27f468){logger['error'](_0xb388('0x23'),_0x27f468[_0xb388('0x15')],_0x500da7);_0x424329(_0x200ccf['error'](0x1f4,_0x27f468[_0xb388('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f5eaf4b..be68910 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 _0x7c09=['describe','put','/:id','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated'];(function(_0x13f597,_0x44ecc1){var _0x5e723f=function(_0x59cbb3){while(--_0x59cbb3){_0x13f597['push'](_0x13f597['shift']());}};_0x5e723f(++_0x44ecc1);}(_0x7c09,0x102));var _0x97c0=function(_0x5cca6d,_0x4638f2){_0x5cca6d=_0x5cca6d-0x0;var _0x5b3283=_0x7c09[_0x5cca6d];return _0x5b3283;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x97c0('0x9')](_0x97c0('0xa'),auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0x9')]('/:id',auth[_0x97c0('0xb')](),controller['show']);router[_0x97c0('0xd')](_0x97c0('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x97c0('0xf')](_0x97c0('0xe'),auth[_0x97c0('0xb')](),controller[_0x97c0('0x10')]);module[_0x97c0('0x11')]=router; \ No newline at end of file +var _0xda19=['isAuthenticated','index','/describe','describe','show','/:id','update','delete','destroy','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x16aa70,_0x5b1f73){var _0x11875f=function(_0x18c7be){while(--_0x18c7be){_0x16aa70['push'](_0x16aa70['shift']());}};_0x11875f(++_0x5b1f73);}(_0xda19,0xd5));var _0x9da1=function(_0x205457,_0x427066){_0x205457=_0x205457-0x0;var _0x17442d=_0xda19[_0x205457];return _0x17442d;};'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['put'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);router[_0x9da1('0xf')](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 4b83a8f..3c15cf5 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 _0x6df4=['STRING','DATE','getDataValue','endtime','diff','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x6df4,0x1f0));var _0x46df=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x6df4[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0x46df('0x0'));var moment=require(_0x46df('0x1'));module[_0x46df('0x2')]={'state':{'type':Sequelize[_0x46df('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x46df('0x4')]},'scheduledat':{'type':Sequelize[_0x46df('0x5')]},'countbusyretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x46df('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x46df('0x4')]},'calleridnum':{'type':Sequelize[_0x46df('0x4')]},'calleridname':{'type':Sequelize[_0x46df('0x4')]},'starttime':{'type':Sequelize[_0x46df('0x5')]},'responsetime':{'type':Sequelize[_0x46df('0x5')]},'answertime':{'type':Sequelize[_0x46df('0x5')]},'droptime':{'type':Sequelize[_0x46df('0x5')]},'endtime':{'type':Sequelize[_0x46df('0x5')]},'ringtime':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x46df('0x4')]},'campaign':{'type':Sequelize[_0x46df('0x4')]},'campaigntype':{'type':Sequelize[_0x46df('0x4')]},'membername':{'type':Sequelize[_0x46df('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x46df('0x4')]},'secondDisposition':{'type':Sequelize[_0x46df('0x4')]},'thirdDisposition':{'type':Sequelize[_0x46df('0x4')]},'dispositionat':{'type':Sequelize[_0x46df('0x5')],'set':function(_0x17f2c9){var _0x2613e3=this[_0x46df('0x6')](_0x46df('0x7'));if(_0x2613e3&&_0x17f2c9){this['setDataValue']('followuptime',moment(_0x17f2c9)[_0x46df('0x8')](moment(_0x2613e3),'seconds'));}}},'amd':{'type':Sequelize[_0x46df('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x46df('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x46df('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x46df('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x46df('0x5')]},'callback':{'type':Sequelize[_0x46df('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x46df('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x46df('0x5')]},'deleted':{'type':Sequelize[_0x46df('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x46df('0x5')]},'recallme':{'type':Sequelize[_0x46df('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x46df('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x46df('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c6a=['exports','STRING','INTEGER','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x238cb1,_0x48d145){var _0x22e0b9=function(_0x3f0784){while(--_0x3f0784){_0x238cb1['push'](_0x238cb1['shift']());}};_0x22e0b9(++_0x48d145);}(_0x2c6a,0xbe));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa2c6('0x0'));var moment=require(_0xa2c6('0x1'));module[_0xa2c6('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xa2c6('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa2c6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa2c6('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa2c6('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa2c6('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa2c6('0x5')]},'answertime':{'type':Sequelize[_0xa2c6('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa2c6('0x5')]},'ringtime':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa2c6('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa2c6('0x3')]},'membername':{'type':Sequelize[_0xa2c6('0x3')]},'reason':{'type':Sequelize[_0xa2c6('0x3')]},'disposition':{'type':Sequelize[_0xa2c6('0x3')]},'secondDisposition':{'type':Sequelize[_0xa2c6('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa2c6('0x3')]},'dispositionat':{'type':Sequelize[_0xa2c6('0x5')],'set':function(_0x2d9f66){var _0x106e66=this[_0xa2c6('0x6')]('endtime');if(_0x106e66&&_0x2d9f66){this[_0xa2c6('0x7')](_0xa2c6('0x8'),moment(_0x2d9f66)[_0xa2c6('0x9')](moment(_0x106e66),_0xa2c6('0xa')));}}},'amd':{'type':Sequelize[_0xa2c6('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa2c6('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa2c6('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa2c6('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa2c6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa2c6('0x5')]},'deleted':{'type':Sequelize[_0xa2c6('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa2c6('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa2c6('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa2c6('0x4')],'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 2d8e8dd..51e4288 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 _0x7a54=['calleridnum\x20NOT\x20IN\x20(?)','calleridnum','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','findOne','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','CmHopperFinal','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL'];(function(_0x473544,_0x43977b){var _0x1fab25=function(_0x563c15){while(--_0x563c15){_0x473544['push'](_0x473544['shift']());}};_0x1fab25(++_0x43977b);}(_0x7a54,0x106));var _0x47a5=function(_0x37e133,_0x30002b){_0x37e133=_0x37e133-0x0;var _0x2e792a=_0x7a54[_0x37e133];return _0x2e792a;};'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['CmHopperFinal'][_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['CmHopperFinal']['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['describe']=function(_0x2d38de,_0x23bb04){return db['CmHopperFinal']['describe']()[_0x47a5('0x23')](respondWithResult(_0x23bb04,null))['catch'](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0xd93e37,_0x54c35f){if(_0xd93e37['body'][_0x47a5('0x47')]){delete _0xd93e37['body'][_0x47a5('0x47')];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'uniqueid':_0xd93e37[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x54c35f,null))[_0x47a5('0x23')](saveUpdates(_0xd93e37[_0x47a5('0x48')],null))['then'](respondWithResult(_0x54c35f,null))['catch'](handleError(_0x54c35f,null));};exports[_0x47a5('0x49')]=function(_0x411230,_0x1163e3,_0x9ea93e){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x411230[_0x47a5('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4c')))),'noSuchContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4d')))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x47a5('0x50')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x52')))),'dropContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x47a5('0x53')))),'abandonedContacts'],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x55')))),_0x47a5('0x56')]]})['then'](handleEntityNotFound(_0x1163e3,null))[_0x47a5('0x23')](respondWithResult(_0x1163e3,null))[_0x47a5('0x46')](handleError(_0x1163e3,null));};exports[_0x47a5('0x57')]=function(_0x5a33b8,_0x30ea7a,_0x4db625){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'CampaignId':_0x5a33b8[_0x47a5('0x41')]['id']},'attributes':[[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x58')))),'busyContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x59')))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x52')))),_0x47a5('0x5a')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize'][_0x47a5('0x4f')](_0x47a5('0x53')))),_0x47a5('0x5b')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x5c')))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x47a5('0x56')]]})[_0x47a5('0x23')](handleEntityNotFound(_0x30ea7a,null))[_0x47a5('0x23')](respondWithResult(_0x30ea7a,null))['catch'](handleError(_0x30ea7a,null));};exports[_0x47a5('0x5d')]=function(_0x2e46af,_0x36c67,_0x26f1ac){return db['VoiceQueue'][_0x47a5('0x45')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x43f649){var _0x4cf7c5;if(_0x43f649){_0x4cf7c5=squel[_0x47a5('0x5e')]()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery'](['phone','scheduledAt',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),_0x47a5('0x64'),'updatedAt'],squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x67'),_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6a'))[_0x47a5('0x66')](_0x47a5('0x6b'),_0x47a5('0x61'))[_0x47a5('0x66')](_0x47a5('0x6c'),'ListId')[_0x47a5('0x66')]('ANY_VALUE(VoiceQueueId)',_0x47a5('0x63'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6d'))[_0x47a5('0x6e')](_0x47a5('0x6f'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x72'),_0x2e46af['body']['state']['toString']())['where'](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x68'))[_0x47a5('0x6e')](_0x47a5('0x60'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')](_0x47a5('0x74'),squel['select']()[_0x47a5('0x66')](_0x47a5('0x75'))[_0x47a5('0x6e')]('cm_hopper_final')[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')]('state\x20=\x204'))['group'](_0x47a5('0x61')))[_0x47a5('0x71')]();return db[_0x47a5('0x4b')][_0x47a5('0x2f')](_0x4cf7c5);}return[];})[_0x47a5('0x23')](respondWithResult(_0x36c67,null))[_0x47a5('0x46')](handleError(_0x36c67,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x592322,_0x3e0dbd,_0x4f2361){return db[_0x47a5('0x76')][_0x47a5('0x45')]({'where':{'id':_0x592322[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x3e0dbd,null))['then'](function(_0x3c66e3){var _0x550bde;if(_0x3c66e3){_0x550bde=squel['insert']()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery']([_0x47a5('0x68'),_0x47a5('0x6a'),_0x47a5('0x61'),'ListId',_0x47a5('0x77'),'createdAt',_0x47a5('0x6d')],squel[_0x47a5('0x65')]()[_0x47a5('0x66')]('ANY_VALUE(calleridnum)',_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),'scheduledAt')[_0x47a5('0x66')]('ANY_VALUE(ContactId)',_0x47a5('0x61'))['field'](_0x47a5('0x6c'),_0x47a5('0x62'))[_0x47a5('0x66')](_0x47a5('0x78'),'CampaignId')[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),'updatedAt')['from'](_0x47a5('0x6f'))['where'](_0x47a5('0x79'),_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())['where'](_0x47a5('0x72'),_0x592322[_0x47a5('0x48')]['state'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x47a5('0x66')](_0x47a5('0x68'))['from'](_0x47a5('0x60'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()['field'](_0x47a5('0x75'))['from'](_0x47a5('0x6f'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')](_0x47a5('0x7a')))[_0x47a5('0x7b')](_0x47a5('0x61')))['toString']();return db[_0x47a5('0x4b')]['query'](_0x550bde);}return[];})['then'](respondWithResult(_0x3e0dbd,null))[_0x47a5('0x46')](handleError(_0x3e0dbd,null));};exports[_0x47a5('0x7c')]=function(_0x352238,_0x96fb22,_0x380c8b){return db['CmHopper'][_0x47a5('0x7d')]({'where':{'VoiceQueueId':_0x352238[_0x47a5('0x48')][_0x47a5('0x63')],'CampaignId':_0x352238[_0x47a5('0x48')]['CampaignId'],'ContactId':_0x352238[_0x47a5('0x48')]['ContactId']}})[_0x47a5('0x23')](handleEntityNotFound(_0x96fb22,null))[_0x47a5('0x23')](function(_0x3f93f0){if(_0x3f93f0){return _0x3f93f0;}return null;})[_0x47a5('0x23')](respondWithResult(_0x96fb22,null))[_0x47a5('0x46')](handleError(_0x96fb22,null));}; \ No newline at end of file +var _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','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','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x30b5ef,_0x53a436){var _0x15325d=function(_0x276e77){while(--_0x276e77){_0x30b5ef['push'](_0x30b5ef['shift']());}};_0x15325d(++_0x53a436);}(_0xadb5,0xad));var _0x5adb=function(_0x1bc1d5,_0x70781){_0x1bc1d5=_0x1bc1d5-0x0;var _0x82e8b8=_0xadb5[_0x1bc1d5];return _0x82e8b8;};'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['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0faea05..4f5ccc7 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 _0xd74a=['../../config/logger','api','moment','bluebird','rimraf','./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','lodash','util'];(function(_0x5eba91,_0x765977){var _0x52d038=function(_0x15e1e9){while(--_0x15e1e9){_0x5eba91['push'](_0x5eba91['shift']());}};_0x52d038(++_0x765977);}(_0xd74a,0x1d2));var _0xad74=function(_0x5a02a3,_0x5c346b){_0x5a02a3=_0x5a02a3-0x0;var _0x2ec097=_0xd74a[_0x5a02a3];return _0x2ec097;};'use strict';var _=require(_0xad74('0x0'));var util=require(_0xad74('0x1'));var logger=require(_0xad74('0x2'))(_0xad74('0x3'));var moment=require(_0xad74('0x4'));var BPromise=require(_0xad74('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xad74('0x6'));var config=require('../../config/environment');var attributes=require(_0xad74('0x7'));module[_0xad74('0x8')]=function(_0x3dc7d7,_0x37ec4c){return _0x3dc7d7[_0xad74('0x9')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xad74('0xa'),'fields':[_0xad74('0xa')]},{'name':'uniqueid','fields':[_0xad74('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32b6=['moment','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger'];(function(_0x28e424,_0x4d6508){var _0x25ab59=function(_0x3ff7b4){while(--_0x3ff7b4){_0x28e424['push'](_0x28e424['shift']());}};_0x25ab59(++_0x4d6508);}(_0x32b6,0x8b));var _0x632b=function(_0x254224,_0x3ebdb6){_0x254224=_0x254224-0x0;var _0x3ffd94=_0x32b6[_0x254224];return _0x3ffd94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x632b('0x0'))('api');var moment=require(_0x632b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x2'));var rimraf=require(_0x632b('0x3'));var config=require(_0x632b('0x4'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x1493fb,_0x338604){return _0x1493fb[_0x632b('0x5')](_0x632b('0x6'),attributes,{'tableName':_0x632b('0x7'),'paranoid':![],'indexes':[{'name':_0x632b('0x8'),'fields':[_0x632b('0x8')]},{'name':_0x632b('0x9'),'fields':[_0x632b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 59d31f2..8ae0dce 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x11e127,_0x371404){var _0x268b66=function(_0x53ccd7){while(--_0x53ccd7){_0x11e127['push'](_0x11e127['shift']());}};_0x268b66(++_0x371404);}(_0x7a54,0x106));var _0x47a5=function(_0x425943,_0x3068a8){_0x425943=_0x425943-0x0;var _0x5c13af=_0x7a54[_0x425943];return _0x5c13af;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2261df,_0xaed61b){var _0x29f50b=function(_0x1571e4){while(--_0x1571e4){_0x2261df['push'](_0x2261df['shift']());}};_0x29f50b(++_0xaed61b);}(_0x7a54,0x106));var _0x47a5=function(_0x58ddfa,_0x358ab7){_0x58ddfa=_0x58ddfa-0x0;var _0x375382=_0x7a54[_0x58ddfa];return _0x375382;};'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 ed13f29..f97cbe4 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 _0x5e3b=['fs-extra','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5e3b,0x79));var _0xb5e3=function(_0x3c66b7,_0x4abef0){_0x3c66b7=_0x3c66b7-0x0;var _0xb32821=_0x5e3b[_0x3c66b7];return _0xb32821;};'use strict';var multer=require(_0xb5e3('0x0'));var util=require(_0xb5e3('0x1'));var path=require(_0xb5e3('0x2'));var timeout=require(_0xb5e3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb5e3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5e3('0x5'));var controller=require(_0xb5e3('0x6'));router[_0xb5e3('0x7')]('/',auth[_0xb5e3('0x8')](),controller[_0xb5e3('0x9')]);router[_0xb5e3('0x7')](_0xb5e3('0xa'),auth[_0xb5e3('0x8')](),controller[_0xb5e3('0xb')]);router['get'](_0xb5e3('0xc'),auth[_0xb5e3('0x8')](),controller['show']);router[_0xb5e3('0x7')](_0xb5e3('0xd'),auth[_0xb5e3('0x8')](),controller[_0xb5e3('0xe')]);router[_0xb5e3('0x7')](_0xb5e3('0xf'),auth['isAuthenticated'](),controller[_0xb5e3('0x10')]);router[_0xb5e3('0x11')](_0xb5e3('0x12'),auth[_0xb5e3('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0xb5e3('0x13'),auth[_0xb5e3('0x8')](),controller[_0xb5e3('0x14')]);router[_0xb5e3('0x11')](_0xb5e3('0x15'),auth[_0xb5e3('0x8')](),controller[_0xb5e3('0x16')]);router[_0xb5e3('0x17')](_0xb5e3('0xc'),auth['isAuthenticated'](),controller['update']);module[_0xb5e3('0x18')]=router; \ No newline at end of file +var _0x6e3f=['fs-extra','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x3ae195,_0x5dd7a2){var _0x70ea07=function(_0x208cec){while(--_0x208cec){_0x3ae195['push'](_0x3ae195['shift']());}};_0x70ea07(++_0x5dd7a2);}(_0x6e3f,0x127));var _0xf6e3=function(_0x42089a,_0x3e5ffa){_0x42089a=_0x42089a-0x0;var _0x32d7e1=_0x6e3f[_0x42089a];return _0x32d7e1;};'use strict';var multer=require(_0xf6e3('0x0'));var util=require(_0xf6e3('0x1'));var path=require(_0xf6e3('0x2'));var timeout=require(_0xf6e3('0x3'));var express=require('express');var router=express[_0xf6e3('0x4')]();var fs_extra=require(_0xf6e3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf6e3('0x6'));router[_0xf6e3('0x7')]('/',auth[_0xf6e3('0x8')](),controller[_0xf6e3('0x9')]);router['get'](_0xf6e3('0xa'),auth[_0xf6e3('0x8')](),controller[_0xf6e3('0xb')]);router[_0xf6e3('0x7')]('/:id',auth[_0xf6e3('0x8')](),controller[_0xf6e3('0xc')]);router['get'](_0xf6e3('0xd'),auth[_0xf6e3('0x8')](),controller[_0xf6e3('0xe')]);router['get']('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xf6e3('0xf')]);router[_0xf6e3('0x10')](_0xf6e3('0x11'),auth['isAuthenticated'](),controller[_0xf6e3('0x12')]);router[_0xf6e3('0x10')](_0xf6e3('0x13'),auth['isAuthenticated'](),controller[_0xf6e3('0x14')]);router[_0xf6e3('0x10')]('/checkContactHopper',auth[_0xf6e3('0x8')](),controller[_0xf6e3('0x15')]);router[_0xf6e3('0x16')]('/:id',auth[_0xf6e3('0x8')](),controller[_0xf6e3('0x17')]);module[_0xf6e3('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 b8b28fd..8326301 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 _0x4d45=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4d45,0x19a));var _0x54d4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4d45[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x54d4('0x0'));module[_0x54d4('0x1')]={'state':{'type':Sequelize[_0x54d4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x54d4('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x54d4('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x54d4('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x54d4('0x3')]},'calleridname':{'type':Sequelize[_0x54d4('0x3')]},'starttime':{'type':Sequelize[_0x54d4('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x54d4('0x4')]},'endtime':{'type':Sequelize[_0x54d4('0x4')]},'ringtime':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x54d4('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x54d4('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x54d4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x54d4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x54d4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x54d4('0x4')]},'recallme':{'type':Sequelize[_0x54d4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x54d4('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x54d4('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x54d4('0x3')]}}; \ No newline at end of file +var _0xb983=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x284d57,_0x5da897){var _0x1c38cd=function(_0x287185){while(--_0x287185){_0x284d57['push'](_0x284d57['shift']());}};_0x1c38cd(++_0x5da897);}(_0xb983,0x1db));var _0x3b98=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0xb983[_0x38fb8b];return _0x1ec681;};'use strict';var Sequelize=require(_0x3b98('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3b98('0x2')]},'originatecalleridname':{'type':Sequelize[_0x3b98('0x2')]},'calleridnum':{'type':Sequelize[_0x3b98('0x2')]},'calleridname':{'type':Sequelize[_0x3b98('0x2')]},'starttime':{'type':Sequelize[_0x3b98('0x3')]},'responsetime':{'type':Sequelize[_0x3b98('0x3')]},'answertime':{'type':Sequelize[_0x3b98('0x3')]},'droptime':{'type':Sequelize[_0x3b98('0x3')]},'endtime':{'type':Sequelize[_0x3b98('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3b98('0x2')]},'campaign':{'type':Sequelize[_0x3b98('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3b98('0x2')]},'amd':{'type':Sequelize[_0x3b98('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3b98('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3b98('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3b98('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3b98('0x3')]},'recallme':{'type':Sequelize[_0x3b98('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3b98('0x3')]},'edited':{'type':Sequelize[_0x3b98('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3b98('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3b98('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0387620..8b7d044 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 _0xc151=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0xc151,0x91));var _0x1c15=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc151[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x1c15('0x0'));var rimraf=require(_0x1c15('0x1'));var zipdir=require(_0x1c15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c15('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c15('0x4'));var path=require(_0x1c15('0x5'));var sox=require(_0x1c15('0x6'));var csv=require(_0x1c15('0x7'));var ejs=require(_0x1c15('0x8'));var fs=require('fs');var fs_extra=require(_0x1c15('0x9'));var _=require(_0x1c15('0xa'));var squel=require(_0x1c15('0xb'));var crypto=require(_0x1c15('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1c15('0xd'));var toCsv=require(_0x1c15('0x7'));var querystring=require(_0x1c15('0xe'));var Papa=require(_0x1c15('0xf'));var Redis=require(_0x1c15('0x10'));var authService=require(_0x1c15('0x11'));var qs=require(_0x1c15('0x12'));var as=require(_0x1c15('0x13'));var hardwareService=require(_0x1c15('0x14'));var logger=require(_0x1c15('0x15'))(_0x1c15('0x16'));var utils=require(_0x1c15('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1c15('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23707b,_0x27c412){_0x27c412=_0x27c412||0xcc;return function(_0x8efe3a){if(_0x8efe3a){return _0x23707b[_0x1c15('0x19')](_0x27c412);}return _0x23707b['status'](_0x27c412)['end']();};}function respondWithResult(_0x2716a2,_0x42eb14){_0x42eb14=_0x42eb14||0xc8;return function(_0x376f45){if(_0x376f45){return _0x2716a2[_0x1c15('0x1a')](_0x42eb14)[_0x1c15('0x1b')](_0x376f45);}};}function respondWithFilteredResult(_0x4676ec,_0x3ee0ff){return function(_0x320b41){if(_0x320b41){var _0x5a3e14=typeof _0x3ee0ff[_0x1c15('0x1c')]==='undefined'&&typeof _0x3ee0ff[_0x1c15('0x1d')]===_0x1c15('0x1e');var _0x4f0a3e=_0x320b41[_0x1c15('0x1f')];var _0x4fd75a=_0x5a3e14?0x0:_0x3ee0ff[_0x1c15('0x1c')];var _0x473eaf=_0x5a3e14?_0x320b41[_0x1c15('0x1f')]:_0x3ee0ff[_0x1c15('0x1c')]+_0x3ee0ff[_0x1c15('0x1d')];var _0x1bb3d5;if(_0x473eaf>=_0x4f0a3e){_0x473eaf=_0x4f0a3e;_0x1bb3d5=0xc8;}else{_0x1bb3d5=0xce;}_0x4676ec[_0x1c15('0x1a')](_0x1bb3d5);return _0x4676ec[_0x1c15('0x20')](_0x1c15('0x21'),_0x4fd75a+'-'+_0x473eaf+'/'+_0x4f0a3e)[_0x1c15('0x1b')](_0x320b41);}return null;};}function patchUpdates(_0x2fdc10){return function(_0x87ec28){try{jsonpatch[_0x1c15('0x22')](_0x87ec28,_0x2fdc10,!![]);}catch(_0x39a574){return BPromise['reject'](_0x39a574);}return _0x87ec28[_0x1c15('0x23')]();};}function saveUpdates(_0x512a70,_0x438977){return function(_0x5bb079){if(_0x5bb079){return _0x5bb079['update'](_0x512a70)['then'](function(_0x28ea6e){return _0x28ea6e;});}return null;};}function removeEntity(_0x507d70,_0x366b64){return function(_0x33a0be){if(_0x33a0be){return _0x33a0be['destroy']()[_0x1c15('0x24')](function(){_0x507d70[_0x1c15('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x352af1,_0x5d56ae){return function(_0x5f0080){if(!_0x5f0080){_0x352af1[_0x1c15('0x19')](0x194);}return _0x5f0080;};}function handleError(_0x59b9de,_0x52c391){_0x52c391=_0x52c391||0x1f4;return function(_0x14e8de){logger[_0x1c15('0x25')](_0x14e8de[_0x1c15('0x26')]);if(_0x14e8de[_0x1c15('0x27')]){delete _0x14e8de['name'];}_0x59b9de['status'](_0x52c391)[_0x1c15('0x28')](_0x14e8de);};}exports[_0x1c15('0x29')]=function(_0x4d6be0,_0x16c81a){var _0x1521b7={},_0x12c35e={},_0x405161={'count':0x0,'rows':[]};var _0x2fb73a=_[_0x1c15('0x2a')](db['CmHopperHistory']['rawAttributes'],function(_0x4b3bbd){return{'name':_0x4b3bbd[_0x1c15('0x2b')],'type':_0x4b3bbd[_0x1c15('0x2c')]['key']};});_0x12c35e['model']=_[_0x1c15('0x2a')](_0x2fb73a,_0x1c15('0x27'));_0x12c35e[_0x1c15('0x2d')]=_[_0x1c15('0x2e')](_0x4d6be0[_0x1c15('0x2d')]);_0x12c35e[_0x1c15('0x2f')]=_[_0x1c15('0x30')](_0x12c35e[_0x1c15('0x31')],_0x12c35e['query']);_0x1521b7[_0x1c15('0x32')]=_[_0x1c15('0x30')](_0x12c35e[_0x1c15('0x31')],qs[_0x1c15('0x33')](_0x4d6be0[_0x1c15('0x2d')]['fields']));_0x1521b7[_0x1c15('0x32')]=_0x1521b7[_0x1c15('0x32')][_0x1c15('0x34')]?_0x1521b7[_0x1c15('0x32')]:_0x12c35e[_0x1c15('0x31')];if(!_0x4d6be0[_0x1c15('0x2d')][_0x1c15('0x35')](_0x1c15('0x36'))){_0x1521b7[_0x1c15('0x1d')]=qs[_0x1c15('0x1d')](_0x4d6be0[_0x1c15('0x2d')][_0x1c15('0x1d')]);_0x1521b7[_0x1c15('0x1c')]=qs['offset'](_0x4d6be0[_0x1c15('0x2d')][_0x1c15('0x1c')]);}_0x1521b7[_0x1c15('0x37')]=qs['sort'](_0x4d6be0['query'][_0x1c15('0x38')]);_0x1521b7['where']=qs['filters'](_[_0x1c15('0x39')](_0x4d6be0[_0x1c15('0x2d')],_0x12c35e['filters']),_0x2fb73a);if(_0x4d6be0[_0x1c15('0x2d')][_0x1c15('0x3a')]){_0x1521b7[_0x1c15('0x3b')]=_['merge'](_0x1521b7[_0x1c15('0x3b')],{'$or':_['map'](_0x2fb73a,function(_0x18bc6d){if(_0x18bc6d[_0x1c15('0x2c')]!==_0x1c15('0x3c')){var _0x4892f4={};_0x4892f4[_0x18bc6d[_0x1c15('0x27')]]={'$like':'%'+_0x4d6be0[_0x1c15('0x2d')][_0x1c15('0x3a')]+'%'};return _0x4892f4;}})});}_0x1521b7=_['merge']({},_0x1521b7,_0x4d6be0[_0x1c15('0x3d')]);var _0x17c952={'where':_0x1521b7[_0x1c15('0x3b')]};return db[_0x1c15('0x3e')][_0x1c15('0x1f')](_0x17c952)[_0x1c15('0x24')](function(_0x4a15d5){_0x405161['count']=_0x4a15d5;if(_0x4d6be0[_0x1c15('0x2d')][_0x1c15('0x3f')]){_0x1521b7[_0x1c15('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1c15('0x41')](_0x1521b7);})['then'](function(_0x4c1ffd){_0x405161[_0x1c15('0x42')]=_0x4c1ffd;return _0x405161;})[_0x1c15('0x24')](respondWithFilteredResult(_0x16c81a,_0x1521b7))[_0x1c15('0x43')](handleError(_0x16c81a,null));};exports['show']=function(_0x495444,_0x4dbaf5){var _0x4bf321={'raw':!![],'where':{'id':_0x495444[_0x1c15('0x44')]['id']}},_0x317425={};_0x317425[_0x1c15('0x31')]=_[_0x1c15('0x2e')](db[_0x1c15('0x3e')][_0x1c15('0x45')]);_0x317425[_0x1c15('0x2d')]=_[_0x1c15('0x2e')](_0x495444[_0x1c15('0x2d')]);_0x317425['filters']=_[_0x1c15('0x30')](_0x317425[_0x1c15('0x31')],_0x317425[_0x1c15('0x2d')]);_0x4bf321[_0x1c15('0x32')]=_[_0x1c15('0x30')](_0x317425['model'],qs[_0x1c15('0x33')](_0x495444[_0x1c15('0x2d')][_0x1c15('0x33')]));_0x4bf321[_0x1c15('0x32')]=_0x4bf321['attributes'][_0x1c15('0x34')]?_0x4bf321[_0x1c15('0x32')]:_0x317425['model'];if(_0x495444[_0x1c15('0x2d')][_0x1c15('0x3f')]){_0x4bf321[_0x1c15('0x40')]=[{'all':!![]}];}_0x4bf321=_[_0x1c15('0x46')]({},_0x4bf321,_0x495444[_0x1c15('0x3d')]);return db[_0x1c15('0x3e')][_0x1c15('0x47')](_0x4bf321)['then'](handleEntityNotFound(_0x4dbaf5,null))['then'](respondWithResult(_0x4dbaf5,null))['catch'](handleError(_0x4dbaf5,null));};exports['create']=function(_0x141fb3,_0x25c6cc){return db['CmHopperHistory'][_0x1c15('0x48')](_0x141fb3['body'],{})['then'](respondWithResult(_0x25c6cc,0xc9))[_0x1c15('0x43')](handleError(_0x25c6cc,null));};exports[_0x1c15('0x49')]=function(_0x365596,_0x31a347){return db[_0x1c15('0x3e')][_0x1c15('0x49')]()[_0x1c15('0x24')](respondWithResult(_0x31a347,null))[_0x1c15('0x43')](handleError(_0x31a347,null));};exports[_0x1c15('0x4a')]=function(_0x51cf0c,_0x2808a1){if(_0x51cf0c[_0x1c15('0x4b')][_0x1c15('0x4c')]){delete _0x51cf0c['body']['uniqueid'];}return db[_0x1c15('0x3e')][_0x1c15('0x47')]({'where':{'uniqueid':_0x51cf0c[_0x1c15('0x44')]['id']}})[_0x1c15('0x24')](handleEntityNotFound(_0x2808a1,null))[_0x1c15('0x24')](saveUpdates(_0x51cf0c[_0x1c15('0x4b')],null))['then'](respondWithResult(_0x2808a1,null))[_0x1c15('0x43')](handleError(_0x2808a1,null));}; \ No newline at end of file +var _0x3375=['find','create','body','describe','update','uniqueid','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x36d25e,_0x1a047d){var _0x4b95b8=function(_0x74da3){while(--_0x74da3){_0x36d25e['push'](_0x36d25e['shift']());}};_0x4b95b8(++_0x1a047d);}(_0x3375,0x191));var _0x5337=function(_0x41e7d7,_0x2681ff){_0x41e7d7=_0x41e7d7-0x0;var _0x306093=_0x3375[_0x41e7d7];return _0x306093;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5337('0x0'));var jsonpatch=require(_0x5337('0x1'));var rp=require(_0x5337('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5337('0x3'));var util=require(_0x5337('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x5337('0x5'));var ejs=require(_0x5337('0x6'));var fs=require('fs');var fs_extra=require(_0x5337('0x7'));var _=require(_0x5337('0x8'));var squel=require(_0x5337('0x9'));var crypto=require(_0x5337('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5337('0x5'));var querystring=require(_0x5337('0xb'));var Papa=require('papaparse');var Redis=require(_0x5337('0xc'));var authService=require(_0x5337('0xd'));var qs=require(_0x5337('0xe'));var as=require(_0x5337('0xf'));var hardwareService=require(_0x5337('0x10'));var logger=require(_0x5337('0x11'))(_0x5337('0x12'));var utils=require(_0x5337('0x13'));var config=require(_0x5337('0x14'));var licenseUtil=require(_0x5337('0x15'));var db=require(_0x5337('0x16'))['db'];function respondWithStatusCode(_0x50c87d,_0x2b574b){_0x2b574b=_0x2b574b||0xcc;return function(_0x2cbe0b){if(_0x2cbe0b){return _0x50c87d[_0x5337('0x17')](_0x2b574b);}return _0x50c87d[_0x5337('0x18')](_0x2b574b)[_0x5337('0x19')]();};}function respondWithResult(_0x4707d7,_0x14e1ed){_0x14e1ed=_0x14e1ed||0xc8;return function(_0x4467c5){if(_0x4467c5){return _0x4707d7[_0x5337('0x18')](_0x14e1ed)[_0x5337('0x1a')](_0x4467c5);}};}function respondWithFilteredResult(_0x5a23b6,_0x32129f){return function(_0x2694e7){if(_0x2694e7){var _0x3949f8=typeof _0x32129f[_0x5337('0x1b')]===_0x5337('0x1c')&&typeof _0x32129f[_0x5337('0x1d')]===_0x5337('0x1c');var _0x47e753=_0x2694e7['count'];var _0x3b171d=_0x3949f8?0x0:_0x32129f[_0x5337('0x1b')];var _0x467ce5=_0x3949f8?_0x2694e7[_0x5337('0x1e')]:_0x32129f[_0x5337('0x1b')]+_0x32129f[_0x5337('0x1d')];var _0x50cae7;if(_0x467ce5>=_0x47e753){_0x467ce5=_0x47e753;_0x50cae7=0xc8;}else{_0x50cae7=0xce;}_0x5a23b6[_0x5337('0x18')](_0x50cae7);return _0x5a23b6[_0x5337('0x1f')](_0x5337('0x20'),_0x3b171d+'-'+_0x467ce5+'/'+_0x47e753)['json'](_0x2694e7);}return null;};}function patchUpdates(_0x5b9854){return function(_0x4cbdfe){try{jsonpatch[_0x5337('0x21')](_0x4cbdfe,_0x5b9854,!![]);}catch(_0x1e32fa){return BPromise[_0x5337('0x22')](_0x1e32fa);}return _0x4cbdfe[_0x5337('0x23')]();};}function saveUpdates(_0x427cc7,_0x397c6c){return function(_0x241360){if(_0x241360){return _0x241360['update'](_0x427cc7)[_0x5337('0x24')](function(_0x2ce969){return _0x2ce969;});}return null;};}function removeEntity(_0x54663b,_0x4926ed){return function(_0x3bdb0e){if(_0x3bdb0e){return _0x3bdb0e['destroy']()[_0x5337('0x24')](function(){_0x54663b[_0x5337('0x18')](0xcc)[_0x5337('0x19')]();});}};}function handleEntityNotFound(_0x3ee13f,_0x41b341){return function(_0x357b7a){if(!_0x357b7a){_0x3ee13f[_0x5337('0x17')](0x194);}return _0x357b7a;};}function handleError(_0x4bc334,_0x1f2279){_0x1f2279=_0x1f2279||0x1f4;return function(_0x3bdc55){logger[_0x5337('0x25')](_0x3bdc55[_0x5337('0x26')]);if(_0x3bdc55[_0x5337('0x27')]){delete _0x3bdc55['name'];}_0x4bc334[_0x5337('0x18')](_0x1f2279)[_0x5337('0x28')](_0x3bdc55);};}exports[_0x5337('0x29')]=function(_0x262fbc,_0x1b4f50){var _0x3ada90={},_0x360383={},_0x2c7e71={'count':0x0,'rows':[]};var _0x2428f9=_['map'](db[_0x5337('0x2a')][_0x5337('0x2b')],function(_0x5c0783){return{'name':_0x5c0783[_0x5337('0x2c')],'type':_0x5c0783[_0x5337('0x2d')][_0x5337('0x2e')]};});_0x360383[_0x5337('0x2f')]=_[_0x5337('0x30')](_0x2428f9,_0x5337('0x27'));_0x360383['query']=_[_0x5337('0x31')](_0x262fbc[_0x5337('0x32')]);_0x360383[_0x5337('0x33')]=_[_0x5337('0x34')](_0x360383[_0x5337('0x2f')],_0x360383[_0x5337('0x32')]);_0x3ada90[_0x5337('0x35')]=_[_0x5337('0x34')](_0x360383[_0x5337('0x2f')],qs[_0x5337('0x36')](_0x262fbc['query']['fields']));_0x3ada90['attributes']=_0x3ada90[_0x5337('0x35')][_0x5337('0x37')]?_0x3ada90[_0x5337('0x35')]:_0x360383[_0x5337('0x2f')];if(!_0x262fbc[_0x5337('0x32')][_0x5337('0x38')](_0x5337('0x39'))){_0x3ada90[_0x5337('0x1d')]=qs[_0x5337('0x1d')](_0x262fbc[_0x5337('0x32')][_0x5337('0x1d')]);_0x3ada90[_0x5337('0x1b')]=qs[_0x5337('0x1b')](_0x262fbc[_0x5337('0x32')][_0x5337('0x1b')]);}_0x3ada90[_0x5337('0x3a')]=qs[_0x5337('0x3b')](_0x262fbc[_0x5337('0x32')][_0x5337('0x3b')]);_0x3ada90['where']=qs[_0x5337('0x33')](_[_0x5337('0x3c')](_0x262fbc[_0x5337('0x32')],_0x360383['filters']),_0x2428f9);if(_0x262fbc[_0x5337('0x32')][_0x5337('0x3d')]){_0x3ada90[_0x5337('0x3e')]=_[_0x5337('0x3f')](_0x3ada90[_0x5337('0x3e')],{'$or':_['map'](_0x2428f9,function(_0x412317){if(_0x412317[_0x5337('0x2d')]!==_0x5337('0x40')){var _0x438b22={};_0x438b22[_0x412317[_0x5337('0x27')]]={'$like':'%'+_0x262fbc[_0x5337('0x32')][_0x5337('0x3d')]+'%'};return _0x438b22;}})});}_0x3ada90=_[_0x5337('0x3f')]({},_0x3ada90,_0x262fbc[_0x5337('0x41')]);var _0x112a30={'where':_0x3ada90[_0x5337('0x3e')]};return db[_0x5337('0x2a')][_0x5337('0x1e')](_0x112a30)['then'](function(_0x59987e){_0x2c7e71['count']=_0x59987e;if(_0x262fbc[_0x5337('0x32')][_0x5337('0x42')]){_0x3ada90[_0x5337('0x43')]=[{'all':!![]}];}return db[_0x5337('0x2a')][_0x5337('0x44')](_0x3ada90);})['then'](function(_0x56f0ff){_0x2c7e71[_0x5337('0x45')]=_0x56f0ff;return _0x2c7e71;})[_0x5337('0x24')](respondWithFilteredResult(_0x1b4f50,_0x3ada90))[_0x5337('0x46')](handleError(_0x1b4f50,null));};exports[_0x5337('0x47')]=function(_0x54bb18,_0x4710d2){var _0x4765de={'raw':!![],'where':{'id':_0x54bb18[_0x5337('0x48')]['id']}},_0x5e0cdf={};_0x5e0cdf[_0x5337('0x2f')]=_['keys'](db['CmHopperHistory'][_0x5337('0x2b')]);_0x5e0cdf[_0x5337('0x32')]=_['keys'](_0x54bb18[_0x5337('0x32')]);_0x5e0cdf[_0x5337('0x33')]=_[_0x5337('0x34')](_0x5e0cdf[_0x5337('0x2f')],_0x5e0cdf[_0x5337('0x32')]);_0x4765de[_0x5337('0x35')]=_[_0x5337('0x34')](_0x5e0cdf[_0x5337('0x2f')],qs[_0x5337('0x36')](_0x54bb18[_0x5337('0x32')]['fields']));_0x4765de[_0x5337('0x35')]=_0x4765de[_0x5337('0x35')]['length']?_0x4765de[_0x5337('0x35')]:_0x5e0cdf['model'];if(_0x54bb18[_0x5337('0x32')][_0x5337('0x42')]){_0x4765de[_0x5337('0x43')]=[{'all':!![]}];}_0x4765de=_[_0x5337('0x3f')]({},_0x4765de,_0x54bb18['options']);return db['CmHopperHistory'][_0x5337('0x49')](_0x4765de)['then'](handleEntityNotFound(_0x4710d2,null))[_0x5337('0x24')](respondWithResult(_0x4710d2,null))[_0x5337('0x46')](handleError(_0x4710d2,null));};exports[_0x5337('0x4a')]=function(_0x5fc43f,_0x1e63ea){return db[_0x5337('0x2a')][_0x5337('0x4a')](_0x5fc43f[_0x5337('0x4b')],{})[_0x5337('0x24')](respondWithResult(_0x1e63ea,0xc9))[_0x5337('0x46')](handleError(_0x1e63ea,null));};exports[_0x5337('0x4c')]=function(_0x2f71a1,_0x2ad3ee){return db[_0x5337('0x2a')][_0x5337('0x4c')]()['then'](respondWithResult(_0x2ad3ee,null))['catch'](handleError(_0x2ad3ee,null));};exports[_0x5337('0x4d')]=function(_0x46a449,_0x291b1f){if(_0x46a449[_0x5337('0x4b')][_0x5337('0x4e')]){delete _0x46a449[_0x5337('0x4b')][_0x5337('0x4e')];}return db[_0x5337('0x2a')][_0x5337('0x49')]({'where':{'uniqueid':_0x46a449['params']['id']}})[_0x5337('0x24')](handleEntityNotFound(_0x291b1f,null))[_0x5337('0x24')](saveUpdates(_0x46a449[_0x5337('0x4b')],null))['then'](respondWithResult(_0x291b1f,null))[_0x5337('0x46')](handleError(_0x291b1f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e9957d8..4b96493 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 _0x4c99=['path','../../config/environment','./cmHopperHistory.attributes','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','request-promise'];(function(_0x4dd992,_0x34844c){var _0x22e05d=function(_0x18af86){while(--_0x18af86){_0x4dd992['push'](_0x4dd992['shift']());}};_0x22e05d(++_0x34844c);}(_0x4c99,0x1ec));var _0x94c9=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4c99[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var logger=require(_0x94c9('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x94c9('0x2'));var fs=require('fs');var path=require(_0x94c9('0x3'));var rimraf=require('rimraf');var config=require(_0x94c9('0x4'));var attributes=require(_0x94c9('0x5'));module['exports']=function(_0x42d25e,_0x4e4ffd){return _0x42d25e['define']('CmHopperHistory',attributes,{'tableName':_0x94c9('0x6'),'paranoid':![],'indexes':[{'name':_0x94c9('0x7'),'fields':[_0x94c9('0x7')]},{'name':_0x94c9('0x8'),'fields':[_0x94c9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb875=['moment','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0xb875,0x167));var _0x5b87=function(_0x374d90,_0x262da6){_0x374d90=_0x374d90-0x0;var _0x539cbb=_0xb875[_0x374d90];return _0x539cbb;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b87('0x1'));var BPromise=require('bluebird');var rp=require(_0x5b87('0x2'));var fs=require('fs');var path=require(_0x5b87('0x3'));var rimraf=require('rimraf');var config=require(_0x5b87('0x4'));var attributes=require(_0x5b87('0x5'));module[_0x5b87('0x6')]=function(_0x32ed83,_0x253d91){return _0x32ed83[_0x5b87('0x7')](_0x5b87('0x8'),attributes,{'tableName':_0x5b87('0x9'),'paranoid':![],'indexes':[{'name':_0x5b87('0xa'),'fields':[_0x5b87('0xa')]},{'name':'uniqueid','fields':[_0x5b87('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 9fe5e06..5c967e5 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 _0x03f5=['AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','catch','GetVoiceQueueHopperHistory','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','predictiveIntervalTotalCalls','COUNT','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit'];(function(_0x553bb0,_0x52e291){var _0x4cfcad=function(_0x1d37f5){while(--_0x1d37f5){_0x553bb0['push'](_0x553bb0['shift']());}};_0x4cfcad(++_0x52e291);}(_0x03f5,0x6c));var _0x503f=function(_0x54ff8b,_0x5c45c4){_0x54ff8b=_0x54ff8b-0x0;var _0x5c6e2d=_0x03f5[_0x54ff8b];return _0x5c6e2d;};'use strict';var _=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var moment=require(_0x503f('0x2'));var BPromise=require(_0x503f('0x3'));var rs=require(_0x503f('0x4'));var fs=require('fs');var Redis=require(_0x503f('0x5'));var db=require(_0x503f('0x6'))['db'];var utils=require(_0x503f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x503f('0x8'));var jayson=require(_0x503f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x364db5,_0x10ed48,_0x1cea02){return new BPromise(function(_0x284993,_0x87aec4){return client[_0x503f('0xa')](_0x364db5,_0x1cea02)[_0x503f('0xb')](function(_0x137ac8){logger[_0x503f('0xc')](_0x503f('0xd'),_0x10ed48,_0x503f('0xe'));logger['debug'](_0x503f('0xf'),_0x10ed48,'request\x20sent',JSON[_0x503f('0x10')](_0x137ac8));if(_0x137ac8[_0x503f('0x11')]){if(_0x137ac8[_0x503f('0x11')][_0x503f('0x12')]===0x1f4){logger['error'](_0x503f('0xd'),_0x10ed48,_0x137ac8[_0x503f('0x11')]['message']);return _0x87aec4(_0x137ac8[_0x503f('0x11')]['message']);}logger[_0x503f('0x11')](_0x503f('0xd'),_0x10ed48,_0x137ac8[_0x503f('0x11')][_0x503f('0x13')]);return _0x284993(_0x137ac8[_0x503f('0x11')][_0x503f('0x13')]);}else{logger[_0x503f('0xc')](_0x503f('0xd'),_0x10ed48,_0x503f('0xe'));_0x284993(_0x137ac8[_0x503f('0x14')]['message']);}})['catch'](function(_0x303765){logger[_0x503f('0x11')](_0x503f('0xd'),_0x10ed48,_0x303765);_0x87aec4(_0x303765);});});}exports[_0x503f('0x15')]=function(_0x4bfe19){var _0x19acf3=this;return new Promise(function(_0xfc2688,_0x1aaa66){return db[_0x503f('0x16')][_0x503f('0x17')](_0x4bfe19[_0x503f('0x18')],{'raw':_0x4bfe19[_0x503f('0x19')]?_0x4bfe19[_0x503f('0x19')][_0x503f('0x1a')]===undefined?!![]:![]:!![]})[_0x503f('0xb')](function(_0x27bb18){logger[_0x503f('0xc')](_0x503f('0x15'),_0x4bfe19);logger[_0x503f('0x1b')](_0x503f('0x15'),_0x4bfe19,JSON[_0x503f('0x10')](_0x27bb18));_0xfc2688(_0x27bb18);})['catch'](function(_0x9ae361){logger[_0x503f('0x11')](_0x503f('0x15'),_0x9ae361[_0x503f('0x13')],_0x4bfe19);_0x1aaa66(_0x19acf3[_0x503f('0x11')](0x1f4,_0x9ae361[_0x503f('0x13')]));});});};exports[_0x503f('0x1c')]=function(_0x59fc8f){var _0x4564a0=this;return new Promise(function(_0x3187c8,_0x1084b6){return db['CmHopperHistory'][_0x503f('0x1d')]({'raw':_0x59fc8f[_0x503f('0x19')]?_0x59fc8f['options'][_0x503f('0x1a')]===undefined?!![]:![]:!![],'where':_0x59fc8f[_0x503f('0x19')]?_0x59fc8f['options'][_0x503f('0x1e')]||null:null,'attributes':[[db[_0x503f('0x1f')]['fn']('COUNT',db[_0x503f('0x1f')]['col']('id')),_0x503f('0x20')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x503f('0x22')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')][_0x503f('0x23')](_0x503f('0x24')))),_0x503f('0x25')],[db[_0x503f('0x1f')]['fn']('COUNT',db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')]['literal'](_0x503f('0x26')))),_0x503f('0x27')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x28'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')][_0x503f('0x23')](_0x503f('0x29')))),_0x503f('0x2a')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x28'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x503f('0x2b')]]})[_0x503f('0xb')](function(_0x2dcdaf){logger[_0x503f('0xc')](_0x503f('0x1c'),_0x59fc8f);logger[_0x503f('0x1b')](_0x503f('0x1c'),_0x59fc8f,JSON['stringify'](_0x2dcdaf));_0x3187c8(_0x2dcdaf);})[_0x503f('0x2c')](function(_0x1333a7){logger['error'](_0x503f('0x1c'),_0x1333a7[_0x503f('0x13')],_0x59fc8f);_0x1084b6(_0x4564a0['error'](0x1f4,_0x1333a7[_0x503f('0x13')]));});});};exports[_0x503f('0x2d')]=function(_0x57fdd6){var _0x3eb3fa=this;return new Promise(function(_0x358a68,_0x4ff69d){return db[_0x503f('0x16')]['findAll']({'raw':_0x57fdd6[_0x503f('0x19')]?_0x57fdd6[_0x503f('0x19')][_0x503f('0x1a')]===undefined?!![]:![]:!![],'where':_0x57fdd6[_0x503f('0x19')]?_0x57fdd6[_0x503f('0x19')][_0x503f('0x1e')]||null:null,'attributes':[['campaign',_0x503f('0x2e')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db['sequelize']['fn']('IF',db[_0x503f('0x1f')][_0x503f('0x23')]('`state`\x20=\x200,\x201,\x20null'))),_0x503f('0x2f')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x503f('0x23')](_0x503f('0x30')))),'outboundNoAnswerCallsDay'],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')]['literal'](_0x503f('0x31')))),_0x503f('0x32')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')][_0x503f('0x23')](_0x503f('0x33')))),_0x503f('0x34')],[db['sequelize']['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')]['literal'](_0x503f('0x35')))),'outboundCongestionCallsDay'],[db[_0x503f('0x1f')]['fn']('COUNT',db[_0x503f('0x1f')]['fn']('IF',db['sequelize'][_0x503f('0x23')](_0x503f('0x36')))),_0x503f('0x37')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x503f('0x1f')]['literal'](_0x503f('0x38')))),_0x503f('0x39')],[db[_0x503f('0x1f')]['fn']('COUNT',db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')][_0x503f('0x23')](_0x503f('0x3a')))),_0x503f('0x3b')],[db[_0x503f('0x1f')]['fn']('COUNT',db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')]['literal'](_0x503f('0x3c')))),_0x503f('0x3d')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')][_0x503f('0x23')](_0x503f('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0x503f('0x1f')]['fn']('COUNT',db[_0x503f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x503f('0x3f')))),_0x503f('0x40')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x503f('0x41')))),_0x503f('0x42')],[db['sequelize']['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x503f('0x43')))),_0x503f('0x40')],[db['sequelize']['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x503f('0x44')]],'group':[_0x503f('0x45')]})[_0x503f('0xb')](function(_0x5e1664){logger['info'](_0x503f('0x2d'),_0x57fdd6);logger[_0x503f('0x1b')](_0x503f('0x2d'),_0x57fdd6,JSON[_0x503f('0x10')](_0x5e1664));_0x358a68(_0x5e1664);})['catch'](function(_0x5b1ee5){logger[_0x503f('0x11')](_0x503f('0x2d'),_0x5b1ee5[_0x503f('0x13')],_0x57fdd6);_0x4ff69d(_0x3eb3fa[_0x503f('0x11')](0x1f4,_0x5b1ee5[_0x503f('0x13')]));});});};exports[_0x503f('0x46')]=function(_0xc18b27){var _0x110d74=this;return new Promise(function(_0x1b684c,_0x551459){return db[_0x503f('0x16')][_0x503f('0x1d')]({'raw':_0xc18b27[_0x503f('0x19')]?_0xc18b27[_0x503f('0x19')][_0x503f('0x1a')]===undefined?!![]:![]:!![],'where':_0xc18b27['options']?_0xc18b27[_0x503f('0x19')][_0x503f('0x1e')]||null:null,'attributes':[['campaign',_0x503f('0x2e')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')][_0x503f('0x47')]('id')),_0x503f('0x48')],[db[_0x503f('0x1f')]['fn'](_0x503f('0x21'),db[_0x503f('0x1f')]['fn']('IF',db[_0x503f('0x1f')][_0x503f('0x23')](_0x503f('0x31')))),_0x503f('0x49')]],'group':[_0x503f('0x45')]})[_0x503f('0xb')](function(_0xc4ca1){logger[_0x503f('0xc')](_0x503f('0x46'),_0xc18b27);logger[_0x503f('0x1b')]('GetCampaignHopperHistory',_0xc18b27,JSON[_0x503f('0x10')](_0xc4ca1));_0x1b684c(_0xc4ca1);})[_0x503f('0x2c')](function(_0x845ea7){logger[_0x503f('0x11')]('GetCampaignHopperHistory',_0x845ea7[_0x503f('0x13')],_0xc18b27);_0x551459(_0x110d74[_0x503f('0x11')](0x1f4,_0x845ea7[_0x503f('0x13')]));});});}; \ No newline at end of file +var _0x22a4=['jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','findAll','where','COUNT','col','predictiveIntervalTotalCalls','sequelize','literal','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2006af,_0x25ecb4){var _0x5e6949=function(_0x1b35f0){while(--_0x1b35f0){_0x2006af['push'](_0x2006af['shift']());}};_0x5e6949(++_0x25ecb4);}(_0x22a4,0x1cb));var _0x422a=function(_0x2a426a,_0x3b308d){_0x2a426a=_0x2a426a-0x0;var _0xfa9fd7=_0x22a4[_0x2a426a];return _0xfa9fd7;};'use strict';var _=require(_0x422a('0x0'));var util=require(_0x422a('0x1'));var moment=require(_0x422a('0x2'));var BPromise=require(_0x422a('0x3'));var rs=require(_0x422a('0x4'));var fs=require('fs');var Redis=require(_0x422a('0x5'));var db=require(_0x422a('0x6'))['db'];var utils=require(_0x422a('0x7'));var logger=require('../../config/logger')(_0x422a('0x8'));var config=require(_0x422a('0x9'));var jayson=require(_0x422a('0xa'));var client=jayson[_0x422a('0xb')][_0x422a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e8fe2,_0x3b5c92,_0x1b4b08){return new BPromise(function(_0x23b1b0,_0x392224){return client[_0x422a('0xd')](_0x5e8fe2,_0x1b4b08)[_0x422a('0xe')](function(_0x317466){logger[_0x422a('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x3b5c92,'request\x20sent');logger[_0x422a('0x10')](_0x422a('0x11'),_0x3b5c92,_0x422a('0x12'),JSON[_0x422a('0x13')](_0x317466));if(_0x317466[_0x422a('0x14')]){if(_0x317466[_0x422a('0x14')]['code']===0x1f4){logger['error'](_0x422a('0x15'),_0x3b5c92,_0x317466['error']['message']);return _0x392224(_0x317466['error'][_0x422a('0x16')]);}logger[_0x422a('0x14')](_0x422a('0x15'),_0x3b5c92,_0x317466[_0x422a('0x14')][_0x422a('0x16')]);return _0x23b1b0(_0x317466[_0x422a('0x14')][_0x422a('0x16')]);}else{logger[_0x422a('0xf')](_0x422a('0x15'),_0x3b5c92,_0x422a('0x12'));_0x23b1b0(_0x317466[_0x422a('0x17')][_0x422a('0x16')]);}})[_0x422a('0x18')](function(_0x3d5033){logger[_0x422a('0x14')](_0x422a('0x15'),_0x3b5c92,_0x3d5033);_0x392224(_0x3d5033);});});}exports[_0x422a('0x19')]=function(_0x5e2507){var _0x30847a=this;return new Promise(function(_0x3c5d86,_0x5b29fc){return db[_0x422a('0x1a')]['create'](_0x5e2507['body'],{'raw':_0x5e2507[_0x422a('0x1b')]?_0x5e2507[_0x422a('0x1b')][_0x422a('0x1c')]===undefined?!![]:![]:!![]})[_0x422a('0xe')](function(_0x194c25){logger[_0x422a('0xf')](_0x422a('0x19'),_0x5e2507);logger[_0x422a('0x10')]('CreateCmHopperHistory',_0x5e2507,JSON[_0x422a('0x13')](_0x194c25));_0x3c5d86(_0x194c25);})[_0x422a('0x18')](function(_0x211d93){logger[_0x422a('0x14')](_0x422a('0x19'),_0x211d93['message'],_0x5e2507);_0x5b29fc(_0x30847a[_0x422a('0x14')](0x1f4,_0x211d93[_0x422a('0x16')]));});});};exports[_0x422a('0x1d')]=function(_0x5e3138){var _0x14f06b=this;return new Promise(function(_0x17b3da,_0x1fd126){return db[_0x422a('0x1a')][_0x422a('0x1e')]({'raw':_0x5e3138[_0x422a('0x1b')]?_0x5e3138[_0x422a('0x1b')][_0x422a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e3138['options']?_0x5e3138[_0x422a('0x1b')][_0x422a('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x422a('0x20'),db['sequelize'][_0x422a('0x21')]('id')),_0x422a('0x22')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db['sequelize']['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),_0x422a('0x25')],[db[_0x422a('0x23')]['fn'](_0x422a('0x26'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x422a('0x23')]['fn'](_0x422a('0x26'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')]['literal'](_0x422a('0x28')))),'predictiveIntervalAvgTalktime']]})[_0x422a('0xe')](function(_0x100e45){logger['info'](_0x422a('0x1d'),_0x5e3138);logger[_0x422a('0x10')]('AvgHandleTime',_0x5e3138,JSON[_0x422a('0x13')](_0x100e45));_0x17b3da(_0x100e45);})[_0x422a('0x18')](function(_0x321afe){logger[_0x422a('0x14')](_0x422a('0x1d'),_0x321afe[_0x422a('0x16')],_0x5e3138);_0x1fd126(_0x14f06b[_0x422a('0x14')](0x1f4,_0x321afe[_0x422a('0x16')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x56f6fb){var _0x36328a=this;return new Promise(function(_0xb1b1d8,_0x45134b){return db['CmHopperHistory'][_0x422a('0x1e')]({'raw':_0x56f6fb[_0x422a('0x1b')]?_0x56f6fb['options']['raw']===undefined?!![]:![]:!![],'where':_0x56f6fb[_0x422a('0x1b')]?_0x56f6fb['options'][_0x422a('0x1f')]||null:null,'attributes':[[_0x422a('0x29'),_0x422a('0x2a')],[db['sequelize']['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x422a('0x2b')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db['sequelize']['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x2c')))),_0x422a('0x2d')],[db[_0x422a('0x23')]['fn']('COUNT',db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x2e')))),_0x422a('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x422a('0x23')]['fn']('IF',db['sequelize'][_0x422a('0x24')](_0x422a('0x30')))),_0x422a('0x31')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')]['literal'](_0x422a('0x32')))),_0x422a('0x33')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x422a('0x34')],[db[_0x422a('0x23')]['fn']('COUNT',db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x35')))),_0x422a('0x36')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db['sequelize']['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x37')))),_0x422a('0x38')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x39')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db['sequelize'][_0x422a('0x24')](_0x422a('0x3a')))),_0x422a('0x3b')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x3c')))),_0x422a('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')]['literal'](_0x422a('0x3e')))),_0x422a('0x3f')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x422a('0x3d')],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x422a('0x29')]})[_0x422a('0xe')](function(_0x1ff3ad){logger[_0x422a('0xf')](_0x422a('0x40'),_0x56f6fb);logger[_0x422a('0x10')](_0x422a('0x40'),_0x56f6fb,JSON[_0x422a('0x13')](_0x1ff3ad));_0xb1b1d8(_0x1ff3ad);})[_0x422a('0x18')](function(_0x5211ff){logger['error']('GetVoiceQueueHopperHistory',_0x5211ff[_0x422a('0x16')],_0x56f6fb);_0x45134b(_0x36328a[_0x422a('0x14')](0x1f4,_0x5211ff[_0x422a('0x16')]));});});};exports[_0x422a('0x41')]=function(_0x4c31fb){var _0x3c04e6=this;return new Promise(function(_0x3f741d,_0x25c7cf){return db[_0x422a('0x1a')][_0x422a('0x1e')]({'raw':_0x4c31fb[_0x422a('0x1b')]?_0x4c31fb['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c31fb[_0x422a('0x1b')]?_0x4c31fb[_0x422a('0x1b')][_0x422a('0x1f')]||null:null,'attributes':[['campaign',_0x422a('0x2a')],[db['sequelize']['fn'](_0x422a('0x20'),db[_0x422a('0x23')]['col']('id')),'ivrTotalCallsDays'],[db[_0x422a('0x23')]['fn'](_0x422a('0x20'),db['sequelize']['fn']('IF',db[_0x422a('0x23')][_0x422a('0x24')](_0x422a('0x2e')))),_0x422a('0x42')]],'group':[_0x422a('0x29')]})[_0x422a('0xe')](function(_0xd462d4){logger[_0x422a('0xf')]('GetCampaignHopperHistory',_0x4c31fb);logger['debug'](_0x422a('0x41'),_0x4c31fb,JSON[_0x422a('0x13')](_0xd462d4));_0x3f741d(_0xd462d4);})[_0x422a('0x18')](function(_0x249cdc){logger[_0x422a('0x14')]('GetCampaignHopperHistory',_0x249cdc['message'],_0x4c31fb);_0x25c7cf(_0x3c04e6[_0x422a('0x14')](0x1f4,_0x249cdc[_0x422a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 22bd315..97151f2 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 _0x24ee=['show','post','create','put','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x24ee,0x9d));var _0xe24e=function(_0x5d572c,_0x53581f){_0x5d572c=_0x5d572c-0x0;var _0x5797cf=_0x24ee[_0x5d572c];return _0x5797cf;};'use strict';var multer=require(_0xe24e('0x0'));var util=require(_0xe24e('0x1'));var path=require(_0xe24e('0x2'));var timeout=require(_0xe24e('0x3'));var express=require('express');var router=express[_0xe24e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe24e('0x5'));var interaction=require(_0xe24e('0x6'));var config=require(_0xe24e('0x7'));var controller=require('./cmHopperHistory.controller');router[_0xe24e('0x8')]('/',auth[_0xe24e('0x9')](),controller[_0xe24e('0xa')]);router[_0xe24e('0x8')](_0xe24e('0xb'),auth['isAuthenticated'](),controller[_0xe24e('0xc')]);router[_0xe24e('0x8')](_0xe24e('0xd'),auth[_0xe24e('0x9')](),controller[_0xe24e('0xe')]);router[_0xe24e('0xf')]('/',auth[_0xe24e('0x9')](),controller[_0xe24e('0x10')]);router[_0xe24e('0x11')](_0xe24e('0xd'),auth[_0xe24e('0x9')](),controller[_0xe24e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbbe2=['isAuthenticated','index','/:id','show','post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get'];(function(_0x5a4756,_0xc9fb35){var _0x451714=function(_0x168c22){while(--_0x168c22){_0x5a4756['push'](_0x5a4756['shift']());}};_0x451714(++_0xc9fb35);}(_0xbbe2,0xce));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2bbe('0x0'));var path=require(_0x2bbe('0x1'));var timeout=require(_0x2bbe('0x2'));var express=require(_0x2bbe('0x3'));var router=express[_0x2bbe('0x4')]();var fs_extra=require(_0x2bbe('0x5'));var auth=require(_0x2bbe('0x6'));var interaction=require(_0x2bbe('0x7'));var config=require('../../config/environment');var controller=require(_0x2bbe('0x8'));router[_0x2bbe('0x9')]('/',auth[_0x2bbe('0xa')](),controller[_0x2bbe('0xb')]);router[_0x2bbe('0x9')]('/describe',auth[_0x2bbe('0xa')](),controller['describe']);router[_0x2bbe('0x9')](_0x2bbe('0xc'),auth[_0x2bbe('0xa')](),controller[_0x2bbe('0xd')]);router[_0x2bbe('0xe')]('/',auth[_0x2bbe('0xa')](),controller[_0x2bbe('0xf')]);router['put'](_0x2bbe('0xc'),auth['isAuthenticated'](),controller[_0x2bbe('0x10')]);module[_0x2bbe('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 103b40c..96b960d 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 _0x303a=['STRING','name','sequelize'];(function(_0x5ea989,_0x549115){var _0x9e78cf=function(_0xe3f709){while(--_0xe3f709){_0x5ea989['push'](_0x5ea989['shift']());}};_0x9e78cf(++_0x549115);}(_0x303a,0x1a0));var _0xa303=function(_0x54597a,_0x4ea42f){_0x54597a=_0x54597a-0x0;var _0x5a764f=_0x303a[_0x54597a];return _0x5a764f;};'use strict';var Sequelize=require(_0xa303('0x0'));module['exports']={'name':{'type':Sequelize[_0xa303('0x1')],'unique':_0xa303('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa303('0x1')]},'dialPrefix':{'type':Sequelize[_0xa303('0x1')]}}; \ No newline at end of file +var _0x782e=['name','STRING'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x782e,0xb9));var _0xe782=function(_0x130116,_0x27c836){_0x130116=_0x130116-0x0;var _0x4ab034=_0x782e[_0x130116];return _0x4ab034;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe782('0x0')],'unique':_0xe782('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xe782('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 83c1e03..01454da 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 _0x5da0=['order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','include','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','update','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','CustomFields','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','CmCustomField','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','c.cf_','customField_','alias','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./cmList.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x5da0,0x10e));var _0x05da=function(_0x4dd34e,_0x1c94f6){_0x4dd34e=_0x4dd34e-0x0;var _0x7339d=_0x5da0[_0x4dd34e];return _0x7339d;};'use strict';var emlformat=require(_0x05da('0x0'));var rimraf=require(_0x05da('0x1'));var zipdir=require(_0x05da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x05da('0x3'));var BPromise=require(_0x05da('0x4'));var Mustache=require(_0x05da('0x5'));var util=require(_0x05da('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x05da('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05da('0x8'));var squel=require(_0x05da('0x9'));var crypto=require(_0x05da('0xa'));var jsforce=require(_0x05da('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x05da('0xc'));var Papa=require(_0x05da('0xd'));var Redis=require(_0x05da('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x05da('0xf'));var as=require(_0x05da('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05da('0x11'))('api');var utils=require(_0x05da('0x12'));var config=require(_0x05da('0x13'));var licenseUtil=require(_0x05da('0x14'));var db=require(_0x05da('0x15'))['db'];var csv_results;config[_0x05da('0x16')]=_[_0x05da('0x17')](config[_0x05da('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x05da('0x18'))[_0x05da('0x19')](socket);function respondWithStatusCode(_0x4356f1,_0x53728e){_0x53728e=_0x53728e||0xcc;return function(_0x4baef1){if(_0x4baef1){return _0x4356f1['sendStatus'](_0x53728e);}return _0x4356f1['status'](_0x53728e)[_0x05da('0x1a')]();};}function respondWithResult(_0x56689c,_0x31bf27){_0x31bf27=_0x31bf27||0xc8;return function(_0x586112){if(_0x586112){return _0x56689c[_0x05da('0x1b')](_0x31bf27)[_0x05da('0x1c')](_0x586112);}};}function respondWithFilteredResult(_0x5adc73,_0x47743f){return function(_0x60cb4){if(_0x60cb4){var _0x2c6936=typeof _0x47743f[_0x05da('0x1d')]===_0x05da('0x1e')&&typeof _0x47743f[_0x05da('0x1f')]===_0x05da('0x1e');var _0x130125=_0x60cb4['count'];var _0x528a9f=_0x2c6936?0x0:_0x47743f[_0x05da('0x1d')];var _0x4892e3=_0x2c6936?_0x60cb4[_0x05da('0x20')]:_0x47743f[_0x05da('0x1d')]+_0x47743f[_0x05da('0x1f')];var _0x3d15d2;if(_0x4892e3>=_0x130125){_0x4892e3=_0x130125;_0x3d15d2=0xc8;}else{_0x3d15d2=0xce;}_0x5adc73[_0x05da('0x1b')](_0x3d15d2);return _0x5adc73['set'](_0x05da('0x21'),_0x528a9f+'-'+_0x4892e3+'/'+_0x130125)[_0x05da('0x1c')](_0x60cb4);}return null;};}function patchUpdates(_0x1729d7){return function(_0x3a6719){try{jsonpatch['apply'](_0x3a6719,_0x1729d7,!![]);}catch(_0x1bfd5c){return BPromise[_0x05da('0x22')](_0x1bfd5c);}return _0x3a6719[_0x05da('0x23')]();};}function saveUpdates(_0x299199,_0x109804){return function(_0x155937){if(_0x155937){return _0x155937['update'](_0x299199)[_0x05da('0x24')](function(_0x86c5aa){return _0x86c5aa;});}return null;};}function removeEntity(_0x24af41,_0x6f85de){return function(_0xe8cf3b){if(_0xe8cf3b){return _0xe8cf3b[_0x05da('0x25')]()[_0x05da('0x24')](function(){var _0x4b07fa=_0xe8cf3b[_0x05da('0x26')]({'plain':!![]});var _0x4aa9a0=_0x05da('0x27');return db[_0x05da('0x28')]['destroy']({'where':{'type':_0x4aa9a0,'resourceId':_0x4b07fa['id']}})[_0x05da('0x24')](function(){return _0xe8cf3b;});})[_0x05da('0x24')](function(){_0x24af41[_0x05da('0x1b')](0xcc)[_0x05da('0x1a')]();});}};}function handleEntityNotFound(_0x989e46,_0x16b29b){return function(_0x652af5){if(!_0x652af5){_0x989e46['sendStatus'](0x194);}return _0x652af5;};}function handleError(_0x31a273,_0x4e9beb){_0x4e9beb=_0x4e9beb||0x1f4;return function(_0x491a6b){logger[_0x05da('0x29')](_0x491a6b[_0x05da('0x2a')]);if(_0x491a6b[_0x05da('0x2b')]){delete _0x491a6b['name'];}_0x31a273['status'](_0x4e9beb)[_0x05da('0x2c')](_0x491a6b);};}exports[_0x05da('0x2d')]=function(_0x563fca,_0x10d948){var _0x371a54={},_0x558eb6={},_0x39924b={'count':0x0,'rows':[]};var _0x10be6c=_[_0x05da('0x2e')](db[_0x05da('0x2f')][_0x05da('0x30')],function(_0x206ffb){return{'name':_0x206ffb[_0x05da('0x31')],'type':_0x206ffb[_0x05da('0x32')][_0x05da('0x33')]};});_0x558eb6[_0x05da('0x34')]=_[_0x05da('0x2e')](_0x10be6c,_0x05da('0x2b'));_0x558eb6[_0x05da('0x35')]=_[_0x05da('0x36')](_0x563fca[_0x05da('0x35')]);_0x558eb6[_0x05da('0x37')]=_[_0x05da('0x38')](_0x558eb6[_0x05da('0x34')],_0x558eb6[_0x05da('0x35')]);_0x371a54[_0x05da('0x39')]=_[_0x05da('0x38')](_0x558eb6[_0x05da('0x34')],qs[_0x05da('0x3a')](_0x563fca[_0x05da('0x35')]['fields']));_0x371a54[_0x05da('0x39')]=_0x371a54[_0x05da('0x39')][_0x05da('0x3b')]?_0x371a54[_0x05da('0x39')]:_0x558eb6[_0x05da('0x34')];if(!_0x563fca[_0x05da('0x35')][_0x05da('0x3c')](_0x05da('0x3d'))){_0x371a54[_0x05da('0x1f')]=qs[_0x05da('0x1f')](_0x563fca[_0x05da('0x35')][_0x05da('0x1f')]);_0x371a54[_0x05da('0x1d')]=qs[_0x05da('0x1d')](_0x563fca[_0x05da('0x35')]['offset']);}_0x371a54[_0x05da('0x3e')]=qs[_0x05da('0x3f')](_0x563fca['query'][_0x05da('0x3f')]);_0x371a54[_0x05da('0x40')]=qs[_0x05da('0x37')](_[_0x05da('0x41')](_0x563fca['query'],_0x558eb6[_0x05da('0x37')]),_0x10be6c);if(_0x563fca[_0x05da('0x35')][_0x05da('0x42')]){_0x371a54[_0x05da('0x40')]=_[_0x05da('0x43')](_0x371a54[_0x05da('0x40')],{'$or':_[_0x05da('0x2e')](_0x10be6c,function(_0x5ae4a8){if(_0x5ae4a8[_0x05da('0x32')]!=='VIRTUAL'){var _0x24a81f={};_0x24a81f[_0x5ae4a8[_0x05da('0x2b')]]={'$like':'%'+_0x563fca['query'][_0x05da('0x42')]+'%'};return _0x24a81f;}})});}_0x371a54=_[_0x05da('0x43')]({},_0x371a54,_0x563fca[_0x05da('0x44')]);var _0x287932={'where':_0x371a54['where']};return db[_0x05da('0x2f')][_0x05da('0x20')](_0x287932)['then'](function(_0x55f8c8){_0x39924b[_0x05da('0x20')]=_0x55f8c8;if(_0x563fca[_0x05da('0x35')][_0x05da('0x45')]){_0x371a54['include']=[{'all':!![]}];}return db[_0x05da('0x2f')]['findAll'](_0x371a54);})['then'](function(_0x39a23c){_0x39924b[_0x05da('0x46')]=_0x39a23c;return _0x39924b;})['then'](respondWithFilteredResult(_0x10d948,_0x371a54))[_0x05da('0x47')](handleError(_0x10d948,null));};exports[_0x05da('0x48')]=function(_0x1150fd,_0x33f7ae){var _0x53d5ac={'raw':![],'where':{'id':_0x1150fd['params']['id']}},_0x33972e={};_0x33972e[_0x05da('0x34')]=_[_0x05da('0x36')](db['CmList'][_0x05da('0x30')]);_0x33972e[_0x05da('0x35')]=_['keys'](_0x1150fd['query']);_0x33972e['filters']=_['intersection'](_0x33972e[_0x05da('0x34')],_0x33972e['query']);_0x53d5ac[_0x05da('0x39')]=_[_0x05da('0x38')](_0x33972e['model'],qs[_0x05da('0x3a')](_0x1150fd[_0x05da('0x35')]['fields']));_0x53d5ac[_0x05da('0x39')]=_0x53d5ac['attributes']['length']?_0x53d5ac[_0x05da('0x39')]:_0x33972e[_0x05da('0x34')];if(_0x1150fd[_0x05da('0x35')][_0x05da('0x45')]){_0x53d5ac[_0x05da('0x49')]=[{'all':!![]}];}_0x53d5ac=_[_0x05da('0x43')]({},_0x53d5ac,_0x1150fd[_0x05da('0x44')]);return db[_0x05da('0x2f')][_0x05da('0x4a')](_0x53d5ac)[_0x05da('0x24')](handleEntityNotFound(_0x33f7ae,null))[_0x05da('0x24')](respondWithResult(_0x33f7ae,null))[_0x05da('0x47')](handleError(_0x33f7ae,null));};exports[_0x05da('0x4b')]=function(_0x4084e2,_0x12b1f1){return db['CmList'][_0x05da('0x4b')](_0x4084e2[_0x05da('0x4c')],{})[_0x05da('0x24')](function(_0x5d89af){var _0xa52d7=_0x4084e2[_0x05da('0x4d')][_0x05da('0x26')]({'plain':!![]});if(!_0xa52d7)throw new Error(_0x05da('0x4e'));if(_0xa52d7[_0x05da('0x4f')]===_0x05da('0x4d')){var _0x53e02f=_0x5d89af[_0x05da('0x26')]({'plain':!![]});var _0x58f33e=_0x05da('0x27');return db[_0x05da('0x50')]['find']({'where':{'name':_0x58f33e,'userProfileId':_0xa52d7[_0x05da('0x51')]},'raw':!![]})[_0x05da('0x24')](function(_0x4c7fdf){if(_0x4c7fdf&&_0x4c7fdf[_0x05da('0x52')]===0x0){return db[_0x05da('0x28')][_0x05da('0x4b')]({'name':_0x53e02f[_0x05da('0x2b')],'resourceId':_0x53e02f['id'],'type':_0x4c7fdf['name'],'sectionId':_0x4c7fdf['id']},{})[_0x05da('0x24')](function(){return _0x5d89af;});}else{return _0x5d89af;}})['catch'](function(_0x3aea5c){logger[_0x05da('0x29')](_0x05da('0x53'),_0x3aea5c);throw _0x3aea5c;});}return _0x5d89af;})['then'](respondWithResult(_0x12b1f1,0xc9))[_0x05da('0x47')](handleError(_0x12b1f1,null));};exports[_0x05da('0x54')]=function(_0x5f1034,_0x5d0b33){if(_0x5f1034[_0x05da('0x4c')]['id']){delete _0x5f1034[_0x05da('0x4c')]['id'];}return db[_0x05da('0x2f')][_0x05da('0x4a')]({'where':{'id':_0x5f1034[_0x05da('0x55')]['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x5d0b33,null))[_0x05da('0x24')](saveUpdates(_0x5f1034[_0x05da('0x4c')],null))[_0x05da('0x24')](respondWithResult(_0x5d0b33,null))[_0x05da('0x47')](handleError(_0x5d0b33,null));};exports[_0x05da('0x25')]=function(_0x41d7d8,_0x2aade8){return db[_0x05da('0x2f')][_0x05da('0x4a')]({'where':{'id':_0x41d7d8['params']['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x2aade8,null))[_0x05da('0x24')](removeEntity(_0x2aade8,null))['catch'](handleError(_0x2aade8,null));};exports[_0x05da('0x56')]=function(_0x375852,_0x4c18c4){return db['CmList'][_0x05da('0x56')]()[_0x05da('0x24')](respondWithResult(_0x4c18c4,null))[_0x05da('0x47')](handleError(_0x4c18c4,null));};exports[_0x05da('0x57')]=function(_0x128473,_0x422f99,_0x4e692c){if(_0x128473[_0x05da('0x4c')]['id']){delete _0x128473[_0x05da('0x4c')]['id'];}return db['CmList'][_0x05da('0x4a')]({'where':{'id':_0x128473[_0x05da('0x55')]['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x422f99,null))['then'](function(_0x39a621){if(_0x39a621){_0x128473[_0x05da('0x4c')][_0x05da('0x58')]=_0x39a621['id'];return db[_0x05da('0x59')][_0x05da('0x4b')](_0x128473['body']);}})[_0x05da('0x24')](respondWithResult(_0x422f99,null))[_0x05da('0x47')](handleError(_0x422f99,null));};exports[_0x05da('0x5a')]=function(_0x37a409,_0x48bc3d,_0x1c19ff){var _0x111f01={'raw':![],'where':{}};var _0xe02c38={};var _0xaeb98b={'count':0x0,'rows':[]};return db[_0x05da('0x2f')][_0x05da('0x5b')]({'where':{'id':_0x37a409[_0x05da('0x55')]['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x48bc3d,null))['then'](function(_0xeb0fd4){if(_0xeb0fd4){_0xe02c38[_0x05da('0x34')]=_['keys'](db[_0x05da('0x59')][_0x05da('0x30')]);_0xe02c38[_0x05da('0x35')]=_[_0x05da('0x36')](_0x37a409[_0x05da('0x35')]);_0xe02c38[_0x05da('0x37')]=_[_0x05da('0x38')](_0xe02c38[_0x05da('0x34')],_0xe02c38[_0x05da('0x35')]);_0x111f01[_0x05da('0x39')]=_[_0x05da('0x38')](_0xe02c38[_0x05da('0x34')],qs[_0x05da('0x3a')](_0x37a409[_0x05da('0x35')]['fields']));_0x111f01[_0x05da('0x39')]=_0x111f01[_0x05da('0x39')][_0x05da('0x3b')]?_0x111f01['attributes']:_0xe02c38[_0x05da('0x34')];if(!_0x37a409[_0x05da('0x35')][_0x05da('0x3c')](_0x05da('0x3d'))){_0x111f01['limit']=qs[_0x05da('0x1f')](_0x37a409[_0x05da('0x35')][_0x05da('0x1f')]);_0x111f01[_0x05da('0x1d')]=qs[_0x05da('0x1d')](_0x37a409['query'][_0x05da('0x1d')]);}_0x111f01[_0x05da('0x3e')]=qs[_0x05da('0x3f')](_0x37a409[_0x05da('0x35')]['sort']);_0x111f01['where']=qs[_0x05da('0x37')](_[_0x05da('0x41')](_0x37a409[_0x05da('0x35')],_0xe02c38['filters']));_0x111f01['where']['ListId']=_0xeb0fd4['id'];if(_0x37a409[_0x05da('0x35')]['filter']){_0x111f01[_0x05da('0x40')]=_[_0x05da('0x43')](_0x111f01[_0x05da('0x40')],{'$or':_[_0x05da('0x2e')](_0x111f01[_0x05da('0x39')],function(_0x5dfe91){var _0xa44d5f={};_0xa44d5f[_0x5dfe91]={'$like':'%'+_0x37a409[_0x05da('0x35')]['filter']+'%'};return _0xa44d5f;})});}_0x111f01=_[_0x05da('0x43')]({},_0x111f01,_0x37a409[_0x05da('0x44')]);return db['Disposition'][_0x05da('0x20')]({'where':_0x111f01[_0x05da('0x40')]})[_0x05da('0x24')](function(_0x3662da){_0xaeb98b[_0x05da('0x20')]=_0x3662da;if(_0x37a409[_0x05da('0x35')][_0x05da('0x45')]){_0x111f01[_0x05da('0x49')]=[{'all':!![]}];}return db[_0x05da('0x59')][_0x05da('0x5c')](_0x111f01);})['then'](function(_0x58b0a5){_0xaeb98b[_0x05da('0x46')]=_0x58b0a5;return _0xaeb98b;});}})[_0x05da('0x24')](respondWithFilteredResult(_0x48bc3d,_0x111f01))[_0x05da('0x47')](handleError(_0x48bc3d,null));};exports[_0x05da('0x5d')]=function(_0x35d5bc,_0x59a9ad,_0x313be9){return db[_0x05da('0x2f')][_0x05da('0x4a')]({'where':{'id':_0x35d5bc[_0x05da('0x55')]['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x59a9ad,null))[_0x05da('0x24')](function(_0x3809c3){if(_0x3809c3){return _0x3809c3[_0x05da('0x5d')](_0x35d5bc[_0x05da('0x35')][_0x05da('0x5e')]);}})[_0x05da('0x24')](respondWithStatusCode(_0x59a9ad,null))[_0x05da('0x47')](handleError(_0x59a9ad,null));};exports[_0x05da('0x5f')]=function(_0x41990e,_0x18b814,_0x4cfa78){return db[_0x05da('0x2f')][_0x05da('0x4a')]({'where':{'id':_0x41990e[_0x05da('0x55')]['id']}})['then'](handleEntityNotFound(_0x18b814,null))['then'](function(_0x607ef2){if(_0x607ef2){var _0x2986a4=[];var _0x1420b0={'success':[],'errors':[]};return db[_0x05da('0x60')][_0x05da('0x56')]()[_0x05da('0x24')](function(_0x57555e){if(_0x41990e[_0x05da('0x4c')]['tags']&&_[_0x05da('0x61')](_0x41990e[_0x05da('0x4c')]['tags'])){if(_0x41990e[_0x05da('0x4c')][_0x05da('0x62')][_0x05da('0x3b')]){_0x41990e[_0x05da('0x4c')][_0x05da('0x62')]=_0x41990e[_0x05da('0x4c')][_0x05da('0x62')]['join'](';')+';';}else{_0x41990e[_0x05da('0x4c')][_0x05da('0x62')]=null;}}else{_0x41990e['body'][_0x05da('0x62')]=null;}if(_0x41990e[_0x05da('0x4c')]&&_['isArray'](_0x41990e[_0x05da('0x4c')])){for(var _0x2297af=0x0;_0x2297af<_0x41990e['body'][_0x05da('0x3b')];_0x2297af+=0x1){_0x41990e[_0x05da('0x4c')][_0x2297af][_0x05da('0x58')]=_0x41990e[_0x05da('0x55')]['id'];_0x2986a4[_0x05da('0x63')](_0x41990e[_0x05da('0x4c')][_0x2297af]);}return BPromise[_0x05da('0x64')](_0x2986a4,function(_0x110f88){return db[_0x05da('0x60')][_0x05da('0x4b')](_['omit'](_0x110f88,[_0x05da('0x5e'),'id'])||{},{'fields':_['keys'](_0x57555e),'raw':!![]})[_0x05da('0x24')](function(_0x549cee){_0x1420b0[_0x05da('0x65')][_0x05da('0x63')](_0x549cee[_0x05da('0x66')]);})[_0x05da('0x47')](function(_0x25acbc){_0x1420b0[_0x05da('0x67')][_0x05da('0x63')]({'data':_0x110f88,'error':_0x25acbc[_0x05da('0x68')]});});})['then'](function(_0x1604e7){return _0x1420b0;})[_0x05da('0x47')](function(_0x43047b){return _0x43047b;});}else{_0x18b814[_0x05da('0x1b')](0x190)[_0x05da('0x1c')]({'message':_0x05da('0x69')});}});}})['then'](respondWithResult(_0x18b814,null))[_0x05da('0x47')](handleError(_0x18b814,null));};exports['getContacts']=function(_0x300826,_0x488e3d,_0xed7aa0){var _0x3b6d67;return db[_0x05da('0x2f')][_0x05da('0x4a')]({'where':{'id':_0x300826[_0x05da('0x55')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x05da('0x6a')}]})['then'](handleEntityNotFound(_0x488e3d,null))['then'](function(_0x566ecf){if(_0x566ecf){_0x3b6d67=_0x566ecf;return db['CmContact'][_0x05da('0x30')];}})[_0x05da('0x24')](function(_0x471fc4){if(_0x471fc4){var _0x3f99f7={};var _0x5a13e9={};_0x5a13e9['model']=_['concat'](_['keys'](_0x471fc4),_['map'](_0x3b6d67[_0x05da('0x6a')],function(_0x3caa1b){return util['format'](_0x05da('0x6b'),_0x3caa1b['id']);}));_0x5a13e9[_0x05da('0x35')]=_[_0x05da('0x36')](_0x300826[_0x05da('0x35')]);_0x5a13e9[_0x05da('0x37')]=_[_0x05da('0x38')](_0x5a13e9[_0x05da('0x34')],_0x5a13e9[_0x05da('0x35')]);_0x3f99f7[_0x05da('0x39')]=_[_0x05da('0x38')](_0x5a13e9['model'],qs['fields'](_0x300826['query'][_0x05da('0x3a')]));_0x3f99f7[_0x05da('0x39')]=_0x3f99f7[_0x05da('0x39')]['length']?_0x3f99f7[_0x05da('0x39')]:_0x5a13e9[_0x05da('0x34')];if(!_0x300826[_0x05da('0x35')]['hasOwnProperty'](_0x05da('0x3d'))){_0x3f99f7[_0x05da('0x1f')]=qs[_0x05da('0x1f')](_0x300826['query'][_0x05da('0x1f')]);_0x3f99f7['offset']=qs[_0x05da('0x1d')](_0x300826[_0x05da('0x35')][_0x05da('0x1d')]);}_0x3f99f7[_0x05da('0x3e')]=qs[_0x05da('0x3f')](_0x300826[_0x05da('0x35')][_0x05da('0x3f')]);_0x3f99f7[_0x05da('0x40')]=qs[_0x05da('0x37')](_[_0x05da('0x41')](_0x300826[_0x05da('0x35')],_0x5a13e9[_0x05da('0x37')]));_0x3f99f7[_0x05da('0x6c')]=!![];if(_0x300826['query'][_0x05da('0x42')]){_0x3f99f7['where']=_[_0x05da('0x43')](_0x3f99f7[_0x05da('0x40')],{'$or':_[_0x05da('0x2e')](_0x3f99f7[_0x05da('0x39')],function(_0x5951a4){var _0x2a1507={};_0x2a1507[_0x5951a4]={'$like':'%'+_0x300826[_0x05da('0x35')][_0x05da('0x42')]+'%'};return _0x2a1507;})});}_0x3f99f7=_[_0x05da('0x43')]({},_0x3f99f7,_0x300826['options']);return _0x3b6d67[_0x05da('0x6d')](_0x3f99f7);}})[_0x05da('0x24')](respondWithResult(_0x488e3d,null))['catch'](handleError(_0x488e3d,null));};exports[_0x05da('0x6e')]=function(_0x39ff63,_0x1f4f13,_0x865916){var _0x423e88;var _0x1c6996;var _0x5d0a71;var _0x327927=_0x39ff63[_0x05da('0x55')]['id'];csv_results=[];return db[_0x05da('0x6f')][_0x05da('0x5c')]({'attributes':['id',_0x05da('0x2b')],'raw':!![],'order':[_0x05da('0x70')]})['then'](function(_0x42ae49){_0x423e88=_0x42ae49;var _0x12d7b6=_[_0x05da('0x36')](db[_0x05da('0x60')][_0x05da('0x30')]);return db[_0x05da('0x71')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0x05da('0x24')](function(_0x37a2ef){_0x1c6996=_0x37a2ef;var _0x43a961=squel[_0x05da('0x72')]()['fields'](_0x12d7b6)[_0x05da('0x73')](_0x05da('0x74'),'c')[_0x05da('0x40')](_0x05da('0x75'),_0x327927)[_0x05da('0x40')](_0x05da('0x76'))['distinct']();for(var _0x3a6871=0x0;_0x3a6871<_0x1c6996[_0x05da('0x3b')];_0x3a6871++){_0x43a961['field'](_0x05da('0x77')+_0x1c6996[_0x3a6871]['id'],_0x05da('0x78')+_0x1c6996[_0x3a6871][_0x05da('0x79')]);}for(var _0x3a6871=0x0;_0x3a6871<_0x423e88[_0x05da('0x3b')];_0x3a6871++){_0x43a961[_0x05da('0x7a')](squel[_0x05da('0x72')]()[_0x05da('0x7a')](_0x05da('0x7b'))[_0x05da('0x73')](_0x05da('0x7c'))[_0x05da('0x40')](_0x05da('0x7d'),_0x423e88[_0x3a6871]['id'])[_0x05da('0x40')](_0x05da('0x7e')),_0x05da('0x7f')+_0x423e88[_0x3a6871][_0x05da('0x2b')]);_0x43a961['field'](squel['select']()[_0x05da('0x7a')]('description')[_0x05da('0x73')](_0x05da('0x7c'))[_0x05da('0x40')]('ItemTypeId\x20=\x20?',_0x423e88[_0x3a6871]['id'])['where']('CmContactId\x20=\x20c.id'),_0x05da('0x80')+_0x423e88[_0x3a6871][_0x05da('0x2b')]);}var _0x31a40a=[];_0x31a40a[_0x05da('0x63')](_0x43a961['toString']());BPromise['each'](_0x31a40a,handleQuery)['then'](function(_0x3787bd){handleQuery(_0x43a961[_0x05da('0x81')]());var _0x48fcee=csv_results[0x0];if(!_[_0x05da('0x82')](_0x48fcee)){var _0x4f4986=toCsv(_0x48fcee);var _0x1581b2=Date['now']();fs[_0x05da('0x83')](util[_0x05da('0x84')](_0x05da('0x85'),_0x327927,_0x1581b2),_0x4f4986);_0x1f4f13['setHeader'](_0x05da('0x86'),_0x05da('0x87')+util[_0x05da('0x84')](_0x05da('0x88'),_0x327927,_0x1581b2));_0x1f4f13[_0x05da('0x89')](_0x05da('0x8a'),_0x05da('0x8b'));return _0x1f4f13[_0x05da('0x8c')](util['format']('/tmp/list_%d_%s.csv',_0x327927,_0x1581b2));}else{return _0x1f4f13[_0x05da('0x8d')](0xcc);}});});});};exports[_0x05da('0x8e')]=function(_0x1c967e,_0x58d9ca,_0x174335){var _0x17acfa;delete _0x1c967e[_0x05da('0x4c')]['id'];return db[_0x05da('0x2f')]['findOne']({'where':{'id':_0x1c967e[_0x05da('0x55')]['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x58d9ca,null))[_0x05da('0x24')](function(_0x2a4385){if(_0x2a4385){return db[_0x05da('0x8f')][_0x05da('0x90')](function(_0x24e773){return db[_0x05da('0x71')][_0x05da('0x4b')](_0x1c967e[_0x05da('0x4c')],{'transaction':_0x24e773})[_0x05da('0x24')](function(_0x56c8e8){_0x17acfa=_0x56c8e8;return _0x2a4385['addCustomFields'](_0x56c8e8,{'transaction':_0x24e773});})[_0x05da('0x24')](function(){var _0x31b96c={'type':db['Sequelize'][_0x05da('0x91')],'transaction':_0x24e773};switch(_0x1c967e[_0x05da('0x4c')][_0x05da('0x32')]){case _0x05da('0x92'):_0x31b96c[_0x05da('0x32')]=db[_0x05da('0x93')][_0x05da('0x91')];break;case _0x05da('0x94'):_0x31b96c[_0x05da('0x32')]=db[_0x05da('0x93')][_0x05da('0x95')];break;case _0x05da('0x96'):_0x31b96c[_0x05da('0x32')]=db[_0x05da('0x93')][_0x05da('0x97')];_0x31b96c[_0x05da('0x98')]=![];break;default:}return db['sequelize'][_0x05da('0x99')][_0x05da('0x9a')]('cm_contacts',util[_0x05da('0x84')]('cf_%s',_0x17acfa['id']),_0x31b96c);})['then'](function(){return _0x17acfa;});});}})['then'](respondWithResult(_0x58d9ca,null))[_0x05da('0x47')](handleError(_0x58d9ca,null));};exports[_0x05da('0x9b')]=function(_0x10b883,_0x335475,_0x586fea){var _0x5ae5c1={};var _0x37387d={};var _0x429eff;var _0x389763;return db[_0x05da('0x2f')][_0x05da('0x5b')]({'where':{'id':_0x10b883[_0x05da('0x55')]['id']}})['then'](handleEntityNotFound(_0x335475,null))[_0x05da('0x24')](function(_0x27a6d8){if(_0x27a6d8){_0x429eff=_0x27a6d8;_0x37387d[_0x05da('0x34')]=_[_0x05da('0x36')](db['CmCustomField'][_0x05da('0x30')]);_0x37387d['query']=_[_0x05da('0x36')](_0x10b883['query']);_0x37387d['filters']=_['intersection'](_0x37387d[_0x05da('0x34')],_0x37387d[_0x05da('0x35')]);_0x5ae5c1[_0x05da('0x39')]=_[_0x05da('0x38')](_0x37387d['model'],qs[_0x05da('0x3a')](_0x10b883[_0x05da('0x35')][_0x05da('0x3a')]));_0x5ae5c1['attributes']=_0x5ae5c1[_0x05da('0x39')]['length']?_0x5ae5c1['attributes']:_0x37387d[_0x05da('0x34')];_0x5ae5c1['order']=qs[_0x05da('0x3f')](_0x10b883[_0x05da('0x35')][_0x05da('0x3f')]);_0x5ae5c1['where']=qs[_0x05da('0x37')](_[_0x05da('0x41')](_0x10b883[_0x05da('0x35')],_0x37387d[_0x05da('0x37')]));_0x5ae5c1[_0x05da('0x40')]=_[_0x05da('0x43')](_0x5ae5c1['where'],{'$or':[{'ListId':_0x27a6d8['id']},{'ListId':null}]});if(_0x10b883['query'][_0x05da('0x42')]){_0x5ae5c1[_0x05da('0x40')]=_[_0x05da('0x43')](_0x5ae5c1[_0x05da('0x40')],{'$or':_[_0x05da('0x2e')](_0x5ae5c1[_0x05da('0x39')],function(_0x55400b){var _0x3f1a0c={};_0x3f1a0c[_0x55400b]={'$like':'%'+_0x10b883[_0x05da('0x35')][_0x05da('0x42')]+'%'};return _0x3f1a0c;})});}_0x5ae5c1=_[_0x05da('0x43')]({},_0x5ae5c1,_0x10b883['options']);return db[_0x05da('0x71')][_0x05da('0x9c')](_0x5ae5c1);}})[_0x05da('0x24')](respondWithResult(_0x335475,null))['catch'](handleError(_0x335475,null));};exports[_0x05da('0x9d')]=function(_0x375d6,_0x4689c5){return db[_0x05da('0x71')]['findAndCountAll']({'where':{'ListId':null}})[_0x05da('0x24')](handleEntityNotFound(_0x4689c5,null))[_0x05da('0x24')](function(_0x1a7ad2){return _0x1a7ad2;})[_0x05da('0x24')](respondWithResult(_0x4689c5,null))[_0x05da('0x47')](handleError(_0x4689c5,null));};exports[_0x05da('0x9e')]=function(_0xd394b4,_0xea792b,_0x213746){return db['CmList'][_0x05da('0x4a')]({'where':{'id':_0xd394b4['params']['id']}})[_0x05da('0x24')](handleEntityNotFound(_0xea792b,null))[_0x05da('0x24')](function(_0x365147){if(_0x365147){return _0x365147[_0x05da('0x9e')](_0xd394b4[_0x05da('0x4c')]['ids'],_[_0x05da('0x9f')](_0xd394b4[_0x05da('0x4c')],['ids','id'])||{})[_0x05da('0xa0')](function(_0x379fa2){for(var _0x59c949=0x0;_0x59c949<_0xd394b4[_0x05da('0x4c')][_0x05da('0x5e')][_0x05da('0x3b')];_0x59c949+=0x1){socket[_0x05da('0xa1')]('userCmList:save',{'UserId':Number(_0xd394b4['body'][_0x05da('0x5e')][_0x59c949]),'CmListId':Number(_0xd394b4[_0x05da('0x55')]['id'])});}return _0x379fa2;});}})[_0x05da('0x24')](respondWithResult(_0xea792b,null))[_0x05da('0x47')](handleError(_0xea792b,null));};exports[_0x05da('0xa2')]=function(_0x2d41d8,_0x112116,_0x545c79){return db[_0x05da('0x2f')][_0x05da('0x4a')]({'where':{'id':_0x2d41d8[_0x05da('0x55')]['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x112116,null))[_0x05da('0x24')](function(_0x3a2168){if(_0x3a2168){return _0x3a2168['removeAgents'](_0x2d41d8['query'][_0x05da('0x5e')])[_0x05da('0x24')](function(){if(_['isArray'](_0x2d41d8[_0x05da('0x35')]['ids'])){for(var _0x29936a=0x0;_0x29936a<_0x2d41d8[_0x05da('0x35')]['ids'][_0x05da('0x3b')];_0x29936a+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2d41d8[_0x05da('0x35')][_0x05da('0x5e')][_0x29936a]),'CmListId':Number(_0x2d41d8[_0x05da('0x55')]['id'])});}}else{socket[_0x05da('0xa1')](_0x05da('0xa3'),{'UserId':Number(_0x2d41d8['query']['ids']),'CmListId':Number(_0x2d41d8[_0x05da('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x112116,null))[_0x05da('0x47')](handleError(_0x112116,null));};exports[_0x05da('0xa4')]=function(_0x482541,_0x42c2ac,_0x460406){var _0x50d10f={};var _0x195094={};var _0x76abfc;var _0x3c43cc;return db[_0x05da('0x2f')][_0x05da('0x5b')]({'where':{'id':_0x482541[_0x05da('0x55')]['id']}})[_0x05da('0x24')](handleEntityNotFound(_0x42c2ac,null))['then'](function(_0x2c61d3){if(_0x2c61d3){_0x76abfc=_0x2c61d3;_0x195094[_0x05da('0x34')]=_['keys'](db[_0x05da('0xa5')][_0x05da('0x30')]);_0x195094[_0x05da('0x35')]=_[_0x05da('0x36')](_0x482541[_0x05da('0x35')]);_0x195094[_0x05da('0x37')]=_[_0x05da('0x38')](_0x195094[_0x05da('0x34')],_0x195094['query']);_0x50d10f[_0x05da('0x39')]=_[_0x05da('0x38')](_0x195094[_0x05da('0x34')],qs[_0x05da('0x3a')](_0x482541[_0x05da('0x35')][_0x05da('0x3a')]));_0x50d10f[_0x05da('0x39')]=_0x50d10f[_0x05da('0x39')]['length']?_0x50d10f[_0x05da('0x39')]:_0x195094[_0x05da('0x34')];_0x50d10f[_0x05da('0x3e')]=qs[_0x05da('0x3f')](_0x482541[_0x05da('0x35')]['sort']);_0x50d10f[_0x05da('0x40')]=qs[_0x05da('0x37')](_[_0x05da('0x41')](_0x482541[_0x05da('0x35')],_0x195094[_0x05da('0x37')]));if(_0x482541[_0x05da('0x35')][_0x05da('0x42')]){_0x50d10f[_0x05da('0x40')]=_[_0x05da('0x43')](_0x50d10f[_0x05da('0x40')],{'$or':_[_0x05da('0x2e')](_0x50d10f[_0x05da('0x39')],function(_0x27d0e1){var _0x5cba5f={};_0x5cba5f[_0x27d0e1]={'$like':'%'+_0x482541['query']['filter']+'%'};return _0x5cba5f;})});}_0x50d10f=_[_0x05da('0x43')]({},_0x50d10f,_0x482541['options']);return _0x76abfc[_0x05da('0xa4')](_0x50d10f);}})['then'](function(_0x4fc9cf){if(_0x4fc9cf){_0x3c43cc=_0x4fc9cf[_0x05da('0x3b')];if(!_0x482541[_0x05da('0x35')][_0x05da('0x3c')](_0x05da('0x3d'))){_0x50d10f[_0x05da('0x1f')]=qs[_0x05da('0x1f')](_0x482541['query']['limit']);_0x50d10f[_0x05da('0x1d')]=qs[_0x05da('0x1d')](_0x482541['query'][_0x05da('0x1d')]);}return _0x76abfc[_0x05da('0xa4')](_0x50d10f);}})[_0x05da('0x24')](function(_0x510cea){if(_0x510cea){return _0x510cea?{'count':_0x3c43cc,'rows':_0x510cea}:null;}})['then'](respondWithResult(_0x42c2ac,null))[_0x05da('0x47')](handleError(_0x42c2ac,null));};function handleQuery(_0x5424fc){logger['info'](_0x5424fc);return db['sequelize'][_0x05da('0x35')](_0x5424fc)[_0x05da('0xa0')](function(_0x409d01){csv_results[_0x05da('0x63')](_0x409d01);})['catch'](function(_0x5c06d0){logger['error'](_0x5c06d0[_0x05da('0x68')]);});} \ No newline at end of file +var _0xeb20=['addCustomFields','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','update','then','destroy','Lists','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','CmList','include','rows','show','params','keys','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','ListId','Disposition','getDispositions','findOne','pick','includeAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','omit','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','findAll','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','each','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction'];(function(_0x5c6326,_0xa9e41a){var _0x4e710d=function(_0x5eb236){while(--_0x5eb236){_0x5c6326['push'](_0x5c6326['shift']());}};_0x4e710d(++_0xa9e41a);}(_0xeb20,0x1ea));var _0x0eb2=function(_0x51c9e0,_0x29b308){_0x51c9e0=_0x51c9e0-0x0;var _0x4aa077=_0xeb20[_0x51c9e0];return _0x4aa077;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0eb2('0x0'));var zipdir=require(_0x0eb2('0x1'));var jsonpatch=require(_0x0eb2('0x2'));var rp=require(_0x0eb2('0x3'));var moment=require(_0x0eb2('0x4'));var BPromise=require(_0x0eb2('0x5'));var Mustache=require(_0x0eb2('0x6'));var util=require('util');var path=require(_0x0eb2('0x7'));var sox=require(_0x0eb2('0x8'));var csv=require(_0x0eb2('0x9'));var ejs=require(_0x0eb2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0eb2('0xb'));var squel=require(_0x0eb2('0xc'));var crypto=require('crypto');var jsforce=require(_0x0eb2('0xd'));var deskjs=require(_0x0eb2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0eb2('0xf'));var Papa=require(_0x0eb2('0x10'));var Redis=require(_0x0eb2('0x11'));var authService=require(_0x0eb2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0eb2('0x13'));var hardwareService=require(_0x0eb2('0x14'));var logger=require(_0x0eb2('0x15'))(_0x0eb2('0x16'));var utils=require('../../config/utils');var config=require(_0x0eb2('0x17'));var licenseUtil=require(_0x0eb2('0x18'));var db=require(_0x0eb2('0x19'))['db'];var csv_results;config[_0x0eb2('0x1a')]=_['defaults'](config[_0x0eb2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0eb2('0x1b'))(new Redis(config[_0x0eb2('0x1a')]));require('./cmList.socket')[_0x0eb2('0x1c')](socket);function respondWithStatusCode(_0x12e851,_0x5368ad){_0x5368ad=_0x5368ad||0xcc;return function(_0x3ba394){if(_0x3ba394){return _0x12e851[_0x0eb2('0x1d')](_0x5368ad);}return _0x12e851[_0x0eb2('0x1e')](_0x5368ad)[_0x0eb2('0x1f')]();};}function respondWithResult(_0xca150a,_0x564b7){_0x564b7=_0x564b7||0xc8;return function(_0x60dd66){if(_0x60dd66){return _0xca150a[_0x0eb2('0x1e')](_0x564b7)[_0x0eb2('0x20')](_0x60dd66);}};}function respondWithFilteredResult(_0x5e7d46,_0x537afd){return function(_0x4c6c98){if(_0x4c6c98){var _0x39e24f=typeof _0x537afd['offset']===_0x0eb2('0x21')&&typeof _0x537afd['limit']===_0x0eb2('0x21');var _0x5efbed=_0x4c6c98[_0x0eb2('0x22')];var _0x449dbe=_0x39e24f?0x0:_0x537afd['offset'];var _0x1cdb18=_0x39e24f?_0x4c6c98['count']:_0x537afd[_0x0eb2('0x23')]+_0x537afd[_0x0eb2('0x24')];var _0x167133;if(_0x1cdb18>=_0x5efbed){_0x1cdb18=_0x5efbed;_0x167133=0xc8;}else{_0x167133=0xce;}_0x5e7d46[_0x0eb2('0x1e')](_0x167133);return _0x5e7d46['set'](_0x0eb2('0x25'),_0x449dbe+'-'+_0x1cdb18+'/'+_0x5efbed)[_0x0eb2('0x20')](_0x4c6c98);}return null;};}function patchUpdates(_0x255320){return function(_0x4e2c7b){try{jsonpatch[_0x0eb2('0x26')](_0x4e2c7b,_0x255320,!![]);}catch(_0x41ec7a){return BPromise['reject'](_0x41ec7a);}return _0x4e2c7b['save']();};}function saveUpdates(_0x59a45f,_0x296bce){return function(_0x44e2fa){if(_0x44e2fa){return _0x44e2fa[_0x0eb2('0x27')](_0x59a45f)[_0x0eb2('0x28')](function(_0x5b620c){return _0x5b620c;});}return null;};}function removeEntity(_0x1fe20f,_0x4a981a){return function(_0x445036){if(_0x445036){return _0x445036[_0x0eb2('0x29')]()['then'](function(){var _0x1ad837=_0x445036['get']({'plain':!![]});var _0x51b5e6=_0x0eb2('0x2a');return db['UserProfileResource'][_0x0eb2('0x29')]({'where':{'type':_0x51b5e6,'resourceId':_0x1ad837['id']}})[_0x0eb2('0x28')](function(){return _0x445036;});})[_0x0eb2('0x28')](function(){_0x1fe20f[_0x0eb2('0x1e')](0xcc)[_0x0eb2('0x1f')]();});}};}function handleEntityNotFound(_0x565294,_0x44d978){return function(_0x16f333){if(!_0x16f333){_0x565294[_0x0eb2('0x1d')](0x194);}return _0x16f333;};}function handleError(_0x2fa558,_0x2ec35b){_0x2ec35b=_0x2ec35b||0x1f4;return function(_0x336458){logger[_0x0eb2('0x2b')](_0x336458[_0x0eb2('0x2c')]);if(_0x336458[_0x0eb2('0x2d')]){delete _0x336458[_0x0eb2('0x2d')];}_0x2fa558['status'](_0x2ec35b)[_0x0eb2('0x2e')](_0x336458);};}exports[_0x0eb2('0x2f')]=function(_0x148a95,_0xa72f26){var _0x52fc88={},_0x264e2c={},_0x4345d1={'count':0x0,'rows':[]};var _0x2194c7=_[_0x0eb2('0x30')](db['CmList'][_0x0eb2('0x31')],function(_0x10b521){return{'name':_0x10b521['fieldName'],'type':_0x10b521[_0x0eb2('0x32')][_0x0eb2('0x33')]};});_0x264e2c[_0x0eb2('0x34')]=_[_0x0eb2('0x30')](_0x2194c7,_0x0eb2('0x2d'));_0x264e2c[_0x0eb2('0x35')]=_['keys'](_0x148a95[_0x0eb2('0x35')]);_0x264e2c[_0x0eb2('0x36')]=_[_0x0eb2('0x37')](_0x264e2c[_0x0eb2('0x34')],_0x264e2c[_0x0eb2('0x35')]);_0x52fc88[_0x0eb2('0x38')]=_[_0x0eb2('0x37')](_0x264e2c['model'],qs[_0x0eb2('0x39')](_0x148a95['query'][_0x0eb2('0x39')]));_0x52fc88[_0x0eb2('0x38')]=_0x52fc88['attributes'][_0x0eb2('0x3a')]?_0x52fc88[_0x0eb2('0x38')]:_0x264e2c[_0x0eb2('0x34')];if(!_0x148a95['query'][_0x0eb2('0x3b')](_0x0eb2('0x3c'))){_0x52fc88[_0x0eb2('0x24')]=qs['limit'](_0x148a95[_0x0eb2('0x35')][_0x0eb2('0x24')]);_0x52fc88[_0x0eb2('0x23')]=qs['offset'](_0x148a95[_0x0eb2('0x35')][_0x0eb2('0x23')]);}_0x52fc88[_0x0eb2('0x3d')]=qs[_0x0eb2('0x3e')](_0x148a95[_0x0eb2('0x35')][_0x0eb2('0x3e')]);_0x52fc88[_0x0eb2('0x3f')]=qs[_0x0eb2('0x36')](_['pick'](_0x148a95[_0x0eb2('0x35')],_0x264e2c['filters']),_0x2194c7);if(_0x148a95[_0x0eb2('0x35')][_0x0eb2('0x40')]){_0x52fc88[_0x0eb2('0x3f')]=_[_0x0eb2('0x41')](_0x52fc88['where'],{'$or':_[_0x0eb2('0x30')](_0x2194c7,function(_0x3b3987){if(_0x3b3987['type']!=='VIRTUAL'){var _0x1d8363={};_0x1d8363[_0x3b3987['name']]={'$like':'%'+_0x148a95['query'][_0x0eb2('0x40')]+'%'};return _0x1d8363;}})});}_0x52fc88=_[_0x0eb2('0x41')]({},_0x52fc88,_0x148a95['options']);var _0x467a7a={'where':_0x52fc88[_0x0eb2('0x3f')]};return db[_0x0eb2('0x42')][_0x0eb2('0x22')](_0x467a7a)[_0x0eb2('0x28')](function(_0x49446f){_0x4345d1[_0x0eb2('0x22')]=_0x49446f;if(_0x148a95['query']['includeAll']){_0x52fc88[_0x0eb2('0x43')]=[{'all':!![]}];}return db[_0x0eb2('0x42')]['findAll'](_0x52fc88);})[_0x0eb2('0x28')](function(_0xdc622){_0x4345d1[_0x0eb2('0x44')]=_0xdc622;return _0x4345d1;})[_0x0eb2('0x28')](respondWithFilteredResult(_0xa72f26,_0x52fc88))['catch'](handleError(_0xa72f26,null));};exports[_0x0eb2('0x45')]=function(_0x5d9ba4,_0x3ba4f3){var _0x6fd2db={'raw':![],'where':{'id':_0x5d9ba4[_0x0eb2('0x46')]['id']}},_0x548d71={};_0x548d71['model']=_[_0x0eb2('0x47')](db['CmList'][_0x0eb2('0x31')]);_0x548d71[_0x0eb2('0x35')]=_[_0x0eb2('0x47')](_0x5d9ba4[_0x0eb2('0x35')]);_0x548d71['filters']=_['intersection'](_0x548d71[_0x0eb2('0x34')],_0x548d71[_0x0eb2('0x35')]);_0x6fd2db[_0x0eb2('0x38')]=_[_0x0eb2('0x37')](_0x548d71[_0x0eb2('0x34')],qs['fields'](_0x5d9ba4['query'][_0x0eb2('0x39')]));_0x6fd2db[_0x0eb2('0x38')]=_0x6fd2db['attributes'][_0x0eb2('0x3a')]?_0x6fd2db[_0x0eb2('0x38')]:_0x548d71[_0x0eb2('0x34')];if(_0x5d9ba4['query']['includeAll']){_0x6fd2db[_0x0eb2('0x43')]=[{'all':!![]}];}_0x6fd2db=_[_0x0eb2('0x41')]({},_0x6fd2db,_0x5d9ba4[_0x0eb2('0x48')]);return db[_0x0eb2('0x42')][_0x0eb2('0x49')](_0x6fd2db)[_0x0eb2('0x28')](handleEntityNotFound(_0x3ba4f3,null))[_0x0eb2('0x28')](respondWithResult(_0x3ba4f3,null))['catch'](handleError(_0x3ba4f3,null));};exports[_0x0eb2('0x4a')]=function(_0x1a5eed,_0x555337){return db[_0x0eb2('0x42')][_0x0eb2('0x4a')](_0x1a5eed[_0x0eb2('0x4b')],{})[_0x0eb2('0x28')](function(_0x49c2bd){var _0x3414d3=_0x1a5eed[_0x0eb2('0x4c')][_0x0eb2('0x4d')]({'plain':!![]});if(!_0x3414d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3414d3['role']===_0x0eb2('0x4c')){var _0xda9821=_0x49c2bd['get']({'plain':!![]});var _0x369d8a=_0x0eb2('0x2a');return db[_0x0eb2('0x4e')][_0x0eb2('0x49')]({'where':{'name':_0x369d8a,'userProfileId':_0x3414d3[_0x0eb2('0x4f')]},'raw':!![]})[_0x0eb2('0x28')](function(_0x5423b8){if(_0x5423b8&&_0x5423b8[_0x0eb2('0x50')]===0x0){return db[_0x0eb2('0x51')][_0x0eb2('0x4a')]({'name':_0xda9821[_0x0eb2('0x2d')],'resourceId':_0xda9821['id'],'type':_0x5423b8[_0x0eb2('0x2d')],'sectionId':_0x5423b8['id']},{})[_0x0eb2('0x28')](function(){return _0x49c2bd;});}else{return _0x49c2bd;}})['catch'](function(_0x17894d){logger['error'](_0x0eb2('0x52'),_0x17894d);throw _0x17894d;});}return _0x49c2bd;})[_0x0eb2('0x28')](respondWithResult(_0x555337,0xc9))[_0x0eb2('0x53')](handleError(_0x555337,null));};exports[_0x0eb2('0x27')]=function(_0x18bd45,_0x3a31e9){if(_0x18bd45[_0x0eb2('0x4b')]['id']){delete _0x18bd45[_0x0eb2('0x4b')]['id'];}return db[_0x0eb2('0x42')]['find']({'where':{'id':_0x18bd45[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x3a31e9,null))[_0x0eb2('0x28')](saveUpdates(_0x18bd45['body'],null))[_0x0eb2('0x28')](respondWithResult(_0x3a31e9,null))[_0x0eb2('0x53')](handleError(_0x3a31e9,null));};exports[_0x0eb2('0x29')]=function(_0x28fbe2,_0x2639cf){return db['CmList']['find']({'where':{'id':_0x28fbe2[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x2639cf,null))[_0x0eb2('0x28')](removeEntity(_0x2639cf,null))[_0x0eb2('0x53')](handleError(_0x2639cf,null));};exports[_0x0eb2('0x54')]=function(_0x1be7ee,_0x1b67ba){return db[_0x0eb2('0x42')]['describe']()['then'](respondWithResult(_0x1b67ba,null))[_0x0eb2('0x53')](handleError(_0x1b67ba,null));};exports['addDisposition']=function(_0x39370b,_0x49fa5d,_0x217e8b){if(_0x39370b['body']['id']){delete _0x39370b['body']['id'];}return db[_0x0eb2('0x42')][_0x0eb2('0x49')]({'where':{'id':_0x39370b[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x49fa5d,null))[_0x0eb2('0x28')](function(_0x4b4b88){if(_0x4b4b88){_0x39370b[_0x0eb2('0x4b')][_0x0eb2('0x55')]=_0x4b4b88['id'];return db[_0x0eb2('0x56')]['create'](_0x39370b[_0x0eb2('0x4b')]);}})[_0x0eb2('0x28')](respondWithResult(_0x49fa5d,null))[_0x0eb2('0x53')](handleError(_0x49fa5d,null));};exports[_0x0eb2('0x57')]=function(_0x207798,_0x58cb66,_0x58d899){var _0x4cdb1d={'raw':![],'where':{}};var _0x14644c={};var _0x2369d7={'count':0x0,'rows':[]};return db[_0x0eb2('0x42')][_0x0eb2('0x58')]({'where':{'id':_0x207798[_0x0eb2('0x46')]['id']}})['then'](handleEntityNotFound(_0x58cb66,null))[_0x0eb2('0x28')](function(_0x55c92c){if(_0x55c92c){_0x14644c[_0x0eb2('0x34')]=_[_0x0eb2('0x47')](db[_0x0eb2('0x56')]['rawAttributes']);_0x14644c[_0x0eb2('0x35')]=_[_0x0eb2('0x47')](_0x207798['query']);_0x14644c['filters']=_[_0x0eb2('0x37')](_0x14644c[_0x0eb2('0x34')],_0x14644c[_0x0eb2('0x35')]);_0x4cdb1d[_0x0eb2('0x38')]=_[_0x0eb2('0x37')](_0x14644c[_0x0eb2('0x34')],qs['fields'](_0x207798[_0x0eb2('0x35')][_0x0eb2('0x39')]));_0x4cdb1d['attributes']=_0x4cdb1d[_0x0eb2('0x38')][_0x0eb2('0x3a')]?_0x4cdb1d[_0x0eb2('0x38')]:_0x14644c[_0x0eb2('0x34')];if(!_0x207798[_0x0eb2('0x35')][_0x0eb2('0x3b')]('nolimit')){_0x4cdb1d[_0x0eb2('0x24')]=qs[_0x0eb2('0x24')](_0x207798['query'][_0x0eb2('0x24')]);_0x4cdb1d[_0x0eb2('0x23')]=qs['offset'](_0x207798['query'][_0x0eb2('0x23')]);}_0x4cdb1d[_0x0eb2('0x3d')]=qs[_0x0eb2('0x3e')](_0x207798[_0x0eb2('0x35')]['sort']);_0x4cdb1d['where']=qs[_0x0eb2('0x36')](_[_0x0eb2('0x59')](_0x207798[_0x0eb2('0x35')],_0x14644c[_0x0eb2('0x36')]));_0x4cdb1d[_0x0eb2('0x3f')][_0x0eb2('0x55')]=_0x55c92c['id'];if(_0x207798[_0x0eb2('0x35')][_0x0eb2('0x40')]){_0x4cdb1d['where']=_[_0x0eb2('0x41')](_0x4cdb1d[_0x0eb2('0x3f')],{'$or':_['map'](_0x4cdb1d['attributes'],function(_0x473d78){var _0x439c0c={};_0x439c0c[_0x473d78]={'$like':'%'+_0x207798[_0x0eb2('0x35')]['filter']+'%'};return _0x439c0c;})});}_0x4cdb1d=_[_0x0eb2('0x41')]({},_0x4cdb1d,_0x207798[_0x0eb2('0x48')]);return db['Disposition'][_0x0eb2('0x22')]({'where':_0x4cdb1d[_0x0eb2('0x3f')]})[_0x0eb2('0x28')](function(_0x5687c7){_0x2369d7[_0x0eb2('0x22')]=_0x5687c7;if(_0x207798[_0x0eb2('0x35')][_0x0eb2('0x5a')]){_0x4cdb1d[_0x0eb2('0x43')]=[{'all':!![]}];}return db[_0x0eb2('0x56')]['findAll'](_0x4cdb1d);})[_0x0eb2('0x28')](function(_0x22bb7e){_0x2369d7[_0x0eb2('0x44')]=_0x22bb7e;return _0x2369d7;});}})[_0x0eb2('0x28')](respondWithFilteredResult(_0x58cb66,_0x4cdb1d))[_0x0eb2('0x53')](handleError(_0x58cb66,null));};exports[_0x0eb2('0x5b')]=function(_0x5126f5,_0x1ef61c,_0x37b669){return db[_0x0eb2('0x42')][_0x0eb2('0x49')]({'where':{'id':_0x5126f5[_0x0eb2('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ef61c,null))[_0x0eb2('0x28')](function(_0x327656){if(_0x327656){return _0x327656[_0x0eb2('0x5b')](_0x5126f5[_0x0eb2('0x35')][_0x0eb2('0x5c')]);}})[_0x0eb2('0x28')](respondWithStatusCode(_0x1ef61c,null))[_0x0eb2('0x53')](handleError(_0x1ef61c,null));};exports[_0x0eb2('0x5d')]=function(_0x3c01cd,_0x57d29c,_0x40926c){return db[_0x0eb2('0x42')][_0x0eb2('0x49')]({'where':{'id':_0x3c01cd[_0x0eb2('0x46')]['id']}})['then'](handleEntityNotFound(_0x57d29c,null))['then'](function(_0x57f18d){if(_0x57f18d){var _0x275396=[];var _0x4ec27b={'success':[],'errors':[]};return db[_0x0eb2('0x5e')][_0x0eb2('0x54')]()[_0x0eb2('0x28')](function(_0x5cc073){if(_0x3c01cd[_0x0eb2('0x4b')][_0x0eb2('0x5f')]&&_['isArray'](_0x3c01cd[_0x0eb2('0x4b')][_0x0eb2('0x5f')])){if(_0x3c01cd[_0x0eb2('0x4b')][_0x0eb2('0x5f')][_0x0eb2('0x3a')]){_0x3c01cd[_0x0eb2('0x4b')][_0x0eb2('0x5f')]=_0x3c01cd[_0x0eb2('0x4b')][_0x0eb2('0x5f')]['join'](';')+';';}else{_0x3c01cd['body'][_0x0eb2('0x5f')]=null;}}else{_0x3c01cd[_0x0eb2('0x4b')][_0x0eb2('0x5f')]=null;}if(_0x3c01cd[_0x0eb2('0x4b')]&&_[_0x0eb2('0x60')](_0x3c01cd[_0x0eb2('0x4b')])){for(var _0x12d991=0x0;_0x12d991<_0x3c01cd[_0x0eb2('0x4b')][_0x0eb2('0x3a')];_0x12d991+=0x1){_0x3c01cd[_0x0eb2('0x4b')][_0x12d991][_0x0eb2('0x55')]=_0x3c01cd[_0x0eb2('0x46')]['id'];_0x275396[_0x0eb2('0x61')](_0x3c01cd[_0x0eb2('0x4b')][_0x12d991]);}return BPromise['each'](_0x275396,function(_0x57b155){return db[_0x0eb2('0x5e')][_0x0eb2('0x4a')](_[_0x0eb2('0x62')](_0x57b155,[_0x0eb2('0x5c'),'id'])||{},{'fields':_[_0x0eb2('0x47')](_0x5cc073),'raw':!![]})[_0x0eb2('0x28')](function(_0x2b6b6a){_0x4ec27b['success'][_0x0eb2('0x61')](_0x2b6b6a[_0x0eb2('0x63')]);})[_0x0eb2('0x53')](function(_0x3bd27f){_0x4ec27b['errors'][_0x0eb2('0x61')]({'data':_0x57b155,'error':_0x3bd27f['message']});});})[_0x0eb2('0x28')](function(_0x330c65){return _0x4ec27b;})[_0x0eb2('0x53')](function(_0x2b1303){return _0x2b1303;});}else{_0x57d29c['status'](0x190)[_0x0eb2('0x20')]({'message':_0x0eb2('0x64')});}});}})['then'](respondWithResult(_0x57d29c,null))['catch'](handleError(_0x57d29c,null));};exports[_0x0eb2('0x65')]=function(_0x46999d,_0x1e750b,_0x4cfc0c){var _0x2393ba;return db['CmList'][_0x0eb2('0x49')]({'where':{'id':_0x46999d['params']['id']},'include':[{'model':db[_0x0eb2('0x66')],'as':_0x0eb2('0x67')}]})[_0x0eb2('0x28')](handleEntityNotFound(_0x1e750b,null))[_0x0eb2('0x28')](function(_0x2505d7){if(_0x2505d7){_0x2393ba=_0x2505d7;return db[_0x0eb2('0x5e')][_0x0eb2('0x31')];}})[_0x0eb2('0x28')](function(_0x485113){if(_0x485113){var _0x48d92b={};var _0x110f35={};_0x110f35[_0x0eb2('0x34')]=_[_0x0eb2('0x68')](_[_0x0eb2('0x47')](_0x485113),_[_0x0eb2('0x30')](_0x2393ba['CustomFields'],function(_0x1529cf){return util[_0x0eb2('0x69')](_0x0eb2('0x6a'),_0x1529cf['id']);}));_0x110f35[_0x0eb2('0x35')]=_['keys'](_0x46999d[_0x0eb2('0x35')]);_0x110f35[_0x0eb2('0x36')]=_[_0x0eb2('0x37')](_0x110f35['model'],_0x110f35['query']);_0x48d92b[_0x0eb2('0x38')]=_[_0x0eb2('0x37')](_0x110f35[_0x0eb2('0x34')],qs['fields'](_0x46999d['query']['fields']));_0x48d92b['attributes']=_0x48d92b[_0x0eb2('0x38')][_0x0eb2('0x3a')]?_0x48d92b[_0x0eb2('0x38')]:_0x110f35['model'];if(!_0x46999d['query'][_0x0eb2('0x3b')]('nolimit')){_0x48d92b[_0x0eb2('0x24')]=qs[_0x0eb2('0x24')](_0x46999d[_0x0eb2('0x35')][_0x0eb2('0x24')]);_0x48d92b[_0x0eb2('0x23')]=qs[_0x0eb2('0x23')](_0x46999d[_0x0eb2('0x35')][_0x0eb2('0x23')]);}_0x48d92b[_0x0eb2('0x3d')]=qs[_0x0eb2('0x3e')](_0x46999d[_0x0eb2('0x35')][_0x0eb2('0x3e')]);_0x48d92b[_0x0eb2('0x3f')]=qs[_0x0eb2('0x36')](_[_0x0eb2('0x59')](_0x46999d['query'],_0x110f35[_0x0eb2('0x36')]));_0x48d92b[_0x0eb2('0x6b')]=!![];if(_0x46999d[_0x0eb2('0x35')][_0x0eb2('0x40')]){_0x48d92b[_0x0eb2('0x3f')]=_[_0x0eb2('0x41')](_0x48d92b['where'],{'$or':_[_0x0eb2('0x30')](_0x48d92b[_0x0eb2('0x38')],function(_0x45c8d4){var _0x1ac9ea={};_0x1ac9ea[_0x45c8d4]={'$like':'%'+_0x46999d[_0x0eb2('0x35')][_0x0eb2('0x40')]+'%'};return _0x1ac9ea;})});}_0x48d92b=_['merge']({},_0x48d92b,_0x46999d[_0x0eb2('0x48')]);return _0x2393ba[_0x0eb2('0x65')](_0x48d92b);}})[_0x0eb2('0x28')](respondWithResult(_0x1e750b,null))[_0x0eb2('0x53')](handleError(_0x1e750b,null));};exports[_0x0eb2('0x6c')]=function(_0x2b42a7,_0xc7be1c,_0x39feee){var _0x120198;var _0x3573c8;var _0x5b6888;var _0x22d210=_0x2b42a7['params']['id'];csv_results=[];return db[_0x0eb2('0x6d')][_0x0eb2('0x6e')]({'attributes':['id',_0x0eb2('0x2d')],'raw':!![],'order':[_0x0eb2('0x6f')]})['then'](function(_0xd7f250){_0x120198=_0xd7f250;var _0x162f3c=_['keys'](db[_0x0eb2('0x5e')]['rawAttributes']);return db[_0x0eb2('0x66')][_0x0eb2('0x6e')]({'raw':!![],'attributes':['id',_0x0eb2('0x70')]})[_0x0eb2('0x28')](function(_0x1c1859){_0x3573c8=_0x1c1859;var _0x52f773=squel[_0x0eb2('0x71')]()[_0x0eb2('0x39')](_0x162f3c)[_0x0eb2('0x72')](_0x0eb2('0x73'),'c')[_0x0eb2('0x3f')](_0x0eb2('0x74'),_0x22d210)[_0x0eb2('0x3f')]('c.deletedAt\x20is\x20null')[_0x0eb2('0x75')]();for(var _0x46e949=0x0;_0x46e949<_0x3573c8[_0x0eb2('0x3a')];_0x46e949++){_0x52f773[_0x0eb2('0x76')]('c.cf_'+_0x3573c8[_0x46e949]['id'],_0x0eb2('0x77')+_0x3573c8[_0x46e949][_0x0eb2('0x70')]);}for(var _0x46e949=0x0;_0x46e949<_0x120198[_0x0eb2('0x3a')];_0x46e949++){_0x52f773[_0x0eb2('0x76')](squel['select']()[_0x0eb2('0x76')]('item')[_0x0eb2('0x72')](_0x0eb2('0x78'))['where'](_0x0eb2('0x79'),_0x120198[_0x46e949]['id'])[_0x0eb2('0x3f')](_0x0eb2('0x7a')),_0x0eb2('0x7b')+_0x120198[_0x46e949][_0x0eb2('0x2d')]);_0x52f773[_0x0eb2('0x76')](squel[_0x0eb2('0x71')]()[_0x0eb2('0x76')]('description')[_0x0eb2('0x72')](_0x0eb2('0x78'))[_0x0eb2('0x3f')](_0x0eb2('0x79'),_0x120198[_0x46e949]['id'])['where'](_0x0eb2('0x7a')),_0x0eb2('0x7c')+_0x120198[_0x46e949][_0x0eb2('0x2d')]);}var _0x44272f=[];_0x44272f['push'](_0x52f773[_0x0eb2('0x7d')]());BPromise[_0x0eb2('0x7e')](_0x44272f,handleQuery)[_0x0eb2('0x28')](function(_0x153765){handleQuery(_0x52f773['toString']());var _0x2cdf51=csv_results[0x0];if(!_['isEmpty'](_0x2cdf51)){var _0x47c636=toCsv(_0x2cdf51);var _0x2ab783=Date[_0x0eb2('0x7f')]();fs[_0x0eb2('0x80')](util['format'](_0x0eb2('0x81'),_0x22d210,_0x2ab783),_0x47c636);_0xc7be1c[_0x0eb2('0x82')](_0x0eb2('0x83'),'attachment;\x20filename='+util['format'](_0x0eb2('0x84'),_0x22d210,_0x2ab783));_0xc7be1c[_0x0eb2('0x82')](_0x0eb2('0x85'),_0x0eb2('0x86'));return _0xc7be1c[_0x0eb2('0x87')](util[_0x0eb2('0x69')]('/tmp/list_%d_%s.csv',_0x22d210,_0x2ab783));}else{return _0xc7be1c[_0x0eb2('0x1d')](0xcc);}});});});};exports['addCustomField']=function(_0x3a7c85,_0x5c3eb7,_0x1cd37e){var _0x486633;delete _0x3a7c85[_0x0eb2('0x4b')]['id'];return db[_0x0eb2('0x42')]['findOne']({'where':{'id':_0x3a7c85[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x5c3eb7,null))[_0x0eb2('0x28')](function(_0x56f0cd){if(_0x56f0cd){return db[_0x0eb2('0x88')][_0x0eb2('0x89')](function(_0x39858e){return db[_0x0eb2('0x66')]['create'](_0x3a7c85[_0x0eb2('0x4b')],{'transaction':_0x39858e})[_0x0eb2('0x28')](function(_0x419fe4){_0x486633=_0x419fe4;return _0x56f0cd[_0x0eb2('0x8a')](_0x419fe4,{'transaction':_0x39858e});})[_0x0eb2('0x28')](function(){var _0x477a34={'type':db['Sequelize'][_0x0eb2('0x8b')],'transaction':_0x39858e};switch(_0x3a7c85[_0x0eb2('0x4b')][_0x0eb2('0x32')]){case _0x0eb2('0x8c'):_0x477a34['type']=db['Sequelize'][_0x0eb2('0x8b')];break;case'number':_0x477a34[_0x0eb2('0x32')]=db[_0x0eb2('0x8d')][_0x0eb2('0x8e')];break;case _0x0eb2('0x8f'):_0x477a34[_0x0eb2('0x32')]=db[_0x0eb2('0x8d')][_0x0eb2('0x90')];_0x477a34['defaultValue']=![];break;default:}return db[_0x0eb2('0x88')]['queryInterface'][_0x0eb2('0x91')]('cm_contacts',util[_0x0eb2('0x69')](_0x0eb2('0x92'),_0x486633['id']),_0x477a34);})['then'](function(){return _0x486633;});});}})[_0x0eb2('0x28')](respondWithResult(_0x5c3eb7,null))['catch'](handleError(_0x5c3eb7,null));};exports[_0x0eb2('0x93')]=function(_0x1c7b2e,_0x34132b,_0x27b657){var _0x29b7bf={};var _0xaba454={};var _0x528e2f;var _0x43f128;return db[_0x0eb2('0x42')][_0x0eb2('0x58')]({'where':{'id':_0x1c7b2e[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x34132b,null))[_0x0eb2('0x28')](function(_0x282b28){if(_0x282b28){_0x528e2f=_0x282b28;_0xaba454['model']=_[_0x0eb2('0x47')](db[_0x0eb2('0x66')][_0x0eb2('0x31')]);_0xaba454[_0x0eb2('0x35')]=_['keys'](_0x1c7b2e[_0x0eb2('0x35')]);_0xaba454[_0x0eb2('0x36')]=_[_0x0eb2('0x37')](_0xaba454[_0x0eb2('0x34')],_0xaba454[_0x0eb2('0x35')]);_0x29b7bf['attributes']=_[_0x0eb2('0x37')](_0xaba454[_0x0eb2('0x34')],qs['fields'](_0x1c7b2e[_0x0eb2('0x35')][_0x0eb2('0x39')]));_0x29b7bf[_0x0eb2('0x38')]=_0x29b7bf['attributes']['length']?_0x29b7bf[_0x0eb2('0x38')]:_0xaba454[_0x0eb2('0x34')];_0x29b7bf[_0x0eb2('0x3d')]=qs[_0x0eb2('0x3e')](_0x1c7b2e[_0x0eb2('0x35')][_0x0eb2('0x3e')]);_0x29b7bf['where']=qs['filters'](_[_0x0eb2('0x59')](_0x1c7b2e[_0x0eb2('0x35')],_0xaba454['filters']));_0x29b7bf['where']=_[_0x0eb2('0x41')](_0x29b7bf[_0x0eb2('0x3f')],{'$or':[{'ListId':_0x282b28['id']},{'ListId':null}]});if(_0x1c7b2e['query'][_0x0eb2('0x40')]){_0x29b7bf[_0x0eb2('0x3f')]=_['merge'](_0x29b7bf[_0x0eb2('0x3f')],{'$or':_['map'](_0x29b7bf[_0x0eb2('0x38')],function(_0x57bd92){var _0x455ad1={};_0x455ad1[_0x57bd92]={'$like':'%'+_0x1c7b2e[_0x0eb2('0x35')]['filter']+'%'};return _0x455ad1;})});}_0x29b7bf=_['merge']({},_0x29b7bf,_0x1c7b2e[_0x0eb2('0x48')]);return db['CmCustomField']['findAndCountAll'](_0x29b7bf);}})[_0x0eb2('0x28')](respondWithResult(_0x34132b,null))['catch'](handleError(_0x34132b,null));};exports[_0x0eb2('0x94')]=function(_0x5468c5,_0x293cc1){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0x0eb2('0x28')](handleEntityNotFound(_0x293cc1,null))[_0x0eb2('0x28')](function(_0x4367f0){return _0x4367f0;})[_0x0eb2('0x28')](respondWithResult(_0x293cc1,null))['catch'](handleError(_0x293cc1,null));};exports[_0x0eb2('0x95')]=function(_0x3860ba,_0x121e4a,_0x510d4e){return db[_0x0eb2('0x42')][_0x0eb2('0x49')]({'where':{'id':_0x3860ba[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x121e4a,null))[_0x0eb2('0x28')](function(_0x88bfa2){if(_0x88bfa2){return _0x88bfa2[_0x0eb2('0x95')](_0x3860ba[_0x0eb2('0x4b')][_0x0eb2('0x5c')],_[_0x0eb2('0x62')](_0x3860ba[_0x0eb2('0x4b')],[_0x0eb2('0x5c'),'id'])||{})[_0x0eb2('0x96')](function(_0x1fe179){for(var _0x2cc5dc=0x0;_0x2cc5dc<_0x3860ba[_0x0eb2('0x4b')]['ids'][_0x0eb2('0x3a')];_0x2cc5dc+=0x1){socket[_0x0eb2('0x97')](_0x0eb2('0x98'),{'UserId':Number(_0x3860ba[_0x0eb2('0x4b')][_0x0eb2('0x5c')][_0x2cc5dc]),'CmListId':Number(_0x3860ba[_0x0eb2('0x46')]['id'])});}return _0x1fe179;});}})['then'](respondWithResult(_0x121e4a,null))[_0x0eb2('0x53')](handleError(_0x121e4a,null));};exports[_0x0eb2('0x99')]=function(_0x329ff7,_0x2c3542,_0x33e768){return db[_0x0eb2('0x42')][_0x0eb2('0x49')]({'where':{'id':_0x329ff7[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x2c3542,null))[_0x0eb2('0x28')](function(_0x201d8d){if(_0x201d8d){return _0x201d8d[_0x0eb2('0x99')](_0x329ff7[_0x0eb2('0x35')][_0x0eb2('0x5c')])['then'](function(){if(_[_0x0eb2('0x60')](_0x329ff7[_0x0eb2('0x35')][_0x0eb2('0x5c')])){for(var _0x36d9f=0x0;_0x36d9f<_0x329ff7['query'][_0x0eb2('0x5c')][_0x0eb2('0x3a')];_0x36d9f+=0x1){socket[_0x0eb2('0x97')](_0x0eb2('0x9a'),{'UserId':Number(_0x329ff7[_0x0eb2('0x35')][_0x0eb2('0x5c')][_0x36d9f]),'CmListId':Number(_0x329ff7[_0x0eb2('0x46')]['id'])});}}else{socket[_0x0eb2('0x97')]('userCmList:remove',{'UserId':Number(_0x329ff7[_0x0eb2('0x35')][_0x0eb2('0x5c')]),'CmListId':Number(_0x329ff7[_0x0eb2('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c3542,null))['catch'](handleError(_0x2c3542,null));};exports['getAgents']=function(_0x5c2424,_0x266e88,_0x5d37ff){var _0x36b4a2={};var _0x3d62aa={};var _0x2b6cff;var _0x60f23d;return db[_0x0eb2('0x42')][_0x0eb2('0x58')]({'where':{'id':_0x5c2424[_0x0eb2('0x46')]['id']}})[_0x0eb2('0x28')](handleEntityNotFound(_0x266e88,null))['then'](function(_0xb8b84a){if(_0xb8b84a){_0x2b6cff=_0xb8b84a;_0x3d62aa[_0x0eb2('0x34')]=_['keys'](db['User']['rawAttributes']);_0x3d62aa['query']=_[_0x0eb2('0x47')](_0x5c2424[_0x0eb2('0x35')]);_0x3d62aa['filters']=_['intersection'](_0x3d62aa[_0x0eb2('0x34')],_0x3d62aa[_0x0eb2('0x35')]);_0x36b4a2[_0x0eb2('0x38')]=_[_0x0eb2('0x37')](_0x3d62aa[_0x0eb2('0x34')],qs[_0x0eb2('0x39')](_0x5c2424[_0x0eb2('0x35')]['fields']));_0x36b4a2[_0x0eb2('0x38')]=_0x36b4a2[_0x0eb2('0x38')]['length']?_0x36b4a2[_0x0eb2('0x38')]:_0x3d62aa[_0x0eb2('0x34')];_0x36b4a2['order']=qs[_0x0eb2('0x3e')](_0x5c2424[_0x0eb2('0x35')][_0x0eb2('0x3e')]);_0x36b4a2[_0x0eb2('0x3f')]=qs[_0x0eb2('0x36')](_[_0x0eb2('0x59')](_0x5c2424[_0x0eb2('0x35')],_0x3d62aa[_0x0eb2('0x36')]));if(_0x5c2424[_0x0eb2('0x35')][_0x0eb2('0x40')]){_0x36b4a2[_0x0eb2('0x3f')]=_[_0x0eb2('0x41')](_0x36b4a2[_0x0eb2('0x3f')],{'$or':_[_0x0eb2('0x30')](_0x36b4a2[_0x0eb2('0x38')],function(_0x3d3a7d){var _0x115cec={};_0x115cec[_0x3d3a7d]={'$like':'%'+_0x5c2424[_0x0eb2('0x35')][_0x0eb2('0x40')]+'%'};return _0x115cec;})});}_0x36b4a2=_[_0x0eb2('0x41')]({},_0x36b4a2,_0x5c2424[_0x0eb2('0x48')]);return _0x2b6cff[_0x0eb2('0x9b')](_0x36b4a2);}})['then'](function(_0x490f24){if(_0x490f24){_0x60f23d=_0x490f24[_0x0eb2('0x3a')];if(!_0x5c2424[_0x0eb2('0x35')][_0x0eb2('0x3b')]('nolimit')){_0x36b4a2['limit']=qs[_0x0eb2('0x24')](_0x5c2424[_0x0eb2('0x35')][_0x0eb2('0x24')]);_0x36b4a2[_0x0eb2('0x23')]=qs[_0x0eb2('0x23')](_0x5c2424[_0x0eb2('0x35')][_0x0eb2('0x23')]);}return _0x2b6cff[_0x0eb2('0x9b')](_0x36b4a2);}})['then'](function(_0x30a7bd){if(_0x30a7bd){return _0x30a7bd?{'count':_0x60f23d,'rows':_0x30a7bd}:null;}})[_0x0eb2('0x28')](respondWithResult(_0x266e88,null))[_0x0eb2('0x53')](handleError(_0x266e88,null));};function handleQuery(_0x8e5374){logger[_0x0eb2('0x9c')](_0x8e5374);return db['sequelize'][_0x0eb2('0x35')](_0x8e5374)[_0x0eb2('0x96')](function(_0x41aff4){csv_results[_0x0eb2('0x61')](_0x41aff4);})[_0x0eb2('0x53')](function(_0x4e2276){logger[_0x0eb2('0x2b')](_0x4e2276['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 2a7bdbd..c994cbb 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x358c6e,_0x3bddb6){_0x358c6e=_0x358c6e-0x0;var _0x172cbe=_0x3e74[_0x358c6e];return _0x172cbe;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x7217,0x19e));var _0x7721=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7217[_0x21aec3];return _0x288bbc;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4b93332..d0e75a4 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 _0xa75b=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','api','moment','bluebird'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xa75b,0x170));var _0xba75=function(_0x218398,_0x32a8ae){_0x218398=_0x218398-0x0;var _0x333283=_0xa75b[_0x218398];return _0x333283;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0x5cf9d7,_0x1e9525){var _0x634ee4=function(_0x226fb5){while(--_0x226fb5){_0x5cf9d7['push'](_0x5cf9d7['shift']());}};_0x634ee4(++_0x1e9525);}(_0x2dae,0xc3));var _0xe2da=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x2dae[_0x4429e0];return _0x51a5b3;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'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 b3380ec..e7f42fc 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 _0xe0b0=['./cmList.socket','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x42a6c8,_0x329a0b){var _0x175da3=function(_0x261163){while(--_0x261163){_0x42a6c8['push'](_0x42a6c8['shift']());}};_0x175da3(++_0x329a0b);}(_0xe0b0,0xfb));var _0x0e0b=function(_0x16a395,_0x3b5670){_0x16a395=_0x16a395-0x0;var _0x7b6261=_0xe0b0[_0x16a395];return _0x7b6261;};'use strict';var _=require('lodash');var util=require(_0x0e0b('0x0'));var moment=require(_0x0e0b('0x1'));var BPromise=require(_0x0e0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e0b('0x3'))['db'];var utils=require(_0x0e0b('0x4'));var logger=require('../../config/logger')(_0x0e0b('0x5'));var config=require(_0x0e0b('0x6'));var jayson=require(_0x0e0b('0x7'));var client=jayson[_0x0e0b('0x8')][_0x0e0b('0x9')]({'port':0x232a});config['redis']=_[_0x0e0b('0xa')](config[_0x0e0b('0xb')],{'host':_0x0e0b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0e0b('0xd'))['register'](socket);function respondWithRpcPromise(_0x55bc44,_0x593f83,_0x12107b){return new BPromise(function(_0x3f7a5f,_0x2983cf){return client['request'](_0x55bc44,_0x12107b)[_0x0e0b('0xe')](function(_0x4b028b){logger['info'](_0x0e0b('0xf'),_0x593f83,_0x0e0b('0x10'));logger['debug'](_0x0e0b('0x11'),_0x593f83,_0x0e0b('0x10'),JSON[_0x0e0b('0x12')](_0x4b028b));if(_0x4b028b[_0x0e0b('0x13')]){if(_0x4b028b[_0x0e0b('0x13')][_0x0e0b('0x14')]===0x1f4){logger['error'](_0x0e0b('0xf'),_0x593f83,_0x4b028b[_0x0e0b('0x13')][_0x0e0b('0x15')]);return _0x2983cf(_0x4b028b[_0x0e0b('0x13')][_0x0e0b('0x15')]);}logger[_0x0e0b('0x13')](_0x0e0b('0xf'),_0x593f83,_0x4b028b[_0x0e0b('0x13')][_0x0e0b('0x15')]);return _0x3f7a5f(_0x4b028b[_0x0e0b('0x13')][_0x0e0b('0x15')]);}else{logger[_0x0e0b('0x16')](_0x0e0b('0xf'),_0x593f83,_0x0e0b('0x10'));_0x3f7a5f(_0x4b028b['result'][_0x0e0b('0x15')]);}})[_0x0e0b('0x17')](function(_0x107d54){logger[_0x0e0b('0x13')](_0x0e0b('0xf'),_0x593f83,_0x107d54);_0x2983cf(_0x107d54);});});} \ No newline at end of file +var _0x254a=['request','info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','./cmList.socket','register'];(function(_0x136a23,_0x507cda){var _0x48e69b=function(_0x4aefdb){while(--_0x4aefdb){_0x136a23['push'](_0x136a23['shift']());}};_0x48e69b(++_0x507cda);}(_0x254a,0x11c));var _0xa254=function(_0x2d67b4,_0x4ca8fe){_0x2d67b4=_0x2d67b4-0x0;var _0x4cd582=_0x254a[_0x2d67b4];return _0x4cd582;};'use strict';var _=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var moment=require(_0xa254('0x2'));var BPromise=require('bluebird');var rs=require(_0xa254('0x3'));var fs=require('fs');var Redis=require(_0xa254('0x4'));var db=require(_0xa254('0x5'))['db'];var utils=require(_0xa254('0x6'));var logger=require(_0xa254('0x7'))(_0xa254('0x8'));var config=require(_0xa254('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa254('0xa')][_0xa254('0xb')]({'port':0x232a});config['redis']=_[_0xa254('0xc')](config[_0xa254('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa254('0xd')]));require(_0xa254('0xe'))[_0xa254('0xf')](socket);function respondWithRpcPromise(_0x43ce1e,_0x2e6252,_0x38110f){return new BPromise(function(_0x407ce7,_0x24dfb0){return client[_0xa254('0x10')](_0x43ce1e,_0x38110f)['then'](function(_0x503c7a){logger[_0xa254('0x11')](_0xa254('0x12'),_0x2e6252,_0xa254('0x13'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x2e6252,'request\x20sent',JSON[_0xa254('0x14')](_0x503c7a));if(_0x503c7a['error']){if(_0x503c7a[_0xa254('0x15')]['code']===0x1f4){logger[_0xa254('0x15')](_0xa254('0x12'),_0x2e6252,_0x503c7a[_0xa254('0x15')]['message']);return _0x24dfb0(_0x503c7a['error'][_0xa254('0x16')]);}logger[_0xa254('0x15')](_0xa254('0x12'),_0x2e6252,_0x503c7a['error']['message']);return _0x407ce7(_0x503c7a[_0xa254('0x15')]['message']);}else{logger[_0xa254('0x11')](_0xa254('0x12'),_0x2e6252,_0xa254('0x13'));_0x407ce7(_0x503c7a[_0xa254('0x17')]['message']);}})[_0xa254('0x18')](function(_0x25a5f4){logger['error'](_0xa254('0x12'),_0x2e6252,_0x25a5f4);_0x24dfb0(_0x25a5f4);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 236877e..c65accf 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 _0xf50b=['removeListener','register','length','cmList:','./cmList.events','save','update'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf50b,0xc8));var _0xbf50=function(_0x1905b8,_0x165883){_0x1905b8=_0x1905b8-0x0;var _0x35bd1a=_0xf50b[_0x1905b8];return _0x35bd1a;};'use strict';var CmListEvents=require(_0xbf50('0x0'));var events=[_0xbf50('0x1'),'remove',_0xbf50('0x2')];function createListener(_0x18c2f1,_0x3336bb){return function(_0x443bf8){_0x3336bb['emit'](_0x18c2f1,_0x443bf8);};}function removeListener(_0x32217d,_0x4f5ba8){return function(){CmListEvents[_0xbf50('0x3')](_0x32217d,_0x4f5ba8);};}exports[_0xbf50('0x4')]=function(_0x1ecb62){for(var _0x117cc8=0x0,_0x3dd305=events[_0xbf50('0x5')];_0x117cc8<_0x3dd305;_0x117cc8++){var _0xce290=events[_0x117cc8];var _0x497c4c=createListener(_0xbf50('0x6')+_0xce290,_0x1ecb62);CmListEvents['on'](_0xce290,_0x497c4c);}}; \ No newline at end of file +var _0x1310=['cmList:','./cmList.events','remove','emit','removeListener','register','length'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x1310,0x1ac));var _0x0131=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1310[_0x20a584];return _0x4b41a8;};'use strict';var CmListEvents=require(_0x0131('0x0'));var events=['save',_0x0131('0x1'),'update'];function createListener(_0x3af490,_0x4e2814){return function(_0xa1185a){_0x4e2814[_0x0131('0x2')](_0x3af490,_0xa1185a);};}function removeListener(_0x126147,_0x52864c){return function(){CmListEvents[_0x0131('0x3')](_0x126147,_0x52864c);};}exports[_0x0131('0x4')]=function(_0x2dedb4){for(var _0x2014eb=0x0,_0x2c199d=events[_0x0131('0x5')];_0x2014eb<_0x2c199d;_0x2014eb++){var _0x21c93a=events[_0x2014eb];var _0x39c43f=createListener(_0x0131('0x6')+_0x21c93a,_0x2dedb4);CmListEvents['on'](_0x21c93a,_0x39c43f);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8a069e2..1a08447 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 _0x5044=['/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','destroy','delete','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','describe','/global_fields','show'];(function(_0x4a7b2b,_0x3366e1){var _0x35e381=function(_0x4409db){while(--_0x4409db){_0x4a7b2b['push'](_0x4a7b2b['shift']());}};_0x35e381(++_0x3366e1);}(_0x5044,0xc8));var _0x4504=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0x5044[_0x2211ed];return _0x4d78cc;};'use strict';var multer=require('multer');var util=require(_0x4504('0x0'));var path=require('path');var timeout=require(_0x4504('0x1'));var express=require(_0x4504('0x2'));var router=express[_0x4504('0x3')]();var fs_extra=require(_0x4504('0x4'));var auth=require(_0x4504('0x5'));var interaction=require(_0x4504('0x6'));var config=require(_0x4504('0x7'));var controller=require(_0x4504('0x8'));router['get']('/',auth[_0x4504('0x9')](),controller[_0x4504('0xa')]);router[_0x4504('0xb')](_0x4504('0xc'),auth[_0x4504('0x9')](),controller[_0x4504('0xd')]);router[_0x4504('0xb')](_0x4504('0xe'),auth[_0x4504('0x9')](),controller['getGlobalCustomFields']);router[_0x4504('0xb')]('/:id',auth[_0x4504('0x9')](),controller[_0x4504('0xf')]);router[_0x4504('0xb')](_0x4504('0x10'),auth[_0x4504('0x9')](),controller[_0x4504('0x11')]);router[_0x4504('0xb')](_0x4504('0x12'),auth[_0x4504('0x9')](),controller[_0x4504('0x13')]);router[_0x4504('0xb')](_0x4504('0x14'),auth[_0x4504('0x9')](),controller['getContactsCsv']);router[_0x4504('0xb')](_0x4504('0x15'),auth['isAuthenticated'](),controller[_0x4504('0x16')]);router[_0x4504('0xb')](_0x4504('0x17'),auth[_0x4504('0x9')](),controller['getAgents']);router['post']('/',auth[_0x4504('0x9')](),controller['create']);router[_0x4504('0x18')]('/:id/dispositions',auth[_0x4504('0x9')](),controller[_0x4504('0x19')]);router[_0x4504('0x18')]('/:id/contacts',auth[_0x4504('0x9')](),controller[_0x4504('0x1a')]);router[_0x4504('0x18')](_0x4504('0x15'),auth[_0x4504('0x9')](),controller[_0x4504('0x1b')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x4504('0x1c')]);router[_0x4504('0x1d')](_0x4504('0x1e'),auth[_0x4504('0x9')](),controller[_0x4504('0x1f')]);router['delete'](_0x4504('0x1e'),auth[_0x4504('0x9')](),controller[_0x4504('0x20')]);router[_0x4504('0x21')](_0x4504('0x10'),auth[_0x4504('0x9')](),controller['removeDispositions']);router[_0x4504('0x21')](_0x4504('0x17'),auth['isAuthenticated'](),controller[_0x4504('0x22')]);module[_0x4504('0x23')]=router; \ No newline at end of file +var _0x3c5f=['getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','/:id/contacts','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','./cmList.controller','get','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions'];(function(_0x4f3b2b,_0x33bd99){var _0x1469db=function(_0x22284b){while(--_0x22284b){_0x4f3b2b['push'](_0x4f3b2b['shift']());}};_0x1469db(++_0x33bd99);}(_0x3c5f,0xb0));var _0xf3c5=function(_0x1e029f,_0x53fbd0){_0x1e029f=_0x1e029f-0x0;var _0x39a9b1=_0x3c5f[_0x1e029f];return _0x39a9b1;};'use strict';var multer=require(_0xf3c5('0x0'));var util=require(_0xf3c5('0x1'));var path=require(_0xf3c5('0x2'));var timeout=require('connect-timeout');var express=require(_0xf3c5('0x3'));var router=express[_0xf3c5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf3c5('0x5'));var config=require('../../config/environment');var controller=require(_0xf3c5('0x6'));router[_0xf3c5('0x7')]('/',auth[_0xf3c5('0x8')](),controller['index']);router[_0xf3c5('0x7')]('/describe',auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x9')]);router[_0xf3c5('0x7')](_0xf3c5('0xa'),auth['isAuthenticated'](),controller[_0xf3c5('0xb')]);router[_0xf3c5('0x7')](_0xf3c5('0xc'),auth[_0xf3c5('0x8')](),controller[_0xf3c5('0xd')]);router[_0xf3c5('0x7')](_0xf3c5('0xe'),auth[_0xf3c5('0x8')](),controller[_0xf3c5('0xf')]);router[_0xf3c5('0x7')]('/:id/contacts',auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x10')]);router[_0xf3c5('0x7')]('/:id/contacts/csv',auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x11')]);router[_0xf3c5('0x7')](_0xf3c5('0x12'),auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x13')]);router[_0xf3c5('0x7')](_0xf3c5('0x14'),auth[_0xf3c5('0x8')](),controller['getAgents']);router[_0xf3c5('0x15')]('/',auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x16')]);router[_0xf3c5('0x15')]('/:id/dispositions',auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x17')]);router[_0xf3c5('0x15')](_0xf3c5('0x18'),auth['isAuthenticated'](),controller['addContacts']);router['post'](_0xf3c5('0x12'),auth[_0xf3c5('0x8')](),controller['addCustomField']);router['post'](_0xf3c5('0x14'),auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x19')]);router[_0xf3c5('0x1a')]('/:id',auth[_0xf3c5('0x8')](),controller['update']);router[_0xf3c5('0x1b')](_0xf3c5('0xc'),auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x1c')]);router[_0xf3c5('0x1b')](_0xf3c5('0xe'),auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x1d')]);router['delete']('/:id/users',auth[_0xf3c5('0x8')](),controller[_0xf3c5('0x1e')]);module[_0xf3c5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index fce0a37..c8ba4b6 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 _0xe377=['sequelize','exports','VIRTUAL','getDataValue'];(function(_0x2b086d,_0x1ac1ed){var _0x19372b=function(_0x33be8e){while(--_0x33be8e){_0x2b086d['push'](_0x2b086d['shift']());}};_0x19372b(++_0x1ac1ed);}(_0xe377,0x148));var _0x7e37=function(_0x101df2,_0x4fbbf5){_0x101df2=_0x101df2-0x0;var _0x33da37=_0xe377[_0x101df2];return _0x33da37;};'use strict';var Sequelize=require(_0x7e37('0x0'));module[_0x7e37('0x1')]={'name':{'type':Sequelize[_0x7e37('0x2')],'get':function(_0x4bbde2){return this[_0x7e37('0x3')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe02b=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xe02b,0x163));var _0xbe02=function(_0x4f8c3e,_0x4152a2){_0x4f8c3e=_0x4f8c3e-0x0;var _0x1c050d=_0xe02b[_0x4f8c3e];return _0x1c050d;};'use strict';var Sequelize=require(_0xbe02('0x0'));module[_0xbe02('0x1')]={'name':{'type':Sequelize[_0xbe02('0x2')],'get':function(_0x40de29){return this[_0xbe02('0x3')](_0xbe02('0x4'));}},'field':{'type':Sequelize[_0xbe02('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xbe02('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 ae6d601..74fceee 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(_0x4b0e06,_0x3f01a0){var _0x152ef9=function(_0x784b3b){while(--_0x784b3b){_0x4b0e06['push'](_0x4b0e06['shift']());}};_0x152ef9(++_0x3f01a0);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x3d5251,_0x4bc9a1){var _0x3a3767=function(_0x26de44){while(--_0x26de44){_0x3d5251['push'](_0x3d5251['shift']());}};_0x3a3767(++_0x4bc9a1);}(_0x7a54,0x106));var _0x47a5=function(_0x368c69,_0x465b9d){_0x368c69=_0x368c69-0x0;var _0x4d30b5=_0x7a54[_0x368c69];return _0x4d30b5;};'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 d768967..a919c18 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 _0x8b90=['moment','request-promise','./condition.attributes','exports','define','tools_conditions','util','api'];(function(_0x4a76d7,_0x1dc4ed){var _0x368d2b=function(_0x4fa986){while(--_0x4fa986){_0x4a76d7['push'](_0x4a76d7['shift']());}};_0x368d2b(++_0x1dc4ed);}(_0x8b90,0x126));var _0x08b9=function(_0x12ad5d,_0x2e63ed){_0x12ad5d=_0x12ad5d-0x0;var _0x45a98b=_0x8b90[_0x12ad5d];return _0x45a98b;};'use strict';var _=require('lodash');var util=require(_0x08b9('0x0'));var logger=require('../../config/logger')(_0x08b9('0x1'));var moment=require(_0x08b9('0x2'));var BPromise=require('bluebird');var rp=require(_0x08b9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x08b9('0x4'));module[_0x08b9('0x5')]=function(_0x57c6bd,_0xe60384){return _0x57c6bd[_0x08b9('0x6')]('Condition',attributes,{'tableName':_0x08b9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31d6=['./condition.attributes','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2b4154,_0x4e9cba){var _0x59768f=function(_0x5a058f){while(--_0x5a058f){_0x2b4154['push'](_0x2b4154['shift']());}};_0x59768f(++_0x4e9cba);}(_0x31d6,0x1f2));var _0x631d=function(_0x373e96,_0x47ff6e){_0x373e96=_0x373e96-0x0;var _0x5f3c03=_0x31d6[_0x373e96];return _0x5f3c03;};'use strict';var _=require(_0x631d('0x0'));var util=require(_0x631d('0x1'));var logger=require(_0x631d('0x2'))(_0x631d('0x3'));var moment=require(_0x631d('0x4'));var BPromise=require(_0x631d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x631d('0x6'));var rimraf=require(_0x631d('0x7'));var config=require(_0x631d('0x8'));var attributes=require(_0x631d('0x9'));module['exports']=function(_0x8bba8b,_0x926226){return _0x8bba8b[_0x631d('0xa')](_0x631d('0xb'),attributes,{'tableName':_0x631d('0xc'),'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 de51c08..1924d15 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 _0xdc41=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x2d8845,_0x452764){var _0x4ff1a6=function(_0x376251){while(--_0x376251){_0x2d8845['push'](_0x2d8845['shift']());}};_0x4ff1a6(++_0x452764);}(_0xdc41,0x1c8));var _0x1dc4=function(_0x5e8fc3,_0x37ef41){_0x5e8fc3=_0x5e8fc3-0x0;var _0x2d224a=_0xdc41[_0x5e8fc3];return _0x2d224a;};'use strict';var _=require(_0x1dc4('0x0'));var util=require(_0x1dc4('0x1'));var moment=require('moment');var BPromise=require(_0x1dc4('0x2'));var rs=require(_0x1dc4('0x3'));var fs=require('fs');var Redis=require(_0x1dc4('0x4'));var db=require(_0x1dc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dc4('0x6'))('rpc');var config=require(_0x1dc4('0x7'));var jayson=require(_0x1dc4('0x8'));var client=jayson[_0x1dc4('0x9')][_0x1dc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15dc20,_0x21d22b,_0x34d053){return new BPromise(function(_0x2b38bb,_0x561d22){return client[_0x1dc4('0xb')](_0x15dc20,_0x34d053)[_0x1dc4('0xc')](function(_0x374d94){logger[_0x1dc4('0xd')]('Condition,\x20%s,\x20%s',_0x21d22b,_0x1dc4('0xe'));logger[_0x1dc4('0xf')](_0x1dc4('0x10'),_0x21d22b,_0x1dc4('0xe'),JSON[_0x1dc4('0x11')](_0x374d94));if(_0x374d94['error']){if(_0x374d94[_0x1dc4('0x12')][_0x1dc4('0x13')]===0x1f4){logger['error'](_0x1dc4('0x14'),_0x21d22b,_0x374d94['error'][_0x1dc4('0x15')]);return _0x561d22(_0x374d94[_0x1dc4('0x12')][_0x1dc4('0x15')]);}logger['error'](_0x1dc4('0x14'),_0x21d22b,_0x374d94[_0x1dc4('0x12')][_0x1dc4('0x15')]);return _0x2b38bb(_0x374d94['error'][_0x1dc4('0x15')]);}else{logger[_0x1dc4('0xd')](_0x1dc4('0x14'),_0x21d22b,'request\x20sent');_0x2b38bb(_0x374d94[_0x1dc4('0x16')][_0x1dc4('0x15')]);}})['catch'](function(_0x18a9c7){logger[_0x1dc4('0x12')]('Condition,\x20%s,\x20%s',_0x21d22b,_0x18a9c7);_0x561d22(_0x18a9c7);});});} \ No newline at end of file +var _0x59f6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x295b82,_0x671f3d){var _0x583a52=function(_0x2a07b1){while(--_0x2a07b1){_0x295b82['push'](_0x295b82['shift']());}};_0x583a52(++_0x671f3d);}(_0x59f6,0xcf));var _0x659f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x59f6[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x659f('0x0'));var util=require(_0x659f('0x1'));var moment=require(_0x659f('0x2'));var BPromise=require(_0x659f('0x3'));var rs=require(_0x659f('0x4'));var fs=require('fs');var Redis=require(_0x659f('0x5'));var db=require(_0x659f('0x6'))['db'];var utils=require(_0x659f('0x7'));var logger=require(_0x659f('0x8'))(_0x659f('0x9'));var config=require('../../config/environment');var jayson=require(_0x659f('0xa'));var client=jayson[_0x659f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x558260,_0x3df125,_0x460ee3){return new BPromise(function(_0x235122,_0x174758){return client[_0x659f('0xc')](_0x558260,_0x460ee3)[_0x659f('0xd')](function(_0x3368de){logger[_0x659f('0xe')](_0x659f('0xf'),_0x3df125,_0x659f('0x10'));logger[_0x659f('0x11')](_0x659f('0x12'),_0x3df125,'request\x20sent',JSON['stringify'](_0x3368de));if(_0x3368de[_0x659f('0x13')]){if(_0x3368de[_0x659f('0x13')]['code']===0x1f4){logger[_0x659f('0x13')]('Condition,\x20%s,\x20%s',_0x3df125,_0x3368de[_0x659f('0x13')][_0x659f('0x14')]);return _0x174758(_0x3368de[_0x659f('0x13')][_0x659f('0x14')]);}logger['error'](_0x659f('0xf'),_0x3df125,_0x3368de['error'][_0x659f('0x14')]);return _0x235122(_0x3368de[_0x659f('0x13')][_0x659f('0x14')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x3df125,_0x659f('0x10'));_0x235122(_0x3368de[_0x659f('0x15')]['message']);}})[_0x659f('0x16')](function(_0x244c13){logger[_0x659f('0x13')](_0x659f('0xf'),_0x3df125,_0x244c13);_0x174758(_0x244c13);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 028da23..e3e8188 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 _0x6d66=['express','Router','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x36af1d,_0x57d190){var _0x29acde=function(_0x6586bc){while(--_0x6586bc){_0x36af1d['push'](_0x36af1d['shift']());}};_0x29acde(++_0x57d190);}(_0x6d66,0x1c4));var _0x66d6=function(_0x3ad49a,_0x5ea7c7){_0x3ad49a=_0x3ad49a-0x0;var _0x531237=_0x6d66[_0x3ad49a];return _0x531237;};'use strict';var multer=require(_0x66d6('0x0'));var util=require('util');var path=require(_0x66d6('0x1'));var timeout=require(_0x66d6('0x2'));var express=require(_0x66d6('0x3'));var router=express[_0x66d6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66d6('0x5'));var config=require('../../config/environment');var controller=require(_0x66d6('0x6'));router['put'](_0x66d6('0x7'),auth[_0x66d6('0x8')](),controller[_0x66d6('0x9')]);router[_0x66d6('0xa')](_0x66d6('0x7'),auth[_0x66d6('0x8')](),controller[_0x66d6('0xb')]);module[_0x66d6('0xc')]=router; \ No newline at end of file +var _0x2895=['fs-extra','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x165f69,_0x758f03){var _0x2b9edf=function(_0x90ee62){while(--_0x90ee62){_0x165f69['push'](_0x165f69['shift']());}};_0x2b9edf(++_0x758f03);}(_0x2895,0x82));var _0x5289=function(_0x44e5b2,_0x307c93){_0x44e5b2=_0x44e5b2-0x0;var _0x131aa3=_0x2895[_0x44e5b2];return _0x131aa3;};'use strict';var multer=require(_0x5289('0x0'));var util=require(_0x5289('0x1'));var path=require(_0x5289('0x2'));var timeout=require('connect-timeout');var express=require(_0x5289('0x3'));var router=express[_0x5289('0x4')]();var fs_extra=require(_0x5289('0x5'));var auth=require(_0x5289('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5289('0x7'));var controller=require('./condition.controller');router[_0x5289('0x8')](_0x5289('0x9'),auth[_0x5289('0xa')](),controller[_0x5289('0xb')]);router[_0x5289('0xc')](_0x5289('0x9'),auth['isAuthenticated'](),controller[_0x5289('0xd')]);module[_0x5289('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 da99e2b..70b8b5f 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 _0x3cc5=['exports','STRING'];(function(_0x2c4a6b,_0x29a928){var _0xe67f09=function(_0x3cbdaf){while(--_0x3cbdaf){_0x2c4a6b['push'](_0x2c4a6b['shift']());}};_0xe67f09(++_0x29a928);}(_0x3cc5,0xd8));var _0x53cc=function(_0xb40ca1,_0x246809){_0xb40ca1=_0xb40ca1-0x0;var _0x26eb7e=_0x3cc5[_0xb40ca1];return _0x26eb7e;};'use strict';var Sequelize=require('sequelize');module[_0x53cc('0x0')]={'name':{'type':Sequelize[_0x53cc('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x53cc('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8346=['name','INTEGER','sequelize','exports','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x8346,0xca));var _0x6834=function(_0x2b17f7,_0x42ed33){_0x2b17f7=_0x2b17f7-0x0;var _0x5486e8=_0x8346[_0x2b17f7];return _0x5486e8;};'use strict';var Sequelize=require(_0x6834('0x0'));module[_0x6834('0x1')]={'name':{'type':Sequelize[_0x6834('0x2')],'allowNull':![],'unique':_0x6834('0x3')},'OrderBy':{'type':Sequelize[_0x6834('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x6834('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 f38d28c..3d9a320 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x233340,_0x30e76c){var _0x6e4908=function(_0x297299){while(--_0x297299){_0x233340['push'](_0x233340['shift']());}};_0x6e4908(++_0x30e76c);}(_0x6a95,0x1db));var _0x56a9=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x6a95[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=typeof _0x2a0714['offset']===_0x56a9('0x1c')&&typeof _0x2a0714['limit']==='undefined';var _0x4e292f=_0x42007b[_0x56a9('0x1d')];var _0x576bdf=_0x46f854?0x0:_0x2a0714[_0x56a9('0x1e')];var _0x105fe5=_0x46f854?_0x42007b[_0x56a9('0x1d')]:_0x2a0714[_0x56a9('0x1e')]+_0x2a0714[_0x56a9('0x1f')];var _0xbfeb1a;if(_0x105fe5>=_0x4e292f){_0x105fe5=_0x4e292f;_0xbfeb1a=0xc8;}else{_0xbfeb1a=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0xbfeb1a);return _0x2e0dfd[_0x56a9('0x20')](_0x56a9('0x21'),_0x576bdf+'-'+_0x105fe5+'/'+_0x4e292f)[_0x56a9('0x22')](_0x42007b);}return null;};}function patchUpdates(_0x5f145f){return function(_0x5bc03a){try{jsonpatch[_0x56a9('0x23')](_0x5bc03a,_0x5f145f,!![]);}catch(_0x16f9de){return BPromise[_0x56a9('0x24')](_0x16f9de);}return _0x5bc03a[_0x56a9('0x25')]();};}function saveUpdates(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')](_0x4a09e5)[_0x56a9('0x27')](function(_0x5a82e0){return _0x5a82e0;});}return null;};}function removeEntity(_0x44762e,_0x32839b){return function(_0x21ab38){if(_0x21ab38){return _0x21ab38[_0x56a9('0x28')]()[_0x56a9('0x27')](function(){var _0x52016c=_0x21ab38[_0x56a9('0x29')]({'plain':!![]});var _0x217bda=_0x56a9('0x2a');return db['UserProfileResource'][_0x56a9('0x28')]({'where':{'type':_0x217bda,'resourceId':_0x52016c['id']}})['then'](function(){return _0x21ab38;});})[_0x56a9('0x27')](function(){_0x44762e[_0x56a9('0x1a')](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x20432a,_0x45f38c){return function(_0x1afe8a){if(!_0x1afe8a){_0x20432a[_0x56a9('0x19')](0x194);}return _0x1afe8a;};}function handleError(_0xff5f55,_0x51fd64){_0x51fd64=_0x51fd64||0x1f4;return function(_0x437ccf){logger[_0x56a9('0x2b')](_0x437ccf['stack']);if(_0x437ccf[_0x56a9('0x2c')]){delete _0x437ccf['name'];}_0xff5f55['status'](_0x51fd64)[_0x56a9('0x2d')](_0x437ccf);};}exports['index']=function(_0x2f933a,_0x11002a){var _0x2fbd5d={},_0x2c1c3d={},_0x5879db={'count':0x0,'rows':[]};var _0x332707=_[_0x56a9('0x2e')](db[_0x56a9('0x2f')][_0x56a9('0x30')],function(_0xbbb47d){return{'name':_0xbbb47d[_0x56a9('0x31')],'type':_0xbbb47d[_0x56a9('0x32')][_0x56a9('0x33')]};});_0x2c1c3d[_0x56a9('0x34')]=_[_0x56a9('0x2e')](_0x332707,_0x56a9('0x2c'));_0x2c1c3d[_0x56a9('0x35')]=_['keys'](_0x2f933a[_0x56a9('0x35')]);_0x2c1c3d[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x2c1c3d['model'],_0x2c1c3d[_0x56a9('0x35')]);_0x2fbd5d['attributes']=_['intersection'](_0x2c1c3d['model'],qs[_0x56a9('0x38')](_0x2f933a[_0x56a9('0x35')]['fields']));_0x2fbd5d['attributes']=_0x2fbd5d[_0x56a9('0x39')][_0x56a9('0x3a')]?_0x2fbd5d[_0x56a9('0x39')]:_0x2c1c3d[_0x56a9('0x34')];if(!_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3b')](_0x56a9('0x3c'))){_0x2fbd5d[_0x56a9('0x1f')]=qs[_0x56a9('0x1f')](_0x2f933a[_0x56a9('0x35')]['limit']);_0x2fbd5d['offset']=qs['offset'](_0x2f933a['query'][_0x56a9('0x1e')]);}_0x2fbd5d[_0x56a9('0x3d')]=qs['sort'](_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3e')]);_0x2fbd5d[_0x56a9('0x3f')]=qs[_0x56a9('0x36')](_[_0x56a9('0x40')](_0x2f933a[_0x56a9('0x35')],_0x2c1c3d[_0x56a9('0x36')]),_0x332707);if(_0x2f933a['query'][_0x56a9('0x41')]){_0x2fbd5d[_0x56a9('0x3f')]=_['merge'](_0x2fbd5d['where'],{'$or':_[_0x56a9('0x2e')](_0x332707,function(_0x1180c6){if(_0x1180c6[_0x56a9('0x32')]!==_0x56a9('0x42')){var _0x158504={};_0x158504[_0x1180c6[_0x56a9('0x2c')]]={'$like':'%'+_0x2f933a[_0x56a9('0x35')][_0x56a9('0x41')]+'%'};return _0x158504;}})});}_0x2fbd5d=_[_0x56a9('0x43')]({},_0x2fbd5d,_0x2f933a[_0x56a9('0x44')]);var _0x9f24ea={'where':_0x2fbd5d[_0x56a9('0x3f')]};return db[_0x56a9('0x2f')][_0x56a9('0x1d')](_0x9f24ea)[_0x56a9('0x27')](function(_0xe57cfb){_0x5879db[_0x56a9('0x1d')]=_0xe57cfb;if(_0x2f933a[_0x56a9('0x35')]['includeAll']){_0x2fbd5d[_0x56a9('0x45')]=[{'all':!![]}];}return db[_0x56a9('0x2f')][_0x56a9('0x46')](_0x2fbd5d);})['then'](function(_0x1f8b30){_0x5879db['rows']=_0x1f8b30;return _0x5879db;})[_0x56a9('0x27')](respondWithFilteredResult(_0x11002a,_0x2fbd5d))['catch'](handleError(_0x11002a,null));};exports[_0x56a9('0x47')]=function(_0x39c445,_0x3998f1){var _0x49286b={'raw':!![],'where':{'id':_0x39c445['params']['id']}},_0x5192d8={};_0x5192d8['model']=_[_0x56a9('0x48')](db[_0x56a9('0x2f')][_0x56a9('0x30')]);_0x5192d8[_0x56a9('0x35')]=_[_0x56a9('0x48')](_0x39c445[_0x56a9('0x35')]);_0x5192d8[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],_0x5192d8[_0x56a9('0x35')]);_0x49286b[_0x56a9('0x39')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],qs[_0x56a9('0x38')](_0x39c445['query'][_0x56a9('0x38')]));_0x49286b[_0x56a9('0x39')]=_0x49286b[_0x56a9('0x39')]['length']?_0x49286b[_0x56a9('0x39')]:_0x5192d8[_0x56a9('0x34')];if(_0x39c445['query'][_0x56a9('0x49')]){_0x49286b[_0x56a9('0x45')]=[{'all':!![]}];}_0x49286b=_[_0x56a9('0x43')]({},_0x49286b,_0x39c445[_0x56a9('0x44')]);return db['ContactItemType'][_0x56a9('0x4a')](_0x49286b)[_0x56a9('0x27')](handleEntityNotFound(_0x3998f1,null))[_0x56a9('0x27')](respondWithResult(_0x3998f1,null))[_0x56a9('0x4b')](handleError(_0x3998f1,null));};exports[_0x56a9('0x4c')]=function(_0x3942d8,_0x31aaf5){return db[_0x56a9('0x2f')][_0x56a9('0x4c')](_0x3942d8[_0x56a9('0x4d')],{})[_0x56a9('0x27')](function(_0x500656){var _0x58d370=_0x3942d8[_0x56a9('0x4e')][_0x56a9('0x29')]({'plain':!![]});if(!_0x58d370)throw new Error(_0x56a9('0x4f'));if(_0x58d370[_0x56a9('0x50')]==='user'){var _0x1986f2=_0x500656[_0x56a9('0x29')]({'plain':!![]});var _0x26ad3e=_0x56a9('0x2a');return db['UserProfileSection'][_0x56a9('0x4a')]({'where':{'name':_0x26ad3e,'userProfileId':_0x58d370[_0x56a9('0x51')]},'raw':!![]})['then'](function(_0x1ff42f){if(_0x1ff42f&&_0x1ff42f[_0x56a9('0x52')]===0x0){return db['UserProfileResource'][_0x56a9('0x4c')]({'name':_0x1986f2[_0x56a9('0x2c')],'resourceId':_0x1986f2['id'],'type':_0x1ff42f[_0x56a9('0x2c')],'sectionId':_0x1ff42f['id']},{})[_0x56a9('0x27')](function(){return _0x500656;});}else{return _0x500656;}})['catch'](function(_0x4938d6){logger[_0x56a9('0x2b')](_0x56a9('0x53'),_0x4938d6);throw _0x4938d6;});}return _0x500656;})[_0x56a9('0x27')](respondWithResult(_0x31aaf5,0xc9))[_0x56a9('0x4b')](handleError(_0x31aaf5,null));};exports[_0x56a9('0x26')]=function(_0xce9dc0,_0x798b4e){if(_0xce9dc0[_0x56a9('0x4d')]['id']){delete _0xce9dc0[_0x56a9('0x4d')]['id'];}return db[_0x56a9('0x2f')]['find']({'where':{'id':_0xce9dc0[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x798b4e,null))[_0x56a9('0x27')](saveUpdates(_0xce9dc0[_0x56a9('0x4d')],null))[_0x56a9('0x27')](respondWithResult(_0x798b4e,null))[_0x56a9('0x4b')](handleError(_0x798b4e,null));};exports[_0x56a9('0x28')]=function(_0x488577,_0x870aa5){return db[_0x56a9('0x2f')][_0x56a9('0x4a')]({'where':{'id':_0x488577[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x870aa5,null))[_0x56a9('0x27')](db[_0x56a9('0x55')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x488577[_0x56a9('0x54')]['id']}}))['then'](removeEntity(_0x870aa5,null))['catch'](handleError(_0x870aa5,null));}; \ No newline at end of file +var _0x02ce=['role','UserProfileSection','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','ContactItemTypes','UserProfileResource','end','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','get'];(function(_0x1fd8b3,_0x3bd29a){var _0x1f461f=function(_0x171f72){while(--_0x171f72){_0x1fd8b3['push'](_0x1fd8b3['shift']());}};_0x1f461f(++_0x3bd29a);}(_0x02ce,0x1ac));var _0xe02c=function(_0x43794a,_0x145c34){_0x43794a=_0x43794a-0x0;var _0x519742=_0x02ce[_0x43794a];return _0x519742;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){var _0x60b65e=_0xf41d4c['get']({'plain':!![]});var _0xefd882=_0xe02c('0x2a');return db[_0xe02c('0x2b')][_0xe02c('0x29')]({'where':{'type':_0xefd882,'resourceId':_0x60b65e['id']}})[_0xe02c('0x28')](function(){return _0xf41d4c;});})[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)[_0xe02c('0x2c')]();});}};}function handleEntityNotFound(_0x55ef2a,_0x55e475){return function(_0x3790eb){if(!_0x3790eb){_0x55ef2a[_0xe02c('0x1c')](0x194);}return _0x3790eb;};}function handleError(_0x481e02,_0x18b572){_0x18b572=_0x18b572||0x1f4;return function(_0x2d1d98){logger[_0xe02c('0x2d')](_0x2d1d98[_0xe02c('0x2e')]);if(_0x2d1d98[_0xe02c('0x2f')]){delete _0x2d1d98[_0xe02c('0x2f')];}_0x481e02[_0xe02c('0x22')](_0x18b572)[_0xe02c('0x30')](_0x2d1d98);};}exports[_0xe02c('0x31')]=function(_0x288004,_0x17d5b3){var _0x5a2da0={},_0x3c3d2c={},_0x3c1858={'count':0x0,'rows':[]};var _0x22b783=_[_0xe02c('0x32')](db[_0xe02c('0x33')][_0xe02c('0x34')],function(_0x58bf16){return{'name':_0x58bf16[_0xe02c('0x35')],'type':_0x58bf16[_0xe02c('0x36')]['key']};});_0x3c3d2c[_0xe02c('0x37')]=_[_0xe02c('0x32')](_0x22b783,_0xe02c('0x2f'));_0x3c3d2c[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x288004['query']);_0x3c3d2c['filters']=_[_0xe02c('0x3a')](_0x3c3d2c[_0xe02c('0x37')],_0x3c3d2c['query']);_0x5a2da0[_0xe02c('0x3b')]=_['intersection'](_0x3c3d2c[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x288004[_0xe02c('0x38')][_0xe02c('0x3c')]));_0x5a2da0[_0xe02c('0x3b')]=_0x5a2da0['attributes'][_0xe02c('0x3d')]?_0x5a2da0['attributes']:_0x3c3d2c[_0xe02c('0x37')];if(!_0x288004[_0xe02c('0x38')][_0xe02c('0x3e')](_0xe02c('0x3f'))){_0x5a2da0[_0xe02c('0x21')]=qs[_0xe02c('0x21')](_0x288004['query'][_0xe02c('0x21')]);_0x5a2da0[_0xe02c('0x1e')]=qs['offset'](_0x288004[_0xe02c('0x38')][_0xe02c('0x1e')]);}_0x5a2da0['order']=qs[_0xe02c('0x40')](_0x288004['query'][_0xe02c('0x40')]);_0x5a2da0[_0xe02c('0x41')]=qs['filters'](_[_0xe02c('0x42')](_0x288004[_0xe02c('0x38')],_0x3c3d2c[_0xe02c('0x43')]),_0x22b783);if(_0x288004[_0xe02c('0x38')][_0xe02c('0x44')]){_0x5a2da0[_0xe02c('0x41')]=_['merge'](_0x5a2da0[_0xe02c('0x41')],{'$or':_['map'](_0x22b783,function(_0x5ae8cd){if(_0x5ae8cd[_0xe02c('0x36')]!==_0xe02c('0x45')){var _0x42fbac={};_0x42fbac[_0x5ae8cd[_0xe02c('0x2f')]]={'$like':'%'+_0x288004['query'][_0xe02c('0x44')]+'%'};return _0x42fbac;}})});}_0x5a2da0=_[_0xe02c('0x46')]({},_0x5a2da0,_0x288004[_0xe02c('0x47')]);var _0x5baef6={'where':_0x5a2da0['where']};return db[_0xe02c('0x33')][_0xe02c('0x20')](_0x5baef6)[_0xe02c('0x28')](function(_0x2313d2){_0x3c1858[_0xe02c('0x20')]=_0x2313d2;if(_0x288004[_0xe02c('0x38')][_0xe02c('0x48')]){_0x5a2da0[_0xe02c('0x49')]=[{'all':!![]}];}return db[_0xe02c('0x33')]['findAll'](_0x5a2da0);})[_0xe02c('0x28')](function(_0x5ef4a1){_0x3c1858['rows']=_0x5ef4a1;return _0x3c1858;})[_0xe02c('0x28')](respondWithFilteredResult(_0x17d5b3,_0x5a2da0))[_0xe02c('0x4a')](handleError(_0x17d5b3,null));};exports[_0xe02c('0x4b')]=function(_0x1719cf,_0x24d506){var _0x12ca0e={'raw':!![],'where':{'id':_0x1719cf[_0xe02c('0x4c')]['id']}},_0x165f4a={};_0x165f4a['model']=_['keys'](db[_0xe02c('0x33')][_0xe02c('0x34')]);_0x165f4a[_0xe02c('0x38')]=_['keys'](_0x1719cf[_0xe02c('0x38')]);_0x165f4a[_0xe02c('0x43')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],_0x165f4a[_0xe02c('0x38')]);_0x12ca0e[_0xe02c('0x3b')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x1719cf[_0xe02c('0x38')]['fields']));_0x12ca0e[_0xe02c('0x3b')]=_0x12ca0e[_0xe02c('0x3b')][_0xe02c('0x3d')]?_0x12ca0e[_0xe02c('0x3b')]:_0x165f4a[_0xe02c('0x37')];if(_0x1719cf[_0xe02c('0x38')][_0xe02c('0x48')]){_0x12ca0e[_0xe02c('0x49')]=[{'all':!![]}];}_0x12ca0e=_[_0xe02c('0x46')]({},_0x12ca0e,_0x1719cf[_0xe02c('0x47')]);return db[_0xe02c('0x33')][_0xe02c('0x4d')](_0x12ca0e)[_0xe02c('0x28')](handleEntityNotFound(_0x24d506,null))['then'](respondWithResult(_0x24d506,null))[_0xe02c('0x4a')](handleError(_0x24d506,null));};exports['create']=function(_0x15b05c,_0x324911){return db[_0xe02c('0x33')][_0xe02c('0x4e')](_0x15b05c[_0xe02c('0x4f')],{})[_0xe02c('0x28')](function(_0x160969){var _0xc2b5dd=_0x15b05c[_0xe02c('0x50')][_0xe02c('0x51')]({'plain':!![]});if(!_0xc2b5dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc2b5dd[_0xe02c('0x52')]===_0xe02c('0x50')){var _0xeb4214=_0x160969['get']({'plain':!![]});var _0xdab6cb='ContactItemTypes';return db[_0xe02c('0x53')]['find']({'where':{'name':_0xdab6cb,'userProfileId':_0xc2b5dd['userProfileId']},'raw':!![]})['then'](function(_0x55cf99){if(_0x55cf99&&_0x55cf99['autoAssociation']===0x0){return db['UserProfileResource'][_0xe02c('0x4e')]({'name':_0xeb4214[_0xe02c('0x2f')],'resourceId':_0xeb4214['id'],'type':_0x55cf99[_0xe02c('0x2f')],'sectionId':_0x55cf99['id']},{})[_0xe02c('0x28')](function(){return _0x160969;});}else{return _0x160969;}})['catch'](function(_0x274beb){logger[_0xe02c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x274beb);throw _0x274beb;});}return _0x160969;})[_0xe02c('0x28')](respondWithResult(_0x324911,0xc9))[_0xe02c('0x4a')](handleError(_0x324911,null));};exports[_0xe02c('0x27')]=function(_0x51f940,_0x57a00f){if(_0x51f940[_0xe02c('0x4f')]['id']){delete _0x51f940[_0xe02c('0x4f')]['id'];}return db[_0xe02c('0x33')]['find']({'where':{'id':_0x51f940[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57a00f,null))['then'](saveUpdates(_0x51f940[_0xe02c('0x4f')],null))[_0xe02c('0x28')](respondWithResult(_0x57a00f,null))['catch'](handleError(_0x57a00f,null));};exports[_0xe02c('0x29')]=function(_0x849eea,_0x1ead72){return db['ContactItemType'][_0xe02c('0x4d')]({'where':{'id':_0x849eea[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ead72,null))[_0xe02c('0x28')](db[_0xe02c('0x54')][_0xe02c('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x849eea[_0xe02c('0x4c')]['id']}}))[_0xe02c('0x28')](removeEntity(_0x1ead72,null))[_0xe02c('0x4a')](handleError(_0x1ead72,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 7e5ed1d..570f5ae 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 _0x6dca=['../../config/logger','moment','bluebird','request-promise','path','tools_contact_item_types','util'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6dca,0x1d4));var _0xa6dc=function(_0x218d8a,_0x39bd04){_0x218d8a=_0x218d8a-0x0;var _0x3ffaca=_0x6dca[_0x218d8a];return _0x3ffaca;};'use strict';var _=require('lodash');var util=require(_0xa6dc('0x0'));var logger=require(_0xa6dc('0x1'))('api');var moment=require(_0xa6dc('0x2'));var BPromise=require(_0xa6dc('0x3'));var rp=require(_0xa6dc('0x4'));var fs=require('fs');var path=require(_0xa6dc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module['exports']=function(_0x6da517,_0x261877){return _0x6da517['define']('ContactItemType',attributes,{'tableName':_0xa6dc('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50fe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api'];(function(_0xbfc560,_0x311fba){var _0x47b022=function(_0x2cd37f){while(--_0x2cd37f){_0xbfc560['push'](_0xbfc560['shift']());}};_0x47b022(++_0x311fba);}(_0x50fe,0x92));var _0xe50f=function(_0x520d65,_0x99d12e){_0x520d65=_0x520d65-0x0;var _0x4e76d2=_0x50fe[_0x520d65];return _0x4e76d2;};'use strict';var _=require(_0xe50f('0x0'));var util=require(_0xe50f('0x1'));var logger=require(_0xe50f('0x2'))(_0xe50f('0x3'));var moment=require(_0xe50f('0x4'));var BPromise=require(_0xe50f('0x5'));var rp=require(_0xe50f('0x6'));var fs=require('fs');var path=require(_0xe50f('0x7'));var rimraf=require(_0xe50f('0x8'));var config=require(_0xe50f('0x9'));var attributes=require(_0xe50f('0xa'));module[_0xe50f('0xb')]=function(_0x3c82bd,_0x11a7bc){return _0x3c82bd[_0xe50f('0xc')](_0xe50f('0xd'),attributes,{'tableName':_0xe50f('0xe'),'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 f53050d..260d474 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 _0x382a=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x96b744,_0x4a1732){var _0x5539a4=function(_0x45e8e5){while(--_0x45e8e5){_0x96b744['push'](_0x96b744['shift']());}};_0x5539a4(++_0x4a1732);}(_0x382a,0x120));var _0xa382=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x382a[_0x3e531a];return _0x3c2574;};'use strict';var _=require(_0xa382('0x0'));var util=require(_0xa382('0x1'));var moment=require('moment');var BPromise=require(_0xa382('0x2'));var rs=require(_0xa382('0x3'));var fs=require('fs');var Redis=require(_0xa382('0x4'));var db=require(_0xa382('0x5'))['db'];var utils=require(_0xa382('0x6'));var logger=require(_0xa382('0x7'))(_0xa382('0x8'));var config=require(_0xa382('0x9'));var jayson=require(_0xa382('0xa'));var client=jayson['client'][_0xa382('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7008e5,_0x5a34ea,_0x333d5a){return new BPromise(function(_0x17ed0f,_0x1b0813){return client[_0xa382('0xc')](_0x7008e5,_0x333d5a)[_0xa382('0xd')](function(_0x41a904){logger[_0xa382('0xe')](_0xa382('0xf'),_0x5a34ea,'request\x20sent');logger['debug'](_0xa382('0x10'),_0x5a34ea,_0xa382('0x11'),JSON[_0xa382('0x12')](_0x41a904));if(_0x41a904[_0xa382('0x13')]){if(_0x41a904[_0xa382('0x13')]['code']===0x1f4){logger[_0xa382('0x13')](_0xa382('0xf'),_0x5a34ea,_0x41a904[_0xa382('0x13')][_0xa382('0x14')]);return _0x1b0813(_0x41a904['error']['message']);}logger[_0xa382('0x13')](_0xa382('0xf'),_0x5a34ea,_0x41a904['error']['message']);return _0x17ed0f(_0x41a904['error'][_0xa382('0x14')]);}else{logger[_0xa382('0xe')]('ContactItemType,\x20%s,\x20%s',_0x5a34ea,_0xa382('0x11'));_0x17ed0f(_0x41a904[_0xa382('0x15')][_0xa382('0x14')]);}})['catch'](function(_0x420f55){logger[_0xa382('0x13')](_0xa382('0xf'),_0x5a34ea,_0x420f55);_0x1b0813(_0x420f55);});});} \ No newline at end of file +var _0x342e=['result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3a246d,_0x8031fa){var _0x1a4162=function(_0x13c4da){while(--_0x13c4da){_0x3a246d['push'](_0x3a246d['shift']());}};_0x1a4162(++_0x8031fa);}(_0x342e,0xde));var _0xe342=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0x342e[_0x5948dd];return _0xb1f8be;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var moment=require(_0xe342('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe342('0x3'));var db=require(_0xe342('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe342('0x5'));var config=require(_0xe342('0x6'));var jayson=require(_0xe342('0x7'));var client=jayson[_0xe342('0x8')][_0xe342('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e643a,_0x57895b,_0x3457ac){return new BPromise(function(_0x36bb18,_0x54868d){return client['request'](_0x5e643a,_0x3457ac)[_0xe342('0xa')](function(_0x2b2e82){logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));logger[_0xe342('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x57895b,_0xe342('0xd'),JSON[_0xe342('0xf')](_0x2b2e82));if(_0x2b2e82[_0xe342('0x10')]){if(_0x2b2e82[_0xe342('0x10')]['code']===0x1f4){logger[_0xe342('0x10')]('ContactItemType,\x20%s,\x20%s',_0x57895b,_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);return _0x54868d(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}logger['error'](_0xe342('0xc'),_0x57895b,_0x2b2e82[_0xe342('0x10')]['message']);return _0x36bb18(_0x2b2e82[_0xe342('0x10')][_0xe342('0x11')]);}else{logger[_0xe342('0xb')](_0xe342('0xc'),_0x57895b,_0xe342('0xd'));_0x36bb18(_0x2b2e82[_0xe342('0x12')][_0xe342('0x11')]);}})[_0xe342('0x13')](function(_0x190a90){logger[_0xe342('0x10')](_0xe342('0xc'),_0x57895b,_0x190a90);_0x54868d(_0x190a90);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 40849db..153834f 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 _0x13a3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show','post','put','update','delete','multer','util','path'];(function(_0x7113ee,_0x50595d){var _0x18a64d=function(_0x4d8548){while(--_0x4d8548){_0x7113ee['push'](_0x7113ee['shift']());}};_0x18a64d(++_0x50595d);}(_0x13a3,0x162));var _0x313a=function(_0x266eec,_0x1244d4){_0x266eec=_0x266eec-0x0;var _0x51f1a6=_0x13a3[_0x266eec];return _0x51f1a6;};'use strict';var multer=require(_0x313a('0x0'));var util=require(_0x313a('0x1'));var path=require(_0x313a('0x2'));var timeout=require('connect-timeout');var express=require(_0x313a('0x3'));var router=express[_0x313a('0x4')]();var fs_extra=require(_0x313a('0x5'));var auth=require(_0x313a('0x6'));var interaction=require(_0x313a('0x7'));var config=require(_0x313a('0x8'));var controller=require(_0x313a('0x9'));router[_0x313a('0xa')]('/',auth[_0x313a('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x313a('0xc')]);router[_0x313a('0xd')]('/',auth[_0x313a('0xb')](),controller['create']);router[_0x313a('0xe')]('/:id',auth[_0x313a('0xb')](),controller[_0x313a('0xf')]);router[_0x313a('0x10')]('/:id',auth[_0x313a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x303a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','Router'];(function(_0x431c2b,_0x13baf3){var _0x384637=function(_0x46191f){while(--_0x46191f){_0x431c2b['push'](_0x431c2b['shift']());}};_0x384637(++_0x13baf3);}(_0x303a,0x1b8));var _0xa303=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x303a[_0xa8b370];return _0x643e37;};'use strict';var multer=require('multer');var util=require(_0xa303('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa303('0x1')]();var fs_extra=require(_0xa303('0x2'));var auth=require(_0xa303('0x3'));var interaction=require(_0xa303('0x4'));var config=require(_0xa303('0x5'));var controller=require(_0xa303('0x6'));router[_0xa303('0x7')]('/',auth[_0xa303('0x8')](),controller[_0xa303('0x9')]);router['get'](_0xa303('0xa'),auth[_0xa303('0x8')](),controller[_0xa303('0xb')]);router[_0xa303('0xc')]('/',auth[_0xa303('0x8')](),controller[_0xa303('0xd')]);router['put'](_0xa303('0xa'),auth['isAuthenticated'](),controller[_0xa303('0xe')]);router[_0xa303('0xf')](_0xa303('0xa'),auth[_0xa303('0x8')](),controller[_0xa303('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7939281..3b72800 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xb7e7[_0x2555d0];return _0x3bb486;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3df426a..e01154c 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 _0x13ed=['updatedAt','iframe','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','hasOwnProperty','getItems','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','CustomDashboards','UserProfileResource','end','sendStatus','error','name','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt'];(function(_0x490a3d,_0x54983e){var _0xb4575d=function(_0x4b67f8){while(--_0x4b67f8){_0x490a3d['push'](_0x490a3d['shift']());}};_0xb4575d(++_0x54983e);}(_0x13ed,0xa2));var _0xd13e=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x13ed[_0x210603];return _0x1bcb7d;};'use strict';var emlformat=require(_0xd13e('0x0'));var rimraf=require(_0xd13e('0x1'));var zipdir=require(_0xd13e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd13e('0x3'));var moment=require('moment');var BPromise=require(_0xd13e('0x4'));var Mustache=require(_0xd13e('0x5'));var util=require(_0xd13e('0x6'));var path=require('path');var sox=require(_0xd13e('0x7'));var csv=require('to-csv');var ejs=require(_0xd13e('0x8'));var fs=require('fs');var fs_extra=require(_0xd13e('0x9'));var _=require(_0xd13e('0xa'));var squel=require(_0xd13e('0xb'));var crypto=require(_0xd13e('0xc'));var jsforce=require(_0xd13e('0xd'));var deskjs=require(_0xd13e('0xe'));var toCsv=require(_0xd13e('0xf'));var querystring=require(_0xd13e('0x10'));var Papa=require(_0xd13e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd13e('0x12'));var hardwareService=require(_0xd13e('0x13'));var logger=require(_0xd13e('0x14'))(_0xd13e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd13e('0x16'));var db=require(_0xd13e('0x17'))['db'];config[_0xd13e('0x18')]=_[_0xd13e('0x19')](config['redis'],{'host':_0xd13e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0xd13e('0x1b')](socket);function respondWithStatusCode(_0x1ee1d2,_0x779b92){_0x779b92=_0x779b92||0xcc;return function(_0x53d326){if(_0x53d326){return _0x1ee1d2['sendStatus'](_0x779b92);}return _0x1ee1d2[_0xd13e('0x1c')](_0x779b92)['end']();};}function respondWithResult(_0x4c171e,_0x190ae5){_0x190ae5=_0x190ae5||0xc8;return function(_0x174a13){if(_0x174a13){return _0x4c171e[_0xd13e('0x1c')](_0x190ae5)['json'](_0x174a13);}};}function respondWithFilteredResult(_0x241a52,_0x2e5ae2){return function(_0x1a4fc0){if(_0x1a4fc0){var _0x83da2f=typeof _0x2e5ae2['offset']===_0xd13e('0x1d')&&typeof _0x2e5ae2[_0xd13e('0x1e')]===_0xd13e('0x1d');var _0x591bf6=_0x1a4fc0[_0xd13e('0x1f')];var _0xfe1f26=_0x83da2f?0x0:_0x2e5ae2['offset'];var _0x59baa5=_0x83da2f?_0x1a4fc0[_0xd13e('0x1f')]:_0x2e5ae2[_0xd13e('0x20')]+_0x2e5ae2[_0xd13e('0x1e')];var _0x17505a;if(_0x59baa5>=_0x591bf6){_0x59baa5=_0x591bf6;_0x17505a=0xc8;}else{_0x17505a=0xce;}_0x241a52['status'](_0x17505a);return _0x241a52[_0xd13e('0x21')](_0xd13e('0x22'),_0xfe1f26+'-'+_0x59baa5+'/'+_0x591bf6)['json'](_0x1a4fc0);}return null;};}function patchUpdates(_0x5d157e){return function(_0x31218c){try{jsonpatch['apply'](_0x31218c,_0x5d157e,!![]);}catch(_0xd9e4de){return BPromise[_0xd13e('0x23')](_0xd9e4de);}return _0x31218c[_0xd13e('0x24')]();};}function saveUpdates(_0xb4bb80,_0x448f30){return function(_0x306348){if(_0x306348){return _0x306348[_0xd13e('0x25')](_0xb4bb80)['then'](function(_0x485ef0){return _0x485ef0;});}return null;};}function removeEntity(_0x29eb74,_0x3d07ed){return function(_0x2e6fcc){if(_0x2e6fcc){return _0x2e6fcc[_0xd13e('0x26')]()[_0xd13e('0x27')](function(){var _0x518777=_0x2e6fcc['get']({'plain':!![]});var _0x1665f5=_0xd13e('0x28');return db[_0xd13e('0x29')]['destroy']({'where':{'type':_0x1665f5,'resourceId':_0x518777['id']}})['then'](function(){return _0x2e6fcc;});})[_0xd13e('0x27')](function(){_0x29eb74[_0xd13e('0x1c')](0xcc)[_0xd13e('0x2a')]();});}};}function handleEntityNotFound(_0x244d59,_0x23587b){return function(_0x568ed8){if(!_0x568ed8){_0x244d59[_0xd13e('0x2b')](0x194);}return _0x568ed8;};}function handleError(_0x3bbf4a,_0x3553b9){_0x3553b9=_0x3553b9||0x1f4;return function(_0x4fb8c4){logger[_0xd13e('0x2c')](_0x4fb8c4['stack']);if(_0x4fb8c4[_0xd13e('0x2d')]){delete _0x4fb8c4[_0xd13e('0x2d')];}_0x3bbf4a[_0xd13e('0x1c')](_0x3553b9)['send'](_0x4fb8c4);};}exports[_0xd13e('0x2e')]=function(_0x299e34,_0x4af537){var _0x383a55={},_0x18509b={},_0x29ada8={'count':0x0,'rows':[]};var _0x327a18=_['map'](db[_0xd13e('0x2f')][_0xd13e('0x30')],function(_0x2e7ec1){return{'name':_0x2e7ec1[_0xd13e('0x31')],'type':_0x2e7ec1[_0xd13e('0x32')][_0xd13e('0x33')]};});_0x18509b[_0xd13e('0x34')]=_[_0xd13e('0x35')](_0x327a18,_0xd13e('0x2d'));_0x18509b[_0xd13e('0x36')]=_[_0xd13e('0x37')](_0x299e34['query']);_0x18509b[_0xd13e('0x38')]=_[_0xd13e('0x39')](_0x18509b['model'],_0x18509b[_0xd13e('0x36')]);_0x383a55[_0xd13e('0x3a')]=_[_0xd13e('0x39')](_0x18509b['model'],qs[_0xd13e('0x3b')](_0x299e34[_0xd13e('0x36')][_0xd13e('0x3b')]));_0x383a55[_0xd13e('0x3a')]=_0x383a55[_0xd13e('0x3a')][_0xd13e('0x3c')]?_0x383a55[_0xd13e('0x3a')]:_0x18509b[_0xd13e('0x34')];if(!_0x299e34[_0xd13e('0x36')]['hasOwnProperty'](_0xd13e('0x3d'))){_0x383a55[_0xd13e('0x1e')]=qs[_0xd13e('0x1e')](_0x299e34[_0xd13e('0x36')][_0xd13e('0x1e')]);_0x383a55[_0xd13e('0x20')]=qs[_0xd13e('0x20')](_0x299e34['query']['offset']);}_0x383a55[_0xd13e('0x3e')]=qs[_0xd13e('0x3f')](_0x299e34[_0xd13e('0x36')][_0xd13e('0x3f')]);_0x383a55['where']=qs[_0xd13e('0x38')](_[_0xd13e('0x40')](_0x299e34['query'],_0x18509b[_0xd13e('0x38')]),_0x327a18);if(_0x299e34['query'][_0xd13e('0x41')]){_0x383a55['where']=_[_0xd13e('0x42')](_0x383a55[_0xd13e('0x43')],{'$or':_['map'](_0x327a18,function(_0x307c6a){if(_0x307c6a[_0xd13e('0x32')]!==_0xd13e('0x44')){var _0x1fac17={};_0x1fac17[_0x307c6a[_0xd13e('0x2d')]]={'$like':'%'+_0x299e34[_0xd13e('0x36')]['filter']+'%'};return _0x1fac17;}})});}_0x383a55=_[_0xd13e('0x42')]({},_0x383a55,_0x299e34[_0xd13e('0x45')]);var _0x35b0cc={'where':_0x383a55[_0xd13e('0x43')]};return db['Dashboard'][_0xd13e('0x1f')](_0x35b0cc)[_0xd13e('0x27')](function(_0x1b8c12){_0x29ada8[_0xd13e('0x1f')]=_0x1b8c12;if(_0x299e34['query'][_0xd13e('0x46')]){_0x383a55[_0xd13e('0x47')]=[{'all':!![]}];}return db[_0xd13e('0x2f')][_0xd13e('0x48')](_0x383a55);})[_0xd13e('0x27')](function(_0x316b34){_0x29ada8[_0xd13e('0x49')]=_0x316b34;return _0x29ada8;})['then'](respondWithFilteredResult(_0x4af537,_0x383a55))['catch'](handleError(_0x4af537,null));};exports['show']=function(_0x216940,_0x34cffa){var _0x400680={'raw':![],'where':{'id':_0x216940[_0xd13e('0x4a')]['id']}},_0x3629f6={};_0x3629f6[_0xd13e('0x34')]=_[_0xd13e('0x37')](db['Dashboard']['rawAttributes']);_0x3629f6[_0xd13e('0x36')]=_[_0xd13e('0x37')](_0x216940['query']);_0x3629f6['filters']=_[_0xd13e('0x39')](_0x3629f6[_0xd13e('0x34')],_0x3629f6[_0xd13e('0x36')]);_0x400680[_0xd13e('0x3a')]=_[_0xd13e('0x39')](_0x3629f6[_0xd13e('0x34')],qs[_0xd13e('0x3b')](_0x216940['query'][_0xd13e('0x3b')]));_0x400680[_0xd13e('0x3a')]=_0x400680[_0xd13e('0x3a')][_0xd13e('0x3c')]?_0x400680['attributes']:_0x3629f6[_0xd13e('0x34')];if(_0x216940[_0xd13e('0x36')]['includeAll']){_0x400680[_0xd13e('0x47')]=[{'all':!![]}];}_0x400680=_[_0xd13e('0x42')]({},_0x400680,_0x216940['options']);return db['Dashboard'][_0xd13e('0x4b')](_0x400680)[_0xd13e('0x27')](handleEntityNotFound(_0x34cffa,null))[_0xd13e('0x27')](respondWithResult(_0x34cffa,null))['catch'](handleError(_0x34cffa,null));};exports[_0xd13e('0x4c')]=function(_0x4fb400,_0x1a70f9){return db[_0xd13e('0x2f')][_0xd13e('0x4c')](_0x4fb400[_0xd13e('0x4d')],{})[_0xd13e('0x27')](function(_0x16084d){var _0x44d36c=_0x4fb400[_0xd13e('0x4e')][_0xd13e('0x4f')]({'plain':!![]});if(!_0x44d36c)throw new Error(_0xd13e('0x50'));if(_0x44d36c[_0xd13e('0x51')]===_0xd13e('0x4e')){var _0x3300a6=_0x16084d[_0xd13e('0x4f')]({'plain':!![]});var _0x1a67c1=_0xd13e('0x28');return db[_0xd13e('0x52')]['find']({'where':{'name':_0x1a67c1,'userProfileId':_0x44d36c[_0xd13e('0x53')]},'raw':!![]})[_0xd13e('0x27')](function(_0x81283d){if(_0x81283d&&_0x81283d[_0xd13e('0x54')]===0x0){return db['UserProfileResource'][_0xd13e('0x4c')]({'name':_0x3300a6['name'],'resourceId':_0x3300a6['id'],'type':_0x81283d[_0xd13e('0x2d')],'sectionId':_0x81283d['id']},{})[_0xd13e('0x27')](function(){return _0x16084d;});}else{return _0x16084d;}})[_0xd13e('0x55')](function(_0x26e64f){logger['error'](_0xd13e('0x56'),_0x26e64f);throw _0x26e64f;});}return _0x16084d;})[_0xd13e('0x27')](respondWithResult(_0x1a70f9,0xc9))[_0xd13e('0x55')](handleError(_0x1a70f9,null));};exports[_0xd13e('0x57')]=function(_0x412fb2,_0x203240){var _0x5225f6={'where':{'id':_0x412fb2[_0xd13e('0x4a')]['id']}},_0x300bef={};_0x300bef['model']=_[_0xd13e('0x37')](db[_0xd13e('0x2f')][_0xd13e('0x30')]);_0x5225f6[_0xd13e('0x3a')]=_[_0xd13e('0x39')](_0x300bef[_0xd13e('0x34')],qs['fields'](_0x412fb2[_0xd13e('0x36')][_0xd13e('0x3b')]));_0x5225f6[_0xd13e('0x3a')]=_0x5225f6[_0xd13e('0x3a')]['length']?_0x5225f6['attributes']:_0x300bef[_0xd13e('0x34')];if(_0x412fb2[_0xd13e('0x36')][_0xd13e('0x46')]){_0x5225f6[_0xd13e('0x47')]=[{'all':!![]}];}_0x5225f6=_[_0xd13e('0x42')]({},_0x5225f6,_0x412fb2[_0xd13e('0x45')]);return db[_0xd13e('0x2f')]['find'](_0x5225f6)[_0xd13e('0x27')](handleEntityNotFound(_0x203240,null))[_0xd13e('0x27')](function(_0x5c16c7){if(_0x5c16c7){var _0x383742=_0x5c16c7[_0xd13e('0x4f')]({'plain':!![]});_0x383742=qs[_0xd13e('0x58')](_0x383742,['id',_0xd13e('0x59'),_0xd13e('0x5a')]);_0x412fb2['body']=_['omit'](_0x412fb2[_0xd13e('0x4d')],['id','createdAt',_0xd13e('0x5a')]);return db[_0xd13e('0x2f')][_0xd13e('0x4c')](_[_0xd13e('0x42')](_0x383742,_0x412fb2[_0xd13e('0x4d')]),{'include':_0x412fb2[_0xd13e('0x36')][_0xd13e('0x46')]?[{'all':!![]}]:undefined})[_0xd13e('0x27')](function(_0x416c1e){var _0x40619e=_0x412fb2['user']['get']({'plain':!![]});if(!_0x40619e)throw new Error(_0xd13e('0x50'));if(_0x40619e['role']==='user'){var _0x13e771=_0x416c1e['get']({'plain':!![]});var _0xc6c6ce=_0xd13e('0x28');return db[_0xd13e('0x52')]['find']({'where':{'name':_0xc6c6ce,'userProfileId':_0x40619e[_0xd13e('0x53')]},'raw':!![]})['then'](function(_0x112f2e){if(_0x112f2e&&_0x112f2e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x13e771[_0xd13e('0x2d')],'resourceId':_0x13e771['id'],'type':_0x112f2e[_0xd13e('0x2d')],'sectionId':_0x112f2e['id']},{})[_0xd13e('0x27')](function(){return _0x416c1e;});}else{return _0x416c1e;}})['catch'](function(_0x27998b){logger[_0xd13e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27998b);throw _0x27998b;});}return _0x416c1e;});}})[_0xd13e('0x27')](respondWithResult(_0x203240,0xc9))[_0xd13e('0x55')](handleError(_0x203240,null));};exports['update']=function(_0x5edb3f,_0x171d15){if(_0x5edb3f[_0xd13e('0x4d')]['id']){delete _0x5edb3f['body']['id'];}return db[_0xd13e('0x2f')]['find']({'where':{'id':_0x5edb3f['params']['id']}})['then'](handleEntityNotFound(_0x171d15,null))[_0xd13e('0x27')](saveUpdates(_0x5edb3f['body'],null))['then'](respondWithResult(_0x171d15,null))[_0xd13e('0x55')](handleError(_0x171d15,null));};exports[_0xd13e('0x26')]=function(_0x5f42ea,_0x5cbe43){return db['Dashboard'][_0xd13e('0x4b')]({'where':{'id':_0x5f42ea['params']['id']}})['then'](handleEntityNotFound(_0x5cbe43,null))[_0xd13e('0x27')](removeEntity(_0x5cbe43,null))[_0xd13e('0x55')](handleError(_0x5cbe43,null));};function widgetAttributes(_0x1d6cc4){try{switch(_0x1d6cc4[_0xd13e('0x32')]){case _0xd13e('0x5b'):return[{'name':_0xd13e('0x5c'),'value':_0x1d6cc4['attrUrl']||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x0]?_0x1d6cc4['attrs'][0x0]['value']:undefined)||'https://'}];case _0xd13e('0x5e'):return[{'name':'attrPath','value':_0x1d6cc4[_0xd13e('0x5f')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x0]?_0x1d6cc4[_0xd13e('0x5d')][0x0]['value']:undefined)||''}];case _0xd13e('0x60'):return[{'name':_0xd13e('0x61'),'value':_0x1d6cc4['attrHourFormat']||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4['attrs'][0x0]?_0x1d6cc4[_0xd13e('0x5d')][0x0][_0xd13e('0x62')]:undefined)||_0xd13e('0x63')},{'name':_0xd13e('0x64'),'value':_0x1d6cc4['attrTimezone']||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x1]?_0x1d6cc4[_0xd13e('0x5d')][0x1][_0xd13e('0x62')]:undefined)||'0.00'},{'name':_0xd13e('0x65'),'value':_0x1d6cc4[_0xd13e('0x65')]||(_0x1d6cc4['attrs']&&_0x1d6cc4[_0xd13e('0x5d')][0x2]?_0x1d6cc4[_0xd13e('0x5d')][0x2][_0xd13e('0x62')]:undefined)||0xc}];case _0xd13e('0x66'):return[{'name':_0xd13e('0x67'),'value':_0x1d6cc4[_0xd13e('0x67')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x0]?_0x1d6cc4[_0xd13e('0x5d')][0x0][_0xd13e('0x62')]:undefined)||'total'},{'name':_0xd13e('0x68'),'value':_0x1d6cc4[_0xd13e('0x68')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x1]?_0x1d6cc4['attrs'][0x1][_0xd13e('0x62')]:undefined)||[]},{'name':_0xd13e('0x65'),'value':_0x1d6cc4[_0xd13e('0x65')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x2]?_0x1d6cc4[_0xd13e('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0xd13e('0x69'),'value':_0x1d6cc4[_0xd13e('0x69')]||(_0x1d6cc4['attrs']&&_0x1d6cc4['attrs'][0x3]?_0x1d6cc4['attrs'][0x3]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1d6cc4[_0xd13e('0x6a')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x4]?_0x1d6cc4['attrs'][0x4]['value']:undefined)||''},{'name':_0xd13e('0x6b'),'value':_0x1d6cc4['attrFaxAccounts']||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x5]?_0x1d6cc4[_0xd13e('0x5d')][0x5][_0xd13e('0x62')]:undefined)||''},{'name':_0xd13e('0x6c'),'value':_0x1d6cc4[_0xd13e('0x6c')]||(_0x1d6cc4['attrs']&&_0x1d6cc4['attrs'][0x6]?_0x1d6cc4[_0xd13e('0x5d')][0x6][_0xd13e('0x62')]:undefined)||''},{'name':_0xd13e('0x6d'),'value':_0x1d6cc4[_0xd13e('0x6d')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x7]?_0x1d6cc4[_0xd13e('0x5d')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1d6cc4[_0xd13e('0x6e')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4['attrs'][0x8]?_0x1d6cc4['attrs'][0x8][_0xd13e('0x62')]:undefined)||''},{'name':_0xd13e('0x6f'),'value':_0x1d6cc4[_0xd13e('0x6f')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x9]?_0x1d6cc4['attrs'][0x9][_0xd13e('0x62')]:undefined)||''}];case _0xd13e('0x70'):case _0xd13e('0x71'):return[{'name':_0xd13e('0x72'),'value':_0x1d6cc4['attrSerie1']||(_0x1d6cc4['attrs']&&_0x1d6cc4[_0xd13e('0x5d')][0x0]?_0x1d6cc4['attrs'][0x0][_0xd13e('0x62')]:undefined)||'total'},{'name':_0xd13e('0x73'),'value':_0x1d6cc4['attrSerie2']||(_0x1d6cc4['attrs']&&_0x1d6cc4[_0xd13e('0x5d')][0x1]?_0x1d6cc4[_0xd13e('0x5d')][0x1]['value']:undefined)||null},{'name':_0xd13e('0x74'),'value':_0x1d6cc4[_0xd13e('0x74')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x2]?_0x1d6cc4[_0xd13e('0x5d')][0x2][_0xd13e('0x62')]:undefined)||null},{'name':_0xd13e('0x68'),'value':_0x1d6cc4['attrVoiceQueues']||(_0x1d6cc4['attrs']&&_0x1d6cc4[_0xd13e('0x5d')][0x3]?_0x1d6cc4['attrs'][0x3][_0xd13e('0x62')]:undefined)||[]},{'name':_0xd13e('0x69'),'value':_0x1d6cc4[_0xd13e('0x69')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x4]?_0x1d6cc4[_0xd13e('0x5d')][0x4][_0xd13e('0x62')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1d6cc4[_0xd13e('0x6a')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x5]?_0x1d6cc4[_0xd13e('0x5d')][0x5][_0xd13e('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1d6cc4[_0xd13e('0x6b')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x6]?_0x1d6cc4[_0xd13e('0x5d')][0x6][_0xd13e('0x62')]:undefined)||''},{'name':_0xd13e('0x6c'),'value':_0x1d6cc4['attrSmsAccounts']||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x7]?_0x1d6cc4[_0xd13e('0x5d')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1d6cc4[_0xd13e('0x6d')]||(_0x1d6cc4['attrs']&&_0x1d6cc4[_0xd13e('0x5d')][0x8]?_0x1d6cc4['attrs'][0x8][_0xd13e('0x62')]:undefined)||''},{'name':_0xd13e('0x6e'),'value':_0x1d6cc4[_0xd13e('0x6e')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x9]?_0x1d6cc4[_0xd13e('0x5d')][0x9][_0xd13e('0x62')]:undefined)||''},{'name':_0xd13e('0x6f'),'value':_0x1d6cc4[_0xd13e('0x6f')]||(_0x1d6cc4['attrs']&&_0x1d6cc4['attrs'][0xa]?_0x1d6cc4['attrs'][0xa]['value']:undefined)||''}];case _0xd13e('0x75'):return[{'name':_0xd13e('0x76'),'type':_0x1d6cc4[_0xd13e('0x77')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4['attrs'][0x0]?_0x1d6cc4[_0xd13e('0x5d')][0x0][_0xd13e('0x32')]:undefined)||null,'value':_0x1d6cc4[_0xd13e('0x76')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x0]?_0x1d6cc4[_0xd13e('0x5d')][0x0][_0xd13e('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0x1d6cc4[_0xd13e('0x78')]||(_0x1d6cc4[_0xd13e('0x5d')]&&_0x1d6cc4[_0xd13e('0x5d')][0x1]?_0x1d6cc4[_0xd13e('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2a7e76){logger[_0xd13e('0x2c')]('widgetAttributes:\x20%s',JSON[_0xd13e('0x79')](_0x2a7e76));return[];}}exports['addItem']=function(_0x2630dc,_0x1061ab,_0x4782be){if(_0x2630dc['body']['id']){delete _0x2630dc['body']['id'];}return db[_0xd13e('0x2f')][_0xd13e('0x4b')]({'where':{'id':_0x2630dc[_0xd13e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1061ab,null))[_0xd13e('0x27')](function(_0x16c393){if(_0x16c393){_0x2630dc[_0xd13e('0x4d')][_0xd13e('0x7a')]=_0x16c393['id'];_0x2630dc[_0xd13e('0x4d')][_0xd13e('0x5d')]=widgetAttributes(_0x2630dc[_0xd13e('0x4d')]);return db[_0xd13e('0x7b')][_0xd13e('0x4c')](_0x2630dc[_0xd13e('0x4d')]);}})[_0xd13e('0x27')](respondWithResult(_0x1061ab,null))[_0xd13e('0x55')](handleError(_0x1061ab,null));};exports['getItems']=function(_0x3d744c,_0x59ac93,_0x2d6df6){var _0x5183e7={};var _0x1a2caf={};var _0x1577de;var _0x272110;return db[_0xd13e('0x2f')]['findOne']({'where':{'id':_0x3d744c['params']['id']}})[_0xd13e('0x27')](handleEntityNotFound(_0x59ac93,null))['then'](function(_0x19e47e){if(_0x19e47e){_0x1577de=_0x19e47e;_0x1a2caf['model']=_['keys'](db['DashboardItem']['rawAttributes']);_0x1a2caf['query']=_[_0xd13e('0x37')](_0x3d744c[_0xd13e('0x36')]);_0x1a2caf[_0xd13e('0x38')]=_['intersection'](_0x1a2caf['model'],_0x1a2caf[_0xd13e('0x36')]);_0x5183e7[_0xd13e('0x3a')]=_[_0xd13e('0x39')](_0x1a2caf['model'],qs['fields'](_0x3d744c[_0xd13e('0x36')][_0xd13e('0x3b')]));_0x5183e7[_0xd13e('0x3a')]=_0x5183e7['attributes'][_0xd13e('0x3c')]?_0x5183e7[_0xd13e('0x3a')]:_0x1a2caf[_0xd13e('0x34')];_0x5183e7['order']=qs[_0xd13e('0x3f')](_0x3d744c[_0xd13e('0x36')][_0xd13e('0x3f')]);_0x5183e7[_0xd13e('0x43')]=qs[_0xd13e('0x38')](_['pick'](_0x3d744c[_0xd13e('0x36')],_0x1a2caf['filters']));if(_0x3d744c['query'][_0xd13e('0x41')]){_0x5183e7[_0xd13e('0x43')]=_[_0xd13e('0x42')](_0x5183e7[_0xd13e('0x43')],{'$or':_[_0xd13e('0x35')](_0x5183e7[_0xd13e('0x3a')],function(_0x4ab22a){var _0x95d5ca={};_0x95d5ca[_0x4ab22a]={'$like':'%'+_0x3d744c['query'][_0xd13e('0x41')]+'%'};return _0x95d5ca;})});}_0x5183e7=_[_0xd13e('0x42')]({},_0x5183e7,_0x3d744c[_0xd13e('0x45')]);return _0x1577de['getItems'](_0x5183e7);}})[_0xd13e('0x27')](function(_0x3208fb){if(_0x3208fb){_0x272110=_0x3208fb[_0xd13e('0x3c')];if(!_0x3d744c[_0xd13e('0x36')][_0xd13e('0x7c')](_0xd13e('0x3d'))){_0x5183e7[_0xd13e('0x1e')]=qs[_0xd13e('0x1e')](_0x3d744c['query'][_0xd13e('0x1e')]);_0x5183e7['offset']=qs[_0xd13e('0x20')](_0x3d744c['query'][_0xd13e('0x20')]);}return _0x1577de[_0xd13e('0x7d')](_0x5183e7);}})[_0xd13e('0x27')](function(_0x37b4e0){if(_0x37b4e0){return _0x37b4e0?{'count':_0x272110,'rows':_0x37b4e0}:null;}})['then'](respondWithResult(_0x59ac93,null))[_0xd13e('0x55')](handleError(_0x59ac93,null));}; \ No newline at end of file +var _0x6f03=['merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','stack','index','Dashboard','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x37d317,_0x46dcc1){var _0x2c757f=function(_0xcbee92){while(--_0xcbee92){_0x37d317['push'](_0x37d317['shift']());}};_0x2c757f(++_0x46dcc1);}(_0x6f03,0x1b5));var _0x36f0=function(_0xb4747e,_0x51c8a6){_0xb4747e=_0xb4747e-0x0;var _0x29f4a0=_0x6f03[_0xb4747e];return _0x29f4a0;};'use strict';var emlformat=require(_0x36f0('0x0'));var rimraf=require(_0x36f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x36f0('0x2'));var moment=require('moment');var BPromise=require(_0x36f0('0x3'));var Mustache=require(_0x36f0('0x4'));var util=require(_0x36f0('0x5'));var path=require(_0x36f0('0x6'));var sox=require('sox');var csv=require(_0x36f0('0x7'));var ejs=require(_0x36f0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36f0('0x9'));var squel=require('squel');var crypto=require(_0x36f0('0xa'));var jsforce=require(_0x36f0('0xb'));var deskjs=require(_0x36f0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x36f0('0xd'));var Papa=require(_0x36f0('0xe'));var Redis=require(_0x36f0('0xf'));var authService=require(_0x36f0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36f0('0x11'));var logger=require(_0x36f0('0x12'))(_0x36f0('0x13'));var utils=require(_0x36f0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x36f0('0x15'));var db=require(_0x36f0('0x16'))['db'];config[_0x36f0('0x17')]=_['defaults'](config[_0x36f0('0x17')],{'host':_0x36f0('0x18'),'port':0x18eb});var socket=require(_0x36f0('0x19'))(new Redis(config['redis']));require(_0x36f0('0x1a'))[_0x36f0('0x1b')](socket);function respondWithStatusCode(_0xe6b4b0,_0x389a32){_0x389a32=_0x389a32||0xcc;return function(_0x2b427e){if(_0x2b427e){return _0xe6b4b0['sendStatus'](_0x389a32);}return _0xe6b4b0[_0x36f0('0x1c')](_0x389a32)[_0x36f0('0x1d')]();};}function respondWithResult(_0x34fc2d,_0x5473a3){_0x5473a3=_0x5473a3||0xc8;return function(_0x2a0f90){if(_0x2a0f90){return _0x34fc2d[_0x36f0('0x1c')](_0x5473a3)['json'](_0x2a0f90);}};}function respondWithFilteredResult(_0x22158c,_0x30cc92){return function(_0xaf222b){if(_0xaf222b){var _0x182ec0=typeof _0x30cc92[_0x36f0('0x1e')]===_0x36f0('0x1f')&&typeof _0x30cc92[_0x36f0('0x20')]===_0x36f0('0x1f');var _0x3aed13=_0xaf222b['count'];var _0x4aafaf=_0x182ec0?0x0:_0x30cc92['offset'];var _0x5aeab0=_0x182ec0?_0xaf222b[_0x36f0('0x21')]:_0x30cc92[_0x36f0('0x1e')]+_0x30cc92['limit'];var _0x995252;if(_0x5aeab0>=_0x3aed13){_0x5aeab0=_0x3aed13;_0x995252=0xc8;}else{_0x995252=0xce;}_0x22158c[_0x36f0('0x1c')](_0x995252);return _0x22158c[_0x36f0('0x22')]('Content-Range',_0x4aafaf+'-'+_0x5aeab0+'/'+_0x3aed13)['json'](_0xaf222b);}return null;};}function patchUpdates(_0x5a6e8f){return function(_0x41b37f){try{jsonpatch[_0x36f0('0x23')](_0x41b37f,_0x5a6e8f,!![]);}catch(_0x3d44f6){return BPromise[_0x36f0('0x24')](_0x3d44f6);}return _0x41b37f[_0x36f0('0x25')]();};}function saveUpdates(_0x2b36fb,_0x4704ec){return function(_0x4eb64a){if(_0x4eb64a){return _0x4eb64a[_0x36f0('0x26')](_0x2b36fb)[_0x36f0('0x27')](function(_0x304c08){return _0x304c08;});}return null;};}function removeEntity(_0x43397e,_0x5b6050){return function(_0x57778a){if(_0x57778a){return _0x57778a[_0x36f0('0x28')]()[_0x36f0('0x27')](function(){var _0x3b6c5a=_0x57778a[_0x36f0('0x29')]({'plain':!![]});var _0x2906ac=_0x36f0('0x2a');return db[_0x36f0('0x2b')][_0x36f0('0x28')]({'where':{'type':_0x2906ac,'resourceId':_0x3b6c5a['id']}})[_0x36f0('0x27')](function(){return _0x57778a;});})[_0x36f0('0x27')](function(){_0x43397e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xad8305,_0x5727e9){return function(_0x5ce145){if(!_0x5ce145){_0xad8305[_0x36f0('0x2c')](0x194);}return _0x5ce145;};}function handleError(_0x1db117,_0x5cebf1){_0x5cebf1=_0x5cebf1||0x1f4;return function(_0x9a8002){logger['error'](_0x9a8002[_0x36f0('0x2d')]);if(_0x9a8002['name']){delete _0x9a8002['name'];}_0x1db117[_0x36f0('0x1c')](_0x5cebf1)['send'](_0x9a8002);};}exports[_0x36f0('0x2e')]=function(_0x2c2e80,_0x9c36ed){var _0x2f01af={},_0x5a5c22={},_0x45cc6a={'count':0x0,'rows':[]};var _0x25530d=_['map'](db[_0x36f0('0x2f')]['rawAttributes'],function(_0x41a0ca){return{'name':_0x41a0ca[_0x36f0('0x30')],'type':_0x41a0ca[_0x36f0('0x31')][_0x36f0('0x32')]};});_0x5a5c22[_0x36f0('0x33')]=_[_0x36f0('0x34')](_0x25530d,_0x36f0('0x35'));_0x5a5c22[_0x36f0('0x36')]=_[_0x36f0('0x37')](_0x2c2e80[_0x36f0('0x36')]);_0x5a5c22[_0x36f0('0x38')]=_[_0x36f0('0x39')](_0x5a5c22[_0x36f0('0x33')],_0x5a5c22[_0x36f0('0x36')]);_0x2f01af['attributes']=_[_0x36f0('0x39')](_0x5a5c22[_0x36f0('0x33')],qs['fields'](_0x2c2e80[_0x36f0('0x36')][_0x36f0('0x3a')]));_0x2f01af[_0x36f0('0x3b')]=_0x2f01af[_0x36f0('0x3b')]['length']?_0x2f01af[_0x36f0('0x3b')]:_0x5a5c22[_0x36f0('0x33')];if(!_0x2c2e80[_0x36f0('0x36')][_0x36f0('0x3c')](_0x36f0('0x3d'))){_0x2f01af[_0x36f0('0x20')]=qs['limit'](_0x2c2e80['query'][_0x36f0('0x20')]);_0x2f01af['offset']=qs['offset'](_0x2c2e80[_0x36f0('0x36')][_0x36f0('0x1e')]);}_0x2f01af[_0x36f0('0x3e')]=qs[_0x36f0('0x3f')](_0x2c2e80['query'][_0x36f0('0x3f')]);_0x2f01af[_0x36f0('0x40')]=qs[_0x36f0('0x38')](_[_0x36f0('0x41')](_0x2c2e80[_0x36f0('0x36')],_0x5a5c22[_0x36f0('0x38')]),_0x25530d);if(_0x2c2e80['query'][_0x36f0('0x42')]){_0x2f01af[_0x36f0('0x40')]=_[_0x36f0('0x43')](_0x2f01af[_0x36f0('0x40')],{'$or':_[_0x36f0('0x34')](_0x25530d,function(_0x57f35f){if(_0x57f35f[_0x36f0('0x31')]!==_0x36f0('0x44')){var _0x13fb2d={};_0x13fb2d[_0x57f35f[_0x36f0('0x35')]]={'$like':'%'+_0x2c2e80[_0x36f0('0x36')]['filter']+'%'};return _0x13fb2d;}})});}_0x2f01af=_[_0x36f0('0x43')]({},_0x2f01af,_0x2c2e80[_0x36f0('0x45')]);var _0x2d9a3a={'where':_0x2f01af[_0x36f0('0x40')]};return db['Dashboard']['count'](_0x2d9a3a)[_0x36f0('0x27')](function(_0x4be1b8){_0x45cc6a[_0x36f0('0x21')]=_0x4be1b8;if(_0x2c2e80[_0x36f0('0x36')][_0x36f0('0x46')]){_0x2f01af['include']=[{'all':!![]}];}return db[_0x36f0('0x2f')][_0x36f0('0x47')](_0x2f01af);})[_0x36f0('0x27')](function(_0x581566){_0x45cc6a['rows']=_0x581566;return _0x45cc6a;})['then'](respondWithFilteredResult(_0x9c36ed,_0x2f01af))['catch'](handleError(_0x9c36ed,null));};exports[_0x36f0('0x48')]=function(_0x3268b8,_0x10564a){var _0x2f6b64={'raw':![],'where':{'id':_0x3268b8[_0x36f0('0x49')]['id']}},_0x4d509e={};_0x4d509e['model']=_[_0x36f0('0x37')](db[_0x36f0('0x2f')][_0x36f0('0x4a')]);_0x4d509e['query']=_[_0x36f0('0x37')](_0x3268b8[_0x36f0('0x36')]);_0x4d509e[_0x36f0('0x38')]=_[_0x36f0('0x39')](_0x4d509e[_0x36f0('0x33')],_0x4d509e['query']);_0x2f6b64[_0x36f0('0x3b')]=_['intersection'](_0x4d509e[_0x36f0('0x33')],qs[_0x36f0('0x3a')](_0x3268b8[_0x36f0('0x36')][_0x36f0('0x3a')]));_0x2f6b64['attributes']=_0x2f6b64[_0x36f0('0x3b')][_0x36f0('0x4b')]?_0x2f6b64[_0x36f0('0x3b')]:_0x4d509e[_0x36f0('0x33')];if(_0x3268b8['query'][_0x36f0('0x46')]){_0x2f6b64[_0x36f0('0x4c')]=[{'all':!![]}];}_0x2f6b64=_['merge']({},_0x2f6b64,_0x3268b8['options']);return db[_0x36f0('0x2f')][_0x36f0('0x4d')](_0x2f6b64)[_0x36f0('0x27')](handleEntityNotFound(_0x10564a,null))[_0x36f0('0x27')](respondWithResult(_0x10564a,null))[_0x36f0('0x4e')](handleError(_0x10564a,null));};exports[_0x36f0('0x4f')]=function(_0x5c10bb,_0x206acf){return db[_0x36f0('0x2f')]['create'](_0x5c10bb[_0x36f0('0x50')],{})['then'](function(_0x132277){var _0x448d73=_0x5c10bb[_0x36f0('0x51')][_0x36f0('0x29')]({'plain':!![]});if(!_0x448d73)throw new Error(_0x36f0('0x52'));if(_0x448d73[_0x36f0('0x53')]===_0x36f0('0x51')){var _0x105a96=_0x132277[_0x36f0('0x29')]({'plain':!![]});var _0x16c483=_0x36f0('0x2a');return db[_0x36f0('0x54')]['find']({'where':{'name':_0x16c483,'userProfileId':_0x448d73[_0x36f0('0x55')]},'raw':!![]})[_0x36f0('0x27')](function(_0x2e8645){if(_0x2e8645&&_0x2e8645[_0x36f0('0x56')]===0x0){return db['UserProfileResource'][_0x36f0('0x4f')]({'name':_0x105a96['name'],'resourceId':_0x105a96['id'],'type':_0x2e8645[_0x36f0('0x35')],'sectionId':_0x2e8645['id']},{})[_0x36f0('0x27')](function(){return _0x132277;});}else{return _0x132277;}})['catch'](function(_0x26340c){logger[_0x36f0('0x57')](_0x36f0('0x58'),_0x26340c);throw _0x26340c;});}return _0x132277;})[_0x36f0('0x27')](respondWithResult(_0x206acf,0xc9))[_0x36f0('0x4e')](handleError(_0x206acf,null));};exports['clone']=function(_0x45c9bd,_0x533515){var _0x1f2721={'where':{'id':_0x45c9bd[_0x36f0('0x49')]['id']}},_0x448d5c={};_0x448d5c[_0x36f0('0x33')]=_[_0x36f0('0x37')](db[_0x36f0('0x2f')][_0x36f0('0x4a')]);_0x1f2721['attributes']=_[_0x36f0('0x39')](_0x448d5c[_0x36f0('0x33')],qs[_0x36f0('0x3a')](_0x45c9bd[_0x36f0('0x36')]['fields']));_0x1f2721[_0x36f0('0x3b')]=_0x1f2721[_0x36f0('0x3b')][_0x36f0('0x4b')]?_0x1f2721[_0x36f0('0x3b')]:_0x448d5c[_0x36f0('0x33')];if(_0x45c9bd[_0x36f0('0x36')][_0x36f0('0x46')]){_0x1f2721[_0x36f0('0x4c')]=[{'all':!![]}];}_0x1f2721=_[_0x36f0('0x43')]({},_0x1f2721,_0x45c9bd['options']);return db[_0x36f0('0x2f')][_0x36f0('0x4d')](_0x1f2721)['then'](handleEntityNotFound(_0x533515,null))['then'](function(_0x37c70b){if(_0x37c70b){var _0x104104=_0x37c70b[_0x36f0('0x29')]({'plain':!![]});_0x104104=qs['omit'](_0x104104,['id',_0x36f0('0x59'),'updatedAt']);_0x45c9bd['body']=_['omit'](_0x45c9bd[_0x36f0('0x50')],['id',_0x36f0('0x59'),_0x36f0('0x5a')]);return db[_0x36f0('0x2f')][_0x36f0('0x4f')](_[_0x36f0('0x43')](_0x104104,_0x45c9bd[_0x36f0('0x50')]),{'include':_0x45c9bd[_0x36f0('0x36')][_0x36f0('0x46')]?[{'all':!![]}]:undefined})[_0x36f0('0x27')](function(_0x578c75){var _0x153a06=_0x45c9bd[_0x36f0('0x51')][_0x36f0('0x29')]({'plain':!![]});if(!_0x153a06)throw new Error(_0x36f0('0x52'));if(_0x153a06[_0x36f0('0x53')]==='user'){var _0xa99d42=_0x578c75['get']({'plain':!![]});var _0x4de368=_0x36f0('0x2a');return db[_0x36f0('0x54')][_0x36f0('0x4d')]({'where':{'name':_0x4de368,'userProfileId':_0x153a06[_0x36f0('0x55')]},'raw':!![]})[_0x36f0('0x27')](function(_0x317c72){if(_0x317c72&&_0x317c72['autoAssociation']===0x0){return db[_0x36f0('0x2b')][_0x36f0('0x4f')]({'name':_0xa99d42['name'],'resourceId':_0xa99d42['id'],'type':_0x317c72[_0x36f0('0x35')],'sectionId':_0x317c72['id']},{})[_0x36f0('0x27')](function(){return _0x578c75;});}else{return _0x578c75;}})['catch'](function(_0x116c7e){logger[_0x36f0('0x57')](_0x36f0('0x58'),_0x116c7e);throw _0x116c7e;});}return _0x578c75;});}})[_0x36f0('0x27')](respondWithResult(_0x533515,0xc9))[_0x36f0('0x4e')](handleError(_0x533515,null));};exports[_0x36f0('0x26')]=function(_0x53908f,_0x2f3676){if(_0x53908f[_0x36f0('0x50')]['id']){delete _0x53908f[_0x36f0('0x50')]['id'];}return db[_0x36f0('0x2f')]['find']({'where':{'id':_0x53908f[_0x36f0('0x49')]['id']}})[_0x36f0('0x27')](handleEntityNotFound(_0x2f3676,null))[_0x36f0('0x27')](saveUpdates(_0x53908f[_0x36f0('0x50')],null))[_0x36f0('0x27')](respondWithResult(_0x2f3676,null))[_0x36f0('0x4e')](handleError(_0x2f3676,null));};exports[_0x36f0('0x28')]=function(_0x294ff0,_0x3c293f){return db[_0x36f0('0x2f')]['find']({'where':{'id':_0x294ff0[_0x36f0('0x49')]['id']}})[_0x36f0('0x27')](handleEntityNotFound(_0x3c293f,null))['then'](removeEntity(_0x3c293f,null))[_0x36f0('0x4e')](handleError(_0x3c293f,null));};function widgetAttributes(_0x5aec7e){try{switch(_0x5aec7e[_0x36f0('0x31')]){case _0x36f0('0x5b'):return[{'name':'attrUrl','value':_0x5aec7e['attrUrl']||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x0]?_0x5aec7e[_0x36f0('0x5c')][0x0][_0x36f0('0x5d')]:undefined)||_0x36f0('0x5e')}];case _0x36f0('0x5f'):return[{'name':'attrPath','value':_0x5aec7e[_0x36f0('0x60')]||(_0x5aec7e['attrs']&&_0x5aec7e[_0x36f0('0x5c')][0x0]?_0x5aec7e[_0x36f0('0x5c')][0x0][_0x36f0('0x5d')]:undefined)||''}];case _0x36f0('0x61'):return[{'name':_0x36f0('0x62'),'value':_0x5aec7e[_0x36f0('0x62')]||(_0x5aec7e['attrs']&&_0x5aec7e['attrs'][0x0]?_0x5aec7e[_0x36f0('0x5c')][0x0][_0x36f0('0x5d')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x5aec7e[_0x36f0('0x63')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x1]?_0x5aec7e[_0x36f0('0x5c')][0x1][_0x36f0('0x5d')]:undefined)||_0x36f0('0x64')},{'name':_0x36f0('0x65'),'value':_0x5aec7e[_0x36f0('0x65')]||(_0x5aec7e['attrs']&&_0x5aec7e[_0x36f0('0x5c')][0x2]?_0x5aec7e[_0x36f0('0x5c')][0x2][_0x36f0('0x5d')]:undefined)||0xc}];case'counter':return[{'name':_0x36f0('0x66'),'value':_0x5aec7e['attrMetric']||(_0x5aec7e['attrs']&&_0x5aec7e['attrs'][0x0]?_0x5aec7e[_0x36f0('0x5c')][0x0]['value']:undefined)||_0x36f0('0x67')},{'name':_0x36f0('0x68'),'value':_0x5aec7e[_0x36f0('0x68')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x1]?_0x5aec7e['attrs'][0x1][_0x36f0('0x5d')]:undefined)||[]},{'name':_0x36f0('0x65'),'value':_0x5aec7e[_0x36f0('0x65')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x2]?_0x5aec7e[_0x36f0('0x5c')][0x2][_0x36f0('0x5d')]:undefined)||0x14},{'name':_0x36f0('0x69'),'value':_0x5aec7e['attrChannel']||(_0x5aec7e['attrs']&&_0x5aec7e[_0x36f0('0x5c')][0x3]?_0x5aec7e['attrs'][0x3]['value']:undefined)||_0x36f0('0x6a')},{'name':'attrEmailAccounts','value':_0x5aec7e[_0x36f0('0x6b')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e['attrs'][0x4]?_0x5aec7e[_0x36f0('0x5c')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x5aec7e[_0x36f0('0x6c')]||(_0x5aec7e['attrs']&&_0x5aec7e[_0x36f0('0x5c')][0x5]?_0x5aec7e[_0x36f0('0x5c')][0x5][_0x36f0('0x5d')]:undefined)||''},{'name':_0x36f0('0x6d'),'value':_0x5aec7e[_0x36f0('0x6d')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x6]?_0x5aec7e[_0x36f0('0x5c')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5aec7e[_0x36f0('0x6e')]||(_0x5aec7e['attrs']&&_0x5aec7e['attrs'][0x7]?_0x5aec7e[_0x36f0('0x5c')][0x7][_0x36f0('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5aec7e[_0x36f0('0x6f')]||(_0x5aec7e['attrs']&&_0x5aec7e[_0x36f0('0x5c')][0x8]?_0x5aec7e['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x5aec7e['attrChatWebsites']||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x9]?_0x5aec7e[_0x36f0('0x5c')][0x9]['value']:undefined)||''}];case _0x36f0('0x70'):case'pie-chart':return[{'name':_0x36f0('0x71'),'value':_0x5aec7e[_0x36f0('0x71')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e['attrs'][0x0]?_0x5aec7e[_0x36f0('0x5c')][0x0][_0x36f0('0x5d')]:undefined)||_0x36f0('0x67')},{'name':_0x36f0('0x72'),'value':_0x5aec7e[_0x36f0('0x72')]||(_0x5aec7e['attrs']&&_0x5aec7e['attrs'][0x1]?_0x5aec7e[_0x36f0('0x5c')][0x1][_0x36f0('0x5d')]:undefined)||null},{'name':_0x36f0('0x73'),'value':_0x5aec7e[_0x36f0('0x73')]||(_0x5aec7e['attrs']&&_0x5aec7e[_0x36f0('0x5c')][0x2]?_0x5aec7e['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5aec7e['attrVoiceQueues']||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x3]?_0x5aec7e[_0x36f0('0x5c')][0x3][_0x36f0('0x5d')]:undefined)||[]},{'name':'attrChannel','value':_0x5aec7e[_0x36f0('0x69')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x4]?_0x5aec7e[_0x36f0('0x5c')][0x4][_0x36f0('0x5d')]:undefined)||_0x36f0('0x6a')},{'name':_0x36f0('0x6b'),'value':_0x5aec7e['attrEmailAccounts']||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e['attrs'][0x5]?_0x5aec7e['attrs'][0x5][_0x36f0('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5aec7e[_0x36f0('0x6c')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x6]?_0x5aec7e[_0x36f0('0x5c')][0x6][_0x36f0('0x5d')]:undefined)||''},{'name':_0x36f0('0x6d'),'value':_0x5aec7e[_0x36f0('0x6d')]||(_0x5aec7e['attrs']&&_0x5aec7e[_0x36f0('0x5c')][0x7]?_0x5aec7e[_0x36f0('0x5c')][0x7][_0x36f0('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5aec7e['attrOpenchannelAccounts']||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e['attrs'][0x8]?_0x5aec7e['attrs'][0x8]['value']:undefined)||''},{'name':_0x36f0('0x6f'),'value':_0x5aec7e[_0x36f0('0x6f')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e['attrs'][0x9]?_0x5aec7e[_0x36f0('0x5c')][0x9][_0x36f0('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5aec7e[_0x36f0('0x74')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0xa]?_0x5aec7e[_0x36f0('0x5c')][0xa][_0x36f0('0x5d')]:undefined)||''}];case _0x36f0('0x75'):return[{'name':_0x36f0('0x76'),'type':_0x5aec7e['reportType']||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x0]?_0x5aec7e[_0x36f0('0x5c')][0x0][_0x36f0('0x31')]:undefined)||null,'value':_0x5aec7e[_0x36f0('0x76')]||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x0]?_0x5aec7e[_0x36f0('0x5c')][0x0]['value']:undefined)||null},{'name':_0x36f0('0x77'),'value':_0x5aec7e['attrRefresh']||(_0x5aec7e[_0x36f0('0x5c')]&&_0x5aec7e[_0x36f0('0x5c')][0x1]?_0x5aec7e[_0x36f0('0x5c')][0x1][_0x36f0('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x143c69){logger['error'](_0x36f0('0x78'),JSON[_0x36f0('0x79')](_0x143c69));return[];}}exports[_0x36f0('0x7a')]=function(_0x4f2437,_0x241221,_0xef6601){if(_0x4f2437[_0x36f0('0x50')]['id']){delete _0x4f2437[_0x36f0('0x50')]['id'];}return db[_0x36f0('0x2f')]['find']({'where':{'id':_0x4f2437['params']['id']}})['then'](handleEntityNotFound(_0x241221,null))['then'](function(_0xf0a5e9){if(_0xf0a5e9){_0x4f2437['body'][_0x36f0('0x7b')]=_0xf0a5e9['id'];_0x4f2437[_0x36f0('0x50')][_0x36f0('0x5c')]=widgetAttributes(_0x4f2437[_0x36f0('0x50')]);return db[_0x36f0('0x7c')][_0x36f0('0x4f')](_0x4f2437[_0x36f0('0x50')]);}})[_0x36f0('0x27')](respondWithResult(_0x241221,null))[_0x36f0('0x4e')](handleError(_0x241221,null));};exports[_0x36f0('0x7d')]=function(_0x435866,_0x2d6225,_0x1e2ee3){var _0x2d8ed8={};var _0xd611b1={};var _0x15b88e;var _0x3c89e2;return db[_0x36f0('0x2f')]['findOne']({'where':{'id':_0x435866[_0x36f0('0x49')]['id']}})[_0x36f0('0x27')](handleEntityNotFound(_0x2d6225,null))[_0x36f0('0x27')](function(_0x35a2df){if(_0x35a2df){_0x15b88e=_0x35a2df;_0xd611b1['model']=_[_0x36f0('0x37')](db[_0x36f0('0x7c')][_0x36f0('0x4a')]);_0xd611b1['query']=_[_0x36f0('0x37')](_0x435866[_0x36f0('0x36')]);_0xd611b1['filters']=_[_0x36f0('0x39')](_0xd611b1[_0x36f0('0x33')],_0xd611b1[_0x36f0('0x36')]);_0x2d8ed8[_0x36f0('0x3b')]=_[_0x36f0('0x39')](_0xd611b1[_0x36f0('0x33')],qs[_0x36f0('0x3a')](_0x435866['query'][_0x36f0('0x3a')]));_0x2d8ed8[_0x36f0('0x3b')]=_0x2d8ed8['attributes'][_0x36f0('0x4b')]?_0x2d8ed8[_0x36f0('0x3b')]:_0xd611b1[_0x36f0('0x33')];_0x2d8ed8['order']=qs[_0x36f0('0x3f')](_0x435866[_0x36f0('0x36')][_0x36f0('0x3f')]);_0x2d8ed8[_0x36f0('0x40')]=qs[_0x36f0('0x38')](_[_0x36f0('0x41')](_0x435866[_0x36f0('0x36')],_0xd611b1[_0x36f0('0x38')]));if(_0x435866[_0x36f0('0x36')][_0x36f0('0x42')]){_0x2d8ed8['where']=_[_0x36f0('0x43')](_0x2d8ed8[_0x36f0('0x40')],{'$or':_[_0x36f0('0x34')](_0x2d8ed8[_0x36f0('0x3b')],function(_0x1bee1d){var _0x18d779={};_0x18d779[_0x1bee1d]={'$like':'%'+_0x435866[_0x36f0('0x36')][_0x36f0('0x42')]+'%'};return _0x18d779;})});}_0x2d8ed8=_['merge']({},_0x2d8ed8,_0x435866[_0x36f0('0x45')]);return _0x15b88e[_0x36f0('0x7d')](_0x2d8ed8);}})[_0x36f0('0x27')](function(_0x2a7ddd){if(_0x2a7ddd){_0x3c89e2=_0x2a7ddd['length'];if(!_0x435866[_0x36f0('0x36')][_0x36f0('0x3c')]('nolimit')){_0x2d8ed8[_0x36f0('0x20')]=qs[_0x36f0('0x20')](_0x435866[_0x36f0('0x36')][_0x36f0('0x20')]);_0x2d8ed8[_0x36f0('0x1e')]=qs[_0x36f0('0x1e')](_0x435866['query'][_0x36f0('0x1e')]);}return _0x15b88e[_0x36f0('0x7d')](_0x2d8ed8);}})[_0x36f0('0x27')](function(_0xffeab6){if(_0xffeab6){return _0xffeab6?{'count':_0x3c89e2,'rows':_0xffeab6}:null;}})['then'](respondWithResult(_0x2d6225,null))[_0x36f0('0x4e')](handleError(_0x2d6225,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index bfc9c08..c971dc9 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 _0xd1d8=['emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xd1d8,0x1e3));var _0x8d1d=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0xd1d8[_0x454bd3];return _0x4eb066;};'use strict';var EventEmitter=require(_0x8d1d('0x0'));var Dashboard=require(_0x8d1d('0x1'))['db'][_0x8d1d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8d1d('0x3')](0x0);var events={'afterCreate':_0x8d1d('0x4'),'afterUpdate':_0x8d1d('0x5'),'afterDestroy':_0x8d1d('0x6')};function emitEvent(_0x3b974f){return function(_0x35b6d8,_0x498f5c,_0x23bfb6){DashboardEvents[_0x8d1d('0x7')](_0x3b974f+':'+_0x35b6d8['id'],_0x35b6d8);DashboardEvents[_0x8d1d('0x7')](_0x3b974f,_0x35b6d8);_0x23bfb6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x8d1d('0x8')](e,emitEvent(event));}}module[_0x8d1d('0x9')]=DashboardEvents; \ No newline at end of file +var _0xcf50=['update','emit','hasOwnProperty','hook','exports','Dashboard','setMaxListeners','save'];(function(_0x175ea7,_0x37a68e){var _0x4b1437=function(_0x574aeb){while(--_0x574aeb){_0x175ea7['push'](_0x175ea7['shift']());}};_0x4b1437(++_0x37a68e);}(_0xcf50,0xe5));var _0x0cf5=function(_0x45e7ce,_0x41e049){_0x45e7ce=_0x45e7ce-0x0;var _0x3d3dc8=_0xcf50[_0x45e7ce];return _0x3d3dc8;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x0cf5('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0cf5('0x1')](0x0);var events={'afterCreate':_0x0cf5('0x2'),'afterUpdate':_0x0cf5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1ca590){return function(_0x39ffb2,_0x11eb4a,_0x2f82a0){DashboardEvents[_0x0cf5('0x4')](_0x1ca590+':'+_0x39ffb2['id'],_0x39ffb2);DashboardEvents[_0x0cf5('0x4')](_0x1ca590,_0x39ffb2);_0x2f82a0(null);};}for(var e in events){if(events[_0x0cf5('0x5')](e)){var event=events[e];Dashboard[_0x0cf5('0x6')](e,emitEvent(event));}}module[_0x0cf5('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 12396a0..2308862 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 _0xfdbc=['dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0xfdbc,0x153));var _0xcfdb=function(_0x680c44,_0x554c90){_0x680c44=_0x680c44-0x0;var _0x214396=_0xfdbc[_0x680c44];return _0x214396;};'use strict';var _=require(_0xcfdb('0x0'));var util=require(_0xcfdb('0x1'));var logger=require(_0xcfdb('0x2'))(_0xcfdb('0x3'));var moment=require('moment');var BPromise=require(_0xcfdb('0x4'));var rp=require(_0xcfdb('0x5'));var fs=require('fs');var path=require(_0xcfdb('0x6'));var rimraf=require(_0xcfdb('0x7'));var config=require(_0xcfdb('0x8'));var attributes=require(_0xcfdb('0x9'));module['exports']=function(_0x39e904,_0x22b381){return _0x39e904[_0xcfdb('0xa')](_0xcfdb('0xb'),attributes,{'tableName':_0xcfdb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf998=['define','Dashboard','dashboards','util','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf998,0x7b));var _0x8f99=function(_0x1d1918,_0x9b060b){_0x1d1918=_0x1d1918-0x0;var _0x40242b=_0xf998[_0x1d1918];return _0x40242b;};'use strict';var _=require('lodash');var util=require(_0x8f99('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8f99('0x1'));var BPromise=require(_0x8f99('0x2'));var rp=require(_0x8f99('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f99('0x4'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x3213f3,_0x5df400){return _0x3213f3[_0x8f99('0x5')](_0x8f99('0x6'),attributes,{'tableName':_0x8f99('0x7'),'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 40fc08e..da23f4b 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 _0xa91a=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0xa91a,0x111));var _0xaa91=function(_0x5146eb,_0x332eee){_0x5146eb=_0x5146eb-0x0;var _0xcac9e0=_0xa91a[_0x5146eb];return _0xcac9e0;};'use strict';var _=require('lodash');var util=require(_0xaa91('0x0'));var moment=require(_0xaa91('0x1'));var BPromise=require(_0xaa91('0x2'));var rs=require(_0xaa91('0x3'));var fs=require('fs');var Redis=require(_0xaa91('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa91('0x5'));var logger=require(_0xaa91('0x6'))(_0xaa91('0x7'));var config=require(_0xaa91('0x8'));var jayson=require(_0xaa91('0x9'));var client=jayson[_0xaa91('0xa')][_0xaa91('0xb')]({'port':0x232a});config['redis']=_[_0xaa91('0xc')](config['redis'],{'host':_0xaa91('0xd'),'port':0x18eb});var socket=require(_0xaa91('0xe'))(new Redis(config[_0xaa91('0xf')]));require(_0xaa91('0x10'))[_0xaa91('0x11')](socket);function respondWithRpcPromise(_0x3acfea,_0x5386d0,_0x406afc){return new BPromise(function(_0x5c5701,_0xec62cf){return client[_0xaa91('0x12')](_0x3acfea,_0x406afc)[_0xaa91('0x13')](function(_0x582349){logger[_0xaa91('0x14')](_0xaa91('0x15'),_0x5386d0,'request\x20sent');logger[_0xaa91('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5386d0,_0xaa91('0x17'),JSON[_0xaa91('0x18')](_0x582349));if(_0x582349[_0xaa91('0x19')]){if(_0x582349[_0xaa91('0x19')][_0xaa91('0x1a')]===0x1f4){logger[_0xaa91('0x19')](_0xaa91('0x15'),_0x5386d0,_0x582349[_0xaa91('0x19')]['message']);return _0xec62cf(_0x582349[_0xaa91('0x19')]['message']);}logger[_0xaa91('0x19')](_0xaa91('0x15'),_0x5386d0,_0x582349[_0xaa91('0x19')][_0xaa91('0x1b')]);return _0x5c5701(_0x582349[_0xaa91('0x19')][_0xaa91('0x1b')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x5386d0,_0xaa91('0x17'));_0x5c5701(_0x582349[_0xaa91('0x1c')][_0xaa91('0x1b')]);}})[_0xaa91('0x1d')](function(_0x2a2b6d){logger[_0xaa91('0x19')](_0xaa91('0x15'),_0x5386d0,_0x2a2b6d);_0xec62cf(_0x2a2b6d);});});} \ No newline at end of file +var _0xab61=['../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xab61,0x1c9));var _0x1ab6=function(_0x293ca8,_0x3ca5de){_0x293ca8=_0x293ca8-0x0;var _0x4508aa=_0xab61[_0x293ca8];return _0x4508aa;};'use strict';var _=require(_0x1ab6('0x0'));var util=require(_0x1ab6('0x1'));var moment=require(_0x1ab6('0x2'));var BPromise=require(_0x1ab6('0x3'));var rs=require(_0x1ab6('0x4'));var fs=require('fs');var Redis=require(_0x1ab6('0x5'));var db=require(_0x1ab6('0x6'))['db'];var utils=require(_0x1ab6('0x7'));var logger=require('../../config/logger')(_0x1ab6('0x8'));var config=require(_0x1ab6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ab6('0xa')][_0x1ab6('0xb')]({'port':0x232a});config['redis']=_[_0x1ab6('0xc')](config[_0x1ab6('0xd')],{'host':_0x1ab6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ab6('0xd')]));require(_0x1ab6('0xf'))[_0x1ab6('0x10')](socket);function respondWithRpcPromise(_0x3477da,_0x5a6cc6,_0x2b5373){return new BPromise(function(_0x24a792,_0x111509){return client[_0x1ab6('0x11')](_0x3477da,_0x2b5373)[_0x1ab6('0x12')](function(_0x4ed29b){logger[_0x1ab6('0x13')](_0x1ab6('0x14'),_0x5a6cc6,_0x1ab6('0x15'));logger[_0x1ab6('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5a6cc6,_0x1ab6('0x15'),JSON[_0x1ab6('0x17')](_0x4ed29b));if(_0x4ed29b['error']){if(_0x4ed29b[_0x1ab6('0x18')][_0x1ab6('0x19')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x5a6cc6,_0x4ed29b[_0x1ab6('0x18')][_0x1ab6('0x1a')]);return _0x111509(_0x4ed29b[_0x1ab6('0x18')]['message']);}logger[_0x1ab6('0x18')](_0x1ab6('0x14'),_0x5a6cc6,_0x4ed29b[_0x1ab6('0x18')][_0x1ab6('0x1a')]);return _0x24a792(_0x4ed29b[_0x1ab6('0x18')][_0x1ab6('0x1a')]);}else{logger['info'](_0x1ab6('0x14'),_0x5a6cc6,'request\x20sent');_0x24a792(_0x4ed29b[_0x1ab6('0x1b')][_0x1ab6('0x1a')]);}})[_0x1ab6('0x1c')](function(_0x46813b){logger[_0x1ab6('0x18')](_0x1ab6('0x14'),_0x5a6cc6,_0x46813b);_0x111509(_0x46813b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 911b130..5cc64f4 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 _0xfcbc=['dashboard:','save','update','emit','register','length'];(function(_0x52fc79,_0x16f421){var _0x11db56=function(_0x33c7a3){while(--_0x33c7a3){_0x52fc79['push'](_0x52fc79['shift']());}};_0x11db56(++_0x16f421);}(_0xfcbc,0xeb));var _0xcfcb=function(_0x15f724,_0x2794ef){_0x15f724=_0x15f724-0x0;var _0x49b152=_0xfcbc[_0x15f724];return _0x49b152;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xcfcb('0x0'),'remove',_0xcfcb('0x1')];function createListener(_0x35c1ed,_0x40f048){return function(_0x226fe5){_0x40f048[_0xcfcb('0x2')](_0x35c1ed,_0x226fe5);};}function removeListener(_0x11e81f,_0x565c3e){return function(){DashboardEvents['removeListener'](_0x11e81f,_0x565c3e);};}exports[_0xcfcb('0x3')]=function(_0x5e8ea){for(var _0x14ccee=0x0,_0x4bc560=events[_0xcfcb('0x4')];_0x14ccee<_0x4bc560;_0x14ccee++){var _0x2ac608=events[_0x14ccee];var _0x269141=createListener(_0xcfcb('0x5')+_0x2ac608,_0x5e8ea);DashboardEvents['on'](_0x2ac608,_0x269141);}}; \ No newline at end of file +var _0x6082=['register','length','./dashboard.events','save','remove','update'];(function(_0x313a26,_0x407035){var _0x3a5d3d=function(_0x28acd1){while(--_0x28acd1){_0x313a26['push'](_0x313a26['shift']());}};_0x3a5d3d(++_0x407035);}(_0x6082,0xd4));var _0x2608=function(_0x432008,_0x57853e){_0x432008=_0x432008-0x0;var _0x5e9e68=_0x6082[_0x432008];return _0x5e9e68;};'use strict';var DashboardEvents=require(_0x2608('0x0'));var events=[_0x2608('0x1'),_0x2608('0x2'),_0x2608('0x3')];function createListener(_0x12e389,_0x167593){return function(_0x3205f1){_0x167593['emit'](_0x12e389,_0x3205f1);};}function removeListener(_0x58f9f5,_0x1086ee){return function(){DashboardEvents['removeListener'](_0x58f9f5,_0x1086ee);};}exports[_0x2608('0x4')]=function(_0x2cfd8b){for(var _0x39137b=0x0,_0x5514f4=events[_0x2608('0x5')];_0x39137b<_0x5514f4;_0x39137b++){var _0x5f42a0=events[_0x39137b];var _0x3757a3=createListener('dashboard:'+_0x5f42a0,_0x2cfd8b);DashboardEvents['on'](_0x5f42a0,_0x3757a3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5609876..1c45f68 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 _0x7586=['clone','addItem','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','create'];(function(_0x3e7a33,_0xc77695){var _0x25a05b=function(_0x2ed5c8){while(--_0x2ed5c8){_0x3e7a33['push'](_0x3e7a33['shift']());}};_0x25a05b(++_0xc77695);}(_0x7586,0x18d));var _0x6758=function(_0x27227e,_0x38898c){_0x27227e=_0x27227e-0x0;var _0x54f517=_0x7586[_0x27227e];return _0x54f517;};'use strict';var multer=require(_0x6758('0x0'));var util=require(_0x6758('0x1'));var path=require(_0x6758('0x2'));var timeout=require('connect-timeout');var express=require(_0x6758('0x3'));var router=express[_0x6758('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6758('0x5'));var interaction=require(_0x6758('0x6'));var config=require('../../config/environment');var controller=require(_0x6758('0x7'));router[_0x6758('0x8')]('/',auth['isAuthenticated'](),controller[_0x6758('0x9')]);router['get'](_0x6758('0xa'),auth[_0x6758('0xb')](),controller[_0x6758('0xc')]);router[_0x6758('0x8')](_0x6758('0xd'),auth[_0x6758('0xb')](),controller[_0x6758('0xe')]);router[_0x6758('0xf')]('/',auth[_0x6758('0xb')](),controller[_0x6758('0x10')]);router['post']('/:id/clone',auth[_0x6758('0xb')](),controller[_0x6758('0x11')]);router[_0x6758('0xf')](_0x6758('0xd'),auth['isAuthenticated'](),controller[_0x6758('0x12')]);router[_0x6758('0x13')](_0x6758('0xa'),auth[_0x6758('0xb')](),controller[_0x6758('0x14')]);router['delete'](_0x6758('0xa'),auth[_0x6758('0xb')](),controller[_0x6758('0x15')]);module[_0x6758('0x16')]=router; \ No newline at end of file +var _0xf53b=['getItems','post','/:id/clone','clone','addItem','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','show','/:id/items'];(function(_0x803391,_0x1fc054){var _0x41d815=function(_0x353bd5){while(--_0x353bd5){_0x803391['push'](_0x803391['shift']());}};_0x41d815(++_0x1fc054);}(_0xf53b,0xf8));var _0xbf53=function(_0x514020,_0x2f54cd){_0x514020=_0x514020-0x0;var _0x2cb291=_0xf53b[_0x514020];return _0x2cb291;};'use strict';var multer=require(_0xbf53('0x0'));var util=require(_0xbf53('0x1'));var path=require(_0xbf53('0x2'));var timeout=require(_0xbf53('0x3'));var express=require(_0xbf53('0x4'));var router=express[_0xbf53('0x5')]();var fs_extra=require(_0xbf53('0x6'));var auth=require(_0xbf53('0x7'));var interaction=require(_0xbf53('0x8'));var config=require(_0xbf53('0x9'));var controller=require(_0xbf53('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbf53('0xb')](_0xbf53('0xc'),auth[_0xbf53('0xd')](),controller[_0xbf53('0xe')]);router[_0xbf53('0xb')](_0xbf53('0xf'),auth[_0xbf53('0xd')](),controller[_0xbf53('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbf53('0x11')](_0xbf53('0x12'),auth[_0xbf53('0xd')](),controller[_0xbf53('0x13')]);router[_0xbf53('0x11')]('/:id/items',auth[_0xbf53('0xd')](),controller[_0xbf53('0x14')]);router['put'](_0xbf53('0xc'),auth['isAuthenticated'](),controller[_0xbf53('0x15')]);router[_0xbf53('0x16')]('/:id',auth[_0xbf53('0xd')](),controller[_0xbf53('0x17')]);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 e8e5331..2437f76 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 _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x16d263,_0x42d6ea){var _0x50cc18=function(_0x1e999e){while(--_0x1e999e){_0x16d263['push'](_0x16d263['shift']());}};_0x50cc18(++_0x42d6ea);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x4ee1a1,_0x4bb2b8){_0x4ee1a1=_0x4ee1a1-0x0;var _0x54175e=_0xbd51[_0x4ee1a1];return _0x54175e;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x606fe8,_0x10b084){_0x606fe8=_0x606fe8-0x0;var _0x28b517=_0xfdbd[_0x606fe8];return _0x28b517;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'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 4c348c7..e114710 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 _0xa992=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','include','merge','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrOpenchannelAccounts','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x90ec08,_0x46b5d5){var _0x52409e=function(_0xaa9b6b){while(--_0xaa9b6b){_0x90ec08['push'](_0x90ec08['shift']());}};_0x52409e(++_0x46b5d5);}(_0xa992,0x18c));var _0x2a99=function(_0x2754cd,_0xaf73dd){_0x2754cd=_0x2754cd-0x0;var _0x71b5a4=_0xa992[_0x2754cd];return _0x71b5a4;};'use strict';var emlformat=require(_0x2a99('0x0'));var rimraf=require(_0x2a99('0x1'));var zipdir=require(_0x2a99('0x2'));var jsonpatch=require(_0x2a99('0x3'));var rp=require('request-promise');var moment=require(_0x2a99('0x4'));var BPromise=require(_0x2a99('0x5'));var Mustache=require(_0x2a99('0x6'));var util=require(_0x2a99('0x7'));var path=require(_0x2a99('0x8'));var sox=require(_0x2a99('0x9'));var csv=require(_0x2a99('0xa'));var ejs=require(_0x2a99('0xb'));var fs=require('fs');var fs_extra=require(_0x2a99('0xc'));var _=require(_0x2a99('0xd'));var squel=require('squel');var crypto=require(_0x2a99('0xe'));var jsforce=require(_0x2a99('0xf'));var deskjs=require(_0x2a99('0x10'));var toCsv=require(_0x2a99('0xa'));var querystring=require(_0x2a99('0x11'));var Papa=require(_0x2a99('0x12'));var Redis=require(_0x2a99('0x13'));var authService=require(_0x2a99('0x14'));var qs=require(_0x2a99('0x15'));var as=require(_0x2a99('0x16'));var hardwareService=require(_0x2a99('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2a99('0x18'));var config=require(_0x2a99('0x19'));var licenseUtil=require(_0x2a99('0x1a'));var db=require(_0x2a99('0x1b'))['db'];config[_0x2a99('0x1c')]=_[_0x2a99('0x1d')](config['redis'],{'host':_0x2a99('0x1e'),'port':0x18eb});var socket=require(_0x2a99('0x1f'))(new Redis(config[_0x2a99('0x1c')]));require(_0x2a99('0x20'))[_0x2a99('0x21')](socket);function respondWithStatusCode(_0x5f2cfa,_0x2ad1c9){_0x2ad1c9=_0x2ad1c9||0xcc;return function(_0x47f5d7){if(_0x47f5d7){return _0x5f2cfa['sendStatus'](_0x2ad1c9);}return _0x5f2cfa[_0x2a99('0x22')](_0x2ad1c9)[_0x2a99('0x23')]();};}function respondWithResult(_0x343ba4,_0x4aa37c){_0x4aa37c=_0x4aa37c||0xc8;return function(_0x5bf701){if(_0x5bf701){return _0x343ba4['status'](_0x4aa37c)[_0x2a99('0x24')](_0x5bf701);}};}function respondWithFilteredResult(_0x4346c4,_0x59f0f0){return function(_0x1819fd){if(_0x1819fd){var _0x44ac46=typeof _0x59f0f0[_0x2a99('0x25')]===_0x2a99('0x26')&&typeof _0x59f0f0['limit']===_0x2a99('0x26');var _0x410ea7=_0x1819fd[_0x2a99('0x27')];var _0x620ca5=_0x44ac46?0x0:_0x59f0f0[_0x2a99('0x25')];var _0x56860d=_0x44ac46?_0x1819fd[_0x2a99('0x27')]:_0x59f0f0[_0x2a99('0x25')]+_0x59f0f0[_0x2a99('0x28')];var _0x35fddf;if(_0x56860d>=_0x410ea7){_0x56860d=_0x410ea7;_0x35fddf=0xc8;}else{_0x35fddf=0xce;}_0x4346c4[_0x2a99('0x22')](_0x35fddf);return _0x4346c4[_0x2a99('0x29')](_0x2a99('0x2a'),_0x620ca5+'-'+_0x56860d+'/'+_0x410ea7)[_0x2a99('0x24')](_0x1819fd);}return null;};}function patchUpdates(_0x3541fc){return function(_0x457a85){try{jsonpatch['apply'](_0x457a85,_0x3541fc,!![]);}catch(_0x1109cd){return BPromise['reject'](_0x1109cd);}return _0x457a85['save']();};}function saveUpdates(_0x48c611,_0x5527f0){return function(_0x5e13e9){if(_0x5e13e9){return _0x5e13e9['update'](_0x48c611)[_0x2a99('0x2b')](function(_0x5ec334){return _0x5ec334;});}return null;};}function removeEntity(_0x324a1c,_0x228737){return function(_0x274707){if(_0x274707){return _0x274707[_0x2a99('0x2c')]()[_0x2a99('0x2b')](function(){_0x324a1c[_0x2a99('0x22')](0xcc)[_0x2a99('0x23')]();});}};}function handleEntityNotFound(_0x3485c8,_0x2b5d97){return function(_0x2f0bf0){if(!_0x2f0bf0){_0x3485c8['sendStatus'](0x194);}return _0x2f0bf0;};}function handleError(_0x47736f,_0x4271b4){_0x4271b4=_0x4271b4||0x1f4;return function(_0x5ad092){logger[_0x2a99('0x2d')](_0x5ad092[_0x2a99('0x2e')]);if(_0x5ad092[_0x2a99('0x2f')]){delete _0x5ad092['name'];}_0x47736f[_0x2a99('0x22')](_0x4271b4)[_0x2a99('0x30')](_0x5ad092);};}exports[_0x2a99('0x31')]=function(_0x30f087,_0x5ea029){var _0x24dc9f={'raw':![],'where':{'id':_0x30f087['params']['id']}},_0x1dbffa={};_0x1dbffa[_0x2a99('0x32')]=_[_0x2a99('0x33')](db[_0x2a99('0x34')]['rawAttributes']);_0x1dbffa[_0x2a99('0x35')]=_[_0x2a99('0x33')](_0x30f087[_0x2a99('0x35')]);_0x1dbffa[_0x2a99('0x36')]=_[_0x2a99('0x37')](_0x1dbffa['model'],_0x1dbffa[_0x2a99('0x35')]);_0x24dc9f['attributes']=_[_0x2a99('0x37')](_0x1dbffa[_0x2a99('0x32')],qs[_0x2a99('0x38')](_0x30f087[_0x2a99('0x35')][_0x2a99('0x38')]));_0x24dc9f[_0x2a99('0x39')]=_0x24dc9f[_0x2a99('0x39')][_0x2a99('0x3a')]?_0x24dc9f[_0x2a99('0x39')]:_0x1dbffa[_0x2a99('0x32')];if(_0x30f087[_0x2a99('0x35')]['includeAll']){_0x24dc9f[_0x2a99('0x3b')]=[{'all':!![]}];}_0x24dc9f=_[_0x2a99('0x3c')]({},_0x24dc9f,_0x30f087[_0x2a99('0x3d')]);return db[_0x2a99('0x34')][_0x2a99('0x3e')](_0x24dc9f)[_0x2a99('0x2b')](handleEntityNotFound(_0x5ea029,null))[_0x2a99('0x2b')](respondWithResult(_0x5ea029,null))[_0x2a99('0x3f')](handleError(_0x5ea029,null));};exports[_0x2a99('0x2c')]=function(_0xbeca9f,_0x5a7b82){return db['DashboardItem']['find']({'where':{'id':_0xbeca9f[_0x2a99('0x40')]['id']}})[_0x2a99('0x2b')](handleEntityNotFound(_0x5a7b82,null))[_0x2a99('0x2b')](removeEntity(_0x5a7b82,null))[_0x2a99('0x3f')](handleError(_0x5a7b82,null));};function widgetAttributes(_0x2f7fb9){try{switch(_0x2f7fb9[_0x2a99('0x41')]){case _0x2a99('0x42'):return[{'name':'attrUrl','value':_0x2f7fb9[_0x2a99('0x43')]||(_0x2f7fb9['attrs']&&_0x2f7fb9['attrs'][0x0]?_0x2f7fb9[_0x2a99('0x44')][0x0][_0x2a99('0x45')]:undefined)||_0x2a99('0x46')}];case _0x2a99('0x47'):return[{'name':_0x2a99('0x48'),'value':_0x2f7fb9[_0x2a99('0x48')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x0]?_0x2f7fb9[_0x2a99('0x44')][0x0][_0x2a99('0x45')]:undefined)||''}];case _0x2a99('0x49'):return[{'name':_0x2a99('0x4a'),'value':_0x2f7fb9[_0x2a99('0x4a')]||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x0]?_0x2f7fb9[_0x2a99('0x44')][0x0]['value']:undefined)||_0x2a99('0x4b')},{'name':_0x2a99('0x4c'),'value':_0x2f7fb9[_0x2a99('0x4c')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x1]?_0x2f7fb9['attrs'][0x1][_0x2a99('0x45')]:undefined)||_0x2a99('0x4d')},{'name':_0x2a99('0x4e'),'value':_0x2f7fb9[_0x2a99('0x4e')]||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x2]?_0x2f7fb9[_0x2a99('0x44')][0x2][_0x2a99('0x45')]:undefined)||0xc}];case _0x2a99('0x4f'):return[{'name':'attrMetric','value':_0x2f7fb9['attrMetric']||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x0]?_0x2f7fb9['attrs'][0x0][_0x2a99('0x45')]:undefined)||_0x2a99('0x50')},{'name':'attrVoiceQueues','value':_0x2f7fb9[_0x2a99('0x51')]||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x1]?_0x2f7fb9[_0x2a99('0x44')][0x1][_0x2a99('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x2f7fb9[_0x2a99('0x4e')]||(_0x2f7fb9['attrs']&&_0x2f7fb9['attrs'][0x2]?_0x2f7fb9[_0x2a99('0x44')][0x2][_0x2a99('0x45')]:undefined)||0x14},{'name':_0x2a99('0x52'),'value':_0x2f7fb9[_0x2a99('0x52')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x3]?_0x2f7fb9['attrs'][0x3][_0x2a99('0x45')]:undefined)||_0x2a99('0x53')},{'name':_0x2a99('0x54'),'value':_0x2f7fb9[_0x2a99('0x54')]||(_0x2f7fb9['attrs']&&_0x2f7fb9['attrs'][0x4]?_0x2f7fb9[_0x2a99('0x44')][0x4][_0x2a99('0x45')]:undefined)||''},{'name':_0x2a99('0x55'),'value':_0x2f7fb9[_0x2a99('0x55')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9['attrs'][0x5]?_0x2f7fb9[_0x2a99('0x44')][0x5][_0x2a99('0x45')]:undefined)||''},{'name':_0x2a99('0x56'),'value':_0x2f7fb9[_0x2a99('0x56')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x6]?_0x2f7fb9[_0x2a99('0x44')][0x6][_0x2a99('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2f7fb9['attrOpenchannelAccounts']||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x7]?_0x2f7fb9[_0x2a99('0x44')][0x7][_0x2a99('0x45')]:undefined)||''},{'name':_0x2a99('0x57'),'value':_0x2f7fb9[_0x2a99('0x57')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9['attrs'][0x8]?_0x2f7fb9[_0x2a99('0x44')][0x8]['value']:undefined)||''},{'name':_0x2a99('0x58'),'value':_0x2f7fb9[_0x2a99('0x58')]||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x9]?_0x2f7fb9['attrs'][0x9]['value']:undefined)||''}];case _0x2a99('0x59'):case'pie-chart':return[{'name':_0x2a99('0x5a'),'value':_0x2f7fb9['attrSerie1']||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9['attrs'][0x0]?_0x2f7fb9[_0x2a99('0x44')][0x0][_0x2a99('0x45')]:undefined)||_0x2a99('0x50')},{'name':_0x2a99('0x5b'),'value':_0x2f7fb9[_0x2a99('0x5b')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9['attrs'][0x1]?_0x2f7fb9[_0x2a99('0x44')][0x1][_0x2a99('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x2f7fb9['attrSerie3']||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x2]?_0x2f7fb9['attrs'][0x2][_0x2a99('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2f7fb9[_0x2a99('0x51')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x3]?_0x2f7fb9[_0x2a99('0x44')][0x3][_0x2a99('0x45')]:undefined)||[]},{'name':_0x2a99('0x52'),'value':_0x2f7fb9['attrChannel']||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x4]?_0x2f7fb9[_0x2a99('0x44')][0x4][_0x2a99('0x45')]:undefined)||_0x2a99('0x53')},{'name':'attrEmailAccounts','value':_0x2f7fb9[_0x2a99('0x54')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x5]?_0x2f7fb9[_0x2a99('0x44')][0x5]['value']:undefined)||''},{'name':_0x2a99('0x55'),'value':_0x2f7fb9[_0x2a99('0x55')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x6]?_0x2f7fb9[_0x2a99('0x44')][0x6][_0x2a99('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2f7fb9[_0x2a99('0x56')]||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0x7]?_0x2f7fb9[_0x2a99('0x44')][0x7][_0x2a99('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2f7fb9[_0x2a99('0x5c')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x8]?_0x2f7fb9['attrs'][0x8][_0x2a99('0x45')]:undefined)||''},{'name':_0x2a99('0x57'),'value':_0x2f7fb9['attrWhatsappAccounts']||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x9]?_0x2f7fb9[_0x2a99('0x44')][0x9][_0x2a99('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2f7fb9[_0x2a99('0x58')]||(_0x2f7fb9['attrs']&&_0x2f7fb9[_0x2a99('0x44')][0xa]?_0x2f7fb9['attrs'][0xa][_0x2a99('0x45')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x2f7fb9[_0x2a99('0x5d')]||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9['attrs'][0x0]?_0x2f7fb9[_0x2a99('0x44')][0x0][_0x2a99('0x41')]:undefined)||null,'value':_0x2f7fb9['attrReport']||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9[_0x2a99('0x44')][0x0]?_0x2f7fb9[_0x2a99('0x44')][0x0][_0x2a99('0x45')]:undefined)||null},{'name':_0x2a99('0x5e'),'value':_0x2f7fb9['attrRefresh']||(_0x2f7fb9[_0x2a99('0x44')]&&_0x2f7fb9['attrs'][0x1]?_0x2f7fb9[_0x2a99('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x357f27){logger[_0x2a99('0x2d')](_0x2a99('0x5f'),JSON[_0x2a99('0x60')](_0x357f27));return[];}}exports[_0x2a99('0x61')]=function(_0x5c7ee2,_0x2ceceb){if(_0x5c7ee2[_0x2a99('0x62')]){_0x5c7ee2[_0x2a99('0x62')][_0x2a99('0x44')]=widgetAttributes(_0x5c7ee2['body']);}return db[_0x2a99('0x34')]['create'](_0x5c7ee2[_0x2a99('0x62')],{})[_0x2a99('0x2b')](respondWithResult(_0x2ceceb,0xc9))['catch'](handleError(_0x2ceceb,null));};exports[_0x2a99('0x63')]=function(_0x5c34d1,_0x3b81f0){if(_0x5c34d1[_0x2a99('0x62')]['id']){delete _0x5c34d1[_0x2a99('0x62')]['id'];}_0x5c34d1[_0x2a99('0x62')][_0x2a99('0x44')]=widgetAttributes(_0x5c34d1['body']);return db['DashboardItem'][_0x2a99('0x3e')]({'where':{'id':_0x5c34d1[_0x2a99('0x40')]['id']}})[_0x2a99('0x2b')](handleEntityNotFound(_0x3b81f0,null))[_0x2a99('0x2b')](saveUpdates(_0x5c34d1[_0x2a99('0x62')],null))['then'](respondWithResult(_0x3b81f0,null))[_0x2a99('0x3f')](handleError(_0x3b81f0,null));}; \ No newline at end of file +var _0xf78f=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','voice','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','fields','includeAll','merge','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrFaxAccounts','attrSmsAccounts'];(function(_0x3606ff,_0x47b05b){var _0x2c0e6d=function(_0x53c1a6){while(--_0x53c1a6){_0x3606ff['push'](_0x3606ff['shift']());}};_0x2c0e6d(++_0x47b05b);}(_0xf78f,0x72));var _0xff78=function(_0x49ee68,_0x3be033){_0x49ee68=_0x49ee68-0x0;var _0x4d79ca=_0xf78f[_0x49ee68];return _0x4d79ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff78('0x0'));var zipdir=require(_0xff78('0x1'));var jsonpatch=require(_0xff78('0x2'));var rp=require(_0xff78('0x3'));var moment=require(_0xff78('0x4'));var BPromise=require(_0xff78('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff78('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff78('0x7'));var squel=require(_0xff78('0x8'));var crypto=require(_0xff78('0x9'));var jsforce=require(_0xff78('0xa'));var deskjs=require(_0xff78('0xb'));var toCsv=require(_0xff78('0xc'));var querystring=require(_0xff78('0xd'));var Papa=require(_0xff78('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff78('0xf'));var as=require(_0xff78('0x10'));var hardwareService=require(_0xff78('0x11'));var logger=require(_0xff78('0x12'))(_0xff78('0x13'));var utils=require(_0xff78('0x14'));var config=require(_0xff78('0x15'));var licenseUtil=require(_0xff78('0x16'));var db=require('../../mysqldb')['db'];config[_0xff78('0x17')]=_[_0xff78('0x18')](config['redis'],{'host':_0xff78('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xff78('0x17')]));require('./dashboardItem.socket')[_0xff78('0x1a')](socket);function respondWithStatusCode(_0x27c281,_0x205176){_0x205176=_0x205176||0xcc;return function(_0x2ed55e){if(_0x2ed55e){return _0x27c281['sendStatus'](_0x205176);}return _0x27c281[_0xff78('0x1b')](_0x205176)[_0xff78('0x1c')]();};}function respondWithResult(_0x21b5ef,_0x2b47c8){_0x2b47c8=_0x2b47c8||0xc8;return function(_0x3691a2){if(_0x3691a2){return _0x21b5ef[_0xff78('0x1b')](_0x2b47c8)[_0xff78('0x1d')](_0x3691a2);}};}function respondWithFilteredResult(_0x5dfd19,_0x5b1310){return function(_0x183cd1){if(_0x183cd1){var _0x2eda17=typeof _0x5b1310[_0xff78('0x1e')]===_0xff78('0x1f')&&typeof _0x5b1310[_0xff78('0x20')]===_0xff78('0x1f');var _0xf0c91b=_0x183cd1['count'];var _0x279494=_0x2eda17?0x0:_0x5b1310[_0xff78('0x1e')];var _0x198452=_0x2eda17?_0x183cd1['count']:_0x5b1310[_0xff78('0x1e')]+_0x5b1310['limit'];var _0x16ed8e;if(_0x198452>=_0xf0c91b){_0x198452=_0xf0c91b;_0x16ed8e=0xc8;}else{_0x16ed8e=0xce;}_0x5dfd19[_0xff78('0x1b')](_0x16ed8e);return _0x5dfd19[_0xff78('0x21')](_0xff78('0x22'),_0x279494+'-'+_0x198452+'/'+_0xf0c91b)[_0xff78('0x1d')](_0x183cd1);}return null;};}function patchUpdates(_0x4ebf5e){return function(_0x584d0d){try{jsonpatch[_0xff78('0x23')](_0x584d0d,_0x4ebf5e,!![]);}catch(_0x9f79f){return BPromise[_0xff78('0x24')](_0x9f79f);}return _0x584d0d[_0xff78('0x25')]();};}function saveUpdates(_0x1dd2a2,_0x2161b6){return function(_0x2e4b93){if(_0x2e4b93){return _0x2e4b93[_0xff78('0x26')](_0x1dd2a2)['then'](function(_0x184563){return _0x184563;});}return null;};}function removeEntity(_0x122b5e,_0x395734){return function(_0x6cff13){if(_0x6cff13){return _0x6cff13['destroy']()[_0xff78('0x27')](function(){_0x122b5e[_0xff78('0x1b')](0xcc)[_0xff78('0x1c')]();});}};}function handleEntityNotFound(_0x1b04fd,_0x1c5da9){return function(_0x59c24d){if(!_0x59c24d){_0x1b04fd[_0xff78('0x28')](0x194);}return _0x59c24d;};}function handleError(_0x185107,_0xb2015b){_0xb2015b=_0xb2015b||0x1f4;return function(_0x2e716b){logger[_0xff78('0x29')](_0x2e716b[_0xff78('0x2a')]);if(_0x2e716b[_0xff78('0x2b')]){delete _0x2e716b[_0xff78('0x2b')];}_0x185107[_0xff78('0x1b')](_0xb2015b)[_0xff78('0x2c')](_0x2e716b);};}exports[_0xff78('0x2d')]=function(_0x513756,_0x3d1a4a){var _0x22aa0a={'raw':![],'where':{'id':_0x513756[_0xff78('0x2e')]['id']}},_0x2afa72={};_0x2afa72['model']=_[_0xff78('0x2f')](db[_0xff78('0x30')][_0xff78('0x31')]);_0x2afa72[_0xff78('0x32')]=_[_0xff78('0x2f')](_0x513756[_0xff78('0x32')]);_0x2afa72[_0xff78('0x33')]=_[_0xff78('0x34')](_0x2afa72['model'],_0x2afa72[_0xff78('0x32')]);_0x22aa0a[_0xff78('0x35')]=_[_0xff78('0x34')](_0x2afa72[_0xff78('0x36')],qs[_0xff78('0x37')](_0x513756[_0xff78('0x32')][_0xff78('0x37')]));_0x22aa0a['attributes']=_0x22aa0a[_0xff78('0x35')]['length']?_0x22aa0a[_0xff78('0x35')]:_0x2afa72[_0xff78('0x36')];if(_0x513756[_0xff78('0x32')][_0xff78('0x38')]){_0x22aa0a['include']=[{'all':!![]}];}_0x22aa0a=_[_0xff78('0x39')]({},_0x22aa0a,_0x513756[_0xff78('0x3a')]);return db[_0xff78('0x30')][_0xff78('0x3b')](_0x22aa0a)[_0xff78('0x27')](handleEntityNotFound(_0x3d1a4a,null))[_0xff78('0x27')](respondWithResult(_0x3d1a4a,null))[_0xff78('0x3c')](handleError(_0x3d1a4a,null));};exports[_0xff78('0x3d')]=function(_0x2a5b34,_0x149c08){return db[_0xff78('0x30')]['find']({'where':{'id':_0x2a5b34[_0xff78('0x2e')]['id']}})[_0xff78('0x27')](handleEntityNotFound(_0x149c08,null))[_0xff78('0x27')](removeEntity(_0x149c08,null))[_0xff78('0x3c')](handleError(_0x149c08,null));};function widgetAttributes(_0x42b352){try{switch(_0x42b352[_0xff78('0x3e')]){case _0xff78('0x3f'):return[{'name':_0xff78('0x40'),'value':_0x42b352[_0xff78('0x40')]||(_0x42b352['attrs']&&_0x42b352['attrs'][0x0]?_0x42b352[_0xff78('0x41')][0x0][_0xff78('0x42')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x42b352[_0xff78('0x43')]||(_0x42b352['attrs']&&_0x42b352[_0xff78('0x41')][0x0]?_0x42b352[_0xff78('0x41')][0x0][_0xff78('0x42')]:undefined)||''}];case _0xff78('0x44'):return[{'name':_0xff78('0x45'),'value':_0x42b352['attrHourFormat']||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x0]?_0x42b352['attrs'][0x0][_0xff78('0x42')]:undefined)||_0xff78('0x46')},{'name':_0xff78('0x47'),'value':_0x42b352['attrTimezone']||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x1]?_0x42b352[_0xff78('0x41')][0x1]['value']:undefined)||_0xff78('0x48')},{'name':_0xff78('0x49'),'value':_0x42b352[_0xff78('0x49')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x2]?_0x42b352[_0xff78('0x41')][0x2][_0xff78('0x42')]:undefined)||0xc}];case _0xff78('0x4a'):return[{'name':_0xff78('0x4b'),'value':_0x42b352[_0xff78('0x4b')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352['attrs'][0x0]?_0x42b352['attrs'][0x0][_0xff78('0x42')]:undefined)||'total'},{'name':_0xff78('0x4c'),'value':_0x42b352[_0xff78('0x4c')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x1]?_0x42b352[_0xff78('0x41')][0x1][_0xff78('0x42')]:undefined)||[]},{'name':_0xff78('0x49'),'value':_0x42b352[_0xff78('0x49')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x2]?_0x42b352[_0xff78('0x41')][0x2][_0xff78('0x42')]:undefined)||0x14},{'name':_0xff78('0x4d'),'value':_0x42b352[_0xff78('0x4d')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x3]?_0x42b352[_0xff78('0x41')][0x3][_0xff78('0x42')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x42b352['attrEmailAccounts']||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x4]?_0x42b352[_0xff78('0x41')][0x4][_0xff78('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x42b352[_0xff78('0x4e')]||(_0x42b352['attrs']&&_0x42b352[_0xff78('0x41')][0x5]?_0x42b352[_0xff78('0x41')][0x5][_0xff78('0x42')]:undefined)||''},{'name':_0xff78('0x4f'),'value':_0x42b352[_0xff78('0x4f')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x6]?_0x42b352['attrs'][0x6]['value']:undefined)||''},{'name':_0xff78('0x50'),'value':_0x42b352[_0xff78('0x50')]||(_0x42b352['attrs']&&_0x42b352[_0xff78('0x41')][0x7]?_0x42b352['attrs'][0x7][_0xff78('0x42')]:undefined)||''},{'name':_0xff78('0x51'),'value':_0x42b352[_0xff78('0x51')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x8]?_0x42b352[_0xff78('0x41')][0x8][_0xff78('0x42')]:undefined)||''},{'name':_0xff78('0x52'),'value':_0x42b352[_0xff78('0x52')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x9]?_0x42b352['attrs'][0x9][_0xff78('0x42')]:undefined)||''}];case _0xff78('0x53'):case _0xff78('0x54'):return[{'name':_0xff78('0x55'),'value':_0x42b352[_0xff78('0x55')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x0]?_0x42b352[_0xff78('0x41')][0x0][_0xff78('0x42')]:undefined)||'total'},{'name':'attrSerie2','value':_0x42b352['attrSerie2']||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x1]?_0x42b352[_0xff78('0x41')][0x1][_0xff78('0x42')]:undefined)||null},{'name':_0xff78('0x56'),'value':_0x42b352[_0xff78('0x56')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x2]?_0x42b352[_0xff78('0x41')][0x2][_0xff78('0x42')]:undefined)||null},{'name':_0xff78('0x4c'),'value':_0x42b352['attrVoiceQueues']||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x3]?_0x42b352[_0xff78('0x41')][0x3][_0xff78('0x42')]:undefined)||[]},{'name':'attrChannel','value':_0x42b352[_0xff78('0x4d')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x4]?_0x42b352[_0xff78('0x41')][0x4][_0xff78('0x42')]:undefined)||_0xff78('0x57')},{'name':'attrEmailAccounts','value':_0x42b352[_0xff78('0x58')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x5]?_0x42b352['attrs'][0x5][_0xff78('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x42b352[_0xff78('0x4e')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x6]?_0x42b352[_0xff78('0x41')][0x6][_0xff78('0x42')]:undefined)||''},{'name':_0xff78('0x4f'),'value':_0x42b352[_0xff78('0x4f')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352['attrs'][0x7]?_0x42b352[_0xff78('0x41')][0x7]['value']:undefined)||''},{'name':_0xff78('0x50'),'value':_0x42b352[_0xff78('0x50')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x8]?_0x42b352[_0xff78('0x41')][0x8][_0xff78('0x42')]:undefined)||''},{'name':_0xff78('0x51'),'value':_0x42b352[_0xff78('0x51')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x9]?_0x42b352[_0xff78('0x41')][0x9][_0xff78('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x42b352[_0xff78('0x52')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0xa]?_0x42b352[_0xff78('0x41')][0xa][_0xff78('0x42')]:undefined)||''}];case _0xff78('0x59'):return[{'name':_0xff78('0x5a'),'type':_0x42b352[_0xff78('0x5b')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352['attrs'][0x0]?_0x42b352[_0xff78('0x41')][0x0]['type']:undefined)||null,'value':_0x42b352[_0xff78('0x5a')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x0]?_0x42b352['attrs'][0x0][_0xff78('0x42')]:undefined)||null},{'name':_0xff78('0x5c'),'value':_0x42b352[_0xff78('0x5c')]||(_0x42b352[_0xff78('0x41')]&&_0x42b352[_0xff78('0x41')][0x1]?_0x42b352[_0xff78('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x23f8e4){logger[_0xff78('0x29')](_0xff78('0x5d'),JSON[_0xff78('0x5e')](_0x23f8e4));return[];}}exports[_0xff78('0x5f')]=function(_0x283255,_0x308bc5){if(_0x283255[_0xff78('0x60')]){_0x283255[_0xff78('0x60')][_0xff78('0x41')]=widgetAttributes(_0x283255[_0xff78('0x60')]);}return db[_0xff78('0x30')][_0xff78('0x5f')](_0x283255[_0xff78('0x60')],{})[_0xff78('0x27')](respondWithResult(_0x308bc5,0xc9))[_0xff78('0x3c')](handleError(_0x308bc5,null));};exports[_0xff78('0x26')]=function(_0x29eff9,_0x23ab32){if(_0x29eff9[_0xff78('0x60')]['id']){delete _0x29eff9[_0xff78('0x60')]['id'];}_0x29eff9[_0xff78('0x60')][_0xff78('0x41')]=widgetAttributes(_0x29eff9['body']);return db[_0xff78('0x30')][_0xff78('0x3b')]({'where':{'id':_0x29eff9['params']['id']}})[_0xff78('0x27')](handleEntityNotFound(_0x23ab32,null))[_0xff78('0x27')](saveUpdates(_0x29eff9[_0xff78('0x60')],null))[_0xff78('0x27')](respondWithResult(_0x23ab32,null))[_0xff78('0x3c')](handleError(_0x23ab32,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 191fe76..4d2109c 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 _0x5ceb=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x1bcf27,_0x2de1ee){var _0x351cec=function(_0x10468a){while(--_0x10468a){_0x1bcf27['push'](_0x1bcf27['shift']());}};_0x351cec(++_0x2de1ee);}(_0x5ceb,0x1d3));var _0xb5ce=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x5ceb[_0x5519a9];return _0x32f2cc;};'use strict';var EventEmitter=require(_0xb5ce('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb5ce('0x1')](0x0);var events={'afterCreate':_0xb5ce('0x2'),'afterUpdate':_0xb5ce('0x3'),'afterDestroy':'remove'};function emitEvent(_0x93f46a){return function(_0x37e804,_0x787474,_0x40b879){DashboardItemEvents[_0xb5ce('0x4')](_0x93f46a+':'+_0x37e804['id'],_0x37e804);DashboardItemEvents[_0xb5ce('0x4')](_0x93f46a,_0x37e804);_0x40b879(null);};}for(var e in events){if(events[_0xb5ce('0x5')](e)){var event=events[e];DashboardItem[_0xb5ce('0x6')](e,emitEvent(event));}}module[_0xb5ce('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xc280=['events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xc280,0x136));var _0x0c28=function(_0x3f5e22,_0x55dc51){_0x3f5e22=_0x3f5e22-0x0;var _0x3352f8=_0xc280[_0x3f5e22];return _0x3352f8;};'use strict';var EventEmitter=require(_0x0c28('0x0'));var DashboardItem=require(_0x0c28('0x1'))['db'][_0x0c28('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0c28('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c28('0x4'),'afterDestroy':_0x0c28('0x5')};function emitEvent(_0x353795){return function(_0x435ce3,_0x143897,_0x57da90){DashboardItemEvents[_0x0c28('0x6')](_0x353795+':'+_0x435ce3['id'],_0x435ce3);DashboardItemEvents['emit'](_0x353795,_0x435ce3);_0x57da90(null);};}for(var e in events){if(events[_0x0c28('0x7')](e)){var event=events[e];DashboardItem[_0x0c28('0x8')](e,emitEvent(event));}}module[_0x0c28('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 880c0c6..ce52939 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 _0xabd8=['define','DashboardItem','dashboard_items','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x14ebb6,_0x2ad771){var _0x3862d3=function(_0x2fd7c3){while(--_0x2fd7c3){_0x14ebb6['push'](_0x14ebb6['shift']());}};_0x3862d3(++_0x2ad771);}(_0xabd8,0x142));var _0x8abd=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xabd8[_0x40dd56];return _0x4f850f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8abd('0x0'));var moment=require(_0x8abd('0x1'));var BPromise=require(_0x8abd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8abd('0x3'));var rimraf=require(_0x8abd('0x4'));var config=require(_0x8abd('0x5'));var attributes=require(_0x8abd('0x6'));module[_0x8abd('0x7')]=function(_0x840926,_0x2907b1){return _0x840926[_0x8abd('0x8')](_0x8abd('0x9'),attributes,{'tableName':_0x8abd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6548=['dashboard_items','lodash','api','moment','bluebird','../../config/environment','exports','define','DashboardItem'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x6548,0x133));var _0x8654=function(_0x3b3aca,_0x5e03f8){_0x3b3aca=_0x3b3aca-0x0;var _0x12ad5c=_0x6548[_0x3b3aca];return _0x12ad5c;};'use strict';var _=require(_0x8654('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8654('0x1'));var moment=require(_0x8654('0x2'));var BPromise=require(_0x8654('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8654('0x4'));var attributes=require('./dashboardItem.attributes');module[_0x8654('0x5')]=function(_0x1b2d35,_0x3b6266){return _0x1b2d35[_0x8654('0x6')](_0x8654('0x7'),attributes,{'tableName':_0x8654('0x8'),'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 bf44ead..7e8a05c 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 _0x2624=['result','catch','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x2624,0x1e6));var _0x4262=function(_0x1d5a18,_0x11100b){_0x1d5a18=_0x1d5a18-0x0;var _0xaf1dca=_0x2624[_0x1d5a18];return _0xaf1dca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4262('0x0'));var BPromise=require(_0x4262('0x1'));var rs=require(_0x4262('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4262('0x3'));var logger=require('../../config/logger')(_0x4262('0x4'));var config=require(_0x4262('0x5'));var jayson=require(_0x4262('0x6'));var client=jayson['client'][_0x4262('0x7')]({'port':0x232a});config[_0x4262('0x8')]=_['defaults'](config[_0x4262('0x8')],{'host':_0x4262('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4262('0x8')]));require(_0x4262('0xa'))[_0x4262('0xb')](socket);function respondWithRpcPromise(_0x1d7ae3,_0x18c013,_0x3e7268){return new BPromise(function(_0x514eb8,_0x141c15){return client['request'](_0x1d7ae3,_0x3e7268)[_0x4262('0xc')](function(_0x381655){logger[_0x4262('0xd')](_0x4262('0xe'),_0x18c013,_0x4262('0xf'));logger['debug'](_0x4262('0x10'),_0x18c013,'request\x20sent',JSON[_0x4262('0x11')](_0x381655));if(_0x381655['error']){if(_0x381655[_0x4262('0x12')]['code']===0x1f4){logger[_0x4262('0x12')]('DashboardItem,\x20%s,\x20%s',_0x18c013,_0x381655[_0x4262('0x12')][_0x4262('0x13')]);return _0x141c15(_0x381655[_0x4262('0x12')][_0x4262('0x13')]);}logger[_0x4262('0x12')](_0x4262('0xe'),_0x18c013,_0x381655[_0x4262('0x12')]['message']);return _0x514eb8(_0x381655[_0x4262('0x12')][_0x4262('0x13')]);}else{logger['info'](_0x4262('0xe'),_0x18c013,'request\x20sent');_0x514eb8(_0x381655[_0x4262('0x14')]['message']);}})[_0x4262('0x15')](function(_0x2021be){logger[_0x4262('0x12')](_0x4262('0xe'),_0x18c013,_0x2021be);_0x141c15(_0x2021be);});});} \ No newline at end of file +var _0x1e1a=['../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x5b028b,_0x2c64ed){var _0x343bf2=function(_0x2b057d){while(--_0x2b057d){_0x5b028b['push'](_0x5b028b['shift']());}};_0x343bf2(++_0x2c64ed);}(_0x1e1a,0x1a8));var _0xa1e1=function(_0x1d98a7,_0x3c9405){_0x1d98a7=_0x1d98a7-0x0;var _0x3d573f=_0x1e1a[_0x1d98a7];return _0x3d573f;};'use strict';var _=require(_0xa1e1('0x0'));var util=require(_0xa1e1('0x1'));var moment=require(_0xa1e1('0x2'));var BPromise=require(_0xa1e1('0x3'));var rs=require(_0xa1e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1e1('0x5'));var logger=require(_0xa1e1('0x6'))(_0xa1e1('0x7'));var config=require(_0xa1e1('0x8'));var jayson=require(_0xa1e1('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xa1e1('0xa')]=_[_0xa1e1('0xb')](config[_0xa1e1('0xa')],{'host':_0xa1e1('0xc'),'port':0x18eb});var socket=require(_0xa1e1('0xd'))(new Redis(config[_0xa1e1('0xa')]));require('./dashboardItem.socket')[_0xa1e1('0xe')](socket);function respondWithRpcPromise(_0x1195a9,_0x22f21b,_0x34e895){return new BPromise(function(_0x5ae1b5,_0x1a6102){return client['request'](_0x1195a9,_0x34e895)['then'](function(_0x95029f){logger['info'](_0xa1e1('0xf'),_0x22f21b,_0xa1e1('0x10'));logger[_0xa1e1('0x11')](_0xa1e1('0x12'),_0x22f21b,_0xa1e1('0x10'),JSON['stringify'](_0x95029f));if(_0x95029f[_0xa1e1('0x13')]){if(_0x95029f['error'][_0xa1e1('0x14')]===0x1f4){logger['error'](_0xa1e1('0xf'),_0x22f21b,_0x95029f[_0xa1e1('0x13')][_0xa1e1('0x15')]);return _0x1a6102(_0x95029f[_0xa1e1('0x13')][_0xa1e1('0x15')]);}logger[_0xa1e1('0x13')](_0xa1e1('0xf'),_0x22f21b,_0x95029f[_0xa1e1('0x13')][_0xa1e1('0x15')]);return _0x5ae1b5(_0x95029f[_0xa1e1('0x13')][_0xa1e1('0x15')]);}else{logger[_0xa1e1('0x16')]('DashboardItem,\x20%s,\x20%s',_0x22f21b,_0xa1e1('0x10'));_0x5ae1b5(_0x95029f['result'][_0xa1e1('0x15')]);}})[_0xa1e1('0x17')](function(_0xf9d089){logger[_0xa1e1('0x13')]('DashboardItem,\x20%s,\x20%s',_0x22f21b,_0xf9d089);_0x1a6102(_0xf9d089);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 17d0201..65e4555 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 _0x00c6=['register','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x63755c,_0x5638e4){var _0x3c43ce=function(_0x2bf93c){while(--_0x2bf93c){_0x63755c['push'](_0x63755c['shift']());}};_0x3c43ce(++_0x5638e4);}(_0x00c6,0x1c2));var _0x600c=function(_0x309abd,_0x5e28f9){_0x309abd=_0x309abd-0x0;var _0x20e4c0=_0x00c6[_0x309abd];return _0x20e4c0;};'use strict';var DashboardItemEvents=require(_0x600c('0x0'));var events=[_0x600c('0x1'),_0x600c('0x2'),_0x600c('0x3')];function createListener(_0x31afcd,_0x1ee820){return function(_0x22e1ea){_0x1ee820[_0x600c('0x4')](_0x31afcd,_0x22e1ea);};}function removeListener(_0x2dd2f2,_0x48a2bd){return function(){DashboardItemEvents[_0x600c('0x5')](_0x2dd2f2,_0x48a2bd);};}exports[_0x600c('0x6')]=function(_0x4ed980){for(var _0x5e8af1=0x0,_0x1a69ad=events['length'];_0x5e8af1<_0x1a69ad;_0x5e8af1++){var _0x462196=events[_0x5e8af1];var _0x428095=createListener(_0x600c('0x7')+_0x462196,_0x4ed980);DashboardItemEvents['on'](_0x462196,_0x428095);}}; \ No newline at end of file +var _0xcefe=['save','remove','emit','register','dashboardItem:'];(function(_0x54bb36,_0x15cb28){var _0xc4175f=function(_0x41e26a){while(--_0x41e26a){_0x54bb36['push'](_0x54bb36['shift']());}};_0xc4175f(++_0x15cb28);}(_0xcefe,0x78));var _0xecef=function(_0x22e5a2,_0x24d072){_0x22e5a2=_0x22e5a2-0x0;var _0x500b45=_0xcefe[_0x22e5a2];return _0x500b45;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xecef('0x0'),_0xecef('0x1'),'update'];function createListener(_0x2a76d5,_0xbf074a){return function(_0x28cda1){_0xbf074a[_0xecef('0x2')](_0x2a76d5,_0x28cda1);};}function removeListener(_0x149ae5,_0x3668f5){return function(){DashboardItemEvents['removeListener'](_0x149ae5,_0x3668f5);};}exports[_0xecef('0x3')]=function(_0x25cd1d){for(var _0x5b02f4=0x0,_0x1727e3=events['length'];_0x5b02f4<_0x1727e3;_0x5b02f4++){var _0x367e4b=events[_0x5b02f4];var _0x4eca58=createListener(_0xecef('0x4')+_0x367e4b,_0x25cd1d);DashboardItemEvents['on'](_0x367e4b,_0x4eca58);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a84b311..ee3ecbc 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 _0xb0f3=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','update'];(function(_0xc23b5d,_0x4709f6){var _0x46a0e4=function(_0x3451a8){while(--_0x3451a8){_0xc23b5d['push'](_0xc23b5d['shift']());}};_0x46a0e4(++_0x4709f6);}(_0xb0f3,0xb7));var _0x3b0f=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0xb0f3[_0x33c9f8];return _0x2d7004;};'use strict';var multer=require(_0x3b0f('0x0'));var util=require(_0x3b0f('0x1'));var path=require(_0x3b0f('0x2'));var timeout=require(_0x3b0f('0x3'));var express=require(_0x3b0f('0x4'));var router=express['Router']();var fs_extra=require(_0x3b0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3b0f('0x6'));var config=require('../../config/environment');var controller=require(_0x3b0f('0x7'));router[_0x3b0f('0x8')](_0x3b0f('0x9'),auth[_0x3b0f('0xa')](),controller[_0x3b0f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b0f('0xc')]);router[_0x3b0f('0xd')](_0x3b0f('0x9'),auth['isAuthenticated'](),controller[_0x3b0f('0xe')]);router[_0x3b0f('0xf')]('/:id',auth[_0x3b0f('0xa')](),controller[_0x3b0f('0x10')]);module[_0x3b0f('0x11')]=router; \ No newline at end of file +var _0x0bfa=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','delete'];(function(_0x6a734c,_0x1b2d9f){var _0x494d0d=function(_0x36fd39){while(--_0x36fd39){_0x6a734c['push'](_0x6a734c['shift']());}};_0x494d0d(++_0x1b2d9f);}(_0x0bfa,0x134));var _0xa0bf=function(_0x5cb0a6,_0x503a20){_0x5cb0a6=_0x5cb0a6-0x0;var _0x49e7bf=_0x0bfa[_0x5cb0a6];return _0x49e7bf;};'use strict';var multer=require('multer');var util=require(_0xa0bf('0x0'));var path=require('path');var timeout=require(_0xa0bf('0x1'));var express=require('express');var router=express[_0xa0bf('0x2')]();var fs_extra=require(_0xa0bf('0x3'));var auth=require(_0xa0bf('0x4'));var interaction=require(_0xa0bf('0x5'));var config=require(_0xa0bf('0x6'));var controller=require(_0xa0bf('0x7'));router[_0xa0bf('0x8')](_0xa0bf('0x9'),auth[_0xa0bf('0xa')](),controller['show']);router[_0xa0bf('0xb')]('/',auth[_0xa0bf('0xa')](),controller[_0xa0bf('0xc')]);router[_0xa0bf('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa0bf('0xe')](_0xa0bf('0x9'),auth[_0xa0bf('0xa')](),controller[_0xa0bf('0xf')]);module[_0xa0bf('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 c2b8526..9b367c8 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 _0x53fd=['STRING','ENUM','first','third','sequelize','exports'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x53fd,0x112));var _0xd53f=function(_0x2ac255,_0x62dd05){_0x2ac255=_0x2ac255-0x0;var _0x8f79c=_0x53fd[_0x2ac255];return _0x8f79c;};'use strict';var Sequelize=require(_0xd53f('0x0'));module[_0xd53f('0x1')]={'name':{'type':Sequelize[_0xd53f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xd53f('0x3')](_0xd53f('0x4'),'second',_0xd53f('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa196=['sequelize','exports','STRING','ENUM'];(function(_0x14de96,_0x4c6ec4){var _0x29d86e=function(_0x40ad8b){while(--_0x40ad8b){_0x14de96['push'](_0x14de96['shift']());}};_0x29d86e(++_0x4c6ec4);}(_0xa196,0xe0));var _0x6a19=function(_0x699f,_0x1f1f6c){_0x699f=_0x699f-0x0;var _0x112fbb=_0xa196[_0x699f];return _0x112fbb;};'use strict';var Sequelize=require(_0x6a19('0x0'));module[_0x6a19('0x1')]={'name':{'type':Sequelize[_0x6a19('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x6a19('0x3')]('first','second','third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x6a19('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 4af781b..b58a667 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 _0xf2f7=['zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','length','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xf2f7,0xa3));var _0x7f2f=function(_0x5b4480,_0x2be168){_0x5b4480=_0x5b4480-0x0;var _0x4ac110=_0xf2f7[_0x5b4480];return _0x4ac110;};'use strict';var emlformat=require(_0x7f2f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f2f('0x2'));var BPromise=require(_0x7f2f('0x3'));var Mustache=require(_0x7f2f('0x4'));var util=require(_0x7f2f('0x5'));var path=require(_0x7f2f('0x6'));var sox=require(_0x7f2f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f2f('0x8'));var _=require(_0x7f2f('0x9'));var squel=require(_0x7f2f('0xa'));var crypto=require('crypto');var jsforce=require(_0x7f2f('0xb'));var deskjs=require(_0x7f2f('0xc'));var toCsv=require(_0x7f2f('0xd'));var querystring=require(_0x7f2f('0xe'));var Papa=require('papaparse');var Redis=require(_0x7f2f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7f2f('0x10'));var as=require(_0x7f2f('0x11'));var hardwareService=require(_0x7f2f('0x12'));var logger=require('../../config/logger')(_0x7f2f('0x13'));var utils=require(_0x7f2f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7f2f('0x15'));var db=require(_0x7f2f('0x16'))['db'];function respondWithStatusCode(_0x56e266,_0x34c24e){_0x34c24e=_0x34c24e||0xcc;return function(_0x4fca23){if(_0x4fca23){return _0x56e266[_0x7f2f('0x17')](_0x34c24e);}return _0x56e266[_0x7f2f('0x18')](_0x34c24e)[_0x7f2f('0x19')]();};}function respondWithResult(_0x1f6552,_0x2b0be5){_0x2b0be5=_0x2b0be5||0xc8;return function(_0x2cf126){if(_0x2cf126){return _0x1f6552[_0x7f2f('0x18')](_0x2b0be5)[_0x7f2f('0x1a')](_0x2cf126);}};}function respondWithFilteredResult(_0x2edb2c,_0x5aa33c){return function(_0x4a14f5){if(_0x4a14f5){var _0x264999=typeof _0x5aa33c[_0x7f2f('0x1b')]===_0x7f2f('0x1c')&&typeof _0x5aa33c[_0x7f2f('0x1d')]==='undefined';var _0x1aea47=_0x4a14f5[_0x7f2f('0x1e')];var _0x3a77a4=_0x264999?0x0:_0x5aa33c[_0x7f2f('0x1b')];var _0x21462e=_0x264999?_0x4a14f5[_0x7f2f('0x1e')]:_0x5aa33c[_0x7f2f('0x1b')]+_0x5aa33c['limit'];var _0xd6187e;if(_0x21462e>=_0x1aea47){_0x21462e=_0x1aea47;_0xd6187e=0xc8;}else{_0xd6187e=0xce;}_0x2edb2c[_0x7f2f('0x18')](_0xd6187e);return _0x2edb2c[_0x7f2f('0x1f')]('Content-Range',_0x3a77a4+'-'+_0x21462e+'/'+_0x1aea47)[_0x7f2f('0x1a')](_0x4a14f5);}return null;};}function patchUpdates(_0x1ca790){return function(_0x462154){try{jsonpatch[_0x7f2f('0x20')](_0x462154,_0x1ca790,!![]);}catch(_0x335876){return BPromise['reject'](_0x335876);}return _0x462154[_0x7f2f('0x21')]();};}function saveUpdates(_0x295aad,_0x13d5a3){return function(_0x49025f){if(_0x49025f){return _0x49025f[_0x7f2f('0x22')](_0x295aad)[_0x7f2f('0x23')](function(_0x5250f2){return _0x5250f2;});}return null;};}function removeEntity(_0x20710d,_0x5e428b){return function(_0x1c046d){if(_0x1c046d){return _0x1c046d[_0x7f2f('0x24')]()[_0x7f2f('0x23')](function(){var _0x26ae2c=_0x1c046d[_0x7f2f('0x25')]({'plain':!![]});var _0x2a0ae1=_0x7f2f('0x26');return db[_0x7f2f('0x27')]['destroy']({'where':{'type':_0x2a0ae1,'resourceId':_0x26ae2c['id']}})[_0x7f2f('0x23')](function(){return _0x1c046d;});})[_0x7f2f('0x23')](function(){_0x20710d[_0x7f2f('0x18')](0xcc)[_0x7f2f('0x19')]();});}};}function handleEntityNotFound(_0x2ee922,_0x25f89b){return function(_0x412b9a){if(!_0x412b9a){_0x2ee922[_0x7f2f('0x17')](0x194);}return _0x412b9a;};}function handleError(_0x1d4380,_0x58c4df){_0x58c4df=_0x58c4df||0x1f4;return function(_0x259451){logger[_0x7f2f('0x28')](_0x259451['stack']);if(_0x259451[_0x7f2f('0x29')]){delete _0x259451[_0x7f2f('0x29')];}_0x1d4380[_0x7f2f('0x18')](_0x58c4df)[_0x7f2f('0x2a')](_0x259451);};}exports['index']=function(_0x1adf9d,_0x37b4c8){var _0x5b6f0c={},_0x442395={},_0x12c139={'count':0x0,'rows':[]};var _0x21d779=_[_0x7f2f('0x2b')](db[_0x7f2f('0x2c')][_0x7f2f('0x2d')],function(_0x52459a){return{'name':_0x52459a[_0x7f2f('0x2e')],'type':_0x52459a['type'][_0x7f2f('0x2f')]};});_0x442395[_0x7f2f('0x30')]=_[_0x7f2f('0x2b')](_0x21d779,_0x7f2f('0x29'));_0x442395[_0x7f2f('0x31')]=_[_0x7f2f('0x32')](_0x1adf9d['query']);_0x442395['filters']=_[_0x7f2f('0x33')](_0x442395[_0x7f2f('0x30')],_0x442395['query']);_0x5b6f0c[_0x7f2f('0x34')]=_[_0x7f2f('0x33')](_0x442395['model'],qs['fields'](_0x1adf9d['query'][_0x7f2f('0x35')]));_0x5b6f0c[_0x7f2f('0x34')]=_0x5b6f0c[_0x7f2f('0x34')]['length']?_0x5b6f0c['attributes']:_0x442395[_0x7f2f('0x30')];if(!_0x1adf9d[_0x7f2f('0x31')]['hasOwnProperty'](_0x7f2f('0x36'))){_0x5b6f0c[_0x7f2f('0x1d')]=qs[_0x7f2f('0x1d')](_0x1adf9d[_0x7f2f('0x31')][_0x7f2f('0x1d')]);_0x5b6f0c[_0x7f2f('0x1b')]=qs[_0x7f2f('0x1b')](_0x1adf9d[_0x7f2f('0x31')][_0x7f2f('0x1b')]);}_0x5b6f0c[_0x7f2f('0x37')]=qs['sort'](_0x1adf9d[_0x7f2f('0x31')][_0x7f2f('0x38')]);_0x5b6f0c['where']=qs[_0x7f2f('0x39')](_[_0x7f2f('0x3a')](_0x1adf9d[_0x7f2f('0x31')],_0x442395[_0x7f2f('0x39')]),_0x21d779);if(_0x1adf9d[_0x7f2f('0x31')][_0x7f2f('0x3b')]){_0x5b6f0c['where']=_['merge'](_0x5b6f0c[_0x7f2f('0x3c')],{'$or':_[_0x7f2f('0x2b')](_0x21d779,function(_0x201226){if(_0x201226['type']!==_0x7f2f('0x3d')){var _0x4a1855={};_0x4a1855[_0x201226[_0x7f2f('0x29')]]={'$like':'%'+_0x1adf9d['query'][_0x7f2f('0x3b')]+'%'};return _0x4a1855;}})});}_0x5b6f0c=_[_0x7f2f('0x3e')]({},_0x5b6f0c,_0x1adf9d[_0x7f2f('0x3f')]);var _0x18217f={'where':_0x5b6f0c[_0x7f2f('0x3c')]};return db['Disposition'][_0x7f2f('0x1e')](_0x18217f)['then'](function(_0x204a7d){_0x12c139[_0x7f2f('0x1e')]=_0x204a7d;if(_0x1adf9d[_0x7f2f('0x31')][_0x7f2f('0x40')]){_0x5b6f0c[_0x7f2f('0x41')]=[{'all':!![]}];}return db[_0x7f2f('0x2c')][_0x7f2f('0x42')](_0x5b6f0c);})[_0x7f2f('0x23')](function(_0x3dbcf4){_0x12c139[_0x7f2f('0x43')]=_0x3dbcf4;return _0x12c139;})[_0x7f2f('0x23')](respondWithFilteredResult(_0x37b4c8,_0x5b6f0c))['catch'](handleError(_0x37b4c8,null));};exports[_0x7f2f('0x44')]=function(_0x42eaf0,_0x31337e){var _0xc4bee0={'raw':!![],'where':{'id':_0x42eaf0['params']['id']}},_0x204020={};_0x204020[_0x7f2f('0x30')]=_[_0x7f2f('0x32')](db[_0x7f2f('0x2c')]['rawAttributes']);_0x204020[_0x7f2f('0x31')]=_[_0x7f2f('0x32')](_0x42eaf0['query']);_0x204020[_0x7f2f('0x39')]=_[_0x7f2f('0x33')](_0x204020[_0x7f2f('0x30')],_0x204020['query']);_0xc4bee0['attributes']=_[_0x7f2f('0x33')](_0x204020[_0x7f2f('0x30')],qs[_0x7f2f('0x35')](_0x42eaf0['query'][_0x7f2f('0x35')]));_0xc4bee0[_0x7f2f('0x34')]=_0xc4bee0[_0x7f2f('0x34')][_0x7f2f('0x45')]?_0xc4bee0[_0x7f2f('0x34')]:_0x204020[_0x7f2f('0x30')];if(_0x42eaf0[_0x7f2f('0x31')][_0x7f2f('0x40')]){_0xc4bee0[_0x7f2f('0x41')]=[{'all':!![]}];}_0xc4bee0=_[_0x7f2f('0x3e')]({},_0xc4bee0,_0x42eaf0['options']);return db[_0x7f2f('0x2c')][_0x7f2f('0x46')](_0xc4bee0)['then'](handleEntityNotFound(_0x31337e,null))[_0x7f2f('0x23')](respondWithResult(_0x31337e,null))[_0x7f2f('0x47')](handleError(_0x31337e,null));};exports[_0x7f2f('0x48')]=function(_0x155453,_0x5eae7e){return db[_0x7f2f('0x2c')]['create'](_0x155453['body'],{})[_0x7f2f('0x23')](function(_0x4de409){var _0x29efce=_0x155453['user'][_0x7f2f('0x25')]({'plain':!![]});if(!_0x29efce)throw new Error(_0x7f2f('0x49'));if(_0x29efce[_0x7f2f('0x4a')]===_0x7f2f('0x4b')){var _0x12537a=_0x4de409[_0x7f2f('0x25')]({'plain':!![]});var _0x11ef5e=_0x7f2f('0x26');return db[_0x7f2f('0x4c')][_0x7f2f('0x46')]({'where':{'name':_0x11ef5e,'userProfileId':_0x29efce[_0x7f2f('0x4d')]},'raw':!![]})[_0x7f2f('0x23')](function(_0x15d725){if(_0x15d725&&_0x15d725[_0x7f2f('0x4e')]===0x0){return db[_0x7f2f('0x27')][_0x7f2f('0x48')]({'name':_0x12537a[_0x7f2f('0x29')],'resourceId':_0x12537a['id'],'type':_0x15d725[_0x7f2f('0x29')],'sectionId':_0x15d725['id']},{})['then'](function(){return _0x4de409;});}else{return _0x4de409;}})[_0x7f2f('0x47')](function(_0x3cf50c){logger['error'](_0x7f2f('0x4f'),_0x3cf50c);throw _0x3cf50c;});}return _0x4de409;})[_0x7f2f('0x23')](respondWithResult(_0x5eae7e,0xc9))[_0x7f2f('0x47')](handleError(_0x5eae7e,null));};exports[_0x7f2f('0x22')]=function(_0x5b9f44,_0x478ff0){if(_0x5b9f44[_0x7f2f('0x50')]['id']){delete _0x5b9f44[_0x7f2f('0x50')]['id'];}return db[_0x7f2f('0x2c')][_0x7f2f('0x46')]({'where':{'id':_0x5b9f44[_0x7f2f('0x51')]['id']}})[_0x7f2f('0x23')](handleEntityNotFound(_0x478ff0,null))[_0x7f2f('0x23')](saveUpdates(_0x5b9f44['body'],null))['then'](respondWithResult(_0x478ff0,null))['catch'](handleError(_0x478ff0,null));};exports[_0x7f2f('0x24')]=function(_0x61a033,_0x3d1715){return db[_0x7f2f('0x2c')][_0x7f2f('0x46')]({'where':{'id':_0x61a033[_0x7f2f('0x51')]['id']}})[_0x7f2f('0x23')](handleEntityNotFound(_0x3d1715,null))[_0x7f2f('0x23')](removeEntity(_0x3d1715,null))['catch'](handleError(_0x3d1715,null));}; \ No newline at end of file +var _0x4c41=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','Dispositions','sendStatus','stack','name','index','map','Disposition','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','include','findAll','rows','params','options','catch','create','body','user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse'];(function(_0xf83b3f,_0x2e0444){var _0x45246f=function(_0xbc636b){while(--_0xbc636b){_0xf83b3f['push'](_0xf83b3f['shift']());}};_0x45246f(++_0x2e0444);}(_0x4c41,0xda));var _0x14c4=function(_0x3a003a,_0x251949){_0x3a003a=_0x3a003a-0x0;var _0x13dc4c=_0x4c41[_0x3a003a];return _0x13dc4c;};'use strict';var emlformat=require(_0x14c4('0x0'));var rimraf=require(_0x14c4('0x1'));var zipdir=require(_0x14c4('0x2'));var jsonpatch=require(_0x14c4('0x3'));var rp=require(_0x14c4('0x4'));var moment=require('moment');var BPromise=require(_0x14c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x14c4('0x6'));var sox=require(_0x14c4('0x7'));var csv=require(_0x14c4('0x8'));var ejs=require(_0x14c4('0x9'));var fs=require('fs');var fs_extra=require(_0x14c4('0xa'));var _=require(_0x14c4('0xb'));var squel=require('squel');var crypto=require(_0x14c4('0xc'));var jsforce=require(_0x14c4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x14c4('0x8'));var querystring=require(_0x14c4('0xe'));var Papa=require(_0x14c4('0xf'));var Redis=require('ioredis');var authService=require(_0x14c4('0x10'));var qs=require(_0x14c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14c4('0x12'));var logger=require(_0x14c4('0x13'))(_0x14c4('0x14'));var utils=require(_0x14c4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x14c4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50d681,_0x330057){_0x330057=_0x330057||0xcc;return function(_0x527c1f){if(_0x527c1f){return _0x50d681['sendStatus'](_0x330057);}return _0x50d681[_0x14c4('0x17')](_0x330057)[_0x14c4('0x18')]();};}function respondWithResult(_0x5e2f0f,_0x380b5c){_0x380b5c=_0x380b5c||0xc8;return function(_0x2a212d){if(_0x2a212d){return _0x5e2f0f['status'](_0x380b5c)[_0x14c4('0x19')](_0x2a212d);}};}function respondWithFilteredResult(_0x468fec,_0x297116){return function(_0x42a787){if(_0x42a787){var _0x2b81c1=typeof _0x297116[_0x14c4('0x1a')]===_0x14c4('0x1b')&&typeof _0x297116['limit']==='undefined';var _0xde5694=_0x42a787[_0x14c4('0x1c')];var _0x2d5e39=_0x2b81c1?0x0:_0x297116[_0x14c4('0x1a')];var _0x177803=_0x2b81c1?_0x42a787['count']:_0x297116[_0x14c4('0x1a')]+_0x297116[_0x14c4('0x1d')];var _0x249f39;if(_0x177803>=_0xde5694){_0x177803=_0xde5694;_0x249f39=0xc8;}else{_0x249f39=0xce;}_0x468fec[_0x14c4('0x17')](_0x249f39);return _0x468fec[_0x14c4('0x1e')]('Content-Range',_0x2d5e39+'-'+_0x177803+'/'+_0xde5694)[_0x14c4('0x19')](_0x42a787);}return null;};}function patchUpdates(_0x5f240d){return function(_0x323d5e){try{jsonpatch[_0x14c4('0x1f')](_0x323d5e,_0x5f240d,!![]);}catch(_0x53434b){return BPromise[_0x14c4('0x20')](_0x53434b);}return _0x323d5e['save']();};}function saveUpdates(_0x7bd416,_0x7376e8){return function(_0x55ef16){if(_0x55ef16){return _0x55ef16[_0x14c4('0x21')](_0x7bd416)[_0x14c4('0x22')](function(_0x1233ad){return _0x1233ad;});}return null;};}function removeEntity(_0x41a606,_0x16b064){return function(_0x45a013){if(_0x45a013){return _0x45a013[_0x14c4('0x23')]()[_0x14c4('0x22')](function(){var _0x5717e8=_0x45a013[_0x14c4('0x24')]({'plain':!![]});var _0x623062=_0x14c4('0x25');return db['UserProfileResource'][_0x14c4('0x23')]({'where':{'type':_0x623062,'resourceId':_0x5717e8['id']}})['then'](function(){return _0x45a013;});})[_0x14c4('0x22')](function(){_0x41a606[_0x14c4('0x17')](0xcc)[_0x14c4('0x18')]();});}};}function handleEntityNotFound(_0xb482c5,_0x479b1d){return function(_0x229d49){if(!_0x229d49){_0xb482c5[_0x14c4('0x26')](0x194);}return _0x229d49;};}function handleError(_0x2c5378,_0x521c77){_0x521c77=_0x521c77||0x1f4;return function(_0x941859){logger['error'](_0x941859[_0x14c4('0x27')]);if(_0x941859[_0x14c4('0x28')]){delete _0x941859[_0x14c4('0x28')];}_0x2c5378['status'](_0x521c77)['send'](_0x941859);};}exports[_0x14c4('0x29')]=function(_0x4ebcb4,_0x33a816){var _0x2abde8={},_0x181b32={},_0x2f7dbb={'count':0x0,'rows':[]};var _0x58e174=_[_0x14c4('0x2a')](db[_0x14c4('0x2b')][_0x14c4('0x2c')],function(_0x39d02b){return{'name':_0x39d02b[_0x14c4('0x2d')],'type':_0x39d02b[_0x14c4('0x2e')]['key']};});_0x181b32['model']=_[_0x14c4('0x2a')](_0x58e174,'name');_0x181b32[_0x14c4('0x2f')]=_[_0x14c4('0x30')](_0x4ebcb4['query']);_0x181b32[_0x14c4('0x31')]=_[_0x14c4('0x32')](_0x181b32[_0x14c4('0x33')],_0x181b32[_0x14c4('0x2f')]);_0x2abde8[_0x14c4('0x34')]=_[_0x14c4('0x32')](_0x181b32[_0x14c4('0x33')],qs['fields'](_0x4ebcb4[_0x14c4('0x2f')]['fields']));_0x2abde8[_0x14c4('0x34')]=_0x2abde8[_0x14c4('0x34')][_0x14c4('0x35')]?_0x2abde8[_0x14c4('0x34')]:_0x181b32[_0x14c4('0x33')];if(!_0x4ebcb4[_0x14c4('0x2f')][_0x14c4('0x36')](_0x14c4('0x37'))){_0x2abde8[_0x14c4('0x1d')]=qs[_0x14c4('0x1d')](_0x4ebcb4[_0x14c4('0x2f')][_0x14c4('0x1d')]);_0x2abde8[_0x14c4('0x1a')]=qs[_0x14c4('0x1a')](_0x4ebcb4[_0x14c4('0x2f')]['offset']);}_0x2abde8[_0x14c4('0x38')]=qs['sort'](_0x4ebcb4['query']['sort']);_0x2abde8[_0x14c4('0x39')]=qs[_0x14c4('0x31')](_[_0x14c4('0x3a')](_0x4ebcb4[_0x14c4('0x2f')],_0x181b32['filters']),_0x58e174);if(_0x4ebcb4[_0x14c4('0x2f')][_0x14c4('0x3b')]){_0x2abde8[_0x14c4('0x39')]=_[_0x14c4('0x3c')](_0x2abde8['where'],{'$or':_[_0x14c4('0x2a')](_0x58e174,function(_0xc64b6a){if(_0xc64b6a[_0x14c4('0x2e')]!=='VIRTUAL'){var _0x3dff80={};_0x3dff80[_0xc64b6a[_0x14c4('0x28')]]={'$like':'%'+_0x4ebcb4[_0x14c4('0x2f')][_0x14c4('0x3b')]+'%'};return _0x3dff80;}})});}_0x2abde8=_[_0x14c4('0x3c')]({},_0x2abde8,_0x4ebcb4['options']);var _0x1f7e94={'where':_0x2abde8[_0x14c4('0x39')]};return db[_0x14c4('0x2b')][_0x14c4('0x1c')](_0x1f7e94)[_0x14c4('0x22')](function(_0x146f5a){_0x2f7dbb['count']=_0x146f5a;if(_0x4ebcb4[_0x14c4('0x2f')][_0x14c4('0x3d')]){_0x2abde8[_0x14c4('0x3e')]=[{'all':!![]}];}return db[_0x14c4('0x2b')][_0x14c4('0x3f')](_0x2abde8);})[_0x14c4('0x22')](function(_0x9d5a13){_0x2f7dbb[_0x14c4('0x40')]=_0x9d5a13;return _0x2f7dbb;})['then'](respondWithFilteredResult(_0x33a816,_0x2abde8))['catch'](handleError(_0x33a816,null));};exports['show']=function(_0x406796,_0x2279b6){var _0x1d04ab={'raw':!![],'where':{'id':_0x406796[_0x14c4('0x41')]['id']}},_0x158694={};_0x158694[_0x14c4('0x33')]=_['keys'](db[_0x14c4('0x2b')]['rawAttributes']);_0x158694[_0x14c4('0x2f')]=_[_0x14c4('0x30')](_0x406796['query']);_0x158694[_0x14c4('0x31')]=_['intersection'](_0x158694[_0x14c4('0x33')],_0x158694['query']);_0x1d04ab[_0x14c4('0x34')]=_[_0x14c4('0x32')](_0x158694['model'],qs['fields'](_0x406796[_0x14c4('0x2f')]['fields']));_0x1d04ab[_0x14c4('0x34')]=_0x1d04ab[_0x14c4('0x34')][_0x14c4('0x35')]?_0x1d04ab[_0x14c4('0x34')]:_0x158694[_0x14c4('0x33')];if(_0x406796[_0x14c4('0x2f')]['includeAll']){_0x1d04ab[_0x14c4('0x3e')]=[{'all':!![]}];}_0x1d04ab=_[_0x14c4('0x3c')]({},_0x1d04ab,_0x406796[_0x14c4('0x42')]);return db['Disposition']['find'](_0x1d04ab)[_0x14c4('0x22')](handleEntityNotFound(_0x2279b6,null))[_0x14c4('0x22')](respondWithResult(_0x2279b6,null))[_0x14c4('0x43')](handleError(_0x2279b6,null));};exports[_0x14c4('0x44')]=function(_0x3a2a67,_0x5323b8){return db['Disposition']['create'](_0x3a2a67[_0x14c4('0x45')],{})[_0x14c4('0x22')](function(_0x1a51bd){var _0x4d1440=_0x3a2a67[_0x14c4('0x46')][_0x14c4('0x24')]({'plain':!![]});if(!_0x4d1440)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d1440[_0x14c4('0x47')]===_0x14c4('0x46')){var _0x3577e0=_0x1a51bd[_0x14c4('0x24')]({'plain':!![]});var _0x4e64ae=_0x14c4('0x25');return db[_0x14c4('0x48')][_0x14c4('0x49')]({'where':{'name':_0x4e64ae,'userProfileId':_0x4d1440['userProfileId']},'raw':!![]})[_0x14c4('0x22')](function(_0x5b459b){if(_0x5b459b&&_0x5b459b[_0x14c4('0x4a')]===0x0){return db[_0x14c4('0x4b')]['create']({'name':_0x3577e0[_0x14c4('0x28')],'resourceId':_0x3577e0['id'],'type':_0x5b459b[_0x14c4('0x28')],'sectionId':_0x5b459b['id']},{})['then'](function(){return _0x1a51bd;});}else{return _0x1a51bd;}})[_0x14c4('0x43')](function(_0x2eb3d5){logger[_0x14c4('0x4c')](_0x14c4('0x4d'),_0x2eb3d5);throw _0x2eb3d5;});}return _0x1a51bd;})['then'](respondWithResult(_0x5323b8,0xc9))['catch'](handleError(_0x5323b8,null));};exports['update']=function(_0x38f196,_0x3c62db){if(_0x38f196['body']['id']){delete _0x38f196['body']['id'];}return db[_0x14c4('0x2b')][_0x14c4('0x49')]({'where':{'id':_0x38f196[_0x14c4('0x41')]['id']}})[_0x14c4('0x22')](handleEntityNotFound(_0x3c62db,null))[_0x14c4('0x22')](saveUpdates(_0x38f196['body'],null))['then'](respondWithResult(_0x3c62db,null))[_0x14c4('0x43')](handleError(_0x3c62db,null));};exports[_0x14c4('0x23')]=function(_0x330de2,_0x2d6f24){return db[_0x14c4('0x2b')][_0x14c4('0x49')]({'where':{'id':_0x330de2[_0x14c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d6f24,null))[_0x14c4('0x22')](removeEntity(_0x2d6f24,null))['catch'](handleError(_0x2d6f24,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a4db00d..b2316ce 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 _0xee4c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee4c,0x1cc));var _0xcee4=function(_0x3c26cc,_0xc3aa5f){_0x3c26cc=_0x3c26cc-0x0;var _0x3d918f=_0xee4c[_0x3c26cc];return _0x3d918f;};'use strict';var _=require(_0xcee4('0x0'));var util=require(_0xcee4('0x1'));var logger=require('../../config/logger')(_0xcee4('0x2'));var moment=require(_0xcee4('0x3'));var BPromise=require(_0xcee4('0x4'));var rp=require(_0xcee4('0x5'));var fs=require('fs');var path=require(_0xcee4('0x6'));var rimraf=require(_0xcee4('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xcee4('0x8')]=function(_0x5ec5b8,_0x470f9f){return _0x5ec5b8[_0xcee4('0x9')](_0xcee4('0xa'),attributes,{'tableName':_0xcee4('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xcee4('0xc'),'fields':[_0xcee4('0xd'),'ListId']},{'unique':!![],'name':_0xcee4('0xe'),'fields':['name',_0xcee4('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0xcee4('0xd'),'MailAccountId']},{'unique':!![],'name':_0xcee4('0x10'),'fields':[_0xcee4('0xd'),_0xcee4('0x11')]},{'unique':!![],'name':_0xcee4('0x12'),'fields':[_0xcee4('0xd'),'FaxAccountId']},{'unique':!![],'name':_0xcee4('0x13'),'fields':[_0xcee4('0xd'),_0xcee4('0x14')]},{'unique':!![],'name':_0xcee4('0x15'),'fields':[_0xcee4('0xd'),_0xcee4('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaee1=['FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','define','Disposition','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','name_sms'];(function(_0x468837,_0x5f0a68){var _0x7c161e=function(_0x340946){while(--_0x340946){_0x468837['push'](_0x468837['shift']());}};_0x7c161e(++_0x5f0a68);}(_0xaee1,0x12f));var _0x1aee=function(_0x15c57e,_0x5c766e){_0x15c57e=_0x15c57e-0x0;var _0x26034a=_0xaee1[_0x15c57e];return _0x26034a;};'use strict';var _=require(_0x1aee('0x0'));var util=require('util');var logger=require(_0x1aee('0x1'))('api');var moment=require(_0x1aee('0x2'));var BPromise=require(_0x1aee('0x3'));var rp=require(_0x1aee('0x4'));var fs=require('fs');var path=require(_0x1aee('0x5'));var rimraf=require(_0x1aee('0x6'));var config=require('../../config/environment');var attributes=require(_0x1aee('0x7'));module['exports']=function(_0x557814,_0x132e49){return _0x557814[_0x1aee('0x8')](_0x1aee('0x9'),attributes,{'tableName':_0x1aee('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x1aee('0xb'),_0x1aee('0xc')]},{'unique':!![],'name':_0x1aee('0xd'),'fields':[_0x1aee('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0x1aee('0xe'),'fields':[_0x1aee('0xb'),_0x1aee('0xf')]},{'unique':!![],'name':_0x1aee('0x10'),'fields':[_0x1aee('0xb'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0x1aee('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0x1aee('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x1aee('0x12'),'fields':[_0x1aee('0xb'),_0x1aee('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0792eff..360321c 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(_0x4fe872,_0xe248c2){var _0x45aabd=function(_0x2c873a){while(--_0x2c873a){_0x4fe872['push'](_0x4fe872['shift']());}};_0x45aabd(++_0xe248c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x42a3cc,_0x1b205a){var _0x572a91=function(_0x246e44){while(--_0x246e44){_0x42a3cc['push'](_0x42a3cc['shift']());}};_0x572a91(++_0x1b205a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 e8dd7f7..6393651 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 _0x3f35=['index','/:id','show','post','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x18b9a8,_0x1770b6){var _0x4a0a8f=function(_0x80ea93){while(--_0x80ea93){_0x18b9a8['push'](_0x18b9a8['shift']());}};_0x4a0a8f(++_0x1770b6);}(_0x3f35,0x90));var _0x53f3=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x3f35[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x53f3('0x2'));var router=express[_0x53f3('0x3')]();var fs_extra=require(_0x53f3('0x4'));var auth=require(_0x53f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x53f3('0x6'));var controller=require('./disposition.controller');router[_0x53f3('0x7')]('/',auth[_0x53f3('0x8')](),controller[_0x53f3('0x9')]);router['get'](_0x53f3('0xa'),auth[_0x53f3('0x8')](),controller[_0x53f3('0xb')]);router[_0x53f3('0xc')]('/',auth[_0x53f3('0x8')](),controller['create']);router[_0x53f3('0xd')](_0x53f3('0xa'),auth[_0x53f3('0x8')](),controller[_0x53f3('0xe')]);router['delete'](_0x53f3('0xa'),auth[_0x53f3('0x8')](),controller[_0x53f3('0xf')]);module[_0x53f3('0x10')]=router; \ No newline at end of file +var _0xea08=['./disposition.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4bcde3,_0x530cec){var _0x211c47=function(_0x33a604){while(--_0x33a604){_0x4bcde3['push'](_0x4bcde3['shift']());}};_0x211c47(++_0x530cec);}(_0xea08,0x1af));var _0x8ea0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xea08[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x8ea0('0x0'));var util=require(_0x8ea0('0x1'));var path=require(_0x8ea0('0x2'));var timeout=require(_0x8ea0('0x3'));var express=require(_0x8ea0('0x4'));var router=express[_0x8ea0('0x5')]();var fs_extra=require(_0x8ea0('0x6'));var auth=require(_0x8ea0('0x7'));var interaction=require(_0x8ea0('0x8'));var config=require(_0x8ea0('0x9'));var controller=require(_0x8ea0('0xa'));router['get']('/',auth[_0x8ea0('0xb')](),controller['index']);router[_0x8ea0('0xc')](_0x8ea0('0xd'),auth[_0x8ea0('0xb')](),controller[_0x8ea0('0xe')]);router['post']('/',auth[_0x8ea0('0xb')](),controller[_0x8ea0('0xf')]);router[_0x8ea0('0x10')](_0x8ea0('0xd'),auth[_0x8ea0('0xb')](),controller[_0x8ea0('0x11')]);router[_0x8ea0('0x12')](_0x8ea0('0xd'),auth[_0x8ea0('0xb')](),controller[_0x8ea0('0x13')]);module[_0x8ea0('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 53cb6db..1cfd617 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 _0x3a3d=['SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDisposition','sequelize','STRING','yes','localstationid','ENUM','2400','4800','9600','12000','14400','v17,v27,v29','INTEGER'];(function(_0x3e59c2,_0x4c6d36){var _0x16cc92=function(_0x494973){while(--_0x494973){_0x3e59c2['push'](_0x3e59c2['shift']());}};_0x16cc92(++_0x4c6d36);}(_0x3a3d,0xb1));var _0xd3a3=function(_0x5ccfa7,_0x54d55f){_0x5ccfa7=_0x5ccfa7-0x0;var _0x456801=_0x3a3d[_0x5ccfa7];return _0x456801;};'use strict';var Sequelize=require(_0xd3a3('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3a3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xd3a3('0x2')},'headerinfo':{'type':Sequelize[_0xd3a3('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xd3a3('0x1')],'unique':_0xd3a3('0x3')},'minrate':{'type':Sequelize[_0xd3a3('0x4')](_0xd3a3('0x5'),_0xd3a3('0x6'),'7200',_0xd3a3('0x7'),_0xd3a3('0x8'),_0xd3a3('0x9')),'defaultValue':_0xd3a3('0x6')},'maxrate':{'type':Sequelize['ENUM']('2400','4800','7200',_0xd3a3('0x7'),_0xd3a3('0x8'),_0xd3a3('0x9')),'defaultValue':_0xd3a3('0x9')},'modem':{'type':Sequelize[_0xd3a3('0x1')],'defaultValue':_0xd3a3('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd3a3('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd3a3('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd3a3('0x4')](_0xd3a3('0xc'),_0xd3a3('0xd'),_0xd3a3('0xe'),_0xd3a3('0xf')),'defaultValue':_0xd3a3('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd3a3('0x10')],'defaultValue':function(){return _0xd3a3('0x11');}},'notificationSound':{'type':Sequelize[_0xd3a3('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd3a3('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd3a3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd3a3('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd3a3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd3a3('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd3a3('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1c18d5){if(!_0x1c18d5)this[_0xd3a3('0x13')]('mandatoryDispositionPauseId',null);this[_0xd3a3('0x13')](_0xd3a3('0x14'),_0x1c18d5);}}}; \ No newline at end of file +var _0xf0db=['exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','9600','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x5d2cd0,_0x550d1e){var _0x441b98=function(_0x46ac3b){while(--_0x46ac3b){_0x5d2cd0['push'](_0x5d2cd0['shift']());}};_0x441b98(++_0x550d1e);}(_0xf0db,0x12b));var _0xbf0d=function(_0x5d7e04,_0xa140){_0x5d7e04=_0x5d7e04-0x0;var _0x179210=_0xf0db[_0x5d7e04];return _0x179210;};'use strict';var Sequelize=require(_0xbf0d('0x0'));module[_0xbf0d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbf0d('0x2')]},'ecm':{'type':Sequelize[_0xbf0d('0x3')](_0xbf0d('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xbf0d('0x2')],'defaultValue':_0xbf0d('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xbf0d('0x3')](_0xbf0d('0x6'),_0xbf0d('0x7'),_0xbf0d('0x8'),'9600',_0xbf0d('0x9'),_0xbf0d('0xa')),'defaultValue':_0xbf0d('0x7')},'maxrate':{'type':Sequelize[_0xbf0d('0x3')](_0xbf0d('0x6'),_0xbf0d('0x7'),_0xbf0d('0x8'),_0xbf0d('0xb'),'12000','14400'),'defaultValue':_0xbf0d('0xa')},'modem':{'type':Sequelize[_0xbf0d('0x2')],'defaultValue':_0xbf0d('0xc')},'gateway':{'type':Sequelize[_0xbf0d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbf0d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbf0d('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbf0d('0x3')](_0xbf0d('0xe'),'IAX',_0xbf0d('0xf'),_0xbf0d('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xbf0d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbf0d('0x11')],'defaultValue':function(){return _0xbf0d('0x12');}},'notificationSound':{'type':Sequelize[_0xbf0d('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf0d('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf0d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbf0d('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf0d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf0d('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf0d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf0d('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xbf0d('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xbf0d('0x13')],'defaultValue':![],'comment':_0xbf0d('0x15'),'set':function(_0x523802){if(!_0x523802)this[_0xbf0d('0x16')](_0xbf0d('0x17'),null);this[_0xbf0d('0x16')](_0xbf0d('0x18'),_0x523802);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 80449d5..6dcdbf2 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 _0x77af=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','FaxAccounts','UserProfileResource','status','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','show','params','include','catch','create','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addInteraction','getInteractions','FaxInteraction','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','json','getApplications','context','from-voip-provider','app','appdata','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','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','VoiceExtension','bulkCreate','updateAccountApplications','omit','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','root','basename','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','CmContact','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x279ce4,_0x13a3c8){var _0x3e8bcd=function(_0x122463){while(--_0x122463){_0x279ce4['push'](_0x279ce4['shift']());}};_0x3e8bcd(++_0x13a3c8);}(_0x77af,0xb3));var _0xf77a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x77af[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xf77a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf77a('0x1'));var jsonpatch=require(_0xf77a('0x2'));var rp=require(_0xf77a('0x3'));var moment=require(_0xf77a('0x4'));var BPromise=require(_0xf77a('0x5'));var Mustache=require(_0xf77a('0x6'));var util=require(_0xf77a('0x7'));var path=require('path');var sox=require(_0xf77a('0x8'));var csv=require('to-csv');var ejs=require(_0xf77a('0x9'));var fs=require('fs');var fs_extra=require(_0xf77a('0xa'));var _=require(_0xf77a('0xb'));var squel=require('squel');var crypto=require(_0xf77a('0xc'));var jsforce=require(_0xf77a('0xd'));var deskjs=require(_0xf77a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf77a('0xf'));var Papa=require(_0xf77a('0x10'));var Redis=require(_0xf77a('0x11'));var authService=require(_0xf77a('0x12'));var qs=require(_0xf77a('0x13'));var as=require(_0xf77a('0x14'));var hardwareService=require(_0xf77a('0x15'));var logger=require(_0xf77a('0x16'))(_0xf77a('0x17'));var utils=require(_0xf77a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf77a('0x19'));var db=require(_0xf77a('0x1a'))['db'];config[_0xf77a('0x1b')]=_[_0xf77a('0x1c')](config[_0xf77a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf77a('0x1d'))(new Redis(config['redis']));require(_0xf77a('0x1e'))[_0xf77a('0x1f')](socket);var jayson=require(_0xf77a('0x20'));var client=jayson[_0xf77a('0x21')][_0xf77a('0x22')]({'port':0x232c});var client9002=jayson[_0xf77a('0x21')][_0xf77a('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x575d6f,_0x5be08e,_0x135934,_0x393205){return new BPromise(function(_0x156efb,_0x266d95){var _0x247606=_0x393205||client;return _0x247606['request'](_0x575d6f,_0x135934)[_0xf77a('0x23')](function(_0xf2e605){logger[_0xf77a('0x24')](_0xf77a('0x25'),_0x5be08e,_0xf77a('0x26'));logger['debug'](_0xf77a('0x27'),_0x5be08e,_0xf77a('0x26'),JSON[_0xf77a('0x28')](_0xf2e605));if(_0xf2e605[_0xf77a('0x29')]){if(_0xf2e605[_0xf77a('0x29')][_0xf77a('0x2a')]===0x1f4){logger[_0xf77a('0x29')](_0xf77a('0x25'),_0x5be08e,_0xf2e605[_0xf77a('0x29')][_0xf77a('0x2b')]);return _0x266d95(_0xf2e605['error'][_0xf77a('0x2b')]);}logger[_0xf77a('0x29')](_0xf77a('0x25'),_0x5be08e,_0xf2e605[_0xf77a('0x29')]['message']);return _0x156efb(_0xf2e605['error'][_0xf77a('0x2b')]);}else{logger[_0xf77a('0x24')]('FaxAccount,\x20%s,\x20%s',_0x5be08e,_0xf77a('0x26'));_0x156efb(_0xf2e605[_0xf77a('0x2c')][_0xf77a('0x2b')]);}})['catch'](function(_0xb5af82){logger[_0xf77a('0x29')](_0xf77a('0x25'),_0x5be08e,_0xb5af82);_0x266d95(_0xb5af82);});});}function respondWithStatusCode(_0x555cda,_0x4d3a97){_0x4d3a97=_0x4d3a97||0xcc;return function(_0x2e4751){if(_0x2e4751){return _0x555cda[_0xf77a('0x2d')](_0x4d3a97);}return _0x555cda['status'](_0x4d3a97)[_0xf77a('0x2e')]();};}function respondWithResult(_0x357bae,_0x41ecca){_0x41ecca=_0x41ecca||0xc8;return function(_0x58051d){if(_0x58051d){return _0x357bae['status'](_0x41ecca)['json'](_0x58051d);}};}function respondWithFilteredResult(_0x1aa83e,_0x5b942a){return function(_0x2f58fa){if(_0x2f58fa){var _0x320094=typeof _0x5b942a['offset']===_0xf77a('0x2f')&&typeof _0x5b942a[_0xf77a('0x30')]==='undefined';var _0x4d9244=_0x2f58fa[_0xf77a('0x31')];var _0x1ec1bf=_0x320094?0x0:_0x5b942a[_0xf77a('0x32')];var _0x528748=_0x320094?_0x2f58fa[_0xf77a('0x31')]:_0x5b942a[_0xf77a('0x32')]+_0x5b942a[_0xf77a('0x30')];var _0x21b71a;if(_0x528748>=_0x4d9244){_0x528748=_0x4d9244;_0x21b71a=0xc8;}else{_0x21b71a=0xce;}_0x1aa83e['status'](_0x21b71a);return _0x1aa83e[_0xf77a('0x33')](_0xf77a('0x34'),_0x1ec1bf+'-'+_0x528748+'/'+_0x4d9244)['json'](_0x2f58fa);}return null;};}function patchUpdates(_0x5d73b7){return function(_0x23f85d){try{jsonpatch['apply'](_0x23f85d,_0x5d73b7,!![]);}catch(_0x5abd0f){return BPromise[_0xf77a('0x35')](_0x5abd0f);}return _0x23f85d['save']();};}function saveUpdates(_0x1e7ee0,_0x4e223f){return function(_0x19a004){if(_0x19a004){return _0x19a004[_0xf77a('0x36')](_0x1e7ee0)[_0xf77a('0x23')](function(_0x323907){return _0x323907;});}return null;};}function removeEntity(_0x50fd07,_0x3251da){return function(_0x14620b){if(_0x14620b){return _0x14620b[_0xf77a('0x37')]()['then'](function(){var _0x21a017=_0x14620b['get']({'plain':!![]});var _0x4d083c=_0xf77a('0x38');return db[_0xf77a('0x39')][_0xf77a('0x37')]({'where':{'type':_0x4d083c,'resourceId':_0x21a017['id']}})[_0xf77a('0x23')](function(){return _0x14620b;});})[_0xf77a('0x23')](function(){_0x50fd07[_0xf77a('0x3a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2af16,_0x423f82){return function(_0x119007){if(!_0x119007){_0xd2af16[_0xf77a('0x2d')](0x194);}return _0x119007;};}function handleError(_0x5464ba,_0x196737){_0x196737=_0x196737||0x1f4;return function(_0x1d7a45){logger[_0xf77a('0x29')](_0x1d7a45[_0xf77a('0x3b')]);if(_0x1d7a45['name']){delete _0x1d7a45[_0xf77a('0x3c')];}_0x5464ba[_0xf77a('0x3a')](_0x196737)[_0xf77a('0x3d')](_0x1d7a45);};}exports[_0xf77a('0x3e')]=function(_0xee30fb,_0x250e39){var _0x1ad5d1={'include':[{'model':db[_0xf77a('0x3f')],'as':_0xf77a('0x40')}]},_0x250f5d={},_0x4b5cb7={'count':0x0,'rows':[]};var _0x59a5b7=_[_0xf77a('0x41')](db[_0xf77a('0x42')][_0xf77a('0x43')],function(_0x396a45){return{'name':_0x396a45[_0xf77a('0x44')],'type':_0x396a45[_0xf77a('0x45')][_0xf77a('0x46')]};});_0x250f5d[_0xf77a('0x47')]=_['map'](_0x59a5b7,'name');_0x250f5d['query']=_[_0xf77a('0x48')](_0xee30fb[_0xf77a('0x49')]);_0x250f5d[_0xf77a('0x4a')]=_[_0xf77a('0x4b')](_0x250f5d[_0xf77a('0x47')],_0x250f5d[_0xf77a('0x49')]);_0x1ad5d1['attributes']=_[_0xf77a('0x4b')](_0x250f5d[_0xf77a('0x47')],qs[_0xf77a('0x4c')](_0xee30fb[_0xf77a('0x49')][_0xf77a('0x4c')]));_0x1ad5d1[_0xf77a('0x4d')]=_0x1ad5d1['attributes'][_0xf77a('0x4e')]?_0x1ad5d1['attributes']:_0x250f5d[_0xf77a('0x47')];if(!_0xee30fb[_0xf77a('0x49')][_0xf77a('0x4f')](_0xf77a('0x50'))){_0x1ad5d1[_0xf77a('0x30')]=qs[_0xf77a('0x30')](_0xee30fb[_0xf77a('0x49')][_0xf77a('0x30')]);_0x1ad5d1['offset']=qs[_0xf77a('0x32')](_0xee30fb[_0xf77a('0x49')]['offset']);}_0x1ad5d1[_0xf77a('0x51')]=qs[_0xf77a('0x52')](_0xee30fb['query'][_0xf77a('0x52')]);_0x1ad5d1['where']=qs[_0xf77a('0x4a')](_[_0xf77a('0x53')](_0xee30fb['query'],_0x250f5d[_0xf77a('0x4a')]),_0x59a5b7);if(_0xee30fb[_0xf77a('0x49')][_0xf77a('0x54')]){_0x1ad5d1[_0xf77a('0x55')]=_[_0xf77a('0x56')](_0x1ad5d1[_0xf77a('0x55')],{'$or':_[_0xf77a('0x41')](_0x59a5b7,function(_0x3fcda8){if(_0x3fcda8[_0xf77a('0x45')]!=='VIRTUAL'){var _0x469fca={};_0x469fca[_0x3fcda8[_0xf77a('0x3c')]]={'$like':'%'+_0xee30fb[_0xf77a('0x49')]['filter']+'%'};return _0x469fca;}})});}_0x1ad5d1=_[_0xf77a('0x56')]({},_0x1ad5d1,_0xee30fb[_0xf77a('0x57')]);var _0x3d3c76={'where':_0x1ad5d1[_0xf77a('0x55')]};return db[_0xf77a('0x42')]['count'](_0x3d3c76)['then'](function(_0x175e98){_0x4b5cb7[_0xf77a('0x31')]=_0x175e98;if(_0xee30fb[_0xf77a('0x49')][_0xf77a('0x58')]){_0x1ad5d1['include']=[{'all':!![]}];}return db[_0xf77a('0x42')]['findAll'](_0x1ad5d1);})[_0xf77a('0x23')](function(_0x209a91){_0x4b5cb7[_0xf77a('0x59')]=_0x209a91;return _0x4b5cb7;})[_0xf77a('0x23')](respondWithFilteredResult(_0x250e39,_0x1ad5d1))['catch'](handleError(_0x250e39,null));};exports[_0xf77a('0x5a')]=function(_0x5bf2f5,_0x529b91){var _0x599d54={'raw':![],'where':{'id':_0x5bf2f5[_0xf77a('0x5b')]['id']},'include':[{'model':db[_0xf77a('0x3f')],'as':_0xf77a('0x40')}]},_0x2e2361={};_0x2e2361['model']=_[_0xf77a('0x48')](db[_0xf77a('0x42')][_0xf77a('0x43')]);_0x2e2361['query']=_[_0xf77a('0x48')](_0x5bf2f5[_0xf77a('0x49')]);_0x2e2361[_0xf77a('0x4a')]=_[_0xf77a('0x4b')](_0x2e2361[_0xf77a('0x47')],_0x2e2361[_0xf77a('0x49')]);_0x599d54['attributes']=_['intersection'](_0x2e2361[_0xf77a('0x47')],qs[_0xf77a('0x4c')](_0x5bf2f5[_0xf77a('0x49')][_0xf77a('0x4c')]));_0x599d54[_0xf77a('0x4d')]=_0x599d54[_0xf77a('0x4d')]['length']?_0x599d54[_0xf77a('0x4d')]:_0x2e2361[_0xf77a('0x47')];if(_0x5bf2f5[_0xf77a('0x49')][_0xf77a('0x58')]){_0x599d54[_0xf77a('0x5c')]=[{'all':!![]}];}_0x599d54=_[_0xf77a('0x56')]({},_0x599d54,_0x5bf2f5[_0xf77a('0x57')]);return db['FaxAccount']['find'](_0x599d54)['then'](handleEntityNotFound(_0x529b91,null))[_0xf77a('0x23')](respondWithResult(_0x529b91,null))[_0xf77a('0x5d')](handleError(_0x529b91,null));};exports[_0xf77a('0x5e')]=function(_0x321e23,_0x42730e){return db[_0xf77a('0x42')][_0xf77a('0x5e')](_0x321e23['body'],{})[_0xf77a('0x23')](function(_0x4eb36c){var _0x162934=_0x321e23[_0xf77a('0x5f')][_0xf77a('0x60')]({'plain':!![]});if(!_0x162934)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x162934[_0xf77a('0x61')]===_0xf77a('0x5f')){var _0x317256=_0x4eb36c['get']({'plain':!![]});var _0x18bdb9=_0xf77a('0x38');return db[_0xf77a('0x62')][_0xf77a('0x63')]({'where':{'name':_0x18bdb9,'userProfileId':_0x162934[_0xf77a('0x64')]},'raw':!![]})[_0xf77a('0x23')](function(_0x2642ba){if(_0x2642ba&&_0x2642ba[_0xf77a('0x65')]===0x0){return db[_0xf77a('0x39')][_0xf77a('0x5e')]({'name':_0x317256[_0xf77a('0x3c')],'resourceId':_0x317256['id'],'type':_0x2642ba['name'],'sectionId':_0x2642ba['id']},{})[_0xf77a('0x23')](function(){return _0x4eb36c;});}else{return _0x4eb36c;}})[_0xf77a('0x5d')](function(_0x3926a5){logger[_0xf77a('0x29')](_0xf77a('0x66'),_0x3926a5);throw _0x3926a5;});}return _0x4eb36c;})[_0xf77a('0x23')](respondWithResult(_0x42730e,0xc9))[_0xf77a('0x5d')](handleError(_0x42730e,null));};exports[_0xf77a('0x36')]=function(_0x4e4091,_0x2531ff){if(_0x4e4091[_0xf77a('0x67')]['id']){delete _0x4e4091[_0xf77a('0x67')]['id'];}return db[_0xf77a('0x42')]['find']({'where':{'id':_0x4e4091[_0xf77a('0x5b')]['id']},'include':[{'model':db[_0xf77a('0x3f')],'as':_0xf77a('0x40')}]})[_0xf77a('0x23')](handleEntityNotFound(_0x2531ff,null))['then'](saveUpdates(_0x4e4091[_0xf77a('0x67')],null))[_0xf77a('0x23')](respondWithResult(_0x2531ff,null))['catch'](handleError(_0x2531ff,null));};exports['destroy']=function(_0x2a0178,_0x5481be){return db['FaxAccount'][_0xf77a('0x63')]({'where':{'id':_0x2a0178['params']['id']}})['then'](handleEntityNotFound(_0x5481be,null))[_0xf77a('0x23')](removeEntity(_0x5481be,null))[_0xf77a('0x5d')](handleError(_0x5481be,null));};exports[_0xf77a('0x68')]=function(_0x3c48d5,_0x26861f){return db[_0xf77a('0x42')][_0xf77a('0x68')]()['then'](respondWithResult(_0x26861f,null))[_0xf77a('0x5d')](handleError(_0x26861f,null));};exports[_0xf77a('0x69')]=function(_0x15ca9a,_0x42de85,_0x3b9ced){if(_0x15ca9a[_0xf77a('0x67')]['id']){delete _0x15ca9a[_0xf77a('0x67')]['id'];}return db[_0xf77a('0x42')][_0xf77a('0x63')]({'where':{'id':_0x15ca9a['params']['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x42de85,null))[_0xf77a('0x23')](function(_0x17b812){if(_0x17b812){_0x15ca9a[_0xf77a('0x67')][_0xf77a('0x6a')]=_0x17b812['id'];return db['Disposition']['create'](_0x15ca9a[_0xf77a('0x67')]);}})['then'](respondWithResult(_0x42de85,null))[_0xf77a('0x5d')](handleError(_0x42de85,null));};exports[_0xf77a('0x6b')]=function(_0xe78ba7,_0x150e9d,_0x1473f9){var _0x560cca={'raw':![],'where':{}};var _0x45dec0={};var _0xc1a6ed={'count':0x0,'rows':[]};return db[_0xf77a('0x42')][_0xf77a('0x6c')]({'where':{'id':_0xe78ba7[_0xf77a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x150e9d,null))['then'](function(_0x5b00dd){if(_0x5b00dd){_0x45dec0[_0xf77a('0x47')]=_[_0xf77a('0x48')](db[_0xf77a('0x6d')][_0xf77a('0x43')]);_0x45dec0['query']=_[_0xf77a('0x48')](_0xe78ba7[_0xf77a('0x49')]);_0x45dec0['filters']=_['intersection'](_0x45dec0[_0xf77a('0x47')],_0x45dec0[_0xf77a('0x49')]);_0x560cca[_0xf77a('0x4d')]=_[_0xf77a('0x4b')](_0x45dec0[_0xf77a('0x47')],qs[_0xf77a('0x4c')](_0xe78ba7[_0xf77a('0x49')][_0xf77a('0x4c')]));_0x560cca[_0xf77a('0x4d')]=_0x560cca[_0xf77a('0x4d')][_0xf77a('0x4e')]?_0x560cca[_0xf77a('0x4d')]:_0x45dec0['model'];if(!_0xe78ba7[_0xf77a('0x49')][_0xf77a('0x4f')]('nolimit')){_0x560cca[_0xf77a('0x30')]=qs[_0xf77a('0x30')](_0xe78ba7[_0xf77a('0x49')]['limit']);_0x560cca['offset']=qs[_0xf77a('0x32')](_0xe78ba7['query'][_0xf77a('0x32')]);}_0x560cca[_0xf77a('0x51')]=qs[_0xf77a('0x52')](_0xe78ba7[_0xf77a('0x49')][_0xf77a('0x52')]);_0x560cca[_0xf77a('0x55')]=qs[_0xf77a('0x4a')](_[_0xf77a('0x53')](_0xe78ba7[_0xf77a('0x49')],_0x45dec0['filters']));_0x560cca[_0xf77a('0x55')][_0xf77a('0x6a')]=_0x5b00dd['id'];if(_0xe78ba7[_0xf77a('0x49')][_0xf77a('0x54')]){_0x560cca[_0xf77a('0x55')]=_['merge'](_0x560cca[_0xf77a('0x55')],{'$or':_[_0xf77a('0x41')](_0x560cca[_0xf77a('0x4d')],function(_0x45a7a1){var _0xee1f8={};_0xee1f8[_0x45a7a1]={'$like':'%'+_0xe78ba7[_0xf77a('0x49')]['filter']+'%'};return _0xee1f8;})});}_0x560cca=_[_0xf77a('0x56')]({},_0x560cca,_0xe78ba7[_0xf77a('0x57')]);return db[_0xf77a('0x6d')]['count']({'where':_0x560cca['where']})[_0xf77a('0x23')](function(_0x2d1c5b){_0xc1a6ed[_0xf77a('0x31')]=_0x2d1c5b;if(_0xe78ba7['query']['includeAll']){_0x560cca[_0xf77a('0x5c')]=[{'all':!![]}];}return db[_0xf77a('0x6d')][_0xf77a('0x6e')](_0x560cca);})['then'](function(_0x27450a){_0xc1a6ed[_0xf77a('0x59')]=_0x27450a;return _0xc1a6ed;});}})[_0xf77a('0x23')](respondWithFilteredResult(_0x150e9d,_0x560cca))[_0xf77a('0x5d')](handleError(_0x150e9d,null));};exports[_0xf77a('0x6f')]=function(_0x4a9794,_0x5f79c8,_0x2b6de9){return db['FaxAccount'][_0xf77a('0x63')]({'where':{'id':_0x4a9794[_0xf77a('0x5b')]['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x5f79c8,null))[_0xf77a('0x23')](function(_0x40da22){if(_0x40da22){return _0x40da22[_0xf77a('0x6f')](_0x4a9794[_0xf77a('0x49')]['ids']);}})[_0xf77a('0x23')](respondWithStatusCode(_0x5f79c8,null))['catch'](handleError(_0x5f79c8,null));};exports[_0xf77a('0x70')]=function(_0x1050cd,_0x5dc49a,_0x487a98){if(_0x1050cd[_0xf77a('0x67')]['id']){delete _0x1050cd[_0xf77a('0x67')]['id'];}return db[_0xf77a('0x42')]['find']({'where':{'id':_0x1050cd['params']['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x5dc49a,null))['then'](function(_0x64cc5c){if(_0x64cc5c){_0x1050cd[_0xf77a('0x67')][_0xf77a('0x6a')]=_0x64cc5c['id'];return db[_0xf77a('0x71')][_0xf77a('0x5e')](_0x1050cd[_0xf77a('0x67')]);}})[_0xf77a('0x23')](respondWithResult(_0x5dc49a,null))[_0xf77a('0x5d')](handleError(_0x5dc49a,null));};exports['getAnswers']=function(_0x84399a,_0x5daf35,_0xa30b4f){var _0x1467f6={'raw':![],'where':{}};var _0x58e940={};var _0x4e2b90={'count':0x0,'rows':[]};return db[_0xf77a('0x42')]['findOne']({'where':{'id':_0x84399a['params']['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x5daf35,null))[_0xf77a('0x23')](function(_0x218d54){if(_0x218d54){_0x58e940['model']=_[_0xf77a('0x48')](db[_0xf77a('0x71')][_0xf77a('0x43')]);_0x58e940[_0xf77a('0x49')]=_[_0xf77a('0x48')](_0x84399a['query']);_0x58e940['filters']=_[_0xf77a('0x4b')](_0x58e940[_0xf77a('0x47')],_0x58e940[_0xf77a('0x49')]);_0x1467f6['attributes']=_[_0xf77a('0x4b')](_0x58e940['model'],qs['fields'](_0x84399a['query'][_0xf77a('0x4c')]));_0x1467f6['attributes']=_0x1467f6[_0xf77a('0x4d')][_0xf77a('0x4e')]?_0x1467f6[_0xf77a('0x4d')]:_0x58e940[_0xf77a('0x47')];if(!_0x84399a['query'][_0xf77a('0x4f')](_0xf77a('0x50'))){_0x1467f6[_0xf77a('0x30')]=qs[_0xf77a('0x30')](_0x84399a['query']['limit']);_0x1467f6[_0xf77a('0x32')]=qs['offset'](_0x84399a[_0xf77a('0x49')]['offset']);}_0x1467f6[_0xf77a('0x51')]=qs[_0xf77a('0x52')](_0x84399a[_0xf77a('0x49')]['sort']);_0x1467f6[_0xf77a('0x55')]=qs[_0xf77a('0x4a')](_[_0xf77a('0x53')](_0x84399a[_0xf77a('0x49')],_0x58e940[_0xf77a('0x4a')]));_0x1467f6['where'][_0xf77a('0x6a')]=_0x218d54['id'];if(_0x84399a[_0xf77a('0x49')]['filter']){_0x1467f6['where']=_[_0xf77a('0x56')](_0x1467f6['where'],{'$or':_['map'](_0x1467f6[_0xf77a('0x4d')],function(_0x4a3d43){var _0x1bdf02={};_0x1bdf02[_0x4a3d43]={'$like':'%'+_0x84399a[_0xf77a('0x49')][_0xf77a('0x54')]+'%'};return _0x1bdf02;})});}_0x1467f6=_[_0xf77a('0x56')]({},_0x1467f6,_0x84399a['options']);return db[_0xf77a('0x71')][_0xf77a('0x31')]({'where':_0x1467f6[_0xf77a('0x55')]})[_0xf77a('0x23')](function(_0x40a822){_0x4e2b90['count']=_0x40a822;if(_0x84399a[_0xf77a('0x49')]['includeAll']){_0x1467f6[_0xf77a('0x5c')]=[{'all':!![]}];}return db[_0xf77a('0x71')][_0xf77a('0x6e')](_0x1467f6);})[_0xf77a('0x23')](function(_0x445643){_0x4e2b90[_0xf77a('0x59')]=_0x445643;return _0x4e2b90;});}})[_0xf77a('0x23')](respondWithFilteredResult(_0x5daf35,_0x1467f6))[_0xf77a('0x5d')](handleError(_0x5daf35,null));};exports[_0xf77a('0x72')]=function(_0x30f011,_0x923b09,_0xa469a){return db['FaxAccount'][_0xf77a('0x63')]({'where':{'id':_0x30f011['params']['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x923b09,null))[_0xf77a('0x23')](function(_0x2bd642){if(_0x2bd642){return _0x2bd642['removeAnswers'](_0x30f011['query'][_0xf77a('0x73')]);}})['then'](respondWithStatusCode(_0x923b09,null))[_0xf77a('0x5d')](handleError(_0x923b09,null));};exports['addInteraction']=function(_0x5dd80b,_0x48d6ff,_0x3773dd){return db['FaxInteraction'][_0xf77a('0x63')]({'where':{'id':_0x5dd80b[_0xf77a('0x5b')]['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x48d6ff,null))[_0xf77a('0x23')](function(_0x2205cb){if(_0x2205cb){return _0x2205cb[_0xf77a('0x74')](_0x5dd80b[_0xf77a('0x67')][_0xf77a('0x73')],_['omit'](_0x5dd80b['body'],[_0xf77a('0x73'),'id'])||{});}})['then'](respondWithResult(_0x48d6ff,null))[_0xf77a('0x5d')](handleError(_0x48d6ff,null));};exports[_0xf77a('0x75')]=function(_0x5e4253,_0xa6877,_0x227e96){var _0x365e0c={'raw':![],'where':{}};var _0x22ead6={};var _0x38fd51={'count':0x0,'rows':[]};return db[_0xf77a('0x42')][_0xf77a('0x6c')]({'where':{'id':_0x5e4253['params']['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0xa6877,null))[_0xf77a('0x23')](function(_0x1558ef){if(_0x1558ef){_0x22ead6[_0xf77a('0x47')]=_[_0xf77a('0x48')](db[_0xf77a('0x76')][_0xf77a('0x43')]);_0x22ead6[_0xf77a('0x49')]=_[_0xf77a('0x48')](_0x5e4253[_0xf77a('0x49')]);_0x22ead6[_0xf77a('0x4a')]=_['intersection'](_0x22ead6[_0xf77a('0x47')],_0x22ead6['query']);_0x365e0c['attributes']=_[_0xf77a('0x4b')](_0x22ead6[_0xf77a('0x47')],qs[_0xf77a('0x4c')](_0x5e4253[_0xf77a('0x49')]['fields']));_0x365e0c[_0xf77a('0x4d')]=_0x365e0c[_0xf77a('0x4d')][_0xf77a('0x4e')]?_0x365e0c[_0xf77a('0x4d')]:_0x22ead6['model'];if(!_0x5e4253['query'][_0xf77a('0x4f')](_0xf77a('0x50'))){_0x365e0c[_0xf77a('0x30')]=qs[_0xf77a('0x30')](_0x5e4253[_0xf77a('0x49')]['limit']);_0x365e0c[_0xf77a('0x32')]=qs['offset'](_0x5e4253[_0xf77a('0x49')]['offset']);}_0x365e0c['order']=qs[_0xf77a('0x52')](_0x5e4253['query'][_0xf77a('0x52')]);_0x365e0c[_0xf77a('0x55')]=qs[_0xf77a('0x4a')](_[_0xf77a('0x53')](_0x5e4253['query'],_0x22ead6[_0xf77a('0x4a')]));_0x365e0c[_0xf77a('0x55')][_0xf77a('0x6a')]=_0x1558ef['id'];if(_0x5e4253[_0xf77a('0x49')][_0xf77a('0x54')]){_0x365e0c[_0xf77a('0x55')]=_['merge'](_0x365e0c[_0xf77a('0x55')],{'$or':_[_0xf77a('0x41')](_0x365e0c['attributes'],function(_0x44ed7d){var _0x163553={};_0x163553[_0x44ed7d]={'$like':'%'+_0x5e4253[_0xf77a('0x49')][_0xf77a('0x54')]+'%'};return _0x163553;})});}_0x365e0c=_[_0xf77a('0x56')]({},_0x365e0c,_0x5e4253[_0xf77a('0x57')]);return db[_0xf77a('0x76')][_0xf77a('0x31')]({'where':_0x365e0c[_0xf77a('0x55')]})[_0xf77a('0x23')](function(_0x3bb9f5){_0x38fd51[_0xf77a('0x31')]=_0x3bb9f5;if(_0x5e4253[_0xf77a('0x49')][_0xf77a('0x58')]){_0x365e0c['include']=[{'model':db['CmContact'],'as':_0xf77a('0x77'),'required':![]},{'model':db[_0xf77a('0x78')],'as':_0xf77a('0x79'),'attributes':['name',_0xf77a('0x7a'),'internal'],'required':![]},{'model':db[_0xf77a('0x7b')],'as':_0xf77a('0x7c'),'attributes':['id',_0xf77a('0x3c'),_0xf77a('0x7d')],'where':_0x5e4253[_0xf77a('0x49')][_0xf77a('0x7e')]?{'id':_0x5e4253['query'][_0xf77a('0x7e')]}:undefined,'required':_0x5e4253[_0xf77a('0x49')]['tag']?!![]:![]}];}return db[_0xf77a('0x76')]['findAll'](_0x365e0c);})[_0xf77a('0x23')](function(_0x303979){_0x38fd51[_0xf77a('0x59')]=_0x303979;return _0x38fd51;});}})['then'](respondWithFilteredResult(_0xa6877,_0x365e0c))[_0xf77a('0x5d')](handleError(_0xa6877,null));};exports[_0xf77a('0x7f')]=function(_0xa8b36,_0x3a080b){var _0x384d58=_0xa8b36[_0xf77a('0x5b')]['id'];var _0x2866d0=_0xa8b36[_0xf77a('0x67')];var _0x3ef1fc=0xc8;var _0x146c32=null;return db['sequelize'][_0xf77a('0x80')]({'isolationLevel':db[_0xf77a('0x81')][_0xf77a('0x82')][_0xf77a('0x83')][_0xf77a('0x84')]},function(_0x5ba50b){return db[_0xf77a('0x42')][_0xf77a('0x6c')]({'where':{'id':_0x384d58},'transaction':_0x5ba50b})[_0xf77a('0x23')](function(_0x56ccf3){if(_0x56ccf3){return db[_0xf77a('0x85')]['destroy']({'where':{'FaxAccountId':_0x384d58},'transaction':_0x5ba50b})[_0xf77a('0x23')](function(){var _0x2ef689=_[_0xf77a('0x41')](_0x2866d0,function(_0x43abf5){_0x43abf5[_0xf77a('0x6a')]=_0x384d58;return _0x43abf5;});return db[_0xf77a('0x85')]['bulkCreate'](_0x2ef689,{'transaction':_0x5ba50b});});}else{_0x3ef1fc=0x194;_0x146c32=[];}});})[_0xf77a('0x23')](function(){if(_0x3ef1fc!==0x194){return db[_0xf77a('0x85')][_0xf77a('0x86')]({'where':{'FaxAccountId':_0x384d58},'order':_0xf77a('0x87')})[_0xf77a('0x23')](function(_0x532c70){_0x146c32=_0x532c70;});}})[_0xf77a('0x5d')](function(_0x5706ce){_0x3ef1fc=0x1f4;logger[_0xf77a('0x29')](_0x5706ce[_0xf77a('0x3b')]);if(_0x5706ce[_0xf77a('0x3c')]){delete _0x5706ce[_0xf77a('0x3c')];}_0x146c32=_0x5706ce;})['finally'](function(){if(_0x146c32===null){_0x3a080b[_0xf77a('0x2d')](_0x3ef1fc);}else{if(_0x3ef1fc===0x1f4){_0x3a080b[_0xf77a('0x3a')](_0x3ef1fc)['send'](_0x146c32);}else{_0x3a080b[_0xf77a('0x3a')](_0x3ef1fc)[_0xf77a('0x88')](_0x146c32);}}});};exports['getApplications']=function(_0x6742d4,_0x1a6627,_0x52a0b3){var _0x556ffc={};var _0x4b766c={};var _0x41881e;var _0x39dfd6;return db[_0xf77a('0x42')][_0xf77a('0x6c')]({'where':{'id':_0x6742d4[_0xf77a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1a6627,null))[_0xf77a('0x23')](function(_0x210a6b){if(_0x210a6b){_0x41881e=_0x210a6b;_0x4b766c[_0xf77a('0x47')]=_['keys'](db[_0xf77a('0x85')]['rawAttributes']);_0x4b766c[_0xf77a('0x49')]=_['keys'](_0x6742d4[_0xf77a('0x49')]);_0x4b766c['filters']=_[_0xf77a('0x4b')](_0x4b766c['model'],_0x4b766c[_0xf77a('0x49')]);_0x556ffc['attributes']=_[_0xf77a('0x4b')](_0x4b766c[_0xf77a('0x47')],qs[_0xf77a('0x4c')](_0x6742d4['query']['fields']));_0x556ffc['attributes']=_0x556ffc[_0xf77a('0x4d')][_0xf77a('0x4e')]?_0x556ffc[_0xf77a('0x4d')]:_0x4b766c['model'];_0x556ffc['order']=qs[_0xf77a('0x52')](_0x6742d4[_0xf77a('0x49')][_0xf77a('0x52')]);_0x556ffc[_0xf77a('0x55')]=qs['filters'](_['pick'](_0x6742d4[_0xf77a('0x49')],_0x4b766c[_0xf77a('0x4a')]));if(_0x6742d4[_0xf77a('0x49')]['filter']){_0x556ffc[_0xf77a('0x55')]=_[_0xf77a('0x56')](_0x556ffc['where'],{'$or':_[_0xf77a('0x41')](_0x556ffc[_0xf77a('0x4d')],function(_0xedb333){var _0x214793={};_0x214793[_0xedb333]={'$like':'%'+_0x6742d4[_0xf77a('0x49')]['filter']+'%'};return _0x214793;})});}_0x556ffc=_[_0xf77a('0x56')]({},_0x556ffc,_0x6742d4[_0xf77a('0x57')]);return _0x41881e[_0xf77a('0x89')](_0x556ffc);}})['then'](function(_0x26ab7b){if(_0x26ab7b){_0x39dfd6=_0x26ab7b[_0xf77a('0x4e')];if(!_0x6742d4[_0xf77a('0x49')][_0xf77a('0x4f')]('nolimit')){_0x556ffc['limit']=qs[_0xf77a('0x30')](_0x6742d4[_0xf77a('0x49')][_0xf77a('0x30')]);_0x556ffc['offset']=qs[_0xf77a('0x32')](_0x6742d4[_0xf77a('0x49')]['offset']);}return _0x41881e[_0xf77a('0x89')](_0x556ffc);}})[_0xf77a('0x23')](function(_0x4381d5){if(_0x4381d5){return _0x4381d5?{'count':_0x39dfd6,'rows':_0x4381d5}:null;}})[_0xf77a('0x23')](respondWithResult(_0x1a6627,null))[_0xf77a('0x5d')](handleError(_0x1a6627,null));};function Extension(_0x3a1b4f,_0x155683,_0x49dc99,_0x4eae0a){this[_0xf77a('0x8a')]=_0xf77a('0x8b');this['exten']=_0x3a1b4f['localstationid'];this[_0xf77a('0x8c')]=_0x4eae0a;this[_0xf77a('0x45')]='system';this['description']='Fax\x20Extension';this[_0xf77a('0x6a')]=_0x3a1b4f['id'];this[_0xf77a('0x87')]=_0x155683;this[_0xf77a('0x8d')]=_0x49dc99;}function createExtensionsReciveFax(_0x3ad8e2){var _0x93e699=0x1;var _0x53b95e=[];_0x53b95e[_0xf77a('0x8e')](new Extension(_0x3ad8e2,_0x93e699,'','Answer'));_0x93e699+=0x1;_0x53b95e[_0xf77a('0x8e')](new Extension(_0x3ad8e2,_0x93e699,_0xf77a('0x8f'),_0xf77a('0x90')));_0x93e699+=0x1;for(var _0x3b88e4 in _0x3ad8e2){if(_0x3ad8e2[_0xf77a('0x4f')](_0x3b88e4)&&(_0x3b88e4===_0xf77a('0x91')||_0x3b88e4===_0xf77a('0x92')||_0x3b88e4===_0xf77a('0x93')||_0x3b88e4===_0xf77a('0x94')||_0x3b88e4===_0xf77a('0x95')||_0x3b88e4===_0xf77a('0x96')||_0x3b88e4===_0xf77a('0x97')||_0x3b88e4==='modem'||_0x3b88e4===_0xf77a('0x98'))){_0x53b95e['push'](new Extension(_0x3ad8e2,_0x93e699,'FAXOPT('+_0x3b88e4+')='+_0x3ad8e2[_0x3b88e4],_0xf77a('0x90')));_0x93e699+=0x1;}}_0x53b95e[_0xf77a('0x8e')](new Extension(_0x3ad8e2,_0x93e699,'6',_0xf77a('0x99')));_0x93e699+=0x1;_0x53b95e['push'](new Extension(_0x3ad8e2,_0x93e699,_0xf77a('0x9a'),_0xf77a('0x9b')));_0x93e699=0x0;return _0x53b95e;}exports['addAccountApplications']=function(_0x2eb3bd,_0x54fbc7,_0x47ffdf){var _0x20a841;return db[_0xf77a('0x81')][_0xf77a('0x80')](function(_0x3590a8){return db[_0xf77a('0x42')][_0xf77a('0x5e')](_0x2eb3bd[_0xf77a('0x67')],{'transaction':_0x3590a8})[_0xf77a('0x23')](function(_0x411754){_0x20a841=_0x411754[_0xf77a('0x60')]({'plain':!![]});return db[_0xf77a('0x9c')][_0xf77a('0x9d')](createExtensionsReciveFax(_0x20a841),{'transaction':_0x3590a8});});})[_0xf77a('0x23')](function(){return _0x20a841;})['then'](respondWithResult(_0x54fbc7,null))[_0xf77a('0x5d')](handleError(_0x54fbc7,null));};exports[_0xf77a('0x9e')]=function(_0x352b7b,_0x141206,_0x18cd63){var _0xb6cf03;return db[_0xf77a('0x81')][_0xf77a('0x80')](function(_0x244fb1){return db[_0xf77a('0x42')][_0xf77a('0x36')](_0x352b7b['body'],{'where':{'id':_0x352b7b[_0xf77a('0x67')]['id']},'transaction':_0x244fb1})[_0xf77a('0x23')](function(_0x33866d){return db[_0xf77a('0x9c')]['destroy']({'where':{'FaxAccountId':_0x352b7b[_0xf77a('0x67')]['id']},'transaction':_0x244fb1})[_0xf77a('0x23')](function(_0xf8714c){return db[_0xf77a('0x9c')][_0xf77a('0x9d')](createExtensionsReciveFax(_[_0xf77a('0x9f')](_0x352b7b[_0xf77a('0x67')],['tech',_0xf77a('0x46'),_0xf77a('0xa0'),_0xf77a('0xa1'),_0xf77a('0xa2'),'ListId'])),{'transaction':_0x244fb1});});});})[_0xf77a('0x23')](function(){return db[_0xf77a('0x42')]['findById'](_0x352b7b[_0xf77a('0x67')]['id']);})[_0xf77a('0x23')](respondWithResult(_0x141206,null))[_0xf77a('0x5d')](handleError(_0x141206,null));};exports[_0xf77a('0xa3')]=function(_0x39c162,_0x3493a8,_0x2a7400){var _0x12f203={'raw':!![],'where':{}};var _0x18b804={};var _0x163c80={'count':0x0,'rows':[]};return db[_0xf77a('0x42')][_0xf77a('0x6c')]({'where':{'id':_0x39c162[_0xf77a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3493a8,null))['then'](function(_0x5386fb){if(_0x5386fb){_0x18b804['model']=_[_0xf77a('0x48')](db[_0xf77a('0xa4')][_0xf77a('0x43')]);_0x18b804[_0xf77a('0x49')]=_['keys'](_0x39c162[_0xf77a('0x49')]);_0x18b804[_0xf77a('0x4a')]=_[_0xf77a('0x4b')](_0x18b804[_0xf77a('0x47')],_0x18b804[_0xf77a('0x49')]);_0x12f203['attributes']=_[_0xf77a('0x4b')](_0x18b804[_0xf77a('0x47')],qs[_0xf77a('0x4c')](_0x39c162[_0xf77a('0x49')][_0xf77a('0x4c')]));_0x12f203[_0xf77a('0x4d')]=_0x12f203['attributes'][_0xf77a('0x4e')]?_0x12f203[_0xf77a('0x4d')]:_0x18b804[_0xf77a('0x47')];if(!_0x39c162['query'][_0xf77a('0x4f')](_0xf77a('0x50'))){_0x12f203[_0xf77a('0x30')]=qs['limit'](_0x39c162[_0xf77a('0x49')][_0xf77a('0x30')]);_0x12f203[_0xf77a('0x32')]=qs['offset'](_0x39c162[_0xf77a('0x49')][_0xf77a('0x32')]);}_0x12f203['order']=qs[_0xf77a('0x52')](_0x39c162[_0xf77a('0x49')][_0xf77a('0x52')]);_0x12f203[_0xf77a('0x55')]=qs[_0xf77a('0x4a')](_['pick'](_0x39c162[_0xf77a('0x49')],_0x18b804[_0xf77a('0x4a')]));_0x12f203[_0xf77a('0x55')]['FaxAccountId']=_0x5386fb['id'];if(_0x39c162[_0xf77a('0x49')][_0xf77a('0x54')]){_0x12f203[_0xf77a('0x55')]=_[_0xf77a('0x56')](_0x12f203[_0xf77a('0x55')],{'$or':_['map'](_0x12f203[_0xf77a('0x4d')],function(_0x1c2989){var _0x537d48={};_0x537d48[_0x1c2989]={'$like':'%'+_0x39c162[_0xf77a('0x49')][_0xf77a('0x54')]+'%'};return _0x537d48;})});}if(_0x39c162[_0xf77a('0x49')][_0xf77a('0xa5')]){var _0x246989=_0x39c162[_0xf77a('0x49')]['$gte'][_0xf77a('0xa6')](',');var _0x3764a6={};_0x3764a6[_0x246989[0x0]]={'$gte':moment(_0x246989[0x1])[_0xf77a('0xa7')](_0xf77a('0xa8'))};_0x12f203['where']=_[_0xf77a('0x56')](_0x12f203[_0xf77a('0x55')],_0x3764a6);}_0x12f203=_[_0xf77a('0x56')]({},_0x12f203,_0x39c162[_0xf77a('0x57')]);return db[_0xf77a('0xa4')][_0xf77a('0x31')]({'where':_0x12f203[_0xf77a('0x55')]})[_0xf77a('0x23')](function(_0xc5d7f7){_0x163c80[_0xf77a('0x31')]=_0xc5d7f7;if(_0x39c162[_0xf77a('0x49')][_0xf77a('0x58')]){_0x12f203[_0xf77a('0x5c')]=[{'all':!![]}];}return db[_0xf77a('0xa4')][_0xf77a('0x6e')](_0x12f203);})[_0xf77a('0x23')](function(_0x55694c){_0x163c80['rows']=_0x55694c;return _0x163c80;});}})['then'](respondWithFilteredResult(_0x3493a8,_0x12f203))[_0xf77a('0x5d')](handleError(_0x3493a8,null));};exports[_0xf77a('0x3d')]=function(_0x2a1025,_0x499fd1,_0x48e7bf){var _0x2f6698,_0x570168={},_0x5c6708;if(_0x2a1025[_0xf77a('0x67')]['to']){_0x5c6708=_0x2a1025[_0xf77a('0x67')]['to'][0x0];}return db[_0xf77a('0x42')][_0xf77a('0x63')]({'where':{'id':_0x2a1025[_0xf77a('0x5b')]['id']},'include':[{'model':db[_0xf77a('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':_0xf77a('0xaa'),'where':{'fax':_0x5c6708},'limit':0x1,'order':[[_0xf77a('0xa1'),_0xf77a('0xab')]]}]}]})[_0xf77a('0x23')](handleEntityNotFound(_0x499fd1,null))[_0xf77a('0x23')](function(_0x134c80){_0x2f6698=_0x134c80;if(_0x2a1025[_0xf77a('0x67')]['attachments']&&_0x2a1025[_0xf77a('0x67')]['attachments'][_0xf77a('0x4e')]){for(var _0x41f9bc=0x0;_0x41f9bc<_0x2a1025[_0xf77a('0x67')][_0xf77a('0xac')][_0xf77a('0x4e')];_0x41f9bc+=0x1){_0x2a1025[_0xf77a('0x67')][_0xf77a('0xac')][_0x41f9bc]={'filename':_0x2a1025['body'][_0xf77a('0xac')][_0x41f9bc][_0xf77a('0x3c')],'id':_0x2a1025[_0xf77a('0x67')][_0xf77a('0xac')][_0x41f9bc]['id'],'path':path['join'](config[_0xf77a('0xad')],'server/files/attachments',_0x2a1025[_0xf77a('0x67')]['attachments'][_0x41f9bc][_0xf77a('0xae')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xf77a('0xaf')](_0x2a1025[_0xf77a('0x5b')]['id'])?undefined:_0x2a1025[_0xf77a('0x5b')]['id'],'path':_[_0xf77a('0xaf')](_0x2a1025['body'][_0xf77a('0xac')][0x0]['path'])?undefined:_0x2a1025[_0xf77a('0x67')][_0xf77a('0xac')][0x0][_0xf77a('0xb0')],'fax':_[_0xf77a('0xaf')](_0x2a1025[_0xf77a('0x67')]['to'][0x0])?undefined:_0x2a1025['body']['to'][0x0]},client9002);})[_0xf77a('0x23')](function(){if(_0x2f6698){if(_[_0xf77a('0xaf')](_0x2a1025[_0xf77a('0x67')][_0xf77a('0xb1')])){_0x2a1025[_0xf77a('0x67')][_0xf77a('0xb1')]=util[_0xf77a('0xa7')](_0xf77a('0xb2'),_0x2f6698['name'],_0x2f6698[_0xf77a('0xb3')]);}if(_0x2f6698[_0xf77a('0xb4')]){if(_0x2f6698[_0xf77a('0xb4')][_0xf77a('0xaa')][_0xf77a('0x4e')]){return _0x2f6698[_0xf77a('0xb4')][_0xf77a('0xaa')][0x0];}else{return db[_0xf77a('0xb5')][_0xf77a('0x5e')](_[_0xf77a('0x1c')](_0x2a1025[_0xf77a('0x67')],{'firstName':_0x2a1025[_0xf77a('0x67')]['to'][0x0],'phone':_0x2a1025['body']['to'][0x0],'fax':_0x2a1025[_0xf77a('0x67')]['to'][0x0],'ListId':_0x2f6698[_0xf77a('0xb6')]}));}}else{throw new Error(_0xf77a('0xb7'));}}else{throw new Error(_0xf77a('0xb8'));}})[_0xf77a('0x23')](function(_0x5afeb0){if(_0x5afeb0){return db[_0xf77a('0x76')][_0xf77a('0x63')]({'where':{'ContactId':_0x5afeb0['id'],'closed':![],'FaxAccountId':_0x2f6698['id']}})[_0xf77a('0x23')](function(_0x4e7c72){if(_0x4e7c72){return[_0x4e7c72,![]];}return db['FaxInteraction'][_0xf77a('0x5e')]({'UserId':_0x2a1025[_0xf77a('0x5f')]['id'],'ContactId':_0x5afeb0['id'],'FaxAccountId':_0x2f6698['id'],'fax':_0x2a1025[_0xf77a('0x67')]['to'][0x0],'firstMsgDirection':_0xf77a('0xb9'),'Messages':[_[_0xf77a('0x56')](_0x2a1025[_0xf77a('0x67')],{'read':![],'body':_0x2a1025[_0xf77a('0x67')]['attachments'][0x0][_0xf77a('0xba')],'FaxAccountId':_0x2f6698['id'],'UserId':_0x2a1025['user']['id'],'ContactId':_0x5afeb0['id'],'AttachmentId':_0x2a1025[_0xf77a('0x67')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xf77a('0xa4')],'as':_0xf77a('0xbb')}]})['then'](function(_0x1657ee){return[_0x1657ee,!![]];});});}else{throw new Error(_0xf77a('0xbc'));}})[_0xf77a('0xbd')](function(_0x3b382f,_0x355cd5){if(_0x355cd5){return _0x3b382f;}return db[_0xf77a('0xa4')][_0xf77a('0x5e')]({'direction':_0xf77a('0xb9'),'read':![],'body':_0x2a1025[_0xf77a('0x67')]['attachments'][0x0]['filename'],'FaxAccountId':_0x2f6698['id'],'FaxInteractionId':_0x3b382f['id'],'UserId':_0x2a1025[_0xf77a('0x5f')]['id'],'ContactId':_0x3b382f[_0xf77a('0xbe')],'AttachmentId':_0x2a1025[_0xf77a('0x67')]['attachments'][0x0]['id']})[_0xf77a('0x23')](function(_0x45b30c){_0x3b382f[_0xf77a('0xbf')][_0xf77a('0xbb')]=[];_0x3b382f['dataValues'][_0xf77a('0xbb')][_0xf77a('0x8e')](_0x45b30c[_0xf77a('0xbf')]);return _0x3b382f;});})[_0xf77a('0x23')](function(_0x26310c){respondWithRpcPromise('SendFax',_0xf77a('0xc0'),{'FaxAccountId':_[_0xf77a('0xaf')](_0x2a1025[_0xf77a('0x5b')]['id'])?undefined:_0x2a1025[_0xf77a('0x5b')]['id'],'path':_[_0xf77a('0xaf')](_0x2a1025[_0xf77a('0x67')][_0xf77a('0xac')][0x0][_0xf77a('0xb0')])?undefined:_0x2a1025['body'][_0xf77a('0xac')][0x0]['path'],'fax':_[_0xf77a('0xaf')](_0x2a1025['body']['to'][0x0])?undefined:_0x2a1025['body']['to'][0x0],'AttachmentId':_0x2a1025[_0xf77a('0x67')]['attachments'][0x0]['id']},client9002)[_0xf77a('0x23')](function(_0x38621c){logger[_0xf77a('0x24')](_0xf77a('0xc1'),_0x38621c);})[_0xf77a('0x5d')](function(_0x516a98){logger[_0xf77a('0x24')](_0xf77a('0xc1'),_0x516a98);});return _0x26310c;})[_0xf77a('0x23')](respondWithResult(_0x499fd1,null))[_0xf77a('0x5d')](handleError(_0x499fd1,null));};exports['addAgents']=function(_0xa2ea8b,_0xf799d,_0x10095c){return db[_0xf77a('0x42')][_0xf77a('0x63')]({'where':{'id':_0xa2ea8b[_0xf77a('0x5b')]['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0xf799d,null))[_0xf77a('0x23')](function(_0x39cb24){if(_0x39cb24){return _0x39cb24['addAgents'](_0xa2ea8b['body'][_0xf77a('0x73')],_[_0xf77a('0x9f')](_0xa2ea8b['body'],[_0xf77a('0x73'),'id'])||{})[_0xf77a('0xbd')](function(_0x597d92){for(var _0x514707=0x0;_0x514707<_0xa2ea8b['body']['ids'][_0xf77a('0x4e')];_0x514707+=0x1){socket[_0xf77a('0xc2')](_0xf77a('0xc3'),{'UserId':Number(_0xa2ea8b[_0xf77a('0x67')][_0xf77a('0x73')][_0x514707]),'FaxAccountId':Number(_0xa2ea8b[_0xf77a('0x5b')]['id'])});}return _0x597d92;});}})[_0xf77a('0x23')](respondWithResult(_0xf799d,null))[_0xf77a('0x5d')](handleError(_0xf799d,null));};exports[_0xf77a('0xc4')]=function(_0x122948,_0x248d58,_0x50b597){return db[_0xf77a('0x42')][_0xf77a('0x63')]({'where':{'id':_0x122948[_0xf77a('0x5b')]['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x248d58,null))[_0xf77a('0x23')](function(_0x551f5d){if(_0x551f5d){return _0x551f5d['removeAgents'](_0x122948[_0xf77a('0x49')][_0xf77a('0x73')])['then'](function(){if(_[_0xf77a('0xc5')](_0x122948['query'][_0xf77a('0x73')])){for(var _0x268152=0x0;_0x268152<_0x122948[_0xf77a('0x49')]['ids'][_0xf77a('0x4e')];_0x268152+=0x1){socket[_0xf77a('0xc2')](_0xf77a('0xc6'),{'UserId':Number(_0x122948[_0xf77a('0x49')][_0xf77a('0x73')][_0x268152]),'FaxAccountId':Number(_0x122948[_0xf77a('0x5b')]['id'])});}}else{socket[_0xf77a('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x122948[_0xf77a('0x49')][_0xf77a('0x73')]),'FaxAccountId':Number(_0x122948['params']['id'])});}});}})['then'](respondWithStatusCode(_0x248d58,null))[_0xf77a('0x5d')](handleError(_0x248d58,null));};exports[_0xf77a('0xc7')]=function(_0x2d9089,_0x2221ed,_0x56b400){var _0x170dbb={};var _0x1efa70={};var _0x20f537;var _0x3dc91f;return db['FaxAccount']['findOne']({'where':{'id':_0x2d9089[_0xf77a('0x5b')]['id']}})[_0xf77a('0x23')](handleEntityNotFound(_0x2221ed,null))['then'](function(_0x57b891){if(_0x57b891){_0x20f537=_0x57b891;_0x1efa70['model']=_['keys'](db[_0xf77a('0x78')]['rawAttributes']);_0x1efa70['query']=_[_0xf77a('0x48')](_0x2d9089[_0xf77a('0x49')]);_0x1efa70['filters']=_[_0xf77a('0x4b')](_0x1efa70[_0xf77a('0x47')],_0x1efa70[_0xf77a('0x49')]);_0x170dbb[_0xf77a('0x4d')]=_['intersection'](_0x1efa70[_0xf77a('0x47')],qs[_0xf77a('0x4c')](_0x2d9089[_0xf77a('0x49')][_0xf77a('0x4c')]));_0x170dbb['attributes']=_0x170dbb[_0xf77a('0x4d')][_0xf77a('0x4e')]?_0x170dbb[_0xf77a('0x4d')]:_0x1efa70[_0xf77a('0x47')];_0x170dbb[_0xf77a('0x51')]=qs[_0xf77a('0x52')](_0x2d9089[_0xf77a('0x49')]['sort']);_0x170dbb[_0xf77a('0x55')]=qs['filters'](_[_0xf77a('0x53')](_0x2d9089['query'],_0x1efa70['filters']));if(_0x2d9089['query'][_0xf77a('0x54')]){_0x170dbb[_0xf77a('0x55')]=_['merge'](_0x170dbb['where'],{'$or':_[_0xf77a('0x41')](_0x170dbb[_0xf77a('0x4d')],function(_0x33e281){var _0x23ab9c={};_0x23ab9c[_0x33e281]={'$like':'%'+_0x2d9089['query'][_0xf77a('0x54')]+'%'};return _0x23ab9c;})});}_0x170dbb=_[_0xf77a('0x56')]({},_0x170dbb,_0x2d9089[_0xf77a('0x57')]);return _0x20f537['getAgents'](_0x170dbb);}})[_0xf77a('0x23')](function(_0xd15745){if(_0xd15745){_0x3dc91f=_0xd15745[_0xf77a('0x4e')];if(!_0x2d9089[_0xf77a('0x49')]['hasOwnProperty'](_0xf77a('0x50'))){_0x170dbb['limit']=qs[_0xf77a('0x30')](_0x2d9089['query'][_0xf77a('0x30')]);_0x170dbb['offset']=qs['offset'](_0x2d9089[_0xf77a('0x49')]['offset']);}return _0x20f537['getAgents'](_0x170dbb);}})[_0xf77a('0x23')](function(_0x1d2b45){if(_0x1d2b45){return _0x1d2b45?{'count':_0x3dc91f,'rows':_0x1d2b45}:null;}})[_0xf77a('0x23')](respondWithResult(_0x2221ed,null))[_0xf77a('0x5d')](handleError(_0x2221ed,null));}; \ No newline at end of file +var _0xf702=['update','get','FaxAccounts','UserProfileResource','destroy','end','stack','name','Pause','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','send','getApplications','context','from-voip-provider','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','minrate','modem','Wait','transaction','VoiceExtension','tech','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','isArray','emit','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','crypto','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','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save'];(function(_0x817388,_0x58547f){var _0x12d106=function(_0x41914a){while(--_0x41914a){_0x817388['push'](_0x817388['shift']());}};_0x12d106(++_0x58547f);}(_0xf702,0x147));var _0x2f70=function(_0x2046d9,_0x25f636){_0x2046d9=_0x2046d9-0x0;var _0x5d2754=_0xf702[_0x2046d9];return _0x5d2754;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f70('0x0'));var zipdir=require(_0x2f70('0x1'));var jsonpatch=require(_0x2f70('0x2'));var rp=require(_0x2f70('0x3'));var moment=require('moment');var BPromise=require(_0x2f70('0x4'));var Mustache=require(_0x2f70('0x5'));var util=require(_0x2f70('0x6'));var path=require(_0x2f70('0x7'));var sox=require('sox');var csv=require(_0x2f70('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f70('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2f70('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f70('0x8'));var querystring=require(_0x2f70('0xb'));var Papa=require(_0x2f70('0xc'));var Redis=require(_0x2f70('0xd'));var authService=require(_0x2f70('0xe'));var qs=require(_0x2f70('0xf'));var as=require(_0x2f70('0x10'));var hardwareService=require(_0x2f70('0x11'));var logger=require(_0x2f70('0x12'))(_0x2f70('0x13'));var utils=require(_0x2f70('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2f70('0x15'));var db=require(_0x2f70('0x16'))['db'];config['redis']=_['defaults'](config[_0x2f70('0x17')],{'host':_0x2f70('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f70('0x17')]));require(_0x2f70('0x19'))[_0x2f70('0x1a')](socket);var jayson=require(_0x2f70('0x1b'));var client=jayson[_0x2f70('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x2f70('0x1c')][_0x2f70('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x32419b,_0x3312fc,_0x1e854f,_0x491a32){return new BPromise(function(_0x13f526,_0x4a4b1b){var _0x1fb606=_0x491a32||client;return _0x1fb606[_0x2f70('0x1e')](_0x32419b,_0x1e854f)[_0x2f70('0x1f')](function(_0x9f0cd4){logger[_0x2f70('0x20')](_0x2f70('0x21'),_0x3312fc,'request\x20sent');logger[_0x2f70('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3312fc,_0x2f70('0x23'),JSON[_0x2f70('0x24')](_0x9f0cd4));if(_0x9f0cd4['error']){if(_0x9f0cd4[_0x2f70('0x25')][_0x2f70('0x26')]===0x1f4){logger[_0x2f70('0x25')](_0x2f70('0x21'),_0x3312fc,_0x9f0cd4[_0x2f70('0x25')][_0x2f70('0x27')]);return _0x4a4b1b(_0x9f0cd4['error'][_0x2f70('0x27')]);}logger[_0x2f70('0x25')](_0x2f70('0x21'),_0x3312fc,_0x9f0cd4[_0x2f70('0x25')][_0x2f70('0x27')]);return _0x13f526(_0x9f0cd4[_0x2f70('0x25')][_0x2f70('0x27')]);}else{logger['info'](_0x2f70('0x21'),_0x3312fc,'request\x20sent');_0x13f526(_0x9f0cd4['result']['message']);}})['catch'](function(_0x2159a5){logger[_0x2f70('0x25')]('FaxAccount,\x20%s,\x20%s',_0x3312fc,_0x2159a5);_0x4a4b1b(_0x2159a5);});});}function respondWithStatusCode(_0x1b7ca2,_0x3f6c7e){_0x3f6c7e=_0x3f6c7e||0xcc;return function(_0x2a3a68){if(_0x2a3a68){return _0x1b7ca2[_0x2f70('0x28')](_0x3f6c7e);}return _0x1b7ca2[_0x2f70('0x29')](_0x3f6c7e)['end']();};}function respondWithResult(_0x84e154,_0xfcf51){_0xfcf51=_0xfcf51||0xc8;return function(_0x3fcbdb){if(_0x3fcbdb){return _0x84e154[_0x2f70('0x29')](_0xfcf51)[_0x2f70('0x2a')](_0x3fcbdb);}};}function respondWithFilteredResult(_0x20a6a4,_0x2d0e14){return function(_0xc35c68){if(_0xc35c68){var _0xbc5a85=typeof _0x2d0e14[_0x2f70('0x2b')]===_0x2f70('0x2c')&&typeof _0x2d0e14[_0x2f70('0x2d')]===_0x2f70('0x2c');var _0x53263e=_0xc35c68['count'];var _0x1e2272=_0xbc5a85?0x0:_0x2d0e14[_0x2f70('0x2b')];var _0x44aaac=_0xbc5a85?_0xc35c68['count']:_0x2d0e14['offset']+_0x2d0e14[_0x2f70('0x2d')];var _0x1969cc;if(_0x44aaac>=_0x53263e){_0x44aaac=_0x53263e;_0x1969cc=0xc8;}else{_0x1969cc=0xce;}_0x20a6a4[_0x2f70('0x29')](_0x1969cc);return _0x20a6a4[_0x2f70('0x2e')](_0x2f70('0x2f'),_0x1e2272+'-'+_0x44aaac+'/'+_0x53263e)[_0x2f70('0x2a')](_0xc35c68);}return null;};}function patchUpdates(_0xf44841){return function(_0x1e2624){try{jsonpatch[_0x2f70('0x30')](_0x1e2624,_0xf44841,!![]);}catch(_0x1817ee){return BPromise[_0x2f70('0x31')](_0x1817ee);}return _0x1e2624[_0x2f70('0x32')]();};}function saveUpdates(_0x445da4,_0x57a7ec){return function(_0x374350){if(_0x374350){return _0x374350[_0x2f70('0x33')](_0x445da4)[_0x2f70('0x1f')](function(_0x12bd2a){return _0x12bd2a;});}return null;};}function removeEntity(_0x453d84,_0x7e4ef9){return function(_0x4f2ddf){if(_0x4f2ddf){return _0x4f2ddf['destroy']()[_0x2f70('0x1f')](function(){var _0x5e2999=_0x4f2ddf[_0x2f70('0x34')]({'plain':!![]});var _0x77b187=_0x2f70('0x35');return db[_0x2f70('0x36')][_0x2f70('0x37')]({'where':{'type':_0x77b187,'resourceId':_0x5e2999['id']}})[_0x2f70('0x1f')](function(){return _0x4f2ddf;});})[_0x2f70('0x1f')](function(){_0x453d84[_0x2f70('0x29')](0xcc)[_0x2f70('0x38')]();});}};}function handleEntityNotFound(_0xee9293,_0x50530c){return function(_0x2c81e6){if(!_0x2c81e6){_0xee9293[_0x2f70('0x28')](0x194);}return _0x2c81e6;};}function handleError(_0x820d9c,_0x156c0a){_0x156c0a=_0x156c0a||0x1f4;return function(_0x651371){logger[_0x2f70('0x25')](_0x651371[_0x2f70('0x39')]);if(_0x651371[_0x2f70('0x3a')]){delete _0x651371[_0x2f70('0x3a')];}_0x820d9c['status'](_0x156c0a)['send'](_0x651371);};}exports['index']=function(_0x453017,_0x1de8f8){var _0x4d580b={'include':[{'model':db[_0x2f70('0x3b')],'as':'mandatoryDispositionPause'}]},_0x295093={},_0x31ad5c={'count':0x0,'rows':[]};var _0x36bbf0=_[_0x2f70('0x3c')](db[_0x2f70('0x3d')][_0x2f70('0x3e')],function(_0x4c00ce){return{'name':_0x4c00ce['fieldName'],'type':_0x4c00ce[_0x2f70('0x3f')][_0x2f70('0x40')]};});_0x295093[_0x2f70('0x41')]=_[_0x2f70('0x3c')](_0x36bbf0,_0x2f70('0x3a'));_0x295093[_0x2f70('0x42')]=_[_0x2f70('0x43')](_0x453017[_0x2f70('0x42')]);_0x295093[_0x2f70('0x44')]=_[_0x2f70('0x45')](_0x295093[_0x2f70('0x41')],_0x295093[_0x2f70('0x42')]);_0x4d580b[_0x2f70('0x46')]=_[_0x2f70('0x45')](_0x295093[_0x2f70('0x41')],qs['fields'](_0x453017[_0x2f70('0x42')][_0x2f70('0x47')]));_0x4d580b[_0x2f70('0x46')]=_0x4d580b[_0x2f70('0x46')][_0x2f70('0x48')]?_0x4d580b['attributes']:_0x295093[_0x2f70('0x41')];if(!_0x453017['query'][_0x2f70('0x49')](_0x2f70('0x4a'))){_0x4d580b['limit']=qs[_0x2f70('0x2d')](_0x453017[_0x2f70('0x42')][_0x2f70('0x2d')]);_0x4d580b[_0x2f70('0x2b')]=qs[_0x2f70('0x2b')](_0x453017[_0x2f70('0x42')][_0x2f70('0x2b')]);}_0x4d580b['order']=qs[_0x2f70('0x4b')](_0x453017['query'][_0x2f70('0x4b')]);_0x4d580b[_0x2f70('0x4c')]=qs[_0x2f70('0x44')](_[_0x2f70('0x4d')](_0x453017[_0x2f70('0x42')],_0x295093[_0x2f70('0x44')]),_0x36bbf0);if(_0x453017[_0x2f70('0x42')][_0x2f70('0x4e')]){_0x4d580b[_0x2f70('0x4c')]=_[_0x2f70('0x4f')](_0x4d580b['where'],{'$or':_[_0x2f70('0x3c')](_0x36bbf0,function(_0x35f66b){if(_0x35f66b[_0x2f70('0x3f')]!=='VIRTUAL'){var _0x5ae08a={};_0x5ae08a[_0x35f66b[_0x2f70('0x3a')]]={'$like':'%'+_0x453017[_0x2f70('0x42')][_0x2f70('0x4e')]+'%'};return _0x5ae08a;}})});}_0x4d580b=_[_0x2f70('0x4f')]({},_0x4d580b,_0x453017[_0x2f70('0x50')]);var _0x366fd2={'where':_0x4d580b[_0x2f70('0x4c')]};return db[_0x2f70('0x3d')][_0x2f70('0x51')](_0x366fd2)[_0x2f70('0x1f')](function(_0x26170f){_0x31ad5c[_0x2f70('0x51')]=_0x26170f;if(_0x453017['query'][_0x2f70('0x52')]){_0x4d580b[_0x2f70('0x53')]=[{'all':!![]}];}return db[_0x2f70('0x3d')][_0x2f70('0x54')](_0x4d580b);})[_0x2f70('0x1f')](function(_0x43d98d){_0x31ad5c[_0x2f70('0x55')]=_0x43d98d;return _0x31ad5c;})['then'](respondWithFilteredResult(_0x1de8f8,_0x4d580b))[_0x2f70('0x56')](handleError(_0x1de8f8,null));};exports[_0x2f70('0x57')]=function(_0x3fc9c1,_0x2dde5b){var _0x5a1c27={'raw':![],'where':{'id':_0x3fc9c1[_0x2f70('0x58')]['id']},'include':[{'model':db[_0x2f70('0x3b')],'as':_0x2f70('0x59')}]},_0x1ad993={};_0x1ad993[_0x2f70('0x41')]=_[_0x2f70('0x43')](db['FaxAccount']['rawAttributes']);_0x1ad993['query']=_[_0x2f70('0x43')](_0x3fc9c1['query']);_0x1ad993['filters']=_[_0x2f70('0x45')](_0x1ad993[_0x2f70('0x41')],_0x1ad993[_0x2f70('0x42')]);_0x5a1c27[_0x2f70('0x46')]=_[_0x2f70('0x45')](_0x1ad993[_0x2f70('0x41')],qs[_0x2f70('0x47')](_0x3fc9c1[_0x2f70('0x42')][_0x2f70('0x47')]));_0x5a1c27['attributes']=_0x5a1c27[_0x2f70('0x46')]['length']?_0x5a1c27[_0x2f70('0x46')]:_0x1ad993['model'];if(_0x3fc9c1[_0x2f70('0x42')][_0x2f70('0x52')]){_0x5a1c27[_0x2f70('0x53')]=[{'all':!![]}];}_0x5a1c27=_[_0x2f70('0x4f')]({},_0x5a1c27,_0x3fc9c1['options']);return db['FaxAccount'][_0x2f70('0x5a')](_0x5a1c27)['then'](handleEntityNotFound(_0x2dde5b,null))[_0x2f70('0x1f')](respondWithResult(_0x2dde5b,null))[_0x2f70('0x56')](handleError(_0x2dde5b,null));};exports[_0x2f70('0x5b')]=function(_0x41ffa6,_0x29b63d){return db['FaxAccount']['create'](_0x41ffa6[_0x2f70('0x5c')],{})[_0x2f70('0x1f')](function(_0x3bb3ed){var _0x6cfa6c=_0x41ffa6[_0x2f70('0x5d')][_0x2f70('0x34')]({'plain':!![]});if(!_0x6cfa6c)throw new Error(_0x2f70('0x5e'));if(_0x6cfa6c[_0x2f70('0x5f')]===_0x2f70('0x5d')){var _0x174e09=_0x3bb3ed[_0x2f70('0x34')]({'plain':!![]});var _0x232e61='FaxAccounts';return db[_0x2f70('0x60')][_0x2f70('0x5a')]({'where':{'name':_0x232e61,'userProfileId':_0x6cfa6c[_0x2f70('0x61')]},'raw':!![]})['then'](function(_0x21f810){if(_0x21f810&&_0x21f810['autoAssociation']===0x0){return db[_0x2f70('0x36')][_0x2f70('0x5b')]({'name':_0x174e09[_0x2f70('0x3a')],'resourceId':_0x174e09['id'],'type':_0x21f810[_0x2f70('0x3a')],'sectionId':_0x21f810['id']},{})['then'](function(){return _0x3bb3ed;});}else{return _0x3bb3ed;}})[_0x2f70('0x56')](function(_0xe2389f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe2389f);throw _0xe2389f;});}return _0x3bb3ed;})['then'](respondWithResult(_0x29b63d,0xc9))[_0x2f70('0x56')](handleError(_0x29b63d,null));};exports[_0x2f70('0x33')]=function(_0xb9d0c2,_0x282547){if(_0xb9d0c2[_0x2f70('0x5c')]['id']){delete _0xb9d0c2[_0x2f70('0x5c')]['id'];}return db[_0x2f70('0x3d')][_0x2f70('0x5a')]({'where':{'id':_0xb9d0c2[_0x2f70('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x2f70('0x59')}]})[_0x2f70('0x1f')](handleEntityNotFound(_0x282547,null))[_0x2f70('0x1f')](saveUpdates(_0xb9d0c2['body'],null))[_0x2f70('0x1f')](respondWithResult(_0x282547,null))[_0x2f70('0x56')](handleError(_0x282547,null));};exports['destroy']=function(_0x1f23ce,_0x195a64){return db[_0x2f70('0x3d')][_0x2f70('0x5a')]({'where':{'id':_0x1f23ce[_0x2f70('0x58')]['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x195a64,null))['then'](removeEntity(_0x195a64,null))[_0x2f70('0x56')](handleError(_0x195a64,null));};exports['describe']=function(_0x194779,_0x12d49e){return db[_0x2f70('0x3d')][_0x2f70('0x62')]()['then'](respondWithResult(_0x12d49e,null))['catch'](handleError(_0x12d49e,null));};exports[_0x2f70('0x63')]=function(_0x56472e,_0x4c2824,_0x3ae532){if(_0x56472e['body']['id']){delete _0x56472e['body']['id'];}return db[_0x2f70('0x3d')][_0x2f70('0x5a')]({'where':{'id':_0x56472e['params']['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x4c2824,null))[_0x2f70('0x1f')](function(_0x4fc492){if(_0x4fc492){_0x56472e[_0x2f70('0x5c')][_0x2f70('0x64')]=_0x4fc492['id'];return db[_0x2f70('0x65')][_0x2f70('0x5b')](_0x56472e[_0x2f70('0x5c')]);}})['then'](respondWithResult(_0x4c2824,null))['catch'](handleError(_0x4c2824,null));};exports[_0x2f70('0x66')]=function(_0x203d3b,_0x50e50b,_0x2348a5){var _0x587c2b={'raw':![],'where':{}};var _0x2329f2={};var _0x136797={'count':0x0,'rows':[]};return db[_0x2f70('0x3d')][_0x2f70('0x67')]({'where':{'id':_0x203d3b[_0x2f70('0x58')]['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x50e50b,null))[_0x2f70('0x1f')](function(_0x2c5052){if(_0x2c5052){_0x2329f2[_0x2f70('0x41')]=_[_0x2f70('0x43')](db[_0x2f70('0x65')]['rawAttributes']);_0x2329f2[_0x2f70('0x42')]=_[_0x2f70('0x43')](_0x203d3b[_0x2f70('0x42')]);_0x2329f2[_0x2f70('0x44')]=_[_0x2f70('0x45')](_0x2329f2[_0x2f70('0x41')],_0x2329f2[_0x2f70('0x42')]);_0x587c2b[_0x2f70('0x46')]=_[_0x2f70('0x45')](_0x2329f2[_0x2f70('0x41')],qs[_0x2f70('0x47')](_0x203d3b['query'][_0x2f70('0x47')]));_0x587c2b['attributes']=_0x587c2b[_0x2f70('0x46')]['length']?_0x587c2b['attributes']:_0x2329f2[_0x2f70('0x41')];if(!_0x203d3b[_0x2f70('0x42')][_0x2f70('0x49')](_0x2f70('0x4a'))){_0x587c2b[_0x2f70('0x2d')]=qs[_0x2f70('0x2d')](_0x203d3b[_0x2f70('0x42')][_0x2f70('0x2d')]);_0x587c2b['offset']=qs[_0x2f70('0x2b')](_0x203d3b[_0x2f70('0x42')][_0x2f70('0x2b')]);}_0x587c2b[_0x2f70('0x68')]=qs['sort'](_0x203d3b[_0x2f70('0x42')]['sort']);_0x587c2b[_0x2f70('0x4c')]=qs[_0x2f70('0x44')](_['pick'](_0x203d3b[_0x2f70('0x42')],_0x2329f2[_0x2f70('0x44')]));_0x587c2b[_0x2f70('0x4c')]['FaxAccountId']=_0x2c5052['id'];if(_0x203d3b['query'][_0x2f70('0x4e')]){_0x587c2b['where']=_[_0x2f70('0x4f')](_0x587c2b['where'],{'$or':_['map'](_0x587c2b[_0x2f70('0x46')],function(_0x166771){var _0x5495da={};_0x5495da[_0x166771]={'$like':'%'+_0x203d3b[_0x2f70('0x42')][_0x2f70('0x4e')]+'%'};return _0x5495da;})});}_0x587c2b=_[_0x2f70('0x4f')]({},_0x587c2b,_0x203d3b['options']);return db['Disposition'][_0x2f70('0x51')]({'where':_0x587c2b[_0x2f70('0x4c')]})[_0x2f70('0x1f')](function(_0x550093){_0x136797[_0x2f70('0x51')]=_0x550093;if(_0x203d3b['query'][_0x2f70('0x52')]){_0x587c2b[_0x2f70('0x53')]=[{'all':!![]}];}return db[_0x2f70('0x65')][_0x2f70('0x54')](_0x587c2b);})['then'](function(_0x1a7b65){_0x136797['rows']=_0x1a7b65;return _0x136797;});}})[_0x2f70('0x1f')](respondWithFilteredResult(_0x50e50b,_0x587c2b))[_0x2f70('0x56')](handleError(_0x50e50b,null));};exports[_0x2f70('0x69')]=function(_0x76f89d,_0x3620fe,_0x36f149){return db['FaxAccount'][_0x2f70('0x5a')]({'where':{'id':_0x76f89d[_0x2f70('0x58')]['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x3620fe,null))['then'](function(_0x58074e){if(_0x58074e){return _0x58074e['removeDispositions'](_0x76f89d[_0x2f70('0x42')][_0x2f70('0x6a')]);}})[_0x2f70('0x1f')](respondWithStatusCode(_0x3620fe,null))[_0x2f70('0x56')](handleError(_0x3620fe,null));};exports['addAnswer']=function(_0x53f6a5,_0x48a6a3,_0x4671ef){if(_0x53f6a5[_0x2f70('0x5c')]['id']){delete _0x53f6a5[_0x2f70('0x5c')]['id'];}return db['FaxAccount'][_0x2f70('0x5a')]({'where':{'id':_0x53f6a5['params']['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x48a6a3,null))[_0x2f70('0x1f')](function(_0xd286dd){if(_0xd286dd){_0x53f6a5[_0x2f70('0x5c')][_0x2f70('0x64')]=_0xd286dd['id'];return db[_0x2f70('0x6b')][_0x2f70('0x5b')](_0x53f6a5[_0x2f70('0x5c')]);}})[_0x2f70('0x1f')](respondWithResult(_0x48a6a3,null))[_0x2f70('0x56')](handleError(_0x48a6a3,null));};exports[_0x2f70('0x6c')]=function(_0x4dbe20,_0x37b780,_0xb0a56d){var _0x26bf06={'raw':![],'where':{}};var _0x33148e={};var _0x32d4ad={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2f70('0x67')]({'where':{'id':_0x4dbe20['params']['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x37b780,null))['then'](function(_0x12cb28){if(_0x12cb28){_0x33148e[_0x2f70('0x41')]=_['keys'](db[_0x2f70('0x6b')][_0x2f70('0x3e')]);_0x33148e['query']=_[_0x2f70('0x43')](_0x4dbe20[_0x2f70('0x42')]);_0x33148e[_0x2f70('0x44')]=_[_0x2f70('0x45')](_0x33148e[_0x2f70('0x41')],_0x33148e[_0x2f70('0x42')]);_0x26bf06[_0x2f70('0x46')]=_[_0x2f70('0x45')](_0x33148e[_0x2f70('0x41')],qs[_0x2f70('0x47')](_0x4dbe20[_0x2f70('0x42')][_0x2f70('0x47')]));_0x26bf06[_0x2f70('0x46')]=_0x26bf06['attributes'][_0x2f70('0x48')]?_0x26bf06[_0x2f70('0x46')]:_0x33148e[_0x2f70('0x41')];if(!_0x4dbe20[_0x2f70('0x42')]['hasOwnProperty']('nolimit')){_0x26bf06[_0x2f70('0x2d')]=qs['limit'](_0x4dbe20[_0x2f70('0x42')][_0x2f70('0x2d')]);_0x26bf06[_0x2f70('0x2b')]=qs[_0x2f70('0x2b')](_0x4dbe20['query']['offset']);}_0x26bf06[_0x2f70('0x68')]=qs[_0x2f70('0x4b')](_0x4dbe20['query'][_0x2f70('0x4b')]);_0x26bf06[_0x2f70('0x4c')]=qs[_0x2f70('0x44')](_[_0x2f70('0x4d')](_0x4dbe20[_0x2f70('0x42')],_0x33148e['filters']));_0x26bf06['where']['FaxAccountId']=_0x12cb28['id'];if(_0x4dbe20[_0x2f70('0x42')]['filter']){_0x26bf06[_0x2f70('0x4c')]=_['merge'](_0x26bf06[_0x2f70('0x4c')],{'$or':_['map'](_0x26bf06[_0x2f70('0x46')],function(_0x4fc7d8){var _0x49c3a8={};_0x49c3a8[_0x4fc7d8]={'$like':'%'+_0x4dbe20['query'][_0x2f70('0x4e')]+'%'};return _0x49c3a8;})});}_0x26bf06=_[_0x2f70('0x4f')]({},_0x26bf06,_0x4dbe20[_0x2f70('0x50')]);return db[_0x2f70('0x6b')][_0x2f70('0x51')]({'where':_0x26bf06[_0x2f70('0x4c')]})[_0x2f70('0x1f')](function(_0x23122c){_0x32d4ad[_0x2f70('0x51')]=_0x23122c;if(_0x4dbe20['query'][_0x2f70('0x52')]){_0x26bf06['include']=[{'all':!![]}];}return db[_0x2f70('0x6b')][_0x2f70('0x54')](_0x26bf06);})[_0x2f70('0x1f')](function(_0x3ae469){_0x32d4ad['rows']=_0x3ae469;return _0x32d4ad;});}})[_0x2f70('0x1f')](respondWithFilteredResult(_0x37b780,_0x26bf06))[_0x2f70('0x56')](handleError(_0x37b780,null));};exports[_0x2f70('0x6d')]=function(_0x250123,_0x3085a4,_0x21052c){return db[_0x2f70('0x3d')]['find']({'where':{'id':_0x250123[_0x2f70('0x58')]['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x3085a4,null))[_0x2f70('0x1f')](function(_0x63c443){if(_0x63c443){return _0x63c443[_0x2f70('0x6d')](_0x250123[_0x2f70('0x42')][_0x2f70('0x6a')]);}})['then'](respondWithStatusCode(_0x3085a4,null))['catch'](handleError(_0x3085a4,null));};exports[_0x2f70('0x6e')]=function(_0x599cab,_0x1b827b,_0x43d108){return db['FaxInteraction'][_0x2f70('0x5a')]({'where':{'id':_0x599cab[_0x2f70('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b827b,null))[_0x2f70('0x1f')](function(_0x1af487){if(_0x1af487){return _0x1af487[_0x2f70('0x6e')](_0x599cab[_0x2f70('0x5c')]['ids'],_[_0x2f70('0x6f')](_0x599cab[_0x2f70('0x5c')],[_0x2f70('0x6a'),'id'])||{});}})[_0x2f70('0x1f')](respondWithResult(_0x1b827b,null))['catch'](handleError(_0x1b827b,null));};exports[_0x2f70('0x70')]=function(_0x220ee1,_0x101e67,_0x334a49){var _0x108780={'raw':![],'where':{}};var _0x43f3cb={};var _0x51b19a={'count':0x0,'rows':[]};return db[_0x2f70('0x3d')][_0x2f70('0x67')]({'where':{'id':_0x220ee1[_0x2f70('0x58')]['id']}})['then'](handleEntityNotFound(_0x101e67,null))[_0x2f70('0x1f')](function(_0x41a4fc){if(_0x41a4fc){_0x43f3cb[_0x2f70('0x41')]=_[_0x2f70('0x43')](db[_0x2f70('0x71')][_0x2f70('0x3e')]);_0x43f3cb['query']=_[_0x2f70('0x43')](_0x220ee1['query']);_0x43f3cb['filters']=_[_0x2f70('0x45')](_0x43f3cb[_0x2f70('0x41')],_0x43f3cb['query']);_0x108780['attributes']=_[_0x2f70('0x45')](_0x43f3cb[_0x2f70('0x41')],qs['fields'](_0x220ee1[_0x2f70('0x42')][_0x2f70('0x47')]));_0x108780[_0x2f70('0x46')]=_0x108780['attributes'][_0x2f70('0x48')]?_0x108780[_0x2f70('0x46')]:_0x43f3cb[_0x2f70('0x41')];if(!_0x220ee1[_0x2f70('0x42')][_0x2f70('0x49')](_0x2f70('0x4a'))){_0x108780['limit']=qs[_0x2f70('0x2d')](_0x220ee1['query'][_0x2f70('0x2d')]);_0x108780[_0x2f70('0x2b')]=qs[_0x2f70('0x2b')](_0x220ee1[_0x2f70('0x42')][_0x2f70('0x2b')]);}_0x108780[_0x2f70('0x68')]=qs[_0x2f70('0x4b')](_0x220ee1[_0x2f70('0x42')]['sort']);_0x108780['where']=qs['filters'](_[_0x2f70('0x4d')](_0x220ee1[_0x2f70('0x42')],_0x43f3cb[_0x2f70('0x44')]));_0x108780['where']['FaxAccountId']=_0x41a4fc['id'];if(_0x220ee1['query'][_0x2f70('0x4e')]){_0x108780[_0x2f70('0x4c')]=_['merge'](_0x108780[_0x2f70('0x4c')],{'$or':_[_0x2f70('0x3c')](_0x108780[_0x2f70('0x46')],function(_0x143077){var _0x14aca8={};_0x14aca8[_0x143077]={'$like':'%'+_0x220ee1['query'][_0x2f70('0x4e')]+'%'};return _0x14aca8;})});}_0x108780=_['merge']({},_0x108780,_0x220ee1[_0x2f70('0x50')]);return db['FaxInteraction'][_0x2f70('0x51')]({'where':_0x108780[_0x2f70('0x4c')]})[_0x2f70('0x1f')](function(_0xe6eeba){_0x51b19a[_0x2f70('0x51')]=_0xe6eeba;if(_0x220ee1[_0x2f70('0x42')][_0x2f70('0x52')]){_0x108780[_0x2f70('0x53')]=[{'model':db[_0x2f70('0x72')],'as':_0x2f70('0x73'),'required':![]},{'model':db[_0x2f70('0x74')],'as':_0x2f70('0x75'),'attributes':[_0x2f70('0x3a'),_0x2f70('0x76'),'internal'],'required':![]},{'model':db[_0x2f70('0x77')],'as':_0x2f70('0x78'),'attributes':['id',_0x2f70('0x3a'),'color'],'where':_0x220ee1[_0x2f70('0x42')][_0x2f70('0x79')]?{'id':_0x220ee1[_0x2f70('0x42')][_0x2f70('0x79')]}:undefined,'required':_0x220ee1['query'][_0x2f70('0x79')]?!![]:![]}];}return db[_0x2f70('0x71')]['findAll'](_0x108780);})[_0x2f70('0x1f')](function(_0x44a984){_0x51b19a[_0x2f70('0x55')]=_0x44a984;return _0x51b19a;});}})[_0x2f70('0x1f')](respondWithFilteredResult(_0x101e67,_0x108780))[_0x2f70('0x56')](handleError(_0x101e67,null));};exports[_0x2f70('0x7a')]=function(_0x50bf95,_0x52b12d){var _0x4bc533=_0x50bf95[_0x2f70('0x58')]['id'];var _0x31130b=_0x50bf95[_0x2f70('0x5c')];var _0x41292c=0xc8;var _0x506c9f=null;return db[_0x2f70('0x7b')]['transaction']({'isolationLevel':db[_0x2f70('0x7b')][_0x2f70('0x7c')]['ISOLATION_LEVELS'][_0x2f70('0x7d')]},function(_0x24f4bd){return db[_0x2f70('0x3d')][_0x2f70('0x67')]({'where':{'id':_0x4bc533},'transaction':_0x24f4bd})[_0x2f70('0x1f')](function(_0x4b3678){if(_0x4b3678){return db[_0x2f70('0x7e')][_0x2f70('0x37')]({'where':{'FaxAccountId':_0x4bc533},'transaction':_0x24f4bd})[_0x2f70('0x1f')](function(){var _0x414fd7=_['map'](_0x31130b,function(_0x5edef3){_0x5edef3[_0x2f70('0x64')]=_0x4bc533;return _0x5edef3;});return db[_0x2f70('0x7e')][_0x2f70('0x7f')](_0x414fd7,{'transaction':_0x24f4bd});});}else{_0x41292c=0x194;_0x506c9f=[];}});})[_0x2f70('0x1f')](function(){if(_0x41292c!==0x194){return db[_0x2f70('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0x4bc533},'order':_0x2f70('0x80')})[_0x2f70('0x1f')](function(_0x2ee2b0){_0x506c9f=_0x2ee2b0;});}})['catch'](function(_0x48c48b){_0x41292c=0x1f4;logger[_0x2f70('0x25')](_0x48c48b['stack']);if(_0x48c48b[_0x2f70('0x3a')]){delete _0x48c48b[_0x2f70('0x3a')];}_0x506c9f=_0x48c48b;})[_0x2f70('0x81')](function(){if(_0x506c9f===null){_0x52b12d[_0x2f70('0x28')](_0x41292c);}else{if(_0x41292c===0x1f4){_0x52b12d[_0x2f70('0x29')](_0x41292c)[_0x2f70('0x82')](_0x506c9f);}else{_0x52b12d[_0x2f70('0x29')](_0x41292c)[_0x2f70('0x2a')](_0x506c9f);}}});};exports[_0x2f70('0x83')]=function(_0x5f2a6e,_0x461bac,_0x1da9f2){var _0x38b8d7={};var _0x4c180a={};var _0x2818e7;var _0x5df2ab;return db['FaxAccount'][_0x2f70('0x67')]({'where':{'id':_0x5f2a6e['params']['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x461bac,null))[_0x2f70('0x1f')](function(_0x4801d7){if(_0x4801d7){_0x2818e7=_0x4801d7;_0x4c180a['model']=_[_0x2f70('0x43')](db[_0x2f70('0x7e')][_0x2f70('0x3e')]);_0x4c180a[_0x2f70('0x42')]=_['keys'](_0x5f2a6e['query']);_0x4c180a[_0x2f70('0x44')]=_[_0x2f70('0x45')](_0x4c180a['model'],_0x4c180a[_0x2f70('0x42')]);_0x38b8d7[_0x2f70('0x46')]=_[_0x2f70('0x45')](_0x4c180a['model'],qs[_0x2f70('0x47')](_0x5f2a6e[_0x2f70('0x42')][_0x2f70('0x47')]));_0x38b8d7['attributes']=_0x38b8d7['attributes']['length']?_0x38b8d7['attributes']:_0x4c180a[_0x2f70('0x41')];_0x38b8d7[_0x2f70('0x68')]=qs['sort'](_0x5f2a6e[_0x2f70('0x42')]['sort']);_0x38b8d7[_0x2f70('0x4c')]=qs['filters'](_['pick'](_0x5f2a6e[_0x2f70('0x42')],_0x4c180a['filters']));if(_0x5f2a6e[_0x2f70('0x42')][_0x2f70('0x4e')]){_0x38b8d7[_0x2f70('0x4c')]=_['merge'](_0x38b8d7[_0x2f70('0x4c')],{'$or':_['map'](_0x38b8d7[_0x2f70('0x46')],function(_0x24b737){var _0xf5dff={};_0xf5dff[_0x24b737]={'$like':'%'+_0x5f2a6e[_0x2f70('0x42')][_0x2f70('0x4e')]+'%'};return _0xf5dff;})});}_0x38b8d7=_[_0x2f70('0x4f')]({},_0x38b8d7,_0x5f2a6e[_0x2f70('0x50')]);return _0x2818e7[_0x2f70('0x83')](_0x38b8d7);}})[_0x2f70('0x1f')](function(_0x13e6c2){if(_0x13e6c2){_0x5df2ab=_0x13e6c2[_0x2f70('0x48')];if(!_0x5f2a6e[_0x2f70('0x42')]['hasOwnProperty']('nolimit')){_0x38b8d7[_0x2f70('0x2d')]=qs[_0x2f70('0x2d')](_0x5f2a6e['query']['limit']);_0x38b8d7[_0x2f70('0x2b')]=qs[_0x2f70('0x2b')](_0x5f2a6e[_0x2f70('0x42')][_0x2f70('0x2b')]);}return _0x2818e7[_0x2f70('0x83')](_0x38b8d7);}})['then'](function(_0x168d96){if(_0x168d96){return _0x168d96?{'count':_0x5df2ab,'rows':_0x168d96}:null;}})[_0x2f70('0x1f')](respondWithResult(_0x461bac,null))[_0x2f70('0x56')](handleError(_0x461bac,null));};function Extension(_0x2a166d,_0x22a6a5,_0xbeb913,_0x33e4bd){this[_0x2f70('0x84')]=_0x2f70('0x85');this['exten']=_0x2a166d[_0x2f70('0x86')];this[_0x2f70('0x87')]=_0x33e4bd;this[_0x2f70('0x3f')]='system';this[_0x2f70('0x88')]=_0x2f70('0x89');this[_0x2f70('0x64')]=_0x2a166d['id'];this[_0x2f70('0x80')]=_0x22a6a5;this[_0x2f70('0x8a')]=_0xbeb913;}function createExtensionsReciveFax(_0x590fce){var _0x3a84f7=0x1;var _0x5f30d0=[];_0x5f30d0[_0x2f70('0x8b')](new Extension(_0x590fce,_0x3a84f7,'',_0x2f70('0x8c')));_0x3a84f7+=0x1;_0x5f30d0[_0x2f70('0x8b')](new Extension(_0x590fce,_0x3a84f7,_0x2f70('0x8d'),_0x2f70('0x8e')));_0x3a84f7+=0x1;for(var _0x16cc4d in _0x590fce){if(_0x590fce[_0x2f70('0x49')](_0x16cc4d)&&(_0x16cc4d==='ecm'||_0x16cc4d===_0x2f70('0x86')||_0x16cc4d===_0x2f70('0x8f')||_0x16cc4d===_0x2f70('0x90')||_0x16cc4d==='headerinfo'||_0x16cc4d===_0x2f70('0x91')||_0x16cc4d===_0x2f70('0x92')||_0x16cc4d===_0x2f70('0x93')||_0x16cc4d==='t38timeout')){_0x5f30d0[_0x2f70('0x8b')](new Extension(_0x590fce,_0x3a84f7,'FAXOPT('+_0x16cc4d+')='+_0x590fce[_0x16cc4d],_0x2f70('0x8e')));_0x3a84f7+=0x1;}}_0x5f30d0['push'](new Extension(_0x590fce,_0x3a84f7,'6',_0x2f70('0x94')));_0x3a84f7+=0x1;_0x5f30d0[_0x2f70('0x8b')](new Extension(_0x590fce,_0x3a84f7,'/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'));_0x3a84f7=0x0;return _0x5f30d0;}exports['addAccountApplications']=function(_0x1959a2,_0x56e501,_0xbdd20c){var _0x1d3613;return db[_0x2f70('0x7b')][_0x2f70('0x95')](function(_0x1c0bc6){return db[_0x2f70('0x3d')][_0x2f70('0x5b')](_0x1959a2[_0x2f70('0x5c')],{'transaction':_0x1c0bc6})[_0x2f70('0x1f')](function(_0x1b7671){_0x1d3613=_0x1b7671[_0x2f70('0x34')]({'plain':!![]});return db[_0x2f70('0x96')][_0x2f70('0x7f')](createExtensionsReciveFax(_0x1d3613),{'transaction':_0x1c0bc6});});})['then'](function(){return _0x1d3613;})['then'](respondWithResult(_0x56e501,null))['catch'](handleError(_0x56e501,null));};exports['updateAccountApplications']=function(_0x51613a,_0x1c3ba2,_0x502447){var _0x49e8b6;return db['sequelize']['transaction'](function(_0x16fba0){return db[_0x2f70('0x3d')]['update'](_0x51613a[_0x2f70('0x5c')],{'where':{'id':_0x51613a['body']['id']},'transaction':_0x16fba0})[_0x2f70('0x1f')](function(_0x5a8381){return db[_0x2f70('0x96')][_0x2f70('0x37')]({'where':{'FaxAccountId':_0x51613a[_0x2f70('0x5c')]['id']},'transaction':_0x16fba0})['then'](function(_0x5d0693){return db['VoiceExtension'][_0x2f70('0x7f')](createExtensionsReciveFax(_['omit'](_0x51613a[_0x2f70('0x5c')],[_0x2f70('0x97'),'key','createdAt',_0x2f70('0x98'),'TrunkId',_0x2f70('0x99')])),{'transaction':_0x16fba0});});});})['then'](function(){return db[_0x2f70('0x3d')][_0x2f70('0x9a')](_0x51613a[_0x2f70('0x5c')]['id']);})[_0x2f70('0x1f')](respondWithResult(_0x1c3ba2,null))['catch'](handleError(_0x1c3ba2,null));};exports[_0x2f70('0x9b')]=function(_0x5e9706,_0x310df0,_0x4431a6){var _0x38ca0d={'raw':!![],'where':{}};var _0x27b8ec={};var _0x364b1e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2f70('0x67')]({'where':{'id':_0x5e9706[_0x2f70('0x58')]['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x310df0,null))[_0x2f70('0x1f')](function(_0x4ab0b5){if(_0x4ab0b5){_0x27b8ec[_0x2f70('0x41')]=_['keys'](db[_0x2f70('0x9c')][_0x2f70('0x3e')]);_0x27b8ec[_0x2f70('0x42')]=_['keys'](_0x5e9706[_0x2f70('0x42')]);_0x27b8ec[_0x2f70('0x44')]=_[_0x2f70('0x45')](_0x27b8ec[_0x2f70('0x41')],_0x27b8ec['query']);_0x38ca0d[_0x2f70('0x46')]=_[_0x2f70('0x45')](_0x27b8ec[_0x2f70('0x41')],qs[_0x2f70('0x47')](_0x5e9706[_0x2f70('0x42')][_0x2f70('0x47')]));_0x38ca0d['attributes']=_0x38ca0d[_0x2f70('0x46')][_0x2f70('0x48')]?_0x38ca0d[_0x2f70('0x46')]:_0x27b8ec[_0x2f70('0x41')];if(!_0x5e9706['query'][_0x2f70('0x49')]('nolimit')){_0x38ca0d[_0x2f70('0x2d')]=qs[_0x2f70('0x2d')](_0x5e9706['query'][_0x2f70('0x2d')]);_0x38ca0d[_0x2f70('0x2b')]=qs[_0x2f70('0x2b')](_0x5e9706[_0x2f70('0x42')]['offset']);}_0x38ca0d[_0x2f70('0x68')]=qs['sort'](_0x5e9706[_0x2f70('0x42')]['sort']);_0x38ca0d['where']=qs[_0x2f70('0x44')](_[_0x2f70('0x4d')](_0x5e9706[_0x2f70('0x42')],_0x27b8ec[_0x2f70('0x44')]));_0x38ca0d[_0x2f70('0x4c')]['FaxAccountId']=_0x4ab0b5['id'];if(_0x5e9706[_0x2f70('0x42')][_0x2f70('0x4e')]){_0x38ca0d[_0x2f70('0x4c')]=_[_0x2f70('0x4f')](_0x38ca0d[_0x2f70('0x4c')],{'$or':_[_0x2f70('0x3c')](_0x38ca0d[_0x2f70('0x46')],function(_0x8ef5cb){var _0xf3d0df={};_0xf3d0df[_0x8ef5cb]={'$like':'%'+_0x5e9706['query']['filter']+'%'};return _0xf3d0df;})});}if(_0x5e9706[_0x2f70('0x42')]['$gte']){var _0x19015f=_0x5e9706['query'][_0x2f70('0x9d')][_0x2f70('0x9e')](',');var _0x5a311a={};_0x5a311a[_0x19015f[0x0]]={'$gte':moment(_0x19015f[0x1])[_0x2f70('0x9f')](_0x2f70('0xa0'))};_0x38ca0d[_0x2f70('0x4c')]=_['merge'](_0x38ca0d[_0x2f70('0x4c')],_0x5a311a);}_0x38ca0d=_[_0x2f70('0x4f')]({},_0x38ca0d,_0x5e9706[_0x2f70('0x50')]);return db[_0x2f70('0x9c')]['count']({'where':_0x38ca0d['where']})[_0x2f70('0x1f')](function(_0x169ed8){_0x364b1e['count']=_0x169ed8;if(_0x5e9706[_0x2f70('0x42')]['includeAll']){_0x38ca0d[_0x2f70('0x53')]=[{'all':!![]}];}return db[_0x2f70('0x9c')][_0x2f70('0x54')](_0x38ca0d);})[_0x2f70('0x1f')](function(_0x4c3bdc){_0x364b1e[_0x2f70('0x55')]=_0x4c3bdc;return _0x364b1e;});}})[_0x2f70('0x1f')](respondWithFilteredResult(_0x310df0,_0x38ca0d))[_0x2f70('0x56')](handleError(_0x310df0,null));};exports[_0x2f70('0x82')]=function(_0x5189d6,_0x4d7fad,_0x18bac5){var _0x491362,_0x54655c={},_0x20b567;if(_0x5189d6[_0x2f70('0x5c')]['to']){_0x20b567=_0x5189d6['body']['to'][0x0];}return db[_0x2f70('0x3d')]['find']({'where':{'id':_0x5189d6[_0x2f70('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x2f70('0xa1'),'include':[{'model':db[_0x2f70('0x72')],'as':'Contacts','where':{'fax':_0x20b567},'limit':0x1,'order':[[_0x2f70('0x98'),_0x2f70('0xa2')]]}]}]})[_0x2f70('0x1f')](handleEntityNotFound(_0x4d7fad,null))['then'](function(_0xb769ae){_0x491362=_0xb769ae;if(_0x5189d6['body']['attachments']&&_0x5189d6['body']['attachments'][_0x2f70('0x48')]){for(var _0x35285e=0x0;_0x35285e<_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][_0x2f70('0x48')];_0x35285e+=0x1){_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][_0x35285e]={'filename':_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][_0x35285e][_0x2f70('0x3a')],'id':_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][_0x35285e]['id'],'path':path['join'](config[_0x2f70('0xa4')],'server/files/attachments',_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][_0x35285e][_0x2f70('0xa5')])};}}return respondWithRpcPromise(_0x2f70('0xa6'),_0x2f70('0xa6'),{'FaxAccountId':_['isNil'](_0x5189d6[_0x2f70('0x58')]['id'])?undefined:_0x5189d6[_0x2f70('0x58')]['id'],'path':_[_0x2f70('0xa7')](_0x5189d6['body'][_0x2f70('0xa3')][0x0][_0x2f70('0x7')])?undefined:_0x5189d6['body'][_0x2f70('0xa3')][0x0][_0x2f70('0x7')],'fax':_[_0x2f70('0xa7')](_0x5189d6[_0x2f70('0x5c')]['to'][0x0])?undefined:_0x5189d6['body']['to'][0x0]},client9002);})[_0x2f70('0x1f')](function(){if(_0x491362){if(_[_0x2f70('0xa7')](_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa8')])){_0x5189d6['body'][_0x2f70('0xa8')]=util[_0x2f70('0x9f')](_0x2f70('0xa9'),_0x491362[_0x2f70('0x3a')],_0x491362[_0x2f70('0xaa')]);}if(_0x491362['List']){if(_0x491362[_0x2f70('0xa1')][_0x2f70('0xab')][_0x2f70('0x48')]){return _0x491362[_0x2f70('0xa1')][_0x2f70('0xab')][0x0];}else{return db['CmContact'][_0x2f70('0x5b')](_['defaults'](_0x5189d6[_0x2f70('0x5c')],{'firstName':_0x5189d6[_0x2f70('0x5c')]['to'][0x0],'phone':_0x5189d6[_0x2f70('0x5c')]['to'][0x0],'fax':_0x5189d6[_0x2f70('0x5c')]['to'][0x0],'ListId':_0x491362['ListId']}));}}else{throw new Error(_0x2f70('0xac'));}}else{throw new Error(_0x2f70('0xad'));}})['then'](function(_0x4c238d){if(_0x4c238d){return db[_0x2f70('0x71')]['find']({'where':{'ContactId':_0x4c238d['id'],'closed':![],'FaxAccountId':_0x491362['id']}})[_0x2f70('0x1f')](function(_0x147ef2){if(_0x147ef2){return[_0x147ef2,![]];}return db['FaxInteraction'][_0x2f70('0x5b')]({'UserId':_0x5189d6[_0x2f70('0x5d')]['id'],'ContactId':_0x4c238d['id'],'FaxAccountId':_0x491362['id'],'fax':_0x5189d6[_0x2f70('0x5c')]['to'][0x0],'firstMsgDirection':_0x2f70('0xae'),'Messages':[_[_0x2f70('0x4f')](_0x5189d6[_0x2f70('0x5c')],{'read':![],'body':_0x5189d6['body'][_0x2f70('0xa3')][0x0][_0x2f70('0xaf')],'FaxAccountId':_0x491362['id'],'UserId':_0x5189d6['user']['id'],'ContactId':_0x4c238d['id'],'AttachmentId':_0x5189d6[_0x2f70('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x2f70('0x9c')],'as':'Messages'}]})[_0x2f70('0x1f')](function(_0x16980c){return[_0x16980c,!![]];});});}else{throw new Error(_0x2f70('0xb0'));}})[_0x2f70('0xb1')](function(_0x1b2f15,_0x25367d){if(_0x25367d){return _0x1b2f15;}return db[_0x2f70('0x9c')][_0x2f70('0x5b')]({'direction':_0x2f70('0xae'),'read':![],'body':_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][0x0]['filename'],'FaxAccountId':_0x491362['id'],'FaxInteractionId':_0x1b2f15['id'],'UserId':_0x5189d6[_0x2f70('0x5d')]['id'],'ContactId':_0x1b2f15[_0x2f70('0xb2')],'AttachmentId':_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][0x0]['id']})[_0x2f70('0x1f')](function(_0x52e1a6){_0x1b2f15[_0x2f70('0xb3')][_0x2f70('0xb4')]=[];_0x1b2f15[_0x2f70('0xb3')][_0x2f70('0xb4')][_0x2f70('0x8b')](_0x52e1a6[_0x2f70('0xb3')]);return _0x1b2f15;});})[_0x2f70('0x1f')](function(_0x3d5ea1){respondWithRpcPromise('SendFax',_0x2f70('0xb5'),{'FaxAccountId':_[_0x2f70('0xa7')](_0x5189d6['params']['id'])?undefined:_0x5189d6[_0x2f70('0x58')]['id'],'path':_[_0x2f70('0xa7')](_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][0x0][_0x2f70('0x7')])?undefined:_0x5189d6[_0x2f70('0x5c')][_0x2f70('0xa3')][0x0]['path'],'fax':_[_0x2f70('0xa7')](_0x5189d6[_0x2f70('0x5c')]['to'][0x0])?undefined:_0x5189d6['body']['to'][0x0],'AttachmentId':_0x5189d6['body'][_0x2f70('0xa3')][0x0]['id']},client9002)[_0x2f70('0x1f')](function(_0x266597){logger[_0x2f70('0x20')](_0x2f70('0xb6'),_0x266597);})[_0x2f70('0x56')](function(_0x1f1a08){logger['info'](_0x2f70('0xb6'),_0x1f1a08);});return _0x3d5ea1;})[_0x2f70('0x1f')](respondWithResult(_0x4d7fad,null))['catch'](handleError(_0x4d7fad,null));};exports[_0x2f70('0xb7')]=function(_0x5271c6,_0x1930ba,_0xac36ae){return db[_0x2f70('0x3d')][_0x2f70('0x5a')]({'where':{'id':_0x5271c6[_0x2f70('0x58')]['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x1930ba,null))[_0x2f70('0x1f')](function(_0x118583){if(_0x118583){return _0x118583[_0x2f70('0xb7')](_0x5271c6[_0x2f70('0x5c')][_0x2f70('0x6a')],_[_0x2f70('0x6f')](_0x5271c6['body'],[_0x2f70('0x6a'),'id'])||{})['spread'](function(_0x329f6b){for(var _0x1addd7=0x0;_0x1addd7<_0x5271c6[_0x2f70('0x5c')][_0x2f70('0x6a')][_0x2f70('0x48')];_0x1addd7+=0x1){socket['emit'](_0x2f70('0xb8'),{'UserId':Number(_0x5271c6[_0x2f70('0x5c')][_0x2f70('0x6a')][_0x1addd7]),'FaxAccountId':Number(_0x5271c6[_0x2f70('0x58')]['id'])});}return _0x329f6b;});}})[_0x2f70('0x1f')](respondWithResult(_0x1930ba,null))['catch'](handleError(_0x1930ba,null));};exports['removeAgents']=function(_0x3a43f2,_0x56b06b,_0x34ef7e){return db[_0x2f70('0x3d')]['find']({'where':{'id':_0x3a43f2['params']['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x56b06b,null))['then'](function(_0x353d30){if(_0x353d30){return _0x353d30['removeAgents'](_0x3a43f2[_0x2f70('0x42')][_0x2f70('0x6a')])[_0x2f70('0x1f')](function(){if(_[_0x2f70('0xb9')](_0x3a43f2[_0x2f70('0x42')][_0x2f70('0x6a')])){for(var _0x5ccd3d=0x0;_0x5ccd3d<_0x3a43f2[_0x2f70('0x42')][_0x2f70('0x6a')][_0x2f70('0x48')];_0x5ccd3d+=0x1){socket[_0x2f70('0xba')](_0x2f70('0xbb'),{'UserId':Number(_0x3a43f2[_0x2f70('0x42')][_0x2f70('0x6a')][_0x5ccd3d]),'FaxAccountId':Number(_0x3a43f2[_0x2f70('0x58')]['id'])});}}else{socket[_0x2f70('0xba')](_0x2f70('0xbb'),{'UserId':Number(_0x3a43f2[_0x2f70('0x42')][_0x2f70('0x6a')]),'FaxAccountId':Number(_0x3a43f2['params']['id'])});}});}})[_0x2f70('0x1f')](respondWithStatusCode(_0x56b06b,null))['catch'](handleError(_0x56b06b,null));};exports[_0x2f70('0xbc')]=function(_0xe4c31d,_0x3ff1c6,_0x8f6193){var _0x5812e7={};var _0x90cd98={};var _0x422a7d;var _0x2a5342;return db['FaxAccount'][_0x2f70('0x67')]({'where':{'id':_0xe4c31d[_0x2f70('0x58')]['id']}})[_0x2f70('0x1f')](handleEntityNotFound(_0x3ff1c6,null))[_0x2f70('0x1f')](function(_0x470dea){if(_0x470dea){_0x422a7d=_0x470dea;_0x90cd98[_0x2f70('0x41')]=_[_0x2f70('0x43')](db['User'][_0x2f70('0x3e')]);_0x90cd98[_0x2f70('0x42')]=_[_0x2f70('0x43')](_0xe4c31d[_0x2f70('0x42')]);_0x90cd98[_0x2f70('0x44')]=_[_0x2f70('0x45')](_0x90cd98[_0x2f70('0x41')],_0x90cd98[_0x2f70('0x42')]);_0x5812e7[_0x2f70('0x46')]=_[_0x2f70('0x45')](_0x90cd98[_0x2f70('0x41')],qs[_0x2f70('0x47')](_0xe4c31d[_0x2f70('0x42')]['fields']));_0x5812e7[_0x2f70('0x46')]=_0x5812e7[_0x2f70('0x46')][_0x2f70('0x48')]?_0x5812e7[_0x2f70('0x46')]:_0x90cd98[_0x2f70('0x41')];_0x5812e7[_0x2f70('0x68')]=qs[_0x2f70('0x4b')](_0xe4c31d[_0x2f70('0x42')]['sort']);_0x5812e7[_0x2f70('0x4c')]=qs[_0x2f70('0x44')](_[_0x2f70('0x4d')](_0xe4c31d[_0x2f70('0x42')],_0x90cd98[_0x2f70('0x44')]));if(_0xe4c31d[_0x2f70('0x42')][_0x2f70('0x4e')]){_0x5812e7['where']=_[_0x2f70('0x4f')](_0x5812e7['where'],{'$or':_[_0x2f70('0x3c')](_0x5812e7[_0x2f70('0x46')],function(_0x5d0f9a){var _0x3a8bd7={};_0x3a8bd7[_0x5d0f9a]={'$like':'%'+_0xe4c31d[_0x2f70('0x42')][_0x2f70('0x4e')]+'%'};return _0x3a8bd7;})});}_0x5812e7=_[_0x2f70('0x4f')]({},_0x5812e7,_0xe4c31d[_0x2f70('0x50')]);return _0x422a7d[_0x2f70('0xbc')](_0x5812e7);}})['then'](function(_0x33bddc){if(_0x33bddc){_0x2a5342=_0x33bddc[_0x2f70('0x48')];if(!_0xe4c31d[_0x2f70('0x42')][_0x2f70('0x49')](_0x2f70('0x4a'))){_0x5812e7[_0x2f70('0x2d')]=qs['limit'](_0xe4c31d['query'][_0x2f70('0x2d')]);_0x5812e7[_0x2f70('0x2b')]=qs[_0x2f70('0x2b')](_0xe4c31d[_0x2f70('0x42')][_0x2f70('0x2b')]);}return _0x422a7d[_0x2f70('0xbc')](_0x5812e7);}})['then'](function(_0x105008){if(_0x105008){return _0x105008?{'count':_0x2a5342,'rows':_0x105008}:null;}})['then'](respondWithResult(_0x3ff1c6,null))[_0x2f70('0x56')](handleError(_0x3ff1c6,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ccad29c..8c032d2 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 _0xa0d5=['exports','../../mysqldb','remove','emit','hasOwnProperty'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xa0d5,0xab));var _0x5a0d=function(_0x97d4b6,_0x1b8eab){_0x97d4b6=_0x97d4b6-0x0;var _0x364238=_0xa0d5[_0x97d4b6];return _0x364238;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x5a0d('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5a0d('0x1')};function emitEvent(_0x1f3f70){return function(_0x1ad6b3,_0x206b98,_0x14ed29){FaxAccountEvents[_0x5a0d('0x2')](_0x1f3f70+':'+_0x1ad6b3['id'],_0x1ad6b3);FaxAccountEvents['emit'](_0x1f3f70,_0x1ad6b3);_0x14ed29(null);};}for(var e in events){if(events[_0x5a0d('0x3')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x5a0d('0x4')]=FaxAccountEvents; \ No newline at end of file +var _0xe597=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x232152,_0xc38468){var _0x147751=function(_0x110e24){while(--_0x110e24){_0x232152['push'](_0x232152['shift']());}};_0x147751(++_0xc38468);}(_0xe597,0xf8));var _0x7e59=function(_0x1219f7,_0x464bd5){_0x1219f7=_0x1219f7-0x0;var _0x59c2d3=_0xe597[_0x1219f7];return _0x59c2d3;};'use strict';var EventEmitter=require(_0x7e59('0x0'));var FaxAccount=require(_0x7e59('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7e59('0x2')](0x0);var events={'afterCreate':_0x7e59('0x3'),'afterUpdate':_0x7e59('0x4'),'afterDestroy':_0x7e59('0x5')};function emitEvent(_0x457242){return function(_0x81cd03,_0x449d2b,_0x358933){FaxAccountEvents['emit'](_0x457242+':'+_0x81cd03['id'],_0x81cd03);FaxAccountEvents[_0x7e59('0x6')](_0x457242,_0x81cd03);_0x358933(null);};}for(var e in events){if(events[_0x7e59('0x7')](e)){var event=events[e];FaxAccount[_0x7e59('0x8')](e,emitEvent(event));}}module[_0x7e59('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 6cf1452..597eef4 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 _0x708b=['request-promise','rimraf','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x708b,0x69));var _0xb708=function(_0x3db003,_0x3b9ffa){_0x3db003=_0x3db003-0x0;var _0x46e823=_0x708b[_0x3db003];return _0x46e823;};'use strict';var _=require(_0xb708('0x0'));var util=require(_0xb708('0x1'));var logger=require('../../config/logger')(_0xb708('0x2'));var moment=require(_0xb708('0x3'));var BPromise=require(_0xb708('0x4'));var rp=require(_0xb708('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb708('0x6'));var config=require('../../config/environment');var attributes=require(_0xb708('0x7'));module[_0xb708('0x8')]=function(_0x2d7272,_0x3e3ae6){return _0x2d7272['define'](_0xb708('0x9'),attributes,{'tableName':_0xb708('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4aee=['fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0xf801a0,_0x2a1f96){var _0x25846e=function(_0x27c48c){while(--_0x27c48c){_0xf801a0['push'](_0xf801a0['shift']());}};_0x25846e(++_0x2a1f96);}(_0x4aee,0xb7));var _0xe4ae=function(_0xc7c6d6,_0x56f3bc){_0xc7c6d6=_0xc7c6d6-0x0;var _0x1c4180=_0x4aee[_0xc7c6d6];return _0x1c4180;};'use strict';var _=require('lodash');var util=require(_0xe4ae('0x0'));var logger=require(_0xe4ae('0x1'))(_0xe4ae('0x2'));var moment=require(_0xe4ae('0x3'));var BPromise=require(_0xe4ae('0x4'));var rp=require(_0xe4ae('0x5'));var fs=require('fs');var path=require(_0xe4ae('0x6'));var rimraf=require('rimraf');var config=require(_0xe4ae('0x7'));var attributes=require(_0xe4ae('0x8'));module[_0xe4ae('0x9')]=function(_0x4c96cb,_0x3176ba){return _0x4c96cb[_0xe4ae('0xa')](_0xe4ae('0xb'),attributes,{'tableName':_0xe4ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 50b525f..8a0c2cc 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 _0xfa21=['model','attributes','NotifyFaxAccount','body','fax','CmContact','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','length','create','FaxInteraction','Contact\x20not\x20found','spread','close','unmanaged','interaction','FaxMessage','ContactId','UserId','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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','FaxAccount','findAll','options','where','map','include'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xfa21,0xdc));var _0x1fa2=function(_0x59e5e8,_0x3bfa2a){_0x59e5e8=_0x59e5e8-0x0;var _0x1ebb02=_0xfa21[_0x59e5e8];return _0x1ebb02;};'use strict';var _=require('lodash');var util=require(_0x1fa2('0x0'));var moment=require(_0x1fa2('0x1'));var BPromise=require(_0x1fa2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fa2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1fa2('0x4'))(_0x1fa2('0x5'));var config=require(_0x1fa2('0x6'));var jayson=require(_0x1fa2('0x7'));var client=jayson[_0x1fa2('0x8')][_0x1fa2('0x9')]({'port':0x232c});config[_0x1fa2('0xa')]=_[_0x1fa2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1fa2('0xc'))(new Redis(config[_0x1fa2('0xa')]));require(_0x1fa2('0xd'))[_0x1fa2('0xe')](socket);function respondWithRpcPromise(_0x168ecb,_0x53f3fb,_0x2b1323){return new BPromise(function(_0x18566c,_0x281a3e){return client[_0x1fa2('0xf')](_0x168ecb,_0x2b1323)[_0x1fa2('0x10')](function(_0x4d32f3){logger[_0x1fa2('0x11')](_0x1fa2('0x12'),_0x53f3fb,_0x1fa2('0x13'));logger[_0x1fa2('0x14')](_0x1fa2('0x15'),_0x53f3fb,'request\x20sent',JSON[_0x1fa2('0x16')](_0x4d32f3));if(_0x4d32f3[_0x1fa2('0x17')]){if(_0x4d32f3[_0x1fa2('0x17')][_0x1fa2('0x18')]===0x1f4){logger[_0x1fa2('0x17')](_0x1fa2('0x12'),_0x53f3fb,_0x4d32f3['error']['message']);return _0x281a3e(_0x4d32f3['error'][_0x1fa2('0x19')]);}logger['error'](_0x1fa2('0x12'),_0x53f3fb,_0x4d32f3[_0x1fa2('0x17')][_0x1fa2('0x19')]);return _0x18566c(_0x4d32f3[_0x1fa2('0x17')][_0x1fa2('0x19')]);}else{logger[_0x1fa2('0x11')]('FaxAccount,\x20%s,\x20%s',_0x53f3fb,_0x1fa2('0x13'));_0x18566c(_0x4d32f3[_0x1fa2('0x1a')][_0x1fa2('0x19')]);}})[_0x1fa2('0x1b')](function(_0x5136dd){logger[_0x1fa2('0x17')](_0x1fa2('0x12'),_0x53f3fb,_0x5136dd);_0x281a3e(_0x5136dd);});});}exports[_0x1fa2('0x1c')]=function(_0x4a504e){var _0x473aea=this;return new Promise(function(_0xec6595,_0x267cb5){return db[_0x1fa2('0x1d')][_0x1fa2('0x1e')]({'raw':_0x4a504e[_0x1fa2('0x1f')]?_0x4a504e[_0x1fa2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4a504e[_0x1fa2('0x1f')]?_0x4a504e['options'][_0x1fa2('0x20')]||null:null,'attributes':_0x4a504e['options']?_0x4a504e[_0x1fa2('0x1f')]['attributes']||null:null,'limit':_0x4a504e['options']?_0x4a504e[_0x1fa2('0x1f')]['limit']||null:null,'include':_0x4a504e[_0x1fa2('0x1f')]?_0x4a504e[_0x1fa2('0x1f')]['include']?_[_0x1fa2('0x21')](_0x4a504e[_0x1fa2('0x1f')][_0x1fa2('0x22')],function(_0x148e5d){return{'model':db[_0x148e5d[_0x1fa2('0x23')]],'as':_0x148e5d['as'],'attributes':_0x148e5d[_0x1fa2('0x24')],'include':_0x148e5d[_0x1fa2('0x22')]?_['map'](_0x148e5d[_0x1fa2('0x22')],function(_0x3d1e93){return{'model':db[_0x3d1e93['model']],'as':_0x3d1e93['as'],'attributes':_0x3d1e93[_0x1fa2('0x24')],'include':_0x3d1e93[_0x1fa2('0x22')]?_[_0x1fa2('0x21')](_0x3d1e93[_0x1fa2('0x22')],function(_0x1347e1){return{'model':db[_0x1347e1[_0x1fa2('0x23')]],'as':_0x1347e1['as'],'attributes':_0x1347e1[_0x1fa2('0x24')]};}):[]};}):[]};}):[]:[]})[_0x1fa2('0x10')](function(_0x5a6980){logger[_0x1fa2('0x11')](_0x1fa2('0x1c'),_0x4a504e);logger[_0x1fa2('0x14')]('GetFaxAccount',_0x4a504e,JSON[_0x1fa2('0x16')](_0x5a6980));_0xec6595(_0x5a6980);})[_0x1fa2('0x1b')](function(_0x54d02b){logger[_0x1fa2('0x17')](_0x1fa2('0x1c'),_0x54d02b[_0x1fa2('0x19')],_0x4a504e);_0x267cb5(_0x473aea[_0x1fa2('0x17')](0x1f4,_0x54d02b[_0x1fa2('0x19')]));});});};exports[_0x1fa2('0x25')]=function(_0x5c9a85,_0xadf679,_0x31067b){var _0x588e0a=this;return new Promise(function(_0x29c55b,_0xe75b74){var _0x221c46={'body':_0x5c9a85[_0x1fa2('0x26')],'channel':_0x1fa2('0x27')};var _0x4c232a=[];var _0x5dcd71=[];var _0x8b2062={};return db[_0x1fa2('0x28')]['describe']()['then'](function(_0x18ceb7){if(!_0x18ceb7){throw new db['Sequelize'][(_0x1fa2('0x29'))]('no\x20available\x20attributes');}_0x4c232a=_[_0x1fa2('0x2a')](_[_0x1fa2('0x2b')](_0x18ceb7),['createdAt','updatedAt']);_0x5dcd71=_[_0x1fa2('0x2a')](_[_0x1fa2('0x2b')](_0x18ceb7),[_0x1fa2('0x2c'),_0x1fa2('0x2d'),_0x1fa2('0x2e'),_0x1fa2('0x2f')]);if(_0x5c9a85['body']['id']){delete _0x5c9a85[_0x1fa2('0x26')]['id'];}if(_['isNil'](_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x30')])){throw new db[(_0x1fa2('0x31'))][(_0x1fa2('0x29'))](_0x1fa2('0x32'));}if(_[_0x1fa2('0x33')](_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x26')])||_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x26')]===''){throw new db[(_0x1fa2('0x31'))][(_0x1fa2('0x29'))](_0x1fa2('0x34'));}if(_[_0x1fa2('0x33')](_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x35')])){throw new db[(_0x1fa2('0x31'))][(_0x1fa2('0x29'))](_0x1fa2('0x36')+_0x5dcd71);}if(!_['includes'](_0x5dcd71,_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x35')])){throw new db[(_0x1fa2('0x31'))][(_0x1fa2('0x29'))](_0x1fa2('0x37')+_0x5dcd71);}_0x8b2062[_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x35')]]=_0x5c9a85[_0x1fa2('0x26')]['from'];})['then'](function(){return db[_0x1fa2('0x1d')][_0x1fa2('0x38')]({'where':{'id':_0x5c9a85[_0x1fa2('0x39')]['id']},'include':[{'model':db[_0x1fa2('0x3a')],'as':_0x1fa2('0x3b'),'include':[{'model':db[_0x1fa2('0x28')],'as':_0x1fa2('0x3c'),'where':_0x8b2062,'limit':0x1,'order':[[_0x1fa2('0x2d'),_0x1fa2('0x3d')]]}]},{'model':db[_0x1fa2('0x3e')],'as':_0x1fa2('0x3f')}]});})[_0x1fa2('0x10')](function(_0x23b648){if(_0x23b648&&_0x23b648[_0x1fa2('0x3b')]){var _0x5d5362=_0x23b648[_0x1fa2('0x40')]({'plain':!![]});_0x221c46[_0x1fa2('0x39')]=_0x5d5362;_0x221c46[_0x1fa2('0x41')]=_0x5d5362[_0x1fa2('0x3f')];_0x221c46['list']=_0x5d5362[_0x1fa2('0x3b')];_0x221c46[_0x1fa2('0x41')]=_[_0x1fa2('0x42')](_0x221c46[_0x1fa2('0x41')],['priority'],['asc']);if(_0x221c46[_0x1fa2('0x39')][_0x1fa2('0x3f')]){delete _0x221c46['account'][_0x1fa2('0x3f')];}if(_0x221c46['account'][_0x1fa2('0x3b')]&&_0x221c46[_0x1fa2('0x39')][_0x1fa2('0x3b')][_0x1fa2('0x3c')][_0x1fa2('0x43')]){return _0x221c46[_0x1fa2('0x39')][_0x1fa2('0x3b')][_0x1fa2('0x3c')][0x0];}var _0x55e84a=_[_0x1fa2('0xb')](_0x5c9a85[_0x1fa2('0x26')],{'firstName':_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x30')],'ListId':_0x5d5362['ListId']});_0x55e84a[_0x5c9a85['body'][_0x1fa2('0x35')]]=_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x30')];return db[_0x1fa2('0x28')][_0x1fa2('0x44')](_0x55e84a,{'fields':_0x4c232a,'raw':!![]});}})['then'](function(_0x23d13a){_0x221c46['contact']=_0x23d13a;if(_0x23d13a){var _0x3be43a={'ContactId':_0x23d13a['id'],'FaxAccountId':_0x5c9a85[_0x1fa2('0x39')]['id'],'fax':_0x23d13a[_0x1fa2('0x27')]};return db[_0x1fa2('0x45')]['find']({'where':{'ContactId':_0x23d13a['id'],'closed':![],'FaxAccountId':_0x5c9a85[_0x1fa2('0x39')]['id']}})[_0x1fa2('0x10')](function(_0x5bf090){if(_0x5bf090){return[_0x5bf090,![]];}return db[_0x1fa2('0x45')][_0x1fa2('0x44')](_0x3be43a)[_0x1fa2('0x10')](function(_0x44014f){return[_0x44014f,!![]];});});}else{throw new Error(_0x1fa2('0x46'));}})[_0x1fa2('0x47')](function(_0x567c14,_0x1b2248){var _0x27fba5=_0x567c14[_0x1fa2('0x40')]({'plain':!![]});if(_0x1b2248){if(_0x221c46[_0x1fa2('0x39')]['autoclose']){_0x221c46[_0x1fa2('0x41')]['push']({'id':0x0,'priority':_0x221c46['applications'][_0x1fa2('0x43')]+0x1,'app':_0x1fa2('0x48'),'appdata':_0x1fa2('0x49'),'interval':'*,*,*,*'});}_0x27fba5['created']=!![];}else{_0x27fba5['created']=![];}_0x221c46[_0x1fa2('0x4a')]=_0x27fba5;return db[_0x1fa2('0x4b')][_0x1fa2('0x44')]({'body':_0x5c9a85[_0x1fa2('0x26')][_0x1fa2('0x26')],'FaxAccountId':_0x5c9a85[_0x1fa2('0x39')]['id'],'FaxInteractionId':_0x567c14['id'],'direction':'in','ContactId':_0x567c14[_0x1fa2('0x4c')],'AttachmentId':_0x5c9a85[_0x1fa2('0x26')]['AttachmentId']});})[_0x1fa2('0x10')](function(_0xd6388b){_0x221c46[_0x1fa2('0x19')]=_0xd6388b;if(_0x221c46[_0x1fa2('0x4a')][_0x1fa2('0x4d')]){return db['User'][_0x1fa2('0x38')]({'attributes':['id','name'],'where':{'id':_0x221c46[_0x1fa2('0x4a')]['UserId']}})['then'](function(_0x2aa4e0){if(_0x2aa4e0){_0x221c46[_0x1fa2('0x41')][_0x1fa2('0x4e')]({'id':0x0,'priority':0x0,'app':_0x1fa2('0x4f'),'appdata':_0x2aa4e0[_0x1fa2('0x50')]+','+(_0x221c46[_0x1fa2('0x39')][_0x1fa2('0x51')]||0xa),'interval':_0x1fa2('0x52')});}return respondWithRpcPromise('Start',_0x1fa2('0x53'),_0x221c46);});}return respondWithRpcPromise(_0x1fa2('0x54'),_0x1fa2('0x53'),_0x221c46);})[_0x1fa2('0x10')](function(_0x21a6a6){_0x29c55b(_0x21a6a6);})[_0x1fa2('0x1b')](function(_0x11655a){_0xe75b74(_0x588e0a[_0x1fa2('0x17')](0x1f4,_0x11655a[_0x1fa2('0x19')]));});});}; \ No newline at end of file +var _0x86d2=['unmanaged','created','interaction','FaxMessage','create','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','limit','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','Applications','list','orderBy','applications','asc','Contacts','ListId','contact','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x86d2,0x1cf));var _0x286d=function(_0x3f174a,_0x577180){_0x3f174a=_0x3f174a-0x0;var _0x1af4ed=_0x86d2[_0x3f174a];return _0x1af4ed;};'use strict';var _=require(_0x286d('0x0'));var util=require(_0x286d('0x1'));var moment=require(_0x286d('0x2'));var BPromise=require(_0x286d('0x3'));var rs=require(_0x286d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x286d('0x5'))['db'];var utils=require(_0x286d('0x6'));var logger=require(_0x286d('0x7'))(_0x286d('0x8'));var config=require(_0x286d('0x9'));var jayson=require(_0x286d('0xa'));var client=jayson[_0x286d('0xb')][_0x286d('0xc')]({'port':0x232c});config[_0x286d('0xd')]=_[_0x286d('0xe')](config['redis'],{'host':_0x286d('0xf'),'port':0x18eb});var socket=require(_0x286d('0x10'))(new Redis(config[_0x286d('0xd')]));require(_0x286d('0x11'))[_0x286d('0x12')](socket);function respondWithRpcPromise(_0x213915,_0x1c7dbc,_0x3c2479){return new BPromise(function(_0x4b4941,_0x42ae52){return client['request'](_0x213915,_0x3c2479)[_0x286d('0x13')](function(_0x2279cb){logger[_0x286d('0x14')]('FaxAccount,\x20%s,\x20%s',_0x1c7dbc,_0x286d('0x15'));logger[_0x286d('0x16')](_0x286d('0x17'),_0x1c7dbc,_0x286d('0x15'),JSON['stringify'](_0x2279cb));if(_0x2279cb[_0x286d('0x18')]){if(_0x2279cb[_0x286d('0x18')][_0x286d('0x19')]===0x1f4){logger[_0x286d('0x18')](_0x286d('0x1a'),_0x1c7dbc,_0x2279cb[_0x286d('0x18')][_0x286d('0x1b')]);return _0x42ae52(_0x2279cb[_0x286d('0x18')][_0x286d('0x1b')]);}logger[_0x286d('0x18')]('FaxAccount,\x20%s,\x20%s',_0x1c7dbc,_0x2279cb[_0x286d('0x18')][_0x286d('0x1b')]);return _0x4b4941(_0x2279cb[_0x286d('0x18')]['message']);}else{logger['info'](_0x286d('0x1a'),_0x1c7dbc,_0x286d('0x15'));_0x4b4941(_0x2279cb[_0x286d('0x1c')]['message']);}})[_0x286d('0x1d')](function(_0x4ac35a){logger[_0x286d('0x18')]('FaxAccount,\x20%s,\x20%s',_0x1c7dbc,_0x4ac35a);_0x42ae52(_0x4ac35a);});});}exports[_0x286d('0x1e')]=function(_0x494474){var _0x3e034d=this;return new Promise(function(_0x1638c5,_0x47f641){return db[_0x286d('0x1f')][_0x286d('0x20')]({'raw':_0x494474[_0x286d('0x21')]?_0x494474[_0x286d('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x494474['options']?_0x494474[_0x286d('0x21')]['where']||null:null,'attributes':_0x494474['options']?_0x494474[_0x286d('0x21')]['attributes']||null:null,'limit':_0x494474['options']?_0x494474[_0x286d('0x21')][_0x286d('0x22')]||null:null,'include':_0x494474[_0x286d('0x21')]?_0x494474[_0x286d('0x21')][_0x286d('0x23')]?_[_0x286d('0x24')](_0x494474[_0x286d('0x21')][_0x286d('0x23')],function(_0x4308b3){return{'model':db[_0x4308b3[_0x286d('0x25')]],'as':_0x4308b3['as'],'attributes':_0x4308b3[_0x286d('0x26')],'include':_0x4308b3[_0x286d('0x23')]?_[_0x286d('0x24')](_0x4308b3[_0x286d('0x23')],function(_0x3a98f5){return{'model':db[_0x3a98f5['model']],'as':_0x3a98f5['as'],'attributes':_0x3a98f5['attributes'],'include':_0x3a98f5[_0x286d('0x23')]?_[_0x286d('0x24')](_0x3a98f5[_0x286d('0x23')],function(_0x1b7554){return{'model':db[_0x1b7554[_0x286d('0x25')]],'as':_0x1b7554['as'],'attributes':_0x1b7554[_0x286d('0x26')]};}):[]};}):[]};}):[]:[]})[_0x286d('0x13')](function(_0x43aed8){logger['info'](_0x286d('0x1e'),_0x494474);logger[_0x286d('0x16')](_0x286d('0x1e'),_0x494474,JSON['stringify'](_0x43aed8));_0x1638c5(_0x43aed8);})[_0x286d('0x1d')](function(_0x23d85b){logger['error'](_0x286d('0x1e'),_0x23d85b[_0x286d('0x1b')],_0x494474);_0x47f641(_0x3e034d[_0x286d('0x18')](0x1f4,_0x23d85b[_0x286d('0x1b')]));});});};exports[_0x286d('0x27')]=function(_0x2ecdb9,_0xf82570,_0x5ceb97){var _0x552334=this;return new Promise(function(_0x5b06d3,_0x5925ce){var _0x2fb1fb={'body':_0x2ecdb9[_0x286d('0x28')],'channel':_0x286d('0x29')};var _0x26f5cb=[];var _0x1d932f=[];var _0x44e444={};return db[_0x286d('0x2a')][_0x286d('0x2b')]()['then'](function(_0x5c71db){if(!_0x5c71db){throw new db[(_0x286d('0x2c'))][(_0x286d('0x2d'))](_0x286d('0x2e'));}_0x26f5cb=_['difference'](_['keys'](_0x5c71db),[_0x286d('0x2f'),_0x286d('0x30')]);_0x1d932f=_[_0x286d('0x31')](_[_0x286d('0x32')](_0x5c71db),[_0x286d('0x2f'),'updatedAt','CompanyId','ListId']);if(_0x2ecdb9[_0x286d('0x28')]['id']){delete _0x2ecdb9[_0x286d('0x28')]['id'];}if(_[_0x286d('0x33')](_0x2ecdb9[_0x286d('0x28')][_0x286d('0x34')])){throw new db[(_0x286d('0x2c'))][(_0x286d('0x2d'))]('from\x20is\x20mandatory');}if(_[_0x286d('0x33')](_0x2ecdb9['body'][_0x286d('0x28')])||_0x2ecdb9[_0x286d('0x28')][_0x286d('0x28')]===''){throw new db['Sequelize'][(_0x286d('0x2d'))](_0x286d('0x35'));}if(_[_0x286d('0x33')](_0x2ecdb9[_0x286d('0x28')][_0x286d('0x36')])){throw new db[(_0x286d('0x2c'))][(_0x286d('0x2d'))](_0x286d('0x37')+_0x1d932f);}if(!_['includes'](_0x1d932f,_0x2ecdb9[_0x286d('0x28')]['mapKey'])){throw new db[(_0x286d('0x2c'))][(_0x286d('0x2d'))](_0x286d('0x38')+_0x1d932f);}_0x44e444[_0x2ecdb9['body'][_0x286d('0x36')]]=_0x2ecdb9[_0x286d('0x28')][_0x286d('0x34')];})[_0x286d('0x13')](function(){return db['FaxAccount'][_0x286d('0x39')]({'where':{'id':_0x2ecdb9[_0x286d('0x3a')]['id']},'include':[{'model':db[_0x286d('0x3b')],'as':_0x286d('0x3c'),'include':[{'model':db[_0x286d('0x2a')],'as':'Contacts','where':_0x44e444,'limit':0x1,'order':[[_0x286d('0x30'),_0x286d('0x3d')]]}]},{'model':db[_0x286d('0x3e')],'as':_0x286d('0x3f')}]});})[_0x286d('0x13')](function(_0x11f982){if(_0x11f982&&_0x11f982[_0x286d('0x3c')]){var _0x211361=_0x11f982['get']({'plain':!![]});_0x2fb1fb['account']=_0x211361;_0x2fb1fb['applications']=_0x211361[_0x286d('0x3f')];_0x2fb1fb[_0x286d('0x40')]=_0x211361[_0x286d('0x3c')];_0x2fb1fb['applications']=_[_0x286d('0x41')](_0x2fb1fb[_0x286d('0x42')],['priority'],[_0x286d('0x43')]);if(_0x2fb1fb[_0x286d('0x3a')][_0x286d('0x3f')]){delete _0x2fb1fb[_0x286d('0x3a')]['Applications'];}if(_0x2fb1fb[_0x286d('0x3a')][_0x286d('0x3c')]&&_0x2fb1fb[_0x286d('0x3a')]['List'][_0x286d('0x44')]['length']){return _0x2fb1fb[_0x286d('0x3a')]['List'][_0x286d('0x44')][0x0];}var _0xd087a1=_['defaults'](_0x2ecdb9[_0x286d('0x28')],{'firstName':_0x2ecdb9['body'][_0x286d('0x34')],'ListId':_0x211361[_0x286d('0x45')]});_0xd087a1[_0x2ecdb9[_0x286d('0x28')][_0x286d('0x36')]]=_0x2ecdb9[_0x286d('0x28')][_0x286d('0x34')];return db[_0x286d('0x2a')]['create'](_0xd087a1,{'fields':_0x26f5cb,'raw':!![]});}})[_0x286d('0x13')](function(_0x19a4db){_0x2fb1fb[_0x286d('0x46')]=_0x19a4db;if(_0x19a4db){var _0x1087cf={'ContactId':_0x19a4db['id'],'FaxAccountId':_0x2ecdb9[_0x286d('0x3a')]['id'],'fax':_0x19a4db[_0x286d('0x29')]};return db['FaxInteraction'][_0x286d('0x39')]({'where':{'ContactId':_0x19a4db['id'],'closed':![],'FaxAccountId':_0x2ecdb9[_0x286d('0x3a')]['id']}})['then'](function(_0x35bf04){if(_0x35bf04){return[_0x35bf04,![]];}return db[_0x286d('0x47')]['create'](_0x1087cf)['then'](function(_0x4fbb71){return[_0x4fbb71,!![]];});});}else{throw new Error(_0x286d('0x48'));}})['spread'](function(_0x595bf6,_0x2a2e5f){var _0x4c800f=_0x595bf6[_0x286d('0x49')]({'plain':!![]});if(_0x2a2e5f){if(_0x2fb1fb[_0x286d('0x3a')][_0x286d('0x4a')]){_0x2fb1fb['applications'][_0x286d('0x4b')]({'id':0x0,'priority':_0x2fb1fb['applications'][_0x286d('0x4c')]+0x1,'app':'close','appdata':_0x286d('0x4d'),'interval':'*,*,*,*'});}_0x4c800f[_0x286d('0x4e')]=!![];}else{_0x4c800f[_0x286d('0x4e')]=![];}_0x2fb1fb[_0x286d('0x4f')]=_0x4c800f;return db[_0x286d('0x50')][_0x286d('0x51')]({'body':_0x2ecdb9[_0x286d('0x28')][_0x286d('0x28')],'FaxAccountId':_0x2ecdb9[_0x286d('0x3a')]['id'],'FaxInteractionId':_0x595bf6['id'],'direction':'in','ContactId':_0x595bf6['ContactId'],'AttachmentId':_0x2ecdb9['body'][_0x286d('0x52')]});})['then'](function(_0x2615c4){_0x2fb1fb[_0x286d('0x1b')]=_0x2615c4;if(_0x2fb1fb[_0x286d('0x4f')][_0x286d('0x53')]){return db['User'][_0x286d('0x39')]({'attributes':['id',_0x286d('0x54')],'where':{'id':_0x2fb1fb['interaction'][_0x286d('0x53')]}})[_0x286d('0x13')](function(_0x4f421f){if(_0x4f421f){_0x2fb1fb[_0x286d('0x42')][_0x286d('0x55')]({'id':0x0,'priority':0x0,'app':_0x286d('0x56'),'appdata':_0x4f421f[_0x286d('0x54')]+','+(_0x2fb1fb[_0x286d('0x3a')][_0x286d('0x57')]||0xa),'interval':_0x286d('0x58')});}return respondWithRpcPromise('Start',_0x286d('0x59'),_0x2fb1fb);});}return respondWithRpcPromise('Start','startRouting',_0x2fb1fb);})[_0x286d('0x13')](function(_0x14b8bf){_0x5b06d3(_0x14b8bf);})[_0x286d('0x1d')](function(_0x2aa76c){_0x5925ce(_0x552334[_0x286d('0x18')](0x1f4,_0x2aa76c[_0x286d('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d443555..03903ac 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 _0xa926=['register','length','save','update','removeListener'];(function(_0x238049,_0x43e7f7){var _0x5a942c=function(_0x4fcdad){while(--_0x4fcdad){_0x238049['push'](_0x238049['shift']());}};_0x5a942c(++_0x43e7f7);}(_0xa926,0x124));var _0x6a92=function(_0x312b4d,_0x1199ed){_0x312b4d=_0x312b4d-0x0;var _0x3809d6=_0xa926[_0x312b4d];return _0x3809d6;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6a92('0x0'),'remove',_0x6a92('0x1')];function createListener(_0x168dea,_0x152878){return function(_0x39e0d0){_0x152878['emit'](_0x168dea,_0x39e0d0);};}function removeListener(_0x11c608,_0x147e56){return function(){FaxAccountEvents[_0x6a92('0x2')](_0x11c608,_0x147e56);};}exports[_0x6a92('0x3')]=function(_0x286673){for(var _0x4d2924=0x0,_0x3f1b49=events[_0x6a92('0x4')];_0x4d2924<_0x3f1b49;_0x4d2924++){var _0x4e5354=events[_0x4d2924];var _0x29e6e4=createListener('faxAccount:'+_0x4e5354,_0x286673);FaxAccountEvents['on'](_0x4e5354,_0x29e6e4);}}; \ No newline at end of file +var _0x8a50=['length','./faxAccount.events','save','remove','update','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a50,0xf7));var _0x08a5=function(_0x9553b,_0x35ce70){_0x9553b=_0x9553b-0x0;var _0x394a9f=_0x8a50[_0x9553b];return _0x394a9f;};'use strict';var FaxAccountEvents=require(_0x08a5('0x0'));var events=[_0x08a5('0x1'),_0x08a5('0x2'),_0x08a5('0x3')];function createListener(_0x11d438,_0x1222b1){return function(_0x3d018e){_0x1222b1['emit'](_0x11d438,_0x3d018e);};}function removeListener(_0x2bedc3,_0x82a4e1){return function(){FaxAccountEvents['removeListener'](_0x2bedc3,_0x82a4e1);};}exports[_0x08a5('0x4')]=function(_0x168b2d){for(var _0x1be0ff=0x0,_0x6e6c36=events[_0x08a5('0x5')];_0x1be0ff<_0x6e6c36;_0x1be0ff++){var _0x163dd3=events[_0x1be0ff];var _0x1ca8fa=createListener('faxAccount:'+_0x163dd3,_0x168b2d);FaxAccountEvents['on'](_0x163dd3,_0x1ca8fa);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index cf3b04e..b22c311 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(_0x3fdc21,_0xfa0b17){var _0x4dfc52=function(_0x2e25ce){while(--_0x2e25ce){_0x3fdc21['push'](_0x3fdc21['shift']());}};_0x4dfc52(++_0xfa0b17);}(_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/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(_0x16d3a7,_0x405ebe){var _0xa91a65=function(_0x2c1828){while(--_0x2c1828){_0x16d3a7['push'](_0x16d3a7['shift']());}};_0xa91a65(++_0x405ebe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 3741ca8..a76544f 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 _0x3de8=['noop','TEXT','INTEGER','STRING'];(function(_0x416707,_0xe2e6e7){var _0xd6170e=function(_0x54a21a){while(--_0x54a21a){_0x416707['push'](_0x416707['shift']());}};_0xd6170e(++_0xe2e6e7);}(_0x3de8,0xea));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x83de('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x83de('0x1')],'allowNull':![],'defaultValue':_0x83de('0x2')},'appdata':{'type':Sequelize[_0x83de('0x3')]()},'description':{'type':Sequelize[_0x83de('0x1')]},'interval':{'type':Sequelize[_0x83de('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x77d3=['INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x50b16e,_0x9ec1e1){var _0xf84639=function(_0xf5f43d){while(--_0xf5f43d){_0x50b16e['push'](_0x50b16e['shift']());}};_0xf84639(++_0x9ec1e1);}(_0x77d3,0x1f3));var _0x377d=function(_0x9e76d,_0x44e7a0){_0x9e76d=_0x9e76d-0x0;var _0x320985=_0x77d3[_0x9e76d];return _0x320985;};'use strict';var Sequelize=require(_0x377d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x377d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x377d('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x377d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x377d('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c546e33..113ed39 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 _0x3289=['attributes','length','order','sort','where','pick','merge','filter','options','include','rows','catch','show','params','FaxApplication','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields'];(function(_0x2904a1,_0x330878){var _0x56afe2=function(_0x4b0b59){while(--_0x4b0b59){_0x2904a1['push'](_0x2904a1['shift']());}};_0x56afe2(++_0x330878);}(_0x3289,0xe7));var _0x9328=function(_0x47d7a8,_0x5f4e8d){_0x47d7a8=_0x47d7a8-0x0;var _0x439015=_0x3289[_0x47d7a8];return _0x439015;};'use strict';var emlformat=require(_0x9328('0x0'));var rimraf=require(_0x9328('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9328('0x2'));var rp=require(_0x9328('0x3'));var moment=require(_0x9328('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9328('0x5'));var util=require(_0x9328('0x6'));var path=require('path');var sox=require(_0x9328('0x7'));var csv=require(_0x9328('0x8'));var ejs=require(_0x9328('0x9'));var fs=require('fs');var fs_extra=require(_0x9328('0xa'));var _=require(_0x9328('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9328('0xc'));var toCsv=require(_0x9328('0x8'));var querystring=require(_0x9328('0xd'));var Papa=require(_0x9328('0xe'));var Redis=require(_0x9328('0xf'));var authService=require(_0x9328('0x10'));var qs=require(_0x9328('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9328('0x12'));var logger=require(_0x9328('0x13'))('api');var utils=require(_0x9328('0x14'));var config=require(_0x9328('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9328('0x16'))['db'];function respondWithStatusCode(_0x4c0b62,_0x2d7c23){_0x2d7c23=_0x2d7c23||0xcc;return function(_0x4e4f5b){if(_0x4e4f5b){return _0x4c0b62[_0x9328('0x17')](_0x2d7c23);}return _0x4c0b62[_0x9328('0x18')](_0x2d7c23)[_0x9328('0x19')]();};}function respondWithResult(_0x13814a,_0x12b2a1){_0x12b2a1=_0x12b2a1||0xc8;return function(_0x180ca5){if(_0x180ca5){return _0x13814a['status'](_0x12b2a1)[_0x9328('0x1a')](_0x180ca5);}};}function respondWithFilteredResult(_0x3f9c07,_0xed3422){return function(_0x42624e){if(_0x42624e){var _0x5ab41e=typeof _0xed3422[_0x9328('0x1b')]===_0x9328('0x1c')&&typeof _0xed3422[_0x9328('0x1d')]===_0x9328('0x1c');var _0xe1765=_0x42624e[_0x9328('0x1e')];var _0x4740c6=_0x5ab41e?0x0:_0xed3422[_0x9328('0x1b')];var _0x4897c5=_0x5ab41e?_0x42624e[_0x9328('0x1e')]:_0xed3422['offset']+_0xed3422[_0x9328('0x1d')];var _0x9c916a;if(_0x4897c5>=_0xe1765){_0x4897c5=_0xe1765;_0x9c916a=0xc8;}else{_0x9c916a=0xce;}_0x3f9c07[_0x9328('0x18')](_0x9c916a);return _0x3f9c07[_0x9328('0x1f')](_0x9328('0x20'),_0x4740c6+'-'+_0x4897c5+'/'+_0xe1765)['json'](_0x42624e);}return null;};}function patchUpdates(_0x1ede69){return function(_0x11fdac){try{jsonpatch[_0x9328('0x21')](_0x11fdac,_0x1ede69,!![]);}catch(_0x50658f){return BPromise['reject'](_0x50658f);}return _0x11fdac[_0x9328('0x22')]();};}function saveUpdates(_0x4842bb,_0x26c703){return function(_0x4b4b0e){if(_0x4b4b0e){return _0x4b4b0e[_0x9328('0x23')](_0x4842bb)[_0x9328('0x24')](function(_0x321d5b){return _0x321d5b;});}return null;};}function removeEntity(_0x263a7e,_0x5e1c7a){return function(_0x3a6b59){if(_0x3a6b59){return _0x3a6b59[_0x9328('0x25')]()[_0x9328('0x24')](function(){_0x263a7e['status'](0xcc)[_0x9328('0x19')]();});}};}function handleEntityNotFound(_0x46abef,_0x3c05aa){return function(_0x4fab2f){if(!_0x4fab2f){_0x46abef[_0x9328('0x17')](0x194);}return _0x4fab2f;};}function handleError(_0xca6308,_0x56e604){_0x56e604=_0x56e604||0x1f4;return function(_0x50209e){logger[_0x9328('0x26')](_0x50209e[_0x9328('0x27')]);if(_0x50209e['name']){delete _0x50209e[_0x9328('0x28')];}_0xca6308['status'](_0x56e604)[_0x9328('0x29')](_0x50209e);};}exports['index']=function(_0x30bcfd,_0x2403c3){var _0xc8428={},_0x512537={},_0x2b64e1={'count':0x0,'rows':[]};var _0x2f75fc=_[_0x9328('0x2a')](db['FaxApplication'][_0x9328('0x2b')],function(_0x5d0b51){return{'name':_0x5d0b51[_0x9328('0x2c')],'type':_0x5d0b51[_0x9328('0x2d')][_0x9328('0x2e')]};});_0x512537['model']=_['map'](_0x2f75fc,_0x9328('0x28'));_0x512537[_0x9328('0x2f')]=_[_0x9328('0x30')](_0x30bcfd[_0x9328('0x2f')]);_0x512537[_0x9328('0x31')]=_[_0x9328('0x32')](_0x512537[_0x9328('0x33')],_0x512537[_0x9328('0x2f')]);_0xc8428['attributes']=_['intersection'](_0x512537[_0x9328('0x33')],qs[_0x9328('0x34')](_0x30bcfd[_0x9328('0x2f')][_0x9328('0x34')]));_0xc8428[_0x9328('0x35')]=_0xc8428[_0x9328('0x35')][_0x9328('0x36')]?_0xc8428[_0x9328('0x35')]:_0x512537[_0x9328('0x33')];if(!_0x30bcfd[_0x9328('0x2f')]['hasOwnProperty']('nolimit')){_0xc8428[_0x9328('0x1d')]=qs[_0x9328('0x1d')](_0x30bcfd['query'][_0x9328('0x1d')]);_0xc8428[_0x9328('0x1b')]=qs[_0x9328('0x1b')](_0x30bcfd['query']['offset']);}_0xc8428[_0x9328('0x37')]=qs[_0x9328('0x38')](_0x30bcfd[_0x9328('0x2f')][_0x9328('0x38')]);_0xc8428[_0x9328('0x39')]=qs[_0x9328('0x31')](_[_0x9328('0x3a')](_0x30bcfd[_0x9328('0x2f')],_0x512537[_0x9328('0x31')]),_0x2f75fc);if(_0x30bcfd[_0x9328('0x2f')]['filter']){_0xc8428['where']=_[_0x9328('0x3b')](_0xc8428[_0x9328('0x39')],{'$or':_[_0x9328('0x2a')](_0x2f75fc,function(_0x5a1579){if(_0x5a1579['type']!=='VIRTUAL'){var _0x3a123e={};_0x3a123e[_0x5a1579[_0x9328('0x28')]]={'$like':'%'+_0x30bcfd[_0x9328('0x2f')][_0x9328('0x3c')]+'%'};return _0x3a123e;}})});}_0xc8428=_['merge']({},_0xc8428,_0x30bcfd[_0x9328('0x3d')]);var _0x3eb26a={'where':_0xc8428['where']};return db['FaxApplication']['count'](_0x3eb26a)[_0x9328('0x24')](function(_0x2ca223){_0x2b64e1['count']=_0x2ca223;if(_0x30bcfd['query']['includeAll']){_0xc8428[_0x9328('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0xc8428);})[_0x9328('0x24')](function(_0x2cfce6){_0x2b64e1[_0x9328('0x3f')]=_0x2cfce6;return _0x2b64e1;})['then'](respondWithFilteredResult(_0x2403c3,_0xc8428))[_0x9328('0x40')](handleError(_0x2403c3,null));};exports[_0x9328('0x41')]=function(_0x2b390a,_0xc906b3){var _0x226ba8={'raw':!![],'where':{'id':_0x2b390a[_0x9328('0x42')]['id']}},_0x321fbd={};_0x321fbd[_0x9328('0x33')]=_[_0x9328('0x30')](db[_0x9328('0x43')]['rawAttributes']);_0x321fbd[_0x9328('0x2f')]=_[_0x9328('0x30')](_0x2b390a['query']);_0x321fbd[_0x9328('0x31')]=_['intersection'](_0x321fbd[_0x9328('0x33')],_0x321fbd[_0x9328('0x2f')]);_0x226ba8[_0x9328('0x35')]=_[_0x9328('0x32')](_0x321fbd[_0x9328('0x33')],qs[_0x9328('0x34')](_0x2b390a[_0x9328('0x2f')]['fields']));_0x226ba8['attributes']=_0x226ba8['attributes']['length']?_0x226ba8[_0x9328('0x35')]:_0x321fbd[_0x9328('0x33')];if(_0x2b390a[_0x9328('0x2f')]['includeAll']){_0x226ba8[_0x9328('0x3e')]=[{'all':!![]}];}_0x226ba8=_[_0x9328('0x3b')]({},_0x226ba8,_0x2b390a['options']);return db[_0x9328('0x43')]['find'](_0x226ba8)['then'](handleEntityNotFound(_0xc906b3,null))[_0x9328('0x24')](respondWithResult(_0xc906b3,null))[_0x9328('0x40')](handleError(_0xc906b3,null));};exports[_0x9328('0x44')]=function(_0x4b7533,_0x140cf9){return db[_0x9328('0x43')]['create'](_0x4b7533[_0x9328('0x45')],{})[_0x9328('0x24')](respondWithResult(_0x140cf9,0xc9))['catch'](handleError(_0x140cf9,null));};exports[_0x9328('0x23')]=function(_0x2b7555,_0x3e2cdf){if(_0x2b7555[_0x9328('0x45')]['id']){delete _0x2b7555[_0x9328('0x45')]['id'];}return db[_0x9328('0x43')][_0x9328('0x46')]({'where':{'id':_0x2b7555['params']['id']}})[_0x9328('0x24')](handleEntityNotFound(_0x3e2cdf,null))[_0x9328('0x24')](saveUpdates(_0x2b7555[_0x9328('0x45')],null))['then'](respondWithResult(_0x3e2cdf,null))[_0x9328('0x40')](handleError(_0x3e2cdf,null));};exports[_0x9328('0x25')]=function(_0x555030,_0x1a6370){return db['FaxApplication']['find']({'where':{'id':_0x555030[_0x9328('0x42')]['id']}})[_0x9328('0x24')](handleEntityNotFound(_0x1a6370,null))[_0x9328('0x24')](removeEntity(_0x1a6370,null))['catch'](handleError(_0x1a6370,null));}; \ No newline at end of file +var _0xd4f8=['show','params','rawAttributes','include','create','body','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','FaxApplication','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch'];(function(_0x2aee5c,_0x14ddfd){var _0x5e2363=function(_0x2b894b){while(--_0x2b894b){_0x2aee5c['push'](_0x2aee5c['shift']());}};_0x5e2363(++_0x14ddfd);}(_0xd4f8,0x12b));var _0x8d4f=function(_0x3ecebf,_0x11d3f1){_0x3ecebf=_0x3ecebf-0x0;var _0x452aa8=_0xd4f8[_0x3ecebf];return _0x452aa8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d4f('0x0'));var zipdir=require(_0x8d4f('0x1'));var jsonpatch=require(_0x8d4f('0x2'));var rp=require('request-promise');var moment=require(_0x8d4f('0x3'));var BPromise=require(_0x8d4f('0x4'));var Mustache=require(_0x8d4f('0x5'));var util=require('util');var path=require(_0x8d4f('0x6'));var sox=require(_0x8d4f('0x7'));var csv=require(_0x8d4f('0x8'));var ejs=require(_0x8d4f('0x9'));var fs=require('fs');var fs_extra=require(_0x8d4f('0xa'));var _=require(_0x8d4f('0xb'));var squel=require(_0x8d4f('0xc'));var crypto=require(_0x8d4f('0xd'));var jsforce=require(_0x8d4f('0xe'));var deskjs=require(_0x8d4f('0xf'));var toCsv=require(_0x8d4f('0x8'));var querystring=require(_0x8d4f('0x10'));var Papa=require(_0x8d4f('0x11'));var Redis=require('ioredis');var authService=require(_0x8d4f('0x12'));var qs=require(_0x8d4f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d4f('0x14'))(_0x8d4f('0x15'));var utils=require(_0x8d4f('0x16'));var config=require(_0x8d4f('0x17'));var licenseUtil=require(_0x8d4f('0x18'));var db=require(_0x8d4f('0x19'))['db'];function respondWithStatusCode(_0x3d2a0b,_0x2989f6){_0x2989f6=_0x2989f6||0xcc;return function(_0x1b78ea){if(_0x1b78ea){return _0x3d2a0b[_0x8d4f('0x1a')](_0x2989f6);}return _0x3d2a0b[_0x8d4f('0x1b')](_0x2989f6)['end']();};}function respondWithResult(_0x87aaf9,_0xc25c93){_0xc25c93=_0xc25c93||0xc8;return function(_0x4aa9cf){if(_0x4aa9cf){return _0x87aaf9[_0x8d4f('0x1b')](_0xc25c93)['json'](_0x4aa9cf);}};}function respondWithFilteredResult(_0x5c12fd,_0x42d414){return function(_0x1bc7c4){if(_0x1bc7c4){var _0x26ce35=typeof _0x42d414[_0x8d4f('0x1c')]==='undefined'&&typeof _0x42d414['limit']==='undefined';var _0x1045f4=_0x1bc7c4[_0x8d4f('0x1d')];var _0x140e36=_0x26ce35?0x0:_0x42d414[_0x8d4f('0x1c')];var _0x3cc4e5=_0x26ce35?_0x1bc7c4[_0x8d4f('0x1d')]:_0x42d414[_0x8d4f('0x1c')]+_0x42d414['limit'];var _0x1f3809;if(_0x3cc4e5>=_0x1045f4){_0x3cc4e5=_0x1045f4;_0x1f3809=0xc8;}else{_0x1f3809=0xce;}_0x5c12fd['status'](_0x1f3809);return _0x5c12fd[_0x8d4f('0x1e')](_0x8d4f('0x1f'),_0x140e36+'-'+_0x3cc4e5+'/'+_0x1045f4)[_0x8d4f('0x20')](_0x1bc7c4);}return null;};}function patchUpdates(_0x8bca63){return function(_0x4e5898){try{jsonpatch['apply'](_0x4e5898,_0x8bca63,!![]);}catch(_0x3ee3b5){return BPromise[_0x8d4f('0x21')](_0x3ee3b5);}return _0x4e5898[_0x8d4f('0x22')]();};}function saveUpdates(_0x2f0f22,_0x246979){return function(_0x49214d){if(_0x49214d){return _0x49214d[_0x8d4f('0x23')](_0x2f0f22)[_0x8d4f('0x24')](function(_0x9c12d2){return _0x9c12d2;});}return null;};}function removeEntity(_0x5c739,_0x375797){return function(_0x1ad128){if(_0x1ad128){return _0x1ad128[_0x8d4f('0x25')]()[_0x8d4f('0x24')](function(){_0x5c739['status'](0xcc)[_0x8d4f('0x26')]();});}};}function handleEntityNotFound(_0x166dbc,_0x35e491){return function(_0x13a4f2){if(!_0x13a4f2){_0x166dbc['sendStatus'](0x194);}return _0x13a4f2;};}function handleError(_0x4d3a80,_0x3e38b0){_0x3e38b0=_0x3e38b0||0x1f4;return function(_0x5c8ddf){logger[_0x8d4f('0x27')](_0x5c8ddf['stack']);if(_0x5c8ddf['name']){delete _0x5c8ddf[_0x8d4f('0x28')];}_0x4d3a80[_0x8d4f('0x1b')](_0x3e38b0)[_0x8d4f('0x29')](_0x5c8ddf);};}exports['index']=function(_0x5db28c,_0x3525f9){var _0x413ad4={},_0x477ade={},_0x367be5={'count':0x0,'rows':[]};var _0x81ad3f=_[_0x8d4f('0x2a')](db[_0x8d4f('0x2b')]['rawAttributes'],function(_0x54e12c){return{'name':_0x54e12c['fieldName'],'type':_0x54e12c[_0x8d4f('0x2c')][_0x8d4f('0x2d')]};});_0x477ade[_0x8d4f('0x2e')]=_[_0x8d4f('0x2a')](_0x81ad3f,_0x8d4f('0x28'));_0x477ade['query']=_[_0x8d4f('0x2f')](_0x5db28c[_0x8d4f('0x30')]);_0x477ade[_0x8d4f('0x31')]=_[_0x8d4f('0x32')](_0x477ade[_0x8d4f('0x2e')],_0x477ade['query']);_0x413ad4[_0x8d4f('0x33')]=_[_0x8d4f('0x32')](_0x477ade[_0x8d4f('0x2e')],qs[_0x8d4f('0x34')](_0x5db28c[_0x8d4f('0x30')]['fields']));_0x413ad4['attributes']=_0x413ad4['attributes'][_0x8d4f('0x35')]?_0x413ad4[_0x8d4f('0x33')]:_0x477ade[_0x8d4f('0x2e')];if(!_0x5db28c[_0x8d4f('0x30')]['hasOwnProperty'](_0x8d4f('0x36'))){_0x413ad4[_0x8d4f('0x37')]=qs[_0x8d4f('0x37')](_0x5db28c[_0x8d4f('0x30')][_0x8d4f('0x37')]);_0x413ad4['offset']=qs[_0x8d4f('0x1c')](_0x5db28c[_0x8d4f('0x30')][_0x8d4f('0x1c')]);}_0x413ad4[_0x8d4f('0x38')]=qs[_0x8d4f('0x39')](_0x5db28c[_0x8d4f('0x30')]['sort']);_0x413ad4['where']=qs[_0x8d4f('0x31')](_[_0x8d4f('0x3a')](_0x5db28c['query'],_0x477ade[_0x8d4f('0x31')]),_0x81ad3f);if(_0x5db28c[_0x8d4f('0x30')][_0x8d4f('0x3b')]){_0x413ad4[_0x8d4f('0x3c')]=_[_0x8d4f('0x3d')](_0x413ad4['where'],{'$or':_[_0x8d4f('0x2a')](_0x81ad3f,function(_0x5c7b23){if(_0x5c7b23[_0x8d4f('0x2c')]!==_0x8d4f('0x3e')){var _0x3ea6e6={};_0x3ea6e6[_0x5c7b23[_0x8d4f('0x28')]]={'$like':'%'+_0x5db28c[_0x8d4f('0x30')][_0x8d4f('0x3b')]+'%'};return _0x3ea6e6;}})});}_0x413ad4=_['merge']({},_0x413ad4,_0x5db28c[_0x8d4f('0x3f')]);var _0x42a43d={'where':_0x413ad4[_0x8d4f('0x3c')]};return db['FaxApplication'][_0x8d4f('0x1d')](_0x42a43d)[_0x8d4f('0x24')](function(_0x10cf82){_0x367be5[_0x8d4f('0x1d')]=_0x10cf82;if(_0x5db28c['query'][_0x8d4f('0x40')]){_0x413ad4['include']=[{'all':!![]}];}return db[_0x8d4f('0x2b')]['findAll'](_0x413ad4);})[_0x8d4f('0x24')](function(_0x48c0e8){_0x367be5['rows']=_0x48c0e8;return _0x367be5;})[_0x8d4f('0x24')](respondWithFilteredResult(_0x3525f9,_0x413ad4))[_0x8d4f('0x41')](handleError(_0x3525f9,null));};exports[_0x8d4f('0x42')]=function(_0x2962d2,_0x5adb01){var _0x426a7b={'raw':!![],'where':{'id':_0x2962d2[_0x8d4f('0x43')]['id']}},_0x560fe1={};_0x560fe1['model']=_[_0x8d4f('0x2f')](db[_0x8d4f('0x2b')][_0x8d4f('0x44')]);_0x560fe1[_0x8d4f('0x30')]=_['keys'](_0x2962d2[_0x8d4f('0x30')]);_0x560fe1['filters']=_['intersection'](_0x560fe1['model'],_0x560fe1[_0x8d4f('0x30')]);_0x426a7b['attributes']=_['intersection'](_0x560fe1[_0x8d4f('0x2e')],qs['fields'](_0x2962d2[_0x8d4f('0x30')][_0x8d4f('0x34')]));_0x426a7b[_0x8d4f('0x33')]=_0x426a7b[_0x8d4f('0x33')][_0x8d4f('0x35')]?_0x426a7b['attributes']:_0x560fe1[_0x8d4f('0x2e')];if(_0x2962d2[_0x8d4f('0x30')][_0x8d4f('0x40')]){_0x426a7b[_0x8d4f('0x45')]=[{'all':!![]}];}_0x426a7b=_['merge']({},_0x426a7b,_0x2962d2['options']);return db[_0x8d4f('0x2b')]['find'](_0x426a7b)[_0x8d4f('0x24')](handleEntityNotFound(_0x5adb01,null))[_0x8d4f('0x24')](respondWithResult(_0x5adb01,null))['catch'](handleError(_0x5adb01,null));};exports[_0x8d4f('0x46')]=function(_0x177403,_0x2902a0){return db['FaxApplication']['create'](_0x177403['body'],{})[_0x8d4f('0x24')](respondWithResult(_0x2902a0,0xc9))[_0x8d4f('0x41')](handleError(_0x2902a0,null));};exports[_0x8d4f('0x23')]=function(_0x47d189,_0x362c8a){if(_0x47d189[_0x8d4f('0x47')]['id']){delete _0x47d189[_0x8d4f('0x47')]['id'];}return db['FaxApplication'][_0x8d4f('0x48')]({'where':{'id':_0x47d189['params']['id']}})['then'](handleEntityNotFound(_0x362c8a,null))['then'](saveUpdates(_0x47d189[_0x8d4f('0x47')],null))[_0x8d4f('0x24')](respondWithResult(_0x362c8a,null))['catch'](handleError(_0x362c8a,null));};exports[_0x8d4f('0x25')]=function(_0x10e947,_0x3bb84a){return db[_0x8d4f('0x2b')][_0x8d4f('0x48')]({'where':{'id':_0x10e947[_0x8d4f('0x43')]['id']}})['then'](handleEntityNotFound(_0x3bb84a,null))[_0x8d4f('0x24')](removeEntity(_0x3bb84a,null))['catch'](handleError(_0x3bb84a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index c3084b6..194a806 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 _0x8428=['fax_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication'];(function(_0x167bb0,_0x26b77d){var _0x4d3531=function(_0x9405b8){while(--_0x9405b8){_0x167bb0['push'](_0x167bb0['shift']());}};_0x4d3531(++_0x26b77d);}(_0x8428,0x152));var _0x8842=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8428[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8842('0x0'));var util=require('util');var logger=require(_0x8842('0x1'))(_0x8842('0x2'));var moment=require(_0x8842('0x3'));var BPromise=require(_0x8842('0x4'));var rp=require(_0x8842('0x5'));var fs=require('fs');var path=require(_0x8842('0x6'));var rimraf=require(_0x8842('0x7'));var config=require(_0x8842('0x8'));var attributes=require(_0x8842('0x9'));module[_0x8842('0xa')]=function(_0x5a3584,_0x46ff1e){return _0x5a3584['define'](_0x8842('0xb'),attributes,{'tableName':_0x8842('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8842('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xde4d=['api','moment','bluebird','path','../../config/environment','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x132b80,_0x45521a){var _0x462527=function(_0x4db540){while(--_0x4db540){_0x132b80['push'](_0x132b80['shift']());}};_0x462527(++_0x45521a);}(_0xde4d,0xae));var _0xdde4=function(_0x293cea,_0x4dbaf5){_0x293cea=_0x293cea-0x0;var _0x311878=_0xde4d[_0x293cea];return _0x311878;};'use strict';var _=require(_0xdde4('0x0'));var util=require('util');var logger=require(_0xdde4('0x1'))(_0xdde4('0x2'));var moment=require(_0xdde4('0x3'));var BPromise=require(_0xdde4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdde4('0x5'));var rimraf=require('rimraf');var config=require(_0xdde4('0x6'));var attributes=require('./faxApplication.attributes');module[_0xdde4('0x7')]=function(_0x3c8f18,_0x331c65){return _0x3c8f18['define'](_0xdde4('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdde4('0x9'),'collate':_0xdde4('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 076e505..9955e9c 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 _0x2b18=['error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','lodash','util','moment','ioredis','rpc','jayson/promise','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b18,0x11e));var _0x82b1=function(_0x8654fd,_0x3c0e71){_0x8654fd=_0x8654fd-0x0;var _0x3dcc0b=_0x2b18[_0x8654fd];return _0x3dcc0b;};'use strict';var _=require(_0x82b1('0x0'));var util=require(_0x82b1('0x1'));var moment=require(_0x82b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x82b1('0x4'));var config=require('../../config/environment');var jayson=require(_0x82b1('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x554d75,_0x38f426,_0x26e87c){return new BPromise(function(_0x4f4646,_0x4af5ab){return client[_0x82b1('0x6')](_0x554d75,_0x26e87c)[_0x82b1('0x7')](function(_0x3cc818){logger[_0x82b1('0x8')](_0x82b1('0x9'),_0x38f426,_0x82b1('0xa'));logger[_0x82b1('0xb')](_0x82b1('0xc'),_0x38f426,_0x82b1('0xa'),JSON[_0x82b1('0xd')](_0x3cc818));if(_0x3cc818[_0x82b1('0xe')]){if(_0x3cc818[_0x82b1('0xe')][_0x82b1('0xf')]===0x1f4){logger[_0x82b1('0xe')]('FaxApplication,\x20%s,\x20%s',_0x38f426,_0x3cc818[_0x82b1('0xe')][_0x82b1('0x10')]);return _0x4af5ab(_0x3cc818[_0x82b1('0xe')]['message']);}logger['error'](_0x82b1('0x9'),_0x38f426,_0x3cc818[_0x82b1('0xe')][_0x82b1('0x10')]);return _0x4f4646(_0x3cc818[_0x82b1('0xe')][_0x82b1('0x10')]);}else{logger[_0x82b1('0x8')]('FaxApplication,\x20%s,\x20%s',_0x38f426,_0x82b1('0xa'));_0x4f4646(_0x3cc818[_0x82b1('0x11')][_0x82b1('0x10')]);}})[_0x82b1('0x12')](function(_0xb29ae){logger[_0x82b1('0xe')](_0x82b1('0x9'),_0x38f426,_0xb29ae);_0x4af5ab(_0xb29ae);});});}exports[_0x82b1('0x13')]=function(_0x49f748){var _0x5ebdfd=this;return new Promise(function(_0x5182dd,_0x5dc5d3){return db[_0x82b1('0x14')]['update'](_0x49f748[_0x82b1('0x15')],{'raw':_0x49f748[_0x82b1('0x16')]?_0x49f748[_0x82b1('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49f748[_0x82b1('0x16')]?_0x49f748[_0x82b1('0x16')][_0x82b1('0x17')]||null:null,'attributes':_0x49f748[_0x82b1('0x16')]?_0x49f748[_0x82b1('0x16')][_0x82b1('0x18')]||null:null,'limit':_0x49f748['options']?_0x49f748[_0x82b1('0x16')]['limit']||null:null})['then'](function(_0x272457){logger['info'](_0x82b1('0x13'),_0x49f748);logger[_0x82b1('0xb')](_0x82b1('0x13'),_0x49f748,JSON['stringify'](_0x272457));_0x5182dd(_0x272457);})[_0x82b1('0x12')](function(_0x5c9eb2){logger[_0x82b1('0xe')]('UpdateFaxApplication',_0x5c9eb2['message'],_0x49f748);_0x5dc5d3(_0x5ebdfd[_0x82b1('0xe')](0x1f4,_0x5c9eb2['message']));});});}; \ No newline at end of file +var _0xf8be=['FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxApplication,\x20%s,\x20%s','debug'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf8be,0x71));var _0xef8b=function(_0x3aa07b,_0x3ce0a0){_0x3aa07b=_0x3aa07b-0x0;var _0x29f31f=_0xf8be[_0x3aa07b];return _0x29f31f;};'use strict';var _=require('lodash');var util=require(_0xef8b('0x0'));var moment=require(_0xef8b('0x1'));var BPromise=require(_0xef8b('0x2'));var rs=require(_0xef8b('0x3'));var fs=require('fs');var Redis=require(_0xef8b('0x4'));var db=require(_0xef8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef8b('0x6'))(_0xef8b('0x7'));var config=require(_0xef8b('0x8'));var jayson=require(_0xef8b('0x9'));var client=jayson['client'][_0xef8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20b448,_0x1dc3d3,_0x1d1923){return new BPromise(function(_0x3e38ee,_0x5204c6){return client[_0xef8b('0xb')](_0x20b448,_0x1d1923)[_0xef8b('0xc')](function(_0x13b58d){logger['info'](_0xef8b('0xd'),_0x1dc3d3,'request\x20sent');logger[_0xef8b('0xe')](_0xef8b('0xf'),_0x1dc3d3,'request\x20sent',JSON['stringify'](_0x13b58d));if(_0x13b58d[_0xef8b('0x10')]){if(_0x13b58d['error'][_0xef8b('0x11')]===0x1f4){logger[_0xef8b('0x10')]('FaxApplication,\x20%s,\x20%s',_0x1dc3d3,_0x13b58d[_0xef8b('0x10')][_0xef8b('0x12')]);return _0x5204c6(_0x13b58d[_0xef8b('0x10')][_0xef8b('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x1dc3d3,_0x13b58d[_0xef8b('0x10')][_0xef8b('0x12')]);return _0x3e38ee(_0x13b58d[_0xef8b('0x10')][_0xef8b('0x12')]);}else{logger[_0xef8b('0x13')](_0xef8b('0xd'),_0x1dc3d3,_0xef8b('0x14'));_0x3e38ee(_0x13b58d[_0xef8b('0x15')][_0xef8b('0x12')]);}})[_0xef8b('0x16')](function(_0x1634e4){logger[_0xef8b('0x10')](_0xef8b('0xd'),_0x1dc3d3,_0x1634e4);_0x5204c6(_0x1634e4);});});}exports[_0xef8b('0x17')]=function(_0x210d26){var _0x55ff0d=this;return new Promise(function(_0x29af36,_0x4eed93){return db[_0xef8b('0x18')][_0xef8b('0x19')](_0x210d26['body'],{'raw':_0x210d26[_0xef8b('0x1a')]?_0x210d26[_0xef8b('0x1a')][_0xef8b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210d26['options']?_0x210d26[_0xef8b('0x1a')][_0xef8b('0x1c')]||null:null,'attributes':_0x210d26[_0xef8b('0x1a')]?_0x210d26[_0xef8b('0x1a')][_0xef8b('0x1d')]||null:null,'limit':_0x210d26['options']?_0x210d26[_0xef8b('0x1a')][_0xef8b('0x1e')]||null:null})[_0xef8b('0xc')](function(_0x9e313){logger['info']('UpdateFaxApplication',_0x210d26);logger[_0xef8b('0xe')](_0xef8b('0x17'),_0x210d26,JSON[_0xef8b('0x1f')](_0x9e313));_0x29af36(_0x9e313);})[_0xef8b('0x16')](function(_0x55852a){logger[_0xef8b('0x10')](_0xef8b('0x17'),_0x55852a[_0xef8b('0x12')],_0x210d26);_0x4eed93(_0x55ff0d[_0xef8b('0x10')](0x1f4,_0x55852a[_0xef8b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a3ed9fd..1033def 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 _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4c3550,_0x171432){var _0x2dc5f7=function(_0x388dce){while(--_0x388dce){_0x4c3550['push'](_0x4c3550['shift']());}};_0x2dc5f7(++_0x171432);}(_0xb03e,0x1eb));var _0xeb03=function(_0xe1efe2,_0x596cb1){_0xe1efe2=_0xe1efe2-0x0;var _0x1133c7=_0xb03e[_0xe1efe2];return _0x1133c7;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file +var _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x955f,0x1eb));var _0xf955=function(_0x236bef,_0x2e8b13){_0x236bef=_0x236bef-0x0;var _0x5f3868=_0x955f[_0x236bef];return _0x5f3868;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1c5e062..52a0e1c 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 _0x95d3=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x3852df,_0x299709){var _0xa162a3=function(_0x10416f){while(--_0x10416f){_0x3852df['push'](_0x3852df['shift']());}};_0xa162a3(++_0x299709);}(_0x95d3,0x89));var _0x395d=function(_0xfc316b,_0x3bec1a){_0xfc316b=_0xfc316b-0x0;var _0x359fc7=_0x95d3[_0xfc316b];return _0x359fc7;};'use strict';var Sequelize=require(_0x395d('0x0'));module[_0x395d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x395d('0x2')]},'disposition':{'type':Sequelize[_0x395d('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x395d('0x3')]},'read1stAt':{'type':Sequelize[_0x395d('0x2')]},'fax':{'type':Sequelize[_0x395d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x395d('0x4')]('in',_0x395d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x395d('0x4')]('in',_0x395d('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4eda=['STRING','out','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x70c97a,_0xd4d263){var _0x5cb362=function(_0x163f30){while(--_0x163f30){_0x70c97a['push'](_0x70c97a['shift']());}};_0x5cb362(++_0xd4d263);}(_0x4eda,0x11b));var _0xa4ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4eda[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa4ed('0x0'));module[_0xa4ed('0x1')]={'closed':{'type':Sequelize[_0xa4ed('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa4ed('0x3')]},'disposition':{'type':Sequelize[_0xa4ed('0x4')]},'secondDisposition':{'type':Sequelize[_0xa4ed('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa4ed('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa4ed('0x3')]},'fax':{'type':Sequelize[_0xa4ed('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa4ed('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa4ed('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa4ed('0x6')]('in',_0xa4ed('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index c7a8367..da3c704 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 _0x6eb4=['basename','existsSync','createWriteStream','resolve','log','rimraf','zip-dir','moment','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','index','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','FaxInteraction','filters','model','attributes','intersection','fields','includeAll','include','options','find','create','body','describe','addMessage','FaxMessage','ids','rawAttributes','order','sort','where','pick','FaxInteractionId','filter','merge','map','$gte','split','format','rows','setTags','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','length'];(function(_0x3ec69d,_0xf8aade){var _0x394c7e=function(_0x16764b){while(--_0x16764b){_0x3ec69d['push'](_0x3ec69d['shift']());}};_0x394c7e(++_0xf8aade);}(_0x6eb4,0x125));var _0x46eb=function(_0x377a6a,_0x1f0b7a){_0x377a6a=_0x377a6a-0x0;var _0x21cf0b=_0x6eb4[_0x377a6a];return _0x21cf0b;};'use strict';var rimraf=require(_0x46eb('0x0'));var zipdir=require(_0x46eb('0x1'));var moment=require(_0x46eb('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x46eb('0x3'));var interaction=require(_0x46eb('0x4'));var qs=require(_0x46eb('0x5'));var logger=require(_0x46eb('0x6'))(_0x46eb('0x7'));var config=require(_0x46eb('0x8'));var db=require('../../mysqldb')['db'];config[_0x46eb('0x9')]=_[_0x46eb('0xa')](config[_0x46eb('0x9')],{'host':_0x46eb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46eb('0x9')]));require(_0x46eb('0xc'))['register'](socket);function respondWithStatusCode(_0x27f940,_0x435872){_0x435872=_0x435872||0xcc;return function(_0x137ae8){if(_0x137ae8){return _0x27f940[_0x46eb('0xd')](_0x435872);}return _0x27f940[_0x46eb('0xe')](_0x435872)[_0x46eb('0xf')]();};}function respondWithResult(_0xbecb01,_0x350640){_0x350640=_0x350640||0xc8;return function(_0x2f1262){if(_0x2f1262){return _0xbecb01['status'](_0x350640)[_0x46eb('0x10')](_0x2f1262);}};}function respondWithFilteredResult(_0x44a076,_0x5a3051){return function(_0x371c62){if(_0x371c62){var _0x4e1125=typeof _0x5a3051[_0x46eb('0x11')]===_0x46eb('0x12')&&typeof _0x5a3051[_0x46eb('0x13')]===_0x46eb('0x12');var _0x47ea2a=_0x371c62[_0x46eb('0x14')];var _0x2f81f0=_0x4e1125?0x0:_0x5a3051['offset'];var _0x3b8fe1=_0x4e1125?_0x371c62[_0x46eb('0x14')]:_0x5a3051[_0x46eb('0x11')]+_0x5a3051[_0x46eb('0x13')];var _0x3a3527;if(_0x3b8fe1>=_0x47ea2a){_0x3b8fe1=_0x47ea2a;_0x3a3527=0xc8;}else{_0x3a3527=0xce;}_0x44a076[_0x46eb('0xe')](_0x3a3527);return _0x44a076[_0x46eb('0x15')](_0x46eb('0x16'),_0x2f81f0+'-'+_0x3b8fe1+'/'+_0x47ea2a)['json'](_0x371c62);}return null;};}function saveUpdates(_0xb9aa41){return function(_0x5da8d2){if(_0x5da8d2){return _0x5da8d2[_0x46eb('0x17')](_0xb9aa41)[_0x46eb('0x18')](function(_0x145bdc){return _0x145bdc;});}return null;};}function removeEntity(_0x204fea){return function(_0xe3ea40){if(_0xe3ea40){return _0xe3ea40[_0x46eb('0x19')]()[_0x46eb('0x18')](function(){_0x204fea['status'](0xcc)[_0x46eb('0xf')]();});}};}function handleEntityNotFound(_0x49df57){return function(_0x5e7d48){if(!_0x5e7d48){_0x49df57[_0x46eb('0xd')](0x194);}return _0x5e7d48;};}function handleError(_0x227d9c,_0x3ae211){_0x3ae211=_0x3ae211||0x1f4;return function(_0x3ca265){logger['error'](_0x3ca265['stack']);if(_0x3ca265[_0x46eb('0x1a')]){delete _0x3ca265['name'];}_0x227d9c[_0x46eb('0xe')](_0x3ae211)['send'](_0x3ca265);};}exports[_0x46eb('0x1b')]=function(_0x6c8953,_0x5b27b2){var _0x53fd45={};var _0x10eabe=_['map'](db['FaxInteraction']['rawAttributes'],function(_0x18c998){return{'name':_0x18c998['fieldName'],'type':_0x18c998[_0x46eb('0x1c')][_0x46eb('0x1d')]};});_0x53fd45=qs[_0x46eb('0x1e')](_0x10eabe,_0x6c8953);return interaction[_0x46eb('0x1f')](_0x46eb('0x20'),_0x6c8953[_0x46eb('0x21')],_0x6c8953[_0x46eb('0x22')],_0x53fd45,_0x10eabe)['then'](respondWithFilteredResult(_0x5b27b2,_0x53fd45))[_0x46eb('0x23')](handleError(_0x5b27b2,null));};exports[_0x46eb('0x24')]=function(_0x1738c1,_0x4c7d43){var _0x522d91={'raw':![],'where':{'id':_0x1738c1[_0x46eb('0x25')]['id']}},_0x2aa06d={};_0x2aa06d['model']=_[_0x46eb('0x26')](db[_0x46eb('0x27')]['rawAttributes']);_0x2aa06d[_0x46eb('0x21')]=_[_0x46eb('0x26')](_0x1738c1[_0x46eb('0x21')]);_0x2aa06d[_0x46eb('0x28')]=_['intersection'](_0x2aa06d[_0x46eb('0x29')],_0x2aa06d[_0x46eb('0x21')]);_0x522d91[_0x46eb('0x2a')]=_[_0x46eb('0x2b')](_0x2aa06d[_0x46eb('0x29')],qs[_0x46eb('0x2c')](_0x1738c1[_0x46eb('0x21')][_0x46eb('0x2c')]));_0x522d91[_0x46eb('0x2a')]=_0x522d91[_0x46eb('0x2a')]['length']?_0x522d91['attributes']:_0x2aa06d[_0x46eb('0x29')];if(_0x1738c1['query'][_0x46eb('0x2d')]){_0x522d91[_0x46eb('0x2e')]=[{'all':!![]}];}_0x522d91=_['merge']({},_0x522d91,_0x1738c1[_0x46eb('0x2f')]);return db[_0x46eb('0x27')][_0x46eb('0x30')](_0x522d91)['then'](handleEntityNotFound(_0x4c7d43,null))['then'](respondWithResult(_0x4c7d43,null))[_0x46eb('0x23')](handleError(_0x4c7d43,null));};exports[_0x46eb('0x31')]=function(_0x4b1104,_0x411a9c){return db[_0x46eb('0x27')][_0x46eb('0x31')](_0x4b1104[_0x46eb('0x32')],{})[_0x46eb('0x18')](respondWithResult(_0x411a9c,0xc9))[_0x46eb('0x23')](handleError(_0x411a9c,null));};exports[_0x46eb('0x17')]=function(_0x542aa5,_0x33b4ef){if(_0x542aa5[_0x46eb('0x32')]['id']){delete _0x542aa5['body']['id'];}return db['FaxInteraction'][_0x46eb('0x30')]({'where':{'id':_0x542aa5[_0x46eb('0x25')]['id']}})[_0x46eb('0x18')](handleEntityNotFound(_0x33b4ef,null))[_0x46eb('0x18')](saveUpdates(_0x542aa5['body'],null))['then'](respondWithResult(_0x33b4ef,null))[_0x46eb('0x23')](handleError(_0x33b4ef,null));};exports[_0x46eb('0x19')]=function(_0x1fde11,_0x4d551a){return db['FaxInteraction']['find']({'where':{'id':_0x1fde11[_0x46eb('0x25')]['id']}})['then'](handleEntityNotFound(_0x4d551a,null))[_0x46eb('0x18')](removeEntity(_0x4d551a,null))[_0x46eb('0x23')](handleError(_0x4d551a,null));};exports['describe']=function(_0x38e209,_0x5a5c29){return db['FaxInteraction'][_0x46eb('0x33')]()[_0x46eb('0x18')](respondWithResult(_0x5a5c29,null))[_0x46eb('0x23')](handleError(_0x5a5c29,null));};exports[_0x46eb('0x34')]=function(_0xa37f87,_0xeb589f){return db[_0x46eb('0x35')][_0x46eb('0x30')]({'where':{'id':_0xa37f87['params']['id']}})[_0x46eb('0x18')](handleEntityNotFound(_0xeb589f,null))[_0x46eb('0x18')](function(_0x438c22){if(_0x438c22){return _0x438c22[_0x46eb('0x34')](_0xa37f87[_0x46eb('0x32')][_0x46eb('0x36')],_['omit'](_0xa37f87[_0x46eb('0x32')],[_0x46eb('0x36'),'id'])||{});}})['then'](respondWithResult(_0xeb589f,null))[_0x46eb('0x23')](handleError(_0xeb589f,null));};exports['getMessages']=function(_0x317d57,_0x4c585f){var _0x688a60={'raw':![],'where':{}};var _0x1b5914={};var _0x323a5f={'count':0x0,'rows':[]};return db[_0x46eb('0x27')]['findOne']({'where':{'id':_0x317d57['params']['id']}})[_0x46eb('0x18')](handleEntityNotFound(_0x4c585f,null))['then'](function(_0x9cdc36){if(_0x9cdc36){_0x1b5914[_0x46eb('0x29')]=_[_0x46eb('0x26')](db[_0x46eb('0x35')][_0x46eb('0x37')]);_0x1b5914[_0x46eb('0x21')]=_[_0x46eb('0x26')](_0x317d57[_0x46eb('0x21')]);_0x1b5914[_0x46eb('0x28')]=_['intersection'](_0x1b5914['model'],_0x1b5914['query']);_0x688a60['attributes']=_['intersection'](_0x1b5914[_0x46eb('0x29')],qs['fields'](_0x317d57[_0x46eb('0x21')][_0x46eb('0x2c')]));_0x688a60['attributes']=_0x688a60['attributes']['length']?_0x688a60[_0x46eb('0x2a')]:_0x1b5914[_0x46eb('0x29')];if(!_0x317d57[_0x46eb('0x21')]['hasOwnProperty']('nolimit')){_0x688a60['limit']=qs[_0x46eb('0x13')](_0x317d57[_0x46eb('0x21')][_0x46eb('0x13')]);_0x688a60['offset']=qs['offset'](_0x317d57[_0x46eb('0x21')][_0x46eb('0x11')]);}_0x688a60[_0x46eb('0x38')]=qs['sort'](_0x317d57[_0x46eb('0x21')][_0x46eb('0x39')]);_0x688a60[_0x46eb('0x3a')]=qs[_0x46eb('0x28')](_[_0x46eb('0x3b')](_0x317d57[_0x46eb('0x21')],_0x1b5914[_0x46eb('0x28')]));_0x688a60[_0x46eb('0x3a')][_0x46eb('0x3c')]=_0x9cdc36['id'];if(_0x317d57[_0x46eb('0x21')][_0x46eb('0x3d')]){_0x688a60[_0x46eb('0x3a')]=_[_0x46eb('0x3e')](_0x688a60[_0x46eb('0x3a')],{'$or':_[_0x46eb('0x3f')](_0x688a60[_0x46eb('0x2a')],function(_0x1e21fa){var _0x3eefc5={};_0x3eefc5[_0x1e21fa]={'$like':'%'+_0x317d57[_0x46eb('0x21')][_0x46eb('0x3d')]+'%'};return _0x3eefc5;})});}if(_0x317d57['query'][_0x46eb('0x40')]){var _0x34c231=_0x317d57['query'][_0x46eb('0x40')][_0x46eb('0x41')](',');var _0x2e0df8={};_0x2e0df8[_0x34c231[0x0]]={'$gte':moment(_0x34c231[0x1])[_0x46eb('0x42')]('YYYY-MM-DD\x20HH:mm:ss')};_0x688a60['where']=_['merge'](_0x688a60[_0x46eb('0x3a')],_0x2e0df8);}_0x688a60=_['merge']({},_0x688a60,_0x317d57[_0x46eb('0x2f')]);return db['FaxMessage']['count']({'where':_0x688a60[_0x46eb('0x3a')]})[_0x46eb('0x18')](function(_0xa257c6){_0x323a5f[_0x46eb('0x14')]=_0xa257c6;if(_0x317d57[_0x46eb('0x21')][_0x46eb('0x2d')]){_0x688a60[_0x46eb('0x2e')]=[{'all':!![]}];}return db[_0x46eb('0x35')][_0x46eb('0x1f')](_0x688a60);})[_0x46eb('0x18')](function(_0x253e0e){_0x323a5f[_0x46eb('0x43')]=_0x253e0e;return _0x323a5f;});}})['then'](respondWithFilteredResult(_0x4c585f,_0x688a60))[_0x46eb('0x23')](handleError(_0x4c585f,null));};exports['addTags']=function(_0x23e48b,_0x4a7e95){return db[_0x46eb('0x27')][_0x46eb('0x30')]({'where':{'id':_0x23e48b[_0x46eb('0x25')]['id']}})[_0x46eb('0x18')](handleEntityNotFound(_0x4a7e95,null))['then'](function(_0xcc8395){if(_0xcc8395){return _0xcc8395[_0x46eb('0x44')](_0x23e48b[_0x46eb('0x32')][_0x46eb('0x36')],_[_0x46eb('0x45')](_0x23e48b['body'],['ids','id'])||{})[_0x46eb('0x46')](function(){return db[_0x46eb('0x47')]['findAll']({'attributes':['id',_0x46eb('0x1a'),_0x46eb('0x48')],'where':{'id':_0x23e48b[_0x46eb('0x32')][_0x46eb('0x36')]}});})[_0x46eb('0x18')](function(_0x4e4572){socket[_0x46eb('0x49')](_0x46eb('0x4a'),{'id':Number(_0x23e48b['params']['id']),'tags':_0x4e4572||[]});return{'id':Number(_0x23e48b[_0x46eb('0x25')]['id']),'tags':_0x4e4572||[]};});}})[_0x46eb('0x18')](respondWithResult(_0x4a7e95,null))[_0x46eb('0x23')](handleError(_0x4a7e95,null));};exports[_0x46eb('0x4b')]=function(_0x42504d,_0xdad443){return db[_0x46eb('0x27')][_0x46eb('0x30')]({'where':{'id':_0x42504d['params']['id']}})[_0x46eb('0x18')](handleEntityNotFound(_0xdad443,null))['then'](function(_0x54baa0){if(_0x54baa0){return _0x54baa0[_0x46eb('0x4b')](_0x42504d[_0x46eb('0x21')][_0x46eb('0x36')]);}})[_0x46eb('0x18')](respondWithStatusCode(_0xdad443,null))[_0x46eb('0x23')](handleError(_0xdad443,null));};exports[_0x46eb('0x4c')]=function(_0x32de3f,_0x4bf7df){var _0x44c7f2=moment()[_0x46eb('0x4d')]()['toString']();var _0x422f5a=path[_0x46eb('0x4e')](config[_0x46eb('0x4f')],_0x46eb('0x50'),'files',_0x46eb('0x51'));var _0x195981=path[_0x46eb('0x4e')](config[_0x46eb('0x4f')],_0x46eb('0x50'),_0x46eb('0x52'),_0x46eb('0x53'));var _0x1db89b=path[_0x46eb('0x4e')](_0x422f5a,_0x44c7f2);var _0x3e4d09=util['format'](_0x46eb('0x54'),_0x32de3f[_0x46eb('0x25')]['id'],_0x44c7f2);var _0x29e7cd=path[_0x46eb('0x4e')](_0x422f5a,_0x3e4d09);var _0x1313aa=[];_0x1313aa[_0x46eb('0x55')]({'model':db[_0x46eb('0x56')],'as':'Attachment','raw':!![]});var _0x256043=[{'model':db[_0x46eb('0x35')],'as':_0x46eb('0x57'),'attributes':['id',_0x46eb('0x32'),_0x46eb('0x58')],'include':_0x1313aa}];return db[_0x46eb('0x27')][_0x46eb('0x30')]({'where':{'id':_0x32de3f[_0x46eb('0x25')]['id']},'include':_0x256043})[_0x46eb('0x18')](handleEntityNotFound(_0x4bf7df,null))['then'](function(_0x21dd4b){if(_0x21dd4b&&_0x21dd4b[_0x46eb('0x57')]){var _0x5c0ad3=_0x21dd4b['get']({'plain':!![]});fs[_0x46eb('0x59')](_0x1db89b);for(var _0x56874d=0x0;_0x56874d<_0x5c0ad3['Messages'][_0x46eb('0x5a')];_0x56874d++){var _0x502861=_0x5c0ad3['Messages'][_0x56874d][_0x46eb('0x56')];if(_0x502861){var _0x4588dc=path[_0x46eb('0x4e')](_0x195981,_0x502861[_0x46eb('0x5b')]);if(fs[_0x46eb('0x5c')](_0x4588dc)){fs['createReadStream'](_0x4588dc)['pipe'](fs[_0x46eb('0x5d')](path[_0x46eb('0x4e')](_0x1db89b,_0x502861[_0x46eb('0x5b')])));}}}return BPromise[_0x46eb('0x5e')]()[_0x46eb('0x18')](function(){return new BPromise(function(_0x1a2829,_0x79a8ac){zipdir(_0x1db89b,{'saveTo':_0x29e7cd},function(_0x3e16ae,_0x32323e){if(_0x3e16ae)return _0x79a8ac(_0x3e16ae);return _0x1a2829(_0x32323e);});})['then'](function(){return new BPromise(function(_0x4b66d8,_0x3440bf){rimraf(_0x1db89b,function(_0x129e99){if(_0x129e99)_0x3440bf(_0x129e99);return _0x4b66d8();});});})[_0x46eb('0x18')](function(){return _0x4bf7df[_0x46eb('0x4c')](_0x29e7cd,_0x3e4d09,function(_0x20eed5){if(_0x20eed5){console[_0x46eb('0x5f')]('err',_0x20eed5);}else{fs['unlinkSync'](_0x29e7cd);}});});});}else{return _0x4bf7df[_0x46eb('0xd')](0xc8);}})[_0x46eb('0x23')](handleError(_0x4bf7df,null));}; \ No newline at end of file +var _0x21c8=['defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','name','index','map','FaxInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','keys','rawAttributes','intersection','model','attributes','fields','includeAll','include','merge','create','body','find','addMessage','FaxMessage','ids','omit','findOne','filters','length','hasOwnProperty','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','resolve','log','unlinkSync','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb'];(function(_0xf671c8,_0x275759){var _0x2a7d44=function(_0x18481f){while(--_0x18481f){_0xf671c8['push'](_0xf671c8['shift']());}};_0x2a7d44(++_0x275759);}(_0x21c8,0x1ea));var _0x821c=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x21c8[_0x4e8401];return _0x17269f;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x821c('0x0'));var util=require(_0x821c('0x1'));var path=require(_0x821c('0x2'));var fs=require('fs');var _=require(_0x821c('0x3'));var Redis=require(_0x821c('0x4'));var interaction=require(_0x821c('0x5'));var qs=require(_0x821c('0x6'));var logger=require(_0x821c('0x7'))(_0x821c('0x8'));var config=require('../../config/environment');var db=require(_0x821c('0x9'))['db'];config['redis']=_[_0x821c('0xa')](config[_0x821c('0xb')],{'host':_0x821c('0xc'),'port':0x18eb});var socket=require(_0x821c('0xd'))(new Redis(config[_0x821c('0xb')]));require(_0x821c('0xe'))[_0x821c('0xf')](socket);function respondWithStatusCode(_0x4494fd,_0x4e4131){_0x4e4131=_0x4e4131||0xcc;return function(_0x520edd){if(_0x520edd){return _0x4494fd[_0x821c('0x10')](_0x4e4131);}return _0x4494fd[_0x821c('0x11')](_0x4e4131)[_0x821c('0x12')]();};}function respondWithResult(_0x4e5180,_0x417f25){_0x417f25=_0x417f25||0xc8;return function(_0x47a95b){if(_0x47a95b){return _0x4e5180[_0x821c('0x11')](_0x417f25)['json'](_0x47a95b);}};}function respondWithFilteredResult(_0xdaaebf,_0x278966){return function(_0x31224c){if(_0x31224c){var _0x123e94=typeof _0x278966[_0x821c('0x13')]===_0x821c('0x14')&&typeof _0x278966[_0x821c('0x15')]===_0x821c('0x14');var _0x456707=_0x31224c[_0x821c('0x16')];var _0x3436a5=_0x123e94?0x0:_0x278966[_0x821c('0x13')];var _0x241fbe=_0x123e94?_0x31224c['count']:_0x278966[_0x821c('0x13')]+_0x278966[_0x821c('0x15')];var _0x575305;if(_0x241fbe>=_0x456707){_0x241fbe=_0x456707;_0x575305=0xc8;}else{_0x575305=0xce;}_0xdaaebf[_0x821c('0x11')](_0x575305);return _0xdaaebf[_0x821c('0x17')](_0x821c('0x18'),_0x3436a5+'-'+_0x241fbe+'/'+_0x456707)[_0x821c('0x19')](_0x31224c);}return null;};}function saveUpdates(_0x20e70b){return function(_0x39f1c5){if(_0x39f1c5){return _0x39f1c5[_0x821c('0x1a')](_0x20e70b)[_0x821c('0x1b')](function(_0x1575b6){return _0x1575b6;});}return null;};}function removeEntity(_0x582156){return function(_0x4136bc){if(_0x4136bc){return _0x4136bc['destroy']()[_0x821c('0x1b')](function(){_0x582156[_0x821c('0x11')](0xcc)[_0x821c('0x12')]();});}};}function handleEntityNotFound(_0x435433){return function(_0x2fb33b){if(!_0x2fb33b){_0x435433['sendStatus'](0x194);}return _0x2fb33b;};}function handleError(_0x3c97eb,_0x5ececa){_0x5ececa=_0x5ececa||0x1f4;return function(_0x129a10){logger[_0x821c('0x1c')](_0x129a10['stack']);if(_0x129a10[_0x821c('0x1d')]){delete _0x129a10[_0x821c('0x1d')];}_0x3c97eb[_0x821c('0x11')](_0x5ececa)['send'](_0x129a10);};}exports[_0x821c('0x1e')]=function(_0x4e8536,_0x24c5a8){var _0x2f01f8={};var _0x1363a5=_[_0x821c('0x1f')](db[_0x821c('0x20')]['rawAttributes'],function(_0x2a60f2){return{'name':_0x2a60f2[_0x821c('0x21')],'type':_0x2a60f2[_0x821c('0x22')][_0x821c('0x23')]};});_0x2f01f8=qs[_0x821c('0x24')](_0x1363a5,_0x4e8536);return interaction[_0x821c('0x25')]('fax',_0x4e8536[_0x821c('0x26')],_0x4e8536[_0x821c('0x27')],_0x2f01f8,_0x1363a5)[_0x821c('0x1b')](respondWithFilteredResult(_0x24c5a8,_0x2f01f8))[_0x821c('0x28')](handleError(_0x24c5a8,null));};exports[_0x821c('0x29')]=function(_0x37455e,_0x4ec441){var _0x1c937e={'raw':![],'where':{'id':_0x37455e[_0x821c('0x2a')]['id']}},_0x2c2c02={};_0x2c2c02['model']=_[_0x821c('0x2b')](db['FaxInteraction'][_0x821c('0x2c')]);_0x2c2c02['query']=_['keys'](_0x37455e[_0x821c('0x26')]);_0x2c2c02['filters']=_[_0x821c('0x2d')](_0x2c2c02[_0x821c('0x2e')],_0x2c2c02['query']);_0x1c937e[_0x821c('0x2f')]=_[_0x821c('0x2d')](_0x2c2c02['model'],qs[_0x821c('0x30')](_0x37455e['query'][_0x821c('0x30')]));_0x1c937e['attributes']=_0x1c937e[_0x821c('0x2f')]['length']?_0x1c937e[_0x821c('0x2f')]:_0x2c2c02[_0x821c('0x2e')];if(_0x37455e['query'][_0x821c('0x31')]){_0x1c937e[_0x821c('0x32')]=[{'all':!![]}];}_0x1c937e=_[_0x821c('0x33')]({},_0x1c937e,_0x37455e['options']);return db[_0x821c('0x20')]['find'](_0x1c937e)[_0x821c('0x1b')](handleEntityNotFound(_0x4ec441,null))[_0x821c('0x1b')](respondWithResult(_0x4ec441,null))[_0x821c('0x28')](handleError(_0x4ec441,null));};exports[_0x821c('0x34')]=function(_0x1b3d88,_0x3bb46a){return db[_0x821c('0x20')]['create'](_0x1b3d88[_0x821c('0x35')],{})[_0x821c('0x1b')](respondWithResult(_0x3bb46a,0xc9))[_0x821c('0x28')](handleError(_0x3bb46a,null));};exports[_0x821c('0x1a')]=function(_0x2474ca,_0x513e10){if(_0x2474ca[_0x821c('0x35')]['id']){delete _0x2474ca[_0x821c('0x35')]['id'];}return db['FaxInteraction'][_0x821c('0x36')]({'where':{'id':_0x2474ca[_0x821c('0x2a')]['id']}})[_0x821c('0x1b')](handleEntityNotFound(_0x513e10,null))['then'](saveUpdates(_0x2474ca[_0x821c('0x35')],null))[_0x821c('0x1b')](respondWithResult(_0x513e10,null))['catch'](handleError(_0x513e10,null));};exports['destroy']=function(_0xcc580d,_0x4cd9a1){return db['FaxInteraction']['find']({'where':{'id':_0xcc580d[_0x821c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4cd9a1,null))['then'](removeEntity(_0x4cd9a1,null))[_0x821c('0x28')](handleError(_0x4cd9a1,null));};exports['describe']=function(_0x38beb1,_0x1c45dc){return db['FaxInteraction']['describe']()[_0x821c('0x1b')](respondWithResult(_0x1c45dc,null))['catch'](handleError(_0x1c45dc,null));};exports[_0x821c('0x37')]=function(_0x6c53bf,_0x45f278){return db[_0x821c('0x38')][_0x821c('0x36')]({'where':{'id':_0x6c53bf[_0x821c('0x2a')]['id']}})[_0x821c('0x1b')](handleEntityNotFound(_0x45f278,null))[_0x821c('0x1b')](function(_0x19f11f){if(_0x19f11f){return _0x19f11f['addMessage'](_0x6c53bf['body'][_0x821c('0x39')],_[_0x821c('0x3a')](_0x6c53bf[_0x821c('0x35')],[_0x821c('0x39'),'id'])||{});}})['then'](respondWithResult(_0x45f278,null))[_0x821c('0x28')](handleError(_0x45f278,null));};exports['getMessages']=function(_0x466bed,_0x1e72d8){var _0x3e0291={'raw':![],'where':{}};var _0x43f894={};var _0x334616={'count':0x0,'rows':[]};return db[_0x821c('0x20')][_0x821c('0x3b')]({'where':{'id':_0x466bed['params']['id']}})[_0x821c('0x1b')](handleEntityNotFound(_0x1e72d8,null))[_0x821c('0x1b')](function(_0x529a30){if(_0x529a30){_0x43f894[_0x821c('0x2e')]=_[_0x821c('0x2b')](db[_0x821c('0x38')]['rawAttributes']);_0x43f894[_0x821c('0x26')]=_[_0x821c('0x2b')](_0x466bed[_0x821c('0x26')]);_0x43f894[_0x821c('0x3c')]=_['intersection'](_0x43f894[_0x821c('0x2e')],_0x43f894[_0x821c('0x26')]);_0x3e0291[_0x821c('0x2f')]=_[_0x821c('0x2d')](_0x43f894[_0x821c('0x2e')],qs[_0x821c('0x30')](_0x466bed[_0x821c('0x26')][_0x821c('0x30')]));_0x3e0291[_0x821c('0x2f')]=_0x3e0291['attributes'][_0x821c('0x3d')]?_0x3e0291[_0x821c('0x2f')]:_0x43f894[_0x821c('0x2e')];if(!_0x466bed[_0x821c('0x26')][_0x821c('0x3e')]('nolimit')){_0x3e0291[_0x821c('0x15')]=qs[_0x821c('0x15')](_0x466bed[_0x821c('0x26')][_0x821c('0x15')]);_0x3e0291['offset']=qs[_0x821c('0x13')](_0x466bed[_0x821c('0x26')][_0x821c('0x13')]);}_0x3e0291['order']=qs[_0x821c('0x3f')](_0x466bed[_0x821c('0x26')]['sort']);_0x3e0291[_0x821c('0x40')]=qs[_0x821c('0x3c')](_[_0x821c('0x41')](_0x466bed['query'],_0x43f894[_0x821c('0x3c')]));_0x3e0291[_0x821c('0x40')][_0x821c('0x42')]=_0x529a30['id'];if(_0x466bed[_0x821c('0x26')][_0x821c('0x43')]){_0x3e0291['where']=_['merge'](_0x3e0291[_0x821c('0x40')],{'$or':_[_0x821c('0x1f')](_0x3e0291[_0x821c('0x2f')],function(_0xf9131){var _0x4abc92={};_0x4abc92[_0xf9131]={'$like':'%'+_0x466bed[_0x821c('0x26')][_0x821c('0x43')]+'%'};return _0x4abc92;})});}if(_0x466bed[_0x821c('0x26')][_0x821c('0x44')]){var _0x4f5b14=_0x466bed[_0x821c('0x26')][_0x821c('0x44')][_0x821c('0x45')](',');var _0x14e644={};_0x14e644[_0x4f5b14[0x0]]={'$gte':moment(_0x4f5b14[0x1])[_0x821c('0x46')](_0x821c('0x47'))};_0x3e0291[_0x821c('0x40')]=_[_0x821c('0x33')](_0x3e0291[_0x821c('0x40')],_0x14e644);}_0x3e0291=_[_0x821c('0x33')]({},_0x3e0291,_0x466bed[_0x821c('0x48')]);return db[_0x821c('0x38')]['count']({'where':_0x3e0291[_0x821c('0x40')]})[_0x821c('0x1b')](function(_0x256a9f){_0x334616[_0x821c('0x16')]=_0x256a9f;if(_0x466bed[_0x821c('0x26')]['includeAll']){_0x3e0291[_0x821c('0x32')]=[{'all':!![]}];}return db[_0x821c('0x38')][_0x821c('0x25')](_0x3e0291);})['then'](function(_0x136366){_0x334616[_0x821c('0x49')]=_0x136366;return _0x334616;});}})['then'](respondWithFilteredResult(_0x1e72d8,_0x3e0291))[_0x821c('0x28')](handleError(_0x1e72d8,null));};exports[_0x821c('0x4a')]=function(_0x46857f,_0x4a7412){return db[_0x821c('0x20')]['find']({'where':{'id':_0x46857f[_0x821c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4a7412,null))[_0x821c('0x1b')](function(_0x4e79a9){if(_0x4e79a9){return _0x4e79a9[_0x821c('0x4b')](_0x46857f[_0x821c('0x35')][_0x821c('0x39')],_[_0x821c('0x3a')](_0x46857f[_0x821c('0x35')],['ids','id'])||{})[_0x821c('0x4c')](function(){return db['Tag'][_0x821c('0x25')]({'attributes':['id',_0x821c('0x1d'),'color'],'where':{'id':_0x46857f['body'][_0x821c('0x39')]}});})[_0x821c('0x1b')](function(_0x223d62){socket['emit']('faxInteractionTags:save',{'id':Number(_0x46857f[_0x821c('0x2a')]['id']),'tags':_0x223d62||[]});return{'id':Number(_0x46857f['params']['id']),'tags':_0x223d62||[]};});}})[_0x821c('0x1b')](respondWithResult(_0x4a7412,null))[_0x821c('0x28')](handleError(_0x4a7412,null));};exports[_0x821c('0x4d')]=function(_0x2e601f,_0x5865ef){return db[_0x821c('0x20')][_0x821c('0x36')]({'where':{'id':_0x2e601f[_0x821c('0x2a')]['id']}})[_0x821c('0x1b')](handleEntityNotFound(_0x5865ef,null))[_0x821c('0x1b')](function(_0x2a5f39){if(_0x2a5f39){return _0x2a5f39[_0x821c('0x4d')](_0x2e601f[_0x821c('0x26')][_0x821c('0x39')]);}})['then'](respondWithStatusCode(_0x5865ef,null))[_0x821c('0x28')](handleError(_0x5865ef,null));};exports[_0x821c('0x4e')]=function(_0x4f9460,_0x4972ad){var _0x1d17e3=moment()[_0x821c('0x4f')]()[_0x821c('0x50')]();var _0x5b7420=path[_0x821c('0x51')](config[_0x821c('0x52')],_0x821c('0x53'),_0x821c('0x54'),_0x821c('0x55'));var _0x18eaf3=path['join'](config[_0x821c('0x52')],_0x821c('0x53'),'files',_0x821c('0x56'));var _0x31108f=path['join'](_0x5b7420,_0x1d17e3);var _0x281bb6=util[_0x821c('0x46')](_0x821c('0x57'),_0x4f9460[_0x821c('0x2a')]['id'],_0x1d17e3);var _0xe963f6=path[_0x821c('0x51')](_0x5b7420,_0x281bb6);var _0x253b20=[];_0x253b20[_0x821c('0x58')]({'model':db[_0x821c('0x59')],'as':_0x821c('0x59'),'raw':!![]});var _0x3897ea=[{'model':db[_0x821c('0x38')],'as':_0x821c('0x5a'),'attributes':['id',_0x821c('0x35'),_0x821c('0x5b')],'include':_0x253b20}];return db['FaxInteraction'][_0x821c('0x36')]({'where':{'id':_0x4f9460['params']['id']},'include':_0x3897ea})[_0x821c('0x1b')](handleEntityNotFound(_0x4972ad,null))[_0x821c('0x1b')](function(_0x3776dd){if(_0x3776dd&&_0x3776dd[_0x821c('0x5a')]){var _0x1695df=_0x3776dd[_0x821c('0x5c')]({'plain':!![]});fs['mkdirSync'](_0x31108f);for(var _0x3b67d7=0x0;_0x3b67d7<_0x1695df[_0x821c('0x5a')][_0x821c('0x3d')];_0x3b67d7++){var _0x37ff4c=_0x1695df[_0x821c('0x5a')][_0x3b67d7][_0x821c('0x59')];if(_0x37ff4c){var _0x54e710=path[_0x821c('0x51')](_0x18eaf3,_0x37ff4c[_0x821c('0x5d')]);if(fs[_0x821c('0x5e')](_0x54e710)){fs[_0x821c('0x5f')](_0x54e710)[_0x821c('0x60')](fs['createWriteStream'](path[_0x821c('0x51')](_0x31108f,_0x37ff4c['basename'])));}}}return BPromise[_0x821c('0x61')]()['then'](function(){return new BPromise(function(_0x394708,_0x60b9fd){zipdir(_0x31108f,{'saveTo':_0xe963f6},function(_0x446aa2,_0x172ea6){if(_0x446aa2)return _0x60b9fd(_0x446aa2);return _0x394708(_0x172ea6);});})[_0x821c('0x1b')](function(){return new BPromise(function(_0xd04af9,_0x3a94cc){rimraf(_0x31108f,function(_0x132f0d){if(_0x132f0d)_0x3a94cc(_0x132f0d);return _0xd04af9();});});})[_0x821c('0x1b')](function(){return _0x4972ad['download'](_0xe963f6,_0x281bb6,function(_0x50bb02){if(_0x50bb02){console[_0x821c('0x62')]('err',_0x50bb02);}else{fs[_0x821c('0x63')](_0xe963f6);}});});});}else{return _0x4972ad[_0x821c('0x10')](0xc8);}})['catch'](handleError(_0x4972ad,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2c497c7..e11dac2 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 _0x4fd0=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','remove','getUsers','then','findAll','setDataValue','emit','catch'];(function(_0x34cea1,_0x16d860){var _0x2d796a=function(_0x11e340){while(--_0x11e340){_0x34cea1['push'](_0x34cea1['shift']());}};_0x2d796a(++_0x16d860);}(_0x4fd0,0xb9));var _0x04fd=function(_0x1a6269,_0x5deea5){_0x1a6269=_0x1a6269-0x0;var _0x536f68=_0x4fd0[_0x1a6269];return _0x536f68;};'use strict';var EventEmitter=require(_0x04fd('0x0'));var FaxInteraction=require(_0x04fd('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x04fd('0x1'))['db'][_0x04fd('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x04fd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x04fd('0x4')};function emitEvent(_0x502bdd){return function(_0x211eac,_0x4c2ec5,_0x3eb0e2){_0x211eac[_0x04fd('0x5')]({'attributes':['id'],'raw':!![]})[_0x04fd('0x6')](function(_0x59cbc6){_0x211eac['setDataValue']('Users',_0x59cbc6['map'](function(_0x267cd9){return{'id':_0x267cd9['id']};}));return FaxMessage[_0x04fd('0x7')]({'where':{'FaxInteractionId':_0x211eac['id'],'direction':'in','read':![]},'raw':!![]});})[_0x04fd('0x6')](function(_0x3b66aa){_0x211eac[_0x04fd('0x8')]('unreadMessages',_0x3b66aa['length']);FaxInteractionEvents['emit'](_0x502bdd+':'+_0x211eac['id'],_0x211eac);FaxInteractionEvents[_0x04fd('0x9')](_0x502bdd,_0x211eac);_0x3eb0e2(null);})[_0x04fd('0xa')](_0x3eb0e2(null));};}for(var e in events){if(events[_0x04fd('0xb')](e)){var event=events[e];FaxInteraction[_0x04fd('0xc')](e,emitEvent(event));}}module[_0x04fd('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x58a7=['catch','hook','events','../../mysqldb','FaxInteraction','update','remove','setDataValue','Users','map','findAll','then','length','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58a7,0x198));var _0x758a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x58a7[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x758a('0x0'));var FaxInteraction=require(_0x758a('0x1'))['db'][_0x758a('0x2')];var FaxMessage=require(_0x758a('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x758a('0x3'),'afterDestroy':_0x758a('0x4')};function emitEvent(_0x9a782f){return function(_0xb9aedd,_0x25451d,_0x3e1eb4){_0xb9aedd['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1eb5eb){_0xb9aedd[_0x758a('0x5')](_0x758a('0x6'),_0x1eb5eb[_0x758a('0x7')](function(_0xffb6e5){return{'id':_0xffb6e5['id']};}));return FaxMessage[_0x758a('0x8')]({'where':{'FaxInteractionId':_0xb9aedd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x758a('0x9')](function(_0x183388){_0xb9aedd[_0x758a('0x5')]('unreadMessages',_0x183388[_0x758a('0xa')]);FaxInteractionEvents[_0x758a('0xb')](_0x9a782f+':'+_0xb9aedd['id'],_0xb9aedd);FaxInteractionEvents[_0x758a('0xb')](_0x9a782f,_0xb9aedd);_0x3e1eb4(null);})[_0x758a('0xc')](_0x3e1eb4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x758a('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 36c7d77..e7a940e 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 _0x9e69=['define','FaxInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x1f9d72,_0x5ad9a5){var _0x986123=function(_0x3cb29d){while(--_0x3cb29d){_0x1f9d72['push'](_0x1f9d72['shift']());}};_0x986123(++_0x5ad9a5);}(_0x9e69,0x150));var _0x99e6=function(_0x11f1de,_0x29fb3c){_0x11f1de=_0x11f1de-0x0;var _0xd4d377=_0x9e69[_0x11f1de];return _0xd4d377;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var logger=require(_0x99e6('0x1'))(_0x99e6('0x2'));var moment=require(_0x99e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x99e6('0x4'));var fs=require('fs');var path=require(_0x99e6('0x5'));var rimraf=require('rimraf');var config=require(_0x99e6('0x6'));var attributes=require(_0x99e6('0x7'));module[_0x99e6('0x8')]=function(_0x570120,_0x857e0c){return _0x570120[_0x99e6('0x9')](_0x99e6('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3424c5,_0x305140,_0x4a657d){if(_0x3424c5[_0x99e6('0xb')](_0x99e6('0xc'))){_0x3424c5['closedAt']=moment()[_0x99e6('0xd')](_0x99e6('0xe'));}_0x4a657d(null,_0x3424c5);}}});}; \ No newline at end of file +var _0x2e4f=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x2e4f,0x181));var _0xf2e4=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x2e4f[_0x4fbb86];return _0xb141fe;};'use strict';var _=require(_0xf2e4('0x0'));var util=require(_0xf2e4('0x1'));var logger=require(_0xf2e4('0x2'))(_0xf2e4('0x3'));var moment=require('moment');var BPromise=require(_0xf2e4('0x4'));var rp=require(_0xf2e4('0x5'));var fs=require('fs');var path=require(_0xf2e4('0x6'));var rimraf=require(_0xf2e4('0x7'));var config=require(_0xf2e4('0x8'));var attributes=require(_0xf2e4('0x9'));module[_0xf2e4('0xa')]=function(_0x5e02eb,_0x4d4630){return _0x5e02eb['define'](_0xf2e4('0xb'),attributes,{'tableName':_0xf2e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfcf980,_0x5f483f,_0x59368d){if(_0xfcf980[_0xf2e4('0xd')](_0xf2e4('0xe'))){_0xfcf980[_0xf2e4('0xf')]=moment()[_0xf2e4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x59368d(null,_0xfcf980);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 74b357a..3984de7 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 _0x7608=['addTags','ids','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./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','FaxInteraction','update','options','where','attributes'];(function(_0x10b567,_0x482dc9){var _0x401323=function(_0x210366){while(--_0x210366){_0x10b567['push'](_0x10b567['shift']());}};_0x401323(++_0x482dc9);}(_0x7608,0x1f2));var _0x8760=function(_0xb3b061,_0x485e40){_0xb3b061=_0xb3b061-0x0;var _0x45ad79=_0x7608[_0xb3b061];return _0x45ad79;};'use strict';var _=require(_0x8760('0x0'));var util=require('util');var moment=require(_0x8760('0x1'));var BPromise=require(_0x8760('0x2'));var rs=require(_0x8760('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8760('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8760('0x5'));var config=require(_0x8760('0x6'));var jayson=require(_0x8760('0x7'));var client=jayson[_0x8760('0x8')][_0x8760('0x9')]({'port':0x232a});config[_0x8760('0xa')]=_[_0x8760('0xb')](config[_0x8760('0xa')],{'host':_0x8760('0xc'),'port':0x18eb});var socket=require(_0x8760('0xd'))(new Redis(config[_0x8760('0xa')]));require(_0x8760('0xe'))[_0x8760('0xf')](socket);function respondWithRpcPromise(_0x4e7f7a,_0x2bf72c,_0x2cd798){return new BPromise(function(_0x2f9bf0,_0x27121f){return client[_0x8760('0x10')](_0x4e7f7a,_0x2cd798)[_0x8760('0x11')](function(_0x740f41){logger[_0x8760('0x12')](_0x8760('0x13'),_0x2bf72c,_0x8760('0x14'));logger[_0x8760('0x15')](_0x8760('0x16'),_0x2bf72c,'request\x20sent',JSON[_0x8760('0x17')](_0x740f41));if(_0x740f41[_0x8760('0x18')]){if(_0x740f41['error'][_0x8760('0x19')]===0x1f4){logger['error'](_0x8760('0x13'),_0x2bf72c,_0x740f41[_0x8760('0x18')]['message']);return _0x27121f(_0x740f41[_0x8760('0x18')]['message']);}logger['error'](_0x8760('0x13'),_0x2bf72c,_0x740f41[_0x8760('0x18')]['message']);return _0x2f9bf0(_0x740f41[_0x8760('0x18')][_0x8760('0x1a')]);}else{logger[_0x8760('0x12')](_0x8760('0x13'),_0x2bf72c,_0x8760('0x14'));_0x2f9bf0(_0x740f41[_0x8760('0x1b')][_0x8760('0x1a')]);}})[_0x8760('0x1c')](function(_0x155eda){logger[_0x8760('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x2bf72c,_0x155eda);_0x27121f(_0x155eda);});});}exports[_0x8760('0x1d')]=function(_0x1f0884){var _0x59aadf=this;return new Promise(function(_0x5b775c,_0xc71c9b){return db[_0x8760('0x1e')][_0x8760('0x1f')](_0x1f0884['body'],{'raw':_0x1f0884[_0x8760('0x20')]?_0x1f0884['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0884[_0x8760('0x20')]?_0x1f0884[_0x8760('0x20')][_0x8760('0x21')]||null:null,'attributes':_0x1f0884[_0x8760('0x20')]?_0x1f0884[_0x8760('0x20')][_0x8760('0x22')]||null:null,'limit':_0x1f0884[_0x8760('0x20')]?_0x1f0884[_0x8760('0x20')]['limit']||null:null})['then'](function(_0x52fe2e){logger['info']('UpdateFaxInteraction',_0x1f0884);logger[_0x8760('0x15')](_0x8760('0x1d'),_0x1f0884,JSON['stringify'](_0x52fe2e));_0x5b775c(_0x52fe2e);})[_0x8760('0x1c')](function(_0x573c8b){logger['error'](_0x8760('0x1d'),_0x573c8b[_0x8760('0x1a')],_0x1f0884);_0xc71c9b(_0x59aadf['error'](0x1f4,_0x573c8b[_0x8760('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1c58f2){return new Promise(function(_0x235169,_0x11e24a){return db[_0x8760('0x1e')]['find']({'where':_0x1c58f2[_0x8760('0x20')]?_0x1c58f2[_0x8760('0x20')][_0x8760('0x21')]||null:null})['then'](function(_0x5149cc){if(_0x5149cc){return _0x5149cc[_0x8760('0x23')](_0x1c58f2['body'][_0x8760('0x24')],_[_0x8760('0x25')](_0x1c58f2[_0x8760('0x26')],[_0x8760('0x24'),'id'])||{});}})[_0x8760('0x27')](function(_0x4c1f5f){logger[_0x8760('0x12')]('AddTags',_0x1c58f2);logger['debug'](_0x8760('0x28'),_0x1c58f2,JSON[_0x8760('0x17')](_0x4c1f5f));_0x235169(_0x4c1f5f);})[_0x8760('0x1c')](function(_0x2cd86e){logger[_0x8760('0x18')]('AddTags',_0x2cd86e[_0x8760('0x1a')],_0x1c58f2);_0x11e24a(_this[_0x8760('0x18')](0x1f4,_0x2cd86e[_0x8760('0x1a')]));});});}; \ No newline at end of file +var _0xabee=['../../config/logger','../../config/environment','redis','defaults','localhost','register','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','stringify','find','addTags','ids','omit','AddTags','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0xabee,0x11b));var _0xeabe=function(_0x3d0776,_0xfdbd9a){_0x3d0776=_0x3d0776-0x0;var _0x9fb381=_0xabee[_0x3d0776];return _0x9fb381;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xeabe('0x0'));var rs=require(_0xeabe('0x1'));var fs=require('fs');var Redis=require(_0xeabe('0x2'));var db=require(_0xeabe('0x3'))['db'];var utils=require(_0xeabe('0x4'));var logger=require(_0xeabe('0x5'))('rpc');var config=require(_0xeabe('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xeabe('0x7')]=_[_0xeabe('0x8')](config['redis'],{'host':_0xeabe('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeabe('0x7')]));require('./faxInteraction.socket')[_0xeabe('0xa')](socket);function respondWithRpcPromise(_0x8c062c,_0x418dd7,_0x18e322){return new BPromise(function(_0x4e3c66,_0x5e379b){return client['request'](_0x8c062c,_0x18e322)[_0xeabe('0xb')](function(_0x4dd3d6){logger[_0xeabe('0xc')]('FaxInteraction,\x20%s,\x20%s',_0x418dd7,'request\x20sent');logger[_0xeabe('0xd')](_0xeabe('0xe'),_0x418dd7,_0xeabe('0xf'),JSON['stringify'](_0x4dd3d6));if(_0x4dd3d6[_0xeabe('0x10')]){if(_0x4dd3d6['error'][_0xeabe('0x11')]===0x1f4){logger['error'](_0xeabe('0x12'),_0x418dd7,_0x4dd3d6[_0xeabe('0x10')][_0xeabe('0x13')]);return _0x5e379b(_0x4dd3d6[_0xeabe('0x10')]['message']);}logger[_0xeabe('0x10')](_0xeabe('0x12'),_0x418dd7,_0x4dd3d6['error'][_0xeabe('0x13')]);return _0x4e3c66(_0x4dd3d6['error'][_0xeabe('0x13')]);}else{logger[_0xeabe('0xc')]('FaxInteraction,\x20%s,\x20%s',_0x418dd7,_0xeabe('0xf'));_0x4e3c66(_0x4dd3d6[_0xeabe('0x14')][_0xeabe('0x13')]);}})[_0xeabe('0x15')](function(_0x28e2f5){logger[_0xeabe('0x10')](_0xeabe('0x12'),_0x418dd7,_0x28e2f5);_0x5e379b(_0x28e2f5);});});}exports[_0xeabe('0x16')]=function(_0x300db3){var _0x2a54a0=this;return new Promise(function(_0x4ebd3f,_0x4f0fe9){return db[_0xeabe('0x17')][_0xeabe('0x18')](_0x300db3[_0xeabe('0x19')],{'raw':_0x300db3[_0xeabe('0x1a')]?_0x300db3[_0xeabe('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x300db3[_0xeabe('0x1a')]?_0x300db3['options'][_0xeabe('0x1b')]||null:null,'attributes':_0x300db3[_0xeabe('0x1a')]?_0x300db3[_0xeabe('0x1a')][_0xeabe('0x1c')]||null:null,'limit':_0x300db3[_0xeabe('0x1a')]?_0x300db3[_0xeabe('0x1a')][_0xeabe('0x1d')]||null:null})[_0xeabe('0xb')](function(_0x1b9788){logger[_0xeabe('0xc')](_0xeabe('0x16'),_0x300db3);logger['debug'](_0xeabe('0x16'),_0x300db3,JSON[_0xeabe('0x1e')](_0x1b9788));_0x4ebd3f(_0x1b9788);})[_0xeabe('0x15')](function(_0x9627e){logger[_0xeabe('0x10')]('UpdateFaxInteraction',_0x9627e[_0xeabe('0x13')],_0x300db3);_0x4f0fe9(_0x2a54a0[_0xeabe('0x10')](0x1f4,_0x9627e[_0xeabe('0x13')]));});});};exports['AddTagsToFaxInteraction']=function(_0x3b4807){return new Promise(function(_0x499492,_0x324dc2){return db[_0xeabe('0x17')][_0xeabe('0x1f')]({'where':_0x3b4807[_0xeabe('0x1a')]?_0x3b4807[_0xeabe('0x1a')][_0xeabe('0x1b')]||null:null})[_0xeabe('0xb')](function(_0x4db40c){if(_0x4db40c){return _0x4db40c[_0xeabe('0x20')](_0x3b4807[_0xeabe('0x19')][_0xeabe('0x21')],_[_0xeabe('0x22')](_0x3b4807[_0xeabe('0x19')],[_0xeabe('0x21'),'id'])||{});}})['spread'](function(_0x59541d){logger[_0xeabe('0xc')]('AddTags',_0x3b4807);logger[_0xeabe('0xd')](_0xeabe('0x23'),_0x3b4807,JSON[_0xeabe('0x1e')](_0x59541d));_0x499492(_0x59541d);})[_0xeabe('0x15')](function(_0x56d713){logger[_0xeabe('0x10')](_0xeabe('0x23'),_0x56d713['message'],_0x3b4807);_0x324dc2(_this['error'](0x1f4,_0x56d713[_0xeabe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3b35123..48bc4ad 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 _0x7a18=['save','remove','update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x7a18,0xbc));var _0x87a1=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7a18[_0x2576d7];return _0x16a08c;};'use strict';var FaxInteractionEvents=require(_0x87a1('0x0'));var events=[_0x87a1('0x1'),_0x87a1('0x2'),_0x87a1('0x3')];function createListener(_0xe6da19,_0x582bc0){return function(_0x114b7b){_0x582bc0['emit'](_0xe6da19,_0x114b7b);};}function removeListener(_0xab5e10,_0x31a4d2){return function(){FaxInteractionEvents['removeListener'](_0xab5e10,_0x31a4d2);};}exports[_0x87a1('0x4')]=function(_0x17d0ab){for(var _0x3a122f=0x0,_0x2ca2da=events[_0x87a1('0x5')];_0x3a122f<_0x2ca2da;_0x3a122f++){var _0x9318f7=events[_0x3a122f];var _0x3e30e2=createListener(_0x87a1('0x6')+_0x9318f7,_0x17d0ab);FaxInteractionEvents['on'](_0x9318f7,_0x3e30e2);}}; \ No newline at end of file +var _0x136d=['./faxInteraction.events','save','remove','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x3a3ef8,_0x59ae5e){var _0x16420d=function(_0x5bb4cc){while(--_0x5bb4cc){_0x3a3ef8['push'](_0x3a3ef8['shift']());}};_0x16420d(++_0x59ae5e);}(_0x136d,0x87));var _0xd136=function(_0x425d5e,_0x3b9040){_0x425d5e=_0x425d5e-0x0;var _0x3cc67b=_0x136d[_0x425d5e];return _0x3cc67b;};'use strict';var FaxInteractionEvents=require(_0xd136('0x0'));var events=[_0xd136('0x1'),_0xd136('0x2'),_0xd136('0x3')];function createListener(_0x117437,_0x355795){return function(_0x584935){_0x355795[_0xd136('0x4')](_0x117437,_0x584935);};}function removeListener(_0x1e8741,_0x13b3ae){return function(){FaxInteractionEvents[_0xd136('0x5')](_0x1e8741,_0x13b3ae);};}exports[_0xd136('0x6')]=function(_0x165a0a){for(var _0x2ab47e=0x0,_0x1b9788=events[_0xd136('0x7')];_0x2ab47e<_0x1b9788;_0x2ab47e++){var _0x114b7f=events[_0x2ab47e];var _0x26aca9=createListener(_0xd136('0x8')+_0x114b7f,_0x165a0a);FaxInteractionEvents['on'](_0x114b7f,_0x26aca9);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3948f60..6138513 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 _0xff97=['../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/:id','show','getMessages','download','post','/:id/messages','/:id/tags','tracked','fax','faxinteraction:addtags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x54cbd6,_0x120248){var _0x5cfb46=function(_0x2d199a){while(--_0x2d199a){_0x54cbd6['push'](_0x54cbd6['shift']());}};_0x5cfb46(++_0x120248);}(_0xff97,0x19f));var _0x7ff9=function(_0x58aec8,_0x37225d){_0x58aec8=_0x58aec8-0x0;var _0x32c373=_0xff97[_0x58aec8];return _0x32c373;};'use strict';var multer=require(_0x7ff9('0x0'));var util=require(_0x7ff9('0x1'));var path=require('path');var timeout=require(_0x7ff9('0x2'));var express=require('express');var router=express[_0x7ff9('0x3')]();var fs_extra=require(_0x7ff9('0x4'));var auth=require(_0x7ff9('0x5'));var interaction=require(_0x7ff9('0x6'));var config=require('../../config/environment');var controller=require(_0x7ff9('0x7'));router[_0x7ff9('0x8')]('/',auth[_0x7ff9('0x9')](),controller[_0x7ff9('0xa')]);router[_0x7ff9('0x8')]('/describe',auth[_0x7ff9('0x9')](),controller['describe']);router['get'](_0x7ff9('0xb'),auth['isAuthenticated'](),controller[_0x7ff9('0xc')]);router[_0x7ff9('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x7ff9('0xd')]);router[_0x7ff9('0x8')]('/:id/download',auth[_0x7ff9('0x9')](),controller[_0x7ff9('0xe')]);router['post']('/',auth[_0x7ff9('0x9')](),controller['create']);router[_0x7ff9('0xf')](_0x7ff9('0x10'),auth[_0x7ff9('0x9')](),controller['addMessage']);router[_0x7ff9('0xf')](_0x7ff9('0x11'),auth[_0x7ff9('0x9')](),interaction[_0x7ff9('0x12')](_0x7ff9('0x13'),_0x7ff9('0x14')),controller['addTags']);router['put'](_0x7ff9('0xb'),auth[_0x7ff9('0x9')](),interaction['tracked'](_0x7ff9('0x13'),_0x7ff9('0x15')),controller[_0x7ff9('0x16')]);router[_0x7ff9('0x17')](_0x7ff9('0xb'),auth[_0x7ff9('0x9')](),interaction[_0x7ff9('0x12')](_0x7ff9('0x13'),_0x7ff9('0x18')),controller[_0x7ff9('0x19')]);router['delete'](_0x7ff9('0x11'),auth[_0x7ff9('0x9')](),controller[_0x7ff9('0x1a')]);module[_0x7ff9('0x1b')]=router; \ No newline at end of file +var _0x75b4=['/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','fax','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x75b4,0x1c0));var _0x475b=function(_0x46ea52,_0xb09636){_0x46ea52=_0x46ea52-0x0;var _0x4c3872=_0x75b4[_0x46ea52];return _0x4c3872;};'use strict';var multer=require('multer');var util=require(_0x475b('0x0'));var path=require(_0x475b('0x1'));var timeout=require('connect-timeout');var express=require(_0x475b('0x2'));var router=express[_0x475b('0x3')]();var fs_extra=require(_0x475b('0x4'));var auth=require(_0x475b('0x5'));var interaction=require(_0x475b('0x6'));var config=require(_0x475b('0x7'));var controller=require(_0x475b('0x8'));router[_0x475b('0x9')]('/',auth['isAuthenticated'](),controller[_0x475b('0xa')]);router[_0x475b('0x9')](_0x475b('0xb'),auth[_0x475b('0xc')](),controller[_0x475b('0xd')]);router['get'](_0x475b('0xe'),auth['isAuthenticated'](),controller[_0x475b('0xf')]);router[_0x475b('0x9')](_0x475b('0x10'),auth['isAuthenticated'](),controller[_0x475b('0x11')]);router[_0x475b('0x9')]('/:id/download',auth[_0x475b('0xc')](),controller[_0x475b('0x12')]);router[_0x475b('0x13')]('/',auth[_0x475b('0xc')](),controller[_0x475b('0x14')]);router[_0x475b('0x13')](_0x475b('0x10'),auth[_0x475b('0xc')](),controller[_0x475b('0x15')]);router['post'](_0x475b('0x16'),auth[_0x475b('0xc')](),interaction[_0x475b('0x17')](_0x475b('0x18'),'faxinteraction:addtags'),controller['addTags']);router[_0x475b('0x19')](_0x475b('0xe'),auth[_0x475b('0xc')](),interaction[_0x475b('0x17')](_0x475b('0x18'),_0x475b('0x1a')),controller[_0x475b('0x1b')]);router[_0x475b('0x1c')](_0x475b('0xe'),auth['isAuthenticated'](),interaction[_0x475b('0x17')]('fax',_0x475b('0x1d')),controller[_0x475b('0x1e')]);router[_0x475b('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x475b('0x1f')]);module[_0x475b('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c93e5fa..a9a9e1e 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 _0xfc1e=['out','DATE','medium','BOOLEAN','ENUM'];(function(_0x1c8073,_0x457e4a){var _0x2af92c=function(_0x4f47d0){while(--_0x4f47d0){_0x1c8073['push'](_0x1c8073['shift']());}};_0x2af92c(++_0x457e4a);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xfc1e[_0x4429e0];return _0x51a5b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xefc1('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xefc1('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xefc1('0x2')]('in',_0xefc1('0x3')),'defaultValue':_0xefc1('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xefc1('0x4')]}}; \ No newline at end of file +var _0x430e=['ENUM','out','DATE','exports','TEXT','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x430e,0x105));var _0xe430=function(_0x196257,_0x256195){_0x196257=_0x196257-0x0;var _0x30d5c7=_0x430e[_0x196257];return _0x30d5c7;};'use strict';var Sequelize=require('sequelize');module[_0xe430('0x0')]={'body':{'type':Sequelize[_0xe430('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe430('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe430('0x3')]('in',_0xe430('0x4')),'defaultValue':_0xe430('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xe430('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c407680..3fc7169 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 _0xce48=['read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','agent','interface','channel','motionChannel','event','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','create','CmContact','findOne','isNil','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','Attachment','download','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','rows','catch','show','params','includeAll','options','find','body','describe','fax-interactions','accept','fax'];(function(_0x236911,_0x35d7e3){var _0x1b1349=function(_0xee5d4e){while(--_0xee5d4e){_0x236911['push'](_0x236911['shift']());}};_0x1b1349(++_0x35d7e3);}(_0xce48,0x1cd));var _0x8ce4=function(_0x47643e,_0x337374){_0x47643e=_0x47643e-0x0;var _0x2aa5db=_0xce48[_0x47643e];return _0x2aa5db;};'use strict';var emlformat=require(_0x8ce4('0x0'));var rimraf=require(_0x8ce4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ce4('0x2'));var rp=require(_0x8ce4('0x3'));var moment=require(_0x8ce4('0x4'));var BPromise=require(_0x8ce4('0x5'));var Mustache=require(_0x8ce4('0x6'));var util=require(_0x8ce4('0x7'));var path=require(_0x8ce4('0x8'));var sox=require(_0x8ce4('0x9'));var csv=require(_0x8ce4('0xa'));var ejs=require(_0x8ce4('0xb'));var fs=require('fs');var fs_extra=require(_0x8ce4('0xc'));var _=require(_0x8ce4('0xd'));var squel=require(_0x8ce4('0xe'));var crypto=require('crypto');var jsforce=require(_0x8ce4('0xf'));var deskjs=require(_0x8ce4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8ce4('0x11'));var Papa=require(_0x8ce4('0x12'));var Redis=require(_0x8ce4('0x13'));var authService=require(_0x8ce4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8ce4('0x15'));var hardwareService=require(_0x8ce4('0x16'));var logger=require(_0x8ce4('0x17'))(_0x8ce4('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ce4('0x19'))['db'];config[_0x8ce4('0x1a')]=_[_0x8ce4('0x1b')](config[_0x8ce4('0x1a')],{'host':_0x8ce4('0x1c'),'port':0x18eb});var socket=require(_0x8ce4('0x1d'))(new Redis(config[_0x8ce4('0x1a')]));require(_0x8ce4('0x1e'))[_0x8ce4('0x1f')](socket);var jayson=require(_0x8ce4('0x20'));var client=jayson[_0x8ce4('0x21')][_0x8ce4('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x8ce4('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x600e18,_0x5f6186,_0x31369d,_0x485f6e){return new BPromise(function(_0x549eef,_0x3d5006){var _0xe6fa63=_0x485f6e||client;return _0xe6fa63['request'](_0x600e18,_0x31369d)[_0x8ce4('0x23')](function(_0x433b83){logger['info'](_0x8ce4('0x24'),_0x5f6186,'request\x20sent');logger[_0x8ce4('0x25')](_0x8ce4('0x26'),_0x5f6186,'request\x20sent',JSON[_0x8ce4('0x27')](_0x433b83));if(_0x433b83[_0x8ce4('0x28')]){if(_0x433b83[_0x8ce4('0x28')]['code']===0x1f4){logger['error'](_0x8ce4('0x24'),_0x5f6186,_0x433b83[_0x8ce4('0x28')]['message']);return _0x3d5006(_0x433b83['error'][_0x8ce4('0x29')]);}logger[_0x8ce4('0x28')]('FaxMessage,\x20%s,\x20%s',_0x5f6186,_0x433b83[_0x8ce4('0x28')][_0x8ce4('0x29')]);return _0x549eef(_0x433b83['error'][_0x8ce4('0x29')]);}else{logger[_0x8ce4('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x5f6186,_0x8ce4('0x2b'));_0x549eef(_0x433b83[_0x8ce4('0x2c')]['message']);}})['catch'](function(_0x4776a6){logger['error'](_0x8ce4('0x24'),_0x5f6186,_0x4776a6);_0x3d5006(_0x4776a6);});});}function respondWithStatusCode(_0x588575,_0x405fd1){_0x405fd1=_0x405fd1||0xcc;return function(_0x3773a4){if(_0x3773a4){return _0x588575['sendStatus'](_0x405fd1);}return _0x588575[_0x8ce4('0x2d')](_0x405fd1)[_0x8ce4('0x2e')]();};}function respondWithResult(_0x307f64,_0x40b421){_0x40b421=_0x40b421||0xc8;return function(_0x105723){if(_0x105723){return _0x307f64[_0x8ce4('0x2d')](_0x40b421)[_0x8ce4('0x2f')](_0x105723);}};}function respondWithFilteredResult(_0x4d751c,_0x2121bc){return function(_0x38e5c9){if(_0x38e5c9){var _0x2ca697=typeof _0x2121bc[_0x8ce4('0x30')]==='undefined'&&typeof _0x2121bc['limit']===_0x8ce4('0x31');var _0x229292=_0x38e5c9[_0x8ce4('0x32')];var _0x1ed0df=_0x2ca697?0x0:_0x2121bc[_0x8ce4('0x30')];var _0x82e4f6=_0x2ca697?_0x38e5c9[_0x8ce4('0x32')]:_0x2121bc[_0x8ce4('0x30')]+_0x2121bc[_0x8ce4('0x33')];var _0x26ffbb;if(_0x82e4f6>=_0x229292){_0x82e4f6=_0x229292;_0x26ffbb=0xc8;}else{_0x26ffbb=0xce;}_0x4d751c[_0x8ce4('0x2d')](_0x26ffbb);return _0x4d751c[_0x8ce4('0x34')](_0x8ce4('0x35'),_0x1ed0df+'-'+_0x82e4f6+'/'+_0x229292)['json'](_0x38e5c9);}return null;};}function patchUpdates(_0x27a74d){return function(_0x5cf153){try{jsonpatch[_0x8ce4('0x36')](_0x5cf153,_0x27a74d,!![]);}catch(_0x30ed46){return BPromise[_0x8ce4('0x37')](_0x30ed46);}return _0x5cf153[_0x8ce4('0x38')]();};}function saveUpdates(_0x4ab4f5,_0x17f0c1){return function(_0x3e7019){if(_0x3e7019){return _0x3e7019[_0x8ce4('0x39')](_0x4ab4f5)[_0x8ce4('0x23')](function(_0x31f659){return _0x31f659;});}return null;};}function removeEntity(_0x219fbf,_0x5a7ee6){return function(_0x506f29){if(_0x506f29){return _0x506f29[_0x8ce4('0x3a')]()[_0x8ce4('0x23')](function(){_0x219fbf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c06bf,_0x591e93){return function(_0x4af46f){if(!_0x4af46f){_0x2c06bf[_0x8ce4('0x3b')](0x194);}return _0x4af46f;};}function handleError(_0x1c266a,_0x31f82e){_0x31f82e=_0x31f82e||0x1f4;return function(_0x22bd84){logger[_0x8ce4('0x28')](_0x22bd84[_0x8ce4('0x3c')]);if(_0x22bd84['name']){delete _0x22bd84[_0x8ce4('0x3d')];}_0x1c266a[_0x8ce4('0x2d')](_0x31f82e)['send'](_0x22bd84);};}exports['index']=function(_0x5c9737,_0x3ffc1b){var _0x99a831={},_0x5f25b7={},_0x59a626={'count':0x0,'rows':[]};var _0x4f182e=_[_0x8ce4('0x3e')](db[_0x8ce4('0x3f')][_0x8ce4('0x40')],function(_0x18f840){return{'name':_0x18f840[_0x8ce4('0x41')],'type':_0x18f840[_0x8ce4('0x42')][_0x8ce4('0x43')]};});_0x5f25b7[_0x8ce4('0x44')]=_[_0x8ce4('0x3e')](_0x4f182e,_0x8ce4('0x3d'));_0x5f25b7['query']=_['keys'](_0x5c9737[_0x8ce4('0x45')]);_0x5f25b7[_0x8ce4('0x46')]=_[_0x8ce4('0x47')](_0x5f25b7['model'],_0x5f25b7[_0x8ce4('0x45')]);_0x99a831[_0x8ce4('0x48')]=_[_0x8ce4('0x47')](_0x5f25b7[_0x8ce4('0x44')],qs[_0x8ce4('0x49')](_0x5c9737[_0x8ce4('0x45')][_0x8ce4('0x49')]));_0x99a831[_0x8ce4('0x48')]=_0x99a831[_0x8ce4('0x48')][_0x8ce4('0x4a')]?_0x99a831[_0x8ce4('0x48')]:_0x5f25b7[_0x8ce4('0x44')];if(!_0x5c9737[_0x8ce4('0x45')][_0x8ce4('0x4b')](_0x8ce4('0x4c'))){_0x99a831['limit']=qs[_0x8ce4('0x33')](_0x5c9737[_0x8ce4('0x45')][_0x8ce4('0x33')]);_0x99a831[_0x8ce4('0x30')]=qs['offset'](_0x5c9737['query'][_0x8ce4('0x30')]);}_0x99a831['order']=qs[_0x8ce4('0x4d')](_0x5c9737[_0x8ce4('0x45')][_0x8ce4('0x4d')]);_0x99a831[_0x8ce4('0x4e')]=qs[_0x8ce4('0x46')](_[_0x8ce4('0x4f')](_0x5c9737[_0x8ce4('0x45')],_0x5f25b7[_0x8ce4('0x46')]),_0x4f182e);if(_0x5c9737[_0x8ce4('0x45')][_0x8ce4('0x50')]){_0x99a831['where']=_['merge'](_0x99a831[_0x8ce4('0x4e')],{'$or':_[_0x8ce4('0x3e')](_0x4f182e,function(_0x5e1fbc){if(_0x5e1fbc[_0x8ce4('0x42')]!==_0x8ce4('0x51')){var _0x5427e0={};_0x5427e0[_0x5e1fbc[_0x8ce4('0x3d')]]={'$like':'%'+_0x5c9737[_0x8ce4('0x45')][_0x8ce4('0x50')]+'%'};return _0x5427e0;}})});}_0x99a831=_[_0x8ce4('0x52')]({},_0x99a831,_0x5c9737['options']);var _0xca1385={'where':_0x99a831[_0x8ce4('0x4e')]};return db[_0x8ce4('0x3f')][_0x8ce4('0x32')](_0xca1385)[_0x8ce4('0x23')](function(_0x3fcbf6){_0x59a626[_0x8ce4('0x32')]=_0x3fcbf6;if(_0x5c9737[_0x8ce4('0x45')]['includeAll']){_0x99a831['include']=[{'all':!![]}];}return db[_0x8ce4('0x3f')]['findAll'](_0x99a831);})['then'](function(_0x297232){_0x59a626[_0x8ce4('0x53')]=_0x297232;return _0x59a626;})['then'](respondWithFilteredResult(_0x3ffc1b,_0x99a831))[_0x8ce4('0x54')](handleError(_0x3ffc1b,null));};exports[_0x8ce4('0x55')]=function(_0x49491a,_0x5e48f2){var _0x16609a={'raw':!![],'where':{'id':_0x49491a[_0x8ce4('0x56')]['id']}},_0x2c0cbd={};_0x2c0cbd[_0x8ce4('0x44')]=_['keys'](db[_0x8ce4('0x3f')][_0x8ce4('0x40')]);_0x2c0cbd[_0x8ce4('0x45')]=_['keys'](_0x49491a[_0x8ce4('0x45')]);_0x2c0cbd['filters']=_[_0x8ce4('0x47')](_0x2c0cbd[_0x8ce4('0x44')],_0x2c0cbd['query']);_0x16609a[_0x8ce4('0x48')]=_[_0x8ce4('0x47')](_0x2c0cbd['model'],qs['fields'](_0x49491a[_0x8ce4('0x45')][_0x8ce4('0x49')]));_0x16609a[_0x8ce4('0x48')]=_0x16609a[_0x8ce4('0x48')]['length']?_0x16609a['attributes']:_0x2c0cbd['model'];if(_0x49491a['query'][_0x8ce4('0x57')]){_0x16609a['include']=[{'all':!![]}];}_0x16609a=_[_0x8ce4('0x52')]({},_0x16609a,_0x49491a[_0x8ce4('0x58')]);return db[_0x8ce4('0x3f')][_0x8ce4('0x59')](_0x16609a)[_0x8ce4('0x23')](handleEntityNotFound(_0x5e48f2,null))['then'](respondWithResult(_0x5e48f2,null))[_0x8ce4('0x54')](handleError(_0x5e48f2,null));};exports[_0x8ce4('0x39')]=function(_0x43df02,_0x1e7c77){if(_0x43df02[_0x8ce4('0x5a')]['id']){delete _0x43df02[_0x8ce4('0x5a')]['id'];}return db[_0x8ce4('0x3f')][_0x8ce4('0x59')]({'where':{'id':_0x43df02[_0x8ce4('0x56')]['id']}})[_0x8ce4('0x23')](handleEntityNotFound(_0x1e7c77,null))[_0x8ce4('0x23')](saveUpdates(_0x43df02[_0x8ce4('0x5a')],null))[_0x8ce4('0x23')](respondWithResult(_0x1e7c77,null))['catch'](handleError(_0x1e7c77,null));};exports[_0x8ce4('0x3a')]=function(_0x35aa6f,_0x5b9794){return db[_0x8ce4('0x3f')][_0x8ce4('0x59')]({'where':{'id':_0x35aa6f['params']['id']}})[_0x8ce4('0x23')](handleEntityNotFound(_0x5b9794,null))['then'](removeEntity(_0x5b9794,null))['catch'](handleError(_0x5b9794,null));};exports[_0x8ce4('0x5b')]=function(_0x5791c0,_0x1ec13d){return db[_0x8ce4('0x3f')][_0x8ce4('0x5b')]()[_0x8ce4('0x23')](respondWithResult(_0x1ec13d,null))[_0x8ce4('0x54')](handleError(_0x1ec13d,null));};var interaction_log=require('../../config/logger')(_0x8ce4('0x5c'));exports[_0x8ce4('0x5d')]=function(_0x36ebab,_0x678102,_0x44304b){var _0x28ac25={'agent':{},'channel':_0x8ce4('0x5e')};if(_0x36ebab['body']['id']){delete _0x36ebab[_0x8ce4('0x5a')]['id'];}_0x36ebab['body'][_0x8ce4('0x5f')]=!![];_0x36ebab[_0x8ce4('0x5a')][_0x8ce4('0x60')]=moment()['format'](_0x8ce4('0x61'));_0x36ebab['body'][_0x8ce4('0x62')]=_0x36ebab[_0x8ce4('0x5a')][_0x8ce4('0x62')]||_0x36ebab[_0x8ce4('0x63')]['id'];_0x28ac25['agent']['id']=_0x36ebab[_0x8ce4('0x5a')][_0x8ce4('0x62')];return db['FaxMessage'][_0x8ce4('0x59')]({'where':{'id':_0x36ebab[_0x8ce4('0x56')]['id'],'UserId':null}})[_0x8ce4('0x23')](handleEntityNotFound(_0x678102,null))[_0x8ce4('0x23')](saveUpdates(_0x36ebab[_0x8ce4('0x5a')],null))['then'](function(_0x389c0b){if(_0x389c0b){_0x28ac25[_0x8ce4('0x29')]=_0x389c0b[_0x8ce4('0x64')]({'plain':!![]});return db[_0x8ce4('0x65')][_0x8ce4('0x59')]({'where':{'id':_0x389c0b['FaxInteractionId']}});}return null;})[_0x8ce4('0x23')](handleEntityNotFound(_0x678102,null))['then'](function(_0x3e2285){if(_0x3e2285){return _0x3e2285[_0x8ce4('0x39')]({'UserId':_0x36ebab[_0x8ce4('0x5a')][_0x8ce4('0x62')],'read1stAt':_['isNil'](_0x3e2285[_0x8ce4('0x66')])?moment()[_0x8ce4('0x67')](_0x8ce4('0x61')):undefined});}return null;})[_0x8ce4('0x23')](function(_0x466e14){if(_0x466e14){_0x28ac25[_0x8ce4('0x68')]=_0x466e14[_0x8ce4('0x64')]({'plain':!![]});interaction_log['info'](_0x8ce4('0x69'),_0x36ebab[_0x8ce4('0x63')]['id'],_0x36ebab[_0x8ce4('0x63')][_0x8ce4('0x3d')],_0x36ebab[_0x8ce4('0x63')][_0x8ce4('0x6a')],_0x28ac25[_0x8ce4('0x68')]['id'],_0x36ebab[_0x8ce4('0x5a')]?JSON[_0x8ce4('0x27')](_0x36ebab[_0x8ce4('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0x8ce4('0x6b'),_0x28ac25);}return null;})[_0x8ce4('0x23')](function(_0x9e4ff5){var _0xe0baf0=_0x8ce4('0x6c')+_0x9e4ff5['message'][_0x8ce4('0x6d')];return db[_0x8ce4('0x6e')]['query'](_0xe0baf0,{'type':db[_0x8ce4('0x6f')][_0x8ce4('0x70')][_0x8ce4('0x71')],'raw':!![]})[_0x8ce4('0x23')](function(_0x5d13f1){return _0x5d13f1;});})[_0x8ce4('0x23')](function(_0x2eb104){if(_0x2eb104){_0x28ac25['message'][_0x8ce4('0x72')]=_0x2eb104[0x0];if(!_0x36ebab['body'][_0x8ce4('0x62')])return;return db[_0x8ce4('0x73')][_0x8ce4('0x59')]({'where':{'id':_0x36ebab[_0x8ce4('0x5a')][_0x8ce4('0x62')],'role':'agent'},'attributes':['id','name',_0x8ce4('0x74'),'email',_0x8ce4('0x75')],'raw':!![]});}return null;})[_0x8ce4('0x23')](function(_0x1ff135){if(!_0x1ff135)return null;_0x28ac25['message'][_0x8ce4('0x76')]=_0x1ff135;return _0x28ac25;})['then'](function(_0x59a889){if(_0x59a889){if(_0x36ebab[_0x8ce4('0x5a')]['manual']){_0x28ac25[_0x8ce4('0x29')][_0x8ce4('0x77')]=util[_0x8ce4('0x67')]('SIP/%s',_0x36ebab[_0x8ce4('0x63')]['name']);_0x28ac25[_0x8ce4('0x29')][_0x8ce4('0x78')]=_0x28ac25['channel'];_0x28ac25[_0x8ce4('0x29')][_0x8ce4('0x79')]=_0x28ac25[_0x8ce4('0x78')];_0x28ac25['message'][_0x8ce4('0x7a')]=_0x8ce4('0x5d');return respondWithRpcPromise(_0x8ce4('0x7b'),_0x8ce4('0x7b'),{'event':_0x8ce4('0x7c'),'message':_0x28ac25[_0x8ce4('0x29')]},client9002)[_0x8ce4('0x23')](function(){return _0x28ac25;});}return _0x28ac25;}return null;})[_0x8ce4('0x23')](respondWithResult(_0x678102,null))[_0x8ce4('0x54')](handleError(_0x678102,null));};var interaction_log=require(_0x8ce4('0x17'))('fax-interactions');exports[_0x8ce4('0x37')]=function(_0x59dd32,_0x11382f,_0x3333e2){var _0x85a2a3={'agent':{},'channel':_0x8ce4('0x5e')};if(_0x59dd32[_0x8ce4('0x5a')]['id']){delete _0x59dd32[_0x8ce4('0x5a')]['id'];}_0x59dd32[_0x8ce4('0x5a')][_0x8ce4('0x62')]=_0x59dd32[_0x8ce4('0x5a')][_0x8ce4('0x62')]||_0x59dd32[_0x8ce4('0x63')]['id'];_0x85a2a3[_0x8ce4('0x76')]['id']=_0x59dd32[_0x8ce4('0x5a')][_0x8ce4('0x62')];return db[_0x8ce4('0x3f')]['find']({'where':{'id':_0x59dd32[_0x8ce4('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11382f,null))['then'](function(_0x957f7d){if(_0x957f7d){_0x85a2a3[_0x8ce4('0x29')]=_0x957f7d[_0x8ce4('0x64')]({'plain':!![]});return db['FaxInteraction'][_0x8ce4('0x59')]({'where':{'id':_0x957f7d[_0x8ce4('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x11382f,null))['then'](function(_0x509a16){if(_0x509a16){_0x85a2a3[_0x8ce4('0x68')]=_0x509a16[_0x8ce4('0x64')]({'plain':!![]});interaction_log[_0x8ce4('0x2a')](_0x8ce4('0x7e'),_0x59dd32['user']['id'],_0x59dd32['user'][_0x8ce4('0x3d')],_0x59dd32['user'][_0x8ce4('0x6a')],_0x85a2a3[_0x8ce4('0x68')]['id'],_0x59dd32[_0x8ce4('0x5a')]?JSON['stringify'](_0x59dd32['body']):'null');return respondWithRpcPromise('RejectMessage',_0x8ce4('0x7f'),_0x85a2a3);}return null;})[_0x8ce4('0x23')](function(_0x26e8c0){var _0x43fa2f=_0x8ce4('0x6c')+_0x26e8c0[_0x8ce4('0x29')]['ContactId'];return db[_0x8ce4('0x6e')][_0x8ce4('0x45')](_0x43fa2f,{'type':db[_0x8ce4('0x6f')][_0x8ce4('0x70')][_0x8ce4('0x71')],'raw':!![]})['then'](function(_0x325f39){return _0x325f39;});})['then'](function(_0x3aabbd){if(_0x3aabbd){_0x85a2a3[_0x8ce4('0x29')]['contact']=_0x3aabbd[0x0];if(!_0x59dd32[_0x8ce4('0x5a')][_0x8ce4('0x62')])return;return db['User'][_0x8ce4('0x59')]({'where':{'id':_0x59dd32[_0x8ce4('0x5a')]['UserId'],'role':_0x8ce4('0x76')},'attributes':['id','name',_0x8ce4('0x74'),_0x8ce4('0x80'),_0x8ce4('0x75')],'raw':!![]});}return null;})['then'](function(_0x3419d1){if(!_0x3419d1)return null;_0x85a2a3[_0x8ce4('0x29')][_0x8ce4('0x76')]=_0x3419d1;return _0x85a2a3;})[_0x8ce4('0x23')](function(_0x1b2e26){if(_0x1b2e26){_0x1b2e26['message']['interface']=util[_0x8ce4('0x67')]('SIP/%s',_0x59dd32[_0x8ce4('0x63')][_0x8ce4('0x3d')]);_0x1b2e26[_0x8ce4('0x29')]['channel']=_0x85a2a3['channel'];_0x1b2e26[_0x8ce4('0x29')][_0x8ce4('0x79')]=_0x85a2a3['channel'];_0x1b2e26[_0x8ce4('0x29')][_0x8ce4('0x7a')]=_0x8ce4('0x37');respondWithRpcPromise(_0x8ce4('0x7b'),_0x8ce4('0x7b'),{'event':'rejectmessage','message':_0x1b2e26[_0x8ce4('0x29')]},client9002);return _0x85a2a3;}return null;})[_0x8ce4('0x23')](respondWithResult(_0x11382f,null))[_0x8ce4('0x54')](handleError(_0x11382f,null));};exports[_0x8ce4('0x81')]=function(_0x118f49,_0x1a5480){var _0x16df0e;return db[_0x8ce4('0x3f')][_0x8ce4('0x81')](_0x118f49[_0x8ce4('0x5a')],{})[_0x8ce4('0x23')](function(_0x4caf72){_0x16df0e=_0x4caf72;return db[_0x8ce4('0x82')][_0x8ce4('0x83')]({'where':{'id':_0x16df0e[_0x8ce4('0x6d')]}});})[_0x8ce4('0x23')](function(_0x25c2c8){if(_[_0x8ce4('0x84')](_0x25c2c8)){return;}else{_0x16df0e['fax']=_0x25c2c8[_0x8ce4('0x5e')];return db['Attachment'][_0x8ce4('0x83')]({'where':{'id':_0x16df0e[_0x8ce4('0x85')]}});}})[_0x8ce4('0x23')](function(_0x440ebe){return respondWithRpcPromise(_0x8ce4('0x86'),_0x8ce4('0x86'),{'FaxAccountId':_[_0x8ce4('0x84')](_0x118f49['body'])?undefined:_0x118f49[_0x8ce4('0x5a')]['FaxAccountId'],'path':_[_0x8ce4('0x84')](_0x440ebe)?undefined:util[_0x8ce4('0x67')](_0x8ce4('0x87'),_0x440ebe['basename']),'fax':_[_0x8ce4('0x84')](_0x16df0e[_0x8ce4('0x5e')])?undefined:_0x16df0e['fax'],'AttachmentId':_0x16df0e['AttachmentId']},client9002);})['then'](respondWithResult(_0x1a5480,0xc9))[_0x8ce4('0x54')](handleError(_0x1a5480,null));};exports['download']=function(_0x33f401,_0x406d92){var _0x432d6c=path['join'](config['root'],'server','files','attachments');return db[_0x8ce4('0x3f')]['find']({'where':{'id':_0x33f401[_0x8ce4('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0x8ce4('0x88')}]})[_0x8ce4('0x23')](handleEntityNotFound(_0x406d92,null))[_0x8ce4('0x23')](function(_0xb3610a){if(_0xb3610a){return _0x406d92[_0x8ce4('0x89')](path['join'](_0x432d6c,_0xb3610a[_0x8ce4('0x88')][_0x8ce4('0x8a')]));}})[_0x8ce4('0x54')](handleError(_0x406d92,null));}; \ No newline at end of file +var _0x1845=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','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','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','body','describe','fax-interactions','read','readAt','format','UserId','user','agent','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','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','../../config/logger','fax','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1dcf7a,_0xca65bd){var _0x3d0cb4=function(_0x37b033){while(--_0x37b033){_0x1dcf7a['push'](_0x1dcf7a['shift']());}};_0x3d0cb4(++_0xca65bd);}(_0x1845,0x116));var _0x5184=function(_0x48c5d5,_0x4d1edc){_0x48c5d5=_0x48c5d5-0x0;var _0x2fb2b6=_0x1845[_0x48c5d5];return _0x2fb2b6;};'use strict';var emlformat=require(_0x5184('0x0'));var rimraf=require(_0x5184('0x1'));var zipdir=require(_0x5184('0x2'));var jsonpatch=require(_0x5184('0x3'));var rp=require('request-promise');var moment=require(_0x5184('0x4'));var BPromise=require(_0x5184('0x5'));var Mustache=require(_0x5184('0x6'));var util=require(_0x5184('0x7'));var path=require(_0x5184('0x8'));var sox=require(_0x5184('0x9'));var csv=require(_0x5184('0xa'));var ejs=require(_0x5184('0xb'));var fs=require('fs');var fs_extra=require(_0x5184('0xc'));var _=require(_0x5184('0xd'));var squel=require(_0x5184('0xe'));var crypto=require(_0x5184('0xf'));var jsforce=require(_0x5184('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5184('0xa'));var querystring=require(_0x5184('0x11'));var Papa=require(_0x5184('0x12'));var Redis=require(_0x5184('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5184('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5184('0x15'));var licenseUtil=require(_0x5184('0x16'));var db=require('../../mysqldb')['db'];config[_0x5184('0x17')]=_['defaults'](config[_0x5184('0x17')],{'host':_0x5184('0x18'),'port':0x18eb});var socket=require(_0x5184('0x19'))(new Redis(config[_0x5184('0x17')]));require(_0x5184('0x1a'))[_0x5184('0x1b')](socket);var jayson=require(_0x5184('0x1c'));var client=jayson[_0x5184('0x1d')][_0x5184('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5184('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2310a9,_0x17134f,_0x14b0fe,_0x2db542){return new BPromise(function(_0x544f72,_0x224795){var _0x137751=_0x2db542||client;return _0x137751[_0x5184('0x1f')](_0x2310a9,_0x14b0fe)['then'](function(_0x292357){logger[_0x5184('0x20')](_0x5184('0x21'),_0x17134f,_0x5184('0x22'));logger['debug'](_0x5184('0x23'),_0x17134f,_0x5184('0x22'),JSON[_0x5184('0x24')](_0x292357));if(_0x292357['error']){if(_0x292357[_0x5184('0x25')][_0x5184('0x26')]===0x1f4){logger[_0x5184('0x25')](_0x5184('0x21'),_0x17134f,_0x292357[_0x5184('0x25')][_0x5184('0x27')]);return _0x224795(_0x292357[_0x5184('0x25')][_0x5184('0x27')]);}logger[_0x5184('0x25')](_0x5184('0x21'),_0x17134f,_0x292357[_0x5184('0x25')][_0x5184('0x27')]);return _0x544f72(_0x292357['error'][_0x5184('0x27')]);}else{logger[_0x5184('0x20')](_0x5184('0x21'),_0x17134f,_0x5184('0x22'));_0x544f72(_0x292357[_0x5184('0x28')][_0x5184('0x27')]);}})[_0x5184('0x29')](function(_0x40716b){logger[_0x5184('0x25')](_0x5184('0x21'),_0x17134f,_0x40716b);_0x224795(_0x40716b);});});}function respondWithStatusCode(_0x455942,_0x42da9d){_0x42da9d=_0x42da9d||0xcc;return function(_0x2819fb){if(_0x2819fb){return _0x455942[_0x5184('0x2a')](_0x42da9d);}return _0x455942[_0x5184('0x2b')](_0x42da9d)['end']();};}function respondWithResult(_0x39e2ea,_0x369998){_0x369998=_0x369998||0xc8;return function(_0x3c2773){if(_0x3c2773){return _0x39e2ea[_0x5184('0x2b')](_0x369998)[_0x5184('0x2c')](_0x3c2773);}};}function respondWithFilteredResult(_0x1861bd,_0xc42abc){return function(_0x3a9e8f){if(_0x3a9e8f){var _0x20b0cf=typeof _0xc42abc[_0x5184('0x2d')]===_0x5184('0x2e')&&typeof _0xc42abc['limit']===_0x5184('0x2e');var _0x520896=_0x3a9e8f[_0x5184('0x2f')];var _0x4b9613=_0x20b0cf?0x0:_0xc42abc['offset'];var _0x414e92=_0x20b0cf?_0x3a9e8f['count']:_0xc42abc[_0x5184('0x2d')]+_0xc42abc[_0x5184('0x30')];var _0x1cd27a;if(_0x414e92>=_0x520896){_0x414e92=_0x520896;_0x1cd27a=0xc8;}else{_0x1cd27a=0xce;}_0x1861bd[_0x5184('0x2b')](_0x1cd27a);return _0x1861bd['set'](_0x5184('0x31'),_0x4b9613+'-'+_0x414e92+'/'+_0x520896)[_0x5184('0x2c')](_0x3a9e8f);}return null;};}function patchUpdates(_0x28efb1){return function(_0x331526){try{jsonpatch[_0x5184('0x32')](_0x331526,_0x28efb1,!![]);}catch(_0x56a4f2){return BPromise[_0x5184('0x33')](_0x56a4f2);}return _0x331526[_0x5184('0x34')]();};}function saveUpdates(_0x21fce5,_0x1c1a65){return function(_0x1cde78){if(_0x1cde78){return _0x1cde78[_0x5184('0x35')](_0x21fce5)[_0x5184('0x36')](function(_0x198b04){return _0x198b04;});}return null;};}function removeEntity(_0x559c88,_0x25b53e){return function(_0x2abec3){if(_0x2abec3){return _0x2abec3[_0x5184('0x37')]()[_0x5184('0x36')](function(){_0x559c88['status'](0xcc)[_0x5184('0x38')]();});}};}function handleEntityNotFound(_0x38d220,_0x45cb43){return function(_0x462592){if(!_0x462592){_0x38d220[_0x5184('0x2a')](0x194);}return _0x462592;};}function handleError(_0x33e4eb,_0x229d20){_0x229d20=_0x229d20||0x1f4;return function(_0x435190){logger[_0x5184('0x25')](_0x435190[_0x5184('0x39')]);if(_0x435190['name']){delete _0x435190[_0x5184('0x3a')];}_0x33e4eb['status'](_0x229d20)['send'](_0x435190);};}exports['index']=function(_0x4cabdf,_0x4e58a7){var _0x393d62={},_0x2d7369={},_0x329378={'count':0x0,'rows':[]};var _0x50fc2e=_['map'](db[_0x5184('0x3b')][_0x5184('0x3c')],function(_0x2aabea){return{'name':_0x2aabea[_0x5184('0x3d')],'type':_0x2aabea[_0x5184('0x3e')][_0x5184('0x3f')]};});_0x2d7369[_0x5184('0x40')]=_[_0x5184('0x41')](_0x50fc2e,'name');_0x2d7369[_0x5184('0x42')]=_[_0x5184('0x43')](_0x4cabdf[_0x5184('0x42')]);_0x2d7369['filters']=_['intersection'](_0x2d7369[_0x5184('0x40')],_0x2d7369[_0x5184('0x42')]);_0x393d62[_0x5184('0x44')]=_[_0x5184('0x45')](_0x2d7369[_0x5184('0x40')],qs[_0x5184('0x46')](_0x4cabdf['query']['fields']));_0x393d62[_0x5184('0x44')]=_0x393d62['attributes'][_0x5184('0x47')]?_0x393d62['attributes']:_0x2d7369[_0x5184('0x40')];if(!_0x4cabdf[_0x5184('0x42')]['hasOwnProperty'](_0x5184('0x48'))){_0x393d62['limit']=qs['limit'](_0x4cabdf[_0x5184('0x42')][_0x5184('0x30')]);_0x393d62['offset']=qs[_0x5184('0x2d')](_0x4cabdf[_0x5184('0x42')][_0x5184('0x2d')]);}_0x393d62['order']=qs[_0x5184('0x49')](_0x4cabdf[_0x5184('0x42')][_0x5184('0x49')]);_0x393d62[_0x5184('0x4a')]=qs[_0x5184('0x4b')](_[_0x5184('0x4c')](_0x4cabdf[_0x5184('0x42')],_0x2d7369[_0x5184('0x4b')]),_0x50fc2e);if(_0x4cabdf[_0x5184('0x42')][_0x5184('0x4d')]){_0x393d62[_0x5184('0x4a')]=_[_0x5184('0x4e')](_0x393d62[_0x5184('0x4a')],{'$or':_[_0x5184('0x41')](_0x50fc2e,function(_0x476b43){if(_0x476b43[_0x5184('0x3e')]!==_0x5184('0x4f')){var _0x5d21d8={};_0x5d21d8[_0x476b43[_0x5184('0x3a')]]={'$like':'%'+_0x4cabdf[_0x5184('0x42')][_0x5184('0x4d')]+'%'};return _0x5d21d8;}})});}_0x393d62=_['merge']({},_0x393d62,_0x4cabdf['options']);var _0x1d776d={'where':_0x393d62[_0x5184('0x4a')]};return db['FaxMessage']['count'](_0x1d776d)[_0x5184('0x36')](function(_0x56a8f0){_0x329378[_0x5184('0x2f')]=_0x56a8f0;if(_0x4cabdf[_0x5184('0x42')]['includeAll']){_0x393d62[_0x5184('0x50')]=[{'all':!![]}];}return db[_0x5184('0x3b')][_0x5184('0x51')](_0x393d62);})['then'](function(_0x1c4a43){_0x329378[_0x5184('0x52')]=_0x1c4a43;return _0x329378;})['then'](respondWithFilteredResult(_0x4e58a7,_0x393d62))[_0x5184('0x29')](handleError(_0x4e58a7,null));};exports[_0x5184('0x53')]=function(_0x43991a,_0xdc18d5){var _0x546984={'raw':!![],'where':{'id':_0x43991a[_0x5184('0x54')]['id']}},_0x4310ff={};_0x4310ff[_0x5184('0x40')]=_[_0x5184('0x43')](db[_0x5184('0x3b')][_0x5184('0x3c')]);_0x4310ff[_0x5184('0x42')]=_[_0x5184('0x43')](_0x43991a['query']);_0x4310ff[_0x5184('0x4b')]=_[_0x5184('0x45')](_0x4310ff[_0x5184('0x40')],_0x4310ff[_0x5184('0x42')]);_0x546984[_0x5184('0x44')]=_[_0x5184('0x45')](_0x4310ff[_0x5184('0x40')],qs[_0x5184('0x46')](_0x43991a[_0x5184('0x42')][_0x5184('0x46')]));_0x546984['attributes']=_0x546984[_0x5184('0x44')][_0x5184('0x47')]?_0x546984[_0x5184('0x44')]:_0x4310ff[_0x5184('0x40')];if(_0x43991a[_0x5184('0x42')][_0x5184('0x55')]){_0x546984[_0x5184('0x50')]=[{'all':!![]}];}_0x546984=_['merge']({},_0x546984,_0x43991a[_0x5184('0x56')]);return db['FaxMessage'][_0x5184('0x57')](_0x546984)[_0x5184('0x36')](handleEntityNotFound(_0xdc18d5,null))[_0x5184('0x36')](respondWithResult(_0xdc18d5,null))['catch'](handleError(_0xdc18d5,null));};exports[_0x5184('0x35')]=function(_0x471de4,_0x5dbc5d){if(_0x471de4['body']['id']){delete _0x471de4[_0x5184('0x58')]['id'];}return db[_0x5184('0x3b')][_0x5184('0x57')]({'where':{'id':_0x471de4[_0x5184('0x54')]['id']}})['then'](handleEntityNotFound(_0x5dbc5d,null))[_0x5184('0x36')](saveUpdates(_0x471de4['body'],null))[_0x5184('0x36')](respondWithResult(_0x5dbc5d,null))[_0x5184('0x29')](handleError(_0x5dbc5d,null));};exports[_0x5184('0x37')]=function(_0x753dd8,_0x2a20fc){return db[_0x5184('0x3b')][_0x5184('0x57')]({'where':{'id':_0x753dd8[_0x5184('0x54')]['id']}})[_0x5184('0x36')](handleEntityNotFound(_0x2a20fc,null))['then'](removeEntity(_0x2a20fc,null))['catch'](handleError(_0x2a20fc,null));};exports[_0x5184('0x59')]=function(_0x581d67,_0x537c48){return db[_0x5184('0x3b')][_0x5184('0x59')]()[_0x5184('0x36')](respondWithResult(_0x537c48,null))[_0x5184('0x29')](handleError(_0x537c48,null));};var interaction_log=require('../../config/logger')(_0x5184('0x5a'));exports['accept']=function(_0x1274d9,_0x7b3c9c,_0xcef11c){var _0x3806f0={'agent':{},'channel':'fax'};if(_0x1274d9[_0x5184('0x58')]['id']){delete _0x1274d9[_0x5184('0x58')]['id'];}_0x1274d9[_0x5184('0x58')][_0x5184('0x5b')]=!![];_0x1274d9['body'][_0x5184('0x5c')]=moment()[_0x5184('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1274d9[_0x5184('0x58')][_0x5184('0x5e')]=_0x1274d9[_0x5184('0x58')]['UserId']||_0x1274d9[_0x5184('0x5f')]['id'];_0x3806f0[_0x5184('0x60')]['id']=_0x1274d9[_0x5184('0x58')]['UserId'];return db[_0x5184('0x3b')][_0x5184('0x57')]({'where':{'id':_0x1274d9['params']['id'],'UserId':null}})[_0x5184('0x36')](handleEntityNotFound(_0x7b3c9c,null))[_0x5184('0x36')](saveUpdates(_0x1274d9[_0x5184('0x58')],null))[_0x5184('0x36')](function(_0xb8c185){if(_0xb8c185){_0x3806f0[_0x5184('0x27')]=_0xb8c185[_0x5184('0x61')]({'plain':!![]});return db[_0x5184('0x62')][_0x5184('0x57')]({'where':{'id':_0xb8c185[_0x5184('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x7b3c9c,null))[_0x5184('0x36')](function(_0x4921e7){if(_0x4921e7){return _0x4921e7[_0x5184('0x35')]({'UserId':_0x1274d9[_0x5184('0x58')][_0x5184('0x5e')],'read1stAt':_[_0x5184('0x64')](_0x4921e7[_0x5184('0x65')])?moment()['format'](_0x5184('0x66')):undefined});}return null;})['then'](function(_0x49c9ff){if(_0x49c9ff){_0x3806f0[_0x5184('0x67')]=_0x49c9ff['get']({'plain':!![]});interaction_log[_0x5184('0x20')](_0x5184('0x68'),_0x1274d9['user']['id'],_0x1274d9[_0x5184('0x5f')]['name'],_0x1274d9['user'][_0x5184('0x69')],_0x3806f0['interaction']['id'],_0x1274d9[_0x5184('0x58')]?JSON['stringify'](_0x1274d9[_0x5184('0x58')]):'null');return respondWithRpcPromise(_0x5184('0x6a'),_0x5184('0x6b'),_0x3806f0);}return null;})[_0x5184('0x36')](function(_0x1e44f8){var _0x4c4e25='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e44f8[_0x5184('0x27')][_0x5184('0x6c')];return db[_0x5184('0x6d')][_0x5184('0x42')](_0x4c4e25,{'type':db[_0x5184('0x6e')][_0x5184('0x6f')][_0x5184('0x70')],'raw':!![]})[_0x5184('0x36')](function(_0x18dd82){return _0x18dd82;});})[_0x5184('0x36')](function(_0x347a77){if(_0x347a77){_0x3806f0[_0x5184('0x27')][_0x5184('0x71')]=_0x347a77[0x0];if(!_0x1274d9['body']['UserId'])return;return db[_0x5184('0x72')][_0x5184('0x57')]({'where':{'id':_0x1274d9[_0x5184('0x58')][_0x5184('0x5e')],'role':'agent'},'attributes':['id',_0x5184('0x3a'),_0x5184('0x73'),_0x5184('0x74'),_0x5184('0x75')],'raw':!![]});}return null;})[_0x5184('0x36')](function(_0x434954){if(!_0x434954)return null;_0x3806f0[_0x5184('0x27')]['agent']=_0x434954;return _0x3806f0;})[_0x5184('0x36')](function(_0x2f300a){if(_0x2f300a){if(_0x1274d9[_0x5184('0x58')][_0x5184('0x76')]){_0x3806f0[_0x5184('0x27')]['interface']=util['format'](_0x5184('0x77'),_0x1274d9[_0x5184('0x5f')][_0x5184('0x3a')]);_0x3806f0[_0x5184('0x27')]['channel']=_0x3806f0[_0x5184('0x78')];_0x3806f0[_0x5184('0x27')][_0x5184('0x79')]=_0x3806f0['channel'];_0x3806f0[_0x5184('0x27')]['event']='accept';return respondWithRpcPromise(_0x5184('0x7a'),_0x5184('0x7a'),{'event':_0x5184('0x7b'),'message':_0x3806f0[_0x5184('0x27')]},client9002)[_0x5184('0x36')](function(){return _0x3806f0;});}return _0x3806f0;}return null;})[_0x5184('0x36')](respondWithResult(_0x7b3c9c,null))[_0x5184('0x29')](handleError(_0x7b3c9c,null));};var interaction_log=require(_0x5184('0x7c'))('fax-interactions');exports[_0x5184('0x33')]=function(_0x56ce98,_0x1503c3,_0x418acc){var _0x15dd53={'agent':{},'channel':_0x5184('0x7d')};if(_0x56ce98[_0x5184('0x58')]['id']){delete _0x56ce98[_0x5184('0x58')]['id'];}_0x56ce98[_0x5184('0x58')][_0x5184('0x5e')]=_0x56ce98['body'][_0x5184('0x5e')]||_0x56ce98[_0x5184('0x5f')]['id'];_0x15dd53[_0x5184('0x60')]['id']=_0x56ce98['body'][_0x5184('0x5e')];return db[_0x5184('0x3b')]['find']({'where':{'id':_0x56ce98[_0x5184('0x54')]['id'],'UserId':null}})[_0x5184('0x36')](handleEntityNotFound(_0x1503c3,null))[_0x5184('0x36')](function(_0x636162){if(_0x636162){_0x15dd53[_0x5184('0x27')]=_0x636162['get']({'plain':!![]});return db[_0x5184('0x62')][_0x5184('0x57')]({'where':{'id':_0x636162['FaxInteractionId']}});}return null;})[_0x5184('0x36')](handleEntityNotFound(_0x1503c3,null))[_0x5184('0x36')](function(_0x9f4981){if(_0x9f4981){_0x15dd53[_0x5184('0x67')]=_0x9f4981[_0x5184('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56ce98[_0x5184('0x5f')]['id'],_0x56ce98[_0x5184('0x5f')][_0x5184('0x3a')],_0x56ce98[_0x5184('0x5f')][_0x5184('0x69')],_0x15dd53['interaction']['id'],_0x56ce98[_0x5184('0x58')]?JSON['stringify'](_0x56ce98[_0x5184('0x58')]):'null');return respondWithRpcPromise(_0x5184('0x7e'),_0x5184('0x7f'),_0x15dd53);}return null;})['then'](function(_0x5c55cb){var _0x2c41b2=_0x5184('0x80')+_0x5c55cb[_0x5184('0x27')][_0x5184('0x6c')];return db[_0x5184('0x6d')][_0x5184('0x42')](_0x2c41b2,{'type':db[_0x5184('0x6e')][_0x5184('0x6f')][_0x5184('0x70')],'raw':!![]})[_0x5184('0x36')](function(_0x1cf7e6){return _0x1cf7e6;});})[_0x5184('0x36')](function(_0x5bddbf){if(_0x5bddbf){_0x15dd53[_0x5184('0x27')][_0x5184('0x71')]=_0x5bddbf[0x0];if(!_0x56ce98[_0x5184('0x58')][_0x5184('0x5e')])return;return db[_0x5184('0x72')][_0x5184('0x57')]({'where':{'id':_0x56ce98['body'][_0x5184('0x5e')],'role':_0x5184('0x60')},'attributes':['id','name',_0x5184('0x73'),_0x5184('0x74'),_0x5184('0x75')],'raw':!![]});}return null;})[_0x5184('0x36')](function(_0x22941b){if(!_0x22941b)return null;_0x15dd53[_0x5184('0x27')]['agent']=_0x22941b;return _0x15dd53;})[_0x5184('0x36')](function(_0x12951b){if(_0x12951b){_0x12951b['message'][_0x5184('0x81')]=util[_0x5184('0x5d')](_0x5184('0x77'),_0x56ce98[_0x5184('0x5f')][_0x5184('0x3a')]);_0x12951b[_0x5184('0x27')][_0x5184('0x78')]=_0x15dd53['channel'];_0x12951b[_0x5184('0x27')][_0x5184('0x79')]=_0x15dd53[_0x5184('0x78')];_0x12951b[_0x5184('0x27')]['event']=_0x5184('0x33');respondWithRpcPromise(_0x5184('0x7a'),_0x5184('0x7a'),{'event':_0x5184('0x82'),'message':_0x12951b[_0x5184('0x27')]},client9002);return _0x15dd53;}return null;})[_0x5184('0x36')](respondWithResult(_0x1503c3,null))[_0x5184('0x29')](handleError(_0x1503c3,null));};exports[_0x5184('0x83')]=function(_0x23920e,_0x4c602c){var _0x4059d8;return db[_0x5184('0x3b')][_0x5184('0x83')](_0x23920e[_0x5184('0x58')],{})[_0x5184('0x36')](function(_0x3d364e){_0x4059d8=_0x3d364e;return db[_0x5184('0x84')][_0x5184('0x85')]({'where':{'id':_0x4059d8[_0x5184('0x6c')]}});})[_0x5184('0x36')](function(_0x293a89){if(_[_0x5184('0x64')](_0x293a89)){return;}else{_0x4059d8['fax']=_0x293a89['fax'];return db[_0x5184('0x86')][_0x5184('0x85')]({'where':{'id':_0x4059d8[_0x5184('0x87')]}});}})[_0x5184('0x36')](function(_0x4fd3ef){return respondWithRpcPromise(_0x5184('0x88'),_0x5184('0x88'),{'FaxAccountId':_['isNil'](_0x23920e[_0x5184('0x58')])?undefined:_0x23920e[_0x5184('0x58')][_0x5184('0x89')],'path':_['isNil'](_0x4fd3ef)?undefined:util[_0x5184('0x5d')](_0x5184('0x8a'),_0x4fd3ef[_0x5184('0x8b')]),'fax':_[_0x5184('0x64')](_0x4059d8[_0x5184('0x7d')])?undefined:_0x4059d8['fax'],'AttachmentId':_0x4059d8[_0x5184('0x87')]},client9002);})[_0x5184('0x36')](respondWithResult(_0x4c602c,0xc9))[_0x5184('0x29')](handleError(_0x4c602c,null));};exports[_0x5184('0x8c')]=function(_0x132e1d,_0x44ae5f){var _0x4f866f=path[_0x5184('0x8d')](config[_0x5184('0x8e')],_0x5184('0x8f'),_0x5184('0x90'),_0x5184('0x91'));return db[_0x5184('0x3b')][_0x5184('0x57')]({'where':{'id':_0x132e1d[_0x5184('0x54')]['id']},'include':[{'model':db[_0x5184('0x86')],'as':_0x5184('0x86')}]})[_0x5184('0x36')](handleEntityNotFound(_0x44ae5f,null))[_0x5184('0x36')](function(_0x3dbd0a){if(_0x3dbd0a){return _0x44ae5f[_0x5184('0x8c')](path[_0x5184('0x8d')](_0x4f866f,_0x3dbd0a['Attachment'][_0x5184('0x8b')]));}})[_0x5184('0x29')](handleError(_0x44ae5f,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 62f8a18..3422074 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 _0xd5f9=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove','hook'];(function(_0xd61232,_0x3d4293){var _0x40456c=function(_0x511130){while(--_0x511130){_0xd61232['push'](_0xd61232['shift']());}};_0x40456c(++_0x3d4293);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x42bfc9,_0x92ccf5){_0x42bfc9=_0x42bfc9-0x0;var _0x645e2b=_0xd5f9[_0x42bfc9];return _0x645e2b;};'use strict';var EventEmitter=require(_0x9d5f('0x0'));var FaxMessage=require(_0x9d5f('0x1'))['db'][_0x9d5f('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x9d5f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9d5f('0x4'),'afterDestroy':_0x9d5f('0x5')};function emitEvent(_0x15cf45){return function(_0x42d201,_0x216344,_0x338e53){FaxMessageEvents['emit'](_0x15cf45+':'+_0x42d201['id'],_0x42d201);FaxMessageEvents['emit'](_0x15cf45,_0x42d201);_0x338e53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x9d5f('0x6')](e,emitEvent(event));}}module[_0x9d5f('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x363e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x363e,0x179));var _0xe363=function(_0x4aaea1,_0xf0f2fd){_0x4aaea1=_0x4aaea1-0x0;var _0x3012d8=_0x363e[_0x4aaea1];return _0x3012d8;};'use strict';var EventEmitter=require(_0xe363('0x0'));var FaxMessage=require(_0xe363('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe363('0x2')](0x0);var events={'afterCreate':_0xe363('0x3'),'afterUpdate':_0xe363('0x4'),'afterDestroy':_0xe363('0x5')};function emitEvent(_0x179157){return function(_0x3809ea,_0x6e174a,_0x11775e){FaxMessageEvents[_0xe363('0x6')](_0x179157+':'+_0x3809ea['id'],_0x3809ea);FaxMessageEvents[_0xe363('0x6')](_0x179157,_0x3809ea);_0x11775e(null);};}for(var e in events){if(events[_0xe363('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xe363('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index edbbb54..0af50fe 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 _0x953e=['get','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','path','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages','body','models'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x953e,0x1ae));var _0xe953=function(_0x21bbec,_0x56f7aa){_0x21bbec=_0x21bbec-0x0;var _0xbaa7af=_0x953e[_0x21bbec];return _0xbaa7af;};'use strict';var _=require('lodash');var util=require(_0xe953('0x0'));var logger=require('../../config/logger')(_0xe953('0x1'));var moment=require(_0xe953('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe953('0x3'));var rimraf=require(_0xe953('0x4'));var config=require(_0xe953('0x5'));var attributes=require(_0xe953('0x6'));module['exports']=function(_0x35f780,_0x58deae){return _0x35f780[_0xe953('0x7')]('FaxMessage',attributes,{'tableName':_0xe953('0x8'),'paranoid':![],'indexes':[{'name':_0xe953('0x9'),'fields':[_0xe953('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1af675,_0x574222,_0x20fce9){var _0x4a3cd0=_0x35f780[_0xe953('0xb')];var _0x255ab9=_0x1af675[_0xe953('0xc')]({'plain':!![]});if(_0x255ab9['direction'][_0xe953('0xd')]()==='in'||_0x255ab9['direction'][_0xe953('0xd')]()===_0xe953('0xe')&&!_0x255ab9['secret']&&!_['isNil'](_0x255ab9[_0xe953('0xf')])){_0x4a3cd0[_0xe953('0x10')][_0xe953('0x11')]({'where':{'id':_0x255ab9[_0xe953('0x12')]}})['then'](function(_0x45705c){if(_0x45705c){_0x45705c[_0xe953('0x13')]({'lastMsgAt':_0x255ab9[_0xe953('0x14')],'lastMsgDirection':_0x255ab9[_0xe953('0x15')][_0xe953('0xd')]()});}})[_0xe953('0x16')](function(_0x2d2503){console[_0xe953('0x17')](_0x2d2503);});}_0x20fce9();}},'charset':_0xe953('0x18'),'collate':_0xe953('0x19')});}; \ No newline at end of file +var _0x96cb=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash'];(function(_0x3bbdff,_0x3e6615){var _0x53de7d=function(_0x48bfad){while(--_0x48bfad){_0x3bbdff['push'](_0x3bbdff['shift']());}};_0x53de7d(++_0x3e6615);}(_0x96cb,0x7b));var _0xb96c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb96c('0x0'));var util=require(_0xb96c('0x1'));var logger=require(_0xb96c('0x2'))('api');var moment=require(_0xb96c('0x3'));var BPromise=require(_0xb96c('0x4'));var rp=require(_0xb96c('0x5'));var fs=require('fs');var path=require(_0xb96c('0x6'));var rimraf=require(_0xb96c('0x7'));var config=require(_0xb96c('0x8'));var attributes=require(_0xb96c('0x9'));module[_0xb96c('0xa')]=function(_0x360cf7,_0x5f34da){return _0x360cf7[_0xb96c('0xb')](_0xb96c('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb96c('0xd'),'fields':[_0xb96c('0xe')],'type':_0xb96c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47a500,_0x5bc7ac,_0x4d8412){var _0x37a31d=_0x360cf7[_0xb96c('0x10')];var _0x21e649=_0x47a500[_0xb96c('0x11')]({'plain':!![]});if(_0x21e649[_0xb96c('0x12')][_0xb96c('0x13')]()==='in'||_0x21e649[_0xb96c('0x12')][_0xb96c('0x13')]()===_0xb96c('0x14')&&!_0x21e649['secret']&&!_[_0xb96c('0x15')](_0x21e649[_0xb96c('0x16')])){_0x37a31d['FaxInteraction'][_0xb96c('0x17')]({'where':{'id':_0x21e649[_0xb96c('0x18')]}})[_0xb96c('0x19')](function(_0x386af4){if(_0x386af4){_0x386af4[_0xb96c('0x1a')]({'lastMsgAt':_0x21e649[_0xb96c('0x1b')],'lastMsgDirection':_0x21e649[_0xb96c('0x12')][_0xb96c('0x13')]()});}})[_0xb96c('0x1c')](function(_0x3b9ebf){console[_0xb96c('0x1d')](_0x3b9ebf);});}_0x4d8412();}},'charset':'utf8mb4','collate':_0xb96c('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e595df6..bff423b 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 _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x47449c,_0x3c445e){var _0x3186cc=function(_0x23828e){while(--_0x23828e){_0x47449c['push'](_0x47449c['shift']());}};_0x3186cc(++_0x3c445e);}(_0xac31,0xca));var _0x1ac3=function(_0x3d186b,_0x137e12){_0x3d186b=_0x3d186b-0x0;var _0x14554f=_0xac31[_0x3d186b];return _0x14554f;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file +var _0x5c12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','stringify','UpdateFaxMessage','raw','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5c12,0x188));var _0x25c1=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x5c12[_0x495b3d];return _0x4cb329;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});config[_0x25c1('0xb')]=_['defaults'](config['redis'],{'host':_0x25c1('0xc'),'port':0x18eb});var socket=require(_0x25c1('0xd'))(new Redis(config[_0x25c1('0xb')]));require(_0x25c1('0xe'))[_0x25c1('0xf')](socket);function respondWithRpcPromise(_0x588f30,_0x3e062e,_0x41c89d){return new BPromise(function(_0x11a223,_0x81f0f4){return client[_0x25c1('0x10')](_0x588f30,_0x41c89d)['then'](function(_0x196e2f){logger[_0x25c1('0x11')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));logger[_0x25c1('0x13')](_0x25c1('0x14'),_0x3e062e,_0x25c1('0x12'),JSON['stringify'](_0x196e2f));if(_0x196e2f['error']){if(_0x196e2f['error']['code']===0x1f4){logger[_0x25c1('0x15')](_0x25c1('0x16'),_0x3e062e,_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);return _0x81f0f4(_0x196e2f[_0x25c1('0x15')]['message']);}logger[_0x25c1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x196e2f['error']['message']);return _0x11a223(_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));_0x11a223(_0x196e2f['result'][_0x25c1('0x17')]);}})[_0x25c1('0x18')](function(_0x5c3c5d){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x5c3c5d);_0x81f0f4(_0x5c3c5d);});});}exports[_0x25c1('0x19')]=function(_0x3d3149){var _0x22a36e=this;return new Promise(function(_0x1bf95d,_0x481c12){return db[_0x25c1('0x1a')][_0x25c1('0x1b')](_0x3d3149[_0x25c1('0x1c')],{'raw':_0x3d3149[_0x25c1('0x1d')]?_0x3d3149['options']['raw']===undefined?!![]:![]:!![]})[_0x25c1('0x1e')](function(_0xac3335){logger[_0x25c1('0x11')](_0x25c1('0x19'),_0x3d3149);logger[_0x25c1('0x13')](_0x25c1('0x19'),_0x3d3149,JSON[_0x25c1('0x1f')](_0xac3335));_0x1bf95d(_0xac3335);})[_0x25c1('0x18')](function(_0x14ffd9){logger[_0x25c1('0x15')](_0x25c1('0x19'),_0x14ffd9[_0x25c1('0x17')],_0x3d3149);_0x481c12(_0x22a36e[_0x25c1('0x15')](0x1f4,_0x14ffd9['message']));});});};exports[_0x25c1('0x20')]=function(_0x20dbb9){var _0x1b1c96=this;return new Promise(function(_0x1fb59f,_0x21fdb8){return db[_0x25c1('0x1a')]['update'](_0x20dbb9[_0x25c1('0x1c')],{'raw':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')]['where']||null:null,'attributes':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9['options'][_0x25c1('0x22')]||null:null,'limit':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x23')]||null:null})[_0x25c1('0x1e')](function(_0x21069c){logger[_0x25c1('0x11')](_0x25c1('0x20'),_0x20dbb9);logger[_0x25c1('0x13')]('UpdateFaxMessage',_0x20dbb9,JSON[_0x25c1('0x1f')](_0x21069c));_0x1fb59f(_0x21069c);})['catch'](function(_0x492715){logger[_0x25c1('0x15')](_0x25c1('0x20'),_0x492715['message'],_0x20dbb9);_0x21fdb8(_0x1b1c96[_0x25c1('0x15')](0x1f4,_0x492715['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9ec3e75..436ef8b 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 _0xed0b=['removeListener','faxMessage:','./faxMessage.events','save','remove'];(function(_0x2c366f,_0x1bd4f8){var _0x180634=function(_0x5dcd2c){while(--_0x5dcd2c){_0x2c366f['push'](_0x2c366f['shift']());}};_0x180634(++_0x1bd4f8);}(_0xed0b,0xb1));var _0xbed0=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xed0b[_0x254b22];return _0x1279db;};'use strict';var FaxMessageEvents=require(_0xbed0('0x0'));var events=[_0xbed0('0x1'),_0xbed0('0x2'),'update'];function createListener(_0x38e015,_0x43a15){return function(_0xbaa4d1){_0x43a15['emit'](_0x38e015,_0xbaa4d1);};}function removeListener(_0x56bf32,_0x267a90){return function(){FaxMessageEvents[_0xbed0('0x3')](_0x56bf32,_0x267a90);};}exports['register']=function(_0x1d390d){for(var _0x5e3422=0x0,_0x2feb26=events['length'];_0x5e3422<_0x2feb26;_0x5e3422++){var _0x2aa678=events[_0x5e3422];var _0x510e81=createListener(_0xbed0('0x4')+_0x2aa678,_0x1d390d);FaxMessageEvents['on'](_0x2aa678,_0x510e81);}}; \ No newline at end of file +var _0x6f4f=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4d2b40,_0xa2eb21){var _0x45a8e5=function(_0x421327){while(--_0x421327){_0x4d2b40['push'](_0x4d2b40['shift']());}};_0x45a8e5(++_0xa2eb21);}(_0x6f4f,0x186));var _0xf6f4=function(_0x1da69b,_0x414733){_0x1da69b=_0x1da69b-0x0;var _0x655fbe=_0x6f4f[_0x1da69b];return _0x655fbe;};'use strict';var FaxMessageEvents=require(_0xf6f4('0x0'));var events=[_0xf6f4('0x1'),_0xf6f4('0x2'),_0xf6f4('0x3')];function createListener(_0x5c213d,_0x75c093){return function(_0x2cff56){_0x75c093[_0xf6f4('0x4')](_0x5c213d,_0x2cff56);};}function removeListener(_0xa8ced,_0x12a85b){return function(){FaxMessageEvents[_0xf6f4('0x5')](_0xa8ced,_0x12a85b);};}exports[_0xf6f4('0x6')]=function(_0x2d5920){for(var _0x363de1=0x0,_0x3a72cb=events[_0xf6f4('0x7')];_0x363de1<_0x3a72cb;_0x363de1++){var _0xf6b136=events[_0x363de1];var _0x41ea01=createListener(_0xf6f4('0x8')+_0xf6b136,_0x2d5920);FaxMessageEvents['on'](_0xf6b136,_0x41ea01);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 87bf645..6f0cbad 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 _0x4e81=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','fs-extra'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x4e81,0x1bc));var _0x14e8=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x4e81[_0x587693];return _0x510a1a;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14e8('0x3'));var auth=require(_0x14e8('0x4'));var interaction=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var controller=require(_0x14e8('0x7'));router[_0x14e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14e8('0x8')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xb')]);router[_0x14e8('0x8')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xd')]);router[_0x14e8('0x8')]('/:id/download',auth[_0x14e8('0xa')](),controller[_0x14e8('0xe')]);router[_0x14e8('0xf')]('/',auth[_0x14e8('0xa')](),interaction[_0x14e8('0x10')](_0x14e8('0x11'),_0x14e8('0x12')),controller[_0x14e8('0x13')]);router['put'](_0x14e8('0xc'),auth['isAuthenticated'](),controller[_0x14e8('0x14')]);router[_0x14e8('0x15')](_0x14e8('0x16'),auth['isAuthenticated'](),controller[_0x14e8('0x17')]);router['put'](_0x14e8('0x18'),auth['isAuthenticated'](),controller[_0x14e8('0x19')]);router[_0x14e8('0x1a')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller['destroy']);module[_0x14e8('0x1b')]=router; \ No newline at end of file +var _0xcb91=['faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','index','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','fax'];(function(_0x524f44,_0x274742){var _0x49d3e3=function(_0x17f8e4){while(--_0x17f8e4){_0x524f44['push'](_0x524f44['shift']());}};_0x49d3e3(++_0x274742);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xcb91[_0x48d6a3];return _0x38bfa0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),interaction[_0x1cb9('0xf')](_0x1cb9('0x10'),_0x1cb9('0x11')),controller[_0x1cb9('0x12')]);router[_0x1cb9('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x13')](_0x1cb9('0x14'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x15')]);router['put'](_0x1cb9('0x16'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x17')]);router[_0x1cb9('0x18')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1cb9('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 d2df581..2588d86 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 _0xae32=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2ac25e,_0x2c8fe9){var _0x5c56f0=function(_0x574dc2){while(--_0x574dc2){_0x2ac25e['push'](_0x2ac25e['shift']());}};_0x5c56f0(++_0x2c8fe9);}(_0xae32,0x157));var _0x2ae3=function(_0x111b6e,_0x2b4b0c){_0x111b6e=_0x111b6e-0x0;var _0x3ab48d=_0xae32[_0x111b6e];return _0x3ab48d;};'use strict';var Sequelize=require(_0x2ae3('0x0'));module[_0x2ae3('0x1')]={'name':{'type':Sequelize[_0x2ae3('0x2')],'unique':_0x2ae3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2ae3('0x2')]},'timeout':{'type':Sequelize[_0x2ae3('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2ae3('0x5')](_0x2ae3('0x6'),_0x2ae3('0x7'),_0x2ae3('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2ae3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf5bc=['INTEGER','rrmemory','beepall','roundrobin','STRING'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xf5bc,0x16c));var _0xcf5b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf5bc[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcf5b('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcf5b('0x0')]},'timeout':{'type':Sequelize[_0xcf5b('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcf5b('0x2'),_0xcf5b('0x3'),_0xcf5b('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xcf5b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 3a8ce35..b39bbd6 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 _0x3c49=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','FaxQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','findAll','catch','show','params','keys','fields','include','create','body','user','FaxQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','rows','SIP','getTeams','ids','Team','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','join','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x5c6d14,_0x484e06){var _0x5b3bfe=function(_0x250890){while(--_0x250890){_0x5c6d14['push'](_0x5c6d14['shift']());}};_0x5b3bfe(++_0x484e06);}(_0x3c49,0x185));var _0x93c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x3c49[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require(_0x93c4('0x0'));var rimraf=require(_0x93c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93c4('0x2'));var rp=require(_0x93c4('0x3'));var moment=require(_0x93c4('0x4'));var BPromise=require(_0x93c4('0x5'));var Mustache=require('mustache');var util=require(_0x93c4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x93c4('0x7'));var ejs=require(_0x93c4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93c4('0x9'));var squel=require(_0x93c4('0xa'));var crypto=require('crypto');var jsforce=require(_0x93c4('0xb'));var deskjs=require(_0x93c4('0xc'));var toCsv=require(_0x93c4('0x7'));var querystring=require(_0x93c4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93c4('0xe'));var qs=require(_0x93c4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93c4('0x10'));var logger=require(_0x93c4('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x93c4('0x12'));var db=require(_0x93c4('0x13'))['db'];config[_0x93c4('0x14')]=_[_0x93c4('0x15')](config[_0x93c4('0x14')],{'host':_0x93c4('0x16'),'port':0x18eb});var socket=require(_0x93c4('0x17'))(new Redis(config[_0x93c4('0x14')]));require(_0x93c4('0x18'))['register'](socket);function respondWithStatusCode(_0x587e45,_0x55f1e8){_0x55f1e8=_0x55f1e8||0xcc;return function(_0xa5342f){if(_0xa5342f){return _0x587e45[_0x93c4('0x19')](_0x55f1e8);}return _0x587e45[_0x93c4('0x1a')](_0x55f1e8)[_0x93c4('0x1b')]();};}function respondWithResult(_0x5192cb,_0x241153){_0x241153=_0x241153||0xc8;return function(_0x207c7c){if(_0x207c7c){return _0x5192cb[_0x93c4('0x1a')](_0x241153)[_0x93c4('0x1c')](_0x207c7c);}};}function respondWithFilteredResult(_0x4a008b,_0x29c908){return function(_0x118797){if(_0x118797){var _0x9c4a98=typeof _0x29c908[_0x93c4('0x1d')]===_0x93c4('0x1e')&&typeof _0x29c908[_0x93c4('0x1f')]==='undefined';var _0x2e95f9=_0x118797[_0x93c4('0x20')];var _0x8fb687=_0x9c4a98?0x0:_0x29c908[_0x93c4('0x1d')];var _0x2a45ab=_0x9c4a98?_0x118797['count']:_0x29c908['offset']+_0x29c908[_0x93c4('0x1f')];var _0x516807;if(_0x2a45ab>=_0x2e95f9){_0x2a45ab=_0x2e95f9;_0x516807=0xc8;}else{_0x516807=0xce;}_0x4a008b[_0x93c4('0x1a')](_0x516807);return _0x4a008b['set'](_0x93c4('0x21'),_0x8fb687+'-'+_0x2a45ab+'/'+_0x2e95f9)[_0x93c4('0x1c')](_0x118797);}return null;};}function patchUpdates(_0xedfdbd){return function(_0x1a558c){try{jsonpatch['apply'](_0x1a558c,_0xedfdbd,!![]);}catch(_0x3ba877){return BPromise[_0x93c4('0x22')](_0x3ba877);}return _0x1a558c[_0x93c4('0x23')]();};}function saveUpdates(_0x528693,_0x2d40d6){return function(_0x32983d){if(_0x32983d){return _0x32983d[_0x93c4('0x24')](_0x528693)[_0x93c4('0x25')](function(_0x568d26){return _0x568d26;});}return null;};}function removeEntity(_0x54212b,_0x25908c){return function(_0x101cfc){if(_0x101cfc){return _0x101cfc[_0x93c4('0x26')]()[_0x93c4('0x25')](function(){var _0x4f2f0f=_0x101cfc[_0x93c4('0x27')]({'plain':!![]});var _0x1504a6='FaxQueues';return db[_0x93c4('0x28')][_0x93c4('0x26')]({'where':{'type':_0x1504a6,'resourceId':_0x4f2f0f['id']}})[_0x93c4('0x25')](function(){return _0x101cfc;});})[_0x93c4('0x25')](function(){_0x54212b['status'](0xcc)[_0x93c4('0x1b')]();});}};}function handleEntityNotFound(_0x143ccc,_0x3f1983){return function(_0xed4aef){if(!_0xed4aef){_0x143ccc[_0x93c4('0x19')](0x194);}return _0xed4aef;};}function handleError(_0x1f97de,_0x200136){_0x200136=_0x200136||0x1f4;return function(_0x3e2e87){logger[_0x93c4('0x29')](_0x3e2e87[_0x93c4('0x2a')]);if(_0x3e2e87[_0x93c4('0x2b')]){delete _0x3e2e87[_0x93c4('0x2b')];}_0x1f97de['status'](_0x200136)['send'](_0x3e2e87);};}exports['index']=function(_0x21bf10,_0x2d3555){var _0x140cab={},_0x480f40={},_0x36e241={'count':0x0,'rows':[]};var _0x4f7830=_[_0x93c4('0x2c')](db[_0x93c4('0x2d')][_0x93c4('0x2e')],function(_0x300cde){return{'name':_0x300cde[_0x93c4('0x2f')],'type':_0x300cde['type'][_0x93c4('0x30')]};});_0x480f40[_0x93c4('0x31')]=_[_0x93c4('0x2c')](_0x4f7830,_0x93c4('0x2b'));_0x480f40[_0x93c4('0x32')]=_['keys'](_0x21bf10[_0x93c4('0x32')]);_0x480f40[_0x93c4('0x33')]=_[_0x93c4('0x34')](_0x480f40[_0x93c4('0x31')],_0x480f40[_0x93c4('0x32')]);_0x140cab[_0x93c4('0x35')]=_['intersection'](_0x480f40['model'],qs['fields'](_0x21bf10[_0x93c4('0x32')]['fields']));_0x140cab[_0x93c4('0x35')]=_0x140cab[_0x93c4('0x35')][_0x93c4('0x36')]?_0x140cab['attributes']:_0x480f40[_0x93c4('0x31')];if(!_0x21bf10[_0x93c4('0x32')]['hasOwnProperty'](_0x93c4('0x37'))){_0x140cab[_0x93c4('0x1f')]=qs['limit'](_0x21bf10['query'][_0x93c4('0x1f')]);_0x140cab[_0x93c4('0x1d')]=qs['offset'](_0x21bf10[_0x93c4('0x32')]['offset']);}_0x140cab[_0x93c4('0x38')]=qs[_0x93c4('0x39')](_0x21bf10[_0x93c4('0x32')]['sort']);_0x140cab['where']=qs[_0x93c4('0x33')](_[_0x93c4('0x3a')](_0x21bf10[_0x93c4('0x32')],_0x480f40[_0x93c4('0x33')]),_0x4f7830);if(_0x21bf10[_0x93c4('0x32')]['filter']){_0x140cab[_0x93c4('0x3b')]=_[_0x93c4('0x3c')](_0x140cab['where'],{'$or':_[_0x93c4('0x2c')](_0x4f7830,function(_0x16af81){if(_0x16af81[_0x93c4('0x3d')]!=='VIRTUAL'){var _0x5b3673={};_0x5b3673[_0x16af81['name']]={'$like':'%'+_0x21bf10[_0x93c4('0x32')][_0x93c4('0x3e')]+'%'};return _0x5b3673;}})});}_0x140cab=_[_0x93c4('0x3c')]({},_0x140cab,_0x21bf10[_0x93c4('0x3f')]);var _0x57e067={'where':_0x140cab[_0x93c4('0x3b')]};return db[_0x93c4('0x2d')][_0x93c4('0x20')](_0x57e067)[_0x93c4('0x25')](function(_0x173088){_0x36e241['count']=_0x173088;if(_0x21bf10[_0x93c4('0x32')][_0x93c4('0x40')]){_0x140cab['include']=[{'all':!![]}];}return db[_0x93c4('0x2d')][_0x93c4('0x41')](_0x140cab);})[_0x93c4('0x25')](function(_0x5f0260){_0x36e241['rows']=_0x5f0260;return _0x36e241;})[_0x93c4('0x25')](respondWithFilteredResult(_0x2d3555,_0x140cab))[_0x93c4('0x42')](handleError(_0x2d3555,null));};exports[_0x93c4('0x43')]=function(_0x3245e1,_0x43a830){var _0x5b025e={'raw':!![],'where':{'id':_0x3245e1[_0x93c4('0x44')]['id']}},_0x497575={};_0x497575['model']=_[_0x93c4('0x45')](db[_0x93c4('0x2d')][_0x93c4('0x2e')]);_0x497575[_0x93c4('0x32')]=_[_0x93c4('0x45')](_0x3245e1['query']);_0x497575[_0x93c4('0x33')]=_[_0x93c4('0x34')](_0x497575[_0x93c4('0x31')],_0x497575[_0x93c4('0x32')]);_0x5b025e[_0x93c4('0x35')]=_[_0x93c4('0x34')](_0x497575['model'],qs[_0x93c4('0x46')](_0x3245e1[_0x93c4('0x32')][_0x93c4('0x46')]));_0x5b025e[_0x93c4('0x35')]=_0x5b025e[_0x93c4('0x35')][_0x93c4('0x36')]?_0x5b025e['attributes']:_0x497575[_0x93c4('0x31')];if(_0x3245e1['query'][_0x93c4('0x40')]){_0x5b025e[_0x93c4('0x47')]=[{'all':!![]}];}_0x5b025e=_['merge']({},_0x5b025e,_0x3245e1[_0x93c4('0x3f')]);return db[_0x93c4('0x2d')]['find'](_0x5b025e)['then'](handleEntityNotFound(_0x43a830,null))[_0x93c4('0x25')](respondWithResult(_0x43a830,null))[_0x93c4('0x42')](handleError(_0x43a830,null));};exports[_0x93c4('0x48')]=function(_0xe227b1,_0x55dcf6){return db['FaxQueue'][_0x93c4('0x48')](_0xe227b1[_0x93c4('0x49')],{})[_0x93c4('0x25')](function(_0x5ccddb){var _0x3e4943=_0xe227b1[_0x93c4('0x4a')][_0x93c4('0x27')]({'plain':!![]});if(!_0x3e4943)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e4943['role']===_0x93c4('0x4a')){var _0x2a507d=_0x5ccddb[_0x93c4('0x27')]({'plain':!![]});var _0x132869=_0x93c4('0x4b');return db[_0x93c4('0x4c')][_0x93c4('0x4d')]({'where':{'name':_0x132869,'userProfileId':_0x3e4943[_0x93c4('0x4e')]},'raw':!![]})[_0x93c4('0x25')](function(_0x4b4f93){if(_0x4b4f93&&_0x4b4f93[_0x93c4('0x4f')]===0x0){return db[_0x93c4('0x28')]['create']({'name':_0x2a507d[_0x93c4('0x2b')],'resourceId':_0x2a507d['id'],'type':_0x4b4f93[_0x93c4('0x2b')],'sectionId':_0x4b4f93['id']},{})[_0x93c4('0x25')](function(){return _0x5ccddb;});}else{return _0x5ccddb;}})['catch'](function(_0x9fcff5){logger['error'](_0x93c4('0x50'),_0x9fcff5);throw _0x9fcff5;});}return _0x5ccddb;})[_0x93c4('0x25')](respondWithResult(_0x55dcf6,0xc9))[_0x93c4('0x42')](handleError(_0x55dcf6,null));};exports[_0x93c4('0x24')]=function(_0x220715,_0x2082eb){if(_0x220715['body']['id']){delete _0x220715[_0x93c4('0x49')]['id'];}return db[_0x93c4('0x2d')]['find']({'where':{'id':_0x220715['params']['id']}})[_0x93c4('0x25')](handleEntityNotFound(_0x2082eb,null))['then'](saveUpdates(_0x220715[_0x93c4('0x49')],null))[_0x93c4('0x25')](respondWithResult(_0x2082eb,null))[_0x93c4('0x42')](handleError(_0x2082eb,null));};exports[_0x93c4('0x26')]=function(_0x2be166,_0x1679a6){return db[_0x93c4('0x2d')][_0x93c4('0x4d')]({'where':{'id':_0x2be166[_0x93c4('0x44')]['id']}})[_0x93c4('0x25')](handleEntityNotFound(_0x1679a6,null))[_0x93c4('0x25')](removeEntity(_0x1679a6,null))[_0x93c4('0x42')](handleError(_0x1679a6,null));};exports[_0x93c4('0x51')]=function(_0x506df7,_0x35ce4a){return db[_0x93c4('0x2d')][_0x93c4('0x51')]()[_0x93c4('0x25')](respondWithResult(_0x35ce4a,null))['catch'](handleError(_0x35ce4a,null));};exports[_0x93c4('0x52')]=function(_0x5184b7,_0x1e7cdf,_0x4ac1fd){var _0x456d16={'raw':!![],'where':{}},_0x1652b6={},_0x1e9d52;return db[_0x93c4('0x2d')][_0x93c4('0x53')]({'where':{'id':_0x5184b7['params']['id']}})[_0x93c4('0x25')](handleEntityNotFound(_0x1e7cdf,null))[_0x93c4('0x25')](function(_0x28758a){if(_0x28758a){_0x1e9d52=_0x28758a[_0x93c4('0x27')]({'plain':!![]});_0x1652b6[_0x93c4('0x31')]=_['keys'](db['UserFaxQueue'][_0x93c4('0x2e')]);_0x1652b6[_0x93c4('0x32')]=_[_0x93c4('0x45')](_0x5184b7[_0x93c4('0x32')]);_0x1652b6['filters']=_[_0x93c4('0x34')](_0x1652b6[_0x93c4('0x31')],_0x1652b6['query']);_0x456d16[_0x93c4('0x35')]=_['intersection'](_0x1652b6[_0x93c4('0x31')],qs['fields'](_0x5184b7[_0x93c4('0x32')]['fields']));_0x456d16['attributes']=_0x456d16[_0x93c4('0x35')][_0x93c4('0x36')]?_0x456d16[_0x93c4('0x35')]:_0x1652b6[_0x93c4('0x31')];if(!_0x5184b7[_0x93c4('0x32')][_0x93c4('0x54')](_0x93c4('0x37'))){_0x456d16[_0x93c4('0x1f')]=qs[_0x93c4('0x1f')](_0x5184b7['query'][_0x93c4('0x1f')]);_0x456d16[_0x93c4('0x1d')]=qs['offset'](_0x5184b7[_0x93c4('0x32')]['offset']);}_0x456d16[_0x93c4('0x38')]=qs[_0x93c4('0x39')](_0x5184b7['query'][_0x93c4('0x39')]);_0x456d16[_0x93c4('0x3b')]=qs[_0x93c4('0x33')](_['pick'](_0x5184b7[_0x93c4('0x32')],_0x1652b6[_0x93c4('0x33')]));_0x456d16[_0x93c4('0x3b')][_0x93c4('0x55')]=_0x28758a['id'];if(_0x5184b7[_0x93c4('0x32')][_0x93c4('0x3e')]){_0x456d16[_0x93c4('0x3b')]=_[_0x93c4('0x3c')](_0x456d16[_0x93c4('0x3b')],{'$or':_['map'](_0x456d16[_0x93c4('0x35')],function(_0x1dc24a){var _0x3dbf7e={};_0x3dbf7e[_0x1dc24a]={'$like':'%'+_0x5184b7[_0x93c4('0x32')][_0x93c4('0x3e')]+'%'};return _0x3dbf7e;})});}_0x456d16=_[_0x93c4('0x3c')]({},_0x456d16,_0x5184b7['options']);return db[_0x93c4('0x56')]['findAll'](_0x456d16);}})[_0x93c4('0x25')](function(_0x228c40){if(_0x228c40){return db[_0x93c4('0x57')][_0x93c4('0x58')]({'where':{'id':_[_0x93c4('0x2c')](_0x228c40,_0x93c4('0x59')),'role':'agent'},'attributes':['id','name',_0x93c4('0x5a'),_0x93c4('0x5b'),_0x93c4('0x5c')]});}})[_0x93c4('0x25')](function(_0x5b1991){if(_0x5b1991){return{'count':_0x5b1991[_0x93c4('0x20')],'rows':_[_0x93c4('0x2c')](_0x5b1991[_0x93c4('0x5d')],function(_0x2efc3d){return{'membername':_0x2efc3d['name'],'UserId':_0x2efc3d['id'],'queue_name':_0x1e9d52[_0x93c4('0x2b')],'FaxQueueId':_0x1e9d52['id'],'interface':util['format']('%s/%s',_0x93c4('0x5e'),_0x2efc3d['name']),'penalty':0x0,'paused':_0x2efc3d[_0x93c4('0x5a')],'createdAt':_0x2efc3d[_0x93c4('0x5c')],'updatedAt':_0x2efc3d[_0x93c4('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x93c4('0x25')](respondWithFilteredResult(_0x1e7cdf,_0x456d16))[_0x93c4('0x42')](handleError(_0x1e7cdf,null));};exports[_0x93c4('0x5f')]=function(_0x297816,_0x53c300,_0x4e2aba){var _0x5a8888={};var _0x163b29={};var _0x3c5709;var _0x323884;return db[_0x93c4('0x2d')]['findOne']({'where':{'id':_0x297816[_0x93c4('0x44')]['id']}})[_0x93c4('0x25')](handleEntityNotFound(_0x53c300,null))[_0x93c4('0x25')](function(_0x236050){if(_0x236050){_0x3c5709=_0x236050;_0x163b29['model']=_['keys'](db['Team'][_0x93c4('0x2e')]);_0x163b29[_0x93c4('0x32')]=_['keys'](_0x297816[_0x93c4('0x32')]);_0x163b29[_0x93c4('0x33')]=_[_0x93c4('0x34')](_0x163b29['model'],_0x163b29[_0x93c4('0x32')]);_0x5a8888[_0x93c4('0x35')]=_[_0x93c4('0x34')](_0x163b29[_0x93c4('0x31')],qs[_0x93c4('0x46')](_0x297816[_0x93c4('0x32')][_0x93c4('0x46')]));_0x5a8888[_0x93c4('0x35')]=_0x5a8888[_0x93c4('0x35')][_0x93c4('0x36')]?_0x5a8888[_0x93c4('0x35')]:_0x163b29[_0x93c4('0x31')];_0x5a8888['order']=qs['sort'](_0x297816[_0x93c4('0x32')][_0x93c4('0x39')]);_0x5a8888[_0x93c4('0x3b')]=qs[_0x93c4('0x33')](_[_0x93c4('0x3a')](_0x297816[_0x93c4('0x32')],_0x163b29[_0x93c4('0x33')]));if(_0x297816['query']['filter']){_0x5a8888[_0x93c4('0x3b')]=_['merge'](_0x5a8888[_0x93c4('0x3b')],{'$or':_[_0x93c4('0x2c')](_0x5a8888[_0x93c4('0x35')],function(_0x266d43){var _0x15dc3b={};_0x15dc3b[_0x266d43]={'$like':'%'+_0x297816[_0x93c4('0x32')][_0x93c4('0x3e')]+'%'};return _0x15dc3b;})});}_0x5a8888=_[_0x93c4('0x3c')]({},_0x5a8888,_0x297816[_0x93c4('0x3f')]);return _0x3c5709[_0x93c4('0x5f')](_0x5a8888);}})[_0x93c4('0x25')](function(_0x88cc87){if(_0x88cc87){_0x323884=_0x88cc87['length'];if(!_0x297816[_0x93c4('0x32')][_0x93c4('0x54')]('nolimit')){_0x5a8888[_0x93c4('0x1f')]=qs['limit'](_0x297816[_0x93c4('0x32')][_0x93c4('0x1f')]);_0x5a8888['offset']=qs[_0x93c4('0x1d')](_0x297816[_0x93c4('0x32')]['offset']);}return _0x3c5709[_0x93c4('0x5f')](_0x5a8888);}})[_0x93c4('0x25')](function(_0x5af51d){if(_0x5af51d){return _0x5af51d?{'count':_0x323884,'rows':_0x5af51d}:null;}})[_0x93c4('0x25')](respondWithResult(_0x53c300,null))[_0x93c4('0x42')](handleError(_0x53c300,null));};exports['addTeams']=function(_0x37e72d,_0x5572de,_0x5d74ea){var _0x4aef66=_0x37e72d['body'][_0x93c4('0x60')];return db[_0x93c4('0x61')][_0x93c4('0x41')]({'where':{'id':_0x4aef66},'attributes':['id'],'include':[{'model':db[_0x93c4('0x57')],'as':'Agents','attributes':['id',_0x93c4('0x2b'),_0x93c4('0x62'),_0x93c4('0x63'),_0x93c4('0x64')],'raw':!![]}]})[_0x93c4('0x25')](function(_0x5501cf){if(_0x5501cf){var _0x24a46c=_['flatMap'](_0x5501cf,function(_0x1b8e19){var _0xf04943=_0x1b8e19[_0x93c4('0x27')]({'plain':!![]});return _0xf04943['Agents'];});return db[_0x93c4('0x2d')][_0x93c4('0x4d')]({'where':{'id':_0x37e72d[_0x93c4('0x44')]['id']}})[_0x93c4('0x25')](function(_0x1dca19){return db[_0x93c4('0x65')][_0x93c4('0x66')](function(_0x1eee99){return _0x1dca19['addTeams'](_0x4aef66,{'transaction':_0x1eee99})[_0x93c4('0x25')](function(){return BPromise[_0x93c4('0x67')](_0x24a46c,function(_0x570fd5){return db[_0x93c4('0x56')][_0x93c4('0x68')]({'where':{'UserId':_0x570fd5['id'],'FaxQueueId':_0x37e72d[_0x93c4('0x44')]['id']},'transaction':_0x1eee99});});})['then'](function(){_0x24a46c['forEach'](function(_0x267c3c){socket[_0x93c4('0x69')](_0x93c4('0x6a'),{'UserId':_0x267c3c['id'],'FaxQueueId':_0x1dca19['id']});});});});});}})[_0x93c4('0x25')](respondWithStatusCode(_0x5572de,null))[_0x93c4('0x42')](handleError(_0x5572de,null));};exports[_0x93c4('0x6b')]=function(_0x5c61df,_0x57bc2d,_0x43cfdd){return db['Team'][_0x93c4('0x41')]({'where':{'id':_0x5c61df[_0x93c4('0x32')][_0x93c4('0x60')]},'attributes':['id'],'include':[{'model':db[_0x93c4('0x57')],'as':_0x93c4('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x93c4('0x25')](handleEntityNotFound(_0x57bc2d,null))[_0x93c4('0x25')](function(_0x54a3b0){var _0x41d4df=_[_0x93c4('0x2c')](_0x54a3b0,'id');var _0x87e9d7=[];var _0x586140=[];var _0x53180b=squel[_0x93c4('0x6d')]();_0x53180b[_0x93c4('0x6e')](_0x93c4('0x6f'))[_0x93c4('0x70')]('team_has_fax_queues','tq')[_0x93c4('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x93c4('0x3b')]('FaxQueueId\x20=\x20?',_0x5c61df[_0x93c4('0x44')]['id']);for(var _0x88cb79=0x0;_0x88cb79<_0x54a3b0[_0x93c4('0x36')];_0x88cb79+=0x1){let _0x568288=_0x54a3b0[_0x88cb79];for(var _0x13af04=0x0;_0x13af04<_0x568288[_0x93c4('0x6c')][_0x93c4('0x36')];_0x13af04+=0x1){let _0x1f3fc4=_0x568288['Agents'][_0x13af04];var _0x585b84=_0x53180b['clone']();_0x585b84['where'](_0x93c4('0x72'),_0x1f3fc4['id']);_0x586140[_0x93c4('0x73')](db[_0x93c4('0x65')][_0x93c4('0x32')](_0x585b84[_0x93c4('0x74')](),{'type':db[_0x93c4('0x65')][_0x93c4('0x75')][_0x93c4('0x76')]})[_0x93c4('0x25')](function(_0x40259f){if(_0x40259f[_0x93c4('0x36')]===0x1){return _0x1f3fc4['id'];}else{var _0xda3717=_[_0x93c4('0x77')](_[_0x93c4('0x2c')](_0x40259f,'TeamId'),function(_0x1840e0){return _[_0x93c4('0x78')](_0x41d4df,_0x1840e0);});if(_0xda3717){return _0x1f3fc4['id'];}}}));}}return BPromise[_0x93c4('0x79')](_0x586140)[_0x93c4('0x25')](function(_0x1eeccc){_0x87e9d7=_(_0x87e9d7)['union'](_0x1eeccc)[_0x93c4('0x7a')]()[_0x93c4('0x7b')]();return db[_0x93c4('0x2d')]['find']({'where':{'id':_0x5c61df[_0x93c4('0x44')]['id']}})['then'](function(_0x2c6056){return db[_0x93c4('0x65')][_0x93c4('0x66')](function(_0x39a6a0){return _0x2c6056[_0x93c4('0x6b')](_0x5c61df['query'][_0x93c4('0x60')],{'transaction':_0x39a6a0})[_0x93c4('0x25')](function(){if(!_[_0x93c4('0x7c')](_0x87e9d7)){return _0x2c6056[_0x93c4('0x7d')](_0x87e9d7,{'transaction':_0x39a6a0});}})[_0x93c4('0x25')](function(){_0x87e9d7[_0x93c4('0x7e')](function(_0x4cb6b8){socket[_0x93c4('0x69')](_0x93c4('0x7f'),{'UserId':_0x4cb6b8,'FaxQueueId':_0x2c6056['id']});});});});});});})['then'](respondWithStatusCode(_0x57bc2d,null))[_0x93c4('0x42')](handleError(_0x57bc2d,null));};exports[_0x93c4('0x80')]=function(_0x2e52b3,_0xa99abe,_0x40e56e){return db[_0x93c4('0x2d')][_0x93c4('0x4d')]({'where':{'id':_0x2e52b3[_0x93c4('0x44')]['id']}})[_0x93c4('0x25')](handleEntityNotFound(_0xa99abe,null))[_0x93c4('0x25')](function(_0x276422){if(_0x276422){return _0x276422['addAgents'](_0x2e52b3[_0x93c4('0x49')][_0x93c4('0x60')],_['omit'](_0x2e52b3[_0x93c4('0x49')],[_0x93c4('0x60'),'id'])||{})[_0x93c4('0x81')](function(_0x3e4cbb){for(var _0x5f18e5=0x0;_0x5f18e5<_0x2e52b3[_0x93c4('0x49')][_0x93c4('0x60')][_0x93c4('0x36')];_0x5f18e5+=0x1){socket[_0x93c4('0x69')](_0x93c4('0x6a'),{'UserId':Number(_0x2e52b3['body'][_0x93c4('0x60')][_0x5f18e5]),'FaxQueueId':Number(_0x2e52b3[_0x93c4('0x44')]['id'])});}return _0x3e4cbb;});}})[_0x93c4('0x25')](respondWithResult(_0xa99abe,null))[_0x93c4('0x42')](handleError(_0xa99abe,null));};exports[_0x93c4('0x7d')]=function(_0x2c0ee9,_0x1d12d7,_0x3e3536){return db[_0x93c4('0x2d')][_0x93c4('0x4d')]({'where':{'id':_0x2c0ee9['params']['id']}})[_0x93c4('0x25')](handleEntityNotFound(_0x1d12d7,null))[_0x93c4('0x25')](function(_0x4aba13){if(_0x4aba13){return _0x4aba13[_0x93c4('0x7d')](_0x2c0ee9[_0x93c4('0x32')][_0x93c4('0x60')])[_0x93c4('0x25')](function(){if(_[_0x93c4('0x82')](_0x2c0ee9[_0x93c4('0x32')][_0x93c4('0x60')])){for(var _0x242ec9=0x0;_0x242ec9<_0x2c0ee9[_0x93c4('0x32')][_0x93c4('0x60')][_0x93c4('0x36')];_0x242ec9+=0x1){socket[_0x93c4('0x69')](_0x93c4('0x7f'),{'UserId':Number(_0x2c0ee9[_0x93c4('0x32')]['ids'][_0x242ec9]),'FaxQueueId':Number(_0x2c0ee9[_0x93c4('0x44')]['id'])});}}else{socket[_0x93c4('0x69')]('userFaxQueue:remove',{'UserId':Number(_0x2c0ee9[_0x93c4('0x32')][_0x93c4('0x60')]),'FaxQueueId':Number(_0x2c0ee9[_0x93c4('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d12d7,null))[_0x93c4('0x42')](handleError(_0x1d12d7,null));};exports[_0x93c4('0x83')]=function(_0x100911,_0x35d0e3,_0x2ae0e7){var _0x420e51={};var _0x2b4a3b={};var _0xcc21b5;var _0x356d87;return db[_0x93c4('0x2d')]['findOne']({'where':{'id':_0x100911[_0x93c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x35d0e3,null))['then'](function(_0x56b1ba){if(_0x56b1ba){_0xcc21b5=_0x56b1ba;_0x2b4a3b[_0x93c4('0x31')]=_[_0x93c4('0x45')](db['User'][_0x93c4('0x2e')]);_0x2b4a3b[_0x93c4('0x32')]=_[_0x93c4('0x45')](_0x100911[_0x93c4('0x32')]);_0x2b4a3b[_0x93c4('0x33')]=_[_0x93c4('0x34')](_0x2b4a3b[_0x93c4('0x31')],_0x2b4a3b[_0x93c4('0x32')]);_0x420e51[_0x93c4('0x35')]=_[_0x93c4('0x34')](_0x2b4a3b['model'],qs[_0x93c4('0x46')](_0x100911['query']['fields']));_0x420e51['attributes']=_0x420e51[_0x93c4('0x35')][_0x93c4('0x36')]?_0x420e51[_0x93c4('0x35')]:_0x2b4a3b[_0x93c4('0x31')];_0x420e51[_0x93c4('0x38')]=qs[_0x93c4('0x39')](_0x100911[_0x93c4('0x32')][_0x93c4('0x39')]);_0x420e51['where']=qs[_0x93c4('0x33')](_[_0x93c4('0x3a')](_0x100911[_0x93c4('0x32')],_0x2b4a3b[_0x93c4('0x33')]));if(_0x100911[_0x93c4('0x32')][_0x93c4('0x3e')]){_0x420e51[_0x93c4('0x3b')]=_[_0x93c4('0x3c')](_0x420e51['where'],{'$or':_[_0x93c4('0x2c')](_0x420e51[_0x93c4('0x35')],function(_0x41edc4){var _0x3e69d6={};_0x3e69d6[_0x41edc4]={'$like':'%'+_0x100911[_0x93c4('0x32')][_0x93c4('0x3e')]+'%'};return _0x3e69d6;})});}_0x420e51=_[_0x93c4('0x3c')]({},_0x420e51,_0x100911['options']);return _0xcc21b5['getAgents'](_0x420e51);}})[_0x93c4('0x25')](function(_0x39d093){if(_0x39d093){_0x356d87=_0x39d093[_0x93c4('0x36')];if(!_0x100911[_0x93c4('0x32')][_0x93c4('0x54')](_0x93c4('0x37'))){_0x420e51[_0x93c4('0x1f')]=qs['limit'](_0x100911[_0x93c4('0x32')][_0x93c4('0x1f')]);_0x420e51[_0x93c4('0x1d')]=qs[_0x93c4('0x1d')](_0x100911[_0x93c4('0x32')][_0x93c4('0x1d')]);}return _0xcc21b5['getAgents'](_0x420e51);}})[_0x93c4('0x25')](function(_0x31c646){if(_0x31c646){return _0x31c646?{'count':_0x356d87,'rows':_0x31c646}:null;}})['then'](respondWithResult(_0x35d0e3,null))[_0x93c4('0x42')](handleError(_0x35d0e3,null));}; \ No newline at end of file +var _0xec27=['map','FaxQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','get','FaxQueues','UserProfileResource','destroy','end','sendStatus','stack','name','send','index'];(function(_0x24c15a,_0x261c48){var _0x2a3137=function(_0x25096a){while(--_0x25096a){_0x24c15a['push'](_0x24c15a['shift']());}};_0x2a3137(++_0x261c48);}(_0xec27,0xed));var _0x7ec2=function(_0x4d214f,_0x4a9d72){_0x4d214f=_0x4d214f-0x0;var _0x35d3e0=_0xec27[_0x4d214f];return _0x35d3e0;};'use strict';var emlformat=require(_0x7ec2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7ec2('0x1'));var rp=require(_0x7ec2('0x2'));var moment=require(_0x7ec2('0x3'));var BPromise=require(_0x7ec2('0x4'));var Mustache=require(_0x7ec2('0x5'));var util=require(_0x7ec2('0x6'));var path=require(_0x7ec2('0x7'));var sox=require(_0x7ec2('0x8'));var csv=require(_0x7ec2('0x9'));var ejs=require(_0x7ec2('0xa'));var fs=require('fs');var fs_extra=require(_0x7ec2('0xb'));var _=require(_0x7ec2('0xc'));var squel=require(_0x7ec2('0xd'));var crypto=require(_0x7ec2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7ec2('0xf'));var toCsv=require(_0x7ec2('0x9'));var querystring=require(_0x7ec2('0x10'));var Papa=require(_0x7ec2('0x11'));var Redis=require(_0x7ec2('0x12'));var authService=require(_0x7ec2('0x13'));var qs=require(_0x7ec2('0x14'));var as=require(_0x7ec2('0x15'));var hardwareService=require(_0x7ec2('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7ec2('0x17'));var licenseUtil=require(_0x7ec2('0x18'));var db=require(_0x7ec2('0x19'))['db'];config[_0x7ec2('0x1a')]=_[_0x7ec2('0x1b')](config[_0x7ec2('0x1a')],{'host':_0x7ec2('0x1c'),'port':0x18eb});var socket=require(_0x7ec2('0x1d'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x7ec2('0x1e')](socket);function respondWithStatusCode(_0x3503ab,_0x33357f){_0x33357f=_0x33357f||0xcc;return function(_0x552bdb){if(_0x552bdb){return _0x3503ab['sendStatus'](_0x33357f);}return _0x3503ab['status'](_0x33357f)['end']();};}function respondWithResult(_0x5808de,_0x11eee6){_0x11eee6=_0x11eee6||0xc8;return function(_0x925cd3){if(_0x925cd3){return _0x5808de['status'](_0x11eee6)[_0x7ec2('0x1f')](_0x925cd3);}};}function respondWithFilteredResult(_0x385219,_0x47f46d){return function(_0x42538a){if(_0x42538a){var _0x27655d=typeof _0x47f46d[_0x7ec2('0x20')]===_0x7ec2('0x21')&&typeof _0x47f46d[_0x7ec2('0x22')]==='undefined';var _0x1869f3=_0x42538a[_0x7ec2('0x23')];var _0x2cdb85=_0x27655d?0x0:_0x47f46d[_0x7ec2('0x20')];var _0xde4329=_0x27655d?_0x42538a[_0x7ec2('0x23')]:_0x47f46d[_0x7ec2('0x20')]+_0x47f46d[_0x7ec2('0x22')];var _0x222aa5;if(_0xde4329>=_0x1869f3){_0xde4329=_0x1869f3;_0x222aa5=0xc8;}else{_0x222aa5=0xce;}_0x385219[_0x7ec2('0x24')](_0x222aa5);return _0x385219[_0x7ec2('0x25')](_0x7ec2('0x26'),_0x2cdb85+'-'+_0xde4329+'/'+_0x1869f3)[_0x7ec2('0x1f')](_0x42538a);}return null;};}function patchUpdates(_0x202a18){return function(_0x230673){try{jsonpatch[_0x7ec2('0x27')](_0x230673,_0x202a18,!![]);}catch(_0x56cf52){return BPromise[_0x7ec2('0x28')](_0x56cf52);}return _0x230673[_0x7ec2('0x29')]();};}function saveUpdates(_0xdfd999,_0x1d5f27){return function(_0x23ec46){if(_0x23ec46){return _0x23ec46['update'](_0xdfd999)[_0x7ec2('0x2a')](function(_0x4c354e){return _0x4c354e;});}return null;};}function removeEntity(_0x21c4b4,_0x29853d){return function(_0x4b4499){if(_0x4b4499){return _0x4b4499['destroy']()[_0x7ec2('0x2a')](function(){var _0x23a386=_0x4b4499[_0x7ec2('0x2b')]({'plain':!![]});var _0x31b4fa=_0x7ec2('0x2c');return db[_0x7ec2('0x2d')][_0x7ec2('0x2e')]({'where':{'type':_0x31b4fa,'resourceId':_0x23a386['id']}})[_0x7ec2('0x2a')](function(){return _0x4b4499;});})[_0x7ec2('0x2a')](function(){_0x21c4b4[_0x7ec2('0x24')](0xcc)[_0x7ec2('0x2f')]();});}};}function handleEntityNotFound(_0x1bc4a8,_0x574ce1){return function(_0x23d556){if(!_0x23d556){_0x1bc4a8[_0x7ec2('0x30')](0x194);}return _0x23d556;};}function handleError(_0x599881,_0x109806){_0x109806=_0x109806||0x1f4;return function(_0x1640b5){logger['error'](_0x1640b5[_0x7ec2('0x31')]);if(_0x1640b5['name']){delete _0x1640b5[_0x7ec2('0x32')];}_0x599881[_0x7ec2('0x24')](_0x109806)[_0x7ec2('0x33')](_0x1640b5);};}exports[_0x7ec2('0x34')]=function(_0x3b7a22,_0x49d365){var _0x903b00={},_0x34154a={},_0x1c053c={'count':0x0,'rows':[]};var _0x2c4033=_[_0x7ec2('0x35')](db[_0x7ec2('0x36')][_0x7ec2('0x37')],function(_0x3453a3){return{'name':_0x3453a3[_0x7ec2('0x38')],'type':_0x3453a3[_0x7ec2('0x39')][_0x7ec2('0x3a')]};});_0x34154a[_0x7ec2('0x3b')]=_[_0x7ec2('0x35')](_0x2c4033,_0x7ec2('0x32'));_0x34154a[_0x7ec2('0x3c')]=_['keys'](_0x3b7a22['query']);_0x34154a[_0x7ec2('0x3d')]=_['intersection'](_0x34154a[_0x7ec2('0x3b')],_0x34154a[_0x7ec2('0x3c')]);_0x903b00[_0x7ec2('0x3e')]=_[_0x7ec2('0x3f')](_0x34154a['model'],qs[_0x7ec2('0x40')](_0x3b7a22[_0x7ec2('0x3c')][_0x7ec2('0x40')]));_0x903b00['attributes']=_0x903b00[_0x7ec2('0x3e')][_0x7ec2('0x41')]?_0x903b00[_0x7ec2('0x3e')]:_0x34154a[_0x7ec2('0x3b')];if(!_0x3b7a22[_0x7ec2('0x3c')][_0x7ec2('0x42')](_0x7ec2('0x43'))){_0x903b00[_0x7ec2('0x22')]=qs[_0x7ec2('0x22')](_0x3b7a22['query'][_0x7ec2('0x22')]);_0x903b00['offset']=qs[_0x7ec2('0x20')](_0x3b7a22[_0x7ec2('0x3c')]['offset']);}_0x903b00[_0x7ec2('0x44')]=qs[_0x7ec2('0x45')](_0x3b7a22[_0x7ec2('0x3c')][_0x7ec2('0x45')]);_0x903b00[_0x7ec2('0x46')]=qs['filters'](_[_0x7ec2('0x47')](_0x3b7a22['query'],_0x34154a['filters']),_0x2c4033);if(_0x3b7a22[_0x7ec2('0x3c')][_0x7ec2('0x48')]){_0x903b00[_0x7ec2('0x46')]=_[_0x7ec2('0x49')](_0x903b00[_0x7ec2('0x46')],{'$or':_[_0x7ec2('0x35')](_0x2c4033,function(_0x5f0be4){if(_0x5f0be4[_0x7ec2('0x39')]!==_0x7ec2('0x4a')){var _0x55eaaf={};_0x55eaaf[_0x5f0be4[_0x7ec2('0x32')]]={'$like':'%'+_0x3b7a22[_0x7ec2('0x3c')][_0x7ec2('0x48')]+'%'};return _0x55eaaf;}})});}_0x903b00=_[_0x7ec2('0x49')]({},_0x903b00,_0x3b7a22[_0x7ec2('0x4b')]);var _0x1a9bfa={'where':_0x903b00[_0x7ec2('0x46')]};return db[_0x7ec2('0x36')][_0x7ec2('0x23')](_0x1a9bfa)[_0x7ec2('0x2a')](function(_0x31c6de){_0x1c053c[_0x7ec2('0x23')]=_0x31c6de;if(_0x3b7a22['query'][_0x7ec2('0x4c')]){_0x903b00[_0x7ec2('0x4d')]=[{'all':!![]}];}return db[_0x7ec2('0x36')][_0x7ec2('0x4e')](_0x903b00);})[_0x7ec2('0x2a')](function(_0x2161e8){_0x1c053c[_0x7ec2('0x4f')]=_0x2161e8;return _0x1c053c;})[_0x7ec2('0x2a')](respondWithFilteredResult(_0x49d365,_0x903b00))[_0x7ec2('0x50')](handleError(_0x49d365,null));};exports[_0x7ec2('0x51')]=function(_0x25d485,_0x306da8){var _0x704641={'raw':!![],'where':{'id':_0x25d485[_0x7ec2('0x52')]['id']}},_0x5305fa={};_0x5305fa['model']=_[_0x7ec2('0x53')](db[_0x7ec2('0x36')][_0x7ec2('0x37')]);_0x5305fa[_0x7ec2('0x3c')]=_[_0x7ec2('0x53')](_0x25d485[_0x7ec2('0x3c')]);_0x5305fa[_0x7ec2('0x3d')]=_[_0x7ec2('0x3f')](_0x5305fa['model'],_0x5305fa[_0x7ec2('0x3c')]);_0x704641[_0x7ec2('0x3e')]=_[_0x7ec2('0x3f')](_0x5305fa[_0x7ec2('0x3b')],qs[_0x7ec2('0x40')](_0x25d485[_0x7ec2('0x3c')][_0x7ec2('0x40')]));_0x704641[_0x7ec2('0x3e')]=_0x704641[_0x7ec2('0x3e')][_0x7ec2('0x41')]?_0x704641[_0x7ec2('0x3e')]:_0x5305fa[_0x7ec2('0x3b')];if(_0x25d485[_0x7ec2('0x3c')][_0x7ec2('0x4c')]){_0x704641[_0x7ec2('0x4d')]=[{'all':!![]}];}_0x704641=_[_0x7ec2('0x49')]({},_0x704641,_0x25d485[_0x7ec2('0x4b')]);return db[_0x7ec2('0x36')][_0x7ec2('0x54')](_0x704641)[_0x7ec2('0x2a')](handleEntityNotFound(_0x306da8,null))['then'](respondWithResult(_0x306da8,null))[_0x7ec2('0x50')](handleError(_0x306da8,null));};exports[_0x7ec2('0x55')]=function(_0x572121,_0x24314d){return db[_0x7ec2('0x36')][_0x7ec2('0x55')](_0x572121[_0x7ec2('0x56')],{})[_0x7ec2('0x2a')](function(_0x24dcef){var _0x2eb512=_0x572121[_0x7ec2('0x57')][_0x7ec2('0x2b')]({'plain':!![]});if(!_0x2eb512)throw new Error(_0x7ec2('0x58'));if(_0x2eb512[_0x7ec2('0x59')]===_0x7ec2('0x57')){var _0x27213a=_0x24dcef['get']({'plain':!![]});var _0x54c473='FaxQueues';return db[_0x7ec2('0x5a')][_0x7ec2('0x54')]({'where':{'name':_0x54c473,'userProfileId':_0x2eb512['userProfileId']},'raw':!![]})[_0x7ec2('0x2a')](function(_0x43e740){if(_0x43e740&&_0x43e740[_0x7ec2('0x5b')]===0x0){return db[_0x7ec2('0x2d')][_0x7ec2('0x55')]({'name':_0x27213a[_0x7ec2('0x32')],'resourceId':_0x27213a['id'],'type':_0x43e740[_0x7ec2('0x32')],'sectionId':_0x43e740['id']},{})[_0x7ec2('0x2a')](function(){return _0x24dcef;});}else{return _0x24dcef;}})['catch'](function(_0x34d381){logger[_0x7ec2('0x5c')](_0x7ec2('0x5d'),_0x34d381);throw _0x34d381;});}return _0x24dcef;})[_0x7ec2('0x2a')](respondWithResult(_0x24314d,0xc9))['catch'](handleError(_0x24314d,null));};exports[_0x7ec2('0x5e')]=function(_0x464908,_0xf02f46){if(_0x464908['body']['id']){delete _0x464908[_0x7ec2('0x56')]['id'];}return db[_0x7ec2('0x36')][_0x7ec2('0x54')]({'where':{'id':_0x464908[_0x7ec2('0x52')]['id']}})[_0x7ec2('0x2a')](handleEntityNotFound(_0xf02f46,null))[_0x7ec2('0x2a')](saveUpdates(_0x464908[_0x7ec2('0x56')],null))['then'](respondWithResult(_0xf02f46,null))[_0x7ec2('0x50')](handleError(_0xf02f46,null));};exports['destroy']=function(_0x289649,_0x3e474b){return db[_0x7ec2('0x36')][_0x7ec2('0x54')]({'where':{'id':_0x289649[_0x7ec2('0x52')]['id']}})['then'](handleEntityNotFound(_0x3e474b,null))[_0x7ec2('0x2a')](removeEntity(_0x3e474b,null))['catch'](handleError(_0x3e474b,null));};exports['describe']=function(_0x302513,_0x561580){return db[_0x7ec2('0x36')][_0x7ec2('0x5f')]()['then'](respondWithResult(_0x561580,null))[_0x7ec2('0x50')](handleError(_0x561580,null));};exports[_0x7ec2('0x60')]=function(_0x148a7b,_0x1d38f9,_0x1037ef){var _0xc499b4={'raw':!![],'where':{}},_0x497624={},_0x4cdf3f;return db['FaxQueue'][_0x7ec2('0x61')]({'where':{'id':_0x148a7b[_0x7ec2('0x52')]['id']}})[_0x7ec2('0x2a')](handleEntityNotFound(_0x1d38f9,null))['then'](function(_0x2ad82e){if(_0x2ad82e){_0x4cdf3f=_0x2ad82e[_0x7ec2('0x2b')]({'plain':!![]});_0x497624['model']=_['keys'](db[_0x7ec2('0x62')][_0x7ec2('0x37')]);_0x497624[_0x7ec2('0x3c')]=_[_0x7ec2('0x53')](_0x148a7b['query']);_0x497624[_0x7ec2('0x3d')]=_['intersection'](_0x497624['model'],_0x497624[_0x7ec2('0x3c')]);_0xc499b4[_0x7ec2('0x3e')]=_[_0x7ec2('0x3f')](_0x497624[_0x7ec2('0x3b')],qs[_0x7ec2('0x40')](_0x148a7b[_0x7ec2('0x3c')][_0x7ec2('0x40')]));_0xc499b4['attributes']=_0xc499b4['attributes'][_0x7ec2('0x41')]?_0xc499b4[_0x7ec2('0x3e')]:_0x497624[_0x7ec2('0x3b')];if(!_0x148a7b['query'][_0x7ec2('0x42')]('nolimit')){_0xc499b4[_0x7ec2('0x22')]=qs[_0x7ec2('0x22')](_0x148a7b[_0x7ec2('0x3c')][_0x7ec2('0x22')]);_0xc499b4[_0x7ec2('0x20')]=qs['offset'](_0x148a7b[_0x7ec2('0x3c')][_0x7ec2('0x20')]);}_0xc499b4['order']=qs[_0x7ec2('0x45')](_0x148a7b[_0x7ec2('0x3c')][_0x7ec2('0x45')]);_0xc499b4[_0x7ec2('0x46')]=qs[_0x7ec2('0x3d')](_[_0x7ec2('0x47')](_0x148a7b[_0x7ec2('0x3c')],_0x497624[_0x7ec2('0x3d')]));_0xc499b4['where'][_0x7ec2('0x63')]=_0x2ad82e['id'];if(_0x148a7b[_0x7ec2('0x3c')]['filter']){_0xc499b4[_0x7ec2('0x46')]=_[_0x7ec2('0x49')](_0xc499b4['where'],{'$or':_[_0x7ec2('0x35')](_0xc499b4[_0x7ec2('0x3e')],function(_0x21829a){var _0x4ef264={};_0x4ef264[_0x21829a]={'$like':'%'+_0x148a7b[_0x7ec2('0x3c')][_0x7ec2('0x48')]+'%'};return _0x4ef264;})});}_0xc499b4=_[_0x7ec2('0x49')]({},_0xc499b4,_0x148a7b[_0x7ec2('0x4b')]);return db[_0x7ec2('0x62')][_0x7ec2('0x4e')](_0xc499b4);}})[_0x7ec2('0x2a')](function(_0x1e8e20){if(_0x1e8e20){return db[_0x7ec2('0x64')][_0x7ec2('0x65')]({'where':{'id':_[_0x7ec2('0x35')](_0x1e8e20,'UserId'),'role':_0x7ec2('0x66')},'attributes':['id',_0x7ec2('0x32'),'faxPause',_0x7ec2('0x67'),_0x7ec2('0x68')]});}})[_0x7ec2('0x2a')](function(_0x310960){if(_0x310960){return{'count':_0x310960[_0x7ec2('0x23')],'rows':_[_0x7ec2('0x35')](_0x310960['rows'],function(_0x534928){return{'membername':_0x534928[_0x7ec2('0x32')],'UserId':_0x534928['id'],'queue_name':_0x4cdf3f[_0x7ec2('0x32')],'FaxQueueId':_0x4cdf3f['id'],'interface':util[_0x7ec2('0x69')]('%s/%s',_0x7ec2('0x6a'),_0x534928[_0x7ec2('0x32')]),'penalty':0x0,'paused':_0x534928['faxPause'],'createdAt':_0x534928[_0x7ec2('0x68')],'updatedAt':_0x534928[_0x7ec2('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d38f9,_0xc499b4))['catch'](handleError(_0x1d38f9,null));};exports['getTeams']=function(_0x5c817e,_0x525352,_0x3cb523){var _0x23d875={};var _0x2fd51f={};var _0xacad4a;var _0x4e6bfa;return db[_0x7ec2('0x36')][_0x7ec2('0x61')]({'where':{'id':_0x5c817e['params']['id']}})[_0x7ec2('0x2a')](handleEntityNotFound(_0x525352,null))[_0x7ec2('0x2a')](function(_0x1920a7){if(_0x1920a7){_0xacad4a=_0x1920a7;_0x2fd51f['model']=_[_0x7ec2('0x53')](db[_0x7ec2('0x6b')][_0x7ec2('0x37')]);_0x2fd51f[_0x7ec2('0x3c')]=_[_0x7ec2('0x53')](_0x5c817e['query']);_0x2fd51f[_0x7ec2('0x3d')]=_[_0x7ec2('0x3f')](_0x2fd51f[_0x7ec2('0x3b')],_0x2fd51f['query']);_0x23d875[_0x7ec2('0x3e')]=_['intersection'](_0x2fd51f['model'],qs[_0x7ec2('0x40')](_0x5c817e['query']['fields']));_0x23d875[_0x7ec2('0x3e')]=_0x23d875['attributes'][_0x7ec2('0x41')]?_0x23d875[_0x7ec2('0x3e')]:_0x2fd51f[_0x7ec2('0x3b')];_0x23d875[_0x7ec2('0x44')]=qs[_0x7ec2('0x45')](_0x5c817e[_0x7ec2('0x3c')][_0x7ec2('0x45')]);_0x23d875[_0x7ec2('0x46')]=qs[_0x7ec2('0x3d')](_[_0x7ec2('0x47')](_0x5c817e[_0x7ec2('0x3c')],_0x2fd51f[_0x7ec2('0x3d')]));if(_0x5c817e[_0x7ec2('0x3c')][_0x7ec2('0x48')]){_0x23d875['where']=_[_0x7ec2('0x49')](_0x23d875[_0x7ec2('0x46')],{'$or':_[_0x7ec2('0x35')](_0x23d875[_0x7ec2('0x3e')],function(_0x98cc4){var _0x3b1082={};_0x3b1082[_0x98cc4]={'$like':'%'+_0x5c817e[_0x7ec2('0x3c')][_0x7ec2('0x48')]+'%'};return _0x3b1082;})});}_0x23d875=_[_0x7ec2('0x49')]({},_0x23d875,_0x5c817e[_0x7ec2('0x4b')]);return _0xacad4a[_0x7ec2('0x6c')](_0x23d875);}})['then'](function(_0x1e9df7){if(_0x1e9df7){_0x4e6bfa=_0x1e9df7[_0x7ec2('0x41')];if(!_0x5c817e[_0x7ec2('0x3c')][_0x7ec2('0x42')]('nolimit')){_0x23d875[_0x7ec2('0x22')]=qs[_0x7ec2('0x22')](_0x5c817e[_0x7ec2('0x3c')][_0x7ec2('0x22')]);_0x23d875['offset']=qs[_0x7ec2('0x20')](_0x5c817e[_0x7ec2('0x3c')][_0x7ec2('0x20')]);}return _0xacad4a[_0x7ec2('0x6c')](_0x23d875);}})[_0x7ec2('0x2a')](function(_0x13b214){if(_0x13b214){return _0x13b214?{'count':_0x4e6bfa,'rows':_0x13b214}:null;}})[_0x7ec2('0x2a')](respondWithResult(_0x525352,null))['catch'](handleError(_0x525352,null));};exports[_0x7ec2('0x6d')]=function(_0x55565e,_0x46cc85,_0x6e4d81){var _0x2d572c=_0x55565e[_0x7ec2('0x56')][_0x7ec2('0x6e')];return db['Team'][_0x7ec2('0x4e')]({'where':{'id':_0x2d572c},'attributes':['id'],'include':[{'model':db[_0x7ec2('0x64')],'as':'Agents','attributes':['id',_0x7ec2('0x32'),_0x7ec2('0x6f'),_0x7ec2('0x70'),'interface'],'raw':!![]}]})[_0x7ec2('0x2a')](function(_0x291b73){if(_0x291b73){var _0x630704=_[_0x7ec2('0x71')](_0x291b73,function(_0x351ff3){var _0x363515=_0x351ff3['get']({'plain':!![]});return _0x363515[_0x7ec2('0x72')];});return db[_0x7ec2('0x36')]['find']({'where':{'id':_0x55565e[_0x7ec2('0x52')]['id']}})[_0x7ec2('0x2a')](function(_0x352b2f){return db[_0x7ec2('0x73')][_0x7ec2('0x74')](function(_0x57697f){return _0x352b2f[_0x7ec2('0x6d')](_0x2d572c,{'transaction':_0x57697f})[_0x7ec2('0x2a')](function(){return BPromise['each'](_0x630704,function(_0x9d821a){return db[_0x7ec2('0x62')]['findOrCreate']({'where':{'UserId':_0x9d821a['id'],'FaxQueueId':_0x55565e[_0x7ec2('0x52')]['id']},'transaction':_0x57697f});});})[_0x7ec2('0x2a')](function(){_0x630704[_0x7ec2('0x75')](function(_0x58dd14){socket[_0x7ec2('0x76')]('userFaxQueue:save',{'UserId':_0x58dd14['id'],'FaxQueueId':_0x352b2f['id']});});});});});}})['then'](respondWithStatusCode(_0x46cc85,null))[_0x7ec2('0x50')](handleError(_0x46cc85,null));};exports[_0x7ec2('0x77')]=function(_0x2a72f1,_0x1deda2,_0x3157d3){return db['Team'][_0x7ec2('0x4e')]({'where':{'id':_0x2a72f1[_0x7ec2('0x3c')][_0x7ec2('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7ec2('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1deda2,null))[_0x7ec2('0x2a')](function(_0x40e4ce){var _0x29f590=_[_0x7ec2('0x35')](_0x40e4ce,'id');var _0x59e02d=[];var _0x2e7f19=[];var _0x3a8204=squel[_0x7ec2('0x78')]();_0x3a8204[_0x7ec2('0x79')](_0x7ec2('0x7a'))[_0x7ec2('0x7b')](_0x7ec2('0x7c'),'tq')[_0x7ec2('0x7d')](_0x7ec2('0x7e'),'ut',_0x7ec2('0x7f'))['where'](_0x7ec2('0x80'),_0x2a72f1['params']['id']);for(var _0x564e3e=0x0;_0x564e3e<_0x40e4ce[_0x7ec2('0x41')];_0x564e3e+=0x1){let _0x1c7341=_0x40e4ce[_0x564e3e];for(var _0x3fa504=0x0;_0x3fa504<_0x1c7341[_0x7ec2('0x72')][_0x7ec2('0x41')];_0x3fa504+=0x1){let _0x4fd299=_0x1c7341['Agents'][_0x3fa504];var _0x147a40=_0x3a8204['clone']();_0x147a40[_0x7ec2('0x46')]('ut.UserId\x20=\x20?',_0x4fd299['id']);_0x2e7f19[_0x7ec2('0x81')](db['sequelize'][_0x7ec2('0x3c')](_0x147a40['toString'](),{'type':db[_0x7ec2('0x73')]['QueryTypes'][_0x7ec2('0x82')]})[_0x7ec2('0x2a')](function(_0x178e2c){if(_0x178e2c[_0x7ec2('0x41')]===0x1){return _0x4fd299['id'];}else{var _0x3ab52c=_['every'](_[_0x7ec2('0x35')](_0x178e2c,_0x7ec2('0x83')),function(_0x5c7c54){return _[_0x7ec2('0x84')](_0x29f590,_0x5c7c54);});if(_0x3ab52c){return _0x4fd299['id'];}}}));}}return BPromise[_0x7ec2('0x85')](_0x2e7f19)[_0x7ec2('0x2a')](function(_0x5788ba){_0x59e02d=_(_0x59e02d)[_0x7ec2('0x86')](_0x5788ba)[_0x7ec2('0x87')]()[_0x7ec2('0x88')]();return db[_0x7ec2('0x36')]['find']({'where':{'id':_0x2a72f1[_0x7ec2('0x52')]['id']}})[_0x7ec2('0x2a')](function(_0x214578){return db[_0x7ec2('0x73')][_0x7ec2('0x74')](function(_0x33254e){return _0x214578[_0x7ec2('0x77')](_0x2a72f1[_0x7ec2('0x3c')]['ids'],{'transaction':_0x33254e})[_0x7ec2('0x2a')](function(){if(!_[_0x7ec2('0x89')](_0x59e02d)){return _0x214578[_0x7ec2('0x8a')](_0x59e02d,{'transaction':_0x33254e});}})[_0x7ec2('0x2a')](function(){_0x59e02d['forEach'](function(_0x43922c){socket[_0x7ec2('0x76')](_0x7ec2('0x8b'),{'UserId':_0x43922c,'FaxQueueId':_0x214578['id']});});});});});});})[_0x7ec2('0x2a')](respondWithStatusCode(_0x1deda2,null))['catch'](handleError(_0x1deda2,null));};exports[_0x7ec2('0x8c')]=function(_0x1315c0,_0x541d8e,_0x5b7e4d){return db[_0x7ec2('0x36')][_0x7ec2('0x54')]({'where':{'id':_0x1315c0[_0x7ec2('0x52')]['id']}})['then'](handleEntityNotFound(_0x541d8e,null))[_0x7ec2('0x2a')](function(_0x495c84){if(_0x495c84){return _0x495c84['addAgents'](_0x1315c0[_0x7ec2('0x56')][_0x7ec2('0x6e')],_['omit'](_0x1315c0[_0x7ec2('0x56')],['ids','id'])||{})[_0x7ec2('0x8d')](function(_0x51d340){for(var _0x213826=0x0;_0x213826<_0x1315c0['body']['ids']['length'];_0x213826+=0x1){socket[_0x7ec2('0x76')](_0x7ec2('0x8e'),{'UserId':Number(_0x1315c0['body'][_0x7ec2('0x6e')][_0x213826]),'FaxQueueId':Number(_0x1315c0[_0x7ec2('0x52')]['id'])});}return _0x51d340;});}})[_0x7ec2('0x2a')](respondWithResult(_0x541d8e,null))['catch'](handleError(_0x541d8e,null));};exports[_0x7ec2('0x8a')]=function(_0x3b1290,_0x1772c4,_0x5b4e45){return db[_0x7ec2('0x36')]['find']({'where':{'id':_0x3b1290['params']['id']}})[_0x7ec2('0x2a')](handleEntityNotFound(_0x1772c4,null))[_0x7ec2('0x2a')](function(_0x3611e4){if(_0x3611e4){return _0x3611e4[_0x7ec2('0x8a')](_0x3b1290[_0x7ec2('0x3c')]['ids'])[_0x7ec2('0x2a')](function(){if(_[_0x7ec2('0x8f')](_0x3b1290[_0x7ec2('0x3c')]['ids'])){for(var _0x2d1e4c=0x0;_0x2d1e4c<_0x3b1290[_0x7ec2('0x3c')][_0x7ec2('0x6e')]['length'];_0x2d1e4c+=0x1){socket[_0x7ec2('0x76')](_0x7ec2('0x8b'),{'UserId':Number(_0x3b1290['query']['ids'][_0x2d1e4c]),'FaxQueueId':Number(_0x3b1290[_0x7ec2('0x52')]['id'])});}}else{socket['emit'](_0x7ec2('0x8b'),{'UserId':Number(_0x3b1290[_0x7ec2('0x3c')]['ids']),'FaxQueueId':Number(_0x3b1290[_0x7ec2('0x52')]['id'])});}});}})[_0x7ec2('0x2a')](respondWithStatusCode(_0x1772c4,null))[_0x7ec2('0x50')](handleError(_0x1772c4,null));};exports[_0x7ec2('0x90')]=function(_0x4ca558,_0x404e52,_0x2e9c23){var _0x2a17a8={};var _0x5d680f={};var _0x22e93b;var _0x316761;return db[_0x7ec2('0x36')]['findOne']({'where':{'id':_0x4ca558['params']['id']}})[_0x7ec2('0x2a')](handleEntityNotFound(_0x404e52,null))[_0x7ec2('0x2a')](function(_0x6ead24){if(_0x6ead24){_0x22e93b=_0x6ead24;_0x5d680f[_0x7ec2('0x3b')]=_['keys'](db[_0x7ec2('0x64')]['rawAttributes']);_0x5d680f['query']=_[_0x7ec2('0x53')](_0x4ca558['query']);_0x5d680f['filters']=_[_0x7ec2('0x3f')](_0x5d680f[_0x7ec2('0x3b')],_0x5d680f['query']);_0x2a17a8[_0x7ec2('0x3e')]=_[_0x7ec2('0x3f')](_0x5d680f['model'],qs['fields'](_0x4ca558[_0x7ec2('0x3c')][_0x7ec2('0x40')]));_0x2a17a8['attributes']=_0x2a17a8[_0x7ec2('0x3e')][_0x7ec2('0x41')]?_0x2a17a8[_0x7ec2('0x3e')]:_0x5d680f['model'];_0x2a17a8[_0x7ec2('0x44')]=qs[_0x7ec2('0x45')](_0x4ca558['query'][_0x7ec2('0x45')]);_0x2a17a8[_0x7ec2('0x46')]=qs[_0x7ec2('0x3d')](_['pick'](_0x4ca558['query'],_0x5d680f[_0x7ec2('0x3d')]));if(_0x4ca558['query']['filter']){_0x2a17a8[_0x7ec2('0x46')]=_[_0x7ec2('0x49')](_0x2a17a8[_0x7ec2('0x46')],{'$or':_[_0x7ec2('0x35')](_0x2a17a8[_0x7ec2('0x3e')],function(_0x2ae714){var _0xb04cf2={};_0xb04cf2[_0x2ae714]={'$like':'%'+_0x4ca558[_0x7ec2('0x3c')][_0x7ec2('0x48')]+'%'};return _0xb04cf2;})});}_0x2a17a8=_['merge']({},_0x2a17a8,_0x4ca558['options']);return _0x22e93b['getAgents'](_0x2a17a8);}})[_0x7ec2('0x2a')](function(_0x1b4bab){if(_0x1b4bab){_0x316761=_0x1b4bab[_0x7ec2('0x41')];if(!_0x4ca558[_0x7ec2('0x3c')][_0x7ec2('0x42')](_0x7ec2('0x43'))){_0x2a17a8[_0x7ec2('0x22')]=qs[_0x7ec2('0x22')](_0x4ca558[_0x7ec2('0x3c')][_0x7ec2('0x22')]);_0x2a17a8[_0x7ec2('0x20')]=qs[_0x7ec2('0x20')](_0x4ca558[_0x7ec2('0x3c')][_0x7ec2('0x20')]);}return _0x22e93b[_0x7ec2('0x90')](_0x2a17a8);}})[_0x7ec2('0x2a')](function(_0xed9ce8){if(_0xed9ce8){return _0xed9ce8?{'count':_0x316761,'rows':_0xed9ce8}:null;}})['then'](respondWithResult(_0x404e52,null))[_0x7ec2('0x50')](handleError(_0x404e52,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 297d7b0..d5a0048 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 _0x9193=['update','remove','emit','hasOwnProperty','exports','events','FaxQueue','setMaxListeners','save'];(function(_0x2ca346,_0x1878fd){var _0x2c1691=function(_0x4d7129){while(--_0x4d7129){_0x2ca346['push'](_0x2ca346['shift']());}};_0x2c1691(++_0x1878fd);}(_0x9193,0xb0));var _0x3919=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x9193[_0x10dbf6];return _0x452147;};'use strict';var EventEmitter=require(_0x3919('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x3919('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3919('0x2')](0x0);var events={'afterCreate':_0x3919('0x3'),'afterUpdate':_0x3919('0x4'),'afterDestroy':_0x3919('0x5')};function emitEvent(_0x147fa1){return function(_0x1c0cea,_0x475e7b,_0x3f273a){FaxQueueEvents[_0x3919('0x6')](_0x147fa1+':'+_0x1c0cea['id'],_0x1c0cea);FaxQueueEvents[_0x3919('0x6')](_0x147fa1,_0x1c0cea);_0x3f273a(null);};}for(var e in events){if(events[_0x3919('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x3919('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x99a2=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x441b6f,_0x104a4d){var _0xaf8af2=function(_0x1885cf){while(--_0x1885cf){_0x441b6f['push'](_0x441b6f['shift']());}};_0xaf8af2(++_0x104a4d);}(_0x99a2,0x1e7));var _0x299a=function(_0x57d0be,_0x46451d){_0x57d0be=_0x57d0be-0x0;var _0x529492=_0x99a2[_0x57d0be];return _0x529492;};'use strict';var EventEmitter=require(_0x299a('0x0'));var FaxQueue=require(_0x299a('0x1'))['db'][_0x299a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x299a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x299a('0x4')};function emitEvent(_0x4c6cfe){return function(_0x3f2129,_0x42dd26,_0x2dd3d7){FaxQueueEvents[_0x299a('0x5')](_0x4c6cfe+':'+_0x3f2129['id'],_0x3f2129);FaxQueueEvents[_0x299a('0x5')](_0x4c6cfe,_0x3f2129);_0x2dd3d7(null);};}for(var e in events){if(events[_0x299a('0x6')](e)){var event=events[e];FaxQueue[_0x299a('0x7')](e,emitEvent(event));}}module[_0x299a('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 8141db5..b89d7bc 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 _0xde90=['path','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c7c31,_0x47d8f6){var _0x594e81=function(_0x587ab8){while(--_0x587ab8){_0x1c7c31['push'](_0x1c7c31['shift']());}};_0x594e81(++_0x47d8f6);}(_0xde90,0x1a9));var _0x0de9=function(_0x29cb9b,_0x247dd1){_0x29cb9b=_0x29cb9b-0x0;var _0x544ff3=_0xde90[_0x29cb9b];return _0x544ff3;};'use strict';var _=require(_0x0de9('0x0'));var util=require(_0x0de9('0x1'));var logger=require(_0x0de9('0x2'))(_0x0de9('0x3'));var moment=require(_0x0de9('0x4'));var BPromise=require(_0x0de9('0x5'));var rp=require(_0x0de9('0x6'));var fs=require('fs');var path=require(_0x0de9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x0de9('0x8')]=function(_0x2ae912,_0x214849){return _0x2ae912[_0x0de9('0x9')](_0x0de9('0xa'),attributes,{'tableName':_0x0de9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa42b=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x137de9,_0x29acca){var _0xb3d1a5=function(_0x493282){while(--_0x493282){_0x137de9['push'](_0x137de9['shift']());}};_0xb3d1a5(++_0x29acca);}(_0xa42b,0x66));var _0xba42=function(_0x5acb5c,_0x2a9758){_0x5acb5c=_0x5acb5c-0x0;var _0x1a9d75=_0xa42b[_0x5acb5c];return _0x1a9d75;};'use strict';var _=require(_0xba42('0x0'));var util=require(_0xba42('0x1'));var logger=require(_0xba42('0x2'))(_0xba42('0x3'));var moment=require('moment');var BPromise=require(_0xba42('0x4'));var rp=require(_0xba42('0x5'));var fs=require('fs');var path=require(_0xba42('0x6'));var rimraf=require(_0xba42('0x7'));var config=require(_0xba42('0x8'));var attributes=require(_0xba42('0x9'));module[_0xba42('0xa')]=function(_0x3cbf8c,_0x4886c3){return _0x3cbf8c[_0xba42('0xb')](_0xba42('0xc'),attributes,{'tableName':_0xba42('0xd'),'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 113c7de..0e20b09 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 _0xb9cc=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb9cc,0x132));var _0xcb9c=function(_0x3976ff,_0x13e902){_0x3976ff=_0x3976ff-0x0;var _0x5da2bd=_0xb9cc[_0x3976ff];return _0x5da2bd;};'use strict';var _=require(_0xcb9c('0x0'));var util=require(_0xcb9c('0x1'));var moment=require(_0xcb9c('0x2'));var BPromise=require(_0xcb9c('0x3'));var rs=require(_0xcb9c('0x4'));var fs=require('fs');var Redis=require(_0xcb9c('0x5'));var db=require(_0xcb9c('0x6'))['db'];var utils=require(_0xcb9c('0x7'));var logger=require('../../config/logger')(_0xcb9c('0x8'));var config=require(_0xcb9c('0x9'));var jayson=require(_0xcb9c('0xa'));var client=jayson[_0xcb9c('0xb')]['http']({'port':0x232a});config[_0xcb9c('0xc')]=_[_0xcb9c('0xd')](config[_0xcb9c('0xc')],{'host':_0xcb9c('0xe'),'port':0x18eb});var socket=require(_0xcb9c('0xf'))(new Redis(config[_0xcb9c('0xc')]));require(_0xcb9c('0x10'))['register'](socket);function respondWithRpcPromise(_0x3a37ad,_0x58a549,_0x5f1de9){return new BPromise(function(_0x8c30d4,_0x76eb3f){return client[_0xcb9c('0x11')](_0x3a37ad,_0x5f1de9)[_0xcb9c('0x12')](function(_0x28b76a){logger[_0xcb9c('0x13')](_0xcb9c('0x14'),_0x58a549,_0xcb9c('0x15'));logger[_0xcb9c('0x16')](_0xcb9c('0x17'),_0x58a549,'request\x20sent',JSON[_0xcb9c('0x18')](_0x28b76a));if(_0x28b76a[_0xcb9c('0x19')]){if(_0x28b76a['error']['code']===0x1f4){logger['error'](_0xcb9c('0x14'),_0x58a549,_0x28b76a[_0xcb9c('0x19')][_0xcb9c('0x1a')]);return _0x76eb3f(_0x28b76a[_0xcb9c('0x19')]['message']);}logger[_0xcb9c('0x19')]('FaxQueue,\x20%s,\x20%s',_0x58a549,_0x28b76a[_0xcb9c('0x19')][_0xcb9c('0x1a')]);return _0x8c30d4(_0x28b76a[_0xcb9c('0x19')][_0xcb9c('0x1a')]);}else{logger[_0xcb9c('0x13')](_0xcb9c('0x14'),_0x58a549,'request\x20sent');_0x8c30d4(_0x28b76a[_0xcb9c('0x1b')]['message']);}})['catch'](function(_0x11922b){logger['error'](_0xcb9c('0x14'),_0x58a549,_0x11922b);_0x76eb3f(_0x11922b);});});}exports[_0xcb9c('0x1c')]=function(_0x4414ad){var _0x71e54f=this;return new Promise(function(_0x4ccb8e,_0x2b0ac7){return db[_0xcb9c('0x1d')]['findAll']({'raw':_0x4414ad[_0xcb9c('0x1e')]?_0x4414ad['options'][_0xcb9c('0x1f')]===undefined?!![]:![]:!![],'where':_0x4414ad[_0xcb9c('0x1e')]?_0x4414ad[_0xcb9c('0x1e')][_0xcb9c('0x20')]||null:null,'attributes':_0x4414ad[_0xcb9c('0x1e')]?_0x4414ad[_0xcb9c('0x1e')][_0xcb9c('0x21')]||null:null,'limit':_0x4414ad['options']?_0x4414ad[_0xcb9c('0x1e')][_0xcb9c('0x22')]||null:null,'include':_0x4414ad[_0xcb9c('0x1e')]?_0x4414ad['options']['include']?_[_0xcb9c('0x23')](_0x4414ad[_0xcb9c('0x1e')][_0xcb9c('0x24')],function(_0x5e0a97){return{'model':db[_0x5e0a97[_0xcb9c('0x25')]],'as':_0x5e0a97['as'],'attributes':_0x5e0a97['attributes'],'include':_0x5e0a97[_0xcb9c('0x24')]?_[_0xcb9c('0x23')](_0x5e0a97[_0xcb9c('0x24')],function(_0x1bace7){return{'model':db[_0x1bace7[_0xcb9c('0x25')]],'as':_0x1bace7['as'],'attributes':_0x1bace7[_0xcb9c('0x21')],'include':_0x1bace7[_0xcb9c('0x24')]?_[_0xcb9c('0x23')](_0x1bace7[_0xcb9c('0x24')],function(_0x41dd02){return{'model':db[_0x41dd02[_0xcb9c('0x25')]],'as':_0x41dd02['as'],'attributes':_0x41dd02[_0xcb9c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcb9c('0x12')](function(_0x227e8a){logger['info'](_0xcb9c('0x1c'),_0x4414ad);logger[_0xcb9c('0x16')](_0xcb9c('0x1c'),_0x4414ad,JSON[_0xcb9c('0x18')](_0x227e8a));_0x4ccb8e(_0x227e8a);})[_0xcb9c('0x26')](function(_0x210fb3){logger[_0xcb9c('0x19')](_0xcb9c('0x1c'),_0x210fb3['message'],_0x4414ad);_0x2b0ac7(_0x71e54f[_0xcb9c('0x19')](0x1f4,_0x210fb3[_0xcb9c('0x1a')]));});});};exports[_0xcb9c('0x27')]=function(_0x5a7543){var _0xba6d62=this;return new Promise(function(_0x522650,_0x345325){return db[_0xcb9c('0x1d')][_0xcb9c('0x28')]({'raw':_0x5a7543[_0xcb9c('0x1e')]?_0x5a7543[_0xcb9c('0x1e')][_0xcb9c('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a7543['options']?_0x5a7543[_0xcb9c('0x1e')][_0xcb9c('0x20')]||null:null,'attributes':_0x5a7543[_0xcb9c('0x1e')]?_0x5a7543[_0xcb9c('0x1e')][_0xcb9c('0x21')]||null:null,'include':_0x5a7543[_0xcb9c('0x1e')]?_0x5a7543['options'][_0xcb9c('0x24')]?_['map'](_0x5a7543[_0xcb9c('0x1e')][_0xcb9c('0x24')],function(_0x40d199){return{'model':db[_0x40d199[_0xcb9c('0x25')]],'as':_0x40d199['as'],'attributes':_0x40d199[_0xcb9c('0x21')],'include':_0x40d199[_0xcb9c('0x24')]?_[_0xcb9c('0x23')](_0x40d199[_0xcb9c('0x24')],function(_0x31bd76){return{'model':db[_0x31bd76[_0xcb9c('0x25')]],'as':_0x31bd76['as'],'attributes':_0x31bd76[_0xcb9c('0x21')],'include':_0x31bd76[_0xcb9c('0x24')]?_[_0xcb9c('0x23')](_0x31bd76[_0xcb9c('0x24')],function(_0x1fdf68){return{'model':db[_0x1fdf68[_0xcb9c('0x25')]],'as':_0x1fdf68['as'],'attributes':_0x1fdf68[_0xcb9c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcb9c('0x12')](function(_0x1bd1f9){logger[_0xcb9c('0x13')](_0xcb9c('0x27'),_0x5a7543);logger['debug'](_0xcb9c('0x27'),_0x5a7543,JSON['stringify'](_0x1bd1f9));_0x522650(_0x1bd1f9);})[_0xcb9c('0x26')](function(_0x5d8758){logger['error'](_0xcb9c('0x27'),_0x5d8758[_0xcb9c('0x1a')],_0x5a7543);_0x345325(_0xba6d62['error'](0x1f4,_0x5d8758[_0xcb9c('0x1a')]));});});}; \ No newline at end of file +var _0xeab8=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','ShowFaxQueue','find','where','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x248992,_0x553fe7){var _0x18545d=function(_0x474e9c){while(--_0x474e9c){_0x248992['push'](_0x248992['shift']());}};_0x18545d(++_0x553fe7);}(_0xeab8,0xec));var _0x8eab=function(_0x31643d,_0x5506cf){_0x31643d=_0x31643d-0x0;var _0xe7b074=_0xeab8[_0x31643d];return _0xe7b074;};'use strict';var _=require(_0x8eab('0x0'));var util=require(_0x8eab('0x1'));var moment=require('moment');var BPromise=require(_0x8eab('0x2'));var rs=require(_0x8eab('0x3'));var fs=require('fs');var Redis=require(_0x8eab('0x4'));var db=require(_0x8eab('0x5'))['db'];var utils=require(_0x8eab('0x6'));var logger=require(_0x8eab('0x7'))(_0x8eab('0x8'));var config=require('../../config/environment');var jayson=require(_0x8eab('0x9'));var client=jayson[_0x8eab('0xa')][_0x8eab('0xb')]({'port':0x232a});config[_0x8eab('0xc')]=_[_0x8eab('0xd')](config[_0x8eab('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8eab('0xe'))(new Redis(config[_0x8eab('0xc')]));require(_0x8eab('0xf'))[_0x8eab('0x10')](socket);function respondWithRpcPromise(_0x1b7f57,_0x5b844c,_0x13efa9){return new BPromise(function(_0x5b9f25,_0x4ed1d1){return client[_0x8eab('0x11')](_0x1b7f57,_0x13efa9)[_0x8eab('0x12')](function(_0x557d28){logger[_0x8eab('0x13')](_0x8eab('0x14'),_0x5b844c,_0x8eab('0x15'));logger[_0x8eab('0x16')](_0x8eab('0x17'),_0x5b844c,_0x8eab('0x15'),JSON[_0x8eab('0x18')](_0x557d28));if(_0x557d28[_0x8eab('0x19')]){if(_0x557d28[_0x8eab('0x19')][_0x8eab('0x1a')]===0x1f4){logger[_0x8eab('0x19')](_0x8eab('0x14'),_0x5b844c,_0x557d28[_0x8eab('0x19')][_0x8eab('0x1b')]);return _0x4ed1d1(_0x557d28['error'][_0x8eab('0x1b')]);}logger[_0x8eab('0x19')](_0x8eab('0x14'),_0x5b844c,_0x557d28['error'][_0x8eab('0x1b')]);return _0x5b9f25(_0x557d28['error'][_0x8eab('0x1b')]);}else{logger[_0x8eab('0x13')](_0x8eab('0x14'),_0x5b844c,'request\x20sent');_0x5b9f25(_0x557d28[_0x8eab('0x1c')]['message']);}})[_0x8eab('0x1d')](function(_0x4f0036){logger['error'](_0x8eab('0x14'),_0x5b844c,_0x4f0036);_0x4ed1d1(_0x4f0036);});});}exports[_0x8eab('0x1e')]=function(_0x57eccf){var _0x34b5a0=this;return new Promise(function(_0x310999,_0x5b0a45){return db[_0x8eab('0x1f')][_0x8eab('0x20')]({'raw':_0x57eccf['options']?_0x57eccf[_0x8eab('0x21')][_0x8eab('0x22')]===undefined?!![]:![]:!![],'where':_0x57eccf[_0x8eab('0x21')]?_0x57eccf[_0x8eab('0x21')]['where']||null:null,'attributes':_0x57eccf[_0x8eab('0x21')]?_0x57eccf[_0x8eab('0x21')][_0x8eab('0x23')]||null:null,'limit':_0x57eccf[_0x8eab('0x21')]?_0x57eccf[_0x8eab('0x21')][_0x8eab('0x24')]||null:null,'include':_0x57eccf[_0x8eab('0x21')]?_0x57eccf[_0x8eab('0x21')][_0x8eab('0x25')]?_[_0x8eab('0x26')](_0x57eccf['options'][_0x8eab('0x25')],function(_0x151241){return{'model':db[_0x151241['model']],'as':_0x151241['as'],'attributes':_0x151241[_0x8eab('0x23')],'include':_0x151241['include']?_[_0x8eab('0x26')](_0x151241[_0x8eab('0x25')],function(_0x2a257f){return{'model':db[_0x2a257f['model']],'as':_0x2a257f['as'],'attributes':_0x2a257f[_0x8eab('0x23')],'include':_0x2a257f[_0x8eab('0x25')]?_[_0x8eab('0x26')](_0x2a257f['include'],function(_0x5e4b09){return{'model':db[_0x5e4b09['model']],'as':_0x5e4b09['as'],'attributes':_0x5e4b09[_0x8eab('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8eab('0x12')](function(_0x28265f){logger['info']('GetFaxQueue',_0x57eccf);logger[_0x8eab('0x16')]('GetFaxQueue',_0x57eccf,JSON[_0x8eab('0x18')](_0x28265f));_0x310999(_0x28265f);})[_0x8eab('0x1d')](function(_0x1b74a3){logger[_0x8eab('0x19')](_0x8eab('0x1e'),_0x1b74a3[_0x8eab('0x1b')],_0x57eccf);_0x5b0a45(_0x34b5a0[_0x8eab('0x19')](0x1f4,_0x1b74a3[_0x8eab('0x1b')]));});});};exports[_0x8eab('0x27')]=function(_0x2c6443){var _0x4a57f6=this;return new Promise(function(_0x19ce0a,_0x183ca7){return db[_0x8eab('0x1f')][_0x8eab('0x28')]({'raw':_0x2c6443[_0x8eab('0x21')]?_0x2c6443[_0x8eab('0x21')][_0x8eab('0x22')]===undefined?!![]:![]:!![],'where':_0x2c6443['options']?_0x2c6443['options'][_0x8eab('0x29')]||null:null,'attributes':_0x2c6443[_0x8eab('0x21')]?_0x2c6443[_0x8eab('0x21')][_0x8eab('0x23')]||null:null,'include':_0x2c6443['options']?_0x2c6443[_0x8eab('0x21')][_0x8eab('0x25')]?_[_0x8eab('0x26')](_0x2c6443[_0x8eab('0x21')][_0x8eab('0x25')],function(_0x4fae7a){return{'model':db[_0x4fae7a['model']],'as':_0x4fae7a['as'],'attributes':_0x4fae7a[_0x8eab('0x23')],'include':_0x4fae7a[_0x8eab('0x25')]?_[_0x8eab('0x26')](_0x4fae7a[_0x8eab('0x25')],function(_0x143ea5){return{'model':db[_0x143ea5[_0x8eab('0x2a')]],'as':_0x143ea5['as'],'attributes':_0x143ea5[_0x8eab('0x23')],'include':_0x143ea5[_0x8eab('0x25')]?_['map'](_0x143ea5[_0x8eab('0x25')],function(_0x3b4cba){return{'model':db[_0x3b4cba['model']],'as':_0x3b4cba['as'],'attributes':_0x3b4cba[_0x8eab('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8eab('0x12')](function(_0x465c3b){logger['info'](_0x8eab('0x27'),_0x2c6443);logger[_0x8eab('0x16')](_0x8eab('0x27'),_0x2c6443,JSON[_0x8eab('0x18')](_0x465c3b));_0x19ce0a(_0x465c3b);})[_0x8eab('0x1d')](function(_0x4f583a){logger[_0x8eab('0x19')](_0x8eab('0x27'),_0x4f583a[_0x8eab('0x1b')],_0x2c6443);_0x183ca7(_0x4a57f6[_0x8eab('0x19')](0x1f4,_0x4f583a[_0x8eab('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 50b42d8..a4c564d 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 _0x0869=['./faxQueue.events','save','remove','update','emit','removeListener','faxQueue:'];(function(_0x39bdfc,_0x246044){var _0x15c434=function(_0x489a16){while(--_0x489a16){_0x39bdfc['push'](_0x39bdfc['shift']());}};_0x15c434(++_0x246044);}(_0x0869,0xaf));var _0x9086=function(_0x3094db,_0x1a7940){_0x3094db=_0x3094db-0x0;var _0x2a8acc=_0x0869[_0x3094db];return _0x2a8acc;};'use strict';var FaxQueueEvents=require(_0x9086('0x0'));var events=[_0x9086('0x1'),_0x9086('0x2'),_0x9086('0x3')];function createListener(_0x4fbbfd,_0x3f31d1){return function(_0x12f93d){_0x3f31d1[_0x9086('0x4')](_0x4fbbfd,_0x12f93d);};}function removeListener(_0x37489e,_0x3d48f7){return function(){FaxQueueEvents[_0x9086('0x5')](_0x37489e,_0x3d48f7);};}exports['register']=function(_0x330294){for(var _0x3bd9f3=0x0,_0xa40833=events['length'];_0x3bd9f3<_0xa40833;_0x3bd9f3++){var _0x232e7f=events[_0x3bd9f3];var _0x50abce=createListener(_0x9086('0x6')+_0x232e7f,_0x330294);FaxQueueEvents['on'](_0x232e7f,_0x50abce);}}; \ No newline at end of file +var _0x30ff=['length','save','remove','update','emit','removeListener','register'];(function(_0x548a20,_0x2ae8ef){var _0x58bdb1=function(_0xe8aa4b){while(--_0xe8aa4b){_0x548a20['push'](_0x548a20['shift']());}};_0x58bdb1(++_0x2ae8ef);}(_0x30ff,0x6a));var _0xf30f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x30ff[_0x502c7d];return _0x30b7ed;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf30f('0x0'),_0xf30f('0x1'),_0xf30f('0x2')];function createListener(_0x2ba1d5,_0xf93709){return function(_0x5cec8b){_0xf93709[_0xf30f('0x3')](_0x2ba1d5,_0x5cec8b);};}function removeListener(_0x3c0a39,_0x52d716){return function(){FaxQueueEvents[_0xf30f('0x4')](_0x3c0a39,_0x52d716);};}exports[_0xf30f('0x5')]=function(_0x1884e6){for(var _0x4eeee8=0x0,_0x2c95ba=events[_0xf30f('0x6')];_0x4eeee8<_0x2c95ba;_0x4eeee8++){var _0x1a1fc0=events[_0x4eeee8];var _0x398805=createListener('faxQueue:'+_0x1a1fc0,_0x1884e6);FaxQueueEvents['on'](_0x1a1fc0,_0x398805);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 741bf3b..2a5e6d9 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 _0x9b0d=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams'];(function(_0x3dde31,_0x2a5a03){var _0x421e58=function(_0x2b763d){while(--_0x2b763d){_0x3dde31['push'](_0x3dde31['shift']());}};_0x421e58(++_0x2a5a03);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x5eec96,_0x4f8849){_0x5eec96=_0x5eec96-0x0;var _0x19930e=_0x9b0d[_0x5eec96];return _0x19930e;};'use strict';var multer=require('multer');var util=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var timeout=require(_0xd9b0('0x2'));var express=require(_0xd9b0('0x3'));var router=express['Router']();var fs_extra=require(_0xd9b0('0x4'));var auth=require(_0xd9b0('0x5'));var interaction=require(_0xd9b0('0x6'));var config=require(_0xd9b0('0x7'));var controller=require('./faxQueue.controller');router[_0xd9b0('0x8')]('/',auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xa')]);router[_0xd9b0('0x8')](_0xd9b0('0xb'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xc')]);router['get'](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['show']);router[_0xd9b0('0x8')]('/:id/members',auth[_0xd9b0('0x9')](),controller['getMembers']);router[_0xd9b0('0x8')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xf')]);router[_0xd9b0('0x8')](_0xd9b0('0x10'),auth['isAuthenticated'](),controller[_0xd9b0('0x11')]);router[_0xd9b0('0x12')]('/',auth['isAuthenticated'](),controller[_0xd9b0('0x13')]);router[_0xd9b0('0x12')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x14')]);router[_0xd9b0('0x12')]('/:id/users',auth[_0xd9b0('0x9')](),controller['addAgents']);router[_0xd9b0('0x15')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x16')]);router[_0xd9b0('0x17')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['destroy']);router[_0xd9b0('0x17')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x18')]);router[_0xd9b0('0x17')](_0xd9b0('0x10'),auth[_0xd9b0('0x9')](),controller['removeAgents']);module[_0xd9b0('0x19')]=router; \ No newline at end of file +var _0x430c=['post','create','/:id/teams','/:id/users','addAgents','put','destroy','delete','removeAgents','multer','connect-timeout','express','Router','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getAgents'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x430c,0x1a1));var _0xc430=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x430c[_0x187279];return _0x3da59d;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/teams',auth[_0xc430('0x8')](),controller['getTeams']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0xf')]('/',auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0xf')](_0xc430('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc430('0xf')](_0xc430('0x12'),auth[_0xc430('0x8')](),controller[_0xc430('0x13')]);router[_0xc430('0x14')]('/:id',auth[_0xc430('0x8')](),controller['update']);router['delete'](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router['delete']('/:id/teams',auth[_0xc430('0x8')](),controller['removeTeams']);router[_0xc430('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xc430('0x17')]);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 4248bd2..70af309 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 _0x757a=['STRING','DATE','moment','sequelize','exports'];(function(_0xc5cada,_0x3a89f9){var _0x1ed4f2=function(_0x3ce1b7){while(--_0x3ce1b7){_0xc5cada['push'](_0xc5cada['shift']());}};_0x1ed4f2(++_0x3a89f9);}(_0x757a,0x110));var _0xa757=function(_0x30df28,_0x311588){_0x30df28=_0x30df28-0x0;var _0x395f66=_0x757a[_0x30df28];return _0x395f66;};'use strict';var moment=require(_0xa757('0x0'));var Sequelize=require(_0xa757('0x1'));module[_0xa757('0x2')]={'uniqueid':{'type':Sequelize[_0xa757('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa757('0x3')]},'joinAt':{'type':Sequelize[_0xa757('0x4')]},'leaveAt':{'type':Sequelize[_0xa757('0x4')]},'acceptAt':{'type':Sequelize[_0xa757('0x4')]},'exitAt':{'type':Sequelize[_0xa757('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed92=['STRING','DATE','sequelize','exports'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xed92,0x166));var _0x2ed9=function(_0x2371a1,_0x289b60){_0x2371a1=_0x2371a1-0x0;var _0x495042=_0xed92[_0x2371a1];return _0x495042;};'use strict';var moment=require('moment');var Sequelize=require(_0x2ed9('0x0'));module[_0x2ed9('0x1')]={'uniqueid':{'type':Sequelize[_0x2ed9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2ed9('0x2')]},'joinAt':{'type':Sequelize[_0x2ed9('0x3')]},'leaveAt':{'type':Sequelize[_0x2ed9('0x3')]},'acceptAt':{'type':Sequelize[_0x2ed9('0x3')]},'exitAt':{'type':Sequelize[_0x2ed9('0x3')]},'reason':{'type':Sequelize[_0x2ed9('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 16f34f8..3e81c41 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 _0x9b87=['ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','options','FaxQueueReport','includeAll','include','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3b5d45,_0x597509){var _0x3cbc78=function(_0x667d99){while(--_0x667d99){_0x3b5d45['push'](_0x3b5d45['shift']());}};_0x3cbc78(++_0x597509);}(_0x9b87,0x8e));var _0x79b8=function(_0x3fb6f6,_0xd598d5){_0x3fb6f6=_0x3fb6f6-0x0;var _0xd7ba73=_0x9b87[_0x3fb6f6];return _0xd7ba73;};'use strict';var emlformat=require(_0x79b8('0x0'));var rimraf=require(_0x79b8('0x1'));var zipdir=require(_0x79b8('0x2'));var jsonpatch=require(_0x79b8('0x3'));var rp=require(_0x79b8('0x4'));var moment=require(_0x79b8('0x5'));var BPromise=require(_0x79b8('0x6'));var Mustache=require(_0x79b8('0x7'));var util=require(_0x79b8('0x8'));var path=require(_0x79b8('0x9'));var sox=require(_0x79b8('0xa'));var csv=require(_0x79b8('0xb'));var ejs=require(_0x79b8('0xc'));var fs=require('fs');var fs_extra=require(_0x79b8('0xd'));var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=typeof _0x21aae0[_0x79b8('0x1d')]==='undefined'&&typeof _0x21aae0['limit']===_0x79b8('0x1e');var _0x24c02f=_0x57a248[_0x79b8('0x1f')];var _0x2ae2d5=_0x5ddab5?0x0:_0x21aae0[_0x79b8('0x1d')];var _0x23d771=_0x5ddab5?_0x57a248['count']:_0x21aae0[_0x79b8('0x1d')]+_0x21aae0['limit'];var _0x53d386;if(_0x23d771>=_0x24c02f){_0x23d771=_0x24c02f;_0x53d386=0xc8;}else{_0x53d386=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x53d386);return _0x3142e9[_0x79b8('0x20')](_0x79b8('0x21'),_0x2ae2d5+'-'+_0x23d771+'/'+_0x24c02f)[_0x79b8('0x22')](_0x57a248);}return null;};}function patchUpdates(_0x1e24cf){return function(_0x1e7507){try{jsonpatch[_0x79b8('0x23')](_0x1e7507,_0x1e24cf,!![]);}catch(_0x261c48){return BPromise[_0x79b8('0x24')](_0x261c48);}return _0x1e7507['save']();};}function saveUpdates(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x25')](_0x3e9d83)[_0x79b8('0x26')](function(_0x54c605){return _0x54c605;});}return null;};}function removeEntity(_0x28be4b,_0x4f543f){return function(_0x5e8228){if(_0x5e8228){return _0x5e8228[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){_0x28be4b[_0x79b8('0x1b')](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x9deb6c,_0x4cd38b){return function(_0x35db24){if(!_0x35db24){_0x9deb6c[_0x79b8('0x1a')](0x194);}return _0x35db24;};}function handleError(_0x1e84f3,_0x3ba5ac){_0x3ba5ac=_0x3ba5ac||0x1f4;return function(_0x4bbbf8){logger[_0x79b8('0x28')](_0x4bbbf8[_0x79b8('0x29')]);if(_0x4bbbf8[_0x79b8('0x2a')]){delete _0x4bbbf8['name'];}_0x1e84f3[_0x79b8('0x1b')](_0x3ba5ac)[_0x79b8('0x2b')](_0x4bbbf8);};}exports[_0x79b8('0x2c')]=function(_0x2942e9,_0x3662aa){var _0x23483f={},_0x4f51d1={},_0x434ecd={'count':0x0,'rows':[]};var _0x5a24fd=_[_0x79b8('0x2d')](db['FaxQueueReport'][_0x79b8('0x2e')],function(_0x1090d2){return{'name':_0x1090d2[_0x79b8('0x2f')],'type':_0x1090d2['type'][_0x79b8('0x30')]};});_0x4f51d1[_0x79b8('0x31')]=_[_0x79b8('0x2d')](_0x5a24fd,_0x79b8('0x2a'));_0x4f51d1['query']=_[_0x79b8('0x32')](_0x2942e9['query']);_0x4f51d1['filters']=_[_0x79b8('0x33')](_0x4f51d1[_0x79b8('0x31')],_0x4f51d1['query']);_0x23483f[_0x79b8('0x34')]=_['intersection'](_0x4f51d1['model'],qs[_0x79b8('0x35')](_0x2942e9['query'][_0x79b8('0x35')]));_0x23483f[_0x79b8('0x34')]=_0x23483f['attributes'][_0x79b8('0x36')]?_0x23483f[_0x79b8('0x34')]:_0x4f51d1[_0x79b8('0x31')];if(!_0x2942e9[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x23483f['limit']=qs[_0x79b8('0x3a')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3a')]);_0x23483f[_0x79b8('0x1d')]=qs[_0x79b8('0x1d')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x1d')]);}_0x23483f[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x23483f['where']=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x2942e9[_0x79b8('0x37')],_0x4f51d1['filters']),_0x5a24fd);if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3f')]){_0x23483f[_0x79b8('0x40')]=_[_0x79b8('0x41')](_0x23483f[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x5a24fd,function(_0x4b6248){if(_0x4b6248[_0x79b8('0x42')]!=='VIRTUAL'){var _0x512d04={};_0x512d04[_0x4b6248[_0x79b8('0x2a')]]={'$like':'%'+_0x2942e9['query']['filter']+'%'};return _0x512d04;}})});}_0x23483f=_[_0x79b8('0x41')]({},_0x23483f,_0x2942e9[_0x79b8('0x43')]);var _0x422c56={'where':_0x23483f[_0x79b8('0x40')]};return db[_0x79b8('0x44')][_0x79b8('0x1f')](_0x422c56)[_0x79b8('0x26')](function(_0x2aac60){_0x434ecd[_0x79b8('0x1f')]=_0x2aac60;if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x45')]){_0x23483f[_0x79b8('0x46')]=[{'all':!![]}];}return db[_0x79b8('0x44')]['findAll'](_0x23483f);})[_0x79b8('0x26')](function(_0x13b041){_0x434ecd['rows']=_0x13b041;return _0x434ecd;})[_0x79b8('0x26')](respondWithFilteredResult(_0x3662aa,_0x23483f))[_0x79b8('0x47')](handleError(_0x3662aa,null));};exports['show']=function(_0x17dd9e,_0x62a011){var _0x2ddad8={'raw':!![],'where':{'id':_0x17dd9e[_0x79b8('0x48')]['id']}},_0x28d4e4={};_0x28d4e4[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x44')][_0x79b8('0x2e')]);_0x28d4e4[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x17dd9e[_0x79b8('0x37')]);_0x28d4e4['filters']=_['intersection'](_0x28d4e4[_0x79b8('0x31')],_0x28d4e4[_0x79b8('0x37')]);_0x2ddad8[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x28d4e4['model'],qs[_0x79b8('0x35')](_0x17dd9e[_0x79b8('0x37')][_0x79b8('0x35')]));_0x2ddad8[_0x79b8('0x34')]=_0x2ddad8['attributes'][_0x79b8('0x36')]?_0x2ddad8[_0x79b8('0x34')]:_0x28d4e4[_0x79b8('0x31')];if(_0x17dd9e[_0x79b8('0x37')]['includeAll']){_0x2ddad8[_0x79b8('0x46')]=[{'all':!![]}];}_0x2ddad8=_[_0x79b8('0x41')]({},_0x2ddad8,_0x17dd9e[_0x79b8('0x43')]);return db[_0x79b8('0x44')][_0x79b8('0x49')](_0x2ddad8)[_0x79b8('0x26')](handleEntityNotFound(_0x62a011,null))['then'](respondWithResult(_0x62a011,null))[_0x79b8('0x47')](handleError(_0x62a011,null));};exports[_0x79b8('0x4a')]=function(_0x330051,_0xc89e93){return db['FaxQueueReport']['create'](_0x330051[_0x79b8('0x4b')],{})[_0x79b8('0x26')](respondWithResult(_0xc89e93,0xc9))[_0x79b8('0x47')](handleError(_0xc89e93,null));};exports[_0x79b8('0x25')]=function(_0x32e7ea,_0x19272d){if(_0x32e7ea[_0x79b8('0x4b')]['id']){delete _0x32e7ea[_0x79b8('0x4b')]['id'];}return db[_0x79b8('0x44')]['find']({'where':{'id':_0x32e7ea[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x19272d,null))[_0x79b8('0x26')](saveUpdates(_0x32e7ea['body'],null))[_0x79b8('0x26')](respondWithResult(_0x19272d,null))['catch'](handleError(_0x19272d,null));};exports['destroy']=function(_0x24ebb2,_0x252c2c){return db[_0x79b8('0x44')][_0x79b8('0x49')]({'where':{'id':_0x24ebb2['params']['id']}})['then'](handleEntityNotFound(_0x252c2c,null))[_0x79b8('0x26')](removeEntity(_0x252c2c,null))[_0x79b8('0x47')](handleError(_0x252c2c,null));};exports[_0x79b8('0x4c')]=function(_0x43f401,_0x2ff973){return db[_0x79b8('0x44')][_0x79b8('0x4c')]()[_0x79b8('0x26')](respondWithResult(_0x2ff973,null))[_0x79b8('0x47')](handleError(_0x2ff973,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(_0xf01899,_0x441cd0){var _0x31e295=function(_0x6c186d){while(--_0x6c186d){_0xf01899['push'](_0xf01899['shift']());}};_0x31e295(++_0x441cd0);}(_0xa854,0x103));var _0x4a85=function(_0x36400e,_0xebc868){_0x36400e=_0x36400e-0x0;var _0x39f5b4=_0xa854[_0x36400e];return _0x39f5b4;};'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 2b7ce42..37674cd 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x42bdbc,_0x1a8d14){var _0x404ab6=function(_0x15ce6a){while(--_0x15ce6a){_0x42bdbc['push'](_0x42bdbc['shift']());}};_0x404ab6(++_0x1a8d14);}(_0xf494,0x1c6));var _0x4f49=function(_0x57efa6,_0x4f6d2d){_0x57efa6=_0x57efa6-0x0;var _0x1e18d0=_0xf494[_0x57efa6];return _0x1e18d0;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x342d67,_0x19b355){var _0x1a20b7=function(_0x372250){while(--_0x372250){_0x342d67['push'](_0x342d67['shift']());}};_0x1a20b7(++_0x19b355);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0x7fbe[_0x387603];return _0x55ea9e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 6866634..d1e0b10 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 _0x7783=['FaxQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x56f187,_0x2eec20){var _0x1b8b67=function(_0x29d013){while(--_0x29d013){_0x56f187['push'](_0x56f187['shift']());}};_0x1b8b67(++_0x2eec20);}(_0x7783,0x1e8));var _0x3778=function(_0x3c6668,_0x386066){_0x3c6668=_0x3c6668-0x0;var _0x1d82e7=_0x7783[_0x3c6668];return _0x1d82e7;};'use strict';var _=require(_0x3778('0x0'));var util=require(_0x3778('0x1'));var moment=require(_0x3778('0x2'));var BPromise=require(_0x3778('0x3'));var rs=require(_0x3778('0x4'));var fs=require('fs');var Redis=require(_0x3778('0x5'));var db=require(_0x3778('0x6'))['db'];var utils=require(_0x3778('0x7'));var logger=require(_0x3778('0x8'))(_0x3778('0x9'));var config=require(_0x3778('0xa'));var jayson=require(_0x3778('0xb'));var client=jayson[_0x3778('0xc')][_0x3778('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ddeb5,_0x14c3f0,_0x37df1a){return new BPromise(function(_0x9a0655,_0x496358){return client[_0x3778('0xe')](_0x3ddeb5,_0x37df1a)['then'](function(_0x27e773){logger[_0x3778('0xf')](_0x3778('0x10'),_0x14c3f0,'request\x20sent');logger[_0x3778('0x11')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x14c3f0,'request\x20sent',JSON[_0x3778('0x12')](_0x27e773));if(_0x27e773[_0x3778('0x13')]){if(_0x27e773[_0x3778('0x13')][_0x3778('0x14')]===0x1f4){logger[_0x3778('0x13')](_0x3778('0x10'),_0x14c3f0,_0x27e773[_0x3778('0x13')]['message']);return _0x496358(_0x27e773[_0x3778('0x13')][_0x3778('0x15')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x14c3f0,_0x27e773['error'][_0x3778('0x15')]);return _0x9a0655(_0x27e773['error'][_0x3778('0x15')]);}else{logger[_0x3778('0xf')](_0x3778('0x10'),_0x14c3f0,_0x3778('0x16'));_0x9a0655(_0x27e773[_0x3778('0x17')][_0x3778('0x15')]);}})[_0x3778('0x18')](function(_0x457efd){logger['error'](_0x3778('0x10'),_0x14c3f0,_0x457efd);_0x496358(_0x457efd);});});}exports[_0x3778('0x19')]=function(_0x5a4064){var _0xc10743=this;return new Promise(function(_0x145868,_0x349f90){return db[_0x3778('0x1a')][_0x3778('0x1b')](_0x5a4064[_0x3778('0x1c')],{'raw':_0x5a4064[_0x3778('0x1d')]?_0x5a4064[_0x3778('0x1d')][_0x3778('0x1e')]===undefined?!![]:![]:!![]})[_0x3778('0x1f')](function(_0x3927d2){logger[_0x3778('0xf')]('CreateFaxQueueReport',_0x5a4064);logger['debug'](_0x3778('0x19'),_0x5a4064,JSON[_0x3778('0x12')](_0x3927d2));_0x145868(_0x3927d2);})['catch'](function(_0x27c7ac){logger[_0x3778('0x13')](_0x3778('0x19'),_0x27c7ac[_0x3778('0x15')],_0x5a4064);_0x349f90(_0xc10743[_0x3778('0x13')](0x1f4,_0x27c7ac[_0x3778('0x15')]));});});};exports[_0x3778('0x20')]=function(_0x180d1d){var _0x30b5a1=this;return new Promise(function(_0x3b51f3,_0x1c3bd8){return db[_0x3778('0x1a')][_0x3778('0x21')](_0x180d1d[_0x3778('0x1c')],{'raw':_0x180d1d[_0x3778('0x1d')]?_0x180d1d[_0x3778('0x1d')][_0x3778('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180d1d[_0x3778('0x1d')]?_0x180d1d[_0x3778('0x1d')]['where']||null:null,'attributes':_0x180d1d['options']?_0x180d1d[_0x3778('0x1d')][_0x3778('0x22')]||null:null,'limit':_0x180d1d[_0x3778('0x1d')]?_0x180d1d[_0x3778('0x1d')][_0x3778('0x23')]||null:null})[_0x3778('0x1f')](function(_0x2017b0){logger[_0x3778('0xf')]('UpdateFaxQueueReport',_0x180d1d);logger[_0x3778('0x11')](_0x3778('0x20'),_0x180d1d,JSON[_0x3778('0x12')](_0x2017b0));_0x3b51f3(_0x2017b0);})[_0x3778('0x18')](function(_0x157074){logger['error'](_0x3778('0x20'),_0x157074['message'],_0x180d1d);_0x1c3bd8(_0x30b5a1[_0x3778('0x13')](0x1f4,_0x157074[_0x3778('0x15')]));});});}; \ No newline at end of file +var _0xa3b1=['http','request','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','catch','CreateFaxQueueReport','create','body','options','raw','then','FaxQueueReport','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x255227,_0x2063b0){var _0x43a3e4=function(_0x2352ec){while(--_0x2352ec){_0x255227['push'](_0x255227['shift']());}};_0x43a3e4(++_0x2063b0);}(_0xa3b1,0xc9));var _0x1a3b=function(_0x2b216a,_0x5ebea4){_0x2b216a=_0x2b216a-0x0;var _0x39ab62=_0xa3b1[_0x2b216a];return _0x39ab62;};'use strict';var _=require(_0x1a3b('0x0'));var util=require(_0x1a3b('0x1'));var moment=require(_0x1a3b('0x2'));var BPromise=require(_0x1a3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a3b('0x4'))['db'];var utils=require(_0x1a3b('0x5'));var logger=require(_0x1a3b('0x6'))(_0x1a3b('0x7'));var config=require(_0x1a3b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1a3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bf1b7,_0xa1a6d2,_0x248cc4){return new BPromise(function(_0x2eae2b,_0x3c7dab){return client[_0x1a3b('0xa')](_0x2bf1b7,_0x248cc4)['then'](function(_0xd50aad){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xa1a6d2,_0x1a3b('0xb'));logger[_0x1a3b('0xc')](_0x1a3b('0xd'),_0xa1a6d2,'request\x20sent',JSON[_0x1a3b('0xe')](_0xd50aad));if(_0xd50aad['error']){if(_0xd50aad[_0x1a3b('0xf')][_0x1a3b('0x10')]===0x1f4){logger[_0x1a3b('0xf')](_0x1a3b('0x11'),_0xa1a6d2,_0xd50aad[_0x1a3b('0xf')][_0x1a3b('0x12')]);return _0x3c7dab(_0xd50aad[_0x1a3b('0xf')]['message']);}logger[_0x1a3b('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0xa1a6d2,_0xd50aad[_0x1a3b('0xf')][_0x1a3b('0x12')]);return _0x2eae2b(_0xd50aad[_0x1a3b('0xf')][_0x1a3b('0x12')]);}else{logger[_0x1a3b('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0xa1a6d2,_0x1a3b('0xb'));_0x2eae2b(_0xd50aad['result'][_0x1a3b('0x12')]);}})[_0x1a3b('0x14')](function(_0x103deb){logger[_0x1a3b('0xf')](_0x1a3b('0x11'),_0xa1a6d2,_0x103deb);_0x3c7dab(_0x103deb);});});}exports[_0x1a3b('0x15')]=function(_0x36e313){var _0x4414bf=this;return new Promise(function(_0x42877e,_0x56d69b){return db['FaxQueueReport'][_0x1a3b('0x16')](_0x36e313[_0x1a3b('0x17')],{'raw':_0x36e313[_0x1a3b('0x18')]?_0x36e313['options'][_0x1a3b('0x19')]===undefined?!![]:![]:!![]})[_0x1a3b('0x1a')](function(_0x1f069a){logger['info'](_0x1a3b('0x15'),_0x36e313);logger[_0x1a3b('0xc')](_0x1a3b('0x15'),_0x36e313,JSON[_0x1a3b('0xe')](_0x1f069a));_0x42877e(_0x1f069a);})['catch'](function(_0x157732){logger[_0x1a3b('0xf')](_0x1a3b('0x15'),_0x157732['message'],_0x36e313);_0x56d69b(_0x4414bf[_0x1a3b('0xf')](0x1f4,_0x157732[_0x1a3b('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x58ae64){var _0x2af44f=this;return new Promise(function(_0x262e1b,_0x1144b7){return db[_0x1a3b('0x1b')]['update'](_0x58ae64[_0x1a3b('0x17')],{'raw':_0x58ae64[_0x1a3b('0x18')]?_0x58ae64[_0x1a3b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ae64[_0x1a3b('0x18')]?_0x58ae64[_0x1a3b('0x18')]['where']||null:null,'attributes':_0x58ae64[_0x1a3b('0x18')]?_0x58ae64[_0x1a3b('0x18')]['attributes']||null:null,'limit':_0x58ae64[_0x1a3b('0x18')]?_0x58ae64[_0x1a3b('0x18')][_0x1a3b('0x1c')]||null:null})[_0x1a3b('0x1a')](function(_0x185443){logger[_0x1a3b('0x13')](_0x1a3b('0x1d'),_0x58ae64);logger[_0x1a3b('0xc')](_0x1a3b('0x1d'),_0x58ae64,JSON[_0x1a3b('0xe')](_0x185443));_0x262e1b(_0x185443);})[_0x1a3b('0x14')](function(_0x2eb939){logger[_0x1a3b('0xf')](_0x1a3b('0x1d'),_0x2eb939[_0x1a3b('0x12')],_0x58ae64);_0x1144b7(_0x2af44f[_0x1a3b('0xf')](0x1f4,_0x2eb939[_0x1a3b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ded88e9..b669149 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 _0xe3e4=['index','/describe','describe','create','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x43c0f9,_0x2084f2){var _0x392fbe=function(_0x4913e3){while(--_0x4913e3){_0x43c0f9['push'](_0x43c0f9['shift']());}};_0x392fbe(++_0x2084f2);}(_0xe3e4,0x113));var _0x4e3e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe3e4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4e3e('0x0'));var util=require(_0x4e3e('0x1'));var path=require(_0x4e3e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e3e('0x3')]();var fs_extra=require(_0x4e3e('0x4'));var auth=require(_0x4e3e('0x5'));var interaction=require(_0x4e3e('0x6'));var config=require('../../config/environment');var controller=require(_0x4e3e('0x7'));router[_0x4e3e('0x8')]('/',auth[_0x4e3e('0x9')](),controller[_0x4e3e('0xa')]);router[_0x4e3e('0x8')](_0x4e3e('0xb'),auth['isAuthenticated'](),controller[_0x4e3e('0xc')]);router['get']('/:id',auth[_0x4e3e('0x9')](),controller['show']);router['post']('/',auth[_0x4e3e('0x9')](),controller[_0x4e3e('0xd')]);router['put'](_0x4e3e('0xe'),auth['isAuthenticated'](),controller[_0x4e3e('0xf')]);router[_0x4e3e('0x10')](_0x4e3e('0xe'),auth['isAuthenticated'](),controller[_0x4e3e('0x11')]);module[_0x4e3e('0x12')]=router; \ No newline at end of file +var _0x25ff=['../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x28019c,_0x67743){var _0x48ca39=function(_0x4c161e){while(--_0x4c161e){_0x28019c['push'](_0x28019c['shift']());}};_0x48ca39(++_0x67743);}(_0x25ff,0xbf));var _0xf25f=function(_0x39e385,_0x3c69a3){_0x39e385=_0x39e385-0x0;var _0x614bb0=_0x25ff[_0x39e385];return _0x614bb0;};'use strict';var multer=require(_0xf25f('0x0'));var util=require(_0xf25f('0x1'));var path=require(_0xf25f('0x2'));var timeout=require(_0xf25f('0x3'));var express=require(_0xf25f('0x4'));var router=express[_0xf25f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf25f('0x6'));var interaction=require(_0xf25f('0x7'));var config=require(_0xf25f('0x8'));var controller=require(_0xf25f('0x9'));router['get']('/',auth[_0xf25f('0xa')](),controller['index']);router[_0xf25f('0xb')](_0xf25f('0xc'),auth[_0xf25f('0xa')](),controller[_0xf25f('0xd')]);router[_0xf25f('0xb')]('/:id',auth[_0xf25f('0xa')](),controller[_0xf25f('0xe')]);router['post']('/',auth[_0xf25f('0xa')](),controller[_0xf25f('0xf')]);router[_0xf25f('0x10')](_0xf25f('0x11'),auth[_0xf25f('0xa')](),controller[_0xf25f('0x12')]);router[_0xf25f('0x13')](_0xf25f('0x11'),auth['isAuthenticated'](),controller[_0xf25f('0x14')]);module[_0xf25f('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 368a0f4..625125f 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(_0x55418e,_0x3fe1fc){var _0x634190=function(_0x221b38){while(--_0x221b38){_0x55418e['push'](_0x55418e['shift']());}};_0x634190(++_0x3fe1fc);}(_0x008c,0x188));var _0xc008=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0x008c[_0x2b18c9];return _0x8b913c;};'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(_0x136ed6,_0x1df16d){var _0x3bbfb9=function(_0xfc4332){while(--_0xfc4332){_0x136ed6['push'](_0x136ed6['shift']());}};_0x3bbfb9(++_0x1df16d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 d6da235..f44a9c0 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 _0xef9b=['count','set','Content-Range','json','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','update','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','undefined','limit'];(function(_0x350776,_0x3843ba){var _0x309e08=function(_0x1c49e7){while(--_0x1c49e7){_0x350776['push'](_0x350776['shift']());}};_0x309e08(++_0x3843ba);}(_0xef9b,0x1dd));var _0xbef9=function(_0x1dd449,_0x1cf7dd){_0x1dd449=_0x1dd449-0x0;var _0x120ad7=_0xef9b[_0x1dd449];return _0x120ad7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbef9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbef9('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbef9('0x2'));var Mustache=require(_0xbef9('0x3'));var util=require('util');var path=require(_0xbef9('0x4'));var sox=require(_0xbef9('0x5'));var csv=require(_0xbef9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbef9('0x7'));var _=require(_0xbef9('0x8'));var squel=require(_0xbef9('0x9'));var crypto=require(_0xbef9('0xa'));var jsforce=require(_0xbef9('0xb'));var deskjs=require(_0xbef9('0xc'));var toCsv=require(_0xbef9('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbef9('0xd'));var authService=require(_0xbef9('0xe'));var qs=require(_0xbef9('0xf'));var as=require(_0xbef9('0x10'));var hardwareService=require(_0xbef9('0x11'));var logger=require(_0xbef9('0x12'))(_0xbef9('0x13'));var utils=require(_0xbef9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbef9('0x15'))['db'];function respondWithStatusCode(_0x497d7d,_0xaad011){_0xaad011=_0xaad011||0xcc;return function(_0x37e809){if(_0x37e809){return _0x497d7d['sendStatus'](_0xaad011);}return _0x497d7d['status'](_0xaad011)[_0xbef9('0x16')]();};}function respondWithResult(_0x118c0d,_0x2b9544){_0x2b9544=_0x2b9544||0xc8;return function(_0x12d282){if(_0x12d282){return _0x118c0d[_0xbef9('0x17')](_0x2b9544)['json'](_0x12d282);}};}function respondWithFilteredResult(_0x1a9659,_0x2624fa){return function(_0xad696f){if(_0xad696f){var _0x1ea875=typeof _0x2624fa[_0xbef9('0x18')]===_0xbef9('0x19')&&typeof _0x2624fa[_0xbef9('0x1a')]==='undefined';var _0x209e2f=_0xad696f[_0xbef9('0x1b')];var _0x3a1440=_0x1ea875?0x0:_0x2624fa[_0xbef9('0x18')];var _0x48cb46=_0x1ea875?_0xad696f[_0xbef9('0x1b')]:_0x2624fa[_0xbef9('0x18')]+_0x2624fa[_0xbef9('0x1a')];var _0x359d65;if(_0x48cb46>=_0x209e2f){_0x48cb46=_0x209e2f;_0x359d65=0xc8;}else{_0x359d65=0xce;}_0x1a9659['status'](_0x359d65);return _0x1a9659[_0xbef9('0x1c')](_0xbef9('0x1d'),_0x3a1440+'-'+_0x48cb46+'/'+_0x209e2f)[_0xbef9('0x1e')](_0xad696f);}return null;};}function patchUpdates(_0x4e7943){return function(_0x4a0f13){try{jsonpatch[_0xbef9('0x1f')](_0x4a0f13,_0x4e7943,!![]);}catch(_0x2fbcb0){return BPromise[_0xbef9('0x20')](_0x2fbcb0);}return _0x4a0f13['save']();};}function saveUpdates(_0x424e49,_0x2ca8cb){return function(_0x1e177d){if(_0x1e177d){return _0x1e177d['update'](_0x424e49)[_0xbef9('0x21')](function(_0xdb2b71){return _0xdb2b71;});}return null;};}function removeEntity(_0x34b271,_0x3228ef){return function(_0x1d78f1){if(_0x1d78f1){return _0x1d78f1[_0xbef9('0x22')]()[_0xbef9('0x21')](function(){_0x34b271[_0xbef9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f057f,_0x305798){return function(_0x1d1e20){if(!_0x1d1e20){_0x2f057f[_0xbef9('0x23')](0x194);}return _0x1d1e20;};}function handleError(_0x23c1b4,_0x499d61){_0x499d61=_0x499d61||0x1f4;return function(_0x40a0a7){logger['error'](_0x40a0a7[_0xbef9('0x24')]);if(_0x40a0a7[_0xbef9('0x25')]){delete _0x40a0a7[_0xbef9('0x25')];}_0x23c1b4['status'](_0x499d61)[_0xbef9('0x26')](_0x40a0a7);};}exports[_0xbef9('0x27')]=function(_0x430878,_0x27cdb0){var _0x529823={},_0x4ec4d5={},_0x47123b={'count':0x0,'rows':[]};var _0x14021f=_[_0xbef9('0x28')](db[_0xbef9('0x29')][_0xbef9('0x2a')],function(_0x41336f){return{'name':_0x41336f[_0xbef9('0x2b')],'type':_0x41336f[_0xbef9('0x2c')]['key']};});_0x4ec4d5['model']=_[_0xbef9('0x28')](_0x14021f,_0xbef9('0x25'));_0x4ec4d5[_0xbef9('0x2d')]=_['keys'](_0x430878[_0xbef9('0x2d')]);_0x4ec4d5[_0xbef9('0x2e')]=_[_0xbef9('0x2f')](_0x4ec4d5['model'],_0x4ec4d5['query']);_0x529823[_0xbef9('0x30')]=_[_0xbef9('0x2f')](_0x4ec4d5[_0xbef9('0x31')],qs['fields'](_0x430878[_0xbef9('0x2d')][_0xbef9('0x32')]));_0x529823[_0xbef9('0x30')]=_0x529823[_0xbef9('0x30')]['length']?_0x529823[_0xbef9('0x30')]:_0x4ec4d5['model'];if(!_0x430878['query'][_0xbef9('0x33')]('nolimit')){_0x529823['limit']=qs['limit'](_0x430878[_0xbef9('0x2d')][_0xbef9('0x1a')]);_0x529823['offset']=qs[_0xbef9('0x18')](_0x430878[_0xbef9('0x2d')][_0xbef9('0x18')]);}_0x529823[_0xbef9('0x34')]=qs[_0xbef9('0x35')](_0x430878[_0xbef9('0x2d')][_0xbef9('0x35')]);_0x529823[_0xbef9('0x36')]=qs[_0xbef9('0x2e')](_[_0xbef9('0x37')](_0x430878[_0xbef9('0x2d')],_0x4ec4d5[_0xbef9('0x2e')]),_0x14021f);if(_0x430878[_0xbef9('0x2d')][_0xbef9('0x38')]){_0x529823[_0xbef9('0x36')]=_[_0xbef9('0x39')](_0x529823['where'],{'$or':_[_0xbef9('0x28')](_0x14021f,function(_0x270cbd){if(_0x270cbd['type']!==_0xbef9('0x3a')){var _0x5bb446={};_0x5bb446[_0x270cbd['name']]={'$like':'%'+_0x430878[_0xbef9('0x2d')]['filter']+'%'};return _0x5bb446;}})});}_0x529823=_[_0xbef9('0x39')]({},_0x529823,_0x430878[_0xbef9('0x3b')]);var _0x5355b7={'where':_0x529823['where']};return db[_0xbef9('0x29')][_0xbef9('0x1b')](_0x5355b7)['then'](function(_0xc17d33){_0x47123b['count']=_0xc17d33;if(_0x430878[_0xbef9('0x2d')][_0xbef9('0x3c')]){_0x529823[_0xbef9('0x3d')]=[{'all':!![]}];}return db[_0xbef9('0x29')][_0xbef9('0x3e')](_0x529823);})[_0xbef9('0x21')](function(_0x3a0578){_0x47123b['rows']=_0x3a0578;return _0x47123b;})['then'](respondWithFilteredResult(_0x27cdb0,_0x529823))[_0xbef9('0x3f')](handleError(_0x27cdb0,null));};exports[_0xbef9('0x40')]=function(_0x612179,_0x3df5de){var _0x2d009a={'raw':!![],'where':{'id':_0x612179[_0xbef9('0x41')]['id']}},_0x51af21={};_0x51af21[_0xbef9('0x31')]=_[_0xbef9('0x42')](db['FaxTransferReport'][_0xbef9('0x2a')]);_0x51af21['query']=_[_0xbef9('0x42')](_0x612179[_0xbef9('0x2d')]);_0x51af21['filters']=_[_0xbef9('0x2f')](_0x51af21[_0xbef9('0x31')],_0x51af21[_0xbef9('0x2d')]);_0x2d009a[_0xbef9('0x30')]=_[_0xbef9('0x2f')](_0x51af21[_0xbef9('0x31')],qs['fields'](_0x612179['query'][_0xbef9('0x32')]));_0x2d009a[_0xbef9('0x30')]=_0x2d009a[_0xbef9('0x30')][_0xbef9('0x43')]?_0x2d009a[_0xbef9('0x30')]:_0x51af21['model'];if(_0x612179[_0xbef9('0x2d')][_0xbef9('0x3c')]){_0x2d009a[_0xbef9('0x3d')]=[{'all':!![]}];}_0x2d009a=_[_0xbef9('0x39')]({},_0x2d009a,_0x612179[_0xbef9('0x3b')]);return db[_0xbef9('0x29')][_0xbef9('0x44')](_0x2d009a)['then'](handleEntityNotFound(_0x3df5de,null))[_0xbef9('0x21')](respondWithResult(_0x3df5de,null))[_0xbef9('0x3f')](handleError(_0x3df5de,null));};exports['create']=function(_0x3d056d,_0x3149de){return db['FaxTransferReport']['create'](_0x3d056d['body'],{})[_0xbef9('0x21')](respondWithResult(_0x3149de,0xc9))['catch'](handleError(_0x3149de,null));};exports[_0xbef9('0x45')]=function(_0x498924,_0x34d038){if(_0x498924[_0xbef9('0x46')]['id']){delete _0x498924[_0xbef9('0x46')]['id'];}return db[_0xbef9('0x29')][_0xbef9('0x44')]({'where':{'id':_0x498924['params']['id']}})[_0xbef9('0x21')](handleEntityNotFound(_0x34d038,null))['then'](saveUpdates(_0x498924[_0xbef9('0x46')],null))[_0xbef9('0x21')](respondWithResult(_0x34d038,null))[_0xbef9('0x3f')](handleError(_0x34d038,null));};exports['destroy']=function(_0x1f816a,_0x2554b0){return db[_0xbef9('0x29')][_0xbef9('0x44')]({'where':{'id':_0x1f816a[_0xbef9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2554b0,null))[_0xbef9('0x21')](removeEntity(_0x2554b0,null))['catch'](handleError(_0x2554b0,null));};exports[_0xbef9('0x47')]=function(_0xb5b4b3,_0x4997d6){return db[_0xbef9('0x29')]['describe']()['then'](respondWithResult(_0x4997d6,null))['catch'](handleError(_0x4997d6,null));}; \ No newline at end of file +var _0xcf01=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','map','FaxTransferReport','fieldName','type','key','keys','query','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x42b1e7,_0x28ed51){var _0x16d9a8=function(_0x37852c){while(--_0x37852c){_0x42b1e7['push'](_0x42b1e7['shift']());}};_0x16d9a8(++_0x28ed51);}(_0xcf01,0x157));var _0x1cf0=function(_0x11a287,_0x57df55){_0x11a287=_0x11a287-0x0;var _0x111e64=_0xcf01[_0x11a287];return _0x111e64;};'use strict';var emlformat=require(_0x1cf0('0x0'));var rimraf=require(_0x1cf0('0x1'));var zipdir=require(_0x1cf0('0x2'));var jsonpatch=require(_0x1cf0('0x3'));var rp=require('request-promise');var moment=require(_0x1cf0('0x4'));var BPromise=require(_0x1cf0('0x5'));var Mustache=require(_0x1cf0('0x6'));var util=require(_0x1cf0('0x7'));var path=require(_0x1cf0('0x8'));var sox=require(_0x1cf0('0x9'));var csv=require(_0x1cf0('0xa'));var ejs=require(_0x1cf0('0xb'));var fs=require('fs');var fs_extra=require(_0x1cf0('0xc'));var _=require(_0x1cf0('0xd'));var squel=require('squel');var crypto=require(_0x1cf0('0xe'));var jsforce=require(_0x1cf0('0xf'));var deskjs=require(_0x1cf0('0x10'));var toCsv=require(_0x1cf0('0xa'));var querystring=require('querystring');var Papa=require(_0x1cf0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1cf0('0x12'));var as=require(_0x1cf0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cf0('0x14'));var utils=require(_0x1cf0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1cf0('0x16'))['db'];function respondWithStatusCode(_0x4c84fb,_0x43e95b){_0x43e95b=_0x43e95b||0xcc;return function(_0x5add2e){if(_0x5add2e){return _0x4c84fb[_0x1cf0('0x17')](_0x43e95b);}return _0x4c84fb[_0x1cf0('0x18')](_0x43e95b)['end']();};}function respondWithResult(_0xaba7e0,_0x107e3e){_0x107e3e=_0x107e3e||0xc8;return function(_0x361575){if(_0x361575){return _0xaba7e0[_0x1cf0('0x18')](_0x107e3e)[_0x1cf0('0x19')](_0x361575);}};}function respondWithFilteredResult(_0xa675d9,_0x48a6dd){return function(_0x3a5bbf){if(_0x3a5bbf){var _0x343f37=typeof _0x48a6dd[_0x1cf0('0x1a')]==='undefined'&&typeof _0x48a6dd['limit']===_0x1cf0('0x1b');var _0x2087cd=_0x3a5bbf[_0x1cf0('0x1c')];var _0x4da8a7=_0x343f37?0x0:_0x48a6dd[_0x1cf0('0x1a')];var _0xf7353=_0x343f37?_0x3a5bbf['count']:_0x48a6dd[_0x1cf0('0x1a')]+_0x48a6dd[_0x1cf0('0x1d')];var _0x4e2f94;if(_0xf7353>=_0x2087cd){_0xf7353=_0x2087cd;_0x4e2f94=0xc8;}else{_0x4e2f94=0xce;}_0xa675d9[_0x1cf0('0x18')](_0x4e2f94);return _0xa675d9['set'](_0x1cf0('0x1e'),_0x4da8a7+'-'+_0xf7353+'/'+_0x2087cd)[_0x1cf0('0x19')](_0x3a5bbf);}return null;};}function patchUpdates(_0x9fb401){return function(_0x16a958){try{jsonpatch[_0x1cf0('0x1f')](_0x16a958,_0x9fb401,!![]);}catch(_0xf17dc9){return BPromise[_0x1cf0('0x20')](_0xf17dc9);}return _0x16a958[_0x1cf0('0x21')]();};}function saveUpdates(_0x2d1dc2,_0x5ea2a4){return function(_0x2ee1d3){if(_0x2ee1d3){return _0x2ee1d3[_0x1cf0('0x22')](_0x2d1dc2)['then'](function(_0x551daf){return _0x551daf;});}return null;};}function removeEntity(_0x3123c1,_0x220f54){return function(_0x5b61a2){if(_0x5b61a2){return _0x5b61a2[_0x1cf0('0x23')]()[_0x1cf0('0x24')](function(){_0x3123c1[_0x1cf0('0x18')](0xcc)[_0x1cf0('0x25')]();});}};}function handleEntityNotFound(_0x4a4a9c,_0x7ddf70){return function(_0x52045a){if(!_0x52045a){_0x4a4a9c[_0x1cf0('0x17')](0x194);}return _0x52045a;};}function handleError(_0x2e9c01,_0x5166aa){_0x5166aa=_0x5166aa||0x1f4;return function(_0x46584f){logger[_0x1cf0('0x26')](_0x46584f[_0x1cf0('0x27')]);if(_0x46584f[_0x1cf0('0x28')]){delete _0x46584f[_0x1cf0('0x28')];}_0x2e9c01[_0x1cf0('0x18')](_0x5166aa)['send'](_0x46584f);};}exports['index']=function(_0x3ec0a4,_0x57a9e8){var _0x22525e={},_0x5eadd8={},_0x1ec3ab={'count':0x0,'rows':[]};var _0x1acbfe=_[_0x1cf0('0x29')](db[_0x1cf0('0x2a')]['rawAttributes'],function(_0x583616){return{'name':_0x583616[_0x1cf0('0x2b')],'type':_0x583616[_0x1cf0('0x2c')][_0x1cf0('0x2d')]};});_0x5eadd8['model']=_[_0x1cf0('0x29')](_0x1acbfe,_0x1cf0('0x28'));_0x5eadd8['query']=_[_0x1cf0('0x2e')](_0x3ec0a4[_0x1cf0('0x2f')]);_0x5eadd8['filters']=_[_0x1cf0('0x30')](_0x5eadd8[_0x1cf0('0x31')],_0x5eadd8['query']);_0x22525e['attributes']=_[_0x1cf0('0x30')](_0x5eadd8[_0x1cf0('0x31')],qs[_0x1cf0('0x32')](_0x3ec0a4[_0x1cf0('0x2f')][_0x1cf0('0x32')]));_0x22525e['attributes']=_0x22525e['attributes'][_0x1cf0('0x33')]?_0x22525e[_0x1cf0('0x34')]:_0x5eadd8[_0x1cf0('0x31')];if(!_0x3ec0a4[_0x1cf0('0x2f')][_0x1cf0('0x35')](_0x1cf0('0x36'))){_0x22525e[_0x1cf0('0x1d')]=qs[_0x1cf0('0x1d')](_0x3ec0a4[_0x1cf0('0x2f')][_0x1cf0('0x1d')]);_0x22525e[_0x1cf0('0x1a')]=qs['offset'](_0x3ec0a4[_0x1cf0('0x2f')][_0x1cf0('0x1a')]);}_0x22525e['order']=qs['sort'](_0x3ec0a4[_0x1cf0('0x2f')][_0x1cf0('0x37')]);_0x22525e[_0x1cf0('0x38')]=qs[_0x1cf0('0x39')](_[_0x1cf0('0x3a')](_0x3ec0a4[_0x1cf0('0x2f')],_0x5eadd8[_0x1cf0('0x39')]),_0x1acbfe);if(_0x3ec0a4[_0x1cf0('0x2f')][_0x1cf0('0x3b')]){_0x22525e['where']=_[_0x1cf0('0x3c')](_0x22525e[_0x1cf0('0x38')],{'$or':_['map'](_0x1acbfe,function(_0x4fdc9c){if(_0x4fdc9c[_0x1cf0('0x2c')]!==_0x1cf0('0x3d')){var _0x164578={};_0x164578[_0x4fdc9c[_0x1cf0('0x28')]]={'$like':'%'+_0x3ec0a4[_0x1cf0('0x2f')]['filter']+'%'};return _0x164578;}})});}_0x22525e=_[_0x1cf0('0x3c')]({},_0x22525e,_0x3ec0a4['options']);var _0x44541b={'where':_0x22525e[_0x1cf0('0x38')]};return db[_0x1cf0('0x2a')][_0x1cf0('0x1c')](_0x44541b)[_0x1cf0('0x24')](function(_0x33abcf){_0x1ec3ab['count']=_0x33abcf;if(_0x3ec0a4['query'][_0x1cf0('0x3e')]){_0x22525e[_0x1cf0('0x3f')]=[{'all':!![]}];}return db[_0x1cf0('0x2a')][_0x1cf0('0x40')](_0x22525e);})['then'](function(_0x569ac1){_0x1ec3ab['rows']=_0x569ac1;return _0x1ec3ab;})[_0x1cf0('0x24')](respondWithFilteredResult(_0x57a9e8,_0x22525e))[_0x1cf0('0x41')](handleError(_0x57a9e8,null));};exports[_0x1cf0('0x42')]=function(_0x23631c,_0x38f50e){var _0x2772aa={'raw':!![],'where':{'id':_0x23631c[_0x1cf0('0x43')]['id']}},_0x4f116d={};_0x4f116d[_0x1cf0('0x31')]=_[_0x1cf0('0x2e')](db['FaxTransferReport']['rawAttributes']);_0x4f116d[_0x1cf0('0x2f')]=_[_0x1cf0('0x2e')](_0x23631c[_0x1cf0('0x2f')]);_0x4f116d[_0x1cf0('0x39')]=_[_0x1cf0('0x30')](_0x4f116d[_0x1cf0('0x31')],_0x4f116d[_0x1cf0('0x2f')]);_0x2772aa[_0x1cf0('0x34')]=_[_0x1cf0('0x30')](_0x4f116d['model'],qs['fields'](_0x23631c['query']['fields']));_0x2772aa['attributes']=_0x2772aa[_0x1cf0('0x34')][_0x1cf0('0x33')]?_0x2772aa[_0x1cf0('0x34')]:_0x4f116d[_0x1cf0('0x31')];if(_0x23631c[_0x1cf0('0x2f')][_0x1cf0('0x3e')]){_0x2772aa['include']=[{'all':!![]}];}_0x2772aa=_[_0x1cf0('0x3c')]({},_0x2772aa,_0x23631c['options']);return db[_0x1cf0('0x2a')]['find'](_0x2772aa)[_0x1cf0('0x24')](handleEntityNotFound(_0x38f50e,null))[_0x1cf0('0x24')](respondWithResult(_0x38f50e,null))[_0x1cf0('0x41')](handleError(_0x38f50e,null));};exports[_0x1cf0('0x44')]=function(_0x3b0e0b,_0x522429){return db['FaxTransferReport'][_0x1cf0('0x44')](_0x3b0e0b[_0x1cf0('0x45')],{})[_0x1cf0('0x24')](respondWithResult(_0x522429,0xc9))[_0x1cf0('0x41')](handleError(_0x522429,null));};exports[_0x1cf0('0x22')]=function(_0x4b9d9a,_0x503527){if(_0x4b9d9a[_0x1cf0('0x45')]['id']){delete _0x4b9d9a[_0x1cf0('0x45')]['id'];}return db[_0x1cf0('0x2a')]['find']({'where':{'id':_0x4b9d9a[_0x1cf0('0x43')]['id']}})['then'](handleEntityNotFound(_0x503527,null))[_0x1cf0('0x24')](saveUpdates(_0x4b9d9a[_0x1cf0('0x45')],null))[_0x1cf0('0x24')](respondWithResult(_0x503527,null))[_0x1cf0('0x41')](handleError(_0x503527,null));};exports[_0x1cf0('0x23')]=function(_0x531d06,_0x16749b){return db[_0x1cf0('0x2a')][_0x1cf0('0x46')]({'where':{'id':_0x531d06[_0x1cf0('0x43')]['id']}})[_0x1cf0('0x24')](handleEntityNotFound(_0x16749b,null))[_0x1cf0('0x24')](removeEntity(_0x16749b,null))[_0x1cf0('0x41')](handleError(_0x16749b,null));};exports[_0x1cf0('0x47')]=function(_0xd25f27,_0x3cb9e0){return db['FaxTransferReport'][_0x1cf0('0x47')]()['then'](respondWithResult(_0x3cb9e0,null))[_0x1cf0('0x41')](handleError(_0x3cb9e0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e4da8e8..715815e 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 _0x8dd1=['define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x209824,_0x1a54a2){var _0xe4ba63=function(_0x5efcfc){while(--_0x5efcfc){_0x209824['push'](_0x209824['shift']());}};_0xe4ba63(++_0x1a54a2);}(_0x8dd1,0x1e5));var _0x18dd=function(_0x457ad6,_0x40c3b3){_0x457ad6=_0x457ad6-0x0;var _0x6df1ed=_0x8dd1[_0x457ad6];return _0x6df1ed;};'use strict';var _=require(_0x18dd('0x0'));var util=require(_0x18dd('0x1'));var logger=require(_0x18dd('0x2'))('api');var moment=require(_0x18dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x18dd('0x4'));var fs=require('fs');var path=require(_0x18dd('0x5'));var rimraf=require(_0x18dd('0x6'));var config=require(_0x18dd('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0x18dd('0x8')]=function(_0x2cb51e,_0x43c5b5){return _0x2cb51e[_0x18dd('0x9')](_0x18dd('0xa'),attributes,{'tableName':_0x18dd('0xb'),'paranoid':![],'indexes':[{'name':_0x18dd('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f9=['request-promise','path','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe8f9,0x73));var _0x9e8f=function(_0xb124d2,_0x25c628){_0xb124d2=_0xb124d2-0x0;var _0x4ebe2f=_0xe8f9[_0xb124d2];return _0x4ebe2f;};'use strict';var _=require('lodash');var util=require(_0x9e8f('0x0'));var logger=require(_0x9e8f('0x1'))(_0x9e8f('0x2'));var moment=require(_0x9e8f('0x3'));var BPromise=require(_0x9e8f('0x4'));var rp=require(_0x9e8f('0x5'));var fs=require('fs');var path=require(_0x9e8f('0x6'));var rimraf=require('rimraf');var config=require(_0x9e8f('0x7'));var attributes=require(_0x9e8f('0x8'));module['exports']=function(_0x441602,_0x44472c){return _0x441602[_0x9e8f('0x9')](_0x9e8f('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x9e8f('0xb'),'fields':[_0x9e8f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 00770b1..c68d89c 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 _0xa74a=['../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0xa74a,0x76));var _0xaa74=function(_0x5b463d,_0x4c0149){_0x5b463d=_0x5b463d-0x0;var _0x342661=_0xa74a[_0x5b463d];return _0x342661;};'use strict';var _=require('lodash');var util=require(_0xaa74('0x0'));var moment=require(_0xaa74('0x1'));var BPromise=require(_0xaa74('0x2'));var rs=require(_0xaa74('0x3'));var fs=require('fs');var Redis=require(_0xaa74('0x4'));var db=require(_0xaa74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa74('0x6'))(_0xaa74('0x7'));var config=require(_0xaa74('0x8'));var jayson=require(_0xaa74('0x9'));var client=jayson[_0xaa74('0xa')][_0xaa74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4335eb,_0x256bf7,_0x2ea19a){return new BPromise(function(_0x4ebdf4,_0x4485aa){return client['request'](_0x4335eb,_0x2ea19a)[_0xaa74('0xc')](function(_0x4a700c){logger['info'](_0xaa74('0xd'),_0x256bf7,_0xaa74('0xe'));logger['debug'](_0xaa74('0xf'),_0x256bf7,'request\x20sent',JSON[_0xaa74('0x10')](_0x4a700c));if(_0x4a700c['error']){if(_0x4a700c['error'][_0xaa74('0x11')]===0x1f4){logger[_0xaa74('0x12')](_0xaa74('0xd'),_0x256bf7,_0x4a700c[_0xaa74('0x12')][_0xaa74('0x13')]);return _0x4485aa(_0x4a700c['error']['message']);}logger[_0xaa74('0x12')](_0xaa74('0xd'),_0x256bf7,_0x4a700c[_0xaa74('0x12')][_0xaa74('0x13')]);return _0x4ebdf4(_0x4a700c[_0xaa74('0x12')][_0xaa74('0x13')]);}else{logger[_0xaa74('0x14')](_0xaa74('0xd'),_0x256bf7,_0xaa74('0xe'));_0x4ebdf4(_0x4a700c['result'][_0xaa74('0x13')]);}})['catch'](function(_0x1ed53e){logger[_0xaa74('0x12')](_0xaa74('0xd'),_0x256bf7,_0x1ed53e);_0x4485aa(_0x1ed53e);});});} \ No newline at end of file +var _0xfd6c=['FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2232bd,_0x1ef998){var _0x5aafaa=function(_0x8b3f74){while(--_0x8b3f74){_0x2232bd['push'](_0x2232bd['shift']());}};_0x5aafaa(++_0x1ef998);}(_0xfd6c,0x7d));var _0xcfd6=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0xfd6c[_0x4854d6];return _0x3885c0;};'use strict';var _=require(_0xcfd6('0x0'));var util=require(_0xcfd6('0x1'));var moment=require(_0xcfd6('0x2'));var BPromise=require(_0xcfd6('0x3'));var rs=require(_0xcfd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcfd6('0x5'));var logger=require(_0xcfd6('0x6'))('rpc');var config=require(_0xcfd6('0x7'));var jayson=require(_0xcfd6('0x8'));var client=jayson[_0xcfd6('0x9')][_0xcfd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1070cc,_0x4fda1b,_0x514554){return new BPromise(function(_0x1ea559,_0x51fe90){return client[_0xcfd6('0xb')](_0x1070cc,_0x514554)['then'](function(_0x199d35){logger[_0xcfd6('0xc')](_0xcfd6('0xd'),_0x4fda1b,_0xcfd6('0xe'));logger['debug'](_0xcfd6('0xf'),_0x4fda1b,_0xcfd6('0xe'),JSON['stringify'](_0x199d35));if(_0x199d35[_0xcfd6('0x10')]){if(_0x199d35[_0xcfd6('0x10')][_0xcfd6('0x11')]===0x1f4){logger[_0xcfd6('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4fda1b,_0x199d35[_0xcfd6('0x10')]['message']);return _0x51fe90(_0x199d35['error'][_0xcfd6('0x12')]);}logger[_0xcfd6('0x10')](_0xcfd6('0xd'),_0x4fda1b,_0x199d35[_0xcfd6('0x10')][_0xcfd6('0x12')]);return _0x1ea559(_0x199d35['error'][_0xcfd6('0x12')]);}else{logger[_0xcfd6('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x4fda1b,'request\x20sent');_0x1ea559(_0x199d35['result'][_0xcfd6('0x12')]);}})[_0xcfd6('0x13')](function(_0x1e3122){logger[_0xcfd6('0x10')](_0xcfd6('0xd'),_0x4fda1b,_0x1e3122);_0x51fe90(_0x1e3122);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6c42abd..a6dfe30 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 _0xcfe1=['destroy','path','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x3cb167,_0x189a77){var _0x3801d4=function(_0x56c2fb){while(--_0x56c2fb){_0x3cb167['push'](_0x3cb167['shift']());}};_0x3801d4(++_0x189a77);}(_0xcfe1,0xc1));var _0x1cfe=function(_0x4420a6,_0x35086b){_0x4420a6=_0x4420a6-0x0;var _0x660c81=_0xcfe1[_0x4420a6];return _0x660c81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cfe('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1cfe('0x1'));var auth=require(_0x1cfe('0x2'));var interaction=require(_0x1cfe('0x3'));var config=require('../../config/environment');var controller=require(_0x1cfe('0x4'));router[_0x1cfe('0x5')]('/',auth[_0x1cfe('0x6')](),controller[_0x1cfe('0x7')]);router[_0x1cfe('0x5')](_0x1cfe('0x8'),auth['isAuthenticated'](),controller[_0x1cfe('0x9')]);router[_0x1cfe('0x5')](_0x1cfe('0xa'),auth[_0x1cfe('0x6')](),controller[_0x1cfe('0xb')]);router['post']('/',auth[_0x1cfe('0x6')](),controller[_0x1cfe('0xc')]);router[_0x1cfe('0xd')](_0x1cfe('0xa'),auth['isAuthenticated'](),controller[_0x1cfe('0xe')]);router['delete'](_0x1cfe('0xa'),auth[_0x1cfe('0x6')](),controller[_0x1cfe('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3d09=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','index','get','/describe','isAuthenticated','/:id','show','create','put','destroy','util','path'];(function(_0x3b567e,_0x47ad1b){var _0x52f05c=function(_0x58b2cf){while(--_0x58b2cf){_0x3b567e['push'](_0x3b567e['shift']());}};_0x52f05c(++_0x47ad1b);}(_0x3d09,0x18a));var _0x93d0=function(_0x14eed1,_0x38da4a){_0x14eed1=_0x14eed1-0x0;var _0x31807a=_0x3d09[_0x14eed1];return _0x31807a;};'use strict';var multer=require('multer');var util=require(_0x93d0('0x0'));var path=require(_0x93d0('0x1'));var timeout=require(_0x93d0('0x2'));var express=require('express');var router=express[_0x93d0('0x3')]();var fs_extra=require(_0x93d0('0x4'));var auth=require(_0x93d0('0x5'));var interaction=require(_0x93d0('0x6'));var config=require(_0x93d0('0x7'));var controller=require(_0x93d0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x93d0('0x9')]);router[_0x93d0('0xa')](_0x93d0('0xb'),auth[_0x93d0('0xc')](),controller['describe']);router[_0x93d0('0xa')](_0x93d0('0xd'),auth['isAuthenticated'](),controller[_0x93d0('0xe')]);router['post']('/',auth[_0x93d0('0xc')](),controller[_0x93d0('0xf')]);router[_0x93d0('0x10')](_0x93d0('0xd'),auth[_0x93d0('0xc')](),controller['update']);router['delete'](_0x93d0('0xd'),auth[_0x93d0('0xc')](),controller[_0x93d0('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f83077c..37802a1 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 _0x0942=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','/:id'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0942,0x124));var _0x2094=function(_0x381631,_0x59ea51){_0x381631=_0x381631-0x0;var _0x7471bb=_0x0942[_0x381631];return _0x7471bb;};'use strict';var multer=require(_0x2094('0x0'));var util=require(_0x2094('0x1'));var path=require(_0x2094('0x2'));var timeout=require(_0x2094('0x3'));var express=require(_0x2094('0x4'));var router=express[_0x2094('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2094('0x6'));var config=require('../../config/environment');var controller=require(_0x2094('0x7'));router[_0x2094('0x8')]('/',auth[_0x2094('0x9')](),controller['index']);router[_0x2094('0x8')]('/:id',auth[_0x2094('0x9')](),controller[_0x2094('0xa')]);router['get']('/:id/configurations',auth[_0x2094('0x9')](),controller[_0x2094('0xb')]);router[_0x2094('0x8')](_0x2094('0xc'),auth['isAuthenticated'](),controller[_0x2094('0xd')]);router['post']('/',auth[_0x2094('0x9')](),controller[_0x2094('0xe')]);router[_0x2094('0xf')](_0x2094('0x10'),auth[_0x2094('0x9')](),controller[_0x2094('0x11')]);router[_0x2094('0x12')](_0x2094('0x13'),auth[_0x2094('0x9')](),controller[_0x2094('0x14')]);router[_0x2094('0x15')](_0x2094('0x13'),auth['isAuthenticated'](),controller[_0x2094('0x16')]);module[_0x2094('0x17')]=router; \ No newline at end of file +var _0xe1d2=['getConfigurations','/:id/fields','getFields','create','addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xe1d2,0xb0));var _0x2e1d=function(_0xbb302c,_0x4fab80){_0xbb302c=_0xbb302c-0x0;var _0x34df10=_0xe1d2[_0xbb302c];return _0x34df10;};'use strict';var multer=require(_0x2e1d('0x0'));var util=require(_0x2e1d('0x1'));var path=require(_0x2e1d('0x2'));var timeout=require(_0x2e1d('0x3'));var express=require(_0x2e1d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2e1d('0x5'));var interaction=require(_0x2e1d('0x6'));var config=require(_0x2e1d('0x7'));var controller=require('./intDeskAccount.controller');router[_0x2e1d('0x8')]('/',auth[_0x2e1d('0x9')](),controller['index']);router[_0x2e1d('0x8')](_0x2e1d('0xa'),auth[_0x2e1d('0x9')](),controller[_0x2e1d('0xb')]);router[_0x2e1d('0x8')](_0x2e1d('0xc'),auth[_0x2e1d('0x9')](),controller[_0x2e1d('0xd')]);router['get'](_0x2e1d('0xe'),auth['isAuthenticated'](),controller[_0x2e1d('0xf')]);router['post']('/',auth[_0x2e1d('0x9')](),controller[_0x2e1d('0x10')]);router['post'](_0x2e1d('0xc'),auth[_0x2e1d('0x9')](),controller[_0x2e1d('0x11')]);router['put'](_0x2e1d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2e1d('0x12')](_0x2e1d('0xa'),auth[_0x2e1d('0x9')](),controller[_0x2e1d('0x13')]);module[_0x2e1d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 895a168..26a8548 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 _0x4aa2=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0x4aa2,0xad));var _0x24aa=function(_0x35281b,_0xf4ee9e){_0x35281b=_0x35281b-0x0;var _0x16868c=_0x4aa2[_0x35281b];return _0x16868c;};'use strict';var Sequelize=require(_0x24aa('0x0'));module[_0x24aa('0x1')]={'name':{'type':Sequelize[_0x24aa('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x24aa('0x2')]},'remoteUri':{'type':Sequelize[_0x24aa('0x2')]},'authType':{'type':Sequelize[_0x24aa('0x3')]('basic'),'defaultValue':_0x24aa('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x24aa('0x2')]},'consumerSecret':{'type':Sequelize[_0x24aa('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x24aa('0x2')]},'serverUrl':{'type':Sequelize[_0x24aa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x24aa('0x3')]('integrationTab',_0x24aa('0x5')),'defaultValue':_0x24aa('0x6')}}; \ No newline at end of file +var _0x191e=['basic','ENUM','integrationTab','newTab','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x191e,0xe8));var _0xe191=function(_0x372986,_0x1d56af){_0x372986=_0x372986-0x0;var _0x19229e=_0x191e[_0x372986];return _0x19229e;};'use strict';var Sequelize=require('sequelize');module[_0xe191('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe191('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xe191('0x2')),'defaultValue':_0xe191('0x2')},'password':{'type':Sequelize[_0xe191('0x1')]},'consumerKey':{'type':Sequelize[_0xe191('0x1')]},'consumerSecret':{'type':Sequelize[_0xe191('0x1')]},'token':{'type':Sequelize[_0xe191('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe191('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe191('0x3')](_0xe191('0x4'),_0xe191('0x5')),'defaultValue':_0xe191('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 699e023..5566a52 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 _0x0cb4=['params','attributes','find','catch','create','body','DeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','slice','substring','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show'];(function(_0x1f7428,_0x4efbd9){var _0x364335=function(_0x406d0d){while(--_0x406d0d){_0x1f7428['push'](_0x1f7428['shift']());}};_0x364335(++_0x4efbd9);}(_0x0cb4,0x113));var _0x40cb=function(_0x2507b4,_0x36b6d6){_0x2507b4=_0x2507b4-0x0;var _0x2866dc=_0x0cb4[_0x2507b4];return _0x2866dc;};'use strict';var emlformat=require(_0x40cb('0x0'));var rimraf=require(_0x40cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40cb('0x2'));var rp=require('request-promise');var moment=require(_0x40cb('0x3'));var BPromise=require(_0x40cb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x40cb('0x5'));var sox=require('sox');var csv=require(_0x40cb('0x6'));var ejs=require(_0x40cb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40cb('0x8'));var squel=require(_0x40cb('0x9'));var crypto=require(_0x40cb('0xa'));var jsforce=require(_0x40cb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40cb('0x6'));var querystring=require(_0x40cb('0xc'));var Papa=require(_0x40cb('0xd'));var Redis=require(_0x40cb('0xe'));var authService=require(_0x40cb('0xf'));var qs=require(_0x40cb('0x10'));var as=require(_0x40cb('0x11'));var hardwareService=require(_0x40cb('0x12'));var logger=require(_0x40cb('0x13'))('api');var utils=require(_0x40cb('0x14'));var config=require(_0x40cb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x40cb('0x16'))['db'];var integrations=require(_0x40cb('0x17'));function respondWithStatusCode(_0x54f1b5,_0x1eff98){_0x1eff98=_0x1eff98||0xcc;return function(_0xca7de4){if(_0xca7de4){return _0x54f1b5[_0x40cb('0x18')](_0x1eff98);}return _0x54f1b5[_0x40cb('0x19')](_0x1eff98)[_0x40cb('0x1a')]();};}function respondWithResult(_0x299d6d,_0x317f44){_0x317f44=_0x317f44||0xc8;return function(_0x790540){if(_0x790540){return _0x299d6d['status'](_0x317f44)[_0x40cb('0x1b')](_0x790540);}};}function respondWithFilteredResult(_0x170ef7,_0x5d31ef){return function(_0x3280dc){if(_0x3280dc){var _0x4caa79=typeof _0x5d31ef[_0x40cb('0x1c')]===_0x40cb('0x1d')&&typeof _0x5d31ef[_0x40cb('0x1e')]==='undefined';var _0x499f60=_0x3280dc['count'];var _0x5f0265=_0x4caa79?0x0:_0x5d31ef[_0x40cb('0x1c')];var _0x3c15bc=_0x4caa79?_0x3280dc[_0x40cb('0x1f')]:_0x5d31ef[_0x40cb('0x1c')]+_0x5d31ef[_0x40cb('0x1e')];var _0x51f5e8;if(_0x3c15bc>=_0x499f60){_0x3c15bc=_0x499f60;_0x51f5e8=0xc8;}else{_0x51f5e8=0xce;}_0x170ef7[_0x40cb('0x19')](_0x51f5e8);return _0x170ef7[_0x40cb('0x20')]('Content-Range',_0x5f0265+'-'+_0x3c15bc+'/'+_0x499f60)[_0x40cb('0x1b')](_0x3280dc);}return null;};}function patchUpdates(_0x16995f){return function(_0x21b4ab){try{jsonpatch[_0x40cb('0x21')](_0x21b4ab,_0x16995f,!![]);}catch(_0x46c8c3){return BPromise[_0x40cb('0x22')](_0x46c8c3);}return _0x21b4ab[_0x40cb('0x23')]();};}function saveUpdates(_0x82c86,_0x1ef1fb){return function(_0x3e67e5){if(_0x3e67e5){return _0x3e67e5[_0x40cb('0x24')](_0x82c86)[_0x40cb('0x25')](function(_0x229409){return _0x229409;});}return null;};}function removeEntity(_0x5f4e6c,_0x489468){return function(_0x4e22bf){if(_0x4e22bf){return _0x4e22bf[_0x40cb('0x26')]()[_0x40cb('0x25')](function(){_0x5f4e6c[_0x40cb('0x19')](0xcc)[_0x40cb('0x1a')]();});}};}function handleEntityNotFound(_0x46fd9,_0x2f001d){return function(_0x438b57){if(!_0x438b57){_0x46fd9['sendStatus'](0x194);}return _0x438b57;};}function handleError(_0x5c52d9,_0x288931){_0x288931=_0x288931||0x1f4;return function(_0x15994c){logger[_0x40cb('0x27')](_0x15994c['stack']);if(_0x15994c[_0x40cb('0x28')]){delete _0x15994c[_0x40cb('0x28')];}_0x5c52d9[_0x40cb('0x19')](_0x288931)['send'](_0x15994c);};}exports[_0x40cb('0x29')]=function(_0x307e36,_0x4ae73c){var _0x4687af={},_0x241c6e={},_0x332705={'count':0x0,'rows':[]};var _0x4ee4dd=_['map'](db[_0x40cb('0x2a')][_0x40cb('0x2b')],function(_0x5a1b40){return{'name':_0x5a1b40[_0x40cb('0x2c')],'type':_0x5a1b40[_0x40cb('0x2d')]['key']};});_0x241c6e[_0x40cb('0x2e')]=_[_0x40cb('0x2f')](_0x4ee4dd,'name');_0x241c6e[_0x40cb('0x30')]=_[_0x40cb('0x31')](_0x307e36[_0x40cb('0x30')]);_0x241c6e[_0x40cb('0x32')]=_[_0x40cb('0x33')](_0x241c6e[_0x40cb('0x2e')],_0x241c6e[_0x40cb('0x30')]);_0x4687af['attributes']=_[_0x40cb('0x33')](_0x241c6e[_0x40cb('0x2e')],qs[_0x40cb('0x34')](_0x307e36[_0x40cb('0x30')]['fields']));_0x4687af['attributes']=_0x4687af['attributes'][_0x40cb('0x35')]?_0x4687af['attributes']:_0x241c6e[_0x40cb('0x2e')];if(!_0x307e36['query']['hasOwnProperty'](_0x40cb('0x36'))){_0x4687af[_0x40cb('0x1e')]=qs[_0x40cb('0x1e')](_0x307e36[_0x40cb('0x30')][_0x40cb('0x1e')]);_0x4687af[_0x40cb('0x1c')]=qs[_0x40cb('0x1c')](_0x307e36[_0x40cb('0x30')][_0x40cb('0x1c')]);}_0x4687af[_0x40cb('0x37')]=qs['sort'](_0x307e36['query'][_0x40cb('0x38')]);_0x4687af[_0x40cb('0x39')]=qs[_0x40cb('0x32')](_[_0x40cb('0x3a')](_0x307e36[_0x40cb('0x30')],_0x241c6e['filters']),_0x4ee4dd);if(_0x307e36[_0x40cb('0x30')][_0x40cb('0x3b')]){_0x4687af['where']=_[_0x40cb('0x3c')](_0x4687af[_0x40cb('0x39')],{'$or':_[_0x40cb('0x2f')](_0x4ee4dd,function(_0x172e7f){if(_0x172e7f[_0x40cb('0x2d')]!=='VIRTUAL'){var _0x11a958={};_0x11a958[_0x172e7f['name']]={'$like':'%'+_0x307e36[_0x40cb('0x30')][_0x40cb('0x3b')]+'%'};return _0x11a958;}})});}_0x4687af=_['merge']({},_0x4687af,_0x307e36[_0x40cb('0x3d')]);var _0x55b8f9={'where':_0x4687af[_0x40cb('0x39')]};return db[_0x40cb('0x2a')]['count'](_0x55b8f9)[_0x40cb('0x25')](function(_0x300298){_0x332705[_0x40cb('0x1f')]=_0x300298;if(_0x307e36[_0x40cb('0x30')][_0x40cb('0x3e')]){_0x4687af[_0x40cb('0x3f')]=[{'all':!![]}];}return db[_0x40cb('0x2a')][_0x40cb('0x40')](_0x4687af);})[_0x40cb('0x25')](function(_0x27c645){_0x332705[_0x40cb('0x41')]=_0x27c645;return _0x332705;})['then'](respondWithFilteredResult(_0x4ae73c,_0x4687af))['catch'](handleError(_0x4ae73c,null));};exports[_0x40cb('0x42')]=function(_0x2e32b2,_0x30be38){var _0x246bb2={'raw':![],'where':{'id':_0x2e32b2[_0x40cb('0x43')]['id']}},_0x120777={};_0x120777['model']=_[_0x40cb('0x31')](db[_0x40cb('0x2a')][_0x40cb('0x2b')]);_0x120777[_0x40cb('0x30')]=_[_0x40cb('0x31')](_0x2e32b2['query']);_0x120777[_0x40cb('0x32')]=_[_0x40cb('0x33')](_0x120777['model'],_0x120777[_0x40cb('0x30')]);_0x246bb2[_0x40cb('0x44')]=_[_0x40cb('0x33')](_0x120777[_0x40cb('0x2e')],qs['fields'](_0x2e32b2[_0x40cb('0x30')]['fields']));_0x246bb2[_0x40cb('0x44')]=_0x246bb2[_0x40cb('0x44')][_0x40cb('0x35')]?_0x246bb2[_0x40cb('0x44')]:_0x120777['model'];if(_0x2e32b2[_0x40cb('0x30')][_0x40cb('0x3e')]){_0x246bb2[_0x40cb('0x3f')]=[{'all':!![]}];}_0x246bb2=_[_0x40cb('0x3c')]({},_0x246bb2,_0x2e32b2[_0x40cb('0x3d')]);return db[_0x40cb('0x2a')][_0x40cb('0x45')](_0x246bb2)['then'](handleEntityNotFound(_0x30be38,null))[_0x40cb('0x25')](respondWithResult(_0x30be38,null))[_0x40cb('0x46')](handleError(_0x30be38,null));};exports[_0x40cb('0x47')]=function(_0x58cbbd,_0x4b64c4){return db[_0x40cb('0x2a')][_0x40cb('0x47')](_0x58cbbd[_0x40cb('0x48')],{})[_0x40cb('0x25')](respondWithResult(_0x4b64c4,0xc9))[_0x40cb('0x46')](handleError(_0x4b64c4,null));};exports['update']=function(_0x5dfc70,_0x47f93f){if(_0x5dfc70[_0x40cb('0x48')]['id']){delete _0x5dfc70['body']['id'];}return db[_0x40cb('0x2a')][_0x40cb('0x45')]({'where':{'id':_0x5dfc70[_0x40cb('0x43')]['id']}})[_0x40cb('0x25')](handleEntityNotFound(_0x47f93f,null))[_0x40cb('0x25')](saveUpdates(_0x5dfc70[_0x40cb('0x48')],null))[_0x40cb('0x25')](respondWithResult(_0x47f93f,null))[_0x40cb('0x46')](handleError(_0x47f93f,null));};exports[_0x40cb('0x26')]=function(_0x2ec14d,_0x1d611c){return db['DeskAccount'][_0x40cb('0x45')]({'where':{'id':_0x2ec14d['params']['id']}})[_0x40cb('0x25')](handleEntityNotFound(_0x1d611c,null))[_0x40cb('0x25')](removeEntity(_0x1d611c,null))[_0x40cb('0x46')](handleError(_0x1d611c,null));};exports['getConfigurations']=function(_0x42c20f,_0x36f7e6,_0x513911){var _0x1a63b4={};var _0x496458={};var _0xff4577;var _0x41a970;return db['DeskAccount']['findOne']({'where':{'id':_0x42c20f[_0x40cb('0x43')]['id']}})[_0x40cb('0x25')](handleEntityNotFound(_0x36f7e6,null))['then'](function(_0x21311b){if(_0x21311b){_0xff4577=_0x21311b;_0x496458[_0x40cb('0x2e')]=_[_0x40cb('0x31')](db[_0x40cb('0x49')][_0x40cb('0x2b')]);_0x496458[_0x40cb('0x30')]=_[_0x40cb('0x31')](_0x42c20f['query']);_0x496458[_0x40cb('0x32')]=_[_0x40cb('0x33')](_0x496458['model'],_0x496458[_0x40cb('0x30')]);_0x1a63b4[_0x40cb('0x44')]=_[_0x40cb('0x33')](_0x496458[_0x40cb('0x2e')],qs[_0x40cb('0x34')](_0x42c20f['query'][_0x40cb('0x34')]));_0x1a63b4['attributes']=_0x1a63b4['attributes'][_0x40cb('0x35')]?_0x1a63b4[_0x40cb('0x44')]:_0x496458[_0x40cb('0x2e')];_0x1a63b4['order']=qs[_0x40cb('0x38')](_0x42c20f[_0x40cb('0x30')][_0x40cb('0x38')]);_0x1a63b4['where']=qs['filters'](_[_0x40cb('0x3a')](_0x42c20f['query'],_0x496458[_0x40cb('0x32')]));if(_0x42c20f[_0x40cb('0x30')][_0x40cb('0x3b')]){_0x1a63b4[_0x40cb('0x39')]=_['merge'](_0x1a63b4[_0x40cb('0x39')],{'$or':_[_0x40cb('0x2f')](_0x1a63b4[_0x40cb('0x44')],function(_0x455165){var _0x2d8990={};_0x2d8990[_0x455165]={'$like':'%'+_0x42c20f[_0x40cb('0x30')][_0x40cb('0x3b')]+'%'};return _0x2d8990;})});}_0x1a63b4=_[_0x40cb('0x3c')]({},_0x1a63b4,_0x42c20f[_0x40cb('0x3d')]);return _0xff4577[_0x40cb('0x4a')](_0x1a63b4);}})['then'](function(_0x2a3469){if(_0x2a3469){_0x41a970=_0x2a3469['length'];if(!_0x42c20f[_0x40cb('0x30')][_0x40cb('0x4b')](_0x40cb('0x36'))){_0x1a63b4['limit']=qs[_0x40cb('0x1e')](_0x42c20f[_0x40cb('0x30')][_0x40cb('0x1e')]);_0x1a63b4[_0x40cb('0x1c')]=qs['offset'](_0x42c20f[_0x40cb('0x30')]['offset']);}return _0xff4577[_0x40cb('0x4a')](_0x1a63b4);}})[_0x40cb('0x25')](function(_0x92a7d9){if(_0x92a7d9){return _0x92a7d9?{'count':_0x41a970,'rows':_0x92a7d9}:null;}})['then'](respondWithResult(_0x36f7e6,null))[_0x40cb('0x46')](handleError(_0x36f7e6,null));};exports[_0x40cb('0x4c')]=function(_0x466417,_0x508cb7,_0x2a0818){if(_0x466417[_0x40cb('0x48')]['id']){delete _0x466417[_0x40cb('0x48')]['id'];}return db[_0x40cb('0x2a')][_0x40cb('0x4d')]({'where':{'id':_0x466417[_0x40cb('0x43')]['id']}})[_0x40cb('0x25')](handleEntityNotFound(_0x508cb7,null))[_0x40cb('0x25')](function(_0x43d928){if(_0x43d928){_0x466417[_0x40cb('0x48')][_0x40cb('0x4e')]=_0x43d928['id'];_0x466417[_0x40cb('0x48')][_0x40cb('0x4f')]=integrations[_0x40cb('0x50')](_0x466417[_0x40cb('0x48')][_0x40cb('0x51')],_0x466417['body']['type']);_0x466417[_0x40cb('0x48')]['Descriptions']=integrations[_0x40cb('0x52')](_0x466417[_0x40cb('0x48')][_0x40cb('0x51')],_0x466417[_0x40cb('0x48')][_0x40cb('0x2d')]);return db[_0x40cb('0x49')][_0x40cb('0x47')](_0x466417[_0x40cb('0x48')],{'include':[{'model':db[_0x40cb('0x53')],'as':'Subjects'},{'model':db[_0x40cb('0x53')],'as':_0x40cb('0x54')}]});}return null;})[_0x40cb('0x25')](respondWithResult(_0x508cb7,null))[_0x40cb('0x46')](handleError(_0x508cb7,null));};exports[_0x40cb('0x55')]=function(_0x206263,_0x3ab1c5,_0x2dcba2){var _0x181f43=[{'name':_0x40cb('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 _0x435785='';return db[_0x40cb('0x2a')][_0x40cb('0x4d')]({'where':{'id':_0x206263[_0x40cb('0x43')]['id']},'attributes':['id',_0x40cb('0x57'),'authType',_0x40cb('0x58'),_0x40cb('0x59'),_0x40cb('0x5a'),_0x40cb('0x5b'),'token','tokenSecret']})['then'](handleEntityNotFound(_0x3ab1c5,null))[_0x40cb('0x25')](function(_0xc2f5dc){if(_0xc2f5dc){_0x435785=_0xc2f5dc[_0x40cb('0x57')];var _0x109391=_0x435785[_0x40cb('0x5c')](-0x1);if(_0x109391==='/'){_0x435785=_0x435785[_0x40cb('0x5d')](0x0,_0x435785['lastIndexOf'](_0x109391));}var _0x2da51a={'method':_0x40cb('0x5e'),'uri':util[_0x40cb('0x5f')](_0x40cb('0x60'),_0x435785),'headers':{'Content-Type':_0x40cb('0x61'),'Accept':_0x40cb('0x61')},'json':!![]};if(_0xc2f5dc[_0x40cb('0x62')]===_0x40cb('0x63')){_0x2da51a[_0x40cb('0x64')][_0x40cb('0x65')]=util[_0x40cb('0x5f')](_0x40cb('0x66'),new Buffer(util['format']('%s:%s',_0xc2f5dc[_0x40cb('0x58')],_0xc2f5dc['password']))[_0x40cb('0x67')](_0x40cb('0x68')));}return rp(_0x2da51a)[_0x40cb('0x25')](function(_0x128fb1){return _0x181f43[_0x40cb('0x69')](_[_0x40cb('0x2f')](_0x128fb1['_embedded'][_0x40cb('0x6a')],function(_0x57ccab){return{'id':_0x57ccab[_0x40cb('0x28')],'name':_0x57ccab['name'],'type':_0x57ccab[_0x40cb('0x2d')],'active':_0x57ccab[_0x40cb('0x6b')],'label':_0x57ccab[_0x40cb('0x6c')],'custom':!![]};}));});}})[_0x40cb('0x25')](function(_0x4a472b){return{'count':_0x4a472b[_0x40cb('0x35')],'rows':_0x4a472b};})['then'](respondWithResult(_0x3ab1c5,null))[_0x40cb('0x46')](function(_0x476a2a){var _0xbeeb67=_0x206263[_0x40cb('0x30')][_0x40cb('0x6d')]?0x1f4:_0x476a2a['statusCode']||0x1f4;logger['error'](_0x40cb('0x6e'),_0x40cb('0x55'),_0xbeeb67,JSON[_0x40cb('0x6f')](_0x476a2a));delete _0x476a2a[_0x40cb('0x28')];if(_0xbeeb67===0x191){_0xbeeb67=0x190;}_0x3ab1c5[_0x40cb('0x19')](_0xbeeb67)['send'](_0x206263['query'][_0x40cb('0x6d')]?{'message':_0x40cb('0x70'),'statusCode':_0x476a2a[_0x40cb('0x71')]}:_0x476a2a);});}; \ No newline at end of file +var _0x9fed=['body','update','find','destroy','getConfigurations','findOne','DeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','create'];(function(_0x48f95d,_0x988602){var _0x3d5843=function(_0x3ba4a9){while(--_0x3ba4a9){_0x48f95d['push'](_0x48f95d['shift']());}};_0x3d5843(++_0x988602);}(_0x9fed,0xaa));var _0xd9fe=function(_0x87b87e,_0x3d52b0){_0x87b87e=_0x87b87e-0x0;var _0x242d9d=_0x9fed[_0x87b87e];return _0x242d9d;};'use strict';var emlformat=require(_0xd9fe('0x0'));var rimraf=require(_0xd9fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9fe('0x2'));var rp=require('request-promise');var moment=require(_0xd9fe('0x3'));var BPromise=require(_0xd9fe('0x4'));var Mustache=require(_0xd9fe('0x5'));var util=require(_0xd9fe('0x6'));var path=require('path');var sox=require(_0xd9fe('0x7'));var csv=require('to-csv');var ejs=require(_0xd9fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd9fe('0x9'));var squel=require(_0xd9fe('0xa'));var crypto=require(_0xd9fe('0xb'));var jsforce=require(_0xd9fe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd9fe('0xd'));var querystring=require(_0xd9fe('0xe'));var Papa=require(_0xd9fe('0xf'));var Redis=require('ioredis');var authService=require(_0xd9fe('0x10'));var qs=require(_0xd9fe('0x11'));var as=require(_0xd9fe('0x12'));var hardwareService=require(_0xd9fe('0x13'));var logger=require(_0xd9fe('0x14'))(_0xd9fe('0x15'));var utils=require(_0xd9fe('0x16'));var config=require(_0xd9fe('0x17'));var licenseUtil=require(_0xd9fe('0x18'));var db=require(_0xd9fe('0x19'))['db'];var integrations=require(_0xd9fe('0x1a'));function respondWithStatusCode(_0x9032ec,_0x41d9a1){_0x41d9a1=_0x41d9a1||0xcc;return function(_0x2c1ff4){if(_0x2c1ff4){return _0x9032ec[_0xd9fe('0x1b')](_0x41d9a1);}return _0x9032ec[_0xd9fe('0x1c')](_0x41d9a1)[_0xd9fe('0x1d')]();};}function respondWithResult(_0x7d41be,_0x38a76f){_0x38a76f=_0x38a76f||0xc8;return function(_0x3a658c){if(_0x3a658c){return _0x7d41be[_0xd9fe('0x1c')](_0x38a76f)['json'](_0x3a658c);}};}function respondWithFilteredResult(_0x1ac0ab,_0x21175e){return function(_0x1e6268){if(_0x1e6268){var _0x4de357=typeof _0x21175e['offset']===_0xd9fe('0x1e')&&typeof _0x21175e[_0xd9fe('0x1f')]==='undefined';var _0x2f266d=_0x1e6268[_0xd9fe('0x20')];var _0x14d6c4=_0x4de357?0x0:_0x21175e[_0xd9fe('0x21')];var _0x31718a=_0x4de357?_0x1e6268[_0xd9fe('0x20')]:_0x21175e[_0xd9fe('0x21')]+_0x21175e['limit'];var _0x4cab26;if(_0x31718a>=_0x2f266d){_0x31718a=_0x2f266d;_0x4cab26=0xc8;}else{_0x4cab26=0xce;}_0x1ac0ab[_0xd9fe('0x1c')](_0x4cab26);return _0x1ac0ab[_0xd9fe('0x22')](_0xd9fe('0x23'),_0x14d6c4+'-'+_0x31718a+'/'+_0x2f266d)[_0xd9fe('0x24')](_0x1e6268);}return null;};}function patchUpdates(_0x351d16){return function(_0x1b7d0f){try{jsonpatch[_0xd9fe('0x25')](_0x1b7d0f,_0x351d16,!![]);}catch(_0x3c3488){return BPromise[_0xd9fe('0x26')](_0x3c3488);}return _0x1b7d0f[_0xd9fe('0x27')]();};}function saveUpdates(_0x319f3d,_0x185b31){return function(_0x2e7de5){if(_0x2e7de5){return _0x2e7de5['update'](_0x319f3d)['then'](function(_0x21d8c3){return _0x21d8c3;});}return null;};}function removeEntity(_0x22f74e,_0x823973){return function(_0x466481){if(_0x466481){return _0x466481['destroy']()[_0xd9fe('0x28')](function(){_0x22f74e[_0xd9fe('0x1c')](0xcc)[_0xd9fe('0x1d')]();});}};}function handleEntityNotFound(_0x5ce959,_0x1c35da){return function(_0x1b5450){if(!_0x1b5450){_0x5ce959['sendStatus'](0x194);}return _0x1b5450;};}function handleError(_0x6d510b,_0x3f6e40){_0x3f6e40=_0x3f6e40||0x1f4;return function(_0x480119){logger['error'](_0x480119[_0xd9fe('0x29')]);if(_0x480119[_0xd9fe('0x2a')]){delete _0x480119[_0xd9fe('0x2a')];}_0x6d510b[_0xd9fe('0x1c')](_0x3f6e40)[_0xd9fe('0x2b')](_0x480119);};}exports[_0xd9fe('0x2c')]=function(_0x387820,_0x7d87d0){var _0x4ee052={},_0xe9b102={},_0x3b9c95={'count':0x0,'rows':[]};var _0xfe6585=_[_0xd9fe('0x2d')](db[_0xd9fe('0x2e')][_0xd9fe('0x2f')],function(_0x1e59c9){return{'name':_0x1e59c9[_0xd9fe('0x30')],'type':_0x1e59c9[_0xd9fe('0x31')][_0xd9fe('0x32')]};});_0xe9b102[_0xd9fe('0x33')]=_[_0xd9fe('0x2d')](_0xfe6585,_0xd9fe('0x2a'));_0xe9b102['query']=_[_0xd9fe('0x34')](_0x387820[_0xd9fe('0x35')]);_0xe9b102[_0xd9fe('0x36')]=_['intersection'](_0xe9b102[_0xd9fe('0x33')],_0xe9b102[_0xd9fe('0x35')]);_0x4ee052['attributes']=_[_0xd9fe('0x37')](_0xe9b102['model'],qs[_0xd9fe('0x38')](_0x387820['query'][_0xd9fe('0x38')]));_0x4ee052[_0xd9fe('0x39')]=_0x4ee052[_0xd9fe('0x39')]['length']?_0x4ee052[_0xd9fe('0x39')]:_0xe9b102[_0xd9fe('0x33')];if(!_0x387820[_0xd9fe('0x35')]['hasOwnProperty'](_0xd9fe('0x3a'))){_0x4ee052['limit']=qs['limit'](_0x387820['query'][_0xd9fe('0x1f')]);_0x4ee052[_0xd9fe('0x21')]=qs[_0xd9fe('0x21')](_0x387820['query'][_0xd9fe('0x21')]);}_0x4ee052['order']=qs[_0xd9fe('0x3b')](_0x387820[_0xd9fe('0x35')]['sort']);_0x4ee052[_0xd9fe('0x3c')]=qs[_0xd9fe('0x36')](_[_0xd9fe('0x3d')](_0x387820[_0xd9fe('0x35')],_0xe9b102['filters']),_0xfe6585);if(_0x387820['query'][_0xd9fe('0x3e')]){_0x4ee052[_0xd9fe('0x3c')]=_[_0xd9fe('0x3f')](_0x4ee052[_0xd9fe('0x3c')],{'$or':_[_0xd9fe('0x2d')](_0xfe6585,function(_0x4677e8){if(_0x4677e8[_0xd9fe('0x31')]!==_0xd9fe('0x40')){var _0x5d52b={};_0x5d52b[_0x4677e8[_0xd9fe('0x2a')]]={'$like':'%'+_0x387820[_0xd9fe('0x35')][_0xd9fe('0x3e')]+'%'};return _0x5d52b;}})});}_0x4ee052=_['merge']({},_0x4ee052,_0x387820[_0xd9fe('0x41')]);var _0x229abb={'where':_0x4ee052[_0xd9fe('0x3c')]};return db[_0xd9fe('0x2e')][_0xd9fe('0x20')](_0x229abb)['then'](function(_0x215bba){_0x3b9c95[_0xd9fe('0x20')]=_0x215bba;if(_0x387820[_0xd9fe('0x35')]['includeAll']){_0x4ee052[_0xd9fe('0x42')]=[{'all':!![]}];}return db[_0xd9fe('0x2e')][_0xd9fe('0x43')](_0x4ee052);})[_0xd9fe('0x28')](function(_0x3b106c){_0x3b9c95['rows']=_0x3b106c;return _0x3b9c95;})[_0xd9fe('0x28')](respondWithFilteredResult(_0x7d87d0,_0x4ee052))[_0xd9fe('0x44')](handleError(_0x7d87d0,null));};exports[_0xd9fe('0x45')]=function(_0x188c8e,_0x356d2a){var _0x542acf={'raw':![],'where':{'id':_0x188c8e[_0xd9fe('0x46')]['id']}},_0x418335={};_0x418335[_0xd9fe('0x33')]=_[_0xd9fe('0x34')](db['DeskAccount'][_0xd9fe('0x2f')]);_0x418335[_0xd9fe('0x35')]=_[_0xd9fe('0x34')](_0x188c8e[_0xd9fe('0x35')]);_0x418335[_0xd9fe('0x36')]=_[_0xd9fe('0x37')](_0x418335[_0xd9fe('0x33')],_0x418335[_0xd9fe('0x35')]);_0x542acf[_0xd9fe('0x39')]=_[_0xd9fe('0x37')](_0x418335['model'],qs[_0xd9fe('0x38')](_0x188c8e[_0xd9fe('0x35')][_0xd9fe('0x38')]));_0x542acf['attributes']=_0x542acf[_0xd9fe('0x39')][_0xd9fe('0x47')]?_0x542acf[_0xd9fe('0x39')]:_0x418335['model'];if(_0x188c8e[_0xd9fe('0x35')][_0xd9fe('0x48')]){_0x542acf[_0xd9fe('0x42')]=[{'all':!![]}];}_0x542acf=_[_0xd9fe('0x3f')]({},_0x542acf,_0x188c8e[_0xd9fe('0x41')]);return db[_0xd9fe('0x2e')]['find'](_0x542acf)[_0xd9fe('0x28')](handleEntityNotFound(_0x356d2a,null))[_0xd9fe('0x28')](respondWithResult(_0x356d2a,null))[_0xd9fe('0x44')](handleError(_0x356d2a,null));};exports[_0xd9fe('0x49')]=function(_0x36408a,_0x45d658){return db[_0xd9fe('0x2e')]['create'](_0x36408a[_0xd9fe('0x4a')],{})[_0xd9fe('0x28')](respondWithResult(_0x45d658,0xc9))[_0xd9fe('0x44')](handleError(_0x45d658,null));};exports[_0xd9fe('0x4b')]=function(_0x36ec6e,_0x218219){if(_0x36ec6e[_0xd9fe('0x4a')]['id']){delete _0x36ec6e[_0xd9fe('0x4a')]['id'];}return db[_0xd9fe('0x2e')][_0xd9fe('0x4c')]({'where':{'id':_0x36ec6e[_0xd9fe('0x46')]['id']}})[_0xd9fe('0x28')](handleEntityNotFound(_0x218219,null))[_0xd9fe('0x28')](saveUpdates(_0x36ec6e[_0xd9fe('0x4a')],null))['then'](respondWithResult(_0x218219,null))[_0xd9fe('0x44')](handleError(_0x218219,null));};exports[_0xd9fe('0x4d')]=function(_0x5e312b,_0x31547e){return db[_0xd9fe('0x2e')][_0xd9fe('0x4c')]({'where':{'id':_0x5e312b['params']['id']}})[_0xd9fe('0x28')](handleEntityNotFound(_0x31547e,null))[_0xd9fe('0x28')](removeEntity(_0x31547e,null))['catch'](handleError(_0x31547e,null));};exports[_0xd9fe('0x4e')]=function(_0x49e1cd,_0xe9339d,_0x279bfd){var _0x28fa4d={};var _0x583c0d={};var _0x44c4d6;var _0x2ffcbf;return db[_0xd9fe('0x2e')][_0xd9fe('0x4f')]({'where':{'id':_0x49e1cd[_0xd9fe('0x46')]['id']}})[_0xd9fe('0x28')](handleEntityNotFound(_0xe9339d,null))[_0xd9fe('0x28')](function(_0x2423c2){if(_0x2423c2){_0x44c4d6=_0x2423c2;_0x583c0d[_0xd9fe('0x33')]=_[_0xd9fe('0x34')](db[_0xd9fe('0x50')][_0xd9fe('0x2f')]);_0x583c0d['query']=_[_0xd9fe('0x34')](_0x49e1cd['query']);_0x583c0d['filters']=_[_0xd9fe('0x37')](_0x583c0d[_0xd9fe('0x33')],_0x583c0d[_0xd9fe('0x35')]);_0x28fa4d[_0xd9fe('0x39')]=_[_0xd9fe('0x37')](_0x583c0d[_0xd9fe('0x33')],qs[_0xd9fe('0x38')](_0x49e1cd[_0xd9fe('0x35')][_0xd9fe('0x38')]));_0x28fa4d[_0xd9fe('0x39')]=_0x28fa4d[_0xd9fe('0x39')]['length']?_0x28fa4d[_0xd9fe('0x39')]:_0x583c0d[_0xd9fe('0x33')];_0x28fa4d[_0xd9fe('0x51')]=qs[_0xd9fe('0x3b')](_0x49e1cd[_0xd9fe('0x35')][_0xd9fe('0x3b')]);_0x28fa4d[_0xd9fe('0x3c')]=qs[_0xd9fe('0x36')](_[_0xd9fe('0x3d')](_0x49e1cd['query'],_0x583c0d['filters']));if(_0x49e1cd[_0xd9fe('0x35')][_0xd9fe('0x3e')]){_0x28fa4d[_0xd9fe('0x3c')]=_[_0xd9fe('0x3f')](_0x28fa4d[_0xd9fe('0x3c')],{'$or':_['map'](_0x28fa4d['attributes'],function(_0x2145f9){var _0x410d33={};_0x410d33[_0x2145f9]={'$like':'%'+_0x49e1cd[_0xd9fe('0x35')][_0xd9fe('0x3e')]+'%'};return _0x410d33;})});}_0x28fa4d=_['merge']({},_0x28fa4d,_0x49e1cd['options']);return _0x44c4d6[_0xd9fe('0x4e')](_0x28fa4d);}})[_0xd9fe('0x28')](function(_0x501abd){if(_0x501abd){_0x2ffcbf=_0x501abd['length'];if(!_0x49e1cd['query']['hasOwnProperty'](_0xd9fe('0x3a'))){_0x28fa4d[_0xd9fe('0x1f')]=qs[_0xd9fe('0x1f')](_0x49e1cd[_0xd9fe('0x35')][_0xd9fe('0x1f')]);_0x28fa4d[_0xd9fe('0x21')]=qs['offset'](_0x49e1cd[_0xd9fe('0x35')][_0xd9fe('0x21')]);}return _0x44c4d6[_0xd9fe('0x4e')](_0x28fa4d);}})[_0xd9fe('0x28')](function(_0x56c4a1){if(_0x56c4a1){return _0x56c4a1?{'count':_0x2ffcbf,'rows':_0x56c4a1}:null;}})[_0xd9fe('0x28')](respondWithResult(_0xe9339d,null))['catch'](handleError(_0xe9339d,null));};exports[_0xd9fe('0x52')]=function(_0x41f4cd,_0x52ec07,_0x539db9){if(_0x41f4cd[_0xd9fe('0x4a')]['id']){delete _0x41f4cd['body']['id'];}return db[_0xd9fe('0x2e')][_0xd9fe('0x4f')]({'where':{'id':_0x41f4cd[_0xd9fe('0x46')]['id']}})['then'](handleEntityNotFound(_0x52ec07,null))[_0xd9fe('0x28')](function(_0xf43d78){if(_0xf43d78){_0x41f4cd['body'][_0xd9fe('0x53')]=_0xf43d78['id'];_0x41f4cd[_0xd9fe('0x4a')][_0xd9fe('0x54')]=integrations[_0xd9fe('0x55')](_0x41f4cd[_0xd9fe('0x4a')][_0xd9fe('0x56')],_0x41f4cd[_0xd9fe('0x4a')][_0xd9fe('0x31')]);_0x41f4cd['body']['Descriptions']=integrations[_0xd9fe('0x57')](_0x41f4cd[_0xd9fe('0x4a')]['channel'],_0x41f4cd[_0xd9fe('0x4a')][_0xd9fe('0x31')]);return db[_0xd9fe('0x50')][_0xd9fe('0x49')](_0x41f4cd['body'],{'include':[{'model':db['DeskField'],'as':_0xd9fe('0x54')},{'model':db[_0xd9fe('0x58')],'as':_0xd9fe('0x59')}]});}return null;})[_0xd9fe('0x28')](respondWithResult(_0x52ec07,null))['catch'](handleError(_0x52ec07,null));};exports[_0xd9fe('0x5a')]=function(_0x345882,_0x395095,_0x13df82){var _0x5abc01=[{'name':'priority','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 _0x209180='';return db[_0xd9fe('0x2e')][_0xd9fe('0x4f')]({'where':{'id':_0x345882[_0xd9fe('0x46')]['id']},'attributes':['id',_0xd9fe('0x5b'),_0xd9fe('0x5c'),_0xd9fe('0x5d'),_0xd9fe('0x5e'),_0xd9fe('0x5f'),_0xd9fe('0x60'),'token',_0xd9fe('0x61')]})[_0xd9fe('0x28')](handleEntityNotFound(_0x395095,null))[_0xd9fe('0x28')](function(_0x3751e5){if(_0x3751e5){_0x209180=_0x3751e5['remoteUri'];var _0x4a3e1b=_0x209180['slice'](-0x1);if(_0x4a3e1b==='/'){_0x209180=_0x209180[_0xd9fe('0x62')](0x0,_0x209180[_0xd9fe('0x63')](_0x4a3e1b));}var _0x41b26d={'method':_0xd9fe('0x64'),'uri':util[_0xd9fe('0x65')](_0xd9fe('0x66'),_0x209180),'headers':{'Content-Type':'application/json','Accept':_0xd9fe('0x67')},'json':!![]};if(_0x3751e5['authType']===_0xd9fe('0x68')){_0x41b26d[_0xd9fe('0x69')][_0xd9fe('0x6a')]=util[_0xd9fe('0x65')](_0xd9fe('0x6b'),new Buffer(util[_0xd9fe('0x65')](_0xd9fe('0x6c'),_0x3751e5[_0xd9fe('0x5d')],_0x3751e5[_0xd9fe('0x5e')]))[_0xd9fe('0x6d')](_0xd9fe('0x6e')));}return rp(_0x41b26d)['then'](function(_0x66b884){return _0x5abc01[_0xd9fe('0x6f')](_[_0xd9fe('0x2d')](_0x66b884[_0xd9fe('0x70')][_0xd9fe('0x71')],function(_0xb7dc19){return{'id':_0xb7dc19[_0xd9fe('0x2a')],'name':_0xb7dc19[_0xd9fe('0x2a')],'type':_0xb7dc19[_0xd9fe('0x31')],'active':_0xb7dc19[_0xd9fe('0x72')],'label':_0xb7dc19[_0xd9fe('0x73')],'custom':!![]};}));});}})[_0xd9fe('0x28')](function(_0x45a877){return{'count':_0x45a877['length'],'rows':_0x45a877};})[_0xd9fe('0x28')](respondWithResult(_0x395095,null))[_0xd9fe('0x44')](function(_0x1d2058){var _0x122705=_0x345882[_0xd9fe('0x35')]['test']?0x1f4:_0x1d2058[_0xd9fe('0x74')]||0x1f4;logger[_0xd9fe('0x75')](_0xd9fe('0x76'),'getFields',_0x122705,JSON[_0xd9fe('0x77')](_0x1d2058));delete _0x1d2058[_0xd9fe('0x2a')];if(_0x122705===0x191){_0x122705=0x190;}_0x395095[_0xd9fe('0x1c')](_0x122705)[_0xd9fe('0x2b')](_0x345882[_0xd9fe('0x35')][_0xd9fe('0x78')]?{'message':_0xd9fe('0x79'),'statusCode':_0x1d2058['statusCode']}:_0x1d2058);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 894e081..03fc0e2 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 _0x6448=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x9f3e89,_0x39b12c){var _0x12d365=function(_0x2d9326){while(--_0x2d9326){_0x9f3e89['push'](_0x9f3e89['shift']());}};_0x12d365(++_0x39b12c);}(_0x6448,0x1da));var _0x8644=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6448[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8644('0x0'));var logger=require(_0x8644('0x1'))(_0x8644('0x2'));var moment=require(_0x8644('0x3'));var BPromise=require(_0x8644('0x4'));var rp=require(_0x8644('0x5'));var fs=require('fs');var path=require(_0x8644('0x6'));var rimraf=require(_0x8644('0x7'));var config=require(_0x8644('0x8'));var attributes=require(_0x8644('0x9'));var integrations=require(_0x8644('0xa'));module['exports']=function(_0x3939c2,_0xb7f46e){return _0x3939c2[_0x8644('0xb')]('DeskAccount',attributes,{'tableName':_0x8644('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf75c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x202953,_0x550657){var _0x31d072=function(_0x803a72){while(--_0x803a72){_0x202953['push'](_0x202953['shift']());}};_0x31d072(++_0x550657);}(_0xf75c,0x1ed));var _0xcf75=function(_0x3278f0,_0x4d7a43){_0x3278f0=_0x3278f0-0x0;var _0x241ff5=_0xf75c[_0x3278f0];return _0x241ff5;};'use strict';var _=require(_0xcf75('0x0'));var util=require(_0xcf75('0x1'));var logger=require(_0xcf75('0x2'))(_0xcf75('0x3'));var moment=require(_0xcf75('0x4'));var BPromise=require(_0xcf75('0x5'));var rp=require(_0xcf75('0x6'));var fs=require('fs');var path=require(_0xcf75('0x7'));var rimraf=require(_0xcf75('0x8'));var config=require('../../config/environment');var attributes=require(_0xcf75('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5a4fd6,_0xf380c2){return _0x5a4fd6[_0xcf75('0xa')](_0xcf75('0xb'),attributes,{'tableName':_0xcf75('0xc'),'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 84d8f72..ae904d0 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 _0x5297=['limit','include','map','attributes','model','then','info','debug','GetDeskAccount','ShowDeskAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','where'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x5297,0xf9));var _0x7529=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0x5297[_0x5d2ed9];return _0x4262c5;};'use strict';var _=require(_0x7529('0x0'));var util=require(_0x7529('0x1'));var moment=require(_0x7529('0x2'));var BPromise=require(_0x7529('0x3'));var rs=require(_0x7529('0x4'));var fs=require('fs');var Redis=require(_0x7529('0x5'));var db=require(_0x7529('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7529('0x7'))(_0x7529('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7529('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38e304,_0x2edc55,_0x4c22c4){return new BPromise(function(_0x5816ce,_0x1b9c31){return client[_0x7529('0xa')](_0x38e304,_0x4c22c4)['then'](function(_0x379632){logger['info']('DeskAccount,\x20%s,\x20%s',_0x2edc55,_0x7529('0xb'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2edc55,_0x7529('0xb'),JSON[_0x7529('0xc')](_0x379632));if(_0x379632['error']){if(_0x379632[_0x7529('0xd')][_0x7529('0xe')]===0x1f4){logger['error'](_0x7529('0xf'),_0x2edc55,_0x379632['error']['message']);return _0x1b9c31(_0x379632[_0x7529('0xd')][_0x7529('0x10')]);}logger['error'](_0x7529('0xf'),_0x2edc55,_0x379632[_0x7529('0xd')]['message']);return _0x5816ce(_0x379632['error']['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x2edc55,_0x7529('0xb'));_0x5816ce(_0x379632[_0x7529('0x11')][_0x7529('0x10')]);}})[_0x7529('0x12')](function(_0x4be55c){logger[_0x7529('0xd')](_0x7529('0xf'),_0x2edc55,_0x4be55c);_0x1b9c31(_0x4be55c);});});}exports['GetDeskAccount']=function(_0x15f9b2){var _0x37d476=this;return new Promise(function(_0x1eba1d,_0x13fde5){return db[_0x7529('0x13')][_0x7529('0x14')]({'raw':_0x15f9b2[_0x7529('0x15')]?_0x15f9b2['options']['raw']===undefined?!![]:![]:!![],'where':_0x15f9b2['options']?_0x15f9b2[_0x7529('0x15')][_0x7529('0x16')]||null:null,'attributes':_0x15f9b2[_0x7529('0x15')]?_0x15f9b2[_0x7529('0x15')]['attributes']||null:null,'limit':_0x15f9b2[_0x7529('0x15')]?_0x15f9b2[_0x7529('0x15')][_0x7529('0x17')]||null:null,'include':_0x15f9b2[_0x7529('0x15')]?_0x15f9b2[_0x7529('0x15')][_0x7529('0x18')]?_[_0x7529('0x19')](_0x15f9b2[_0x7529('0x15')][_0x7529('0x18')],function(_0x34148d){return{'model':db[_0x34148d['model']],'as':_0x34148d['as'],'attributes':_0x34148d[_0x7529('0x1a')],'include':_0x34148d[_0x7529('0x18')]?_['map'](_0x34148d[_0x7529('0x18')],function(_0x4b736b){return{'model':db[_0x4b736b[_0x7529('0x1b')]],'as':_0x4b736b['as'],'attributes':_0x4b736b[_0x7529('0x1a')],'include':_0x4b736b[_0x7529('0x18')]?_['map'](_0x4b736b[_0x7529('0x18')],function(_0x46c520){return{'model':db[_0x46c520['model']],'as':_0x46c520['as'],'attributes':_0x46c520[_0x7529('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7529('0x1c')](function(_0x23f9cb){logger[_0x7529('0x1d')]('GetDeskAccount',_0x15f9b2);logger[_0x7529('0x1e')](_0x7529('0x1f'),_0x15f9b2,JSON[_0x7529('0xc')](_0x23f9cb));_0x1eba1d(_0x23f9cb);})[_0x7529('0x12')](function(_0x95b802){logger[_0x7529('0xd')](_0x7529('0x1f'),_0x95b802[_0x7529('0x10')],_0x15f9b2);_0x13fde5(_0x37d476[_0x7529('0xd')](0x1f4,_0x95b802[_0x7529('0x10')]));});});};exports[_0x7529('0x20')]=function(_0x45dbd0){var _0x2564f2=this;return new Promise(function(_0x4d2c4b,_0x1f4dcc){return db[_0x7529('0x13')]['find']({'raw':_0x45dbd0[_0x7529('0x15')]?_0x45dbd0[_0x7529('0x15')][_0x7529('0x21')]===undefined?!![]:![]:!![],'where':_0x45dbd0['options']?_0x45dbd0['options']['where']||null:null,'attributes':_0x45dbd0[_0x7529('0x15')]?_0x45dbd0[_0x7529('0x15')][_0x7529('0x1a')]||null:null,'include':_0x45dbd0[_0x7529('0x15')]?_0x45dbd0['options'][_0x7529('0x18')]?_[_0x7529('0x19')](_0x45dbd0[_0x7529('0x15')]['include'],function(_0x4cfe5d){return{'model':db[_0x4cfe5d[_0x7529('0x1b')]],'as':_0x4cfe5d['as'],'attributes':_0x4cfe5d[_0x7529('0x1a')],'include':_0x4cfe5d[_0x7529('0x18')]?_[_0x7529('0x19')](_0x4cfe5d['include'],function(_0x362a7a){return{'model':db[_0x362a7a[_0x7529('0x1b')]],'as':_0x362a7a['as'],'attributes':_0x362a7a[_0x7529('0x1a')],'include':_0x362a7a[_0x7529('0x18')]?_[_0x7529('0x19')](_0x362a7a['include'],function(_0x14a716){return{'model':db[_0x14a716[_0x7529('0x1b')]],'as':_0x14a716['as'],'attributes':_0x14a716[_0x7529('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c7f29){logger['info'](_0x7529('0x20'),_0x45dbd0);logger[_0x7529('0x1e')](_0x7529('0x20'),_0x45dbd0,JSON['stringify'](_0x5c7f29));_0x4d2c4b(_0x5c7f29);})[_0x7529('0x12')](function(_0x2ecaa6){logger[_0x7529('0xd')](_0x7529('0x20'),_0x2ecaa6[_0x7529('0x10')],_0x45dbd0);_0x1f4dcc(_0x2564f2[_0x7529('0xd')](0x1f4,_0x2ecaa6['message']));});});}; \ No newline at end of file +var _0x0506=['DeskAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','find','where','ShowDeskAccount','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','info','request\x20sent','GetDeskAccount'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0506,0x149));var _0x6050=function(_0x4269e3,_0x1a7773){_0x4269e3=_0x4269e3-0x0;var _0x2929b8=_0x0506[_0x4269e3];return _0x2929b8;};'use strict';var _=require('lodash');var util=require(_0x6050('0x0'));var moment=require(_0x6050('0x1'));var BPromise=require(_0x6050('0x2'));var rs=require(_0x6050('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6050('0x4'))['db'];var utils=require(_0x6050('0x5'));var logger=require(_0x6050('0x6'))(_0x6050('0x7'));var config=require('../../config/environment');var jayson=require(_0x6050('0x8'));var client=jayson[_0x6050('0x9')][_0x6050('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x280d88,_0x44bc3a,_0x1b1e12){return new BPromise(function(_0x3d46c8,_0x703113){return client['request'](_0x280d88,_0x1b1e12)[_0x6050('0xb')](function(_0x88b11f){logger['info']('DeskAccount,\x20%s,\x20%s',_0x44bc3a,'request\x20sent');logger[_0x6050('0xc')](_0x6050('0xd'),_0x44bc3a,'request\x20sent',JSON['stringify'](_0x88b11f));if(_0x88b11f['error']){if(_0x88b11f[_0x6050('0xe')][_0x6050('0xf')]===0x1f4){logger[_0x6050('0xe')](_0x6050('0x10'),_0x44bc3a,_0x88b11f['error'][_0x6050('0x11')]);return _0x703113(_0x88b11f['error'][_0x6050('0x11')]);}logger[_0x6050('0xe')](_0x6050('0x10'),_0x44bc3a,_0x88b11f[_0x6050('0xe')]['message']);return _0x3d46c8(_0x88b11f[_0x6050('0xe')][_0x6050('0x11')]);}else{logger[_0x6050('0x12')]('DeskAccount,\x20%s,\x20%s',_0x44bc3a,_0x6050('0x13'));_0x3d46c8(_0x88b11f['result'][_0x6050('0x11')]);}})['catch'](function(_0x281724){logger['error'](_0x6050('0x10'),_0x44bc3a,_0x281724);_0x703113(_0x281724);});});}exports[_0x6050('0x14')]=function(_0x4e2435){var _0x4bc424=this;return new Promise(function(_0x2a4f72,_0xbbfbb4){return db[_0x6050('0x15')][_0x6050('0x16')]({'raw':_0x4e2435[_0x6050('0x17')]?_0x4e2435[_0x6050('0x17')][_0x6050('0x18')]===undefined?!![]:![]:!![],'where':_0x4e2435[_0x6050('0x17')]?_0x4e2435[_0x6050('0x17')]['where']||null:null,'attributes':_0x4e2435[_0x6050('0x17')]?_0x4e2435['options'][_0x6050('0x19')]||null:null,'limit':_0x4e2435['options']?_0x4e2435[_0x6050('0x17')][_0x6050('0x1a')]||null:null,'include':_0x4e2435[_0x6050('0x17')]?_0x4e2435['options'][_0x6050('0x1b')]?_[_0x6050('0x1c')](_0x4e2435['options']['include'],function(_0x41c09a){return{'model':db[_0x41c09a[_0x6050('0x1d')]],'as':_0x41c09a['as'],'attributes':_0x41c09a[_0x6050('0x19')],'include':_0x41c09a['include']?_[_0x6050('0x1c')](_0x41c09a[_0x6050('0x1b')],function(_0x51ec42){return{'model':db[_0x51ec42[_0x6050('0x1d')]],'as':_0x51ec42['as'],'attributes':_0x51ec42['attributes'],'include':_0x51ec42['include']?_[_0x6050('0x1c')](_0x51ec42['include'],function(_0x3aeac1){return{'model':db[_0x3aeac1[_0x6050('0x1d')]],'as':_0x3aeac1['as'],'attributes':_0x3aeac1[_0x6050('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6050('0xb')](function(_0x963d70){logger['info'](_0x6050('0x14'),_0x4e2435);logger['debug']('GetDeskAccount',_0x4e2435,JSON[_0x6050('0x1e')](_0x963d70));_0x2a4f72(_0x963d70);})['catch'](function(_0x102eee){logger[_0x6050('0xe')](_0x6050('0x14'),_0x102eee[_0x6050('0x11')],_0x4e2435);_0xbbfbb4(_0x4bc424['error'](0x1f4,_0x102eee[_0x6050('0x11')]));});});};exports['ShowDeskAccount']=function(_0x59fd5f){var _0x5cc622=this;return new Promise(function(_0x1cf674,_0x45bbf5){return db[_0x6050('0x15')][_0x6050('0x1f')]({'raw':_0x59fd5f[_0x6050('0x17')]?_0x59fd5f[_0x6050('0x17')][_0x6050('0x18')]===undefined?!![]:![]:!![],'where':_0x59fd5f[_0x6050('0x17')]?_0x59fd5f[_0x6050('0x17')][_0x6050('0x20')]||null:null,'attributes':_0x59fd5f['options']?_0x59fd5f[_0x6050('0x17')][_0x6050('0x19')]||null:null,'include':_0x59fd5f[_0x6050('0x17')]?_0x59fd5f['options']['include']?_[_0x6050('0x1c')](_0x59fd5f[_0x6050('0x17')][_0x6050('0x1b')],function(_0x350ed2){return{'model':db[_0x350ed2['model']],'as':_0x350ed2['as'],'attributes':_0x350ed2[_0x6050('0x19')],'include':_0x350ed2[_0x6050('0x1b')]?_[_0x6050('0x1c')](_0x350ed2[_0x6050('0x1b')],function(_0x54a9ab){return{'model':db[_0x54a9ab[_0x6050('0x1d')]],'as':_0x54a9ab['as'],'attributes':_0x54a9ab['attributes'],'include':_0x54a9ab['include']?_[_0x6050('0x1c')](_0x54a9ab['include'],function(_0x3a0488){return{'model':db[_0x3a0488[_0x6050('0x1d')]],'as':_0x3a0488['as'],'attributes':_0x3a0488['attributes']};}):[]};}):[]};}):[]:[]})[_0x6050('0xb')](function(_0x213554){logger[_0x6050('0x12')](_0x6050('0x21'),_0x59fd5f);logger[_0x6050('0xc')](_0x6050('0x21'),_0x59fd5f,JSON[_0x6050('0x1e')](_0x213554));_0x1cf674(_0x213554);})[_0x6050('0x22')](function(_0x14680f){logger['error']('ShowDeskAccount',_0x14680f[_0x6050('0x11')],_0x59fd5f);_0x45bbf5(_0x5cc622[_0x6050('0xe')](0x1f4,_0x14680f[_0x6050('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 2e2e1d9..a0e9105 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5c8b8b,_0x4b98b0){var _0x4dd0b3=function(_0x324099){while(--_0x324099){_0x5c8b8b['push'](_0x5c8b8b['shift']());}};_0x4dd0b3(++_0x4b98b0);}(_0x3e74,0x175));var _0x43e7=function(_0x4c6522,_0x1041f6){_0x4c6522=_0x4c6522-0x0;var _0x4a0cd6=_0x3e74[_0x4c6522];return _0x4a0cd6;};'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/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x10d82f,_0x1d51a6){var _0x295e9e=function(_0x3eb0b8){while(--_0x3eb0b8){_0x10d82f['push'](_0x10d82f['shift']());}};_0x295e9e(++_0x1d51a6);}(_0x008c,0x188));var _0xc008=function(_0x33aefe,_0x371ccd){_0x33aefe=_0x33aefe-0x0;var _0x471d19=_0x008c[_0x33aefe];return _0x471d19;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 239241a..6d89331 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 _0x421e=['exports','STRING'];(function(_0x1ebc0f,_0x12171a){var _0x5d9cbd=function(_0x1d3bb4){while(--_0x1d3bb4){_0x1ebc0f['push'](_0x1ebc0f['shift']());}};_0x5d9cbd(++_0x12171a);}(_0x421e,0xa6));var _0xe421=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x421e[_0x484cac];return _0x1d6e77;};'use strict';var Sequelize=require('sequelize');module[_0xe421('0x0')]={'name':{'type':Sequelize[_0xe421('0x1')]},'description':{'type':Sequelize[_0xe421('0x1')]}}; \ No newline at end of file +var _0x7521=['sequelize','exports'];(function(_0x5d9550,_0x253c1a){var _0x1d08a1=function(_0x37817a){while(--_0x37817a){_0x5d9550['push'](_0x5d9550['shift']());}};_0x1d08a1(++_0x253c1a);}(_0x7521,0xf6));var _0x1752=function(_0x5ac99e,_0x1e387e){_0x5ac99e=_0x5ac99e-0x0;var _0x4871c4=_0x7521[_0x5ac99e];return _0x4871c4;};'use strict';var Sequelize=require(_0x1752('0x0'));module[_0x1752('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 17e8042..7329eba 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 _0x6f01=['reject','save','update','then','destroy','error','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','keys','create','body','find','getFields','findOne','DeskField','getSubjects','map','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x420d6a,_0x5f3df8){var _0x1f5f2c=function(_0x1d5b76){while(--_0x1d5b76){_0x420d6a['push'](_0x420d6a['shift']());}};_0x1f5f2c(++_0x5f3df8);}(_0x6f01,0x1bf));var _0x16f0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6f01[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x16f0('0x0'));var rimraf=require(_0x16f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16f0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x16f0('0x3'));var path=require('path');var sox=require(_0x16f0('0x4'));var csv=require(_0x16f0('0x5'));var ejs=require(_0x16f0('0x6'));var fs=require('fs');var fs_extra=require(_0x16f0('0x7'));var _=require(_0x16f0('0x8'));var squel=require(_0x16f0('0x9'));var crypto=require(_0x16f0('0xa'));var jsforce=require(_0x16f0('0xb'));var deskjs=require(_0x16f0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x16f0('0xd'));var authService=require(_0x16f0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x16f0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16f0('0x10'))(_0x16f0('0x11'));var utils=require(_0x16f0('0x12'));var config=require(_0x16f0('0x13'));var licenseUtil=require(_0x16f0('0x14'));var db=require(_0x16f0('0x15'))['db'];function respondWithStatusCode(_0x207ef6,_0x35eeb9){_0x35eeb9=_0x35eeb9||0xcc;return function(_0x220bbb){if(_0x220bbb){return _0x207ef6[_0x16f0('0x16')](_0x35eeb9);}return _0x207ef6['status'](_0x35eeb9)[_0x16f0('0x17')]();};}function respondWithResult(_0x22330b,_0x5d6763){_0x5d6763=_0x5d6763||0xc8;return function(_0x577c6e){if(_0x577c6e){return _0x22330b[_0x16f0('0x18')](_0x5d6763)[_0x16f0('0x19')](_0x577c6e);}};}function respondWithFilteredResult(_0x43e94b,_0x23791a){return function(_0x10de55){if(_0x10de55){var _0x5e0bbb=typeof _0x23791a[_0x16f0('0x1a')]===_0x16f0('0x1b')&&typeof _0x23791a[_0x16f0('0x1c')]===_0x16f0('0x1b');var _0x1c85c6=_0x10de55[_0x16f0('0x1d')];var _0x554fe1=_0x5e0bbb?0x0:_0x23791a['offset'];var _0x380dec=_0x5e0bbb?_0x10de55[_0x16f0('0x1d')]:_0x23791a[_0x16f0('0x1a')]+_0x23791a[_0x16f0('0x1c')];var _0x3002c3;if(_0x380dec>=_0x1c85c6){_0x380dec=_0x1c85c6;_0x3002c3=0xc8;}else{_0x3002c3=0xce;}_0x43e94b['status'](_0x3002c3);return _0x43e94b[_0x16f0('0x1e')](_0x16f0('0x1f'),_0x554fe1+'-'+_0x380dec+'/'+_0x1c85c6)[_0x16f0('0x19')](_0x10de55);}return null;};}function patchUpdates(_0x391b36){return function(_0x4f9e30){try{jsonpatch[_0x16f0('0x20')](_0x4f9e30,_0x391b36,!![]);}catch(_0x2e0fc0){return BPromise[_0x16f0('0x21')](_0x2e0fc0);}return _0x4f9e30[_0x16f0('0x22')]();};}function saveUpdates(_0xc5ceb0,_0x1e1b4b){return function(_0x3afcc4){if(_0x3afcc4){return _0x3afcc4[_0x16f0('0x23')](_0xc5ceb0)[_0x16f0('0x24')](function(_0xd25b3){return _0xd25b3;});}return null;};}function removeEntity(_0x5d2313,_0x32eede){return function(_0x12c520){if(_0x12c520){return _0x12c520[_0x16f0('0x25')]()[_0x16f0('0x24')](function(){_0x5d2313[_0x16f0('0x18')](0xcc)[_0x16f0('0x17')]();});}};}function handleEntityNotFound(_0x1a326a,_0x2d5fc1){return function(_0x36989d){if(!_0x36989d){_0x1a326a[_0x16f0('0x16')](0x194);}return _0x36989d;};}function handleError(_0x302a36,_0x3c3716){_0x3c3716=_0x3c3716||0x1f4;return function(_0x440847){logger[_0x16f0('0x26')](_0x440847['stack']);if(_0x440847[_0x16f0('0x27')]){delete _0x440847[_0x16f0('0x27')];}_0x302a36[_0x16f0('0x18')](_0x3c3716)[_0x16f0('0x28')](_0x440847);};}exports[_0x16f0('0x29')]=function(_0x50d8a3,_0x278cf3){var _0x482fff={},_0x14b775={},_0x6a5ea3={'count':0x0,'rows':[]};var _0x474651=_['map'](db[_0x16f0('0x2a')][_0x16f0('0x2b')],function(_0x478cec){return{'name':_0x478cec[_0x16f0('0x2c')],'type':_0x478cec['type'][_0x16f0('0x2d')]};});_0x14b775[_0x16f0('0x2e')]=_['map'](_0x474651,'name');_0x14b775[_0x16f0('0x2f')]=_['keys'](_0x50d8a3[_0x16f0('0x2f')]);_0x14b775[_0x16f0('0x30')]=_['intersection'](_0x14b775['model'],_0x14b775[_0x16f0('0x2f')]);_0x482fff[_0x16f0('0x31')]=_[_0x16f0('0x32')](_0x14b775[_0x16f0('0x2e')],qs[_0x16f0('0x33')](_0x50d8a3[_0x16f0('0x2f')]['fields']));_0x482fff[_0x16f0('0x31')]=_0x482fff['attributes'][_0x16f0('0x34')]?_0x482fff[_0x16f0('0x31')]:_0x14b775['model'];if(!_0x50d8a3[_0x16f0('0x2f')][_0x16f0('0x35')](_0x16f0('0x36'))){_0x482fff['limit']=qs[_0x16f0('0x1c')](_0x50d8a3[_0x16f0('0x2f')][_0x16f0('0x1c')]);_0x482fff[_0x16f0('0x1a')]=qs[_0x16f0('0x1a')](_0x50d8a3[_0x16f0('0x2f')][_0x16f0('0x1a')]);}_0x482fff[_0x16f0('0x37')]=qs['sort'](_0x50d8a3[_0x16f0('0x2f')][_0x16f0('0x38')]);_0x482fff[_0x16f0('0x39')]=qs['filters'](_[_0x16f0('0x3a')](_0x50d8a3[_0x16f0('0x2f')],_0x14b775[_0x16f0('0x30')]),_0x474651);if(_0x50d8a3[_0x16f0('0x2f')][_0x16f0('0x3b')]){_0x482fff[_0x16f0('0x39')]=_['merge'](_0x482fff[_0x16f0('0x39')],{'$or':_['map'](_0x474651,function(_0x25418f){if(_0x25418f['type']!=='VIRTUAL'){var _0x544977={};_0x544977[_0x25418f[_0x16f0('0x27')]]={'$like':'%'+_0x50d8a3[_0x16f0('0x2f')][_0x16f0('0x3b')]+'%'};return _0x544977;}})});}_0x482fff=_[_0x16f0('0x3c')]({},_0x482fff,_0x50d8a3[_0x16f0('0x3d')]);var _0x492788={'where':_0x482fff['where']};return db[_0x16f0('0x2a')][_0x16f0('0x1d')](_0x492788)[_0x16f0('0x24')](function(_0x3c2bd8){_0x6a5ea3[_0x16f0('0x1d')]=_0x3c2bd8;if(_0x50d8a3[_0x16f0('0x2f')][_0x16f0('0x3e')]){_0x482fff[_0x16f0('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x482fff);})[_0x16f0('0x24')](function(_0x4f0fb3){_0x6a5ea3['rows']=_0x4f0fb3;return _0x6a5ea3;})[_0x16f0('0x24')](respondWithFilteredResult(_0x278cf3,_0x482fff))[_0x16f0('0x40')](handleError(_0x278cf3,null));};exports[_0x16f0('0x41')]=function(_0x1fd878,_0x921290){var _0x2b1a25={'raw':![],'where':{'id':_0x1fd878[_0x16f0('0x42')]['id']}},_0x356d7c={};_0x356d7c[_0x16f0('0x2e')]=_[_0x16f0('0x43')](db[_0x16f0('0x2a')][_0x16f0('0x2b')]);_0x356d7c['query']=_[_0x16f0('0x43')](_0x1fd878[_0x16f0('0x2f')]);_0x356d7c[_0x16f0('0x30')]=_[_0x16f0('0x32')](_0x356d7c[_0x16f0('0x2e')],_0x356d7c[_0x16f0('0x2f')]);_0x2b1a25[_0x16f0('0x31')]=_[_0x16f0('0x32')](_0x356d7c[_0x16f0('0x2e')],qs[_0x16f0('0x33')](_0x1fd878['query']['fields']));_0x2b1a25['attributes']=_0x2b1a25[_0x16f0('0x31')][_0x16f0('0x34')]?_0x2b1a25[_0x16f0('0x31')]:_0x356d7c['model'];if(_0x1fd878[_0x16f0('0x2f')][_0x16f0('0x3e')]){_0x2b1a25['include']=[{'all':!![]}];}_0x2b1a25=_[_0x16f0('0x3c')]({},_0x2b1a25,_0x1fd878['options']);return db[_0x16f0('0x2a')]['find'](_0x2b1a25)[_0x16f0('0x24')](handleEntityNotFound(_0x921290,null))[_0x16f0('0x24')](respondWithResult(_0x921290,null))['catch'](handleError(_0x921290,null));};exports[_0x16f0('0x44')]=function(_0x329e9d,_0x7c8c89){return db['DeskConfiguration']['create'](_0x329e9d[_0x16f0('0x45')],{})[_0x16f0('0x24')](respondWithResult(_0x7c8c89,0xc9))[_0x16f0('0x40')](handleError(_0x7c8c89,null));};exports[_0x16f0('0x23')]=function(_0x4c1d55,_0x5ae3d){if(_0x4c1d55[_0x16f0('0x45')]['id']){delete _0x4c1d55['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x4c1d55['params']['id']}})['then'](handleEntityNotFound(_0x5ae3d,null))[_0x16f0('0x24')](saveUpdates(_0x4c1d55['body'],null))[_0x16f0('0x24')](respondWithResult(_0x5ae3d,null))[_0x16f0('0x40')](handleError(_0x5ae3d,null));};exports[_0x16f0('0x25')]=function(_0x1dda85,_0x200ae8){return db[_0x16f0('0x2a')][_0x16f0('0x46')]({'where':{'id':_0x1dda85[_0x16f0('0x42')]['id']}})[_0x16f0('0x24')](handleEntityNotFound(_0x200ae8,null))[_0x16f0('0x24')](removeEntity(_0x200ae8,null))[_0x16f0('0x40')](handleError(_0x200ae8,null));};exports[_0x16f0('0x47')]=function(_0x41f11f,_0x44ddb3,_0x15a9a6){var _0x98e591={};var _0x525175={};var _0x37c12d;var _0x15a326;return db[_0x16f0('0x2a')][_0x16f0('0x48')]({'where':{'id':_0x41f11f[_0x16f0('0x42')]['id']}})[_0x16f0('0x24')](handleEntityNotFound(_0x44ddb3,null))['then'](function(_0x25c320){if(_0x25c320){_0x37c12d=_0x25c320;_0x525175[_0x16f0('0x2e')]=_[_0x16f0('0x43')](db[_0x16f0('0x49')][_0x16f0('0x2b')]);_0x525175[_0x16f0('0x2f')]=_[_0x16f0('0x43')](_0x41f11f[_0x16f0('0x2f')]);_0x525175[_0x16f0('0x30')]=_[_0x16f0('0x32')](_0x525175[_0x16f0('0x2e')],_0x525175[_0x16f0('0x2f')]);_0x98e591[_0x16f0('0x31')]=_[_0x16f0('0x32')](_0x525175[_0x16f0('0x2e')],qs[_0x16f0('0x33')](_0x41f11f[_0x16f0('0x2f')][_0x16f0('0x33')]));_0x98e591[_0x16f0('0x31')]=_0x98e591[_0x16f0('0x31')][_0x16f0('0x34')]?_0x98e591['attributes']:_0x525175[_0x16f0('0x2e')];_0x98e591[_0x16f0('0x37')]=qs[_0x16f0('0x38')](_0x41f11f['query'][_0x16f0('0x38')]);_0x98e591[_0x16f0('0x39')]=qs[_0x16f0('0x30')](_[_0x16f0('0x3a')](_0x41f11f[_0x16f0('0x2f')],_0x525175[_0x16f0('0x30')]));if(_0x41f11f[_0x16f0('0x2f')]['filter']){_0x98e591[_0x16f0('0x39')]=_[_0x16f0('0x3c')](_0x98e591[_0x16f0('0x39')],{'$or':_['map'](_0x98e591['attributes'],function(_0x2ad013){var _0x58193={};_0x58193[_0x2ad013]={'$like':'%'+_0x41f11f[_0x16f0('0x2f')]['filter']+'%'};return _0x58193;})});}_0x98e591=_[_0x16f0('0x3c')]({},_0x98e591,_0x41f11f[_0x16f0('0x3d')]);return _0x37c12d[_0x16f0('0x47')](_0x98e591);}})[_0x16f0('0x24')](function(_0x489e2f){if(_0x489e2f){_0x15a326=_0x489e2f['length'];if(!_0x41f11f[_0x16f0('0x2f')][_0x16f0('0x35')](_0x16f0('0x36'))){_0x98e591['limit']=qs[_0x16f0('0x1c')](_0x41f11f[_0x16f0('0x2f')][_0x16f0('0x1c')]);_0x98e591[_0x16f0('0x1a')]=qs[_0x16f0('0x1a')](_0x41f11f[_0x16f0('0x2f')][_0x16f0('0x1a')]);}return _0x37c12d[_0x16f0('0x47')](_0x98e591);}})[_0x16f0('0x24')](function(_0x1f9d7d){if(_0x1f9d7d){return _0x1f9d7d?{'count':_0x15a326,'rows':_0x1f9d7d}:null;}})[_0x16f0('0x24')](respondWithResult(_0x44ddb3,null))[_0x16f0('0x40')](handleError(_0x44ddb3,null));};exports[_0x16f0('0x4a')]=function(_0x4cb393,_0x3b2acd,_0x32c795){var _0x779e9c={};var _0x18e8fd={};var _0x452b83;var _0x5aafc1;return db[_0x16f0('0x2a')][_0x16f0('0x48')]({'where':{'id':_0x4cb393[_0x16f0('0x42')]['id']}})[_0x16f0('0x24')](handleEntityNotFound(_0x3b2acd,null))['then'](function(_0x5c4cc6){if(_0x5c4cc6){_0x452b83=_0x5c4cc6;_0x18e8fd[_0x16f0('0x2e')]=_[_0x16f0('0x43')](db[_0x16f0('0x49')][_0x16f0('0x2b')]);_0x18e8fd[_0x16f0('0x2f')]=_[_0x16f0('0x43')](_0x4cb393[_0x16f0('0x2f')]);_0x18e8fd[_0x16f0('0x30')]=_['intersection'](_0x18e8fd[_0x16f0('0x2e')],_0x18e8fd['query']);_0x779e9c[_0x16f0('0x31')]=_[_0x16f0('0x32')](_0x18e8fd[_0x16f0('0x2e')],qs[_0x16f0('0x33')](_0x4cb393['query'][_0x16f0('0x33')]));_0x779e9c[_0x16f0('0x31')]=_0x779e9c[_0x16f0('0x31')][_0x16f0('0x34')]?_0x779e9c[_0x16f0('0x31')]:_0x18e8fd[_0x16f0('0x2e')];_0x779e9c[_0x16f0('0x37')]=qs[_0x16f0('0x38')](_0x4cb393[_0x16f0('0x2f')][_0x16f0('0x38')]);_0x779e9c[_0x16f0('0x39')]=qs['filters'](_[_0x16f0('0x3a')](_0x4cb393[_0x16f0('0x2f')],_0x18e8fd[_0x16f0('0x30')]));if(_0x4cb393['query'][_0x16f0('0x3b')]){_0x779e9c[_0x16f0('0x39')]=_[_0x16f0('0x3c')](_0x779e9c[_0x16f0('0x39')],{'$or':_[_0x16f0('0x4b')](_0x779e9c[_0x16f0('0x31')],function(_0x468b02){var _0x14c248={};_0x14c248[_0x468b02]={'$like':'%'+_0x4cb393['query']['filter']+'%'};return _0x14c248;})});}_0x779e9c=_['merge']({},_0x779e9c,_0x4cb393[_0x16f0('0x3d')]);return _0x452b83[_0x16f0('0x4a')](_0x779e9c);}})[_0x16f0('0x24')](function(_0x42e5f6){if(_0x42e5f6){_0x5aafc1=_0x42e5f6[_0x16f0('0x34')];if(!_0x4cb393[_0x16f0('0x2f')][_0x16f0('0x35')](_0x16f0('0x36'))){_0x779e9c[_0x16f0('0x1c')]=qs[_0x16f0('0x1c')](_0x4cb393[_0x16f0('0x2f')][_0x16f0('0x1c')]);_0x779e9c['offset']=qs[_0x16f0('0x1a')](_0x4cb393[_0x16f0('0x2f')][_0x16f0('0x1a')]);}return _0x452b83[_0x16f0('0x4a')](_0x779e9c);}})[_0x16f0('0x24')](function(_0x11b9cd){if(_0x11b9cd){return _0x11b9cd?{'count':_0x5aafc1,'rows':_0x11b9cd}:null;}})[_0x16f0('0x24')](respondWithResult(_0x3b2acd,null))['catch'](handleError(_0x3b2acd,null));};exports[_0x16f0('0x4c')]=function(_0x4342eb,_0x2a5ae2,_0x1adf28){var _0x3f37d6={};var _0x2c68ef={};var _0x258279;var _0x38793e;return db[_0x16f0('0x2a')][_0x16f0('0x48')]({'where':{'id':_0x4342eb[_0x16f0('0x42')]['id']}})[_0x16f0('0x24')](handleEntityNotFound(_0x2a5ae2,null))[_0x16f0('0x24')](function(_0x39f615){if(_0x39f615){_0x258279=_0x39f615;_0x2c68ef[_0x16f0('0x2e')]=_['keys'](db[_0x16f0('0x49')][_0x16f0('0x2b')]);_0x2c68ef['query']=_['keys'](_0x4342eb['query']);_0x2c68ef[_0x16f0('0x30')]=_['intersection'](_0x2c68ef[_0x16f0('0x2e')],_0x2c68ef['query']);_0x3f37d6['attributes']=_[_0x16f0('0x32')](_0x2c68ef['model'],qs['fields'](_0x4342eb[_0x16f0('0x2f')][_0x16f0('0x33')]));_0x3f37d6[_0x16f0('0x31')]=_0x3f37d6[_0x16f0('0x31')][_0x16f0('0x34')]?_0x3f37d6[_0x16f0('0x31')]:_0x2c68ef[_0x16f0('0x2e')];_0x3f37d6[_0x16f0('0x37')]=qs[_0x16f0('0x38')](_0x4342eb[_0x16f0('0x2f')][_0x16f0('0x38')]);_0x3f37d6['where']=qs['filters'](_[_0x16f0('0x3a')](_0x4342eb[_0x16f0('0x2f')],_0x2c68ef[_0x16f0('0x30')]));if(_0x4342eb[_0x16f0('0x2f')]['filter']){_0x3f37d6[_0x16f0('0x39')]=_[_0x16f0('0x3c')](_0x3f37d6[_0x16f0('0x39')],{'$or':_[_0x16f0('0x4b')](_0x3f37d6[_0x16f0('0x31')],function(_0x4c32c6){var _0x1d2e39={};_0x1d2e39[_0x4c32c6]={'$like':'%'+_0x4342eb[_0x16f0('0x2f')]['filter']+'%'};return _0x1d2e39;})});}_0x3f37d6=_['merge']({},_0x3f37d6,_0x4342eb[_0x16f0('0x3d')]);return _0x258279[_0x16f0('0x4c')](_0x3f37d6);}})[_0x16f0('0x24')](function(_0x3fc890){if(_0x3fc890){_0x38793e=_0x3fc890[_0x16f0('0x34')];if(!_0x4342eb['query']['hasOwnProperty'](_0x16f0('0x36'))){_0x3f37d6['limit']=qs[_0x16f0('0x1c')](_0x4342eb[_0x16f0('0x2f')]['limit']);_0x3f37d6['offset']=qs[_0x16f0('0x1a')](_0x4342eb[_0x16f0('0x2f')][_0x16f0('0x1a')]);}return _0x258279['getDescriptions'](_0x3f37d6);}})[_0x16f0('0x24')](function(_0x564a4b){if(_0x564a4b){return _0x564a4b?{'count':_0x38793e,'rows':_0x564a4b}:null;}})['then'](respondWithResult(_0x2a5ae2,null))[_0x16f0('0x40')](handleError(_0x2a5ae2,null));};exports[_0x16f0('0x4d')]=function(_0x3d7a16,_0xa89276,_0x2de040){var _0x25bbd4={};var _0x2ad18e={};var _0x57a307;var _0x59fa1a;return db['DeskConfiguration'][_0x16f0('0x48')]({'where':{'id':_0x3d7a16[_0x16f0('0x42')]['id']}})[_0x16f0('0x24')](handleEntityNotFound(_0xa89276,null))[_0x16f0('0x24')](function(_0x5986e0){if(_0x5986e0){_0x57a307=_0x5986e0;_0x2ad18e[_0x16f0('0x2e')]=_[_0x16f0('0x43')](db[_0x16f0('0x4e')][_0x16f0('0x2b')]);_0x2ad18e[_0x16f0('0x2f')]=_[_0x16f0('0x43')](_0x3d7a16[_0x16f0('0x2f')]);_0x2ad18e[_0x16f0('0x30')]=_[_0x16f0('0x32')](_0x2ad18e[_0x16f0('0x2e')],_0x2ad18e[_0x16f0('0x2f')]);_0x25bbd4[_0x16f0('0x31')]=_[_0x16f0('0x32')](_0x2ad18e[_0x16f0('0x2e')],qs[_0x16f0('0x33')](_0x3d7a16[_0x16f0('0x2f')][_0x16f0('0x33')]));_0x25bbd4['attributes']=_0x25bbd4['attributes'][_0x16f0('0x34')]?_0x25bbd4[_0x16f0('0x31')]:_0x2ad18e[_0x16f0('0x2e')];_0x25bbd4[_0x16f0('0x37')]=qs[_0x16f0('0x38')](_0x3d7a16[_0x16f0('0x2f')][_0x16f0('0x38')]);_0x25bbd4[_0x16f0('0x39')]=qs['filters'](_[_0x16f0('0x3a')](_0x3d7a16[_0x16f0('0x2f')],_0x2ad18e[_0x16f0('0x30')]));if(_0x3d7a16[_0x16f0('0x2f')][_0x16f0('0x3b')]){_0x25bbd4['where']=_['merge'](_0x25bbd4['where'],{'$or':_['map'](_0x25bbd4[_0x16f0('0x31')],function(_0x102780){var _0x3615b1={};_0x3615b1[_0x102780]={'$like':'%'+_0x3d7a16[_0x16f0('0x2f')][_0x16f0('0x3b')]+'%'};return _0x3615b1;})});}_0x25bbd4=_[_0x16f0('0x3c')]({},_0x25bbd4,_0x3d7a16[_0x16f0('0x3d')]);return _0x57a307[_0x16f0('0x4d')](_0x25bbd4);}})['then'](function(_0x194f88){if(_0x194f88){_0x59fa1a=_0x194f88[_0x16f0('0x34')];if(!_0x3d7a16[_0x16f0('0x2f')][_0x16f0('0x35')](_0x16f0('0x36'))){_0x25bbd4[_0x16f0('0x1c')]=qs[_0x16f0('0x1c')](_0x3d7a16['query'][_0x16f0('0x1c')]);_0x25bbd4[_0x16f0('0x1a')]=qs[_0x16f0('0x1a')](_0x3d7a16[_0x16f0('0x2f')][_0x16f0('0x1a')]);}return _0x57a307[_0x16f0('0x4d')](_0x25bbd4);}})['then'](function(_0x4d5ef3){if(_0x4d5ef3){return _0x4d5ef3?{'count':_0x59fa1a,'rows':_0x4d5ef3}:null;}})['then'](respondWithResult(_0xa89276,null))[_0x16f0('0x40')](handleError(_0xa89276,null));};exports[_0x16f0('0x4f')]=function(_0x2c625c,_0x1f6510,_0x52c11c){if(_0x2c625c['body']['id']){delete _0x2c625c[_0x16f0('0x45')]['id'];}return db[_0x16f0('0x2a')][_0x16f0('0x48')]({'where':{'id':_0x2c625c[_0x16f0('0x42')]['id']}})[_0x16f0('0x24')](handleEntityNotFound(_0x1f6510,null))['then'](function(_0x24ec50){if(_0x24ec50){return _0x24ec50[_0x16f0('0x4f')](_0x2c625c['body']['ids']||[]);}return null;})[_0x16f0('0x24')](respondWithResult(_0x1f6510,null))['catch'](handleError(_0x1f6510,null));}; \ No newline at end of file +var _0xd1fd=['name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x29ed66,_0x412e57){var _0x3219af=function(_0x4701b5){while(--_0x4701b5){_0x29ed66['push'](_0x29ed66['shift']());}};_0x3219af(++_0x412e57);}(_0xd1fd,0x82));var _0xdd1f=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xd1fd[_0x25fc41];return _0x1371d1;};'use strict';var emlformat=require(_0xdd1f('0x0'));var rimraf=require(_0xdd1f('0x1'));var zipdir=require(_0xdd1f('0x2'));var jsonpatch=require(_0xdd1f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd1f('0x4'));var Mustache=require(_0xdd1f('0x5'));var util=require(_0xdd1f('0x6'));var path=require(_0xdd1f('0x7'));var sox=require(_0xdd1f('0x8'));var csv=require(_0xdd1f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd1f('0xa'));var crypto=require(_0xdd1f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdd1f('0xc'));var toCsv=require(_0xdd1f('0x9'));var querystring=require(_0xdd1f('0xd'));var Papa=require('papaparse');var Redis=require(_0xdd1f('0xe'));var authService=require(_0xdd1f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdd1f('0x10'));var hardwareService=require(_0xdd1f('0x11'));var logger=require(_0xdd1f('0x12'))(_0xdd1f('0x13'));var utils=require('../../config/utils');var config=require(_0xdd1f('0x14'));var licenseUtil=require(_0xdd1f('0x15'));var db=require(_0xdd1f('0x16'))['db'];function respondWithStatusCode(_0x17a1de,_0x274628){_0x274628=_0x274628||0xcc;return function(_0x52cf26){if(_0x52cf26){return _0x17a1de[_0xdd1f('0x17')](_0x274628);}return _0x17a1de[_0xdd1f('0x18')](_0x274628)[_0xdd1f('0x19')]();};}function respondWithResult(_0x2122f5,_0x3d6886){_0x3d6886=_0x3d6886||0xc8;return function(_0x372d69){if(_0x372d69){return _0x2122f5['status'](_0x3d6886)[_0xdd1f('0x1a')](_0x372d69);}};}function respondWithFilteredResult(_0x31bff2,_0x1b91e3){return function(_0x1c4243){if(_0x1c4243){var _0x7f2c1a=typeof _0x1b91e3['offset']==='undefined'&&typeof _0x1b91e3[_0xdd1f('0x1b')]==='undefined';var _0x298ac3=_0x1c4243['count'];var _0x1fc53a=_0x7f2c1a?0x0:_0x1b91e3['offset'];var _0x1fa16d=_0x7f2c1a?_0x1c4243[_0xdd1f('0x1c')]:_0x1b91e3[_0xdd1f('0x1d')]+_0x1b91e3[_0xdd1f('0x1b')];var _0x347147;if(_0x1fa16d>=_0x298ac3){_0x1fa16d=_0x298ac3;_0x347147=0xc8;}else{_0x347147=0xce;}_0x31bff2[_0xdd1f('0x18')](_0x347147);return _0x31bff2[_0xdd1f('0x1e')](_0xdd1f('0x1f'),_0x1fc53a+'-'+_0x1fa16d+'/'+_0x298ac3)[_0xdd1f('0x1a')](_0x1c4243);}return null;};}function patchUpdates(_0x4a6fe1){return function(_0x27845c){try{jsonpatch[_0xdd1f('0x20')](_0x27845c,_0x4a6fe1,!![]);}catch(_0x4e8f08){return BPromise[_0xdd1f('0x21')](_0x4e8f08);}return _0x27845c[_0xdd1f('0x22')]();};}function saveUpdates(_0x356eb4,_0x19ba42){return function(_0x698b39){if(_0x698b39){return _0x698b39['update'](_0x356eb4)[_0xdd1f('0x23')](function(_0x53654f){return _0x53654f;});}return null;};}function removeEntity(_0x410d7b,_0x12ef52){return function(_0x31fb03){if(_0x31fb03){return _0x31fb03['destroy']()[_0xdd1f('0x23')](function(){_0x410d7b['status'](0xcc)[_0xdd1f('0x19')]();});}};}function handleEntityNotFound(_0xd9fac2,_0x47918f){return function(_0x3a7ec4){if(!_0x3a7ec4){_0xd9fac2['sendStatus'](0x194);}return _0x3a7ec4;};}function handleError(_0x20d6c7,_0x427b18){_0x427b18=_0x427b18||0x1f4;return function(_0x375764){logger[_0xdd1f('0x24')](_0x375764[_0xdd1f('0x25')]);if(_0x375764[_0xdd1f('0x26')]){delete _0x375764['name'];}_0x20d6c7[_0xdd1f('0x18')](_0x427b18)[_0xdd1f('0x27')](_0x375764);};}exports[_0xdd1f('0x28')]=function(_0x21eb42,_0x39e205){var _0x1581b9={},_0x3651bc={},_0x825888={'count':0x0,'rows':[]};var _0x20214b=_[_0xdd1f('0x29')](db[_0xdd1f('0x2a')][_0xdd1f('0x2b')],function(_0x408115){return{'name':_0x408115[_0xdd1f('0x2c')],'type':_0x408115[_0xdd1f('0x2d')][_0xdd1f('0x2e')]};});_0x3651bc['model']=_[_0xdd1f('0x29')](_0x20214b,_0xdd1f('0x26'));_0x3651bc[_0xdd1f('0x2f')]=_[_0xdd1f('0x30')](_0x21eb42[_0xdd1f('0x2f')]);_0x3651bc[_0xdd1f('0x31')]=_[_0xdd1f('0x32')](_0x3651bc[_0xdd1f('0x33')],_0x3651bc[_0xdd1f('0x2f')]);_0x1581b9[_0xdd1f('0x34')]=_['intersection'](_0x3651bc[_0xdd1f('0x33')],qs[_0xdd1f('0x35')](_0x21eb42[_0xdd1f('0x2f')]['fields']));_0x1581b9[_0xdd1f('0x34')]=_0x1581b9['attributes'][_0xdd1f('0x36')]?_0x1581b9[_0xdd1f('0x34')]:_0x3651bc['model'];if(!_0x21eb42[_0xdd1f('0x2f')][_0xdd1f('0x37')](_0xdd1f('0x38'))){_0x1581b9[_0xdd1f('0x1b')]=qs['limit'](_0x21eb42['query'][_0xdd1f('0x1b')]);_0x1581b9[_0xdd1f('0x1d')]=qs[_0xdd1f('0x1d')](_0x21eb42[_0xdd1f('0x2f')][_0xdd1f('0x1d')]);}_0x1581b9[_0xdd1f('0x39')]=qs['sort'](_0x21eb42[_0xdd1f('0x2f')][_0xdd1f('0x3a')]);_0x1581b9[_0xdd1f('0x3b')]=qs['filters'](_[_0xdd1f('0x3c')](_0x21eb42['query'],_0x3651bc[_0xdd1f('0x31')]),_0x20214b);if(_0x21eb42[_0xdd1f('0x2f')][_0xdd1f('0x3d')]){_0x1581b9[_0xdd1f('0x3b')]=_[_0xdd1f('0x3e')](_0x1581b9[_0xdd1f('0x3b')],{'$or':_[_0xdd1f('0x29')](_0x20214b,function(_0x4abf09){if(_0x4abf09[_0xdd1f('0x2d')]!==_0xdd1f('0x3f')){var _0x374c5d={};_0x374c5d[_0x4abf09[_0xdd1f('0x26')]]={'$like':'%'+_0x21eb42['query'][_0xdd1f('0x3d')]+'%'};return _0x374c5d;}})});}_0x1581b9=_[_0xdd1f('0x3e')]({},_0x1581b9,_0x21eb42['options']);var _0x1df735={'where':_0x1581b9[_0xdd1f('0x3b')]};return db[_0xdd1f('0x2a')][_0xdd1f('0x1c')](_0x1df735)[_0xdd1f('0x23')](function(_0x16d972){_0x825888['count']=_0x16d972;if(_0x21eb42[_0xdd1f('0x2f')][_0xdd1f('0x40')]){_0x1581b9['include']=[{'all':!![]}];}return db[_0xdd1f('0x2a')][_0xdd1f('0x41')](_0x1581b9);})[_0xdd1f('0x23')](function(_0x1d9bbf){_0x825888[_0xdd1f('0x42')]=_0x1d9bbf;return _0x825888;})[_0xdd1f('0x23')](respondWithFilteredResult(_0x39e205,_0x1581b9))[_0xdd1f('0x43')](handleError(_0x39e205,null));};exports[_0xdd1f('0x44')]=function(_0x5d7383,_0x2d4868){var _0x5c1550={'raw':![],'where':{'id':_0x5d7383[_0xdd1f('0x45')]['id']}},_0x3da060={};_0x3da060['model']=_[_0xdd1f('0x30')](db[_0xdd1f('0x2a')][_0xdd1f('0x2b')]);_0x3da060[_0xdd1f('0x2f')]=_[_0xdd1f('0x30')](_0x5d7383['query']);_0x3da060[_0xdd1f('0x31')]=_[_0xdd1f('0x32')](_0x3da060[_0xdd1f('0x33')],_0x3da060['query']);_0x5c1550['attributes']=_['intersection'](_0x3da060['model'],qs['fields'](_0x5d7383['query'][_0xdd1f('0x35')]));_0x5c1550[_0xdd1f('0x34')]=_0x5c1550[_0xdd1f('0x34')][_0xdd1f('0x36')]?_0x5c1550[_0xdd1f('0x34')]:_0x3da060[_0xdd1f('0x33')];if(_0x5d7383[_0xdd1f('0x2f')]['includeAll']){_0x5c1550[_0xdd1f('0x46')]=[{'all':!![]}];}_0x5c1550=_[_0xdd1f('0x3e')]({},_0x5c1550,_0x5d7383[_0xdd1f('0x47')]);return db[_0xdd1f('0x2a')][_0xdd1f('0x48')](_0x5c1550)[_0xdd1f('0x23')](handleEntityNotFound(_0x2d4868,null))['then'](respondWithResult(_0x2d4868,null))[_0xdd1f('0x43')](handleError(_0x2d4868,null));};exports['create']=function(_0x191fd7,_0x49e3f6){return db[_0xdd1f('0x2a')][_0xdd1f('0x49')](_0x191fd7[_0xdd1f('0x4a')],{})['then'](respondWithResult(_0x49e3f6,0xc9))['catch'](handleError(_0x49e3f6,null));};exports['update']=function(_0x415176,_0x36ad16){if(_0x415176[_0xdd1f('0x4a')]['id']){delete _0x415176['body']['id'];}return db[_0xdd1f('0x2a')][_0xdd1f('0x48')]({'where':{'id':_0x415176[_0xdd1f('0x45')]['id']}})[_0xdd1f('0x23')](handleEntityNotFound(_0x36ad16,null))['then'](saveUpdates(_0x415176[_0xdd1f('0x4a')],null))[_0xdd1f('0x23')](respondWithResult(_0x36ad16,null))[_0xdd1f('0x43')](handleError(_0x36ad16,null));};exports['destroy']=function(_0x294062,_0x11574a){return db[_0xdd1f('0x2a')]['find']({'where':{'id':_0x294062[_0xdd1f('0x45')]['id']}})['then'](handleEntityNotFound(_0x11574a,null))[_0xdd1f('0x23')](removeEntity(_0x11574a,null))[_0xdd1f('0x43')](handleError(_0x11574a,null));};exports[_0xdd1f('0x4b')]=function(_0x40f84b,_0x135acc,_0x234044){var _0x83b11e={};var _0x484468={};var _0x370818;var _0x4e2259;return db[_0xdd1f('0x2a')][_0xdd1f('0x4c')]({'where':{'id':_0x40f84b['params']['id']}})[_0xdd1f('0x23')](handleEntityNotFound(_0x135acc,null))['then'](function(_0x4d355a){if(_0x4d355a){_0x370818=_0x4d355a;_0x484468['model']=_[_0xdd1f('0x30')](db[_0xdd1f('0x4d')][_0xdd1f('0x2b')]);_0x484468[_0xdd1f('0x2f')]=_[_0xdd1f('0x30')](_0x40f84b[_0xdd1f('0x2f')]);_0x484468[_0xdd1f('0x31')]=_[_0xdd1f('0x32')](_0x484468[_0xdd1f('0x33')],_0x484468[_0xdd1f('0x2f')]);_0x83b11e[_0xdd1f('0x34')]=_[_0xdd1f('0x32')](_0x484468[_0xdd1f('0x33')],qs[_0xdd1f('0x35')](_0x40f84b[_0xdd1f('0x2f')][_0xdd1f('0x35')]));_0x83b11e[_0xdd1f('0x34')]=_0x83b11e[_0xdd1f('0x34')][_0xdd1f('0x36')]?_0x83b11e['attributes']:_0x484468[_0xdd1f('0x33')];_0x83b11e['order']=qs[_0xdd1f('0x3a')](_0x40f84b[_0xdd1f('0x2f')][_0xdd1f('0x3a')]);_0x83b11e[_0xdd1f('0x3b')]=qs[_0xdd1f('0x31')](_[_0xdd1f('0x3c')](_0x40f84b[_0xdd1f('0x2f')],_0x484468['filters']));if(_0x40f84b['query'][_0xdd1f('0x3d')]){_0x83b11e['where']=_[_0xdd1f('0x3e')](_0x83b11e[_0xdd1f('0x3b')],{'$or':_[_0xdd1f('0x29')](_0x83b11e[_0xdd1f('0x34')],function(_0x570315){var _0x1e0d9e={};_0x1e0d9e[_0x570315]={'$like':'%'+_0x40f84b['query'][_0xdd1f('0x3d')]+'%'};return _0x1e0d9e;})});}_0x83b11e=_[_0xdd1f('0x3e')]({},_0x83b11e,_0x40f84b[_0xdd1f('0x47')]);return _0x370818[_0xdd1f('0x4b')](_0x83b11e);}})['then'](function(_0x3a883f){if(_0x3a883f){_0x4e2259=_0x3a883f[_0xdd1f('0x36')];if(!_0x40f84b['query'][_0xdd1f('0x37')](_0xdd1f('0x38'))){_0x83b11e[_0xdd1f('0x1b')]=qs['limit'](_0x40f84b[_0xdd1f('0x2f')][_0xdd1f('0x1b')]);_0x83b11e['offset']=qs['offset'](_0x40f84b['query'][_0xdd1f('0x1d')]);}return _0x370818[_0xdd1f('0x4b')](_0x83b11e);}})[_0xdd1f('0x23')](function(_0x253c01){if(_0x253c01){return _0x253c01?{'count':_0x4e2259,'rows':_0x253c01}:null;}})[_0xdd1f('0x23')](respondWithResult(_0x135acc,null))['catch'](handleError(_0x135acc,null));};exports[_0xdd1f('0x4e')]=function(_0x55b6c5,_0x34dc00,_0x509a4c){var _0x462b6c={};var _0x40cf3={};var _0x78bb50;var _0x253efd;return db[_0xdd1f('0x2a')][_0xdd1f('0x4c')]({'where':{'id':_0x55b6c5[_0xdd1f('0x45')]['id']}})[_0xdd1f('0x23')](handleEntityNotFound(_0x34dc00,null))[_0xdd1f('0x23')](function(_0x2480e1){if(_0x2480e1){_0x78bb50=_0x2480e1;_0x40cf3[_0xdd1f('0x33')]=_[_0xdd1f('0x30')](db[_0xdd1f('0x4d')][_0xdd1f('0x2b')]);_0x40cf3[_0xdd1f('0x2f')]=_[_0xdd1f('0x30')](_0x55b6c5[_0xdd1f('0x2f')]);_0x40cf3[_0xdd1f('0x31')]=_['intersection'](_0x40cf3[_0xdd1f('0x33')],_0x40cf3[_0xdd1f('0x2f')]);_0x462b6c['attributes']=_[_0xdd1f('0x32')](_0x40cf3[_0xdd1f('0x33')],qs[_0xdd1f('0x35')](_0x55b6c5['query']['fields']));_0x462b6c[_0xdd1f('0x34')]=_0x462b6c['attributes']['length']?_0x462b6c[_0xdd1f('0x34')]:_0x40cf3['model'];_0x462b6c[_0xdd1f('0x39')]=qs['sort'](_0x55b6c5[_0xdd1f('0x2f')][_0xdd1f('0x3a')]);_0x462b6c[_0xdd1f('0x3b')]=qs[_0xdd1f('0x31')](_['pick'](_0x55b6c5[_0xdd1f('0x2f')],_0x40cf3['filters']));if(_0x55b6c5[_0xdd1f('0x2f')][_0xdd1f('0x3d')]){_0x462b6c[_0xdd1f('0x3b')]=_['merge'](_0x462b6c[_0xdd1f('0x3b')],{'$or':_[_0xdd1f('0x29')](_0x462b6c[_0xdd1f('0x34')],function(_0x1cd455){var _0x4d846c={};_0x4d846c[_0x1cd455]={'$like':'%'+_0x55b6c5[_0xdd1f('0x2f')]['filter']+'%'};return _0x4d846c;})});}_0x462b6c=_['merge']({},_0x462b6c,_0x55b6c5['options']);return _0x78bb50[_0xdd1f('0x4e')](_0x462b6c);}})['then'](function(_0x1ba03c){if(_0x1ba03c){_0x253efd=_0x1ba03c['length'];if(!_0x55b6c5[_0xdd1f('0x2f')][_0xdd1f('0x37')](_0xdd1f('0x38'))){_0x462b6c[_0xdd1f('0x1b')]=qs[_0xdd1f('0x1b')](_0x55b6c5[_0xdd1f('0x2f')]['limit']);_0x462b6c[_0xdd1f('0x1d')]=qs[_0xdd1f('0x1d')](_0x55b6c5['query']['offset']);}return _0x78bb50[_0xdd1f('0x4e')](_0x462b6c);}})[_0xdd1f('0x23')](function(_0x5a6da0){if(_0x5a6da0){return _0x5a6da0?{'count':_0x253efd,'rows':_0x5a6da0}:null;}})[_0xdd1f('0x23')](respondWithResult(_0x34dc00,null))[_0xdd1f('0x43')](handleError(_0x34dc00,null));};exports[_0xdd1f('0x4f')]=function(_0x25aa8c,_0x1f1ee3,_0x41dc54){var _0x2456b5={};var _0x31e46d={};var _0x5923f1;var _0x33e6ca;return db['DeskConfiguration'][_0xdd1f('0x4c')]({'where':{'id':_0x25aa8c[_0xdd1f('0x45')]['id']}})[_0xdd1f('0x23')](handleEntityNotFound(_0x1f1ee3,null))[_0xdd1f('0x23')](function(_0x35625e){if(_0x35625e){_0x5923f1=_0x35625e;_0x31e46d[_0xdd1f('0x33')]=_['keys'](db[_0xdd1f('0x4d')]['rawAttributes']);_0x31e46d['query']=_[_0xdd1f('0x30')](_0x25aa8c[_0xdd1f('0x2f')]);_0x31e46d[_0xdd1f('0x31')]=_[_0xdd1f('0x32')](_0x31e46d[_0xdd1f('0x33')],_0x31e46d[_0xdd1f('0x2f')]);_0x2456b5[_0xdd1f('0x34')]=_[_0xdd1f('0x32')](_0x31e46d[_0xdd1f('0x33')],qs[_0xdd1f('0x35')](_0x25aa8c[_0xdd1f('0x2f')][_0xdd1f('0x35')]));_0x2456b5['attributes']=_0x2456b5[_0xdd1f('0x34')][_0xdd1f('0x36')]?_0x2456b5[_0xdd1f('0x34')]:_0x31e46d[_0xdd1f('0x33')];_0x2456b5['order']=qs['sort'](_0x25aa8c[_0xdd1f('0x2f')][_0xdd1f('0x3a')]);_0x2456b5['where']=qs[_0xdd1f('0x31')](_['pick'](_0x25aa8c[_0xdd1f('0x2f')],_0x31e46d[_0xdd1f('0x31')]));if(_0x25aa8c[_0xdd1f('0x2f')][_0xdd1f('0x3d')]){_0x2456b5[_0xdd1f('0x3b')]=_['merge'](_0x2456b5[_0xdd1f('0x3b')],{'$or':_[_0xdd1f('0x29')](_0x2456b5[_0xdd1f('0x34')],function(_0xd9171){var _0x1293d8={};_0x1293d8[_0xd9171]={'$like':'%'+_0x25aa8c[_0xdd1f('0x2f')][_0xdd1f('0x3d')]+'%'};return _0x1293d8;})});}_0x2456b5=_['merge']({},_0x2456b5,_0x25aa8c[_0xdd1f('0x47')]);return _0x5923f1[_0xdd1f('0x4f')](_0x2456b5);}})[_0xdd1f('0x23')](function(_0x6ff03d){if(_0x6ff03d){_0x33e6ca=_0x6ff03d[_0xdd1f('0x36')];if(!_0x25aa8c[_0xdd1f('0x2f')]['hasOwnProperty'](_0xdd1f('0x38'))){_0x2456b5[_0xdd1f('0x1b')]=qs[_0xdd1f('0x1b')](_0x25aa8c['query'][_0xdd1f('0x1b')]);_0x2456b5[_0xdd1f('0x1d')]=qs['offset'](_0x25aa8c[_0xdd1f('0x2f')][_0xdd1f('0x1d')]);}return _0x5923f1[_0xdd1f('0x4f')](_0x2456b5);}})[_0xdd1f('0x23')](function(_0x5cfa0a){if(_0x5cfa0a){return _0x5cfa0a?{'count':_0x33e6ca,'rows':_0x5cfa0a}:null;}})['then'](respondWithResult(_0x1f1ee3,null))[_0xdd1f('0x43')](handleError(_0x1f1ee3,null));};exports[_0xdd1f('0x50')]=function(_0x38d0b9,_0x13cc80,_0x40d56b){var _0x3d1f92={};var _0x279c5f={};var _0x28922d;var _0x44b289;return db[_0xdd1f('0x2a')][_0xdd1f('0x4c')]({'where':{'id':_0x38d0b9[_0xdd1f('0x45')]['id']}})['then'](handleEntityNotFound(_0x13cc80,null))[_0xdd1f('0x23')](function(_0x4c827f){if(_0x4c827f){_0x28922d=_0x4c827f;_0x279c5f[_0xdd1f('0x33')]=_[_0xdd1f('0x30')](db[_0xdd1f('0x51')][_0xdd1f('0x2b')]);_0x279c5f[_0xdd1f('0x2f')]=_[_0xdd1f('0x30')](_0x38d0b9[_0xdd1f('0x2f')]);_0x279c5f[_0xdd1f('0x31')]=_[_0xdd1f('0x32')](_0x279c5f[_0xdd1f('0x33')],_0x279c5f[_0xdd1f('0x2f')]);_0x3d1f92['attributes']=_['intersection'](_0x279c5f['model'],qs['fields'](_0x38d0b9[_0xdd1f('0x2f')][_0xdd1f('0x35')]));_0x3d1f92['attributes']=_0x3d1f92[_0xdd1f('0x34')][_0xdd1f('0x36')]?_0x3d1f92[_0xdd1f('0x34')]:_0x279c5f['model'];_0x3d1f92[_0xdd1f('0x39')]=qs['sort'](_0x38d0b9[_0xdd1f('0x2f')][_0xdd1f('0x3a')]);_0x3d1f92[_0xdd1f('0x3b')]=qs[_0xdd1f('0x31')](_[_0xdd1f('0x3c')](_0x38d0b9[_0xdd1f('0x2f')],_0x279c5f[_0xdd1f('0x31')]));if(_0x38d0b9[_0xdd1f('0x2f')][_0xdd1f('0x3d')]){_0x3d1f92[_0xdd1f('0x3b')]=_[_0xdd1f('0x3e')](_0x3d1f92[_0xdd1f('0x3b')],{'$or':_['map'](_0x3d1f92['attributes'],function(_0x1a0625){var _0x36c096={};_0x36c096[_0x1a0625]={'$like':'%'+_0x38d0b9[_0xdd1f('0x2f')][_0xdd1f('0x3d')]+'%'};return _0x36c096;})});}_0x3d1f92=_[_0xdd1f('0x3e')]({},_0x3d1f92,_0x38d0b9[_0xdd1f('0x47')]);return _0x28922d[_0xdd1f('0x50')](_0x3d1f92);}})[_0xdd1f('0x23')](function(_0x19e37b){if(_0x19e37b){_0x44b289=_0x19e37b[_0xdd1f('0x36')];if(!_0x38d0b9[_0xdd1f('0x2f')]['hasOwnProperty'](_0xdd1f('0x38'))){_0x3d1f92[_0xdd1f('0x1b')]=qs['limit'](_0x38d0b9['query'][_0xdd1f('0x1b')]);_0x3d1f92[_0xdd1f('0x1d')]=qs['offset'](_0x38d0b9[_0xdd1f('0x2f')][_0xdd1f('0x1d')]);}return _0x28922d['getTags'](_0x3d1f92);}})[_0xdd1f('0x23')](function(_0x1fc470){if(_0x1fc470){return _0x1fc470?{'count':_0x44b289,'rows':_0x1fc470}:null;}})[_0xdd1f('0x23')](respondWithResult(_0x13cc80,null))[_0xdd1f('0x43')](handleError(_0x13cc80,null));};exports['setTags']=function(_0x2ca621,_0x183c6d,_0x293c80){if(_0x2ca621[_0xdd1f('0x4a')]['id']){delete _0x2ca621[_0xdd1f('0x4a')]['id'];}return db['DeskConfiguration'][_0xdd1f('0x4c')]({'where':{'id':_0x2ca621[_0xdd1f('0x45')]['id']}})['then'](handleEntityNotFound(_0x183c6d,null))[_0xdd1f('0x23')](function(_0x32c07d){if(_0x32c07d){return _0x32c07d[_0xdd1f('0x52')](_0x2ca621[_0xdd1f('0x4a')][_0xdd1f('0x53')]||[]);}return null;})['then'](respondWithResult(_0x183c6d,null))[_0xdd1f('0x43')](handleError(_0x183c6d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 23f0e77..c21d6bd 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 _0xc4c1=['api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','../../config/logger'];(function(_0x26df73,_0x2fadd6){var _0x3d5d0e=function(_0x33ba4a){while(--_0x33ba4a){_0x26df73['push'](_0x26df73['shift']());}};_0x3d5d0e(++_0x2fadd6);}(_0xc4c1,0x175));var _0x1c4c=function(_0x5ccce8,_0xb6ac66){_0x5ccce8=_0x5ccce8-0x0;var _0xaf68af=_0xc4c1[_0x5ccce8];return _0xaf68af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1c4c('0x0'))(_0x1c4c('0x1'));var moment=require(_0x1c4c('0x2'));var BPromise=require(_0x1c4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c4c('0x4'));var rimraf=require(_0x1c4c('0x5'));var config=require(_0x1c4c('0x6'));var attributes=require(_0x1c4c('0x7'));module[_0x1c4c('0x8')]=function(_0x13eb4d,_0x347a88){return _0x13eb4d[_0x1c4c('0x9')](_0x1c4c('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0e4=['exports','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x531e5b,_0x3ef763){var _0x4de892=function(_0x4d29d2){while(--_0x4d29d2){_0x531e5b['push'](_0x531e5b['shift']());}};_0x4de892(++_0x3ef763);}(_0xe0e4,0x1b1));var _0x4e0e=function(_0x5edafb,_0x59146a){_0x5edafb=_0x5edafb-0x0;var _0x4f5167=_0xe0e4[_0x5edafb];return _0x4f5167;};'use strict';var _=require('lodash');var util=require(_0x4e0e('0x0'));var logger=require(_0x4e0e('0x1'))(_0x4e0e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e0e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e0e('0x4'));var config=require(_0x4e0e('0x5'));var attributes=require(_0x4e0e('0x6'));module[_0x4e0e('0x7')]=function(_0x26f652,_0x512650){return _0x26f652['define'](_0x4e0e('0x8'),attributes,{'tableName':_0x4e0e('0x9'),'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 506ef1c..530849c 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 _0x34a5=['stringify','error','message','info','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34a5,0xc2));var _0x534a=function(_0x2903f9,_0x3c9d3b){_0x2903f9=_0x2903f9-0x0;var _0x54f545=_0x34a5[_0x2903f9];return _0x54f545;};'use strict';var _=require(_0x534a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x534a('0x1'));var fs=require('fs');var Redis=require(_0x534a('0x2'));var db=require(_0x534a('0x3'))['db'];var utils=require(_0x534a('0x4'));var logger=require(_0x534a('0x5'))(_0x534a('0x6'));var config=require(_0x534a('0x7'));var jayson=require(_0x534a('0x8'));var client=jayson[_0x534a('0x9')][_0x534a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b2cd,_0x31a4e7,_0x167ea5){return new BPromise(function(_0x3c85e8,_0x10ebcc){return client['request'](_0x27b2cd,_0x167ea5)[_0x534a('0xb')](function(_0x3d86ff){logger['info'](_0x534a('0xc'),_0x31a4e7,_0x534a('0xd'));logger[_0x534a('0xe')](_0x534a('0xf'),_0x31a4e7,_0x534a('0xd'),JSON[_0x534a('0x10')](_0x3d86ff));if(_0x3d86ff[_0x534a('0x11')]){if(_0x3d86ff[_0x534a('0x11')]['code']===0x1f4){logger[_0x534a('0x11')](_0x534a('0xc'),_0x31a4e7,_0x3d86ff['error'][_0x534a('0x12')]);return _0x10ebcc(_0x3d86ff[_0x534a('0x11')][_0x534a('0x12')]);}logger[_0x534a('0x11')](_0x534a('0xc'),_0x31a4e7,_0x3d86ff['error'][_0x534a('0x12')]);return _0x3c85e8(_0x3d86ff[_0x534a('0x11')][_0x534a('0x12')]);}else{logger[_0x534a('0x13')](_0x534a('0xc'),_0x31a4e7,_0x534a('0xd'));_0x3c85e8(_0x3d86ff[_0x534a('0x14')][_0x534a('0x12')]);}})['catch'](function(_0x4f2a7d){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x31a4e7,_0x4f2a7d);_0x10ebcc(_0x4f2a7d);});});} \ No newline at end of file +var _0x6bdd=['http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x37d9ac,_0x1af5c3){var _0x4e3dff=function(_0x3ece1f){while(--_0x3ece1f){_0x37d9ac['push'](_0x37d9ac['shift']());}};_0x4e3dff(++_0x1af5c3);}(_0x6bdd,0xe9));var _0xd6bd=function(_0x5f046c,_0x53eb88){_0x5f046c=_0x5f046c-0x0;var _0x568032=_0x6bdd[_0x5f046c];return _0x568032;};'use strict';var _=require('lodash');var util=require(_0xd6bd('0x0'));var moment=require(_0xd6bd('0x1'));var BPromise=require(_0xd6bd('0x2'));var rs=require(_0xd6bd('0x3'));var fs=require('fs');var Redis=require(_0xd6bd('0x4'));var db=require(_0xd6bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6bd('0x6'))('rpc');var config=require(_0xd6bd('0x7'));var jayson=require(_0xd6bd('0x8'));var client=jayson['client'][_0xd6bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bb565,_0x56899d,_0x5e3b1c){return new BPromise(function(_0x204e21,_0x3a4376){return client[_0xd6bd('0xa')](_0x2bb565,_0x5e3b1c)[_0xd6bd('0xb')](function(_0x13e0c3){logger['info'](_0xd6bd('0xc'),_0x56899d,_0xd6bd('0xd'));logger[_0xd6bd('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x56899d,'request\x20sent',JSON[_0xd6bd('0xf')](_0x13e0c3));if(_0x13e0c3[_0xd6bd('0x10')]){if(_0x13e0c3[_0xd6bd('0x10')][_0xd6bd('0x11')]===0x1f4){logger[_0xd6bd('0x10')](_0xd6bd('0xc'),_0x56899d,_0x13e0c3[_0xd6bd('0x10')][_0xd6bd('0x12')]);return _0x3a4376(_0x13e0c3[_0xd6bd('0x10')][_0xd6bd('0x12')]);}logger[_0xd6bd('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x56899d,_0x13e0c3[_0xd6bd('0x10')][_0xd6bd('0x12')]);return _0x204e21(_0x13e0c3['error']['message']);}else{logger[_0xd6bd('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x56899d,_0xd6bd('0xd'));_0x204e21(_0x13e0c3[_0xd6bd('0x14')][_0xd6bd('0x12')]);}})[_0xd6bd('0x15')](function(_0x59dfe7){logger[_0xd6bd('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x56899d,_0x59dfe7);_0x3a4376(_0x59dfe7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 278dbc3..f973dfb 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 _0x9672=['index','get','/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x31b957,_0x5de2ec){var _0x44415f=function(_0x320f66){while(--_0x320f66){_0x31b957['push'](_0x31b957['shift']());}};_0x44415f(++_0x5de2ec);}(_0x9672,0xee));var _0x2967=function(_0x5e0102,_0x1ab296){_0x5e0102=_0x5e0102-0x0;var _0x5bbeb4=_0x9672[_0x5e0102];return _0x5bbeb4;};'use strict';var multer=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var path=require('path');var timeout=require(_0x2967('0x2'));var express=require(_0x2967('0x3'));var router=express[_0x2967('0x4')]();var fs_extra=require(_0x2967('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var controller=require(_0x2967('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2967('0x9')]);router[_0x2967('0xa')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0xd')]);router[_0x2967('0xe')]('/',auth[_0x2967('0xc')](),controller[_0x2967('0xf')]);router['put'](_0x2967('0xb'),auth[_0x2967('0xc')](),controller[_0x2967('0x10')]);router[_0x2967('0x11')](_0x2967('0xb'),auth[_0x2967('0xc')](),controller['destroy']);module[_0x2967('0x12')]=router; \ No newline at end of file +var _0x0124=['put','/:id','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intDeskField.controller','get','index','show','post','isAuthenticated'];(function(_0x36edce,_0x5b68ad){var _0x3fdf21=function(_0x577e3d){while(--_0x577e3d){_0x36edce['push'](_0x36edce['shift']());}};_0x3fdf21(++_0x5b68ad);}(_0x0124,0x1b4));var _0x4012=function(_0x27c5b4,_0x430385){_0x27c5b4=_0x27c5b4-0x0;var _0x1358ba=_0x0124[_0x27c5b4];return _0x1358ba;};'use strict';var multer=require(_0x4012('0x0'));var util=require('util');var path=require(_0x4012('0x1'));var timeout=require(_0x4012('0x2'));var express=require(_0x4012('0x3'));var router=express[_0x4012('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4012('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4012('0x6'));router[_0x4012('0x7')]('/',auth['isAuthenticated'](),controller[_0x4012('0x8')]);router[_0x4012('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4012('0x9')]);router[_0x4012('0xa')]('/',auth[_0x4012('0xb')](),controller['create']);router[_0x4012('0xc')](_0x4012('0xd'),auth[_0x4012('0xb')](),controller[_0x4012('0xe')]);router['delete'](_0x4012('0xd'),auth[_0x4012('0xb')](),controller['destroy']);module[_0x4012('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 751ecb3..7a6747d 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 _0xdeed=['keyValue','picklist','string','STRING','BOOLEAN','ENUM','customVariable'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xdeed,0x155));var _0xddee=function(_0x43665e,_0x5751f3){_0x43665e=_0x43665e-0x0;var _0x1b3f10=_0xdeed[_0x43665e];return _0x1b3f10;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xddee('0x0')]('string','variable',_0xddee('0x1'),_0xddee('0x2'),_0xddee('0x3')),'defaultValue':_0xddee('0x4')},'content':{'type':Sequelize[_0xddee('0x5')]},'key':{'type':Sequelize[_0xddee('0x5')]},'keyType':{'type':Sequelize[_0xddee('0x0')](_0xddee('0x4'),'variable',_0xddee('0x1'))},'keyContent':{'type':Sequelize[_0xddee('0x5')]},'idField':{'type':Sequelize[_0xddee('0x5')]},'nameField':{'type':Sequelize[_0xddee('0x5')]},'customField':{'type':Sequelize[_0xddee('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xddee('0x5')]}}; \ No newline at end of file +var _0xf159=['sequelize','exports','string','variable','keyValue','STRING','BOOLEAN'];(function(_0x2b53ba,_0x54c027){var _0x5d933e=function(_0x3ff047){while(--_0x3ff047){_0x2b53ba['push'](_0x2b53ba['shift']());}};_0x5d933e(++_0x54c027);}(_0xf159,0xfc));var _0x9f15=function(_0x45f473,_0x354613){_0x45f473=_0x45f473-0x0;var _0x50c256=_0xf159[_0x45f473];return _0x50c256;};'use strict';var Sequelize=require(_0x9f15('0x0'));module[_0x9f15('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9f15('0x2'),_0x9f15('0x3'),'customVariable',_0x9f15('0x4'),'picklist'),'defaultValue':_0x9f15('0x2')},'content':{'type':Sequelize[_0x9f15('0x5')]},'key':{'type':Sequelize[_0x9f15('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x9f15('0x2'),_0x9f15('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9f15('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9f15('0x5')]},'customField':{'type':Sequelize[_0x9f15('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f15('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 717f614..3ff18b9 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 _0xdf55=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','DeskField','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3c79ee,_0x5483e7){var _0x312e55=function(_0x20e88e){while(--_0x20e88e){_0x3c79ee['push'](_0x3c79ee['shift']());}};_0x312e55(++_0x5483e7);}(_0xdf55,0x83));var _0x5df5=function(_0x30eb5b,_0x234476){_0x30eb5b=_0x30eb5b-0x0;var _0x559d73=_0xdf55[_0x30eb5b];return _0x559d73;};'use strict';var emlformat=require(_0x5df5('0x0'));var rimraf=require(_0x5df5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5df5('0x2'));var rp=require(_0x5df5('0x3'));var moment=require('moment');var BPromise=require(_0x5df5('0x4'));var Mustache=require(_0x5df5('0x5'));var util=require(_0x5df5('0x6'));var path=require('path');var sox=require(_0x5df5('0x7'));var csv=require(_0x5df5('0x8'));var ejs=require(_0x5df5('0x9'));var fs=require('fs');var fs_extra=require(_0x5df5('0xa'));var _=require(_0x5df5('0xb'));var squel=require(_0x5df5('0xc'));var crypto=require(_0x5df5('0xd'));var jsforce=require(_0x5df5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5df5('0x8'));var querystring=require(_0x5df5('0xf'));var Papa=require(_0x5df5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5df5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5df5('0x12'));var logger=require(_0x5df5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5df5('0x14'));var licenseUtil=require(_0x5df5('0x15'));var db=require(_0x5df5('0x16'))['db'];function respondWithStatusCode(_0x4c3d6f,_0xe8bcd8){_0xe8bcd8=_0xe8bcd8||0xcc;return function(_0xb4a4fe){if(_0xb4a4fe){return _0x4c3d6f[_0x5df5('0x17')](_0xe8bcd8);}return _0x4c3d6f[_0x5df5('0x18')](_0xe8bcd8)[_0x5df5('0x19')]();};}function respondWithResult(_0x956317,_0x555d3f){_0x555d3f=_0x555d3f||0xc8;return function(_0x30fd32){if(_0x30fd32){return _0x956317['status'](_0x555d3f)[_0x5df5('0x1a')](_0x30fd32);}};}function respondWithFilteredResult(_0x33f818,_0x5b0ad9){return function(_0x3657c8){if(_0x3657c8){var _0x282d53=typeof _0x5b0ad9['offset']===_0x5df5('0x1b')&&typeof _0x5b0ad9[_0x5df5('0x1c')]==='undefined';var _0x9a52c9=_0x3657c8[_0x5df5('0x1d')];var _0xb7e1c2=_0x282d53?0x0:_0x5b0ad9[_0x5df5('0x1e')];var _0x215d59=_0x282d53?_0x3657c8['count']:_0x5b0ad9['offset']+_0x5b0ad9[_0x5df5('0x1c')];var _0x5d8dfd;if(_0x215d59>=_0x9a52c9){_0x215d59=_0x9a52c9;_0x5d8dfd=0xc8;}else{_0x5d8dfd=0xce;}_0x33f818[_0x5df5('0x18')](_0x5d8dfd);return _0x33f818[_0x5df5('0x1f')](_0x5df5('0x20'),_0xb7e1c2+'-'+_0x215d59+'/'+_0x9a52c9)[_0x5df5('0x1a')](_0x3657c8);}return null;};}function patchUpdates(_0x1deae7){return function(_0x4b4b57){try{jsonpatch[_0x5df5('0x21')](_0x4b4b57,_0x1deae7,!![]);}catch(_0x39d8a1){return BPromise[_0x5df5('0x22')](_0x39d8a1);}return _0x4b4b57[_0x5df5('0x23')]();};}function saveUpdates(_0x28efc8,_0x382999){return function(_0x59ff67){if(_0x59ff67){return _0x59ff67[_0x5df5('0x24')](_0x28efc8)[_0x5df5('0x25')](function(_0x8742a7){return _0x8742a7;});}return null;};}function removeEntity(_0x446bba,_0x5ca542){return function(_0x4358ba){if(_0x4358ba){return _0x4358ba[_0x5df5('0x26')]()[_0x5df5('0x25')](function(){_0x446bba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x532923,_0x357fb0){return function(_0x3ff82e){if(!_0x3ff82e){_0x532923[_0x5df5('0x17')](0x194);}return _0x3ff82e;};}function handleError(_0xa7f4b3,_0x1baf52){_0x1baf52=_0x1baf52||0x1f4;return function(_0x1fd83c){logger[_0x5df5('0x27')](_0x1fd83c[_0x5df5('0x28')]);if(_0x1fd83c['name']){delete _0x1fd83c[_0x5df5('0x29')];}_0xa7f4b3['status'](_0x1baf52)[_0x5df5('0x2a')](_0x1fd83c);};}exports[_0x5df5('0x2b')]=function(_0x5bc181,_0x3854d0){var _0x4945c6={},_0xd2b213={},_0x4cccf1={'count':0x0,'rows':[]};var _0x2e1885=_['map'](db[_0x5df5('0x2c')]['rawAttributes'],function(_0x2f91e3){return{'name':_0x2f91e3[_0x5df5('0x2d')],'type':_0x2f91e3[_0x5df5('0x2e')]['key']};});_0xd2b213[_0x5df5('0x2f')]=_[_0x5df5('0x30')](_0x2e1885,_0x5df5('0x29'));_0xd2b213[_0x5df5('0x31')]=_[_0x5df5('0x32')](_0x5bc181[_0x5df5('0x31')]);_0xd2b213[_0x5df5('0x33')]=_['intersection'](_0xd2b213['model'],_0xd2b213[_0x5df5('0x31')]);_0x4945c6[_0x5df5('0x34')]=_[_0x5df5('0x35')](_0xd2b213[_0x5df5('0x2f')],qs[_0x5df5('0x36')](_0x5bc181[_0x5df5('0x31')]['fields']));_0x4945c6[_0x5df5('0x34')]=_0x4945c6[_0x5df5('0x34')][_0x5df5('0x37')]?_0x4945c6[_0x5df5('0x34')]:_0xd2b213['model'];if(!_0x5bc181[_0x5df5('0x31')]['hasOwnProperty'](_0x5df5('0x38'))){_0x4945c6[_0x5df5('0x1c')]=qs['limit'](_0x5bc181[_0x5df5('0x31')]['limit']);_0x4945c6[_0x5df5('0x1e')]=qs[_0x5df5('0x1e')](_0x5bc181[_0x5df5('0x31')][_0x5df5('0x1e')]);}_0x4945c6['order']=qs[_0x5df5('0x39')](_0x5bc181[_0x5df5('0x31')][_0x5df5('0x39')]);_0x4945c6[_0x5df5('0x3a')]=qs['filters'](_[_0x5df5('0x3b')](_0x5bc181[_0x5df5('0x31')],_0xd2b213[_0x5df5('0x33')]),_0x2e1885);if(_0x5bc181[_0x5df5('0x31')][_0x5df5('0x3c')]){_0x4945c6[_0x5df5('0x3a')]=_[_0x5df5('0x3d')](_0x4945c6['where'],{'$or':_[_0x5df5('0x30')](_0x2e1885,function(_0x3102c7){if(_0x3102c7['type']!==_0x5df5('0x3e')){var _0x217844={};_0x217844[_0x3102c7['name']]={'$like':'%'+_0x5bc181[_0x5df5('0x31')][_0x5df5('0x3c')]+'%'};return _0x217844;}})});}_0x4945c6=_[_0x5df5('0x3d')]({},_0x4945c6,_0x5bc181[_0x5df5('0x3f')]);var _0x235f3e={'where':_0x4945c6[_0x5df5('0x3a')]};return db[_0x5df5('0x2c')][_0x5df5('0x1d')](_0x235f3e)['then'](function(_0x5e6c93){_0x4cccf1[_0x5df5('0x1d')]=_0x5e6c93;if(_0x5bc181['query'][_0x5df5('0x40')]){_0x4945c6[_0x5df5('0x41')]=[{'all':!![]}];}return db['DeskField'][_0x5df5('0x42')](_0x4945c6);})[_0x5df5('0x25')](function(_0x23e592){_0x4cccf1[_0x5df5('0x43')]=_0x23e592;return _0x4cccf1;})[_0x5df5('0x25')](respondWithFilteredResult(_0x3854d0,_0x4945c6))[_0x5df5('0x44')](handleError(_0x3854d0,null));};exports[_0x5df5('0x45')]=function(_0x3902a1,_0x5824c3){var _0x42b562={'raw':!![],'where':{'id':_0x3902a1[_0x5df5('0x46')]['id']}},_0x4a4057={};_0x4a4057[_0x5df5('0x2f')]=_[_0x5df5('0x32')](db[_0x5df5('0x2c')][_0x5df5('0x47')]);_0x4a4057['query']=_[_0x5df5('0x32')](_0x3902a1[_0x5df5('0x31')]);_0x4a4057[_0x5df5('0x33')]=_['intersection'](_0x4a4057[_0x5df5('0x2f')],_0x4a4057[_0x5df5('0x31')]);_0x42b562['attributes']=_[_0x5df5('0x35')](_0x4a4057[_0x5df5('0x2f')],qs[_0x5df5('0x36')](_0x3902a1[_0x5df5('0x31')]['fields']));_0x42b562[_0x5df5('0x34')]=_0x42b562[_0x5df5('0x34')]['length']?_0x42b562[_0x5df5('0x34')]:_0x4a4057[_0x5df5('0x2f')];if(_0x3902a1[_0x5df5('0x31')]['includeAll']){_0x42b562[_0x5df5('0x41')]=[{'all':!![]}];}_0x42b562=_[_0x5df5('0x3d')]({},_0x42b562,_0x3902a1[_0x5df5('0x3f')]);return db[_0x5df5('0x2c')]['find'](_0x42b562)[_0x5df5('0x25')](handleEntityNotFound(_0x5824c3,null))[_0x5df5('0x25')](respondWithResult(_0x5824c3,null))[_0x5df5('0x44')](handleError(_0x5824c3,null));};exports[_0x5df5('0x48')]=function(_0x14f9ca,_0x5f44cb){return db['DeskField'][_0x5df5('0x48')](_0x14f9ca['body'],{})[_0x5df5('0x25')](respondWithResult(_0x5f44cb,0xc9))[_0x5df5('0x44')](handleError(_0x5f44cb,null));};exports[_0x5df5('0x24')]=function(_0x28108e,_0x48462e){if(_0x28108e[_0x5df5('0x49')]['id']){delete _0x28108e[_0x5df5('0x49')]['id'];}return db[_0x5df5('0x2c')][_0x5df5('0x4a')]({'where':{'id':_0x28108e[_0x5df5('0x46')]['id']}})[_0x5df5('0x25')](handleEntityNotFound(_0x48462e,null))['then'](saveUpdates(_0x28108e[_0x5df5('0x49')],null))['then'](respondWithResult(_0x48462e,null))[_0x5df5('0x44')](handleError(_0x48462e,null));};exports[_0x5df5('0x26')]=function(_0x17288f,_0x4d1ebd){return db[_0x5df5('0x2c')]['find']({'where':{'id':_0x17288f[_0x5df5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d1ebd,null))[_0x5df5('0x25')](removeEntity(_0x4d1ebd,null))[_0x5df5('0x44')](handleError(_0x4d1ebd,null));}; \ No newline at end of file +var _0x36b2=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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/license/util','sendStatus','status','end','offset','undefined','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskField','rawAttributes'];(function(_0x4faec0,_0x17626a){var _0x2132a4=function(_0x389324){while(--_0x389324){_0x4faec0['push'](_0x4faec0['shift']());}};_0x2132a4(++_0x17626a);}(_0x36b2,0x6b));var _0x236b=function(_0x5a939b,_0x3c4fcf){_0x5a939b=_0x5a939b-0x0;var _0x45e0f8=_0x36b2[_0x5a939b];return _0x45e0f8;};'use strict';var emlformat=require(_0x236b('0x0'));var rimraf=require(_0x236b('0x1'));var zipdir=require(_0x236b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x236b('0x3'));var moment=require(_0x236b('0x4'));var BPromise=require(_0x236b('0x5'));var Mustache=require('mustache');var util=require(_0x236b('0x6'));var path=require(_0x236b('0x7'));var sox=require('sox');var csv=require(_0x236b('0x8'));var ejs=require(_0x236b('0x9'));var fs=require('fs');var fs_extra=require(_0x236b('0xa'));var _=require(_0x236b('0xb'));var squel=require(_0x236b('0xc'));var crypto=require(_0x236b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x236b('0xe'));var toCsv=require(_0x236b('0x8'));var querystring=require(_0x236b('0xf'));var Papa=require(_0x236b('0x10'));var Redis=require('ioredis');var authService=require(_0x236b('0x11'));var qs=require(_0x236b('0x12'));var as=require(_0x236b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x236b('0x14'))(_0x236b('0x15'));var utils=require(_0x236b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x236b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52393a,_0x1ee631){_0x1ee631=_0x1ee631||0xcc;return function(_0x5d5d8a){if(_0x5d5d8a){return _0x52393a[_0x236b('0x18')](_0x1ee631);}return _0x52393a[_0x236b('0x19')](_0x1ee631)[_0x236b('0x1a')]();};}function respondWithResult(_0x2410a5,_0x2df000){_0x2df000=_0x2df000||0xc8;return function(_0xa772f3){if(_0xa772f3){return _0x2410a5[_0x236b('0x19')](_0x2df000)['json'](_0xa772f3);}};}function respondWithFilteredResult(_0x5476ac,_0xcc6d01){return function(_0x13248a){if(_0x13248a){var _0x258935=typeof _0xcc6d01[_0x236b('0x1b')]===_0x236b('0x1c')&&typeof _0xcc6d01['limit']==='undefined';var _0xab13f4=_0x13248a['count'];var _0x18878f=_0x258935?0x0:_0xcc6d01[_0x236b('0x1b')];var _0x5a6c07=_0x258935?_0x13248a['count']:_0xcc6d01[_0x236b('0x1b')]+_0xcc6d01['limit'];var _0x1be23c;if(_0x5a6c07>=_0xab13f4){_0x5a6c07=_0xab13f4;_0x1be23c=0xc8;}else{_0x1be23c=0xce;}_0x5476ac['status'](_0x1be23c);return _0x5476ac['set'](_0x236b('0x1d'),_0x18878f+'-'+_0x5a6c07+'/'+_0xab13f4)[_0x236b('0x1e')](_0x13248a);}return null;};}function patchUpdates(_0x3f4ed3){return function(_0x35e4f1){try{jsonpatch[_0x236b('0x1f')](_0x35e4f1,_0x3f4ed3,!![]);}catch(_0x7a1430){return BPromise[_0x236b('0x20')](_0x7a1430);}return _0x35e4f1[_0x236b('0x21')]();};}function saveUpdates(_0x1159c5,_0x1927a1){return function(_0x168ede){if(_0x168ede){return _0x168ede[_0x236b('0x22')](_0x1159c5)['then'](function(_0xc135e7){return _0xc135e7;});}return null;};}function removeEntity(_0xc8d8cf,_0x5711a9){return function(_0xb18e7){if(_0xb18e7){return _0xb18e7[_0x236b('0x23')]()[_0x236b('0x24')](function(){_0xc8d8cf['status'](0xcc)[_0x236b('0x1a')]();});}};}function handleEntityNotFound(_0x1617f8,_0xd405b3){return function(_0x154905){if(!_0x154905){_0x1617f8[_0x236b('0x18')](0x194);}return _0x154905;};}function handleError(_0x29e0ec,_0x9702b2){_0x9702b2=_0x9702b2||0x1f4;return function(_0x4d319e){logger[_0x236b('0x25')](_0x4d319e[_0x236b('0x26')]);if(_0x4d319e[_0x236b('0x27')]){delete _0x4d319e[_0x236b('0x27')];}_0x29e0ec[_0x236b('0x19')](_0x9702b2)[_0x236b('0x28')](_0x4d319e);};}exports[_0x236b('0x29')]=function(_0x1b5a50,_0x1de15f){var _0x2e7fc5={},_0x15a520={},_0xa7cf2f={'count':0x0,'rows':[]};var _0xa81165=_[_0x236b('0x2a')](db[_0x236b('0x2b')][_0x236b('0x2c')],function(_0x48f727){return{'name':_0x48f727[_0x236b('0x2d')],'type':_0x48f727[_0x236b('0x2e')][_0x236b('0x2f')]};});_0x15a520['model']=_[_0x236b('0x2a')](_0xa81165,_0x236b('0x27'));_0x15a520[_0x236b('0x30')]=_[_0x236b('0x31')](_0x1b5a50[_0x236b('0x30')]);_0x15a520[_0x236b('0x32')]=_[_0x236b('0x33')](_0x15a520[_0x236b('0x34')],_0x15a520[_0x236b('0x30')]);_0x2e7fc5[_0x236b('0x35')]=_[_0x236b('0x33')](_0x15a520[_0x236b('0x34')],qs[_0x236b('0x36')](_0x1b5a50[_0x236b('0x30')][_0x236b('0x36')]));_0x2e7fc5['attributes']=_0x2e7fc5[_0x236b('0x35')]['length']?_0x2e7fc5['attributes']:_0x15a520[_0x236b('0x34')];if(!_0x1b5a50[_0x236b('0x30')][_0x236b('0x37')](_0x236b('0x38'))){_0x2e7fc5[_0x236b('0x39')]=qs[_0x236b('0x39')](_0x1b5a50['query'][_0x236b('0x39')]);_0x2e7fc5['offset']=qs['offset'](_0x1b5a50[_0x236b('0x30')][_0x236b('0x1b')]);}_0x2e7fc5[_0x236b('0x3a')]=qs[_0x236b('0x3b')](_0x1b5a50[_0x236b('0x30')]['sort']);_0x2e7fc5[_0x236b('0x3c')]=qs[_0x236b('0x32')](_[_0x236b('0x3d')](_0x1b5a50[_0x236b('0x30')],_0x15a520[_0x236b('0x32')]),_0xa81165);if(_0x1b5a50[_0x236b('0x30')][_0x236b('0x3e')]){_0x2e7fc5[_0x236b('0x3c')]=_[_0x236b('0x3f')](_0x2e7fc5[_0x236b('0x3c')],{'$or':_[_0x236b('0x2a')](_0xa81165,function(_0x209759){if(_0x209759[_0x236b('0x2e')]!==_0x236b('0x40')){var _0x2423e5={};_0x2423e5[_0x209759[_0x236b('0x27')]]={'$like':'%'+_0x1b5a50[_0x236b('0x30')][_0x236b('0x3e')]+'%'};return _0x2423e5;}})});}_0x2e7fc5=_[_0x236b('0x3f')]({},_0x2e7fc5,_0x1b5a50[_0x236b('0x41')]);var _0x1cf466={'where':_0x2e7fc5['where']};return db['DeskField']['count'](_0x1cf466)[_0x236b('0x24')](function(_0x3b05c0){_0xa7cf2f[_0x236b('0x42')]=_0x3b05c0;if(_0x1b5a50[_0x236b('0x30')][_0x236b('0x43')]){_0x2e7fc5[_0x236b('0x44')]=[{'all':!![]}];}return db[_0x236b('0x2b')][_0x236b('0x45')](_0x2e7fc5);})[_0x236b('0x24')](function(_0x3bfcf3){_0xa7cf2f['rows']=_0x3bfcf3;return _0xa7cf2f;})[_0x236b('0x24')](respondWithFilteredResult(_0x1de15f,_0x2e7fc5))['catch'](handleError(_0x1de15f,null));};exports[_0x236b('0x46')]=function(_0x4d613c,_0x65c103){var _0x4f370c={'raw':!![],'where':{'id':_0x4d613c[_0x236b('0x47')]['id']}},_0xc5fb1c={};_0xc5fb1c[_0x236b('0x34')]=_[_0x236b('0x31')](db[_0x236b('0x2b')]['rawAttributes']);_0xc5fb1c[_0x236b('0x30')]=_['keys'](_0x4d613c[_0x236b('0x30')]);_0xc5fb1c['filters']=_[_0x236b('0x33')](_0xc5fb1c[_0x236b('0x34')],_0xc5fb1c['query']);_0x4f370c[_0x236b('0x35')]=_[_0x236b('0x33')](_0xc5fb1c[_0x236b('0x34')],qs[_0x236b('0x36')](_0x4d613c['query'][_0x236b('0x36')]));_0x4f370c['attributes']=_0x4f370c[_0x236b('0x35')]['length']?_0x4f370c[_0x236b('0x35')]:_0xc5fb1c['model'];if(_0x4d613c[_0x236b('0x30')][_0x236b('0x43')]){_0x4f370c[_0x236b('0x44')]=[{'all':!![]}];}_0x4f370c=_[_0x236b('0x3f')]({},_0x4f370c,_0x4d613c[_0x236b('0x41')]);return db['DeskField'][_0x236b('0x48')](_0x4f370c)['then'](handleEntityNotFound(_0x65c103,null))[_0x236b('0x24')](respondWithResult(_0x65c103,null))[_0x236b('0x49')](handleError(_0x65c103,null));};exports['create']=function(_0x1e11be,_0x1cecb5){return db['DeskField'][_0x236b('0x4a')](_0x1e11be['body'],{})['then'](respondWithResult(_0x1cecb5,0xc9))['catch'](handleError(_0x1cecb5,null));};exports[_0x236b('0x22')]=function(_0x31e83a,_0x1b940c){if(_0x31e83a['body']['id']){delete _0x31e83a[_0x236b('0x4b')]['id'];}return db['DeskField'][_0x236b('0x48')]({'where':{'id':_0x31e83a[_0x236b('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b940c,null))['then'](saveUpdates(_0x31e83a['body'],null))['then'](respondWithResult(_0x1b940c,null))[_0x236b('0x49')](handleError(_0x1b940c,null));};exports['destroy']=function(_0x4532e7,_0x151c91){return db[_0x236b('0x2b')]['find']({'where':{'id':_0x4532e7[_0x236b('0x47')]['id']}})[_0x236b('0x24')](handleEntityNotFound(_0x151c91,null))['then'](removeEntity(_0x151c91,null))['catch'](handleError(_0x151c91,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index daad663..03f363c 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 _0x1a9a=['desk_unique_index','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','DeskField'];(function(_0x41dda8,_0xdec0ff){var _0x3bb74f=function(_0x14441a){while(--_0x14441a){_0x41dda8['push'](_0x41dda8['shift']());}};_0x3bb74f(++_0xdec0ff);}(_0x1a9a,0xbc));var _0xa1a9=function(_0x301907,_0x254d69){_0x301907=_0x301907-0x0;var _0x598053=_0x1a9a[_0x301907];return _0x598053;};'use strict';var _=require(_0xa1a9('0x0'));var util=require(_0xa1a9('0x1'));var logger=require('../../config/logger')(_0xa1a9('0x2'));var moment=require('moment');var BPromise=require(_0xa1a9('0x3'));var rp=require(_0xa1a9('0x4'));var fs=require('fs');var path=require(_0xa1a9('0x5'));var rimraf=require('rimraf');var config=require(_0xa1a9('0x6'));var attributes=require(_0xa1a9('0x7'));module[_0xa1a9('0x8')]=function(_0x114b57,_0x4aefb1){return _0x114b57['define'](_0xa1a9('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa1a9('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x121c=['../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x121c,0x71));var _0xc121=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x121c[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require('lodash');var util=require(_0xc121('0x0'));var logger=require(_0xc121('0x1'))(_0xc121('0x2'));var moment=require(_0xc121('0x3'));var BPromise=require(_0xc121('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc121('0x5'));var rimraf=require(_0xc121('0x6'));var config=require(_0xc121('0x7'));var attributes=require('./intDeskField.attributes');module[_0xc121('0x8')]=function(_0x118c0f,_0x21368b){return _0x118c0f[_0xc121('0x9')](_0xc121('0xa'),attributes,{'tableName':_0xc121('0xb'),'paranoid':![],'indexes':[{'name':_0xc121('0xc'),'fields':[_0xc121('0xd'),_0xc121('0xe')],'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 63e688c..10f43c6 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 _0x8d68=['DeskField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x51c463,_0x1313c2){var _0x4666a7=function(_0x437a77){while(--_0x437a77){_0x51c463['push'](_0x51c463['shift']());}};_0x4666a7(++_0x1313c2);}(_0x8d68,0x138));var _0x88d6=function(_0x14e4f7,_0x4d62c6){_0x14e4f7=_0x14e4f7-0x0;var _0x55ea7f=_0x8d68[_0x14e4f7];return _0x55ea7f;};'use strict';var _=require(_0x88d6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x88d6('0x1'));var rs=require(_0x88d6('0x2'));var fs=require('fs');var Redis=require(_0x88d6('0x3'));var db=require(_0x88d6('0x4'))['db'];var utils=require(_0x88d6('0x5'));var logger=require(_0x88d6('0x6'))(_0x88d6('0x7'));var config=require('../../config/environment');var jayson=require(_0x88d6('0x8'));var client=jayson[_0x88d6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x470280,_0x5010a5,_0xb960c1){return new BPromise(function(_0x49e7c2,_0x2b2911){return client[_0x88d6('0xa')](_0x470280,_0xb960c1)[_0x88d6('0xb')](function(_0x2f1833){logger[_0x88d6('0xc')]('DeskField,\x20%s,\x20%s',_0x5010a5,_0x88d6('0xd'));logger[_0x88d6('0xe')](_0x88d6('0xf'),_0x5010a5,_0x88d6('0xd'),JSON['stringify'](_0x2f1833));if(_0x2f1833[_0x88d6('0x10')]){if(_0x2f1833['error'][_0x88d6('0x11')]===0x1f4){logger['error'](_0x88d6('0x12'),_0x5010a5,_0x2f1833[_0x88d6('0x10')][_0x88d6('0x13')]);return _0x2b2911(_0x2f1833[_0x88d6('0x10')][_0x88d6('0x13')]);}logger[_0x88d6('0x10')](_0x88d6('0x12'),_0x5010a5,_0x2f1833[_0x88d6('0x10')][_0x88d6('0x13')]);return _0x49e7c2(_0x2f1833['error']['message']);}else{logger[_0x88d6('0xc')](_0x88d6('0x12'),_0x5010a5,_0x88d6('0xd'));_0x49e7c2(_0x2f1833[_0x88d6('0x14')][_0x88d6('0x13')]);}})[_0x88d6('0x15')](function(_0x3228cb){logger['error'](_0x88d6('0x12'),_0x5010a5,_0x3228cb);_0x2b2911(_0x3228cb);});});} \ No newline at end of file +var _0x3a04=['jayson/promise','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0x3a04,0x1ee));var _0x43a0=function(_0x11e8ac,_0xe2068f){_0x11e8ac=_0x11e8ac-0x0;var _0xc35fdf=_0x3a04[_0x11e8ac];return _0xc35fdf;};'use strict';var _=require('lodash');var util=require(_0x43a0('0x0'));var moment=require(_0x43a0('0x1'));var BPromise=require(_0x43a0('0x2'));var rs=require(_0x43a0('0x3'));var fs=require('fs');var Redis=require(_0x43a0('0x4'));var db=require(_0x43a0('0x5'))['db'];var utils=require(_0x43a0('0x6'));var logger=require(_0x43a0('0x7'))(_0x43a0('0x8'));var config=require(_0x43a0('0x9'));var jayson=require(_0x43a0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfdde,_0x518268,_0x4e183c){return new BPromise(function(_0x259d70,_0x53e2e2){return client[_0x43a0('0xb')](_0x2dfdde,_0x4e183c)['then'](function(_0x4c7d74){logger[_0x43a0('0xc')](_0x43a0('0xd'),_0x518268,_0x43a0('0xe'));logger[_0x43a0('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x518268,_0x43a0('0xe'),JSON[_0x43a0('0x10')](_0x4c7d74));if(_0x4c7d74['error']){if(_0x4c7d74[_0x43a0('0x11')][_0x43a0('0x12')]===0x1f4){logger[_0x43a0('0x11')](_0x43a0('0xd'),_0x518268,_0x4c7d74[_0x43a0('0x11')]['message']);return _0x53e2e2(_0x4c7d74[_0x43a0('0x11')][_0x43a0('0x13')]);}logger[_0x43a0('0x11')](_0x43a0('0xd'),_0x518268,_0x4c7d74[_0x43a0('0x11')][_0x43a0('0x13')]);return _0x259d70(_0x4c7d74[_0x43a0('0x11')][_0x43a0('0x13')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x518268,_0x43a0('0xe'));_0x259d70(_0x4c7d74[_0x43a0('0x14')][_0x43a0('0x13')]);}})['catch'](function(_0x390dbb){logger['error']('DeskField,\x20%s,\x20%s',_0x518268,_0x390dbb);_0x53e2e2(_0x390dbb);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1cdfc16..8281347 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 _0xa1c0=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x330698,_0x5e4f86){var _0x5bbdd0=function(_0x547634){while(--_0x547634){_0x330698['push'](_0x330698['shift']());}};_0x5bbdd0(++_0x5e4f86);}(_0xa1c0,0x12c));var _0x0a1c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa1c0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0a1c('0x0'));var util=require(_0x0a1c('0x1'));var path=require(_0x0a1c('0x2'));var timeout=require(_0x0a1c('0x3'));var express=require(_0x0a1c('0x4'));var router=express[_0x0a1c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0a1c('0x6'));var interaction=require(_0x0a1c('0x7'));var config=require('../../config/environment');var controller=require(_0x0a1c('0x8'));router[_0x0a1c('0x9')]('/',auth[_0x0a1c('0xa')](),controller[_0x0a1c('0xb')]);router[_0x0a1c('0x9')](_0x0a1c('0xc'),auth[_0x0a1c('0xa')](),controller[_0x0a1c('0xd')]);router['get'](_0x0a1c('0xe'),auth[_0x0a1c('0xa')](),controller['getConfigurations']);router[_0x0a1c('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0a1c('0xf')]);router[_0x0a1c('0x10')]('/',auth[_0x0a1c('0xa')](),controller[_0x0a1c('0x11')]);router['post'](_0x0a1c('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0a1c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0a1c('0x13')]);router[_0x0a1c('0x14')](_0x0a1c('0xc'),auth[_0x0a1c('0xa')](),controller[_0x0a1c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5dee=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','/:id/fields'];(function(_0x3f6460,_0x3bdb9b){var _0x5d9ac6=function(_0x1ebb5e){while(--_0x1ebb5e){_0x3f6460['push'](_0x3f6460['shift']());}};_0x5d9ac6(++_0x3bdb9b);}(_0x5dee,0x106));var _0xe5de=function(_0x51c22b,_0x4d4855){_0x51c22b=_0x51c22b-0x0;var _0x404ae0=_0x5dee[_0x51c22b];return _0x404ae0;};'use strict';var multer=require(_0xe5de('0x0'));var util=require(_0xe5de('0x1'));var path=require(_0xe5de('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe5de('0x3')]();var fs_extra=require(_0xe5de('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe5de('0x5'));var config=require('../../config/environment');var controller=require(_0xe5de('0x6'));router[_0xe5de('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5de('0x8')]);router[_0xe5de('0x7')](_0xe5de('0x9'),auth['isAuthenticated'](),controller[_0xe5de('0xa')]);router[_0xe5de('0x7')](_0xe5de('0xb'),auth[_0xe5de('0xc')](),controller['getConfigurations']);router[_0xe5de('0x7')](_0xe5de('0xd'),auth['isAuthenticated'](),controller[_0xe5de('0xe')]);router[_0xe5de('0xf')]('/',auth[_0xe5de('0xc')](),controller[_0xe5de('0x10')]);router['post'](_0xe5de('0xb'),auth['isAuthenticated'](),controller[_0xe5de('0x11')]);router[_0xe5de('0x12')]('/:id',auth[_0xe5de('0xc')](),controller[_0xe5de('0x13')]);router[_0xe5de('0x14')](_0xe5de('0x9'),auth[_0xe5de('0xc')](),controller[_0xe5de('0x15')]);module[_0xe5de('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 6ab86c5..50993f7 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 _0x15c6=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1cb55d,_0xd9537){var _0xa553ca=function(_0x3188ee){while(--_0x3188ee){_0x1cb55d['push'](_0x1cb55d['shift']());}};_0xa553ca(++_0xd9537);}(_0x15c6,0x1cd));var _0x615c=function(_0x9a3d47,_0x1953a0){_0x9a3d47=_0x9a3d47-0x0;var _0xf60b78=_0x15c6[_0x9a3d47];return _0xf60b78;};'use strict';var Sequelize=require(_0x615c('0x0'));module[_0x615c('0x1')]={'name':{'type':Sequelize[_0x615c('0x2')]},'username':{'type':Sequelize[_0x615c('0x2')]},'password':{'type':Sequelize[_0x615c('0x2')]},'remoteUri':{'type':Sequelize[_0x615c('0x2')]},'tenantId':{'type':Sequelize[_0x615c('0x2')]},'clientId':{'type':Sequelize[_0x615c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x615c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9d5c=['sequelize','STRING'];(function(_0x5d743d,_0x508d8f){var _0x347fb7=function(_0x3daa8b){while(--_0x3daa8b){_0x5d743d['push'](_0x5d743d['shift']());}};_0x347fb7(++_0x508d8f);}(_0x9d5c,0x98));var _0xc9d5=function(_0x1d0e15,_0x1c98bd){_0x1d0e15=_0x1d0e15-0x0;var _0x5b115d=_0x9d5c[_0x1d0e15];return _0x5b115d;};'use strict';var Sequelize=require(_0xc9d5('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9d5('0x1')]},'username':{'type':Sequelize[_0xc9d5('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc9d5('0x1')]},'tenantId':{'type':Sequelize[_0xc9d5('0x1')]},'clientId':{'type':Sequelize[_0xc9d5('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc9d5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc9d5('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 a475434..f78d1e6 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 _0xb7aa=['channel','getDescriptions','Dynamics365Field','Subjects','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','remoteUri','tenantId','clientId','CloudProvider','data5','data7','modernAuthentication','POST','/oauth2/token','username','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','Attributes','includes','LogicalName','@odata.type','push','all','isNil','BooleanAttributeMetadata','forEach','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','stack','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','status','offset','undefined','count','Content-Range','json','then','destroy','end','sendStatus','name','send','index','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','type','options','where','Dynamics365Account','includeAll','include','params','rawAttributes','find','catch','create','body','update','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId'];(function(_0x2416b2,_0x134439){var _0x159c30=function(_0x2e335c){while(--_0x2e335c){_0x2416b2['push'](_0x2416b2['shift']());}};_0x159c30(++_0x134439);}(_0xb7aa,0x13b));var _0xab7a=function(_0x29eac6,_0x48f3c4){_0x29eac6=_0x29eac6-0x0;var _0x5c9d17=_0xb7aa[_0x29eac6];return _0x5c9d17;};'use strict';var rp=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var _=require(_0xab7a('0x2'));var qs=require(_0xab7a('0x3'));var logger=require('../../config/logger')(_0xab7a('0x4'));var db=require(_0xab7a('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x49382a,_0x25751a){_0x25751a=_0x25751a||0xc8;return function(_0x43b1fc){if(_0x43b1fc){return _0x49382a[_0xab7a('0x6')](_0x25751a)['json'](_0x43b1fc);}};}function respondWithFilteredResult(_0x260100,_0x2c4dd4){return function(_0xa63800){if(_0xa63800){var _0x1fdfb1=typeof _0x2c4dd4[_0xab7a('0x7')]===_0xab7a('0x8')&&typeof _0x2c4dd4['limit']===_0xab7a('0x8');var _0x18b260=_0xa63800[_0xab7a('0x9')];var _0x10fdb0=_0x1fdfb1?0x0:_0x2c4dd4[_0xab7a('0x7')];var _0x18d4a3=_0x1fdfb1?_0xa63800[_0xab7a('0x9')]:_0x2c4dd4['offset']+_0x2c4dd4['limit'];var _0x2852ee;if(_0x18d4a3>=_0x18b260){_0x18d4a3=_0x18b260;_0x2852ee=0xc8;}else{_0x2852ee=0xce;}_0x260100[_0xab7a('0x6')](_0x2852ee);return _0x260100['set'](_0xab7a('0xa'),_0x10fdb0+'-'+_0x18d4a3+'/'+_0x18b260)[_0xab7a('0xb')](_0xa63800);}return null;};}function saveUpdates(_0x8f9edb){return function(_0x2c7c0f){if(_0x2c7c0f){return _0x2c7c0f['update'](_0x8f9edb)[_0xab7a('0xc')](function(_0x362d29){return _0x362d29;});}return null;};}function removeEntity(_0x1e2c6f){return function(_0xbe892b){if(_0xbe892b){return _0xbe892b[_0xab7a('0xd')]()['then'](function(){_0x1e2c6f['status'](0xcc)[_0xab7a('0xe')]();});}};}function handleEntityNotFound(_0x463ec1){return function(_0x183555){if(!_0x183555){_0x463ec1[_0xab7a('0xf')](0x194);}return _0x183555;};}function handleError(_0x2d397a,_0x59b270){_0x59b270=_0x59b270||0x1f4;return function(_0x10e39c){logger['error'](_0x10e39c['stack']);if(_0x10e39c[_0xab7a('0x10')]){delete _0x10e39c['name'];}_0x2d397a['status'](_0x59b270)[_0xab7a('0x11')](_0x10e39c);};}exports[_0xab7a('0x12')]=function(_0x45f605,_0x228afc){var _0x235035={},_0x591a55={},_0x22cc03={'count':0x0,'rows':[]};var _0x54c076=_['map'](db['Dynamics365Account']['rawAttributes'],function(_0x204efe){return{'name':_0x204efe['fieldName'],'type':_0x204efe['type'][_0xab7a('0x13')]};});_0x591a55[_0xab7a('0x14')]=_[_0xab7a('0x15')](_0x54c076,_0xab7a('0x10'));_0x591a55[_0xab7a('0x16')]=_[_0xab7a('0x17')](_0x45f605[_0xab7a('0x16')]);_0x591a55[_0xab7a('0x18')]=_[_0xab7a('0x19')](_0x591a55[_0xab7a('0x14')],_0x591a55[_0xab7a('0x16')]);_0x235035[_0xab7a('0x1a')]=_['intersection'](_0x591a55[_0xab7a('0x14')],qs[_0xab7a('0x1b')](_0x45f605[_0xab7a('0x16')][_0xab7a('0x1b')]));_0x235035[_0xab7a('0x1a')]=_0x235035[_0xab7a('0x1a')][_0xab7a('0x1c')]?_0x235035[_0xab7a('0x1a')]:_0x591a55[_0xab7a('0x14')];if(!_0x45f605[_0xab7a('0x16')][_0xab7a('0x1d')](_0xab7a('0x1e'))){_0x235035[_0xab7a('0x1f')]=qs[_0xab7a('0x1f')](_0x45f605[_0xab7a('0x16')]['limit']);_0x235035[_0xab7a('0x7')]=qs[_0xab7a('0x7')](_0x45f605[_0xab7a('0x16')][_0xab7a('0x7')]);}_0x235035[_0xab7a('0x20')]=qs[_0xab7a('0x21')](_0x45f605[_0xab7a('0x16')][_0xab7a('0x21')]);_0x235035['where']=qs[_0xab7a('0x18')](_[_0xab7a('0x22')](_0x45f605[_0xab7a('0x16')],_0x591a55['filters']),_0x54c076);if(_0x45f605[_0xab7a('0x16')][_0xab7a('0x23')]){_0x235035['where']=_[_0xab7a('0x24')](_0x235035['where'],{'$or':_[_0xab7a('0x15')](_0x54c076,function(_0x24bce7){if(_0x24bce7[_0xab7a('0x25')]!=='VIRTUAL'){var _0x2294f5={};_0x2294f5[_0x24bce7[_0xab7a('0x10')]]={'$like':'%'+_0x45f605[_0xab7a('0x16')]['filter']+'%'};return _0x2294f5;}})});}_0x235035=_[_0xab7a('0x24')]({},_0x235035,_0x45f605[_0xab7a('0x26')]);var _0x70a4b5={'where':_0x235035[_0xab7a('0x27')]};return db[_0xab7a('0x28')][_0xab7a('0x9')](_0x70a4b5)[_0xab7a('0xc')](function(_0x127863){_0x22cc03['count']=_0x127863;if(_0x45f605[_0xab7a('0x16')][_0xab7a('0x29')]){_0x235035[_0xab7a('0x2a')]=[{'all':!![]}];}return db[_0xab7a('0x28')]['findAll'](_0x235035);})[_0xab7a('0xc')](function(_0x267a54){_0x22cc03['rows']=_0x267a54;return _0x22cc03;})['then'](respondWithFilteredResult(_0x228afc,_0x235035))['catch'](handleError(_0x228afc,null));};exports['show']=function(_0x3429da,_0x1eeb1){var _0x153f3a={'raw':![],'where':{'id':_0x3429da[_0xab7a('0x2b')]['id']}},_0x376033={};_0x376033[_0xab7a('0x14')]=_[_0xab7a('0x17')](db[_0xab7a('0x28')][_0xab7a('0x2c')]);_0x376033['query']=_[_0xab7a('0x17')](_0x3429da[_0xab7a('0x16')]);_0x376033['filters']=_[_0xab7a('0x19')](_0x376033['model'],_0x376033[_0xab7a('0x16')]);_0x153f3a[_0xab7a('0x1a')]=_[_0xab7a('0x19')](_0x376033[_0xab7a('0x14')],qs[_0xab7a('0x1b')](_0x3429da[_0xab7a('0x16')]['fields']));_0x153f3a[_0xab7a('0x1a')]=_0x153f3a['attributes'][_0xab7a('0x1c')]?_0x153f3a[_0xab7a('0x1a')]:_0x376033['model'];if(_0x3429da['query'][_0xab7a('0x29')]){_0x153f3a[_0xab7a('0x2a')]=[{'all':!![]}];}_0x153f3a=_[_0xab7a('0x24')]({},_0x153f3a,_0x3429da[_0xab7a('0x26')]);return db['Dynamics365Account'][_0xab7a('0x2d')](_0x153f3a)['then'](handleEntityNotFound(_0x1eeb1,null))[_0xab7a('0xc')](respondWithResult(_0x1eeb1,null))[_0xab7a('0x2e')](handleError(_0x1eeb1,null));};exports[_0xab7a('0x2f')]=function(_0x5cbed6,_0x5d19d3){return db[_0xab7a('0x28')][_0xab7a('0x2f')](_0x5cbed6[_0xab7a('0x30')],{})[_0xab7a('0xc')](respondWithResult(_0x5d19d3,0xc9))[_0xab7a('0x2e')](handleError(_0x5d19d3,null));};exports[_0xab7a('0x31')]=function(_0x32d8ed,_0x57a292){if(_0x32d8ed[_0xab7a('0x30')]['id']){delete _0x32d8ed[_0xab7a('0x30')]['id'];}return db['Dynamics365Account'][_0xab7a('0x2d')]({'where':{'id':_0x32d8ed[_0xab7a('0x2b')]['id']}})[_0xab7a('0xc')](handleEntityNotFound(_0x57a292,null))[_0xab7a('0xc')](saveUpdates(_0x32d8ed[_0xab7a('0x30')],null))[_0xab7a('0xc')](respondWithResult(_0x57a292,null))[_0xab7a('0x2e')](handleError(_0x57a292,null));};exports['destroy']=function(_0x5518b6,_0x52bd92){return db[_0xab7a('0x28')][_0xab7a('0x2d')]({'where':{'id':_0x5518b6['params']['id']}})[_0xab7a('0xc')](handleEntityNotFound(_0x52bd92,null))[_0xab7a('0xc')](removeEntity(_0x52bd92,null))[_0xab7a('0x2e')](handleError(_0x52bd92,null));};exports[_0xab7a('0x32')]=function(_0x56ad1b,_0x5f21a4){var _0x47c019={};var _0x43d900={};var _0x3274d6;var _0x4b33d8;return db[_0xab7a('0x28')]['findOne']({'where':{'id':_0x56ad1b[_0xab7a('0x2b')]['id']}})[_0xab7a('0xc')](handleEntityNotFound(_0x5f21a4,null))[_0xab7a('0xc')](function(_0x5c1092){if(_0x5c1092){_0x3274d6=_0x5c1092;_0x43d900[_0xab7a('0x14')]=_[_0xab7a('0x17')](db[_0xab7a('0x33')][_0xab7a('0x2c')]);_0x43d900[_0xab7a('0x16')]=_[_0xab7a('0x17')](_0x56ad1b['query']);_0x43d900[_0xab7a('0x18')]=_[_0xab7a('0x19')](_0x43d900[_0xab7a('0x14')],_0x43d900[_0xab7a('0x16')]);_0x47c019[_0xab7a('0x1a')]=_[_0xab7a('0x19')](_0x43d900['model'],qs['fields'](_0x56ad1b['query'][_0xab7a('0x1b')]));_0x47c019['attributes']=_0x47c019[_0xab7a('0x1a')][_0xab7a('0x1c')]?_0x47c019[_0xab7a('0x1a')]:_0x43d900[_0xab7a('0x14')];_0x47c019[_0xab7a('0x20')]=qs['sort'](_0x56ad1b[_0xab7a('0x16')][_0xab7a('0x21')]);_0x47c019[_0xab7a('0x27')]=qs[_0xab7a('0x18')](_[_0xab7a('0x22')](_0x56ad1b[_0xab7a('0x16')],_0x43d900[_0xab7a('0x18')]));if(_0x56ad1b[_0xab7a('0x16')][_0xab7a('0x23')]){_0x47c019[_0xab7a('0x27')]=_['merge'](_0x47c019[_0xab7a('0x27')],{'$or':_[_0xab7a('0x15')](_0x47c019[_0xab7a('0x1a')],function(_0x4a5758){var _0x26e32a={};_0x26e32a[_0x4a5758]={'$like':'%'+_0x56ad1b[_0xab7a('0x16')]['filter']+'%'};return _0x26e32a;})});}_0x47c019=_[_0xab7a('0x24')]({},_0x47c019,_0x56ad1b['options']);return _0x3274d6[_0xab7a('0x32')](_0x47c019);}})[_0xab7a('0xc')](function(_0x38812f){if(_0x38812f){_0x4b33d8=_0x38812f[_0xab7a('0x1c')];if(!_0x56ad1b[_0xab7a('0x16')][_0xab7a('0x1d')](_0xab7a('0x1e'))){_0x47c019[_0xab7a('0x1f')]=qs[_0xab7a('0x1f')](_0x56ad1b['query'][_0xab7a('0x1f')]);_0x47c019['offset']=qs[_0xab7a('0x7')](_0x56ad1b[_0xab7a('0x16')]['offset']);}return _0x3274d6['getConfigurations'](_0x47c019);}})['then'](function(_0x3bc74c){if(_0x3bc74c){return _0x3bc74c?{'count':_0x4b33d8,'rows':_0x3bc74c}:null;}})['then'](respondWithResult(_0x5f21a4,null))[_0xab7a('0x2e')](handleError(_0x5f21a4,null));};exports[_0xab7a('0x34')]=function(_0x2f685f,_0x2d9a67){if(_0x2f685f['body']['id']){delete _0x2f685f[_0xab7a('0x30')]['id'];}return db['Dynamics365Account'][_0xab7a('0x35')]({'where':{'id':_0x2f685f[_0xab7a('0x2b')]['id']}})[_0xab7a('0xc')](handleEntityNotFound(_0x2d9a67,null))[_0xab7a('0xc')](function(_0x36d638){if(_0x36d638){_0x2f685f[_0xab7a('0x30')][_0xab7a('0x36')]=_0x36d638['id'];_0x2f685f[_0xab7a('0x30')]['Subjects']=integrations['getSubjects'](_0x2f685f[_0xab7a('0x30')][_0xab7a('0x37')],_0x2f685f[_0xab7a('0x30')]['type']);_0x2f685f[_0xab7a('0x30')]['Descriptions']=integrations[_0xab7a('0x38')](_0x2f685f[_0xab7a('0x30')][_0xab7a('0x37')],_0x2f685f[_0xab7a('0x30')][_0xab7a('0x25')]);return db[_0xab7a('0x33')]['create'](_0x2f685f[_0xab7a('0x30')],{'include':[{'model':db[_0xab7a('0x39')],'as':_0xab7a('0x3a')},{'model':db[_0xab7a('0x39')],'as':_0xab7a('0x3b')}]});}return null;})['then'](respondWithResult(_0x2d9a67,null))[_0xab7a('0x2e')](handleError(_0x2d9a67,null));};function sanitizeRemoteUri(_0x163881){var _0x46a074=_0x163881[_0xab7a('0x3c')](-0x1);if(_0x46a074==='/')return _0x163881[_0xab7a('0x3d')](0x0,_0x163881[_0xab7a('0x3e')](_0x46a074));return _0x163881;}function getWebApiUrl(_0x49b180){return util[_0xab7a('0x3f')](_0xab7a('0x40'),_0x49b180);}exports['getFields']=function(_0x485709,_0x4b8d1d){var _0xfb2c68=_0x485709[_0xab7a('0x16')][_0xab7a('0x41')];var _0x37d894=_0xfb2c68===_0xab7a('0x42')?_0xab7a('0x43'):_0xab7a('0x44');var _0x39725f='';var _0x510f97='';var _0x1ce6ce='';var _0x25262d='';var _0x4f2f0c='';var _0x6c8bb2='';var _0x3c0fc5='';var _0xd12348='';var _0x2754af=[_0xab7a('0x45'),_0xab7a('0x46'),_0xab7a('0x47'),'ownerid',_0xab7a('0x48'),_0xab7a('0x49'),_0xab7a('0x4a'),_0xab7a('0x4b'),_0xab7a('0x4c'),_0xab7a('0x4d')];var _0x9a5b07=[_0xab7a('0x4e'),_0xab7a('0x4f'),_0xab7a('0x50'),_0xab7a('0x51'),_0xab7a('0x52'),_0xab7a('0x53'),_0xab7a('0x54'),_0xab7a('0x55'),_0xab7a('0x56'),_0xab7a('0x57'),_0xab7a('0x58'),_0xab7a('0x59'),_0xab7a('0x5a'),_0xab7a('0x5b'),_0xab7a('0x5c'),_0xab7a('0x5d'),_0xab7a('0x5e'),_0xab7a('0x5f'),'emailaddress',_0xab7a('0x60'),_0xab7a('0x61'),'entityimage_url','escalatedon',_0xab7a('0x62'),'firstresponsebykpiidname',_0xab7a('0x63'),_0xab7a('0x64'),_0xab7a('0x65'),'kbarticleidname',_0xab7a('0x66'),_0xab7a('0x67'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xab7a('0x68'),_0xab7a('0x69'),_0xab7a('0x6a'),_0xab7a('0x6b'),_0xab7a('0x6c'),_0xab7a('0x6d'),_0xab7a('0x6e'),_0xab7a('0x6f'),_0xab7a('0x70'),_0xab7a('0x71'),'owneridname','owneridtype',_0xab7a('0x72'),_0xab7a('0x73'),_0xab7a('0x74'),'primarycontactidyominame',_0xab7a('0x75'),'productidname','productserialnumber',_0xab7a('0x76'),_0xab7a('0x77'),_0xab7a('0x78'),_0xab7a('0x79'),_0xab7a('0x7a'),'sentimentvalue',_0xab7a('0x7b'),'slaname',_0xab7a('0x7c'),_0xab7a('0x7d'),'statuscode',_0xab7a('0x7e'),_0xab7a('0x7f'),_0xab7a('0x80'),_0xab7a('0x81'),_0xab7a('0x82'),'utcconversiontimezonecode',_0xab7a('0x83')];var _0x327cc4=_0x2754af[_0xab7a('0x84')](_0x9a5b07);return db[_0xab7a('0x28')][_0xab7a('0x35')]({'where':{'id':_0x485709[_0xab7a('0x2b')]['id']},'attributes':['id','username',_0xab7a('0x85'),_0xab7a('0x86'),_0xab7a('0x87'),_0xab7a('0x88'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0xab7a('0x89')],'as':'CloudProvider','attributes':['id',_0xab7a('0x8a'),_0xab7a('0x8b')]}]})[_0xab7a('0xc')](handleEntityNotFound(_0x4b8d1d,null))['then'](function(_0x5e84eb){if(_0x5e84eb){if(_0x5e84eb[_0xab7a('0x8c')]){_0x5e84eb['access_token']=_0x5e84eb[_0xab7a('0x89')]['data5'];_0xd12348=sanitizeRemoteUri(_0x5e84eb[_0xab7a('0x89')][_0xab7a('0x8b')]);_0x3c0fc5=getWebApiUrl(_0xd12348);return _0x5e84eb;}_0xd12348=sanitizeRemoteUri(_0x5e84eb[_0xab7a('0x86')]);_0x3c0fc5=getWebApiUrl(_0xd12348);var _0x41fdfd={'method':_0xab7a('0x8d'),'uri':'https://login.microsoftonline.com/'+_0x5e84eb[_0xab7a('0x87')]+_0xab7a('0x8e'),'form':{'client_id':_0x5e84eb[_0xab7a('0x88')],'resource':_0xd12348,'username':_0x5e84eb[_0xab7a('0x8f')],'password':_0x5e84eb['password'],'grant_type':_0xab7a('0x85'),'client_secret':_0x5e84eb[_0xab7a('0x90')]},'json':!![]};return rp(_0x41fdfd);}})[_0xab7a('0xc')](function(_0x250656){_0x6c8bb2=_0x250656[_0xab7a('0x91')];var _0xf7552a={'method':_0xab7a('0x92'),'uri':encodeURI(_0x3c0fc5+_0xab7a('0x93')+_0x37d894+'\x27'),'headers':{'Authorization':_0xab7a('0x94')+_0x6c8bb2,'If-None-Match':null,'OData-Version':_0xab7a('0x95')},'json':!![]};return rp(_0xf7552a);})[_0xab7a('0xc')](function(_0x9baac3){var _0x3c67f5=_0x9baac3['value'][0x0];var _0x49a7ea=_0x3c67f5[_0xab7a('0x96')];var _0x58b3ab={'method':_0xab7a('0x92'),'uri':_0x3c0fc5+'EntityDefinitions('+_0x49a7ea+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xab7a('0x94')+_0x6c8bb2,'If-None-Match':null,'OData-Version':_0xab7a('0x95')},'json':!![]};return rp(_0x58b3ab);})[_0xab7a('0xc')](function(_0x2e8c2f){_0x39725f=_0x2e8c2f;_0x510f97=_0x39725f[_0xab7a('0x97')];_0x510f97=_['remove'](_0x510f97,function(_0x56a6d2){return!_0x327cc4[_0xab7a('0x98')](_0x56a6d2[_0xab7a('0x99')]);});var _0x144fb6=[];var _0xda1bf2=[];_0x510f97['forEach'](function(_0x1ff075){if(_0x1ff075[_0xab7a('0x9a')]){var _0xf1645e=_0x1ff075['@odata.type'][_0xab7a('0x3d')](_0x1ff075[_0xab7a('0x9a')][_0xab7a('0x3e')]('.')+0x1);if(_0xf1645e==='PicklistAttributeMetadata'){_0x144fb6[_0xab7a('0x9b')](getSelectList(_0x3c0fc5,_0xfb2c68,_0xda1bf2,_0x39725f[_0xab7a('0x96')],_0x1ff075['MetadataId'],_0x6c8bb2));}}});return Promise[_0xab7a('0x9c')](_0x144fb6);})[_0xab7a('0xc')](function(_0x57e590){_0x1ce6ce=_0x57e590[0x0];var _0x5aab62=[];var _0x5b9ada=[];_0x510f97['forEach'](function(_0x3f4f0d){if(!_[_0xab7a('0x9d')](_0x3f4f0d[_0xab7a('0x9a')])){var _0x16828f=_0x3f4f0d['@odata.type'][_0xab7a('0x3d')](_0x3f4f0d['@odata.type'][_0xab7a('0x3e')]('.')+0x1);if(_0x16828f===_0xab7a('0x9e')){_0x5aab62[_0xab7a('0x9b')](getBooleanList(_0x3c0fc5,_0xfb2c68,_0x5b9ada,_0x39725f[_0xab7a('0x96')],_0x3f4f0d['MetadataId'],_0x6c8bb2));}}});return Promise[_0xab7a('0x9c')](_0x5aab62);})[_0xab7a('0xc')](function(_0x572cdd){_0x25262d=_0x572cdd[0x0];var _0x14115d=[];var _0x16b146=[];_0x510f97[_0xab7a('0x9f')](function(_0x12ab41){if(_0x12ab41[_0xab7a('0x9a')]){var _0x419631=_0x12ab41[_0xab7a('0x9a')][_0xab7a('0x3d')](_0x12ab41[_0xab7a('0x9a')][_0xab7a('0x3e')]('.')+0x1);if(_0x419631===_0xab7a('0xa0')||_0x419631==='DoubleAttributeMetadata'||_0x419631===_0xab7a('0xa1')||_0x419631==='IntegerAttributeMetadata'||_0x419631===_0xab7a('0xa2')||_0x419631===_0xab7a('0xa3')||_0x419631==='StatusAttributeMetadata'||_0x419631===_0xab7a('0xa4')||_0x419631===_0xab7a('0xa5')||_0x419631==='DecimalAttributeMetadata'){_0x14115d['push'](getInputList(_0x3c0fc5,_0xfb2c68,_0x419631,_0x16b146,_0x39725f[_0xab7a('0x96')],_0x12ab41[_0xab7a('0x96')],_0x6c8bb2));}}});return Promise[_0xab7a('0x9c')](_0x14115d);})[_0xab7a('0xc')](function(_0x428eb4){_0x4f2f0c=_0x428eb4[0x0];var _0x38af3a=_0x1ce6ce[_0xab7a('0x84')](_0x25262d)[_0xab7a('0x84')](_0x4f2f0c);var _0x8c1ca0={'count':_0x38af3a['length'],'rows':_0x38af3a};return _0x8c1ca0;})[_0xab7a('0xc')](respondWithResult(_0x4b8d1d,null))[_0xab7a('0x2e')](function(_0x26e9f1){var _0x1035f6=_0x485709[_0xab7a('0x16')][_0xab7a('0xa6')]?0x1f4:_0x26e9f1['statusCode']||0x1f4;logger['error'](_0x26e9f1[_0xab7a('0xa7')]);delete _0x26e9f1[_0xab7a('0x10')];if(_0x1035f6===0x191){_0x1035f6=0x190;}_0x4b8d1d['status'](_0x1035f6)[_0xab7a('0x11')](_0x485709[_0xab7a('0x16')][_0xab7a('0xa6')]?{'message':'Wrong\x20credentials','statusCode':_0x26e9f1[_0xab7a('0xa8')]}:_0x26e9f1);});};function getSelectList(_0x174011,_0x362612,_0x46a708,_0x591693,_0x41d4a5,_0x1a643e){var _0x40e85c={'method':_0xab7a('0x92'),'uri':_0x174011+_0xab7a('0xa9')+_0x591693+_0xab7a('0xaa')+_0x41d4a5+_0xab7a('0xab')+_0xab7a('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x1a643e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x40e85c)['then'](function(_0x4792be){var _0x12f6b0=[];var _0x174b16=_0x4792be[_0xab7a('0xad')][_0xab7a('0xae')];_0x174b16[_0xab7a('0x9f')](function(_0x20b46e){_0x12f6b0[_0xab7a('0x9b')]({'name':_0x20b46e[_0xab7a('0xaf')][_0xab7a('0xb0')][_0xab7a('0xaf')],'value':String(_0x20b46e[_0xab7a('0xb1')])});});var _0x54906d={'id':_0x362612+'_'+_0x4792be['LogicalName'],'name':_0x4792be['DisplayName'][_0xab7a('0xb0')][_0xab7a('0xaf')],'custom':![],'options':_0x12f6b0};_0x46a708['push'](_0x54906d);return _0x46a708;});}function getBooleanList(_0x5ca78c,_0x6dd808,_0x57f06b,_0x1ba914,_0x4285be,_0x3643d2){var _0x2d244a={'method':'GET','uri':_0x5ca78c+'EntityDefinitions('+_0x1ba914+')/Attributes('+_0x4285be+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xab7a('0x94')+_0x3643d2,'If-None-Match':null,'OData-Version':_0xab7a('0x95')},'json':!![]};return rp(_0x2d244a)[_0xab7a('0xc')](function(_0x3c659f){var _0x2f623a=[];_0x2f623a[_0xab7a('0x9b')]({'name':_0x3c659f['OptionSet'][_0xab7a('0xb2')]['Label'][_0xab7a('0xb0')][_0xab7a('0xaf')],'value':_0xab7a('0xb3')},{'name':_0x3c659f[_0xab7a('0xad')][_0xab7a('0xb4')][_0xab7a('0xaf')][_0xab7a('0xb0')][_0xab7a('0xaf')],'value':_0xab7a('0xb5')});var _0x5e5882={'id':_0x6dd808+'_'+_0x3c659f[_0xab7a('0x99')],'name':_0x3c659f['DisplayName'][_0xab7a('0xb0')]['Label'],'custom':![],'options':_0x2f623a};_0x57f06b[_0xab7a('0x9b')](_0x5e5882);return _0x57f06b;});}function getInputList(_0x3f12a0,_0x48d3e4,_0x476f6e,_0x3a9cd0,_0x2ac3d3,_0x4eaa30,_0x3aa651){var _0x369be6={'method':_0xab7a('0x92'),'uri':_0x3f12a0+_0xab7a('0xa9')+_0x2ac3d3+_0xab7a('0xaa')+_0x4eaa30+_0xab7a('0xb6')+_0x476f6e+_0xab7a('0xb7'),'headers':{'Authorization':_0xab7a('0x94')+_0x3aa651,'If-None-Match':null,'OData-Version':_0xab7a('0x95')},'json':!![]};return rp(_0x369be6)['then'](function(_0x2a2964){var _0x51978b={'id':_0x48d3e4+'_'+_0x2a2964['LogicalName'],'name':_0x2a2964['DisplayName'][_0xab7a('0xb0')]?_0x2a2964[_0xab7a('0xb8')][_0xab7a('0xb0')]['Label']:_0x2a2964[_0xab7a('0x99')],'custom':![],'options':[]};_0x3a9cd0[_0xab7a('0x9b')](_0x51978b);return _0x3a9cd0;});} \ No newline at end of file +var _0x9af1=['find','create','body','getConfigurations','findOne','order','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','Descriptions','slice','format','%s/api/data/v9.0/','getFields','incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','send','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','forEach','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','Dynamics365Account','includeAll','then','rows','catch','show','params','include','options'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x9af1,0x149));var _0x19af=function(_0x3a203e,_0x54d253){_0x3a203e=_0x3a203e-0x0;var _0x3c7db2=_0x9af1[_0x3a203e];return _0x3c7db2;};'use strict';var rp=require(_0x19af('0x0'));var util=require('util');var _=require(_0x19af('0x1'));var qs=require(_0x19af('0x2'));var logger=require(_0x19af('0x3'))(_0x19af('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x19af('0x5'));function respondWithResult(_0xf5475e,_0x8e69ec){_0x8e69ec=_0x8e69ec||0xc8;return function(_0x25fa3f){if(_0x25fa3f){return _0xf5475e[_0x19af('0x6')](_0x8e69ec)[_0x19af('0x7')](_0x25fa3f);}};}function respondWithFilteredResult(_0x4a6104,_0x5bd9ae){return function(_0x2ae9f2){if(_0x2ae9f2){var _0x386b1b=typeof _0x5bd9ae[_0x19af('0x8')]===_0x19af('0x9')&&typeof _0x5bd9ae[_0x19af('0xa')]===_0x19af('0x9');var _0x3234ac=_0x2ae9f2[_0x19af('0xb')];var _0x3e9957=_0x386b1b?0x0:_0x5bd9ae[_0x19af('0x8')];var _0x78832d=_0x386b1b?_0x2ae9f2['count']:_0x5bd9ae['offset']+_0x5bd9ae[_0x19af('0xa')];var _0x5280c3;if(_0x78832d>=_0x3234ac){_0x78832d=_0x3234ac;_0x5280c3=0xc8;}else{_0x5280c3=0xce;}_0x4a6104[_0x19af('0x6')](_0x5280c3);return _0x4a6104[_0x19af('0xc')](_0x19af('0xd'),_0x3e9957+'-'+_0x78832d+'/'+_0x3234ac)[_0x19af('0x7')](_0x2ae9f2);}return null;};}function saveUpdates(_0x5e8a3d){return function(_0x4746ce){if(_0x4746ce){return _0x4746ce[_0x19af('0xe')](_0x5e8a3d)['then'](function(_0x49a5b6){return _0x49a5b6;});}return null;};}function removeEntity(_0x593998){return function(_0xd8c7f9){if(_0xd8c7f9){return _0xd8c7f9[_0x19af('0xf')]()['then'](function(){_0x593998[_0x19af('0x6')](0xcc)[_0x19af('0x10')]();});}};}function handleEntityNotFound(_0x5106d9){return function(_0x3387d7){if(!_0x3387d7){_0x5106d9[_0x19af('0x11')](0x194);}return _0x3387d7;};}function handleError(_0x4b285f,_0x5c19e5){_0x5c19e5=_0x5c19e5||0x1f4;return function(_0x3ce3ac){logger['error'](_0x3ce3ac[_0x19af('0x12')]);if(_0x3ce3ac[_0x19af('0x13')]){delete _0x3ce3ac[_0x19af('0x13')];}_0x4b285f[_0x19af('0x6')](_0x5c19e5)['send'](_0x3ce3ac);};}exports[_0x19af('0x14')]=function(_0x587483,_0x1b3c4c){var _0x1b5c79={},_0x264e28={},_0x34e0f2={'count':0x0,'rows':[]};var _0x577184=_['map'](db['Dynamics365Account'][_0x19af('0x15')],function(_0x194c2c){return{'name':_0x194c2c[_0x19af('0x16')],'type':_0x194c2c[_0x19af('0x17')]['key']};});_0x264e28[_0x19af('0x18')]=_[_0x19af('0x19')](_0x577184,_0x19af('0x13'));_0x264e28[_0x19af('0x1a')]=_[_0x19af('0x1b')](_0x587483[_0x19af('0x1a')]);_0x264e28[_0x19af('0x1c')]=_[_0x19af('0x1d')](_0x264e28[_0x19af('0x18')],_0x264e28['query']);_0x1b5c79[_0x19af('0x1e')]=_[_0x19af('0x1d')](_0x264e28[_0x19af('0x18')],qs[_0x19af('0x1f')](_0x587483[_0x19af('0x1a')][_0x19af('0x1f')]));_0x1b5c79['attributes']=_0x1b5c79[_0x19af('0x1e')][_0x19af('0x20')]?_0x1b5c79['attributes']:_0x264e28[_0x19af('0x18')];if(!_0x587483[_0x19af('0x1a')]['hasOwnProperty'](_0x19af('0x21'))){_0x1b5c79[_0x19af('0xa')]=qs[_0x19af('0xa')](_0x587483[_0x19af('0x1a')]['limit']);_0x1b5c79[_0x19af('0x8')]=qs['offset'](_0x587483[_0x19af('0x1a')][_0x19af('0x8')]);}_0x1b5c79['order']=qs[_0x19af('0x22')](_0x587483[_0x19af('0x1a')]['sort']);_0x1b5c79['where']=qs[_0x19af('0x1c')](_[_0x19af('0x23')](_0x587483['query'],_0x264e28[_0x19af('0x1c')]),_0x577184);if(_0x587483[_0x19af('0x1a')][_0x19af('0x24')]){_0x1b5c79[_0x19af('0x25')]=_[_0x19af('0x26')](_0x1b5c79[_0x19af('0x25')],{'$or':_[_0x19af('0x19')](_0x577184,function(_0x17f789){if(_0x17f789['type']!==_0x19af('0x27')){var _0x4fd6a3={};_0x4fd6a3[_0x17f789['name']]={'$like':'%'+_0x587483[_0x19af('0x1a')][_0x19af('0x24')]+'%'};return _0x4fd6a3;}})});}_0x1b5c79=_[_0x19af('0x26')]({},_0x1b5c79,_0x587483['options']);var _0x3d10e5={'where':_0x1b5c79['where']};return db[_0x19af('0x28')]['count'](_0x3d10e5)['then'](function(_0xb8a383){_0x34e0f2[_0x19af('0xb')]=_0xb8a383;if(_0x587483['query'][_0x19af('0x29')]){_0x1b5c79['include']=[{'all':!![]}];}return db[_0x19af('0x28')]['findAll'](_0x1b5c79);})[_0x19af('0x2a')](function(_0x556aea){_0x34e0f2[_0x19af('0x2b')]=_0x556aea;return _0x34e0f2;})[_0x19af('0x2a')](respondWithFilteredResult(_0x1b3c4c,_0x1b5c79))[_0x19af('0x2c')](handleError(_0x1b3c4c,null));};exports[_0x19af('0x2d')]=function(_0x17b4a6,_0x3aa4ba){var _0x1484d3={'raw':![],'where':{'id':_0x17b4a6[_0x19af('0x2e')]['id']}},_0x5d63f6={};_0x5d63f6[_0x19af('0x18')]=_[_0x19af('0x1b')](db[_0x19af('0x28')][_0x19af('0x15')]);_0x5d63f6[_0x19af('0x1a')]=_[_0x19af('0x1b')](_0x17b4a6[_0x19af('0x1a')]);_0x5d63f6[_0x19af('0x1c')]=_['intersection'](_0x5d63f6[_0x19af('0x18')],_0x5d63f6[_0x19af('0x1a')]);_0x1484d3[_0x19af('0x1e')]=_[_0x19af('0x1d')](_0x5d63f6[_0x19af('0x18')],qs[_0x19af('0x1f')](_0x17b4a6[_0x19af('0x1a')][_0x19af('0x1f')]));_0x1484d3['attributes']=_0x1484d3[_0x19af('0x1e')][_0x19af('0x20')]?_0x1484d3[_0x19af('0x1e')]:_0x5d63f6[_0x19af('0x18')];if(_0x17b4a6[_0x19af('0x1a')][_0x19af('0x29')]){_0x1484d3[_0x19af('0x2f')]=[{'all':!![]}];}_0x1484d3=_['merge']({},_0x1484d3,_0x17b4a6[_0x19af('0x30')]);return db['Dynamics365Account'][_0x19af('0x31')](_0x1484d3)[_0x19af('0x2a')](handleEntityNotFound(_0x3aa4ba,null))[_0x19af('0x2a')](respondWithResult(_0x3aa4ba,null))['catch'](handleError(_0x3aa4ba,null));};exports[_0x19af('0x32')]=function(_0x2fab67,_0x423eba){return db[_0x19af('0x28')][_0x19af('0x32')](_0x2fab67[_0x19af('0x33')],{})['then'](respondWithResult(_0x423eba,0xc9))[_0x19af('0x2c')](handleError(_0x423eba,null));};exports[_0x19af('0xe')]=function(_0xf9e050,_0x370bbc){if(_0xf9e050[_0x19af('0x33')]['id']){delete _0xf9e050[_0x19af('0x33')]['id'];}return db[_0x19af('0x28')]['find']({'where':{'id':_0xf9e050[_0x19af('0x2e')]['id']}})['then'](handleEntityNotFound(_0x370bbc,null))['then'](saveUpdates(_0xf9e050[_0x19af('0x33')],null))[_0x19af('0x2a')](respondWithResult(_0x370bbc,null))['catch'](handleError(_0x370bbc,null));};exports['destroy']=function(_0x531758,_0x134ff6){return db[_0x19af('0x28')][_0x19af('0x31')]({'where':{'id':_0x531758['params']['id']}})['then'](handleEntityNotFound(_0x134ff6,null))[_0x19af('0x2a')](removeEntity(_0x134ff6,null))[_0x19af('0x2c')](handleError(_0x134ff6,null));};exports[_0x19af('0x34')]=function(_0x428a05,_0x5d58e6){var _0x69532={};var _0x501573={};var _0x3da095;var _0x4b639a;return db[_0x19af('0x28')][_0x19af('0x35')]({'where':{'id':_0x428a05[_0x19af('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5d58e6,null))[_0x19af('0x2a')](function(_0x51a28c){if(_0x51a28c){_0x3da095=_0x51a28c;_0x501573[_0x19af('0x18')]=_[_0x19af('0x1b')](db['Dynamics365Configuration'][_0x19af('0x15')]);_0x501573[_0x19af('0x1a')]=_[_0x19af('0x1b')](_0x428a05[_0x19af('0x1a')]);_0x501573['filters']=_[_0x19af('0x1d')](_0x501573[_0x19af('0x18')],_0x501573[_0x19af('0x1a')]);_0x69532[_0x19af('0x1e')]=_[_0x19af('0x1d')](_0x501573[_0x19af('0x18')],qs['fields'](_0x428a05[_0x19af('0x1a')][_0x19af('0x1f')]));_0x69532[_0x19af('0x1e')]=_0x69532['attributes'][_0x19af('0x20')]?_0x69532[_0x19af('0x1e')]:_0x501573[_0x19af('0x18')];_0x69532[_0x19af('0x36')]=qs[_0x19af('0x22')](_0x428a05['query'][_0x19af('0x22')]);_0x69532[_0x19af('0x25')]=qs[_0x19af('0x1c')](_[_0x19af('0x23')](_0x428a05['query'],_0x501573['filters']));if(_0x428a05[_0x19af('0x1a')][_0x19af('0x24')]){_0x69532[_0x19af('0x25')]=_['merge'](_0x69532[_0x19af('0x25')],{'$or':_[_0x19af('0x19')](_0x69532[_0x19af('0x1e')],function(_0xba7ed){var _0x1e3d12={};_0x1e3d12[_0xba7ed]={'$like':'%'+_0x428a05['query'][_0x19af('0x24')]+'%'};return _0x1e3d12;})});}_0x69532=_[_0x19af('0x26')]({},_0x69532,_0x428a05[_0x19af('0x30')]);return _0x3da095['getConfigurations'](_0x69532);}})['then'](function(_0xd3eb0){if(_0xd3eb0){_0x4b639a=_0xd3eb0[_0x19af('0x20')];if(!_0x428a05[_0x19af('0x1a')]['hasOwnProperty'](_0x19af('0x21'))){_0x69532['limit']=qs[_0x19af('0xa')](_0x428a05[_0x19af('0x1a')]['limit']);_0x69532[_0x19af('0x8')]=qs[_0x19af('0x8')](_0x428a05[_0x19af('0x1a')][_0x19af('0x8')]);}return _0x3da095[_0x19af('0x34')](_0x69532);}})[_0x19af('0x2a')](function(_0x45aa4a){if(_0x45aa4a){return _0x45aa4a?{'count':_0x4b639a,'rows':_0x45aa4a}:null;}})[_0x19af('0x2a')](respondWithResult(_0x5d58e6,null))[_0x19af('0x2c')](handleError(_0x5d58e6,null));};exports['addConfiguration']=function(_0x501348,_0x5f1fbd){if(_0x501348[_0x19af('0x33')]['id']){delete _0x501348[_0x19af('0x33')]['id'];}return db[_0x19af('0x28')]['findOne']({'where':{'id':_0x501348[_0x19af('0x2e')]['id']}})[_0x19af('0x2a')](handleEntityNotFound(_0x5f1fbd,null))[_0x19af('0x2a')](function(_0x11113c){if(_0x11113c){_0x501348[_0x19af('0x33')][_0x19af('0x37')]=_0x11113c['id'];_0x501348[_0x19af('0x33')][_0x19af('0x38')]=integrations[_0x19af('0x39')](_0x501348[_0x19af('0x33')]['channel'],_0x501348[_0x19af('0x33')][_0x19af('0x17')]);_0x501348[_0x19af('0x33')]['Descriptions']=integrations[_0x19af('0x3a')](_0x501348[_0x19af('0x33')][_0x19af('0x3b')],_0x501348['body']['type']);return db[_0x19af('0x3c')]['create'](_0x501348[_0x19af('0x33')],{'include':[{'model':db[_0x19af('0x3d')],'as':_0x19af('0x38')},{'model':db[_0x19af('0x3d')],'as':_0x19af('0x3e')}]});}return null;})[_0x19af('0x2a')](respondWithResult(_0x5f1fbd,null))[_0x19af('0x2c')](handleError(_0x5f1fbd,null));};function sanitizeRemoteUri(_0x559c95){var _0x22d484=_0x559c95[_0x19af('0x3f')](-0x1);if(_0x22d484==='/')return _0x559c95['substring'](0x0,_0x559c95['lastIndexOf'](_0x22d484));return _0x559c95;}function getWebApiUrl(_0x71aa26){return util[_0x19af('0x40')](_0x19af('0x41'),_0x71aa26);}exports[_0x19af('0x42')]=function(_0x4a652f,_0x886a51){var _0x5be615=_0x4a652f[_0x19af('0x1a')]['ticketType'];var _0x1ecb0d=_0x5be615===_0x19af('0x43')?'Incident':_0x19af('0x44');var _0x1b5f9d='';var _0x57e19b='';var _0x3300c2='';var _0x3a05f5='';var _0x163eab='';var _0x4fe596='';var _0x1bb88b='';var _0x2c127d='';var _0x5e7aad=['title',_0x19af('0x45'),_0x19af('0x46'),_0x19af('0x47'),_0x19af('0x48'),'subject',_0x19af('0x49'),_0x19af('0x4a'),_0x19af('0x4b'),_0x19af('0x4c')];var _0x385501=[_0x19af('0x4d'),'accountidyominame','actualserviceunits',_0x19af('0x4e'),_0x19af('0x4f'),_0x19af('0x50'),'contractdetailidname',_0x19af('0x51'),_0x19af('0x52'),_0x19af('0x53'),_0x19af('0x54'),_0x19af('0x55'),_0x19af('0x56'),'createdonbehalfbyname','createdonbehalfbyyominame','customeridname',_0x19af('0x57'),_0x19af('0x58'),_0x19af('0x59'),_0x19af('0x5a'),'entityimage_timestamp',_0x19af('0x5b'),_0x19af('0x5c'),_0x19af('0x5d'),_0x19af('0x5e'),_0x19af('0x5f'),_0x19af('0x60'),_0x19af('0x61'),'kbarticleidname',_0x19af('0x62'),_0x19af('0x63'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x19af('0x64'),_0x19af('0x65'),_0x19af('0x66'),_0x19af('0x67'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x19af('0x68'),_0x19af('0x69'),_0x19af('0x6a'),_0x19af('0x6b'),_0x19af('0x6c'),_0x19af('0x6d'),_0x19af('0x6e'),_0x19af('0x6f'),_0x19af('0x70'),_0x19af('0x71'),_0x19af('0x72'),_0x19af('0x73'),_0x19af('0x74'),_0x19af('0x75'),_0x19af('0x76'),_0x19af('0x77'),_0x19af('0x78'),'responsiblecontactidyominame',_0x19af('0x79'),_0x19af('0x7a'),'slaname',_0x19af('0x7b'),_0x19af('0x7c'),_0x19af('0x7d'),_0x19af('0x7e'),_0x19af('0x7f'),_0x19af('0x80'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0x19af('0x81')];var _0x34c8cf=_0x5e7aad[_0x19af('0x82')](_0x385501);return db['Dynamics365Account'][_0x19af('0x35')]({'where':{'id':_0x4a652f[_0x19af('0x2e')]['id']},'attributes':['id',_0x19af('0x83'),_0x19af('0x84'),_0x19af('0x85'),_0x19af('0x86'),_0x19af('0x87'),_0x19af('0x88'),'modernAuthentication'],'include':[{'model':db[_0x19af('0x89')],'as':_0x19af('0x89'),'attributes':['id',_0x19af('0x8a'),_0x19af('0x8b')]}]})[_0x19af('0x2a')](handleEntityNotFound(_0x886a51,null))[_0x19af('0x2a')](function(_0xef5a99){if(_0xef5a99){if(_0xef5a99['modernAuthentication']){_0xef5a99[_0x19af('0x8c')]=_0xef5a99[_0x19af('0x89')]['data5'];_0x2c127d=sanitizeRemoteUri(_0xef5a99[_0x19af('0x89')][_0x19af('0x8b')]);_0x1bb88b=getWebApiUrl(_0x2c127d);return _0xef5a99;}_0x2c127d=sanitizeRemoteUri(_0xef5a99['remoteUri']);_0x1bb88b=getWebApiUrl(_0x2c127d);var _0x146a2e={'method':_0x19af('0x8d'),'uri':'https://login.microsoftonline.com/'+_0xef5a99[_0x19af('0x86')]+_0x19af('0x8e'),'form':{'client_id':_0xef5a99[_0x19af('0x87')],'resource':_0x2c127d,'username':_0xef5a99[_0x19af('0x83')],'password':_0xef5a99[_0x19af('0x84')],'grant_type':_0x19af('0x84'),'client_secret':_0xef5a99[_0x19af('0x88')]},'json':!![]};return rp(_0x146a2e);}})[_0x19af('0x2a')](function(_0x3f13dd){_0x4fe596=_0x3f13dd['access_token'];var _0xe7a62f={'method':_0x19af('0x8f'),'uri':encodeURI(_0x1bb88b+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1ecb0d+'\x27'),'headers':{'Authorization':_0x19af('0x90')+_0x4fe596,'If-None-Match':null,'OData-Version':_0x19af('0x91')},'json':!![]};return rp(_0xe7a62f);})[_0x19af('0x2a')](function(_0x5d8662){var _0x11d5be=_0x5d8662[_0x19af('0x92')][0x0];var _0x20927a=_0x11d5be[_0x19af('0x93')];var _0x15a112={'method':_0x19af('0x8f'),'uri':_0x1bb88b+_0x19af('0x94')+_0x20927a+_0x19af('0x95'),'headers':{'Authorization':'Bearer\x20'+_0x4fe596,'If-None-Match':null,'OData-Version':_0x19af('0x91')},'json':!![]};return rp(_0x15a112);})[_0x19af('0x2a')](function(_0x3b6c0b){_0x1b5f9d=_0x3b6c0b;_0x57e19b=_0x1b5f9d['Attributes'];_0x57e19b=_[_0x19af('0x96')](_0x57e19b,function(_0x225507){return!_0x34c8cf[_0x19af('0x97')](_0x225507[_0x19af('0x98')]);});var _0x499598=[];var _0x205dce=[];_0x57e19b['forEach'](function(_0x429342){if(_0x429342[_0x19af('0x99')]){var _0x5e0f16=_0x429342[_0x19af('0x99')][_0x19af('0x9a')](_0x429342['@odata.type'][_0x19af('0x9b')]('.')+0x1);if(_0x5e0f16===_0x19af('0x9c')){_0x499598[_0x19af('0x9d')](getSelectList(_0x1bb88b,_0x5be615,_0x205dce,_0x1b5f9d[_0x19af('0x93')],_0x429342[_0x19af('0x93')],_0x4fe596));}}});return Promise['all'](_0x499598);})[_0x19af('0x2a')](function(_0x3f017f){_0x3300c2=_0x3f017f[0x0];var _0x2efd98=[];var _0x14f79c=[];_0x57e19b['forEach'](function(_0x4b9173){if(!_[_0x19af('0x9e')](_0x4b9173['@odata.type'])){var _0x238576=_0x4b9173[_0x19af('0x99')][_0x19af('0x9a')](_0x4b9173[_0x19af('0x99')][_0x19af('0x9b')]('.')+0x1);if(_0x238576===_0x19af('0x9f')){_0x2efd98[_0x19af('0x9d')](getBooleanList(_0x1bb88b,_0x5be615,_0x14f79c,_0x1b5f9d[_0x19af('0x93')],_0x4b9173[_0x19af('0x93')],_0x4fe596));}}});return Promise[_0x19af('0xa0')](_0x2efd98);})[_0x19af('0x2a')](function(_0xd90cc0){_0x3a05f5=_0xd90cc0[0x0];var _0x77e753=[];var _0x7ad25b=[];_0x57e19b['forEach'](function(_0x1e3550){if(_0x1e3550[_0x19af('0x99')]){var _0x9c4a9d=_0x1e3550[_0x19af('0x99')][_0x19af('0x9a')](_0x1e3550[_0x19af('0x99')][_0x19af('0x9b')]('.')+0x1);if(_0x9c4a9d===_0x19af('0xa1')||_0x9c4a9d===_0x19af('0xa2')||_0x9c4a9d===_0x19af('0xa3')||_0x9c4a9d===_0x19af('0xa4')||_0x9c4a9d===_0x19af('0xa5')||_0x9c4a9d===_0x19af('0xa6')||_0x9c4a9d===_0x19af('0xa7')||_0x9c4a9d===_0x19af('0xa8')||_0x9c4a9d==='StateAttributeMetadata'||_0x9c4a9d===_0x19af('0xa9')){_0x77e753[_0x19af('0x9d')](getInputList(_0x1bb88b,_0x5be615,_0x9c4a9d,_0x7ad25b,_0x1b5f9d['MetadataId'],_0x1e3550[_0x19af('0x93')],_0x4fe596));}}});return Promise[_0x19af('0xa0')](_0x77e753);})['then'](function(_0x39c438){_0x163eab=_0x39c438[0x0];var _0x3e9348=_0x3300c2[_0x19af('0x82')](_0x3a05f5)[_0x19af('0x82')](_0x163eab);var _0x5c6d8b={'count':_0x3e9348['length'],'rows':_0x3e9348};return _0x5c6d8b;})['then'](respondWithResult(_0x886a51,null))[_0x19af('0x2c')](function(_0x32ea3a){var _0x1e14dd=_0x4a652f['query'][_0x19af('0xaa')]?0x1f4:_0x32ea3a[_0x19af('0xab')]||0x1f4;logger[_0x19af('0xac')](_0x32ea3a[_0x19af('0x12')]);delete _0x32ea3a[_0x19af('0x13')];if(_0x1e14dd===0x191){_0x1e14dd=0x190;}_0x886a51[_0x19af('0x6')](_0x1e14dd)[_0x19af('0xad')](_0x4a652f[_0x19af('0x1a')][_0x19af('0xaa')]?{'message':_0x19af('0xae'),'statusCode':_0x32ea3a[_0x19af('0xab')]}:_0x32ea3a);});};function getSelectList(_0x353baa,_0x389588,_0x57e966,_0x1a1600,_0xfef2b6,_0x39ed93){var _0x28182e={'method':_0x19af('0x8f'),'uri':_0x353baa+_0x19af('0x94')+_0x1a1600+')/Attributes('+_0xfef2b6+_0x19af('0xaf')+_0x19af('0xb0'),'headers':{'Authorization':_0x19af('0x90')+_0x39ed93,'If-None-Match':null,'OData-Version':_0x19af('0x91')},'json':!![]};return rp(_0x28182e)[_0x19af('0x2a')](function(_0x2698b0){var _0xd52f8=[];var _0x145fb9=_0x2698b0[_0x19af('0xb1')]['Options'];_0x145fb9[_0x19af('0xb2')](function(_0x44fd85){_0xd52f8[_0x19af('0x9d')]({'name':_0x44fd85[_0x19af('0xb3')][_0x19af('0xb4')]['Label'],'value':String(_0x44fd85[_0x19af('0xb5')])});});var _0x4cb2a4={'id':_0x389588+'_'+_0x2698b0[_0x19af('0x98')],'name':_0x2698b0[_0x19af('0xb6')][_0x19af('0xb4')][_0x19af('0xb3')],'custom':![],'options':_0xd52f8};_0x57e966[_0x19af('0x9d')](_0x4cb2a4);return _0x57e966;});}function getBooleanList(_0x509b90,_0x859191,_0x553f38,_0x1684b9,_0x30de64,_0x35e794){var _0x274ed2={'method':_0x19af('0x8f'),'uri':_0x509b90+_0x19af('0x94')+_0x1684b9+_0x19af('0xb7')+_0x30de64+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x19af('0x90')+_0x35e794,'If-None-Match':null,'OData-Version':_0x19af('0x91')},'json':!![]};return rp(_0x274ed2)[_0x19af('0x2a')](function(_0x27ca02){var _0x7c2c1d=[];_0x7c2c1d[_0x19af('0x9d')]({'name':_0x27ca02[_0x19af('0xb1')][_0x19af('0xb8')][_0x19af('0xb3')]['UserLocalizedLabel']['Label'],'value':_0x19af('0xb9')},{'name':_0x27ca02['OptionSet'][_0x19af('0xba')][_0x19af('0xb3')]['UserLocalizedLabel']['Label'],'value':_0x19af('0xbb')});var _0x20234f={'id':_0x859191+'_'+_0x27ca02[_0x19af('0x98')],'name':_0x27ca02[_0x19af('0xb6')][_0x19af('0xb4')]['Label'],'custom':![],'options':_0x7c2c1d};_0x553f38[_0x19af('0x9d')](_0x20234f);return _0x553f38;});}function getInputList(_0x40c4d5,_0x51ed5d,_0xdc4f80,_0x2d59d4,_0x1e3132,_0x284bdf,_0x1a7a27){var _0x4f9f73={'method':'GET','uri':_0x40c4d5+_0x19af('0x94')+_0x1e3132+_0x19af('0xb7')+_0x284bdf+')/Microsoft.Dynamics.CRM.'+_0xdc4f80+_0x19af('0xbc'),'headers':{'Authorization':_0x19af('0x90')+_0x1a7a27,'If-None-Match':null,'OData-Version':_0x19af('0x91')},'json':!![]};return rp(_0x4f9f73)[_0x19af('0x2a')](function(_0x202dae){var _0xf7ba37={'id':_0x51ed5d+'_'+_0x202dae['LogicalName'],'name':_0x202dae[_0x19af('0xb6')][_0x19af('0xb4')]?_0x202dae['DisplayName'][_0x19af('0xb4')][_0x19af('0xb3')]:_0x202dae[_0x19af('0x98')],'custom':![],'options':[]};_0x2d59d4[_0x19af('0x9d')](_0xf7ba37);return _0x2d59d4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7797032..5fe3c5f 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x392832,_0x24b780){var _0x24bc39=function(_0x3c2f82){while(--_0x3c2f82){_0x392832['push'](_0x392832['shift']());}};_0x24bc39(++_0x24b780);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x5a3830,_0x3d42e){var _0x346a62=function(_0x38a66d){while(--_0x38a66d){_0x5a3830['push'](_0x5a3830['shift']());}};_0x346a62(++_0x3d42e);}(_0xe706,0xa3));var _0x6e70=function(_0xe6f4ef,_0x4e34cc){_0xe6f4ef=_0xe6f4ef-0x0;var _0x4f3447=_0xe706[_0xe6f4ef];return _0x4f3447;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 6804e27..ff1fac7 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 _0x40e0=['findAll','options','attributes','include','model','map','debug','GetDynamics365Account','ShowDynamics365Account','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Account,\x20%s,\x20%s','info','catch','Dynamics365Account'];(function(_0x4e202d,_0x221567){var _0x24c04f=function(_0x19727f){while(--_0x19727f){_0x4e202d['push'](_0x4e202d['shift']());}};_0x24c04f(++_0x221567);}(_0x40e0,0x155));var _0x040e=function(_0x18e35d,_0x38c8e7){_0x18e35d=_0x18e35d-0x0;var _0x3cd646=_0x40e0[_0x18e35d];return _0x3cd646;};'use strict';var _=require(_0x040e('0x0'));var util=require(_0x040e('0x1'));var moment=require('moment');var BPromise=require(_0x040e('0x2'));var rs=require(_0x040e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x040e('0x4'))['db'];var utils=require(_0x040e('0x5'));var logger=require('../../config/logger')(_0x040e('0x6'));var config=require(_0x040e('0x7'));var jayson=require(_0x040e('0x8'));var client=jayson[_0x040e('0x9')][_0x040e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b93dc,_0x2dbfaa,_0x3658ea){return new BPromise(function(_0x16ebe9,_0x1dd963){return client[_0x040e('0xb')](_0x3b93dc,_0x3658ea)[_0x040e('0xc')](function(_0x34b2c9){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2dbfaa,_0x040e('0xd'));logger['debug'](_0x040e('0xe'),_0x2dbfaa,_0x040e('0xd'),JSON[_0x040e('0xf')](_0x34b2c9));if(_0x34b2c9[_0x040e('0x10')]){if(_0x34b2c9['error']['code']===0x1f4){logger[_0x040e('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2dbfaa,_0x34b2c9[_0x040e('0x10')][_0x040e('0x11')]);return _0x1dd963(_0x34b2c9[_0x040e('0x10')][_0x040e('0x11')]);}logger[_0x040e('0x10')](_0x040e('0x12'),_0x2dbfaa,_0x34b2c9[_0x040e('0x10')][_0x040e('0x11')]);return _0x16ebe9(_0x34b2c9[_0x040e('0x10')]['message']);}else{logger[_0x040e('0x13')](_0x040e('0x12'),_0x2dbfaa,_0x040e('0xd'));_0x16ebe9(_0x34b2c9['result'][_0x040e('0x11')]);}})[_0x040e('0x14')](function(_0x1b5d9b){logger[_0x040e('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2dbfaa,_0x1b5d9b);_0x1dd963(_0x1b5d9b);});});}exports['GetDynamics365Account']=function(_0x30c50c){var _0x45c297=this;return new Promise(function(_0x56879a,_0x2c61d0){return db[_0x040e('0x15')][_0x040e('0x16')]({'raw':_0x30c50c[_0x040e('0x17')]?_0x30c50c['options']['raw']===undefined?!![]:![]:!![],'where':_0x30c50c[_0x040e('0x17')]?_0x30c50c[_0x040e('0x17')]['where']||null:null,'attributes':_0x30c50c[_0x040e('0x17')]?_0x30c50c[_0x040e('0x17')][_0x040e('0x18')]||null:null,'limit':_0x30c50c[_0x040e('0x17')]?_0x30c50c[_0x040e('0x17')]['limit']||null:null,'include':_0x30c50c['options']?_0x30c50c['options'][_0x040e('0x19')]?_['map'](_0x30c50c[_0x040e('0x17')][_0x040e('0x19')],function(_0x432ba4){return{'model':db[_0x432ba4[_0x040e('0x1a')]],'as':_0x432ba4['as'],'attributes':_0x432ba4[_0x040e('0x18')],'include':_0x432ba4[_0x040e('0x19')]?_[_0x040e('0x1b')](_0x432ba4[_0x040e('0x19')],function(_0xc42567){return{'model':db[_0xc42567[_0x040e('0x1a')]],'as':_0xc42567['as'],'attributes':_0xc42567[_0x040e('0x18')],'include':_0xc42567[_0x040e('0x19')]?_['map'](_0xc42567[_0x040e('0x19')],function(_0x1f7100){return{'model':db[_0x1f7100[_0x040e('0x1a')]],'as':_0x1f7100['as'],'attributes':_0x1f7100['attributes']};}):[]};}):[]};}):[]:[]})[_0x040e('0xc')](function(_0x51f04e){logger[_0x040e('0x13')]('GetDynamics365Account',_0x30c50c);logger[_0x040e('0x1c')](_0x040e('0x1d'),_0x30c50c,JSON['stringify'](_0x51f04e));_0x56879a(_0x51f04e);})['catch'](function(_0x46a2aa){logger['error'](_0x040e('0x1d'),_0x46a2aa[_0x040e('0x11')],_0x30c50c);_0x2c61d0(_0x45c297[_0x040e('0x10')](0x1f4,_0x46a2aa['message']));});});};exports[_0x040e('0x1e')]=function(_0x12405c){var _0x24653b=this;return new Promise(function(_0x2be4ea,_0x4d7b61){return db['Dynamics365Account'][_0x040e('0x1f')]({'raw':_0x12405c[_0x040e('0x17')]?_0x12405c['options']['raw']===undefined?!![]:![]:!![],'where':_0x12405c['options']?_0x12405c[_0x040e('0x17')][_0x040e('0x20')]||null:null,'attributes':_0x12405c['options']?_0x12405c[_0x040e('0x17')][_0x040e('0x18')]||null:null,'include':_0x12405c['options']?_0x12405c[_0x040e('0x17')][_0x040e('0x19')]?_[_0x040e('0x1b')](_0x12405c[_0x040e('0x17')]['include'],function(_0x45dc5f){return{'model':db[_0x45dc5f['model']],'as':_0x45dc5f['as'],'attributes':_0x45dc5f[_0x040e('0x18')],'include':_0x45dc5f['include']?_[_0x040e('0x1b')](_0x45dc5f[_0x040e('0x19')],function(_0x3927cc){return{'model':db[_0x3927cc[_0x040e('0x1a')]],'as':_0x3927cc['as'],'attributes':_0x3927cc[_0x040e('0x18')],'include':_0x3927cc[_0x040e('0x19')]?_[_0x040e('0x1b')](_0x3927cc[_0x040e('0x19')],function(_0x125acd){return{'model':db[_0x125acd[_0x040e('0x1a')]],'as':_0x125acd['as'],'attributes':_0x125acd[_0x040e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab43a){logger[_0x040e('0x13')](_0x040e('0x1e'),_0x12405c);logger['debug']('ShowDynamics365Account',_0x12405c,JSON[_0x040e('0xf')](_0x5ab43a));_0x2be4ea(_0x5ab43a);})[_0x040e('0x14')](function(_0x1b1cf5){logger[_0x040e('0x10')](_0x040e('0x1e'),_0x1b1cf5[_0x040e('0x11')],_0x12405c);_0x4d7b61(_0x24653b['error'](0x1f4,_0x1b1cf5[_0x040e('0x11')]));});});}; \ No newline at end of file +var _0x2678=['error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','attributes','map','model','then','ShowDynamics365Account','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x50068c,_0x38a87a){var _0x11826a=function(_0x3bb53e){while(--_0x3bb53e){_0x50068c['push'](_0x50068c['shift']());}};_0x11826a(++_0x38a87a);}(_0x2678,0x11d));var _0x8267=function(_0x4bef2b,_0x453cfd){_0x4bef2b=_0x4bef2b-0x0;var _0x42584f=_0x2678[_0x4bef2b];return _0x42584f;};'use strict';var _=require(_0x8267('0x0'));var util=require('util');var moment=require(_0x8267('0x1'));var BPromise=require(_0x8267('0x2'));var rs=require(_0x8267('0x3'));var fs=require('fs');var Redis=require(_0x8267('0x4'));var db=require(_0x8267('0x5'))['db'];var utils=require(_0x8267('0x6'));var logger=require(_0x8267('0x7'))(_0x8267('0x8'));var config=require('../../config/environment');var jayson=require(_0x8267('0x9'));var client=jayson[_0x8267('0xa')][_0x8267('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d322a,_0x4b1cdf,_0x2594b2){return new BPromise(function(_0x5ed8b0,_0x59e7f0){return client[_0x8267('0xc')](_0x1d322a,_0x2594b2)['then'](function(_0x59e687){logger[_0x8267('0xd')](_0x8267('0xe'),_0x4b1cdf,_0x8267('0xf'));logger[_0x8267('0x10')](_0x8267('0x11'),_0x4b1cdf,_0x8267('0xf'),JSON[_0x8267('0x12')](_0x59e687));if(_0x59e687[_0x8267('0x13')]){if(_0x59e687[_0x8267('0x13')][_0x8267('0x14')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4b1cdf,_0x59e687['error'][_0x8267('0x15')]);return _0x59e7f0(_0x59e687[_0x8267('0x13')][_0x8267('0x15')]);}logger[_0x8267('0x13')](_0x8267('0xe'),_0x4b1cdf,_0x59e687['error'][_0x8267('0x15')]);return _0x5ed8b0(_0x59e687[_0x8267('0x13')][_0x8267('0x15')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4b1cdf,_0x8267('0xf'));_0x5ed8b0(_0x59e687[_0x8267('0x16')][_0x8267('0x15')]);}})[_0x8267('0x17')](function(_0x3e67e2){logger[_0x8267('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x4b1cdf,_0x3e67e2);_0x59e7f0(_0x3e67e2);});});}exports[_0x8267('0x18')]=function(_0x19ddcb){var _0x3d331c=this;return new Promise(function(_0x3c9477,_0xfa957b){return db[_0x8267('0x19')][_0x8267('0x1a')]({'raw':_0x19ddcb[_0x8267('0x1b')]?_0x19ddcb[_0x8267('0x1b')][_0x8267('0x1c')]===undefined?!![]:![]:!![],'where':_0x19ddcb[_0x8267('0x1b')]?_0x19ddcb[_0x8267('0x1b')][_0x8267('0x1d')]||null:null,'attributes':_0x19ddcb[_0x8267('0x1b')]?_0x19ddcb[_0x8267('0x1b')]['attributes']||null:null,'limit':_0x19ddcb[_0x8267('0x1b')]?_0x19ddcb['options'][_0x8267('0x1e')]||null:null,'include':_0x19ddcb[_0x8267('0x1b')]?_0x19ddcb[_0x8267('0x1b')][_0x8267('0x1f')]?_['map'](_0x19ddcb[_0x8267('0x1b')][_0x8267('0x1f')],function(_0x122919){return{'model':db[_0x122919['model']],'as':_0x122919['as'],'attributes':_0x122919[_0x8267('0x20')],'include':_0x122919[_0x8267('0x1f')]?_[_0x8267('0x21')](_0x122919[_0x8267('0x1f')],function(_0x1f778e){return{'model':db[_0x1f778e[_0x8267('0x22')]],'as':_0x1f778e['as'],'attributes':_0x1f778e[_0x8267('0x20')],'include':_0x1f778e[_0x8267('0x1f')]?_[_0x8267('0x21')](_0x1f778e[_0x8267('0x1f')],function(_0x5e9c52){return{'model':db[_0x5e9c52[_0x8267('0x22')]],'as':_0x5e9c52['as'],'attributes':_0x5e9c52[_0x8267('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8267('0x23')](function(_0x4f1a75){logger[_0x8267('0xd')](_0x8267('0x18'),_0x19ddcb);logger['debug'](_0x8267('0x18'),_0x19ddcb,JSON[_0x8267('0x12')](_0x4f1a75));_0x3c9477(_0x4f1a75);})[_0x8267('0x17')](function(_0x382a17){logger[_0x8267('0x13')]('GetDynamics365Account',_0x382a17[_0x8267('0x15')],_0x19ddcb);_0xfa957b(_0x3d331c[_0x8267('0x13')](0x1f4,_0x382a17[_0x8267('0x15')]));});});};exports[_0x8267('0x24')]=function(_0x2bd8e5){var _0x207c1d=this;return new Promise(function(_0xa184cd,_0x5a65bc){return db[_0x8267('0x19')][_0x8267('0x25')]({'raw':_0x2bd8e5[_0x8267('0x1b')]?_0x2bd8e5[_0x8267('0x1b')][_0x8267('0x1c')]===undefined?!![]:![]:!![],'where':_0x2bd8e5[_0x8267('0x1b')]?_0x2bd8e5[_0x8267('0x1b')][_0x8267('0x1d')]||null:null,'attributes':_0x2bd8e5['options']?_0x2bd8e5[_0x8267('0x1b')][_0x8267('0x20')]||null:null,'include':_0x2bd8e5['options']?_0x2bd8e5['options'][_0x8267('0x1f')]?_[_0x8267('0x21')](_0x2bd8e5[_0x8267('0x1b')][_0x8267('0x1f')],function(_0x3b1e35){return{'model':db[_0x3b1e35['model']],'as':_0x3b1e35['as'],'attributes':_0x3b1e35[_0x8267('0x20')],'include':_0x3b1e35[_0x8267('0x1f')]?_[_0x8267('0x21')](_0x3b1e35[_0x8267('0x1f')],function(_0x50c47d){return{'model':db[_0x50c47d[_0x8267('0x22')]],'as':_0x50c47d['as'],'attributes':_0x50c47d['attributes'],'include':_0x50c47d['include']?_['map'](_0x50c47d['include'],function(_0x27858b){return{'model':db[_0x27858b[_0x8267('0x22')]],'as':_0x27858b['as'],'attributes':_0x27858b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8267('0x23')](function(_0x2bb7bd){logger[_0x8267('0xd')](_0x8267('0x24'),_0x2bd8e5);logger[_0x8267('0x10')]('ShowDynamics365Account',_0x2bd8e5,JSON[_0x8267('0x12')](_0x2bb7bd));_0xa184cd(_0x2bb7bd);})[_0x8267('0x17')](function(_0xcc670){logger[_0x8267('0x13')](_0x8267('0x24'),_0xcc670[_0x8267('0x15')],_0x2bd8e5);_0x5a65bc(_0x207c1d[_0x8267('0x13')](0x1f4,_0xcc670[_0x8267('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 11bc1b6..4f225d2 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 _0x70e9=['post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','/:id','/:id/fields','getFields','get','/:id/subjects','getSubjects','getDescriptions'];(function(_0x51a086,_0x3b6858){var _0x5ca5fc=function(_0x52bc41){while(--_0x52bc41){_0x51a086['push'](_0x51a086['shift']());}};_0x5ca5fc(++_0x3b6858);}(_0x70e9,0x1d2));var _0x970e=function(_0x32076b,_0x2c69ad){_0x32076b=_0x32076b-0x0;var _0x68ad26=_0x70e9[_0x32076b];return _0x68ad26;};'use strict';var multer=require(_0x970e('0x0'));var util=require(_0x970e('0x1'));var path=require(_0x970e('0x2'));var timeout=require(_0x970e('0x3'));var express=require(_0x970e('0x4'));var router=express[_0x970e('0x5')]();var fs_extra=require(_0x970e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x970e('0x7'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x970e('0x8')](),controller[_0x970e('0x9')]);router['get'](_0x970e('0xa'),auth[_0x970e('0x8')](),controller['show']);router['get'](_0x970e('0xb'),auth[_0x970e('0x8')](),controller[_0x970e('0xc')]);router[_0x970e('0xd')](_0x970e('0xe'),auth[_0x970e('0x8')](),controller[_0x970e('0xf')]);router[_0x970e('0xd')]('/:id/descriptions',auth[_0x970e('0x8')](),controller[_0x970e('0x10')]);router[_0x970e('0x11')]('/',auth[_0x970e('0x8')](),controller['create']);router[_0x970e('0x12')](_0x970e('0xa'),auth[_0x970e('0x8')](),controller['update']);router[_0x970e('0x13')](_0x970e('0xa'),auth[_0x970e('0x8')](),controller[_0x970e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x094c=['getDescriptions','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x2c076b,_0x884471){var _0x564601=function(_0x335ff1){while(--_0x335ff1){_0x2c076b['push'](_0x2c076b['shift']());}};_0x564601(++_0x884471);}(_0x094c,0x131));var _0xc094=function(_0x2967b4,_0x9b5a9b){_0x2967b4=_0x2967b4-0x0;var _0x483322=_0x094c[_0x2967b4];return _0x483322;};'use strict';var multer=require('multer');var util=require(_0xc094('0x0'));var path=require(_0xc094('0x1'));var timeout=require('connect-timeout');var express=require(_0xc094('0x2'));var router=express[_0xc094('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc094('0x4'));var interaction=require(_0xc094('0x5'));var config=require(_0xc094('0x6'));var controller=require(_0xc094('0x7'));router[_0xc094('0x8')]('/',auth[_0xc094('0x9')](),controller[_0xc094('0xa')]);router['get'](_0xc094('0xb'),auth['isAuthenticated'](),controller[_0xc094('0xc')]);router[_0xc094('0x8')]('/:id/fields',auth[_0xc094('0x9')](),controller[_0xc094('0xd')]);router[_0xc094('0x8')](_0xc094('0xe'),auth[_0xc094('0x9')](),controller[_0xc094('0xf')]);router['get'](_0xc094('0x10'),auth[_0xc094('0x9')](),controller[_0xc094('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc094('0x12')]);router[_0xc094('0x13')](_0xc094('0xb'),auth[_0xc094('0x9')](),controller[_0xc094('0x14')]);router[_0xc094('0x15')]('/:id',auth[_0xc094('0x9')](),controller['destroy']);module[_0xc094('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0c03899..062f429 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 _0xbe42=['sequelize','exports','STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbe42,0x87));var _0x2be4=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0xbe42[_0x1a0c59];return _0xed67c9;};'use strict';var Sequelize=require(_0x2be4('0x0'));module[_0x2be4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2be4('0x2')]},'ticketType':{'type':Sequelize[_0x2be4('0x3')](_0x2be4('0x4'),_0x2be4('0x5')),'defaultValue':_0x2be4('0x4')},'moduleCreate':{'type':Sequelize[_0x2be4('0x3')](_0x2be4('0x6'),_0x2be4('0x7')),'defaultValue':_0x2be4('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2be4('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2be4('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xae6a=['nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','contact'];(function(_0x427bda,_0x5bc1ad){var _0x4bd366=function(_0x36a07c){while(--_0x36a07c){_0x427bda['push'](_0x427bda['shift']());}};_0x4bd366(++_0x5bc1ad);}(_0xae6a,0x172));var _0xaae6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xae6a[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xaae6('0x0'));module[_0xaae6('0x1')]={'name':{'type':Sequelize[_0xaae6('0x2')]},'description':{'type':Sequelize[_0xaae6('0x2')]},'ticketType':{'type':Sequelize[_0xaae6('0x3')](_0xaae6('0x4'),'phonecall'),'defaultValue':_0xaae6('0x4')},'moduleCreate':{'type':Sequelize[_0xaae6('0x3')](_0xaae6('0x5'),_0xaae6('0x6')),'defaultValue':_0xaae6('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xaae6('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xaae6('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 49ff4d3..430189c 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 _0xbf0d=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','getFields','hasOwnProperty','getSubjects','findOne','Dynamics365Field','getDescriptions','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x180a3b,_0x234e53){var _0x55806a=function(_0x4a6766){while(--_0x4a6766){_0x180a3b['push'](_0x180a3b['shift']());}};_0x55806a(++_0x234e53);}(_0xbf0d,0x1df));var _0xdbf0=function(_0x424e44,_0x402be9){_0x424e44=_0x424e44-0x0;var _0x49b69f=_0xbf0d[_0x424e44];return _0x49b69f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbf0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbf0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdbf0('0x2'));var util=require('util');var path=require(_0xdbf0('0x3'));var sox=require(_0xdbf0('0x4'));var csv=require(_0xdbf0('0x5'));var ejs=require(_0xdbf0('0x6'));var fs=require('fs');var fs_extra=require(_0xdbf0('0x7'));var _=require(_0xdbf0('0x8'));var squel=require(_0xdbf0('0x9'));var crypto=require(_0xdbf0('0xa'));var jsforce=require(_0xdbf0('0xb'));var deskjs=require(_0xdbf0('0xc'));var toCsv=require(_0xdbf0('0x5'));var querystring=require(_0xdbf0('0xd'));var Papa=require(_0xdbf0('0xe'));var Redis=require(_0xdbf0('0xf'));var authService=require(_0xdbf0('0x10'));var qs=require(_0xdbf0('0x11'));var as=require(_0xdbf0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbf0('0x13'))(_0xdbf0('0x14'));var utils=require(_0xdbf0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdbf0('0x16'));var db=require(_0xdbf0('0x17'))['db'];function respondWithStatusCode(_0x402807,_0x5a03cb){_0x5a03cb=_0x5a03cb||0xcc;return function(_0x512c5b){if(_0x512c5b){return _0x402807['sendStatus'](_0x5a03cb);}return _0x402807[_0xdbf0('0x18')](_0x5a03cb)[_0xdbf0('0x19')]();};}function respondWithResult(_0x315d44,_0x129810){_0x129810=_0x129810||0xc8;return function(_0x2198f2){if(_0x2198f2){return _0x315d44[_0xdbf0('0x18')](_0x129810)[_0xdbf0('0x1a')](_0x2198f2);}};}function respondWithFilteredResult(_0x35dd89,_0x2f8f68){return function(_0x48677c){if(_0x48677c){var _0x4f4040=typeof _0x2f8f68[_0xdbf0('0x1b')]===_0xdbf0('0x1c')&&typeof _0x2f8f68[_0xdbf0('0x1d')]==='undefined';var _0x5e469b=_0x48677c[_0xdbf0('0x1e')];var _0x56e45e=_0x4f4040?0x0:_0x2f8f68[_0xdbf0('0x1b')];var _0x5c9776=_0x4f4040?_0x48677c[_0xdbf0('0x1e')]:_0x2f8f68[_0xdbf0('0x1b')]+_0x2f8f68[_0xdbf0('0x1d')];var _0x13309a;if(_0x5c9776>=_0x5e469b){_0x5c9776=_0x5e469b;_0x13309a=0xc8;}else{_0x13309a=0xce;}_0x35dd89[_0xdbf0('0x18')](_0x13309a);return _0x35dd89['set'](_0xdbf0('0x1f'),_0x56e45e+'-'+_0x5c9776+'/'+_0x5e469b)[_0xdbf0('0x1a')](_0x48677c);}return null;};}function patchUpdates(_0x209b14){return function(_0x51c4e9){try{jsonpatch[_0xdbf0('0x20')](_0x51c4e9,_0x209b14,!![]);}catch(_0x21da06){return BPromise[_0xdbf0('0x21')](_0x21da06);}return _0x51c4e9[_0xdbf0('0x22')]();};}function saveUpdates(_0x35da11,_0xad4e06){return function(_0x1e56b3){if(_0x1e56b3){return _0x1e56b3[_0xdbf0('0x23')](_0x35da11)['then'](function(_0x476f8a){return _0x476f8a;});}return null;};}function removeEntity(_0x5409ed,_0x5dc02e){return function(_0x4e5c67){if(_0x4e5c67){return _0x4e5c67[_0xdbf0('0x24')]()[_0xdbf0('0x25')](function(){_0x5409ed['status'](0xcc)[_0xdbf0('0x19')]();});}};}function handleEntityNotFound(_0x1c5de7,_0x323518){return function(_0x5097b6){if(!_0x5097b6){_0x1c5de7[_0xdbf0('0x26')](0x194);}return _0x5097b6;};}function handleError(_0x5a571b,_0x34baf2){_0x34baf2=_0x34baf2||0x1f4;return function(_0x3a66d0){logger[_0xdbf0('0x27')](_0x3a66d0[_0xdbf0('0x28')]);if(_0x3a66d0['name']){delete _0x3a66d0[_0xdbf0('0x29')];}_0x5a571b[_0xdbf0('0x18')](_0x34baf2)[_0xdbf0('0x2a')](_0x3a66d0);};}exports[_0xdbf0('0x2b')]=function(_0x15ebef,_0xead7da){var _0x4fa4d3={},_0x4f9fdd={},_0x34be3f={'count':0x0,'rows':[]};var _0x5b1842=_['map'](db[_0xdbf0('0x2c')][_0xdbf0('0x2d')],function(_0x3b9dbc){return{'name':_0x3b9dbc['fieldName'],'type':_0x3b9dbc[_0xdbf0('0x2e')][_0xdbf0('0x2f')]};});_0x4f9fdd[_0xdbf0('0x30')]=_[_0xdbf0('0x31')](_0x5b1842,_0xdbf0('0x29'));_0x4f9fdd['query']=_[_0xdbf0('0x32')](_0x15ebef[_0xdbf0('0x33')]);_0x4f9fdd[_0xdbf0('0x34')]=_[_0xdbf0('0x35')](_0x4f9fdd[_0xdbf0('0x30')],_0x4f9fdd[_0xdbf0('0x33')]);_0x4fa4d3[_0xdbf0('0x36')]=_[_0xdbf0('0x35')](_0x4f9fdd[_0xdbf0('0x30')],qs['fields'](_0x15ebef[_0xdbf0('0x33')]['fields']));_0x4fa4d3[_0xdbf0('0x36')]=_0x4fa4d3[_0xdbf0('0x36')][_0xdbf0('0x37')]?_0x4fa4d3['attributes']:_0x4f9fdd[_0xdbf0('0x30')];if(!_0x15ebef[_0xdbf0('0x33')]['hasOwnProperty'](_0xdbf0('0x38'))){_0x4fa4d3['limit']=qs[_0xdbf0('0x1d')](_0x15ebef[_0xdbf0('0x33')][_0xdbf0('0x1d')]);_0x4fa4d3[_0xdbf0('0x1b')]=qs[_0xdbf0('0x1b')](_0x15ebef[_0xdbf0('0x33')]['offset']);}_0x4fa4d3[_0xdbf0('0x39')]=qs[_0xdbf0('0x3a')](_0x15ebef[_0xdbf0('0x33')][_0xdbf0('0x3a')]);_0x4fa4d3[_0xdbf0('0x3b')]=qs[_0xdbf0('0x34')](_[_0xdbf0('0x3c')](_0x15ebef[_0xdbf0('0x33')],_0x4f9fdd[_0xdbf0('0x34')]),_0x5b1842);if(_0x15ebef[_0xdbf0('0x33')][_0xdbf0('0x3d')]){_0x4fa4d3[_0xdbf0('0x3b')]=_[_0xdbf0('0x3e')](_0x4fa4d3[_0xdbf0('0x3b')],{'$or':_[_0xdbf0('0x31')](_0x5b1842,function(_0x21d23e){if(_0x21d23e['type']!==_0xdbf0('0x3f')){var _0x5d7ad3={};_0x5d7ad3[_0x21d23e[_0xdbf0('0x29')]]={'$like':'%'+_0x15ebef[_0xdbf0('0x33')]['filter']+'%'};return _0x5d7ad3;}})});}_0x4fa4d3=_['merge']({},_0x4fa4d3,_0x15ebef['options']);var _0x56db82={'where':_0x4fa4d3[_0xdbf0('0x3b')]};return db['Dynamics365Configuration']['count'](_0x56db82)[_0xdbf0('0x25')](function(_0x260533){_0x34be3f['count']=_0x260533;if(_0x15ebef[_0xdbf0('0x33')][_0xdbf0('0x40')]){_0x4fa4d3[_0xdbf0('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xdbf0('0x42')](_0x4fa4d3);})['then'](function(_0x53fc46){_0x34be3f[_0xdbf0('0x43')]=_0x53fc46;return _0x34be3f;})[_0xdbf0('0x25')](respondWithFilteredResult(_0xead7da,_0x4fa4d3))[_0xdbf0('0x44')](handleError(_0xead7da,null));};exports[_0xdbf0('0x45')]=function(_0x37b008,_0x3592e0){var _0x1db4c2={'raw':![],'where':{'id':_0x37b008[_0xdbf0('0x46')]['id']}},_0x2c0166={};_0x2c0166[_0xdbf0('0x30')]=_[_0xdbf0('0x32')](db[_0xdbf0('0x2c')][_0xdbf0('0x2d')]);_0x2c0166[_0xdbf0('0x33')]=_[_0xdbf0('0x32')](_0x37b008['query']);_0x2c0166['filters']=_[_0xdbf0('0x35')](_0x2c0166[_0xdbf0('0x30')],_0x2c0166[_0xdbf0('0x33')]);_0x1db4c2[_0xdbf0('0x36')]=_[_0xdbf0('0x35')](_0x2c0166['model'],qs[_0xdbf0('0x47')](_0x37b008['query']['fields']));_0x1db4c2[_0xdbf0('0x36')]=_0x1db4c2['attributes']['length']?_0x1db4c2[_0xdbf0('0x36')]:_0x2c0166[_0xdbf0('0x30')];if(_0x37b008[_0xdbf0('0x33')][_0xdbf0('0x40')]){_0x1db4c2[_0xdbf0('0x41')]=[{'all':!![]}];}_0x1db4c2=_[_0xdbf0('0x3e')]({},_0x1db4c2,_0x37b008[_0xdbf0('0x48')]);return db[_0xdbf0('0x2c')][_0xdbf0('0x49')](_0x1db4c2)[_0xdbf0('0x25')](handleEntityNotFound(_0x3592e0,null))[_0xdbf0('0x25')](respondWithResult(_0x3592e0,null))['catch'](handleError(_0x3592e0,null));};exports[_0xdbf0('0x4a')]=function(_0x322f08,_0x468826){return db[_0xdbf0('0x2c')][_0xdbf0('0x4a')](_0x322f08[_0xdbf0('0x4b')],{})[_0xdbf0('0x25')](respondWithResult(_0x468826,0xc9))[_0xdbf0('0x44')](handleError(_0x468826,null));};exports[_0xdbf0('0x23')]=function(_0x5bffbb,_0x218191){if(_0x5bffbb[_0xdbf0('0x4b')]['id']){delete _0x5bffbb[_0xdbf0('0x4b')]['id'];}return db[_0xdbf0('0x2c')][_0xdbf0('0x49')]({'where':{'id':_0x5bffbb[_0xdbf0('0x46')]['id']}})['then'](handleEntityNotFound(_0x218191,null))['then'](saveUpdates(_0x5bffbb[_0xdbf0('0x4b')],null))[_0xdbf0('0x25')](respondWithResult(_0x218191,null))[_0xdbf0('0x44')](handleError(_0x218191,null));};exports['destroy']=function(_0x2f7d1f,_0x5910fa){return db['Dynamics365Configuration'][_0xdbf0('0x49')]({'where':{'id':_0x2f7d1f[_0xdbf0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5910fa,null))['then'](removeEntity(_0x5910fa,null))['catch'](handleError(_0x5910fa,null));};exports[_0xdbf0('0x4c')]=function(_0x4d14df,_0x1fe754,_0x12204c){var _0x20434d={};var _0x53cf39={};var _0x44e5a0;var _0x247e96;return db[_0xdbf0('0x2c')]['findOne']({'where':{'id':_0x4d14df[_0xdbf0('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fe754,null))['then'](function(_0x5ab396){if(_0x5ab396){_0x44e5a0=_0x5ab396;_0x53cf39[_0xdbf0('0x30')]=_['keys'](db['Dynamics365Field'][_0xdbf0('0x2d')]);_0x53cf39[_0xdbf0('0x33')]=_[_0xdbf0('0x32')](_0x4d14df[_0xdbf0('0x33')]);_0x53cf39[_0xdbf0('0x34')]=_['intersection'](_0x53cf39[_0xdbf0('0x30')],_0x53cf39[_0xdbf0('0x33')]);_0x20434d[_0xdbf0('0x36')]=_[_0xdbf0('0x35')](_0x53cf39[_0xdbf0('0x30')],qs[_0xdbf0('0x47')](_0x4d14df['query'][_0xdbf0('0x47')]));_0x20434d[_0xdbf0('0x36')]=_0x20434d['attributes'][_0xdbf0('0x37')]?_0x20434d[_0xdbf0('0x36')]:_0x53cf39['model'];_0x20434d[_0xdbf0('0x39')]=qs[_0xdbf0('0x3a')](_0x4d14df[_0xdbf0('0x33')][_0xdbf0('0x3a')]);_0x20434d[_0xdbf0('0x3b')]=qs[_0xdbf0('0x34')](_[_0xdbf0('0x3c')](_0x4d14df[_0xdbf0('0x33')],_0x53cf39['filters']));if(_0x4d14df[_0xdbf0('0x33')][_0xdbf0('0x3d')]){_0x20434d['where']=_[_0xdbf0('0x3e')](_0x20434d[_0xdbf0('0x3b')],{'$or':_[_0xdbf0('0x31')](_0x20434d['attributes'],function(_0x39fa74){var _0x35aa94={};_0x35aa94[_0x39fa74]={'$like':'%'+_0x4d14df[_0xdbf0('0x33')][_0xdbf0('0x3d')]+'%'};return _0x35aa94;})});}_0x20434d=_[_0xdbf0('0x3e')]({},_0x20434d,_0x4d14df['options']);return _0x44e5a0[_0xdbf0('0x4c')](_0x20434d);}})[_0xdbf0('0x25')](function(_0x498cf3){if(_0x498cf3){_0x247e96=_0x498cf3[_0xdbf0('0x37')];if(!_0x4d14df['query'][_0xdbf0('0x4d')]('nolimit')){_0x20434d[_0xdbf0('0x1d')]=qs[_0xdbf0('0x1d')](_0x4d14df['query']['limit']);_0x20434d[_0xdbf0('0x1b')]=qs[_0xdbf0('0x1b')](_0x4d14df[_0xdbf0('0x33')]['offset']);}return _0x44e5a0['getFields'](_0x20434d);}})[_0xdbf0('0x25')](function(_0x42c164){if(_0x42c164){return _0x42c164?{'count':_0x247e96,'rows':_0x42c164}:null;}})[_0xdbf0('0x25')](respondWithResult(_0x1fe754,null))[_0xdbf0('0x44')](handleError(_0x1fe754,null));};exports[_0xdbf0('0x4e')]=function(_0x4410cb,_0x504d08,_0x5e5cb3){var _0x204286={};var _0x1cef43={};var _0x5231ac;var _0x4d992e;return db[_0xdbf0('0x2c')][_0xdbf0('0x4f')]({'where':{'id':_0x4410cb[_0xdbf0('0x46')]['id']}})[_0xdbf0('0x25')](handleEntityNotFound(_0x504d08,null))[_0xdbf0('0x25')](function(_0xa8dd41){if(_0xa8dd41){_0x5231ac=_0xa8dd41;_0x1cef43[_0xdbf0('0x30')]=_['keys'](db[_0xdbf0('0x50')][_0xdbf0('0x2d')]);_0x1cef43['query']=_[_0xdbf0('0x32')](_0x4410cb[_0xdbf0('0x33')]);_0x1cef43[_0xdbf0('0x34')]=_[_0xdbf0('0x35')](_0x1cef43[_0xdbf0('0x30')],_0x1cef43[_0xdbf0('0x33')]);_0x204286[_0xdbf0('0x36')]=_[_0xdbf0('0x35')](_0x1cef43['model'],qs['fields'](_0x4410cb['query']['fields']));_0x204286[_0xdbf0('0x36')]=_0x204286[_0xdbf0('0x36')][_0xdbf0('0x37')]?_0x204286[_0xdbf0('0x36')]:_0x1cef43[_0xdbf0('0x30')];_0x204286[_0xdbf0('0x39')]=qs['sort'](_0x4410cb[_0xdbf0('0x33')][_0xdbf0('0x3a')]);_0x204286[_0xdbf0('0x3b')]=qs[_0xdbf0('0x34')](_['pick'](_0x4410cb[_0xdbf0('0x33')],_0x1cef43[_0xdbf0('0x34')]));if(_0x4410cb['query']['filter']){_0x204286['where']=_['merge'](_0x204286[_0xdbf0('0x3b')],{'$or':_[_0xdbf0('0x31')](_0x204286[_0xdbf0('0x36')],function(_0x5a6ce8){var _0x2482ea={};_0x2482ea[_0x5a6ce8]={'$like':'%'+_0x4410cb[_0xdbf0('0x33')][_0xdbf0('0x3d')]+'%'};return _0x2482ea;})});}_0x204286=_[_0xdbf0('0x3e')]({},_0x204286,_0x4410cb[_0xdbf0('0x48')]);return _0x5231ac['getSubjects'](_0x204286);}})[_0xdbf0('0x25')](function(_0x3bb762){if(_0x3bb762){_0x4d992e=_0x3bb762[_0xdbf0('0x37')];if(!_0x4410cb[_0xdbf0('0x33')][_0xdbf0('0x4d')](_0xdbf0('0x38'))){_0x204286[_0xdbf0('0x1d')]=qs[_0xdbf0('0x1d')](_0x4410cb[_0xdbf0('0x33')][_0xdbf0('0x1d')]);_0x204286[_0xdbf0('0x1b')]=qs[_0xdbf0('0x1b')](_0x4410cb[_0xdbf0('0x33')][_0xdbf0('0x1b')]);}return _0x5231ac['getSubjects'](_0x204286);}})[_0xdbf0('0x25')](function(_0x8ec086){if(_0x8ec086){return _0x8ec086?{'count':_0x4d992e,'rows':_0x8ec086}:null;}})[_0xdbf0('0x25')](respondWithResult(_0x504d08,null))[_0xdbf0('0x44')](handleError(_0x504d08,null));};exports['getDescriptions']=function(_0x1a9015,_0x1688d7,_0x53625e){var _0x40ed6c={};var _0x21bc38={};var _0x20f40d;var _0x5367c7;return db[_0xdbf0('0x2c')][_0xdbf0('0x4f')]({'where':{'id':_0x1a9015[_0xdbf0('0x46')]['id']}})['then'](handleEntityNotFound(_0x1688d7,null))[_0xdbf0('0x25')](function(_0xed65ca){if(_0xed65ca){_0x20f40d=_0xed65ca;_0x21bc38[_0xdbf0('0x30')]=_['keys'](db['Dynamics365Field'][_0xdbf0('0x2d')]);_0x21bc38[_0xdbf0('0x33')]=_['keys'](_0x1a9015[_0xdbf0('0x33')]);_0x21bc38[_0xdbf0('0x34')]=_['intersection'](_0x21bc38[_0xdbf0('0x30')],_0x21bc38['query']);_0x40ed6c[_0xdbf0('0x36')]=_[_0xdbf0('0x35')](_0x21bc38[_0xdbf0('0x30')],qs[_0xdbf0('0x47')](_0x1a9015['query'][_0xdbf0('0x47')]));_0x40ed6c[_0xdbf0('0x36')]=_0x40ed6c[_0xdbf0('0x36')][_0xdbf0('0x37')]?_0x40ed6c['attributes']:_0x21bc38['model'];_0x40ed6c[_0xdbf0('0x39')]=qs['sort'](_0x1a9015[_0xdbf0('0x33')]['sort']);_0x40ed6c[_0xdbf0('0x3b')]=qs[_0xdbf0('0x34')](_['pick'](_0x1a9015[_0xdbf0('0x33')],_0x21bc38[_0xdbf0('0x34')]));if(_0x1a9015[_0xdbf0('0x33')][_0xdbf0('0x3d')]){_0x40ed6c['where']=_[_0xdbf0('0x3e')](_0x40ed6c['where'],{'$or':_[_0xdbf0('0x31')](_0x40ed6c[_0xdbf0('0x36')],function(_0x4b2af0){var _0x36a4e7={};_0x36a4e7[_0x4b2af0]={'$like':'%'+_0x1a9015[_0xdbf0('0x33')][_0xdbf0('0x3d')]+'%'};return _0x36a4e7;})});}_0x40ed6c=_['merge']({},_0x40ed6c,_0x1a9015[_0xdbf0('0x48')]);return _0x20f40d[_0xdbf0('0x51')](_0x40ed6c);}})[_0xdbf0('0x25')](function(_0x1a4d78){if(_0x1a4d78){_0x5367c7=_0x1a4d78[_0xdbf0('0x37')];if(!_0x1a9015[_0xdbf0('0x33')][_0xdbf0('0x4d')]('nolimit')){_0x40ed6c[_0xdbf0('0x1d')]=qs[_0xdbf0('0x1d')](_0x1a9015['query'][_0xdbf0('0x1d')]);_0x40ed6c[_0xdbf0('0x1b')]=qs['offset'](_0x1a9015['query'][_0xdbf0('0x1b')]);}return _0x20f40d['getDescriptions'](_0x40ed6c);}})[_0xdbf0('0x25')](function(_0x2a732d){if(_0x2a732d){return _0x2a732d?{'count':_0x5367c7,'rows':_0x2a732d}:null;}})[_0xdbf0('0x25')](respondWithResult(_0x1688d7,null))['catch'](handleError(_0x1688d7,null));}; \ No newline at end of file +var _0xe166=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','getFields','findOne','Dynamics365Field','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x18cb5c,_0x58e8ca){var _0x2f9171=function(_0x14f52e){while(--_0x14f52e){_0x18cb5c['push'](_0x18cb5c['shift']());}};_0x2f9171(++_0x58e8ca);}(_0xe166,0x9e));var _0x6e16=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe166[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x6e16('0x0'));var rimraf=require(_0x6e16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e16('0x2'));var rp=require('request-promise');var moment=require(_0x6e16('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6e16('0x4'));var util=require(_0x6e16('0x5'));var path=require(_0x6e16('0x6'));var sox=require(_0x6e16('0x7'));var csv=require(_0x6e16('0x8'));var ejs=require(_0x6e16('0x9'));var fs=require('fs');var fs_extra=require(_0x6e16('0xa'));var _=require(_0x6e16('0xb'));var squel=require(_0x6e16('0xc'));var crypto=require(_0x6e16('0xd'));var jsforce=require(_0x6e16('0xe'));var deskjs=require(_0x6e16('0xf'));var toCsv=require(_0x6e16('0x8'));var querystring=require(_0x6e16('0x10'));var Papa=require(_0x6e16('0x11'));var Redis=require(_0x6e16('0x12'));var authService=require(_0x6e16('0x13'));var qs=require(_0x6e16('0x14'));var as=require(_0x6e16('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e16('0x16'))(_0x6e16('0x17'));var utils=require(_0x6e16('0x18'));var config=require(_0x6e16('0x19'));var licenseUtil=require(_0x6e16('0x1a'));var db=require(_0x6e16('0x1b'))['db'];function respondWithStatusCode(_0x1aa397,_0x1ff23a){_0x1ff23a=_0x1ff23a||0xcc;return function(_0x56385a){if(_0x56385a){return _0x1aa397[_0x6e16('0x1c')](_0x1ff23a);}return _0x1aa397[_0x6e16('0x1d')](_0x1ff23a)['end']();};}function respondWithResult(_0x4585a9,_0x2dd524){_0x2dd524=_0x2dd524||0xc8;return function(_0x5cece8){if(_0x5cece8){return _0x4585a9[_0x6e16('0x1d')](_0x2dd524)[_0x6e16('0x1e')](_0x5cece8);}};}function respondWithFilteredResult(_0x44530b,_0x23699b){return function(_0x28fc6f){if(_0x28fc6f){var _0x213657=typeof _0x23699b['offset']==='undefined'&&typeof _0x23699b['limit']===_0x6e16('0x1f');var _0x639d3e=_0x28fc6f[_0x6e16('0x20')];var _0x2d192d=_0x213657?0x0:_0x23699b[_0x6e16('0x21')];var _0x37d8ac=_0x213657?_0x28fc6f[_0x6e16('0x20')]:_0x23699b[_0x6e16('0x21')]+_0x23699b['limit'];var _0x3b9c7c;if(_0x37d8ac>=_0x639d3e){_0x37d8ac=_0x639d3e;_0x3b9c7c=0xc8;}else{_0x3b9c7c=0xce;}_0x44530b[_0x6e16('0x1d')](_0x3b9c7c);return _0x44530b[_0x6e16('0x22')]('Content-Range',_0x2d192d+'-'+_0x37d8ac+'/'+_0x639d3e)['json'](_0x28fc6f);}return null;};}function patchUpdates(_0x5eb001){return function(_0x1cba3b){try{jsonpatch[_0x6e16('0x23')](_0x1cba3b,_0x5eb001,!![]);}catch(_0x3dd595){return BPromise[_0x6e16('0x24')](_0x3dd595);}return _0x1cba3b[_0x6e16('0x25')]();};}function saveUpdates(_0x54c558,_0x20050d){return function(_0x14abd3){if(_0x14abd3){return _0x14abd3[_0x6e16('0x26')](_0x54c558)[_0x6e16('0x27')](function(_0x10e6c3){return _0x10e6c3;});}return null;};}function removeEntity(_0xae4f20,_0x57a6c3){return function(_0x5d894e){if(_0x5d894e){return _0x5d894e[_0x6e16('0x28')]()[_0x6e16('0x27')](function(){_0xae4f20[_0x6e16('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4abc3f,_0x4921e9){return function(_0x58686e){if(!_0x58686e){_0x4abc3f[_0x6e16('0x1c')](0x194);}return _0x58686e;};}function handleError(_0x170e5a,_0x568283){_0x568283=_0x568283||0x1f4;return function(_0x11644f){logger[_0x6e16('0x29')](_0x11644f[_0x6e16('0x2a')]);if(_0x11644f[_0x6e16('0x2b')]){delete _0x11644f[_0x6e16('0x2b')];}_0x170e5a[_0x6e16('0x1d')](_0x568283)[_0x6e16('0x2c')](_0x11644f);};}exports[_0x6e16('0x2d')]=function(_0x227e8b,_0x3102f8){var _0x2d5aaa={},_0x17b6c5={},_0x5bb27b={'count':0x0,'rows':[]};var _0x13344e=_[_0x6e16('0x2e')](db[_0x6e16('0x2f')]['rawAttributes'],function(_0xb3379f){return{'name':_0xb3379f['fieldName'],'type':_0xb3379f[_0x6e16('0x30')][_0x6e16('0x31')]};});_0x17b6c5[_0x6e16('0x32')]=_['map'](_0x13344e,'name');_0x17b6c5[_0x6e16('0x33')]=_[_0x6e16('0x34')](_0x227e8b[_0x6e16('0x33')]);_0x17b6c5['filters']=_[_0x6e16('0x35')](_0x17b6c5['model'],_0x17b6c5[_0x6e16('0x33')]);_0x2d5aaa[_0x6e16('0x36')]=_[_0x6e16('0x35')](_0x17b6c5['model'],qs[_0x6e16('0x37')](_0x227e8b[_0x6e16('0x33')][_0x6e16('0x37')]));_0x2d5aaa[_0x6e16('0x36')]=_0x2d5aaa[_0x6e16('0x36')][_0x6e16('0x38')]?_0x2d5aaa['attributes']:_0x17b6c5['model'];if(!_0x227e8b[_0x6e16('0x33')]['hasOwnProperty'](_0x6e16('0x39'))){_0x2d5aaa[_0x6e16('0x3a')]=qs[_0x6e16('0x3a')](_0x227e8b[_0x6e16('0x33')][_0x6e16('0x3a')]);_0x2d5aaa[_0x6e16('0x21')]=qs[_0x6e16('0x21')](_0x227e8b[_0x6e16('0x33')][_0x6e16('0x21')]);}_0x2d5aaa[_0x6e16('0x3b')]=qs['sort'](_0x227e8b[_0x6e16('0x33')]['sort']);_0x2d5aaa[_0x6e16('0x3c')]=qs['filters'](_[_0x6e16('0x3d')](_0x227e8b['query'],_0x17b6c5[_0x6e16('0x3e')]),_0x13344e);if(_0x227e8b['query'][_0x6e16('0x3f')]){_0x2d5aaa[_0x6e16('0x3c')]=_[_0x6e16('0x40')](_0x2d5aaa[_0x6e16('0x3c')],{'$or':_[_0x6e16('0x2e')](_0x13344e,function(_0x27da70){if(_0x27da70['type']!==_0x6e16('0x41')){var _0x8e13b1={};_0x8e13b1[_0x27da70[_0x6e16('0x2b')]]={'$like':'%'+_0x227e8b[_0x6e16('0x33')][_0x6e16('0x3f')]+'%'};return _0x8e13b1;}})});}_0x2d5aaa=_['merge']({},_0x2d5aaa,_0x227e8b[_0x6e16('0x42')]);var _0x512ff={'where':_0x2d5aaa[_0x6e16('0x3c')]};return db['Dynamics365Configuration'][_0x6e16('0x20')](_0x512ff)[_0x6e16('0x27')](function(_0x1f91ec){_0x5bb27b[_0x6e16('0x20')]=_0x1f91ec;if(_0x227e8b[_0x6e16('0x33')]['includeAll']){_0x2d5aaa['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x6e16('0x43')](_0x2d5aaa);})['then'](function(_0x3ce726){_0x5bb27b[_0x6e16('0x44')]=_0x3ce726;return _0x5bb27b;})[_0x6e16('0x27')](respondWithFilteredResult(_0x3102f8,_0x2d5aaa))['catch'](handleError(_0x3102f8,null));};exports[_0x6e16('0x45')]=function(_0x30cdd6,_0x41f441){var _0x965d6={'raw':![],'where':{'id':_0x30cdd6[_0x6e16('0x46')]['id']}},_0x13b07b={};_0x13b07b[_0x6e16('0x32')]=_[_0x6e16('0x34')](db[_0x6e16('0x2f')][_0x6e16('0x47')]);_0x13b07b[_0x6e16('0x33')]=_[_0x6e16('0x34')](_0x30cdd6['query']);_0x13b07b[_0x6e16('0x3e')]=_[_0x6e16('0x35')](_0x13b07b[_0x6e16('0x32')],_0x13b07b[_0x6e16('0x33')]);_0x965d6[_0x6e16('0x36')]=_[_0x6e16('0x35')](_0x13b07b[_0x6e16('0x32')],qs[_0x6e16('0x37')](_0x30cdd6['query'][_0x6e16('0x37')]));_0x965d6[_0x6e16('0x36')]=_0x965d6[_0x6e16('0x36')][_0x6e16('0x38')]?_0x965d6[_0x6e16('0x36')]:_0x13b07b[_0x6e16('0x32')];if(_0x30cdd6[_0x6e16('0x33')][_0x6e16('0x48')]){_0x965d6['include']=[{'all':!![]}];}_0x965d6=_[_0x6e16('0x40')]({},_0x965d6,_0x30cdd6[_0x6e16('0x42')]);return db[_0x6e16('0x2f')][_0x6e16('0x49')](_0x965d6)['then'](handleEntityNotFound(_0x41f441,null))['then'](respondWithResult(_0x41f441,null))[_0x6e16('0x4a')](handleError(_0x41f441,null));};exports['create']=function(_0x556fbf,_0x401b73){return db[_0x6e16('0x2f')][_0x6e16('0x4b')](_0x556fbf[_0x6e16('0x4c')],{})[_0x6e16('0x27')](respondWithResult(_0x401b73,0xc9))[_0x6e16('0x4a')](handleError(_0x401b73,null));};exports[_0x6e16('0x26')]=function(_0xf95a0f,_0x30381a){if(_0xf95a0f[_0x6e16('0x4c')]['id']){delete _0xf95a0f['body']['id'];}return db[_0x6e16('0x2f')][_0x6e16('0x49')]({'where':{'id':_0xf95a0f[_0x6e16('0x46')]['id']}})[_0x6e16('0x27')](handleEntityNotFound(_0x30381a,null))[_0x6e16('0x27')](saveUpdates(_0xf95a0f['body'],null))[_0x6e16('0x27')](respondWithResult(_0x30381a,null))[_0x6e16('0x4a')](handleError(_0x30381a,null));};exports[_0x6e16('0x28')]=function(_0x326c4a,_0x41bdfe){return db[_0x6e16('0x2f')]['find']({'where':{'id':_0x326c4a[_0x6e16('0x46')]['id']}})[_0x6e16('0x27')](handleEntityNotFound(_0x41bdfe,null))[_0x6e16('0x27')](removeEntity(_0x41bdfe,null))['catch'](handleError(_0x41bdfe,null));};exports[_0x6e16('0x4d')]=function(_0x24c981,_0x43d2ef,_0x20de9c){var _0x1c530b={};var _0x384d66={};var _0xc114d7;var _0x3d270a;return db['Dynamics365Configuration'][_0x6e16('0x4e')]({'where':{'id':_0x24c981[_0x6e16('0x46')]['id']}})['then'](handleEntityNotFound(_0x43d2ef,null))[_0x6e16('0x27')](function(_0x3cf175){if(_0x3cf175){_0xc114d7=_0x3cf175;_0x384d66['model']=_[_0x6e16('0x34')](db[_0x6e16('0x4f')][_0x6e16('0x47')]);_0x384d66['query']=_[_0x6e16('0x34')](_0x24c981[_0x6e16('0x33')]);_0x384d66[_0x6e16('0x3e')]=_[_0x6e16('0x35')](_0x384d66['model'],_0x384d66[_0x6e16('0x33')]);_0x1c530b[_0x6e16('0x36')]=_[_0x6e16('0x35')](_0x384d66[_0x6e16('0x32')],qs[_0x6e16('0x37')](_0x24c981['query'][_0x6e16('0x37')]));_0x1c530b[_0x6e16('0x36')]=_0x1c530b[_0x6e16('0x36')][_0x6e16('0x38')]?_0x1c530b['attributes']:_0x384d66[_0x6e16('0x32')];_0x1c530b['order']=qs[_0x6e16('0x50')](_0x24c981[_0x6e16('0x33')][_0x6e16('0x50')]);_0x1c530b['where']=qs[_0x6e16('0x3e')](_['pick'](_0x24c981[_0x6e16('0x33')],_0x384d66[_0x6e16('0x3e')]));if(_0x24c981['query'][_0x6e16('0x3f')]){_0x1c530b['where']=_[_0x6e16('0x40')](_0x1c530b[_0x6e16('0x3c')],{'$or':_[_0x6e16('0x2e')](_0x1c530b[_0x6e16('0x36')],function(_0x2d7abb){var _0x55f52c={};_0x55f52c[_0x2d7abb]={'$like':'%'+_0x24c981[_0x6e16('0x33')][_0x6e16('0x3f')]+'%'};return _0x55f52c;})});}_0x1c530b=_['merge']({},_0x1c530b,_0x24c981['options']);return _0xc114d7[_0x6e16('0x4d')](_0x1c530b);}})[_0x6e16('0x27')](function(_0x5e876c){if(_0x5e876c){_0x3d270a=_0x5e876c[_0x6e16('0x38')];if(!_0x24c981['query'][_0x6e16('0x51')](_0x6e16('0x39'))){_0x1c530b[_0x6e16('0x3a')]=qs[_0x6e16('0x3a')](_0x24c981[_0x6e16('0x33')]['limit']);_0x1c530b[_0x6e16('0x21')]=qs[_0x6e16('0x21')](_0x24c981['query'][_0x6e16('0x21')]);}return _0xc114d7[_0x6e16('0x4d')](_0x1c530b);}})[_0x6e16('0x27')](function(_0x244073){if(_0x244073){return _0x244073?{'count':_0x3d270a,'rows':_0x244073}:null;}})[_0x6e16('0x27')](respondWithResult(_0x43d2ef,null))[_0x6e16('0x4a')](handleError(_0x43d2ef,null));};exports[_0x6e16('0x52')]=function(_0x475faa,_0x37cc83,_0x2d2694){var _0x595c11={};var _0x120b90={};var _0x382892;var _0xf091c1;return db[_0x6e16('0x2f')][_0x6e16('0x4e')]({'where':{'id':_0x475faa['params']['id']}})[_0x6e16('0x27')](handleEntityNotFound(_0x37cc83,null))['then'](function(_0x4fab83){if(_0x4fab83){_0x382892=_0x4fab83;_0x120b90[_0x6e16('0x32')]=_[_0x6e16('0x34')](db[_0x6e16('0x4f')]['rawAttributes']);_0x120b90[_0x6e16('0x33')]=_[_0x6e16('0x34')](_0x475faa[_0x6e16('0x33')]);_0x120b90[_0x6e16('0x3e')]=_[_0x6e16('0x35')](_0x120b90[_0x6e16('0x32')],_0x120b90[_0x6e16('0x33')]);_0x595c11[_0x6e16('0x36')]=_[_0x6e16('0x35')](_0x120b90[_0x6e16('0x32')],qs[_0x6e16('0x37')](_0x475faa[_0x6e16('0x33')][_0x6e16('0x37')]));_0x595c11[_0x6e16('0x36')]=_0x595c11[_0x6e16('0x36')][_0x6e16('0x38')]?_0x595c11['attributes']:_0x120b90[_0x6e16('0x32')];_0x595c11['order']=qs[_0x6e16('0x50')](_0x475faa[_0x6e16('0x33')][_0x6e16('0x50')]);_0x595c11['where']=qs[_0x6e16('0x3e')](_[_0x6e16('0x3d')](_0x475faa[_0x6e16('0x33')],_0x120b90['filters']));if(_0x475faa[_0x6e16('0x33')][_0x6e16('0x3f')]){_0x595c11[_0x6e16('0x3c')]=_[_0x6e16('0x40')](_0x595c11[_0x6e16('0x3c')],{'$or':_[_0x6e16('0x2e')](_0x595c11[_0x6e16('0x36')],function(_0x20abd6){var _0x1ff2c5={};_0x1ff2c5[_0x20abd6]={'$like':'%'+_0x475faa[_0x6e16('0x33')][_0x6e16('0x3f')]+'%'};return _0x1ff2c5;})});}_0x595c11=_[_0x6e16('0x40')]({},_0x595c11,_0x475faa[_0x6e16('0x42')]);return _0x382892[_0x6e16('0x52')](_0x595c11);}})[_0x6e16('0x27')](function(_0x53992e){if(_0x53992e){_0xf091c1=_0x53992e[_0x6e16('0x38')];if(!_0x475faa['query']['hasOwnProperty'](_0x6e16('0x39'))){_0x595c11[_0x6e16('0x3a')]=qs[_0x6e16('0x3a')](_0x475faa[_0x6e16('0x33')]['limit']);_0x595c11['offset']=qs[_0x6e16('0x21')](_0x475faa['query'][_0x6e16('0x21')]);}return _0x382892[_0x6e16('0x52')](_0x595c11);}})[_0x6e16('0x27')](function(_0x52c83d){if(_0x52c83d){return _0x52c83d?{'count':_0xf091c1,'rows':_0x52c83d}:null;}})[_0x6e16('0x27')](respondWithResult(_0x37cc83,null))[_0x6e16('0x4a')](handleError(_0x37cc83,null));};exports[_0x6e16('0x53')]=function(_0x3c2ec5,_0xd70cd5,_0x3202d7){var _0x5e43bc={};var _0x2e8ac1={};var _0x47dabc;var _0xbc1702;return db[_0x6e16('0x2f')]['findOne']({'where':{'id':_0x3c2ec5[_0x6e16('0x46')]['id']}})[_0x6e16('0x27')](handleEntityNotFound(_0xd70cd5,null))[_0x6e16('0x27')](function(_0x323c64){if(_0x323c64){_0x47dabc=_0x323c64;_0x2e8ac1['model']=_['keys'](db[_0x6e16('0x4f')]['rawAttributes']);_0x2e8ac1[_0x6e16('0x33')]=_[_0x6e16('0x34')](_0x3c2ec5[_0x6e16('0x33')]);_0x2e8ac1[_0x6e16('0x3e')]=_[_0x6e16('0x35')](_0x2e8ac1[_0x6e16('0x32')],_0x2e8ac1[_0x6e16('0x33')]);_0x5e43bc[_0x6e16('0x36')]=_['intersection'](_0x2e8ac1[_0x6e16('0x32')],qs[_0x6e16('0x37')](_0x3c2ec5[_0x6e16('0x33')]['fields']));_0x5e43bc[_0x6e16('0x36')]=_0x5e43bc[_0x6e16('0x36')][_0x6e16('0x38')]?_0x5e43bc[_0x6e16('0x36')]:_0x2e8ac1[_0x6e16('0x32')];_0x5e43bc[_0x6e16('0x3b')]=qs['sort'](_0x3c2ec5[_0x6e16('0x33')]['sort']);_0x5e43bc[_0x6e16('0x3c')]=qs[_0x6e16('0x3e')](_[_0x6e16('0x3d')](_0x3c2ec5[_0x6e16('0x33')],_0x2e8ac1[_0x6e16('0x3e')]));if(_0x3c2ec5[_0x6e16('0x33')][_0x6e16('0x3f')]){_0x5e43bc['where']=_[_0x6e16('0x40')](_0x5e43bc[_0x6e16('0x3c')],{'$or':_[_0x6e16('0x2e')](_0x5e43bc['attributes'],function(_0x5883a3){var _0x1c2ed4={};_0x1c2ed4[_0x5883a3]={'$like':'%'+_0x3c2ec5[_0x6e16('0x33')][_0x6e16('0x3f')]+'%'};return _0x1c2ed4;})});}_0x5e43bc=_[_0x6e16('0x40')]({},_0x5e43bc,_0x3c2ec5[_0x6e16('0x42')]);return _0x47dabc['getDescriptions'](_0x5e43bc);}})[_0x6e16('0x27')](function(_0x46b70c){if(_0x46b70c){_0xbc1702=_0x46b70c['length'];if(!_0x3c2ec5[_0x6e16('0x33')][_0x6e16('0x51')](_0x6e16('0x39'))){_0x5e43bc[_0x6e16('0x3a')]=qs[_0x6e16('0x3a')](_0x3c2ec5[_0x6e16('0x33')][_0x6e16('0x3a')]);_0x5e43bc[_0x6e16('0x21')]=qs['offset'](_0x3c2ec5[_0x6e16('0x33')]['offset']);}return _0x47dabc['getDescriptions'](_0x5e43bc);}})[_0x6e16('0x27')](function(_0x255403){if(_0x255403){return _0x255403?{'count':_0xbc1702,'rows':_0x255403}:null;}})[_0x6e16('0x27')](respondWithResult(_0xd70cd5,null))[_0x6e16('0x4a')](handleError(_0xd70cd5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0606334..5175b2a 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0xfadce2,_0x4c8951){var _0x4642d0=function(_0x130799){while(--_0x130799){_0xfadce2['push'](_0xfadce2['shift']());}};_0x4642d0(++_0x4c8951);}(_0x9f62,0x154));var _0x29f6=function(_0x4c8733,_0x485e84){_0x4c8733=_0x4c8733-0x0;var _0xb71c7d=_0x9f62[_0x4c8733];return _0xb71c7d;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b02=['define','Dynamics365Configuration','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x353625,_0x40b6de){var _0x584726=function(_0x316058){while(--_0x316058){_0x353625['push'](_0x353625['shift']());}};_0x584726(++_0x40b6de);}(_0x5b02,0xe9));var _0x25b0=function(_0x531964,_0x227d06){_0x531964=_0x531964-0x0;var _0x142c5d=_0x5b02[_0x531964];return _0x142c5d;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),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 81e19fe..ade97c6 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 _0x1dfa=['code','message','Dynamics365Configuration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x1c862e,_0x2e378a){var _0x5a4b11=function(_0x3c95a9){while(--_0x3c95a9){_0x1c862e['push'](_0x1c862e['shift']());}};_0x5a4b11(++_0x2e378a);}(_0x1dfa,0xea));var _0xa1df=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x1dfa[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xa1df('0x0'));var util=require(_0xa1df('0x1'));var moment=require('moment');var BPromise=require(_0xa1df('0x2'));var rs=require(_0xa1df('0x3'));var fs=require('fs');var Redis=require(_0xa1df('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa1df('0x5'))(_0xa1df('0x6'));var config=require(_0xa1df('0x7'));var jayson=require(_0xa1df('0x8'));var client=jayson[_0xa1df('0x9')][_0xa1df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca2c9,_0x4e551d,_0x5c80f5){return new BPromise(function(_0x32adb1,_0x2f4633){return client[_0xa1df('0xb')](_0x5ca2c9,_0x5c80f5)[_0xa1df('0xc')](function(_0x16a301){logger[_0xa1df('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4e551d,_0xa1df('0xe'));logger[_0xa1df('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4e551d,_0xa1df('0xe'),JSON[_0xa1df('0x10')](_0x16a301));if(_0x16a301['error']){if(_0x16a301[_0xa1df('0x11')][_0xa1df('0x12')]===0x1f4){logger[_0xa1df('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4e551d,_0x16a301[_0xa1df('0x11')][_0xa1df('0x13')]);return _0x2f4633(_0x16a301[_0xa1df('0x11')]['message']);}logger[_0xa1df('0x11')](_0xa1df('0x14'),_0x4e551d,_0x16a301[_0xa1df('0x11')][_0xa1df('0x13')]);return _0x32adb1(_0x16a301[_0xa1df('0x11')]['message']);}else{logger[_0xa1df('0xd')](_0xa1df('0x14'),_0x4e551d,_0xa1df('0xe'));_0x32adb1(_0x16a301['result'][_0xa1df('0x13')]);}})['catch'](function(_0x431bb1){logger[_0xa1df('0x11')](_0xa1df('0x14'),_0x4e551d,_0x431bb1);_0x2f4633(_0x431bb1);});});} \ No newline at end of file +var _0x4800=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x3138a7,_0x4276d8){var _0x3df3d1=function(_0x868b7c){while(--_0x868b7c){_0x3138a7['push'](_0x3138a7['shift']());}};_0x3df3d1(++_0x4276d8);}(_0x4800,0x14c));var _0x0480=function(_0x1eac9b,_0x24bf2f){_0x1eac9b=_0x1eac9b-0x0;var _0x33dfd6=_0x4800[_0x1eac9b];return _0x33dfd6;};'use strict';var _=require(_0x0480('0x0'));var util=require(_0x0480('0x1'));var moment=require(_0x0480('0x2'));var BPromise=require(_0x0480('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0480('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0480('0x5'))(_0x0480('0x6'));var config=require(_0x0480('0x7'));var jayson=require(_0x0480('0x8'));var client=jayson['client'][_0x0480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x156d55,_0x4b9c72,_0x32a276){return new BPromise(function(_0x1e2c25,_0xe10390){return client[_0x0480('0xa')](_0x156d55,_0x32a276)[_0x0480('0xb')](function(_0x572494){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4b9c72,_0x0480('0xc'));logger[_0x0480('0xd')](_0x0480('0xe'),_0x4b9c72,_0x0480('0xc'),JSON[_0x0480('0xf')](_0x572494));if(_0x572494[_0x0480('0x10')]){if(_0x572494[_0x0480('0x10')][_0x0480('0x11')]===0x1f4){logger[_0x0480('0x10')](_0x0480('0x12'),_0x4b9c72,_0x572494[_0x0480('0x10')][_0x0480('0x13')]);return _0xe10390(_0x572494[_0x0480('0x10')][_0x0480('0x13')]);}logger[_0x0480('0x10')](_0x0480('0x12'),_0x4b9c72,_0x572494[_0x0480('0x10')][_0x0480('0x13')]);return _0x1e2c25(_0x572494[_0x0480('0x10')][_0x0480('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4b9c72,_0x0480('0xc'));_0x1e2c25(_0x572494['result'][_0x0480('0x13')]);}})[_0x0480('0x14')](function(_0x1d0ad2){logger[_0x0480('0x10')](_0x0480('0x12'),_0x4b9c72,_0x1d0ad2);_0xe10390(_0x1d0ad2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0fc600b..ed8dded 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 _0x1b90=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','isAuthenticated','index','get','/:id'];(function(_0x166cf1,_0x565c65){var _0x538ba7=function(_0x383eef){while(--_0x383eef){_0x166cf1['push'](_0x166cf1['shift']());}};_0x538ba7(++_0x565c65);}(_0x1b90,0xb2));var _0x01b9=function(_0x3a2cd9,_0x56d294){_0x3a2cd9=_0x3a2cd9-0x0;var _0x44845a=_0x1b90[_0x3a2cd9];return _0x44845a;};'use strict';var multer=require(_0x01b9('0x0'));var util=require(_0x01b9('0x1'));var path=require(_0x01b9('0x2'));var timeout=require(_0x01b9('0x3'));var express=require(_0x01b9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x01b9('0x5'));var interaction=require(_0x01b9('0x6'));var config=require('../../config/environment');var controller=require(_0x01b9('0x7'));router['get']('/',auth[_0x01b9('0x8')](),controller[_0x01b9('0x9')]);router[_0x01b9('0xa')](_0x01b9('0xb'),auth['isAuthenticated'](),controller[_0x01b9('0xc')]);router[_0x01b9('0xd')]('/',auth[_0x01b9('0x8')](),controller[_0x01b9('0xe')]);router['put']('/:id',auth[_0x01b9('0x8')](),controller[_0x01b9('0xf')]);router[_0x01b9('0x10')](_0x01b9('0xb'),auth[_0x01b9('0x8')](),controller[_0x01b9('0x11')]);module[_0x01b9('0x12')]=router; \ No newline at end of file +var _0xeba6=['/:id','destroy','exports','util','path','express','Router','fs-extra','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','delete'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xeba6,0x157));var _0x6eba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeba6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6eba('0x0'));var path=require(_0x6eba('0x1'));var timeout=require('connect-timeout');var express=require(_0x6eba('0x2'));var router=express[_0x6eba('0x3')]();var fs_extra=require(_0x6eba('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6eba('0x5'));router[_0x6eba('0x6')]('/',auth[_0x6eba('0x7')](),controller[_0x6eba('0x8')]);router[_0x6eba('0x6')]('/:id',auth[_0x6eba('0x7')](),controller[_0x6eba('0x9')]);router[_0x6eba('0xa')]('/',auth[_0x6eba('0x7')](),controller[_0x6eba('0xb')]);router[_0x6eba('0xc')]('/:id',auth[_0x6eba('0x7')](),controller['update']);router[_0x6eba('0xd')](_0x6eba('0xe'),auth[_0x6eba('0x7')](),controller[_0x6eba('0xf')]);module[_0x6eba('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 38413ee..9354580 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 _0x7aa4=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x5a99f7,_0x143d95){var _0x3d1c7a=function(_0x2ea915){while(--_0x2ea915){_0x5a99f7['push'](_0x5a99f7['shift']());}};_0x3d1c7a(++_0x143d95);}(_0x7aa4,0x134));var _0x47aa=function(_0x5c40d1,_0x5aeb8d){_0x5c40d1=_0x5c40d1-0x0;var _0x4ead16=_0x7aa4[_0x5c40d1];return _0x4ead16;};'use strict';var Sequelize=require(_0x47aa('0x0'));module[_0x47aa('0x1')]={'type':{'type':Sequelize[_0x47aa('0x2')](_0x47aa('0x3'),_0x47aa('0x4'),_0x47aa('0x5'),_0x47aa('0x6'),'picklist'),'defaultValue':_0x47aa('0x3')},'content':{'type':Sequelize[_0x47aa('0x7')]},'key':{'type':Sequelize[_0x47aa('0x7')]},'keyType':{'type':Sequelize[_0x47aa('0x2')](_0x47aa('0x3'),_0x47aa('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x47aa('0x7')]},'idField':{'type':Sequelize[_0x47aa('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfce4=['BOOLEAN','exports','ENUM','string','keyValue','picklist','STRING','variable'];(function(_0x3c5249,_0x589225){var _0x5ea071=function(_0x109d4e){while(--_0x109d4e){_0x3c5249['push'](_0x3c5249['shift']());}};_0x5ea071(++_0x589225);}(_0xfce4,0x1e1));var _0x4fce=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xfce4[_0x2e58c7];return _0x26eb00;};'use strict';var Sequelize=require('sequelize');module[_0x4fce('0x0')]={'type':{'type':Sequelize[_0x4fce('0x1')](_0x4fce('0x2'),'variable','customVariable',_0x4fce('0x3'),_0x4fce('0x4')),'defaultValue':_0x4fce('0x2')},'content':{'type':Sequelize[_0x4fce('0x5')]},'key':{'type':Sequelize[_0x4fce('0x5')]},'keyType':{'type':Sequelize[_0x4fce('0x1')](_0x4fce('0x2'),_0x4fce('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x4fce('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4fce('0x5')]},'customField':{'type':Sequelize[_0x4fce('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4fce('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0faeac8..1e0dbf8 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 _0x4d91=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','Dynamics365Field','findAll','rows','show','params','keys','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x4d91,0x1d6));var _0x14d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d91[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x14d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x14d9('0x1'));var rp=require(_0x14d9('0x2'));var moment=require(_0x14d9('0x3'));var BPromise=require(_0x14d9('0x4'));var Mustache=require('mustache');var util=require(_0x14d9('0x5'));var path=require(_0x14d9('0x6'));var sox=require(_0x14d9('0x7'));var csv=require(_0x14d9('0x8'));var ejs=require(_0x14d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14d9('0xa'));var squel=require(_0x14d9('0xb'));var crypto=require(_0x14d9('0xc'));var jsforce=require(_0x14d9('0xd'));var deskjs=require(_0x14d9('0xe'));var toCsv=require(_0x14d9('0x8'));var querystring=require(_0x14d9('0xf'));var Papa=require(_0x14d9('0x10'));var Redis=require(_0x14d9('0x11'));var authService=require(_0x14d9('0x12'));var qs=require(_0x14d9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14d9('0x14'));var logger=require(_0x14d9('0x15'))(_0x14d9('0x16'));var utils=require(_0x14d9('0x17'));var config=require(_0x14d9('0x18'));var licenseUtil=require(_0x14d9('0x19'));var db=require(_0x14d9('0x1a'))['db'];function respondWithStatusCode(_0x293a77,_0x59ed48){_0x59ed48=_0x59ed48||0xcc;return function(_0xddf41f){if(_0xddf41f){return _0x293a77['sendStatus'](_0x59ed48);}return _0x293a77['status'](_0x59ed48)[_0x14d9('0x1b')]();};}function respondWithResult(_0x516ae0,_0x5d2951){_0x5d2951=_0x5d2951||0xc8;return function(_0x20fb5d){if(_0x20fb5d){return _0x516ae0[_0x14d9('0x1c')](_0x5d2951)['json'](_0x20fb5d);}};}function respondWithFilteredResult(_0x11fd31,_0xa6f31e){return function(_0x42819c){if(_0x42819c){var _0x2640e2=typeof _0xa6f31e['offset']==='undefined'&&typeof _0xa6f31e[_0x14d9('0x1d')]==='undefined';var _0x20da00=_0x42819c[_0x14d9('0x1e')];var _0x5f1d2b=_0x2640e2?0x0:_0xa6f31e[_0x14d9('0x1f')];var _0x2ae7a6=_0x2640e2?_0x42819c['count']:_0xa6f31e[_0x14d9('0x1f')]+_0xa6f31e['limit'];var _0xbf348b;if(_0x2ae7a6>=_0x20da00){_0x2ae7a6=_0x20da00;_0xbf348b=0xc8;}else{_0xbf348b=0xce;}_0x11fd31[_0x14d9('0x1c')](_0xbf348b);return _0x11fd31[_0x14d9('0x20')](_0x14d9('0x21'),_0x5f1d2b+'-'+_0x2ae7a6+'/'+_0x20da00)[_0x14d9('0x22')](_0x42819c);}return null;};}function patchUpdates(_0x460ba3){return function(_0x3b5811){try{jsonpatch[_0x14d9('0x23')](_0x3b5811,_0x460ba3,!![]);}catch(_0x1a2e36){return BPromise['reject'](_0x1a2e36);}return _0x3b5811[_0x14d9('0x24')]();};}function saveUpdates(_0x3dfade,_0x3104ae){return function(_0x12a09e){if(_0x12a09e){return _0x12a09e[_0x14d9('0x25')](_0x3dfade)[_0x14d9('0x26')](function(_0x2ccb71){return _0x2ccb71;});}return null;};}function removeEntity(_0x2ea790,_0x5bfb83){return function(_0x330259){if(_0x330259){return _0x330259[_0x14d9('0x27')]()[_0x14d9('0x26')](function(){_0x2ea790[_0x14d9('0x1c')](0xcc)[_0x14d9('0x1b')]();});}};}function handleEntityNotFound(_0x2bc036,_0x4623e6){return function(_0x4faa7d){if(!_0x4faa7d){_0x2bc036[_0x14d9('0x28')](0x194);}return _0x4faa7d;};}function handleError(_0x3c681b,_0x58fe46){_0x58fe46=_0x58fe46||0x1f4;return function(_0xeb8eab){logger[_0x14d9('0x29')](_0xeb8eab[_0x14d9('0x2a')]);if(_0xeb8eab[_0x14d9('0x2b')]){delete _0xeb8eab['name'];}_0x3c681b['status'](_0x58fe46)[_0x14d9('0x2c')](_0xeb8eab);};}exports[_0x14d9('0x2d')]=function(_0x551ef5,_0x4bce3b){var _0x4eaaf5={},_0x1acf4f={},_0x5b2417={'count':0x0,'rows':[]};var _0x412c95=_[_0x14d9('0x2e')](db['Dynamics365Field'][_0x14d9('0x2f')],function(_0x3adc5d){return{'name':_0x3adc5d[_0x14d9('0x30')],'type':_0x3adc5d[_0x14d9('0x31')][_0x14d9('0x32')]};});_0x1acf4f[_0x14d9('0x33')]=_[_0x14d9('0x2e')](_0x412c95,_0x14d9('0x2b'));_0x1acf4f['query']=_['keys'](_0x551ef5['query']);_0x1acf4f['filters']=_[_0x14d9('0x34')](_0x1acf4f[_0x14d9('0x33')],_0x1acf4f[_0x14d9('0x35')]);_0x4eaaf5['attributes']=_[_0x14d9('0x34')](_0x1acf4f[_0x14d9('0x33')],qs[_0x14d9('0x36')](_0x551ef5['query'][_0x14d9('0x36')]));_0x4eaaf5[_0x14d9('0x37')]=_0x4eaaf5[_0x14d9('0x37')][_0x14d9('0x38')]?_0x4eaaf5[_0x14d9('0x37')]:_0x1acf4f[_0x14d9('0x33')];if(!_0x551ef5['query'][_0x14d9('0x39')](_0x14d9('0x3a'))){_0x4eaaf5['limit']=qs[_0x14d9('0x1d')](_0x551ef5[_0x14d9('0x35')]['limit']);_0x4eaaf5[_0x14d9('0x1f')]=qs[_0x14d9('0x1f')](_0x551ef5[_0x14d9('0x35')][_0x14d9('0x1f')]);}_0x4eaaf5[_0x14d9('0x3b')]=qs[_0x14d9('0x3c')](_0x551ef5[_0x14d9('0x35')][_0x14d9('0x3c')]);_0x4eaaf5['where']=qs[_0x14d9('0x3d')](_[_0x14d9('0x3e')](_0x551ef5[_0x14d9('0x35')],_0x1acf4f['filters']),_0x412c95);if(_0x551ef5[_0x14d9('0x35')]['filter']){_0x4eaaf5[_0x14d9('0x3f')]=_[_0x14d9('0x40')](_0x4eaaf5[_0x14d9('0x3f')],{'$or':_[_0x14d9('0x2e')](_0x412c95,function(_0x22f261){if(_0x22f261[_0x14d9('0x31')]!==_0x14d9('0x41')){var _0x5b4367={};_0x5b4367[_0x22f261[_0x14d9('0x2b')]]={'$like':'%'+_0x551ef5[_0x14d9('0x35')][_0x14d9('0x42')]+'%'};return _0x5b4367;}})});}_0x4eaaf5=_[_0x14d9('0x40')]({},_0x4eaaf5,_0x551ef5[_0x14d9('0x43')]);var _0x4ade15={'where':_0x4eaaf5[_0x14d9('0x3f')]};return db['Dynamics365Field'][_0x14d9('0x1e')](_0x4ade15)[_0x14d9('0x26')](function(_0x93898b){_0x5b2417[_0x14d9('0x1e')]=_0x93898b;if(_0x551ef5[_0x14d9('0x35')][_0x14d9('0x44')]){_0x4eaaf5[_0x14d9('0x45')]=[{'all':!![]}];}return db[_0x14d9('0x46')][_0x14d9('0x47')](_0x4eaaf5);})[_0x14d9('0x26')](function(_0x4a6ca0){_0x5b2417[_0x14d9('0x48')]=_0x4a6ca0;return _0x5b2417;})[_0x14d9('0x26')](respondWithFilteredResult(_0x4bce3b,_0x4eaaf5))['catch'](handleError(_0x4bce3b,null));};exports[_0x14d9('0x49')]=function(_0x449dad,_0x2eb3d8){var _0x1ba0e3={'raw':!![],'where':{'id':_0x449dad[_0x14d9('0x4a')]['id']}},_0x34bcfb={};_0x34bcfb[_0x14d9('0x33')]=_[_0x14d9('0x4b')](db[_0x14d9('0x46')][_0x14d9('0x2f')]);_0x34bcfb[_0x14d9('0x35')]=_[_0x14d9('0x4b')](_0x449dad[_0x14d9('0x35')]);_0x34bcfb['filters']=_[_0x14d9('0x34')](_0x34bcfb[_0x14d9('0x33')],_0x34bcfb[_0x14d9('0x35')]);_0x1ba0e3[_0x14d9('0x37')]=_[_0x14d9('0x34')](_0x34bcfb['model'],qs[_0x14d9('0x36')](_0x449dad['query'][_0x14d9('0x36')]));_0x1ba0e3['attributes']=_0x1ba0e3['attributes'][_0x14d9('0x38')]?_0x1ba0e3['attributes']:_0x34bcfb[_0x14d9('0x33')];if(_0x449dad[_0x14d9('0x35')][_0x14d9('0x44')]){_0x1ba0e3['include']=[{'all':!![]}];}_0x1ba0e3=_[_0x14d9('0x40')]({},_0x1ba0e3,_0x449dad['options']);return db[_0x14d9('0x46')][_0x14d9('0x4c')](_0x1ba0e3)[_0x14d9('0x26')](handleEntityNotFound(_0x2eb3d8,null))[_0x14d9('0x26')](respondWithResult(_0x2eb3d8,null))[_0x14d9('0x4d')](handleError(_0x2eb3d8,null));};exports[_0x14d9('0x4e')]=function(_0x475780,_0x36529f){return db[_0x14d9('0x46')][_0x14d9('0x4e')](_0x475780['body'],{})[_0x14d9('0x26')](respondWithResult(_0x36529f,0xc9))['catch'](handleError(_0x36529f,null));};exports[_0x14d9('0x25')]=function(_0x159854,_0x30b9a9){if(_0x159854['body']['id']){delete _0x159854[_0x14d9('0x4f')]['id'];}return db[_0x14d9('0x46')]['find']({'where':{'id':_0x159854['params']['id']}})['then'](handleEntityNotFound(_0x30b9a9,null))[_0x14d9('0x26')](saveUpdates(_0x159854[_0x14d9('0x4f')],null))[_0x14d9('0x26')](respondWithResult(_0x30b9a9,null))['catch'](handleError(_0x30b9a9,null));};exports[_0x14d9('0x27')]=function(_0x6b045a,_0x336891){return db['Dynamics365Field'][_0x14d9('0x4c')]({'where':{'id':_0x6b045a[_0x14d9('0x4a')]['id']}})[_0x14d9('0x26')](handleEntityNotFound(_0x336891,null))[_0x14d9('0x26')](removeEntity(_0x336891,null))[_0x14d9('0x4d')](handleError(_0x336891,null));}; \ No newline at end of file +var _0x986f=['error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','then','includeAll','rows','show','params','keys','include','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0x986f,0x72));var _0xf986=function(_0x28b199,_0x16d86b){_0x28b199=_0x28b199-0x0;var _0x5f26d4=_0x986f[_0x28b199];return _0x5f26d4;};'use strict';var emlformat=require(_0xf986('0x0'));var rimraf=require(_0xf986('0x1'));var zipdir=require(_0xf986('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf986('0x3'));var moment=require(_0xf986('0x4'));var BPromise=require(_0xf986('0x5'));var Mustache=require(_0xf986('0x6'));var util=require(_0xf986('0x7'));var path=require(_0xf986('0x8'));var sox=require(_0xf986('0x9'));var csv=require(_0xf986('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf986('0xb'));var _=require(_0xf986('0xc'));var squel=require(_0xf986('0xd'));var crypto=require(_0xf986('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf986('0xa'));var querystring=require(_0xf986('0xf'));var Papa=require(_0xf986('0x10'));var Redis=require(_0xf986('0x11'));var authService=require(_0xf986('0x12'));var qs=require(_0xf986('0x13'));var as=require(_0xf986('0x14'));var hardwareService=require(_0xf986('0x15'));var logger=require('../../config/logger')(_0xf986('0x16'));var utils=require(_0xf986('0x17'));var config=require(_0xf986('0x18'));var licenseUtil=require(_0xf986('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461f9d,_0x1d3c7d){_0x1d3c7d=_0x1d3c7d||0xcc;return function(_0x458e66){if(_0x458e66){return _0x461f9d[_0xf986('0x1a')](_0x1d3c7d);}return _0x461f9d[_0xf986('0x1b')](_0x1d3c7d)[_0xf986('0x1c')]();};}function respondWithResult(_0x578949,_0x3c7e1d){_0x3c7e1d=_0x3c7e1d||0xc8;return function(_0x41b001){if(_0x41b001){return _0x578949[_0xf986('0x1b')](_0x3c7e1d)[_0xf986('0x1d')](_0x41b001);}};}function respondWithFilteredResult(_0x176847,_0x310dc4){return function(_0x145834){if(_0x145834){var _0x2f60d4=typeof _0x310dc4[_0xf986('0x1e')]===_0xf986('0x1f')&&typeof _0x310dc4[_0xf986('0x20')]===_0xf986('0x1f');var _0x4e780c=_0x145834[_0xf986('0x21')];var _0x3da8a2=_0x2f60d4?0x0:_0x310dc4[_0xf986('0x1e')];var _0x11c8a2=_0x2f60d4?_0x145834[_0xf986('0x21')]:_0x310dc4['offset']+_0x310dc4[_0xf986('0x20')];var _0x2796bf;if(_0x11c8a2>=_0x4e780c){_0x11c8a2=_0x4e780c;_0x2796bf=0xc8;}else{_0x2796bf=0xce;}_0x176847[_0xf986('0x1b')](_0x2796bf);return _0x176847['set'](_0xf986('0x22'),_0x3da8a2+'-'+_0x11c8a2+'/'+_0x4e780c)[_0xf986('0x1d')](_0x145834);}return null;};}function patchUpdates(_0x564aa7){return function(_0x264ab2){try{jsonpatch['apply'](_0x264ab2,_0x564aa7,!![]);}catch(_0x46f801){return BPromise[_0xf986('0x23')](_0x46f801);}return _0x264ab2[_0xf986('0x24')]();};}function saveUpdates(_0x1dccf4,_0x308696){return function(_0x1576c0){if(_0x1576c0){return _0x1576c0[_0xf986('0x25')](_0x1dccf4)['then'](function(_0x218a83){return _0x218a83;});}return null;};}function removeEntity(_0x4de910,_0x2f3ec0){return function(_0x5b6fb9){if(_0x5b6fb9){return _0x5b6fb9['destroy']()['then'](function(){_0x4de910[_0xf986('0x1b')](0xcc)[_0xf986('0x1c')]();});}};}function handleEntityNotFound(_0x48cf03,_0x40ea49){return function(_0x42ff22){if(!_0x42ff22){_0x48cf03[_0xf986('0x1a')](0x194);}return _0x42ff22;};}function handleError(_0x4c96dd,_0x3e32d2){_0x3e32d2=_0x3e32d2||0x1f4;return function(_0x4e6aab){logger[_0xf986('0x26')](_0x4e6aab[_0xf986('0x27')]);if(_0x4e6aab['name']){delete _0x4e6aab[_0xf986('0x28')];}_0x4c96dd[_0xf986('0x1b')](_0x3e32d2)[_0xf986('0x29')](_0x4e6aab);};}exports[_0xf986('0x2a')]=function(_0x58258b,_0xaab784){var _0x1f5faa={},_0xcf6305={},_0x4ee2f8={'count':0x0,'rows':[]};var _0x488c21=_[_0xf986('0x2b')](db[_0xf986('0x2c')][_0xf986('0x2d')],function(_0x21df9d){return{'name':_0x21df9d['fieldName'],'type':_0x21df9d[_0xf986('0x2e')][_0xf986('0x2f')]};});_0xcf6305[_0xf986('0x30')]=_['map'](_0x488c21,_0xf986('0x28'));_0xcf6305[_0xf986('0x31')]=_['keys'](_0x58258b['query']);_0xcf6305['filters']=_[_0xf986('0x32')](_0xcf6305['model'],_0xcf6305[_0xf986('0x31')]);_0x1f5faa[_0xf986('0x33')]=_[_0xf986('0x32')](_0xcf6305['model'],qs[_0xf986('0x34')](_0x58258b[_0xf986('0x31')][_0xf986('0x34')]));_0x1f5faa['attributes']=_0x1f5faa[_0xf986('0x33')][_0xf986('0x35')]?_0x1f5faa[_0xf986('0x33')]:_0xcf6305[_0xf986('0x30')];if(!_0x58258b['query'][_0xf986('0x36')](_0xf986('0x37'))){_0x1f5faa[_0xf986('0x20')]=qs[_0xf986('0x20')](_0x58258b['query'][_0xf986('0x20')]);_0x1f5faa['offset']=qs[_0xf986('0x1e')](_0x58258b[_0xf986('0x31')]['offset']);}_0x1f5faa[_0xf986('0x38')]=qs[_0xf986('0x39')](_0x58258b['query'][_0xf986('0x39')]);_0x1f5faa['where']=qs[_0xf986('0x3a')](_[_0xf986('0x3b')](_0x58258b['query'],_0xcf6305['filters']),_0x488c21);if(_0x58258b['query'][_0xf986('0x3c')]){_0x1f5faa['where']=_['merge'](_0x1f5faa[_0xf986('0x3d')],{'$or':_[_0xf986('0x2b')](_0x488c21,function(_0x585421){if(_0x585421[_0xf986('0x2e')]!==_0xf986('0x3e')){var _0x25cf8c={};_0x25cf8c[_0x585421[_0xf986('0x28')]]={'$like':'%'+_0x58258b[_0xf986('0x31')][_0xf986('0x3c')]+'%'};return _0x25cf8c;}})});}_0x1f5faa=_['merge']({},_0x1f5faa,_0x58258b[_0xf986('0x3f')]);var _0x3d2eec={'where':_0x1f5faa[_0xf986('0x3d')]};return db[_0xf986('0x2c')]['count'](_0x3d2eec)[_0xf986('0x40')](function(_0x234c5d){_0x4ee2f8[_0xf986('0x21')]=_0x234c5d;if(_0x58258b[_0xf986('0x31')][_0xf986('0x41')]){_0x1f5faa['include']=[{'all':!![]}];}return db[_0xf986('0x2c')]['findAll'](_0x1f5faa);})[_0xf986('0x40')](function(_0x16c5e8){_0x4ee2f8[_0xf986('0x42')]=_0x16c5e8;return _0x4ee2f8;})[_0xf986('0x40')](respondWithFilteredResult(_0xaab784,_0x1f5faa))['catch'](handleError(_0xaab784,null));};exports[_0xf986('0x43')]=function(_0x5b2109,_0x421c36){var _0x2cafdd={'raw':!![],'where':{'id':_0x5b2109[_0xf986('0x44')]['id']}},_0x143481={};_0x143481[_0xf986('0x30')]=_[_0xf986('0x45')](db[_0xf986('0x2c')][_0xf986('0x2d')]);_0x143481[_0xf986('0x31')]=_[_0xf986('0x45')](_0x5b2109[_0xf986('0x31')]);_0x143481[_0xf986('0x3a')]=_[_0xf986('0x32')](_0x143481['model'],_0x143481[_0xf986('0x31')]);_0x2cafdd[_0xf986('0x33')]=_['intersection'](_0x143481['model'],qs[_0xf986('0x34')](_0x5b2109['query'][_0xf986('0x34')]));_0x2cafdd[_0xf986('0x33')]=_0x2cafdd[_0xf986('0x33')][_0xf986('0x35')]?_0x2cafdd[_0xf986('0x33')]:_0x143481['model'];if(_0x5b2109[_0xf986('0x31')][_0xf986('0x41')]){_0x2cafdd[_0xf986('0x46')]=[{'all':!![]}];}_0x2cafdd=_['merge']({},_0x2cafdd,_0x5b2109[_0xf986('0x3f')]);return db[_0xf986('0x2c')][_0xf986('0x47')](_0x2cafdd)[_0xf986('0x40')](handleEntityNotFound(_0x421c36,null))[_0xf986('0x40')](respondWithResult(_0x421c36,null))[_0xf986('0x48')](handleError(_0x421c36,null));};exports[_0xf986('0x49')]=function(_0x233297,_0x219c59){return db[_0xf986('0x2c')][_0xf986('0x49')](_0x233297['body'],{})[_0xf986('0x40')](respondWithResult(_0x219c59,0xc9))[_0xf986('0x48')](handleError(_0x219c59,null));};exports['update']=function(_0x21003f,_0x5805f9){if(_0x21003f[_0xf986('0x4a')]['id']){delete _0x21003f[_0xf986('0x4a')]['id'];}return db[_0xf986('0x2c')][_0xf986('0x47')]({'where':{'id':_0x21003f[_0xf986('0x44')]['id']}})[_0xf986('0x40')](handleEntityNotFound(_0x5805f9,null))[_0xf986('0x40')](saveUpdates(_0x21003f[_0xf986('0x4a')],null))[_0xf986('0x40')](respondWithResult(_0x5805f9,null))['catch'](handleError(_0x5805f9,null));};exports[_0xf986('0x4b')]=function(_0xc3bf7a,_0x44b796){return db[_0xf986('0x2c')]['find']({'where':{'id':_0xc3bf7a[_0xf986('0x44')]['id']}})[_0xf986('0x40')](handleEntityNotFound(_0x44b796,null))['then'](removeEntity(_0x44b796,null))[_0xf986('0x48')](handleError(_0x44b796,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b2d4734..3a71de7 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 _0x8fb5=['./intDynamics365Field.attributes','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf35d3c,_0x161bbc){var _0x569b8c=function(_0x4d9cdc){while(--_0x4d9cdc){_0xf35d3c['push'](_0xf35d3c['shift']());}};_0x569b8c(++_0x161bbc);}(_0x8fb5,0x1da));var _0x58fb=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x8fb5[_0x173452];return _0xee3fd0;};'use strict';var _=require(_0x58fb('0x0'));var util=require(_0x58fb('0x1'));var logger=require(_0x58fb('0x2'))(_0x58fb('0x3'));var moment=require(_0x58fb('0x4'));var BPromise=require(_0x58fb('0x5'));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(_0x58fb('0x6'));module['exports']=function(_0x1126ea,_0x41b7a8){return _0x1126ea[_0x58fb('0x7')]('Dynamics365Field',attributes,{'tableName':_0x58fb('0x8'),'paranoid':![],'indexes':[{'name':_0x58fb('0x9'),'fields':[_0x58fb('0xa'),_0x58fb('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2066=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x29af49,_0x1403af){var _0x2af322=function(_0x3e4d86){while(--_0x3e4d86){_0x29af49['push'](_0x29af49['shift']());}};_0x2af322(++_0x1403af);}(_0x2066,0x1b9));var _0x6206=function(_0x2aa66f,_0x4fd888){_0x2aa66f=_0x2aa66f-0x0;var _0x1461e0=_0x2066[_0x2aa66f];return _0x1461e0;};'use strict';var _=require(_0x6206('0x0'));var util=require(_0x6206('0x1'));var logger=require('../../config/logger')(_0x6206('0x2'));var moment=require(_0x6206('0x3'));var BPromise=require(_0x6206('0x4'));var rp=require(_0x6206('0x5'));var fs=require('fs');var path=require(_0x6206('0x6'));var rimraf=require(_0x6206('0x7'));var config=require(_0x6206('0x8'));var attributes=require(_0x6206('0x9'));module[_0x6206('0xa')]=function(_0x13ac5a,_0xd9091d){return _0x13ac5a[_0x6206('0xb')](_0x6206('0xc'),attributes,{'tableName':_0x6206('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x6206('0xe'),_0x6206('0xf')],'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 72d62cd..6204832 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 _0xae0b=['Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x15b3b3,_0x12b9f6){var _0x49108b=function(_0x4451a5){while(--_0x4451a5){_0x15b3b3['push'](_0x15b3b3['shift']());}};_0x49108b(++_0x12b9f6);}(_0xae0b,0x66));var _0xbae0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae0b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbae0('0x0'));var util=require('util');var moment=require(_0xbae0('0x1'));var BPromise=require(_0xbae0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbae0('0x3'));var logger=require('../../config/logger')(_0xbae0('0x4'));var config=require(_0xbae0('0x5'));var jayson=require(_0xbae0('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ee3d0,_0x298a06,_0x2cbcaa){return new BPromise(function(_0x2d725d,_0x3f61f2){return client['request'](_0x5ee3d0,_0x2cbcaa)[_0xbae0('0x7')](function(_0x289359){logger['info'](_0xbae0('0x8'),_0x298a06,_0xbae0('0x9'));logger['debug'](_0xbae0('0xa'),_0x298a06,'request\x20sent',JSON['stringify'](_0x289359));if(_0x289359[_0xbae0('0xb')]){if(_0x289359[_0xbae0('0xb')][_0xbae0('0xc')]===0x1f4){logger[_0xbae0('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x298a06,_0x289359[_0xbae0('0xb')][_0xbae0('0xd')]);return _0x3f61f2(_0x289359[_0xbae0('0xb')][_0xbae0('0xd')]);}logger[_0xbae0('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x298a06,_0x289359[_0xbae0('0xb')][_0xbae0('0xd')]);return _0x2d725d(_0x289359[_0xbae0('0xb')]['message']);}else{logger[_0xbae0('0xe')](_0xbae0('0x8'),_0x298a06,_0xbae0('0x9'));_0x2d725d(_0x289359['result'][_0xbae0('0xd')]);}})[_0xbae0('0xf')](function(_0x243977){logger[_0xbae0('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x298a06,_0x243977);_0x3f61f2(_0x243977);});});} \ No newline at end of file +var _0xb5ee=['rpc','../../config/environment','client','request','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Field,\x20%s,\x20%s','request\x20sent','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xb5ee,0x1c7));var _0xeb5e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb5ee[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xeb5e('0x0'));var util=require(_0xeb5e('0x1'));var moment=require('moment');var BPromise=require(_0xeb5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb5e('0x3'));var db=require(_0xeb5e('0x4'))['db'];var utils=require(_0xeb5e('0x5'));var logger=require(_0xeb5e('0x6'))(_0xeb5e('0x7'));var config=require(_0xeb5e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb5e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b61ff,_0x41efc9,_0x2b4499){return new BPromise(function(_0x558937,_0x40b76b){return client[_0xeb5e('0xa')](_0x5b61ff,_0x2b4499)[_0xeb5e('0xb')](function(_0x5daebd){logger[_0xeb5e('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x41efc9,'request\x20sent');logger[_0xeb5e('0xd')](_0xeb5e('0xe'),_0x41efc9,'request\x20sent',JSON[_0xeb5e('0xf')](_0x5daebd));if(_0x5daebd['error']){if(_0x5daebd[_0xeb5e('0x10')][_0xeb5e('0x11')]===0x1f4){logger[_0xeb5e('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x41efc9,_0x5daebd[_0xeb5e('0x10')][_0xeb5e('0x12')]);return _0x40b76b(_0x5daebd['error'][_0xeb5e('0x12')]);}logger['error'](_0xeb5e('0x13'),_0x41efc9,_0x5daebd[_0xeb5e('0x10')][_0xeb5e('0x12')]);return _0x558937(_0x5daebd[_0xeb5e('0x10')][_0xeb5e('0x12')]);}else{logger[_0xeb5e('0xc')](_0xeb5e('0x13'),_0x41efc9,_0xeb5e('0x14'));_0x558937(_0x5daebd[_0xeb5e('0x15')][_0xeb5e('0x12')]);}})['catch'](function(_0x5463e6){logger[_0xeb5e('0x10')](_0xeb5e('0x13'),_0x41efc9,_0x5463e6);_0x40b76b(_0x5463e6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c815fd5..6068258 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 _0x40d0=['put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post'];(function(_0x27b187,_0x2b576f){var _0x37f8f9=function(_0x253599){while(--_0x253599){_0x27b187['push'](_0x27b187['shift']());}};_0x37f8f9(++_0x2b576f);}(_0x40d0,0x139));var _0x040d=function(_0x110197,_0x4e546b){_0x110197=_0x110197-0x0;var _0x3b8623=_0x40d0[_0x110197];return _0x3b8623;};'use strict';var multer=require('multer');var util=require(_0x040d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x040d('0x1'));var router=express[_0x040d('0x2')]();var fs_extra=require(_0x040d('0x3'));var auth=require(_0x040d('0x4'));var interaction=require(_0x040d('0x5'));var config=require('../../config/environment');var controller=require(_0x040d('0x6'));router[_0x040d('0x7')]('/',auth[_0x040d('0x8')](),controller[_0x040d('0x9')]);router[_0x040d('0x7')](_0x040d('0xa'),auth[_0x040d('0x8')](),controller[_0x040d('0xb')]);router['get'](_0x040d('0xc'),auth[_0x040d('0x8')](),controller[_0x040d('0xd')]);router['get'](_0x040d('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x040d('0x8')](),controller[_0x040d('0xf')]);router[_0x040d('0x10')](_0x040d('0xc'),auth[_0x040d('0x8')](),controller['addConfiguration']);router[_0x040d('0x11')](_0x040d('0xa'),auth[_0x040d('0x8')](),controller[_0x040d('0x12')]);router[_0x040d('0x13')](_0x040d('0xa'),auth['isAuthenticated'](),controller[_0x040d('0x14')]);module[_0x040d('0x15')]=router; \ No newline at end of file +var _0x5d4b=['create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post'];(function(_0x2ffb08,_0x46a2f5){var _0x42bffb=function(_0x103d39){while(--_0x103d39){_0x2ffb08['push'](_0x2ffb08['shift']());}};_0x42bffb(++_0x46a2f5);}(_0x5d4b,0xd0));var _0xb5d4=function(_0x479700,_0x1125d2){_0x479700=_0x479700-0x0;var _0x2a6c06=_0x5d4b[_0x479700];return _0x2a6c06;};'use strict';var multer=require('multer');var util=require(_0xb5d4('0x0'));var path=require(_0xb5d4('0x1'));var timeout=require(_0xb5d4('0x2'));var express=require(_0xb5d4('0x3'));var router=express[_0xb5d4('0x4')]();var fs_extra=require(_0xb5d4('0x5'));var auth=require(_0xb5d4('0x6'));var interaction=require(_0xb5d4('0x7'));var config=require(_0xb5d4('0x8'));var controller=require(_0xb5d4('0x9'));router[_0xb5d4('0xa')]('/',auth[_0xb5d4('0xb')](),controller[_0xb5d4('0xc')]);router[_0xb5d4('0xa')]('/:id',auth[_0xb5d4('0xb')](),controller[_0xb5d4('0xd')]);router[_0xb5d4('0xa')]('/:id/configurations',auth[_0xb5d4('0xb')](),controller['getConfigurations']);router[_0xb5d4('0xa')](_0xb5d4('0xe'),auth['isAuthenticated'](),controller[_0xb5d4('0xf')]);router[_0xb5d4('0x10')]('/',auth[_0xb5d4('0xb')](),controller[_0xb5d4('0x11')]);router[_0xb5d4('0x10')](_0xb5d4('0x12'),auth[_0xb5d4('0xb')](),controller[_0xb5d4('0x13')]);router[_0xb5d4('0x14')](_0xb5d4('0x15'),auth[_0xb5d4('0xb')](),controller['update']);router[_0xb5d4('0x16')](_0xb5d4('0x15'),auth['isAuthenticated'](),controller[_0xb5d4('0x17')]);module[_0xb5d4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d9f5af0..21dc3ba 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 _0xda2d=['exports','STRING','username'];(function(_0x4de63c,_0x104832){var _0x592333=function(_0x267310){while(--_0x267310){_0x4de63c['push'](_0x4de63c['shift']());}};_0x592333(++_0x104832);}(_0xda2d,0x102));var _0xdda2=function(_0x181782,_0x5a8920){_0x181782=_0x181782-0x0;var _0x14d8ff=_0xda2d[_0x181782];return _0x14d8ff;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'name':{'type':Sequelize[_0xdda2('0x1')]},'description':{'type':Sequelize[_0xdda2('0x1')]},'username':{'type':Sequelize[_0xdda2('0x1')],'unique':_0xdda2('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xdda2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xaebd=['remoteUri','sequelize','STRING','username'];(function(_0x4b8968,_0x5c9b44){var _0x3a0ab7=function(_0x4dade2){while(--_0x4dade2){_0x4b8968['push'](_0x4b8968['shift']());}};_0x3a0ab7(++_0x5c9b44);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x46c211,_0x3b2126){_0x46c211=_0x46c211-0x0;var _0x12cff9=_0xaebd[_0x46c211];return _0x12cff9;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')]},'description':{'type':Sequelize[_0xdaeb('0x1')]},'username':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2')},'apiKey':{'type':Sequelize[_0xdaeb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdaeb('0x3')},'serverUrl':{'type':Sequelize[_0xdaeb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 342c5f9..0583d44 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 _0x0f73=['ticket_type','remove','includes','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','then','end','error','name','send','map','FreshdeskAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','update','params','getConfigurations','FreshdeskConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','GET','format','%s/%s','Basic\x20%s','toString','base64','subject','agent','description','priority','group'];(function(_0x463943,_0xdf7201){var _0x27a3dd=function(_0x33426e){while(--_0x33426e){_0x463943['push'](_0x463943['shift']());}};_0x27a3dd(++_0xdf7201);}(_0x0f73,0x146));var _0x30f7=function(_0x7a3fff,_0x19e65d){_0x7a3fff=_0x7a3fff-0x0;var _0x1edfa7=_0x0f73[_0x7a3fff];return _0x1edfa7;};'use strict';var emlformat=require(_0x30f7('0x0'));var rimraf=require(_0x30f7('0x1'));var zipdir=require(_0x30f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x30f7('0x3'));var BPromise=require(_0x30f7('0x4'));var Mustache=require(_0x30f7('0x5'));var util=require(_0x30f7('0x6'));var path=require(_0x30f7('0x7'));var sox=require('sox');var csv=require(_0x30f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30f7('0x9'));var squel=require(_0x30f7('0xa'));var crypto=require(_0x30f7('0xb'));var jsforce=require(_0x30f7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x30f7('0x8'));var querystring=require(_0x30f7('0xd'));var Papa=require('papaparse');var Redis=require(_0x30f7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30f7('0xf'));var hardwareService=require(_0x30f7('0x10'));var logger=require(_0x30f7('0x11'))(_0x30f7('0x12'));var utils=require('../../config/utils');var config=require(_0x30f7('0x13'));var licenseUtil=require(_0x30f7('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x30f7('0x15'));function respondWithStatusCode(_0x7b4cd1,_0xb9752c){_0xb9752c=_0xb9752c||0xcc;return function(_0x5a2223){if(_0x5a2223){return _0x7b4cd1[_0x30f7('0x16')](_0xb9752c);}return _0x7b4cd1[_0x30f7('0x17')](_0xb9752c)['end']();};}function respondWithResult(_0x1ad086,_0xfc31c5){_0xfc31c5=_0xfc31c5||0xc8;return function(_0x383a7f){if(_0x383a7f){return _0x1ad086[_0x30f7('0x17')](_0xfc31c5)[_0x30f7('0x18')](_0x383a7f);}};}function respondWithFilteredResult(_0x579e7a,_0x49fccb){return function(_0x401f9e){if(_0x401f9e){var _0x9861c3=typeof _0x49fccb[_0x30f7('0x19')]===_0x30f7('0x1a')&&typeof _0x49fccb['limit']===_0x30f7('0x1a');var _0x5210cc=_0x401f9e[_0x30f7('0x1b')];var _0x1083e3=_0x9861c3?0x0:_0x49fccb[_0x30f7('0x19')];var _0x21f3d1=_0x9861c3?_0x401f9e[_0x30f7('0x1b')]:_0x49fccb[_0x30f7('0x19')]+_0x49fccb[_0x30f7('0x1c')];var _0x4d2d8d;if(_0x21f3d1>=_0x5210cc){_0x21f3d1=_0x5210cc;_0x4d2d8d=0xc8;}else{_0x4d2d8d=0xce;}_0x579e7a[_0x30f7('0x17')](_0x4d2d8d);return _0x579e7a[_0x30f7('0x1d')](_0x30f7('0x1e'),_0x1083e3+'-'+_0x21f3d1+'/'+_0x5210cc)[_0x30f7('0x18')](_0x401f9e);}return null;};}function patchUpdates(_0x37d7d5){return function(_0x3380e1){try{jsonpatch['apply'](_0x3380e1,_0x37d7d5,!![]);}catch(_0x9dfa89){return BPromise[_0x30f7('0x1f')](_0x9dfa89);}return _0x3380e1['save']();};}function saveUpdates(_0x570d52,_0x12d3f2){return function(_0x57d2ee){if(_0x57d2ee){return _0x57d2ee['update'](_0x570d52)['then'](function(_0x1bfc45){return _0x1bfc45;});}return null;};}function removeEntity(_0x261116,_0x4c686d){return function(_0x4b77ec){if(_0x4b77ec){return _0x4b77ec[_0x30f7('0x20')]()[_0x30f7('0x21')](function(){_0x261116['status'](0xcc)[_0x30f7('0x22')]();});}};}function handleEntityNotFound(_0x3bb297,_0x14429e){return function(_0x583496){if(!_0x583496){_0x3bb297[_0x30f7('0x16')](0x194);}return _0x583496;};}function handleError(_0x4407ed,_0x540caf){_0x540caf=_0x540caf||0x1f4;return function(_0x2f6443){logger[_0x30f7('0x23')](_0x2f6443['stack']);if(_0x2f6443[_0x30f7('0x24')]){delete _0x2f6443[_0x30f7('0x24')];}_0x4407ed['status'](_0x540caf)[_0x30f7('0x25')](_0x2f6443);};}exports['index']=function(_0x2ec3b9,_0x371258){var _0x21bb2a={},_0x1e2b16={},_0xbd53d={'count':0x0,'rows':[]};var _0x518e02=_[_0x30f7('0x26')](db[_0x30f7('0x27')][_0x30f7('0x28')],function(_0x3e26f3){return{'name':_0x3e26f3['fieldName'],'type':_0x3e26f3[_0x30f7('0x29')]['key']};});_0x1e2b16[_0x30f7('0x2a')]=_['map'](_0x518e02,_0x30f7('0x24'));_0x1e2b16[_0x30f7('0x2b')]=_[_0x30f7('0x2c')](_0x2ec3b9[_0x30f7('0x2b')]);_0x1e2b16['filters']=_['intersection'](_0x1e2b16[_0x30f7('0x2a')],_0x1e2b16[_0x30f7('0x2b')]);_0x21bb2a[_0x30f7('0x2d')]=_[_0x30f7('0x2e')](_0x1e2b16['model'],qs[_0x30f7('0x2f')](_0x2ec3b9[_0x30f7('0x2b')][_0x30f7('0x2f')]));_0x21bb2a[_0x30f7('0x2d')]=_0x21bb2a[_0x30f7('0x2d')][_0x30f7('0x30')]?_0x21bb2a[_0x30f7('0x2d')]:_0x1e2b16[_0x30f7('0x2a')];if(!_0x2ec3b9[_0x30f7('0x2b')]['hasOwnProperty'](_0x30f7('0x31'))){_0x21bb2a[_0x30f7('0x1c')]=qs[_0x30f7('0x1c')](_0x2ec3b9[_0x30f7('0x2b')]['limit']);_0x21bb2a[_0x30f7('0x19')]=qs[_0x30f7('0x19')](_0x2ec3b9[_0x30f7('0x2b')]['offset']);}_0x21bb2a[_0x30f7('0x32')]=qs[_0x30f7('0x33')](_0x2ec3b9[_0x30f7('0x2b')][_0x30f7('0x33')]);_0x21bb2a[_0x30f7('0x34')]=qs[_0x30f7('0x35')](_[_0x30f7('0x36')](_0x2ec3b9[_0x30f7('0x2b')],_0x1e2b16['filters']),_0x518e02);if(_0x2ec3b9[_0x30f7('0x2b')][_0x30f7('0x37')]){_0x21bb2a['where']=_[_0x30f7('0x38')](_0x21bb2a[_0x30f7('0x34')],{'$or':_[_0x30f7('0x26')](_0x518e02,function(_0x36700d){if(_0x36700d[_0x30f7('0x29')]!==_0x30f7('0x39')){var _0x416718={};_0x416718[_0x36700d[_0x30f7('0x24')]]={'$like':'%'+_0x2ec3b9[_0x30f7('0x2b')][_0x30f7('0x37')]+'%'};return _0x416718;}})});}_0x21bb2a=_[_0x30f7('0x38')]({},_0x21bb2a,_0x2ec3b9[_0x30f7('0x3a')]);var _0x440103={'where':_0x21bb2a[_0x30f7('0x34')]};return db[_0x30f7('0x27')]['count'](_0x440103)[_0x30f7('0x21')](function(_0x4ac209){_0xbd53d['count']=_0x4ac209;if(_0x2ec3b9['query'][_0x30f7('0x3b')]){_0x21bb2a[_0x30f7('0x3c')]=[{'all':!![]}];}return db[_0x30f7('0x27')][_0x30f7('0x3d')](_0x21bb2a);})[_0x30f7('0x21')](function(_0x2f581b){_0xbd53d['rows']=_0x2f581b;return _0xbd53d;})[_0x30f7('0x21')](respondWithFilteredResult(_0x371258,_0x21bb2a))[_0x30f7('0x3e')](handleError(_0x371258,null));};exports['show']=function(_0x480a8f,_0x4ac14f){var _0x5194c7={'raw':![],'where':{'id':_0x480a8f['params']['id']}},_0x43f19a={};_0x43f19a[_0x30f7('0x2a')]=_[_0x30f7('0x2c')](db[_0x30f7('0x27')]['rawAttributes']);_0x43f19a[_0x30f7('0x2b')]=_[_0x30f7('0x2c')](_0x480a8f[_0x30f7('0x2b')]);_0x43f19a[_0x30f7('0x35')]=_[_0x30f7('0x2e')](_0x43f19a[_0x30f7('0x2a')],_0x43f19a['query']);_0x5194c7['attributes']=_[_0x30f7('0x2e')](_0x43f19a[_0x30f7('0x2a')],qs[_0x30f7('0x2f')](_0x480a8f[_0x30f7('0x2b')]['fields']));_0x5194c7[_0x30f7('0x2d')]=_0x5194c7[_0x30f7('0x2d')][_0x30f7('0x30')]?_0x5194c7['attributes']:_0x43f19a['model'];if(_0x480a8f[_0x30f7('0x2b')][_0x30f7('0x3b')]){_0x5194c7['include']=[{'all':!![]}];}_0x5194c7=_[_0x30f7('0x38')]({},_0x5194c7,_0x480a8f['options']);return db[_0x30f7('0x27')][_0x30f7('0x3f')](_0x5194c7)[_0x30f7('0x21')](handleEntityNotFound(_0x4ac14f,null))[_0x30f7('0x21')](respondWithResult(_0x4ac14f,null))[_0x30f7('0x3e')](handleError(_0x4ac14f,null));};exports[_0x30f7('0x40')]=function(_0x107c72,_0x267583){return db[_0x30f7('0x27')][_0x30f7('0x40')](_0x107c72[_0x30f7('0x41')],{})[_0x30f7('0x21')](respondWithResult(_0x267583,0xc9))[_0x30f7('0x3e')](handleError(_0x267583,null));};exports[_0x30f7('0x42')]=function(_0x1c18af,_0x44b0d2){if(_0x1c18af[_0x30f7('0x41')]['id']){delete _0x1c18af[_0x30f7('0x41')]['id'];}return db[_0x30f7('0x27')][_0x30f7('0x3f')]({'where':{'id':_0x1c18af[_0x30f7('0x43')]['id']}})['then'](handleEntityNotFound(_0x44b0d2,null))[_0x30f7('0x21')](saveUpdates(_0x1c18af[_0x30f7('0x41')],null))[_0x30f7('0x21')](respondWithResult(_0x44b0d2,null))[_0x30f7('0x3e')](handleError(_0x44b0d2,null));};exports[_0x30f7('0x20')]=function(_0x1908b8,_0x26377e){return db[_0x30f7('0x27')][_0x30f7('0x3f')]({'where':{'id':_0x1908b8[_0x30f7('0x43')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x26377e,null))[_0x30f7('0x21')](removeEntity(_0x26377e,null))['catch'](handleError(_0x26377e,null));};exports[_0x30f7('0x44')]=function(_0x4bd1d1,_0x288048,_0x213d9b){var _0x9aa62b={};var _0x557854={};var _0x155fbc;var _0x9fc9f;return db[_0x30f7('0x27')]['findOne']({'where':{'id':_0x4bd1d1['params']['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x288048,null))[_0x30f7('0x21')](function(_0x5d023f){if(_0x5d023f){_0x155fbc=_0x5d023f;_0x557854['model']=_[_0x30f7('0x2c')](db[_0x30f7('0x45')]['rawAttributes']);_0x557854[_0x30f7('0x2b')]=_[_0x30f7('0x2c')](_0x4bd1d1[_0x30f7('0x2b')]);_0x557854[_0x30f7('0x35')]=_[_0x30f7('0x2e')](_0x557854[_0x30f7('0x2a')],_0x557854[_0x30f7('0x2b')]);_0x9aa62b[_0x30f7('0x2d')]=_[_0x30f7('0x2e')](_0x557854[_0x30f7('0x2a')],qs['fields'](_0x4bd1d1[_0x30f7('0x2b')]['fields']));_0x9aa62b[_0x30f7('0x2d')]=_0x9aa62b[_0x30f7('0x2d')][_0x30f7('0x30')]?_0x9aa62b[_0x30f7('0x2d')]:_0x557854[_0x30f7('0x2a')];_0x9aa62b[_0x30f7('0x32')]=qs['sort'](_0x4bd1d1[_0x30f7('0x2b')][_0x30f7('0x33')]);_0x9aa62b['where']=qs['filters'](_[_0x30f7('0x36')](_0x4bd1d1[_0x30f7('0x2b')],_0x557854[_0x30f7('0x35')]));if(_0x4bd1d1[_0x30f7('0x2b')][_0x30f7('0x37')]){_0x9aa62b[_0x30f7('0x34')]=_[_0x30f7('0x38')](_0x9aa62b[_0x30f7('0x34')],{'$or':_[_0x30f7('0x26')](_0x9aa62b[_0x30f7('0x2d')],function(_0x371de8){var _0x7d6056={};_0x7d6056[_0x371de8]={'$like':'%'+_0x4bd1d1[_0x30f7('0x2b')][_0x30f7('0x37')]+'%'};return _0x7d6056;})});}_0x9aa62b=_[_0x30f7('0x38')]({},_0x9aa62b,_0x4bd1d1[_0x30f7('0x3a')]);return _0x155fbc[_0x30f7('0x44')](_0x9aa62b);}})[_0x30f7('0x21')](function(_0x72f8e){if(_0x72f8e){_0x9fc9f=_0x72f8e[_0x30f7('0x30')];if(!_0x4bd1d1['query'][_0x30f7('0x46')](_0x30f7('0x31'))){_0x9aa62b[_0x30f7('0x1c')]=qs[_0x30f7('0x1c')](_0x4bd1d1['query']['limit']);_0x9aa62b[_0x30f7('0x19')]=qs['offset'](_0x4bd1d1[_0x30f7('0x2b')][_0x30f7('0x19')]);}return _0x155fbc[_0x30f7('0x44')](_0x9aa62b);}})['then'](function(_0x371d8c){if(_0x371d8c){return _0x371d8c?{'count':_0x9fc9f,'rows':_0x371d8c}:null;}})['then'](respondWithResult(_0x288048,null))[_0x30f7('0x3e')](handleError(_0x288048,null));};exports[_0x30f7('0x47')]=function(_0x25f7cb,_0x58e161,_0x2608b4){if(_0x25f7cb[_0x30f7('0x41')]['id']){delete _0x25f7cb[_0x30f7('0x41')]['id'];}return db[_0x30f7('0x27')][_0x30f7('0x48')]({'where':{'id':_0x25f7cb[_0x30f7('0x43')]['id']}})['then'](handleEntityNotFound(_0x58e161,null))[_0x30f7('0x21')](function(_0x2cd21a){if(_0x2cd21a){_0x25f7cb['body'][_0x30f7('0x49')]=_0x2cd21a['id'];_0x25f7cb[_0x30f7('0x41')][_0x30f7('0x4a')]=integrations[_0x30f7('0x4b')](_0x25f7cb[_0x30f7('0x41')]['channel'],_0x25f7cb[_0x30f7('0x41')][_0x30f7('0x29')]);_0x25f7cb['body'][_0x30f7('0x4c')]=integrations[_0x30f7('0x4d')](_0x25f7cb[_0x30f7('0x41')]['channel'],_0x25f7cb[_0x30f7('0x41')][_0x30f7('0x29')]);return db[_0x30f7('0x45')]['create'](_0x25f7cb[_0x30f7('0x41')],{'include':[{'model':db[_0x30f7('0x4e')],'as':_0x30f7('0x4a')},{'model':db['FreshdeskField'],'as':_0x30f7('0x4c')}]});}return null;})[_0x30f7('0x21')](respondWithResult(_0x58e161,null))[_0x30f7('0x3e')](handleError(_0x58e161,null));};exports['getFields']=function(_0x49d879,_0x1bd8dd,_0x38eb7d){var _0x381499='';return db[_0x30f7('0x27')][_0x30f7('0x48')]({'where':{'id':_0x49d879[_0x30f7('0x43')]['id']},'attributes':['id',_0x30f7('0x4f'),_0x30f7('0x50')]})[_0x30f7('0x21')](handleEntityNotFound(_0x1bd8dd,null))[_0x30f7('0x21')](function(_0x4933d6){if(_0x4933d6){_0x381499=_0x4933d6['remoteUri'];var _0x41ab6f=_0x381499[_0x30f7('0x51')](-0x1);if(_0x41ab6f==='/'){_0x381499=_0x381499[_0x30f7('0x52')](0x0,_0x381499['lastIndexOf'](_0x41ab6f));}return rp({'method':_0x30f7('0x53'),'uri':util[_0x30f7('0x54')](_0x30f7('0x55'),_0x381499,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x30f7('0x54')](_0x30f7('0x56'),new Buffer(util['format']('%s:X',_0x4933d6[_0x30f7('0x50')]))[_0x30f7('0x57')](_0x30f7('0x58')))},'json':!![]});}})[_0x30f7('0x21')](function(_0x521657){if(_0x521657){var _0x3a52d5=['requester',_0x30f7('0x59'),_0x30f7('0x5a'),_0x30f7('0x5b'),'status',_0x30f7('0x5c'),_0x30f7('0x5d'),'source',_0x30f7('0x5e'),'group','company'];_[_0x30f7('0x5f')](_0x521657,function(_0x65c52e){return _0x3a52d5[_0x30f7('0x60')](_0x65c52e[_0x30f7('0x24')])||!_0x65c52e['default']&&_0x65c52e['type']!=='custom_text'&&_0x65c52e[_0x30f7('0x29')]!==_0x30f7('0x61');});return{'count':_0x521657[_0x30f7('0x30')],'rows':_[_0x30f7('0x26')](_0x521657,function(_0x503578){return{'id':_0x503578[_0x30f7('0x24')],'name':_0x503578[_0x30f7('0x62')],'custom':!_0x503578['default'],'options':_0x503578[_0x30f7('0x63')]?_['map'](_0x503578['choices'],function(_0xb9a70f){return{'name':_[_0x30f7('0x64')](_0xb9a70f),'value':_0xb9a70f};}):[]};})};}})[_0x30f7('0x21')](respondWithResult(_0x1bd8dd,null))[_0x30f7('0x3e')](function(_0x3b9706){var _0x5cf0f6=_0x49d879['query'][_0x30f7('0x65')]?0x1f4:_0x3b9706['statusCode']||0x1f4;logger[_0x30f7('0x23')](_0x30f7('0x66'),'getFields',_0x5cf0f6,JSON[_0x30f7('0x67')](_0x3b9706));delete _0x3b9706['name'];if(_0x5cf0f6===0x191){_0x5cf0f6=0x190;}_0x1bd8dd[_0x30f7('0x17')](_0x5cf0f6)[_0x30f7('0x25')](_0x49d879[_0x30f7('0x2b')][_0x30f7('0x65')]?{'message':'Wrong\x20credentials','statusCode':_0x3b9706[_0x30f7('0x68')]}:_0x3b9706);});}; \ No newline at end of file +var _0xd49c=['api/v2/ticket_fields','Basic\x20%s','%s:X','toString','priority','source','ticket_type','group','company','remove','default','custom_text','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','offset','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','destroy','getConfigurations','order','findOne','AccountId','Subjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format'];(function(_0xdd3c7,_0x3953fb){var _0x5a2793=function(_0x52cc59){while(--_0x52cc59){_0xdd3c7['push'](_0xdd3c7['shift']());}};_0x5a2793(++_0x3953fb);}(_0xd49c,0x1d8));var _0xcd49=function(_0x1ed133,_0x6664f){_0x1ed133=_0x1ed133-0x0;var _0x5af4d1=_0xd49c[_0x1ed133];return _0x5af4d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd49('0x1'));var rp=require(_0xcd49('0x2'));var moment=require('moment');var BPromise=require(_0xcd49('0x3'));var Mustache=require('mustache');var util=require(_0xcd49('0x4'));var path=require('path');var sox=require(_0xcd49('0x5'));var csv=require(_0xcd49('0x6'));var ejs=require(_0xcd49('0x7'));var fs=require('fs');var fs_extra=require(_0xcd49('0x8'));var _=require(_0xcd49('0x9'));var squel=require(_0xcd49('0xa'));var crypto=require(_0xcd49('0xb'));var jsforce=require(_0xcd49('0xc'));var deskjs=require(_0xcd49('0xd'));var toCsv=require(_0xcd49('0x6'));var querystring=require(_0xcd49('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd49('0xf'));var authService=require(_0xcd49('0x10'));var qs=require(_0xcd49('0x11'));var as=require(_0xcd49('0x12'));var hardwareService=require(_0xcd49('0x13'));var logger=require(_0xcd49('0x14'))(_0xcd49('0x15'));var utils=require(_0xcd49('0x16'));var config=require(_0xcd49('0x17'));var licenseUtil=require(_0xcd49('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b8c8d,_0x2e817d){_0x2e817d=_0x2e817d||0xcc;return function(_0xfda206){if(_0xfda206){return _0x5b8c8d['sendStatus'](_0x2e817d);}return _0x5b8c8d[_0xcd49('0x19')](_0x2e817d)[_0xcd49('0x1a')]();};}function respondWithResult(_0x5c7d8c,_0x26f20){_0x26f20=_0x26f20||0xc8;return function(_0x227c38){if(_0x227c38){return _0x5c7d8c[_0xcd49('0x19')](_0x26f20)[_0xcd49('0x1b')](_0x227c38);}};}function respondWithFilteredResult(_0x1e2275,_0x328755){return function(_0x5a0c6e){if(_0x5a0c6e){var _0x4b090e=typeof _0x328755['offset']==='undefined'&&typeof _0x328755[_0xcd49('0x1c')]===_0xcd49('0x1d');var _0x43b97d=_0x5a0c6e['count'];var _0x3074a4=_0x4b090e?0x0:_0x328755[_0xcd49('0x1e')];var _0x9c7262=_0x4b090e?_0x5a0c6e['count']:_0x328755[_0xcd49('0x1e')]+_0x328755[_0xcd49('0x1c')];var _0x322add;if(_0x9c7262>=_0x43b97d){_0x9c7262=_0x43b97d;_0x322add=0xc8;}else{_0x322add=0xce;}_0x1e2275[_0xcd49('0x19')](_0x322add);return _0x1e2275[_0xcd49('0x1f')](_0xcd49('0x20'),_0x3074a4+'-'+_0x9c7262+'/'+_0x43b97d)[_0xcd49('0x1b')](_0x5a0c6e);}return null;};}function patchUpdates(_0x9475c1){return function(_0x383235){try{jsonpatch['apply'](_0x383235,_0x9475c1,!![]);}catch(_0x243f1a){return BPromise[_0xcd49('0x21')](_0x243f1a);}return _0x383235[_0xcd49('0x22')]();};}function saveUpdates(_0x5829d1,_0x4fdab7){return function(_0x5e4835){if(_0x5e4835){return _0x5e4835[_0xcd49('0x23')](_0x5829d1)[_0xcd49('0x24')](function(_0x57bc92){return _0x57bc92;});}return null;};}function removeEntity(_0x1f649c,_0x400669){return function(_0x978310){if(_0x978310){return _0x978310['destroy']()[_0xcd49('0x24')](function(){_0x1f649c[_0xcd49('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d05a,_0x22c0ed){return function(_0x58afd6){if(!_0x58afd6){_0x38d05a[_0xcd49('0x25')](0x194);}return _0x58afd6;};}function handleError(_0xc3897c,_0x77a7eb){_0x77a7eb=_0x77a7eb||0x1f4;return function(_0x42bdfd){logger[_0xcd49('0x26')](_0x42bdfd[_0xcd49('0x27')]);if(_0x42bdfd[_0xcd49('0x28')]){delete _0x42bdfd[_0xcd49('0x28')];}_0xc3897c[_0xcd49('0x19')](_0x77a7eb)[_0xcd49('0x29')](_0x42bdfd);};}exports[_0xcd49('0x2a')]=function(_0x5cb1c8,_0x3be5e6){var _0x567557={},_0x43a448={},_0x468029={'count':0x0,'rows':[]};var _0x5a43cb=_[_0xcd49('0x2b')](db[_0xcd49('0x2c')]['rawAttributes'],function(_0x339dc0){return{'name':_0x339dc0[_0xcd49('0x2d')],'type':_0x339dc0[_0xcd49('0x2e')][_0xcd49('0x2f')]};});_0x43a448[_0xcd49('0x30')]=_[_0xcd49('0x2b')](_0x5a43cb,'name');_0x43a448['query']=_[_0xcd49('0x31')](_0x5cb1c8[_0xcd49('0x32')]);_0x43a448[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x43a448[_0xcd49('0x30')],_0x43a448[_0xcd49('0x32')]);_0x567557[_0xcd49('0x35')]=_[_0xcd49('0x34')](_0x43a448[_0xcd49('0x30')],qs[_0xcd49('0x36')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x36')]));_0x567557[_0xcd49('0x35')]=_0x567557['attributes'][_0xcd49('0x37')]?_0x567557[_0xcd49('0x35')]:_0x43a448['model'];if(!_0x5cb1c8['query'][_0xcd49('0x38')](_0xcd49('0x39'))){_0x567557['limit']=qs[_0xcd49('0x1c')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x1c')]);_0x567557[_0xcd49('0x1e')]=qs[_0xcd49('0x1e')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x1e')]);}_0x567557['order']=qs[_0xcd49('0x3a')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3a')]);_0x567557[_0xcd49('0x3b')]=qs[_0xcd49('0x33')](_[_0xcd49('0x3c')](_0x5cb1c8['query'],_0x43a448[_0xcd49('0x33')]),_0x5a43cb);if(_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3d')]){_0x567557['where']=_[_0xcd49('0x3e')](_0x567557[_0xcd49('0x3b')],{'$or':_[_0xcd49('0x2b')](_0x5a43cb,function(_0x265fa4){if(_0x265fa4[_0xcd49('0x2e')]!==_0xcd49('0x3f')){var _0x463e2b={};_0x463e2b[_0x265fa4[_0xcd49('0x28')]]={'$like':'%'+_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3d')]+'%'};return _0x463e2b;}})});}_0x567557=_['merge']({},_0x567557,_0x5cb1c8['options']);var _0x2e3d84={'where':_0x567557[_0xcd49('0x3b')]};return db[_0xcd49('0x2c')][_0xcd49('0x40')](_0x2e3d84)[_0xcd49('0x24')](function(_0x5124b6){_0x468029[_0xcd49('0x40')]=_0x5124b6;if(_0x5cb1c8[_0xcd49('0x32')]['includeAll']){_0x567557[_0xcd49('0x41')]=[{'all':!![]}];}return db[_0xcd49('0x2c')][_0xcd49('0x42')](_0x567557);})[_0xcd49('0x24')](function(_0x452a89){_0x468029[_0xcd49('0x43')]=_0x452a89;return _0x468029;})[_0xcd49('0x24')](respondWithFilteredResult(_0x3be5e6,_0x567557))['catch'](handleError(_0x3be5e6,null));};exports[_0xcd49('0x44')]=function(_0x4f3dd7,_0x470e4d){var _0x1a8685={'raw':![],'where':{'id':_0x4f3dd7[_0xcd49('0x45')]['id']}},_0x54631f={};_0x54631f[_0xcd49('0x30')]=_['keys'](db[_0xcd49('0x2c')]['rawAttributes']);_0x54631f[_0xcd49('0x32')]=_[_0xcd49('0x31')](_0x4f3dd7[_0xcd49('0x32')]);_0x54631f['filters']=_[_0xcd49('0x34')](_0x54631f['model'],_0x54631f['query']);_0x1a8685[_0xcd49('0x35')]=_[_0xcd49('0x34')](_0x54631f['model'],qs[_0xcd49('0x36')](_0x4f3dd7[_0xcd49('0x32')][_0xcd49('0x36')]));_0x1a8685[_0xcd49('0x35')]=_0x1a8685[_0xcd49('0x35')]['length']?_0x1a8685[_0xcd49('0x35')]:_0x54631f[_0xcd49('0x30')];if(_0x4f3dd7[_0xcd49('0x32')][_0xcd49('0x46')]){_0x1a8685['include']=[{'all':!![]}];}_0x1a8685=_[_0xcd49('0x3e')]({},_0x1a8685,_0x4f3dd7[_0xcd49('0x47')]);return db[_0xcd49('0x2c')][_0xcd49('0x48')](_0x1a8685)[_0xcd49('0x24')](handleEntityNotFound(_0x470e4d,null))[_0xcd49('0x24')](respondWithResult(_0x470e4d,null))[_0xcd49('0x49')](handleError(_0x470e4d,null));};exports[_0xcd49('0x4a')]=function(_0x38676b,_0x5b11cc){return db[_0xcd49('0x2c')]['create'](_0x38676b[_0xcd49('0x4b')],{})[_0xcd49('0x24')](respondWithResult(_0x5b11cc,0xc9))[_0xcd49('0x49')](handleError(_0x5b11cc,null));};exports[_0xcd49('0x23')]=function(_0x268cc1,_0x5cc9c5){if(_0x268cc1['body']['id']){delete _0x268cc1['body']['id'];}return db[_0xcd49('0x2c')][_0xcd49('0x48')]({'where':{'id':_0x268cc1['params']['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x5cc9c5,null))[_0xcd49('0x24')](saveUpdates(_0x268cc1[_0xcd49('0x4b')],null))['then'](respondWithResult(_0x5cc9c5,null))['catch'](handleError(_0x5cc9c5,null));};exports[_0xcd49('0x4c')]=function(_0x5b47d3,_0x440990){return db[_0xcd49('0x2c')][_0xcd49('0x48')]({'where':{'id':_0x5b47d3[_0xcd49('0x45')]['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x440990,null))['then'](removeEntity(_0x440990,null))[_0xcd49('0x49')](handleError(_0x440990,null));};exports[_0xcd49('0x4d')]=function(_0x4cbb15,_0xe4e023,_0x518428){var _0x2def45={};var _0x183f37={};var _0x5822df;var _0x1c95d1;return db[_0xcd49('0x2c')]['findOne']({'where':{'id':_0x4cbb15[_0xcd49('0x45')]['id']}})['then'](handleEntityNotFound(_0xe4e023,null))[_0xcd49('0x24')](function(_0xe6231a){if(_0xe6231a){_0x5822df=_0xe6231a;_0x183f37[_0xcd49('0x30')]=_[_0xcd49('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0x183f37[_0xcd49('0x32')]=_[_0xcd49('0x31')](_0x4cbb15[_0xcd49('0x32')]);_0x183f37[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x183f37['model'],_0x183f37[_0xcd49('0x32')]);_0x2def45['attributes']=_[_0xcd49('0x34')](_0x183f37[_0xcd49('0x30')],qs[_0xcd49('0x36')](_0x4cbb15['query'][_0xcd49('0x36')]));_0x2def45['attributes']=_0x2def45[_0xcd49('0x35')]['length']?_0x2def45['attributes']:_0x183f37[_0xcd49('0x30')];_0x2def45[_0xcd49('0x4e')]=qs[_0xcd49('0x3a')](_0x4cbb15['query'][_0xcd49('0x3a')]);_0x2def45[_0xcd49('0x3b')]=qs['filters'](_['pick'](_0x4cbb15[_0xcd49('0x32')],_0x183f37[_0xcd49('0x33')]));if(_0x4cbb15[_0xcd49('0x32')][_0xcd49('0x3d')]){_0x2def45['where']=_[_0xcd49('0x3e')](_0x2def45[_0xcd49('0x3b')],{'$or':_['map'](_0x2def45[_0xcd49('0x35')],function(_0x13d5d6){var _0x3a5ac0={};_0x3a5ac0[_0x13d5d6]={'$like':'%'+_0x4cbb15[_0xcd49('0x32')][_0xcd49('0x3d')]+'%'};return _0x3a5ac0;})});}_0x2def45=_['merge']({},_0x2def45,_0x4cbb15[_0xcd49('0x47')]);return _0x5822df[_0xcd49('0x4d')](_0x2def45);}})[_0xcd49('0x24')](function(_0x21cc84){if(_0x21cc84){_0x1c95d1=_0x21cc84[_0xcd49('0x37')];if(!_0x4cbb15[_0xcd49('0x32')]['hasOwnProperty'](_0xcd49('0x39'))){_0x2def45[_0xcd49('0x1c')]=qs['limit'](_0x4cbb15[_0xcd49('0x32')]['limit']);_0x2def45[_0xcd49('0x1e')]=qs[_0xcd49('0x1e')](_0x4cbb15[_0xcd49('0x32')]['offset']);}return _0x5822df[_0xcd49('0x4d')](_0x2def45);}})[_0xcd49('0x24')](function(_0x5002eb){if(_0x5002eb){return _0x5002eb?{'count':_0x1c95d1,'rows':_0x5002eb}:null;}})[_0xcd49('0x24')](respondWithResult(_0xe4e023,null))['catch'](handleError(_0xe4e023,null));};exports['addConfiguration']=function(_0x171e47,_0x2a22ce,_0x4f3d07){if(_0x171e47[_0xcd49('0x4b')]['id']){delete _0x171e47[_0xcd49('0x4b')]['id'];}return db[_0xcd49('0x2c')][_0xcd49('0x4f')]({'where':{'id':_0x171e47['params']['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x2a22ce,null))[_0xcd49('0x24')](function(_0x2c9584){if(_0x2c9584){_0x171e47['body'][_0xcd49('0x50')]=_0x2c9584['id'];_0x171e47['body'][_0xcd49('0x51')]=integrations['getSubjects'](_0x171e47[_0xcd49('0x4b')]['channel'],_0x171e47[_0xcd49('0x4b')][_0xcd49('0x2e')]);_0x171e47[_0xcd49('0x4b')][_0xcd49('0x52')]=integrations[_0xcd49('0x53')](_0x171e47['body']['channel'],_0x171e47[_0xcd49('0x4b')][_0xcd49('0x2e')]);return db['FreshdeskConfiguration'][_0xcd49('0x4a')](_0x171e47[_0xcd49('0x4b')],{'include':[{'model':db['FreshdeskField'],'as':_0xcd49('0x51')},{'model':db[_0xcd49('0x54')],'as':_0xcd49('0x52')}]});}return null;})['then'](respondWithResult(_0x2a22ce,null))[_0xcd49('0x49')](handleError(_0x2a22ce,null));};exports[_0xcd49('0x55')]=function(_0xad1b0e,_0x5efe18,_0x3626a4){var _0x222da2='';return db[_0xcd49('0x2c')][_0xcd49('0x4f')]({'where':{'id':_0xad1b0e[_0xcd49('0x45')]['id']},'attributes':['id',_0xcd49('0x56'),_0xcd49('0x57')]})[_0xcd49('0x24')](handleEntityNotFound(_0x5efe18,null))[_0xcd49('0x24')](function(_0x4cc4cb){if(_0x4cc4cb){_0x222da2=_0x4cc4cb[_0xcd49('0x56')];var _0x82257b=_0x222da2[_0xcd49('0x58')](-0x1);if(_0x82257b==='/'){_0x222da2=_0x222da2[_0xcd49('0x59')](0x0,_0x222da2[_0xcd49('0x5a')](_0x82257b));}return rp({'method':_0xcd49('0x5b'),'uri':util[_0xcd49('0x5c')]('%s/%s',_0x222da2,_0xcd49('0x5d')),'headers':{'Authorization':util[_0xcd49('0x5c')](_0xcd49('0x5e'),new Buffer(util['format'](_0xcd49('0x5f'),_0x4cc4cb[_0xcd49('0x57')]))[_0xcd49('0x60')]('base64'))},'json':!![]});}})[_0xcd49('0x24')](function(_0x403cab){if(_0x403cab){var _0x209e23=['requester','subject','agent','description',_0xcd49('0x19'),_0xcd49('0x61'),'group',_0xcd49('0x62'),_0xcd49('0x63'),_0xcd49('0x64'),_0xcd49('0x65')];_[_0xcd49('0x66')](_0x403cab,function(_0x3b4f32){return _0x209e23['includes'](_0x3b4f32[_0xcd49('0x28')])||!_0x3b4f32[_0xcd49('0x67')]&&_0x3b4f32[_0xcd49('0x2e')]!==_0xcd49('0x68')&&_0x3b4f32[_0xcd49('0x2e')]!==_0xcd49('0x69');});return{'count':_0x403cab[_0xcd49('0x37')],'rows':_[_0xcd49('0x2b')](_0x403cab,function(_0x3b69f7){return{'id':_0x3b69f7[_0xcd49('0x28')],'name':_0x3b69f7[_0xcd49('0x6a')],'custom':!_0x3b69f7[_0xcd49('0x67')],'options':_0x3b69f7[_0xcd49('0x6b')]?_[_0xcd49('0x2b')](_0x3b69f7[_0xcd49('0x6b')],function(_0x4f3092){return{'name':_['capitalize'](_0x4f3092),'value':_0x4f3092};}):[]};})};}})[_0xcd49('0x24')](respondWithResult(_0x5efe18,null))[_0xcd49('0x49')](function(_0x37f450){var _0x36c8a4=_0xad1b0e['query'][_0xcd49('0x6c')]?0x1f4:_0x37f450['statusCode']||0x1f4;logger[_0xcd49('0x26')](_0xcd49('0x6d'),'getFields',_0x36c8a4,JSON[_0xcd49('0x6e')](_0x37f450));delete _0x37f450['name'];if(_0x36c8a4===0x191){_0x36c8a4=0x190;}_0x5efe18[_0xcd49('0x19')](_0x36c8a4)['send'](_0xad1b0e['query'][_0xcd49('0x6c')]?{'message':_0xcd49('0x6f'),'statusCode':_0x37f450[_0xcd49('0x70')]}:_0x37f450);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ff7e792..675d76d 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 _0x1dcf=['int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount'];(function(_0x36e9a8,_0x3b48e7){var _0x5a85a7=function(_0x35ba12){while(--_0x35ba12){_0x36e9a8['push'](_0x36e9a8['shift']());}};_0x5a85a7(++_0x3b48e7);}(_0x1dcf,0x83));var _0xf1dc=function(_0x547a87,_0x4d4e24){_0x547a87=_0x547a87-0x0;var _0x11fde1=_0x1dcf[_0x547a87];return _0x11fde1;};'use strict';var _=require(_0xf1dc('0x0'));var util=require('util');var logger=require(_0xf1dc('0x1'))(_0xf1dc('0x2'));var moment=require(_0xf1dc('0x3'));var BPromise=require(_0xf1dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1dc('0x5'));var rimraf=require(_0xf1dc('0x6'));var config=require(_0xf1dc('0x7'));var attributes=require(_0xf1dc('0x8'));var integrations=require(_0xf1dc('0x9'));module['exports']=function(_0x5db781,_0x30f6d0){return _0x5db781[_0xf1dc('0xa')](_0xf1dc('0xb'),attributes,{'tableName':_0xf1dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c59=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c59,0x1a4));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x92c5('0x0'));var logger=require(_0x92c5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x92c5('0x2'));var rp=require(_0x92c5('0x3'));var fs=require('fs');var path=require(_0x92c5('0x4'));var rimraf=require(_0x92c5('0x5'));var config=require(_0x92c5('0x6'));var attributes=require(_0x92c5('0x7'));var integrations=require(_0x92c5('0x8'));module[_0x92c5('0x9')]=function(_0x8fd8c,_0x209509){return _0x8fd8c[_0x92c5('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x92c5('0xb'),'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 d9480e6..8759139 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 _0xe8cf=['result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','FreshdeskAccount','ShowFreshdeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3bee3d,_0x55d61d){var _0x2c4287=function(_0x47cb08){while(--_0x47cb08){_0x3bee3d['push'](_0x3bee3d['shift']());}};_0x2c4287(++_0x55d61d);}(_0xe8cf,0x16e));var _0xfe8c=function(_0x4670df,_0x433288){_0x4670df=_0x4670df-0x0;var _0x326082=_0xe8cf[_0x4670df];return _0x326082;};'use strict';var _=require('lodash');var util=require(_0xfe8c('0x0'));var moment=require(_0xfe8c('0x1'));var BPromise=require(_0xfe8c('0x2'));var rs=require(_0xfe8c('0x3'));var fs=require('fs');var Redis=require(_0xfe8c('0x4'));var db=require(_0xfe8c('0x5'))['db'];var utils=require(_0xfe8c('0x6'));var logger=require(_0xfe8c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe8c('0x8'));var client=jayson['client'][_0xfe8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f726,_0x37fd04,_0x4c490e){return new BPromise(function(_0x5c9007,_0x135035){return client[_0xfe8c('0xa')](_0x26f726,_0x4c490e)['then'](function(_0x598691){logger[_0xfe8c('0xb')](_0xfe8c('0xc'),_0x37fd04,'request\x20sent');logger['debug'](_0xfe8c('0xd'),_0x37fd04,_0xfe8c('0xe'),JSON[_0xfe8c('0xf')](_0x598691));if(_0x598691[_0xfe8c('0x10')]){if(_0x598691['error'][_0xfe8c('0x11')]===0x1f4){logger[_0xfe8c('0x10')](_0xfe8c('0xc'),_0x37fd04,_0x598691[_0xfe8c('0x10')][_0xfe8c('0x12')]);return _0x135035(_0x598691['error'][_0xfe8c('0x12')]);}logger[_0xfe8c('0x10')](_0xfe8c('0xc'),_0x37fd04,_0x598691[_0xfe8c('0x10')][_0xfe8c('0x12')]);return _0x5c9007(_0x598691[_0xfe8c('0x10')][_0xfe8c('0x12')]);}else{logger[_0xfe8c('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x37fd04,_0xfe8c('0xe'));_0x5c9007(_0x598691[_0xfe8c('0x13')]['message']);}})[_0xfe8c('0x14')](function(_0x169952){logger[_0xfe8c('0x10')](_0xfe8c('0xc'),_0x37fd04,_0x169952);_0x135035(_0x169952);});});}exports[_0xfe8c('0x15')]=function(_0x45dea0){var _0x483cc5=this;return new Promise(function(_0xae3043,_0x35d0ed){return db['FreshdeskAccount'][_0xfe8c('0x16')]({'raw':_0x45dea0[_0xfe8c('0x17')]?_0x45dea0[_0xfe8c('0x17')][_0xfe8c('0x18')]===undefined?!![]:![]:!![],'where':_0x45dea0[_0xfe8c('0x17')]?_0x45dea0[_0xfe8c('0x17')][_0xfe8c('0x19')]||null:null,'attributes':_0x45dea0[_0xfe8c('0x17')]?_0x45dea0[_0xfe8c('0x17')][_0xfe8c('0x1a')]||null:null,'limit':_0x45dea0[_0xfe8c('0x17')]?_0x45dea0[_0xfe8c('0x17')][_0xfe8c('0x1b')]||null:null,'include':_0x45dea0[_0xfe8c('0x17')]?_0x45dea0['options'][_0xfe8c('0x1c')]?_[_0xfe8c('0x1d')](_0x45dea0['options']['include'],function(_0x27987e){return{'model':db[_0x27987e['model']],'as':_0x27987e['as'],'attributes':_0x27987e[_0xfe8c('0x1a')],'include':_0x27987e[_0xfe8c('0x1c')]?_[_0xfe8c('0x1d')](_0x27987e['include'],function(_0x1e35fe){return{'model':db[_0x1e35fe[_0xfe8c('0x1e')]],'as':_0x1e35fe['as'],'attributes':_0x1e35fe['attributes'],'include':_0x1e35fe[_0xfe8c('0x1c')]?_['map'](_0x1e35fe['include'],function(_0x25d898){return{'model':db[_0x25d898[_0xfe8c('0x1e')]],'as':_0x25d898['as'],'attributes':_0x25d898[_0xfe8c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfe8c('0x1f')](function(_0x2bf732){logger[_0xfe8c('0xb')](_0xfe8c('0x15'),_0x45dea0);logger[_0xfe8c('0x20')](_0xfe8c('0x15'),_0x45dea0,JSON[_0xfe8c('0xf')](_0x2bf732));_0xae3043(_0x2bf732);})['catch'](function(_0x118032){logger[_0xfe8c('0x10')]('GetFreshdeskAccount',_0x118032['message'],_0x45dea0);_0x35d0ed(_0x483cc5['error'](0x1f4,_0x118032[_0xfe8c('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0xd588c8){var _0x27b7cb=this;return new Promise(function(_0x3575dd,_0xdd9c9a){return db[_0xfe8c('0x21')]['find']({'raw':_0xd588c8[_0xfe8c('0x17')]?_0xd588c8['options']['raw']===undefined?!![]:![]:!![],'where':_0xd588c8[_0xfe8c('0x17')]?_0xd588c8[_0xfe8c('0x17')][_0xfe8c('0x19')]||null:null,'attributes':_0xd588c8[_0xfe8c('0x17')]?_0xd588c8[_0xfe8c('0x17')]['attributes']||null:null,'include':_0xd588c8['options']?_0xd588c8[_0xfe8c('0x17')][_0xfe8c('0x1c')]?_[_0xfe8c('0x1d')](_0xd588c8[_0xfe8c('0x17')][_0xfe8c('0x1c')],function(_0x440f19){return{'model':db[_0x440f19['model']],'as':_0x440f19['as'],'attributes':_0x440f19['attributes'],'include':_0x440f19[_0xfe8c('0x1c')]?_[_0xfe8c('0x1d')](_0x440f19[_0xfe8c('0x1c')],function(_0x4936b3){return{'model':db[_0x4936b3['model']],'as':_0x4936b3['as'],'attributes':_0x4936b3[_0xfe8c('0x1a')],'include':_0x4936b3[_0xfe8c('0x1c')]?_[_0xfe8c('0x1d')](_0x4936b3[_0xfe8c('0x1c')],function(_0x2a4b8c){return{'model':db[_0x2a4b8c['model']],'as':_0x2a4b8c['as'],'attributes':_0x2a4b8c['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe8c('0x1f')](function(_0x53b346){logger[_0xfe8c('0xb')](_0xfe8c('0x22'),_0xd588c8);logger[_0xfe8c('0x20')](_0xfe8c('0x22'),_0xd588c8,JSON[_0xfe8c('0xf')](_0x53b346));_0x3575dd(_0x53b346);})['catch'](function(_0x5736b7){logger[_0xfe8c('0x10')]('ShowFreshdeskAccount',_0x5736b7[_0xfe8c('0x12')],_0xd588c8);_0xdd9c9a(_0x27b7cb[_0xfe8c('0x10')](0x1f4,_0x5736b7[_0xfe8c('0x12')]));});});}; \ No newline at end of file +var _0x2971=['FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x2971,0x175));var _0x1297=function(_0x5b1738,_0xefdcd4){_0x5b1738=_0x5b1738-0x0;var _0x2601ef=_0x2971[_0x5b1738];return _0x2601ef;};'use strict';var _=require(_0x1297('0x0'));var util=require(_0x1297('0x1'));var moment=require(_0x1297('0x2'));var BPromise=require(_0x1297('0x3'));var rs=require(_0x1297('0x4'));var fs=require('fs');var Redis=require(_0x1297('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1297('0x6'))('rpc');var config=require(_0x1297('0x7'));var jayson=require(_0x1297('0x8'));var client=jayson[_0x1297('0x9')][_0x1297('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25d4b1,_0x332d3b,_0x2c40b0){return new BPromise(function(_0x1fd5da,_0x1cb104){return client[_0x1297('0xb')](_0x25d4b1,_0x2c40b0)[_0x1297('0xc')](function(_0x31f574){logger[_0x1297('0xd')](_0x1297('0xe'),_0x332d3b,_0x1297('0xf'));logger[_0x1297('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x332d3b,_0x1297('0xf'),JSON[_0x1297('0x11')](_0x31f574));if(_0x31f574['error']){if(_0x31f574[_0x1297('0x12')][_0x1297('0x13')]===0x1f4){logger['error'](_0x1297('0xe'),_0x332d3b,_0x31f574[_0x1297('0x12')]['message']);return _0x1cb104(_0x31f574[_0x1297('0x12')][_0x1297('0x14')]);}logger[_0x1297('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x332d3b,_0x31f574['error'][_0x1297('0x14')]);return _0x1fd5da(_0x31f574[_0x1297('0x12')][_0x1297('0x14')]);}else{logger[_0x1297('0xd')](_0x1297('0xe'),_0x332d3b,_0x1297('0xf'));_0x1fd5da(_0x31f574[_0x1297('0x15')]['message']);}})[_0x1297('0x16')](function(_0xc36f6a){logger[_0x1297('0x12')](_0x1297('0xe'),_0x332d3b,_0xc36f6a);_0x1cb104(_0xc36f6a);});});}exports['GetFreshdeskAccount']=function(_0xb87264){var _0x268c4e=this;return new Promise(function(_0x3bc263,_0x13776e){return db[_0x1297('0x17')][_0x1297('0x18')]({'raw':_0xb87264[_0x1297('0x19')]?_0xb87264[_0x1297('0x19')][_0x1297('0x1a')]===undefined?!![]:![]:!![],'where':_0xb87264['options']?_0xb87264[_0x1297('0x19')][_0x1297('0x1b')]||null:null,'attributes':_0xb87264[_0x1297('0x19')]?_0xb87264[_0x1297('0x19')][_0x1297('0x1c')]||null:null,'limit':_0xb87264[_0x1297('0x19')]?_0xb87264['options'][_0x1297('0x1d')]||null:null,'include':_0xb87264[_0x1297('0x19')]?_0xb87264[_0x1297('0x19')][_0x1297('0x1e')]?_[_0x1297('0x1f')](_0xb87264[_0x1297('0x19')][_0x1297('0x1e')],function(_0xd0beca){return{'model':db[_0xd0beca[_0x1297('0x20')]],'as':_0xd0beca['as'],'attributes':_0xd0beca[_0x1297('0x1c')],'include':_0xd0beca[_0x1297('0x1e')]?_[_0x1297('0x1f')](_0xd0beca[_0x1297('0x1e')],function(_0x418cce){return{'model':db[_0x418cce[_0x1297('0x20')]],'as':_0x418cce['as'],'attributes':_0x418cce['attributes'],'include':_0x418cce[_0x1297('0x1e')]?_['map'](_0x418cce[_0x1297('0x1e')],function(_0x5c38f5){return{'model':db[_0x5c38f5[_0x1297('0x20')]],'as':_0x5c38f5['as'],'attributes':_0x5c38f5[_0x1297('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21640c){logger[_0x1297('0xd')](_0x1297('0x21'),_0xb87264);logger[_0x1297('0x10')](_0x1297('0x21'),_0xb87264,JSON[_0x1297('0x11')](_0x21640c));_0x3bc263(_0x21640c);})[_0x1297('0x16')](function(_0x7524fc){logger[_0x1297('0x12')](_0x1297('0x21'),_0x7524fc['message'],_0xb87264);_0x13776e(_0x268c4e[_0x1297('0x12')](0x1f4,_0x7524fc['message']));});});};exports['ShowFreshdeskAccount']=function(_0xe07048){var _0x58159b=this;return new Promise(function(_0x13b3ac,_0xaae686){return db[_0x1297('0x17')][_0x1297('0x22')]({'raw':_0xe07048['options']?_0xe07048[_0x1297('0x19')][_0x1297('0x1a')]===undefined?!![]:![]:!![],'where':_0xe07048[_0x1297('0x19')]?_0xe07048['options']['where']||null:null,'attributes':_0xe07048['options']?_0xe07048[_0x1297('0x19')][_0x1297('0x1c')]||null:null,'include':_0xe07048[_0x1297('0x19')]?_0xe07048[_0x1297('0x19')][_0x1297('0x1e')]?_['map'](_0xe07048['options'][_0x1297('0x1e')],function(_0x10d406){return{'model':db[_0x10d406[_0x1297('0x20')]],'as':_0x10d406['as'],'attributes':_0x10d406['attributes'],'include':_0x10d406[_0x1297('0x1e')]?_[_0x1297('0x1f')](_0x10d406['include'],function(_0x45f332){return{'model':db[_0x45f332[_0x1297('0x20')]],'as':_0x45f332['as'],'attributes':_0x45f332[_0x1297('0x1c')],'include':_0x45f332[_0x1297('0x1e')]?_[_0x1297('0x1f')](_0x45f332[_0x1297('0x1e')],function(_0x42b592){return{'model':db[_0x42b592[_0x1297('0x20')]],'as':_0x42b592['as'],'attributes':_0x42b592[_0x1297('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1297('0xc')](function(_0x26ac87){logger[_0x1297('0xd')](_0x1297('0x23'),_0xe07048);logger[_0x1297('0x10')](_0x1297('0x23'),_0xe07048,JSON[_0x1297('0x11')](_0x26ac87));_0x13b3ac(_0x26ac87);})['catch'](function(_0xaf21b8){logger[_0x1297('0x12')](_0x1297('0x23'),_0xaf21b8[_0x1297('0x14')],_0xe07048);_0xaae686(_0x58159b['error'](0x1f4,_0xaf21b8['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4b8ee29..1af6911 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 _0xe429=['/:id/tags','getTags','post','create','setTags','put','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0xe429,0x1ec));var _0x9e42=function(_0x3a0abf,_0x395ab0){_0x3a0abf=_0x3a0abf-0x0;var _0x294b54=_0xe429[_0x3a0abf];return _0x294b54;};'use strict';var multer=require('multer');var util=require(_0x9e42('0x0'));var path=require(_0x9e42('0x1'));var timeout=require(_0x9e42('0x2'));var express=require('express');var router=express[_0x9e42('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9e42('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e42('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x9e42('0x6')]('/',auth[_0x9e42('0x7')](),controller[_0x9e42('0x8')]);router['get'](_0x9e42('0x9'),auth[_0x9e42('0x7')](),controller[_0x9e42('0xa')]);router[_0x9e42('0x6')](_0x9e42('0xb'),auth[_0x9e42('0x7')](),controller[_0x9e42('0xc')]);router[_0x9e42('0x6')](_0x9e42('0xd'),auth[_0x9e42('0x7')](),controller['getSubjects']);router[_0x9e42('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x9e42('0xe'),auth[_0x9e42('0x7')](),controller[_0x9e42('0xf')]);router[_0x9e42('0x10')]('/',auth['isAuthenticated'](),controller[_0x9e42('0x11')]);router['post'](_0x9e42('0xe'),auth[_0x9e42('0x7')](),controller[_0x9e42('0x12')]);router[_0x9e42('0x13')](_0x9e42('0x9'),auth[_0x9e42('0x7')](),controller['update']);router[_0x9e42('0x14')]('/:id',auth[_0x9e42('0x7')](),controller['destroy']);module[_0x9e42('0x15')]=router; \ No newline at end of file +var _0x3555=['getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects'];(function(_0x4beb67,_0x5c290a){var _0x3f5d70=function(_0x5d6486){while(--_0x5d6486){_0x4beb67['push'](_0x4beb67['shift']());}};_0x3f5d70(++_0x5c290a);}(_0x3555,0x1b1));var _0x5355=function(_0x40ccef,_0x3861e7){_0x40ccef=_0x40ccef-0x0;var _0x14a8dd=_0x3555[_0x40ccef];return _0x14a8dd;};'use strict';var multer=require(_0x5355('0x0'));var util=require(_0x5355('0x1'));var path=require(_0x5355('0x2'));var timeout=require(_0x5355('0x3'));var express=require(_0x5355('0x4'));var router=express[_0x5355('0x5')]();var fs_extra=require(_0x5355('0x6'));var auth=require(_0x5355('0x7'));var interaction=require(_0x5355('0x8'));var config=require(_0x5355('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x5355('0xa')]('/',auth[_0x5355('0xb')](),controller[_0x5355('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5355('0xd')]);router[_0x5355('0xa')](_0x5355('0xe'),auth[_0x5355('0xb')](),controller[_0x5355('0xf')]);router['get'](_0x5355('0x10'),auth['isAuthenticated'](),controller[_0x5355('0x11')]);router['get'](_0x5355('0x12'),auth[_0x5355('0xb')](),controller[_0x5355('0x13')]);router[_0x5355('0xa')](_0x5355('0x14'),auth[_0x5355('0xb')](),controller[_0x5355('0x15')]);router['post']('/',auth[_0x5355('0xb')](),controller[_0x5355('0x16')]);router[_0x5355('0x17')](_0x5355('0x14'),auth[_0x5355('0xb')](),controller[_0x5355('0x18')]);router[_0x5355('0x19')](_0x5355('0x1a'),auth[_0x5355('0xb')](),controller['update']);router[_0x5355('0x1b')](_0x5355('0x1a'),auth['isAuthenticated'](),controller[_0x5355('0x1c')]);module[_0x5355('0x1d')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7713d26..a9eab40 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 _0x83f1=['exports','STRING','sequelize'];(function(_0x245aae,_0x227cc5){var _0x1b3ad9=function(_0x32a99f){while(--_0x32a99f){_0x245aae['push'](_0x245aae['shift']());}};_0x1b3ad9(++_0x227cc5);}(_0x83f1,0x74));var _0x183f=function(_0x48c1cd,_0x1c95b9){_0x48c1cd=_0x48c1cd-0x0;var _0x3908dc=_0x83f1[_0x48c1cd];return _0x3908dc;};'use strict';var Sequelize=require(_0x183f('0x0'));module[_0x183f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x183f('0x2')]}}; \ No newline at end of file +var _0xc525=['sequelize','STRING'];(function(_0x1b7184,_0x4a69fd){var _0x46c069=function(_0x51b394){while(--_0x51b394){_0x1b7184['push'](_0x1b7184['shift']());}};_0x46c069(++_0x4a69fd);}(_0xc525,0x15a));var _0x5c52=function(_0x5648aa,_0x3c5a1a){_0x5648aa=_0x5648aa-0x0;var _0x5b24b1=_0xc525[_0x5648aa];return _0x5b24b1;};'use strict';var Sequelize=require(_0x5c52('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c52('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 06e2b7f..2153499 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 _0x03d1=['getSubjects','getDescriptions','getTags','rawAttributes','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','map','FreshdeskConfiguration','fieldName','type','key','model','query','keys','filters','attributes','fields','length','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','getFields','findOne','FreshdeskField','order','filter','hasOwnProperty','nolimit'];(function(_0x45a738,_0x10f0da){var _0xd8a4fd=function(_0x589903){while(--_0x589903){_0x45a738['push'](_0x45a738['shift']());}};_0xd8a4fd(++_0x10f0da);}(_0x03d1,0xa7));var _0x103d=function(_0x4fb0d6,_0x3f54fe){_0x4fb0d6=_0x4fb0d6-0x0;var _0x5c44ac=_0x03d1[_0x4fb0d6];return _0x5c44ac;};'use strict';var emlformat=require(_0x103d('0x0'));var rimraf=require(_0x103d('0x1'));var zipdir=require(_0x103d('0x2'));var jsonpatch=require(_0x103d('0x3'));var rp=require(_0x103d('0x4'));var moment=require('moment');var BPromise=require(_0x103d('0x5'));var Mustache=require(_0x103d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x103d('0x7'));var csv=require(_0x103d('0x8'));var ejs=require(_0x103d('0x9'));var fs=require('fs');var fs_extra=require(_0x103d('0xa'));var _=require(_0x103d('0xb'));var squel=require(_0x103d('0xc'));var crypto=require('crypto');var jsforce=require(_0x103d('0xd'));var deskjs=require(_0x103d('0xe'));var toCsv=require(_0x103d('0x8'));var querystring=require(_0x103d('0xf'));var Papa=require(_0x103d('0x10'));var Redis=require(_0x103d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x103d('0x12'));var as=require(_0x103d('0x13'));var hardwareService=require(_0x103d('0x14'));var logger=require('../../config/logger')(_0x103d('0x15'));var utils=require('../../config/utils');var config=require(_0x103d('0x16'));var licenseUtil=require(_0x103d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27cd49,_0x3caa5c){_0x3caa5c=_0x3caa5c||0xcc;return function(_0x12ea61){if(_0x12ea61){return _0x27cd49['sendStatus'](_0x3caa5c);}return _0x27cd49[_0x103d('0x18')](_0x3caa5c)[_0x103d('0x19')]();};}function respondWithResult(_0x38ca73,_0x136bfa){_0x136bfa=_0x136bfa||0xc8;return function(_0xa6109d){if(_0xa6109d){return _0x38ca73['status'](_0x136bfa)[_0x103d('0x1a')](_0xa6109d);}};}function respondWithFilteredResult(_0x44dac1,_0x3a316f){return function(_0x5c016c){if(_0x5c016c){var _0x324721=typeof _0x3a316f[_0x103d('0x1b')]==='undefined'&&typeof _0x3a316f[_0x103d('0x1c')]===_0x103d('0x1d');var _0xcafc78=_0x5c016c[_0x103d('0x1e')];var _0x483759=_0x324721?0x0:_0x3a316f[_0x103d('0x1b')];var _0x2b8700=_0x324721?_0x5c016c[_0x103d('0x1e')]:_0x3a316f[_0x103d('0x1b')]+_0x3a316f[_0x103d('0x1c')];var _0x4d361e;if(_0x2b8700>=_0xcafc78){_0x2b8700=_0xcafc78;_0x4d361e=0xc8;}else{_0x4d361e=0xce;}_0x44dac1[_0x103d('0x18')](_0x4d361e);return _0x44dac1[_0x103d('0x1f')](_0x103d('0x20'),_0x483759+'-'+_0x2b8700+'/'+_0xcafc78)[_0x103d('0x1a')](_0x5c016c);}return null;};}function patchUpdates(_0x289fe1){return function(_0x5c64c5){try{jsonpatch[_0x103d('0x21')](_0x5c64c5,_0x289fe1,!![]);}catch(_0x7730f1){return BPromise[_0x103d('0x22')](_0x7730f1);}return _0x5c64c5['save']();};}function saveUpdates(_0x322500,_0x76e171){return function(_0x25802d){if(_0x25802d){return _0x25802d[_0x103d('0x23')](_0x322500)[_0x103d('0x24')](function(_0x5c734a){return _0x5c734a;});}return null;};}function removeEntity(_0x5e6d17,_0x66b144){return function(_0x37b588){if(_0x37b588){return _0x37b588[_0x103d('0x25')]()[_0x103d('0x24')](function(){_0x5e6d17[_0x103d('0x18')](0xcc)[_0x103d('0x19')]();});}};}function handleEntityNotFound(_0x4826e3,_0x1b4014){return function(_0x23010c){if(!_0x23010c){_0x4826e3[_0x103d('0x26')](0x194);}return _0x23010c;};}function handleError(_0x2a112f,_0x1af3e8){_0x1af3e8=_0x1af3e8||0x1f4;return function(_0x546329){logger[_0x103d('0x27')](_0x546329['stack']);if(_0x546329[_0x103d('0x28')]){delete _0x546329[_0x103d('0x28')];}_0x2a112f[_0x103d('0x18')](_0x1af3e8)[_0x103d('0x29')](_0x546329);};}exports['index']=function(_0xc24ce2,_0x53a1e2){var _0x2b07fc={},_0x5e7c86={},_0x4435d4={'count':0x0,'rows':[]};var _0x53a615=_[_0x103d('0x2a')](db[_0x103d('0x2b')]['rawAttributes'],function(_0x14b224){return{'name':_0x14b224[_0x103d('0x2c')],'type':_0x14b224[_0x103d('0x2d')][_0x103d('0x2e')]};});_0x5e7c86[_0x103d('0x2f')]=_['map'](_0x53a615,_0x103d('0x28'));_0x5e7c86[_0x103d('0x30')]=_[_0x103d('0x31')](_0xc24ce2[_0x103d('0x30')]);_0x5e7c86[_0x103d('0x32')]=_['intersection'](_0x5e7c86[_0x103d('0x2f')],_0x5e7c86[_0x103d('0x30')]);_0x2b07fc[_0x103d('0x33')]=_['intersection'](_0x5e7c86['model'],qs[_0x103d('0x34')](_0xc24ce2[_0x103d('0x30')]['fields']));_0x2b07fc[_0x103d('0x33')]=_0x2b07fc[_0x103d('0x33')][_0x103d('0x35')]?_0x2b07fc[_0x103d('0x33')]:_0x5e7c86[_0x103d('0x2f')];if(!_0xc24ce2[_0x103d('0x30')]['hasOwnProperty']('nolimit')){_0x2b07fc[_0x103d('0x1c')]=qs[_0x103d('0x1c')](_0xc24ce2[_0x103d('0x30')][_0x103d('0x1c')]);_0x2b07fc[_0x103d('0x1b')]=qs['offset'](_0xc24ce2[_0x103d('0x30')][_0x103d('0x1b')]);}_0x2b07fc['order']=qs[_0x103d('0x36')](_0xc24ce2['query'][_0x103d('0x36')]);_0x2b07fc[_0x103d('0x37')]=qs[_0x103d('0x32')](_[_0x103d('0x38')](_0xc24ce2[_0x103d('0x30')],_0x5e7c86[_0x103d('0x32')]),_0x53a615);if(_0xc24ce2[_0x103d('0x30')]['filter']){_0x2b07fc[_0x103d('0x37')]=_[_0x103d('0x39')](_0x2b07fc[_0x103d('0x37')],{'$or':_[_0x103d('0x2a')](_0x53a615,function(_0x57dd7d){if(_0x57dd7d[_0x103d('0x2d')]!=='VIRTUAL'){var _0x1bd7cc={};_0x1bd7cc[_0x57dd7d[_0x103d('0x28')]]={'$like':'%'+_0xc24ce2[_0x103d('0x30')]['filter']+'%'};return _0x1bd7cc;}})});}_0x2b07fc=_[_0x103d('0x39')]({},_0x2b07fc,_0xc24ce2[_0x103d('0x3a')]);var _0x1bf5dc={'where':_0x2b07fc['where']};return db[_0x103d('0x2b')][_0x103d('0x1e')](_0x1bf5dc)[_0x103d('0x24')](function(_0x32439a){_0x4435d4[_0x103d('0x1e')]=_0x32439a;if(_0xc24ce2['query'][_0x103d('0x3b')]){_0x2b07fc[_0x103d('0x3c')]=[{'all':!![]}];}return db[_0x103d('0x2b')][_0x103d('0x3d')](_0x2b07fc);})[_0x103d('0x24')](function(_0xab4016){_0x4435d4[_0x103d('0x3e')]=_0xab4016;return _0x4435d4;})[_0x103d('0x24')](respondWithFilteredResult(_0x53a1e2,_0x2b07fc))[_0x103d('0x3f')](handleError(_0x53a1e2,null));};exports['show']=function(_0x6714b0,_0x2180cf){var _0xd1263c={'raw':![],'where':{'id':_0x6714b0[_0x103d('0x40')]['id']}},_0x42864e={};_0x42864e[_0x103d('0x2f')]=_[_0x103d('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0x42864e[_0x103d('0x30')]=_[_0x103d('0x31')](_0x6714b0[_0x103d('0x30')]);_0x42864e[_0x103d('0x32')]=_[_0x103d('0x41')](_0x42864e[_0x103d('0x2f')],_0x42864e[_0x103d('0x30')]);_0xd1263c[_0x103d('0x33')]=_[_0x103d('0x41')](_0x42864e[_0x103d('0x2f')],qs['fields'](_0x6714b0[_0x103d('0x30')][_0x103d('0x34')]));_0xd1263c[_0x103d('0x33')]=_0xd1263c[_0x103d('0x33')][_0x103d('0x35')]?_0xd1263c['attributes']:_0x42864e[_0x103d('0x2f')];if(_0x6714b0[_0x103d('0x30')][_0x103d('0x3b')]){_0xd1263c[_0x103d('0x3c')]=[{'all':!![]}];}_0xd1263c=_[_0x103d('0x39')]({},_0xd1263c,_0x6714b0[_0x103d('0x3a')]);return db['FreshdeskConfiguration'][_0x103d('0x42')](_0xd1263c)[_0x103d('0x24')](handleEntityNotFound(_0x2180cf,null))[_0x103d('0x24')](respondWithResult(_0x2180cf,null))[_0x103d('0x3f')](handleError(_0x2180cf,null));};exports['create']=function(_0xeb6e50,_0x5e204a){return db[_0x103d('0x2b')][_0x103d('0x43')](_0xeb6e50[_0x103d('0x44')],{})[_0x103d('0x24')](respondWithResult(_0x5e204a,0xc9))[_0x103d('0x3f')](handleError(_0x5e204a,null));};exports[_0x103d('0x23')]=function(_0x31e4f9,_0x2efd61){if(_0x31e4f9[_0x103d('0x44')]['id']){delete _0x31e4f9['body']['id'];}return db['FreshdeskConfiguration'][_0x103d('0x42')]({'where':{'id':_0x31e4f9[_0x103d('0x40')]['id']}})[_0x103d('0x24')](handleEntityNotFound(_0x2efd61,null))[_0x103d('0x24')](saveUpdates(_0x31e4f9[_0x103d('0x44')],null))[_0x103d('0x24')](respondWithResult(_0x2efd61,null))[_0x103d('0x3f')](handleError(_0x2efd61,null));};exports[_0x103d('0x25')]=function(_0x1a79a5,_0x20ee69){return db[_0x103d('0x2b')][_0x103d('0x42')]({'where':{'id':_0x1a79a5[_0x103d('0x40')]['id']}})[_0x103d('0x24')](handleEntityNotFound(_0x20ee69,null))[_0x103d('0x24')](removeEntity(_0x20ee69,null))['catch'](handleError(_0x20ee69,null));};exports[_0x103d('0x45')]=function(_0x29515c,_0x134ac9,_0x158163){var _0x327c85={};var _0x5584d9={};var _0x2a22d9;var _0x4cf6d1;return db[_0x103d('0x2b')][_0x103d('0x46')]({'where':{'id':_0x29515c['params']['id']}})['then'](handleEntityNotFound(_0x134ac9,null))['then'](function(_0x1ff3e2){if(_0x1ff3e2){_0x2a22d9=_0x1ff3e2;_0x5584d9[_0x103d('0x2f')]=_[_0x103d('0x31')](db[_0x103d('0x47')]['rawAttributes']);_0x5584d9[_0x103d('0x30')]=_[_0x103d('0x31')](_0x29515c[_0x103d('0x30')]);_0x5584d9['filters']=_['intersection'](_0x5584d9[_0x103d('0x2f')],_0x5584d9[_0x103d('0x30')]);_0x327c85[_0x103d('0x33')]=_[_0x103d('0x41')](_0x5584d9[_0x103d('0x2f')],qs[_0x103d('0x34')](_0x29515c[_0x103d('0x30')][_0x103d('0x34')]));_0x327c85['attributes']=_0x327c85['attributes'][_0x103d('0x35')]?_0x327c85[_0x103d('0x33')]:_0x5584d9['model'];_0x327c85[_0x103d('0x48')]=qs[_0x103d('0x36')](_0x29515c[_0x103d('0x30')][_0x103d('0x36')]);_0x327c85['where']=qs[_0x103d('0x32')](_['pick'](_0x29515c['query'],_0x5584d9[_0x103d('0x32')]));if(_0x29515c[_0x103d('0x30')][_0x103d('0x49')]){_0x327c85[_0x103d('0x37')]=_[_0x103d('0x39')](_0x327c85[_0x103d('0x37')],{'$or':_['map'](_0x327c85[_0x103d('0x33')],function(_0x473079){var _0x1e77c1={};_0x1e77c1[_0x473079]={'$like':'%'+_0x29515c[_0x103d('0x30')][_0x103d('0x49')]+'%'};return _0x1e77c1;})});}_0x327c85=_[_0x103d('0x39')]({},_0x327c85,_0x29515c[_0x103d('0x3a')]);return _0x2a22d9[_0x103d('0x45')](_0x327c85);}})[_0x103d('0x24')](function(_0x5d265b){if(_0x5d265b){_0x4cf6d1=_0x5d265b[_0x103d('0x35')];if(!_0x29515c['query'][_0x103d('0x4a')](_0x103d('0x4b'))){_0x327c85[_0x103d('0x1c')]=qs[_0x103d('0x1c')](_0x29515c[_0x103d('0x30')][_0x103d('0x1c')]);_0x327c85[_0x103d('0x1b')]=qs[_0x103d('0x1b')](_0x29515c[_0x103d('0x30')]['offset']);}return _0x2a22d9[_0x103d('0x45')](_0x327c85);}})[_0x103d('0x24')](function(_0x2b457a){if(_0x2b457a){return _0x2b457a?{'count':_0x4cf6d1,'rows':_0x2b457a}:null;}})[_0x103d('0x24')](respondWithResult(_0x134ac9,null))[_0x103d('0x3f')](handleError(_0x134ac9,null));};exports[_0x103d('0x4c')]=function(_0x245d11,_0x2c9ea1,_0x37c94b){var _0x53a4d7={};var _0x5753eb={};var _0x959129;var _0x3c039a;return db['FreshdeskConfiguration'][_0x103d('0x46')]({'where':{'id':_0x245d11['params']['id']}})['then'](handleEntityNotFound(_0x2c9ea1,null))[_0x103d('0x24')](function(_0x3b591b){if(_0x3b591b){_0x959129=_0x3b591b;_0x5753eb[_0x103d('0x2f')]=_[_0x103d('0x31')](db['FreshdeskField']['rawAttributes']);_0x5753eb[_0x103d('0x30')]=_[_0x103d('0x31')](_0x245d11['query']);_0x5753eb[_0x103d('0x32')]=_['intersection'](_0x5753eb[_0x103d('0x2f')],_0x5753eb[_0x103d('0x30')]);_0x53a4d7[_0x103d('0x33')]=_['intersection'](_0x5753eb[_0x103d('0x2f')],qs['fields'](_0x245d11['query'][_0x103d('0x34')]));_0x53a4d7[_0x103d('0x33')]=_0x53a4d7[_0x103d('0x33')]['length']?_0x53a4d7['attributes']:_0x5753eb[_0x103d('0x2f')];_0x53a4d7[_0x103d('0x48')]=qs[_0x103d('0x36')](_0x245d11['query']['sort']);_0x53a4d7[_0x103d('0x37')]=qs[_0x103d('0x32')](_['pick'](_0x245d11[_0x103d('0x30')],_0x5753eb[_0x103d('0x32')]));if(_0x245d11[_0x103d('0x30')][_0x103d('0x49')]){_0x53a4d7[_0x103d('0x37')]=_['merge'](_0x53a4d7[_0x103d('0x37')],{'$or':_['map'](_0x53a4d7[_0x103d('0x33')],function(_0x26bba8){var _0x16d0fb={};_0x16d0fb[_0x26bba8]={'$like':'%'+_0x245d11[_0x103d('0x30')][_0x103d('0x49')]+'%'};return _0x16d0fb;})});}_0x53a4d7=_[_0x103d('0x39')]({},_0x53a4d7,_0x245d11['options']);return _0x959129[_0x103d('0x4c')](_0x53a4d7);}})[_0x103d('0x24')](function(_0x40b71d){if(_0x40b71d){_0x3c039a=_0x40b71d[_0x103d('0x35')];if(!_0x245d11[_0x103d('0x30')][_0x103d('0x4a')](_0x103d('0x4b'))){_0x53a4d7['limit']=qs['limit'](_0x245d11[_0x103d('0x30')][_0x103d('0x1c')]);_0x53a4d7[_0x103d('0x1b')]=qs['offset'](_0x245d11[_0x103d('0x30')][_0x103d('0x1b')]);}return _0x959129[_0x103d('0x4c')](_0x53a4d7);}})[_0x103d('0x24')](function(_0x4a2e3a){if(_0x4a2e3a){return _0x4a2e3a?{'count':_0x3c039a,'rows':_0x4a2e3a}:null;}})['then'](respondWithResult(_0x2c9ea1,null))['catch'](handleError(_0x2c9ea1,null));};exports[_0x103d('0x4d')]=function(_0xabcb81,_0x1bc0dc,_0x7dd497){var _0x27cb6e={};var _0x68c27e={};var _0xdc8a85;var _0x454676;return db['FreshdeskConfiguration'][_0x103d('0x46')]({'where':{'id':_0xabcb81[_0x103d('0x40')]['id']}})['then'](handleEntityNotFound(_0x1bc0dc,null))[_0x103d('0x24')](function(_0x2b2a61){if(_0x2b2a61){_0xdc8a85=_0x2b2a61;_0x68c27e['model']=_[_0x103d('0x31')](db[_0x103d('0x47')]['rawAttributes']);_0x68c27e[_0x103d('0x30')]=_['keys'](_0xabcb81[_0x103d('0x30')]);_0x68c27e['filters']=_[_0x103d('0x41')](_0x68c27e[_0x103d('0x2f')],_0x68c27e[_0x103d('0x30')]);_0x27cb6e[_0x103d('0x33')]=_[_0x103d('0x41')](_0x68c27e[_0x103d('0x2f')],qs['fields'](_0xabcb81['query'][_0x103d('0x34')]));_0x27cb6e[_0x103d('0x33')]=_0x27cb6e[_0x103d('0x33')]['length']?_0x27cb6e['attributes']:_0x68c27e['model'];_0x27cb6e[_0x103d('0x48')]=qs[_0x103d('0x36')](_0xabcb81['query'][_0x103d('0x36')]);_0x27cb6e[_0x103d('0x37')]=qs[_0x103d('0x32')](_['pick'](_0xabcb81[_0x103d('0x30')],_0x68c27e['filters']));if(_0xabcb81[_0x103d('0x30')][_0x103d('0x49')]){_0x27cb6e[_0x103d('0x37')]=_[_0x103d('0x39')](_0x27cb6e[_0x103d('0x37')],{'$or':_[_0x103d('0x2a')](_0x27cb6e['attributes'],function(_0x4ea2d5){var _0x360623={};_0x360623[_0x4ea2d5]={'$like':'%'+_0xabcb81['query']['filter']+'%'};return _0x360623;})});}_0x27cb6e=_[_0x103d('0x39')]({},_0x27cb6e,_0xabcb81[_0x103d('0x3a')]);return _0xdc8a85[_0x103d('0x4d')](_0x27cb6e);}})[_0x103d('0x24')](function(_0x338c07){if(_0x338c07){_0x454676=_0x338c07[_0x103d('0x35')];if(!_0xabcb81[_0x103d('0x30')][_0x103d('0x4a')](_0x103d('0x4b'))){_0x27cb6e[_0x103d('0x1c')]=qs[_0x103d('0x1c')](_0xabcb81[_0x103d('0x30')]['limit']);_0x27cb6e[_0x103d('0x1b')]=qs[_0x103d('0x1b')](_0xabcb81[_0x103d('0x30')][_0x103d('0x1b')]);}return _0xdc8a85[_0x103d('0x4d')](_0x27cb6e);}})[_0x103d('0x24')](function(_0x30bd2a){if(_0x30bd2a){return _0x30bd2a?{'count':_0x454676,'rows':_0x30bd2a}:null;}})[_0x103d('0x24')](respondWithResult(_0x1bc0dc,null))[_0x103d('0x3f')](handleError(_0x1bc0dc,null));};exports[_0x103d('0x4e')]=function(_0x4e9b48,_0x4fd258,_0x2a9fa7){var _0x3c7389={};var _0x5e0c8e={};var _0x3089d4;var _0x33f2be;return db[_0x103d('0x2b')][_0x103d('0x46')]({'where':{'id':_0x4e9b48[_0x103d('0x40')]['id']}})[_0x103d('0x24')](handleEntityNotFound(_0x4fd258,null))[_0x103d('0x24')](function(_0x22f0e4){if(_0x22f0e4){_0x3089d4=_0x22f0e4;_0x5e0c8e[_0x103d('0x2f')]=_[_0x103d('0x31')](db['Tag'][_0x103d('0x4f')]);_0x5e0c8e[_0x103d('0x30')]=_['keys'](_0x4e9b48['query']);_0x5e0c8e['filters']=_[_0x103d('0x41')](_0x5e0c8e[_0x103d('0x2f')],_0x5e0c8e['query']);_0x3c7389[_0x103d('0x33')]=_[_0x103d('0x41')](_0x5e0c8e[_0x103d('0x2f')],qs[_0x103d('0x34')](_0x4e9b48['query'][_0x103d('0x34')]));_0x3c7389[_0x103d('0x33')]=_0x3c7389['attributes']['length']?_0x3c7389[_0x103d('0x33')]:_0x5e0c8e['model'];_0x3c7389[_0x103d('0x48')]=qs[_0x103d('0x36')](_0x4e9b48[_0x103d('0x30')][_0x103d('0x36')]);_0x3c7389['where']=qs['filters'](_[_0x103d('0x38')](_0x4e9b48[_0x103d('0x30')],_0x5e0c8e['filters']));if(_0x4e9b48[_0x103d('0x30')]['filter']){_0x3c7389[_0x103d('0x37')]=_[_0x103d('0x39')](_0x3c7389[_0x103d('0x37')],{'$or':_[_0x103d('0x2a')](_0x3c7389[_0x103d('0x33')],function(_0x3958c6){var _0x4d11b8={};_0x4d11b8[_0x3958c6]={'$like':'%'+_0x4e9b48[_0x103d('0x30')][_0x103d('0x49')]+'%'};return _0x4d11b8;})});}_0x3c7389=_['merge']({},_0x3c7389,_0x4e9b48[_0x103d('0x3a')]);return _0x3089d4[_0x103d('0x4e')](_0x3c7389);}})[_0x103d('0x24')](function(_0x59a396){if(_0x59a396){_0x33f2be=_0x59a396['length'];if(!_0x4e9b48['query'][_0x103d('0x4a')]('nolimit')){_0x3c7389['limit']=qs[_0x103d('0x1c')](_0x4e9b48[_0x103d('0x30')][_0x103d('0x1c')]);_0x3c7389[_0x103d('0x1b')]=qs['offset'](_0x4e9b48[_0x103d('0x30')][_0x103d('0x1b')]);}return _0x3089d4[_0x103d('0x4e')](_0x3c7389);}})['then'](function(_0xdd39af){if(_0xdd39af){return _0xdd39af?{'count':_0x33f2be,'rows':_0xdd39af}:null;}})['then'](respondWithResult(_0x4fd258,null))[_0x103d('0x3f')](handleError(_0x4fd258,null));};exports[_0x103d('0x50')]=function(_0xe73de3,_0x4a5df9,_0x25edc3){if(_0xe73de3[_0x103d('0x44')]['id']){delete _0xe73de3[_0x103d('0x44')]['id'];}return db[_0x103d('0x2b')][_0x103d('0x46')]({'where':{'id':_0xe73de3[_0x103d('0x40')]['id']}})[_0x103d('0x24')](handleEntityNotFound(_0x4a5df9,null))['then'](function(_0x5ebee8){if(_0x5ebee8){return _0x5ebee8[_0x103d('0x50')](_0xe73de3[_0x103d('0x44')]['ids']||[]);}return null;})[_0x103d('0x24')](respondWithResult(_0x4a5df9,null))[_0x103d('0x3f')](handleError(_0x4a5df9,null));}; \ No newline at end of file +var _0x2019=['getFields','FreshdeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','rows','params','find','catch','create','body'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0x2019,0xa6));var _0x9201=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x2019[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9201('0x0'));var zipdir=require(_0x9201('0x1'));var jsonpatch=require(_0x9201('0x2'));var rp=require(_0x9201('0x3'));var moment=require(_0x9201('0x4'));var BPromise=require(_0x9201('0x5'));var Mustache=require(_0x9201('0x6'));var util=require('util');var path=require(_0x9201('0x7'));var sox=require(_0x9201('0x8'));var csv=require(_0x9201('0x9'));var ejs=require(_0x9201('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9201('0xb'));var squel=require(_0x9201('0xc'));var crypto=require(_0x9201('0xd'));var jsforce=require(_0x9201('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9201('0xf'));var Redis=require(_0x9201('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9201('0x11'));var as=require(_0x9201('0x12'));var hardwareService=require(_0x9201('0x13'));var logger=require('../../config/logger')(_0x9201('0x14'));var utils=require(_0x9201('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9201('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f4a21,_0x3e7391){_0x3e7391=_0x3e7391||0xcc;return function(_0x5c428b){if(_0x5c428b){return _0x5f4a21['sendStatus'](_0x3e7391);}return _0x5f4a21[_0x9201('0x17')](_0x3e7391)[_0x9201('0x18')]();};}function respondWithResult(_0x4358c4,_0x1d94bf){_0x1d94bf=_0x1d94bf||0xc8;return function(_0x274888){if(_0x274888){return _0x4358c4['status'](_0x1d94bf)[_0x9201('0x19')](_0x274888);}};}function respondWithFilteredResult(_0x5f5267,_0x5ea4dc){return function(_0x2e292d){if(_0x2e292d){var _0x1632ba=typeof _0x5ea4dc[_0x9201('0x1a')]===_0x9201('0x1b')&&typeof _0x5ea4dc[_0x9201('0x1c')]===_0x9201('0x1b');var _0x23808c=_0x2e292d[_0x9201('0x1d')];var _0x2aadb3=_0x1632ba?0x0:_0x5ea4dc[_0x9201('0x1a')];var _0x216d0e=_0x1632ba?_0x2e292d[_0x9201('0x1d')]:_0x5ea4dc[_0x9201('0x1a')]+_0x5ea4dc[_0x9201('0x1c')];var _0x24274e;if(_0x216d0e>=_0x23808c){_0x216d0e=_0x23808c;_0x24274e=0xc8;}else{_0x24274e=0xce;}_0x5f5267[_0x9201('0x17')](_0x24274e);return _0x5f5267[_0x9201('0x1e')](_0x9201('0x1f'),_0x2aadb3+'-'+_0x216d0e+'/'+_0x23808c)['json'](_0x2e292d);}return null;};}function patchUpdates(_0x4972e8){return function(_0x297f07){try{jsonpatch[_0x9201('0x20')](_0x297f07,_0x4972e8,!![]);}catch(_0x54708b){return BPromise['reject'](_0x54708b);}return _0x297f07['save']();};}function saveUpdates(_0x59d950,_0x52ae36){return function(_0x3fbad8){if(_0x3fbad8){return _0x3fbad8[_0x9201('0x21')](_0x59d950)['then'](function(_0x12244b){return _0x12244b;});}return null;};}function removeEntity(_0x56c03d,_0x1d2557){return function(_0x455b88){if(_0x455b88){return _0x455b88[_0x9201('0x22')]()[_0x9201('0x23')](function(){_0x56c03d[_0x9201('0x17')](0xcc)[_0x9201('0x18')]();});}};}function handleEntityNotFound(_0x38ca37,_0x5bb8ca){return function(_0x347f02){if(!_0x347f02){_0x38ca37[_0x9201('0x24')](0x194);}return _0x347f02;};}function handleError(_0x25310d,_0x5d45ad){_0x5d45ad=_0x5d45ad||0x1f4;return function(_0x5aa8a2){logger['error'](_0x5aa8a2[_0x9201('0x25')]);if(_0x5aa8a2[_0x9201('0x26')]){delete _0x5aa8a2[_0x9201('0x26')];}_0x25310d[_0x9201('0x17')](_0x5d45ad)[_0x9201('0x27')](_0x5aa8a2);};}exports[_0x9201('0x28')]=function(_0x3f60d3,_0x493071){var _0x48c86c={},_0x4dacca={},_0x4c2158={'count':0x0,'rows':[]};var _0x1f98da=_[_0x9201('0x29')](db['FreshdeskConfiguration'][_0x9201('0x2a')],function(_0x9febe5){return{'name':_0x9febe5['fieldName'],'type':_0x9febe5[_0x9201('0x2b')]['key']};});_0x4dacca[_0x9201('0x2c')]=_[_0x9201('0x29')](_0x1f98da,_0x9201('0x26'));_0x4dacca[_0x9201('0x2d')]=_[_0x9201('0x2e')](_0x3f60d3[_0x9201('0x2d')]);_0x4dacca[_0x9201('0x2f')]=_[_0x9201('0x30')](_0x4dacca[_0x9201('0x2c')],_0x4dacca['query']);_0x48c86c['attributes']=_[_0x9201('0x30')](_0x4dacca[_0x9201('0x2c')],qs[_0x9201('0x31')](_0x3f60d3[_0x9201('0x2d')][_0x9201('0x31')]));_0x48c86c[_0x9201('0x32')]=_0x48c86c[_0x9201('0x32')][_0x9201('0x33')]?_0x48c86c[_0x9201('0x32')]:_0x4dacca[_0x9201('0x2c')];if(!_0x3f60d3[_0x9201('0x2d')][_0x9201('0x34')](_0x9201('0x35'))){_0x48c86c[_0x9201('0x1c')]=qs[_0x9201('0x1c')](_0x3f60d3[_0x9201('0x2d')][_0x9201('0x1c')]);_0x48c86c[_0x9201('0x1a')]=qs[_0x9201('0x1a')](_0x3f60d3[_0x9201('0x2d')]['offset']);}_0x48c86c[_0x9201('0x36')]=qs[_0x9201('0x37')](_0x3f60d3['query'][_0x9201('0x37')]);_0x48c86c[_0x9201('0x38')]=qs[_0x9201('0x2f')](_[_0x9201('0x39')](_0x3f60d3[_0x9201('0x2d')],_0x4dacca[_0x9201('0x2f')]),_0x1f98da);if(_0x3f60d3[_0x9201('0x2d')][_0x9201('0x3a')]){_0x48c86c[_0x9201('0x38')]=_[_0x9201('0x3b')](_0x48c86c[_0x9201('0x38')],{'$or':_[_0x9201('0x29')](_0x1f98da,function(_0x3ab0b3){if(_0x3ab0b3[_0x9201('0x2b')]!==_0x9201('0x3c')){var _0x141d80={};_0x141d80[_0x3ab0b3[_0x9201('0x26')]]={'$like':'%'+_0x3f60d3[_0x9201('0x2d')]['filter']+'%'};return _0x141d80;}})});}_0x48c86c=_[_0x9201('0x3b')]({},_0x48c86c,_0x3f60d3[_0x9201('0x3d')]);var _0x4b7598={'where':_0x48c86c[_0x9201('0x38')]};return db['FreshdeskConfiguration'][_0x9201('0x1d')](_0x4b7598)['then'](function(_0x4aec9f){_0x4c2158[_0x9201('0x1d')]=_0x4aec9f;if(_0x3f60d3['query'][_0x9201('0x3e')]){_0x48c86c[_0x9201('0x3f')]=[{'all':!![]}];}return db[_0x9201('0x40')]['findAll'](_0x48c86c);})['then'](function(_0x5c3a47){_0x4c2158[_0x9201('0x41')]=_0x5c3a47;return _0x4c2158;})[_0x9201('0x23')](respondWithFilteredResult(_0x493071,_0x48c86c))['catch'](handleError(_0x493071,null));};exports['show']=function(_0x22f74f,_0x55cfba){var _0x1b72c5={'raw':![],'where':{'id':_0x22f74f[_0x9201('0x42')]['id']}},_0x4bdc85={};_0x4bdc85[_0x9201('0x2c')]=_[_0x9201('0x2e')](db[_0x9201('0x40')][_0x9201('0x2a')]);_0x4bdc85[_0x9201('0x2d')]=_[_0x9201('0x2e')](_0x22f74f['query']);_0x4bdc85[_0x9201('0x2f')]=_[_0x9201('0x30')](_0x4bdc85[_0x9201('0x2c')],_0x4bdc85[_0x9201('0x2d')]);_0x1b72c5[_0x9201('0x32')]=_[_0x9201('0x30')](_0x4bdc85[_0x9201('0x2c')],qs[_0x9201('0x31')](_0x22f74f[_0x9201('0x2d')][_0x9201('0x31')]));_0x1b72c5[_0x9201('0x32')]=_0x1b72c5[_0x9201('0x32')][_0x9201('0x33')]?_0x1b72c5[_0x9201('0x32')]:_0x4bdc85[_0x9201('0x2c')];if(_0x22f74f[_0x9201('0x2d')]['includeAll']){_0x1b72c5[_0x9201('0x3f')]=[{'all':!![]}];}_0x1b72c5=_[_0x9201('0x3b')]({},_0x1b72c5,_0x22f74f[_0x9201('0x3d')]);return db[_0x9201('0x40')][_0x9201('0x43')](_0x1b72c5)[_0x9201('0x23')](handleEntityNotFound(_0x55cfba,null))[_0x9201('0x23')](respondWithResult(_0x55cfba,null))[_0x9201('0x44')](handleError(_0x55cfba,null));};exports[_0x9201('0x45')]=function(_0x34973b,_0x1af6a1){return db[_0x9201('0x40')][_0x9201('0x45')](_0x34973b[_0x9201('0x46')],{})['then'](respondWithResult(_0x1af6a1,0xc9))[_0x9201('0x44')](handleError(_0x1af6a1,null));};exports[_0x9201('0x21')]=function(_0x2efaec,_0x1b9556){if(_0x2efaec[_0x9201('0x46')]['id']){delete _0x2efaec[_0x9201('0x46')]['id'];}return db[_0x9201('0x40')][_0x9201('0x43')]({'where':{'id':_0x2efaec[_0x9201('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b9556,null))['then'](saveUpdates(_0x2efaec['body'],null))[_0x9201('0x23')](respondWithResult(_0x1b9556,null))['catch'](handleError(_0x1b9556,null));};exports[_0x9201('0x22')]=function(_0x40afab,_0x28bf6a){return db[_0x9201('0x40')][_0x9201('0x43')]({'where':{'id':_0x40afab[_0x9201('0x42')]['id']}})[_0x9201('0x23')](handleEntityNotFound(_0x28bf6a,null))[_0x9201('0x23')](removeEntity(_0x28bf6a,null))[_0x9201('0x44')](handleError(_0x28bf6a,null));};exports[_0x9201('0x47')]=function(_0x343d26,_0x480d5e,_0xdb966a){var _0x5adf5b={};var _0x3dfb3c={};var _0x1f800d;var _0x8c2d4;return db[_0x9201('0x40')]['findOne']({'where':{'id':_0x343d26['params']['id']}})[_0x9201('0x23')](handleEntityNotFound(_0x480d5e,null))['then'](function(_0x589c87){if(_0x589c87){_0x1f800d=_0x589c87;_0x3dfb3c[_0x9201('0x2c')]=_['keys'](db[_0x9201('0x48')][_0x9201('0x2a')]);_0x3dfb3c[_0x9201('0x2d')]=_[_0x9201('0x2e')](_0x343d26[_0x9201('0x2d')]);_0x3dfb3c['filters']=_[_0x9201('0x30')](_0x3dfb3c[_0x9201('0x2c')],_0x3dfb3c[_0x9201('0x2d')]);_0x5adf5b['attributes']=_['intersection'](_0x3dfb3c[_0x9201('0x2c')],qs[_0x9201('0x31')](_0x343d26[_0x9201('0x2d')][_0x9201('0x31')]));_0x5adf5b[_0x9201('0x32')]=_0x5adf5b[_0x9201('0x32')]['length']?_0x5adf5b[_0x9201('0x32')]:_0x3dfb3c['model'];_0x5adf5b[_0x9201('0x36')]=qs['sort'](_0x343d26[_0x9201('0x2d')]['sort']);_0x5adf5b[_0x9201('0x38')]=qs[_0x9201('0x2f')](_[_0x9201('0x39')](_0x343d26[_0x9201('0x2d')],_0x3dfb3c['filters']));if(_0x343d26[_0x9201('0x2d')][_0x9201('0x3a')]){_0x5adf5b['where']=_['merge'](_0x5adf5b[_0x9201('0x38')],{'$or':_[_0x9201('0x29')](_0x5adf5b[_0x9201('0x32')],function(_0x4570fa){var _0x519779={};_0x519779[_0x4570fa]={'$like':'%'+_0x343d26[_0x9201('0x2d')]['filter']+'%'};return _0x519779;})});}_0x5adf5b=_[_0x9201('0x3b')]({},_0x5adf5b,_0x343d26['options']);return _0x1f800d[_0x9201('0x47')](_0x5adf5b);}})[_0x9201('0x23')](function(_0x4b49dd){if(_0x4b49dd){_0x8c2d4=_0x4b49dd[_0x9201('0x33')];if(!_0x343d26[_0x9201('0x2d')][_0x9201('0x34')]('nolimit')){_0x5adf5b[_0x9201('0x1c')]=qs['limit'](_0x343d26[_0x9201('0x2d')][_0x9201('0x1c')]);_0x5adf5b[_0x9201('0x1a')]=qs['offset'](_0x343d26[_0x9201('0x2d')]['offset']);}return _0x1f800d[_0x9201('0x47')](_0x5adf5b);}})[_0x9201('0x23')](function(_0x6bf17d){if(_0x6bf17d){return _0x6bf17d?{'count':_0x8c2d4,'rows':_0x6bf17d}:null;}})[_0x9201('0x23')](respondWithResult(_0x480d5e,null))[_0x9201('0x44')](handleError(_0x480d5e,null));};exports[_0x9201('0x49')]=function(_0x46e60f,_0x7de8cb,_0x23e083){var _0x2383e2={};var _0x38fc40={};var _0x3ea337;var _0x24298c;return db[_0x9201('0x40')]['findOne']({'where':{'id':_0x46e60f[_0x9201('0x42')]['id']}})[_0x9201('0x23')](handleEntityNotFound(_0x7de8cb,null))[_0x9201('0x23')](function(_0x239be3){if(_0x239be3){_0x3ea337=_0x239be3;_0x38fc40[_0x9201('0x2c')]=_[_0x9201('0x2e')](db[_0x9201('0x48')][_0x9201('0x2a')]);_0x38fc40[_0x9201('0x2d')]=_['keys'](_0x46e60f[_0x9201('0x2d')]);_0x38fc40[_0x9201('0x2f')]=_[_0x9201('0x30')](_0x38fc40[_0x9201('0x2c')],_0x38fc40[_0x9201('0x2d')]);_0x2383e2[_0x9201('0x32')]=_['intersection'](_0x38fc40[_0x9201('0x2c')],qs[_0x9201('0x31')](_0x46e60f[_0x9201('0x2d')][_0x9201('0x31')]));_0x2383e2[_0x9201('0x32')]=_0x2383e2[_0x9201('0x32')]['length']?_0x2383e2[_0x9201('0x32')]:_0x38fc40[_0x9201('0x2c')];_0x2383e2[_0x9201('0x36')]=qs[_0x9201('0x37')](_0x46e60f['query']['sort']);_0x2383e2[_0x9201('0x38')]=qs[_0x9201('0x2f')](_[_0x9201('0x39')](_0x46e60f['query'],_0x38fc40[_0x9201('0x2f')]));if(_0x46e60f[_0x9201('0x2d')][_0x9201('0x3a')]){_0x2383e2[_0x9201('0x38')]=_[_0x9201('0x3b')](_0x2383e2[_0x9201('0x38')],{'$or':_[_0x9201('0x29')](_0x2383e2[_0x9201('0x32')],function(_0x49d01f){var _0x35bc95={};_0x35bc95[_0x49d01f]={'$like':'%'+_0x46e60f[_0x9201('0x2d')]['filter']+'%'};return _0x35bc95;})});}_0x2383e2=_[_0x9201('0x3b')]({},_0x2383e2,_0x46e60f['options']);return _0x3ea337[_0x9201('0x49')](_0x2383e2);}})[_0x9201('0x23')](function(_0x3bbdab){if(_0x3bbdab){_0x24298c=_0x3bbdab['length'];if(!_0x46e60f[_0x9201('0x2d')]['hasOwnProperty']('nolimit')){_0x2383e2[_0x9201('0x1c')]=qs[_0x9201('0x1c')](_0x46e60f[_0x9201('0x2d')][_0x9201('0x1c')]);_0x2383e2[_0x9201('0x1a')]=qs[_0x9201('0x1a')](_0x46e60f['query'][_0x9201('0x1a')]);}return _0x3ea337[_0x9201('0x49')](_0x2383e2);}})[_0x9201('0x23')](function(_0x3e255d){if(_0x3e255d){return _0x3e255d?{'count':_0x24298c,'rows':_0x3e255d}:null;}})[_0x9201('0x23')](respondWithResult(_0x7de8cb,null))['catch'](handleError(_0x7de8cb,null));};exports['getDescriptions']=function(_0x4b9154,_0x223cae,_0x448466){var _0x3a0cc2={};var _0x205565={};var _0x1757a8;var _0x5cfb03;return db[_0x9201('0x40')][_0x9201('0x4a')]({'where':{'id':_0x4b9154[_0x9201('0x42')]['id']}})['then'](handleEntityNotFound(_0x223cae,null))[_0x9201('0x23')](function(_0x177af1){if(_0x177af1){_0x1757a8=_0x177af1;_0x205565[_0x9201('0x2c')]=_['keys'](db[_0x9201('0x48')][_0x9201('0x2a')]);_0x205565[_0x9201('0x2d')]=_[_0x9201('0x2e')](_0x4b9154['query']);_0x205565['filters']=_[_0x9201('0x30')](_0x205565['model'],_0x205565[_0x9201('0x2d')]);_0x3a0cc2[_0x9201('0x32')]=_[_0x9201('0x30')](_0x205565['model'],qs[_0x9201('0x31')](_0x4b9154[_0x9201('0x2d')][_0x9201('0x31')]));_0x3a0cc2[_0x9201('0x32')]=_0x3a0cc2[_0x9201('0x32')][_0x9201('0x33')]?_0x3a0cc2[_0x9201('0x32')]:_0x205565['model'];_0x3a0cc2[_0x9201('0x36')]=qs['sort'](_0x4b9154[_0x9201('0x2d')][_0x9201('0x37')]);_0x3a0cc2['where']=qs[_0x9201('0x2f')](_['pick'](_0x4b9154[_0x9201('0x2d')],_0x205565[_0x9201('0x2f')]));if(_0x4b9154['query']['filter']){_0x3a0cc2[_0x9201('0x38')]=_['merge'](_0x3a0cc2['where'],{'$or':_[_0x9201('0x29')](_0x3a0cc2[_0x9201('0x32')],function(_0x264529){var _0x2862a1={};_0x2862a1[_0x264529]={'$like':'%'+_0x4b9154[_0x9201('0x2d')]['filter']+'%'};return _0x2862a1;})});}_0x3a0cc2=_['merge']({},_0x3a0cc2,_0x4b9154['options']);return _0x1757a8['getDescriptions'](_0x3a0cc2);}})[_0x9201('0x23')](function(_0x30d22d){if(_0x30d22d){_0x5cfb03=_0x30d22d[_0x9201('0x33')];if(!_0x4b9154['query']['hasOwnProperty'](_0x9201('0x35'))){_0x3a0cc2[_0x9201('0x1c')]=qs[_0x9201('0x1c')](_0x4b9154[_0x9201('0x2d')][_0x9201('0x1c')]);_0x3a0cc2[_0x9201('0x1a')]=qs[_0x9201('0x1a')](_0x4b9154[_0x9201('0x2d')][_0x9201('0x1a')]);}return _0x1757a8[_0x9201('0x4b')](_0x3a0cc2);}})[_0x9201('0x23')](function(_0x21cebd){if(_0x21cebd){return _0x21cebd?{'count':_0x5cfb03,'rows':_0x21cebd}:null;}})[_0x9201('0x23')](respondWithResult(_0x223cae,null))[_0x9201('0x44')](handleError(_0x223cae,null));};exports[_0x9201('0x4c')]=function(_0x1d9cc9,_0xcaf9f5,_0x25c6e6){var _0x9f3579={};var _0x1b8d31={};var _0x2b1ef7;var _0xbaaaac;return db[_0x9201('0x40')]['findOne']({'where':{'id':_0x1d9cc9[_0x9201('0x42')]['id']}})[_0x9201('0x23')](handleEntityNotFound(_0xcaf9f5,null))[_0x9201('0x23')](function(_0x8dac9e){if(_0x8dac9e){_0x2b1ef7=_0x8dac9e;_0x1b8d31[_0x9201('0x2c')]=_[_0x9201('0x2e')](db[_0x9201('0x4d')][_0x9201('0x2a')]);_0x1b8d31['query']=_[_0x9201('0x2e')](_0x1d9cc9['query']);_0x1b8d31[_0x9201('0x2f')]=_[_0x9201('0x30')](_0x1b8d31['model'],_0x1b8d31[_0x9201('0x2d')]);_0x9f3579[_0x9201('0x32')]=_[_0x9201('0x30')](_0x1b8d31[_0x9201('0x2c')],qs[_0x9201('0x31')](_0x1d9cc9[_0x9201('0x2d')][_0x9201('0x31')]));_0x9f3579[_0x9201('0x32')]=_0x9f3579['attributes'][_0x9201('0x33')]?_0x9f3579[_0x9201('0x32')]:_0x1b8d31[_0x9201('0x2c')];_0x9f3579[_0x9201('0x36')]=qs[_0x9201('0x37')](_0x1d9cc9[_0x9201('0x2d')][_0x9201('0x37')]);_0x9f3579[_0x9201('0x38')]=qs['filters'](_['pick'](_0x1d9cc9['query'],_0x1b8d31[_0x9201('0x2f')]));if(_0x1d9cc9[_0x9201('0x2d')][_0x9201('0x3a')]){_0x9f3579[_0x9201('0x38')]=_[_0x9201('0x3b')](_0x9f3579[_0x9201('0x38')],{'$or':_[_0x9201('0x29')](_0x9f3579['attributes'],function(_0x4b5ee0){var _0x3ed456={};_0x3ed456[_0x4b5ee0]={'$like':'%'+_0x1d9cc9[_0x9201('0x2d')][_0x9201('0x3a')]+'%'};return _0x3ed456;})});}_0x9f3579=_[_0x9201('0x3b')]({},_0x9f3579,_0x1d9cc9['options']);return _0x2b1ef7[_0x9201('0x4c')](_0x9f3579);}})[_0x9201('0x23')](function(_0x5e385a){if(_0x5e385a){_0xbaaaac=_0x5e385a[_0x9201('0x33')];if(!_0x1d9cc9[_0x9201('0x2d')][_0x9201('0x34')]('nolimit')){_0x9f3579['limit']=qs['limit'](_0x1d9cc9[_0x9201('0x2d')][_0x9201('0x1c')]);_0x9f3579[_0x9201('0x1a')]=qs[_0x9201('0x1a')](_0x1d9cc9[_0x9201('0x2d')]['offset']);}return _0x2b1ef7[_0x9201('0x4c')](_0x9f3579);}})[_0x9201('0x23')](function(_0x4ce07f){if(_0x4ce07f){return _0x4ce07f?{'count':_0xbaaaac,'rows':_0x4ce07f}:null;}})[_0x9201('0x23')](respondWithResult(_0xcaf9f5,null))['catch'](handleError(_0xcaf9f5,null));};exports['setTags']=function(_0x7f8212,_0x25c3d5,_0x1ce3ab){if(_0x7f8212['body']['id']){delete _0x7f8212['body']['id'];}return db[_0x9201('0x40')][_0x9201('0x4a')]({'where':{'id':_0x7f8212[_0x9201('0x42')]['id']}})[_0x9201('0x23')](handleEntityNotFound(_0x25c3d5,null))['then'](function(_0x4f6959){if(_0x4f6959){return _0x4f6959[_0x9201('0x4e')](_0x7f8212[_0x9201('0x46')]['ids']||[]);}return null;})[_0x9201('0x23')](respondWithResult(_0x25c3d5,null))['catch'](handleError(_0x25c3d5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a3cf661..74d36d7 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 _0x58da=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x58da,0xd4));var _0xa58d=function(_0x36210b,_0x3bdebd){_0x36210b=_0x36210b-0x0;var _0x573fb4=_0x58da[_0x36210b];return _0x573fb4;};'use strict';var _=require(_0xa58d('0x0'));var util=require(_0xa58d('0x1'));var logger=require(_0xa58d('0x2'))(_0xa58d('0x3'));var moment=require(_0xa58d('0x4'));var BPromise=require(_0xa58d('0x5'));var rp=require(_0xa58d('0x6'));var fs=require('fs');var path=require(_0xa58d('0x7'));var rimraf=require(_0xa58d('0x8'));var config=require(_0xa58d('0x9'));var attributes=require(_0xa58d('0xa'));module['exports']=function(_0x2e86e2,_0x2a4441){return _0x2e86e2[_0xa58d('0xb')](_0xa58d('0xc'),attributes,{'tableName':_0xa58d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba28=['request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','bluebird'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xba28,0x110));var _0x8ba2=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xba28[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x8ba2('0x0'));var util=require(_0x8ba2('0x1'));var logger=require('../../config/logger')(_0x8ba2('0x2'));var moment=require('moment');var BPromise=require(_0x8ba2('0x3'));var rp=require(_0x8ba2('0x4'));var fs=require('fs');var path=require(_0x8ba2('0x5'));var rimraf=require('rimraf');var config=require(_0x8ba2('0x6'));var attributes=require(_0x8ba2('0x7'));module[_0x8ba2('0x8')]=function(_0x52a747,_0x5f34b7){return _0x52a747[_0x8ba2('0x9')](_0x8ba2('0xa'),attributes,{'tableName':_0x8ba2('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 e42e0da..9681853 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 _0xc6c0=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0xc6c0,0x108));var _0x0c6c=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0xc6c0[_0x33c637];return _0x14aa20;};'use strict';var _=require(_0x0c6c('0x0'));var util=require(_0x0c6c('0x1'));var moment=require(_0x0c6c('0x2'));var BPromise=require(_0x0c6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c6c('0x4'));var logger=require(_0x0c6c('0x5'))(_0x0c6c('0x6'));var config=require(_0x0c6c('0x7'));var jayson=require(_0x0c6c('0x8'));var client=jayson[_0x0c6c('0x9')][_0x0c6c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54635b,_0x386652,_0x896938){return new BPromise(function(_0x354440,_0x2a565d){return client[_0x0c6c('0xb')](_0x54635b,_0x896938)['then'](function(_0x2f4101){logger[_0x0c6c('0xc')](_0x0c6c('0xd'),_0x386652,_0x0c6c('0xe'));logger[_0x0c6c('0xf')](_0x0c6c('0x10'),_0x386652,'request\x20sent',JSON['stringify'](_0x2f4101));if(_0x2f4101[_0x0c6c('0x11')]){if(_0x2f4101[_0x0c6c('0x11')][_0x0c6c('0x12')]===0x1f4){logger['error'](_0x0c6c('0xd'),_0x386652,_0x2f4101[_0x0c6c('0x11')][_0x0c6c('0x13')]);return _0x2a565d(_0x2f4101[_0x0c6c('0x11')][_0x0c6c('0x13')]);}logger['error'](_0x0c6c('0xd'),_0x386652,_0x2f4101[_0x0c6c('0x11')]['message']);return _0x354440(_0x2f4101[_0x0c6c('0x11')][_0x0c6c('0x13')]);}else{logger[_0x0c6c('0xc')](_0x0c6c('0xd'),_0x386652,_0x0c6c('0xe'));_0x354440(_0x2f4101[_0x0c6c('0x14')][_0x0c6c('0x13')]);}})[_0x0c6c('0x15')](function(_0x2096e3){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x386652,_0x2096e3);_0x2a565d(_0x2096e3);});});} \ No newline at end of file +var _0x3433=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x3433,0xa8));var _0x3343=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x3433[_0x81e39d];return _0x548fbb;};'use strict';var _=require(_0x3343('0x0'));var util=require('util');var moment=require(_0x3343('0x1'));var BPromise=require(_0x3343('0x2'));var rs=require(_0x3343('0x3'));var fs=require('fs');var Redis=require(_0x3343('0x4'));var db=require(_0x3343('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3343('0x6'))(_0x3343('0x7'));var config=require(_0x3343('0x8'));var jayson=require(_0x3343('0x9'));var client=jayson[_0x3343('0xa')][_0x3343('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eef79,_0x69c7e6,_0x4ba990){return new BPromise(function(_0xa9866d,_0x1dd181){return client[_0x3343('0xc')](_0x5eef79,_0x4ba990)[_0x3343('0xd')](function(_0x3a5422){logger['info'](_0x3343('0xe'),_0x69c7e6,'request\x20sent');logger[_0x3343('0xf')](_0x3343('0x10'),_0x69c7e6,_0x3343('0x11'),JSON[_0x3343('0x12')](_0x3a5422));if(_0x3a5422[_0x3343('0x13')]){if(_0x3a5422[_0x3343('0x13')]['code']===0x1f4){logger[_0x3343('0x13')](_0x3343('0xe'),_0x69c7e6,_0x3a5422[_0x3343('0x13')][_0x3343('0x14')]);return _0x1dd181(_0x3a5422[_0x3343('0x13')][_0x3343('0x14')]);}logger[_0x3343('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x69c7e6,_0x3a5422['error'][_0x3343('0x14')]);return _0xa9866d(_0x3a5422[_0x3343('0x13')][_0x3343('0x14')]);}else{logger[_0x3343('0x15')](_0x3343('0xe'),_0x69c7e6,_0x3343('0x11'));_0xa9866d(_0x3a5422[_0x3343('0x16')][_0x3343('0x14')]);}})[_0x3343('0x17')](function(_0x3dfde0){logger[_0x3343('0x13')](_0x3343('0xe'),_0x69c7e6,_0x3dfde0);_0x1dd181(_0x3dfde0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index fdd788a..842fb96 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 _0x760e=['post','create','put','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x3d2e15,_0x1128d3){var _0x1f814e=function(_0x2a70e3){while(--_0x2a70e3){_0x3d2e15['push'](_0x3d2e15['shift']());}};_0x1f814e(++_0x1128d3);}(_0x760e,0x148));var _0xe760=function(_0x5aaa78,_0x48e277){_0x5aaa78=_0x5aaa78-0x0;var _0x14cd91=_0x760e[_0x5aaa78];return _0x14cd91;};'use strict';var multer=require('multer');var util=require(_0xe760('0x0'));var path=require(_0xe760('0x1'));var timeout=require(_0xe760('0x2'));var express=require(_0xe760('0x3'));var router=express['Router']();var fs_extra=require(_0xe760('0x4'));var auth=require(_0xe760('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe760('0x6'));router['get']('/',auth[_0xe760('0x7')](),controller[_0xe760('0x8')]);router[_0xe760('0x9')](_0xe760('0xa'),auth[_0xe760('0x7')](),controller[_0xe760('0xb')]);router[_0xe760('0xc')]('/',auth[_0xe760('0x7')](),controller[_0xe760('0xd')]);router[_0xe760('0xe')](_0xe760('0xa'),auth[_0xe760('0x7')](),controller['update']);router[_0xe760('0xf')](_0xe760('0xa'),auth[_0xe760('0x7')](),controller[_0xe760('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7d14=['put','update','delete','destroy','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x487c3b,_0x4452e3){var _0x4755af=function(_0x21b8d6){while(--_0x21b8d6){_0x487c3b['push'](_0x487c3b['shift']());}};_0x4755af(++_0x4452e3);}(_0x7d14,0xca));var _0x47d1=function(_0x4d1976,_0x2b8a94){_0x4d1976=_0x4d1976-0x0;var _0xf2d716=_0x7d14[_0x4d1976];return _0xf2d716;};'use strict';var multer=require(_0x47d1('0x0'));var util=require(_0x47d1('0x1'));var path=require(_0x47d1('0x2'));var timeout=require(_0x47d1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x47d1('0x4'));var config=require(_0x47d1('0x5'));var controller=require(_0x47d1('0x6'));router[_0x47d1('0x7')]('/',auth[_0x47d1('0x8')](),controller[_0x47d1('0x9')]);router[_0x47d1('0x7')](_0x47d1('0xa'),auth[_0x47d1('0x8')](),controller[_0x47d1('0xb')]);router[_0x47d1('0xc')]('/',auth[_0x47d1('0x8')](),controller[_0x47d1('0xd')]);router[_0x47d1('0xe')](_0x47d1('0xa'),auth['isAuthenticated'](),controller[_0x47d1('0xf')]);router[_0x47d1('0x10')](_0x47d1('0xa'),auth[_0x47d1('0x8')](),controller[_0x47d1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1756128..603ad5b 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 _0x8f51=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x3f8b99,_0x498c90){var _0xa3feac=function(_0x396390){while(--_0x396390){_0x3f8b99['push'](_0x3f8b99['shift']());}};_0xa3feac(++_0x498c90);}(_0x8f51,0xdd));var _0x18f5=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x8f51[_0x5e6cb8];return _0x3faeb3;};'use strict';var Sequelize=require(_0x18f5('0x0'));module[_0x18f5('0x1')]={'type':{'type':Sequelize[_0x18f5('0x2')](_0x18f5('0x3'),_0x18f5('0x4'),_0x18f5('0x5'),_0x18f5('0x6'),_0x18f5('0x7')),'defaultValue':_0x18f5('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x18f5('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x18f5('0x3'),_0x18f5('0x4'),_0x18f5('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x18f5('0x8')]},'nameField':{'type':Sequelize[_0x18f5('0x8')]},'customField':{'type':Sequelize[_0x18f5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18f5('0x8')]}}; \ No newline at end of file +var _0x8e88=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x8e88,0x1cd));var _0x88e8=function(_0x122e9b,_0x391bf4){_0x122e9b=_0x122e9b-0x0;var _0x22c247=_0x8e88[_0x122e9b];return _0x22c247;};'use strict';var Sequelize=require(_0x88e8('0x0'));module[_0x88e8('0x1')]={'type':{'type':Sequelize[_0x88e8('0x2')]('string','variable',_0x88e8('0x3'),_0x88e8('0x4'),_0x88e8('0x5')),'defaultValue':_0x88e8('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x88e8('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x88e8('0x8'),_0x88e8('0x3'))},'keyContent':{'type':Sequelize[_0x88e8('0x7')]},'idField':{'type':Sequelize[_0x88e8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x88e8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88e8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 114b6a1..c83988a 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 _0xf109=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','FreshdeskField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3e5425,_0x39ca9c){var _0x14fcd3=function(_0x14f14d){while(--_0x14f14d){_0x3e5425['push'](_0x3e5425['shift']());}};_0x14fcd3(++_0x39ca9c);}(_0xf109,0xce));var _0x9f10=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xf109[_0x19b3f9];return _0x18c3f6;};'use strict';var emlformat=require(_0x9f10('0x0'));var rimraf=require(_0x9f10('0x1'));var zipdir=require(_0x9f10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f10('0x3'));var Mustache=require(_0x9f10('0x4'));var util=require(_0x9f10('0x5'));var path=require(_0x9f10('0x6'));var sox=require(_0x9f10('0x7'));var csv=require(_0x9f10('0x8'));var ejs=require(_0x9f10('0x9'));var fs=require('fs');var fs_extra=require(_0x9f10('0xa'));var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x8'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var licenseUtil=require(_0x9f10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x289164,_0x260606){_0x260606=_0x260606||0xcc;return function(_0x35c529){if(_0x35c529){return _0x289164['sendStatus'](_0x260606);}return _0x289164[_0x9f10('0x18')](_0x260606)[_0x9f10('0x19')]();};}function respondWithResult(_0x5be443,_0x40a48a){_0x40a48a=_0x40a48a||0xc8;return function(_0x236e28){if(_0x236e28){return _0x5be443['status'](_0x40a48a)['json'](_0x236e28);}};}function respondWithFilteredResult(_0x2b6c4c,_0x177918){return function(_0x549217){if(_0x549217){var _0x11154b=typeof _0x177918['offset']===_0x9f10('0x1a')&&typeof _0x177918[_0x9f10('0x1b')]==='undefined';var _0x11cc56=_0x549217[_0x9f10('0x1c')];var _0x509fba=_0x11154b?0x0:_0x177918[_0x9f10('0x1d')];var _0x53bfbd=_0x11154b?_0x549217[_0x9f10('0x1c')]:_0x177918['offset']+_0x177918[_0x9f10('0x1b')];var _0x56fb44;if(_0x53bfbd>=_0x11cc56){_0x53bfbd=_0x11cc56;_0x56fb44=0xc8;}else{_0x56fb44=0xce;}_0x2b6c4c['status'](_0x56fb44);return _0x2b6c4c[_0x9f10('0x1e')](_0x9f10('0x1f'),_0x509fba+'-'+_0x53bfbd+'/'+_0x11cc56)[_0x9f10('0x20')](_0x549217);}return null;};}function patchUpdates(_0x3a78be){return function(_0xa810c){try{jsonpatch[_0x9f10('0x21')](_0xa810c,_0x3a78be,!![]);}catch(_0x27843d){return BPromise['reject'](_0x27843d);}return _0xa810c[_0x9f10('0x22')]();};}function saveUpdates(_0x58e6ba,_0x293990){return function(_0x36ace4){if(_0x36ace4){return _0x36ace4[_0x9f10('0x23')](_0x58e6ba)['then'](function(_0x2f31fb){return _0x2f31fb;});}return null;};}function removeEntity(_0x3dde2e,_0x213567){return function(_0x4d21c5){if(_0x4d21c5){return _0x4d21c5[_0x9f10('0x24')]()[_0x9f10('0x25')](function(){_0x3dde2e[_0x9f10('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec07d,_0x23c2e7){return function(_0x11cae7){if(!_0x11cae7){_0x2ec07d[_0x9f10('0x26')](0x194);}return _0x11cae7;};}function handleError(_0x5e80de,_0x57539b){_0x57539b=_0x57539b||0x1f4;return function(_0x5c1800){logger[_0x9f10('0x27')](_0x5c1800['stack']);if(_0x5c1800[_0x9f10('0x28')]){delete _0x5c1800[_0x9f10('0x28')];}_0x5e80de[_0x9f10('0x18')](_0x57539b)[_0x9f10('0x29')](_0x5c1800);};}exports[_0x9f10('0x2a')]=function(_0x4f6b0c,_0x522805){var _0x22814f={},_0x40f96b={},_0xfbb37f={'count':0x0,'rows':[]};var _0x181aec=_[_0x9f10('0x2b')](db['FreshdeskField'][_0x9f10('0x2c')],function(_0x501ee){return{'name':_0x501ee[_0x9f10('0x2d')],'type':_0x501ee[_0x9f10('0x2e')]['key']};});_0x40f96b[_0x9f10('0x2f')]=_[_0x9f10('0x2b')](_0x181aec,_0x9f10('0x28'));_0x40f96b['query']=_[_0x9f10('0x30')](_0x4f6b0c['query']);_0x40f96b[_0x9f10('0x31')]=_[_0x9f10('0x32')](_0x40f96b[_0x9f10('0x2f')],_0x40f96b['query']);_0x22814f[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0x40f96b[_0x9f10('0x2f')],qs[_0x9f10('0x34')](_0x4f6b0c[_0x9f10('0x35')]['fields']));_0x22814f[_0x9f10('0x33')]=_0x22814f['attributes'][_0x9f10('0x36')]?_0x22814f[_0x9f10('0x33')]:_0x40f96b[_0x9f10('0x2f')];if(!_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x37')](_0x9f10('0x38'))){_0x22814f['limit']=qs[_0x9f10('0x1b')](_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x1b')]);_0x22814f['offset']=qs[_0x9f10('0x1d')](_0x4f6b0c[_0x9f10('0x35')]['offset']);}_0x22814f[_0x9f10('0x39')]=qs['sort'](_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x3a')]);_0x22814f[_0x9f10('0x3b')]=qs[_0x9f10('0x31')](_[_0x9f10('0x3c')](_0x4f6b0c[_0x9f10('0x35')],_0x40f96b[_0x9f10('0x31')]),_0x181aec);if(_0x4f6b0c[_0x9f10('0x35')]['filter']){_0x22814f[_0x9f10('0x3b')]=_[_0x9f10('0x3d')](_0x22814f[_0x9f10('0x3b')],{'$or':_['map'](_0x181aec,function(_0x233bab){if(_0x233bab[_0x9f10('0x2e')]!=='VIRTUAL'){var _0x30b04b={};_0x30b04b[_0x233bab[_0x9f10('0x28')]]={'$like':'%'+_0x4f6b0c[_0x9f10('0x35')]['filter']+'%'};return _0x30b04b;}})});}_0x22814f=_['merge']({},_0x22814f,_0x4f6b0c[_0x9f10('0x3e')]);var _0x2ff98d={'where':_0x22814f[_0x9f10('0x3b')]};return db[_0x9f10('0x3f')][_0x9f10('0x1c')](_0x2ff98d)[_0x9f10('0x25')](function(_0x15929f){_0xfbb37f[_0x9f10('0x1c')]=_0x15929f;if(_0x4f6b0c[_0x9f10('0x35')][_0x9f10('0x40')]){_0x22814f[_0x9f10('0x41')]=[{'all':!![]}];}return db[_0x9f10('0x3f')]['findAll'](_0x22814f);})['then'](function(_0x4bb805){_0xfbb37f[_0x9f10('0x42')]=_0x4bb805;return _0xfbb37f;})['then'](respondWithFilteredResult(_0x522805,_0x22814f))[_0x9f10('0x43')](handleError(_0x522805,null));};exports[_0x9f10('0x44')]=function(_0x426d30,_0x47d25c){var _0x3cfce6={'raw':!![],'where':{'id':_0x426d30[_0x9f10('0x45')]['id']}},_0xf1164={};_0xf1164[_0x9f10('0x2f')]=_[_0x9f10('0x30')](db['FreshdeskField']['rawAttributes']);_0xf1164['query']=_[_0x9f10('0x30')](_0x426d30['query']);_0xf1164[_0x9f10('0x31')]=_['intersection'](_0xf1164[_0x9f10('0x2f')],_0xf1164[_0x9f10('0x35')]);_0x3cfce6[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0xf1164['model'],qs[_0x9f10('0x34')](_0x426d30[_0x9f10('0x35')]['fields']));_0x3cfce6[_0x9f10('0x33')]=_0x3cfce6[_0x9f10('0x33')][_0x9f10('0x36')]?_0x3cfce6[_0x9f10('0x33')]:_0xf1164[_0x9f10('0x2f')];if(_0x426d30[_0x9f10('0x35')][_0x9f10('0x40')]){_0x3cfce6[_0x9f10('0x41')]=[{'all':!![]}];}_0x3cfce6=_[_0x9f10('0x3d')]({},_0x3cfce6,_0x426d30[_0x9f10('0x3e')]);return db['FreshdeskField'][_0x9f10('0x46')](_0x3cfce6)[_0x9f10('0x25')](handleEntityNotFound(_0x47d25c,null))['then'](respondWithResult(_0x47d25c,null))[_0x9f10('0x43')](handleError(_0x47d25c,null));};exports[_0x9f10('0x47')]=function(_0x1cf3eb,_0x1807b3){return db['FreshdeskField'][_0x9f10('0x47')](_0x1cf3eb[_0x9f10('0x48')],{})[_0x9f10('0x25')](respondWithResult(_0x1807b3,0xc9))[_0x9f10('0x43')](handleError(_0x1807b3,null));};exports[_0x9f10('0x23')]=function(_0x43cb31,_0x479b46){if(_0x43cb31[_0x9f10('0x48')]['id']){delete _0x43cb31[_0x9f10('0x48')]['id'];}return db[_0x9f10('0x3f')][_0x9f10('0x46')]({'where':{'id':_0x43cb31[_0x9f10('0x45')]['id']}})[_0x9f10('0x25')](handleEntityNotFound(_0x479b46,null))['then'](saveUpdates(_0x43cb31[_0x9f10('0x48')],null))[_0x9f10('0x25')](respondWithResult(_0x479b46,null))[_0x9f10('0x43')](handleError(_0x479b46,null));};exports[_0x9f10('0x24')]=function(_0x39dae3,_0x15d676){return db[_0x9f10('0x3f')][_0x9f10('0x46')]({'where':{'id':_0x39dae3['params']['id']}})[_0x9f10('0x25')](handleEntityNotFound(_0x15d676,null))['then'](removeEntity(_0x15d676,null))[_0x9f10('0x43')](handleError(_0x15d676,null));}; \ No newline at end of file +var _0x55ea=['sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x55ea,0xc9));var _0xa55e=function(_0xdf2e11,_0x10b199){_0xdf2e11=_0xdf2e11-0x0;var _0x786582=_0x55ea[_0xdf2e11];return _0x786582;};'use strict';var emlformat=require(_0xa55e('0x0'));var rimraf=require(_0xa55e('0x1'));var zipdir=require(_0xa55e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa55e('0x3'));var moment=require(_0xa55e('0x4'));var BPromise=require(_0xa55e('0x5'));var Mustache=require(_0xa55e('0x6'));var util=require(_0xa55e('0x7'));var path=require('path');var sox=require(_0xa55e('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(_0xa55e('0x9'));var crypto=require(_0xa55e('0xa'));var jsforce=require(_0xa55e('0xb'));var deskjs=require(_0xa55e('0xc'));var toCsv=require(_0xa55e('0xd'));var querystring=require(_0xa55e('0xe'));var Papa=require(_0xa55e('0xf'));var Redis=require(_0xa55e('0x10'));var authService=require(_0xa55e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa55e('0x12'));var logger=require(_0xa55e('0x13'))(_0xa55e('0x14'));var utils=require(_0xa55e('0x15'));var config=require(_0xa55e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa55e('0x17'))['db'];function respondWithStatusCode(_0x5b69cc,_0x3f5178){_0x3f5178=_0x3f5178||0xcc;return function(_0x1d45c1){if(_0x1d45c1){return _0x5b69cc[_0xa55e('0x18')](_0x3f5178);}return _0x5b69cc[_0xa55e('0x19')](_0x3f5178)[_0xa55e('0x1a')]();};}function respondWithResult(_0x20e138,_0x15a283){_0x15a283=_0x15a283||0xc8;return function(_0x27746c){if(_0x27746c){return _0x20e138[_0xa55e('0x19')](_0x15a283)['json'](_0x27746c);}};}function respondWithFilteredResult(_0x1fcee6,_0x30738d){return function(_0x25fa30){if(_0x25fa30){var _0x12895e=typeof _0x30738d[_0xa55e('0x1b')]===_0xa55e('0x1c')&&typeof _0x30738d['limit']===_0xa55e('0x1c');var _0x5dbfe6=_0x25fa30['count'];var _0x4599b9=_0x12895e?0x0:_0x30738d[_0xa55e('0x1b')];var _0x30854e=_0x12895e?_0x25fa30[_0xa55e('0x1d')]:_0x30738d[_0xa55e('0x1b')]+_0x30738d['limit'];var _0x42d2d0;if(_0x30854e>=_0x5dbfe6){_0x30854e=_0x5dbfe6;_0x42d2d0=0xc8;}else{_0x42d2d0=0xce;}_0x1fcee6['status'](_0x42d2d0);return _0x1fcee6['set'](_0xa55e('0x1e'),_0x4599b9+'-'+_0x30854e+'/'+_0x5dbfe6)[_0xa55e('0x1f')](_0x25fa30);}return null;};}function patchUpdates(_0x262f6c){return function(_0x1033c0){try{jsonpatch[_0xa55e('0x20')](_0x1033c0,_0x262f6c,!![]);}catch(_0x438707){return BPromise[_0xa55e('0x21')](_0x438707);}return _0x1033c0[_0xa55e('0x22')]();};}function saveUpdates(_0x9594a3,_0x5b0e74){return function(_0x53a2f9){if(_0x53a2f9){return _0x53a2f9[_0xa55e('0x23')](_0x9594a3)['then'](function(_0xaaf2f1){return _0xaaf2f1;});}return null;};}function removeEntity(_0x31c4ac,_0x801fec){return function(_0x2842a6){if(_0x2842a6){return _0x2842a6[_0xa55e('0x24')]()[_0xa55e('0x25')](function(){_0x31c4ac[_0xa55e('0x19')](0xcc)[_0xa55e('0x1a')]();});}};}function handleEntityNotFound(_0x231333,_0x3627e8){return function(_0x3c519d){if(!_0x3c519d){_0x231333[_0xa55e('0x18')](0x194);}return _0x3c519d;};}function handleError(_0xa05c41,_0x25142c){_0x25142c=_0x25142c||0x1f4;return function(_0xa57293){logger[_0xa55e('0x26')](_0xa57293[_0xa55e('0x27')]);if(_0xa57293[_0xa55e('0x28')]){delete _0xa57293[_0xa55e('0x28')];}_0xa05c41['status'](_0x25142c)['send'](_0xa57293);};}exports[_0xa55e('0x29')]=function(_0x4ebcbd,_0x286f95){var _0x58fc30={},_0x2fe4e9={},_0x4d9634={'count':0x0,'rows':[]};var _0x2758ca=_['map'](db[_0xa55e('0x2a')][_0xa55e('0x2b')],function(_0x4a03ef){return{'name':_0x4a03ef[_0xa55e('0x2c')],'type':_0x4a03ef[_0xa55e('0x2d')][_0xa55e('0x2e')]};});_0x2fe4e9[_0xa55e('0x2f')]=_['map'](_0x2758ca,_0xa55e('0x28'));_0x2fe4e9[_0xa55e('0x30')]=_['keys'](_0x4ebcbd[_0xa55e('0x30')]);_0x2fe4e9[_0xa55e('0x31')]=_[_0xa55e('0x32')](_0x2fe4e9[_0xa55e('0x2f')],_0x2fe4e9['query']);_0x58fc30[_0xa55e('0x33')]=_['intersection'](_0x2fe4e9[_0xa55e('0x2f')],qs['fields'](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x34')]));_0x58fc30[_0xa55e('0x33')]=_0x58fc30[_0xa55e('0x33')]['length']?_0x58fc30[_0xa55e('0x33')]:_0x2fe4e9['model'];if(!_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x35')](_0xa55e('0x36'))){_0x58fc30['limit']=qs[_0xa55e('0x37')](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x37')]);_0x58fc30[_0xa55e('0x1b')]=qs[_0xa55e('0x1b')](_0x4ebcbd[_0xa55e('0x30')]['offset']);}_0x58fc30['order']=qs[_0xa55e('0x38')](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x38')]);_0x58fc30[_0xa55e('0x39')]=qs[_0xa55e('0x31')](_[_0xa55e('0x3a')](_0x4ebcbd[_0xa55e('0x30')],_0x2fe4e9['filters']),_0x2758ca);if(_0x4ebcbd['query'][_0xa55e('0x3b')]){_0x58fc30[_0xa55e('0x39')]=_[_0xa55e('0x3c')](_0x58fc30[_0xa55e('0x39')],{'$or':_[_0xa55e('0x3d')](_0x2758ca,function(_0x41444d){if(_0x41444d[_0xa55e('0x2d')]!==_0xa55e('0x3e')){var _0x29e0c2={};_0x29e0c2[_0x41444d[_0xa55e('0x28')]]={'$like':'%'+_0x4ebcbd[_0xa55e('0x30')]['filter']+'%'};return _0x29e0c2;}})});}_0x58fc30=_[_0xa55e('0x3c')]({},_0x58fc30,_0x4ebcbd[_0xa55e('0x3f')]);var _0x2982db={'where':_0x58fc30['where']};return db[_0xa55e('0x2a')]['count'](_0x2982db)[_0xa55e('0x25')](function(_0x4e97de){_0x4d9634[_0xa55e('0x1d')]=_0x4e97de;if(_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x40')]){_0x58fc30[_0xa55e('0x41')]=[{'all':!![]}];}return db[_0xa55e('0x2a')]['findAll'](_0x58fc30);})['then'](function(_0x3d9fe9){_0x4d9634[_0xa55e('0x42')]=_0x3d9fe9;return _0x4d9634;})[_0xa55e('0x25')](respondWithFilteredResult(_0x286f95,_0x58fc30))['catch'](handleError(_0x286f95,null));};exports[_0xa55e('0x43')]=function(_0x2d4d27,_0x1c7d18){var _0xb43d62={'raw':!![],'where':{'id':_0x2d4d27[_0xa55e('0x44')]['id']}},_0x43c887={};_0x43c887[_0xa55e('0x2f')]=_[_0xa55e('0x45')](db['FreshdeskField']['rawAttributes']);_0x43c887[_0xa55e('0x30')]=_[_0xa55e('0x45')](_0x2d4d27[_0xa55e('0x30')]);_0x43c887[_0xa55e('0x31')]=_[_0xa55e('0x32')](_0x43c887[_0xa55e('0x2f')],_0x43c887[_0xa55e('0x30')]);_0xb43d62[_0xa55e('0x33')]=_['intersection'](_0x43c887['model'],qs[_0xa55e('0x34')](_0x2d4d27['query'][_0xa55e('0x34')]));_0xb43d62['attributes']=_0xb43d62['attributes'][_0xa55e('0x46')]?_0xb43d62[_0xa55e('0x33')]:_0x43c887['model'];if(_0x2d4d27['query'][_0xa55e('0x40')]){_0xb43d62[_0xa55e('0x41')]=[{'all':!![]}];}_0xb43d62=_[_0xa55e('0x3c')]({},_0xb43d62,_0x2d4d27[_0xa55e('0x3f')]);return db[_0xa55e('0x2a')][_0xa55e('0x47')](_0xb43d62)['then'](handleEntityNotFound(_0x1c7d18,null))['then'](respondWithResult(_0x1c7d18,null))[_0xa55e('0x48')](handleError(_0x1c7d18,null));};exports[_0xa55e('0x49')]=function(_0x31458d,_0x259cb3){return db[_0xa55e('0x2a')][_0xa55e('0x49')](_0x31458d['body'],{})[_0xa55e('0x25')](respondWithResult(_0x259cb3,0xc9))[_0xa55e('0x48')](handleError(_0x259cb3,null));};exports[_0xa55e('0x23')]=function(_0x1de3a8,_0x338018){if(_0x1de3a8[_0xa55e('0x4a')]['id']){delete _0x1de3a8['body']['id'];}return db['FreshdeskField'][_0xa55e('0x47')]({'where':{'id':_0x1de3a8['params']['id']}})[_0xa55e('0x25')](handleEntityNotFound(_0x338018,null))['then'](saveUpdates(_0x1de3a8[_0xa55e('0x4a')],null))[_0xa55e('0x25')](respondWithResult(_0x338018,null))[_0xa55e('0x48')](handleError(_0x338018,null));};exports[_0xa55e('0x24')]=function(_0x2c35a8,_0x63aa32){return db[_0xa55e('0x2a')][_0xa55e('0x47')]({'where':{'id':_0x2c35a8['params']['id']}})[_0xa55e('0x25')](handleEntityNotFound(_0x63aa32,null))[_0xa55e('0x25')](removeEntity(_0x63aa32,null))[_0xa55e('0x48')](handleError(_0x63aa32,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 1943829..ab1a0d6 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 _0x3e7c=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x3d5cd7,_0x3cb6d8){var _0x275da4=function(_0x92dbc1){while(--_0x92dbc1){_0x3d5cd7['push'](_0x3d5cd7['shift']());}};_0x275da4(++_0x3cb6d8);}(_0x3e7c,0x136));var _0xc3e7=function(_0x70b1d3,_0x26c29f){_0x70b1d3=_0x70b1d3-0x0;var _0x5d23a0=_0x3e7c[_0x70b1d3];return _0x5d23a0;};'use strict';var _=require(_0xc3e7('0x0'));var util=require(_0xc3e7('0x1'));var logger=require(_0xc3e7('0x2'))('api');var moment=require(_0xc3e7('0x3'));var BPromise=require(_0xc3e7('0x4'));var rp=require(_0xc3e7('0x5'));var fs=require('fs');var path=require(_0xc3e7('0x6'));var rimraf=require(_0xc3e7('0x7'));var config=require(_0xc3e7('0x8'));var attributes=require(_0xc3e7('0x9'));module['exports']=function(_0x462d29,_0x1faf3f){return _0x462d29[_0xc3e7('0xa')](_0xc3e7('0xb'),attributes,{'tableName':_0xc3e7('0xc'),'paranoid':![],'indexes':[{'name':_0xc3e7('0xd'),'fields':[_0xc3e7('0xe'),_0xc3e7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65e9=['define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x54151d,_0x580fdc){var _0x5d97dd=function(_0x6b5663){while(--_0x6b5663){_0x54151d['push'](_0x54151d['shift']());}};_0x5d97dd(++_0x580fdc);}(_0x65e9,0x15e));var _0x965e=function(_0x442e97,_0x69b353){_0x442e97=_0x442e97-0x0;var _0x5c2ba2=_0x65e9[_0x442e97];return _0x5c2ba2;};'use strict';var _=require(_0x965e('0x0'));var util=require(_0x965e('0x1'));var logger=require('../../config/logger')(_0x965e('0x2'));var moment=require(_0x965e('0x3'));var BPromise=require(_0x965e('0x4'));var rp=require(_0x965e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x965e('0x6'));var config=require(_0x965e('0x7'));var attributes=require(_0x965e('0x8'));module[_0x965e('0x9')]=function(_0x32e6ad,_0x363e45){return _0x32e6ad[_0x965e('0xa')](_0x965e('0xb'),attributes,{'tableName':_0x965e('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x965e('0xd'),_0x965e('0xe')],'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 7ef421c..41c6d3e 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 _0xb87f=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment'];(function(_0x2e7c81,_0x2df2b5){var _0x5e351c=function(_0x65600e){while(--_0x65600e){_0x2e7c81['push'](_0x2e7c81['shift']());}};_0x5e351c(++_0x2df2b5);}(_0xb87f,0xa7));var _0xfb87=function(_0x174fae,_0x5d7bad){_0x174fae=_0x174fae-0x0;var _0x5d8970=_0xb87f[_0x174fae];return _0x5d8970;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfb87('0x0'));var BPromise=require(_0xfb87('0x1'));var rs=require(_0xfb87('0x2'));var fs=require('fs');var Redis=require(_0xfb87('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb87('0x4'));var logger=require(_0xfb87('0x5'))(_0xfb87('0x6'));var config=require(_0xfb87('0x7'));var jayson=require(_0xfb87('0x8'));var client=jayson[_0xfb87('0x9')][_0xfb87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x349425,_0x19710e,_0x314712){return new BPromise(function(_0x453410,_0x1842b1){return client[_0xfb87('0xb')](_0x349425,_0x314712)['then'](function(_0x11051a){logger[_0xfb87('0xc')](_0xfb87('0xd'),_0x19710e,_0xfb87('0xe'));logger[_0xfb87('0xf')](_0xfb87('0x10'),_0x19710e,_0xfb87('0xe'),JSON['stringify'](_0x11051a));if(_0x11051a[_0xfb87('0x11')]){if(_0x11051a[_0xfb87('0x11')][_0xfb87('0x12')]===0x1f4){logger['error'](_0xfb87('0xd'),_0x19710e,_0x11051a[_0xfb87('0x11')][_0xfb87('0x13')]);return _0x1842b1(_0x11051a[_0xfb87('0x11')][_0xfb87('0x13')]);}logger[_0xfb87('0x11')](_0xfb87('0xd'),_0x19710e,_0x11051a[_0xfb87('0x11')][_0xfb87('0x13')]);return _0x453410(_0x11051a['error'][_0xfb87('0x13')]);}else{logger[_0xfb87('0xc')](_0xfb87('0xd'),_0x19710e,_0xfb87('0xe'));_0x453410(_0x11051a['result'][_0xfb87('0x13')]);}})[_0xfb87('0x14')](function(_0x5de776){logger[_0xfb87('0x11')](_0xfb87('0xd'),_0x19710e,_0x5de776);_0x1842b1(_0x5de776);});});} \ No newline at end of file +var _0x9e96=['FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x44daa1,_0x1487db){var _0x460e27=function(_0x384fbb){while(--_0x384fbb){_0x44daa1['push'](_0x44daa1['shift']());}};_0x460e27(++_0x1487db);}(_0x9e96,0x75));var _0x69e9=function(_0x2f8bb6,_0x37f7fd){_0x2f8bb6=_0x2f8bb6-0x0;var _0x2afd3e=_0x9e96[_0x2f8bb6];return _0x2afd3e;};'use strict';var _=require(_0x69e9('0x0'));var util=require(_0x69e9('0x1'));var moment=require(_0x69e9('0x2'));var BPromise=require(_0x69e9('0x3'));var rs=require(_0x69e9('0x4'));var fs=require('fs');var Redis=require(_0x69e9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x69e9('0x6'));var logger=require(_0x69e9('0x7'))(_0x69e9('0x8'));var config=require(_0x69e9('0x9'));var jayson=require(_0x69e9('0xa'));var client=jayson[_0x69e9('0xb')][_0x69e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b7b06,_0x4be99d,_0x227399){return new BPromise(function(_0x334bef,_0x5cd03a){return client[_0x69e9('0xd')](_0x2b7b06,_0x227399)['then'](function(_0x403e55){logger[_0x69e9('0xe')](_0x69e9('0xf'),_0x4be99d,_0x69e9('0x10'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4be99d,'request\x20sent',JSON[_0x69e9('0x11')](_0x403e55));if(_0x403e55[_0x69e9('0x12')]){if(_0x403e55[_0x69e9('0x12')][_0x69e9('0x13')]===0x1f4){logger[_0x69e9('0x12')](_0x69e9('0xf'),_0x4be99d,_0x403e55[_0x69e9('0x12')]['message']);return _0x5cd03a(_0x403e55['error'][_0x69e9('0x14')]);}logger[_0x69e9('0x12')](_0x69e9('0xf'),_0x4be99d,_0x403e55[_0x69e9('0x12')]['message']);return _0x334bef(_0x403e55['error']['message']);}else{logger[_0x69e9('0xe')](_0x69e9('0xf'),_0x4be99d,_0x69e9('0x10'));_0x334bef(_0x403e55['result'][_0x69e9('0x14')]);}})[_0x69e9('0x15')](function(_0x4a9326){logger['error'](_0x69e9('0xf'),_0x4be99d,_0x4a9326);_0x5cd03a(_0x4a9326);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9a08d6d..fcd8124 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 _0x9ffd=['../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x49ccd0,_0x314233){_0x49ccd0=_0x49ccd0-0x0;var _0x38ef4a=_0x9ffd[_0x49ccd0];return _0x38ef4a;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x10')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x12')]);router['put']('/:id',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller['destroy']);module[_0xd9ff('0x15')]=router; \ No newline at end of file +var _0x4cf8=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration'];(function(_0xb0ef7a,_0x50e969){var _0x58d66b=function(_0x26bfc4){while(--_0x26bfc4){_0xb0ef7a['push'](_0xb0ef7a['shift']());}};_0x58d66b(++_0x50e969);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x5c1449,_0x2af4b4){_0x5c1449=_0x5c1449-0x0;var _0x270473=_0x4cf8[_0x5c1449];return _0x270473;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['getConfigurations']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x11')]);router['post']('/:id/configurations',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0x14'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x15')]);router[_0x84cf('0x16')](_0x84cf('0x14'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x17')]);module[_0x84cf('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9fa90fa..74f08da 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 _0x2542=['remoteUri','sequelize','exports','STRING','username'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2542,0x169));var _0x2254=function(_0x45900c,_0xa38510){_0x45900c=_0x45900c-0x0;var _0x28d6c8=_0x2542[_0x45900c];return _0x28d6c8;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')]},'description':{'type':Sequelize[_0x2254('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2254('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2254('0x2')],'unique':_0x2254('0x4')},'serverUrl':{'type':Sequelize[_0x2254('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5b12,0xa3));var _0x25b1=function(_0x28b51f,_0x5950a4){_0x28b51f=_0x28b51f-0x0;var _0x376b4e=_0x5b12[_0x28b51f];return _0x376b4e;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('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 9da9ebd..5a9c0b6 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 _0xc3b4=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params','length','merge','find','create','body','FreshsalesConfiguration','rawAttributes','order','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesField','Descriptions','getFields','findOne','username','remoteUri','apiKey','slice','substring','/api/selector/owners','users','Requested\x20Resource\x20not\x20Found','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x536f83,_0x41978f){var _0x5853b9=function(_0xa8d445){while(--_0xa8d445){_0x536f83['push'](_0x536f83['shift']());}};_0x5853b9(++_0x41978f);}(_0xc3b4,0x113));var _0x4c3b=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0xc3b4[_0x34c027];return _0x47bff0;};'use strict';var emlformat=require(_0x4c3b('0x0'));var rimraf=require(_0x4c3b('0x1'));var zipdir=require(_0x4c3b('0x2'));var jsonpatch=require(_0x4c3b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c3b('0x4'));var Mustache=require(_0x4c3b('0x5'));var util=require(_0x4c3b('0x6'));var path=require(_0x4c3b('0x7'));var sox=require(_0x4c3b('0x8'));var csv=require(_0x4c3b('0x9'));var ejs=require(_0x4c3b('0xa'));var fs=require('fs');var fs_extra=require(_0x4c3b('0xb'));var _=require(_0x4c3b('0xc'));var squel=require(_0x4c3b('0xd'));var crypto=require(_0x4c3b('0xe'));var jsforce=require(_0x4c3b('0xf'));var deskjs=require(_0x4c3b('0x10'));var toCsv=require(_0x4c3b('0x9'));var querystring=require(_0x4c3b('0x11'));var Papa=require(_0x4c3b('0x12'));var Redis=require(_0x4c3b('0x13'));var authService=require(_0x4c3b('0x14'));var qs=require(_0x4c3b('0x15'));var as=require(_0x4c3b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c3b('0x17'))(_0x4c3b('0x18'));var utils=require(_0x4c3b('0x19'));var config=require(_0x4c3b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c3b('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x298573,_0x2fe83c){_0x2fe83c=_0x2fe83c||0xcc;return function(_0x1c251f){if(_0x1c251f){return _0x298573[_0x4c3b('0x1c')](_0x2fe83c);}return _0x298573[_0x4c3b('0x1d')](_0x2fe83c)['end']();};}function respondWithResult(_0x33355c,_0xb27a5d){_0xb27a5d=_0xb27a5d||0xc8;return function(_0x19aac4){if(_0x19aac4){return _0x33355c['status'](_0xb27a5d)[_0x4c3b('0x1e')](_0x19aac4);}};}function respondWithFilteredResult(_0x2ffc68,_0x53709c){return function(_0x5ea98f){if(_0x5ea98f){var _0x31be29=typeof _0x53709c[_0x4c3b('0x1f')]===_0x4c3b('0x20')&&typeof _0x53709c['limit']==='undefined';var _0x3b5477=_0x5ea98f[_0x4c3b('0x21')];var _0x1f3a64=_0x31be29?0x0:_0x53709c[_0x4c3b('0x1f')];var _0x4a4f56=_0x31be29?_0x5ea98f[_0x4c3b('0x21')]:_0x53709c[_0x4c3b('0x1f')]+_0x53709c[_0x4c3b('0x22')];var _0x6aa0f2;if(_0x4a4f56>=_0x3b5477){_0x4a4f56=_0x3b5477;_0x6aa0f2=0xc8;}else{_0x6aa0f2=0xce;}_0x2ffc68[_0x4c3b('0x1d')](_0x6aa0f2);return _0x2ffc68[_0x4c3b('0x23')](_0x4c3b('0x24'),_0x1f3a64+'-'+_0x4a4f56+'/'+_0x3b5477)[_0x4c3b('0x1e')](_0x5ea98f);}return null;};}function patchUpdates(_0x5462ff){return function(_0x1dc6ba){try{jsonpatch[_0x4c3b('0x25')](_0x1dc6ba,_0x5462ff,!![]);}catch(_0xf2cea0){return BPromise[_0x4c3b('0x26')](_0xf2cea0);}return _0x1dc6ba['save']();};}function saveUpdates(_0x591214,_0x5f01d2){return function(_0x45b6b5){if(_0x45b6b5){return _0x45b6b5[_0x4c3b('0x27')](_0x591214)[_0x4c3b('0x28')](function(_0x1cb49e){return _0x1cb49e;});}return null;};}function removeEntity(_0x5698c4,_0x1af8b5){return function(_0x4b4846){if(_0x4b4846){return _0x4b4846[_0x4c3b('0x29')]()['then'](function(){_0x5698c4[_0x4c3b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a27de,_0x12fe08){return function(_0x517345){if(!_0x517345){_0x2a27de[_0x4c3b('0x1c')](0x194);}return _0x517345;};}function handleError(_0x2ddaa8,_0x443f80){_0x443f80=_0x443f80||0x1f4;return function(_0x11a6fe){logger[_0x4c3b('0x2a')](_0x11a6fe[_0x4c3b('0x2b')]);if(_0x11a6fe[_0x4c3b('0x2c')]){delete _0x11a6fe[_0x4c3b('0x2c')];}_0x2ddaa8[_0x4c3b('0x1d')](_0x443f80)[_0x4c3b('0x2d')](_0x11a6fe);};}exports[_0x4c3b('0x2e')]=function(_0x2a9294,_0x401434){var _0x50c2cd={},_0x50e351={},_0x31e7e4={'count':0x0,'rows':[]};var _0x1f4e95=_[_0x4c3b('0x2f')](db[_0x4c3b('0x30')]['rawAttributes'],function(_0x86dddf){return{'name':_0x86dddf['fieldName'],'type':_0x86dddf[_0x4c3b('0x31')][_0x4c3b('0x32')]};});_0x50e351[_0x4c3b('0x33')]=_['map'](_0x1f4e95,_0x4c3b('0x2c'));_0x50e351[_0x4c3b('0x34')]=_[_0x4c3b('0x35')](_0x2a9294[_0x4c3b('0x34')]);_0x50e351[_0x4c3b('0x36')]=_[_0x4c3b('0x37')](_0x50e351[_0x4c3b('0x33')],_0x50e351[_0x4c3b('0x34')]);_0x50c2cd[_0x4c3b('0x38')]=_[_0x4c3b('0x37')](_0x50e351[_0x4c3b('0x33')],qs[_0x4c3b('0x39')](_0x2a9294[_0x4c3b('0x34')]['fields']));_0x50c2cd[_0x4c3b('0x38')]=_0x50c2cd[_0x4c3b('0x38')]['length']?_0x50c2cd[_0x4c3b('0x38')]:_0x50e351[_0x4c3b('0x33')];if(!_0x2a9294[_0x4c3b('0x34')][_0x4c3b('0x3a')]('nolimit')){_0x50c2cd[_0x4c3b('0x22')]=qs[_0x4c3b('0x22')](_0x2a9294[_0x4c3b('0x34')][_0x4c3b('0x22')]);_0x50c2cd[_0x4c3b('0x1f')]=qs[_0x4c3b('0x1f')](_0x2a9294[_0x4c3b('0x34')][_0x4c3b('0x1f')]);}_0x50c2cd['order']=qs[_0x4c3b('0x3b')](_0x2a9294[_0x4c3b('0x34')][_0x4c3b('0x3b')]);_0x50c2cd[_0x4c3b('0x3c')]=qs[_0x4c3b('0x36')](_[_0x4c3b('0x3d')](_0x2a9294[_0x4c3b('0x34')],_0x50e351[_0x4c3b('0x36')]),_0x1f4e95);if(_0x2a9294[_0x4c3b('0x34')][_0x4c3b('0x3e')]){_0x50c2cd['where']=_['merge'](_0x50c2cd['where'],{'$or':_[_0x4c3b('0x2f')](_0x1f4e95,function(_0x24771d){if(_0x24771d[_0x4c3b('0x31')]!==_0x4c3b('0x3f')){var _0x29ee78={};_0x29ee78[_0x24771d[_0x4c3b('0x2c')]]={'$like':'%'+_0x2a9294['query'][_0x4c3b('0x3e')]+'%'};return _0x29ee78;}})});}_0x50c2cd=_['merge']({},_0x50c2cd,_0x2a9294[_0x4c3b('0x40')]);var _0x24d1f2={'where':_0x50c2cd['where']};return db[_0x4c3b('0x30')]['count'](_0x24d1f2)[_0x4c3b('0x28')](function(_0x5d4d10){_0x31e7e4['count']=_0x5d4d10;if(_0x2a9294['query']['includeAll']){_0x50c2cd[_0x4c3b('0x41')]=[{'all':!![]}];}return db[_0x4c3b('0x30')][_0x4c3b('0x42')](_0x50c2cd);})['then'](function(_0x55f20e){_0x31e7e4['rows']=_0x55f20e;return _0x31e7e4;})['then'](respondWithFilteredResult(_0x401434,_0x50c2cd))[_0x4c3b('0x43')](handleError(_0x401434,null));};exports[_0x4c3b('0x44')]=function(_0x3fb483,_0xdb285c){var _0xe5d94b={'raw':![],'where':{'id':_0x3fb483[_0x4c3b('0x45')]['id']}},_0x5ab940={};_0x5ab940[_0x4c3b('0x33')]=_[_0x4c3b('0x35')](db[_0x4c3b('0x30')]['rawAttributes']);_0x5ab940[_0x4c3b('0x34')]=_[_0x4c3b('0x35')](_0x3fb483['query']);_0x5ab940[_0x4c3b('0x36')]=_[_0x4c3b('0x37')](_0x5ab940['model'],_0x5ab940[_0x4c3b('0x34')]);_0xe5d94b[_0x4c3b('0x38')]=_[_0x4c3b('0x37')](_0x5ab940[_0x4c3b('0x33')],qs[_0x4c3b('0x39')](_0x3fb483[_0x4c3b('0x34')][_0x4c3b('0x39')]));_0xe5d94b[_0x4c3b('0x38')]=_0xe5d94b[_0x4c3b('0x38')][_0x4c3b('0x46')]?_0xe5d94b['attributes']:_0x5ab940[_0x4c3b('0x33')];if(_0x3fb483['query']['includeAll']){_0xe5d94b[_0x4c3b('0x41')]=[{'all':!![]}];}_0xe5d94b=_[_0x4c3b('0x47')]({},_0xe5d94b,_0x3fb483[_0x4c3b('0x40')]);return db[_0x4c3b('0x30')][_0x4c3b('0x48')](_0xe5d94b)[_0x4c3b('0x28')](handleEntityNotFound(_0xdb285c,null))[_0x4c3b('0x28')](respondWithResult(_0xdb285c,null))['catch'](handleError(_0xdb285c,null));};exports[_0x4c3b('0x49')]=function(_0x55c527,_0x46d97f){return db[_0x4c3b('0x30')]['create'](_0x55c527[_0x4c3b('0x4a')],{})[_0x4c3b('0x28')](respondWithResult(_0x46d97f,0xc9))['catch'](handleError(_0x46d97f,null));};exports[_0x4c3b('0x27')]=function(_0x345d29,_0x3dec3b){if(_0x345d29['body']['id']){delete _0x345d29[_0x4c3b('0x4a')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x345d29[_0x4c3b('0x45')]['id']}})[_0x4c3b('0x28')](handleEntityNotFound(_0x3dec3b,null))[_0x4c3b('0x28')](saveUpdates(_0x345d29[_0x4c3b('0x4a')],null))[_0x4c3b('0x28')](respondWithResult(_0x3dec3b,null))['catch'](handleError(_0x3dec3b,null));};exports[_0x4c3b('0x29')]=function(_0x360acf,_0x5db4c5){return db[_0x4c3b('0x30')][_0x4c3b('0x48')]({'where':{'id':_0x360acf[_0x4c3b('0x45')]['id']}})[_0x4c3b('0x28')](handleEntityNotFound(_0x5db4c5,null))[_0x4c3b('0x28')](removeEntity(_0x5db4c5,null))[_0x4c3b('0x43')](handleError(_0x5db4c5,null));};exports['getConfigurations']=function(_0x5270c6,_0x5b7744,_0xd47828){var _0xb59f62={};var _0x2d353f={};var _0x3cf7e7;var _0x58cc87;return db[_0x4c3b('0x30')]['findOne']({'where':{'id':_0x5270c6[_0x4c3b('0x45')]['id']}})[_0x4c3b('0x28')](handleEntityNotFound(_0x5b7744,null))[_0x4c3b('0x28')](function(_0x2cb966){if(_0x2cb966){_0x3cf7e7=_0x2cb966;_0x2d353f[_0x4c3b('0x33')]=_['keys'](db[_0x4c3b('0x4b')][_0x4c3b('0x4c')]);_0x2d353f[_0x4c3b('0x34')]=_[_0x4c3b('0x35')](_0x5270c6['query']);_0x2d353f[_0x4c3b('0x36')]=_[_0x4c3b('0x37')](_0x2d353f['model'],_0x2d353f[_0x4c3b('0x34')]);_0xb59f62[_0x4c3b('0x38')]=_['intersection'](_0x2d353f['model'],qs['fields'](_0x5270c6[_0x4c3b('0x34')][_0x4c3b('0x39')]));_0xb59f62[_0x4c3b('0x38')]=_0xb59f62[_0x4c3b('0x38')][_0x4c3b('0x46')]?_0xb59f62[_0x4c3b('0x38')]:_0x2d353f[_0x4c3b('0x33')];_0xb59f62[_0x4c3b('0x4d')]=qs[_0x4c3b('0x3b')](_0x5270c6['query'][_0x4c3b('0x3b')]);_0xb59f62[_0x4c3b('0x3c')]=qs['filters'](_[_0x4c3b('0x3d')](_0x5270c6[_0x4c3b('0x34')],_0x2d353f[_0x4c3b('0x36')]));if(_0x5270c6[_0x4c3b('0x34')]['filter']){_0xb59f62['where']=_[_0x4c3b('0x47')](_0xb59f62['where'],{'$or':_['map'](_0xb59f62[_0x4c3b('0x38')],function(_0x2b416a){var _0x17a4de={};_0x17a4de[_0x2b416a]={'$like':'%'+_0x5270c6[_0x4c3b('0x34')][_0x4c3b('0x3e')]+'%'};return _0x17a4de;})});}_0xb59f62=_['merge']({},_0xb59f62,_0x5270c6[_0x4c3b('0x40')]);return _0x3cf7e7[_0x4c3b('0x4e')](_0xb59f62);}})[_0x4c3b('0x28')](function(_0x23dbb0){if(_0x23dbb0){_0x58cc87=_0x23dbb0[_0x4c3b('0x46')];if(!_0x5270c6[_0x4c3b('0x34')][_0x4c3b('0x3a')](_0x4c3b('0x4f'))){_0xb59f62[_0x4c3b('0x22')]=qs[_0x4c3b('0x22')](_0x5270c6[_0x4c3b('0x34')]['limit']);_0xb59f62[_0x4c3b('0x1f')]=qs[_0x4c3b('0x1f')](_0x5270c6[_0x4c3b('0x34')][_0x4c3b('0x1f')]);}return _0x3cf7e7[_0x4c3b('0x4e')](_0xb59f62);}})[_0x4c3b('0x28')](function(_0x2cd72d){if(_0x2cd72d){return _0x2cd72d?{'count':_0x58cc87,'rows':_0x2cd72d}:null;}})[_0x4c3b('0x28')](respondWithResult(_0x5b7744,null))[_0x4c3b('0x43')](handleError(_0x5b7744,null));};exports[_0x4c3b('0x50')]=function(_0x50fcdc,_0x4fe677,_0x45382c){if(_0x50fcdc[_0x4c3b('0x4a')]['id']){delete _0x50fcdc[_0x4c3b('0x4a')]['id'];}return db[_0x4c3b('0x30')]['findOne']({'where':{'id':_0x50fcdc[_0x4c3b('0x45')]['id']}})['then'](handleEntityNotFound(_0x4fe677,null))[_0x4c3b('0x28')](function(_0x215325){if(_0x215325){_0x50fcdc[_0x4c3b('0x4a')][_0x4c3b('0x51')]=_0x215325['id'];_0x50fcdc['body'][_0x4c3b('0x52')]=integrations[_0x4c3b('0x53')](_0x50fcdc[_0x4c3b('0x4a')][_0x4c3b('0x54')],_0x50fcdc[_0x4c3b('0x4a')][_0x4c3b('0x31')]);_0x50fcdc[_0x4c3b('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x50fcdc[_0x4c3b('0x4a')][_0x4c3b('0x54')],_0x50fcdc[_0x4c3b('0x4a')][_0x4c3b('0x31')]);return db[_0x4c3b('0x4b')][_0x4c3b('0x49')](_0x50fcdc['body'],{'include':[{'model':db[_0x4c3b('0x55')],'as':'Subjects'},{'model':db[_0x4c3b('0x55')],'as':_0x4c3b('0x56')}]});}return null;})['then'](respondWithResult(_0x4fe677,null))[_0x4c3b('0x43')](handleError(_0x4fe677,null));};exports[_0x4c3b('0x57')]=function(_0x4a8115,_0x278f29,_0x5a5a62){var _0x210c10='';var _0x252866='';return db[_0x4c3b('0x30')][_0x4c3b('0x58')]({'where':{'id':_0x4a8115[_0x4c3b('0x45')]['id']},'attributes':['id',_0x4c3b('0x59'),_0x4c3b('0x5a'),_0x4c3b('0x5b')]})[_0x4c3b('0x28')](handleEntityNotFound(_0x278f29,null))['then'](function(_0x58edee){if(_0x58edee){_0x252866=_0x58edee['username'];_0x210c10=_0x58edee['remoteUri'];var _0x569e9b=_0x58edee[_0x4c3b('0x5a')][_0x4c3b('0x5c')](-0x1);if(_0x569e9b==='/'){_0x210c10=_0x210c10[_0x4c3b('0x5d')](0x0,_0x210c10['lastIndexOf'](_0x569e9b));}return rp({'method':'GET','uri':util['format']('%s%s',_0x210c10,_0x4c3b('0x5e')),'headers':{'Authorization':'Token\x20token='+_0x58edee[_0x4c3b('0x5b')]},'json':!![]});}})[_0x4c3b('0x28')](function(_0x574178){if(_0x574178){var _0x45dc91=_0x574178[_0x4c3b('0x5f')];var _0x5017a6=![];var _0x19e583=null;for(_0x19e583=0x0;_0x19e583<_0x45dc91[_0x4c3b('0x46')];_0x19e583++){if(_0x45dc91[_0x19e583]['email']===_0x252866){_0x5017a6=!![];}}if(_0x5017a6){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4c3b('0x60')});}}})['then'](respondWithResult(_0x278f29,null))[_0x4c3b('0x43')](function(_0x410f60){var _0x4220b2=_0x4a8115[_0x4c3b('0x34')][_0x4c3b('0x61')]?0x1f4:_0x410f60[_0x4c3b('0x62')]||0x1f4;logger[_0x4c3b('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x4c3b('0x57'),_0x4220b2,JSON['stringify'](_0x410f60));delete _0x410f60[_0x4c3b('0x2c')];if(_0x4220b2===0x191){_0x4220b2=0x190;}_0x278f29['status'](_0x4220b2)[_0x4c3b('0x2d')](_0x4a8115[_0x4c3b('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x410f60['statusCode']}:_0x410f60);});}; \ No newline at end of file +var _0x9fea=['channel','getDescriptions','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','stringify','statusCode','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','FreshsalesAccount','includeAll','findAll','rows','catch','params','keys','include','create','body','find','getConfigurations','FreshsalesConfiguration','rawAttributes','length','addConfiguration','findOne','AccountId','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fea,0x75));var _0xa9fe=function(_0x4fb7d8,_0x5b68b6){_0x4fb7d8=_0x4fb7d8-0x0;var _0x517bdb=_0x9fea[_0x4fb7d8];return _0x517bdb;};'use strict';var emlformat=require(_0xa9fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9fe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9fe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa9fe('0x3'));var util=require(_0xa9fe('0x4'));var path=require('path');var sox=require(_0xa9fe('0x5'));var csv=require(_0xa9fe('0x6'));var ejs=require(_0xa9fe('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9fe('0x8'));var squel=require(_0xa9fe('0x9'));var crypto=require(_0xa9fe('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa9fe('0xb'));var toCsv=require(_0xa9fe('0x6'));var querystring=require(_0xa9fe('0xc'));var Papa=require(_0xa9fe('0xd'));var Redis=require(_0xa9fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa9fe('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9fe('0x10'))('api');var utils=require(_0xa9fe('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa9fe('0x12'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xcf8acd,_0xe09859){_0xe09859=_0xe09859||0xcc;return function(_0x39d5ed){if(_0x39d5ed){return _0xcf8acd[_0xa9fe('0x13')](_0xe09859);}return _0xcf8acd[_0xa9fe('0x14')](_0xe09859)[_0xa9fe('0x15')]();};}function respondWithResult(_0x41492c,_0x47c336){_0x47c336=_0x47c336||0xc8;return function(_0x477ac9){if(_0x477ac9){return _0x41492c[_0xa9fe('0x14')](_0x47c336)[_0xa9fe('0x16')](_0x477ac9);}};}function respondWithFilteredResult(_0x2528f8,_0xe6ce08){return function(_0xcf8185){if(_0xcf8185){var _0x17216b=typeof _0xe6ce08[_0xa9fe('0x17')]===_0xa9fe('0x18')&&typeof _0xe6ce08['limit']==='undefined';var _0x26a61b=_0xcf8185['count'];var _0x434d60=_0x17216b?0x0:_0xe6ce08[_0xa9fe('0x17')];var _0x40da33=_0x17216b?_0xcf8185[_0xa9fe('0x19')]:_0xe6ce08[_0xa9fe('0x17')]+_0xe6ce08[_0xa9fe('0x1a')];var _0x4b49ec;if(_0x40da33>=_0x26a61b){_0x40da33=_0x26a61b;_0x4b49ec=0xc8;}else{_0x4b49ec=0xce;}_0x2528f8[_0xa9fe('0x14')](_0x4b49ec);return _0x2528f8[_0xa9fe('0x1b')](_0xa9fe('0x1c'),_0x434d60+'-'+_0x40da33+'/'+_0x26a61b)[_0xa9fe('0x16')](_0xcf8185);}return null;};}function patchUpdates(_0x337275){return function(_0x1dcd18){try{jsonpatch['apply'](_0x1dcd18,_0x337275,!![]);}catch(_0x121f60){return BPromise[_0xa9fe('0x1d')](_0x121f60);}return _0x1dcd18[_0xa9fe('0x1e')]();};}function saveUpdates(_0x19f55c,_0xab9207){return function(_0x4e5079){if(_0x4e5079){return _0x4e5079[_0xa9fe('0x1f')](_0x19f55c)[_0xa9fe('0x20')](function(_0x3514c2){return _0x3514c2;});}return null;};}function removeEntity(_0x63c7c,_0x4d3f84){return function(_0x57d80c){if(_0x57d80c){return _0x57d80c[_0xa9fe('0x21')]()[_0xa9fe('0x20')](function(){_0x63c7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e696,_0x5ed9ea){return function(_0x204395){if(!_0x204395){_0x21e696[_0xa9fe('0x13')](0x194);}return _0x204395;};}function handleError(_0xee7e11,_0x47e44d){_0x47e44d=_0x47e44d||0x1f4;return function(_0x188104){logger[_0xa9fe('0x22')](_0x188104['stack']);if(_0x188104[_0xa9fe('0x23')]){delete _0x188104['name'];}_0xee7e11[_0xa9fe('0x14')](_0x47e44d)[_0xa9fe('0x24')](_0x188104);};}exports[_0xa9fe('0x25')]=function(_0x2b613b,_0x596fb9){var _0x12771d={},_0x1d74d7={},_0x3fcfb7={'count':0x0,'rows':[]};var _0x4140ac=_[_0xa9fe('0x26')](db['FreshsalesAccount']['rawAttributes'],function(_0x404ac3){return{'name':_0x404ac3['fieldName'],'type':_0x404ac3[_0xa9fe('0x27')][_0xa9fe('0x28')]};});_0x1d74d7[_0xa9fe('0x29')]=_[_0xa9fe('0x26')](_0x4140ac,'name');_0x1d74d7[_0xa9fe('0x2a')]=_['keys'](_0x2b613b['query']);_0x1d74d7[_0xa9fe('0x2b')]=_[_0xa9fe('0x2c')](_0x1d74d7[_0xa9fe('0x29')],_0x1d74d7[_0xa9fe('0x2a')]);_0x12771d[_0xa9fe('0x2d')]=_[_0xa9fe('0x2c')](_0x1d74d7[_0xa9fe('0x29')],qs[_0xa9fe('0x2e')](_0x2b613b[_0xa9fe('0x2a')][_0xa9fe('0x2e')]));_0x12771d['attributes']=_0x12771d[_0xa9fe('0x2d')]['length']?_0x12771d[_0xa9fe('0x2d')]:_0x1d74d7[_0xa9fe('0x29')];if(!_0x2b613b[_0xa9fe('0x2a')][_0xa9fe('0x2f')]('nolimit')){_0x12771d['limit']=qs[_0xa9fe('0x1a')](_0x2b613b['query'][_0xa9fe('0x1a')]);_0x12771d['offset']=qs['offset'](_0x2b613b[_0xa9fe('0x2a')][_0xa9fe('0x17')]);}_0x12771d[_0xa9fe('0x30')]=qs[_0xa9fe('0x31')](_0x2b613b[_0xa9fe('0x2a')][_0xa9fe('0x31')]);_0x12771d['where']=qs[_0xa9fe('0x2b')](_[_0xa9fe('0x32')](_0x2b613b[_0xa9fe('0x2a')],_0x1d74d7['filters']),_0x4140ac);if(_0x2b613b[_0xa9fe('0x2a')][_0xa9fe('0x33')]){_0x12771d[_0xa9fe('0x34')]=_[_0xa9fe('0x35')](_0x12771d['where'],{'$or':_[_0xa9fe('0x26')](_0x4140ac,function(_0x474431){if(_0x474431['type']!==_0xa9fe('0x36')){var _0x13c827={};_0x13c827[_0x474431[_0xa9fe('0x23')]]={'$like':'%'+_0x2b613b[_0xa9fe('0x2a')][_0xa9fe('0x33')]+'%'};return _0x13c827;}})});}_0x12771d=_['merge']({},_0x12771d,_0x2b613b[_0xa9fe('0x37')]);var _0x93a89f={'where':_0x12771d['where']};return db[_0xa9fe('0x38')][_0xa9fe('0x19')](_0x93a89f)['then'](function(_0x5a8b02){_0x3fcfb7['count']=_0x5a8b02;if(_0x2b613b['query'][_0xa9fe('0x39')]){_0x12771d['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0xa9fe('0x3a')](_0x12771d);})[_0xa9fe('0x20')](function(_0x2e6839){_0x3fcfb7[_0xa9fe('0x3b')]=_0x2e6839;return _0x3fcfb7;})[_0xa9fe('0x20')](respondWithFilteredResult(_0x596fb9,_0x12771d))[_0xa9fe('0x3c')](handleError(_0x596fb9,null));};exports['show']=function(_0x30bc9a,_0xc8dbc1){var _0x2da549={'raw':![],'where':{'id':_0x30bc9a[_0xa9fe('0x3d')]['id']}},_0x3425d8={};_0x3425d8['model']=_[_0xa9fe('0x3e')](db[_0xa9fe('0x38')]['rawAttributes']);_0x3425d8[_0xa9fe('0x2a')]=_[_0xa9fe('0x3e')](_0x30bc9a[_0xa9fe('0x2a')]);_0x3425d8[_0xa9fe('0x2b')]=_['intersection'](_0x3425d8[_0xa9fe('0x29')],_0x3425d8[_0xa9fe('0x2a')]);_0x2da549[_0xa9fe('0x2d')]=_['intersection'](_0x3425d8[_0xa9fe('0x29')],qs['fields'](_0x30bc9a[_0xa9fe('0x2a')][_0xa9fe('0x2e')]));_0x2da549[_0xa9fe('0x2d')]=_0x2da549[_0xa9fe('0x2d')]['length']?_0x2da549[_0xa9fe('0x2d')]:_0x3425d8['model'];if(_0x30bc9a[_0xa9fe('0x2a')][_0xa9fe('0x39')]){_0x2da549[_0xa9fe('0x3f')]=[{'all':!![]}];}_0x2da549=_['merge']({},_0x2da549,_0x30bc9a[_0xa9fe('0x37')]);return db[_0xa9fe('0x38')]['find'](_0x2da549)[_0xa9fe('0x20')](handleEntityNotFound(_0xc8dbc1,null))[_0xa9fe('0x20')](respondWithResult(_0xc8dbc1,null))[_0xa9fe('0x3c')](handleError(_0xc8dbc1,null));};exports['create']=function(_0x4f7cc2,_0x145f2a){return db['FreshsalesAccount'][_0xa9fe('0x40')](_0x4f7cc2['body'],{})[_0xa9fe('0x20')](respondWithResult(_0x145f2a,0xc9))[_0xa9fe('0x3c')](handleError(_0x145f2a,null));};exports[_0xa9fe('0x1f')]=function(_0x2953b9,_0x120dec){if(_0x2953b9[_0xa9fe('0x41')]['id']){delete _0x2953b9['body']['id'];}return db[_0xa9fe('0x38')][_0xa9fe('0x42')]({'where':{'id':_0x2953b9[_0xa9fe('0x3d')]['id']}})[_0xa9fe('0x20')](handleEntityNotFound(_0x120dec,null))[_0xa9fe('0x20')](saveUpdates(_0x2953b9[_0xa9fe('0x41')],null))[_0xa9fe('0x20')](respondWithResult(_0x120dec,null))['catch'](handleError(_0x120dec,null));};exports[_0xa9fe('0x21')]=function(_0x209c24,_0x5b8bca){return db[_0xa9fe('0x38')]['find']({'where':{'id':_0x209c24[_0xa9fe('0x3d')]['id']}})[_0xa9fe('0x20')](handleEntityNotFound(_0x5b8bca,null))[_0xa9fe('0x20')](removeEntity(_0x5b8bca,null))[_0xa9fe('0x3c')](handleError(_0x5b8bca,null));};exports[_0xa9fe('0x43')]=function(_0x5b7796,_0x3c9732,_0x4273cb){var _0x49718d={};var _0x50bb18={};var _0x582058;var _0x2bb3ae;return db[_0xa9fe('0x38')]['findOne']({'where':{'id':_0x5b7796[_0xa9fe('0x3d')]['id']}})[_0xa9fe('0x20')](handleEntityNotFound(_0x3c9732,null))[_0xa9fe('0x20')](function(_0x4f9d99){if(_0x4f9d99){_0x582058=_0x4f9d99;_0x50bb18[_0xa9fe('0x29')]=_['keys'](db[_0xa9fe('0x44')][_0xa9fe('0x45')]);_0x50bb18['query']=_[_0xa9fe('0x3e')](_0x5b7796[_0xa9fe('0x2a')]);_0x50bb18[_0xa9fe('0x2b')]=_['intersection'](_0x50bb18['model'],_0x50bb18[_0xa9fe('0x2a')]);_0x49718d[_0xa9fe('0x2d')]=_[_0xa9fe('0x2c')](_0x50bb18['model'],qs[_0xa9fe('0x2e')](_0x5b7796[_0xa9fe('0x2a')][_0xa9fe('0x2e')]));_0x49718d[_0xa9fe('0x2d')]=_0x49718d[_0xa9fe('0x2d')][_0xa9fe('0x46')]?_0x49718d[_0xa9fe('0x2d')]:_0x50bb18[_0xa9fe('0x29')];_0x49718d[_0xa9fe('0x30')]=qs[_0xa9fe('0x31')](_0x5b7796['query'][_0xa9fe('0x31')]);_0x49718d[_0xa9fe('0x34')]=qs[_0xa9fe('0x2b')](_[_0xa9fe('0x32')](_0x5b7796[_0xa9fe('0x2a')],_0x50bb18[_0xa9fe('0x2b')]));if(_0x5b7796[_0xa9fe('0x2a')][_0xa9fe('0x33')]){_0x49718d[_0xa9fe('0x34')]=_[_0xa9fe('0x35')](_0x49718d[_0xa9fe('0x34')],{'$or':_['map'](_0x49718d[_0xa9fe('0x2d')],function(_0x20e571){var _0x2560ee={};_0x2560ee[_0x20e571]={'$like':'%'+_0x5b7796[_0xa9fe('0x2a')][_0xa9fe('0x33')]+'%'};return _0x2560ee;})});}_0x49718d=_['merge']({},_0x49718d,_0x5b7796[_0xa9fe('0x37')]);return _0x582058[_0xa9fe('0x43')](_0x49718d);}})[_0xa9fe('0x20')](function(_0x260699){if(_0x260699){_0x2bb3ae=_0x260699[_0xa9fe('0x46')];if(!_0x5b7796[_0xa9fe('0x2a')][_0xa9fe('0x2f')]('nolimit')){_0x49718d[_0xa9fe('0x1a')]=qs[_0xa9fe('0x1a')](_0x5b7796[_0xa9fe('0x2a')][_0xa9fe('0x1a')]);_0x49718d['offset']=qs[_0xa9fe('0x17')](_0x5b7796[_0xa9fe('0x2a')][_0xa9fe('0x17')]);}return _0x582058[_0xa9fe('0x43')](_0x49718d);}})[_0xa9fe('0x20')](function(_0x218976){if(_0x218976){return _0x218976?{'count':_0x2bb3ae,'rows':_0x218976}:null;}})['then'](respondWithResult(_0x3c9732,null))['catch'](handleError(_0x3c9732,null));};exports[_0xa9fe('0x47')]=function(_0x3d42de,_0x410e34,_0x16462b){if(_0x3d42de[_0xa9fe('0x41')]['id']){delete _0x3d42de[_0xa9fe('0x41')]['id'];}return db[_0xa9fe('0x38')][_0xa9fe('0x48')]({'where':{'id':_0x3d42de[_0xa9fe('0x3d')]['id']}})[_0xa9fe('0x20')](handleEntityNotFound(_0x410e34,null))['then'](function(_0x334aa5){if(_0x334aa5){_0x3d42de['body'][_0xa9fe('0x49')]=_0x334aa5['id'];_0x3d42de[_0xa9fe('0x41')]['Subjects']=integrations[_0xa9fe('0x4a')](_0x3d42de[_0xa9fe('0x41')][_0xa9fe('0x4b')],_0x3d42de['body'][_0xa9fe('0x27')]);_0x3d42de['body']['Descriptions']=integrations[_0xa9fe('0x4c')](_0x3d42de['body'][_0xa9fe('0x4b')],_0x3d42de['body'][_0xa9fe('0x27')]);return db['FreshsalesConfiguration']['create'](_0x3d42de['body'],{'include':[{'model':db[_0xa9fe('0x4d')],'as':_0xa9fe('0x4e')},{'model':db['FreshsalesField'],'as':_0xa9fe('0x4f')}]});}return null;})['then'](respondWithResult(_0x410e34,null))[_0xa9fe('0x3c')](handleError(_0x410e34,null));};exports[_0xa9fe('0x50')]=function(_0x5170e8,_0x4c7683,_0x1581c8){var _0x505ff2='';var _0x243ad4='';return db['FreshsalesAccount'][_0xa9fe('0x48')]({'where':{'id':_0x5170e8[_0xa9fe('0x3d')]['id']},'attributes':['id',_0xa9fe('0x51'),_0xa9fe('0x52'),_0xa9fe('0x53')]})[_0xa9fe('0x20')](handleEntityNotFound(_0x4c7683,null))[_0xa9fe('0x20')](function(_0x1084db){if(_0x1084db){_0x243ad4=_0x1084db[_0xa9fe('0x51')];_0x505ff2=_0x1084db[_0xa9fe('0x52')];var _0x2bd9ce=_0x1084db[_0xa9fe('0x52')][_0xa9fe('0x54')](-0x1);if(_0x2bd9ce==='/'){_0x505ff2=_0x505ff2[_0xa9fe('0x55')](0x0,_0x505ff2[_0xa9fe('0x56')](_0x2bd9ce));}return rp({'method':'GET','uri':util[_0xa9fe('0x57')](_0xa9fe('0x58'),_0x505ff2,'/api/selector/owners'),'headers':{'Authorization':_0xa9fe('0x59')+_0x1084db['apiKey']},'json':!![]});}})[_0xa9fe('0x20')](function(_0x3334d7){if(_0x3334d7){var _0x1fbc84=_0x3334d7[_0xa9fe('0x5a')];var _0x4973de=![];var _0x451701=null;for(_0x451701=0x0;_0x451701<_0x1fbc84['length'];_0x451701++){if(_0x1fbc84[_0x451701][_0xa9fe('0x5b')]===_0x243ad4){_0x4973de=!![];}}if(_0x4973de){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa9fe('0x5c')});}}})[_0xa9fe('0x20')](respondWithResult(_0x4c7683,null))[_0xa9fe('0x3c')](function(_0x4972ec){var _0x1dec88=_0x5170e8[_0xa9fe('0x2a')][_0xa9fe('0x5d')]?0x1f4:_0x4972ec['statusCode']||0x1f4;logger[_0xa9fe('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xa9fe('0x50'),_0x1dec88,JSON[_0xa9fe('0x5e')](_0x4972ec));delete _0x4972ec[_0xa9fe('0x23')];if(_0x1dec88===0x191){_0x1dec88=0x190;}_0x4c7683[_0xa9fe('0x14')](_0x1dec88)[_0xa9fe('0x24')](_0x5170e8[_0xa9fe('0x2a')][_0xa9fe('0x5d')]?{'message':'Wrong\x20credentials','statusCode':_0x4972ec[_0xa9fe('0x5f')]}:_0x4972ec);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index cbc62cc..45932d5 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 _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));var integrations=require(_0x7413('0xb'));module['exports']=function(_0xc808cd,_0x188d89){return _0xc808cd[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x583c=['define','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intFreshsalesAccount.attributes','exports'];(function(_0x296a11,_0xfcdf6){var _0x3b5c6c=function(_0x9cfcf0){while(--_0x9cfcf0){_0x296a11['push'](_0x296a11['shift']());}};_0x3b5c6c(++_0xfcdf6);}(_0x583c,0x12b));var _0xc583=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0x583c[_0x57cc22];return _0x6f7bdc;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc583('0x8')]=function(_0x365ed6,_0x2719df){return _0x365ed6[_0xc583('0x9')]('FreshsalesAccount',attributes,{'tableName':_0xc583('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index e141a1e..f5f09a2 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 _0xb145=['stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetFreshsalesAccount','where','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb145,0xa3));var _0x5b14=function(_0x129fe9,_0x1f5b80){_0x129fe9=_0x129fe9-0x0;var _0x2fe9fc=_0xb145[_0x129fe9];return _0x2fe9fc;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['GetFreshsalesAccount']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')]({'raw':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d395['options']?_0x48d395['options']['where']||null:null,'attributes':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'limit':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1c')]||null:null,'include':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x48d395['options'][_0x5b14('0x1d')],function(_0x54073f){return{'model':db[_0x54073f['model']],'as':_0x54073f['as'],'attributes':_0x54073f['attributes'],'include':_0x54073f['include']?_[_0x5b14('0x1e')](_0x54073f[_0x5b14('0x1d')],function(_0x153a25){return{'model':db[_0x153a25['model']],'as':_0x153a25['as'],'attributes':_0x153a25[_0x5b14('0x1b')],'include':_0x153a25[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x153a25[_0x5b14('0x1d')],function(_0xe6851b){return{'model':db[_0xe6851b[_0x5b14('0x1f')]],'as':_0xe6851b['as'],'attributes':_0xe6851b[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5b14('0x20')](function(_0x296d65){logger[_0x5b14('0xd')](_0x5b14('0x21'),_0x48d395);logger[_0x5b14('0xf')](_0x5b14('0x21'),_0x48d395,JSON[_0x5b14('0x11')](_0x296d65));_0x3f397d(_0x296d65);})['catch'](function(_0x370fcd){logger[_0x5b14('0x12')]('GetFreshsalesAccount',_0x370fcd['message'],_0x48d395);_0x3035b5(_0x58bf3c[_0x5b14('0x12')](0x1f4,_0x370fcd[_0x5b14('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4c1f0e){var _0x21b43b=this;return new Promise(function(_0x4d3905,_0x38c665){return db[_0x5b14('0x17')]['find']({'raw':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e['options'][_0x5b14('0x22')]||null:null,'attributes':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'include':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e[_0x5b14('0x19')]['include']?_[_0x5b14('0x1e')](_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1d')],function(_0x37f62c){return{'model':db[_0x37f62c['model']],'as':_0x37f62c['as'],'attributes':_0x37f62c[_0x5b14('0x1b')],'include':_0x37f62c[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x37f62c['include'],function(_0x2fe74d){return{'model':db[_0x2fe74d['model']],'as':_0x2fe74d['as'],'attributes':_0x2fe74d[_0x5b14('0x1b')],'include':_0x2fe74d[_0x5b14('0x1d')]?_['map'](_0x2fe74d[_0x5b14('0x1d')],function(_0x2a83d4){return{'model':db[_0x2a83d4['model']],'as':_0x2a83d4['as'],'attributes':_0x2a83d4[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce6bb){logger[_0x5b14('0xd')](_0x5b14('0x23'),_0x4c1f0e);logger[_0x5b14('0xf')]('ShowFreshsalesAccount',_0x4c1f0e,JSON[_0x5b14('0x11')](_0x1ce6bb));_0x4d3905(_0x1ce6bb);})[_0x5b14('0x16')](function(_0x15d4c4){logger[_0x5b14('0x12')](_0x5b14('0x23'),_0x15d4c4[_0x5b14('0x14')],_0x4c1f0e);_0x38c665(_0x21b43b[_0x5b14('0x12')](0x1f4,_0x15d4c4[_0x5b14('0x14')]));});});}; \ No newline at end of file +var _0x8e3f=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','limit','include','model','attributes','map','stringify','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x175d1e,_0x48ad7e){var _0x10aefc=function(_0x508d26){while(--_0x508d26){_0x175d1e['push'](_0x175d1e['shift']());}};_0x10aefc(++_0x48ad7e);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['findAll']({'raw':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x19')]===undefined?!![]:![]:!![],'where':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x1a')]||null:null,'attributes':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')]['attributes']||null:null,'limit':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x1b')]||null:null,'include':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc['options'][_0xf8e3('0x1c')]?_['map'](_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x1c')],function(_0x33d526){return{'model':db[_0x33d526[_0xf8e3('0x1d')]],'as':_0x33d526['as'],'attributes':_0x33d526[_0xf8e3('0x1e')],'include':_0x33d526[_0xf8e3('0x1c')]?_['map'](_0x33d526[_0xf8e3('0x1c')],function(_0x2fc674){return{'model':db[_0x2fc674[_0xf8e3('0x1d')]],'as':_0x2fc674['as'],'attributes':_0x2fc674[_0xf8e3('0x1e')],'include':_0x2fc674[_0xf8e3('0x1c')]?_[_0xf8e3('0x1f')](_0x2fc674[_0xf8e3('0x1c')],function(_0x157a2d){return{'model':db[_0x157a2d['model']],'as':_0x157a2d['as'],'attributes':_0x157a2d[_0xf8e3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf8e3('0xc')](function(_0x12ebd2){logger[_0xf8e3('0xd')](_0xf8e3('0x16'),_0x11d4cc);logger[_0xf8e3('0x10')](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x20')](_0x12ebd2));_0x2e27e3(_0x12ebd2);})['catch'](function(_0x21e1c0){logger[_0xf8e3('0x12')](_0xf8e3('0x16'),_0x21e1c0[_0xf8e3('0x14')],_0x11d4cc);_0x1337ae(_0x7a81c3['error'](0x1f4,_0x21e1c0[_0xf8e3('0x14')]));});});};exports[_0xf8e3('0x21')]=function(_0x40f64d){var _0x45df49=this;return new Promise(function(_0x33f208,_0x46c85d){return db[_0xf8e3('0x17')][_0xf8e3('0x22')]({'raw':_0x40f64d['options']?_0x40f64d[_0xf8e3('0x18')][_0xf8e3('0x19')]===undefined?!![]:![]:!![],'where':_0x40f64d['options']?_0x40f64d['options']['where']||null:null,'attributes':_0x40f64d[_0xf8e3('0x18')]?_0x40f64d['options'][_0xf8e3('0x1e')]||null:null,'include':_0x40f64d[_0xf8e3('0x18')]?_0x40f64d[_0xf8e3('0x18')][_0xf8e3('0x1c')]?_['map'](_0x40f64d['options'][_0xf8e3('0x1c')],function(_0x2f87d8){return{'model':db[_0x2f87d8[_0xf8e3('0x1d')]],'as':_0x2f87d8['as'],'attributes':_0x2f87d8[_0xf8e3('0x1e')],'include':_0x2f87d8[_0xf8e3('0x1c')]?_[_0xf8e3('0x1f')](_0x2f87d8['include'],function(_0x1afead){return{'model':db[_0x1afead['model']],'as':_0x1afead['as'],'attributes':_0x1afead['attributes'],'include':_0x1afead[_0xf8e3('0x1c')]?_[_0xf8e3('0x1f')](_0x1afead[_0xf8e3('0x1c')],function(_0x1b7af2){return{'model':db[_0x1b7af2['model']],'as':_0x1b7af2['as'],'attributes':_0x1b7af2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8e3('0xc')](function(_0x215183){logger['info'](_0xf8e3('0x21'),_0x40f64d);logger[_0xf8e3('0x10')](_0xf8e3('0x21'),_0x40f64d,JSON[_0xf8e3('0x20')](_0x215183));_0x33f208(_0x215183);})['catch'](function(_0x53cfea){logger['error'](_0xf8e3('0x21'),_0x53cfea[_0xf8e3('0x14')],_0x40f64d);_0x46c85d(_0x45df49[_0xf8e3('0x12')](0x1f4,_0x53cfea[_0xf8e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c081f87..720c18d 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 _0x1d6c=['isAuthenticated','index','/:id','show','/:id/subjects','getDescriptions','/:id/fields','getFields','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x28c97e,_0x5a8a12){var _0x32ab68=function(_0x2ac366){while(--_0x2ac366){_0x28c97e['push'](_0x28c97e['shift']());}};_0x32ab68(++_0x5a8a12);}(_0x1d6c,0xad));var _0xc1d6=function(_0x4c7a57,_0x2f26f9){_0x4c7a57=_0x4c7a57-0x0;var _0x11cff6=_0x1d6c[_0x4c7a57];return _0x11cff6;};'use strict';var multer=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var path=require(_0xc1d6('0x2'));var timeout=require(_0xc1d6('0x3'));var express=require(_0xc1d6('0x4'));var router=express['Router']();var fs_extra=require(_0xc1d6('0x5'));var auth=require(_0xc1d6('0x6'));var interaction=require(_0xc1d6('0x7'));var config=require(_0xc1d6('0x8'));var controller=require(_0xc1d6('0x9'));router[_0xc1d6('0xa')]('/',auth[_0xc1d6('0xb')](),controller[_0xc1d6('0xc')]);router[_0xc1d6('0xa')](_0xc1d6('0xd'),auth[_0xc1d6('0xb')](),controller[_0xc1d6('0xe')]);router[_0xc1d6('0xa')](_0xc1d6('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xc1d6('0xa')]('/:id/descriptions',auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x10')]);router[_0xc1d6('0xa')](_0xc1d6('0x11'),auth['isAuthenticated'](),controller[_0xc1d6('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc1d6('0xd'),auth['isAuthenticated'](),controller[_0xc1d6('0x13')]);router[_0xc1d6('0x14')]('/:id',auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x15')]);module[_0xc1d6('0x16')]=router; \ No newline at end of file +var _0x4e25=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put'];(function(_0x12bdac,_0x3af946){var _0x5a5650=function(_0x4d0f24){while(--_0x4d0f24){_0x12bdac['push'](_0x12bdac['shift']());}};_0x5a5650(++_0x3af946);}(_0x4e25,0x138));var _0x54e2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4e25[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x54e2('0x0'));var util=require(_0x54e2('0x1'));var path=require(_0x54e2('0x2'));var timeout=require(_0x54e2('0x3'));var express=require(_0x54e2('0x4'));var router=express[_0x54e2('0x5')]();var fs_extra=require(_0x54e2('0x6'));var auth=require(_0x54e2('0x7'));var interaction=require(_0x54e2('0x8'));var config=require(_0x54e2('0x9'));var controller=require(_0x54e2('0xa'));router[_0x54e2('0xb')]('/',auth[_0x54e2('0xc')](),controller[_0x54e2('0xd')]);router[_0x54e2('0xb')](_0x54e2('0xe'),auth[_0x54e2('0xc')](),controller[_0x54e2('0xf')]);router[_0x54e2('0xb')](_0x54e2('0x10'),auth['isAuthenticated'](),controller[_0x54e2('0x11')]);router[_0x54e2('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x54e2('0x12')]);router['get'](_0x54e2('0x13'),auth[_0x54e2('0xc')](),controller[_0x54e2('0x14')]);router[_0x54e2('0x15')]('/',auth[_0x54e2('0xc')](),controller[_0x54e2('0x16')]);router[_0x54e2('0x17')](_0x54e2('0xe'),auth[_0x54e2('0xc')](),controller[_0x54e2('0x18')]);router[_0x54e2('0x19')](_0x54e2('0xe'),auth[_0x54e2('0xc')](),controller[_0x54e2('0x1a')]);module[_0x54e2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 89e075d..b81aab5 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 _0x739c=['STRING','sequelize','exports'];(function(_0x4041ca,_0x38690a){var _0x48543b=function(_0x54e1be){while(--_0x54e1be){_0x4041ca['push'](_0x4041ca['shift']());}};_0x48543b(++_0x38690a);}(_0x739c,0xca));var _0xc739=function(_0x48c8dd,_0x195db1){_0x48c8dd=_0x48c8dd-0x0;var _0x721b3d=_0x739c[_0x48c8dd];return _0x721b3d;};'use strict';var Sequelize=require(_0xc739('0x0'));module[_0xc739('0x1')]={'name':{'type':Sequelize[_0xc739('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5db9=['sequelize','exports','STRING'];(function(_0xb2406b,_0x3805f9){var _0x37dde4=function(_0x53a53d){while(--_0x53a53d){_0xb2406b['push'](_0xb2406b['shift']());}};_0x37dde4(++_0x3805f9);}(_0x5db9,0xcf));var _0x95db=function(_0x2c0390,_0x203c7e){_0x2c0390=_0x2c0390-0x0;var _0x1e8cad=_0x5db9[_0x2c0390];return _0x1e8cad;};'use strict';var Sequelize=require(_0x95db('0x0'));module[_0x95db('0x1')]={'name':{'type':Sequelize[_0x95db('0x2')]},'description':{'type':Sequelize[_0x95db('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 638eb47..00b73f6 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 _0xca7f=['filter','options','include','rows','show','params','includeAll','find','catch','create','body','getSubjects','FreshsalesField','order','findOne','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xca7f,0x1a1));var _0xfca7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xca7f[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xfca7('0x0'));var rimraf=require(_0xfca7('0x1'));var zipdir=require(_0xfca7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfca7('0x3'));var moment=require(_0xfca7('0x4'));var BPromise=require(_0xfca7('0x5'));var Mustache=require(_0xfca7('0x6'));var util=require(_0xfca7('0x7'));var path=require('path');var sox=require(_0xfca7('0x8'));var csv=require(_0xfca7('0x9'));var ejs=require(_0xfca7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfca7('0xb'));var crypto=require(_0xfca7('0xc'));var jsforce=require(_0xfca7('0xd'));var deskjs=require(_0xfca7('0xe'));var toCsv=require(_0xfca7('0x9'));var querystring=require('querystring');var Papa=require(_0xfca7('0xf'));var Redis=require('ioredis');var authService=require(_0xfca7('0x10'));var qs=require(_0xfca7('0x11'));var as=require(_0xfca7('0x12'));var hardwareService=require(_0xfca7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfca7('0x14'));var config=require(_0xfca7('0x15'));var licenseUtil=require(_0xfca7('0x16'));var db=require(_0xfca7('0x17'))['db'];function respondWithStatusCode(_0x205d44,_0x5062e){_0x5062e=_0x5062e||0xcc;return function(_0x52d62){if(_0x52d62){return _0x205d44[_0xfca7('0x18')](_0x5062e);}return _0x205d44[_0xfca7('0x19')](_0x5062e)[_0xfca7('0x1a')]();};}function respondWithResult(_0x12d47a,_0x197946){_0x197946=_0x197946||0xc8;return function(_0x14df69){if(_0x14df69){return _0x12d47a[_0xfca7('0x19')](_0x197946)['json'](_0x14df69);}};}function respondWithFilteredResult(_0x50a976,_0x565265){return function(_0x1f1401){if(_0x1f1401){var _0x499ef9=typeof _0x565265['offset']===_0xfca7('0x1b')&&typeof _0x565265[_0xfca7('0x1c')]===_0xfca7('0x1b');var _0xed5262=_0x1f1401[_0xfca7('0x1d')];var _0x585758=_0x499ef9?0x0:_0x565265['offset'];var _0x82fd58=_0x499ef9?_0x1f1401['count']:_0x565265[_0xfca7('0x1e')]+_0x565265[_0xfca7('0x1c')];var _0x48088c;if(_0x82fd58>=_0xed5262){_0x82fd58=_0xed5262;_0x48088c=0xc8;}else{_0x48088c=0xce;}_0x50a976[_0xfca7('0x19')](_0x48088c);return _0x50a976[_0xfca7('0x1f')](_0xfca7('0x20'),_0x585758+'-'+_0x82fd58+'/'+_0xed5262)[_0xfca7('0x21')](_0x1f1401);}return null;};}function patchUpdates(_0x291cd8){return function(_0x5a34ee){try{jsonpatch[_0xfca7('0x22')](_0x5a34ee,_0x291cd8,!![]);}catch(_0x33f8a7){return BPromise[_0xfca7('0x23')](_0x33f8a7);}return _0x5a34ee[_0xfca7('0x24')]();};}function saveUpdates(_0x4beecf,_0x5b0406){return function(_0x3331a2){if(_0x3331a2){return _0x3331a2['update'](_0x4beecf)[_0xfca7('0x25')](function(_0x4ce2aa){return _0x4ce2aa;});}return null;};}function removeEntity(_0x16389d,_0x48dba9){return function(_0x2bb76c){if(_0x2bb76c){return _0x2bb76c[_0xfca7('0x26')]()[_0xfca7('0x25')](function(){_0x16389d[_0xfca7('0x19')](0xcc)[_0xfca7('0x1a')]();});}};}function handleEntityNotFound(_0x3c7ba5,_0x2271da){return function(_0x4efa0a){if(!_0x4efa0a){_0x3c7ba5[_0xfca7('0x18')](0x194);}return _0x4efa0a;};}function handleError(_0x557f97,_0x27bf55){_0x27bf55=_0x27bf55||0x1f4;return function(_0x28af41){logger['error'](_0x28af41[_0xfca7('0x27')]);if(_0x28af41[_0xfca7('0x28')]){delete _0x28af41[_0xfca7('0x28')];}_0x557f97['status'](_0x27bf55)[_0xfca7('0x29')](_0x28af41);};}exports[_0xfca7('0x2a')]=function(_0x5a0c86,_0x3ccd5f){var _0x5d776a={},_0x56c1b4={},_0x11964e={'count':0x0,'rows':[]};var _0xcd4dc8=_[_0xfca7('0x2b')](db[_0xfca7('0x2c')][_0xfca7('0x2d')],function(_0x5787aa){return{'name':_0x5787aa['fieldName'],'type':_0x5787aa[_0xfca7('0x2e')][_0xfca7('0x2f')]};});_0x56c1b4[_0xfca7('0x30')]=_[_0xfca7('0x2b')](_0xcd4dc8,_0xfca7('0x28'));_0x56c1b4[_0xfca7('0x31')]=_[_0xfca7('0x32')](_0x5a0c86[_0xfca7('0x31')]);_0x56c1b4[_0xfca7('0x33')]=_[_0xfca7('0x34')](_0x56c1b4['model'],_0x56c1b4[_0xfca7('0x31')]);_0x5d776a['attributes']=_[_0xfca7('0x34')](_0x56c1b4[_0xfca7('0x30')],qs['fields'](_0x5a0c86[_0xfca7('0x31')][_0xfca7('0x35')]));_0x5d776a[_0xfca7('0x36')]=_0x5d776a[_0xfca7('0x36')][_0xfca7('0x37')]?_0x5d776a[_0xfca7('0x36')]:_0x56c1b4[_0xfca7('0x30')];if(!_0x5a0c86[_0xfca7('0x31')][_0xfca7('0x38')](_0xfca7('0x39'))){_0x5d776a['limit']=qs[_0xfca7('0x1c')](_0x5a0c86[_0xfca7('0x31')][_0xfca7('0x1c')]);_0x5d776a[_0xfca7('0x1e')]=qs[_0xfca7('0x1e')](_0x5a0c86[_0xfca7('0x31')][_0xfca7('0x1e')]);}_0x5d776a['order']=qs[_0xfca7('0x3a')](_0x5a0c86['query'][_0xfca7('0x3a')]);_0x5d776a[_0xfca7('0x3b')]=qs[_0xfca7('0x33')](_[_0xfca7('0x3c')](_0x5a0c86[_0xfca7('0x31')],_0x56c1b4['filters']),_0xcd4dc8);if(_0x5a0c86[_0xfca7('0x31')]['filter']){_0x5d776a['where']=_[_0xfca7('0x3d')](_0x5d776a[_0xfca7('0x3b')],{'$or':_[_0xfca7('0x2b')](_0xcd4dc8,function(_0x4227af){if(_0x4227af[_0xfca7('0x2e')]!==_0xfca7('0x3e')){var _0x396ac2={};_0x396ac2[_0x4227af[_0xfca7('0x28')]]={'$like':'%'+_0x5a0c86[_0xfca7('0x31')][_0xfca7('0x3f')]+'%'};return _0x396ac2;}})});}_0x5d776a=_['merge']({},_0x5d776a,_0x5a0c86[_0xfca7('0x40')]);var _0x531baf={'where':_0x5d776a[_0xfca7('0x3b')]};return db['FreshsalesConfiguration'][_0xfca7('0x1d')](_0x531baf)['then'](function(_0x471f66){_0x11964e['count']=_0x471f66;if(_0x5a0c86[_0xfca7('0x31')]['includeAll']){_0x5d776a[_0xfca7('0x41')]=[{'all':!![]}];}return db[_0xfca7('0x2c')]['findAll'](_0x5d776a);})['then'](function(_0x4a1157){_0x11964e[_0xfca7('0x42')]=_0x4a1157;return _0x11964e;})[_0xfca7('0x25')](respondWithFilteredResult(_0x3ccd5f,_0x5d776a))['catch'](handleError(_0x3ccd5f,null));};exports[_0xfca7('0x43')]=function(_0xb796dd,_0x58f72b){var _0x17cb67={'raw':![],'where':{'id':_0xb796dd[_0xfca7('0x44')]['id']}},_0x1c77b8={};_0x1c77b8[_0xfca7('0x30')]=_[_0xfca7('0x32')](db[_0xfca7('0x2c')][_0xfca7('0x2d')]);_0x1c77b8[_0xfca7('0x31')]=_[_0xfca7('0x32')](_0xb796dd['query']);_0x1c77b8[_0xfca7('0x33')]=_[_0xfca7('0x34')](_0x1c77b8[_0xfca7('0x30')],_0x1c77b8[_0xfca7('0x31')]);_0x17cb67[_0xfca7('0x36')]=_[_0xfca7('0x34')](_0x1c77b8[_0xfca7('0x30')],qs[_0xfca7('0x35')](_0xb796dd[_0xfca7('0x31')][_0xfca7('0x35')]));_0x17cb67['attributes']=_0x17cb67[_0xfca7('0x36')]['length']?_0x17cb67[_0xfca7('0x36')]:_0x1c77b8[_0xfca7('0x30')];if(_0xb796dd['query'][_0xfca7('0x45')]){_0x17cb67[_0xfca7('0x41')]=[{'all':!![]}];}_0x17cb67=_[_0xfca7('0x3d')]({},_0x17cb67,_0xb796dd[_0xfca7('0x40')]);return db[_0xfca7('0x2c')][_0xfca7('0x46')](_0x17cb67)[_0xfca7('0x25')](handleEntityNotFound(_0x58f72b,null))['then'](respondWithResult(_0x58f72b,null))[_0xfca7('0x47')](handleError(_0x58f72b,null));};exports[_0xfca7('0x48')]=function(_0x105893,_0x35a31c){return db[_0xfca7('0x2c')][_0xfca7('0x48')](_0x105893[_0xfca7('0x49')],{})[_0xfca7('0x25')](respondWithResult(_0x35a31c,0xc9))[_0xfca7('0x47')](handleError(_0x35a31c,null));};exports['update']=function(_0x18ab4a,_0xe64d8e){if(_0x18ab4a[_0xfca7('0x49')]['id']){delete _0x18ab4a[_0xfca7('0x49')]['id'];}return db[_0xfca7('0x2c')][_0xfca7('0x46')]({'where':{'id':_0x18ab4a[_0xfca7('0x44')]['id']}})['then'](handleEntityNotFound(_0xe64d8e,null))['then'](saveUpdates(_0x18ab4a[_0xfca7('0x49')],null))['then'](respondWithResult(_0xe64d8e,null))[_0xfca7('0x47')](handleError(_0xe64d8e,null));};exports['destroy']=function(_0x59490e,_0x4aecde){return db[_0xfca7('0x2c')][_0xfca7('0x46')]({'where':{'id':_0x59490e[_0xfca7('0x44')]['id']}})['then'](handleEntityNotFound(_0x4aecde,null))[_0xfca7('0x25')](removeEntity(_0x4aecde,null))[_0xfca7('0x47')](handleError(_0x4aecde,null));};exports[_0xfca7('0x4a')]=function(_0x37cfbd,_0x47fed6,_0x33a7de){var _0x4b2150={};var _0x1140fc={};var _0x2ebd3e;var _0x55b4e8;return db[_0xfca7('0x2c')]['findOne']({'where':{'id':_0x37cfbd['params']['id']}})[_0xfca7('0x25')](handleEntityNotFound(_0x47fed6,null))[_0xfca7('0x25')](function(_0x5275ac){if(_0x5275ac){_0x2ebd3e=_0x5275ac;_0x1140fc['model']=_[_0xfca7('0x32')](db[_0xfca7('0x4b')]['rawAttributes']);_0x1140fc[_0xfca7('0x31')]=_[_0xfca7('0x32')](_0x37cfbd[_0xfca7('0x31')]);_0x1140fc[_0xfca7('0x33')]=_[_0xfca7('0x34')](_0x1140fc['model'],_0x1140fc['query']);_0x4b2150[_0xfca7('0x36')]=_[_0xfca7('0x34')](_0x1140fc[_0xfca7('0x30')],qs[_0xfca7('0x35')](_0x37cfbd['query'][_0xfca7('0x35')]));_0x4b2150[_0xfca7('0x36')]=_0x4b2150[_0xfca7('0x36')]['length']?_0x4b2150[_0xfca7('0x36')]:_0x1140fc['model'];_0x4b2150[_0xfca7('0x4c')]=qs[_0xfca7('0x3a')](_0x37cfbd[_0xfca7('0x31')][_0xfca7('0x3a')]);_0x4b2150[_0xfca7('0x3b')]=qs[_0xfca7('0x33')](_[_0xfca7('0x3c')](_0x37cfbd['query'],_0x1140fc['filters']));if(_0x37cfbd['query'][_0xfca7('0x3f')]){_0x4b2150['where']=_[_0xfca7('0x3d')](_0x4b2150['where'],{'$or':_[_0xfca7('0x2b')](_0x4b2150[_0xfca7('0x36')],function(_0x2ff5ea){var _0x5f321b={};_0x5f321b[_0x2ff5ea]={'$like':'%'+_0x37cfbd[_0xfca7('0x31')][_0xfca7('0x3f')]+'%'};return _0x5f321b;})});}_0x4b2150=_[_0xfca7('0x3d')]({},_0x4b2150,_0x37cfbd[_0xfca7('0x40')]);return _0x2ebd3e[_0xfca7('0x4a')](_0x4b2150);}})[_0xfca7('0x25')](function(_0x3a3312){if(_0x3a3312){_0x55b4e8=_0x3a3312[_0xfca7('0x37')];if(!_0x37cfbd[_0xfca7('0x31')][_0xfca7('0x38')](_0xfca7('0x39'))){_0x4b2150[_0xfca7('0x1c')]=qs[_0xfca7('0x1c')](_0x37cfbd[_0xfca7('0x31')][_0xfca7('0x1c')]);_0x4b2150[_0xfca7('0x1e')]=qs[_0xfca7('0x1e')](_0x37cfbd[_0xfca7('0x31')]['offset']);}return _0x2ebd3e[_0xfca7('0x4a')](_0x4b2150);}})[_0xfca7('0x25')](function(_0x5c29c0){if(_0x5c29c0){return _0x5c29c0?{'count':_0x55b4e8,'rows':_0x5c29c0}:null;}})[_0xfca7('0x25')](respondWithResult(_0x47fed6,null))['catch'](handleError(_0x47fed6,null));};exports['getDescriptions']=function(_0x3b62d1,_0x2207ec,_0xc94627){var _0x45fbc9={};var _0x34adb5={};var _0x46cbee;var _0xc5b8cd;return db[_0xfca7('0x2c')][_0xfca7('0x4d')]({'where':{'id':_0x3b62d1[_0xfca7('0x44')]['id']}})[_0xfca7('0x25')](handleEntityNotFound(_0x2207ec,null))[_0xfca7('0x25')](function(_0x1bc546){if(_0x1bc546){_0x46cbee=_0x1bc546;_0x34adb5['model']=_['keys'](db[_0xfca7('0x4b')]['rawAttributes']);_0x34adb5[_0xfca7('0x31')]=_[_0xfca7('0x32')](_0x3b62d1[_0xfca7('0x31')]);_0x34adb5['filters']=_['intersection'](_0x34adb5[_0xfca7('0x30')],_0x34adb5[_0xfca7('0x31')]);_0x45fbc9[_0xfca7('0x36')]=_[_0xfca7('0x34')](_0x34adb5[_0xfca7('0x30')],qs[_0xfca7('0x35')](_0x3b62d1['query'][_0xfca7('0x35')]));_0x45fbc9[_0xfca7('0x36')]=_0x45fbc9[_0xfca7('0x36')]['length']?_0x45fbc9[_0xfca7('0x36')]:_0x34adb5['model'];_0x45fbc9['order']=qs[_0xfca7('0x3a')](_0x3b62d1[_0xfca7('0x31')][_0xfca7('0x3a')]);_0x45fbc9[_0xfca7('0x3b')]=qs[_0xfca7('0x33')](_[_0xfca7('0x3c')](_0x3b62d1[_0xfca7('0x31')],_0x34adb5[_0xfca7('0x33')]));if(_0x3b62d1['query'][_0xfca7('0x3f')]){_0x45fbc9[_0xfca7('0x3b')]=_[_0xfca7('0x3d')](_0x45fbc9[_0xfca7('0x3b')],{'$or':_[_0xfca7('0x2b')](_0x45fbc9[_0xfca7('0x36')],function(_0x13e978){var _0x186f78={};_0x186f78[_0x13e978]={'$like':'%'+_0x3b62d1[_0xfca7('0x31')][_0xfca7('0x3f')]+'%'};return _0x186f78;})});}_0x45fbc9=_['merge']({},_0x45fbc9,_0x3b62d1[_0xfca7('0x40')]);return _0x46cbee[_0xfca7('0x4e')](_0x45fbc9);}})[_0xfca7('0x25')](function(_0x17dd30){if(_0x17dd30){_0xc5b8cd=_0x17dd30[_0xfca7('0x37')];if(!_0x3b62d1['query'][_0xfca7('0x38')](_0xfca7('0x39'))){_0x45fbc9[_0xfca7('0x1c')]=qs['limit'](_0x3b62d1[_0xfca7('0x31')][_0xfca7('0x1c')]);_0x45fbc9[_0xfca7('0x1e')]=qs[_0xfca7('0x1e')](_0x3b62d1[_0xfca7('0x31')][_0xfca7('0x1e')]);}return _0x46cbee[_0xfca7('0x4e')](_0x45fbc9);}})[_0xfca7('0x25')](function(_0x45d044){if(_0x45d044){return _0x45d044?{'count':_0xc5b8cd,'rows':_0x45d044}:null;}})[_0xfca7('0x25')](respondWithResult(_0x2207ec,null))[_0xfca7('0x47')](handleError(_0x2207ec,null));};exports[_0xfca7('0x4f')]=function(_0x4e9348,_0x1eb8b8,_0x2ac728){var _0x307250={};var _0x3cf660={};var _0x1baefb;var _0xf2e75;return db[_0xfca7('0x2c')][_0xfca7('0x4d')]({'where':{'id':_0x4e9348[_0xfca7('0x44')]['id']}})[_0xfca7('0x25')](handleEntityNotFound(_0x1eb8b8,null))[_0xfca7('0x25')](function(_0x59423a){if(_0x59423a){_0x1baefb=_0x59423a;_0x3cf660[_0xfca7('0x30')]=_[_0xfca7('0x32')](db[_0xfca7('0x4b')][_0xfca7('0x2d')]);_0x3cf660[_0xfca7('0x31')]=_[_0xfca7('0x32')](_0x4e9348[_0xfca7('0x31')]);_0x3cf660['filters']=_[_0xfca7('0x34')](_0x3cf660[_0xfca7('0x30')],_0x3cf660['query']);_0x307250[_0xfca7('0x36')]=_['intersection'](_0x3cf660['model'],qs[_0xfca7('0x35')](_0x4e9348['query'][_0xfca7('0x35')]));_0x307250[_0xfca7('0x36')]=_0x307250[_0xfca7('0x36')][_0xfca7('0x37')]?_0x307250['attributes']:_0x3cf660[_0xfca7('0x30')];_0x307250[_0xfca7('0x4c')]=qs['sort'](_0x4e9348[_0xfca7('0x31')][_0xfca7('0x3a')]);_0x307250[_0xfca7('0x3b')]=qs[_0xfca7('0x33')](_[_0xfca7('0x3c')](_0x4e9348[_0xfca7('0x31')],_0x3cf660['filters']));if(_0x4e9348[_0xfca7('0x31')][_0xfca7('0x3f')]){_0x307250[_0xfca7('0x3b')]=_[_0xfca7('0x3d')](_0x307250['where'],{'$or':_['map'](_0x307250[_0xfca7('0x36')],function(_0x206b95){var _0x185356={};_0x185356[_0x206b95]={'$like':'%'+_0x4e9348['query'][_0xfca7('0x3f')]+'%'};return _0x185356;})});}_0x307250=_[_0xfca7('0x3d')]({},_0x307250,_0x4e9348[_0xfca7('0x40')]);return _0x1baefb[_0xfca7('0x4f')](_0x307250);}})[_0xfca7('0x25')](function(_0x46ea9e){if(_0x46ea9e){_0xf2e75=_0x46ea9e['length'];if(!_0x4e9348[_0xfca7('0x31')]['hasOwnProperty'](_0xfca7('0x39'))){_0x307250[_0xfca7('0x1c')]=qs[_0xfca7('0x1c')](_0x4e9348[_0xfca7('0x31')][_0xfca7('0x1c')]);_0x307250['offset']=qs[_0xfca7('0x1e')](_0x4e9348['query'][_0xfca7('0x1e')]);}return _0x1baefb['getFields'](_0x307250);}})[_0xfca7('0x25')](function(_0x3e851b){if(_0x3e851b){return _0x3e851b?{'count':_0xf2e75,'rows':_0x3e851b}:null;}})[_0xfca7('0x25')](respondWithResult(_0x1eb8b8,null))[_0xfca7('0x47')](handleError(_0x1eb8b8,null));}; \ No newline at end of file +var _0xbbb6=['getSubjects','FreshsalesField','nolimit','getDescriptions','findOne','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','options','include','findAll','includeAll','find','catch','create','body','params','destroy'];(function(_0x3f7299,_0x138bfe){var _0x2eabdc=function(_0x3184c1){while(--_0x3184c1){_0x3f7299['push'](_0x3f7299['shift']());}};_0x2eabdc(++_0x138bfe);}(_0xbbb6,0x14e));var _0x6bbb=function(_0x2baff4,_0x9e7e5){_0x2baff4=_0x2baff4-0x0;var _0x3bf2f7=_0xbbb6[_0x2baff4];return _0x3bf2f7;};'use strict';var emlformat=require(_0x6bbb('0x0'));var rimraf=require(_0x6bbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6bbb('0x2'));var rp=require(_0x6bbb('0x3'));var moment=require(_0x6bbb('0x4'));var BPromise=require(_0x6bbb('0x5'));var Mustache=require(_0x6bbb('0x6'));var util=require(_0x6bbb('0x7'));var path=require(_0x6bbb('0x8'));var sox=require('sox');var csv=require(_0x6bbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bbb('0xa'));var _=require(_0x6bbb('0xb'));var squel=require(_0x6bbb('0xc'));var crypto=require(_0x6bbb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6bbb('0xe'));var toCsv=require(_0x6bbb('0x9'));var querystring=require('querystring');var Papa=require(_0x6bbb('0xf'));var Redis=require(_0x6bbb('0x10'));var authService=require(_0x6bbb('0x11'));var qs=require(_0x6bbb('0x12'));var as=require(_0x6bbb('0x13'));var hardwareService=require(_0x6bbb('0x14'));var logger=require('../../config/logger')(_0x6bbb('0x15'));var utils=require(_0x6bbb('0x16'));var config=require(_0x6bbb('0x17'));var licenseUtil=require(_0x6bbb('0x18'));var db=require(_0x6bbb('0x19'))['db'];function respondWithStatusCode(_0x285cc0,_0x12517b){_0x12517b=_0x12517b||0xcc;return function(_0x304901){if(_0x304901){return _0x285cc0[_0x6bbb('0x1a')](_0x12517b);}return _0x285cc0[_0x6bbb('0x1b')](_0x12517b)['end']();};}function respondWithResult(_0x4c2fe8,_0x41538e){_0x41538e=_0x41538e||0xc8;return function(_0x35c342){if(_0x35c342){return _0x4c2fe8[_0x6bbb('0x1b')](_0x41538e)[_0x6bbb('0x1c')](_0x35c342);}};}function respondWithFilteredResult(_0x53ede1,_0x1f207b){return function(_0x5974d9){if(_0x5974d9){var _0x350bc6=typeof _0x1f207b[_0x6bbb('0x1d')]===_0x6bbb('0x1e')&&typeof _0x1f207b[_0x6bbb('0x1f')]===_0x6bbb('0x1e');var _0x7f3768=_0x5974d9[_0x6bbb('0x20')];var _0x5e0699=_0x350bc6?0x0:_0x1f207b[_0x6bbb('0x1d')];var _0x3605fa=_0x350bc6?_0x5974d9['count']:_0x1f207b[_0x6bbb('0x1d')]+_0x1f207b[_0x6bbb('0x1f')];var _0x344d20;if(_0x3605fa>=_0x7f3768){_0x3605fa=_0x7f3768;_0x344d20=0xc8;}else{_0x344d20=0xce;}_0x53ede1[_0x6bbb('0x1b')](_0x344d20);return _0x53ede1[_0x6bbb('0x21')](_0x6bbb('0x22'),_0x5e0699+'-'+_0x3605fa+'/'+_0x7f3768)[_0x6bbb('0x1c')](_0x5974d9);}return null;};}function patchUpdates(_0x521d7d){return function(_0x58f84d){try{jsonpatch[_0x6bbb('0x23')](_0x58f84d,_0x521d7d,!![]);}catch(_0x3d092){return BPromise[_0x6bbb('0x24')](_0x3d092);}return _0x58f84d[_0x6bbb('0x25')]();};}function saveUpdates(_0xcca591,_0x5b2d42){return function(_0x45d3a4){if(_0x45d3a4){return _0x45d3a4[_0x6bbb('0x26')](_0xcca591)[_0x6bbb('0x27')](function(_0x1daee3){return _0x1daee3;});}return null;};}function removeEntity(_0x1dfb87,_0x22be03){return function(_0x265458){if(_0x265458){return _0x265458['destroy']()[_0x6bbb('0x27')](function(){_0x1dfb87[_0x6bbb('0x1b')](0xcc)[_0x6bbb('0x28')]();});}};}function handleEntityNotFound(_0x2fd6d4,_0x530680){return function(_0x1a816d){if(!_0x1a816d){_0x2fd6d4[_0x6bbb('0x1a')](0x194);}return _0x1a816d;};}function handleError(_0x3e9ebe,_0x256dae){_0x256dae=_0x256dae||0x1f4;return function(_0x5ddd53){logger['error'](_0x5ddd53[_0x6bbb('0x29')]);if(_0x5ddd53[_0x6bbb('0x2a')]){delete _0x5ddd53[_0x6bbb('0x2a')];}_0x3e9ebe[_0x6bbb('0x1b')](_0x256dae)[_0x6bbb('0x2b')](_0x5ddd53);};}exports[_0x6bbb('0x2c')]=function(_0x46a093,_0x205eb8){var _0x2861b2={},_0x53e491={},_0x42cbb5={'count':0x0,'rows':[]};var _0x25af2f=_['map'](db[_0x6bbb('0x2d')][_0x6bbb('0x2e')],function(_0x15d8a2){return{'name':_0x15d8a2[_0x6bbb('0x2f')],'type':_0x15d8a2[_0x6bbb('0x30')][_0x6bbb('0x31')]};});_0x53e491[_0x6bbb('0x32')]=_['map'](_0x25af2f,_0x6bbb('0x2a'));_0x53e491[_0x6bbb('0x33')]=_[_0x6bbb('0x34')](_0x46a093[_0x6bbb('0x33')]);_0x53e491['filters']=_['intersection'](_0x53e491[_0x6bbb('0x32')],_0x53e491[_0x6bbb('0x33')]);_0x2861b2['attributes']=_[_0x6bbb('0x35')](_0x53e491[_0x6bbb('0x32')],qs[_0x6bbb('0x36')](_0x46a093[_0x6bbb('0x33')][_0x6bbb('0x36')]));_0x2861b2[_0x6bbb('0x37')]=_0x2861b2[_0x6bbb('0x37')][_0x6bbb('0x38')]?_0x2861b2[_0x6bbb('0x37')]:_0x53e491['model'];if(!_0x46a093[_0x6bbb('0x33')][_0x6bbb('0x39')]('nolimit')){_0x2861b2['limit']=qs[_0x6bbb('0x1f')](_0x46a093['query'][_0x6bbb('0x1f')]);_0x2861b2['offset']=qs[_0x6bbb('0x1d')](_0x46a093[_0x6bbb('0x33')][_0x6bbb('0x1d')]);}_0x2861b2[_0x6bbb('0x3a')]=qs['sort'](_0x46a093[_0x6bbb('0x33')][_0x6bbb('0x3b')]);_0x2861b2[_0x6bbb('0x3c')]=qs['filters'](_[_0x6bbb('0x3d')](_0x46a093[_0x6bbb('0x33')],_0x53e491[_0x6bbb('0x3e')]),_0x25af2f);if(_0x46a093[_0x6bbb('0x33')][_0x6bbb('0x3f')]){_0x2861b2[_0x6bbb('0x3c')]=_[_0x6bbb('0x40')](_0x2861b2['where'],{'$or':_[_0x6bbb('0x41')](_0x25af2f,function(_0x3593b0){if(_0x3593b0[_0x6bbb('0x30')]!=='VIRTUAL'){var _0x4a213e={};_0x4a213e[_0x3593b0[_0x6bbb('0x2a')]]={'$like':'%'+_0x46a093['query'][_0x6bbb('0x3f')]+'%'};return _0x4a213e;}})});}_0x2861b2=_['merge']({},_0x2861b2,_0x46a093[_0x6bbb('0x42')]);var _0x16ca57={'where':_0x2861b2['where']};return db['FreshsalesConfiguration'][_0x6bbb('0x20')](_0x16ca57)[_0x6bbb('0x27')](function(_0x1b9c33){_0x42cbb5[_0x6bbb('0x20')]=_0x1b9c33;if(_0x46a093[_0x6bbb('0x33')]['includeAll']){_0x2861b2[_0x6bbb('0x43')]=[{'all':!![]}];}return db[_0x6bbb('0x2d')][_0x6bbb('0x44')](_0x2861b2);})[_0x6bbb('0x27')](function(_0x23692e){_0x42cbb5['rows']=_0x23692e;return _0x42cbb5;})['then'](respondWithFilteredResult(_0x205eb8,_0x2861b2))['catch'](handleError(_0x205eb8,null));};exports['show']=function(_0x30b87b,_0x325a1d){var _0x71f215={'raw':![],'where':{'id':_0x30b87b['params']['id']}},_0x58f338={};_0x58f338['model']=_[_0x6bbb('0x34')](db[_0x6bbb('0x2d')][_0x6bbb('0x2e')]);_0x58f338['query']=_[_0x6bbb('0x34')](_0x30b87b[_0x6bbb('0x33')]);_0x58f338[_0x6bbb('0x3e')]=_[_0x6bbb('0x35')](_0x58f338[_0x6bbb('0x32')],_0x58f338[_0x6bbb('0x33')]);_0x71f215[_0x6bbb('0x37')]=_[_0x6bbb('0x35')](_0x58f338['model'],qs[_0x6bbb('0x36')](_0x30b87b[_0x6bbb('0x33')]['fields']));_0x71f215[_0x6bbb('0x37')]=_0x71f215['attributes']['length']?_0x71f215[_0x6bbb('0x37')]:_0x58f338['model'];if(_0x30b87b[_0x6bbb('0x33')][_0x6bbb('0x45')]){_0x71f215[_0x6bbb('0x43')]=[{'all':!![]}];}_0x71f215=_[_0x6bbb('0x40')]({},_0x71f215,_0x30b87b[_0x6bbb('0x42')]);return db[_0x6bbb('0x2d')][_0x6bbb('0x46')](_0x71f215)[_0x6bbb('0x27')](handleEntityNotFound(_0x325a1d,null))['then'](respondWithResult(_0x325a1d,null))[_0x6bbb('0x47')](handleError(_0x325a1d,null));};exports['create']=function(_0x4f8ab9,_0x463501){return db[_0x6bbb('0x2d')][_0x6bbb('0x48')](_0x4f8ab9['body'],{})[_0x6bbb('0x27')](respondWithResult(_0x463501,0xc9))[_0x6bbb('0x47')](handleError(_0x463501,null));};exports['update']=function(_0x3052a7,_0xdda01){if(_0x3052a7['body']['id']){delete _0x3052a7[_0x6bbb('0x49')]['id'];}return db[_0x6bbb('0x2d')]['find']({'where':{'id':_0x3052a7[_0x6bbb('0x4a')]['id']}})[_0x6bbb('0x27')](handleEntityNotFound(_0xdda01,null))[_0x6bbb('0x27')](saveUpdates(_0x3052a7[_0x6bbb('0x49')],null))['then'](respondWithResult(_0xdda01,null))[_0x6bbb('0x47')](handleError(_0xdda01,null));};exports[_0x6bbb('0x4b')]=function(_0x1e93c3,_0x2d7ba6){return db[_0x6bbb('0x2d')]['find']({'where':{'id':_0x1e93c3[_0x6bbb('0x4a')]['id']}})[_0x6bbb('0x27')](handleEntityNotFound(_0x2d7ba6,null))[_0x6bbb('0x27')](removeEntity(_0x2d7ba6,null))[_0x6bbb('0x47')](handleError(_0x2d7ba6,null));};exports[_0x6bbb('0x4c')]=function(_0x2439a4,_0x4b5961,_0x13bb0a){var _0x448a12={};var _0x16d18a={};var _0x15b545;var _0x3c72b5;return db[_0x6bbb('0x2d')]['findOne']({'where':{'id':_0x2439a4[_0x6bbb('0x4a')]['id']}})[_0x6bbb('0x27')](handleEntityNotFound(_0x4b5961,null))['then'](function(_0x319b6e){if(_0x319b6e){_0x15b545=_0x319b6e;_0x16d18a['model']=_[_0x6bbb('0x34')](db[_0x6bbb('0x4d')][_0x6bbb('0x2e')]);_0x16d18a[_0x6bbb('0x33')]=_[_0x6bbb('0x34')](_0x2439a4[_0x6bbb('0x33')]);_0x16d18a[_0x6bbb('0x3e')]=_[_0x6bbb('0x35')](_0x16d18a['model'],_0x16d18a['query']);_0x448a12['attributes']=_[_0x6bbb('0x35')](_0x16d18a[_0x6bbb('0x32')],qs[_0x6bbb('0x36')](_0x2439a4[_0x6bbb('0x33')][_0x6bbb('0x36')]));_0x448a12[_0x6bbb('0x37')]=_0x448a12[_0x6bbb('0x37')]['length']?_0x448a12[_0x6bbb('0x37')]:_0x16d18a[_0x6bbb('0x32')];_0x448a12[_0x6bbb('0x3a')]=qs[_0x6bbb('0x3b')](_0x2439a4[_0x6bbb('0x33')]['sort']);_0x448a12['where']=qs['filters'](_[_0x6bbb('0x3d')](_0x2439a4[_0x6bbb('0x33')],_0x16d18a[_0x6bbb('0x3e')]));if(_0x2439a4[_0x6bbb('0x33')][_0x6bbb('0x3f')]){_0x448a12[_0x6bbb('0x3c')]=_[_0x6bbb('0x40')](_0x448a12[_0x6bbb('0x3c')],{'$or':_[_0x6bbb('0x41')](_0x448a12['attributes'],function(_0x25e7c7){var _0x1b8427={};_0x1b8427[_0x25e7c7]={'$like':'%'+_0x2439a4[_0x6bbb('0x33')]['filter']+'%'};return _0x1b8427;})});}_0x448a12=_['merge']({},_0x448a12,_0x2439a4[_0x6bbb('0x42')]);return _0x15b545[_0x6bbb('0x4c')](_0x448a12);}})[_0x6bbb('0x27')](function(_0xb41799){if(_0xb41799){_0x3c72b5=_0xb41799[_0x6bbb('0x38')];if(!_0x2439a4[_0x6bbb('0x33')][_0x6bbb('0x39')](_0x6bbb('0x4e'))){_0x448a12[_0x6bbb('0x1f')]=qs['limit'](_0x2439a4[_0x6bbb('0x33')][_0x6bbb('0x1f')]);_0x448a12['offset']=qs[_0x6bbb('0x1d')](_0x2439a4[_0x6bbb('0x33')][_0x6bbb('0x1d')]);}return _0x15b545['getSubjects'](_0x448a12);}})[_0x6bbb('0x27')](function(_0x4784ca){if(_0x4784ca){return _0x4784ca?{'count':_0x3c72b5,'rows':_0x4784ca}:null;}})[_0x6bbb('0x27')](respondWithResult(_0x4b5961,null))['catch'](handleError(_0x4b5961,null));};exports[_0x6bbb('0x4f')]=function(_0x1e6d88,_0x4cc150,_0x2bc94b){var _0x2c1516={};var _0x44ac33={};var _0x2f0f77;var _0x1b4570;return db[_0x6bbb('0x2d')][_0x6bbb('0x50')]({'where':{'id':_0x1e6d88[_0x6bbb('0x4a')]['id']}})[_0x6bbb('0x27')](handleEntityNotFound(_0x4cc150,null))[_0x6bbb('0x27')](function(_0x36313f){if(_0x36313f){_0x2f0f77=_0x36313f;_0x44ac33[_0x6bbb('0x32')]=_[_0x6bbb('0x34')](db['FreshsalesField']['rawAttributes']);_0x44ac33['query']=_[_0x6bbb('0x34')](_0x1e6d88['query']);_0x44ac33[_0x6bbb('0x3e')]=_[_0x6bbb('0x35')](_0x44ac33[_0x6bbb('0x32')],_0x44ac33[_0x6bbb('0x33')]);_0x2c1516[_0x6bbb('0x37')]=_[_0x6bbb('0x35')](_0x44ac33['model'],qs['fields'](_0x1e6d88[_0x6bbb('0x33')][_0x6bbb('0x36')]));_0x2c1516[_0x6bbb('0x37')]=_0x2c1516[_0x6bbb('0x37')][_0x6bbb('0x38')]?_0x2c1516[_0x6bbb('0x37')]:_0x44ac33[_0x6bbb('0x32')];_0x2c1516[_0x6bbb('0x3a')]=qs[_0x6bbb('0x3b')](_0x1e6d88[_0x6bbb('0x33')][_0x6bbb('0x3b')]);_0x2c1516[_0x6bbb('0x3c')]=qs[_0x6bbb('0x3e')](_[_0x6bbb('0x3d')](_0x1e6d88[_0x6bbb('0x33')],_0x44ac33['filters']));if(_0x1e6d88['query'][_0x6bbb('0x3f')]){_0x2c1516['where']=_[_0x6bbb('0x40')](_0x2c1516[_0x6bbb('0x3c')],{'$or':_[_0x6bbb('0x41')](_0x2c1516[_0x6bbb('0x37')],function(_0x98444){var _0x24e287={};_0x24e287[_0x98444]={'$like':'%'+_0x1e6d88[_0x6bbb('0x33')][_0x6bbb('0x3f')]+'%'};return _0x24e287;})});}_0x2c1516=_['merge']({},_0x2c1516,_0x1e6d88[_0x6bbb('0x42')]);return _0x2f0f77[_0x6bbb('0x4f')](_0x2c1516);}})[_0x6bbb('0x27')](function(_0xdb883d){if(_0xdb883d){_0x1b4570=_0xdb883d[_0x6bbb('0x38')];if(!_0x1e6d88[_0x6bbb('0x33')][_0x6bbb('0x39')](_0x6bbb('0x4e'))){_0x2c1516['limit']=qs[_0x6bbb('0x1f')](_0x1e6d88['query'][_0x6bbb('0x1f')]);_0x2c1516[_0x6bbb('0x1d')]=qs[_0x6bbb('0x1d')](_0x1e6d88[_0x6bbb('0x33')][_0x6bbb('0x1d')]);}return _0x2f0f77[_0x6bbb('0x4f')](_0x2c1516);}})['then'](function(_0x2648c4){if(_0x2648c4){return _0x2648c4?{'count':_0x1b4570,'rows':_0x2648c4}:null;}})['then'](respondWithResult(_0x4cc150,null))['catch'](handleError(_0x4cc150,null));};exports[_0x6bbb('0x51')]=function(_0x2ff971,_0x51dddb,_0x253919){var _0x4554e8={};var _0x355427={};var _0x134051;var _0x56a48d;return db[_0x6bbb('0x2d')]['findOne']({'where':{'id':_0x2ff971['params']['id']}})[_0x6bbb('0x27')](handleEntityNotFound(_0x51dddb,null))[_0x6bbb('0x27')](function(_0x5d3520){if(_0x5d3520){_0x134051=_0x5d3520;_0x355427['model']=_[_0x6bbb('0x34')](db['FreshsalesField'][_0x6bbb('0x2e')]);_0x355427[_0x6bbb('0x33')]=_[_0x6bbb('0x34')](_0x2ff971[_0x6bbb('0x33')]);_0x355427[_0x6bbb('0x3e')]=_[_0x6bbb('0x35')](_0x355427[_0x6bbb('0x32')],_0x355427['query']);_0x4554e8[_0x6bbb('0x37')]=_[_0x6bbb('0x35')](_0x355427[_0x6bbb('0x32')],qs['fields'](_0x2ff971[_0x6bbb('0x33')][_0x6bbb('0x36')]));_0x4554e8[_0x6bbb('0x37')]=_0x4554e8[_0x6bbb('0x37')][_0x6bbb('0x38')]?_0x4554e8[_0x6bbb('0x37')]:_0x355427[_0x6bbb('0x32')];_0x4554e8[_0x6bbb('0x3a')]=qs['sort'](_0x2ff971[_0x6bbb('0x33')]['sort']);_0x4554e8[_0x6bbb('0x3c')]=qs['filters'](_['pick'](_0x2ff971['query'],_0x355427[_0x6bbb('0x3e')]));if(_0x2ff971['query']['filter']){_0x4554e8[_0x6bbb('0x3c')]=_[_0x6bbb('0x40')](_0x4554e8[_0x6bbb('0x3c')],{'$or':_[_0x6bbb('0x41')](_0x4554e8[_0x6bbb('0x37')],function(_0x2918b7){var _0x2bb4f0={};_0x2bb4f0[_0x2918b7]={'$like':'%'+_0x2ff971[_0x6bbb('0x33')][_0x6bbb('0x3f')]+'%'};return _0x2bb4f0;})});}_0x4554e8=_[_0x6bbb('0x40')]({},_0x4554e8,_0x2ff971[_0x6bbb('0x42')]);return _0x134051[_0x6bbb('0x51')](_0x4554e8);}})[_0x6bbb('0x27')](function(_0x3e8fa8){if(_0x3e8fa8){_0x56a48d=_0x3e8fa8[_0x6bbb('0x38')];if(!_0x2ff971[_0x6bbb('0x33')]['hasOwnProperty']('nolimit')){_0x4554e8[_0x6bbb('0x1f')]=qs[_0x6bbb('0x1f')](_0x2ff971['query']['limit']);_0x4554e8[_0x6bbb('0x1d')]=qs[_0x6bbb('0x1d')](_0x2ff971[_0x6bbb('0x33')][_0x6bbb('0x1d')]);}return _0x134051[_0x6bbb('0x51')](_0x4554e8);}})['then'](function(_0x164efc){if(_0x164efc){return _0x164efc?{'count':_0x56a48d,'rows':_0x164efc}:null;}})[_0x6bbb('0x27')](respondWithResult(_0x51dddb,null))['catch'](handleError(_0x51dddb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 873c895..910f724 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 _0x251c=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x251c,0x186));var _0xc251=function(_0x5bb6bb,_0x366538){_0x5bb6bb=_0x5bb6bb-0x0;var _0x41bfb1=_0x251c[_0x5bb6bb];return _0x41bfb1;};'use strict';var _=require(_0xc251('0x0'));var util=require(_0xc251('0x1'));var logger=require('../../config/logger')(_0xc251('0x2'));var moment=require(_0xc251('0x3'));var BPromise=require(_0xc251('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc251('0x5'));var rimraf=require(_0xc251('0x6'));var config=require(_0xc251('0x7'));var attributes=require(_0xc251('0x8'));module['exports']=function(_0x4082e5,_0x372c5e){return _0x4082e5[_0xc251('0x9')](_0xc251('0xa'),attributes,{'tableName':_0xc251('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeec3=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2be614,_0x5678b8){var _0x489992=function(_0x447b3f){while(--_0x447b3f){_0x2be614['push'](_0x2be614['shift']());}};_0x489992(++_0x5678b8);}(_0xeec3,0x14b));var _0x3eec=function(_0xe78537,_0xee96ce){_0xe78537=_0xe78537-0x0;var _0x1d51c4=_0xeec3[_0xe78537];return _0x1d51c4;};'use strict';var _=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var logger=require(_0x3eec('0x2'))(_0x3eec('0x3'));var moment=require(_0x3eec('0x4'));var BPromise=require('bluebird');var rp=require(_0x3eec('0x5'));var fs=require('fs');var path=require(_0x3eec('0x6'));var rimraf=require(_0x3eec('0x7'));var config=require(_0x3eec('0x8'));var attributes=require(_0x3eec('0x9'));module['exports']=function(_0x280749,_0x53fd1e){return _0x280749[_0x3eec('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x3eec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index a62c932..accb225 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 _0x0807=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x0807,0xdb));var _0x7080=function(_0x189ddb,_0x5519ee){_0x189ddb=_0x189ddb-0x0;var _0x52f283=_0x0807[_0x189ddb];return _0x52f283;};'use strict';var _=require(_0x7080('0x0'));var util=require(_0x7080('0x1'));var moment=require('moment');var BPromise=require(_0x7080('0x2'));var rs=require(_0x7080('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7080('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7080('0x5'))(_0x7080('0x6'));var config=require(_0x7080('0x7'));var jayson=require(_0x7080('0x8'));var client=jayson[_0x7080('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4028dd,_0x312345,_0x2b2c3f){return new BPromise(function(_0xeb3e6d,_0xdd6bc7){return client[_0x7080('0xa')](_0x4028dd,_0x2b2c3f)['then'](function(_0x5d3b29){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x312345,_0x7080('0xb'));logger[_0x7080('0xc')](_0x7080('0xd'),_0x312345,'request\x20sent',JSON[_0x7080('0xe')](_0x5d3b29));if(_0x5d3b29[_0x7080('0xf')]){if(_0x5d3b29[_0x7080('0xf')][_0x7080('0x10')]===0x1f4){logger[_0x7080('0xf')](_0x7080('0x11'),_0x312345,_0x5d3b29['error'][_0x7080('0x12')]);return _0xdd6bc7(_0x5d3b29[_0x7080('0xf')][_0x7080('0x12')]);}logger['error'](_0x7080('0x11'),_0x312345,_0x5d3b29[_0x7080('0xf')]['message']);return _0xeb3e6d(_0x5d3b29[_0x7080('0xf')][_0x7080('0x12')]);}else{logger[_0x7080('0x13')](_0x7080('0x11'),_0x312345,'request\x20sent');_0xeb3e6d(_0x5d3b29[_0x7080('0x14')][_0x7080('0x12')]);}})['catch'](function(_0xb22dcb){logger[_0x7080('0xf')](_0x7080('0x11'),_0x312345,_0xb22dcb);_0xdd6bc7(_0xb22dcb);});});} \ No newline at end of file +var _0x2f4e=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0xa3e0f7,_0x1b06db){var _0x4ce604=function(_0x29df1e){while(--_0x29df1e){_0xa3e0f7['push'](_0xa3e0f7['shift']());}};_0x4ce604(++_0x1b06db);}(_0x2f4e,0x69));var _0xe2f4=function(_0x307159,_0xe96798){_0x307159=_0x307159-0x0;var _0x5241f1=_0x2f4e[_0x307159];return _0x5241f1;};'use strict';var _=require(_0xe2f4('0x0'));var util=require('util');var moment=require(_0xe2f4('0x1'));var BPromise=require('bluebird');var rs=require(_0xe2f4('0x2'));var fs=require('fs');var Redis=require(_0xe2f4('0x3'));var db=require(_0xe2f4('0x4'))['db'];var utils=require(_0xe2f4('0x5'));var logger=require(_0xe2f4('0x6'))(_0xe2f4('0x7'));var config=require(_0xe2f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe2f4('0x9')][_0xe2f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bd113,_0x2913e1,_0x13044a){return new BPromise(function(_0x4c6db4,_0x280721){return client[_0xe2f4('0xb')](_0x1bd113,_0x13044a)[_0xe2f4('0xc')](function(_0x123b49){logger[_0xe2f4('0xd')](_0xe2f4('0xe'),_0x2913e1,_0xe2f4('0xf'));logger['debug'](_0xe2f4('0x10'),_0x2913e1,_0xe2f4('0xf'),JSON[_0xe2f4('0x11')](_0x123b49));if(_0x123b49['error']){if(_0x123b49[_0xe2f4('0x12')]['code']===0x1f4){logger['error'](_0xe2f4('0xe'),_0x2913e1,_0x123b49['error'][_0xe2f4('0x13')]);return _0x280721(_0x123b49[_0xe2f4('0x12')][_0xe2f4('0x13')]);}logger[_0xe2f4('0x12')](_0xe2f4('0xe'),_0x2913e1,_0x123b49[_0xe2f4('0x12')]['message']);return _0x4c6db4(_0x123b49[_0xe2f4('0x12')][_0xe2f4('0x13')]);}else{logger[_0xe2f4('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2913e1,_0xe2f4('0xf'));_0x4c6db4(_0x123b49[_0xe2f4('0x14')][_0xe2f4('0x13')]);}})[_0xe2f4('0x15')](function(_0x1dc457){logger[_0xe2f4('0x12')](_0xe2f4('0xe'),_0x2913e1,_0x1dc457);_0x280721(_0x1dc457);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 68b8145..34d4a67 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 _0xad95=['isAuthenticated','show','post','create','update','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','get','/:id'];(function(_0x3e3f27,_0x2c2ecf){var _0x15c868=function(_0x4b348d){while(--_0x4b348d){_0x3e3f27['push'](_0x3e3f27['shift']());}};_0x15c868(++_0x2c2ecf);}(_0xad95,0x70));var _0x5ad9=function(_0x4be2c6,_0x5b9ac1){_0x4be2c6=_0x4be2c6-0x0;var _0x4fc8a9=_0xad95[_0x4be2c6];return _0x4fc8a9;};'use strict';var multer=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var path=require(_0x5ad9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5ad9('0x3')]();var fs_extra=require(_0x5ad9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ad9('0x5'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5ad9('0x6')](_0x5ad9('0x7'),auth[_0x5ad9('0x8')](),controller[_0x5ad9('0x9')]);router[_0x5ad9('0xa')]('/',auth['isAuthenticated'](),controller[_0x5ad9('0xb')]);router['put']('/:id',auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xc')]);router[_0x5ad9('0xd')]('/:id',auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6282=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x6282,0x76));var _0x2628=function(_0x4f64ed,_0x59c8c4){_0x4f64ed=_0x4f64ed-0x0;var _0x206f04=_0x6282[_0x4f64ed];return _0x206f04;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2628('0x4'));var auth=require(_0x2628('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2628('0x6'));var controller=require(_0x2628('0x7'));router[_0x2628('0x8')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xa')]);router['get'](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xe')]);router[_0x2628('0xf')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x10')]);router[_0x2628('0x11')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x12')]);module[_0x2628('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ed87324..7e66ad0 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 _0xcb95=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x16b8fe,_0x2b4075){var _0x456919=function(_0x49ac45){while(--_0x49ac45){_0x16b8fe['push'](_0x16b8fe['shift']());}};_0x456919(++_0x2b4075);}(_0xcb95,0x156));var _0x5cb9=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xcb95[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x5cb9('0x0'));module['exports']={'type':{'type':Sequelize[_0x5cb9('0x1')](_0x5cb9('0x2'),_0x5cb9('0x3'),_0x5cb9('0x4'),_0x5cb9('0x5'),_0x5cb9('0x6')),'defaultValue':_0x5cb9('0x2')},'content':{'type':Sequelize[_0x5cb9('0x7')]},'key':{'type':Sequelize[_0x5cb9('0x7')]},'keyType':{'type':Sequelize[_0x5cb9('0x1')](_0x5cb9('0x2'),_0x5cb9('0x3'),_0x5cb9('0x4'))},'keyContent':{'type':Sequelize[_0x5cb9('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5cb9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cb9('0x7')]}}; \ No newline at end of file +var _0x217a=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x358c20,_0x43bc51){var _0xf4df96=function(_0x328eed){while(--_0x328eed){_0x358c20['push'](_0x358c20['shift']());}};_0xf4df96(++_0x43bc51);}(_0x217a,0x138));var _0xa217=function(_0x562658,_0x474c16){_0x562658=_0x562658-0x0;var _0x42cd8c=_0x217a[_0x562658];return _0x42cd8c;};'use strict';var Sequelize=require(_0xa217('0x0'));module[_0xa217('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa217('0x2'),_0xa217('0x3'),_0xa217('0x4'),_0xa217('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa217('0x6')]},'key':{'type':Sequelize[_0xa217('0x6')]},'keyType':{'type':Sequelize[_0xa217('0x7')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xa217('0x6')]},'idField':{'type':Sequelize[_0xa217('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa217('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ae22577..b94dd9d 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 _0xcbae=['undefined','count','limit','status','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','FreshsalesField','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset'];(function(_0xcc3c91,_0x3ec8a3){var _0x178bf3=function(_0xf64238){while(--_0xf64238){_0xcc3c91['push'](_0xcc3c91['shift']());}};_0x178bf3(++_0x3ec8a3);}(_0xcbae,0xc3));var _0xecba=function(_0x375ab3,_0x3c1f43){_0x375ab3=_0x375ab3-0x0;var _0x6c649f=_0xcbae[_0x375ab3];return _0x6c649f;};'use strict';var emlformat=require(_0xecba('0x0'));var rimraf=require(_0xecba('0x1'));var zipdir=require(_0xecba('0x2'));var jsonpatch=require(_0xecba('0x3'));var rp=require(_0xecba('0x4'));var moment=require(_0xecba('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xecba('0x6'));var path=require(_0xecba('0x7'));var sox=require(_0xecba('0x8'));var csv=require(_0xecba('0x9'));var ejs=require(_0xecba('0xa'));var fs=require('fs');var fs_extra=require(_0xecba('0xb'));var _=require('lodash');var squel=require(_0xecba('0xc'));var crypto=require(_0xecba('0xd'));var jsforce=require(_0xecba('0xe'));var deskjs=require(_0xecba('0xf'));var toCsv=require(_0xecba('0x9'));var querystring=require('querystring');var Papa=require(_0xecba('0x10'));var Redis=require('ioredis');var authService=require(_0xecba('0x11'));var qs=require(_0xecba('0x12'));var as=require(_0xecba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecba('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xecba('0x15'));var licenseUtil=require(_0xecba('0x16'));var db=require(_0xecba('0x17'))['db'];function respondWithStatusCode(_0x31f3d5,_0x4c7fba){_0x4c7fba=_0x4c7fba||0xcc;return function(_0x3ba3c0){if(_0x3ba3c0){return _0x31f3d5[_0xecba('0x18')](_0x4c7fba);}return _0x31f3d5['status'](_0x4c7fba)['end']();};}function respondWithResult(_0x1662b6,_0x59c73c){_0x59c73c=_0x59c73c||0xc8;return function(_0x3f688c){if(_0x3f688c){return _0x1662b6['status'](_0x59c73c)[_0xecba('0x19')](_0x3f688c);}};}function respondWithFilteredResult(_0x871a1b,_0x1abe52){return function(_0x5bc410){if(_0x5bc410){var _0x2c7f57=typeof _0x1abe52[_0xecba('0x1a')]===_0xecba('0x1b')&&typeof _0x1abe52['limit']===_0xecba('0x1b');var _0x7b5b91=_0x5bc410['count'];var _0x46b261=_0x2c7f57?0x0:_0x1abe52[_0xecba('0x1a')];var _0x167650=_0x2c7f57?_0x5bc410[_0xecba('0x1c')]:_0x1abe52[_0xecba('0x1a')]+_0x1abe52[_0xecba('0x1d')];var _0xb8de8b;if(_0x167650>=_0x7b5b91){_0x167650=_0x7b5b91;_0xb8de8b=0xc8;}else{_0xb8de8b=0xce;}_0x871a1b[_0xecba('0x1e')](_0xb8de8b);return _0x871a1b[_0xecba('0x1f')]('Content-Range',_0x46b261+'-'+_0x167650+'/'+_0x7b5b91)['json'](_0x5bc410);}return null;};}function patchUpdates(_0x22641c){return function(_0x70aa8d){try{jsonpatch[_0xecba('0x20')](_0x70aa8d,_0x22641c,!![]);}catch(_0x154218){return BPromise[_0xecba('0x21')](_0x154218);}return _0x70aa8d[_0xecba('0x22')]();};}function saveUpdates(_0x516c62,_0x8a3f29){return function(_0x83ad65){if(_0x83ad65){return _0x83ad65['update'](_0x516c62)['then'](function(_0x203608){return _0x203608;});}return null;};}function removeEntity(_0x202cbb,_0x72c1cd){return function(_0x2c40ab){if(_0x2c40ab){return _0x2c40ab[_0xecba('0x23')]()[_0xecba('0x24')](function(){_0x202cbb[_0xecba('0x1e')](0xcc)[_0xecba('0x25')]();});}};}function handleEntityNotFound(_0x3608af,_0x25812b){return function(_0x4b7c97){if(!_0x4b7c97){_0x3608af[_0xecba('0x18')](0x194);}return _0x4b7c97;};}function handleError(_0x5566d1,_0x5c326a){_0x5c326a=_0x5c326a||0x1f4;return function(_0xd88751){logger[_0xecba('0x26')](_0xd88751[_0xecba('0x27')]);if(_0xd88751[_0xecba('0x28')]){delete _0xd88751[_0xecba('0x28')];}_0x5566d1[_0xecba('0x1e')](_0x5c326a)[_0xecba('0x29')](_0xd88751);};}exports[_0xecba('0x2a')]=function(_0x43ac16,_0x545773){var _0x1e7d8e={},_0x349987={},_0x368541={'count':0x0,'rows':[]};var _0x143628=_[_0xecba('0x2b')](db[_0xecba('0x2c')]['rawAttributes'],function(_0x3b24ab){return{'name':_0x3b24ab['fieldName'],'type':_0x3b24ab['type']['key']};});_0x349987['model']=_[_0xecba('0x2b')](_0x143628,_0xecba('0x28'));_0x349987['query']=_[_0xecba('0x2d')](_0x43ac16[_0xecba('0x2e')]);_0x349987[_0xecba('0x2f')]=_[_0xecba('0x30')](_0x349987[_0xecba('0x31')],_0x349987[_0xecba('0x2e')]);_0x1e7d8e[_0xecba('0x32')]=_['intersection'](_0x349987['model'],qs[_0xecba('0x33')](_0x43ac16[_0xecba('0x2e')]['fields']));_0x1e7d8e[_0xecba('0x32')]=_0x1e7d8e[_0xecba('0x32')][_0xecba('0x34')]?_0x1e7d8e[_0xecba('0x32')]:_0x349987[_0xecba('0x31')];if(!_0x43ac16[_0xecba('0x2e')][_0xecba('0x35')](_0xecba('0x36'))){_0x1e7d8e[_0xecba('0x1d')]=qs[_0xecba('0x1d')](_0x43ac16[_0xecba('0x2e')][_0xecba('0x1d')]);_0x1e7d8e[_0xecba('0x1a')]=qs['offset'](_0x43ac16['query'][_0xecba('0x1a')]);}_0x1e7d8e[_0xecba('0x37')]=qs['sort'](_0x43ac16[_0xecba('0x2e')][_0xecba('0x38')]);_0x1e7d8e[_0xecba('0x39')]=qs['filters'](_[_0xecba('0x3a')](_0x43ac16[_0xecba('0x2e')],_0x349987['filters']),_0x143628);if(_0x43ac16['query'][_0xecba('0x3b')]){_0x1e7d8e[_0xecba('0x39')]=_['merge'](_0x1e7d8e['where'],{'$or':_[_0xecba('0x2b')](_0x143628,function(_0x37e735){if(_0x37e735[_0xecba('0x3c')]!=='VIRTUAL'){var _0x4e7974={};_0x4e7974[_0x37e735[_0xecba('0x28')]]={'$like':'%'+_0x43ac16[_0xecba('0x2e')][_0xecba('0x3b')]+'%'};return _0x4e7974;}})});}_0x1e7d8e=_[_0xecba('0x3d')]({},_0x1e7d8e,_0x43ac16[_0xecba('0x3e')]);var _0x592545={'where':_0x1e7d8e[_0xecba('0x39')]};return db[_0xecba('0x2c')]['count'](_0x592545)[_0xecba('0x24')](function(_0x11fc30){_0x368541['count']=_0x11fc30;if(_0x43ac16[_0xecba('0x2e')]['includeAll']){_0x1e7d8e['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xecba('0x3f')](_0x1e7d8e);})[_0xecba('0x24')](function(_0x57bdc4){_0x368541[_0xecba('0x40')]=_0x57bdc4;return _0x368541;})[_0xecba('0x24')](respondWithFilteredResult(_0x545773,_0x1e7d8e))[_0xecba('0x41')](handleError(_0x545773,null));};exports[_0xecba('0x42')]=function(_0x41d44b,_0x5e0c79){var _0x4dd3cc={'raw':!![],'where':{'id':_0x41d44b[_0xecba('0x43')]['id']}},_0xc11d4c={};_0xc11d4c[_0xecba('0x31')]=_[_0xecba('0x2d')](db['FreshsalesField'][_0xecba('0x44')]);_0xc11d4c[_0xecba('0x2e')]=_[_0xecba('0x2d')](_0x41d44b['query']);_0xc11d4c[_0xecba('0x2f')]=_[_0xecba('0x30')](_0xc11d4c[_0xecba('0x31')],_0xc11d4c[_0xecba('0x2e')]);_0x4dd3cc[_0xecba('0x32')]=_[_0xecba('0x30')](_0xc11d4c['model'],qs[_0xecba('0x33')](_0x41d44b[_0xecba('0x2e')][_0xecba('0x33')]));_0x4dd3cc[_0xecba('0x32')]=_0x4dd3cc[_0xecba('0x32')][_0xecba('0x34')]?_0x4dd3cc[_0xecba('0x32')]:_0xc11d4c[_0xecba('0x31')];if(_0x41d44b['query'][_0xecba('0x45')]){_0x4dd3cc[_0xecba('0x46')]=[{'all':!![]}];}_0x4dd3cc=_[_0xecba('0x3d')]({},_0x4dd3cc,_0x41d44b[_0xecba('0x3e')]);return db[_0xecba('0x2c')][_0xecba('0x47')](_0x4dd3cc)['then'](handleEntityNotFound(_0x5e0c79,null))[_0xecba('0x24')](respondWithResult(_0x5e0c79,null))[_0xecba('0x41')](handleError(_0x5e0c79,null));};exports[_0xecba('0x48')]=function(_0x387fd8,_0x59da3d){return db[_0xecba('0x2c')]['create'](_0x387fd8[_0xecba('0x49')],{})[_0xecba('0x24')](respondWithResult(_0x59da3d,0xc9))['catch'](handleError(_0x59da3d,null));};exports['update']=function(_0x1c1f1b,_0x224096){if(_0x1c1f1b['body']['id']){delete _0x1c1f1b[_0xecba('0x49')]['id'];}return db[_0xecba('0x2c')]['find']({'where':{'id':_0x1c1f1b[_0xecba('0x43')]['id']}})[_0xecba('0x24')](handleEntityNotFound(_0x224096,null))[_0xecba('0x24')](saveUpdates(_0x1c1f1b[_0xecba('0x49')],null))[_0xecba('0x24')](respondWithResult(_0x224096,null))[_0xecba('0x41')](handleError(_0x224096,null));};exports['destroy']=function(_0x38d0b3,_0x4459ae){return db[_0xecba('0x2c')]['find']({'where':{'id':_0x38d0b3['params']['id']}})[_0xecba('0x24')](handleEntityNotFound(_0x4459ae,null))[_0xecba('0x24')](removeEntity(_0x4459ae,null))['catch'](handleError(_0x4459ae,null));}; \ No newline at end of file +var _0x6893=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','FreshsalesField','includeAll','include','findAll','show','rawAttributes','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash'];(function(_0x2e6399,_0x1c175b){var _0x3a4dec=function(_0x18a409){while(--_0x18a409){_0x2e6399['push'](_0x2e6399['shift']());}};_0x3a4dec(++_0x1c175b);}(_0x6893,0x1ab));var _0x3689=function(_0x3dc190,_0xa6c975){_0x3dc190=_0x3dc190-0x0;var _0x5bde76=_0x6893[_0x3dc190];return _0x5bde76;};'use strict';var emlformat=require(_0x3689('0x0'));var rimraf=require(_0x3689('0x1'));var zipdir=require(_0x3689('0x2'));var jsonpatch=require(_0x3689('0x3'));var rp=require('request-promise');var moment=require(_0x3689('0x4'));var BPromise=require(_0x3689('0x5'));var Mustache=require(_0x3689('0x6'));var util=require('util');var path=require(_0x3689('0x7'));var sox=require(_0x3689('0x8'));var csv=require(_0x3689('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3689('0xa'));var squel=require(_0x3689('0xb'));var crypto=require(_0x3689('0xc'));var jsforce=require(_0x3689('0xd'));var deskjs=require(_0x3689('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3689('0xf'));var Papa=require(_0x3689('0x10'));var Redis=require(_0x3689('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3689('0x12'));var as=require(_0x3689('0x13'));var hardwareService=require(_0x3689('0x14'));var logger=require(_0x3689('0x15'))('api');var utils=require(_0x3689('0x16'));var config=require(_0x3689('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc84958,_0x258b1d){_0x258b1d=_0x258b1d||0xcc;return function(_0x39486e){if(_0x39486e){return _0xc84958['sendStatus'](_0x258b1d);}return _0xc84958[_0x3689('0x18')](_0x258b1d)[_0x3689('0x19')]();};}function respondWithResult(_0x2624af,_0x1c2fec){_0x1c2fec=_0x1c2fec||0xc8;return function(_0x5dcab3){if(_0x5dcab3){return _0x2624af['status'](_0x1c2fec)[_0x3689('0x1a')](_0x5dcab3);}};}function respondWithFilteredResult(_0x1c09cf,_0x559120){return function(_0x139d8a){if(_0x139d8a){var _0x4fa617=typeof _0x559120[_0x3689('0x1b')]===_0x3689('0x1c')&&typeof _0x559120[_0x3689('0x1d')]===_0x3689('0x1c');var _0x4f2bfa=_0x139d8a[_0x3689('0x1e')];var _0x555f04=_0x4fa617?0x0:_0x559120[_0x3689('0x1b')];var _0x4c842f=_0x4fa617?_0x139d8a[_0x3689('0x1e')]:_0x559120[_0x3689('0x1b')]+_0x559120[_0x3689('0x1d')];var _0x13af43;if(_0x4c842f>=_0x4f2bfa){_0x4c842f=_0x4f2bfa;_0x13af43=0xc8;}else{_0x13af43=0xce;}_0x1c09cf[_0x3689('0x18')](_0x13af43);return _0x1c09cf[_0x3689('0x1f')](_0x3689('0x20'),_0x555f04+'-'+_0x4c842f+'/'+_0x4f2bfa)[_0x3689('0x1a')](_0x139d8a);}return null;};}function patchUpdates(_0x17b8d3){return function(_0x2b1ca5){try{jsonpatch['apply'](_0x2b1ca5,_0x17b8d3,!![]);}catch(_0x5bddd4){return BPromise[_0x3689('0x21')](_0x5bddd4);}return _0x2b1ca5[_0x3689('0x22')]();};}function saveUpdates(_0x222bd3,_0x19353c){return function(_0x131977){if(_0x131977){return _0x131977[_0x3689('0x23')](_0x222bd3)[_0x3689('0x24')](function(_0x322597){return _0x322597;});}return null;};}function removeEntity(_0x32c090,_0xcc7edd){return function(_0x9bbbc0){if(_0x9bbbc0){return _0x9bbbc0[_0x3689('0x25')]()[_0x3689('0x24')](function(){_0x32c090['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa319f4,_0x5e99e0){return function(_0x48c590){if(!_0x48c590){_0xa319f4[_0x3689('0x26')](0x194);}return _0x48c590;};}function handleError(_0x3a37e7,_0x4a5d13){_0x4a5d13=_0x4a5d13||0x1f4;return function(_0x16aae0){logger['error'](_0x16aae0[_0x3689('0x27')]);if(_0x16aae0[_0x3689('0x28')]){delete _0x16aae0[_0x3689('0x28')];}_0x3a37e7[_0x3689('0x18')](_0x4a5d13)[_0x3689('0x29')](_0x16aae0);};}exports[_0x3689('0x2a')]=function(_0x3417da,_0x38c0f8){var _0x4a0e04={},_0x51481a={},_0x21bd9c={'count':0x0,'rows':[]};var _0x403448=_[_0x3689('0x2b')](db['FreshsalesField']['rawAttributes'],function(_0x7d81c3){return{'name':_0x7d81c3[_0x3689('0x2c')],'type':_0x7d81c3['type'][_0x3689('0x2d')]};});_0x51481a[_0x3689('0x2e')]=_[_0x3689('0x2b')](_0x403448,_0x3689('0x28'));_0x51481a[_0x3689('0x2f')]=_[_0x3689('0x30')](_0x3417da['query']);_0x51481a[_0x3689('0x31')]=_[_0x3689('0x32')](_0x51481a[_0x3689('0x2e')],_0x51481a[_0x3689('0x2f')]);_0x4a0e04[_0x3689('0x33')]=_[_0x3689('0x32')](_0x51481a[_0x3689('0x2e')],qs['fields'](_0x3417da['query'][_0x3689('0x34')]));_0x4a0e04[_0x3689('0x33')]=_0x4a0e04[_0x3689('0x33')]['length']?_0x4a0e04[_0x3689('0x33')]:_0x51481a[_0x3689('0x2e')];if(!_0x3417da[_0x3689('0x2f')][_0x3689('0x35')](_0x3689('0x36'))){_0x4a0e04[_0x3689('0x1d')]=qs['limit'](_0x3417da[_0x3689('0x2f')][_0x3689('0x1d')]);_0x4a0e04[_0x3689('0x1b')]=qs[_0x3689('0x1b')](_0x3417da[_0x3689('0x2f')][_0x3689('0x1b')]);}_0x4a0e04['order']=qs[_0x3689('0x37')](_0x3417da[_0x3689('0x2f')]['sort']);_0x4a0e04[_0x3689('0x38')]=qs[_0x3689('0x31')](_[_0x3689('0x39')](_0x3417da[_0x3689('0x2f')],_0x51481a[_0x3689('0x31')]),_0x403448);if(_0x3417da[_0x3689('0x2f')][_0x3689('0x3a')]){_0x4a0e04[_0x3689('0x38')]=_[_0x3689('0x3b')](_0x4a0e04[_0x3689('0x38')],{'$or':_[_0x3689('0x2b')](_0x403448,function(_0x3cc1f9){if(_0x3cc1f9[_0x3689('0x3c')]!=='VIRTUAL'){var _0x2332de={};_0x2332de[_0x3cc1f9[_0x3689('0x28')]]={'$like':'%'+_0x3417da['query']['filter']+'%'};return _0x2332de;}})});}_0x4a0e04=_['merge']({},_0x4a0e04,_0x3417da['options']);var _0x2cd45e={'where':_0x4a0e04[_0x3689('0x38')]};return db[_0x3689('0x3d')][_0x3689('0x1e')](_0x2cd45e)[_0x3689('0x24')](function(_0x4e4a8e){_0x21bd9c[_0x3689('0x1e')]=_0x4e4a8e;if(_0x3417da[_0x3689('0x2f')][_0x3689('0x3e')]){_0x4a0e04[_0x3689('0x3f')]=[{'all':!![]}];}return db[_0x3689('0x3d')][_0x3689('0x40')](_0x4a0e04);})['then'](function(_0x3052f7){_0x21bd9c['rows']=_0x3052f7;return _0x21bd9c;})[_0x3689('0x24')](respondWithFilteredResult(_0x38c0f8,_0x4a0e04))['catch'](handleError(_0x38c0f8,null));};exports[_0x3689('0x41')]=function(_0x272aac,_0xdc8daf){var _0x497953={'raw':!![],'where':{'id':_0x272aac['params']['id']}},_0x262116={};_0x262116[_0x3689('0x2e')]=_[_0x3689('0x30')](db[_0x3689('0x3d')][_0x3689('0x42')]);_0x262116[_0x3689('0x2f')]=_['keys'](_0x272aac[_0x3689('0x2f')]);_0x262116['filters']=_[_0x3689('0x32')](_0x262116['model'],_0x262116[_0x3689('0x2f')]);_0x497953[_0x3689('0x33')]=_[_0x3689('0x32')](_0x262116[_0x3689('0x2e')],qs[_0x3689('0x34')](_0x272aac[_0x3689('0x2f')][_0x3689('0x34')]));_0x497953[_0x3689('0x33')]=_0x497953['attributes'][_0x3689('0x43')]?_0x497953[_0x3689('0x33')]:_0x262116[_0x3689('0x2e')];if(_0x272aac[_0x3689('0x2f')]['includeAll']){_0x497953[_0x3689('0x3f')]=[{'all':!![]}];}_0x497953=_[_0x3689('0x3b')]({},_0x497953,_0x272aac[_0x3689('0x44')]);return db[_0x3689('0x3d')][_0x3689('0x45')](_0x497953)[_0x3689('0x24')](handleEntityNotFound(_0xdc8daf,null))['then'](respondWithResult(_0xdc8daf,null))[_0x3689('0x46')](handleError(_0xdc8daf,null));};exports[_0x3689('0x47')]=function(_0x3f495e,_0x274a31){return db[_0x3689('0x3d')][_0x3689('0x47')](_0x3f495e[_0x3689('0x48')],{})[_0x3689('0x24')](respondWithResult(_0x274a31,0xc9))[_0x3689('0x46')](handleError(_0x274a31,null));};exports[_0x3689('0x23')]=function(_0x5bcf9b,_0x53cbea){if(_0x5bcf9b[_0x3689('0x48')]['id']){delete _0x5bcf9b[_0x3689('0x48')]['id'];}return db[_0x3689('0x3d')]['find']({'where':{'id':_0x5bcf9b['params']['id']}})['then'](handleEntityNotFound(_0x53cbea,null))[_0x3689('0x24')](saveUpdates(_0x5bcf9b[_0x3689('0x48')],null))['then'](respondWithResult(_0x53cbea,null))['catch'](handleError(_0x53cbea,null));};exports[_0x3689('0x25')]=function(_0x6db0ad,_0x482196){return db[_0x3689('0x3d')]['find']({'where':{'id':_0x6db0ad['params']['id']}})['then'](handleEntityNotFound(_0x482196,null))[_0x3689('0x24')](removeEntity(_0x482196,null))[_0x3689('0x46')](handleError(_0x482196,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6b04ed5..b11cff7 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 _0xe3b3=['freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe3b3,0x1b3));var _0x3e3b=function(_0x117d37,_0x3740dd){_0x117d37=_0x117d37-0x0;var _0x5ce28f=_0xe3b3[_0x117d37];return _0x5ce28f;};'use strict';var _=require(_0x3e3b('0x0'));var util=require(_0x3e3b('0x1'));var logger=require(_0x3e3b('0x2'))(_0x3e3b('0x3'));var moment=require(_0x3e3b('0x4'));var BPromise=require(_0x3e3b('0x5'));var rp=require(_0x3e3b('0x6'));var fs=require('fs');var path=require(_0x3e3b('0x7'));var rimraf=require(_0x3e3b('0x8'));var config=require(_0x3e3b('0x9'));var attributes=require('./intFreshsalesField.attributes');module[_0x3e3b('0xa')]=function(_0x3fd79a,_0x410458){return _0x3fd79a['define'](_0x3e3b('0xb'),attributes,{'tableName':_0x3e3b('0xc'),'paranoid':![],'indexes':[{'name':_0x3e3b('0xd'),'fields':[_0x3e3b('0xe'),_0x3e3b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4efb=['api','bluebird','path','rimraf','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4efb,0xfa));var _0xb4ef=function(_0x58ed91,_0xdaba62){_0x58ed91=_0x58ed91-0x0;var _0x2fe0be=_0x4efb[_0x58ed91];return _0x2fe0be;};'use strict';var _=require('lodash');var util=require(_0xb4ef('0x0'));var logger=require(_0xb4ef('0x1'))(_0xb4ef('0x2'));var moment=require('moment');var BPromise=require(_0xb4ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4ef('0x4'));var rimraf=require(_0xb4ef('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4ef('0x6'));module['exports']=function(_0x1f69fc,_0xd99454){return _0x1f69fc[_0xb4ef('0x7')](_0xb4ef('0x8'),attributes,{'tableName':_0xb4ef('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb4ef('0xa'),_0xb4ef('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 919053b..71000c4 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0xf494,0x1c6));var _0x4f49=function(_0xf69c37,_0x35fd40){_0xf69c37=_0xf69c37-0x0;var _0x1f4eaf=_0xf494[_0xf69c37];return _0x1f4eaf;};'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);});});} \ No newline at end of file +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(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xacf4,0xe7));var _0x4acf=function(_0x558010,_0x4a71e6){_0x558010=_0x558010-0x0;var _0x3b9dba=_0xacf4[_0x558010];return _0x3b9dba;};'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 diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c70900f..9bf7937 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(_0x132441,_0xe37b7){var _0x216a93=function(_0x3437b3){while(--_0x3437b3){_0x132441['push'](_0x132441['shift']());}};_0x216a93(++_0xe37b7);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2fd184,_0x5c30ff){var _0x53f8e5=function(_0x44c7a8){while(--_0x44c7a8){_0x2fd184['push'](_0x2fd184['shift']());}};_0x53f8e5(++_0x5c30ff);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 52a8793..690a443 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 _0xcefd=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x4cd2a2,_0x2acc49){var _0xfeb181=function(_0x11c960){while(--_0x11c960){_0x4cd2a2['push'](_0x4cd2a2['shift']());}};_0xfeb181(++_0x2acc49);}(_0xcefd,0x126));var _0xdcef=function(_0xa650d8,_0x6d01ef){_0xa650d8=_0xa650d8-0x0;var _0x79ce97=_0xcefd[_0xa650d8];return _0x79ce97;};'use strict';var Sequelize=require(_0xdcef('0x0'));module[_0xdcef('0x1')]={'name':{'type':Sequelize[_0xdcef('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdcef('0x2')],'unique':_0xdcef('0x3')},'remoteUri':{'type':Sequelize[_0xdcef('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xdcef('0x2')]},'clientSecret':{'type':Sequelize[_0xdcef('0x2')]},'securityToken':{'type':Sequelize[_0xdcef('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdcef('0x4')](_0xdcef('0x5'),_0xdcef('0x6')),'defaultValue':_0xdcef('0x5')}}; \ No newline at end of file +var _0x68fd=['STRING','username','ENUM','integrationTab','sequelize'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x68fd,0x1e9));var _0xd68f=function(_0xba4f68,_0x3d9dbe){_0xba4f68=_0xba4f68-0x0;var _0x53b86c=_0x68fd[_0xba4f68];return _0x53b86c;};'use strict';var Sequelize=require(_0xd68f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd68f('0x1')]},'description':{'type':Sequelize[_0xd68f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xd68f('0x2')},'remoteUri':{'type':Sequelize[_0xd68f('0x1')]},'password':{'type':Sequelize[_0xd68f('0x1')]},'clientId':{'type':Sequelize[_0xd68f('0x1')]},'clientSecret':{'type':Sequelize[_0xd68f('0x1')]},'securityToken':{'type':Sequelize[_0xd68f('0x1')]},'serverUrl':{'type':Sequelize[_0xd68f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd68f('0x3')](_0xd68f('0x4'),'newTab'),'defaultValue':_0xd68f('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9ccd14b..c89610c 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 _0x51f7=['fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','name','merge','includeAll','include','findAll','rows','params','rawAttributes','catch','create','body','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','username','password','securityToken','remoteUri','slice','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','index','SalesforceAccount'];(function(_0xa4a3f1,_0x30775b){var _0x37a952=function(_0x477cc1){while(--_0x477cc1){_0xa4a3f1['push'](_0xa4a3f1['shift']());}};_0x37a952(++_0x30775b);}(_0x51f7,0xd2));var _0x751f=function(_0x4ebb5d,_0x1e92b6){_0x4ebb5d=_0x4ebb5d-0x0;var _0x5abafd=_0x51f7[_0x4ebb5d];return _0x5abafd;};'use strict';var emlformat=require(_0x751f('0x0'));var rimraf=require(_0x751f('0x1'));var zipdir=require(_0x751f('0x2'));var jsonpatch=require(_0x751f('0x3'));var rp=require(_0x751f('0x4'));var moment=require(_0x751f('0x5'));var BPromise=require(_0x751f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x751f('0x7'));var sox=require(_0x751f('0x8'));var csv=require('to-csv');var ejs=require(_0x751f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x751f('0xa'));var squel=require(_0x751f('0xb'));var crypto=require(_0x751f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x751f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x751f('0xe'));var Papa=require(_0x751f('0xf'));var Redis=require(_0x751f('0x10'));var authService=require(_0x751f('0x11'));var qs=require(_0x751f('0x12'));var as=require(_0x751f('0x13'));var hardwareService=require(_0x751f('0x14'));var logger=require(_0x751f('0x15'))(_0x751f('0x16'));var utils=require(_0x751f('0x17'));var config=require(_0x751f('0x18'));var licenseUtil=require(_0x751f('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1bf57f,_0x1542dd){_0x1542dd=_0x1542dd||0xcc;return function(_0x2f915c){if(_0x2f915c){return _0x1bf57f[_0x751f('0x1a')](_0x1542dd);}return _0x1bf57f[_0x751f('0x1b')](_0x1542dd)[_0x751f('0x1c')]();};}function respondWithResult(_0x2c93d8,_0x46979c){_0x46979c=_0x46979c||0xc8;return function(_0x51cbf0){if(_0x51cbf0){return _0x2c93d8[_0x751f('0x1b')](_0x46979c)['json'](_0x51cbf0);}};}function respondWithFilteredResult(_0x54100f,_0x18b4fa){return function(_0x5c5516){if(_0x5c5516){var _0x5d7a84=typeof _0x18b4fa[_0x751f('0x1d')]===_0x751f('0x1e')&&typeof _0x18b4fa[_0x751f('0x1f')]==='undefined';var _0x47fe9e=_0x5c5516['count'];var _0x2d339f=_0x5d7a84?0x0:_0x18b4fa[_0x751f('0x1d')];var _0x685c75=_0x5d7a84?_0x5c5516[_0x751f('0x20')]:_0x18b4fa[_0x751f('0x1d')]+_0x18b4fa[_0x751f('0x1f')];var _0x212fa7;if(_0x685c75>=_0x47fe9e){_0x685c75=_0x47fe9e;_0x212fa7=0xc8;}else{_0x212fa7=0xce;}_0x54100f['status'](_0x212fa7);return _0x54100f[_0x751f('0x21')](_0x751f('0x22'),_0x2d339f+'-'+_0x685c75+'/'+_0x47fe9e)[_0x751f('0x23')](_0x5c5516);}return null;};}function patchUpdates(_0x3565f1){return function(_0x27a167){try{jsonpatch[_0x751f('0x24')](_0x27a167,_0x3565f1,!![]);}catch(_0xb95eec){return BPromise[_0x751f('0x25')](_0xb95eec);}return _0x27a167[_0x751f('0x26')]();};}function saveUpdates(_0x51ecbe,_0x4c27ba){return function(_0x16fff4){if(_0x16fff4){return _0x16fff4[_0x751f('0x27')](_0x51ecbe)[_0x751f('0x28')](function(_0x4c3d8d){return _0x4c3d8d;});}return null;};}function removeEntity(_0x14a58c,_0x286501){return function(_0x21e3fa){if(_0x21e3fa){return _0x21e3fa[_0x751f('0x29')]()[_0x751f('0x28')](function(){_0x14a58c[_0x751f('0x1b')](0xcc)[_0x751f('0x1c')]();});}};}function handleEntityNotFound(_0x359e75,_0x575793){return function(_0x321786){if(!_0x321786){_0x359e75['sendStatus'](0x194);}return _0x321786;};}function handleError(_0x3fa57a,_0x57a4f1){_0x57a4f1=_0x57a4f1||0x1f4;return function(_0x50f13f){logger[_0x751f('0x2a')](_0x50f13f[_0x751f('0x2b')]);if(_0x50f13f['name']){delete _0x50f13f['name'];}_0x3fa57a[_0x751f('0x1b')](_0x57a4f1)['send'](_0x50f13f);};}exports[_0x751f('0x2c')]=function(_0x17efa2,_0x1c005f){var _0x3aedbd={},_0xdfd16d={},_0x42afb1={'count':0x0,'rows':[]};var _0x26905d=_['map'](db[_0x751f('0x2d')]['rawAttributes'],function(_0x4914d2){return{'name':_0x4914d2[_0x751f('0x2e')],'type':_0x4914d2[_0x751f('0x2f')][_0x751f('0x30')]};});_0xdfd16d[_0x751f('0x31')]=_[_0x751f('0x32')](_0x26905d,'name');_0xdfd16d[_0x751f('0x33')]=_[_0x751f('0x34')](_0x17efa2[_0x751f('0x33')]);_0xdfd16d[_0x751f('0x35')]=_[_0x751f('0x36')](_0xdfd16d[_0x751f('0x31')],_0xdfd16d[_0x751f('0x33')]);_0x3aedbd[_0x751f('0x37')]=_[_0x751f('0x36')](_0xdfd16d[_0x751f('0x31')],qs[_0x751f('0x38')](_0x17efa2[_0x751f('0x33')][_0x751f('0x38')]));_0x3aedbd[_0x751f('0x37')]=_0x3aedbd['attributes'][_0x751f('0x39')]?_0x3aedbd['attributes']:_0xdfd16d[_0x751f('0x31')];if(!_0x17efa2[_0x751f('0x33')][_0x751f('0x3a')](_0x751f('0x3b'))){_0x3aedbd[_0x751f('0x1f')]=qs['limit'](_0x17efa2[_0x751f('0x33')][_0x751f('0x1f')]);_0x3aedbd[_0x751f('0x1d')]=qs[_0x751f('0x1d')](_0x17efa2['query'][_0x751f('0x1d')]);}_0x3aedbd['order']=qs[_0x751f('0x3c')](_0x17efa2[_0x751f('0x33')][_0x751f('0x3c')]);_0x3aedbd['where']=qs[_0x751f('0x35')](_[_0x751f('0x3d')](_0x17efa2[_0x751f('0x33')],_0xdfd16d[_0x751f('0x35')]),_0x26905d);if(_0x17efa2[_0x751f('0x33')][_0x751f('0x3e')]){_0x3aedbd[_0x751f('0x3f')]=_['merge'](_0x3aedbd[_0x751f('0x3f')],{'$or':_['map'](_0x26905d,function(_0x3759ca){if(_0x3759ca[_0x751f('0x2f')]!==_0x751f('0x40')){var _0x5bedef={};_0x5bedef[_0x3759ca[_0x751f('0x41')]]={'$like':'%'+_0x17efa2[_0x751f('0x33')][_0x751f('0x3e')]+'%'};return _0x5bedef;}})});}_0x3aedbd=_[_0x751f('0x42')]({},_0x3aedbd,_0x17efa2['options']);var _0x4b8392={'where':_0x3aedbd['where']};return db[_0x751f('0x2d')][_0x751f('0x20')](_0x4b8392)[_0x751f('0x28')](function(_0x1b580d){_0x42afb1[_0x751f('0x20')]=_0x1b580d;if(_0x17efa2['query'][_0x751f('0x43')]){_0x3aedbd[_0x751f('0x44')]=[{'all':!![]}];}return db[_0x751f('0x2d')][_0x751f('0x45')](_0x3aedbd);})['then'](function(_0x2b30c1){_0x42afb1[_0x751f('0x46')]=_0x2b30c1;return _0x42afb1;})[_0x751f('0x28')](respondWithFilteredResult(_0x1c005f,_0x3aedbd))['catch'](handleError(_0x1c005f,null));};exports['show']=function(_0xfa2d88,_0x32319d){var _0x36a57b={'raw':![],'where':{'id':_0xfa2d88[_0x751f('0x47')]['id']}},_0x2e92c2={};_0x2e92c2[_0x751f('0x31')]=_[_0x751f('0x34')](db[_0x751f('0x2d')][_0x751f('0x48')]);_0x2e92c2[_0x751f('0x33')]=_[_0x751f('0x34')](_0xfa2d88['query']);_0x2e92c2[_0x751f('0x35')]=_['intersection'](_0x2e92c2[_0x751f('0x31')],_0x2e92c2[_0x751f('0x33')]);_0x36a57b[_0x751f('0x37')]=_['intersection'](_0x2e92c2[_0x751f('0x31')],qs[_0x751f('0x38')](_0xfa2d88['query']['fields']));_0x36a57b[_0x751f('0x37')]=_0x36a57b[_0x751f('0x37')]['length']?_0x36a57b[_0x751f('0x37')]:_0x2e92c2[_0x751f('0x31')];if(_0xfa2d88[_0x751f('0x33')][_0x751f('0x43')]){_0x36a57b[_0x751f('0x44')]=[{'all':!![]}];}_0x36a57b=_[_0x751f('0x42')]({},_0x36a57b,_0xfa2d88['options']);return db[_0x751f('0x2d')]['find'](_0x36a57b)[_0x751f('0x28')](handleEntityNotFound(_0x32319d,null))[_0x751f('0x28')](respondWithResult(_0x32319d,null))[_0x751f('0x49')](handleError(_0x32319d,null));};exports[_0x751f('0x4a')]=function(_0x4becc7,_0x2f21a3){return db[_0x751f('0x2d')]['create'](_0x4becc7[_0x751f('0x4b')],{})['then'](respondWithResult(_0x2f21a3,0xc9))[_0x751f('0x49')](handleError(_0x2f21a3,null));};exports[_0x751f('0x27')]=function(_0x565cea,_0x5483fd){if(_0x565cea['body']['id']){delete _0x565cea['body']['id'];}return db[_0x751f('0x2d')][_0x751f('0x4c')]({'where':{'id':_0x565cea[_0x751f('0x47')]['id']}})[_0x751f('0x28')](handleEntityNotFound(_0x5483fd,null))[_0x751f('0x28')](saveUpdates(_0x565cea['body'],null))[_0x751f('0x28')](respondWithResult(_0x5483fd,null))[_0x751f('0x49')](handleError(_0x5483fd,null));};exports['destroy']=function(_0x27b77a,_0x40445c){return db[_0x751f('0x2d')][_0x751f('0x4c')]({'where':{'id':_0x27b77a[_0x751f('0x47')]['id']}})[_0x751f('0x28')](handleEntityNotFound(_0x40445c,null))[_0x751f('0x28')](removeEntity(_0x40445c,null))[_0x751f('0x49')](handleError(_0x40445c,null));};exports[_0x751f('0x4d')]=function(_0x35da0a,_0x4af1fa,_0x4e2ae3){var _0x41b50e={};var _0x2c23ff={};var _0x41131d;var _0x10ff7e;return db[_0x751f('0x2d')][_0x751f('0x4e')]({'where':{'id':_0x35da0a[_0x751f('0x47')]['id']}})[_0x751f('0x28')](handleEntityNotFound(_0x4af1fa,null))[_0x751f('0x28')](function(_0x13a406){if(_0x13a406){_0x41131d=_0x13a406;_0x2c23ff[_0x751f('0x31')]=_[_0x751f('0x34')](db[_0x751f('0x4f')][_0x751f('0x48')]);_0x2c23ff[_0x751f('0x33')]=_[_0x751f('0x34')](_0x35da0a['query']);_0x2c23ff['filters']=_[_0x751f('0x36')](_0x2c23ff[_0x751f('0x31')],_0x2c23ff['query']);_0x41b50e[_0x751f('0x37')]=_[_0x751f('0x36')](_0x2c23ff[_0x751f('0x31')],qs[_0x751f('0x38')](_0x35da0a[_0x751f('0x33')][_0x751f('0x38')]));_0x41b50e[_0x751f('0x37')]=_0x41b50e[_0x751f('0x37')][_0x751f('0x39')]?_0x41b50e['attributes']:_0x2c23ff['model'];_0x41b50e['order']=qs[_0x751f('0x3c')](_0x35da0a[_0x751f('0x33')]['sort']);_0x41b50e[_0x751f('0x3f')]=qs[_0x751f('0x35')](_['pick'](_0x35da0a['query'],_0x2c23ff[_0x751f('0x35')]));if(_0x35da0a['query'][_0x751f('0x3e')]){_0x41b50e['where']=_[_0x751f('0x42')](_0x41b50e[_0x751f('0x3f')],{'$or':_['map'](_0x41b50e[_0x751f('0x37')],function(_0x2fd532){var _0x3e9486={};_0x3e9486[_0x2fd532]={'$like':'%'+_0x35da0a[_0x751f('0x33')]['filter']+'%'};return _0x3e9486;})});}_0x41b50e=_['merge']({},_0x41b50e,_0x35da0a['options']);return _0x41131d[_0x751f('0x4d')](_0x41b50e);}})[_0x751f('0x28')](function(_0x4a1190){if(_0x4a1190){_0x10ff7e=_0x4a1190[_0x751f('0x39')];if(!_0x35da0a[_0x751f('0x33')][_0x751f('0x3a')](_0x751f('0x3b'))){_0x41b50e['limit']=qs['limit'](_0x35da0a[_0x751f('0x33')][_0x751f('0x1f')]);_0x41b50e[_0x751f('0x1d')]=qs[_0x751f('0x1d')](_0x35da0a[_0x751f('0x33')][_0x751f('0x1d')]);}return _0x41131d['getConfigurations'](_0x41b50e);}})[_0x751f('0x28')](function(_0xc2ec61){if(_0xc2ec61){return _0xc2ec61?{'count':_0x10ff7e,'rows':_0xc2ec61}:null;}})[_0x751f('0x28')](respondWithResult(_0x4af1fa,null))[_0x751f('0x49')](handleError(_0x4af1fa,null));};exports[_0x751f('0x50')]=function(_0x461b0f,_0x821e8a,_0x5ec215){if(_0x461b0f[_0x751f('0x4b')]['id']){delete _0x461b0f[_0x751f('0x4b')]['id'];}return db[_0x751f('0x2d')][_0x751f('0x4e')]({'where':{'id':_0x461b0f[_0x751f('0x47')]['id']}})[_0x751f('0x28')](handleEntityNotFound(_0x821e8a,null))['then'](function(_0x1b13fe){if(_0x1b13fe){_0x461b0f['body']['AccountId']=_0x1b13fe['id'];_0x461b0f['body'][_0x751f('0x51')]=integrations[_0x751f('0x52')](_0x461b0f[_0x751f('0x4b')][_0x751f('0x53')],_0x461b0f[_0x751f('0x4b')][_0x751f('0x2f')]);_0x461b0f['body'][_0x751f('0x54')]=integrations[_0x751f('0x55')](_0x461b0f[_0x751f('0x4b')]['channel'],_0x461b0f[_0x751f('0x4b')][_0x751f('0x2f')]);return db[_0x751f('0x4f')][_0x751f('0x4a')](_0x461b0f[_0x751f('0x4b')],{'include':[{'model':db[_0x751f('0x56')],'as':'Subjects'},{'model':db[_0x751f('0x56')],'as':_0x751f('0x54')}]});}return null;})[_0x751f('0x28')](respondWithResult(_0x821e8a,null))['catch'](handleError(_0x821e8a,null));};exports[_0x751f('0x57')]=function(_0x457679,_0x47b8a8,_0x3ebf3a){var _0x5769cf;var _0x3435ce='';var _0x135b30=_0x751f('0x58');return db[_0x751f('0x2d')][_0x751f('0x4e')]({'where':{'id':_0x457679['params']['id']},'attributes':['id','remoteUri','clientId',_0x751f('0x59'),_0x751f('0x5a'),_0x751f('0x5b'),_0x751f('0x5c')]})[_0x751f('0x28')](handleEntityNotFound(_0x47b8a8,null))[_0x751f('0x28')](function(_0x4a44b4){if(_0x4a44b4){_0x3435ce=_0x4a44b4[_0x751f('0x5d')];var _0x49fe85=_0x3435ce[_0x751f('0x5e')](-0x1);if(_0x49fe85==='/'){_0x3435ce=_0x3435ce['substring'](0x0,_0x3435ce[_0x751f('0x5f')](_0x49fe85));}_0x5769cf=new jsforce[(_0x751f('0x60'))]({'oauth2':{'loginUrl':_0x3435ce,'clientId':_0x4a44b4[_0x751f('0x61')],'clientSecret':_0x4a44b4['clientSecret']}});return _0x5769cf[_0x751f('0x62')](_0x4a44b4[_0x751f('0x5a')],_0x4a44b4[_0x751f('0x5b')][_0x751f('0x63')](_0x4a44b4[_0x751f('0x5c')]));}})[_0x751f('0x28')](function(_0x227809){if(_0x227809){if(!_[_0x751f('0x64')](_0x457679[_0x751f('0x33')]['ticketType'])){_0x135b30=_0x457679[_0x751f('0x33')][_0x751f('0x65')];}return _0x5769cf['sobject'](_0x135b30)[_0x751f('0x66')]();}})[_0x751f('0x28')](function(_0x5d6c44){var _0x2eee3a=[_0x751f('0x67'),_0x751f('0x68'),'IsReminderSet',_0x751f('0x69'),_0x751f('0x6a'),'Description'];var _0x1996ed=[_0x751f('0x6b'),_0x751f('0x6c'),'picklist',_0x751f('0x6d'),_0x751f('0x6e'),_0x751f('0x6f'),_0x751f('0x70')];if(_0x5d6c44){_[_0x751f('0x71')](_0x5d6c44[_0x751f('0x38')],function(_0x2b7180){return _0x2eee3a[_0x751f('0x72')](_0x2b7180[_0x751f('0x41')])||!_0x1996ed[_0x751f('0x72')](_0x2b7180['type']);});return{'count':_0x5d6c44[_0x751f('0x38')][_0x751f('0x39')],'rows':_[_0x751f('0x32')](_0x5d6c44[_0x751f('0x38')],function(_0x50059b){return{'id':_0x50059b[_0x751f('0x41')],'name':_0x50059b[_0x751f('0x73')],'custom':_0x50059b[_0x751f('0x74')],'options':_0x50059b['picklistValues'][_0x751f('0x39')]>0x0?_['map'](_0x50059b[_0x751f('0x75')],function(_0xcdc200){return{'name':_0xcdc200[_0x751f('0x73')],'value':_0xcdc200[_0x751f('0x76')]};}):_0x50059b[_0x751f('0x2f')]==_0x751f('0x6d')?[{'name':_0x751f('0x77'),'value':_0x751f('0x78')},{'name':_0x751f('0x79'),'value':_0x751f('0x7a')}]:[]};})};}})[_0x751f('0x28')](respondWithResult(_0x47b8a8,null))[_0x751f('0x49')](function(_0x5b6341){var _0xd392d1=_0x457679[_0x751f('0x33')][_0x751f('0x7b')]?0x1f4:_0x5b6341['statusCode']||0x1f4;logger[_0x751f('0x2a')](_0x751f('0x7c'),_0x751f('0x57'),_0xd392d1,JSON[_0x751f('0x7d')](_0x5b6341));delete _0x5b6341[_0x751f('0x41')];if(_0xd392d1===0x191){_0xd392d1=0x190;}_0x47b8a8[_0x751f('0x1b')](_0xd392d1)[_0x751f('0x7e')](_0x457679['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x5b6341[_0x751f('0x7f')]}:_0x5b6341);});}; \ No newline at end of file +var _0x1276=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','index','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','password','securityToken','slice','substring','clientSecret','login','username','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','phone','remove','includes','label','custom','picklistValues','value','true','False','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3b6d9f,_0x24f464){var _0x29748c=function(_0x58dc8b){while(--_0x58dc8b){_0x3b6d9f['push'](_0x3b6d9f['shift']());}};_0x29748c(++_0x24f464);}(_0x1276,0xe9));var _0x6127=function(_0x4316bb,_0x45486a){_0x4316bb=_0x4316bb-0x0;var _0x14c479=_0x1276[_0x4316bb];return _0x14c479;};'use strict';var emlformat=require(_0x6127('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6127('0x1'));var jsonpatch=require(_0x6127('0x2'));var rp=require('request-promise');var moment=require(_0x6127('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6127('0x4'));var util=require(_0x6127('0x5'));var path=require('path');var sox=require(_0x6127('0x6'));var csv=require(_0x6127('0x7'));var ejs=require(_0x6127('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6127('0x9'));var squel=require(_0x6127('0xa'));var crypto=require('crypto');var jsforce=require(_0x6127('0xb'));var deskjs=require(_0x6127('0xc'));var toCsv=require(_0x6127('0x7'));var querystring=require(_0x6127('0xd'));var Papa=require(_0x6127('0xe'));var Redis=require(_0x6127('0xf'));var authService=require(_0x6127('0x10'));var qs=require(_0x6127('0x11'));var as=require(_0x6127('0x12'));var hardwareService=require(_0x6127('0x13'));var logger=require(_0x6127('0x14'))(_0x6127('0x15'));var utils=require(_0x6127('0x16'));var config=require(_0x6127('0x17'));var licenseUtil=require(_0x6127('0x18'));var db=require(_0x6127('0x19'))['db'];var integrations=require(_0x6127('0x1a'));function respondWithStatusCode(_0x298678,_0x847c9f){_0x847c9f=_0x847c9f||0xcc;return function(_0x4b7a09){if(_0x4b7a09){return _0x298678['sendStatus'](_0x847c9f);}return _0x298678['status'](_0x847c9f)[_0x6127('0x1b')]();};}function respondWithResult(_0x570447,_0x196351){_0x196351=_0x196351||0xc8;return function(_0x2a37c6){if(_0x2a37c6){return _0x570447[_0x6127('0x1c')](_0x196351)[_0x6127('0x1d')](_0x2a37c6);}};}function respondWithFilteredResult(_0x150c78,_0x29139b){return function(_0x5334d4){if(_0x5334d4){var _0x571938=typeof _0x29139b[_0x6127('0x1e')]===_0x6127('0x1f')&&typeof _0x29139b[_0x6127('0x20')]==='undefined';var _0x4f3131=_0x5334d4[_0x6127('0x21')];var _0x213e6a=_0x571938?0x0:_0x29139b[_0x6127('0x1e')];var _0x29820d=_0x571938?_0x5334d4[_0x6127('0x21')]:_0x29139b[_0x6127('0x1e')]+_0x29139b[_0x6127('0x20')];var _0x1852d3;if(_0x29820d>=_0x4f3131){_0x29820d=_0x4f3131;_0x1852d3=0xc8;}else{_0x1852d3=0xce;}_0x150c78[_0x6127('0x1c')](_0x1852d3);return _0x150c78[_0x6127('0x22')]('Content-Range',_0x213e6a+'-'+_0x29820d+'/'+_0x4f3131)['json'](_0x5334d4);}return null;};}function patchUpdates(_0x12db30){return function(_0x4b5ca7){try{jsonpatch[_0x6127('0x23')](_0x4b5ca7,_0x12db30,!![]);}catch(_0x1511d2){return BPromise[_0x6127('0x24')](_0x1511d2);}return _0x4b5ca7[_0x6127('0x25')]();};}function saveUpdates(_0x49e349,_0x16291b){return function(_0x1c0c7f){if(_0x1c0c7f){return _0x1c0c7f['update'](_0x49e349)[_0x6127('0x26')](function(_0x3eca55){return _0x3eca55;});}return null;};}function removeEntity(_0x39bb39,_0x4a1c8d){return function(_0x4d59d4){if(_0x4d59d4){return _0x4d59d4[_0x6127('0x27')]()['then'](function(){_0x39bb39[_0x6127('0x1c')](0xcc)[_0x6127('0x1b')]();});}};}function handleEntityNotFound(_0x538f54,_0x4ff9c7){return function(_0x5be44d){if(!_0x5be44d){_0x538f54[_0x6127('0x28')](0x194);}return _0x5be44d;};}function handleError(_0x1be4ec,_0x465fe5){_0x465fe5=_0x465fe5||0x1f4;return function(_0x3f0ee6){logger[_0x6127('0x29')](_0x3f0ee6['stack']);if(_0x3f0ee6[_0x6127('0x2a')]){delete _0x3f0ee6['name'];}_0x1be4ec[_0x6127('0x1c')](_0x465fe5)[_0x6127('0x2b')](_0x3f0ee6);};}exports[_0x6127('0x2c')]=function(_0x174264,_0x40cfb5){var _0x3c7f53={},_0x568410={},_0x2576bf={'count':0x0,'rows':[]};var _0x231865=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x569418){return{'name':_0x569418['fieldName'],'type':_0x569418[_0x6127('0x2d')][_0x6127('0x2e')]};});_0x568410[_0x6127('0x2f')]=_[_0x6127('0x30')](_0x231865,_0x6127('0x2a'));_0x568410[_0x6127('0x31')]=_[_0x6127('0x32')](_0x174264['query']);_0x568410['filters']=_[_0x6127('0x33')](_0x568410['model'],_0x568410['query']);_0x3c7f53[_0x6127('0x34')]=_[_0x6127('0x33')](_0x568410[_0x6127('0x2f')],qs['fields'](_0x174264['query'][_0x6127('0x35')]));_0x3c7f53[_0x6127('0x34')]=_0x3c7f53[_0x6127('0x34')][_0x6127('0x36')]?_0x3c7f53['attributes']:_0x568410[_0x6127('0x2f')];if(!_0x174264['query'][_0x6127('0x37')](_0x6127('0x38'))){_0x3c7f53[_0x6127('0x20')]=qs[_0x6127('0x20')](_0x174264[_0x6127('0x31')][_0x6127('0x20')]);_0x3c7f53[_0x6127('0x1e')]=qs[_0x6127('0x1e')](_0x174264[_0x6127('0x31')][_0x6127('0x1e')]);}_0x3c7f53[_0x6127('0x39')]=qs['sort'](_0x174264[_0x6127('0x31')][_0x6127('0x3a')]);_0x3c7f53[_0x6127('0x3b')]=qs[_0x6127('0x3c')](_[_0x6127('0x3d')](_0x174264['query'],_0x568410['filters']),_0x231865);if(_0x174264[_0x6127('0x31')][_0x6127('0x3e')]){_0x3c7f53[_0x6127('0x3b')]=_['merge'](_0x3c7f53['where'],{'$or':_[_0x6127('0x30')](_0x231865,function(_0x1844df){if(_0x1844df[_0x6127('0x2d')]!==_0x6127('0x3f')){var _0x43d37a={};_0x43d37a[_0x1844df[_0x6127('0x2a')]]={'$like':'%'+_0x174264[_0x6127('0x31')][_0x6127('0x3e')]+'%'};return _0x43d37a;}})});}_0x3c7f53=_[_0x6127('0x40')]({},_0x3c7f53,_0x174264['options']);var _0x44c1ef={'where':_0x3c7f53[_0x6127('0x3b')]};return db[_0x6127('0x41')]['count'](_0x44c1ef)['then'](function(_0x4e9ad6){_0x2576bf[_0x6127('0x21')]=_0x4e9ad6;if(_0x174264[_0x6127('0x31')][_0x6127('0x42')]){_0x3c7f53[_0x6127('0x43')]=[{'all':!![]}];}return db[_0x6127('0x41')][_0x6127('0x44')](_0x3c7f53);})[_0x6127('0x26')](function(_0x1c3915){_0x2576bf[_0x6127('0x45')]=_0x1c3915;return _0x2576bf;})[_0x6127('0x26')](respondWithFilteredResult(_0x40cfb5,_0x3c7f53))[_0x6127('0x46')](handleError(_0x40cfb5,null));};exports[_0x6127('0x47')]=function(_0x449e08,_0x58f088){var _0x5f4dd4={'raw':![],'where':{'id':_0x449e08[_0x6127('0x48')]['id']}},_0xb828a2={};_0xb828a2[_0x6127('0x2f')]=_[_0x6127('0x32')](db['SalesforceAccount'][_0x6127('0x49')]);_0xb828a2['query']=_['keys'](_0x449e08[_0x6127('0x31')]);_0xb828a2[_0x6127('0x3c')]=_[_0x6127('0x33')](_0xb828a2[_0x6127('0x2f')],_0xb828a2[_0x6127('0x31')]);_0x5f4dd4[_0x6127('0x34')]=_[_0x6127('0x33')](_0xb828a2[_0x6127('0x2f')],qs[_0x6127('0x35')](_0x449e08[_0x6127('0x31')][_0x6127('0x35')]));_0x5f4dd4[_0x6127('0x34')]=_0x5f4dd4[_0x6127('0x34')]['length']?_0x5f4dd4[_0x6127('0x34')]:_0xb828a2[_0x6127('0x2f')];if(_0x449e08[_0x6127('0x31')]['includeAll']){_0x5f4dd4[_0x6127('0x43')]=[{'all':!![]}];}_0x5f4dd4=_[_0x6127('0x40')]({},_0x5f4dd4,_0x449e08[_0x6127('0x4a')]);return db[_0x6127('0x41')][_0x6127('0x4b')](_0x5f4dd4)[_0x6127('0x26')](handleEntityNotFound(_0x58f088,null))[_0x6127('0x26')](respondWithResult(_0x58f088,null))[_0x6127('0x46')](handleError(_0x58f088,null));};exports[_0x6127('0x4c')]=function(_0x319fe8,_0x121395){return db[_0x6127('0x41')][_0x6127('0x4c')](_0x319fe8[_0x6127('0x4d')],{})[_0x6127('0x26')](respondWithResult(_0x121395,0xc9))['catch'](handleError(_0x121395,null));};exports[_0x6127('0x4e')]=function(_0x492304,_0x4ef8e1){if(_0x492304[_0x6127('0x4d')]['id']){delete _0x492304['body']['id'];}return db['SalesforceAccount'][_0x6127('0x4b')]({'where':{'id':_0x492304[_0x6127('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ef8e1,null))['then'](saveUpdates(_0x492304[_0x6127('0x4d')],null))['then'](respondWithResult(_0x4ef8e1,null))[_0x6127('0x46')](handleError(_0x4ef8e1,null));};exports[_0x6127('0x27')]=function(_0x7b4ba2,_0x172b1e){return db['SalesforceAccount'][_0x6127('0x4b')]({'where':{'id':_0x7b4ba2[_0x6127('0x48')]['id']}})[_0x6127('0x26')](handleEntityNotFound(_0x172b1e,null))['then'](removeEntity(_0x172b1e,null))[_0x6127('0x46')](handleError(_0x172b1e,null));};exports['getConfigurations']=function(_0x428ec7,_0x108e39,_0x124d7a){var _0x2c9cba={};var _0x2c2ff7={};var _0x395799;var _0x5db162;return db['SalesforceAccount'][_0x6127('0x4f')]({'where':{'id':_0x428ec7[_0x6127('0x48')]['id']}})['then'](handleEntityNotFound(_0x108e39,null))['then'](function(_0x39fd70){if(_0x39fd70){_0x395799=_0x39fd70;_0x2c2ff7[_0x6127('0x2f')]=_[_0x6127('0x32')](db['SalesforceConfiguration']['rawAttributes']);_0x2c2ff7[_0x6127('0x31')]=_[_0x6127('0x32')](_0x428ec7[_0x6127('0x31')]);_0x2c2ff7[_0x6127('0x3c')]=_['intersection'](_0x2c2ff7[_0x6127('0x2f')],_0x2c2ff7[_0x6127('0x31')]);_0x2c9cba[_0x6127('0x34')]=_[_0x6127('0x33')](_0x2c2ff7[_0x6127('0x2f')],qs[_0x6127('0x35')](_0x428ec7['query'][_0x6127('0x35')]));_0x2c9cba[_0x6127('0x34')]=_0x2c9cba[_0x6127('0x34')][_0x6127('0x36')]?_0x2c9cba[_0x6127('0x34')]:_0x2c2ff7[_0x6127('0x2f')];_0x2c9cba[_0x6127('0x39')]=qs[_0x6127('0x3a')](_0x428ec7['query'][_0x6127('0x3a')]);_0x2c9cba['where']=qs[_0x6127('0x3c')](_[_0x6127('0x3d')](_0x428ec7[_0x6127('0x31')],_0x2c2ff7[_0x6127('0x3c')]));if(_0x428ec7[_0x6127('0x31')][_0x6127('0x3e')]){_0x2c9cba['where']=_[_0x6127('0x40')](_0x2c9cba[_0x6127('0x3b')],{'$or':_[_0x6127('0x30')](_0x2c9cba[_0x6127('0x34')],function(_0x120b2b){var _0x5f58fb={};_0x5f58fb[_0x120b2b]={'$like':'%'+_0x428ec7[_0x6127('0x31')][_0x6127('0x3e')]+'%'};return _0x5f58fb;})});}_0x2c9cba=_[_0x6127('0x40')]({},_0x2c9cba,_0x428ec7['options']);return _0x395799[_0x6127('0x50')](_0x2c9cba);}})[_0x6127('0x26')](function(_0x32afb3){if(_0x32afb3){_0x5db162=_0x32afb3[_0x6127('0x36')];if(!_0x428ec7['query'][_0x6127('0x37')]('nolimit')){_0x2c9cba['limit']=qs[_0x6127('0x20')](_0x428ec7[_0x6127('0x31')][_0x6127('0x20')]);_0x2c9cba[_0x6127('0x1e')]=qs[_0x6127('0x1e')](_0x428ec7[_0x6127('0x31')][_0x6127('0x1e')]);}return _0x395799[_0x6127('0x50')](_0x2c9cba);}})[_0x6127('0x26')](function(_0x2c1e39){if(_0x2c1e39){return _0x2c1e39?{'count':_0x5db162,'rows':_0x2c1e39}:null;}})[_0x6127('0x26')](respondWithResult(_0x108e39,null))[_0x6127('0x46')](handleError(_0x108e39,null));};exports[_0x6127('0x51')]=function(_0x568338,_0x2c3a05,_0x296769){if(_0x568338['body']['id']){delete _0x568338['body']['id'];}return db['SalesforceAccount'][_0x6127('0x4f')]({'where':{'id':_0x568338[_0x6127('0x48')]['id']}})[_0x6127('0x26')](handleEntityNotFound(_0x2c3a05,null))[_0x6127('0x26')](function(_0x107e11){if(_0x107e11){_0x568338[_0x6127('0x4d')][_0x6127('0x52')]=_0x107e11['id'];_0x568338[_0x6127('0x4d')][_0x6127('0x53')]=integrations[_0x6127('0x54')](_0x568338['body'][_0x6127('0x55')],_0x568338['body'][_0x6127('0x2d')]);_0x568338[_0x6127('0x4d')][_0x6127('0x56')]=integrations[_0x6127('0x57')](_0x568338[_0x6127('0x4d')]['channel'],_0x568338['body'][_0x6127('0x2d')]);return db['SalesforceConfiguration'][_0x6127('0x4c')](_0x568338['body'],{'include':[{'model':db[_0x6127('0x58')],'as':'Subjects'},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x6127('0x26')](respondWithResult(_0x2c3a05,null))[_0x6127('0x46')](handleError(_0x2c3a05,null));};exports['getFields']=function(_0x369d6a,_0x2c0c7b,_0x538dbd){var _0x462777;var _0x1ad419='';var _0x5e6a67=_0x6127('0x59');return db['SalesforceAccount']['findOne']({'where':{'id':_0x369d6a[_0x6127('0x48')]['id']},'attributes':['id',_0x6127('0x5a'),_0x6127('0x5b'),'clientSecret','username',_0x6127('0x5c'),_0x6127('0x5d')]})[_0x6127('0x26')](handleEntityNotFound(_0x2c0c7b,null))['then'](function(_0x5f358f){if(_0x5f358f){_0x1ad419=_0x5f358f['remoteUri'];var _0x1b9888=_0x1ad419[_0x6127('0x5e')](-0x1);if(_0x1b9888==='/'){_0x1ad419=_0x1ad419[_0x6127('0x5f')](0x0,_0x1ad419['lastIndexOf'](_0x1b9888));}_0x462777=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1ad419,'clientId':_0x5f358f['clientId'],'clientSecret':_0x5f358f[_0x6127('0x60')]}});return _0x462777[_0x6127('0x61')](_0x5f358f[_0x6127('0x62')],_0x5f358f[_0x6127('0x5c')][_0x6127('0x63')](_0x5f358f[_0x6127('0x5d')]));}})[_0x6127('0x26')](function(_0xd08f8c){if(_0xd08f8c){if(!_['isNil'](_0x369d6a['query'][_0x6127('0x64')])){_0x5e6a67=_0x369d6a['query'][_0x6127('0x64')];}return _0x462777[_0x6127('0x65')](_0x5e6a67)[_0x6127('0x66')]();}})[_0x6127('0x26')](function(_0xc9daa7){var _0x583c57=[_0x6127('0x67'),_0x6127('0x68'),_0x6127('0x69'),_0x6127('0x6a'),_0x6127('0x6b'),_0x6127('0x6c')];var _0x3a68a4=[_0x6127('0x6d'),_0x6127('0x6e'),_0x6127('0x6f'),_0x6127('0x70'),'email','textarea',_0x6127('0x71')];if(_0xc9daa7){_[_0x6127('0x72')](_0xc9daa7['fields'],function(_0xcd7960){return _0x583c57[_0x6127('0x73')](_0xcd7960['name'])||!_0x3a68a4['includes'](_0xcd7960[_0x6127('0x2d')]);});return{'count':_0xc9daa7[_0x6127('0x35')][_0x6127('0x36')],'rows':_[_0x6127('0x30')](_0xc9daa7[_0x6127('0x35')],function(_0x166248){return{'id':_0x166248[_0x6127('0x2a')],'name':_0x166248[_0x6127('0x74')],'custom':_0x166248[_0x6127('0x75')],'options':_0x166248[_0x6127('0x76')][_0x6127('0x36')]>0x0?_[_0x6127('0x30')](_0x166248[_0x6127('0x76')],function(_0x5561cc){return{'name':_0x5561cc[_0x6127('0x74')],'value':_0x5561cc[_0x6127('0x77')]};}):_0x166248[_0x6127('0x2d')]==_0x6127('0x70')?[{'name':'True','value':_0x6127('0x78')},{'name':_0x6127('0x79'),'value':'false'}]:[]};})};}})[_0x6127('0x26')](respondWithResult(_0x2c0c7b,null))['catch'](function(_0x59ca8c){var _0x28a031=_0x369d6a[_0x6127('0x31')][_0x6127('0x7a')]?0x1f4:_0x59ca8c['statusCode']||0x1f4;logger[_0x6127('0x29')](_0x6127('0x7b'),_0x6127('0x7c'),_0x28a031,JSON[_0x6127('0x7d')](_0x59ca8c));delete _0x59ca8c[_0x6127('0x2a')];if(_0x28a031===0x191){_0x28a031=0x190;}_0x2c0c7b[_0x6127('0x1c')](_0x28a031)[_0x6127('0x2b')](_0x369d6a[_0x6127('0x31')][_0x6127('0x7a')]?{'message':_0x6127('0x7e'),'statusCode':_0x59ca8c[_0x6127('0x7f')]}:_0x59ca8c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4acb56a..bfb77e5 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 _0xb4aa=['../../config/environment','./intSalesforceAccount.attributes','define','SalesforceAccount','int_salesforce_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xb4aa,0xdd));var _0xab4a=function(_0x5924c9,_0x4afb52){_0x5924c9=_0x5924c9-0x0;var _0x3e0e94=_0xb4aa[_0x5924c9];return _0x3e0e94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab4a('0x0'))(_0xab4a('0x1'));var moment=require(_0xab4a('0x2'));var BPromise=require(_0xab4a('0x3'));var rp=require(_0xab4a('0x4'));var fs=require('fs');var path=require(_0xab4a('0x5'));var rimraf=require(_0xab4a('0x6'));var config=require(_0xab4a('0x7'));var attributes=require(_0xab4a('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3a0292,_0x12a79d){return _0x3a0292[_0xab4a('0x9')](_0xab4a('0xa'),attributes,{'tableName':_0xab4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f5c=['./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x57a6f1,_0x282078){var _0x3559ae=function(_0xff0a86){while(--_0xff0a86){_0x57a6f1['push'](_0x57a6f1['shift']());}};_0x3559ae(++_0x282078);}(_0x6f5c,0x7a));var _0xc6f5=function(_0x2d8b08,_0x5acb0f){_0x2d8b08=_0x2d8b08-0x0;var _0x5b9d0a=_0x6f5c[_0x2d8b08];return _0x5b9d0a;};'use strict';var _=require(_0xc6f5('0x0'));var util=require(_0xc6f5('0x1'));var logger=require(_0xc6f5('0x2'))(_0xc6f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6f5('0x4'));var fs=require('fs');var path=require(_0xc6f5('0x5'));var rimraf=require(_0xc6f5('0x6'));var config=require(_0xc6f5('0x7'));var attributes=require(_0xc6f5('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc6f5('0x9')]=function(_0xb1781,_0xaefa11){return _0xb1781[_0xc6f5('0xa')](_0xc6f5('0xb'),attributes,{'tableName':_0xc6f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 291aa4c..478a565 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 _0x0aaa=['catch','GetSalesforceAccount','findAll','options','where','limit','include','model','attributes','find','map','ShowSalesforceAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3b44b0,_0x4458f3){var _0x39b561=function(_0x534b02){while(--_0x534b02){_0x3b44b0['push'](_0x3b44b0['shift']());}};_0x39b561(++_0x4458f3);}(_0x0aaa,0x160));var _0xa0aa=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x0aaa[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0xa0aa('0x0'));var util=require(_0xa0aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0aa('0x2'));var fs=require('fs');var Redis=require(_0xa0aa('0x3'));var db=require(_0xa0aa('0x4'))['db'];var utils=require(_0xa0aa('0x5'));var logger=require(_0xa0aa('0x6'))(_0xa0aa('0x7'));var config=require(_0xa0aa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0aa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f514b,_0x500e1c,_0x14136c){return new BPromise(function(_0x4e523c,_0x258bbf){return client[_0xa0aa('0xa')](_0x7f514b,_0x14136c)[_0xa0aa('0xb')](function(_0x35a132){logger[_0xa0aa('0xc')](_0xa0aa('0xd'),_0x500e1c,_0xa0aa('0xe'));logger[_0xa0aa('0xf')](_0xa0aa('0x10'),_0x500e1c,'request\x20sent',JSON[_0xa0aa('0x11')](_0x35a132));if(_0x35a132[_0xa0aa('0x12')]){if(_0x35a132[_0xa0aa('0x12')][_0xa0aa('0x13')]===0x1f4){logger[_0xa0aa('0x12')](_0xa0aa('0xd'),_0x500e1c,_0x35a132[_0xa0aa('0x12')][_0xa0aa('0x14')]);return _0x258bbf(_0x35a132['error'][_0xa0aa('0x14')]);}logger[_0xa0aa('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x500e1c,_0x35a132[_0xa0aa('0x12')][_0xa0aa('0x14')]);return _0x4e523c(_0x35a132[_0xa0aa('0x12')][_0xa0aa('0x14')]);}else{logger[_0xa0aa('0xc')](_0xa0aa('0xd'),_0x500e1c,_0xa0aa('0xe'));_0x4e523c(_0x35a132[_0xa0aa('0x15')][_0xa0aa('0x14')]);}})[_0xa0aa('0x16')](function(_0x4af031){logger[_0xa0aa('0x12')](_0xa0aa('0xd'),_0x500e1c,_0x4af031);_0x258bbf(_0x4af031);});});}exports[_0xa0aa('0x17')]=function(_0x1e64fe){var _0x17f120=this;return new Promise(function(_0x1f9546,_0x5e2ff8){return db['SalesforceAccount'][_0xa0aa('0x18')]({'raw':_0x1e64fe[_0xa0aa('0x19')]?_0x1e64fe['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e64fe[_0xa0aa('0x19')]?_0x1e64fe[_0xa0aa('0x19')][_0xa0aa('0x1a')]||null:null,'attributes':_0x1e64fe[_0xa0aa('0x19')]?_0x1e64fe['options']['attributes']||null:null,'limit':_0x1e64fe['options']?_0x1e64fe[_0xa0aa('0x19')][_0xa0aa('0x1b')]||null:null,'include':_0x1e64fe['options']?_0x1e64fe[_0xa0aa('0x19')][_0xa0aa('0x1c')]?_['map'](_0x1e64fe['options'][_0xa0aa('0x1c')],function(_0x201e73){return{'model':db[_0x201e73[_0xa0aa('0x1d')]],'as':_0x201e73['as'],'attributes':_0x201e73[_0xa0aa('0x1e')],'include':_0x201e73['include']?_['map'](_0x201e73['include'],function(_0xd91b75){return{'model':db[_0xd91b75[_0xa0aa('0x1d')]],'as':_0xd91b75['as'],'attributes':_0xd91b75[_0xa0aa('0x1e')],'include':_0xd91b75[_0xa0aa('0x1c')]?_['map'](_0xd91b75[_0xa0aa('0x1c')],function(_0x2a4737){return{'model':db[_0x2a4737[_0xa0aa('0x1d')]],'as':_0x2a4737['as'],'attributes':_0x2a4737[_0xa0aa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa0aa('0xb')](function(_0x188645){logger['info'](_0xa0aa('0x17'),_0x1e64fe);logger[_0xa0aa('0xf')]('GetSalesforceAccount',_0x1e64fe,JSON[_0xa0aa('0x11')](_0x188645));_0x1f9546(_0x188645);})[_0xa0aa('0x16')](function(_0x31923e){logger['error'](_0xa0aa('0x17'),_0x31923e[_0xa0aa('0x14')],_0x1e64fe);_0x5e2ff8(_0x17f120[_0xa0aa('0x12')](0x1f4,_0x31923e[_0xa0aa('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x893477){var _0x5ddeac=this;return new Promise(function(_0x3a1db6,_0x59c32a){return db['SalesforceAccount'][_0xa0aa('0x1f')]({'raw':_0x893477['options']?_0x893477[_0xa0aa('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x893477[_0xa0aa('0x19')]?_0x893477[_0xa0aa('0x19')][_0xa0aa('0x1a')]||null:null,'attributes':_0x893477[_0xa0aa('0x19')]?_0x893477[_0xa0aa('0x19')]['attributes']||null:null,'include':_0x893477[_0xa0aa('0x19')]?_0x893477['options']['include']?_[_0xa0aa('0x20')](_0x893477[_0xa0aa('0x19')][_0xa0aa('0x1c')],function(_0x244773){return{'model':db[_0x244773[_0xa0aa('0x1d')]],'as':_0x244773['as'],'attributes':_0x244773[_0xa0aa('0x1e')],'include':_0x244773[_0xa0aa('0x1c')]?_[_0xa0aa('0x20')](_0x244773[_0xa0aa('0x1c')],function(_0x4afe26){return{'model':db[_0x4afe26[_0xa0aa('0x1d')]],'as':_0x4afe26['as'],'attributes':_0x4afe26[_0xa0aa('0x1e')],'include':_0x4afe26[_0xa0aa('0x1c')]?_[_0xa0aa('0x20')](_0x4afe26['include'],function(_0x12706a){return{'model':db[_0x12706a[_0xa0aa('0x1d')]],'as':_0x12706a['as'],'attributes':_0x12706a[_0xa0aa('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41765b){logger[_0xa0aa('0xc')](_0xa0aa('0x21'),_0x893477);logger[_0xa0aa('0xf')]('ShowSalesforceAccount',_0x893477,JSON[_0xa0aa('0x11')](_0x41765b));_0x3a1db6(_0x41765b);})[_0xa0aa('0x16')](function(_0x3c2d67){logger[_0xa0aa('0x12')](_0xa0aa('0x21'),_0x3c2d67['message'],_0x893477);_0x59c32a(_0x5ddeac['error'](0x1f4,_0x3c2d67[_0xa0aa('0x14')]));});});}; \ No newline at end of file +var _0x2689=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetSalesforceAccount','stringify','ShowSalesforceAccount','find','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x15f80f,_0x7593c6){var _0x70c0f6=function(_0x3b432a){while(--_0x3b432a){_0x15f80f['push'](_0x15f80f['shift']());}};_0x70c0f6(++_0x7593c6);}(_0x2689,0x6a));var _0x9268=function(_0x35af8c,_0x4c64ea){_0x35af8c=_0x35af8c-0x0;var _0x4b74d4=_0x2689[_0x35af8c];return _0x4b74d4;};'use strict';var _=require(_0x9268('0x0'));var util=require(_0x9268('0x1'));var moment=require(_0x9268('0x2'));var BPromise=require('bluebird');var rs=require(_0x9268('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9268('0x4'))['db'];var utils=require(_0x9268('0x5'));var logger=require(_0x9268('0x6'))(_0x9268('0x7'));var config=require(_0x9268('0x8'));var jayson=require(_0x9268('0x9'));var client=jayson[_0x9268('0xa')][_0x9268('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58cd0b,_0x4ad7cb,_0x12f5b5){return new BPromise(function(_0x39d127,_0xd57f65){return client[_0x9268('0xc')](_0x58cd0b,_0x12f5b5)[_0x9268('0xd')](function(_0xf19ad3){logger[_0x9268('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x4ad7cb,_0x9268('0xf'));logger[_0x9268('0x10')](_0x9268('0x11'),_0x4ad7cb,'request\x20sent',JSON['stringify'](_0xf19ad3));if(_0xf19ad3['error']){if(_0xf19ad3[_0x9268('0x12')][_0x9268('0x13')]===0x1f4){logger[_0x9268('0x12')](_0x9268('0x14'),_0x4ad7cb,_0xf19ad3['error'][_0x9268('0x15')]);return _0xd57f65(_0xf19ad3[_0x9268('0x12')]['message']);}logger[_0x9268('0x12')](_0x9268('0x14'),_0x4ad7cb,_0xf19ad3['error']['message']);return _0x39d127(_0xf19ad3[_0x9268('0x12')][_0x9268('0x15')]);}else{logger[_0x9268('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x4ad7cb,'request\x20sent');_0x39d127(_0xf19ad3[_0x9268('0x16')][_0x9268('0x15')]);}})['catch'](function(_0x164772){logger[_0x9268('0x12')](_0x9268('0x14'),_0x4ad7cb,_0x164772);_0xd57f65(_0x164772);});});}exports['GetSalesforceAccount']=function(_0x119aad){var _0x50ca21=this;return new Promise(function(_0x5e9e14,_0x1c46ad){return db[_0x9268('0x17')][_0x9268('0x18')]({'raw':_0x119aad[_0x9268('0x19')]?_0x119aad[_0x9268('0x19')][_0x9268('0x1a')]===undefined?!![]:![]:!![],'where':_0x119aad[_0x9268('0x19')]?_0x119aad[_0x9268('0x19')][_0x9268('0x1b')]||null:null,'attributes':_0x119aad[_0x9268('0x19')]?_0x119aad[_0x9268('0x19')][_0x9268('0x1c')]||null:null,'limit':_0x119aad['options']?_0x119aad[_0x9268('0x19')][_0x9268('0x1d')]||null:null,'include':_0x119aad[_0x9268('0x19')]?_0x119aad[_0x9268('0x19')]['include']?_[_0x9268('0x1e')](_0x119aad[_0x9268('0x19')][_0x9268('0x1f')],function(_0x58940a){return{'model':db[_0x58940a[_0x9268('0x20')]],'as':_0x58940a['as'],'attributes':_0x58940a[_0x9268('0x1c')],'include':_0x58940a['include']?_[_0x9268('0x1e')](_0x58940a['include'],function(_0x45f256){return{'model':db[_0x45f256[_0x9268('0x20')]],'as':_0x45f256['as'],'attributes':_0x45f256['attributes'],'include':_0x45f256[_0x9268('0x1f')]?_[_0x9268('0x1e')](_0x45f256[_0x9268('0x1f')],function(_0x491009){return{'model':db[_0x491009[_0x9268('0x20')]],'as':_0x491009['as'],'attributes':_0x491009[_0x9268('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cac86){logger[_0x9268('0xe')](_0x9268('0x21'),_0x119aad);logger[_0x9268('0x10')]('GetSalesforceAccount',_0x119aad,JSON[_0x9268('0x22')](_0x3cac86));_0x5e9e14(_0x3cac86);})['catch'](function(_0x417226){logger['error'](_0x9268('0x21'),_0x417226[_0x9268('0x15')],_0x119aad);_0x1c46ad(_0x50ca21[_0x9268('0x12')](0x1f4,_0x417226[_0x9268('0x15')]));});});};exports[_0x9268('0x23')]=function(_0x54a58e){var _0x5f02ca=this;return new Promise(function(_0x55672f,_0x109272){return db[_0x9268('0x17')][_0x9268('0x24')]({'raw':_0x54a58e[_0x9268('0x19')]?_0x54a58e['options'][_0x9268('0x1a')]===undefined?!![]:![]:!![],'where':_0x54a58e[_0x9268('0x19')]?_0x54a58e[_0x9268('0x19')][_0x9268('0x1b')]||null:null,'attributes':_0x54a58e[_0x9268('0x19')]?_0x54a58e[_0x9268('0x19')][_0x9268('0x1c')]||null:null,'include':_0x54a58e[_0x9268('0x19')]?_0x54a58e[_0x9268('0x19')][_0x9268('0x1f')]?_[_0x9268('0x1e')](_0x54a58e['options'][_0x9268('0x1f')],function(_0x3ba965){return{'model':db[_0x3ba965[_0x9268('0x20')]],'as':_0x3ba965['as'],'attributes':_0x3ba965[_0x9268('0x1c')],'include':_0x3ba965['include']?_[_0x9268('0x1e')](_0x3ba965[_0x9268('0x1f')],function(_0x3cbe18){return{'model':db[_0x3cbe18[_0x9268('0x20')]],'as':_0x3cbe18['as'],'attributes':_0x3cbe18[_0x9268('0x1c')],'include':_0x3cbe18[_0x9268('0x1f')]?_[_0x9268('0x1e')](_0x3cbe18[_0x9268('0x1f')],function(_0x66823c){return{'model':db[_0x66823c[_0x9268('0x20')]],'as':_0x66823c['as'],'attributes':_0x66823c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9268('0xd')](function(_0x274ee8){logger[_0x9268('0xe')](_0x9268('0x23'),_0x54a58e);logger[_0x9268('0x10')](_0x9268('0x23'),_0x54a58e,JSON[_0x9268('0x22')](_0x274ee8));_0x55672f(_0x274ee8);})['catch'](function(_0x5217c2){logger[_0x9268('0x12')](_0x9268('0x23'),_0x5217c2[_0x9268('0x15')],_0x54a58e);_0x109272(_0x5f02ca[_0x9268('0x12')](0x1f4,_0x5217c2[_0x9268('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 54829ad..6911b36 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 _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(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0b0e,0x187));var _0xe0b0=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x0b0e[_0x622035];return _0x326cf2;};'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 +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(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0x0b0e[_0x163977];return _0x28bf3a;};'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 09f1a2d..024df12 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 _0xce03=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing'];(function(_0x1235f7,_0x4a3374){var _0x3cdaac=function(_0x46d733){while(--_0x46d733){_0x1235f7['push'](_0x1235f7['shift']());}};_0x3cdaac(++_0x4a3374);}(_0xce03,0x114));var _0x3ce0=function(_0x2ee8fd,_0x40320c){_0x2ee8fd=_0x2ee8fd-0x0;var _0x33f810=_0xce03[_0x2ee8fd];return _0x33f810;};'use strict';var Sequelize=require(_0x3ce0('0x0'));module[_0x3ce0('0x1')]={'name':{'type':Sequelize[_0x3ce0('0x2')]},'description':{'type':Sequelize[_0x3ce0('0x2')]},'ticketType':{'type':Sequelize[_0x3ce0('0x3')](_0x3ce0('0x4'),_0x3ce0('0x5')),'defaultValue':_0x3ce0('0x4')},'moduleSearch':{'type':Sequelize[_0x3ce0('0x3')](_0x3ce0('0x6'),_0x3ce0('0x7'),_0x3ce0('0x8'),_0x3ce0('0x9'),_0x3ce0('0xa')),'defaultValue':_0x3ce0('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x3ce0('0xb'),_0x3ce0('0x7'),'lead',_0x3ce0('0xa')),'defaultValue':_0x3ce0('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x3ce0('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x3ce0('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x93ed=['account_contact_lead','account','sequelize','exports','STRING','ENUM','Case','contact_lead','lead'];(function(_0x409f76,_0x14dbf1){var _0x261321=function(_0x2775cc){while(--_0x2775cc){_0x409f76['push'](_0x409f76['shift']());}};_0x261321(++_0x14dbf1);}(_0x93ed,0xfe));var _0xd93e=function(_0x36218e,_0x516d2e){_0x36218e=_0x36218e-0x0;var _0x354293=_0x93ed[_0x36218e];return _0x354293;};'use strict';var Sequelize=require(_0xd93e('0x0'));module[_0xd93e('0x1')]={'name':{'type':Sequelize[_0xd93e('0x2')]},'description':{'type':Sequelize[_0xd93e('0x2')]},'ticketType':{'type':Sequelize[_0xd93e('0x3')]('Task',_0xd93e('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xd93e('0x3')](_0xd93e('0x5'),'contact',_0xd93e('0x6'),_0xd93e('0x7'),_0xd93e('0x8')),'defaultValue':_0xd93e('0x5')},'moduleCreate':{'type':Sequelize[_0xd93e('0x3')]('nothing','contact',_0xd93e('0x6'),_0xd93e('0x8')),'defaultValue':_0xd93e('0x6')},'leadId':{'type':Sequelize[_0xd93e('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xd93e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 32bb138..c85127d 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 _0xf5a7=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','SalesforceConfiguration','fieldName','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','type','VIRTUAL','merge','where','then','findAll','rows','catch','show','params','rawAttributes','intersection','include','options','create','body','find','getFields','order','filter','getSubjects','findOne','getDescriptions','SalesforceField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x4cedc0,_0x240022){var _0x12bd4a=function(_0x3171df){while(--_0x3171df){_0x4cedc0['push'](_0x4cedc0['shift']());}};_0x12bd4a(++_0x240022);}(_0xf5a7,0x133));var _0x7f5a=function(_0x8a8386,_0x1b2f20){_0x8a8386=_0x8a8386-0x0;var _0x2c2d20=_0xf5a7[_0x8a8386];return _0x2c2d20;};'use strict';var emlformat=require(_0x7f5a('0x0'));var rimraf=require(_0x7f5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f5a('0x2'));var rp=require(_0x7f5a('0x3'));var moment=require(_0x7f5a('0x4'));var BPromise=require(_0x7f5a('0x5'));var Mustache=require(_0x7f5a('0x6'));var util=require(_0x7f5a('0x7'));var path=require(_0x7f5a('0x8'));var sox=require(_0x7f5a('0x9'));var csv=require(_0x7f5a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f5a('0xb'));var _=require(_0x7f5a('0xc'));var squel=require('squel');var crypto=require(_0x7f5a('0xd'));var jsforce=require(_0x7f5a('0xe'));var deskjs=require(_0x7f5a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f5a('0x10'));var Redis=require(_0x7f5a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f5a('0x12'));var hardwareService=require(_0x7f5a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7f5a('0x14'));var config=require(_0x7f5a('0x15'));var licenseUtil=require(_0x7f5a('0x16'));var db=require(_0x7f5a('0x17'))['db'];function respondWithStatusCode(_0x169701,_0x325fda){_0x325fda=_0x325fda||0xcc;return function(_0x55ca4b){if(_0x55ca4b){return _0x169701[_0x7f5a('0x18')](_0x325fda);}return _0x169701[_0x7f5a('0x19')](_0x325fda)[_0x7f5a('0x1a')]();};}function respondWithResult(_0x112311,_0x1f1c17){_0x1f1c17=_0x1f1c17||0xc8;return function(_0x2a25ab){if(_0x2a25ab){return _0x112311[_0x7f5a('0x19')](_0x1f1c17)[_0x7f5a('0x1b')](_0x2a25ab);}};}function respondWithFilteredResult(_0x4ce5c2,_0x2ed7d3){return function(_0x3c6d7c){if(_0x3c6d7c){var _0x5c6810=typeof _0x2ed7d3[_0x7f5a('0x1c')]===_0x7f5a('0x1d')&&typeof _0x2ed7d3[_0x7f5a('0x1e')]===_0x7f5a('0x1d');var _0x568857=_0x3c6d7c[_0x7f5a('0x1f')];var _0xce9655=_0x5c6810?0x0:_0x2ed7d3[_0x7f5a('0x1c')];var _0x3e168e=_0x5c6810?_0x3c6d7c['count']:_0x2ed7d3[_0x7f5a('0x1c')]+_0x2ed7d3[_0x7f5a('0x1e')];var _0x557b16;if(_0x3e168e>=_0x568857){_0x3e168e=_0x568857;_0x557b16=0xc8;}else{_0x557b16=0xce;}_0x4ce5c2['status'](_0x557b16);return _0x4ce5c2[_0x7f5a('0x20')](_0x7f5a('0x21'),_0xce9655+'-'+_0x3e168e+'/'+_0x568857)[_0x7f5a('0x1b')](_0x3c6d7c);}return null;};}function patchUpdates(_0x90c080){return function(_0x208a6e){try{jsonpatch[_0x7f5a('0x22')](_0x208a6e,_0x90c080,!![]);}catch(_0x2942f9){return BPromise[_0x7f5a('0x23')](_0x2942f9);}return _0x208a6e['save']();};}function saveUpdates(_0x4b8d6b,_0x3d5f19){return function(_0x57019e){if(_0x57019e){return _0x57019e[_0x7f5a('0x24')](_0x4b8d6b)['then'](function(_0x3fda96){return _0x3fda96;});}return null;};}function removeEntity(_0x1c43bb,_0xf52b51){return function(_0xb65c0){if(_0xb65c0){return _0xb65c0[_0x7f5a('0x25')]()['then'](function(){_0x1c43bb[_0x7f5a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280a55,_0x31f206){return function(_0x49902a){if(!_0x49902a){_0x280a55[_0x7f5a('0x18')](0x194);}return _0x49902a;};}function handleError(_0x5d53cc,_0x35c43b){_0x35c43b=_0x35c43b||0x1f4;return function(_0x2bfbfe){logger[_0x7f5a('0x26')](_0x2bfbfe[_0x7f5a('0x27')]);if(_0x2bfbfe['name']){delete _0x2bfbfe[_0x7f5a('0x28')];}_0x5d53cc[_0x7f5a('0x19')](_0x35c43b)[_0x7f5a('0x29')](_0x2bfbfe);};}exports[_0x7f5a('0x2a')]=function(_0x49327f,_0x4ee1ca){var _0x550e81={},_0x30c290={},_0x2f8113={'count':0x0,'rows':[]};var _0x332baa=_['map'](db[_0x7f5a('0x2b')]['rawAttributes'],function(_0x347d5c){return{'name':_0x347d5c[_0x7f5a('0x2c')],'type':_0x347d5c['type'][_0x7f5a('0x2d')]};});_0x30c290[_0x7f5a('0x2e')]=_[_0x7f5a('0x2f')](_0x332baa,_0x7f5a('0x28'));_0x30c290[_0x7f5a('0x30')]=_[_0x7f5a('0x31')](_0x49327f[_0x7f5a('0x30')]);_0x30c290[_0x7f5a('0x32')]=_['intersection'](_0x30c290[_0x7f5a('0x2e')],_0x30c290['query']);_0x550e81['attributes']=_['intersection'](_0x30c290[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x49327f[_0x7f5a('0x30')][_0x7f5a('0x33')]));_0x550e81[_0x7f5a('0x34')]=_0x550e81['attributes'][_0x7f5a('0x35')]?_0x550e81['attributes']:_0x30c290[_0x7f5a('0x2e')];if(!_0x49327f['query'][_0x7f5a('0x36')](_0x7f5a('0x37'))){_0x550e81[_0x7f5a('0x1e')]=qs['limit'](_0x49327f['query'][_0x7f5a('0x1e')]);_0x550e81[_0x7f5a('0x1c')]=qs[_0x7f5a('0x1c')](_0x49327f['query'][_0x7f5a('0x1c')]);}_0x550e81['order']=qs['sort'](_0x49327f[_0x7f5a('0x30')][_0x7f5a('0x38')]);_0x550e81['where']=qs[_0x7f5a('0x32')](_[_0x7f5a('0x39')](_0x49327f[_0x7f5a('0x30')],_0x30c290[_0x7f5a('0x32')]),_0x332baa);if(_0x49327f[_0x7f5a('0x30')]['filter']){_0x550e81['where']=_['merge'](_0x550e81['where'],{'$or':_[_0x7f5a('0x2f')](_0x332baa,function(_0x5f194b){if(_0x5f194b[_0x7f5a('0x3a')]!==_0x7f5a('0x3b')){var _0x3e06c6={};_0x3e06c6[_0x5f194b[_0x7f5a('0x28')]]={'$like':'%'+_0x49327f[_0x7f5a('0x30')]['filter']+'%'};return _0x3e06c6;}})});}_0x550e81=_[_0x7f5a('0x3c')]({},_0x550e81,_0x49327f['options']);var _0x367be8={'where':_0x550e81[_0x7f5a('0x3d')]};return db[_0x7f5a('0x2b')]['count'](_0x367be8)[_0x7f5a('0x3e')](function(_0x5219e8){_0x2f8113[_0x7f5a('0x1f')]=_0x5219e8;if(_0x49327f[_0x7f5a('0x30')]['includeAll']){_0x550e81['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7f5a('0x3f')](_0x550e81);})['then'](function(_0x4d65c0){_0x2f8113[_0x7f5a('0x40')]=_0x4d65c0;return _0x2f8113;})[_0x7f5a('0x3e')](respondWithFilteredResult(_0x4ee1ca,_0x550e81))[_0x7f5a('0x41')](handleError(_0x4ee1ca,null));};exports[_0x7f5a('0x42')]=function(_0x1fa1cc,_0x185db9){var _0x121fdf={'raw':![],'where':{'id':_0x1fa1cc[_0x7f5a('0x43')]['id']}},_0x29b022={};_0x29b022[_0x7f5a('0x2e')]=_[_0x7f5a('0x31')](db['SalesforceConfiguration'][_0x7f5a('0x44')]);_0x29b022['query']=_[_0x7f5a('0x31')](_0x1fa1cc[_0x7f5a('0x30')]);_0x29b022[_0x7f5a('0x32')]=_['intersection'](_0x29b022[_0x7f5a('0x2e')],_0x29b022[_0x7f5a('0x30')]);_0x121fdf[_0x7f5a('0x34')]=_[_0x7f5a('0x45')](_0x29b022[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x1fa1cc[_0x7f5a('0x30')]['fields']));_0x121fdf[_0x7f5a('0x34')]=_0x121fdf[_0x7f5a('0x34')][_0x7f5a('0x35')]?_0x121fdf[_0x7f5a('0x34')]:_0x29b022[_0x7f5a('0x2e')];if(_0x1fa1cc[_0x7f5a('0x30')]['includeAll']){_0x121fdf[_0x7f5a('0x46')]=[{'all':!![]}];}_0x121fdf=_[_0x7f5a('0x3c')]({},_0x121fdf,_0x1fa1cc[_0x7f5a('0x47')]);return db[_0x7f5a('0x2b')]['find'](_0x121fdf)[_0x7f5a('0x3e')](handleEntityNotFound(_0x185db9,null))[_0x7f5a('0x3e')](respondWithResult(_0x185db9,null))[_0x7f5a('0x41')](handleError(_0x185db9,null));};exports[_0x7f5a('0x48')]=function(_0x10457b,_0x21c7f6){return db[_0x7f5a('0x2b')][_0x7f5a('0x48')](_0x10457b[_0x7f5a('0x49')],{})[_0x7f5a('0x3e')](respondWithResult(_0x21c7f6,0xc9))[_0x7f5a('0x41')](handleError(_0x21c7f6,null));};exports[_0x7f5a('0x24')]=function(_0xaabf0f,_0x163b97){if(_0xaabf0f['body']['id']){delete _0xaabf0f[_0x7f5a('0x49')]['id'];}return db['SalesforceConfiguration'][_0x7f5a('0x4a')]({'where':{'id':_0xaabf0f[_0x7f5a('0x43')]['id']}})[_0x7f5a('0x3e')](handleEntityNotFound(_0x163b97,null))['then'](saveUpdates(_0xaabf0f['body'],null))[_0x7f5a('0x3e')](respondWithResult(_0x163b97,null))[_0x7f5a('0x41')](handleError(_0x163b97,null));};exports[_0x7f5a('0x25')]=function(_0x3ad069,_0x5731d0){return db[_0x7f5a('0x2b')][_0x7f5a('0x4a')]({'where':{'id':_0x3ad069['params']['id']}})['then'](handleEntityNotFound(_0x5731d0,null))[_0x7f5a('0x3e')](removeEntity(_0x5731d0,null))[_0x7f5a('0x41')](handleError(_0x5731d0,null));};exports[_0x7f5a('0x4b')]=function(_0x225019,_0x361c56,_0x519834){var _0x11cb05={};var _0x2e8c81={};var _0x5eceb9;var _0x49a596;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x225019[_0x7f5a('0x43')]['id']}})[_0x7f5a('0x3e')](handleEntityNotFound(_0x361c56,null))['then'](function(_0x312ec1){if(_0x312ec1){_0x5eceb9=_0x312ec1;_0x2e8c81['model']=_['keys'](db['SalesforceField'][_0x7f5a('0x44')]);_0x2e8c81[_0x7f5a('0x30')]=_[_0x7f5a('0x31')](_0x225019[_0x7f5a('0x30')]);_0x2e8c81[_0x7f5a('0x32')]=_['intersection'](_0x2e8c81[_0x7f5a('0x2e')],_0x2e8c81[_0x7f5a('0x30')]);_0x11cb05['attributes']=_[_0x7f5a('0x45')](_0x2e8c81[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x225019[_0x7f5a('0x30')][_0x7f5a('0x33')]));_0x11cb05['attributes']=_0x11cb05[_0x7f5a('0x34')][_0x7f5a('0x35')]?_0x11cb05[_0x7f5a('0x34')]:_0x2e8c81['model'];_0x11cb05[_0x7f5a('0x4c')]=qs['sort'](_0x225019[_0x7f5a('0x30')]['sort']);_0x11cb05[_0x7f5a('0x3d')]=qs[_0x7f5a('0x32')](_[_0x7f5a('0x39')](_0x225019[_0x7f5a('0x30')],_0x2e8c81[_0x7f5a('0x32')]));if(_0x225019[_0x7f5a('0x30')][_0x7f5a('0x4d')]){_0x11cb05[_0x7f5a('0x3d')]=_[_0x7f5a('0x3c')](_0x11cb05[_0x7f5a('0x3d')],{'$or':_[_0x7f5a('0x2f')](_0x11cb05[_0x7f5a('0x34')],function(_0x113715){var _0x21c6e5={};_0x21c6e5[_0x113715]={'$like':'%'+_0x225019[_0x7f5a('0x30')][_0x7f5a('0x4d')]+'%'};return _0x21c6e5;})});}_0x11cb05=_[_0x7f5a('0x3c')]({},_0x11cb05,_0x225019[_0x7f5a('0x47')]);return _0x5eceb9[_0x7f5a('0x4b')](_0x11cb05);}})['then'](function(_0x556a5f){if(_0x556a5f){_0x49a596=_0x556a5f[_0x7f5a('0x35')];if(!_0x225019['query']['hasOwnProperty'](_0x7f5a('0x37'))){_0x11cb05[_0x7f5a('0x1e')]=qs[_0x7f5a('0x1e')](_0x225019[_0x7f5a('0x30')][_0x7f5a('0x1e')]);_0x11cb05[_0x7f5a('0x1c')]=qs[_0x7f5a('0x1c')](_0x225019['query']['offset']);}return _0x5eceb9[_0x7f5a('0x4b')](_0x11cb05);}})['then'](function(_0x3184e0){if(_0x3184e0){return _0x3184e0?{'count':_0x49a596,'rows':_0x3184e0}:null;}})[_0x7f5a('0x3e')](respondWithResult(_0x361c56,null))[_0x7f5a('0x41')](handleError(_0x361c56,null));};exports[_0x7f5a('0x4e')]=function(_0x3b2963,_0x421f66,_0x2fac37){var _0x29d409={};var _0x3b7bf1={};var _0xda3aee;var _0x193b22;return db[_0x7f5a('0x2b')][_0x7f5a('0x4f')]({'where':{'id':_0x3b2963['params']['id']}})[_0x7f5a('0x3e')](handleEntityNotFound(_0x421f66,null))[_0x7f5a('0x3e')](function(_0x334b1f){if(_0x334b1f){_0xda3aee=_0x334b1f;_0x3b7bf1[_0x7f5a('0x2e')]=_[_0x7f5a('0x31')](db['SalesforceField']['rawAttributes']);_0x3b7bf1[_0x7f5a('0x30')]=_[_0x7f5a('0x31')](_0x3b2963[_0x7f5a('0x30')]);_0x3b7bf1['filters']=_[_0x7f5a('0x45')](_0x3b7bf1[_0x7f5a('0x2e')],_0x3b7bf1[_0x7f5a('0x30')]);_0x29d409['attributes']=_[_0x7f5a('0x45')](_0x3b7bf1[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x3b2963[_0x7f5a('0x30')]['fields']));_0x29d409[_0x7f5a('0x34')]=_0x29d409['attributes']['length']?_0x29d409[_0x7f5a('0x34')]:_0x3b7bf1[_0x7f5a('0x2e')];_0x29d409[_0x7f5a('0x4c')]=qs[_0x7f5a('0x38')](_0x3b2963[_0x7f5a('0x30')][_0x7f5a('0x38')]);_0x29d409[_0x7f5a('0x3d')]=qs[_0x7f5a('0x32')](_['pick'](_0x3b2963[_0x7f5a('0x30')],_0x3b7bf1[_0x7f5a('0x32')]));if(_0x3b2963[_0x7f5a('0x30')][_0x7f5a('0x4d')]){_0x29d409[_0x7f5a('0x3d')]=_['merge'](_0x29d409[_0x7f5a('0x3d')],{'$or':_[_0x7f5a('0x2f')](_0x29d409[_0x7f5a('0x34')],function(_0x4d0f09){var _0x52a0dd={};_0x52a0dd[_0x4d0f09]={'$like':'%'+_0x3b2963[_0x7f5a('0x30')][_0x7f5a('0x4d')]+'%'};return _0x52a0dd;})});}_0x29d409=_[_0x7f5a('0x3c')]({},_0x29d409,_0x3b2963[_0x7f5a('0x47')]);return _0xda3aee['getSubjects'](_0x29d409);}})['then'](function(_0x3183b9){if(_0x3183b9){_0x193b22=_0x3183b9[_0x7f5a('0x35')];if(!_0x3b2963['query'][_0x7f5a('0x36')]('nolimit')){_0x29d409[_0x7f5a('0x1e')]=qs[_0x7f5a('0x1e')](_0x3b2963['query']['limit']);_0x29d409[_0x7f5a('0x1c')]=qs[_0x7f5a('0x1c')](_0x3b2963['query'][_0x7f5a('0x1c')]);}return _0xda3aee['getSubjects'](_0x29d409);}})[_0x7f5a('0x3e')](function(_0x15368e){if(_0x15368e){return _0x15368e?{'count':_0x193b22,'rows':_0x15368e}:null;}})[_0x7f5a('0x3e')](respondWithResult(_0x421f66,null))[_0x7f5a('0x41')](handleError(_0x421f66,null));};exports[_0x7f5a('0x50')]=function(_0x181e12,_0x1a9d82,_0x9b186e){var _0x24034b={};var _0x47369a={};var _0x2ee329;var _0x2bd572;return db[_0x7f5a('0x2b')]['findOne']({'where':{'id':_0x181e12[_0x7f5a('0x43')]['id']}})[_0x7f5a('0x3e')](handleEntityNotFound(_0x1a9d82,null))[_0x7f5a('0x3e')](function(_0x4cc688){if(_0x4cc688){_0x2ee329=_0x4cc688;_0x47369a[_0x7f5a('0x2e')]=_['keys'](db[_0x7f5a('0x51')][_0x7f5a('0x44')]);_0x47369a['query']=_[_0x7f5a('0x31')](_0x181e12[_0x7f5a('0x30')]);_0x47369a[_0x7f5a('0x32')]=_[_0x7f5a('0x45')](_0x47369a['model'],_0x47369a['query']);_0x24034b[_0x7f5a('0x34')]=_[_0x7f5a('0x45')](_0x47369a[_0x7f5a('0x2e')],qs['fields'](_0x181e12[_0x7f5a('0x30')][_0x7f5a('0x33')]));_0x24034b[_0x7f5a('0x34')]=_0x24034b[_0x7f5a('0x34')]['length']?_0x24034b[_0x7f5a('0x34')]:_0x47369a['model'];_0x24034b[_0x7f5a('0x4c')]=qs[_0x7f5a('0x38')](_0x181e12[_0x7f5a('0x30')]['sort']);_0x24034b[_0x7f5a('0x3d')]=qs[_0x7f5a('0x32')](_['pick'](_0x181e12[_0x7f5a('0x30')],_0x47369a[_0x7f5a('0x32')]));if(_0x181e12[_0x7f5a('0x30')][_0x7f5a('0x4d')]){_0x24034b[_0x7f5a('0x3d')]=_[_0x7f5a('0x3c')](_0x24034b[_0x7f5a('0x3d')],{'$or':_[_0x7f5a('0x2f')](_0x24034b['attributes'],function(_0x367bea){var _0x4069b7={};_0x4069b7[_0x367bea]={'$like':'%'+_0x181e12[_0x7f5a('0x30')]['filter']+'%'};return _0x4069b7;})});}_0x24034b=_[_0x7f5a('0x3c')]({},_0x24034b,_0x181e12[_0x7f5a('0x47')]);return _0x2ee329[_0x7f5a('0x50')](_0x24034b);}})[_0x7f5a('0x3e')](function(_0x5b3e58){if(_0x5b3e58){_0x2bd572=_0x5b3e58[_0x7f5a('0x35')];if(!_0x181e12[_0x7f5a('0x30')][_0x7f5a('0x36')](_0x7f5a('0x37'))){_0x24034b[_0x7f5a('0x1e')]=qs[_0x7f5a('0x1e')](_0x181e12['query'][_0x7f5a('0x1e')]);_0x24034b['offset']=qs[_0x7f5a('0x1c')](_0x181e12['query'][_0x7f5a('0x1c')]);}return _0x2ee329[_0x7f5a('0x50')](_0x24034b);}})['then'](function(_0x56bac5){if(_0x56bac5){return _0x56bac5?{'count':_0x2bd572,'rows':_0x56bac5}:null;}})[_0x7f5a('0x3e')](respondWithResult(_0x1a9d82,null))['catch'](handleError(_0x1a9d82,null));}; \ No newline at end of file +var _0x76b1=['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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','SalesforceConfiguration','include','findAll','catch','show','params','length','includeAll','find','create','body','findOne','SalesforceField','getFields','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2cf832,_0x104eb1){var _0x353089=function(_0x555345){while(--_0x555345){_0x2cf832['push'](_0x2cf832['shift']());}};_0x353089(++_0x104eb1);}(_0x76b1,0x9c));var _0x176b=function(_0x3867f8,_0x4bf6e6){_0x3867f8=_0x3867f8-0x0;var _0x25d057=_0x76b1[_0x3867f8];return _0x25d057;};'use strict';var emlformat=require(_0x176b('0x0'));var rimraf=require(_0x176b('0x1'));var zipdir=require(_0x176b('0x2'));var jsonpatch=require(_0x176b('0x3'));var rp=require(_0x176b('0x4'));var moment=require(_0x176b('0x5'));var BPromise=require(_0x176b('0x6'));var Mustache=require(_0x176b('0x7'));var util=require('util');var path=require(_0x176b('0x8'));var sox=require(_0x176b('0x9'));var csv=require(_0x176b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x176b('0xb'));var _=require(_0x176b('0xc'));var squel=require(_0x176b('0xd'));var crypto=require('crypto');var jsforce=require(_0x176b('0xe'));var deskjs=require(_0x176b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x176b('0x10'));var Redis=require(_0x176b('0x11'));var authService=require(_0x176b('0x12'));var qs=require(_0x176b('0x13'));var as=require(_0x176b('0x14'));var hardwareService=require(_0x176b('0x15'));var logger=require(_0x176b('0x16'))(_0x176b('0x17'));var utils=require('../../config/utils');var config=require(_0x176b('0x18'));var licenseUtil=require(_0x176b('0x19'));var db=require(_0x176b('0x1a'))['db'];function respondWithStatusCode(_0x52d81f,_0x350b94){_0x350b94=_0x350b94||0xcc;return function(_0x1b7698){if(_0x1b7698){return _0x52d81f[_0x176b('0x1b')](_0x350b94);}return _0x52d81f[_0x176b('0x1c')](_0x350b94)[_0x176b('0x1d')]();};}function respondWithResult(_0x1b02f6,_0x5aeac5){_0x5aeac5=_0x5aeac5||0xc8;return function(_0x5906fc){if(_0x5906fc){return _0x1b02f6[_0x176b('0x1c')](_0x5aeac5)['json'](_0x5906fc);}};}function respondWithFilteredResult(_0x3122e9,_0x1f213d){return function(_0x2a314c){if(_0x2a314c){var _0x489876=typeof _0x1f213d['offset']===_0x176b('0x1e')&&typeof _0x1f213d[_0x176b('0x1f')]==='undefined';var _0x1fc663=_0x2a314c[_0x176b('0x20')];var _0xccc649=_0x489876?0x0:_0x1f213d[_0x176b('0x21')];var _0x4f0034=_0x489876?_0x2a314c[_0x176b('0x20')]:_0x1f213d[_0x176b('0x21')]+_0x1f213d[_0x176b('0x1f')];var _0x53c7d4;if(_0x4f0034>=_0x1fc663){_0x4f0034=_0x1fc663;_0x53c7d4=0xc8;}else{_0x53c7d4=0xce;}_0x3122e9['status'](_0x53c7d4);return _0x3122e9[_0x176b('0x22')](_0x176b('0x23'),_0xccc649+'-'+_0x4f0034+'/'+_0x1fc663)['json'](_0x2a314c);}return null;};}function patchUpdates(_0x256167){return function(_0x2365e2){try{jsonpatch[_0x176b('0x24')](_0x2365e2,_0x256167,!![]);}catch(_0x534de5){return BPromise[_0x176b('0x25')](_0x534de5);}return _0x2365e2[_0x176b('0x26')]();};}function saveUpdates(_0x5c274f,_0x4ffc3d){return function(_0x156e0c){if(_0x156e0c){return _0x156e0c[_0x176b('0x27')](_0x5c274f)['then'](function(_0x545e3c){return _0x545e3c;});}return null;};}function removeEntity(_0x381e31,_0x1463c5){return function(_0x3d53f0){if(_0x3d53f0){return _0x3d53f0['destroy']()[_0x176b('0x28')](function(){_0x381e31[_0x176b('0x1c')](0xcc)[_0x176b('0x1d')]();});}};}function handleEntityNotFound(_0x5f5ba9,_0x3d3350){return function(_0x33c7df){if(!_0x33c7df){_0x5f5ba9[_0x176b('0x1b')](0x194);}return _0x33c7df;};}function handleError(_0x2b13ad,_0x2f0b8c){_0x2f0b8c=_0x2f0b8c||0x1f4;return function(_0x40a90e){logger['error'](_0x40a90e[_0x176b('0x29')]);if(_0x40a90e[_0x176b('0x2a')]){delete _0x40a90e[_0x176b('0x2a')];}_0x2b13ad[_0x176b('0x1c')](_0x2f0b8c)[_0x176b('0x2b')](_0x40a90e);};}exports[_0x176b('0x2c')]=function(_0x48e446,_0x1ebdf5){var _0x2c574f={},_0x3e2083={},_0x1f85ff={'count':0x0,'rows':[]};var _0x131684=_[_0x176b('0x2d')](db['SalesforceConfiguration'][_0x176b('0x2e')],function(_0x4f6040){return{'name':_0x4f6040['fieldName'],'type':_0x4f6040['type'][_0x176b('0x2f')]};});_0x3e2083[_0x176b('0x30')]=_[_0x176b('0x2d')](_0x131684,_0x176b('0x2a'));_0x3e2083[_0x176b('0x31')]=_[_0x176b('0x32')](_0x48e446[_0x176b('0x31')]);_0x3e2083[_0x176b('0x33')]=_['intersection'](_0x3e2083[_0x176b('0x30')],_0x3e2083[_0x176b('0x31')]);_0x2c574f[_0x176b('0x34')]=_[_0x176b('0x35')](_0x3e2083[_0x176b('0x30')],qs[_0x176b('0x36')](_0x48e446[_0x176b('0x31')][_0x176b('0x36')]));_0x2c574f[_0x176b('0x34')]=_0x2c574f[_0x176b('0x34')]['length']?_0x2c574f[_0x176b('0x34')]:_0x3e2083[_0x176b('0x30')];if(!_0x48e446[_0x176b('0x31')][_0x176b('0x37')](_0x176b('0x38'))){_0x2c574f[_0x176b('0x1f')]=qs[_0x176b('0x1f')](_0x48e446[_0x176b('0x31')][_0x176b('0x1f')]);_0x2c574f[_0x176b('0x21')]=qs[_0x176b('0x21')](_0x48e446[_0x176b('0x31')]['offset']);}_0x2c574f[_0x176b('0x39')]=qs[_0x176b('0x3a')](_0x48e446[_0x176b('0x31')]['sort']);_0x2c574f[_0x176b('0x3b')]=qs['filters'](_['pick'](_0x48e446['query'],_0x3e2083[_0x176b('0x33')]),_0x131684);if(_0x48e446[_0x176b('0x31')][_0x176b('0x3c')]){_0x2c574f['where']=_[_0x176b('0x3d')](_0x2c574f[_0x176b('0x3b')],{'$or':_[_0x176b('0x2d')](_0x131684,function(_0x592101){if(_0x592101[_0x176b('0x3e')]!==_0x176b('0x3f')){var _0x31f189={};_0x31f189[_0x592101['name']]={'$like':'%'+_0x48e446[_0x176b('0x31')][_0x176b('0x3c')]+'%'};return _0x31f189;}})});}_0x2c574f=_[_0x176b('0x3d')]({},_0x2c574f,_0x48e446[_0x176b('0x40')]);var _0x2f5fd1={'where':_0x2c574f[_0x176b('0x3b')]};return db[_0x176b('0x41')][_0x176b('0x20')](_0x2f5fd1)['then'](function(_0x239e8e){_0x1f85ff[_0x176b('0x20')]=_0x239e8e;if(_0x48e446[_0x176b('0x31')]['includeAll']){_0x2c574f[_0x176b('0x42')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x176b('0x43')](_0x2c574f);})[_0x176b('0x28')](function(_0x164c63){_0x1f85ff['rows']=_0x164c63;return _0x1f85ff;})[_0x176b('0x28')](respondWithFilteredResult(_0x1ebdf5,_0x2c574f))[_0x176b('0x44')](handleError(_0x1ebdf5,null));};exports[_0x176b('0x45')]=function(_0x384dca,_0x17c0ed){var _0x50cab7={'raw':![],'where':{'id':_0x384dca[_0x176b('0x46')]['id']}},_0x3dec39={};_0x3dec39[_0x176b('0x30')]=_[_0x176b('0x32')](db[_0x176b('0x41')][_0x176b('0x2e')]);_0x3dec39[_0x176b('0x31')]=_[_0x176b('0x32')](_0x384dca[_0x176b('0x31')]);_0x3dec39['filters']=_[_0x176b('0x35')](_0x3dec39[_0x176b('0x30')],_0x3dec39[_0x176b('0x31')]);_0x50cab7[_0x176b('0x34')]=_[_0x176b('0x35')](_0x3dec39['model'],qs['fields'](_0x384dca['query'][_0x176b('0x36')]));_0x50cab7[_0x176b('0x34')]=_0x50cab7[_0x176b('0x34')][_0x176b('0x47')]?_0x50cab7[_0x176b('0x34')]:_0x3dec39[_0x176b('0x30')];if(_0x384dca[_0x176b('0x31')][_0x176b('0x48')]){_0x50cab7[_0x176b('0x42')]=[{'all':!![]}];}_0x50cab7=_[_0x176b('0x3d')]({},_0x50cab7,_0x384dca[_0x176b('0x40')]);return db['SalesforceConfiguration'][_0x176b('0x49')](_0x50cab7)[_0x176b('0x28')](handleEntityNotFound(_0x17c0ed,null))['then'](respondWithResult(_0x17c0ed,null))[_0x176b('0x44')](handleError(_0x17c0ed,null));};exports[_0x176b('0x4a')]=function(_0x12792b,_0xedc5e3){return db[_0x176b('0x41')][_0x176b('0x4a')](_0x12792b[_0x176b('0x4b')],{})[_0x176b('0x28')](respondWithResult(_0xedc5e3,0xc9))[_0x176b('0x44')](handleError(_0xedc5e3,null));};exports['update']=function(_0x1feb4b,_0x37829b){if(_0x1feb4b[_0x176b('0x4b')]['id']){delete _0x1feb4b[_0x176b('0x4b')]['id'];}return db[_0x176b('0x41')][_0x176b('0x49')]({'where':{'id':_0x1feb4b['params']['id']}})[_0x176b('0x28')](handleEntityNotFound(_0x37829b,null))['then'](saveUpdates(_0x1feb4b['body'],null))[_0x176b('0x28')](respondWithResult(_0x37829b,null))[_0x176b('0x44')](handleError(_0x37829b,null));};exports['destroy']=function(_0x3c4a49,_0x281351){return db['SalesforceConfiguration']['find']({'where':{'id':_0x3c4a49[_0x176b('0x46')]['id']}})['then'](handleEntityNotFound(_0x281351,null))[_0x176b('0x28')](removeEntity(_0x281351,null))[_0x176b('0x44')](handleError(_0x281351,null));};exports['getFields']=function(_0x1ee404,_0x164617,_0x54036c){var _0x5a6b6c={};var _0x1bd0c0={};var _0x36ced1;var _0x43816e;return db[_0x176b('0x41')][_0x176b('0x4c')]({'where':{'id':_0x1ee404[_0x176b('0x46')]['id']}})[_0x176b('0x28')](handleEntityNotFound(_0x164617,null))[_0x176b('0x28')](function(_0x143d82){if(_0x143d82){_0x36ced1=_0x143d82;_0x1bd0c0[_0x176b('0x30')]=_[_0x176b('0x32')](db[_0x176b('0x4d')][_0x176b('0x2e')]);_0x1bd0c0[_0x176b('0x31')]=_[_0x176b('0x32')](_0x1ee404[_0x176b('0x31')]);_0x1bd0c0[_0x176b('0x33')]=_['intersection'](_0x1bd0c0[_0x176b('0x30')],_0x1bd0c0[_0x176b('0x31')]);_0x5a6b6c['attributes']=_[_0x176b('0x35')](_0x1bd0c0[_0x176b('0x30')],qs[_0x176b('0x36')](_0x1ee404['query'][_0x176b('0x36')]));_0x5a6b6c[_0x176b('0x34')]=_0x5a6b6c['attributes'][_0x176b('0x47')]?_0x5a6b6c[_0x176b('0x34')]:_0x1bd0c0['model'];_0x5a6b6c[_0x176b('0x39')]=qs[_0x176b('0x3a')](_0x1ee404['query']['sort']);_0x5a6b6c[_0x176b('0x3b')]=qs[_0x176b('0x33')](_['pick'](_0x1ee404[_0x176b('0x31')],_0x1bd0c0[_0x176b('0x33')]));if(_0x1ee404['query'][_0x176b('0x3c')]){_0x5a6b6c[_0x176b('0x3b')]=_[_0x176b('0x3d')](_0x5a6b6c[_0x176b('0x3b')],{'$or':_['map'](_0x5a6b6c[_0x176b('0x34')],function(_0x44358f){var _0x1e6f14={};_0x1e6f14[_0x44358f]={'$like':'%'+_0x1ee404['query'][_0x176b('0x3c')]+'%'};return _0x1e6f14;})});}_0x5a6b6c=_[_0x176b('0x3d')]({},_0x5a6b6c,_0x1ee404['options']);return _0x36ced1[_0x176b('0x4e')](_0x5a6b6c);}})['then'](function(_0x2f0b54){if(_0x2f0b54){_0x43816e=_0x2f0b54[_0x176b('0x47')];if(!_0x1ee404[_0x176b('0x31')][_0x176b('0x37')](_0x176b('0x38'))){_0x5a6b6c['limit']=qs['limit'](_0x1ee404[_0x176b('0x31')][_0x176b('0x1f')]);_0x5a6b6c[_0x176b('0x21')]=qs['offset'](_0x1ee404['query'][_0x176b('0x21')]);}return _0x36ced1[_0x176b('0x4e')](_0x5a6b6c);}})[_0x176b('0x28')](function(_0x48b213){if(_0x48b213){return _0x48b213?{'count':_0x43816e,'rows':_0x48b213}:null;}})['then'](respondWithResult(_0x164617,null))[_0x176b('0x44')](handleError(_0x164617,null));};exports[_0x176b('0x4f')]=function(_0x2366f0,_0x285c87,_0x35e762){var _0xf1e59c={};var _0x1005e6={};var _0x319a6f;var _0x352ebc;return db[_0x176b('0x41')][_0x176b('0x4c')]({'where':{'id':_0x2366f0['params']['id']}})[_0x176b('0x28')](handleEntityNotFound(_0x285c87,null))[_0x176b('0x28')](function(_0x59b4d3){if(_0x59b4d3){_0x319a6f=_0x59b4d3;_0x1005e6[_0x176b('0x30')]=_['keys'](db[_0x176b('0x4d')]['rawAttributes']);_0x1005e6[_0x176b('0x31')]=_[_0x176b('0x32')](_0x2366f0[_0x176b('0x31')]);_0x1005e6[_0x176b('0x33')]=_[_0x176b('0x35')](_0x1005e6[_0x176b('0x30')],_0x1005e6['query']);_0xf1e59c[_0x176b('0x34')]=_['intersection'](_0x1005e6[_0x176b('0x30')],qs[_0x176b('0x36')](_0x2366f0[_0x176b('0x31')][_0x176b('0x36')]));_0xf1e59c['attributes']=_0xf1e59c['attributes']['length']?_0xf1e59c[_0x176b('0x34')]:_0x1005e6['model'];_0xf1e59c[_0x176b('0x39')]=qs[_0x176b('0x3a')](_0x2366f0[_0x176b('0x31')][_0x176b('0x3a')]);_0xf1e59c['where']=qs[_0x176b('0x33')](_[_0x176b('0x50')](_0x2366f0[_0x176b('0x31')],_0x1005e6[_0x176b('0x33')]));if(_0x2366f0[_0x176b('0x31')][_0x176b('0x3c')]){_0xf1e59c[_0x176b('0x3b')]=_['merge'](_0xf1e59c[_0x176b('0x3b')],{'$or':_[_0x176b('0x2d')](_0xf1e59c[_0x176b('0x34')],function(_0x340f07){var _0x46912c={};_0x46912c[_0x340f07]={'$like':'%'+_0x2366f0[_0x176b('0x31')][_0x176b('0x3c')]+'%'};return _0x46912c;})});}_0xf1e59c=_['merge']({},_0xf1e59c,_0x2366f0['options']);return _0x319a6f[_0x176b('0x4f')](_0xf1e59c);}})[_0x176b('0x28')](function(_0x3d2b5b){if(_0x3d2b5b){_0x352ebc=_0x3d2b5b[_0x176b('0x47')];if(!_0x2366f0[_0x176b('0x31')][_0x176b('0x37')](_0x176b('0x38'))){_0xf1e59c[_0x176b('0x1f')]=qs[_0x176b('0x1f')](_0x2366f0[_0x176b('0x31')]['limit']);_0xf1e59c['offset']=qs[_0x176b('0x21')](_0x2366f0['query'][_0x176b('0x21')]);}return _0x319a6f[_0x176b('0x4f')](_0xf1e59c);}})['then'](function(_0x30d113){if(_0x30d113){return _0x30d113?{'count':_0x352ebc,'rows':_0x30d113}:null;}})[_0x176b('0x28')](respondWithResult(_0x285c87,null))[_0x176b('0x44')](handleError(_0x285c87,null));};exports['getDescriptions']=function(_0x4f3a3a,_0x12b73f,_0x2b02f4){var _0x306d4a={};var _0x38199a={};var _0x511e0c;var _0xc77376;return db[_0x176b('0x41')]['findOne']({'where':{'id':_0x4f3a3a[_0x176b('0x46')]['id']}})[_0x176b('0x28')](handleEntityNotFound(_0x12b73f,null))[_0x176b('0x28')](function(_0x126f2c){if(_0x126f2c){_0x511e0c=_0x126f2c;_0x38199a[_0x176b('0x30')]=_[_0x176b('0x32')](db['SalesforceField'][_0x176b('0x2e')]);_0x38199a[_0x176b('0x31')]=_[_0x176b('0x32')](_0x4f3a3a[_0x176b('0x31')]);_0x38199a[_0x176b('0x33')]=_[_0x176b('0x35')](_0x38199a[_0x176b('0x30')],_0x38199a[_0x176b('0x31')]);_0x306d4a[_0x176b('0x34')]=_['intersection'](_0x38199a[_0x176b('0x30')],qs[_0x176b('0x36')](_0x4f3a3a[_0x176b('0x31')][_0x176b('0x36')]));_0x306d4a[_0x176b('0x34')]=_0x306d4a[_0x176b('0x34')][_0x176b('0x47')]?_0x306d4a['attributes']:_0x38199a[_0x176b('0x30')];_0x306d4a[_0x176b('0x39')]=qs[_0x176b('0x3a')](_0x4f3a3a[_0x176b('0x31')][_0x176b('0x3a')]);_0x306d4a['where']=qs[_0x176b('0x33')](_['pick'](_0x4f3a3a['query'],_0x38199a[_0x176b('0x33')]));if(_0x4f3a3a[_0x176b('0x31')][_0x176b('0x3c')]){_0x306d4a[_0x176b('0x3b')]=_[_0x176b('0x3d')](_0x306d4a[_0x176b('0x3b')],{'$or':_[_0x176b('0x2d')](_0x306d4a[_0x176b('0x34')],function(_0x5303a4){var _0x3bc942={};_0x3bc942[_0x5303a4]={'$like':'%'+_0x4f3a3a[_0x176b('0x31')][_0x176b('0x3c')]+'%'};return _0x3bc942;})});}_0x306d4a=_[_0x176b('0x3d')]({},_0x306d4a,_0x4f3a3a[_0x176b('0x40')]);return _0x511e0c[_0x176b('0x51')](_0x306d4a);}})['then'](function(_0x49c50c){if(_0x49c50c){_0xc77376=_0x49c50c[_0x176b('0x47')];if(!_0x4f3a3a[_0x176b('0x31')][_0x176b('0x37')](_0x176b('0x38'))){_0x306d4a['limit']=qs[_0x176b('0x1f')](_0x4f3a3a['query']['limit']);_0x306d4a[_0x176b('0x21')]=qs[_0x176b('0x21')](_0x4f3a3a[_0x176b('0x31')][_0x176b('0x21')]);}return _0x511e0c[_0x176b('0x51')](_0x306d4a);}})[_0x176b('0x28')](function(_0x5c3935){if(_0x5c3935){return _0x5c3935?{'count':_0xc77376,'rows':_0x5c3935}:null;}})[_0x176b('0x28')](respondWithResult(_0x12b73f,null))[_0x176b('0x44')](handleError(_0x12b73f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f311aa9..b25fa01 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 _0xc98d=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1d7037,_0xb6cea9){var _0xd410a2=function(_0x480d39){while(--_0x480d39){_0x1d7037['push'](_0x1d7037['shift']());}};_0xd410a2(++_0xb6cea9);}(_0xc98d,0xbe));var _0xdc98=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0xc98d[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0xdc98('0x0'));var util=require(_0xdc98('0x1'));var logger=require(_0xdc98('0x2'))(_0xdc98('0x3'));var moment=require(_0xdc98('0x4'));var BPromise=require(_0xdc98('0x5'));var rp=require(_0xdc98('0x6'));var fs=require('fs');var path=require(_0xdc98('0x7'));var rimraf=require(_0xdc98('0x8'));var config=require(_0xdc98('0x9'));var attributes=require(_0xdc98('0xa'));module[_0xdc98('0xb')]=function(_0x4e95ee,_0x3092a0){return _0x4e95ee[_0xdc98('0xc')]('SalesforceConfiguration',attributes,{'tableName':_0xdc98('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd509=['request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','util','../../config/logger','api'];(function(_0x3c1312,_0x45bfdb){var _0x5b4831=function(_0x53706f){while(--_0x53706f){_0x3c1312['push'](_0x3c1312['shift']());}};_0x5b4831(++_0x45bfdb);}(_0xd509,0xf9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9d50('0x0'));var logger=require(_0x9d50('0x1'))(_0x9d50('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9d50('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d50('0x4'));var config=require(_0x9d50('0x5'));var attributes=require(_0x9d50('0x6'));module['exports']=function(_0x3c38f8,_0x5d9c2d){return _0x3c38f8[_0x9d50('0x7')](_0x9d50('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index bfa859a..49d0ba6 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 _0xd635=['then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4df280,_0x40468a){var _0x156023=function(_0x28585c){while(--_0x28585c){_0x4df280['push'](_0x4df280['shift']());}};_0x156023(++_0x40468a);}(_0xd635,0x186));var _0x5d63=function(_0x7a242a,_0x423353){_0x7a242a=_0x7a242a-0x0;var _0x3b20c3=_0xd635[_0x7a242a];return _0x3b20c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5d63('0x0'));var BPromise=require(_0x5d63('0x1'));var rs=require(_0x5d63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d63('0x4'))(_0x5d63('0x5'));var config=require(_0x5d63('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5d63('0x7')][_0x5d63('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x432e15,_0x25262b,_0x10e0c3){return new BPromise(function(_0xad1086,_0x34686d){return client['request'](_0x432e15,_0x10e0c3)[_0x5d63('0x9')](function(_0x539ba0){logger[_0x5d63('0xa')](_0x5d63('0xb'),_0x25262b,'request\x20sent');logger[_0x5d63('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x25262b,_0x5d63('0xd'),JSON[_0x5d63('0xe')](_0x539ba0));if(_0x539ba0[_0x5d63('0xf')]){if(_0x539ba0[_0x5d63('0xf')]['code']===0x1f4){logger[_0x5d63('0xf')](_0x5d63('0xb'),_0x25262b,_0x539ba0[_0x5d63('0xf')][_0x5d63('0x10')]);return _0x34686d(_0x539ba0['error'][_0x5d63('0x10')]);}logger['error'](_0x5d63('0xb'),_0x25262b,_0x539ba0['error'][_0x5d63('0x10')]);return _0xad1086(_0x539ba0[_0x5d63('0xf')][_0x5d63('0x10')]);}else{logger[_0x5d63('0xa')](_0x5d63('0xb'),_0x25262b,_0x5d63('0xd'));_0xad1086(_0x539ba0[_0x5d63('0x11')][_0x5d63('0x10')]);}})[_0x5d63('0x12')](function(_0x196689){logger[_0x5d63('0xf')](_0x5d63('0xb'),_0x25262b,_0x196689);_0x34686d(_0x196689);});});} \ No newline at end of file +var _0x39da=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util'];(function(_0x12baec,_0x33ac15){var _0x31595f=function(_0x55015f){while(--_0x55015f){_0x12baec['push'](_0x12baec['shift']());}};_0x31595f(++_0x33ac15);}(_0x39da,0x18f));var _0xa39d=function(_0x22f472,_0x239399){_0x22f472=_0x22f472-0x0;var _0x4672e5=_0x39da[_0x22f472];return _0x4672e5;};'use strict';var _=require('lodash');var util=require(_0xa39d('0x0'));var moment=require(_0xa39d('0x1'));var BPromise=require(_0xa39d('0x2'));var rs=require(_0xa39d('0x3'));var fs=require('fs');var Redis=require(_0xa39d('0x4'));var db=require(_0xa39d('0x5'))['db'];var utils=require(_0xa39d('0x6'));var logger=require(_0xa39d('0x7'))('rpc');var config=require(_0xa39d('0x8'));var jayson=require(_0xa39d('0x9'));var client=jayson[_0xa39d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287c4f,_0x266928,_0x519a94){return new BPromise(function(_0x107767,_0x29e3b9){return client['request'](_0x287c4f,_0x519a94)[_0xa39d('0xb')](function(_0x46ac5f){logger[_0xa39d('0xc')](_0xa39d('0xd'),_0x266928,_0xa39d('0xe'));logger['debug'](_0xa39d('0xf'),_0x266928,_0xa39d('0xe'),JSON['stringify'](_0x46ac5f));if(_0x46ac5f[_0xa39d('0x10')]){if(_0x46ac5f[_0xa39d('0x10')]['code']===0x1f4){logger[_0xa39d('0x10')](_0xa39d('0xd'),_0x266928,_0x46ac5f['error']['message']);return _0x29e3b9(_0x46ac5f['error']['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x266928,_0x46ac5f[_0xa39d('0x10')][_0xa39d('0x11')]);return _0x107767(_0x46ac5f['error'][_0xa39d('0x11')]);}else{logger[_0xa39d('0xc')](_0xa39d('0xd'),_0x266928,'request\x20sent');_0x107767(_0x46ac5f[_0xa39d('0x12')]['message']);}})[_0xa39d('0x13')](function(_0x3ff233){logger['error'](_0xa39d('0xd'),_0x266928,_0x3ff233);_0x29e3b9(_0x3ff233);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ceb090b..7acab40 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 _0xb1cf=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x14792f,_0x32f1be){var _0x38f852=function(_0x313df2){while(--_0x313df2){_0x14792f['push'](_0x14792f['shift']());}};_0x38f852(++_0x32f1be);}(_0xb1cf,0xc7));var _0xfb1c=function(_0x46a635,_0x3cf6f0){_0x46a635=_0x46a635-0x0;var _0xff72f1=_0xb1cf[_0x46a635];return _0xff72f1;};'use strict';var multer=require(_0xfb1c('0x0'));var util=require(_0xfb1c('0x1'));var path=require(_0xfb1c('0x2'));var timeout=require(_0xfb1c('0x3'));var express=require(_0xfb1c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfb1c('0x5'));var config=require(_0xfb1c('0x6'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0xfb1c('0x7')](),controller[_0xfb1c('0x8')]);router[_0xfb1c('0x9')](_0xfb1c('0xa'),auth['isAuthenticated'](),controller[_0xfb1c('0xb')]);router[_0xfb1c('0xc')]('/',auth[_0xfb1c('0x7')](),controller[_0xfb1c('0xd')]);router[_0xfb1c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xfb1c('0xf')]);router[_0xfb1c('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfb1c('0x11')]=router; \ No newline at end of file +var _0xf6bb=['get','isAuthenticated','index','/:id','show','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf6bb,0x117));var _0xbf6b=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xf6bb[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require('multer');var util=require(_0xbf6b('0x0'));var path=require(_0xbf6b('0x1'));var timeout=require(_0xbf6b('0x2'));var express=require(_0xbf6b('0x3'));var router=express[_0xbf6b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf6b('0x5'));var interaction=require(_0xbf6b('0x6'));var config=require(_0xbf6b('0x7'));var controller=require(_0xbf6b('0x8'));router[_0xbf6b('0x9')]('/',auth[_0xbf6b('0xa')](),controller[_0xbf6b('0xb')]);router[_0xbf6b('0x9')](_0xbf6b('0xc'),auth[_0xbf6b('0xa')](),controller[_0xbf6b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf6b('0xe')]);router[_0xbf6b('0xf')](_0xbf6b('0xc'),auth['isAuthenticated'](),controller[_0xbf6b('0x10')]);router[_0xbf6b('0x11')](_0xbf6b('0xc'),auth[_0xbf6b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 6611f7d..65c270d 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 _0xbd10=['ENUM','string','customVariable','picklist','STRING','variable','sequelize','exports'];(function(_0x434cd0,_0x5644ed){var _0x590669=function(_0x20d3dd){while(--_0x20d3dd){_0x434cd0['push'](_0x434cd0['shift']());}};_0x590669(++_0x5644ed);}(_0xbd10,0x1d6));var _0x0bd1=function(_0x541049,_0x1d54af){_0x541049=_0x541049-0x0;var _0x16bcfe=_0xbd10[_0x541049];return _0x16bcfe;};'use strict';var Sequelize=require(_0x0bd1('0x0'));module[_0x0bd1('0x1')]={'type':{'type':Sequelize[_0x0bd1('0x2')](_0x0bd1('0x3'),'variable',_0x0bd1('0x4'),'keyValue',_0x0bd1('0x5')),'defaultValue':_0x0bd1('0x3')},'content':{'type':Sequelize[_0x0bd1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0bd1('0x2')](_0x0bd1('0x3'),_0x0bd1('0x7'),_0x0bd1('0x4'))},'keyContent':{'type':Sequelize[_0x0bd1('0x6')]},'idField':{'type':Sequelize[_0x0bd1('0x6')]},'variableName':{'type':Sequelize[_0x0bd1('0x6')]}}; \ No newline at end of file +var _0xd9f8=['customVariable','sequelize','exports','string','variable','keyValue','picklist','STRING'];(function(_0x45b54f,_0xb79008){var _0x2f4baf=function(_0x1e6bbb){while(--_0x1e6bbb){_0x45b54f['push'](_0x45b54f['shift']());}};_0x2f4baf(++_0xb79008);}(_0xd9f8,0x121));var _0x8d9f=function(_0x508d17,_0xa3354e){_0x508d17=_0x508d17-0x0;var _0x29bf38=_0xd9f8[_0x508d17];return _0x29bf38;};'use strict';var Sequelize=require(_0x8d9f('0x0'));module[_0x8d9f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8d9f('0x2'),_0x8d9f('0x3'),'customVariable',_0x8d9f('0x4'),_0x8d9f('0x5')),'defaultValue':_0x8d9f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8d9f('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8d9f('0x2'),_0x8d9f('0x3'),_0x8d9f('0x7'))},'keyContent':{'type':Sequelize[_0x8d9f('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x8d9f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 570e1b6..a7bd972 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 _0xf3cb=['fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SalesforceField','rawAttributes'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0xf3cb,0x152));var _0xbf3c=function(_0x420fb0,_0x350024){_0x420fb0=_0x420fb0-0x0;var _0x2572b4=_0xf3cb[_0x420fb0];return _0x2572b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf3c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf3c('0x1'));var rp=require(_0xbf3c('0x2'));var moment=require(_0xbf3c('0x3'));var BPromise=require(_0xbf3c('0x4'));var Mustache=require(_0xbf3c('0x5'));var util=require(_0xbf3c('0x6'));var path=require(_0xbf3c('0x7'));var sox=require(_0xbf3c('0x8'));var csv=require(_0xbf3c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf3c('0xa'));var _=require(_0xbf3c('0xb'));var squel=require(_0xbf3c('0xc'));var crypto=require(_0xbf3c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf3c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbf3c('0xf'));var Papa=require(_0xbf3c('0x10'));var Redis=require(_0xbf3c('0x11'));var authService=require(_0xbf3c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbf3c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf3c('0x14'))(_0xbf3c('0x15'));var utils=require(_0xbf3c('0x16'));var config=require(_0xbf3c('0x17'));var licenseUtil=require(_0xbf3c('0x18'));var db=require(_0xbf3c('0x19'))['db'];function respondWithStatusCode(_0x5a20a1,_0x2d003e){_0x2d003e=_0x2d003e||0xcc;return function(_0x218a11){if(_0x218a11){return _0x5a20a1['sendStatus'](_0x2d003e);}return _0x5a20a1[_0xbf3c('0x1a')](_0x2d003e)[_0xbf3c('0x1b')]();};}function respondWithResult(_0xb7dfb3,_0x40ba0f){_0x40ba0f=_0x40ba0f||0xc8;return function(_0x58845b){if(_0x58845b){return _0xb7dfb3[_0xbf3c('0x1a')](_0x40ba0f)[_0xbf3c('0x1c')](_0x58845b);}};}function respondWithFilteredResult(_0x5357c9,_0x45f8de){return function(_0x1feaea){if(_0x1feaea){var _0x5e2278=typeof _0x45f8de['offset']===_0xbf3c('0x1d')&&typeof _0x45f8de[_0xbf3c('0x1e')]===_0xbf3c('0x1d');var _0x5a1198=_0x1feaea[_0xbf3c('0x1f')];var _0xb82579=_0x5e2278?0x0:_0x45f8de[_0xbf3c('0x20')];var _0x22874d=_0x5e2278?_0x1feaea[_0xbf3c('0x1f')]:_0x45f8de[_0xbf3c('0x20')]+_0x45f8de['limit'];var _0x4b0ff0;if(_0x22874d>=_0x5a1198){_0x22874d=_0x5a1198;_0x4b0ff0=0xc8;}else{_0x4b0ff0=0xce;}_0x5357c9[_0xbf3c('0x1a')](_0x4b0ff0);return _0x5357c9[_0xbf3c('0x21')](_0xbf3c('0x22'),_0xb82579+'-'+_0x22874d+'/'+_0x5a1198)['json'](_0x1feaea);}return null;};}function patchUpdates(_0x187156){return function(_0xfd4ec4){try{jsonpatch[_0xbf3c('0x23')](_0xfd4ec4,_0x187156,!![]);}catch(_0x266600){return BPromise[_0xbf3c('0x24')](_0x266600);}return _0xfd4ec4[_0xbf3c('0x25')]();};}function saveUpdates(_0x201b68,_0x57830d){return function(_0x1ef70b){if(_0x1ef70b){return _0x1ef70b[_0xbf3c('0x26')](_0x201b68)[_0xbf3c('0x27')](function(_0x1508c4){return _0x1508c4;});}return null;};}function removeEntity(_0x1b96ba,_0x12b997){return function(_0x426297){if(_0x426297){return _0x426297[_0xbf3c('0x28')]()[_0xbf3c('0x27')](function(){_0x1b96ba[_0xbf3c('0x1a')](0xcc)[_0xbf3c('0x1b')]();});}};}function handleEntityNotFound(_0x45fd88,_0x3702aa){return function(_0x2d8453){if(!_0x2d8453){_0x45fd88['sendStatus'](0x194);}return _0x2d8453;};}function handleError(_0x5976d5,_0x456963){_0x456963=_0x456963||0x1f4;return function(_0x12fa2c){logger[_0xbf3c('0x29')](_0x12fa2c[_0xbf3c('0x2a')]);if(_0x12fa2c[_0xbf3c('0x2b')]){delete _0x12fa2c[_0xbf3c('0x2b')];}_0x5976d5[_0xbf3c('0x1a')](_0x456963)['send'](_0x12fa2c);};}exports['index']=function(_0x54a293,_0x1b15cb){var _0x8da7fc={},_0x576f61={},_0x14017e={'count':0x0,'rows':[]};var _0x295b8c=_[_0xbf3c('0x2c')](db[_0xbf3c('0x2d')][_0xbf3c('0x2e')],function(_0x277d25){return{'name':_0x277d25[_0xbf3c('0x2f')],'type':_0x277d25['type'][_0xbf3c('0x30')]};});_0x576f61[_0xbf3c('0x31')]=_['map'](_0x295b8c,'name');_0x576f61[_0xbf3c('0x32')]=_[_0xbf3c('0x33')](_0x54a293[_0xbf3c('0x32')]);_0x576f61[_0xbf3c('0x34')]=_['intersection'](_0x576f61['model'],_0x576f61[_0xbf3c('0x32')]);_0x8da7fc[_0xbf3c('0x35')]=_[_0xbf3c('0x36')](_0x576f61['model'],qs[_0xbf3c('0x37')](_0x54a293[_0xbf3c('0x32')][_0xbf3c('0x37')]));_0x8da7fc[_0xbf3c('0x35')]=_0x8da7fc['attributes']['length']?_0x8da7fc[_0xbf3c('0x35')]:_0x576f61['model'];if(!_0x54a293[_0xbf3c('0x32')][_0xbf3c('0x38')](_0xbf3c('0x39'))){_0x8da7fc[_0xbf3c('0x1e')]=qs[_0xbf3c('0x1e')](_0x54a293[_0xbf3c('0x32')]['limit']);_0x8da7fc[_0xbf3c('0x20')]=qs[_0xbf3c('0x20')](_0x54a293[_0xbf3c('0x32')][_0xbf3c('0x20')]);}_0x8da7fc[_0xbf3c('0x3a')]=qs['sort'](_0x54a293[_0xbf3c('0x32')][_0xbf3c('0x3b')]);_0x8da7fc[_0xbf3c('0x3c')]=qs[_0xbf3c('0x34')](_[_0xbf3c('0x3d')](_0x54a293[_0xbf3c('0x32')],_0x576f61[_0xbf3c('0x34')]),_0x295b8c);if(_0x54a293[_0xbf3c('0x32')][_0xbf3c('0x3e')]){_0x8da7fc[_0xbf3c('0x3c')]=_['merge'](_0x8da7fc[_0xbf3c('0x3c')],{'$or':_[_0xbf3c('0x2c')](_0x295b8c,function(_0x4f6764){if(_0x4f6764[_0xbf3c('0x3f')]!==_0xbf3c('0x40')){var _0x5121e0={};_0x5121e0[_0x4f6764[_0xbf3c('0x2b')]]={'$like':'%'+_0x54a293['query'][_0xbf3c('0x3e')]+'%'};return _0x5121e0;}})});}_0x8da7fc=_[_0xbf3c('0x41')]({},_0x8da7fc,_0x54a293[_0xbf3c('0x42')]);var _0x5ea06c={'where':_0x8da7fc[_0xbf3c('0x3c')]};return db['SalesforceField'][_0xbf3c('0x1f')](_0x5ea06c)['then'](function(_0x4eb9dd){_0x14017e[_0xbf3c('0x1f')]=_0x4eb9dd;if(_0x54a293[_0xbf3c('0x32')][_0xbf3c('0x43')]){_0x8da7fc[_0xbf3c('0x44')]=[{'all':!![]}];}return db[_0xbf3c('0x2d')]['findAll'](_0x8da7fc);})[_0xbf3c('0x27')](function(_0x442217){_0x14017e[_0xbf3c('0x45')]=_0x442217;return _0x14017e;})[_0xbf3c('0x27')](respondWithFilteredResult(_0x1b15cb,_0x8da7fc))[_0xbf3c('0x46')](handleError(_0x1b15cb,null));};exports[_0xbf3c('0x47')]=function(_0x28ff5d,_0x9ffd04){var _0x3f8734={'raw':!![],'where':{'id':_0x28ff5d[_0xbf3c('0x48')]['id']}},_0x48db17={};_0x48db17[_0xbf3c('0x31')]=_[_0xbf3c('0x33')](db[_0xbf3c('0x2d')][_0xbf3c('0x2e')]);_0x48db17[_0xbf3c('0x32')]=_['keys'](_0x28ff5d[_0xbf3c('0x32')]);_0x48db17[_0xbf3c('0x34')]=_[_0xbf3c('0x36')](_0x48db17[_0xbf3c('0x31')],_0x48db17[_0xbf3c('0x32')]);_0x3f8734[_0xbf3c('0x35')]=_['intersection'](_0x48db17['model'],qs[_0xbf3c('0x37')](_0x28ff5d[_0xbf3c('0x32')][_0xbf3c('0x37')]));_0x3f8734['attributes']=_0x3f8734[_0xbf3c('0x35')][_0xbf3c('0x49')]?_0x3f8734[_0xbf3c('0x35')]:_0x48db17[_0xbf3c('0x31')];if(_0x28ff5d['query'][_0xbf3c('0x43')]){_0x3f8734[_0xbf3c('0x44')]=[{'all':!![]}];}_0x3f8734=_[_0xbf3c('0x41')]({},_0x3f8734,_0x28ff5d[_0xbf3c('0x42')]);return db[_0xbf3c('0x2d')][_0xbf3c('0x4a')](_0x3f8734)[_0xbf3c('0x27')](handleEntityNotFound(_0x9ffd04,null))['then'](respondWithResult(_0x9ffd04,null))[_0xbf3c('0x46')](handleError(_0x9ffd04,null));};exports[_0xbf3c('0x4b')]=function(_0x412d97,_0x5850c0){return db[_0xbf3c('0x2d')][_0xbf3c('0x4b')](_0x412d97[_0xbf3c('0x4c')],{})['then'](respondWithResult(_0x5850c0,0xc9))['catch'](handleError(_0x5850c0,null));};exports[_0xbf3c('0x26')]=function(_0x157fcd,_0xbba293){if(_0x157fcd[_0xbf3c('0x4c')]['id']){delete _0x157fcd[_0xbf3c('0x4c')]['id'];}return db['SalesforceField'][_0xbf3c('0x4a')]({'where':{'id':_0x157fcd[_0xbf3c('0x48')]['id']}})[_0xbf3c('0x27')](handleEntityNotFound(_0xbba293,null))[_0xbf3c('0x27')](saveUpdates(_0x157fcd['body'],null))[_0xbf3c('0x27')](respondWithResult(_0xbba293,null))[_0xbf3c('0x46')](handleError(_0xbba293,null));};exports[_0xbf3c('0x28')]=function(_0x5c7099,_0x4a19e6){return db[_0xbf3c('0x2d')][_0xbf3c('0x4a')]({'where':{'id':_0x5c7099[_0xbf3c('0x48')]['id']}})[_0xbf3c('0x27')](handleEntityNotFound(_0x4a19e6,null))[_0xbf3c('0x27')](removeEntity(_0x4a19e6,null))[_0xbf3c('0x46')](handleError(_0x4a19e6,null));}; \ No newline at end of file +var _0x52c2=['findAll','rows','catch','show','params','rawAttributes','include','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','error','stack','send','index','map','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','SalesforceField','then','includeAll'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x52c2,0x1eb));var _0x252c=function(_0x376c87,_0x259f10){_0x376c87=_0x376c87-0x0;var _0x265832=_0x52c2[_0x376c87];return _0x265832;};'use strict';var emlformat=require(_0x252c('0x0'));var rimraf=require(_0x252c('0x1'));var zipdir=require(_0x252c('0x2'));var jsonpatch=require(_0x252c('0x3'));var rp=require(_0x252c('0x4'));var moment=require(_0x252c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x252c('0x6'));var util=require(_0x252c('0x7'));var path=require(_0x252c('0x8'));var sox=require(_0x252c('0x9'));var csv=require(_0x252c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x252c('0xb'));var _=require('lodash');var squel=require(_0x252c('0xc'));var crypto=require(_0x252c('0xd'));var jsforce=require(_0x252c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x252c('0xa'));var querystring=require(_0x252c('0xf'));var Papa=require('papaparse');var Redis=require(_0x252c('0x10'));var authService=require(_0x252c('0x11'));var qs=require(_0x252c('0x12'));var as=require(_0x252c('0x13'));var hardwareService=require(_0x252c('0x14'));var logger=require('../../config/logger')(_0x252c('0x15'));var utils=require(_0x252c('0x16'));var config=require(_0x252c('0x17'));var licenseUtil=require(_0x252c('0x18'));var db=require(_0x252c('0x19'))['db'];function respondWithStatusCode(_0x15e654,_0x41e705){_0x41e705=_0x41e705||0xcc;return function(_0x17f502){if(_0x17f502){return _0x15e654[_0x252c('0x1a')](_0x41e705);}return _0x15e654[_0x252c('0x1b')](_0x41e705)[_0x252c('0x1c')]();};}function respondWithResult(_0x2c67c2,_0x4db5cf){_0x4db5cf=_0x4db5cf||0xc8;return function(_0x3bb512){if(_0x3bb512){return _0x2c67c2[_0x252c('0x1b')](_0x4db5cf)['json'](_0x3bb512);}};}function respondWithFilteredResult(_0x46de58,_0x31692a){return function(_0x2fd6bd){if(_0x2fd6bd){var _0x10b70e=typeof _0x31692a[_0x252c('0x1d')]===_0x252c('0x1e')&&typeof _0x31692a[_0x252c('0x1f')]===_0x252c('0x1e');var _0x290053=_0x2fd6bd[_0x252c('0x20')];var _0x246009=_0x10b70e?0x0:_0x31692a[_0x252c('0x1d')];var _0x2a588c=_0x10b70e?_0x2fd6bd[_0x252c('0x20')]:_0x31692a[_0x252c('0x1d')]+_0x31692a[_0x252c('0x1f')];var _0x17f043;if(_0x2a588c>=_0x290053){_0x2a588c=_0x290053;_0x17f043=0xc8;}else{_0x17f043=0xce;}_0x46de58[_0x252c('0x1b')](_0x17f043);return _0x46de58[_0x252c('0x21')](_0x252c('0x22'),_0x246009+'-'+_0x2a588c+'/'+_0x290053)[_0x252c('0x23')](_0x2fd6bd);}return null;};}function patchUpdates(_0x30818c){return function(_0xaaebbd){try{jsonpatch[_0x252c('0x24')](_0xaaebbd,_0x30818c,!![]);}catch(_0x40ac1f){return BPromise[_0x252c('0x25')](_0x40ac1f);}return _0xaaebbd[_0x252c('0x26')]();};}function saveUpdates(_0x38ab5e,_0x3d6291){return function(_0x3b64d0){if(_0x3b64d0){return _0x3b64d0['update'](_0x38ab5e)['then'](function(_0x183663){return _0x183663;});}return null;};}function removeEntity(_0x57ee2b,_0x5178a8){return function(_0x28a21f){if(_0x28a21f){return _0x28a21f[_0x252c('0x27')]()['then'](function(){_0x57ee2b[_0x252c('0x1b')](0xcc)[_0x252c('0x1c')]();});}};}function handleEntityNotFound(_0xb026ac,_0x32274c){return function(_0x40be21){if(!_0x40be21){_0xb026ac[_0x252c('0x1a')](0x194);}return _0x40be21;};}function handleError(_0xa17e5e,_0x5e4ace){_0x5e4ace=_0x5e4ace||0x1f4;return function(_0x48a448){logger[_0x252c('0x28')](_0x48a448[_0x252c('0x29')]);if(_0x48a448['name']){delete _0x48a448['name'];}_0xa17e5e[_0x252c('0x1b')](_0x5e4ace)[_0x252c('0x2a')](_0x48a448);};}exports[_0x252c('0x2b')]=function(_0x211c19,_0x1e0169){var _0xd041d5={},_0x3194a0={},_0x5d7201={'count':0x0,'rows':[]};var _0x2e0c8d=_[_0x252c('0x2c')](db['SalesforceField']['rawAttributes'],function(_0x2a54fc){return{'name':_0x2a54fc[_0x252c('0x2d')],'type':_0x2a54fc[_0x252c('0x2e')]['key']};});_0x3194a0[_0x252c('0x2f')]=_['map'](_0x2e0c8d,_0x252c('0x30'));_0x3194a0[_0x252c('0x31')]=_[_0x252c('0x32')](_0x211c19[_0x252c('0x31')]);_0x3194a0[_0x252c('0x33')]=_['intersection'](_0x3194a0[_0x252c('0x2f')],_0x3194a0[_0x252c('0x31')]);_0xd041d5['attributes']=_[_0x252c('0x34')](_0x3194a0['model'],qs[_0x252c('0x35')](_0x211c19['query'][_0x252c('0x35')]));_0xd041d5[_0x252c('0x36')]=_0xd041d5[_0x252c('0x36')][_0x252c('0x37')]?_0xd041d5[_0x252c('0x36')]:_0x3194a0[_0x252c('0x2f')];if(!_0x211c19[_0x252c('0x31')][_0x252c('0x38')](_0x252c('0x39'))){_0xd041d5[_0x252c('0x1f')]=qs[_0x252c('0x1f')](_0x211c19[_0x252c('0x31')][_0x252c('0x1f')]);_0xd041d5['offset']=qs[_0x252c('0x1d')](_0x211c19[_0x252c('0x31')][_0x252c('0x1d')]);}_0xd041d5[_0x252c('0x3a')]=qs[_0x252c('0x3b')](_0x211c19[_0x252c('0x31')][_0x252c('0x3b')]);_0xd041d5['where']=qs[_0x252c('0x33')](_[_0x252c('0x3c')](_0x211c19[_0x252c('0x31')],_0x3194a0[_0x252c('0x33')]),_0x2e0c8d);if(_0x211c19[_0x252c('0x31')][_0x252c('0x3d')]){_0xd041d5['where']=_[_0x252c('0x3e')](_0xd041d5[_0x252c('0x3f')],{'$or':_[_0x252c('0x2c')](_0x2e0c8d,function(_0x4bba70){if(_0x4bba70[_0x252c('0x2e')]!==_0x252c('0x40')){var _0x1e7957={};_0x1e7957[_0x4bba70['name']]={'$like':'%'+_0x211c19[_0x252c('0x31')][_0x252c('0x3d')]+'%'};return _0x1e7957;}})});}_0xd041d5=_[_0x252c('0x3e')]({},_0xd041d5,_0x211c19[_0x252c('0x41')]);var _0x9db8c={'where':_0xd041d5[_0x252c('0x3f')]};return db[_0x252c('0x42')][_0x252c('0x20')](_0x9db8c)[_0x252c('0x43')](function(_0x274399){_0x5d7201[_0x252c('0x20')]=_0x274399;if(_0x211c19['query'][_0x252c('0x44')]){_0xd041d5['include']=[{'all':!![]}];}return db['SalesforceField'][_0x252c('0x45')](_0xd041d5);})[_0x252c('0x43')](function(_0x2e1d93){_0x5d7201[_0x252c('0x46')]=_0x2e1d93;return _0x5d7201;})[_0x252c('0x43')](respondWithFilteredResult(_0x1e0169,_0xd041d5))[_0x252c('0x47')](handleError(_0x1e0169,null));};exports[_0x252c('0x48')]=function(_0x496a4a,_0x5d4ea7){var _0x2502df={'raw':!![],'where':{'id':_0x496a4a[_0x252c('0x49')]['id']}},_0x748732={};_0x748732[_0x252c('0x2f')]=_[_0x252c('0x32')](db['SalesforceField'][_0x252c('0x4a')]);_0x748732['query']=_['keys'](_0x496a4a[_0x252c('0x31')]);_0x748732[_0x252c('0x33')]=_[_0x252c('0x34')](_0x748732[_0x252c('0x2f')],_0x748732[_0x252c('0x31')]);_0x2502df[_0x252c('0x36')]=_[_0x252c('0x34')](_0x748732[_0x252c('0x2f')],qs[_0x252c('0x35')](_0x496a4a[_0x252c('0x31')][_0x252c('0x35')]));_0x2502df[_0x252c('0x36')]=_0x2502df[_0x252c('0x36')][_0x252c('0x37')]?_0x2502df[_0x252c('0x36')]:_0x748732[_0x252c('0x2f')];if(_0x496a4a[_0x252c('0x31')][_0x252c('0x44')]){_0x2502df[_0x252c('0x4b')]=[{'all':!![]}];}_0x2502df=_[_0x252c('0x3e')]({},_0x2502df,_0x496a4a[_0x252c('0x41')]);return db[_0x252c('0x42')]['find'](_0x2502df)['then'](handleEntityNotFound(_0x5d4ea7,null))[_0x252c('0x43')](respondWithResult(_0x5d4ea7,null))[_0x252c('0x47')](handleError(_0x5d4ea7,null));};exports[_0x252c('0x4c')]=function(_0x2fb2ef,_0x263c85){return db[_0x252c('0x42')]['create'](_0x2fb2ef[_0x252c('0x4d')],{})[_0x252c('0x43')](respondWithResult(_0x263c85,0xc9))[_0x252c('0x47')](handleError(_0x263c85,null));};exports[_0x252c('0x4e')]=function(_0x294434,_0x52a845){if(_0x294434[_0x252c('0x4d')]['id']){delete _0x294434[_0x252c('0x4d')]['id'];}return db[_0x252c('0x42')][_0x252c('0x4f')]({'where':{'id':_0x294434[_0x252c('0x49')]['id']}})[_0x252c('0x43')](handleEntityNotFound(_0x52a845,null))['then'](saveUpdates(_0x294434[_0x252c('0x4d')],null))['then'](respondWithResult(_0x52a845,null))['catch'](handleError(_0x52a845,null));};exports[_0x252c('0x27')]=function(_0x4e3c98,_0x3f2961){return db[_0x252c('0x42')]['find']({'where':{'id':_0x4e3c98[_0x252c('0x49')]['id']}})[_0x252c('0x43')](handleEntityNotFound(_0x3f2961,null))[_0x252c('0x43')](removeEntity(_0x3f2961,null))[_0x252c('0x47')](handleError(_0x3f2961,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 187e2c7..0eb81ae 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 _0x45d0=['api','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x1a58b3,_0x2e191e){var _0xc153b3=function(_0x2fd92e){while(--_0x2fd92e){_0x1a58b3['push'](_0x1a58b3['shift']());}};_0xc153b3(++_0x2e191e);}(_0x45d0,0x193));var _0x045d=function(_0x5016c9,_0x51ad68){_0x5016c9=_0x5016c9-0x0;var _0x2cad2b=_0x45d0[_0x5016c9];return _0x2cad2b;};'use strict';var _=require(_0x045d('0x0'));var util=require('util');var logger=require(_0x045d('0x1'))(_0x045d('0x2'));var moment=require('moment');var BPromise=require(_0x045d('0x3'));var rp=require(_0x045d('0x4'));var fs=require('fs');var path=require(_0x045d('0x5'));var rimraf=require('rimraf');var config=require(_0x045d('0x6'));var attributes=require(_0x045d('0x7'));module[_0x045d('0x8')]=function(_0x2113fc,_0x3e0560){return _0x2113fc[_0x045d('0x9')](_0x045d('0xa'),attributes,{'tableName':_0x045d('0xb'),'paranoid':![],'indexes':[{'name':_0x045d('0xc'),'fields':[_0x045d('0xd'),_0x045d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc8=['rimraf','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','api','moment','bluebird','request-promise','path'];(function(_0x33ceeb,_0x58b863){var _0x5b6556=function(_0x23a6b1){while(--_0x23a6b1){_0x33ceeb['push'](_0x33ceeb['shift']());}};_0x5b6556(++_0x58b863);}(_0x7cc8,0xc7));var _0x87cc=function(_0xaa2ee0,_0x5ebbf9){_0xaa2ee0=_0xaa2ee0-0x0;var _0x5ba77f=_0x7cc8[_0xaa2ee0];return _0x5ba77f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x87cc('0x0'));var moment=require(_0x87cc('0x1'));var BPromise=require(_0x87cc('0x2'));var rp=require(_0x87cc('0x3'));var fs=require('fs');var path=require(_0x87cc('0x4'));var rimraf=require(_0x87cc('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x87cc('0x6')]=function(_0x2cac68,_0x579200){return _0x2cac68[_0x87cc('0x7')]('SalesforceField',attributes,{'tableName':_0x87cc('0x8'),'paranoid':![],'indexes':[{'name':_0x87cc('0x9'),'fields':[_0x87cc('0xa'),_0x87cc('0xb')],'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 1808368..8855273 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 _0x9d93=['result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info'];(function(_0x399b95,_0x4fafc8){var _0x3e3c12=function(_0x1d9ff6){while(--_0x1d9ff6){_0x399b95['push'](_0x399b95['shift']());}};_0x3e3c12(++_0x4fafc8);}(_0x9d93,0xc0));var _0x39d9=function(_0x26784a,_0x6c2717){_0x26784a=_0x26784a-0x0;var _0x53ffb6=_0x9d93[_0x26784a];return _0x53ffb6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39d9('0x0'));var BPromise=require(_0x39d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x39d9('0x3'));var logger=require(_0x39d9('0x4'))(_0x39d9('0x5'));var config=require(_0x39d9('0x6'));var jayson=require(_0x39d9('0x7'));var client=jayson[_0x39d9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10fe59,_0x3b54c3,_0x584b60){return new BPromise(function(_0x2fae1b,_0x4cd36a){return client['request'](_0x10fe59,_0x584b60)[_0x39d9('0x9')](function(_0x5a427f){logger['info'](_0x39d9('0xa'),_0x3b54c3,_0x39d9('0xb'));logger[_0x39d9('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x3b54c3,'request\x20sent',JSON['stringify'](_0x5a427f));if(_0x5a427f[_0x39d9('0xd')]){if(_0x5a427f[_0x39d9('0xd')][_0x39d9('0xe')]===0x1f4){logger[_0x39d9('0xd')](_0x39d9('0xa'),_0x3b54c3,_0x5a427f[_0x39d9('0xd')][_0x39d9('0xf')]);return _0x4cd36a(_0x5a427f[_0x39d9('0xd')][_0x39d9('0xf')]);}logger[_0x39d9('0xd')]('SalesforceField,\x20%s,\x20%s',_0x3b54c3,_0x5a427f[_0x39d9('0xd')][_0x39d9('0xf')]);return _0x2fae1b(_0x5a427f[_0x39d9('0xd')][_0x39d9('0xf')]);}else{logger[_0x39d9('0x10')](_0x39d9('0xa'),_0x3b54c3,_0x39d9('0xb'));_0x2fae1b(_0x5a427f[_0x39d9('0x11')]['message']);}})[_0x39d9('0x12')](function(_0x447172){logger[_0x39d9('0xd')](_0x39d9('0xa'),_0x3b54c3,_0x447172);_0x4cd36a(_0x447172);});});} \ No newline at end of file +var _0x7491=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57db6d,_0x246461){var _0x4ac77e=function(_0x4ce5e4){while(--_0x4ce5e4){_0x57db6d['push'](_0x57db6d['shift']());}};_0x4ac77e(++_0x246461);}(_0x7491,0x92));var _0x1749=function(_0x178972,_0x3ee1c3){_0x178972=_0x178972-0x0;var _0x199c0c=_0x7491[_0x178972];return _0x199c0c;};'use strict';var _=require(_0x1749('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1749('0x1'));var rs=require(_0x1749('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1749('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1749('0x4'))(_0x1749('0x5'));var config=require('../../config/environment');var jayson=require(_0x1749('0x6'));var client=jayson[_0x1749('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x240b73,_0x39b6d6,_0x5ed388){return new BPromise(function(_0x4f7186,_0x26f310){return client[_0x1749('0x8')](_0x240b73,_0x5ed388)[_0x1749('0x9')](function(_0x430277){logger[_0x1749('0xa')](_0x1749('0xb'),_0x39b6d6,_0x1749('0xc'));logger[_0x1749('0xd')](_0x1749('0xe'),_0x39b6d6,'request\x20sent',JSON[_0x1749('0xf')](_0x430277));if(_0x430277[_0x1749('0x10')]){if(_0x430277[_0x1749('0x10')][_0x1749('0x11')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x39b6d6,_0x430277['error'][_0x1749('0x12')]);return _0x26f310(_0x430277[_0x1749('0x10')][_0x1749('0x12')]);}logger[_0x1749('0x10')]('SalesforceField,\x20%s,\x20%s',_0x39b6d6,_0x430277[_0x1749('0x10')][_0x1749('0x12')]);return _0x4f7186(_0x430277[_0x1749('0x10')]['message']);}else{logger[_0x1749('0xa')]('SalesforceField,\x20%s,\x20%s',_0x39b6d6,_0x1749('0xc'));_0x4f7186(_0x430277['result'][_0x1749('0x12')]);}})[_0x1749('0x13')](function(_0x3c6ae8){logger[_0x1749('0x10')]('SalesforceField,\x20%s,\x20%s',_0x39b6d6,_0x3c6ae8);_0x26f310(_0x3c6ae8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f1aeeb7..5729810 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 _0x9c2c=['post','create','addConfiguration','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x25b298,_0x5d4fc6){var _0x2bc16c=function(_0x3516f7){while(--_0x3516f7){_0x25b298['push'](_0x25b298['shift']());}};_0x2bc16c(++_0x5d4fc6);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc9c2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc9c2('0x3'));var interaction=require(_0xc9c2('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xc9c2('0x5')]('/',auth['isAuthenticated'](),controller[_0xc9c2('0x6')]);router[_0xc9c2('0x5')](_0xc9c2('0x7'),auth[_0xc9c2('0x8')](),controller[_0xc9c2('0x9')]);router[_0xc9c2('0x5')](_0xc9c2('0xa'),auth[_0xc9c2('0x8')](),controller[_0xc9c2('0xb')]);router['get'](_0xc9c2('0xc'),auth['isAuthenticated'](),controller[_0xc9c2('0xd')]);router[_0xc9c2('0xe')]('/',auth[_0xc9c2('0x8')](),controller[_0xc9c2('0xf')]);router['post']('/:id/configurations',auth[_0xc9c2('0x8')](),controller[_0xc9c2('0x10')]);router['put'](_0xc9c2('0x7'),auth[_0xc9c2('0x8')](),controller[_0xc9c2('0x11')]);router[_0xc9c2('0x12')](_0xc9c2('0x7'),auth[_0xc9c2('0x8')](),controller[_0xc9c2('0x13')]);module[_0xc9c2('0x14')]=router; \ No newline at end of file +var _0x6545=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','exports','multer','path','Router'];(function(_0x14625a,_0x8c9ef0){var _0x2a6d5d=function(_0x193150){while(--_0x193150){_0x14625a['push'](_0x14625a['shift']());}};_0x2a6d5d(++_0x8c9ef0);}(_0x6545,0x75));var _0x5654=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6545[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5654('0x0'));var util=require('util');var path=require(_0x5654('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5654('0x2')]();var fs_extra=require(_0x5654('0x3'));var auth=require(_0x5654('0x4'));var interaction=require(_0x5654('0x5'));var config=require(_0x5654('0x6'));var controller=require(_0x5654('0x7'));router[_0x5654('0x8')]('/',auth[_0x5654('0x9')](),controller[_0x5654('0xa')]);router[_0x5654('0x8')](_0x5654('0xb'),auth[_0x5654('0x9')](),controller[_0x5654('0xc')]);router[_0x5654('0x8')](_0x5654('0xd'),auth[_0x5654('0x9')](),controller[_0x5654('0xe')]);router['get'](_0x5654('0xf'),auth['isAuthenticated'](),controller[_0x5654('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5654('0x11')]);router[_0x5654('0x12')](_0x5654('0xd'),auth['isAuthenticated'](),controller[_0x5654('0x13')]);router[_0x5654('0x14')](_0x5654('0xb'),auth[_0x5654('0x9')](),controller[_0x5654('0x15')]);router[_0x5654('0x16')](_0x5654('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x5654('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 00c99cd..5767a0b 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 _0x835b=['STRING'];(function(_0x3c73d1,_0x2c5b98){var _0x200bba=function(_0x23c557){while(--_0x23c557){_0x3c73d1['push'](_0x3c73d1['shift']());}};_0x200bba(++_0x2c5b98);}(_0x835b,0x11d));var _0xb835=function(_0x5aada8,_0x460a35){_0x5aada8=_0x5aada8-0x0;var _0xf5247e=_0x835b[_0x5aada8];return _0xf5247e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb835('0x0')]},'username':{'type':Sequelize[_0xb835('0x0')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb835('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4027=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4be738,_0xa90dd0){var _0x2b3c84=function(_0x9fa91c){while(--_0x9fa91c){_0x4be738['push'](_0x4be738['shift']());}};_0x2b3c84(++_0xa90dd0);}(_0x4027,0x72));var _0x7402=function(_0x5b8f7a,_0x21433c){_0x5b8f7a=_0x5b8f7a-0x0;var _0x555405=_0x4027[_0x5b8f7a];return _0x555405;};'use strict';var Sequelize=require(_0x7402('0x0'));module[_0x7402('0x1')]={'name':{'type':Sequelize[_0x7402('0x2')]},'description':{'type':Sequelize[_0x7402('0x2')]},'username':{'type':Sequelize[_0x7402('0x2')],'unique':_0x7402('0x3')},'password':{'type':Sequelize[_0x7402('0x2')]},'email':{'type':Sequelize[_0x7402('0x2')]},'remoteUri':{'type':Sequelize[_0x7402('0x2')],'unique':_0x7402('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5201a35..38f61d8 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 _0x8e5d=['order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','number','resolved_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','priority','sys_domain_path','rfc','expected_start','opened_at','group_list','reopened_time','resolved_at','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','urgency','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','password','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','label','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','test','statusCode','Wrong\x20credentials','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','limit','Content-Range','reject','save','update','then','error','stack','index','ServicenowAccount','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','getConfigurations','findOne','ServicenowConfiguration'];(function(_0x84fe32,_0xe5937c){var _0x1df670=function(_0x13f146){while(--_0x13f146){_0x84fe32['push'](_0x84fe32['shift']());}};_0x1df670(++_0xe5937c);}(_0x8e5d,0x119));var _0xd8e5=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x8e5d[_0x2b0bc2];return _0x56e5b9;};'use strict';var emlformat=require(_0xd8e5('0x0'));var rimraf=require(_0xd8e5('0x1'));var zipdir=require(_0xd8e5('0x2'));var jsonpatch=require(_0xd8e5('0x3'));var rp=require(_0xd8e5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8e5('0x5'));var util=require(_0xd8e5('0x6'));var path=require(_0xd8e5('0x7'));var sox=require(_0xd8e5('0x8'));var csv=require(_0xd8e5('0x9'));var ejs=require(_0xd8e5('0xa'));var fs=require('fs');var fs_extra=require(_0xd8e5('0xb'));var _=require(_0xd8e5('0xc'));var squel=require(_0xd8e5('0xd'));var crypto=require(_0xd8e5('0xe'));var jsforce=require(_0xd8e5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd8e5('0x9'));var querystring=require(_0xd8e5('0x10'));var Papa=require('papaparse');var Redis=require(_0xd8e5('0x11'));var authService=require(_0xd8e5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd8e5('0x13'));var hardwareService=require(_0xd8e5('0x14'));var logger=require(_0xd8e5('0x15'))(_0xd8e5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd8e5('0x17'));var db=require(_0xd8e5('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x24bde8,_0x3c6f30){_0x3c6f30=_0x3c6f30||0xcc;return function(_0x1b7773){if(_0x1b7773){return _0x24bde8[_0xd8e5('0x19')](_0x3c6f30);}return _0x24bde8['status'](_0x3c6f30)[_0xd8e5('0x1a')]();};}function respondWithResult(_0x4db899,_0x5736d3){_0x5736d3=_0x5736d3||0xc8;return function(_0x4d78c9){if(_0x4d78c9){return _0x4db899[_0xd8e5('0x1b')](_0x5736d3)[_0xd8e5('0x1c')](_0x4d78c9);}};}function respondWithFilteredResult(_0x3b4987,_0x3c16b0){return function(_0x10ce17){if(_0x10ce17){var _0x33d56c=typeof _0x3c16b0['offset']==='undefined'&&typeof _0x3c16b0['limit']===_0xd8e5('0x1d');var _0x5217cb=_0x10ce17['count'];var _0x4423dd=_0x33d56c?0x0:_0x3c16b0[_0xd8e5('0x1e')];var _0x2dad39=_0x33d56c?_0x10ce17[_0xd8e5('0x1f')]:_0x3c16b0[_0xd8e5('0x1e')]+_0x3c16b0[_0xd8e5('0x20')];var _0x45a006;if(_0x2dad39>=_0x5217cb){_0x2dad39=_0x5217cb;_0x45a006=0xc8;}else{_0x45a006=0xce;}_0x3b4987[_0xd8e5('0x1b')](_0x45a006);return _0x3b4987['set'](_0xd8e5('0x21'),_0x4423dd+'-'+_0x2dad39+'/'+_0x5217cb)['json'](_0x10ce17);}return null;};}function patchUpdates(_0x1529b2){return function(_0x3e256b){try{jsonpatch['apply'](_0x3e256b,_0x1529b2,!![]);}catch(_0x586a20){return BPromise[_0xd8e5('0x22')](_0x586a20);}return _0x3e256b[_0xd8e5('0x23')]();};}function saveUpdates(_0x29ac14,_0xf8baa9){return function(_0x2b5d61){if(_0x2b5d61){return _0x2b5d61[_0xd8e5('0x24')](_0x29ac14)[_0xd8e5('0x25')](function(_0x2b63ab){return _0x2b63ab;});}return null;};}function removeEntity(_0x1f0af2,_0x5c0297){return function(_0x2ef019){if(_0x2ef019){return _0x2ef019['destroy']()[_0xd8e5('0x25')](function(){_0x1f0af2[_0xd8e5('0x1b')](0xcc)[_0xd8e5('0x1a')]();});}};}function handleEntityNotFound(_0x5892cd,_0x2a6035){return function(_0x210775){if(!_0x210775){_0x5892cd[_0xd8e5('0x19')](0x194);}return _0x210775;};}function handleError(_0x48e532,_0x2c6d1a){_0x2c6d1a=_0x2c6d1a||0x1f4;return function(_0x63d75c){logger[_0xd8e5('0x26')](_0x63d75c[_0xd8e5('0x27')]);if(_0x63d75c['name']){delete _0x63d75c['name'];}_0x48e532[_0xd8e5('0x1b')](_0x2c6d1a)['send'](_0x63d75c);};}exports[_0xd8e5('0x28')]=function(_0x3b5127,_0x4c23e9){var _0x3a4a32={},_0xbf2af2={},_0xef0e96={'count':0x0,'rows':[]};var _0x189b96=_['map'](db[_0xd8e5('0x29')][_0xd8e5('0x2a')],function(_0x5072b2){return{'name':_0x5072b2['fieldName'],'type':_0x5072b2[_0xd8e5('0x2b')][_0xd8e5('0x2c')]};});_0xbf2af2[_0xd8e5('0x2d')]=_['map'](_0x189b96,_0xd8e5('0x2e'));_0xbf2af2[_0xd8e5('0x2f')]=_[_0xd8e5('0x30')](_0x3b5127[_0xd8e5('0x2f')]);_0xbf2af2[_0xd8e5('0x31')]=_[_0xd8e5('0x32')](_0xbf2af2[_0xd8e5('0x2d')],_0xbf2af2['query']);_0x3a4a32[_0xd8e5('0x33')]=_[_0xd8e5('0x32')](_0xbf2af2['model'],qs[_0xd8e5('0x34')](_0x3b5127[_0xd8e5('0x2f')][_0xd8e5('0x34')]));_0x3a4a32[_0xd8e5('0x33')]=_0x3a4a32[_0xd8e5('0x33')][_0xd8e5('0x35')]?_0x3a4a32[_0xd8e5('0x33')]:_0xbf2af2[_0xd8e5('0x2d')];if(!_0x3b5127['query'][_0xd8e5('0x36')]('nolimit')){_0x3a4a32[_0xd8e5('0x20')]=qs[_0xd8e5('0x20')](_0x3b5127[_0xd8e5('0x2f')]['limit']);_0x3a4a32['offset']=qs[_0xd8e5('0x1e')](_0x3b5127[_0xd8e5('0x2f')][_0xd8e5('0x1e')]);}_0x3a4a32['order']=qs['sort'](_0x3b5127[_0xd8e5('0x2f')][_0xd8e5('0x37')]);_0x3a4a32[_0xd8e5('0x38')]=qs[_0xd8e5('0x31')](_[_0xd8e5('0x39')](_0x3b5127[_0xd8e5('0x2f')],_0xbf2af2[_0xd8e5('0x31')]),_0x189b96);if(_0x3b5127[_0xd8e5('0x2f')]['filter']){_0x3a4a32[_0xd8e5('0x38')]=_['merge'](_0x3a4a32[_0xd8e5('0x38')],{'$or':_[_0xd8e5('0x3a')](_0x189b96,function(_0x329aab){if(_0x329aab[_0xd8e5('0x2b')]!==_0xd8e5('0x3b')){var _0x4869df={};_0x4869df[_0x329aab['name']]={'$like':'%'+_0x3b5127['query'][_0xd8e5('0x3c')]+'%'};return _0x4869df;}})});}_0x3a4a32=_[_0xd8e5('0x3d')]({},_0x3a4a32,_0x3b5127[_0xd8e5('0x3e')]);var _0x111fb1={'where':_0x3a4a32[_0xd8e5('0x38')]};return db[_0xd8e5('0x29')]['count'](_0x111fb1)[_0xd8e5('0x25')](function(_0x37d00c){_0xef0e96[_0xd8e5('0x1f')]=_0x37d00c;if(_0x3b5127[_0xd8e5('0x2f')][_0xd8e5('0x3f')]){_0x3a4a32[_0xd8e5('0x40')]=[{'all':!![]}];}return db[_0xd8e5('0x29')][_0xd8e5('0x41')](_0x3a4a32);})[_0xd8e5('0x25')](function(_0x2682b1){_0xef0e96['rows']=_0x2682b1;return _0xef0e96;})['then'](respondWithFilteredResult(_0x4c23e9,_0x3a4a32))[_0xd8e5('0x42')](handleError(_0x4c23e9,null));};exports[_0xd8e5('0x43')]=function(_0x495e9c,_0x2642c9){var _0x4ab1e3={'raw':![],'where':{'id':_0x495e9c[_0xd8e5('0x44')]['id']}},_0x11908c={};_0x11908c[_0xd8e5('0x2d')]=_[_0xd8e5('0x30')](db[_0xd8e5('0x29')][_0xd8e5('0x2a')]);_0x11908c['query']=_[_0xd8e5('0x30')](_0x495e9c[_0xd8e5('0x2f')]);_0x11908c['filters']=_[_0xd8e5('0x32')](_0x11908c[_0xd8e5('0x2d')],_0x11908c[_0xd8e5('0x2f')]);_0x4ab1e3[_0xd8e5('0x33')]=_['intersection'](_0x11908c['model'],qs[_0xd8e5('0x34')](_0x495e9c[_0xd8e5('0x2f')][_0xd8e5('0x34')]));_0x4ab1e3[_0xd8e5('0x33')]=_0x4ab1e3[_0xd8e5('0x33')][_0xd8e5('0x35')]?_0x4ab1e3[_0xd8e5('0x33')]:_0x11908c[_0xd8e5('0x2d')];if(_0x495e9c['query'][_0xd8e5('0x3f')]){_0x4ab1e3['include']=[{'all':!![]}];}_0x4ab1e3=_[_0xd8e5('0x3d')]({},_0x4ab1e3,_0x495e9c[_0xd8e5('0x3e')]);return db['ServicenowAccount']['find'](_0x4ab1e3)[_0xd8e5('0x25')](handleEntityNotFound(_0x2642c9,null))['then'](respondWithResult(_0x2642c9,null))[_0xd8e5('0x42')](handleError(_0x2642c9,null));};exports[_0xd8e5('0x45')]=function(_0x1c4ba2,_0x22e427){return db[_0xd8e5('0x29')]['create'](_0x1c4ba2[_0xd8e5('0x46')],{})[_0xd8e5('0x25')](respondWithResult(_0x22e427,0xc9))['catch'](handleError(_0x22e427,null));};exports[_0xd8e5('0x24')]=function(_0x5a5ff1,_0x6abf43){if(_0x5a5ff1[_0xd8e5('0x46')]['id']){delete _0x5a5ff1[_0xd8e5('0x46')]['id'];}return db[_0xd8e5('0x29')][_0xd8e5('0x47')]({'where':{'id':_0x5a5ff1[_0xd8e5('0x44')]['id']}})[_0xd8e5('0x25')](handleEntityNotFound(_0x6abf43,null))[_0xd8e5('0x25')](saveUpdates(_0x5a5ff1['body'],null))[_0xd8e5('0x25')](respondWithResult(_0x6abf43,null))[_0xd8e5('0x42')](handleError(_0x6abf43,null));};exports['destroy']=function(_0x49835e,_0x5cd7ab){return db[_0xd8e5('0x29')][_0xd8e5('0x47')]({'where':{'id':_0x49835e[_0xd8e5('0x44')]['id']}})[_0xd8e5('0x25')](handleEntityNotFound(_0x5cd7ab,null))[_0xd8e5('0x25')](removeEntity(_0x5cd7ab,null))['catch'](handleError(_0x5cd7ab,null));};exports[_0xd8e5('0x48')]=function(_0x502c87,_0x51617d,_0x40c3df){var _0x25d972={};var _0x2f9126={};var _0x99c4cb;var _0x38b647;return db[_0xd8e5('0x29')][_0xd8e5('0x49')]({'where':{'id':_0x502c87['params']['id']}})['then'](handleEntityNotFound(_0x51617d,null))[_0xd8e5('0x25')](function(_0x5d1268){if(_0x5d1268){_0x99c4cb=_0x5d1268;_0x2f9126[_0xd8e5('0x2d')]=_[_0xd8e5('0x30')](db[_0xd8e5('0x4a')][_0xd8e5('0x2a')]);_0x2f9126['query']=_[_0xd8e5('0x30')](_0x502c87[_0xd8e5('0x2f')]);_0x2f9126['filters']=_[_0xd8e5('0x32')](_0x2f9126['model'],_0x2f9126[_0xd8e5('0x2f')]);_0x25d972[_0xd8e5('0x33')]=_[_0xd8e5('0x32')](_0x2f9126[_0xd8e5('0x2d')],qs['fields'](_0x502c87['query'][_0xd8e5('0x34')]));_0x25d972[_0xd8e5('0x33')]=_0x25d972[_0xd8e5('0x33')]['length']?_0x25d972[_0xd8e5('0x33')]:_0x2f9126['model'];_0x25d972[_0xd8e5('0x4b')]=qs[_0xd8e5('0x37')](_0x502c87[_0xd8e5('0x2f')][_0xd8e5('0x37')]);_0x25d972[_0xd8e5('0x38')]=qs[_0xd8e5('0x31')](_[_0xd8e5('0x39')](_0x502c87[_0xd8e5('0x2f')],_0x2f9126[_0xd8e5('0x31')]));if(_0x502c87[_0xd8e5('0x2f')][_0xd8e5('0x3c')]){_0x25d972['where']=_[_0xd8e5('0x3d')](_0x25d972['where'],{'$or':_[_0xd8e5('0x3a')](_0x25d972[_0xd8e5('0x33')],function(_0x2215cd){var _0x3c3941={};_0x3c3941[_0x2215cd]={'$like':'%'+_0x502c87[_0xd8e5('0x2f')][_0xd8e5('0x3c')]+'%'};return _0x3c3941;})});}_0x25d972=_[_0xd8e5('0x3d')]({},_0x25d972,_0x502c87[_0xd8e5('0x3e')]);return _0x99c4cb[_0xd8e5('0x48')](_0x25d972);}})['then'](function(_0x134d63){if(_0x134d63){_0x38b647=_0x134d63[_0xd8e5('0x35')];if(!_0x502c87[_0xd8e5('0x2f')][_0xd8e5('0x36')](_0xd8e5('0x4c'))){_0x25d972[_0xd8e5('0x20')]=qs['limit'](_0x502c87[_0xd8e5('0x2f')][_0xd8e5('0x20')]);_0x25d972[_0xd8e5('0x1e')]=qs[_0xd8e5('0x1e')](_0x502c87[_0xd8e5('0x2f')]['offset']);}return _0x99c4cb[_0xd8e5('0x48')](_0x25d972);}})[_0xd8e5('0x25')](function(_0x5472a8){if(_0x5472a8){return _0x5472a8?{'count':_0x38b647,'rows':_0x5472a8}:null;}})[_0xd8e5('0x25')](respondWithResult(_0x51617d,null))[_0xd8e5('0x42')](handleError(_0x51617d,null));};exports[_0xd8e5('0x4d')]=function(_0x322187,_0xdd1332,_0x58bf11){if(_0x322187[_0xd8e5('0x46')]['id']){delete _0x322187[_0xd8e5('0x46')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x322187[_0xd8e5('0x44')]['id']}})[_0xd8e5('0x25')](handleEntityNotFound(_0xdd1332,null))['then'](function(_0x54f926){if(_0x54f926){_0x322187[_0xd8e5('0x46')][_0xd8e5('0x4e')]=_0x54f926['id'];_0x322187[_0xd8e5('0x46')][_0xd8e5('0x4f')]=integrations[_0xd8e5('0x50')](_0x322187['body']['channel'],_0x322187[_0xd8e5('0x46')][_0xd8e5('0x2b')]);_0x322187[_0xd8e5('0x46')][_0xd8e5('0x51')]=integrations[_0xd8e5('0x52')](_0x322187[_0xd8e5('0x46')][_0xd8e5('0x53')],_0x322187['body']['type']);return db[_0xd8e5('0x4a')][_0xd8e5('0x45')](_0x322187[_0xd8e5('0x46')],{'include':[{'model':db[_0xd8e5('0x54')],'as':_0xd8e5('0x4f')},{'model':db[_0xd8e5('0x54')],'as':_0xd8e5('0x51')}]});}return null;})[_0xd8e5('0x25')](respondWithResult(_0xdd1332,null))['catch'](handleError(_0xdd1332,null));};exports[_0xd8e5('0x55')]=function(_0x35b718,_0x1275f3,_0x2c29ff){var _0x491cca=[_0xd8e5('0x56'),_0xd8e5('0x57'),_0xd8e5('0x58'),_0xd8e5('0x59'),_0xd8e5('0x5a'),_0xd8e5('0x5b'),_0xd8e5('0x5c'),'severity',_0xd8e5('0x5d')];var _0x160148=[_0xd8e5('0x5e'),_0xd8e5('0x56'),_0xd8e5('0x5f'),_0xd8e5('0x60'),_0xd8e5('0x61'),'sys_updated_on',_0xd8e5('0x62'),_0xd8e5('0x57'),'approval_history',_0xd8e5('0x63'),_0xd8e5('0x64'),'sys_updated_by',_0xd8e5('0x65'),'user_input',_0xd8e5('0x66'),_0xd8e5('0x67'),_0xd8e5('0x68'),_0xd8e5('0x69'),_0xd8e5('0x58'),_0xd8e5('0x4b'),_0xd8e5('0x6a'),_0xd8e5('0x6b'),_0xd8e5('0x6c'),'delivery_plan',_0xd8e5('0x6d'),_0xd8e5('0x6e'),'work_notes_list','business_service',_0xd8e5('0x6f'),_0xd8e5('0x70'),_0xd8e5('0x71'),'time_worked',_0xd8e5('0x72'),_0xd8e5('0x73'),'business_duration',_0xd8e5('0x74'),'work_end',_0xd8e5('0x75'),_0xd8e5('0x76'),'caller_id','approval_set',_0xd8e5('0x59'),_0xd8e5('0x77'),_0xd8e5('0x78'),'close_code',_0xd8e5('0x79'),_0xd8e5('0x7a'),_0xd8e5('0x7b'),'assignment_group',_0xd8e5('0x7c'),_0xd8e5('0x7d'),_0xd8e5('0x7e'),'calendar_duration',_0xd8e5('0x5b'),_0xd8e5('0x7f'),_0xd8e5('0x80'),_0xd8e5('0x81'),_0xd8e5('0x82'),_0xd8e5('0x83'),_0xd8e5('0x84'),'contact_type','reopened_by','incident_state',_0xd8e5('0x85'),'problem_id',_0xd8e5('0x86'),_0xd8e5('0x87'),_0xd8e5('0x88'),'assigned_to','severity',_0xd8e5('0x89'),_0xd8e5('0x8a'),_0xd8e5('0x8b'),_0xd8e5('0x8c'),_0xd8e5('0x8d'),_0xd8e5('0x8e'),_0xd8e5('0x8f'),_0xd8e5('0x90'),'escalation',_0xd8e5('0x91'),_0xd8e5('0x92'),_0xd8e5('0x93'),'category'];var _0x209e11='';var _0x47977e='';var _0x3e635d=[];var _0x20fe5a='';var _0x43ecf5='';var _0x4df08f=[];var _0x20438b='';var _0x520032='';var _0x114f19={};var _0x24b1e7='';return db[_0xd8e5('0x29')][_0xd8e5('0x49')]({'where':{'id':_0x35b718[_0xd8e5('0x44')]['id']},'attributes':['id','username',_0xd8e5('0x94'),'email','remoteUri','serverUrl']})[_0xd8e5('0x25')](handleEntityNotFound(_0x1275f3,null))[_0xd8e5('0x25')](function(_0x497f35){if(_0x497f35){_0x24b1e7=_0x497f35['remoteUri'];var _0x4cfc20=_0x24b1e7[_0xd8e5('0x95')](-0x1);if(_0x4cfc20==='/'){_0x24b1e7=_0x24b1e7['substring'](0x0,_0x24b1e7[_0xd8e5('0x96')](_0x4cfc20));}_0x520032=util['format'](_0xd8e5('0x97'),_0x24b1e7);_0x20438b=util[_0xd8e5('0x98')](_0xd8e5('0x99'),_0x24b1e7);_0x114f19={'user':_0x497f35[_0xd8e5('0x9a')],'pass':_0x497f35['password']};var _0x6fce1b={'method':_0xd8e5('0x9b'),'uri':_0x520032+_0xd8e5('0x9c'),'auth':_0x114f19,'json':!![]};return rp(_0x6fce1b);}})[_0xd8e5('0x25')](function(_0x14f4ec){if(_0x14f4ec[_0xd8e5('0x9d')][_0xd8e5('0x35')]>0x0){_0x209e11=_0x14f4ec[_0xd8e5('0x9d')];}console[_0xd8e5('0x9e')](_0xd8e5('0x9f'),_0x209e11);_0x4df08f=[];_0x47977e=Object[_0xd8e5('0xa0')]([],_0x209e11);_['remove'](_0x47977e,function(_0xdf730a){return!_0x491cca['includes'](_0xdf730a[_0xd8e5('0x2e')]);});_0x47977e[_0xd8e5('0xa1')](function(_0x52a459){var _0x1022aa=createFieldObject(_0x20438b,_0x114f19,_0x52a459['internalType'],_0x52a459[_0xd8e5('0x2e')],_0x52a459[_0xd8e5('0xa2')],![]);_0x4df08f['push'](_0x1022aa);});return Promise[_0xd8e5('0xa3')](_0x4df08f);})[_0xd8e5('0x25')](function(_0x4bc9bd){_0x3e635d=_0x4bc9bd;_0x20fe5a=Object[_0xd8e5('0xa0')]([],_0x209e11);console['log']('TCL:\x20_object',_0x209e11);_['remove'](_0x20fe5a,function(_0x1d4ef5){return _0x160148[_0xd8e5('0xa4')](_0x1d4ef5[_0xd8e5('0x2e')]);});console['log'](_0xd8e5('0xa5'),_0x20fe5a);_0x4df08f=[];_0x20fe5a['forEach'](function(_0x398462){var _0x3d9037=createFieldObject(_0x20438b,_0x114f19,_0x398462[_0xd8e5('0xa6')],_0x398462['name'],_0x398462[_0xd8e5('0xa2')],!![]);_0x4df08f['push'](_0x3d9037);});return Promise[_0xd8e5('0xa3')](_0x4df08f);})['then'](function(_0x28c7fb){_0x43ecf5=_0x28c7fb;var _0x4bfc8f=_0x3e635d[_0xd8e5('0xa7')](_0x43ecf5);return{'count':_0x4bfc8f[_0xd8e5('0x35')],'rows':_0x4bfc8f};})[_0xd8e5('0x25')](respondWithResult(_0x1275f3,null))['catch'](function(_0x2816c5){console[_0xd8e5('0x9e')]('ServiceNow\x20error:\x20'+_0x2816c5);var _0x573a02=_0x35b718[_0xd8e5('0x2f')][_0xd8e5('0xa8')]?0x1f4:_0x2816c5[_0xd8e5('0xa9')]||0x1f4;logger[_0xd8e5('0x26')](_0x2816c5[_0xd8e5('0x27')]);delete _0x2816c5[_0xd8e5('0x2e')];if(_0x573a02===0x191){_0x573a02=0x190;}_0x1275f3[_0xd8e5('0x1b')](_0x573a02)['send'](_0x35b718[_0xd8e5('0x2f')]['test']?{'message':_0xd8e5('0xaa'),'statusCode':_0x2816c5[_0xd8e5('0xa9')]}:_0x2816c5);});};function createFieldObject(_0x42287b,_0x3adfb9,_0x2b4976,_0x349cb9,_0x5e8c3c,_0x22eb2c){return new Promise(function(_0x4bbdde,_0x2a97df){var _0x2954a7={'id':_0x349cb9,'name':_0x5e8c3c,'custom':_0x22eb2c};if(_0x2b4976==='boolean'){_0x2954a7[_0xd8e5('0x3e')]=[{'name':_0xd8e5('0xab'),'value':_0xd8e5('0xac')},{'name':'False','value':_0xd8e5('0xad')}];_0x4bbdde(_0x2954a7);}else{var _0x430612={'method':'GET','uri':_0x42287b+_0xd8e5('0xae')+_0x349cb9,'auth':_0x3adfb9,'json':!![]};return rp(_0x430612)[_0xd8e5('0x25')](function(_0x33a538){var _0x352430=[];if(_0x33a538[_0xd8e5('0x9d')]['length']>0x0){_0x33a538[_0xd8e5('0x9d')]['forEach'](function(_0xe050c5){if(_0xe050c5[_0xd8e5('0xaf')]==='false'){var _0x146636={'name':_0xe050c5[_0xd8e5('0xa2')],'value':_0xe050c5[_0xd8e5('0xb0')]};_0x352430[_0xd8e5('0xb1')](_0x146636);}});}_0x2954a7['options']=_0x352430;if(_0x2954a7[_0xd8e5('0x3e')][_0xd8e5('0x35')]>0x0){_0x4bbdde(_0x2954a7);}else{if(_0x22eb2c==![]){_0x4bbdde();}else{_0x4bbdde(_0x2954a7);}}});}});} \ No newline at end of file +var _0xb93b=['offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','ServicenowAccount','includeAll','findAll','rows','catch','show','params','include','create','body','find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','close_code','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','due_date','sys_mod_count','sys_tags','upon_approval','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','inactive','false','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json'];(function(_0x2178e6,_0x342a47){var _0x55075f=function(_0x4e5534){while(--_0x4e5534){_0x2178e6['push'](_0x2178e6['shift']());}};_0x55075f(++_0x342a47);}(_0xb93b,0x9c));var _0xbb93=function(_0x50ceed,_0x2cf670){_0x50ceed=_0x50ceed-0x0;var _0x9034e2=_0xb93b[_0x50ceed];return _0x9034e2;};'use strict';var emlformat=require(_0xbb93('0x0'));var rimraf=require(_0xbb93('0x1'));var zipdir=require(_0xbb93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb93('0x3'));var moment=require(_0xbb93('0x4'));var BPromise=require(_0xbb93('0x5'));var Mustache=require(_0xbb93('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbb93('0x7'));var ejs=require(_0xbb93('0x8'));var fs=require('fs');var fs_extra=require(_0xbb93('0x9'));var _=require(_0xbb93('0xa'));var squel=require(_0xbb93('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb93('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb93('0xd'));var Papa=require(_0xbb93('0xe'));var Redis=require(_0xbb93('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb93('0x10'));var hardwareService=require(_0xbb93('0x11'));var logger=require(_0xbb93('0x12'))(_0xbb93('0x13'));var utils=require(_0xbb93('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbb93('0x15'));var db=require(_0xbb93('0x16'))['db'];var integrations=require(_0xbb93('0x17'));function respondWithStatusCode(_0x265087,_0x426c76){_0x426c76=_0x426c76||0xcc;return function(_0x48a43e){if(_0x48a43e){return _0x265087[_0xbb93('0x18')](_0x426c76);}return _0x265087[_0xbb93('0x19')](_0x426c76)[_0xbb93('0x1a')]();};}function respondWithResult(_0x1d74d0,_0x22d737){_0x22d737=_0x22d737||0xc8;return function(_0x4eea16){if(_0x4eea16){return _0x1d74d0[_0xbb93('0x19')](_0x22d737)[_0xbb93('0x1b')](_0x4eea16);}};}function respondWithFilteredResult(_0x1f2f35,_0x58c629){return function(_0x271de6){if(_0x271de6){var _0x1a8a00=typeof _0x58c629[_0xbb93('0x1c')]===_0xbb93('0x1d')&&typeof _0x58c629[_0xbb93('0x1e')]===_0xbb93('0x1d');var _0x11b09e=_0x271de6[_0xbb93('0x1f')];var _0x1afda7=_0x1a8a00?0x0:_0x58c629['offset'];var _0x1dde16=_0x1a8a00?_0x271de6['count']:_0x58c629[_0xbb93('0x1c')]+_0x58c629[_0xbb93('0x1e')];var _0x36311b;if(_0x1dde16>=_0x11b09e){_0x1dde16=_0x11b09e;_0x36311b=0xc8;}else{_0x36311b=0xce;}_0x1f2f35[_0xbb93('0x19')](_0x36311b);return _0x1f2f35[_0xbb93('0x20')](_0xbb93('0x21'),_0x1afda7+'-'+_0x1dde16+'/'+_0x11b09e)[_0xbb93('0x1b')](_0x271de6);}return null;};}function patchUpdates(_0x266ddf){return function(_0x40c01d){try{jsonpatch['apply'](_0x40c01d,_0x266ddf,!![]);}catch(_0x3ffcad){return BPromise[_0xbb93('0x22')](_0x3ffcad);}return _0x40c01d[_0xbb93('0x23')]();};}function saveUpdates(_0x4adcda,_0x4bc7ce){return function(_0x1d39d2){if(_0x1d39d2){return _0x1d39d2[_0xbb93('0x24')](_0x4adcda)[_0xbb93('0x25')](function(_0x232c40){return _0x232c40;});}return null;};}function removeEntity(_0x29dca2,_0x29a25e){return function(_0x163151){if(_0x163151){return _0x163151[_0xbb93('0x26')]()[_0xbb93('0x25')](function(){_0x29dca2[_0xbb93('0x19')](0xcc)[_0xbb93('0x1a')]();});}};}function handleEntityNotFound(_0x52912d,_0x310ec6){return function(_0x2887a2){if(!_0x2887a2){_0x52912d[_0xbb93('0x18')](0x194);}return _0x2887a2;};}function handleError(_0x43f06d,_0x2a9d7e){_0x2a9d7e=_0x2a9d7e||0x1f4;return function(_0x2d4a2b){logger[_0xbb93('0x27')](_0x2d4a2b[_0xbb93('0x28')]);if(_0x2d4a2b[_0xbb93('0x29')]){delete _0x2d4a2b['name'];}_0x43f06d[_0xbb93('0x19')](_0x2a9d7e)['send'](_0x2d4a2b);};}exports[_0xbb93('0x2a')]=function(_0x31fb92,_0x82518c){var _0x5385ca={},_0x5df80c={},_0x16a313={'count':0x0,'rows':[]};var _0x237bb4=_[_0xbb93('0x2b')](db['ServicenowAccount'][_0xbb93('0x2c')],function(_0xc97011){return{'name':_0xc97011['fieldName'],'type':_0xc97011[_0xbb93('0x2d')]['key']};});_0x5df80c[_0xbb93('0x2e')]=_[_0xbb93('0x2b')](_0x237bb4,_0xbb93('0x29'));_0x5df80c[_0xbb93('0x2f')]=_[_0xbb93('0x30')](_0x31fb92[_0xbb93('0x2f')]);_0x5df80c[_0xbb93('0x31')]=_[_0xbb93('0x32')](_0x5df80c[_0xbb93('0x2e')],_0x5df80c[_0xbb93('0x2f')]);_0x5385ca['attributes']=_['intersection'](_0x5df80c[_0xbb93('0x2e')],qs[_0xbb93('0x33')](_0x31fb92[_0xbb93('0x2f')][_0xbb93('0x33')]));_0x5385ca[_0xbb93('0x34')]=_0x5385ca[_0xbb93('0x34')][_0xbb93('0x35')]?_0x5385ca['attributes']:_0x5df80c[_0xbb93('0x2e')];if(!_0x31fb92['query']['hasOwnProperty'](_0xbb93('0x36'))){_0x5385ca['limit']=qs['limit'](_0x31fb92['query'][_0xbb93('0x1e')]);_0x5385ca[_0xbb93('0x1c')]=qs['offset'](_0x31fb92[_0xbb93('0x2f')][_0xbb93('0x1c')]);}_0x5385ca[_0xbb93('0x37')]=qs[_0xbb93('0x38')](_0x31fb92[_0xbb93('0x2f')]['sort']);_0x5385ca[_0xbb93('0x39')]=qs[_0xbb93('0x31')](_[_0xbb93('0x3a')](_0x31fb92[_0xbb93('0x2f')],_0x5df80c['filters']),_0x237bb4);if(_0x31fb92[_0xbb93('0x2f')]['filter']){_0x5385ca[_0xbb93('0x39')]=_['merge'](_0x5385ca[_0xbb93('0x39')],{'$or':_[_0xbb93('0x2b')](_0x237bb4,function(_0x3e14dd){if(_0x3e14dd['type']!==_0xbb93('0x3b')){var _0x52b105={};_0x52b105[_0x3e14dd[_0xbb93('0x29')]]={'$like':'%'+_0x31fb92[_0xbb93('0x2f')][_0xbb93('0x3c')]+'%'};return _0x52b105;}})});}_0x5385ca=_[_0xbb93('0x3d')]({},_0x5385ca,_0x31fb92[_0xbb93('0x3e')]);var _0x27424d={'where':_0x5385ca['where']};return db[_0xbb93('0x3f')][_0xbb93('0x1f')](_0x27424d)['then'](function(_0x25d290){_0x16a313[_0xbb93('0x1f')]=_0x25d290;if(_0x31fb92[_0xbb93('0x2f')][_0xbb93('0x40')]){_0x5385ca['include']=[{'all':!![]}];}return db[_0xbb93('0x3f')][_0xbb93('0x41')](_0x5385ca);})['then'](function(_0x35a82d){_0x16a313[_0xbb93('0x42')]=_0x35a82d;return _0x16a313;})[_0xbb93('0x25')](respondWithFilteredResult(_0x82518c,_0x5385ca))[_0xbb93('0x43')](handleError(_0x82518c,null));};exports[_0xbb93('0x44')]=function(_0x3ba8c7,_0x1ef872){var _0x38ebfb={'raw':![],'where':{'id':_0x3ba8c7[_0xbb93('0x45')]['id']}},_0x2168d8={};_0x2168d8[_0xbb93('0x2e')]=_[_0xbb93('0x30')](db[_0xbb93('0x3f')][_0xbb93('0x2c')]);_0x2168d8[_0xbb93('0x2f')]=_[_0xbb93('0x30')](_0x3ba8c7[_0xbb93('0x2f')]);_0x2168d8[_0xbb93('0x31')]=_[_0xbb93('0x32')](_0x2168d8['model'],_0x2168d8[_0xbb93('0x2f')]);_0x38ebfb['attributes']=_[_0xbb93('0x32')](_0x2168d8[_0xbb93('0x2e')],qs[_0xbb93('0x33')](_0x3ba8c7['query'][_0xbb93('0x33')]));_0x38ebfb['attributes']=_0x38ebfb[_0xbb93('0x34')][_0xbb93('0x35')]?_0x38ebfb[_0xbb93('0x34')]:_0x2168d8['model'];if(_0x3ba8c7[_0xbb93('0x2f')]['includeAll']){_0x38ebfb[_0xbb93('0x46')]=[{'all':!![]}];}_0x38ebfb=_['merge']({},_0x38ebfb,_0x3ba8c7[_0xbb93('0x3e')]);return db[_0xbb93('0x3f')]['find'](_0x38ebfb)[_0xbb93('0x25')](handleEntityNotFound(_0x1ef872,null))[_0xbb93('0x25')](respondWithResult(_0x1ef872,null))[_0xbb93('0x43')](handleError(_0x1ef872,null));};exports['create']=function(_0x2f3542,_0x2488f2){return db[_0xbb93('0x3f')][_0xbb93('0x47')](_0x2f3542[_0xbb93('0x48')],{})['then'](respondWithResult(_0x2488f2,0xc9))[_0xbb93('0x43')](handleError(_0x2488f2,null));};exports[_0xbb93('0x24')]=function(_0x15d47c,_0x190cf4){if(_0x15d47c['body']['id']){delete _0x15d47c[_0xbb93('0x48')]['id'];}return db[_0xbb93('0x3f')][_0xbb93('0x49')]({'where':{'id':_0x15d47c[_0xbb93('0x45')]['id']}})[_0xbb93('0x25')](handleEntityNotFound(_0x190cf4,null))[_0xbb93('0x25')](saveUpdates(_0x15d47c['body'],null))[_0xbb93('0x25')](respondWithResult(_0x190cf4,null))['catch'](handleError(_0x190cf4,null));};exports[_0xbb93('0x26')]=function(_0x44bf4d,_0x165ede){return db[_0xbb93('0x3f')][_0xbb93('0x49')]({'where':{'id':_0x44bf4d[_0xbb93('0x45')]['id']}})[_0xbb93('0x25')](handleEntityNotFound(_0x165ede,null))[_0xbb93('0x25')](removeEntity(_0x165ede,null))[_0xbb93('0x43')](handleError(_0x165ede,null));};exports[_0xbb93('0x4a')]=function(_0x5ca4ca,_0x5bddd3,_0xec81a7){var _0x22430e={};var _0x125396={};var _0x3da4f1;var _0x212a73;return db[_0xbb93('0x3f')][_0xbb93('0x4b')]({'where':{'id':_0x5ca4ca[_0xbb93('0x45')]['id']}})[_0xbb93('0x25')](handleEntityNotFound(_0x5bddd3,null))[_0xbb93('0x25')](function(_0xfbcd04){if(_0xfbcd04){_0x3da4f1=_0xfbcd04;_0x125396[_0xbb93('0x2e')]=_['keys'](db[_0xbb93('0x4c')]['rawAttributes']);_0x125396['query']=_[_0xbb93('0x30')](_0x5ca4ca['query']);_0x125396[_0xbb93('0x31')]=_[_0xbb93('0x32')](_0x125396[_0xbb93('0x2e')],_0x125396[_0xbb93('0x2f')]);_0x22430e[_0xbb93('0x34')]=_[_0xbb93('0x32')](_0x125396[_0xbb93('0x2e')],qs[_0xbb93('0x33')](_0x5ca4ca[_0xbb93('0x2f')][_0xbb93('0x33')]));_0x22430e[_0xbb93('0x34')]=_0x22430e[_0xbb93('0x34')]['length']?_0x22430e[_0xbb93('0x34')]:_0x125396[_0xbb93('0x2e')];_0x22430e[_0xbb93('0x37')]=qs[_0xbb93('0x38')](_0x5ca4ca[_0xbb93('0x2f')]['sort']);_0x22430e[_0xbb93('0x39')]=qs[_0xbb93('0x31')](_[_0xbb93('0x3a')](_0x5ca4ca[_0xbb93('0x2f')],_0x125396[_0xbb93('0x31')]));if(_0x5ca4ca[_0xbb93('0x2f')]['filter']){_0x22430e[_0xbb93('0x39')]=_['merge'](_0x22430e[_0xbb93('0x39')],{'$or':_[_0xbb93('0x2b')](_0x22430e[_0xbb93('0x34')],function(_0x2ffbf5){var _0x56f81f={};_0x56f81f[_0x2ffbf5]={'$like':'%'+_0x5ca4ca[_0xbb93('0x2f')][_0xbb93('0x3c')]+'%'};return _0x56f81f;})});}_0x22430e=_[_0xbb93('0x3d')]({},_0x22430e,_0x5ca4ca[_0xbb93('0x3e')]);return _0x3da4f1['getConfigurations'](_0x22430e);}})[_0xbb93('0x25')](function(_0x2cf2db){if(_0x2cf2db){_0x212a73=_0x2cf2db[_0xbb93('0x35')];if(!_0x5ca4ca[_0xbb93('0x2f')][_0xbb93('0x4d')](_0xbb93('0x36'))){_0x22430e[_0xbb93('0x1e')]=qs[_0xbb93('0x1e')](_0x5ca4ca[_0xbb93('0x2f')][_0xbb93('0x1e')]);_0x22430e['offset']=qs[_0xbb93('0x1c')](_0x5ca4ca['query'][_0xbb93('0x1c')]);}return _0x3da4f1[_0xbb93('0x4a')](_0x22430e);}})[_0xbb93('0x25')](function(_0x2485db){if(_0x2485db){return _0x2485db?{'count':_0x212a73,'rows':_0x2485db}:null;}})[_0xbb93('0x25')](respondWithResult(_0x5bddd3,null))['catch'](handleError(_0x5bddd3,null));};exports[_0xbb93('0x4e')]=function(_0x527dca,_0x9213ed,_0x143b0a){if(_0x527dca['body']['id']){delete _0x527dca[_0xbb93('0x48')]['id'];}return db[_0xbb93('0x3f')][_0xbb93('0x4b')]({'where':{'id':_0x527dca[_0xbb93('0x45')]['id']}})['then'](handleEntityNotFound(_0x9213ed,null))[_0xbb93('0x25')](function(_0x4d14e8){if(_0x4d14e8){_0x527dca[_0xbb93('0x48')][_0xbb93('0x4f')]=_0x4d14e8['id'];_0x527dca[_0xbb93('0x48')][_0xbb93('0x50')]=integrations[_0xbb93('0x51')](_0x527dca[_0xbb93('0x48')][_0xbb93('0x52')],_0x527dca['body'][_0xbb93('0x2d')]);_0x527dca['body'][_0xbb93('0x53')]=integrations[_0xbb93('0x54')](_0x527dca[_0xbb93('0x48')][_0xbb93('0x52')],_0x527dca['body'][_0xbb93('0x2d')]);return db[_0xbb93('0x4c')][_0xbb93('0x47')](_0x527dca['body'],{'include':[{'model':db['ServicenowField'],'as':_0xbb93('0x50')},{'model':db[_0xbb93('0x55')],'as':_0xbb93('0x53')}]});}return null;})[_0xbb93('0x25')](respondWithResult(_0x9213ed,null))[_0xbb93('0x43')](handleError(_0x9213ed,null));};exports[_0xbb93('0x56')]=function(_0xea88,_0x3ad72c,_0x53d7b3){var _0x53e07c=[_0xbb93('0x57'),'hold_reason',_0xbb93('0x58'),'subcategory','close_code',_0xbb93('0x59'),'incident_state',_0xbb93('0x5a'),_0xbb93('0x5b')];var _0x4e7a3e=['parent',_0xbb93('0x57'),_0xbb93('0x5c'),_0xbb93('0x5d'),_0xbb93('0x5e'),_0xbb93('0x5f'),_0xbb93('0x60'),_0xbb93('0x61'),_0xbb93('0x62'),_0xbb93('0x63'),_0xbb93('0x64'),_0xbb93('0x65'),_0xbb93('0x66'),_0xbb93('0x67'),_0xbb93('0x68'),'sys_domain',_0xbb93('0x69'),'sys_created_by',_0xbb93('0x58'),_0xbb93('0x37'),_0xbb93('0x6a'),_0xbb93('0x6b'),'cmdb_ci',_0xbb93('0x6c'),_0xbb93('0x6d'),_0xbb93('0x6e'),_0xbb93('0x6f'),_0xbb93('0x70'),_0xbb93('0x71'),'sys_domain_path',_0xbb93('0x72'),_0xbb93('0x73'),_0xbb93('0x74'),_0xbb93('0x75'),_0xbb93('0x76'),_0xbb93('0x77'),_0xbb93('0x78'),_0xbb93('0x79'),_0xbb93('0x7a'),_0xbb93('0x7b'),_0xbb93('0x7c'),_0xbb93('0x7d'),_0xbb93('0x7e'),_0xbb93('0x7f'),_0xbb93('0x80'),'correlation_display','delivery_task','work_start',_0xbb93('0x81'),_0xbb93('0x82'),'additional_assignee_list',_0xbb93('0x83'),_0xbb93('0x84'),_0xbb93('0x59'),_0xbb93('0x85'),_0xbb93('0x86'),'closed_by',_0xbb93('0x87'),_0xbb93('0x88'),_0xbb93('0x89'),'contact_type','reopened_by',_0xbb93('0x8a'),_0xbb93('0x8b'),_0xbb93('0x8c'),_0xbb93('0x8d'),_0xbb93('0x8e'),_0xbb93('0x8f'),_0xbb93('0x90'),_0xbb93('0x5a'),'comments',_0xbb93('0x91'),_0xbb93('0x92'),'comments_and_work_notes',_0xbb93('0x93'),_0xbb93('0x94'),'reopen_count',_0xbb93('0x95'),'escalation',_0xbb93('0x96'),'correlation_id',_0xbb93('0x97'),_0xbb93('0x5b')];var _0x3c09e2='';var _0x1c1fb4='';var _0x169eb7=[];var _0x1a8851='';var _0x373b91='';var _0x57519a=[];var _0x232e15='';var _0x5717c5='';var _0x692a38={};var _0x47161d='';return db['ServicenowAccount'][_0xbb93('0x4b')]({'where':{'id':_0xea88[_0xbb93('0x45')]['id']},'attributes':['id',_0xbb93('0x98'),'password',_0xbb93('0x99'),_0xbb93('0x9a'),_0xbb93('0x9b')]})['then'](handleEntityNotFound(_0x3ad72c,null))[_0xbb93('0x25')](function(_0x43402f){if(_0x43402f){_0x47161d=_0x43402f[_0xbb93('0x9a')];var _0x34e22b=_0x47161d[_0xbb93('0x9c')](-0x1);if(_0x34e22b==='/'){_0x47161d=_0x47161d[_0xbb93('0x9d')](0x0,_0x47161d[_0xbb93('0x9e')](_0x34e22b));}_0x5717c5=util[_0xbb93('0x9f')](_0xbb93('0xa0'),_0x47161d);_0x232e15=util[_0xbb93('0x9f')](_0xbb93('0xa1'),_0x47161d);_0x692a38={'user':_0x43402f[_0xbb93('0x98')],'pass':_0x43402f['password']};var _0x286d9e={'method':_0xbb93('0xa2'),'uri':_0x5717c5+'incident?sysparm_display_value=all','auth':_0x692a38,'json':!![]};return rp(_0x286d9e);}})[_0xbb93('0x25')](function(_0x2490c1){if(_0x2490c1[_0xbb93('0xa3')][_0xbb93('0x35')]>0x0){_0x3c09e2=_0x2490c1['result'];}console[_0xbb93('0xa4')](_0xbb93('0xa5'),_0x3c09e2);_0x57519a=[];_0x1c1fb4=Object[_0xbb93('0xa6')]([],_0x3c09e2);_[_0xbb93('0xa7')](_0x1c1fb4,function(_0x4513fa){return!_0x53e07c[_0xbb93('0xa8')](_0x4513fa[_0xbb93('0x29')]);});_0x1c1fb4[_0xbb93('0xa9')](function(_0x366d96){var _0x14853b=createFieldObject(_0x232e15,_0x692a38,_0x366d96[_0xbb93('0xaa')],_0x366d96[_0xbb93('0x29')],_0x366d96[_0xbb93('0xab')],![]);_0x57519a[_0xbb93('0xac')](_0x14853b);});return Promise[_0xbb93('0xad')](_0x57519a);})[_0xbb93('0x25')](function(_0x23af58){_0x169eb7=_0x23af58;_0x1a8851=Object['assign']([],_0x3c09e2);console[_0xbb93('0xa4')](_0xbb93('0xae'),_0x3c09e2);_['remove'](_0x1a8851,function(_0xd0cabd){return _0x4e7a3e['includes'](_0xd0cabd[_0xbb93('0x29')]);});console[_0xbb93('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1a8851);_0x57519a=[];_0x1a8851[_0xbb93('0xa9')](function(_0x41ec64){var _0x2de56e=createFieldObject(_0x232e15,_0x692a38,_0x41ec64[_0xbb93('0xaa')],_0x41ec64['name'],_0x41ec64[_0xbb93('0xab')],!![]);_0x57519a[_0xbb93('0xac')](_0x2de56e);});return Promise[_0xbb93('0xad')](_0x57519a);})[_0xbb93('0x25')](function(_0x4d057d){_0x373b91=_0x4d057d;var _0x3c582f=_0x169eb7[_0xbb93('0xaf')](_0x373b91);return{'count':_0x3c582f[_0xbb93('0x35')],'rows':_0x3c582f};})['then'](respondWithResult(_0x3ad72c,null))[_0xbb93('0x43')](function(_0x2148c0){console[_0xbb93('0xa4')](_0xbb93('0xb0')+_0x2148c0);var _0x6472a2=_0xea88[_0xbb93('0x2f')][_0xbb93('0xb1')]?0x1f4:_0x2148c0[_0xbb93('0xb2')]||0x1f4;logger['error'](_0x2148c0['stack']);delete _0x2148c0[_0xbb93('0x29')];if(_0x6472a2===0x191){_0x6472a2=0x190;}_0x3ad72c['status'](_0x6472a2)['send'](_0xea88[_0xbb93('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2148c0[_0xbb93('0xb2')]}:_0x2148c0);});};function createFieldObject(_0x4b9cd1,_0x2e59ef,_0x3ee731,_0x50b695,_0x3226e9,_0x3b05c9){return new Promise(function(_0x73b4b3,_0x1f980a){var _0x3010d4={'id':_0x50b695,'name':_0x3226e9,'custom':_0x3b05c9};if(_0x3ee731===_0xbb93('0xb3')){_0x3010d4[_0xbb93('0x3e')]=[{'name':_0xbb93('0xb4'),'value':_0xbb93('0xb5')},{'name':'False','value':'false'}];_0x73b4b3(_0x3010d4);}else{var _0x441223={'method':_0xbb93('0xa2'),'uri':_0x4b9cd1+'sys_choice?sysparm_query=name=incident^element='+_0x50b695,'auth':_0x2e59ef,'json':!![]};return rp(_0x441223)[_0xbb93('0x25')](function(_0x24193a){var _0xdd960e=[];if(_0x24193a['result'][_0xbb93('0x35')]>0x0){_0x24193a[_0xbb93('0xa3')][_0xbb93('0xa9')](function(_0x93a311){if(_0x93a311[_0xbb93('0xb6')]===_0xbb93('0xb7')){var _0x283047={'name':_0x93a311[_0xbb93('0xab')],'value':_0x93a311['value']};_0xdd960e[_0xbb93('0xac')](_0x283047);}});}_0x3010d4[_0xbb93('0x3e')]=_0xdd960e;if(_0x3010d4[_0xbb93('0x3e')]['length']>0x0){_0x73b4b3(_0x3010d4);}else{if(_0x3b05c9==![]){_0x73b4b3();}else{_0x73b4b3(_0x3010d4);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6f7e420..3aad9d4 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x326f,0xd1));var _0xf326=function(_0x3cced9,_0x761591){_0x3cced9=_0x3cced9-0x0;var _0x5700e1=_0x326f[_0x3cced9];return _0x5700e1;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));var integrations=require(_0xf326('0x9'));module[_0xf326('0xa')]=function(_0x4c2249,_0x3c254d){return _0x4c2249[_0xf326('0xb')](_0xf326('0xc'),attributes,{'tableName':_0xf326('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x1684a6,_0x515bb4){var _0x5aa422=function(_0x5a52b7){while(--_0x5a52b7){_0x1684a6['push'](_0x1684a6['shift']());}};_0x5aa422(++_0x515bb4);}(_0x8958,0x93));var _0x8895=function(_0x21065c,_0x23839c){_0x21065c=_0x21065c-0x0;var _0x3500c0=_0x8958[_0x21065c];return _0x3500c0;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index cc3efe7..b66c3eb 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 _0x2a25=['ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','ShowServicenowAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x2a25,0x89));var _0x52a2=function(_0x37d38a,_0x88dfe7){_0x37d38a=_0x37d38a-0x0;var _0x15e5b4=_0x2a25[_0x37d38a];return _0x15e5b4;};'use strict';var _=require(_0x52a2('0x0'));var util=require(_0x52a2('0x1'));var moment=require(_0x52a2('0x2'));var BPromise=require(_0x52a2('0x3'));var rs=require(_0x52a2('0x4'));var fs=require('fs');var Redis=require(_0x52a2('0x5'));var db=require(_0x52a2('0x6'))['db'];var utils=require(_0x52a2('0x7'));var logger=require('../../config/logger')(_0x52a2('0x8'));var config=require(_0x52a2('0x9'));var jayson=require(_0x52a2('0xa'));var client=jayson[_0x52a2('0xb')][_0x52a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58d607,_0x20369b,_0x10e1fe){return new BPromise(function(_0x500149,_0x41c75b){return client[_0x52a2('0xd')](_0x58d607,_0x10e1fe)['then'](function(_0x261460){logger[_0x52a2('0xe')](_0x52a2('0xf'),_0x20369b,'request\x20sent');logger[_0x52a2('0x10')](_0x52a2('0x11'),_0x20369b,_0x52a2('0x12'),JSON[_0x52a2('0x13')](_0x261460));if(_0x261460[_0x52a2('0x14')]){if(_0x261460[_0x52a2('0x14')][_0x52a2('0x15')]===0x1f4){logger[_0x52a2('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x20369b,_0x261460[_0x52a2('0x14')][_0x52a2('0x16')]);return _0x41c75b(_0x261460[_0x52a2('0x14')][_0x52a2('0x16')]);}logger['error'](_0x52a2('0xf'),_0x20369b,_0x261460[_0x52a2('0x14')]['message']);return _0x500149(_0x261460[_0x52a2('0x14')][_0x52a2('0x16')]);}else{logger[_0x52a2('0xe')](_0x52a2('0xf'),_0x20369b,_0x52a2('0x12'));_0x500149(_0x261460[_0x52a2('0x17')][_0x52a2('0x16')]);}})[_0x52a2('0x18')](function(_0x19110c){logger['error'](_0x52a2('0xf'),_0x20369b,_0x19110c);_0x41c75b(_0x19110c);});});}exports[_0x52a2('0x19')]=function(_0xad0737){var _0x433ad8=this;return new Promise(function(_0x3e91c8,_0x1923dc){return db[_0x52a2('0x1a')][_0x52a2('0x1b')]({'raw':_0xad0737['options']?_0xad0737[_0x52a2('0x1c')][_0x52a2('0x1d')]===undefined?!![]:![]:!![],'where':_0xad0737['options']?_0xad0737[_0x52a2('0x1c')][_0x52a2('0x1e')]||null:null,'attributes':_0xad0737[_0x52a2('0x1c')]?_0xad0737[_0x52a2('0x1c')][_0x52a2('0x1f')]||null:null,'limit':_0xad0737[_0x52a2('0x1c')]?_0xad0737[_0x52a2('0x1c')]['limit']||null:null,'include':_0xad0737[_0x52a2('0x1c')]?_0xad0737[_0x52a2('0x1c')][_0x52a2('0x20')]?_[_0x52a2('0x21')](_0xad0737[_0x52a2('0x1c')][_0x52a2('0x20')],function(_0x1e215b){return{'model':db[_0x1e215b[_0x52a2('0x22')]],'as':_0x1e215b['as'],'attributes':_0x1e215b['attributes'],'include':_0x1e215b[_0x52a2('0x20')]?_[_0x52a2('0x21')](_0x1e215b[_0x52a2('0x20')],function(_0x24cb72){return{'model':db[_0x24cb72[_0x52a2('0x22')]],'as':_0x24cb72['as'],'attributes':_0x24cb72[_0x52a2('0x1f')],'include':_0x24cb72[_0x52a2('0x20')]?_[_0x52a2('0x21')](_0x24cb72[_0x52a2('0x20')],function(_0x572a07){return{'model':db[_0x572a07[_0x52a2('0x22')]],'as':_0x572a07['as'],'attributes':_0x572a07['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x514dc0){logger['info'](_0x52a2('0x19'),_0xad0737);logger['debug'](_0x52a2('0x19'),_0xad0737,JSON[_0x52a2('0x13')](_0x514dc0));_0x3e91c8(_0x514dc0);})['catch'](function(_0x152ebe){logger[_0x52a2('0x14')](_0x52a2('0x19'),_0x152ebe[_0x52a2('0x16')],_0xad0737);_0x1923dc(_0x433ad8[_0x52a2('0x14')](0x1f4,_0x152ebe[_0x52a2('0x16')]));});});};exports[_0x52a2('0x23')]=function(_0x2c0fbc){var _0x456603=this;return new Promise(function(_0x73a3d6,_0xc9cb8d){return db['ServicenowAccount'][_0x52a2('0x24')]({'raw':_0x2c0fbc[_0x52a2('0x1c')]?_0x2c0fbc[_0x52a2('0x1c')][_0x52a2('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c0fbc['options']?_0x2c0fbc[_0x52a2('0x1c')]['where']||null:null,'attributes':_0x2c0fbc[_0x52a2('0x1c')]?_0x2c0fbc[_0x52a2('0x1c')]['attributes']||null:null,'include':_0x2c0fbc['options']?_0x2c0fbc[_0x52a2('0x1c')][_0x52a2('0x20')]?_[_0x52a2('0x21')](_0x2c0fbc[_0x52a2('0x1c')][_0x52a2('0x20')],function(_0x54f926){return{'model':db[_0x54f926[_0x52a2('0x22')]],'as':_0x54f926['as'],'attributes':_0x54f926[_0x52a2('0x1f')],'include':_0x54f926[_0x52a2('0x20')]?_[_0x52a2('0x21')](_0x54f926[_0x52a2('0x20')],function(_0xe99a97){return{'model':db[_0xe99a97[_0x52a2('0x22')]],'as':_0xe99a97['as'],'attributes':_0xe99a97[_0x52a2('0x1f')],'include':_0xe99a97[_0x52a2('0x20')]?_[_0x52a2('0x21')](_0xe99a97[_0x52a2('0x20')],function(_0x2f35b8){return{'model':db[_0x2f35b8[_0x52a2('0x22')]],'as':_0x2f35b8['as'],'attributes':_0x2f35b8[_0x52a2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x52a2('0x25')](function(_0x440d18){logger['info'](_0x52a2('0x23'),_0x2c0fbc);logger['debug'](_0x52a2('0x23'),_0x2c0fbc,JSON[_0x52a2('0x13')](_0x440d18));_0x73a3d6(_0x440d18);})[_0x52a2('0x18')](function(_0x4bb03a){logger['error'](_0x52a2('0x23'),_0x4bb03a[_0x52a2('0x16')],_0x2c0fbc);_0xc9cb8d(_0x456603['error'](0x1f4,_0x4bb03a[_0x52a2('0x16')]));});});}; \ No newline at end of file +var _0xfaad=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ServicenowAccount','raw','options','where','attributes','include','model','map','GetServicenowAccount','catch','ShowServicenowAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x310048,_0x173985){var _0x21a076=function(_0x43fe66){while(--_0x43fe66){_0x310048['push'](_0x310048['shift']());}};_0x21a076(++_0x173985);}(_0xfaad,0x1a0));var _0xdfaa=function(_0xa5404c,_0x44ca10){_0xa5404c=_0xa5404c-0x0;var _0x565f52=_0xfaad[_0xa5404c];return _0x565f52;};'use strict';var _=require('lodash');var util=require(_0xdfaa('0x0'));var moment=require('moment');var BPromise=require(_0xdfaa('0x1'));var rs=require(_0xdfaa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfaa('0x3'))['db'];var utils=require(_0xdfaa('0x4'));var logger=require(_0xdfaa('0x5'))('rpc');var config=require(_0xdfaa('0x6'));var jayson=require(_0xdfaa('0x7'));var client=jayson['client'][_0xdfaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1540a9,_0x3c3aef,_0x5cabdf){return new BPromise(function(_0x322242,_0x4c38b4){return client[_0xdfaa('0x9')](_0x1540a9,_0x5cabdf)[_0xdfaa('0xa')](function(_0x5007a0){logger['info'](_0xdfaa('0xb'),_0x3c3aef,_0xdfaa('0xc'));logger[_0xdfaa('0xd')](_0xdfaa('0xe'),_0x3c3aef,_0xdfaa('0xc'),JSON[_0xdfaa('0xf')](_0x5007a0));if(_0x5007a0[_0xdfaa('0x10')]){if(_0x5007a0[_0xdfaa('0x10')][_0xdfaa('0x11')]===0x1f4){logger[_0xdfaa('0x10')](_0xdfaa('0xb'),_0x3c3aef,_0x5007a0['error'][_0xdfaa('0x12')]);return _0x4c38b4(_0x5007a0[_0xdfaa('0x10')][_0xdfaa('0x12')]);}logger[_0xdfaa('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x3c3aef,_0x5007a0['error']['message']);return _0x322242(_0x5007a0[_0xdfaa('0x10')]['message']);}else{logger[_0xdfaa('0x13')](_0xdfaa('0xb'),_0x3c3aef,_0xdfaa('0xc'));_0x322242(_0x5007a0[_0xdfaa('0x14')][_0xdfaa('0x12')]);}})['catch'](function(_0x56d13c){logger[_0xdfaa('0x10')](_0xdfaa('0xb'),_0x3c3aef,_0x56d13c);_0x4c38b4(_0x56d13c);});});}exports['GetServicenowAccount']=function(_0x33ace7){var _0x3420c5=this;return new Promise(function(_0x3b6527,_0x250aef){return db[_0xdfaa('0x15')]['findAll']({'raw':_0x33ace7['options']?_0x33ace7['options'][_0xdfaa('0x16')]===undefined?!![]:![]:!![],'where':_0x33ace7[_0xdfaa('0x17')]?_0x33ace7[_0xdfaa('0x17')][_0xdfaa('0x18')]||null:null,'attributes':_0x33ace7[_0xdfaa('0x17')]?_0x33ace7[_0xdfaa('0x17')][_0xdfaa('0x19')]||null:null,'limit':_0x33ace7['options']?_0x33ace7[_0xdfaa('0x17')]['limit']||null:null,'include':_0x33ace7[_0xdfaa('0x17')]?_0x33ace7[_0xdfaa('0x17')]['include']?_['map'](_0x33ace7['options'][_0xdfaa('0x1a')],function(_0x444a93){return{'model':db[_0x444a93[_0xdfaa('0x1b')]],'as':_0x444a93['as'],'attributes':_0x444a93[_0xdfaa('0x19')],'include':_0x444a93[_0xdfaa('0x1a')]?_[_0xdfaa('0x1c')](_0x444a93[_0xdfaa('0x1a')],function(_0x323e6b){return{'model':db[_0x323e6b[_0xdfaa('0x1b')]],'as':_0x323e6b['as'],'attributes':_0x323e6b[_0xdfaa('0x19')],'include':_0x323e6b[_0xdfaa('0x1a')]?_['map'](_0x323e6b[_0xdfaa('0x1a')],function(_0x353c00){return{'model':db[_0x353c00[_0xdfaa('0x1b')]],'as':_0x353c00['as'],'attributes':_0x353c00['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x490b76){logger[_0xdfaa('0x13')](_0xdfaa('0x1d'),_0x33ace7);logger[_0xdfaa('0xd')](_0xdfaa('0x1d'),_0x33ace7,JSON[_0xdfaa('0xf')](_0x490b76));_0x3b6527(_0x490b76);})[_0xdfaa('0x1e')](function(_0x259525){logger[_0xdfaa('0x10')](_0xdfaa('0x1d'),_0x259525['message'],_0x33ace7);_0x250aef(_0x3420c5[_0xdfaa('0x10')](0x1f4,_0x259525[_0xdfaa('0x12')]));});});};exports[_0xdfaa('0x1f')]=function(_0x10bb05){var _0x3abe6b=this;return new Promise(function(_0x4c914d,_0x38b853){return db['ServicenowAccount'][_0xdfaa('0x20')]({'raw':_0x10bb05['options']?_0x10bb05[_0xdfaa('0x17')][_0xdfaa('0x16')]===undefined?!![]:![]:!![],'where':_0x10bb05[_0xdfaa('0x17')]?_0x10bb05[_0xdfaa('0x17')][_0xdfaa('0x18')]||null:null,'attributes':_0x10bb05[_0xdfaa('0x17')]?_0x10bb05[_0xdfaa('0x17')]['attributes']||null:null,'include':_0x10bb05[_0xdfaa('0x17')]?_0x10bb05[_0xdfaa('0x17')]['include']?_[_0xdfaa('0x1c')](_0x10bb05[_0xdfaa('0x17')][_0xdfaa('0x1a')],function(_0x5e023d){return{'model':db[_0x5e023d[_0xdfaa('0x1b')]],'as':_0x5e023d['as'],'attributes':_0x5e023d['attributes'],'include':_0x5e023d[_0xdfaa('0x1a')]?_[_0xdfaa('0x1c')](_0x5e023d[_0xdfaa('0x1a')],function(_0x5122c0){return{'model':db[_0x5122c0[_0xdfaa('0x1b')]],'as':_0x5122c0['as'],'attributes':_0x5122c0[_0xdfaa('0x19')],'include':_0x5122c0[_0xdfaa('0x1a')]?_['map'](_0x5122c0[_0xdfaa('0x1a')],function(_0x131607){return{'model':db[_0x131607['model']],'as':_0x131607['as'],'attributes':_0x131607['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfaa('0xa')](function(_0x2804aa){logger[_0xdfaa('0x13')](_0xdfaa('0x1f'),_0x10bb05);logger[_0xdfaa('0xd')](_0xdfaa('0x1f'),_0x10bb05,JSON[_0xdfaa('0xf')](_0x2804aa));_0x4c914d(_0x2804aa);})[_0xdfaa('0x1e')](function(_0x16e617){logger['error'](_0xdfaa('0x1f'),_0x16e617['message'],_0x10bb05);_0x38b853(_0x3abe6b[_0xdfaa('0x10')](0x1f4,_0x16e617[_0xdfaa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1ed1a42..35c1486 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 _0xc9a5=['show','/:id/fields','isAuthenticated','getFields','/:id/subjects','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xc9a5,0x1da));var _0x5c9a=function(_0x3a592f,_0x1a9441){_0x3a592f=_0x3a592f-0x0;var _0x28d6f8=_0xc9a5[_0x3a592f];return _0x28d6f8;};'use strict';var multer=require(_0x5c9a('0x0'));var util=require(_0x5c9a('0x1'));var path=require(_0x5c9a('0x2'));var timeout=require(_0x5c9a('0x3'));var express=require('express');var router=express[_0x5c9a('0x4')]();var fs_extra=require(_0x5c9a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c9a('0x6'));var controller=require(_0x5c9a('0x7'));router[_0x5c9a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c9a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5c9a('0x9')]);router[_0x5c9a('0x8')](_0x5c9a('0xa'),auth[_0x5c9a('0xb')](),controller[_0x5c9a('0xc')]);router[_0x5c9a('0x8')](_0x5c9a('0xd'),auth[_0x5c9a('0xb')](),controller['getSubjects']);router[_0x5c9a('0x8')]('/:id/descriptions',auth[_0x5c9a('0xb')](),controller['getDescriptions']);router[_0x5c9a('0xe')]('/',auth[_0x5c9a('0xb')](),controller[_0x5c9a('0xf')]);router[_0x5c9a('0x10')](_0x5c9a('0x11'),auth[_0x5c9a('0xb')](),controller[_0x5c9a('0x12')]);router['delete'](_0x5c9a('0x11'),auth[_0x5c9a('0xb')](),controller[_0x5c9a('0x13')]);module[_0x5c9a('0x14')]=router; \ No newline at end of file +var _0x2ae1=['isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2ae1,0xc9));var _0x12ae=function(_0x247149,_0x577dac){_0x247149=_0x247149-0x0;var _0x2d90e8=_0x2ae1[_0x247149];return _0x2d90e8;};'use strict';var multer=require(_0x12ae('0x0'));var util=require(_0x12ae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x12ae('0x2')]();var fs_extra=require(_0x12ae('0x3'));var auth=require(_0x12ae('0x4'));var interaction=require(_0x12ae('0x5'));var config=require('../../config/environment');var controller=require(_0x12ae('0x6'));router[_0x12ae('0x7')]('/',auth[_0x12ae('0x8')](),controller[_0x12ae('0x9')]);router['get']('/:id',auth[_0x12ae('0x8')](),controller[_0x12ae('0xa')]);router['get'](_0x12ae('0xb'),auth[_0x12ae('0x8')](),controller['getFields']);router[_0x12ae('0x7')](_0x12ae('0xc'),auth[_0x12ae('0x8')](),controller[_0x12ae('0xd')]);router[_0x12ae('0x7')]('/:id/descriptions',auth[_0x12ae('0x8')](),controller[_0x12ae('0xe')]);router['post']('/',auth[_0x12ae('0x8')](),controller['create']);router[_0x12ae('0xf')]('/:id',auth[_0x12ae('0x8')](),controller[_0x12ae('0x10')]);router[_0x12ae('0x11')]('/:id',auth[_0x12ae('0x8')](),controller[_0x12ae('0x12')]);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 12c446c..a6e9526 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 _0xbd35=['sequelize','STRING'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xbd35,0x19a));var _0x5bd3=function(_0x48ce59,_0x2b0620){_0x48ce59=_0x48ce59-0x0;var _0x32d4a1=_0xbd35[_0x48ce59];return _0x32d4a1;};'use strict';var Sequelize=require(_0x5bd3('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bd3('0x1')]},'description':{'type':Sequelize[_0x5bd3('0x1')]}}; \ No newline at end of file +var _0xac62=['STRING','exports'];(function(_0x5fddc0,_0x5e12a6){var _0x3c61bd=function(_0x15c7da){while(--_0x15c7da){_0x5fddc0['push'](_0x5fddc0['shift']());}};_0x3c61bd(++_0x5e12a6);}(_0xac62,0xed));var _0x2ac6=function(_0x44d48d,_0xf539fd){_0x44d48d=_0x44d48d-0x0;var _0x2b6985=_0xac62[_0x44d48d];return _0x2b6985;};'use strict';var Sequelize=require('sequelize');module[_0x2ac6('0x0')]={'name':{'type':Sequelize[_0x2ac6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8938a95..5cfdd4c 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 _0x0b53=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','catch','body','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0b53,0x170));var _0x30b5=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x0b53[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0x30b5('0x0'));var rimraf=require(_0x30b5('0x1'));var zipdir=require(_0x30b5('0x2'));var jsonpatch=require(_0x30b5('0x3'));var rp=require(_0x30b5('0x4'));var moment=require(_0x30b5('0x5'));var BPromise=require(_0x30b5('0x6'));var Mustache=require(_0x30b5('0x7'));var util=require(_0x30b5('0x8'));var path=require(_0x30b5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30b5('0xa'));var fs=require('fs');var fs_extra=require(_0x30b5('0xb'));var _=require(_0x30b5('0xc'));var squel=require(_0x30b5('0xd'));var crypto=require(_0x30b5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x30b5('0xf'));var toCsv=require(_0x30b5('0x10'));var querystring=require(_0x30b5('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30b5('0x12'));var hardwareService=require(_0x30b5('0x13'));var logger=require(_0x30b5('0x14'))(_0x30b5('0x15'));var utils=require('../../config/utils');var config=require(_0x30b5('0x16'));var licenseUtil=require(_0x30b5('0x17'));var db=require(_0x30b5('0x18'))['db'];function respondWithStatusCode(_0x132530,_0x49a871){_0x49a871=_0x49a871||0xcc;return function(_0x1c852d){if(_0x1c852d){return _0x132530[_0x30b5('0x19')](_0x49a871);}return _0x132530[_0x30b5('0x1a')](_0x49a871)[_0x30b5('0x1b')]();};}function respondWithResult(_0x537649,_0x48abc3){_0x48abc3=_0x48abc3||0xc8;return function(_0x2fdef1){if(_0x2fdef1){return _0x537649[_0x30b5('0x1a')](_0x48abc3)['json'](_0x2fdef1);}};}function respondWithFilteredResult(_0xba304a,_0x5b8bbd){return function(_0x9df82b){if(_0x9df82b){var _0x2b6008=typeof _0x5b8bbd['offset']===_0x30b5('0x1c')&&typeof _0x5b8bbd[_0x30b5('0x1d')]===_0x30b5('0x1c');var _0x56b6b3=_0x9df82b['count'];var _0x1f8d3c=_0x2b6008?0x0:_0x5b8bbd[_0x30b5('0x1e')];var _0x396815=_0x2b6008?_0x9df82b[_0x30b5('0x1f')]:_0x5b8bbd[_0x30b5('0x1e')]+_0x5b8bbd[_0x30b5('0x1d')];var _0x5c6c8f;if(_0x396815>=_0x56b6b3){_0x396815=_0x56b6b3;_0x5c6c8f=0xc8;}else{_0x5c6c8f=0xce;}_0xba304a[_0x30b5('0x1a')](_0x5c6c8f);return _0xba304a[_0x30b5('0x20')](_0x30b5('0x21'),_0x1f8d3c+'-'+_0x396815+'/'+_0x56b6b3)[_0x30b5('0x22')](_0x9df82b);}return null;};}function patchUpdates(_0x44c31b){return function(_0x484cd6){try{jsonpatch[_0x30b5('0x23')](_0x484cd6,_0x44c31b,!![]);}catch(_0x13a290){return BPromise[_0x30b5('0x24')](_0x13a290);}return _0x484cd6[_0x30b5('0x25')]();};}function saveUpdates(_0x23b10d,_0x47ddc4){return function(_0x50492f){if(_0x50492f){return _0x50492f[_0x30b5('0x26')](_0x23b10d)[_0x30b5('0x27')](function(_0x3aebc5){return _0x3aebc5;});}return null;};}function removeEntity(_0xa956a8,_0x1a4b03){return function(_0xbd65f7){if(_0xbd65f7){return _0xbd65f7[_0x30b5('0x28')]()[_0x30b5('0x27')](function(){_0xa956a8['status'](0xcc)[_0x30b5('0x1b')]();});}};}function handleEntityNotFound(_0x5c6f30,_0x21f3ed){return function(_0x1ebbc5){if(!_0x1ebbc5){_0x5c6f30[_0x30b5('0x19')](0x194);}return _0x1ebbc5;};}function handleError(_0x14c8ef,_0x163994){_0x163994=_0x163994||0x1f4;return function(_0x3fc6b5){logger[_0x30b5('0x29')](_0x3fc6b5[_0x30b5('0x2a')]);if(_0x3fc6b5[_0x30b5('0x2b')]){delete _0x3fc6b5[_0x30b5('0x2b')];}_0x14c8ef[_0x30b5('0x1a')](_0x163994)[_0x30b5('0x2c')](_0x3fc6b5);};}exports[_0x30b5('0x2d')]=function(_0x494236,_0x1e86d0){var _0x4915e1={},_0x341650={},_0x5c35cc={'count':0x0,'rows':[]};var _0x1f3acd=_[_0x30b5('0x2e')](db[_0x30b5('0x2f')][_0x30b5('0x30')],function(_0x432836){return{'name':_0x432836['fieldName'],'type':_0x432836[_0x30b5('0x31')][_0x30b5('0x32')]};});_0x341650[_0x30b5('0x33')]=_[_0x30b5('0x2e')](_0x1f3acd,'name');_0x341650[_0x30b5('0x34')]=_['keys'](_0x494236[_0x30b5('0x34')]);_0x341650[_0x30b5('0x35')]=_['intersection'](_0x341650['model'],_0x341650[_0x30b5('0x34')]);_0x4915e1[_0x30b5('0x36')]=_['intersection'](_0x341650[_0x30b5('0x33')],qs[_0x30b5('0x37')](_0x494236[_0x30b5('0x34')][_0x30b5('0x37')]));_0x4915e1[_0x30b5('0x36')]=_0x4915e1['attributes'][_0x30b5('0x38')]?_0x4915e1[_0x30b5('0x36')]:_0x341650[_0x30b5('0x33')];if(!_0x494236[_0x30b5('0x34')][_0x30b5('0x39')](_0x30b5('0x3a'))){_0x4915e1[_0x30b5('0x1d')]=qs[_0x30b5('0x1d')](_0x494236['query'][_0x30b5('0x1d')]);_0x4915e1[_0x30b5('0x1e')]=qs[_0x30b5('0x1e')](_0x494236[_0x30b5('0x34')]['offset']);}_0x4915e1['order']=qs[_0x30b5('0x3b')](_0x494236[_0x30b5('0x34')][_0x30b5('0x3b')]);_0x4915e1['where']=qs[_0x30b5('0x35')](_[_0x30b5('0x3c')](_0x494236[_0x30b5('0x34')],_0x341650[_0x30b5('0x35')]),_0x1f3acd);if(_0x494236[_0x30b5('0x34')][_0x30b5('0x3d')]){_0x4915e1[_0x30b5('0x3e')]=_['merge'](_0x4915e1[_0x30b5('0x3e')],{'$or':_[_0x30b5('0x2e')](_0x1f3acd,function(_0x582793){if(_0x582793[_0x30b5('0x31')]!==_0x30b5('0x3f')){var _0x5689cd={};_0x5689cd[_0x582793[_0x30b5('0x2b')]]={'$like':'%'+_0x494236[_0x30b5('0x34')]['filter']+'%'};return _0x5689cd;}})});}_0x4915e1=_[_0x30b5('0x40')]({},_0x4915e1,_0x494236[_0x30b5('0x41')]);var _0x56bfb1={'where':_0x4915e1[_0x30b5('0x3e')]};return db[_0x30b5('0x2f')][_0x30b5('0x1f')](_0x56bfb1)[_0x30b5('0x27')](function(_0x35117e){_0x5c35cc[_0x30b5('0x1f')]=_0x35117e;if(_0x494236[_0x30b5('0x34')][_0x30b5('0x42')]){_0x4915e1[_0x30b5('0x43')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x30b5('0x44')](_0x4915e1);})[_0x30b5('0x27')](function(_0x541a1c){_0x5c35cc[_0x30b5('0x45')]=_0x541a1c;return _0x5c35cc;})[_0x30b5('0x27')](respondWithFilteredResult(_0x1e86d0,_0x4915e1))['catch'](handleError(_0x1e86d0,null));};exports[_0x30b5('0x46')]=function(_0x4e02ef,_0x4f502e){var _0x342d4e={'raw':![],'where':{'id':_0x4e02ef[_0x30b5('0x47')]['id']}},_0x3aa776={};_0x3aa776[_0x30b5('0x33')]=_[_0x30b5('0x48')](db[_0x30b5('0x2f')]['rawAttributes']);_0x3aa776[_0x30b5('0x34')]=_[_0x30b5('0x48')](_0x4e02ef[_0x30b5('0x34')]);_0x3aa776[_0x30b5('0x35')]=_['intersection'](_0x3aa776['model'],_0x3aa776['query']);_0x342d4e[_0x30b5('0x36')]=_[_0x30b5('0x49')](_0x3aa776[_0x30b5('0x33')],qs['fields'](_0x4e02ef['query'][_0x30b5('0x37')]));_0x342d4e[_0x30b5('0x36')]=_0x342d4e[_0x30b5('0x36')]['length']?_0x342d4e['attributes']:_0x3aa776[_0x30b5('0x33')];if(_0x4e02ef[_0x30b5('0x34')]['includeAll']){_0x342d4e['include']=[{'all':!![]}];}_0x342d4e=_[_0x30b5('0x40')]({},_0x342d4e,_0x4e02ef[_0x30b5('0x41')]);return db['ServicenowConfiguration'][_0x30b5('0x4a')](_0x342d4e)[_0x30b5('0x27')](handleEntityNotFound(_0x4f502e,null))[_0x30b5('0x27')](respondWithResult(_0x4f502e,null))['catch'](handleError(_0x4f502e,null));};exports[_0x30b5('0x4b')]=function(_0x59021d,_0x2f80d3){return db['ServicenowConfiguration'][_0x30b5('0x4b')](_0x59021d['body'],{})[_0x30b5('0x27')](respondWithResult(_0x2f80d3,0xc9))[_0x30b5('0x4c')](handleError(_0x2f80d3,null));};exports['update']=function(_0x5defb1,_0x5b523c){if(_0x5defb1[_0x30b5('0x4d')]['id']){delete _0x5defb1[_0x30b5('0x4d')]['id'];}return db[_0x30b5('0x2f')][_0x30b5('0x4a')]({'where':{'id':_0x5defb1[_0x30b5('0x47')]['id']}})[_0x30b5('0x27')](handleEntityNotFound(_0x5b523c,null))[_0x30b5('0x27')](saveUpdates(_0x5defb1[_0x30b5('0x4d')],null))['then'](respondWithResult(_0x5b523c,null))['catch'](handleError(_0x5b523c,null));};exports[_0x30b5('0x28')]=function(_0x57b205,_0x4ddbeb){return db[_0x30b5('0x2f')]['find']({'where':{'id':_0x57b205[_0x30b5('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ddbeb,null))[_0x30b5('0x27')](removeEntity(_0x4ddbeb,null))[_0x30b5('0x4c')](handleError(_0x4ddbeb,null));};exports[_0x30b5('0x4e')]=function(_0x5bd67a,_0x2a4d63,_0x1b6ec8){var _0x24e743={};var _0x31c238={};var _0x2a69cb;var _0x461416;return db['ServicenowConfiguration'][_0x30b5('0x4f')]({'where':{'id':_0x5bd67a[_0x30b5('0x47')]['id']}})[_0x30b5('0x27')](handleEntityNotFound(_0x2a4d63,null))[_0x30b5('0x27')](function(_0x3e4c10){if(_0x3e4c10){_0x2a69cb=_0x3e4c10;_0x31c238[_0x30b5('0x33')]=_[_0x30b5('0x48')](db[_0x30b5('0x50')][_0x30b5('0x30')]);_0x31c238[_0x30b5('0x34')]=_['keys'](_0x5bd67a[_0x30b5('0x34')]);_0x31c238[_0x30b5('0x35')]=_[_0x30b5('0x49')](_0x31c238[_0x30b5('0x33')],_0x31c238[_0x30b5('0x34')]);_0x24e743[_0x30b5('0x36')]=_[_0x30b5('0x49')](_0x31c238[_0x30b5('0x33')],qs[_0x30b5('0x37')](_0x5bd67a[_0x30b5('0x34')][_0x30b5('0x37')]));_0x24e743['attributes']=_0x24e743[_0x30b5('0x36')][_0x30b5('0x38')]?_0x24e743[_0x30b5('0x36')]:_0x31c238[_0x30b5('0x33')];_0x24e743[_0x30b5('0x51')]=qs[_0x30b5('0x3b')](_0x5bd67a[_0x30b5('0x34')][_0x30b5('0x3b')]);_0x24e743[_0x30b5('0x3e')]=qs[_0x30b5('0x35')](_[_0x30b5('0x3c')](_0x5bd67a[_0x30b5('0x34')],_0x31c238[_0x30b5('0x35')]));if(_0x5bd67a['query'][_0x30b5('0x3d')]){_0x24e743['where']=_[_0x30b5('0x40')](_0x24e743[_0x30b5('0x3e')],{'$or':_[_0x30b5('0x2e')](_0x24e743[_0x30b5('0x36')],function(_0x57f442){var _0x4b8341={};_0x4b8341[_0x57f442]={'$like':'%'+_0x5bd67a[_0x30b5('0x34')][_0x30b5('0x3d')]+'%'};return _0x4b8341;})});}_0x24e743=_[_0x30b5('0x40')]({},_0x24e743,_0x5bd67a[_0x30b5('0x41')]);return _0x2a69cb[_0x30b5('0x4e')](_0x24e743);}})[_0x30b5('0x27')](function(_0x343776){if(_0x343776){_0x461416=_0x343776[_0x30b5('0x38')];if(!_0x5bd67a[_0x30b5('0x34')]['hasOwnProperty']('nolimit')){_0x24e743[_0x30b5('0x1d')]=qs['limit'](_0x5bd67a[_0x30b5('0x34')][_0x30b5('0x1d')]);_0x24e743['offset']=qs[_0x30b5('0x1e')](_0x5bd67a[_0x30b5('0x34')][_0x30b5('0x1e')]);}return _0x2a69cb['getFields'](_0x24e743);}})[_0x30b5('0x27')](function(_0x467016){if(_0x467016){return _0x467016?{'count':_0x461416,'rows':_0x467016}:null;}})[_0x30b5('0x27')](respondWithResult(_0x2a4d63,null))[_0x30b5('0x4c')](handleError(_0x2a4d63,null));};exports[_0x30b5('0x52')]=function(_0x399225,_0x4aaa6a,_0x53c2d6){var _0x1fad04={};var _0x18a2f0={};var _0x2fa375;var _0x1db9c9;return db[_0x30b5('0x2f')]['findOne']({'where':{'id':_0x399225['params']['id']}})['then'](handleEntityNotFound(_0x4aaa6a,null))['then'](function(_0x4aef13){if(_0x4aef13){_0x2fa375=_0x4aef13;_0x18a2f0['model']=_[_0x30b5('0x48')](db[_0x30b5('0x50')][_0x30b5('0x30')]);_0x18a2f0[_0x30b5('0x34')]=_[_0x30b5('0x48')](_0x399225[_0x30b5('0x34')]);_0x18a2f0[_0x30b5('0x35')]=_[_0x30b5('0x49')](_0x18a2f0[_0x30b5('0x33')],_0x18a2f0[_0x30b5('0x34')]);_0x1fad04[_0x30b5('0x36')]=_['intersection'](_0x18a2f0[_0x30b5('0x33')],qs[_0x30b5('0x37')](_0x399225['query'][_0x30b5('0x37')]));_0x1fad04[_0x30b5('0x36')]=_0x1fad04[_0x30b5('0x36')]['length']?_0x1fad04[_0x30b5('0x36')]:_0x18a2f0[_0x30b5('0x33')];_0x1fad04[_0x30b5('0x51')]=qs['sort'](_0x399225[_0x30b5('0x34')]['sort']);_0x1fad04['where']=qs[_0x30b5('0x35')](_['pick'](_0x399225[_0x30b5('0x34')],_0x18a2f0[_0x30b5('0x35')]));if(_0x399225[_0x30b5('0x34')]['filter']){_0x1fad04['where']=_['merge'](_0x1fad04[_0x30b5('0x3e')],{'$or':_[_0x30b5('0x2e')](_0x1fad04[_0x30b5('0x36')],function(_0x146242){var _0x4f1b25={};_0x4f1b25[_0x146242]={'$like':'%'+_0x399225['query'][_0x30b5('0x3d')]+'%'};return _0x4f1b25;})});}_0x1fad04=_[_0x30b5('0x40')]({},_0x1fad04,_0x399225[_0x30b5('0x41')]);return _0x2fa375['getSubjects'](_0x1fad04);}})['then'](function(_0x36a2ff){if(_0x36a2ff){_0x1db9c9=_0x36a2ff[_0x30b5('0x38')];if(!_0x399225[_0x30b5('0x34')][_0x30b5('0x39')]('nolimit')){_0x1fad04[_0x30b5('0x1d')]=qs[_0x30b5('0x1d')](_0x399225['query'][_0x30b5('0x1d')]);_0x1fad04[_0x30b5('0x1e')]=qs['offset'](_0x399225[_0x30b5('0x34')][_0x30b5('0x1e')]);}return _0x2fa375['getSubjects'](_0x1fad04);}})[_0x30b5('0x27')](function(_0x561d06){if(_0x561d06){return _0x561d06?{'count':_0x1db9c9,'rows':_0x561d06}:null;}})[_0x30b5('0x27')](respondWithResult(_0x4aaa6a,null))['catch'](handleError(_0x4aaa6a,null));};exports[_0x30b5('0x53')]=function(_0x4df1d4,_0x3d7201,_0x75b16f){var _0x2f9510={};var _0x5c0c7a={};var _0x4853fb;var _0xd283a1;return db[_0x30b5('0x2f')][_0x30b5('0x4f')]({'where':{'id':_0x4df1d4[_0x30b5('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d7201,null))[_0x30b5('0x27')](function(_0x408dc9){if(_0x408dc9){_0x4853fb=_0x408dc9;_0x5c0c7a[_0x30b5('0x33')]=_[_0x30b5('0x48')](db[_0x30b5('0x50')][_0x30b5('0x30')]);_0x5c0c7a[_0x30b5('0x34')]=_[_0x30b5('0x48')](_0x4df1d4[_0x30b5('0x34')]);_0x5c0c7a[_0x30b5('0x35')]=_['intersection'](_0x5c0c7a['model'],_0x5c0c7a[_0x30b5('0x34')]);_0x2f9510[_0x30b5('0x36')]=_['intersection'](_0x5c0c7a[_0x30b5('0x33')],qs[_0x30b5('0x37')](_0x4df1d4[_0x30b5('0x34')][_0x30b5('0x37')]));_0x2f9510[_0x30b5('0x36')]=_0x2f9510[_0x30b5('0x36')][_0x30b5('0x38')]?_0x2f9510[_0x30b5('0x36')]:_0x5c0c7a[_0x30b5('0x33')];_0x2f9510[_0x30b5('0x51')]=qs['sort'](_0x4df1d4['query'][_0x30b5('0x3b')]);_0x2f9510['where']=qs[_0x30b5('0x35')](_[_0x30b5('0x3c')](_0x4df1d4[_0x30b5('0x34')],_0x5c0c7a[_0x30b5('0x35')]));if(_0x4df1d4['query'][_0x30b5('0x3d')]){_0x2f9510[_0x30b5('0x3e')]=_[_0x30b5('0x40')](_0x2f9510[_0x30b5('0x3e')],{'$or':_[_0x30b5('0x2e')](_0x2f9510['attributes'],function(_0x58b5ae){var _0xc7876={};_0xc7876[_0x58b5ae]={'$like':'%'+_0x4df1d4['query'][_0x30b5('0x3d')]+'%'};return _0xc7876;})});}_0x2f9510=_[_0x30b5('0x40')]({},_0x2f9510,_0x4df1d4[_0x30b5('0x41')]);return _0x4853fb['getDescriptions'](_0x2f9510);}})['then'](function(_0x15a4cc){if(_0x15a4cc){_0xd283a1=_0x15a4cc[_0x30b5('0x38')];if(!_0x4df1d4['query'][_0x30b5('0x39')](_0x30b5('0x3a'))){_0x2f9510[_0x30b5('0x1d')]=qs['limit'](_0x4df1d4[_0x30b5('0x34')][_0x30b5('0x1d')]);_0x2f9510[_0x30b5('0x1e')]=qs['offset'](_0x4df1d4[_0x30b5('0x34')]['offset']);}return _0x4853fb['getDescriptions'](_0x2f9510);}})[_0x30b5('0x27')](function(_0x11c7e2){if(_0x11c7e2){return _0x11c7e2?{'count':_0xd283a1,'rows':_0x11c7e2}:null;}})[_0x30b5('0x27')](respondWithResult(_0x3d7201,null))[_0x30b5('0x4c')](handleError(_0x3d7201,null));}; \ No newline at end of file +var _0x6f20=['jsforce','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','ServicenowConfiguration','include','rows','catch','show','includeAll','find','create','body','update','params','findOne','ServicenowField','getSubjects','pick','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1d5f68,_0x229dd7){var _0x53c3ca=function(_0x1846bd){while(--_0x1846bd){_0x1d5f68['push'](_0x1d5f68['shift']());}};_0x53c3ca(++_0x229dd7);}(_0x6f20,0x98));var _0x06f2=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x6f20[_0x400322];return _0xfdd597;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06f2('0x1'));var rp=require(_0x06f2('0x2'));var moment=require(_0x06f2('0x3'));var BPromise=require(_0x06f2('0x4'));var Mustache=require(_0x06f2('0x5'));var util=require(_0x06f2('0x6'));var path=require(_0x06f2('0x7'));var sox=require(_0x06f2('0x8'));var csv=require(_0x06f2('0x9'));var ejs=require(_0x06f2('0xa'));var fs=require('fs');var fs_extra=require(_0x06f2('0xb'));var _=require(_0x06f2('0xc'));var squel=require(_0x06f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x06f2('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x06f2('0xf'));var Papa=require(_0x06f2('0x10'));var Redis=require(_0x06f2('0x11'));var authService=require(_0x06f2('0x12'));var qs=require(_0x06f2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06f2('0x14'));var logger=require(_0x06f2('0x15'))(_0x06f2('0x16'));var utils=require(_0x06f2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x06f2('0x18'));var db=require(_0x06f2('0x19'))['db'];function respondWithStatusCode(_0x3cd066,_0x3da79d){_0x3da79d=_0x3da79d||0xcc;return function(_0x4797b9){if(_0x4797b9){return _0x3cd066[_0x06f2('0x1a')](_0x3da79d);}return _0x3cd066[_0x06f2('0x1b')](_0x3da79d)[_0x06f2('0x1c')]();};}function respondWithResult(_0x248ad,_0x2c44df){_0x2c44df=_0x2c44df||0xc8;return function(_0x340712){if(_0x340712){return _0x248ad[_0x06f2('0x1b')](_0x2c44df)[_0x06f2('0x1d')](_0x340712);}};}function respondWithFilteredResult(_0x2604ae,_0x3d3aa5){return function(_0x31b527){if(_0x31b527){var _0x19f5bf=typeof _0x3d3aa5['offset']===_0x06f2('0x1e')&&typeof _0x3d3aa5[_0x06f2('0x1f')]===_0x06f2('0x1e');var _0x323768=_0x31b527[_0x06f2('0x20')];var _0x2be366=_0x19f5bf?0x0:_0x3d3aa5[_0x06f2('0x21')];var _0x489212=_0x19f5bf?_0x31b527[_0x06f2('0x20')]:_0x3d3aa5[_0x06f2('0x21')]+_0x3d3aa5[_0x06f2('0x1f')];var _0x1cdc0d;if(_0x489212>=_0x323768){_0x489212=_0x323768;_0x1cdc0d=0xc8;}else{_0x1cdc0d=0xce;}_0x2604ae[_0x06f2('0x1b')](_0x1cdc0d);return _0x2604ae[_0x06f2('0x22')](_0x06f2('0x23'),_0x2be366+'-'+_0x489212+'/'+_0x323768)['json'](_0x31b527);}return null;};}function patchUpdates(_0x1d802a){return function(_0x49d1c0){try{jsonpatch[_0x06f2('0x24')](_0x49d1c0,_0x1d802a,!![]);}catch(_0x4d131c){return BPromise[_0x06f2('0x25')](_0x4d131c);}return _0x49d1c0[_0x06f2('0x26')]();};}function saveUpdates(_0x2ba7ec,_0x14c949){return function(_0x49cb8f){if(_0x49cb8f){return _0x49cb8f['update'](_0x2ba7ec)['then'](function(_0x198b2e){return _0x198b2e;});}return null;};}function removeEntity(_0x2179e2,_0x26a541){return function(_0x539e5d){if(_0x539e5d){return _0x539e5d[_0x06f2('0x27')]()[_0x06f2('0x28')](function(){_0x2179e2[_0x06f2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bdb7f,_0x408034){return function(_0x4a51d5){if(!_0x4a51d5){_0x5bdb7f[_0x06f2('0x1a')](0x194);}return _0x4a51d5;};}function handleError(_0x1f9a41,_0xb8c4e6){_0xb8c4e6=_0xb8c4e6||0x1f4;return function(_0x5a995a){logger[_0x06f2('0x29')](_0x5a995a[_0x06f2('0x2a')]);if(_0x5a995a['name']){delete _0x5a995a['name'];}_0x1f9a41[_0x06f2('0x1b')](_0xb8c4e6)[_0x06f2('0x2b')](_0x5a995a);};}exports[_0x06f2('0x2c')]=function(_0x472a16,_0x5801ab){var _0x4bca91={},_0x4822e9={},_0x52fa57={'count':0x0,'rows':[]};var _0x1b00b3=_[_0x06f2('0x2d')](db['ServicenowConfiguration'][_0x06f2('0x2e')],function(_0x12c088){return{'name':_0x12c088['fieldName'],'type':_0x12c088[_0x06f2('0x2f')][_0x06f2('0x30')]};});_0x4822e9[_0x06f2('0x31')]=_[_0x06f2('0x2d')](_0x1b00b3,_0x06f2('0x32'));_0x4822e9[_0x06f2('0x33')]=_[_0x06f2('0x34')](_0x472a16[_0x06f2('0x33')]);_0x4822e9['filters']=_['intersection'](_0x4822e9[_0x06f2('0x31')],_0x4822e9[_0x06f2('0x33')]);_0x4bca91[_0x06f2('0x35')]=_[_0x06f2('0x36')](_0x4822e9[_0x06f2('0x31')],qs[_0x06f2('0x37')](_0x472a16['query'][_0x06f2('0x37')]));_0x4bca91[_0x06f2('0x35')]=_0x4bca91[_0x06f2('0x35')][_0x06f2('0x38')]?_0x4bca91['attributes']:_0x4822e9[_0x06f2('0x31')];if(!_0x472a16[_0x06f2('0x33')][_0x06f2('0x39')](_0x06f2('0x3a'))){_0x4bca91['limit']=qs[_0x06f2('0x1f')](_0x472a16[_0x06f2('0x33')]['limit']);_0x4bca91[_0x06f2('0x21')]=qs['offset'](_0x472a16['query'][_0x06f2('0x21')]);}_0x4bca91[_0x06f2('0x3b')]=qs[_0x06f2('0x3c')](_0x472a16[_0x06f2('0x33')][_0x06f2('0x3c')]);_0x4bca91[_0x06f2('0x3d')]=qs[_0x06f2('0x3e')](_['pick'](_0x472a16[_0x06f2('0x33')],_0x4822e9['filters']),_0x1b00b3);if(_0x472a16[_0x06f2('0x33')]['filter']){_0x4bca91[_0x06f2('0x3d')]=_[_0x06f2('0x3f')](_0x4bca91['where'],{'$or':_['map'](_0x1b00b3,function(_0x43f4a7){if(_0x43f4a7[_0x06f2('0x2f')]!==_0x06f2('0x40')){var _0x27e8d7={};_0x27e8d7[_0x43f4a7['name']]={'$like':'%'+_0x472a16[_0x06f2('0x33')][_0x06f2('0x41')]+'%'};return _0x27e8d7;}})});}_0x4bca91=_[_0x06f2('0x3f')]({},_0x4bca91,_0x472a16[_0x06f2('0x42')]);var _0x5e8736={'where':_0x4bca91[_0x06f2('0x3d')]};return db[_0x06f2('0x43')][_0x06f2('0x20')](_0x5e8736)[_0x06f2('0x28')](function(_0x53083c){_0x52fa57[_0x06f2('0x20')]=_0x53083c;if(_0x472a16['query']['includeAll']){_0x4bca91[_0x06f2('0x44')]=[{'all':!![]}];}return db[_0x06f2('0x43')]['findAll'](_0x4bca91);})[_0x06f2('0x28')](function(_0x1b76ff){_0x52fa57[_0x06f2('0x45')]=_0x1b76ff;return _0x52fa57;})['then'](respondWithFilteredResult(_0x5801ab,_0x4bca91))[_0x06f2('0x46')](handleError(_0x5801ab,null));};exports[_0x06f2('0x47')]=function(_0x48d32b,_0xf86003){var _0x1ad7d8={'raw':![],'where':{'id':_0x48d32b['params']['id']}},_0xdf052b={};_0xdf052b[_0x06f2('0x31')]=_['keys'](db[_0x06f2('0x43')][_0x06f2('0x2e')]);_0xdf052b[_0x06f2('0x33')]=_[_0x06f2('0x34')](_0x48d32b[_0x06f2('0x33')]);_0xdf052b[_0x06f2('0x3e')]=_[_0x06f2('0x36')](_0xdf052b[_0x06f2('0x31')],_0xdf052b['query']);_0x1ad7d8[_0x06f2('0x35')]=_[_0x06f2('0x36')](_0xdf052b['model'],qs['fields'](_0x48d32b[_0x06f2('0x33')][_0x06f2('0x37')]));_0x1ad7d8['attributes']=_0x1ad7d8['attributes'][_0x06f2('0x38')]?_0x1ad7d8['attributes']:_0xdf052b['model'];if(_0x48d32b['query'][_0x06f2('0x48')]){_0x1ad7d8['include']=[{'all':!![]}];}_0x1ad7d8=_[_0x06f2('0x3f')]({},_0x1ad7d8,_0x48d32b[_0x06f2('0x42')]);return db['ServicenowConfiguration'][_0x06f2('0x49')](_0x1ad7d8)[_0x06f2('0x28')](handleEntityNotFound(_0xf86003,null))[_0x06f2('0x28')](respondWithResult(_0xf86003,null))[_0x06f2('0x46')](handleError(_0xf86003,null));};exports['create']=function(_0x4af715,_0x3d3a4b){return db['ServicenowConfiguration'][_0x06f2('0x4a')](_0x4af715[_0x06f2('0x4b')],{})[_0x06f2('0x28')](respondWithResult(_0x3d3a4b,0xc9))[_0x06f2('0x46')](handleError(_0x3d3a4b,null));};exports[_0x06f2('0x4c')]=function(_0x5b6b09,_0x155ade){if(_0x5b6b09[_0x06f2('0x4b')]['id']){delete _0x5b6b09[_0x06f2('0x4b')]['id'];}return db[_0x06f2('0x43')][_0x06f2('0x49')]({'where':{'id':_0x5b6b09[_0x06f2('0x4d')]['id']}})[_0x06f2('0x28')](handleEntityNotFound(_0x155ade,null))[_0x06f2('0x28')](saveUpdates(_0x5b6b09[_0x06f2('0x4b')],null))[_0x06f2('0x28')](respondWithResult(_0x155ade,null))[_0x06f2('0x46')](handleError(_0x155ade,null));};exports[_0x06f2('0x27')]=function(_0x517833,_0x3ff84d){return db[_0x06f2('0x43')]['find']({'where':{'id':_0x517833[_0x06f2('0x4d')]['id']}})[_0x06f2('0x28')](handleEntityNotFound(_0x3ff84d,null))['then'](removeEntity(_0x3ff84d,null))[_0x06f2('0x46')](handleError(_0x3ff84d,null));};exports['getFields']=function(_0x288a13,_0x1f71fd,_0x26d0a2){var _0x4f2450={};var _0x10fc9b={};var _0xc1e70;var _0x929501;return db[_0x06f2('0x43')][_0x06f2('0x4e')]({'where':{'id':_0x288a13[_0x06f2('0x4d')]['id']}})[_0x06f2('0x28')](handleEntityNotFound(_0x1f71fd,null))['then'](function(_0x12dee3){if(_0x12dee3){_0xc1e70=_0x12dee3;_0x10fc9b['model']=_['keys'](db[_0x06f2('0x4f')][_0x06f2('0x2e')]);_0x10fc9b['query']=_['keys'](_0x288a13[_0x06f2('0x33')]);_0x10fc9b[_0x06f2('0x3e')]=_['intersection'](_0x10fc9b[_0x06f2('0x31')],_0x10fc9b[_0x06f2('0x33')]);_0x4f2450[_0x06f2('0x35')]=_['intersection'](_0x10fc9b[_0x06f2('0x31')],qs['fields'](_0x288a13['query'][_0x06f2('0x37')]));_0x4f2450[_0x06f2('0x35')]=_0x4f2450[_0x06f2('0x35')][_0x06f2('0x38')]?_0x4f2450['attributes']:_0x10fc9b[_0x06f2('0x31')];_0x4f2450[_0x06f2('0x3b')]=qs[_0x06f2('0x3c')](_0x288a13[_0x06f2('0x33')][_0x06f2('0x3c')]);_0x4f2450['where']=qs[_0x06f2('0x3e')](_['pick'](_0x288a13['query'],_0x10fc9b[_0x06f2('0x3e')]));if(_0x288a13['query'][_0x06f2('0x41')]){_0x4f2450[_0x06f2('0x3d')]=_[_0x06f2('0x3f')](_0x4f2450['where'],{'$or':_[_0x06f2('0x2d')](_0x4f2450[_0x06f2('0x35')],function(_0x559a23){var _0xf83490={};_0xf83490[_0x559a23]={'$like':'%'+_0x288a13[_0x06f2('0x33')][_0x06f2('0x41')]+'%'};return _0xf83490;})});}_0x4f2450=_['merge']({},_0x4f2450,_0x288a13[_0x06f2('0x42')]);return _0xc1e70['getFields'](_0x4f2450);}})[_0x06f2('0x28')](function(_0x27eedc){if(_0x27eedc){_0x929501=_0x27eedc[_0x06f2('0x38')];if(!_0x288a13[_0x06f2('0x33')][_0x06f2('0x39')](_0x06f2('0x3a'))){_0x4f2450[_0x06f2('0x1f')]=qs['limit'](_0x288a13['query']['limit']);_0x4f2450[_0x06f2('0x21')]=qs[_0x06f2('0x21')](_0x288a13[_0x06f2('0x33')][_0x06f2('0x21')]);}return _0xc1e70['getFields'](_0x4f2450);}})[_0x06f2('0x28')](function(_0x3065d4){if(_0x3065d4){return _0x3065d4?{'count':_0x929501,'rows':_0x3065d4}:null;}})[_0x06f2('0x28')](respondWithResult(_0x1f71fd,null))['catch'](handleError(_0x1f71fd,null));};exports[_0x06f2('0x50')]=function(_0x73ce90,_0x5221a7,_0x1157a9){var _0x1cfd75={};var _0x3b0992={};var _0x4c3105;var _0x29962d;return db[_0x06f2('0x43')][_0x06f2('0x4e')]({'where':{'id':_0x73ce90[_0x06f2('0x4d')]['id']}})[_0x06f2('0x28')](handleEntityNotFound(_0x5221a7,null))['then'](function(_0x238acb){if(_0x238acb){_0x4c3105=_0x238acb;_0x3b0992['model']=_[_0x06f2('0x34')](db[_0x06f2('0x4f')]['rawAttributes']);_0x3b0992[_0x06f2('0x33')]=_[_0x06f2('0x34')](_0x73ce90[_0x06f2('0x33')]);_0x3b0992[_0x06f2('0x3e')]=_[_0x06f2('0x36')](_0x3b0992[_0x06f2('0x31')],_0x3b0992[_0x06f2('0x33')]);_0x1cfd75['attributes']=_[_0x06f2('0x36')](_0x3b0992['model'],qs[_0x06f2('0x37')](_0x73ce90[_0x06f2('0x33')][_0x06f2('0x37')]));_0x1cfd75[_0x06f2('0x35')]=_0x1cfd75['attributes']['length']?_0x1cfd75[_0x06f2('0x35')]:_0x3b0992[_0x06f2('0x31')];_0x1cfd75[_0x06f2('0x3b')]=qs[_0x06f2('0x3c')](_0x73ce90[_0x06f2('0x33')][_0x06f2('0x3c')]);_0x1cfd75[_0x06f2('0x3d')]=qs[_0x06f2('0x3e')](_[_0x06f2('0x51')](_0x73ce90[_0x06f2('0x33')],_0x3b0992['filters']));if(_0x73ce90['query'][_0x06f2('0x41')]){_0x1cfd75[_0x06f2('0x3d')]=_[_0x06f2('0x3f')](_0x1cfd75[_0x06f2('0x3d')],{'$or':_[_0x06f2('0x2d')](_0x1cfd75['attributes'],function(_0x2945fb){var _0x214c96={};_0x214c96[_0x2945fb]={'$like':'%'+_0x73ce90[_0x06f2('0x33')][_0x06f2('0x41')]+'%'};return _0x214c96;})});}_0x1cfd75=_['merge']({},_0x1cfd75,_0x73ce90[_0x06f2('0x42')]);return _0x4c3105[_0x06f2('0x50')](_0x1cfd75);}})[_0x06f2('0x28')](function(_0x1ec024){if(_0x1ec024){_0x29962d=_0x1ec024[_0x06f2('0x38')];if(!_0x73ce90[_0x06f2('0x33')][_0x06f2('0x39')](_0x06f2('0x3a'))){_0x1cfd75['limit']=qs[_0x06f2('0x1f')](_0x73ce90[_0x06f2('0x33')]['limit']);_0x1cfd75[_0x06f2('0x21')]=qs[_0x06f2('0x21')](_0x73ce90[_0x06f2('0x33')][_0x06f2('0x21')]);}return _0x4c3105[_0x06f2('0x50')](_0x1cfd75);}})[_0x06f2('0x28')](function(_0x92f178){if(_0x92f178){return _0x92f178?{'count':_0x29962d,'rows':_0x92f178}:null;}})['then'](respondWithResult(_0x5221a7,null))[_0x06f2('0x46')](handleError(_0x5221a7,null));};exports['getDescriptions']=function(_0x2a380e,_0x557544,_0x3b1492){var _0x34898d={};var _0xa1a2b0={};var _0x5392d3;var _0x4f0528;return db[_0x06f2('0x43')]['findOne']({'where':{'id':_0x2a380e[_0x06f2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x557544,null))[_0x06f2('0x28')](function(_0x22a6b7){if(_0x22a6b7){_0x5392d3=_0x22a6b7;_0xa1a2b0[_0x06f2('0x31')]=_[_0x06f2('0x34')](db[_0x06f2('0x4f')][_0x06f2('0x2e')]);_0xa1a2b0[_0x06f2('0x33')]=_[_0x06f2('0x34')](_0x2a380e[_0x06f2('0x33')]);_0xa1a2b0[_0x06f2('0x3e')]=_['intersection'](_0xa1a2b0[_0x06f2('0x31')],_0xa1a2b0[_0x06f2('0x33')]);_0x34898d[_0x06f2('0x35')]=_['intersection'](_0xa1a2b0[_0x06f2('0x31')],qs['fields'](_0x2a380e[_0x06f2('0x33')][_0x06f2('0x37')]));_0x34898d['attributes']=_0x34898d['attributes'][_0x06f2('0x38')]?_0x34898d['attributes']:_0xa1a2b0['model'];_0x34898d[_0x06f2('0x3b')]=qs[_0x06f2('0x3c')](_0x2a380e[_0x06f2('0x33')][_0x06f2('0x3c')]);_0x34898d[_0x06f2('0x3d')]=qs[_0x06f2('0x3e')](_[_0x06f2('0x51')](_0x2a380e[_0x06f2('0x33')],_0xa1a2b0[_0x06f2('0x3e')]));if(_0x2a380e[_0x06f2('0x33')]['filter']){_0x34898d['where']=_['merge'](_0x34898d[_0x06f2('0x3d')],{'$or':_[_0x06f2('0x2d')](_0x34898d['attributes'],function(_0x31d781){var _0x2012c2={};_0x2012c2[_0x31d781]={'$like':'%'+_0x2a380e[_0x06f2('0x33')]['filter']+'%'};return _0x2012c2;})});}_0x34898d=_[_0x06f2('0x3f')]({},_0x34898d,_0x2a380e[_0x06f2('0x42')]);return _0x5392d3['getDescriptions'](_0x34898d);}})[_0x06f2('0x28')](function(_0x125e00){if(_0x125e00){_0x4f0528=_0x125e00[_0x06f2('0x38')];if(!_0x2a380e[_0x06f2('0x33')][_0x06f2('0x39')](_0x06f2('0x3a'))){_0x34898d[_0x06f2('0x1f')]=qs[_0x06f2('0x1f')](_0x2a380e[_0x06f2('0x33')]['limit']);_0x34898d[_0x06f2('0x21')]=qs[_0x06f2('0x21')](_0x2a380e['query'][_0x06f2('0x21')]);}return _0x5392d3[_0x06f2('0x52')](_0x34898d);}})[_0x06f2('0x28')](function(_0x36386b){if(_0x36386b){return _0x36386b?{'count':_0x4f0528,'rows':_0x36386b}:null;}})[_0x06f2('0x28')](respondWithResult(_0x557544,null))[_0x06f2('0x46')](handleError(_0x557544,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 51c4e96..dee48e3 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 _0xb03e=['int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x271697,_0x6897d6){var _0x426093=function(_0x4d4dfe){while(--_0x4d4dfe){_0x271697['push'](_0x271697['shift']());}};_0x426093(++_0x6897d6);}(_0xb03e,0x1eb));var _0xeb03=function(_0x5dfbd4,_0x2d62d0){_0x5dfbd4=_0x5dfbd4-0x0;var _0x164bf3=_0xb03e[_0x5dfbd4];return _0x164bf3;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3306=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x54c24d,_0xd06be9){var _0x31d072=function(_0x3ba302){while(--_0x3ba302){_0x54c24d['push'](_0x54c24d['shift']());}};_0x31d072(++_0xd06be9);}(_0x3306,0x107));var _0x6330=function(_0x52ff84,_0x11c9e6){_0x52ff84=_0x52ff84-0x0;var _0x2bd8f2=_0x3306[_0x52ff84];return _0x2bd8f2;};'use strict';var _=require(_0x6330('0x0'));var util=require(_0x6330('0x1'));var logger=require(_0x6330('0x2'))(_0x6330('0x3'));var moment=require('moment');var BPromise=require(_0x6330('0x4'));var rp=require(_0x6330('0x5'));var fs=require('fs');var path=require(_0x6330('0x6'));var rimraf=require(_0x6330('0x7'));var config=require(_0x6330('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x6330('0x9')]=function(_0x457797,_0x2942ec){return _0x457797[_0x6330('0xa')](_0x6330('0xb'),attributes,{'tableName':_0x6330('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 95f1c7a..ef8b8ad 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 _0xf228=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b3c25,_0x65dc4d){var _0xdcb0ad=function(_0x4e546e){while(--_0x4e546e){_0x3b3c25['push'](_0x3b3c25['shift']());}};_0xdcb0ad(++_0x65dc4d);}(_0xf228,0x1a9));var _0x8f22=function(_0x43f64b,_0x4cf1a9){_0x43f64b=_0x43f64b-0x0;var _0xc4dc49=_0xf228[_0x43f64b];return _0xc4dc49;};'use strict';var _=require(_0x8f22('0x0'));var util=require(_0x8f22('0x1'));var moment=require('moment');var BPromise=require(_0x8f22('0x2'));var rs=require(_0x8f22('0x3'));var fs=require('fs');var Redis=require(_0x8f22('0x4'));var db=require(_0x8f22('0x5'))['db'];var utils=require(_0x8f22('0x6'));var logger=require(_0x8f22('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f22('0x8'));var client=jayson['client'][_0x8f22('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcf8bf8,_0x47f1a6,_0x2f65b7){return new BPromise(function(_0x22c45d,_0x5d913d){return client[_0x8f22('0xa')](_0xcf8bf8,_0x2f65b7)[_0x8f22('0xb')](function(_0x32dd0b){logger[_0x8f22('0xc')](_0x8f22('0xd'),_0x47f1a6,_0x8f22('0xe'));logger[_0x8f22('0xf')](_0x8f22('0x10'),_0x47f1a6,'request\x20sent',JSON[_0x8f22('0x11')](_0x32dd0b));if(_0x32dd0b[_0x8f22('0x12')]){if(_0x32dd0b[_0x8f22('0x12')]['code']===0x1f4){logger[_0x8f22('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47f1a6,_0x32dd0b[_0x8f22('0x12')][_0x8f22('0x13')]);return _0x5d913d(_0x32dd0b[_0x8f22('0x12')][_0x8f22('0x13')]);}logger[_0x8f22('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47f1a6,_0x32dd0b[_0x8f22('0x12')][_0x8f22('0x13')]);return _0x22c45d(_0x32dd0b['error'][_0x8f22('0x13')]);}else{logger[_0x8f22('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47f1a6,_0x8f22('0xe'));_0x22c45d(_0x32dd0b[_0x8f22('0x14')][_0x8f22('0x13')]);}})['catch'](function(_0x1b3bcc){logger[_0x8f22('0x12')](_0x8f22('0xd'),_0x47f1a6,_0x1b3bcc);_0x5d913d(_0x1b3bcc);});});} \ No newline at end of file +var _0x09b0=['jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x09b0,0x6e));var _0x009b=function(_0x1a10c2,_0x5a8114){_0x1a10c2=_0x1a10c2-0x0;var _0x34de45=_0x09b0[_0x1a10c2];return _0x34de45;};'use strict';var _=require(_0x009b('0x0'));var util=require(_0x009b('0x1'));var moment=require(_0x009b('0x2'));var BPromise=require(_0x009b('0x3'));var rs=require(_0x009b('0x4'));var fs=require('fs');var Redis=require(_0x009b('0x5'));var db=require(_0x009b('0x6'))['db'];var utils=require(_0x009b('0x7'));var logger=require('../../config/logger')(_0x009b('0x8'));var config=require(_0x009b('0x9'));var jayson=require(_0x009b('0xa'));var client=jayson[_0x009b('0xb')][_0x009b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31f236,_0x4fbf9a,_0xd708f1){return new BPromise(function(_0x52e593,_0x4ff73b){return client[_0x009b('0xd')](_0x31f236,_0xd708f1)[_0x009b('0xe')](function(_0x4b43eb){logger[_0x009b('0xf')](_0x009b('0x10'),_0x4fbf9a,_0x009b('0x11'));logger[_0x009b('0x12')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4fbf9a,_0x009b('0x11'),JSON[_0x009b('0x13')](_0x4b43eb));if(_0x4b43eb[_0x009b('0x14')]){if(_0x4b43eb['error']['code']===0x1f4){logger[_0x009b('0x14')](_0x009b('0x10'),_0x4fbf9a,_0x4b43eb[_0x009b('0x14')][_0x009b('0x15')]);return _0x4ff73b(_0x4b43eb['error'][_0x009b('0x15')]);}logger[_0x009b('0x14')](_0x009b('0x10'),_0x4fbf9a,_0x4b43eb[_0x009b('0x14')][_0x009b('0x15')]);return _0x52e593(_0x4b43eb[_0x009b('0x14')][_0x009b('0x15')]);}else{logger[_0x009b('0xf')](_0x009b('0x10'),_0x4fbf9a,_0x009b('0x11'));_0x52e593(_0x4b43eb[_0x009b('0x16')][_0x009b('0x15')]);}})[_0x009b('0x17')](function(_0x92e5df){logger[_0x009b('0x14')](_0x009b('0x10'),_0x4fbf9a,_0x92e5df);_0x4ff73b(_0x92e5df);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 89a57df..aced30b 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 _0x7845=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','/:id'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7845,0xbe));var _0x5784=function(_0x3d6a0c,_0x2a6199){_0x3d6a0c=_0x3d6a0c-0x0;var _0x1e95a2=_0x7845[_0x3d6a0c];return _0x1e95a2;};'use strict';var multer=require(_0x5784('0x0'));var util=require(_0x5784('0x1'));var path=require(_0x5784('0x2'));var timeout=require(_0x5784('0x3'));var express=require(_0x5784('0x4'));var router=express[_0x5784('0x5')]();var fs_extra=require(_0x5784('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5784('0x7'));var config=require(_0x5784('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x5784('0x9')](),controller[_0x5784('0xa')]);router['get']('/:id',auth[_0x5784('0x9')](),controller[_0x5784('0xb')]);router[_0x5784('0xc')]('/',auth[_0x5784('0x9')](),controller['create']);router['put'](_0x5784('0xd'),auth[_0x5784('0x9')](),controller[_0x5784('0xe')]);router[_0x5784('0xf')](_0x5784('0xd'),auth[_0x5784('0x9')](),controller[_0x5784('0x10')]);module['exports']=router; \ No newline at end of file +var _0x43eb=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1c72bc,_0x19d88c){var _0x489e20=function(_0x51e234){while(--_0x51e234){_0x1c72bc['push'](_0x1c72bc['shift']());}};_0x489e20(++_0x19d88c);}(_0x43eb,0x9c));var _0xb43e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x43eb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb43e('0x0'));var util=require('util');var path=require(_0xb43e('0x1'));var timeout=require(_0xb43e('0x2'));var express=require(_0xb43e('0x3'));var router=express[_0xb43e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb43e('0x5'));var config=require(_0xb43e('0x6'));var controller=require(_0xb43e('0x7'));router[_0xb43e('0x8')]('/',auth[_0xb43e('0x9')](),controller[_0xb43e('0xa')]);router[_0xb43e('0x8')](_0xb43e('0xb'),auth[_0xb43e('0x9')](),controller[_0xb43e('0xc')]);router[_0xb43e('0xd')]('/',auth[_0xb43e('0x9')](),controller[_0xb43e('0xe')]);router[_0xb43e('0xf')](_0xb43e('0xb'),auth[_0xb43e('0x9')](),controller['update']);router[_0xb43e('0x10')](_0xb43e('0xb'),auth[_0xb43e('0x9')](),controller[_0xb43e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e77bce0..63ee7c4 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 _0xcdb0=['sequelize','ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN'];(function(_0x54d00d,_0x3a4bd1){var _0x227c26=function(_0x5cfb89){while(--_0x5cfb89){_0x54d00d['push'](_0x54d00d['shift']());}};_0x227c26(++_0x3a4bd1);}(_0xcdb0,0x1f0));var _0x0cdb=function(_0x1db22e,_0x3af678){_0x1db22e=_0x1db22e-0x0;var _0x552045=_0xcdb0[_0x1db22e];return _0x552045;};'use strict';var Sequelize=require(_0x0cdb('0x0'));module['exports']={'type':{'type':Sequelize[_0x0cdb('0x1')](_0x0cdb('0x2'),_0x0cdb('0x3'),'customVariable','keyValue',_0x0cdb('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0cdb('0x5')]},'key':{'type':Sequelize[_0x0cdb('0x5')]},'keyType':{'type':Sequelize[_0x0cdb('0x1')]('string',_0x0cdb('0x3'),_0x0cdb('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0cdb('0x5')]},'customField':{'type':Sequelize[_0x0cdb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0cdb('0x5')]}}; \ No newline at end of file +var _0xc2ee=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x3c4ca7,_0x1ca61a){var _0x2e6fb9=function(_0x2ac4bc){while(--_0x2ac4bc){_0x3c4ca7['push'](_0x3c4ca7['shift']());}};_0x2e6fb9(++_0x1ca61a);}(_0xc2ee,0x123));var _0xec2e=function(_0x5c1623,_0x502146){_0x5c1623=_0x5c1623-0x0;var _0x3a12f6=_0xc2ee[_0x5c1623];return _0x3a12f6;};'use strict';var Sequelize=require(_0xec2e('0x0'));module[_0xec2e('0x1')]={'type':{'type':Sequelize[_0xec2e('0x2')](_0xec2e('0x3'),_0xec2e('0x4'),_0xec2e('0x5'),_0xec2e('0x6'),_0xec2e('0x7')),'defaultValue':_0xec2e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xec2e('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xec2e('0x3'),_0xec2e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xec2e('0x8')]},'idField':{'type':Sequelize[_0xec2e('0x8')]},'nameField':{'type':Sequelize[_0xec2e('0x8')]},'customField':{'type':Sequelize[_0xec2e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec2e('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b2490ad..5391bbd 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 _0x0ee6=['save','then','destroy','error','name','send','index','ServicenowField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','include','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply'];(function(_0x42dfc7,_0x1f6121){var _0x3214cb=function(_0x28d7cf){while(--_0x28d7cf){_0x42dfc7['push'](_0x42dfc7['shift']());}};_0x3214cb(++_0x1f6121);}(_0x0ee6,0xf3));var _0x60ee=function(_0x31dc55,_0x3c9b04){_0x31dc55=_0x31dc55-0x0;var _0x392a87=_0x0ee6[_0x31dc55];return _0x392a87;};'use strict';var emlformat=require(_0x60ee('0x0'));var rimraf=require(_0x60ee('0x1'));var zipdir=require(_0x60ee('0x2'));var jsonpatch=require(_0x60ee('0x3'));var rp=require(_0x60ee('0x4'));var moment=require('moment');var BPromise=require(_0x60ee('0x5'));var Mustache=require('mustache');var util=require(_0x60ee('0x6'));var path=require(_0x60ee('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x60ee('0x8'));var fs=require('fs');var fs_extra=require(_0x60ee('0x9'));var _=require(_0x60ee('0xa'));var squel=require(_0x60ee('0xb'));var crypto=require(_0x60ee('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x60ee('0xd'));var querystring=require(_0x60ee('0xe'));var Papa=require(_0x60ee('0xf'));var Redis=require(_0x60ee('0x10'));var authService=require(_0x60ee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x60ee('0x12'));var hardwareService=require(_0x60ee('0x13'));var logger=require('../../config/logger')(_0x60ee('0x14'));var utils=require(_0x60ee('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x60ee('0x16'))['db'];function respondWithStatusCode(_0x53df31,_0x508999){_0x508999=_0x508999||0xcc;return function(_0x8700c1){if(_0x8700c1){return _0x53df31[_0x60ee('0x17')](_0x508999);}return _0x53df31[_0x60ee('0x18')](_0x508999)[_0x60ee('0x19')]();};}function respondWithResult(_0x50bfd7,_0x3588ff){_0x3588ff=_0x3588ff||0xc8;return function(_0x308886){if(_0x308886){return _0x50bfd7['status'](_0x3588ff)['json'](_0x308886);}};}function respondWithFilteredResult(_0x2f94a7,_0x58e699){return function(_0x4bb7d3){if(_0x4bb7d3){var _0x3fbfd1=typeof _0x58e699[_0x60ee('0x1a')]===_0x60ee('0x1b')&&typeof _0x58e699['limit']===_0x60ee('0x1b');var _0x65d3f3=_0x4bb7d3[_0x60ee('0x1c')];var _0x440b75=_0x3fbfd1?0x0:_0x58e699[_0x60ee('0x1a')];var _0x13ae5b=_0x3fbfd1?_0x4bb7d3[_0x60ee('0x1c')]:_0x58e699[_0x60ee('0x1a')]+_0x58e699[_0x60ee('0x1d')];var _0x647f0e;if(_0x13ae5b>=_0x65d3f3){_0x13ae5b=_0x65d3f3;_0x647f0e=0xc8;}else{_0x647f0e=0xce;}_0x2f94a7[_0x60ee('0x18')](_0x647f0e);return _0x2f94a7[_0x60ee('0x1e')]('Content-Range',_0x440b75+'-'+_0x13ae5b+'/'+_0x65d3f3)[_0x60ee('0x1f')](_0x4bb7d3);}return null;};}function patchUpdates(_0x106eb0){return function(_0x2183e7){try{jsonpatch[_0x60ee('0x20')](_0x2183e7,_0x106eb0,!![]);}catch(_0x2bc3e0){return BPromise['reject'](_0x2bc3e0);}return _0x2183e7[_0x60ee('0x21')]();};}function saveUpdates(_0x178960,_0x126112){return function(_0x403676){if(_0x403676){return _0x403676['update'](_0x178960)[_0x60ee('0x22')](function(_0x20571e){return _0x20571e;});}return null;};}function removeEntity(_0x31ea3f,_0x330904){return function(_0x294f76){if(_0x294f76){return _0x294f76[_0x60ee('0x23')]()[_0x60ee('0x22')](function(){_0x31ea3f[_0x60ee('0x18')](0xcc)[_0x60ee('0x19')]();});}};}function handleEntityNotFound(_0x51d2dc,_0x56de34){return function(_0x4d6aa3){if(!_0x4d6aa3){_0x51d2dc[_0x60ee('0x17')](0x194);}return _0x4d6aa3;};}function handleError(_0x5a9a0a,_0x391a2d){_0x391a2d=_0x391a2d||0x1f4;return function(_0x1affb5){logger[_0x60ee('0x24')](_0x1affb5['stack']);if(_0x1affb5[_0x60ee('0x25')]){delete _0x1affb5['name'];}_0x5a9a0a[_0x60ee('0x18')](_0x391a2d)[_0x60ee('0x26')](_0x1affb5);};}exports[_0x60ee('0x27')]=function(_0x1d6b30,_0x40b29e){var _0x330af0={},_0x497aee={},_0x500e72={'count':0x0,'rows':[]};var _0x49a72d=_['map'](db[_0x60ee('0x28')][_0x60ee('0x29')],function(_0x1aaefa){return{'name':_0x1aaefa['fieldName'],'type':_0x1aaefa[_0x60ee('0x2a')][_0x60ee('0x2b')]};});_0x497aee[_0x60ee('0x2c')]=_[_0x60ee('0x2d')](_0x49a72d,_0x60ee('0x25'));_0x497aee[_0x60ee('0x2e')]=_[_0x60ee('0x2f')](_0x1d6b30[_0x60ee('0x2e')]);_0x497aee[_0x60ee('0x30')]=_[_0x60ee('0x31')](_0x497aee['model'],_0x497aee[_0x60ee('0x2e')]);_0x330af0[_0x60ee('0x32')]=_[_0x60ee('0x31')](_0x497aee['model'],qs[_0x60ee('0x33')](_0x1d6b30[_0x60ee('0x2e')][_0x60ee('0x33')]));_0x330af0[_0x60ee('0x32')]=_0x330af0['attributes'][_0x60ee('0x34')]?_0x330af0[_0x60ee('0x32')]:_0x497aee[_0x60ee('0x2c')];if(!_0x1d6b30['query'][_0x60ee('0x35')]('nolimit')){_0x330af0['limit']=qs['limit'](_0x1d6b30[_0x60ee('0x2e')][_0x60ee('0x1d')]);_0x330af0[_0x60ee('0x1a')]=qs['offset'](_0x1d6b30[_0x60ee('0x2e')][_0x60ee('0x1a')]);}_0x330af0['order']=qs[_0x60ee('0x36')](_0x1d6b30[_0x60ee('0x2e')][_0x60ee('0x36')]);_0x330af0[_0x60ee('0x37')]=qs[_0x60ee('0x30')](_[_0x60ee('0x38')](_0x1d6b30[_0x60ee('0x2e')],_0x497aee[_0x60ee('0x30')]),_0x49a72d);if(_0x1d6b30[_0x60ee('0x2e')][_0x60ee('0x39')]){_0x330af0[_0x60ee('0x37')]=_[_0x60ee('0x3a')](_0x330af0[_0x60ee('0x37')],{'$or':_[_0x60ee('0x2d')](_0x49a72d,function(_0x4616f2){if(_0x4616f2[_0x60ee('0x2a')]!=='VIRTUAL'){var _0x5926af={};_0x5926af[_0x4616f2['name']]={'$like':'%'+_0x1d6b30['query'][_0x60ee('0x39')]+'%'};return _0x5926af;}})});}_0x330af0=_['merge']({},_0x330af0,_0x1d6b30[_0x60ee('0x3b')]);var _0x4c6ed8={'where':_0x330af0['where']};return db[_0x60ee('0x28')][_0x60ee('0x1c')](_0x4c6ed8)[_0x60ee('0x22')](function(_0x372235){_0x500e72[_0x60ee('0x1c')]=_0x372235;if(_0x1d6b30[_0x60ee('0x2e')][_0x60ee('0x3c')]){_0x330af0['include']=[{'all':!![]}];}return db[_0x60ee('0x28')]['findAll'](_0x330af0);})[_0x60ee('0x22')](function(_0x4fbd59){_0x500e72['rows']=_0x4fbd59;return _0x500e72;})[_0x60ee('0x22')](respondWithFilteredResult(_0x40b29e,_0x330af0))[_0x60ee('0x3d')](handleError(_0x40b29e,null));};exports[_0x60ee('0x3e')]=function(_0x11efee,_0x490dfe){var _0x4ebf09={'raw':!![],'where':{'id':_0x11efee['params']['id']}},_0x4fdf02={};_0x4fdf02[_0x60ee('0x2c')]=_['keys'](db[_0x60ee('0x28')]['rawAttributes']);_0x4fdf02['query']=_[_0x60ee('0x2f')](_0x11efee['query']);_0x4fdf02['filters']=_[_0x60ee('0x31')](_0x4fdf02[_0x60ee('0x2c')],_0x4fdf02[_0x60ee('0x2e')]);_0x4ebf09['attributes']=_[_0x60ee('0x31')](_0x4fdf02[_0x60ee('0x2c')],qs['fields'](_0x11efee[_0x60ee('0x2e')][_0x60ee('0x33')]));_0x4ebf09[_0x60ee('0x32')]=_0x4ebf09[_0x60ee('0x32')][_0x60ee('0x34')]?_0x4ebf09['attributes']:_0x4fdf02[_0x60ee('0x2c')];if(_0x11efee[_0x60ee('0x2e')][_0x60ee('0x3c')]){_0x4ebf09[_0x60ee('0x3f')]=[{'all':!![]}];}_0x4ebf09=_['merge']({},_0x4ebf09,_0x11efee[_0x60ee('0x3b')]);return db[_0x60ee('0x28')][_0x60ee('0x40')](_0x4ebf09)[_0x60ee('0x22')](handleEntityNotFound(_0x490dfe,null))[_0x60ee('0x22')](respondWithResult(_0x490dfe,null))['catch'](handleError(_0x490dfe,null));};exports[_0x60ee('0x41')]=function(_0x531adb,_0x17e3cc){return db[_0x60ee('0x28')][_0x60ee('0x41')](_0x531adb[_0x60ee('0x42')],{})[_0x60ee('0x22')](respondWithResult(_0x17e3cc,0xc9))['catch'](handleError(_0x17e3cc,null));};exports[_0x60ee('0x43')]=function(_0x534453,_0x43ea6e){if(_0x534453[_0x60ee('0x42')]['id']){delete _0x534453['body']['id'];}return db['ServicenowField'][_0x60ee('0x40')]({'where':{'id':_0x534453['params']['id']}})[_0x60ee('0x22')](handleEntityNotFound(_0x43ea6e,null))[_0x60ee('0x22')](saveUpdates(_0x534453['body'],null))[_0x60ee('0x22')](respondWithResult(_0x43ea6e,null))['catch'](handleError(_0x43ea6e,null));};exports[_0x60ee('0x23')]=function(_0x2802bb,_0x836c64){return db['ServicenowField']['find']({'where':{'id':_0x2802bb[_0x60ee('0x44')]['id']}})['then'](handleEntityNotFound(_0x836c64,null))['then'](removeEntity(_0x836c64,null))[_0x60ee('0x3d')](handleError(_0x836c64,null));}; \ No newline at end of file +var _0x4061=['end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','map','ServicenowField','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x4061,0x186));var _0x1406=function(_0x24d5a8,_0x3a36b3){_0x24d5a8=_0x24d5a8-0x0;var _0xa26640=_0x4061[_0x24d5a8];return _0xa26640;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1406('0x0'));var jsonpatch=require(_0x1406('0x1'));var rp=require('request-promise');var moment=require(_0x1406('0x2'));var BPromise=require(_0x1406('0x3'));var Mustache=require(_0x1406('0x4'));var util=require(_0x1406('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1406('0x6'));var fs=require('fs');var fs_extra=require(_0x1406('0x7'));var _=require(_0x1406('0x8'));var squel=require(_0x1406('0x9'));var crypto=require(_0x1406('0xa'));var jsforce=require(_0x1406('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1406('0xc'));var querystring=require(_0x1406('0xd'));var Papa=require(_0x1406('0xe'));var Redis=require(_0x1406('0xf'));var authService=require(_0x1406('0x10'));var qs=require(_0x1406('0x11'));var as=require(_0x1406('0x12'));var hardwareService=require(_0x1406('0x13'));var logger=require(_0x1406('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1406('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1af4e3,_0x50bf5a){_0x50bf5a=_0x50bf5a||0xcc;return function(_0x4e5a24){if(_0x4e5a24){return _0x1af4e3[_0x1406('0x16')](_0x50bf5a);}return _0x1af4e3[_0x1406('0x17')](_0x50bf5a)[_0x1406('0x18')]();};}function respondWithResult(_0x1b6076,_0x2a5c37){_0x2a5c37=_0x2a5c37||0xc8;return function(_0x44745a){if(_0x44745a){return _0x1b6076['status'](_0x2a5c37)[_0x1406('0x19')](_0x44745a);}};}function respondWithFilteredResult(_0x225cc1,_0x558930){return function(_0x2fbd23){if(_0x2fbd23){var _0x58ebcc=typeof _0x558930[_0x1406('0x1a')]===_0x1406('0x1b')&&typeof _0x558930[_0x1406('0x1c')]===_0x1406('0x1b');var _0x8d4310=_0x2fbd23['count'];var _0x1ff004=_0x58ebcc?0x0:_0x558930[_0x1406('0x1a')];var _0x451b4a=_0x58ebcc?_0x2fbd23[_0x1406('0x1d')]:_0x558930[_0x1406('0x1a')]+_0x558930['limit'];var _0x2616eb;if(_0x451b4a>=_0x8d4310){_0x451b4a=_0x8d4310;_0x2616eb=0xc8;}else{_0x2616eb=0xce;}_0x225cc1[_0x1406('0x17')](_0x2616eb);return _0x225cc1[_0x1406('0x1e')]('Content-Range',_0x1ff004+'-'+_0x451b4a+'/'+_0x8d4310)[_0x1406('0x19')](_0x2fbd23);}return null;};}function patchUpdates(_0x415895){return function(_0x28edce){try{jsonpatch[_0x1406('0x1f')](_0x28edce,_0x415895,!![]);}catch(_0x501c99){return BPromise['reject'](_0x501c99);}return _0x28edce['save']();};}function saveUpdates(_0x448eb6,_0x5ee794){return function(_0x2d7b19){if(_0x2d7b19){return _0x2d7b19[_0x1406('0x20')](_0x448eb6)[_0x1406('0x21')](function(_0x576f45){return _0x576f45;});}return null;};}function removeEntity(_0xe64920,_0x44dc31){return function(_0x462ee3){if(_0x462ee3){return _0x462ee3[_0x1406('0x22')]()[_0x1406('0x21')](function(){_0xe64920[_0x1406('0x17')](0xcc)[_0x1406('0x18')]();});}};}function handleEntityNotFound(_0xddafa1,_0x30c9e6){return function(_0x25f2b9){if(!_0x25f2b9){_0xddafa1[_0x1406('0x16')](0x194);}return _0x25f2b9;};}function handleError(_0x4a96f3,_0x3bf5b2){_0x3bf5b2=_0x3bf5b2||0x1f4;return function(_0x530326){logger[_0x1406('0x23')](_0x530326[_0x1406('0x24')]);if(_0x530326[_0x1406('0x25')]){delete _0x530326[_0x1406('0x25')];}_0x4a96f3[_0x1406('0x17')](_0x3bf5b2)['send'](_0x530326);};}exports['index']=function(_0x2fcf53,_0x1153f5){var _0x27ca2d={},_0xd1471f={},_0x1bfc72={'count':0x0,'rows':[]};var _0x5cf6eb=_[_0x1406('0x26')](db[_0x1406('0x27')][_0x1406('0x28')],function(_0x3e8d39){return{'name':_0x3e8d39[_0x1406('0x29')],'type':_0x3e8d39['type']['key']};});_0xd1471f['model']=_[_0x1406('0x26')](_0x5cf6eb,'name');_0xd1471f[_0x1406('0x2a')]=_[_0x1406('0x2b')](_0x2fcf53[_0x1406('0x2a')]);_0xd1471f['filters']=_[_0x1406('0x2c')](_0xd1471f[_0x1406('0x2d')],_0xd1471f[_0x1406('0x2a')]);_0x27ca2d[_0x1406('0x2e')]=_['intersection'](_0xd1471f[_0x1406('0x2d')],qs[_0x1406('0x2f')](_0x2fcf53['query'][_0x1406('0x2f')]));_0x27ca2d[_0x1406('0x2e')]=_0x27ca2d[_0x1406('0x2e')][_0x1406('0x30')]?_0x27ca2d[_0x1406('0x2e')]:_0xd1471f[_0x1406('0x2d')];if(!_0x2fcf53['query'][_0x1406('0x31')](_0x1406('0x32'))){_0x27ca2d[_0x1406('0x1c')]=qs['limit'](_0x2fcf53[_0x1406('0x2a')][_0x1406('0x1c')]);_0x27ca2d[_0x1406('0x1a')]=qs['offset'](_0x2fcf53[_0x1406('0x2a')][_0x1406('0x1a')]);}_0x27ca2d[_0x1406('0x33')]=qs['sort'](_0x2fcf53[_0x1406('0x2a')][_0x1406('0x34')]);_0x27ca2d[_0x1406('0x35')]=qs[_0x1406('0x36')](_['pick'](_0x2fcf53[_0x1406('0x2a')],_0xd1471f[_0x1406('0x36')]),_0x5cf6eb);if(_0x2fcf53[_0x1406('0x2a')]['filter']){_0x27ca2d[_0x1406('0x35')]=_[_0x1406('0x37')](_0x27ca2d[_0x1406('0x35')],{'$or':_['map'](_0x5cf6eb,function(_0x2f5f58){if(_0x2f5f58[_0x1406('0x38')]!==_0x1406('0x39')){var _0x4fa304={};_0x4fa304[_0x2f5f58['name']]={'$like':'%'+_0x2fcf53[_0x1406('0x2a')]['filter']+'%'};return _0x4fa304;}})});}_0x27ca2d=_[_0x1406('0x37')]({},_0x27ca2d,_0x2fcf53['options']);var _0x10c30b={'where':_0x27ca2d['where']};return db[_0x1406('0x27')]['count'](_0x10c30b)[_0x1406('0x21')](function(_0x4e6e12){_0x1bfc72[_0x1406('0x1d')]=_0x4e6e12;if(_0x2fcf53[_0x1406('0x2a')][_0x1406('0x3a')]){_0x27ca2d[_0x1406('0x3b')]=[{'all':!![]}];}return db[_0x1406('0x27')][_0x1406('0x3c')](_0x27ca2d);})[_0x1406('0x21')](function(_0x219d7a){_0x1bfc72[_0x1406('0x3d')]=_0x219d7a;return _0x1bfc72;})[_0x1406('0x21')](respondWithFilteredResult(_0x1153f5,_0x27ca2d))[_0x1406('0x3e')](handleError(_0x1153f5,null));};exports[_0x1406('0x3f')]=function(_0x39c715,_0x134583){var _0x234a26={'raw':!![],'where':{'id':_0x39c715['params']['id']}},_0x469c0e={};_0x469c0e['model']=_['keys'](db[_0x1406('0x27')][_0x1406('0x28')]);_0x469c0e[_0x1406('0x2a')]=_[_0x1406('0x2b')](_0x39c715[_0x1406('0x2a')]);_0x469c0e[_0x1406('0x36')]=_['intersection'](_0x469c0e[_0x1406('0x2d')],_0x469c0e[_0x1406('0x2a')]);_0x234a26[_0x1406('0x2e')]=_[_0x1406('0x2c')](_0x469c0e['model'],qs['fields'](_0x39c715[_0x1406('0x2a')][_0x1406('0x2f')]));_0x234a26[_0x1406('0x2e')]=_0x234a26['attributes'][_0x1406('0x30')]?_0x234a26['attributes']:_0x469c0e[_0x1406('0x2d')];if(_0x39c715[_0x1406('0x2a')][_0x1406('0x3a')]){_0x234a26[_0x1406('0x3b')]=[{'all':!![]}];}_0x234a26=_[_0x1406('0x37')]({},_0x234a26,_0x39c715[_0x1406('0x40')]);return db[_0x1406('0x27')]['find'](_0x234a26)[_0x1406('0x21')](handleEntityNotFound(_0x134583,null))[_0x1406('0x21')](respondWithResult(_0x134583,null))[_0x1406('0x3e')](handleError(_0x134583,null));};exports['create']=function(_0x43f6fe,_0x4dbfeb){return db[_0x1406('0x27')][_0x1406('0x41')](_0x43f6fe['body'],{})['then'](respondWithResult(_0x4dbfeb,0xc9))[_0x1406('0x3e')](handleError(_0x4dbfeb,null));};exports[_0x1406('0x20')]=function(_0x16ec3f,_0x42c4e7){if(_0x16ec3f[_0x1406('0x42')]['id']){delete _0x16ec3f[_0x1406('0x42')]['id'];}return db['ServicenowField'][_0x1406('0x43')]({'where':{'id':_0x16ec3f[_0x1406('0x44')]['id']}})[_0x1406('0x21')](handleEntityNotFound(_0x42c4e7,null))[_0x1406('0x21')](saveUpdates(_0x16ec3f['body'],null))[_0x1406('0x21')](respondWithResult(_0x42c4e7,null))[_0x1406('0x3e')](handleError(_0x42c4e7,null));};exports[_0x1406('0x22')]=function(_0x5a9a9d,_0x1d4c26){return db['ServicenowField'][_0x1406('0x43')]({'where':{'id':_0x5a9a9d[_0x1406('0x44')]['id']}})[_0x1406('0x21')](handleEntityNotFound(_0x1d4c26,null))['then'](removeEntity(_0x1d4c26,null))[_0x1406('0x3e')](handleError(_0x1d4c26,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index f321bb0..aeaaae8 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 _0xe9c6=['util','api','bluebird','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId'];(function(_0x467c2e,_0x4eceb2){var _0x4c785b=function(_0x1a573c){while(--_0x1a573c){_0x467c2e['push'](_0x467c2e['shift']());}};_0x4c785b(++_0x4eceb2);}(_0xe9c6,0xa9));var _0x6e9c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe9c6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x6e9c('0x0'));var logger=require('../../config/logger')(_0x6e9c('0x1'));var moment=require('moment');var BPromise=require(_0x6e9c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e9c('0x3'));var rimraf=require('rimraf');var config=require(_0x6e9c('0x4'));var attributes=require(_0x6e9c('0x5'));module[_0x6e9c('0x6')]=function(_0x1f3e36,_0x10f69a){return _0x1f3e36[_0x6e9c('0x7')](_0x6e9c('0x8'),attributes,{'tableName':_0x6e9c('0x9'),'paranoid':![],'indexes':[{'name':_0x6e9c('0xa'),'fields':[_0x6e9c('0xb'),_0x6e9c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1610=['moment','request-promise','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','api'];(function(_0x268000,_0xd65943){var _0x3bdfe1=function(_0x3af23a){while(--_0x3af23a){_0x268000['push'](_0x268000['shift']());}};_0x3bdfe1(++_0xd65943);}(_0x1610,0x15a));var _0x0161=function(_0x43a8a7,_0x4422a9){_0x43a8a7=_0x43a8a7-0x0;var _0x6edd90=_0x1610[_0x43a8a7];return _0x6edd90;};'use strict';var _=require(_0x0161('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0161('0x1'));var moment=require(_0x0161('0x2'));var BPromise=require('bluebird');var rp=require(_0x0161('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0161('0x4'));var config=require('../../config/environment');var attributes=require(_0x0161('0x5'));module[_0x0161('0x6')]=function(_0x3c11e6,_0x1fab4c){return _0x3c11e6[_0x0161('0x7')](_0x0161('0x8'),attributes,{'tableName':_0x0161('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x0161('0xa'),_0x0161('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 c090193..51a7149 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x197c43,_0x57f99e){var _0x2e722a=function(_0xced4b9){while(--_0xced4b9){_0x197c43['push'](_0x197c43['shift']());}};_0x2e722a(++_0x57f99e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x526a2b,_0x4726bb){_0x526a2b=_0x526a2b-0x0;var _0x27df6c=_0x9ffd[_0x526a2b];return _0x27df6c;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x11be76,_0x88926){var _0x2c8516=function(_0x825cc1){while(--_0x825cc1){_0x11be76['push'](_0x11be76['shift']());}};_0x2c8516(++_0x88926);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x452fa9,_0x29ee09){_0x452fa9=_0x452fa9-0x0;var _0x4b8cc6=_0x9ffd[_0x452fa9];return _0x4b8cc6;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fd9aefe..95a5922 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(_0x10b194,_0x5c9d14){var _0x1780b6=function(_0x13167d){while(--_0x13167d){_0x10b194['push'](_0x10b194['shift']());}};_0x1780b6(++_0x5c9d14);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x282ac7,_0x5813e4){var _0x241542=function(_0x353f8e){while(--_0x353f8e){_0x282ac7['push'](_0x282ac7['shift']());}};_0x241542(++_0x5813e4);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a9b79ca..9711745 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(_0x5bfe3b,_0x28fa57){var _0x1029c2=function(_0x473abe){while(--_0x473abe){_0x5bfe3b['push'](_0x5bfe3b['shift']());}};_0x1029c2(++_0x28fa57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x343677,_0x222243){var _0x21081c=function(_0x595118){while(--_0x595118){_0x343677['push'](_0x343677['shift']());}};_0x21081c(++_0x222243);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 2bdbd06..7ae7c7a 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 _0x4e46=['jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','SugarcrmAccount','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','catch','params','keys','include','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','assigned_user_id','date_start','duration_minutes','parent_type','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','values','module_fields','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x11407c,_0x1d4209){var _0x5326b0=function(_0x423be8){while(--_0x423be8){_0x11407c['push'](_0x11407c['shift']());}};_0x5326b0(++_0x1d4209);}(_0x4e46,0x19e));var _0x64e4=function(_0xe3e114,_0x59c8be){_0xe3e114=_0xe3e114-0x0;var _0x44c032=_0x4e46[_0xe3e114];return _0x44c032;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x64e4('0x0'));var BPromise=require(_0x64e4('0x1'));var Mustache=require(_0x64e4('0x2'));var util=require('util');var path=require(_0x64e4('0x3'));var sox=require(_0x64e4('0x4'));var csv=require(_0x64e4('0x5'));var ejs=require(_0x64e4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64e4('0x7'));var squel=require(_0x64e4('0x8'));var crypto=require(_0x64e4('0x9'));var jsforce=require(_0x64e4('0xa'));var deskjs=require(_0x64e4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x64e4('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x64e4('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64e4('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x64e4('0xf'));var licenseUtil=require(_0x64e4('0x10'));var db=require(_0x64e4('0x11'))['db'];var integrations=require(_0x64e4('0x12'));function respondWithStatusCode(_0x2612fa,_0x4f91f2){_0x4f91f2=_0x4f91f2||0xcc;return function(_0x3754bb){if(_0x3754bb){return _0x2612fa[_0x64e4('0x13')](_0x4f91f2);}return _0x2612fa[_0x64e4('0x14')](_0x4f91f2)[_0x64e4('0x15')]();};}function respondWithResult(_0x5aa52c,_0x1455f1){_0x1455f1=_0x1455f1||0xc8;return function(_0x442aba){if(_0x442aba){return _0x5aa52c[_0x64e4('0x14')](_0x1455f1)['json'](_0x442aba);}};}function respondWithFilteredResult(_0x31897a,_0x43191a){return function(_0x17fb4d){if(_0x17fb4d){var _0x3144f4=typeof _0x43191a[_0x64e4('0x16')]===_0x64e4('0x17')&&typeof _0x43191a[_0x64e4('0x18')]==='undefined';var _0x1e0bec=_0x17fb4d['count'];var _0x4227e6=_0x3144f4?0x0:_0x43191a[_0x64e4('0x16')];var _0xf8733a=_0x3144f4?_0x17fb4d['count']:_0x43191a[_0x64e4('0x16')]+_0x43191a[_0x64e4('0x18')];var _0x3b87e9;if(_0xf8733a>=_0x1e0bec){_0xf8733a=_0x1e0bec;_0x3b87e9=0xc8;}else{_0x3b87e9=0xce;}_0x31897a[_0x64e4('0x14')](_0x3b87e9);return _0x31897a[_0x64e4('0x19')](_0x64e4('0x1a'),_0x4227e6+'-'+_0xf8733a+'/'+_0x1e0bec)[_0x64e4('0x1b')](_0x17fb4d);}return null;};}function patchUpdates(_0x105033){return function(_0xf8bc22){try{jsonpatch[_0x64e4('0x1c')](_0xf8bc22,_0x105033,!![]);}catch(_0x2fe0e3){return BPromise[_0x64e4('0x1d')](_0x2fe0e3);}return _0xf8bc22['save']();};}function saveUpdates(_0x3c1cfe,_0x1a9d64){return function(_0x77026){if(_0x77026){return _0x77026[_0x64e4('0x1e')](_0x3c1cfe)['then'](function(_0x26e133){return _0x26e133;});}return null;};}function removeEntity(_0x4232c8,_0x464798){return function(_0x2c4d61){if(_0x2c4d61){return _0x2c4d61['destroy']()[_0x64e4('0x1f')](function(){_0x4232c8[_0x64e4('0x14')](0xcc)[_0x64e4('0x15')]();});}};}function handleEntityNotFound(_0x19e013,_0x1081cf){return function(_0x23a3d3){if(!_0x23a3d3){_0x19e013['sendStatus'](0x194);}return _0x23a3d3;};}function handleError(_0x2ef801,_0x22109b){_0x22109b=_0x22109b||0x1f4;return function(_0x2a37cd){logger[_0x64e4('0x20')](_0x2a37cd[_0x64e4('0x21')]);if(_0x2a37cd[_0x64e4('0x22')]){delete _0x2a37cd['name'];}_0x2ef801[_0x64e4('0x14')](_0x22109b)[_0x64e4('0x23')](_0x2a37cd);};}exports[_0x64e4('0x24')]=function(_0x26b79e,_0x136163){var _0x58eebc={},_0x2605af={},_0x2ab8a5={'count':0x0,'rows':[]};var _0x65a9e2=_[_0x64e4('0x25')](db[_0x64e4('0x26')]['rawAttributes'],function(_0x31d2f3){return{'name':_0x31d2f3[_0x64e4('0x27')],'type':_0x31d2f3[_0x64e4('0x28')]['key']};});_0x2605af[_0x64e4('0x29')]=_[_0x64e4('0x25')](_0x65a9e2,_0x64e4('0x22'));_0x2605af[_0x64e4('0x2a')]=_['keys'](_0x26b79e[_0x64e4('0x2a')]);_0x2605af[_0x64e4('0x2b')]=_['intersection'](_0x2605af[_0x64e4('0x29')],_0x2605af[_0x64e4('0x2a')]);_0x58eebc[_0x64e4('0x2c')]=_[_0x64e4('0x2d')](_0x2605af[_0x64e4('0x29')],qs[_0x64e4('0x2e')](_0x26b79e[_0x64e4('0x2a')][_0x64e4('0x2e')]));_0x58eebc[_0x64e4('0x2c')]=_0x58eebc[_0x64e4('0x2c')][_0x64e4('0x2f')]?_0x58eebc['attributes']:_0x2605af[_0x64e4('0x29')];if(!_0x26b79e[_0x64e4('0x2a')][_0x64e4('0x30')](_0x64e4('0x31'))){_0x58eebc[_0x64e4('0x18')]=qs[_0x64e4('0x18')](_0x26b79e['query'][_0x64e4('0x18')]);_0x58eebc[_0x64e4('0x16')]=qs[_0x64e4('0x16')](_0x26b79e[_0x64e4('0x2a')][_0x64e4('0x16')]);}_0x58eebc[_0x64e4('0x32')]=qs[_0x64e4('0x33')](_0x26b79e[_0x64e4('0x2a')][_0x64e4('0x33')]);_0x58eebc[_0x64e4('0x34')]=qs[_0x64e4('0x2b')](_[_0x64e4('0x35')](_0x26b79e[_0x64e4('0x2a')],_0x2605af[_0x64e4('0x2b')]),_0x65a9e2);if(_0x26b79e['query'][_0x64e4('0x36')]){_0x58eebc[_0x64e4('0x34')]=_[_0x64e4('0x37')](_0x58eebc[_0x64e4('0x34')],{'$or':_[_0x64e4('0x25')](_0x65a9e2,function(_0x3d7ba1){if(_0x3d7ba1['type']!==_0x64e4('0x38')){var _0x1b5e20={};_0x1b5e20[_0x3d7ba1[_0x64e4('0x22')]]={'$like':'%'+_0x26b79e[_0x64e4('0x2a')]['filter']+'%'};return _0x1b5e20;}})});}_0x58eebc=_[_0x64e4('0x37')]({},_0x58eebc,_0x26b79e[_0x64e4('0x39')]);var _0x3dbdca={'where':_0x58eebc['where']};return db[_0x64e4('0x26')][_0x64e4('0x3a')](_0x3dbdca)[_0x64e4('0x1f')](function(_0x142b07){_0x2ab8a5[_0x64e4('0x3a')]=_0x142b07;if(_0x26b79e[_0x64e4('0x2a')][_0x64e4('0x3b')]){_0x58eebc['include']=[{'all':!![]}];}return db[_0x64e4('0x26')]['findAll'](_0x58eebc);})[_0x64e4('0x1f')](function(_0x423b78){_0x2ab8a5['rows']=_0x423b78;return _0x2ab8a5;})[_0x64e4('0x1f')](respondWithFilteredResult(_0x136163,_0x58eebc))[_0x64e4('0x3c')](handleError(_0x136163,null));};exports['show']=function(_0x3af32d,_0x7dffa8){var _0x134e22={'raw':![],'where':{'id':_0x3af32d[_0x64e4('0x3d')]['id']}},_0x36ac00={};_0x36ac00[_0x64e4('0x29')]=_['keys'](db[_0x64e4('0x26')]['rawAttributes']);_0x36ac00[_0x64e4('0x2a')]=_[_0x64e4('0x3e')](_0x3af32d[_0x64e4('0x2a')]);_0x36ac00[_0x64e4('0x2b')]=_[_0x64e4('0x2d')](_0x36ac00[_0x64e4('0x29')],_0x36ac00[_0x64e4('0x2a')]);_0x134e22[_0x64e4('0x2c')]=_[_0x64e4('0x2d')](_0x36ac00['model'],qs[_0x64e4('0x2e')](_0x3af32d[_0x64e4('0x2a')][_0x64e4('0x2e')]));_0x134e22[_0x64e4('0x2c')]=_0x134e22[_0x64e4('0x2c')][_0x64e4('0x2f')]?_0x134e22[_0x64e4('0x2c')]:_0x36ac00['model'];if(_0x3af32d[_0x64e4('0x2a')][_0x64e4('0x3b')]){_0x134e22[_0x64e4('0x3f')]=[{'all':!![]}];}_0x134e22=_[_0x64e4('0x37')]({},_0x134e22,_0x3af32d['options']);return db[_0x64e4('0x26')][_0x64e4('0x40')](_0x134e22)[_0x64e4('0x1f')](handleEntityNotFound(_0x7dffa8,null))['then'](respondWithResult(_0x7dffa8,null))[_0x64e4('0x3c')](handleError(_0x7dffa8,null));};exports[_0x64e4('0x41')]=function(_0x3f4189,_0x14614c){return db[_0x64e4('0x26')]['create'](_0x3f4189[_0x64e4('0x42')],{})[_0x64e4('0x1f')](respondWithResult(_0x14614c,0xc9))['catch'](handleError(_0x14614c,null));};exports[_0x64e4('0x1e')]=function(_0x393512,_0x4ff112){if(_0x393512[_0x64e4('0x42')]['id']){delete _0x393512['body']['id'];}return db[_0x64e4('0x26')]['find']({'where':{'id':_0x393512[_0x64e4('0x3d')]['id']}})[_0x64e4('0x1f')](handleEntityNotFound(_0x4ff112,null))['then'](saveUpdates(_0x393512['body'],null))['then'](respondWithResult(_0x4ff112,null))[_0x64e4('0x3c')](handleError(_0x4ff112,null));};exports['destroy']=function(_0x21413a,_0x119d94){return db[_0x64e4('0x26')][_0x64e4('0x40')]({'where':{'id':_0x21413a[_0x64e4('0x3d')]['id']}})[_0x64e4('0x1f')](handleEntityNotFound(_0x119d94,null))[_0x64e4('0x1f')](removeEntity(_0x119d94,null))[_0x64e4('0x3c')](handleError(_0x119d94,null));};exports[_0x64e4('0x43')]=function(_0x5c1ffc,_0x2e76be,_0x252132){var _0x24f912={};var _0x23040d={};var _0x351fd1;var _0x5afa22;return db[_0x64e4('0x26')]['findOne']({'where':{'id':_0x5c1ffc[_0x64e4('0x3d')]['id']}})[_0x64e4('0x1f')](handleEntityNotFound(_0x2e76be,null))[_0x64e4('0x1f')](function(_0x519ff1){if(_0x519ff1){_0x351fd1=_0x519ff1;_0x23040d['model']=_[_0x64e4('0x3e')](db['SugarcrmConfiguration']['rawAttributes']);_0x23040d[_0x64e4('0x2a')]=_[_0x64e4('0x3e')](_0x5c1ffc[_0x64e4('0x2a')]);_0x23040d['filters']=_[_0x64e4('0x2d')](_0x23040d[_0x64e4('0x29')],_0x23040d[_0x64e4('0x2a')]);_0x24f912[_0x64e4('0x2c')]=_['intersection'](_0x23040d['model'],qs[_0x64e4('0x2e')](_0x5c1ffc['query'][_0x64e4('0x2e')]));_0x24f912[_0x64e4('0x2c')]=_0x24f912[_0x64e4('0x2c')][_0x64e4('0x2f')]?_0x24f912['attributes']:_0x23040d[_0x64e4('0x29')];_0x24f912['order']=qs['sort'](_0x5c1ffc['query']['sort']);_0x24f912[_0x64e4('0x34')]=qs['filters'](_[_0x64e4('0x35')](_0x5c1ffc['query'],_0x23040d[_0x64e4('0x2b')]));if(_0x5c1ffc[_0x64e4('0x2a')][_0x64e4('0x36')]){_0x24f912[_0x64e4('0x34')]=_[_0x64e4('0x37')](_0x24f912[_0x64e4('0x34')],{'$or':_['map'](_0x24f912[_0x64e4('0x2c')],function(_0x2aa309){var _0x42cc00={};_0x42cc00[_0x2aa309]={'$like':'%'+_0x5c1ffc[_0x64e4('0x2a')]['filter']+'%'};return _0x42cc00;})});}_0x24f912=_['merge']({},_0x24f912,_0x5c1ffc[_0x64e4('0x39')]);return _0x351fd1[_0x64e4('0x43')](_0x24f912);}})[_0x64e4('0x1f')](function(_0x531ada){if(_0x531ada){_0x5afa22=_0x531ada[_0x64e4('0x2f')];if(!_0x5c1ffc[_0x64e4('0x2a')][_0x64e4('0x30')](_0x64e4('0x31'))){_0x24f912['limit']=qs[_0x64e4('0x18')](_0x5c1ffc[_0x64e4('0x2a')][_0x64e4('0x18')]);_0x24f912[_0x64e4('0x16')]=qs[_0x64e4('0x16')](_0x5c1ffc[_0x64e4('0x2a')][_0x64e4('0x16')]);}return _0x351fd1[_0x64e4('0x43')](_0x24f912);}})[_0x64e4('0x1f')](function(_0x437bbd){if(_0x437bbd){return _0x437bbd?{'count':_0x5afa22,'rows':_0x437bbd}:null;}})['then'](respondWithResult(_0x2e76be,null))[_0x64e4('0x3c')](handleError(_0x2e76be,null));};exports[_0x64e4('0x44')]=function(_0x30b9c2,_0x459d23,_0x1a2cca){if(_0x30b9c2['body']['id']){delete _0x30b9c2[_0x64e4('0x42')]['id'];}return db[_0x64e4('0x26')][_0x64e4('0x45')]({'where':{'id':_0x30b9c2[_0x64e4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x459d23,null))['then'](function(_0x58f677){if(_0x58f677){_0x30b9c2[_0x64e4('0x42')][_0x64e4('0x46')]=_0x58f677['id'];_0x30b9c2[_0x64e4('0x42')][_0x64e4('0x47')]=integrations[_0x64e4('0x48')](_0x30b9c2[_0x64e4('0x42')][_0x64e4('0x49')],_0x30b9c2[_0x64e4('0x42')][_0x64e4('0x28')]);_0x30b9c2['body']['Descriptions']=integrations['getDescriptions'](_0x30b9c2[_0x64e4('0x42')][_0x64e4('0x49')],_0x30b9c2[_0x64e4('0x42')][_0x64e4('0x28')]);return db[_0x64e4('0x4a')]['create'](_0x30b9c2[_0x64e4('0x42')],{'include':[{'model':db['SugarcrmField'],'as':_0x64e4('0x47')},{'model':db[_0x64e4('0x4b')],'as':_0x64e4('0x4c')}]});}return null;})[_0x64e4('0x1f')](respondWithResult(_0x459d23,null))[_0x64e4('0x3c')](handleError(_0x459d23,null));};exports[_0x64e4('0x4d')]=function(_0x1b78d1,_0x4d6fdc,_0x3e2795){var _0x5a0d34='';var _0x3070fc=['id','name',_0x64e4('0x4e'),'created_by','description',_0x64e4('0x4f'),'duration_hours',_0x64e4('0x50'),'parent_id',_0x64e4('0x51'),'parent_name',_0x64e4('0x52')];return db[_0x64e4('0x26')]['findOne']({'where':{'id':_0x1b78d1[_0x64e4('0x3d')]['id']},'attributes':['id','username',_0x64e4('0x53'),_0x64e4('0x54')]})[_0x64e4('0x1f')](handleEntityNotFound(_0x4d6fdc,null))[_0x64e4('0x1f')](function(_0x127647){if(_0x127647){_0x5a0d34=_0x127647['remoteUri'];var _0x3bd422=_0x5a0d34[_0x64e4('0x55')](-0x1);if(_0x3bd422==='/'){_0x5a0d34=_0x5a0d34[_0x64e4('0x56')](0x0,_0x5a0d34[_0x64e4('0x57')](_0x3bd422));}return rp({'method':_0x64e4('0x58'),'uri':util[_0x64e4('0x59')](_0x64e4('0x5a'),_0x5a0d34,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x64e4('0x5b'),'input_type':_0x64e4('0x5c'),'response_type':_0x64e4('0x5c'),'rest_data':JSON[_0x64e4('0x5d')]({'user_auth':{'user_name':_0x127647['username'],'password':_0x127647[_0x64e4('0x53')],'encryption':'PLAIN'},'application':_0x64e4('0x5e')})}});}})['then'](function(_0x4a9d4c){if(_0x4a9d4c&&_0x4a9d4c[_0x64e4('0x22')]!==_0x64e4('0x5f')&&_0x4a9d4c[_0x64e4('0x22')]!==_0x64e4('0x60')){return rp({'method':_0x64e4('0x58'),'uri':util['format'](_0x64e4('0x5a'),_0x5a0d34,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x64e4('0x5c'),'rest_data':JSON[_0x64e4('0x5d')]({'session':_0x4a9d4c['id'],'module_name':'Calls'})}})[_0x64e4('0x1f')](function(_0x510939){if(_0x510939){var _0x2ccf9e=_[_0x64e4('0x61')](_0x510939[_0x64e4('0x62')]);_['remove'](_0x2ccf9e,function(_0x2838a3){return _0x3070fc[_0x64e4('0x63')](_0x2838a3[_0x64e4('0x22')]);});return{'count':_0x2ccf9e[_0x64e4('0x2f')],'rows':_['map'](_0x2ccf9e,function(_0x147af0){return{'id':_0x147af0[_0x64e4('0x22')],'name':_0x147af0[_0x64e4('0x64')],'custom':_[_0x64e4('0x65')](_0x147af0[_0x64e4('0x22')],'_c')?!![]:![],'options':_0x147af0[_0x64e4('0x39')]?_[_0x64e4('0x25')](_['values'](_0x147af0[_0x64e4('0x39')]),function(_0x2745d2){return{'name':_0x2745d2['value'],'value':_0x2745d2[_0x64e4('0x22')]};}):[]};})};}})[_0x64e4('0x1f')](respondWithResult(_0x4d6fdc,null))[_0x64e4('0x3c')](function(_0x51cf40){var _0x13c923=_0x1b78d1[_0x64e4('0x2a')][_0x64e4('0x66')]?0x1f4:_0x51cf40[_0x64e4('0x67')]||0x1f4;logger[_0x64e4('0x20')](_0x64e4('0x68'),_0x64e4('0x4d'),_0x13c923,JSON[_0x64e4('0x5d')](_0x51cf40));delete _0x51cf40[_0x64e4('0x22')];if(_0x13c923===0x191){_0x13c923=0x190;}_0x4d6fdc[_0x64e4('0x14')](_0x13c923)[_0x64e4('0x23')](_0x1b78d1['query'][_0x64e4('0x66')]?{'message':_0x64e4('0x69'),'statusCode':_0x51cf40['statusCode']}:_0x51cf40);});}else{var _0x9fea15=0x1f4;_0x4d6fdc[_0x64e4('0x14')](_0x9fea15)[_0x64e4('0x23')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x3126=['description','duration_minutes','parent_type','parent_name','direction','findOne','remoteUri','slice','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','json','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','SugarcrmAccount','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','SugarcrmConfiguration','order','getConfigurations','nolimit','addConfiguration','Subjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by'];(function(_0x53d230,_0x193316){var _0x411a84=function(_0x1acf9c){while(--_0x1acf9c){_0x53d230['push'](_0x53d230['shift']());}};_0x411a84(++_0x193316);}(_0x3126,0x9a));var _0x6312=function(_0x4c91a3,_0xba3f91){_0x4c91a3=_0x4c91a3-0x0;var _0x35c9cc=_0x3126[_0x4c91a3];return _0x35c9cc;};'use strict';var emlformat=require(_0x6312('0x0'));var rimraf=require(_0x6312('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6312('0x2'));var rp=require(_0x6312('0x3'));var moment=require('moment');var BPromise=require(_0x6312('0x4'));var Mustache=require(_0x6312('0x5'));var util=require(_0x6312('0x6'));var path=require(_0x6312('0x7'));var sox=require(_0x6312('0x8'));var csv=require(_0x6312('0x9'));var ejs=require(_0x6312('0xa'));var fs=require('fs');var fs_extra=require(_0x6312('0xb'));var _=require(_0x6312('0xc'));var squel=require('squel');var crypto=require(_0x6312('0xd'));var jsforce=require(_0x6312('0xe'));var deskjs=require(_0x6312('0xf'));var toCsv=require(_0x6312('0x9'));var querystring=require(_0x6312('0x10'));var Papa=require('papaparse');var Redis=require(_0x6312('0x11'));var authService=require(_0x6312('0x12'));var qs=require(_0x6312('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6312('0x14'));var logger=require(_0x6312('0x15'))(_0x6312('0x16'));var utils=require(_0x6312('0x17'));var config=require(_0x6312('0x18'));var licenseUtil=require(_0x6312('0x19'));var db=require(_0x6312('0x1a'))['db'];var integrations=require(_0x6312('0x1b'));function respondWithStatusCode(_0x1c09c3,_0x45c662){_0x45c662=_0x45c662||0xcc;return function(_0x2df242){if(_0x2df242){return _0x1c09c3['sendStatus'](_0x45c662);}return _0x1c09c3['status'](_0x45c662)['end']();};}function respondWithResult(_0x1a400f,_0x3f412e){_0x3f412e=_0x3f412e||0xc8;return function(_0x2b07d9){if(_0x2b07d9){return _0x1a400f['status'](_0x3f412e)[_0x6312('0x1c')](_0x2b07d9);}};}function respondWithFilteredResult(_0x455815,_0x4835df){return function(_0x2ec1b7){if(_0x2ec1b7){var _0xaa5dc6=typeof _0x4835df['offset']===_0x6312('0x1d')&&typeof _0x4835df['limit']==='undefined';var _0x12731d=_0x2ec1b7['count'];var _0x52c657=_0xaa5dc6?0x0:_0x4835df['offset'];var _0x44af81=_0xaa5dc6?_0x2ec1b7[_0x6312('0x1e')]:_0x4835df[_0x6312('0x1f')]+_0x4835df['limit'];var _0x50b75e;if(_0x44af81>=_0x12731d){_0x44af81=_0x12731d;_0x50b75e=0xc8;}else{_0x50b75e=0xce;}_0x455815[_0x6312('0x20')](_0x50b75e);return _0x455815[_0x6312('0x21')](_0x6312('0x22'),_0x52c657+'-'+_0x44af81+'/'+_0x12731d)[_0x6312('0x1c')](_0x2ec1b7);}return null;};}function patchUpdates(_0x4bc828){return function(_0x4928e8){try{jsonpatch[_0x6312('0x23')](_0x4928e8,_0x4bc828,!![]);}catch(_0x4cf097){return BPromise[_0x6312('0x24')](_0x4cf097);}return _0x4928e8[_0x6312('0x25')]();};}function saveUpdates(_0x33c24c,_0x396c4d){return function(_0x4154f0){if(_0x4154f0){return _0x4154f0[_0x6312('0x26')](_0x33c24c)[_0x6312('0x27')](function(_0x2ad1fd){return _0x2ad1fd;});}return null;};}function removeEntity(_0x875944,_0x187030){return function(_0x3c7f70){if(_0x3c7f70){return _0x3c7f70['destroy']()[_0x6312('0x27')](function(){_0x875944[_0x6312('0x20')](0xcc)[_0x6312('0x28')]();});}};}function handleEntityNotFound(_0x4e5b88,_0x26c3f9){return function(_0x1a684f){if(!_0x1a684f){_0x4e5b88['sendStatus'](0x194);}return _0x1a684f;};}function handleError(_0xeed2f8,_0x5da8f4){_0x5da8f4=_0x5da8f4||0x1f4;return function(_0x4df53e){logger[_0x6312('0x29')](_0x4df53e[_0x6312('0x2a')]);if(_0x4df53e[_0x6312('0x2b')]){delete _0x4df53e[_0x6312('0x2b')];}_0xeed2f8['status'](_0x5da8f4)['send'](_0x4df53e);};}exports['index']=function(_0x27c3fa,_0x553bf9){var _0x54237d={},_0x1b78ce={},_0x42c989={'count':0x0,'rows':[]};var _0x5893bb=_[_0x6312('0x2c')](db['SugarcrmAccount'][_0x6312('0x2d')],function(_0x3f37fe){return{'name':_0x3f37fe['fieldName'],'type':_0x3f37fe[_0x6312('0x2e')]['key']};});_0x1b78ce[_0x6312('0x2f')]=_[_0x6312('0x2c')](_0x5893bb,'name');_0x1b78ce[_0x6312('0x30')]=_[_0x6312('0x31')](_0x27c3fa[_0x6312('0x30')]);_0x1b78ce[_0x6312('0x32')]=_['intersection'](_0x1b78ce[_0x6312('0x2f')],_0x1b78ce['query']);_0x54237d[_0x6312('0x33')]=_[_0x6312('0x34')](_0x1b78ce['model'],qs['fields'](_0x27c3fa[_0x6312('0x30')][_0x6312('0x35')]));_0x54237d[_0x6312('0x33')]=_0x54237d[_0x6312('0x33')][_0x6312('0x36')]?_0x54237d['attributes']:_0x1b78ce['model'];if(!_0x27c3fa[_0x6312('0x30')][_0x6312('0x37')]('nolimit')){_0x54237d[_0x6312('0x38')]=qs[_0x6312('0x38')](_0x27c3fa[_0x6312('0x30')][_0x6312('0x38')]);_0x54237d[_0x6312('0x1f')]=qs[_0x6312('0x1f')](_0x27c3fa[_0x6312('0x30')]['offset']);}_0x54237d['order']=qs[_0x6312('0x39')](_0x27c3fa['query'][_0x6312('0x39')]);_0x54237d[_0x6312('0x3a')]=qs[_0x6312('0x32')](_[_0x6312('0x3b')](_0x27c3fa['query'],_0x1b78ce[_0x6312('0x32')]),_0x5893bb);if(_0x27c3fa[_0x6312('0x30')][_0x6312('0x3c')]){_0x54237d[_0x6312('0x3a')]=_[_0x6312('0x3d')](_0x54237d[_0x6312('0x3a')],{'$or':_['map'](_0x5893bb,function(_0x57a104){if(_0x57a104[_0x6312('0x2e')]!==_0x6312('0x3e')){var _0x2db85c={};_0x2db85c[_0x57a104['name']]={'$like':'%'+_0x27c3fa['query']['filter']+'%'};return _0x2db85c;}})});}_0x54237d=_[_0x6312('0x3d')]({},_0x54237d,_0x27c3fa['options']);var _0x4fa64f={'where':_0x54237d[_0x6312('0x3a')]};return db[_0x6312('0x3f')][_0x6312('0x1e')](_0x4fa64f)[_0x6312('0x27')](function(_0x455394){_0x42c989['count']=_0x455394;if(_0x27c3fa[_0x6312('0x30')]['includeAll']){_0x54237d[_0x6312('0x40')]=[{'all':!![]}];}return db[_0x6312('0x3f')][_0x6312('0x41')](_0x54237d);})[_0x6312('0x27')](function(_0x2b159a){_0x42c989[_0x6312('0x42')]=_0x2b159a;return _0x42c989;})[_0x6312('0x27')](respondWithFilteredResult(_0x553bf9,_0x54237d))[_0x6312('0x43')](handleError(_0x553bf9,null));};exports[_0x6312('0x44')]=function(_0x1ff7f7,_0x1529a6){var _0x120421={'raw':![],'where':{'id':_0x1ff7f7[_0x6312('0x45')]['id']}},_0x1cc2a0={};_0x1cc2a0[_0x6312('0x2f')]=_['keys'](db['SugarcrmAccount'][_0x6312('0x2d')]);_0x1cc2a0[_0x6312('0x30')]=_[_0x6312('0x31')](_0x1ff7f7['query']);_0x1cc2a0[_0x6312('0x32')]=_['intersection'](_0x1cc2a0[_0x6312('0x2f')],_0x1cc2a0[_0x6312('0x30')]);_0x120421[_0x6312('0x33')]=_[_0x6312('0x34')](_0x1cc2a0[_0x6312('0x2f')],qs['fields'](_0x1ff7f7[_0x6312('0x30')][_0x6312('0x35')]));_0x120421[_0x6312('0x33')]=_0x120421[_0x6312('0x33')][_0x6312('0x36')]?_0x120421[_0x6312('0x33')]:_0x1cc2a0['model'];if(_0x1ff7f7[_0x6312('0x30')][_0x6312('0x46')]){_0x120421[_0x6312('0x40')]=[{'all':!![]}];}_0x120421=_['merge']({},_0x120421,_0x1ff7f7[_0x6312('0x47')]);return db['SugarcrmAccount'][_0x6312('0x48')](_0x120421)[_0x6312('0x27')](handleEntityNotFound(_0x1529a6,null))['then'](respondWithResult(_0x1529a6,null))[_0x6312('0x43')](handleError(_0x1529a6,null));};exports[_0x6312('0x49')]=function(_0x25442e,_0x5a7238){return db['SugarcrmAccount'][_0x6312('0x49')](_0x25442e[_0x6312('0x4a')],{})['then'](respondWithResult(_0x5a7238,0xc9))['catch'](handleError(_0x5a7238,null));};exports[_0x6312('0x26')]=function(_0x2ab4bd,_0x176168){if(_0x2ab4bd[_0x6312('0x4a')]['id']){delete _0x2ab4bd[_0x6312('0x4a')]['id'];}return db[_0x6312('0x3f')][_0x6312('0x48')]({'where':{'id':_0x2ab4bd[_0x6312('0x45')]['id']}})[_0x6312('0x27')](handleEntityNotFound(_0x176168,null))['then'](saveUpdates(_0x2ab4bd['body'],null))[_0x6312('0x27')](respondWithResult(_0x176168,null))['catch'](handleError(_0x176168,null));};exports[_0x6312('0x4b')]=function(_0x453cc8,_0x56fe2e){return db['SugarcrmAccount']['find']({'where':{'id':_0x453cc8[_0x6312('0x45')]['id']}})[_0x6312('0x27')](handleEntityNotFound(_0x56fe2e,null))[_0x6312('0x27')](removeEntity(_0x56fe2e,null))[_0x6312('0x43')](handleError(_0x56fe2e,null));};exports['getConfigurations']=function(_0x29b744,_0xdb897a,_0x59b5cd){var _0xd143c4={};var _0x4de8f8={};var _0x5a9588;var _0xe80a85;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x29b744[_0x6312('0x45')]['id']}})[_0x6312('0x27')](handleEntityNotFound(_0xdb897a,null))[_0x6312('0x27')](function(_0x4cf551){if(_0x4cf551){_0x5a9588=_0x4cf551;_0x4de8f8[_0x6312('0x2f')]=_[_0x6312('0x31')](db[_0x6312('0x4c')][_0x6312('0x2d')]);_0x4de8f8[_0x6312('0x30')]=_['keys'](_0x29b744[_0x6312('0x30')]);_0x4de8f8[_0x6312('0x32')]=_[_0x6312('0x34')](_0x4de8f8[_0x6312('0x2f')],_0x4de8f8[_0x6312('0x30')]);_0xd143c4[_0x6312('0x33')]=_[_0x6312('0x34')](_0x4de8f8[_0x6312('0x2f')],qs[_0x6312('0x35')](_0x29b744[_0x6312('0x30')][_0x6312('0x35')]));_0xd143c4[_0x6312('0x33')]=_0xd143c4[_0x6312('0x33')][_0x6312('0x36')]?_0xd143c4[_0x6312('0x33')]:_0x4de8f8['model'];_0xd143c4[_0x6312('0x4d')]=qs[_0x6312('0x39')](_0x29b744['query'][_0x6312('0x39')]);_0xd143c4[_0x6312('0x3a')]=qs[_0x6312('0x32')](_[_0x6312('0x3b')](_0x29b744[_0x6312('0x30')],_0x4de8f8[_0x6312('0x32')]));if(_0x29b744['query'][_0x6312('0x3c')]){_0xd143c4['where']=_[_0x6312('0x3d')](_0xd143c4[_0x6312('0x3a')],{'$or':_[_0x6312('0x2c')](_0xd143c4[_0x6312('0x33')],function(_0x2d9e2d){var _0x530693={};_0x530693[_0x2d9e2d]={'$like':'%'+_0x29b744[_0x6312('0x30')][_0x6312('0x3c')]+'%'};return _0x530693;})});}_0xd143c4=_['merge']({},_0xd143c4,_0x29b744[_0x6312('0x47')]);return _0x5a9588[_0x6312('0x4e')](_0xd143c4);}})['then'](function(_0x8ea824){if(_0x8ea824){_0xe80a85=_0x8ea824['length'];if(!_0x29b744[_0x6312('0x30')][_0x6312('0x37')](_0x6312('0x4f'))){_0xd143c4[_0x6312('0x38')]=qs['limit'](_0x29b744[_0x6312('0x30')][_0x6312('0x38')]);_0xd143c4[_0x6312('0x1f')]=qs['offset'](_0x29b744['query'][_0x6312('0x1f')]);}return _0x5a9588['getConfigurations'](_0xd143c4);}})[_0x6312('0x27')](function(_0x38b613){if(_0x38b613){return _0x38b613?{'count':_0xe80a85,'rows':_0x38b613}:null;}})[_0x6312('0x27')](respondWithResult(_0xdb897a,null))['catch'](handleError(_0xdb897a,null));};exports[_0x6312('0x50')]=function(_0x52ff64,_0x10320c,_0x43dceb){if(_0x52ff64[_0x6312('0x4a')]['id']){delete _0x52ff64[_0x6312('0x4a')]['id'];}return db[_0x6312('0x3f')]['findOne']({'where':{'id':_0x52ff64[_0x6312('0x45')]['id']}})[_0x6312('0x27')](handleEntityNotFound(_0x10320c,null))[_0x6312('0x27')](function(_0x11a00f){if(_0x11a00f){_0x52ff64[_0x6312('0x4a')]['AccountId']=_0x11a00f['id'];_0x52ff64[_0x6312('0x4a')][_0x6312('0x51')]=integrations['getSubjects'](_0x52ff64['body'][_0x6312('0x52')],_0x52ff64[_0x6312('0x4a')][_0x6312('0x2e')]);_0x52ff64[_0x6312('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x52ff64[_0x6312('0x4a')][_0x6312('0x52')],_0x52ff64[_0x6312('0x4a')][_0x6312('0x2e')]);return db[_0x6312('0x4c')][_0x6312('0x49')](_0x52ff64['body'],{'include':[{'model':db[_0x6312('0x53')],'as':_0x6312('0x51')},{'model':db[_0x6312('0x53')],'as':_0x6312('0x54')}]});}return null;})[_0x6312('0x27')](respondWithResult(_0x10320c,null))[_0x6312('0x43')](handleError(_0x10320c,null));};exports[_0x6312('0x55')]=function(_0x127075,_0x5d288b,_0x4aad1e){var _0x1e1a71='';var _0x4ac178=['id',_0x6312('0x2b'),_0x6312('0x56'),_0x6312('0x57'),_0x6312('0x58'),'date_start','duration_hours',_0x6312('0x59'),'parent_id',_0x6312('0x5a'),_0x6312('0x5b'),_0x6312('0x5c')];return db[_0x6312('0x3f')][_0x6312('0x5d')]({'where':{'id':_0x127075[_0x6312('0x45')]['id']},'attributes':['id','username','password','remoteUri']})['then'](handleEntityNotFound(_0x5d288b,null))['then'](function(_0x55f844){if(_0x55f844){_0x1e1a71=_0x55f844[_0x6312('0x5e')];var _0x4dcbfe=_0x1e1a71[_0x6312('0x5f')](-0x1);if(_0x4dcbfe==='/'){_0x1e1a71=_0x1e1a71['substring'](0x0,_0x1e1a71[_0x6312('0x60')](_0x4dcbfe));}return rp({'method':'POST','uri':util[_0x6312('0x61')](_0x6312('0x62'),_0x1e1a71,_0x6312('0x63')),'json':!![],'form':{'method':_0x6312('0x64'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x6312('0x65')]({'user_auth':{'user_name':_0x55f844['username'],'password':_0x55f844[_0x6312('0x66')],'encryption':_0x6312('0x67')},'application':_0x6312('0x68')})}});}})['then'](function(_0x747e79){if(_0x747e79&&_0x747e79[_0x6312('0x2b')]!==_0x6312('0x69')&&_0x747e79[_0x6312('0x2b')]!==_0x6312('0x6a')){return rp({'method':'POST','uri':util[_0x6312('0x61')](_0x6312('0x62'),_0x1e1a71,_0x6312('0x63')),'json':!![],'form':{'method':_0x6312('0x6b'),'input_type':_0x6312('0x6c'),'response_type':_0x6312('0x6c'),'rest_data':JSON[_0x6312('0x65')]({'session':_0x747e79['id'],'module_name':_0x6312('0x6d')})}})[_0x6312('0x27')](function(_0x308a2f){if(_0x308a2f){var _0x2dcce7=_[_0x6312('0x6e')](_0x308a2f[_0x6312('0x6f')]);_[_0x6312('0x70')](_0x2dcce7,function(_0x42768e){return _0x4ac178['includes'](_0x42768e[_0x6312('0x2b')]);});return{'count':_0x2dcce7[_0x6312('0x36')],'rows':_[_0x6312('0x2c')](_0x2dcce7,function(_0x35d587){return{'id':_0x35d587[_0x6312('0x2b')],'name':_0x35d587[_0x6312('0x71')],'custom':_[_0x6312('0x72')](_0x35d587['name'],'_c')?!![]:![],'options':_0x35d587['options']?_[_0x6312('0x2c')](_[_0x6312('0x6e')](_0x35d587[_0x6312('0x47')]),function(_0x36a5c5){return{'name':_0x36a5c5[_0x6312('0x73')],'value':_0x36a5c5[_0x6312('0x2b')]};}):[]};})};}})[_0x6312('0x27')](respondWithResult(_0x5d288b,null))[_0x6312('0x43')](function(_0x20686e){var _0x5c717c=_0x127075[_0x6312('0x30')][_0x6312('0x74')]?0x1f4:_0x20686e[_0x6312('0x75')]||0x1f4;logger['error'](_0x6312('0x76'),_0x6312('0x55'),_0x5c717c,JSON[_0x6312('0x65')](_0x20686e));delete _0x20686e[_0x6312('0x2b')];if(_0x5c717c===0x191){_0x5c717c=0x190;}_0x5d288b[_0x6312('0x20')](_0x5c717c)[_0x6312('0x77')](_0x127075[_0x6312('0x30')][_0x6312('0x74')]?{'message':_0x6312('0x78'),'statusCode':_0x20686e[_0x6312('0x75')]}:_0x20686e);});}else{var _0x11c413=0x1f4;_0x5d288b[_0x6312('0x20')](_0x11c413)[_0x6312('0x77')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index fc11e0b..858cd41 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 _0xd0ee=['util','api','moment','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount'];(function(_0xf94257,_0x28a889){var _0x3af135=function(_0x3a5883){while(--_0x3a5883){_0xf94257['push'](_0xf94257['shift']());}};_0x3af135(++_0x28a889);}(_0xd0ee,0x19a));var _0xed0e=function(_0x7f5b4,_0x4e551f){_0x7f5b4=_0x7f5b4-0x0;var _0x17777c=_0xd0ee[_0x7f5b4];return _0x17777c;};'use strict';var _=require('lodash');var util=require(_0xed0e('0x0'));var logger=require('../../config/logger')(_0xed0e('0x1'));var moment=require(_0xed0e('0x2'));var BPromise=require('bluebird');var rp=require(_0xed0e('0x3'));var fs=require('fs');var path=require(_0xed0e('0x4'));var rimraf=require('rimraf');var config=require(_0xed0e('0x5'));var attributes=require(_0xed0e('0x6'));var integrations=require(_0xed0e('0x7'));module[_0xed0e('0x8')]=function(_0x53dfad,_0x5adddb){return _0x53dfad['define'](_0xed0e('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3be=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x57277c,_0x3259a1){var _0x11a0ef=function(_0x2fdbc1){while(--_0x2fdbc1){_0x57277c['push'](_0x57277c['shift']());}};_0x11a0ef(++_0x3259a1);}(_0xd3be,0x195));var _0xed3b=function(_0x4b8b5f,_0x53a1c4){_0x4b8b5f=_0x4b8b5f-0x0;var _0x5d2479=_0xd3be[_0x4b8b5f];return _0x5d2479;};'use strict';var _=require('lodash');var util=require(_0xed3b('0x0'));var logger=require(_0xed3b('0x1'))(_0xed3b('0x2'));var moment=require(_0xed3b('0x3'));var BPromise=require(_0xed3b('0x4'));var rp=require(_0xed3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed3b('0x6'));var config=require(_0xed3b('0x7'));var attributes=require(_0xed3b('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4fcdc5,_0x4a1c14){return _0x4fcdc5['define'](_0xed3b('0x9'),attributes,{'tableName':_0xed3b('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 d52d472..7f0c6be 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 _0xcff7=['ShowSugarcrmAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','map','include','model','catch','then','info'];(function(_0x47cc69,_0x43a080){var _0x18aacc=function(_0x47b427){while(--_0x47b427){_0x47cc69['push'](_0x47cc69['shift']());}};_0x18aacc(++_0x43a080);}(_0xcff7,0x89));var _0x7cff=function(_0x11c2f4,_0x1588e3){_0x11c2f4=_0x11c2f4-0x0;var _0xc8e948=_0xcff7[_0x11c2f4];return _0xc8e948;};'use strict';var _=require('lodash');var util=require(_0x7cff('0x0'));var moment=require(_0x7cff('0x1'));var BPromise=require('bluebird');var rs=require(_0x7cff('0x2'));var fs=require('fs');var Redis=require(_0x7cff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cff('0x4'));var logger=require(_0x7cff('0x5'))(_0x7cff('0x6'));var config=require(_0x7cff('0x7'));var jayson=require(_0x7cff('0x8'));var client=jayson['client'][_0x7cff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6fda17,_0x44bd88,_0x496ee5){return new BPromise(function(_0x591918,_0x3af3c1){return client[_0x7cff('0xa')](_0x6fda17,_0x496ee5)['then'](function(_0x6a92bf){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x44bd88,_0x7cff('0xb'));logger[_0x7cff('0xc')](_0x7cff('0xd'),_0x44bd88,_0x7cff('0xb'),JSON[_0x7cff('0xe')](_0x6a92bf));if(_0x6a92bf[_0x7cff('0xf')]){if(_0x6a92bf[_0x7cff('0xf')][_0x7cff('0x10')]===0x1f4){logger[_0x7cff('0xf')](_0x7cff('0x11'),_0x44bd88,_0x6a92bf[_0x7cff('0xf')]['message']);return _0x3af3c1(_0x6a92bf[_0x7cff('0xf')][_0x7cff('0x12')]);}logger[_0x7cff('0xf')](_0x7cff('0x11'),_0x44bd88,_0x6a92bf[_0x7cff('0xf')][_0x7cff('0x12')]);return _0x591918(_0x6a92bf[_0x7cff('0xf')][_0x7cff('0x12')]);}else{logger['info'](_0x7cff('0x11'),_0x44bd88,_0x7cff('0xb'));_0x591918(_0x6a92bf[_0x7cff('0x13')]['message']);}})['catch'](function(_0x51eceb){logger[_0x7cff('0xf')](_0x7cff('0x11'),_0x44bd88,_0x51eceb);_0x3af3c1(_0x51eceb);});});}exports[_0x7cff('0x14')]=function(_0x337381){var _0x24e645=this;return new Promise(function(_0x2d2ecd,_0x814a01){return db[_0x7cff('0x15')][_0x7cff('0x16')]({'raw':_0x337381['options']?_0x337381[_0x7cff('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x337381[_0x7cff('0x17')]?_0x337381[_0x7cff('0x17')][_0x7cff('0x18')]||null:null,'attributes':_0x337381[_0x7cff('0x17')]?_0x337381[_0x7cff('0x17')][_0x7cff('0x19')]||null:null,'limit':_0x337381[_0x7cff('0x17')]?_0x337381[_0x7cff('0x17')][_0x7cff('0x1a')]||null:null,'include':_0x337381['options']?_0x337381[_0x7cff('0x17')]['include']?_[_0x7cff('0x1b')](_0x337381[_0x7cff('0x17')][_0x7cff('0x1c')],function(_0x40998a){return{'model':db[_0x40998a[_0x7cff('0x1d')]],'as':_0x40998a['as'],'attributes':_0x40998a['attributes'],'include':_0x40998a['include']?_[_0x7cff('0x1b')](_0x40998a[_0x7cff('0x1c')],function(_0x408442){return{'model':db[_0x408442[_0x7cff('0x1d')]],'as':_0x408442['as'],'attributes':_0x408442[_0x7cff('0x19')],'include':_0x408442[_0x7cff('0x1c')]?_[_0x7cff('0x1b')](_0x408442[_0x7cff('0x1c')],function(_0x4ab8f9){return{'model':db[_0x4ab8f9['model']],'as':_0x4ab8f9['as'],'attributes':_0x4ab8f9[_0x7cff('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x209117){logger['info'](_0x7cff('0x14'),_0x337381);logger[_0x7cff('0xc')](_0x7cff('0x14'),_0x337381,JSON[_0x7cff('0xe')](_0x209117));_0x2d2ecd(_0x209117);})[_0x7cff('0x1e')](function(_0x3ae814){logger[_0x7cff('0xf')](_0x7cff('0x14'),_0x3ae814[_0x7cff('0x12')],_0x337381);_0x814a01(_0x24e645[_0x7cff('0xf')](0x1f4,_0x3ae814['message']));});});};exports['ShowSugarcrmAccount']=function(_0x506561){var _0x504486=this;return new Promise(function(_0x3da15b,_0x5176f4){return db[_0x7cff('0x15')]['find']({'raw':_0x506561['options']?_0x506561[_0x7cff('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x506561[_0x7cff('0x17')]?_0x506561['options'][_0x7cff('0x18')]||null:null,'attributes':_0x506561[_0x7cff('0x17')]?_0x506561[_0x7cff('0x17')][_0x7cff('0x19')]||null:null,'include':_0x506561[_0x7cff('0x17')]?_0x506561[_0x7cff('0x17')][_0x7cff('0x1c')]?_['map'](_0x506561[_0x7cff('0x17')]['include'],function(_0xa2e77b){return{'model':db[_0xa2e77b[_0x7cff('0x1d')]],'as':_0xa2e77b['as'],'attributes':_0xa2e77b['attributes'],'include':_0xa2e77b[_0x7cff('0x1c')]?_[_0x7cff('0x1b')](_0xa2e77b[_0x7cff('0x1c')],function(_0x59244b){return{'model':db[_0x59244b[_0x7cff('0x1d')]],'as':_0x59244b['as'],'attributes':_0x59244b[_0x7cff('0x19')],'include':_0x59244b[_0x7cff('0x1c')]?_['map'](_0x59244b[_0x7cff('0x1c')],function(_0x149978){return{'model':db[_0x149978[_0x7cff('0x1d')]],'as':_0x149978['as'],'attributes':_0x149978['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cff('0x1f')](function(_0x3c5697){logger[_0x7cff('0x20')](_0x7cff('0x21'),_0x506561);logger['debug'](_0x7cff('0x21'),_0x506561,JSON[_0x7cff('0xe')](_0x3c5697));_0x3da15b(_0x3c5697);})[_0x7cff('0x1e')](function(_0x309393){logger[_0x7cff('0xf')]('ShowSugarcrmAccount',_0x309393[_0x7cff('0x12')],_0x506561);_0x5176f4(_0x504486[_0x7cff('0xf')](0x1f4,_0x309393[_0x7cff('0x12')]));});});}; \ No newline at end of file +var _0x882f=['request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','map','model','include','ShowSugarcrmAccount','find','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x882f,0x18d));var _0xf882=function(_0x3a2295,_0x3064c9){_0x3a2295=_0x3a2295-0x0;var _0x569710=_0x882f[_0x3a2295];return _0x569710;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf882('0x0'));var fs=require('fs');var Redis=require(_0xf882('0x1'));var db=require(_0xf882('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf882('0x3'))(_0xf882('0x4'));var config=require('../../config/environment');var jayson=require(_0xf882('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39b3ee,_0x352f05,_0x3ba2c4){return new BPromise(function(_0x147ad9,_0x38fa17){return client[_0xf882('0x6')](_0x39b3ee,_0x3ba2c4)[_0xf882('0x7')](function(_0x1f4a94){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x352f05,_0xf882('0x8'));logger[_0xf882('0x9')](_0xf882('0xa'),_0x352f05,_0xf882('0x8'),JSON[_0xf882('0xb')](_0x1f4a94));if(_0x1f4a94[_0xf882('0xc')]){if(_0x1f4a94[_0xf882('0xc')][_0xf882('0xd')]===0x1f4){logger[_0xf882('0xc')](_0xf882('0xe'),_0x352f05,_0x1f4a94[_0xf882('0xc')][_0xf882('0xf')]);return _0x38fa17(_0x1f4a94[_0xf882('0xc')][_0xf882('0xf')]);}logger['error'](_0xf882('0xe'),_0x352f05,_0x1f4a94[_0xf882('0xc')]['message']);return _0x147ad9(_0x1f4a94[_0xf882('0xc')][_0xf882('0xf')]);}else{logger[_0xf882('0x10')](_0xf882('0xe'),_0x352f05,_0xf882('0x8'));_0x147ad9(_0x1f4a94[_0xf882('0x11')][_0xf882('0xf')]);}})[_0xf882('0x12')](function(_0x17e9a7){logger[_0xf882('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x352f05,_0x17e9a7);_0x38fa17(_0x17e9a7);});});}exports[_0xf882('0x13')]=function(_0x84ec76){var _0x46dafd=this;return new Promise(function(_0x483fcd,_0x6c89c0){return db[_0xf882('0x14')]['findAll']({'raw':_0x84ec76[_0xf882('0x15')]?_0x84ec76[_0xf882('0x15')][_0xf882('0x16')]===undefined?!![]:![]:!![],'where':_0x84ec76[_0xf882('0x15')]?_0x84ec76[_0xf882('0x15')][_0xf882('0x17')]||null:null,'attributes':_0x84ec76[_0xf882('0x15')]?_0x84ec76[_0xf882('0x15')][_0xf882('0x18')]||null:null,'limit':_0x84ec76['options']?_0x84ec76[_0xf882('0x15')][_0xf882('0x19')]||null:null,'include':_0x84ec76[_0xf882('0x15')]?_0x84ec76[_0xf882('0x15')]['include']?_[_0xf882('0x1a')](_0x84ec76[_0xf882('0x15')]['include'],function(_0x3dfe2a){return{'model':db[_0x3dfe2a[_0xf882('0x1b')]],'as':_0x3dfe2a['as'],'attributes':_0x3dfe2a['attributes'],'include':_0x3dfe2a[_0xf882('0x1c')]?_[_0xf882('0x1a')](_0x3dfe2a[_0xf882('0x1c')],function(_0x30ee82){return{'model':db[_0x30ee82[_0xf882('0x1b')]],'as':_0x30ee82['as'],'attributes':_0x30ee82[_0xf882('0x18')],'include':_0x30ee82[_0xf882('0x1c')]?_[_0xf882('0x1a')](_0x30ee82[_0xf882('0x1c')],function(_0x35151e){return{'model':db[_0x35151e[_0xf882('0x1b')]],'as':_0x35151e['as'],'attributes':_0x35151e[_0xf882('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf882('0x7')](function(_0x32a7e7){logger[_0xf882('0x10')](_0xf882('0x13'),_0x84ec76);logger[_0xf882('0x9')]('GetSugarcrmAccount',_0x84ec76,JSON[_0xf882('0xb')](_0x32a7e7));_0x483fcd(_0x32a7e7);})[_0xf882('0x12')](function(_0x51640b){logger[_0xf882('0xc')](_0xf882('0x13'),_0x51640b[_0xf882('0xf')],_0x84ec76);_0x6c89c0(_0x46dafd['error'](0x1f4,_0x51640b[_0xf882('0xf')]));});});};exports[_0xf882('0x1d')]=function(_0x5a864f){var _0x1bc740=this;return new Promise(function(_0x224f50,_0x2912c1){return db[_0xf882('0x14')][_0xf882('0x1e')]({'raw':_0x5a864f['options']?_0x5a864f[_0xf882('0x15')][_0xf882('0x16')]===undefined?!![]:![]:!![],'where':_0x5a864f['options']?_0x5a864f[_0xf882('0x15')][_0xf882('0x17')]||null:null,'attributes':_0x5a864f[_0xf882('0x15')]?_0x5a864f[_0xf882('0x15')][_0xf882('0x18')]||null:null,'include':_0x5a864f['options']?_0x5a864f[_0xf882('0x15')][_0xf882('0x1c')]?_[_0xf882('0x1a')](_0x5a864f[_0xf882('0x15')]['include'],function(_0x55856b){return{'model':db[_0x55856b['model']],'as':_0x55856b['as'],'attributes':_0x55856b[_0xf882('0x18')],'include':_0x55856b['include']?_[_0xf882('0x1a')](_0x55856b['include'],function(_0x32e1e2){return{'model':db[_0x32e1e2[_0xf882('0x1b')]],'as':_0x32e1e2['as'],'attributes':_0x32e1e2[_0xf882('0x18')],'include':_0x32e1e2[_0xf882('0x1c')]?_[_0xf882('0x1a')](_0x32e1e2[_0xf882('0x1c')],function(_0x55bb1a){return{'model':db[_0x55bb1a[_0xf882('0x1b')]],'as':_0x55bb1a['as'],'attributes':_0x55bb1a[_0xf882('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf882('0x7')](function(_0xdfb6ab){logger['info'](_0xf882('0x1d'),_0x5a864f);logger[_0xf882('0x9')](_0xf882('0x1d'),_0x5a864f,JSON[_0xf882('0xb')](_0xdfb6ab));_0x224f50(_0xdfb6ab);})[_0xf882('0x12')](function(_0x3b369e){logger[_0xf882('0xc')](_0xf882('0x1d'),_0x3b369e[_0xf882('0xf')],_0x5a864f);_0x2912c1(_0x1bc740[_0xf882('0xc')](0x1f4,_0x3b369e[_0xf882('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4106f9a..52a0e3b 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 _0xc24e=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','create','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x47242c,_0x42ffd9){var _0x560b61=function(_0xf22893){while(--_0xf22893){_0x47242c['push'](_0x47242c['shift']());}};_0x560b61(++_0x42ffd9);}(_0xc24e,0x1d9));var _0xec24=function(_0x2f5598,_0x3fc452){_0x2f5598=_0x2f5598-0x0;var _0x525191=_0xc24e[_0x2f5598];return _0x525191;};'use strict';var multer=require(_0xec24('0x0'));var util=require(_0xec24('0x1'));var path=require(_0xec24('0x2'));var timeout=require('connect-timeout');var express=require(_0xec24('0x3'));var router=express[_0xec24('0x4')]();var fs_extra=require(_0xec24('0x5'));var auth=require(_0xec24('0x6'));var interaction=require(_0xec24('0x7'));var config=require(_0xec24('0x8'));var controller=require(_0xec24('0x9'));router[_0xec24('0xa')]('/',auth[_0xec24('0xb')](),controller['index']);router[_0xec24('0xa')](_0xec24('0xc'),auth[_0xec24('0xb')](),controller[_0xec24('0xd')]);router[_0xec24('0xa')](_0xec24('0xe'),auth[_0xec24('0xb')](),controller[_0xec24('0xf')]);router[_0xec24('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xec24('0x10')]);router['get']('/:id/descriptions',auth[_0xec24('0xb')](),controller[_0xec24('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec24('0x12')]);router['put'](_0xec24('0xc'),auth[_0xec24('0xb')](),controller['update']);router[_0xec24('0x13')]('/:id',auth[_0xec24('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xddd7=['update','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','/:id/descriptions','post','create'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xddd7,0x16d));var _0x7ddd=function(_0x43e59d,_0x504eec){_0x43e59d=_0x43e59d-0x0;var _0x358b40=_0xddd7[_0x43e59d];return _0x358b40;};'use strict';var multer=require(_0x7ddd('0x0'));var util=require(_0x7ddd('0x1'));var path=require(_0x7ddd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ddd('0x3')]();var fs_extra=require(_0x7ddd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ddd('0x5'));var controller=require(_0x7ddd('0x6'));router[_0x7ddd('0x7')]('/',auth[_0x7ddd('0x8')](),controller[_0x7ddd('0x9')]);router['get']('/:id',auth[_0x7ddd('0x8')](),controller['show']);router['get'](_0x7ddd('0xa'),auth[_0x7ddd('0x8')](),controller['getFields']);router[_0x7ddd('0x7')](_0x7ddd('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x7ddd('0x7')](_0x7ddd('0xc'),auth[_0x7ddd('0x8')](),controller['getDescriptions']);router[_0x7ddd('0xd')]('/',auth['isAuthenticated'](),controller[_0x7ddd('0xe')]);router['put']('/:id',auth[_0x7ddd('0x8')](),controller[_0x7ddd('0xf')]);router['delete'](_0x7ddd('0x10'),auth[_0x7ddd('0x8')](),controller[_0x7ddd('0x11')]);module[_0x7ddd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 75ec34b..03fb709 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 _0xe90d=['STRING','sequelize','exports'];(function(_0x5b3a82,_0x5675e3){var _0x154dba=function(_0x4313f5){while(--_0x4313f5){_0x5b3a82['push'](_0x5b3a82['shift']());}};_0x154dba(++_0x5675e3);}(_0xe90d,0x145));var _0xde90=function(_0x572683,_0x435e01){_0x572683=_0x572683-0x0;var _0x16dcbb=_0xe90d[_0x572683];return _0x16dcbb;};'use strict';var Sequelize=require(_0xde90('0x0'));module[_0xde90('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde90('0x2')]}}; \ No newline at end of file +var _0x00d9=['STRING','sequelize','exports'];(function(_0x483dc1,_0x27ebf2){var _0x45ba41=function(_0x281627){while(--_0x281627){_0x483dc1['push'](_0x483dc1['shift']());}};_0x45ba41(++_0x27ebf2);}(_0x00d9,0x64));var _0x900d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x00d9[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x900d('0x0'));module[_0x900d('0x1')]={'name':{'type':Sequelize[_0x900d('0x2')]},'description':{'type':Sequelize[_0x900d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index dd726b7..9414f19 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 _0x4b31=['VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','catch','params','destroy','getFields','findOne','SugarcrmField','order','getSubjects','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x52e920,_0xea93bb){var _0x819cc3=function(_0x2b1330){while(--_0x2b1330){_0x52e920['push'](_0x52e920['shift']());}};_0x819cc3(++_0xea93bb);}(_0x4b31,0x142));var _0x14b3=function(_0x19beab,_0x2c9e3e){_0x19beab=_0x19beab-0x0;var _0x14d7fe=_0x4b31[_0x19beab];return _0x14d7fe;};'use strict';var emlformat=require(_0x14b3('0x0'));var rimraf=require(_0x14b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14b3('0x2'));var rp=require('request-promise');var moment=require(_0x14b3('0x3'));var BPromise=require(_0x14b3('0x4'));var Mustache=require(_0x14b3('0x5'));var util=require(_0x14b3('0x6'));var path=require('path');var sox=require(_0x14b3('0x7'));var csv=require(_0x14b3('0x8'));var ejs=require(_0x14b3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x14b3('0xa'));var crypto=require(_0x14b3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x14b3('0xc'));var toCsv=require(_0x14b3('0x8'));var querystring=require(_0x14b3('0xd'));var Papa=require(_0x14b3('0xe'));var Redis=require(_0x14b3('0xf'));var authService=require(_0x14b3('0x10'));var qs=require(_0x14b3('0x11'));var as=require(_0x14b3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x14b3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1be116,_0x34426e){_0x34426e=_0x34426e||0xcc;return function(_0x53ba42){if(_0x53ba42){return _0x1be116['sendStatus'](_0x34426e);}return _0x1be116['status'](_0x34426e)[_0x14b3('0x14')]();};}function respondWithResult(_0x277da7,_0x167c3b){_0x167c3b=_0x167c3b||0xc8;return function(_0x53683d){if(_0x53683d){return _0x277da7[_0x14b3('0x15')](_0x167c3b)[_0x14b3('0x16')](_0x53683d);}};}function respondWithFilteredResult(_0x3f81da,_0x54eb30){return function(_0x43b4bd){if(_0x43b4bd){var _0x356949=typeof _0x54eb30['offset']===_0x14b3('0x17')&&typeof _0x54eb30[_0x14b3('0x18')]===_0x14b3('0x17');var _0x145919=_0x43b4bd[_0x14b3('0x19')];var _0x1ba560=_0x356949?0x0:_0x54eb30[_0x14b3('0x1a')];var _0x2bbe87=_0x356949?_0x43b4bd[_0x14b3('0x19')]:_0x54eb30['offset']+_0x54eb30[_0x14b3('0x18')];var _0x4e74f6;if(_0x2bbe87>=_0x145919){_0x2bbe87=_0x145919;_0x4e74f6=0xc8;}else{_0x4e74f6=0xce;}_0x3f81da[_0x14b3('0x15')](_0x4e74f6);return _0x3f81da[_0x14b3('0x1b')](_0x14b3('0x1c'),_0x1ba560+'-'+_0x2bbe87+'/'+_0x145919)[_0x14b3('0x16')](_0x43b4bd);}return null;};}function patchUpdates(_0x326430){return function(_0x4347b6){try{jsonpatch[_0x14b3('0x1d')](_0x4347b6,_0x326430,!![]);}catch(_0x514906){return BPromise[_0x14b3('0x1e')](_0x514906);}return _0x4347b6[_0x14b3('0x1f')]();};}function saveUpdates(_0x105e04,_0x29d771){return function(_0x3ba79d){if(_0x3ba79d){return _0x3ba79d[_0x14b3('0x20')](_0x105e04)[_0x14b3('0x21')](function(_0x32ca99){return _0x32ca99;});}return null;};}function removeEntity(_0x306f1e,_0x236817){return function(_0x7976e8){if(_0x7976e8){return _0x7976e8['destroy']()[_0x14b3('0x21')](function(){_0x306f1e[_0x14b3('0x15')](0xcc)[_0x14b3('0x14')]();});}};}function handleEntityNotFound(_0x3672c1,_0x4b3543){return function(_0x30f15e){if(!_0x30f15e){_0x3672c1['sendStatus'](0x194);}return _0x30f15e;};}function handleError(_0x32a594,_0x1ff5a1){_0x1ff5a1=_0x1ff5a1||0x1f4;return function(_0x1f5e91){logger['error'](_0x1f5e91[_0x14b3('0x22')]);if(_0x1f5e91[_0x14b3('0x23')]){delete _0x1f5e91[_0x14b3('0x23')];}_0x32a594[_0x14b3('0x15')](_0x1ff5a1)[_0x14b3('0x24')](_0x1f5e91);};}exports[_0x14b3('0x25')]=function(_0x3faecd,_0x3135ef){var _0x199528={},_0x3469cb={},_0x3b61f0={'count':0x0,'rows':[]};var _0x2e42ed=_['map'](db[_0x14b3('0x26')][_0x14b3('0x27')],function(_0x159d59){return{'name':_0x159d59[_0x14b3('0x28')],'type':_0x159d59[_0x14b3('0x29')][_0x14b3('0x2a')]};});_0x3469cb['model']=_[_0x14b3('0x2b')](_0x2e42ed,_0x14b3('0x23'));_0x3469cb['query']=_[_0x14b3('0x2c')](_0x3faecd[_0x14b3('0x2d')]);_0x3469cb[_0x14b3('0x2e')]=_['intersection'](_0x3469cb[_0x14b3('0x2f')],_0x3469cb[_0x14b3('0x2d')]);_0x199528['attributes']=_[_0x14b3('0x30')](_0x3469cb[_0x14b3('0x2f')],qs[_0x14b3('0x31')](_0x3faecd['query'][_0x14b3('0x31')]));_0x199528[_0x14b3('0x32')]=_0x199528['attributes'][_0x14b3('0x33')]?_0x199528['attributes']:_0x3469cb['model'];if(!_0x3faecd['query'][_0x14b3('0x34')](_0x14b3('0x35'))){_0x199528[_0x14b3('0x18')]=qs[_0x14b3('0x18')](_0x3faecd['query']['limit']);_0x199528[_0x14b3('0x1a')]=qs['offset'](_0x3faecd['query'][_0x14b3('0x1a')]);}_0x199528['order']=qs['sort'](_0x3faecd['query'][_0x14b3('0x36')]);_0x199528[_0x14b3('0x37')]=qs[_0x14b3('0x2e')](_['pick'](_0x3faecd[_0x14b3('0x2d')],_0x3469cb[_0x14b3('0x2e')]),_0x2e42ed);if(_0x3faecd[_0x14b3('0x2d')][_0x14b3('0x38')]){_0x199528[_0x14b3('0x37')]=_[_0x14b3('0x39')](_0x199528[_0x14b3('0x37')],{'$or':_[_0x14b3('0x2b')](_0x2e42ed,function(_0x174876){if(_0x174876[_0x14b3('0x29')]!==_0x14b3('0x3a')){var _0x3efa4e={};_0x3efa4e[_0x174876[_0x14b3('0x23')]]={'$like':'%'+_0x3faecd[_0x14b3('0x2d')]['filter']+'%'};return _0x3efa4e;}})});}_0x199528=_['merge']({},_0x199528,_0x3faecd[_0x14b3('0x3b')]);var _0x49d01a={'where':_0x199528[_0x14b3('0x37')]};return db[_0x14b3('0x26')]['count'](_0x49d01a)[_0x14b3('0x21')](function(_0x3df2d7){_0x3b61f0[_0x14b3('0x19')]=_0x3df2d7;if(_0x3faecd[_0x14b3('0x2d')]['includeAll']){_0x199528[_0x14b3('0x3c')]=[{'all':!![]}];}return db[_0x14b3('0x26')][_0x14b3('0x3d')](_0x199528);})[_0x14b3('0x21')](function(_0x667d5e){_0x3b61f0[_0x14b3('0x3e')]=_0x667d5e;return _0x3b61f0;})[_0x14b3('0x21')](respondWithFilteredResult(_0x3135ef,_0x199528))['catch'](handleError(_0x3135ef,null));};exports[_0x14b3('0x3f')]=function(_0x39e108,_0x46cdea){var _0x46ecd3={'raw':![],'where':{'id':_0x39e108['params']['id']}},_0x108d4b={};_0x108d4b[_0x14b3('0x2f')]=_['keys'](db['SugarcrmConfiguration'][_0x14b3('0x27')]);_0x108d4b['query']=_[_0x14b3('0x2c')](_0x39e108[_0x14b3('0x2d')]);_0x108d4b[_0x14b3('0x2e')]=_[_0x14b3('0x30')](_0x108d4b[_0x14b3('0x2f')],_0x108d4b[_0x14b3('0x2d')]);_0x46ecd3[_0x14b3('0x32')]=_[_0x14b3('0x30')](_0x108d4b[_0x14b3('0x2f')],qs[_0x14b3('0x31')](_0x39e108['query'][_0x14b3('0x31')]));_0x46ecd3[_0x14b3('0x32')]=_0x46ecd3[_0x14b3('0x32')][_0x14b3('0x33')]?_0x46ecd3[_0x14b3('0x32')]:_0x108d4b[_0x14b3('0x2f')];if(_0x39e108['query'][_0x14b3('0x40')]){_0x46ecd3['include']=[{'all':!![]}];}_0x46ecd3=_[_0x14b3('0x39')]({},_0x46ecd3,_0x39e108['options']);return db['SugarcrmConfiguration'][_0x14b3('0x41')](_0x46ecd3)[_0x14b3('0x21')](handleEntityNotFound(_0x46cdea,null))[_0x14b3('0x21')](respondWithResult(_0x46cdea,null))['catch'](handleError(_0x46cdea,null));};exports[_0x14b3('0x42')]=function(_0x33eed4,_0x1df713){return db['SugarcrmConfiguration'][_0x14b3('0x42')](_0x33eed4[_0x14b3('0x43')],{})[_0x14b3('0x21')](respondWithResult(_0x1df713,0xc9))[_0x14b3('0x44')](handleError(_0x1df713,null));};exports[_0x14b3('0x20')]=function(_0x26a8b3,_0x2330f0){if(_0x26a8b3[_0x14b3('0x43')]['id']){delete _0x26a8b3[_0x14b3('0x43')]['id'];}return db['SugarcrmConfiguration'][_0x14b3('0x41')]({'where':{'id':_0x26a8b3[_0x14b3('0x45')]['id']}})[_0x14b3('0x21')](handleEntityNotFound(_0x2330f0,null))['then'](saveUpdates(_0x26a8b3['body'],null))[_0x14b3('0x21')](respondWithResult(_0x2330f0,null))[_0x14b3('0x44')](handleError(_0x2330f0,null));};exports[_0x14b3('0x46')]=function(_0x317cad,_0x44f391){return db[_0x14b3('0x26')][_0x14b3('0x41')]({'where':{'id':_0x317cad['params']['id']}})[_0x14b3('0x21')](handleEntityNotFound(_0x44f391,null))[_0x14b3('0x21')](removeEntity(_0x44f391,null))[_0x14b3('0x44')](handleError(_0x44f391,null));};exports[_0x14b3('0x47')]=function(_0x19ba3b,_0x38c1ca,_0x2a41fc){var _0x229288={};var _0x8ddc41={};var _0x45697d;var _0x45f5b7;return db[_0x14b3('0x26')][_0x14b3('0x48')]({'where':{'id':_0x19ba3b[_0x14b3('0x45')]['id']}})['then'](handleEntityNotFound(_0x38c1ca,null))[_0x14b3('0x21')](function(_0x2476d2){if(_0x2476d2){_0x45697d=_0x2476d2;_0x8ddc41['model']=_['keys'](db[_0x14b3('0x49')][_0x14b3('0x27')]);_0x8ddc41['query']=_[_0x14b3('0x2c')](_0x19ba3b[_0x14b3('0x2d')]);_0x8ddc41[_0x14b3('0x2e')]=_['intersection'](_0x8ddc41[_0x14b3('0x2f')],_0x8ddc41[_0x14b3('0x2d')]);_0x229288[_0x14b3('0x32')]=_[_0x14b3('0x30')](_0x8ddc41[_0x14b3('0x2f')],qs['fields'](_0x19ba3b['query'][_0x14b3('0x31')]));_0x229288[_0x14b3('0x32')]=_0x229288[_0x14b3('0x32')][_0x14b3('0x33')]?_0x229288[_0x14b3('0x32')]:_0x8ddc41[_0x14b3('0x2f')];_0x229288[_0x14b3('0x4a')]=qs[_0x14b3('0x36')](_0x19ba3b[_0x14b3('0x2d')][_0x14b3('0x36')]);_0x229288[_0x14b3('0x37')]=qs[_0x14b3('0x2e')](_['pick'](_0x19ba3b[_0x14b3('0x2d')],_0x8ddc41[_0x14b3('0x2e')]));if(_0x19ba3b[_0x14b3('0x2d')][_0x14b3('0x38')]){_0x229288[_0x14b3('0x37')]=_[_0x14b3('0x39')](_0x229288[_0x14b3('0x37')],{'$or':_['map'](_0x229288[_0x14b3('0x32')],function(_0x4ff145){var _0x360e2d={};_0x360e2d[_0x4ff145]={'$like':'%'+_0x19ba3b[_0x14b3('0x2d')]['filter']+'%'};return _0x360e2d;})});}_0x229288=_[_0x14b3('0x39')]({},_0x229288,_0x19ba3b['options']);return _0x45697d[_0x14b3('0x47')](_0x229288);}})['then'](function(_0x117c9f){if(_0x117c9f){_0x45f5b7=_0x117c9f[_0x14b3('0x33')];if(!_0x19ba3b[_0x14b3('0x2d')][_0x14b3('0x34')]('nolimit')){_0x229288[_0x14b3('0x18')]=qs['limit'](_0x19ba3b[_0x14b3('0x2d')][_0x14b3('0x18')]);_0x229288['offset']=qs[_0x14b3('0x1a')](_0x19ba3b[_0x14b3('0x2d')][_0x14b3('0x1a')]);}return _0x45697d['getFields'](_0x229288);}})[_0x14b3('0x21')](function(_0x1b1c1d){if(_0x1b1c1d){return _0x1b1c1d?{'count':_0x45f5b7,'rows':_0x1b1c1d}:null;}})[_0x14b3('0x21')](respondWithResult(_0x38c1ca,null))[_0x14b3('0x44')](handleError(_0x38c1ca,null));};exports['getSubjects']=function(_0x445b6d,_0x26208f,_0x591c85){var _0x313b15={};var _0x372eb2={};var _0x1baf68;var _0x5d9b8f;return db['SugarcrmConfiguration'][_0x14b3('0x48')]({'where':{'id':_0x445b6d[_0x14b3('0x45')]['id']}})[_0x14b3('0x21')](handleEntityNotFound(_0x26208f,null))[_0x14b3('0x21')](function(_0x228aff){if(_0x228aff){_0x1baf68=_0x228aff;_0x372eb2[_0x14b3('0x2f')]=_[_0x14b3('0x2c')](db['SugarcrmField'][_0x14b3('0x27')]);_0x372eb2[_0x14b3('0x2d')]=_[_0x14b3('0x2c')](_0x445b6d['query']);_0x372eb2[_0x14b3('0x2e')]=_['intersection'](_0x372eb2[_0x14b3('0x2f')],_0x372eb2[_0x14b3('0x2d')]);_0x313b15['attributes']=_[_0x14b3('0x30')](_0x372eb2[_0x14b3('0x2f')],qs[_0x14b3('0x31')](_0x445b6d[_0x14b3('0x2d')][_0x14b3('0x31')]));_0x313b15[_0x14b3('0x32')]=_0x313b15[_0x14b3('0x32')]['length']?_0x313b15['attributes']:_0x372eb2[_0x14b3('0x2f')];_0x313b15[_0x14b3('0x4a')]=qs[_0x14b3('0x36')](_0x445b6d[_0x14b3('0x2d')][_0x14b3('0x36')]);_0x313b15['where']=qs[_0x14b3('0x2e')](_['pick'](_0x445b6d[_0x14b3('0x2d')],_0x372eb2[_0x14b3('0x2e')]));if(_0x445b6d[_0x14b3('0x2d')][_0x14b3('0x38')]){_0x313b15[_0x14b3('0x37')]=_[_0x14b3('0x39')](_0x313b15[_0x14b3('0x37')],{'$or':_[_0x14b3('0x2b')](_0x313b15[_0x14b3('0x32')],function(_0x9dfca1){var _0x356778={};_0x356778[_0x9dfca1]={'$like':'%'+_0x445b6d[_0x14b3('0x2d')]['filter']+'%'};return _0x356778;})});}_0x313b15=_[_0x14b3('0x39')]({},_0x313b15,_0x445b6d[_0x14b3('0x3b')]);return _0x1baf68['getSubjects'](_0x313b15);}})['then'](function(_0x29090f){if(_0x29090f){_0x5d9b8f=_0x29090f[_0x14b3('0x33')];if(!_0x445b6d[_0x14b3('0x2d')][_0x14b3('0x34')]('nolimit')){_0x313b15['limit']=qs[_0x14b3('0x18')](_0x445b6d[_0x14b3('0x2d')][_0x14b3('0x18')]);_0x313b15[_0x14b3('0x1a')]=qs['offset'](_0x445b6d[_0x14b3('0x2d')]['offset']);}return _0x1baf68[_0x14b3('0x4b')](_0x313b15);}})[_0x14b3('0x21')](function(_0x360b19){if(_0x360b19){return _0x360b19?{'count':_0x5d9b8f,'rows':_0x360b19}:null;}})[_0x14b3('0x21')](respondWithResult(_0x26208f,null))[_0x14b3('0x44')](handleError(_0x26208f,null));};exports['getDescriptions']=function(_0x4298de,_0x4c11cd,_0x1ec950){var _0x183814={};var _0x2f46aa={};var _0x412575;var _0x1f8cca;return db[_0x14b3('0x26')][_0x14b3('0x48')]({'where':{'id':_0x4298de[_0x14b3('0x45')]['id']}})[_0x14b3('0x21')](handleEntityNotFound(_0x4c11cd,null))['then'](function(_0xf92fa6){if(_0xf92fa6){_0x412575=_0xf92fa6;_0x2f46aa[_0x14b3('0x2f')]=_[_0x14b3('0x2c')](db[_0x14b3('0x49')]['rawAttributes']);_0x2f46aa['query']=_[_0x14b3('0x2c')](_0x4298de[_0x14b3('0x2d')]);_0x2f46aa[_0x14b3('0x2e')]=_[_0x14b3('0x30')](_0x2f46aa[_0x14b3('0x2f')],_0x2f46aa['query']);_0x183814[_0x14b3('0x32')]=_['intersection'](_0x2f46aa[_0x14b3('0x2f')],qs[_0x14b3('0x31')](_0x4298de[_0x14b3('0x2d')][_0x14b3('0x31')]));_0x183814[_0x14b3('0x32')]=_0x183814[_0x14b3('0x32')][_0x14b3('0x33')]?_0x183814[_0x14b3('0x32')]:_0x2f46aa[_0x14b3('0x2f')];_0x183814[_0x14b3('0x4a')]=qs[_0x14b3('0x36')](_0x4298de['query'][_0x14b3('0x36')]);_0x183814['where']=qs[_0x14b3('0x2e')](_['pick'](_0x4298de[_0x14b3('0x2d')],_0x2f46aa[_0x14b3('0x2e')]));if(_0x4298de[_0x14b3('0x2d')][_0x14b3('0x38')]){_0x183814[_0x14b3('0x37')]=_['merge'](_0x183814[_0x14b3('0x37')],{'$or':_[_0x14b3('0x2b')](_0x183814['attributes'],function(_0x13fac8){var _0x18580a={};_0x18580a[_0x13fac8]={'$like':'%'+_0x4298de[_0x14b3('0x2d')][_0x14b3('0x38')]+'%'};return _0x18580a;})});}_0x183814=_[_0x14b3('0x39')]({},_0x183814,_0x4298de[_0x14b3('0x3b')]);return _0x412575['getDescriptions'](_0x183814);}})['then'](function(_0x4b2fb5){if(_0x4b2fb5){_0x1f8cca=_0x4b2fb5[_0x14b3('0x33')];if(!_0x4298de['query']['hasOwnProperty'](_0x14b3('0x35'))){_0x183814[_0x14b3('0x18')]=qs['limit'](_0x4298de[_0x14b3('0x2d')][_0x14b3('0x18')]);_0x183814['offset']=qs[_0x14b3('0x1a')](_0x4298de[_0x14b3('0x2d')]['offset']);}return _0x412575['getDescriptions'](_0x183814);}})['then'](function(_0x5d65a0){if(_0x5d65a0){return _0x5d65a0?{'count':_0x1f8cca,'rows':_0x5d65a0}:null;}})[_0x14b3('0x21')](respondWithResult(_0x4c11cd,null))[_0x14b3('0x44')](handleError(_0x4c11cd,null));}; \ No newline at end of file +var _0x6be3=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','update','then','error','stack','name','index','SugarcrmConfiguration','rawAttributes','type','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2f10c2,_0x56c1ab){var _0x51ab02=function(_0x2747b5){while(--_0x2747b5){_0x2f10c2['push'](_0x2f10c2['shift']());}};_0x51ab02(++_0x56c1ab);}(_0x6be3,0xe6));var _0x36be=function(_0x909abb,_0x49bef3){_0x909abb=_0x909abb-0x0;var _0x421e71=_0x6be3[_0x909abb];return _0x421e71;};'use strict';var emlformat=require(_0x36be('0x0'));var rimraf=require(_0x36be('0x1'));var zipdir=require(_0x36be('0x2'));var jsonpatch=require(_0x36be('0x3'));var rp=require(_0x36be('0x4'));var moment=require(_0x36be('0x5'));var BPromise=require(_0x36be('0x6'));var Mustache=require(_0x36be('0x7'));var util=require(_0x36be('0x8'));var path=require(_0x36be('0x9'));var sox=require(_0x36be('0xa'));var csv=require(_0x36be('0xb'));var ejs=require(_0x36be('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36be('0xd'));var squel=require(_0x36be('0xe'));var crypto=require(_0x36be('0xf'));var jsforce=require(_0x36be('0x10'));var deskjs=require(_0x36be('0x11'));var toCsv=require('to-csv');var querystring=require(_0x36be('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36be('0x13'));var qs=require(_0x36be('0x14'));var as=require(_0x36be('0x15'));var hardwareService=require(_0x36be('0x16'));var logger=require(_0x36be('0x17'))(_0x36be('0x18'));var utils=require(_0x36be('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x36be('0x1a'));var db=require(_0x36be('0x1b'))['db'];function respondWithStatusCode(_0x3eab69,_0x19c1f1){_0x19c1f1=_0x19c1f1||0xcc;return function(_0x3f2b77){if(_0x3f2b77){return _0x3eab69[_0x36be('0x1c')](_0x19c1f1);}return _0x3eab69[_0x36be('0x1d')](_0x19c1f1)[_0x36be('0x1e')]();};}function respondWithResult(_0xbef33e,_0x38c6fa){_0x38c6fa=_0x38c6fa||0xc8;return function(_0x179bd2){if(_0x179bd2){return _0xbef33e[_0x36be('0x1d')](_0x38c6fa)[_0x36be('0x1f')](_0x179bd2);}};}function respondWithFilteredResult(_0x4e5854,_0xc4f716){return function(_0x16309a){if(_0x16309a){var _0x21ddfc=typeof _0xc4f716[_0x36be('0x20')]==='undefined'&&typeof _0xc4f716[_0x36be('0x21')]==='undefined';var _0x481086=_0x16309a[_0x36be('0x22')];var _0x2b7f49=_0x21ddfc?0x0:_0xc4f716[_0x36be('0x20')];var _0x371c31=_0x21ddfc?_0x16309a[_0x36be('0x22')]:_0xc4f716[_0x36be('0x20')]+_0xc4f716[_0x36be('0x21')];var _0x15f373;if(_0x371c31>=_0x481086){_0x371c31=_0x481086;_0x15f373=0xc8;}else{_0x15f373=0xce;}_0x4e5854['status'](_0x15f373);return _0x4e5854['set'](_0x36be('0x23'),_0x2b7f49+'-'+_0x371c31+'/'+_0x481086)[_0x36be('0x1f')](_0x16309a);}return null;};}function patchUpdates(_0x4c2630){return function(_0x1d38a0){try{jsonpatch[_0x36be('0x24')](_0x1d38a0,_0x4c2630,!![]);}catch(_0x2fd16a){return BPromise['reject'](_0x2fd16a);}return _0x1d38a0['save']();};}function saveUpdates(_0x4b7559,_0xe154c1){return function(_0x10b0db){if(_0x10b0db){return _0x10b0db[_0x36be('0x25')](_0x4b7559)['then'](function(_0x67ed59){return _0x67ed59;});}return null;};}function removeEntity(_0x3683c0,_0x5a53bf){return function(_0x423f98){if(_0x423f98){return _0x423f98['destroy']()[_0x36be('0x26')](function(){_0x3683c0[_0x36be('0x1d')](0xcc)[_0x36be('0x1e')]();});}};}function handleEntityNotFound(_0x82de8d,_0x20817c){return function(_0x8a9b48){if(!_0x8a9b48){_0x82de8d['sendStatus'](0x194);}return _0x8a9b48;};}function handleError(_0x375ed6,_0x2f01ef){_0x2f01ef=_0x2f01ef||0x1f4;return function(_0x39d34e){logger[_0x36be('0x27')](_0x39d34e[_0x36be('0x28')]);if(_0x39d34e[_0x36be('0x29')]){delete _0x39d34e[_0x36be('0x29')];}_0x375ed6[_0x36be('0x1d')](_0x2f01ef)['send'](_0x39d34e);};}exports[_0x36be('0x2a')]=function(_0x1a30fb,_0x53a4a9){var _0x9e7fd0={},_0x26f8e4={},_0x4dc656={'count':0x0,'rows':[]};var _0x4b7e88=_['map'](db[_0x36be('0x2b')][_0x36be('0x2c')],function(_0x58927b){return{'name':_0x58927b['fieldName'],'type':_0x58927b[_0x36be('0x2d')]['key']};});_0x26f8e4['model']=_[_0x36be('0x2e')](_0x4b7e88,_0x36be('0x29'));_0x26f8e4[_0x36be('0x2f')]=_[_0x36be('0x30')](_0x1a30fb[_0x36be('0x2f')]);_0x26f8e4[_0x36be('0x31')]=_[_0x36be('0x32')](_0x26f8e4['model'],_0x26f8e4[_0x36be('0x2f')]);_0x9e7fd0[_0x36be('0x33')]=_[_0x36be('0x32')](_0x26f8e4['model'],qs[_0x36be('0x34')](_0x1a30fb[_0x36be('0x2f')][_0x36be('0x34')]));_0x9e7fd0['attributes']=_0x9e7fd0[_0x36be('0x33')][_0x36be('0x35')]?_0x9e7fd0['attributes']:_0x26f8e4[_0x36be('0x36')];if(!_0x1a30fb[_0x36be('0x2f')][_0x36be('0x37')](_0x36be('0x38'))){_0x9e7fd0[_0x36be('0x21')]=qs['limit'](_0x1a30fb[_0x36be('0x2f')][_0x36be('0x21')]);_0x9e7fd0['offset']=qs[_0x36be('0x20')](_0x1a30fb[_0x36be('0x2f')]['offset']);}_0x9e7fd0[_0x36be('0x39')]=qs[_0x36be('0x3a')](_0x1a30fb[_0x36be('0x2f')][_0x36be('0x3a')]);_0x9e7fd0[_0x36be('0x3b')]=qs[_0x36be('0x31')](_[_0x36be('0x3c')](_0x1a30fb['query'],_0x26f8e4[_0x36be('0x31')]),_0x4b7e88);if(_0x1a30fb[_0x36be('0x2f')][_0x36be('0x3d')]){_0x9e7fd0[_0x36be('0x3b')]=_[_0x36be('0x3e')](_0x9e7fd0['where'],{'$or':_[_0x36be('0x2e')](_0x4b7e88,function(_0x5ddfd9){if(_0x5ddfd9['type']!=='VIRTUAL'){var _0x340d5a={};_0x340d5a[_0x5ddfd9[_0x36be('0x29')]]={'$like':'%'+_0x1a30fb[_0x36be('0x2f')][_0x36be('0x3d')]+'%'};return _0x340d5a;}})});}_0x9e7fd0=_['merge']({},_0x9e7fd0,_0x1a30fb['options']);var _0x83aaf9={'where':_0x9e7fd0[_0x36be('0x3b')]};return db[_0x36be('0x2b')][_0x36be('0x22')](_0x83aaf9)['then'](function(_0x3acddb){_0x4dc656['count']=_0x3acddb;if(_0x1a30fb['query'][_0x36be('0x3f')]){_0x9e7fd0[_0x36be('0x40')]=[{'all':!![]}];}return db[_0x36be('0x2b')]['findAll'](_0x9e7fd0);})['then'](function(_0x45dfcb){_0x4dc656[_0x36be('0x41')]=_0x45dfcb;return _0x4dc656;})['then'](respondWithFilteredResult(_0x53a4a9,_0x9e7fd0))[_0x36be('0x42')](handleError(_0x53a4a9,null));};exports[_0x36be('0x43')]=function(_0x14fbdc,_0x2643f4){var _0x259973={'raw':![],'where':{'id':_0x14fbdc[_0x36be('0x44')]['id']}},_0x25da8a={};_0x25da8a[_0x36be('0x36')]=_[_0x36be('0x30')](db[_0x36be('0x2b')][_0x36be('0x2c')]);_0x25da8a['query']=_[_0x36be('0x30')](_0x14fbdc[_0x36be('0x2f')]);_0x25da8a[_0x36be('0x31')]=_[_0x36be('0x32')](_0x25da8a[_0x36be('0x36')],_0x25da8a[_0x36be('0x2f')]);_0x259973[_0x36be('0x33')]=_[_0x36be('0x32')](_0x25da8a[_0x36be('0x36')],qs[_0x36be('0x34')](_0x14fbdc[_0x36be('0x2f')][_0x36be('0x34')]));_0x259973['attributes']=_0x259973[_0x36be('0x33')][_0x36be('0x35')]?_0x259973[_0x36be('0x33')]:_0x25da8a['model'];if(_0x14fbdc[_0x36be('0x2f')][_0x36be('0x3f')]){_0x259973[_0x36be('0x40')]=[{'all':!![]}];}_0x259973=_['merge']({},_0x259973,_0x14fbdc[_0x36be('0x45')]);return db[_0x36be('0x2b')][_0x36be('0x46')](_0x259973)[_0x36be('0x26')](handleEntityNotFound(_0x2643f4,null))[_0x36be('0x26')](respondWithResult(_0x2643f4,null))[_0x36be('0x42')](handleError(_0x2643f4,null));};exports[_0x36be('0x47')]=function(_0x38d9c5,_0x1f260d){return db[_0x36be('0x2b')]['create'](_0x38d9c5['body'],{})['then'](respondWithResult(_0x1f260d,0xc9))[_0x36be('0x42')](handleError(_0x1f260d,null));};exports['update']=function(_0x8a39e0,_0x3f5611){if(_0x8a39e0[_0x36be('0x48')]['id']){delete _0x8a39e0['body']['id'];}return db['SugarcrmConfiguration'][_0x36be('0x46')]({'where':{'id':_0x8a39e0[_0x36be('0x44')]['id']}})[_0x36be('0x26')](handleEntityNotFound(_0x3f5611,null))[_0x36be('0x26')](saveUpdates(_0x8a39e0[_0x36be('0x48')],null))[_0x36be('0x26')](respondWithResult(_0x3f5611,null))[_0x36be('0x42')](handleError(_0x3f5611,null));};exports[_0x36be('0x49')]=function(_0x979bce,_0x4f839e){return db[_0x36be('0x2b')][_0x36be('0x46')]({'where':{'id':_0x979bce[_0x36be('0x44')]['id']}})[_0x36be('0x26')](handleEntityNotFound(_0x4f839e,null))[_0x36be('0x26')](removeEntity(_0x4f839e,null))[_0x36be('0x42')](handleError(_0x4f839e,null));};exports[_0x36be('0x4a')]=function(_0x7d1292,_0x5c0ed3,_0x16cb22){var _0x473bf9={};var _0x5465a4={};var _0x332fcd;var _0x210758;return db[_0x36be('0x2b')][_0x36be('0x4b')]({'where':{'id':_0x7d1292['params']['id']}})[_0x36be('0x26')](handleEntityNotFound(_0x5c0ed3,null))[_0x36be('0x26')](function(_0x2ac681){if(_0x2ac681){_0x332fcd=_0x2ac681;_0x5465a4[_0x36be('0x36')]=_[_0x36be('0x30')](db[_0x36be('0x4c')][_0x36be('0x2c')]);_0x5465a4[_0x36be('0x2f')]=_[_0x36be('0x30')](_0x7d1292[_0x36be('0x2f')]);_0x5465a4[_0x36be('0x31')]=_[_0x36be('0x32')](_0x5465a4['model'],_0x5465a4['query']);_0x473bf9[_0x36be('0x33')]=_[_0x36be('0x32')](_0x5465a4['model'],qs[_0x36be('0x34')](_0x7d1292[_0x36be('0x2f')]['fields']));_0x473bf9[_0x36be('0x33')]=_0x473bf9['attributes'][_0x36be('0x35')]?_0x473bf9[_0x36be('0x33')]:_0x5465a4[_0x36be('0x36')];_0x473bf9[_0x36be('0x39')]=qs[_0x36be('0x3a')](_0x7d1292[_0x36be('0x2f')][_0x36be('0x3a')]);_0x473bf9['where']=qs[_0x36be('0x31')](_['pick'](_0x7d1292[_0x36be('0x2f')],_0x5465a4[_0x36be('0x31')]));if(_0x7d1292['query'][_0x36be('0x3d')]){_0x473bf9[_0x36be('0x3b')]=_[_0x36be('0x3e')](_0x473bf9[_0x36be('0x3b')],{'$or':_[_0x36be('0x2e')](_0x473bf9['attributes'],function(_0x550638){var _0x431125={};_0x431125[_0x550638]={'$like':'%'+_0x7d1292[_0x36be('0x2f')][_0x36be('0x3d')]+'%'};return _0x431125;})});}_0x473bf9=_[_0x36be('0x3e')]({},_0x473bf9,_0x7d1292[_0x36be('0x45')]);return _0x332fcd[_0x36be('0x4a')](_0x473bf9);}})[_0x36be('0x26')](function(_0x3f4519){if(_0x3f4519){_0x210758=_0x3f4519[_0x36be('0x35')];if(!_0x7d1292[_0x36be('0x2f')]['hasOwnProperty']('nolimit')){_0x473bf9[_0x36be('0x21')]=qs[_0x36be('0x21')](_0x7d1292['query'][_0x36be('0x21')]);_0x473bf9[_0x36be('0x20')]=qs[_0x36be('0x20')](_0x7d1292[_0x36be('0x2f')][_0x36be('0x20')]);}return _0x332fcd[_0x36be('0x4a')](_0x473bf9);}})[_0x36be('0x26')](function(_0x630cea){if(_0x630cea){return _0x630cea?{'count':_0x210758,'rows':_0x630cea}:null;}})[_0x36be('0x26')](respondWithResult(_0x5c0ed3,null))['catch'](handleError(_0x5c0ed3,null));};exports[_0x36be('0x4d')]=function(_0x1a227a,_0x4e66e0,_0x4bd0e9){var _0x3f8f6f={};var _0x2fcec4={};var _0x3c8d13;var _0x4ddde4;return db[_0x36be('0x2b')][_0x36be('0x4b')]({'where':{'id':_0x1a227a['params']['id']}})[_0x36be('0x26')](handleEntityNotFound(_0x4e66e0,null))[_0x36be('0x26')](function(_0x294a37){if(_0x294a37){_0x3c8d13=_0x294a37;_0x2fcec4['model']=_[_0x36be('0x30')](db[_0x36be('0x4c')][_0x36be('0x2c')]);_0x2fcec4[_0x36be('0x2f')]=_[_0x36be('0x30')](_0x1a227a[_0x36be('0x2f')]);_0x2fcec4[_0x36be('0x31')]=_[_0x36be('0x32')](_0x2fcec4[_0x36be('0x36')],_0x2fcec4['query']);_0x3f8f6f[_0x36be('0x33')]=_[_0x36be('0x32')](_0x2fcec4['model'],qs[_0x36be('0x34')](_0x1a227a[_0x36be('0x2f')][_0x36be('0x34')]));_0x3f8f6f[_0x36be('0x33')]=_0x3f8f6f[_0x36be('0x33')]['length']?_0x3f8f6f[_0x36be('0x33')]:_0x2fcec4[_0x36be('0x36')];_0x3f8f6f['order']=qs[_0x36be('0x3a')](_0x1a227a['query'][_0x36be('0x3a')]);_0x3f8f6f[_0x36be('0x3b')]=qs['filters'](_['pick'](_0x1a227a['query'],_0x2fcec4['filters']));if(_0x1a227a[_0x36be('0x2f')][_0x36be('0x3d')]){_0x3f8f6f[_0x36be('0x3b')]=_['merge'](_0x3f8f6f[_0x36be('0x3b')],{'$or':_['map'](_0x3f8f6f[_0x36be('0x33')],function(_0x450446){var _0x472bc5={};_0x472bc5[_0x450446]={'$like':'%'+_0x1a227a[_0x36be('0x2f')][_0x36be('0x3d')]+'%'};return _0x472bc5;})});}_0x3f8f6f=_[_0x36be('0x3e')]({},_0x3f8f6f,_0x1a227a['options']);return _0x3c8d13[_0x36be('0x4d')](_0x3f8f6f);}})['then'](function(_0x1370de){if(_0x1370de){_0x4ddde4=_0x1370de[_0x36be('0x35')];if(!_0x1a227a[_0x36be('0x2f')][_0x36be('0x37')]('nolimit')){_0x3f8f6f['limit']=qs['limit'](_0x1a227a['query'][_0x36be('0x21')]);_0x3f8f6f['offset']=qs[_0x36be('0x20')](_0x1a227a[_0x36be('0x2f')]['offset']);}return _0x3c8d13[_0x36be('0x4d')](_0x3f8f6f);}})[_0x36be('0x26')](function(_0x54ea38){if(_0x54ea38){return _0x54ea38?{'count':_0x4ddde4,'rows':_0x54ea38}:null;}})['then'](respondWithResult(_0x4e66e0,null))[_0x36be('0x42')](handleError(_0x4e66e0,null));};exports['getDescriptions']=function(_0x12a815,_0x533704,_0x2e1518){var _0x2923be={};var _0xcf65fb={};var _0x59a255;var _0x1c000b;return db[_0x36be('0x2b')][_0x36be('0x4b')]({'where':{'id':_0x12a815['params']['id']}})[_0x36be('0x26')](handleEntityNotFound(_0x533704,null))[_0x36be('0x26')](function(_0x8a38fd){if(_0x8a38fd){_0x59a255=_0x8a38fd;_0xcf65fb[_0x36be('0x36')]=_[_0x36be('0x30')](db['SugarcrmField'][_0x36be('0x2c')]);_0xcf65fb[_0x36be('0x2f')]=_['keys'](_0x12a815[_0x36be('0x2f')]);_0xcf65fb[_0x36be('0x31')]=_[_0x36be('0x32')](_0xcf65fb[_0x36be('0x36')],_0xcf65fb[_0x36be('0x2f')]);_0x2923be[_0x36be('0x33')]=_[_0x36be('0x32')](_0xcf65fb[_0x36be('0x36')],qs[_0x36be('0x34')](_0x12a815[_0x36be('0x2f')][_0x36be('0x34')]));_0x2923be[_0x36be('0x33')]=_0x2923be[_0x36be('0x33')][_0x36be('0x35')]?_0x2923be['attributes']:_0xcf65fb[_0x36be('0x36')];_0x2923be[_0x36be('0x39')]=qs[_0x36be('0x3a')](_0x12a815[_0x36be('0x2f')][_0x36be('0x3a')]);_0x2923be[_0x36be('0x3b')]=qs[_0x36be('0x31')](_[_0x36be('0x3c')](_0x12a815[_0x36be('0x2f')],_0xcf65fb[_0x36be('0x31')]));if(_0x12a815[_0x36be('0x2f')][_0x36be('0x3d')]){_0x2923be[_0x36be('0x3b')]=_[_0x36be('0x3e')](_0x2923be['where'],{'$or':_[_0x36be('0x2e')](_0x2923be[_0x36be('0x33')],function(_0x16b965){var _0x3804ff={};_0x3804ff[_0x16b965]={'$like':'%'+_0x12a815[_0x36be('0x2f')][_0x36be('0x3d')]+'%'};return _0x3804ff;})});}_0x2923be=_[_0x36be('0x3e')]({},_0x2923be,_0x12a815[_0x36be('0x45')]);return _0x59a255[_0x36be('0x4e')](_0x2923be);}})[_0x36be('0x26')](function(_0x52d78d){if(_0x52d78d){_0x1c000b=_0x52d78d['length'];if(!_0x12a815['query']['hasOwnProperty'](_0x36be('0x38'))){_0x2923be['limit']=qs[_0x36be('0x21')](_0x12a815[_0x36be('0x2f')][_0x36be('0x21')]);_0x2923be[_0x36be('0x20')]=qs[_0x36be('0x20')](_0x12a815[_0x36be('0x2f')][_0x36be('0x20')]);}return _0x59a255['getDescriptions'](_0x2923be);}})['then'](function(_0x1a36e5){if(_0x1a36e5){return _0x1a36e5?{'count':_0x1c000b,'rows':_0x1a36e5}:null;}})[_0x36be('0x26')](respondWithResult(_0x533704,null))[_0x36be('0x42')](handleError(_0x533704,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c7b9719..b5a8d34 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 _0xe697=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','../../config/logger'];(function(_0x3154e1,_0x5d484e){var _0x5ebffe=function(_0x3546d6){while(--_0x3546d6){_0x3154e1['push'](_0x3154e1['shift']());}};_0x5ebffe(++_0x5d484e);}(_0xe697,0xf2));var _0x7e69=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0xe697[_0xfb42e6];return _0x27265b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7e69('0x0'))('api');var moment=require(_0x7e69('0x1'));var BPromise=require(_0x7e69('0x2'));var rp=require(_0x7e69('0x3'));var fs=require('fs');var path=require(_0x7e69('0x4'));var rimraf=require(_0x7e69('0x5'));var config=require('../../config/environment');var attributes=require(_0x7e69('0x6'));module['exports']=function(_0x3a2d10,_0xcc3cf1){return _0x3a2d10[_0x7e69('0x7')](_0x7e69('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a11=['request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird'];(function(_0x5f2076,_0xbd2aaa){var _0x23408f=function(_0xfe5479){while(--_0xfe5479){_0x5f2076['push'](_0x5f2076['shift']());}};_0x23408f(++_0xbd2aaa);}(_0x5a11,0x1db));var _0x15a1=function(_0x514403,_0x25af5f){_0x514403=_0x514403-0x0;var _0x1b7a69=_0x5a11[_0x514403];return _0x1b7a69;};'use strict';var _=require(_0x15a1('0x0'));var util=require(_0x15a1('0x1'));var logger=require('../../config/logger')(_0x15a1('0x2'));var moment=require(_0x15a1('0x3'));var BPromise=require(_0x15a1('0x4'));var rp=require(_0x15a1('0x5'));var fs=require('fs');var path=require(_0x15a1('0x6'));var rimraf=require(_0x15a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x15a1('0x8'));module['exports']=function(_0x13e5d8,_0x20c629){return _0x13e5d8[_0x15a1('0x9')](_0x15a1('0xa'),attributes,{'tableName':_0x15a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 55ba98d..0793374 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 _0x5750=['code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x45e3cb,_0x35c413){var _0x1649ae=function(_0x3eb074){while(--_0x3eb074){_0x45e3cb['push'](_0x45e3cb['shift']());}};_0x1649ae(++_0x35c413);}(_0x5750,0x194));var _0x0575=function(_0xb0469e,_0x57edb5){_0xb0469e=_0xb0469e-0x0;var _0x3a8da5=_0x5750[_0xb0469e];return _0x3a8da5;};'use strict';var _=require(_0x0575('0x0'));var util=require('util');var moment=require(_0x0575('0x1'));var BPromise=require(_0x0575('0x2'));var rs=require(_0x0575('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0575('0x4'))['db'];var utils=require(_0x0575('0x5'));var logger=require('../../config/logger')(_0x0575('0x6'));var config=require(_0x0575('0x7'));var jayson=require(_0x0575('0x8'));var client=jayson['client'][_0x0575('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4055f3,_0xc25b3f,_0x58675d){return new BPromise(function(_0x4871b5,_0x3ba292){return client['request'](_0x4055f3,_0x58675d)[_0x0575('0xa')](function(_0xa02d7e){logger[_0x0575('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc25b3f,_0x0575('0xc'));logger[_0x0575('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xc25b3f,_0x0575('0xc'),JSON[_0x0575('0xe')](_0xa02d7e));if(_0xa02d7e['error']){if(_0xa02d7e[_0x0575('0xf')][_0x0575('0x10')]===0x1f4){logger[_0x0575('0xf')](_0x0575('0x11'),_0xc25b3f,_0xa02d7e[_0x0575('0xf')][_0x0575('0x12')]);return _0x3ba292(_0xa02d7e[_0x0575('0xf')]['message']);}logger[_0x0575('0xf')](_0x0575('0x11'),_0xc25b3f,_0xa02d7e['error'][_0x0575('0x12')]);return _0x4871b5(_0xa02d7e['error'][_0x0575('0x12')]);}else{logger[_0x0575('0xb')](_0x0575('0x11'),_0xc25b3f,_0x0575('0xc'));_0x4871b5(_0xa02d7e[_0x0575('0x13')][_0x0575('0x12')]);}})[_0x0575('0x14')](function(_0x287744){logger[_0x0575('0xf')](_0x0575('0x11'),_0xc25b3f,_0x287744);_0x3ba292(_0x287744);});});} \ No newline at end of file +var _0x5a66=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x534549,_0x8c5faa){var _0x3cca7e=function(_0x2fd4c6){while(--_0x2fd4c6){_0x534549['push'](_0x534549['shift']());}};_0x3cca7e(++_0x8c5faa);}(_0x5a66,0x198));var _0x65a6=function(_0xe01a2,_0xfd91e){_0xe01a2=_0xe01a2-0x0;var _0x1e8116=_0x5a66[_0xe01a2];return _0x1e8116;};'use strict';var _=require(_0x65a6('0x0'));var util=require(_0x65a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65a6('0x2'));var fs=require('fs');var Redis=require(_0x65a6('0x3'));var db=require(_0x65a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65a6('0x5'))(_0x65a6('0x6'));var config=require(_0x65a6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x65a6('0x8')][_0x65a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2815d0,_0x298b08,_0x195f44){return new BPromise(function(_0x34b53f,_0x2e1000){return client[_0x65a6('0xa')](_0x2815d0,_0x195f44)[_0x65a6('0xb')](function(_0x4ba94a){logger[_0x65a6('0xc')](_0x65a6('0xd'),_0x298b08,'request\x20sent');logger[_0x65a6('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x298b08,'request\x20sent',JSON[_0x65a6('0xf')](_0x4ba94a));if(_0x4ba94a[_0x65a6('0x10')]){if(_0x4ba94a[_0x65a6('0x10')][_0x65a6('0x11')]===0x1f4){logger['error'](_0x65a6('0xd'),_0x298b08,_0x4ba94a['error']['message']);return _0x2e1000(_0x4ba94a[_0x65a6('0x10')][_0x65a6('0x12')]);}logger[_0x65a6('0x10')](_0x65a6('0xd'),_0x298b08,_0x4ba94a[_0x65a6('0x10')][_0x65a6('0x12')]);return _0x34b53f(_0x4ba94a[_0x65a6('0x10')][_0x65a6('0x12')]);}else{logger[_0x65a6('0xc')](_0x65a6('0xd'),_0x298b08,'request\x20sent');_0x34b53f(_0x4ba94a['result'][_0x65a6('0x12')]);}})['catch'](function(_0x12f27b){logger[_0x65a6('0x10')](_0x65a6('0xd'),_0x298b08,_0x12f27b);_0x2e1000(_0x12f27b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2be0982..ed1f107 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 _0xd023=['../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x58a364,_0x3439f6){var _0x409b74=function(_0xff5c15){while(--_0xff5c15){_0x58a364['push'](_0x58a364['shift']());}};_0x409b74(++_0x3439f6);}(_0xd023,0x162));var _0x3d02=function(_0x34cea1,_0x16d860){_0x34cea1=_0x34cea1-0x0;var _0x2d796a=_0xd023[_0x34cea1];return _0x2d796a;};'use strict';var multer=require('multer');var util=require(_0x3d02('0x0'));var path=require('path');var timeout=require(_0x3d02('0x1'));var express=require(_0x3d02('0x2'));var router=express[_0x3d02('0x3')]();var fs_extra=require(_0x3d02('0x4'));var auth=require(_0x3d02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d02('0x6'));var controller=require(_0x3d02('0x7'));router[_0x3d02('0x8')]('/',auth[_0x3d02('0x9')](),controller[_0x3d02('0xa')]);router[_0x3d02('0x8')](_0x3d02('0xb'),auth['isAuthenticated'](),controller[_0x3d02('0xc')]);router[_0x3d02('0xd')]('/',auth[_0x3d02('0x9')](),controller[_0x3d02('0xe')]);router['put'](_0x3d02('0xb'),auth['isAuthenticated'](),controller[_0x3d02('0xf')]);router[_0x3d02('0x10')](_0x3d02('0xb'),auth[_0x3d02('0x9')](),controller[_0x3d02('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaa16=['show','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x326d78,_0x16bdfe){var _0xfe7170=function(_0x147e32){while(--_0x147e32){_0x326d78['push'](_0x326d78['shift']());}};_0xfe7170(++_0x16bdfe);}(_0xaa16,0x14c));var _0x6aa1=function(_0x861e02,_0x33f772){_0x861e02=_0x861e02-0x0;var _0x48fc24=_0xaa16[_0x861e02];return _0x48fc24;};'use strict';var multer=require(_0x6aa1('0x0'));var util=require('util');var path=require(_0x6aa1('0x1'));var timeout=require(_0x6aa1('0x2'));var express=require(_0x6aa1('0x3'));var router=express[_0x6aa1('0x4')]();var fs_extra=require(_0x6aa1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6aa1('0x6'));var config=require(_0x6aa1('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x6aa1('0x8')]('/',auth[_0x6aa1('0x9')](),controller['index']);router[_0x6aa1('0x8')]('/:id',auth[_0x6aa1('0x9')](),controller[_0x6aa1('0xa')]);router['post']('/',auth[_0x6aa1('0x9')](),controller[_0x6aa1('0xb')]);router[_0x6aa1('0xc')](_0x6aa1('0xd'),auth[_0x6aa1('0x9')](),controller[_0x6aa1('0xe')]);router[_0x6aa1('0xf')](_0x6aa1('0xd'),auth[_0x6aa1('0x9')](),controller[_0x6aa1('0x10')]);module[_0x6aa1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6fd6d34..0ceb15f 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 _0x4812=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x8c8762,_0x10c0ab){var _0x24e27b=function(_0x483e40){while(--_0x483e40){_0x8c8762['push'](_0x8c8762['shift']());}};_0x24e27b(++_0x10c0ab);}(_0x4812,0x1c8));var _0x2481=function(_0x3b014d,_0x516fdf){_0x3b014d=_0x3b014d-0x0;var _0x2789ea=_0x4812[_0x3b014d];return _0x2789ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2481('0x0')](_0x2481('0x1'),_0x2481('0x2'),_0x2481('0x3'),_0x2481('0x4'),_0x2481('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2481('0x6')]},'key':{'type':Sequelize[_0x2481('0x6')]},'keyType':{'type':Sequelize[_0x2481('0x0')](_0x2481('0x1'),_0x2481('0x2'),_0x2481('0x3'))},'keyContent':{'type':Sequelize[_0x2481('0x6')]},'idField':{'type':Sequelize[_0x2481('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2481('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2481('0x6')]}}; \ No newline at end of file +var _0x7e79=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1149b4,_0x6d65e9){var _0xb6f2c4=function(_0x1482ff){while(--_0x1482ff){_0x1149b4['push'](_0x1149b4['shift']());}};_0xb6f2c4(++_0x6d65e9);}(_0x7e79,0xb2));var _0x97e7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7e79[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x97e7('0x0'));module[_0x97e7('0x1')]={'type':{'type':Sequelize[_0x97e7('0x2')](_0x97e7('0x3'),_0x97e7('0x4'),_0x97e7('0x5'),'keyValue',_0x97e7('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x97e7('0x7')]},'key':{'type':Sequelize[_0x97e7('0x7')]},'keyType':{'type':Sequelize[_0x97e7('0x2')](_0x97e7('0x3'),_0x97e7('0x4'),_0x97e7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x97e7('0x7')]},'nameField':{'type':Sequelize[_0x97e7('0x7')]},'customField':{'type':Sequelize[_0x97e7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x97e7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1d51a37..0c4896f 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 _0x2f4f=['reject','save','update','then','destroy','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','options','where','includeAll','include','rows','catch','show','params','length','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0x2f4f,0x1ca));var _0xf2f4=function(_0xa7e110,_0x10bed0){_0xa7e110=_0xa7e110-0x0;var _0x7f1aec=_0x2f4f[_0xa7e110];return _0x7f1aec;};'use strict';var emlformat=require(_0xf2f4('0x0'));var rimraf=require(_0xf2f4('0x1'));var zipdir=require(_0xf2f4('0x2'));var jsonpatch=require(_0xf2f4('0x3'));var rp=require(_0xf2f4('0x4'));var moment=require('moment');var BPromise=require(_0xf2f4('0x5'));var Mustache=require(_0xf2f4('0x6'));var util=require(_0xf2f4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf2f4('0x8'));var ejs=require(_0xf2f4('0x9'));var fs=require('fs');var fs_extra=require(_0xf2f4('0xa'));var _=require(_0xf2f4('0xb'));var squel=require(_0xf2f4('0xc'));var crypto=require('crypto');var jsforce=require(_0xf2f4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf2f4('0x8'));var querystring=require(_0xf2f4('0xe'));var Papa=require('papaparse');var Redis=require(_0xf2f4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf2f4('0x10'));var hardwareService=require(_0xf2f4('0x11'));var logger=require(_0xf2f4('0x12'))(_0xf2f4('0x13'));var utils=require(_0xf2f4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf2f4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58bf70,_0x6c7d4e){_0x6c7d4e=_0x6c7d4e||0xcc;return function(_0x346c6d){if(_0x346c6d){return _0x58bf70[_0xf2f4('0x16')](_0x6c7d4e);}return _0x58bf70[_0xf2f4('0x17')](_0x6c7d4e)[_0xf2f4('0x18')]();};}function respondWithResult(_0x49bd1c,_0x58a9cc){_0x58a9cc=_0x58a9cc||0xc8;return function(_0x1940cd){if(_0x1940cd){return _0x49bd1c[_0xf2f4('0x17')](_0x58a9cc)[_0xf2f4('0x19')](_0x1940cd);}};}function respondWithFilteredResult(_0x43560a,_0x1c463c){return function(_0x1a8c37){if(_0x1a8c37){var _0xaccfad=typeof _0x1c463c['offset']===_0xf2f4('0x1a')&&typeof _0x1c463c[_0xf2f4('0x1b')]===_0xf2f4('0x1a');var _0x5a8841=_0x1a8c37[_0xf2f4('0x1c')];var _0x18c526=_0xaccfad?0x0:_0x1c463c[_0xf2f4('0x1d')];var _0x475fba=_0xaccfad?_0x1a8c37[_0xf2f4('0x1c')]:_0x1c463c[_0xf2f4('0x1d')]+_0x1c463c['limit'];var _0x53cef4;if(_0x475fba>=_0x5a8841){_0x475fba=_0x5a8841;_0x53cef4=0xc8;}else{_0x53cef4=0xce;}_0x43560a[_0xf2f4('0x17')](_0x53cef4);return _0x43560a['set'](_0xf2f4('0x1e'),_0x18c526+'-'+_0x475fba+'/'+_0x5a8841)[_0xf2f4('0x19')](_0x1a8c37);}return null;};}function patchUpdates(_0x5d7b7a){return function(_0x488382){try{jsonpatch[_0xf2f4('0x1f')](_0x488382,_0x5d7b7a,!![]);}catch(_0x314c28){return BPromise[_0xf2f4('0x20')](_0x314c28);}return _0x488382[_0xf2f4('0x21')]();};}function saveUpdates(_0x39453b,_0x47564d){return function(_0x1a958b){if(_0x1a958b){return _0x1a958b[_0xf2f4('0x22')](_0x39453b)[_0xf2f4('0x23')](function(_0x2eb869){return _0x2eb869;});}return null;};}function removeEntity(_0x58f89b,_0x3c9158){return function(_0x117571){if(_0x117571){return _0x117571[_0xf2f4('0x24')]()['then'](function(){_0x58f89b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f1ca,_0x594f9b){return function(_0x26234c){if(!_0x26234c){_0x27f1ca[_0xf2f4('0x16')](0x194);}return _0x26234c;};}function handleError(_0x3853fc,_0x3d2412){_0x3d2412=_0x3d2412||0x1f4;return function(_0x5b0d5d){logger['error'](_0x5b0d5d[_0xf2f4('0x25')]);if(_0x5b0d5d['name']){delete _0x5b0d5d[_0xf2f4('0x26')];}_0x3853fc['status'](_0x3d2412)['send'](_0x5b0d5d);};}exports[_0xf2f4('0x27')]=function(_0x4e24ac,_0x3c9561){var _0x437240={},_0x17caed={},_0x200054={'count':0x0,'rows':[]};var _0x41eda6=_['map'](db[_0xf2f4('0x28')][_0xf2f4('0x29')],function(_0x2b79f1){return{'name':_0x2b79f1[_0xf2f4('0x2a')],'type':_0x2b79f1[_0xf2f4('0x2b')][_0xf2f4('0x2c')]};});_0x17caed[_0xf2f4('0x2d')]=_[_0xf2f4('0x2e')](_0x41eda6,_0xf2f4('0x26'));_0x17caed[_0xf2f4('0x2f')]=_[_0xf2f4('0x30')](_0x4e24ac[_0xf2f4('0x2f')]);_0x17caed[_0xf2f4('0x31')]=_[_0xf2f4('0x32')](_0x17caed[_0xf2f4('0x2d')],_0x17caed[_0xf2f4('0x2f')]);_0x437240[_0xf2f4('0x33')]=_[_0xf2f4('0x32')](_0x17caed[_0xf2f4('0x2d')],qs[_0xf2f4('0x34')](_0x4e24ac['query'][_0xf2f4('0x34')]));_0x437240[_0xf2f4('0x33')]=_0x437240[_0xf2f4('0x33')]['length']?_0x437240['attributes']:_0x17caed[_0xf2f4('0x2d')];if(!_0x4e24ac[_0xf2f4('0x2f')][_0xf2f4('0x35')]('nolimit')){_0x437240[_0xf2f4('0x1b')]=qs['limit'](_0x4e24ac[_0xf2f4('0x2f')][_0xf2f4('0x1b')]);_0x437240[_0xf2f4('0x1d')]=qs[_0xf2f4('0x1d')](_0x4e24ac[_0xf2f4('0x2f')]['offset']);}_0x437240[_0xf2f4('0x36')]=qs[_0xf2f4('0x37')](_0x4e24ac[_0xf2f4('0x2f')]['sort']);_0x437240['where']=qs[_0xf2f4('0x31')](_['pick'](_0x4e24ac['query'],_0x17caed[_0xf2f4('0x31')]),_0x41eda6);if(_0x4e24ac[_0xf2f4('0x2f')][_0xf2f4('0x38')]){_0x437240['where']=_['merge'](_0x437240['where'],{'$or':_[_0xf2f4('0x2e')](_0x41eda6,function(_0x7f4a30){if(_0x7f4a30[_0xf2f4('0x2b')]!=='VIRTUAL'){var _0x1e8123={};_0x1e8123[_0x7f4a30[_0xf2f4('0x26')]]={'$like':'%'+_0x4e24ac[_0xf2f4('0x2f')][_0xf2f4('0x38')]+'%'};return _0x1e8123;}})});}_0x437240=_['merge']({},_0x437240,_0x4e24ac[_0xf2f4('0x39')]);var _0xe9cfac={'where':_0x437240[_0xf2f4('0x3a')]};return db[_0xf2f4('0x28')][_0xf2f4('0x1c')](_0xe9cfac)[_0xf2f4('0x23')](function(_0x601cbe){_0x200054[_0xf2f4('0x1c')]=_0x601cbe;if(_0x4e24ac[_0xf2f4('0x2f')][_0xf2f4('0x3b')]){_0x437240[_0xf2f4('0x3c')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x437240);})[_0xf2f4('0x23')](function(_0x595666){_0x200054[_0xf2f4('0x3d')]=_0x595666;return _0x200054;})[_0xf2f4('0x23')](respondWithFilteredResult(_0x3c9561,_0x437240))[_0xf2f4('0x3e')](handleError(_0x3c9561,null));};exports[_0xf2f4('0x3f')]=function(_0x392224,_0x21dc27){var _0x1ab921={'raw':!![],'where':{'id':_0x392224[_0xf2f4('0x40')]['id']}},_0x2851c2={};_0x2851c2[_0xf2f4('0x2d')]=_[_0xf2f4('0x30')](db[_0xf2f4('0x28')][_0xf2f4('0x29')]);_0x2851c2[_0xf2f4('0x2f')]=_[_0xf2f4('0x30')](_0x392224[_0xf2f4('0x2f')]);_0x2851c2[_0xf2f4('0x31')]=_['intersection'](_0x2851c2[_0xf2f4('0x2d')],_0x2851c2['query']);_0x1ab921['attributes']=_[_0xf2f4('0x32')](_0x2851c2[_0xf2f4('0x2d')],qs[_0xf2f4('0x34')](_0x392224['query'][_0xf2f4('0x34')]));_0x1ab921[_0xf2f4('0x33')]=_0x1ab921[_0xf2f4('0x33')][_0xf2f4('0x41')]?_0x1ab921[_0xf2f4('0x33')]:_0x2851c2[_0xf2f4('0x2d')];if(_0x392224[_0xf2f4('0x2f')][_0xf2f4('0x3b')]){_0x1ab921[_0xf2f4('0x3c')]=[{'all':!![]}];}_0x1ab921=_[_0xf2f4('0x42')]({},_0x1ab921,_0x392224[_0xf2f4('0x39')]);return db[_0xf2f4('0x28')][_0xf2f4('0x43')](_0x1ab921)['then'](handleEntityNotFound(_0x21dc27,null))[_0xf2f4('0x23')](respondWithResult(_0x21dc27,null))['catch'](handleError(_0x21dc27,null));};exports['create']=function(_0x66f3d5,_0x7beaa8){return db[_0xf2f4('0x28')][_0xf2f4('0x44')](_0x66f3d5[_0xf2f4('0x45')],{})['then'](respondWithResult(_0x7beaa8,0xc9))[_0xf2f4('0x3e')](handleError(_0x7beaa8,null));};exports['update']=function(_0x295492,_0xb3044d){if(_0x295492['body']['id']){delete _0x295492[_0xf2f4('0x45')]['id'];}return db[_0xf2f4('0x28')][_0xf2f4('0x43')]({'where':{'id':_0x295492[_0xf2f4('0x40')]['id']}})[_0xf2f4('0x23')](handleEntityNotFound(_0xb3044d,null))[_0xf2f4('0x23')](saveUpdates(_0x295492[_0xf2f4('0x45')],null))['then'](respondWithResult(_0xb3044d,null))[_0xf2f4('0x3e')](handleError(_0xb3044d,null));};exports[_0xf2f4('0x24')]=function(_0x5743dc,_0x584178){return db[_0xf2f4('0x28')][_0xf2f4('0x43')]({'where':{'id':_0x5743dc[_0xf2f4('0x40')]['id']}})[_0xf2f4('0x23')](handleEntityNotFound(_0x584178,null))['then'](removeEntity(_0x584178,null))[_0xf2f4('0x3e')](handleError(_0x584178,null));}; \ No newline at end of file +var _0x44cb=['findAll','rows','catch','show','params','length','find','create','body','destroy','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','then','sendStatus','error','stack','name','index','map','SugarcrmField','rawAttributes','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll'];(function(_0x49cf52,_0xe4caa9){var _0x1a6cfc=function(_0x12956e){while(--_0x12956e){_0x49cf52['push'](_0x49cf52['shift']());}};_0x1a6cfc(++_0xe4caa9);}(_0x44cb,0xd3));var _0xb44c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x44cb[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb44c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb44c('0x1'));var rp=require(_0xb44c('0x2'));var moment=require('moment');var BPromise=require(_0xb44c('0x3'));var Mustache=require('mustache');var util=require(_0xb44c('0x4'));var path=require(_0xb44c('0x5'));var sox=require(_0xb44c('0x6'));var csv=require(_0xb44c('0x7'));var ejs=require(_0xb44c('0x8'));var fs=require('fs');var fs_extra=require(_0xb44c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb44c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb44c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb44c('0xc'));var Papa=require(_0xb44c('0xd'));var Redis=require(_0xb44c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb44c('0xf'));var as=require(_0xb44c('0x10'));var hardwareService=require(_0xb44c('0x11'));var logger=require(_0xb44c('0x12'))(_0xb44c('0x13'));var utils=require(_0xb44c('0x14'));var config=require(_0xb44c('0x15'));var licenseUtil=require(_0xb44c('0x16'));var db=require(_0xb44c('0x17'))['db'];function respondWithStatusCode(_0x3fea63,_0x29c9b6){_0x29c9b6=_0x29c9b6||0xcc;return function(_0x5534f1){if(_0x5534f1){return _0x3fea63['sendStatus'](_0x29c9b6);}return _0x3fea63['status'](_0x29c9b6)[_0xb44c('0x18')]();};}function respondWithResult(_0x1eadc1,_0x3b8dc2){_0x3b8dc2=_0x3b8dc2||0xc8;return function(_0x571e04){if(_0x571e04){return _0x1eadc1[_0xb44c('0x19')](_0x3b8dc2)[_0xb44c('0x1a')](_0x571e04);}};}function respondWithFilteredResult(_0x50177a,_0x416435){return function(_0x2f22d2){if(_0x2f22d2){var _0x440917=typeof _0x416435[_0xb44c('0x1b')]===_0xb44c('0x1c')&&typeof _0x416435[_0xb44c('0x1d')]===_0xb44c('0x1c');var _0x4a5144=_0x2f22d2[_0xb44c('0x1e')];var _0xe5e054=_0x440917?0x0:_0x416435[_0xb44c('0x1b')];var _0xe8661c=_0x440917?_0x2f22d2[_0xb44c('0x1e')]:_0x416435[_0xb44c('0x1b')]+_0x416435[_0xb44c('0x1d')];var _0x2059a6;if(_0xe8661c>=_0x4a5144){_0xe8661c=_0x4a5144;_0x2059a6=0xc8;}else{_0x2059a6=0xce;}_0x50177a[_0xb44c('0x19')](_0x2059a6);return _0x50177a[_0xb44c('0x1f')]('Content-Range',_0xe5e054+'-'+_0xe8661c+'/'+_0x4a5144)[_0xb44c('0x1a')](_0x2f22d2);}return null;};}function patchUpdates(_0x5d033c){return function(_0x5759ce){try{jsonpatch['apply'](_0x5759ce,_0x5d033c,!![]);}catch(_0x157ad9){return BPromise['reject'](_0x157ad9);}return _0x5759ce['save']();};}function saveUpdates(_0x1e4d46,_0x219613){return function(_0xc3f72a){if(_0xc3f72a){return _0xc3f72a['update'](_0x1e4d46)[_0xb44c('0x20')](function(_0x4e2f4d){return _0x4e2f4d;});}return null;};}function removeEntity(_0x17d314,_0x5b1fb4){return function(_0x5e632b){if(_0x5e632b){return _0x5e632b['destroy']()[_0xb44c('0x20')](function(){_0x17d314[_0xb44c('0x19')](0xcc)[_0xb44c('0x18')]();});}};}function handleEntityNotFound(_0x3c8438,_0x18114b){return function(_0x1adfc3){if(!_0x1adfc3){_0x3c8438[_0xb44c('0x21')](0x194);}return _0x1adfc3;};}function handleError(_0x2029e2,_0x27c764){_0x27c764=_0x27c764||0x1f4;return function(_0xf760aa){logger[_0xb44c('0x22')](_0xf760aa[_0xb44c('0x23')]);if(_0xf760aa[_0xb44c('0x24')]){delete _0xf760aa['name'];}_0x2029e2['status'](_0x27c764)['send'](_0xf760aa);};}exports[_0xb44c('0x25')]=function(_0x48ade2,_0x443c08){var _0x11ced1={},_0x3841b0={},_0x301290={'count':0x0,'rows':[]};var _0x5477a0=_[_0xb44c('0x26')](db[_0xb44c('0x27')][_0xb44c('0x28')],function(_0xa3cc){return{'name':_0xa3cc['fieldName'],'type':_0xa3cc[_0xb44c('0x29')]['key']};});_0x3841b0[_0xb44c('0x2a')]=_[_0xb44c('0x26')](_0x5477a0,_0xb44c('0x24'));_0x3841b0[_0xb44c('0x2b')]=_['keys'](_0x48ade2[_0xb44c('0x2b')]);_0x3841b0['filters']=_[_0xb44c('0x2c')](_0x3841b0[_0xb44c('0x2a')],_0x3841b0['query']);_0x11ced1[_0xb44c('0x2d')]=_[_0xb44c('0x2c')](_0x3841b0[_0xb44c('0x2a')],qs[_0xb44c('0x2e')](_0x48ade2[_0xb44c('0x2b')][_0xb44c('0x2e')]));_0x11ced1[_0xb44c('0x2d')]=_0x11ced1['attributes']['length']?_0x11ced1[_0xb44c('0x2d')]:_0x3841b0[_0xb44c('0x2a')];if(!_0x48ade2[_0xb44c('0x2b')][_0xb44c('0x2f')](_0xb44c('0x30'))){_0x11ced1[_0xb44c('0x1d')]=qs[_0xb44c('0x1d')](_0x48ade2['query'][_0xb44c('0x1d')]);_0x11ced1[_0xb44c('0x1b')]=qs[_0xb44c('0x1b')](_0x48ade2[_0xb44c('0x2b')][_0xb44c('0x1b')]);}_0x11ced1['order']=qs['sort'](_0x48ade2['query'][_0xb44c('0x31')]);_0x11ced1[_0xb44c('0x32')]=qs[_0xb44c('0x33')](_['pick'](_0x48ade2[_0xb44c('0x2b')],_0x3841b0['filters']),_0x5477a0);if(_0x48ade2[_0xb44c('0x2b')]['filter']){_0x11ced1[_0xb44c('0x32')]=_[_0xb44c('0x34')](_0x11ced1[_0xb44c('0x32')],{'$or':_[_0xb44c('0x26')](_0x5477a0,function(_0x21c538){if(_0x21c538[_0xb44c('0x29')]!==_0xb44c('0x35')){var _0x1b699f={};_0x1b699f[_0x21c538[_0xb44c('0x24')]]={'$like':'%'+_0x48ade2[_0xb44c('0x2b')][_0xb44c('0x36')]+'%'};return _0x1b699f;}})});}_0x11ced1=_['merge']({},_0x11ced1,_0x48ade2[_0xb44c('0x37')]);var _0x426ee0={'where':_0x11ced1[_0xb44c('0x32')]};return db[_0xb44c('0x27')][_0xb44c('0x1e')](_0x426ee0)['then'](function(_0x275ed1){_0x301290[_0xb44c('0x1e')]=_0x275ed1;if(_0x48ade2[_0xb44c('0x2b')][_0xb44c('0x38')]){_0x11ced1['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xb44c('0x39')](_0x11ced1);})['then'](function(_0x340e0c){_0x301290[_0xb44c('0x3a')]=_0x340e0c;return _0x301290;})[_0xb44c('0x20')](respondWithFilteredResult(_0x443c08,_0x11ced1))[_0xb44c('0x3b')](handleError(_0x443c08,null));};exports[_0xb44c('0x3c')]=function(_0x537ac6,_0x9d2b90){var _0x437d28={'raw':!![],'where':{'id':_0x537ac6[_0xb44c('0x3d')]['id']}},_0xfdbca2={};_0xfdbca2[_0xb44c('0x2a')]=_['keys'](db[_0xb44c('0x27')][_0xb44c('0x28')]);_0xfdbca2[_0xb44c('0x2b')]=_['keys'](_0x537ac6[_0xb44c('0x2b')]);_0xfdbca2[_0xb44c('0x33')]=_['intersection'](_0xfdbca2['model'],_0xfdbca2['query']);_0x437d28[_0xb44c('0x2d')]=_[_0xb44c('0x2c')](_0xfdbca2['model'],qs[_0xb44c('0x2e')](_0x537ac6[_0xb44c('0x2b')][_0xb44c('0x2e')]));_0x437d28['attributes']=_0x437d28['attributes'][_0xb44c('0x3e')]?_0x437d28['attributes']:_0xfdbca2[_0xb44c('0x2a')];if(_0x537ac6['query'][_0xb44c('0x38')]){_0x437d28['include']=[{'all':!![]}];}_0x437d28=_['merge']({},_0x437d28,_0x537ac6[_0xb44c('0x37')]);return db[_0xb44c('0x27')][_0xb44c('0x3f')](_0x437d28)['then'](handleEntityNotFound(_0x9d2b90,null))['then'](respondWithResult(_0x9d2b90,null))[_0xb44c('0x3b')](handleError(_0x9d2b90,null));};exports[_0xb44c('0x40')]=function(_0x220e56,_0x5806ed){return db[_0xb44c('0x27')][_0xb44c('0x40')](_0x220e56[_0xb44c('0x41')],{})['then'](respondWithResult(_0x5806ed,0xc9))['catch'](handleError(_0x5806ed,null));};exports['update']=function(_0x3dd8fd,_0x381156){if(_0x3dd8fd[_0xb44c('0x41')]['id']){delete _0x3dd8fd[_0xb44c('0x41')]['id'];}return db[_0xb44c('0x27')][_0xb44c('0x3f')]({'where':{'id':_0x3dd8fd['params']['id']}})[_0xb44c('0x20')](handleEntityNotFound(_0x381156,null))[_0xb44c('0x20')](saveUpdates(_0x3dd8fd[_0xb44c('0x41')],null))[_0xb44c('0x20')](respondWithResult(_0x381156,null))[_0xb44c('0x3b')](handleError(_0x381156,null));};exports[_0xb44c('0x42')]=function(_0x42a45a,_0x282d7d){return db[_0xb44c('0x27')][_0xb44c('0x3f')]({'where':{'id':_0x42a45a[_0xb44c('0x3d')]['id']}})[_0xb44c('0x20')](handleEntityNotFound(_0x282d7d,null))[_0xb44c('0x20')](removeEntity(_0x282d7d,null))['catch'](handleError(_0x282d7d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 989e34a..ea5b176 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 _0xc7fa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x472a90,_0x449707){var _0xe59f8a=function(_0xef66ff){while(--_0xef66ff){_0x472a90['push'](_0x472a90['shift']());}};_0xe59f8a(++_0x449707);}(_0xc7fa,0x140));var _0xac7f=function(_0x2aefc6,_0x2e52be){_0x2aefc6=_0x2aefc6-0x0;var _0x17705c=_0xc7fa[_0x2aefc6];return _0x17705c;};'use strict';var _=require(_0xac7f('0x0'));var util=require(_0xac7f('0x1'));var logger=require(_0xac7f('0x2'))(_0xac7f('0x3'));var moment=require(_0xac7f('0x4'));var BPromise=require(_0xac7f('0x5'));var rp=require(_0xac7f('0x6'));var fs=require('fs');var path=require(_0xac7f('0x7'));var rimraf=require(_0xac7f('0x8'));var config=require(_0xac7f('0x9'));var attributes=require(_0xac7f('0xa'));module[_0xac7f('0xb')]=function(_0x2d45bd,_0x13f2ee){return _0x2d45bd[_0xac7f('0xc')](_0xac7f('0xd'),attributes,{'tableName':_0xac7f('0xe'),'paranoid':![],'indexes':[{'name':_0xac7f('0xf'),'fields':[_0xac7f('0x10'),_0xac7f('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1780=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x5b0f68,_0xc52ab4){var _0x366c32=function(_0x3e0ab6){while(--_0x3e0ab6){_0x5b0f68['push'](_0x5b0f68['shift']());}};_0x366c32(++_0xc52ab4);}(_0x1780,0x191));var _0x0178=function(_0x4d8759,_0x38bfde){_0x4d8759=_0x4d8759-0x0;var _0x50fe6e=_0x1780[_0x4d8759];return _0x50fe6e;};'use strict';var _=require('lodash');var util=require(_0x0178('0x0'));var logger=require(_0x0178('0x1'))(_0x0178('0x2'));var moment=require(_0x0178('0x3'));var BPromise=require(_0x0178('0x4'));var rp=require(_0x0178('0x5'));var fs=require('fs');var path=require(_0x0178('0x6'));var rimraf=require(_0x0178('0x7'));var config=require(_0x0178('0x8'));var attributes=require(_0x0178('0x9'));module[_0x0178('0xa')]=function(_0x4c3dfd,_0xbbd14e){return _0x4c3dfd['define'](_0x0178('0xb'),attributes,{'tableName':_0x0178('0xc'),'paranoid':![],'indexes':[{'name':_0x0178('0xd'),'fields':[_0x0178('0xe'),_0x0178('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 49e2216..0905420 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 _0xf11c=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x211d57,_0x55020d){var _0x3cbb1f=function(_0x280d0b){while(--_0x280d0b){_0x211d57['push'](_0x211d57['shift']());}};_0x3cbb1f(++_0x55020d);}(_0xf11c,0x1cf));var _0xcf11=function(_0x179ca0,_0x8c6c2f){_0x179ca0=_0x179ca0-0x0;var _0x2a5094=_0xf11c[_0x179ca0];return _0x2a5094;};'use strict';var _=require(_0xcf11('0x0'));var util=require(_0xcf11('0x1'));var moment=require(_0xcf11('0x2'));var BPromise=require(_0xcf11('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf11('0x4'));var db=require(_0xcf11('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf11('0x6'))('rpc');var config=require(_0xcf11('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcf11('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e115a,_0x5429e5,_0x16dec9){return new BPromise(function(_0x40c5c6,_0x29b3ed){return client[_0xcf11('0x9')](_0x2e115a,_0x16dec9)[_0xcf11('0xa')](function(_0xa49623){logger[_0xcf11('0xb')](_0xcf11('0xc'),_0x5429e5,_0xcf11('0xd'));logger[_0xcf11('0xe')](_0xcf11('0xf'),_0x5429e5,'request\x20sent',JSON[_0xcf11('0x10')](_0xa49623));if(_0xa49623['error']){if(_0xa49623['error'][_0xcf11('0x11')]===0x1f4){logger[_0xcf11('0x12')](_0xcf11('0xc'),_0x5429e5,_0xa49623[_0xcf11('0x12')]['message']);return _0x29b3ed(_0xa49623[_0xcf11('0x12')][_0xcf11('0x13')]);}logger[_0xcf11('0x12')](_0xcf11('0xc'),_0x5429e5,_0xa49623[_0xcf11('0x12')][_0xcf11('0x13')]);return _0x40c5c6(_0xa49623['error'][_0xcf11('0x13')]);}else{logger[_0xcf11('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x5429e5,_0xcf11('0xd'));_0x40c5c6(_0xa49623['result'][_0xcf11('0x13')]);}})[_0xcf11('0x14')](function(_0x23e9c8){logger[_0xcf11('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x5429e5,_0x23e9c8);_0x29b3ed(_0x23e9c8);});});} \ No newline at end of file +var _0xb642=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x13a8cc,_0x45b4fc){var _0x31b53c=function(_0x3ea73b){while(--_0x3ea73b){_0x13a8cc['push'](_0x13a8cc['shift']());}};_0x31b53c(++_0x45b4fc);}(_0xb642,0xcc));var _0x2b64=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xb642[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x2b64('0x0'));var util=require(_0x2b64('0x1'));var moment=require(_0x2b64('0x2'));var BPromise=require(_0x2b64('0x3'));var rs=require(_0x2b64('0x4'));var fs=require('fs');var Redis=require(_0x2b64('0x5'));var db=require(_0x2b64('0x6'))['db'];var utils=require(_0x2b64('0x7'));var logger=require(_0x2b64('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2b64('0x9')][_0x2b64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21e0b0,_0x5d27c6,_0x170d46){return new BPromise(function(_0x4be59e,_0xa5d182){return client[_0x2b64('0xb')](_0x21e0b0,_0x170d46)['then'](function(_0x2c73ab){logger[_0x2b64('0xc')](_0x2b64('0xd'),_0x5d27c6,_0x2b64('0xe'));logger[_0x2b64('0xf')](_0x2b64('0x10'),_0x5d27c6,_0x2b64('0xe'),JSON[_0x2b64('0x11')](_0x2c73ab));if(_0x2c73ab['error']){if(_0x2c73ab[_0x2b64('0x12')][_0x2b64('0x13')]===0x1f4){logger['error'](_0x2b64('0xd'),_0x5d27c6,_0x2c73ab[_0x2b64('0x12')][_0x2b64('0x14')]);return _0xa5d182(_0x2c73ab[_0x2b64('0x12')][_0x2b64('0x14')]);}logger['error'](_0x2b64('0xd'),_0x5d27c6,_0x2c73ab[_0x2b64('0x12')][_0x2b64('0x14')]);return _0x4be59e(_0x2c73ab[_0x2b64('0x12')]['message']);}else{logger['info'](_0x2b64('0xd'),_0x5d27c6,_0x2b64('0xe'));_0x4be59e(_0x2c73ab[_0x2b64('0x15')]['message']);}})[_0x2b64('0x16')](function(_0x4626cf){logger['error'](_0x2b64('0xd'),_0x5d27c6,_0x4626cf);_0xa5d182(_0x4626cf);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e0f18a8..c32fcf6 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 _0x2029=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x57f07a,_0x59d056){var _0x579df0=function(_0x498181){while(--_0x498181){_0x57f07a['push'](_0x57f07a['shift']());}};_0x579df0(++_0x59d056);}(_0x2029,0x171));var _0x9202=function(_0x42d4f6,_0x2b04c8){_0x42d4f6=_0x42d4f6-0x0;var _0x8f8c08=_0x2029[_0x42d4f6];return _0x8f8c08;};'use strict';var multer=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var path=require('path');var timeout=require(_0x9202('0x2'));var express=require(_0x9202('0x3'));var router=express[_0x9202('0x4')]();var fs_extra=require(_0x9202('0x5'));var auth=require(_0x9202('0x6'));var interaction=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var controller=require(_0x9202('0x9'));router[_0x9202('0xa')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0xc')]);router[_0x9202('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9202('0xd')]);router['get'](_0x9202('0xe'),auth[_0x9202('0xb')](),controller['getConfigurations']);router[_0x9202('0xa')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x10')]);router[_0x9202('0x11')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0x12')]);router[_0x9202('0x11')](_0x9202('0xe'),auth[_0x9202('0xb')](),controller[_0x9202('0x13')]);router[_0x9202('0x14')](_0x9202('0x15'),auth[_0x9202('0xb')](),controller[_0x9202('0x16')]);router[_0x9202('0x17')](_0x9202('0x15'),auth['isAuthenticated'](),controller[_0x9202('0x18')]);module[_0x9202('0x19')]=router; \ No newline at end of file +var _0xe50e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','express','Router','fs-extra'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe50e,0xf9));var _0xee50=function(_0x4aa4a6,_0x126a84){_0x4aa4a6=_0x4aa4a6-0x0;var _0x1b2b50=_0xe50e[_0x4aa4a6];return _0x1b2b50;};'use strict';var multer=require(_0xee50('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee50('0x1'));var router=express[_0xee50('0x2')]();var fs_extra=require(_0xee50('0x3'));var auth=require(_0xee50('0x4'));var interaction=require(_0xee50('0x5'));var config=require(_0xee50('0x6'));var controller=require(_0xee50('0x7'));router[_0xee50('0x8')]('/',auth[_0xee50('0x9')](),controller[_0xee50('0xa')]);router[_0xee50('0x8')](_0xee50('0xb'),auth[_0xee50('0x9')](),controller[_0xee50('0xc')]);router[_0xee50('0x8')](_0xee50('0xd'),auth[_0xee50('0x9')](),controller[_0xee50('0xe')]);router[_0xee50('0x8')](_0xee50('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xee50('0x10')]('/',auth[_0xee50('0x9')](),controller[_0xee50('0x11')]);router[_0xee50('0x10')](_0xee50('0xd'),auth['isAuthenticated'](),controller[_0xee50('0x12')]);router[_0xee50('0x13')](_0xee50('0xb'),auth[_0xee50('0x9')](),controller[_0xee50('0x14')]);router[_0xee50('0x15')](_0xee50('0xb'),auth[_0xee50('0x9')](),controller['destroy']);module[_0xee50('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c842328..36c2de2 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 _0x6c78=['sequelize','exports','STRING','HelpDesk'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x6c78,0xf8));var _0x86c7=function(_0x67bf3a,_0x4237ac){_0x67bf3a=_0x67bf3a-0x0;var _0x2f28b5=_0x6c78[_0x67bf3a];return _0x2f28b5;};'use strict';var Sequelize=require(_0x86c7('0x0'));module[_0x86c7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x86c7('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x86c7('0x2')],'allowNull':![],'defaultValue':_0x86c7('0x3')},'remoteUri':{'type':Sequelize[_0x86c7('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x86c7('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x86c7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1bd3=['STRING','sequelize','exports'];(function(_0x2b1332,_0x5c6b16){var _0x3f370a=function(_0x5a44c7){while(--_0x5a44c7){_0x2b1332['push'](_0x2b1332['shift']());}};_0x3f370a(++_0x5c6b16);}(_0x1bd3,0xa6));var _0x31bd=function(_0x1c619d,_0x16dea7){_0x1c619d=_0x1c619d-0x0;var _0x29041f=_0x1bd3[_0x1c619d];return _0x29041f;};'use strict';var Sequelize=require(_0x31bd('0x0'));module[_0x31bd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x31bd('0x2')]},'username':{'type':Sequelize[_0x31bd('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x31bd('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x31bd('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x31bd('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 679fefc..f22e6bb 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 _0x1151=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','VtigerAccount','fieldName','type','key','model','map','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','destroy','findOne','rawAttributes','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerConfiguration','VtigerField','md5','getFields','description','moduleName','remoteUri','accessKey','username','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','result','token','sessionName','autogenerated','reference','owner','remove','includes','false','label','cf_','picklist','picklistValues','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3040ba,_0x5876d0){var _0x21539b=function(_0x4e2ee2){while(--_0x4e2ee2){_0x3040ba['push'](_0x3040ba['shift']());}};_0x21539b(++_0x5876d0);}(_0x1151,0x65));var _0x1115=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x1151[_0x207a02];return _0xd995c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1115('0x0'));var zipdir=require(_0x1115('0x1'));var jsonpatch=require(_0x1115('0x2'));var rp=require(_0x1115('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1115('0x4'));var util=require(_0x1115('0x5'));var path=require(_0x1115('0x6'));var sox=require(_0x1115('0x7'));var csv=require(_0x1115('0x8'));var ejs=require(_0x1115('0x9'));var fs=require('fs');var fs_extra=require(_0x1115('0xa'));var _=require(_0x1115('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1115('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1115('0x8'));var querystring=require(_0x1115('0xd'));var Papa=require(_0x1115('0xe'));var Redis=require(_0x1115('0xf'));var authService=require(_0x1115('0x10'));var qs=require(_0x1115('0x11'));var as=require(_0x1115('0x12'));var hardwareService=require(_0x1115('0x13'));var logger=require(_0x1115('0x14'))(_0x1115('0x15'));var utils=require('../../config/utils');var config=require(_0x1115('0x16'));var licenseUtil=require(_0x1115('0x17'));var db=require(_0x1115('0x18'))['db'];var integrations=require(_0x1115('0x19'));function respondWithStatusCode(_0x28cdb1,_0x39d20b){_0x39d20b=_0x39d20b||0xcc;return function(_0x5025e9){if(_0x5025e9){return _0x28cdb1[_0x1115('0x1a')](_0x39d20b);}return _0x28cdb1['status'](_0x39d20b)[_0x1115('0x1b')]();};}function respondWithResult(_0x170475,_0x58fd86){_0x58fd86=_0x58fd86||0xc8;return function(_0x50843b){if(_0x50843b){return _0x170475[_0x1115('0x1c')](_0x58fd86)[_0x1115('0x1d')](_0x50843b);}};}function respondWithFilteredResult(_0x1028e6,_0x564672){return function(_0x4d34be){if(_0x4d34be){var _0x4f2833=typeof _0x564672[_0x1115('0x1e')]===_0x1115('0x1f')&&typeof _0x564672[_0x1115('0x20')]===_0x1115('0x1f');var _0x221f35=_0x4d34be[_0x1115('0x21')];var _0x1c74d9=_0x4f2833?0x0:_0x564672[_0x1115('0x1e')];var _0x249b35=_0x4f2833?_0x4d34be[_0x1115('0x21')]:_0x564672[_0x1115('0x1e')]+_0x564672[_0x1115('0x20')];var _0x367367;if(_0x249b35>=_0x221f35){_0x249b35=_0x221f35;_0x367367=0xc8;}else{_0x367367=0xce;}_0x1028e6['status'](_0x367367);return _0x1028e6[_0x1115('0x22')]('Content-Range',_0x1c74d9+'-'+_0x249b35+'/'+_0x221f35)[_0x1115('0x1d')](_0x4d34be);}return null;};}function patchUpdates(_0x300499){return function(_0x2c68db){try{jsonpatch[_0x1115('0x23')](_0x2c68db,_0x300499,!![]);}catch(_0x2fa5da){return BPromise[_0x1115('0x24')](_0x2fa5da);}return _0x2c68db['save']();};}function saveUpdates(_0x563d73,_0x56866c){return function(_0x1f2ba3){if(_0x1f2ba3){return _0x1f2ba3[_0x1115('0x25')](_0x563d73)[_0x1115('0x26')](function(_0x3dd44f){return _0x3dd44f;});}return null;};}function removeEntity(_0x3a3cc5,_0x3d88ef){return function(_0x318885){if(_0x318885){return _0x318885['destroy']()['then'](function(){_0x3a3cc5['status'](0xcc)[_0x1115('0x1b')]();});}};}function handleEntityNotFound(_0x876c5d,_0x1d4f6b){return function(_0x294904){if(!_0x294904){_0x876c5d['sendStatus'](0x194);}return _0x294904;};}function handleError(_0x33a768,_0x551407){_0x551407=_0x551407||0x1f4;return function(_0x18a716){logger[_0x1115('0x27')](_0x18a716[_0x1115('0x28')]);if(_0x18a716[_0x1115('0x29')]){delete _0x18a716[_0x1115('0x29')];}_0x33a768[_0x1115('0x1c')](_0x551407)[_0x1115('0x2a')](_0x18a716);};}exports[_0x1115('0x2b')]=function(_0x350ea0,_0x24f830){var _0x5ceeae={},_0x54ecd6={},_0x19ee5a={'count':0x0,'rows':[]};var _0x48c5ee=_['map'](db[_0x1115('0x2c')]['rawAttributes'],function(_0x2d90e5){return{'name':_0x2d90e5[_0x1115('0x2d')],'type':_0x2d90e5[_0x1115('0x2e')][_0x1115('0x2f')]};});_0x54ecd6[_0x1115('0x30')]=_[_0x1115('0x31')](_0x48c5ee,_0x1115('0x29'));_0x54ecd6[_0x1115('0x32')]=_['keys'](_0x350ea0[_0x1115('0x32')]);_0x54ecd6['filters']=_[_0x1115('0x33')](_0x54ecd6[_0x1115('0x30')],_0x54ecd6[_0x1115('0x32')]);_0x5ceeae[_0x1115('0x34')]=_[_0x1115('0x33')](_0x54ecd6[_0x1115('0x30')],qs[_0x1115('0x35')](_0x350ea0[_0x1115('0x32')]['fields']));_0x5ceeae[_0x1115('0x34')]=_0x5ceeae[_0x1115('0x34')][_0x1115('0x36')]?_0x5ceeae[_0x1115('0x34')]:_0x54ecd6[_0x1115('0x30')];if(!_0x350ea0[_0x1115('0x32')]['hasOwnProperty']('nolimit')){_0x5ceeae[_0x1115('0x20')]=qs[_0x1115('0x20')](_0x350ea0[_0x1115('0x32')]['limit']);_0x5ceeae[_0x1115('0x1e')]=qs[_0x1115('0x1e')](_0x350ea0[_0x1115('0x32')][_0x1115('0x1e')]);}_0x5ceeae[_0x1115('0x37')]=qs[_0x1115('0x38')](_0x350ea0['query'][_0x1115('0x38')]);_0x5ceeae[_0x1115('0x39')]=qs[_0x1115('0x3a')](_[_0x1115('0x3b')](_0x350ea0[_0x1115('0x32')],_0x54ecd6[_0x1115('0x3a')]),_0x48c5ee);if(_0x350ea0['query'][_0x1115('0x3c')]){_0x5ceeae[_0x1115('0x39')]=_[_0x1115('0x3d')](_0x5ceeae['where'],{'$or':_[_0x1115('0x31')](_0x48c5ee,function(_0x392632){if(_0x392632['type']!=='VIRTUAL'){var _0x44763d={};_0x44763d[_0x392632[_0x1115('0x29')]]={'$like':'%'+_0x350ea0['query']['filter']+'%'};return _0x44763d;}})});}_0x5ceeae=_[_0x1115('0x3d')]({},_0x5ceeae,_0x350ea0['options']);var _0xbfe7a8={'where':_0x5ceeae[_0x1115('0x39')]};return db['VtigerAccount']['count'](_0xbfe7a8)['then'](function(_0x16e4ee){_0x19ee5a[_0x1115('0x21')]=_0x16e4ee;if(_0x350ea0[_0x1115('0x32')]['includeAll']){_0x5ceeae[_0x1115('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0x1115('0x3f')](_0x5ceeae);})['then'](function(_0x261838){_0x19ee5a[_0x1115('0x40')]=_0x261838;return _0x19ee5a;})[_0x1115('0x26')](respondWithFilteredResult(_0x24f830,_0x5ceeae))[_0x1115('0x41')](handleError(_0x24f830,null));};exports[_0x1115('0x42')]=function(_0x1ae78a,_0x417a17){var _0x51d5a5={'raw':![],'where':{'id':_0x1ae78a[_0x1115('0x43')]['id']}},_0x14e09c={};_0x14e09c['model']=_['keys'](db['VtigerAccount']['rawAttributes']);_0x14e09c['query']=_[_0x1115('0x44')](_0x1ae78a[_0x1115('0x32')]);_0x14e09c[_0x1115('0x3a')]=_[_0x1115('0x33')](_0x14e09c[_0x1115('0x30')],_0x14e09c[_0x1115('0x32')]);_0x51d5a5[_0x1115('0x34')]=_[_0x1115('0x33')](_0x14e09c[_0x1115('0x30')],qs[_0x1115('0x35')](_0x1ae78a[_0x1115('0x32')][_0x1115('0x35')]));_0x51d5a5[_0x1115('0x34')]=_0x51d5a5[_0x1115('0x34')][_0x1115('0x36')]?_0x51d5a5[_0x1115('0x34')]:_0x14e09c[_0x1115('0x30')];if(_0x1ae78a[_0x1115('0x32')][_0x1115('0x45')]){_0x51d5a5['include']=[{'all':!![]}];}_0x51d5a5=_['merge']({},_0x51d5a5,_0x1ae78a[_0x1115('0x46')]);return db[_0x1115('0x2c')][_0x1115('0x47')](_0x51d5a5)[_0x1115('0x26')](handleEntityNotFound(_0x417a17,null))[_0x1115('0x26')](respondWithResult(_0x417a17,null))['catch'](handleError(_0x417a17,null));};exports[_0x1115('0x48')]=function(_0x26dfb7,_0xd22859){return db[_0x1115('0x2c')][_0x1115('0x48')](_0x26dfb7[_0x1115('0x49')],{})[_0x1115('0x26')](respondWithResult(_0xd22859,0xc9))[_0x1115('0x41')](handleError(_0xd22859,null));};exports[_0x1115('0x25')]=function(_0x1cc619,_0x3a6827){if(_0x1cc619['body']['id']){delete _0x1cc619[_0x1115('0x49')]['id'];}return db[_0x1115('0x2c')][_0x1115('0x47')]({'where':{'id':_0x1cc619[_0x1115('0x43')]['id']}})[_0x1115('0x26')](handleEntityNotFound(_0x3a6827,null))[_0x1115('0x26')](saveUpdates(_0x1cc619[_0x1115('0x49')],null))[_0x1115('0x26')](respondWithResult(_0x3a6827,null))[_0x1115('0x41')](handleError(_0x3a6827,null));};exports[_0x1115('0x4a')]=function(_0x48e859,_0x2f88ff){return db[_0x1115('0x2c')][_0x1115('0x47')]({'where':{'id':_0x48e859[_0x1115('0x43')]['id']}})[_0x1115('0x26')](handleEntityNotFound(_0x2f88ff,null))[_0x1115('0x26')](removeEntity(_0x2f88ff,null))[_0x1115('0x41')](handleError(_0x2f88ff,null));};exports['getConfigurations']=function(_0x37173c,_0x288994,_0x129aae){var _0x53d808={};var _0x374914={};var _0x35985f;var _0x2ab181;return db[_0x1115('0x2c')][_0x1115('0x4b')]({'where':{'id':_0x37173c[_0x1115('0x43')]['id']}})[_0x1115('0x26')](handleEntityNotFound(_0x288994,null))[_0x1115('0x26')](function(_0x1e36a4){if(_0x1e36a4){_0x35985f=_0x1e36a4;_0x374914[_0x1115('0x30')]=_[_0x1115('0x44')](db['VtigerConfiguration'][_0x1115('0x4c')]);_0x374914['query']=_[_0x1115('0x44')](_0x37173c[_0x1115('0x32')]);_0x374914['filters']=_[_0x1115('0x33')](_0x374914[_0x1115('0x30')],_0x374914[_0x1115('0x32')]);_0x53d808[_0x1115('0x34')]=_['intersection'](_0x374914['model'],qs['fields'](_0x37173c[_0x1115('0x32')][_0x1115('0x35')]));_0x53d808[_0x1115('0x34')]=_0x53d808[_0x1115('0x34')][_0x1115('0x36')]?_0x53d808[_0x1115('0x34')]:_0x374914['model'];_0x53d808[_0x1115('0x37')]=qs[_0x1115('0x38')](_0x37173c[_0x1115('0x32')][_0x1115('0x38')]);_0x53d808[_0x1115('0x39')]=qs[_0x1115('0x3a')](_['pick'](_0x37173c[_0x1115('0x32')],_0x374914[_0x1115('0x3a')]));if(_0x37173c[_0x1115('0x32')]['filter']){_0x53d808['where']=_['merge'](_0x53d808[_0x1115('0x39')],{'$or':_[_0x1115('0x31')](_0x53d808[_0x1115('0x34')],function(_0x192407){var _0x35db89={};_0x35db89[_0x192407]={'$like':'%'+_0x37173c[_0x1115('0x32')][_0x1115('0x3c')]+'%'};return _0x35db89;})});}_0x53d808=_[_0x1115('0x3d')]({},_0x53d808,_0x37173c[_0x1115('0x46')]);return _0x35985f[_0x1115('0x4d')](_0x53d808);}})[_0x1115('0x26')](function(_0x5a9317){if(_0x5a9317){_0x2ab181=_0x5a9317[_0x1115('0x36')];if(!_0x37173c['query'][_0x1115('0x4e')](_0x1115('0x4f'))){_0x53d808[_0x1115('0x20')]=qs[_0x1115('0x20')](_0x37173c[_0x1115('0x32')]['limit']);_0x53d808[_0x1115('0x1e')]=qs['offset'](_0x37173c['query'][_0x1115('0x1e')]);}return _0x35985f[_0x1115('0x4d')](_0x53d808);}})['then'](function(_0x3b096c){if(_0x3b096c){return _0x3b096c?{'count':_0x2ab181,'rows':_0x3b096c}:null;}})[_0x1115('0x26')](respondWithResult(_0x288994,null))[_0x1115('0x41')](handleError(_0x288994,null));};exports[_0x1115('0x50')]=function(_0x44e17b,_0xb4cce1,_0x378fac){if(_0x44e17b[_0x1115('0x49')]['id']){delete _0x44e17b['body']['id'];}return db[_0x1115('0x2c')][_0x1115('0x4b')]({'where':{'id':_0x44e17b[_0x1115('0x43')]['id']}})[_0x1115('0x26')](handleEntityNotFound(_0xb4cce1,null))[_0x1115('0x26')](function(_0x26d7bf){if(_0x26d7bf){_0x44e17b['body'][_0x1115('0x51')]=_0x26d7bf['id'];_0x44e17b['body'][_0x1115('0x52')]=integrations[_0x1115('0x53')](_0x44e17b[_0x1115('0x49')][_0x1115('0x54')],_0x44e17b['body'][_0x1115('0x2e')]);_0x44e17b[_0x1115('0x49')][_0x1115('0x55')]=integrations['getDescriptions'](_0x44e17b['body'][_0x1115('0x54')],_0x44e17b[_0x1115('0x49')]['type']);return db[_0x1115('0x56')][_0x1115('0x48')](_0x44e17b[_0x1115('0x49')],{'include':[{'model':db[_0x1115('0x57')],'as':_0x1115('0x52')},{'model':db[_0x1115('0x57')],'as':_0x1115('0x55')}]});}return null;})['then'](respondWithResult(_0xb4cce1,null))[_0x1115('0x41')](handleError(_0xb4cce1,null));};var md5=require(_0x1115('0x58'));exports[_0x1115('0x59')]=function(_0xfd9236,_0x4034dd,_0xeec935){var _0x328cb9=null;var _0x9c7e85=null;var _0x3bacff=null;var _0x3d320d=null;var _0x5060d5='';return db[_0x1115('0x2c')][_0x1115('0x4b')]({'where':{'id':_0xfd9236[_0x1115('0x43')]['id']},'attributes':['id',_0x1115('0x29'),'username',_0x1115('0x5a'),_0x1115('0x5b'),_0x1115('0x5c'),'serverUrl',_0x1115('0x5d')]})[_0x1115('0x26')](handleEntityNotFound(_0x4034dd,null))[_0x1115('0x26')](function(_0x1919ce){if(_0x1919ce){_0x328cb9=_0x1919ce[_0x1115('0x5e')];_0x9c7e85=_0x1919ce[_0x1115('0x5d')];_0x3bacff=_0x1919ce[_0x1115('0x5b')];_0x5060d5=_0x1919ce[_0x1115('0x5c')];var _0x4fa40f=_0x5060d5['slice'](-0x1);if(_0x4fa40f==='/'){_0x5060d5=_0x5060d5[_0x1115('0x5f')](0x0,_0x5060d5[_0x1115('0x60')](_0x4fa40f));}_0x3d320d=util['format'](_0x1115('0x61'),_0x5060d5);var _0x1513a8={'method':_0x1115('0x62'),'uri':_0x3d320d,'qs':{'operation':_0x1115('0x63'),'username':_0x1919ce[_0x1115('0x5e')]},'json':!![]};return rp(_0x1513a8);}})['then'](function(_0x3ef197){if(_0x3ef197[_0x1115('0x64')]){var _0x2ff13e={'method':_0x1115('0x65'),'uri':_0x3d320d,'form':{'operation':'login','username':_0x328cb9,'accessKey':md5(_0x3ef197[_0x1115('0x66')][_0x1115('0x67')]+_0x9c7e85)},'json':!![]};return rp(_0x2ff13e);}})[_0x1115('0x26')](function(_0x280ccb){if(_0x280ccb[_0x1115('0x64')]){var _0x3e5615={'method':_0x1115('0x62'),'uri':_0x3d320d,'qs':{'operation':'describe','username':_0x328cb9,'sessionName':_0x280ccb[_0x1115('0x66')][_0x1115('0x68')],'elementType':_0x3bacff},'json':!![]};return rp(_0x3e5615);}})[_0x1115('0x26')](function(_0x2376e7){if(_0x2376e7[_0x1115('0x64')]){var _0x41bc82=[_0x1115('0x69'),_0x1115('0x6a'),_0x1115('0x6b')];_[_0x1115('0x6c')](_0x2376e7[_0x1115('0x66')][_0x1115('0x35')],function(_0x5084e1){return _0x41bc82[_0x1115('0x6d')](_0x5084e1[_0x1115('0x2e')][_0x1115('0x29')]);});_[_0x1115('0x6c')](_0x2376e7[_0x1115('0x66')][_0x1115('0x35')],function(_0x28f7aa){return _0x28f7aa['editable']===_0x1115('0x6e');});return{'count':_0x2376e7[_0x1115('0x66')][_0x1115('0x35')][_0x1115('0x36')],'rows':_[_0x1115('0x31')](_0x2376e7[_0x1115('0x66')]['fields'],function(_0x567c9e){return{'id':_0x567c9e['name'],'name':_0x567c9e[_0x1115('0x6f')],'custom':_['startsWith'](_0x567c9e['name'],_0x1115('0x70'))?!![]:![],'options':_0x567c9e[_0x1115('0x2e')][_0x1115('0x29')]===_0x1115('0x71')&&_0x567c9e[_0x1115('0x2e')]['picklistValues'][_0x1115('0x36')]>0x0?_[_0x1115('0x31')](_0x567c9e[_0x1115('0x2e')][_0x1115('0x72')],function(_0x1ed6a7){return{'name':_0x1ed6a7[_0x1115('0x6f')],'value':_0x1ed6a7[_0x1115('0x73')]};}):[]};})};}})[_0x1115('0x26')](respondWithResult(_0x4034dd,null))['catch'](function(_0x6b3375){console['log']('vTiger\x20error:\x20'+_0x6b3375);var _0x2f5d2b=_0xfd9236[_0x1115('0x32')]['test']?0x1f4:_0x6b3375[_0x1115('0x74')]||0x1f4;logger['error'](_0x1115('0x75'),_0x1115('0x59'),_0x2f5d2b,JSON[_0x1115('0x76')](_0x6b3375));delete _0x6b3375[_0x1115('0x29')];if(_0x2f5d2b===0x191){_0x2f5d2b=0x190;}_0x4034dd[_0x1115('0x1c')](_0x2f5d2b)['send'](_0xfd9236['query'][_0x1115('0x77')]?{'message':_0x1115('0x78'),'statusCode':_0x6b3375[_0x1115('0x74')]}:_0x6b3375);});}; \ No newline at end of file +var _0x98ae=['VIRTUAL','options','VtigerAccount','includeAll','show','params','rawAttributes','merge','find','catch','create','body','getConfigurations','VtigerConfiguration','findOne','Subjects','Descriptions','channel','VtigerField','username','description','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','reject','update','then','destroy','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x98ae,0xa5));var _0xe98a=function(_0x1ec2b2,_0x47fac1){_0x1ec2b2=_0x1ec2b2-0x0;var _0xd38e94=_0x98ae[_0x1ec2b2];return _0xd38e94;};'use strict';var emlformat=require(_0xe98a('0x0'));var rimraf=require(_0xe98a('0x1'));var zipdir=require(_0xe98a('0x2'));var jsonpatch=require(_0xe98a('0x3'));var rp=require(_0xe98a('0x4'));var moment=require(_0xe98a('0x5'));var BPromise=require(_0xe98a('0x6'));var Mustache=require(_0xe98a('0x7'));var util=require(_0xe98a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe98a('0x9'));var ejs=require(_0xe98a('0xa'));var fs=require('fs');var fs_extra=require(_0xe98a('0xb'));var _=require(_0xe98a('0xc'));var squel=require('squel');var crypto=require(_0xe98a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe98a('0xe'));var toCsv=require(_0xe98a('0x9'));var querystring=require(_0xe98a('0xf'));var Papa=require(_0xe98a('0x10'));var Redis=require('ioredis');var authService=require(_0xe98a('0x11'));var qs=require(_0xe98a('0x12'));var as=require(_0xe98a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe98a('0x14'))(_0xe98a('0x15'));var utils=require('../../config/utils');var config=require(_0xe98a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe98a('0x17'))['db'];var integrations=require(_0xe98a('0x18'));function respondWithStatusCode(_0x47a806,_0x2d04b2){_0x2d04b2=_0x2d04b2||0xcc;return function(_0x47151c){if(_0x47151c){return _0x47a806[_0xe98a('0x19')](_0x2d04b2);}return _0x47a806['status'](_0x2d04b2)[_0xe98a('0x1a')]();};}function respondWithResult(_0x2f0e4f,_0x50a9f7){_0x50a9f7=_0x50a9f7||0xc8;return function(_0x18fb3a){if(_0x18fb3a){return _0x2f0e4f[_0xe98a('0x1b')](_0x50a9f7)['json'](_0x18fb3a);}};}function respondWithFilteredResult(_0xa9d3da,_0x58d28f){return function(_0x13f4ff){if(_0x13f4ff){var _0x1fe397=typeof _0x58d28f['offset']===_0xe98a('0x1c')&&typeof _0x58d28f[_0xe98a('0x1d')]===_0xe98a('0x1c');var _0x2df51b=_0x13f4ff[_0xe98a('0x1e')];var _0x2b200a=_0x1fe397?0x0:_0x58d28f[_0xe98a('0x1f')];var _0x2ab40c=_0x1fe397?_0x13f4ff[_0xe98a('0x1e')]:_0x58d28f['offset']+_0x58d28f[_0xe98a('0x1d')];var _0x2c3e07;if(_0x2ab40c>=_0x2df51b){_0x2ab40c=_0x2df51b;_0x2c3e07=0xc8;}else{_0x2c3e07=0xce;}_0xa9d3da[_0xe98a('0x1b')](_0x2c3e07);return _0xa9d3da['set'](_0xe98a('0x20'),_0x2b200a+'-'+_0x2ab40c+'/'+_0x2df51b)[_0xe98a('0x21')](_0x13f4ff);}return null;};}function patchUpdates(_0x23bc78){return function(_0x28b409){try{jsonpatch['apply'](_0x28b409,_0x23bc78,!![]);}catch(_0x5e0478){return BPromise[_0xe98a('0x22')](_0x5e0478);}return _0x28b409['save']();};}function saveUpdates(_0x37a791,_0x38965d){return function(_0x8f0620){if(_0x8f0620){return _0x8f0620[_0xe98a('0x23')](_0x37a791)[_0xe98a('0x24')](function(_0x3ca753){return _0x3ca753;});}return null;};}function removeEntity(_0x23aa0c,_0x523048){return function(_0x1f244b){if(_0x1f244b){return _0x1f244b[_0xe98a('0x25')]()[_0xe98a('0x24')](function(){_0x23aa0c[_0xe98a('0x1b')](0xcc)[_0xe98a('0x1a')]();});}};}function handleEntityNotFound(_0x45f3f6,_0x50d98c){return function(_0x5f5144){if(!_0x5f5144){_0x45f3f6['sendStatus'](0x194);}return _0x5f5144;};}function handleError(_0x593b80,_0x18f419){_0x18f419=_0x18f419||0x1f4;return function(_0x3ec047){logger['error'](_0x3ec047['stack']);if(_0x3ec047[_0xe98a('0x26')]){delete _0x3ec047[_0xe98a('0x26')];}_0x593b80['status'](_0x18f419)[_0xe98a('0x27')](_0x3ec047);};}exports[_0xe98a('0x28')]=function(_0x3093f6,_0x1ed7a7){var _0x3d6e63={},_0x18091a={},_0x2eb709={'count':0x0,'rows':[]};var _0x2ad947=_[_0xe98a('0x29')](db['VtigerAccount']['rawAttributes'],function(_0x4b5fae){return{'name':_0x4b5fae['fieldName'],'type':_0x4b5fae[_0xe98a('0x2a')][_0xe98a('0x2b')]};});_0x18091a[_0xe98a('0x2c')]=_['map'](_0x2ad947,_0xe98a('0x26'));_0x18091a[_0xe98a('0x2d')]=_[_0xe98a('0x2e')](_0x3093f6[_0xe98a('0x2d')]);_0x18091a[_0xe98a('0x2f')]=_[_0xe98a('0x30')](_0x18091a[_0xe98a('0x2c')],_0x18091a[_0xe98a('0x2d')]);_0x3d6e63[_0xe98a('0x31')]=_['intersection'](_0x18091a[_0xe98a('0x2c')],qs[_0xe98a('0x32')](_0x3093f6['query']['fields']));_0x3d6e63[_0xe98a('0x31')]=_0x3d6e63[_0xe98a('0x31')][_0xe98a('0x33')]?_0x3d6e63[_0xe98a('0x31')]:_0x18091a[_0xe98a('0x2c')];if(!_0x3093f6[_0xe98a('0x2d')][_0xe98a('0x34')](_0xe98a('0x35'))){_0x3d6e63['limit']=qs['limit'](_0x3093f6[_0xe98a('0x2d')][_0xe98a('0x1d')]);_0x3d6e63[_0xe98a('0x1f')]=qs['offset'](_0x3093f6[_0xe98a('0x2d')][_0xe98a('0x1f')]);}_0x3d6e63[_0xe98a('0x36')]=qs[_0xe98a('0x37')](_0x3093f6['query'][_0xe98a('0x37')]);_0x3d6e63['where']=qs[_0xe98a('0x2f')](_[_0xe98a('0x38')](_0x3093f6[_0xe98a('0x2d')],_0x18091a['filters']),_0x2ad947);if(_0x3093f6[_0xe98a('0x2d')][_0xe98a('0x39')]){_0x3d6e63[_0xe98a('0x3a')]=_['merge'](_0x3d6e63[_0xe98a('0x3a')],{'$or':_[_0xe98a('0x29')](_0x2ad947,function(_0x2eea03){if(_0x2eea03[_0xe98a('0x2a')]!==_0xe98a('0x3b')){var _0x4ef22e={};_0x4ef22e[_0x2eea03[_0xe98a('0x26')]]={'$like':'%'+_0x3093f6[_0xe98a('0x2d')][_0xe98a('0x39')]+'%'};return _0x4ef22e;}})});}_0x3d6e63=_['merge']({},_0x3d6e63,_0x3093f6[_0xe98a('0x3c')]);var _0x398751={'where':_0x3d6e63[_0xe98a('0x3a')]};return db[_0xe98a('0x3d')][_0xe98a('0x1e')](_0x398751)[_0xe98a('0x24')](function(_0x2886a0){_0x2eb709[_0xe98a('0x1e')]=_0x2886a0;if(_0x3093f6['query'][_0xe98a('0x3e')]){_0x3d6e63['include']=[{'all':!![]}];}return db[_0xe98a('0x3d')]['findAll'](_0x3d6e63);})[_0xe98a('0x24')](function(_0x4cdd22){_0x2eb709['rows']=_0x4cdd22;return _0x2eb709;})['then'](respondWithFilteredResult(_0x1ed7a7,_0x3d6e63))['catch'](handleError(_0x1ed7a7,null));};exports[_0xe98a('0x3f')]=function(_0x132cf5,_0x5e77da){var _0x299454={'raw':![],'where':{'id':_0x132cf5[_0xe98a('0x40')]['id']}},_0x5c7607={};_0x5c7607[_0xe98a('0x2c')]=_[_0xe98a('0x2e')](db[_0xe98a('0x3d')][_0xe98a('0x41')]);_0x5c7607['query']=_[_0xe98a('0x2e')](_0x132cf5[_0xe98a('0x2d')]);_0x5c7607[_0xe98a('0x2f')]=_['intersection'](_0x5c7607['model'],_0x5c7607[_0xe98a('0x2d')]);_0x299454[_0xe98a('0x31')]=_[_0xe98a('0x30')](_0x5c7607[_0xe98a('0x2c')],qs['fields'](_0x132cf5[_0xe98a('0x2d')][_0xe98a('0x32')]));_0x299454[_0xe98a('0x31')]=_0x299454['attributes'][_0xe98a('0x33')]?_0x299454[_0xe98a('0x31')]:_0x5c7607['model'];if(_0x132cf5[_0xe98a('0x2d')][_0xe98a('0x3e')]){_0x299454['include']=[{'all':!![]}];}_0x299454=_[_0xe98a('0x42')]({},_0x299454,_0x132cf5['options']);return db[_0xe98a('0x3d')][_0xe98a('0x43')](_0x299454)['then'](handleEntityNotFound(_0x5e77da,null))['then'](respondWithResult(_0x5e77da,null))[_0xe98a('0x44')](handleError(_0x5e77da,null));};exports['create']=function(_0x5a2ee9,_0xb2f5b8){return db[_0xe98a('0x3d')][_0xe98a('0x45')](_0x5a2ee9['body'],{})['then'](respondWithResult(_0xb2f5b8,0xc9))[_0xe98a('0x44')](handleError(_0xb2f5b8,null));};exports[_0xe98a('0x23')]=function(_0x49bbcd,_0x152cd7){if(_0x49bbcd[_0xe98a('0x46')]['id']){delete _0x49bbcd[_0xe98a('0x46')]['id'];}return db[_0xe98a('0x3d')][_0xe98a('0x43')]({'where':{'id':_0x49bbcd[_0xe98a('0x40')]['id']}})['then'](handleEntityNotFound(_0x152cd7,null))[_0xe98a('0x24')](saveUpdates(_0x49bbcd[_0xe98a('0x46')],null))['then'](respondWithResult(_0x152cd7,null))[_0xe98a('0x44')](handleError(_0x152cd7,null));};exports[_0xe98a('0x25')]=function(_0x54d0d0,_0x1ed098){return db[_0xe98a('0x3d')][_0xe98a('0x43')]({'where':{'id':_0x54d0d0[_0xe98a('0x40')]['id']}})[_0xe98a('0x24')](handleEntityNotFound(_0x1ed098,null))[_0xe98a('0x24')](removeEntity(_0x1ed098,null))[_0xe98a('0x44')](handleError(_0x1ed098,null));};exports[_0xe98a('0x47')]=function(_0x40d112,_0x417e8f,_0x78540a){var _0x4be721={};var _0x4982d0={};var _0x3e68a6;var _0x3d5498;return db[_0xe98a('0x3d')]['findOne']({'where':{'id':_0x40d112[_0xe98a('0x40')]['id']}})['then'](handleEntityNotFound(_0x417e8f,null))['then'](function(_0x10bd5d){if(_0x10bd5d){_0x3e68a6=_0x10bd5d;_0x4982d0[_0xe98a('0x2c')]=_[_0xe98a('0x2e')](db[_0xe98a('0x48')]['rawAttributes']);_0x4982d0[_0xe98a('0x2d')]=_[_0xe98a('0x2e')](_0x40d112[_0xe98a('0x2d')]);_0x4982d0[_0xe98a('0x2f')]=_[_0xe98a('0x30')](_0x4982d0[_0xe98a('0x2c')],_0x4982d0[_0xe98a('0x2d')]);_0x4be721['attributes']=_['intersection'](_0x4982d0['model'],qs['fields'](_0x40d112['query'][_0xe98a('0x32')]));_0x4be721['attributes']=_0x4be721['attributes'][_0xe98a('0x33')]?_0x4be721[_0xe98a('0x31')]:_0x4982d0[_0xe98a('0x2c')];_0x4be721[_0xe98a('0x36')]=qs[_0xe98a('0x37')](_0x40d112[_0xe98a('0x2d')][_0xe98a('0x37')]);_0x4be721[_0xe98a('0x3a')]=qs['filters'](_[_0xe98a('0x38')](_0x40d112[_0xe98a('0x2d')],_0x4982d0[_0xe98a('0x2f')]));if(_0x40d112['query'][_0xe98a('0x39')]){_0x4be721['where']=_[_0xe98a('0x42')](_0x4be721[_0xe98a('0x3a')],{'$or':_[_0xe98a('0x29')](_0x4be721[_0xe98a('0x31')],function(_0x1c9108){var _0x2bc642={};_0x2bc642[_0x1c9108]={'$like':'%'+_0x40d112[_0xe98a('0x2d')]['filter']+'%'};return _0x2bc642;})});}_0x4be721=_[_0xe98a('0x42')]({},_0x4be721,_0x40d112[_0xe98a('0x3c')]);return _0x3e68a6[_0xe98a('0x47')](_0x4be721);}})[_0xe98a('0x24')](function(_0x4aedbd){if(_0x4aedbd){_0x3d5498=_0x4aedbd[_0xe98a('0x33')];if(!_0x40d112[_0xe98a('0x2d')][_0xe98a('0x34')](_0xe98a('0x35'))){_0x4be721[_0xe98a('0x1d')]=qs[_0xe98a('0x1d')](_0x40d112['query'][_0xe98a('0x1d')]);_0x4be721[_0xe98a('0x1f')]=qs[_0xe98a('0x1f')](_0x40d112['query'][_0xe98a('0x1f')]);}return _0x3e68a6[_0xe98a('0x47')](_0x4be721);}})[_0xe98a('0x24')](function(_0x40463a){if(_0x40463a){return _0x40463a?{'count':_0x3d5498,'rows':_0x40463a}:null;}})[_0xe98a('0x24')](respondWithResult(_0x417e8f,null))[_0xe98a('0x44')](handleError(_0x417e8f,null));};exports['addConfiguration']=function(_0x21a4e6,_0x4ca722,_0x578bff){if(_0x21a4e6[_0xe98a('0x46')]['id']){delete _0x21a4e6[_0xe98a('0x46')]['id'];}return db[_0xe98a('0x3d')][_0xe98a('0x49')]({'where':{'id':_0x21a4e6[_0xe98a('0x40')]['id']}})[_0xe98a('0x24')](handleEntityNotFound(_0x4ca722,null))[_0xe98a('0x24')](function(_0x4c6f66){if(_0x4c6f66){_0x21a4e6[_0xe98a('0x46')]['AccountId']=_0x4c6f66['id'];_0x21a4e6[_0xe98a('0x46')][_0xe98a('0x4a')]=integrations['getSubjects'](_0x21a4e6[_0xe98a('0x46')]['channel'],_0x21a4e6[_0xe98a('0x46')]['type']);_0x21a4e6[_0xe98a('0x46')][_0xe98a('0x4b')]=integrations['getDescriptions'](_0x21a4e6['body'][_0xe98a('0x4c')],_0x21a4e6['body']['type']);return db['VtigerConfiguration'][_0xe98a('0x45')](_0x21a4e6[_0xe98a('0x46')],{'include':[{'model':db[_0xe98a('0x4d')],'as':_0xe98a('0x4a')},{'model':db['VtigerField'],'as':_0xe98a('0x4b')}]});}return null;})[_0xe98a('0x24')](respondWithResult(_0x4ca722,null))[_0xe98a('0x44')](handleError(_0x4ca722,null));};var md5=require('md5');exports['getFields']=function(_0x421501,_0x5e6230,_0x48756a){var _0x5a34e5=null;var _0x586117=null;var _0x54e011=null;var _0x2232c8=null;var _0x345b62='';return db['VtigerAccount'][_0xe98a('0x49')]({'where':{'id':_0x421501[_0xe98a('0x40')]['id']},'attributes':['id',_0xe98a('0x26'),_0xe98a('0x4e'),_0xe98a('0x4f'),'moduleName','remoteUri',_0xe98a('0x50'),_0xe98a('0x51')]})[_0xe98a('0x24')](handleEntityNotFound(_0x5e6230,null))[_0xe98a('0x24')](function(_0x104f23){if(_0x104f23){_0x5a34e5=_0x104f23['username'];_0x586117=_0x104f23[_0xe98a('0x51')];_0x54e011=_0x104f23['moduleName'];_0x345b62=_0x104f23['remoteUri'];var _0x9573ac=_0x345b62['slice'](-0x1);if(_0x9573ac==='/'){_0x345b62=_0x345b62[_0xe98a('0x52')](0x0,_0x345b62[_0xe98a('0x53')](_0x9573ac));}_0x2232c8=util[_0xe98a('0x54')](_0xe98a('0x55'),_0x345b62);var _0x1d3c8f={'method':_0xe98a('0x56'),'uri':_0x2232c8,'qs':{'operation':'getchallenge','username':_0x104f23[_0xe98a('0x4e')]},'json':!![]};return rp(_0x1d3c8f);}})[_0xe98a('0x24')](function(_0x4650cb){if(_0x4650cb['success']){var _0x30ca1c={'method':_0xe98a('0x57'),'uri':_0x2232c8,'form':{'operation':_0xe98a('0x58'),'username':_0x5a34e5,'accessKey':md5(_0x4650cb[_0xe98a('0x59')][_0xe98a('0x5a')]+_0x586117)},'json':!![]};return rp(_0x30ca1c);}})['then'](function(_0x11cc0c){if(_0x11cc0c[_0xe98a('0x5b')]){var _0xdead2a={'method':_0xe98a('0x56'),'uri':_0x2232c8,'qs':{'operation':'describe','username':_0x5a34e5,'sessionName':_0x11cc0c['result'][_0xe98a('0x5c')],'elementType':_0x54e011},'json':!![]};return rp(_0xdead2a);}})[_0xe98a('0x24')](function(_0x19991e){if(_0x19991e[_0xe98a('0x5b')]){var _0x55422b=[_0xe98a('0x5d'),_0xe98a('0x5e'),_0xe98a('0x5f')];_[_0xe98a('0x60')](_0x19991e['result']['fields'],function(_0x391960){return _0x55422b['includes'](_0x391960[_0xe98a('0x2a')]['name']);});_[_0xe98a('0x60')](_0x19991e['result'][_0xe98a('0x32')],function(_0x46bdc8){return _0x46bdc8[_0xe98a('0x61')]===_0xe98a('0x62');});return{'count':_0x19991e['result'][_0xe98a('0x32')][_0xe98a('0x33')],'rows':_[_0xe98a('0x29')](_0x19991e[_0xe98a('0x59')][_0xe98a('0x32')],function(_0x21f3e4){return{'id':_0x21f3e4[_0xe98a('0x26')],'name':_0x21f3e4[_0xe98a('0x63')],'custom':_[_0xe98a('0x64')](_0x21f3e4['name'],_0xe98a('0x65'))?!![]:![],'options':_0x21f3e4['type']['name']==='picklist'&&_0x21f3e4[_0xe98a('0x2a')][_0xe98a('0x66')][_0xe98a('0x33')]>0x0?_['map'](_0x21f3e4[_0xe98a('0x2a')][_0xe98a('0x66')],function(_0x31aa12){return{'name':_0x31aa12[_0xe98a('0x63')],'value':_0x31aa12[_0xe98a('0x67')]};}):[]};})};}})[_0xe98a('0x24')](respondWithResult(_0x5e6230,null))['catch'](function(_0x21c5ef){console[_0xe98a('0x68')](_0xe98a('0x69')+_0x21c5ef);var _0x5cc862=_0x421501[_0xe98a('0x2d')][_0xe98a('0x6a')]?0x1f4:_0x21c5ef[_0xe98a('0x6b')]||0x1f4;logger[_0xe98a('0x6c')](_0xe98a('0x6d'),_0xe98a('0x6e'),_0x5cc862,JSON['stringify'](_0x21c5ef));delete _0x21c5ef[_0xe98a('0x26')];if(_0x5cc862===0x191){_0x5cc862=0x190;}_0x5e6230['status'](_0x5cc862)[_0xe98a('0x27')](_0x421501[_0xe98a('0x2d')][_0xe98a('0x6a')]?{'message':_0xe98a('0x6f'),'statusCode':_0x21c5ef[_0xe98a('0x6b')]}:_0x21c5ef);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 97ce58d..1bb950e 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 _0x291f=['request-promise','rimraf','../../components/integrations/configuration','exports','int_vtiger_accounts','../../config/logger','moment'];(function(_0x32cadf,_0x3de1c6){var _0x3b6a30=function(_0x4ea9bb){while(--_0x4ea9bb){_0x32cadf['push'](_0x32cadf['shift']());}};_0x3b6a30(++_0x3de1c6);}(_0x291f,0xa6));var _0xf291=function(_0x3fc3af,_0xd1fe0c){_0x3fc3af=_0x3fc3af-0x0;var _0x2f8d47=_0x291f[_0x3fc3af];return _0x2f8d47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf291('0x0'))('api');var moment=require(_0xf291('0x1'));var BPromise=require('bluebird');var rp=require(_0xf291('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf291('0x3'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xf291('0x4'));module[_0xf291('0x5')]=function(_0x1915e1,_0x9ba697){return _0x1915e1['define']('VtigerAccount',attributes,{'tableName':_0xf291('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7f9=['request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','moment'];(function(_0x1ff5c7,_0x35f3f0){var _0x186508=function(_0x1f8b5a){while(--_0x1f8b5a){_0x1ff5c7['push'](_0x1ff5c7['shift']());}};_0x186508(++_0x35f3f0);}(_0xf7f9,0x128));var _0x9f7f=function(_0x5b2610,_0x2d7f16){_0x5b2610=_0x5b2610-0x0;var _0x35182d=_0xf7f9[_0x5b2610];return _0x35182d;};'use strict';var _=require(_0x9f7f('0x0'));var util=require(_0x9f7f('0x1'));var logger=require(_0x9f7f('0x2'))('api');var moment=require(_0x9f7f('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f7f('0x4'));var fs=require('fs');var path=require(_0x9f7f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f7f('0x6'));var integrations=require(_0x9f7f('0x7'));module[_0x9f7f('0x8')]=function(_0x2afcbf,_0x5202e0){return _0x2afcbf[_0x9f7f('0x9')]('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 3fbb186..21c9dca 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 _0xd4f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x321472,_0x1f27e3){var _0x8a561c=function(_0x285860){while(--_0x285860){_0x321472['push'](_0x321472['shift']());}};_0x8a561c(++_0x1f27e3);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3d68d8,_0x59732d){_0x3d68d8=_0x3d68d8-0x0;var _0x6fb1f7=_0xd4f4[_0x3d68d8];return _0x6fb1f7;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['VtigerAccount'][_0x4d4f('0x18')]({'raw':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1b')]||null:null,'attributes':_0x51dcf1['options']?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1c')]||null:null,'limit':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1d')]||null:null,'include':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1e')]?_['map'](_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1e')],function(_0x2d2fb3){return{'model':db[_0x2d2fb3[_0x4d4f('0x1f')]],'as':_0x2d2fb3['as'],'attributes':_0x2d2fb3[_0x4d4f('0x1c')],'include':_0x2d2fb3['include']?_[_0x4d4f('0x20')](_0x2d2fb3[_0x4d4f('0x1e')],function(_0x1cf365){return{'model':db[_0x1cf365[_0x4d4f('0x1f')]],'as':_0x1cf365['as'],'attributes':_0x1cf365['attributes'],'include':_0x1cf365['include']?_[_0x4d4f('0x20')](_0x1cf365[_0x4d4f('0x1e')],function(_0xa2492c){return{'model':db[_0xa2492c[_0x4d4f('0x1f')]],'as':_0xa2492c['as'],'attributes':_0xa2492c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x380ebf){logger[_0x4d4f('0xd')](_0x4d4f('0x17'),_0x51dcf1);logger['debug'](_0x4d4f('0x17'),_0x51dcf1,JSON['stringify'](_0x380ebf));_0x519501(_0x380ebf);})[_0x4d4f('0x16')](function(_0x333a40){logger['error'](_0x4d4f('0x17'),_0x333a40[_0x4d4f('0x15')],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x333a40[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x21')]=function(_0x43a704){var _0x4c69cb=this;return new Promise(function(_0x36eede,_0x4578b6){return db[_0x4d4f('0x22')][_0x4d4f('0x23')]({'raw':_0x43a704[_0x4d4f('0x19')]?_0x43a704['options'][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')]['where']||null:null,'attributes':_0x43a704['options']?_0x43a704['options'][_0x4d4f('0x1c')]||null:null,'include':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')][_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x43a704['options'][_0x4d4f('0x1e')],function(_0x1ab7c4){return{'model':db[_0x1ab7c4[_0x4d4f('0x1f')]],'as':_0x1ab7c4['as'],'attributes':_0x1ab7c4['attributes'],'include':_0x1ab7c4[_0x4d4f('0x1e')]?_['map'](_0x1ab7c4[_0x4d4f('0x1e')],function(_0x2f18df){return{'model':db[_0x2f18df[_0x4d4f('0x1f')]],'as':_0x2f18df['as'],'attributes':_0x2f18df[_0x4d4f('0x1c')],'include':_0x2f18df[_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x2f18df[_0x4d4f('0x1e')],function(_0x461900){return{'model':db[_0x461900['model']],'as':_0x461900['as'],'attributes':_0x461900['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x559441){logger['info'](_0x4d4f('0x21'),_0x43a704);logger[_0x4d4f('0x10')](_0x4d4f('0x21'),_0x43a704,JSON[_0x4d4f('0x12')](_0x559441));_0x36eede(_0x559441);})[_0x4d4f('0x16')](function(_0x56eed8){logger[_0x4d4f('0x13')](_0x4d4f('0x21'),_0x56eed8['message'],_0x43a704);_0x4578b6(_0x4c69cb[_0x4d4f('0x13')](0x1f4,_0x56eed8[_0x4d4f('0x15')]));});});}; \ No newline at end of file +var _0xe1e3=['result','GetVtigerAccount','options','raw','where','attributes','limit','include','model','map','debug','catch','find','ShowVtigerAccount','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','info'];(function(_0x159ef9,_0x32c262){var _0x4c56e9=function(_0x3c4a9c){while(--_0x3c4a9c){_0x159ef9['push'](_0x159ef9['shift']());}};_0x4c56e9(++_0x32c262);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x33ae81,_0x29eea9){_0x33ae81=_0x33ae81-0x0;var _0x1c78db=_0xe1e3[_0x33ae81];return _0x1c78db;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['VtigerAccount']['findAll']({'raw':_0x1d786c['options']?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![],'where':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c['options'][_0x3e1e('0x17')]||null:null,'attributes':_0x1d786c['options']?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x18')]||null:null,'limit':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c['options'][_0x3e1e('0x19')]||null:null,'include':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')]['include']?_['map'](_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x1a')],function(_0x488f9f){return{'model':db[_0x488f9f[_0x3e1e('0x1b')]],'as':_0x488f9f['as'],'attributes':_0x488f9f[_0x3e1e('0x18')],'include':_0x488f9f[_0x3e1e('0x1a')]?_[_0x3e1e('0x1c')](_0x488f9f[_0x3e1e('0x1a')],function(_0x159212){return{'model':db[_0x159212[_0x3e1e('0x1b')]],'as':_0x159212['as'],'attributes':_0x159212[_0x3e1e('0x18')],'include':_0x159212['include']?_['map'](_0x159212[_0x3e1e('0x1a')],function(_0x541ef1){return{'model':db[_0x541ef1['model']],'as':_0x541ef1['as'],'attributes':_0x541ef1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a33bb){logger[_0x3e1e('0x12')]('GetVtigerAccount',_0x1d786c);logger[_0x3e1e('0x1d')]('GetVtigerAccount',_0x1d786c,JSON[_0x3e1e('0xe')](_0x1a33bb));_0x791ed8(_0x1a33bb);})[_0x3e1e('0x1e')](function(_0x53a6ff){logger[_0x3e1e('0xf')](_0x3e1e('0x14'),_0x53a6ff[_0x3e1e('0x11')],_0x1d786c);_0x1c181b(_0x39eaa7['error'](0x1f4,_0x53a6ff[_0x3e1e('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x591c36){var _0x494c75=this;return new Promise(function(_0x39da8d,_0x5b8f95){return db['VtigerAccount'][_0x3e1e('0x1f')]({'raw':_0x591c36[_0x3e1e('0x15')]?_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![],'where':_0x591c36[_0x3e1e('0x15')]?_0x591c36['options']['where']||null:null,'attributes':_0x591c36['options']?_0x591c36['options'][_0x3e1e('0x18')]||null:null,'include':_0x591c36[_0x3e1e('0x15')]?_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x1a')]?_[_0x3e1e('0x1c')](_0x591c36[_0x3e1e('0x15')][_0x3e1e('0x1a')],function(_0x431bd5){return{'model':db[_0x431bd5['model']],'as':_0x431bd5['as'],'attributes':_0x431bd5[_0x3e1e('0x18')],'include':_0x431bd5[_0x3e1e('0x1a')]?_['map'](_0x431bd5[_0x3e1e('0x1a')],function(_0x3f4ef3){return{'model':db[_0x3f4ef3[_0x3e1e('0x1b')]],'as':_0x3f4ef3['as'],'attributes':_0x3f4ef3[_0x3e1e('0x18')],'include':_0x3f4ef3['include']?_['map'](_0x3f4ef3[_0x3e1e('0x1a')],function(_0x332f1e){return{'model':db[_0x332f1e['model']],'as':_0x332f1e['as'],'attributes':_0x332f1e[_0x3e1e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3e1e('0xb')](function(_0x4e9acd){logger[_0x3e1e('0x12')](_0x3e1e('0x20'),_0x591c36);logger[_0x3e1e('0x1d')](_0x3e1e('0x20'),_0x591c36,JSON[_0x3e1e('0xe')](_0x4e9acd));_0x39da8d(_0x4e9acd);})['catch'](function(_0x1da527){logger[_0x3e1e('0xf')](_0x3e1e('0x20'),_0x1da527[_0x3e1e('0x11')],_0x591c36);_0x5b8f95(_0x494c75['error'](0x1f4,_0x1da527[_0x3e1e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0998304..8c63576 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 _0xbe38=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects'];(function(_0x4817c9,_0x513943){var _0x42c186=function(_0x463b28){while(--_0x463b28){_0x4817c9['push'](_0x4817c9['shift']());}};_0x42c186(++_0x513943);}(_0xbe38,0x99));var _0x8be3=function(_0x35644c,_0x3c80a0){_0x35644c=_0x35644c-0x0;var _0xc2e514=_0xbe38[_0x35644c];return _0xc2e514;};'use strict';var multer=require('multer');var util=require(_0x8be3('0x0'));var path=require(_0x8be3('0x1'));var timeout=require(_0x8be3('0x2'));var express=require(_0x8be3('0x3'));var router=express[_0x8be3('0x4')]();var fs_extra=require(_0x8be3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8be3('0x6'));var config=require('../../config/environment');var controller=require(_0x8be3('0x7'));router['get']('/',auth[_0x8be3('0x8')](),controller[_0x8be3('0x9')]);router[_0x8be3('0xa')](_0x8be3('0xb'),auth[_0x8be3('0x8')](),controller[_0x8be3('0xc')]);router[_0x8be3('0xa')](_0x8be3('0xd'),auth[_0x8be3('0x8')](),controller['getFields']);router[_0x8be3('0xa')](_0x8be3('0xe'),auth['isAuthenticated'](),controller[_0x8be3('0xf')]);router[_0x8be3('0xa')](_0x8be3('0x10'),auth[_0x8be3('0x8')](),controller[_0x8be3('0x11')]);router[_0x8be3('0x12')]('/',auth['isAuthenticated'](),controller[_0x8be3('0x13')]);router[_0x8be3('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8be3('0x15')]);router[_0x8be3('0x16')](_0x8be3('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8be3('0x17')]=router; \ No newline at end of file +var _0x7a98=['../../components/interaction/service','./intVtigerConfiguration.controller','get','index','/:id','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a1d4a,_0x48ef2b){var _0x44fda1=function(_0x1c68b9){while(--_0x1c68b9){_0x1a1d4a['push'](_0x1a1d4a['shift']());}};_0x44fda1(++_0x48ef2b);}(_0x7a98,0x17f));var _0x87a9=function(_0x4201f7,_0x210acc){_0x4201f7=_0x4201f7-0x0;var _0x334384=_0x7a98[_0x4201f7];return _0x334384;};'use strict';var multer=require(_0x87a9('0x0'));var util=require(_0x87a9('0x1'));var path=require('path');var timeout=require(_0x87a9('0x2'));var express=require(_0x87a9('0x3'));var router=express[_0x87a9('0x4')]();var fs_extra=require(_0x87a9('0x5'));var auth=require(_0x87a9('0x6'));var interaction=require(_0x87a9('0x7'));var config=require('../../config/environment');var controller=require(_0x87a9('0x8'));router[_0x87a9('0x9')]('/',auth['isAuthenticated'](),controller[_0x87a9('0xa')]);router['get'](_0x87a9('0xb'),auth['isAuthenticated'](),controller[_0x87a9('0xc')]);router[_0x87a9('0x9')](_0x87a9('0xd'),auth['isAuthenticated'](),controller[_0x87a9('0xe')]);router[_0x87a9('0x9')](_0x87a9('0xf'),auth[_0x87a9('0x10')](),controller[_0x87a9('0x11')]);router[_0x87a9('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x87a9('0x12')]);router[_0x87a9('0x13')]('/',auth[_0x87a9('0x10')](),controller[_0x87a9('0x14')]);router[_0x87a9('0x15')](_0x87a9('0xb'),auth[_0x87a9('0x10')](),controller[_0x87a9('0x16')]);router[_0x87a9('0x17')]('/:id',auth[_0x87a9('0x10')](),controller[_0x87a9('0x18')]);module[_0x87a9('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 58f98d4..0e2bc24 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 _0x40e1=['STRING','sequelize'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x40e1,0x111));var _0x140e=function(_0xcbc7d0,_0x4ad63c){_0xcbc7d0=_0xcbc7d0-0x0;var _0x37b8c6=_0x40e1[_0xcbc7d0];return _0x37b8c6;};'use strict';var Sequelize=require(_0x140e('0x0'));module['exports']={'name':{'type':Sequelize[_0x140e('0x1')]},'description':{'type':Sequelize[_0x140e('0x1')]}}; \ No newline at end of file +var _0xfac6=['exports','STRING','sequelize'];(function(_0x15bc2f,_0x25e563){var _0x574008=function(_0x220bee){while(--_0x220bee){_0x15bc2f['push'](_0x15bc2f['shift']());}};_0x574008(++_0x25e563);}(_0xfac6,0x13a));var _0x6fac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfac6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6fac('0x0'));module[_0x6fac('0x1')]={'name':{'type':Sequelize[_0x6fac('0x2')]},'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 fb0f7d5..2e538d4 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 _0x422f=['jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','VtigerConfiguration','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','getFields','filter','hasOwnProperty','findOne','VtigerField','pick','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x59c3f6,_0x4889b0){var _0x51b314=function(_0x535e9a){while(--_0x535e9a){_0x59c3f6['push'](_0x59c3f6['shift']());}};_0x51b314(++_0x4889b0);}(_0x422f,0x1c7));var _0xf422=function(_0x1098c8,_0x28ba87){_0x1098c8=_0x1098c8-0x0;var _0x5cc1b3=_0x422f[_0x1098c8];return _0x5cc1b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['VtigerConfiguration'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));};exports[_0xf422('0x46')]=function(_0x4b4de4,_0x4b8b1f,_0x44448c){var _0xe333b8={};var _0x46a200={};var _0xddcd6c;var _0x2b640a;return db[_0xf422('0x2a')]['findOne']({'where':{'id':_0x4b4de4[_0xf422('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4b8b1f,null))[_0xf422('0x25')](function(_0x39f21b){if(_0x39f21b){_0xddcd6c=_0x39f21b;_0x46a200[_0xf422('0x2c')]=_[_0xf422('0x2e')](db['VtigerField']['rawAttributes']);_0x46a200[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x4b4de4[_0xf422('0x2d')]);_0x46a200[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x46a200[_0xf422('0x2c')],_0x46a200[_0xf422('0x2d')]);_0xe333b8['attributes']=_[_0xf422('0x30')](_0x46a200[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x4b4de4[_0xf422('0x2d')][_0xf422('0x31')]));_0xe333b8[_0xf422('0x32')]=_0xe333b8[_0xf422('0x32')][_0xf422('0x3e')]?_0xe333b8[_0xf422('0x32')]:_0x46a200[_0xf422('0x2c')];_0xe333b8['order']=qs[_0xf422('0x35')](_0x4b4de4[_0xf422('0x2d')][_0xf422('0x35')]);_0xe333b8[_0xf422('0x36')]=qs[_0xf422('0x2f')](_['pick'](_0x4b4de4[_0xf422('0x2d')],_0x46a200[_0xf422('0x2f')]));if(_0x4b4de4['query'][_0xf422('0x47')]){_0xe333b8[_0xf422('0x36')]=_[_0xf422('0x41')](_0xe333b8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0xe333b8[_0xf422('0x32')],function(_0x3d73de){var _0x5997bc={};_0x5997bc[_0x3d73de]={'$like':'%'+_0x4b4de4[_0xf422('0x2d')][_0xf422('0x47')]+'%'};return _0x5997bc;})});}_0xe333b8=_[_0xf422('0x41')]({},_0xe333b8,_0x4b4de4['options']);return _0xddcd6c[_0xf422('0x46')](_0xe333b8);}})[_0xf422('0x25')](function(_0x3d9946){if(_0x3d9946){_0x2b640a=_0x3d9946[_0xf422('0x3e')];if(!_0x4b4de4[_0xf422('0x2d')][_0xf422('0x48')](_0xf422('0x33'))){_0xe333b8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x4b4de4[_0xf422('0x2d')][_0xf422('0x1e')]);_0xe333b8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x4b4de4[_0xf422('0x2d')][_0xf422('0x1b')]);}return _0xddcd6c[_0xf422('0x46')](_0xe333b8);}})[_0xf422('0x25')](function(_0x42d94f){if(_0x42d94f){return _0x42d94f?{'count':_0x2b640a,'rows':_0x42d94f}:null;}})[_0xf422('0x25')](respondWithResult(_0x4b8b1f,null))['catch'](handleError(_0x4b8b1f,null));};exports['getSubjects']=function(_0x7ddb3,_0x5ec3a5,_0xd9e138){var _0x3345dd={};var _0x416e40={};var _0x14904a;var _0x59efc6;return db[_0xf422('0x2a')][_0xf422('0x49')]({'where':{'id':_0x7ddb3[_0xf422('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5ec3a5,null))['then'](function(_0x31012e){if(_0x31012e){_0x14904a=_0x31012e;_0x416e40[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x4a')]['rawAttributes']);_0x416e40['query']=_['keys'](_0x7ddb3[_0xf422('0x2d')]);_0x416e40[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x416e40[_0xf422('0x2c')],_0x416e40[_0xf422('0x2d')]);_0x3345dd[_0xf422('0x32')]=_[_0xf422('0x30')](_0x416e40['model'],qs['fields'](_0x7ddb3['query'][_0xf422('0x31')]));_0x3345dd['attributes']=_0x3345dd[_0xf422('0x32')][_0xf422('0x3e')]?_0x3345dd['attributes']:_0x416e40[_0xf422('0x2c')];_0x3345dd[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x7ddb3['query'][_0xf422('0x35')]);_0x3345dd[_0xf422('0x36')]=qs['filters'](_[_0xf422('0x4b')](_0x7ddb3[_0xf422('0x2d')],_0x416e40[_0xf422('0x2f')]));if(_0x7ddb3[_0xf422('0x2d')][_0xf422('0x47')]){_0x3345dd[_0xf422('0x36')]=_[_0xf422('0x41')](_0x3345dd['where'],{'$or':_[_0xf422('0x29')](_0x3345dd[_0xf422('0x32')],function(_0x33c2df){var _0x503660={};_0x503660[_0x33c2df]={'$like':'%'+_0x7ddb3['query'][_0xf422('0x47')]+'%'};return _0x503660;})});}_0x3345dd=_[_0xf422('0x41')]({},_0x3345dd,_0x7ddb3[_0xf422('0x42')]);return _0x14904a[_0xf422('0x4c')](_0x3345dd);}})[_0xf422('0x25')](function(_0x3b1d2d){if(_0x3b1d2d){_0x59efc6=_0x3b1d2d['length'];if(!_0x7ddb3[_0xf422('0x2d')][_0xf422('0x48')](_0xf422('0x33'))){_0x3345dd['limit']=qs[_0xf422('0x1e')](_0x7ddb3['query']['limit']);_0x3345dd[_0xf422('0x1b')]=qs['offset'](_0x7ddb3[_0xf422('0x2d')][_0xf422('0x1b')]);}return _0x14904a[_0xf422('0x4c')](_0x3345dd);}})[_0xf422('0x25')](function(_0x185bba){if(_0x185bba){return _0x185bba?{'count':_0x59efc6,'rows':_0x185bba}:null;}})['then'](respondWithResult(_0x5ec3a5,null))[_0xf422('0x45')](handleError(_0x5ec3a5,null));};exports[_0xf422('0x4d')]=function(_0xa5c30b,_0x53d89c,_0x535814){var _0x3bc35a={};var _0x54841a={};var _0xeabbf5;var _0x5c5b61;return db[_0xf422('0x2a')][_0xf422('0x49')]({'where':{'id':_0xa5c30b['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x53d89c,null))[_0xf422('0x25')](function(_0x5a9b09){if(_0x5a9b09){_0xeabbf5=_0x5a9b09;_0x54841a[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x4a')][_0xf422('0x3d')]);_0x54841a['query']=_[_0xf422('0x2e')](_0xa5c30b['query']);_0x54841a[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x54841a[_0xf422('0x2c')],_0x54841a['query']);_0x3bc35a['attributes']=_[_0xf422('0x30')](_0x54841a[_0xf422('0x2c')],qs['fields'](_0xa5c30b[_0xf422('0x2d')]['fields']));_0x3bc35a[_0xf422('0x32')]=_0x3bc35a['attributes']['length']?_0x3bc35a[_0xf422('0x32')]:_0x54841a[_0xf422('0x2c')];_0x3bc35a[_0xf422('0x34')]=qs[_0xf422('0x35')](_0xa5c30b[_0xf422('0x2d')][_0xf422('0x35')]);_0x3bc35a[_0xf422('0x36')]=qs[_0xf422('0x2f')](_['pick'](_0xa5c30b[_0xf422('0x2d')],_0x54841a[_0xf422('0x2f')]));if(_0xa5c30b[_0xf422('0x2d')][_0xf422('0x47')]){_0x3bc35a[_0xf422('0x36')]=_['merge'](_0x3bc35a[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x3bc35a[_0xf422('0x32')],function(_0x365b38){var _0x282e5b={};_0x282e5b[_0x365b38]={'$like':'%'+_0xa5c30b['query'][_0xf422('0x47')]+'%'};return _0x282e5b;})});}_0x3bc35a=_['merge']({},_0x3bc35a,_0xa5c30b[_0xf422('0x42')]);return _0xeabbf5[_0xf422('0x4d')](_0x3bc35a);}})[_0xf422('0x25')](function(_0x53d7ca){if(_0x53d7ca){_0x5c5b61=_0x53d7ca[_0xf422('0x3e')];if(!_0xa5c30b[_0xf422('0x2d')][_0xf422('0x48')](_0xf422('0x33'))){_0x3bc35a['limit']=qs['limit'](_0xa5c30b['query']['limit']);_0x3bc35a[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0xa5c30b['query'][_0xf422('0x1b')]);}return _0xeabbf5[_0xf422('0x4d')](_0x3bc35a);}})[_0xf422('0x25')](function(_0x1949af){if(_0x1949af){return _0x1949af?{'count':_0x5c5b61,'rows':_0x1949af}:null;}})[_0xf422('0x25')](respondWithResult(_0x53d89c,null))[_0xf422('0x45')](handleError(_0x53d89c,null));}; \ No newline at end of file +var _0x8ae0=['error','stack','name','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','VtigerConfiguration','findAll','rows','catch','show','params','length','find','create','update','body','getFields','findOne','VtigerField','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','Content-Range','save','destroy','then'];(function(_0x460294,_0x53e384){var _0x5b793e=function(_0x2fc992){while(--_0x2fc992){_0x460294['push'](_0x460294['shift']());}};_0x5b793e(++_0x53e384);}(_0x8ae0,0x115));var _0x08ae=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8ae0[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x08ae('0x0'));var rimraf=require(_0x08ae('0x1'));var zipdir=require(_0x08ae('0x2'));var jsonpatch=require(_0x08ae('0x3'));var rp=require(_0x08ae('0x4'));var moment=require('moment');var BPromise=require(_0x08ae('0x5'));var Mustache=require(_0x08ae('0x6'));var util=require(_0x08ae('0x7'));var path=require(_0x08ae('0x8'));var sox=require(_0x08ae('0x9'));var csv=require('to-csv');var ejs=require(_0x08ae('0xa'));var fs=require('fs');var fs_extra=require(_0x08ae('0xb'));var _=require(_0x08ae('0xc'));var squel=require('squel');var crypto=require(_0x08ae('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x08ae('0xe'));var Papa=require(_0x08ae('0xf'));var Redis=require(_0x08ae('0x10'));var authService=require(_0x08ae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x08ae('0x12'));var hardwareService=require(_0x08ae('0x13'));var logger=require(_0x08ae('0x14'))(_0x08ae('0x15'));var utils=require(_0x08ae('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x08ae('0x17'));var db=require(_0x08ae('0x18'))['db'];function respondWithStatusCode(_0xe55963,_0x4eba5c){_0x4eba5c=_0x4eba5c||0xcc;return function(_0x9fc151){if(_0x9fc151){return _0xe55963[_0x08ae('0x19')](_0x4eba5c);}return _0xe55963[_0x08ae('0x1a')](_0x4eba5c)[_0x08ae('0x1b')]();};}function respondWithResult(_0x16d86a,_0x38219e){_0x38219e=_0x38219e||0xc8;return function(_0x42f286){if(_0x42f286){return _0x16d86a[_0x08ae('0x1a')](_0x38219e)[_0x08ae('0x1c')](_0x42f286);}};}function respondWithFilteredResult(_0x576165,_0x574b24){return function(_0xfe9902){if(_0xfe9902){var _0x3ea04=typeof _0x574b24[_0x08ae('0x1d')]==='undefined'&&typeof _0x574b24['limit']==='undefined';var _0x1b28f8=_0xfe9902[_0x08ae('0x1e')];var _0x1589df=_0x3ea04?0x0:_0x574b24[_0x08ae('0x1d')];var _0x36dc40=_0x3ea04?_0xfe9902[_0x08ae('0x1e')]:_0x574b24[_0x08ae('0x1d')]+_0x574b24['limit'];var _0x55b70d;if(_0x36dc40>=_0x1b28f8){_0x36dc40=_0x1b28f8;_0x55b70d=0xc8;}else{_0x55b70d=0xce;}_0x576165[_0x08ae('0x1a')](_0x55b70d);return _0x576165['set'](_0x08ae('0x1f'),_0x1589df+'-'+_0x36dc40+'/'+_0x1b28f8)[_0x08ae('0x1c')](_0xfe9902);}return null;};}function patchUpdates(_0x50d52d){return function(_0x1a9669){try{jsonpatch['apply'](_0x1a9669,_0x50d52d,!![]);}catch(_0x2c8666){return BPromise['reject'](_0x2c8666);}return _0x1a9669[_0x08ae('0x20')]();};}function saveUpdates(_0x3747c2,_0xe82362){return function(_0x14d35d){if(_0x14d35d){return _0x14d35d['update'](_0x3747c2)['then'](function(_0x293535){return _0x293535;});}return null;};}function removeEntity(_0x3ba91f,_0x1639a6){return function(_0x197068){if(_0x197068){return _0x197068[_0x08ae('0x21')]()[_0x08ae('0x22')](function(){_0x3ba91f[_0x08ae('0x1a')](0xcc)[_0x08ae('0x1b')]();});}};}function handleEntityNotFound(_0xbd97e1,_0x4968c9){return function(_0x54a1fc){if(!_0x54a1fc){_0xbd97e1[_0x08ae('0x19')](0x194);}return _0x54a1fc;};}function handleError(_0x344973,_0x544874){_0x544874=_0x544874||0x1f4;return function(_0x39ac46){logger[_0x08ae('0x23')](_0x39ac46[_0x08ae('0x24')]);if(_0x39ac46[_0x08ae('0x25')]){delete _0x39ac46[_0x08ae('0x25')];}_0x344973[_0x08ae('0x1a')](_0x544874)['send'](_0x39ac46);};}exports['index']=function(_0x590956,_0x4c806c){var _0x5efdf3={},_0x121fbe={},_0x53fff2={'count':0x0,'rows':[]};var _0x1ad270=_[_0x08ae('0x26')](db['VtigerConfiguration']['rawAttributes'],function(_0x4e36de){return{'name':_0x4e36de[_0x08ae('0x27')],'type':_0x4e36de[_0x08ae('0x28')][_0x08ae('0x29')]};});_0x121fbe[_0x08ae('0x2a')]=_[_0x08ae('0x26')](_0x1ad270,'name');_0x121fbe[_0x08ae('0x2b')]=_[_0x08ae('0x2c')](_0x590956['query']);_0x121fbe[_0x08ae('0x2d')]=_['intersection'](_0x121fbe['model'],_0x121fbe[_0x08ae('0x2b')]);_0x5efdf3[_0x08ae('0x2e')]=_[_0x08ae('0x2f')](_0x121fbe[_0x08ae('0x2a')],qs[_0x08ae('0x30')](_0x590956['query'][_0x08ae('0x30')]));_0x5efdf3[_0x08ae('0x2e')]=_0x5efdf3['attributes']['length']?_0x5efdf3[_0x08ae('0x2e')]:_0x121fbe['model'];if(!_0x590956[_0x08ae('0x2b')][_0x08ae('0x31')](_0x08ae('0x32'))){_0x5efdf3[_0x08ae('0x33')]=qs['limit'](_0x590956[_0x08ae('0x2b')][_0x08ae('0x33')]);_0x5efdf3['offset']=qs[_0x08ae('0x1d')](_0x590956[_0x08ae('0x2b')]['offset']);}_0x5efdf3[_0x08ae('0x34')]=qs[_0x08ae('0x35')](_0x590956[_0x08ae('0x2b')]['sort']);_0x5efdf3[_0x08ae('0x36')]=qs[_0x08ae('0x2d')](_[_0x08ae('0x37')](_0x590956[_0x08ae('0x2b')],_0x121fbe['filters']),_0x1ad270);if(_0x590956[_0x08ae('0x2b')][_0x08ae('0x38')]){_0x5efdf3[_0x08ae('0x36')]=_['merge'](_0x5efdf3['where'],{'$or':_[_0x08ae('0x26')](_0x1ad270,function(_0x38de82){if(_0x38de82['type']!==_0x08ae('0x39')){var _0xa4d27e={};_0xa4d27e[_0x38de82[_0x08ae('0x25')]]={'$like':'%'+_0x590956['query'][_0x08ae('0x38')]+'%'};return _0xa4d27e;}})});}_0x5efdf3=_[_0x08ae('0x3a')]({},_0x5efdf3,_0x590956[_0x08ae('0x3b')]);var _0x48c220={'where':_0x5efdf3[_0x08ae('0x36')]};return db['VtigerConfiguration']['count'](_0x48c220)[_0x08ae('0x22')](function(_0x2230a7){_0x53fff2[_0x08ae('0x1e')]=_0x2230a7;if(_0x590956[_0x08ae('0x2b')][_0x08ae('0x3c')]){_0x5efdf3['include']=[{'all':!![]}];}return db[_0x08ae('0x3d')][_0x08ae('0x3e')](_0x5efdf3);})[_0x08ae('0x22')](function(_0x5d7be2){_0x53fff2[_0x08ae('0x3f')]=_0x5d7be2;return _0x53fff2;})[_0x08ae('0x22')](respondWithFilteredResult(_0x4c806c,_0x5efdf3))[_0x08ae('0x40')](handleError(_0x4c806c,null));};exports[_0x08ae('0x41')]=function(_0x8b24,_0x19b754){var _0x408789={'raw':![],'where':{'id':_0x8b24[_0x08ae('0x42')]['id']}},_0x5b485a={};_0x5b485a[_0x08ae('0x2a')]=_[_0x08ae('0x2c')](db[_0x08ae('0x3d')]['rawAttributes']);_0x5b485a['query']=_[_0x08ae('0x2c')](_0x8b24[_0x08ae('0x2b')]);_0x5b485a[_0x08ae('0x2d')]=_['intersection'](_0x5b485a[_0x08ae('0x2a')],_0x5b485a[_0x08ae('0x2b')]);_0x408789[_0x08ae('0x2e')]=_[_0x08ae('0x2f')](_0x5b485a['model'],qs[_0x08ae('0x30')](_0x8b24['query'][_0x08ae('0x30')]));_0x408789[_0x08ae('0x2e')]=_0x408789['attributes'][_0x08ae('0x43')]?_0x408789[_0x08ae('0x2e')]:_0x5b485a['model'];if(_0x8b24['query'][_0x08ae('0x3c')]){_0x408789['include']=[{'all':!![]}];}_0x408789=_['merge']({},_0x408789,_0x8b24[_0x08ae('0x3b')]);return db[_0x08ae('0x3d')][_0x08ae('0x44')](_0x408789)[_0x08ae('0x22')](handleEntityNotFound(_0x19b754,null))[_0x08ae('0x22')](respondWithResult(_0x19b754,null))['catch'](handleError(_0x19b754,null));};exports[_0x08ae('0x45')]=function(_0x3ec578,_0x432f1c){return db[_0x08ae('0x3d')][_0x08ae('0x45')](_0x3ec578['body'],{})[_0x08ae('0x22')](respondWithResult(_0x432f1c,0xc9))[_0x08ae('0x40')](handleError(_0x432f1c,null));};exports[_0x08ae('0x46')]=function(_0x378fe6,_0x3c7a8b){if(_0x378fe6[_0x08ae('0x47')]['id']){delete _0x378fe6[_0x08ae('0x47')]['id'];}return db[_0x08ae('0x3d')][_0x08ae('0x44')]({'where':{'id':_0x378fe6[_0x08ae('0x42')]['id']}})[_0x08ae('0x22')](handleEntityNotFound(_0x3c7a8b,null))[_0x08ae('0x22')](saveUpdates(_0x378fe6[_0x08ae('0x47')],null))[_0x08ae('0x22')](respondWithResult(_0x3c7a8b,null))[_0x08ae('0x40')](handleError(_0x3c7a8b,null));};exports['destroy']=function(_0x94ae3b,_0x15d8c3){return db[_0x08ae('0x3d')][_0x08ae('0x44')]({'where':{'id':_0x94ae3b['params']['id']}})['then'](handleEntityNotFound(_0x15d8c3,null))[_0x08ae('0x22')](removeEntity(_0x15d8c3,null))['catch'](handleError(_0x15d8c3,null));};exports[_0x08ae('0x48')]=function(_0x2cd97a,_0x30b416,_0x328b82){var _0x5e7f1c={};var _0x3db094={};var _0x34bd55;var _0x3703a6;return db[_0x08ae('0x3d')][_0x08ae('0x49')]({'where':{'id':_0x2cd97a['params']['id']}})[_0x08ae('0x22')](handleEntityNotFound(_0x30b416,null))[_0x08ae('0x22')](function(_0x1024ee){if(_0x1024ee){_0x34bd55=_0x1024ee;_0x3db094['model']=_['keys'](db[_0x08ae('0x4a')][_0x08ae('0x4b')]);_0x3db094[_0x08ae('0x2b')]=_[_0x08ae('0x2c')](_0x2cd97a[_0x08ae('0x2b')]);_0x3db094[_0x08ae('0x2d')]=_[_0x08ae('0x2f')](_0x3db094[_0x08ae('0x2a')],_0x3db094[_0x08ae('0x2b')]);_0x5e7f1c[_0x08ae('0x2e')]=_[_0x08ae('0x2f')](_0x3db094[_0x08ae('0x2a')],qs[_0x08ae('0x30')](_0x2cd97a[_0x08ae('0x2b')][_0x08ae('0x30')]));_0x5e7f1c['attributes']=_0x5e7f1c[_0x08ae('0x2e')][_0x08ae('0x43')]?_0x5e7f1c['attributes']:_0x3db094[_0x08ae('0x2a')];_0x5e7f1c[_0x08ae('0x34')]=qs[_0x08ae('0x35')](_0x2cd97a[_0x08ae('0x2b')][_0x08ae('0x35')]);_0x5e7f1c[_0x08ae('0x36')]=qs[_0x08ae('0x2d')](_['pick'](_0x2cd97a[_0x08ae('0x2b')],_0x3db094[_0x08ae('0x2d')]));if(_0x2cd97a[_0x08ae('0x2b')][_0x08ae('0x38')]){_0x5e7f1c[_0x08ae('0x36')]=_['merge'](_0x5e7f1c[_0x08ae('0x36')],{'$or':_[_0x08ae('0x26')](_0x5e7f1c[_0x08ae('0x2e')],function(_0x2c823b){var _0xaaaced={};_0xaaaced[_0x2c823b]={'$like':'%'+_0x2cd97a[_0x08ae('0x2b')][_0x08ae('0x38')]+'%'};return _0xaaaced;})});}_0x5e7f1c=_[_0x08ae('0x3a')]({},_0x5e7f1c,_0x2cd97a[_0x08ae('0x3b')]);return _0x34bd55[_0x08ae('0x48')](_0x5e7f1c);}})[_0x08ae('0x22')](function(_0x56a098){if(_0x56a098){_0x3703a6=_0x56a098['length'];if(!_0x2cd97a[_0x08ae('0x2b')][_0x08ae('0x31')](_0x08ae('0x32'))){_0x5e7f1c[_0x08ae('0x33')]=qs[_0x08ae('0x33')](_0x2cd97a[_0x08ae('0x2b')][_0x08ae('0x33')]);_0x5e7f1c['offset']=qs['offset'](_0x2cd97a[_0x08ae('0x2b')][_0x08ae('0x1d')]);}return _0x34bd55['getFields'](_0x5e7f1c);}})['then'](function(_0xb1f174){if(_0xb1f174){return _0xb1f174?{'count':_0x3703a6,'rows':_0xb1f174}:null;}})[_0x08ae('0x22')](respondWithResult(_0x30b416,null))[_0x08ae('0x40')](handleError(_0x30b416,null));};exports[_0x08ae('0x4c')]=function(_0x524911,_0x5a3297,_0x5ec09f){var _0x32af6a={};var _0x15dedb={};var _0x39e471;var _0x521293;return db[_0x08ae('0x3d')]['findOne']({'where':{'id':_0x524911[_0x08ae('0x42')]['id']}})[_0x08ae('0x22')](handleEntityNotFound(_0x5a3297,null))[_0x08ae('0x22')](function(_0x3cb488){if(_0x3cb488){_0x39e471=_0x3cb488;_0x15dedb[_0x08ae('0x2a')]=_[_0x08ae('0x2c')](db[_0x08ae('0x4a')]['rawAttributes']);_0x15dedb[_0x08ae('0x2b')]=_[_0x08ae('0x2c')](_0x524911['query']);_0x15dedb[_0x08ae('0x2d')]=_[_0x08ae('0x2f')](_0x15dedb[_0x08ae('0x2a')],_0x15dedb[_0x08ae('0x2b')]);_0x32af6a[_0x08ae('0x2e')]=_['intersection'](_0x15dedb[_0x08ae('0x2a')],qs[_0x08ae('0x30')](_0x524911['query']['fields']));_0x32af6a[_0x08ae('0x2e')]=_0x32af6a[_0x08ae('0x2e')][_0x08ae('0x43')]?_0x32af6a[_0x08ae('0x2e')]:_0x15dedb[_0x08ae('0x2a')];_0x32af6a[_0x08ae('0x34')]=qs[_0x08ae('0x35')](_0x524911['query']['sort']);_0x32af6a['where']=qs[_0x08ae('0x2d')](_['pick'](_0x524911[_0x08ae('0x2b')],_0x15dedb['filters']));if(_0x524911[_0x08ae('0x2b')]['filter']){_0x32af6a[_0x08ae('0x36')]=_[_0x08ae('0x3a')](_0x32af6a[_0x08ae('0x36')],{'$or':_[_0x08ae('0x26')](_0x32af6a['attributes'],function(_0x715e93){var _0x451881={};_0x451881[_0x715e93]={'$like':'%'+_0x524911[_0x08ae('0x2b')][_0x08ae('0x38')]+'%'};return _0x451881;})});}_0x32af6a=_[_0x08ae('0x3a')]({},_0x32af6a,_0x524911[_0x08ae('0x3b')]);return _0x39e471[_0x08ae('0x4c')](_0x32af6a);}})['then'](function(_0x568c91){if(_0x568c91){_0x521293=_0x568c91[_0x08ae('0x43')];if(!_0x524911['query'][_0x08ae('0x31')]('nolimit')){_0x32af6a[_0x08ae('0x33')]=qs['limit'](_0x524911[_0x08ae('0x2b')][_0x08ae('0x33')]);_0x32af6a[_0x08ae('0x1d')]=qs[_0x08ae('0x1d')](_0x524911[_0x08ae('0x2b')][_0x08ae('0x1d')]);}return _0x39e471[_0x08ae('0x4c')](_0x32af6a);}})[_0x08ae('0x22')](function(_0x4bff14){if(_0x4bff14){return _0x4bff14?{'count':_0x521293,'rows':_0x4bff14}:null;}})[_0x08ae('0x22')](respondWithResult(_0x5a3297,null))[_0x08ae('0x40')](handleError(_0x5a3297,null));};exports[_0x08ae('0x4d')]=function(_0x4e468c,_0x80408f,_0x5f5d35){var _0x2a4862={};var _0x20b303={};var _0xfbb44e;var _0x34d737;return db[_0x08ae('0x3d')][_0x08ae('0x49')]({'where':{'id':_0x4e468c[_0x08ae('0x42')]['id']}})[_0x08ae('0x22')](handleEntityNotFound(_0x80408f,null))['then'](function(_0x108647){if(_0x108647){_0xfbb44e=_0x108647;_0x20b303[_0x08ae('0x2a')]=_[_0x08ae('0x2c')](db[_0x08ae('0x4a')][_0x08ae('0x4b')]);_0x20b303[_0x08ae('0x2b')]=_[_0x08ae('0x2c')](_0x4e468c[_0x08ae('0x2b')]);_0x20b303[_0x08ae('0x2d')]=_[_0x08ae('0x2f')](_0x20b303[_0x08ae('0x2a')],_0x20b303['query']);_0x2a4862[_0x08ae('0x2e')]=_[_0x08ae('0x2f')](_0x20b303[_0x08ae('0x2a')],qs[_0x08ae('0x30')](_0x4e468c['query'][_0x08ae('0x30')]));_0x2a4862[_0x08ae('0x2e')]=_0x2a4862[_0x08ae('0x2e')][_0x08ae('0x43')]?_0x2a4862[_0x08ae('0x2e')]:_0x20b303[_0x08ae('0x2a')];_0x2a4862[_0x08ae('0x34')]=qs[_0x08ae('0x35')](_0x4e468c[_0x08ae('0x2b')]['sort']);_0x2a4862[_0x08ae('0x36')]=qs[_0x08ae('0x2d')](_[_0x08ae('0x37')](_0x4e468c[_0x08ae('0x2b')],_0x20b303[_0x08ae('0x2d')]));if(_0x4e468c['query'][_0x08ae('0x38')]){_0x2a4862[_0x08ae('0x36')]=_[_0x08ae('0x3a')](_0x2a4862[_0x08ae('0x36')],{'$or':_[_0x08ae('0x26')](_0x2a4862[_0x08ae('0x2e')],function(_0x401f6c){var _0x21db3f={};_0x21db3f[_0x401f6c]={'$like':'%'+_0x4e468c[_0x08ae('0x2b')][_0x08ae('0x38')]+'%'};return _0x21db3f;})});}_0x2a4862=_[_0x08ae('0x3a')]({},_0x2a4862,_0x4e468c['options']);return _0xfbb44e[_0x08ae('0x4d')](_0x2a4862);}})['then'](function(_0x54b947){if(_0x54b947){_0x34d737=_0x54b947[_0x08ae('0x43')];if(!_0x4e468c[_0x08ae('0x2b')]['hasOwnProperty']('nolimit')){_0x2a4862[_0x08ae('0x33')]=qs[_0x08ae('0x33')](_0x4e468c[_0x08ae('0x2b')][_0x08ae('0x33')]);_0x2a4862['offset']=qs['offset'](_0x4e468c[_0x08ae('0x2b')]['offset']);}return _0xfbb44e[_0x08ae('0x4d')](_0x2a4862);}})[_0x08ae('0x22')](function(_0x4bfc22){if(_0x4bfc22){return _0x4bfc22?{'count':_0x34d737,'rows':_0x4bfc22}:null;}})[_0x08ae('0x22')](respondWithResult(_0x80408f,null))[_0x08ae('0x40')](handleError(_0x80408f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e166c60..a433ed7 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 _0xd4fb=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2547c3,_0x2df02f){var _0x551191=function(_0x292db4){while(--_0x292db4){_0x2547c3['push'](_0x2547c3['shift']());}};_0x551191(++_0x2df02f);}(_0xd4fb,0xca));var _0xbd4f=function(_0x2950fb,_0x474110){_0x2950fb=_0x2950fb-0x0;var _0x53c9f1=_0xd4fb[_0x2950fb];return _0x53c9f1;};'use strict';var _=require(_0xbd4f('0x0'));var util=require(_0xbd4f('0x1'));var logger=require(_0xbd4f('0x2'))(_0xbd4f('0x3'));var moment=require(_0xbd4f('0x4'));var BPromise=require(_0xbd4f('0x5'));var rp=require(_0xbd4f('0x6'));var fs=require('fs');var path=require(_0xbd4f('0x7'));var rimraf=require(_0xbd4f('0x8'));var config=require('../../config/environment');var attributes=require(_0xbd4f('0x9'));module['exports']=function(_0x44cfc1,_0xba9d02){return _0x44cfc1[_0xbd4f('0xa')](_0xbd4f('0xb'),attributes,{'tableName':_0xbd4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x092e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x393e46,_0x56f5f7){var _0x2b2497=function(_0x14b2cc){while(--_0x14b2cc){_0x393e46['push'](_0x393e46['shift']());}};_0x2b2497(++_0x56f5f7);}(_0x092e,0xb2));var _0xe092=function(_0x2ec44e,_0x493db7){_0x2ec44e=_0x2ec44e-0x0;var _0x2d4c8e=_0x092e[_0x2ec44e];return _0x2d4c8e;};'use strict';var _=require(_0xe092('0x0'));var util=require(_0xe092('0x1'));var logger=require('../../config/logger')(_0xe092('0x2'));var moment=require(_0xe092('0x3'));var BPromise=require(_0xe092('0x4'));var rp=require(_0xe092('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe092('0x6'));var config=require(_0xe092('0x7'));var attributes=require(_0xe092('0x8'));module[_0xe092('0x9')]=function(_0x578211,_0x1267cc){return _0x578211['define'](_0xe092('0xa'),attributes,{'tableName':_0xe092('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 8b4e061..38c1935 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 _0xe32d=['request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','VtigerConfiguration,\x20%s,\x20%s','message','result','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xe32d,0x186));var _0xde32=function(_0xabbc3e,_0x2982fa){_0xabbc3e=_0xabbc3e-0x0;var _0x5d0673=_0xe32d[_0xabbc3e];return _0x5d0673;};'use strict';var _=require('lodash');var util=require(_0xde32('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xde32('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde32('0x2'))['db'];var utils=require(_0xde32('0x3'));var logger=require('../../config/logger')(_0xde32('0x4'));var config=require(_0xde32('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xde32('0x6')][_0xde32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3419a3,_0x22fa34,_0x2975b7){return new BPromise(function(_0x440b32,_0x527e5d){return client[_0xde32('0x8')](_0x3419a3,_0x2975b7)[_0xde32('0x9')](function(_0x3685d1){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x22fa34,_0xde32('0xa'));logger['debug'](_0xde32('0xb'),_0x22fa34,_0xde32('0xa'),JSON['stringify'](_0x3685d1));if(_0x3685d1[_0xde32('0xc')]){if(_0x3685d1[_0xde32('0xc')]['code']===0x1f4){logger[_0xde32('0xc')](_0xde32('0xd'),_0x22fa34,_0x3685d1[_0xde32('0xc')][_0xde32('0xe')]);return _0x527e5d(_0x3685d1[_0xde32('0xc')][_0xde32('0xe')]);}logger[_0xde32('0xc')](_0xde32('0xd'),_0x22fa34,_0x3685d1[_0xde32('0xc')][_0xde32('0xe')]);return _0x440b32(_0x3685d1[_0xde32('0xc')][_0xde32('0xe')]);}else{logger['info'](_0xde32('0xd'),_0x22fa34,'request\x20sent');_0x440b32(_0x3685d1[_0xde32('0xf')][_0xde32('0xe')]);}})['catch'](function(_0x2c0448){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x22fa34,_0x2c0448);_0x527e5d(_0x2c0448);});});} \ No newline at end of file +var _0xfa67=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x377ba1,_0x50abae){var _0x4c192e=function(_0x3f55b3){while(--_0x3f55b3){_0x377ba1['push'](_0x377ba1['shift']());}};_0x4c192e(++_0x50abae);}(_0xfa67,0x1d5));var _0x7fa6=function(_0x43f056,_0x1172e6){_0x43f056=_0x43f056-0x0;var _0x589023=_0xfa67[_0x43f056];return _0x589023;};'use strict';var _=require(_0x7fa6('0x0'));var util=require(_0x7fa6('0x1'));var moment=require(_0x7fa6('0x2'));var BPromise=require('bluebird');var rs=require(_0x7fa6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fa6('0x4'))['db'];var utils=require(_0x7fa6('0x5'));var logger=require(_0x7fa6('0x6'))(_0x7fa6('0x7'));var config=require(_0x7fa6('0x8'));var jayson=require(_0x7fa6('0x9'));var client=jayson[_0x7fa6('0xa')][_0x7fa6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d7e0f,_0x15d040,_0x5cc7a5){return new BPromise(function(_0x5a4709,_0x30cda1){return client[_0x7fa6('0xc')](_0x1d7e0f,_0x5cc7a5)[_0x7fa6('0xd')](function(_0x45de84){logger[_0x7fa6('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x15d040,_0x7fa6('0xf'));logger[_0x7fa6('0x10')](_0x7fa6('0x11'),_0x15d040,_0x7fa6('0xf'),JSON[_0x7fa6('0x12')](_0x45de84));if(_0x45de84['error']){if(_0x45de84[_0x7fa6('0x13')][_0x7fa6('0x14')]===0x1f4){logger['error'](_0x7fa6('0x15'),_0x15d040,_0x45de84[_0x7fa6('0x13')][_0x7fa6('0x16')]);return _0x30cda1(_0x45de84[_0x7fa6('0x13')]['message']);}logger[_0x7fa6('0x13')](_0x7fa6('0x15'),_0x15d040,_0x45de84[_0x7fa6('0x13')][_0x7fa6('0x16')]);return _0x5a4709(_0x45de84[_0x7fa6('0x13')]['message']);}else{logger[_0x7fa6('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x15d040,_0x7fa6('0xf'));_0x5a4709(_0x45de84[_0x7fa6('0x17')][_0x7fa6('0x16')]);}})[_0x7fa6('0x18')](function(_0x4068f2){logger['error'](_0x7fa6('0x15'),_0x15d040,_0x4068f2);_0x30cda1(_0x4068f2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5d585db..ea50815 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 _0x9f93=['fs-extra','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout'];(function(_0x5154ce,_0x3275d0){var _0x5bceab=function(_0x7dd73){while(--_0x7dd73){_0x5154ce['push'](_0x5154ce['shift']());}};_0x5bceab(++_0x3275d0);}(_0x9f93,0x95));var _0x39f9=function(_0xb95ed5,_0x960508){_0xb95ed5=_0xb95ed5-0x0;var _0x48bb0d=_0x9f93[_0xb95ed5];return _0x48bb0d;};'use strict';var multer=require(_0x39f9('0x0'));var util=require(_0x39f9('0x1'));var path=require(_0x39f9('0x2'));var timeout=require(_0x39f9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x39f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x39f9('0x5'));var config=require('../../config/environment');var controller=require(_0x39f9('0x6'));router[_0x39f9('0x7')]('/',auth[_0x39f9('0x8')](),controller[_0x39f9('0x9')]);router['get']('/:id',auth[_0x39f9('0x8')](),controller[_0x39f9('0xa')]);router['post']('/',auth[_0x39f9('0x8')](),controller[_0x39f9('0xb')]);router[_0x39f9('0xc')]('/:id',auth[_0x39f9('0x8')](),controller[_0x39f9('0xd')]);router[_0x39f9('0xe')](_0x39f9('0xf'),auth[_0x39f9('0x8')](),controller['destroy']);module[_0x39f9('0x10')]=router; \ No newline at end of file +var _0x5947=['fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x543273,_0x3ca545){var _0x23ece1=function(_0x15f6cf){while(--_0x15f6cf){_0x543273['push'](_0x543273['shift']());}};_0x23ece1(++_0x3ca545);}(_0x5947,0x1ea));var _0x7594=function(_0x4e0276,_0x386e65){_0x4e0276=_0x4e0276-0x0;var _0x56a90f=_0x5947[_0x4e0276];return _0x56a90f;};'use strict';var multer=require(_0x7594('0x0'));var util=require(_0x7594('0x1'));var path=require('path');var timeout=require(_0x7594('0x2'));var express=require('express');var router=express[_0x7594('0x3')]();var fs_extra=require(_0x7594('0x4'));var auth=require(_0x7594('0x5'));var interaction=require(_0x7594('0x6'));var config=require('../../config/environment');var controller=require(_0x7594('0x7'));router[_0x7594('0x8')]('/',auth[_0x7594('0x9')](),controller[_0x7594('0xa')]);router[_0x7594('0x8')](_0x7594('0xb'),auth[_0x7594('0x9')](),controller[_0x7594('0xc')]);router[_0x7594('0xd')]('/',auth['isAuthenticated'](),controller[_0x7594('0xe')]);router[_0x7594('0xf')](_0x7594('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7594('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x7594('0x11')]);module[_0x7594('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 50ff6c2..130cb3f 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 _0x1342=['ENUM','keyValue','picklist','STRING','string','sequelize','exports'];(function(_0x4cdc78,_0x5e168b){var _0x1cbfd0=function(_0x1c3267){while(--_0x1c3267){_0x4cdc78['push'](_0x4cdc78['shift']());}};_0x1cbfd0(++_0x5e168b);}(_0x1342,0x11d));var _0x2134=function(_0x4ae39d,_0x5c3787){_0x4ae39d=_0x4ae39d-0x0;var _0x1015a7=_0x1342[_0x4ae39d];return _0x1015a7;};'use strict';var Sequelize=require(_0x2134('0x0'));module[_0x2134('0x1')]={'type':{'type':Sequelize[_0x2134('0x2')]('string','variable','customVariable',_0x2134('0x3'),_0x2134('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2134('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2134('0x2')](_0x2134('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2134('0x5')]},'idField':{'type':Sequelize[_0x2134('0x5')]},'nameField':{'type':Sequelize[_0x2134('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2134('0x5')]}}; \ No newline at end of file +var _0x5759=['ENUM','keyValue','picklist','STRING','string','variable','customVariable','sequelize','exports'];(function(_0x56cf0f,_0x483cef){var _0x5cf04f=function(_0x555c37){while(--_0x555c37){_0x56cf0f['push'](_0x56cf0f['shift']());}};_0x5cf04f(++_0x483cef);}(_0x5759,0x181));var _0x9575=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x5759[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x9575('0x0'));module[_0x9575('0x1')]={'type':{'type':Sequelize[_0x9575('0x2')]('string','variable','customVariable',_0x9575('0x3'),_0x9575('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9575('0x5')]},'key':{'type':Sequelize[_0x9575('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x9575('0x6'),_0x9575('0x7'),_0x9575('0x8'))},'keyContent':{'type':Sequelize[_0x9575('0x5')]},'idField':{'type':Sequelize[_0x9575('0x5')]},'nameField':{'type':Sequelize[_0x9575('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9575('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f61b900..8c413af 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 _0xfb2b=['limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0xbaf87a,_0x4982ef){var _0x166be4=function(_0x21d1fc){while(--_0x21d1fc){_0xbaf87a['push'](_0xbaf87a['shift']());}};_0x166be4(++_0x4982ef);}(_0xfb2b,0x154));var _0xbfb2=function(_0x5ae070,_0x23c722){_0x5ae070=_0x5ae070-0x0;var _0x29d88a=_0xfb2b[_0x5ae070];return _0x29d88a;};'use strict';var emlformat=require(_0xbfb2('0x0'));var rimraf=require(_0xbfb2('0x1'));var zipdir=require(_0xbfb2('0x2'));var jsonpatch=require(_0xbfb2('0x3'));var rp=require('request-promise');var moment=require(_0xbfb2('0x4'));var BPromise=require(_0xbfb2('0x5'));var Mustache=require(_0xbfb2('0x6'));var util=require('util');var path=require(_0xbfb2('0x7'));var sox=require('sox');var csv=require(_0xbfb2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfb2('0x9'));var _=require(_0xbfb2('0xa'));var squel=require(_0xbfb2('0xb'));var crypto=require(_0xbfb2('0xc'));var jsforce=require(_0xbfb2('0xd'));var deskjs=require(_0xbfb2('0xe'));var toCsv=require(_0xbfb2('0x8'));var querystring=require(_0xbfb2('0xf'));var Papa=require(_0xbfb2('0x10'));var Redis=require(_0xbfb2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfb2('0x12'));var as=require(_0xbfb2('0x13'));var hardwareService=require(_0xbfb2('0x14'));var logger=require('../../config/logger')(_0xbfb2('0x15'));var utils=require(_0xbfb2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbfb2('0x17'))['db'];function respondWithStatusCode(_0xdc1e85,_0x2800ed){_0x2800ed=_0x2800ed||0xcc;return function(_0x42a7d0){if(_0x42a7d0){return _0xdc1e85[_0xbfb2('0x18')](_0x2800ed);}return _0xdc1e85[_0xbfb2('0x19')](_0x2800ed)[_0xbfb2('0x1a')]();};}function respondWithResult(_0x46cbad,_0x17ac8f){_0x17ac8f=_0x17ac8f||0xc8;return function(_0x261695){if(_0x261695){return _0x46cbad['status'](_0x17ac8f)[_0xbfb2('0x1b')](_0x261695);}};}function respondWithFilteredResult(_0x218ce9,_0x51c8ce){return function(_0x3c0bd4){if(_0x3c0bd4){var _0x4441b8=typeof _0x51c8ce[_0xbfb2('0x1c')]===_0xbfb2('0x1d')&&typeof _0x51c8ce[_0xbfb2('0x1e')]===_0xbfb2('0x1d');var _0x37e022=_0x3c0bd4[_0xbfb2('0x1f')];var _0x57a01a=_0x4441b8?0x0:_0x51c8ce[_0xbfb2('0x1c')];var _0x1b45f0=_0x4441b8?_0x3c0bd4['count']:_0x51c8ce[_0xbfb2('0x1c')]+_0x51c8ce['limit'];var _0x47a99c;if(_0x1b45f0>=_0x37e022){_0x1b45f0=_0x37e022;_0x47a99c=0xc8;}else{_0x47a99c=0xce;}_0x218ce9[_0xbfb2('0x19')](_0x47a99c);return _0x218ce9['set'](_0xbfb2('0x20'),_0x57a01a+'-'+_0x1b45f0+'/'+_0x37e022)[_0xbfb2('0x1b')](_0x3c0bd4);}return null;};}function patchUpdates(_0x19624f){return function(_0x39e6aa){try{jsonpatch[_0xbfb2('0x21')](_0x39e6aa,_0x19624f,!![]);}catch(_0x325168){return BPromise['reject'](_0x325168);}return _0x39e6aa[_0xbfb2('0x22')]();};}function saveUpdates(_0x23c93c,_0x32a979){return function(_0x45fe5d){if(_0x45fe5d){return _0x45fe5d[_0xbfb2('0x23')](_0x23c93c)['then'](function(_0x6027be){return _0x6027be;});}return null;};}function removeEntity(_0x4745f8,_0x380183){return function(_0x74a8f5){if(_0x74a8f5){return _0x74a8f5[_0xbfb2('0x24')]()[_0xbfb2('0x25')](function(){_0x4745f8[_0xbfb2('0x19')](0xcc)[_0xbfb2('0x1a')]();});}};}function handleEntityNotFound(_0x5a2ec9,_0x4bf02e){return function(_0x3d8094){if(!_0x3d8094){_0x5a2ec9['sendStatus'](0x194);}return _0x3d8094;};}function handleError(_0x410091,_0x1f4cdb){_0x1f4cdb=_0x1f4cdb||0x1f4;return function(_0x528ca2){logger[_0xbfb2('0x26')](_0x528ca2[_0xbfb2('0x27')]);if(_0x528ca2[_0xbfb2('0x28')]){delete _0x528ca2['name'];}_0x410091[_0xbfb2('0x19')](_0x1f4cdb)[_0xbfb2('0x29')](_0x528ca2);};}exports[_0xbfb2('0x2a')]=function(_0x23de3a,_0x587d7e){var _0x760541={},_0x4f9fe8={},_0x45e405={'count':0x0,'rows':[]};var _0x1d6792=_[_0xbfb2('0x2b')](db[_0xbfb2('0x2c')][_0xbfb2('0x2d')],function(_0x5a26fc){return{'name':_0x5a26fc[_0xbfb2('0x2e')],'type':_0x5a26fc['type'][_0xbfb2('0x2f')]};});_0x4f9fe8[_0xbfb2('0x30')]=_[_0xbfb2('0x2b')](_0x1d6792,_0xbfb2('0x28'));_0x4f9fe8[_0xbfb2('0x31')]=_[_0xbfb2('0x32')](_0x23de3a['query']);_0x4f9fe8['filters']=_[_0xbfb2('0x33')](_0x4f9fe8[_0xbfb2('0x30')],_0x4f9fe8[_0xbfb2('0x31')]);_0x760541['attributes']=_[_0xbfb2('0x33')](_0x4f9fe8[_0xbfb2('0x30')],qs['fields'](_0x23de3a['query'][_0xbfb2('0x34')]));_0x760541[_0xbfb2('0x35')]=_0x760541[_0xbfb2('0x35')]['length']?_0x760541[_0xbfb2('0x35')]:_0x4f9fe8[_0xbfb2('0x30')];if(!_0x23de3a['query'][_0xbfb2('0x36')](_0xbfb2('0x37'))){_0x760541[_0xbfb2('0x1e')]=qs[_0xbfb2('0x1e')](_0x23de3a[_0xbfb2('0x31')]['limit']);_0x760541[_0xbfb2('0x1c')]=qs[_0xbfb2('0x1c')](_0x23de3a[_0xbfb2('0x31')][_0xbfb2('0x1c')]);}_0x760541[_0xbfb2('0x38')]=qs[_0xbfb2('0x39')](_0x23de3a[_0xbfb2('0x31')][_0xbfb2('0x39')]);_0x760541[_0xbfb2('0x3a')]=qs[_0xbfb2('0x3b')](_[_0xbfb2('0x3c')](_0x23de3a[_0xbfb2('0x31')],_0x4f9fe8[_0xbfb2('0x3b')]),_0x1d6792);if(_0x23de3a[_0xbfb2('0x31')][_0xbfb2('0x3d')]){_0x760541[_0xbfb2('0x3a')]=_[_0xbfb2('0x3e')](_0x760541[_0xbfb2('0x3a')],{'$or':_[_0xbfb2('0x2b')](_0x1d6792,function(_0x51e20f){if(_0x51e20f['type']!=='VIRTUAL'){var _0x36f384={};_0x36f384[_0x51e20f['name']]={'$like':'%'+_0x23de3a[_0xbfb2('0x31')][_0xbfb2('0x3d')]+'%'};return _0x36f384;}})});}_0x760541=_[_0xbfb2('0x3e')]({},_0x760541,_0x23de3a[_0xbfb2('0x3f')]);var _0x1b4e92={'where':_0x760541[_0xbfb2('0x3a')]};return db['VtigerField'][_0xbfb2('0x1f')](_0x1b4e92)[_0xbfb2('0x25')](function(_0x1dfc8e){_0x45e405[_0xbfb2('0x1f')]=_0x1dfc8e;if(_0x23de3a[_0xbfb2('0x31')][_0xbfb2('0x40')]){_0x760541[_0xbfb2('0x41')]=[{'all':!![]}];}return db[_0xbfb2('0x2c')]['findAll'](_0x760541);})[_0xbfb2('0x25')](function(_0x4c2339){_0x45e405[_0xbfb2('0x42')]=_0x4c2339;return _0x45e405;})[_0xbfb2('0x25')](respondWithFilteredResult(_0x587d7e,_0x760541))['catch'](handleError(_0x587d7e,null));};exports[_0xbfb2('0x43')]=function(_0x5371e3,_0x358dd7){var _0x34ee7c={'raw':!![],'where':{'id':_0x5371e3[_0xbfb2('0x44')]['id']}},_0x29bbd5={};_0x29bbd5[_0xbfb2('0x30')]=_['keys'](db[_0xbfb2('0x2c')]['rawAttributes']);_0x29bbd5[_0xbfb2('0x31')]=_[_0xbfb2('0x32')](_0x5371e3[_0xbfb2('0x31')]);_0x29bbd5[_0xbfb2('0x3b')]=_[_0xbfb2('0x33')](_0x29bbd5[_0xbfb2('0x30')],_0x29bbd5[_0xbfb2('0x31')]);_0x34ee7c['attributes']=_[_0xbfb2('0x33')](_0x29bbd5[_0xbfb2('0x30')],qs['fields'](_0x5371e3[_0xbfb2('0x31')][_0xbfb2('0x34')]));_0x34ee7c[_0xbfb2('0x35')]=_0x34ee7c[_0xbfb2('0x35')][_0xbfb2('0x45')]?_0x34ee7c[_0xbfb2('0x35')]:_0x29bbd5[_0xbfb2('0x30')];if(_0x5371e3[_0xbfb2('0x31')]['includeAll']){_0x34ee7c['include']=[{'all':!![]}];}_0x34ee7c=_[_0xbfb2('0x3e')]({},_0x34ee7c,_0x5371e3['options']);return db[_0xbfb2('0x2c')][_0xbfb2('0x46')](_0x34ee7c)[_0xbfb2('0x25')](handleEntityNotFound(_0x358dd7,null))['then'](respondWithResult(_0x358dd7,null))[_0xbfb2('0x47')](handleError(_0x358dd7,null));};exports[_0xbfb2('0x48')]=function(_0x23f7ea,_0x54069f){return db[_0xbfb2('0x2c')][_0xbfb2('0x48')](_0x23f7ea[_0xbfb2('0x49')],{})[_0xbfb2('0x25')](respondWithResult(_0x54069f,0xc9))[_0xbfb2('0x47')](handleError(_0x54069f,null));};exports['update']=function(_0x30a1d7,_0x3595dd){if(_0x30a1d7[_0xbfb2('0x49')]['id']){delete _0x30a1d7[_0xbfb2('0x49')]['id'];}return db['VtigerField'][_0xbfb2('0x46')]({'where':{'id':_0x30a1d7[_0xbfb2('0x44')]['id']}})[_0xbfb2('0x25')](handleEntityNotFound(_0x3595dd,null))[_0xbfb2('0x25')](saveUpdates(_0x30a1d7[_0xbfb2('0x49')],null))[_0xbfb2('0x25')](respondWithResult(_0x3595dd,null))['catch'](handleError(_0x3595dd,null));};exports[_0xbfb2('0x24')]=function(_0x754726,_0x3f663a){return db[_0xbfb2('0x2c')][_0xbfb2('0x46')]({'where':{'id':_0x754726[_0xbfb2('0x44')]['id']}})[_0xbfb2('0x25')](handleEntityNotFound(_0x3f663a,null))[_0xbfb2('0x25')](removeEntity(_0x3f663a,null))[_0xbfb2('0x47')](handleError(_0x3f663a,null));}; \ No newline at end of file +var _0x3b20=['moment','mustache','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','sort','filter','merge','VIRTUAL','where','VtigerField','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3a9d38,_0xe4726b){var _0x2a4c0f=function(_0x57b89e){while(--_0x57b89e){_0x3a9d38['push'](_0x3a9d38['shift']());}};_0x2a4c0f(++_0xe4726b);}(_0x3b20,0x1de));var _0x03b2=function(_0xf6182f,_0x1501a7){_0xf6182f=_0xf6182f-0x0;var _0x3ec48c=_0x3b20[_0xf6182f];return _0x3ec48c;};'use strict';var emlformat=require(_0x03b2('0x0'));var rimraf=require(_0x03b2('0x1'));var zipdir=require(_0x03b2('0x2'));var jsonpatch=require(_0x03b2('0x3'));var rp=require(_0x03b2('0x4'));var moment=require(_0x03b2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x03b2('0x6'));var util=require(_0x03b2('0x7'));var path=require(_0x03b2('0x8'));var sox=require(_0x03b2('0x9'));var csv=require('to-csv');var ejs=require(_0x03b2('0xa'));var fs=require('fs');var fs_extra=require(_0x03b2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x03b2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03b2('0xd'));var querystring=require(_0x03b2('0xe'));var Papa=require('papaparse');var Redis=require(_0x03b2('0xf'));var authService=require(_0x03b2('0x10'));var qs=require(_0x03b2('0x11'));var as=require(_0x03b2('0x12'));var hardwareService=require(_0x03b2('0x13'));var logger=require(_0x03b2('0x14'))('api');var utils=require(_0x03b2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x03b2('0x16'))['db'];function respondWithStatusCode(_0x1575e4,_0x3da62b){_0x3da62b=_0x3da62b||0xcc;return function(_0x2b2620){if(_0x2b2620){return _0x1575e4[_0x03b2('0x17')](_0x3da62b);}return _0x1575e4[_0x03b2('0x18')](_0x3da62b)[_0x03b2('0x19')]();};}function respondWithResult(_0x453940,_0x7424ab){_0x7424ab=_0x7424ab||0xc8;return function(_0x2161cc){if(_0x2161cc){return _0x453940['status'](_0x7424ab)[_0x03b2('0x1a')](_0x2161cc);}};}function respondWithFilteredResult(_0x524a69,_0x2c0efb){return function(_0x1c1fa9){if(_0x1c1fa9){var _0x29d42c=typeof _0x2c0efb[_0x03b2('0x1b')]===_0x03b2('0x1c')&&typeof _0x2c0efb[_0x03b2('0x1d')]===_0x03b2('0x1c');var _0x33e2b2=_0x1c1fa9[_0x03b2('0x1e')];var _0x2d9af4=_0x29d42c?0x0:_0x2c0efb[_0x03b2('0x1b')];var _0x4a4880=_0x29d42c?_0x1c1fa9[_0x03b2('0x1e')]:_0x2c0efb['offset']+_0x2c0efb[_0x03b2('0x1d')];var _0x2ecda0;if(_0x4a4880>=_0x33e2b2){_0x4a4880=_0x33e2b2;_0x2ecda0=0xc8;}else{_0x2ecda0=0xce;}_0x524a69['status'](_0x2ecda0);return _0x524a69[_0x03b2('0x1f')]('Content-Range',_0x2d9af4+'-'+_0x4a4880+'/'+_0x33e2b2)['json'](_0x1c1fa9);}return null;};}function patchUpdates(_0x2a258a){return function(_0xcb6752){try{jsonpatch[_0x03b2('0x20')](_0xcb6752,_0x2a258a,!![]);}catch(_0x52838a){return BPromise[_0x03b2('0x21')](_0x52838a);}return _0xcb6752['save']();};}function saveUpdates(_0x340b20,_0x3414b3){return function(_0x18ab2b){if(_0x18ab2b){return _0x18ab2b['update'](_0x340b20)[_0x03b2('0x22')](function(_0x487d5a){return _0x487d5a;});}return null;};}function removeEntity(_0x5e91dc,_0x2e06bf){return function(_0x1bd8d7){if(_0x1bd8d7){return _0x1bd8d7[_0x03b2('0x23')]()[_0x03b2('0x22')](function(){_0x5e91dc[_0x03b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x110f32,_0x5759eb){return function(_0x43e7d8){if(!_0x43e7d8){_0x110f32[_0x03b2('0x17')](0x194);}return _0x43e7d8;};}function handleError(_0x5df4b0,_0x1a093d){_0x1a093d=_0x1a093d||0x1f4;return function(_0x239270){logger[_0x03b2('0x24')](_0x239270[_0x03b2('0x25')]);if(_0x239270[_0x03b2('0x26')]){delete _0x239270[_0x03b2('0x26')];}_0x5df4b0[_0x03b2('0x18')](_0x1a093d)[_0x03b2('0x27')](_0x239270);};}exports['index']=function(_0x4bf726,_0x353eba){var _0x3d8fdc={},_0x293ff5={},_0x29b46d={'count':0x0,'rows':[]};var _0x497f70=_[_0x03b2('0x28')](db['VtigerField'][_0x03b2('0x29')],function(_0x1a76ca){return{'name':_0x1a76ca[_0x03b2('0x2a')],'type':_0x1a76ca[_0x03b2('0x2b')]['key']};});_0x293ff5[_0x03b2('0x2c')]=_['map'](_0x497f70,_0x03b2('0x26'));_0x293ff5[_0x03b2('0x2d')]=_['keys'](_0x4bf726[_0x03b2('0x2d')]);_0x293ff5[_0x03b2('0x2e')]=_[_0x03b2('0x2f')](_0x293ff5[_0x03b2('0x2c')],_0x293ff5['query']);_0x3d8fdc[_0x03b2('0x30')]=_['intersection'](_0x293ff5['model'],qs['fields'](_0x4bf726[_0x03b2('0x2d')][_0x03b2('0x31')]));_0x3d8fdc['attributes']=_0x3d8fdc[_0x03b2('0x30')][_0x03b2('0x32')]?_0x3d8fdc['attributes']:_0x293ff5[_0x03b2('0x2c')];if(!_0x4bf726['query']['hasOwnProperty']('nolimit')){_0x3d8fdc[_0x03b2('0x1d')]=qs[_0x03b2('0x1d')](_0x4bf726[_0x03b2('0x2d')][_0x03b2('0x1d')]);_0x3d8fdc[_0x03b2('0x1b')]=qs['offset'](_0x4bf726['query'][_0x03b2('0x1b')]);}_0x3d8fdc['order']=qs[_0x03b2('0x33')](_0x4bf726['query'][_0x03b2('0x33')]);_0x3d8fdc['where']=qs['filters'](_['pick'](_0x4bf726[_0x03b2('0x2d')],_0x293ff5[_0x03b2('0x2e')]),_0x497f70);if(_0x4bf726[_0x03b2('0x2d')][_0x03b2('0x34')]){_0x3d8fdc['where']=_[_0x03b2('0x35')](_0x3d8fdc['where'],{'$or':_[_0x03b2('0x28')](_0x497f70,function(_0x3a7730){if(_0x3a7730[_0x03b2('0x2b')]!==_0x03b2('0x36')){var _0x39f7fc={};_0x39f7fc[_0x3a7730['name']]={'$like':'%'+_0x4bf726['query']['filter']+'%'};return _0x39f7fc;}})});}_0x3d8fdc=_[_0x03b2('0x35')]({},_0x3d8fdc,_0x4bf726['options']);var _0x35aec5={'where':_0x3d8fdc[_0x03b2('0x37')]};return db[_0x03b2('0x38')][_0x03b2('0x1e')](_0x35aec5)[_0x03b2('0x22')](function(_0x259b54){_0x29b46d['count']=_0x259b54;if(_0x4bf726[_0x03b2('0x2d')]['includeAll']){_0x3d8fdc['include']=[{'all':!![]}];}return db['VtigerField'][_0x03b2('0x39')](_0x3d8fdc);})['then'](function(_0x1c2162){_0x29b46d[_0x03b2('0x3a')]=_0x1c2162;return _0x29b46d;})[_0x03b2('0x22')](respondWithFilteredResult(_0x353eba,_0x3d8fdc))[_0x03b2('0x3b')](handleError(_0x353eba,null));};exports[_0x03b2('0x3c')]=function(_0x310dbb,_0x23a958){var _0x4c1db0={'raw':!![],'where':{'id':_0x310dbb[_0x03b2('0x3d')]['id']}},_0x4bf2f9={};_0x4bf2f9[_0x03b2('0x2c')]=_['keys'](db[_0x03b2('0x38')][_0x03b2('0x29')]);_0x4bf2f9[_0x03b2('0x2d')]=_['keys'](_0x310dbb[_0x03b2('0x2d')]);_0x4bf2f9[_0x03b2('0x2e')]=_['intersection'](_0x4bf2f9[_0x03b2('0x2c')],_0x4bf2f9[_0x03b2('0x2d')]);_0x4c1db0[_0x03b2('0x30')]=_[_0x03b2('0x2f')](_0x4bf2f9[_0x03b2('0x2c')],qs[_0x03b2('0x31')](_0x310dbb['query'][_0x03b2('0x31')]));_0x4c1db0[_0x03b2('0x30')]=_0x4c1db0[_0x03b2('0x30')]['length']?_0x4c1db0[_0x03b2('0x30')]:_0x4bf2f9[_0x03b2('0x2c')];if(_0x310dbb[_0x03b2('0x2d')][_0x03b2('0x3e')]){_0x4c1db0[_0x03b2('0x3f')]=[{'all':!![]}];}_0x4c1db0=_[_0x03b2('0x35')]({},_0x4c1db0,_0x310dbb[_0x03b2('0x40')]);return db[_0x03b2('0x38')][_0x03b2('0x41')](_0x4c1db0)[_0x03b2('0x22')](handleEntityNotFound(_0x23a958,null))[_0x03b2('0x22')](respondWithResult(_0x23a958,null))['catch'](handleError(_0x23a958,null));};exports[_0x03b2('0x42')]=function(_0xfe4161,_0x127f83){return db['VtigerField'][_0x03b2('0x42')](_0xfe4161[_0x03b2('0x43')],{})[_0x03b2('0x22')](respondWithResult(_0x127f83,0xc9))[_0x03b2('0x3b')](handleError(_0x127f83,null));};exports[_0x03b2('0x44')]=function(_0x28dc61,_0x21b16c){if(_0x28dc61[_0x03b2('0x43')]['id']){delete _0x28dc61[_0x03b2('0x43')]['id'];}return db['VtigerField'][_0x03b2('0x41')]({'where':{'id':_0x28dc61[_0x03b2('0x3d')]['id']}})[_0x03b2('0x22')](handleEntityNotFound(_0x21b16c,null))[_0x03b2('0x22')](saveUpdates(_0x28dc61['body'],null))[_0x03b2('0x22')](respondWithResult(_0x21b16c,null))[_0x03b2('0x3b')](handleError(_0x21b16c,null));};exports['destroy']=function(_0x41caa8,_0x58eed4){return db[_0x03b2('0x38')][_0x03b2('0x41')]({'where':{'id':_0x41caa8[_0x03b2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x58eed4,null))[_0x03b2('0x22')](removeEntity(_0x58eed4,null))[_0x03b2('0x3b')](handleError(_0x58eed4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e2980f9..85e38eb 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 _0x8689=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x3bbb2c,_0x184320){var _0x59211d=function(_0x2eb2f5){while(--_0x2eb2f5){_0x3bbb2c['push'](_0x3bbb2c['shift']());}};_0x59211d(++_0x184320);}(_0x8689,0x143));var _0x9868=function(_0x307f62,_0x59bc89){_0x307f62=_0x307f62-0x0;var _0x547caf=_0x8689[_0x307f62];return _0x547caf;};'use strict';var _=require(_0x9868('0x0'));var util=require(_0x9868('0x1'));var logger=require(_0x9868('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9868('0x3'));var fs=require('fs');var path=require(_0x9868('0x4'));var rimraf=require(_0x9868('0x5'));var config=require(_0x9868('0x6'));var attributes=require(_0x9868('0x7'));module[_0x9868('0x8')]=function(_0x1256b7,_0xba4be5){return _0x1256b7[_0x9868('0x9')](_0x9868('0xa'),attributes,{'tableName':_0x9868('0xb'),'paranoid':![],'indexes':[{'name':_0x9868('0xc'),'fields':[_0x9868('0xd'),_0x9868('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0bc3=['vtiger_unique_index','FieldId','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x0bc3,0x13a));var _0x30bc=function(_0xf6b79b,_0x988e7e){_0xf6b79b=_0xf6b79b-0x0;var _0x40f212=_0x0bc3[_0xf6b79b];return _0x40f212;};'use strict';var _=require(_0x30bc('0x0'));var util=require(_0x30bc('0x1'));var logger=require(_0x30bc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x30bc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30bc('0x4'));var config=require(_0x30bc('0x5'));var attributes=require(_0x30bc('0x6'));module['exports']=function(_0xc9ea87,_0x199bf9){return _0xc9ea87[_0x30bc('0x7')](_0x30bc('0x8'),attributes,{'tableName':_0x30bc('0x9'),'paranoid':![],'indexes':[{'name':_0x30bc('0xa'),'fields':['idField',_0x30bc('0xb')],'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 74f1b94..4e373dc 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 _0xdd3f=['debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x5c5502,_0x47cf47){var _0x359546=function(_0x5b0561){while(--_0x5b0561){_0x5c5502['push'](_0x5c5502['shift']());}};_0x359546(++_0x47cf47);}(_0xdd3f,0xdf));var _0xfdd3=function(_0x156972,_0x5e6bc9){_0x156972=_0x156972-0x0;var _0x5e6b56=_0xdd3f[_0x156972];return _0x5e6b56;};'use strict';var _=require(_0xfdd3('0x0'));var util=require(_0xfdd3('0x1'));var moment=require(_0xfdd3('0x2'));var BPromise=require(_0xfdd3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdd3('0x4'));var db=require(_0xfdd3('0x5'))['db'];var utils=require(_0xfdd3('0x6'));var logger=require(_0xfdd3('0x7'))(_0xfdd3('0x8'));var config=require(_0xfdd3('0x9'));var jayson=require(_0xfdd3('0xa'));var client=jayson[_0xfdd3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dba59,_0x1c4b1b,_0x4e8ca6){return new BPromise(function(_0x3ed2d8,_0x332d6a){return client[_0xfdd3('0xc')](_0x4dba59,_0x4e8ca6)[_0xfdd3('0xd')](function(_0x544eb5){logger[_0xfdd3('0xe')](_0xfdd3('0xf'),_0x1c4b1b,_0xfdd3('0x10'));logger[_0xfdd3('0x11')](_0xfdd3('0x12'),_0x1c4b1b,'request\x20sent',JSON['stringify'](_0x544eb5));if(_0x544eb5[_0xfdd3('0x13')]){if(_0x544eb5['error'][_0xfdd3('0x14')]===0x1f4){logger[_0xfdd3('0x13')](_0xfdd3('0xf'),_0x1c4b1b,_0x544eb5[_0xfdd3('0x13')][_0xfdd3('0x15')]);return _0x332d6a(_0x544eb5[_0xfdd3('0x13')]['message']);}logger[_0xfdd3('0x13')]('VtigerField,\x20%s,\x20%s',_0x1c4b1b,_0x544eb5[_0xfdd3('0x13')]['message']);return _0x3ed2d8(_0x544eb5[_0xfdd3('0x13')]['message']);}else{logger['info'](_0xfdd3('0xf'),_0x1c4b1b,_0xfdd3('0x10'));_0x3ed2d8(_0x544eb5[_0xfdd3('0x16')][_0xfdd3('0x15')]);}})[_0xfdd3('0x17')](function(_0x32bcce){logger['error']('VtigerField,\x20%s,\x20%s',_0x1c4b1b,_0x32bcce);_0x332d6a(_0x32bcce);});});} \ No newline at end of file +var _0xd923=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x345ac8,_0x2daa49){var _0x552f86=function(_0x2210b8){while(--_0x2210b8){_0x345ac8['push'](_0x345ac8['shift']());}};_0x552f86(++_0x2daa49);}(_0xd923,0x16d));var _0x3d92=function(_0x595403,_0x362229){_0x595403=_0x595403-0x0;var _0x51b535=_0xd923[_0x595403];return _0x51b535;};'use strict';var _=require(_0x3d92('0x0'));var util=require(_0x3d92('0x1'));var moment=require(_0x3d92('0x2'));var BPromise=require(_0x3d92('0x3'));var rs=require(_0x3d92('0x4'));var fs=require('fs');var Redis=require(_0x3d92('0x5'));var db=require(_0x3d92('0x6'))['db'];var utils=require(_0x3d92('0x7'));var logger=require(_0x3d92('0x8'))(_0x3d92('0x9'));var config=require(_0x3d92('0xa'));var jayson=require(_0x3d92('0xb'));var client=jayson[_0x3d92('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6ee3dd,_0x286733,_0x535d78){return new BPromise(function(_0xefad32,_0x5dfa31){return client[_0x3d92('0xd')](_0x6ee3dd,_0x535d78)[_0x3d92('0xe')](function(_0xb60091){logger[_0x3d92('0xf')](_0x3d92('0x10'),_0x286733,_0x3d92('0x11'));logger['debug'](_0x3d92('0x12'),_0x286733,_0x3d92('0x11'),JSON[_0x3d92('0x13')](_0xb60091));if(_0xb60091[_0x3d92('0x14')]){if(_0xb60091[_0x3d92('0x14')]['code']===0x1f4){logger[_0x3d92('0x14')](_0x3d92('0x10'),_0x286733,_0xb60091['error'][_0x3d92('0x15')]);return _0x5dfa31(_0xb60091[_0x3d92('0x14')][_0x3d92('0x15')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x286733,_0xb60091[_0x3d92('0x14')][_0x3d92('0x15')]);return _0xefad32(_0xb60091['error']['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x286733,_0x3d92('0x11'));_0xefad32(_0xb60091[_0x3d92('0x16')][_0x3d92('0x15')]);}})['catch'](function(_0x2a073b){logger[_0x3d92('0x14')](_0x3d92('0x10'),_0x286733,_0x2a073b);_0x5dfa31(_0x2a073b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index b9c91b1..593ed52 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 _0x5965=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5965,0x8d));var _0x5596=function(_0x57da49,_0x4c705b){_0x57da49=_0x57da49-0x0;var _0x3c5fef=_0x5965[_0x57da49];return _0x3c5fef;};'use strict';var multer=require(_0x5596('0x0'));var util=require('util');var path=require(_0x5596('0x1'));var timeout=require(_0x5596('0x2'));var express=require(_0x5596('0x3'));var router=express[_0x5596('0x4')]();var fs_extra=require(_0x5596('0x5'));var auth=require(_0x5596('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5596('0x7'));var controller=require(_0x5596('0x8'));router[_0x5596('0x9')]('/',auth[_0x5596('0xa')](),controller['index']);router[_0x5596('0x9')]('/:id',auth[_0x5596('0xa')](),controller['show']);router[_0x5596('0x9')](_0x5596('0xb'),auth[_0x5596('0xa')](),controller[_0x5596('0xc')]);router['get'](_0x5596('0xd'),auth[_0x5596('0xa')](),controller[_0x5596('0xe')]);router[_0x5596('0xf')]('/',auth[_0x5596('0xa')](),controller[_0x5596('0x10')]);router['post'](_0x5596('0xb'),auth[_0x5596('0xa')](),controller[_0x5596('0x11')]);router[_0x5596('0x12')]('/:id',auth[_0x5596('0xa')](),controller[_0x5596('0x13')]);router[_0x5596('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5596('0x15')]);module[_0x5596('0x16')]=router; \ No newline at end of file +var _0x204b=['addConfiguration','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','post','create'];(function(_0x115c17,_0x12dfc8){var _0x2d914f=function(_0xece36c){while(--_0xece36c){_0x115c17['push'](_0x115c17['shift']());}};_0x2d914f(++_0x12dfc8);}(_0x204b,0x12c));var _0xb204=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x204b[_0x279d37];return _0x530173;};'use strict';var multer=require(_0xb204('0x0'));var util=require(_0xb204('0x1'));var path=require(_0xb204('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb204('0x3')]();var fs_extra=require(_0xb204('0x4'));var auth=require(_0xb204('0x5'));var interaction=require(_0xb204('0x6'));var config=require(_0xb204('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xb204('0x8')]('/',auth['isAuthenticated'](),controller[_0xb204('0x9')]);router[_0xb204('0x8')]('/:id',auth[_0xb204('0xa')](),controller[_0xb204('0xb')]);router[_0xb204('0x8')](_0xb204('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb204('0x8')]('/:id/fields',auth[_0xb204('0xa')](),controller['getFields']);router[_0xb204('0xd')]('/',auth[_0xb204('0xa')](),controller[_0xb204('0xe')]);router[_0xb204('0xd')](_0xb204('0xc'),auth[_0xb204('0xa')](),controller[_0xb204('0xf')]);router[_0xb204('0x10')](_0xb204('0x11'),auth['isAuthenticated'](),controller[_0xb204('0x12')]);router[_0xb204('0x13')]('/:id',auth[_0xb204('0xa')](),controller['destroy']);module[_0xb204('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 361492b..7d0d91c 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 _0x5bc1=['remoteUri','ENUM','password','integrationTab','newTab','exports','STRING','username'];(function(_0x581543,_0x5d08cf){var _0x2845f5=function(_0x59aec4){while(--_0x59aec4){_0x581543['push'](_0x581543['shift']());}};_0x2845f5(++_0x5d08cf);}(_0x5bc1,0xb5));var _0x15bc=function(_0x4ae506,_0x5a97ed){_0x4ae506=_0x4ae506-0x0;var _0x18e3a1=_0x5bc1[_0x4ae506];return _0x18e3a1;};'use strict';var Sequelize=require('sequelize');module[_0x15bc('0x0')]={'name':{'type':Sequelize[_0x15bc('0x1')]},'description':{'type':Sequelize[_0x15bc('0x1')]},'username':{'type':Sequelize[_0x15bc('0x1')],'unique':_0x15bc('0x2')},'password':{'type':Sequelize[_0x15bc('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x15bc('0x3')},'authType':{'type':Sequelize[_0x15bc('0x4')](_0x15bc('0x5'),'token'),'defaultValue':_0x15bc('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x15bc('0x4')](_0x15bc('0x6'),_0x15bc('0x7')),'defaultValue':_0x15bc('0x6')}}; \ No newline at end of file +var _0x8daf=['remoteUri','ENUM','password','token','newTab','STRING','username'];(function(_0x44c822,_0x20b440){var _0x342429=function(_0x4d2f9b){while(--_0x4d2f9b){_0x44c822['push'](_0x44c822['shift']());}};_0x342429(++_0x20b440);}(_0x8daf,0x15c));var _0xf8da=function(_0x203271,_0x542139){_0x203271=_0x203271-0x0;var _0x37b0dd=_0x8daf[_0x203271];return _0x37b0dd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8da('0x0')],'unique':_0xf8da('0x1')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf8da('0x0')]},'remoteUri':{'type':Sequelize[_0xf8da('0x0')],'unique':_0xf8da('0x2')},'authType':{'type':Sequelize[_0xf8da('0x3')](_0xf8da('0x4'),_0xf8da('0x5')),'defaultValue':_0xf8da('0x4')},'serverUrl':{'type':Sequelize[_0xf8da('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xf8da('0x3')]('integrationTab',_0xf8da('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3ce50a4..d4155f6 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 _0x757a=['rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','name','ZendeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getConfigurations','findOne','ZendeskConfiguration','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x3d6b5b,_0x163153){var _0x3f8935=function(_0x2e29ef){while(--_0x2e29ef){_0x3d6b5b['push'](_0x3d6b5b['shift']());}};_0x3f8935(++_0x163153);}(_0x757a,0xde));var _0xa757=function(_0x32ea53,_0x5ce025){_0x32ea53=_0x32ea53-0x0;var _0x31565d=_0x757a[_0x32ea53];return _0x31565d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x421040,_0x544b45){_0x544b45=_0x544b45||0xcc;return function(_0x564187){if(_0x564187){return _0x421040[_0xa757('0x15')](_0x544b45);}return _0x421040['status'](_0x544b45)['end']();};}function respondWithResult(_0x32112b,_0x1b670e){_0x1b670e=_0x1b670e||0xc8;return function(_0x355f0a){if(_0x355f0a){return _0x32112b[_0xa757('0x16')](_0x1b670e)[_0xa757('0x17')](_0x355f0a);}};}function respondWithFilteredResult(_0x31cfd2,_0xf12b68){return function(_0x2f7947){if(_0x2f7947){var _0x185011=typeof _0xf12b68[_0xa757('0x18')]==='undefined'&&typeof _0xf12b68[_0xa757('0x19')]===_0xa757('0x1a');var _0xde8248=_0x2f7947['count'];var _0x54b305=_0x185011?0x0:_0xf12b68[_0xa757('0x18')];var _0x468d45=_0x185011?_0x2f7947[_0xa757('0x1b')]:_0xf12b68[_0xa757('0x18')]+_0xf12b68[_0xa757('0x19')];var _0xe2d567;if(_0x468d45>=_0xde8248){_0x468d45=_0xde8248;_0xe2d567=0xc8;}else{_0xe2d567=0xce;}_0x31cfd2['status'](_0xe2d567);return _0x31cfd2[_0xa757('0x1c')]('Content-Range',_0x54b305+'-'+_0x468d45+'/'+_0xde8248)[_0xa757('0x17')](_0x2f7947);}return null;};}function patchUpdates(_0x167640){return function(_0x14014c){try{jsonpatch[_0xa757('0x1d')](_0x14014c,_0x167640,!![]);}catch(_0x4d598c){return BPromise['reject'](_0x4d598c);}return _0x14014c[_0xa757('0x1e')]();};}function saveUpdates(_0x2159cf,_0x2ba923){return function(_0x8d121f){if(_0x8d121f){return _0x8d121f[_0xa757('0x1f')](_0x2159cf)[_0xa757('0x20')](function(_0x2ca10d){return _0x2ca10d;});}return null;};}function removeEntity(_0x21f1af,_0x2bf276){return function(_0x59fae6){if(_0x59fae6){return _0x59fae6[_0xa757('0x21')]()['then'](function(){_0x21f1af[_0xa757('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40551d,_0x3859ce){return function(_0x37c7e6){if(!_0x37c7e6){_0x40551d['sendStatus'](0x194);}return _0x37c7e6;};}function handleError(_0x2b19d5,_0xcd98bd){_0xcd98bd=_0xcd98bd||0x1f4;return function(_0x471e84){logger[_0xa757('0x22')](_0x471e84['stack']);if(_0x471e84[_0xa757('0x23')]){delete _0x471e84['name'];}_0x2b19d5['status'](_0xcd98bd)['send'](_0x471e84);};}exports['index']=function(_0xfdf69d,_0x596ae2){var _0x2208f9={},_0x3bc24c={},_0x55c5f8={'count':0x0,'rows':[]};var _0x2a0c9a=_['map'](db[_0xa757('0x24')][_0xa757('0x25')],function(_0x5307c3){return{'name':_0x5307c3[_0xa757('0x26')],'type':_0x5307c3['type'][_0xa757('0x27')]};});_0x3bc24c[_0xa757('0x28')]=_[_0xa757('0x29')](_0x2a0c9a,_0xa757('0x23'));_0x3bc24c[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0xfdf69d[_0xa757('0x2a')]);_0x3bc24c[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],_0x3bc24c[_0xa757('0x2a')]);_0x2208f9[_0xa757('0x2e')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],qs[_0xa757('0x2f')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x2f')]));_0x2208f9[_0xa757('0x2e')]=_0x2208f9[_0xa757('0x2e')][_0xa757('0x30')]?_0x2208f9[_0xa757('0x2e')]:_0x3bc24c[_0xa757('0x28')];if(!_0xfdf69d[_0xa757('0x2a')][_0xa757('0x31')]('nolimit')){_0x2208f9[_0xa757('0x19')]=qs[_0xa757('0x19')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x19')]);_0x2208f9[_0xa757('0x18')]=qs['offset'](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x18')]);}_0x2208f9[_0xa757('0x32')]=qs[_0xa757('0x33')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x33')]);_0x2208f9['where']=qs[_0xa757('0x2c')](_[_0xa757('0x34')](_0xfdf69d[_0xa757('0x2a')],_0x3bc24c[_0xa757('0x2c')]),_0x2a0c9a);if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x35')]){_0x2208f9[_0xa757('0x36')]=_[_0xa757('0x37')](_0x2208f9[_0xa757('0x36')],{'$or':_['map'](_0x2a0c9a,function(_0x300be4){if(_0x300be4[_0xa757('0x38')]!==_0xa757('0x39')){var _0x35c15a={};_0x35c15a[_0x300be4[_0xa757('0x23')]]={'$like':'%'+_0xfdf69d[_0xa757('0x2a')]['filter']+'%'};return _0x35c15a;}})});}_0x2208f9=_[_0xa757('0x37')]({},_0x2208f9,_0xfdf69d[_0xa757('0x3a')]);var _0x48cde9={'where':_0x2208f9['where']};return db[_0xa757('0x24')][_0xa757('0x1b')](_0x48cde9)['then'](function(_0x51c3d1){_0x55c5f8[_0xa757('0x1b')]=_0x51c3d1;if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x3b')]){_0x2208f9['include']=[{'all':!![]}];}return db[_0xa757('0x24')][_0xa757('0x3c')](_0x2208f9);})[_0xa757('0x20')](function(_0x1ba399){_0x55c5f8[_0xa757('0x3d')]=_0x1ba399;return _0x55c5f8;})['then'](respondWithFilteredResult(_0x596ae2,_0x2208f9))[_0xa757('0x3e')](handleError(_0x596ae2,null));};exports['show']=function(_0x564d40,_0x43329c){var _0x57298b={'raw':![],'where':{'id':_0x564d40[_0xa757('0x3f')]['id']}},_0x373747={};_0x373747[_0xa757('0x28')]=_['keys'](db['ZendeskAccount'][_0xa757('0x25')]);_0x373747[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x564d40[_0xa757('0x2a')]);_0x373747[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x373747['model'],_0x373747[_0xa757('0x2a')]);_0x57298b[_0xa757('0x2e')]=_['intersection'](_0x373747[_0xa757('0x28')],qs['fields'](_0x564d40[_0xa757('0x2a')][_0xa757('0x2f')]));_0x57298b['attributes']=_0x57298b[_0xa757('0x2e')][_0xa757('0x30')]?_0x57298b['attributes']:_0x373747[_0xa757('0x28')];if(_0x564d40[_0xa757('0x2a')][_0xa757('0x3b')]){_0x57298b[_0xa757('0x40')]=[{'all':!![]}];}_0x57298b=_['merge']({},_0x57298b,_0x564d40[_0xa757('0x3a')]);return db[_0xa757('0x24')][_0xa757('0x41')](_0x57298b)[_0xa757('0x20')](handleEntityNotFound(_0x43329c,null))['then'](respondWithResult(_0x43329c,null))[_0xa757('0x3e')](handleError(_0x43329c,null));};exports['create']=function(_0x50c131,_0x2acf88){return db[_0xa757('0x24')][_0xa757('0x42')](_0x50c131['body'],{})[_0xa757('0x20')](respondWithResult(_0x2acf88,0xc9))['catch'](handleError(_0x2acf88,null));};exports[_0xa757('0x1f')]=function(_0x151cc3,_0x265793){if(_0x151cc3[_0xa757('0x43')]['id']){delete _0x151cc3[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x151cc3[_0xa757('0x3f')]['id']}})['then'](handleEntityNotFound(_0x265793,null))[_0xa757('0x20')](saveUpdates(_0x151cc3[_0xa757('0x43')],null))[_0xa757('0x20')](respondWithResult(_0x265793,null))[_0xa757('0x3e')](handleError(_0x265793,null));};exports[_0xa757('0x21')]=function(_0x1f10cf,_0x15bad7){return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x1f10cf[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x15bad7,null))[_0xa757('0x20')](removeEntity(_0x15bad7,null))[_0xa757('0x3e')](handleError(_0x15bad7,null));};exports[_0xa757('0x44')]=function(_0x388573,_0x23caca,_0x492e7e){var _0x3b5116={};var _0x51157e={};var _0x48af6e;var _0x311c25;return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x388573['params']['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x23caca,null))[_0xa757('0x20')](function(_0x8614f9){if(_0x8614f9){_0x48af6e=_0x8614f9;_0x51157e[_0xa757('0x28')]=_['keys'](db[_0xa757('0x46')][_0xa757('0x25')]);_0x51157e[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x388573[_0xa757('0x2a')]);_0x51157e[_0xa757('0x2c')]=_['intersection'](_0x51157e['model'],_0x51157e['query']);_0x3b5116['attributes']=_[_0xa757('0x2d')](_0x51157e[_0xa757('0x28')],qs[_0xa757('0x2f')](_0x388573[_0xa757('0x2a')][_0xa757('0x2f')]));_0x3b5116[_0xa757('0x2e')]=_0x3b5116['attributes'][_0xa757('0x30')]?_0x3b5116[_0xa757('0x2e')]:_0x51157e[_0xa757('0x28')];_0x3b5116[_0xa757('0x32')]=qs['sort'](_0x388573[_0xa757('0x2a')][_0xa757('0x33')]);_0x3b5116['where']=qs[_0xa757('0x2c')](_['pick'](_0x388573[_0xa757('0x2a')],_0x51157e['filters']));if(_0x388573[_0xa757('0x2a')]['filter']){_0x3b5116['where']=_[_0xa757('0x37')](_0x3b5116[_0xa757('0x36')],{'$or':_[_0xa757('0x29')](_0x3b5116[_0xa757('0x2e')],function(_0x14e226){var _0xc5ae37={};_0xc5ae37[_0x14e226]={'$like':'%'+_0x388573['query']['filter']+'%'};return _0xc5ae37;})});}_0x3b5116=_[_0xa757('0x37')]({},_0x3b5116,_0x388573[_0xa757('0x3a')]);return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})['then'](function(_0x55a7d2){if(_0x55a7d2){_0x311c25=_0x55a7d2[_0xa757('0x30')];if(!_0x388573[_0xa757('0x2a')][_0xa757('0x31')](_0xa757('0x47'))){_0x3b5116[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x388573['query'][_0xa757('0x19')]);_0x3b5116[_0xa757('0x18')]=qs[_0xa757('0x18')](_0x388573[_0xa757('0x2a')][_0xa757('0x18')]);}return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})[_0xa757('0x20')](function(_0x13dd81){if(_0x13dd81){return _0x13dd81?{'count':_0x311c25,'rows':_0x13dd81}:null;}})[_0xa757('0x20')](respondWithResult(_0x23caca,null))[_0xa757('0x3e')](handleError(_0x23caca,null));};exports['addConfiguration']=function(_0x9e96e6,_0x5c803a,_0x5851fd){if(_0x9e96e6[_0xa757('0x43')]['id']){delete _0x9e96e6[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x9e96e6[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x5c803a,null))[_0xa757('0x20')](function(_0x32e0b9){if(_0x32e0b9){_0x9e96e6[_0xa757('0x43')][_0xa757('0x48')]=_0x32e0b9['id'];_0x9e96e6[_0xa757('0x43')]['Subjects']=integrations[_0xa757('0x49')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')][_0xa757('0x38')]);_0x9e96e6[_0xa757('0x43')][_0xa757('0x4a')]=integrations[_0xa757('0x4b')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')]['type']);return db[_0xa757('0x46')][_0xa757('0x42')](_0x9e96e6[_0xa757('0x43')],{'include':[{'model':db[_0xa757('0x4c')],'as':_0xa757('0x4d')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xa757('0x20')](respondWithResult(_0x5c803a,null))[_0xa757('0x3e')](handleError(_0x5c803a,null));};exports[_0xa757('0x4e')]=function(_0x5f450f,_0x115a94,_0x55bc0f){var _0x34982a='';return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x5f450f[_0xa757('0x3f')]['id']},'attributes':['id',_0xa757('0x4f'),_0xa757('0x50'),'token',_0xa757('0x51'),_0xa757('0x52')]})[_0xa757('0x20')](handleEntityNotFound(_0x115a94,null))[_0xa757('0x20')](function(_0x1c35bc){if(_0x1c35bc){_0x34982a=_0x1c35bc['remoteUri'];var _0x2586f9=_0x34982a[_0xa757('0x53')](-0x1);if(_0x2586f9==='/'){_0x34982a=_0x34982a[_0xa757('0x54')](0x0,_0x34982a[_0xa757('0x55')](_0x2586f9));}var _0x43cc0a={'method':'GET','uri':util[_0xa757('0x56')](_0xa757('0x57'),_0x34982a,_0xa757('0x58')),'json':!![]};switch(_0x1c35bc['authType']){case _0xa757('0x50'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util[_0xa757('0x56')](_0xa757('0x5b'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc[_0xa757('0x50')]))[_0xa757('0x5c')](_0xa757('0x5d')))};break;case _0xa757('0x5e'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util['format'](_0xa757('0x5f'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc['token']))[_0xa757('0x5c')](_0xa757('0x5d')))};break;default:throw new db['Sequelize'][(_0xa757('0x60'))](_0xa757('0x61'));}return rp(_0x43cc0a);}})[_0xa757('0x20')](function(_0x2e1198){if(_0x2e1198){var _0x3a00ef=[_0xa757('0x62'),_0xa757('0x63'),_0xa757('0x64'),_0xa757('0x65')];_[_0xa757('0x66')](_0x2e1198[_0xa757('0x58')],function(_0x189195){return _0x3a00ef[_0xa757('0x67')](_0x189195[_0xa757('0x38')]);});return{'count':_0x2e1198[_0xa757('0x58')][_0xa757('0x30')],'rows':_['map'](_0x2e1198[_0xa757('0x58')],function(_0x56ba75){return{'id':_0x56ba75['id'],'name':_0x56ba75[_0xa757('0x68')]>0x7?_0x56ba75[_0xa757('0x69')]:_0x56ba75[_0xa757('0x38')],'custom':_0x56ba75[_0xa757('0x68')]>0x7?!![]:![],'options':_0x56ba75[_0xa757('0x6a')]?_0x56ba75['system_field_options']:_0x56ba75[_0xa757('0x6b')]?_0x56ba75[_0xa757('0x6b')]:[]};})};}})[_0xa757('0x20')](respondWithResult(_0x115a94,null))['catch'](function(_0x3317d8){var _0x3619ec=_0x5f450f[_0xa757('0x2a')]['test']?0x1f4:_0x3317d8['statusCode']||0x1f4;logger[_0xa757('0x22')](_0xa757('0x6c'),_0xa757('0x4e'),_0x3619ec,JSON['stringify'](_0x3317d8));delete _0x3317d8[_0xa757('0x23')];if(_0x3619ec===0x191){_0x3619ec=0x190;}_0x115a94['status'](_0x3619ec)['send'](_0x5f450f[_0xa757('0x2a')][_0xa757('0x6d')]?{'message':_0xa757('0x6e'),'statusCode':_0x3317d8['statusCode']}:_0x3317d8);});}; \ No newline at end of file +var _0xf290=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','sendStatus','send','ZendeskAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','count','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','create','body','find','getConfigurations','findOne','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','username','authType','remoteUri','lastIndexOf','%s/%s','password','headers','format','%s:%s','toString','token','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','ticket_fields','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv'];(function(_0x1c0aea,_0x17778a){var _0x53cf3e=function(_0x24fb0b){while(--_0x24fb0b){_0x1c0aea['push'](_0x1c0aea['shift']());}};_0x53cf3e(++_0x17778a);}(_0xf290,0xde));var _0x0f29=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xf290[_0x247fa1];return _0x244f35;};'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'];var integrations=require(_0x0f29('0x19'));function respondWithStatusCode(_0x222c42,_0x195424){_0x195424=_0x195424||0xcc;return function(_0x2d2573){if(_0x2d2573){return _0x222c42['sendStatus'](_0x195424);}return _0x222c42[_0x0f29('0x1a')](_0x195424)[_0x0f29('0x1b')]();};}function respondWithResult(_0x2bb7b8,_0x368984){_0x368984=_0x368984||0xc8;return function(_0x234856){if(_0x234856){return _0x2bb7b8[_0x0f29('0x1a')](_0x368984)[_0x0f29('0x1c')](_0x234856);}};}function respondWithFilteredResult(_0x69df36,_0x547404){return function(_0x4ac37d){if(_0x4ac37d){var _0x2be27f=typeof _0x547404[_0x0f29('0x1d')]===_0x0f29('0x1e')&&typeof _0x547404[_0x0f29('0x1f')]==='undefined';var _0x122bfa=_0x4ac37d['count'];var _0x17b994=_0x2be27f?0x0:_0x547404['offset'];var _0x5ddc74=_0x2be27f?_0x4ac37d['count']:_0x547404[_0x0f29('0x1d')]+_0x547404[_0x0f29('0x1f')];var _0x13e8ff;if(_0x5ddc74>=_0x122bfa){_0x5ddc74=_0x122bfa;_0x13e8ff=0xc8;}else{_0x13e8ff=0xce;}_0x69df36[_0x0f29('0x1a')](_0x13e8ff);return _0x69df36[_0x0f29('0x20')](_0x0f29('0x21'),_0x17b994+'-'+_0x5ddc74+'/'+_0x122bfa)[_0x0f29('0x1c')](_0x4ac37d);}return null;};}function patchUpdates(_0x4888b6){return function(_0x49d954){try{jsonpatch['apply'](_0x49d954,_0x4888b6,!![]);}catch(_0x5ab592){return BPromise['reject'](_0x5ab592);}return _0x49d954['save']();};}function saveUpdates(_0x38a1ce,_0x4a9dd8){return function(_0x563d15){if(_0x563d15){return _0x563d15[_0x0f29('0x22')](_0x38a1ce)[_0x0f29('0x23')](function(_0x346db8){return _0x346db8;});}return null;};}function removeEntity(_0x3402dc,_0x29ca73){return function(_0x568ad9){if(_0x568ad9){return _0x568ad9[_0x0f29('0x24')]()['then'](function(){_0x3402dc[_0x0f29('0x1a')](0xcc)[_0x0f29('0x1b')]();});}};}function handleEntityNotFound(_0x23c09e,_0x28cfaa){return function(_0x57667b){if(!_0x57667b){_0x23c09e[_0x0f29('0x25')](0x194);}return _0x57667b;};}function handleError(_0x540d72,_0x58b201){_0x58b201=_0x58b201||0x1f4;return function(_0x92876){logger['error'](_0x92876['stack']);if(_0x92876['name']){delete _0x92876['name'];}_0x540d72[_0x0f29('0x1a')](_0x58b201)[_0x0f29('0x26')](_0x92876);};}exports['index']=function(_0x1fc4fd,_0x2ab528){var _0x274c9d={},_0x51e7dc={},_0x56e729={'count':0x0,'rows':[]};var _0x37ebcc=_['map'](db[_0x0f29('0x27')]['rawAttributes'],function(_0x526364){return{'name':_0x526364[_0x0f29('0x28')],'type':_0x526364[_0x0f29('0x29')][_0x0f29('0x2a')]};});_0x51e7dc[_0x0f29('0x2b')]=_['map'](_0x37ebcc,'name');_0x51e7dc[_0x0f29('0x2c')]=_['keys'](_0x1fc4fd['query']);_0x51e7dc[_0x0f29('0x2d')]=_['intersection'](_0x51e7dc[_0x0f29('0x2b')],_0x51e7dc['query']);_0x274c9d['attributes']=_[_0x0f29('0x2e')](_0x51e7dc[_0x0f29('0x2b')],qs[_0x0f29('0x2f')](_0x1fc4fd[_0x0f29('0x2c')][_0x0f29('0x2f')]));_0x274c9d['attributes']=_0x274c9d[_0x0f29('0x30')]['length']?_0x274c9d[_0x0f29('0x30')]:_0x51e7dc[_0x0f29('0x2b')];if(!_0x1fc4fd[_0x0f29('0x2c')][_0x0f29('0x31')]('nolimit')){_0x274c9d[_0x0f29('0x1f')]=qs[_0x0f29('0x1f')](_0x1fc4fd['query'][_0x0f29('0x1f')]);_0x274c9d[_0x0f29('0x1d')]=qs['offset'](_0x1fc4fd['query'][_0x0f29('0x1d')]);}_0x274c9d[_0x0f29('0x32')]=qs[_0x0f29('0x33')](_0x1fc4fd[_0x0f29('0x2c')][_0x0f29('0x33')]);_0x274c9d[_0x0f29('0x34')]=qs['filters'](_[_0x0f29('0x35')](_0x1fc4fd['query'],_0x51e7dc[_0x0f29('0x2d')]),_0x37ebcc);if(_0x1fc4fd['query'][_0x0f29('0x36')]){_0x274c9d[_0x0f29('0x34')]=_[_0x0f29('0x37')](_0x274c9d['where'],{'$or':_['map'](_0x37ebcc,function(_0x16a9eb){if(_0x16a9eb['type']!==_0x0f29('0x38')){var _0x3f49f8={};_0x3f49f8[_0x16a9eb[_0x0f29('0x39')]]={'$like':'%'+_0x1fc4fd[_0x0f29('0x2c')][_0x0f29('0x36')]+'%'};return _0x3f49f8;}})});}_0x274c9d=_['merge']({},_0x274c9d,_0x1fc4fd[_0x0f29('0x3a')]);var _0xf77c66={'where':_0x274c9d[_0x0f29('0x34')]};return db[_0x0f29('0x27')][_0x0f29('0x3b')](_0xf77c66)[_0x0f29('0x23')](function(_0xac4fb2){_0x56e729[_0x0f29('0x3b')]=_0xac4fb2;if(_0x1fc4fd[_0x0f29('0x2c')]['includeAll']){_0x274c9d[_0x0f29('0x3c')]=[{'all':!![]}];}return db[_0x0f29('0x27')][_0x0f29('0x3d')](_0x274c9d);})[_0x0f29('0x23')](function(_0x504908){_0x56e729[_0x0f29('0x3e')]=_0x504908;return _0x56e729;})[_0x0f29('0x23')](respondWithFilteredResult(_0x2ab528,_0x274c9d))[_0x0f29('0x3f')](handleError(_0x2ab528,null));};exports[_0x0f29('0x40')]=function(_0x185493,_0x56062d){var _0x410c59={'raw':![],'where':{'id':_0x185493[_0x0f29('0x41')]['id']}},_0x245bf9={};_0x245bf9['model']=_[_0x0f29('0x42')](db[_0x0f29('0x27')][_0x0f29('0x43')]);_0x245bf9[_0x0f29('0x2c')]=_[_0x0f29('0x42')](_0x185493[_0x0f29('0x2c')]);_0x245bf9[_0x0f29('0x2d')]=_[_0x0f29('0x2e')](_0x245bf9['model'],_0x245bf9['query']);_0x410c59['attributes']=_[_0x0f29('0x2e')](_0x245bf9[_0x0f29('0x2b')],qs[_0x0f29('0x2f')](_0x185493[_0x0f29('0x2c')][_0x0f29('0x2f')]));_0x410c59[_0x0f29('0x30')]=_0x410c59['attributes'][_0x0f29('0x44')]?_0x410c59['attributes']:_0x245bf9[_0x0f29('0x2b')];if(_0x185493['query'][_0x0f29('0x45')]){_0x410c59[_0x0f29('0x3c')]=[{'all':!![]}];}_0x410c59=_[_0x0f29('0x37')]({},_0x410c59,_0x185493[_0x0f29('0x3a')]);return db[_0x0f29('0x27')]['find'](_0x410c59)[_0x0f29('0x23')](handleEntityNotFound(_0x56062d,null))[_0x0f29('0x23')](respondWithResult(_0x56062d,null))[_0x0f29('0x3f')](handleError(_0x56062d,null));};exports['create']=function(_0x14b747,_0x563fe2){return db['ZendeskAccount'][_0x0f29('0x46')](_0x14b747[_0x0f29('0x47')],{})[_0x0f29('0x23')](respondWithResult(_0x563fe2,0xc9))[_0x0f29('0x3f')](handleError(_0x563fe2,null));};exports[_0x0f29('0x22')]=function(_0x335435,_0x5e3546){if(_0x335435[_0x0f29('0x47')]['id']){delete _0x335435[_0x0f29('0x47')]['id'];}return db[_0x0f29('0x27')][_0x0f29('0x48')]({'where':{'id':_0x335435[_0x0f29('0x41')]['id']}})[_0x0f29('0x23')](handleEntityNotFound(_0x5e3546,null))[_0x0f29('0x23')](saveUpdates(_0x335435[_0x0f29('0x47')],null))[_0x0f29('0x23')](respondWithResult(_0x5e3546,null))[_0x0f29('0x3f')](handleError(_0x5e3546,null));};exports['destroy']=function(_0x5e4479,_0xa6231e){return db[_0x0f29('0x27')][_0x0f29('0x48')]({'where':{'id':_0x5e4479[_0x0f29('0x41')]['id']}})['then'](handleEntityNotFound(_0xa6231e,null))[_0x0f29('0x23')](removeEntity(_0xa6231e,null))[_0x0f29('0x3f')](handleError(_0xa6231e,null));};exports[_0x0f29('0x49')]=function(_0x30387c,_0xbf8f22,_0x2b3797){var _0x277ced={};var _0x59aeb9={};var _0x17f33;var _0x6c1800;return db[_0x0f29('0x27')][_0x0f29('0x4a')]({'where':{'id':_0x30387c[_0x0f29('0x41')]['id']}})[_0x0f29('0x23')](handleEntityNotFound(_0xbf8f22,null))['then'](function(_0x8c9780){if(_0x8c9780){_0x17f33=_0x8c9780;_0x59aeb9[_0x0f29('0x2b')]=_[_0x0f29('0x42')](db['ZendeskConfiguration'][_0x0f29('0x43')]);_0x59aeb9['query']=_[_0x0f29('0x42')](_0x30387c['query']);_0x59aeb9[_0x0f29('0x2d')]=_[_0x0f29('0x2e')](_0x59aeb9['model'],_0x59aeb9[_0x0f29('0x2c')]);_0x277ced[_0x0f29('0x30')]=_[_0x0f29('0x2e')](_0x59aeb9['model'],qs[_0x0f29('0x2f')](_0x30387c['query'][_0x0f29('0x2f')]));_0x277ced[_0x0f29('0x30')]=_0x277ced['attributes'][_0x0f29('0x44')]?_0x277ced[_0x0f29('0x30')]:_0x59aeb9['model'];_0x277ced[_0x0f29('0x32')]=qs['sort'](_0x30387c[_0x0f29('0x2c')]['sort']);_0x277ced[_0x0f29('0x34')]=qs[_0x0f29('0x2d')](_[_0x0f29('0x35')](_0x30387c['query'],_0x59aeb9[_0x0f29('0x2d')]));if(_0x30387c[_0x0f29('0x2c')][_0x0f29('0x36')]){_0x277ced[_0x0f29('0x34')]=_['merge'](_0x277ced[_0x0f29('0x34')],{'$or':_['map'](_0x277ced[_0x0f29('0x30')],function(_0x5159ac){var _0x1a4c57={};_0x1a4c57[_0x5159ac]={'$like':'%'+_0x30387c[_0x0f29('0x2c')][_0x0f29('0x36')]+'%'};return _0x1a4c57;})});}_0x277ced=_[_0x0f29('0x37')]({},_0x277ced,_0x30387c[_0x0f29('0x3a')]);return _0x17f33[_0x0f29('0x49')](_0x277ced);}})[_0x0f29('0x23')](function(_0x536ab1){if(_0x536ab1){_0x6c1800=_0x536ab1[_0x0f29('0x44')];if(!_0x30387c['query'][_0x0f29('0x31')](_0x0f29('0x4b'))){_0x277ced[_0x0f29('0x1f')]=qs['limit'](_0x30387c[_0x0f29('0x2c')][_0x0f29('0x1f')]);_0x277ced[_0x0f29('0x1d')]=qs[_0x0f29('0x1d')](_0x30387c[_0x0f29('0x2c')]['offset']);}return _0x17f33['getConfigurations'](_0x277ced);}})[_0x0f29('0x23')](function(_0x441fe8){if(_0x441fe8){return _0x441fe8?{'count':_0x6c1800,'rows':_0x441fe8}:null;}})[_0x0f29('0x23')](respondWithResult(_0xbf8f22,null))['catch'](handleError(_0xbf8f22,null));};exports['addConfiguration']=function(_0xebd543,_0x204a27,_0x280433){if(_0xebd543['body']['id']){delete _0xebd543['body']['id'];}return db['ZendeskAccount'][_0x0f29('0x4a')]({'where':{'id':_0xebd543[_0x0f29('0x41')]['id']}})['then'](handleEntityNotFound(_0x204a27,null))[_0x0f29('0x23')](function(_0x1c5eb4){if(_0x1c5eb4){_0xebd543['body'][_0x0f29('0x4c')]=_0x1c5eb4['id'];_0xebd543['body'][_0x0f29('0x4d')]=integrations[_0x0f29('0x4e')](_0xebd543['body'][_0x0f29('0x4f')],_0xebd543[_0x0f29('0x47')][_0x0f29('0x29')]);_0xebd543[_0x0f29('0x47')][_0x0f29('0x50')]=integrations[_0x0f29('0x51')](_0xebd543['body'][_0x0f29('0x4f')],_0xebd543[_0x0f29('0x47')][_0x0f29('0x29')]);return db['ZendeskConfiguration'][_0x0f29('0x46')](_0xebd543[_0x0f29('0x47')],{'include':[{'model':db['ZendeskField'],'as':_0x0f29('0x4d')},{'model':db['ZendeskField'],'as':_0x0f29('0x50')}]});}return null;})[_0x0f29('0x23')](respondWithResult(_0x204a27,null))[_0x0f29('0x3f')](handleError(_0x204a27,null));};exports['getFields']=function(_0x3c46d7,_0x1c0cb2,_0x2325cf){var _0x1a7d0c='';return db[_0x0f29('0x27')][_0x0f29('0x4a')]({'where':{'id':_0x3c46d7['params']['id']},'attributes':['id',_0x0f29('0x52'),'password','token',_0x0f29('0x53'),_0x0f29('0x54')]})['then'](handleEntityNotFound(_0x1c0cb2,null))[_0x0f29('0x23')](function(_0x1668a3){if(_0x1668a3){_0x1a7d0c=_0x1668a3['remoteUri'];var _0x5767b3=_0x1a7d0c['slice'](-0x1);if(_0x5767b3==='/'){_0x1a7d0c=_0x1a7d0c['substring'](0x0,_0x1a7d0c[_0x0f29('0x55')](_0x5767b3));}var _0x353472={'method':'GET','uri':util['format'](_0x0f29('0x56'),_0x1a7d0c,'ticket_fields'),'json':!![]};switch(_0x1668a3[_0x0f29('0x53')]){case _0x0f29('0x57'):_0x353472[_0x0f29('0x58')]={'Authorization':util[_0x0f29('0x59')]('Basic\x20%s',new Buffer(util[_0x0f29('0x59')](_0x0f29('0x5a'),_0x1668a3[_0x0f29('0x52')],_0x1668a3[_0x0f29('0x57')]))[_0x0f29('0x5b')]('base64'))};break;case _0x0f29('0x5c'):_0x353472[_0x0f29('0x58')]={'Authorization':util[_0x0f29('0x59')](_0x0f29('0x5d'),new Buffer(util[_0x0f29('0x59')](_0x0f29('0x5e'),_0x1668a3[_0x0f29('0x52')],_0x1668a3[_0x0f29('0x5c')]))[_0x0f29('0x5b')](_0x0f29('0x5f')))};break;default:throw new db[(_0x0f29('0x60'))][(_0x0f29('0x61'))](_0x0f29('0x62'));}return rp(_0x353472);}})[_0x0f29('0x23')](function(_0x46a8c1){if(_0x46a8c1){var _0x58f4cc=[_0x0f29('0x63'),_0x0f29('0x64'),_0x0f29('0x65'),_0x0f29('0x66')];_['remove'](_0x46a8c1['ticket_fields'],function(_0x5c0695){return _0x58f4cc[_0x0f29('0x67')](_0x5c0695[_0x0f29('0x29')]);});return{'count':_0x46a8c1['ticket_fields'][_0x0f29('0x44')],'rows':_['map'](_0x46a8c1[_0x0f29('0x68')],function(_0x5548dd){return{'id':_0x5548dd['id'],'name':_0x5548dd[_0x0f29('0x69')]>0x7?_0x5548dd[_0x0f29('0x6a')]:_0x5548dd[_0x0f29('0x29')],'custom':_0x5548dd['position']>0x7?!![]:![],'options':_0x5548dd[_0x0f29('0x6b')]?_0x5548dd['system_field_options']:_0x5548dd['custom_field_options']?_0x5548dd[_0x0f29('0x6c')]:[]};})};}})['then'](respondWithResult(_0x1c0cb2,null))[_0x0f29('0x3f')](function(_0x2b4390){var _0x55b810=_0x3c46d7[_0x0f29('0x2c')][_0x0f29('0x6d')]?0x1f4:_0x2b4390[_0x0f29('0x6e')]||0x1f4;logger[_0x0f29('0x6f')](_0x0f29('0x70'),_0x0f29('0x71'),_0x55b810,JSON[_0x0f29('0x72')](_0x2b4390));delete _0x2b4390[_0x0f29('0x39')];if(_0x55b810===0x191){_0x55b810=0x190;}_0x1c0cb2['status'](_0x55b810)[_0x0f29('0x26')](_0x3c46d7[_0x0f29('0x2c')][_0x0f29('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x2b4390[_0x0f29('0x6e')]}:_0x2b4390);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f3ddfb3..1874798 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 _0x114a=['request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x59ec12,_0x5690e4){var _0x1a40b4=function(_0x2ed01b){while(--_0x2ed01b){_0x59ec12['push'](_0x59ec12['shift']());}};_0x1a40b4(++_0x5690e4);}(_0x114a,0xb1));var _0xa114=function(_0x1a2600,_0x3795b7){_0x1a2600=_0x1a2600-0x0;var _0x44ae14=_0x114a[_0x1a2600];return _0x44ae14;};'use strict';var _=require(_0xa114('0x0'));var util=require('util');var logger=require(_0xa114('0x1'))(_0xa114('0x2'));var moment=require(_0xa114('0x3'));var BPromise=require(_0xa114('0x4'));var rp=require(_0xa114('0x5'));var fs=require('fs');var path=require(_0xa114('0x6'));var rimraf=require('rimraf');var config=require(_0xa114('0x7'));var attributes=require(_0xa114('0x8'));var integrations=require(_0xa114('0x9'));module[_0xa114('0xa')]=function(_0x1742fb,_0x3eef95){return _0x1742fb[_0xa114('0xb')](_0xa114('0xc'),attributes,{'tableName':_0xa114('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9145=['../../components/integrations/configuration','exports','define','ZendeskAccount','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x274016,_0x479562){var _0x254893=function(_0xb922bd){while(--_0xb922bd){_0x274016['push'](_0x274016['shift']());}};_0x254893(++_0x479562);}(_0x9145,0x197));var _0x5914=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9145[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5914('0x0'));var logger=require(_0x5914('0x1'))('api');var moment=require(_0x5914('0x2'));var BPromise=require(_0x5914('0x3'));var rp=require(_0x5914('0x4'));var fs=require('fs');var path=require(_0x5914('0x5'));var rimraf=require(_0x5914('0x6'));var config=require(_0x5914('0x7'));var attributes=require(_0x5914('0x8'));var integrations=require(_0x5914('0x9'));module[_0x5914('0xa')]=function(_0x1aead9,_0x1a0f81){return _0x1aead9[_0x5914('0xb')](_0x5914('0xc'),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 3de8a8d..5ecece7 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 _0x6ac7=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','info','debug','catch','find','ShowZendeskAccount','lodash'];(function(_0x19328b,_0x4a5802){var _0x4216ee=function(_0x5aad41){while(--_0x5aad41){_0x19328b['push'](_0x19328b['shift']());}};_0x4216ee(++_0x4a5802);}(_0x6ac7,0x1e0));var _0x76ac=function(_0x365e4b,_0x3673a9){_0x365e4b=_0x365e4b-0x0;var _0x452017=_0x6ac7[_0x365e4b];return _0x452017;};'use strict';var _=require(_0x76ac('0x0'));var util=require(_0x76ac('0x1'));var moment=require(_0x76ac('0x2'));var BPromise=require(_0x76ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76ac('0x4'));var db=require(_0x76ac('0x5'))['db'];var utils=require(_0x76ac('0x6'));var logger=require(_0x76ac('0x7'))(_0x76ac('0x8'));var config=require(_0x76ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x76ac('0xa')][_0x76ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4282,_0x22ba65,_0x159cbb){return new BPromise(function(_0x31d9bc,_0x26884d){return client[_0x76ac('0xc')](_0x5f4282,_0x159cbb)[_0x76ac('0xd')](function(_0x38ef11){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x22ba65,_0x76ac('0xe'));logger['debug'](_0x76ac('0xf'),_0x22ba65,_0x76ac('0xe'),JSON[_0x76ac('0x10')](_0x38ef11));if(_0x38ef11[_0x76ac('0x11')]){if(_0x38ef11[_0x76ac('0x11')]['code']===0x1f4){logger[_0x76ac('0x11')](_0x76ac('0x12'),_0x22ba65,_0x38ef11[_0x76ac('0x11')]['message']);return _0x26884d(_0x38ef11[_0x76ac('0x11')][_0x76ac('0x13')]);}logger['error'](_0x76ac('0x12'),_0x22ba65,_0x38ef11[_0x76ac('0x11')][_0x76ac('0x13')]);return _0x31d9bc(_0x38ef11[_0x76ac('0x11')]['message']);}else{logger['info'](_0x76ac('0x12'),_0x22ba65,_0x76ac('0xe'));_0x31d9bc(_0x38ef11[_0x76ac('0x14')][_0x76ac('0x13')]);}})['catch'](function(_0x104c7e){logger[_0x76ac('0x11')](_0x76ac('0x12'),_0x22ba65,_0x104c7e);_0x26884d(_0x104c7e);});});}exports[_0x76ac('0x15')]=function(_0x471b94){var _0x54a968=this;return new Promise(function(_0x44b9b0,_0x560549){return db[_0x76ac('0x16')][_0x76ac('0x17')]({'raw':_0x471b94['options']?_0x471b94[_0x76ac('0x18')][_0x76ac('0x19')]===undefined?!![]:![]:!![],'where':_0x471b94['options']?_0x471b94['options'][_0x76ac('0x1a')]||null:null,'attributes':_0x471b94['options']?_0x471b94[_0x76ac('0x18')][_0x76ac('0x1b')]||null:null,'limit':_0x471b94[_0x76ac('0x18')]?_0x471b94[_0x76ac('0x18')][_0x76ac('0x1c')]||null:null,'include':_0x471b94[_0x76ac('0x18')]?_0x471b94[_0x76ac('0x18')]['include']?_[_0x76ac('0x1d')](_0x471b94[_0x76ac('0x18')][_0x76ac('0x1e')],function(_0x314a87){return{'model':db[_0x314a87[_0x76ac('0x1f')]],'as':_0x314a87['as'],'attributes':_0x314a87[_0x76ac('0x1b')],'include':_0x314a87[_0x76ac('0x1e')]?_[_0x76ac('0x1d')](_0x314a87[_0x76ac('0x1e')],function(_0x488001){return{'model':db[_0x488001[_0x76ac('0x1f')]],'as':_0x488001['as'],'attributes':_0x488001[_0x76ac('0x1b')],'include':_0x488001['include']?_[_0x76ac('0x1d')](_0x488001[_0x76ac('0x1e')],function(_0x5f38a5){return{'model':db[_0x5f38a5[_0x76ac('0x1f')]],'as':_0x5f38a5['as'],'attributes':_0x5f38a5[_0x76ac('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x76ac('0xd')](function(_0x341ec6){logger[_0x76ac('0x20')](_0x76ac('0x15'),_0x471b94);logger[_0x76ac('0x21')]('GetZendeskAccount',_0x471b94,JSON[_0x76ac('0x10')](_0x341ec6));_0x44b9b0(_0x341ec6);})[_0x76ac('0x22')](function(_0x1863e4){logger['error']('GetZendeskAccount',_0x1863e4[_0x76ac('0x13')],_0x471b94);_0x560549(_0x54a968[_0x76ac('0x11')](0x1f4,_0x1863e4['message']));});});};exports['ShowZendeskAccount']=function(_0x1903ab){var _0x58dc63=this;return new Promise(function(_0x4c8260,_0x25d5df){return db[_0x76ac('0x16')][_0x76ac('0x23')]({'raw':_0x1903ab[_0x76ac('0x18')]?_0x1903ab['options'][_0x76ac('0x19')]===undefined?!![]:![]:!![],'where':_0x1903ab[_0x76ac('0x18')]?_0x1903ab[_0x76ac('0x18')][_0x76ac('0x1a')]||null:null,'attributes':_0x1903ab['options']?_0x1903ab['options'][_0x76ac('0x1b')]||null:null,'include':_0x1903ab[_0x76ac('0x18')]?_0x1903ab['options'][_0x76ac('0x1e')]?_[_0x76ac('0x1d')](_0x1903ab[_0x76ac('0x18')][_0x76ac('0x1e')],function(_0x556c0f){return{'model':db[_0x556c0f[_0x76ac('0x1f')]],'as':_0x556c0f['as'],'attributes':_0x556c0f[_0x76ac('0x1b')],'include':_0x556c0f['include']?_['map'](_0x556c0f[_0x76ac('0x1e')],function(_0xcbadc){return{'model':db[_0xcbadc[_0x76ac('0x1f')]],'as':_0xcbadc['as'],'attributes':_0xcbadc['attributes'],'include':_0xcbadc['include']?_['map'](_0xcbadc[_0x76ac('0x1e')],function(_0x1c8766){return{'model':db[_0x1c8766[_0x76ac('0x1f')]],'as':_0x1c8766['as'],'attributes':_0x1c8766['attributes']};}):[]};}):[]};}):[]:[]})[_0x76ac('0xd')](function(_0x4f6349){logger[_0x76ac('0x20')](_0x76ac('0x24'),_0x1903ab);logger[_0x76ac('0x21')]('ShowZendeskAccount',_0x1903ab,JSON[_0x76ac('0x10')](_0x4f6349));_0x4c8260(_0x4f6349);})[_0x76ac('0x22')](function(_0xe72c0c){logger[_0x76ac('0x11')](_0x76ac('0x24'),_0xe72c0c['message'],_0x1903ab);_0x25d5df(_0x58dc63[_0x76ac('0x11')](0x1f4,_0xe72c0c[_0x76ac('0x13')]));});});}; \ No newline at end of file +var _0x8da9=['ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','GetZendeskAccount','find','raw','ShowZendeskAccount','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x51f8c0,_0x3a1250){var _0x4025bd=function(_0x84584){while(--_0x84584){_0x51f8c0['push'](_0x51f8c0['shift']());}};_0x4025bd(++_0x3a1250);}(_0x8da9,0x1be));var _0x98da=function(_0x5966e8,_0xa8b755){_0x5966e8=_0x5966e8-0x0;var _0x1f3f71=_0x8da9[_0x5966e8];return _0x1f3f71;};'use strict';var _=require('lodash');var util=require(_0x98da('0x0'));var moment=require(_0x98da('0x1'));var BPromise=require(_0x98da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98da('0x3'));var db=require(_0x98da('0x4'))['db'];var utils=require(_0x98da('0x5'));var logger=require(_0x98da('0x6'))(_0x98da('0x7'));var config=require(_0x98da('0x8'));var jayson=require(_0x98da('0x9'));var client=jayson[_0x98da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa798e5,_0x45b648,_0x2aa3e7){return new BPromise(function(_0x296f0b,_0x48253e){return client[_0x98da('0xb')](_0xa798e5,_0x2aa3e7)[_0x98da('0xc')](function(_0x328d00){logger[_0x98da('0xd')](_0x98da('0xe'),_0x45b648,'request\x20sent');logger[_0x98da('0xf')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x45b648,_0x98da('0x10'),JSON[_0x98da('0x11')](_0x328d00));if(_0x328d00[_0x98da('0x12')]){if(_0x328d00[_0x98da('0x12')][_0x98da('0x13')]===0x1f4){logger['error'](_0x98da('0xe'),_0x45b648,_0x328d00['error'][_0x98da('0x14')]);return _0x48253e(_0x328d00['error'][_0x98da('0x14')]);}logger['error'](_0x98da('0xe'),_0x45b648,_0x328d00[_0x98da('0x12')][_0x98da('0x14')]);return _0x296f0b(_0x328d00[_0x98da('0x12')][_0x98da('0x14')]);}else{logger[_0x98da('0xd')](_0x98da('0xe'),_0x45b648,'request\x20sent');_0x296f0b(_0x328d00[_0x98da('0x15')][_0x98da('0x14')]);}})['catch'](function(_0x35da9c){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x45b648,_0x35da9c);_0x48253e(_0x35da9c);});});}exports['GetZendeskAccount']=function(_0x3cd619){var _0x48919b=this;return new Promise(function(_0x35aeaf,_0x3e898e){return db[_0x98da('0x16')][_0x98da('0x17')]({'raw':_0x3cd619['options']?_0x3cd619[_0x98da('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd619[_0x98da('0x18')]?_0x3cd619[_0x98da('0x18')][_0x98da('0x19')]||null:null,'attributes':_0x3cd619[_0x98da('0x18')]?_0x3cd619['options'][_0x98da('0x1a')]||null:null,'limit':_0x3cd619[_0x98da('0x18')]?_0x3cd619['options'][_0x98da('0x1b')]||null:null,'include':_0x3cd619[_0x98da('0x18')]?_0x3cd619[_0x98da('0x18')][_0x98da('0x1c')]?_['map'](_0x3cd619['options']['include'],function(_0x36fab7){return{'model':db[_0x36fab7[_0x98da('0x1d')]],'as':_0x36fab7['as'],'attributes':_0x36fab7[_0x98da('0x1a')],'include':_0x36fab7[_0x98da('0x1c')]?_['map'](_0x36fab7[_0x98da('0x1c')],function(_0xb9d160){return{'model':db[_0xb9d160['model']],'as':_0xb9d160['as'],'attributes':_0xb9d160['attributes'],'include':_0xb9d160[_0x98da('0x1c')]?_[_0x98da('0x1e')](_0xb9d160[_0x98da('0x1c')],function(_0x4bbb68){return{'model':db[_0x4bbb68[_0x98da('0x1d')]],'as':_0x4bbb68['as'],'attributes':_0x4bbb68[_0x98da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98da('0xc')](function(_0x132d12){logger['info'](_0x98da('0x1f'),_0x3cd619);logger[_0x98da('0xf')](_0x98da('0x1f'),_0x3cd619,JSON[_0x98da('0x11')](_0x132d12));_0x35aeaf(_0x132d12);})['catch'](function(_0x515f14){logger['error'](_0x98da('0x1f'),_0x515f14[_0x98da('0x14')],_0x3cd619);_0x3e898e(_0x48919b[_0x98da('0x12')](0x1f4,_0x515f14['message']));});});};exports['ShowZendeskAccount']=function(_0x36203a){var _0x40b4d8=this;return new Promise(function(_0x3bd4ae,_0xdac627){return db[_0x98da('0x16')][_0x98da('0x20')]({'raw':_0x36203a[_0x98da('0x18')]?_0x36203a[_0x98da('0x18')][_0x98da('0x21')]===undefined?!![]:![]:!![],'where':_0x36203a['options']?_0x36203a[_0x98da('0x18')]['where']||null:null,'attributes':_0x36203a[_0x98da('0x18')]?_0x36203a[_0x98da('0x18')]['attributes']||null:null,'include':_0x36203a['options']?_0x36203a[_0x98da('0x18')][_0x98da('0x1c')]?_['map'](_0x36203a[_0x98da('0x18')][_0x98da('0x1c')],function(_0x4877c7){return{'model':db[_0x4877c7[_0x98da('0x1d')]],'as':_0x4877c7['as'],'attributes':_0x4877c7['attributes'],'include':_0x4877c7[_0x98da('0x1c')]?_['map'](_0x4877c7[_0x98da('0x1c')],function(_0x2b7eea){return{'model':db[_0x2b7eea[_0x98da('0x1d')]],'as':_0x2b7eea['as'],'attributes':_0x2b7eea['attributes'],'include':_0x2b7eea[_0x98da('0x1c')]?_['map'](_0x2b7eea[_0x98da('0x1c')],function(_0x574d38){return{'model':db[_0x574d38[_0x98da('0x1d')]],'as':_0x574d38['as'],'attributes':_0x574d38[_0x98da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98da('0xc')](function(_0x18b76c){logger['info'](_0x98da('0x22'),_0x36203a);logger[_0x98da('0xf')](_0x98da('0x22'),_0x36203a,JSON[_0x98da('0x11')](_0x18b76c));_0x3bd4ae(_0x18b76c);})[_0x98da('0x23')](function(_0x10a248){logger[_0x98da('0x12')](_0x98da('0x22'),_0x10a248[_0x98da('0x14')],_0x36203a);_0xdac627(_0x40b4d8[_0x98da('0x12')](0x1f4,_0x10a248[_0x98da('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ccabf99..362e700 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 _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x5f0b3a,_0x355c0b){var _0x2ba0f2=function(_0x14a672){while(--_0x14a672){_0x5f0b3a['push'](_0x5f0b3a['shift']());}};_0x2ba0f2(++_0x355c0b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x5e7688,_0x3bdc63){var _0x219d7e=function(_0x994cef){while(--_0x994cef){_0x5e7688['push'](_0x5e7688['shift']());}};_0x219d7e(++_0x3bdc63);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a91d9,_0x47cedb){_0x5a91d9=_0x5a91d9-0x0;var _0x5275e2=_0xb10b[_0x5a91d9];return _0x5275e2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index bafafe8..e5bc332 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 _0x2bef=['exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2bef,0x179));var _0xf2be=function(_0x5db96a,_0x60039){_0x5db96a=_0x5db96a-0x0;var _0x13fdb0=_0x2bef[_0x5db96a];return _0x13fdb0;};'use strict';var Sequelize=require('sequelize');module[_0xf2be('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a3a=['exports','STRING'];(function(_0x16da20,_0x5d0e73){var _0x1ef19c=function(_0x455316){while(--_0x455316){_0x16da20['push'](_0x16da20['shift']());}};_0x1ef19c(++_0x5d0e73);}(_0x2a3a,0x1d6));var _0xa2a3=function(_0x1617b3,_0x2d121b){_0x1617b3=_0x1617b3-0x0;var _0x5dc56c=_0x2a3a[_0x1617b3];return _0x5dc56c;};'use strict';var Sequelize=require('sequelize');module[_0xa2a3('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa2a3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 9720828..665f132 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 _0x703c=['VIRTUAL','options','ZendeskConfiguration','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','includeAll','find','create','body','findOne','sort','getFields','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','moment','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','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','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','send','index','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','map'];(function(_0x5d38f9,_0x4bbdd8){var _0x21c1f7=function(_0x48c786){while(--_0x48c786){_0x5d38f9['push'](_0x5d38f9['shift']());}};_0x21c1f7(++_0x4bbdd8);}(_0x703c,0xbd));var _0xc703=function(_0x11f264,_0x1c1a0d){_0x11f264=_0x11f264-0x0;var _0x99c74f=_0x703c[_0x11f264];return _0x99c74f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc703('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc703('0x1'));var rp=require('request-promise');var moment=require(_0xc703('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc703('0x3'));var path=require(_0xc703('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc703('0x5'));var fs=require('fs');var fs_extra=require(_0xc703('0x6'));var _=require(_0xc703('0x7'));var squel=require(_0xc703('0x8'));var crypto=require('crypto');var jsforce=require(_0xc703('0x9'));var deskjs=require(_0xc703('0xa'));var toCsv=require(_0xc703('0xb'));var querystring=require(_0xc703('0xc'));var Papa=require('papaparse');var Redis=require(_0xc703('0xd'));var authService=require(_0xc703('0xe'));var qs=require(_0xc703('0xf'));var as=require(_0xc703('0x10'));var hardwareService=require(_0xc703('0x11'));var logger=require(_0xc703('0x12'))(_0xc703('0x13'));var utils=require('../../config/utils');var config=require(_0xc703('0x14'));var licenseUtil=require(_0xc703('0x15'));var db=require(_0xc703('0x16'))['db'];function respondWithStatusCode(_0x48780b,_0x194a6c){_0x194a6c=_0x194a6c||0xcc;return function(_0x584131){if(_0x584131){return _0x48780b[_0xc703('0x17')](_0x194a6c);}return _0x48780b[_0xc703('0x18')](_0x194a6c)[_0xc703('0x19')]();};}function respondWithResult(_0x404596,_0x2cd2f2){_0x2cd2f2=_0x2cd2f2||0xc8;return function(_0x41a4ed){if(_0x41a4ed){return _0x404596[_0xc703('0x18')](_0x2cd2f2)[_0xc703('0x1a')](_0x41a4ed);}};}function respondWithFilteredResult(_0x4c7c0a,_0x1a981a){return function(_0x59a986){if(_0x59a986){var _0x1c8249=typeof _0x1a981a[_0xc703('0x1b')]===_0xc703('0x1c')&&typeof _0x1a981a[_0xc703('0x1d')]===_0xc703('0x1c');var _0x22c444=_0x59a986['count'];var _0x1503d2=_0x1c8249?0x0:_0x1a981a[_0xc703('0x1b')];var _0x130539=_0x1c8249?_0x59a986[_0xc703('0x1e')]:_0x1a981a[_0xc703('0x1b')]+_0x1a981a['limit'];var _0x4a0cc8;if(_0x130539>=_0x22c444){_0x130539=_0x22c444;_0x4a0cc8=0xc8;}else{_0x4a0cc8=0xce;}_0x4c7c0a['status'](_0x4a0cc8);return _0x4c7c0a['set'](_0xc703('0x1f'),_0x1503d2+'-'+_0x130539+'/'+_0x22c444)[_0xc703('0x1a')](_0x59a986);}return null;};}function patchUpdates(_0x284566){return function(_0x4c8e15){try{jsonpatch[_0xc703('0x20')](_0x4c8e15,_0x284566,!![]);}catch(_0xad11b7){return BPromise[_0xc703('0x21')](_0xad11b7);}return _0x4c8e15['save']();};}function saveUpdates(_0x4b5d8f,_0x460577){return function(_0x47a724){if(_0x47a724){return _0x47a724[_0xc703('0x22')](_0x4b5d8f)[_0xc703('0x23')](function(_0x56f266){return _0x56f266;});}return null;};}function removeEntity(_0x302017,_0x339204){return function(_0x27a06b){if(_0x27a06b){return _0x27a06b[_0xc703('0x24')]()['then'](function(){_0x302017[_0xc703('0x18')](0xcc)[_0xc703('0x19')]();});}};}function handleEntityNotFound(_0x1fbcde,_0x3f43ab){return function(_0x10ac62){if(!_0x10ac62){_0x1fbcde['sendStatus'](0x194);}return _0x10ac62;};}function handleError(_0x41a6c1,_0x6b347e){_0x6b347e=_0x6b347e||0x1f4;return function(_0x57b65a){logger[_0xc703('0x25')](_0x57b65a['stack']);if(_0x57b65a[_0xc703('0x26')]){delete _0x57b65a['name'];}_0x41a6c1[_0xc703('0x18')](_0x6b347e)[_0xc703('0x27')](_0x57b65a);};}exports[_0xc703('0x28')]=function(_0x55d0bb,_0x5cf6b4){var _0x5ee10c={},_0x31a743={},_0x4556c9={'count':0x0,'rows':[]};var _0x593cbf=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x312ac7){return{'name':_0x312ac7[_0xc703('0x29')],'type':_0x312ac7[_0xc703('0x2a')]['key']};});_0x31a743[_0xc703('0x2b')]=_['map'](_0x593cbf,_0xc703('0x26'));_0x31a743[_0xc703('0x2c')]=_[_0xc703('0x2d')](_0x55d0bb[_0xc703('0x2c')]);_0x31a743[_0xc703('0x2e')]=_['intersection'](_0x31a743['model'],_0x31a743[_0xc703('0x2c')]);_0x5ee10c[_0xc703('0x2f')]=_['intersection'](_0x31a743[_0xc703('0x2b')],qs[_0xc703('0x30')](_0x55d0bb[_0xc703('0x2c')][_0xc703('0x30')]));_0x5ee10c[_0xc703('0x2f')]=_0x5ee10c['attributes']['length']?_0x5ee10c['attributes']:_0x31a743['model'];if(!_0x55d0bb['query'][_0xc703('0x31')](_0xc703('0x32'))){_0x5ee10c[_0xc703('0x1d')]=qs[_0xc703('0x1d')](_0x55d0bb['query'][_0xc703('0x1d')]);_0x5ee10c[_0xc703('0x1b')]=qs['offset'](_0x55d0bb[_0xc703('0x2c')][_0xc703('0x1b')]);}_0x5ee10c[_0xc703('0x33')]=qs['sort'](_0x55d0bb['query']['sort']);_0x5ee10c[_0xc703('0x34')]=qs[_0xc703('0x2e')](_[_0xc703('0x35')](_0x55d0bb['query'],_0x31a743['filters']),_0x593cbf);if(_0x55d0bb[_0xc703('0x2c')][_0xc703('0x36')]){_0x5ee10c[_0xc703('0x34')]=_[_0xc703('0x37')](_0x5ee10c['where'],{'$or':_[_0xc703('0x38')](_0x593cbf,function(_0x501ce6){if(_0x501ce6['type']!==_0xc703('0x39')){var _0x10584f={};_0x10584f[_0x501ce6[_0xc703('0x26')]]={'$like':'%'+_0x55d0bb['query'][_0xc703('0x36')]+'%'};return _0x10584f;}})});}_0x5ee10c=_['merge']({},_0x5ee10c,_0x55d0bb[_0xc703('0x3a')]);var _0x65b2a6={'where':_0x5ee10c[_0xc703('0x34')]};return db[_0xc703('0x3b')][_0xc703('0x1e')](_0x65b2a6)[_0xc703('0x23')](function(_0x3c4e57){_0x4556c9[_0xc703('0x1e')]=_0x3c4e57;if(_0x55d0bb[_0xc703('0x2c')]['includeAll']){_0x5ee10c[_0xc703('0x3c')]=[{'all':!![]}];}return db[_0xc703('0x3b')][_0xc703('0x3d')](_0x5ee10c);})[_0xc703('0x23')](function(_0xbc2750){_0x4556c9[_0xc703('0x3e')]=_0xbc2750;return _0x4556c9;})[_0xc703('0x23')](respondWithFilteredResult(_0x5cf6b4,_0x5ee10c))[_0xc703('0x3f')](handleError(_0x5cf6b4,null));};exports[_0xc703('0x40')]=function(_0x3076b1,_0x3b71fc){var _0x3b3927={'raw':![],'where':{'id':_0x3076b1[_0xc703('0x41')]['id']}},_0x5d4cde={};_0x5d4cde[_0xc703('0x2b')]=_[_0xc703('0x2d')](db['ZendeskConfiguration'][_0xc703('0x42')]);_0x5d4cde['query']=_[_0xc703('0x2d')](_0x3076b1[_0xc703('0x2c')]);_0x5d4cde[_0xc703('0x2e')]=_[_0xc703('0x43')](_0x5d4cde[_0xc703('0x2b')],_0x5d4cde[_0xc703('0x2c')]);_0x3b3927[_0xc703('0x2f')]=_[_0xc703('0x43')](_0x5d4cde[_0xc703('0x2b')],qs['fields'](_0x3076b1[_0xc703('0x2c')][_0xc703('0x30')]));_0x3b3927[_0xc703('0x2f')]=_0x3b3927['attributes'][_0xc703('0x44')]?_0x3b3927[_0xc703('0x2f')]:_0x5d4cde['model'];if(_0x3076b1[_0xc703('0x2c')][_0xc703('0x45')]){_0x3b3927['include']=[{'all':!![]}];}_0x3b3927=_['merge']({},_0x3b3927,_0x3076b1[_0xc703('0x3a')]);return db[_0xc703('0x3b')][_0xc703('0x46')](_0x3b3927)['then'](handleEntityNotFound(_0x3b71fc,null))[_0xc703('0x23')](respondWithResult(_0x3b71fc,null))['catch'](handleError(_0x3b71fc,null));};exports['create']=function(_0x58a6f6,_0x421326){return db['ZendeskConfiguration'][_0xc703('0x47')](_0x58a6f6['body'],{})['then'](respondWithResult(_0x421326,0xc9))[_0xc703('0x3f')](handleError(_0x421326,null));};exports[_0xc703('0x22')]=function(_0x3722a9,_0x2a8bfd){if(_0x3722a9[_0xc703('0x48')]['id']){delete _0x3722a9[_0xc703('0x48')]['id'];}return db['ZendeskConfiguration'][_0xc703('0x46')]({'where':{'id':_0x3722a9[_0xc703('0x41')]['id']}})[_0xc703('0x23')](handleEntityNotFound(_0x2a8bfd,null))[_0xc703('0x23')](saveUpdates(_0x3722a9['body'],null))[_0xc703('0x23')](respondWithResult(_0x2a8bfd,null))[_0xc703('0x3f')](handleError(_0x2a8bfd,null));};exports[_0xc703('0x24')]=function(_0x108659,_0x47ab3b){return db[_0xc703('0x3b')]['find']({'where':{'id':_0x108659[_0xc703('0x41')]['id']}})[_0xc703('0x23')](handleEntityNotFound(_0x47ab3b,null))[_0xc703('0x23')](removeEntity(_0x47ab3b,null))[_0xc703('0x3f')](handleError(_0x47ab3b,null));};exports['getFields']=function(_0x580c21,_0x27015b,_0x5881cb){var _0x5d3c35={};var _0x37e5dc={};var _0x4ce52d;var _0x1f4740;return db['ZendeskConfiguration'][_0xc703('0x49')]({'where':{'id':_0x580c21[_0xc703('0x41')]['id']}})['then'](handleEntityNotFound(_0x27015b,null))[_0xc703('0x23')](function(_0x2b72b1){if(_0x2b72b1){_0x4ce52d=_0x2b72b1;_0x37e5dc['model']=_['keys'](db['ZendeskField'][_0xc703('0x42')]);_0x37e5dc[_0xc703('0x2c')]=_[_0xc703('0x2d')](_0x580c21[_0xc703('0x2c')]);_0x37e5dc['filters']=_[_0xc703('0x43')](_0x37e5dc[_0xc703('0x2b')],_0x37e5dc[_0xc703('0x2c')]);_0x5d3c35[_0xc703('0x2f')]=_[_0xc703('0x43')](_0x37e5dc[_0xc703('0x2b')],qs[_0xc703('0x30')](_0x580c21['query'][_0xc703('0x30')]));_0x5d3c35[_0xc703('0x2f')]=_0x5d3c35[_0xc703('0x2f')][_0xc703('0x44')]?_0x5d3c35['attributes']:_0x37e5dc[_0xc703('0x2b')];_0x5d3c35[_0xc703('0x33')]=qs[_0xc703('0x4a')](_0x580c21[_0xc703('0x2c')][_0xc703('0x4a')]);_0x5d3c35[_0xc703('0x34')]=qs[_0xc703('0x2e')](_[_0xc703('0x35')](_0x580c21[_0xc703('0x2c')],_0x37e5dc[_0xc703('0x2e')]));if(_0x580c21[_0xc703('0x2c')]['filter']){_0x5d3c35['where']=_[_0xc703('0x37')](_0x5d3c35[_0xc703('0x34')],{'$or':_[_0xc703('0x38')](_0x5d3c35[_0xc703('0x2f')],function(_0x35ef77){var _0x324f76={};_0x324f76[_0x35ef77]={'$like':'%'+_0x580c21['query'][_0xc703('0x36')]+'%'};return _0x324f76;})});}_0x5d3c35=_[_0xc703('0x37')]({},_0x5d3c35,_0x580c21[_0xc703('0x3a')]);return _0x4ce52d[_0xc703('0x4b')](_0x5d3c35);}})[_0xc703('0x23')](function(_0x219048){if(_0x219048){_0x1f4740=_0x219048['length'];if(!_0x580c21[_0xc703('0x2c')][_0xc703('0x31')](_0xc703('0x32'))){_0x5d3c35[_0xc703('0x1d')]=qs[_0xc703('0x1d')](_0x580c21[_0xc703('0x2c')][_0xc703('0x1d')]);_0x5d3c35[_0xc703('0x1b')]=qs['offset'](_0x580c21['query'][_0xc703('0x1b')]);}return _0x4ce52d[_0xc703('0x4b')](_0x5d3c35);}})[_0xc703('0x23')](function(_0xc5ff1b){if(_0xc5ff1b){return _0xc5ff1b?{'count':_0x1f4740,'rows':_0xc5ff1b}:null;}})['then'](respondWithResult(_0x27015b,null))[_0xc703('0x3f')](handleError(_0x27015b,null));};exports[_0xc703('0x4c')]=function(_0x50ffb4,_0x52c340,_0x582da5){var _0x163f17={};var _0x5677b1={};var _0xdbf266;var _0x4a9964;return db['ZendeskConfiguration'][_0xc703('0x49')]({'where':{'id':_0x50ffb4[_0xc703('0x41')]['id']}})[_0xc703('0x23')](handleEntityNotFound(_0x52c340,null))[_0xc703('0x23')](function(_0x2f1d38){if(_0x2f1d38){_0xdbf266=_0x2f1d38;_0x5677b1[_0xc703('0x2b')]=_[_0xc703('0x2d')](db[_0xc703('0x4d')][_0xc703('0x42')]);_0x5677b1[_0xc703('0x2c')]=_[_0xc703('0x2d')](_0x50ffb4[_0xc703('0x2c')]);_0x5677b1['filters']=_['intersection'](_0x5677b1[_0xc703('0x2b')],_0x5677b1[_0xc703('0x2c')]);_0x163f17[_0xc703('0x2f')]=_[_0xc703('0x43')](_0x5677b1[_0xc703('0x2b')],qs[_0xc703('0x30')](_0x50ffb4[_0xc703('0x2c')][_0xc703('0x30')]));_0x163f17['attributes']=_0x163f17[_0xc703('0x2f')]['length']?_0x163f17[_0xc703('0x2f')]:_0x5677b1[_0xc703('0x2b')];_0x163f17[_0xc703('0x33')]=qs[_0xc703('0x4a')](_0x50ffb4[_0xc703('0x2c')]['sort']);_0x163f17[_0xc703('0x34')]=qs[_0xc703('0x2e')](_['pick'](_0x50ffb4[_0xc703('0x2c')],_0x5677b1[_0xc703('0x2e')]));if(_0x50ffb4['query'][_0xc703('0x36')]){_0x163f17['where']=_['merge'](_0x163f17[_0xc703('0x34')],{'$or':_['map'](_0x163f17[_0xc703('0x2f')],function(_0x4dab36){var _0x2f0422={};_0x2f0422[_0x4dab36]={'$like':'%'+_0x50ffb4[_0xc703('0x2c')][_0xc703('0x36')]+'%'};return _0x2f0422;})});}_0x163f17=_['merge']({},_0x163f17,_0x50ffb4[_0xc703('0x3a')]);return _0xdbf266[_0xc703('0x4c')](_0x163f17);}})[_0xc703('0x23')](function(_0xfe7879){if(_0xfe7879){_0x4a9964=_0xfe7879[_0xc703('0x44')];if(!_0x50ffb4[_0xc703('0x2c')][_0xc703('0x31')](_0xc703('0x32'))){_0x163f17[_0xc703('0x1d')]=qs[_0xc703('0x1d')](_0x50ffb4['query'][_0xc703('0x1d')]);_0x163f17[_0xc703('0x1b')]=qs[_0xc703('0x1b')](_0x50ffb4[_0xc703('0x2c')][_0xc703('0x1b')]);}return _0xdbf266[_0xc703('0x4c')](_0x163f17);}})[_0xc703('0x23')](function(_0xe2c70f){if(_0xe2c70f){return _0xe2c70f?{'count':_0x4a9964,'rows':_0xe2c70f}:null;}})[_0xc703('0x23')](respondWithResult(_0x52c340,null))[_0xc703('0x3f')](handleError(_0x52c340,null));};exports[_0xc703('0x4e')]=function(_0x58d978,_0x544e0c,_0x53d9d8){var _0x4ffbf7={};var _0xad44f2={};var _0x45c7f0;var _0x1e2d5c;return db[_0xc703('0x3b')][_0xc703('0x49')]({'where':{'id':_0x58d978[_0xc703('0x41')]['id']}})[_0xc703('0x23')](handleEntityNotFound(_0x544e0c,null))[_0xc703('0x23')](function(_0x26d2a7){if(_0x26d2a7){_0x45c7f0=_0x26d2a7;_0xad44f2[_0xc703('0x2b')]=_[_0xc703('0x2d')](db['ZendeskField'][_0xc703('0x42')]);_0xad44f2[_0xc703('0x2c')]=_[_0xc703('0x2d')](_0x58d978[_0xc703('0x2c')]);_0xad44f2[_0xc703('0x2e')]=_[_0xc703('0x43')](_0xad44f2[_0xc703('0x2b')],_0xad44f2[_0xc703('0x2c')]);_0x4ffbf7[_0xc703('0x2f')]=_[_0xc703('0x43')](_0xad44f2[_0xc703('0x2b')],qs['fields'](_0x58d978['query']['fields']));_0x4ffbf7[_0xc703('0x2f')]=_0x4ffbf7['attributes'][_0xc703('0x44')]?_0x4ffbf7['attributes']:_0xad44f2[_0xc703('0x2b')];_0x4ffbf7[_0xc703('0x33')]=qs[_0xc703('0x4a')](_0x58d978[_0xc703('0x2c')][_0xc703('0x4a')]);_0x4ffbf7[_0xc703('0x34')]=qs[_0xc703('0x2e')](_[_0xc703('0x35')](_0x58d978[_0xc703('0x2c')],_0xad44f2[_0xc703('0x2e')]));if(_0x58d978[_0xc703('0x2c')][_0xc703('0x36')]){_0x4ffbf7[_0xc703('0x34')]=_['merge'](_0x4ffbf7['where'],{'$or':_['map'](_0x4ffbf7[_0xc703('0x2f')],function(_0x5072c8){var _0x13a751={};_0x13a751[_0x5072c8]={'$like':'%'+_0x58d978[_0xc703('0x2c')][_0xc703('0x36')]+'%'};return _0x13a751;})});}_0x4ffbf7=_[_0xc703('0x37')]({},_0x4ffbf7,_0x58d978[_0xc703('0x3a')]);return _0x45c7f0[_0xc703('0x4e')](_0x4ffbf7);}})[_0xc703('0x23')](function(_0x1ed817){if(_0x1ed817){_0x1e2d5c=_0x1ed817[_0xc703('0x44')];if(!_0x58d978[_0xc703('0x2c')][_0xc703('0x31')](_0xc703('0x32'))){_0x4ffbf7[_0xc703('0x1d')]=qs[_0xc703('0x1d')](_0x58d978[_0xc703('0x2c')][_0xc703('0x1d')]);_0x4ffbf7[_0xc703('0x1b')]=qs[_0xc703('0x1b')](_0x58d978[_0xc703('0x2c')]['offset']);}return _0x45c7f0[_0xc703('0x4e')](_0x4ffbf7);}})[_0xc703('0x23')](function(_0x5cd372){if(_0x5cd372){return _0x5cd372?{'count':_0x1e2d5c,'rows':_0x5cd372}:null;}})['then'](respondWithResult(_0x544e0c,null))[_0xc703('0x3f')](handleError(_0x544e0c,null));};exports[_0xc703('0x4f')]=function(_0x55f594,_0x11327c,_0x35add7){var _0x210df4={};var _0x569b4e={};var _0xa6bd1b;var _0x283901;return db[_0xc703('0x3b')][_0xc703('0x49')]({'where':{'id':_0x55f594['params']['id']}})[_0xc703('0x23')](handleEntityNotFound(_0x11327c,null))[_0xc703('0x23')](function(_0x1a20ec){if(_0x1a20ec){_0xa6bd1b=_0x1a20ec;_0x569b4e['model']=_['keys'](db[_0xc703('0x50')]['rawAttributes']);_0x569b4e[_0xc703('0x2c')]=_[_0xc703('0x2d')](_0x55f594[_0xc703('0x2c')]);_0x569b4e['filters']=_[_0xc703('0x43')](_0x569b4e[_0xc703('0x2b')],_0x569b4e[_0xc703('0x2c')]);_0x210df4[_0xc703('0x2f')]=_[_0xc703('0x43')](_0x569b4e[_0xc703('0x2b')],qs[_0xc703('0x30')](_0x55f594[_0xc703('0x2c')][_0xc703('0x30')]));_0x210df4[_0xc703('0x2f')]=_0x210df4[_0xc703('0x2f')][_0xc703('0x44')]?_0x210df4[_0xc703('0x2f')]:_0x569b4e['model'];_0x210df4[_0xc703('0x33')]=qs['sort'](_0x55f594['query']['sort']);_0x210df4['where']=qs['filters'](_[_0xc703('0x35')](_0x55f594['query'],_0x569b4e[_0xc703('0x2e')]));if(_0x55f594[_0xc703('0x2c')][_0xc703('0x36')]){_0x210df4[_0xc703('0x34')]=_['merge'](_0x210df4[_0xc703('0x34')],{'$or':_[_0xc703('0x38')](_0x210df4[_0xc703('0x2f')],function(_0x294343){var _0x45a596={};_0x45a596[_0x294343]={'$like':'%'+_0x55f594[_0xc703('0x2c')]['filter']+'%'};return _0x45a596;})});}_0x210df4=_[_0xc703('0x37')]({},_0x210df4,_0x55f594[_0xc703('0x3a')]);return _0xa6bd1b[_0xc703('0x4f')](_0x210df4);}})[_0xc703('0x23')](function(_0x393d79){if(_0x393d79){_0x283901=_0x393d79[_0xc703('0x44')];if(!_0x55f594[_0xc703('0x2c')][_0xc703('0x31')](_0xc703('0x32'))){_0x210df4[_0xc703('0x1d')]=qs[_0xc703('0x1d')](_0x55f594[_0xc703('0x2c')]['limit']);_0x210df4[_0xc703('0x1b')]=qs[_0xc703('0x1b')](_0x55f594['query'][_0xc703('0x1b')]);}return _0xa6bd1b['getTags'](_0x210df4);}})[_0xc703('0x23')](function(_0xc16c49){if(_0xc16c49){return _0xc16c49?{'count':_0x283901,'rows':_0xc16c49}:null;}})[_0xc703('0x23')](respondWithResult(_0x11327c,null))['catch'](handleError(_0x11327c,null));};exports['setTags']=function(_0x75602a,_0x54dc8a,_0x2380fc){if(_0x75602a[_0xc703('0x48')]['id']){delete _0x75602a['body']['id'];}return db[_0xc703('0x3b')][_0xc703('0x49')]({'where':{'id':_0x75602a['params']['id']}})[_0xc703('0x23')](handleEntityNotFound(_0x54dc8a,null))[_0xc703('0x23')](function(_0x90f3d3){if(_0x90f3d3){return _0x90f3d3[_0xc703('0x51')](_0x75602a['body']['ids']||[]);}return null;})[_0xc703('0x23')](respondWithResult(_0x54dc8a,null))['catch'](handleError(_0x54dc8a,null));}; \ No newline at end of file +var _0xdb02=['keys','length','find','create','body','destroy','params','getFields','ZendeskField','findOne','map','getSubjects','getDescriptions','getTags','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','end','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x1f41b0,_0x3b3978){var _0x3e0791=function(_0x91906){while(--_0x91906){_0x1f41b0['push'](_0x1f41b0['shift']());}};_0x3e0791(++_0x3b3978);}(_0xdb02,0x1b7));var _0x2db0=function(_0x525864,_0x1bb3ea){_0x525864=_0x525864-0x0;var _0x4f9964=_0xdb02[_0x525864];return _0x4f9964;};'use strict';var emlformat=require(_0x2db0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2db0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2db0('0x2'));var moment=require(_0x2db0('0x3'));var BPromise=require(_0x2db0('0x4'));var Mustache=require(_0x2db0('0x5'));var util=require(_0x2db0('0x6'));var path=require(_0x2db0('0x7'));var sox=require(_0x2db0('0x8'));var csv=require(_0x2db0('0x9'));var ejs=require(_0x2db0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2db0('0xb'));var squel=require(_0x2db0('0xc'));var crypto=require(_0x2db0('0xd'));var jsforce=require(_0x2db0('0xe'));var deskjs=require(_0x2db0('0xf'));var toCsv=require(_0x2db0('0x9'));var querystring=require(_0x2db0('0x10'));var Papa=require('papaparse');var Redis=require(_0x2db0('0x11'));var authService=require(_0x2db0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2db0('0x13'));var hardwareService=require(_0x2db0('0x14'));var logger=require(_0x2db0('0x15'))(_0x2db0('0x16'));var utils=require('../../config/utils');var config=require(_0x2db0('0x17'));var licenseUtil=require(_0x2db0('0x18'));var db=require(_0x2db0('0x19'))['db'];function respondWithStatusCode(_0x3792ab,_0x65710b){_0x65710b=_0x65710b||0xcc;return function(_0x49c467){if(_0x49c467){return _0x3792ab[_0x2db0('0x1a')](_0x65710b);}return _0x3792ab[_0x2db0('0x1b')](_0x65710b)['end']();};}function respondWithResult(_0x64feda,_0xa4f092){_0xa4f092=_0xa4f092||0xc8;return function(_0x3f845f){if(_0x3f845f){return _0x64feda[_0x2db0('0x1b')](_0xa4f092)['json'](_0x3f845f);}};}function respondWithFilteredResult(_0x465c56,_0x3ca119){return function(_0x399802){if(_0x399802){var _0x5cf7e8=typeof _0x3ca119[_0x2db0('0x1c')]===_0x2db0('0x1d')&&typeof _0x3ca119['limit']===_0x2db0('0x1d');var _0x223bc6=_0x399802[_0x2db0('0x1e')];var _0x227a08=_0x5cf7e8?0x0:_0x3ca119[_0x2db0('0x1c')];var _0x51d138=_0x5cf7e8?_0x399802[_0x2db0('0x1e')]:_0x3ca119[_0x2db0('0x1c')]+_0x3ca119[_0x2db0('0x1f')];var _0x404165;if(_0x51d138>=_0x223bc6){_0x51d138=_0x223bc6;_0x404165=0xc8;}else{_0x404165=0xce;}_0x465c56[_0x2db0('0x1b')](_0x404165);return _0x465c56[_0x2db0('0x20')]('Content-Range',_0x227a08+'-'+_0x51d138+'/'+_0x223bc6)[_0x2db0('0x21')](_0x399802);}return null;};}function patchUpdates(_0x2e0a61){return function(_0x5ad1c9){try{jsonpatch[_0x2db0('0x22')](_0x5ad1c9,_0x2e0a61,!![]);}catch(_0x5f4a6){return BPromise[_0x2db0('0x23')](_0x5f4a6);}return _0x5ad1c9[_0x2db0('0x24')]();};}function saveUpdates(_0x48fccb,_0x5cb088){return function(_0xfe128c){if(_0xfe128c){return _0xfe128c[_0x2db0('0x25')](_0x48fccb)['then'](function(_0x1ac3ea){return _0x1ac3ea;});}return null;};}function removeEntity(_0x1d6d82,_0x1f79fa){return function(_0x405853){if(_0x405853){return _0x405853['destroy']()[_0x2db0('0x26')](function(){_0x1d6d82[_0x2db0('0x1b')](0xcc)[_0x2db0('0x27')]();});}};}function handleEntityNotFound(_0x51bda9,_0x6f4377){return function(_0x365096){if(!_0x365096){_0x51bda9[_0x2db0('0x1a')](0x194);}return _0x365096;};}function handleError(_0x361587,_0x3acabd){_0x3acabd=_0x3acabd||0x1f4;return function(_0x19e970){logger[_0x2db0('0x28')](_0x19e970[_0x2db0('0x29')]);if(_0x19e970[_0x2db0('0x2a')]){delete _0x19e970['name'];}_0x361587['status'](_0x3acabd)[_0x2db0('0x2b')](_0x19e970);};}exports[_0x2db0('0x2c')]=function(_0x41c279,_0xed89ec){var _0x314456={},_0x22cfa4={},_0x3372a2={'count':0x0,'rows':[]};var _0x227020=_['map'](db[_0x2db0('0x2d')][_0x2db0('0x2e')],function(_0x30182e){return{'name':_0x30182e[_0x2db0('0x2f')],'type':_0x30182e[_0x2db0('0x30')][_0x2db0('0x31')]};});_0x22cfa4[_0x2db0('0x32')]=_['map'](_0x227020,_0x2db0('0x2a'));_0x22cfa4[_0x2db0('0x33')]=_['keys'](_0x41c279['query']);_0x22cfa4[_0x2db0('0x34')]=_['intersection'](_0x22cfa4[_0x2db0('0x32')],_0x22cfa4['query']);_0x314456[_0x2db0('0x35')]=_[_0x2db0('0x36')](_0x22cfa4[_0x2db0('0x32')],qs[_0x2db0('0x37')](_0x41c279[_0x2db0('0x33')]['fields']));_0x314456[_0x2db0('0x35')]=_0x314456[_0x2db0('0x35')]['length']?_0x314456[_0x2db0('0x35')]:_0x22cfa4['model'];if(!_0x41c279['query'][_0x2db0('0x38')](_0x2db0('0x39'))){_0x314456['limit']=qs[_0x2db0('0x1f')](_0x41c279[_0x2db0('0x33')][_0x2db0('0x1f')]);_0x314456[_0x2db0('0x1c')]=qs[_0x2db0('0x1c')](_0x41c279[_0x2db0('0x33')][_0x2db0('0x1c')]);}_0x314456[_0x2db0('0x3a')]=qs[_0x2db0('0x3b')](_0x41c279[_0x2db0('0x33')]['sort']);_0x314456[_0x2db0('0x3c')]=qs[_0x2db0('0x34')](_[_0x2db0('0x3d')](_0x41c279['query'],_0x22cfa4[_0x2db0('0x34')]),_0x227020);if(_0x41c279[_0x2db0('0x33')][_0x2db0('0x3e')]){_0x314456[_0x2db0('0x3c')]=_[_0x2db0('0x3f')](_0x314456[_0x2db0('0x3c')],{'$or':_['map'](_0x227020,function(_0x21549d){if(_0x21549d[_0x2db0('0x30')]!==_0x2db0('0x40')){var _0xb72dea={};_0xb72dea[_0x21549d['name']]={'$like':'%'+_0x41c279['query']['filter']+'%'};return _0xb72dea;}})});}_0x314456=_[_0x2db0('0x3f')]({},_0x314456,_0x41c279[_0x2db0('0x41')]);var _0x571664={'where':_0x314456[_0x2db0('0x3c')]};return db[_0x2db0('0x2d')][_0x2db0('0x1e')](_0x571664)[_0x2db0('0x26')](function(_0x1200be){_0x3372a2['count']=_0x1200be;if(_0x41c279['query'][_0x2db0('0x42')]){_0x314456[_0x2db0('0x43')]=[{'all':!![]}];}return db[_0x2db0('0x2d')][_0x2db0('0x44')](_0x314456);})[_0x2db0('0x26')](function(_0x1a0cc3){_0x3372a2[_0x2db0('0x45')]=_0x1a0cc3;return _0x3372a2;})['then'](respondWithFilteredResult(_0xed89ec,_0x314456))[_0x2db0('0x46')](handleError(_0xed89ec,null));};exports['show']=function(_0x3de9a8,_0xda876b){var _0x3ff8c4={'raw':![],'where':{'id':_0x3de9a8['params']['id']}},_0x9cc4de={};_0x9cc4de[_0x2db0('0x32')]=_[_0x2db0('0x47')](db[_0x2db0('0x2d')][_0x2db0('0x2e')]);_0x9cc4de[_0x2db0('0x33')]=_[_0x2db0('0x47')](_0x3de9a8[_0x2db0('0x33')]);_0x9cc4de['filters']=_[_0x2db0('0x36')](_0x9cc4de[_0x2db0('0x32')],_0x9cc4de[_0x2db0('0x33')]);_0x3ff8c4['attributes']=_['intersection'](_0x9cc4de['model'],qs[_0x2db0('0x37')](_0x3de9a8[_0x2db0('0x33')]['fields']));_0x3ff8c4[_0x2db0('0x35')]=_0x3ff8c4[_0x2db0('0x35')][_0x2db0('0x48')]?_0x3ff8c4[_0x2db0('0x35')]:_0x9cc4de['model'];if(_0x3de9a8[_0x2db0('0x33')][_0x2db0('0x42')]){_0x3ff8c4['include']=[{'all':!![]}];}_0x3ff8c4=_[_0x2db0('0x3f')]({},_0x3ff8c4,_0x3de9a8[_0x2db0('0x41')]);return db[_0x2db0('0x2d')][_0x2db0('0x49')](_0x3ff8c4)['then'](handleEntityNotFound(_0xda876b,null))[_0x2db0('0x26')](respondWithResult(_0xda876b,null))[_0x2db0('0x46')](handleError(_0xda876b,null));};exports[_0x2db0('0x4a')]=function(_0x432e5e,_0x4c8591){return db[_0x2db0('0x2d')][_0x2db0('0x4a')](_0x432e5e['body'],{})[_0x2db0('0x26')](respondWithResult(_0x4c8591,0xc9))[_0x2db0('0x46')](handleError(_0x4c8591,null));};exports[_0x2db0('0x25')]=function(_0x447582,_0x12fa94){if(_0x447582[_0x2db0('0x4b')]['id']){delete _0x447582[_0x2db0('0x4b')]['id'];}return db[_0x2db0('0x2d')][_0x2db0('0x49')]({'where':{'id':_0x447582['params']['id']}})[_0x2db0('0x26')](handleEntityNotFound(_0x12fa94,null))[_0x2db0('0x26')](saveUpdates(_0x447582[_0x2db0('0x4b')],null))[_0x2db0('0x26')](respondWithResult(_0x12fa94,null))[_0x2db0('0x46')](handleError(_0x12fa94,null));};exports[_0x2db0('0x4c')]=function(_0x81092a,_0x3b9902){return db['ZendeskConfiguration']['find']({'where':{'id':_0x81092a[_0x2db0('0x4d')]['id']}})[_0x2db0('0x26')](handleEntityNotFound(_0x3b9902,null))['then'](removeEntity(_0x3b9902,null))[_0x2db0('0x46')](handleError(_0x3b9902,null));};exports[_0x2db0('0x4e')]=function(_0xd1302c,_0x39f1bd,_0x82f66c){var _0x362037={};var _0x593ba0={};var _0x3aee8a;var _0x1925a9;return db[_0x2db0('0x2d')]['findOne']({'where':{'id':_0xd1302c[_0x2db0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39f1bd,null))['then'](function(_0x36320f){if(_0x36320f){_0x3aee8a=_0x36320f;_0x593ba0['model']=_[_0x2db0('0x47')](db[_0x2db0('0x4f')][_0x2db0('0x2e')]);_0x593ba0[_0x2db0('0x33')]=_[_0x2db0('0x47')](_0xd1302c['query']);_0x593ba0['filters']=_[_0x2db0('0x36')](_0x593ba0['model'],_0x593ba0[_0x2db0('0x33')]);_0x362037[_0x2db0('0x35')]=_[_0x2db0('0x36')](_0x593ba0[_0x2db0('0x32')],qs[_0x2db0('0x37')](_0xd1302c[_0x2db0('0x33')]['fields']));_0x362037[_0x2db0('0x35')]=_0x362037[_0x2db0('0x35')][_0x2db0('0x48')]?_0x362037[_0x2db0('0x35')]:_0x593ba0[_0x2db0('0x32')];_0x362037[_0x2db0('0x3a')]=qs[_0x2db0('0x3b')](_0xd1302c['query'][_0x2db0('0x3b')]);_0x362037[_0x2db0('0x3c')]=qs[_0x2db0('0x34')](_[_0x2db0('0x3d')](_0xd1302c[_0x2db0('0x33')],_0x593ba0[_0x2db0('0x34')]));if(_0xd1302c[_0x2db0('0x33')][_0x2db0('0x3e')]){_0x362037[_0x2db0('0x3c')]=_[_0x2db0('0x3f')](_0x362037['where'],{'$or':_['map'](_0x362037[_0x2db0('0x35')],function(_0x52b807){var _0x2dfbf4={};_0x2dfbf4[_0x52b807]={'$like':'%'+_0xd1302c[_0x2db0('0x33')][_0x2db0('0x3e')]+'%'};return _0x2dfbf4;})});}_0x362037=_['merge']({},_0x362037,_0xd1302c['options']);return _0x3aee8a[_0x2db0('0x4e')](_0x362037);}})[_0x2db0('0x26')](function(_0x4b6b41){if(_0x4b6b41){_0x1925a9=_0x4b6b41[_0x2db0('0x48')];if(!_0xd1302c[_0x2db0('0x33')][_0x2db0('0x38')](_0x2db0('0x39'))){_0x362037['limit']=qs[_0x2db0('0x1f')](_0xd1302c[_0x2db0('0x33')][_0x2db0('0x1f')]);_0x362037[_0x2db0('0x1c')]=qs[_0x2db0('0x1c')](_0xd1302c[_0x2db0('0x33')][_0x2db0('0x1c')]);}return _0x3aee8a[_0x2db0('0x4e')](_0x362037);}})[_0x2db0('0x26')](function(_0x43a73a){if(_0x43a73a){return _0x43a73a?{'count':_0x1925a9,'rows':_0x43a73a}:null;}})[_0x2db0('0x26')](respondWithResult(_0x39f1bd,null))[_0x2db0('0x46')](handleError(_0x39f1bd,null));};exports['getSubjects']=function(_0x3e8d51,_0xa7706c,_0x218503){var _0x11df81={};var _0x41e12f={};var _0x3e53bf;var _0x25cfb7;return db[_0x2db0('0x2d')][_0x2db0('0x50')]({'where':{'id':_0x3e8d51[_0x2db0('0x4d')]['id']}})[_0x2db0('0x26')](handleEntityNotFound(_0xa7706c,null))[_0x2db0('0x26')](function(_0x3eb56c){if(_0x3eb56c){_0x3e53bf=_0x3eb56c;_0x41e12f[_0x2db0('0x32')]=_[_0x2db0('0x47')](db[_0x2db0('0x4f')][_0x2db0('0x2e')]);_0x41e12f[_0x2db0('0x33')]=_[_0x2db0('0x47')](_0x3e8d51[_0x2db0('0x33')]);_0x41e12f[_0x2db0('0x34')]=_[_0x2db0('0x36')](_0x41e12f[_0x2db0('0x32')],_0x41e12f[_0x2db0('0x33')]);_0x11df81[_0x2db0('0x35')]=_[_0x2db0('0x36')](_0x41e12f[_0x2db0('0x32')],qs['fields'](_0x3e8d51['query'][_0x2db0('0x37')]));_0x11df81['attributes']=_0x11df81[_0x2db0('0x35')][_0x2db0('0x48')]?_0x11df81['attributes']:_0x41e12f['model'];_0x11df81[_0x2db0('0x3a')]=qs[_0x2db0('0x3b')](_0x3e8d51[_0x2db0('0x33')][_0x2db0('0x3b')]);_0x11df81[_0x2db0('0x3c')]=qs[_0x2db0('0x34')](_['pick'](_0x3e8d51[_0x2db0('0x33')],_0x41e12f['filters']));if(_0x3e8d51[_0x2db0('0x33')]['filter']){_0x11df81[_0x2db0('0x3c')]=_['merge'](_0x11df81[_0x2db0('0x3c')],{'$or':_[_0x2db0('0x51')](_0x11df81[_0x2db0('0x35')],function(_0x20b637){var _0x2019a2={};_0x2019a2[_0x20b637]={'$like':'%'+_0x3e8d51[_0x2db0('0x33')][_0x2db0('0x3e')]+'%'};return _0x2019a2;})});}_0x11df81=_[_0x2db0('0x3f')]({},_0x11df81,_0x3e8d51[_0x2db0('0x41')]);return _0x3e53bf[_0x2db0('0x52')](_0x11df81);}})[_0x2db0('0x26')](function(_0x478968){if(_0x478968){_0x25cfb7=_0x478968[_0x2db0('0x48')];if(!_0x3e8d51[_0x2db0('0x33')][_0x2db0('0x38')](_0x2db0('0x39'))){_0x11df81[_0x2db0('0x1f')]=qs[_0x2db0('0x1f')](_0x3e8d51[_0x2db0('0x33')]['limit']);_0x11df81[_0x2db0('0x1c')]=qs[_0x2db0('0x1c')](_0x3e8d51[_0x2db0('0x33')][_0x2db0('0x1c')]);}return _0x3e53bf[_0x2db0('0x52')](_0x11df81);}})[_0x2db0('0x26')](function(_0x1fa352){if(_0x1fa352){return _0x1fa352?{'count':_0x25cfb7,'rows':_0x1fa352}:null;}})['then'](respondWithResult(_0xa7706c,null))[_0x2db0('0x46')](handleError(_0xa7706c,null));};exports[_0x2db0('0x53')]=function(_0x29865a,_0x18457a,_0xabf55d){var _0x276265={};var _0x188024={};var _0x3303a6;var _0x2af57a;return db[_0x2db0('0x2d')][_0x2db0('0x50')]({'where':{'id':_0x29865a[_0x2db0('0x4d')]['id']}})[_0x2db0('0x26')](handleEntityNotFound(_0x18457a,null))['then'](function(_0x40164d){if(_0x40164d){_0x3303a6=_0x40164d;_0x188024[_0x2db0('0x32')]=_[_0x2db0('0x47')](db[_0x2db0('0x4f')]['rawAttributes']);_0x188024[_0x2db0('0x33')]=_['keys'](_0x29865a[_0x2db0('0x33')]);_0x188024[_0x2db0('0x34')]=_['intersection'](_0x188024[_0x2db0('0x32')],_0x188024[_0x2db0('0x33')]);_0x276265[_0x2db0('0x35')]=_['intersection'](_0x188024[_0x2db0('0x32')],qs['fields'](_0x29865a[_0x2db0('0x33')][_0x2db0('0x37')]));_0x276265['attributes']=_0x276265[_0x2db0('0x35')][_0x2db0('0x48')]?_0x276265[_0x2db0('0x35')]:_0x188024[_0x2db0('0x32')];_0x276265[_0x2db0('0x3a')]=qs[_0x2db0('0x3b')](_0x29865a[_0x2db0('0x33')][_0x2db0('0x3b')]);_0x276265[_0x2db0('0x3c')]=qs['filters'](_['pick'](_0x29865a[_0x2db0('0x33')],_0x188024['filters']));if(_0x29865a[_0x2db0('0x33')][_0x2db0('0x3e')]){_0x276265[_0x2db0('0x3c')]=_[_0x2db0('0x3f')](_0x276265[_0x2db0('0x3c')],{'$or':_[_0x2db0('0x51')](_0x276265[_0x2db0('0x35')],function(_0x262bf5){var _0x3c329a={};_0x3c329a[_0x262bf5]={'$like':'%'+_0x29865a[_0x2db0('0x33')]['filter']+'%'};return _0x3c329a;})});}_0x276265=_[_0x2db0('0x3f')]({},_0x276265,_0x29865a[_0x2db0('0x41')]);return _0x3303a6[_0x2db0('0x53')](_0x276265);}})[_0x2db0('0x26')](function(_0x3bf36f){if(_0x3bf36f){_0x2af57a=_0x3bf36f[_0x2db0('0x48')];if(!_0x29865a['query'][_0x2db0('0x38')](_0x2db0('0x39'))){_0x276265[_0x2db0('0x1f')]=qs[_0x2db0('0x1f')](_0x29865a[_0x2db0('0x33')][_0x2db0('0x1f')]);_0x276265[_0x2db0('0x1c')]=qs['offset'](_0x29865a[_0x2db0('0x33')][_0x2db0('0x1c')]);}return _0x3303a6['getDescriptions'](_0x276265);}})[_0x2db0('0x26')](function(_0x1189e5){if(_0x1189e5){return _0x1189e5?{'count':_0x2af57a,'rows':_0x1189e5}:null;}})[_0x2db0('0x26')](respondWithResult(_0x18457a,null))[_0x2db0('0x46')](handleError(_0x18457a,null));};exports[_0x2db0('0x54')]=function(_0x3ad90b,_0x13a7d0,_0x2a7c70){var _0x3554a4={};var _0x3166c4={};var _0x3033cc;var _0x692df4;return db[_0x2db0('0x2d')]['findOne']({'where':{'id':_0x3ad90b[_0x2db0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13a7d0,null))['then'](function(_0x242e07){if(_0x242e07){_0x3033cc=_0x242e07;_0x3166c4[_0x2db0('0x32')]=_[_0x2db0('0x47')](db['Tag'][_0x2db0('0x2e')]);_0x3166c4[_0x2db0('0x33')]=_['keys'](_0x3ad90b[_0x2db0('0x33')]);_0x3166c4[_0x2db0('0x34')]=_['intersection'](_0x3166c4[_0x2db0('0x32')],_0x3166c4[_0x2db0('0x33')]);_0x3554a4[_0x2db0('0x35')]=_[_0x2db0('0x36')](_0x3166c4['model'],qs[_0x2db0('0x37')](_0x3ad90b['query'][_0x2db0('0x37')]));_0x3554a4[_0x2db0('0x35')]=_0x3554a4[_0x2db0('0x35')][_0x2db0('0x48')]?_0x3554a4[_0x2db0('0x35')]:_0x3166c4[_0x2db0('0x32')];_0x3554a4[_0x2db0('0x3a')]=qs[_0x2db0('0x3b')](_0x3ad90b[_0x2db0('0x33')][_0x2db0('0x3b')]);_0x3554a4['where']=qs[_0x2db0('0x34')](_[_0x2db0('0x3d')](_0x3ad90b[_0x2db0('0x33')],_0x3166c4[_0x2db0('0x34')]));if(_0x3ad90b[_0x2db0('0x33')]['filter']){_0x3554a4[_0x2db0('0x3c')]=_['merge'](_0x3554a4[_0x2db0('0x3c')],{'$or':_[_0x2db0('0x51')](_0x3554a4[_0x2db0('0x35')],function(_0x34c616){var _0x394979={};_0x394979[_0x34c616]={'$like':'%'+_0x3ad90b['query'][_0x2db0('0x3e')]+'%'};return _0x394979;})});}_0x3554a4=_[_0x2db0('0x3f')]({},_0x3554a4,_0x3ad90b[_0x2db0('0x41')]);return _0x3033cc[_0x2db0('0x54')](_0x3554a4);}})[_0x2db0('0x26')](function(_0x33d8a1){if(_0x33d8a1){_0x692df4=_0x33d8a1[_0x2db0('0x48')];if(!_0x3ad90b[_0x2db0('0x33')][_0x2db0('0x38')](_0x2db0('0x39'))){_0x3554a4[_0x2db0('0x1f')]=qs[_0x2db0('0x1f')](_0x3ad90b[_0x2db0('0x33')][_0x2db0('0x1f')]);_0x3554a4[_0x2db0('0x1c')]=qs['offset'](_0x3ad90b[_0x2db0('0x33')][_0x2db0('0x1c')]);}return _0x3033cc['getTags'](_0x3554a4);}})[_0x2db0('0x26')](function(_0x17f4ce){if(_0x17f4ce){return _0x17f4ce?{'count':_0x692df4,'rows':_0x17f4ce}:null;}})[_0x2db0('0x26')](respondWithResult(_0x13a7d0,null))[_0x2db0('0x46')](handleError(_0x13a7d0,null));};exports['setTags']=function(_0x53622f,_0xef4e0f,_0x3baad1){if(_0x53622f[_0x2db0('0x4b')]['id']){delete _0x53622f[_0x2db0('0x4b')]['id'];}return db[_0x2db0('0x2d')]['findOne']({'where':{'id':_0x53622f[_0x2db0('0x4d')]['id']}})['then'](handleEntityNotFound(_0xef4e0f,null))[_0x2db0('0x26')](function(_0x1e8b9c){if(_0x1e8b9c){return _0x1e8b9c['setTags'](_0x53622f[_0x2db0('0x4b')]['ids']||[]);}return null;})['then'](respondWithResult(_0xef4e0f,null))['catch'](handleError(_0xef4e0f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index bded38b..56ca488 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 _0xbbbc=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0xbbbc[_0x10c778];return _0x4e9fb2;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3f=['request-promise','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x21af32,_0x1f06eb){var _0x1d8885=function(_0x575136){while(--_0x575136){_0x21af32['push'](_0x21af32['shift']());}};_0x1d8885(++_0x1f06eb);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 4bdc95d..3a6c96e 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 _0x62c3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','catch','util'];(function(_0x1c76e4,_0x3a887d){var _0x336bba=function(_0x344bf7){while(--_0x344bf7){_0x1c76e4['push'](_0x1c76e4['shift']());}};_0x336bba(++_0x3a887d);}(_0x62c3,0x13f));var _0x362c=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x62c3[_0x540dcb];return _0x49353c;};'use strict';var _=require('lodash');var util=require(_0x362c('0x0'));var moment=require('moment');var BPromise=require(_0x362c('0x1'));var rs=require(_0x362c('0x2'));var fs=require('fs');var Redis=require(_0x362c('0x3'));var db=require(_0x362c('0x4'))['db'];var utils=require(_0x362c('0x5'));var logger=require(_0x362c('0x6'))(_0x362c('0x7'));var config=require(_0x362c('0x8'));var jayson=require(_0x362c('0x9'));var client=jayson[_0x362c('0xa')][_0x362c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47a955,_0x321446,_0x504c6a){return new BPromise(function(_0x1dc272,_0x1b7426){return client[_0x362c('0xc')](_0x47a955,_0x504c6a)['then'](function(_0xdc41ed){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x321446,_0x362c('0xd'));logger['debug'](_0x362c('0xe'),_0x321446,_0x362c('0xd'),JSON[_0x362c('0xf')](_0xdc41ed));if(_0xdc41ed[_0x362c('0x10')]){if(_0xdc41ed['error']['code']===0x1f4){logger['error'](_0x362c('0x11'),_0x321446,_0xdc41ed[_0x362c('0x10')][_0x362c('0x12')]);return _0x1b7426(_0xdc41ed['error'][_0x362c('0x12')]);}logger[_0x362c('0x10')](_0x362c('0x11'),_0x321446,_0xdc41ed['error'][_0x362c('0x12')]);return _0x1dc272(_0xdc41ed[_0x362c('0x10')][_0x362c('0x12')]);}else{logger['info'](_0x362c('0x11'),_0x321446,_0x362c('0xd'));_0x1dc272(_0xdc41ed['result'][_0x362c('0x12')]);}})[_0x362c('0x13')](function(_0xfce933){logger[_0x362c('0x10')](_0x362c('0x11'),_0x321446,_0xfce933);_0x1b7426(_0xfce933);});});} \ No newline at end of file +var _0xb03a=['jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x441fd4,_0x7aa65a){var _0x570d91=function(_0x4abcfe){while(--_0x4abcfe){_0x441fd4['push'](_0x441fd4['shift']());}};_0x570d91(++_0x7aa65a);}(_0xb03a,0x7d));var _0xab03=function(_0xc1a34,_0x3ba984){_0xc1a34=_0xc1a34-0x0;var _0x466448=_0xb03a[_0xc1a34];return _0x466448;};'use strict';var _=require('lodash');var util=require(_0xab03('0x0'));var moment=require(_0xab03('0x1'));var BPromise=require(_0xab03('0x2'));var rs=require(_0xab03('0x3'));var fs=require('fs');var Redis=require(_0xab03('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xab03('0x5'));var logger=require(_0xab03('0x6'))(_0xab03('0x7'));var config=require('../../config/environment');var jayson=require(_0xab03('0x8'));var client=jayson[_0xab03('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c1c17,_0xc1f436,_0x2c6a73){return new BPromise(function(_0x43816a,_0x338141){return client['request'](_0x5c1c17,_0x2c6a73)[_0xab03('0xa')](function(_0x4d40a4){logger[_0xab03('0xb')](_0xab03('0xc'),_0xc1f436,'request\x20sent');logger[_0xab03('0xd')](_0xab03('0xe'),_0xc1f436,'request\x20sent',JSON[_0xab03('0xf')](_0x4d40a4));if(_0x4d40a4['error']){if(_0x4d40a4[_0xab03('0x10')][_0xab03('0x11')]===0x1f4){logger[_0xab03('0x10')](_0xab03('0xc'),_0xc1f436,_0x4d40a4['error'][_0xab03('0x12')]);return _0x338141(_0x4d40a4[_0xab03('0x10')][_0xab03('0x12')]);}logger[_0xab03('0x10')](_0xab03('0xc'),_0xc1f436,_0x4d40a4[_0xab03('0x10')][_0xab03('0x12')]);return _0x43816a(_0x4d40a4[_0xab03('0x10')][_0xab03('0x12')]);}else{logger[_0xab03('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0xc1f436,'request\x20sent');_0x43816a(_0x4d40a4['result'][_0xab03('0x12')]);}})['catch'](function(_0x511dca){logger['error'](_0xab03('0xc'),_0xc1f436,_0x511dca);_0x338141(_0x511dca);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 63dbefd..85433ba 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 _0x19c2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','get','/:id','show','post','create','update','exports','multer','util','path','connect-timeout'];(function(_0x2fc5db,_0x2253b1){var _0x1ef11b=function(_0x2846a5){while(--_0x2846a5){_0x2fc5db['push'](_0x2fc5db['shift']());}};_0x1ef11b(++_0x2253b1);}(_0x19c2,0x11d));var _0x219c=function(_0x32a2cf,_0x20b153){_0x32a2cf=_0x32a2cf-0x0;var _0x250e9d=_0x19c2[_0x32a2cf];return _0x250e9d;};'use strict';var multer=require(_0x219c('0x0'));var util=require(_0x219c('0x1'));var path=require(_0x219c('0x2'));var timeout=require(_0x219c('0x3'));var express=require(_0x219c('0x4'));var router=express['Router']();var fs_extra=require(_0x219c('0x5'));var auth=require(_0x219c('0x6'));var interaction=require(_0x219c('0x7'));var config=require('../../config/environment');var controller=require(_0x219c('0x8'));router['get']('/',auth[_0x219c('0x9')](),controller['index']);router[_0x219c('0xa')](_0x219c('0xb'),auth[_0x219c('0x9')](),controller[_0x219c('0xc')]);router[_0x219c('0xd')]('/',auth[_0x219c('0x9')](),controller[_0x219c('0xe')]);router['put'](_0x219c('0xb'),auth[_0x219c('0x9')](),controller[_0x219c('0xf')]);router['delete'](_0x219c('0xb'),auth[_0x219c('0x9')](),controller['destroy']);module[_0x219c('0x10')]=router; \ No newline at end of file +var _0x8228=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x2aeca6,_0x565154){var _0x48c8c9=function(_0x739357){while(--_0x739357){_0x2aeca6['push'](_0x2aeca6['shift']());}};_0x48c8c9(++_0x565154);}(_0x8228,0x124));var _0x8822=function(_0x15b705,_0x4bcef4){_0x15b705=_0x15b705-0x0;var _0x6b5d0a=_0x8228[_0x15b705];return _0x6b5d0a;};'use strict';var multer=require(_0x8822('0x0'));var util=require(_0x8822('0x1'));var path=require(_0x8822('0x2'));var timeout=require(_0x8822('0x3'));var express=require(_0x8822('0x4'));var router=express['Router']();var fs_extra=require(_0x8822('0x5'));var auth=require(_0x8822('0x6'));var interaction=require(_0x8822('0x7'));var config=require(_0x8822('0x8'));var controller=require(_0x8822('0x9'));router['get']('/',auth[_0x8822('0xa')](),controller[_0x8822('0xb')]);router[_0x8822('0xc')](_0x8822('0xd'),auth[_0x8822('0xa')](),controller[_0x8822('0xe')]);router[_0x8822('0xf')]('/',auth['isAuthenticated'](),controller[_0x8822('0x10')]);router[_0x8822('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8822('0x12')]);router[_0x8822('0x13')](_0x8822('0xd'),auth['isAuthenticated'](),controller[_0x8822('0x14')]);module[_0x8822('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index aadee4d..65161ea 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 _0xa552=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x123ff8,_0x2b9a42){var _0x2d8b5e=function(_0x970b6f){while(--_0x970b6f){_0x123ff8['push'](_0x123ff8['shift']());}};_0x2d8b5e(++_0x2b9a42);}(_0xa552,0x97));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2a55('0x0'));module[_0x2a55('0x1')]={'type':{'type':Sequelize[_0x2a55('0x2')](_0x2a55('0x3'),'variable',_0x2a55('0x4'),_0x2a55('0x5'),_0x2a55('0x6')),'defaultValue':_0x2a55('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2a55('0x7')]},'keyType':{'type':Sequelize[_0x2a55('0x2')](_0x2a55('0x3'),_0x2a55('0x8'),_0x2a55('0x4'))},'keyContent':{'type':Sequelize[_0x2a55('0x7')]},'idField':{'type':Sequelize[_0x2a55('0x7')]},'nameField':{'type':Sequelize[_0x2a55('0x7')]},'customField':{'type':Sequelize[_0x2a55('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a55('0x7')]}}; \ No newline at end of file +var _0x8454=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x5d235a,_0x34e653){var _0x51069f=function(_0x2716c2){while(--_0x2716c2){_0x5d235a['push'](_0x5d235a['shift']());}};_0x51069f(++_0x34e653);}(_0x8454,0x130));var _0x4845=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x8454[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x4845('0x0'));module[_0x4845('0x1')]={'type':{'type':Sequelize[_0x4845('0x2')](_0x4845('0x3'),_0x4845('0x4'),'customVariable',_0x4845('0x5'),_0x4845('0x6')),'defaultValue':_0x4845('0x3')},'content':{'type':Sequelize[_0x4845('0x7')]},'key':{'type':Sequelize[_0x4845('0x7')]},'keyType':{'type':Sequelize[_0x4845('0x2')](_0x4845('0x3'),_0x4845('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4845('0x7')]},'idField':{'type':Sequelize[_0x4845('0x7')]},'nameField':{'type':Sequelize[_0x4845('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4845('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 140d380..d8532eb 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 _0x08fd=['query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','findAll','catch','params','include','create','update','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','index','map','ZendeskField','rawAttributes','fieldName','key','model'];(function(_0x26a1d6,_0x1d7e93){var _0x228122=function(_0x529fb3){while(--_0x529fb3){_0x26a1d6['push'](_0x26a1d6['shift']());}};_0x228122(++_0x1d7e93);}(_0x08fd,0xa6));var _0xd08f=function(_0x55f34a,_0x4c8897){_0x55f34a=_0x55f34a-0x0;var _0x56efe4=_0x08fd[_0x55f34a];return _0x56efe4;};'use strict';var emlformat=require(_0xd08f('0x0'));var rimraf=require(_0xd08f('0x1'));var zipdir=require(_0xd08f('0x2'));var jsonpatch=require(_0xd08f('0x3'));var rp=require('request-promise');var moment=require(_0xd08f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd08f('0x5'));var path=require(_0xd08f('0x6'));var sox=require(_0xd08f('0x7'));var csv=require(_0xd08f('0x8'));var ejs=require(_0xd08f('0x9'));var fs=require('fs');var fs_extra=require(_0xd08f('0xa'));var _=require('lodash');var squel=require(_0xd08f('0xb'));var crypto=require(_0xd08f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd08f('0x8'));var querystring=require(_0xd08f('0xd'));var Papa=require(_0xd08f('0xe'));var Redis=require(_0xd08f('0xf'));var authService=require(_0xd08f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd08f('0x11'));var logger=require('../../config/logger')(_0xd08f('0x12'));var utils=require('../../config/utils');var config=require(_0xd08f('0x13'));var licenseUtil=require(_0xd08f('0x14'));var db=require(_0xd08f('0x15'))['db'];function respondWithStatusCode(_0x3e8c38,_0x3f6136){_0x3f6136=_0x3f6136||0xcc;return function(_0x15664b){if(_0x15664b){return _0x3e8c38[_0xd08f('0x16')](_0x3f6136);}return _0x3e8c38[_0xd08f('0x17')](_0x3f6136)[_0xd08f('0x18')]();};}function respondWithResult(_0x59c987,_0x4c2fc3){_0x4c2fc3=_0x4c2fc3||0xc8;return function(_0x1bc5a0){if(_0x1bc5a0){return _0x59c987['status'](_0x4c2fc3)[_0xd08f('0x19')](_0x1bc5a0);}};}function respondWithFilteredResult(_0x136dbe,_0x58fd99){return function(_0x2027db){if(_0x2027db){var _0x36299d=typeof _0x58fd99[_0xd08f('0x1a')]===_0xd08f('0x1b')&&typeof _0x58fd99[_0xd08f('0x1c')]===_0xd08f('0x1b');var _0x2b5146=_0x2027db['count'];var _0x164c45=_0x36299d?0x0:_0x58fd99['offset'];var _0x513ce5=_0x36299d?_0x2027db[_0xd08f('0x1d')]:_0x58fd99[_0xd08f('0x1a')]+_0x58fd99[_0xd08f('0x1c')];var _0x29bdc9;if(_0x513ce5>=_0x2b5146){_0x513ce5=_0x2b5146;_0x29bdc9=0xc8;}else{_0x29bdc9=0xce;}_0x136dbe[_0xd08f('0x17')](_0x29bdc9);return _0x136dbe[_0xd08f('0x1e')](_0xd08f('0x1f'),_0x164c45+'-'+_0x513ce5+'/'+_0x2b5146)['json'](_0x2027db);}return null;};}function patchUpdates(_0x52622b){return function(_0x7032c1){try{jsonpatch[_0xd08f('0x20')](_0x7032c1,_0x52622b,!![]);}catch(_0x50d4ea){return BPromise[_0xd08f('0x21')](_0x50d4ea);}return _0x7032c1['save']();};}function saveUpdates(_0x66f5d2,_0x480465){return function(_0x304c84){if(_0x304c84){return _0x304c84['update'](_0x66f5d2)[_0xd08f('0x22')](function(_0x2a86aa){return _0x2a86aa;});}return null;};}function removeEntity(_0x1ae8a6,_0x94940b){return function(_0x2107a0){if(_0x2107a0){return _0x2107a0['destroy']()['then'](function(){_0x1ae8a6[_0xd08f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f558,_0x3d9635){return function(_0x1fe448){if(!_0x1fe448){_0x11f558[_0xd08f('0x16')](0x194);}return _0x1fe448;};}function handleError(_0x14010d,_0x1f3676){_0x1f3676=_0x1f3676||0x1f4;return function(_0x2d9dc5){logger['error'](_0x2d9dc5[_0xd08f('0x23')]);if(_0x2d9dc5[_0xd08f('0x24')]){delete _0x2d9dc5['name'];}_0x14010d[_0xd08f('0x17')](_0x1f3676)['send'](_0x2d9dc5);};}exports[_0xd08f('0x25')]=function(_0x575f73,_0x44ead6){var _0x27d048={},_0xde2de4={},_0x39b86a={'count':0x0,'rows':[]};var _0x1786ae=_[_0xd08f('0x26')](db[_0xd08f('0x27')][_0xd08f('0x28')],function(_0x4517db){return{'name':_0x4517db[_0xd08f('0x29')],'type':_0x4517db['type'][_0xd08f('0x2a')]};});_0xde2de4[_0xd08f('0x2b')]=_[_0xd08f('0x26')](_0x1786ae,_0xd08f('0x24'));_0xde2de4[_0xd08f('0x2c')]=_[_0xd08f('0x2d')](_0x575f73[_0xd08f('0x2c')]);_0xde2de4['filters']=_[_0xd08f('0x2e')](_0xde2de4[_0xd08f('0x2b')],_0xde2de4[_0xd08f('0x2c')]);_0x27d048['attributes']=_[_0xd08f('0x2e')](_0xde2de4[_0xd08f('0x2b')],qs[_0xd08f('0x2f')](_0x575f73['query'][_0xd08f('0x2f')]));_0x27d048[_0xd08f('0x30')]=_0x27d048[_0xd08f('0x30')][_0xd08f('0x31')]?_0x27d048['attributes']:_0xde2de4['model'];if(!_0x575f73[_0xd08f('0x2c')][_0xd08f('0x32')]('nolimit')){_0x27d048[_0xd08f('0x1c')]=qs[_0xd08f('0x1c')](_0x575f73[_0xd08f('0x2c')][_0xd08f('0x1c')]);_0x27d048['offset']=qs[_0xd08f('0x1a')](_0x575f73[_0xd08f('0x2c')][_0xd08f('0x1a')]);}_0x27d048[_0xd08f('0x33')]=qs[_0xd08f('0x34')](_0x575f73['query'][_0xd08f('0x34')]);_0x27d048[_0xd08f('0x35')]=qs[_0xd08f('0x36')](_[_0xd08f('0x37')](_0x575f73[_0xd08f('0x2c')],_0xde2de4[_0xd08f('0x36')]),_0x1786ae);if(_0x575f73[_0xd08f('0x2c')]['filter']){_0x27d048[_0xd08f('0x35')]=_[_0xd08f('0x38')](_0x27d048[_0xd08f('0x35')],{'$or':_['map'](_0x1786ae,function(_0x4b3733){if(_0x4b3733[_0xd08f('0x39')]!==_0xd08f('0x3a')){var _0x384c4a={};_0x384c4a[_0x4b3733[_0xd08f('0x24')]]={'$like':'%'+_0x575f73['query']['filter']+'%'};return _0x384c4a;}})});}_0x27d048=_[_0xd08f('0x38')]({},_0x27d048,_0x575f73[_0xd08f('0x3b')]);var _0x214f6d={'where':_0x27d048[_0xd08f('0x35')]};return db['ZendeskField']['count'](_0x214f6d)[_0xd08f('0x22')](function(_0x4e9ad9){_0x39b86a[_0xd08f('0x1d')]=_0x4e9ad9;if(_0x575f73['query'][_0xd08f('0x3c')]){_0x27d048['include']=[{'all':!![]}];}return db[_0xd08f('0x27')][_0xd08f('0x3d')](_0x27d048);})[_0xd08f('0x22')](function(_0x806f31){_0x39b86a['rows']=_0x806f31;return _0x39b86a;})['then'](respondWithFilteredResult(_0x44ead6,_0x27d048))[_0xd08f('0x3e')](handleError(_0x44ead6,null));};exports['show']=function(_0x577c82,_0x158a2b){var _0x3ca9ef={'raw':!![],'where':{'id':_0x577c82[_0xd08f('0x3f')]['id']}},_0x19d207={};_0x19d207[_0xd08f('0x2b')]=_[_0xd08f('0x2d')](db[_0xd08f('0x27')][_0xd08f('0x28')]);_0x19d207[_0xd08f('0x2c')]=_[_0xd08f('0x2d')](_0x577c82[_0xd08f('0x2c')]);_0x19d207[_0xd08f('0x36')]=_[_0xd08f('0x2e')](_0x19d207[_0xd08f('0x2b')],_0x19d207[_0xd08f('0x2c')]);_0x3ca9ef[_0xd08f('0x30')]=_['intersection'](_0x19d207[_0xd08f('0x2b')],qs[_0xd08f('0x2f')](_0x577c82[_0xd08f('0x2c')][_0xd08f('0x2f')]));_0x3ca9ef['attributes']=_0x3ca9ef[_0xd08f('0x30')][_0xd08f('0x31')]?_0x3ca9ef['attributes']:_0x19d207[_0xd08f('0x2b')];if(_0x577c82[_0xd08f('0x2c')][_0xd08f('0x3c')]){_0x3ca9ef[_0xd08f('0x40')]=[{'all':!![]}];}_0x3ca9ef=_['merge']({},_0x3ca9ef,_0x577c82[_0xd08f('0x3b')]);return db['ZendeskField']['find'](_0x3ca9ef)[_0xd08f('0x22')](handleEntityNotFound(_0x158a2b,null))[_0xd08f('0x22')](respondWithResult(_0x158a2b,null))[_0xd08f('0x3e')](handleError(_0x158a2b,null));};exports['create']=function(_0x36272c,_0x987f4b){return db[_0xd08f('0x27')][_0xd08f('0x41')](_0x36272c['body'],{})[_0xd08f('0x22')](respondWithResult(_0x987f4b,0xc9))['catch'](handleError(_0x987f4b,null));};exports[_0xd08f('0x42')]=function(_0x4e1ef8,_0x583981){if(_0x4e1ef8[_0xd08f('0x43')]['id']){delete _0x4e1ef8['body']['id'];}return db[_0xd08f('0x27')][_0xd08f('0x44')]({'where':{'id':_0x4e1ef8['params']['id']}})[_0xd08f('0x22')](handleEntityNotFound(_0x583981,null))['then'](saveUpdates(_0x4e1ef8['body'],null))[_0xd08f('0x22')](respondWithResult(_0x583981,null))['catch'](handleError(_0x583981,null));};exports[_0xd08f('0x45')]=function(_0x4eeb22,_0x1ba976){return db[_0xd08f('0x27')][_0xd08f('0x44')]({'where':{'id':_0x4eeb22[_0xd08f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1ba976,null))[_0xd08f('0x22')](removeEntity(_0x1ba976,null))[_0xd08f('0x3e')](handleError(_0x1ba976,null));}; \ No newline at end of file +var _0xb790=['order','sort','pick','filter','merge','where','type','ZendeskField','includeAll','include','rows','catch','params','keys','options','find','create','body','update','rimraf','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x3b0e27,_0x19b22a){var _0x3d1ebb=function(_0x1cb852){while(--_0x1cb852){_0x3b0e27['push'](_0x3b0e27['shift']());}};_0x3d1ebb(++_0x19b22a);}(_0xb790,0xe5));var _0x0b79=function(_0x17ba7d,_0x3d1ace){_0x17ba7d=_0x17ba7d-0x0;var _0x8fd171=_0xb790[_0x17ba7d];return _0x8fd171;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b79('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b79('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0b79('0x2'));var path=require(_0x0b79('0x3'));var sox=require('sox');var csv=require(_0x0b79('0x4'));var ejs=require(_0x0b79('0x5'));var fs=require('fs');var fs_extra=require(_0x0b79('0x6'));var _=require(_0x0b79('0x7'));var squel=require(_0x0b79('0x8'));var crypto=require(_0x0b79('0x9'));var jsforce=require(_0x0b79('0xa'));var deskjs=require(_0x0b79('0xb'));var toCsv=require(_0x0b79('0x4'));var querystring=require(_0x0b79('0xc'));var Papa=require(_0x0b79('0xd'));var Redis=require(_0x0b79('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b79('0xf'));var hardwareService=require(_0x0b79('0x10'));var logger=require(_0x0b79('0x11'))(_0x0b79('0x12'));var utils=require(_0x0b79('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0b79('0x14'));var db=require(_0x0b79('0x15'))['db'];function respondWithStatusCode(_0x545d4e,_0x44c94c){_0x44c94c=_0x44c94c||0xcc;return function(_0x1c0a61){if(_0x1c0a61){return _0x545d4e[_0x0b79('0x16')](_0x44c94c);}return _0x545d4e[_0x0b79('0x17')](_0x44c94c)['end']();};}function respondWithResult(_0x1a6251,_0x4681e4){_0x4681e4=_0x4681e4||0xc8;return function(_0x162522){if(_0x162522){return _0x1a6251[_0x0b79('0x17')](_0x4681e4)['json'](_0x162522);}};}function respondWithFilteredResult(_0x464c1a,_0x44f4f7){return function(_0x5bf09b){if(_0x5bf09b){var _0x1820fa=typeof _0x44f4f7[_0x0b79('0x18')]===_0x0b79('0x19')&&typeof _0x44f4f7[_0x0b79('0x1a')]===_0x0b79('0x19');var _0x37177d=_0x5bf09b[_0x0b79('0x1b')];var _0x316ebb=_0x1820fa?0x0:_0x44f4f7['offset'];var _0x49909d=_0x1820fa?_0x5bf09b['count']:_0x44f4f7[_0x0b79('0x18')]+_0x44f4f7[_0x0b79('0x1a')];var _0x23a663;if(_0x49909d>=_0x37177d){_0x49909d=_0x37177d;_0x23a663=0xc8;}else{_0x23a663=0xce;}_0x464c1a['status'](_0x23a663);return _0x464c1a[_0x0b79('0x1c')]('Content-Range',_0x316ebb+'-'+_0x49909d+'/'+_0x37177d)[_0x0b79('0x1d')](_0x5bf09b);}return null;};}function patchUpdates(_0x41d9da){return function(_0x8482ad){try{jsonpatch['apply'](_0x8482ad,_0x41d9da,!![]);}catch(_0x4483db){return BPromise[_0x0b79('0x1e')](_0x4483db);}return _0x8482ad[_0x0b79('0x1f')]();};}function saveUpdates(_0x50084c,_0xa836a8){return function(_0x58901a){if(_0x58901a){return _0x58901a['update'](_0x50084c)[_0x0b79('0x20')](function(_0x59cd0d){return _0x59cd0d;});}return null;};}function removeEntity(_0x80fbe9,_0x235a7f){return function(_0x3a04d3){if(_0x3a04d3){return _0x3a04d3[_0x0b79('0x21')]()['then'](function(){_0x80fbe9[_0x0b79('0x17')](0xcc)[_0x0b79('0x22')]();});}};}function handleEntityNotFound(_0x409db2,_0x553ed1){return function(_0x143ca2){if(!_0x143ca2){_0x409db2[_0x0b79('0x16')](0x194);}return _0x143ca2;};}function handleError(_0x23fb4b,_0x4a2f93){_0x4a2f93=_0x4a2f93||0x1f4;return function(_0x39b034){logger[_0x0b79('0x23')](_0x39b034[_0x0b79('0x24')]);if(_0x39b034[_0x0b79('0x25')]){delete _0x39b034[_0x0b79('0x25')];}_0x23fb4b['status'](_0x4a2f93)[_0x0b79('0x26')](_0x39b034);};}exports[_0x0b79('0x27')]=function(_0x43291a,_0x365ea4){var _0x48756d={},_0x47cdf2={},_0x10f10c={'count':0x0,'rows':[]};var _0x5595fd=_[_0x0b79('0x28')](db['ZendeskField'][_0x0b79('0x29')],function(_0x63c8f2){return{'name':_0x63c8f2[_0x0b79('0x2a')],'type':_0x63c8f2['type'][_0x0b79('0x2b')]};});_0x47cdf2['model']=_[_0x0b79('0x28')](_0x5595fd,_0x0b79('0x25'));_0x47cdf2[_0x0b79('0x2c')]=_['keys'](_0x43291a['query']);_0x47cdf2[_0x0b79('0x2d')]=_[_0x0b79('0x2e')](_0x47cdf2[_0x0b79('0x2f')],_0x47cdf2[_0x0b79('0x2c')]);_0x48756d[_0x0b79('0x30')]=_[_0x0b79('0x2e')](_0x47cdf2[_0x0b79('0x2f')],qs[_0x0b79('0x31')](_0x43291a[_0x0b79('0x2c')][_0x0b79('0x31')]));_0x48756d[_0x0b79('0x30')]=_0x48756d[_0x0b79('0x30')][_0x0b79('0x32')]?_0x48756d[_0x0b79('0x30')]:_0x47cdf2[_0x0b79('0x2f')];if(!_0x43291a[_0x0b79('0x2c')]['hasOwnProperty']('nolimit')){_0x48756d[_0x0b79('0x1a')]=qs[_0x0b79('0x1a')](_0x43291a[_0x0b79('0x2c')][_0x0b79('0x1a')]);_0x48756d[_0x0b79('0x18')]=qs[_0x0b79('0x18')](_0x43291a[_0x0b79('0x2c')][_0x0b79('0x18')]);}_0x48756d[_0x0b79('0x33')]=qs['sort'](_0x43291a[_0x0b79('0x2c')][_0x0b79('0x34')]);_0x48756d['where']=qs[_0x0b79('0x2d')](_[_0x0b79('0x35')](_0x43291a[_0x0b79('0x2c')],_0x47cdf2[_0x0b79('0x2d')]),_0x5595fd);if(_0x43291a[_0x0b79('0x2c')][_0x0b79('0x36')]){_0x48756d['where']=_[_0x0b79('0x37')](_0x48756d[_0x0b79('0x38')],{'$or':_[_0x0b79('0x28')](_0x5595fd,function(_0x40c092){if(_0x40c092[_0x0b79('0x39')]!=='VIRTUAL'){var _0x1d8b23={};_0x1d8b23[_0x40c092['name']]={'$like':'%'+_0x43291a[_0x0b79('0x2c')][_0x0b79('0x36')]+'%'};return _0x1d8b23;}})});}_0x48756d=_[_0x0b79('0x37')]({},_0x48756d,_0x43291a['options']);var _0x4de36a={'where':_0x48756d['where']};return db[_0x0b79('0x3a')]['count'](_0x4de36a)[_0x0b79('0x20')](function(_0x2aac97){_0x10f10c[_0x0b79('0x1b')]=_0x2aac97;if(_0x43291a[_0x0b79('0x2c')][_0x0b79('0x3b')]){_0x48756d[_0x0b79('0x3c')]=[{'all':!![]}];}return db[_0x0b79('0x3a')]['findAll'](_0x48756d);})[_0x0b79('0x20')](function(_0x38a258){_0x10f10c[_0x0b79('0x3d')]=_0x38a258;return _0x10f10c;})[_0x0b79('0x20')](respondWithFilteredResult(_0x365ea4,_0x48756d))[_0x0b79('0x3e')](handleError(_0x365ea4,null));};exports['show']=function(_0x3fa505,_0x2b9f9f){var _0x47f9e8={'raw':!![],'where':{'id':_0x3fa505[_0x0b79('0x3f')]['id']}},_0x1a8e38={};_0x1a8e38['model']=_['keys'](db[_0x0b79('0x3a')][_0x0b79('0x29')]);_0x1a8e38[_0x0b79('0x2c')]=_[_0x0b79('0x40')](_0x3fa505['query']);_0x1a8e38[_0x0b79('0x2d')]=_[_0x0b79('0x2e')](_0x1a8e38[_0x0b79('0x2f')],_0x1a8e38['query']);_0x47f9e8[_0x0b79('0x30')]=_[_0x0b79('0x2e')](_0x1a8e38[_0x0b79('0x2f')],qs[_0x0b79('0x31')](_0x3fa505[_0x0b79('0x2c')][_0x0b79('0x31')]));_0x47f9e8[_0x0b79('0x30')]=_0x47f9e8[_0x0b79('0x30')][_0x0b79('0x32')]?_0x47f9e8[_0x0b79('0x30')]:_0x1a8e38[_0x0b79('0x2f')];if(_0x3fa505['query']['includeAll']){_0x47f9e8[_0x0b79('0x3c')]=[{'all':!![]}];}_0x47f9e8=_[_0x0b79('0x37')]({},_0x47f9e8,_0x3fa505[_0x0b79('0x41')]);return db[_0x0b79('0x3a')][_0x0b79('0x42')](_0x47f9e8)['then'](handleEntityNotFound(_0x2b9f9f,null))[_0x0b79('0x20')](respondWithResult(_0x2b9f9f,null))['catch'](handleError(_0x2b9f9f,null));};exports[_0x0b79('0x43')]=function(_0x34352e,_0x358bce){return db[_0x0b79('0x3a')][_0x0b79('0x43')](_0x34352e[_0x0b79('0x44')],{})[_0x0b79('0x20')](respondWithResult(_0x358bce,0xc9))[_0x0b79('0x3e')](handleError(_0x358bce,null));};exports[_0x0b79('0x45')]=function(_0x37b5df,_0x362aa4){if(_0x37b5df[_0x0b79('0x44')]['id']){delete _0x37b5df[_0x0b79('0x44')]['id'];}return db[_0x0b79('0x3a')][_0x0b79('0x42')]({'where':{'id':_0x37b5df[_0x0b79('0x3f')]['id']}})['then'](handleEntityNotFound(_0x362aa4,null))[_0x0b79('0x20')](saveUpdates(_0x37b5df['body'],null))[_0x0b79('0x20')](respondWithResult(_0x362aa4,null))[_0x0b79('0x3e')](handleError(_0x362aa4,null));};exports[_0x0b79('0x21')]=function(_0x5ab832,_0x4172b9){return db[_0x0b79('0x3a')][_0x0b79('0x42')]({'where':{'id':_0x5ab832[_0x0b79('0x3f')]['id']}})[_0x0b79('0x20')](handleEntityNotFound(_0x4172b9,null))[_0x0b79('0x20')](removeEntity(_0x4172b9,null))[_0x0b79('0x3e')](handleError(_0x4172b9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 00a1bfe..83d08c7 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 _0x3087=['int_zendesk_fields','zendesk_unique_index','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define'];(function(_0x16e7bf,_0x182a1e){var _0x12d53b=function(_0x419649){while(--_0x419649){_0x16e7bf['push'](_0x16e7bf['shift']());}};_0x12d53b(++_0x182a1e);}(_0x3087,0x161));var _0x7308=function(_0x3626a7,_0x4e9617){_0x3626a7=_0x3626a7-0x0;var _0x103447=_0x3087[_0x3626a7];return _0x103447;};'use strict';var _=require(_0x7308('0x0'));var util=require(_0x7308('0x1'));var logger=require('../../config/logger')(_0x7308('0x2'));var moment=require(_0x7308('0x3'));var BPromise=require(_0x7308('0x4'));var rp=require(_0x7308('0x5'));var fs=require('fs');var path=require(_0x7308('0x6'));var rimraf=require(_0x7308('0x7'));var config=require('../../config/environment');var attributes=require(_0x7308('0x8'));module[_0x7308('0x9')]=function(_0x49df73,_0x190d27){return _0x49df73[_0x7308('0xa')]('ZendeskField',attributes,{'tableName':_0x7308('0xb'),'paranoid':![],'indexes':[{'name':_0x7308('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfb6=['util','api','moment','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','FieldId','lodash'];(function(_0x4d88c3,_0x5ca495){var _0xafff00=function(_0x2bd855){while(--_0x2bd855){_0x4d88c3['push'](_0x4d88c3['shift']());}};_0xafff00(++_0x5ca495);}(_0xbfb6,0x121));var _0x6bfb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xbfb6[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x6bfb('0x0'));var util=require(_0x6bfb('0x1'));var logger=require('../../config/logger')(_0x6bfb('0x2'));var moment=require(_0x6bfb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6bfb('0x4'));var attributes=require('./intZendeskField.attributes');module[_0x6bfb('0x5')]=function(_0x5c032f,_0x120c56){return _0x5c032f[_0x6bfb('0x6')](_0x6bfb('0x7'),attributes,{'tableName':_0x6bfb('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x6bfb('0x9')],'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 3f0032e..9734fcb 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 _0x0b4e=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x0b4e,0xf6));var _0xe0b4=function(_0x225e06,_0x41a798){_0x225e06=_0x225e06-0x0;var _0x2b4046=_0x0b4e[_0x225e06];return _0x2b4046;};'use strict';var _=require(_0xe0b4('0x0'));var util=require(_0xe0b4('0x1'));var moment=require(_0xe0b4('0x2'));var BPromise=require(_0xe0b4('0x3'));var rs=require(_0xe0b4('0x4'));var fs=require('fs');var Redis=require(_0xe0b4('0x5'));var db=require(_0xe0b4('0x6'))['db'];var utils=require(_0xe0b4('0x7'));var logger=require(_0xe0b4('0x8'))(_0xe0b4('0x9'));var config=require('../../config/environment');var jayson=require(_0xe0b4('0xa'));var client=jayson[_0xe0b4('0xb')][_0xe0b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42ba0e,_0x3055e6,_0x39e202){return new BPromise(function(_0x40020d,_0x305824){return client[_0xe0b4('0xd')](_0x42ba0e,_0x39e202)[_0xe0b4('0xe')](function(_0x2b3208){logger[_0xe0b4('0xf')](_0xe0b4('0x10'),_0x3055e6,_0xe0b4('0x11'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3055e6,_0xe0b4('0x11'),JSON[_0xe0b4('0x12')](_0x2b3208));if(_0x2b3208[_0xe0b4('0x13')]){if(_0x2b3208[_0xe0b4('0x13')]['code']===0x1f4){logger[_0xe0b4('0x13')]('ZendeskField,\x20%s,\x20%s',_0x3055e6,_0x2b3208[_0xe0b4('0x13')][_0xe0b4('0x14')]);return _0x305824(_0x2b3208[_0xe0b4('0x13')][_0xe0b4('0x14')]);}logger[_0xe0b4('0x13')]('ZendeskField,\x20%s,\x20%s',_0x3055e6,_0x2b3208['error'][_0xe0b4('0x14')]);return _0x40020d(_0x2b3208[_0xe0b4('0x13')][_0xe0b4('0x14')]);}else{logger[_0xe0b4('0xf')](_0xe0b4('0x10'),_0x3055e6,_0xe0b4('0x11'));_0x40020d(_0x2b3208['result'][_0xe0b4('0x14')]);}})[_0xe0b4('0x15')](function(_0x53260d){logger[_0xe0b4('0x13')](_0xe0b4('0x10'),_0x3055e6,_0x53260d);_0x305824(_0x53260d);});});} \ No newline at end of file +var _0xc82d=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x82c65c,_0x31e689){var _0x599753=function(_0x580ad3){while(--_0x580ad3){_0x82c65c['push'](_0x82c65c['shift']());}};_0x599753(++_0x31e689);}(_0xc82d,0x8b));var _0xdc82=function(_0x3a177b,_0x10d9fe){_0x3a177b=_0x3a177b-0x0;var _0x205959=_0xc82d[_0x3a177b];return _0x205959;};'use strict';var _=require(_0xdc82('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdc82('0x1'));var rs=require(_0xdc82('0x2'));var fs=require('fs');var Redis=require(_0xdc82('0x3'));var db=require(_0xdc82('0x4'))['db'];var utils=require(_0xdc82('0x5'));var logger=require('../../config/logger')(_0xdc82('0x6'));var config=require(_0xdc82('0x7'));var jayson=require(_0xdc82('0x8'));var client=jayson[_0xdc82('0x9')][_0xdc82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4328be,_0x528666,_0x525855){return new BPromise(function(_0x3da550,_0x1b4632){return client[_0xdc82('0xb')](_0x4328be,_0x525855)[_0xdc82('0xc')](function(_0x46e29f){logger[_0xdc82('0xd')](_0xdc82('0xe'),_0x528666,_0xdc82('0xf'));logger[_0xdc82('0x10')](_0xdc82('0x11'),_0x528666,_0xdc82('0xf'),JSON['stringify'](_0x46e29f));if(_0x46e29f[_0xdc82('0x12')]){if(_0x46e29f['error']['code']===0x1f4){logger['error'](_0xdc82('0xe'),_0x528666,_0x46e29f[_0xdc82('0x12')][_0xdc82('0x13')]);return _0x1b4632(_0x46e29f[_0xdc82('0x12')][_0xdc82('0x13')]);}logger[_0xdc82('0x12')](_0xdc82('0xe'),_0x528666,_0x46e29f[_0xdc82('0x12')][_0xdc82('0x13')]);return _0x3da550(_0x46e29f[_0xdc82('0x12')]['message']);}else{logger[_0xdc82('0xd')](_0xdc82('0xe'),_0x528666,_0xdc82('0xf'));_0x3da550(_0x46e29f[_0xdc82('0x14')][_0xdc82('0x13')]);}})[_0xdc82('0x15')](function(_0x2a9d95){logger[_0xdc82('0x12')](_0xdc82('0xe'),_0x528666,_0x2a9d95);_0x1b4632(_0x2a9d95);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 706d349..517dd2d 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 _0x38da=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','create','post','put','update','delete','/:id','destroy','multer'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x38da,0x92));var _0xa38d=function(_0x5519e0,_0xec8f68){_0x5519e0=_0x5519e0-0x0;var _0x14dfb2=_0x38da[_0x5519e0];return _0x14dfb2;};'use strict';var multer=require(_0xa38d('0x0'));var util=require('util');var path=require(_0xa38d('0x1'));var timeout=require(_0xa38d('0x2'));var express=require(_0xa38d('0x3'));var router=express['Router']();var fs_extra=require(_0xa38d('0x4'));var auth=require(_0xa38d('0x5'));var interaction=require(_0xa38d('0x6'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xa38d('0x7')]('/',auth[_0xa38d('0x8')](),controller[_0xa38d('0x9')]);router[_0xa38d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa38d('0xa')]);router[_0xa38d('0x7')](_0xa38d('0xb'),auth[_0xa38d('0x8')](),controller['getConfigurations']);router[_0xa38d('0x7')](_0xa38d('0xc'),auth[_0xa38d('0x8')](),controller[_0xa38d('0xd')]);router['post']('/',auth[_0xa38d('0x8')](),controller[_0xa38d('0xe')]);router[_0xa38d('0xf')](_0xa38d('0xb'),auth[_0xa38d('0x8')](),controller['addConfiguration']);router[_0xa38d('0x10')]('/:id',auth[_0xa38d('0x8')](),controller[_0xa38d('0x11')]);router[_0xa38d('0x12')](_0xa38d('0x13'),auth[_0xa38d('0x8')](),controller[_0xa38d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8092=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','destroy','multer','util','connect-timeout'];(function(_0x26707f,_0x2bcfd5){var _0x3a19df=function(_0x2124cd){while(--_0x2124cd){_0x26707f['push'](_0x26707f['shift']());}};_0x3a19df(++_0x2bcfd5);}(_0x8092,0x1e1));var _0x2809=function(_0x443cd9,_0x3ce43c){_0x443cd9=_0x443cd9-0x0;var _0x4f2d67=_0x8092[_0x443cd9];return _0x4f2d67;};'use strict';var multer=require(_0x2809('0x0'));var util=require(_0x2809('0x1'));var path=require('path');var timeout=require(_0x2809('0x2'));var express=require(_0x2809('0x3'));var router=express[_0x2809('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2809('0x5'));var interaction=require(_0x2809('0x6'));var config=require(_0x2809('0x7'));var controller=require('./intZohoAccount.controller');router[_0x2809('0x8')]('/',auth['isAuthenticated'](),controller[_0x2809('0x9')]);router[_0x2809('0x8')](_0x2809('0xa'),auth[_0x2809('0xb')](),controller[_0x2809('0xc')]);router[_0x2809('0x8')](_0x2809('0xd'),auth[_0x2809('0xb')](),controller[_0x2809('0xe')]);router[_0x2809('0x8')](_0x2809('0xf'),auth[_0x2809('0xb')](),controller[_0x2809('0x10')]);router[_0x2809('0x11')]('/',auth['isAuthenticated'](),controller[_0x2809('0x12')]);router[_0x2809('0x11')](_0x2809('0xd'),auth[_0x2809('0xb')](),controller['addConfiguration']);router['put'](_0x2809('0xa'),auth[_0x2809('0xb')](),controller[_0x2809('0x13')]);router[_0x2809('0x14')](_0x2809('0xa'),auth[_0x2809('0xb')](),controller[_0x2809('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 58fb49a..15d2b2b 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 _0x4c4e=['sequelize','STRING'];(function(_0x2ad2f3,_0x3a6a7c){var _0x9eac9e=function(_0x4c0170){while(--_0x4c0170){_0x2ad2f3['push'](_0x2ad2f3['shift']());}};_0x9eac9e(++_0x3a6a7c);}(_0x4c4e,0x152));var _0xe4c4=function(_0x1ff540,_0x359d73){_0x1ff540=_0x1ff540-0x0;var _0x1ea6db=_0x4c4e[_0x1ff540];return _0x1ea6db;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4c4('0x1')]},'description':{'type':Sequelize[_0xe4c4('0x1')]},'host':{'type':Sequelize[_0xe4c4('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe4c4('0x1')]},'clientSecret':{'type':Sequelize[_0xe4c4('0x1')]},'serverUrl':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xe4c4('0x1')]}}; \ No newline at end of file +var _0xda55=['STRING','sequelize','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xda55,0x6d));var _0x5da5=function(_0x4e9e24,_0x34b638){_0x4e9e24=_0x4e9e24-0x0;var _0x3ef905=_0xda55[_0x4e9e24];return _0x3ef905;};'use strict';var Sequelize=require(_0x5da5('0x0'));module[_0x5da5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5da5('0x2')]},'zone':{'type':Sequelize[_0x5da5('0x2')]},'clientId':{'type':Sequelize[_0x5da5('0x2')]},'clientSecret':{'type':Sequelize[_0x5da5('0x2')]},'serverUrl':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x5da5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9db9950..bd0178d 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 _0xdddf=['Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','substring','lastIndexOf','refreshToken','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify'];(function(_0x3d9bfe,_0x2f64e2){var _0x4c0f42=function(_0x42f8b2){while(--_0x42f8b2){_0x3d9bfe['push'](_0x3d9bfe['shift']());}};_0x4c0f42(++_0x2f64e2);}(_0xdddf,0x111));var _0xfddd=function(_0x51a901,_0x4ec442){_0x51a901=_0x51a901-0x0;var _0x2afea2=_0xdddf[_0x51a901];return _0x2afea2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfddd('0x0'));var jsonpatch=require(_0xfddd('0x1'));var rp=require(_0xfddd('0x2'));var moment=require(_0xfddd('0x3'));var BPromise=require(_0xfddd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfddd('0x5'));var sox=require('sox');var csv=require(_0xfddd('0x6'));var ejs=require(_0xfddd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfddd('0x8'));var squel=require(_0xfddd('0x9'));var crypto=require('crypto');var jsforce=require(_0xfddd('0xa'));var deskjs=require(_0xfddd('0xb'));var toCsv=require(_0xfddd('0x6'));var querystring=require(_0xfddd('0xc'));var Papa=require(_0xfddd('0xd'));var Redis=require(_0xfddd('0xe'));var authService=require(_0xfddd('0xf'));var qs=require(_0xfddd('0x10'));var as=require(_0xfddd('0x11'));var hardwareService=require(_0xfddd('0x12'));var logger=require(_0xfddd('0x13'))(_0xfddd('0x14'));var utils=require(_0xfddd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfddd('0x16'));var db=require(_0xfddd('0x17'))['db'];var integrations=require(_0xfddd('0x18'));function respondWithStatusCode(_0x8539f2,_0xf645){_0xf645=_0xf645||0xcc;return function(_0x2018d8){if(_0x2018d8){return _0x8539f2['sendStatus'](_0xf645);}return _0x8539f2[_0xfddd('0x19')](_0xf645)[_0xfddd('0x1a')]();};}function respondWithResult(_0x4b08f3,_0x4f0024){_0x4f0024=_0x4f0024||0xc8;return function(_0x148b17){if(_0x148b17){return _0x4b08f3[_0xfddd('0x19')](_0x4f0024)[_0xfddd('0x1b')](_0x148b17);}};}function respondWithFilteredResult(_0x270ebf,_0x4690c8){return function(_0x40e757){if(_0x40e757){var _0xf9a378=typeof _0x4690c8[_0xfddd('0x1c')]==='undefined'&&typeof _0x4690c8[_0xfddd('0x1d')]===_0xfddd('0x1e');var _0x193dc8=_0x40e757['count'];var _0x367b81=_0xf9a378?0x0:_0x4690c8['offset'];var _0x416800=_0xf9a378?_0x40e757['count']:_0x4690c8['offset']+_0x4690c8[_0xfddd('0x1d')];var _0xf19fb2;if(_0x416800>=_0x193dc8){_0x416800=_0x193dc8;_0xf19fb2=0xc8;}else{_0xf19fb2=0xce;}_0x270ebf['status'](_0xf19fb2);return _0x270ebf[_0xfddd('0x1f')](_0xfddd('0x20'),_0x367b81+'-'+_0x416800+'/'+_0x193dc8)[_0xfddd('0x1b')](_0x40e757);}return null;};}function patchUpdates(_0x20332f){return function(_0x56dd3e){try{jsonpatch[_0xfddd('0x21')](_0x56dd3e,_0x20332f,!![]);}catch(_0x23ee68){return BPromise[_0xfddd('0x22')](_0x23ee68);}return _0x56dd3e[_0xfddd('0x23')]();};}function saveUpdates(_0xcc3947,_0x1a1ff0){return function(_0x551174){if(_0x551174){return _0x551174['update'](_0xcc3947)[_0xfddd('0x24')](function(_0x53ec1a){return _0x53ec1a;});}return null;};}function removeEntity(_0x5b2eb9,_0x4b7dd8){return function(_0x44ae1d){if(_0x44ae1d){return _0x44ae1d[_0xfddd('0x25')]()['then'](function(){_0x5b2eb9[_0xfddd('0x19')](0xcc)[_0xfddd('0x1a')]();});}};}function handleEntityNotFound(_0x57437e,_0x5518ca){return function(_0x4849e0){if(!_0x4849e0){_0x57437e[_0xfddd('0x26')](0x194);}return _0x4849e0;};}function handleError(_0x1d81f0,_0x137b6f){_0x137b6f=_0x137b6f||0x1f4;return function(_0x2fae0c){logger[_0xfddd('0x27')](_0x2fae0c[_0xfddd('0x28')]);if(_0x2fae0c[_0xfddd('0x29')]){delete _0x2fae0c[_0xfddd('0x29')];}_0x1d81f0[_0xfddd('0x19')](_0x137b6f)[_0xfddd('0x2a')](_0x2fae0c);};}exports[_0xfddd('0x2b')]=function(_0x2f9429,_0x1c97b7){var _0x452fd3={},_0x432b8b={},_0x359853={'count':0x0,'rows':[]};var _0x2af433=_[_0xfddd('0x2c')](db[_0xfddd('0x2d')][_0xfddd('0x2e')],function(_0x43505e){return{'name':_0x43505e['fieldName'],'type':_0x43505e[_0xfddd('0x2f')][_0xfddd('0x30')]};});_0x432b8b[_0xfddd('0x31')]=_['map'](_0x2af433,_0xfddd('0x29'));_0x432b8b[_0xfddd('0x32')]=_[_0xfddd('0x33')](_0x2f9429[_0xfddd('0x32')]);_0x432b8b[_0xfddd('0x34')]=_[_0xfddd('0x35')](_0x432b8b[_0xfddd('0x31')],_0x432b8b[_0xfddd('0x32')]);_0x452fd3['attributes']=_[_0xfddd('0x35')](_0x432b8b[_0xfddd('0x31')],qs[_0xfddd('0x36')](_0x2f9429[_0xfddd('0x32')][_0xfddd('0x36')]));_0x452fd3['attributes']=_0x452fd3['attributes'][_0xfddd('0x37')]?_0x452fd3[_0xfddd('0x38')]:_0x432b8b[_0xfddd('0x31')];if(!_0x2f9429['query']['hasOwnProperty'](_0xfddd('0x39'))){_0x452fd3['limit']=qs[_0xfddd('0x1d')](_0x2f9429['query']['limit']);_0x452fd3[_0xfddd('0x1c')]=qs[_0xfddd('0x1c')](_0x2f9429[_0xfddd('0x32')][_0xfddd('0x1c')]);}_0x452fd3[_0xfddd('0x3a')]=qs['sort'](_0x2f9429[_0xfddd('0x32')][_0xfddd('0x3b')]);_0x452fd3[_0xfddd('0x3c')]=qs[_0xfddd('0x34')](_['pick'](_0x2f9429['query'],_0x432b8b[_0xfddd('0x34')]),_0x2af433);if(_0x2f9429[_0xfddd('0x32')]['filter']){_0x452fd3[_0xfddd('0x3c')]=_[_0xfddd('0x3d')](_0x452fd3[_0xfddd('0x3c')],{'$or':_[_0xfddd('0x2c')](_0x2af433,function(_0x10e740){if(_0x10e740['type']!==_0xfddd('0x3e')){var _0x202085={};_0x202085[_0x10e740[_0xfddd('0x29')]]={'$like':'%'+_0x2f9429[_0xfddd('0x32')][_0xfddd('0x3f')]+'%'};return _0x202085;}})});}_0x452fd3=_['merge']({},_0x452fd3,_0x2f9429[_0xfddd('0x40')]);var _0x263f2e={'where':_0x452fd3[_0xfddd('0x3c')]};return db['ZohoAccount']['count'](_0x263f2e)[_0xfddd('0x24')](function(_0x463013){_0x359853[_0xfddd('0x41')]=_0x463013;if(_0x2f9429[_0xfddd('0x32')]['includeAll']){_0x452fd3[_0xfddd('0x42')]=[{'all':!![]}];}return db[_0xfddd('0x2d')][_0xfddd('0x43')](_0x452fd3);})[_0xfddd('0x24')](function(_0x4d0b88){_0x359853[_0xfddd('0x44')]=_0x4d0b88;return _0x359853;})['then'](respondWithFilteredResult(_0x1c97b7,_0x452fd3))[_0xfddd('0x45')](handleError(_0x1c97b7,null));};exports['show']=function(_0x53bc8c,_0x3f28c9){var _0x222ddd={'raw':![],'where':{'id':_0x53bc8c[_0xfddd('0x46')]['id']}},_0x2c7ff2={};_0x2c7ff2[_0xfddd('0x31')]=_[_0xfddd('0x33')](db[_0xfddd('0x2d')]['rawAttributes']);_0x2c7ff2['query']=_[_0xfddd('0x33')](_0x53bc8c[_0xfddd('0x32')]);_0x2c7ff2[_0xfddd('0x34')]=_[_0xfddd('0x35')](_0x2c7ff2['model'],_0x2c7ff2[_0xfddd('0x32')]);_0x222ddd[_0xfddd('0x38')]=_[_0xfddd('0x35')](_0x2c7ff2['model'],qs[_0xfddd('0x36')](_0x53bc8c[_0xfddd('0x32')]['fields']));_0x222ddd[_0xfddd('0x38')]=_0x222ddd[_0xfddd('0x38')]['length']?_0x222ddd['attributes']:_0x2c7ff2[_0xfddd('0x31')];if(_0x53bc8c['query'][_0xfddd('0x47')]){_0x222ddd[_0xfddd('0x42')]=[{'all':!![]}];}_0x222ddd=_['merge']({},_0x222ddd,_0x53bc8c[_0xfddd('0x40')]);return db['ZohoAccount'][_0xfddd('0x48')](_0x222ddd)[_0xfddd('0x24')](handleEntityNotFound(_0x3f28c9,null))[_0xfddd('0x24')](respondWithResult(_0x3f28c9,null))[_0xfddd('0x45')](handleError(_0x3f28c9,null));};exports[_0xfddd('0x49')]=function(_0x5b9799,_0xd2c672){return db['ZohoAccount'][_0xfddd('0x49')](_0x5b9799[_0xfddd('0x4a')],{})[_0xfddd('0x24')](respondWithResult(_0xd2c672,0xc9))['catch'](handleError(_0xd2c672,null));};exports[_0xfddd('0x4b')]=function(_0xbbb555,_0x266049){if(_0xbbb555[_0xfddd('0x4a')]['id']){delete _0xbbb555[_0xfddd('0x4a')]['id'];}return db['ZohoAccount'][_0xfddd('0x48')]({'where':{'id':_0xbbb555[_0xfddd('0x46')]['id']}})[_0xfddd('0x24')](handleEntityNotFound(_0x266049,null))['then'](saveUpdates(_0xbbb555[_0xfddd('0x4a')],null))['then'](respondWithResult(_0x266049,null))['catch'](handleError(_0x266049,null));};exports['destroy']=function(_0x47daf0,_0x463de6){return db['ZohoAccount'][_0xfddd('0x48')]({'where':{'id':_0x47daf0[_0xfddd('0x46')]['id']}})[_0xfddd('0x24')](handleEntityNotFound(_0x463de6,null))[_0xfddd('0x24')](removeEntity(_0x463de6,null))[_0xfddd('0x45')](handleError(_0x463de6,null));};exports[_0xfddd('0x4c')]=function(_0x5da387,_0x7df68a,_0x20671b){var _0x521b32={};var _0x32a1f3={};var _0x366c7f;var _0x32512a;return db[_0xfddd('0x2d')][_0xfddd('0x4d')]({'where':{'id':_0x5da387[_0xfddd('0x46')]['id']}})[_0xfddd('0x24')](handleEntityNotFound(_0x7df68a,null))['then'](function(_0x1c6f83){if(_0x1c6f83){_0x366c7f=_0x1c6f83;_0x32a1f3[_0xfddd('0x31')]=_['keys'](db[_0xfddd('0x4e')]['rawAttributes']);_0x32a1f3[_0xfddd('0x32')]=_['keys'](_0x5da387['query']);_0x32a1f3[_0xfddd('0x34')]=_[_0xfddd('0x35')](_0x32a1f3[_0xfddd('0x31')],_0x32a1f3[_0xfddd('0x32')]);_0x521b32['attributes']=_['intersection'](_0x32a1f3[_0xfddd('0x31')],qs[_0xfddd('0x36')](_0x5da387[_0xfddd('0x32')][_0xfddd('0x36')]));_0x521b32['attributes']=_0x521b32[_0xfddd('0x38')]['length']?_0x521b32[_0xfddd('0x38')]:_0x32a1f3[_0xfddd('0x31')];_0x521b32[_0xfddd('0x3a')]=qs[_0xfddd('0x3b')](_0x5da387['query']['sort']);_0x521b32['where']=qs['filters'](_[_0xfddd('0x4f')](_0x5da387[_0xfddd('0x32')],_0x32a1f3[_0xfddd('0x34')]));if(_0x5da387[_0xfddd('0x32')][_0xfddd('0x3f')]){_0x521b32[_0xfddd('0x3c')]=_[_0xfddd('0x3d')](_0x521b32[_0xfddd('0x3c')],{'$or':_[_0xfddd('0x2c')](_0x521b32[_0xfddd('0x38')],function(_0x3e09b4){var _0x2ca0ee={};_0x2ca0ee[_0x3e09b4]={'$like':'%'+_0x5da387[_0xfddd('0x32')][_0xfddd('0x3f')]+'%'};return _0x2ca0ee;})});}_0x521b32=_[_0xfddd('0x3d')]({},_0x521b32,_0x5da387['options']);return _0x366c7f[_0xfddd('0x4c')](_0x521b32);}})[_0xfddd('0x24')](function(_0x5b31c8){if(_0x5b31c8){_0x32512a=_0x5b31c8[_0xfddd('0x37')];if(!_0x5da387['query'][_0xfddd('0x50')]('nolimit')){_0x521b32['limit']=qs['limit'](_0x5da387[_0xfddd('0x32')][_0xfddd('0x1d')]);_0x521b32[_0xfddd('0x1c')]=qs['offset'](_0x5da387['query'][_0xfddd('0x1c')]);}return _0x366c7f['getConfigurations'](_0x521b32);}})['then'](function(_0x41cda7){if(_0x41cda7){return _0x41cda7?{'count':_0x32512a,'rows':_0x41cda7}:null;}})[_0xfddd('0x24')](respondWithResult(_0x7df68a,null))[_0xfddd('0x45')](handleError(_0x7df68a,null));};exports[_0xfddd('0x51')]=function(_0x4eadb5,_0x1d499d,_0x456c35){if(_0x4eadb5['body']['id']){delete _0x4eadb5[_0xfddd('0x4a')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x4eadb5[_0xfddd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d499d,null))[_0xfddd('0x24')](function(_0x51041d){if(_0x51041d){_0x4eadb5[_0xfddd('0x4a')][_0xfddd('0x52')]=_0x51041d['id'];_0x4eadb5[_0xfddd('0x4a')][_0xfddd('0x53')]=integrations['getSubjects'](_0x4eadb5['body'][_0xfddd('0x54')],_0x4eadb5[_0xfddd('0x4a')][_0xfddd('0x2f')]);_0x4eadb5[_0xfddd('0x4a')][_0xfddd('0x55')]=integrations[_0xfddd('0x56')](_0x4eadb5[_0xfddd('0x4a')][_0xfddd('0x54')],_0x4eadb5[_0xfddd('0x4a')][_0xfddd('0x2f')]);return db['ZohoConfiguration'][_0xfddd('0x49')](_0x4eadb5[_0xfddd('0x4a')],{'include':[{'model':db[_0xfddd('0x57')],'as':_0xfddd('0x53')},{'model':db['ZohoField'],'as':_0xfddd('0x55')}]});}return null;})[_0xfddd('0x24')](respondWithResult(_0x1d499d,null))['catch'](handleError(_0x1d499d,null));};function getAccessToken(_0x2bef2f){return new Promise(function(_0xb82418,_0x521f2e){var _0xe1ee46;switch(_0x2bef2f[_0xfddd('0x58')]){case'US':_0xe1ee46='https://accounts.zoho.com';break;case'AU':_0xe1ee46='https://accounts.zoho.com.au';break;case'EU':_0xe1ee46=_0xfddd('0x59');break;case'IN':_0xe1ee46=_0xfddd('0x5a');break;case'CN':_0xe1ee46=_0xfddd('0x5b');break;default:_0xe1ee46=_0xfddd('0x59');break;}var _0x358454={'method':_0xfddd('0x5c'),'uri':_0xe1ee46+_0xfddd('0x5d'),'qs':{'refresh_token':_0x2bef2f['refreshToken'],'client_id':_0x2bef2f[_0xfddd('0x5e')],'client_secret':_0x2bef2f[_0xfddd('0x5f')],'grant_type':_0xfddd('0x60')},'json':!![]};return rp(_0x358454)['then'](function(_0x70d5cc){if(_0x70d5cc[_0xfddd('0x61')]){_0xb82418(_0x70d5cc[_0xfddd('0x61')]);}else{_0x521f2e(_0xfddd('0x62'));}})['catch'](function(_0x305a20){_0x521f2e(_0x305a20);});});}exports['getFields']=function(_0x3bd8fe,_0xe57280,_0x21085b){var _0x352aee,_0x52529f,_0x1e4949,_0x4463de,_0x1bae87;return db[_0xfddd('0x2d')][_0xfddd('0x4d')]({'where':{'id':_0x3bd8fe['params']['id']},'attributes':['id',_0xfddd('0x63'),_0xfddd('0x58'),_0xfddd('0x5e'),_0xfddd('0x5f'),_0xfddd('0x64'),_0xfddd('0x65'),'refreshToken']})[_0xfddd('0x24')](handleEntityNotFound(_0xe57280,null))['then'](function(_0x7326b9){_0x1bae87=_0x7326b9;_0x352aee=_0x1bae87[_0xfddd('0x63')];_0x52529f=_0x352aee===_0xfddd('0x66')?'eu':_0xfddd('0x67');_0x1e4949=_0x1bae87[_0xfddd('0x64')];var _0x209c3a=_0x1e4949['slice'](-0x1);if(_0x209c3a==='/'||_0x209c3a==='\x5c'||_0x209c3a===':'){_0x1e4949=_0x1e4949[_0xfddd('0x68')](0x0,_0x1e4949[_0xfddd('0x69')](_0x209c3a));}if(!_0x1bae87[_0xfddd('0x6a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x1bae87);})['then'](function(_0x2788e2){if(_0x2788e2){return rp({'method':_0xfddd('0x6b'),'uri':util[_0xfddd('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x52529f),'qs':{'module':_0xfddd('0x6d')},'headers':{'Authorization':_0xfddd('0x6e')+_0x2788e2},'json':!![]});}})['then'](function(_0x1efbd8){if(_0x1efbd8){if(_0x1efbd8[_0xfddd('0x6f')]&&_0x1efbd8[_0xfddd('0x6f')][_0xfddd('0x27')]){throw new Error(_0x1efbd8[_0xfddd('0x6f')]['error'][_0xfddd('0x70')]);}var _0x37e75f=[];var _0x3dcefb=[];var _0x4aa953=[_0xfddd('0x71'),_0xfddd('0x72'),_0xfddd('0x73'),_0xfddd('0x74'),_0xfddd('0x75'),_0xfddd('0x76'),_0xfddd('0x77'),_0xfddd('0x78')];_0x3dcefb=_[_0xfddd('0x79')](_0x1efbd8[_0xfddd('0x36')],function(_0x5d571b){return _0x4aa953[_0xfddd('0x7a')](_0x5d571b[_0xfddd('0x7b')]);});for(var _0x39ea34=0x0;_0x39ea34<_0x3dcefb[_0xfddd('0x37')];_0x39ea34++){if(_0x3dcefb[_0x39ea34][_0xfddd('0x7c')]===![]){_0x37e75f[_0xfddd('0x7d')]({'id':_0x3dcefb[_0x39ea34]['id'],'name':_0x3dcefb[_0x39ea34][_0xfddd('0x7e')],'custom':_0x3dcefb[_0x39ea34][_0xfddd('0x7f')],'options':_0x3dcefb[_0x39ea34][_0xfddd('0x80')]===_0xfddd('0x81')&&_0x3dcefb[_0x39ea34][_0xfddd('0x82')]['length']>-0x1?_['map'](_0x3dcefb[_0x39ea34][_0xfddd('0x82')],function(_0x58a7b5){return{'name':_0x58a7b5,'value':_0x58a7b5};}):[]});}}return{'count':_0x37e75f[_0xfddd('0x37')],'rows':_0x37e75f};}else{return{'count':0x0,'rows':[]};}})[_0xfddd('0x24')](respondWithResult(_0xe57280,null))[_0xfddd('0x45')](function(_0x30431b){var _0x5a5606=_0x3bd8fe[_0xfddd('0x32')][_0xfddd('0x83')]?0x1f4:_0x30431b[_0xfddd('0x84')]||0x1f4;logger[_0xfddd('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xfddd('0x85'),_0x5a5606,JSON[_0xfddd('0x86')](_0x30431b));delete _0x30431b[_0xfddd('0x29')];if(_0x5a5606===0x191){_0x5a5606=0x190;}_0xe57280[_0xfddd('0x19')](_0x5a5606)['send'](_0x3bd8fe['query'][_0xfddd('0x83')]?{'message':_0xfddd('0x87'),'statusCode':_0x30431b[_0xfddd('0x84')]}:_0x30431b);});}; \ No newline at end of file +var _0xd868=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','options','ZohoAccount','includeAll','findAll','rows','show','params','fields','include','find','create','body','catch','getConfigurations','findOne','ZohoConfiguration','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xd868,0xf9));var _0x8d86=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xd868[_0x5e36d1];return _0x950b9e;};'use strict';var emlformat=require(_0x8d86('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8d86('0x1'));var rp=require(_0x8d86('0x2'));var moment=require(_0x8d86('0x3'));var BPromise=require(_0x8d86('0x4'));var Mustache=require(_0x8d86('0x5'));var util=require(_0x8d86('0x6'));var path=require('path');var sox=require(_0x8d86('0x7'));var csv=require('to-csv');var ejs=require(_0x8d86('0x8'));var fs=require('fs');var fs_extra=require(_0x8d86('0x9'));var _=require(_0x8d86('0xa'));var squel=require(_0x8d86('0xb'));var crypto=require('crypto');var jsforce=require(_0x8d86('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8d86('0xd'));var Papa=require(_0x8d86('0xe'));var Redis=require(_0x8d86('0xf'));var authService=require(_0x8d86('0x10'));var qs=require(_0x8d86('0x11'));var as=require(_0x8d86('0x12'));var hardwareService=require(_0x8d86('0x13'));var logger=require(_0x8d86('0x14'))('api');var utils=require(_0x8d86('0x15'));var config=require(_0x8d86('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d86('0x17'))['db'];var integrations=require(_0x8d86('0x18'));function respondWithStatusCode(_0x49c7cc,_0x259be5){_0x259be5=_0x259be5||0xcc;return function(_0x485dde){if(_0x485dde){return _0x49c7cc[_0x8d86('0x19')](_0x259be5);}return _0x49c7cc[_0x8d86('0x1a')](_0x259be5)['end']();};}function respondWithResult(_0x3449b8,_0x287780){_0x287780=_0x287780||0xc8;return function(_0x240040){if(_0x240040){return _0x3449b8['status'](_0x287780)[_0x8d86('0x1b')](_0x240040);}};}function respondWithFilteredResult(_0x5d6a5e,_0x4b4a62){return function(_0x2a8e1b){if(_0x2a8e1b){var _0x5d46f7=typeof _0x4b4a62[_0x8d86('0x1c')]===_0x8d86('0x1d')&&typeof _0x4b4a62[_0x8d86('0x1e')]==='undefined';var _0x17f122=_0x2a8e1b[_0x8d86('0x1f')];var _0x4ccc88=_0x5d46f7?0x0:_0x4b4a62[_0x8d86('0x1c')];var _0x5c4874=_0x5d46f7?_0x2a8e1b[_0x8d86('0x1f')]:_0x4b4a62[_0x8d86('0x1c')]+_0x4b4a62[_0x8d86('0x1e')];var _0xa678f9;if(_0x5c4874>=_0x17f122){_0x5c4874=_0x17f122;_0xa678f9=0xc8;}else{_0xa678f9=0xce;}_0x5d6a5e[_0x8d86('0x1a')](_0xa678f9);return _0x5d6a5e['set'](_0x8d86('0x20'),_0x4ccc88+'-'+_0x5c4874+'/'+_0x17f122)['json'](_0x2a8e1b);}return null;};}function patchUpdates(_0x32b427){return function(_0xb1d76d){try{jsonpatch[_0x8d86('0x21')](_0xb1d76d,_0x32b427,!![]);}catch(_0x1044ee){return BPromise[_0x8d86('0x22')](_0x1044ee);}return _0xb1d76d[_0x8d86('0x23')]();};}function saveUpdates(_0x1a6523,_0x5bdf54){return function(_0x36cf12){if(_0x36cf12){return _0x36cf12[_0x8d86('0x24')](_0x1a6523)[_0x8d86('0x25')](function(_0x215663){return _0x215663;});}return null;};}function removeEntity(_0xfa585a,_0x2d0270){return function(_0x5941b5){if(_0x5941b5){return _0x5941b5[_0x8d86('0x26')]()['then'](function(){_0xfa585a[_0x8d86('0x1a')](0xcc)[_0x8d86('0x27')]();});}};}function handleEntityNotFound(_0x3f9974,_0x2d5d4b){return function(_0x87862b){if(!_0x87862b){_0x3f9974[_0x8d86('0x19')](0x194);}return _0x87862b;};}function handleError(_0x58fb01,_0x3fa90d){_0x3fa90d=_0x3fa90d||0x1f4;return function(_0x5c8e08){logger['error'](_0x5c8e08[_0x8d86('0x28')]);if(_0x5c8e08['name']){delete _0x5c8e08[_0x8d86('0x29')];}_0x58fb01[_0x8d86('0x1a')](_0x3fa90d)[_0x8d86('0x2a')](_0x5c8e08);};}exports[_0x8d86('0x2b')]=function(_0x428692,_0x394b4d){var _0x4999e6={},_0x5da4b4={},_0x2a19c7={'count':0x0,'rows':[]};var _0x7e8649=_[_0x8d86('0x2c')](db['ZohoAccount'][_0x8d86('0x2d')],function(_0x7664e2){return{'name':_0x7664e2[_0x8d86('0x2e')],'type':_0x7664e2[_0x8d86('0x2f')][_0x8d86('0x30')]};});_0x5da4b4['model']=_['map'](_0x7e8649,_0x8d86('0x29'));_0x5da4b4[_0x8d86('0x31')]=_[_0x8d86('0x32')](_0x428692[_0x8d86('0x31')]);_0x5da4b4['filters']=_[_0x8d86('0x33')](_0x5da4b4[_0x8d86('0x34')],_0x5da4b4[_0x8d86('0x31')]);_0x4999e6[_0x8d86('0x35')]=_[_0x8d86('0x33')](_0x5da4b4[_0x8d86('0x34')],qs['fields'](_0x428692['query']['fields']));_0x4999e6[_0x8d86('0x35')]=_0x4999e6[_0x8d86('0x35')][_0x8d86('0x36')]?_0x4999e6[_0x8d86('0x35')]:_0x5da4b4[_0x8d86('0x34')];if(!_0x428692['query'][_0x8d86('0x37')]('nolimit')){_0x4999e6[_0x8d86('0x1e')]=qs[_0x8d86('0x1e')](_0x428692[_0x8d86('0x31')][_0x8d86('0x1e')]);_0x4999e6[_0x8d86('0x1c')]=qs['offset'](_0x428692[_0x8d86('0x31')][_0x8d86('0x1c')]);}_0x4999e6[_0x8d86('0x38')]=qs[_0x8d86('0x39')](_0x428692[_0x8d86('0x31')][_0x8d86('0x39')]);_0x4999e6[_0x8d86('0x3a')]=qs[_0x8d86('0x3b')](_[_0x8d86('0x3c')](_0x428692[_0x8d86('0x31')],_0x5da4b4[_0x8d86('0x3b')]),_0x7e8649);if(_0x428692['query']['filter']){_0x4999e6[_0x8d86('0x3a')]=_['merge'](_0x4999e6[_0x8d86('0x3a')],{'$or':_[_0x8d86('0x2c')](_0x7e8649,function(_0x501f2b){if(_0x501f2b[_0x8d86('0x2f')]!==_0x8d86('0x3d')){var _0x7540f6={};_0x7540f6[_0x501f2b[_0x8d86('0x29')]]={'$like':'%'+_0x428692[_0x8d86('0x31')]['filter']+'%'};return _0x7540f6;}})});}_0x4999e6=_[_0x8d86('0x3e')]({},_0x4999e6,_0x428692[_0x8d86('0x3f')]);var _0x49e87f={'where':_0x4999e6['where']};return db[_0x8d86('0x40')][_0x8d86('0x1f')](_0x49e87f)[_0x8d86('0x25')](function(_0x447f75){_0x2a19c7[_0x8d86('0x1f')]=_0x447f75;if(_0x428692[_0x8d86('0x31')][_0x8d86('0x41')]){_0x4999e6['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x8d86('0x42')](_0x4999e6);})['then'](function(_0x30f538){_0x2a19c7[_0x8d86('0x43')]=_0x30f538;return _0x2a19c7;})[_0x8d86('0x25')](respondWithFilteredResult(_0x394b4d,_0x4999e6))['catch'](handleError(_0x394b4d,null));};exports[_0x8d86('0x44')]=function(_0x2266a7,_0x4465d0){var _0x486499={'raw':![],'where':{'id':_0x2266a7[_0x8d86('0x45')]['id']}},_0x9c7392={};_0x9c7392['model']=_[_0x8d86('0x32')](db['ZohoAccount']['rawAttributes']);_0x9c7392['query']=_['keys'](_0x2266a7['query']);_0x9c7392[_0x8d86('0x3b')]=_[_0x8d86('0x33')](_0x9c7392[_0x8d86('0x34')],_0x9c7392['query']);_0x486499[_0x8d86('0x35')]=_[_0x8d86('0x33')](_0x9c7392[_0x8d86('0x34')],qs[_0x8d86('0x46')](_0x2266a7[_0x8d86('0x31')][_0x8d86('0x46')]));_0x486499[_0x8d86('0x35')]=_0x486499[_0x8d86('0x35')][_0x8d86('0x36')]?_0x486499[_0x8d86('0x35')]:_0x9c7392[_0x8d86('0x34')];if(_0x2266a7[_0x8d86('0x31')][_0x8d86('0x41')]){_0x486499[_0x8d86('0x47')]=[{'all':!![]}];}_0x486499=_[_0x8d86('0x3e')]({},_0x486499,_0x2266a7[_0x8d86('0x3f')]);return db[_0x8d86('0x40')][_0x8d86('0x48')](_0x486499)[_0x8d86('0x25')](handleEntityNotFound(_0x4465d0,null))['then'](respondWithResult(_0x4465d0,null))['catch'](handleError(_0x4465d0,null));};exports[_0x8d86('0x49')]=function(_0x3f93fb,_0xfef113){return db[_0x8d86('0x40')][_0x8d86('0x49')](_0x3f93fb[_0x8d86('0x4a')],{})[_0x8d86('0x25')](respondWithResult(_0xfef113,0xc9))[_0x8d86('0x4b')](handleError(_0xfef113,null));};exports['update']=function(_0x231697,_0x5191e2){if(_0x231697[_0x8d86('0x4a')]['id']){delete _0x231697['body']['id'];}return db[_0x8d86('0x40')][_0x8d86('0x48')]({'where':{'id':_0x231697[_0x8d86('0x45')]['id']}})[_0x8d86('0x25')](handleEntityNotFound(_0x5191e2,null))[_0x8d86('0x25')](saveUpdates(_0x231697[_0x8d86('0x4a')],null))['then'](respondWithResult(_0x5191e2,null))[_0x8d86('0x4b')](handleError(_0x5191e2,null));};exports[_0x8d86('0x26')]=function(_0x35f4c1,_0x340c27){return db[_0x8d86('0x40')][_0x8d86('0x48')]({'where':{'id':_0x35f4c1[_0x8d86('0x45')]['id']}})[_0x8d86('0x25')](handleEntityNotFound(_0x340c27,null))[_0x8d86('0x25')](removeEntity(_0x340c27,null))[_0x8d86('0x4b')](handleError(_0x340c27,null));};exports[_0x8d86('0x4c')]=function(_0x4286b7,_0x496409,_0x531a9a){var _0x28d1ac={};var _0xdba331={};var _0x1e2978;var _0x59036f;return db['ZohoAccount'][_0x8d86('0x4d')]({'where':{'id':_0x4286b7[_0x8d86('0x45')]['id']}})[_0x8d86('0x25')](handleEntityNotFound(_0x496409,null))[_0x8d86('0x25')](function(_0x1ed366){if(_0x1ed366){_0x1e2978=_0x1ed366;_0xdba331[_0x8d86('0x34')]=_[_0x8d86('0x32')](db[_0x8d86('0x4e')][_0x8d86('0x2d')]);_0xdba331[_0x8d86('0x31')]=_[_0x8d86('0x32')](_0x4286b7['query']);_0xdba331[_0x8d86('0x3b')]=_[_0x8d86('0x33')](_0xdba331['model'],_0xdba331['query']);_0x28d1ac[_0x8d86('0x35')]=_['intersection'](_0xdba331[_0x8d86('0x34')],qs[_0x8d86('0x46')](_0x4286b7[_0x8d86('0x31')][_0x8d86('0x46')]));_0x28d1ac['attributes']=_0x28d1ac[_0x8d86('0x35')][_0x8d86('0x36')]?_0x28d1ac[_0x8d86('0x35')]:_0xdba331['model'];_0x28d1ac[_0x8d86('0x38')]=qs['sort'](_0x4286b7[_0x8d86('0x31')][_0x8d86('0x39')]);_0x28d1ac[_0x8d86('0x3a')]=qs[_0x8d86('0x3b')](_[_0x8d86('0x3c')](_0x4286b7['query'],_0xdba331['filters']));if(_0x4286b7[_0x8d86('0x31')][_0x8d86('0x4f')]){_0x28d1ac['where']=_[_0x8d86('0x3e')](_0x28d1ac[_0x8d86('0x3a')],{'$or':_[_0x8d86('0x2c')](_0x28d1ac[_0x8d86('0x35')],function(_0x34c879){var _0xed4000={};_0xed4000[_0x34c879]={'$like':'%'+_0x4286b7[_0x8d86('0x31')][_0x8d86('0x4f')]+'%'};return _0xed4000;})});}_0x28d1ac=_[_0x8d86('0x3e')]({},_0x28d1ac,_0x4286b7[_0x8d86('0x3f')]);return _0x1e2978[_0x8d86('0x4c')](_0x28d1ac);}})[_0x8d86('0x25')](function(_0x23f4ef){if(_0x23f4ef){_0x59036f=_0x23f4ef[_0x8d86('0x36')];if(!_0x4286b7['query'][_0x8d86('0x37')](_0x8d86('0x50'))){_0x28d1ac[_0x8d86('0x1e')]=qs[_0x8d86('0x1e')](_0x4286b7['query'][_0x8d86('0x1e')]);_0x28d1ac[_0x8d86('0x1c')]=qs[_0x8d86('0x1c')](_0x4286b7[_0x8d86('0x31')][_0x8d86('0x1c')]);}return _0x1e2978[_0x8d86('0x4c')](_0x28d1ac);}})[_0x8d86('0x25')](function(_0x1b4d0f){if(_0x1b4d0f){return _0x1b4d0f?{'count':_0x59036f,'rows':_0x1b4d0f}:null;}})[_0x8d86('0x25')](respondWithResult(_0x496409,null))[_0x8d86('0x4b')](handleError(_0x496409,null));};exports[_0x8d86('0x51')]=function(_0x1214b3,_0x3f0f79,_0x1342a7){if(_0x1214b3[_0x8d86('0x4a')]['id']){delete _0x1214b3[_0x8d86('0x4a')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x1214b3[_0x8d86('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f0f79,null))['then'](function(_0x359a6e){if(_0x359a6e){_0x1214b3['body'][_0x8d86('0x52')]=_0x359a6e['id'];_0x1214b3[_0x8d86('0x4a')][_0x8d86('0x53')]=integrations[_0x8d86('0x54')](_0x1214b3[_0x8d86('0x4a')][_0x8d86('0x55')],_0x1214b3[_0x8d86('0x4a')]['type']);_0x1214b3[_0x8d86('0x4a')]['Descriptions']=integrations[_0x8d86('0x56')](_0x1214b3[_0x8d86('0x4a')][_0x8d86('0x55')],_0x1214b3[_0x8d86('0x4a')][_0x8d86('0x2f')]);return db['ZohoConfiguration'][_0x8d86('0x49')](_0x1214b3[_0x8d86('0x4a')],{'include':[{'model':db[_0x8d86('0x57')],'as':_0x8d86('0x53')},{'model':db[_0x8d86('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3f0f79,null))[_0x8d86('0x4b')](handleError(_0x3f0f79,null));};function getAccessToken(_0x43eec2){return new Promise(function(_0x2d8316,_0x311d38){var _0x5d08a7;switch(_0x43eec2[_0x8d86('0x58')]){case'US':_0x5d08a7='https://accounts.zoho.com';break;case'AU':_0x5d08a7='https://accounts.zoho.com.au';break;case'EU':_0x5d08a7=_0x8d86('0x59');break;case'IN':_0x5d08a7=_0x8d86('0x5a');break;case'CN':_0x5d08a7=_0x8d86('0x5b');break;default:_0x5d08a7=_0x8d86('0x59');break;}var _0x56c1df={'method':'POST','uri':_0x5d08a7+'/oauth/v2/token','qs':{'refresh_token':_0x43eec2[_0x8d86('0x5c')],'client_id':_0x43eec2[_0x8d86('0x5d')],'client_secret':_0x43eec2[_0x8d86('0x5e')],'grant_type':_0x8d86('0x5f')},'json':!![]};return rp(_0x56c1df)[_0x8d86('0x25')](function(_0x57a5f2){if(_0x57a5f2['access_token']){_0x2d8316(_0x57a5f2[_0x8d86('0x60')]);}else{_0x311d38(_0x8d86('0x61'));}})[_0x8d86('0x4b')](function(_0x3a24b3){_0x311d38(_0x3a24b3);});});}exports[_0x8d86('0x62')]=function(_0x3ec66c,_0x4f2d20,_0x3b8351){var _0x44c2eb,_0x22c5ef,_0x2b530d,_0x198af6,_0x2eada4;return db[_0x8d86('0x40')][_0x8d86('0x4d')]({'where':{'id':_0x3ec66c[_0x8d86('0x45')]['id']},'attributes':['id',_0x8d86('0x63'),'zone','clientId',_0x8d86('0x5e'),_0x8d86('0x64'),_0x8d86('0x65'),'refreshToken']})[_0x8d86('0x25')](handleEntityNotFound(_0x4f2d20,null))[_0x8d86('0x25')](function(_0xeeaee4){_0x2eada4=_0xeeaee4;_0x44c2eb=_0x2eada4[_0x8d86('0x63')];_0x22c5ef=_0x44c2eb==='zoho.eu'?'eu':'com';_0x2b530d=_0x2eada4['serverUrl'];var _0x1a97d1=_0x2b530d['slice'](-0x1);if(_0x1a97d1==='/'||_0x1a97d1==='\x5c'||_0x1a97d1===':'){_0x2b530d=_0x2b530d[_0x8d86('0x66')](0x0,_0x2b530d[_0x8d86('0x67')](_0x1a97d1));}if(!_0x2eada4[_0x8d86('0x5c')]){throw new Error(_0x8d86('0x68'));}return getAccessToken(_0x2eada4);})[_0x8d86('0x25')](function(_0xff0040){if(_0xff0040){return rp({'method':_0x8d86('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x22c5ef),'qs':{'module':_0x8d86('0x6a')},'headers':{'Authorization':_0x8d86('0x6b')+_0xff0040},'json':!![]});}})['then'](function(_0x3139d0){if(_0x3139d0){if(_0x3139d0[_0x8d86('0x6c')]&&_0x3139d0[_0x8d86('0x6c')][_0x8d86('0x6d')]){throw new Error(_0x3139d0[_0x8d86('0x6c')]['error'][_0x8d86('0x6e')]);}var _0x194aea=[];var _0x30c511=[];var _0x1e0889=[_0x8d86('0x6f'),_0x8d86('0x70'),_0x8d86('0x71'),_0x8d86('0x72'),_0x8d86('0x73'),_0x8d86('0x74'),'Call_Start_Time',_0x8d86('0x75')];_0x30c511=_[_0x8d86('0x76')](_0x3139d0[_0x8d86('0x46')],function(_0x5dae1d){return _0x1e0889[_0x8d86('0x77')](_0x5dae1d['api_name']);});for(var _0x308ed4=0x0;_0x308ed4<_0x30c511['length'];_0x308ed4++){if(_0x30c511[_0x308ed4][_0x8d86('0x78')]===![]){_0x194aea[_0x8d86('0x79')]({'id':_0x30c511[_0x308ed4]['id'],'name':_0x30c511[_0x308ed4][_0x8d86('0x7a')],'custom':_0x30c511[_0x308ed4][_0x8d86('0x7b')],'options':_0x30c511[_0x308ed4][_0x8d86('0x7c')]===_0x8d86('0x7d')&&_0x30c511[_0x308ed4][_0x8d86('0x7e')][_0x8d86('0x36')]>-0x1?_[_0x8d86('0x2c')](_0x30c511[_0x308ed4]['pick_list_values'],function(_0x1d105f){return{'name':_0x1d105f,'value':_0x1d105f};}):[]});}}return{'count':_0x194aea[_0x8d86('0x36')],'rows':_0x194aea};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4f2d20,null))[_0x8d86('0x4b')](function(_0x590e77){var _0x1830c4=_0x3ec66c[_0x8d86('0x31')][_0x8d86('0x7f')]?0x1f4:_0x590e77['statusCode']||0x1f4;logger[_0x8d86('0x6d')](_0x8d86('0x80'),_0x8d86('0x62'),_0x1830c4,JSON[_0x8d86('0x81')](_0x590e77));delete _0x590e77[_0x8d86('0x29')];if(_0x1830c4===0x191){_0x1830c4=0x190;}_0x4f2d20[_0x8d86('0x1a')](_0x1830c4)[_0x8d86('0x2a')](_0x3ec66c['query'][_0x8d86('0x7f')]?{'message':_0x8d86('0x82'),'statusCode':_0x590e77[_0x8d86('0x83')]}:_0x590e77);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index fa40308..e8f19f0 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 _0x13e6=['code','host','slice','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','authorization_code','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','parse','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x13e6,0x1b3));var _0x613e=function(_0x16ada8,_0x44a8cf){_0x16ada8=_0x16ada8-0x0;var _0x58fac9=_0x13e6[_0x16ada8];return _0x58fac9;};'use strict';var _=require(_0x613e('0x0'));var util=require(_0x613e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x613e('0x2'));var BPromise=require(_0x613e('0x3'));var rp=require(_0x613e('0x4'));var fs=require('fs');var path=require(_0x613e('0x5'));var rimraf=require(_0x613e('0x6'));var config=require(_0x613e('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x613e('0x8'));module[_0x613e('0x9')]=function(_0x37e21f,_0x2adb6c){return _0x37e21f['define'](_0x613e('0xa'),attributes,{'tableName':_0x613e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9931ae,_0x5293d1,_0x1beeda){if(_0x9931ae['changed']('zone')||_0x9931ae[_0x613e('0xc')](_0x613e('0xd'))||_0x9931ae['changed'](_0x613e('0xe'))||_0x9931ae[_0x613e('0xc')](_0x613e('0xf'))||_0x9931ae[_0x613e('0xc')](_0x613e('0x10'))||_0x9931ae[_0x613e('0xc')](_0x613e('0x11'))){var _0x5e8dc6,_0x2ac3cf;_0x5e8dc6=_0x9931ae[_0x613e('0xd')];var _0x5a0d9e=_0x5e8dc6[_0x613e('0x12')](-0x1);if(_0x5a0d9e==='/'||_0x5a0d9e==='\x5c'||_0x5a0d9e===':'){_0x5e8dc6=_0x5e8dc6[_0x613e('0x13')](0x0,_0x5e8dc6[_0x613e('0x14')](_0x5a0d9e));}switch(_0x9931ae[_0x613e('0x15')]){case'US':_0x2ac3cf=_0x613e('0x16');break;case'AU':_0x2ac3cf=_0x613e('0x17');break;case'IN':_0x2ac3cf=_0x613e('0x18');break;case'CN':_0x2ac3cf=_0x613e('0x19');break;default:_0x2ac3cf=_0x613e('0x1a');break;}var _0x1b16d4={'method':_0x613e('0x1b'),'uri':_0x2ac3cf+_0x613e('0x1c'),'form':{'grant_type':_0x613e('0x1d'),'client_id':_0x9931ae[_0x613e('0xe')],'client_secret':_0x9931ae[_0x613e('0xf')],'redirect_uri':_0x9931ae[_0x613e('0xd')],'code':_0x9931ae['code']},'headers':{'Content-Type':_0x613e('0x1e')}};return rp(_0x1b16d4)['then'](function(_0x45eaf2){var _0x45f79e=JSON['parse'](_0x45eaf2);if(_0x45f79e[_0x613e('0x1f')]){_0x9931ae[_0x613e('0x20')]=_0x45f79e['refresh_token'];logger[_0x613e('0x21')](util[_0x613e('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9931ae[_0x613e('0x23')],_0x9931ae['id']));}else{logger[_0x613e('0x24')](util['format'](_0x613e('0x25'),_0x9931ae[_0x613e('0x23')],_0x9931ae['id']),util[_0x613e('0x26')](_0x45f79e,{'showHidden':![],'depth':null}));}return _0x1beeda(null,_0x5293d1);})[_0x613e('0x27')](function(_0x14b8d8){logger[_0x613e('0x24')](util[_0x613e('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9931ae[_0x613e('0x23')],_0x9931ae['id']),util[_0x613e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1beeda(_0x14b8d8);});}else{return _0x1beeda(null,_0x5293d1);}},'beforeUpdate':function(_0x2c74fb,_0x3366d6,_0xe084){if(_0x2c74fb[_0x613e('0xc')](_0x613e('0x15'))||_0x2c74fb[_0x613e('0xc')](_0x613e('0xd'))||_0x2c74fb[_0x613e('0xc')](_0x613e('0xe'))||_0x2c74fb['changed']('clientSecret')||_0x2c74fb['changed'](_0x613e('0x10'))||_0x2c74fb[_0x613e('0xc')](_0x613e('0x11'))){var _0x1bfbcb,_0x3936ab;_0x1bfbcb=_0x2c74fb[_0x613e('0xd')];var _0x474f13=_0x1bfbcb[_0x613e('0x12')](-0x1);if(_0x474f13==='/'||_0x474f13==='\x5c'||_0x474f13===':'){_0x1bfbcb=_0x1bfbcb[_0x613e('0x13')](0x0,_0x1bfbcb[_0x613e('0x14')](_0x474f13));}switch(_0x2c74fb[_0x613e('0x15')]){case'US':_0x3936ab=_0x613e('0x16');break;case'AU':_0x3936ab=_0x613e('0x17');break;case'IN':_0x3936ab=_0x613e('0x18');break;case'CN':_0x3936ab=_0x613e('0x19');break;default:_0x3936ab=_0x613e('0x1a');break;}var _0x239c27={'method':'POST','uri':_0x3936ab+_0x613e('0x1c'),'form':{'grant_type':_0x613e('0x1d'),'client_id':_0x2c74fb[_0x613e('0xe')],'client_secret':_0x2c74fb[_0x613e('0xf')],'redirect_uri':_0x2c74fb[_0x613e('0xd')],'code':_0x2c74fb[_0x613e('0x10')]},'headers':{'Content-Type':_0x613e('0x1e')}};return rp(_0x239c27)['then'](function(_0xa5d976){var _0x5c2e17=JSON[_0x613e('0x28')](_0xa5d976);if(_0x5c2e17['refresh_token']){_0x2c74fb[_0x613e('0x20')]=_0x5c2e17[_0x613e('0x1f')];logger[_0x613e('0x21')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2c74fb[_0x613e('0x23')],_0x2c74fb['id']));}else{logger[_0x613e('0x24')](util['format'](_0x613e('0x25'),_0x2c74fb['name'],_0x2c74fb['id']),util[_0x613e('0x26')](_0x5c2e17,{'showHidden':![],'depth':null}));}return _0xe084(null,_0x3366d6);})[_0x613e('0x27')](function(_0xff0d95){logger['error'](util[_0x613e('0x22')](_0x613e('0x25'),_0x2c74fb[_0x613e('0x23')],_0x2c74fb['id']),util[_0x613e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0xe084(_0xff0d95);});}else{return _0xe084(null,_0x3366d6);}}}});}; \ No newline at end of file +var _0x36c5=['host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','format','https://accounts.zoho.com','parse','info','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x36c5,0x120));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x536c('0x0'));var util=require(_0x536c('0x1'));var logger=require(_0x536c('0x2'))(_0x536c('0x3'));var moment=require(_0x536c('0x4'));var BPromise=require(_0x536c('0x5'));var rp=require(_0x536c('0x6'));var fs=require('fs');var path=require(_0x536c('0x7'));var rimraf=require(_0x536c('0x8'));var config=require(_0x536c('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x536c('0xa'));module[_0x536c('0xb')]=function(_0x48d0ea,_0x19e6de){return _0x48d0ea['define'](_0x536c('0xc'),attributes,{'tableName':_0x536c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x219638,_0x17b460,_0x91acf){if(_0x219638[_0x536c('0xe')](_0x536c('0xf'))||_0x219638[_0x536c('0xe')](_0x536c('0x10'))||_0x219638[_0x536c('0xe')](_0x536c('0x11'))||_0x219638[_0x536c('0xe')](_0x536c('0x12'))||_0x219638['changed'](_0x536c('0x13'))||_0x219638[_0x536c('0xe')](_0x536c('0x14'))){var _0x1901aa,_0x274d22;_0x1901aa=_0x219638[_0x536c('0x10')];var _0x219fe9=_0x1901aa[_0x536c('0x15')](-0x1);if(_0x219fe9==='/'||_0x219fe9==='\x5c'||_0x219fe9===':'){_0x1901aa=_0x1901aa[_0x536c('0x16')](0x0,_0x1901aa[_0x536c('0x17')](_0x219fe9));}switch(_0x219638[_0x536c('0xf')]){case'US':_0x274d22='https://accounts.zoho.com';break;case'AU':_0x274d22=_0x536c('0x18');break;case'IN':_0x274d22=_0x536c('0x19');break;case'CN':_0x274d22=_0x536c('0x1a');break;default:_0x274d22=_0x536c('0x1b');break;}var _0x4d50fc={'method':_0x536c('0x1c'),'uri':_0x274d22+_0x536c('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x219638[_0x536c('0x11')],'client_secret':_0x219638[_0x536c('0x12')],'redirect_uri':_0x219638['serverUrl'],'code':_0x219638[_0x536c('0x13')]},'headers':{'Content-Type':_0x536c('0x1e')}};return rp(_0x4d50fc)[_0x536c('0x1f')](function(_0x3a494e){var _0x2dfeb1=JSON['parse'](_0x3a494e);if(_0x2dfeb1[_0x536c('0x20')]){_0x219638[_0x536c('0x21')]=_0x2dfeb1[_0x536c('0x20')];logger['info'](util['format'](_0x536c('0x22'),_0x219638[_0x536c('0x23')],_0x219638['id']));}else{logger[_0x536c('0x24')](util['format'](_0x536c('0x25'),_0x219638[_0x536c('0x23')],_0x219638['id']),util[_0x536c('0x26')](_0x2dfeb1,{'showHidden':![],'depth':null}));}return _0x91acf(null,_0x17b460);})[_0x536c('0x27')](function(_0x386d14){logger[_0x536c('0x24')](util[_0x536c('0x28')](_0x536c('0x25'),_0x219638[_0x536c('0x23')],_0x219638['id']),util[_0x536c('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x91acf(_0x386d14);});}else{return _0x91acf(null,_0x17b460);}},'beforeUpdate':function(_0x434146,_0x48898b,_0x3b6310){if(_0x434146[_0x536c('0xe')]('zone')||_0x434146[_0x536c('0xe')](_0x536c('0x10'))||_0x434146[_0x536c('0xe')](_0x536c('0x11'))||_0x434146[_0x536c('0xe')](_0x536c('0x12'))||_0x434146[_0x536c('0xe')](_0x536c('0x13'))||_0x434146['changed']('host')){var _0x1bb59f,_0x444946;_0x1bb59f=_0x434146[_0x536c('0x10')];var _0x4f5892=_0x1bb59f['slice'](-0x1);if(_0x4f5892==='/'||_0x4f5892==='\x5c'||_0x4f5892===':'){_0x1bb59f=_0x1bb59f[_0x536c('0x16')](0x0,_0x1bb59f['lastIndexOf'](_0x4f5892));}switch(_0x434146[_0x536c('0xf')]){case'US':_0x444946=_0x536c('0x29');break;case'AU':_0x444946='https://accounts.zoho.com.au';break;case'IN':_0x444946='https://accounts.zoho.in';break;case'CN':_0x444946='https://accounts.zoho.com.cn';break;default:_0x444946=_0x536c('0x1b');break;}var _0x179500={'method':_0x536c('0x1c'),'uri':_0x444946+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x434146['clientId'],'client_secret':_0x434146[_0x536c('0x12')],'redirect_uri':_0x434146[_0x536c('0x10')],'code':_0x434146[_0x536c('0x13')]},'headers':{'Content-Type':_0x536c('0x1e')}};return rp(_0x179500)[_0x536c('0x1f')](function(_0x56ade4){var _0x304488=JSON[_0x536c('0x2a')](_0x56ade4);if(_0x304488[_0x536c('0x20')]){_0x434146['refreshToken']=_0x304488[_0x536c('0x20')];logger[_0x536c('0x2b')](util[_0x536c('0x28')](_0x536c('0x22'),_0x434146[_0x536c('0x23')],_0x434146['id']));}else{logger[_0x536c('0x24')](util[_0x536c('0x28')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x434146[_0x536c('0x23')],_0x434146['id']),util[_0x536c('0x26')](_0x304488,{'showHidden':![],'depth':null}));}return _0x3b6310(null,_0x48898b);})[_0x536c('0x27')](function(_0x3a9d54){logger[_0x536c('0x24')](util['format'](_0x536c('0x25'),_0x434146[_0x536c('0x23')],_0x434146['id']),util[_0x536c('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3b6310(_0x3a9d54);});}else{return _0x3b6310(null,_0x48898b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 28b5e37..5ac10f0 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 _0x5458=['catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1fd1c9,_0x35ffa5){var _0x128bbd=function(_0x3832af){while(--_0x3832af){_0x1fd1c9['push'](_0x1fd1c9['shift']());}};_0x128bbd(++_0x35ffa5);}(_0x5458,0x1c7));var _0x8545=function(_0x178d9c,_0x3aaad3){_0x178d9c=_0x178d9c-0x0;var _0x9656c5=_0x5458[_0x178d9c];return _0x9656c5;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require('bluebird');var rs=require(_0x8545('0x3'));var fs=require('fs');var Redis=require(_0x8545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8545('0x5'));var logger=require(_0x8545('0x6'))(_0x8545('0x7'));var config=require('../../config/environment');var jayson=require(_0x8545('0x8'));var client=jayson[_0x8545('0x9')][_0x8545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359d01,_0x5062c7,_0x291bc9){return new BPromise(function(_0x507ed8,_0x2cc4f4){return client[_0x8545('0xb')](_0x359d01,_0x291bc9)[_0x8545('0xc')](function(_0x10931d){logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));logger[_0x8545('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5062c7,_0x8545('0xf'),JSON[_0x8545('0x11')](_0x10931d));if(_0x10931d[_0x8545('0x12')]){if(_0x10931d['error'][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);return _0x2cc4f4(_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d['error'][_0x8545('0x14')]);return _0x507ed8(_0x10931d[_0x8545('0x12')]['message']);}else{logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));_0x507ed8(_0x10931d['result'][_0x8545('0x14')]);}})[_0x8545('0x15')](function(_0x3374f7){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5062c7,_0x3374f7);_0x2cc4f4(_0x3374f7);});});}exports[_0x8545('0x16')]=function(_0x122a4c){var _0x4e5733=this;return new Promise(function(_0x50e621,_0x564d3f){return db[_0x8545('0x17')][_0x8545('0x18')]({'raw':_0x122a4c[_0x8545('0x19')]?_0x122a4c[_0x8545('0x19')][_0x8545('0x1a')]===undefined?!![]:![]:!![],'where':_0x122a4c[_0x8545('0x19')]?_0x122a4c[_0x8545('0x19')][_0x8545('0x1b')]||null:null,'attributes':_0x122a4c['options']?_0x122a4c[_0x8545('0x19')][_0x8545('0x1c')]||null:null,'limit':_0x122a4c[_0x8545('0x19')]?_0x122a4c[_0x8545('0x19')][_0x8545('0x1d')]||null:null,'include':_0x122a4c[_0x8545('0x19')]?_0x122a4c['options'][_0x8545('0x1e')]?_['map'](_0x122a4c['options'][_0x8545('0x1e')],function(_0x20d2d9){return{'model':db[_0x20d2d9[_0x8545('0x1f')]],'as':_0x20d2d9['as'],'attributes':_0x20d2d9['attributes'],'include':_0x20d2d9[_0x8545('0x1e')]?_[_0x8545('0x20')](_0x20d2d9[_0x8545('0x1e')],function(_0x178ff8){return{'model':db[_0x178ff8['model']],'as':_0x178ff8['as'],'attributes':_0x178ff8[_0x8545('0x1c')],'include':_0x178ff8[_0x8545('0x1e')]?_[_0x8545('0x20')](_0x178ff8[_0x8545('0x1e')],function(_0x4bd30a){return{'model':db[_0x4bd30a['model']],'as':_0x4bd30a['as'],'attributes':_0x4bd30a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8545('0xc')](function(_0x2f244d){logger[_0x8545('0xd')]('GetZohoAccount',_0x122a4c);logger['debug'](_0x8545('0x16'),_0x122a4c,JSON[_0x8545('0x11')](_0x2f244d));_0x50e621(_0x2f244d);})[_0x8545('0x15')](function(_0x2ec6d6){logger[_0x8545('0x12')](_0x8545('0x16'),_0x2ec6d6[_0x8545('0x14')],_0x122a4c);_0x564d3f(_0x4e5733[_0x8545('0x12')](0x1f4,_0x2ec6d6[_0x8545('0x14')]));});});};exports[_0x8545('0x21')]=function(_0x576048){var _0x17e87e=this;return new Promise(function(_0x3b9659,_0x375289){return db['ZohoAccount']['find']({'raw':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1a')]===undefined?!![]:![]:!![],'where':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1b')]||null:null,'attributes':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1c')]||null:null,'include':_0x576048[_0x8545('0x19')]?_0x576048[_0x8545('0x19')][_0x8545('0x1e')]?_[_0x8545('0x20')](_0x576048[_0x8545('0x19')][_0x8545('0x1e')],function(_0x48b305){return{'model':db[_0x48b305[_0x8545('0x1f')]],'as':_0x48b305['as'],'attributes':_0x48b305['attributes'],'include':_0x48b305['include']?_[_0x8545('0x20')](_0x48b305['include'],function(_0x1efdc7){return{'model':db[_0x1efdc7['model']],'as':_0x1efdc7['as'],'attributes':_0x1efdc7[_0x8545('0x1c')],'include':_0x1efdc7[_0x8545('0x1e')]?_['map'](_0x1efdc7[_0x8545('0x1e')],function(_0x47a771){return{'model':db[_0x47a771['model']],'as':_0x47a771['as'],'attributes':_0x47a771[_0x8545('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8545('0xc')](function(_0x1b9ded){logger['info'](_0x8545('0x21'),_0x576048);logger[_0x8545('0x10')](_0x8545('0x21'),_0x576048,JSON['stringify'](_0x1b9ded));_0x3b9659(_0x1b9ded);})[_0x8545('0x15')](function(_0x113b81){logger[_0x8545('0x12')](_0x8545('0x21'),_0x113b81['message'],_0x576048);_0x375289(_0x17e87e[_0x8545('0x12')](0x1f4,_0x113b81[_0x8545('0x14')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowZohoAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','limit'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x5f2f,0x73));var _0xf5f2=function(_0x335840,_0xd1b8de){_0x335840=_0x335840-0x0;var _0x5e133f=_0x5f2f[_0x335840];return _0x5e133f;};'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')]('ZohoAccount,\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')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetZohoAccount',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetZohoAccount',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowZohoAccount',_0x153924);logger[_0xf5f2('0xf')]('ShowZohoAccount',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowZohoAccount',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2fb7b07..7ce5b26 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 _0xba83=['getFields','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2bf081,_0x13efdf){var _0x3e4faf=function(_0x24ca9c){while(--_0x24ca9c){_0x2bf081['push'](_0x2bf081['shift']());}};_0x3e4faf(++_0x13efdf);}(_0xba83,0x1c2));var _0x3ba8=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0xba83[_0x101802];return _0x5d61ce;};'use strict';var multer=require(_0x3ba8('0x0'));var util=require(_0x3ba8('0x1'));var path=require(_0x3ba8('0x2'));var timeout=require(_0x3ba8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3ba8('0x4'));var auth=require(_0x3ba8('0x5'));var interaction=require(_0x3ba8('0x6'));var config=require(_0x3ba8('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x3ba8('0x8')]('/',auth[_0x3ba8('0x9')](),controller[_0x3ba8('0xa')]);router[_0x3ba8('0x8')]('/:id',auth[_0x3ba8('0x9')](),controller[_0x3ba8('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x3ba8('0xc')]);router[_0x3ba8('0x8')]('/:id/subjects',auth[_0x3ba8('0x9')](),controller[_0x3ba8('0xd')]);router[_0x3ba8('0x8')](_0x3ba8('0xe'),auth[_0x3ba8('0x9')](),controller[_0x3ba8('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3ba8('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3ba8('0x11')]);router[_0x3ba8('0x12')](_0x3ba8('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x3ba8('0x14')]=router; \ No newline at end of file +var _0x4746=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x4746,0x11b));var _0x6474=function(_0x2c48d3,_0x4ca500){_0x2c48d3=_0x2c48d3-0x0;var _0x1f12aa=_0x4746[_0x2c48d3];return _0x1f12aa;};'use strict';var multer=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var path=require(_0x6474('0x2'));var timeout=require(_0x6474('0x3'));var express=require(_0x6474('0x4'));var router=express[_0x6474('0x5')]();var fs_extra=require(_0x6474('0x6'));var auth=require(_0x6474('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6474('0x8'));var controller=require(_0x6474('0x9'));router[_0x6474('0xa')]('/',auth[_0x6474('0xb')](),controller[_0x6474('0xc')]);router[_0x6474('0xa')](_0x6474('0xd'),auth[_0x6474('0xb')](),controller[_0x6474('0xe')]);router['get'](_0x6474('0xf'),auth[_0x6474('0xb')](),controller[_0x6474('0x10')]);router[_0x6474('0xa')](_0x6474('0x11'),auth[_0x6474('0xb')](),controller['getSubjects']);router[_0x6474('0xa')](_0x6474('0x12'),auth[_0x6474('0xb')](),controller[_0x6474('0x13')]);router['post']('/',auth[_0x6474('0xb')](),controller[_0x6474('0x14')]);router[_0x6474('0x15')](_0x6474('0xd'),auth[_0x6474('0xb')](),controller[_0x6474('0x16')]);router[_0x6474('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x6474('0x18')]);module[_0x6474('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f9948ad..5d208f2 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 _0x3f98=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead','nothing'];(function(_0x44c72b,_0x4dc6dd){var _0x3d0ec5=function(_0x144459){while(--_0x144459){_0x44c72b['push'](_0x44c72b['shift']());}};_0x3d0ec5(++_0x4dc6dd);}(_0x3f98,0x19a));var _0x83f9=function(_0x51355a,_0x54a655){_0x51355a=_0x51355a-0x0;var _0xadc9dd=_0x3f98[_0x51355a];return _0xadc9dd;};'use strict';var Sequelize=require(_0x83f9('0x0'));module[_0x83f9('0x1')]={'name':{'type':Sequelize[_0x83f9('0x2')]},'moduleCreate':{'type':Sequelize[_0x83f9('0x3')](_0x83f9('0x4'),'contact',_0x83f9('0x5')),'defaultValue':_0x83f9('0x4')},'moduleSearch':{'type':Sequelize[_0x83f9('0x3')](_0x83f9('0x6'),_0x83f9('0x7'),_0x83f9('0x4')),'defaultValue':_0x83f9('0x6')},'description':{'type':Sequelize[_0x83f9('0x2')]}}; \ No newline at end of file +var _0xef6c=['ENUM','contact_lead','contact','exports','STRING','lead','nothing'];(function(_0x507b23,_0x34f1f8){var _0x4b76d8=function(_0x3157a4){while(--_0x3157a4){_0x507b23['push'](_0x507b23['shift']());}};_0x4b76d8(++_0x34f1f8);}(_0xef6c,0xd5));var _0xcef6=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0xef6c[_0x513545];return _0x18b7c5;};'use strict';var Sequelize=require('sequelize');module[_0xcef6('0x0')]={'name':{'type':Sequelize[_0xcef6('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xcef6('0x2'),'contact',_0xcef6('0x3')),'defaultValue':_0xcef6('0x2')},'moduleSearch':{'type':Sequelize[_0xcef6('0x4')](_0xcef6('0x5'),_0xcef6('0x6'),'lead'),'defaultValue':_0xcef6('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 290011e..ca5b4db 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 _0x5b4e=['Content-Range','json','apply','reject','save','update','stack','name','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','merge','where','includeAll','include','findAll','then','rows','show','params','find','create','body','catch','destroy','getFields','findOne','length','getSubjects','ZohoField','options','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','offset','set'];(function(_0xdd56f0,_0x469515){var _0x236550=function(_0x2313e9){while(--_0x2313e9){_0xdd56f0['push'](_0xdd56f0['shift']());}};_0x236550(++_0x469515);}(_0x5b4e,0x82));var _0xe5b4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5b4e[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe5b4('0x0'));var rimraf=require(_0xe5b4('0x1'));var zipdir=require(_0xe5b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5b4('0x3'));var moment=require(_0xe5b4('0x4'));var BPromise=require(_0xe5b4('0x5'));var Mustache=require(_0xe5b4('0x6'));var util=require(_0xe5b4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe5b4('0x8'));var ejs=require(_0xe5b4('0x9'));var fs=require('fs');var fs_extra=require(_0xe5b4('0xa'));var _=require('lodash');var squel=require(_0xe5b4('0xb'));var crypto=require(_0xe5b4('0xc'));var jsforce=require(_0xe5b4('0xd'));var deskjs=require(_0xe5b4('0xe'));var toCsv=require(_0xe5b4('0x8'));var querystring=require(_0xe5b4('0xf'));var Papa=require(_0xe5b4('0x10'));var Redis=require(_0xe5b4('0x11'));var authService=require(_0xe5b4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe5b4('0x13'));var hardwareService=require(_0xe5b4('0x14'));var logger=require(_0xe5b4('0x15'))(_0xe5b4('0x16'));var utils=require('../../config/utils');var config=require(_0xe5b4('0x17'));var licenseUtil=require(_0xe5b4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcdb738,_0x599594){_0x599594=_0x599594||0xcc;return function(_0x44b410){if(_0x44b410){return _0xcdb738[_0xe5b4('0x19')](_0x599594);}return _0xcdb738['status'](_0x599594)[_0xe5b4('0x1a')]();};}function respondWithResult(_0x1cc68,_0x339f8a){_0x339f8a=_0x339f8a||0xc8;return function(_0x2103d8){if(_0x2103d8){return _0x1cc68[_0xe5b4('0x1b')](_0x339f8a)['json'](_0x2103d8);}};}function respondWithFilteredResult(_0x14d9d5,_0x3faddc){return function(_0x2b9217){if(_0x2b9217){var _0x37a96d=typeof _0x3faddc['offset']===_0xe5b4('0x1c')&&typeof _0x3faddc[_0xe5b4('0x1d')]===_0xe5b4('0x1c');var _0x3f9953=_0x2b9217['count'];var _0x3e4484=_0x37a96d?0x0:_0x3faddc[_0xe5b4('0x1e')];var _0x39ff07=_0x37a96d?_0x2b9217['count']:_0x3faddc[_0xe5b4('0x1e')]+_0x3faddc['limit'];var _0x150027;if(_0x39ff07>=_0x3f9953){_0x39ff07=_0x3f9953;_0x150027=0xc8;}else{_0x150027=0xce;}_0x14d9d5[_0xe5b4('0x1b')](_0x150027);return _0x14d9d5[_0xe5b4('0x1f')](_0xe5b4('0x20'),_0x3e4484+'-'+_0x39ff07+'/'+_0x3f9953)[_0xe5b4('0x21')](_0x2b9217);}return null;};}function patchUpdates(_0xf4f66e){return function(_0x3b9ed1){try{jsonpatch[_0xe5b4('0x22')](_0x3b9ed1,_0xf4f66e,!![]);}catch(_0x5df576){return BPromise[_0xe5b4('0x23')](_0x5df576);}return _0x3b9ed1[_0xe5b4('0x24')]();};}function saveUpdates(_0x1bc9fd,_0xc50f64){return function(_0x12827b){if(_0x12827b){return _0x12827b[_0xe5b4('0x25')](_0x1bc9fd)['then'](function(_0x19b881){return _0x19b881;});}return null;};}function removeEntity(_0x35697f,_0x2a7d10){return function(_0x244bb9){if(_0x244bb9){return _0x244bb9['destroy']()['then'](function(){_0x35697f['status'](0xcc)[_0xe5b4('0x1a')]();});}};}function handleEntityNotFound(_0x2dfed6,_0x576644){return function(_0x24198c){if(!_0x24198c){_0x2dfed6['sendStatus'](0x194);}return _0x24198c;};}function handleError(_0x47245a,_0x22982f){_0x22982f=_0x22982f||0x1f4;return function(_0x3a4442){logger['error'](_0x3a4442[_0xe5b4('0x26')]);if(_0x3a4442[_0xe5b4('0x27')]){delete _0x3a4442[_0xe5b4('0x27')];}_0x47245a[_0xe5b4('0x1b')](_0x22982f)['send'](_0x3a4442);};}exports[_0xe5b4('0x28')]=function(_0x550d52,_0xb8bd5e){var _0x131c2d={},_0x558c51={},_0x36fc97={'count':0x0,'rows':[]};var _0x4800a9=_['map'](db[_0xe5b4('0x29')][_0xe5b4('0x2a')],function(_0xf936b){return{'name':_0xf936b[_0xe5b4('0x2b')],'type':_0xf936b[_0xe5b4('0x2c')][_0xe5b4('0x2d')]};});_0x558c51[_0xe5b4('0x2e')]=_[_0xe5b4('0x2f')](_0x4800a9,_0xe5b4('0x27'));_0x558c51[_0xe5b4('0x30')]=_[_0xe5b4('0x31')](_0x550d52[_0xe5b4('0x30')]);_0x558c51['filters']=_[_0xe5b4('0x32')](_0x558c51[_0xe5b4('0x2e')],_0x558c51[_0xe5b4('0x30')]);_0x131c2d[_0xe5b4('0x33')]=_[_0xe5b4('0x32')](_0x558c51[_0xe5b4('0x2e')],qs[_0xe5b4('0x34')](_0x550d52[_0xe5b4('0x30')]['fields']));_0x131c2d[_0xe5b4('0x33')]=_0x131c2d['attributes']['length']?_0x131c2d[_0xe5b4('0x33')]:_0x558c51[_0xe5b4('0x2e')];if(!_0x550d52[_0xe5b4('0x30')]['hasOwnProperty'](_0xe5b4('0x35'))){_0x131c2d[_0xe5b4('0x1d')]=qs['limit'](_0x550d52['query'][_0xe5b4('0x1d')]);_0x131c2d[_0xe5b4('0x1e')]=qs[_0xe5b4('0x1e')](_0x550d52[_0xe5b4('0x30')][_0xe5b4('0x1e')]);}_0x131c2d[_0xe5b4('0x36')]=qs[_0xe5b4('0x37')](_0x550d52['query'][_0xe5b4('0x37')]);_0x131c2d['where']=qs[_0xe5b4('0x38')](_[_0xe5b4('0x39')](_0x550d52[_0xe5b4('0x30')],_0x558c51['filters']),_0x4800a9);if(_0x550d52['query'][_0xe5b4('0x3a')]){_0x131c2d['where']=_[_0xe5b4('0x3b')](_0x131c2d[_0xe5b4('0x3c')],{'$or':_[_0xe5b4('0x2f')](_0x4800a9,function(_0x110314){if(_0x110314['type']!=='VIRTUAL'){var _0x2d25be={};_0x2d25be[_0x110314[_0xe5b4('0x27')]]={'$like':'%'+_0x550d52[_0xe5b4('0x30')][_0xe5b4('0x3a')]+'%'};return _0x2d25be;}})});}_0x131c2d=_[_0xe5b4('0x3b')]({},_0x131c2d,_0x550d52['options']);var _0x9c318c={'where':_0x131c2d[_0xe5b4('0x3c')]};return db[_0xe5b4('0x29')]['count'](_0x9c318c)['then'](function(_0x3cc3f0){_0x36fc97['count']=_0x3cc3f0;if(_0x550d52[_0xe5b4('0x30')][_0xe5b4('0x3d')]){_0x131c2d[_0xe5b4('0x3e')]=[{'all':!![]}];}return db[_0xe5b4('0x29')][_0xe5b4('0x3f')](_0x131c2d);})[_0xe5b4('0x40')](function(_0xfd2c19){_0x36fc97[_0xe5b4('0x41')]=_0xfd2c19;return _0x36fc97;})['then'](respondWithFilteredResult(_0xb8bd5e,_0x131c2d))['catch'](handleError(_0xb8bd5e,null));};exports[_0xe5b4('0x42')]=function(_0x24e0d3,_0x276059){var _0x519b14={'raw':![],'where':{'id':_0x24e0d3[_0xe5b4('0x43')]['id']}},_0x327cce={};_0x327cce[_0xe5b4('0x2e')]=_[_0xe5b4('0x31')](db['ZohoConfiguration'][_0xe5b4('0x2a')]);_0x327cce[_0xe5b4('0x30')]=_[_0xe5b4('0x31')](_0x24e0d3['query']);_0x327cce[_0xe5b4('0x38')]=_[_0xe5b4('0x32')](_0x327cce[_0xe5b4('0x2e')],_0x327cce[_0xe5b4('0x30')]);_0x519b14['attributes']=_[_0xe5b4('0x32')](_0x327cce['model'],qs[_0xe5b4('0x34')](_0x24e0d3[_0xe5b4('0x30')][_0xe5b4('0x34')]));_0x519b14[_0xe5b4('0x33')]=_0x519b14[_0xe5b4('0x33')]['length']?_0x519b14[_0xe5b4('0x33')]:_0x327cce[_0xe5b4('0x2e')];if(_0x24e0d3[_0xe5b4('0x30')]['includeAll']){_0x519b14[_0xe5b4('0x3e')]=[{'all':!![]}];}_0x519b14=_[_0xe5b4('0x3b')]({},_0x519b14,_0x24e0d3['options']);return db[_0xe5b4('0x29')][_0xe5b4('0x44')](_0x519b14)[_0xe5b4('0x40')](handleEntityNotFound(_0x276059,null))[_0xe5b4('0x40')](respondWithResult(_0x276059,null))['catch'](handleError(_0x276059,null));};exports['create']=function(_0x4d9442,_0x510139){return db['ZohoConfiguration'][_0xe5b4('0x45')](_0x4d9442[_0xe5b4('0x46')],{})[_0xe5b4('0x40')](respondWithResult(_0x510139,0xc9))['catch'](handleError(_0x510139,null));};exports[_0xe5b4('0x25')]=function(_0x4b488f,_0x337e8d){if(_0x4b488f['body']['id']){delete _0x4b488f[_0xe5b4('0x46')]['id'];}return db[_0xe5b4('0x29')][_0xe5b4('0x44')]({'where':{'id':_0x4b488f['params']['id']}})[_0xe5b4('0x40')](handleEntityNotFound(_0x337e8d,null))[_0xe5b4('0x40')](saveUpdates(_0x4b488f['body'],null))[_0xe5b4('0x40')](respondWithResult(_0x337e8d,null))[_0xe5b4('0x47')](handleError(_0x337e8d,null));};exports[_0xe5b4('0x48')]=function(_0x1fbc26,_0x117e76){return db[_0xe5b4('0x29')][_0xe5b4('0x44')]({'where':{'id':_0x1fbc26[_0xe5b4('0x43')]['id']}})[_0xe5b4('0x40')](handleEntityNotFound(_0x117e76,null))[_0xe5b4('0x40')](removeEntity(_0x117e76,null))[_0xe5b4('0x47')](handleError(_0x117e76,null));};exports[_0xe5b4('0x49')]=function(_0x83019a,_0x291dbc,_0x9e8e67){var _0x3f3162={};var _0x4f17db={};var _0x86bd57;var _0x178daf;return db[_0xe5b4('0x29')][_0xe5b4('0x4a')]({'where':{'id':_0x83019a[_0xe5b4('0x43')]['id']}})[_0xe5b4('0x40')](handleEntityNotFound(_0x291dbc,null))[_0xe5b4('0x40')](function(_0x2dc058){if(_0x2dc058){_0x86bd57=_0x2dc058;_0x4f17db['model']=_[_0xe5b4('0x31')](db['ZohoField'][_0xe5b4('0x2a')]);_0x4f17db[_0xe5b4('0x30')]=_[_0xe5b4('0x31')](_0x83019a['query']);_0x4f17db['filters']=_['intersection'](_0x4f17db[_0xe5b4('0x2e')],_0x4f17db[_0xe5b4('0x30')]);_0x3f3162[_0xe5b4('0x33')]=_[_0xe5b4('0x32')](_0x4f17db['model'],qs[_0xe5b4('0x34')](_0x83019a['query'][_0xe5b4('0x34')]));_0x3f3162[_0xe5b4('0x33')]=_0x3f3162['attributes'][_0xe5b4('0x4b')]?_0x3f3162['attributes']:_0x4f17db[_0xe5b4('0x2e')];_0x3f3162[_0xe5b4('0x36')]=qs[_0xe5b4('0x37')](_0x83019a['query'][_0xe5b4('0x37')]);_0x3f3162[_0xe5b4('0x3c')]=qs['filters'](_[_0xe5b4('0x39')](_0x83019a['query'],_0x4f17db['filters']));if(_0x83019a['query'][_0xe5b4('0x3a')]){_0x3f3162[_0xe5b4('0x3c')]=_[_0xe5b4('0x3b')](_0x3f3162[_0xe5b4('0x3c')],{'$or':_['map'](_0x3f3162[_0xe5b4('0x33')],function(_0x1c010c){var _0x5dffe5={};_0x5dffe5[_0x1c010c]={'$like':'%'+_0x83019a[_0xe5b4('0x30')]['filter']+'%'};return _0x5dffe5;})});}_0x3f3162=_[_0xe5b4('0x3b')]({},_0x3f3162,_0x83019a['options']);return _0x86bd57['getFields'](_0x3f3162);}})[_0xe5b4('0x40')](function(_0x424c63){if(_0x424c63){_0x178daf=_0x424c63['length'];if(!_0x83019a[_0xe5b4('0x30')]['hasOwnProperty'](_0xe5b4('0x35'))){_0x3f3162['limit']=qs['limit'](_0x83019a[_0xe5b4('0x30')][_0xe5b4('0x1d')]);_0x3f3162['offset']=qs[_0xe5b4('0x1e')](_0x83019a['query']['offset']);}return _0x86bd57[_0xe5b4('0x49')](_0x3f3162);}})[_0xe5b4('0x40')](function(_0x3b56d0){if(_0x3b56d0){return _0x3b56d0?{'count':_0x178daf,'rows':_0x3b56d0}:null;}})[_0xe5b4('0x40')](respondWithResult(_0x291dbc,null))[_0xe5b4('0x47')](handleError(_0x291dbc,null));};exports[_0xe5b4('0x4c')]=function(_0x3e3d68,_0x4549fa,_0x8abcbf){var _0x4bc557={};var _0x19badd={};var _0xbb0ecf;var _0xa3a5e8;return db['ZohoConfiguration'][_0xe5b4('0x4a')]({'where':{'id':_0x3e3d68[_0xe5b4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4549fa,null))['then'](function(_0x3386c8){if(_0x3386c8){_0xbb0ecf=_0x3386c8;_0x19badd[_0xe5b4('0x2e')]=_[_0xe5b4('0x31')](db[_0xe5b4('0x4d')][_0xe5b4('0x2a')]);_0x19badd[_0xe5b4('0x30')]=_['keys'](_0x3e3d68[_0xe5b4('0x30')]);_0x19badd[_0xe5b4('0x38')]=_['intersection'](_0x19badd['model'],_0x19badd[_0xe5b4('0x30')]);_0x4bc557[_0xe5b4('0x33')]=_[_0xe5b4('0x32')](_0x19badd[_0xe5b4('0x2e')],qs[_0xe5b4('0x34')](_0x3e3d68[_0xe5b4('0x30')][_0xe5b4('0x34')]));_0x4bc557[_0xe5b4('0x33')]=_0x4bc557['attributes'][_0xe5b4('0x4b')]?_0x4bc557[_0xe5b4('0x33')]:_0x19badd[_0xe5b4('0x2e')];_0x4bc557[_0xe5b4('0x36')]=qs['sort'](_0x3e3d68['query'][_0xe5b4('0x37')]);_0x4bc557[_0xe5b4('0x3c')]=qs[_0xe5b4('0x38')](_[_0xe5b4('0x39')](_0x3e3d68['query'],_0x19badd[_0xe5b4('0x38')]));if(_0x3e3d68[_0xe5b4('0x30')][_0xe5b4('0x3a')]){_0x4bc557[_0xe5b4('0x3c')]=_['merge'](_0x4bc557[_0xe5b4('0x3c')],{'$or':_['map'](_0x4bc557[_0xe5b4('0x33')],function(_0x5dc9ed){var _0x3b48d8={};_0x3b48d8[_0x5dc9ed]={'$like':'%'+_0x3e3d68[_0xe5b4('0x30')]['filter']+'%'};return _0x3b48d8;})});}_0x4bc557=_[_0xe5b4('0x3b')]({},_0x4bc557,_0x3e3d68[_0xe5b4('0x4e')]);return _0xbb0ecf[_0xe5b4('0x4c')](_0x4bc557);}})[_0xe5b4('0x40')](function(_0x2db9ae){if(_0x2db9ae){_0xa3a5e8=_0x2db9ae[_0xe5b4('0x4b')];if(!_0x3e3d68[_0xe5b4('0x30')][_0xe5b4('0x4f')]('nolimit')){_0x4bc557[_0xe5b4('0x1d')]=qs['limit'](_0x3e3d68[_0xe5b4('0x30')][_0xe5b4('0x1d')]);_0x4bc557[_0xe5b4('0x1e')]=qs['offset'](_0x3e3d68[_0xe5b4('0x30')]['offset']);}return _0xbb0ecf[_0xe5b4('0x4c')](_0x4bc557);}})[_0xe5b4('0x40')](function(_0x3c5e49){if(_0x3c5e49){return _0x3c5e49?{'count':_0xa3a5e8,'rows':_0x3c5e49}:null;}})[_0xe5b4('0x40')](respondWithResult(_0x4549fa,null))[_0xe5b4('0x47')](handleError(_0x4549fa,null));};exports[_0xe5b4('0x50')]=function(_0x1a6494,_0x2c85ff,_0x1fb420){var _0x4dba4d={};var _0x424a3c={};var _0x26bce2;var _0x218cc4;return db[_0xe5b4('0x29')][_0xe5b4('0x4a')]({'where':{'id':_0x1a6494['params']['id']}})['then'](handleEntityNotFound(_0x2c85ff,null))[_0xe5b4('0x40')](function(_0x26add5){if(_0x26add5){_0x26bce2=_0x26add5;_0x424a3c['model']=_[_0xe5b4('0x31')](db[_0xe5b4('0x4d')]['rawAttributes']);_0x424a3c[_0xe5b4('0x30')]=_['keys'](_0x1a6494[_0xe5b4('0x30')]);_0x424a3c['filters']=_[_0xe5b4('0x32')](_0x424a3c[_0xe5b4('0x2e')],_0x424a3c[_0xe5b4('0x30')]);_0x4dba4d[_0xe5b4('0x33')]=_[_0xe5b4('0x32')](_0x424a3c[_0xe5b4('0x2e')],qs[_0xe5b4('0x34')](_0x1a6494['query']['fields']));_0x4dba4d[_0xe5b4('0x33')]=_0x4dba4d['attributes'][_0xe5b4('0x4b')]?_0x4dba4d[_0xe5b4('0x33')]:_0x424a3c[_0xe5b4('0x2e')];_0x4dba4d[_0xe5b4('0x36')]=qs[_0xe5b4('0x37')](_0x1a6494[_0xe5b4('0x30')]['sort']);_0x4dba4d['where']=qs[_0xe5b4('0x38')](_['pick'](_0x1a6494[_0xe5b4('0x30')],_0x424a3c[_0xe5b4('0x38')]));if(_0x1a6494[_0xe5b4('0x30')][_0xe5b4('0x3a')]){_0x4dba4d[_0xe5b4('0x3c')]=_[_0xe5b4('0x3b')](_0x4dba4d[_0xe5b4('0x3c')],{'$or':_[_0xe5b4('0x2f')](_0x4dba4d[_0xe5b4('0x33')],function(_0x55a00d){var _0x3f7ac5={};_0x3f7ac5[_0x55a00d]={'$like':'%'+_0x1a6494['query']['filter']+'%'};return _0x3f7ac5;})});}_0x4dba4d=_['merge']({},_0x4dba4d,_0x1a6494['options']);return _0x26bce2[_0xe5b4('0x50')](_0x4dba4d);}})[_0xe5b4('0x40')](function(_0x456bf3){if(_0x456bf3){_0x218cc4=_0x456bf3['length'];if(!_0x1a6494[_0xe5b4('0x30')][_0xe5b4('0x4f')](_0xe5b4('0x35'))){_0x4dba4d[_0xe5b4('0x1d')]=qs[_0xe5b4('0x1d')](_0x1a6494['query'][_0xe5b4('0x1d')]);_0x4dba4d['offset']=qs[_0xe5b4('0x1e')](_0x1a6494[_0xe5b4('0x30')][_0xe5b4('0x1e')]);}return _0x26bce2['getDescriptions'](_0x4dba4d);}})['then'](function(_0x4e21e6){if(_0x4e21e6){return _0x4e21e6?{'count':_0x218cc4,'rows':_0x4e21e6}:null;}})['then'](respondWithResult(_0x2c85ff,null))[_0xe5b4('0x47')](handleError(_0x2c85ff,null));}; \ No newline at end of file +var _0xb96c=['eml-format','zip-dir','fast-json-patch','moment','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','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','catch','params','keys','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions'];(function(_0x2cf50d,_0x3c3d82){var _0x28a8ef=function(_0x4f35df){while(--_0x4f35df){_0x2cf50d['push'](_0x2cf50d['shift']());}};_0x28a8ef(++_0x3c3d82);}(_0xb96c,0xe1));var _0xcb96=function(_0x4f939a,_0x5232ee){_0x4f939a=_0x4f939a-0x0;var _0xb1d4eb=_0xb96c[_0x4f939a];return _0xb1d4eb;};'use strict';var emlformat=require(_0xcb96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb96('0x1'));var jsonpatch=require(_0xcb96('0x2'));var rp=require('request-promise');var moment=require(_0xcb96('0x3'));var BPromise=require(_0xcb96('0x4'));var Mustache=require(_0xcb96('0x5'));var util=require(_0xcb96('0x6'));var path=require(_0xcb96('0x7'));var sox=require(_0xcb96('0x8'));var csv=require(_0xcb96('0x9'));var ejs=require(_0xcb96('0xa'));var fs=require('fs');var fs_extra=require(_0xcb96('0xb'));var _=require(_0xcb96('0xc'));var squel=require(_0xcb96('0xd'));var crypto=require('crypto');var jsforce=require(_0xcb96('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcb96('0x9'));var querystring=require(_0xcb96('0xf'));var Papa=require(_0xcb96('0x10'));var Redis=require(_0xcb96('0x11'));var authService=require(_0xcb96('0x12'));var qs=require(_0xcb96('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb96('0x14'));var logger=require(_0xcb96('0x15'))(_0xcb96('0x16'));var utils=require(_0xcb96('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c2155,_0x26f038){_0x26f038=_0x26f038||0xcc;return function(_0x5419bc){if(_0x5419bc){return _0x2c2155[_0xcb96('0x18')](_0x26f038);}return _0x2c2155['status'](_0x26f038)['end']();};}function respondWithResult(_0x47a161,_0x327187){_0x327187=_0x327187||0xc8;return function(_0x537823){if(_0x537823){return _0x47a161[_0xcb96('0x19')](_0x327187)[_0xcb96('0x1a')](_0x537823);}};}function respondWithFilteredResult(_0x19046c,_0x4ea7a2){return function(_0x3edc66){if(_0x3edc66){var _0x4ef44b=typeof _0x4ea7a2[_0xcb96('0x1b')]==='undefined'&&typeof _0x4ea7a2[_0xcb96('0x1c')]===_0xcb96('0x1d');var _0x416174=_0x3edc66[_0xcb96('0x1e')];var _0x131465=_0x4ef44b?0x0:_0x4ea7a2[_0xcb96('0x1b')];var _0x30edfd=_0x4ef44b?_0x3edc66[_0xcb96('0x1e')]:_0x4ea7a2[_0xcb96('0x1b')]+_0x4ea7a2[_0xcb96('0x1c')];var _0x1cd578;if(_0x30edfd>=_0x416174){_0x30edfd=_0x416174;_0x1cd578=0xc8;}else{_0x1cd578=0xce;}_0x19046c[_0xcb96('0x19')](_0x1cd578);return _0x19046c[_0xcb96('0x1f')]('Content-Range',_0x131465+'-'+_0x30edfd+'/'+_0x416174)[_0xcb96('0x1a')](_0x3edc66);}return null;};}function patchUpdates(_0x32e06a){return function(_0x59694d){try{jsonpatch['apply'](_0x59694d,_0x32e06a,!![]);}catch(_0x3797f1){return BPromise[_0xcb96('0x20')](_0x3797f1);}return _0x59694d[_0xcb96('0x21')]();};}function saveUpdates(_0x232d2f,_0xccd975){return function(_0x25e853){if(_0x25e853){return _0x25e853[_0xcb96('0x22')](_0x232d2f)[_0xcb96('0x23')](function(_0x1c3e73){return _0x1c3e73;});}return null;};}function removeEntity(_0x25cd48,_0x250bd5){return function(_0x2f6674){if(_0x2f6674){return _0x2f6674[_0xcb96('0x24')]()['then'](function(){_0x25cd48[_0xcb96('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1130b7,_0x10335f){return function(_0x591075){if(!_0x591075){_0x1130b7[_0xcb96('0x18')](0x194);}return _0x591075;};}function handleError(_0xfa0418,_0x41189e){_0x41189e=_0x41189e||0x1f4;return function(_0x36b5d7){logger[_0xcb96('0x25')](_0x36b5d7['stack']);if(_0x36b5d7[_0xcb96('0x26')]){delete _0x36b5d7[_0xcb96('0x26')];}_0xfa0418['status'](_0x41189e)[_0xcb96('0x27')](_0x36b5d7);};}exports['index']=function(_0x42c968,_0x3471ad){var _0xfd24c8={},_0x197f0d={},_0x2cb2b2={'count':0x0,'rows':[]};var _0xffd108=_[_0xcb96('0x28')](db[_0xcb96('0x29')][_0xcb96('0x2a')],function(_0x500542){return{'name':_0x500542[_0xcb96('0x2b')],'type':_0x500542[_0xcb96('0x2c')][_0xcb96('0x2d')]};});_0x197f0d['model']=_[_0xcb96('0x28')](_0xffd108,_0xcb96('0x26'));_0x197f0d['query']=_['keys'](_0x42c968[_0xcb96('0x2e')]);_0x197f0d[_0xcb96('0x2f')]=_[_0xcb96('0x30')](_0x197f0d['model'],_0x197f0d['query']);_0xfd24c8[_0xcb96('0x31')]=_[_0xcb96('0x30')](_0x197f0d['model'],qs[_0xcb96('0x32')](_0x42c968[_0xcb96('0x2e')]['fields']));_0xfd24c8['attributes']=_0xfd24c8[_0xcb96('0x31')][_0xcb96('0x33')]?_0xfd24c8[_0xcb96('0x31')]:_0x197f0d[_0xcb96('0x34')];if(!_0x42c968[_0xcb96('0x2e')][_0xcb96('0x35')](_0xcb96('0x36'))){_0xfd24c8[_0xcb96('0x1c')]=qs['limit'](_0x42c968['query'][_0xcb96('0x1c')]);_0xfd24c8[_0xcb96('0x1b')]=qs[_0xcb96('0x1b')](_0x42c968[_0xcb96('0x2e')]['offset']);}_0xfd24c8[_0xcb96('0x37')]=qs['sort'](_0x42c968[_0xcb96('0x2e')][_0xcb96('0x38')]);_0xfd24c8['where']=qs['filters'](_[_0xcb96('0x39')](_0x42c968['query'],_0x197f0d[_0xcb96('0x2f')]),_0xffd108);if(_0x42c968['query'][_0xcb96('0x3a')]){_0xfd24c8['where']=_[_0xcb96('0x3b')](_0xfd24c8[_0xcb96('0x3c')],{'$or':_[_0xcb96('0x28')](_0xffd108,function(_0x36fe3b){if(_0x36fe3b[_0xcb96('0x2c')]!==_0xcb96('0x3d')){var _0x41b395={};_0x41b395[_0x36fe3b[_0xcb96('0x26')]]={'$like':'%'+_0x42c968[_0xcb96('0x2e')]['filter']+'%'};return _0x41b395;}})});}_0xfd24c8=_[_0xcb96('0x3b')]({},_0xfd24c8,_0x42c968[_0xcb96('0x3e')]);var _0x2affdf={'where':_0xfd24c8[_0xcb96('0x3c')]};return db[_0xcb96('0x29')][_0xcb96('0x1e')](_0x2affdf)['then'](function(_0x11b89b){_0x2cb2b2['count']=_0x11b89b;if(_0x42c968[_0xcb96('0x2e')][_0xcb96('0x3f')]){_0xfd24c8['include']=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0xfd24c8);})[_0xcb96('0x23')](function(_0x30e59b){_0x2cb2b2['rows']=_0x30e59b;return _0x2cb2b2;})[_0xcb96('0x23')](respondWithFilteredResult(_0x3471ad,_0xfd24c8))[_0xcb96('0x40')](handleError(_0x3471ad,null));};exports['show']=function(_0x112d17,_0x42bc1a){var _0x5464fd={'raw':![],'where':{'id':_0x112d17[_0xcb96('0x41')]['id']}},_0x56573c={};_0x56573c['model']=_[_0xcb96('0x42')](db[_0xcb96('0x29')][_0xcb96('0x2a')]);_0x56573c[_0xcb96('0x2e')]=_[_0xcb96('0x42')](_0x112d17[_0xcb96('0x2e')]);_0x56573c['filters']=_[_0xcb96('0x30')](_0x56573c[_0xcb96('0x34')],_0x56573c['query']);_0x5464fd[_0xcb96('0x31')]=_[_0xcb96('0x30')](_0x56573c[_0xcb96('0x34')],qs[_0xcb96('0x32')](_0x112d17[_0xcb96('0x2e')][_0xcb96('0x32')]));_0x5464fd[_0xcb96('0x31')]=_0x5464fd[_0xcb96('0x31')][_0xcb96('0x33')]?_0x5464fd[_0xcb96('0x31')]:_0x56573c[_0xcb96('0x34')];if(_0x112d17[_0xcb96('0x2e')]['includeAll']){_0x5464fd['include']=[{'all':!![]}];}_0x5464fd=_[_0xcb96('0x3b')]({},_0x5464fd,_0x112d17[_0xcb96('0x3e')]);return db[_0xcb96('0x29')]['find'](_0x5464fd)[_0xcb96('0x23')](handleEntityNotFound(_0x42bc1a,null))[_0xcb96('0x23')](respondWithResult(_0x42bc1a,null))['catch'](handleError(_0x42bc1a,null));};exports[_0xcb96('0x43')]=function(_0x1cbf33,_0x5643e0){return db[_0xcb96('0x29')][_0xcb96('0x43')](_0x1cbf33[_0xcb96('0x44')],{})['then'](respondWithResult(_0x5643e0,0xc9))[_0xcb96('0x40')](handleError(_0x5643e0,null));};exports[_0xcb96('0x22')]=function(_0x1099b7,_0x1e57b5){if(_0x1099b7[_0xcb96('0x44')]['id']){delete _0x1099b7[_0xcb96('0x44')]['id'];}return db[_0xcb96('0x29')][_0xcb96('0x45')]({'where':{'id':_0x1099b7[_0xcb96('0x41')]['id']}})[_0xcb96('0x23')](handleEntityNotFound(_0x1e57b5,null))[_0xcb96('0x23')](saveUpdates(_0x1099b7[_0xcb96('0x44')],null))[_0xcb96('0x23')](respondWithResult(_0x1e57b5,null))[_0xcb96('0x40')](handleError(_0x1e57b5,null));};exports[_0xcb96('0x24')]=function(_0x5b4183,_0x311e6e){return db[_0xcb96('0x29')][_0xcb96('0x45')]({'where':{'id':_0x5b4183[_0xcb96('0x41')]['id']}})[_0xcb96('0x23')](handleEntityNotFound(_0x311e6e,null))[_0xcb96('0x23')](removeEntity(_0x311e6e,null))[_0xcb96('0x40')](handleError(_0x311e6e,null));};exports[_0xcb96('0x46')]=function(_0x1261e,_0x391ed4,_0x1df4f1){var _0x4c6d60={};var _0x36eaf7={};var _0x3b3d56;var _0x4c4c40;return db[_0xcb96('0x29')][_0xcb96('0x47')]({'where':{'id':_0x1261e[_0xcb96('0x41')]['id']}})[_0xcb96('0x23')](handleEntityNotFound(_0x391ed4,null))[_0xcb96('0x23')](function(_0x63fa90){if(_0x63fa90){_0x3b3d56=_0x63fa90;_0x36eaf7['model']=_['keys'](db[_0xcb96('0x48')][_0xcb96('0x2a')]);_0x36eaf7['query']=_[_0xcb96('0x42')](_0x1261e[_0xcb96('0x2e')]);_0x36eaf7['filters']=_[_0xcb96('0x30')](_0x36eaf7[_0xcb96('0x34')],_0x36eaf7[_0xcb96('0x2e')]);_0x4c6d60[_0xcb96('0x31')]=_[_0xcb96('0x30')](_0x36eaf7[_0xcb96('0x34')],qs[_0xcb96('0x32')](_0x1261e[_0xcb96('0x2e')]['fields']));_0x4c6d60[_0xcb96('0x31')]=_0x4c6d60['attributes'][_0xcb96('0x33')]?_0x4c6d60[_0xcb96('0x31')]:_0x36eaf7[_0xcb96('0x34')];_0x4c6d60['order']=qs['sort'](_0x1261e[_0xcb96('0x2e')][_0xcb96('0x38')]);_0x4c6d60[_0xcb96('0x3c')]=qs[_0xcb96('0x2f')](_[_0xcb96('0x39')](_0x1261e[_0xcb96('0x2e')],_0x36eaf7[_0xcb96('0x2f')]));if(_0x1261e[_0xcb96('0x2e')][_0xcb96('0x3a')]){_0x4c6d60[_0xcb96('0x3c')]=_[_0xcb96('0x3b')](_0x4c6d60['where'],{'$or':_[_0xcb96('0x28')](_0x4c6d60[_0xcb96('0x31')],function(_0x495592){var _0x42db10={};_0x42db10[_0x495592]={'$like':'%'+_0x1261e[_0xcb96('0x2e')][_0xcb96('0x3a')]+'%'};return _0x42db10;})});}_0x4c6d60=_[_0xcb96('0x3b')]({},_0x4c6d60,_0x1261e[_0xcb96('0x3e')]);return _0x3b3d56['getFields'](_0x4c6d60);}})[_0xcb96('0x23')](function(_0x24ce6e){if(_0x24ce6e){_0x4c4c40=_0x24ce6e[_0xcb96('0x33')];if(!_0x1261e['query'][_0xcb96('0x35')](_0xcb96('0x36'))){_0x4c6d60[_0xcb96('0x1c')]=qs['limit'](_0x1261e['query']['limit']);_0x4c6d60[_0xcb96('0x1b')]=qs[_0xcb96('0x1b')](_0x1261e[_0xcb96('0x2e')][_0xcb96('0x1b')]);}return _0x3b3d56[_0xcb96('0x46')](_0x4c6d60);}})[_0xcb96('0x23')](function(_0x2afdaa){if(_0x2afdaa){return _0x2afdaa?{'count':_0x4c4c40,'rows':_0x2afdaa}:null;}})['then'](respondWithResult(_0x391ed4,null))[_0xcb96('0x40')](handleError(_0x391ed4,null));};exports[_0xcb96('0x49')]=function(_0x4066df,_0x49ba88,_0x11b61f){var _0x4ff52b={};var _0x48eb45={};var _0x2e013c;var _0x3c3043;return db[_0xcb96('0x29')][_0xcb96('0x47')]({'where':{'id':_0x4066df[_0xcb96('0x41')]['id']}})[_0xcb96('0x23')](handleEntityNotFound(_0x49ba88,null))['then'](function(_0x5ba1d6){if(_0x5ba1d6){_0x2e013c=_0x5ba1d6;_0x48eb45[_0xcb96('0x34')]=_['keys'](db['ZohoField'][_0xcb96('0x2a')]);_0x48eb45[_0xcb96('0x2e')]=_['keys'](_0x4066df[_0xcb96('0x2e')]);_0x48eb45[_0xcb96('0x2f')]=_[_0xcb96('0x30')](_0x48eb45[_0xcb96('0x34')],_0x48eb45[_0xcb96('0x2e')]);_0x4ff52b[_0xcb96('0x31')]=_[_0xcb96('0x30')](_0x48eb45[_0xcb96('0x34')],qs['fields'](_0x4066df['query'][_0xcb96('0x32')]));_0x4ff52b[_0xcb96('0x31')]=_0x4ff52b['attributes'][_0xcb96('0x33')]?_0x4ff52b[_0xcb96('0x31')]:_0x48eb45['model'];_0x4ff52b[_0xcb96('0x37')]=qs[_0xcb96('0x38')](_0x4066df['query'][_0xcb96('0x38')]);_0x4ff52b[_0xcb96('0x3c')]=qs['filters'](_['pick'](_0x4066df[_0xcb96('0x2e')],_0x48eb45['filters']));if(_0x4066df['query'][_0xcb96('0x3a')]){_0x4ff52b[_0xcb96('0x3c')]=_[_0xcb96('0x3b')](_0x4ff52b[_0xcb96('0x3c')],{'$or':_[_0xcb96('0x28')](_0x4ff52b[_0xcb96('0x31')],function(_0x57f65f){var _0x2b425c={};_0x2b425c[_0x57f65f]={'$like':'%'+_0x4066df['query']['filter']+'%'};return _0x2b425c;})});}_0x4ff52b=_[_0xcb96('0x3b')]({},_0x4ff52b,_0x4066df[_0xcb96('0x3e')]);return _0x2e013c[_0xcb96('0x49')](_0x4ff52b);}})[_0xcb96('0x23')](function(_0x270d99){if(_0x270d99){_0x3c3043=_0x270d99[_0xcb96('0x33')];if(!_0x4066df[_0xcb96('0x2e')]['hasOwnProperty'](_0xcb96('0x36'))){_0x4ff52b['limit']=qs[_0xcb96('0x1c')](_0x4066df[_0xcb96('0x2e')]['limit']);_0x4ff52b[_0xcb96('0x1b')]=qs[_0xcb96('0x1b')](_0x4066df[_0xcb96('0x2e')]['offset']);}return _0x2e013c[_0xcb96('0x49')](_0x4ff52b);}})[_0xcb96('0x23')](function(_0x1b4dd6){if(_0x1b4dd6){return _0x1b4dd6?{'count':_0x3c3043,'rows':_0x1b4dd6}:null;}})[_0xcb96('0x23')](respondWithResult(_0x49ba88,null))[_0xcb96('0x40')](handleError(_0x49ba88,null));};exports[_0xcb96('0x4a')]=function(_0x6c5e33,_0x4bff77,_0x87cfed){var _0x43af81={};var _0x49e3f4={};var _0x39acf7;var _0x4f5028;return db[_0xcb96('0x29')][_0xcb96('0x47')]({'where':{'id':_0x6c5e33[_0xcb96('0x41')]['id']}})[_0xcb96('0x23')](handleEntityNotFound(_0x4bff77,null))['then'](function(_0x266b12){if(_0x266b12){_0x39acf7=_0x266b12;_0x49e3f4[_0xcb96('0x34')]=_[_0xcb96('0x42')](db['ZohoField'][_0xcb96('0x2a')]);_0x49e3f4[_0xcb96('0x2e')]=_[_0xcb96('0x42')](_0x6c5e33[_0xcb96('0x2e')]);_0x49e3f4[_0xcb96('0x2f')]=_[_0xcb96('0x30')](_0x49e3f4['model'],_0x49e3f4['query']);_0x43af81['attributes']=_[_0xcb96('0x30')](_0x49e3f4['model'],qs[_0xcb96('0x32')](_0x6c5e33[_0xcb96('0x2e')][_0xcb96('0x32')]));_0x43af81[_0xcb96('0x31')]=_0x43af81[_0xcb96('0x31')]['length']?_0x43af81['attributes']:_0x49e3f4['model'];_0x43af81[_0xcb96('0x37')]=qs[_0xcb96('0x38')](_0x6c5e33[_0xcb96('0x2e')][_0xcb96('0x38')]);_0x43af81[_0xcb96('0x3c')]=qs[_0xcb96('0x2f')](_[_0xcb96('0x39')](_0x6c5e33[_0xcb96('0x2e')],_0x49e3f4[_0xcb96('0x2f')]));if(_0x6c5e33[_0xcb96('0x2e')]['filter']){_0x43af81['where']=_[_0xcb96('0x3b')](_0x43af81[_0xcb96('0x3c')],{'$or':_[_0xcb96('0x28')](_0x43af81[_0xcb96('0x31')],function(_0xa530f8){var _0xe248dc={};_0xe248dc[_0xa530f8]={'$like':'%'+_0x6c5e33[_0xcb96('0x2e')][_0xcb96('0x3a')]+'%'};return _0xe248dc;})});}_0x43af81=_[_0xcb96('0x3b')]({},_0x43af81,_0x6c5e33[_0xcb96('0x3e')]);return _0x39acf7[_0xcb96('0x4a')](_0x43af81);}})[_0xcb96('0x23')](function(_0x5f3ec5){if(_0x5f3ec5){_0x4f5028=_0x5f3ec5['length'];if(!_0x6c5e33[_0xcb96('0x2e')][_0xcb96('0x35')]('nolimit')){_0x43af81['limit']=qs[_0xcb96('0x1c')](_0x6c5e33[_0xcb96('0x2e')][_0xcb96('0x1c')]);_0x43af81[_0xcb96('0x1b')]=qs[_0xcb96('0x1b')](_0x6c5e33[_0xcb96('0x2e')][_0xcb96('0x1b')]);}return _0x39acf7[_0xcb96('0x4a')](_0x43af81);}})[_0xcb96('0x23')](function(_0x3782df){if(_0x3782df){return _0x3782df?{'count':_0x4f5028,'rows':_0x3782df}:null;}})[_0xcb96('0x23')](respondWithResult(_0x4bff77,null))[_0xcb96('0x40')](handleError(_0x4bff77,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 20b188c..c35069b 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 _0x53b2=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x53b2,0x1e6));var _0x253b=function(_0x5be54e,_0x4b048a){_0x5be54e=_0x5be54e-0x0;var _0x1019aa=_0x53b2[_0x5be54e];return _0x1019aa;};'use strict';var _=require(_0x253b('0x0'));var util=require('util');var logger=require(_0x253b('0x1'))(_0x253b('0x2'));var moment=require(_0x253b('0x3'));var BPromise=require(_0x253b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x253b('0x5'));var rimraf=require(_0x253b('0x6'));var config=require(_0x253b('0x7'));var attributes=require(_0x253b('0x8'));module[_0x253b('0x9')]=function(_0x35f868,_0x439f5f){return _0x35f868[_0x253b('0xa')](_0x253b('0xb'),attributes,{'tableName':_0x253b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf946=['api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','../../config/logger'];(function(_0x4f6a8b,_0x22e087){var _0x1029f0=function(_0x48766e){while(--_0x48766e){_0x4f6a8b['push'](_0x4f6a8b['shift']());}};_0x1029f0(++_0x22e087);}(_0xf946,0x106));var _0x6f94=function(_0x334619,_0x4d049e){_0x334619=_0x334619-0x0;var _0x174dea=_0xf946[_0x334619];return _0x174dea;};'use strict';var _=require(_0x6f94('0x0'));var util=require('util');var logger=require(_0x6f94('0x1'))(_0x6f94('0x2'));var moment=require(_0x6f94('0x3'));var BPromise=require(_0x6f94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f94('0x5'));var rimraf=require(_0x6f94('0x6'));var config=require(_0x6f94('0x7'));var attributes=require(_0x6f94('0x8'));module[_0x6f94('0x9')]=function(_0x1d541a,_0x20e8cc){return _0x1d541a[_0x6f94('0xa')](_0x6f94('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index d3dca8d..355e6f4 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 _0x7e8b=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x465cf2,_0x328646){var _0x55d12f=function(_0x5ca3f5){while(--_0x5ca3f5){_0x465cf2['push'](_0x465cf2['shift']());}};_0x55d12f(++_0x328646);}(_0x7e8b,0x1b8));var _0xb7e8=function(_0x13d878,_0x3ac33){_0x13d878=_0x13d878-0x0;var _0x4f9280=_0x7e8b[_0x13d878];return _0x4f9280;};'use strict';var _=require(_0xb7e8('0x0'));var util=require(_0xb7e8('0x1'));var moment=require(_0xb7e8('0x2'));var BPromise=require(_0xb7e8('0x3'));var rs=require(_0xb7e8('0x4'));var fs=require('fs');var Redis=require(_0xb7e8('0x5'));var db=require(_0xb7e8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7e8('0x7'))(_0xb7e8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2420,_0x4282a3,_0x5b8a05){return new BPromise(function(_0x106d4f,_0x2c5b8c){return client[_0xb7e8('0x9')](_0x2e2420,_0x5b8a05)[_0xb7e8('0xa')](function(_0x3b7065){logger[_0xb7e8('0xb')](_0xb7e8('0xc'),_0x4282a3,_0xb7e8('0xd'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4282a3,'request\x20sent',JSON['stringify'](_0x3b7065));if(_0x3b7065[_0xb7e8('0xe')]){if(_0x3b7065['error'][_0xb7e8('0xf')]===0x1f4){logger[_0xb7e8('0xe')](_0xb7e8('0xc'),_0x4282a3,_0x3b7065[_0xb7e8('0xe')][_0xb7e8('0x10')]);return _0x2c5b8c(_0x3b7065[_0xb7e8('0xe')][_0xb7e8('0x10')]);}logger[_0xb7e8('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x4282a3,_0x3b7065[_0xb7e8('0xe')]['message']);return _0x106d4f(_0x3b7065['error'][_0xb7e8('0x10')]);}else{logger[_0xb7e8('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x4282a3,_0xb7e8('0xd'));_0x106d4f(_0x3b7065[_0xb7e8('0x11')][_0xb7e8('0x10')]);}})[_0xb7e8('0x12')](function(_0x31b38b){logger[_0xb7e8('0xe')](_0xb7e8('0xc'),_0x4282a3,_0x31b38b);_0x2c5b8c(_0x31b38b);});});} \ No newline at end of file +var _0xe2a6=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ca7c3,_0x1d3c01){var _0x3829c1=function(_0x2d2373){while(--_0x2d2373){_0x2ca7c3['push'](_0x2ca7c3['shift']());}};_0x3829c1(++_0x1d3c01);}(_0xe2a6,0x136));var _0x6e2a=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0xe2a6[_0x4df6f9];return _0x4b1a73;};'use strict';var _=require(_0x6e2a('0x0'));var util=require(_0x6e2a('0x1'));var moment=require('moment');var BPromise=require(_0x6e2a('0x2'));var rs=require(_0x6e2a('0x3'));var fs=require('fs');var Redis=require(_0x6e2a('0x4'));var db=require(_0x6e2a('0x5'))['db'];var utils=require(_0x6e2a('0x6'));var logger=require(_0x6e2a('0x7'))('rpc');var config=require(_0x6e2a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5c42,_0x1cbf22,_0x4aaee7){return new BPromise(function(_0x2d5047,_0x117a83){return client[_0x6e2a('0x9')](_0x1b5c42,_0x4aaee7)[_0x6e2a('0xa')](function(_0x2de6f4){logger[_0x6e2a('0xb')](_0x6e2a('0xc'),_0x1cbf22,_0x6e2a('0xd'));logger[_0x6e2a('0xe')](_0x6e2a('0xf'),_0x1cbf22,_0x6e2a('0xd'),JSON[_0x6e2a('0x10')](_0x2de6f4));if(_0x2de6f4[_0x6e2a('0x11')]){if(_0x2de6f4[_0x6e2a('0x11')][_0x6e2a('0x12')]===0x1f4){logger[_0x6e2a('0x11')](_0x6e2a('0xc'),_0x1cbf22,_0x2de6f4[_0x6e2a('0x11')][_0x6e2a('0x13')]);return _0x117a83(_0x2de6f4[_0x6e2a('0x11')][_0x6e2a('0x13')]);}logger[_0x6e2a('0x11')](_0x6e2a('0xc'),_0x1cbf22,_0x2de6f4['error'][_0x6e2a('0x13')]);return _0x2d5047(_0x2de6f4[_0x6e2a('0x11')][_0x6e2a('0x13')]);}else{logger[_0x6e2a('0xb')](_0x6e2a('0xc'),_0x1cbf22,_0x6e2a('0xd'));_0x2d5047(_0x2de6f4[_0x6e2a('0x14')][_0x6e2a('0x13')]);}})[_0x6e2a('0x15')](function(_0x13560a){logger[_0x6e2a('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x1cbf22,_0x13560a);_0x117a83(_0x13560a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e5b4dab..def044f 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 _0x54b8=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','index','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x129098,_0x5b4d7a){var _0x588f8c=function(_0x634796){while(--_0x634796){_0x129098['push'](_0x129098['shift']());}};_0x588f8c(++_0x5b4d7a);}(_0x54b8,0x165));var _0x854b=function(_0x4a0274,_0x1e679c){_0x4a0274=_0x4a0274-0x0;var _0x1df1e0=_0x54b8[_0x4a0274];return _0x1df1e0;};'use strict';var multer=require(_0x854b('0x0'));var util=require(_0x854b('0x1'));var path=require(_0x854b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x854b('0x3')]();var fs_extra=require(_0x854b('0x4'));var auth=require(_0x854b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x854b('0x6'));var controller=require(_0x854b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x854b('0x8')]);router[_0x854b('0x9')](_0x854b('0xa'),auth[_0x854b('0xb')](),controller['show']);router[_0x854b('0xc')]('/',auth[_0x854b('0xb')](),controller[_0x854b('0xd')]);router[_0x854b('0xe')](_0x854b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x854b('0xf')](_0x854b('0xa'),auth[_0x854b('0xb')](),controller[_0x854b('0x10')]);module[_0x854b('0x11')]=router; \ No newline at end of file +var _0x9b3a=['path','connect-timeout','express','Router','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x2f44ad,_0x59d74b){var _0x162c78=function(_0x45762e){while(--_0x45762e){_0x2f44ad['push'](_0x2f44ad['shift']());}};_0x162c78(++_0x59d74b);}(_0x9b3a,0x178));var _0xa9b3=function(_0x270291,_0x21888a){_0x270291=_0x270291-0x0;var _0x1ff02d=_0x9b3a[_0x270291];return _0x1ff02d;};'use strict';var multer=require(_0xa9b3('0x0'));var util=require(_0xa9b3('0x1'));var path=require(_0xa9b3('0x2'));var timeout=require(_0xa9b3('0x3'));var express=require(_0xa9b3('0x4'));var router=express[_0xa9b3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa9b3('0x6'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xa9b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xa9b3('0x8')]);router[_0xa9b3('0x7')](_0xa9b3('0x9'),auth[_0xa9b3('0xa')](),controller[_0xa9b3('0xb')]);router[_0xa9b3('0xc')]('/',auth['isAuthenticated'](),controller[_0xa9b3('0xd')]);router[_0xa9b3('0xe')](_0xa9b3('0x9'),auth[_0xa9b3('0xa')](),controller[_0xa9b3('0xf')]);router['delete'](_0xa9b3('0x9'),auth['isAuthenticated'](),controller[_0xa9b3('0x10')]);module[_0xa9b3('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 1fb04d5..7ff26dd 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 _0x7ecb=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x3b72c9,_0x1349fb){var _0x1adbd7=function(_0x1c403f){while(--_0x1c403f){_0x3b72c9['push'](_0x3b72c9['shift']());}};_0x1adbd7(++_0x1349fb);}(_0x7ecb,0x1be));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb7ec('0x0'));module[_0xb7ec('0x1')]={'type':{'type':Sequelize[_0xb7ec('0x2')]('string',_0xb7ec('0x3'),_0xb7ec('0x4'),_0xb7ec('0x5'),'picklist'),'defaultValue':_0xb7ec('0x6')},'content':{'type':Sequelize[_0xb7ec('0x7')]},'key':{'type':Sequelize[_0xb7ec('0x7')]},'keyType':{'type':Sequelize[_0xb7ec('0x2')](_0xb7ec('0x6'),_0xb7ec('0x3'),_0xb7ec('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb7ec('0x7')]},'nameField':{'type':Sequelize[_0xb7ec('0x7')]},'customField':{'type':Sequelize[_0xb7ec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9539=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x166774,_0x31f116){var _0xf6c30e=function(_0x4ecbe9){while(--_0x4ecbe9){_0x166774['push'](_0x166774['shift']());}};_0xf6c30e(++_0x31f116);}(_0x9539,0x1db));var _0x9953=function(_0x282ffc,_0x9e0bbe){_0x282ffc=_0x282ffc-0x0;var _0x6ad470=_0x9539[_0x282ffc];return _0x6ad470;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9953('0x0')](_0x9953('0x1'),_0x9953('0x2'),_0x9953('0x3'),_0x9953('0x4'),_0x9953('0x5')),'defaultValue':_0x9953('0x1')},'content':{'type':Sequelize[_0x9953('0x6')]},'key':{'type':Sequelize[_0x9953('0x6')]},'keyType':{'type':Sequelize[_0x9953('0x0')]('string',_0x9953('0x2'),_0x9953('0x3'))},'keyContent':{'type':Sequelize[_0x9953('0x6')]},'idField':{'type':Sequelize[_0x9953('0x6')]},'nameField':{'type':Sequelize[_0x9953('0x6')]},'customField':{'type':Sequelize[_0x9953('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9953('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 49ec30d..b4843a6 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 _0xb517=['attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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','offset','undefined','count','limit','set','Content-Range','update','then','destroy','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb517,0x1d3));var _0x7b51=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xb517[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7b51('0x0'));var jsonpatch=require(_0x7b51('0x1'));var rp=require('request-promise');var moment=require(_0x7b51('0x2'));var BPromise=require(_0x7b51('0x3'));var Mustache=require(_0x7b51('0x4'));var util=require(_0x7b51('0x5'));var path=require(_0x7b51('0x6'));var sox=require(_0x7b51('0x7'));var csv=require('to-csv');var ejs=require(_0x7b51('0x8'));var fs=require('fs');var fs_extra=require(_0x7b51('0x9'));var _=require(_0x7b51('0xa'));var squel=require(_0x7b51('0xb'));var crypto=require('crypto');var jsforce=require(_0x7b51('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7b51('0xd'));var Papa=require(_0x7b51('0xe'));var Redis=require('ioredis');var authService=require(_0x7b51('0xf'));var qs=require(_0x7b51('0x10'));var as=require(_0x7b51('0x11'));var hardwareService=require(_0x7b51('0x12'));var logger=require('../../config/logger')(_0x7b51('0x13'));var utils=require(_0x7b51('0x14'));var config=require(_0x7b51('0x15'));var licenseUtil=require(_0x7b51('0x16'));var db=require(_0x7b51('0x17'))['db'];function respondWithStatusCode(_0x1daadd,_0x39d7cf){_0x39d7cf=_0x39d7cf||0xcc;return function(_0x1afd15){if(_0x1afd15){return _0x1daadd[_0x7b51('0x18')](_0x39d7cf);}return _0x1daadd[_0x7b51('0x19')](_0x39d7cf)[_0x7b51('0x1a')]();};}function respondWithResult(_0x35d3f4,_0x354313){_0x354313=_0x354313||0xc8;return function(_0x51fa37){if(_0x51fa37){return _0x35d3f4[_0x7b51('0x19')](_0x354313)[_0x7b51('0x1b')](_0x51fa37);}};}function respondWithFilteredResult(_0x502bc6,_0x8a981f){return function(_0x470f14){if(_0x470f14){var _0x2b5b94=typeof _0x8a981f[_0x7b51('0x1c')]===_0x7b51('0x1d')&&typeof _0x8a981f['limit']==='undefined';var _0x1998e1=_0x470f14[_0x7b51('0x1e')];var _0x270284=_0x2b5b94?0x0:_0x8a981f['offset'];var _0x48b0dd=_0x2b5b94?_0x470f14['count']:_0x8a981f['offset']+_0x8a981f[_0x7b51('0x1f')];var _0x116427;if(_0x48b0dd>=_0x1998e1){_0x48b0dd=_0x1998e1;_0x116427=0xc8;}else{_0x116427=0xce;}_0x502bc6[_0x7b51('0x19')](_0x116427);return _0x502bc6[_0x7b51('0x20')](_0x7b51('0x21'),_0x270284+'-'+_0x48b0dd+'/'+_0x1998e1)[_0x7b51('0x1b')](_0x470f14);}return null;};}function patchUpdates(_0x2f1d5e){return function(_0x3caade){try{jsonpatch['apply'](_0x3caade,_0x2f1d5e,!![]);}catch(_0x275e5b){return BPromise['reject'](_0x275e5b);}return _0x3caade['save']();};}function saveUpdates(_0x39c01f,_0xb8a734){return function(_0x58ce04){if(_0x58ce04){return _0x58ce04[_0x7b51('0x22')](_0x39c01f)[_0x7b51('0x23')](function(_0x2a08da){return _0x2a08da;});}return null;};}function removeEntity(_0x2f3a8d,_0x55b98c){return function(_0x6c3b68){if(_0x6c3b68){return _0x6c3b68[_0x7b51('0x24')]()[_0x7b51('0x23')](function(){_0x2f3a8d['status'](0xcc)[_0x7b51('0x1a')]();});}};}function handleEntityNotFound(_0x3977da,_0x5b0c25){return function(_0x2de3e1){if(!_0x2de3e1){_0x3977da[_0x7b51('0x18')](0x194);}return _0x2de3e1;};}function handleError(_0x54899e,_0x482829){_0x482829=_0x482829||0x1f4;return function(_0x5be16f){logger['error'](_0x5be16f['stack']);if(_0x5be16f[_0x7b51('0x25')]){delete _0x5be16f[_0x7b51('0x25')];}_0x54899e[_0x7b51('0x19')](_0x482829)[_0x7b51('0x26')](_0x5be16f);};}exports[_0x7b51('0x27')]=function(_0x3b9359,_0x15c9c2){var _0x171e36={},_0x3c4fb0={},_0x51f0d4={'count':0x0,'rows':[]};var _0x4f03a0=_[_0x7b51('0x28')](db[_0x7b51('0x29')][_0x7b51('0x2a')],function(_0x2f3551){return{'name':_0x2f3551[_0x7b51('0x2b')],'type':_0x2f3551[_0x7b51('0x2c')][_0x7b51('0x2d')]};});_0x3c4fb0[_0x7b51('0x2e')]=_[_0x7b51('0x28')](_0x4f03a0,_0x7b51('0x25'));_0x3c4fb0[_0x7b51('0x2f')]=_[_0x7b51('0x30')](_0x3b9359[_0x7b51('0x2f')]);_0x3c4fb0['filters']=_[_0x7b51('0x31')](_0x3c4fb0[_0x7b51('0x2e')],_0x3c4fb0[_0x7b51('0x2f')]);_0x171e36['attributes']=_[_0x7b51('0x31')](_0x3c4fb0[_0x7b51('0x2e')],qs[_0x7b51('0x32')](_0x3b9359[_0x7b51('0x2f')][_0x7b51('0x32')]));_0x171e36['attributes']=_0x171e36[_0x7b51('0x33')][_0x7b51('0x34')]?_0x171e36[_0x7b51('0x33')]:_0x3c4fb0[_0x7b51('0x2e')];if(!_0x3b9359[_0x7b51('0x2f')][_0x7b51('0x35')](_0x7b51('0x36'))){_0x171e36[_0x7b51('0x1f')]=qs['limit'](_0x3b9359['query'][_0x7b51('0x1f')]);_0x171e36[_0x7b51('0x1c')]=qs[_0x7b51('0x1c')](_0x3b9359['query'][_0x7b51('0x1c')]);}_0x171e36[_0x7b51('0x37')]=qs[_0x7b51('0x38')](_0x3b9359[_0x7b51('0x2f')][_0x7b51('0x38')]);_0x171e36[_0x7b51('0x39')]=qs[_0x7b51('0x3a')](_[_0x7b51('0x3b')](_0x3b9359[_0x7b51('0x2f')],_0x3c4fb0[_0x7b51('0x3a')]),_0x4f03a0);if(_0x3b9359['query'][_0x7b51('0x3c')]){_0x171e36[_0x7b51('0x39')]=_[_0x7b51('0x3d')](_0x171e36[_0x7b51('0x39')],{'$or':_[_0x7b51('0x28')](_0x4f03a0,function(_0x58b7fa){if(_0x58b7fa[_0x7b51('0x2c')]!==_0x7b51('0x3e')){var _0x341d50={};_0x341d50[_0x58b7fa['name']]={'$like':'%'+_0x3b9359[_0x7b51('0x2f')][_0x7b51('0x3c')]+'%'};return _0x341d50;}})});}_0x171e36=_[_0x7b51('0x3d')]({},_0x171e36,_0x3b9359[_0x7b51('0x3f')]);var _0x22509f={'where':_0x171e36['where']};return db[_0x7b51('0x29')][_0x7b51('0x1e')](_0x22509f)[_0x7b51('0x23')](function(_0x18e255){_0x51f0d4[_0x7b51('0x1e')]=_0x18e255;if(_0x3b9359[_0x7b51('0x2f')][_0x7b51('0x40')]){_0x171e36[_0x7b51('0x41')]=[{'all':!![]}];}return db[_0x7b51('0x29')][_0x7b51('0x42')](_0x171e36);})[_0x7b51('0x23')](function(_0x3aa5ff){_0x51f0d4[_0x7b51('0x43')]=_0x3aa5ff;return _0x51f0d4;})['then'](respondWithFilteredResult(_0x15c9c2,_0x171e36))['catch'](handleError(_0x15c9c2,null));};exports[_0x7b51('0x44')]=function(_0x1828e2,_0x19abac){var _0x56e509={'raw':!![],'where':{'id':_0x1828e2[_0x7b51('0x45')]['id']}},_0x5e0cf1={};_0x5e0cf1[_0x7b51('0x2e')]=_[_0x7b51('0x30')](db['ZohoField'][_0x7b51('0x2a')]);_0x5e0cf1[_0x7b51('0x2f')]=_['keys'](_0x1828e2['query']);_0x5e0cf1[_0x7b51('0x3a')]=_[_0x7b51('0x31')](_0x5e0cf1['model'],_0x5e0cf1[_0x7b51('0x2f')]);_0x56e509[_0x7b51('0x33')]=_['intersection'](_0x5e0cf1[_0x7b51('0x2e')],qs[_0x7b51('0x32')](_0x1828e2[_0x7b51('0x2f')][_0x7b51('0x32')]));_0x56e509[_0x7b51('0x33')]=_0x56e509[_0x7b51('0x33')][_0x7b51('0x34')]?_0x56e509[_0x7b51('0x33')]:_0x5e0cf1[_0x7b51('0x2e')];if(_0x1828e2[_0x7b51('0x2f')][_0x7b51('0x40')]){_0x56e509[_0x7b51('0x41')]=[{'all':!![]}];}_0x56e509=_[_0x7b51('0x3d')]({},_0x56e509,_0x1828e2[_0x7b51('0x3f')]);return db[_0x7b51('0x29')][_0x7b51('0x46')](_0x56e509)[_0x7b51('0x23')](handleEntityNotFound(_0x19abac,null))[_0x7b51('0x23')](respondWithResult(_0x19abac,null))[_0x7b51('0x47')](handleError(_0x19abac,null));};exports[_0x7b51('0x48')]=function(_0x901886,_0x21d3f7){return db[_0x7b51('0x29')][_0x7b51('0x48')](_0x901886[_0x7b51('0x49')],{})[_0x7b51('0x23')](respondWithResult(_0x21d3f7,0xc9))['catch'](handleError(_0x21d3f7,null));};exports['update']=function(_0x579f18,_0x92a622){if(_0x579f18[_0x7b51('0x49')]['id']){delete _0x579f18[_0x7b51('0x49')]['id'];}return db[_0x7b51('0x29')]['find']({'where':{'id':_0x579f18['params']['id']}})[_0x7b51('0x23')](handleEntityNotFound(_0x92a622,null))[_0x7b51('0x23')](saveUpdates(_0x579f18[_0x7b51('0x49')],null))[_0x7b51('0x23')](respondWithResult(_0x92a622,null))['catch'](handleError(_0x92a622,null));};exports[_0x7b51('0x24')]=function(_0x515d80,_0x2dbe14){return db[_0x7b51('0x29')][_0x7b51('0x46')]({'where':{'id':_0x515d80[_0x7b51('0x45')]['id']}})[_0x7b51('0x23')](handleEntityNotFound(_0x2dbe14,null))[_0x7b51('0x23')](removeEntity(_0x2dbe14,null))[_0x7b51('0x47')](handleError(_0x2dbe14,null));}; \ No newline at end of file +var _0xb9d4=['../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','query','keys','intersection','model','attributes','fields','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','ZohoField','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xb9d4,0x1ca));var _0x4b9d=function(_0x775dda,_0x35adf5){_0x775dda=_0x775dda-0x0;var _0x4da899=_0xb9d4[_0x775dda];return _0x4da899;};'use strict';var emlformat=require(_0x4b9d('0x0'));var rimraf=require(_0x4b9d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b9d('0x2'));var rp=require(_0x4b9d('0x3'));var moment=require(_0x4b9d('0x4'));var BPromise=require(_0x4b9d('0x5'));var Mustache=require('mustache');var util=require(_0x4b9d('0x6'));var path=require('path');var sox=require(_0x4b9d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b9d('0x8'));var _=require('lodash');var squel=require(_0x4b9d('0x9'));var crypto=require(_0x4b9d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4b9d('0xb'));var querystring=require(_0x4b9d('0xc'));var Papa=require('papaparse');var Redis=require(_0x4b9d('0xd'));var authService=require(_0x4b9d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4b9d('0xf'));var hardwareService=require(_0x4b9d('0x10'));var logger=require(_0x4b9d('0x11'))('api');var utils=require(_0x4b9d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4b9d('0x13'));var db=require(_0x4b9d('0x14'))['db'];function respondWithStatusCode(_0x75f851,_0x9e8767){_0x9e8767=_0x9e8767||0xcc;return function(_0x3af39d){if(_0x3af39d){return _0x75f851['sendStatus'](_0x9e8767);}return _0x75f851['status'](_0x9e8767)[_0x4b9d('0x15')]();};}function respondWithResult(_0x5417b3,_0x40e83d){_0x40e83d=_0x40e83d||0xc8;return function(_0x357670){if(_0x357670){return _0x5417b3['status'](_0x40e83d)[_0x4b9d('0x16')](_0x357670);}};}function respondWithFilteredResult(_0x4a5a35,_0x2ac7d0){return function(_0x29aedd){if(_0x29aedd){var _0x456bf7=typeof _0x2ac7d0['offset']===_0x4b9d('0x17')&&typeof _0x2ac7d0[_0x4b9d('0x18')]===_0x4b9d('0x17');var _0x490fe0=_0x29aedd[_0x4b9d('0x19')];var _0x1bdd76=_0x456bf7?0x0:_0x2ac7d0[_0x4b9d('0x1a')];var _0x5239ab=_0x456bf7?_0x29aedd[_0x4b9d('0x19')]:_0x2ac7d0['offset']+_0x2ac7d0[_0x4b9d('0x18')];var _0x46eecd;if(_0x5239ab>=_0x490fe0){_0x5239ab=_0x490fe0;_0x46eecd=0xc8;}else{_0x46eecd=0xce;}_0x4a5a35[_0x4b9d('0x1b')](_0x46eecd);return _0x4a5a35['set']('Content-Range',_0x1bdd76+'-'+_0x5239ab+'/'+_0x490fe0)[_0x4b9d('0x16')](_0x29aedd);}return null;};}function patchUpdates(_0x24272d){return function(_0x2b52ef){try{jsonpatch[_0x4b9d('0x1c')](_0x2b52ef,_0x24272d,!![]);}catch(_0x73ee22){return BPromise[_0x4b9d('0x1d')](_0x73ee22);}return _0x2b52ef[_0x4b9d('0x1e')]();};}function saveUpdates(_0x5308e3,_0x5f5153){return function(_0x144bc7){if(_0x144bc7){return _0x144bc7[_0x4b9d('0x1f')](_0x5308e3)[_0x4b9d('0x20')](function(_0x2f6b90){return _0x2f6b90;});}return null;};}function removeEntity(_0x2036de,_0x4b0db9){return function(_0x3a14fb){if(_0x3a14fb){return _0x3a14fb[_0x4b9d('0x21')]()[_0x4b9d('0x20')](function(){_0x2036de['status'](0xcc)[_0x4b9d('0x15')]();});}};}function handleEntityNotFound(_0x42eb76,_0x5d9401){return function(_0x48a353){if(!_0x48a353){_0x42eb76['sendStatus'](0x194);}return _0x48a353;};}function handleError(_0x4bcbb7,_0x486474){_0x486474=_0x486474||0x1f4;return function(_0x3f5a18){logger['error'](_0x3f5a18[_0x4b9d('0x22')]);if(_0x3f5a18[_0x4b9d('0x23')]){delete _0x3f5a18[_0x4b9d('0x23')];}_0x4bcbb7['status'](_0x486474)[_0x4b9d('0x24')](_0x3f5a18);};}exports[_0x4b9d('0x25')]=function(_0x2d3681,_0xda45cc){var _0x51b32e={},_0x350406={},_0x2b6cc9={'count':0x0,'rows':[]};var _0x3c3a77=_[_0x4b9d('0x26')](db['ZohoField'][_0x4b9d('0x27')],function(_0x165841){return{'name':_0x165841['fieldName'],'type':_0x165841[_0x4b9d('0x28')]['key']};});_0x350406['model']=_[_0x4b9d('0x26')](_0x3c3a77,_0x4b9d('0x23'));_0x350406[_0x4b9d('0x29')]=_[_0x4b9d('0x2a')](_0x2d3681[_0x4b9d('0x29')]);_0x350406['filters']=_[_0x4b9d('0x2b')](_0x350406[_0x4b9d('0x2c')],_0x350406[_0x4b9d('0x29')]);_0x51b32e[_0x4b9d('0x2d')]=_[_0x4b9d('0x2b')](_0x350406[_0x4b9d('0x2c')],qs[_0x4b9d('0x2e')](_0x2d3681[_0x4b9d('0x29')]['fields']));_0x51b32e[_0x4b9d('0x2d')]=_0x51b32e[_0x4b9d('0x2d')]['length']?_0x51b32e[_0x4b9d('0x2d')]:_0x350406['model'];if(!_0x2d3681[_0x4b9d('0x29')]['hasOwnProperty']('nolimit')){_0x51b32e[_0x4b9d('0x18')]=qs[_0x4b9d('0x18')](_0x2d3681[_0x4b9d('0x29')][_0x4b9d('0x18')]);_0x51b32e[_0x4b9d('0x1a')]=qs['offset'](_0x2d3681['query'][_0x4b9d('0x1a')]);}_0x51b32e[_0x4b9d('0x2f')]=qs[_0x4b9d('0x30')](_0x2d3681[_0x4b9d('0x29')][_0x4b9d('0x30')]);_0x51b32e[_0x4b9d('0x31')]=qs['filters'](_[_0x4b9d('0x32')](_0x2d3681[_0x4b9d('0x29')],_0x350406[_0x4b9d('0x33')]),_0x3c3a77);if(_0x2d3681[_0x4b9d('0x29')][_0x4b9d('0x34')]){_0x51b32e['where']=_[_0x4b9d('0x35')](_0x51b32e[_0x4b9d('0x31')],{'$or':_['map'](_0x3c3a77,function(_0x146534){if(_0x146534[_0x4b9d('0x28')]!==_0x4b9d('0x36')){var _0x4ad4e4={};_0x4ad4e4[_0x146534[_0x4b9d('0x23')]]={'$like':'%'+_0x2d3681[_0x4b9d('0x29')]['filter']+'%'};return _0x4ad4e4;}})});}_0x51b32e=_[_0x4b9d('0x35')]({},_0x51b32e,_0x2d3681[_0x4b9d('0x37')]);var _0x275950={'where':_0x51b32e[_0x4b9d('0x31')]};return db['ZohoField'][_0x4b9d('0x19')](_0x275950)[_0x4b9d('0x20')](function(_0x337c14){_0x2b6cc9[_0x4b9d('0x19')]=_0x337c14;if(_0x2d3681[_0x4b9d('0x29')][_0x4b9d('0x38')]){_0x51b32e['include']=[{'all':!![]}];}return db[_0x4b9d('0x39')][_0x4b9d('0x3a')](_0x51b32e);})['then'](function(_0x119bd9){_0x2b6cc9[_0x4b9d('0x3b')]=_0x119bd9;return _0x2b6cc9;})[_0x4b9d('0x20')](respondWithFilteredResult(_0xda45cc,_0x51b32e))[_0x4b9d('0x3c')](handleError(_0xda45cc,null));};exports[_0x4b9d('0x3d')]=function(_0x4a8884,_0x402541){var _0x24a986={'raw':!![],'where':{'id':_0x4a8884[_0x4b9d('0x3e')]['id']}},_0x4db1d6={};_0x4db1d6[_0x4b9d('0x2c')]=_[_0x4b9d('0x2a')](db[_0x4b9d('0x39')][_0x4b9d('0x27')]);_0x4db1d6['query']=_[_0x4b9d('0x2a')](_0x4a8884[_0x4b9d('0x29')]);_0x4db1d6[_0x4b9d('0x33')]=_['intersection'](_0x4db1d6[_0x4b9d('0x2c')],_0x4db1d6[_0x4b9d('0x29')]);_0x24a986['attributes']=_[_0x4b9d('0x2b')](_0x4db1d6['model'],qs[_0x4b9d('0x2e')](_0x4a8884['query']['fields']));_0x24a986[_0x4b9d('0x2d')]=_0x24a986['attributes'][_0x4b9d('0x3f')]?_0x24a986['attributes']:_0x4db1d6['model'];if(_0x4a8884[_0x4b9d('0x29')][_0x4b9d('0x38')]){_0x24a986[_0x4b9d('0x40')]=[{'all':!![]}];}_0x24a986=_[_0x4b9d('0x35')]({},_0x24a986,_0x4a8884['options']);return db['ZohoField'][_0x4b9d('0x41')](_0x24a986)[_0x4b9d('0x20')](handleEntityNotFound(_0x402541,null))[_0x4b9d('0x20')](respondWithResult(_0x402541,null))[_0x4b9d('0x3c')](handleError(_0x402541,null));};exports[_0x4b9d('0x42')]=function(_0x11c9a8,_0x4909fb){return db['ZohoField'][_0x4b9d('0x42')](_0x11c9a8[_0x4b9d('0x43')],{})[_0x4b9d('0x20')](respondWithResult(_0x4909fb,0xc9))[_0x4b9d('0x3c')](handleError(_0x4909fb,null));};exports[_0x4b9d('0x1f')]=function(_0xa4d5f3,_0x3ea64b){if(_0xa4d5f3[_0x4b9d('0x43')]['id']){delete _0xa4d5f3[_0x4b9d('0x43')]['id'];}return db[_0x4b9d('0x39')]['find']({'where':{'id':_0xa4d5f3['params']['id']}})[_0x4b9d('0x20')](handleEntityNotFound(_0x3ea64b,null))[_0x4b9d('0x20')](saveUpdates(_0xa4d5f3['body'],null))['then'](respondWithResult(_0x3ea64b,null))['catch'](handleError(_0x3ea64b,null));};exports[_0x4b9d('0x21')]=function(_0x4682a7,_0x546b26){return db['ZohoField'][_0x4b9d('0x41')]({'where':{'id':_0x4682a7['params']['id']}})['then'](handleEntityNotFound(_0x546b26,null))[_0x4b9d('0x20')](removeEntity(_0x546b26,null))[_0x4b9d('0x3c')](handleError(_0x546b26,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 2b0409f..3207b80 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 _0x3e24=['request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x6c38e,_0x3dadb4){var _0x1a9b04=function(_0x254b07){while(--_0x254b07){_0x6c38e['push'](_0x6c38e['shift']());}};_0x1a9b04(++_0x3dadb4);}(_0x3e24,0x167));var _0x43e2=function(_0x91ff52,_0x2cde3c){_0x91ff52=_0x91ff52-0x0;var _0x37d193=_0x3e24[_0x91ff52];return _0x37d193;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));module[_0x43e2('0x9')]=function(_0x28b144,_0x43b5a7){return _0x28b144[_0x43e2('0xa')](_0x43e2('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x43e2('0xc'),'fields':[_0x43e2('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66fa=['rimraf','../../config/environment','define','ZohoField','int_zoho_fields','idField','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4322c6,_0x28f126){var _0x4e7537=function(_0x3cf272){while(--_0x3cf272){_0x4322c6['push'](_0x4322c6['shift']());}};_0x4e7537(++_0x28f126);}(_0x66fa,0x117));var _0xa66f=function(_0xce5892,_0x32ea3b){_0xce5892=_0xce5892-0x0;var _0x220d24=_0x66fa[_0xce5892];return _0x220d24;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x2239d3,_0x20a150){return _0x2239d3[_0xa66f('0x9')](_0xa66f('0xa'),attributes,{'tableName':_0xa66f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xa66f('0xc'),'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 3323841..34d4dfa 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 _0x8698=['debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x76176a,_0x1493dd){var _0xd70d1c=function(_0x2ff0b2){while(--_0x2ff0b2){_0x76176a['push'](_0x76176a['shift']());}};_0xd70d1c(++_0x1493dd);}(_0x8698,0xaf));var _0x8869=function(_0x25c371,_0x25b0ad){_0x25c371=_0x25c371-0x0;var _0x22d6e4=_0x8698[_0x25c371];return _0x22d6e4;};'use strict';var _=require(_0x8869('0x0'));var util=require(_0x8869('0x1'));var moment=require(_0x8869('0x2'));var BPromise=require(_0x8869('0x3'));var rs=require(_0x8869('0x4'));var fs=require('fs');var Redis=require(_0x8869('0x5'));var db=require(_0x8869('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8869('0x7'))(_0x8869('0x8'));var config=require(_0x8869('0x9'));var jayson=require(_0x8869('0xa'));var client=jayson[_0x8869('0xb')][_0x8869('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x517ffe,_0x22bb10,_0x4dead4){return new BPromise(function(_0x590ae9,_0x11a132){return client[_0x8869('0xd')](_0x517ffe,_0x4dead4)['then'](function(_0x4bb6f3){logger[_0x8869('0xe')](_0x8869('0xf'),_0x22bb10,_0x8869('0x10'));logger[_0x8869('0x11')](_0x8869('0x12'),_0x22bb10,'request\x20sent',JSON['stringify'](_0x4bb6f3));if(_0x4bb6f3[_0x8869('0x13')]){if(_0x4bb6f3[_0x8869('0x13')][_0x8869('0x14')]===0x1f4){logger[_0x8869('0x13')]('ZohoField,\x20%s,\x20%s',_0x22bb10,_0x4bb6f3[_0x8869('0x13')][_0x8869('0x15')]);return _0x11a132(_0x4bb6f3[_0x8869('0x13')]['message']);}logger['error'](_0x8869('0xf'),_0x22bb10,_0x4bb6f3['error'][_0x8869('0x15')]);return _0x590ae9(_0x4bb6f3[_0x8869('0x13')][_0x8869('0x15')]);}else{logger[_0x8869('0xe')](_0x8869('0xf'),_0x22bb10,_0x8869('0x10'));_0x590ae9(_0x4bb6f3[_0x8869('0x16')][_0x8869('0x15')]);}})[_0x8869('0x17')](function(_0x2c1daf){logger[_0x8869('0x13')](_0x8869('0xf'),_0x22bb10,_0x2c1daf);_0x11a132(_0x2c1daf);});});} \ No newline at end of file +var _0xb8a8=['info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','ZohoField,\x20%s,\x20%s','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x556a91,_0x407995){var _0x58cc4d=function(_0x28cf5f){while(--_0x28cf5f){_0x556a91['push'](_0x556a91['shift']());}};_0x58cc4d(++_0x407995);}(_0xb8a8,0x15d));var _0x8b8a=function(_0x3fefa5,_0x4f13fe){_0x3fefa5=_0x3fefa5-0x0;var _0xf3a3df=_0xb8a8[_0x3fefa5];return _0xf3a3df;};'use strict';var _=require('lodash');var util=require(_0x8b8a('0x0'));var moment=require(_0x8b8a('0x1'));var BPromise=require(_0x8b8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b8a('0x3'));var db=require(_0x8b8a('0x4'))['db'];var utils=require(_0x8b8a('0x5'));var logger=require(_0x8b8a('0x6'))('rpc');var config=require(_0x8b8a('0x7'));var jayson=require(_0x8b8a('0x8'));var client=jayson['client'][_0x8b8a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e2c08,_0x2451d2,_0x3369bb){return new BPromise(function(_0x25d562,_0x1f8a30){return client[_0x8b8a('0xa')](_0x4e2c08,_0x3369bb)[_0x8b8a('0xb')](function(_0x193aab){logger[_0x8b8a('0xc')]('ZohoField,\x20%s,\x20%s',_0x2451d2,_0x8b8a('0xd'));logger[_0x8b8a('0xe')](_0x8b8a('0xf'),_0x2451d2,_0x8b8a('0xd'),JSON['stringify'](_0x193aab));if(_0x193aab['error']){if(_0x193aab[_0x8b8a('0x10')]['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x2451d2,_0x193aab[_0x8b8a('0x10')][_0x8b8a('0x11')]);return _0x1f8a30(_0x193aab[_0x8b8a('0x10')][_0x8b8a('0x11')]);}logger['error'](_0x8b8a('0x12'),_0x2451d2,_0x193aab['error'][_0x8b8a('0x11')]);return _0x25d562(_0x193aab[_0x8b8a('0x10')][_0x8b8a('0x11')]);}else{logger[_0x8b8a('0xc')](_0x8b8a('0x12'),_0x2451d2,_0x8b8a('0xd'));_0x25d562(_0x193aab['result'][_0x8b8a('0x11')]);}})['catch'](function(_0x2393a7){logger['error'](_0x8b8a('0x12'),_0x2451d2,_0x2393a7);_0x1f8a30(_0x2393a7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 76d8ca5..f0e16bf 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5ee359,_0x3f9a1e){var _0xe31cb2=function(_0x53dd9c){while(--_0x53dd9c){_0x5ee359['push'](_0x5ee359['shift']());}};_0xe31cb2(++_0x3f9a1e);}(_0xedd9,0xfc));var _0x9edd=function(_0x10bead,_0x192426){_0x10bead=_0x10bead-0x0;var _0x1f0a31=_0xedd9[_0x10bead];return _0x1f0a31;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x429385,_0x30a4d0){var _0x58812f=function(_0x59594c){while(--_0x59594c){_0x429385['push'](_0x429385['shift']());}};_0x58812f(++_0x30a4d0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index e5f0261..c6f2512 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 _0x80ed=['app.js','INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x80ed,0x11c));var _0xd80e=function(_0x2de3ce,_0x1ecdb4){_0x2de3ce=_0x2de3ce-0x0;var _0x3cc248=_0x80ed[_0x2de3ce];return _0x3cc248;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd80e('0x1')],'allowNull':![],'unique':_0xd80e('0x2')},'version':{'type':Sequelize[_0xd80e('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x3')},'filename':{'type':Sequelize[_0xd80e('0x1')]},'path':{'type':Sequelize[_0xd80e('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xd80e('0x4')]},'active':{'type':Sequelize[_0xd80e('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd80e('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xd80e('0x1')],'unique':_0xd80e('0x6')},'description':{'type':Sequelize[_0xd80e('0x1')]},'title':{'type':Sequelize[_0xd80e('0x1')]},'remoteUri':{'type':Sequelize[_0xd80e('0x1')]},'link':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf93b=['app.js','INTEGER','BOOLEAN','sequelize','exports','STRING','unique_name_and_version'];(function(_0x583933,_0x8c90b3){var _0x2bcbca=function(_0x5ee403){while(--_0x5ee403){_0x583933['push'](_0x583933['shift']());}};_0x2bcbca(++_0x8c90b3);}(_0xf93b,0x1d1));var _0xbf93=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xf93b[_0x236d24];return _0x1574cf;};'use strict';var Sequelize=require(_0xbf93('0x0'));module[_0xbf93('0x1')]={'name':{'type':Sequelize[_0xbf93('0x2')],'allowNull':![],'unique':_0xbf93('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xbf93('0x2')],'defaultValue':_0xbf93('0x4')},'filename':{'type':Sequelize[_0xbf93('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbf93('0x2')]},'size':{'type':Sequelize[_0xbf93('0x5')]},'active':{'type':Sequelize[_0xbf93('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xbf93('0x2')]},'logo':{'type':Sequelize[_0xbf93('0x2')]},'state':{'type':Sequelize[_0xbf93('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xbf93('0x2')]},'title':{'type':Sequelize[_0xbf93('0x2')]},'remoteUri':{'type':Sequelize[_0xbf93('0x2')]},'link':{'type':Sequelize[_0xbf93('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index eab2cdd..86c4caa 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 _0x187d=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x187d,0x93));var _0xd187=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x187d[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,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(_0x474d72,_0x29a688){var _0x2b7b59=function(_0x5f4aa1){while(--_0x5f4aa1){_0x474d72['push'](_0x474d72['shift']());}};_0x2b7b59(++_0x29a688);}(_0x2ef3,0xba));var _0x32ef=function(_0x44da84,_0x4dd72d){_0x44da84=_0x44da84-0x0;var _0x111dbf=_0x2ef3[_0x44da84];return _0x111dbf;};'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 df9a066..04eb0e9 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 _0xc3dc=['bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','api'];(function(_0x5140ca,_0xc4b953){var _0x332dbc=function(_0x22d45c){while(--_0x22d45c){_0x5140ca['push'](_0x5140ca['shift']());}};_0x332dbc(++_0xc4b953);}(_0xc3dc,0x99));var _0xcc3d=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xc3dc[_0x377a6e];return _0x37f751;};'use strict';var _=require('lodash');var util=require(_0xcc3d('0x0'));var logger=require(_0xcc3d('0x1'))(_0xcc3d('0x2'));var moment=require('moment');var BPromise=require(_0xcc3d('0x3'));var rp=require(_0xcc3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc3d('0x5'));var config=require(_0xcc3d('0x6'));var attributes=require(_0xcc3d('0x7'));module[_0xcc3d('0x8')]=function(_0x1a11cf,_0x280c50){return _0x1a11cf[_0xcc3d('0x9')](_0xcc3d('0xa'),attributes,{'tableName':_0xcc3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc02b=['define','Integration','integrations','lodash','util','../../config/logger','api','moment','rimraf','./integration.attributes','exports'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xc02b,0xa8));var _0xbc02=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0xc02b[_0x4a7843];return _0x2c57fe;};'use strict';var _=require(_0xbc02('0x0'));var util=require(_0xbc02('0x1'));var logger=require(_0xbc02('0x2'))(_0xbc02('0x3'));var moment=require(_0xbc02('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc02('0x5'));var config=require('../../config/environment');var attributes=require(_0xbc02('0x6'));module[_0xbc02('0x7')]=function(_0x4f4c30,_0x34d638){return _0x4f4c30[_0xbc02('0x8')](_0xbc02('0x9'),attributes,{'tableName':_0xbc02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 6a70e9a..238f6f9 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x4975,0x86));var _0x5497=function(_0x487c01,_0x59819e){_0x487c01=_0x487c01-0x0;var _0x570f4d=_0x4975[_0x487c01];return _0x570f4d;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Integration,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4569fd,_0x4f2e82){var _0x10fca7=function(_0x3a969d){while(--_0x3a969d){_0x4569fd['push'](_0x4569fd['shift']());}};_0x10fca7(++_0x4f2e82);}(_0x896e,0x1e9));var _0xe896=function(_0xca20af,_0x21a04d){_0xca20af=_0xca20af-0x0;var _0x1c0c70=_0x896e[_0xca20af];return _0x1c0c70;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 98612d8..ec8c399 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 _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x31bb1d,_0x8eea6b){var _0x2eb906=function(_0xee1dbf){while(--_0xee1dbf){_0x31bb1d['push'](_0x31bb1d['shift']());}};_0x2eb906(++_0x8eea6b);}(_0x1a85,0x178));var _0x51a8=function(_0x66f455,_0x43978d){_0x66f455=_0x66f455-0x0;var _0x2f4d67=_0x1a85[_0x66f455];return _0x2f4d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x1a3e84,_0x59bd8a){var _0x38ed3c=function(_0x403fb4){while(--_0x403fb4){_0x1a3e84['push'](_0x1a3e84['shift']());}};_0x38ed3c(++_0x59bd8a);}(_0x7a54,0x106));var _0x47a5=function(_0x2782cb,_0x1d502e){_0x2782cb=_0x2782cb-0x0;var _0x222cf7=_0x7a54[_0x2782cb];return _0x222cf7;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 47b34a1..ecb8fa2 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 _0xdc55=['BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING','DATE'];(function(_0x3f713e,_0x143255){var _0x105bef=function(_0x4527e3){while(--_0x4527e3){_0x3f713e['push'](_0x3f713e['shift']());}};_0x105bef(++_0x143255);}(_0xdc55,0x1d5));var _0x5dc5=function(_0x14cb31,_0x3dac96){_0x14cb31=_0x14cb31-0x0;var _0x2ac886=_0xdc55[_0x14cb31];return _0x2ac886;};'use strict';var Sequelize=require(_0x5dc5('0x0'));module[_0x5dc5('0x1')]={'integration':{'type':Sequelize[_0x5dc5('0x2')]},'eventChannel':{'type':Sequelize[_0x5dc5('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x5dc5('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x5dc5('0x2')]},'uniqueid':{'type':Sequelize[_0x5dc5('0x2')]},'calleridnum':{'type':Sequelize[_0x5dc5('0x2')]},'calleridname':{'type':Sequelize[_0x5dc5('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5dc5('0x2')]},'membername':{'type':Sequelize[_0x5dc5('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5dc5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5dc5('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5dc5('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5dc5('0x5')]},'reason':{'type':Sequelize[_0x5dc5('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x5dc5('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5dc5('0x3')]},'agentdump':{'type':Sequelize[_0x5dc5('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5dc5('0x3')]},'lastevent':{'type':Sequelize[_0x5dc5('0x2')]},'channel':{'type':Sequelize[_0x5dc5('0x2')]},'channelstate':{'type':Sequelize[_0x5dc5('0x5')]},'channelstatedesc':{'type':Sequelize[_0x5dc5('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5dc5('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5dc5('0x2')]},'context':{'type':Sequelize[_0x5dc5('0x2')]},'exten':{'type':Sequelize[_0x5dc5('0x2')]},'priority':{'type':Sequelize[_0x5dc5('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x5dc5('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5dc5('0x2')]},'destcalleridname':{'type':Sequelize[_0x5dc5('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5dc5('0x2')]},'destlanguage':{'type':Sequelize[_0x5dc5('0x2')]},'destaccountcode':{'type':Sequelize[_0x5dc5('0x2')]},'destcontext':{'type':Sequelize[_0x5dc5('0x2')]},'destexten':{'type':Sequelize[_0x5dc5('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x5dc5('0x2')]},'messageId':{'type':Sequelize[_0x5dc5('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x5dc5('0x2')]},'from':{'type':Sequelize[_0x5dc5('0x2')]},'to':{'type':Sequelize[_0x5dc5('0x2')]},'cc':{'type':Sequelize[_0x5dc5('0x2')]},'attachment':{'type':Sequelize[_0x5dc5('0x6')]},'html':{'type':Sequelize[_0x5dc5('0x6')]},'text':{'type':Sequelize[_0x5dc5('0x6')]},'status':{'type':Sequelize[_0x5dc5('0x7')](_0x5dc5('0x8'),_0x5dc5('0x9'),_0x5dc5('0xa'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x5dc5('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa1e1=['BOOLEAN','INTEGER','TEXT','SENT','SENDING','RECEIVED','sequelize','exports','STRING','DATE'];(function(_0x3711ea,_0x2f9ddf){var _0x5cd289=function(_0x15069f){while(--_0x15069f){_0x3711ea['push'](_0x3711ea['shift']());}};_0x5cd289(++_0x2f9ddf);}(_0xa1e1,0x15a));var _0x1a1e=function(_0x305827,_0x273d1c){_0x305827=_0x305827-0x0;var _0x262131=_0xa1e1[_0x305827];return _0x262131;};'use strict';var Sequelize=require(_0x1a1e('0x0'));module[_0x1a1e('0x1')]={'integration':{'type':Sequelize[_0x1a1e('0x2')]},'eventChannel':{'type':Sequelize[_0x1a1e('0x2')]},'exitStatus':{'type':Sequelize[_0x1a1e('0x2')]},'ticketId':{'type':Sequelize[_0x1a1e('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x1a1e('0x2')]},'uniqueid':{'type':Sequelize[_0x1a1e('0x2')]},'calleridnum':{'type':Sequelize[_0x1a1e('0x2')]},'calleridname':{'type':Sequelize[_0x1a1e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1a1e('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x1a1e('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1a1e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1a1e('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1a1e('0x3')]},'talktime':{'type':Sequelize[_0x1a1e('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1a1e('0x5')]},'reason':{'type':Sequelize[_0x1a1e('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x1a1e('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1a1e('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1a1e('0x3')]},'lastevent':{'type':Sequelize[_0x1a1e('0x2')]},'channel':{'type':Sequelize[_0x1a1e('0x2')]},'channelstate':{'type':Sequelize[_0x1a1e('0x5')]},'channelstatedesc':{'type':Sequelize[_0x1a1e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1a1e('0x2')]},'context':{'type':Sequelize[_0x1a1e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1a1e('0x2')]},'destchannel':{'type':Sequelize[_0x1a1e('0x2')]},'destchannelstate':{'type':Sequelize[_0x1a1e('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x1a1e('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x1a1e('0x2')]},'destaccountcode':{'type':Sequelize[_0x1a1e('0x2')]},'destcontext':{'type':Sequelize[_0x1a1e('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x1a1e('0x2')]},'inReplyTo':{'type':Sequelize[_0x1a1e('0x2')]},'subject':{'type':Sequelize[_0x1a1e('0x2')]},'from':{'type':Sequelize[_0x1a1e('0x2')]},'to':{'type':Sequelize[_0x1a1e('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x1a1e('0x6')]},'html':{'type':Sequelize[_0x1a1e('0x6')]},'text':{'type':Sequelize[_0x1a1e('0x6')]},'status':{'type':Sequelize['ENUM'](_0x1a1e('0x7'),_0x1a1e('0x8'),_0x1a1e('0x9'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x1a1e('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index fb6c039..ce13634 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 _0xcf21=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs'];(function(_0x373a67,_0x5af5ff){var _0x15d61b=function(_0x226d35){while(--_0x226d35){_0x373a67['push'](_0x373a67['shift']());}};_0x15d61b(++_0x5af5ff);}(_0xcf21,0x12a));var _0x1cf2=function(_0x4acda3,_0x1bd408){_0x4acda3=_0x4acda3-0x0;var _0x200fa7=_0xcf21[_0x4acda3];return _0x200fa7;};'use strict';var emlformat=require(_0x1cf2('0x0'));var rimraf=require(_0x1cf2('0x1'));var zipdir=require(_0x1cf2('0x2'));var jsonpatch=require(_0x1cf2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cf2('0x4'));var Mustache=require(_0x1cf2('0x5'));var util=require(_0x1cf2('0x6'));var path=require(_0x1cf2('0x7'));var sox=require(_0x1cf2('0x8'));var csv=require('to-csv');var ejs=require(_0x1cf2('0x9'));var fs=require('fs');var fs_extra=require(_0x1cf2('0xa'));var _=require(_0x1cf2('0xb'));var squel=require(_0x1cf2('0xc'));var crypto=require(_0x1cf2('0xd'));var jsforce=require(_0x1cf2('0xe'));var deskjs=require(_0x1cf2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cf2('0x10'));var Redis=require('ioredis');var authService=require(_0x1cf2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1cf2('0x12'));var hardwareService=require(_0x1cf2('0x13'));var logger=require(_0x1cf2('0x14'))(_0x1cf2('0x15'));var utils=require(_0x1cf2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1cf2('0x17'));var db=require(_0x1cf2('0x18'))['db'];function respondWithStatusCode(_0x3b10ae,_0x3e02e9){_0x3e02e9=_0x3e02e9||0xcc;return function(_0x2a8a93){if(_0x2a8a93){return _0x3b10ae[_0x1cf2('0x19')](_0x3e02e9);}return _0x3b10ae[_0x1cf2('0x1a')](_0x3e02e9)['end']();};}function respondWithResult(_0x1a1e59,_0x8e65cd){_0x8e65cd=_0x8e65cd||0xc8;return function(_0x54e3da){if(_0x54e3da){return _0x1a1e59[_0x1cf2('0x1a')](_0x8e65cd)[_0x1cf2('0x1b')](_0x54e3da);}};}function respondWithFilteredResult(_0x39cbf,_0x58f7d8){return function(_0x1d7692){if(_0x1d7692){var _0x484ac8=typeof _0x58f7d8[_0x1cf2('0x1c')]==='undefined'&&typeof _0x58f7d8[_0x1cf2('0x1d')]===_0x1cf2('0x1e');var _0x56d759=_0x1d7692[_0x1cf2('0x1f')];var _0x21718c=_0x484ac8?0x0:_0x58f7d8[_0x1cf2('0x1c')];var _0x487186=_0x484ac8?_0x1d7692[_0x1cf2('0x1f')]:_0x58f7d8[_0x1cf2('0x1c')]+_0x58f7d8[_0x1cf2('0x1d')];var _0x4db9cf;if(_0x487186>=_0x56d759){_0x487186=_0x56d759;_0x4db9cf=0xc8;}else{_0x4db9cf=0xce;}_0x39cbf['status'](_0x4db9cf);return _0x39cbf['set']('Content-Range',_0x21718c+'-'+_0x487186+'/'+_0x56d759)[_0x1cf2('0x1b')](_0x1d7692);}return null;};}function patchUpdates(_0x694789){return function(_0x1e430d){try{jsonpatch[_0x1cf2('0x20')](_0x1e430d,_0x694789,!![]);}catch(_0x113149){return BPromise[_0x1cf2('0x21')](_0x113149);}return _0x1e430d[_0x1cf2('0x22')]();};}function saveUpdates(_0x261b67,_0x4c8606){return function(_0x448598){if(_0x448598){return _0x448598[_0x1cf2('0x23')](_0x261b67)[_0x1cf2('0x24')](function(_0xf763f){return _0xf763f;});}return null;};}function removeEntity(_0x292d64,_0x204a04){return function(_0x13f854){if(_0x13f854){return _0x13f854[_0x1cf2('0x25')]()[_0x1cf2('0x24')](function(){_0x292d64[_0x1cf2('0x1a')](0xcc)[_0x1cf2('0x26')]();});}};}function handleEntityNotFound(_0x61d794,_0x24faf8){return function(_0x179d25){if(!_0x179d25){_0x61d794[_0x1cf2('0x19')](0x194);}return _0x179d25;};}function handleError(_0x21cb3a,_0x4e46af){_0x4e46af=_0x4e46af||0x1f4;return function(_0x268617){logger['error'](_0x268617[_0x1cf2('0x27')]);if(_0x268617[_0x1cf2('0x28')]){delete _0x268617[_0x1cf2('0x28')];}_0x21cb3a[_0x1cf2('0x1a')](_0x4e46af)[_0x1cf2('0x29')](_0x268617);};}exports[_0x1cf2('0x2a')]=function(_0x44b10c,_0x4ae1fa){var _0x59b6f8={},_0x3d9856={},_0x22077a={'count':0x0,'rows':[]};var _0xfef37b=_[_0x1cf2('0x2b')](db[_0x1cf2('0x2c')][_0x1cf2('0x2d')],function(_0x189c3c){return{'name':_0x189c3c[_0x1cf2('0x2e')],'type':_0x189c3c[_0x1cf2('0x2f')][_0x1cf2('0x30')]};});_0x3d9856['model']=_['map'](_0xfef37b,_0x1cf2('0x28'));_0x3d9856['query']=_[_0x1cf2('0x31')](_0x44b10c[_0x1cf2('0x32')]);_0x3d9856['filters']=_[_0x1cf2('0x33')](_0x3d9856[_0x1cf2('0x34')],_0x3d9856[_0x1cf2('0x32')]);_0x59b6f8[_0x1cf2('0x35')]=_['intersection'](_0x3d9856[_0x1cf2('0x34')],qs[_0x1cf2('0x36')](_0x44b10c[_0x1cf2('0x32')][_0x1cf2('0x36')]));_0x59b6f8[_0x1cf2('0x35')]=_0x59b6f8[_0x1cf2('0x35')][_0x1cf2('0x37')]?_0x59b6f8['attributes']:_0x3d9856[_0x1cf2('0x34')];if(!_0x44b10c[_0x1cf2('0x32')][_0x1cf2('0x38')](_0x1cf2('0x39'))){_0x59b6f8[_0x1cf2('0x1d')]=qs[_0x1cf2('0x1d')](_0x44b10c[_0x1cf2('0x32')][_0x1cf2('0x1d')]);_0x59b6f8[_0x1cf2('0x1c')]=qs[_0x1cf2('0x1c')](_0x44b10c[_0x1cf2('0x32')][_0x1cf2('0x1c')]);}_0x59b6f8[_0x1cf2('0x3a')]=qs[_0x1cf2('0x3b')](_0x44b10c[_0x1cf2('0x32')]['sort']);_0x59b6f8[_0x1cf2('0x3c')]=qs[_0x1cf2('0x3d')](_['pick'](_0x44b10c[_0x1cf2('0x32')],_0x3d9856[_0x1cf2('0x3d')]),_0xfef37b);if(_0x44b10c[_0x1cf2('0x32')]['filter']){_0x59b6f8[_0x1cf2('0x3c')]=_[_0x1cf2('0x3e')](_0x59b6f8['where'],{'$or':_[_0x1cf2('0x2b')](_0xfef37b,function(_0x4cd974){if(_0x4cd974[_0x1cf2('0x2f')]!==_0x1cf2('0x3f')){var _0x485384={};_0x485384[_0x4cd974['name']]={'$like':'%'+_0x44b10c[_0x1cf2('0x32')][_0x1cf2('0x40')]+'%'};return _0x485384;}})});}_0x59b6f8=_[_0x1cf2('0x3e')]({},_0x59b6f8,_0x44b10c[_0x1cf2('0x41')]);var _0x4d2e27={'where':_0x59b6f8[_0x1cf2('0x3c')]};return db[_0x1cf2('0x2c')]['count'](_0x4d2e27)[_0x1cf2('0x24')](function(_0x6e4085){_0x22077a[_0x1cf2('0x1f')]=_0x6e4085;if(_0x44b10c['query'][_0x1cf2('0x42')]){_0x59b6f8[_0x1cf2('0x43')]=[{'all':!![]}];}return db[_0x1cf2('0x2c')][_0x1cf2('0x44')](_0x59b6f8);})[_0x1cf2('0x24')](function(_0x20a2ed){_0x22077a[_0x1cf2('0x45')]=_0x20a2ed;return _0x22077a;})['then'](respondWithFilteredResult(_0x4ae1fa,_0x59b6f8))[_0x1cf2('0x46')](handleError(_0x4ae1fa,null));};exports[_0x1cf2('0x47')]=function(_0x4aaa0a,_0xc9266d){var _0x5e5f7e={'raw':![],'where':{'id':_0x4aaa0a[_0x1cf2('0x48')]['id']}},_0x32a5ff={};_0x32a5ff[_0x1cf2('0x34')]=_[_0x1cf2('0x31')](db['IntegrationReport'][_0x1cf2('0x2d')]);_0x32a5ff[_0x1cf2('0x32')]=_[_0x1cf2('0x31')](_0x4aaa0a['query']);_0x32a5ff[_0x1cf2('0x3d')]=_[_0x1cf2('0x33')](_0x32a5ff[_0x1cf2('0x34')],_0x32a5ff[_0x1cf2('0x32')]);_0x5e5f7e[_0x1cf2('0x35')]=_[_0x1cf2('0x33')](_0x32a5ff['model'],qs[_0x1cf2('0x36')](_0x4aaa0a[_0x1cf2('0x32')][_0x1cf2('0x36')]));_0x5e5f7e[_0x1cf2('0x35')]=_0x5e5f7e[_0x1cf2('0x35')]['length']?_0x5e5f7e['attributes']:_0x32a5ff[_0x1cf2('0x34')];if(_0x4aaa0a['query']['includeAll']){_0x5e5f7e[_0x1cf2('0x43')]=[{'all':!![]}];}_0x5e5f7e=_[_0x1cf2('0x3e')]({},_0x5e5f7e,_0x4aaa0a[_0x1cf2('0x41')]);return db[_0x1cf2('0x2c')][_0x1cf2('0x49')](_0x5e5f7e)[_0x1cf2('0x24')](handleEntityNotFound(_0xc9266d,null))[_0x1cf2('0x24')](respondWithResult(_0xc9266d,null))[_0x1cf2('0x46')](handleError(_0xc9266d,null));};exports['create']=function(_0x12f324,_0x371104){return db[_0x1cf2('0x2c')][_0x1cf2('0x4a')](_0x12f324[_0x1cf2('0x4b')],{})[_0x1cf2('0x24')](respondWithResult(_0x371104,0xc9))[_0x1cf2('0x46')](handleError(_0x371104,null));};exports[_0x1cf2('0x23')]=function(_0x1cec1c,_0x157621){if(_0x1cec1c[_0x1cf2('0x4b')]['id']){delete _0x1cec1c[_0x1cf2('0x4b')]['id'];}return db['IntegrationReport'][_0x1cf2('0x49')]({'where':{'id':_0x1cec1c[_0x1cf2('0x48')]['id']}})[_0x1cf2('0x24')](handleEntityNotFound(_0x157621,null))['then'](saveUpdates(_0x1cec1c[_0x1cf2('0x4b')],null))['then'](respondWithResult(_0x157621,null))['catch'](handleError(_0x157621,null));};exports[_0x1cf2('0x25')]=function(_0x50cc3b,_0x33c3a9){return db[_0x1cf2('0x2c')][_0x1cf2('0x49')]({'where':{'id':_0x50cc3b[_0x1cf2('0x48')]['id']}})['then'](handleEntityNotFound(_0x33c3a9,null))[_0x1cf2('0x24')](removeEntity(_0x33c3a9,null))[_0x1cf2('0x46')](handleError(_0x33c3a9,null));};exports[_0x1cf2('0x4c')]=function(_0x167df4,_0x172b71){return db[_0x1cf2('0x2c')][_0x1cf2('0x4c')]()[_0x1cf2('0x24')](respondWithResult(_0x172b71,null))[_0x1cf2('0x46')](handleError(_0x172b71,null));}; \ No newline at end of file +var _0x2023=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','IntegrationReport','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x2b19e3,_0x415dfe){var _0x2eae31=function(_0x20390e){while(--_0x20390e){_0x2b19e3['push'](_0x2b19e3['shift']());}};_0x2eae31(++_0x415dfe);}(_0x2023,0x1c4));var _0x3202=function(_0x3ab688,_0x1179eb){_0x3ab688=_0x3ab688-0x0;var _0x2c03c4=_0x2023[_0x3ab688];return _0x2c03c4;};'use strict';var emlformat=require(_0x3202('0x0'));var rimraf=require(_0x3202('0x1'));var zipdir=require(_0x3202('0x2'));var jsonpatch=require(_0x3202('0x3'));var rp=require(_0x3202('0x4'));var moment=require(_0x3202('0x5'));var BPromise=require(_0x3202('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3202('0x7'));var sox=require(_0x3202('0x8'));var csv=require(_0x3202('0x9'));var ejs=require(_0x3202('0xa'));var fs=require('fs');var fs_extra=require(_0x3202('0xb'));var _=require(_0x3202('0xc'));var squel=require('squel');var crypto=require(_0x3202('0xd'));var jsforce=require(_0x3202('0xe'));var deskjs=require(_0x3202('0xf'));var toCsv=require(_0x3202('0x9'));var querystring=require('querystring');var Papa=require(_0x3202('0x10'));var Redis=require('ioredis');var authService=require(_0x3202('0x11'));var qs=require(_0x3202('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3202('0x13'))(_0x3202('0x14'));var utils=require(_0x3202('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3202('0x16'))['db'];function respondWithStatusCode(_0x373f8b,_0x3c5448){_0x3c5448=_0x3c5448||0xcc;return function(_0x7648ce){if(_0x7648ce){return _0x373f8b[_0x3202('0x17')](_0x3c5448);}return _0x373f8b[_0x3202('0x18')](_0x3c5448)[_0x3202('0x19')]();};}function respondWithResult(_0x51f917,_0x22f89c){_0x22f89c=_0x22f89c||0xc8;return function(_0x392565){if(_0x392565){return _0x51f917[_0x3202('0x18')](_0x22f89c)['json'](_0x392565);}};}function respondWithFilteredResult(_0x360378,_0x9489f6){return function(_0x598b3d){if(_0x598b3d){var _0x2ea2eb=typeof _0x9489f6[_0x3202('0x1a')]==='undefined'&&typeof _0x9489f6[_0x3202('0x1b')]==='undefined';var _0x10fdce=_0x598b3d[_0x3202('0x1c')];var _0x2755bb=_0x2ea2eb?0x0:_0x9489f6[_0x3202('0x1a')];var _0x102d90=_0x2ea2eb?_0x598b3d[_0x3202('0x1c')]:_0x9489f6[_0x3202('0x1a')]+_0x9489f6['limit'];var _0x532d40;if(_0x102d90>=_0x10fdce){_0x102d90=_0x10fdce;_0x532d40=0xc8;}else{_0x532d40=0xce;}_0x360378[_0x3202('0x18')](_0x532d40);return _0x360378[_0x3202('0x1d')](_0x3202('0x1e'),_0x2755bb+'-'+_0x102d90+'/'+_0x10fdce)['json'](_0x598b3d);}return null;};}function patchUpdates(_0x41bb9b){return function(_0x46f4e3){try{jsonpatch[_0x3202('0x1f')](_0x46f4e3,_0x41bb9b,!![]);}catch(_0x48b17){return BPromise[_0x3202('0x20')](_0x48b17);}return _0x46f4e3[_0x3202('0x21')]();};}function saveUpdates(_0xb577c4,_0x5ce40a){return function(_0x39ded3){if(_0x39ded3){return _0x39ded3[_0x3202('0x22')](_0xb577c4)['then'](function(_0x587681){return _0x587681;});}return null;};}function removeEntity(_0x3646fe,_0x5245a2){return function(_0x435aa3){if(_0x435aa3){return _0x435aa3[_0x3202('0x23')]()[_0x3202('0x24')](function(){_0x3646fe['status'](0xcc)[_0x3202('0x19')]();});}};}function handleEntityNotFound(_0xfdae32,_0x1db813){return function(_0x4a5ef9){if(!_0x4a5ef9){_0xfdae32[_0x3202('0x17')](0x194);}return _0x4a5ef9;};}function handleError(_0x4cfcb9,_0x44c46b){_0x44c46b=_0x44c46b||0x1f4;return function(_0x5b1bcc){logger[_0x3202('0x25')](_0x5b1bcc[_0x3202('0x26')]);if(_0x5b1bcc['name']){delete _0x5b1bcc[_0x3202('0x27')];}_0x4cfcb9[_0x3202('0x18')](_0x44c46b)[_0x3202('0x28')](_0x5b1bcc);};}exports[_0x3202('0x29')]=function(_0x1b18d2,_0xa60935){var _0x119a1c={},_0x466cc4={},_0x3b1df2={'count':0x0,'rows':[]};var _0x52830a=_[_0x3202('0x2a')](db['IntegrationReport'][_0x3202('0x2b')],function(_0x410174){return{'name':_0x410174[_0x3202('0x2c')],'type':_0x410174[_0x3202('0x2d')][_0x3202('0x2e')]};});_0x466cc4[_0x3202('0x2f')]=_['map'](_0x52830a,_0x3202('0x27'));_0x466cc4[_0x3202('0x30')]=_[_0x3202('0x31')](_0x1b18d2['query']);_0x466cc4['filters']=_[_0x3202('0x32')](_0x466cc4[_0x3202('0x2f')],_0x466cc4[_0x3202('0x30')]);_0x119a1c[_0x3202('0x33')]=_[_0x3202('0x32')](_0x466cc4[_0x3202('0x2f')],qs['fields'](_0x1b18d2[_0x3202('0x30')]['fields']));_0x119a1c['attributes']=_0x119a1c[_0x3202('0x33')][_0x3202('0x34')]?_0x119a1c[_0x3202('0x33')]:_0x466cc4[_0x3202('0x2f')];if(!_0x1b18d2[_0x3202('0x30')][_0x3202('0x35')](_0x3202('0x36'))){_0x119a1c[_0x3202('0x1b')]=qs['limit'](_0x1b18d2[_0x3202('0x30')][_0x3202('0x1b')]);_0x119a1c[_0x3202('0x1a')]=qs[_0x3202('0x1a')](_0x1b18d2[_0x3202('0x30')][_0x3202('0x1a')]);}_0x119a1c[_0x3202('0x37')]=qs[_0x3202('0x38')](_0x1b18d2['query'][_0x3202('0x38')]);_0x119a1c[_0x3202('0x39')]=qs[_0x3202('0x3a')](_[_0x3202('0x3b')](_0x1b18d2[_0x3202('0x30')],_0x466cc4[_0x3202('0x3a')]),_0x52830a);if(_0x1b18d2[_0x3202('0x30')]['filter']){_0x119a1c[_0x3202('0x39')]=_[_0x3202('0x3c')](_0x119a1c[_0x3202('0x39')],{'$or':_[_0x3202('0x2a')](_0x52830a,function(_0x5d521d){if(_0x5d521d[_0x3202('0x2d')]!==_0x3202('0x3d')){var _0x2dfc40={};_0x2dfc40[_0x5d521d[_0x3202('0x27')]]={'$like':'%'+_0x1b18d2['query'][_0x3202('0x3e')]+'%'};return _0x2dfc40;}})});}_0x119a1c=_[_0x3202('0x3c')]({},_0x119a1c,_0x1b18d2[_0x3202('0x3f')]);var _0x276abf={'where':_0x119a1c['where']};return db[_0x3202('0x40')][_0x3202('0x1c')](_0x276abf)[_0x3202('0x24')](function(_0x30e608){_0x3b1df2['count']=_0x30e608;if(_0x1b18d2[_0x3202('0x30')][_0x3202('0x41')]){_0x119a1c[_0x3202('0x42')]=[{'all':!![]}];}return db[_0x3202('0x40')][_0x3202('0x43')](_0x119a1c);})[_0x3202('0x24')](function(_0x303025){_0x3b1df2[_0x3202('0x44')]=_0x303025;return _0x3b1df2;})[_0x3202('0x24')](respondWithFilteredResult(_0xa60935,_0x119a1c))['catch'](handleError(_0xa60935,null));};exports[_0x3202('0x45')]=function(_0x3e644d,_0x1f0d0c){var _0x233199={'raw':![],'where':{'id':_0x3e644d[_0x3202('0x46')]['id']}},_0x3a78cc={};_0x3a78cc[_0x3202('0x2f')]=_[_0x3202('0x31')](db[_0x3202('0x40')][_0x3202('0x2b')]);_0x3a78cc[_0x3202('0x30')]=_[_0x3202('0x31')](_0x3e644d['query']);_0x3a78cc['filters']=_[_0x3202('0x32')](_0x3a78cc[_0x3202('0x2f')],_0x3a78cc[_0x3202('0x30')]);_0x233199[_0x3202('0x33')]=_[_0x3202('0x32')](_0x3a78cc[_0x3202('0x2f')],qs[_0x3202('0x47')](_0x3e644d['query'][_0x3202('0x47')]));_0x233199['attributes']=_0x233199[_0x3202('0x33')][_0x3202('0x34')]?_0x233199[_0x3202('0x33')]:_0x3a78cc[_0x3202('0x2f')];if(_0x3e644d[_0x3202('0x30')][_0x3202('0x41')]){_0x233199[_0x3202('0x42')]=[{'all':!![]}];}_0x233199=_[_0x3202('0x3c')]({},_0x233199,_0x3e644d['options']);return db[_0x3202('0x40')]['find'](_0x233199)[_0x3202('0x24')](handleEntityNotFound(_0x1f0d0c,null))[_0x3202('0x24')](respondWithResult(_0x1f0d0c,null))[_0x3202('0x48')](handleError(_0x1f0d0c,null));};exports[_0x3202('0x49')]=function(_0x280919,_0x12d981){return db[_0x3202('0x40')][_0x3202('0x49')](_0x280919[_0x3202('0x4a')],{})[_0x3202('0x24')](respondWithResult(_0x12d981,0xc9))[_0x3202('0x48')](handleError(_0x12d981,null));};exports['update']=function(_0x536bf9,_0x47c050){if(_0x536bf9[_0x3202('0x4a')]['id']){delete _0x536bf9[_0x3202('0x4a')]['id'];}return db[_0x3202('0x40')]['find']({'where':{'id':_0x536bf9[_0x3202('0x46')]['id']}})[_0x3202('0x24')](handleEntityNotFound(_0x47c050,null))[_0x3202('0x24')](saveUpdates(_0x536bf9[_0x3202('0x4a')],null))[_0x3202('0x24')](respondWithResult(_0x47c050,null))['catch'](handleError(_0x47c050,null));};exports[_0x3202('0x23')]=function(_0x3f2471,_0x120851){return db[_0x3202('0x40')][_0x3202('0x4b')]({'where':{'id':_0x3f2471[_0x3202('0x46')]['id']}})[_0x3202('0x24')](handleEntityNotFound(_0x120851,null))[_0x3202('0x24')](removeEntity(_0x120851,null))[_0x3202('0x48')](handleError(_0x120851,null));};exports[_0x3202('0x4c')]=function(_0xe0fc13,_0xa7dd8f){return db[_0x3202('0x40')][_0x3202('0x4c')]()['then'](respondWithResult(_0xa7dd8f,null))[_0x3202('0x48')](handleError(_0xa7dd8f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 63558ba..831cf06 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 _0x184c=['api','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger'];(function(_0x1685c6,_0x451816){var _0x520122=function(_0x1d14a9){while(--_0x1d14a9){_0x1685c6['push'](_0x1685c6['shift']());}};_0x520122(++_0x451816);}(_0x184c,0x1c4));var _0xc184=function(_0x35c1b4,_0x1e310e){_0x35c1b4=_0x35c1b4-0x0;var _0x44cd33=_0x184c[_0x35c1b4];return _0x44cd33;};'use strict';var _=require(_0xc184('0x0'));var util=require(_0xc184('0x1'));var logger=require(_0xc184('0x2'))(_0xc184('0x3'));var moment=require(_0xc184('0x4'));var BPromise=require(_0xc184('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc184('0x6'));var rimraf=require(_0xc184('0x7'));var config=require(_0xc184('0x8'));var attributes=require(_0xc184('0x9'));module[_0xc184('0xa')]=function(_0xc86740,_0x371734){return _0xc86740[_0xc184('0xb')](_0xc184('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe61=['IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x2a351b,_0x31ba01){var _0x3b36af=function(_0x401bd2){while(--_0x401bd2){_0x2a351b['push'](_0x2a351b['shift']());}};_0x3b36af(++_0x31ba01);}(_0xfe61,0x1a4));var _0x1fe6=function(_0x10c280,_0x4a09a4){_0x10c280=_0x10c280-0x0;var _0x4f3d44=_0xfe61[_0x10c280];return _0x4f3d44;};'use strict';var _=require(_0x1fe6('0x0'));var util=require(_0x1fe6('0x1'));var logger=require(_0x1fe6('0x2'))(_0x1fe6('0x3'));var moment=require(_0x1fe6('0x4'));var BPromise=require('bluebird');var rp=require(_0x1fe6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fe6('0x6'));var config=require(_0x1fe6('0x7'));var attributes=require('./integrationReport.attributes');module[_0x1fe6('0x8')]=function(_0x3ca405,_0xffd77){return _0x3ca405['define'](_0x1fe6('0x9'),attributes,{'tableName':_0x1fe6('0xa'),'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 085cd86..54fdae3 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x524e,0x15e));var _0xe524=function(_0x1365fe,_0x24eaee){_0x1365fe=_0x1365fe-0x0;var _0x31d66=_0x524e[_0x1365fe];return _0x31d66;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x560b3e,_0x5dfd95){var _0x843ac2=function(_0x1f327e){while(--_0x1f327e){_0x560b3e['push'](_0x560b3e['shift']());}};_0x843ac2(++_0x5dfd95);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 84b237e..d51f7dc 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 _0xea44=['Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','addInterval','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x185d2a,_0x308609){var _0x4dea27=function(_0x513443){while(--_0x513443){_0x185d2a['push'](_0x185d2a['shift']());}};_0x4dea27(++_0x308609);}(_0xea44,0x1a5));var _0x4ea4=function(_0x23adf1,_0xac3762){_0x23adf1=_0x23adf1-0x0;var _0x25b499=_0xea44[_0x23adf1];return _0x25b499;};'use strict';var multer=require(_0x4ea4('0x0'));var util=require(_0x4ea4('0x1'));var path=require(_0x4ea4('0x2'));var timeout=require(_0x4ea4('0x3'));var express=require('express');var router=express[_0x4ea4('0x4')]();var fs_extra=require(_0x4ea4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ea4('0x6'));var config=require(_0x4ea4('0x7'));var controller=require(_0x4ea4('0x8'));router[_0x4ea4('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ea4('0xa')]);router[_0x4ea4('0x9')](_0x4ea4('0xb'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xd')]);router[_0x4ea4('0x9')](_0x4ea4('0xe'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xf')]);router['post']('/',auth[_0x4ea4('0xc')](),controller['create']);router['post'](_0x4ea4('0xe'),auth['isAuthenticated'](),controller[_0x4ea4('0x10')]);router[_0x4ea4('0x11')](_0x4ea4('0x12'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0x13')]);router[_0x4ea4('0x14')](_0x4ea4('0xb'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0x15')]);router[_0x4ea4('0x16')](_0x4ea4('0xb'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0x17')]);module[_0x4ea4('0x18')]=router; \ No newline at end of file +var _0x2e65=['isAuthenticated','index','/:id','show','getIntervals','/:id/sub_intervals','addInterval','post','/:id/sub_intervals/create_many','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get'];(function(_0x5df4f6,_0x5b4fcf){var _0x442adb=function(_0x4c874d){while(--_0x4c874d){_0x5df4f6['push'](_0x5df4f6['shift']());}};_0x442adb(++_0x5b4fcf);}(_0x2e65,0x193));var _0x52e6=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x2e65[_0x1347f8];return _0x218368;};'use strict';var multer=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var path=require(_0x52e6('0x2'));var timeout=require(_0x52e6('0x3'));var express=require(_0x52e6('0x4'));var router=express[_0x52e6('0x5')]();var fs_extra=require(_0x52e6('0x6'));var auth=require(_0x52e6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x52e6('0x8'));var controller=require(_0x52e6('0x9'));router[_0x52e6('0xa')]('/',auth[_0x52e6('0xb')](),controller[_0x52e6('0xc')]);router[_0x52e6('0xa')](_0x52e6('0xd'),auth[_0x52e6('0xb')](),controller[_0x52e6('0xe')]);router[_0x52e6('0xa')]('/:id/sub_intervals',auth[_0x52e6('0xb')](),controller[_0x52e6('0xf')]);router['post']('/',auth[_0x52e6('0xb')](),controller['create']);router['post'](_0x52e6('0x10'),auth[_0x52e6('0xb')](),controller[_0x52e6('0x11')]);router[_0x52e6('0x12')](_0x52e6('0x13'),auth[_0x52e6('0xb')](),controller['addIntervals']);router['put'](_0x52e6('0xd'),auth[_0x52e6('0xb')](),controller['update']);router[_0x52e6('0x14')](_0x52e6('0xd'),auth[_0x52e6('0xb')](),controller[_0x52e6('0x15')]);module[_0x52e6('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9b819c1..c368444 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 _0x5eb1=['sequelize','exports','STRING'];(function(_0x23ca3a,_0xe44c43){var _0x5c1aab=function(_0x29bcdd){while(--_0x29bcdd){_0x23ca3a['push'](_0x23ca3a['shift']());}};_0x5c1aab(++_0xe44c43);}(_0x5eb1,0x1a1));var _0x15eb=function(_0x26a672,_0x59f5be){_0x26a672=_0x26a672-0x0;var _0x348f43=_0x5eb1[_0x26a672];return _0x348f43;};'use strict';var Sequelize=require(_0x15eb('0x0'));module[_0x15eb('0x1')]={'name':{'type':Sequelize[_0x15eb('0x2')]},'description':{'type':Sequelize[_0x15eb('0x2')]},'interval':{'type':Sequelize[_0x15eb('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xbdf6=['exports','STRING'];(function(_0x1559a3,_0x1e4f51){var _0x3a4b87=function(_0x5212d2){while(--_0x5212d2){_0x1559a3['push'](_0x1559a3['shift']());}};_0x3a4b87(++_0x1e4f51);}(_0xbdf6,0x140));var _0x6bdf=function(_0x1cc709,_0x139d27){_0x1cc709=_0x1cc709-0x0;var _0x2c7067=_0xbdf6[_0x1cc709];return _0x2c7067;};'use strict';var Sequelize=require('sequelize');module[_0x6bdf('0x0')]={'name':{'type':Sequelize[_0x6bdf('0x1')]},'description':{'type':Sequelize[_0x6bdf('0x1')]},'interval':{'type':Sequelize[_0x6bdf('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 2564cf5..54f7a8e 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 _0xcdd6=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','fieldName','type','model','map','keys','filters','intersection','query','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Interval','includeAll','findAll','catch','show','rawAttributes','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','sequelize','transaction','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','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','../../components/extensions/rewrite','sendStatus','status','end'];(function(_0x291589,_0x394acd){var _0x304d5d=function(_0x12e247){while(--_0x12e247){_0x291589['push'](_0x291589['shift']());}};_0x304d5d(++_0x394acd);}(_0xcdd6,0xf5));var _0x6cdd=function(_0x56172a,_0x4e9617){_0x56172a=_0x56172a-0x0;var _0x259380=_0xcdd6[_0x56172a];return _0x259380;};'use strict';var emlformat=require(_0x6cdd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6cdd('0x1'));var rp=require(_0x6cdd('0x2'));var moment=require(_0x6cdd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cdd('0x4'));var path=require(_0x6cdd('0x5'));var sox=require('sox');var csv=require(_0x6cdd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cdd('0x7'));var _=require(_0x6cdd('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6cdd('0x9'));var deskjs=require(_0x6cdd('0xa'));var toCsv=require(_0x6cdd('0x6'));var querystring=require(_0x6cdd('0xb'));var Papa=require(_0x6cdd('0xc'));var Redis=require('ioredis');var authService=require(_0x6cdd('0xd'));var qs=require(_0x6cdd('0xe'));var as=require(_0x6cdd('0xf'));var hardwareService=require(_0x6cdd('0x10'));var logger=require(_0x6cdd('0x11'))(_0x6cdd('0x12'));var utils=require(_0x6cdd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6cdd('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6cdd('0x15'));function respondWithStatusCode(_0x4bb4f9,_0x200ac9){_0x200ac9=_0x200ac9||0xcc;return function(_0x316d10){if(_0x316d10){return _0x4bb4f9[_0x6cdd('0x16')](_0x200ac9);}return _0x4bb4f9[_0x6cdd('0x17')](_0x200ac9)[_0x6cdd('0x18')]();};}function respondWithResult(_0x3ac029,_0x1aa78f){_0x1aa78f=_0x1aa78f||0xc8;return function(_0x267438){if(_0x267438){return _0x3ac029[_0x6cdd('0x17')](_0x1aa78f)[_0x6cdd('0x19')](_0x267438);}};}function respondWithFilteredResult(_0x5556c2,_0x161873){return function(_0x5906c4){if(_0x5906c4){var _0x26d97c=typeof _0x161873[_0x6cdd('0x1a')]===_0x6cdd('0x1b')&&typeof _0x161873[_0x6cdd('0x1c')]===_0x6cdd('0x1b');var _0x20f92b=_0x5906c4[_0x6cdd('0x1d')];var _0x460fc3=_0x26d97c?0x0:_0x161873[_0x6cdd('0x1a')];var _0x8ce07c=_0x26d97c?_0x5906c4[_0x6cdd('0x1d')]:_0x161873[_0x6cdd('0x1a')]+_0x161873[_0x6cdd('0x1c')];var _0x4edbd4;if(_0x8ce07c>=_0x20f92b){_0x8ce07c=_0x20f92b;_0x4edbd4=0xc8;}else{_0x4edbd4=0xce;}_0x5556c2[_0x6cdd('0x17')](_0x4edbd4);return _0x5556c2[_0x6cdd('0x1e')](_0x6cdd('0x1f'),_0x460fc3+'-'+_0x8ce07c+'/'+_0x20f92b)['json'](_0x5906c4);}return null;};}function patchUpdates(_0x1a85d1){return function(_0x553d72){try{jsonpatch[_0x6cdd('0x20')](_0x553d72,_0x1a85d1,!![]);}catch(_0x1f3870){return BPromise[_0x6cdd('0x21')](_0x1f3870);}return _0x553d72[_0x6cdd('0x22')]();};}function saveUpdates(_0x322ba7,_0x1c2ab7){return function(_0x5448a5){if(_0x5448a5){return _0x5448a5['update'](_0x322ba7)[_0x6cdd('0x23')](function(_0x2f9214){return _0x2f9214;});}return null;};}function removeEntity(_0x2e4796,_0x4e0cc8){return function(_0x42a209){if(_0x42a209){return _0x42a209['destroy']()['then'](function(){var _0x3bc45b=_0x42a209[_0x6cdd('0x24')]({'plain':!![]});var _0x58d4bc='Intervals';return db[_0x6cdd('0x25')][_0x6cdd('0x26')]({'where':{'type':_0x58d4bc,'resourceId':_0x3bc45b['id']}})['then'](function(){return _0x42a209;});})[_0x6cdd('0x23')](function(){_0x2e4796[_0x6cdd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cce5,_0x45e7c2){return function(_0x492990){if(!_0x492990){_0x39cce5[_0x6cdd('0x16')](0x194);}return _0x492990;};}function handleError(_0x4bf80c,_0x3778f1){_0x3778f1=_0x3778f1||0x1f4;return function(_0x1d53ea){logger[_0x6cdd('0x27')](_0x1d53ea[_0x6cdd('0x28')]);if(_0x1d53ea['name']){delete _0x1d53ea[_0x6cdd('0x29')];}_0x4bf80c[_0x6cdd('0x17')](_0x3778f1)[_0x6cdd('0x2a')](_0x1d53ea);};}exports['index']=function(_0x40f308,_0x1eb4a1){var _0x47399f={},_0x30c00f={},_0x4ebdb0={'count':0x0,'rows':[]};var _0x429883=_['map'](db['Interval']['rawAttributes'],function(_0x86210a){return{'name':_0x86210a[_0x6cdd('0x2b')],'type':_0x86210a[_0x6cdd('0x2c')]['key']};});_0x30c00f[_0x6cdd('0x2d')]=_[_0x6cdd('0x2e')](_0x429883,'name');_0x30c00f['query']=_[_0x6cdd('0x2f')](_0x40f308['query']);_0x30c00f[_0x6cdd('0x30')]=_[_0x6cdd('0x31')](_0x30c00f[_0x6cdd('0x2d')],_0x30c00f[_0x6cdd('0x32')]);_0x47399f['attributes']=_[_0x6cdd('0x31')](_0x30c00f[_0x6cdd('0x2d')],qs[_0x6cdd('0x33')](_0x40f308[_0x6cdd('0x32')][_0x6cdd('0x33')]));_0x47399f['attributes']=_0x47399f['attributes'][_0x6cdd('0x34')]?_0x47399f[_0x6cdd('0x35')]:_0x30c00f[_0x6cdd('0x2d')];if(!_0x40f308[_0x6cdd('0x32')]['hasOwnProperty'](_0x6cdd('0x36'))){_0x47399f[_0x6cdd('0x1c')]=qs['limit'](_0x40f308[_0x6cdd('0x32')]['limit']);_0x47399f['offset']=qs['offset'](_0x40f308[_0x6cdd('0x32')][_0x6cdd('0x1a')]);}_0x47399f[_0x6cdd('0x37')]=qs[_0x6cdd('0x38')](_0x40f308[_0x6cdd('0x32')][_0x6cdd('0x38')]);_0x47399f[_0x6cdd('0x39')]=qs[_0x6cdd('0x30')](_[_0x6cdd('0x3a')](_0x40f308[_0x6cdd('0x32')],_0x30c00f[_0x6cdd('0x30')]),_0x429883);if(_0x40f308[_0x6cdd('0x32')][_0x6cdd('0x3b')]){_0x47399f[_0x6cdd('0x39')]=_[_0x6cdd('0x3c')](_0x47399f['where'],{'$or':_['map'](_0x429883,function(_0x1f136b){if(_0x1f136b[_0x6cdd('0x2c')]!==_0x6cdd('0x3d')){var _0xf5d2d5={};_0xf5d2d5[_0x1f136b[_0x6cdd('0x29')]]={'$like':'%'+_0x40f308['query'][_0x6cdd('0x3b')]+'%'};return _0xf5d2d5;}})});}_0x47399f=_[_0x6cdd('0x3c')]({},_0x47399f,_0x40f308['options']);var _0x538782={'where':_0x47399f['where']};return db[_0x6cdd('0x3e')][_0x6cdd('0x1d')](_0x538782)[_0x6cdd('0x23')](function(_0x11e943){_0x4ebdb0[_0x6cdd('0x1d')]=_0x11e943;if(_0x40f308[_0x6cdd('0x32')][_0x6cdd('0x3f')]){_0x47399f['include']=[{'all':!![]}];}return db[_0x6cdd('0x3e')][_0x6cdd('0x40')](_0x47399f);})['then'](function(_0x99f359){_0x4ebdb0['rows']=_0x99f359;return _0x4ebdb0;})['then'](respondWithFilteredResult(_0x1eb4a1,_0x47399f))[_0x6cdd('0x41')](handleError(_0x1eb4a1,null));};exports[_0x6cdd('0x42')]=function(_0x428966,_0x478a9f){var _0x114eea={'raw':!![],'where':{'id':_0x428966['params']['id']}},_0x5d60c6={};_0x5d60c6[_0x6cdd('0x2d')]=_['keys'](db[_0x6cdd('0x3e')][_0x6cdd('0x43')]);_0x5d60c6[_0x6cdd('0x32')]=_[_0x6cdd('0x2f')](_0x428966[_0x6cdd('0x32')]);_0x5d60c6[_0x6cdd('0x30')]=_[_0x6cdd('0x31')](_0x5d60c6['model'],_0x5d60c6['query']);_0x114eea[_0x6cdd('0x35')]=_[_0x6cdd('0x31')](_0x5d60c6[_0x6cdd('0x2d')],qs[_0x6cdd('0x33')](_0x428966['query']['fields']));_0x114eea[_0x6cdd('0x35')]=_0x114eea['attributes'][_0x6cdd('0x34')]?_0x114eea['attributes']:_0x5d60c6['model'];if(_0x428966[_0x6cdd('0x32')][_0x6cdd('0x3f')]){_0x114eea[_0x6cdd('0x44')]=[{'all':!![]}];}_0x114eea=_[_0x6cdd('0x3c')]({},_0x114eea,_0x428966[_0x6cdd('0x45')]);return db[_0x6cdd('0x3e')][_0x6cdd('0x46')](_0x114eea)[_0x6cdd('0x23')](handleEntityNotFound(_0x478a9f,null))['then'](respondWithResult(_0x478a9f,null))[_0x6cdd('0x41')](handleError(_0x478a9f,null));};exports['create']=function(_0x492441,_0x50a219){return db[_0x6cdd('0x3e')][_0x6cdd('0x47')](_0x492441['body'],{})[_0x6cdd('0x23')](function(_0x4161f2){var _0x40295f=_0x492441[_0x6cdd('0x48')]['get']({'plain':!![]});if(!_0x40295f)throw new Error(_0x6cdd('0x49'));if(_0x40295f[_0x6cdd('0x4a')]===_0x6cdd('0x48')){var _0x16ac54=_0x4161f2[_0x6cdd('0x24')]({'plain':!![]});var _0x1529d7=_0x6cdd('0x4b');return db[_0x6cdd('0x4c')]['find']({'where':{'name':_0x1529d7,'userProfileId':_0x40295f[_0x6cdd('0x4d')]},'raw':!![]})[_0x6cdd('0x23')](function(_0x32d64d){if(_0x32d64d&&_0x32d64d[_0x6cdd('0x4e')]===0x0){return db[_0x6cdd('0x25')]['create']({'name':_0x16ac54['name'],'resourceId':_0x16ac54['id'],'type':_0x32d64d[_0x6cdd('0x29')],'sectionId':_0x32d64d['id']},{})['then'](function(){return _0x4161f2;});}else{return _0x4161f2;}})[_0x6cdd('0x41')](function(_0x1a3925){logger[_0x6cdd('0x27')](_0x6cdd('0x4f'),_0x1a3925);throw _0x1a3925;});}return _0x4161f2;})[_0x6cdd('0x23')](respondWithResult(_0x50a219,0xc9))['catch'](handleError(_0x50a219,null));};exports[_0x6cdd('0x50')]=function(_0x2eadc2,_0x25ff2a){if(_0x2eadc2[_0x6cdd('0x51')]['id']){delete _0x2eadc2['body']['id'];}return db[_0x6cdd('0x3e')][_0x6cdd('0x46')]({'where':{'id':_0x2eadc2['params']['id']}})[_0x6cdd('0x23')](handleEntityNotFound(_0x25ff2a,null))[_0x6cdd('0x23')](saveUpdates(_0x2eadc2[_0x6cdd('0x51')],null))[_0x6cdd('0x23')](respondWithResult(_0x25ff2a,null))[_0x6cdd('0x41')](handleError(_0x25ff2a,null));};exports['destroy']=function(_0xc23220,_0x231f70){return db[_0x6cdd('0x3e')][_0x6cdd('0x46')]({'where':{'id':_0xc23220[_0x6cdd('0x52')]['id']}})[_0x6cdd('0x23')](handleEntityNotFound(_0x231f70,null))[_0x6cdd('0x23')](removeEntity(_0x231f70,null))[_0x6cdd('0x41')](handleError(_0x231f70,null));};exports[_0x6cdd('0x53')]=function(_0xf2fc73,_0x582af6,_0x1c413a){if(_0xf2fc73[_0x6cdd('0x51')]['id']){delete _0xf2fc73[_0x6cdd('0x51')]['id'];}return db[_0x6cdd('0x3e')][_0x6cdd('0x46')]({'where':{'id':_0xf2fc73[_0x6cdd('0x52')]['id']}})[_0x6cdd('0x23')](handleEntityNotFound(_0x582af6,null))[_0x6cdd('0x23')](function(_0x4bb462){if(_0x4bb462){_0xf2fc73[_0x6cdd('0x51')][_0x6cdd('0x54')]=_0x4bb462['id'];return db[_0x6cdd('0x3e')][_0x6cdd('0x47')](_0xf2fc73[_0x6cdd('0x51')]);}})[_0x6cdd('0x23')](respondWithResult(_0x582af6,null))['catch'](handleError(_0x582af6,null));};exports[_0x6cdd('0x55')]=function(_0x1f9196,_0x28ae17,_0x281ed8){var _0x39bf0e={};var _0x5760b2={};var _0x4fe6f9;var _0x42ba4c;return db[_0x6cdd('0x3e')][_0x6cdd('0x56')]({'where':{'id':_0x1f9196[_0x6cdd('0x52')]['id']}})[_0x6cdd('0x23')](handleEntityNotFound(_0x28ae17,null))[_0x6cdd('0x23')](function(_0x3efc50){if(_0x3efc50){_0x4fe6f9=_0x3efc50;_0x5760b2[_0x6cdd('0x2d')]=_[_0x6cdd('0x2f')](db[_0x6cdd('0x3e')][_0x6cdd('0x43')]);_0x5760b2['query']=_[_0x6cdd('0x2f')](_0x1f9196['query']);_0x5760b2[_0x6cdd('0x30')]=_[_0x6cdd('0x31')](_0x5760b2[_0x6cdd('0x2d')],_0x5760b2[_0x6cdd('0x32')]);_0x39bf0e[_0x6cdd('0x35')]=_[_0x6cdd('0x31')](_0x5760b2[_0x6cdd('0x2d')],qs['fields'](_0x1f9196[_0x6cdd('0x32')][_0x6cdd('0x33')]));_0x39bf0e[_0x6cdd('0x35')]=_0x39bf0e[_0x6cdd('0x35')][_0x6cdd('0x34')]?_0x39bf0e[_0x6cdd('0x35')]:_0x5760b2[_0x6cdd('0x2d')];_0x39bf0e[_0x6cdd('0x37')]=qs[_0x6cdd('0x38')](_0x1f9196[_0x6cdd('0x32')]['sort']);_0x39bf0e['where']=qs[_0x6cdd('0x30')](_[_0x6cdd('0x3a')](_0x1f9196[_0x6cdd('0x32')],_0x5760b2[_0x6cdd('0x30')]));if(_0x1f9196[_0x6cdd('0x32')]['filter']){_0x39bf0e['where']=_[_0x6cdd('0x3c')](_0x39bf0e[_0x6cdd('0x39')],{'$or':_[_0x6cdd('0x2e')](_0x39bf0e[_0x6cdd('0x35')],function(_0x3b0f41){var _0x3a5dbf={};_0x3a5dbf[_0x3b0f41]={'$like':'%'+_0x1f9196['query']['filter']+'%'};return _0x3a5dbf;})});}_0x39bf0e=_[_0x6cdd('0x3c')]({},_0x39bf0e,_0x1f9196[_0x6cdd('0x45')]);return _0x4fe6f9[_0x6cdd('0x55')](_0x39bf0e);}})[_0x6cdd('0x23')](function(_0x111aff){if(_0x111aff){_0x42ba4c=_0x111aff[_0x6cdd('0x34')];if(!_0x1f9196[_0x6cdd('0x32')][_0x6cdd('0x57')](_0x6cdd('0x36'))){_0x39bf0e['limit']=qs[_0x6cdd('0x1c')](_0x1f9196[_0x6cdd('0x32')][_0x6cdd('0x1c')]);_0x39bf0e['offset']=qs[_0x6cdd('0x1a')](_0x1f9196[_0x6cdd('0x32')][_0x6cdd('0x1a')]);}return _0x4fe6f9[_0x6cdd('0x55')](_0x39bf0e);}})[_0x6cdd('0x23')](function(_0x4e632b){if(_0x4e632b){return _0x4e632b?{'count':_0x42ba4c,'rows':_0x4e632b}:null;}})[_0x6cdd('0x23')](respondWithResult(_0x28ae17,null))['catch'](handleError(_0x28ae17,null));};exports['addIntervals']=function(_0x20237b,_0x5629f7,_0x53e5ba){return db[_0x6cdd('0x3e')][_0x6cdd('0x56')]({'where':{'id':_0x20237b[_0x6cdd('0x52')]['id']}})[_0x6cdd('0x23')](handleEntityNotFound(_0x5629f7,null))[_0x6cdd('0x23')](function(_0x201dad){if(_0x201dad){return db[_0x6cdd('0x58')][_0x6cdd('0x59')](function(_0x2d0986){return db['Interval']['destroy']({'where':{'IntervalId':_0x20237b[_0x6cdd('0x52')]['id']},'transaction':_0x2d0986})[_0x6cdd('0x23')](function(_0x2bb5e2){var _0x3d78bf=_[_0x6cdd('0x2e')](_0x20237b['body'],function(_0x589d6a){delete _0x589d6a['id'];_0x589d6a['IntervalId']=_0x20237b[_0x6cdd('0x52')]['id'];return _0x589d6a;});return db[_0x6cdd('0x3e')]['bulkCreate'](_0x3d78bf,{'transaction':_0x2d0986});});})['then'](function(){return db[_0x6cdd('0x3e')][_0x6cdd('0x40')]({'where':{'IntervalId':_0x20237b['params']['id']}});});}})[_0x6cdd('0x23')](respondWithResult(_0x5629f7,null))[_0x6cdd('0x41')](handleError(_0x5629f7,null));}; \ No newline at end of file +var _0x4fe3=['name','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','catch','params','length','find','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','order','transaction','bulkCreate','findAll','rimraf','moment','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack'];(function(_0x47824e,_0x2473b1){var _0x1acc49=function(_0x4db6f7){while(--_0x4db6f7){_0x47824e['push'](_0x47824e['shift']());}};_0x1acc49(++_0x2473b1);}(_0x4fe3,0x7f));var _0x34fe=function(_0x596133,_0xb1f2de){_0x596133=_0x596133-0x0;var _0x4ebc05=_0x4fe3[_0x596133];return _0x4ebc05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34fe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x34fe('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x34fe('0x2'));var csv=require(_0x34fe('0x3'));var ejs=require(_0x34fe('0x4'));var fs=require('fs');var fs_extra=require(_0x34fe('0x5'));var _=require(_0x34fe('0x6'));var squel=require('squel');var crypto=require(_0x34fe('0x7'));var jsforce=require(_0x34fe('0x8'));var deskjs=require(_0x34fe('0x9'));var toCsv=require('to-csv');var querystring=require(_0x34fe('0xa'));var Papa=require(_0x34fe('0xb'));var Redis=require('ioredis');var authService=require(_0x34fe('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x34fe('0xd'));var hardwareService=require(_0x34fe('0xe'));var logger=require('../../config/logger')(_0x34fe('0xf'));var utils=require(_0x34fe('0x10'));var config=require(_0x34fe('0x11'));var licenseUtil=require(_0x34fe('0x12'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x20506e,_0x1c008b){_0x1c008b=_0x1c008b||0xcc;return function(_0x5f483c){if(_0x5f483c){return _0x20506e[_0x34fe('0x13')](_0x1c008b);}return _0x20506e[_0x34fe('0x14')](_0x1c008b)[_0x34fe('0x15')]();};}function respondWithResult(_0x45708d,_0x15577c){_0x15577c=_0x15577c||0xc8;return function(_0x4fc5d8){if(_0x4fc5d8){return _0x45708d[_0x34fe('0x14')](_0x15577c)['json'](_0x4fc5d8);}};}function respondWithFilteredResult(_0x40e6be,_0x4fedcd){return function(_0x6052f4){if(_0x6052f4){var _0x260b36=typeof _0x4fedcd['offset']===_0x34fe('0x16')&&typeof _0x4fedcd[_0x34fe('0x17')]===_0x34fe('0x16');var _0xe7fbed=_0x6052f4[_0x34fe('0x18')];var _0x5b2221=_0x260b36?0x0:_0x4fedcd[_0x34fe('0x19')];var _0x39f7a8=_0x260b36?_0x6052f4[_0x34fe('0x18')]:_0x4fedcd[_0x34fe('0x19')]+_0x4fedcd['limit'];var _0x1727ca;if(_0x39f7a8>=_0xe7fbed){_0x39f7a8=_0xe7fbed;_0x1727ca=0xc8;}else{_0x1727ca=0xce;}_0x40e6be[_0x34fe('0x14')](_0x1727ca);return _0x40e6be[_0x34fe('0x1a')]('Content-Range',_0x5b2221+'-'+_0x39f7a8+'/'+_0xe7fbed)[_0x34fe('0x1b')](_0x6052f4);}return null;};}function patchUpdates(_0x1992d5){return function(_0x4081f2){try{jsonpatch['apply'](_0x4081f2,_0x1992d5,!![]);}catch(_0x1bb505){return BPromise[_0x34fe('0x1c')](_0x1bb505);}return _0x4081f2[_0x34fe('0x1d')]();};}function saveUpdates(_0x3da961,_0x249360){return function(_0xadfc2){if(_0xadfc2){return _0xadfc2[_0x34fe('0x1e')](_0x3da961)[_0x34fe('0x1f')](function(_0x39cb7c){return _0x39cb7c;});}return null;};}function removeEntity(_0x3a252e,_0x3ec81b){return function(_0x30d487){if(_0x30d487){return _0x30d487[_0x34fe('0x20')]()[_0x34fe('0x1f')](function(){var _0xb929bd=_0x30d487[_0x34fe('0x21')]({'plain':!![]});var _0x54e2d6=_0x34fe('0x22');return db[_0x34fe('0x23')]['destroy']({'where':{'type':_0x54e2d6,'resourceId':_0xb929bd['id']}})[_0x34fe('0x1f')](function(){return _0x30d487;});})[_0x34fe('0x1f')](function(){_0x3a252e[_0x34fe('0x14')](0xcc)[_0x34fe('0x15')]();});}};}function handleEntityNotFound(_0x75f7b8,_0x5ba53a){return function(_0x246f4f){if(!_0x246f4f){_0x75f7b8[_0x34fe('0x13')](0x194);}return _0x246f4f;};}function handleError(_0x3ddcd5,_0x1c4fe0){_0x1c4fe0=_0x1c4fe0||0x1f4;return function(_0x184b8f){logger['error'](_0x184b8f[_0x34fe('0x24')]);if(_0x184b8f['name']){delete _0x184b8f[_0x34fe('0x25')];}_0x3ddcd5[_0x34fe('0x14')](_0x1c4fe0)['send'](_0x184b8f);};}exports[_0x34fe('0x26')]=function(_0x1d2041,_0x1b272b){var _0x41ff2c={},_0x529101={},_0x3d3b64={'count':0x0,'rows':[]};var _0x28bdcc=_[_0x34fe('0x27')](db[_0x34fe('0x28')][_0x34fe('0x29')],function(_0x18d4ac){return{'name':_0x18d4ac[_0x34fe('0x2a')],'type':_0x18d4ac[_0x34fe('0x2b')][_0x34fe('0x2c')]};});_0x529101['model']=_[_0x34fe('0x27')](_0x28bdcc,_0x34fe('0x25'));_0x529101[_0x34fe('0x2d')]=_[_0x34fe('0x2e')](_0x1d2041[_0x34fe('0x2d')]);_0x529101[_0x34fe('0x2f')]=_[_0x34fe('0x30')](_0x529101[_0x34fe('0x31')],_0x529101['query']);_0x41ff2c[_0x34fe('0x32')]=_[_0x34fe('0x30')](_0x529101['model'],qs[_0x34fe('0x33')](_0x1d2041[_0x34fe('0x2d')][_0x34fe('0x33')]));_0x41ff2c['attributes']=_0x41ff2c[_0x34fe('0x32')]['length']?_0x41ff2c[_0x34fe('0x32')]:_0x529101[_0x34fe('0x31')];if(!_0x1d2041[_0x34fe('0x2d')][_0x34fe('0x34')](_0x34fe('0x35'))){_0x41ff2c[_0x34fe('0x17')]=qs[_0x34fe('0x17')](_0x1d2041[_0x34fe('0x2d')][_0x34fe('0x17')]);_0x41ff2c[_0x34fe('0x19')]=qs[_0x34fe('0x19')](_0x1d2041[_0x34fe('0x2d')][_0x34fe('0x19')]);}_0x41ff2c['order']=qs[_0x34fe('0x36')](_0x1d2041['query'][_0x34fe('0x36')]);_0x41ff2c['where']=qs[_0x34fe('0x2f')](_[_0x34fe('0x37')](_0x1d2041[_0x34fe('0x2d')],_0x529101['filters']),_0x28bdcc);if(_0x1d2041[_0x34fe('0x2d')][_0x34fe('0x38')]){_0x41ff2c[_0x34fe('0x39')]=_['merge'](_0x41ff2c['where'],{'$or':_[_0x34fe('0x27')](_0x28bdcc,function(_0x362007){if(_0x362007[_0x34fe('0x2b')]!==_0x34fe('0x3a')){var _0x4d8da5={};_0x4d8da5[_0x362007['name']]={'$like':'%'+_0x1d2041[_0x34fe('0x2d')][_0x34fe('0x38')]+'%'};return _0x4d8da5;}})});}_0x41ff2c=_[_0x34fe('0x3b')]({},_0x41ff2c,_0x1d2041[_0x34fe('0x3c')]);var _0x90dbfa={'where':_0x41ff2c['where']};return db[_0x34fe('0x28')][_0x34fe('0x18')](_0x90dbfa)[_0x34fe('0x1f')](function(_0x44eb01){_0x3d3b64[_0x34fe('0x18')]=_0x44eb01;if(_0x1d2041[_0x34fe('0x2d')][_0x34fe('0x3d')]){_0x41ff2c[_0x34fe('0x3e')]=[{'all':!![]}];}return db[_0x34fe('0x28')]['findAll'](_0x41ff2c);})[_0x34fe('0x1f')](function(_0x1ed00c){_0x3d3b64['rows']=_0x1ed00c;return _0x3d3b64;})[_0x34fe('0x1f')](respondWithFilteredResult(_0x1b272b,_0x41ff2c))[_0x34fe('0x3f')](handleError(_0x1b272b,null));};exports['show']=function(_0x592456,_0x49c654){var _0x19f35b={'raw':!![],'where':{'id':_0x592456[_0x34fe('0x40')]['id']}},_0x29efbc={};_0x29efbc['model']=_[_0x34fe('0x2e')](db[_0x34fe('0x28')]['rawAttributes']);_0x29efbc['query']=_[_0x34fe('0x2e')](_0x592456['query']);_0x29efbc[_0x34fe('0x2f')]=_[_0x34fe('0x30')](_0x29efbc[_0x34fe('0x31')],_0x29efbc[_0x34fe('0x2d')]);_0x19f35b[_0x34fe('0x32')]=_[_0x34fe('0x30')](_0x29efbc[_0x34fe('0x31')],qs['fields'](_0x592456[_0x34fe('0x2d')][_0x34fe('0x33')]));_0x19f35b[_0x34fe('0x32')]=_0x19f35b[_0x34fe('0x32')][_0x34fe('0x41')]?_0x19f35b['attributes']:_0x29efbc[_0x34fe('0x31')];if(_0x592456[_0x34fe('0x2d')][_0x34fe('0x3d')]){_0x19f35b[_0x34fe('0x3e')]=[{'all':!![]}];}_0x19f35b=_[_0x34fe('0x3b')]({},_0x19f35b,_0x592456['options']);return db[_0x34fe('0x28')][_0x34fe('0x42')](_0x19f35b)['then'](handleEntityNotFound(_0x49c654,null))[_0x34fe('0x1f')](respondWithResult(_0x49c654,null))['catch'](handleError(_0x49c654,null));};exports[_0x34fe('0x43')]=function(_0x30add2,_0x36303c){return db[_0x34fe('0x28')]['create'](_0x30add2[_0x34fe('0x44')],{})[_0x34fe('0x1f')](function(_0x277356){var _0x5671b3=_0x30add2[_0x34fe('0x45')][_0x34fe('0x21')]({'plain':!![]});if(!_0x5671b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5671b3[_0x34fe('0x46')]===_0x34fe('0x45')){var _0x277b43=_0x277356[_0x34fe('0x21')]({'plain':!![]});var _0x532a2b='Intervals';return db[_0x34fe('0x47')]['find']({'where':{'name':_0x532a2b,'userProfileId':_0x5671b3['userProfileId']},'raw':!![]})[_0x34fe('0x1f')](function(_0x38ce52){if(_0x38ce52&&_0x38ce52[_0x34fe('0x48')]===0x0){return db[_0x34fe('0x23')][_0x34fe('0x43')]({'name':_0x277b43['name'],'resourceId':_0x277b43['id'],'type':_0x38ce52[_0x34fe('0x25')],'sectionId':_0x38ce52['id']},{})[_0x34fe('0x1f')](function(){return _0x277356;});}else{return _0x277356;}})[_0x34fe('0x3f')](function(_0x3b6bbc){logger[_0x34fe('0x49')](_0x34fe('0x4a'),_0x3b6bbc);throw _0x3b6bbc;});}return _0x277356;})[_0x34fe('0x1f')](respondWithResult(_0x36303c,0xc9))[_0x34fe('0x3f')](handleError(_0x36303c,null));};exports[_0x34fe('0x1e')]=function(_0x5680c3,_0x418d80){if(_0x5680c3[_0x34fe('0x44')]['id']){delete _0x5680c3['body']['id'];}return db[_0x34fe('0x28')][_0x34fe('0x42')]({'where':{'id':_0x5680c3[_0x34fe('0x40')]['id']}})[_0x34fe('0x1f')](handleEntityNotFound(_0x418d80,null))['then'](saveUpdates(_0x5680c3['body'],null))[_0x34fe('0x1f')](respondWithResult(_0x418d80,null))[_0x34fe('0x3f')](handleError(_0x418d80,null));};exports[_0x34fe('0x20')]=function(_0x47d8bf,_0x3d437d){return db[_0x34fe('0x28')][_0x34fe('0x42')]({'where':{'id':_0x47d8bf[_0x34fe('0x40')]['id']}})[_0x34fe('0x1f')](handleEntityNotFound(_0x3d437d,null))[_0x34fe('0x1f')](removeEntity(_0x3d437d,null))[_0x34fe('0x3f')](handleError(_0x3d437d,null));};exports['addInterval']=function(_0x38d981,_0xc5da35,_0x5dd4c1){if(_0x38d981['body']['id']){delete _0x38d981[_0x34fe('0x44')]['id'];}return db[_0x34fe('0x28')][_0x34fe('0x42')]({'where':{'id':_0x38d981[_0x34fe('0x40')]['id']}})['then'](handleEntityNotFound(_0xc5da35,null))['then'](function(_0x22c3fa){if(_0x22c3fa){_0x38d981[_0x34fe('0x44')][_0x34fe('0x4b')]=_0x22c3fa['id'];return db['Interval']['create'](_0x38d981[_0x34fe('0x44')]);}})[_0x34fe('0x1f')](respondWithResult(_0xc5da35,null))['catch'](handleError(_0xc5da35,null));};exports[_0x34fe('0x4c')]=function(_0x4ec5a4,_0x1d2712,_0x4037a7){var _0x1f71c8={};var _0x1eb357={};var _0x94431c;var _0x5def6d;return db['Interval'][_0x34fe('0x4d')]({'where':{'id':_0x4ec5a4[_0x34fe('0x40')]['id']}})[_0x34fe('0x1f')](handleEntityNotFound(_0x1d2712,null))[_0x34fe('0x1f')](function(_0x4db6dd){if(_0x4db6dd){_0x94431c=_0x4db6dd;_0x1eb357['model']=_[_0x34fe('0x2e')](db['Interval'][_0x34fe('0x29')]);_0x1eb357[_0x34fe('0x2d')]=_['keys'](_0x4ec5a4[_0x34fe('0x2d')]);_0x1eb357['filters']=_[_0x34fe('0x30')](_0x1eb357[_0x34fe('0x31')],_0x1eb357[_0x34fe('0x2d')]);_0x1f71c8[_0x34fe('0x32')]=_[_0x34fe('0x30')](_0x1eb357[_0x34fe('0x31')],qs[_0x34fe('0x33')](_0x4ec5a4[_0x34fe('0x2d')]['fields']));_0x1f71c8[_0x34fe('0x32')]=_0x1f71c8[_0x34fe('0x32')][_0x34fe('0x41')]?_0x1f71c8[_0x34fe('0x32')]:_0x1eb357['model'];_0x1f71c8[_0x34fe('0x4e')]=qs[_0x34fe('0x36')](_0x4ec5a4[_0x34fe('0x2d')]['sort']);_0x1f71c8[_0x34fe('0x39')]=qs['filters'](_[_0x34fe('0x37')](_0x4ec5a4[_0x34fe('0x2d')],_0x1eb357[_0x34fe('0x2f')]));if(_0x4ec5a4['query'][_0x34fe('0x38')]){_0x1f71c8['where']=_[_0x34fe('0x3b')](_0x1f71c8['where'],{'$or':_['map'](_0x1f71c8[_0x34fe('0x32')],function(_0x44fe86){var _0xfd1a07={};_0xfd1a07[_0x44fe86]={'$like':'%'+_0x4ec5a4['query']['filter']+'%'};return _0xfd1a07;})});}_0x1f71c8=_['merge']({},_0x1f71c8,_0x4ec5a4[_0x34fe('0x3c')]);return _0x94431c[_0x34fe('0x4c')](_0x1f71c8);}})['then'](function(_0xb72ef6){if(_0xb72ef6){_0x5def6d=_0xb72ef6[_0x34fe('0x41')];if(!_0x4ec5a4[_0x34fe('0x2d')][_0x34fe('0x34')](_0x34fe('0x35'))){_0x1f71c8[_0x34fe('0x17')]=qs[_0x34fe('0x17')](_0x4ec5a4[_0x34fe('0x2d')][_0x34fe('0x17')]);_0x1f71c8[_0x34fe('0x19')]=qs[_0x34fe('0x19')](_0x4ec5a4[_0x34fe('0x2d')][_0x34fe('0x19')]);}return _0x94431c[_0x34fe('0x4c')](_0x1f71c8);}})[_0x34fe('0x1f')](function(_0x1db999){if(_0x1db999){return _0x1db999?{'count':_0x5def6d,'rows':_0x1db999}:null;}})[_0x34fe('0x1f')](respondWithResult(_0x1d2712,null))[_0x34fe('0x3f')](handleError(_0x1d2712,null));};exports['addIntervals']=function(_0x188031,_0x5996ab,_0xf5302){return db[_0x34fe('0x28')][_0x34fe('0x4d')]({'where':{'id':_0x188031['params']['id']}})[_0x34fe('0x1f')](handleEntityNotFound(_0x5996ab,null))['then'](function(_0x51c07b){if(_0x51c07b){return db['sequelize'][_0x34fe('0x4f')](function(_0x20c5d1){return db[_0x34fe('0x28')][_0x34fe('0x20')]({'where':{'IntervalId':_0x188031[_0x34fe('0x40')]['id']},'transaction':_0x20c5d1})['then'](function(_0x5ce5e0){var _0x7199b5=_[_0x34fe('0x27')](_0x188031[_0x34fe('0x44')],function(_0x49b41a){delete _0x49b41a['id'];_0x49b41a[_0x34fe('0x4b')]=_0x188031['params']['id'];return _0x49b41a;});return db[_0x34fe('0x28')][_0x34fe('0x50')](_0x7199b5,{'transaction':_0x20c5d1});});})[_0x34fe('0x1f')](function(){return db[_0x34fe('0x28')][_0x34fe('0x51')]({'where':{'IntervalId':_0x188031[_0x34fe('0x40')]['id']}});});}})[_0x34fe('0x1f')](respondWithResult(_0x5996ab,null))[_0x34fe('0x3f')](handleError(_0x5996ab,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0c8fa4b..8687d92 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 _0x96c2=['getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','string'];(function(_0x301613,_0x5d8672){var _0x1ade61=function(_0xb11f03){while(--_0xb11f03){_0x301613['push'](_0x301613['shift']());}};_0x1ade61(++_0x5d8672);}(_0x96c2,0x1e6));var _0x296c=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x96c2[_0x42c6f1];return _0x3c7398;};'use strict';var attributes=require(_0x296c('0x0'));var extensions=require(_0x296c('0x1'));var iftime=require(_0x296c('0x2'))[_0x296c('0x3')];module[_0x296c('0x4')]=function(_0x358a2f){return _0x358a2f[_0x296c('0x5')]('Interval',attributes,{'tableName':_0x296c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x49a869){extensions['rewrite'](_0x358a2f,_0x49a869);},'afterBulkCreate':function(_0x508877,_0x54fcd7,_0x43b4ee){_0x43b4ee();extensions['rewrite'](_0x358a2f,_0x508877[0x0]);},'afterUpdate':function(_0x549734){extensions[_0x296c('0x7')](_0x358a2f,_0x549734);},'afterDestroy':function(_0x381790){extensions[_0x296c('0x7')](_0x358a2f,_0x381790);}},'instanceMethods':{'ifTime':function(_0x23a15f=undefined,_0x23e519=new Date()){if(typeof this[_0x296c('0x8')]===_0x296c('0x9')){return iftime(this[_0x296c('0x8')],_0x23a15f,_0x23e519);}else{return this[_0x296c('0xa')]()[_0x296c('0xb')](function(_0x55715f){return Promise[_0x296c('0xc')](_0x55715f[_0x296c('0xd')](function(_0x937ec5){return _0x937ec5[_0x296c('0xe')](_0x23a15f,_0x23e519);}));})[_0x296c('0xb')](function(_0x1d367f){return _0x1d367f[_0x296c('0xf')](function(_0xaff3ec,_0x418904){return _0xaff3ec||_0x418904;},![]);});}}}});}; \ No newline at end of file +var _0x0b87=['interval','string','getIntervals','all','reduce','./interval.attributes','../../components/extensions/rewrite','exports','rewrite'];(function(_0x1b9025,_0x4d8601){var _0x21104b=function(_0x165bf6){while(--_0x165bf6){_0x1b9025['push'](_0x1b9025['shift']());}};_0x21104b(++_0x4d8601);}(_0x0b87,0xa7));var _0x70b8=function(_0x3658d1,_0x5b3437){_0x3658d1=_0x3658d1-0x0;var _0x3db9de=_0x0b87[_0x3658d1];return _0x3db9de;};'use strict';var attributes=require(_0x70b8('0x0'));var extensions=require(_0x70b8('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x70b8('0x2')]=function(_0x23fd0c){return _0x23fd0c['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x19c1c5){extensions[_0x70b8('0x3')](_0x23fd0c,_0x19c1c5);},'afterBulkCreate':function(_0x4f1ba0,_0x27a951,_0xf0943){_0xf0943();extensions[_0x70b8('0x3')](_0x23fd0c,_0x4f1ba0[0x0]);},'afterUpdate':function(_0x3eaf29){extensions[_0x70b8('0x3')](_0x23fd0c,_0x3eaf29);},'afterDestroy':function(_0x2b5ea9){extensions['rewrite'](_0x23fd0c,_0x2b5ea9);}},'instanceMethods':{'ifTime':function(_0x44c4e0=undefined,_0x57e2dd=new Date()){if(typeof this[_0x70b8('0x4')]===_0x70b8('0x5')){return iftime(this['interval'],_0x44c4e0,_0x57e2dd);}else{return this[_0x70b8('0x6')]()['then'](function(_0x3774c6){return Promise[_0x70b8('0x7')](_0x3774c6['map'](function(_0x411274){return _0x411274['ifTime'](_0x44c4e0,_0x57e2dd);}));})['then'](function(_0x1096bf){return _0x1096bf[_0x70b8('0x8')](function(_0x30a9fb,_0x211da2){return _0x30a9fb||_0x211da2;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7c4440c..744e094 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 _0x54f7=['Interval','options','where','attributes','limit','include','model','map','then','GetInterval','debug','stringify','catch','error','message','raw','info','ShowInterval','findAll','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','ifTime','IntervalIftime','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc'];(function(_0x17086b,_0x117941){var _0x3b7614=function(_0x5c0269){while(--_0x5c0269){_0x17086b['push'](_0x17086b['shift']());}};_0x3b7614(++_0x117941);}(_0x54f7,0x80));var _0x754f=function(_0x410fd0,_0x4b8953){_0x410fd0=_0x410fd0-0x0;var _0x1ea69b=_0x54f7[_0x410fd0];return _0x1ea69b;};'use strict';var _=require(_0x754f('0x0'));var util=require(_0x754f('0x1'));var db=require(_0x754f('0x2'))['db'];var iftime=require(_0x754f('0x3'))[_0x754f('0x4')];var logger=require(_0x754f('0x5'))(_0x754f('0x6'));exports['GetInterval']=function(_0x2f4709){var _0x41da40=this;return new Promise(function(_0x4bf3dc,_0x6b07ad){return db[_0x754f('0x7')]['findAll']({'raw':_0x2f4709[_0x754f('0x8')]?_0x2f4709[_0x754f('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x2f4709['options']?_0x2f4709[_0x754f('0x8')][_0x754f('0x9')]||null:null,'attributes':_0x2f4709[_0x754f('0x8')]?_0x2f4709[_0x754f('0x8')][_0x754f('0xa')]||null:null,'limit':_0x2f4709[_0x754f('0x8')]?_0x2f4709[_0x754f('0x8')][_0x754f('0xb')]||null:null,'include':_0x2f4709[_0x754f('0x8')]?_0x2f4709['options'][_0x754f('0xc')]?_['map'](_0x2f4709[_0x754f('0x8')][_0x754f('0xc')],function(_0x4e09b1){return{'model':db[_0x4e09b1['model']],'as':_0x4e09b1['as'],'attributes':_0x4e09b1[_0x754f('0xa')],'include':_0x4e09b1[_0x754f('0xc')]?_['map'](_0x4e09b1[_0x754f('0xc')],function(_0x4a28da){return{'model':db[_0x4a28da[_0x754f('0xd')]],'as':_0x4a28da['as'],'attributes':_0x4a28da[_0x754f('0xa')],'include':_0x4a28da[_0x754f('0xc')]?_[_0x754f('0xe')](_0x4a28da['include'],function(_0x493570){return{'model':db[_0x493570[_0x754f('0xd')]],'as':_0x493570['as'],'attributes':_0x493570[_0x754f('0xa')]};}):[]};}):[]};}):[]:[]})[_0x754f('0xf')](function(_0x3c4c29){logger['info'](_0x754f('0x10'),_0x2f4709);logger[_0x754f('0x11')](_0x754f('0x10'),_0x2f4709,JSON[_0x754f('0x12')](_0x3c4c29));_0x4bf3dc(_0x3c4c29);})[_0x754f('0x13')](function(_0x5b05d5){logger[_0x754f('0x14')](_0x754f('0x10'),_0x5b05d5[_0x754f('0x15')],_0x2f4709);_0x6b07ad(_0x41da40[_0x754f('0x14')](0x1f4,_0x5b05d5[_0x754f('0x15')]));});});};exports['ShowInterval']=function(_0x51f156){var _0x4ceb33=this;return new Promise(function(_0x2c134c,_0x2eba7d){return db[_0x754f('0x7')]['find']({'raw':_0x51f156[_0x754f('0x8')]?_0x51f156[_0x754f('0x8')][_0x754f('0x16')]===undefined?!![]:![]:!![],'where':_0x51f156[_0x754f('0x8')]?_0x51f156[_0x754f('0x8')][_0x754f('0x9')]||null:null,'attributes':_0x51f156[_0x754f('0x8')]?_0x51f156[_0x754f('0x8')]['attributes']||null:null,'include':_0x51f156['options']?_0x51f156[_0x754f('0x8')][_0x754f('0xc')]?_[_0x754f('0xe')](_0x51f156[_0x754f('0x8')][_0x754f('0xc')],function(_0xbc8fcc){return{'model':db[_0xbc8fcc['model']],'as':_0xbc8fcc['as'],'attributes':_0xbc8fcc[_0x754f('0xa')],'include':_0xbc8fcc['include']?_[_0x754f('0xe')](_0xbc8fcc[_0x754f('0xc')],function(_0x272cfc){return{'model':db[_0x272cfc['model']],'as':_0x272cfc['as'],'attributes':_0x272cfc[_0x754f('0xa')],'include':_0x272cfc['include']?_['map'](_0x272cfc['include'],function(_0x159077){return{'model':db[_0x159077['model']],'as':_0x159077['as'],'attributes':_0x159077[_0x754f('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1487c2){logger[_0x754f('0x17')](_0x754f('0x18'),_0x51f156);logger[_0x754f('0x11')]('ShowInterval',_0x51f156,JSON[_0x754f('0x12')](_0x1487c2));_0x2c134c(_0x1487c2);})[_0x754f('0x13')](function(_0x2dd98f){logger['error'](_0x754f('0x18'),_0x2dd98f[_0x754f('0x15')],_0x51f156);_0x2eba7d(_0x4ceb33['error'](0x1f4,_0x2dd98f[_0x754f('0x15')]));});});};function checkArrayOfIntervals(_0xa87d9f,_0x74d593){var _0x55fe96=[];return db[_0x754f('0x7')][_0x754f('0x19')]({'where':{'id':_0xa87d9f}})['then'](function(_0xa7747f){_0x55fe96=_0xa7747f;return Promise[_0x754f('0x1a')](_0x55fe96[_0x754f('0xe')](function(_0x147570){return _0x147570['ifTime'](_0x74d593);}));})[_0x754f('0xf')](function(_0x52b7f5){var _0x4e6fd1=_0x52b7f5[_0x754f('0x1b')](function(_0x2bb7ae,_0x2bf9dd){return _0x2bb7ae||_0x2bf9dd;},![]);logger[_0x754f('0x17')](util[_0x754f('0x1c')](_0x754f('0x1d'),_0x55fe96['map'](function(_0x363490){return _0x363490[_0x754f('0x1e')];})[_0x754f('0x1f')](',\x20'),_0x55fe96[_0x754f('0xe')](function(_0x55936e){return _0x55936e['id'];})[_0x754f('0x1f')](',\x20')));return _0x4e6fd1;});}function checkSingleInterval(_0x3e34bb,_0x4c8a4d){return db[_0x754f('0x7')][_0x754f('0x20')](_0x3e34bb)['then'](function(_0x5e3525){if(_0x5e3525){logger['info'](util[_0x754f('0x1c')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5e3525[_0x754f('0x1e')],_0x5e3525['id']));return _0x5e3525[_0x754f('0x21')](_0x4c8a4d);}});}exports[_0x754f('0x22')]=function(_0x299e1d){var _0x3a647b=_0x299e1d[_0x754f('0x23')];var _0x354e6d=Array['isArray'](_0x299e1d[_0x754f('0x24')])?_0x299e1d[_0x754f('0x24')]:typeof _0x299e1d['intervals']===_0x754f('0x25')?[_0x299e1d[_0x754f('0x24')]]:[];var _0x500922=_0x299e1d[_0x754f('0x26')]||undefined;var _0xaa403b=![];if(_0x354e6d[_0x754f('0x27')]){logger['info'](util[_0x754f('0x1c')](_0x754f('0x28'),_0x354e6d[_0x754f('0x1f')](';\x20')));}if(_0x500922){logger[_0x754f('0x17')](util[_0x754f('0x1c')](_0x754f('0x29'),_0x500922));}logger[_0x754f('0x11')](_0x754f('0x2a'),_0xaa403b);logger[_0x754f('0x2b')](_0x754f('0x22'),_0x299e1d);return Promise[_0x754f('0x2c')]()[_0x754f('0xf')](function(){if(Array['isArray'](_0x3a647b)){return checkArrayOfIntervals(_0x3a647b,_0x500922);}else if(_0x3a647b){return checkSingleInterval(_0x3a647b,_0x500922);}})[_0x754f('0xf')](function(_0xaaabd0){var _0x137153=_0x354e6d[_0x754f('0x1b')](function(_0x36e530,_0x4a0b18){return _0x36e530||iftime(_0x4a0b18,_0x500922);},![]);_0xaa403b=_0xaaabd0||_0x137153;return _0xaa403b;})[_0x754f('0x13')](function(_0x35aa67){logger[_0x754f('0x14')](_0x754f('0x22'),_0x299e1d,_0x35aa67);throw this[_0x754f('0x14')](0x1f4,_0x35aa67[_0x754f('0x15')]);});}; \ No newline at end of file +var _0x02bc=['ShowInterval','Interval','then','debug','all','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','isArray','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify','catch','message','error'];(function(_0x204e7e,_0xab35e9){var _0x582bab=function(_0x838e0a){while(--_0x838e0a){_0x204e7e['push'](_0x204e7e['shift']());}};_0x582bab(++_0xab35e9);}(_0x02bc,0x97));var _0xc02b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x02bc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc02b('0x0'));var util=require(_0xc02b('0x1'));var db=require(_0xc02b('0x2'))['db'];var iftime=require(_0xc02b('0x3'))['iftime'];var logger=require(_0xc02b('0x4'))(_0xc02b('0x5'));exports[_0xc02b('0x6')]=function(_0x5c9196){var _0x42d30b=this;return new Promise(function(_0x4eba60,_0x305196){return db['Interval'][_0xc02b('0x7')]({'raw':_0x5c9196['options']?_0x5c9196[_0xc02b('0x8')][_0xc02b('0x9')]===undefined?!![]:![]:!![],'where':_0x5c9196[_0xc02b('0x8')]?_0x5c9196['options'][_0xc02b('0xa')]||null:null,'attributes':_0x5c9196[_0xc02b('0x8')]?_0x5c9196[_0xc02b('0x8')][_0xc02b('0xb')]||null:null,'limit':_0x5c9196['options']?_0x5c9196[_0xc02b('0x8')][_0xc02b('0xc')]||null:null,'include':_0x5c9196['options']?_0x5c9196['options'][_0xc02b('0xd')]?_[_0xc02b('0xe')](_0x5c9196['options'][_0xc02b('0xd')],function(_0xce3913){return{'model':db[_0xce3913[_0xc02b('0xf')]],'as':_0xce3913['as'],'attributes':_0xce3913['attributes'],'include':_0xce3913[_0xc02b('0xd')]?_[_0xc02b('0xe')](_0xce3913[_0xc02b('0xd')],function(_0x4f73a6){return{'model':db[_0x4f73a6[_0xc02b('0xf')]],'as':_0x4f73a6['as'],'attributes':_0x4f73a6[_0xc02b('0xb')],'include':_0x4f73a6[_0xc02b('0xd')]?_[_0xc02b('0xe')](_0x4f73a6['include'],function(_0x80d09e){return{'model':db[_0x80d09e[_0xc02b('0xf')]],'as':_0x80d09e['as'],'attributes':_0x80d09e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b353a){logger[_0xc02b('0x10')](_0xc02b('0x6'),_0x5c9196);logger['debug'](_0xc02b('0x6'),_0x5c9196,JSON[_0xc02b('0x11')](_0x3b353a));_0x4eba60(_0x3b353a);})[_0xc02b('0x12')](function(_0x36f5eb){logger['error']('GetInterval',_0x36f5eb[_0xc02b('0x13')],_0x5c9196);_0x305196(_0x42d30b[_0xc02b('0x14')](0x1f4,_0x36f5eb[_0xc02b('0x13')]));});});};exports[_0xc02b('0x15')]=function(_0x475dea){var _0x15e193=this;return new Promise(function(_0x279a05,_0x4a3fa9){return db[_0xc02b('0x16')]['find']({'raw':_0x475dea[_0xc02b('0x8')]?_0x475dea['options']['raw']===undefined?!![]:![]:!![],'where':_0x475dea['options']?_0x475dea[_0xc02b('0x8')]['where']||null:null,'attributes':_0x475dea[_0xc02b('0x8')]?_0x475dea['options']['attributes']||null:null,'include':_0x475dea[_0xc02b('0x8')]?_0x475dea[_0xc02b('0x8')][_0xc02b('0xd')]?_[_0xc02b('0xe')](_0x475dea['options'][_0xc02b('0xd')],function(_0xf7147e){return{'model':db[_0xf7147e['model']],'as':_0xf7147e['as'],'attributes':_0xf7147e[_0xc02b('0xb')],'include':_0xf7147e[_0xc02b('0xd')]?_[_0xc02b('0xe')](_0xf7147e['include'],function(_0x43446f){return{'model':db[_0x43446f['model']],'as':_0x43446f['as'],'attributes':_0x43446f[_0xc02b('0xb')],'include':_0x43446f['include']?_[_0xc02b('0xe')](_0x43446f[_0xc02b('0xd')],function(_0x1328cf){return{'model':db[_0x1328cf['model']],'as':_0x1328cf['as'],'attributes':_0x1328cf['attributes']};}):[]};}):[]};}):[]:[]})[_0xc02b('0x17')](function(_0x25a472){logger[_0xc02b('0x10')](_0xc02b('0x15'),_0x475dea);logger[_0xc02b('0x18')](_0xc02b('0x15'),_0x475dea,JSON['stringify'](_0x25a472));_0x279a05(_0x25a472);})[_0xc02b('0x12')](function(_0x127856){logger['error'](_0xc02b('0x15'),_0x127856['message'],_0x475dea);_0x4a3fa9(_0x15e193[_0xc02b('0x14')](0x1f4,_0x127856[_0xc02b('0x13')]));});});};function checkArrayOfIntervals(_0x237905,_0x3ce7fc){var _0x3c7e1a=[];return db['Interval']['findAll']({'where':{'id':_0x237905}})[_0xc02b('0x17')](function(_0x2c7a3a){_0x3c7e1a=_0x2c7a3a;return Promise[_0xc02b('0x19')](_0x3c7e1a[_0xc02b('0xe')](function(_0x57c3db){return _0x57c3db[_0xc02b('0x1a')](_0x3ce7fc);}));})['then'](function(_0x26f5cb){var _0x11d85c=_0x26f5cb['reduce'](function(_0x1f8ef2,_0x44aabf){return _0x1f8ef2||_0x44aabf;},![]);logger[_0xc02b('0x10')](util['format'](_0xc02b('0x1b'),_0x3c7e1a[_0xc02b('0xe')](function(_0x376e2a){return _0x376e2a['name'];})[_0xc02b('0x1c')](',\x20'),_0x3c7e1a[_0xc02b('0xe')](function(_0x25f1b4){return _0x25f1b4['id'];})['join'](',\x20')));return _0x11d85c;});}function checkSingleInterval(_0x58f81d,_0x5a1e06){return db[_0xc02b('0x16')][_0xc02b('0x1d')](_0x58f81d)[_0xc02b('0x17')](function(_0xe0613f){if(_0xe0613f){logger['info'](util[_0xc02b('0x1e')](_0xc02b('0x1f'),_0xe0613f[_0xc02b('0x20')],_0xe0613f['id']));return _0xe0613f['ifTime'](_0x5a1e06);}});}exports['IntervalIftime']=function(_0x1ee260){var _0x2fe7dc=_0x1ee260[_0xc02b('0x21')];var _0x10b9a7=Array[_0xc02b('0x22')](_0x1ee260[_0xc02b('0x23')])?_0x1ee260[_0xc02b('0x23')]:typeof _0x1ee260['intervals']==='string'?[_0x1ee260['intervals']]:[];var _0x3a8545=_0x1ee260[_0xc02b('0x24')]||undefined;var _0x51bd87=![];if(_0x10b9a7['length']){logger[_0xc02b('0x10')](util[_0xc02b('0x1e')](_0xc02b('0x25'),_0x10b9a7['join'](';\x20')));}if(_0x3a8545){logger[_0xc02b('0x10')](util[_0xc02b('0x1e')](_0xc02b('0x26'),_0x3a8545));}logger[_0xc02b('0x18')](_0xc02b('0x27'),_0x51bd87);logger[_0xc02b('0x28')](_0xc02b('0x29'),_0x1ee260);return Promise[_0xc02b('0x2a')]()[_0xc02b('0x17')](function(){if(Array['isArray'](_0x2fe7dc)){return checkArrayOfIntervals(_0x2fe7dc,_0x3a8545);}else if(_0x2fe7dc){return checkSingleInterval(_0x2fe7dc,_0x3a8545);}})[_0xc02b('0x17')](function(_0x461225){var _0x4b98ce=_0x10b9a7['reduce'](function(_0x378f1f,_0x116810){return _0x378f1f||iftime(_0x116810,_0x3a8545);},![]);_0x51bd87=_0x461225||_0x4b98ce;return _0x51bd87;})[_0xc02b('0x12')](function(_0x2b420d){logger[_0xc02b('0x14')](_0xc02b('0x29'),_0x1ee260,_0x2b420d);throw this[_0xc02b('0x14')](0x1f4,_0x2b420d['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index a8c4eaa..0c8d7cb 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x2e8293,_0x3d09e1){var _0x4a6614=function(_0x2120b1){while(--_0x2120b1){_0x2e8293['push'](_0x2e8293['shift']());}};_0x4a6614(++_0x3d09e1);}(_0x2ef3,0xba));var _0x32ef=function(_0x467d92,_0x38b09e){_0x467d92=_0x467d92-0x0;var _0x50f056=_0x2ef3[_0x467d92];return _0x50f056;};'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['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb10b,0x12a));var _0xbb10=function(_0x5bda3b,_0x41160f){_0x5bda3b=_0x5bda3b-0x0;var _0x431bb9=_0xb10b[_0x5bda3b];return _0x431bb9;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a6ec5ff..7971d71 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 _0xc4f3=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','stringify','setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504'];(function(_0x16cfae,_0x3c3596){var _0x5a04cf=function(_0x578063){while(--_0x578063){_0x16cfae['push'](_0x16cfae['shift']());}};_0x5a04cf(++_0x3c3596);}(_0xc4f3,0x14e));var _0x3c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f3[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3c4f('0x0'));var https=require(_0x3c4f('0x1'));var logger=require(_0x3c4f('0x2'))(_0x3c4f('0x3'));var USERNAME=_0x3c4f('0x4');var PASSWORD=_0x3c4f('0x5');function openIssue(_0x3207d8,_0x156d02){var _0x962ff0={'fields':{'project':{'key':_0x3207d8[_0x3c4f('0x6')]||_0x3c4f('0x7')},'summary':(_0x3207d8[_0x3c4f('0x8')]||_0x3c4f('0x9'))+'\x20from\x20'+_0x3207d8['ip'],'description':_0x3207d8[_0x3c4f('0xa')]||JSON['stringify'](_0x3207d8),'issuetype':{'name':_0x3207d8['issuetype']||_0x3c4f('0xb')}}};_0x962ff0[_0x3c4f('0xc')]['customfield_11500']=_0x3207d8['email'];_0x962ff0[_0x3c4f('0xc')][_0x3c4f('0xd')]=_0x3207d8[_0x3c4f('0xe')];_0x962ff0[_0x3c4f('0xc')][_0x3c4f('0xf')]=_0x3207d8[_0x3c4f('0x10')];_0x962ff0[_0x3c4f('0xc')]['customfield_11503']=_0x3207d8['name'];_0x962ff0[_0x3c4f('0xc')][_0x3c4f('0x11')]=_0x3207d8['reason'];_0x962ff0['fields'][_0x3c4f('0x12')]=_0x3207d8['ip'];var _0xeeb511={'host':_0x3c4f('0x13'),'port':0x1bb,'path':_0x3c4f('0x14'),'method':_0x3c4f('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x3c4f('0x16'),'Authorization':_0x3c4f('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x220b69=JSON[_0x3c4f('0x18')](_0x962ff0);var _0x21be3f=https['request'](_0xeeb511,function(_0x2056f0){_0x2056f0[_0x3c4f('0x19')](_0x3c4f('0x1a'));var _0x1188eb='';_0x2056f0['on'](_0x3c4f('0x1b'),function(_0x51e8a8){_0x1188eb+=_0x51e8a8;});_0x2056f0['on']('end',function(){if(_0x156d02){return _0x156d02[_0x3c4f('0x1c')](_0x2056f0[_0x3c4f('0x1d')])[_0x3c4f('0x1e')](JSON[_0x3c4f('0x1f')](_0x1188eb));}});});_0x21be3f['on'](_0x3c4f('0x20'),function(_0x1b9ca3){if(_0x156d02){return _0x156d02[_0x3c4f('0x1c')](0x1f4)[_0x3c4f('0x1e')]({'errors':[{'message':_0x3c4f('0x21'),'type':'api.jira'}]});}});_0x21be3f[_0x3c4f('0x22')](_0x220b69);_0x21be3f[_0x3c4f('0x23')]();}exports[_0x3c4f('0x24')]=openIssue;exports[_0x3c4f('0x25')]=function(_0x451f01,_0x458817){_0x451f01[_0x3c4f('0x26')]['ip']=_0x451f01[_0x3c4f('0x27')][_0x3c4f('0x28')]||_0x451f01[_0x3c4f('0x29')][_0x3c4f('0x2a')]||_0x451f01['socket'][_0x3c4f('0x2a')]||_0x451f01[_0x3c4f('0x29')][_0x3c4f('0x2b')][_0x3c4f('0x2a')];return openIssue(_0x451f01[_0x3c4f('0x26')],_0x458817);}; \ No newline at end of file +var _0x2eec=['status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','headers','x-forwarded-for','remoteAddress','connection','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','Report','description','stringify','issuetype','Bug','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','reason','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','end'];(function(_0x18aa01,_0x5b43e7){var _0xc74793=function(_0x52adbc){while(--_0x52adbc){_0x18aa01['push'](_0x18aa01['shift']());}};_0xc74793(++_0x5b43e7);}(_0x2eec,0x133));var _0xc2ee=function(_0x52275d,_0x20c084){_0x52275d=_0x52275d-0x0;var _0x5a5b81=_0x2eec[_0x52275d];return _0x5a5b81;};'use strict';var BPromise=require(_0xc2ee('0x0'));var https=require(_0xc2ee('0x1'));var logger=require('../../config/logger')(_0xc2ee('0x2'));var USERNAME=_0xc2ee('0x3');var PASSWORD=_0xc2ee('0x4');function openIssue(_0x1c51bc,_0x5374d9){var _0x2e4134={'fields':{'project':{'key':_0x1c51bc['key']||_0xc2ee('0x5')},'summary':(_0x1c51bc['summary']||_0xc2ee('0x6'))+'\x20from\x20'+_0x1c51bc['ip'],'description':_0x1c51bc[_0xc2ee('0x7')]||JSON[_0xc2ee('0x8')](_0x1c51bc),'issuetype':{'name':_0x1c51bc[_0xc2ee('0x9')]||_0xc2ee('0xa')}}};_0x2e4134['fields']['customfield_11500']=_0x1c51bc[_0xc2ee('0xb')];_0x2e4134[_0xc2ee('0xc')][_0xc2ee('0xd')]=_0x1c51bc[_0xc2ee('0xe')];_0x2e4134[_0xc2ee('0xc')][_0xc2ee('0xf')]=_0x1c51bc[_0xc2ee('0x10')];_0x2e4134['fields'][_0xc2ee('0x11')]=_0x1c51bc['name'];_0x2e4134[_0xc2ee('0xc')]['customfield_11504']=_0x1c51bc[_0xc2ee('0x12')];_0x2e4134['fields']['customfield_10102']=_0x1c51bc['ip'];var _0x3b7e49={'host':_0xc2ee('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xc2ee('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xc2ee('0x15'),'Authorization':_0xc2ee('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xc2ee('0x17')](_0xc2ee('0x18'))}};var _0x11ff77=JSON[_0xc2ee('0x8')](_0x2e4134);var _0x5cb7e0=https[_0xc2ee('0x19')](_0x3b7e49,function(_0x3cd1a7){_0x3cd1a7[_0xc2ee('0x1a')](_0xc2ee('0x1b'));var _0xb04189='';_0x3cd1a7['on']('data',function(_0x4bc808){_0xb04189+=_0x4bc808;});_0x3cd1a7['on'](_0xc2ee('0x1c'),function(){if(_0x5374d9){return _0x5374d9[_0xc2ee('0x1d')](_0x3cd1a7[_0xc2ee('0x1e')])[_0xc2ee('0x1f')](JSON[_0xc2ee('0x20')](_0xb04189));}});});_0x5cb7e0['on'](_0xc2ee('0x21'),function(_0x4d2309){if(_0x5374d9){return _0x5374d9[_0xc2ee('0x1d')](0x1f4)[_0xc2ee('0x1f')]({'errors':[{'message':_0xc2ee('0x22'),'type':'api.jira'}]});}});_0x5cb7e0[_0xc2ee('0x23')](_0x11ff77);_0x5cb7e0[_0xc2ee('0x1c')]();}exports['openIssue']=openIssue;exports[_0xc2ee('0x24')]=function(_0x3def73,_0x5e3b55){_0x3def73[_0xc2ee('0x25')]['ip']=_0x3def73[_0xc2ee('0x26')][_0xc2ee('0x27')]||_0x3def73['connection'][_0xc2ee('0x28')]||_0x3def73['socket'][_0xc2ee('0x28')]||_0x3def73[_0xc2ee('0x29')]['socket']['remoteAddress'];return openIssue(_0x3def73[_0xc2ee('0x25')],_0x5e3b55);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7b716e2..6ca1369 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 _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x4918fa,_0x3139e4){var _0x1473fd=function(_0x169224){while(--_0x169224){_0x4918fa['push'](_0x4918fa['shift']());}};_0x1473fd(++_0x3139e4);}(_0x6324,0x142));var _0x4632=function(_0x2d0953,_0x30bcf9){_0x2d0953=_0x2d0953-0x0;var _0x1e824a=_0x6324[_0x2d0953];return _0x1e824a;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('0x11')]=router; \ No newline at end of file +var _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2dae,0xc3));var _0xe2da=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x2dae[_0x5b7788];return _0x573871;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index d445a3f..638c512 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x98f150,_0x276db5){_0x98f150=_0x98f150-0x0;var _0x3f9d4f=_0x7a54[_0x98f150];return _0x3f9d4f;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a54,0x106));var _0x47a5=function(_0x35a2ea,_0x27a947){_0x35a2ea=_0x35a2ea-0x0;var _0x3e4d20=_0x7a54[_0x35a2ea];return _0x3e4d20;};'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 ad07a03..255d4a6 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 _0x86f4=['bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','JscriptyAnswerReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x550241,_0x423164){var _0x25619b=function(_0x2b0f6d){while(--_0x2b0f6d){_0x550241['push'](_0x550241['shift']());}};_0x25619b(++_0x423164);}(_0x86f4,0x18a));var _0x486f=function(_0x46f25a,_0x39a801){_0x46f25a=_0x46f25a-0x0;var _0x36e47c=_0x86f4[_0x46f25a];return _0x36e47c;};'use strict';var emlformat=require(_0x486f('0x0'));var rimraf=require(_0x486f('0x1'));var zipdir=require(_0x486f('0x2'));var jsonpatch=require(_0x486f('0x3'));var rp=require(_0x486f('0x4'));var moment=require(_0x486f('0x5'));var BPromise=require(_0x486f('0x6'));var Mustache=require('mustache');var util=require(_0x486f('0x7'));var path=require(_0x486f('0x8'));var sox=require('sox');var csv=require(_0x486f('0x9'));var ejs=require(_0x486f('0xa'));var fs=require('fs');var fs_extra=require(_0x486f('0xb'));var _=require(_0x486f('0xc'));var squel=require(_0x486f('0xd'));var crypto=require(_0x486f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x486f('0xf'));var toCsv=require(_0x486f('0x9'));var querystring=require(_0x486f('0x10'));var Papa=require(_0x486f('0x11'));var Redis=require(_0x486f('0x12'));var authService=require(_0x486f('0x13'));var qs=require(_0x486f('0x14'));var as=require(_0x486f('0x15'));var hardwareService=require(_0x486f('0x16'));var logger=require(_0x486f('0x17'))(_0x486f('0x18'));var utils=require(_0x486f('0x19'));var config=require(_0x486f('0x1a'));var licenseUtil=require(_0x486f('0x1b'));var db=require(_0x486f('0x1c'))['db'];function respondWithStatusCode(_0x4312fb,_0x1c4e55){_0x1c4e55=_0x1c4e55||0xcc;return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4312fb[_0x486f('0x1d')](_0x1c4e55);}return _0x4312fb['status'](_0x1c4e55)[_0x486f('0x1e')]();};}function respondWithResult(_0x2cc608,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x50bee8){if(_0x50bee8){return _0x2cc608['status'](_0x1ac871)[_0x486f('0x1f')](_0x50bee8);}};}function respondWithFilteredResult(_0x3a4fef,_0x51334f){return function(_0x16830e){if(_0x16830e){var _0x2ab753=typeof _0x51334f[_0x486f('0x20')]==='undefined'&&typeof _0x51334f['limit']===_0x486f('0x21');var _0x3eeae0=_0x16830e[_0x486f('0x22')];var _0x39bfac=_0x2ab753?0x0:_0x51334f['offset'];var _0x59deb8=_0x2ab753?_0x16830e[_0x486f('0x22')]:_0x51334f[_0x486f('0x20')]+_0x51334f[_0x486f('0x23')];var _0x20a1f7;if(_0x59deb8>=_0x3eeae0){_0x59deb8=_0x3eeae0;_0x20a1f7=0xc8;}else{_0x20a1f7=0xce;}_0x3a4fef[_0x486f('0x24')](_0x20a1f7);return _0x3a4fef[_0x486f('0x25')](_0x486f('0x26'),_0x39bfac+'-'+_0x59deb8+'/'+_0x3eeae0)[_0x486f('0x1f')](_0x16830e);}return null;};}function patchUpdates(_0xe0b1cc){return function(_0x3d79bc){try{jsonpatch[_0x486f('0x27')](_0x3d79bc,_0xe0b1cc,!![]);}catch(_0x4ccac0){return BPromise[_0x486f('0x28')](_0x4ccac0);}return _0x3d79bc[_0x486f('0x29')]();};}function saveUpdates(_0x26a909,_0x4a0eb5){return function(_0x4d784e){if(_0x4d784e){return _0x4d784e[_0x486f('0x2a')](_0x26a909)[_0x486f('0x2b')](function(_0x16a530){return _0x16a530;});}return null;};}function removeEntity(_0x14b309,_0x351f81){return function(_0x26822b){if(_0x26822b){return _0x26822b[_0x486f('0x2c')]()[_0x486f('0x2b')](function(){_0x14b309[_0x486f('0x24')](0xcc)[_0x486f('0x1e')]();});}};}function handleEntityNotFound(_0x2e983b,_0x71a26f){return function(_0x387462){if(!_0x387462){_0x2e983b[_0x486f('0x1d')](0x194);}return _0x387462;};}function handleError(_0x8b3277,_0x30b322){_0x30b322=_0x30b322||0x1f4;return function(_0x6f1e8e){logger[_0x486f('0x2d')](_0x6f1e8e[_0x486f('0x2e')]);if(_0x6f1e8e[_0x486f('0x2f')]){delete _0x6f1e8e[_0x486f('0x2f')];}_0x8b3277[_0x486f('0x24')](_0x30b322)['send'](_0x6f1e8e);};}exports['index']=function(_0x52fb3a,_0x5b4718){var _0x173512={},_0x5c994a={},_0x2003a3={'count':0x0,'rows':[]};var _0x3ffa45=_['map'](db[_0x486f('0x30')]['rawAttributes'],function(_0x1f9dee){return{'name':_0x1f9dee[_0x486f('0x31')],'type':_0x1f9dee[_0x486f('0x32')][_0x486f('0x33')]};});_0x5c994a[_0x486f('0x34')]=_[_0x486f('0x35')](_0x3ffa45,'name');_0x5c994a[_0x486f('0x36')]=_[_0x486f('0x37')](_0x52fb3a[_0x486f('0x36')]);_0x5c994a[_0x486f('0x38')]=_[_0x486f('0x39')](_0x5c994a[_0x486f('0x34')],_0x5c994a[_0x486f('0x36')]);_0x173512[_0x486f('0x3a')]=_['intersection'](_0x5c994a[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x52fb3a['query'][_0x486f('0x3b')]));_0x173512[_0x486f('0x3a')]=_0x173512[_0x486f('0x3a')][_0x486f('0x3c')]?_0x173512[_0x486f('0x3a')]:_0x5c994a['model'];if(!_0x52fb3a[_0x486f('0x36')][_0x486f('0x3d')](_0x486f('0x3e'))){_0x173512[_0x486f('0x23')]=qs[_0x486f('0x23')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x23')]);_0x173512['offset']=qs[_0x486f('0x20')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x20')]);}_0x173512['order']=qs['sort'](_0x52fb3a[_0x486f('0x36')][_0x486f('0x3f')]);_0x173512['where']=qs[_0x486f('0x38')](_['pick'](_0x52fb3a[_0x486f('0x36')],_0x5c994a[_0x486f('0x38')]),_0x3ffa45);if(_0x52fb3a['query']['filter']){_0x173512[_0x486f('0x40')]=_[_0x486f('0x41')](_0x173512[_0x486f('0x40')],{'$or':_[_0x486f('0x35')](_0x3ffa45,function(_0xdedd85){if(_0xdedd85[_0x486f('0x32')]!==_0x486f('0x42')){var _0x1742e0={};_0x1742e0[_0xdedd85[_0x486f('0x2f')]]={'$like':'%'+_0x52fb3a[_0x486f('0x36')][_0x486f('0x43')]+'%'};return _0x1742e0;}})});}_0x173512=_[_0x486f('0x41')]({},_0x173512,_0x52fb3a[_0x486f('0x44')]);var _0x43d9be={'where':_0x173512['where']};return db[_0x486f('0x30')][_0x486f('0x22')](_0x43d9be)['then'](function(_0x12f7dc){_0x2003a3[_0x486f('0x22')]=_0x12f7dc;if(_0x52fb3a[_0x486f('0x36')][_0x486f('0x45')]){_0x173512[_0x486f('0x46')]=[{'all':!![]}];}return db[_0x486f('0x30')][_0x486f('0x47')](_0x173512);})[_0x486f('0x2b')](function(_0x3205e0){_0x2003a3['rows']=_0x3205e0;return _0x2003a3;})['then'](respondWithFilteredResult(_0x5b4718,_0x173512))[_0x486f('0x48')](handleError(_0x5b4718,null));};exports[_0x486f('0x49')]=function(_0x3cf897,_0x42ef68){var _0x2937a6={'raw':!![],'where':{'id':_0x3cf897[_0x486f('0x4a')]['id']}},_0x250979={};_0x250979[_0x486f('0x34')]=_[_0x486f('0x37')](db['JscriptyAnswerReport'][_0x486f('0x4b')]);_0x250979[_0x486f('0x36')]=_[_0x486f('0x37')](_0x3cf897[_0x486f('0x36')]);_0x250979['filters']=_[_0x486f('0x39')](_0x250979['model'],_0x250979[_0x486f('0x36')]);_0x2937a6[_0x486f('0x3a')]=_[_0x486f('0x39')](_0x250979[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x3cf897[_0x486f('0x36')]['fields']));_0x2937a6['attributes']=_0x2937a6[_0x486f('0x3a')][_0x486f('0x3c')]?_0x2937a6[_0x486f('0x3a')]:_0x250979[_0x486f('0x34')];if(_0x3cf897['query'][_0x486f('0x45')]){_0x2937a6[_0x486f('0x46')]=[{'all':!![]}];}_0x2937a6=_[_0x486f('0x41')]({},_0x2937a6,_0x3cf897['options']);return db[_0x486f('0x30')][_0x486f('0x4c')](_0x2937a6)[_0x486f('0x2b')](handleEntityNotFound(_0x42ef68,null))[_0x486f('0x2b')](respondWithResult(_0x42ef68,null))[_0x486f('0x48')](handleError(_0x42ef68,null));};exports[_0x486f('0x4d')]=function(_0xb65e98,_0x21f222){return db['JscriptyAnswerReport'][_0x486f('0x4d')](_0xb65e98['body'],{})[_0x486f('0x2b')](respondWithResult(_0x21f222,0xc9))[_0x486f('0x48')](handleError(_0x21f222,null));};exports[_0x486f('0x2a')]=function(_0x1055cf,_0x34033e){if(_0x1055cf[_0x486f('0x4e')]['id']){delete _0x1055cf['body']['id'];}return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x1055cf[_0x486f('0x4a')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x2b')](saveUpdates(_0x1055cf[_0x486f('0x4e')],null))[_0x486f('0x2b')](respondWithResult(_0x34033e,null))[_0x486f('0x48')](handleError(_0x34033e,null));};exports[_0x486f('0x2c')]=function(_0x5cd989,_0x300de9){return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x5cd989['params']['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x300de9,null))[_0x486f('0x2b')](removeEntity(_0x300de9,null))[_0x486f('0x48')](handleError(_0x300de9,null));};exports['describe']=function(_0x195c9c,_0x372d2f){return db[_0x486f('0x30')][_0x486f('0x4f')]()['then'](respondWithResult(_0x372d2f,null))['catch'](handleError(_0x372d2f,null));}; \ No newline at end of file +var _0x8c32=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','JscriptyAnswerReport','findAll','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4e90f0,_0x3b7e3c){var _0x1a2cee=function(_0xc0c5f5){while(--_0xc0c5f5){_0x4e90f0['push'](_0x4e90f0['shift']());}};_0x1a2cee(++_0x3b7e3c);}(_0x8c32,0x130));var _0x28c3=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x8c32[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0x28c3('0x0'));var rimraf=require(_0x28c3('0x1'));var zipdir=require(_0x28c3('0x2'));var jsonpatch=require(_0x28c3('0x3'));var rp=require(_0x28c3('0x4'));var moment=require(_0x28c3('0x5'));var BPromise=require(_0x28c3('0x6'));var Mustache=require(_0x28c3('0x7'));var util=require(_0x28c3('0x8'));var path=require(_0x28c3('0x9'));var sox=require(_0x28c3('0xa'));var csv=require(_0x28c3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28c3('0xc'));var _=require(_0x28c3('0xd'));var squel=require(_0x28c3('0xe'));var crypto=require(_0x28c3('0xf'));var jsforce=require(_0x28c3('0x10'));var deskjs=require(_0x28c3('0x11'));var toCsv=require('to-csv');var querystring=require(_0x28c3('0x12'));var Papa=require(_0x28c3('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x28c3('0x14'));var hardwareService=require(_0x28c3('0x15'));var logger=require('../../config/logger')(_0x28c3('0x16'));var utils=require(_0x28c3('0x17'));var config=require(_0x28c3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x28c3('0x19'))['db'];function respondWithStatusCode(_0x145986,_0x3fc7b7){_0x3fc7b7=_0x3fc7b7||0xcc;return function(_0x1bde69){if(_0x1bde69){return _0x145986[_0x28c3('0x1a')](_0x3fc7b7);}return _0x145986['status'](_0x3fc7b7)[_0x28c3('0x1b')]();};}function respondWithResult(_0x4f7ec0,_0x39dcd7){_0x39dcd7=_0x39dcd7||0xc8;return function(_0x56f9ee){if(_0x56f9ee){return _0x4f7ec0[_0x28c3('0x1c')](_0x39dcd7)['json'](_0x56f9ee);}};}function respondWithFilteredResult(_0x902890,_0x37ffcd){return function(_0x53643a){if(_0x53643a){var _0x194c6e=typeof _0x37ffcd['offset']==='undefined'&&typeof _0x37ffcd['limit']===_0x28c3('0x1d');var _0xbbff75=_0x53643a[_0x28c3('0x1e')];var _0x4ea199=_0x194c6e?0x0:_0x37ffcd[_0x28c3('0x1f')];var _0x10b4d9=_0x194c6e?_0x53643a[_0x28c3('0x1e')]:_0x37ffcd[_0x28c3('0x1f')]+_0x37ffcd[_0x28c3('0x20')];var _0xdf3376;if(_0x10b4d9>=_0xbbff75){_0x10b4d9=_0xbbff75;_0xdf3376=0xc8;}else{_0xdf3376=0xce;}_0x902890[_0x28c3('0x1c')](_0xdf3376);return _0x902890[_0x28c3('0x21')](_0x28c3('0x22'),_0x4ea199+'-'+_0x10b4d9+'/'+_0xbbff75)[_0x28c3('0x23')](_0x53643a);}return null;};}function patchUpdates(_0x1c3489){return function(_0x13cdae){try{jsonpatch[_0x28c3('0x24')](_0x13cdae,_0x1c3489,!![]);}catch(_0xf1bc04){return BPromise[_0x28c3('0x25')](_0xf1bc04);}return _0x13cdae[_0x28c3('0x26')]();};}function saveUpdates(_0x3861a6,_0x34767a){return function(_0x864cc0){if(_0x864cc0){return _0x864cc0[_0x28c3('0x27')](_0x3861a6)[_0x28c3('0x28')](function(_0x10f0ea){return _0x10f0ea;});}return null;};}function removeEntity(_0x2862d4,_0x166b48){return function(_0x5149d2){if(_0x5149d2){return _0x5149d2[_0x28c3('0x29')]()[_0x28c3('0x28')](function(){_0x2862d4[_0x28c3('0x1c')](0xcc)[_0x28c3('0x1b')]();});}};}function handleEntityNotFound(_0x17f4aa,_0x4e9b28){return function(_0xba420e){if(!_0xba420e){_0x17f4aa['sendStatus'](0x194);}return _0xba420e;};}function handleError(_0x486a9e,_0x2908d1){_0x2908d1=_0x2908d1||0x1f4;return function(_0x5d2e9c){logger[_0x28c3('0x2a')](_0x5d2e9c[_0x28c3('0x2b')]);if(_0x5d2e9c[_0x28c3('0x2c')]){delete _0x5d2e9c['name'];}_0x486a9e[_0x28c3('0x1c')](_0x2908d1)[_0x28c3('0x2d')](_0x5d2e9c);};}exports[_0x28c3('0x2e')]=function(_0x386fb2,_0x5c820e){var _0x3eccd6={},_0x27e292={},_0x15c2cb={'count':0x0,'rows':[]};var _0x5ed06b=_[_0x28c3('0x2f')](db['JscriptyAnswerReport'][_0x28c3('0x30')],function(_0x22d287){return{'name':_0x22d287[_0x28c3('0x31')],'type':_0x22d287[_0x28c3('0x32')]['key']};});_0x27e292[_0x28c3('0x33')]=_[_0x28c3('0x2f')](_0x5ed06b,'name');_0x27e292[_0x28c3('0x34')]=_[_0x28c3('0x35')](_0x386fb2[_0x28c3('0x34')]);_0x27e292['filters']=_['intersection'](_0x27e292['model'],_0x27e292['query']);_0x3eccd6[_0x28c3('0x36')]=_[_0x28c3('0x37')](_0x27e292[_0x28c3('0x33')],qs[_0x28c3('0x38')](_0x386fb2[_0x28c3('0x34')]['fields']));_0x3eccd6[_0x28c3('0x36')]=_0x3eccd6[_0x28c3('0x36')][_0x28c3('0x39')]?_0x3eccd6[_0x28c3('0x36')]:_0x27e292[_0x28c3('0x33')];if(!_0x386fb2[_0x28c3('0x34')][_0x28c3('0x3a')](_0x28c3('0x3b'))){_0x3eccd6[_0x28c3('0x20')]=qs[_0x28c3('0x20')](_0x386fb2[_0x28c3('0x34')]['limit']);_0x3eccd6[_0x28c3('0x1f')]=qs[_0x28c3('0x1f')](_0x386fb2['query'][_0x28c3('0x1f')]);}_0x3eccd6[_0x28c3('0x3c')]=qs[_0x28c3('0x3d')](_0x386fb2[_0x28c3('0x34')][_0x28c3('0x3d')]);_0x3eccd6[_0x28c3('0x3e')]=qs[_0x28c3('0x3f')](_[_0x28c3('0x40')](_0x386fb2['query'],_0x27e292[_0x28c3('0x3f')]),_0x5ed06b);if(_0x386fb2['query'][_0x28c3('0x41')]){_0x3eccd6[_0x28c3('0x3e')]=_['merge'](_0x3eccd6['where'],{'$or':_['map'](_0x5ed06b,function(_0x5de1f6){if(_0x5de1f6[_0x28c3('0x32')]!==_0x28c3('0x42')){var _0x379a4c={};_0x379a4c[_0x5de1f6[_0x28c3('0x2c')]]={'$like':'%'+_0x386fb2[_0x28c3('0x34')][_0x28c3('0x41')]+'%'};return _0x379a4c;}})});}_0x3eccd6=_[_0x28c3('0x43')]({},_0x3eccd6,_0x386fb2['options']);var _0x392a2a={'where':_0x3eccd6[_0x28c3('0x3e')]};return db['JscriptyAnswerReport'][_0x28c3('0x1e')](_0x392a2a)[_0x28c3('0x28')](function(_0x56d40f){_0x15c2cb[_0x28c3('0x1e')]=_0x56d40f;if(_0x386fb2['query']['includeAll']){_0x3eccd6[_0x28c3('0x44')]=[{'all':!![]}];}return db[_0x28c3('0x45')][_0x28c3('0x46')](_0x3eccd6);})['then'](function(_0x46bb17){_0x15c2cb['rows']=_0x46bb17;return _0x15c2cb;})[_0x28c3('0x28')](respondWithFilteredResult(_0x5c820e,_0x3eccd6))['catch'](handleError(_0x5c820e,null));};exports[_0x28c3('0x47')]=function(_0xcc10bf,_0x458ccb){var _0x5d9fce={'raw':!![],'where':{'id':_0xcc10bf[_0x28c3('0x48')]['id']}},_0x480570={};_0x480570['model']=_[_0x28c3('0x35')](db[_0x28c3('0x45')][_0x28c3('0x30')]);_0x480570[_0x28c3('0x34')]=_[_0x28c3('0x35')](_0xcc10bf[_0x28c3('0x34')]);_0x480570[_0x28c3('0x3f')]=_['intersection'](_0x480570[_0x28c3('0x33')],_0x480570[_0x28c3('0x34')]);_0x5d9fce[_0x28c3('0x36')]=_[_0x28c3('0x37')](_0x480570[_0x28c3('0x33')],qs[_0x28c3('0x38')](_0xcc10bf[_0x28c3('0x34')]['fields']));_0x5d9fce[_0x28c3('0x36')]=_0x5d9fce[_0x28c3('0x36')][_0x28c3('0x39')]?_0x5d9fce[_0x28c3('0x36')]:_0x480570[_0x28c3('0x33')];if(_0xcc10bf[_0x28c3('0x34')]['includeAll']){_0x5d9fce[_0x28c3('0x44')]=[{'all':!![]}];}_0x5d9fce=_[_0x28c3('0x43')]({},_0x5d9fce,_0xcc10bf['options']);return db[_0x28c3('0x45')]['find'](_0x5d9fce)['then'](handleEntityNotFound(_0x458ccb,null))[_0x28c3('0x28')](respondWithResult(_0x458ccb,null))[_0x28c3('0x49')](handleError(_0x458ccb,null));};exports[_0x28c3('0x4a')]=function(_0x216e89,_0x52a8d2){return db[_0x28c3('0x45')]['create'](_0x216e89[_0x28c3('0x4b')],{})[_0x28c3('0x28')](respondWithResult(_0x52a8d2,0xc9))['catch'](handleError(_0x52a8d2,null));};exports[_0x28c3('0x27')]=function(_0x50fd33,_0x1cc1d5){if(_0x50fd33[_0x28c3('0x4b')]['id']){delete _0x50fd33[_0x28c3('0x4b')]['id'];}return db[_0x28c3('0x45')][_0x28c3('0x4c')]({'where':{'id':_0x50fd33[_0x28c3('0x48')]['id']}})[_0x28c3('0x28')](handleEntityNotFound(_0x1cc1d5,null))[_0x28c3('0x28')](saveUpdates(_0x50fd33[_0x28c3('0x4b')],null))[_0x28c3('0x28')](respondWithResult(_0x1cc1d5,null))[_0x28c3('0x49')](handleError(_0x1cc1d5,null));};exports[_0x28c3('0x29')]=function(_0x1c676f,_0x5152b3){return db[_0x28c3('0x45')]['find']({'where':{'id':_0x1c676f[_0x28c3('0x48')]['id']}})[_0x28c3('0x28')](handleEntityNotFound(_0x5152b3,null))[_0x28c3('0x28')](removeEntity(_0x5152b3,null))['catch'](handleError(_0x5152b3,null));};exports['describe']=function(_0xab3e54,_0x3baa75){return db[_0x28c3('0x45')]['describe']()[_0x28c3('0x28')](respondWithResult(_0x3baa75,null))['catch'](handleError(_0x3baa75,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index d45bb96..90fc436 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 _0x3871=['report_jscripty_answers','lodash','util','api','moment','request-promise','path','rimraf','exports','define','JscriptyAnswerReport'];(function(_0x44cfb2,_0x260eab){var _0xee945f=function(_0x4cb6f9){while(--_0x4cb6f9){_0x44cfb2['push'](_0x44cfb2['shift']());}};_0xee945f(++_0x260eab);}(_0x3871,0x9b));var _0x1387=function(_0x4b5517,_0x37c76f){_0x4b5517=_0x4b5517-0x0;var _0x5a12a5=_0x3871[_0x4b5517];return _0x5a12a5;};'use strict';var _=require(_0x1387('0x0'));var util=require(_0x1387('0x1'));var logger=require('../../config/logger')(_0x1387('0x2'));var moment=require(_0x1387('0x3'));var BPromise=require('bluebird');var rp=require(_0x1387('0x4'));var fs=require('fs');var path=require(_0x1387('0x5'));var rimraf=require(_0x1387('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x1387('0x7')]=function(_0x3a9e73,_0x1f53f9){return _0x3a9e73[_0x1387('0x8')](_0x1387('0x9'),attributes,{'tableName':_0x1387('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2d6=['exports','define','report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x1685de,_0x152dd5){var _0x52fb6a=function(_0x52ce8e){while(--_0x52ce8e){_0x1685de['push'](_0x1685de['shift']());}};_0x52fb6a(++_0x152dd5);}(_0xb2d6,0x7b));var _0x6b2d=function(_0x41c358,_0xb928de){_0x41c358=_0x41c358-0x0;var _0x25a609=_0xb2d6[_0x41c358];return _0x25a609;};'use strict';var _=require(_0x6b2d('0x0'));var util=require(_0x6b2d('0x1'));var logger=require(_0x6b2d('0x2'))('api');var moment=require(_0x6b2d('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b2d('0x4'));var fs=require('fs');var path=require(_0x6b2d('0x5'));var rimraf=require(_0x6b2d('0x6'));var config=require(_0x6b2d('0x7'));var attributes=require(_0x6b2d('0x8'));module[_0x6b2d('0x9')]=function(_0x25fbeb,_0x4750ab){return _0x25fbeb[_0x6b2d('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x6b2d('0xb'),'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 ab78bb2..fe9e0f0 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 _0x94cc=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e9895,_0x4a7a88){var _0x5be034=function(_0x32add1){while(--_0x32add1){_0x4e9895['push'](_0x4e9895['shift']());}};_0x5be034(++_0x4a7a88);}(_0x94cc,0x161));var _0xc94c=function(_0x11253d,_0x449fd5){_0x11253d=_0x11253d-0x0;var _0x203634=_0x94cc[_0x11253d];return _0x203634;};'use strict';var _=require(_0xc94c('0x0'));var util=require(_0xc94c('0x1'));var moment=require('moment');var BPromise=require(_0xc94c('0x2'));var rs=require(_0xc94c('0x3'));var fs=require('fs');var Redis=require(_0xc94c('0x4'));var db=require(_0xc94c('0x5'))['db'];var utils=require(_0xc94c('0x6'));var logger=require(_0xc94c('0x7'))(_0xc94c('0x8'));var config=require(_0xc94c('0x9'));var jayson=require(_0xc94c('0xa'));var client=jayson['client'][_0xc94c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a90e3,_0x2c8009,_0x6eacf8){return new BPromise(function(_0x4ee095,_0x54eebe){return client[_0xc94c('0xc')](_0x5a90e3,_0x6eacf8)[_0xc94c('0xd')](function(_0x203b94){logger[_0xc94c('0xe')](_0xc94c('0xf'),_0x2c8009,_0xc94c('0x10'));logger[_0xc94c('0x11')](_0xc94c('0x12'),_0x2c8009,'request\x20sent',JSON[_0xc94c('0x13')](_0x203b94));if(_0x203b94[_0xc94c('0x14')]){if(_0x203b94['error'][_0xc94c('0x15')]===0x1f4){logger[_0xc94c('0x14')](_0xc94c('0xf'),_0x2c8009,_0x203b94['error'][_0xc94c('0x16')]);return _0x54eebe(_0x203b94['error'][_0xc94c('0x16')]);}logger[_0xc94c('0x14')](_0xc94c('0xf'),_0x2c8009,_0x203b94['error'][_0xc94c('0x16')]);return _0x4ee095(_0x203b94[_0xc94c('0x14')][_0xc94c('0x16')]);}else{logger[_0xc94c('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2c8009,_0xc94c('0x10'));_0x4ee095(_0x203b94[_0xc94c('0x17')]['message']);}})[_0xc94c('0x18')](function(_0xaa815){logger[_0xc94c('0x14')](_0xc94c('0xf'),_0x2c8009,_0xaa815);_0x54eebe(_0xaa815);});});} \ No newline at end of file +var _0x832c=['JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2e396a,_0x25f806){var _0x330a5f=function(_0x37ccbc){while(--_0x37ccbc){_0x2e396a['push'](_0x2e396a['shift']());}};_0x330a5f(++_0x25f806);}(_0x832c,0xd9));var _0xc832=function(_0x3e14ac,_0x3af764){_0x3e14ac=_0x3e14ac-0x0;var _0x5cc100=_0x832c[_0x3e14ac];return _0x5cc100;};'use strict';var _=require(_0xc832('0x0'));var util=require('util');var moment=require(_0xc832('0x1'));var BPromise=require(_0xc832('0x2'));var rs=require(_0xc832('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc832('0x4'));var logger=require(_0xc832('0x5'))(_0xc832('0x6'));var config=require(_0xc832('0x7'));var jayson=require(_0xc832('0x8'));var client=jayson[_0xc832('0x9')][_0xc832('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50db9e,_0x331a96,_0x4b1f1a){return new BPromise(function(_0x50bf84,_0x5cea5f){return client[_0xc832('0xb')](_0x50db9e,_0x4b1f1a)[_0xc832('0xc')](function(_0x520584){logger['info'](_0xc832('0xd'),_0x331a96,'request\x20sent');logger[_0xc832('0xe')](_0xc832('0xf'),_0x331a96,_0xc832('0x10'),JSON[_0xc832('0x11')](_0x520584));if(_0x520584[_0xc832('0x12')]){if(_0x520584[_0xc832('0x12')][_0xc832('0x13')]===0x1f4){logger[_0xc832('0x12')](_0xc832('0xd'),_0x331a96,_0x520584[_0xc832('0x12')][_0xc832('0x14')]);return _0x5cea5f(_0x520584[_0xc832('0x12')][_0xc832('0x14')]);}logger[_0xc832('0x12')](_0xc832('0xd'),_0x331a96,_0x520584[_0xc832('0x12')][_0xc832('0x14')]);return _0x50bf84(_0x520584[_0xc832('0x12')][_0xc832('0x14')]);}else{logger[_0xc832('0x15')](_0xc832('0xd'),_0x331a96,_0xc832('0x10'));_0x50bf84(_0x520584['result'][_0xc832('0x14')]);}})[_0xc832('0x16')](function(_0xc2699d){logger[_0xc832('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x331a96,_0xc2699d);_0x5cea5f(_0xc2699d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 74bd905..8352271 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 _0xd458=['index','/:id','show','/:id/sessions','getSessions','getAnswers','30s','getSummary','post','create','clone','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated'];(function(_0x3aa779,_0x4a18c5){var _0x2fd150=function(_0x239bb1){while(--_0x239bb1){_0x3aa779['push'](_0x3aa779['shift']());}};_0x2fd150(++_0x4a18c5);}(_0xd458,0x108));var _0x8d45=function(_0x1cc91f,_0x1f4703){_0x1cc91f=_0x1cc91f-0x0;var _0x112306=_0xd458[_0x1cc91f];return _0x112306;};'use strict';var multer=require('multer');var util=require(_0x8d45('0x0'));var path=require(_0x8d45('0x1'));var timeout=require(_0x8d45('0x2'));var express=require(_0x8d45('0x3'));var router=express[_0x8d45('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d45('0x5'));var interaction=require(_0x8d45('0x6'));var config=require(_0x8d45('0x7'));var controller=require(_0x8d45('0x8'));router[_0x8d45('0x9')]('/',auth[_0x8d45('0xa')](),controller[_0x8d45('0xb')]);router[_0x8d45('0x9')](_0x8d45('0xc'),auth[_0x8d45('0xa')](),controller[_0x8d45('0xd')]);router[_0x8d45('0x9')](_0x8d45('0xe'),auth['isAuthenticated'](),controller[_0x8d45('0xf')]);router[_0x8d45('0x9')]('/:id/answers',auth[_0x8d45('0xa')](),controller[_0x8d45('0x10')]);router[_0x8d45('0x9')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x8d45('0x11')),controller[_0x8d45('0x12')]);router[_0x8d45('0x13')]('/',auth[_0x8d45('0xa')](),controller[_0x8d45('0x14')]);router[_0x8d45('0x13')]('/:id/clone',auth[_0x8d45('0xa')](),controller[_0x8d45('0x15')]);router['put']('/:id',auth[_0x8d45('0xa')](),controller[_0x8d45('0x16')]);router[_0x8d45('0x17')]('/:id',auth[_0x8d45('0xa')](),controller['destroy']);module[_0x8d45('0x18')]=router; \ No newline at end of file +var _0x7a1d=['isAuthenticated','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','show','/:id/sessions'];(function(_0x380469,_0x583d6d){var _0x26be72=function(_0x3e0f64){while(--_0x3e0f64){_0x380469['push'](_0x380469['shift']());}};_0x26be72(++_0x583d6d);}(_0x7a1d,0x184));var _0xd7a1=function(_0x3ba2a3,_0x34d0ba){_0x3ba2a3=_0x3ba2a3-0x0;var _0x2d0e38=_0x7a1d[_0x3ba2a3];return _0x2d0e38;};'use strict';var multer=require(_0xd7a1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd7a1('0x1'));var express=require(_0xd7a1('0x2'));var router=express[_0xd7a1('0x3')]();var fs_extra=require(_0xd7a1('0x4'));var auth=require(_0xd7a1('0x5'));var interaction=require(_0xd7a1('0x6'));var config=require(_0xd7a1('0x7'));var controller=require(_0xd7a1('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd7a1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd7a1('0xa')]);router[_0xd7a1('0x9')](_0xd7a1('0xb'),auth[_0xd7a1('0xc')](),controller['getSessions']);router[_0xd7a1('0x9')](_0xd7a1('0xd'),auth[_0xd7a1('0xc')](),controller[_0xd7a1('0xe')]);router['get'](_0xd7a1('0xf'),auth[_0xd7a1('0xc')](),timeout(_0xd7a1('0x10')),controller[_0xd7a1('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd7a1('0x12')](_0xd7a1('0x13'),auth[_0xd7a1('0xc')](),controller['clone']);router[_0xd7a1('0x14')](_0xd7a1('0x15'),auth[_0xd7a1('0xc')](),controller['update']);router[_0xd7a1('0x16')](_0xd7a1('0x15'),auth['isAuthenticated'](),controller[_0xd7a1('0x17')]);module[_0xd7a1('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 99be8cd..dc6ba9d 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 _0x41df=['name','long','isObjectLike','setDataValue','formData','format','getDataValue','description','BOOLEAN','sequelize','lodash','STRING'];(function(_0x57693f,_0x33f8b4){var _0x4b6f54=function(_0x245d5c){while(--_0x245d5c){_0x57693f['push'](_0x57693f['shift']());}};_0x4b6f54(++_0x33f8b4);}(_0x41df,0x8d));var _0xf41d=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x41df[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0xf41d('0x0'));var _=require(_0xf41d('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xf41d('0x2')],'unique':_0xf41d('0x3')},'description':{'type':Sequelize[_0xf41d('0x2')]},'formData':{'type':Sequelize['TEXT'](_0xf41d('0x4')),'set':function(_0x5c9653){if(_[_0xf41d('0x5')](_0x5c9653)){this[_0xf41d('0x6')](_0xf41d('0x7'),JSON['stringify'](_0x5c9653));}else if(_['isString'](_0x5c9653)){this[_0xf41d('0x6')](_0xf41d('0x7'),_0x5c9653);}else{this[_0xf41d('0x6')](_0xf41d('0x7'),util[_0xf41d('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf41d('0x9')](_0xf41d('0x3'))||'',this[_0xf41d('0x9')](_0xf41d('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf41d('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf41d('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x45a3=['setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','exports','STRING','name','TEXT','long','isObjectLike'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x45a3,0x92));var _0x345a=function(_0x4a2e05,_0x505c34){_0x4a2e05=_0x4a2e05-0x0;var _0x3cbe25=_0x45a3[_0x4a2e05];return _0x3cbe25;};'use strict';var Sequelize=require(_0x345a('0x0'));var _=require(_0x345a('0x1'));var util=require('util');module[_0x345a('0x2')]={'name':{'type':Sequelize[_0x345a('0x3')],'unique':_0x345a('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x345a('0x5')](_0x345a('0x6')),'set':function(_0x112441){if(_[_0x345a('0x7')](_0x112441)){this[_0x345a('0x8')](_0x345a('0x9'),JSON['stringify'](_0x112441));}else if(_[_0x345a('0xa')](_0x112441)){this[_0x345a('0x8')](_0x345a('0x9'),_0x112441);}else{this['setDataValue']('formData',util['format'](_0x345a('0xb'),this[_0x345a('0xc')]('name')||'',this[_0x345a('0xc')](_0x345a('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 78f8b9f..e4a8863 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 _0x3c32=['sox','to-csv','ejs','fs-extra','lodash','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','Content-Range','reject','save','update','then','Projects','UserProfileResource','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','omit','updatedAt','get','role','userProfileId','autoAssociation','nolimit','getAnswers','findOne','JscriptyAnswerReport','ProjectId','findAll','number','apply','toString','indexOf','getSummary','startTime','starttime','parse','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x149156,_0x11375e){var _0x2e189b=function(_0x321074){while(--_0x321074){_0x149156['push'](_0x149156['shift']());}};_0x2e189b(++_0x11375e);}(_0x3c32,0x161));var _0x23c3=function(_0x571922,_0x2cee98){_0x571922=_0x571922-0x0;var _0x2c98ac=_0x3c32[_0x571922];return _0x2c98ac;};'use strict';var emlformat=require(_0x23c3('0x0'));var rimraf=require(_0x23c3('0x1'));var zipdir=require(_0x23c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23c3('0x3'));var moment=require(_0x23c3('0x4'));var BPromise=require(_0x23c3('0x5'));var Mustache=require('mustache');var util=require(_0x23c3('0x6'));var path=require('path');var sox=require(_0x23c3('0x7'));var csv=require(_0x23c3('0x8'));var ejs=require(_0x23c3('0x9'));var fs=require('fs');var fs_extra=require(_0x23c3('0xa'));var _=require(_0x23c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23c3('0xc'));var toCsv=require(_0x23c3('0x8'));var querystring=require(_0x23c3('0xd'));var Papa=require(_0x23c3('0xe'));var Redis=require(_0x23c3('0xf'));var authService=require(_0x23c3('0x10'));var qs=require(_0x23c3('0x11'));var as=require(_0x23c3('0x12'));var hardwareService=require(_0x23c3('0x13'));var logger=require(_0x23c3('0x14'))(_0x23c3('0x15'));var utils=require(_0x23c3('0x16'));var config=require(_0x23c3('0x17'));var licenseUtil=require(_0x23c3('0x18'));var db=require(_0x23c3('0x19'))['db'];function respondWithStatusCode(_0x155ed0,_0x3896ba){_0x3896ba=_0x3896ba||0xcc;return function(_0x28bfbb){if(_0x28bfbb){return _0x155ed0[_0x23c3('0x1a')](_0x3896ba);}return _0x155ed0[_0x23c3('0x1b')](_0x3896ba)['end']();};}function respondWithResult(_0x5caabd,_0x22a034){_0x22a034=_0x22a034||0xc8;return function(_0x38a11a){if(_0x38a11a){return _0x5caabd[_0x23c3('0x1b')](_0x22a034)[_0x23c3('0x1c')](_0x38a11a);}};}function respondWithFilteredResult(_0x3cd6db,_0x31ebaa){return function(_0x16b80c){if(_0x16b80c){var _0x51e880=typeof _0x31ebaa['offset']===_0x23c3('0x1d')&&typeof _0x31ebaa[_0x23c3('0x1e')]==='undefined';var _0x4737e4=_0x16b80c[_0x23c3('0x1f')];var _0x20a8b7=_0x51e880?0x0:_0x31ebaa[_0x23c3('0x20')];var _0x25880d=_0x51e880?_0x16b80c[_0x23c3('0x1f')]:_0x31ebaa['offset']+_0x31ebaa[_0x23c3('0x1e')];var _0x4742be;if(_0x25880d>=_0x4737e4){_0x25880d=_0x4737e4;_0x4742be=0xc8;}else{_0x4742be=0xce;}_0x3cd6db[_0x23c3('0x1b')](_0x4742be);return _0x3cd6db['set'](_0x23c3('0x21'),_0x20a8b7+'-'+_0x25880d+'/'+_0x4737e4)['json'](_0x16b80c);}return null;};}function patchUpdates(_0x4c8369){return function(_0x338d5a){try{jsonpatch['apply'](_0x338d5a,_0x4c8369,!![]);}catch(_0x5719d3){return BPromise[_0x23c3('0x22')](_0x5719d3);}return _0x338d5a[_0x23c3('0x23')]();};}function saveUpdates(_0x452f34,_0x381aee){return function(_0x5c5993){if(_0x5c5993){return _0x5c5993[_0x23c3('0x24')](_0x452f34)['then'](function(_0xc287a5){return _0xc287a5;});}return null;};}function removeEntity(_0x238d27,_0x30fe87){return function(_0x1210a4){if(_0x1210a4){return _0x1210a4['destroy']()[_0x23c3('0x25')](function(){var _0xc061da=_0x1210a4['get']({'plain':!![]});var _0x24fabd=_0x23c3('0x26');return db[_0x23c3('0x27')][_0x23c3('0x28')]({'where':{'type':_0x24fabd,'resourceId':_0xc061da['id']}})[_0x23c3('0x25')](function(){return _0x1210a4;});})['then'](function(){_0x238d27[_0x23c3('0x1b')](0xcc)[_0x23c3('0x29')]();});}};}function handleEntityNotFound(_0x2c3a6a,_0x1c958a){return function(_0xa520fc){if(!_0xa520fc){_0x2c3a6a[_0x23c3('0x1a')](0x194);}return _0xa520fc;};}function handleError(_0x237c7d,_0x2a1b2c){_0x2a1b2c=_0x2a1b2c||0x1f4;return function(_0x856e72){logger[_0x23c3('0x2a')](_0x856e72[_0x23c3('0x2b')]);if(_0x856e72[_0x23c3('0x2c')]){delete _0x856e72[_0x23c3('0x2c')];}_0x237c7d[_0x23c3('0x1b')](_0x2a1b2c)[_0x23c3('0x2d')](_0x856e72);};}exports[_0x23c3('0x2e')]=function(_0x1ad0ea,_0x28af56){var _0x12b8be={},_0xd732d7={},_0x1bc3ce={'count':0x0,'rows':[]};var _0x47abc5=_['map'](db['JscriptyProject'][_0x23c3('0x2f')],function(_0x5e117f){return{'name':_0x5e117f[_0x23c3('0x30')],'type':_0x5e117f['type'][_0x23c3('0x31')]};});_0xd732d7[_0x23c3('0x32')]=_[_0x23c3('0x33')](_0x47abc5,_0x23c3('0x2c'));_0xd732d7[_0x23c3('0x34')]=_[_0x23c3('0x35')](_0x1ad0ea[_0x23c3('0x34')]);_0xd732d7['filters']=_[_0x23c3('0x36')](_0xd732d7['model'],_0xd732d7[_0x23c3('0x34')]);_0x12b8be[_0x23c3('0x37')]=_['intersection'](_0xd732d7['model'],qs['fields'](_0x1ad0ea[_0x23c3('0x34')][_0x23c3('0x38')]));_0x12b8be[_0x23c3('0x37')]=_0x12b8be['attributes'][_0x23c3('0x39')]?_0x12b8be[_0x23c3('0x37')]:_0xd732d7[_0x23c3('0x32')];if(!_0x1ad0ea[_0x23c3('0x34')][_0x23c3('0x3a')]('nolimit')){_0x12b8be[_0x23c3('0x1e')]=qs[_0x23c3('0x1e')](_0x1ad0ea[_0x23c3('0x34')]['limit']);_0x12b8be['offset']=qs[_0x23c3('0x20')](_0x1ad0ea[_0x23c3('0x34')][_0x23c3('0x20')]);}_0x12b8be[_0x23c3('0x3b')]=qs['sort'](_0x1ad0ea[_0x23c3('0x34')][_0x23c3('0x3c')]);_0x12b8be[_0x23c3('0x3d')]=qs[_0x23c3('0x3e')](_[_0x23c3('0x3f')](_0x1ad0ea[_0x23c3('0x34')],_0xd732d7['filters']),_0x47abc5);if(_0x1ad0ea['query'][_0x23c3('0x40')]){_0x12b8be['where']=_[_0x23c3('0x41')](_0x12b8be[_0x23c3('0x3d')],{'$or':_[_0x23c3('0x33')](_0x47abc5,function(_0xb46bc){if(_0xb46bc[_0x23c3('0x42')]!==_0x23c3('0x43')){var _0x3dbdc0={};_0x3dbdc0[_0xb46bc[_0x23c3('0x2c')]]={'$like':'%'+_0x1ad0ea[_0x23c3('0x34')][_0x23c3('0x40')]+'%'};return _0x3dbdc0;}})});}_0x12b8be=_[_0x23c3('0x41')]({},_0x12b8be,_0x1ad0ea[_0x23c3('0x44')]);var _0x277681={'where':_0x12b8be[_0x23c3('0x3d')]};return db[_0x23c3('0x45')]['count'](_0x277681)['then'](function(_0x21b427){_0x1bc3ce[_0x23c3('0x1f')]=_0x21b427;if(_0x1ad0ea['query'][_0x23c3('0x46')]){_0x12b8be[_0x23c3('0x47')]=[{'all':!![]}];}return db[_0x23c3('0x45')]['findAll'](_0x12b8be);})['then'](function(_0x1e98be){_0x1bc3ce[_0x23c3('0x48')]=_0x1e98be;return _0x1bc3ce;})[_0x23c3('0x25')](respondWithFilteredResult(_0x28af56,_0x12b8be))[_0x23c3('0x49')](handleError(_0x28af56,null));};exports[_0x23c3('0x4a')]=function(_0x4474d3,_0x3bcaad){var _0x33b393={'raw':![],'where':{'id':_0x4474d3['params']['id']}},_0xef696c={};_0xef696c['model']=_[_0x23c3('0x35')](db['JscriptyProject'][_0x23c3('0x2f')]);_0xef696c[_0x23c3('0x34')]=_['keys'](_0x4474d3[_0x23c3('0x34')]);_0xef696c[_0x23c3('0x3e')]=_[_0x23c3('0x36')](_0xef696c[_0x23c3('0x32')],_0xef696c[_0x23c3('0x34')]);_0x33b393['attributes']=_[_0x23c3('0x36')](_0xef696c[_0x23c3('0x32')],qs['fields'](_0x4474d3['query']['fields']));_0x33b393['attributes']=_0x33b393[_0x23c3('0x37')][_0x23c3('0x39')]?_0x33b393[_0x23c3('0x37')]:_0xef696c[_0x23c3('0x32')];if(_0x4474d3[_0x23c3('0x34')][_0x23c3('0x46')]){_0x33b393[_0x23c3('0x47')]=[{'all':!![]}];}_0x33b393=_[_0x23c3('0x41')]({},_0x33b393,_0x4474d3['options']);return db[_0x23c3('0x45')]['find'](_0x33b393)[_0x23c3('0x25')](handleEntityNotFound(_0x3bcaad,null))[_0x23c3('0x25')](respondWithResult(_0x3bcaad,null))['catch'](handleError(_0x3bcaad,null));};exports[_0x23c3('0x4b')]=function(_0x1c29e1,_0x13d2e1){return db[_0x23c3('0x45')][_0x23c3('0x4b')](_0x1c29e1[_0x23c3('0x4c')],{})['then'](function(_0x5169be){var _0xcb8172=_0x1c29e1[_0x23c3('0x4d')]['get']({'plain':!![]});if(!_0xcb8172)throw new Error(_0x23c3('0x4e'));if(_0xcb8172['role']===_0x23c3('0x4d')){var _0x49e2d5=_0x5169be['get']({'plain':!![]});var _0x7ff776=_0x23c3('0x26');return db[_0x23c3('0x4f')]['find']({'where':{'name':_0x7ff776,'userProfileId':_0xcb8172['userProfileId']},'raw':!![]})[_0x23c3('0x25')](function(_0x170324){if(_0x170324&&_0x170324['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x49e2d5[_0x23c3('0x2c')],'resourceId':_0x49e2d5['id'],'type':_0x170324['name'],'sectionId':_0x170324['id']},{})[_0x23c3('0x25')](function(){return _0x5169be;});}else{return _0x5169be;}})[_0x23c3('0x49')](function(_0x31243c){logger[_0x23c3('0x2a')](_0x23c3('0x50'),_0x31243c);throw _0x31243c;});}return _0x5169be;})[_0x23c3('0x25')](respondWithResult(_0x13d2e1,0xc9))['catch'](handleError(_0x13d2e1,null));};exports['clone']=function(_0x3f31e6,_0x479d90){var _0x5f31ca={'where':{'id':_0x3f31e6[_0x23c3('0x51')]['id']}},_0x1fc444={};_0x1fc444['model']=_[_0x23c3('0x35')](db[_0x23c3('0x45')][_0x23c3('0x2f')]);_0x5f31ca['attributes']=_['intersection'](_0x1fc444[_0x23c3('0x32')],qs['fields'](_0x3f31e6[_0x23c3('0x34')][_0x23c3('0x38')]));_0x5f31ca[_0x23c3('0x37')]=_0x5f31ca[_0x23c3('0x37')][_0x23c3('0x39')]?_0x5f31ca[_0x23c3('0x37')]:_0x1fc444[_0x23c3('0x32')];if(_0x3f31e6[_0x23c3('0x34')][_0x23c3('0x46')]){_0x5f31ca[_0x23c3('0x47')]=[{'all':!![]}];}_0x5f31ca=_[_0x23c3('0x41')]({},_0x5f31ca,_0x3f31e6['options']);return db[_0x23c3('0x45')][_0x23c3('0x52')](_0x5f31ca)['then'](handleEntityNotFound(_0x479d90,null))[_0x23c3('0x25')](function(_0x440243){if(_0x440243){var _0xdfdd10=_0x440243['get']({'plain':!![]});_0xdfdd10=qs[_0x23c3('0x53')](_0xdfdd10,['id','createdAt',_0x23c3('0x54')]);_0x3f31e6[_0x23c3('0x4c')]=_['omit'](_0x3f31e6[_0x23c3('0x4c')],['id','createdAt',_0x23c3('0x54')]);return db[_0x23c3('0x45')][_0x23c3('0x4b')](_[_0x23c3('0x41')](_0xdfdd10,_0x3f31e6['body']),{'include':_0x3f31e6['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4289b5){var _0x34b3b6=_0x3f31e6[_0x23c3('0x4d')][_0x23c3('0x55')]({'plain':!![]});if(!_0x34b3b6)throw new Error(_0x23c3('0x4e'));if(_0x34b3b6[_0x23c3('0x56')]===_0x23c3('0x4d')){var _0x194627=_0x4289b5[_0x23c3('0x55')]({'plain':!![]});var _0x2a4b5c=_0x23c3('0x26');return db[_0x23c3('0x4f')][_0x23c3('0x52')]({'where':{'name':_0x2a4b5c,'userProfileId':_0x34b3b6[_0x23c3('0x57')]},'raw':!![]})[_0x23c3('0x25')](function(_0x4c5519){if(_0x4c5519&&_0x4c5519[_0x23c3('0x58')]===0x0){return db[_0x23c3('0x27')]['create']({'name':_0x194627['name'],'resourceId':_0x194627['id'],'type':_0x4c5519['name'],'sectionId':_0x4c5519['id']},{})[_0x23c3('0x25')](function(){return _0x4289b5;});}else{return _0x4289b5;}})[_0x23c3('0x49')](function(_0x57a668){logger['error'](_0x23c3('0x50'),_0x57a668);throw _0x57a668;});}return _0x4289b5;});}})[_0x23c3('0x25')](respondWithResult(_0x479d90,0xc9))['catch'](handleError(_0x479d90,null));};exports['update']=function(_0x1dca53,_0x38378c){if(_0x1dca53[_0x23c3('0x4c')]['id']){delete _0x1dca53[_0x23c3('0x4c')]['id'];}return db[_0x23c3('0x45')][_0x23c3('0x52')]({'where':{'id':_0x1dca53[_0x23c3('0x51')]['id']}})[_0x23c3('0x25')](handleEntityNotFound(_0x38378c,null))[_0x23c3('0x25')](saveUpdates(_0x1dca53[_0x23c3('0x4c')],null))['then'](respondWithResult(_0x38378c,null))['catch'](handleError(_0x38378c,null));};exports['destroy']=function(_0x576201,_0xc52e0){return db[_0x23c3('0x45')][_0x23c3('0x52')]({'where':{'id':_0x576201[_0x23c3('0x51')]['id']}})[_0x23c3('0x25')](handleEntityNotFound(_0xc52e0,null))[_0x23c3('0x25')](removeEntity(_0xc52e0,null))[_0x23c3('0x49')](handleError(_0xc52e0,null));};exports['getSessions']=function(_0x1fc2e1,_0x3a6b84,_0x4bccd1){var _0x35bc9e={'raw':!![],'where':{}};var _0x5cddd8={};var _0x3abcbc={'count':0x0,'rows':[]};return db[_0x23c3('0x45')]['findOne']({'where':{'id':_0x1fc2e1[_0x23c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a6b84,null))[_0x23c3('0x25')](function(_0x59d93c){if(_0x59d93c){_0x5cddd8[_0x23c3('0x32')]=_[_0x23c3('0x35')](db['JscriptySessionReport'][_0x23c3('0x2f')]);_0x5cddd8['query']=_[_0x23c3('0x35')](_0x1fc2e1[_0x23c3('0x34')]);_0x5cddd8[_0x23c3('0x3e')]=_[_0x23c3('0x36')](_0x5cddd8[_0x23c3('0x32')],_0x5cddd8[_0x23c3('0x34')]);_0x35bc9e[_0x23c3('0x37')]=_[_0x23c3('0x36')](_0x5cddd8[_0x23c3('0x32')],qs[_0x23c3('0x38')](_0x1fc2e1[_0x23c3('0x34')][_0x23c3('0x38')]));_0x35bc9e['attributes']=_0x35bc9e[_0x23c3('0x37')][_0x23c3('0x39')]?_0x35bc9e[_0x23c3('0x37')]:_0x5cddd8[_0x23c3('0x32')];if(!_0x1fc2e1[_0x23c3('0x34')]['hasOwnProperty'](_0x23c3('0x59'))){_0x35bc9e[_0x23c3('0x1e')]=qs[_0x23c3('0x1e')](_0x1fc2e1[_0x23c3('0x34')][_0x23c3('0x1e')]);_0x35bc9e[_0x23c3('0x20')]=qs[_0x23c3('0x20')](_0x1fc2e1[_0x23c3('0x34')][_0x23c3('0x20')]);}_0x35bc9e[_0x23c3('0x3b')]=qs[_0x23c3('0x3c')](_0x1fc2e1['query']['sort']);_0x35bc9e[_0x23c3('0x3d')]=qs[_0x23c3('0x3e')](_[_0x23c3('0x3f')](_0x1fc2e1['query'],_0x5cddd8[_0x23c3('0x3e')]));_0x35bc9e[_0x23c3('0x3d')]['ProjectId']=_0x59d93c['id'];if(_0x1fc2e1[_0x23c3('0x34')][_0x23c3('0x40')]){_0x35bc9e[_0x23c3('0x3d')]=_[_0x23c3('0x41')](_0x35bc9e[_0x23c3('0x3d')],{'$or':_['map'](_0x35bc9e['attributes'],function(_0x3da3db){var _0x38a152={};_0x38a152[_0x3da3db]={'$like':'%'+_0x1fc2e1[_0x23c3('0x34')][_0x23c3('0x40')]+'%'};return _0x38a152;})});}_0x35bc9e=_['merge']({},_0x35bc9e,_0x1fc2e1['options']);return db['JscriptySessionReport'][_0x23c3('0x1f')]({'where':_0x35bc9e[_0x23c3('0x3d')]})[_0x23c3('0x25')](function(_0x4d43f9){_0x3abcbc[_0x23c3('0x1f')]=_0x4d43f9;if(_0x1fc2e1[_0x23c3('0x34')][_0x23c3('0x46')]){_0x35bc9e[_0x23c3('0x47')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x35bc9e);})[_0x23c3('0x25')](function(_0x5b76c6){_0x3abcbc[_0x23c3('0x48')]=_0x5b76c6;return _0x3abcbc;});}})[_0x23c3('0x25')](respondWithFilteredResult(_0x3a6b84,_0x35bc9e))['catch'](handleError(_0x3a6b84,null));};exports[_0x23c3('0x5a')]=function(_0x217eee,_0x1f39bd,_0x527264){var _0x576e25={'raw':!![],'where':{}};var _0x4675fa={};var _0x2d5ac2={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x23c3('0x5b')]({'where':{'id':_0x217eee['params']['id']}})['then'](handleEntityNotFound(_0x1f39bd,null))['then'](function(_0xf4e753){if(_0xf4e753){_0x4675fa['model']=_[_0x23c3('0x35')](db[_0x23c3('0x5c')][_0x23c3('0x2f')]);_0x4675fa[_0x23c3('0x34')]=_['keys'](_0x217eee[_0x23c3('0x34')]);_0x4675fa[_0x23c3('0x3e')]=_['intersection'](_0x4675fa[_0x23c3('0x32')],_0x4675fa[_0x23c3('0x34')]);_0x576e25[_0x23c3('0x37')]=_[_0x23c3('0x36')](_0x4675fa[_0x23c3('0x32')],qs[_0x23c3('0x38')](_0x217eee[_0x23c3('0x34')][_0x23c3('0x38')]));_0x576e25[_0x23c3('0x37')]=_0x576e25[_0x23c3('0x37')]['length']?_0x576e25[_0x23c3('0x37')]:_0x4675fa[_0x23c3('0x32')];if(!_0x217eee['query']['hasOwnProperty'](_0x23c3('0x59'))){_0x576e25[_0x23c3('0x1e')]=qs['limit'](_0x217eee[_0x23c3('0x34')][_0x23c3('0x1e')]);_0x576e25[_0x23c3('0x20')]=qs[_0x23c3('0x20')](_0x217eee[_0x23c3('0x34')]['offset']);}_0x576e25['order']=qs[_0x23c3('0x3c')](_0x217eee[_0x23c3('0x34')][_0x23c3('0x3c')]);_0x576e25[_0x23c3('0x3d')]=qs[_0x23c3('0x3e')](_['pick'](_0x217eee[_0x23c3('0x34')],_0x4675fa[_0x23c3('0x3e')]));_0x576e25[_0x23c3('0x3d')][_0x23c3('0x5d')]=_0xf4e753['id'];if(_0x217eee[_0x23c3('0x34')]['filter']){_0x576e25[_0x23c3('0x3d')]=_[_0x23c3('0x41')](_0x576e25[_0x23c3('0x3d')],{'$or':_[_0x23c3('0x33')](_0x576e25['attributes'],function(_0xfa697){var _0x18ed6f={};_0x18ed6f[_0xfa697]={'$like':'%'+_0x217eee['query'][_0x23c3('0x40')]+'%'};return _0x18ed6f;})});}_0x576e25=_[_0x23c3('0x41')]({},_0x576e25,_0x217eee['options']);return db[_0x23c3('0x5c')][_0x23c3('0x1f')]({'where':_0x576e25[_0x23c3('0x3d')]})['then'](function(_0x2fa763){_0x2d5ac2['count']=_0x2fa763;if(_0x217eee['query'][_0x23c3('0x46')]){_0x576e25[_0x23c3('0x47')]=[{'all':!![]}];}return db[_0x23c3('0x5c')][_0x23c3('0x5e')](_0x576e25);})[_0x23c3('0x25')](function(_0x3aad3e){_0x2d5ac2[_0x23c3('0x48')]=_0x3aad3e;return _0x2d5ac2;});}})[_0x23c3('0x25')](respondWithFilteredResult(_0x1f39bd,_0x576e25))[_0x23c3('0x49')](handleError(_0x1f39bd,null));};function char(_0x120a73){return _0x23c3('0x5f')===typeof _0x120a73?String['fromCharCode'][_0x23c3('0x60')](null,arguments):_0x120a73;}function needsEncapsulation(_0x504155){return!!_0x504155&&(_0x504155[_0x23c3('0x61')]()[_0x23c3('0x62')](char(0xd))>=0x0||_0x504155[_0x23c3('0x61')]()[_0x23c3('0x62')](char(0xa))>=0x0||_0x504155[_0x23c3('0x61')]()['indexOf'](char(0x2c))>=0x0||_0x504155[_0x23c3('0x61')]()[_0x23c3('0x62')](char(0x22))>=0x0);}function encapsulate(_0x44f4c1){var _0x4c1a87=char(0x22),_0x38f1b2='\x5c'+char(0x22),_0x4c1f06=_0x44f4c1['toString']()['replace'](new RegExp(_0x4c1a87,'g'),_0x38f1b2);return _0x4c1a87+_0x4c1f06+_0x4c1a87;}exports[_0x23c3('0x63')]=function(_0x2c81a3,_0x3b6493,_0x3cb8a6){var _0x1677ec,_0x52c519;var _0x179b69={'where':{'ProjectId':_0x2c81a3[_0x23c3('0x51')]['id']}};if(_0x2c81a3[_0x23c3('0x34')][_0x23c3('0x64')]){_0x179b69[_0x23c3('0x3d')][_0x23c3('0x65')]=JSON[_0x23c3('0x66')](_0x2c81a3[_0x23c3('0x34')]['startTime']);}return db[_0x23c3('0x67')][_0x23c3('0x5e')](_0x179b69)[_0x23c3('0x25')](handleEntityNotFound(_0x3b6493,null))[_0x23c3('0x25')](function(_0x1b900b){if(_0x1b900b){_0x1677ec=_0x1b900b;return db[_0x23c3('0x68')][_0x23c3('0x5e')]({'where':{'SessionId':{'$in':_['map'](_0x1677ec,'id')},'ProjectId':_0x2c81a3[_0x23c3('0x51')]['id']},'order':_0x23c3('0x69')});}})[_0x23c3('0x25')](handleEntityNotFound(_0x3b6493,null))[_0x23c3('0x25')](function(_0x4fed40){if(_0x4fed40){_0x52c519=_0x4fed40;var _0x2e4a7c={};for(var _0x4483f8=0x0,_0x4b572d=_0x52c519[_0x23c3('0x39')];_0x4483f8<_0x4b572d;_0x4483f8++){if(!_0x2e4a7c['hasOwnProperty'](_0x52c519[_0x4483f8][_0x23c3('0x6a')])){_0x2e4a7c[_0x52c519[_0x4483f8]['questionId']]=needsEncapsulation(_0x52c519[_0x4483f8][_0x23c3('0x6b')])?encapsulate(_0x52c519[_0x4483f8]['question']):_0x52c519[_0x4483f8][_0x23c3('0x6b')];}}var _0x2d62ac=[],_0x5c23f1={};for(var _0x10db90=0x0,_0x21d9f0=_0x1677ec[_0x23c3('0x39')];_0x10db90<_0x21d9f0;_0x10db90++){_0x5c23f1={'ProjectId':_0x2c81a3[_0x23c3('0x51')]['id'],'SessionId':_0x1677ec[_0x10db90]['id'],'StartTime':moment(_0x1677ec[_0x10db90]['starttime'])['format'](_0x23c3('0x6c'))};for(var _0x53ba12=0x0,_0x5d1108=_0x52c519['length'];_0x53ba12<_0x5d1108;_0x53ba12++){if(_0x52c519[_0x53ba12][_0x23c3('0x6d')]==_0x1677ec[_0x10db90]['id']&&_0x2e4a7c[_0x23c3('0x3a')](_0x52c519[_0x53ba12][_0x23c3('0x6a')])){_0x5c23f1[_0x2e4a7c[_0x52c519[_0x53ba12][_0x23c3('0x6a')]]]=_0x52c519[_0x53ba12][_0x23c3('0x6e')];}}for(var _0x525fa6 in _0x2e4a7c){if(!_0x5c23f1[_0x23c3('0x3a')](_0x2e4a7c[_0x525fa6])){_0x5c23f1[_0x2e4a7c[_0x525fa6]]=null;}}_0x2d62ac[_0x23c3('0x6f')](_0x5c23f1);}return _0x2d62ac;}})[_0x23c3('0x25')](function(_0x526929){if(!_['isEmpty'](_0x526929)){var _0x56fef5=toCsv(_0x526929);var _0x386eb9=Date[_0x23c3('0x70')]();fs[_0x23c3('0x71')](util[_0x23c3('0x72')](_0x23c3('0x73'),_0x2c81a3[_0x23c3('0x51')]['id'],_0x386eb9),_0x56fef5);_0x3b6493['setHeader']('Content-disposition','attachment;\x20filename='+util['format'](_0x23c3('0x74'),_0x2c81a3[_0x23c3('0x51')]['id'],_0x386eb9));_0x3b6493[_0x23c3('0x75')](_0x23c3('0x76'),'text/csv');return _0x3b6493[_0x23c3('0x77')](util['format'](_0x23c3('0x73'),_0x2c81a3[_0x23c3('0x51')]['id'],_0x386eb9));}else{return _0x3b6493[_0x23c3('0x1a')](0xcc);}})['catch'](handleError(_0x3b6493,null));}; \ No newline at end of file +var _0xdabc=['indexOf','toString','replace','getSummary','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','status','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','JscriptyProject','rows','params','intersection','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','role','getSessions','JscriptySessionReport','order','ProjectId','getAnswers','findOne','JscriptyAnswerReport','findAll','number','fromCharCode'];(function(_0x43884a,_0x154135){var _0x55c82a=function(_0x44428f){while(--_0x44428f){_0x43884a['push'](_0x43884a['shift']());}};_0x55c82a(++_0x154135);}(_0xdabc,0x16b));var _0xcdab=function(_0x5e4a61,_0x403c59){_0x5e4a61=_0x5e4a61-0x0;var _0x1374aa=_0xdabc[_0x5e4a61];return _0x1374aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdab('0x0'));var zipdir=require(_0xcdab('0x1'));var jsonpatch=require(_0xcdab('0x2'));var rp=require('request-promise');var moment=require(_0xcdab('0x3'));var BPromise=require(_0xcdab('0x4'));var Mustache=require(_0xcdab('0x5'));var util=require(_0xcdab('0x6'));var path=require(_0xcdab('0x7'));var sox=require(_0xcdab('0x8'));var csv=require(_0xcdab('0x9'));var ejs=require(_0xcdab('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdab('0xb'));var squel=require(_0xcdab('0xc'));var crypto=require(_0xcdab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcdab('0xe'));var toCsv=require(_0xcdab('0x9'));var querystring=require(_0xcdab('0xf'));var Papa=require('papaparse');var Redis=require(_0xcdab('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcdab('0x11'));var as=require(_0xcdab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdab('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcdab('0x14'))['db'];function respondWithStatusCode(_0x414b10,_0xd7644a){_0xd7644a=_0xd7644a||0xcc;return function(_0xc6048d){if(_0xc6048d){return _0x414b10[_0xcdab('0x15')](_0xd7644a);}return _0x414b10['status'](_0xd7644a)['end']();};}function respondWithResult(_0x39a5ae,_0x30a596){_0x30a596=_0x30a596||0xc8;return function(_0x516186){if(_0x516186){return _0x39a5ae['status'](_0x30a596)['json'](_0x516186);}};}function respondWithFilteredResult(_0x22fa04,_0x31ba87){return function(_0x29c14c){if(_0x29c14c){var _0x12ea56=typeof _0x31ba87[_0xcdab('0x16')]===_0xcdab('0x17')&&typeof _0x31ba87['limit']==='undefined';var _0x2c099d=_0x29c14c[_0xcdab('0x18')];var _0x5e21e6=_0x12ea56?0x0:_0x31ba87[_0xcdab('0x16')];var _0xd529a=_0x12ea56?_0x29c14c['count']:_0x31ba87['offset']+_0x31ba87[_0xcdab('0x19')];var _0x536d2d;if(_0xd529a>=_0x2c099d){_0xd529a=_0x2c099d;_0x536d2d=0xc8;}else{_0x536d2d=0xce;}_0x22fa04['status'](_0x536d2d);return _0x22fa04[_0xcdab('0x1a')](_0xcdab('0x1b'),_0x5e21e6+'-'+_0xd529a+'/'+_0x2c099d)[_0xcdab('0x1c')](_0x29c14c);}return null;};}function patchUpdates(_0x43dd38){return function(_0x3479ee){try{jsonpatch['apply'](_0x3479ee,_0x43dd38,!![]);}catch(_0x32d72f){return BPromise[_0xcdab('0x1d')](_0x32d72f);}return _0x3479ee[_0xcdab('0x1e')]();};}function saveUpdates(_0x1b4126,_0x3c2d36){return function(_0x547832){if(_0x547832){return _0x547832[_0xcdab('0x1f')](_0x1b4126)[_0xcdab('0x20')](function(_0x2b9556){return _0x2b9556;});}return null;};}function removeEntity(_0x3999f0,_0x2abb32){return function(_0x3bb70a){if(_0x3bb70a){return _0x3bb70a[_0xcdab('0x21')]()[_0xcdab('0x20')](function(){var _0x3cb8bf=_0x3bb70a[_0xcdab('0x22')]({'plain':!![]});var _0x5dc824=_0xcdab('0x23');return db['UserProfileResource'][_0xcdab('0x21')]({'where':{'type':_0x5dc824,'resourceId':_0x3cb8bf['id']}})[_0xcdab('0x20')](function(){return _0x3bb70a;});})[_0xcdab('0x20')](function(){_0x3999f0[_0xcdab('0x24')](0xcc)[_0xcdab('0x25')]();});}};}function handleEntityNotFound(_0x5ca8c7,_0x3061ac){return function(_0x1b280d){if(!_0x1b280d){_0x5ca8c7[_0xcdab('0x15')](0x194);}return _0x1b280d;};}function handleError(_0x17efdb,_0x4e902c){_0x4e902c=_0x4e902c||0x1f4;return function(_0x1bd3c5){logger[_0xcdab('0x26')](_0x1bd3c5[_0xcdab('0x27')]);if(_0x1bd3c5[_0xcdab('0x28')]){delete _0x1bd3c5[_0xcdab('0x28')];}_0x17efdb[_0xcdab('0x24')](_0x4e902c)[_0xcdab('0x29')](_0x1bd3c5);};}exports['index']=function(_0x47441e,_0x401766){var _0x387846={},_0x278683={},_0x41aae1={'count':0x0,'rows':[]};var _0x4f258d=_[_0xcdab('0x2a')](db['JscriptyProject'][_0xcdab('0x2b')],function(_0x46b4b6){return{'name':_0x46b4b6[_0xcdab('0x2c')],'type':_0x46b4b6['type'][_0xcdab('0x2d')]};});_0x278683['model']=_[_0xcdab('0x2a')](_0x4f258d,_0xcdab('0x28'));_0x278683[_0xcdab('0x2e')]=_[_0xcdab('0x2f')](_0x47441e[_0xcdab('0x2e')]);_0x278683[_0xcdab('0x30')]=_['intersection'](_0x278683[_0xcdab('0x31')],_0x278683[_0xcdab('0x2e')]);_0x387846[_0xcdab('0x32')]=_['intersection'](_0x278683['model'],qs[_0xcdab('0x33')](_0x47441e[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x387846[_0xcdab('0x32')]=_0x387846['attributes'][_0xcdab('0x34')]?_0x387846[_0xcdab('0x32')]:_0x278683[_0xcdab('0x31')];if(!_0x47441e[_0xcdab('0x2e')][_0xcdab('0x35')](_0xcdab('0x36'))){_0x387846['limit']=qs['limit'](_0x47441e[_0xcdab('0x2e')]['limit']);_0x387846[_0xcdab('0x16')]=qs[_0xcdab('0x16')](_0x47441e[_0xcdab('0x2e')]['offset']);}_0x387846['order']=qs[_0xcdab('0x37')](_0x47441e[_0xcdab('0x2e')][_0xcdab('0x37')]);_0x387846[_0xcdab('0x38')]=qs[_0xcdab('0x30')](_[_0xcdab('0x39')](_0x47441e[_0xcdab('0x2e')],_0x278683[_0xcdab('0x30')]),_0x4f258d);if(_0x47441e['query'][_0xcdab('0x3a')]){_0x387846[_0xcdab('0x38')]=_[_0xcdab('0x3b')](_0x387846[_0xcdab('0x38')],{'$or':_['map'](_0x4f258d,function(_0x41b425){if(_0x41b425['type']!=='VIRTUAL'){var _0x1c644a={};_0x1c644a[_0x41b425[_0xcdab('0x28')]]={'$like':'%'+_0x47441e[_0xcdab('0x2e')]['filter']+'%'};return _0x1c644a;}})});}_0x387846=_[_0xcdab('0x3b')]({},_0x387846,_0x47441e[_0xcdab('0x3c')]);var _0x18afa1={'where':_0x387846[_0xcdab('0x38')]};return db['JscriptyProject'][_0xcdab('0x18')](_0x18afa1)['then'](function(_0x22b710){_0x41aae1[_0xcdab('0x18')]=_0x22b710;if(_0x47441e[_0xcdab('0x2e')]['includeAll']){_0x387846['include']=[{'all':!![]}];}return db[_0xcdab('0x3d')]['findAll'](_0x387846);})[_0xcdab('0x20')](function(_0x21b678){_0x41aae1[_0xcdab('0x3e')]=_0x21b678;return _0x41aae1;})[_0xcdab('0x20')](respondWithFilteredResult(_0x401766,_0x387846))['catch'](handleError(_0x401766,null));};exports['show']=function(_0x286867,_0x2fc565){var _0x432092={'raw':![],'where':{'id':_0x286867[_0xcdab('0x3f')]['id']}},_0x10d0bd={};_0x10d0bd[_0xcdab('0x31')]=_['keys'](db[_0xcdab('0x3d')][_0xcdab('0x2b')]);_0x10d0bd[_0xcdab('0x2e')]=_[_0xcdab('0x2f')](_0x286867[_0xcdab('0x2e')]);_0x10d0bd[_0xcdab('0x30')]=_[_0xcdab('0x40')](_0x10d0bd[_0xcdab('0x31')],_0x10d0bd[_0xcdab('0x2e')]);_0x432092['attributes']=_[_0xcdab('0x40')](_0x10d0bd[_0xcdab('0x31')],qs['fields'](_0x286867[_0xcdab('0x2e')]['fields']));_0x432092[_0xcdab('0x32')]=_0x432092[_0xcdab('0x32')][_0xcdab('0x34')]?_0x432092[_0xcdab('0x32')]:_0x10d0bd['model'];if(_0x286867[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x432092[_0xcdab('0x42')]=[{'all':!![]}];}_0x432092=_['merge']({},_0x432092,_0x286867[_0xcdab('0x3c')]);return db[_0xcdab('0x3d')][_0xcdab('0x43')](_0x432092)[_0xcdab('0x20')](handleEntityNotFound(_0x2fc565,null))['then'](respondWithResult(_0x2fc565,null))[_0xcdab('0x44')](handleError(_0x2fc565,null));};exports[_0xcdab('0x45')]=function(_0x55032c,_0x303a25){return db[_0xcdab('0x3d')]['create'](_0x55032c[_0xcdab('0x46')],{})['then'](function(_0x88b8db){var _0x53eb2b=_0x55032c[_0xcdab('0x47')]['get']({'plain':!![]});if(!_0x53eb2b)throw new Error(_0xcdab('0x48'));if(_0x53eb2b['role']===_0xcdab('0x47')){var _0x56d737=_0x88b8db['get']({'plain':!![]});var _0x197bb0=_0xcdab('0x23');return db[_0xcdab('0x49')][_0xcdab('0x43')]({'where':{'name':_0x197bb0,'userProfileId':_0x53eb2b[_0xcdab('0x4a')]},'raw':!![]})[_0xcdab('0x20')](function(_0x358c65){if(_0x358c65&&_0x358c65[_0xcdab('0x4b')]===0x0){return db[_0xcdab('0x4c')][_0xcdab('0x45')]({'name':_0x56d737[_0xcdab('0x28')],'resourceId':_0x56d737['id'],'type':_0x358c65[_0xcdab('0x28')],'sectionId':_0x358c65['id']},{})['then'](function(){return _0x88b8db;});}else{return _0x88b8db;}})[_0xcdab('0x44')](function(_0x533574){logger[_0xcdab('0x26')](_0xcdab('0x4d'),_0x533574);throw _0x533574;});}return _0x88b8db;})[_0xcdab('0x20')](respondWithResult(_0x303a25,0xc9))[_0xcdab('0x44')](handleError(_0x303a25,null));};exports[_0xcdab('0x4e')]=function(_0x23a013,_0x5c29a7){var _0x41c1a2={'where':{'id':_0x23a013['params']['id']}},_0x18aa2a={};_0x18aa2a['model']=_[_0xcdab('0x2f')](db[_0xcdab('0x3d')][_0xcdab('0x2b')]);_0x41c1a2['attributes']=_[_0xcdab('0x40')](_0x18aa2a[_0xcdab('0x31')],qs['fields'](_0x23a013[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x41c1a2[_0xcdab('0x32')]=_0x41c1a2[_0xcdab('0x32')][_0xcdab('0x34')]?_0x41c1a2[_0xcdab('0x32')]:_0x18aa2a[_0xcdab('0x31')];if(_0x23a013[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x41c1a2['include']=[{'all':!![]}];}_0x41c1a2=_[_0xcdab('0x3b')]({},_0x41c1a2,_0x23a013[_0xcdab('0x3c')]);return db[_0xcdab('0x3d')][_0xcdab('0x43')](_0x41c1a2)[_0xcdab('0x20')](handleEntityNotFound(_0x5c29a7,null))[_0xcdab('0x20')](function(_0x8dc584){if(_0x8dc584){var _0x4d2dc1=_0x8dc584[_0xcdab('0x22')]({'plain':!![]});_0x4d2dc1=qs['omit'](_0x4d2dc1,['id',_0xcdab('0x4f'),'updatedAt']);_0x23a013[_0xcdab('0x46')]=_[_0xcdab('0x50')](_0x23a013['body'],['id','createdAt',_0xcdab('0x51')]);return db[_0xcdab('0x3d')][_0xcdab('0x45')](_[_0xcdab('0x3b')](_0x4d2dc1,_0x23a013[_0xcdab('0x46')]),{'include':_0x23a013[_0xcdab('0x2e')][_0xcdab('0x41')]?[{'all':!![]}]:undefined})[_0xcdab('0x20')](function(_0x23e685){var _0x31f288=_0x23a013[_0xcdab('0x47')][_0xcdab('0x22')]({'plain':!![]});if(!_0x31f288)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31f288[_0xcdab('0x52')]===_0xcdab('0x47')){var _0x4f08b0=_0x23e685[_0xcdab('0x22')]({'plain':!![]});var _0x423a88=_0xcdab('0x23');return db[_0xcdab('0x49')][_0xcdab('0x43')]({'where':{'name':_0x423a88,'userProfileId':_0x31f288['userProfileId']},'raw':!![]})['then'](function(_0x1e9cd9){if(_0x1e9cd9&&_0x1e9cd9[_0xcdab('0x4b')]===0x0){return db[_0xcdab('0x4c')][_0xcdab('0x45')]({'name':_0x4f08b0[_0xcdab('0x28')],'resourceId':_0x4f08b0['id'],'type':_0x1e9cd9[_0xcdab('0x28')],'sectionId':_0x1e9cd9['id']},{})[_0xcdab('0x20')](function(){return _0x23e685;});}else{return _0x23e685;}})[_0xcdab('0x44')](function(_0xaa4065){logger[_0xcdab('0x26')](_0xcdab('0x4d'),_0xaa4065);throw _0xaa4065;});}return _0x23e685;});}})[_0xcdab('0x20')](respondWithResult(_0x5c29a7,0xc9))['catch'](handleError(_0x5c29a7,null));};exports[_0xcdab('0x1f')]=function(_0x40fb8e,_0x1a08bf){if(_0x40fb8e[_0xcdab('0x46')]['id']){delete _0x40fb8e[_0xcdab('0x46')]['id'];}return db[_0xcdab('0x3d')]['find']({'where':{'id':_0x40fb8e[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x1a08bf,null))[_0xcdab('0x20')](saveUpdates(_0x40fb8e['body'],null))[_0xcdab('0x20')](respondWithResult(_0x1a08bf,null))[_0xcdab('0x44')](handleError(_0x1a08bf,null));};exports[_0xcdab('0x21')]=function(_0x4af13f,_0x55ee0b){return db[_0xcdab('0x3d')]['find']({'where':{'id':_0x4af13f[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x55ee0b,null))[_0xcdab('0x20')](removeEntity(_0x55ee0b,null))[_0xcdab('0x44')](handleError(_0x55ee0b,null));};exports[_0xcdab('0x53')]=function(_0x18b3ba,_0x567e90,_0x1ae695){var _0x4a9bac={'raw':!![],'where':{}};var _0x1a362d={};var _0x5d0a1d={'count':0x0,'rows':[]};return db[_0xcdab('0x3d')]['findOne']({'where':{'id':_0x18b3ba[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x567e90,null))[_0xcdab('0x20')](function(_0x13eacf){if(_0x13eacf){_0x1a362d['model']=_[_0xcdab('0x2f')](db[_0xcdab('0x54')][_0xcdab('0x2b')]);_0x1a362d[_0xcdab('0x2e')]=_[_0xcdab('0x2f')](_0x18b3ba[_0xcdab('0x2e')]);_0x1a362d[_0xcdab('0x30')]=_['intersection'](_0x1a362d[_0xcdab('0x31')],_0x1a362d[_0xcdab('0x2e')]);_0x4a9bac[_0xcdab('0x32')]=_[_0xcdab('0x40')](_0x1a362d[_0xcdab('0x31')],qs['fields'](_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x4a9bac[_0xcdab('0x32')]=_0x4a9bac[_0xcdab('0x32')]['length']?_0x4a9bac[_0xcdab('0x32')]:_0x1a362d[_0xcdab('0x31')];if(!_0x18b3ba[_0xcdab('0x2e')]['hasOwnProperty'](_0xcdab('0x36'))){_0x4a9bac[_0xcdab('0x19')]=qs['limit'](_0x18b3ba['query']['limit']);_0x4a9bac['offset']=qs[_0xcdab('0x16')](_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x16')]);}_0x4a9bac[_0xcdab('0x55')]=qs[_0xcdab('0x37')](_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x37')]);_0x4a9bac[_0xcdab('0x38')]=qs[_0xcdab('0x30')](_['pick'](_0x18b3ba[_0xcdab('0x2e')],_0x1a362d[_0xcdab('0x30')]));_0x4a9bac[_0xcdab('0x38')][_0xcdab('0x56')]=_0x13eacf['id'];if(_0x18b3ba[_0xcdab('0x2e')]['filter']){_0x4a9bac[_0xcdab('0x38')]=_['merge'](_0x4a9bac[_0xcdab('0x38')],{'$or':_['map'](_0x4a9bac[_0xcdab('0x32')],function(_0x4cccec){var _0x44f5ed={};_0x44f5ed[_0x4cccec]={'$like':'%'+_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x3a')]+'%'};return _0x44f5ed;})});}_0x4a9bac=_[_0xcdab('0x3b')]({},_0x4a9bac,_0x18b3ba[_0xcdab('0x3c')]);return db['JscriptySessionReport']['count']({'where':_0x4a9bac['where']})['then'](function(_0x3a199d){_0x5d0a1d[_0xcdab('0x18')]=_0x3a199d;if(_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x4a9bac[_0xcdab('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4a9bac);})[_0xcdab('0x20')](function(_0x204273){_0x5d0a1d[_0xcdab('0x3e')]=_0x204273;return _0x5d0a1d;});}})[_0xcdab('0x20')](respondWithFilteredResult(_0x567e90,_0x4a9bac))[_0xcdab('0x44')](handleError(_0x567e90,null));};exports[_0xcdab('0x57')]=function(_0x1df5df,_0x1feac9,_0x45229d){var _0x5dd1ab={'raw':!![],'where':{}};var _0x49fd95={};var _0x2dfb9d={'count':0x0,'rows':[]};return db[_0xcdab('0x3d')][_0xcdab('0x58')]({'where':{'id':_0x1df5df[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x1feac9,null))[_0xcdab('0x20')](function(_0x512bb9){if(_0x512bb9){_0x49fd95[_0xcdab('0x31')]=_['keys'](db['JscriptyAnswerReport'][_0xcdab('0x2b')]);_0x49fd95[_0xcdab('0x2e')]=_['keys'](_0x1df5df['query']);_0x49fd95[_0xcdab('0x30')]=_[_0xcdab('0x40')](_0x49fd95[_0xcdab('0x31')],_0x49fd95[_0xcdab('0x2e')]);_0x5dd1ab[_0xcdab('0x32')]=_['intersection'](_0x49fd95[_0xcdab('0x31')],qs[_0xcdab('0x33')](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x5dd1ab[_0xcdab('0x32')]=_0x5dd1ab[_0xcdab('0x32')][_0xcdab('0x34')]?_0x5dd1ab[_0xcdab('0x32')]:_0x49fd95[_0xcdab('0x31')];if(!_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x35')]('nolimit')){_0x5dd1ab['limit']=qs[_0xcdab('0x19')](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x19')]);_0x5dd1ab[_0xcdab('0x16')]=qs['offset'](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x16')]);}_0x5dd1ab['order']=qs[_0xcdab('0x37')](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x37')]);_0x5dd1ab[_0xcdab('0x38')]=qs[_0xcdab('0x30')](_[_0xcdab('0x39')](_0x1df5df[_0xcdab('0x2e')],_0x49fd95['filters']));_0x5dd1ab[_0xcdab('0x38')][_0xcdab('0x56')]=_0x512bb9['id'];if(_0x1df5df['query'][_0xcdab('0x3a')]){_0x5dd1ab[_0xcdab('0x38')]=_['merge'](_0x5dd1ab[_0xcdab('0x38')],{'$or':_[_0xcdab('0x2a')](_0x5dd1ab['attributes'],function(_0x339d98){var _0x4c0d53={};_0x4c0d53[_0x339d98]={'$like':'%'+_0x1df5df['query'][_0xcdab('0x3a')]+'%'};return _0x4c0d53;})});}_0x5dd1ab=_[_0xcdab('0x3b')]({},_0x5dd1ab,_0x1df5df[_0xcdab('0x3c')]);return db['JscriptyAnswerReport'][_0xcdab('0x18')]({'where':_0x5dd1ab[_0xcdab('0x38')]})['then'](function(_0x571405){_0x2dfb9d[_0xcdab('0x18')]=_0x571405;if(_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x5dd1ab[_0xcdab('0x42')]=[{'all':!![]}];}return db[_0xcdab('0x59')][_0xcdab('0x5a')](_0x5dd1ab);})[_0xcdab('0x20')](function(_0x4791c3){_0x2dfb9d[_0xcdab('0x3e')]=_0x4791c3;return _0x2dfb9d;});}})['then'](respondWithFilteredResult(_0x1feac9,_0x5dd1ab))[_0xcdab('0x44')](handleError(_0x1feac9,null));};function char(_0x128259){return _0xcdab('0x5b')===typeof _0x128259?String[_0xcdab('0x5c')]['apply'](null,arguments):_0x128259;}function needsEncapsulation(_0x5f5b4d){return!!_0x5f5b4d&&(_0x5f5b4d['toString']()[_0xcdab('0x5d')](char(0xd))>=0x0||_0x5f5b4d['toString']()[_0xcdab('0x5d')](char(0xa))>=0x0||_0x5f5b4d[_0xcdab('0x5e')]()[_0xcdab('0x5d')](char(0x2c))>=0x0||_0x5f5b4d[_0xcdab('0x5e')]()[_0xcdab('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x5c8b30){var _0x3fa63a=char(0x22),_0x52b6d9='\x5c'+char(0x22),_0x2005cd=_0x5c8b30['toString']()[_0xcdab('0x5f')](new RegExp(_0x3fa63a,'g'),_0x52b6d9);return _0x3fa63a+_0x2005cd+_0x3fa63a;}exports[_0xcdab('0x60')]=function(_0x566b8b,_0x48ab55,_0x406e43){var _0x4b9e2b,_0x1b5fdd;var _0x5c7cfc={'where':{'ProjectId':_0x566b8b[_0xcdab('0x3f')]['id']}};if(_0x566b8b[_0xcdab('0x2e')]['startTime']){_0x5c7cfc[_0xcdab('0x38')]['starttime']=JSON[_0xcdab('0x61')](_0x566b8b[_0xcdab('0x2e')]['startTime']);}return db['JscriptySessionReport'][_0xcdab('0x5a')](_0x5c7cfc)['then'](handleEntityNotFound(_0x48ab55,null))['then'](function(_0x25a546){if(_0x25a546){_0x4b9e2b=_0x25a546;return db[_0xcdab('0x62')][_0xcdab('0x5a')]({'where':{'SessionId':{'$in':_[_0xcdab('0x2a')](_0x4b9e2b,'id')},'ProjectId':_0x566b8b['params']['id']},'order':_0xcdab('0x63')});}})['then'](handleEntityNotFound(_0x48ab55,null))['then'](function(_0x3bddf7){if(_0x3bddf7){_0x1b5fdd=_0x3bddf7;var _0x1b83be={};for(var _0x2aad99=0x0,_0x182fd5=_0x1b5fdd[_0xcdab('0x34')];_0x2aad99<_0x182fd5;_0x2aad99++){if(!_0x1b83be[_0xcdab('0x35')](_0x1b5fdd[_0x2aad99][_0xcdab('0x64')])){_0x1b83be[_0x1b5fdd[_0x2aad99][_0xcdab('0x64')]]=needsEncapsulation(_0x1b5fdd[_0x2aad99][_0xcdab('0x65')])?encapsulate(_0x1b5fdd[_0x2aad99][_0xcdab('0x65')]):_0x1b5fdd[_0x2aad99][_0xcdab('0x65')];}}var _0x3cbea1=[],_0x244cf3={};for(var _0x1556c1=0x0,_0x462ae8=_0x4b9e2b[_0xcdab('0x34')];_0x1556c1<_0x462ae8;_0x1556c1++){_0x244cf3={'ProjectId':_0x566b8b[_0xcdab('0x3f')]['id'],'SessionId':_0x4b9e2b[_0x1556c1]['id'],'StartTime':moment(_0x4b9e2b[_0x1556c1][_0xcdab('0x66')])[_0xcdab('0x67')](_0xcdab('0x68'))};for(var _0x503098=0x0,_0x332448=_0x1b5fdd['length'];_0x503098<_0x332448;_0x503098++){if(_0x1b5fdd[_0x503098][_0xcdab('0x69')]==_0x4b9e2b[_0x1556c1]['id']&&_0x1b83be['hasOwnProperty'](_0x1b5fdd[_0x503098]['questionId'])){_0x244cf3[_0x1b83be[_0x1b5fdd[_0x503098][_0xcdab('0x64')]]]=_0x1b5fdd[_0x503098][_0xcdab('0x6a')];}}for(var _0x529caa in _0x1b83be){if(!_0x244cf3[_0xcdab('0x35')](_0x1b83be[_0x529caa])){_0x244cf3[_0x1b83be[_0x529caa]]=null;}}_0x3cbea1[_0xcdab('0x6b')](_0x244cf3);}return _0x3cbea1;}})[_0xcdab('0x20')](function(_0x1789b9){if(!_[_0xcdab('0x6c')](_0x1789b9)){var _0x20e4d9=toCsv(_0x1789b9);var _0x1ebc4f=Date['now']();fs['writeFileSync'](util[_0xcdab('0x67')](_0xcdab('0x6d'),_0x566b8b['params']['id'],_0x1ebc4f),_0x20e4d9);_0x48ab55[_0xcdab('0x6e')](_0xcdab('0x6f'),'attachment;\x20filename='+util[_0xcdab('0x67')](_0xcdab('0x70'),_0x566b8b[_0xcdab('0x3f')]['id'],_0x1ebc4f));_0x48ab55['setHeader'](_0xcdab('0x71'),'text/csv');return _0x48ab55['download'](util[_0xcdab('0x67')](_0xcdab('0x6d'),_0x566b8b[_0xcdab('0x3f')]['id'],_0x1ebc4f));}else{return _0x48ab55[_0xcdab('0x15')](0xcc);}})[_0xcdab('0x44')](handleError(_0x48ab55,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7932e2b..e5ef0f5 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 _0xbe22=['../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x105d2e,_0xefc0f9){var _0x44969d=function(_0x2fca67){while(--_0x2fca67){_0x105d2e['push'](_0x105d2e['shift']());}};_0x44969d(++_0xefc0f9);}(_0xbe22,0x1c1));var _0x2be2=function(_0x1c80d3,_0x4e00ab){_0x1c80d3=_0x1c80d3-0x0;var _0x3d4ad8=_0xbe22[_0x1c80d3];return _0x3d4ad8;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2be2('0x2'));var BPromise=require(_0x2be2('0x3'));var rp=require(_0x2be2('0x4'));var fs=require('fs');var path=require(_0x2be2('0x5'));var rimraf=require(_0x2be2('0x6'));var config=require(_0x2be2('0x7'));var attributes=require(_0x2be2('0x8'));module[_0x2be2('0x9')]=function(_0x1b3bde,_0x3a4d77){return _0x1b3bde['define'](_0x2be2('0xa'),attributes,{'tableName':_0x2be2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a08=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util'];(function(_0x13e09b,_0x49cfe0){var _0x44c0d7=function(_0x50283b){while(--_0x50283b){_0x13e09b['push'](_0x13e09b['shift']());}};_0x44c0d7(++_0x49cfe0);}(_0x7a08,0x11e));var _0x87a0=function(_0x361bb4,_0x411189){_0x361bb4=_0x361bb4-0x0;var _0x3e88c3=_0x7a08[_0x361bb4];return _0x3e88c3;};'use strict';var _=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x87a0('0x2'));var BPromise=require(_0x87a0('0x3'));var rp=require(_0x87a0('0x4'));var fs=require('fs');var path=require(_0x87a0('0x5'));var rimraf=require(_0x87a0('0x6'));var config=require(_0x87a0('0x7'));var attributes=require(_0x87a0('0x8'));module[_0x87a0('0x9')]=function(_0x1b384a,_0xf9199b){return _0x1b384a[_0x87a0('0xa')]('JscriptyProject',attributes,{'tableName':_0x87a0('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 38c0214..c2a1e55 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x37cbbc,_0x1ac641){var _0x263bc2=function(_0x300089){while(--_0x300089){_0x37cbbc['push'](_0x37cbbc['shift']());}};_0x263bc2(++_0x1ac641);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xac4a,0x13f));var _0xaac4=function(_0x132711,_0x542f4f){_0x132711=_0x132711-0x0;var _0x306eff=_0xac4a[_0x132711];return _0x306eff;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index dcf2fcc..451e7fe 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 _0x7c73=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path'];(function(_0x35565a,_0x14263d){var _0x16dd84=function(_0x4b4da6){while(--_0x4b4da6){_0x35565a['push'](_0x35565a['shift']());}};_0x16dd84(++_0x14263d);}(_0x7c73,0x165));var _0x37c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c73[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x37c7('0x0'));var util=require(_0x37c7('0x1'));var path=require(_0x37c7('0x2'));var timeout=require(_0x37c7('0x3'));var express=require(_0x37c7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x37c7('0x5'));var interaction=require(_0x37c7('0x6'));var config=require(_0x37c7('0x7'));var controller=require(_0x37c7('0x8'));router[_0x37c7('0x9')]('/',auth[_0x37c7('0xa')](),controller['index']);router[_0x37c7('0x9')](_0x37c7('0xb'),auth[_0x37c7('0xa')](),controller[_0x37c7('0xc')]);router[_0x37c7('0x9')](_0x37c7('0xd'),auth['isAuthenticated'](),controller[_0x37c7('0xe')]);router[_0x37c7('0xf')]('/',auth[_0x37c7('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x37c7('0x10')]);router[_0x37c7('0x11')]('/:id',auth[_0x37c7('0xa')](),controller[_0x37c7('0x12')]);module[_0x37c7('0x13')]=router; \ No newline at end of file +var _0x4155=['../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x4155,0xd6));var _0x5415=function(_0x4d8b33,_0x5af873){_0x4d8b33=_0x4d8b33-0x0;var _0x1f2f3a=_0x4155[_0x4d8b33];return _0x1f2f3a;};'use strict';var multer=require(_0x5415('0x0'));var util=require(_0x5415('0x1'));var path=require(_0x5415('0x2'));var timeout=require(_0x5415('0x3'));var express=require('express');var router=express[_0x5415('0x4')]();var fs_extra=require(_0x5415('0x5'));var auth=require(_0x5415('0x6'));var interaction=require(_0x5415('0x7'));var config=require('../../config/environment');var controller=require(_0x5415('0x8'));router[_0x5415('0x9')]('/',auth[_0x5415('0xa')](),controller[_0x5415('0xb')]);router['get'](_0x5415('0xc'),auth[_0x5415('0xa')](),controller[_0x5415('0xd')]);router[_0x5415('0x9')]('/:id',auth[_0x5415('0xa')](),controller[_0x5415('0xe')]);router[_0x5415('0xf')]('/',auth[_0x5415('0xa')](),controller[_0x5415('0x10')]);router['put'](_0x5415('0x11'),auth[_0x5415('0xa')](),controller[_0x5415('0x12')]);router[_0x5415('0x13')](_0x5415('0x11'),auth[_0x5415('0xa')](),controller[_0x5415('0x14')]);module[_0x5415('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 3d36034..fc7beb9 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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0xb41fba,_0x1892f5){_0xb41fba=_0xb41fba-0x0;var _0x254098=_0x7a54[_0xb41fba];return _0x254098;};'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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x410841,_0x41ab52){_0x410841=_0x410841-0x0;var _0x4548a6=_0x7a54[_0x410841];return _0x4548a6;};'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 576dbec..2a87173 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 _0xe759=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys','filters','attributes'];(function(_0x4257cf,_0x3cd364){var _0x5394a3=function(_0x3ae4da){while(--_0x3ae4da){_0x4257cf['push'](_0x4257cf['shift']());}};_0x5394a3(++_0x3cd364);}(_0xe759,0xa8));var _0x9e75=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe759[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x9e75('0x0'));var rimraf=require(_0x9e75('0x1'));var zipdir=require(_0x9e75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e75('0x3'));var moment=require(_0x9e75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e75('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9e75('0x6'));var csv=require('to-csv');var ejs=require(_0x9e75('0x7'));var fs=require('fs');var fs_extra=require(_0x9e75('0x8'));var _=require(_0x9e75('0x9'));var squel=require(_0x9e75('0xa'));var crypto=require(_0x9e75('0xb'));var jsforce=require(_0x9e75('0xc'));var deskjs=require(_0x9e75('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e75('0xe'));var Redis=require(_0x9e75('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e75('0x10'));var as=require(_0x9e75('0x11'));var hardwareService=require(_0x9e75('0x12'));var logger=require(_0x9e75('0x13'))(_0x9e75('0x14'));var utils=require(_0x9e75('0x15'));var config=require(_0x9e75('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed207,_0x4d9ac8){_0x4d9ac8=_0x4d9ac8||0xcc;return function(_0xee63e9){if(_0xee63e9){return _0x3ed207[_0x9e75('0x17')](_0x4d9ac8);}return _0x3ed207[_0x9e75('0x18')](_0x4d9ac8)['end']();};}function respondWithResult(_0x3dbabd,_0x2e0f0a){_0x2e0f0a=_0x2e0f0a||0xc8;return function(_0x254592){if(_0x254592){return _0x3dbabd[_0x9e75('0x18')](_0x2e0f0a)['json'](_0x254592);}};}function respondWithFilteredResult(_0x3f3374,_0x56e137){return function(_0x1e7680){if(_0x1e7680){var _0x4b8e2f=typeof _0x56e137[_0x9e75('0x19')]==='undefined'&&typeof _0x56e137[_0x9e75('0x1a')]==='undefined';var _0x2401c3=_0x1e7680[_0x9e75('0x1b')];var _0xf167d1=_0x4b8e2f?0x0:_0x56e137[_0x9e75('0x19')];var _0x18c72c=_0x4b8e2f?_0x1e7680[_0x9e75('0x1b')]:_0x56e137[_0x9e75('0x19')]+_0x56e137['limit'];var _0x57d3e3;if(_0x18c72c>=_0x2401c3){_0x18c72c=_0x2401c3;_0x57d3e3=0xc8;}else{_0x57d3e3=0xce;}_0x3f3374[_0x9e75('0x18')](_0x57d3e3);return _0x3f3374[_0x9e75('0x1c')](_0x9e75('0x1d'),_0xf167d1+'-'+_0x18c72c+'/'+_0x2401c3)[_0x9e75('0x1e')](_0x1e7680);}return null;};}function patchUpdates(_0x21f239){return function(_0x163e37){try{jsonpatch['apply'](_0x163e37,_0x21f239,!![]);}catch(_0x39ee3a){return BPromise[_0x9e75('0x1f')](_0x39ee3a);}return _0x163e37[_0x9e75('0x20')]();};}function saveUpdates(_0x2f1219,_0x38bf88){return function(_0x5efb0e){if(_0x5efb0e){return _0x5efb0e[_0x9e75('0x21')](_0x2f1219)[_0x9e75('0x22')](function(_0x2b284f){return _0x2b284f;});}return null;};}function removeEntity(_0x21426f,_0xcd951a){return function(_0x1b6b0a){if(_0x1b6b0a){return _0x1b6b0a[_0x9e75('0x23')]()['then'](function(){_0x21426f[_0x9e75('0x18')](0xcc)[_0x9e75('0x24')]();});}};}function handleEntityNotFound(_0x2329c1,_0x5ea19c){return function(_0x496c95){if(!_0x496c95){_0x2329c1[_0x9e75('0x17')](0x194);}return _0x496c95;};}function handleError(_0x37b0bc,_0x966c0f){_0x966c0f=_0x966c0f||0x1f4;return function(_0x3b4928){logger['error'](_0x3b4928['stack']);if(_0x3b4928['name']){delete _0x3b4928[_0x9e75('0x25')];}_0x37b0bc[_0x9e75('0x18')](_0x966c0f)['send'](_0x3b4928);};}exports[_0x9e75('0x26')]=function(_0x10e1c4,_0x45e844){var _0x4c4df4={},_0x38509c={},_0xd1ef2f={'count':0x0,'rows':[]};var _0x4aff4f=_[_0x9e75('0x27')](db[_0x9e75('0x28')][_0x9e75('0x29')],function(_0x1c9dce){return{'name':_0x1c9dce['fieldName'],'type':_0x1c9dce['type'][_0x9e75('0x2a')]};});_0x38509c[_0x9e75('0x2b')]=_[_0x9e75('0x27')](_0x4aff4f,_0x9e75('0x25'));_0x38509c[_0x9e75('0x2c')]=_[_0x9e75('0x2d')](_0x10e1c4[_0x9e75('0x2c')]);_0x38509c[_0x9e75('0x2e')]=_['intersection'](_0x38509c[_0x9e75('0x2b')],_0x38509c[_0x9e75('0x2c')]);_0x4c4df4[_0x9e75('0x2f')]=_[_0x9e75('0x30')](_0x38509c[_0x9e75('0x2b')],qs[_0x9e75('0x31')](_0x10e1c4['query']['fields']));_0x4c4df4[_0x9e75('0x2f')]=_0x4c4df4[_0x9e75('0x2f')][_0x9e75('0x32')]?_0x4c4df4[_0x9e75('0x2f')]:_0x38509c['model'];if(!_0x10e1c4[_0x9e75('0x2c')][_0x9e75('0x33')](_0x9e75('0x34'))){_0x4c4df4[_0x9e75('0x1a')]=qs[_0x9e75('0x1a')](_0x10e1c4['query']['limit']);_0x4c4df4[_0x9e75('0x19')]=qs['offset'](_0x10e1c4[_0x9e75('0x2c')][_0x9e75('0x19')]);}_0x4c4df4[_0x9e75('0x35')]=qs[_0x9e75('0x36')](_0x10e1c4[_0x9e75('0x2c')][_0x9e75('0x36')]);_0x4c4df4[_0x9e75('0x37')]=qs[_0x9e75('0x2e')](_[_0x9e75('0x38')](_0x10e1c4['query'],_0x38509c[_0x9e75('0x2e')]),_0x4aff4f);if(_0x10e1c4[_0x9e75('0x2c')][_0x9e75('0x39')]){_0x4c4df4[_0x9e75('0x37')]=_[_0x9e75('0x3a')](_0x4c4df4[_0x9e75('0x37')],{'$or':_[_0x9e75('0x27')](_0x4aff4f,function(_0x39f3c8){if(_0x39f3c8[_0x9e75('0x3b')]!==_0x9e75('0x3c')){var _0x45624a={};_0x45624a[_0x39f3c8[_0x9e75('0x25')]]={'$like':'%'+_0x10e1c4[_0x9e75('0x2c')][_0x9e75('0x39')]+'%'};return _0x45624a;}})});}_0x4c4df4=_[_0x9e75('0x3a')]({},_0x4c4df4,_0x10e1c4[_0x9e75('0x3d')]);var _0x32e283={'where':_0x4c4df4['where']};return db[_0x9e75('0x28')][_0x9e75('0x1b')](_0x32e283)[_0x9e75('0x22')](function(_0x4fa04e){_0xd1ef2f[_0x9e75('0x1b')]=_0x4fa04e;if(_0x10e1c4['query']['includeAll']){_0x4c4df4[_0x9e75('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9e75('0x3f')](_0x4c4df4);})[_0x9e75('0x22')](function(_0x428b88){_0xd1ef2f[_0x9e75('0x40')]=_0x428b88;return _0xd1ef2f;})[_0x9e75('0x22')](respondWithFilteredResult(_0x45e844,_0x4c4df4))[_0x9e75('0x41')](handleError(_0x45e844,null));};exports[_0x9e75('0x42')]=function(_0x29d136,_0x4f0560){var _0x376dd6={'raw':!![],'where':{'id':_0x29d136[_0x9e75('0x43')]['id']}},_0x77eeb0={};_0x77eeb0['model']=_[_0x9e75('0x2d')](db[_0x9e75('0x28')][_0x9e75('0x29')]);_0x77eeb0[_0x9e75('0x2c')]=_[_0x9e75('0x2d')](_0x29d136['query']);_0x77eeb0[_0x9e75('0x2e')]=_[_0x9e75('0x30')](_0x77eeb0[_0x9e75('0x2b')],_0x77eeb0[_0x9e75('0x2c')]);_0x376dd6[_0x9e75('0x2f')]=_[_0x9e75('0x30')](_0x77eeb0[_0x9e75('0x2b')],qs[_0x9e75('0x31')](_0x29d136[_0x9e75('0x2c')][_0x9e75('0x31')]));_0x376dd6[_0x9e75('0x2f')]=_0x376dd6[_0x9e75('0x2f')]['length']?_0x376dd6[_0x9e75('0x2f')]:_0x77eeb0[_0x9e75('0x2b')];if(_0x29d136[_0x9e75('0x2c')]['includeAll']){_0x376dd6[_0x9e75('0x3e')]=[{'all':!![]}];}_0x376dd6=_['merge']({},_0x376dd6,_0x29d136[_0x9e75('0x3d')]);return db[_0x9e75('0x28')][_0x9e75('0x44')](_0x376dd6)[_0x9e75('0x22')](handleEntityNotFound(_0x4f0560,null))['then'](respondWithResult(_0x4f0560,null))[_0x9e75('0x41')](handleError(_0x4f0560,null));};exports[_0x9e75('0x45')]=function(_0x1c36a6,_0x553ffb){return db[_0x9e75('0x28')][_0x9e75('0x45')](_0x1c36a6[_0x9e75('0x46')],{})[_0x9e75('0x22')](respondWithResult(_0x553ffb,0xc9))[_0x9e75('0x41')](handleError(_0x553ffb,null));};exports[_0x9e75('0x21')]=function(_0x2e5939,_0x2ed276){if(_0x2e5939[_0x9e75('0x46')]['id']){delete _0x2e5939[_0x9e75('0x46')]['id'];}return db[_0x9e75('0x28')][_0x9e75('0x44')]({'where':{'id':_0x2e5939[_0x9e75('0x43')]['id']}})[_0x9e75('0x22')](handleEntityNotFound(_0x2ed276,null))[_0x9e75('0x22')](saveUpdates(_0x2e5939[_0x9e75('0x46')],null))['then'](respondWithResult(_0x2ed276,null))[_0x9e75('0x41')](handleError(_0x2ed276,null));};exports[_0x9e75('0x23')]=function(_0x3c9d60,_0x1ddc68){return db[_0x9e75('0x28')][_0x9e75('0x44')]({'where':{'id':_0x3c9d60[_0x9e75('0x43')]['id']}})[_0x9e75('0x22')](handleEntityNotFound(_0x1ddc68,null))[_0x9e75('0x22')](removeEntity(_0x1ddc68,null))[_0x9e75('0x41')](handleError(_0x1ddc68,null));};exports[_0x9e75('0x47')]=function(_0x304c7f,_0x58e56d){return db[_0x9e75('0x28')]['describe']()[_0x9e75('0x22')](respondWithResult(_0x58e56d,null))[_0x9e75('0x41')](handleError(_0x58e56d,null));}; \ No newline at end of file +var _0x162b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x5f4352,_0x16ef2a){var _0x3638a5=function(_0x11020c){while(--_0x11020c){_0x5f4352['push'](_0x5f4352['shift']());}};_0x3638a5(++_0x16ef2a);}(_0x162b,0x90));var _0xb162=function(_0x3a28e2,_0x58325a){_0x3a28e2=_0x3a28e2-0x0;var _0xfd325a=_0x162b[_0x3a28e2];return _0xfd325a;};'use strict';var emlformat=require(_0xb162('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb162('0x1'));var jsonpatch=require(_0xb162('0x2'));var rp=require(_0xb162('0x3'));var moment=require(_0xb162('0x4'));var BPromise=require(_0xb162('0x5'));var Mustache=require(_0xb162('0x6'));var util=require(_0xb162('0x7'));var path=require(_0xb162('0x8'));var sox=require('sox');var csv=require(_0xb162('0x9'));var ejs=require(_0xb162('0xa'));var fs=require('fs');var fs_extra=require(_0xb162('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb162('0xc'));var jsforce=require(_0xb162('0xd'));var deskjs=require(_0xb162('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb162('0xf'));var Papa=require('papaparse');var Redis=require(_0xb162('0x10'));var authService=require(_0xb162('0x11'));var qs=require(_0xb162('0x12'));var as=require(_0xb162('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb162('0x14'))(_0xb162('0x15'));var utils=require(_0xb162('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb162('0x17'));var db=require(_0xb162('0x18'))['db'];function respondWithStatusCode(_0x2ba7c9,_0x3c1534){_0x3c1534=_0x3c1534||0xcc;return function(_0x54afa5){if(_0x54afa5){return _0x2ba7c9[_0xb162('0x19')](_0x3c1534);}return _0x2ba7c9['status'](_0x3c1534)[_0xb162('0x1a')]();};}function respondWithResult(_0x131a7a,_0x245d04){_0x245d04=_0x245d04||0xc8;return function(_0x1c518b){if(_0x1c518b){return _0x131a7a[_0xb162('0x1b')](_0x245d04)['json'](_0x1c518b);}};}function respondWithFilteredResult(_0x123ef5,_0x48da08){return function(_0x4ee51d){if(_0x4ee51d){var _0x406f5c=typeof _0x48da08['offset']==='undefined'&&typeof _0x48da08[_0xb162('0x1c')]===_0xb162('0x1d');var _0x232e34=_0x4ee51d[_0xb162('0x1e')];var _0x2dff0c=_0x406f5c?0x0:_0x48da08[_0xb162('0x1f')];var _0x55988f=_0x406f5c?_0x4ee51d[_0xb162('0x1e')]:_0x48da08[_0xb162('0x1f')]+_0x48da08['limit'];var _0xb39fe2;if(_0x55988f>=_0x232e34){_0x55988f=_0x232e34;_0xb39fe2=0xc8;}else{_0xb39fe2=0xce;}_0x123ef5[_0xb162('0x1b')](_0xb39fe2);return _0x123ef5[_0xb162('0x20')](_0xb162('0x21'),_0x2dff0c+'-'+_0x55988f+'/'+_0x232e34)[_0xb162('0x22')](_0x4ee51d);}return null;};}function patchUpdates(_0x2a8481){return function(_0x22b3f1){try{jsonpatch[_0xb162('0x23')](_0x22b3f1,_0x2a8481,!![]);}catch(_0x24b871){return BPromise[_0xb162('0x24')](_0x24b871);}return _0x22b3f1[_0xb162('0x25')]();};}function saveUpdates(_0x4f6fb0,_0x7ad256){return function(_0x4da20b){if(_0x4da20b){return _0x4da20b[_0xb162('0x26')](_0x4f6fb0)[_0xb162('0x27')](function(_0x3e6e2a){return _0x3e6e2a;});}return null;};}function removeEntity(_0x2e13c4,_0x3a2526){return function(_0x4ad073){if(_0x4ad073){return _0x4ad073[_0xb162('0x28')]()[_0xb162('0x27')](function(){_0x2e13c4[_0xb162('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174e00,_0x238602){return function(_0x306f2a){if(!_0x306f2a){_0x174e00[_0xb162('0x19')](0x194);}return _0x306f2a;};}function handleError(_0x248495,_0x3ce83b){_0x3ce83b=_0x3ce83b||0x1f4;return function(_0x3ef2b2){logger[_0xb162('0x29')](_0x3ef2b2['stack']);if(_0x3ef2b2[_0xb162('0x2a')]){delete _0x3ef2b2[_0xb162('0x2a')];}_0x248495[_0xb162('0x1b')](_0x3ce83b)[_0xb162('0x2b')](_0x3ef2b2);};}exports[_0xb162('0x2c')]=function(_0x577edc,_0x1f802f){var _0x486fdd={},_0x21348a={},_0x246557={'count':0x0,'rows':[]};var _0x5af84f=_[_0xb162('0x2d')](db[_0xb162('0x2e')][_0xb162('0x2f')],function(_0x419f3f){return{'name':_0x419f3f[_0xb162('0x30')],'type':_0x419f3f['type'][_0xb162('0x31')]};});_0x21348a[_0xb162('0x32')]=_[_0xb162('0x2d')](_0x5af84f,_0xb162('0x2a'));_0x21348a[_0xb162('0x33')]=_[_0xb162('0x34')](_0x577edc[_0xb162('0x33')]);_0x21348a[_0xb162('0x35')]=_[_0xb162('0x36')](_0x21348a['model'],_0x21348a[_0xb162('0x33')]);_0x486fdd[_0xb162('0x37')]=_[_0xb162('0x36')](_0x21348a[_0xb162('0x32')],qs[_0xb162('0x38')](_0x577edc[_0xb162('0x33')][_0xb162('0x38')]));_0x486fdd[_0xb162('0x37')]=_0x486fdd[_0xb162('0x37')][_0xb162('0x39')]?_0x486fdd['attributes']:_0x21348a[_0xb162('0x32')];if(!_0x577edc['query'][_0xb162('0x3a')](_0xb162('0x3b'))){_0x486fdd[_0xb162('0x1c')]=qs[_0xb162('0x1c')](_0x577edc[_0xb162('0x33')][_0xb162('0x1c')]);_0x486fdd[_0xb162('0x1f')]=qs[_0xb162('0x1f')](_0x577edc[_0xb162('0x33')]['offset']);}_0x486fdd[_0xb162('0x3c')]=qs[_0xb162('0x3d')](_0x577edc[_0xb162('0x33')][_0xb162('0x3d')]);_0x486fdd[_0xb162('0x3e')]=qs[_0xb162('0x35')](_[_0xb162('0x3f')](_0x577edc[_0xb162('0x33')],_0x21348a['filters']),_0x5af84f);if(_0x577edc[_0xb162('0x33')][_0xb162('0x40')]){_0x486fdd[_0xb162('0x3e')]=_[_0xb162('0x41')](_0x486fdd['where'],{'$or':_[_0xb162('0x2d')](_0x5af84f,function(_0x1ca4a9){if(_0x1ca4a9[_0xb162('0x42')]!==_0xb162('0x43')){var _0x448c51={};_0x448c51[_0x1ca4a9[_0xb162('0x2a')]]={'$like':'%'+_0x577edc['query'][_0xb162('0x40')]+'%'};return _0x448c51;}})});}_0x486fdd=_['merge']({},_0x486fdd,_0x577edc[_0xb162('0x44')]);var _0x264221={'where':_0x486fdd[_0xb162('0x3e')]};return db[_0xb162('0x2e')]['count'](_0x264221)[_0xb162('0x27')](function(_0x31f2a0){_0x246557['count']=_0x31f2a0;if(_0x577edc[_0xb162('0x33')][_0xb162('0x45')]){_0x486fdd[_0xb162('0x46')]=[{'all':!![]}];}return db[_0xb162('0x2e')][_0xb162('0x47')](_0x486fdd);})[_0xb162('0x27')](function(_0x4ceb1f){_0x246557[_0xb162('0x48')]=_0x4ceb1f;return _0x246557;})['then'](respondWithFilteredResult(_0x1f802f,_0x486fdd))[_0xb162('0x49')](handleError(_0x1f802f,null));};exports[_0xb162('0x4a')]=function(_0x38640e,_0x309c42){var _0x2ffe55={'raw':!![],'where':{'id':_0x38640e['params']['id']}},_0x579de2={};_0x579de2[_0xb162('0x32')]=_['keys'](db['JscriptyQuestionReport'][_0xb162('0x2f')]);_0x579de2[_0xb162('0x33')]=_['keys'](_0x38640e[_0xb162('0x33')]);_0x579de2[_0xb162('0x35')]=_['intersection'](_0x579de2[_0xb162('0x32')],_0x579de2['query']);_0x2ffe55[_0xb162('0x37')]=_[_0xb162('0x36')](_0x579de2[_0xb162('0x32')],qs[_0xb162('0x38')](_0x38640e[_0xb162('0x33')][_0xb162('0x38')]));_0x2ffe55[_0xb162('0x37')]=_0x2ffe55['attributes'][_0xb162('0x39')]?_0x2ffe55[_0xb162('0x37')]:_0x579de2[_0xb162('0x32')];if(_0x38640e['query'][_0xb162('0x45')]){_0x2ffe55[_0xb162('0x46')]=[{'all':!![]}];}_0x2ffe55=_[_0xb162('0x41')]({},_0x2ffe55,_0x38640e[_0xb162('0x44')]);return db['JscriptyQuestionReport'][_0xb162('0x4b')](_0x2ffe55)[_0xb162('0x27')](handleEntityNotFound(_0x309c42,null))[_0xb162('0x27')](respondWithResult(_0x309c42,null))[_0xb162('0x49')](handleError(_0x309c42,null));};exports[_0xb162('0x4c')]=function(_0x304ec4,_0x4b367e){return db[_0xb162('0x2e')][_0xb162('0x4c')](_0x304ec4['body'],{})['then'](respondWithResult(_0x4b367e,0xc9))['catch'](handleError(_0x4b367e,null));};exports['update']=function(_0x4f2f11,_0x1e1163){if(_0x4f2f11[_0xb162('0x4d')]['id']){delete _0x4f2f11[_0xb162('0x4d')]['id'];}return db[_0xb162('0x2e')][_0xb162('0x4b')]({'where':{'id':_0x4f2f11[_0xb162('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e1163,null))[_0xb162('0x27')](saveUpdates(_0x4f2f11['body'],null))['then'](respondWithResult(_0x1e1163,null))[_0xb162('0x49')](handleError(_0x1e1163,null));};exports[_0xb162('0x28')]=function(_0x17b19c,_0x17fe36){return db['JscriptyQuestionReport'][_0xb162('0x4b')]({'where':{'id':_0x17b19c[_0xb162('0x4e')]['id']}})[_0xb162('0x27')](handleEntityNotFound(_0x17fe36,null))[_0xb162('0x27')](removeEntity(_0x17fe36,null))['catch'](handleError(_0x17fe36,null));};exports[_0xb162('0x4f')]=function(_0x556c0a,_0x322639){return db['JscriptyQuestionReport']['describe']()[_0xb162('0x27')](respondWithResult(_0x322639,null))[_0xb162('0x49')](handleError(_0x322639,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index dc57979..8802f1a 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 _0x2ea3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger'];(function(_0x44f859,_0x39d4cd){var _0x2ecda6=function(_0x594b3){while(--_0x594b3){_0x44f859['push'](_0x44f859['shift']());}};_0x2ecda6(++_0x39d4cd);}(_0x2ea3,0x17e));var _0x32ea=function(_0x2b7196,_0x582f8e){_0x2b7196=_0x2b7196-0x0;var _0x4b7b3a=_0x2ea3[_0x2b7196];return _0x4b7b3a;};'use strict';var _=require('lodash');var util=require(_0x32ea('0x0'));var logger=require(_0x32ea('0x1'))('api');var moment=require(_0x32ea('0x2'));var BPromise=require(_0x32ea('0x3'));var rp=require(_0x32ea('0x4'));var fs=require('fs');var path=require(_0x32ea('0x5'));var rimraf=require(_0x32ea('0x6'));var config=require(_0x32ea('0x7'));var attributes=require(_0x32ea('0x8'));module[_0x32ea('0x9')]=function(_0xc0b9f7,_0x484998){return _0xc0b9f7[_0x32ea('0xa')](_0x32ea('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb98d=['JscriptyQuestionReport','report_jscripty_questions','lodash','api','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xb98d,0x80));var _0xdb98=function(_0x1c4b72,_0x47b058){_0x1c4b72=_0x1c4b72-0x0;var _0x5dd0f1=_0xb98d[_0x1c4b72];return _0x5dd0f1;};'use strict';var _=require(_0xdb98('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb98('0x1'));var moment=require(_0xdb98('0x2'));var BPromise=require(_0xdb98('0x3'));var rp=require(_0xdb98('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb98('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x200b81,_0x170d54){return _0x200b81[_0xdb98('0x6')](_0xdb98('0x7'),attributes,{'tableName':_0xdb98('0x8'),'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 9660488..3e163cc 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 _0xa0b7=['request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x4f949f,_0x22a8a1){var _0x263e01=function(_0x3e94ba){while(--_0x3e94ba){_0x4f949f['push'](_0x4f949f['shift']());}};_0x263e01(++_0x22a8a1);}(_0xa0b7,0x1da));var _0x7a0b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xa0b7[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x7a0b('0x0'));var util=require('util');var moment=require(_0x7a0b('0x1'));var BPromise=require(_0x7a0b('0x2'));var rs=require(_0x7a0b('0x3'));var fs=require('fs');var Redis=require(_0x7a0b('0x4'));var db=require(_0x7a0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a0b('0x6'))('rpc');var config=require(_0x7a0b('0x7'));var jayson=require(_0x7a0b('0x8'));var client=jayson['client'][_0x7a0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55fd2b,_0x245831,_0xde1c0b){return new BPromise(function(_0x46fc23,_0x107b51){return client[_0x7a0b('0xa')](_0x55fd2b,_0xde1c0b)[_0x7a0b('0xb')](function(_0x4fff01){logger['info'](_0x7a0b('0xc'),_0x245831,'request\x20sent');logger[_0x7a0b('0xd')](_0x7a0b('0xe'),_0x245831,'request\x20sent',JSON[_0x7a0b('0xf')](_0x4fff01));if(_0x4fff01[_0x7a0b('0x10')]){if(_0x4fff01[_0x7a0b('0x10')][_0x7a0b('0x11')]===0x1f4){logger[_0x7a0b('0x10')](_0x7a0b('0xc'),_0x245831,_0x4fff01[_0x7a0b('0x10')][_0x7a0b('0x12')]);return _0x107b51(_0x4fff01['error'][_0x7a0b('0x12')]);}logger['error'](_0x7a0b('0xc'),_0x245831,_0x4fff01[_0x7a0b('0x10')][_0x7a0b('0x12')]);return _0x46fc23(_0x4fff01[_0x7a0b('0x10')][_0x7a0b('0x12')]);}else{logger[_0x7a0b('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x245831,'request\x20sent');_0x46fc23(_0x4fff01[_0x7a0b('0x14')][_0x7a0b('0x12')]);}})[_0x7a0b('0x15')](function(_0x37f9a9){logger[_0x7a0b('0x10')](_0x7a0b('0xc'),_0x245831,_0x37f9a9);_0x107b51(_0x37f9a9);});});} \ No newline at end of file +var _0x9de3=['util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0x9de3,0x1a1));var _0x39de=function(_0x4db03c,_0x271b59){_0x4db03c=_0x4db03c-0x0;var _0x28cf6a=_0x9de3[_0x4db03c];return _0x28cf6a;};'use strict';var _=require(_0x39de('0x0'));var util=require(_0x39de('0x1'));var moment=require('moment');var BPromise=require(_0x39de('0x2'));var rs=require(_0x39de('0x3'));var fs=require('fs');var Redis=require(_0x39de('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39de('0x5'));var logger=require('../../config/logger')(_0x39de('0x6'));var config=require(_0x39de('0x7'));var jayson=require(_0x39de('0x8'));var client=jayson[_0x39de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x186328,_0x376340,_0x2486a9){return new BPromise(function(_0x3a236f,_0x19e16e){return client[_0x39de('0xa')](_0x186328,_0x2486a9)[_0x39de('0xb')](function(_0x528389){logger[_0x39de('0xc')](_0x39de('0xd'),_0x376340,'request\x20sent');logger[_0x39de('0xe')](_0x39de('0xf'),_0x376340,_0x39de('0x10'),JSON[_0x39de('0x11')](_0x528389));if(_0x528389[_0x39de('0x12')]){if(_0x528389[_0x39de('0x12')][_0x39de('0x13')]===0x1f4){logger[_0x39de('0x12')](_0x39de('0xd'),_0x376340,_0x528389['error'][_0x39de('0x14')]);return _0x19e16e(_0x528389[_0x39de('0x12')]['message']);}logger['error'](_0x39de('0xd'),_0x376340,_0x528389[_0x39de('0x12')][_0x39de('0x14')]);return _0x3a236f(_0x528389['error'][_0x39de('0x14')]);}else{logger[_0x39de('0xc')](_0x39de('0xd'),_0x376340,_0x39de('0x10'));_0x3a236f(_0x528389['result'][_0x39de('0x14')]);}})[_0x39de('0x15')](function(_0x8e2714){logger[_0x39de('0x12')](_0x39de('0xd'),_0x376340,_0x8e2714);_0x19e16e(_0x8e2714);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d34f8b9..0c2d725 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 _0xcd50=['exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/questions','post','put','delete','destroy'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xcd50,0x1e7));var _0x0cd5=function(_0x1e93ae,_0x4c9a5e){_0x1e93ae=_0x1e93ae-0x0;var _0x1f9ea5=_0xcd50[_0x1e93ae];return _0x1f9ea5;};'use strict';var multer=require(_0x0cd5('0x0'));var util=require(_0x0cd5('0x1'));var path=require(_0x0cd5('0x2'));var timeout=require(_0x0cd5('0x3'));var express=require(_0x0cd5('0x4'));var router=express['Router']();var fs_extra=require(_0x0cd5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cd5('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x0cd5('0x7')]('/',auth[_0x0cd5('0x8')](),controller['index']);router['get']('/describe',auth[_0x0cd5('0x8')](),controller[_0x0cd5('0x9')]);router[_0x0cd5('0x7')](_0x0cd5('0xa'),auth[_0x0cd5('0x8')](),controller[_0x0cd5('0xb')]);router['get'](_0x0cd5('0xc'),auth[_0x0cd5('0x8')](),controller['getQuestions']);router[_0x0cd5('0xd')]('/',auth[_0x0cd5('0x8')](),controller['create']);router[_0x0cd5('0xe')](_0x0cd5('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x0cd5('0xf')](_0x0cd5('0xa'),auth['isAuthenticated'](),controller[_0x0cd5('0x10')]);module[_0x0cd5('0x11')]=router; \ No newline at end of file +var _0x3f8d=['/:id/questions','getQuestions','post','create','put','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x60ee39,_0x1b50fe){var _0x2875f3=function(_0x99a94a){while(--_0x99a94a){_0x60ee39['push'](_0x60ee39['shift']());}};_0x2875f3(++_0x1b50fe);}(_0x3f8d,0x1d3));var _0xd3f8=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3f8d[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0xd3f8('0x0'));var util=require(_0xd3f8('0x1'));var path=require(_0xd3f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd3f8('0x3')]();var fs_extra=require(_0xd3f8('0x4'));var auth=require(_0xd3f8('0x5'));var interaction=require(_0xd3f8('0x6'));var config=require(_0xd3f8('0x7'));var controller=require(_0xd3f8('0x8'));router[_0xd3f8('0x9')]('/',auth[_0xd3f8('0xa')](),controller[_0xd3f8('0xb')]);router[_0xd3f8('0x9')](_0xd3f8('0xc'),auth[_0xd3f8('0xa')](),controller[_0xd3f8('0xd')]);router['get'](_0xd3f8('0xe'),auth[_0xd3f8('0xa')](),controller[_0xd3f8('0xf')]);router['get'](_0xd3f8('0x10'),auth[_0xd3f8('0xa')](),controller[_0xd3f8('0x11')]);router[_0xd3f8('0x12')]('/',auth[_0xd3f8('0xa')](),controller[_0xd3f8('0x13')]);router[_0xd3f8('0x14')](_0xd3f8('0xe'),auth['isAuthenticated'](),controller[_0xd3f8('0x15')]);router[_0xd3f8('0x16')](_0xd3f8('0xe'),auth[_0xd3f8('0xa')](),controller['destroy']);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 6f3f55c..e32d3b6 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 _0x8c8a=['BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x542730,_0x107034){var _0x5dd58a=function(_0x3c2c57){while(--_0x3c2c57){_0x542730['push'](_0x542730['shift']());}};_0x5dd58a(++_0x107034);}(_0x8c8a,0xbf));var _0xa8c8=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x8c8a[_0x592d48];return _0x5d789e;};'use strict';var moment=require(_0xa8c8('0x0'));var Sequelize=require(_0xa8c8('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xa8c8('0x2')],'set':function(_0x3c7106){this[_0xa8c8('0x3')](_0xa8c8('0x4'),_0x3c7106);this[_0xa8c8('0x3')](_0xa8c8('0x5'),moment()[_0xa8c8('0x6')](_0xa8c8('0x7')));}},'endtime':{'type':Sequelize[_0xa8c8('0x2')]},'membername':{'type':Sequelize[_0xa8c8('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa8c8('0x8')]},'calleridname':{'type':Sequelize[_0xa8c8('0x8')]},'calleridnum':{'type':Sequelize[_0xa8c8('0x8')]},'completed':{'type':Sequelize[_0xa8c8('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xf91e=['setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','exports'];(function(_0x1b8bc6,_0x4672de){var _0x17b6bd=function(_0x2ab866){while(--_0x2ab866){_0x1b8bc6['push'](_0x1b8bc6['shift']());}};_0x17b6bd(++_0x4672de);}(_0xf91e,0x73));var _0xef91=function(_0x145ee1,_0x19c9fa){_0x145ee1=_0x145ee1-0x0;var _0x411642=_0xf91e[_0x145ee1];return _0x411642;};'use strict';var moment=require(_0xef91('0x0'));var Sequelize=require('sequelize');module[_0xef91('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x383764){this[_0xef91('0x2')](_0xef91('0x3'),_0x383764);this[_0xef91('0x2')](_0xef91('0x4'),moment()['format'](_0xef91('0x5')));}},'endtime':{'type':Sequelize[_0xef91('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xef91('0x7')]},'queue':{'type':Sequelize[_0xef91('0x7')]},'uniqueid':{'type':Sequelize[_0xef91('0x7')]},'calleridname':{'type':Sequelize[_0xef91('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xef91('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9a487d9..9f3a845 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 _0x79b9=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','show','params','rawAttributes','length','includeAll','find','catch','create','update','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','filter','findAll','rows','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','name','send','map','JscriptySessionReport'];(function(_0x42af18,_0x147924){var _0x1a37ac=function(_0x1ade82){while(--_0x1ade82){_0x42af18['push'](_0x42af18['shift']());}};_0x1a37ac(++_0x147924);}(_0x79b9,0x1a6));var _0x979b=function(_0x36a787,_0x3650ad){_0x36a787=_0x36a787-0x0;var _0x4486db=_0x79b9[_0x36a787];return _0x4486db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x979b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x979b('0x1'));var moment=require(_0x979b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x979b('0x3'));var util=require(_0x979b('0x4'));var path=require(_0x979b('0x5'));var sox=require(_0x979b('0x6'));var csv=require(_0x979b('0x7'));var ejs=require(_0x979b('0x8'));var fs=require('fs');var fs_extra=require(_0x979b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x979b('0xa'));var jsforce=require(_0x979b('0xb'));var deskjs=require(_0x979b('0xc'));var toCsv=require(_0x979b('0x7'));var querystring=require(_0x979b('0xd'));var Papa=require('papaparse');var Redis=require(_0x979b('0xe'));var authService=require(_0x979b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x979b('0x10'));var logger=require(_0x979b('0x11'))('api');var utils=require(_0x979b('0x12'));var config=require(_0x979b('0x13'));var licenseUtil=require(_0x979b('0x14'));var db=require(_0x979b('0x15'))['db'];function respondWithStatusCode(_0x4e2290,_0x42f0b3){_0x42f0b3=_0x42f0b3||0xcc;return function(_0x329793){if(_0x329793){return _0x4e2290[_0x979b('0x16')](_0x42f0b3);}return _0x4e2290[_0x979b('0x17')](_0x42f0b3)[_0x979b('0x18')]();};}function respondWithResult(_0x53eb20,_0x1bb7ca){_0x1bb7ca=_0x1bb7ca||0xc8;return function(_0x303c99){if(_0x303c99){return _0x53eb20['status'](_0x1bb7ca)[_0x979b('0x19')](_0x303c99);}};}function respondWithFilteredResult(_0x4073d2,_0x553267){return function(_0x306f35){if(_0x306f35){var _0x855fbb=typeof _0x553267[_0x979b('0x1a')]===_0x979b('0x1b')&&typeof _0x553267[_0x979b('0x1c')]==='undefined';var _0x18a70a=_0x306f35[_0x979b('0x1d')];var _0x45b6a5=_0x855fbb?0x0:_0x553267[_0x979b('0x1a')];var _0x1f5b8d=_0x855fbb?_0x306f35[_0x979b('0x1d')]:_0x553267[_0x979b('0x1a')]+_0x553267['limit'];var _0x4bbe36;if(_0x1f5b8d>=_0x18a70a){_0x1f5b8d=_0x18a70a;_0x4bbe36=0xc8;}else{_0x4bbe36=0xce;}_0x4073d2[_0x979b('0x17')](_0x4bbe36);return _0x4073d2[_0x979b('0x1e')](_0x979b('0x1f'),_0x45b6a5+'-'+_0x1f5b8d+'/'+_0x18a70a)[_0x979b('0x19')](_0x306f35);}return null;};}function patchUpdates(_0x2b3b63){return function(_0x40515d){try{jsonpatch['apply'](_0x40515d,_0x2b3b63,!![]);}catch(_0x2aba93){return BPromise['reject'](_0x2aba93);}return _0x40515d[_0x979b('0x20')]();};}function saveUpdates(_0x18b859,_0x5daca4){return function(_0x36e088){if(_0x36e088){return _0x36e088['update'](_0x18b859)[_0x979b('0x21')](function(_0x35d53d){return _0x35d53d;});}return null;};}function removeEntity(_0x2e9a20,_0x44a06b){return function(_0x486528){if(_0x486528){return _0x486528[_0x979b('0x22')]()['then'](function(){_0x2e9a20[_0x979b('0x17')](0xcc)[_0x979b('0x18')]();});}};}function handleEntityNotFound(_0x5b3d7c,_0x1e9bc7){return function(_0x2ca8c1){if(!_0x2ca8c1){_0x5b3d7c[_0x979b('0x16')](0x194);}return _0x2ca8c1;};}function handleError(_0x3c7ba1,_0x5b4379){_0x5b4379=_0x5b4379||0x1f4;return function(_0x1a44ed){logger[_0x979b('0x23')](_0x1a44ed['stack']);if(_0x1a44ed['name']){delete _0x1a44ed[_0x979b('0x24')];}_0x3c7ba1[_0x979b('0x17')](_0x5b4379)[_0x979b('0x25')](_0x1a44ed);};}exports['index']=function(_0xb5367,_0x421efc){var _0x3b0ab7={},_0x56fddd={},_0x226ce9={'count':0x0,'rows':[]};var _0x4eb2d9=_[_0x979b('0x26')](db[_0x979b('0x27')]['rawAttributes'],function(_0xefa336){return{'name':_0xefa336[_0x979b('0x28')],'type':_0xefa336[_0x979b('0x29')]['key']};});_0x56fddd[_0x979b('0x2a')]=_[_0x979b('0x26')](_0x4eb2d9,_0x979b('0x24'));_0x56fddd[_0x979b('0x2b')]=_[_0x979b('0x2c')](_0xb5367[_0x979b('0x2b')]);_0x56fddd[_0x979b('0x2d')]=_[_0x979b('0x2e')](_0x56fddd['model'],_0x56fddd[_0x979b('0x2b')]);_0x3b0ab7[_0x979b('0x2f')]=_['intersection'](_0x56fddd[_0x979b('0x2a')],qs[_0x979b('0x30')](_0xb5367[_0x979b('0x2b')][_0x979b('0x30')]));_0x3b0ab7[_0x979b('0x2f')]=_0x3b0ab7[_0x979b('0x2f')]['length']?_0x3b0ab7[_0x979b('0x2f')]:_0x56fddd[_0x979b('0x2a')];if(!_0xb5367['query'][_0x979b('0x31')](_0x979b('0x32'))){_0x3b0ab7[_0x979b('0x1c')]=qs[_0x979b('0x1c')](_0xb5367[_0x979b('0x2b')][_0x979b('0x1c')]);_0x3b0ab7[_0x979b('0x1a')]=qs[_0x979b('0x1a')](_0xb5367['query']['offset']);}_0x3b0ab7[_0x979b('0x33')]=qs[_0x979b('0x34')](_0xb5367[_0x979b('0x2b')][_0x979b('0x34')]);_0x3b0ab7[_0x979b('0x35')]=qs[_0x979b('0x2d')](_[_0x979b('0x36')](_0xb5367['query'],_0x56fddd[_0x979b('0x2d')]),_0x4eb2d9);if(_0xb5367['query']['filter']){_0x3b0ab7[_0x979b('0x35')]=_[_0x979b('0x37')](_0x3b0ab7['where'],{'$or':_['map'](_0x4eb2d9,function(_0xd921b6){if(_0xd921b6['type']!==_0x979b('0x38')){var _0x174283={};_0x174283[_0xd921b6[_0x979b('0x24')]]={'$like':'%'+_0xb5367[_0x979b('0x2b')]['filter']+'%'};return _0x174283;}})});}_0x3b0ab7=_[_0x979b('0x37')]({},_0x3b0ab7,_0xb5367[_0x979b('0x39')]);var _0xaeb97e={'where':_0x3b0ab7[_0x979b('0x35')]};return db[_0x979b('0x27')]['count'](_0xaeb97e)['then'](function(_0xb68146){_0x226ce9[_0x979b('0x1d')]=_0xb68146;if(_0xb5367[_0x979b('0x2b')]['includeAll']){_0x3b0ab7[_0x979b('0x3a')]=[{'all':!![]}];}return db[_0x979b('0x27')]['findAll'](_0x3b0ab7);})[_0x979b('0x21')](function(_0xd3185d){_0x226ce9['rows']=_0xd3185d;return _0x226ce9;})[_0x979b('0x21')](respondWithFilteredResult(_0x421efc,_0x3b0ab7))['catch'](handleError(_0x421efc,null));};exports[_0x979b('0x3b')]=function(_0x3af912,_0x2d37e4){var _0x18fdd4={'raw':!![],'where':{'id':_0x3af912[_0x979b('0x3c')]['id']}},_0x4f5e44={};_0x4f5e44[_0x979b('0x2a')]=_[_0x979b('0x2c')](db['JscriptySessionReport'][_0x979b('0x3d')]);_0x4f5e44[_0x979b('0x2b')]=_[_0x979b('0x2c')](_0x3af912[_0x979b('0x2b')]);_0x4f5e44[_0x979b('0x2d')]=_[_0x979b('0x2e')](_0x4f5e44[_0x979b('0x2a')],_0x4f5e44[_0x979b('0x2b')]);_0x18fdd4[_0x979b('0x2f')]=_['intersection'](_0x4f5e44[_0x979b('0x2a')],qs[_0x979b('0x30')](_0x3af912[_0x979b('0x2b')][_0x979b('0x30')]));_0x18fdd4[_0x979b('0x2f')]=_0x18fdd4[_0x979b('0x2f')][_0x979b('0x3e')]?_0x18fdd4[_0x979b('0x2f')]:_0x4f5e44['model'];if(_0x3af912[_0x979b('0x2b')][_0x979b('0x3f')]){_0x18fdd4[_0x979b('0x3a')]=[{'all':!![]}];}_0x18fdd4=_[_0x979b('0x37')]({},_0x18fdd4,_0x3af912[_0x979b('0x39')]);return db[_0x979b('0x27')][_0x979b('0x40')](_0x18fdd4)[_0x979b('0x21')](handleEntityNotFound(_0x2d37e4,null))[_0x979b('0x21')](respondWithResult(_0x2d37e4,null))[_0x979b('0x41')](handleError(_0x2d37e4,null));};exports['create']=function(_0x5ed3d8,_0x9698dc){return db[_0x979b('0x27')][_0x979b('0x42')](_0x5ed3d8['body'],{})[_0x979b('0x21')](respondWithResult(_0x9698dc,0xc9))[_0x979b('0x41')](handleError(_0x9698dc,null));};exports[_0x979b('0x43')]=function(_0x31b5ae,_0x570bf0){if(_0x31b5ae[_0x979b('0x44')]['id']){delete _0x31b5ae['body']['id'];}return db[_0x979b('0x27')]['find']({'where':{'id':_0x31b5ae[_0x979b('0x3c')]['id']}})[_0x979b('0x21')](handleEntityNotFound(_0x570bf0,null))['then'](saveUpdates(_0x31b5ae[_0x979b('0x44')],null))[_0x979b('0x21')](respondWithResult(_0x570bf0,null))['catch'](handleError(_0x570bf0,null));};exports[_0x979b('0x22')]=function(_0x3245e7,_0x354c72){return db['JscriptySessionReport'][_0x979b('0x40')]({'where':{'id':_0x3245e7[_0x979b('0x3c')]['id']}})[_0x979b('0x21')](handleEntityNotFound(_0x354c72,null))[_0x979b('0x21')](removeEntity(_0x354c72,null))[_0x979b('0x41')](handleError(_0x354c72,null));};exports[_0x979b('0x45')]=function(_0x30d3b8,_0x3d34c9){return db[_0x979b('0x27')]['describe']()['then'](respondWithResult(_0x3d34c9,null))['catch'](handleError(_0x3d34c9,null));};exports[_0x979b('0x46')]=function(_0x358454,_0x73ff86,_0x158873){var _0x15e6f3={'raw':!![],'where':{}};var _0x516bf5={};var _0x4f8e2c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x979b('0x47')]({'where':{'id':_0x358454[_0x979b('0x3c')]['id']}})[_0x979b('0x21')](handleEntityNotFound(_0x73ff86,null))['then'](function(_0x1229eb){if(_0x1229eb){_0x516bf5[_0x979b('0x2a')]=_[_0x979b('0x2c')](db[_0x979b('0x48')][_0x979b('0x3d')]);_0x516bf5[_0x979b('0x2b')]=_[_0x979b('0x2c')](_0x358454['query']);_0x516bf5[_0x979b('0x2d')]=_[_0x979b('0x2e')](_0x516bf5[_0x979b('0x2a')],_0x516bf5[_0x979b('0x2b')]);_0x15e6f3['attributes']=_[_0x979b('0x2e')](_0x516bf5[_0x979b('0x2a')],qs[_0x979b('0x30')](_0x358454[_0x979b('0x2b')][_0x979b('0x30')]));_0x15e6f3[_0x979b('0x2f')]=_0x15e6f3[_0x979b('0x2f')][_0x979b('0x3e')]?_0x15e6f3[_0x979b('0x2f')]:_0x516bf5['model'];if(!_0x358454[_0x979b('0x2b')][_0x979b('0x31')](_0x979b('0x32'))){_0x15e6f3[_0x979b('0x1c')]=qs['limit'](_0x358454[_0x979b('0x2b')]['limit']);_0x15e6f3[_0x979b('0x1a')]=qs[_0x979b('0x1a')](_0x358454[_0x979b('0x2b')][_0x979b('0x1a')]);}_0x15e6f3[_0x979b('0x33')]=qs[_0x979b('0x34')](_0x358454[_0x979b('0x2b')]['sort']);_0x15e6f3[_0x979b('0x35')]=qs['filters'](_[_0x979b('0x36')](_0x358454[_0x979b('0x2b')],_0x516bf5[_0x979b('0x2d')]));_0x15e6f3[_0x979b('0x35')][_0x979b('0x49')]=_0x1229eb['id'];if(_0x358454[_0x979b('0x2b')][_0x979b('0x4a')]){_0x15e6f3[_0x979b('0x35')]=_['merge'](_0x15e6f3[_0x979b('0x35')],{'$or':_[_0x979b('0x26')](_0x15e6f3[_0x979b('0x2f')],function(_0x500e7d){var _0x4f7f9f={};_0x4f7f9f[_0x500e7d]={'$like':'%'+_0x358454[_0x979b('0x2b')][_0x979b('0x4a')]+'%'};return _0x4f7f9f;})});}_0x15e6f3=_[_0x979b('0x37')]({},_0x15e6f3,_0x358454[_0x979b('0x39')]);return db[_0x979b('0x48')]['count']({'where':_0x15e6f3['where']})[_0x979b('0x21')](function(_0x6ef2f4){_0x4f8e2c[_0x979b('0x1d')]=_0x6ef2f4;if(_0x358454[_0x979b('0x2b')]['includeAll']){_0x15e6f3[_0x979b('0x3a')]=[{'all':!![]}];}return db[_0x979b('0x48')][_0x979b('0x4b')](_0x15e6f3);})[_0x979b('0x21')](function(_0x1c82eb){_0x4f8e2c[_0x979b('0x4c')]=_0x1c82eb;return _0x4f8e2c;});}})[_0x979b('0x21')](respondWithFilteredResult(_0x73ff86,_0x15e6f3))['catch'](handleError(_0x73ff86,null));}; \ No newline at end of file +var _0x89e6=['lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','apply','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs'];(function(_0x152369,_0x1674a8){var _0x1370f1=function(_0x478f89){while(--_0x478f89){_0x152369['push'](_0x152369['shift']());}};_0x1370f1(++_0x1674a8);}(_0x89e6,0x98));var _0x689e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89e6[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x689e('0x0'));var zipdir=require(_0x689e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x689e('0x2'));var moment=require('moment');var BPromise=require(_0x689e('0x3'));var Mustache=require(_0x689e('0x4'));var util=require(_0x689e('0x5'));var path=require('path');var sox=require(_0x689e('0x6'));var csv=require('to-csv');var ejs=require(_0x689e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x689e('0x8'));var squel=require(_0x689e('0x9'));var crypto=require(_0x689e('0xa'));var jsforce=require(_0x689e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x689e('0xc'));var querystring=require(_0x689e('0xd'));var Papa=require(_0x689e('0xe'));var Redis=require('ioredis');var authService=require(_0x689e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x689e('0x10'));var hardwareService=require(_0x689e('0x11'));var logger=require(_0x689e('0x12'))(_0x689e('0x13'));var utils=require('../../config/utils');var config=require(_0x689e('0x14'));var licenseUtil=require(_0x689e('0x15'));var db=require(_0x689e('0x16'))['db'];function respondWithStatusCode(_0x590fc8,_0x4345db){_0x4345db=_0x4345db||0xcc;return function(_0x55f837){if(_0x55f837){return _0x590fc8[_0x689e('0x17')](_0x4345db);}return _0x590fc8['status'](_0x4345db)['end']();};}function respondWithResult(_0x245741,_0x183647){_0x183647=_0x183647||0xc8;return function(_0x5abc40){if(_0x5abc40){return _0x245741[_0x689e('0x18')](_0x183647)[_0x689e('0x19')](_0x5abc40);}};}function respondWithFilteredResult(_0xbc2c85,_0x384b11){return function(_0xd6071e){if(_0xd6071e){var _0x17aec3=typeof _0x384b11['offset']===_0x689e('0x1a')&&typeof _0x384b11[_0x689e('0x1b')]===_0x689e('0x1a');var _0x10d01f=_0xd6071e[_0x689e('0x1c')];var _0x358645=_0x17aec3?0x0:_0x384b11['offset'];var _0x3b2fac=_0x17aec3?_0xd6071e[_0x689e('0x1c')]:_0x384b11['offset']+_0x384b11[_0x689e('0x1b')];var _0x442301;if(_0x3b2fac>=_0x10d01f){_0x3b2fac=_0x10d01f;_0x442301=0xc8;}else{_0x442301=0xce;}_0xbc2c85[_0x689e('0x18')](_0x442301);return _0xbc2c85[_0x689e('0x1d')]('Content-Range',_0x358645+'-'+_0x3b2fac+'/'+_0x10d01f)['json'](_0xd6071e);}return null;};}function patchUpdates(_0xac5f2c){return function(_0x4d5d91){try{jsonpatch[_0x689e('0x1e')](_0x4d5d91,_0xac5f2c,!![]);}catch(_0x1f1224){return BPromise['reject'](_0x1f1224);}return _0x4d5d91[_0x689e('0x1f')]();};}function saveUpdates(_0x33e5ab,_0x399ea6){return function(_0x101f53){if(_0x101f53){return _0x101f53[_0x689e('0x20')](_0x33e5ab)[_0x689e('0x21')](function(_0x51f898){return _0x51f898;});}return null;};}function removeEntity(_0x3dc08b,_0x4798b8){return function(_0x78a18a){if(_0x78a18a){return _0x78a18a[_0x689e('0x22')]()[_0x689e('0x21')](function(){_0x3dc08b[_0x689e('0x18')](0xcc)[_0x689e('0x23')]();});}};}function handleEntityNotFound(_0x2d4cb9,_0x400dda){return function(_0x3df406){if(!_0x3df406){_0x2d4cb9['sendStatus'](0x194);}return _0x3df406;};}function handleError(_0x379045,_0x2ab3bd){_0x2ab3bd=_0x2ab3bd||0x1f4;return function(_0x4bfa92){logger[_0x689e('0x24')](_0x4bfa92['stack']);if(_0x4bfa92[_0x689e('0x25')]){delete _0x4bfa92[_0x689e('0x25')];}_0x379045['status'](_0x2ab3bd)[_0x689e('0x26')](_0x4bfa92);};}exports[_0x689e('0x27')]=function(_0x145efd,_0x4aa6d8){var _0x49b6c4={},_0x58a32b={},_0x5dde06={'count':0x0,'rows':[]};var _0x1c501d=_[_0x689e('0x28')](db['JscriptySessionReport'][_0x689e('0x29')],function(_0x172007){return{'name':_0x172007[_0x689e('0x2a')],'type':_0x172007['type'][_0x689e('0x2b')]};});_0x58a32b[_0x689e('0x2c')]=_['map'](_0x1c501d,'name');_0x58a32b[_0x689e('0x2d')]=_[_0x689e('0x2e')](_0x145efd[_0x689e('0x2d')]);_0x58a32b[_0x689e('0x2f')]=_['intersection'](_0x58a32b[_0x689e('0x2c')],_0x58a32b[_0x689e('0x2d')]);_0x49b6c4['attributes']=_[_0x689e('0x30')](_0x58a32b['model'],qs[_0x689e('0x31')](_0x145efd[_0x689e('0x2d')]['fields']));_0x49b6c4[_0x689e('0x32')]=_0x49b6c4[_0x689e('0x32')][_0x689e('0x33')]?_0x49b6c4[_0x689e('0x32')]:_0x58a32b[_0x689e('0x2c')];if(!_0x145efd['query'][_0x689e('0x34')]('nolimit')){_0x49b6c4['limit']=qs[_0x689e('0x1b')](_0x145efd['query']['limit']);_0x49b6c4[_0x689e('0x35')]=qs[_0x689e('0x35')](_0x145efd[_0x689e('0x2d')][_0x689e('0x35')]);}_0x49b6c4[_0x689e('0x36')]=qs[_0x689e('0x37')](_0x145efd[_0x689e('0x2d')][_0x689e('0x37')]);_0x49b6c4[_0x689e('0x38')]=qs['filters'](_[_0x689e('0x39')](_0x145efd['query'],_0x58a32b['filters']),_0x1c501d);if(_0x145efd['query'][_0x689e('0x3a')]){_0x49b6c4[_0x689e('0x38')]=_[_0x689e('0x3b')](_0x49b6c4[_0x689e('0x38')],{'$or':_[_0x689e('0x28')](_0x1c501d,function(_0x46c621){if(_0x46c621[_0x689e('0x3c')]!==_0x689e('0x3d')){var _0x585355={};_0x585355[_0x46c621['name']]={'$like':'%'+_0x145efd[_0x689e('0x2d')]['filter']+'%'};return _0x585355;}})});}_0x49b6c4=_[_0x689e('0x3b')]({},_0x49b6c4,_0x145efd[_0x689e('0x3e')]);var _0x35926f={'where':_0x49b6c4[_0x689e('0x38')]};return db[_0x689e('0x3f')][_0x689e('0x1c')](_0x35926f)[_0x689e('0x21')](function(_0x50cd4b){_0x5dde06['count']=_0x50cd4b;if(_0x145efd['query'][_0x689e('0x40')]){_0x49b6c4[_0x689e('0x41')]=[{'all':!![]}];}return db[_0x689e('0x3f')][_0x689e('0x42')](_0x49b6c4);})['then'](function(_0x33b6fa){_0x5dde06[_0x689e('0x43')]=_0x33b6fa;return _0x5dde06;})[_0x689e('0x21')](respondWithFilteredResult(_0x4aa6d8,_0x49b6c4))[_0x689e('0x44')](handleError(_0x4aa6d8,null));};exports[_0x689e('0x45')]=function(_0x1a00ea,_0x4dcbc0){var _0x371dbe={'raw':!![],'where':{'id':_0x1a00ea[_0x689e('0x46')]['id']}},_0x67fad9={};_0x67fad9['model']=_[_0x689e('0x2e')](db[_0x689e('0x3f')][_0x689e('0x29')]);_0x67fad9[_0x689e('0x2d')]=_[_0x689e('0x2e')](_0x1a00ea['query']);_0x67fad9[_0x689e('0x2f')]=_['intersection'](_0x67fad9['model'],_0x67fad9[_0x689e('0x2d')]);_0x371dbe[_0x689e('0x32')]=_[_0x689e('0x30')](_0x67fad9[_0x689e('0x2c')],qs[_0x689e('0x31')](_0x1a00ea[_0x689e('0x2d')][_0x689e('0x31')]));_0x371dbe[_0x689e('0x32')]=_0x371dbe[_0x689e('0x32')]['length']?_0x371dbe[_0x689e('0x32')]:_0x67fad9[_0x689e('0x2c')];if(_0x1a00ea[_0x689e('0x2d')][_0x689e('0x40')]){_0x371dbe[_0x689e('0x41')]=[{'all':!![]}];}_0x371dbe=_[_0x689e('0x3b')]({},_0x371dbe,_0x1a00ea[_0x689e('0x3e')]);return db['JscriptySessionReport'][_0x689e('0x47')](_0x371dbe)[_0x689e('0x21')](handleEntityNotFound(_0x4dcbc0,null))[_0x689e('0x21')](respondWithResult(_0x4dcbc0,null))[_0x689e('0x44')](handleError(_0x4dcbc0,null));};exports['create']=function(_0x23bd2d,_0x1c4472){return db['JscriptySessionReport'][_0x689e('0x48')](_0x23bd2d[_0x689e('0x49')],{})[_0x689e('0x21')](respondWithResult(_0x1c4472,0xc9))[_0x689e('0x44')](handleError(_0x1c4472,null));};exports['update']=function(_0x37be4d,_0x47ec37){if(_0x37be4d[_0x689e('0x49')]['id']){delete _0x37be4d[_0x689e('0x49')]['id'];}return db[_0x689e('0x3f')][_0x689e('0x47')]({'where':{'id':_0x37be4d[_0x689e('0x46')]['id']}})[_0x689e('0x21')](handleEntityNotFound(_0x47ec37,null))[_0x689e('0x21')](saveUpdates(_0x37be4d[_0x689e('0x49')],null))['then'](respondWithResult(_0x47ec37,null))[_0x689e('0x44')](handleError(_0x47ec37,null));};exports[_0x689e('0x22')]=function(_0x46c212,_0x3b1163){return db[_0x689e('0x3f')][_0x689e('0x47')]({'where':{'id':_0x46c212[_0x689e('0x46')]['id']}})[_0x689e('0x21')](handleEntityNotFound(_0x3b1163,null))['then'](removeEntity(_0x3b1163,null))['catch'](handleError(_0x3b1163,null));};exports['describe']=function(_0x36e0bf,_0x3ae3c9){return db[_0x689e('0x3f')][_0x689e('0x4a')]()[_0x689e('0x21')](respondWithResult(_0x3ae3c9,null))['catch'](handleError(_0x3ae3c9,null));};exports[_0x689e('0x4b')]=function(_0x9e904a,_0x28fc18,_0x2c9fe3){var _0x277a62={'raw':!![],'where':{}};var _0x585adc={};var _0x378220={'count':0x0,'rows':[]};return db[_0x689e('0x3f')][_0x689e('0x4c')]({'where':{'id':_0x9e904a[_0x689e('0x46')]['id']}})[_0x689e('0x21')](handleEntityNotFound(_0x28fc18,null))[_0x689e('0x21')](function(_0x35203f){if(_0x35203f){_0x585adc[_0x689e('0x2c')]=_[_0x689e('0x2e')](db[_0x689e('0x4d')][_0x689e('0x29')]);_0x585adc[_0x689e('0x2d')]=_[_0x689e('0x2e')](_0x9e904a[_0x689e('0x2d')]);_0x585adc[_0x689e('0x2f')]=_[_0x689e('0x30')](_0x585adc[_0x689e('0x2c')],_0x585adc[_0x689e('0x2d')]);_0x277a62[_0x689e('0x32')]=_['intersection'](_0x585adc[_0x689e('0x2c')],qs[_0x689e('0x31')](_0x9e904a[_0x689e('0x2d')][_0x689e('0x31')]));_0x277a62[_0x689e('0x32')]=_0x277a62[_0x689e('0x32')][_0x689e('0x33')]?_0x277a62[_0x689e('0x32')]:_0x585adc['model'];if(!_0x9e904a[_0x689e('0x2d')][_0x689e('0x34')](_0x689e('0x4e'))){_0x277a62[_0x689e('0x1b')]=qs[_0x689e('0x1b')](_0x9e904a['query'][_0x689e('0x1b')]);_0x277a62[_0x689e('0x35')]=qs[_0x689e('0x35')](_0x9e904a['query'][_0x689e('0x35')]);}_0x277a62['order']=qs[_0x689e('0x37')](_0x9e904a['query'][_0x689e('0x37')]);_0x277a62[_0x689e('0x38')]=qs[_0x689e('0x2f')](_[_0x689e('0x39')](_0x9e904a[_0x689e('0x2d')],_0x585adc['filters']));_0x277a62[_0x689e('0x38')][_0x689e('0x4f')]=_0x35203f['id'];if(_0x9e904a[_0x689e('0x2d')][_0x689e('0x3a')]){_0x277a62[_0x689e('0x38')]=_['merge'](_0x277a62[_0x689e('0x38')],{'$or':_[_0x689e('0x28')](_0x277a62[_0x689e('0x32')],function(_0x5a293b){var _0x2ebabf={};_0x2ebabf[_0x5a293b]={'$like':'%'+_0x9e904a[_0x689e('0x2d')][_0x689e('0x3a')]+'%'};return _0x2ebabf;})});}_0x277a62=_[_0x689e('0x3b')]({},_0x277a62,_0x9e904a[_0x689e('0x3e')]);return db[_0x689e('0x4d')]['count']({'where':_0x277a62['where']})[_0x689e('0x21')](function(_0x4c4141){_0x378220[_0x689e('0x1c')]=_0x4c4141;if(_0x9e904a[_0x689e('0x2d')][_0x689e('0x40')]){_0x277a62[_0x689e('0x41')]=[{'all':!![]}];}return db[_0x689e('0x4d')][_0x689e('0x42')](_0x277a62);})['then'](function(_0x26e049){_0x378220[_0x689e('0x43')]=_0x26e049;return _0x378220;});}})[_0x689e('0x21')](respondWithFilteredResult(_0x28fc18,_0x277a62))[_0x689e('0x44')](handleError(_0x28fc18,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 75153af..c50f797 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 _0x8f9d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x5ebd6e,_0x46633e){var _0x3cbde1=function(_0x5fe20e){while(--_0x5fe20e){_0x5ebd6e['push'](_0x5ebd6e['shift']());}};_0x3cbde1(++_0x46633e);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'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(_0x380419,_0x3e2689){var _0x21e2eb=function(_0x1d1c5c){while(--_0x1d1c5c){_0x380419['push'](_0x380419['shift']());}};_0x21e2eb(++_0x3e2689);}(_0x2d72,0xa8));var _0x22d7=function(_0x31433c,_0x40040a){_0x31433c=_0x31433c-0x0;var _0x5bfc33=_0x2d72[_0x31433c];return _0x5bfc33;};'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 e57d7be..80d8515 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 _0x81c6=['stringify','code','error','message','info','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x81c6,0x1d5));var _0x681c=function(_0x3917d3,_0xab2510){_0x3917d3=_0x3917d3-0x0;var _0x36b6fa=_0x81c6[_0x3917d3];return _0x36b6fa;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});} \ No newline at end of file +var _0x7a54=['info','JscriptySessionReport,\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(_0x3b6d41,_0x3b117a){_0x3b6d41=_0x3b6d41-0x0;var _0x1b8586=_0x7a54[_0x3b6d41];return _0x1b8586;};'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')]('JscriptySessionReport,\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/license/index.js b/server/api/license/index.js index 9761737..8438308 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 _0x8692=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','update','/download_log_file','exports','util','path','connect-timeout','express'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x8692,0xbf));var _0x2869=function(_0x25b0c9,_0x598bcf){_0x25b0c9=_0x25b0c9-0x0;var _0x43885f=_0x8692[_0x25b0c9];return _0x43885f;};'use strict';var multer=require('multer');var util=require(_0x2869('0x0'));var path=require(_0x2869('0x1'));var timeout=require(_0x2869('0x2'));var express=require(_0x2869('0x3'));var router=express[_0x2869('0x4')]();var fs_extra=require(_0x2869('0x5'));var auth=require(_0x2869('0x6'));var interaction=require(_0x2869('0x7'));var config=require(_0x2869('0x8'));var controller=require('./license.controller');router[_0x2869('0x9')]('/',controller[_0x2869('0xa')]);router['put']('/:id',auth[_0x2869('0xb')](),controller[_0x2869('0xc')]);router[_0x2869('0x9')](_0x2869('0xd'),auth[_0x2869('0xb')](),controller['downloadLogFile']);module[_0x2869('0xe')]=router; \ No newline at end of file +var _0x907c=['put','/:id','isAuthenticated','update','downloadLogFile','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x4efbdd,_0x3c6c4f){var _0x3c5ef2=function(_0x15d1d9){while(--_0x15d1d9){_0x4efbdd['push'](_0x4efbdd['shift']());}};_0x3c5ef2(++_0x3c6c4f);}(_0x907c,0xad));var _0xc907=function(_0x8062c2,_0x3cc303){_0x8062c2=_0x8062c2-0x0;var _0x597834=_0x907c[_0x8062c2];return _0x597834;};'use strict';var multer=require('multer');var util=require(_0xc907('0x0'));var path=require(_0xc907('0x1'));var timeout=require(_0xc907('0x2'));var express=require(_0xc907('0x3'));var router=express['Router']();var fs_extra=require(_0xc907('0x4'));var auth=require(_0xc907('0x5'));var interaction=require(_0xc907('0x6'));var config=require(_0xc907('0x7'));var controller=require(_0xc907('0x8'));router['get']('/',controller['index']);router[_0xc907('0x9')](_0xc907('0xa'),auth[_0xc907('0xb')](),controller[_0xc907('0xc')]);router['get']('/download_log_file',auth[_0xc907('0xb')](),controller[_0xc907('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 95d1c73..2cbb2a3 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 _0x75c1=['TEXT','STRING','INTEGER','sequelize'];(function(_0x258a29,_0x309152){var _0x49261b=function(_0x5e897a){while(--_0x5e897a){_0x258a29['push'](_0x258a29['shift']());}};_0x49261b(++_0x309152);}(_0x75c1,0x1a3));var _0x175c=function(_0x49c792,_0x45bd7d){_0x49c792=_0x49c792-0x0;var _0x2ca401=_0x75c1[_0x49c792];return _0x2ca401;};'use strict';var Sequelize=require(_0x175c('0x0'));module['exports']={'license':{'type':Sequelize[_0x175c('0x1')]},'data1':{'type':Sequelize[_0x175c('0x2')]},'data2':{'type':Sequelize[_0x175c('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x175c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b09=['STRING','sequelize','TEXT'];(function(_0x1fc247,_0x124956){var _0x51635a=function(_0x389da9){while(--_0x389da9){_0x1fc247['push'](_0x1fc247['shift']());}};_0x51635a(++_0x124956);}(_0x2b09,0xcd));var _0x92b0=function(_0xfacbf8,_0x4fe73b){_0xfacbf8=_0xfacbf8-0x0;var _0x36875d=_0x2b09[_0xfacbf8];return _0x36875d;};'use strict';var Sequelize=require(_0x92b0('0x0'));module['exports']={'license':{'type':Sequelize[_0x92b0('0x1')]},'data1':{'type':Sequelize[_0x92b0('0x2')]},'data2':{'type':Sequelize[_0x92b0('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 1fdd3c9..bdabf7b 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 _0x9c10=['request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','catch','body','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch'];(function(_0x548ccb,_0x1fab15){var _0x2f7701=function(_0x92da09){while(--_0x92da09){_0x548ccb['push'](_0x548ccb['shift']());}};_0x2f7701(++_0x1fab15);}(_0x9c10,0x1a7));var _0x09c1=function(_0xb41555,_0x1dd63e){_0xb41555=_0xb41555-0x0;var _0x5b2406=_0x9c10[_0xb41555];return _0x5b2406;};'use strict';var emlformat=require(_0x09c1('0x0'));var rimraf=require(_0x09c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09c1('0x2'));var rp=require(_0x09c1('0x3'));var moment=require(_0x09c1('0x4'));var BPromise=require(_0x09c1('0x5'));var Mustache=require('mustache');var util=require(_0x09c1('0x6'));var path=require(_0x09c1('0x7'));var sox=require(_0x09c1('0x8'));var csv=require('to-csv');var ejs=require(_0x09c1('0x9'));var fs=require('fs');var fs_extra=require(_0x09c1('0xa'));var _=require(_0x09c1('0xb'));var squel=require(_0x09c1('0xc'));var crypto=require('crypto');var jsforce=require(_0x09c1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x09c1('0xe'));var Papa=require(_0x09c1('0xf'));var Redis=require('ioredis');var authService=require(_0x09c1('0x10'));var qs=require(_0x09c1('0x11'));var as=require(_0x09c1('0x12'));var hardwareService=require(_0x09c1('0x13'));var logger=require(_0x09c1('0x14'))(_0x09c1('0x15'));var utils=require(_0x09c1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x09c1('0x17'));var db=require(_0x09c1('0x18'))['db'];function respondWithStatusCode(_0x5cccf2,_0x392907){_0x392907=_0x392907||0xcc;return function(_0x375bab){if(_0x375bab){return _0x5cccf2['sendStatus'](_0x392907);}return _0x5cccf2[_0x09c1('0x19')](_0x392907)[_0x09c1('0x1a')]();};}function respondWithResult(_0x38dd39,_0x2a3083){_0x2a3083=_0x2a3083||0xc8;return function(_0x3b8ec1){if(_0x3b8ec1){return _0x38dd39[_0x09c1('0x19')](_0x2a3083)['json'](_0x3b8ec1);}};}function respondWithFilteredResult(_0x4e280f,_0x4e1bb0){return function(_0x4e059a){if(_0x4e059a){var _0x37e3a2=typeof _0x4e1bb0[_0x09c1('0x1b')]===_0x09c1('0x1c')&&typeof _0x4e1bb0[_0x09c1('0x1d')]===_0x09c1('0x1c');var _0x318838=_0x4e059a[_0x09c1('0x1e')];var _0xb8125d=_0x37e3a2?0x0:_0x4e1bb0[_0x09c1('0x1b')];var _0x2795e1=_0x37e3a2?_0x4e059a[_0x09c1('0x1e')]:_0x4e1bb0[_0x09c1('0x1b')]+_0x4e1bb0[_0x09c1('0x1d')];var _0x5766b9;if(_0x2795e1>=_0x318838){_0x2795e1=_0x318838;_0x5766b9=0xc8;}else{_0x5766b9=0xce;}_0x4e280f[_0x09c1('0x19')](_0x5766b9);return _0x4e280f[_0x09c1('0x1f')]('Content-Range',_0xb8125d+'-'+_0x2795e1+'/'+_0x318838)[_0x09c1('0x20')](_0x4e059a);}return null;};}function patchUpdates(_0x3accb3){return function(_0x4f1205){try{jsonpatch[_0x09c1('0x21')](_0x4f1205,_0x3accb3,!![]);}catch(_0x436cc3){return BPromise[_0x09c1('0x22')](_0x436cc3);}return _0x4f1205[_0x09c1('0x23')]();};}function saveUpdates(_0x58070e,_0x4f908d){return function(_0x59e7fe){if(_0x59e7fe){return _0x59e7fe[_0x09c1('0x24')](_0x58070e)['then'](function(_0x19fe06){return _0x19fe06;});}return null;};}function removeEntity(_0xb9c69,_0x954815){return function(_0x10beda){if(_0x10beda){return _0x10beda[_0x09c1('0x25')]()[_0x09c1('0x26')](function(){_0xb9c69[_0x09c1('0x19')](0xcc)[_0x09c1('0x1a')]();});}};}function handleEntityNotFound(_0xe7be25,_0x47d794){return function(_0x91874e){if(!_0x91874e){_0xe7be25[_0x09c1('0x27')](0x194);}return _0x91874e;};}function handleError(_0x384a8a,_0x1a8acb){_0x1a8acb=_0x1a8acb||0x1f4;return function(_0x4bc1dc){logger[_0x09c1('0x28')](_0x4bc1dc['stack']);if(_0x4bc1dc[_0x09c1('0x29')]){delete _0x4bc1dc[_0x09c1('0x29')];}_0x384a8a[_0x09c1('0x19')](_0x1a8acb)[_0x09c1('0x2a')](_0x4bc1dc);};}var utilLicense=require('../../config/license/util');exports[_0x09c1('0x2b')]=function(_0x174ed7,_0x5d9961){var _0x1e75ca={'raw':!![],'where':{'id':0x1}},_0x558213={};_0x558213[_0x09c1('0x2c')]=_[_0x09c1('0x2d')](db[_0x09c1('0x2e')][_0x09c1('0x2f')]);_0x558213[_0x09c1('0x30')]=_[_0x09c1('0x2d')](_0x174ed7[_0x09c1('0x30')]);_0x558213[_0x09c1('0x31')]=_[_0x09c1('0x32')](_0x558213[_0x09c1('0x2c')],_0x558213[_0x09c1('0x30')]);_0x1e75ca['attributes']=_[_0x09c1('0x32')](_0x558213[_0x09c1('0x2c')],qs[_0x09c1('0x33')](_0x174ed7[_0x09c1('0x30')][_0x09c1('0x33')]));_0x1e75ca[_0x09c1('0x34')]=_0x1e75ca['attributes'][_0x09c1('0x35')]?_0x1e75ca[_0x09c1('0x34')]:_0x558213[_0x09c1('0x2c')];_0x1e75ca=_['merge']({},_0x1e75ca,_0x174ed7['options']);return utilLicense['getLicense'](_0x1e75ca)['then'](respondWithResult(_0x5d9961,null))[_0x09c1('0x36')](handleError(_0x5d9961,null));};exports[_0x09c1('0x24')]=function(_0x37c4b8,_0x4cf4ec){if(_0x37c4b8['body']['id']){delete _0x37c4b8[_0x09c1('0x37')]['id'];}return db[_0x09c1('0x2e')]['find']({'where':{'id':_0x37c4b8[_0x09c1('0x38')]['id']}})[_0x09c1('0x26')](handleEntityNotFound(_0x4cf4ec,null))[_0x09c1('0x26')](function(_0x1c7e7f){var _0x562151=_0x1c7e7f[_0x09c1('0x39')]({'plain':!![]});return utilLicense[_0x09c1('0x3a')](_0x562151,_0x37c4b8[_0x09c1('0x37')][_0x09c1('0x3b')]);})[_0x09c1('0x26')](function(_0x4a7c76){if(!_0x4a7c76['demo']){return saveUpdates(_0x37c4b8[_0x09c1('0x37')],null);}return _0x4a7c76;})[_0x09c1('0x26')](respondWithResult(_0x4cf4ec,null))[_0x09c1('0x36')](handleError(_0x4cf4ec,null));};exports[_0x09c1('0x3c')]=function(_0x580424,_0xe2716c){var _0x1198b3=_0x09c1('0x3d');var _0x1b914b=path[_0x09c1('0x3e')](_0x09c1('0x3f'),_0x09c1('0x40'),'xcally',_0x1198b3);_0xe2716c[_0x09c1('0x41')](_0x09c1('0x42'),_0x09c1('0x43')+_0x1198b3);_0xe2716c[_0x09c1('0x1f')](_0x09c1('0x44'),_0x09c1('0x45'));_0xe2716c[_0x09c1('0x46')](_0x1b914b);}; \ No newline at end of file +var _0x2f63=['body','find','params','checkLicense','key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','getLicense','catch'];(function(_0x1edcc4,_0x38dd4c){var _0x2c5aef=function(_0x4b7da4){while(--_0x4b7da4){_0x1edcc4['push'](_0x1edcc4['shift']());}};_0x2c5aef(++_0x38dd4c);}(_0x2f63,0x1c1));var _0x32f6=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x2f63[_0x1505e5];return _0x5b1dcd;};'use strict';var emlformat=require(_0x32f6('0x0'));var rimraf=require(_0x32f6('0x1'));var zipdir=require(_0x32f6('0x2'));var jsonpatch=require(_0x32f6('0x3'));var rp=require(_0x32f6('0x4'));var moment=require(_0x32f6('0x5'));var BPromise=require(_0x32f6('0x6'));var Mustache=require(_0x32f6('0x7'));var util=require(_0x32f6('0x8'));var path=require(_0x32f6('0x9'));var sox=require('sox');var csv=require(_0x32f6('0xa'));var ejs=require(_0x32f6('0xb'));var fs=require('fs');var fs_extra=require(_0x32f6('0xc'));var _=require(_0x32f6('0xd'));var squel=require('squel');var crypto=require(_0x32f6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x32f6('0xa'));var querystring=require(_0x32f6('0xf'));var Papa=require(_0x32f6('0x10'));var Redis=require('ioredis');var authService=require(_0x32f6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x32f6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32f6('0x13'))(_0x32f6('0x14'));var utils=require(_0x32f6('0x15'));var config=require(_0x32f6('0x16'));var licenseUtil=require(_0x32f6('0x17'));var db=require(_0x32f6('0x18'))['db'];function respondWithStatusCode(_0x3e7d00,_0x1ebf70){_0x1ebf70=_0x1ebf70||0xcc;return function(_0x13c394){if(_0x13c394){return _0x3e7d00[_0x32f6('0x19')](_0x1ebf70);}return _0x3e7d00[_0x32f6('0x1a')](_0x1ebf70)[_0x32f6('0x1b')]();};}function respondWithResult(_0x1be70e,_0x203722){_0x203722=_0x203722||0xc8;return function(_0x4f8988){if(_0x4f8988){return _0x1be70e[_0x32f6('0x1a')](_0x203722)[_0x32f6('0x1c')](_0x4f8988);}};}function respondWithFilteredResult(_0x3daf25,_0x1e8ea5){return function(_0x9b9897){if(_0x9b9897){var _0x2f371e=typeof _0x1e8ea5[_0x32f6('0x1d')]===_0x32f6('0x1e')&&typeof _0x1e8ea5[_0x32f6('0x1f')]==='undefined';var _0x541bc7=_0x9b9897[_0x32f6('0x20')];var _0x59514a=_0x2f371e?0x0:_0x1e8ea5[_0x32f6('0x1d')];var _0x5cdc93=_0x2f371e?_0x9b9897[_0x32f6('0x20')]:_0x1e8ea5[_0x32f6('0x1d')]+_0x1e8ea5[_0x32f6('0x1f')];var _0x3a7876;if(_0x5cdc93>=_0x541bc7){_0x5cdc93=_0x541bc7;_0x3a7876=0xc8;}else{_0x3a7876=0xce;}_0x3daf25[_0x32f6('0x1a')](_0x3a7876);return _0x3daf25[_0x32f6('0x21')](_0x32f6('0x22'),_0x59514a+'-'+_0x5cdc93+'/'+_0x541bc7)['json'](_0x9b9897);}return null;};}function patchUpdates(_0x4241ca){return function(_0x1a4857){try{jsonpatch[_0x32f6('0x23')](_0x1a4857,_0x4241ca,!![]);}catch(_0x33b0d7){return BPromise[_0x32f6('0x24')](_0x33b0d7);}return _0x1a4857['save']();};}function saveUpdates(_0x17a284,_0x3ed71e){return function(_0x30b6cf){if(_0x30b6cf){return _0x30b6cf['update'](_0x17a284)[_0x32f6('0x25')](function(_0x82b468){return _0x82b468;});}return null;};}function removeEntity(_0xba01f2,_0x171c19){return function(_0x5e1542){if(_0x5e1542){return _0x5e1542[_0x32f6('0x26')]()[_0x32f6('0x25')](function(){_0xba01f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x584424,_0x19bbd2){return function(_0xb38806){if(!_0xb38806){_0x584424[_0x32f6('0x19')](0x194);}return _0xb38806;};}function handleError(_0x37afc8,_0x51f40f){_0x51f40f=_0x51f40f||0x1f4;return function(_0x181338){logger[_0x32f6('0x27')](_0x181338[_0x32f6('0x28')]);if(_0x181338[_0x32f6('0x29')]){delete _0x181338['name'];}_0x37afc8[_0x32f6('0x1a')](_0x51f40f)['send'](_0x181338);};}var utilLicense=require('../../config/license/util');exports[_0x32f6('0x2a')]=function(_0x4c2fae,_0x3ab42e){var _0xd1e2c3={'raw':!![],'where':{'id':0x1}},_0x18d400={};_0x18d400[_0x32f6('0x2b')]=_[_0x32f6('0x2c')](db[_0x32f6('0x2d')][_0x32f6('0x2e')]);_0x18d400['query']=_[_0x32f6('0x2c')](_0x4c2fae[_0x32f6('0x2f')]);_0x18d400[_0x32f6('0x30')]=_[_0x32f6('0x31')](_0x18d400[_0x32f6('0x2b')],_0x18d400[_0x32f6('0x2f')]);_0xd1e2c3['attributes']=_[_0x32f6('0x31')](_0x18d400[_0x32f6('0x2b')],qs['fields'](_0x4c2fae[_0x32f6('0x2f')][_0x32f6('0x32')]));_0xd1e2c3[_0x32f6('0x33')]=_0xd1e2c3[_0x32f6('0x33')][_0x32f6('0x34')]?_0xd1e2c3[_0x32f6('0x33')]:_0x18d400[_0x32f6('0x2b')];_0xd1e2c3=_['merge']({},_0xd1e2c3,_0x4c2fae['options']);return utilLicense[_0x32f6('0x35')](_0xd1e2c3)['then'](respondWithResult(_0x3ab42e,null))[_0x32f6('0x36')](handleError(_0x3ab42e,null));};exports['update']=function(_0x2b2b64,_0x1558e7){if(_0x2b2b64[_0x32f6('0x37')]['id']){delete _0x2b2b64[_0x32f6('0x37')]['id'];}return db[_0x32f6('0x2d')][_0x32f6('0x38')]({'where':{'id':_0x2b2b64[_0x32f6('0x39')]['id']}})[_0x32f6('0x25')](handleEntityNotFound(_0x1558e7,null))[_0x32f6('0x25')](function(_0x5dd8d8){var _0x27aa45=_0x5dd8d8['get']({'plain':!![]});return utilLicense[_0x32f6('0x3a')](_0x27aa45,_0x2b2b64['body'][_0x32f6('0x3b')]);})['then'](function(_0x3b22ff){if(!_0x3b22ff[_0x32f6('0x3c')]){return saveUpdates(_0x2b2b64[_0x32f6('0x37')],null);}return _0x3b22ff;})[_0x32f6('0x25')](respondWithResult(_0x1558e7,null))[_0x32f6('0x36')](handleError(_0x1558e7,null));};exports[_0x32f6('0x3d')]=function(_0x9d9008,_0x51c628){var _0x4519ac='license-info.log';var _0x4fff75=path[_0x32f6('0x3e')](_0x32f6('0x3f'),_0x32f6('0x40'),_0x32f6('0x41'),_0x4519ac);_0x51c628[_0x32f6('0x42')](_0x32f6('0x43'),_0x32f6('0x44')+_0x4519ac);_0x51c628[_0x32f6('0x21')](_0x32f6('0x45'),_0x32f6('0x46'));_0x51c628[_0x32f6('0x47')](_0x4fff75);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 573ad75..f0c558f 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 _0x0fa3=['rimraf','exports','define','License','license','lodash','util','api','moment','bluebird','request-promise'];(function(_0xd86794,_0x678771){var _0x4dd2ce=function(_0x194dac){while(--_0x194dac){_0xd86794['push'](_0xd86794['shift']());}};_0x4dd2ce(++_0x678771);}(_0x0fa3,0x1e9));var _0x30fa=function(_0x198fc6,_0x5eaee9){_0x198fc6=_0x198fc6-0x0;var _0x4376bb=_0x0fa3[_0x198fc6];return _0x4376bb;};'use strict';var _=require(_0x30fa('0x0'));var util=require(_0x30fa('0x1'));var logger=require('../../config/logger')(_0x30fa('0x2'));var moment=require(_0x30fa('0x3'));var BPromise=require(_0x30fa('0x4'));var rp=require(_0x30fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30fa('0x6'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x30fa('0x7')]=function(_0x17bd30,_0x437439){return _0x17bd30[_0x30fa('0x8')](_0x30fa('0x9'),attributes,{'tableName':_0x30fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd599=['./license.attributes','exports','define','License','license','lodash','api','bluebird','request-promise','path','../../config/environment'];(function(_0x14474a,_0x5be492){var _0x1f8b71=function(_0x4a7acd){while(--_0x4a7acd){_0x14474a['push'](_0x14474a['shift']());}};_0x1f8b71(++_0x5be492);}(_0xd599,0x9f));var _0x9d59=function(_0x43bd3c,_0x32bfbd){_0x43bd3c=_0x43bd3c-0x0;var _0x1bcf75=_0xd599[_0x43bd3c];return _0x1bcf75;};'use strict';var _=require(_0x9d59('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d59('0x1'));var moment=require('moment');var BPromise=require(_0x9d59('0x2'));var rp=require(_0x9d59('0x3'));var fs=require('fs');var path=require(_0x9d59('0x4'));var rimraf=require('rimraf');var config=require(_0x9d59('0x5'));var attributes=require(_0x9d59('0x6'));module[_0x9d59('0x7')]=function(_0x16079b,_0x57b02a){return _0x16079b[_0x9d59('0x8')](_0x9d59('0x9'),attributes,{'tableName':_0x9d59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 7970234..b10f58c 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 _0x620e=['http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x17bbed,_0x14942c){var _0x526358=function(_0x213f53){while(--_0x213f53){_0x17bbed['push'](_0x17bbed['shift']());}};_0x526358(++_0x14942c);}(_0x620e,0x80));var _0xe620=function(_0x874bde,_0x14c3ec){_0x874bde=_0x874bde-0x0;var _0x2742a4=_0x620e[_0x874bde];return _0x2742a4;};'use strict';var _=require(_0xe620('0x0'));var util=require(_0xe620('0x1'));var moment=require(_0xe620('0x2'));var BPromise=require('bluebird');var rs=require(_0xe620('0x3'));var fs=require('fs');var Redis=require(_0xe620('0x4'));var db=require(_0xe620('0x5'))['db'];var utils=require(_0xe620('0x6'));var logger=require(_0xe620('0x7'))('rpc');var config=require(_0xe620('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe620('0x9')][_0xe620('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e83ab,_0x52ae9c,_0x2101f5){return new BPromise(function(_0x609143,_0x271bfb){return client[_0xe620('0xb')](_0x4e83ab,_0x2101f5)[_0xe620('0xc')](function(_0x4251cd){logger[_0xe620('0xd')]('License,\x20%s,\x20%s',_0x52ae9c,'request\x20sent');logger[_0xe620('0xe')](_0xe620('0xf'),_0x52ae9c,_0xe620('0x10'),JSON[_0xe620('0x11')](_0x4251cd));if(_0x4251cd['error']){if(_0x4251cd[_0xe620('0x12')]['code']===0x1f4){logger[_0xe620('0x12')](_0xe620('0x13'),_0x52ae9c,_0x4251cd[_0xe620('0x12')][_0xe620('0x14')]);return _0x271bfb(_0x4251cd[_0xe620('0x12')][_0xe620('0x14')]);}logger['error'](_0xe620('0x13'),_0x52ae9c,_0x4251cd[_0xe620('0x12')][_0xe620('0x14')]);return _0x609143(_0x4251cd[_0xe620('0x12')][_0xe620('0x14')]);}else{logger['info'](_0xe620('0x13'),_0x52ae9c,_0xe620('0x10'));_0x609143(_0x4251cd[_0xe620('0x15')][_0xe620('0x14')]);}})[_0xe620('0x16')](function(_0x1878f1){logger[_0xe620('0x12')](_0xe620('0x13'),_0x52ae9c,_0x1878f1);_0x271bfb(_0x1878f1);});});} \ No newline at end of file +var _0x0126=['rpc','../../config/environment','jayson/promise','client','http','request','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x468498,_0x2f0bc3){var _0x3c96f5=function(_0x268bd5){while(--_0x268bd5){_0x468498['push'](_0x468498['shift']());}};_0x3c96f5(++_0x2f0bc3);}(_0x0126,0xb2));var _0x6012=function(_0x4e42cf,_0x33fe5b){_0x4e42cf=_0x4e42cf-0x0;var _0x2223a6=_0x0126[_0x4e42cf];return _0x2223a6;};'use strict';var _=require(_0x6012('0x0'));var util=require('util');var moment=require(_0x6012('0x1'));var BPromise=require(_0x6012('0x2'));var rs=require(_0x6012('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6012('0x4'));var logger=require(_0x6012('0x5'))(_0x6012('0x6'));var config=require(_0x6012('0x7'));var jayson=require(_0x6012('0x8'));var client=jayson[_0x6012('0x9')][_0x6012('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e9e2a,_0x45f97c,_0x35bcc6){return new BPromise(function(_0x158b17,_0x3c173d){return client[_0x6012('0xb')](_0x3e9e2a,_0x35bcc6)['then'](function(_0x5855fb){logger['info']('License,\x20%s,\x20%s',_0x45f97c,'request\x20sent');logger[_0x6012('0xc')](_0x6012('0xd'),_0x45f97c,_0x6012('0xe'),JSON[_0x6012('0xf')](_0x5855fb));if(_0x5855fb[_0x6012('0x10')]){if(_0x5855fb[_0x6012('0x10')][_0x6012('0x11')]===0x1f4){logger[_0x6012('0x10')](_0x6012('0x12'),_0x45f97c,_0x5855fb[_0x6012('0x10')][_0x6012('0x13')]);return _0x3c173d(_0x5855fb[_0x6012('0x10')]['message']);}logger[_0x6012('0x10')]('License,\x20%s,\x20%s',_0x45f97c,_0x5855fb['error']['message']);return _0x158b17(_0x5855fb['error'][_0x6012('0x13')]);}else{logger[_0x6012('0x14')](_0x6012('0x12'),_0x45f97c,_0x6012('0xe'));_0x158b17(_0x5855fb[_0x6012('0x15')]['message']);}})[_0x6012('0x16')](function(_0x752b47){logger['error'](_0x6012('0x12'),_0x45f97c,_0x752b47);_0x3c173d(_0x752b47);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0a85de2..23bf7fb 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 _0x450d=['getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','addImap','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','/:id','destroy','removeAgents','exports','multer','util','connect-timeout','../../components/interaction/service','./mailAccount.controller','isAuthenticated','get','describe','show','/:id/canned_answers'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x450d,0x74));var _0xd450=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x450d[_0x369151];return _0x4292d5;};'use strict';var multer=require(_0xd450('0x0'));var util=require(_0xd450('0x1'));var path=require('path');var timeout=require(_0xd450('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd450('0x3'));var config=require('../../config/environment');var controller=require(_0xd450('0x4'));router['get']('/',auth[_0xd450('0x5')](),controller['index']);router[_0xd450('0x6')]('/describe',auth[_0xd450('0x5')](),controller[_0xd450('0x7')]);router[_0xd450('0x6')]('/:id',auth[_0xd450('0x5')](),controller[_0xd450('0x8')]);router[_0xd450('0x6')]('/:id/dispositions',auth[_0xd450('0x5')](),controller['getDispositions']);router[_0xd450('0x6')](_0xd450('0x9'),auth[_0xd450('0x5')](),controller[_0xd450('0xa')]);router[_0xd450('0x6')](_0xd450('0xb'),auth[_0xd450('0x5')](),controller['getImap']);router['get'](_0xd450('0xc'),auth[_0xd450('0x5')](),controller[_0xd450('0xd')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0xd450('0xe')]);router[_0xd450('0x6')](_0xd450('0xf'),auth[_0xd450('0x5')](),controller[_0xd450('0x10')]);router['get'](_0xd450('0x11'),auth['isAuthenticated'](),controller[_0xd450('0x12')]);router[_0xd450('0x6')](_0xd450('0x13'),auth[_0xd450('0x5')](),controller[_0xd450('0x14')]);router[_0xd450('0x6')]('/:id/users',auth[_0xd450('0x5')](),controller[_0xd450('0x15')]);router[_0xd450('0x16')](_0xd450('0x17'),auth[_0xd450('0x5')](),controller[_0xd450('0x18')]);router[_0xd450('0x16')](_0xd450('0x9'),auth[_0xd450('0x5')](),controller['addAnswer']);router[_0xd450('0x16')]('/',auth[_0xd450('0x5')](),controller['create']);router[_0xd450('0x16')](_0xd450('0xb'),auth['isAuthenticated'](),controller[_0xd450('0x19')]);router['post'](_0xd450('0xc'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xd450('0x16')](_0xd450('0x1a'),auth[_0xd450('0x5')](),controller[_0xd450('0x1b')]);router[_0xd450('0x16')](_0xd450('0xf'),auth[_0xd450('0x5')](),controller[_0xd450('0x1c')]);router['post'](_0xd450('0x1d'),auth[_0xd450('0x5')](),controller[_0xd450('0x1e')]);router[_0xd450('0x16')]('/:id/users',auth[_0xd450('0x5')](),controller[_0xd450('0x1f')]);router[_0xd450('0x20')]('/:id',auth[_0xd450('0x5')](),controller[_0xd450('0x21')]);router[_0xd450('0x22')](_0xd450('0x17'),auth[_0xd450('0x5')](),controller[_0xd450('0x23')]);router['delete'](_0xd450('0x9'),auth[_0xd450('0x5')](),controller['removeAnswers']);router[_0xd450('0x22')]('/:id/in_servers',auth[_0xd450('0x5')](),controller[_0xd450('0x24')]);router[_0xd450('0x22')]('/:id/out_servers',auth[_0xd450('0x5')](),controller[_0xd450('0x25')]);router[_0xd450('0x22')](_0xd450('0x26'),auth[_0xd450('0x5')](),controller[_0xd450('0x27')]);router[_0xd450('0x22')]('/:id/users',auth[_0xd450('0x5')](),controller[_0xd450('0x28')]);module[_0xd450('0x29')]=router; \ No newline at end of file +var _0xb0df=['post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','put','update','delete','removeDispositions','removeAnswers','removeImap','/:id','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','describe','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents'];(function(_0x5568fd,_0x50db00){var _0x3ebc=function(_0x61844d){while(--_0x61844d){_0x5568fd['push'](_0x5568fd['shift']());}};_0x3ebc(++_0x50db00);}(_0xb0df,0x153));var _0xfb0d=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xb0df[_0x3acee8];return _0x5046cc;};'use strict';var multer=require(_0xfb0d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfb0d('0x1'));var router=express[_0xfb0d('0x2')]();var fs_extra=require(_0xfb0d('0x3'));var auth=require(_0xfb0d('0x4'));var interaction=require(_0xfb0d('0x5'));var config=require(_0xfb0d('0x6'));var controller=require(_0xfb0d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfb0d('0x8')]);router[_0xfb0d('0x9')](_0xfb0d('0xa'),auth['isAuthenticated'](),controller[_0xfb0d('0xb')]);router['get']('/:id',auth[_0xfb0d('0xc')](),controller[_0xfb0d('0xd')]);router['get'](_0xfb0d('0xe'),auth[_0xfb0d('0xc')](),controller['getDispositions']);router[_0xfb0d('0x9')](_0xfb0d('0xf'),auth['isAuthenticated'](),controller[_0xfb0d('0x10')]);router['get'](_0xfb0d('0x11'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x12')]);router['get'](_0xfb0d('0x13'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x14')]);router['get'](_0xfb0d('0x15'),auth[_0xfb0d('0xc')](),controller['getInteractions']);router[_0xfb0d('0x9')](_0xfb0d('0x16'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x17')]);router[_0xfb0d('0x9')](_0xfb0d('0x18'),auth['isAuthenticated'](),controller[_0xfb0d('0x19')]);router['get']('/:id/verify',auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x1a')]);router[_0xfb0d('0x9')](_0xfb0d('0x1b'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x1c')]);router[_0xfb0d('0x1d')](_0xfb0d('0xe'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x1e')]);router['post'](_0xfb0d('0xf'),auth['isAuthenticated'](),controller[_0xfb0d('0x1f')]);router[_0xfb0d('0x1d')]('/',auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x20')]);router[_0xfb0d('0x1d')](_0xfb0d('0x11'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x21')]);router[_0xfb0d('0x1d')](_0xfb0d('0x13'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x22')]);router['post']('/:id/interactions',auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x23')]);router[_0xfb0d('0x1d')](_0xfb0d('0x16'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x24')]);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xfb0d('0x1d')](_0xfb0d('0x1b'),auth[_0xfb0d('0xc')](),controller['addAgents']);router[_0xfb0d('0x25')]('/:id',auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x26')]);router[_0xfb0d('0x27')](_0xfb0d('0xe'),auth['isAuthenticated'](),controller[_0xfb0d('0x28')]);router[_0xfb0d('0x27')](_0xfb0d('0xf'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x29')]);router[_0xfb0d('0x27')](_0xfb0d('0x11'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x2a')]);router[_0xfb0d('0x27')](_0xfb0d('0x13'),auth[_0xfb0d('0xc')](),controller['removeSmtp']);router['delete'](_0xfb0d('0x2b'),auth[_0xfb0d('0xc')](),controller['destroy']);router['delete'](_0xfb0d('0x1b'),auth[_0xfb0d('0xc')](),controller[_0xfb0d('0x2c')]);module[_0xfb0d('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ae3828d..15a3d8a 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 _0x36b9=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1b0c7c,_0x468383){var _0x44f649=function(_0x56fbc6){while(--_0x56fbc6){_0x1b0c7c['push'](_0x1b0c7c['shift']());}};_0x44f649(++_0x468383);}(_0x36b9,0x132));var _0x936b=function(_0x28c384,_0x15c131){_0x28c384=_0x28c384-0x0;var _0x4c6974=_0x36b9[_0x28c384];return _0x4c6974;};'use strict';var Sequelize=require(_0x936b('0x0'));module[_0x936b('0x1')]={'description':{'type':Sequelize[_0x936b('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x936b('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x936b('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x936b('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x936b('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x936b('0x4')]},'markAsUnread':{'type':Sequelize[_0x936b('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x936b('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x936b('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x936b('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x936b('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x936b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x936b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x936b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x936b('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x936b('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x936b('0x9'),'set':function(_0x3f8196){if(!_0x3f8196)this[_0x936b('0xa')](_0x936b('0xb'),null);this[_0x936b('0xa')](_0x936b('0xc'),_0x3f8196);}},'provider':{'type':Sequelize[_0x936b('0xd')](_0x936b('0xe'),_0x936b('0xf'),_0x936b('0x10'),_0x936b('0x11')),'defaultValue':null,'get':function(){if(!this[_0x936b('0x12')](_0x936b('0x13')))return _0x936b('0x14');return this['getDataValue'](_0x936b('0x13'));},'set':function(_0x21985d){if(_0x21985d===_0x936b('0x14'))_0x21985d=null;return this[_0x936b('0xa')](_0x936b('0x13'),_0x21985d);}}}; \ No newline at end of file +var _0x1b53=['provider','custom','getDataValue','setDataValue','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}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b53,0xe0));var _0x31b5=function(_0x24792d,_0x4b6de3){_0x24792d=_0x24792d-0x0;var _0x219e35=_0x1b53[_0x24792d];return _0x219e35;};'use strict';var Sequelize=require(_0x31b5('0x0'));module[_0x31b5('0x1')]={'description':{'type':Sequelize[_0x31b5('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x31b5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x31b5('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x31b5('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x31b5('0x2')],'allowNull':![],'defaultValue':_0x31b5('0x5')},'fontSize':{'type':Sequelize[_0x31b5('0x6')](0x2)[_0x31b5('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x31b5('0x4')],'defaultValue':function(){return _0x31b5('0x8');}},'notificationSound':{'type':Sequelize[_0x31b5('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x31b5('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x31b5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x31b5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x31b5('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x31b5('0x9'),'set':function(_0x12601c){if(!_0x12601c)this['setDataValue'](_0x31b5('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x12601c);}},'provider':{'type':Sequelize[_0x31b5('0xb')](_0x31b5('0xc'),_0x31b5('0xd'),_0x31b5('0xe'),_0x31b5('0xf')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x31b5('0x10')))return _0x31b5('0x11');return this[_0x31b5('0x12')](_0x31b5('0x10'));},'set':function(_0x601078){if(_0x601078===_0x31b5('0x11'))_0x601078=null;return this[_0x31b5('0x13')]('provider',_0x601078);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a33af23..c981d2f 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 _0x62a9=['keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','Pause','intersection','update','custom','provider','body','modernAuthentication','find','params','MailServerIn','Mail\x20Account\x20not\x20found','describe','create','getDispositions','findOne','Disposition','MailAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','Owner','fullname','Tags','color','tag','transaction','sequelize','Transaction','MailApplication','destroy','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','Contacts','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','../../components/parsers/qs','api','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','get','MailAccounts','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','CloudProviderId','host','port','secure','service','password','authentication','Imap','index','MailServerOut','Smtp','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','model','map','query'];(function(_0x23e6d6,_0x3fe925){var _0x531f33=function(_0x878f4f){while(--_0x878f4f){_0x23e6d6['push'](_0x23e6d6['shift']());}};_0x531f33(++_0x3fe925);}(_0x62a9,0x134));var _0x962a=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x62a9[_0x1d87fc];return _0x492b56;};'use strict';var moment=require('moment');var BPromise=require(_0x962a('0x0'));var util=require(_0x962a('0x1'));var path=require(_0x962a('0x2'));var _=require(_0x962a('0x3'));var juice=require(_0x962a('0x4'));var Redis=require('ioredis');var qs=require(_0x962a('0x5'));var logger=require('../../config/logger')(_0x962a('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x962a('0x7')]=_[_0x962a('0x8')](config[_0x962a('0x7')],{'host':_0x962a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x962a('0xa'))[_0x962a('0xb')](socket);var jayson=require(_0x962a('0xc'));var client=jayson['client'][_0x962a('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x3f98d0,_0x48df84,_0x28b97c,_0x5c07ab){return new BPromise(function(_0x5e3766,_0x12958f){var _0x1bb01c=_0x5c07ab||client;return _0x1bb01c[_0x962a('0xe')](_0x3f98d0,_0x28b97c)[_0x962a('0xf')](function(_0x2be5fc){logger[_0x962a('0x10')](_0x962a('0x11'),_0x48df84,_0x962a('0x12'));logger['debug'](_0x962a('0x13'),_0x48df84,'request\x20sent',JSON[_0x962a('0x14')](_0x2be5fc));if(_0x2be5fc[_0x962a('0x15')]){if(_0x2be5fc[_0x962a('0x15')][_0x962a('0x16')]===0x1f4){logger[_0x962a('0x15')](_0x962a('0x11'),_0x48df84,_0x2be5fc[_0x962a('0x15')][_0x962a('0x17')]);return _0x12958f(_0x2be5fc[_0x962a('0x15')][_0x962a('0x17')]);}logger[_0x962a('0x15')](_0x962a('0x11'),_0x48df84,_0x2be5fc[_0x962a('0x15')]['message']);return _0x5e3766(_0x2be5fc['error']['message']);}else{logger[_0x962a('0x10')]('MailAccount,\x20%s,\x20%s',_0x48df84,_0x962a('0x12'));_0x5e3766(_0x2be5fc[_0x962a('0x18')][_0x962a('0x17')]);}})[_0x962a('0x19')](function(_0x17f804){logger[_0x962a('0x15')]('MailAccount,\x20%s,\x20%s',_0x48df84,_0x17f804);_0x12958f(_0x17f804);});});}function respondWithStatusCode(_0x265d45,_0xf347ac){_0xf347ac=_0xf347ac||0xcc;return function(_0x3be799){if(_0x3be799){return _0x265d45[_0x962a('0x1a')](_0xf347ac);}return _0x265d45[_0x962a('0x1b')](_0xf347ac)[_0x962a('0x1c')]();};}function respondWithResult(_0x202f7a,_0x5bb55b){_0x5bb55b=_0x5bb55b||0xc8;return function(_0x1cc8b0){if(_0x1cc8b0){return _0x202f7a[_0x962a('0x1b')](_0x5bb55b)['json'](_0x1cc8b0);}};}function respondWithFilteredResult(_0x281ec6,_0x26f133){return function(_0x4c8e1d){if(_0x4c8e1d){var _0x173a30=typeof _0x26f133[_0x962a('0x1d')]===_0x962a('0x1e')&&typeof _0x26f133[_0x962a('0x1f')]==='undefined';var _0x221925=_0x4c8e1d['count'];var _0x44ec0c=_0x173a30?0x0:_0x26f133[_0x962a('0x1d')];var _0x5e6bb1=_0x173a30?_0x4c8e1d[_0x962a('0x20')]:_0x26f133[_0x962a('0x1d')]+_0x26f133[_0x962a('0x1f')];var _0x5bd083;if(_0x5e6bb1>=_0x221925){_0x5e6bb1=_0x221925;_0x5bd083=0xc8;}else{_0x5bd083=0xce;}_0x281ec6[_0x962a('0x1b')](_0x5bd083);return _0x281ec6[_0x962a('0x21')](_0x962a('0x22'),_0x44ec0c+'-'+_0x5e6bb1+'/'+_0x221925)[_0x962a('0x23')](_0x4c8e1d);}return null;};}function saveUpdates(_0x2508e3){return function(_0x4c40ef){if(_0x4c40ef){return _0x4c40ef['update'](_0x2508e3)[_0x962a('0xf')](function(_0x3c7ab0){return _0x3c7ab0;});}return null;};}function removeEntity(_0x48c6fa){return function(_0x14d0e2){if(_0x14d0e2){return _0x14d0e2['destroy']()['then'](function(){var _0x2e8afe=_0x14d0e2[_0x962a('0x24')]({'plain':!![]});var _0x2ba07f=_0x962a('0x25');return db[_0x962a('0x26')]['destroy']({'where':{'type':_0x2ba07f,'resourceId':_0x2e8afe['id']}})[_0x962a('0xf')](function(){return _0x14d0e2;});})[_0x962a('0xf')](function(){_0x48c6fa[_0x962a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598ee2){return function(_0x1b702e){if(!_0x1b702e){_0x598ee2[_0x962a('0x1a')](0x194);}return _0x1b702e;};}function handleError(_0x3b2e96,_0x4ede91){_0x4ede91=_0x4ede91||0x1f4;return function(_0x32454e){logger[_0x962a('0x15')](_0x32454e[_0x962a('0x27')]);if(_0x32454e[_0x962a('0x28')]){delete _0x32454e['name'];}_0x3b2e96[_0x962a('0x1b')](_0x4ede91)[_0x962a('0x29')](_0x32454e);};}function getImapHost(_0x5895d2){switch(_0x5895d2){case'gmail':return _0x962a('0x2a');case _0x962a('0x2b'):return _0x962a('0x2c');case _0x962a('0x2d'):return _0x962a('0x2e');case _0x962a('0x2f'):return _0x962a('0x30');}throw new Error(_0x962a('0x31'),_0x5895d2);}function getSmtpHost(_0x726118){switch(_0x726118){case'gmail':return _0x962a('0x32');case'yahoo':return _0x962a('0x33');case'hotmail':return _0x962a('0x34');case'outlook365':return _0x962a('0x35');}throw new Error(_0x962a('0x31'),_0x726118);}function getAuthenticationOptions(_0x2939e4,_0xbd8b94){var _0x532e80={};var _0xf57a16={};if(_0x2939e4){_0x532e80[_0x962a('0x36')]=_0xf57a16[_0x962a('0x36')]=_0xbd8b94[_0x962a('0x37')];_0x532e80['password']=_0xf57a16[_0x962a('0x38')]=_0xbd8b94['password'];if(_0xbd8b94['modernAuthentication']){_0x532e80['modernAuthentication']=_0xf57a16['modernAuthentication']=!![];_0x532e80[_0x962a('0x39')]=_0xf57a16['CloudProviderId']=_0xbd8b94[_0x962a('0x39')];_0x532e80['password']=_0xf57a16['pass']=null;}else{_0x532e80[_0x962a('0x39')]=_0xf57a16[_0x962a('0x39')]=null;}_0x532e80[_0x962a('0x3a')]=getImapHost(_0x2939e4);_0x532e80['port']=0x3e1;_0xf57a16[_0x962a('0x3a')]=getSmtpHost(_0x2939e4);_0xf57a16[_0x962a('0x3b')]=0x24b;_0xf57a16[_0x962a('0x3c')]=![];_0x532e80['service']=_0xf57a16[_0x962a('0x3d')]=null;}else{if(_0xbd8b94['authentication']){_0x532e80[_0x962a('0x36')]=_0xf57a16['user']=_0xbd8b94[_0x962a('0x37')];_0x532e80['password']=_0xf57a16[_0x962a('0x38')]=_0xbd8b94[_0x962a('0x3e')];}else{_0x532e80[_0x962a('0x3f')]=_0xf57a16[_0x962a('0x3f')]=![];_0x532e80[_0x962a('0x36')]=_0xf57a16[_0x962a('0x36')]=null;_0x532e80['password']=_0xf57a16[_0x962a('0x38')]=null;}_0x532e80['host']=_0xbd8b94[_0x962a('0x40')][_0x962a('0x3a')];_0x532e80['port']=_0xbd8b94[_0x962a('0x40')]['port'];_0xf57a16[_0x962a('0x3a')]=_0xbd8b94['Smtp'][_0x962a('0x3a')];_0xf57a16[_0x962a('0x3b')]=_0xbd8b94['Smtp']['port'];}return{'Imap':_0x532e80,'Smtp':_0xf57a16};}exports[_0x962a('0x41')]=function(_0x61f74e,_0x3752c4){var _0x1fc201={'include':[{'model':db['MailServerIn'],'as':_0x962a('0x40')},{'model':db[_0x962a('0x42')],'as':_0x962a('0x43')},{'model':db['Pause'],'as':_0x962a('0x44')}]},_0xc6b54={},_0x1e8203={'count':0x0,'rows':[]};var _0x5b5fa1=_['map'](db[_0x962a('0x45')][_0x962a('0x46')],function(_0x418703){return{'name':_0x418703[_0x962a('0x47')],'type':_0x418703['type'][_0x962a('0x48')]};});_0xc6b54[_0x962a('0x49')]=_[_0x962a('0x4a')](_0x5b5fa1,_0x962a('0x28'));_0xc6b54[_0x962a('0x4b')]=_[_0x962a('0x4c')](_0x61f74e[_0x962a('0x4b')]);_0xc6b54[_0x962a('0x4d')]=_['intersection'](_0xc6b54[_0x962a('0x49')],_0xc6b54['query']);_0x1fc201[_0x962a('0x4e')]=_['intersection'](_0xc6b54[_0x962a('0x49')],qs[_0x962a('0x4f')](_0x61f74e[_0x962a('0x4b')][_0x962a('0x4f')]));_0x1fc201[_0x962a('0x4e')]=_0x1fc201[_0x962a('0x4e')][_0x962a('0x50')]?_0x1fc201['attributes']:_0xc6b54['model'];if(!_0x61f74e[_0x962a('0x4b')][_0x962a('0x51')](_0x962a('0x52'))){_0x1fc201[_0x962a('0x1f')]=qs[_0x962a('0x1f')](_0x61f74e['query'][_0x962a('0x1f')]);_0x1fc201['offset']=qs[_0x962a('0x1d')](_0x61f74e[_0x962a('0x4b')]['offset']);}_0x1fc201[_0x962a('0x53')]=qs[_0x962a('0x54')](_0x61f74e[_0x962a('0x4b')][_0x962a('0x54')]);_0x1fc201[_0x962a('0x55')]=qs[_0x962a('0x4d')](_[_0x962a('0x56')](_0x61f74e[_0x962a('0x4b')],_0xc6b54[_0x962a('0x4d')]),_0x5b5fa1);if(_0x61f74e[_0x962a('0x4b')][_0x962a('0x57')]){_0x1fc201['where']=_[_0x962a('0x58')](_0x1fc201[_0x962a('0x55')],{'$or':_[_0x962a('0x4a')](_0x5b5fa1,function(_0x236890){if(_0x236890[_0x962a('0x59')]!==_0x962a('0x5a')){var _0x5cb056={};_0x5cb056[_0x236890[_0x962a('0x28')]]={'$like':'%'+_0x61f74e[_0x962a('0x4b')][_0x962a('0x57')]+'%'};return _0x5cb056;}})});}_0x1fc201=_['merge']({},_0x1fc201,_0x61f74e[_0x962a('0x5b')]);var _0x375f37={'where':_0x1fc201[_0x962a('0x55')]};return db[_0x962a('0x45')][_0x962a('0x20')](_0x375f37)[_0x962a('0xf')](function(_0x508f6a){_0x1e8203[_0x962a('0x20')]=_0x508f6a;if(_0x61f74e[_0x962a('0x4b')][_0x962a('0x5c')]){_0x1fc201[_0x962a('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x962a('0x5e')](_0x1fc201);})[_0x962a('0xf')](function(_0x5563ad){_0x1e8203[_0x962a('0x5f')]=_0x5563ad;return _0x1e8203;})[_0x962a('0xf')](respondWithFilteredResult(_0x3752c4,_0x1fc201))[_0x962a('0x19')](handleError(_0x3752c4,null));};exports['show']=function(_0x29e1d6,_0x3178bd){var _0x3bdf76={'raw':![],'where':{'id':_0x29e1d6['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x962a('0x40')},{'model':db[_0x962a('0x42')],'as':_0x962a('0x43')},{'model':db[_0x962a('0x60')],'as':_0x962a('0x44')}]},_0x33126f={};_0x33126f[_0x962a('0x49')]=_[_0x962a('0x4c')](db['MailAccount'][_0x962a('0x46')]);_0x33126f[_0x962a('0x4b')]=_[_0x962a('0x4c')](_0x29e1d6[_0x962a('0x4b')]);_0x33126f[_0x962a('0x4d')]=_[_0x962a('0x61')](_0x33126f[_0x962a('0x49')],_0x33126f[_0x962a('0x4b')]);_0x3bdf76[_0x962a('0x4e')]=_[_0x962a('0x61')](_0x33126f[_0x962a('0x49')],qs[_0x962a('0x4f')](_0x29e1d6[_0x962a('0x4b')][_0x962a('0x4f')]));_0x3bdf76['attributes']=_0x3bdf76[_0x962a('0x4e')][_0x962a('0x50')]?_0x3bdf76[_0x962a('0x4e')]:_0x33126f[_0x962a('0x49')];if(_0x29e1d6[_0x962a('0x4b')][_0x962a('0x5c')]){_0x3bdf76[_0x962a('0x5d')]=[{'all':!![]}];}_0x3bdf76=_[_0x962a('0x58')]({},_0x3bdf76,_0x29e1d6[_0x962a('0x5b')]);return db[_0x962a('0x45')]['find'](_0x3bdf76)[_0x962a('0xf')](handleEntityNotFound(_0x3178bd,null))[_0x962a('0xf')](respondWithResult(_0x3178bd,null))[_0x962a('0x19')](handleError(_0x3178bd,null));};exports[_0x962a('0x62')]=function(_0x34cdb9,_0xfae18d){if(_0x34cdb9['body']['id']){delete _0x34cdb9['body']['id'];}var _0x12cf06=_0x34cdb9['body']['provider']===_0x962a('0x63')?null:_0x34cdb9['body'][_0x962a('0x64')];var _0x2b17b6=_0x34cdb9['body'][_0x962a('0x40')]||{};var _0x5164b5=_0x34cdb9[_0x962a('0x65')][_0x962a('0x43')]||{};if(_0x12cf06){_0x2b17b6[_0x962a('0x3a')]=getImapHost(_0x12cf06);_0x2b17b6[_0x962a('0x3b')]=0x3e1;_0x5164b5[_0x962a('0x3a')]=getSmtpHost(_0x12cf06);_0x5164b5['port']=0x24b;_0x5164b5[_0x962a('0x3c')]=![];}if(_0x5164b5['modernAuthentication']){_0x5164b5[_0x962a('0x3c')]=![];}else{_0x5164b5[_0x962a('0x39')]=null;}if(!_0x2b17b6[_0x962a('0x66')])_0x2b17b6['CloudProviderId']=null;_0x34cdb9[_0x962a('0x65')][_0x962a('0x40')]=_0x2b17b6;_0x34cdb9[_0x962a('0x65')][_0x962a('0x43')]=_0x5164b5;return db['MailAccount'][_0x962a('0x67')]({'where':{'id':_0x34cdb9[_0x962a('0x68')]['id']},'include':[{'model':db[_0x962a('0x69')],'as':_0x962a('0x40')},{'model':db[_0x962a('0x42')],'as':_0x962a('0x43')},{'model':db[_0x962a('0x60')],'as':_0x962a('0x44')}]})[_0x962a('0xf')](handleEntityNotFound(_0xfae18d,null))[_0x962a('0xf')](function(_0x162bbc){if(!_0x162bbc)throw new Error(_0x962a('0x6a'));if(_0x162bbc[_0x962a('0x3d')])delete _0x34cdb9[_0x962a('0x65')]['Imap'];return _0x162bbc;})[_0x962a('0xf')](saveUpdates(_0x34cdb9['body'],null))[_0x962a('0xf')](function(_0x143ca6){if(!_0x34cdb9['body'][_0x962a('0x40')])return _0x143ca6;return db[_0x962a('0x69')][_0x962a('0x62')](_0x34cdb9[_0x962a('0x65')]['Imap'],{'where':{'MailAccountId':_0x143ca6['id']}})['then'](function(){return _0x143ca6;});})[_0x962a('0xf')](function(_0x537859){if(!_0x34cdb9[_0x962a('0x65')][_0x962a('0x43')])return _0x537859;return db['MailServerOut'][_0x962a('0x62')](_0x34cdb9['body'][_0x962a('0x43')],{'where':{'MailAccountId':_0x537859['id']}})[_0x962a('0xf')](function(){return _0x537859;});})['then'](respondWithResult(_0xfae18d,null))[_0x962a('0x19')](handleError(_0xfae18d,null));};exports[_0x962a('0x6b')]=function(_0x1aae0c,_0x5d8dae){return db['MailAccount'][_0x962a('0x6b')]()[_0x962a('0xf')](respondWithResult(_0x5d8dae,null))['catch'](handleError(_0x5d8dae,null));};exports['addDisposition']=function(_0x3f80d2,_0xf18dc2){if(_0x3f80d2[_0x962a('0x65')]['id']){delete _0x3f80d2['body']['id'];}return db['MailAccount'][_0x962a('0x67')]({'where':{'id':_0x3f80d2[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0xf18dc2,null))['then'](function(_0x240abb){if(_0x240abb){_0x3f80d2[_0x962a('0x65')]['MailAccountId']=_0x240abb['id'];return db['Disposition'][_0x962a('0x6c')](_0x3f80d2[_0x962a('0x65')]);}})['then'](respondWithResult(_0xf18dc2,null))[_0x962a('0x19')](handleError(_0xf18dc2,null));};exports[_0x962a('0x6d')]=function(_0x402045,_0x5ec9e3){var _0x3e0a41={'raw':![],'where':{}};var _0x36ca86={};var _0x411e63={'count':0x0,'rows':[]};return db['MailAccount'][_0x962a('0x6e')]({'where':{'id':_0x402045[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x5ec9e3,null))[_0x962a('0xf')](function(_0x5a5d88){if(_0x5a5d88){_0x36ca86[_0x962a('0x49')]=_[_0x962a('0x4c')](db[_0x962a('0x6f')][_0x962a('0x46')]);_0x36ca86[_0x962a('0x4b')]=_[_0x962a('0x4c')](_0x402045[_0x962a('0x4b')]);_0x36ca86['filters']=_[_0x962a('0x61')](_0x36ca86['model'],_0x36ca86[_0x962a('0x4b')]);_0x3e0a41[_0x962a('0x4e')]=_[_0x962a('0x61')](_0x36ca86[_0x962a('0x49')],qs[_0x962a('0x4f')](_0x402045[_0x962a('0x4b')][_0x962a('0x4f')]));_0x3e0a41[_0x962a('0x4e')]=_0x3e0a41[_0x962a('0x4e')][_0x962a('0x50')]?_0x3e0a41[_0x962a('0x4e')]:_0x36ca86[_0x962a('0x49')];if(!_0x402045[_0x962a('0x4b')][_0x962a('0x51')](_0x962a('0x52'))){_0x3e0a41['limit']=qs[_0x962a('0x1f')](_0x402045[_0x962a('0x4b')][_0x962a('0x1f')]);_0x3e0a41[_0x962a('0x1d')]=qs[_0x962a('0x1d')](_0x402045[_0x962a('0x4b')]['offset']);}_0x3e0a41['order']=qs[_0x962a('0x54')](_0x402045[_0x962a('0x4b')][_0x962a('0x54')]);_0x3e0a41[_0x962a('0x55')]=qs[_0x962a('0x4d')](_[_0x962a('0x56')](_0x402045[_0x962a('0x4b')],_0x36ca86['filters']));_0x3e0a41[_0x962a('0x55')][_0x962a('0x70')]=_0x5a5d88['id'];if(_0x402045[_0x962a('0x4b')]['filter']){_0x3e0a41[_0x962a('0x55')]=_[_0x962a('0x58')](_0x3e0a41[_0x962a('0x55')],{'$or':_['map'](_0x3e0a41[_0x962a('0x4e')],function(_0x47c214){var _0x572482={};_0x572482[_0x47c214]={'$like':'%'+_0x402045[_0x962a('0x4b')][_0x962a('0x57')]+'%'};return _0x572482;})});}_0x3e0a41=_['merge']({},_0x3e0a41,_0x402045[_0x962a('0x5b')]);return db['Disposition'][_0x962a('0x20')]({'where':_0x3e0a41[_0x962a('0x55')]})[_0x962a('0xf')](function(_0x1bbd83){_0x411e63['count']=_0x1bbd83;if(_0x402045[_0x962a('0x4b')][_0x962a('0x5c')]){_0x3e0a41[_0x962a('0x5d')]=[{'all':!![]}];}return db[_0x962a('0x6f')][_0x962a('0x5e')](_0x3e0a41);})[_0x962a('0xf')](function(_0x5ba0f9){_0x411e63[_0x962a('0x5f')]=_0x5ba0f9;return _0x411e63;});}})[_0x962a('0xf')](respondWithFilteredResult(_0x5ec9e3,_0x3e0a41))['catch'](handleError(_0x5ec9e3,null));};exports[_0x962a('0x71')]=function(_0x11be0c,_0x4ac837){return db[_0x962a('0x45')][_0x962a('0x67')]({'where':{'id':_0x11be0c[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x4ac837,null))[_0x962a('0xf')](function(_0x4550c1){if(_0x4550c1){return _0x4550c1[_0x962a('0x71')](_0x11be0c['query'][_0x962a('0x72')]);}})[_0x962a('0xf')](respondWithStatusCode(_0x4ac837,null))[_0x962a('0x19')](handleError(_0x4ac837,null));};exports['addAnswer']=function(_0x3ef8c7,_0x17458c){if(_0x3ef8c7[_0x962a('0x65')]['id']){delete _0x3ef8c7['body']['id'];}return db['MailAccount'][_0x962a('0x67')]({'where':{'id':_0x3ef8c7[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x17458c,null))['then'](function(_0x12c77f){if(_0x12c77f){_0x3ef8c7[_0x962a('0x65')][_0x962a('0x70')]=_0x12c77f['id'];return db[_0x962a('0x73')][_0x962a('0x6c')](_0x3ef8c7[_0x962a('0x65')]);}})[_0x962a('0xf')](respondWithResult(_0x17458c,null))['catch'](handleError(_0x17458c,null));};exports[_0x962a('0x74')]=function(_0x2a9e36,_0x4372ab){var _0x5d2091={'raw':![],'where':{}};var _0x1bb10d={};var _0x3184cb={'count':0x0,'rows':[]};return db[_0x962a('0x45')][_0x962a('0x6e')]({'where':{'id':_0x2a9e36[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x4372ab,null))[_0x962a('0xf')](function(_0x115531){if(_0x115531){_0x1bb10d[_0x962a('0x49')]=_['keys'](db['CannedAnswer'][_0x962a('0x46')]);_0x1bb10d['query']=_[_0x962a('0x4c')](_0x2a9e36[_0x962a('0x4b')]);_0x1bb10d['filters']=_['intersection'](_0x1bb10d[_0x962a('0x49')],_0x1bb10d[_0x962a('0x4b')]);_0x5d2091[_0x962a('0x4e')]=_[_0x962a('0x61')](_0x1bb10d[_0x962a('0x49')],qs[_0x962a('0x4f')](_0x2a9e36['query']['fields']));_0x5d2091[_0x962a('0x4e')]=_0x5d2091[_0x962a('0x4e')]['length']?_0x5d2091[_0x962a('0x4e')]:_0x1bb10d[_0x962a('0x49')];if(!_0x2a9e36[_0x962a('0x4b')]['hasOwnProperty'](_0x962a('0x52'))){_0x5d2091[_0x962a('0x1f')]=qs[_0x962a('0x1f')](_0x2a9e36[_0x962a('0x4b')][_0x962a('0x1f')]);_0x5d2091[_0x962a('0x1d')]=qs['offset'](_0x2a9e36['query']['offset']);}_0x5d2091[_0x962a('0x53')]=qs['sort'](_0x2a9e36[_0x962a('0x4b')][_0x962a('0x54')]);_0x5d2091[_0x962a('0x55')]=qs[_0x962a('0x4d')](_[_0x962a('0x56')](_0x2a9e36[_0x962a('0x4b')],_0x1bb10d['filters']));_0x5d2091[_0x962a('0x55')][_0x962a('0x70')]=_0x115531['id'];if(_0x2a9e36[_0x962a('0x4b')]['filter']){_0x5d2091[_0x962a('0x55')]=_[_0x962a('0x58')](_0x5d2091['where'],{'$or':_[_0x962a('0x4a')](_0x5d2091[_0x962a('0x4e')],function(_0x1d7f3c){var _0x2a4f76={};_0x2a4f76[_0x1d7f3c]={'$like':'%'+_0x2a9e36['query'][_0x962a('0x57')]+'%'};return _0x2a4f76;})});}_0x5d2091=_[_0x962a('0x58')]({},_0x5d2091,_0x2a9e36[_0x962a('0x5b')]);return db[_0x962a('0x73')]['count']({'where':_0x5d2091[_0x962a('0x55')]})[_0x962a('0xf')](function(_0x22bcf3){_0x3184cb[_0x962a('0x20')]=_0x22bcf3;if(_0x2a9e36[_0x962a('0x4b')][_0x962a('0x5c')]){_0x5d2091['include']=[{'all':!![]}];}return db[_0x962a('0x73')][_0x962a('0x5e')](_0x5d2091);})['then'](function(_0x9eff4f){_0x3184cb[_0x962a('0x5f')]=_0x9eff4f;return _0x3184cb;});}})['then'](respondWithFilteredResult(_0x4372ab,_0x5d2091))[_0x962a('0x19')](handleError(_0x4372ab,null));};exports[_0x962a('0x75')]=function(_0x3f710f,_0x19aeb5){return db['MailAccount']['find']({'where':{'id':_0x3f710f[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x19aeb5,null))['then'](function(_0x767f16){if(_0x767f16){return _0x767f16[_0x962a('0x75')](_0x3f710f['query'][_0x962a('0x72')]);}})['then'](respondWithStatusCode(_0x19aeb5,null))[_0x962a('0x19')](handleError(_0x19aeb5,null));};exports[_0x962a('0x6c')]=function(_0x534eee,_0x2f4c59){var _0x2e656c={'name':_0x534eee[_0x962a('0x65')][_0x962a('0x28')],'key':_0x534eee['body'][_0x962a('0x48')],'provider':_0x534eee[_0x962a('0x65')][_0x962a('0x64')]===_0x962a('0x63')?null:_0x534eee[_0x962a('0x65')][_0x962a('0x64')],'email':_0x534eee[_0x962a('0x65')][_0x962a('0x76')],'ListId':_0x534eee[_0x962a('0x65')][_0x962a('0x77')],'active':!_['isNil'](_0x534eee['body']['active'])?_0x534eee[_0x962a('0x65')][_0x962a('0x78')]:!![],'description':_0x534eee[_0x962a('0x65')][_0x962a('0x79')]||null};var _0x3654bd=getAuthenticationOptions(_0x2e656c[_0x962a('0x64')],_0x534eee[_0x962a('0x65')]);_0x2e656c[_0x962a('0x40')]=_0x3654bd[_0x962a('0x40')];_0x2e656c[_0x962a('0x43')]=_0x3654bd[_0x962a('0x43')];return db[_0x962a('0x45')][_0x962a('0x6c')](_0x2e656c,{'include':[{'model':db['MailServerOut'],'as':_0x962a('0x43')},{'model':db[_0x962a('0x69')],'as':_0x962a('0x40')}]})[_0x962a('0xf')](function(_0x5169d2){var _0x5042a7=_0x534eee[_0x962a('0x36')][_0x962a('0x24')]({'plain':!![]});if(!_0x5042a7)throw new Error(_0x962a('0x7a'));if(_0x5042a7[_0x962a('0x7b')]===_0x962a('0x36')){var _0x3a3216=_0x5169d2['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x962a('0x25'),'userProfileId':_0x5042a7[_0x962a('0x7c')]},'raw':!![]})[_0x962a('0xf')](function(_0x1df4d3){if(_0x1df4d3&&_0x1df4d3['autoAssociation']===0x0){return db[_0x962a('0x26')]['create']({'name':_0x3a3216[_0x962a('0x28')],'resourceId':_0x3a3216['id'],'type':_0x1df4d3[_0x962a('0x28')],'sectionId':_0x1df4d3['id']},{})['then'](function(){return _0x5169d2;});}else{return _0x5169d2;}})[_0x962a('0x19')](function(_0x56bba7){logger[_0x962a('0x15')](_0x962a('0x7d'),_0x56bba7);throw _0x56bba7;});}return _0x5169d2;})[_0x962a('0xf')](respondWithResult(_0x2f4c59,0xc9))[_0x962a('0x19')](handleError(_0x2f4c59,null));};exports[_0x962a('0x7e')]=function(_0xb88087,_0x1c67b3){return db['MailAccount'][_0x962a('0x6e')]({'where':{'id':_0xb88087[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x1c67b3,null))[_0x962a('0xf')](function(_0x2adcb5){if(_0x2adcb5){return _0x2adcb5[_0x962a('0x7e')]();}return null;})[_0x962a('0xf')](respondWithResult(_0x1c67b3,null))[_0x962a('0x19')](handleError(_0x1c67b3,null));};exports[_0x962a('0x7f')]=function(_0x123ada,_0x10a159){if(_0x123ada[_0x962a('0x65')]['id']){delete _0x123ada[_0x962a('0x65')]['id'];}return db[_0x962a('0x45')]['find']({'where':{'id':_0x123ada['params']['id']}})['then'](handleEntityNotFound(_0x10a159,null))[_0x962a('0xf')](function(_0x5afabf){if(_0x5afabf){_0x123ada[_0x962a('0x65')][_0x962a('0x70')]=_0x5afabf['id'];return db[_0x962a('0x69')][_0x962a('0x6c')](_0x123ada[_0x962a('0x65')]);}})['then'](respondWithResult(_0x10a159,null))['catch'](handleError(_0x10a159,null));};exports[_0x962a('0x80')]=function(_0xd6b0d,_0xa749fe){return db[_0x962a('0x45')][_0x962a('0x6e')]({'where':{'id':_0xd6b0d[_0x962a('0x68')]['id']}})['then'](handleEntityNotFound(_0xa749fe,null))[_0x962a('0xf')](function(_0x450d10){if(_0x450d10){return _0x450d10[_0x962a('0x81')](null);}return null;})['then'](respondWithStatusCode(_0xa749fe,null))[_0x962a('0x19')](handleError(_0xa749fe,null));};exports[_0x962a('0x82')]=function(_0x35343c,_0x2374d6){return db[_0x962a('0x45')][_0x962a('0x6e')]({'where':{'id':_0x35343c[_0x962a('0x68')]['id']}})['then'](handleEntityNotFound(_0x2374d6,null))[_0x962a('0xf')](function(_0x501ca8){if(_0x501ca8){return _0x501ca8[_0x962a('0x82')]();}return null;})[_0x962a('0xf')](respondWithResult(_0x2374d6,null))[_0x962a('0x19')](handleError(_0x2374d6,null));};exports['addSmtp']=function(_0x442412,_0x25b27c){if(_0x442412[_0x962a('0x65')]['id']){delete _0x442412['body']['id'];}return db[_0x962a('0x45')]['find']({'where':{'id':_0x442412[_0x962a('0x68')]['id']}})['then'](handleEntityNotFound(_0x25b27c,null))[_0x962a('0xf')](function(_0x395cb5){if(_0x395cb5){_0x442412[_0x962a('0x65')][_0x962a('0x70')]=_0x395cb5['id'];return db[_0x962a('0x42')][_0x962a('0x6c')](_0x442412[_0x962a('0x65')]);}})[_0x962a('0xf')](respondWithResult(_0x25b27c,null))['catch'](handleError(_0x25b27c,null));};exports[_0x962a('0x83')]=function(_0x29f05f,_0x4b8ffa){return db[_0x962a('0x45')]['findOne']({'where':{'id':_0x29f05f[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x4b8ffa,null))[_0x962a('0xf')](function(_0x1becc3){if(_0x1becc3){return _0x1becc3['setSmtp'](null);}return null;})[_0x962a('0xf')](respondWithStatusCode(_0x4b8ffa,null))[_0x962a('0x19')](handleError(_0x4b8ffa,null));};exports[_0x962a('0x84')]=function(_0x32d2e9,_0x4be205){return db[_0x962a('0x85')]['find']({'where':{'id':_0x32d2e9[_0x962a('0x68')]['id']}})['then'](handleEntityNotFound(_0x4be205,null))[_0x962a('0xf')](function(_0x1863ef){if(_0x1863ef){return _0x1863ef[_0x962a('0x84')](_0x32d2e9[_0x962a('0x65')][_0x962a('0x72')],_['omit'](_0x32d2e9[_0x962a('0x65')],['ids','id'])||{});}})[_0x962a('0xf')](respondWithResult(_0x4be205,null))[_0x962a('0x19')](handleError(_0x4be205,null));};exports[_0x962a('0x86')]=function(_0x2650c1,_0x21479b){var _0x5ec139={'raw':![],'where':{}};var _0x4b6cbb={};var _0x58904a={'count':0x0,'rows':[]};return db['MailAccount'][_0x962a('0x6e')]({'where':{'id':_0x2650c1['params']['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x21479b,null))[_0x962a('0xf')](function(_0xa6dbcf){if(_0xa6dbcf){_0x4b6cbb[_0x962a('0x49')]=_['keys'](db[_0x962a('0x85')]['rawAttributes']);_0x4b6cbb['query']=_[_0x962a('0x4c')](_0x2650c1[_0x962a('0x4b')]);_0x4b6cbb[_0x962a('0x4d')]=_['intersection'](_0x4b6cbb['model'],_0x4b6cbb[_0x962a('0x4b')]);_0x5ec139[_0x962a('0x4e')]=_[_0x962a('0x61')](_0x4b6cbb[_0x962a('0x49')],qs[_0x962a('0x4f')](_0x2650c1[_0x962a('0x4b')][_0x962a('0x4f')]));_0x5ec139[_0x962a('0x4e')]=_0x5ec139[_0x962a('0x4e')][_0x962a('0x50')]?_0x5ec139['attributes']:_0x4b6cbb[_0x962a('0x49')];if(!_0x2650c1[_0x962a('0x4b')][_0x962a('0x51')](_0x962a('0x52'))){_0x5ec139['limit']=qs[_0x962a('0x1f')](_0x2650c1[_0x962a('0x4b')]['limit']);_0x5ec139[_0x962a('0x1d')]=qs[_0x962a('0x1d')](_0x2650c1[_0x962a('0x4b')][_0x962a('0x1d')]);}_0x5ec139[_0x962a('0x53')]=qs['sort'](_0x2650c1[_0x962a('0x4b')][_0x962a('0x54')]);_0x5ec139[_0x962a('0x55')]=qs[_0x962a('0x4d')](_['pick'](_0x2650c1[_0x962a('0x4b')],_0x4b6cbb['filters']));_0x5ec139['where']['MailAccountId']=_0xa6dbcf['id'];if(_0x2650c1[_0x962a('0x4b')]['filter']){_0x5ec139[_0x962a('0x55')]=_[_0x962a('0x58')](_0x5ec139['where'],{'$or':_['map'](_0x5ec139[_0x962a('0x4e')],function(_0x144029){var _0x5d9d6d={};_0x5d9d6d[_0x144029]={'$like':'%'+_0x2650c1[_0x962a('0x4b')]['filter']+'%'};return _0x5d9d6d;})});}_0x5ec139=_['merge']({},_0x5ec139,_0x2650c1[_0x962a('0x5b')]);return db[_0x962a('0x85')][_0x962a('0x20')]({'where':_0x5ec139[_0x962a('0x55')]})[_0x962a('0xf')](function(_0x58fe4b){_0x58904a[_0x962a('0x20')]=_0x58fe4b;if(_0x2650c1['query'][_0x962a('0x5c')]){_0x5ec139['include']=[{'model':db[_0x962a('0x87')],'as':'Contact','required':![]},{'model':db[_0x962a('0x88')],'as':_0x962a('0x89'),'attributes':[_0x962a('0x28'),_0x962a('0x8a'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x962a('0x8b'),'attributes':['id',_0x962a('0x28'),_0x962a('0x8c')],'where':_0x2650c1[_0x962a('0x4b')][_0x962a('0x8d')]?{'id':_0x2650c1['query']['tag']}:undefined,'required':_0x2650c1[_0x962a('0x4b')][_0x962a('0x8d')]?!![]:![]}];}return db[_0x962a('0x85')][_0x962a('0x5e')](_0x5ec139);})[_0x962a('0xf')](function(_0x5717b1){_0x58904a[_0x962a('0x5f')]=_0x5717b1;return _0x58904a;});}})[_0x962a('0xf')](respondWithFilteredResult(_0x21479b,_0x5ec139))['catch'](handleError(_0x21479b,null));};exports['addApplications']=function addApplications(_0x46186d,_0x3e5aa9){var _0x5b4f8c=_0x46186d[_0x962a('0x68')]['id'];var _0x3ddaa2=_0x46186d[_0x962a('0x65')];var _0x2febd7=0xc8;var _0x46a8b3=null;return db['sequelize'][_0x962a('0x8e')]({'isolationLevel':db[_0x962a('0x8f')][_0x962a('0x90')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3cf315){return db[_0x962a('0x45')][_0x962a('0x6e')]({'where':{'id':_0x5b4f8c},'transaction':_0x3cf315})[_0x962a('0xf')](function(_0x1d48dc){if(_0x1d48dc){return db[_0x962a('0x91')][_0x962a('0x92')]({'where':{'MailAccountId':_0x5b4f8c},'transaction':_0x3cf315})['then'](function(){var _0x35bb73=_['map'](_0x3ddaa2,function(_0x468418){_0x468418['MailAccountId']=_0x5b4f8c;return _0x468418;});return db[_0x962a('0x91')][_0x962a('0x93')](_0x35bb73,{'transaction':_0x3cf315});});}else{_0x2febd7=0x194;_0x46a8b3=[];}});})[_0x962a('0xf')](function(){if(_0x2febd7!==0x194){return db[_0x962a('0x91')][_0x962a('0x94')]({'where':{'MailAccountId':_0x5b4f8c},'order':_0x962a('0x95')})[_0x962a('0xf')](function(_0x37d0b2){_0x46a8b3=_0x37d0b2;});}})[_0x962a('0x19')](function(_0x14ca77){_0x2febd7=0x1f4;logger[_0x962a('0x15')](_0x14ca77[_0x962a('0x27')]);if(_0x14ca77[_0x962a('0x28')]){delete _0x14ca77['name'];}_0x46a8b3=_0x14ca77;})['finally'](function(){if(_0x46a8b3===null){_0x3e5aa9[_0x962a('0x1a')](_0x2febd7);}else{if(_0x2febd7===0x1f4){_0x3e5aa9[_0x962a('0x1b')](_0x2febd7)[_0x962a('0x29')](_0x46a8b3);}else{_0x3e5aa9[_0x962a('0x1b')](_0x2febd7)['json'](_0x46a8b3);}}});};exports['getApplications']=function(_0x543b68,_0x1f8d56){var _0x1b5403={};var _0xe38975={};var _0xbdc1dc;var _0x525804;return db[_0x962a('0x45')][_0x962a('0x6e')]({'where':{'id':_0x543b68[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x1f8d56,null))[_0x962a('0xf')](function(_0x45de3b){if(_0x45de3b){_0xbdc1dc=_0x45de3b;_0xe38975['model']=_[_0x962a('0x4c')](db[_0x962a('0x91')]['rawAttributes']);_0xe38975[_0x962a('0x4b')]=_[_0x962a('0x4c')](_0x543b68[_0x962a('0x4b')]);_0xe38975['filters']=_[_0x962a('0x61')](_0xe38975['model'],_0xe38975[_0x962a('0x4b')]);_0x1b5403[_0x962a('0x4e')]=_[_0x962a('0x61')](_0xe38975[_0x962a('0x49')],qs[_0x962a('0x4f')](_0x543b68[_0x962a('0x4b')][_0x962a('0x4f')]));_0x1b5403[_0x962a('0x4e')]=_0x1b5403['attributes']['length']?_0x1b5403['attributes']:_0xe38975[_0x962a('0x49')];_0x1b5403[_0x962a('0x53')]=qs[_0x962a('0x54')](_0x543b68[_0x962a('0x4b')][_0x962a('0x54')]);_0x1b5403[_0x962a('0x55')]=qs[_0x962a('0x4d')](_[_0x962a('0x56')](_0x543b68[_0x962a('0x4b')],_0xe38975[_0x962a('0x4d')]));if(_0x543b68[_0x962a('0x4b')][_0x962a('0x57')]){_0x1b5403['where']=_[_0x962a('0x58')](_0x1b5403[_0x962a('0x55')],{'$or':_['map'](_0x1b5403[_0x962a('0x4e')],function(_0x2e39cb){var _0x4ded3a={};_0x4ded3a[_0x2e39cb]={'$like':'%'+_0x543b68[_0x962a('0x4b')][_0x962a('0x57')]+'%'};return _0x4ded3a;})});}_0x1b5403=_[_0x962a('0x58')]({},_0x1b5403,_0x543b68[_0x962a('0x5b')]);return _0xbdc1dc[_0x962a('0x96')](_0x1b5403);}})[_0x962a('0xf')](function(_0x42e607){if(_0x42e607){_0x525804=_0x42e607[_0x962a('0x50')];if(!_0x543b68[_0x962a('0x4b')][_0x962a('0x51')]('nolimit')){_0x1b5403[_0x962a('0x1f')]=qs[_0x962a('0x1f')](_0x543b68['query'][_0x962a('0x1f')]);_0x1b5403[_0x962a('0x1d')]=qs[_0x962a('0x1d')](_0x543b68['query'][_0x962a('0x1d')]);}return _0xbdc1dc[_0x962a('0x96')](_0x1b5403);}})[_0x962a('0xf')](function(_0x3675f1){if(_0x3675f1){return _0x3675f1?{'count':_0x525804,'rows':_0x3675f1}:null;}})[_0x962a('0xf')](respondWithResult(_0x1f8d56,null))[_0x962a('0x19')](handleError(_0x1f8d56,null));};exports[_0x962a('0x97')]=function(_0x531393,_0x59496d){var _0x1cb193={'raw':!![],'where':{}};var _0x145871={};var _0x4182de={'count':0x0,'rows':[]};return db[_0x962a('0x45')][_0x962a('0x6e')]({'where':{'id':_0x531393[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x59496d,null))[_0x962a('0xf')](function(_0x11fb29){if(_0x11fb29){_0x145871[_0x962a('0x49')]=_[_0x962a('0x4c')](db[_0x962a('0x98')][_0x962a('0x46')]);_0x145871[_0x962a('0x4b')]=_[_0x962a('0x4c')](_0x531393[_0x962a('0x4b')]);_0x145871[_0x962a('0x4d')]=_['intersection'](_0x145871[_0x962a('0x49')],_0x145871['query']);_0x1cb193['attributes']=_[_0x962a('0x61')](_0x145871[_0x962a('0x49')],qs['fields'](_0x531393[_0x962a('0x4b')][_0x962a('0x4f')]));_0x1cb193[_0x962a('0x4e')]=_0x1cb193[_0x962a('0x4e')]['length']?_0x1cb193[_0x962a('0x4e')]:_0x145871[_0x962a('0x49')];if(!_0x531393['query'][_0x962a('0x51')](_0x962a('0x52'))){_0x1cb193[_0x962a('0x1f')]=qs[_0x962a('0x1f')](_0x531393[_0x962a('0x4b')]['limit']);_0x1cb193[_0x962a('0x1d')]=qs[_0x962a('0x1d')](_0x531393[_0x962a('0x4b')][_0x962a('0x1d')]);}_0x1cb193[_0x962a('0x53')]=qs['sort'](_0x531393[_0x962a('0x4b')][_0x962a('0x54')]);_0x1cb193['where']=qs['filters'](_[_0x962a('0x56')](_0x531393[_0x962a('0x4b')],_0x145871[_0x962a('0x4d')]));_0x1cb193[_0x962a('0x55')][_0x962a('0x70')]=_0x11fb29['id'];if(_0x531393['query'][_0x962a('0x57')]){_0x1cb193[_0x962a('0x55')]=_[_0x962a('0x58')](_0x1cb193[_0x962a('0x55')],{'$or':_[_0x962a('0x4a')](_0x1cb193[_0x962a('0x4e')],function(_0x1980ee){var _0x3387c4={};_0x3387c4[_0x1980ee]={'$like':'%'+_0x531393[_0x962a('0x4b')][_0x962a('0x57')]+'%'};return _0x3387c4;})});}if(_0x531393[_0x962a('0x4b')][_0x962a('0x99')]){var _0x1c832d=_0x531393['query'][_0x962a('0x99')][_0x962a('0x9a')](',');var _0x510cb5={};_0x510cb5[_0x1c832d[0x0]]={'$gte':moment(_0x1c832d[0x1])[_0x962a('0x9b')](_0x962a('0x9c'))};_0x1cb193['where']=_[_0x962a('0x58')](_0x1cb193[_0x962a('0x55')],_0x510cb5);}_0x1cb193=_[_0x962a('0x58')]({},_0x1cb193,_0x531393[_0x962a('0x5b')]);return db[_0x962a('0x98')][_0x962a('0x20')]({'where':_0x1cb193[_0x962a('0x55')]})[_0x962a('0xf')](function(_0x3a55a5){_0x4182de[_0x962a('0x20')]=_0x3a55a5;if(_0x531393['query'][_0x962a('0x5c')]){_0x1cb193[_0x962a('0x5d')]=[{'all':!![]}];}return db[_0x962a('0x98')][_0x962a('0x5e')](_0x1cb193);})[_0x962a('0xf')](function(_0x1eb1c6){if(_0x531393[_0x962a('0x4b')]['inlineCss']===_0x962a('0x9d')){for(var _0x2c5518=0x0;_0x2c5518<_0x1eb1c6['length'];_0x2c5518++){_0x1eb1c6[_0x2c5518][_0x962a('0x65')]=juice(_0x1eb1c6[_0x2c5518][_0x962a('0x65')]);}}_0x4182de[_0x962a('0x5f')]=_0x1eb1c6;return _0x4182de;});}})[_0x962a('0xf')](respondWithFilteredResult(_0x59496d,_0x1cb193))[_0x962a('0x19')](handleError(_0x59496d,null));};exports[_0x962a('0x29')]=function(_0x3ba1c1,_0x1d9ead){var _0xe59d6f,_0x292f1e={},_0x5bfa8a;if(_0x3ba1c1[_0x962a('0x65')]['to']){_0x5bfa8a=_0x3ba1c1[_0x962a('0x65')]['to'][_0x962a('0x9a')](',')[0x0];}return db[_0x962a('0x45')][_0x962a('0x67')]({'where':{'id':_0x3ba1c1[_0x962a('0x68')]['id']},'include':[{'model':db[_0x962a('0x9e')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x5bfa8a},'limit':0x1,'order':[[_0x962a('0x9f'),_0x962a('0xa0')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x962a('0xa1')],'as':_0x962a('0xa1'),'raw':!![]}]}]})[_0x962a('0xf')](handleEntityNotFound(_0x1d9ead,null))[_0x962a('0xf')](function(_0x51bd41){if(!_0x51bd41)return;_0xe59d6f=_0x51bd41;if(!_0x51bd41[_0x962a('0x43')])throw new Error(_0x962a('0xa2'));if(_[_0x962a('0xa3')](_0x3ba1c1[_0x962a('0x65')]['from'])){_0x3ba1c1[_0x962a('0x65')][_0x962a('0xa4')]=util[_0x962a('0x9b')](_0x962a('0xa5'),_0x51bd41['name'],_0x51bd41['email']||_0x51bd41[_0x962a('0x43')][_0x962a('0x36')]);}if(_0x3ba1c1['body'][_0x962a('0xa6')]&&_0x3ba1c1['body'][_0x962a('0xa6')]['length']){for(var _0xd2eb1c=0x0;_0xd2eb1c<_0x3ba1c1[_0x962a('0x65')][_0x962a('0xa6')][_0x962a('0x50')];_0xd2eb1c+=0x1){_0x3ba1c1[_0x962a('0x65')][_0x962a('0xa6')][_0xd2eb1c]={'filename':_0x3ba1c1[_0x962a('0x65')][_0x962a('0xa6')][_0xd2eb1c][_0x962a('0x28')],'path':path[_0x962a('0xa7')](config['root'],_0x962a('0xa8'),_0x3ba1c1[_0x962a('0x65')][_0x962a('0xa6')][_0xd2eb1c][_0x962a('0xa9')])};}}var _0x1a13a2=_0x51bd41[_0x962a('0xaa')]();return respondWithRpcPromise(_0x962a('0xab'),_0x962a('0xac'),{'account':_0x1a13a2,'message':_0x3ba1c1[_0x962a('0x65')]});})[_0x962a('0xf')](function(_0x36b76e){if(!_0x36b76e)return;_0x292f1e=_0x36b76e;if(!_0xe59d6f[_0x962a('0xad')])throw new Error('List\x20not\x20found');if(_0xe59d6f['List'][_0x962a('0xae')]['length'])return _0xe59d6f[_0x962a('0xad')][_0x962a('0xae')][0x0];return db[_0x962a('0x87')]['create'](_[_0x962a('0x8')](_0x3ba1c1[_0x962a('0x65')],{'firstName':_0x3ba1c1[_0x962a('0x65')]['to'],'email':_0x3ba1c1['body']['to'],'phone':_0x3ba1c1[_0x962a('0x65')]['to'],'ListId':_0xe59d6f[_0x962a('0x77')]}));})['then'](function(_0x3889c1){if(!_0x3889c1)return;var _0xcd61a3={'UserId':_0x3ba1c1[_0x962a('0x36')]['id'],'ContactId':_0x3889c1['id'],'MailAccountId':_0xe59d6f['id'],'inReplyTo':_0x292f1e[_0x962a('0xaf')],'to':_0x3ba1c1[_0x962a('0x65')][_0x962a('0xa4')],'cc':_0x3ba1c1[_0x962a('0x65')]['cc'],'subject':_0x3ba1c1['body'][_0x962a('0xb0')],'attach':_0x3ba1c1[_0x962a('0x65')][_0x962a('0xb1')],'firstMsgDirection':_0x962a('0xb2'),'lastMsgAt':moment()[_0x962a('0x9b')](_0x962a('0x9c')),'lastMsgDirection':_0x962a('0xb2'),'Messages':[_[_0x962a('0x58')](_0x3ba1c1[_0x962a('0x65')],{'messageId':_0x292f1e['messageId'],'sentAt':moment()[_0x962a('0x9b')](_0x962a('0x9c')),'read':!![],'MailAccountId':_0xe59d6f['id'],'UserId':_0x3ba1c1[_0x962a('0x36')]['id'],'ContactId':_0x3889c1['id']})]};if(_0x3ba1c1['body'][_0x962a('0xb3')]){_0xcd61a3=_[_0x962a('0x58')](_0xcd61a3,_0x3ba1c1[_0x962a('0x65')][_0x962a('0xb3')]);}return db[_0x962a('0x85')][_0x962a('0x6c')](_0xcd61a3,{'include':[{'model':db[_0x962a('0x98')],'as':'Messages'}]});})[_0x962a('0xf')](respondWithResult(_0x1d9ead,null))['catch'](handleError(_0x1d9ead,null));};exports[_0x962a('0xb4')]=function(_0x34d9c6,_0x568fd9){return db['MailAccount']['find']({'where':{'id':_0x34d9c6['params']['id']},'include':[{'model':db[_0x962a('0x42')],'as':_0x962a('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x962a('0xa1'),'raw':!![]}]}]})[_0x962a('0xf')](handleEntityNotFound(_0x568fd9,null))[_0x962a('0xf')](function(_0x1d76c7){if(!_0x1d76c7['Smtp'])return;var _0x449102=_0x1d76c7[_0x962a('0xaa')]();return respondWithRpcPromise(_0x962a('0xb5'),_0x962a('0xb4'),{'account':_0x449102});})[_0x962a('0xf')](respondWithResult(_0x568fd9,null))[_0x962a('0x19')](handleError(_0x568fd9,null));};exports[_0x962a('0x92')]=function(_0x28fd41,_0x92c1c){return db[_0x962a('0x45')][_0x962a('0x67')]({'where':{'id':_0x28fd41[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x92c1c,null))[_0x962a('0xf')](function(_0x3583a2){if(_0x3583a2&&_0x3583a2[_0x962a('0x3d')]){throw new db['Sequelize']['ValidationError'](_0x962a('0xb6'));}return _0x3583a2;})[_0x962a('0xf')](removeEntity(_0x92c1c,null))[_0x962a('0x19')](handleError(_0x92c1c,null));};exports[_0x962a('0xb7')]=function(_0x55e963,_0x532ee6){return db[_0x962a('0x45')]['find']({'where':{'id':_0x55e963[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x532ee6,null))[_0x962a('0xf')](function(_0x8e60e3){if(_0x8e60e3){return _0x8e60e3[_0x962a('0xb7')](_0x55e963['body']['ids'],_[_0x962a('0xb8')](_0x55e963[_0x962a('0x65')],[_0x962a('0x72'),'id'])||{})[_0x962a('0xb9')](function(_0x3826e2){for(var _0xc17a7=0x0;_0xc17a7<_0x55e963['body'][_0x962a('0x72')][_0x962a('0x50')];_0xc17a7+=0x1){socket[_0x962a('0xba')](_0x962a('0xbb'),{'UserId':Number(_0x55e963[_0x962a('0x65')]['ids'][_0xc17a7]),'MailAccountId':Number(_0x55e963[_0x962a('0x68')]['id'])});}return _0x3826e2;});}})[_0x962a('0xf')](respondWithResult(_0x532ee6,null))[_0x962a('0x19')](handleError(_0x532ee6,null));};exports['removeAgents']=function(_0xa9dc03,_0x620f44){return db[_0x962a('0x45')]['find']({'where':{'id':_0xa9dc03[_0x962a('0x68')]['id']}})[_0x962a('0xf')](handleEntityNotFound(_0x620f44,null))[_0x962a('0xf')](function(_0x3e7113){if(_0x3e7113){return _0x3e7113[_0x962a('0xbc')](_0xa9dc03[_0x962a('0x4b')]['ids'])[_0x962a('0xf')](function(){if(_[_0x962a('0xbd')](_0xa9dc03['query']['ids'])){for(var _0x48041e=0x0;_0x48041e<_0xa9dc03[_0x962a('0x4b')][_0x962a('0x72')][_0x962a('0x50')];_0x48041e+=0x1){socket[_0x962a('0xba')](_0x962a('0xbe'),{'UserId':Number(_0xa9dc03['query'][_0x962a('0x72')][_0x48041e]),'MailAccountId':Number(_0xa9dc03[_0x962a('0x68')]['id'])});}}else{socket['emit'](_0x962a('0xbe'),{'UserId':Number(_0xa9dc03[_0x962a('0x4b')]['ids']),'MailAccountId':Number(_0xa9dc03[_0x962a('0x68')]['id'])});}});}})[_0x962a('0xf')](respondWithStatusCode(_0x620f44,null))[_0x962a('0x19')](handleError(_0x620f44,null));};exports[_0x962a('0xbf')]=function(_0x318123,_0x4514f9){var _0x126761={};var _0x567fb2={};var _0x2302d1;var _0x4d34ae;return db[_0x962a('0x45')]['findOne']({'where':{'id':_0x318123[_0x962a('0x68')]['id']}})['then'](handleEntityNotFound(_0x4514f9,null))[_0x962a('0xf')](function(_0x2fc572){if(_0x2fc572){_0x2302d1=_0x2fc572;_0x567fb2['model']=_[_0x962a('0x4c')](db[_0x962a('0x88')][_0x962a('0x46')]);_0x567fb2['query']=_['keys'](_0x318123[_0x962a('0x4b')]);_0x567fb2[_0x962a('0x4d')]=_['intersection'](_0x567fb2['model'],_0x567fb2['query']);_0x126761[_0x962a('0x4e')]=_[_0x962a('0x61')](_0x567fb2[_0x962a('0x49')],qs['fields'](_0x318123[_0x962a('0x4b')][_0x962a('0x4f')]));_0x126761[_0x962a('0x4e')]=_0x126761[_0x962a('0x4e')][_0x962a('0x50')]?_0x126761[_0x962a('0x4e')]:_0x567fb2[_0x962a('0x49')];_0x126761[_0x962a('0x53')]=qs[_0x962a('0x54')](_0x318123[_0x962a('0x4b')][_0x962a('0x54')]);_0x126761[_0x962a('0x55')]=qs['filters'](_[_0x962a('0x56')](_0x318123['query'],_0x567fb2[_0x962a('0x4d')]));if(_0x318123['query'][_0x962a('0x57')]){_0x126761[_0x962a('0x55')]=_['merge'](_0x126761[_0x962a('0x55')],{'$or':_[_0x962a('0x4a')](_0x126761[_0x962a('0x4e')],function(_0x2a12d4){var _0x560b15={};_0x560b15[_0x2a12d4]={'$like':'%'+_0x318123[_0x962a('0x4b')][_0x962a('0x57')]+'%'};return _0x560b15;})});}_0x126761=_['merge']({},_0x126761,_0x318123[_0x962a('0x5b')]);return _0x2302d1['getAgents'](_0x126761);}})[_0x962a('0xf')](function(_0x479a29){if(_0x479a29){_0x4d34ae=_0x479a29['length'];if(!_0x318123[_0x962a('0x4b')][_0x962a('0x51')](_0x962a('0x52'))){_0x126761[_0x962a('0x1f')]=qs[_0x962a('0x1f')](_0x318123[_0x962a('0x4b')][_0x962a('0x1f')]);_0x126761[_0x962a('0x1d')]=qs[_0x962a('0x1d')](_0x318123['query']['offset']);}return _0x2302d1[_0x962a('0xbf')](_0x126761);}})[_0x962a('0xf')](function(_0x5442e9){if(_0x5442e9){return _0x5442e9?{'count':_0x4d34ae,'rows':_0x5442e9}:null;}})[_0x962a('0xf')](respondWithResult(_0x4514f9,null))['catch'](handleError(_0x4514f9,null));}; \ No newline at end of file +var _0xc931=['VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','includeAll','include','rows','show','params','MailServerIn','MailServerOut','find','update','body','custom','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','sort','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','options','CmContact','Contact','User','Owner','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction'];(function(_0x1c5543,_0x1a408c){var _0x4b734d=function(_0x1fcfdf){while(--_0x1fcfdf){_0x1c5543['push'](_0x1c5543['shift']());}};_0x4b734d(++_0x1a408c);}(_0xc931,0xd0));var _0x1c93=function(_0x512b50,_0x4716b6){_0x512b50=_0x512b50-0x0;var _0x5af819=_0xc931[_0x512b50];return _0x5af819;};'use strict';var moment=require('moment');var BPromise=require(_0x1c93('0x0'));var util=require(_0x1c93('0x1'));var path=require('path');var _=require(_0x1c93('0x2'));var juice=require('juice');var Redis=require(_0x1c93('0x3'));var qs=require(_0x1c93('0x4'));var logger=require(_0x1c93('0x5'))(_0x1c93('0x6'));var config=require(_0x1c93('0x7'));var db=require(_0x1c93('0x8'))['db'];config[_0x1c93('0x9')]=_[_0x1c93('0xa')](config[_0x1c93('0x9')],{'host':_0x1c93('0xb'),'port':0x18eb});var socket=require(_0x1c93('0xc'))(new Redis(config[_0x1c93('0x9')]));require(_0x1c93('0xd'))[_0x1c93('0xe')](socket);var jayson=require(_0x1c93('0xf'));var client=jayson[_0x1c93('0x10')][_0x1c93('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x5ae36e,_0x1c564c,_0x3b61b2,_0x2c8e1e){return new BPromise(function(_0x5cf9c5,_0x5b8925){var _0x4bd713=_0x2c8e1e||client;return _0x4bd713['request'](_0x5ae36e,_0x3b61b2)[_0x1c93('0x12')](function(_0x297cf9){logger[_0x1c93('0x13')]('MailAccount,\x20%s,\x20%s',_0x1c564c,_0x1c93('0x14'));logger['debug'](_0x1c93('0x15'),_0x1c564c,_0x1c93('0x14'),JSON[_0x1c93('0x16')](_0x297cf9));if(_0x297cf9[_0x1c93('0x17')]){if(_0x297cf9['error'][_0x1c93('0x18')]===0x1f4){logger[_0x1c93('0x17')](_0x1c93('0x19'),_0x1c564c,_0x297cf9[_0x1c93('0x17')]['message']);return _0x5b8925(_0x297cf9['error'][_0x1c93('0x1a')]);}logger[_0x1c93('0x17')]('MailAccount,\x20%s,\x20%s',_0x1c564c,_0x297cf9[_0x1c93('0x17')][_0x1c93('0x1a')]);return _0x5cf9c5(_0x297cf9[_0x1c93('0x17')]['message']);}else{logger[_0x1c93('0x13')](_0x1c93('0x19'),_0x1c564c,_0x1c93('0x14'));_0x5cf9c5(_0x297cf9['result'][_0x1c93('0x1a')]);}})[_0x1c93('0x1b')](function(_0x3b5a42){logger[_0x1c93('0x17')]('MailAccount,\x20%s,\x20%s',_0x1c564c,_0x3b5a42);_0x5b8925(_0x3b5a42);});});}function respondWithStatusCode(_0x55b61c,_0x1c2ab2){_0x1c2ab2=_0x1c2ab2||0xcc;return function(_0x4db437){if(_0x4db437){return _0x55b61c[_0x1c93('0x1c')](_0x1c2ab2);}return _0x55b61c['status'](_0x1c2ab2)[_0x1c93('0x1d')]();};}function respondWithResult(_0x4329c3,_0x88eefa){_0x88eefa=_0x88eefa||0xc8;return function(_0x24a3e3){if(_0x24a3e3){return _0x4329c3[_0x1c93('0x1e')](_0x88eefa)[_0x1c93('0x1f')](_0x24a3e3);}};}function respondWithFilteredResult(_0x5044fe,_0x1d491a){return function(_0x3f1857){if(_0x3f1857){var _0x390fc5=typeof _0x1d491a[_0x1c93('0x20')]==='undefined'&&typeof _0x1d491a[_0x1c93('0x21')]===_0x1c93('0x22');var _0x1c3077=_0x3f1857[_0x1c93('0x23')];var _0x5f5b01=_0x390fc5?0x0:_0x1d491a['offset'];var _0x49c022=_0x390fc5?_0x3f1857[_0x1c93('0x23')]:_0x1d491a['offset']+_0x1d491a['limit'];var _0x347de1;if(_0x49c022>=_0x1c3077){_0x49c022=_0x1c3077;_0x347de1=0xc8;}else{_0x347de1=0xce;}_0x5044fe[_0x1c93('0x1e')](_0x347de1);return _0x5044fe[_0x1c93('0x24')](_0x1c93('0x25'),_0x5f5b01+'-'+_0x49c022+'/'+_0x1c3077)[_0x1c93('0x1f')](_0x3f1857);}return null;};}function saveUpdates(_0x4b634a){return function(_0x267578){if(_0x267578){return _0x267578['update'](_0x4b634a)[_0x1c93('0x12')](function(_0x36b7d2){return _0x36b7d2;});}return null;};}function removeEntity(_0x5e8956){return function(_0x1db913){if(_0x1db913){return _0x1db913[_0x1c93('0x26')]()[_0x1c93('0x12')](function(){var _0x217609=_0x1db913[_0x1c93('0x27')]({'plain':!![]});var _0x35a550=_0x1c93('0x28');return db[_0x1c93('0x29')][_0x1c93('0x26')]({'where':{'type':_0x35a550,'resourceId':_0x217609['id']}})[_0x1c93('0x12')](function(){return _0x1db913;});})['then'](function(){_0x5e8956[_0x1c93('0x1e')](0xcc)[_0x1c93('0x1d')]();});}};}function handleEntityNotFound(_0x349b9b){return function(_0x39bb82){if(!_0x39bb82){_0x349b9b[_0x1c93('0x1c')](0x194);}return _0x39bb82;};}function handleError(_0x273709,_0x5d12ef){_0x5d12ef=_0x5d12ef||0x1f4;return function(_0x346249){logger[_0x1c93('0x17')](_0x346249[_0x1c93('0x2a')]);if(_0x346249[_0x1c93('0x2b')]){delete _0x346249[_0x1c93('0x2b')];}_0x273709[_0x1c93('0x1e')](_0x5d12ef)[_0x1c93('0x2c')](_0x346249);};}function getImapHost(_0x4d11ee){switch(_0x4d11ee){case _0x1c93('0x2d'):return'imap.gmail.com';case _0x1c93('0x2e'):return'imap.mail.yahoo.com';case _0x1c93('0x2f'):return _0x1c93('0x30');case'outlook365':return _0x1c93('0x31');}throw new Error(_0x1c93('0x32'),_0x4d11ee);}function getSmtpHost(_0xea454a){switch(_0xea454a){case _0x1c93('0x2d'):return _0x1c93('0x33');case'yahoo':return _0x1c93('0x34');case _0x1c93('0x2f'):return'smtp-mail.outlook.com';case'outlook365':return _0x1c93('0x35');}throw new Error(_0x1c93('0x32'),_0xea454a);}function getAuthenticationOptions(_0x58e3b3,_0x447428){var _0x1b244d={};var _0x3532ef={};if(_0x58e3b3){_0x1b244d[_0x1c93('0x36')]=_0x3532ef[_0x1c93('0x36')]=_0x447428['username'];_0x1b244d[_0x1c93('0x37')]=_0x3532ef[_0x1c93('0x38')]=_0x447428[_0x1c93('0x37')];if(_0x447428['modernAuthentication']){_0x1b244d[_0x1c93('0x39')]=_0x3532ef['modernAuthentication']=!![];_0x1b244d[_0x1c93('0x3a')]=_0x3532ef[_0x1c93('0x3a')]=_0x447428[_0x1c93('0x3a')];_0x1b244d[_0x1c93('0x37')]=_0x3532ef[_0x1c93('0x38')]=null;}else{_0x1b244d[_0x1c93('0x3a')]=_0x3532ef[_0x1c93('0x3a')]=null;}_0x1b244d[_0x1c93('0x3b')]=getImapHost(_0x58e3b3);_0x1b244d[_0x1c93('0x3c')]=0x3e1;_0x3532ef[_0x1c93('0x3b')]=getSmtpHost(_0x58e3b3);_0x3532ef[_0x1c93('0x3c')]=0x24b;_0x3532ef[_0x1c93('0x3d')]=![];_0x1b244d[_0x1c93('0x3e')]=_0x3532ef[_0x1c93('0x3e')]=null;}else{if(_0x447428[_0x1c93('0x3f')]){_0x1b244d[_0x1c93('0x36')]=_0x3532ef[_0x1c93('0x36')]=_0x447428[_0x1c93('0x40')];_0x1b244d[_0x1c93('0x37')]=_0x3532ef['pass']=_0x447428['password'];}else{_0x1b244d['authentication']=_0x3532ef[_0x1c93('0x3f')]=![];_0x1b244d[_0x1c93('0x36')]=_0x3532ef[_0x1c93('0x36')]=null;_0x1b244d[_0x1c93('0x37')]=_0x3532ef[_0x1c93('0x38')]=null;}_0x1b244d[_0x1c93('0x3b')]=_0x447428[_0x1c93('0x41')][_0x1c93('0x3b')];_0x1b244d['port']=_0x447428[_0x1c93('0x41')][_0x1c93('0x3c')];_0x3532ef[_0x1c93('0x3b')]=_0x447428[_0x1c93('0x42')]['host'];_0x3532ef[_0x1c93('0x3c')]=_0x447428['Smtp'][_0x1c93('0x3c')];}return{'Imap':_0x1b244d,'Smtp':_0x3532ef};}exports[_0x1c93('0x43')]=function(_0x367a84,_0x1431bb){var _0x151417={'include':[{'model':db['MailServerIn'],'as':_0x1c93('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x1c93('0x44')],'as':_0x1c93('0x45')}]},_0x124f7a={},_0x5711b8={'count':0x0,'rows':[]};var _0x432df8=_['map'](db[_0x1c93('0x46')][_0x1c93('0x47')],function(_0x448732){return{'name':_0x448732['fieldName'],'type':_0x448732[_0x1c93('0x48')][_0x1c93('0x49')]};});_0x124f7a[_0x1c93('0x4a')]=_[_0x1c93('0x4b')](_0x432df8,_0x1c93('0x2b'));_0x124f7a[_0x1c93('0x4c')]=_[_0x1c93('0x4d')](_0x367a84['query']);_0x124f7a[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x124f7a[_0x1c93('0x4a')],_0x124f7a[_0x1c93('0x4c')]);_0x151417[_0x1c93('0x50')]=_['intersection'](_0x124f7a[_0x1c93('0x4a')],qs[_0x1c93('0x51')](_0x367a84[_0x1c93('0x4c')][_0x1c93('0x51')]));_0x151417[_0x1c93('0x50')]=_0x151417['attributes'][_0x1c93('0x52')]?_0x151417[_0x1c93('0x50')]:_0x124f7a['model'];if(!_0x367a84['query'][_0x1c93('0x53')](_0x1c93('0x54'))){_0x151417[_0x1c93('0x21')]=qs[_0x1c93('0x21')](_0x367a84[_0x1c93('0x4c')][_0x1c93('0x21')]);_0x151417[_0x1c93('0x20')]=qs[_0x1c93('0x20')](_0x367a84[_0x1c93('0x4c')][_0x1c93('0x20')]);}_0x151417['order']=qs['sort'](_0x367a84[_0x1c93('0x4c')]['sort']);_0x151417[_0x1c93('0x55')]=qs[_0x1c93('0x4e')](_['pick'](_0x367a84['query'],_0x124f7a[_0x1c93('0x4e')]),_0x432df8);if(_0x367a84['query'][_0x1c93('0x56')]){_0x151417[_0x1c93('0x55')]=_[_0x1c93('0x57')](_0x151417['where'],{'$or':_[_0x1c93('0x4b')](_0x432df8,function(_0x56211a){if(_0x56211a['type']!=='VIRTUAL'){var _0x269e3e={};_0x269e3e[_0x56211a[_0x1c93('0x2b')]]={'$like':'%'+_0x367a84['query'][_0x1c93('0x56')]+'%'};return _0x269e3e;}})});}_0x151417=_['merge']({},_0x151417,_0x367a84['options']);var _0x5331ea={'where':_0x151417[_0x1c93('0x55')]};return db[_0x1c93('0x46')][_0x1c93('0x23')](_0x5331ea)['then'](function(_0x2da706){_0x5711b8[_0x1c93('0x23')]=_0x2da706;if(_0x367a84[_0x1c93('0x4c')][_0x1c93('0x58')]){_0x151417[_0x1c93('0x59')]=[{'all':!![]}];}return db[_0x1c93('0x46')]['findAll'](_0x151417);})['then'](function(_0x62e23e){_0x5711b8[_0x1c93('0x5a')]=_0x62e23e;return _0x5711b8;})[_0x1c93('0x12')](respondWithFilteredResult(_0x1431bb,_0x151417))['catch'](handleError(_0x1431bb,null));};exports[_0x1c93('0x5b')]=function(_0x529263,_0x21cf60){var _0x328326={'raw':![],'where':{'id':_0x529263[_0x1c93('0x5c')]['id']},'include':[{'model':db[_0x1c93('0x5d')],'as':'Imap'},{'model':db[_0x1c93('0x5e')],'as':_0x1c93('0x42')},{'model':db[_0x1c93('0x44')],'as':_0x1c93('0x45')}]},_0x2cff14={};_0x2cff14[_0x1c93('0x4a')]=_[_0x1c93('0x4d')](db[_0x1c93('0x46')][_0x1c93('0x47')]);_0x2cff14[_0x1c93('0x4c')]=_[_0x1c93('0x4d')](_0x529263[_0x1c93('0x4c')]);_0x2cff14[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x2cff14['model'],_0x2cff14[_0x1c93('0x4c')]);_0x328326[_0x1c93('0x50')]=_[_0x1c93('0x4f')](_0x2cff14[_0x1c93('0x4a')],qs[_0x1c93('0x51')](_0x529263[_0x1c93('0x4c')][_0x1c93('0x51')]));_0x328326[_0x1c93('0x50')]=_0x328326[_0x1c93('0x50')]['length']?_0x328326[_0x1c93('0x50')]:_0x2cff14[_0x1c93('0x4a')];if(_0x529263['query'][_0x1c93('0x58')]){_0x328326['include']=[{'all':!![]}];}_0x328326=_[_0x1c93('0x57')]({},_0x328326,_0x529263['options']);return db[_0x1c93('0x46')][_0x1c93('0x5f')](_0x328326)['then'](handleEntityNotFound(_0x21cf60,null))[_0x1c93('0x12')](respondWithResult(_0x21cf60,null))[_0x1c93('0x1b')](handleError(_0x21cf60,null));};exports[_0x1c93('0x60')]=function(_0x3c859d,_0xf7e65){if(_0x3c859d[_0x1c93('0x61')]['id']){delete _0x3c859d[_0x1c93('0x61')]['id'];}var _0x54c38f=_0x3c859d['body']['provider']===_0x1c93('0x62')?null:_0x3c859d['body'][_0x1c93('0x63')];var _0x1c9e33=_0x3c859d['body'][_0x1c93('0x41')]||{};var _0x5f4a21=_0x3c859d['body']['Smtp']||{};if(_0x54c38f){_0x1c9e33['host']=getImapHost(_0x54c38f);_0x1c9e33[_0x1c93('0x3c')]=0x3e1;_0x5f4a21[_0x1c93('0x3b')]=getSmtpHost(_0x54c38f);_0x5f4a21[_0x1c93('0x3c')]=0x24b;_0x5f4a21[_0x1c93('0x3d')]=![];}if(_0x5f4a21['modernAuthentication']){_0x5f4a21[_0x1c93('0x3d')]=![];}else{_0x5f4a21[_0x1c93('0x3a')]=null;}if(!_0x1c9e33[_0x1c93('0x39')])_0x1c9e33[_0x1c93('0x3a')]=null;_0x3c859d[_0x1c93('0x61')][_0x1c93('0x41')]=_0x1c9e33;_0x3c859d[_0x1c93('0x61')]['Smtp']=_0x5f4a21;return db['MailAccount']['find']({'where':{'id':_0x3c859d[_0x1c93('0x5c')]['id']},'include':[{'model':db[_0x1c93('0x5d')],'as':_0x1c93('0x41')},{'model':db[_0x1c93('0x5e')],'as':_0x1c93('0x42')},{'model':db[_0x1c93('0x44')],'as':'mandatoryDispositionPause'}]})[_0x1c93('0x12')](handleEntityNotFound(_0xf7e65,null))[_0x1c93('0x12')](function(_0x124528){if(!_0x124528)throw new Error(_0x1c93('0x64'));if(_0x124528[_0x1c93('0x3e')])delete _0x3c859d[_0x1c93('0x61')][_0x1c93('0x41')];return _0x124528;})['then'](saveUpdates(_0x3c859d[_0x1c93('0x61')],null))[_0x1c93('0x12')](function(_0x4788e7){if(!_0x3c859d[_0x1c93('0x61')][_0x1c93('0x41')])return _0x4788e7;return db[_0x1c93('0x5d')][_0x1c93('0x60')](_0x3c859d[_0x1c93('0x61')][_0x1c93('0x41')],{'where':{'MailAccountId':_0x4788e7['id']}})[_0x1c93('0x12')](function(){return _0x4788e7;});})[_0x1c93('0x12')](function(_0x28479){if(!_0x3c859d['body'][_0x1c93('0x42')])return _0x28479;return db[_0x1c93('0x5e')]['update'](_0x3c859d['body'][_0x1c93('0x42')],{'where':{'MailAccountId':_0x28479['id']}})['then'](function(){return _0x28479;});})['then'](respondWithResult(_0xf7e65,null))['catch'](handleError(_0xf7e65,null));};exports['describe']=function(_0x316a31,_0x4045fe){return db[_0x1c93('0x46')][_0x1c93('0x65')]()[_0x1c93('0x12')](respondWithResult(_0x4045fe,null))[_0x1c93('0x1b')](handleError(_0x4045fe,null));};exports[_0x1c93('0x66')]=function(_0x138a40,_0x4fdbe7){if(_0x138a40['body']['id']){delete _0x138a40[_0x1c93('0x61')]['id'];}return db['MailAccount'][_0x1c93('0x5f')]({'where':{'id':_0x138a40['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x4fdbe7,null))[_0x1c93('0x12')](function(_0x4f7952){if(_0x4f7952){_0x138a40['body'][_0x1c93('0x67')]=_0x4f7952['id'];return db[_0x1c93('0x68')][_0x1c93('0x69')](_0x138a40[_0x1c93('0x61')]);}})['then'](respondWithResult(_0x4fdbe7,null))['catch'](handleError(_0x4fdbe7,null));};exports[_0x1c93('0x6a')]=function(_0x208fce,_0x99438b){var _0x4228e0={'raw':![],'where':{}};var _0x2ac9fc={};var _0x45bd2c={'count':0x0,'rows':[]};return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x208fce['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x99438b,null))[_0x1c93('0x12')](function(_0x3c47a2){if(_0x3c47a2){_0x2ac9fc[_0x1c93('0x4a')]=_[_0x1c93('0x4d')](db[_0x1c93('0x68')][_0x1c93('0x47')]);_0x2ac9fc[_0x1c93('0x4c')]=_[_0x1c93('0x4d')](_0x208fce[_0x1c93('0x4c')]);_0x2ac9fc[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x2ac9fc[_0x1c93('0x4a')],_0x2ac9fc[_0x1c93('0x4c')]);_0x4228e0[_0x1c93('0x50')]=_[_0x1c93('0x4f')](_0x2ac9fc[_0x1c93('0x4a')],qs['fields'](_0x208fce[_0x1c93('0x4c')][_0x1c93('0x51')]));_0x4228e0['attributes']=_0x4228e0[_0x1c93('0x50')][_0x1c93('0x52')]?_0x4228e0['attributes']:_0x2ac9fc[_0x1c93('0x4a')];if(!_0x208fce[_0x1c93('0x4c')][_0x1c93('0x53')](_0x1c93('0x54'))){_0x4228e0[_0x1c93('0x21')]=qs[_0x1c93('0x21')](_0x208fce[_0x1c93('0x4c')][_0x1c93('0x21')]);_0x4228e0[_0x1c93('0x20')]=qs[_0x1c93('0x20')](_0x208fce['query'][_0x1c93('0x20')]);}_0x4228e0[_0x1c93('0x6c')]=qs[_0x1c93('0x6d')](_0x208fce['query'][_0x1c93('0x6d')]);_0x4228e0[_0x1c93('0x55')]=qs[_0x1c93('0x4e')](_[_0x1c93('0x6e')](_0x208fce[_0x1c93('0x4c')],_0x2ac9fc['filters']));_0x4228e0[_0x1c93('0x55')][_0x1c93('0x67')]=_0x3c47a2['id'];if(_0x208fce[_0x1c93('0x4c')]['filter']){_0x4228e0[_0x1c93('0x55')]=_[_0x1c93('0x57')](_0x4228e0[_0x1c93('0x55')],{'$or':_[_0x1c93('0x4b')](_0x4228e0[_0x1c93('0x50')],function(_0x438028){var _0x319bcc={};_0x319bcc[_0x438028]={'$like':'%'+_0x208fce['query']['filter']+'%'};return _0x319bcc;})});}_0x4228e0=_[_0x1c93('0x57')]({},_0x4228e0,_0x208fce['options']);return db[_0x1c93('0x68')][_0x1c93('0x23')]({'where':_0x4228e0['where']})[_0x1c93('0x12')](function(_0x7d7b7d){_0x45bd2c[_0x1c93('0x23')]=_0x7d7b7d;if(_0x208fce['query'][_0x1c93('0x58')]){_0x4228e0[_0x1c93('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x1c93('0x6f')](_0x4228e0);})[_0x1c93('0x12')](function(_0x1d2ece){_0x45bd2c[_0x1c93('0x5a')]=_0x1d2ece;return _0x45bd2c;});}})[_0x1c93('0x12')](respondWithFilteredResult(_0x99438b,_0x4228e0))[_0x1c93('0x1b')](handleError(_0x99438b,null));};exports[_0x1c93('0x70')]=function(_0x25cebb,_0xa4a773){return db[_0x1c93('0x46')][_0x1c93('0x5f')]({'where':{'id':_0x25cebb['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0xa4a773,null))[_0x1c93('0x12')](function(_0x6caedc){if(_0x6caedc){return _0x6caedc[_0x1c93('0x70')](_0x25cebb[_0x1c93('0x4c')][_0x1c93('0x71')]);}})['then'](respondWithStatusCode(_0xa4a773,null))[_0x1c93('0x1b')](handleError(_0xa4a773,null));};exports[_0x1c93('0x72')]=function(_0x2447ee,_0x579735){if(_0x2447ee[_0x1c93('0x61')]['id']){delete _0x2447ee[_0x1c93('0x61')]['id'];}return db[_0x1c93('0x46')][_0x1c93('0x5f')]({'where':{'id':_0x2447ee[_0x1c93('0x5c')]['id']}})['then'](handleEntityNotFound(_0x579735,null))['then'](function(_0x263045){if(_0x263045){_0x2447ee['body'][_0x1c93('0x67')]=_0x263045['id'];return db[_0x1c93('0x73')]['create'](_0x2447ee[_0x1c93('0x61')]);}})['then'](respondWithResult(_0x579735,null))[_0x1c93('0x1b')](handleError(_0x579735,null));};exports[_0x1c93('0x74')]=function(_0x5d7ec9,_0x8dc526){var _0x4912cd={'raw':![],'where':{}};var _0x52f4e6={};var _0x14a85={'count':0x0,'rows':[]};return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x5d7ec9[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x8dc526,null))[_0x1c93('0x12')](function(_0xa09e43){if(_0xa09e43){_0x52f4e6[_0x1c93('0x4a')]=_['keys'](db[_0x1c93('0x73')][_0x1c93('0x47')]);_0x52f4e6[_0x1c93('0x4c')]=_[_0x1c93('0x4d')](_0x5d7ec9[_0x1c93('0x4c')]);_0x52f4e6[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x52f4e6[_0x1c93('0x4a')],_0x52f4e6[_0x1c93('0x4c')]);_0x4912cd[_0x1c93('0x50')]=_['intersection'](_0x52f4e6[_0x1c93('0x4a')],qs[_0x1c93('0x51')](_0x5d7ec9[_0x1c93('0x4c')][_0x1c93('0x51')]));_0x4912cd['attributes']=_0x4912cd[_0x1c93('0x50')][_0x1c93('0x52')]?_0x4912cd['attributes']:_0x52f4e6[_0x1c93('0x4a')];if(!_0x5d7ec9[_0x1c93('0x4c')][_0x1c93('0x53')](_0x1c93('0x54'))){_0x4912cd[_0x1c93('0x21')]=qs[_0x1c93('0x21')](_0x5d7ec9[_0x1c93('0x4c')]['limit']);_0x4912cd[_0x1c93('0x20')]=qs[_0x1c93('0x20')](_0x5d7ec9[_0x1c93('0x4c')][_0x1c93('0x20')]);}_0x4912cd[_0x1c93('0x6c')]=qs[_0x1c93('0x6d')](_0x5d7ec9['query'][_0x1c93('0x6d')]);_0x4912cd[_0x1c93('0x55')]=qs[_0x1c93('0x4e')](_[_0x1c93('0x6e')](_0x5d7ec9[_0x1c93('0x4c')],_0x52f4e6['filters']));_0x4912cd[_0x1c93('0x55')][_0x1c93('0x67')]=_0xa09e43['id'];if(_0x5d7ec9[_0x1c93('0x4c')][_0x1c93('0x56')]){_0x4912cd[_0x1c93('0x55')]=_[_0x1c93('0x57')](_0x4912cd[_0x1c93('0x55')],{'$or':_[_0x1c93('0x4b')](_0x4912cd['attributes'],function(_0x35c9bf){var _0x11aa7d={};_0x11aa7d[_0x35c9bf]={'$like':'%'+_0x5d7ec9[_0x1c93('0x4c')][_0x1c93('0x56')]+'%'};return _0x11aa7d;})});}_0x4912cd=_[_0x1c93('0x57')]({},_0x4912cd,_0x5d7ec9['options']);return db[_0x1c93('0x73')][_0x1c93('0x23')]({'where':_0x4912cd[_0x1c93('0x55')]})[_0x1c93('0x12')](function(_0x3df0d7){_0x14a85[_0x1c93('0x23')]=_0x3df0d7;if(_0x5d7ec9[_0x1c93('0x4c')][_0x1c93('0x58')]){_0x4912cd['include']=[{'all':!![]}];}return db[_0x1c93('0x73')][_0x1c93('0x6f')](_0x4912cd);})[_0x1c93('0x12')](function(_0x452486){_0x14a85['rows']=_0x452486;return _0x14a85;});}})[_0x1c93('0x12')](respondWithFilteredResult(_0x8dc526,_0x4912cd))[_0x1c93('0x1b')](handleError(_0x8dc526,null));};exports[_0x1c93('0x75')]=function(_0x30402b,_0x4074fa){return db[_0x1c93('0x46')][_0x1c93('0x5f')]({'where':{'id':_0x30402b['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x4074fa,null))[_0x1c93('0x12')](function(_0x40a53f){if(_0x40a53f){return _0x40a53f['removeAnswers'](_0x30402b[_0x1c93('0x4c')][_0x1c93('0x71')]);}})[_0x1c93('0x12')](respondWithStatusCode(_0x4074fa,null))[_0x1c93('0x1b')](handleError(_0x4074fa,null));};exports[_0x1c93('0x69')]=function(_0x24167a,_0x42a740){var _0x332e87={'name':_0x24167a[_0x1c93('0x61')][_0x1c93('0x2b')],'key':_0x24167a[_0x1c93('0x61')][_0x1c93('0x49')],'provider':_0x24167a[_0x1c93('0x61')]['provider']===_0x1c93('0x62')?null:_0x24167a[_0x1c93('0x61')][_0x1c93('0x63')],'email':_0x24167a[_0x1c93('0x61')]['email'],'ListId':_0x24167a[_0x1c93('0x61')][_0x1c93('0x76')],'active':!_[_0x1c93('0x77')](_0x24167a['body'][_0x1c93('0x78')])?_0x24167a[_0x1c93('0x61')]['active']:!![],'description':_0x24167a[_0x1c93('0x61')][_0x1c93('0x79')]||null};var _0xb568bc=getAuthenticationOptions(_0x332e87[_0x1c93('0x63')],_0x24167a[_0x1c93('0x61')]);_0x332e87[_0x1c93('0x41')]=_0xb568bc['Imap'];_0x332e87[_0x1c93('0x42')]=_0xb568bc[_0x1c93('0x42')];return db[_0x1c93('0x46')][_0x1c93('0x69')](_0x332e87,{'include':[{'model':db[_0x1c93('0x5e')],'as':_0x1c93('0x42')},{'model':db[_0x1c93('0x5d')],'as':_0x1c93('0x41')}]})['then'](function(_0x42b35b){var _0x1f9f94=_0x24167a[_0x1c93('0x36')]['get']({'plain':!![]});if(!_0x1f9f94)throw new Error(_0x1c93('0x7a'));if(_0x1f9f94[_0x1c93('0x7b')]==='user'){var _0x45b766=_0x42b35b[_0x1c93('0x27')]({'plain':!![]});return db[_0x1c93('0x7c')][_0x1c93('0x5f')]({'where':{'name':_0x1c93('0x28'),'userProfileId':_0x1f9f94[_0x1c93('0x7d')]},'raw':!![]})[_0x1c93('0x12')](function(_0x120883){if(_0x120883&&_0x120883['autoAssociation']===0x0){return db[_0x1c93('0x29')]['create']({'name':_0x45b766[_0x1c93('0x2b')],'resourceId':_0x45b766['id'],'type':_0x120883[_0x1c93('0x2b')],'sectionId':_0x120883['id']},{})[_0x1c93('0x12')](function(){return _0x42b35b;});}else{return _0x42b35b;}})[_0x1c93('0x1b')](function(_0x57f036){logger[_0x1c93('0x17')](_0x1c93('0x7e'),_0x57f036);throw _0x57f036;});}return _0x42b35b;})['then'](respondWithResult(_0x42a740,0xc9))[_0x1c93('0x1b')](handleError(_0x42a740,null));};exports[_0x1c93('0x7f')]=function(_0x2a2715,_0x56351a){return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x2a2715['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x56351a,null))['then'](function(_0x2e61f5){if(_0x2e61f5){return _0x2e61f5[_0x1c93('0x7f')]();}return null;})[_0x1c93('0x12')](respondWithResult(_0x56351a,null))['catch'](handleError(_0x56351a,null));};exports[_0x1c93('0x80')]=function(_0xc7665a,_0x44b0cf){if(_0xc7665a[_0x1c93('0x61')]['id']){delete _0xc7665a[_0x1c93('0x61')]['id'];}return db['MailAccount'][_0x1c93('0x5f')]({'where':{'id':_0xc7665a[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x44b0cf,null))[_0x1c93('0x12')](function(_0x1ae709){if(_0x1ae709){_0xc7665a[_0x1c93('0x61')][_0x1c93('0x67')]=_0x1ae709['id'];return db[_0x1c93('0x5d')]['create'](_0xc7665a[_0x1c93('0x61')]);}})[_0x1c93('0x12')](respondWithResult(_0x44b0cf,null))[_0x1c93('0x1b')](handleError(_0x44b0cf,null));};exports['removeImap']=function(_0x219f91,_0x465a68){return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x219f91['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x465a68,null))['then'](function(_0x51280e){if(_0x51280e){return _0x51280e['setImap'](null);}return null;})[_0x1c93('0x12')](respondWithStatusCode(_0x465a68,null))[_0x1c93('0x1b')](handleError(_0x465a68,null));};exports[_0x1c93('0x81')]=function(_0x268b7c,_0x5e26ad){return db['MailAccount'][_0x1c93('0x6b')]({'where':{'id':_0x268b7c[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x5e26ad,null))['then'](function(_0x23278f){if(_0x23278f){return _0x23278f[_0x1c93('0x81')]();}return null;})[_0x1c93('0x12')](respondWithResult(_0x5e26ad,null))[_0x1c93('0x1b')](handleError(_0x5e26ad,null));};exports[_0x1c93('0x82')]=function(_0x5aad6b,_0x5810d9){if(_0x5aad6b[_0x1c93('0x61')]['id']){delete _0x5aad6b[_0x1c93('0x61')]['id'];}return db[_0x1c93('0x46')][_0x1c93('0x5f')]({'where':{'id':_0x5aad6b[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x5810d9,null))[_0x1c93('0x12')](function(_0x3d1610){if(_0x3d1610){_0x5aad6b[_0x1c93('0x61')][_0x1c93('0x67')]=_0x3d1610['id'];return db[_0x1c93('0x5e')][_0x1c93('0x69')](_0x5aad6b[_0x1c93('0x61')]);}})['then'](respondWithResult(_0x5810d9,null))['catch'](handleError(_0x5810d9,null));};exports[_0x1c93('0x83')]=function(_0x1c78f2,_0x31cc4d){return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x1c78f2[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x31cc4d,null))[_0x1c93('0x12')](function(_0x4f0e62){if(_0x4f0e62){return _0x4f0e62[_0x1c93('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x31cc4d,null))['catch'](handleError(_0x31cc4d,null));};exports[_0x1c93('0x85')]=function(_0x4b5e1d,_0x5539cc){return db[_0x1c93('0x86')][_0x1c93('0x5f')]({'where':{'id':_0x4b5e1d['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x5539cc,null))[_0x1c93('0x12')](function(_0x27c35c){if(_0x27c35c){return _0x27c35c[_0x1c93('0x85')](_0x4b5e1d[_0x1c93('0x61')][_0x1c93('0x71')],_[_0x1c93('0x87')](_0x4b5e1d['body'],[_0x1c93('0x71'),'id'])||{});}})[_0x1c93('0x12')](respondWithResult(_0x5539cc,null))[_0x1c93('0x1b')](handleError(_0x5539cc,null));};exports[_0x1c93('0x88')]=function(_0x2596e0,_0x2b0ce4){var _0x3d9b0f={'raw':![],'where':{}};var _0x36d560={};var _0x382838={'count':0x0,'rows':[]};return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x2596e0[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x2b0ce4,null))['then'](function(_0x5a4e5d){if(_0x5a4e5d){_0x36d560[_0x1c93('0x4a')]=_[_0x1c93('0x4d')](db[_0x1c93('0x86')][_0x1c93('0x47')]);_0x36d560[_0x1c93('0x4c')]=_[_0x1c93('0x4d')](_0x2596e0['query']);_0x36d560[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x36d560[_0x1c93('0x4a')],_0x36d560[_0x1c93('0x4c')]);_0x3d9b0f[_0x1c93('0x50')]=_[_0x1c93('0x4f')](_0x36d560[_0x1c93('0x4a')],qs[_0x1c93('0x51')](_0x2596e0[_0x1c93('0x4c')]['fields']));_0x3d9b0f[_0x1c93('0x50')]=_0x3d9b0f[_0x1c93('0x50')][_0x1c93('0x52')]?_0x3d9b0f[_0x1c93('0x50')]:_0x36d560[_0x1c93('0x4a')];if(!_0x2596e0[_0x1c93('0x4c')][_0x1c93('0x53')](_0x1c93('0x54'))){_0x3d9b0f[_0x1c93('0x21')]=qs[_0x1c93('0x21')](_0x2596e0[_0x1c93('0x4c')][_0x1c93('0x21')]);_0x3d9b0f['offset']=qs['offset'](_0x2596e0[_0x1c93('0x4c')]['offset']);}_0x3d9b0f['order']=qs[_0x1c93('0x6d')](_0x2596e0['query'][_0x1c93('0x6d')]);_0x3d9b0f[_0x1c93('0x55')]=qs['filters'](_[_0x1c93('0x6e')](_0x2596e0[_0x1c93('0x4c')],_0x36d560['filters']));_0x3d9b0f[_0x1c93('0x55')][_0x1c93('0x67')]=_0x5a4e5d['id'];if(_0x2596e0[_0x1c93('0x4c')][_0x1c93('0x56')]){_0x3d9b0f['where']=_[_0x1c93('0x57')](_0x3d9b0f[_0x1c93('0x55')],{'$or':_[_0x1c93('0x4b')](_0x3d9b0f['attributes'],function(_0x369d08){var _0x5c934b={};_0x5c934b[_0x369d08]={'$like':'%'+_0x2596e0['query'][_0x1c93('0x56')]+'%'};return _0x5c934b;})});}_0x3d9b0f=_[_0x1c93('0x57')]({},_0x3d9b0f,_0x2596e0[_0x1c93('0x89')]);return db[_0x1c93('0x86')][_0x1c93('0x23')]({'where':_0x3d9b0f[_0x1c93('0x55')]})['then'](function(_0x2dbf5e){_0x382838[_0x1c93('0x23')]=_0x2dbf5e;if(_0x2596e0[_0x1c93('0x4c')]['includeAll']){_0x3d9b0f[_0x1c93('0x59')]=[{'model':db[_0x1c93('0x8a')],'as':_0x1c93('0x8b'),'required':![]},{'model':db[_0x1c93('0x8c')],'as':_0x1c93('0x8d'),'attributes':[_0x1c93('0x2b'),'fullname',_0x1c93('0x8e')],'required':![]},{'model':db['Tag'],'as':_0x1c93('0x8f'),'attributes':['id',_0x1c93('0x2b'),'color'],'where':_0x2596e0[_0x1c93('0x4c')][_0x1c93('0x90')]?{'id':_0x2596e0[_0x1c93('0x4c')][_0x1c93('0x90')]}:undefined,'required':_0x2596e0[_0x1c93('0x4c')][_0x1c93('0x90')]?!![]:![]}];}return db[_0x1c93('0x86')][_0x1c93('0x6f')](_0x3d9b0f);})[_0x1c93('0x12')](function(_0x253933){_0x382838[_0x1c93('0x5a')]=_0x253933;return _0x382838;});}})[_0x1c93('0x12')](respondWithFilteredResult(_0x2b0ce4,_0x3d9b0f))[_0x1c93('0x1b')](handleError(_0x2b0ce4,null));};exports[_0x1c93('0x91')]=function addApplications(_0x59251,_0x1cd5e8){var _0x2d3993=_0x59251['params']['id'];var _0x5edd4c=_0x59251['body'];var _0x1dda66=0xc8;var _0x3b02af=null;return db[_0x1c93('0x92')][_0x1c93('0x93')]({'isolationLevel':db['sequelize'][_0x1c93('0x94')]['ISOLATION_LEVELS'][_0x1c93('0x95')]},function(_0x3f4110){return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x2d3993},'transaction':_0x3f4110})[_0x1c93('0x12')](function(_0x1ec851){if(_0x1ec851){return db[_0x1c93('0x96')][_0x1c93('0x26')]({'where':{'MailAccountId':_0x2d3993},'transaction':_0x3f4110})[_0x1c93('0x12')](function(){var _0x1caeb0=_['map'](_0x5edd4c,function(_0x401952){_0x401952[_0x1c93('0x67')]=_0x2d3993;return _0x401952;});return db[_0x1c93('0x96')][_0x1c93('0x97')](_0x1caeb0,{'transaction':_0x3f4110});});}else{_0x1dda66=0x194;_0x3b02af=[];}});})[_0x1c93('0x12')](function(){if(_0x1dda66!==0x194){return db[_0x1c93('0x96')][_0x1c93('0x98')]({'where':{'MailAccountId':_0x2d3993},'order':'priority'})[_0x1c93('0x12')](function(_0x2d8454){_0x3b02af=_0x2d8454;});}})[_0x1c93('0x1b')](function(_0x29d583){_0x1dda66=0x1f4;logger[_0x1c93('0x17')](_0x29d583['stack']);if(_0x29d583[_0x1c93('0x2b')]){delete _0x29d583[_0x1c93('0x2b')];}_0x3b02af=_0x29d583;})[_0x1c93('0x99')](function(){if(_0x3b02af===null){_0x1cd5e8['sendStatus'](_0x1dda66);}else{if(_0x1dda66===0x1f4){_0x1cd5e8[_0x1c93('0x1e')](_0x1dda66)[_0x1c93('0x2c')](_0x3b02af);}else{_0x1cd5e8['status'](_0x1dda66)[_0x1c93('0x1f')](_0x3b02af);}}});};exports[_0x1c93('0x9a')]=function(_0x217ef0,_0x15cb78){var _0x306e3a={};var _0x476372={};var _0xccac86;var _0x4d3bec;return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x217ef0['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x15cb78,null))[_0x1c93('0x12')](function(_0x5ea780){if(_0x5ea780){_0xccac86=_0x5ea780;_0x476372[_0x1c93('0x4a')]=_[_0x1c93('0x4d')](db['MailApplication'][_0x1c93('0x47')]);_0x476372[_0x1c93('0x4c')]=_['keys'](_0x217ef0[_0x1c93('0x4c')]);_0x476372[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x476372['model'],_0x476372[_0x1c93('0x4c')]);_0x306e3a[_0x1c93('0x50')]=_['intersection'](_0x476372['model'],qs[_0x1c93('0x51')](_0x217ef0[_0x1c93('0x4c')]['fields']));_0x306e3a[_0x1c93('0x50')]=_0x306e3a[_0x1c93('0x50')]['length']?_0x306e3a[_0x1c93('0x50')]:_0x476372[_0x1c93('0x4a')];_0x306e3a[_0x1c93('0x6c')]=qs[_0x1c93('0x6d')](_0x217ef0[_0x1c93('0x4c')][_0x1c93('0x6d')]);_0x306e3a['where']=qs[_0x1c93('0x4e')](_[_0x1c93('0x6e')](_0x217ef0[_0x1c93('0x4c')],_0x476372[_0x1c93('0x4e')]));if(_0x217ef0[_0x1c93('0x4c')][_0x1c93('0x56')]){_0x306e3a[_0x1c93('0x55')]=_['merge'](_0x306e3a[_0x1c93('0x55')],{'$or':_[_0x1c93('0x4b')](_0x306e3a[_0x1c93('0x50')],function(_0x507c7b){var _0x149a05={};_0x149a05[_0x507c7b]={'$like':'%'+_0x217ef0[_0x1c93('0x4c')][_0x1c93('0x56')]+'%'};return _0x149a05;})});}_0x306e3a=_[_0x1c93('0x57')]({},_0x306e3a,_0x217ef0[_0x1c93('0x89')]);return _0xccac86[_0x1c93('0x9a')](_0x306e3a);}})['then'](function(_0x3fd505){if(_0x3fd505){_0x4d3bec=_0x3fd505[_0x1c93('0x52')];if(!_0x217ef0[_0x1c93('0x4c')]['hasOwnProperty'](_0x1c93('0x54'))){_0x306e3a[_0x1c93('0x21')]=qs['limit'](_0x217ef0[_0x1c93('0x4c')][_0x1c93('0x21')]);_0x306e3a[_0x1c93('0x20')]=qs[_0x1c93('0x20')](_0x217ef0[_0x1c93('0x4c')]['offset']);}return _0xccac86['getApplications'](_0x306e3a);}})[_0x1c93('0x12')](function(_0x5894e2){if(_0x5894e2){return _0x5894e2?{'count':_0x4d3bec,'rows':_0x5894e2}:null;}})[_0x1c93('0x12')](respondWithResult(_0x15cb78,null))[_0x1c93('0x1b')](handleError(_0x15cb78,null));};exports[_0x1c93('0x9b')]=function(_0x5fdbce,_0x53515b){var _0x33f0c8={'raw':!![],'where':{}};var _0x28355e={};var _0x376a1d={'count':0x0,'rows':[]};return db[_0x1c93('0x46')][_0x1c93('0x6b')]({'where':{'id':_0x5fdbce[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x53515b,null))[_0x1c93('0x12')](function(_0x30faef){if(_0x30faef){_0x28355e[_0x1c93('0x4a')]=_[_0x1c93('0x4d')](db[_0x1c93('0x9c')][_0x1c93('0x47')]);_0x28355e[_0x1c93('0x4c')]=_['keys'](_0x5fdbce[_0x1c93('0x4c')]);_0x28355e[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x28355e['model'],_0x28355e['query']);_0x33f0c8['attributes']=_['intersection'](_0x28355e[_0x1c93('0x4a')],qs[_0x1c93('0x51')](_0x5fdbce[_0x1c93('0x4c')][_0x1c93('0x51')]));_0x33f0c8[_0x1c93('0x50')]=_0x33f0c8[_0x1c93('0x50')][_0x1c93('0x52')]?_0x33f0c8['attributes']:_0x28355e[_0x1c93('0x4a')];if(!_0x5fdbce[_0x1c93('0x4c')][_0x1c93('0x53')](_0x1c93('0x54'))){_0x33f0c8[_0x1c93('0x21')]=qs['limit'](_0x5fdbce[_0x1c93('0x4c')][_0x1c93('0x21')]);_0x33f0c8[_0x1c93('0x20')]=qs[_0x1c93('0x20')](_0x5fdbce['query'][_0x1c93('0x20')]);}_0x33f0c8[_0x1c93('0x6c')]=qs[_0x1c93('0x6d')](_0x5fdbce[_0x1c93('0x4c')]['sort']);_0x33f0c8['where']=qs[_0x1c93('0x4e')](_[_0x1c93('0x6e')](_0x5fdbce[_0x1c93('0x4c')],_0x28355e[_0x1c93('0x4e')]));_0x33f0c8[_0x1c93('0x55')][_0x1c93('0x67')]=_0x30faef['id'];if(_0x5fdbce['query']['filter']){_0x33f0c8[_0x1c93('0x55')]=_[_0x1c93('0x57')](_0x33f0c8[_0x1c93('0x55')],{'$or':_['map'](_0x33f0c8[_0x1c93('0x50')],function(_0x2fa2b7){var _0x30230f={};_0x30230f[_0x2fa2b7]={'$like':'%'+_0x5fdbce[_0x1c93('0x4c')][_0x1c93('0x56')]+'%'};return _0x30230f;})});}if(_0x5fdbce[_0x1c93('0x4c')][_0x1c93('0x9d')]){var _0x352e6a=_0x5fdbce['query'][_0x1c93('0x9d')][_0x1c93('0x9e')](',');var _0x6fcc10={};_0x6fcc10[_0x352e6a[0x0]]={'$gte':moment(_0x352e6a[0x1])[_0x1c93('0x9f')](_0x1c93('0xa0'))};_0x33f0c8['where']=_[_0x1c93('0x57')](_0x33f0c8[_0x1c93('0x55')],_0x6fcc10);}_0x33f0c8=_['merge']({},_0x33f0c8,_0x5fdbce[_0x1c93('0x89')]);return db[_0x1c93('0x9c')][_0x1c93('0x23')]({'where':_0x33f0c8[_0x1c93('0x55')]})[_0x1c93('0x12')](function(_0x288918){_0x376a1d[_0x1c93('0x23')]=_0x288918;if(_0x5fdbce['query'][_0x1c93('0x58')]){_0x33f0c8[_0x1c93('0x59')]=[{'all':!![]}];}return db[_0x1c93('0x9c')]['findAll'](_0x33f0c8);})[_0x1c93('0x12')](function(_0x3183b2){if(_0x5fdbce['query'][_0x1c93('0xa1')]==='true'){for(var _0x176b5e=0x0;_0x176b5e<_0x3183b2[_0x1c93('0x52')];_0x176b5e++){_0x3183b2[_0x176b5e][_0x1c93('0x61')]=juice(_0x3183b2[_0x176b5e][_0x1c93('0x61')]);}}_0x376a1d[_0x1c93('0x5a')]=_0x3183b2;return _0x376a1d;});}})[_0x1c93('0x12')](respondWithFilteredResult(_0x53515b,_0x33f0c8))['catch'](handleError(_0x53515b,null));};exports[_0x1c93('0x2c')]=function(_0xa73a61,_0x34bf29){var _0x4c4ad5,_0x1845eb={},_0x313d50;if(_0xa73a61['body']['to']){_0x313d50=_0xa73a61[_0x1c93('0x61')]['to']['split'](',')[0x0];}return db[_0x1c93('0x46')][_0x1c93('0x5f')]({'where':{'id':_0xa73a61[_0x1c93('0x5c')]['id']},'include':[{'model':db[_0x1c93('0xa2')],'as':_0x1c93('0xa3'),'include':[{'model':db[_0x1c93('0x8a')],'as':_0x1c93('0xa4'),'where':{'email':_0x313d50},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1c93('0x5e')],'as':_0x1c93('0x42'),'raw':!![],'include':[{'model':db[_0x1c93('0xa5')],'as':_0x1c93('0xa5'),'raw':!![]}]}]})[_0x1c93('0x12')](handleEntityNotFound(_0x34bf29,null))['then'](function(_0x52f7a4){if(!_0x52f7a4)return;_0x4c4ad5=_0x52f7a4;if(!_0x52f7a4[_0x1c93('0x42')])throw new Error(_0x1c93('0xa6'));if(_[_0x1c93('0x77')](_0xa73a61[_0x1c93('0x61')][_0x1c93('0xa7')])){_0xa73a61[_0x1c93('0x61')]['from']=util[_0x1c93('0x9f')](_0x1c93('0xa8'),_0x52f7a4['name'],_0x52f7a4[_0x1c93('0xa9')]||_0x52f7a4['Smtp'][_0x1c93('0x36')]);}if(_0xa73a61[_0x1c93('0x61')][_0x1c93('0xaa')]&&_0xa73a61[_0x1c93('0x61')][_0x1c93('0xaa')]['length']){for(var _0x3647c0=0x0;_0x3647c0<_0xa73a61[_0x1c93('0x61')][_0x1c93('0xaa')][_0x1c93('0x52')];_0x3647c0+=0x1){_0xa73a61[_0x1c93('0x61')]['attachments'][_0x3647c0]={'filename':_0xa73a61[_0x1c93('0x61')][_0x1c93('0xaa')][_0x3647c0][_0x1c93('0x2b')],'path':path[_0x1c93('0xab')](config['root'],_0x1c93('0xac'),_0xa73a61[_0x1c93('0x61')][_0x1c93('0xaa')][_0x3647c0][_0x1c93('0xad')])};}}var _0x2e2a59=_0x52f7a4[_0x1c93('0xae')]();return respondWithRpcPromise('SendMail',_0x1c93('0xaf'),{'account':_0x2e2a59,'message':_0xa73a61[_0x1c93('0x61')]});})[_0x1c93('0x12')](function(_0x1c0730){if(!_0x1c0730)return;_0x1845eb=_0x1c0730;if(!_0x4c4ad5[_0x1c93('0xa3')])throw new Error(_0x1c93('0xb0'));if(_0x4c4ad5['List'][_0x1c93('0xa4')]['length'])return _0x4c4ad5[_0x1c93('0xa3')]['Contacts'][0x0];return db[_0x1c93('0x8a')]['create'](_[_0x1c93('0xa')](_0xa73a61[_0x1c93('0x61')],{'firstName':_0xa73a61[_0x1c93('0x61')]['to'],'email':_0xa73a61['body']['to'],'phone':_0xa73a61['body']['to'],'ListId':_0x4c4ad5[_0x1c93('0x76')]}));})[_0x1c93('0x12')](function(_0x45f078){if(!_0x45f078)return;var _0xba2ff4={'UserId':_0xa73a61[_0x1c93('0x36')]['id'],'ContactId':_0x45f078['id'],'MailAccountId':_0x4c4ad5['id'],'inReplyTo':_0x1845eb[_0x1c93('0xb1')],'to':_0xa73a61[_0x1c93('0x61')]['from'],'cc':_0xa73a61['body']['cc'],'subject':_0xa73a61[_0x1c93('0x61')][_0x1c93('0xb2')],'attach':_0xa73a61['body'][_0x1c93('0xb3')],'firstMsgDirection':_0x1c93('0xb4'),'lastMsgAt':moment()['format'](_0x1c93('0xa0')),'lastMsgDirection':_0x1c93('0xb4'),'Messages':[_[_0x1c93('0x57')](_0xa73a61['body'],{'messageId':_0x1845eb['messageId'],'sentAt':moment()[_0x1c93('0x9f')](_0x1c93('0xa0')),'read':!![],'MailAccountId':_0x4c4ad5['id'],'UserId':_0xa73a61['user']['id'],'ContactId':_0x45f078['id']})]};if(_0xa73a61['body'][_0x1c93('0xb5')]){_0xba2ff4=_[_0x1c93('0x57')](_0xba2ff4,_0xa73a61[_0x1c93('0x61')][_0x1c93('0xb5')]);}return db[_0x1c93('0x86')][_0x1c93('0x69')](_0xba2ff4,{'include':[{'model':db[_0x1c93('0x9c')],'as':'Messages'}]});})[_0x1c93('0x12')](respondWithResult(_0x34bf29,null))[_0x1c93('0x1b')](handleError(_0x34bf29,null));};exports['verifySmtp']=function(_0x599e1c,_0x4d09f3){return db[_0x1c93('0x46')]['find']({'where':{'id':_0x599e1c[_0x1c93('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x1c93('0x42'),'raw':!![],'include':[{'model':db[_0x1c93('0xa5')],'as':_0x1c93('0xa5'),'raw':!![]}]}]})[_0x1c93('0x12')](handleEntityNotFound(_0x4d09f3,null))['then'](function(_0x47714a){if(!_0x47714a[_0x1c93('0x42')])return;var _0x607791=_0x47714a[_0x1c93('0xae')]();return respondWithRpcPromise(_0x1c93('0xb6'),_0x1c93('0xb7'),{'account':_0x607791});})[_0x1c93('0x12')](respondWithResult(_0x4d09f3,null))[_0x1c93('0x1b')](handleError(_0x4d09f3,null));};exports[_0x1c93('0x26')]=function(_0xf9a177,_0x65e84c){return db['MailAccount']['find']({'where':{'id':_0xf9a177[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x65e84c,null))[_0x1c93('0x12')](function(_0x577c5e){if(_0x577c5e&&_0x577c5e[_0x1c93('0x3e')]){throw new db[(_0x1c93('0xb8'))][(_0x1c93('0xb9'))](_0x1c93('0xba'));}return _0x577c5e;})[_0x1c93('0x12')](removeEntity(_0x65e84c,null))[_0x1c93('0x1b')](handleError(_0x65e84c,null));};exports['addAgents']=function(_0x1ff6ff,_0x155a4b){return db[_0x1c93('0x46')][_0x1c93('0x5f')]({'where':{'id':_0x1ff6ff[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x155a4b,null))[_0x1c93('0x12')](function(_0x4128d4){if(_0x4128d4){return _0x4128d4[_0x1c93('0xbb')](_0x1ff6ff[_0x1c93('0x61')][_0x1c93('0x71')],_[_0x1c93('0x87')](_0x1ff6ff['body'],['ids','id'])||{})[_0x1c93('0xbc')](function(_0x2278a6){for(var _0x87cb76=0x0;_0x87cb76<_0x1ff6ff['body'][_0x1c93('0x71')]['length'];_0x87cb76+=0x1){socket['emit'](_0x1c93('0xbd'),{'UserId':Number(_0x1ff6ff[_0x1c93('0x61')][_0x1c93('0x71')][_0x87cb76]),'MailAccountId':Number(_0x1ff6ff[_0x1c93('0x5c')]['id'])});}return _0x2278a6;});}})[_0x1c93('0x12')](respondWithResult(_0x155a4b,null))[_0x1c93('0x1b')](handleError(_0x155a4b,null));};exports[_0x1c93('0xbe')]=function(_0x5a4480,_0x534a23){return db[_0x1c93('0x46')][_0x1c93('0x5f')]({'where':{'id':_0x5a4480['params']['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x534a23,null))[_0x1c93('0x12')](function(_0x3a585a){if(_0x3a585a){return _0x3a585a[_0x1c93('0xbe')](_0x5a4480[_0x1c93('0x4c')]['ids'])[_0x1c93('0x12')](function(){if(_[_0x1c93('0xbf')](_0x5a4480['query'][_0x1c93('0x71')])){for(var _0x13e741=0x0;_0x13e741<_0x5a4480[_0x1c93('0x4c')]['ids'][_0x1c93('0x52')];_0x13e741+=0x1){socket[_0x1c93('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x5a4480['query'][_0x1c93('0x71')][_0x13e741]),'MailAccountId':Number(_0x5a4480['params']['id'])});}}else{socket[_0x1c93('0xc0')](_0x1c93('0xc1'),{'UserId':Number(_0x5a4480[_0x1c93('0x4c')][_0x1c93('0x71')]),'MailAccountId':Number(_0x5a4480[_0x1c93('0x5c')]['id'])});}});}})[_0x1c93('0x12')](respondWithStatusCode(_0x534a23,null))['catch'](handleError(_0x534a23,null));};exports[_0x1c93('0xc2')]=function(_0x33809e,_0x434866){var _0x52dfad={};var _0x3cea23={};var _0x2e7f74;var _0x5e06ee;return db['MailAccount'][_0x1c93('0x6b')]({'where':{'id':_0x33809e[_0x1c93('0x5c')]['id']}})[_0x1c93('0x12')](handleEntityNotFound(_0x434866,null))['then'](function(_0x4c0ed9){if(_0x4c0ed9){_0x2e7f74=_0x4c0ed9;_0x3cea23[_0x1c93('0x4a')]=_[_0x1c93('0x4d')](db['User'][_0x1c93('0x47')]);_0x3cea23['query']=_[_0x1c93('0x4d')](_0x33809e[_0x1c93('0x4c')]);_0x3cea23[_0x1c93('0x4e')]=_[_0x1c93('0x4f')](_0x3cea23['model'],_0x3cea23[_0x1c93('0x4c')]);_0x52dfad[_0x1c93('0x50')]=_[_0x1c93('0x4f')](_0x3cea23['model'],qs[_0x1c93('0x51')](_0x33809e['query'][_0x1c93('0x51')]));_0x52dfad[_0x1c93('0x50')]=_0x52dfad[_0x1c93('0x50')][_0x1c93('0x52')]?_0x52dfad[_0x1c93('0x50')]:_0x3cea23[_0x1c93('0x4a')];_0x52dfad[_0x1c93('0x6c')]=qs['sort'](_0x33809e[_0x1c93('0x4c')]['sort']);_0x52dfad[_0x1c93('0x55')]=qs[_0x1c93('0x4e')](_[_0x1c93('0x6e')](_0x33809e[_0x1c93('0x4c')],_0x3cea23[_0x1c93('0x4e')]));if(_0x33809e[_0x1c93('0x4c')][_0x1c93('0x56')]){_0x52dfad[_0x1c93('0x55')]=_[_0x1c93('0x57')](_0x52dfad[_0x1c93('0x55')],{'$or':_['map'](_0x52dfad['attributes'],function(_0x49784c){var _0x40e670={};_0x40e670[_0x49784c]={'$like':'%'+_0x33809e['query'][_0x1c93('0x56')]+'%'};return _0x40e670;})});}_0x52dfad=_['merge']({},_0x52dfad,_0x33809e[_0x1c93('0x89')]);return _0x2e7f74[_0x1c93('0xc2')](_0x52dfad);}})['then'](function(_0x47b571){if(_0x47b571){_0x5e06ee=_0x47b571['length'];if(!_0x33809e[_0x1c93('0x4c')][_0x1c93('0x53')]('nolimit')){_0x52dfad[_0x1c93('0x21')]=qs[_0x1c93('0x21')](_0x33809e[_0x1c93('0x4c')][_0x1c93('0x21')]);_0x52dfad[_0x1c93('0x20')]=qs[_0x1c93('0x20')](_0x33809e[_0x1c93('0x4c')][_0x1c93('0x20')]);}return _0x2e7f74[_0x1c93('0xc2')](_0x52dfad);}})['then'](function(_0x20676d){if(_0x20676d){return _0x20676d?{'count':_0x5e06ee,'rows':_0x20676d}:null;}})[_0x1c93('0x12')](respondWithResult(_0x434866,null))['catch'](handleError(_0x434866,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c9cb66c..2c0eb33 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 _0x4cb5=['../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x5426e0,_0x316e4f){var _0x4aedec=function(_0x33975a){while(--_0x33975a){_0x5426e0['push'](_0x5426e0['shift']());}};_0x4aedec(++_0x316e4f);}(_0x4cb5,0x8f));var _0x54cb=function(_0x2e1a49,_0x5a4f26){_0x2e1a49=_0x2e1a49-0x0;var _0x56234d=_0x4cb5[_0x2e1a49];return _0x56234d;};'use strict';var EventEmitter=require(_0x54cb('0x0'));var MailAccount=require(_0x54cb('0x1'))['db'][_0x54cb('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x54cb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x54cb('0x4'),'afterDestroy':_0x54cb('0x5')};function emitEvent(_0x240a36){return function(_0xe3fc36,_0x297dd8,_0xf3461f){MailAccountEvents[_0x54cb('0x6')](_0x240a36+':'+_0xe3fc36['id'],_0xe3fc36);MailAccountEvents['emit'](_0x240a36,_0xe3fc36);_0xf3461f(null);};}for(var e in events){if(events[_0x54cb('0x7')](e)){var event=events[e];MailAccount[_0x54cb('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x0733=['emit','hasOwnProperty','hook','exports','MailAccount','setMaxListeners','save','remove'];(function(_0x26f22b,_0x5c77fc){var _0x4bf48f=function(_0x41c49d){while(--_0x41c49d){_0x26f22b['push'](_0x26f22b['shift']());}};_0x4bf48f(++_0x5c77fc);}(_0x0733,0xc4));var _0x3073=function(_0x3b97a1,_0x381a7d){_0x3b97a1=_0x3b97a1-0x0;var _0x5d2eba=_0x0733[_0x3b97a1];return _0x5d2eba;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x3073('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3073('0x1')](0x0);var events={'afterCreate':_0x3073('0x2'),'afterUpdate':'update','afterDestroy':_0x3073('0x3')};function emitEvent(_0x441cd2){return function(_0x5f2625,_0x322391,_0xfcabfd){MailAccountEvents[_0x3073('0x4')](_0x441cd2+':'+_0x5f2625['id'],_0x5f2625);MailAccountEvents[_0x3073('0x4')](_0x441cd2,_0x5f2625);_0xfcabfd(null);};}for(var e in events){if(events[_0x3073('0x5')](e)){var event=events[e];MailAccount[_0x3073('0x6')](e,emitEvent(event));}}module[_0x3073('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1a6fbf3..86d7d7b 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 _0x75e6=['MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','data5','user','pass','./mailAccount.attributes','define'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0x75e6,0x1ae));var _0x675e=function(_0x49d5a6,_0x3a1f12){_0x49d5a6=_0x49d5a6-0x0;var _0x56d4fa=_0x75e6[_0x49d5a6];return _0x56d4fa;};'use strict';var attributes=require(_0x675e('0x0'));module['exports']=function(_0x3dc64a){return _0x3dc64a[_0x675e('0x1')](_0x675e('0x2'),attributes,{'tableName':_0x675e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4faddc=this;var _0x1b2072={'id':_0x4faddc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4faddc[_0x675e('0x4')]!==_0x675e('0x5')){_0x1b2072[_0x675e('0x6')]=_0x4faddc[_0x675e('0x4')];}else{_0x1b2072[_0x675e('0x7')]=_0x4faddc[_0x675e('0x8')]['host'];_0x1b2072[_0x675e('0x9')]=_0x4faddc[_0x675e('0x8')][_0x675e('0x9')];_0x1b2072['secure']=_0x4faddc['Smtp']['secure'];}if(_0x4faddc[_0x675e('0x8')][_0x675e('0xa')]){if(_0x4faddc[_0x675e('0x8')][_0x675e('0xb')]){if(!_0x4faddc['Smtp'][_0x675e('0xc')])throw new Error(_0x675e('0xd'));_0x1b2072[_0x675e('0xe')]={'type':'OAuth2','user':_0x4faddc[_0x675e('0x8')]['user'],'accessToken':_0x4faddc[_0x675e('0x8')][_0x675e('0xc')][_0x675e('0xf')]};}else{_0x1b2072[_0x675e('0xe')]={'user':_0x4faddc[_0x675e('0x8')][_0x675e('0x10')],'pass':_0x4faddc['Smtp'][_0x675e('0x11')]};}}return _0x1b2072;}}});}; \ No newline at end of file +var _0x69c1=['secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','host','Smtp','port'];(function(_0x2232fa,_0x270722){var _0x2f0564=function(_0x23d048){while(--_0x23d048){_0x2232fa['push'](_0x2232fa['shift']());}};_0x2f0564(++_0x270722);}(_0x69c1,0xe5));var _0x169c=function(_0x311666,_0x17b07d){_0x311666=_0x311666-0x0;var _0x2bc692=_0x69c1[_0x311666];return _0x2bc692;};'use strict';var attributes=require(_0x169c('0x0'));module[_0x169c('0x1')]=function(_0x2b41a2){return _0x2b41a2[_0x169c('0x2')](_0x169c('0x3'),attributes,{'tableName':_0x169c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x33b90a=this;var _0x4b612b={'id':_0x33b90a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x33b90a['provider']!==_0x169c('0x5')){_0x4b612b[_0x169c('0x6')]=_0x33b90a[_0x169c('0x7')];}else{_0x4b612b[_0x169c('0x8')]=_0x33b90a[_0x169c('0x9')][_0x169c('0x8')];_0x4b612b[_0x169c('0xa')]=_0x33b90a[_0x169c('0x9')][_0x169c('0xa')];_0x4b612b[_0x169c('0xb')]=_0x33b90a[_0x169c('0x9')]['secure'];}if(_0x33b90a[_0x169c('0x9')][_0x169c('0xc')]){if(_0x33b90a['Smtp'][_0x169c('0xd')]){if(!_0x33b90a[_0x169c('0x9')][_0x169c('0xe')])throw new Error(_0x169c('0xf'));_0x4b612b['auth']={'type':_0x169c('0x10'),'user':_0x33b90a[_0x169c('0x9')][_0x169c('0x11')],'accessToken':_0x33b90a[_0x169c('0x9')][_0x169c('0xe')][_0x169c('0x12')]};}else{_0x4b612b[_0x169c('0x13')]={'user':_0x33b90a[_0x169c('0x9')]['user'],'pass':_0x33b90a[_0x169c('0x9')]['pass']};}}return _0x4b612b;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index bb71e69..daf025e 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 _0xd943=['MailServerOut','Smtp','CloudProvider','get','account','omit','smtpOptions','applications','list','asc','autoclose','close','Contacts','length','defaults','ListId','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','create','spread','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','MailAccount','findAll','options','where','attributes','limit','include','map','model','stringify','GetMailAccount','ShowMailAccount','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','DESC','MailApplication','Applications'];(function(_0x2fe6d9,_0x4e5470){var _0x3dfbfd=function(_0x21ec09){while(--_0x21ec09){_0x2fe6d9['push'](_0x2fe6d9['shift']());}};_0x3dfbfd(++_0x4e5470);}(_0xd943,0x15d));var _0x3d94=function(_0x487353,_0x4caec7){_0x487353=_0x487353-0x0;var _0x23196f=_0xd943[_0x487353];return _0x23196f;};'use strict';var _=require(_0x3d94('0x0'));var moment=require(_0x3d94('0x1'));var BPromise=require(_0x3d94('0x2'));var rs=require(_0x3d94('0x3'));var Redis=require('ioredis');var db=require(_0x3d94('0x4'))['db'];var logger=require(_0x3d94('0x5'))(_0x3d94('0x6'));var config=require(_0x3d94('0x7'));var jayson=require(_0x3d94('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x3d94('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3d94('0xa'))(new Redis(config[_0x3d94('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3984a3,_0x27e381,_0x1cc58c){return new BPromise(function(_0x5908a7,_0x182066){return client['request'](_0x3984a3,_0x1cc58c)[_0x3d94('0xb')](function(_0x301536){logger['info'](_0x3d94('0xc'),_0x27e381,_0x3d94('0xd'));logger[_0x3d94('0xe')](_0x3d94('0xf'),_0x27e381,_0x3d94('0xd'),JSON['stringify'](_0x301536));if(_0x301536[_0x3d94('0x10')]){if(_0x301536[_0x3d94('0x10')][_0x3d94('0x11')]===0x1f4){logger['error'](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x182066(_0x301536['error'][_0x3d94('0x12')]);}logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x5908a7(_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);}else{logger[_0x3d94('0x13')]('MailAccount,\x20%s,\x20%s',_0x27e381,_0x3d94('0xd'));_0x5908a7(_0x301536[_0x3d94('0x14')][_0x3d94('0x12')]);}})[_0x3d94('0x15')](function(_0x4afc92){logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x4afc92);_0x182066(_0x4afc92);});});}exports['GetMailAccount']=function(_0x9bca24){var _0x59b741=this;return new Promise(function(_0x28bead,_0x193934){return db[_0x3d94('0x16')][_0x3d94('0x17')]({'raw':_0x9bca24[_0x3d94('0x18')]?_0x9bca24['options']['raw']===undefined?!![]:![]:!![],'where':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x9bca24['options']?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1a')]||null:null,'limit':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1b')]||null:null,'include':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1e')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1a')],'include':_0x192839[_0x3d94('0x1c')]?_['map'](_0x192839[_0x3d94('0x1c')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1e')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1a')],'include':_0x558fd2[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x558fd2[_0x3d94('0x1c')],function(_0x82b568){return{'model':db[_0x82b568[_0x3d94('0x1e')]],'as':_0x82b568['as'],'attributes':_0x82b568['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x362642){logger['info']('GetMailAccount',_0x9bca24);logger[_0x3d94('0xe')]('GetMailAccount',_0x9bca24,JSON[_0x3d94('0x1f')](_0x362642));_0x28bead(_0x362642);})[_0x3d94('0x15')](function(_0x32403a){logger['error'](_0x3d94('0x20'),_0x32403a['message'],_0x9bca24);_0x193934(_0x59b741[_0x3d94('0x10')](0x1f4,_0x32403a['message']));});});};exports[_0x3d94('0x21')]=function(_0x215ad7){var _0x29b1ff=this;return new Promise(function(_0x246f88,_0x50560c){return db[_0x3d94('0x16')]['find']({'raw':_0x215ad7[_0x3d94('0x18')]?_0x215ad7[_0x3d94('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x215ad7['options']?_0x215ad7[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1a')]||null:null,'include':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x215ad7[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1a')],'include':_0x782c1[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x782c1[_0x3d94('0x1c')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1e')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes'],'include':_0xb493f1['include']?_[_0x3d94('0x1d')](_0xb493f1[_0x3d94('0x1c')],function(_0x1c1b25){return{'model':db[_0x1c1b25[_0x3d94('0x1e')]],'as':_0x1c1b25['as'],'attributes':_0x1c1b25[_0x3d94('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xb')](function(_0x2ef743){if(_0x215ad7[_0x3d94('0x18')][_0x3d94('0x22')]===!![])_0x2ef743[_0x3d94('0x23')]('smtpOptions',_0x2ef743[_0x3d94('0x24')]());logger[_0x3d94('0x13')](_0x3d94('0x21'),_0x215ad7);logger[_0x3d94('0xe')]('ShowMailAccount',_0x215ad7,JSON[_0x3d94('0x1f')](_0x2ef743));_0x246f88(_0x2ef743);})[_0x3d94('0x15')](function(_0x35e0e6){logger[_0x3d94('0x10')](_0x3d94('0x21'),_0x35e0e6['message'],_0x215ad7);_0x50560c(_0x29b1ff[_0x3d94('0x10')](0x1f4,_0x35e0e6[_0x3d94('0x12')]));});});};exports[_0x3d94('0x25')]=function(_0x485066){var _0x4eee4d=this;return new Promise(function(_0x4d8a8f,_0x47905e){var _0x3b3550={'body':_0x485066[_0x3d94('0x26')],'channel':_0x3d94('0x27')};var _0x146ccb=_[_0x3d94('0x28')](_[_0x3d94('0x29')](db[_0x3d94('0x2a')]['rawAttributes']),['createdAt',_0x3d94('0x2b'),_0x3d94('0x2c'),'ListId']);var _0x2d0aa2=![];if(_0x485066['body']['id']){delete _0x485066[_0x3d94('0x26')]['id'];}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x26')])||_0x485066['body'][_0x3d94('0x26')]===''){return _0x47905e(_0x4eee4d['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x146ccb));}if(!_[_0x3d94('0x30')](_0x146ccb,_0x485066['body'][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x3d94('0x31')+_0x146ccb));}var _0x15c8e7={};_0x15c8e7[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')]['from'];return db[_0x3d94('0x16')][_0x3d94('0x32')]({'where':{'id':_0x485066['account']['id']},'include':[{'model':db['CmList'],'as':_0x3d94('0x33'),'include':[{'model':db[_0x3d94('0x2a')],'as':'Contacts','where':_0x15c8e7,'limit':0x1,'order':[[_0x3d94('0x2b'),_0x3d94('0x34')]]}]},{'model':db[_0x3d94('0x35')],'as':_0x3d94('0x36')},{'model':db[_0x3d94('0x37')],'as':_0x3d94('0x38'),'include':[{'model':db[_0x3d94('0x39')],'as':_0x3d94('0x39')}]}]})[_0x3d94('0xb')](function(_0x2429bc){if(_0x2429bc&&_0x2429bc[_0x3d94('0x33')]){var _0x29682b=_0x2429bc[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x3b')]=_[_0x3d94('0x3c')](_0x29682b,['Applications',_0x3d94('0x33')]);_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x3d')]=_0x2429bc[_0x3d94('0x24')]();_0x3b3550[_0x3d94('0x3e')]=_0x29682b[_0x3d94('0x36')];_0x3b3550[_0x3d94('0x3f')]=_0x29682b[_0x3d94('0x33')];_0x3b3550[_0x3d94('0x3e')]=_['orderBy'](_0x3b3550[_0x3d94('0x3e')],['priority'],[_0x3d94('0x40')]);if(_0x3b3550[_0x3d94('0x3b')]&&_0x3b3550['account'][_0x3d94('0x41')]){_0x3b3550['applications']['push']({'id':0x0,'priority':_0x3b3550[_0x3d94('0x3e')]['length']+0x1,'app':_0x3d94('0x42'),'appdata':_0x3d94('0x41'),'interval':'*,*,*,*'});}if(_0x3b3550[_0x3d94('0x3b')]['Applications']){delete _0x3b3550['account'][_0x3d94('0x36')];}if(_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')]){delete _0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')];}if(_0x29682b[_0x3d94('0x33')][_0x3d94('0x43')][_0x3d94('0x44')]){return _0x29682b[_0x3d94('0x33')]['Contacts'][0x0];}var _0x28cfbb=_[_0x3d94('0x45')](_0x485066[_0x3d94('0x26')],{'firstName':_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')],'ListId':_0x29682b[_0x3d94('0x46')]});_0x28cfbb[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')];return db[_0x3d94('0x2a')]['create'](_0x28cfbb);}else{throw new Error(_0x3d94('0x47'));}})['then'](function(_0x709841){_0x3b3550[_0x3d94('0x48')]=_0x709841;if(_0x709841){if(!_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]){_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]=rs[_0x3d94('0x4a')]()+'\x20'+_0x485066['body']['message'][_0x3d94('0x2e')];}var _0x4bd97c={'ContactId':_0x709841['id'],'MailAccountId':_0x485066[_0x3d94('0x3b')]['id'],'inReplyTo':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x49')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['attach'],'lastMsgAt':moment()[_0x3d94('0x4c')](_0x3d94('0x4d')),'lastMsgDirection':'in'};return db[_0x3d94('0x4e')][_0x3d94('0x32')]({'where':{'closed':![],'MailAccountId':_0x485066['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x3d94('0x4f'),'attributes':[_0x3d94('0x49')],'where':{'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['inReplyTo']}}]})[_0x3d94('0xb')](function(_0x1c99d1){if(_0x1c99d1){return[_0x1c99d1,![]];}return db['MailInteraction'][_0x3d94('0x50')](_0x4bd97c)[_0x3d94('0xb')](function(_0x336e36){return[_0x336e36,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3d94('0x51')](function(_0x227372,_0x585531){if(_0x227372){_0x2d0aa2=_0x585531;if(!_0x585531){return _0x227372['update']({'inReplyTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['messageId'],'to':_0x485066['body']['message'][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['subject'],'attach':_0x227372[_0x3d94('0x52')]?_0x227372[_0x3d94('0x52')]:_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x52')],'substatus':null,'substatusAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x227372;}}})[_0x3d94('0xb')](function(_0x41d561){_0x3b3550[_0x3d94('0x53')]=_0x41d561[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x53')][_0x3d94('0x54')]=_0x2d0aa2;return db['MailMessage']['create']({'body':_0x485066[_0x3d94('0x26')]['body'],'MailAccountId':_0x485066['account']['id'],'MailInteractionId':_0x41d561['id'],'direction':'in','ContactId':_0x3b3550['contact']['id'],'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')],'from':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['to'],'cc':_0x485066['body'][_0x3d94('0x12')]['cc'],'subject':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')]['message']['attach'],'Attachments':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x55')],'originTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x56')],'originCc':_0x485066['body']['message'][_0x3d94('0x57')],'bcc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['bcc'],'ChatWebsiteId':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x58')]||null,'originChannel':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x59')]||_0x3d94('0x5a'),'ChatOfflineMessageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x5b')]||null},{'include':[{'model':db[_0x3d94('0x5c')],'as':_0x3d94('0x5d')}]});})[_0x3d94('0xb')](function(_0xe6cfd1){_0x3b3550[_0x3d94('0x12')]=_0xe6cfd1;if(_0x3b3550['interaction'][_0x3d94('0x5e')]){return db[_0x3d94('0x5f')][_0x3d94('0x32')]({'attributes':['id',_0x3d94('0x60')],'where':{'id':_0x3b3550['interaction'][_0x3d94('0x5e')]}})['then'](function(_0x4f217f){if(_0x4f217f){_0x3b3550[_0x3d94('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3d94('0x61'),'appdata':_0x4f217f[_0x3d94('0x60')]+','+(_0x3b3550['account'][_0x3d94('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3d94('0x63'),_0x3d94('0x64'),_0x3b3550);});}return respondWithRpcPromise('Start','startRouting',_0x3b3550);})['then'](function(_0x833d96){_0x4d8a8f(_0x833d96);})['catch'](function(_0x5a8114){_0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x5a8114[_0x3d94('0x12')]));});});}; \ No newline at end of file +var _0xef0f=['Applications','MailServerOut','CloudProvider','get','omit','smtpOptions','list','applications','orderBy','priority','asc','autoclose','push','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','interaction','created','originTo','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','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','MailAccount','findAll','options','attributes','limit','include','map','model','find','where','setDataValue','getSmtpOptions','ShowMailAccount','body','mail','difference','keys','rawAttributes','createdAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','MailApplication'];(function(_0x356f52,_0x301844){var _0xc587b1=function(_0x763c42){while(--_0x763c42){_0x356f52['push'](_0x356f52['shift']());}};_0xc587b1(++_0x301844);}(_0xef0f,0x168));var _0xfef0=function(_0x26f123,_0x4d6c39){_0x26f123=_0x26f123-0x0;var _0x58c576=_0xef0f[_0x26f123];return _0x58c576;};'use strict';var _=require(_0xfef0('0x0'));var moment=require('moment');var BPromise=require(_0xfef0('0x1'));var rs=require(_0xfef0('0x2'));var Redis=require(_0xfef0('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xfef0('0x4'))(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfef0('0x7')][_0xfef0('0x8')]({'port':0x232c});config[_0xfef0('0x9')]=_[_0xfef0('0xa')](config[_0xfef0('0x9')],{'host':_0xfef0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0x9')]));require('./mailAccount.socket')[_0xfef0('0xc')](socket);function respondWithRpcPromise(_0x100e3a,_0x3a81cc,_0x2d42dc){return new BPromise(function(_0x334e74,_0x402dff){return client[_0xfef0('0xd')](_0x100e3a,_0x2d42dc)[_0xfef0('0xe')](function(_0x11bbca){logger[_0xfef0('0xf')](_0xfef0('0x10'),_0x3a81cc,_0xfef0('0x11'));logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x3a81cc,'request\x20sent',JSON[_0xfef0('0x14')](_0x11bbca));if(_0x11bbca[_0xfef0('0x15')]){if(_0x11bbca[_0xfef0('0x15')][_0xfef0('0x16')]===0x1f4){logger[_0xfef0('0x15')](_0xfef0('0x10'),_0x3a81cc,_0x11bbca[_0xfef0('0x15')]['message']);return _0x402dff(_0x11bbca[_0xfef0('0x15')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3a81cc,_0x11bbca[_0xfef0('0x15')][_0xfef0('0x17')]);return _0x334e74(_0x11bbca[_0xfef0('0x15')][_0xfef0('0x17')]);}else{logger[_0xfef0('0xf')](_0xfef0('0x10'),_0x3a81cc,_0xfef0('0x11'));_0x334e74(_0x11bbca[_0xfef0('0x18')]['message']);}})[_0xfef0('0x19')](function(_0x1642cd){logger[_0xfef0('0x15')](_0xfef0('0x10'),_0x3a81cc,_0x1642cd);_0x402dff(_0x1642cd);});});}exports[_0xfef0('0x1a')]=function(_0x55912f){var _0x5283e1=this;return new Promise(function(_0x4e24de,_0x20826b){return db[_0xfef0('0x1b')][_0xfef0('0x1c')]({'raw':_0x55912f['options']?_0x55912f[_0xfef0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x55912f[_0xfef0('0x1d')]?_0x55912f[_0xfef0('0x1d')]['where']||null:null,'attributes':_0x55912f['options']?_0x55912f['options'][_0xfef0('0x1e')]||null:null,'limit':_0x55912f['options']?_0x55912f[_0xfef0('0x1d')][_0xfef0('0x1f')]||null:null,'include':_0x55912f[_0xfef0('0x1d')]?_0x55912f[_0xfef0('0x1d')][_0xfef0('0x20')]?_[_0xfef0('0x21')](_0x55912f['options']['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x22')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1e')],'include':_0x316e20[_0xfef0('0x20')]?_[_0xfef0('0x21')](_0x316e20[_0xfef0('0x20')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x22')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1e')],'include':_0x5df04f['include']?_[_0xfef0('0x21')](_0x5df04f[_0xfef0('0x20')],function(_0xca0cce){return{'model':db[_0xca0cce[_0xfef0('0x22')]],'as':_0xca0cce['as'],'attributes':_0xca0cce[_0xfef0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xe')](function(_0x3e3c4c){logger[_0xfef0('0xf')](_0xfef0('0x1a'),_0x55912f);logger[_0xfef0('0x12')](_0xfef0('0x1a'),_0x55912f,JSON[_0xfef0('0x14')](_0x3e3c4c));_0x4e24de(_0x3e3c4c);})['catch'](function(_0x445625){logger['error']('GetMailAccount',_0x445625[_0xfef0('0x17')],_0x55912f);_0x20826b(_0x5283e1[_0xfef0('0x15')](0x1f4,_0x445625['message']));});});};exports['ShowMailAccount']=function(_0x5cf518){var _0x4f65cd=this;return new Promise(function(_0x4cce8a,_0x417535){return db[_0xfef0('0x1b')][_0xfef0('0x23')]({'raw':_0x5cf518['options']?_0x5cf518['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cf518[_0xfef0('0x1d')]?_0x5cf518['options'][_0xfef0('0x24')]||null:null,'attributes':_0x5cf518[_0xfef0('0x1d')]?_0x5cf518[_0xfef0('0x1d')]['attributes']||null:null,'include':_0x5cf518[_0xfef0('0x1d')]?_0x5cf518['options'][_0xfef0('0x20')]?_[_0xfef0('0x21')](_0x5cf518[_0xfef0('0x1d')][_0xfef0('0x20')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x22')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1e')],'include':_0x3e1a64[_0xfef0('0x20')]?_['map'](_0x3e1a64[_0xfef0('0x20')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x22')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1e')],'include':_0xea09ec[_0xfef0('0x20')]?_[_0xfef0('0x21')](_0xea09ec[_0xfef0('0x20')],function(_0xeb75e2){return{'model':db[_0xeb75e2[_0xfef0('0x22')]],'as':_0xeb75e2['as'],'attributes':_0xeb75e2[_0xfef0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xe')](function(_0x22acf9){if(_0x5cf518[_0xfef0('0x1d')]['smtp']===!![])_0x22acf9[_0xfef0('0x25')]('smtpOptions',_0x22acf9[_0xfef0('0x26')]());logger[_0xfef0('0xf')](_0xfef0('0x27'),_0x5cf518);logger['debug'](_0xfef0('0x27'),_0x5cf518,JSON[_0xfef0('0x14')](_0x22acf9));_0x4cce8a(_0x22acf9);})[_0xfef0('0x19')](function(_0x5537c8){logger[_0xfef0('0x15')](_0xfef0('0x27'),_0x5537c8[_0xfef0('0x17')],_0x5cf518);_0x417535(_0x4f65cd['error'](0x1f4,_0x5537c8[_0xfef0('0x17')]));});});};exports['NotifyMailAccount']=function(_0x49ed48){var _0xf30aff=this;return new Promise(function(_0x547a5d,_0x5c3305){var _0xbf6ddd={'body':_0x49ed48[_0xfef0('0x28')],'channel':_0xfef0('0x29')};var _0x1a6593=_[_0xfef0('0x2a')](_[_0xfef0('0x2b')](db['CmContact'][_0xfef0('0x2c')]),[_0xfef0('0x2d'),'updatedAt','CompanyId',_0xfef0('0x2e')]);var _0x5dc824=![];if(_0x49ed48[_0xfef0('0x28')]['id']){delete _0x49ed48[_0xfef0('0x28')]['id'];}if(_[_0xfef0('0x2f')](_0x49ed48[_0xfef0('0x28')][_0xfef0('0x30')])){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x31')));}if(_[_0xfef0('0x2f')](_0x49ed48['body'][_0xfef0('0x28')])||_0x49ed48['body']['body']===''){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x32')));}if(_['isNil'](_0x49ed48[_0xfef0('0x28')]['mapKey'])){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x33')+_0x1a6593));}if(!_[_0xfef0('0x34')](_0x1a6593,_0x49ed48[_0xfef0('0x28')]['mapKey'])){return _0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0xfef0('0x35')+_0x1a6593));}var _0x504967={};_0x504967[_0x49ed48['body'][_0xfef0('0x36')]]=_0x49ed48['body'][_0xfef0('0x30')];return db[_0xfef0('0x1b')][_0xfef0('0x23')]({'where':{'id':_0x49ed48[_0xfef0('0x37')]['id']},'include':[{'model':db[_0xfef0('0x38')],'as':_0xfef0('0x39'),'include':[{'model':db['CmContact'],'as':_0xfef0('0x3a'),'where':_0x504967,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xfef0('0x3b')],'as':_0xfef0('0x3c')},{'model':db[_0xfef0('0x3d')],'as':'Smtp','include':[{'model':db[_0xfef0('0x3e')],'as':'CloudProvider'}]}]})['then'](function(_0x51f207){if(_0x51f207&&_0x51f207[_0xfef0('0x39')]){var _0x3d471c=_0x51f207[_0xfef0('0x3f')]({'plain':!![]});_0xbf6ddd[_0xfef0('0x37')]=_[_0xfef0('0x40')](_0x3d471c,[_0xfef0('0x3c'),_0xfef0('0x39')]);_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x41')]=_0x51f207['getSmtpOptions']();_0xbf6ddd['applications']=_0x3d471c[_0xfef0('0x3c')];_0xbf6ddd[_0xfef0('0x42')]=_0x3d471c[_0xfef0('0x39')];_0xbf6ddd[_0xfef0('0x43')]=_[_0xfef0('0x44')](_0xbf6ddd[_0xfef0('0x43')],[_0xfef0('0x45')],[_0xfef0('0x46')]);if(_0xbf6ddd['account']&&_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x47')]){_0xbf6ddd[_0xfef0('0x43')][_0xfef0('0x48')]({'id':0x0,'priority':_0xbf6ddd[_0xfef0('0x43')]['length']+0x1,'app':'close','appdata':'autoclose','interval':_0xfef0('0x49')});}if(_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x3c')]){delete _0xbf6ddd[_0xfef0('0x37')]['Applications'];}if(_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x39')]){delete _0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x39')];}if(_0x3d471c[_0xfef0('0x39')][_0xfef0('0x3a')][_0xfef0('0x4a')]){return _0x3d471c['List'][_0xfef0('0x3a')][0x0];}var _0x163255=_['defaults'](_0x49ed48[_0xfef0('0x28')],{'firstName':_0x49ed48['body'][_0xfef0('0x30')],'ListId':_0x3d471c[_0xfef0('0x2e')]});_0x163255[_0x49ed48['body'][_0xfef0('0x36')]]=_0x49ed48['body']['from'];return db['CmContact'][_0xfef0('0x4b')](_0x163255);}else{throw new Error(_0xfef0('0x4c'));}})[_0xfef0('0xe')](function(_0x34fda3){_0xbf6ddd[_0xfef0('0x4d')]=_0x34fda3;if(_0x34fda3){if(!_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x4e')]){_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x4e')]=rs[_0xfef0('0x4f')]()+'\x20'+_0x49ed48['body'][_0xfef0('0x17')]['from'];}var _0x135653={'ContactId':_0x34fda3['id'],'MailAccountId':_0x49ed48['account']['id'],'inReplyTo':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x4e')],'to':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['from'],'cc':_0x49ed48[_0xfef0('0x28')]['message']['cc'],'subject':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['subject'],'attach':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x50')],'lastMsgAt':moment()[_0xfef0('0x51')](_0xfef0('0x52')),'lastMsgDirection':'in'};return db[_0xfef0('0x53')][_0xfef0('0x23')]({'where':{'closed':![],'MailAccountId':_0x49ed48[_0xfef0('0x37')]['id']},'include':[{'model':db[_0xfef0('0x54')],'as':_0xfef0('0x55'),'attributes':[_0xfef0('0x4e')],'where':{'messageId':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x56')]}}]})[_0xfef0('0xe')](function(_0x28cab7){if(_0x28cab7){return[_0x28cab7,![]];}return db[_0xfef0('0x53')][_0xfef0('0x4b')](_0x135653)['then'](function(_0x12e383){return[_0x12e383,!![]];});});}else{throw new Error(_0xfef0('0x57'));}})[_0xfef0('0x58')](function(_0x3c6bb8,_0x176fc7){if(_0x3c6bb8){_0x5dc824=_0x176fc7;if(!_0x176fc7){return _0x3c6bb8[_0xfef0('0x59')]({'inReplyTo':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x4e')],'to':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x30')],'cc':_0x49ed48['body'][_0xfef0('0x17')]['cc'],'subject':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x5a')],'attach':_0x3c6bb8[_0xfef0('0x50')]?_0x3c6bb8[_0xfef0('0x50')]:_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0xfef0('0x51')](_0xfef0('0x52')),'lastMsgAt':moment()[_0xfef0('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x3c6bb8;}}})[_0xfef0('0xe')](function(_0x2ab666){_0xbf6ddd[_0xfef0('0x5b')]=_0x2ab666[_0xfef0('0x3f')]({'plain':!![]});_0xbf6ddd[_0xfef0('0x5b')][_0xfef0('0x5c')]=_0x5dc824;return db[_0xfef0('0x54')]['create']({'body':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x28')],'MailAccountId':_0x49ed48[_0xfef0('0x37')]['id'],'MailInteractionId':_0x2ab666['id'],'direction':'in','ContactId':_0xbf6ddd[_0xfef0('0x4d')]['id'],'messageId':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['messageId'],'from':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x30')],'to':_0x49ed48[_0xfef0('0x28')]['message']['to'],'cc':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['cc'],'subject':_0x49ed48['body'][_0xfef0('0x17')][_0xfef0('0x5a')],'attach':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x50')],'Attachments':_0x49ed48['body']['message']['attachments'],'originTo':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')][_0xfef0('0x5d')],'originCc':_0x49ed48['body'][_0xfef0('0x17')]['originCc'],'bcc':_0x49ed48['body']['message'][_0xfef0('0x5e')],'ChatWebsiteId':_0x49ed48[_0xfef0('0x28')]['message'][_0xfef0('0x5f')]||null,'originChannel':_0x49ed48[_0xfef0('0x28')][_0xfef0('0x17')]['originChannel']||_0xfef0('0x60'),'ChatOfflineMessageId':_0x49ed48['body']['message'][_0xfef0('0x61')]||null},{'include':[{'model':db[_0xfef0('0x62')],'as':_0xfef0('0x63')}]});})[_0xfef0('0xe')](function(_0x4df63b){_0xbf6ddd['message']=_0x4df63b;if(_0xbf6ddd['interaction'][_0xfef0('0x64')]){return db['User'][_0xfef0('0x23')]({'attributes':['id',_0xfef0('0x65')],'where':{'id':_0xbf6ddd[_0xfef0('0x5b')][_0xfef0('0x64')]}})[_0xfef0('0xe')](function(_0x4be622){if(_0x4be622){_0xbf6ddd[_0xfef0('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4be622[_0xfef0('0x65')]+','+(_0xbf6ddd[_0xfef0('0x37')][_0xfef0('0x66')]||0xa),'interval':_0xfef0('0x49')});}return respondWithRpcPromise('Start','startRouting',_0xbf6ddd);});}return respondWithRpcPromise(_0xfef0('0x67'),_0xfef0('0x68'),_0xbf6ddd);})['then'](function(_0x872f99){_0x547a5d(_0x872f99);})[_0xfef0('0x19')](function(_0x4690c0){_0x5c3305(_0xf30aff[_0xfef0('0x15')](0x1f4,_0x4690c0[_0xfef0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index d0f3be0..4f41d2f 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 _0x209e=['removeListener','register','length','mailAccount:','save','remove','emit'];(function(_0x359dd1,_0x2a3e77){var _0x1559de=function(_0x5b2dd9){while(--_0x5b2dd9){_0x359dd1['push'](_0x359dd1['shift']());}};_0x1559de(++_0x2a3e77);}(_0x209e,0x89));var _0xe209=function(_0x1b2896,_0x27d3d6){_0x1b2896=_0x1b2896-0x0;var _0xfe232a=_0x209e[_0x1b2896];return _0xfe232a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe209('0x0'),_0xe209('0x1'),'update'];function createListener(_0x4ea308,_0x5efe05){return function(_0x137160){_0x5efe05[_0xe209('0x2')](_0x4ea308,_0x137160);};}function removeListener(_0x555070,_0x4607fc){return function(){MailAccountEvents[_0xe209('0x3')](_0x555070,_0x4607fc);};}exports[_0xe209('0x4')]=function(_0x338805){for(var _0x164e1b=0x0,_0x49963a=events[_0xe209('0x5')];_0x164e1b<_0x49963a;_0x164e1b++){var _0x15eb5e=events[_0x164e1b];var _0x9016f4=createListener(_0xe209('0x6')+_0x15eb5e,_0x338805);MailAccountEvents['on'](_0x15eb5e,_0x9016f4);}}; \ No newline at end of file +var _0x223e=['mailAccount:','./mailAccount.events','save','remove','emit','length'];(function(_0x51d9d1,_0x437469){var _0x2ccceb=function(_0x56e89e){while(--_0x56e89e){_0x51d9d1['push'](_0x51d9d1['shift']());}};_0x2ccceb(++_0x437469);}(_0x223e,0x1b1));var _0xe223=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x223e[_0x1a7550];return _0x426e22;};'use strict';var MailAccountEvents=require(_0xe223('0x0'));var events=[_0xe223('0x1'),_0xe223('0x2'),'update'];function createListener(_0x215451,_0x372447){return function(_0x14c171){_0x372447[_0xe223('0x3')](_0x215451,_0x14c171);};}function removeListener(_0x3521c1,_0x2cced4){return function(){MailAccountEvents['removeListener'](_0x3521c1,_0x2cced4);};}exports['register']=function(_0x3084b0){for(var _0xde7d70=0x0,_0x4a8891=events[_0xe223('0x4')];_0xde7d70<_0x4a8891;_0xde7d70++){var _0x366d9b=events[_0xde7d70];var _0x4cffbb=createListener(_0xe223('0x5')+_0x366d9b,_0x3084b0);MailAccountEvents['on'](_0x366d9b,_0x4cffbb);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d6f49e5..90b0197 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 _0x7586=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','put','/:id','delete','destroy','exports'];(function(_0xc78d40,_0xfa35e5){var _0x3f6f61=function(_0x4831f7){while(--_0x4831f7){_0xc78d40['push'](_0xc78d40['shift']());}};_0x3f6f61(++_0xfa35e5);}(_0x7586,0x1b0));var _0x6758=function(_0x508786,_0x26e090){_0x508786=_0x508786-0x0;var _0x2c9780=_0x7586[_0x508786];return _0x2c9780;};'use strict';var multer=require(_0x6758('0x0'));var util=require(_0x6758('0x1'));var path=require(_0x6758('0x2'));var timeout=require('connect-timeout');var express=require(_0x6758('0x3'));var router=express[_0x6758('0x4')]();var fs_extra=require(_0x6758('0x5'));var auth=require(_0x6758('0x6'));var interaction=require(_0x6758('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x6758('0x8')]('/:id',auth[_0x6758('0x9')](),controller[_0x6758('0xa')]);router[_0x6758('0xb')](_0x6758('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6758('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6758('0xe')]);module[_0x6758('0xf')]=router; \ No newline at end of file +var _0xaf7e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0xf67a65,_0x4f9b5f){var _0x160786=function(_0x297812){while(--_0x297812){_0xf67a65['push'](_0xf67a65['shift']());}};_0x160786(++_0x4f9b5f);}(_0xaf7e,0x145));var _0xeaf7=function(_0xe4edf3,_0x4d5376){_0xe4edf3=_0xe4edf3-0x0;var _0x543613=_0xaf7e[_0xe4edf3];return _0x543613;};'use strict';var multer=require(_0xeaf7('0x0'));var util=require(_0xeaf7('0x1'));var path=require('path');var timeout=require(_0xeaf7('0x2'));var express=require(_0xeaf7('0x3'));var router=express['Router']();var fs_extra=require(_0xeaf7('0x4'));var auth=require(_0xeaf7('0x5'));var interaction=require(_0xeaf7('0x6'));var config=require(_0xeaf7('0x7'));var controller=require('./mailApplication.controller');router[_0xeaf7('0x8')]('/:id',auth[_0xeaf7('0x9')](),controller['show']);router[_0xeaf7('0xa')](_0xeaf7('0xb'),auth['isAuthenticated'](),controller[_0xeaf7('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xeaf7('0xd')]);module[_0xeaf7('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 8bf0765..0cd0d92 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 _0xe6f2=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x51a480,_0x2e086a){var _0x35a992=function(_0x22810e){while(--_0x22810e){_0x51a480['push'](_0x51a480['shift']());}};_0x35a992(++_0x2e086a);}(_0xe6f2,0x95));var _0x2e6f=function(_0x3f56ea,_0x1d7f54){_0x3f56ea=_0x3f56ea-0x0;var _0x37fa95=_0xe6f2[_0x3f56ea];return _0x37fa95;};'use strict';var Sequelize=require(_0x2e6f('0x0'));module[_0x2e6f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2e6f('0x2')},'appdata':{'type':Sequelize[_0x2e6f('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2e6f('0x4')],'defaultValue':_0x2e6f('0x5')}}; \ No newline at end of file +var _0x1b42=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x4fdfbf,_0x57fa43){var _0x599a36=function(_0x33f9a8){while(--_0x33f9a8){_0x4fdfbf['push'](_0x4fdfbf['shift']());}};_0x599a36(++_0x57fa43);}(_0x1b42,0x1b2));var _0x21b4=function(_0x2cc3a9,_0x61dc6){_0x2cc3a9=_0x2cc3a9-0x0;var _0x5d5201=_0x1b42[_0x2cc3a9];return _0x5d5201;};'use strict';var Sequelize=require(_0x21b4('0x0'));module[_0x21b4('0x1')]={'priority':{'type':Sequelize[_0x21b4('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x21b4('0x3')},'appdata':{'type':Sequelize[_0x21b4('0x4')]()},'description':{'type':Sequelize[_0x21b4('0x5')]},'interval':{'type':Sequelize[_0x21b4('0x5')],'defaultValue':_0x21b4('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4afe53f..a3d7533 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x70e0,0x17b));var _0x070e=function(_0x1d2d26,_0x2ee403){_0x1d2d26=_0x1d2d26-0x0;var _0x2f3215=_0x70e0[_0x1d2d26];return _0x2f3215;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x28d138,_0x21196d){_0x28d138=_0x28d138-0x0;var _0x4beedb=_0xbdb7[_0x28d138];return _0x4beedb;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 76d9478..54cb71a 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 _0xfe94=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','mail_applications'];(function(_0x2185f1,_0x540ad2){var _0xf85844=function(_0x5af92d){while(--_0x5af92d){_0x2185f1['push'](_0x2185f1['shift']());}};_0xf85844(++_0x540ad2);}(_0xfe94,0x188));var _0x4fe9=function(_0x561dfc,_0x255f77){_0x561dfc=_0x561dfc-0x0;var _0x2e2fd6=_0xfe94[_0x561dfc];return _0x2e2fd6;};'use strict';var _=require(_0x4fe9('0x0'));var util=require(_0x4fe9('0x1'));var logger=require(_0x4fe9('0x2'))(_0x4fe9('0x3'));var moment=require(_0x4fe9('0x4'));var BPromise=require(_0x4fe9('0x5'));var rp=require(_0x4fe9('0x6'));var fs=require('fs');var path=require(_0x4fe9('0x7'));var rimraf=require(_0x4fe9('0x8'));var config=require(_0x4fe9('0x9'));var attributes=require(_0x4fe9('0xa'));module[_0x4fe9('0xb')]=function(_0x27c778,_0x18d2c2){return _0x27c778['define']('MailApplication',attributes,{'tableName':_0x4fe9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4fe9('0xd'),'collate':_0x4fe9('0xe')});}; \ No newline at end of file +var _0xafdb=['lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','utf8mb4'];(function(_0x1c90a7,_0x115e4d){var _0x408b33=function(_0x4b2b46){while(--_0x4b2b46){_0x1c90a7['push'](_0x1c90a7['shift']());}};_0x408b33(++_0x115e4d);}(_0xafdb,0x1ad));var _0xbafd=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xafdb[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0xbafd('0x0'));var util=require(_0xbafd('0x1'));var logger=require(_0xbafd('0x2'))('api');var moment=require(_0xbafd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbafd('0x4'));var rimraf=require(_0xbafd('0x5'));var config=require(_0xbafd('0x6'));var attributes=require(_0xbafd('0x7'));module[_0xbafd('0x8')]=function(_0x1b65df,_0x470819){return _0x1b65df['define'](_0xbafd('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbafd('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 418c468..ffa6602 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 _0xb3b1=['raw','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','update','body','options'];(function(_0xd24036,_0x41ab24){var _0x4e1f74=function(_0x59a960){while(--_0x59a960){_0xd24036['push'](_0xd24036['shift']());}};_0x4e1f74(++_0x41ab24);}(_0xb3b1,0xd2));var _0x1b3b=function(_0x1b819e,_0x496e33){_0x1b819e=_0x1b819e-0x0;var _0x5a613b=_0xb3b1[_0x1b819e];return _0x5a613b;};'use strict';var _=require(_0x1b3b('0x0'));var util=require(_0x1b3b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1b3b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b3b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b3b('0x4'))(_0x1b3b('0x5'));var config=require(_0x1b3b('0x6'));var jayson=require(_0x1b3b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x339da3,_0x1ff4aa,_0x324011){return new BPromise(function(_0x16dcda,_0x92211e){return client[_0x1b3b('0x8')](_0x339da3,_0x324011)[_0x1b3b('0x9')](function(_0x174511){logger[_0x1b3b('0xa')](_0x1b3b('0xb'),_0x1ff4aa,_0x1b3b('0xc'));logger[_0x1b3b('0xd')](_0x1b3b('0xe'),_0x1ff4aa,_0x1b3b('0xc'),JSON[_0x1b3b('0xf')](_0x174511));if(_0x174511[_0x1b3b('0x10')]){if(_0x174511[_0x1b3b('0x10')][_0x1b3b('0x11')]===0x1f4){logger[_0x1b3b('0x10')](_0x1b3b('0xb'),_0x1ff4aa,_0x174511[_0x1b3b('0x10')][_0x1b3b('0x12')]);return _0x92211e(_0x174511[_0x1b3b('0x10')]['message']);}logger[_0x1b3b('0x10')](_0x1b3b('0xb'),_0x1ff4aa,_0x174511['error'][_0x1b3b('0x12')]);return _0x16dcda(_0x174511[_0x1b3b('0x10')][_0x1b3b('0x12')]);}else{logger[_0x1b3b('0xa')]('MailApplication,\x20%s,\x20%s',_0x1ff4aa,_0x1b3b('0xc'));_0x16dcda(_0x174511[_0x1b3b('0x13')]['message']);}})['catch'](function(_0x5b4622){logger[_0x1b3b('0x10')]('MailApplication,\x20%s,\x20%s',_0x1ff4aa,_0x5b4622);_0x92211e(_0x5b4622);});});}exports[_0x1b3b('0x14')]=function(_0x520639){var _0x3b381c=this;return new Promise(function(_0x286976,_0x5a10a0){return db['MailApplication'][_0x1b3b('0x15')](_0x520639[_0x1b3b('0x16')],{'raw':_0x520639[_0x1b3b('0x17')]?_0x520639[_0x1b3b('0x17')][_0x1b3b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520639[_0x1b3b('0x17')]?_0x520639[_0x1b3b('0x17')]['where']||null:null,'attributes':_0x520639[_0x1b3b('0x17')]?_0x520639[_0x1b3b('0x17')]['attributes']||null:null,'limit':_0x520639['options']?_0x520639[_0x1b3b('0x17')]['limit']||null:null})[_0x1b3b('0x9')](function(_0x457dcc){logger[_0x1b3b('0xa')](_0x1b3b('0x14'),_0x520639);logger[_0x1b3b('0xd')]('UpdateMailApplication',_0x520639,JSON['stringify'](_0x457dcc));_0x286976(_0x457dcc);})[_0x1b3b('0x19')](function(_0x58a9df){logger[_0x1b3b('0x10')](_0x1b3b('0x14'),_0x58a9df[_0x1b3b('0x12')],_0x520639);_0x5a10a0(_0x3b381c['error'](0x1f4,_0x58a9df[_0x1b3b('0x12')]));});});}; \ No newline at end of file +var _0x6868=['message','result','catch','MailApplication','update','body','options','where','attributes','info','UpdateMailApplication','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1da244,_0xc277e5){var _0x45994e=function(_0x237973){while(--_0x237973){_0x1da244['push'](_0x1da244['shift']());}};_0x45994e(++_0xc277e5);}(_0x6868,0xdd));var _0x8686=function(_0x1f1d47,_0x188ece){_0x1f1d47=_0x1f1d47-0x0;var _0x829c2e=_0x6868[_0x1f1d47];return _0x829c2e;};'use strict';var _=require(_0x8686('0x0'));var util=require('util');var moment=require(_0x8686('0x1'));var BPromise=require(_0x8686('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8686('0x3'));var db=require(_0x8686('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8686('0x5'))('rpc');var config=require(_0x8686('0x6'));var jayson=require(_0x8686('0x7'));var client=jayson[_0x8686('0x8')][_0x8686('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2732e6,_0x4e3d3,_0xbbc930){return new BPromise(function(_0x1958aa,_0x388050){return client[_0x8686('0xa')](_0x2732e6,_0xbbc930)[_0x8686('0xb')](function(_0x5277fe){logger['info'](_0x8686('0xc'),_0x4e3d3,'request\x20sent');logger[_0x8686('0xd')](_0x8686('0xe'),_0x4e3d3,_0x8686('0xf'),JSON[_0x8686('0x10')](_0x5277fe));if(_0x5277fe[_0x8686('0x11')]){if(_0x5277fe[_0x8686('0x11')][_0x8686('0x12')]===0x1f4){logger['error'](_0x8686('0xc'),_0x4e3d3,_0x5277fe[_0x8686('0x11')][_0x8686('0x13')]);return _0x388050(_0x5277fe[_0x8686('0x11')]['message']);}logger[_0x8686('0x11')]('MailApplication,\x20%s,\x20%s',_0x4e3d3,_0x5277fe[_0x8686('0x11')]['message']);return _0x1958aa(_0x5277fe[_0x8686('0x11')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x4e3d3,_0x8686('0xf'));_0x1958aa(_0x5277fe[_0x8686('0x14')][_0x8686('0x13')]);}})[_0x8686('0x15')](function(_0x5abafc){logger[_0x8686('0x11')](_0x8686('0xc'),_0x4e3d3,_0x5abafc);_0x388050(_0x5abafc);});});}exports['UpdateMailApplication']=function(_0x49c4d4){var _0x26a2ce=this;return new Promise(function(_0x20ebc1,_0x3e6e29){return db[_0x8686('0x16')][_0x8686('0x17')](_0x49c4d4[_0x8686('0x18')],{'raw':_0x49c4d4[_0x8686('0x19')]?_0x49c4d4[_0x8686('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49c4d4[_0x8686('0x19')]?_0x49c4d4['options'][_0x8686('0x1a')]||null:null,'attributes':_0x49c4d4[_0x8686('0x19')]?_0x49c4d4[_0x8686('0x19')][_0x8686('0x1b')]||null:null,'limit':_0x49c4d4[_0x8686('0x19')]?_0x49c4d4['options']['limit']||null:null})['then'](function(_0x3bd64d){logger[_0x8686('0x1c')](_0x8686('0x1d'),_0x49c4d4);logger['debug'](_0x8686('0x1d'),_0x49c4d4,JSON[_0x8686('0x10')](_0x3bd64d));_0x20ebc1(_0x3bd64d);})['catch'](function(_0x1f23e1){logger[_0x8686('0x11')](_0x8686('0x1d'),_0x1f23e1[_0x8686('0x13')],_0x49c4d4);_0x3e6e29(_0x26a2ce[_0x8686('0x11')](0x1f4,_0x1f23e1[_0x8686('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d054d4f..71ce0ac 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 _0x951b=['isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get'];(function(_0x34c58e,_0x2f8d7d){var _0x593f5b=function(_0x262ac8){while(--_0x262ac8){_0x34c58e['push'](_0x34c58e['shift']());}};_0x593f5b(++_0x2f8d7d);}(_0x951b,0x14b));var _0xb951=function(_0x1f9c2e,_0x1bdec9){_0x1f9c2e=_0x1f9c2e-0x0;var _0x9cb458=_0x951b[_0x1f9c2e];return _0x9cb458;};'use strict';var express=require(_0xb951('0x0'));var router=express['Router']();var auth=require(_0xb951('0x1'));var interaction=require(_0xb951('0x2'));var controller=require(_0xb951('0x3'));router[_0xb951('0x4')]('/',auth[_0xb951('0x5')](),controller[_0xb951('0x6')]);router[_0xb951('0x4')]('/describe',auth[_0xb951('0x5')](),controller[_0xb951('0x7')]);router[_0xb951('0x4')](_0xb951('0x8'),auth[_0xb951('0x5')](),controller['show']);router[_0xb951('0x4')](_0xb951('0x9'),auth['isAuthenticated'](),controller[_0xb951('0xa')]);router[_0xb951('0x4')](_0xb951('0xb'),auth[_0xb951('0x5')](),controller[_0xb951('0xc')]);router[_0xb951('0xd')]('/',auth[_0xb951('0x5')](),controller[_0xb951('0xe')]);router[_0xb951('0xd')](_0xb951('0x9'),auth['isAuthenticated'](),controller[_0xb951('0xf')]);router[_0xb951('0xd')](_0xb951('0x10'),auth['isAuthenticated'](),interaction['tracked'](_0xb951('0x11'),_0xb951('0x12')),controller['addTags']);router[_0xb951('0x13')](_0xb951('0x8'),auth['isAuthenticated'](),interaction[_0xb951('0x14')](_0xb951('0x11'),_0xb951('0x15')),controller[_0xb951('0x16')]);router[_0xb951('0x17')](_0xb951('0x8'),auth['isAuthenticated'](),interaction[_0xb951('0x14')](_0xb951('0x11'),_0xb951('0x18')),controller[_0xb951('0x19')]);router[_0xb951('0x17')](_0xb951('0x10'),auth['isAuthenticated'](),controller[_0xb951('0x1a')]);module[_0xb951('0x1b')]=router; \ No newline at end of file +var _0xd919=['Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','delete','tracked','mailinteraction:destroy','removeTags','exports'];(function(_0x4ccb02,_0x384cac){var _0x1206ae=function(_0x3f1834){while(--_0x3f1834){_0x4ccb02['push'](_0x4ccb02['shift']());}};_0x1206ae(++_0x384cac);}(_0xd919,0x90));var _0x9d91=function(_0x4d09ec,_0x3e5b44){_0x4d09ec=_0x4d09ec-0x0;var _0x19ac2a=_0xd919[_0x4d09ec];return _0x19ac2a;};'use strict';var express=require('express');var router=express[_0x9d91('0x0')]();var auth=require(_0x9d91('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x9d91('0x2'));router[_0x9d91('0x3')]('/',auth[_0x9d91('0x4')](),controller['index']);router[_0x9d91('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x9d91('0x5')]);router['get'](_0x9d91('0x6'),auth[_0x9d91('0x4')](),controller[_0x9d91('0x7')]);router[_0x9d91('0x3')](_0x9d91('0x8'),auth['isAuthenticated'](),controller[_0x9d91('0x9')]);router[_0x9d91('0x3')](_0x9d91('0xa'),auth[_0x9d91('0x4')](),controller[_0x9d91('0xb')]);router['post']('/',auth[_0x9d91('0x4')](),controller[_0x9d91('0xc')]);router['post'](_0x9d91('0x8'),auth[_0x9d91('0x4')](),controller[_0x9d91('0xd')]);router['post'](_0x9d91('0xe'),auth[_0x9d91('0x4')](),interaction['tracked'](_0x9d91('0xf'),_0x9d91('0x10')),controller[_0x9d91('0x11')]);router[_0x9d91('0x12')]('/:id',auth[_0x9d91('0x4')](),interaction['tracked']('mail','mailinteraction:update'),controller['update']);router[_0x9d91('0x13')](_0x9d91('0x6'),auth[_0x9d91('0x4')](),interaction[_0x9d91('0x14')](_0x9d91('0xf'),_0x9d91('0x15')),controller['destroy']);router[_0x9d91('0x13')]('/:id/tags',auth[_0x9d91('0x4')](),controller[_0x9d91('0x16')]);module[_0x9d91('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index fc57b94..3b6704d 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 _0xf774=['long','TEXT','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0xf774,0x1e4));var _0x4f77=function(_0x240d73,_0x2dc0a1){_0x240d73=_0x240d73-0x0;var _0x4657c7=_0xf774[_0x240d73];return _0x4657c7;};'use strict';var Sequelize=require(_0x4f77('0x0'));var iconv=require(_0x4f77('0x1'));module[_0x4f77('0x2')]={'closed':{'type':Sequelize[_0x4f77('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f77('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4f77('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4f77('0x5')]},'note':{'type':Sequelize[_0x4f77('0x5')]},'inReplyTo':{'type':Sequelize[_0x4f77('0x5')](0x1fe)},'to':{'type':Sequelize[_0x4f77('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x4f77('0x6'))},'subject':{'type':Sequelize[_0x4f77('0x7')]()},'attach':{'type':Sequelize[_0x4f77('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4f77('0x4')]},'substatus':{'type':Sequelize[_0x4f77('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4f77('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4f77('0x8')]('in',_0x4f77('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4f77('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd7c5=['sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x34e481,_0x1f0d05){var _0x195d01=function(_0x4e3fae){while(--_0x4e3fae){_0x34e481['push'](_0x34e481['shift']());}};_0x195d01(++_0x1f0d05);}(_0xd7c5,0xfc));var _0x5d7c=function(_0x2a32f1,_0x4b5ebe){_0x2a32f1=_0x2a32f1-0x0;var _0x22a77a=_0xd7c5[_0x2a32f1];return _0x22a77a;};'use strict';var Sequelize=require(_0x5d7c('0x0'));var iconv=require(_0x5d7c('0x1'));module['exports']={'closed':{'type':Sequelize[_0x5d7c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5d7c('0x3')]},'disposition':{'type':Sequelize[_0x5d7c('0x4')]},'secondDisposition':{'type':Sequelize[_0x5d7c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5d7c('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5d7c('0x4')](0x1fe)},'to':{'type':Sequelize[_0x5d7c('0x4')]},'cc':{'type':Sequelize[_0x5d7c('0x5')](_0x5d7c('0x6'))},'subject':{'type':Sequelize[_0x5d7c('0x5')]()},'attach':{'type':Sequelize[_0x5d7c('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5d7c('0x3')]},'substatus':{'type':Sequelize[_0x5d7c('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5d7c('0x7')]('in',_0x5d7c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5d7c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5d7c('0x7')]('in',_0x5d7c('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5d7c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index da2bc9a..cb9d2ed 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 _0x6dd0=['index','map','rawAttributes','fieldName','type','key','getOptions','findAll','mail','user','catch','model','keys','MailInteraction','query','filters','attributes','intersection','fields','length','include','options','find','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','setTags','Tag','emit','mailInteractionTags:save','removeTags','unix','toString','root','files','tmp','attachments','join','transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','rimraf','moment','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6dd0,0xca));var _0x06dd=function(_0x389e2f,_0x93ac99){_0x389e2f=_0x389e2f-0x0;var _0x32aaf0=_0x6dd0[_0x389e2f];return _0x32aaf0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06dd('0x0'));var zipdir=require('zip-dir');var moment=require(_0x06dd('0x1'));var BPromise=require('bluebird');var util=require(_0x06dd('0x2'));var path=require(_0x06dd('0x3'));var fs=require('fs');var _=require(_0x06dd('0x4'));var juice=require(_0x06dd('0x5'));var Redis=require(_0x06dd('0x6'));var interaction=require(_0x06dd('0x7'));var qs=require(_0x06dd('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x06dd('0x9'));var db=require(_0x06dd('0xa'))['db'];var htmlEntities=require(_0x06dd('0xb'));config['redis']=_['defaults'](config[_0x06dd('0xc')],{'host':_0x06dd('0xd'),'port':0x18eb});var socket=require(_0x06dd('0xe'))(new Redis(config[_0x06dd('0xc')]));require('./mailInteraction.socket')[_0x06dd('0xf')](socket);function respondWithStatusCode(_0x2afc50,_0x5c4d6b){_0x5c4d6b=_0x5c4d6b||0xcc;return function(_0x557bcf){if(_0x557bcf){return _0x2afc50['sendStatus'](_0x5c4d6b);}return _0x2afc50['status'](_0x5c4d6b)[_0x06dd('0x10')]();};}function respondWithResult(_0x4da037,_0x2a194d){_0x2a194d=_0x2a194d||0xc8;return function(_0x412079){if(_0x412079){return _0x4da037[_0x06dd('0x11')](_0x2a194d)[_0x06dd('0x12')](_0x412079);}};}function respondWithFilteredResult(_0x4bd13b,_0x2e56cd){return function(_0x688a80){if(_0x688a80){var _0x322bf5=typeof _0x2e56cd[_0x06dd('0x13')]===_0x06dd('0x14')&&typeof _0x2e56cd[_0x06dd('0x15')]===_0x06dd('0x14');var _0x2541b6=_0x688a80[_0x06dd('0x16')];var _0x1eb6bc=_0x322bf5?0x0:_0x2e56cd[_0x06dd('0x13')];var _0x3cf082=_0x322bf5?_0x688a80[_0x06dd('0x16')]:_0x2e56cd[_0x06dd('0x13')]+_0x2e56cd[_0x06dd('0x15')];var _0x49cb8d;if(_0x3cf082>=_0x2541b6){_0x3cf082=_0x2541b6;_0x49cb8d=0xc8;}else{_0x49cb8d=0xce;}_0x4bd13b[_0x06dd('0x11')](_0x49cb8d);return _0x4bd13b[_0x06dd('0x17')](_0x06dd('0x18'),_0x1eb6bc+'-'+_0x3cf082+'/'+_0x2541b6)[_0x06dd('0x12')](_0x688a80);}return null;};}function saveUpdates(_0x4e981d){return function(_0x277e40){if(_0x277e40){return _0x277e40[_0x06dd('0x19')](_0x4e981d)[_0x06dd('0x1a')](function(_0x316d08){return _0x316d08;});}return null;};}function removeEntity(_0x4aed30){return function(_0x425275){if(_0x425275){return _0x425275[_0x06dd('0x1b')]()['then'](function(){_0x4aed30[_0x06dd('0x11')](0xcc)[_0x06dd('0x10')]();});}};}function handleEntityNotFound(_0x22f3a9){return function(_0x11bb0d){if(!_0x11bb0d){_0x22f3a9[_0x06dd('0x1c')](0x194);}return _0x11bb0d;};}function handleError(_0x2108f0,_0x329156){_0x329156=_0x329156||0x1f4;return function(_0x5795fe){logger[_0x06dd('0x1d')](_0x5795fe[_0x06dd('0x1e')]);if(_0x5795fe[_0x06dd('0x1f')]){delete _0x5795fe[_0x06dd('0x1f')];}_0x2108f0[_0x06dd('0x11')](_0x329156)['send'](_0x5795fe);};}exports[_0x06dd('0x20')]=function(_0x25c3b5,_0x215f89){var _0x5c828e={};var _0x508719=_[_0x06dd('0x21')](db['MailInteraction'][_0x06dd('0x22')],function(_0x1d2ef6){return{'name':_0x1d2ef6[_0x06dd('0x23')],'type':_0x1d2ef6[_0x06dd('0x24')][_0x06dd('0x25')]};});_0x5c828e=qs[_0x06dd('0x26')](_0x508719,_0x25c3b5);return interaction[_0x06dd('0x27')](_0x06dd('0x28'),_0x25c3b5['query'],_0x25c3b5[_0x06dd('0x29')],_0x5c828e,_0x508719)[_0x06dd('0x1a')](respondWithFilteredResult(_0x215f89,_0x5c828e))[_0x06dd('0x2a')](handleError(_0x215f89,null));};exports['show']=function(_0x14c0c3,_0x1edeba){var _0x1d3e5d={'raw':![],'where':{'id':_0x14c0c3['params']['id']}},_0x2eb193={};_0x2eb193[_0x06dd('0x2b')]=_[_0x06dd('0x2c')](db[_0x06dd('0x2d')][_0x06dd('0x22')]);_0x2eb193[_0x06dd('0x2e')]=_[_0x06dd('0x2c')](_0x14c0c3['query']);_0x2eb193[_0x06dd('0x2f')]=_['intersection'](_0x2eb193[_0x06dd('0x2b')],_0x2eb193[_0x06dd('0x2e')]);_0x1d3e5d[_0x06dd('0x30')]=_[_0x06dd('0x31')](_0x2eb193[_0x06dd('0x2b')],qs[_0x06dd('0x32')](_0x14c0c3[_0x06dd('0x2e')][_0x06dd('0x32')]));_0x1d3e5d[_0x06dd('0x30')]=_0x1d3e5d['attributes'][_0x06dd('0x33')]?_0x1d3e5d['attributes']:_0x2eb193[_0x06dd('0x2b')];if(_0x14c0c3[_0x06dd('0x2e')]['includeAll']){_0x1d3e5d[_0x06dd('0x34')]=[{'all':!![]}];}_0x1d3e5d=_['merge']({},_0x1d3e5d,_0x14c0c3[_0x06dd('0x35')]);return db['MailInteraction'][_0x06dd('0x36')](_0x1d3e5d)['then'](handleEntityNotFound(_0x1edeba,null))[_0x06dd('0x1a')](respondWithResult(_0x1edeba,null))[_0x06dd('0x2a')](handleError(_0x1edeba,null));};exports['create']=function(_0x30ff32,_0x57db07){return db[_0x06dd('0x2d')][_0x06dd('0x37')](_0x30ff32[_0x06dd('0x38')],{})[_0x06dd('0x1a')](respondWithResult(_0x57db07,0xc9))[_0x06dd('0x2a')](handleError(_0x57db07,null));};exports[_0x06dd('0x19')]=function(_0x519665,_0x154b33){if(_0x519665[_0x06dd('0x38')]['id']){delete _0x519665[_0x06dd('0x38')]['id'];}return db[_0x06dd('0x2d')]['find']({'where':{'id':_0x519665['params']['id']}})['then'](handleEntityNotFound(_0x154b33,null))[_0x06dd('0x1a')](saveUpdates(_0x519665[_0x06dd('0x38')],null))[_0x06dd('0x1a')](respondWithResult(_0x154b33,null))[_0x06dd('0x2a')](handleError(_0x154b33,null));};exports['destroy']=function(_0x19226b,_0x45fc5a){return db['MailInteraction']['find']({'where':{'id':_0x19226b[_0x06dd('0x39')]['id']}})[_0x06dd('0x1a')](handleEntityNotFound(_0x45fc5a,null))['then'](removeEntity(_0x45fc5a,null))[_0x06dd('0x2a')](handleError(_0x45fc5a,null));};exports[_0x06dd('0x3a')]=function(_0x135a35,_0x3e5639){return db['MailInteraction'][_0x06dd('0x3a')]()[_0x06dd('0x1a')](respondWithResult(_0x3e5639,null))[_0x06dd('0x2a')](handleError(_0x3e5639,null));};exports[_0x06dd('0x3b')]=function(_0x33ad29,_0x55aec2){return db[_0x06dd('0x3c')]['find']({'where':{'id':_0x33ad29[_0x06dd('0x39')]['id']}})[_0x06dd('0x1a')](handleEntityNotFound(_0x55aec2,null))[_0x06dd('0x1a')](function(_0x3ab63b){if(_0x3ab63b){return _0x3ab63b[_0x06dd('0x3b')](_0x33ad29[_0x06dd('0x38')][_0x06dd('0x3d')],_[_0x06dd('0x3e')](_0x33ad29[_0x06dd('0x38')],[_0x06dd('0x3d'),'id'])||{});}})[_0x06dd('0x1a')](respondWithResult(_0x55aec2,null))['catch'](handleError(_0x55aec2,null));};exports[_0x06dd('0x3f')]=function(_0x4b48a9,_0x49e4c4){var _0x3c3a53={'raw':![],'where':{}};var _0x3d7a17={};var _0x153402={'count':0x0,'rows':[]};return db['MailInteraction'][_0x06dd('0x40')]({'where':{'id':_0x4b48a9['params']['id']}})[_0x06dd('0x1a')](handleEntityNotFound(_0x49e4c4,null))[_0x06dd('0x1a')](function(_0x5c4f02){if(_0x5c4f02){_0x3d7a17['model']=_[_0x06dd('0x2c')](db[_0x06dd('0x3c')][_0x06dd('0x22')]);_0x3d7a17['query']=_[_0x06dd('0x2c')](_0x4b48a9[_0x06dd('0x2e')]);_0x3d7a17[_0x06dd('0x2f')]=_['intersection'](_0x3d7a17[_0x06dd('0x2b')],_0x3d7a17[_0x06dd('0x2e')]);_0x3c3a53[_0x06dd('0x30')]=_[_0x06dd('0x31')](_0x3d7a17[_0x06dd('0x2b')],qs[_0x06dd('0x32')](_0x4b48a9[_0x06dd('0x2e')]['fields']));_0x3c3a53[_0x06dd('0x30')]=_0x3c3a53['attributes'][_0x06dd('0x33')]?_0x3c3a53[_0x06dd('0x30')]:_0x3d7a17[_0x06dd('0x2b')];if(!_0x4b48a9[_0x06dd('0x2e')][_0x06dd('0x41')](_0x06dd('0x42'))){_0x3c3a53[_0x06dd('0x15')]=qs[_0x06dd('0x15')](_0x4b48a9[_0x06dd('0x2e')][_0x06dd('0x15')]);_0x3c3a53[_0x06dd('0x13')]=qs[_0x06dd('0x13')](_0x4b48a9[_0x06dd('0x2e')][_0x06dd('0x13')]);}_0x3c3a53['order']=qs[_0x06dd('0x43')](_0x4b48a9[_0x06dd('0x2e')]['sort']);_0x3c3a53[_0x06dd('0x44')]=qs[_0x06dd('0x2f')](_[_0x06dd('0x45')](_0x4b48a9[_0x06dd('0x2e')],_0x3d7a17[_0x06dd('0x2f')]));_0x3c3a53[_0x06dd('0x44')][_0x06dd('0x46')]=_0x5c4f02['id'];if(_0x4b48a9['query'][_0x06dd('0x47')]){_0x3c3a53[_0x06dd('0x44')]=_[_0x06dd('0x48')](_0x3c3a53[_0x06dd('0x44')],{'$or':_[_0x06dd('0x21')](_0x3c3a53['attributes'],function(_0x3820b6){var _0x16819b={};_0x16819b[_0x3820b6]={'$like':'%'+_0x4b48a9[_0x06dd('0x2e')][_0x06dd('0x47')]+'%'};return _0x16819b;})});}if(_0x4b48a9[_0x06dd('0x2e')][_0x06dd('0x49')]){var _0x33da14=_0x4b48a9['query'][_0x06dd('0x49')][_0x06dd('0x4a')](',');var _0x150a05={};_0x150a05[_0x33da14[0x0]]={'$gte':moment(_0x33da14[0x1])[_0x06dd('0x4b')](_0x06dd('0x4c'))};_0x3c3a53['where']=_[_0x06dd('0x48')](_0x3c3a53[_0x06dd('0x44')],_0x150a05);}_0x3c3a53=_['merge']({},_0x3c3a53,_0x4b48a9['options']);return db['MailMessage'][_0x06dd('0x16')]({'where':_0x3c3a53[_0x06dd('0x44')]})[_0x06dd('0x1a')](function(_0x1d7016){_0x153402['count']=_0x1d7016;if(_0x4b48a9[_0x06dd('0x2e')][_0x06dd('0x4d')]){_0x3c3a53[_0x06dd('0x34')]=[{'all':!![]}];}return db[_0x06dd('0x3c')][_0x06dd('0x27')](_0x3c3a53);})[_0x06dd('0x1a')](function(_0x11e3f7){if(_0x4b48a9[_0x06dd('0x2e')][_0x06dd('0x4e')]===_0x06dd('0x4f')){for(var _0x1cfe7e=0x0;_0x1cfe7e<_0x11e3f7['length'];_0x1cfe7e++){_0x11e3f7[_0x1cfe7e][_0x06dd('0x38')]=juice(_0x11e3f7[_0x1cfe7e][_0x06dd('0x38')]);}}_0x153402[_0x06dd('0x50')]=_0x11e3f7;return _0x153402;});}})[_0x06dd('0x1a')](respondWithFilteredResult(_0x49e4c4,_0x3c3a53))[_0x06dd('0x2a')](handleError(_0x49e4c4,null));};exports['addTags']=function(_0x27b357,_0x209e22){return db[_0x06dd('0x2d')][_0x06dd('0x36')]({'where':{'id':_0x27b357[_0x06dd('0x39')]['id']}})[_0x06dd('0x1a')](handleEntityNotFound(_0x209e22,null))[_0x06dd('0x1a')](function(_0x10fc0e){if(_0x10fc0e){return _0x10fc0e[_0x06dd('0x51')](_0x27b357[_0x06dd('0x38')][_0x06dd('0x3d')],_[_0x06dd('0x3e')](_0x27b357[_0x06dd('0x38')],[_0x06dd('0x3d'),'id'])||{})['spread'](function(){return db[_0x06dd('0x52')][_0x06dd('0x27')]({'attributes':['id',_0x06dd('0x1f'),'color'],'where':{'id':_0x27b357[_0x06dd('0x38')]['ids']}});})['then'](function(_0xaae6a2){socket[_0x06dd('0x53')](_0x06dd('0x54'),{'id':Number(_0x27b357[_0x06dd('0x39')]['id']),'tags':_0xaae6a2||[]});return{'id':Number(_0x27b357[_0x06dd('0x39')]['id']),'tags':_0xaae6a2||[]};});}})['then'](respondWithResult(_0x209e22,null))[_0x06dd('0x2a')](handleError(_0x209e22,null));};exports[_0x06dd('0x55')]=function(_0x3896af,_0x14afda){return db[_0x06dd('0x2d')][_0x06dd('0x36')]({'where':{'id':_0x3896af[_0x06dd('0x39')]['id']}})[_0x06dd('0x1a')](handleEntityNotFound(_0x14afda,null))[_0x06dd('0x1a')](function(_0x3b47e2){if(_0x3b47e2){return _0x3b47e2[_0x06dd('0x55')](_0x3896af[_0x06dd('0x2e')]['ids']);}})['then'](respondWithStatusCode(_0x14afda,null))[_0x06dd('0x2a')](handleError(_0x14afda,null));};exports['download']=function(_0x5b09ea,_0x54f9fa){var _0x59d58a=moment()[_0x06dd('0x56')]()[_0x06dd('0x57')]();var _0x5df2d9=path['join'](config[_0x06dd('0x58')],'server',_0x06dd('0x59'),_0x06dd('0x5a'));var _0x1d649a=path['join'](config[_0x06dd('0x58')],'server',_0x06dd('0x59'),_0x06dd('0x5b'));var _0x6e260e=path[_0x06dd('0x5c')](_0x5df2d9,_0x59d58a);var _0x47f04f=util['format'](_0x06dd('0x5d'),_0x5b09ea[_0x06dd('0x39')]['id'],_0x59d58a);var _0x527da6=path[_0x06dd('0x5c')](_0x5df2d9,_0x47f04f);var _0x15ee24=[];if(_0x5b09ea['query'][_0x06dd('0x5b')]){_0x15ee24[_0x06dd('0x5e')]({'model':db[_0x06dd('0x5f')],'as':_0x06dd('0x60'),'raw':!![]});}var _0x13e85b=[{'model':db[_0x06dd('0x3c')],'as':'Messages','attributes':['id','body',_0x06dd('0x61'),'to','cc',_0x06dd('0x62'),_0x06dd('0x63'),_0x06dd('0x64')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x15ee24}];return db[_0x06dd('0x2d')][_0x06dd('0x36')]({'where':{'id':_0x5b09ea[_0x06dd('0x39')]['id']},'include':_0x13e85b})[_0x06dd('0x1a')](handleEntityNotFound(_0x54f9fa,null))[_0x06dd('0x1a')](function(_0x38d578){if(_0x38d578&&_0x38d578[_0x06dd('0x65')]){var _0x337b59=_0x38d578[_0x06dd('0x66')]({'plain':!![]});fs[_0x06dd('0x67')](_0x6e260e);return BPromise[_0x06dd('0x68')](_0x337b59[_0x06dd('0x65')],function(_0x337867,_0x1e2ec5){var _0x4c4092={'from':_0x337867['from'],'to':_0x337867['to']||'missing.recipient@your.company.com','subject':_0x337867[_0x06dd('0x63')],'html':htmlEntities[_0x06dd('0x69')](_0x337867[_0x06dd('0x38')]),'headers':{'Date':moment(_0x337867[_0x06dd('0x64')])['format'](_0x06dd('0x6a'))},'attachments':[]};if(_0x337867['cc']){_0x4c4092[_0x06dd('0x6b')]['Cc']=_0x337867['cc'];}if(_0x337867['bcc']){_0x4c4092[_0x06dd('0x6b')][_0x06dd('0x6c')]=_0x337867[_0x06dd('0x62')];}return new BPromise(function(_0x91a891,_0x330b5d){if(_0x337867['Attachments']){for(var _0x520731=0x0;_0x520731<_0x337867[_0x06dd('0x60')][_0x06dd('0x33')];_0x520731++){var _0x42ab97=_0x337867[_0x06dd('0x60')][_0x520731];var _0x43b200=path[_0x06dd('0x5c')](_0x1d649a,_0x42ab97[_0x06dd('0x6d')]);if(fs[_0x06dd('0x6e')](_0x43b200)){_0x4c4092['attachments'][_0x06dd('0x5e')]({'name':_0x42ab97[_0x06dd('0x1f')],'contentType':_0x42ab97[_0x06dd('0x24')],'data':fs[_0x06dd('0x6f')](_0x43b200)});}}}emlformat[_0x06dd('0x70')](_0x4c4092,function(_0x4a804a,_0x187218){if(_0x4a804a)return _0x330b5d(_0x4a804a);fs[_0x06dd('0x71')](path['join'](_0x6e260e,util[_0x06dd('0x4b')](_0x06dd('0x72'),_0x1e2ec5)),_0x187218);return _0x91a891(_0x187218);});});})[_0x06dd('0x1a')](function(){return new BPromise(function(_0x2a8695,_0x2bd606){zipdir(_0x6e260e,{'saveTo':_0x527da6},function(_0x2f1893,_0x563d86){if(_0x2f1893)return _0x2bd606(_0x2f1893);return _0x2a8695(_0x563d86);});})['then'](function(){return new BPromise(function(_0x507c6d,_0x568fff){rimraf(_0x6e260e,function(_0x652860){if(_0x652860)_0x568fff(_0x652860);return _0x507c6d();});});})[_0x06dd('0x1a')](function(){return _0x54f9fa[_0x06dd('0x73')](_0x527da6,_0x47f04f,function(_0x261ca0){if(!_0x261ca0)fs[_0x06dd('0x74')](_0x527da6);});});});}else{return _0x54f9fa['sendStatus'](0xc8);}})[_0x06dd('0x2a')](handleError(_0x54f9fa,null));}; \ No newline at end of file +var _0x0099=['user','catch','show','keys','MailInteraction','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','create','body','params','destroy','describe','addMessage','MailMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','format','options','inlineCss','rows','setTags','spread','mailInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','from','bcc','subject','createdAt','Messages','get','mkdirSync','missing.recipient@your.company.com','decode','Bcc','Attachments','basename','existsSync','writeFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir','moment','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','undefined','limit','offset','count','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','getOptions','findAll','query'];(function(_0x49208a,_0x338aa7){var _0x353678=function(_0x4aac5d){while(--_0x4aac5d){_0x49208a['push'](_0x49208a['shift']());}};_0x353678(++_0x338aa7);}(_0x0099,0x184));var _0x9009=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x0099[_0x163040];return _0x364667;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9009('0x0'));var zipdir=require(_0x9009('0x1'));var moment=require(_0x9009('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x9009('0x3'));var fs=require('fs');var _=require('lodash');var juice=require(_0x9009('0x4'));var Redis=require(_0x9009('0x5'));var interaction=require(_0x9009('0x6'));var qs=require(_0x9009('0x7'));var logger=require(_0x9009('0x8'))(_0x9009('0x9'));var config=require('../../config/environment');var db=require(_0x9009('0xa'))['db'];var htmlEntities=require('html-entities');config[_0x9009('0xb')]=_[_0x9009('0xc')](config[_0x9009('0xb')],{'host':_0x9009('0xd'),'port':0x18eb});var socket=require(_0x9009('0xe'))(new Redis(config[_0x9009('0xb')]));require(_0x9009('0xf'))[_0x9009('0x10')](socket);function respondWithStatusCode(_0x1f1b42,_0x2881d4){_0x2881d4=_0x2881d4||0xcc;return function(_0x55ff94){if(_0x55ff94){return _0x1f1b42['sendStatus'](_0x2881d4);}return _0x1f1b42[_0x9009('0x11')](_0x2881d4)[_0x9009('0x12')]();};}function respondWithResult(_0x223631,_0x1ff477){_0x1ff477=_0x1ff477||0xc8;return function(_0x511101){if(_0x511101){return _0x223631[_0x9009('0x11')](_0x1ff477)['json'](_0x511101);}};}function respondWithFilteredResult(_0x4aa849,_0x18bc0e){return function(_0x268c06){if(_0x268c06){var _0x15ad27=typeof _0x18bc0e['offset']===_0x9009('0x13')&&typeof _0x18bc0e[_0x9009('0x14')]===_0x9009('0x13');var _0x37df46=_0x268c06['count'];var _0x4e49ae=_0x15ad27?0x0:_0x18bc0e[_0x9009('0x15')];var _0x3654ea=_0x15ad27?_0x268c06[_0x9009('0x16')]:_0x18bc0e[_0x9009('0x15')]+_0x18bc0e[_0x9009('0x14')];var _0x529220;if(_0x3654ea>=_0x37df46){_0x3654ea=_0x37df46;_0x529220=0xc8;}else{_0x529220=0xce;}_0x4aa849[_0x9009('0x11')](_0x529220);return _0x4aa849['set'](_0x9009('0x17'),_0x4e49ae+'-'+_0x3654ea+'/'+_0x37df46)[_0x9009('0x18')](_0x268c06);}return null;};}function saveUpdates(_0x269c99){return function(_0x2b975b){if(_0x2b975b){return _0x2b975b[_0x9009('0x19')](_0x269c99)[_0x9009('0x1a')](function(_0x181ff9){return _0x181ff9;});}return null;};}function removeEntity(_0x168044){return function(_0x31da0c){if(_0x31da0c){return _0x31da0c['destroy']()['then'](function(){_0x168044['status'](0xcc)[_0x9009('0x12')]();});}};}function handleEntityNotFound(_0xab8d0f){return function(_0x156233){if(!_0x156233){_0xab8d0f[_0x9009('0x1b')](0x194);}return _0x156233;};}function handleError(_0x5a2418,_0x11f2a9){_0x11f2a9=_0x11f2a9||0x1f4;return function(_0x487a85){logger[_0x9009('0x1c')](_0x487a85[_0x9009('0x1d')]);if(_0x487a85[_0x9009('0x1e')]){delete _0x487a85[_0x9009('0x1e')];}_0x5a2418[_0x9009('0x11')](_0x11f2a9)[_0x9009('0x1f')](_0x487a85);};}exports[_0x9009('0x20')]=function(_0x20de13,_0x1c0cbc){var _0xa02488={};var _0x1311ae=_[_0x9009('0x21')](db['MailInteraction'][_0x9009('0x22')],function(_0x39ca21){return{'name':_0x39ca21['fieldName'],'type':_0x39ca21[_0x9009('0x23')][_0x9009('0x24')]};});_0xa02488=qs[_0x9009('0x25')](_0x1311ae,_0x20de13);return interaction[_0x9009('0x26')]('mail',_0x20de13[_0x9009('0x27')],_0x20de13[_0x9009('0x28')],_0xa02488,_0x1311ae)[_0x9009('0x1a')](respondWithFilteredResult(_0x1c0cbc,_0xa02488))[_0x9009('0x29')](handleError(_0x1c0cbc,null));};exports[_0x9009('0x2a')]=function(_0x149ecc,_0x1a7cdf){var _0x19637f={'raw':![],'where':{'id':_0x149ecc['params']['id']}},_0x570544={};_0x570544['model']=_[_0x9009('0x2b')](db[_0x9009('0x2c')][_0x9009('0x22')]);_0x570544['query']=_[_0x9009('0x2b')](_0x149ecc[_0x9009('0x27')]);_0x570544[_0x9009('0x2d')]=_[_0x9009('0x2e')](_0x570544[_0x9009('0x2f')],_0x570544[_0x9009('0x27')]);_0x19637f[_0x9009('0x30')]=_[_0x9009('0x2e')](_0x570544[_0x9009('0x2f')],qs[_0x9009('0x31')](_0x149ecc['query']['fields']));_0x19637f['attributes']=_0x19637f[_0x9009('0x30')][_0x9009('0x32')]?_0x19637f[_0x9009('0x30')]:_0x570544['model'];if(_0x149ecc['query'][_0x9009('0x33')]){_0x19637f[_0x9009('0x34')]=[{'all':!![]}];}_0x19637f=_[_0x9009('0x35')]({},_0x19637f,_0x149ecc['options']);return db['MailInteraction'][_0x9009('0x36')](_0x19637f)[_0x9009('0x1a')](handleEntityNotFound(_0x1a7cdf,null))[_0x9009('0x1a')](respondWithResult(_0x1a7cdf,null))[_0x9009('0x29')](handleError(_0x1a7cdf,null));};exports[_0x9009('0x37')]=function(_0x3a37d7,_0x213a40){return db['MailInteraction']['create'](_0x3a37d7[_0x9009('0x38')],{})['then'](respondWithResult(_0x213a40,0xc9))['catch'](handleError(_0x213a40,null));};exports[_0x9009('0x19')]=function(_0x575f63,_0x5083eb){if(_0x575f63['body']['id']){delete _0x575f63[_0x9009('0x38')]['id'];}return db[_0x9009('0x2c')][_0x9009('0x36')]({'where':{'id':_0x575f63[_0x9009('0x39')]['id']}})[_0x9009('0x1a')](handleEntityNotFound(_0x5083eb,null))[_0x9009('0x1a')](saveUpdates(_0x575f63[_0x9009('0x38')],null))[_0x9009('0x1a')](respondWithResult(_0x5083eb,null))[_0x9009('0x29')](handleError(_0x5083eb,null));};exports[_0x9009('0x3a')]=function(_0x1d37c6,_0x1806be){return db[_0x9009('0x2c')][_0x9009('0x36')]({'where':{'id':_0x1d37c6[_0x9009('0x39')]['id']}})[_0x9009('0x1a')](handleEntityNotFound(_0x1806be,null))['then'](removeEntity(_0x1806be,null))['catch'](handleError(_0x1806be,null));};exports[_0x9009('0x3b')]=function(_0x468108,_0x428040){return db['MailInteraction']['describe']()[_0x9009('0x1a')](respondWithResult(_0x428040,null))[_0x9009('0x29')](handleError(_0x428040,null));};exports[_0x9009('0x3c')]=function(_0x23241b,_0x559b00){return db[_0x9009('0x3d')][_0x9009('0x36')]({'where':{'id':_0x23241b[_0x9009('0x39')]['id']}})[_0x9009('0x1a')](handleEntityNotFound(_0x559b00,null))[_0x9009('0x1a')](function(_0xe67288){if(_0xe67288){return _0xe67288[_0x9009('0x3c')](_0x23241b[_0x9009('0x38')][_0x9009('0x3e')],_[_0x9009('0x3f')](_0x23241b[_0x9009('0x38')],[_0x9009('0x3e'),'id'])||{});}})[_0x9009('0x1a')](respondWithResult(_0x559b00,null))[_0x9009('0x29')](handleError(_0x559b00,null));};exports['getMessages']=function(_0x319445,_0x5a82cb){var _0x2accd4={'raw':![],'where':{}};var _0x447268={};var _0x2de086={'count':0x0,'rows':[]};return db[_0x9009('0x2c')]['findOne']({'where':{'id':_0x319445['params']['id']}})[_0x9009('0x1a')](handleEntityNotFound(_0x5a82cb,null))[_0x9009('0x1a')](function(_0x1361b1){if(_0x1361b1){_0x447268[_0x9009('0x2f')]=_[_0x9009('0x2b')](db['MailMessage'][_0x9009('0x22')]);_0x447268[_0x9009('0x27')]=_[_0x9009('0x2b')](_0x319445[_0x9009('0x27')]);_0x447268[_0x9009('0x2d')]=_[_0x9009('0x2e')](_0x447268[_0x9009('0x2f')],_0x447268[_0x9009('0x27')]);_0x2accd4[_0x9009('0x30')]=_[_0x9009('0x2e')](_0x447268[_0x9009('0x2f')],qs[_0x9009('0x31')](_0x319445[_0x9009('0x27')][_0x9009('0x31')]));_0x2accd4[_0x9009('0x30')]=_0x2accd4[_0x9009('0x30')][_0x9009('0x32')]?_0x2accd4[_0x9009('0x30')]:_0x447268[_0x9009('0x2f')];if(!_0x319445['query'][_0x9009('0x40')](_0x9009('0x41'))){_0x2accd4['limit']=qs[_0x9009('0x14')](_0x319445[_0x9009('0x27')][_0x9009('0x14')]);_0x2accd4[_0x9009('0x15')]=qs[_0x9009('0x15')](_0x319445[_0x9009('0x27')]['offset']);}_0x2accd4[_0x9009('0x42')]=qs[_0x9009('0x43')](_0x319445[_0x9009('0x27')][_0x9009('0x43')]);_0x2accd4[_0x9009('0x44')]=qs[_0x9009('0x2d')](_[_0x9009('0x45')](_0x319445['query'],_0x447268['filters']));_0x2accd4['where']['MailInteractionId']=_0x1361b1['id'];if(_0x319445[_0x9009('0x27')][_0x9009('0x46')]){_0x2accd4[_0x9009('0x44')]=_[_0x9009('0x35')](_0x2accd4[_0x9009('0x44')],{'$or':_[_0x9009('0x21')](_0x2accd4['attributes'],function(_0x2684c6){var _0xd664bb={};_0xd664bb[_0x2684c6]={'$like':'%'+_0x319445['query'][_0x9009('0x46')]+'%'};return _0xd664bb;})});}if(_0x319445['query'][_0x9009('0x47')]){var _0x3515d3=_0x319445[_0x9009('0x27')]['$gte']['split'](',');var _0x271545={};_0x271545[_0x3515d3[0x0]]={'$gte':moment(_0x3515d3[0x1])[_0x9009('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2accd4[_0x9009('0x44')]=_['merge'](_0x2accd4[_0x9009('0x44')],_0x271545);}_0x2accd4=_[_0x9009('0x35')]({},_0x2accd4,_0x319445[_0x9009('0x49')]);return db[_0x9009('0x3d')]['count']({'where':_0x2accd4[_0x9009('0x44')]})[_0x9009('0x1a')](function(_0x2438f7){_0x2de086[_0x9009('0x16')]=_0x2438f7;if(_0x319445[_0x9009('0x27')]['includeAll']){_0x2accd4[_0x9009('0x34')]=[{'all':!![]}];}return db[_0x9009('0x3d')][_0x9009('0x26')](_0x2accd4);})[_0x9009('0x1a')](function(_0x39ffad){if(_0x319445[_0x9009('0x27')][_0x9009('0x4a')]==='true'){for(var _0x2c636e=0x0;_0x2c636e<_0x39ffad['length'];_0x2c636e++){_0x39ffad[_0x2c636e][_0x9009('0x38')]=juice(_0x39ffad[_0x2c636e]['body']);}}_0x2de086[_0x9009('0x4b')]=_0x39ffad;return _0x2de086;});}})[_0x9009('0x1a')](respondWithFilteredResult(_0x5a82cb,_0x2accd4))['catch'](handleError(_0x5a82cb,null));};exports['addTags']=function(_0x28cb37,_0x306110){return db[_0x9009('0x2c')][_0x9009('0x36')]({'where':{'id':_0x28cb37[_0x9009('0x39')]['id']}})[_0x9009('0x1a')](handleEntityNotFound(_0x306110,null))[_0x9009('0x1a')](function(_0x7f2503){if(_0x7f2503){return _0x7f2503[_0x9009('0x4c')](_0x28cb37[_0x9009('0x38')]['ids'],_[_0x9009('0x3f')](_0x28cb37[_0x9009('0x38')],[_0x9009('0x3e'),'id'])||{})[_0x9009('0x4d')](function(){return db['Tag'][_0x9009('0x26')]({'attributes':['id','name','color'],'where':{'id':_0x28cb37[_0x9009('0x38')][_0x9009('0x3e')]}});})[_0x9009('0x1a')](function(_0x130f0a){socket['emit'](_0x9009('0x4e'),{'id':Number(_0x28cb37[_0x9009('0x39')]['id']),'tags':_0x130f0a||[]});return{'id':Number(_0x28cb37[_0x9009('0x39')]['id']),'tags':_0x130f0a||[]};});}})[_0x9009('0x1a')](respondWithResult(_0x306110,null))[_0x9009('0x29')](handleError(_0x306110,null));};exports[_0x9009('0x4f')]=function(_0x129126,_0x142cfa){return db[_0x9009('0x2c')][_0x9009('0x36')]({'where':{'id':_0x129126[_0x9009('0x39')]['id']}})[_0x9009('0x1a')](handleEntityNotFound(_0x142cfa,null))['then'](function(_0xf932de){if(_0xf932de){return _0xf932de[_0x9009('0x4f')](_0x129126[_0x9009('0x27')][_0x9009('0x3e')]);}})[_0x9009('0x1a')](respondWithStatusCode(_0x142cfa,null))[_0x9009('0x29')](handleError(_0x142cfa,null));};exports['download']=function(_0x5511e8,_0x290294){var _0x3abab4=moment()[_0x9009('0x50')]()[_0x9009('0x51')]();var _0x56cf16=path[_0x9009('0x52')](config[_0x9009('0x53')],_0x9009('0x54'),_0x9009('0x55'),_0x9009('0x56'));var _0x26da21=path[_0x9009('0x52')](config[_0x9009('0x53')],_0x9009('0x54'),_0x9009('0x55'),'attachments');var _0xf6a43b=path[_0x9009('0x52')](_0x56cf16,_0x3abab4);var _0x4ab134=util[_0x9009('0x48')](_0x9009('0x57'),_0x5511e8[_0x9009('0x39')]['id'],_0x3abab4);var _0x2cac1b=path['join'](_0x56cf16,_0x4ab134);var _0x2925dd=[];if(_0x5511e8['query'][_0x9009('0x58')]){_0x2925dd['push']({'model':db[_0x9009('0x59')],'as':'Attachments','raw':!![]});}var _0x338890=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x9009('0x38'),_0x9009('0x5a'),'to','cc',_0x9009('0x5b'),_0x9009('0x5c'),_0x9009('0x5d')],'where':{'secret':![]},'order':qs[_0x9009('0x43')]('id'),'include':_0x2925dd}];return db[_0x9009('0x2c')][_0x9009('0x36')]({'where':{'id':_0x5511e8[_0x9009('0x39')]['id']},'include':_0x338890})['then'](handleEntityNotFound(_0x290294,null))['then'](function(_0x1eb808){if(_0x1eb808&&_0x1eb808[_0x9009('0x5e')]){var _0x1d095d=_0x1eb808[_0x9009('0x5f')]({'plain':!![]});fs[_0x9009('0x60')](_0xf6a43b);return BPromise['each'](_0x1d095d[_0x9009('0x5e')],function(_0x38313c,_0x30fb92){var _0x28de4c={'from':_0x38313c[_0x9009('0x5a')],'to':_0x38313c['to']||_0x9009('0x61'),'subject':_0x38313c[_0x9009('0x5c')],'html':htmlEntities[_0x9009('0x62')](_0x38313c[_0x9009('0x38')]),'headers':{'Date':moment(_0x38313c[_0x9009('0x5d')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x38313c['cc']){_0x28de4c['headers']['Cc']=_0x38313c['cc'];}if(_0x38313c['bcc']){_0x28de4c['headers'][_0x9009('0x63')]=_0x38313c[_0x9009('0x5b')];}return new BPromise(function(_0x35c12,_0x5e10fe){if(_0x38313c[_0x9009('0x64')]){for(var _0x4c6418=0x0;_0x4c6418<_0x38313c['Attachments'][_0x9009('0x32')];_0x4c6418++){var _0x21c059=_0x38313c[_0x9009('0x64')][_0x4c6418];var _0x6dc8c2=path[_0x9009('0x52')](_0x26da21,_0x21c059[_0x9009('0x65')]);if(fs[_0x9009('0x66')](_0x6dc8c2)){_0x28de4c[_0x9009('0x58')]['push']({'name':_0x21c059[_0x9009('0x1e')],'contentType':_0x21c059[_0x9009('0x23')],'data':fs['readFileSync'](_0x6dc8c2)});}}}emlformat['build'](_0x28de4c,function(_0x3f5127,_0x2c333e){if(_0x3f5127)return _0x5e10fe(_0x3f5127);fs[_0x9009('0x67')](path[_0x9009('0x52')](_0xf6a43b,util[_0x9009('0x48')](_0x9009('0x68'),_0x30fb92)),_0x2c333e);return _0x35c12(_0x2c333e);});});})[_0x9009('0x1a')](function(){return new BPromise(function(_0x5950d0,_0x9a017b){zipdir(_0xf6a43b,{'saveTo':_0x2cac1b},function(_0x4c957c,_0x3c5aa6){if(_0x4c957c)return _0x9a017b(_0x4c957c);return _0x5950d0(_0x3c5aa6);});})[_0x9009('0x1a')](function(){return new BPromise(function(_0x56b6c5,_0x5c1347){rimraf(_0xf6a43b,function(_0x490381){if(_0x490381)_0x5c1347(_0x490381);return _0x56b6c5();});});})['then'](function(){return _0x290294[_0x9009('0x69')](_0x2cac1b,_0x4ab134,function(_0xd8c77a){if(!_0xd8c77a)fs[_0x9009('0x6a')](_0x2cac1b);});});});}else{return _0x290294[_0x9009('0x1b')](0xc8);}})[_0x9009('0x29')](handleError(_0x290294,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index dd49624..43fd35c 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 _0xbc48=['then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0xc80d54,_0x39a6a7){var _0x308fc6=function(_0x23cb71){while(--_0x23cb71){_0xc80d54['push'](_0xc80d54['shift']());}};_0x308fc6(++_0x39a6a7);}(_0xbc48,0x90));var _0x8bc4=function(_0x527273,_0x4edcb1){_0x527273=_0x527273-0x0;var _0x578ec4=_0xbc48[_0x527273];return _0x578ec4;};'use strict';var EventEmitter=require(_0x8bc4('0x0'));var MailInteraction=require(_0x8bc4('0x1'))['db'][_0x8bc4('0x2')];var MailMessage=require(_0x8bc4('0x1'))['db'][_0x8bc4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8bc4('0x4')](0x0);var events={'afterCreate':_0x8bc4('0x5'),'afterUpdate':'update','afterDestroy':_0x8bc4('0x6')};function emitEvent(_0x2342a8){return function(_0x306ee3,_0x2cc45b,_0x50b13e){_0x306ee3[_0x8bc4('0x7')]({'attributes':['id'],'raw':!![]})[_0x8bc4('0x8')](function(_0x121704){_0x306ee3[_0x8bc4('0x9')](_0x8bc4('0xa'),_0x121704[_0x8bc4('0xb')](function(_0xff81a3){return{'id':_0xff81a3['id']};}));return MailMessage[_0x8bc4('0xc')]({'where':{'MailInteractionId':_0x306ee3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8bc4('0x8')](function(_0x344db2){_0x306ee3[_0x8bc4('0x9')](_0x8bc4('0xd'),_0x344db2['length']);MailInteractionEvents[_0x8bc4('0xe')](_0x2342a8+':'+_0x306ee3['id'],_0x306ee3);MailInteractionEvents[_0x8bc4('0xe')](_0x2342a8,_0x306ee3);_0x50b13e(null);})[_0x8bc4('0xf')](_0x50b13e(null));};}for(var e in events){if(events[_0x8bc4('0x10')](e)){var event=events[e];MailInteraction[_0x8bc4('0x11')](e,emitEvent(event));}}module[_0x8bc4('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x1b2f=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','hook','MailMessage','save','update'];(function(_0x5a4b7f,_0x276df0){var _0x46131b=function(_0x51802e){while(--_0x51802e){_0x5a4b7f['push'](_0x5a4b7f['shift']());}};_0x46131b(++_0x276df0);}(_0x1b2f,0x65));var _0xf1b2=function(_0x47d09b,_0x405943){_0x47d09b=_0x47d09b-0x0;var _0x455d26=_0x1b2f[_0x47d09b];return _0x455d26;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xf1b2('0x0')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1b2('0x1'),'afterUpdate':_0xf1b2('0x2'),'afterDestroy':_0xf1b2('0x3')};function emitEvent(_0x29027e){return function(_0x29fbe6,_0x206009,_0x4c621a){_0x29fbe6[_0xf1b2('0x4')]({'attributes':['id'],'raw':!![]})[_0xf1b2('0x5')](function(_0x21706c){_0x29fbe6[_0xf1b2('0x6')]('Users',_0x21706c[_0xf1b2('0x7')](function(_0x39183a){return{'id':_0x39183a['id']};}));return MailMessage[_0xf1b2('0x8')]({'where':{'MailInteractionId':_0x29fbe6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf1b2('0x5')](function(_0x18d125){_0x29fbe6[_0xf1b2('0x6')](_0xf1b2('0x9'),_0x18d125[_0xf1b2('0xa')]);MailInteractionEvents[_0xf1b2('0xb')](_0x29027e+':'+_0x29fbe6['id'],_0x29fbe6);MailInteractionEvents[_0xf1b2('0xb')](_0x29027e,_0x29fbe6);_0x4c621a(null);})['catch'](_0x4c621a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xf1b2('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 3817d12..4bd3d93 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 _0x40c7=['YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','closed','get','MailMessage','update','then','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','mail_interactions','FULLTEXT','substatusAt','format'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x40c7,0xa3));var _0x740c=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x40c7[_0x485f53];return _0x480f1e;};'use strict';var _=require(_0x740c('0x0'));var util=require('util');var logger=require(_0x740c('0x1'))(_0x740c('0x2'));var moment=require(_0x740c('0x3'));var BPromise=require('bluebird');var rp=require(_0x740c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x740c('0x5'));var config=require(_0x740c('0x6'));var attributes=require(_0x740c('0x7'));module[_0x740c('0x8')]=function(_0x3dc786,_0x2e2eff){return _0x3dc786['define']('MailInteraction',attributes,{'tableName':_0x740c('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x740c('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a8b48,_0x509771,_0x1f2183){if(_0x2a8b48['substatus']){_0x2a8b48[_0x740c('0xb')]=moment()[_0x740c('0xc')](_0x740c('0xd'));}if(_0x2a8b48['closed']){_0x2a8b48[_0x740c('0xe')]=moment()[_0x740c('0xc')](_0x740c('0xd'));}_0x1f2183(null,_0x509771);},'beforeUpdate':function(_0x56209f,_0x1c2bdb,_0x3769cc){if(_0x56209f[_0x740c('0xf')](_0x740c('0x10'))){_0x56209f[_0x740c('0xb')]=_0x56209f['substatus']?moment()[_0x740c('0xc')](_0x740c('0xd')):null;}if(_0x56209f['changed'](_0x740c('0x11'))){_0x56209f[_0x740c('0xe')]=moment()[_0x740c('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x56209f[_0x740c('0x10')]=null;_0x56209f['substatusAt']=null;}_0x3769cc(null,_0x56209f);},'afterUpdate':function(_0x255b6c,_0x4b0bca,_0xc8bf6c){var _0x4e03d5=_0x3dc786['models'];var _0x8e7066=_0x255b6c[_0x740c('0x12')]({'plain':!![]});if(_0x8e7066[_0x740c('0x11')]){return _0x4e03d5[_0x740c('0x13')][_0x740c('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x8e7066['id']}})[_0x740c('0x15')](function(){_0xc8bf6c();})['catch'](function(_0x34f369){_0xc8bf6c(_0x34f369);});}else{_0xc8bf6c();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4c0e=['models','MailMessage','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','substatus','substatusAt','closed'];(function(_0x3ad08f,_0x37b7aa){var _0x26c37c=function(_0x227490){while(--_0x227490){_0x3ad08f['push'](_0x3ad08f['shift']());}};_0x26c37c(++_0x37b7aa);}(_0x4c0e,0xff));var _0xe4c0=function(_0x1ed406,_0x3b3184){_0x1ed406=_0x1ed406-0x0;var _0x359b38=_0x4c0e[_0x1ed406];return _0x359b38;};'use strict';var _=require(_0xe4c0('0x0'));var util=require(_0xe4c0('0x1'));var logger=require(_0xe4c0('0x2'))(_0xe4c0('0x3'));var moment=require('moment');var BPromise=require(_0xe4c0('0x4'));var rp=require(_0xe4c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4c0('0x6'));var config=require(_0xe4c0('0x7'));var attributes=require(_0xe4c0('0x8'));module[_0xe4c0('0x9')]=function(_0x25fe37,_0x4d3ec1){return _0x25fe37['define'](_0xe4c0('0xa'),attributes,{'tableName':_0xe4c0('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0xe4c0('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f7e8d,_0x4fa110,_0x37d2db){if(_0x3f7e8d['substatus']){_0x3f7e8d['substatusAt']=moment()['format'](_0xe4c0('0xd'));}if(_0x3f7e8d['closed']){_0x3f7e8d[_0xe4c0('0xe')]=moment()[_0xe4c0('0xf')](_0xe4c0('0xd'));}_0x37d2db(null,_0x4fa110);},'beforeUpdate':function(_0x1baa70,_0x53e2c7,_0x16ca3f){if(_0x1baa70[_0xe4c0('0x10')](_0xe4c0('0x11'))){_0x1baa70[_0xe4c0('0x12')]=_0x1baa70[_0xe4c0('0x11')]?moment()[_0xe4c0('0xf')](_0xe4c0('0xd')):null;}if(_0x1baa70[_0xe4c0('0x10')](_0xe4c0('0x13'))){_0x1baa70[_0xe4c0('0xe')]=moment()[_0xe4c0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x1baa70[_0xe4c0('0x11')]=null;_0x1baa70[_0xe4c0('0x12')]=null;}_0x16ca3f(null,_0x1baa70);},'afterUpdate':function(_0x21a3fe,_0x2ae449,_0x4cc389){var _0x192ac1=_0x25fe37[_0xe4c0('0x14')];var _0x48048c=_0x21a3fe['get']({'plain':!![]});if(_0x48048c[_0xe4c0('0x13')]){return _0x192ac1[_0xe4c0('0x15')][_0xe4c0('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x48048c['id']}})[_0xe4c0('0x17')](function(){_0x4cc389();})['catch'](function(_0x1b3b10){_0x4cc389(_0x1b3b10);});}else{_0x4cc389();}}},'charset':'utf8mb4','collate':_0xe4c0('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b5b9ba1..a9e60fb 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 _0x2787=['redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','limit','then','debug','stringify','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2787,0x15e));var _0x7278=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2787[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7278('0x0'));var util=require('util');var moment=require(_0x7278('0x1'));var BPromise=require('bluebird');var rs=require(_0x7278('0x2'));var fs=require('fs');var Redis=require(_0x7278('0x3'));var db=require(_0x7278('0x4'))['db'];var utils=require(_0x7278('0x5'));var logger=require(_0x7278('0x6'))(_0x7278('0x7'));var config=require('../../config/environment');var jayson=require(_0x7278('0x8'));var client=jayson[_0x7278('0x9')]['http']({'port':0x232a});config[_0x7278('0xa')]=_[_0x7278('0xb')](config['redis'],{'host':_0x7278('0xc'),'port':0x18eb});var socket=require(_0x7278('0xd'))(new Redis(config[_0x7278('0xa')]));require(_0x7278('0xe'))[_0x7278('0xf')](socket);function respondWithRpcPromise(_0x184450,_0x4fdb2b,_0x322afa){return new BPromise(function(_0xcea77e,_0x339fdc){return client['request'](_0x184450,_0x322afa)['then'](function(_0x2693a3){logger['info'](_0x7278('0x10'),_0x4fdb2b,_0x7278('0x11'));logger['debug'](_0x7278('0x12'),_0x4fdb2b,'request\x20sent',JSON['stringify'](_0x2693a3));if(_0x2693a3['error']){if(_0x2693a3[_0x7278('0x13')][_0x7278('0x14')]===0x1f4){logger[_0x7278('0x13')](_0x7278('0x10'),_0x4fdb2b,_0x2693a3['error'][_0x7278('0x15')]);return _0x339fdc(_0x2693a3[_0x7278('0x13')][_0x7278('0x15')]);}logger[_0x7278('0x13')]('MailInteraction,\x20%s,\x20%s',_0x4fdb2b,_0x2693a3[_0x7278('0x13')][_0x7278('0x15')]);return _0xcea77e(_0x2693a3[_0x7278('0x13')][_0x7278('0x15')]);}else{logger[_0x7278('0x16')](_0x7278('0x10'),_0x4fdb2b,'request\x20sent');_0xcea77e(_0x2693a3[_0x7278('0x17')][_0x7278('0x15')]);}})[_0x7278('0x18')](function(_0x517461){logger[_0x7278('0x13')](_0x7278('0x10'),_0x4fdb2b,_0x517461);_0x339fdc(_0x517461);});});}exports[_0x7278('0x19')]=function(_0x153122){var _0x273f14=this;return new Promise(function(_0x1c7431,_0x499e2c){return db[_0x7278('0x1a')]['update'](_0x153122[_0x7278('0x1b')],{'raw':_0x153122[_0x7278('0x1c')]?_0x153122[_0x7278('0x1c')][_0x7278('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153122['options']?_0x153122[_0x7278('0x1c')][_0x7278('0x1e')]||null:null,'attributes':_0x153122['options']?_0x153122['options']['attributes']||null:null,'limit':_0x153122['options']?_0x153122['options'][_0x7278('0x1f')]||null:null})[_0x7278('0x20')](function(_0x3b2205){logger[_0x7278('0x16')](_0x7278('0x19'),_0x153122);logger[_0x7278('0x21')]('UpdateMailInteraction',_0x153122,JSON[_0x7278('0x22')](_0x3b2205));_0x1c7431(_0x3b2205);})['catch'](function(_0x2163e4){logger[_0x7278('0x13')](_0x7278('0x19'),_0x2163e4[_0x7278('0x15')],_0x153122);_0x499e2c(_0x273f14[_0x7278('0x13')](0x1f4,_0x2163e4['message']));});});};exports[_0x7278('0x23')]=function(_0x3c9b08){return new Promise(function(_0x1b9098,_0x239e44){return db[_0x7278('0x1a')][_0x7278('0x24')]({'where':_0x3c9b08[_0x7278('0x1c')]?_0x3c9b08[_0x7278('0x1c')][_0x7278('0x1e')]||null:null})[_0x7278('0x20')](function(_0x1a3460){if(_0x1a3460){return _0x1a3460['addTags'](_0x3c9b08[_0x7278('0x1b')][_0x7278('0x25')],_['omit'](_0x3c9b08['body'],[_0x7278('0x25'),'id'])||{});}})[_0x7278('0x26')](function(_0x47fc0d){logger['info'](_0x7278('0x27'),_0x3c9b08);logger[_0x7278('0x21')](_0x7278('0x27'),_0x3c9b08,JSON[_0x7278('0x22')](_0x47fc0d));_0x1b9098(_0x47fc0d);})[_0x7278('0x18')](function(_0x2ade99){logger['error'](_0x7278('0x27'),_0x2ade99[_0x7278('0x15')],_0x3c9b08);_0x239e44(_this[_0x7278('0x13')](0x1f4,_0x2ade99['message']));});});}; \ No newline at end of file +var _0x6cb2=['jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','UpdateMailInteraction','MailInteraction','options','raw','attributes','limit','AddTagsToMailInteraction','where','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x30a925,_0x1d4bca){var _0x1d8293=function(_0x35ac3b){while(--_0x35ac3b){_0x30a925['push'](_0x30a925['shift']());}};_0x1d8293(++_0x1d4bca);}(_0x6cb2,0xfa));var _0x26cb=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x6cb2[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x26cb('0x0'));var util=require(_0x26cb('0x1'));var moment=require(_0x26cb('0x2'));var BPromise=require(_0x26cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26cb('0x4'));var db=require(_0x26cb('0x5'))['db'];var utils=require(_0x26cb('0x6'));var logger=require('../../config/logger')(_0x26cb('0x7'));var config=require(_0x26cb('0x8'));var jayson=require(_0x26cb('0x9'));var client=jayson[_0x26cb('0xa')][_0x26cb('0xb')]({'port':0x232a});config[_0x26cb('0xc')]=_['defaults'](config[_0x26cb('0xc')],{'host':_0x26cb('0xd'),'port':0x18eb});var socket=require(_0x26cb('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x26cb('0xf')](socket);function respondWithRpcPromise(_0x13e793,_0xcfa2a,_0x497531){return new BPromise(function(_0x2406a6,_0x21e5c2){return client['request'](_0x13e793,_0x497531)[_0x26cb('0x10')](function(_0x28eab7){logger[_0x26cb('0x11')](_0x26cb('0x12'),_0xcfa2a,'request\x20sent');logger[_0x26cb('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xcfa2a,_0x26cb('0x14'),JSON['stringify'](_0x28eab7));if(_0x28eab7[_0x26cb('0x15')]){if(_0x28eab7[_0x26cb('0x15')]['code']===0x1f4){logger[_0x26cb('0x15')](_0x26cb('0x12'),_0xcfa2a,_0x28eab7['error']['message']);return _0x21e5c2(_0x28eab7[_0x26cb('0x15')][_0x26cb('0x16')]);}logger[_0x26cb('0x15')](_0x26cb('0x12'),_0xcfa2a,_0x28eab7['error'][_0x26cb('0x16')]);return _0x2406a6(_0x28eab7[_0x26cb('0x15')][_0x26cb('0x16')]);}else{logger[_0x26cb('0x11')](_0x26cb('0x12'),_0xcfa2a,_0x26cb('0x14'));_0x2406a6(_0x28eab7['result']['message']);}})[_0x26cb('0x17')](function(_0x44acd3){logger['error']('MailInteraction,\x20%s,\x20%s',_0xcfa2a,_0x44acd3);_0x21e5c2(_0x44acd3);});});}exports[_0x26cb('0x18')]=function(_0x58dda3){var _0x46aca0=this;return new Promise(function(_0x955113,_0x1c96a1){return db[_0x26cb('0x19')]['update'](_0x58dda3['body'],{'raw':_0x58dda3['options']?_0x58dda3[_0x26cb('0x1a')][_0x26cb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58dda3['options']?_0x58dda3[_0x26cb('0x1a')]['where']||null:null,'attributes':_0x58dda3['options']?_0x58dda3['options'][_0x26cb('0x1c')]||null:null,'limit':_0x58dda3[_0x26cb('0x1a')]?_0x58dda3[_0x26cb('0x1a')][_0x26cb('0x1d')]||null:null})[_0x26cb('0x10')](function(_0x390358){logger[_0x26cb('0x11')](_0x26cb('0x18'),_0x58dda3);logger[_0x26cb('0x13')](_0x26cb('0x18'),_0x58dda3,JSON['stringify'](_0x390358));_0x955113(_0x390358);})[_0x26cb('0x17')](function(_0x94c48f){logger[_0x26cb('0x15')]('UpdateMailInteraction',_0x94c48f[_0x26cb('0x16')],_0x58dda3);_0x1c96a1(_0x46aca0[_0x26cb('0x15')](0x1f4,_0x94c48f[_0x26cb('0x16')]));});});};exports[_0x26cb('0x1e')]=function(_0x1bf06b){return new Promise(function(_0x1ff6b3,_0x41d149){return db[_0x26cb('0x19')]['find']({'where':_0x1bf06b[_0x26cb('0x1a')]?_0x1bf06b[_0x26cb('0x1a')][_0x26cb('0x1f')]||null:null})[_0x26cb('0x10')](function(_0x10c4d8){if(_0x10c4d8){return _0x10c4d8[_0x26cb('0x20')](_0x1bf06b[_0x26cb('0x21')][_0x26cb('0x22')],_[_0x26cb('0x23')](_0x1bf06b[_0x26cb('0x21')],[_0x26cb('0x22'),'id'])||{});}})['spread'](function(_0x4c9898){logger[_0x26cb('0x11')](_0x26cb('0x24'),_0x1bf06b);logger[_0x26cb('0x13')](_0x26cb('0x24'),_0x1bf06b,JSON['stringify'](_0x4c9898));_0x1ff6b3(_0x4c9898);})['catch'](function(_0x45c06e){logger['error'](_0x26cb('0x24'),_0x45c06e[_0x26cb('0x16')],_0x1bf06b);_0x41d149(_this[_0x26cb('0x15')](0x1f4,_0x45c06e[_0x26cb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d34c592..c3d7291 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 _0x22a0=['mailInteraction:','save','remove','update','emit','length'];(function(_0x4ef3,_0x84ad99){var _0x562f3a=function(_0x32ae71){while(--_0x32ae71){_0x4ef3['push'](_0x4ef3['shift']());}};_0x562f3a(++_0x84ad99);}(_0x22a0,0x1e7));var _0x022a=function(_0x561f21,_0x275f68){_0x561f21=_0x561f21-0x0;var _0xa9c0ec=_0x22a0[_0x561f21];return _0xa9c0ec;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x022a('0x0'),_0x022a('0x1'),_0x022a('0x2')];function createListener(_0x485123,_0x4de04f){return function(_0x37d502){_0x4de04f[_0x022a('0x3')](_0x485123,_0x37d502);};}function removeListener(_0x520f55,_0x598ba7){return function(){MailInteractionEvents['removeListener'](_0x520f55,_0x598ba7);};}exports['register']=function(_0x2ca9b8){for(var _0x4d6043=0x0,_0x36c7cd=events[_0x022a('0x4')];_0x4d6043<_0x36c7cd;_0x4d6043++){var _0x1abcdf=events[_0x4d6043];var _0x325b60=createListener(_0x022a('0x5')+_0x1abcdf,_0x2ca9b8);MailInteractionEvents['on'](_0x1abcdf,_0x325b60);}}; \ No newline at end of file +var _0x7cf7=['remove','removeListener','register','./mailInteraction.events'];(function(_0x2e48c1,_0x5271a2){var _0x524fce=function(_0x3e9e25){while(--_0x3e9e25){_0x2e48c1['push'](_0x2e48c1['shift']());}};_0x524fce(++_0x5271a2);}(_0x7cf7,0x163));var _0x77cf=function(_0x494020,_0x30eba4){_0x494020=_0x494020-0x0;var _0x2ba0aa=_0x7cf7[_0x494020];return _0x2ba0aa;};'use strict';var MailInteractionEvents=require(_0x77cf('0x0'));var events=['save',_0x77cf('0x1'),'update'];function createListener(_0x5710fa,_0x465396){return function(_0x38ef96){_0x465396['emit'](_0x5710fa,_0x38ef96);};}function removeListener(_0x13a536,_0x213cb1){return function(){MailInteractionEvents[_0x77cf('0x2')](_0x13a536,_0x213cb1);};}exports[_0x77cf('0x3')]=function(_0x54173d){for(var _0x203f45=0x0,_0xdf2107=events['length'];_0x203f45<_0xdf2107;_0x203f45++){var _0x29e3fb=events[_0x203f45];var _0x50c782=createListener('mailInteraction:'+_0x29e3fb,_0x54173d);MailInteractionEvents['on'](_0x29e3fb,_0x50c782);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cb79986..b9caea2 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 _0x7b6b=['post','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download'];(function(_0x16c071,_0x475628){var _0x4e51c5=function(_0x284972){while(--_0x284972){_0x16c071['push'](_0x16c071['shift']());}};_0x4e51c5(++_0x475628);}(_0x7b6b,0xac));var _0xb7b6=function(_0x38cef0,_0x381d4e){_0x38cef0=_0x38cef0-0x0;var _0x7c0b97=_0x7b6b[_0x38cef0];return _0x7c0b97;};'use strict';var multer=require(_0xb7b6('0x0'));var util=require('util');var path=require(_0xb7b6('0x1'));var timeout=require(_0xb7b6('0x2'));var express=require(_0xb7b6('0x3'));var router=express['Router']();var fs_extra=require(_0xb7b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb7b6('0x5'));var config=require(_0xb7b6('0x6'));var controller=require(_0xb7b6('0x7'));router[_0xb7b6('0x8')]('/',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xa')]);router[_0xb7b6('0x8')](_0xb7b6('0xb'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xc')]);router[_0xb7b6('0x8')](_0xb7b6('0xd'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xe')]);router[_0xb7b6('0x8')](_0xb7b6('0xf'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x10')]);router[_0xb7b6('0x11')]('/',auth[_0xb7b6('0x9')](),interaction['tracked'](_0xb7b6('0x12'),_0xb7b6('0x13')),controller[_0xb7b6('0x14')]);router[_0xb7b6('0x15')](_0xb7b6('0xd'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x16')]);router[_0xb7b6('0x15')](_0xb7b6('0x17'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x18')]);router[_0xb7b6('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0xb7b6('0x19')]);router['delete']('/:id',auth[_0xb7b6('0x9')](),controller['destroy']);module[_0xb7b6('0x1a')]=router; \ No newline at end of file +var _0x823c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','destroy','multer','path'];(function(_0x295a5c,_0xfd0b5){var _0x53339e=function(_0x5ee71d){while(--_0x5ee71d){_0x295a5c['push'](_0x295a5c['shift']());}};_0x53339e(++_0xfd0b5);}(_0x823c,0x143));var _0xc823=function(_0x460583,_0x31dc63){_0x460583=_0x460583-0x0;var _0x86c989=_0x823c[_0x460583];return _0x86c989;};'use strict';var multer=require(_0xc823('0x0'));var util=require('util');var path=require(_0xc823('0x1'));var timeout=require(_0xc823('0x2'));var express=require(_0xc823('0x3'));var router=express[_0xc823('0x4')]();var fs_extra=require(_0xc823('0x5'));var auth=require(_0xc823('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc823('0x7'));var controller=require(_0xc823('0x8'));router[_0xc823('0x9')]('/',auth[_0xc823('0xa')](),controller[_0xc823('0xb')]);router['get'](_0xc823('0xc'),auth[_0xc823('0xa')](),controller['describe']);router['get'](_0xc823('0xd'),auth[_0xc823('0xa')](),controller['show']);router[_0xc823('0x9')](_0xc823('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xc823('0xf')]('/',auth[_0xc823('0xa')](),interaction[_0xc823('0x10')](_0xc823('0x11'),_0xc823('0x12')),controller['create']);router[_0xc823('0x13')](_0xc823('0xd'),auth[_0xc823('0xa')](),controller[_0xc823('0x14')]);router[_0xc823('0x13')](_0xc823('0x15'),auth['isAuthenticated'](),controller[_0xc823('0x16')]);router[_0xc823('0x13')](_0xc823('0x17'),auth[_0xc823('0xa')](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc823('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8386559..558daae 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 _0x6d85=['ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','TEXT','long','medium','BOOLEAN'];(function(_0x3ada0a,_0x5e94e9){var _0x41ffc0=function(_0xd4dabc){while(--_0xd4dabc){_0x3ada0a['push'](_0x3ada0a['shift']());}};_0x41ffc0(++_0x5e94e9);}(_0x6d85,0x173));var _0x56d8=function(_0x5e7986,_0x8770ef){_0x5e7986=_0x5e7986-0x0;var _0x2ada39=_0x6d85[_0x5e7986];return _0x2ada39;};'use strict';var Sequelize=require(_0x56d8('0x0'));var _=require(_0x56d8('0x1'));module['exports']={'body':{'type':Sequelize[_0x56d8('0x2')](_0x56d8('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x56d8('0x2')](_0x56d8('0x4'))},'read':{'type':Sequelize[_0x56d8('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x56d8('0x6')]('in',_0x56d8('0x7')),'defaultValue':_0x56d8('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x56d8('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x56d8('0x2')](_0x56d8('0x3'))},'cc':{'type':Sequelize[_0x56d8('0x2')]('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x56d8('0x2')]},'sentAt':{'type':Sequelize[_0x56d8('0x9')]},'attach':{'type':Sequelize[_0x56d8('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x56d8('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x56d8('0x3'))},'originCc':{'type':Sequelize[_0x56d8('0x2')](_0x56d8('0x3'))},'originChannel':{'type':Sequelize[_0x56d8('0x6')](_0x56d8('0xb'),_0x56d8('0xc')),'defaultValue':_0x56d8('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x5a47=['Chat','Email','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x556d3d,_0x11b936){var _0x3d134c=function(_0x522f52){while(--_0x522f52){_0x556d3d['push'](_0x556d3d['shift']());}};_0x3d134c(++_0x11b936);}(_0x5a47,0x152));var _0x75a4=function(_0x121faa,_0x3ad4f6){_0x121faa=_0x121faa-0x0;var _0x4be5c1=_0x5a47[_0x121faa];return _0x4be5c1;};'use strict';var Sequelize=require(_0x75a4('0x0'));var _=require(_0x75a4('0x1'));module[_0x75a4('0x2')]={'body':{'type':Sequelize[_0x75a4('0x3')](_0x75a4('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x75a4('0x3')](_0x75a4('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x75a4('0x6')]('in','out'),'defaultValue':_0x75a4('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x75a4('0x8')](0x1fe)},'from':{'type':Sequelize[_0x75a4('0x8')]},'to':{'type':Sequelize['TEXT'](_0x75a4('0x4'))},'cc':{'type':Sequelize[_0x75a4('0x3')](_0x75a4('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x75a4('0x4'))},'subject':{'type':Sequelize[_0x75a4('0x3')]},'sentAt':{'type':Sequelize[_0x75a4('0x9')]},'attach':{'type':Sequelize[_0x75a4('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x75a4('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x75a4('0x9')]},'originTo':{'type':Sequelize[_0x75a4('0x3')](_0x75a4('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x75a4('0x4'))},'originChannel':{'type':Sequelize[_0x75a4('0x6')]('Email',_0x75a4('0xc')),'defaultValue':_0x75a4('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 996666b..a5623bd 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 _0xac0c=['contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','bcc','createdAt','Attachments','from','subject','decode','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','path','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','status','json','offset','undefined','limit','count','then','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','options','MailMessage','includeAll','include','findAll','rows','catch','show','params','find','body','describe','create','direction','secret','split','MailAccount','findOne','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','List','ListId','SendMail','sendMail','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes'];(function(_0x25b6fb,_0x48ffea){var _0xf143b0=function(_0x21bbe6){while(--_0x21bbe6){_0x25b6fb['push'](_0x25b6fb['shift']());}};_0xf143b0(++_0x48ffea);}(_0xac0c,0x160));var _0xcac0=function(_0x3e4519,_0x4d8f2a){_0x3e4519=_0x3e4519-0x0;var _0x27e5cf=_0xac0c[_0x3e4519];return _0x27e5cf;};'use strict';var emlformat=require('eml-format');var moment=require(_0xcac0('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xcac0('0x1'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xcac0('0x2'));var logger=require(_0xcac0('0x3'))(_0xcac0('0x4'));var interaction_log=require(_0xcac0('0x3'))(_0xcac0('0x5'));var config=require(_0xcac0('0x6'));var db=require(_0xcac0('0x7'))['db'];config['redis']=_[_0xcac0('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcac0('0x9'))(new Redis(config['redis']));var htmlEntities=require(_0xcac0('0xa'));require(_0xcac0('0xb'))[_0xcac0('0xc')](socket);var jayson=require(_0xcac0('0xd'));var client=jayson[_0xcac0('0xe')][_0xcac0('0xf')]({'port':0x232c});var client9003=jayson['client'][_0xcac0('0xf')]({'port':0x232b});var client9002=jayson[_0xcac0('0xe')][_0xcac0('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x1b1c47,_0x1ac639,_0x55ae70,_0x5d3926){return new BPromise(function(_0x4d8feb,_0x262947){var _0x12bb6f=_0x5d3926||client;return _0x12bb6f[_0xcac0('0x10')](_0x1b1c47,_0x55ae70)['then'](function(_0x20666d){logger['info']('MailMessage,\x20%s,\x20%s',_0x1ac639,'request\x20sent');logger[_0xcac0('0x11')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1ac639,_0xcac0('0x12'),JSON[_0xcac0('0x13')](_0x20666d));if(_0x20666d[_0xcac0('0x14')]){if(_0x20666d[_0xcac0('0x14')][_0xcac0('0x15')]===0x1f4){logger[_0xcac0('0x14')]('MailMessage,\x20%s,\x20%s',_0x1ac639,_0x20666d[_0xcac0('0x14')]['message']);return _0x262947(_0x20666d[_0xcac0('0x14')]['message']);}logger[_0xcac0('0x14')](_0xcac0('0x16'),_0x1ac639,_0x20666d[_0xcac0('0x14')][_0xcac0('0x17')]);return _0x4d8feb(_0x20666d[_0xcac0('0x14')][_0xcac0('0x17')]);}else{logger[_0xcac0('0x18')](_0xcac0('0x16'),_0x1ac639,_0xcac0('0x12'));_0x4d8feb(_0x20666d['result']['message']);}})['catch'](function(_0x5d3861){logger[_0xcac0('0x14')](_0xcac0('0x16'),_0x1ac639,_0x5d3861);_0x262947(_0x5d3861);});});}function respondWithResult(_0x167520,_0x3c8c82){_0x3c8c82=_0x3c8c82||0xc8;return function(_0x445b3a){if(_0x445b3a){return _0x167520[_0xcac0('0x19')](_0x3c8c82)[_0xcac0('0x1a')](_0x445b3a);}};}function respondWithFilteredResult(_0x556073,_0x3064c0){return function(_0x3cb2de){if(_0x3cb2de){var _0x57fa4b=typeof _0x3064c0[_0xcac0('0x1b')]===_0xcac0('0x1c')&&typeof _0x3064c0[_0xcac0('0x1d')]==='undefined';var _0x21f873=_0x3cb2de[_0xcac0('0x1e')];var _0x484fb2=_0x57fa4b?0x0:_0x3064c0[_0xcac0('0x1b')];var _0x4c85ef=_0x57fa4b?_0x3cb2de[_0xcac0('0x1e')]:_0x3064c0[_0xcac0('0x1b')]+_0x3064c0['limit'];var _0x16fc62;if(_0x4c85ef>=_0x21f873){_0x4c85ef=_0x21f873;_0x16fc62=0xc8;}else{_0x16fc62=0xce;}_0x556073[_0xcac0('0x19')](_0x16fc62);return _0x556073['set']('Content-Range',_0x484fb2+'-'+_0x4c85ef+'/'+_0x21f873)[_0xcac0('0x1a')](_0x3cb2de);}return null;};}function saveUpdates(_0x2db7b4){return function(_0x34c3da){if(_0x34c3da){return _0x34c3da['update'](_0x2db7b4)[_0xcac0('0x1f')](function(_0x23b81d){return _0x23b81d;});}return null;};}function removeEntity(_0x3272ce){return function(_0x1e419f){if(_0x1e419f){return _0x1e419f[_0xcac0('0x20')]()[_0xcac0('0x1f')](function(){_0x3272ce[_0xcac0('0x19')](0xcc)[_0xcac0('0x21')]();});}};}function handleEntityNotFound(_0x29e1ac){return function(_0x3013c7){if(!_0x3013c7){_0x29e1ac[_0xcac0('0x22')](0x194);}return _0x3013c7;};}function handleError(_0x3e8bcf,_0x9315dc){_0x9315dc=_0x9315dc||0x1f4;return function(_0x56df8c){logger[_0xcac0('0x14')](_0x56df8c[_0xcac0('0x23')]);if(_0x56df8c['name']){delete _0x56df8c[_0xcac0('0x24')];}_0x3e8bcf[_0xcac0('0x19')](_0x9315dc)[_0xcac0('0x25')](_0x56df8c);};}exports[_0xcac0('0x26')]=function(_0xe1357b,_0x31a857){var _0xc9f73d={},_0x289c6c={},_0x46897f={'count':0x0,'rows':[]};var _0x1fbb85=_['map'](db['MailMessage'][_0xcac0('0x27')],function(_0x4813a5){return{'name':_0x4813a5[_0xcac0('0x28')],'type':_0x4813a5[_0xcac0('0x29')][_0xcac0('0x2a')]};});_0x289c6c[_0xcac0('0x2b')]=_[_0xcac0('0x2c')](_0x1fbb85,_0xcac0('0x24'));_0x289c6c[_0xcac0('0x2d')]=_[_0xcac0('0x2e')](_0xe1357b['query']);_0x289c6c[_0xcac0('0x2f')]=_[_0xcac0('0x30')](_0x289c6c[_0xcac0('0x2b')],_0x289c6c[_0xcac0('0x2d')]);_0xc9f73d['attributes']=_[_0xcac0('0x30')](_0x289c6c[_0xcac0('0x2b')],qs['fields'](_0xe1357b['query'][_0xcac0('0x31')]));_0xc9f73d[_0xcac0('0x32')]=_0xc9f73d['attributes'][_0xcac0('0x33')]?_0xc9f73d[_0xcac0('0x32')]:_0x289c6c[_0xcac0('0x2b')];if(!_0xe1357b[_0xcac0('0x2d')][_0xcac0('0x34')]('nolimit')){_0xc9f73d[_0xcac0('0x1d')]=qs[_0xcac0('0x1d')](_0xe1357b[_0xcac0('0x2d')][_0xcac0('0x1d')]);_0xc9f73d[_0xcac0('0x1b')]=qs[_0xcac0('0x1b')](_0xe1357b[_0xcac0('0x2d')][_0xcac0('0x1b')]);}_0xc9f73d['order']=qs[_0xcac0('0x35')](_0xe1357b[_0xcac0('0x2d')]['sort']);_0xc9f73d[_0xcac0('0x36')]=qs[_0xcac0('0x2f')](_[_0xcac0('0x37')](_0xe1357b[_0xcac0('0x2d')],_0x289c6c[_0xcac0('0x2f')]),_0x1fbb85);if(_0xe1357b[_0xcac0('0x2d')]['filter']){_0xc9f73d['where']=_[_0xcac0('0x38')](_0xc9f73d[_0xcac0('0x36')],{'$or':_[_0xcac0('0x2c')](_0x1fbb85,function(_0x5f1605){if(_0x5f1605[_0xcac0('0x29')]!=='VIRTUAL'){var _0x51f5af={};_0x51f5af[_0x5f1605[_0xcac0('0x24')]]={'$like':'%'+_0xe1357b[_0xcac0('0x2d')]['filter']+'%'};return _0x51f5af;}})});}_0xc9f73d=_[_0xcac0('0x38')]({},_0xc9f73d,_0xe1357b[_0xcac0('0x39')]);var _0x484166={'where':_0xc9f73d[_0xcac0('0x36')]};return db[_0xcac0('0x3a')]['count'](_0x484166)[_0xcac0('0x1f')](function(_0x5a3f4f){_0x46897f[_0xcac0('0x1e')]=_0x5a3f4f;if(_0xe1357b[_0xcac0('0x2d')][_0xcac0('0x3b')]){_0xc9f73d[_0xcac0('0x3c')]=[{'all':!![]}];}return db[_0xcac0('0x3a')][_0xcac0('0x3d')](_0xc9f73d);})[_0xcac0('0x1f')](function(_0x1749fb){_0x46897f[_0xcac0('0x3e')]=_0x1749fb;return _0x46897f;})['then'](respondWithFilteredResult(_0x31a857,_0xc9f73d))[_0xcac0('0x3f')](handleError(_0x31a857,null));};exports[_0xcac0('0x40')]=function(_0x3ea33b,_0x137f26){var _0x221198={'raw':!![],'where':{'id':_0x3ea33b[_0xcac0('0x41')]['id']}},_0x2856b3={};_0x2856b3[_0xcac0('0x2b')]=_[_0xcac0('0x2e')](db[_0xcac0('0x3a')][_0xcac0('0x27')]);_0x2856b3[_0xcac0('0x2d')]=_[_0xcac0('0x2e')](_0x3ea33b[_0xcac0('0x2d')]);_0x2856b3[_0xcac0('0x2f')]=_['intersection'](_0x2856b3[_0xcac0('0x2b')],_0x2856b3[_0xcac0('0x2d')]);_0x221198[_0xcac0('0x32')]=_[_0xcac0('0x30')](_0x2856b3[_0xcac0('0x2b')],qs[_0xcac0('0x31')](_0x3ea33b['query']['fields']));_0x221198[_0xcac0('0x32')]=_0x221198[_0xcac0('0x32')]['length']?_0x221198[_0xcac0('0x32')]:_0x2856b3[_0xcac0('0x2b')];if(_0x3ea33b[_0xcac0('0x2d')][_0xcac0('0x3b')]){_0x221198[_0xcac0('0x3c')]=[{'all':!![]}];}_0x221198=_[_0xcac0('0x38')]({},_0x221198,_0x3ea33b[_0xcac0('0x39')]);return db[_0xcac0('0x3a')][_0xcac0('0x42')](_0x221198)[_0xcac0('0x1f')](handleEntityNotFound(_0x137f26,null))[_0xcac0('0x1f')](respondWithResult(_0x137f26,null))[_0xcac0('0x3f')](handleError(_0x137f26,null));};exports['update']=function(_0x4aed8a,_0x2a2cb8){if(_0x4aed8a[_0xcac0('0x43')]['id']){delete _0x4aed8a['body']['id'];}return db[_0xcac0('0x3a')][_0xcac0('0x42')]({'where':{'id':_0x4aed8a['params']['id']}})['then'](handleEntityNotFound(_0x2a2cb8,null))[_0xcac0('0x1f')](saveUpdates(_0x4aed8a[_0xcac0('0x43')],null))[_0xcac0('0x1f')](respondWithResult(_0x2a2cb8,null))[_0xcac0('0x3f')](handleError(_0x2a2cb8,null));};exports[_0xcac0('0x20')]=function(_0x28bcdf,_0x228f1a){return db[_0xcac0('0x3a')]['find']({'where':{'id':_0x28bcdf[_0xcac0('0x41')]['id']}})[_0xcac0('0x1f')](handleEntityNotFound(_0x228f1a,null))[_0xcac0('0x1f')](removeEntity(_0x228f1a,null))[_0xcac0('0x3f')](handleError(_0x228f1a,null));};exports[_0xcac0('0x44')]=function(_0x433777,_0x2e77d0){return db['MailMessage'][_0xcac0('0x44')]()['then'](respondWithResult(_0x2e77d0,null))['catch'](handleError(_0x2e77d0,null));};exports[_0xcac0('0x45')]=function(_0xea4f35,_0x346898){return db[_0xcac0('0x3a')][_0xcac0('0x45')](_0xea4f35['body'])[_0xcac0('0x1f')](function(_0x9405f6){if(_0x9405f6){if(_0x9405f6[_0xcac0('0x46')]==='out'&&!_0x9405f6[_0xcac0('0x47')]){var _0x3d69c0,_0x39755d,_0x8251c2;if(_0xea4f35[_0xcac0('0x43')]['to']){_0x39755d=_0xea4f35[_0xcac0('0x43')]['to'][_0xcac0('0x48')](',')[0x0];}return db[_0xcac0('0x49')][_0xcac0('0x4a')]({'where':{'id':_0x9405f6['MailAccountId']},'include':[{'model':db[_0xcac0('0x4b')],'as':'List','include':[{'model':db[_0xcac0('0x4c')],'as':_0xcac0('0x4d'),'where':{'email':_0x39755d},'limit':0x1,'order':[[_0xcac0('0x4e'),_0xcac0('0x4f')]]}]},{'model':db[_0xcac0('0x50')],'as':_0xcac0('0x51'),'raw':!![],'include':[{'model':db[_0xcac0('0x52')],'as':_0xcac0('0x52'),'raw':!![]}]}]})[_0xcac0('0x1f')](function(_0x15175a){_0x3d69c0=_0x15175a;if(!_0x3d69c0||!_0x3d69c0[_0xcac0('0x51')])return;var _0x23ac58=_0x3d69c0[_0xcac0('0x53')]();if(_0xea4f35[_0xcac0('0x43')][_0xcac0('0x54')]&&_0xea4f35['body'][_0xcac0('0x54')][_0xcac0('0x33')]){for(var _0x1d26af=0x0;_0x1d26af<_0xea4f35[_0xcac0('0x43')]['attachments'][_0xcac0('0x33')];_0x1d26af+=0x1){_0xea4f35[_0xcac0('0x43')][_0xcac0('0x54')][_0x1d26af]={'filename':_0xea4f35[_0xcac0('0x43')][_0xcac0('0x54')][_0x1d26af][_0xcac0('0x24')],'path':path[_0xcac0('0x55')](config['root'],_0xcac0('0x56'),_0xea4f35[_0xcac0('0x43')][_0xcac0('0x54')][_0x1d26af][_0xcac0('0x57')])};}}_0x8251c2={'account':_0x23ac58,'message':_0xea4f35[_0xcac0('0x43')]};return;})[_0xcac0('0x1f')](function(){if(_0x3d69c0['List']){if(_0x3d69c0[_0xcac0('0x58')][_0xcac0('0x4d')]['length']){return _0x3d69c0[_0xcac0('0x58')][_0xcac0('0x4d')][0x0];}else{return db[_0xcac0('0x4c')][_0xcac0('0x45')](_[_0xcac0('0x8')](_0xea4f35[_0xcac0('0x43')],{'firstName':_0xea4f35[_0xcac0('0x43')]['to'],'email':_0xea4f35[_0xcac0('0x43')]['to'],'phone':_0xea4f35['body']['to'],'ListId':_0x3d69c0[_0xcac0('0x59')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x8251c2){return respondWithRpcPromise(_0xcac0('0x5a'),_0xcac0('0x5b'),_0x8251c2,client9003)[_0xcac0('0x1f')](function(_0x27e960){return _0x9405f6['update']({'read':!![],'messageId':_0x27e960[_0xcac0('0x5c')],'sentAt':moment()[_0xcac0('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xcac0('0x3f')](function(_0x467832){logger[_0xcac0('0x14')]('%s',JSON[_0xcac0('0x13')](_0x467832));return _0x9405f6;});}return _0x9405f6;});}return _0x9405f6;}})[_0xcac0('0x1f')](respondWithResult(_0x346898,0xc9))[_0xcac0('0x3f')](handleError(_0x346898,null));};exports[_0xcac0('0x5e')]=function(_0x4fc3a3,_0x1038e0){var _0x530caf={'agent':{},'channel':_0xcac0('0x5f')};if(_0x4fc3a3[_0xcac0('0x43')]['id']){delete _0x4fc3a3[_0xcac0('0x43')]['id'];}_0x4fc3a3[_0xcac0('0x43')][_0xcac0('0x60')]=!![];_0x4fc3a3[_0xcac0('0x43')][_0xcac0('0x61')]=moment()[_0xcac0('0x5d')](_0xcac0('0x62'));_0x4fc3a3['body'][_0xcac0('0x63')]=_0x4fc3a3[_0xcac0('0x43')]['UserId']||_0x4fc3a3[_0xcac0('0x64')]['id'];_0x530caf[_0xcac0('0x65')]['id']=_0x4fc3a3[_0xcac0('0x43')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x4fc3a3[_0xcac0('0x41')]['id'],'UserId':null}})[_0xcac0('0x1f')](handleEntityNotFound(_0x1038e0,null))['then'](saveUpdates(_0x4fc3a3[_0xcac0('0x43')],null))[_0xcac0('0x1f')](function(_0x512f16){if(_0x512f16){_0x530caf[_0xcac0('0x17')]=_0x512f16[_0xcac0('0x66')]({'plain':!![]});return db[_0xcac0('0x67')][_0xcac0('0x42')]({'where':{'id':_0x512f16[_0xcac0('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1038e0,null))[_0xcac0('0x1f')](function(_0x168bfd){if(_0x168bfd){return _0x168bfd['update']({'UserId':_0x4fc3a3['body'][_0xcac0('0x63')],'read1stAt':_[_0xcac0('0x69')](_0x168bfd[_0xcac0('0x6a')])?moment()[_0xcac0('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xcac0('0x1f')](function(_0x4f7995){if(_0x4f7995){_0x530caf[_0xcac0('0x6b')]=_0x4f7995[_0xcac0('0x66')]({'plain':!![]});interaction_log[_0xcac0('0x18')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fc3a3[_0xcac0('0x64')]['id'],_0x4fc3a3[_0xcac0('0x64')]['name'],_0x4fc3a3['user']['role'],_0x530caf[_0xcac0('0x6b')]['id'],_0x4fc3a3[_0xcac0('0x43')]?JSON[_0xcac0('0x13')](_0x4fc3a3[_0xcac0('0x43')]):_0xcac0('0x6c'));return respondWithRpcPromise(_0xcac0('0x6d'),_0xcac0('0x6e'),_0x530caf);}return null;})['then'](function(_0x3707d7){var _0x756a41=_0xcac0('0x6f')+_0x3707d7[_0xcac0('0x17')][_0xcac0('0x70')];return db[_0xcac0('0x71')][_0xcac0('0x2d')](_0x756a41,{'type':db[_0xcac0('0x72')][_0xcac0('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x242a23){return _0x242a23;});})[_0xcac0('0x1f')](function(_0xa7a355){if(_0xa7a355){_0x530caf[_0xcac0('0x17')][_0xcac0('0x74')]=_0xa7a355[0x0];if(!_0x4fc3a3['body'][_0xcac0('0x63')])return;return db[_0xcac0('0x75')][_0xcac0('0x42')]({'where':{'id':_0x4fc3a3[_0xcac0('0x43')][_0xcac0('0x63')],'role':'agent'},'attributes':['id',_0xcac0('0x24'),_0xcac0('0x76'),'email',_0xcac0('0x77')],'raw':!![]});}return null;})['then'](function(_0x593f15){if(!_0x593f15)return null;_0x530caf[_0xcac0('0x17')][_0xcac0('0x65')]=_0x593f15;return _0x530caf;})['then'](function(_0x4d9a3d){if(_0x4d9a3d){if(_0x4fc3a3['body'][_0xcac0('0x78')]){_0x530caf[_0xcac0('0x17')][_0xcac0('0x79')]=util['format'](_0xcac0('0x7a'),_0x4fc3a3[_0xcac0('0x64')][_0xcac0('0x24')]);_0x530caf[_0xcac0('0x17')][_0xcac0('0x7b')]=_0x530caf[_0xcac0('0x7b')];_0x530caf[_0xcac0('0x17')][_0xcac0('0x7c')]=_0x530caf['channel'];_0x530caf[_0xcac0('0x17')]['event']='accept';_0x530caf['message']['body']=htmlToText[_0xcac0('0x7d')](_0x530caf[_0xcac0('0x17')][_0xcac0('0x43')]);return respondWithRpcPromise('EventManager',_0xcac0('0x7e'),{'event':_0xcac0('0x7f'),'message':_0x530caf[_0xcac0('0x17')]},client9002)[_0xcac0('0x1f')](function(){return _0x530caf;});}return _0x530caf;}return null;})['then'](respondWithResult(_0x1038e0,null))[_0xcac0('0x3f')](handleError(_0x1038e0,null));};exports[_0xcac0('0x80')]=function(_0x4e535b,_0x31cebb){var _0x2c8cdf={'agent':{},'channel':_0xcac0('0x5f')};if(_0x4e535b[_0xcac0('0x43')]['id']){delete _0x4e535b['body']['id'];}_0x4e535b[_0xcac0('0x43')][_0xcac0('0x63')]=_0x4e535b[_0xcac0('0x43')][_0xcac0('0x63')]||_0x4e535b[_0xcac0('0x64')]['id'];_0x2c8cdf['agent']['id']=_0x4e535b['body'][_0xcac0('0x63')];return db[_0xcac0('0x3a')][_0xcac0('0x42')]({'where':{'id':_0x4e535b[_0xcac0('0x41')]['id'],'UserId':null}})[_0xcac0('0x1f')](handleEntityNotFound(_0x31cebb,null))[_0xcac0('0x1f')](function(_0x41c3dd){if(_0x41c3dd){_0x2c8cdf[_0xcac0('0x17')]=_0x41c3dd[_0xcac0('0x66')]({'plain':!![]});return db[_0xcac0('0x67')]['find']({'where':{'id':_0x41c3dd[_0xcac0('0x68')]}});}return null;})[_0xcac0('0x1f')](handleEntityNotFound(_0x31cebb,null))[_0xcac0('0x1f')](function(_0x5a1e1d){if(_0x5a1e1d){_0x2c8cdf[_0xcac0('0x6b')]=_0x5a1e1d[_0xcac0('0x66')]({'plain':!![]});interaction_log['info'](_0xcac0('0x81'),_0x4e535b[_0xcac0('0x64')]['id'],_0x4e535b[_0xcac0('0x64')]['name'],_0x4e535b[_0xcac0('0x64')][_0xcac0('0x82')],_0x2c8cdf[_0xcac0('0x6b')]['id'],_0x4e535b[_0xcac0('0x43')]?JSON[_0xcac0('0x13')](_0x4e535b[_0xcac0('0x43')]):_0xcac0('0x6c'));return respondWithRpcPromise(_0xcac0('0x83'),_0xcac0('0x84'),_0x2c8cdf);}return null;})['then'](function(_0x4038c4){var _0x1b71c6=_0xcac0('0x6f')+_0x4038c4[_0xcac0('0x17')][_0xcac0('0x70')];return db[_0xcac0('0x71')][_0xcac0('0x2d')](_0x1b71c6,{'type':db['Sequelize'][_0xcac0('0x73')][_0xcac0('0x85')],'raw':!![]})[_0xcac0('0x1f')](function(_0x4488cd){return _0x4488cd;});})['then'](function(_0x383557){if(_0x383557){_0x2c8cdf['message'][_0xcac0('0x74')]=_0x383557[0x0];if(!_0x4e535b[_0xcac0('0x43')][_0xcac0('0x63')])return;return db[_0xcac0('0x75')]['find']({'where':{'id':_0x4e535b[_0xcac0('0x43')]['UserId'],'role':_0xcac0('0x65')},'attributes':['id',_0xcac0('0x24'),_0xcac0('0x76'),'email',_0xcac0('0x77')],'raw':!![]});}return null;})[_0xcac0('0x1f')](function(_0x1cbd2a){if(!_0x1cbd2a)return null;_0x2c8cdf['message'][_0xcac0('0x65')]=_0x1cbd2a;return _0x2c8cdf;})['then'](function(_0x282cf4){if(_0x282cf4){_0x282cf4['message'][_0xcac0('0x79')]=util['format']('SIP/%s',_0x4e535b[_0xcac0('0x64')][_0xcac0('0x24')]);_0x282cf4[_0xcac0('0x17')][_0xcac0('0x7b')]=_0x2c8cdf['channel'];_0x282cf4['message']['motionChannel']=_0x2c8cdf[_0xcac0('0x7b')];_0x282cf4[_0xcac0('0x17')]['event']=_0xcac0('0x80');_0x282cf4[_0xcac0('0x17')]['body']=htmlToText[_0xcac0('0x7d')](_0x2c8cdf[_0xcac0('0x17')][_0xcac0('0x43')]);respondWithRpcPromise('EventManager',_0xcac0('0x7e'),{'event':_0xcac0('0x86'),'message':_0x282cf4[_0xcac0('0x17')]},client9002);return _0x2c8cdf;}return null;})[_0xcac0('0x1f')](respondWithResult(_0x31cebb,null))[_0xcac0('0x3f')](handleError(_0x31cebb,null));};exports[_0xcac0('0x87')]=function(_0x16d9f6,_0x4f7e67){var _0x5298d1=moment()[_0xcac0('0x88')]()[_0xcac0('0x89')]();var _0x5eb7fa=path['join'](config[_0xcac0('0x8a')],_0xcac0('0x8b'),_0xcac0('0x8c'),_0xcac0('0x8d'));var _0x1a43db=path[_0xcac0('0x55')](config[_0xcac0('0x8a')],_0xcac0('0x8b'),_0xcac0('0x8c'),_0xcac0('0x54'));var _0x35f41c=util[_0xcac0('0x5d')](_0xcac0('0x8e'),_0x5298d1);return db[_0xcac0('0x3a')][_0xcac0('0x42')]({'where':{'id':_0x16d9f6[_0xcac0('0x41')]['id']},'attributes':['id','body','from','to','cc',_0xcac0('0x8f'),'subject',_0xcac0('0x90')],'include':_0x16d9f6[_0xcac0('0x2d')][_0xcac0('0x54')]?[{'model':db['Attachment'],'as':_0xcac0('0x91')}]:undefined})['then'](handleEntityNotFound(_0x4f7e67,null))[_0xcac0('0x1f')](function(_0x1a56e6){if(_0x1a56e6){var _0x7d9e4b=_0x1a56e6;var _0x4305a5={'from':_0x7d9e4b[_0xcac0('0x92')],'to':_0x7d9e4b['to'],'subject':_0x7d9e4b[_0xcac0('0x93')],'html':htmlEntities[_0xcac0('0x94')](_0x7d9e4b[_0xcac0('0x43')]),'headers':{'Date':moment(_0x7d9e4b['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1a56e6['cc']){_0x4305a5[_0xcac0('0x95')]['Cc']=_0x1a56e6['cc'];}if(_0x1a56e6[_0xcac0('0x8f')]){_0x4305a5[_0xcac0('0x95')][_0xcac0('0x96')]=_0x1a56e6[_0xcac0('0x8f')];}return new BPromise(function(_0x1a1d4c,_0x149988){if(_0x1a56e6['Attachments']){for(var _0x4ecfa2=0x0;_0x4ecfa2<_0x1a56e6['Attachments'][_0xcac0('0x33')];_0x4ecfa2++){var _0x3e6eb0=_0x1a56e6[_0xcac0('0x91')][_0x4ecfa2];var _0x1c1dbb=path['join'](_0x1a43db,_0x3e6eb0[_0xcac0('0x57')]);if(fs[_0xcac0('0x97')](_0x1c1dbb)){_0x4305a5[_0xcac0('0x54')][_0xcac0('0x98')]({'name':_0x3e6eb0[_0xcac0('0x24')],'contentType':_0x3e6eb0[_0xcac0('0x29')],'data':fs[_0xcac0('0x99')](_0x1c1dbb)});}}}emlformat['build'](_0x4305a5,function(_0x56416a,_0x4161da){if(_0x56416a)return _0x149988(_0x56416a);fs[_0xcac0('0x9a')](path[_0xcac0('0x55')](_0x5eb7fa,_0x35f41c),_0x4161da);return _0x1a1d4c(_0x4161da);});});}})[_0xcac0('0x1f')](function(_0x417310){if(_0x417310){return _0x4f7e67[_0xcac0('0x87')](path['join'](_0x5eb7fa,_0x35f41c),_0x35f41c,function(_0x10ae49){if(!_0x10ae49)fs[_0xcac0('0x9b')](path[_0xcac0('0x55')](_0x5eb7fa,_0x35f41c));});}})[_0xcac0('0x3f')](handleError(_0x4f7e67,null));}; \ No newline at end of file +var _0xa1db=['where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','intersection','find','body','params','describe','create','direction','out','split','MailAccount','MailAccountId','CmList','CmContact','Contacts','DESC','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','List','sendMail','messageId','format','accept','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','download','unix','toString','server','files','tmp','createdAt','Attachments','from','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','Bcc','existsSync','push','build','writeFileSync','eml-format','bluebird','util','html-to-text','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','html-entities','./mailMessage.socket','register','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','status','json','offset','undefined','limit','count','set','update','destroy','then','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa1db,0x188));var _0xba1d=function(_0x59726f,_0x12ca2b){_0x59726f=_0x59726f-0x0;var _0x261676=_0xa1db[_0x59726f];return _0x261676;};'use strict';var emlformat=require(_0xba1d('0x0'));var moment=require('moment');var BPromise=require(_0xba1d('0x1'));var util=require(_0xba1d('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xba1d('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xba1d('0x4'))(_0xba1d('0x5'));var interaction_log=require(_0xba1d('0x4'))('mail-interactions');var config=require(_0xba1d('0x6'));var db=require(_0xba1d('0x7'))['db'];config[_0xba1d('0x8')]=_[_0xba1d('0x9')](config[_0xba1d('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xba1d('0xa'));require(_0xba1d('0xb'))[_0xba1d('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0xba1d('0xd')]['http']({'port':0x232c});var client9003=jayson['client'][_0xba1d('0xe')]({'port':0x232b});var client9002=jayson[_0xba1d('0xd')][_0xba1d('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x29b676,_0x4a3c95,_0x5547a7,_0x2f300f){return new BPromise(function(_0x501415,_0x478a1a){var _0x874fc2=_0x2f300f||client;return _0x874fc2[_0xba1d('0xf')](_0x29b676,_0x5547a7)['then'](function(_0x28632b){logger[_0xba1d('0x10')]('MailMessage,\x20%s,\x20%s',_0x4a3c95,_0xba1d('0x11'));logger[_0xba1d('0x12')](_0xba1d('0x13'),_0x4a3c95,_0xba1d('0x11'),JSON[_0xba1d('0x14')](_0x28632b));if(_0x28632b[_0xba1d('0x15')]){if(_0x28632b['error']['code']===0x1f4){logger['error'](_0xba1d('0x16'),_0x4a3c95,_0x28632b[_0xba1d('0x15')][_0xba1d('0x17')]);return _0x478a1a(_0x28632b[_0xba1d('0x15')][_0xba1d('0x17')]);}logger[_0xba1d('0x15')](_0xba1d('0x16'),_0x4a3c95,_0x28632b['error'][_0xba1d('0x17')]);return _0x501415(_0x28632b[_0xba1d('0x15')][_0xba1d('0x17')]);}else{logger[_0xba1d('0x10')]('MailMessage,\x20%s,\x20%s',_0x4a3c95,_0xba1d('0x11'));_0x501415(_0x28632b['result'][_0xba1d('0x17')]);}})['catch'](function(_0x142909){logger['error'](_0xba1d('0x16'),_0x4a3c95,_0x142909);_0x478a1a(_0x142909);});});}function respondWithResult(_0x421fdd,_0x4ed9cb){_0x4ed9cb=_0x4ed9cb||0xc8;return function(_0x19c76f){if(_0x19c76f){return _0x421fdd[_0xba1d('0x18')](_0x4ed9cb)[_0xba1d('0x19')](_0x19c76f);}};}function respondWithFilteredResult(_0x57394d,_0x5e9295){return function(_0x379bee){if(_0x379bee){var _0x4ca8fd=typeof _0x5e9295[_0xba1d('0x1a')]===_0xba1d('0x1b')&&typeof _0x5e9295[_0xba1d('0x1c')]===_0xba1d('0x1b');var _0x34f88f=_0x379bee[_0xba1d('0x1d')];var _0x5368b9=_0x4ca8fd?0x0:_0x5e9295['offset'];var _0x383fb0=_0x4ca8fd?_0x379bee[_0xba1d('0x1d')]:_0x5e9295[_0xba1d('0x1a')]+_0x5e9295['limit'];var _0x503d37;if(_0x383fb0>=_0x34f88f){_0x383fb0=_0x34f88f;_0x503d37=0xc8;}else{_0x503d37=0xce;}_0x57394d[_0xba1d('0x18')](_0x503d37);return _0x57394d[_0xba1d('0x1e')]('Content-Range',_0x5368b9+'-'+_0x383fb0+'/'+_0x34f88f)['json'](_0x379bee);}return null;};}function saveUpdates(_0x215c8c){return function(_0x5a6caf){if(_0x5a6caf){return _0x5a6caf[_0xba1d('0x1f')](_0x215c8c)['then'](function(_0x13d9bf){return _0x13d9bf;});}return null;};}function removeEntity(_0x335072){return function(_0x38896b){if(_0x38896b){return _0x38896b[_0xba1d('0x20')]()[_0xba1d('0x21')](function(){_0x335072[_0xba1d('0x18')](0xcc)[_0xba1d('0x22')]();});}};}function handleEntityNotFound(_0x45cbe9){return function(_0x1dd3de){if(!_0x1dd3de){_0x45cbe9[_0xba1d('0x23')](0x194);}return _0x1dd3de;};}function handleError(_0x50e59c,_0x2e3bf6){_0x2e3bf6=_0x2e3bf6||0x1f4;return function(_0x120224){logger['error'](_0x120224[_0xba1d('0x24')]);if(_0x120224[_0xba1d('0x25')]){delete _0x120224['name'];}_0x50e59c[_0xba1d('0x18')](_0x2e3bf6)[_0xba1d('0x26')](_0x120224);};}exports[_0xba1d('0x27')]=function(_0x373975,_0x36f66b){var _0x612084={},_0x3c06d2={},_0x3ac4d5={'count':0x0,'rows':[]};var _0x508124=_[_0xba1d('0x28')](db[_0xba1d('0x29')][_0xba1d('0x2a')],function(_0x15fcd4){return{'name':_0x15fcd4[_0xba1d('0x2b')],'type':_0x15fcd4[_0xba1d('0x2c')]['key']};});_0x3c06d2[_0xba1d('0x2d')]=_[_0xba1d('0x28')](_0x508124,_0xba1d('0x25'));_0x3c06d2[_0xba1d('0x2e')]=_[_0xba1d('0x2f')](_0x373975[_0xba1d('0x2e')]);_0x3c06d2[_0xba1d('0x30')]=_['intersection'](_0x3c06d2[_0xba1d('0x2d')],_0x3c06d2[_0xba1d('0x2e')]);_0x612084[_0xba1d('0x31')]=_['intersection'](_0x3c06d2['model'],qs['fields'](_0x373975[_0xba1d('0x2e')][_0xba1d('0x32')]));_0x612084[_0xba1d('0x31')]=_0x612084['attributes'][_0xba1d('0x33')]?_0x612084[_0xba1d('0x31')]:_0x3c06d2[_0xba1d('0x2d')];if(!_0x373975[_0xba1d('0x2e')][_0xba1d('0x34')]('nolimit')){_0x612084[_0xba1d('0x1c')]=qs[_0xba1d('0x1c')](_0x373975[_0xba1d('0x2e')][_0xba1d('0x1c')]);_0x612084[_0xba1d('0x1a')]=qs[_0xba1d('0x1a')](_0x373975[_0xba1d('0x2e')]['offset']);}_0x612084[_0xba1d('0x35')]=qs[_0xba1d('0x36')](_0x373975[_0xba1d('0x2e')]['sort']);_0x612084[_0xba1d('0x37')]=qs['filters'](_[_0xba1d('0x38')](_0x373975[_0xba1d('0x2e')],_0x3c06d2[_0xba1d('0x30')]),_0x508124);if(_0x373975[_0xba1d('0x2e')][_0xba1d('0x39')]){_0x612084[_0xba1d('0x37')]=_['merge'](_0x612084['where'],{'$or':_[_0xba1d('0x28')](_0x508124,function(_0x16378b){if(_0x16378b[_0xba1d('0x2c')]!=='VIRTUAL'){var _0x1beaa8={};_0x1beaa8[_0x16378b[_0xba1d('0x25')]]={'$like':'%'+_0x373975[_0xba1d('0x2e')][_0xba1d('0x39')]+'%'};return _0x1beaa8;}})});}_0x612084=_[_0xba1d('0x3a')]({},_0x612084,_0x373975[_0xba1d('0x3b')]);var _0x1b9730={'where':_0x612084['where']};return db['MailMessage'][_0xba1d('0x1d')](_0x1b9730)[_0xba1d('0x21')](function(_0x2ccf37){_0x3ac4d5[_0xba1d('0x1d')]=_0x2ccf37;if(_0x373975[_0xba1d('0x2e')][_0xba1d('0x3c')]){_0x612084[_0xba1d('0x3d')]=[{'all':!![]}];}return db['MailMessage'][_0xba1d('0x3e')](_0x612084);})[_0xba1d('0x21')](function(_0x304c6a){_0x3ac4d5[_0xba1d('0x3f')]=_0x304c6a;return _0x3ac4d5;})['then'](respondWithFilteredResult(_0x36f66b,_0x612084))[_0xba1d('0x40')](handleError(_0x36f66b,null));};exports[_0xba1d('0x41')]=function(_0x317c2f,_0x18ab12){var _0x2c0c2d={'raw':!![],'where':{'id':_0x317c2f['params']['id']}},_0x535d91={};_0x535d91[_0xba1d('0x2d')]=_['keys'](db[_0xba1d('0x29')][_0xba1d('0x2a')]);_0x535d91[_0xba1d('0x2e')]=_['keys'](_0x317c2f[_0xba1d('0x2e')]);_0x535d91[_0xba1d('0x30')]=_[_0xba1d('0x42')](_0x535d91['model'],_0x535d91[_0xba1d('0x2e')]);_0x2c0c2d[_0xba1d('0x31')]=_[_0xba1d('0x42')](_0x535d91[_0xba1d('0x2d')],qs['fields'](_0x317c2f[_0xba1d('0x2e')]['fields']));_0x2c0c2d['attributes']=_0x2c0c2d[_0xba1d('0x31')][_0xba1d('0x33')]?_0x2c0c2d[_0xba1d('0x31')]:_0x535d91[_0xba1d('0x2d')];if(_0x317c2f[_0xba1d('0x2e')][_0xba1d('0x3c')]){_0x2c0c2d[_0xba1d('0x3d')]=[{'all':!![]}];}_0x2c0c2d=_[_0xba1d('0x3a')]({},_0x2c0c2d,_0x317c2f['options']);return db[_0xba1d('0x29')][_0xba1d('0x43')](_0x2c0c2d)[_0xba1d('0x21')](handleEntityNotFound(_0x18ab12,null))[_0xba1d('0x21')](respondWithResult(_0x18ab12,null))[_0xba1d('0x40')](handleError(_0x18ab12,null));};exports['update']=function(_0x4f4f5b,_0x1154b6){if(_0x4f4f5b[_0xba1d('0x44')]['id']){delete _0x4f4f5b[_0xba1d('0x44')]['id'];}return db[_0xba1d('0x29')][_0xba1d('0x43')]({'where':{'id':_0x4f4f5b[_0xba1d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1154b6,null))['then'](saveUpdates(_0x4f4f5b[_0xba1d('0x44')],null))[_0xba1d('0x21')](respondWithResult(_0x1154b6,null))[_0xba1d('0x40')](handleError(_0x1154b6,null));};exports['destroy']=function(_0x42ce71,_0x1b3c57){return db[_0xba1d('0x29')]['find']({'where':{'id':_0x42ce71[_0xba1d('0x45')]['id']}})[_0xba1d('0x21')](handleEntityNotFound(_0x1b3c57,null))[_0xba1d('0x21')](removeEntity(_0x1b3c57,null))[_0xba1d('0x40')](handleError(_0x1b3c57,null));};exports[_0xba1d('0x46')]=function(_0x2f876a,_0x493df6){return db['MailMessage'][_0xba1d('0x46')]()[_0xba1d('0x21')](respondWithResult(_0x493df6,null))['catch'](handleError(_0x493df6,null));};exports[_0xba1d('0x47')]=function(_0x38fb66,_0xf47355){return db[_0xba1d('0x29')][_0xba1d('0x47')](_0x38fb66[_0xba1d('0x44')])[_0xba1d('0x21')](function(_0xc8fd24){if(_0xc8fd24){if(_0xc8fd24[_0xba1d('0x48')]===_0xba1d('0x49')&&!_0xc8fd24['secret']){var _0x7f6fa,_0x77c94a,_0x34fcac;if(_0x38fb66[_0xba1d('0x44')]['to']){_0x77c94a=_0x38fb66[_0xba1d('0x44')]['to'][_0xba1d('0x4a')](',')[0x0];}return db[_0xba1d('0x4b')]['findOne']({'where':{'id':_0xc8fd24[_0xba1d('0x4c')]},'include':[{'model':db[_0xba1d('0x4d')],'as':'List','include':[{'model':db[_0xba1d('0x4e')],'as':_0xba1d('0x4f'),'where':{'email':_0x77c94a},'limit':0x1,'order':[['updatedAt',_0xba1d('0x50')]]}]},{'model':db['MailServerOut'],'as':_0xba1d('0x51'),'raw':!![],'include':[{'model':db[_0xba1d('0x52')],'as':_0xba1d('0x52'),'raw':!![]}]}]})[_0xba1d('0x21')](function(_0x45d5c4){_0x7f6fa=_0x45d5c4;if(!_0x7f6fa||!_0x7f6fa[_0xba1d('0x51')])return;var _0x3a10ca=_0x7f6fa['getSmtpOptions']();if(_0x38fb66[_0xba1d('0x44')][_0xba1d('0x53')]&&_0x38fb66['body'][_0xba1d('0x53')][_0xba1d('0x33')]){for(var _0x18a31f=0x0;_0x18a31f<_0x38fb66['body'][_0xba1d('0x53')][_0xba1d('0x33')];_0x18a31f+=0x1){_0x38fb66[_0xba1d('0x44')][_0xba1d('0x53')][_0x18a31f]={'filename':_0x38fb66[_0xba1d('0x44')][_0xba1d('0x53')][_0x18a31f][_0xba1d('0x25')],'path':path[_0xba1d('0x54')](config[_0xba1d('0x55')],_0xba1d('0x56'),_0x38fb66[_0xba1d('0x44')][_0xba1d('0x53')][_0x18a31f][_0xba1d('0x57')])};}}_0x34fcac={'account':_0x3a10ca,'message':_0x38fb66[_0xba1d('0x44')]};return;})['then'](function(){if(_0x7f6fa[_0xba1d('0x58')]){if(_0x7f6fa[_0xba1d('0x58')][_0xba1d('0x4f')][_0xba1d('0x33')]){return _0x7f6fa[_0xba1d('0x58')]['Contacts'][0x0];}else{return db[_0xba1d('0x4e')][_0xba1d('0x47')](_['defaults'](_0x38fb66[_0xba1d('0x44')],{'firstName':_0x38fb66[_0xba1d('0x44')]['to'],'email':_0x38fb66[_0xba1d('0x44')]['to'],'phone':_0x38fb66[_0xba1d('0x44')]['to'],'ListId':_0x7f6fa['ListId']}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x34fcac){return respondWithRpcPromise('SendMail',_0xba1d('0x59'),_0x34fcac,client9003)[_0xba1d('0x21')](function(_0x5bab1a){return _0xc8fd24[_0xba1d('0x1f')]({'read':!![],'messageId':_0x5bab1a[_0xba1d('0x5a')],'sentAt':moment()[_0xba1d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xba1d('0x40')](function(_0x20056f){logger[_0xba1d('0x15')]('%s',JSON[_0xba1d('0x14')](_0x20056f));return _0xc8fd24;});}return _0xc8fd24;});}return _0xc8fd24;}})['then'](respondWithResult(_0xf47355,0xc9))[_0xba1d('0x40')](handleError(_0xf47355,null));};exports[_0xba1d('0x5c')]=function(_0x18c956,_0x5ec234){var _0x6ea32e={'agent':{},'channel':_0xba1d('0x5d')};if(_0x18c956['body']['id']){delete _0x18c956[_0xba1d('0x44')]['id'];}_0x18c956[_0xba1d('0x44')]['read']=!![];_0x18c956[_0xba1d('0x44')][_0xba1d('0x5e')]=moment()[_0xba1d('0x5b')](_0xba1d('0x5f'));_0x18c956[_0xba1d('0x44')]['UserId']=_0x18c956[_0xba1d('0x44')][_0xba1d('0x60')]||_0x18c956[_0xba1d('0x61')]['id'];_0x6ea32e['agent']['id']=_0x18c956['body'][_0xba1d('0x60')];return db[_0xba1d('0x29')][_0xba1d('0x43')]({'where':{'id':_0x18c956[_0xba1d('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ec234,null))[_0xba1d('0x21')](saveUpdates(_0x18c956[_0xba1d('0x44')],null))['then'](function(_0x178381){if(_0x178381){_0x6ea32e[_0xba1d('0x17')]=_0x178381[_0xba1d('0x62')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x178381[_0xba1d('0x63')]}});}return null;})[_0xba1d('0x21')](handleEntityNotFound(_0x5ec234,null))[_0xba1d('0x21')](function(_0x429065){if(_0x429065){return _0x429065[_0xba1d('0x1f')]({'UserId':_0x18c956[_0xba1d('0x44')]['UserId'],'read1stAt':_[_0xba1d('0x64')](_0x429065[_0xba1d('0x65')])?moment()[_0xba1d('0x5b')](_0xba1d('0x5f')):undefined});}return null;})[_0xba1d('0x21')](function(_0x1368d0){if(_0x1368d0){_0x6ea32e['interaction']=_0x1368d0[_0xba1d('0x62')]({'plain':!![]});interaction_log['info'](_0xba1d('0x66'),_0x18c956['user']['id'],_0x18c956[_0xba1d('0x61')][_0xba1d('0x25')],_0x18c956['user']['role'],_0x6ea32e['interaction']['id'],_0x18c956['body']?JSON[_0xba1d('0x14')](_0x18c956['body']):_0xba1d('0x67'));return respondWithRpcPromise(_0xba1d('0x68'),_0xba1d('0x69'),_0x6ea32e);}return null;})[_0xba1d('0x21')](function(_0x339ffc){var _0x331e2d=_0xba1d('0x6a')+_0x339ffc[_0xba1d('0x17')][_0xba1d('0x6b')];return db[_0xba1d('0x6c')][_0xba1d('0x2e')](_0x331e2d,{'type':db[_0xba1d('0x6d')][_0xba1d('0x6e')][_0xba1d('0x6f')],'raw':!![]})[_0xba1d('0x21')](function(_0x2a6eeb){return _0x2a6eeb;});})[_0xba1d('0x21')](function(_0x34a7c1){if(_0x34a7c1){_0x6ea32e['message'][_0xba1d('0x70')]=_0x34a7c1[0x0];if(!_0x18c956[_0xba1d('0x44')][_0xba1d('0x60')])return;return db[_0xba1d('0x71')][_0xba1d('0x43')]({'where':{'id':_0x18c956[_0xba1d('0x44')][_0xba1d('0x60')],'role':_0xba1d('0x72')},'attributes':['id',_0xba1d('0x25'),_0xba1d('0x73'),_0xba1d('0x74'),_0xba1d('0x75')],'raw':!![]});}return null;})['then'](function(_0x933eb6){if(!_0x933eb6)return null;_0x6ea32e[_0xba1d('0x17')][_0xba1d('0x72')]=_0x933eb6;return _0x6ea32e;})[_0xba1d('0x21')](function(_0x5dd443){if(_0x5dd443){if(_0x18c956[_0xba1d('0x44')][_0xba1d('0x76')]){_0x6ea32e[_0xba1d('0x17')][_0xba1d('0x77')]=util[_0xba1d('0x5b')](_0xba1d('0x78'),_0x18c956[_0xba1d('0x61')][_0xba1d('0x25')]);_0x6ea32e['message'][_0xba1d('0x79')]=_0x6ea32e[_0xba1d('0x79')];_0x6ea32e[_0xba1d('0x17')]['motionChannel']=_0x6ea32e[_0xba1d('0x79')];_0x6ea32e[_0xba1d('0x17')]['event']=_0xba1d('0x5c');_0x6ea32e['message'][_0xba1d('0x44')]=htmlToText[_0xba1d('0x7a')](_0x6ea32e['message'][_0xba1d('0x44')]);return respondWithRpcPromise('EventManager',_0xba1d('0x7b'),{'event':_0xba1d('0x7c'),'message':_0x6ea32e[_0xba1d('0x17')]},client9002)['then'](function(){return _0x6ea32e;});}return _0x6ea32e;}return null;})[_0xba1d('0x21')](respondWithResult(_0x5ec234,null))[_0xba1d('0x40')](handleError(_0x5ec234,null));};exports[_0xba1d('0x7d')]=function(_0x336df8,_0xe88fdc){var _0x1bde0a={'agent':{},'channel':'mail'};if(_0x336df8['body']['id']){delete _0x336df8[_0xba1d('0x44')]['id'];}_0x336df8['body'][_0xba1d('0x60')]=_0x336df8[_0xba1d('0x44')][_0xba1d('0x60')]||_0x336df8[_0xba1d('0x61')]['id'];_0x1bde0a[_0xba1d('0x72')]['id']=_0x336df8[_0xba1d('0x44')][_0xba1d('0x60')];return db[_0xba1d('0x29')]['find']({'where':{'id':_0x336df8[_0xba1d('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe88fdc,null))[_0xba1d('0x21')](function(_0x1a49e2){if(_0x1a49e2){_0x1bde0a[_0xba1d('0x17')]=_0x1a49e2['get']({'plain':!![]});return db[_0xba1d('0x7e')][_0xba1d('0x43')]({'where':{'id':_0x1a49e2[_0xba1d('0x63')]}});}return null;})[_0xba1d('0x21')](handleEntityNotFound(_0xe88fdc,null))[_0xba1d('0x21')](function(_0x56cf95){if(_0x56cf95){_0x1bde0a['interaction']=_0x56cf95[_0xba1d('0x62')]({'plain':!![]});interaction_log[_0xba1d('0x10')](_0xba1d('0x7f'),_0x336df8[_0xba1d('0x61')]['id'],_0x336df8[_0xba1d('0x61')][_0xba1d('0x25')],_0x336df8['user'][_0xba1d('0x80')],_0x1bde0a['interaction']['id'],_0x336df8[_0xba1d('0x44')]?JSON[_0xba1d('0x14')](_0x336df8['body']):'null');return respondWithRpcPromise(_0xba1d('0x81'),'rejectMessage',_0x1bde0a);}return null;})[_0xba1d('0x21')](function(_0x4c2113){var _0x1b12a4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c2113[_0xba1d('0x17')][_0xba1d('0x6b')];return db[_0xba1d('0x6c')]['query'](_0x1b12a4,{'type':db[_0xba1d('0x6d')][_0xba1d('0x6e')][_0xba1d('0x6f')],'raw':!![]})[_0xba1d('0x21')](function(_0x1183ff){return _0x1183ff;});})[_0xba1d('0x21')](function(_0x3a28e0){if(_0x3a28e0){_0x1bde0a[_0xba1d('0x17')]['contact']=_0x3a28e0[0x0];if(!_0x336df8['body'][_0xba1d('0x60')])return;return db[_0xba1d('0x71')][_0xba1d('0x43')]({'where':{'id':_0x336df8[_0xba1d('0x44')][_0xba1d('0x60')],'role':'agent'},'attributes':['id',_0xba1d('0x25'),_0xba1d('0x73'),_0xba1d('0x74'),'internal'],'raw':!![]});}return null;})[_0xba1d('0x21')](function(_0x24b2db){if(!_0x24b2db)return null;_0x1bde0a[_0xba1d('0x17')][_0xba1d('0x72')]=_0x24b2db;return _0x1bde0a;})['then'](function(_0x7f603d){if(_0x7f603d){_0x7f603d[_0xba1d('0x17')][_0xba1d('0x77')]=util[_0xba1d('0x5b')](_0xba1d('0x78'),_0x336df8[_0xba1d('0x61')][_0xba1d('0x25')]);_0x7f603d[_0xba1d('0x17')]['channel']=_0x1bde0a[_0xba1d('0x79')];_0x7f603d['message']['motionChannel']=_0x1bde0a[_0xba1d('0x79')];_0x7f603d[_0xba1d('0x17')]['event']='reject';_0x7f603d[_0xba1d('0x17')][_0xba1d('0x44')]=htmlToText[_0xba1d('0x7a')](_0x1bde0a[_0xba1d('0x17')][_0xba1d('0x44')]);respondWithRpcPromise(_0xba1d('0x7b'),_0xba1d('0x7b'),{'event':_0xba1d('0x82'),'message':_0x7f603d['message']},client9002);return _0x1bde0a;}return null;})[_0xba1d('0x21')](respondWithResult(_0xe88fdc,null))[_0xba1d('0x40')](handleError(_0xe88fdc,null));};exports[_0xba1d('0x83')]=function(_0x1ae231,_0x4ea2d3){var _0x179746=moment()[_0xba1d('0x84')]()[_0xba1d('0x85')]();var _0x1f411e=path[_0xba1d('0x54')](config[_0xba1d('0x55')],_0xba1d('0x86'),_0xba1d('0x87'),_0xba1d('0x88'));var _0x4f2e8a=path[_0xba1d('0x54')](config[_0xba1d('0x55')],_0xba1d('0x86'),_0xba1d('0x87'),_0xba1d('0x53'));var _0x38567a=util[_0xba1d('0x5b')]('message-%s.eml',_0x179746);return db[_0xba1d('0x29')][_0xba1d('0x43')]({'where':{'id':_0x1ae231[_0xba1d('0x45')]['id']},'attributes':['id',_0xba1d('0x44'),'from','to','cc','bcc','subject',_0xba1d('0x89')],'include':_0x1ae231[_0xba1d('0x2e')][_0xba1d('0x53')]?[{'model':db['Attachment'],'as':_0xba1d('0x8a')}]:undefined})[_0xba1d('0x21')](handleEntityNotFound(_0x4ea2d3,null))[_0xba1d('0x21')](function(_0x2ec516){if(_0x2ec516){var _0x2095b5=_0x2ec516;var _0x404bf3={'from':_0x2095b5[_0xba1d('0x8b')],'to':_0x2095b5['to'],'subject':_0x2095b5[_0xba1d('0x8c')],'html':htmlEntities[_0xba1d('0x8d')](_0x2095b5['body']),'headers':{'Date':moment(_0x2095b5[_0xba1d('0x89')])[_0xba1d('0x5b')](_0xba1d('0x8e'))},'attachments':[]};if(_0x2ec516['cc']){_0x404bf3['headers']['Cc']=_0x2ec516['cc'];}if(_0x2ec516[_0xba1d('0x8f')]){_0x404bf3['headers'][_0xba1d('0x90')]=_0x2ec516[_0xba1d('0x8f')];}return new BPromise(function(_0x9add08,_0x8968c5){if(_0x2ec516[_0xba1d('0x8a')]){for(var _0x320885=0x0;_0x320885<_0x2ec516[_0xba1d('0x8a')][_0xba1d('0x33')];_0x320885++){var _0x4a98d0=_0x2ec516['Attachments'][_0x320885];var _0x2cb226=path[_0xba1d('0x54')](_0x4f2e8a,_0x4a98d0['basename']);if(fs[_0xba1d('0x91')](_0x2cb226)){_0x404bf3['attachments'][_0xba1d('0x92')]({'name':_0x4a98d0['name'],'contentType':_0x4a98d0[_0xba1d('0x2c')],'data':fs['readFileSync'](_0x2cb226)});}}}emlformat[_0xba1d('0x93')](_0x404bf3,function(_0x45cc65,_0x547dcb){if(_0x45cc65)return _0x8968c5(_0x45cc65);fs[_0xba1d('0x94')](path['join'](_0x1f411e,_0x38567a),_0x547dcb);return _0x9add08(_0x547dcb);});});}})['then'](function(_0x5df5d5){if(_0x5df5d5){return _0x4ea2d3[_0xba1d('0x83')](path[_0xba1d('0x54')](_0x1f411e,_0x38567a),_0x38567a,function(_0x5a42c2){if(!_0x5a42c2)fs['unlinkSync'](path[_0xba1d('0x54')](_0x1f411e,_0x38567a));});}})[_0xba1d('0x40')](handleError(_0x4ea2d3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d426fd7..cf2e59a 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 _0x1012=['emit','hasOwnProperty','exports','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x1daff0,_0x27acfa){var _0xc3e54f=function(_0x1c2edb){while(--_0x1c2edb){_0x1daff0['push'](_0x1daff0['shift']());}};_0xc3e54f(++_0x27acfa);}(_0x1012,0xea));var _0x2101=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x1012[_0x1762b4];return _0x29beda;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x2101('0x0'))['db'][_0x2101('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2101('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2101('0x3'),'afterDestroy':'remove'};function emitEvent(_0x49b322){return function(_0xac1ec7,_0x1f3843,_0xda5402){MailMessageEvents[_0x2101('0x4')](_0x49b322+':'+_0xac1ec7['id'],_0xac1ec7);MailMessageEvents[_0x2101('0x4')](_0x49b322,_0xac1ec7);_0xda5402(null);};}for(var e in events){if(events[_0x2101('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x2101('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x80ec=['save','remove','emit','hasOwnProperty','exports','MailMessage','setMaxListeners'];(function(_0x2f7d4e,_0x5bd858){var _0x44d964=function(_0x3fe691){while(--_0x3fe691){_0x2f7d4e['push'](_0x2f7d4e['shift']());}};_0x44d964(++_0x5bd858);}(_0x80ec,0xad));var _0xc80e=function(_0x333478,_0x157211){_0x333478=_0x333478-0x0;var _0x3ddecb=_0x80ec[_0x333478];return _0x3ddecb;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0xc80e('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc80e('0x1')](0x0);var events={'afterCreate':_0xc80e('0x2'),'afterUpdate':'update','afterDestroy':_0xc80e('0x3')};function emitEvent(_0x3ca9c1){return function(_0x424ac3,_0x57383e,_0x218fb4){MailMessageEvents['emit'](_0x3ca9c1+':'+_0x424ac3['id'],_0x424ac3);MailMessageEvents[_0xc80e('0x4')](_0x3ca9c1,_0x424ac3);_0x218fb4(null);};}for(var e in events){if(events[_0xc80e('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc80e('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b0efb40..7bd489c 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 _0xd0ad=['path','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','direction','toLowerCase','secret','isNil','UserId','MailInteraction','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','html-to-text'];(function(_0xbb2e58,_0x1fe145){var _0x2f0d91=function(_0x331b3c){while(--_0x331b3c){_0xbb2e58['push'](_0xbb2e58['shift']());}};_0x2f0d91(++_0x1fe145);}(_0xd0ad,0x6e));var _0xdd0a=function(_0x5d7f88,_0x563dd7){_0x5d7f88=_0x5d7f88-0x0;var _0x502eaf=_0xd0ad[_0x5d7f88];return _0x502eaf;};'use strict';var _=require(_0xdd0a('0x0'));var util=require(_0xdd0a('0x1'));var logger=require('../../config/logger')(_0xdd0a('0x2'));var moment=require('moment');var BPromise=require(_0xdd0a('0x3'));var rp=require(_0xdd0a('0x4'));var htmlToText=require(_0xdd0a('0x5'));var fs=require('fs');var path=require(_0xdd0a('0x6'));var rimraf=require('rimraf');var config=require(_0xdd0a('0x7'));var attributes=require('./mailMessage.attributes');module[_0xdd0a('0x8')]=function(_0x450c36,_0x5ceab1){return _0x450c36[_0xdd0a('0x9')](_0xdd0a('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xdd0a('0xb'),'fields':[_0xdd0a('0xb')]},{'name':_0xdd0a('0xc'),'fields':[_0xdd0a('0xd'),_0xdd0a('0xe')],'type':_0xdd0a('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28e989,_0x5e3642,_0x2a3bf9){if(_0x28e989[_0xdd0a('0x10')]){_0x28e989[_0xdd0a('0xd')]=htmlToText[_0xdd0a('0x11')](_0x28e989[_0xdd0a('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2a3bf9(null,_0x5e3642);},'afterCreate':function(_0x2677d1,_0x1ded1e,_0x1908b5){var _0x530643=_0x450c36['models'];var _0x11e9b1=_0x2677d1['get']({'plain':!![]});if(_0x11e9b1[_0xdd0a('0x12')][_0xdd0a('0x13')]()==='in'||_0x11e9b1[_0xdd0a('0x12')][_0xdd0a('0x13')]()==='out'&&!_0x11e9b1[_0xdd0a('0x14')]&&!_[_0xdd0a('0x15')](_0x11e9b1[_0xdd0a('0x16')])){_0x530643[_0xdd0a('0x17')]['findOne']({'where':{'id':_0x11e9b1['MailInteractionId']}})[_0xdd0a('0x18')](function(_0x59dec7){if(_0x59dec7){_0x59dec7['update']({'lastMsgAt':_0x11e9b1[_0xdd0a('0x19')],'lastMsgDirection':_0x11e9b1[_0xdd0a('0x12')][_0xdd0a('0x13')]()});}})['catch'](function(_0x165693){console[_0xdd0a('0x1a')](_0x165693);});}_0x1908b5();}},'charset':_0xdd0a('0x1b'),'collate':_0xdd0a('0x1c')});}; \ No newline at end of file +var _0x9ad0=['MailInteraction','findOne','MailInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9ad0,0x152));var _0x09ad=function(_0x5cb802,_0x37c064){_0x5cb802=_0x5cb802-0x0;var _0x596393=_0x9ad0[_0x5cb802];return _0x596393;};'use strict';var _=require(_0x09ad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x09ad('0x1'));var moment=require(_0x09ad('0x2'));var BPromise=require(_0x09ad('0x3'));var rp=require(_0x09ad('0x4'));var htmlToText=require(_0x09ad('0x5'));var fs=require('fs');var path=require(_0x09ad('0x6'));var rimraf=require(_0x09ad('0x7'));var config=require(_0x09ad('0x8'));var attributes=require(_0x09ad('0x9'));module['exports']=function(_0x5de086,_0x404165){return _0x5de086[_0x09ad('0xa')]('MailMessage',attributes,{'tableName':_0x09ad('0xb'),'paranoid':![],'indexes':[{'name':_0x09ad('0xc'),'fields':['messageId']},{'name':_0x09ad('0xd'),'fields':[_0x09ad('0xe'),_0x09ad('0xf')],'type':_0x09ad('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x30fa12,_0x506a36,_0x512633){if(_0x30fa12['body']){_0x30fa12[_0x09ad('0xe')]=htmlToText['fromString'](_0x30fa12['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x512633(null,_0x506a36);},'afterCreate':function(_0x1f275a,_0x2a730f,_0x3cdeb5){var _0x317f1a=_0x5de086[_0x09ad('0x11')];var _0x396439=_0x1f275a[_0x09ad('0x12')]({'plain':!![]});if(_0x396439['direction'][_0x09ad('0x13')]()==='in'||_0x396439[_0x09ad('0x14')][_0x09ad('0x13')]()===_0x09ad('0x15')&&!_0x396439[_0x09ad('0x16')]&&!_[_0x09ad('0x17')](_0x396439[_0x09ad('0x18')])){_0x317f1a[_0x09ad('0x19')][_0x09ad('0x1a')]({'where':{'id':_0x396439[_0x09ad('0x1b')]}})[_0x09ad('0x1c')](function(_0x5cdc49){if(_0x5cdc49){_0x5cdc49['update']({'lastMsgAt':_0x396439[_0x09ad('0x1d')],'lastMsgDirection':_0x396439['direction'][_0x09ad('0x13')]()});}})[_0x09ad('0x1e')](function(_0x33a19c){console['error'](_0x33a19c);});}_0x3cdeb5();}},'charset':_0x09ad('0x1f'),'collate':_0x09ad('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ea46195..bcdfe90 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 _0x583c=['request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x22c415,_0x273b84){var _0x3ef055=function(_0x5ef923){while(--_0x5ef923){_0x22c415['push'](_0x22c415['shift']());}};_0x3ef055(++_0x273b84);}(_0x583c,0x12b));var _0xc583=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x583c[_0x4169d8];return _0x32084a;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});config[_0xc583('0xa')]=_[_0xc583('0xb')](config['redis'],{'host':_0xc583('0xc'),'port':0x18eb});var socket=require(_0xc583('0xd'))(new Redis(config['redis']));require(_0xc583('0xe'))[_0xc583('0xf')](socket);function respondWithRpcPromise(_0x25f8d3,_0xb23f07,_0x2d99ca){return new BPromise(function(_0x550b1e,_0x3437be){return client[_0xc583('0x10')](_0x25f8d3,_0x2d99ca)['then'](function(_0x23c51a){logger[_0xc583('0x11')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0xc583('0x12'));logger[_0xc583('0x13')](_0xc583('0x14'),_0xb23f07,_0xc583('0x12'),JSON[_0xc583('0x15')](_0x23c51a));if(_0x23c51a[_0xc583('0x16')]){if(_0x23c51a[_0xc583('0x16')][_0xc583('0x17')]===0x1f4){logger[_0xc583('0x16')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x3437be(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}logger['error'](_0xc583('0x19'),_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x550b1e(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}else{logger['info'](_0xc583('0x19'),_0xb23f07,_0xc583('0x12'));_0x550b1e(_0x23c51a[_0xc583('0x1a')][_0xc583('0x18')]);}})['catch'](function(_0x3dd3cc){logger['error'](_0xc583('0x19'),_0xb23f07,_0x3dd3cc);_0x3437be(_0x3dd3cc);});});}exports[_0xc583('0x1b')]=function(_0xfd9a60){var _0x774f4c=this;return new Promise(function(_0x1052b5,_0x12b910){return db[_0xc583('0x1c')][_0xc583('0x1d')](_0xfd9a60[_0xc583('0x1e')],{'raw':_0xfd9a60[_0xc583('0x1f')]?_0xfd9a60[_0xc583('0x1f')][_0xc583('0x20')]===undefined?!![]:![]:!![]})[_0xc583('0x21')](function(_0x478ee1){logger['info'](_0xc583('0x1b'),_0xfd9a60);logger[_0xc583('0x13')](_0xc583('0x1b'),_0xfd9a60,JSON['stringify'](_0x478ee1));_0x1052b5(_0x478ee1);})[_0xc583('0x22')](function(_0x959500){logger[_0xc583('0x16')](_0xc583('0x1b'),_0x959500[_0xc583('0x18')],_0xfd9a60);_0x12b910(_0x774f4c['error'](0x1f4,_0x959500['message']));});});}; \ No newline at end of file +var _0x0abf=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});config[_0xf0ab('0xa')]=_['defaults'](config[_0xf0ab('0xa')],{'host':_0xf0ab('0xb'),'port':0x18eb});var socket=require(_0xf0ab('0xc'))(new Redis(config[_0xf0ab('0xa')]));require('./mailMessage.socket')[_0xf0ab('0xd')](socket);function respondWithRpcPromise(_0x4688d8,_0x1e7887,_0x4ab8e7){return new BPromise(function(_0x5d25a0,_0x30042c){return client['request'](_0x4688d8,_0x4ab8e7)[_0xf0ab('0xe')](function(_0x10a5a2){logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));logger[_0xf0ab('0x12')](_0xf0ab('0x13'),_0x1e7887,'request\x20sent',JSON[_0xf0ab('0x14')](_0x10a5a2));if(_0x10a5a2[_0xf0ab('0x15')]){if(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x16')]===0x1f4){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x30042c(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);}logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x5d25a0(_0x10a5a2[_0xf0ab('0x15')]['message']);}else{logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));_0x5d25a0(_0x10a5a2[_0xf0ab('0x18')][_0xf0ab('0x17')]);}})[_0xf0ab('0x19')](function(_0x3a0edf){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x3a0edf);_0x30042c(_0x3a0edf);});});}exports[_0xf0ab('0x1a')]=function(_0x715579){var _0xdfcfb2=this;return new Promise(function(_0xf43bc4,_0x22a205){return db[_0xf0ab('0x1b')][_0xf0ab('0x1c')](_0x715579['body'],{'raw':_0x715579[_0xf0ab('0x1d')]?_0x715579[_0xf0ab('0x1d')][_0xf0ab('0x1e')]===undefined?!![]:![]:!![]})[_0xf0ab('0xe')](function(_0x3bf6a1){logger[_0xf0ab('0xf')](_0xf0ab('0x1a'),_0x715579);logger[_0xf0ab('0x12')](_0xf0ab('0x1a'),_0x715579,JSON[_0xf0ab('0x14')](_0x3bf6a1));_0xf43bc4(_0x3bf6a1);})[_0xf0ab('0x19')](function(_0x5645b2){logger['error']('CreateMailMessage',_0x5645b2[_0xf0ab('0x17')],_0x715579);_0x22a205(_0xdfcfb2['error'](0x1f4,_0x5645b2[_0xf0ab('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 78c46c3..8fab0f8 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 _0x6dd0=['remove','update','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x4deada,_0x39335c){var _0x164c75=function(_0x19b450){while(--_0x19b450){_0x4deada['push'](_0x4deada['shift']());}};_0x164c75(++_0x39335c);}(_0x6dd0,0xae));var _0x06dd=function(_0x21b605,_0x2f0cb7){_0x21b605=_0x21b605-0x0;var _0x4dfef8=_0x6dd0[_0x21b605];return _0x4dfef8;};'use strict';var MailMessageEvents=require(_0x06dd('0x0'));var events=[_0x06dd('0x1'),_0x06dd('0x2'),_0x06dd('0x3')];function createListener(_0x31a559,_0x13717f){return function(_0x5ac84a){_0x13717f['emit'](_0x31a559,_0x5ac84a);};}function removeListener(_0x1e9379,_0x41b4d5){return function(){MailMessageEvents[_0x06dd('0x4')](_0x1e9379,_0x41b4d5);};}exports[_0x06dd('0x5')]=function(_0x1fd4d6){for(var _0x3e060d=0x0,_0x4c8123=events[_0x06dd('0x6')];_0x3e060d<_0x4c8123;_0x3e060d++){var _0x37fb3b=events[_0x3e060d];var _0x350274=createListener(_0x06dd('0x7')+_0x37fb3b,_0x1fd4d6);MailMessageEvents['on'](_0x37fb3b,_0x350274);}}; \ No newline at end of file +var _0xf1cc=['update','register','length','mailMessage:','save','remove'];(function(_0x2d4923,_0x5cc83f){var _0x543afb=function(_0x4b5a58){while(--_0x4b5a58){_0x2d4923['push'](_0x2d4923['shift']());}};_0x543afb(++_0x5cc83f);}(_0xf1cc,0x1ae));var _0xcf1c=function(_0x515b38,_0x49e228){_0x515b38=_0x515b38-0x0;var _0x54a321=_0xf1cc[_0x515b38];return _0x54a321;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xcf1c('0x0'),_0xcf1c('0x1'),_0xcf1c('0x2')];function createListener(_0x7a13fc,_0x3f5253){return function(_0x41edea){_0x3f5253['emit'](_0x7a13fc,_0x41edea);};}function removeListener(_0x11147f,_0x176ea5){return function(){MailMessageEvents['removeListener'](_0x11147f,_0x176ea5);};}exports[_0xcf1c('0x3')]=function(_0x49c86a){for(var _0x3cb7fc=0x0,_0x584ab4=events[_0xcf1c('0x4')];_0x3cb7fc<_0x584ab4;_0x3cb7fc++){var _0x3f058d=events[_0x3cb7fc];var _0x2ff2c8=createListener(_0xcf1c('0x5')+_0x3f058d,_0x49c86a);MailMessageEvents['on'](_0x3f058d,_0x2ff2c8);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6361842..6767632 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 _0x0569=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x0569,0x113));var _0x9056=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x0569[_0x3e7804];return _0x56efda;};'use strict';var multer=require(_0x9056('0x0'));var util=require(_0x9056('0x1'));var path=require(_0x9056('0x2'));var timeout=require(_0x9056('0x3'));var express=require(_0x9056('0x4'));var router=express['Router']();var fs_extra=require(_0x9056('0x5'));var auth=require(_0x9056('0x6'));var interaction=require(_0x9056('0x7'));var config=require('../../config/environment');var controller=require(_0x9056('0x8'));router[_0x9056('0x9')]('/',auth[_0x9056('0xa')](),controller[_0x9056('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9056('0xc')]);router[_0x9056('0x9')](_0x9056('0xd'),auth[_0x9056('0xa')](),controller[_0x9056('0xe')]);router[_0x9056('0x9')](_0x9056('0xf'),auth[_0x9056('0xa')](),controller[_0x9056('0x10')]);router['get'](_0x9056('0x11'),auth[_0x9056('0xa')](),controller[_0x9056('0x12')]);router['get'](_0x9056('0x13'),auth['isAuthenticated'](),controller[_0x9056('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9056('0x15')]);router[_0x9056('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9056('0x17')]);router[_0x9056('0x16')](_0x9056('0x13'),auth[_0x9056('0xa')](),controller[_0x9056('0x18')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9056('0x19')]);router['delete'](_0x9056('0xd'),auth[_0x9056('0xa')](),controller[_0x9056('0x1a')]);router[_0x9056('0x1b')](_0x9056('0x11'),auth[_0x9056('0xa')](),controller[_0x9056('0x1c')]);router[_0x9056('0x1b')](_0x9056('0x13'),auth[_0x9056('0xa')](),controller[_0x9056('0x1d')]);module[_0x9056('0x1e')]=router; \ No newline at end of file +var _0xd727=['show','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete','destroy','removeTeams','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd727,0x8f));var _0x7d72=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd727[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7d72('0x0'));var util=require(_0x7d72('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7d72('0x2'));var router=express[_0x7d72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7d72('0x4'));var interaction=require(_0x7d72('0x5'));var config=require(_0x7d72('0x6'));var controller=require(_0x7d72('0x7'));router[_0x7d72('0x8')]('/',auth[_0x7d72('0x9')](),controller[_0x7d72('0xa')]);router['get']('/describe',auth[_0x7d72('0x9')](),controller[_0x7d72('0xb')]);router[_0x7d72('0x8')](_0x7d72('0xc'),auth[_0x7d72('0x9')](),controller[_0x7d72('0xd')]);router['get']('/:id/members',auth[_0x7d72('0x9')](),controller[_0x7d72('0xe')]);router[_0x7d72('0x8')]('/:id/teams',auth[_0x7d72('0x9')](),controller['getTeams']);router[_0x7d72('0x8')](_0x7d72('0xf'),auth['isAuthenticated'](),controller[_0x7d72('0x10')]);router[_0x7d72('0x11')]('/',auth[_0x7d72('0x9')](),controller[_0x7d72('0x12')]);router[_0x7d72('0x11')](_0x7d72('0x13'),auth[_0x7d72('0x9')](),controller[_0x7d72('0x14')]);router['post'](_0x7d72('0xf'),auth[_0x7d72('0x9')](),controller['addAgents']);router['put'](_0x7d72('0xc'),auth[_0x7d72('0x9')](),controller[_0x7d72('0x15')]);router[_0x7d72('0x16')](_0x7d72('0xc'),auth[_0x7d72('0x9')](),controller[_0x7d72('0x17')]);router['delete'](_0x7d72('0x13'),auth['isAuthenticated'](),controller[_0x7d72('0x18')]);router[_0x7d72('0x16')](_0x7d72('0xf'),auth[_0x7d72('0x9')](),controller['removeAgents']);module[_0x7d72('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e95658c..ab6b189 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 _0x2c83=['exports','STRING','name','ENUM','rrmemory','beepall','sequelize'];(function(_0x47ff2f,_0x435af2){var _0x170768=function(_0x24b58c){while(--_0x24b58c){_0x47ff2f['push'](_0x47ff2f['shift']());}};_0x170768(++_0x435af2);}(_0x2c83,0xdf));var _0x32c8=function(_0x13246c,_0x1179e5){_0x13246c=_0x13246c-0x0;var _0x197f16=_0x2c83[_0x13246c];return _0x197f16;};'use strict';var Sequelize=require(_0x32c8('0x0'));module[_0x32c8('0x1')]={'name':{'type':Sequelize[_0x32c8('0x2')],'unique':_0x32c8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x32c8('0x4')](_0x32c8('0x5'),_0x32c8('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x8209=['roundrobin','sequelize','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8209,0x166));var _0x9820=function(_0x4ccb5d,_0x3348da){_0x4ccb5d=_0x4ccb5d-0x0;var _0x43e784=_0x8209[_0x4ccb5d];return _0x43e784;};'use strict';var Sequelize=require(_0x9820('0x0'));module[_0x9820('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9820('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9820('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9820('0x4')](_0x9820('0x5'),'beepall',_0x9820('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f82abd3..88ed83e 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 _0x37a4=['user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','pick','MailQueueId','options','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','userMailQueue:save','removeTeams','Agents','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','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','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','MailQueue','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','find','create','body'];(function(_0x28e459,_0x5d8f1d){var _0x2bdd36=function(_0x2b0161){while(--_0x2b0161){_0x28e459['push'](_0x28e459['shift']());}};_0x2bdd36(++_0x5d8f1d);}(_0x37a4,0xcb));var _0x437a=function(_0x42f845,_0x47e96a){_0x42f845=_0x42f845-0x0;var _0x4f2940=_0x37a4[_0x42f845];return _0x4f2940;};'use strict';var emlformat=require(_0x437a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x437a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x437a('0x2'));var moment=require(_0x437a('0x3'));var BPromise=require(_0x437a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x437a('0x5'));var sox=require(_0x437a('0x6'));var csv=require(_0x437a('0x7'));var ejs=require(_0x437a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x437a('0x9'));var squel=require(_0x437a('0xa'));var crypto=require('crypto');var jsforce=require(_0x437a('0xb'));var deskjs=require(_0x437a('0xc'));var toCsv=require(_0x437a('0x7'));var querystring=require(_0x437a('0xd'));var Papa=require(_0x437a('0xe'));var Redis=require(_0x437a('0xf'));var authService=require(_0x437a('0x10'));var qs=require(_0x437a('0x11'));var as=require(_0x437a('0x12'));var hardwareService=require(_0x437a('0x13'));var logger=require(_0x437a('0x14'))('api');var utils=require(_0x437a('0x15'));var config=require(_0x437a('0x16'));var licenseUtil=require(_0x437a('0x17'));var db=require(_0x437a('0x18'))['db'];config[_0x437a('0x19')]=_['defaults'](config[_0x437a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x437a('0x1a'))(new Redis(config[_0x437a('0x19')]));require(_0x437a('0x1b'))[_0x437a('0x1c')](socket);function respondWithStatusCode(_0x1f4756,_0x89cb08){_0x89cb08=_0x89cb08||0xcc;return function(_0x372161){if(_0x372161){return _0x1f4756[_0x437a('0x1d')](_0x89cb08);}return _0x1f4756[_0x437a('0x1e')](_0x89cb08)[_0x437a('0x1f')]();};}function respondWithResult(_0x19cf32,_0x16aa9c){_0x16aa9c=_0x16aa9c||0xc8;return function(_0x4a44d6){if(_0x4a44d6){return _0x19cf32[_0x437a('0x1e')](_0x16aa9c)['json'](_0x4a44d6);}};}function respondWithFilteredResult(_0x33804e,_0x20173b){return function(_0x170ba3){if(_0x170ba3){var _0x60f54b=typeof _0x20173b[_0x437a('0x20')]===_0x437a('0x21')&&typeof _0x20173b['limit']===_0x437a('0x21');var _0x459284=_0x170ba3[_0x437a('0x22')];var _0x598d89=_0x60f54b?0x0:_0x20173b[_0x437a('0x20')];var _0x53cd54=_0x60f54b?_0x170ba3[_0x437a('0x22')]:_0x20173b[_0x437a('0x20')]+_0x20173b['limit'];var _0x76d5f7;if(_0x53cd54>=_0x459284){_0x53cd54=_0x459284;_0x76d5f7=0xc8;}else{_0x76d5f7=0xce;}_0x33804e['status'](_0x76d5f7);return _0x33804e[_0x437a('0x23')](_0x437a('0x24'),_0x598d89+'-'+_0x53cd54+'/'+_0x459284)[_0x437a('0x25')](_0x170ba3);}return null;};}function patchUpdates(_0x439957){return function(_0x263b61){try{jsonpatch[_0x437a('0x26')](_0x263b61,_0x439957,!![]);}catch(_0x3f9b10){return BPromise[_0x437a('0x27')](_0x3f9b10);}return _0x263b61[_0x437a('0x28')]();};}function saveUpdates(_0x3dad6f,_0x1adcc7){return function(_0x46ebad){if(_0x46ebad){return _0x46ebad['update'](_0x3dad6f)[_0x437a('0x29')](function(_0x29ccd0){return _0x29ccd0;});}return null;};}function removeEntity(_0x39f79b,_0x4d6707){return function(_0x224d7){if(_0x224d7){return _0x224d7['destroy']()[_0x437a('0x29')](function(){var _0x422c2e=_0x224d7[_0x437a('0x2a')]({'plain':!![]});var _0x335659=_0x437a('0x2b');return db[_0x437a('0x2c')][_0x437a('0x2d')]({'where':{'type':_0x335659,'resourceId':_0x422c2e['id']}})[_0x437a('0x29')](function(){return _0x224d7;});})[_0x437a('0x29')](function(){_0x39f79b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6498,_0x434eb1){return function(_0x212e50){if(!_0x212e50){_0x5e6498[_0x437a('0x1d')](0x194);}return _0x212e50;};}function handleError(_0x5bf228,_0x397ae7){_0x397ae7=_0x397ae7||0x1f4;return function(_0x3cbc11){logger[_0x437a('0x2e')](_0x3cbc11[_0x437a('0x2f')]);if(_0x3cbc11[_0x437a('0x30')]){delete _0x3cbc11['name'];}_0x5bf228['status'](_0x397ae7)['send'](_0x3cbc11);};}exports['index']=function(_0x3693dc,_0x374d61){var _0x312df5={},_0x4a66d9={},_0x4f5413={'count':0x0,'rows':[]};var _0x5e1a94=_['map'](db[_0x437a('0x31')][_0x437a('0x32')],function(_0x1e6296){return{'name':_0x1e6296['fieldName'],'type':_0x1e6296['type'][_0x437a('0x33')]};});_0x4a66d9['model']=_[_0x437a('0x34')](_0x5e1a94,_0x437a('0x30'));_0x4a66d9[_0x437a('0x35')]=_[_0x437a('0x36')](_0x3693dc[_0x437a('0x35')]);_0x4a66d9[_0x437a('0x37')]=_[_0x437a('0x38')](_0x4a66d9[_0x437a('0x39')],_0x4a66d9['query']);_0x312df5[_0x437a('0x3a')]=_[_0x437a('0x38')](_0x4a66d9['model'],qs[_0x437a('0x3b')](_0x3693dc[_0x437a('0x35')]['fields']));_0x312df5['attributes']=_0x312df5['attributes'][_0x437a('0x3c')]?_0x312df5[_0x437a('0x3a')]:_0x4a66d9[_0x437a('0x39')];if(!_0x3693dc[_0x437a('0x35')][_0x437a('0x3d')](_0x437a('0x3e'))){_0x312df5[_0x437a('0x3f')]=qs[_0x437a('0x3f')](_0x3693dc['query'][_0x437a('0x3f')]);_0x312df5[_0x437a('0x20')]=qs[_0x437a('0x20')](_0x3693dc[_0x437a('0x35')][_0x437a('0x20')]);}_0x312df5[_0x437a('0x40')]=qs[_0x437a('0x41')](_0x3693dc[_0x437a('0x35')][_0x437a('0x41')]);_0x312df5['where']=qs[_0x437a('0x37')](_['pick'](_0x3693dc[_0x437a('0x35')],_0x4a66d9[_0x437a('0x37')]),_0x5e1a94);if(_0x3693dc[_0x437a('0x35')][_0x437a('0x42')]){_0x312df5[_0x437a('0x43')]=_[_0x437a('0x44')](_0x312df5['where'],{'$or':_[_0x437a('0x34')](_0x5e1a94,function(_0x1bc1ba){if(_0x1bc1ba[_0x437a('0x45')]!==_0x437a('0x46')){var _0x384be3={};_0x384be3[_0x1bc1ba[_0x437a('0x30')]]={'$like':'%'+_0x3693dc[_0x437a('0x35')]['filter']+'%'};return _0x384be3;}})});}_0x312df5=_['merge']({},_0x312df5,_0x3693dc['options']);var _0x34f908={'where':_0x312df5[_0x437a('0x43')]};return db[_0x437a('0x31')]['count'](_0x34f908)[_0x437a('0x29')](function(_0x43a6c1){_0x4f5413[_0x437a('0x22')]=_0x43a6c1;if(_0x3693dc['query']['includeAll']){_0x312df5['include']=[{'all':!![]}];}return db[_0x437a('0x31')][_0x437a('0x47')](_0x312df5);})[_0x437a('0x29')](function(_0x295406){_0x4f5413[_0x437a('0x48')]=_0x295406;return _0x4f5413;})[_0x437a('0x29')](respondWithFilteredResult(_0x374d61,_0x312df5))[_0x437a('0x49')](handleError(_0x374d61,null));};exports[_0x437a('0x4a')]=function(_0xd90e28,_0x5b4bc2){var _0x4423a1={'raw':!![],'where':{'id':_0xd90e28[_0x437a('0x4b')]['id']}},_0x151e9f={};_0x151e9f[_0x437a('0x39')]=_['keys'](db[_0x437a('0x31')][_0x437a('0x32')]);_0x151e9f['query']=_[_0x437a('0x36')](_0xd90e28[_0x437a('0x35')]);_0x151e9f['filters']=_[_0x437a('0x38')](_0x151e9f[_0x437a('0x39')],_0x151e9f[_0x437a('0x35')]);_0x4423a1[_0x437a('0x3a')]=_[_0x437a('0x38')](_0x151e9f[_0x437a('0x39')],qs[_0x437a('0x3b')](_0xd90e28['query']['fields']));_0x4423a1[_0x437a('0x3a')]=_0x4423a1['attributes'][_0x437a('0x3c')]?_0x4423a1['attributes']:_0x151e9f[_0x437a('0x39')];if(_0xd90e28[_0x437a('0x35')][_0x437a('0x4c')]){_0x4423a1[_0x437a('0x4d')]=[{'all':!![]}];}_0x4423a1=_['merge']({},_0x4423a1,_0xd90e28['options']);return db[_0x437a('0x31')][_0x437a('0x4e')](_0x4423a1)[_0x437a('0x29')](handleEntityNotFound(_0x5b4bc2,null))[_0x437a('0x29')](respondWithResult(_0x5b4bc2,null))[_0x437a('0x49')](handleError(_0x5b4bc2,null));};exports[_0x437a('0x4f')]=function(_0x2b2092,_0x12d2f3){return db[_0x437a('0x31')]['create'](_0x2b2092[_0x437a('0x50')],{})[_0x437a('0x29')](function(_0x465c4e){var _0x466f1c=_0x2b2092[_0x437a('0x51')][_0x437a('0x2a')]({'plain':!![]});if(!_0x466f1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x466f1c[_0x437a('0x52')]===_0x437a('0x51')){var _0x33c6b1=_0x465c4e['get']({'plain':!![]});var _0x56cc15=_0x437a('0x2b');return db[_0x437a('0x53')][_0x437a('0x4e')]({'where':{'name':_0x56cc15,'userProfileId':_0x466f1c[_0x437a('0x54')]},'raw':!![]})['then'](function(_0x1b255f){if(_0x1b255f&&_0x1b255f[_0x437a('0x55')]===0x0){return db['UserProfileResource'][_0x437a('0x4f')]({'name':_0x33c6b1['name'],'resourceId':_0x33c6b1['id'],'type':_0x1b255f['name'],'sectionId':_0x1b255f['id']},{})[_0x437a('0x29')](function(){return _0x465c4e;});}else{return _0x465c4e;}})[_0x437a('0x49')](function(_0x380d69){logger[_0x437a('0x2e')](_0x437a('0x56'),_0x380d69);throw _0x380d69;});}return _0x465c4e;})[_0x437a('0x29')](respondWithResult(_0x12d2f3,0xc9))[_0x437a('0x49')](handleError(_0x12d2f3,null));};exports[_0x437a('0x57')]=function(_0x1cd3af,_0x2be0f6){if(_0x1cd3af[_0x437a('0x50')]['id']){delete _0x1cd3af[_0x437a('0x50')]['id'];}return db[_0x437a('0x31')][_0x437a('0x4e')]({'where':{'id':_0x1cd3af[_0x437a('0x4b')]['id']}})[_0x437a('0x29')](handleEntityNotFound(_0x2be0f6,null))['then'](saveUpdates(_0x1cd3af['body'],null))[_0x437a('0x29')](respondWithResult(_0x2be0f6,null))[_0x437a('0x49')](handleError(_0x2be0f6,null));};exports[_0x437a('0x2d')]=function(_0x21953e,_0x28d977){return db['MailQueue'][_0x437a('0x4e')]({'where':{'id':_0x21953e[_0x437a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x28d977,null))[_0x437a('0x29')](removeEntity(_0x28d977,null))[_0x437a('0x49')](handleError(_0x28d977,null));};exports[_0x437a('0x58')]=function(_0x5f15f6,_0x2ab953){return db['MailQueue'][_0x437a('0x58')]()[_0x437a('0x29')](respondWithResult(_0x2ab953,null))['catch'](handleError(_0x2ab953,null));};exports[_0x437a('0x59')]=function(_0x1bbff8,_0x2eacd6,_0x204932){var _0x562728={'raw':!![],'where':{}},_0x431741={},_0x55bddc;return db[_0x437a('0x31')][_0x437a('0x5a')]({'where':{'id':_0x1bbff8[_0x437a('0x4b')]['id']}})[_0x437a('0x29')](handleEntityNotFound(_0x2eacd6,null))[_0x437a('0x29')](function(_0x354209){if(_0x354209){_0x55bddc=_0x354209['get']({'plain':!![]});_0x431741[_0x437a('0x39')]=_['keys'](db['UserMailQueue'][_0x437a('0x32')]);_0x431741[_0x437a('0x35')]=_[_0x437a('0x36')](_0x1bbff8[_0x437a('0x35')]);_0x431741['filters']=_[_0x437a('0x38')](_0x431741[_0x437a('0x39')],_0x431741[_0x437a('0x35')]);_0x562728[_0x437a('0x3a')]=_['intersection'](_0x431741[_0x437a('0x39')],qs['fields'](_0x1bbff8[_0x437a('0x35')][_0x437a('0x3b')]));_0x562728['attributes']=_0x562728[_0x437a('0x3a')][_0x437a('0x3c')]?_0x562728[_0x437a('0x3a')]:_0x431741[_0x437a('0x39')];if(!_0x1bbff8[_0x437a('0x35')]['hasOwnProperty'](_0x437a('0x3e'))){_0x562728[_0x437a('0x3f')]=qs['limit'](_0x1bbff8[_0x437a('0x35')][_0x437a('0x3f')]);_0x562728[_0x437a('0x20')]=qs['offset'](_0x1bbff8[_0x437a('0x35')][_0x437a('0x20')]);}_0x562728[_0x437a('0x40')]=qs[_0x437a('0x41')](_0x1bbff8[_0x437a('0x35')]['sort']);_0x562728[_0x437a('0x43')]=qs[_0x437a('0x37')](_[_0x437a('0x5b')](_0x1bbff8[_0x437a('0x35')],_0x431741[_0x437a('0x37')]));_0x562728[_0x437a('0x43')][_0x437a('0x5c')]=_0x354209['id'];if(_0x1bbff8['query']['filter']){_0x562728[_0x437a('0x43')]=_[_0x437a('0x44')](_0x562728[_0x437a('0x43')],{'$or':_[_0x437a('0x34')](_0x562728[_0x437a('0x3a')],function(_0x29733c){var _0x4a4dc5={};_0x4a4dc5[_0x29733c]={'$like':'%'+_0x1bbff8[_0x437a('0x35')][_0x437a('0x42')]+'%'};return _0x4a4dc5;})});}_0x562728=_[_0x437a('0x44')]({},_0x562728,_0x1bbff8[_0x437a('0x5d')]);return db[_0x437a('0x5e')]['findAll'](_0x562728);}})[_0x437a('0x29')](function(_0x3d66a7){if(_0x3d66a7){return db[_0x437a('0x5f')][_0x437a('0x60')]({'where':{'id':_[_0x437a('0x34')](_0x3d66a7,_0x437a('0x61')),'role':_0x437a('0x62')},'attributes':['id',_0x437a('0x30'),_0x437a('0x63'),'updatedAt',_0x437a('0x64')]});}})['then'](function(_0x562ee7){if(_0x562ee7){return{'count':_0x562ee7[_0x437a('0x22')],'rows':_[_0x437a('0x34')](_0x562ee7[_0x437a('0x48')],function(_0x7da21a){return{'membername':_0x7da21a['name'],'UserId':_0x7da21a['id'],'queue_name':_0x55bddc[_0x437a('0x30')],'MailQueueId':_0x55bddc['id'],'interface':util['format'](_0x437a('0x65'),_0x437a('0x66'),_0x7da21a[_0x437a('0x30')]),'penalty':0x0,'paused':_0x7da21a[_0x437a('0x63')],'createdAt':_0x7da21a[_0x437a('0x64')],'updatedAt':_0x7da21a[_0x437a('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x437a('0x29')](respondWithFilteredResult(_0x2eacd6,_0x562728))[_0x437a('0x49')](handleError(_0x2eacd6,null));};exports['getTeams']=function(_0x19fd48,_0x3ce49e,_0x17c233){var _0x4c25df={};var _0x202910={};var _0x255e69;var _0x341696;return db[_0x437a('0x31')][_0x437a('0x5a')]({'where':{'id':_0x19fd48[_0x437a('0x4b')]['id']}})[_0x437a('0x29')](handleEntityNotFound(_0x3ce49e,null))['then'](function(_0x251dd9){if(_0x251dd9){_0x255e69=_0x251dd9;_0x202910['model']=_[_0x437a('0x36')](db[_0x437a('0x68')][_0x437a('0x32')]);_0x202910[_0x437a('0x35')]=_[_0x437a('0x36')](_0x19fd48[_0x437a('0x35')]);_0x202910['filters']=_[_0x437a('0x38')](_0x202910[_0x437a('0x39')],_0x202910[_0x437a('0x35')]);_0x4c25df[_0x437a('0x3a')]=_[_0x437a('0x38')](_0x202910['model'],qs['fields'](_0x19fd48[_0x437a('0x35')][_0x437a('0x3b')]));_0x4c25df[_0x437a('0x3a')]=_0x4c25df['attributes'][_0x437a('0x3c')]?_0x4c25df[_0x437a('0x3a')]:_0x202910[_0x437a('0x39')];_0x4c25df['order']=qs[_0x437a('0x41')](_0x19fd48[_0x437a('0x35')][_0x437a('0x41')]);_0x4c25df[_0x437a('0x43')]=qs[_0x437a('0x37')](_[_0x437a('0x5b')](_0x19fd48[_0x437a('0x35')],_0x202910[_0x437a('0x37')]));if(_0x19fd48[_0x437a('0x35')][_0x437a('0x42')]){_0x4c25df[_0x437a('0x43')]=_[_0x437a('0x44')](_0x4c25df[_0x437a('0x43')],{'$or':_[_0x437a('0x34')](_0x4c25df[_0x437a('0x3a')],function(_0xbf8dee){var _0x4bd87c={};_0x4bd87c[_0xbf8dee]={'$like':'%'+_0x19fd48[_0x437a('0x35')][_0x437a('0x42')]+'%'};return _0x4bd87c;})});}_0x4c25df=_[_0x437a('0x44')]({},_0x4c25df,_0x19fd48[_0x437a('0x5d')]);return _0x255e69[_0x437a('0x69')](_0x4c25df);}})['then'](function(_0x5d8d67){if(_0x5d8d67){_0x341696=_0x5d8d67['length'];if(!_0x19fd48['query']['hasOwnProperty'](_0x437a('0x3e'))){_0x4c25df[_0x437a('0x3f')]=qs[_0x437a('0x3f')](_0x19fd48[_0x437a('0x35')][_0x437a('0x3f')]);_0x4c25df[_0x437a('0x20')]=qs[_0x437a('0x20')](_0x19fd48[_0x437a('0x35')][_0x437a('0x20')]);}return _0x255e69[_0x437a('0x69')](_0x4c25df);}})[_0x437a('0x29')](function(_0x89281a){if(_0x89281a){return _0x89281a?{'count':_0x341696,'rows':_0x89281a}:null;}})[_0x437a('0x29')](respondWithResult(_0x3ce49e,null))[_0x437a('0x49')](handleError(_0x3ce49e,null));};exports['addTeams']=function(_0xcb23d9,_0xc4bc3c,_0x14c8b4){var _0x236285=_0xcb23d9[_0x437a('0x50')][_0x437a('0x6a')];return db['Team'][_0x437a('0x47')]({'where':{'id':_0x236285},'attributes':['id'],'include':[{'model':db[_0x437a('0x5f')],'as':'Agents','attributes':['id',_0x437a('0x30'),_0x437a('0x6b'),_0x437a('0x6c'),_0x437a('0x6d')],'raw':!![]}]})[_0x437a('0x29')](function(_0x24dec4){if(_0x24dec4){var _0x5ded72=_[_0x437a('0x6e')](_0x24dec4,function(_0x59a53b){var _0x13f5d8=_0x59a53b['get']({'plain':!![]});return _0x13f5d8['Agents'];});return db[_0x437a('0x31')][_0x437a('0x4e')]({'where':{'id':_0xcb23d9[_0x437a('0x4b')]['id']}})[_0x437a('0x29')](function(_0x44c5dd){return db[_0x437a('0x6f')][_0x437a('0x70')](function(_0x572edc){return _0x44c5dd[_0x437a('0x71')](_0x236285,{'transaction':_0x572edc})['then'](function(){return BPromise[_0x437a('0x72')](_0x5ded72,function(_0x3a2ba3){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x3a2ba3['id'],'MailQueueId':_0xcb23d9[_0x437a('0x4b')]['id']},'transaction':_0x572edc});});})[_0x437a('0x29')](function(){_0x5ded72[_0x437a('0x73')](function(_0x294c29){socket['emit'](_0x437a('0x74'),{'UserId':_0x294c29['id'],'MailQueueId':_0x44c5dd['id']});});});});});}})[_0x437a('0x29')](respondWithStatusCode(_0xc4bc3c,null))['catch'](handleError(_0xc4bc3c,null));};exports[_0x437a('0x75')]=function(_0x2ee41d,_0x1a6c02,_0x5b6b2b){return db[_0x437a('0x68')][_0x437a('0x47')]({'where':{'id':_0x2ee41d[_0x437a('0x35')][_0x437a('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x437a('0x5f')],'as':_0x437a('0x76'),'attributes':['id'],'raw':!![]}]})[_0x437a('0x29')](handleEntityNotFound(_0x1a6c02,null))[_0x437a('0x29')](function(_0x4475cf){var _0x5e31fa=_[_0x437a('0x34')](_0x4475cf,'id');var _0x280307=[];var _0x1d1dd4=[];var _0x108566=squel[_0x437a('0x77')]();_0x108566[_0x437a('0x78')]('tq.TeamId')[_0x437a('0x79')]('team_has_mail_queues','tq')[_0x437a('0x7a')](_0x437a('0x7b'),'ut',_0x437a('0x7c'))[_0x437a('0x43')](_0x437a('0x7d'),_0x2ee41d[_0x437a('0x4b')]['id']);for(var _0x48b1d4=0x0;_0x48b1d4<_0x4475cf['length'];_0x48b1d4+=0x1){let _0x1f4b39=_0x4475cf[_0x48b1d4];for(var _0x20e6f1=0x0;_0x20e6f1<_0x1f4b39[_0x437a('0x76')][_0x437a('0x3c')];_0x20e6f1+=0x1){let _0x181026=_0x1f4b39[_0x437a('0x76')][_0x20e6f1];var _0xb291fc=_0x108566['clone']();_0xb291fc['where'](_0x437a('0x7e'),_0x181026['id']);_0x1d1dd4[_0x437a('0x7f')](db[_0x437a('0x6f')][_0x437a('0x35')](_0xb291fc['toString'](),{'type':db[_0x437a('0x6f')][_0x437a('0x80')][_0x437a('0x81')]})['then'](function(_0x6683cb){if(_0x6683cb[_0x437a('0x3c')]===0x1){return _0x181026['id'];}else{var _0xa647cc=_[_0x437a('0x82')](_['map'](_0x6683cb,'TeamId'),function(_0x3e31fa){return _[_0x437a('0x83')](_0x5e31fa,_0x3e31fa);});if(_0xa647cc){return _0x181026['id'];}}}));}}return BPromise[_0x437a('0x84')](_0x1d1dd4)['then'](function(_0x57c985){_0x280307=_(_0x280307)['union'](_0x57c985)['compact']()[_0x437a('0x85')]();return db[_0x437a('0x31')][_0x437a('0x4e')]({'where':{'id':_0x2ee41d[_0x437a('0x4b')]['id']}})[_0x437a('0x29')](function(_0x3c4b70){return db[_0x437a('0x6f')]['transaction'](function(_0x5f17b6){return _0x3c4b70[_0x437a('0x75')](_0x2ee41d[_0x437a('0x35')][_0x437a('0x6a')],{'transaction':_0x5f17b6})[_0x437a('0x29')](function(){if(!_[_0x437a('0x86')](_0x280307)){return _0x3c4b70[_0x437a('0x87')](_0x280307,{'transaction':_0x5f17b6});}})['then'](function(){_0x280307[_0x437a('0x73')](function(_0x987b67){socket[_0x437a('0x88')](_0x437a('0x89'),{'UserId':_0x987b67,'MailQueueId':_0x3c4b70['id']});});});});});});})[_0x437a('0x29')](respondWithStatusCode(_0x1a6c02,null))[_0x437a('0x49')](handleError(_0x1a6c02,null));};exports[_0x437a('0x8a')]=function(_0x15b5c8,_0x357ef6,_0x5990b2){return db[_0x437a('0x31')]['find']({'where':{'id':_0x15b5c8['params']['id']}})[_0x437a('0x29')](handleEntityNotFound(_0x357ef6,null))[_0x437a('0x29')](function(_0x4cfba6){if(_0x4cfba6){return _0x4cfba6[_0x437a('0x8a')](_0x15b5c8[_0x437a('0x50')][_0x437a('0x6a')],_['omit'](_0x15b5c8['body'],[_0x437a('0x6a'),'id'])||{})[_0x437a('0x8b')](function(_0x132357){for(var _0x57c9d1=0x0;_0x57c9d1<_0x15b5c8[_0x437a('0x50')]['ids']['length'];_0x57c9d1+=0x1){socket[_0x437a('0x88')](_0x437a('0x74'),{'UserId':Number(_0x15b5c8[_0x437a('0x50')][_0x437a('0x6a')][_0x57c9d1]),'MailQueueId':Number(_0x15b5c8[_0x437a('0x4b')]['id'])});}return _0x132357;});}})[_0x437a('0x29')](respondWithResult(_0x357ef6,null))[_0x437a('0x49')](handleError(_0x357ef6,null));};exports[_0x437a('0x87')]=function(_0x558e75,_0x42fba3,_0x3a85cb){return db[_0x437a('0x31')][_0x437a('0x4e')]({'where':{'id':_0x558e75[_0x437a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42fba3,null))[_0x437a('0x29')](function(_0xdb8645){if(_0xdb8645){return _0xdb8645[_0x437a('0x87')](_0x558e75[_0x437a('0x35')][_0x437a('0x6a')])[_0x437a('0x29')](function(){if(_[_0x437a('0x8c')](_0x558e75['query'][_0x437a('0x6a')])){for(var _0x33408a=0x0;_0x33408a<_0x558e75[_0x437a('0x35')][_0x437a('0x6a')][_0x437a('0x3c')];_0x33408a+=0x1){socket[_0x437a('0x88')]('userMailQueue:remove',{'UserId':Number(_0x558e75[_0x437a('0x35')]['ids'][_0x33408a]),'MailQueueId':Number(_0x558e75[_0x437a('0x4b')]['id'])});}}else{socket[_0x437a('0x88')](_0x437a('0x89'),{'UserId':Number(_0x558e75[_0x437a('0x35')][_0x437a('0x6a')]),'MailQueueId':Number(_0x558e75[_0x437a('0x4b')]['id'])});}});}})[_0x437a('0x29')](respondWithStatusCode(_0x42fba3,null))[_0x437a('0x49')](handleError(_0x42fba3,null));};exports[_0x437a('0x8d')]=function(_0x8257dc,_0x212209,_0x50a2fd){var _0xfb0f34={};var _0x91212={};var _0x5f1147;var _0x3690c8;return db['MailQueue'][_0x437a('0x5a')]({'where':{'id':_0x8257dc[_0x437a('0x4b')]['id']}})[_0x437a('0x29')](handleEntityNotFound(_0x212209,null))[_0x437a('0x29')](function(_0x304649){if(_0x304649){_0x5f1147=_0x304649;_0x91212[_0x437a('0x39')]=_[_0x437a('0x36')](db[_0x437a('0x5f')]['rawAttributes']);_0x91212[_0x437a('0x35')]=_['keys'](_0x8257dc[_0x437a('0x35')]);_0x91212[_0x437a('0x37')]=_['intersection'](_0x91212[_0x437a('0x39')],_0x91212[_0x437a('0x35')]);_0xfb0f34[_0x437a('0x3a')]=_[_0x437a('0x38')](_0x91212[_0x437a('0x39')],qs['fields'](_0x8257dc['query'][_0x437a('0x3b')]));_0xfb0f34[_0x437a('0x3a')]=_0xfb0f34[_0x437a('0x3a')]['length']?_0xfb0f34[_0x437a('0x3a')]:_0x91212[_0x437a('0x39')];_0xfb0f34[_0x437a('0x40')]=qs[_0x437a('0x41')](_0x8257dc['query']['sort']);_0xfb0f34['where']=qs['filters'](_['pick'](_0x8257dc[_0x437a('0x35')],_0x91212['filters']));if(_0x8257dc[_0x437a('0x35')][_0x437a('0x42')]){_0xfb0f34[_0x437a('0x43')]=_['merge'](_0xfb0f34[_0x437a('0x43')],{'$or':_[_0x437a('0x34')](_0xfb0f34['attributes'],function(_0x38c08d){var _0x33e300={};_0x33e300[_0x38c08d]={'$like':'%'+_0x8257dc[_0x437a('0x35')][_0x437a('0x42')]+'%'};return _0x33e300;})});}_0xfb0f34=_[_0x437a('0x44')]({},_0xfb0f34,_0x8257dc['options']);return _0x5f1147[_0x437a('0x8d')](_0xfb0f34);}})['then'](function(_0x1e62eb){if(_0x1e62eb){_0x3690c8=_0x1e62eb['length'];if(!_0x8257dc[_0x437a('0x35')][_0x437a('0x3d')](_0x437a('0x3e'))){_0xfb0f34['limit']=qs[_0x437a('0x3f')](_0x8257dc[_0x437a('0x35')][_0x437a('0x3f')]);_0xfb0f34['offset']=qs[_0x437a('0x20')](_0x8257dc[_0x437a('0x35')]['offset']);}return _0x5f1147[_0x437a('0x8d')](_0xfb0f34);}})[_0x437a('0x29')](function(_0x190e93){if(_0x190e93){return _0x190e93?{'count':_0x3690c8,'rows':_0x190e93}:null;}})['then'](respondWithResult(_0x212209,null))[_0x437a('0x49')](handleError(_0x212209,null));}; \ No newline at end of file +var _0x0582=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','MailQueueId','UserMailQueue','findAll','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','toString','SELECT','TeamId','includes','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userMailQueue:remove','order','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','MailQueue','includeAll','include','rows','show','options','find'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x0582,0x150));var _0x2058=function(_0x51aaec,_0x3b7800){_0x51aaec=_0x51aaec-0x0;var _0x304da8=_0x0582[_0x51aaec];return _0x304da8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2058('0x0'));var zipdir=require(_0x2058('0x1'));var jsonpatch=require(_0x2058('0x2'));var rp=require(_0x2058('0x3'));var moment=require(_0x2058('0x4'));var BPromise=require(_0x2058('0x5'));var Mustache=require(_0x2058('0x6'));var util=require(_0x2058('0x7'));var path=require(_0x2058('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2058('0x9'));var fs=require('fs');var fs_extra=require(_0x2058('0xa'));var _=require(_0x2058('0xb'));var squel=require(_0x2058('0xc'));var crypto=require(_0x2058('0xd'));var jsforce=require(_0x2058('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2058('0xf'));var authService=require(_0x2058('0x10'));var qs=require(_0x2058('0x11'));var as=require(_0x2058('0x12'));var hardwareService=require(_0x2058('0x13'));var logger=require(_0x2058('0x14'))(_0x2058('0x15'));var utils=require(_0x2058('0x16'));var config=require(_0x2058('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2058('0x18')]=_['defaults'](config[_0x2058('0x18')],{'host':_0x2058('0x19'),'port':0x18eb});var socket=require(_0x2058('0x1a'))(new Redis(config[_0x2058('0x18')]));require(_0x2058('0x1b'))[_0x2058('0x1c')](socket);function respondWithStatusCode(_0x4beea5,_0x4b6691){_0x4b6691=_0x4b6691||0xcc;return function(_0x1315d6){if(_0x1315d6){return _0x4beea5[_0x2058('0x1d')](_0x4b6691);}return _0x4beea5['status'](_0x4b6691)[_0x2058('0x1e')]();};}function respondWithResult(_0x2b4ce5,_0x4fb267){_0x4fb267=_0x4fb267||0xc8;return function(_0x4f9e97){if(_0x4f9e97){return _0x2b4ce5['status'](_0x4fb267)['json'](_0x4f9e97);}};}function respondWithFilteredResult(_0xb8bbfc,_0x163860){return function(_0x133bb3){if(_0x133bb3){var _0x543954=typeof _0x163860[_0x2058('0x1f')]===_0x2058('0x20')&&typeof _0x163860[_0x2058('0x21')]===_0x2058('0x20');var _0x1faed6=_0x133bb3[_0x2058('0x22')];var _0x5664e0=_0x543954?0x0:_0x163860['offset'];var _0x349a67=_0x543954?_0x133bb3[_0x2058('0x22')]:_0x163860['offset']+_0x163860[_0x2058('0x21')];var _0x24b270;if(_0x349a67>=_0x1faed6){_0x349a67=_0x1faed6;_0x24b270=0xc8;}else{_0x24b270=0xce;}_0xb8bbfc[_0x2058('0x23')](_0x24b270);return _0xb8bbfc['set'](_0x2058('0x24'),_0x5664e0+'-'+_0x349a67+'/'+_0x1faed6)[_0x2058('0x25')](_0x133bb3);}return null;};}function patchUpdates(_0x55a370){return function(_0x5b1973){try{jsonpatch[_0x2058('0x26')](_0x5b1973,_0x55a370,!![]);}catch(_0xc77c3e){return BPromise['reject'](_0xc77c3e);}return _0x5b1973[_0x2058('0x27')]();};}function saveUpdates(_0x590284,_0x4d1e50){return function(_0x54814c){if(_0x54814c){return _0x54814c[_0x2058('0x28')](_0x590284)[_0x2058('0x29')](function(_0x482110){return _0x482110;});}return null;};}function removeEntity(_0x689289,_0x564109){return function(_0x334ead){if(_0x334ead){return _0x334ead[_0x2058('0x2a')]()[_0x2058('0x29')](function(){var _0x52c65a=_0x334ead[_0x2058('0x2b')]({'plain':!![]});var _0xb6fd0=_0x2058('0x2c');return db[_0x2058('0x2d')][_0x2058('0x2a')]({'where':{'type':_0xb6fd0,'resourceId':_0x52c65a['id']}})[_0x2058('0x29')](function(){return _0x334ead;});})[_0x2058('0x29')](function(){_0x689289['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20a835,_0x157d13){return function(_0x2a780b){if(!_0x2a780b){_0x20a835['sendStatus'](0x194);}return _0x2a780b;};}function handleError(_0x374134,_0x4f4d2a){_0x4f4d2a=_0x4f4d2a||0x1f4;return function(_0x4d11ff){logger[_0x2058('0x2e')](_0x4d11ff[_0x2058('0x2f')]);if(_0x4d11ff['name']){delete _0x4d11ff[_0x2058('0x30')];}_0x374134[_0x2058('0x23')](_0x4f4d2a)[_0x2058('0x31')](_0x4d11ff);};}exports['index']=function(_0x5f30c8,_0x4f7830){var _0x2500de={},_0x13ec19={},_0x4346c7={'count':0x0,'rows':[]};var _0x1f7173=_[_0x2058('0x32')](db['MailQueue'][_0x2058('0x33')],function(_0x3b9285){return{'name':_0x3b9285[_0x2058('0x34')],'type':_0x3b9285[_0x2058('0x35')][_0x2058('0x36')]};});_0x13ec19[_0x2058('0x37')]=_[_0x2058('0x32')](_0x1f7173,_0x2058('0x30'));_0x13ec19[_0x2058('0x38')]=_[_0x2058('0x39')](_0x5f30c8[_0x2058('0x38')]);_0x13ec19['filters']=_[_0x2058('0x3a')](_0x13ec19['model'],_0x13ec19[_0x2058('0x38')]);_0x2500de[_0x2058('0x3b')]=_['intersection'](_0x13ec19[_0x2058('0x37')],qs[_0x2058('0x3c')](_0x5f30c8[_0x2058('0x38')][_0x2058('0x3c')]));_0x2500de[_0x2058('0x3b')]=_0x2500de[_0x2058('0x3b')][_0x2058('0x3d')]?_0x2500de[_0x2058('0x3b')]:_0x13ec19['model'];if(!_0x5f30c8[_0x2058('0x38')][_0x2058('0x3e')](_0x2058('0x3f'))){_0x2500de[_0x2058('0x21')]=qs[_0x2058('0x21')](_0x5f30c8[_0x2058('0x38')][_0x2058('0x21')]);_0x2500de[_0x2058('0x1f')]=qs[_0x2058('0x1f')](_0x5f30c8[_0x2058('0x38')][_0x2058('0x1f')]);}_0x2500de['order']=qs['sort'](_0x5f30c8[_0x2058('0x38')][_0x2058('0x40')]);_0x2500de[_0x2058('0x41')]=qs['filters'](_[_0x2058('0x42')](_0x5f30c8['query'],_0x13ec19[_0x2058('0x43')]),_0x1f7173);if(_0x5f30c8[_0x2058('0x38')]['filter']){_0x2500de[_0x2058('0x41')]=_[_0x2058('0x44')](_0x2500de[_0x2058('0x41')],{'$or':_[_0x2058('0x32')](_0x1f7173,function(_0x441d94){if(_0x441d94['type']!==_0x2058('0x45')){var _0x5868b3={};_0x5868b3[_0x441d94['name']]={'$like':'%'+_0x5f30c8[_0x2058('0x38')][_0x2058('0x46')]+'%'};return _0x5868b3;}})});}_0x2500de=_[_0x2058('0x44')]({},_0x2500de,_0x5f30c8['options']);var _0x20f77d={'where':_0x2500de[_0x2058('0x41')]};return db[_0x2058('0x47')][_0x2058('0x22')](_0x20f77d)[_0x2058('0x29')](function(_0xfcf0d2){_0x4346c7[_0x2058('0x22')]=_0xfcf0d2;if(_0x5f30c8[_0x2058('0x38')][_0x2058('0x48')]){_0x2500de[_0x2058('0x49')]=[{'all':!![]}];}return db[_0x2058('0x47')]['findAll'](_0x2500de);})[_0x2058('0x29')](function(_0x5647d3){_0x4346c7[_0x2058('0x4a')]=_0x5647d3;return _0x4346c7;})['then'](respondWithFilteredResult(_0x4f7830,_0x2500de))['catch'](handleError(_0x4f7830,null));};exports[_0x2058('0x4b')]=function(_0x139513,_0x44bac6){var _0x347f17={'raw':!![],'where':{'id':_0x139513['params']['id']}},_0x15bfe1={};_0x15bfe1[_0x2058('0x37')]=_['keys'](db[_0x2058('0x47')]['rawAttributes']);_0x15bfe1[_0x2058('0x38')]=_['keys'](_0x139513[_0x2058('0x38')]);_0x15bfe1[_0x2058('0x43')]=_[_0x2058('0x3a')](_0x15bfe1[_0x2058('0x37')],_0x15bfe1['query']);_0x347f17[_0x2058('0x3b')]=_[_0x2058('0x3a')](_0x15bfe1[_0x2058('0x37')],qs[_0x2058('0x3c')](_0x139513[_0x2058('0x38')][_0x2058('0x3c')]));_0x347f17[_0x2058('0x3b')]=_0x347f17[_0x2058('0x3b')][_0x2058('0x3d')]?_0x347f17[_0x2058('0x3b')]:_0x15bfe1[_0x2058('0x37')];if(_0x139513[_0x2058('0x38')]['includeAll']){_0x347f17[_0x2058('0x49')]=[{'all':!![]}];}_0x347f17=_[_0x2058('0x44')]({},_0x347f17,_0x139513[_0x2058('0x4c')]);return db[_0x2058('0x47')][_0x2058('0x4d')](_0x347f17)[_0x2058('0x29')](handleEntityNotFound(_0x44bac6,null))[_0x2058('0x29')](respondWithResult(_0x44bac6,null))[_0x2058('0x4e')](handleError(_0x44bac6,null));};exports['create']=function(_0x455c68,_0xe5d443){return db[_0x2058('0x47')][_0x2058('0x4f')](_0x455c68[_0x2058('0x50')],{})[_0x2058('0x29')](function(_0x146563){var _0x5068ea=_0x455c68[_0x2058('0x51')][_0x2058('0x2b')]({'plain':!![]});if(!_0x5068ea)throw new Error(_0x2058('0x52'));if(_0x5068ea[_0x2058('0x53')]===_0x2058('0x51')){var _0xac2cb5=_0x146563['get']({'plain':!![]});var _0x88ebe9=_0x2058('0x2c');return db[_0x2058('0x54')][_0x2058('0x4d')]({'where':{'name':_0x88ebe9,'userProfileId':_0x5068ea[_0x2058('0x55')]},'raw':!![]})[_0x2058('0x29')](function(_0x1c2d89){if(_0x1c2d89&&_0x1c2d89['autoAssociation']===0x0){return db[_0x2058('0x2d')][_0x2058('0x4f')]({'name':_0xac2cb5[_0x2058('0x30')],'resourceId':_0xac2cb5['id'],'type':_0x1c2d89[_0x2058('0x30')],'sectionId':_0x1c2d89['id']},{})[_0x2058('0x29')](function(){return _0x146563;});}else{return _0x146563;}})[_0x2058('0x4e')](function(_0x1612f8){logger[_0x2058('0x2e')](_0x2058('0x56'),_0x1612f8);throw _0x1612f8;});}return _0x146563;})['then'](respondWithResult(_0xe5d443,0xc9))[_0x2058('0x4e')](handleError(_0xe5d443,null));};exports[_0x2058('0x28')]=function(_0x5e9f65,_0x441d13){if(_0x5e9f65[_0x2058('0x50')]['id']){delete _0x5e9f65['body']['id'];}return db[_0x2058('0x47')][_0x2058('0x4d')]({'where':{'id':_0x5e9f65[_0x2058('0x57')]['id']}})['then'](handleEntityNotFound(_0x441d13,null))[_0x2058('0x29')](saveUpdates(_0x5e9f65[_0x2058('0x50')],null))[_0x2058('0x29')](respondWithResult(_0x441d13,null))[_0x2058('0x4e')](handleError(_0x441d13,null));};exports[_0x2058('0x2a')]=function(_0x12e9fb,_0x5b1bd3){return db[_0x2058('0x47')][_0x2058('0x4d')]({'where':{'id':_0x12e9fb[_0x2058('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b1bd3,null))[_0x2058('0x29')](removeEntity(_0x5b1bd3,null))[_0x2058('0x4e')](handleError(_0x5b1bd3,null));};exports['describe']=function(_0xeb9a47,_0x9e9068){return db['MailQueue']['describe']()[_0x2058('0x29')](respondWithResult(_0x9e9068,null))['catch'](handleError(_0x9e9068,null));};exports[_0x2058('0x58')]=function(_0x3cbd05,_0x6d1684,_0x3b6589){var _0x2df10a={'raw':!![],'where':{}},_0x523385={},_0x28477f;return db[_0x2058('0x47')]['findOne']({'where':{'id':_0x3cbd05[_0x2058('0x57')]['id']}})[_0x2058('0x29')](handleEntityNotFound(_0x6d1684,null))[_0x2058('0x29')](function(_0x2a2715){if(_0x2a2715){_0x28477f=_0x2a2715[_0x2058('0x2b')]({'plain':!![]});_0x523385[_0x2058('0x37')]=_[_0x2058('0x39')](db['UserMailQueue'][_0x2058('0x33')]);_0x523385[_0x2058('0x38')]=_[_0x2058('0x39')](_0x3cbd05['query']);_0x523385[_0x2058('0x43')]=_[_0x2058('0x3a')](_0x523385[_0x2058('0x37')],_0x523385[_0x2058('0x38')]);_0x2df10a[_0x2058('0x3b')]=_[_0x2058('0x3a')](_0x523385[_0x2058('0x37')],qs[_0x2058('0x3c')](_0x3cbd05['query'][_0x2058('0x3c')]));_0x2df10a[_0x2058('0x3b')]=_0x2df10a[_0x2058('0x3b')][_0x2058('0x3d')]?_0x2df10a[_0x2058('0x3b')]:_0x523385[_0x2058('0x37')];if(!_0x3cbd05['query']['hasOwnProperty']('nolimit')){_0x2df10a['limit']=qs[_0x2058('0x21')](_0x3cbd05['query'][_0x2058('0x21')]);_0x2df10a['offset']=qs[_0x2058('0x1f')](_0x3cbd05['query'][_0x2058('0x1f')]);}_0x2df10a['order']=qs[_0x2058('0x40')](_0x3cbd05['query'][_0x2058('0x40')]);_0x2df10a[_0x2058('0x41')]=qs[_0x2058('0x43')](_[_0x2058('0x42')](_0x3cbd05[_0x2058('0x38')],_0x523385['filters']));_0x2df10a[_0x2058('0x41')][_0x2058('0x59')]=_0x2a2715['id'];if(_0x3cbd05[_0x2058('0x38')][_0x2058('0x46')]){_0x2df10a['where']=_[_0x2058('0x44')](_0x2df10a[_0x2058('0x41')],{'$or':_[_0x2058('0x32')](_0x2df10a['attributes'],function(_0xfafdf2){var _0x47ef49={};_0x47ef49[_0xfafdf2]={'$like':'%'+_0x3cbd05[_0x2058('0x38')][_0x2058('0x46')]+'%'};return _0x47ef49;})});}_0x2df10a=_[_0x2058('0x44')]({},_0x2df10a,_0x3cbd05[_0x2058('0x4c')]);return db[_0x2058('0x5a')][_0x2058('0x5b')](_0x2df10a);}})['then'](function(_0xc1f587){if(_0xc1f587){return db[_0x2058('0x5c')]['findAndCountAll']({'where':{'id':_[_0x2058('0x32')](_0xc1f587,_0x2058('0x5d')),'role':_0x2058('0x5e')},'attributes':['id','name',_0x2058('0x5f'),_0x2058('0x60'),_0x2058('0x61')]});}})[_0x2058('0x29')](function(_0x9fcf4f){if(_0x9fcf4f){return{'count':_0x9fcf4f[_0x2058('0x22')],'rows':_[_0x2058('0x32')](_0x9fcf4f[_0x2058('0x4a')],function(_0x1cd82c){return{'membername':_0x1cd82c[_0x2058('0x30')],'UserId':_0x1cd82c['id'],'queue_name':_0x28477f['name'],'MailQueueId':_0x28477f['id'],'interface':util[_0x2058('0x62')](_0x2058('0x63'),'SIP',_0x1cd82c[_0x2058('0x30')]),'penalty':0x0,'paused':_0x1cd82c['mailPause'],'createdAt':_0x1cd82c[_0x2058('0x61')],'updatedAt':_0x1cd82c[_0x2058('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2058('0x29')](respondWithFilteredResult(_0x6d1684,_0x2df10a))['catch'](handleError(_0x6d1684,null));};exports[_0x2058('0x64')]=function(_0x58849b,_0x510d1c,_0x4645af){var _0x2055e3={};var _0x5c52ac={};var _0x27d297;var _0x36ef18;return db[_0x2058('0x47')][_0x2058('0x65')]({'where':{'id':_0x58849b['params']['id']}})['then'](handleEntityNotFound(_0x510d1c,null))[_0x2058('0x29')](function(_0x3e37bb){if(_0x3e37bb){_0x27d297=_0x3e37bb;_0x5c52ac['model']=_[_0x2058('0x39')](db[_0x2058('0x66')][_0x2058('0x33')]);_0x5c52ac[_0x2058('0x38')]=_[_0x2058('0x39')](_0x58849b[_0x2058('0x38')]);_0x5c52ac[_0x2058('0x43')]=_[_0x2058('0x3a')](_0x5c52ac[_0x2058('0x37')],_0x5c52ac[_0x2058('0x38')]);_0x2055e3['attributes']=_['intersection'](_0x5c52ac['model'],qs[_0x2058('0x3c')](_0x58849b['query'][_0x2058('0x3c')]));_0x2055e3['attributes']=_0x2055e3[_0x2058('0x3b')]['length']?_0x2055e3[_0x2058('0x3b')]:_0x5c52ac[_0x2058('0x37')];_0x2055e3['order']=qs[_0x2058('0x40')](_0x58849b[_0x2058('0x38')][_0x2058('0x40')]);_0x2055e3['where']=qs[_0x2058('0x43')](_[_0x2058('0x42')](_0x58849b[_0x2058('0x38')],_0x5c52ac['filters']));if(_0x58849b[_0x2058('0x38')][_0x2058('0x46')]){_0x2055e3['where']=_[_0x2058('0x44')](_0x2055e3[_0x2058('0x41')],{'$or':_[_0x2058('0x32')](_0x2055e3[_0x2058('0x3b')],function(_0x1ac91c){var _0x1f0268={};_0x1f0268[_0x1ac91c]={'$like':'%'+_0x58849b[_0x2058('0x38')][_0x2058('0x46')]+'%'};return _0x1f0268;})});}_0x2055e3=_['merge']({},_0x2055e3,_0x58849b['options']);return _0x27d297[_0x2058('0x64')](_0x2055e3);}})[_0x2058('0x29')](function(_0x518622){if(_0x518622){_0x36ef18=_0x518622[_0x2058('0x3d')];if(!_0x58849b[_0x2058('0x38')]['hasOwnProperty']('nolimit')){_0x2055e3[_0x2058('0x21')]=qs[_0x2058('0x21')](_0x58849b[_0x2058('0x38')][_0x2058('0x21')]);_0x2055e3['offset']=qs['offset'](_0x58849b[_0x2058('0x38')][_0x2058('0x1f')]);}return _0x27d297[_0x2058('0x64')](_0x2055e3);}})[_0x2058('0x29')](function(_0x327f7b){if(_0x327f7b){return _0x327f7b?{'count':_0x36ef18,'rows':_0x327f7b}:null;}})[_0x2058('0x29')](respondWithResult(_0x510d1c,null))[_0x2058('0x4e')](handleError(_0x510d1c,null));};exports[_0x2058('0x67')]=function(_0x439276,_0x2f8aba,_0x29687b){var _0x27844d=_0x439276[_0x2058('0x50')][_0x2058('0x68')];return db[_0x2058('0x66')][_0x2058('0x5b')]({'where':{'id':_0x27844d},'attributes':['id'],'include':[{'model':db[_0x2058('0x5c')],'as':_0x2058('0x69'),'attributes':['id',_0x2058('0x30'),_0x2058('0x6a'),_0x2058('0x6b'),_0x2058('0x6c')],'raw':!![]}]})[_0x2058('0x29')](function(_0xf4649a){if(_0xf4649a){var _0x48f8ea=_['flatMap'](_0xf4649a,function(_0x50c80f){var _0x2c42b7=_0x50c80f[_0x2058('0x2b')]({'plain':!![]});return _0x2c42b7[_0x2058('0x69')];});return db[_0x2058('0x47')][_0x2058('0x4d')]({'where':{'id':_0x439276['params']['id']}})['then'](function(_0x53456f){return db[_0x2058('0x6d')][_0x2058('0x6e')](function(_0x23334c){return _0x53456f[_0x2058('0x67')](_0x27844d,{'transaction':_0x23334c})[_0x2058('0x29')](function(){return BPromise[_0x2058('0x6f')](_0x48f8ea,function(_0x1cc89e){return db[_0x2058('0x5a')][_0x2058('0x70')]({'where':{'UserId':_0x1cc89e['id'],'MailQueueId':_0x439276[_0x2058('0x57')]['id']},'transaction':_0x23334c});});})['then'](function(){_0x48f8ea[_0x2058('0x71')](function(_0x348b61){socket['emit'](_0x2058('0x72'),{'UserId':_0x348b61['id'],'MailQueueId':_0x53456f['id']});});});});});}})[_0x2058('0x29')](respondWithStatusCode(_0x2f8aba,null))[_0x2058('0x4e')](handleError(_0x2f8aba,null));};exports[_0x2058('0x73')]=function(_0x5cf1cf,_0x461321,_0x21e505){return db['Team'][_0x2058('0x5b')]({'where':{'id':_0x5cf1cf[_0x2058('0x38')][_0x2058('0x68')]},'attributes':['id'],'include':[{'model':db[_0x2058('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2058('0x29')](handleEntityNotFound(_0x461321,null))['then'](function(_0x300153){var _0x44d2ff=_[_0x2058('0x32')](_0x300153,'id');var _0x15f92d=[];var _0x45c351=[];var _0x2a54e2=squel[_0x2058('0x74')]();_0x2a54e2[_0x2058('0x75')](_0x2058('0x76'))[_0x2058('0x77')](_0x2058('0x78'),'tq')['join'](_0x2058('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2058('0x41')](_0x2058('0x7a'),_0x5cf1cf[_0x2058('0x57')]['id']);for(var _0x1704c8=0x0;_0x1704c8<_0x300153[_0x2058('0x3d')];_0x1704c8+=0x1){let _0x403f31=_0x300153[_0x1704c8];for(var _0x40416c=0x0;_0x40416c<_0x403f31[_0x2058('0x69')][_0x2058('0x3d')];_0x40416c+=0x1){let _0x5c30c9=_0x403f31[_0x2058('0x69')][_0x40416c];var _0x1fe1f6=_0x2a54e2['clone']();_0x1fe1f6[_0x2058('0x41')]('ut.UserId\x20=\x20?',_0x5c30c9['id']);_0x45c351['push'](db[_0x2058('0x6d')][_0x2058('0x38')](_0x1fe1f6[_0x2058('0x7b')](),{'type':db[_0x2058('0x6d')]['QueryTypes'][_0x2058('0x7c')]})[_0x2058('0x29')](function(_0x1127a5){if(_0x1127a5[_0x2058('0x3d')]===0x1){return _0x5c30c9['id'];}else{var _0x23cb46=_['every'](_['map'](_0x1127a5,_0x2058('0x7d')),function(_0x14c371){return _[_0x2058('0x7e')](_0x44d2ff,_0x14c371);});if(_0x23cb46){return _0x5c30c9['id'];}}}));}}return BPromise['all'](_0x45c351)['then'](function(_0x2c61a1){_0x15f92d=_(_0x15f92d)['union'](_0x2c61a1)['compact']()[_0x2058('0x7f')]();return db[_0x2058('0x47')]['find']({'where':{'id':_0x5cf1cf['params']['id']}})['then'](function(_0x3bc055){return db[_0x2058('0x6d')][_0x2058('0x6e')](function(_0x511ae7){return _0x3bc055[_0x2058('0x73')](_0x5cf1cf[_0x2058('0x38')][_0x2058('0x68')],{'transaction':_0x511ae7})[_0x2058('0x29')](function(){if(!_[_0x2058('0x80')](_0x15f92d)){return _0x3bc055[_0x2058('0x81')](_0x15f92d,{'transaction':_0x511ae7});}})[_0x2058('0x29')](function(){_0x15f92d['forEach'](function(_0x53714c){socket[_0x2058('0x82')]('userMailQueue:remove',{'UserId':_0x53714c,'MailQueueId':_0x3bc055['id']});});});});});});})['then'](respondWithStatusCode(_0x461321,null))[_0x2058('0x4e')](handleError(_0x461321,null));};exports[_0x2058('0x83')]=function(_0x1f91b3,_0xb9395c,_0xc0a3f0){return db['MailQueue'][_0x2058('0x4d')]({'where':{'id':_0x1f91b3['params']['id']}})['then'](handleEntityNotFound(_0xb9395c,null))[_0x2058('0x29')](function(_0x3d68e9){if(_0x3d68e9){return _0x3d68e9[_0x2058('0x83')](_0x1f91b3[_0x2058('0x50')][_0x2058('0x68')],_[_0x2058('0x84')](_0x1f91b3[_0x2058('0x50')],[_0x2058('0x68'),'id'])||{})[_0x2058('0x85')](function(_0xa60fff){for(var _0x38dbd5=0x0;_0x38dbd5<_0x1f91b3[_0x2058('0x50')][_0x2058('0x68')][_0x2058('0x3d')];_0x38dbd5+=0x1){socket[_0x2058('0x82')](_0x2058('0x72'),{'UserId':Number(_0x1f91b3[_0x2058('0x50')][_0x2058('0x68')][_0x38dbd5]),'MailQueueId':Number(_0x1f91b3[_0x2058('0x57')]['id'])});}return _0xa60fff;});}})[_0x2058('0x29')](respondWithResult(_0xb9395c,null))[_0x2058('0x4e')](handleError(_0xb9395c,null));};exports[_0x2058('0x81')]=function(_0x24c22b,_0x4cf0b,_0x327360){return db[_0x2058('0x47')][_0x2058('0x4d')]({'where':{'id':_0x24c22b[_0x2058('0x57')]['id']}})['then'](handleEntityNotFound(_0x4cf0b,null))[_0x2058('0x29')](function(_0x5b9b67){if(_0x5b9b67){return _0x5b9b67[_0x2058('0x81')](_0x24c22b[_0x2058('0x38')]['ids'])[_0x2058('0x29')](function(){if(_[_0x2058('0x86')](_0x24c22b[_0x2058('0x38')][_0x2058('0x68')])){for(var _0x11e895=0x0;_0x11e895<_0x24c22b[_0x2058('0x38')][_0x2058('0x68')][_0x2058('0x3d')];_0x11e895+=0x1){socket[_0x2058('0x82')](_0x2058('0x87'),{'UserId':Number(_0x24c22b['query']['ids'][_0x11e895]),'MailQueueId':Number(_0x24c22b[_0x2058('0x57')]['id'])});}}else{socket['emit'](_0x2058('0x87'),{'UserId':Number(_0x24c22b[_0x2058('0x38')][_0x2058('0x68')]),'MailQueueId':Number(_0x24c22b[_0x2058('0x57')]['id'])});}});}})[_0x2058('0x29')](respondWithStatusCode(_0x4cf0b,null))[_0x2058('0x4e')](handleError(_0x4cf0b,null));};exports['getAgents']=function(_0x1a39f3,_0x34aef8,_0x30ef15){var _0x6abba0={};var _0x1edd8b={};var _0x2b0656;var _0x3d7736;return db[_0x2058('0x47')]['findOne']({'where':{'id':_0x1a39f3[_0x2058('0x57')]['id']}})[_0x2058('0x29')](handleEntityNotFound(_0x34aef8,null))['then'](function(_0x53741c){if(_0x53741c){_0x2b0656=_0x53741c;_0x1edd8b[_0x2058('0x37')]=_[_0x2058('0x39')](db[_0x2058('0x5c')][_0x2058('0x33')]);_0x1edd8b[_0x2058('0x38')]=_[_0x2058('0x39')](_0x1a39f3[_0x2058('0x38')]);_0x1edd8b['filters']=_[_0x2058('0x3a')](_0x1edd8b['model'],_0x1edd8b[_0x2058('0x38')]);_0x6abba0[_0x2058('0x3b')]=_['intersection'](_0x1edd8b[_0x2058('0x37')],qs[_0x2058('0x3c')](_0x1a39f3[_0x2058('0x38')][_0x2058('0x3c')]));_0x6abba0[_0x2058('0x3b')]=_0x6abba0['attributes'][_0x2058('0x3d')]?_0x6abba0[_0x2058('0x3b')]:_0x1edd8b[_0x2058('0x37')];_0x6abba0[_0x2058('0x88')]=qs[_0x2058('0x40')](_0x1a39f3[_0x2058('0x38')]['sort']);_0x6abba0[_0x2058('0x41')]=qs[_0x2058('0x43')](_[_0x2058('0x42')](_0x1a39f3[_0x2058('0x38')],_0x1edd8b[_0x2058('0x43')]));if(_0x1a39f3[_0x2058('0x38')][_0x2058('0x46')]){_0x6abba0[_0x2058('0x41')]=_[_0x2058('0x44')](_0x6abba0[_0x2058('0x41')],{'$or':_[_0x2058('0x32')](_0x6abba0['attributes'],function(_0x22ef11){var _0x4a44d6={};_0x4a44d6[_0x22ef11]={'$like':'%'+_0x1a39f3[_0x2058('0x38')][_0x2058('0x46')]+'%'};return _0x4a44d6;})});}_0x6abba0=_['merge']({},_0x6abba0,_0x1a39f3[_0x2058('0x4c')]);return _0x2b0656[_0x2058('0x89')](_0x6abba0);}})[_0x2058('0x29')](function(_0x45c666){if(_0x45c666){_0x3d7736=_0x45c666[_0x2058('0x3d')];if(!_0x1a39f3[_0x2058('0x38')]['hasOwnProperty'](_0x2058('0x3f'))){_0x6abba0[_0x2058('0x21')]=qs[_0x2058('0x21')](_0x1a39f3[_0x2058('0x38')][_0x2058('0x21')]);_0x6abba0[_0x2058('0x1f')]=qs[_0x2058('0x1f')](_0x1a39f3[_0x2058('0x38')]['offset']);}return _0x2b0656[_0x2058('0x89')](_0x6abba0);}})[_0x2058('0x29')](function(_0x415469){if(_0x415469){return _0x415469?{'count':_0x3d7736,'rows':_0x415469}:null;}})[_0x2058('0x29')](respondWithResult(_0x34aef8,null))[_0x2058('0x4e')](handleError(_0x34aef8,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 42d32c9..5144659 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 _0xeb54=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x326189,_0x23e569){var _0x487e40=function(_0x37dcab){while(--_0x37dcab){_0x326189['push'](_0x326189['shift']());}};_0x487e40(++_0x23e569);}(_0xeb54,0x1bf));var _0x4eb5=function(_0x39ea06,_0x3a7310){_0x39ea06=_0x39ea06-0x0;var _0x5dff85=_0xeb54[_0x39ea06];return _0x5dff85;};'use strict';var EventEmitter=require(_0x4eb5('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4eb5('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4eb5('0x2'),'afterDestroy':_0x4eb5('0x3')};function emitEvent(_0x1d8395){return function(_0x1931cc,_0x2302af,_0x254735){MailQueueEvents[_0x4eb5('0x4')](_0x1d8395+':'+_0x1931cc['id'],_0x1931cc);MailQueueEvents['emit'](_0x1d8395,_0x1931cc);_0x254735(null);};}for(var e in events){if(events[_0x4eb5('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x4eb5('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x581d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x581d,0x113));var _0xd581=function(_0x450ec4,_0x238480){_0x450ec4=_0x450ec4-0x0;var _0x3d488b=_0x581d[_0x450ec4];return _0x3d488b;};'use strict';var EventEmitter=require(_0xd581('0x0'));var MailQueue=require(_0xd581('0x1'))['db'][_0xd581('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd581('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd581('0x4'),'afterDestroy':_0xd581('0x5')};function emitEvent(_0xa7574){return function(_0x3ddc8c,_0xa7e749,_0x4d463a){MailQueueEvents[_0xd581('0x6')](_0xa7574+':'+_0x3ddc8c['id'],_0x3ddc8c);MailQueueEvents[_0xd581('0x6')](_0xa7574,_0x3ddc8c);_0x4d463a(null);};}for(var e in events){if(events[_0xd581('0x7')](e)){var event=events[e];MailQueue[_0xd581('0x8')](e,emitEvent(event));}}module[_0xd581('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e0bd4fe..cc9777c 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 _0x2f11=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x230951,_0x4dad52){var _0xeb26b1=function(_0x25776c){while(--_0x25776c){_0x230951['push'](_0x230951['shift']());}};_0xeb26b1(++_0x4dad52);}(_0x2f11,0x173));var _0x12f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f11[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x12f1('0x0'));var util=require(_0x12f1('0x1'));var logger=require(_0x12f1('0x2'))('api');var moment=require(_0x12f1('0x3'));var BPromise=require(_0x12f1('0x4'));var rp=require(_0x12f1('0x5'));var fs=require('fs');var path=require(_0x12f1('0x6'));var rimraf=require(_0x12f1('0x7'));var config=require(_0x12f1('0x8'));var attributes=require(_0x12f1('0x9'));module[_0x12f1('0xa')]=function(_0x4bf1ae,_0x48dc90){return _0x4bf1ae['define'](_0x12f1('0xb'),attributes,{'tableName':_0x12f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61af=['rimraf','define','lodash','../../config/logger','api','bluebird','path'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x61af,0x18a));var _0xf61a=function(_0x6f041d,_0x4029b4){_0x6f041d=_0x6f041d-0x0;var _0x4609b8=_0x61af[_0x6f041d];return _0x4609b8;};'use strict';var _=require(_0xf61a('0x0'));var util=require('util');var logger=require(_0xf61a('0x1'))(_0xf61a('0x2'));var moment=require('moment');var BPromise=require(_0xf61a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf61a('0x4'));var rimraf=require(_0xf61a('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x55733e,_0x1a95ec){return _0x55733e[_0xf61a('0x6')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index c6f577b..c05905b 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 _0xe6b0=['localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0x247045,_0x41991c){var _0x2fbaa6=function(_0x2c872c){while(--_0x2c872c){_0x247045['push'](_0x247045['shift']());}};_0x2fbaa6(++_0x41991c);}(_0xe6b0,0x15a));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0e6b('0x0'));var util=require(_0x0e6b('0x1'));var moment=require(_0x0e6b('0x2'));var BPromise=require(_0x0e6b('0x3'));var rs=require(_0x0e6b('0x4'));var fs=require('fs');var Redis=require(_0x0e6b('0x5'));var db=require(_0x0e6b('0x6'))['db'];var utils=require(_0x0e6b('0x7'));var logger=require(_0x0e6b('0x8'))(_0x0e6b('0x9'));var config=require('../../config/environment');var jayson=require(_0x0e6b('0xa'));var client=jayson['client'][_0x0e6b('0xb')]({'port':0x232a});config[_0x0e6b('0xc')]=_[_0x0e6b('0xd')](config[_0x0e6b('0xc')],{'host':_0x0e6b('0xe'),'port':0x18eb});var socket=require(_0x0e6b('0xf'))(new Redis(config[_0x0e6b('0xc')]));require('./mailQueue.socket')[_0x0e6b('0x10')](socket);function respondWithRpcPromise(_0x26c270,_0x556e87,_0x362f49){return new BPromise(function(_0x4fe25d,_0x29997f){return client[_0x0e6b('0x11')](_0x26c270,_0x362f49)[_0x0e6b('0x12')](function(_0x1e1a8f){logger[_0x0e6b('0x13')](_0x0e6b('0x14'),_0x556e87,'request\x20sent');logger[_0x0e6b('0x15')](_0x0e6b('0x16'),_0x556e87,'request\x20sent',JSON[_0x0e6b('0x17')](_0x1e1a8f));if(_0x1e1a8f[_0x0e6b('0x18')]){if(_0x1e1a8f['error']['code']===0x1f4){logger[_0x0e6b('0x18')]('MailQueue,\x20%s,\x20%s',_0x556e87,_0x1e1a8f[_0x0e6b('0x18')][_0x0e6b('0x19')]);return _0x29997f(_0x1e1a8f[_0x0e6b('0x18')][_0x0e6b('0x19')]);}logger['error'](_0x0e6b('0x14'),_0x556e87,_0x1e1a8f[_0x0e6b('0x18')]['message']);return _0x4fe25d(_0x1e1a8f[_0x0e6b('0x18')][_0x0e6b('0x19')]);}else{logger[_0x0e6b('0x13')]('MailQueue,\x20%s,\x20%s',_0x556e87,_0x0e6b('0x1a'));_0x4fe25d(_0x1e1a8f[_0x0e6b('0x1b')][_0x0e6b('0x19')]);}})['catch'](function(_0xa55755){logger[_0x0e6b('0x18')](_0x0e6b('0x14'),_0x556e87,_0xa55755);_0x29997f(_0xa55755);});});}exports[_0x0e6b('0x1c')]=function(_0x1060f6){var _0x552134=this;return new Promise(function(_0xf5e029,_0x21dbe4){return db[_0x0e6b('0x1d')][_0x0e6b('0x1e')]({'raw':_0x1060f6[_0x0e6b('0x1f')]?_0x1060f6[_0x0e6b('0x1f')][_0x0e6b('0x20')]===undefined?!![]:![]:!![],'where':_0x1060f6['options']?_0x1060f6[_0x0e6b('0x1f')]['where']||null:null,'attributes':_0x1060f6['options']?_0x1060f6[_0x0e6b('0x1f')][_0x0e6b('0x21')]||null:null,'limit':_0x1060f6[_0x0e6b('0x1f')]?_0x1060f6['options'][_0x0e6b('0x22')]||null:null,'include':_0x1060f6[_0x0e6b('0x1f')]?_0x1060f6[_0x0e6b('0x1f')][_0x0e6b('0x23')]?_[_0x0e6b('0x24')](_0x1060f6['options'][_0x0e6b('0x23')],function(_0x382fc3){return{'model':db[_0x382fc3[_0x0e6b('0x25')]],'as':_0x382fc3['as'],'attributes':_0x382fc3[_0x0e6b('0x21')],'include':_0x382fc3['include']?_[_0x0e6b('0x24')](_0x382fc3[_0x0e6b('0x23')],function(_0x403b06){return{'model':db[_0x403b06['model']],'as':_0x403b06['as'],'attributes':_0x403b06[_0x0e6b('0x21')],'include':_0x403b06[_0x0e6b('0x23')]?_[_0x0e6b('0x24')](_0x403b06[_0x0e6b('0x23')],function(_0x3d8c26){return{'model':db[_0x3d8c26['model']],'as':_0x3d8c26['as'],'attributes':_0x3d8c26[_0x0e6b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9f268f){logger[_0x0e6b('0x13')](_0x0e6b('0x1c'),_0x1060f6);logger[_0x0e6b('0x15')](_0x0e6b('0x1c'),_0x1060f6,JSON[_0x0e6b('0x17')](_0x9f268f));_0xf5e029(_0x9f268f);})[_0x0e6b('0x26')](function(_0x1a7be6){logger[_0x0e6b('0x18')]('GetMailQueue',_0x1a7be6['message'],_0x1060f6);_0x21dbe4(_0x552134['error'](0x1f4,_0x1a7be6['message']));});});};exports[_0x0e6b('0x27')]=function(_0x1d9d35){var _0x26a0e6=this;return new Promise(function(_0x259408,_0x4b6b27){return db['MailQueue']['find']({'raw':_0x1d9d35['options']?_0x1d9d35['options'][_0x0e6b('0x20')]===undefined?!![]:![]:!![],'where':_0x1d9d35[_0x0e6b('0x1f')]?_0x1d9d35[_0x0e6b('0x1f')]['where']||null:null,'attributes':_0x1d9d35[_0x0e6b('0x1f')]?_0x1d9d35[_0x0e6b('0x1f')][_0x0e6b('0x21')]||null:null,'include':_0x1d9d35[_0x0e6b('0x1f')]?_0x1d9d35[_0x0e6b('0x1f')][_0x0e6b('0x23')]?_[_0x0e6b('0x24')](_0x1d9d35[_0x0e6b('0x1f')][_0x0e6b('0x23')],function(_0x12776a){return{'model':db[_0x12776a[_0x0e6b('0x25')]],'as':_0x12776a['as'],'attributes':_0x12776a[_0x0e6b('0x21')],'include':_0x12776a[_0x0e6b('0x23')]?_['map'](_0x12776a[_0x0e6b('0x23')],function(_0x4ddca4){return{'model':db[_0x4ddca4['model']],'as':_0x4ddca4['as'],'attributes':_0x4ddca4[_0x0e6b('0x21')],'include':_0x4ddca4[_0x0e6b('0x23')]?_[_0x0e6b('0x24')](_0x4ddca4['include'],function(_0x36cf19){return{'model':db[_0x36cf19[_0x0e6b('0x25')]],'as':_0x36cf19['as'],'attributes':_0x36cf19[_0x0e6b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0e6b('0x12')](function(_0x5f2a1e){logger[_0x0e6b('0x13')](_0x0e6b('0x27'),_0x1d9d35);logger[_0x0e6b('0x15')](_0x0e6b('0x27'),_0x1d9d35,JSON[_0x0e6b('0x17')](_0x5f2a1e));_0x259408(_0x5f2a1e);})['catch'](function(_0x52e831){logger[_0x0e6b('0x18')]('ShowMailQueue',_0x52e831[_0x0e6b('0x19')],_0x1d9d35);_0x4b6b27(_0x26a0e6[_0x0e6b('0x18')](0x1f4,_0x52e831[_0x0e6b('0x19')]));});});}; \ No newline at end of file +var _0xd882=['debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','include','map','model','attributes','ShowMailQueue','then','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd882,0xd1));var _0x2d88=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xd882[_0x27604f];return _0x40d189;};'use strict';var _=require(_0x2d88('0x0'));var util=require('util');var moment=require(_0x2d88('0x1'));var BPromise=require(_0x2d88('0x2'));var rs=require(_0x2d88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d88('0x4'));var config=require(_0x2d88('0x5'));var jayson=require(_0x2d88('0x6'));var client=jayson[_0x2d88('0x7')][_0x2d88('0x8')]({'port':0x232a});config[_0x2d88('0x9')]=_[_0x2d88('0xa')](config[_0x2d88('0x9')],{'host':_0x2d88('0xb'),'port':0x18eb});var socket=require(_0x2d88('0xc'))(new Redis(config[_0x2d88('0x9')]));require(_0x2d88('0xd'))[_0x2d88('0xe')](socket);function respondWithRpcPromise(_0x342cf7,_0x135fb4,_0x1c723e){return new BPromise(function(_0x21c5e1,_0x199287){return client[_0x2d88('0xf')](_0x342cf7,_0x1c723e)['then'](function(_0x47d741){logger[_0x2d88('0x10')](_0x2d88('0x11'),_0x135fb4,_0x2d88('0x12'));logger[_0x2d88('0x13')](_0x2d88('0x14'),_0x135fb4,_0x2d88('0x12'),JSON[_0x2d88('0x15')](_0x47d741));if(_0x47d741[_0x2d88('0x16')]){if(_0x47d741[_0x2d88('0x16')]['code']===0x1f4){logger[_0x2d88('0x16')](_0x2d88('0x11'),_0x135fb4,_0x47d741['error'][_0x2d88('0x17')]);return _0x199287(_0x47d741[_0x2d88('0x16')][_0x2d88('0x17')]);}logger[_0x2d88('0x16')](_0x2d88('0x11'),_0x135fb4,_0x47d741[_0x2d88('0x16')]['message']);return _0x21c5e1(_0x47d741['error']['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x135fb4,_0x2d88('0x12'));_0x21c5e1(_0x47d741[_0x2d88('0x18')][_0x2d88('0x17')]);}})[_0x2d88('0x19')](function(_0xe989c1){logger[_0x2d88('0x16')](_0x2d88('0x11'),_0x135fb4,_0xe989c1);_0x199287(_0xe989c1);});});}exports[_0x2d88('0x1a')]=function(_0x1cbd89){var _0x2753a4=this;return new Promise(function(_0x1a40c6,_0x196ea5){return db[_0x2d88('0x1b')]['findAll']({'raw':_0x1cbd89[_0x2d88('0x1c')]?_0x1cbd89['options'][_0x2d88('0x1d')]===undefined?!![]:![]:!![],'where':_0x1cbd89[_0x2d88('0x1c')]?_0x1cbd89[_0x2d88('0x1c')][_0x2d88('0x1e')]||null:null,'attributes':_0x1cbd89[_0x2d88('0x1c')]?_0x1cbd89[_0x2d88('0x1c')]['attributes']||null:null,'limit':_0x1cbd89[_0x2d88('0x1c')]?_0x1cbd89['options'][_0x2d88('0x1f')]||null:null,'include':_0x1cbd89['options']?_0x1cbd89['options'][_0x2d88('0x20')]?_[_0x2d88('0x21')](_0x1cbd89[_0x2d88('0x1c')][_0x2d88('0x20')],function(_0x5de4c6){return{'model':db[_0x5de4c6[_0x2d88('0x22')]],'as':_0x5de4c6['as'],'attributes':_0x5de4c6['attributes'],'include':_0x5de4c6[_0x2d88('0x20')]?_[_0x2d88('0x21')](_0x5de4c6[_0x2d88('0x20')],function(_0x55e657){return{'model':db[_0x55e657['model']],'as':_0x55e657['as'],'attributes':_0x55e657[_0x2d88('0x23')],'include':_0x55e657[_0x2d88('0x20')]?_[_0x2d88('0x21')](_0x55e657[_0x2d88('0x20')],function(_0x1ef089){return{'model':db[_0x1ef089[_0x2d88('0x22')]],'as':_0x1ef089['as'],'attributes':_0x1ef089[_0x2d88('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2419db){logger[_0x2d88('0x10')](_0x2d88('0x1a'),_0x1cbd89);logger['debug'](_0x2d88('0x1a'),_0x1cbd89,JSON[_0x2d88('0x15')](_0x2419db));_0x1a40c6(_0x2419db);})[_0x2d88('0x19')](function(_0x38b52b){logger[_0x2d88('0x16')](_0x2d88('0x1a'),_0x38b52b[_0x2d88('0x17')],_0x1cbd89);_0x196ea5(_0x2753a4[_0x2d88('0x16')](0x1f4,_0x38b52b[_0x2d88('0x17')]));});});};exports[_0x2d88('0x24')]=function(_0x357699){var _0x30f7c8=this;return new Promise(function(_0x41dce9,_0x20985d){return db[_0x2d88('0x1b')]['find']({'raw':_0x357699[_0x2d88('0x1c')]?_0x357699[_0x2d88('0x1c')][_0x2d88('0x1d')]===undefined?!![]:![]:!![],'where':_0x357699[_0x2d88('0x1c')]?_0x357699[_0x2d88('0x1c')][_0x2d88('0x1e')]||null:null,'attributes':_0x357699[_0x2d88('0x1c')]?_0x357699['options'][_0x2d88('0x23')]||null:null,'include':_0x357699[_0x2d88('0x1c')]?_0x357699[_0x2d88('0x1c')]['include']?_[_0x2d88('0x21')](_0x357699[_0x2d88('0x1c')][_0x2d88('0x20')],function(_0x5c1b0c){return{'model':db[_0x5c1b0c[_0x2d88('0x22')]],'as':_0x5c1b0c['as'],'attributes':_0x5c1b0c[_0x2d88('0x23')],'include':_0x5c1b0c[_0x2d88('0x20')]?_[_0x2d88('0x21')](_0x5c1b0c[_0x2d88('0x20')],function(_0x420d48){return{'model':db[_0x420d48['model']],'as':_0x420d48['as'],'attributes':_0x420d48[_0x2d88('0x23')],'include':_0x420d48[_0x2d88('0x20')]?_['map'](_0x420d48[_0x2d88('0x20')],function(_0x2f0248){return{'model':db[_0x2f0248[_0x2d88('0x22')]],'as':_0x2f0248['as'],'attributes':_0x2f0248[_0x2d88('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2d88('0x25')](function(_0x3e26c0){logger['info'](_0x2d88('0x24'),_0x357699);logger[_0x2d88('0x13')]('ShowMailQueue',_0x357699,JSON['stringify'](_0x3e26c0));_0x41dce9(_0x3e26c0);})[_0x2d88('0x19')](function(_0x4f9b3d){logger[_0x2d88('0x16')](_0x2d88('0x24'),_0x4f9b3d[_0x2d88('0x17')],_0x357699);_0x20985d(_0x30f7c8[_0x2d88('0x16')](0x1f4,_0x4f9b3d[_0x2d88('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 994749b..9f6e1bc 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 _0xeaef=['save','remove','emit','register','length','./mailQueue.events'];(function(_0x568062,_0xca5174){var _0x1204e2=function(_0x444420){while(--_0x444420){_0x568062['push'](_0x568062['shift']());}};_0x1204e2(++_0xca5174);}(_0xeaef,0x131));var _0xfeae=function(_0x3468f0,_0x570fa7){_0x3468f0=_0x3468f0-0x0;var _0x1c500b=_0xeaef[_0x3468f0];return _0x1c500b;};'use strict';var MailQueueEvents=require(_0xfeae('0x0'));var events=[_0xfeae('0x1'),_0xfeae('0x2'),'update'];function createListener(_0x10613a,_0x25715d){return function(_0xb3439d){_0x25715d[_0xfeae('0x3')](_0x10613a,_0xb3439d);};}function removeListener(_0x1b5a15,_0x4f6afa){return function(){MailQueueEvents['removeListener'](_0x1b5a15,_0x4f6afa);};}exports[_0xfeae('0x4')]=function(_0x36b47c){for(var _0x450c05=0x0,_0x3aafa3=events[_0xfeae('0x5')];_0x450c05<_0x3aafa3;_0x450c05++){var _0x55f3df=events[_0x450c05];var _0x297a5c=createListener('mailQueue:'+_0x55f3df,_0x36b47c);MailQueueEvents['on'](_0x55f3df,_0x297a5c);}}; \ No newline at end of file +var _0xc8ac=['length','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3e844c,_0x188bc2){var _0x4e7c8a=function(_0x1dc8ad){while(--_0x1dc8ad){_0x3e844c['push'](_0x3e844c['shift']());}};_0x4e7c8a(++_0x188bc2);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xc8ac[_0x1f1e31];return _0x229b56;};'use strict';var MailQueueEvents=require(_0xcc8a('0x0'));var events=[_0xcc8a('0x1'),_0xcc8a('0x2'),_0xcc8a('0x3')];function createListener(_0x49e7b9,_0xabf5ee){return function(_0x5e8e2a){_0xabf5ee[_0xcc8a('0x4')](_0x49e7b9,_0x5e8e2a);};}function removeListener(_0x32d898,_0x29420d){return function(){MailQueueEvents[_0xcc8a('0x5')](_0x32d898,_0x29420d);};}exports[_0xcc8a('0x6')]=function(_0x5321e3){for(var _0x4e6a35=0x0,_0x1904fa=events[_0xcc8a('0x7')];_0x4e6a35<_0x1904fa;_0x4e6a35++){var _0x3bd2e3=events[_0x4e6a35];var _0x4e4982=createListener('mailQueue:'+_0x3bd2e3,_0x5321e3);MailQueueEvents['on'](_0x3bd2e3,_0x4e4982);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 70064b9..603c985 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 _0xdc74=['post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdc74,0x1e5));var _0x4dc7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdc74[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x4dc7('0x0'));var util=require('util');var path=require(_0x4dc7('0x1'));var timeout=require(_0x4dc7('0x2'));var express=require(_0x4dc7('0x3'));var router=express[_0x4dc7('0x4')]();var fs_extra=require(_0x4dc7('0x5'));var auth=require(_0x4dc7('0x6'));var interaction=require(_0x4dc7('0x7'));var config=require('../../config/environment');var controller=require(_0x4dc7('0x8'));router[_0x4dc7('0x9')]('/',auth['isAuthenticated'](),controller[_0x4dc7('0xa')]);router[_0x4dc7('0x9')]('/describe',auth[_0x4dc7('0xb')](),controller[_0x4dc7('0xc')]);router[_0x4dc7('0x9')](_0x4dc7('0xd'),auth[_0x4dc7('0xb')](),controller[_0x4dc7('0xe')]);router[_0x4dc7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4dc7('0x10')](_0x4dc7('0xd'),auth[_0x4dc7('0xb')](),controller[_0x4dc7('0x11')]);router['delete'](_0x4dc7('0xd'),auth[_0x4dc7('0xb')](),controller[_0x4dc7('0x12')]);module[_0x4dc7('0x13')]=router; \ No newline at end of file +var _0x2dd2=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x12dc1f,_0x395cec){var _0x47fdb8=function(_0x1ce68d){while(--_0x1ce68d){_0x12dc1f['push'](_0x12dc1f['shift']());}};_0x47fdb8(++_0x395cec);}(_0x2dd2,0x1eb));var _0x22dd=function(_0x47e343,_0x3405af){_0x47e343=_0x47e343-0x0;var _0x294377=_0x2dd2[_0x47e343];return _0x294377;};'use strict';var multer=require(_0x22dd('0x0'));var util=require(_0x22dd('0x1'));var path=require(_0x22dd('0x2'));var timeout=require(_0x22dd('0x3'));var express=require(_0x22dd('0x4'));var router=express['Router']();var fs_extra=require(_0x22dd('0x5'));var auth=require(_0x22dd('0x6'));var interaction=require(_0x22dd('0x7'));var config=require('../../config/environment');var controller=require(_0x22dd('0x8'));router['get']('/',auth[_0x22dd('0x9')](),controller[_0x22dd('0xa')]);router[_0x22dd('0xb')](_0x22dd('0xc'),auth[_0x22dd('0x9')](),controller[_0x22dd('0xd')]);router[_0x22dd('0xb')](_0x22dd('0xe'),auth[_0x22dd('0x9')](),controller[_0x22dd('0xf')]);router[_0x22dd('0x10')]('/',auth[_0x22dd('0x9')](),controller[_0x22dd('0x11')]);router[_0x22dd('0x12')](_0x22dd('0xe'),auth[_0x22dd('0x9')](),controller[_0x22dd('0x13')]);router[_0x22dd('0x14')]('/:id',auth[_0x22dd('0x9')](),controller[_0x22dd('0x15')]);module[_0x22dd('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index dd7dbba..8d2bd56 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 _0x7b58=['STRING','moment','sequelize','DATE'];(function(_0x145f26,_0x5b5422){var _0x435fa5=function(_0x3a01c6){while(--_0x3a01c6){_0x145f26['push'](_0x145f26['shift']());}};_0x435fa5(++_0x5b5422);}(_0x7b58,0xe9));var _0x87b5=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x7b58[_0x42ebba];return _0x3fd2af;};'use strict';var moment=require(_0x87b5('0x0'));var Sequelize=require(_0x87b5('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x87b5('0x2')]},'acceptAt':{'type':Sequelize[_0x87b5('0x2')]},'exitAt':{'type':Sequelize[_0x87b5('0x2')]},'reason':{'type':Sequelize[_0x87b5('0x3')]}}; \ No newline at end of file +var _0x273a=['STRING','DATE','exports'];(function(_0x58d668,_0x260935){var _0xa6f7f=function(_0x5a3bb4){while(--_0x5a3bb4){_0x58d668['push'](_0x58d668['shift']());}};_0xa6f7f(++_0x260935);}(_0x273a,0xb6));var _0xa273=function(_0x3724c1,_0x3130e9){_0x3724c1=_0x3724c1-0x0;var _0x324382=_0x273a[_0x3724c1];return _0x324382;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa273('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa273('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa273('0x2')]},'acceptAt':{'type':Sequelize[_0xa273('0x2')]},'exitAt':{'type':Sequelize[_0xa273('0x2')]},'reason':{'type':Sequelize[_0xa273('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index dc50392..c890099 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 _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','type'];(function(_0x5e76c6,_0xf16290){var _0x43fb22=function(_0x5cac4c){while(--_0x5cac4c){_0x5e76c6['push'](_0x5e76c6['shift']());}};_0x43fb22(++_0xf16290);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['MailQueueReport'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['MailQueueReport']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['MailQueueReport'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0xd8be4e,_0x443708){var _0x2c3ec2=function(_0x263fad){while(--_0x263fad){_0xd8be4e['push'](_0xd8be4e['shift']());}};_0x2c3ec2(++_0x443708);}(_0x6050,0x196));var _0x0605=function(_0x5eb30a,_0x106f30){_0x5eb30a=_0x5eb30a-0x0;var _0x1bc079=_0x6050[_0x5eb30a];return _0x1bc079;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0e539be..44ec2dc 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 _0x1dcd=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','api','moment','bluebird','request-promise','path'];(function(_0x3db60f,_0x4d1688){var _0xa27775=function(_0x59d31d){while(--_0x59d31d){_0x3db60f['push'](_0x3db60f['shift']());}};_0xa27775(++_0x4d1688);}(_0x1dcd,0x166));var _0xd1dc=function(_0x1364f9,_0x422296){_0x1364f9=_0x1364f9-0x0;var _0x1af7b9=_0x1dcd[_0x1364f9];return _0x1af7b9;};'use strict';var _=require(_0xd1dc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd1dc('0x1'));var moment=require(_0xd1dc('0x2'));var BPromise=require(_0xd1dc('0x3'));var rp=require(_0xd1dc('0x4'));var fs=require('fs');var path=require(_0xd1dc('0x5'));var rimraf=require(_0xd1dc('0x6'));var config=require(_0xd1dc('0x7'));var attributes=require(_0xd1dc('0x8'));module[_0xd1dc('0x9')]=function(_0x58659b,_0x37a38d){return _0x58659b[_0xd1dc('0xa')](_0xd1dc('0xb'),attributes,{'tableName':_0xd1dc('0xc'),'paranoid':![],'indexes':[{'name':_0xd1dc('0xd'),'fields':[_0xd1dc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1650=['rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x1ecf12,_0x10026d){var _0x1bdb5f=function(_0x428b55){while(--_0x428b55){_0x1ecf12['push'](_0x1ecf12['shift']());}};_0x1bdb5f(++_0x10026d);}(_0x1650,0xf8));var _0x0165=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x1650[_0x3b5049];return _0x12454e;};'use strict';var _=require(_0x0165('0x0'));var util=require(_0x0165('0x1'));var logger=require('../../config/logger')(_0x0165('0x2'));var moment=require(_0x0165('0x3'));var BPromise=require(_0x0165('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0165('0x5'));var config=require('../../config/environment');var attributes=require(_0x0165('0x6'));module['exports']=function(_0x2dc670,_0x382f89){return _0x2dc670[_0x0165('0x7')](_0x0165('0x8'),attributes,{'tableName':_0x0165('0x9'),'paranoid':![],'indexes':[{'name':_0x0165('0xa'),'fields':[_0x0165('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3e8ce7b..bc8563c 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x3b4691,_0x297c4d){var _0x5d4691=function(_0x1d2e6c){while(--_0x1d2e6c){_0x3b4691['push'](_0x3b4691['shift']());}};_0x5d4691(++_0x297c4d);}(_0xdb28,0x106));var _0x8db2=function(_0x460c73,_0x47721e){_0x460c73=_0x460c73-0x0;var _0x51fd86=_0xdb28[_0x460c73];return _0x51fd86;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b8dfa,_0x2bd85b){var _0x29864c=function(_0x3fb686){while(--_0x3fb686){_0x3b8dfa['push'](_0x3b8dfa['shift']());}};_0x29864c(++_0x2bd85b);}(_0x1261,0x144));var _0x1126=function(_0x5201a7,_0x21f8bf){_0x5201a7=_0x5201a7-0x0;var _0x435d26=_0x1261[_0x5201a7];return _0x435d26;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 77bb456..66f6ff2 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x38257d,_0x4aa6da){var _0x1175b3=function(_0x5b900a){while(--_0x5b900a){_0x38257d['push'](_0x38257d['shift']());}};_0x1175b3(++_0x4aa6da);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x26ce0f,_0x5c2378){var _0x268931=function(_0x545e0b){while(--_0x545e0b){_0x26ce0f['push'](_0x26ce0f['shift']());}};_0x268931(++_0x5c2378);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index c174406..0a525ed 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 _0x2bf4=['STRING','BOOLEAN','INBOX','INTEGER','sequelize','exports'];(function(_0x4771ab,_0x56416d){var _0x46a8a6=function(_0x9bbdaf){while(--_0x9bbdaf){_0x4771ab['push'](_0x4771ab['shift']());}};_0x46a8a6(++_0x56416d);}(_0x2bf4,0x15a));var _0x42bf=function(_0xb20b3f,_0x4ac2ce){_0xb20b3f=_0xb20b3f-0x0;var _0x413304=_0x2bf4[_0xb20b3f];return _0x413304;};'use strict';var Sequelize=require(_0x42bf('0x0'));module[_0x42bf('0x1')]={'description':{'type':Sequelize[_0x42bf('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x42bf('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x42bf('0x2')]},'password':{'type':Sequelize[_0x42bf('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x42bf('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x42bf('0x2')],'defaultValue':_0x42bf('0x4')},'connTimeout':{'type':Sequelize[_0x42bf('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x42bf('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x42bf('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa7b3=['exports','STRING','INBOX','INTEGER','BOOLEAN','sequelize'];(function(_0x20a725,_0x44667f){var _0x21ebb5=function(_0x3bc229){while(--_0x3bc229){_0x20a725['push'](_0x20a725['shift']());}};_0x21ebb5(++_0x44667f);}(_0xa7b3,0xe9));var _0x3a7b=function(_0x85d8e6,_0x2f2c9a){_0x85d8e6=_0x85d8e6-0x0;var _0x24866b=_0xa7b3[_0x85d8e6];return _0x24866b;};'use strict';var Sequelize=require(_0x3a7b('0x0'));module[_0x3a7b('0x1')]={'description':{'type':Sequelize[_0x3a7b('0x2')]},'host':{'type':Sequelize[_0x3a7b('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3a7b('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3a7b('0x2')],'defaultValue':_0x3a7b('0x3')},'connTimeout':{'type':Sequelize[_0x3a7b('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3a7b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x3a7b('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 838ddf8..959436d 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 _0x9b94=['mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','MailServerIn'];(function(_0x5c3581,_0x4f3df2){var _0xb85a10=function(_0x3474f9){while(--_0x3474f9){_0x5c3581['push'](_0x5c3581['shift']());}};_0xb85a10(++_0x4f3df2);}(_0x9b94,0x175));var _0x49b9=function(_0x23ca06,_0x36292d){_0x23ca06=_0x23ca06-0x0;var _0xc385c4=_0x9b94[_0x23ca06];return _0xc385c4;};'use strict';var _=require(_0x49b9('0x0'));var util=require(_0x49b9('0x1'));var logger=require(_0x49b9('0x2'))(_0x49b9('0x3'));var moment=require(_0x49b9('0x4'));var BPromise=require(_0x49b9('0x5'));var rp=require(_0x49b9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49b9('0x7'));var config=require(_0x49b9('0x8'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x3d7b2c,_0x140623){return _0x3d7b2c[_0x49b9('0x9')](_0x49b9('0xa'),attributes,{'tableName':_0x49b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fe7=['define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x6fe7,0x189));var _0x76fe=function(_0x1927b8,_0x87cee8){_0x1927b8=_0x1927b8-0x0;var _0x4103f6=_0x6fe7[_0x1927b8];return _0x4103f6;};'use strict';var _=require(_0x76fe('0x0'));var util=require(_0x76fe('0x1'));var logger=require(_0x76fe('0x2'))(_0x76fe('0x3'));var moment=require(_0x76fe('0x4'));var BPromise=require(_0x76fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76fe('0x6'));var rimraf=require(_0x76fe('0x7'));var config=require(_0x76fe('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x76fe('0x9')]=function(_0x3c0420,_0x207949){return _0x3c0420[_0x76fe('0xa')](_0x76fe('0xb'),attributes,{'tableName':_0x76fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index ee254f7..3f4412e 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 _0xc9fb=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','info','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x5d788d,_0x2f748f){var _0x2909d9=function(_0x4e7c09){while(--_0x4e7c09){_0x5d788d['push'](_0x5d788d['shift']());}};_0x2909d9(++_0x2f748f);}(_0xc9fb,0x148));var _0xbc9f=function(_0x238e28,_0x294a26){_0x238e28=_0x238e28-0x0;var _0x59482b=_0xc9fb[_0x238e28];return _0x59482b;};'use strict';var _=require(_0xbc9f('0x0'));var util=require(_0xbc9f('0x1'));var moment=require(_0xbc9f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc9f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9f('0x4'))['db'];var utils=require(_0xbc9f('0x5'));var logger=require(_0xbc9f('0x6'))(_0xbc9f('0x7'));var config=require(_0xbc9f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbc9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x297171,_0x1a0347,_0xa41afa){return new BPromise(function(_0x257d99,_0x46c304){return client[_0xbc9f('0xa')](_0x297171,_0xa41afa)[_0xbc9f('0xb')](function(_0x31ed09){logger['info'](_0xbc9f('0xc'),_0x1a0347,_0xbc9f('0xd'));logger[_0xbc9f('0xe')](_0xbc9f('0xf'),_0x1a0347,'request\x20sent',JSON['stringify'](_0x31ed09));if(_0x31ed09['error']){if(_0x31ed09[_0xbc9f('0x10')][_0xbc9f('0x11')]===0x1f4){logger[_0xbc9f('0x10')](_0xbc9f('0xc'),_0x1a0347,_0x31ed09[_0xbc9f('0x10')][_0xbc9f('0x12')]);return _0x46c304(_0x31ed09[_0xbc9f('0x10')][_0xbc9f('0x12')]);}logger['error'](_0xbc9f('0xc'),_0x1a0347,_0x31ed09[_0xbc9f('0x10')][_0xbc9f('0x12')]);return _0x257d99(_0x31ed09[_0xbc9f('0x10')]['message']);}else{logger['info'](_0xbc9f('0xc'),_0x1a0347,_0xbc9f('0xd'));_0x257d99(_0x31ed09[_0xbc9f('0x13')][_0xbc9f('0x12')]);}})[_0xbc9f('0x14')](function(_0x3958a1){logger[_0xbc9f('0x10')]('MailServerIn,\x20%s,\x20%s',_0x1a0347,_0x3958a1);_0x46c304(_0x3958a1);});});}exports[_0xbc9f('0x15')]=function(_0x19fe02){var _0x264d9e=this;return new Promise(function(_0x1f487a,_0x390b47){return db[_0xbc9f('0x16')][_0xbc9f('0x17')]({'raw':_0x19fe02[_0xbc9f('0x18')]?_0x19fe02[_0xbc9f('0x18')][_0xbc9f('0x19')]===undefined?!![]:![]:!![],'where':_0x19fe02[_0xbc9f('0x18')]?_0x19fe02['options'][_0xbc9f('0x1a')]||null:null,'attributes':_0x19fe02[_0xbc9f('0x18')]?_0x19fe02['options']['attributes']||null:null,'limit':_0x19fe02[_0xbc9f('0x18')]?_0x19fe02[_0xbc9f('0x18')][_0xbc9f('0x1b')]||null:null,'include':_0x19fe02['options']?_0x19fe02[_0xbc9f('0x18')][_0xbc9f('0x1c')]?_[_0xbc9f('0x1d')](_0x19fe02[_0xbc9f('0x18')][_0xbc9f('0x1c')],function(_0x15f119){return{'model':db[_0x15f119[_0xbc9f('0x1e')]],'as':_0x15f119['as'],'attributes':_0x15f119[_0xbc9f('0x1f')],'include':_0x15f119[_0xbc9f('0x1c')]?_[_0xbc9f('0x1d')](_0x15f119[_0xbc9f('0x1c')],function(_0xef650e){return{'model':db[_0xef650e['model']],'as':_0xef650e['as'],'attributes':_0xef650e[_0xbc9f('0x1f')],'include':_0xef650e['include']?_[_0xbc9f('0x1d')](_0xef650e[_0xbc9f('0x1c')],function(_0x2e746c){return{'model':db[_0x2e746c['model']],'as':_0x2e746c['as'],'attributes':_0x2e746c[_0xbc9f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbc9f('0xb')](function(_0x2adadc){logger[_0xbc9f('0x20')](_0xbc9f('0x15'),_0x19fe02);logger[_0xbc9f('0xe')](_0xbc9f('0x15'),_0x19fe02,JSON[_0xbc9f('0x21')](_0x2adadc));_0x1f487a(_0x2adadc);})[_0xbc9f('0x14')](function(_0x519f90){logger[_0xbc9f('0x10')](_0xbc9f('0x15'),_0x519f90[_0xbc9f('0x12')],_0x19fe02);_0x390b47(_0x264d9e['error'](0x1f4,_0x519f90[_0xbc9f('0x12')]));});});}; \ No newline at end of file +var _0xbbc6=['attributes','limit','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll','options'];(function(_0x92508d,_0x579f05){var _0x2ff403=function(_0x32d69c){while(--_0x32d69c){_0x92508d['push'](_0x92508d['shift']());}};_0x2ff403(++_0x579f05);}(_0xbbc6,0xa6));var _0x6bbc=function(_0x1c496e,_0x5c7342){_0x1c496e=_0x1c496e-0x0;var _0x50df68=_0xbbc6[_0x1c496e];return _0x50df68;};'use strict';var _=require(_0x6bbc('0x0'));var util=require(_0x6bbc('0x1'));var moment=require(_0x6bbc('0x2'));var BPromise=require(_0x6bbc('0x3'));var rs=require(_0x6bbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6bbc('0x5'));var logger=require(_0x6bbc('0x6'))('rpc');var config=require(_0x6bbc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6bbc('0x8')][_0x6bbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d63ac,_0x447ef2,_0x38b3f4){return new BPromise(function(_0x560278,_0x1ed07f){return client[_0x6bbc('0xa')](_0x2d63ac,_0x38b3f4)[_0x6bbc('0xb')](function(_0x5aab77){logger[_0x6bbc('0xc')]('MailServerIn,\x20%s,\x20%s',_0x447ef2,_0x6bbc('0xd'));logger[_0x6bbc('0xe')](_0x6bbc('0xf'),_0x447ef2,'request\x20sent',JSON['stringify'](_0x5aab77));if(_0x5aab77[_0x6bbc('0x10')]){if(_0x5aab77['error'][_0x6bbc('0x11')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x447ef2,_0x5aab77[_0x6bbc('0x10')][_0x6bbc('0x12')]);return _0x1ed07f(_0x5aab77['error'][_0x6bbc('0x12')]);}logger[_0x6bbc('0x10')]('MailServerIn,\x20%s,\x20%s',_0x447ef2,_0x5aab77['error'][_0x6bbc('0x12')]);return _0x560278(_0x5aab77[_0x6bbc('0x10')][_0x6bbc('0x12')]);}else{logger['info'](_0x6bbc('0x13'),_0x447ef2,_0x6bbc('0xd'));_0x560278(_0x5aab77[_0x6bbc('0x14')][_0x6bbc('0x12')]);}})[_0x6bbc('0x15')](function(_0x2d8f2c){logger['error']('MailServerIn,\x20%s,\x20%s',_0x447ef2,_0x2d8f2c);_0x1ed07f(_0x2d8f2c);});});}exports[_0x6bbc('0x16')]=function(_0x51a5fe){var _0x3af05e=this;return new Promise(function(_0x5aa926,_0x2d39af){return db[_0x6bbc('0x17')][_0x6bbc('0x18')]({'raw':_0x51a5fe[_0x6bbc('0x19')]?_0x51a5fe[_0x6bbc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51a5fe['options']?_0x51a5fe[_0x6bbc('0x19')]['where']||null:null,'attributes':_0x51a5fe['options']?_0x51a5fe[_0x6bbc('0x19')][_0x6bbc('0x1a')]||null:null,'limit':_0x51a5fe[_0x6bbc('0x19')]?_0x51a5fe[_0x6bbc('0x19')][_0x6bbc('0x1b')]||null:null,'include':_0x51a5fe[_0x6bbc('0x19')]?_0x51a5fe[_0x6bbc('0x19')][_0x6bbc('0x1c')]?_['map'](_0x51a5fe[_0x6bbc('0x19')]['include'],function(_0x124b0a){return{'model':db[_0x124b0a[_0x6bbc('0x1d')]],'as':_0x124b0a['as'],'attributes':_0x124b0a['attributes'],'include':_0x124b0a['include']?_['map'](_0x124b0a[_0x6bbc('0x1c')],function(_0x12527a){return{'model':db[_0x12527a[_0x6bbc('0x1d')]],'as':_0x12527a['as'],'attributes':_0x12527a[_0x6bbc('0x1a')],'include':_0x12527a['include']?_[_0x6bbc('0x1e')](_0x12527a[_0x6bbc('0x1c')],function(_0x60c582){return{'model':db[_0x60c582[_0x6bbc('0x1d')]],'as':_0x60c582['as'],'attributes':_0x60c582[_0x6bbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6bbc('0xb')](function(_0x5c8e1b){logger[_0x6bbc('0xc')](_0x6bbc('0x16'),_0x51a5fe);logger[_0x6bbc('0xe')](_0x6bbc('0x16'),_0x51a5fe,JSON[_0x6bbc('0x1f')](_0x5c8e1b));_0x5aa926(_0x5c8e1b);})[_0x6bbc('0x15')](function(_0x3f002a){logger[_0x6bbc('0x10')](_0x6bbc('0x16'),_0x3f002a[_0x6bbc('0x12')],_0x51a5fe);_0x2d39af(_0x3af05e['error'](0x1f4,_0x3f002a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 64dd3ca..a2b263c 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _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(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x318542,_0x35f570){_0x318542=_0x318542-0x0;var _0x44e7a1=_0x7a54[_0x318542];return _0x44e7a1;};'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 efd36bf..1266dca 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 _0x84a0=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x84a0,0x66));var _0x084a=function(_0xf5bd9a,_0x5a0bfb){_0xf5bd9a=_0xf5bd9a-0x0;var _0x30f9ee=_0x84a0[_0xf5bd9a];return _0x30f9ee;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'description':{'type':Sequelize[_0x084a('0x2')]},'host':{'type':Sequelize[_0x084a('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x084a('0x2')]},'port':{'type':Sequelize[_0x084a('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x084a('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x084a('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2e54=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x51b9cc,_0xae1ab9){var _0x4e3d44=function(_0x17ddd8){while(--_0x17ddd8){_0x51b9cc['push'](_0x51b9cc['shift']());}};_0x4e3d44(++_0xae1ab9);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4dc423,_0x347ec1){_0x4dc423=_0x4dc423-0x0;var _0x35e27a=_0x2e54[_0x4dc423];return _0x35e27a;};'use strict';var Sequelize=require(_0x42e5('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x42e5('0x1')]},'user':{'type':Sequelize[_0x42e5('0x1')]},'pass':{'type':Sequelize[_0x42e5('0x1')]},'port':{'type':Sequelize[_0x42e5('0x2')]},'secure':{'type':Sequelize[_0x42e5('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x42e5('0x1')]},'authentication':{'type':Sequelize[_0x42e5('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 d13b696..df641df 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 _0x2d06=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','catch','params','includeAll','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x4d7517,_0x162c71){var _0x521996=function(_0x48476c){while(--_0x48476c){_0x4d7517['push'](_0x4d7517['shift']());}};_0x521996(++_0x162c71);}(_0x2d06,0x184));var _0x62d0=function(_0x20abcf,_0x4d8bf4){_0x20abcf=_0x20abcf-0x0;var _0x1e7014=_0x2d06[_0x20abcf];return _0x1e7014;};'use strict';var emlformat=require(_0x62d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x62d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62d0('0x2'));var moment=require(_0x62d0('0x3'));var BPromise=require(_0x62d0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x62d0('0x5'));var sox=require(_0x62d0('0x6'));var csv=require(_0x62d0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62d0('0x8'));var squel=require('squel');var crypto=require(_0x62d0('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x62d0('0x7'));var querystring=require('querystring');var Papa=require(_0x62d0('0xa'));var Redis=require(_0x62d0('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x62d0('0xc'));var as=require(_0x62d0('0xd'));var hardwareService=require(_0x62d0('0xe'));var logger=require(_0x62d0('0xf'))(_0x62d0('0x10'));var utils=require(_0x62d0('0x11'));var config=require(_0x62d0('0x12'));var licenseUtil=require(_0x62d0('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d000a,_0x431702){_0x431702=_0x431702||0xcc;return function(_0xb2f3a3){if(_0xb2f3a3){return _0x5d000a[_0x62d0('0x14')](_0x431702);}return _0x5d000a[_0x62d0('0x15')](_0x431702)[_0x62d0('0x16')]();};}function respondWithResult(_0x469e36,_0x394041){_0x394041=_0x394041||0xc8;return function(_0x24d1e0){if(_0x24d1e0){return _0x469e36['status'](_0x394041)[_0x62d0('0x17')](_0x24d1e0);}};}function respondWithFilteredResult(_0x1d4539,_0x2e5e86){return function(_0x3bf173){if(_0x3bf173){var _0x1b8a9c=typeof _0x2e5e86[_0x62d0('0x18')]===_0x62d0('0x19')&&typeof _0x2e5e86[_0x62d0('0x1a')]===_0x62d0('0x19');var _0x8cc5d4=_0x3bf173[_0x62d0('0x1b')];var _0x2f16f1=_0x1b8a9c?0x0:_0x2e5e86[_0x62d0('0x18')];var _0x105b20=_0x1b8a9c?_0x3bf173[_0x62d0('0x1b')]:_0x2e5e86[_0x62d0('0x18')]+_0x2e5e86[_0x62d0('0x1a')];var _0x2a888f;if(_0x105b20>=_0x8cc5d4){_0x105b20=_0x8cc5d4;_0x2a888f=0xc8;}else{_0x2a888f=0xce;}_0x1d4539[_0x62d0('0x15')](_0x2a888f);return _0x1d4539[_0x62d0('0x1c')](_0x62d0('0x1d'),_0x2f16f1+'-'+_0x105b20+'/'+_0x8cc5d4)[_0x62d0('0x17')](_0x3bf173);}return null;};}function patchUpdates(_0x48705c){return function(_0x1bf55c){try{jsonpatch[_0x62d0('0x1e')](_0x1bf55c,_0x48705c,!![]);}catch(_0x2dc59e){return BPromise[_0x62d0('0x1f')](_0x2dc59e);}return _0x1bf55c[_0x62d0('0x20')]();};}function saveUpdates(_0x1f0df1,_0x16ef45){return function(_0x1d71ed){if(_0x1d71ed){return _0x1d71ed[_0x62d0('0x21')](_0x1f0df1)[_0x62d0('0x22')](function(_0x57ec10){return _0x57ec10;});}return null;};}function removeEntity(_0x4051fc,_0x5011bb){return function(_0x2275d1){if(_0x2275d1){return _0x2275d1[_0x62d0('0x23')]()[_0x62d0('0x22')](function(){_0x4051fc[_0x62d0('0x15')](0xcc)[_0x62d0('0x16')]();});}};}function handleEntityNotFound(_0x335586,_0x3602a2){return function(_0x4c3ef4){if(!_0x4c3ef4){_0x335586['sendStatus'](0x194);}return _0x4c3ef4;};}function handleError(_0x497df5,_0x29c5ab){_0x29c5ab=_0x29c5ab||0x1f4;return function(_0x41e3e1){logger[_0x62d0('0x24')](_0x41e3e1['stack']);if(_0x41e3e1[_0x62d0('0x25')]){delete _0x41e3e1['name'];}_0x497df5[_0x62d0('0x15')](_0x29c5ab)[_0x62d0('0x26')](_0x41e3e1);};}exports[_0x62d0('0x27')]=function(_0x397c97,_0x38d103){var _0x4be21e={},_0x287f4a={},_0x175b22={'count':0x0,'rows':[]};var _0x341300=_[_0x62d0('0x28')](db[_0x62d0('0x29')][_0x62d0('0x2a')],function(_0x84c8af){return{'name':_0x84c8af[_0x62d0('0x2b')],'type':_0x84c8af['type'][_0x62d0('0x2c')]};});_0x287f4a['model']=_[_0x62d0('0x28')](_0x341300,_0x62d0('0x25'));_0x287f4a['query']=_[_0x62d0('0x2d')](_0x397c97['query']);_0x287f4a[_0x62d0('0x2e')]=_[_0x62d0('0x2f')](_0x287f4a[_0x62d0('0x30')],_0x287f4a[_0x62d0('0x31')]);_0x4be21e[_0x62d0('0x32')]=_[_0x62d0('0x2f')](_0x287f4a['model'],qs[_0x62d0('0x33')](_0x397c97[_0x62d0('0x31')][_0x62d0('0x33')]));_0x4be21e[_0x62d0('0x32')]=_0x4be21e[_0x62d0('0x32')][_0x62d0('0x34')]?_0x4be21e[_0x62d0('0x32')]:_0x287f4a[_0x62d0('0x30')];if(!_0x397c97[_0x62d0('0x31')][_0x62d0('0x35')](_0x62d0('0x36'))){_0x4be21e['limit']=qs['limit'](_0x397c97[_0x62d0('0x31')][_0x62d0('0x1a')]);_0x4be21e[_0x62d0('0x18')]=qs[_0x62d0('0x18')](_0x397c97['query'][_0x62d0('0x18')]);}_0x4be21e['order']=qs[_0x62d0('0x37')](_0x397c97['query'][_0x62d0('0x37')]);_0x4be21e[_0x62d0('0x38')]=qs['filters'](_[_0x62d0('0x39')](_0x397c97[_0x62d0('0x31')],_0x287f4a[_0x62d0('0x2e')]),_0x341300);if(_0x397c97['query'][_0x62d0('0x3a')]){_0x4be21e['where']=_[_0x62d0('0x3b')](_0x4be21e['where'],{'$or':_[_0x62d0('0x28')](_0x341300,function(_0x4d1737){if(_0x4d1737[_0x62d0('0x3c')]!==_0x62d0('0x3d')){var _0x514bf7={};_0x514bf7[_0x4d1737[_0x62d0('0x25')]]={'$like':'%'+_0x397c97[_0x62d0('0x31')][_0x62d0('0x3a')]+'%'};return _0x514bf7;}})});}_0x4be21e=_[_0x62d0('0x3b')]({},_0x4be21e,_0x397c97[_0x62d0('0x3e')]);var _0x459cb9={'where':_0x4be21e[_0x62d0('0x38')]};return db['MailServerOut'][_0x62d0('0x1b')](_0x459cb9)[_0x62d0('0x22')](function(_0x4683f1){_0x175b22[_0x62d0('0x1b')]=_0x4683f1;if(_0x397c97['query']['includeAll']){_0x4be21e['include']=[{'all':!![]}];}return db[_0x62d0('0x29')]['findAll'](_0x4be21e);})[_0x62d0('0x22')](function(_0xac4a85){_0x175b22['rows']=_0xac4a85;return _0x175b22;})[_0x62d0('0x22')](respondWithFilteredResult(_0x38d103,_0x4be21e))[_0x62d0('0x3f')](handleError(_0x38d103,null));};exports['show']=function(_0x2dbfe4,_0xa0ef05){var _0x15c2da={'raw':!![],'where':{'id':_0x2dbfe4[_0x62d0('0x40')]['id']}},_0x3abbf2={};_0x3abbf2[_0x62d0('0x30')]=_[_0x62d0('0x2d')](db[_0x62d0('0x29')][_0x62d0('0x2a')]);_0x3abbf2['query']=_[_0x62d0('0x2d')](_0x2dbfe4['query']);_0x3abbf2['filters']=_[_0x62d0('0x2f')](_0x3abbf2[_0x62d0('0x30')],_0x3abbf2[_0x62d0('0x31')]);_0x15c2da['attributes']=_[_0x62d0('0x2f')](_0x3abbf2[_0x62d0('0x30')],qs['fields'](_0x2dbfe4[_0x62d0('0x31')][_0x62d0('0x33')]));_0x15c2da[_0x62d0('0x32')]=_0x15c2da[_0x62d0('0x32')]['length']?_0x15c2da[_0x62d0('0x32')]:_0x3abbf2[_0x62d0('0x30')];if(_0x2dbfe4[_0x62d0('0x31')][_0x62d0('0x41')]){_0x15c2da['include']=[{'all':!![]}];}_0x15c2da=_[_0x62d0('0x3b')]({},_0x15c2da,_0x2dbfe4[_0x62d0('0x3e')]);return db[_0x62d0('0x29')][_0x62d0('0x42')](_0x15c2da)[_0x62d0('0x22')](handleEntityNotFound(_0xa0ef05,null))[_0x62d0('0x22')](respondWithResult(_0xa0ef05,null))[_0x62d0('0x3f')](handleError(_0xa0ef05,null));};exports[_0x62d0('0x43')]=function(_0x5d150d,_0xa1fa){return db['MailServerOut'][_0x62d0('0x43')](_0x5d150d['body'],{})[_0x62d0('0x22')](respondWithResult(_0xa1fa,0xc9))['catch'](handleError(_0xa1fa,null));};exports[_0x62d0('0x21')]=function(_0xecc2d,_0x1dfa83){if(_0xecc2d[_0x62d0('0x44')]['id']){delete _0xecc2d[_0x62d0('0x44')]['id'];}return db[_0x62d0('0x29')][_0x62d0('0x42')]({'where':{'id':_0xecc2d[_0x62d0('0x40')]['id']}})[_0x62d0('0x22')](handleEntityNotFound(_0x1dfa83,null))['then'](saveUpdates(_0xecc2d[_0x62d0('0x44')],null))[_0x62d0('0x22')](respondWithResult(_0x1dfa83,null))['catch'](handleError(_0x1dfa83,null));};exports[_0x62d0('0x23')]=function(_0x28c758,_0x54d9b1){return db[_0x62d0('0x29')][_0x62d0('0x42')]({'where':{'id':_0x28c758[_0x62d0('0x40')]['id']}})[_0x62d0('0x22')](handleEntityNotFound(_0x54d9b1,null))[_0x62d0('0x22')](removeEntity(_0x54d9b1,null))[_0x62d0('0x3f')](handleError(_0x54d9b1,null));}; \ No newline at end of file +var _0xacb7=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xacb7,0x176));var _0x7acb=function(_0x208c12,_0x4f9928){_0x208c12=_0x208c12-0x0;var _0x40a9f7=_0xacb7[_0x208c12];return _0x40a9f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7acb('0x0'));var jsonpatch=require(_0x7acb('0x1'));var rp=require(_0x7acb('0x2'));var moment=require('moment');var BPromise=require(_0x7acb('0x3'));var Mustache=require(_0x7acb('0x4'));var util=require(_0x7acb('0x5'));var path=require(_0x7acb('0x6'));var sox=require(_0x7acb('0x7'));var csv=require(_0x7acb('0x8'));var ejs=require(_0x7acb('0x9'));var fs=require('fs');var fs_extra=require(_0x7acb('0xa'));var _=require(_0x7acb('0xb'));var squel=require(_0x7acb('0xc'));var crypto=require(_0x7acb('0xd'));var jsforce=require(_0x7acb('0xe'));var deskjs=require(_0x7acb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7acb('0x10'));var Papa=require(_0x7acb('0x11'));var Redis=require(_0x7acb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7acb('0x13'));var as=require(_0x7acb('0x14'));var hardwareService=require(_0x7acb('0x15'));var logger=require(_0x7acb('0x16'))(_0x7acb('0x17'));var utils=require(_0x7acb('0x18'));var config=require(_0x7acb('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7acb('0x1a'))['db'];function respondWithStatusCode(_0x20b018,_0x172eb6){_0x172eb6=_0x172eb6||0xcc;return function(_0x59652a){if(_0x59652a){return _0x20b018['sendStatus'](_0x172eb6);}return _0x20b018[_0x7acb('0x1b')](_0x172eb6)[_0x7acb('0x1c')]();};}function respondWithResult(_0x203d59,_0x56e784){_0x56e784=_0x56e784||0xc8;return function(_0x4758ee){if(_0x4758ee){return _0x203d59[_0x7acb('0x1b')](_0x56e784)['json'](_0x4758ee);}};}function respondWithFilteredResult(_0x506a5c,_0x4b9006){return function(_0x127032){if(_0x127032){var _0x5ca2b2=typeof _0x4b9006[_0x7acb('0x1d')]==='undefined'&&typeof _0x4b9006[_0x7acb('0x1e')]===_0x7acb('0x1f');var _0x372393=_0x127032[_0x7acb('0x20')];var _0x3ac41c=_0x5ca2b2?0x0:_0x4b9006[_0x7acb('0x1d')];var _0x45e68a=_0x5ca2b2?_0x127032[_0x7acb('0x20')]:_0x4b9006['offset']+_0x4b9006[_0x7acb('0x1e')];var _0x2c3712;if(_0x45e68a>=_0x372393){_0x45e68a=_0x372393;_0x2c3712=0xc8;}else{_0x2c3712=0xce;}_0x506a5c[_0x7acb('0x1b')](_0x2c3712);return _0x506a5c['set']('Content-Range',_0x3ac41c+'-'+_0x45e68a+'/'+_0x372393)['json'](_0x127032);}return null;};}function patchUpdates(_0x4424ff){return function(_0x9ebb23){try{jsonpatch[_0x7acb('0x21')](_0x9ebb23,_0x4424ff,!![]);}catch(_0x1a503c){return BPromise[_0x7acb('0x22')](_0x1a503c);}return _0x9ebb23[_0x7acb('0x23')]();};}function saveUpdates(_0xc1e504,_0x4504e7){return function(_0x20de20){if(_0x20de20){return _0x20de20['update'](_0xc1e504)[_0x7acb('0x24')](function(_0x34a777){return _0x34a777;});}return null;};}function removeEntity(_0x5d4733,_0x24f93b){return function(_0x3fec17){if(_0x3fec17){return _0x3fec17[_0x7acb('0x25')]()['then'](function(){_0x5d4733[_0x7acb('0x1b')](0xcc)[_0x7acb('0x1c')]();});}};}function handleEntityNotFound(_0x124f6d,_0x23d19b){return function(_0x3585fb){if(!_0x3585fb){_0x124f6d[_0x7acb('0x26')](0x194);}return _0x3585fb;};}function handleError(_0x47b8b2,_0x11a456){_0x11a456=_0x11a456||0x1f4;return function(_0x3070bc){logger[_0x7acb('0x27')](_0x3070bc[_0x7acb('0x28')]);if(_0x3070bc[_0x7acb('0x29')]){delete _0x3070bc[_0x7acb('0x29')];}_0x47b8b2[_0x7acb('0x1b')](_0x11a456)[_0x7acb('0x2a')](_0x3070bc);};}exports[_0x7acb('0x2b')]=function(_0x9599d1,_0x1f7b2b){var _0x1cfbdb={},_0x36b6e7={},_0x45d85b={'count':0x0,'rows':[]};var _0x40a9ec=_['map'](db[_0x7acb('0x2c')][_0x7acb('0x2d')],function(_0x58f584){return{'name':_0x58f584[_0x7acb('0x2e')],'type':_0x58f584[_0x7acb('0x2f')][_0x7acb('0x30')]};});_0x36b6e7[_0x7acb('0x31')]=_[_0x7acb('0x32')](_0x40a9ec,_0x7acb('0x29'));_0x36b6e7[_0x7acb('0x33')]=_[_0x7acb('0x34')](_0x9599d1['query']);_0x36b6e7['filters']=_[_0x7acb('0x35')](_0x36b6e7[_0x7acb('0x31')],_0x36b6e7['query']);_0x1cfbdb['attributes']=_[_0x7acb('0x35')](_0x36b6e7[_0x7acb('0x31')],qs[_0x7acb('0x36')](_0x9599d1[_0x7acb('0x33')][_0x7acb('0x36')]));_0x1cfbdb[_0x7acb('0x37')]=_0x1cfbdb['attributes'][_0x7acb('0x38')]?_0x1cfbdb[_0x7acb('0x37')]:_0x36b6e7[_0x7acb('0x31')];if(!_0x9599d1[_0x7acb('0x33')]['hasOwnProperty'](_0x7acb('0x39'))){_0x1cfbdb[_0x7acb('0x1e')]=qs[_0x7acb('0x1e')](_0x9599d1[_0x7acb('0x33')][_0x7acb('0x1e')]);_0x1cfbdb['offset']=qs['offset'](_0x9599d1[_0x7acb('0x33')][_0x7acb('0x1d')]);}_0x1cfbdb['order']=qs[_0x7acb('0x3a')](_0x9599d1['query'][_0x7acb('0x3a')]);_0x1cfbdb[_0x7acb('0x3b')]=qs[_0x7acb('0x3c')](_[_0x7acb('0x3d')](_0x9599d1['query'],_0x36b6e7['filters']),_0x40a9ec);if(_0x9599d1[_0x7acb('0x33')]['filter']){_0x1cfbdb[_0x7acb('0x3b')]=_[_0x7acb('0x3e')](_0x1cfbdb['where'],{'$or':_[_0x7acb('0x32')](_0x40a9ec,function(_0xbcd9e4){if(_0xbcd9e4[_0x7acb('0x2f')]!==_0x7acb('0x3f')){var _0x39ee37={};_0x39ee37[_0xbcd9e4['name']]={'$like':'%'+_0x9599d1[_0x7acb('0x33')][_0x7acb('0x40')]+'%'};return _0x39ee37;}})});}_0x1cfbdb=_['merge']({},_0x1cfbdb,_0x9599d1[_0x7acb('0x41')]);var _0x39c5f7={'where':_0x1cfbdb['where']};return db[_0x7acb('0x2c')][_0x7acb('0x20')](_0x39c5f7)['then'](function(_0x35600d){_0x45d85b['count']=_0x35600d;if(_0x9599d1[_0x7acb('0x33')][_0x7acb('0x42')]){_0x1cfbdb['include']=[{'all':!![]}];}return db[_0x7acb('0x2c')][_0x7acb('0x43')](_0x1cfbdb);})[_0x7acb('0x24')](function(_0x4abcaa){_0x45d85b[_0x7acb('0x44')]=_0x4abcaa;return _0x45d85b;})['then'](respondWithFilteredResult(_0x1f7b2b,_0x1cfbdb))[_0x7acb('0x45')](handleError(_0x1f7b2b,null));};exports[_0x7acb('0x46')]=function(_0x489034,_0x27a38c){var _0x2b5c4e={'raw':!![],'where':{'id':_0x489034[_0x7acb('0x47')]['id']}},_0x445bc9={};_0x445bc9[_0x7acb('0x31')]=_['keys'](db[_0x7acb('0x2c')][_0x7acb('0x2d')]);_0x445bc9[_0x7acb('0x33')]=_[_0x7acb('0x34')](_0x489034[_0x7acb('0x33')]);_0x445bc9[_0x7acb('0x3c')]=_[_0x7acb('0x35')](_0x445bc9[_0x7acb('0x31')],_0x445bc9[_0x7acb('0x33')]);_0x2b5c4e['attributes']=_[_0x7acb('0x35')](_0x445bc9[_0x7acb('0x31')],qs[_0x7acb('0x36')](_0x489034[_0x7acb('0x33')][_0x7acb('0x36')]));_0x2b5c4e[_0x7acb('0x37')]=_0x2b5c4e['attributes'][_0x7acb('0x38')]?_0x2b5c4e[_0x7acb('0x37')]:_0x445bc9[_0x7acb('0x31')];if(_0x489034['query'][_0x7acb('0x42')]){_0x2b5c4e[_0x7acb('0x48')]=[{'all':!![]}];}_0x2b5c4e=_[_0x7acb('0x3e')]({},_0x2b5c4e,_0x489034[_0x7acb('0x41')]);return db[_0x7acb('0x2c')][_0x7acb('0x49')](_0x2b5c4e)[_0x7acb('0x24')](handleEntityNotFound(_0x27a38c,null))['then'](respondWithResult(_0x27a38c,null))[_0x7acb('0x45')](handleError(_0x27a38c,null));};exports[_0x7acb('0x4a')]=function(_0x9a49f4,_0x142beb){return db[_0x7acb('0x2c')][_0x7acb('0x4a')](_0x9a49f4[_0x7acb('0x4b')],{})['then'](respondWithResult(_0x142beb,0xc9))['catch'](handleError(_0x142beb,null));};exports[_0x7acb('0x4c')]=function(_0x21ad38,_0x5b0a95){if(_0x21ad38[_0x7acb('0x4b')]['id']){delete _0x21ad38[_0x7acb('0x4b')]['id'];}return db['MailServerOut'][_0x7acb('0x49')]({'where':{'id':_0x21ad38[_0x7acb('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b0a95,null))[_0x7acb('0x24')](saveUpdates(_0x21ad38[_0x7acb('0x4b')],null))[_0x7acb('0x24')](respondWithResult(_0x5b0a95,null))[_0x7acb('0x45')](handleError(_0x5b0a95,null));};exports[_0x7acb('0x25')]=function(_0x61f101,_0x3c963e){return db[_0x7acb('0x2c')][_0x7acb('0x49')]({'where':{'id':_0x61f101[_0x7acb('0x47')]['id']}})[_0x7acb('0x24')](handleEntityNotFound(_0x3c963e,null))[_0x7acb('0x24')](removeEntity(_0x3c963e,null))[_0x7acb('0x45')](handleError(_0x3c963e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index aff9cfc..16ffc0a 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 _0x3e4b=['define','MailServerOut','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e4b,0x17c));var _0xb3e4=function(_0x35a87c,_0xe2fb59){_0x35a87c=_0x35a87c-0x0;var _0xc2b279=_0x3e4b[_0x35a87c];return _0xc2b279;};'use strict';var _=require(_0xb3e4('0x0'));var util=require('util');var logger=require(_0xb3e4('0x1'))('api');var moment=require(_0xb3e4('0x2'));var BPromise=require(_0xb3e4('0x3'));var rp=require(_0xb3e4('0x4'));var fs=require('fs');var path=require(_0xb3e4('0x5'));var rimraf=require(_0xb3e4('0x6'));var config=require(_0xb3e4('0x7'));var attributes=require(_0xb3e4('0x8'));module[_0xb3e4('0x9')]=function(_0x360e85,_0x12c27b){return _0x360e85[_0xb3e4('0xa')](_0xb3e4('0xb'),attributes,{'tableName':_0xb3e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e65=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','mail_servers_out','util'];(function(_0x14fe1f,_0x249a03){var _0x4eb77c=function(_0x2e8025){while(--_0x2e8025){_0x14fe1f['push'](_0x14fe1f['shift']());}};_0x4eb77c(++_0x249a03);}(_0x7e65,0x19d));var _0x57e6=function(_0x244ccb,_0x4e0f8a){_0x244ccb=_0x244ccb-0x0;var _0xe3f46d=_0x7e65[_0x244ccb];return _0xe3f46d;};'use strict';var _=require('lodash');var util=require(_0x57e6('0x0'));var logger=require(_0x57e6('0x1'))('api');var moment=require(_0x57e6('0x2'));var BPromise=require(_0x57e6('0x3'));var rp=require(_0x57e6('0x4'));var fs=require('fs');var path=require(_0x57e6('0x5'));var rimraf=require('rimraf');var config=require(_0x57e6('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x57e6('0x7')]=function(_0x127f04,_0x212765){return _0x127f04['define']('MailServerOut',attributes,{'tableName':_0x57e6('0x8'),'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 2953502..9cbc315 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x13a094,_0x250688){var _0xa3d083=function(_0xa272f4){while(--_0xa272f4){_0x13a094['push'](_0x13a094['shift']());}};_0xa3d083(++_0x250688);}(_0x2ef3,0xba));var _0x32ef=function(_0x15f349,_0x36a9a6){_0x15f349=_0x15f349-0x0;var _0x2b89c0=_0x2ef3[_0x15f349];return _0x2b89c0;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4cc104,_0x9632c6){_0x4cc104=_0x4cc104-0x0;var _0x4f1835=_0x7a54[_0x4cc104];return _0x4f1835;};'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 9ab707e..a736fa5 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 _0xbffb=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x184c94,_0x5dfaa4){var _0x3a7f7f=function(_0x11e9b4){while(--_0x11e9b4){_0x184c94['push'](_0x184c94['shift']());}};_0x3a7f7f(++_0x5dfaa4);}(_0xbffb,0xa5));var _0xbbff=function(_0x5f3517,_0xc09135){_0x5f3517=_0x5f3517-0x0;var _0x4318e1=_0xbffb[_0x5f3517];return _0x4318e1;};'use strict';var multer=require(_0xbbff('0x0'));var util=require('util');var path=require(_0xbbff('0x1'));var timeout=require(_0xbbff('0x2'));var express=require(_0xbbff('0x3'));var router=express[_0xbbff('0x4')]();var fs_extra=require(_0xbbff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbbff('0x6'));var config=require(_0xbbff('0x7'));var controller=require(_0xbbff('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbbff('0x9')]);router[_0xbbff('0xa')](_0xbbff('0xb'),auth[_0xbbff('0xc')](),controller[_0xbbff('0xd')]);router[_0xbbff('0xa')](_0xbbff('0xe'),auth[_0xbbff('0xc')](),controller[_0xbbff('0xf')]);router['post']('/',auth[_0xbbff('0xc')](),controller['create']);router[_0xbbff('0x10')](_0xbbff('0xe'),auth['isAuthenticated'](),controller[_0xbbff('0x11')]);router[_0xbbff('0x12')]('/:id',auth[_0xbbff('0xc')](),controller[_0xbbff('0x13')]);module[_0xbbff('0x14')]=router; \ No newline at end of file +var _0x005c=['get','index','/describe','describe','show','post','create','put','/:id','update','isAuthenticated','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x17e3c4,_0x821010){var _0x2211b9=function(_0x33ab42){while(--_0x33ab42){_0x17e3c4['push'](_0x17e3c4['shift']());}};_0x2211b9(++_0x821010);}(_0x005c,0x111));var _0xc005=function(_0x1cbba0,_0x4b2853){_0x1cbba0=_0x1cbba0-0x0;var _0x338659=_0x005c[_0x1cbba0];return _0x338659;};'use strict';var multer=require(_0xc005('0x0'));var util=require(_0xc005('0x1'));var path=require(_0xc005('0x2'));var timeout=require('connect-timeout');var express=require(_0xc005('0x3'));var router=express[_0xc005('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc005('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc005('0x6'));var controller=require('./mailSubstatus.controller');router[_0xc005('0x7')]('/',auth['isAuthenticated'](),controller[_0xc005('0x8')]);router[_0xc005('0x7')](_0xc005('0x9'),auth['isAuthenticated'](),controller[_0xc005('0xa')]);router[_0xc005('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc005('0xb')]);router[_0xc005('0xc')]('/',auth['isAuthenticated'](),controller[_0xc005('0xd')]);router[_0xc005('0xe')](_0xc005('0xf'),auth['isAuthenticated'](),controller[_0xc005('0x10')]);router['delete']('/:id',auth[_0xc005('0x11')](),controller[_0xc005('0x12')]);module[_0xc005('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0d1ef98..082f723 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 _0x0309=['STRING','sequelize'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x0309,0x165));var _0x9030=function(_0x5d669e,_0x42dd1c){_0x5d669e=_0x5d669e-0x0;var _0x13c51d=_0x0309[_0x5d669e];return _0x13c51d;};'use strict';var Sequelize=require(_0x9030('0x0'));module['exports']={'name':{'type':Sequelize[_0x9030('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9030('0x1')]}}; \ No newline at end of file +var _0xa23f=['STRING','sequelize','exports'];(function(_0xdaa23e,_0x1b7044){var _0x3583a8=function(_0x4dc23d){while(--_0x4dc23d){_0xdaa23e['push'](_0xdaa23e['shift']());}};_0x3583a8(++_0x1b7044);}(_0xa23f,0x7c));var _0xfa23=function(_0x3b6a2f,_0x2b022c){_0x3b6a2f=_0x3b6a2f-0x0;var _0x32567a=_0xa23f[_0x3b6a2f];return _0x32567a;};'use strict';var Sequelize=require(_0xfa23('0x0'));module[_0xfa23('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfa23('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6ebdbe1..62f5aac 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 _0x14f5=['api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','MailSubstatus','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4a9421,_0x157e8c){var _0x49d7f2=function(_0x5db072){while(--_0x5db072){_0x4a9421['push'](_0x4a9421['shift']());}};_0x49d7f2(++_0x157e8c);}(_0x14f5,0x118));var _0x514f=function(_0x5c1e60,_0x55c99d){_0x5c1e60=_0x5c1e60-0x0;var _0x331093=_0x14f5[_0x5c1e60];return _0x331093;};'use strict';var emlformat=require(_0x514f('0x0'));var rimraf=require(_0x514f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x514f('0x2'));var rp=require('request-promise');var moment=require(_0x514f('0x3'));var BPromise=require(_0x514f('0x4'));var Mustache=require('mustache');var util=require(_0x514f('0x5'));var path=require(_0x514f('0x6'));var sox=require(_0x514f('0x7'));var csv=require(_0x514f('0x8'));var ejs=require(_0x514f('0x9'));var fs=require('fs');var fs_extra=require(_0x514f('0xa'));var _=require(_0x514f('0xb'));var squel=require(_0x514f('0xc'));var crypto=require(_0x514f('0xd'));var jsforce=require(_0x514f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x514f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x514f('0xf'));var authService=require(_0x514f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x514f('0x11'));var hardwareService=require(_0x514f('0x12'));var logger=require(_0x514f('0x13'))(_0x514f('0x14'));var utils=require(_0x514f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x514f('0x16'));var db=require(_0x514f('0x17'))['db'];function respondWithStatusCode(_0x1eca5b,_0xdc42fd){_0xdc42fd=_0xdc42fd||0xcc;return function(_0x4743b1){if(_0x4743b1){return _0x1eca5b['sendStatus'](_0xdc42fd);}return _0x1eca5b[_0x514f('0x18')](_0xdc42fd)[_0x514f('0x19')]();};}function respondWithResult(_0x5c1abd,_0x2650c1){_0x2650c1=_0x2650c1||0xc8;return function(_0x1de323){if(_0x1de323){return _0x5c1abd[_0x514f('0x18')](_0x2650c1)[_0x514f('0x1a')](_0x1de323);}};}function respondWithFilteredResult(_0x491983,_0x5ebc13){return function(_0x3f1237){if(_0x3f1237){var _0x11a42e=typeof _0x5ebc13[_0x514f('0x1b')]==='undefined'&&typeof _0x5ebc13[_0x514f('0x1c')]===_0x514f('0x1d');var _0x376a49=_0x3f1237['count'];var _0x45cbce=_0x11a42e?0x0:_0x5ebc13[_0x514f('0x1b')];var _0x460922=_0x11a42e?_0x3f1237[_0x514f('0x1e')]:_0x5ebc13[_0x514f('0x1b')]+_0x5ebc13[_0x514f('0x1c')];var _0x449237;if(_0x460922>=_0x376a49){_0x460922=_0x376a49;_0x449237=0xc8;}else{_0x449237=0xce;}_0x491983[_0x514f('0x18')](_0x449237);return _0x491983[_0x514f('0x1f')](_0x514f('0x20'),_0x45cbce+'-'+_0x460922+'/'+_0x376a49)['json'](_0x3f1237);}return null;};}function patchUpdates(_0x2b5f98){return function(_0x36dade){try{jsonpatch['apply'](_0x36dade,_0x2b5f98,!![]);}catch(_0x10f60e){return BPromise[_0x514f('0x21')](_0x10f60e);}return _0x36dade[_0x514f('0x22')]();};}function saveUpdates(_0x58de75,_0xba42a3){return function(_0x645a18){if(_0x645a18){return _0x645a18[_0x514f('0x23')](_0x58de75)['then'](function(_0xa3ab17){return _0xa3ab17;});}return null;};}function removeEntity(_0x28206e,_0x642fc0){return function(_0x361670){if(_0x361670){return _0x361670[_0x514f('0x24')]()['then'](function(){_0x28206e[_0x514f('0x18')](0xcc)[_0x514f('0x19')]();});}};}function handleEntityNotFound(_0x442f2,_0x4f9115){return function(_0x22eaea){if(!_0x22eaea){_0x442f2[_0x514f('0x25')](0x194);}return _0x22eaea;};}function handleError(_0x182a82,_0x11fbff){_0x11fbff=_0x11fbff||0x1f4;return function(_0x3a1f33){logger[_0x514f('0x26')](_0x3a1f33[_0x514f('0x27')]);if(_0x3a1f33[_0x514f('0x28')]){delete _0x3a1f33[_0x514f('0x28')];}_0x182a82[_0x514f('0x18')](_0x11fbff)['send'](_0x3a1f33);};}exports['index']=function(_0x51c824,_0x28229f){var _0x4ac578={},_0xd425dc={},_0x5499df={'count':0x0,'rows':[]};var _0xb9c3bb=_[_0x514f('0x29')](db['MailSubstatus'][_0x514f('0x2a')],function(_0x4f6ced){return{'name':_0x4f6ced[_0x514f('0x2b')],'type':_0x4f6ced[_0x514f('0x2c')]['key']};});_0xd425dc[_0x514f('0x2d')]=_[_0x514f('0x29')](_0xb9c3bb,_0x514f('0x28'));_0xd425dc[_0x514f('0x2e')]=_[_0x514f('0x2f')](_0x51c824[_0x514f('0x2e')]);_0xd425dc[_0x514f('0x30')]=_[_0x514f('0x31')](_0xd425dc[_0x514f('0x2d')],_0xd425dc[_0x514f('0x2e')]);_0x4ac578[_0x514f('0x32')]=_[_0x514f('0x31')](_0xd425dc[_0x514f('0x2d')],qs[_0x514f('0x33')](_0x51c824[_0x514f('0x2e')]['fields']));_0x4ac578[_0x514f('0x32')]=_0x4ac578[_0x514f('0x32')][_0x514f('0x34')]?_0x4ac578[_0x514f('0x32')]:_0xd425dc[_0x514f('0x2d')];if(!_0x51c824['query'][_0x514f('0x35')](_0x514f('0x36'))){_0x4ac578[_0x514f('0x1c')]=qs[_0x514f('0x1c')](_0x51c824[_0x514f('0x2e')][_0x514f('0x1c')]);_0x4ac578['offset']=qs[_0x514f('0x1b')](_0x51c824[_0x514f('0x2e')][_0x514f('0x1b')]);}_0x4ac578[_0x514f('0x37')]=qs[_0x514f('0x38')](_0x51c824[_0x514f('0x2e')][_0x514f('0x38')]);_0x4ac578['where']=qs[_0x514f('0x30')](_[_0x514f('0x39')](_0x51c824['query'],_0xd425dc[_0x514f('0x30')]),_0xb9c3bb);if(_0x51c824['query'][_0x514f('0x3a')]){_0x4ac578[_0x514f('0x3b')]=_['merge'](_0x4ac578[_0x514f('0x3b')],{'$or':_[_0x514f('0x29')](_0xb9c3bb,function(_0x378829){if(_0x378829[_0x514f('0x2c')]!==_0x514f('0x3c')){var _0x3a8049={};_0x3a8049[_0x378829[_0x514f('0x28')]]={'$like':'%'+_0x51c824[_0x514f('0x2e')][_0x514f('0x3a')]+'%'};return _0x3a8049;}})});}_0x4ac578=_[_0x514f('0x3d')]({},_0x4ac578,_0x51c824[_0x514f('0x3e')]);var _0x5af4b0={'where':_0x4ac578[_0x514f('0x3b')]};return db[_0x514f('0x3f')][_0x514f('0x1e')](_0x5af4b0)[_0x514f('0x40')](function(_0x16513e){_0x5499df[_0x514f('0x1e')]=_0x16513e;if(_0x51c824[_0x514f('0x2e')][_0x514f('0x41')]){_0x4ac578[_0x514f('0x42')]=[{'all':!![]}];}return db[_0x514f('0x3f')][_0x514f('0x43')](_0x4ac578);})[_0x514f('0x40')](function(_0x4d81b1){_0x5499df[_0x514f('0x44')]=_0x4d81b1;return _0x5499df;})[_0x514f('0x40')](respondWithFilteredResult(_0x28229f,_0x4ac578))[_0x514f('0x45')](handleError(_0x28229f,null));};exports['show']=function(_0x4db1ed,_0x2adc03){var _0x490740={'raw':!![],'where':{'id':_0x4db1ed[_0x514f('0x46')]['id']}},_0x3fe2bd={};_0x3fe2bd['model']=_[_0x514f('0x2f')](db[_0x514f('0x3f')][_0x514f('0x2a')]);_0x3fe2bd[_0x514f('0x2e')]=_['keys'](_0x4db1ed[_0x514f('0x2e')]);_0x3fe2bd['filters']=_[_0x514f('0x31')](_0x3fe2bd[_0x514f('0x2d')],_0x3fe2bd[_0x514f('0x2e')]);_0x490740[_0x514f('0x32')]=_[_0x514f('0x31')](_0x3fe2bd['model'],qs[_0x514f('0x33')](_0x4db1ed[_0x514f('0x2e')][_0x514f('0x33')]));_0x490740[_0x514f('0x32')]=_0x490740['attributes'][_0x514f('0x34')]?_0x490740['attributes']:_0x3fe2bd['model'];if(_0x4db1ed['query']['includeAll']){_0x490740[_0x514f('0x42')]=[{'all':!![]}];}_0x490740=_[_0x514f('0x3d')]({},_0x490740,_0x4db1ed['options']);return db[_0x514f('0x3f')][_0x514f('0x47')](_0x490740)[_0x514f('0x40')](handleEntityNotFound(_0x2adc03,null))[_0x514f('0x40')](respondWithResult(_0x2adc03,null))[_0x514f('0x45')](handleError(_0x2adc03,null));};exports[_0x514f('0x48')]=function(_0x310a0e,_0xa40c8e){return db[_0x514f('0x3f')][_0x514f('0x48')](_0x310a0e[_0x514f('0x49')],{})[_0x514f('0x40')](respondWithResult(_0xa40c8e,0xc9))['catch'](handleError(_0xa40c8e,null));};exports[_0x514f('0x23')]=function(_0x58b556,_0x4a06ec){if(_0x58b556[_0x514f('0x49')]['id']){delete _0x58b556[_0x514f('0x49')]['id'];}return db['MailSubstatus'][_0x514f('0x47')]({'where':{'id':_0x58b556['params']['id']}})['then'](handleEntityNotFound(_0x4a06ec,null))[_0x514f('0x40')](saveUpdates(_0x58b556[_0x514f('0x49')],null))[_0x514f('0x40')](respondWithResult(_0x4a06ec,null))[_0x514f('0x45')](handleError(_0x4a06ec,null));};exports[_0x514f('0x24')]=function(_0x49be0f,_0x2981e7){return db[_0x514f('0x3f')][_0x514f('0x47')]({'where':{'id':_0x49be0f[_0x514f('0x46')]['id']}})[_0x514f('0x40')](handleEntityNotFound(_0x2981e7,null))[_0x514f('0x40')](removeEntity(_0x2981e7,null))[_0x514f('0x45')](handleError(_0x2981e7,null));};exports[_0x514f('0x4a')]=function(_0x11c0c3,_0x307670){return db[_0x514f('0x3f')][_0x514f('0x4a')]()[_0x514f('0x40')](respondWithResult(_0x307670,null))[_0x514f('0x45')](handleError(_0x307670,null));}; \ No newline at end of file +var _0x8d64=['fs-extra','squel','desk.js','querystring','ioredis','../../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','reject','destroy','then','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','create','update','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8d64,0x1f4));var _0x48d6=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x8d64[_0x2ef44b];return _0x2405b9;};'use strict';var emlformat=require(_0x48d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x48d6('0x1'));var jsonpatch=require(_0x48d6('0x2'));var rp=require(_0x48d6('0x3'));var moment=require(_0x48d6('0x4'));var BPromise=require(_0x48d6('0x5'));var Mustache=require(_0x48d6('0x6'));var util=require(_0x48d6('0x7'));var path=require('path');var sox=require(_0x48d6('0x8'));var csv=require(_0x48d6('0x9'));var ejs=require(_0x48d6('0xa'));var fs=require('fs');var fs_extra=require(_0x48d6('0xb'));var _=require('lodash');var squel=require(_0x48d6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x48d6('0xd'));var toCsv=require(_0x48d6('0x9'));var querystring=require(_0x48d6('0xe'));var Papa=require('papaparse');var Redis=require(_0x48d6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x48d6('0x10'));var as=require(_0x48d6('0x11'));var hardwareService=require(_0x48d6('0x12'));var logger=require(_0x48d6('0x13'))('api');var utils=require(_0x48d6('0x14'));var config=require(_0x48d6('0x15'));var licenseUtil=require(_0x48d6('0x16'));var db=require(_0x48d6('0x17'))['db'];function respondWithStatusCode(_0xa0eec,_0x4be158){_0x4be158=_0x4be158||0xcc;return function(_0x20f87e){if(_0x20f87e){return _0xa0eec[_0x48d6('0x18')](_0x4be158);}return _0xa0eec[_0x48d6('0x19')](_0x4be158)['end']();};}function respondWithResult(_0x5e251e,_0x53a7c0){_0x53a7c0=_0x53a7c0||0xc8;return function(_0x47685d){if(_0x47685d){return _0x5e251e[_0x48d6('0x19')](_0x53a7c0)[_0x48d6('0x1a')](_0x47685d);}};}function respondWithFilteredResult(_0xf1a9c6,_0xe52f5a){return function(_0x3d425c){if(_0x3d425c){var _0x2ce658=typeof _0xe52f5a[_0x48d6('0x1b')]===_0x48d6('0x1c')&&typeof _0xe52f5a[_0x48d6('0x1d')]===_0x48d6('0x1c');var _0x12938e=_0x3d425c[_0x48d6('0x1e')];var _0x45429e=_0x2ce658?0x0:_0xe52f5a[_0x48d6('0x1b')];var _0x844f45=_0x2ce658?_0x3d425c[_0x48d6('0x1e')]:_0xe52f5a['offset']+_0xe52f5a[_0x48d6('0x1d')];var _0x252e4e;if(_0x844f45>=_0x12938e){_0x844f45=_0x12938e;_0x252e4e=0xc8;}else{_0x252e4e=0xce;}_0xf1a9c6['status'](_0x252e4e);return _0xf1a9c6[_0x48d6('0x1f')]('Content-Range',_0x45429e+'-'+_0x844f45+'/'+_0x12938e)[_0x48d6('0x1a')](_0x3d425c);}return null;};}function patchUpdates(_0xf2091e){return function(_0x379901){try{jsonpatch['apply'](_0x379901,_0xf2091e,!![]);}catch(_0x3b741e){return BPromise[_0x48d6('0x20')](_0x3b741e);}return _0x379901['save']();};}function saveUpdates(_0x11e7c0,_0x15c755){return function(_0x33eedd){if(_0x33eedd){return _0x33eedd['update'](_0x11e7c0)['then'](function(_0x1d60e9){return _0x1d60e9;});}return null;};}function removeEntity(_0x477379,_0x52120f){return function(_0x1f6043){if(_0x1f6043){return _0x1f6043[_0x48d6('0x21')]()[_0x48d6('0x22')](function(){_0x477379['status'](0xcc)[_0x48d6('0x23')]();});}};}function handleEntityNotFound(_0x1205ec,_0x2edf16){return function(_0x2476ed){if(!_0x2476ed){_0x1205ec[_0x48d6('0x18')](0x194);}return _0x2476ed;};}function handleError(_0x41e36f,_0x489348){_0x489348=_0x489348||0x1f4;return function(_0x2a0263){logger[_0x48d6('0x24')](_0x2a0263[_0x48d6('0x25')]);if(_0x2a0263['name']){delete _0x2a0263[_0x48d6('0x26')];}_0x41e36f[_0x48d6('0x19')](_0x489348)[_0x48d6('0x27')](_0x2a0263);};}exports[_0x48d6('0x28')]=function(_0x495a24,_0x95ca26){var _0x26e59a={},_0x1a1057={},_0x2f4d00={'count':0x0,'rows':[]};var _0x4032c1=_[_0x48d6('0x29')](db[_0x48d6('0x2a')][_0x48d6('0x2b')],function(_0x4c187a){return{'name':_0x4c187a['fieldName'],'type':_0x4c187a[_0x48d6('0x2c')][_0x48d6('0x2d')]};});_0x1a1057[_0x48d6('0x2e')]=_['map'](_0x4032c1,_0x48d6('0x26'));_0x1a1057[_0x48d6('0x2f')]=_[_0x48d6('0x30')](_0x495a24[_0x48d6('0x2f')]);_0x1a1057[_0x48d6('0x31')]=_['intersection'](_0x1a1057[_0x48d6('0x2e')],_0x1a1057[_0x48d6('0x2f')]);_0x26e59a[_0x48d6('0x32')]=_[_0x48d6('0x33')](_0x1a1057['model'],qs[_0x48d6('0x34')](_0x495a24[_0x48d6('0x2f')]['fields']));_0x26e59a['attributes']=_0x26e59a['attributes'][_0x48d6('0x35')]?_0x26e59a['attributes']:_0x1a1057[_0x48d6('0x2e')];if(!_0x495a24['query']['hasOwnProperty'](_0x48d6('0x36'))){_0x26e59a[_0x48d6('0x1d')]=qs[_0x48d6('0x1d')](_0x495a24['query'][_0x48d6('0x1d')]);_0x26e59a[_0x48d6('0x1b')]=qs[_0x48d6('0x1b')](_0x495a24[_0x48d6('0x2f')][_0x48d6('0x1b')]);}_0x26e59a[_0x48d6('0x37')]=qs[_0x48d6('0x38')](_0x495a24[_0x48d6('0x2f')]['sort']);_0x26e59a[_0x48d6('0x39')]=qs[_0x48d6('0x31')](_[_0x48d6('0x3a')](_0x495a24[_0x48d6('0x2f')],_0x1a1057[_0x48d6('0x31')]),_0x4032c1);if(_0x495a24[_0x48d6('0x2f')][_0x48d6('0x3b')]){_0x26e59a[_0x48d6('0x39')]=_[_0x48d6('0x3c')](_0x26e59a[_0x48d6('0x39')],{'$or':_[_0x48d6('0x29')](_0x4032c1,function(_0x3fcb2f){if(_0x3fcb2f['type']!==_0x48d6('0x3d')){var _0x2b11df={};_0x2b11df[_0x3fcb2f[_0x48d6('0x26')]]={'$like':'%'+_0x495a24[_0x48d6('0x2f')][_0x48d6('0x3b')]+'%'};return _0x2b11df;}})});}_0x26e59a=_[_0x48d6('0x3c')]({},_0x26e59a,_0x495a24[_0x48d6('0x3e')]);var _0x267047={'where':_0x26e59a['where']};return db[_0x48d6('0x2a')][_0x48d6('0x1e')](_0x267047)[_0x48d6('0x22')](function(_0x4b7596){_0x2f4d00[_0x48d6('0x1e')]=_0x4b7596;if(_0x495a24[_0x48d6('0x2f')][_0x48d6('0x3f')]){_0x26e59a[_0x48d6('0x40')]=[{'all':!![]}];}return db[_0x48d6('0x2a')]['findAll'](_0x26e59a);})[_0x48d6('0x22')](function(_0x483dfb){_0x2f4d00[_0x48d6('0x41')]=_0x483dfb;return _0x2f4d00;})[_0x48d6('0x22')](respondWithFilteredResult(_0x95ca26,_0x26e59a))[_0x48d6('0x42')](handleError(_0x95ca26,null));};exports['show']=function(_0x3dcf51,_0xf7c57){var _0x2d70d5={'raw':!![],'where':{'id':_0x3dcf51['params']['id']}},_0x932a6c={};_0x932a6c[_0x48d6('0x2e')]=_[_0x48d6('0x30')](db['MailSubstatus'][_0x48d6('0x2b')]);_0x932a6c[_0x48d6('0x2f')]=_[_0x48d6('0x30')](_0x3dcf51[_0x48d6('0x2f')]);_0x932a6c[_0x48d6('0x31')]=_[_0x48d6('0x33')](_0x932a6c[_0x48d6('0x2e')],_0x932a6c['query']);_0x2d70d5[_0x48d6('0x32')]=_[_0x48d6('0x33')](_0x932a6c[_0x48d6('0x2e')],qs[_0x48d6('0x34')](_0x3dcf51[_0x48d6('0x2f')][_0x48d6('0x34')]));_0x2d70d5[_0x48d6('0x32')]=_0x2d70d5[_0x48d6('0x32')][_0x48d6('0x35')]?_0x2d70d5[_0x48d6('0x32')]:_0x932a6c[_0x48d6('0x2e')];if(_0x3dcf51[_0x48d6('0x2f')][_0x48d6('0x3f')]){_0x2d70d5['include']=[{'all':!![]}];}_0x2d70d5=_[_0x48d6('0x3c')]({},_0x2d70d5,_0x3dcf51['options']);return db['MailSubstatus']['find'](_0x2d70d5)[_0x48d6('0x22')](handleEntityNotFound(_0xf7c57,null))[_0x48d6('0x22')](respondWithResult(_0xf7c57,null))[_0x48d6('0x42')](handleError(_0xf7c57,null));};exports[_0x48d6('0x43')]=function(_0x2576b6,_0x73b410){return db[_0x48d6('0x2a')][_0x48d6('0x43')](_0x2576b6['body'],{})[_0x48d6('0x22')](respondWithResult(_0x73b410,0xc9))['catch'](handleError(_0x73b410,null));};exports[_0x48d6('0x44')]=function(_0x41d301,_0x35698b){if(_0x41d301[_0x48d6('0x45')]['id']){delete _0x41d301['body']['id'];}return db[_0x48d6('0x2a')][_0x48d6('0x46')]({'where':{'id':_0x41d301[_0x48d6('0x47')]['id']}})[_0x48d6('0x22')](handleEntityNotFound(_0x35698b,null))['then'](saveUpdates(_0x41d301['body'],null))[_0x48d6('0x22')](respondWithResult(_0x35698b,null))['catch'](handleError(_0x35698b,null));};exports[_0x48d6('0x21')]=function(_0x12df4f,_0x465668){return db['MailSubstatus']['find']({'where':{'id':_0x12df4f[_0x48d6('0x47')]['id']}})[_0x48d6('0x22')](handleEntityNotFound(_0x465668,null))[_0x48d6('0x22')](removeEntity(_0x465668,null))[_0x48d6('0x42')](handleError(_0x465668,null));};exports[_0x48d6('0x48')]=function(_0x489a4b,_0x283b1a){return db[_0x48d6('0x2a')][_0x48d6('0x48')]()[_0x48d6('0x22')](respondWithResult(_0x283b1a,null))[_0x48d6('0x42')](handleError(_0x283b1a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 54ac830..9220815 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 _0x9aac=['update','emit','hasOwnProperty','hook','exports','MailSubstatus'];(function(_0x564cf3,_0x595b52){var _0x9cd21e=function(_0x2ca13e){while(--_0x2ca13e){_0x564cf3['push'](_0x564cf3['shift']());}};_0x9cd21e(++_0x595b52);}(_0x9aac,0x1af));var _0xc9aa=function(_0x4e13ce,_0x33d081){_0x4e13ce=_0x4e13ce-0x0;var _0x44f4fa=_0x9aac[_0x4e13ce];return _0x44f4fa;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0xc9aa('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xc9aa('0x1')};function emitEvent(_0x58bdb3){return function(_0x171653,_0xff4608,_0x17a869){MailSubstatusEvents[_0xc9aa('0x2')](_0x58bdb3+':'+_0x171653['id'],_0x171653);MailSubstatusEvents[_0xc9aa('0x2')](_0x58bdb3,_0x171653);_0x17a869(null);};}for(var e in events){if(events[_0xc9aa('0x3')](e)){var event=events[e];MailSubstatus[_0xc9aa('0x4')](e,emitEvent(event));}}module[_0xc9aa('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0xd363=['update','emit','hasOwnProperty','exports','events','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x2cd9e6,_0x1e10de){var _0x3a48f6=function(_0x439892){while(--_0x439892){_0x2cd9e6['push'](_0x2cd9e6['shift']());}};_0x3a48f6(++_0x1e10de);}(_0xd363,0x18c));var _0x3d36=function(_0x28b7a2,_0x40aa58){_0x28b7a2=_0x28b7a2-0x0;var _0x404e08=_0xd363[_0x28b7a2];return _0x404e08;};'use strict';var EventEmitter=require(_0x3d36('0x0'));var MailSubstatus=require(_0x3d36('0x1'))['db'][_0x3d36('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3d36('0x3')](0x0);var events={'afterUpdate':_0x3d36('0x4')};function emitEvent(_0x4e2c92){return function(_0x53f08f,_0x15d4d8,_0x4d322f){MailSubstatusEvents[_0x3d36('0x5')](_0x4e2c92+':'+_0x53f08f['id'],_0x53f08f);MailSubstatusEvents[_0x3d36('0x5')](_0x4e2c92,_0x53f08f);_0x4d322f(null);};}for(var e in events){if(events[_0x3d36('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x3d36('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 8e71b44..1dfb06d 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 _0x8c8f=['./mailSubstatus.attributes','name','mailSubstatus','_previousDataValues','then','catch'];(function(_0x584f10,_0x93b820){var _0x77ba37=function(_0x47d0f2){while(--_0x47d0f2){_0x584f10['push'](_0x584f10['shift']());}};_0x77ba37(++_0x93b820);}(_0x8c8f,0x1e6));var _0xf8c8=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x8c8f[_0x4b2436];return _0x4f5ab2;};'use strict';var attributes=require(_0xf8c8('0x0'));module['exports']=function(_0x3c9ffe){var _0x5c1fe1=_0x3c9ffe['models'];return _0x3c9ffe['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5f25fe,_0x22f13f,_0x5f1880){return _0x5c1fe1['Condition']['update']({'value':_0x5f25fe[_0xf8c8('0x1')]},{'where':{'field':_0xf8c8('0x2'),'value':_0x5f25fe[_0xf8c8('0x3')][_0xf8c8('0x1')]}})[_0xf8c8('0x4')](function(){_0x5f1880();})[_0xf8c8('0x5')](function(_0x24dbf1){_0x5f1880(_0x24dbf1);});}}});}; \ No newline at end of file +var _0x7acb=['define','MailSubstatus','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes'];(function(_0x38a7c9,_0x2ef78b){var _0x39c09d=function(_0x81b1c9){while(--_0x81b1c9){_0x38a7c9['push'](_0x38a7c9['shift']());}};_0x39c09d(++_0x2ef78b);}(_0x7acb,0xbf));var _0xb7ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7acb[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0xb7ac('0x0'));module['exports']=function(_0x40010d){var _0x18f5c9=_0x40010d['models'];return _0x40010d[_0xb7ac('0x1')](_0xb7ac('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5540c0,_0x31f887,_0x2c6490){return _0x18f5c9['Condition']['update']({'value':_0x5540c0[_0xb7ac('0x3')]},{'where':{'field':_0xb7ac('0x4'),'value':_0x5540c0[_0xb7ac('0x5')][_0xb7ac('0x3')]}})[_0xb7ac('0x6')](function(){_0x2c6490();})[_0xb7ac('0x7')](function(_0x12e27e){_0x2c6490(_0x12e27e);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4fc684a..46faa7e 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 _0xbe4f=['../../config/environment','jayson/promise','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbe4f,0x121));var _0xfbe4=function(_0x25ba51,_0x407b6d){_0x25ba51=_0x25ba51-0x0;var _0xc2e236=_0xbe4f[_0x25ba51];return _0xc2e236;};'use strict';var _=require(_0xfbe4('0x0'));var util=require(_0xfbe4('0x1'));var moment=require(_0xfbe4('0x2'));var BPromise=require(_0xfbe4('0x3'));var rs=require(_0xfbe4('0x4'));var fs=require('fs');var Redis=require(_0xfbe4('0x5'));var db=require(_0xfbe4('0x6'))['db'];var utils=require(_0xfbe4('0x7'));var logger=require(_0xfbe4('0x8'))(_0xfbe4('0x9'));var config=require(_0xfbe4('0xa'));var jayson=require(_0xfbe4('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x421139,_0x1aac90,_0x24cad1){return new BPromise(function(_0x47b823,_0x5cf614){return client['request'](_0x421139,_0x24cad1)[_0xfbe4('0xc')](function(_0x3ff1f1){logger[_0xfbe4('0xd')](_0xfbe4('0xe'),_0x1aac90,_0xfbe4('0xf'));logger['debug'](_0xfbe4('0x10'),_0x1aac90,_0xfbe4('0xf'),JSON[_0xfbe4('0x11')](_0x3ff1f1));if(_0x3ff1f1['error']){if(_0x3ff1f1[_0xfbe4('0x12')][_0xfbe4('0x13')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x1aac90,_0x3ff1f1[_0xfbe4('0x12')][_0xfbe4('0x14')]);return _0x5cf614(_0x3ff1f1[_0xfbe4('0x12')][_0xfbe4('0x14')]);}logger[_0xfbe4('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x1aac90,_0x3ff1f1['error'][_0xfbe4('0x14')]);return _0x47b823(_0x3ff1f1[_0xfbe4('0x12')][_0xfbe4('0x14')]);}else{logger[_0xfbe4('0xd')](_0xfbe4('0xe'),_0x1aac90,_0xfbe4('0xf'));_0x47b823(_0x3ff1f1[_0xfbe4('0x15')][_0xfbe4('0x14')]);}})[_0xfbe4('0x16')](function(_0x3322e1){logger[_0xfbe4('0x12')](_0xfbe4('0xe'),_0x1aac90,_0x3322e1);_0x5cf614(_0x3322e1);});});} \ No newline at end of file +var _0x8636=['MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8636,0xd5));var _0x6863=function(_0xa56b53,_0x53dbb7){_0xa56b53=_0xa56b53-0x0;var _0x19849f=_0x8636[_0xa56b53];return _0x19849f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6863('0x0'));var BPromise=require(_0x6863('0x1'));var rs=require(_0x6863('0x2'));var fs=require('fs');var Redis=require(_0x6863('0x3'));var db=require(_0x6863('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6863('0x5'))(_0x6863('0x6'));var config=require(_0x6863('0x7'));var jayson=require(_0x6863('0x8'));var client=jayson[_0x6863('0x9')][_0x6863('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x259028,_0x2c2214,_0x1eea18){return new BPromise(function(_0xe05975,_0x4e77d6){return client[_0x6863('0xb')](_0x259028,_0x1eea18)[_0x6863('0xc')](function(_0x97c9f3){logger[_0x6863('0xd')](_0x6863('0xe'),_0x2c2214,_0x6863('0xf'));logger[_0x6863('0x10')](_0x6863('0x11'),_0x2c2214,_0x6863('0xf'),JSON[_0x6863('0x12')](_0x97c9f3));if(_0x97c9f3[_0x6863('0x13')]){if(_0x97c9f3[_0x6863('0x13')][_0x6863('0x14')]===0x1f4){logger[_0x6863('0x13')](_0x6863('0xe'),_0x2c2214,_0x97c9f3[_0x6863('0x13')]['message']);return _0x4e77d6(_0x97c9f3[_0x6863('0x13')][_0x6863('0x15')]);}logger[_0x6863('0x13')](_0x6863('0xe'),_0x2c2214,_0x97c9f3[_0x6863('0x13')][_0x6863('0x15')]);return _0xe05975(_0x97c9f3['error'][_0x6863('0x15')]);}else{logger[_0x6863('0xd')](_0x6863('0xe'),_0x2c2214,'request\x20sent');_0xe05975(_0x97c9f3['result'][_0x6863('0x15')]);}})[_0x6863('0x16')](function(_0x3480a5){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2c2214,_0x3480a5);_0x4e77d6(_0x3480a5);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 2d44312..de81763 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 _0xb67c=['describe','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x5b21a2,_0x2c6461){var _0x57166b=function(_0x2c0c1a){while(--_0x2c0c1a){_0x5b21a2['push'](_0x5b21a2['shift']());}};_0x57166b(++_0x2c6461);}(_0xb67c,0x94));var _0xcb67=function(_0x20e81e,_0x2ad41f){_0x20e81e=_0x20e81e-0x0;var _0x3e6654=_0xb67c[_0x20e81e];return _0x3e6654;};'use strict';var multer=require(_0xcb67('0x0'));var util=require(_0xcb67('0x1'));var path=require(_0xcb67('0x2'));var timeout=require(_0xcb67('0x3'));var express=require(_0xcb67('0x4'));var router=express[_0xcb67('0x5')]();var fs_extra=require(_0xcb67('0x6'));var auth=require(_0xcb67('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcb67('0x8'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xcb67('0x9')](),controller[_0xcb67('0xa')]);router[_0xcb67('0xb')]('/describe',auth[_0xcb67('0x9')](),controller[_0xcb67('0xc')]);router[_0xcb67('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcb67('0xd')]('/',auth[_0xcb67('0x9')](),controller[_0xcb67('0xe')]);router[_0xcb67('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xcb67('0x10')]);router[_0xcb67('0x11')](_0xcb67('0x12'),auth[_0xcb67('0x9')](),controller['destroy']);module[_0xcb67('0x13')]=router; \ No newline at end of file +var _0x3d5e=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x342c13,_0x33845a){var _0x40c43e=function(_0x1230a2){while(--_0x1230a2){_0x342c13['push'](_0x342c13['shift']());}};_0x40c43e(++_0x33845a);}(_0x3d5e,0x65));var _0xe3d5=function(_0x5b3025,_0x91253e){_0x5b3025=_0x5b3025-0x0;var _0x2827dc=_0x3d5e[_0x5b3025];return _0x2827dc;};'use strict';var multer=require(_0xe3d5('0x0'));var util=require(_0xe3d5('0x1'));var path=require(_0xe3d5('0x2'));var timeout=require(_0xe3d5('0x3'));var express=require(_0xe3d5('0x4'));var router=express[_0xe3d5('0x5')]();var fs_extra=require(_0xe3d5('0x6'));var auth=require(_0xe3d5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe3d5('0x8'));var controller=require(_0xe3d5('0x9'));router[_0xe3d5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe3d5('0xa')]('/describe',auth[_0xe3d5('0xb')](),controller[_0xe3d5('0xc')]);router[_0xe3d5('0xa')](_0xe3d5('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe3d5('0xe')]('/',auth[_0xe3d5('0xb')](),controller[_0xe3d5('0xf')]);router[_0xe3d5('0x10')](_0xe3d5('0xd'),auth[_0xe3d5('0xb')](),controller[_0xe3d5('0x11')]);router[_0xe3d5('0x12')](_0xe3d5('0xd'),auth['isAuthenticated'](),controller[_0xe3d5('0x13')]);module[_0xe3d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a1195d2..22139fb 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x47c919,_0x37ff1f){var _0x2e808b=function(_0x50770d){while(--_0x50770d){_0x47c919['push'](_0x47c919['shift']());}};_0x2e808b(++_0x37ff1f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00bb[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1cea2e,_0x57ad0c){var _0x20b95e=function(_0x50c1da){while(--_0x50c1da){_0x1cea2e['push'](_0x1cea2e['shift']());}};_0x20b95e(++_0x57ad0c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xcb91[_0x102977];return _0x15c466;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5e3afe6..b9006bf 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 _0x8aac=['include','findAll','params','length','includeAll','options','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','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','end','status','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','MailTransferReport'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x8aac,0x130));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc8aa('0x0'));var jsonpatch=require(_0xc8aa('0x1'));var rp=require(_0xc8aa('0x2'));var moment=require(_0xc8aa('0x3'));var BPromise=require(_0xc8aa('0x4'));var Mustache=require(_0xc8aa('0x5'));var util=require('util');var path=require(_0xc8aa('0x6'));var sox=require(_0xc8aa('0x7'));var csv=require(_0xc8aa('0x8'));var ejs=require(_0xc8aa('0x9'));var fs=require('fs');var fs_extra=require(_0xc8aa('0xa'));var _=require(_0xc8aa('0xb'));var squel=require('squel');var crypto=require(_0xc8aa('0xc'));var jsforce=require(_0xc8aa('0xd'));var deskjs=require(_0xc8aa('0xe'));var toCsv=require(_0xc8aa('0x8'));var querystring=require(_0xc8aa('0xf'));var Papa=require(_0xc8aa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc8aa('0x11'));var as=require(_0xc8aa('0x12'));var hardwareService=require(_0xc8aa('0x13'));var logger=require(_0xc8aa('0x14'))(_0xc8aa('0x15'));var utils=require(_0xc8aa('0x16'));var config=require(_0xc8aa('0x17'));var licenseUtil=require(_0xc8aa('0x18'));var db=require(_0xc8aa('0x19'))['db'];function respondWithStatusCode(_0x2346d0,_0xce603f){_0xce603f=_0xce603f||0xcc;return function(_0xefb27e){if(_0xefb27e){return _0x2346d0[_0xc8aa('0x1a')](_0xce603f);}return _0x2346d0['status'](_0xce603f)[_0xc8aa('0x1b')]();};}function respondWithResult(_0x1fae05,_0x468dfd){_0x468dfd=_0x468dfd||0xc8;return function(_0x2bf798){if(_0x2bf798){return _0x1fae05[_0xc8aa('0x1c')](_0x468dfd)['json'](_0x2bf798);}};}function respondWithFilteredResult(_0x4e0c2c,_0x560137){return function(_0x2adedd){if(_0x2adedd){var _0x369061=typeof _0x560137[_0xc8aa('0x1d')]==='undefined'&&typeof _0x560137[_0xc8aa('0x1e')]===_0xc8aa('0x1f');var _0x2a5fbd=_0x2adedd[_0xc8aa('0x20')];var _0x52a61f=_0x369061?0x0:_0x560137[_0xc8aa('0x1d')];var _0x2d2000=_0x369061?_0x2adedd[_0xc8aa('0x20')]:_0x560137[_0xc8aa('0x1d')]+_0x560137[_0xc8aa('0x1e')];var _0x26be5a;if(_0x2d2000>=_0x2a5fbd){_0x2d2000=_0x2a5fbd;_0x26be5a=0xc8;}else{_0x26be5a=0xce;}_0x4e0c2c[_0xc8aa('0x1c')](_0x26be5a);return _0x4e0c2c[_0xc8aa('0x21')](_0xc8aa('0x22'),_0x52a61f+'-'+_0x2d2000+'/'+_0x2a5fbd)['json'](_0x2adedd);}return null;};}function patchUpdates(_0x783811){return function(_0x1898bf){try{jsonpatch[_0xc8aa('0x23')](_0x1898bf,_0x783811,!![]);}catch(_0x170b8b){return BPromise[_0xc8aa('0x24')](_0x170b8b);}return _0x1898bf['save']();};}function saveUpdates(_0x2a0992,_0x607ed7){return function(_0x40c793){if(_0x40c793){return _0x40c793[_0xc8aa('0x25')](_0x2a0992)[_0xc8aa('0x26')](function(_0x4fecef){return _0x4fecef;});}return null;};}function removeEntity(_0x29372a,_0x4dffb7){return function(_0x205133){if(_0x205133){return _0x205133['destroy']()[_0xc8aa('0x26')](function(){_0x29372a['status'](0xcc)[_0xc8aa('0x1b')]();});}};}function handleEntityNotFound(_0x3d304e,_0x5e2df3){return function(_0x2bd6f9){if(!_0x2bd6f9){_0x3d304e[_0xc8aa('0x1a')](0x194);}return _0x2bd6f9;};}function handleError(_0x2f453c,_0x4c0f02){_0x4c0f02=_0x4c0f02||0x1f4;return function(_0x281e1d){logger[_0xc8aa('0x27')](_0x281e1d['stack']);if(_0x281e1d[_0xc8aa('0x28')]){delete _0x281e1d[_0xc8aa('0x28')];}_0x2f453c[_0xc8aa('0x1c')](_0x4c0f02)[_0xc8aa('0x29')](_0x281e1d);};}exports['index']=function(_0x4968f4,_0x3279e9){var _0x1594fb={},_0xf2ab9c={},_0x494728={'count':0x0,'rows':[]};var _0x349802=_[_0xc8aa('0x2a')](db['MailTransferReport'][_0xc8aa('0x2b')],function(_0x117561){return{'name':_0x117561[_0xc8aa('0x2c')],'type':_0x117561['type'][_0xc8aa('0x2d')]};});_0xf2ab9c[_0xc8aa('0x2e')]=_[_0xc8aa('0x2a')](_0x349802,_0xc8aa('0x28'));_0xf2ab9c['query']=_[_0xc8aa('0x2f')](_0x4968f4[_0xc8aa('0x30')]);_0xf2ab9c[_0xc8aa('0x31')]=_[_0xc8aa('0x32')](_0xf2ab9c[_0xc8aa('0x2e')],_0xf2ab9c[_0xc8aa('0x30')]);_0x1594fb[_0xc8aa('0x33')]=_[_0xc8aa('0x32')](_0xf2ab9c['model'],qs['fields'](_0x4968f4[_0xc8aa('0x30')][_0xc8aa('0x34')]));_0x1594fb['attributes']=_0x1594fb[_0xc8aa('0x33')]['length']?_0x1594fb['attributes']:_0xf2ab9c[_0xc8aa('0x2e')];if(!_0x4968f4[_0xc8aa('0x30')][_0xc8aa('0x35')](_0xc8aa('0x36'))){_0x1594fb['limit']=qs['limit'](_0x4968f4[_0xc8aa('0x30')]['limit']);_0x1594fb[_0xc8aa('0x1d')]=qs[_0xc8aa('0x1d')](_0x4968f4[_0xc8aa('0x30')][_0xc8aa('0x1d')]);}_0x1594fb['order']=qs[_0xc8aa('0x37')](_0x4968f4[_0xc8aa('0x30')][_0xc8aa('0x37')]);_0x1594fb[_0xc8aa('0x38')]=qs[_0xc8aa('0x31')](_[_0xc8aa('0x39')](_0x4968f4[_0xc8aa('0x30')],_0xf2ab9c[_0xc8aa('0x31')]),_0x349802);if(_0x4968f4[_0xc8aa('0x30')]['filter']){_0x1594fb[_0xc8aa('0x38')]=_['merge'](_0x1594fb['where'],{'$or':_['map'](_0x349802,function(_0x3386b4){if(_0x3386b4['type']!=='VIRTUAL'){var _0x29ae1b={};_0x29ae1b[_0x3386b4[_0xc8aa('0x28')]]={'$like':'%'+_0x4968f4[_0xc8aa('0x30')][_0xc8aa('0x3a')]+'%'};return _0x29ae1b;}})});}_0x1594fb=_[_0xc8aa('0x3b')]({},_0x1594fb,_0x4968f4['options']);var _0x3426d3={'where':_0x1594fb['where']};return db[_0xc8aa('0x3c')]['count'](_0x3426d3)['then'](function(_0x32e88d){_0x494728['count']=_0x32e88d;if(_0x4968f4[_0xc8aa('0x30')]['includeAll']){_0x1594fb[_0xc8aa('0x3d')]=[{'all':!![]}];}return db[_0xc8aa('0x3c')][_0xc8aa('0x3e')](_0x1594fb);})['then'](function(_0x4d0325){_0x494728['rows']=_0x4d0325;return _0x494728;})['then'](respondWithFilteredResult(_0x3279e9,_0x1594fb))['catch'](handleError(_0x3279e9,null));};exports['show']=function(_0x52e321,_0x18253b){var _0x45b248={'raw':!![],'where':{'id':_0x52e321[_0xc8aa('0x3f')]['id']}},_0x4d72bc={};_0x4d72bc[_0xc8aa('0x2e')]=_[_0xc8aa('0x2f')](db['MailTransferReport'][_0xc8aa('0x2b')]);_0x4d72bc[_0xc8aa('0x30')]=_['keys'](_0x52e321[_0xc8aa('0x30')]);_0x4d72bc[_0xc8aa('0x31')]=_[_0xc8aa('0x32')](_0x4d72bc['model'],_0x4d72bc[_0xc8aa('0x30')]);_0x45b248[_0xc8aa('0x33')]=_[_0xc8aa('0x32')](_0x4d72bc[_0xc8aa('0x2e')],qs[_0xc8aa('0x34')](_0x52e321[_0xc8aa('0x30')]['fields']));_0x45b248['attributes']=_0x45b248[_0xc8aa('0x33')][_0xc8aa('0x40')]?_0x45b248[_0xc8aa('0x33')]:_0x4d72bc[_0xc8aa('0x2e')];if(_0x52e321[_0xc8aa('0x30')][_0xc8aa('0x41')]){_0x45b248[_0xc8aa('0x3d')]=[{'all':!![]}];}_0x45b248=_[_0xc8aa('0x3b')]({},_0x45b248,_0x52e321[_0xc8aa('0x42')]);return db[_0xc8aa('0x3c')][_0xc8aa('0x43')](_0x45b248)[_0xc8aa('0x26')](handleEntityNotFound(_0x18253b,null))[_0xc8aa('0x26')](respondWithResult(_0x18253b,null))[_0xc8aa('0x44')](handleError(_0x18253b,null));};exports[_0xc8aa('0x45')]=function(_0x5ed88d,_0x5de48f){return db[_0xc8aa('0x3c')][_0xc8aa('0x45')](_0x5ed88d['body'],{})[_0xc8aa('0x26')](respondWithResult(_0x5de48f,0xc9))['catch'](handleError(_0x5de48f,null));};exports['update']=function(_0x43edfc,_0x1a807f){if(_0x43edfc[_0xc8aa('0x46')]['id']){delete _0x43edfc[_0xc8aa('0x46')]['id'];}return db[_0xc8aa('0x3c')]['find']({'where':{'id':_0x43edfc[_0xc8aa('0x3f')]['id']}})[_0xc8aa('0x26')](handleEntityNotFound(_0x1a807f,null))[_0xc8aa('0x26')](saveUpdates(_0x43edfc[_0xc8aa('0x46')],null))['then'](respondWithResult(_0x1a807f,null))[_0xc8aa('0x44')](handleError(_0x1a807f,null));};exports[_0xc8aa('0x47')]=function(_0x13deb8,_0x222050){return db[_0xc8aa('0x3c')][_0xc8aa('0x43')]({'where':{'id':_0x13deb8['params']['id']}})[_0xc8aa('0x26')](handleEntityNotFound(_0x222050,null))[_0xc8aa('0x26')](removeEntity(_0x222050,null))['catch'](handleError(_0x222050,null));};exports[_0xc8aa('0x48')]=function(_0x28ef50,_0x111d1e){return db['MailTransferReport'][_0xc8aa('0x48')]()[_0xc8aa('0x26')](respondWithResult(_0x111d1e,null))[_0xc8aa('0x44')](handleError(_0x111d1e,null));}; \ No newline at end of file +var _0xf6a3=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','findAll','catch','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection'];(function(_0x1d2fca,_0x884727){var _0x48d1ff=function(_0x17719b){while(--_0x17719b){_0x1d2fca['push'](_0x1d2fca['shift']());}};_0x48d1ff(++_0x884727);}(_0xf6a3,0x195));var _0x3f6a=function(_0x10abb1,_0x3d06db){_0x10abb1=_0x10abb1-0x0;var _0x8836f6=_0xf6a3[_0x10abb1];return _0x8836f6;};'use strict';var emlformat=require(_0x3f6a('0x0'));var rimraf=require(_0x3f6a('0x1'));var zipdir=require(_0x3f6a('0x2'));var jsonpatch=require(_0x3f6a('0x3'));var rp=require('request-promise');var moment=require(_0x3f6a('0x4'));var BPromise=require(_0x3f6a('0x5'));var Mustache=require(_0x3f6a('0x6'));var util=require(_0x3f6a('0x7'));var path=require(_0x3f6a('0x8'));var sox=require(_0x3f6a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f6a('0xa'));var _=require(_0x3f6a('0xb'));var squel=require(_0x3f6a('0xc'));var crypto=require(_0x3f6a('0xd'));var jsforce=require(_0x3f6a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3f6a('0xf'));var querystring=require(_0x3f6a('0x10'));var Papa=require(_0x3f6a('0x11'));var Redis=require(_0x3f6a('0x12'));var authService=require(_0x3f6a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3f6a('0x14'));var hardwareService=require(_0x3f6a('0x15'));var logger=require(_0x3f6a('0x16'))(_0x3f6a('0x17'));var utils=require(_0x3f6a('0x18'));var config=require(_0x3f6a('0x19'));var licenseUtil=require(_0x3f6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ca8dd,_0x1f738a){_0x1f738a=_0x1f738a||0xcc;return function(_0xcbe8fc){if(_0xcbe8fc){return _0x3ca8dd['sendStatus'](_0x1f738a);}return _0x3ca8dd[_0x3f6a('0x1b')](_0x1f738a)['end']();};}function respondWithResult(_0x25b655,_0x2d0972){_0x2d0972=_0x2d0972||0xc8;return function(_0x30a7ad){if(_0x30a7ad){return _0x25b655[_0x3f6a('0x1b')](_0x2d0972)[_0x3f6a('0x1c')](_0x30a7ad);}};}function respondWithFilteredResult(_0x3d4a36,_0x131cd8){return function(_0x4b5459){if(_0x4b5459){var _0x5decf2=typeof _0x131cd8[_0x3f6a('0x1d')]===_0x3f6a('0x1e')&&typeof _0x131cd8[_0x3f6a('0x1f')]===_0x3f6a('0x1e');var _0xa99698=_0x4b5459['count'];var _0x26ae90=_0x5decf2?0x0:_0x131cd8[_0x3f6a('0x1d')];var _0x4fa593=_0x5decf2?_0x4b5459[_0x3f6a('0x20')]:_0x131cd8['offset']+_0x131cd8[_0x3f6a('0x1f')];var _0x196d84;if(_0x4fa593>=_0xa99698){_0x4fa593=_0xa99698;_0x196d84=0xc8;}else{_0x196d84=0xce;}_0x3d4a36[_0x3f6a('0x1b')](_0x196d84);return _0x3d4a36[_0x3f6a('0x21')](_0x3f6a('0x22'),_0x26ae90+'-'+_0x4fa593+'/'+_0xa99698)[_0x3f6a('0x1c')](_0x4b5459);}return null;};}function patchUpdates(_0x353d85){return function(_0x4e54b8){try{jsonpatch[_0x3f6a('0x23')](_0x4e54b8,_0x353d85,!![]);}catch(_0x199422){return BPromise['reject'](_0x199422);}return _0x4e54b8[_0x3f6a('0x24')]();};}function saveUpdates(_0x1f7e39,_0x30546d){return function(_0x47cf77){if(_0x47cf77){return _0x47cf77[_0x3f6a('0x25')](_0x1f7e39)['then'](function(_0x5659e8){return _0x5659e8;});}return null;};}function removeEntity(_0x39de68,_0x339910){return function(_0x3a5551){if(_0x3a5551){return _0x3a5551[_0x3f6a('0x26')]()[_0x3f6a('0x27')](function(){_0x39de68[_0x3f6a('0x1b')](0xcc)[_0x3f6a('0x28')]();});}};}function handleEntityNotFound(_0x5e61fd,_0x5ca212){return function(_0x335cb8){if(!_0x335cb8){_0x5e61fd[_0x3f6a('0x29')](0x194);}return _0x335cb8;};}function handleError(_0xc7a581,_0x3542f2){_0x3542f2=_0x3542f2||0x1f4;return function(_0x2cbf69){logger[_0x3f6a('0x2a')](_0x2cbf69['stack']);if(_0x2cbf69[_0x3f6a('0x2b')]){delete _0x2cbf69[_0x3f6a('0x2b')];}_0xc7a581['status'](_0x3542f2)[_0x3f6a('0x2c')](_0x2cbf69);};}exports[_0x3f6a('0x2d')]=function(_0x136437,_0x289065){var _0x5d3409={},_0x2218e4={},_0x593475={'count':0x0,'rows':[]};var _0x10fc5f=_['map'](db[_0x3f6a('0x2e')][_0x3f6a('0x2f')],function(_0x3f74fc){return{'name':_0x3f74fc[_0x3f6a('0x30')],'type':_0x3f74fc[_0x3f6a('0x31')][_0x3f6a('0x32')]};});_0x2218e4[_0x3f6a('0x33')]=_[_0x3f6a('0x34')](_0x10fc5f,'name');_0x2218e4['query']=_[_0x3f6a('0x35')](_0x136437[_0x3f6a('0x36')]);_0x2218e4[_0x3f6a('0x37')]=_[_0x3f6a('0x38')](_0x2218e4[_0x3f6a('0x33')],_0x2218e4['query']);_0x5d3409[_0x3f6a('0x39')]=_[_0x3f6a('0x38')](_0x2218e4[_0x3f6a('0x33')],qs[_0x3f6a('0x3a')](_0x136437[_0x3f6a('0x36')][_0x3f6a('0x3a')]));_0x5d3409['attributes']=_0x5d3409['attributes'][_0x3f6a('0x3b')]?_0x5d3409[_0x3f6a('0x39')]:_0x2218e4[_0x3f6a('0x33')];if(!_0x136437[_0x3f6a('0x36')][_0x3f6a('0x3c')](_0x3f6a('0x3d'))){_0x5d3409['limit']=qs[_0x3f6a('0x1f')](_0x136437[_0x3f6a('0x36')][_0x3f6a('0x1f')]);_0x5d3409[_0x3f6a('0x1d')]=qs['offset'](_0x136437['query'][_0x3f6a('0x1d')]);}_0x5d3409[_0x3f6a('0x3e')]=qs[_0x3f6a('0x3f')](_0x136437[_0x3f6a('0x36')][_0x3f6a('0x3f')]);_0x5d3409[_0x3f6a('0x40')]=qs[_0x3f6a('0x37')](_['pick'](_0x136437[_0x3f6a('0x36')],_0x2218e4['filters']),_0x10fc5f);if(_0x136437[_0x3f6a('0x36')][_0x3f6a('0x41')]){_0x5d3409[_0x3f6a('0x40')]=_[_0x3f6a('0x42')](_0x5d3409['where'],{'$or':_['map'](_0x10fc5f,function(_0x5c0993){if(_0x5c0993[_0x3f6a('0x31')]!=='VIRTUAL'){var _0x7b4453={};_0x7b4453[_0x5c0993[_0x3f6a('0x2b')]]={'$like':'%'+_0x136437['query'][_0x3f6a('0x41')]+'%'};return _0x7b4453;}})});}_0x5d3409=_[_0x3f6a('0x42')]({},_0x5d3409,_0x136437[_0x3f6a('0x43')]);var _0x1a1254={'where':_0x5d3409[_0x3f6a('0x40')]};return db['MailTransferReport'][_0x3f6a('0x20')](_0x1a1254)[_0x3f6a('0x27')](function(_0x183591){_0x593475['count']=_0x183591;if(_0x136437[_0x3f6a('0x36')]['includeAll']){_0x5d3409['include']=[{'all':!![]}];}return db[_0x3f6a('0x2e')][_0x3f6a('0x44')](_0x5d3409);})[_0x3f6a('0x27')](function(_0x3c58d1){_0x593475['rows']=_0x3c58d1;return _0x593475;})[_0x3f6a('0x27')](respondWithFilteredResult(_0x289065,_0x5d3409))[_0x3f6a('0x45')](handleError(_0x289065,null));};exports['show']=function(_0xfd634f,_0xf8e6e1){var _0x222e43={'raw':!![],'where':{'id':_0xfd634f[_0x3f6a('0x46')]['id']}},_0x1de0c1={};_0x1de0c1[_0x3f6a('0x33')]=_[_0x3f6a('0x35')](db[_0x3f6a('0x2e')]['rawAttributes']);_0x1de0c1[_0x3f6a('0x36')]=_['keys'](_0xfd634f[_0x3f6a('0x36')]);_0x1de0c1[_0x3f6a('0x37')]=_[_0x3f6a('0x38')](_0x1de0c1[_0x3f6a('0x33')],_0x1de0c1[_0x3f6a('0x36')]);_0x222e43[_0x3f6a('0x39')]=_[_0x3f6a('0x38')](_0x1de0c1[_0x3f6a('0x33')],qs[_0x3f6a('0x3a')](_0xfd634f['query']['fields']));_0x222e43[_0x3f6a('0x39')]=_0x222e43[_0x3f6a('0x39')]['length']?_0x222e43[_0x3f6a('0x39')]:_0x1de0c1['model'];if(_0xfd634f['query'][_0x3f6a('0x47')]){_0x222e43[_0x3f6a('0x48')]=[{'all':!![]}];}_0x222e43=_[_0x3f6a('0x42')]({},_0x222e43,_0xfd634f['options']);return db[_0x3f6a('0x2e')][_0x3f6a('0x49')](_0x222e43)['then'](handleEntityNotFound(_0xf8e6e1,null))[_0x3f6a('0x27')](respondWithResult(_0xf8e6e1,null))['catch'](handleError(_0xf8e6e1,null));};exports[_0x3f6a('0x4a')]=function(_0x5650c5,_0x5d40ee){return db[_0x3f6a('0x2e')][_0x3f6a('0x4a')](_0x5650c5[_0x3f6a('0x4b')],{})['then'](respondWithResult(_0x5d40ee,0xc9))[_0x3f6a('0x45')](handleError(_0x5d40ee,null));};exports[_0x3f6a('0x25')]=function(_0x2561fe,_0x2ef6bf){if(_0x2561fe[_0x3f6a('0x4b')]['id']){delete _0x2561fe[_0x3f6a('0x4b')]['id'];}return db[_0x3f6a('0x2e')][_0x3f6a('0x49')]({'where':{'id':_0x2561fe['params']['id']}})[_0x3f6a('0x27')](handleEntityNotFound(_0x2ef6bf,null))[_0x3f6a('0x27')](saveUpdates(_0x2561fe[_0x3f6a('0x4b')],null))['then'](respondWithResult(_0x2ef6bf,null))[_0x3f6a('0x45')](handleError(_0x2ef6bf,null));};exports[_0x3f6a('0x26')]=function(_0x14d826,_0x5485e6){return db[_0x3f6a('0x2e')][_0x3f6a('0x49')]({'where':{'id':_0x14d826[_0x3f6a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5485e6,null))[_0x3f6a('0x27')](removeEntity(_0x5485e6,null))[_0x3f6a('0x45')](handleError(_0x5485e6,null));};exports[_0x3f6a('0x4c')]=function(_0x31a4a7,_0x5e0478){return db[_0x3f6a('0x2e')][_0x3f6a('0x4c')]()[_0x3f6a('0x27')](respondWithResult(_0x5e0478,null))[_0x3f6a('0x45')](handleError(_0x5e0478,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c18aac0..63b4186 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x1cb9,0x14e));var _0x91cb=function(_0x367f1d,_0x256556){_0x367f1d=_0x367f1d-0x0;var _0x5ef4ca=_0x1cb9[_0x367f1d];return _0x5ef4ca;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1f9=['../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x216439,_0x3072e0){var _0x9a78bd=function(_0x7dd628){while(--_0x7dd628){_0x216439['push'](_0x216439['shift']());}};_0x9a78bd(++_0x3072e0);}(_0xd1f9,0x88));var _0x9d1f=function(_0x33eca6,_0x891651){_0x33eca6=_0x33eca6-0x0;var _0x1ada39=_0xd1f9[_0x33eca6];return _0x1ada39;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d1f('0x0'))(_0x9d1f('0x1'));var moment=require(_0x9d1f('0x2'));var BPromise=require(_0x9d1f('0x3'));var rp=require(_0x9d1f('0x4'));var fs=require('fs');var path=require(_0x9d1f('0x5'));var rimraf=require(_0x9d1f('0x6'));var config=require(_0x9d1f('0x7'));var attributes=require(_0x9d1f('0x8'));module['exports']=function(_0x3c4bad,_0x1a72d8){return _0x3c4bad[_0x9d1f('0x9')](_0x9d1f('0xa'),attributes,{'tableName':_0x9d1f('0xb'),'paranoid':![],'indexes':[{'name':_0x9d1f('0xc'),'fields':[_0x9d1f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9731694..4950472 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 _0x961a=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x961a,0x1b3));var _0xa961=function(_0xd84c7,_0x596096){_0xd84c7=_0xd84c7-0x0;var _0x8bda37=_0x961a[_0xd84c7];return _0x8bda37;};'use strict';var _=require('lodash');var util=require(_0xa961('0x0'));var moment=require(_0xa961('0x1'));var BPromise=require(_0xa961('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa961('0x3'));var db=require(_0xa961('0x4'))['db'];var utils=require(_0xa961('0x5'));var logger=require(_0xa961('0x6'))(_0xa961('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa961('0x8')][_0xa961('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33257a,_0xe34040,_0x4f0de6){return new BPromise(function(_0x181739,_0x33cf41){return client['request'](_0x33257a,_0x4f0de6)[_0xa961('0xa')](function(_0x59fb81){logger['info'](_0xa961('0xb'),_0xe34040,_0xa961('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xe34040,_0xa961('0xc'),JSON[_0xa961('0xd')](_0x59fb81));if(_0x59fb81['error']){if(_0x59fb81[_0xa961('0xe')][_0xa961('0xf')]===0x1f4){logger[_0xa961('0xe')]('MailTransferReport,\x20%s,\x20%s',_0xe34040,_0x59fb81[_0xa961('0xe')][_0xa961('0x10')]);return _0x33cf41(_0x59fb81[_0xa961('0xe')]['message']);}logger[_0xa961('0xe')](_0xa961('0xb'),_0xe34040,_0x59fb81[_0xa961('0xe')][_0xa961('0x10')]);return _0x181739(_0x59fb81['error']['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0xe34040,'request\x20sent');_0x181739(_0x59fb81[_0xa961('0x11')]['message']);}})[_0xa961('0x12')](function(_0x1f84bd){logger[_0xa961('0xe')](_0xa961('0xb'),_0xe34040,_0x1f84bd);_0x33cf41(_0x1f84bd);});});} \ No newline at end of file +var _0xba1d=['debug','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3d1868,_0x36d89f){var _0x28db7a=function(_0x48db9f){while(--_0x48db9f){_0x3d1868['push'](_0x3d1868['shift']());}};_0x28db7a(++_0x36d89f);}(_0xba1d,0x11c));var _0xdba1=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0xba1d[_0x3987a1];return _0xe2596e;};'use strict';var _=require(_0xdba1('0x0'));var util=require(_0xdba1('0x1'));var moment=require('moment');var BPromise=require(_0xdba1('0x2'));var rs=require(_0xdba1('0x3'));var fs=require('fs');var Redis=require(_0xdba1('0x4'));var db=require(_0xdba1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdba1('0x6'));var config=require(_0xdba1('0x7'));var jayson=require(_0xdba1('0x8'));var client=jayson[_0xdba1('0x9')][_0xdba1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3acaae,_0x31e955,_0x34d6f0){return new BPromise(function(_0x19d696,_0x19c479){return client[_0xdba1('0xb')](_0x3acaae,_0x34d6f0)[_0xdba1('0xc')](function(_0xec4c3a){logger[_0xdba1('0xd')](_0xdba1('0xe'),_0x31e955,_0xdba1('0xf'));logger[_0xdba1('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x31e955,_0xdba1('0xf'),JSON[_0xdba1('0x11')](_0xec4c3a));if(_0xec4c3a[_0xdba1('0x12')]){if(_0xec4c3a[_0xdba1('0x12')]['code']===0x1f4){logger['error'](_0xdba1('0xe'),_0x31e955,_0xec4c3a[_0xdba1('0x12')][_0xdba1('0x13')]);return _0x19c479(_0xec4c3a['error']['message']);}logger[_0xdba1('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x31e955,_0xec4c3a[_0xdba1('0x12')][_0xdba1('0x13')]);return _0x19d696(_0xec4c3a[_0xdba1('0x12')][_0xdba1('0x13')]);}else{logger[_0xdba1('0xd')](_0xdba1('0xe'),_0x31e955,'request\x20sent');_0x19d696(_0xec4c3a['result'][_0xdba1('0x13')]);}})['catch'](function(_0x580760){logger[_0xdba1('0x12')](_0xdba1('0xe'),_0x31e955,_0x580760);_0x19c479(_0x580760);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2f86368..f88f25e 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 _0x204a=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x33e5d9,_0x93908f){var _0x7b8d23=function(_0x3a3841){while(--_0x3a3841){_0x33e5d9['push'](_0x33e5d9['shift']());}};_0x7b8d23(++_0x93908f);}(_0x204a,0x17d));var _0xa204=function(_0x358cf8,_0x49e227){_0x358cf8=_0x358cf8-0x0;var _0x54555b=_0x204a[_0x358cf8];return _0x54555b;};'use strict';var multer=require(_0xa204('0x0'));var util=require(_0xa204('0x1'));var path=require('path');var timeout=require(_0xa204('0x2'));var express=require('express');var router=express[_0xa204('0x3')]();var fs_extra=require(_0xa204('0x4'));var auth=require(_0xa204('0x5'));var interaction=require(_0xa204('0x6'));var config=require(_0xa204('0x7'));var controller=require(_0xa204('0x8'));router[_0xa204('0x9')]('/',auth[_0xa204('0xa')](),controller[_0xa204('0xb')]);router[_0xa204('0x9')](_0xa204('0xc'),auth[_0xa204('0xa')](),controller[_0xa204('0xd')]);router['get'](_0xa204('0xe'),auth[_0xa204('0xa')](),controller[_0xa204('0xf')]);router[_0xa204('0x10')]('/',auth[_0xa204('0xa')](),controller[_0xa204('0x11')]);router[_0xa204('0x12')]('/:id',auth[_0xa204('0xa')](),controller[_0xa204('0x13')]);router[_0xa204('0x14')](_0xa204('0xe'),auth[_0xa204('0xa')](),controller[_0xa204('0x15')]);module[_0xa204('0x16')]=router; \ No newline at end of file +var _0x22bc=['describe','/:id','show','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index'];(function(_0x37e0c6,_0x129329){var _0x4c3a9b=function(_0xdf40e5){while(--_0xdf40e5){_0x37e0c6['push'](_0x37e0c6['shift']());}};_0x4c3a9b(++_0x129329);}(_0x22bc,0xd9));var _0xc22b=function(_0x5a3890,_0x1594bd){_0x5a3890=_0x5a3890-0x0;var _0x924bab=_0x22bc[_0x5a3890];return _0x924bab;};'use strict';var multer=require(_0xc22b('0x0'));var util=require('util');var path=require(_0xc22b('0x1'));var timeout=require('connect-timeout');var express=require(_0xc22b('0x2'));var router=express[_0xc22b('0x3')]();var fs_extra=require(_0xc22b('0x4'));var auth=require(_0xc22b('0x5'));var interaction=require(_0xc22b('0x6'));var config=require('../../config/environment');var controller=require(_0xc22b('0x7'));router[_0xc22b('0x8')]('/',auth[_0xc22b('0x9')](),controller[_0xc22b('0xa')]);router[_0xc22b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc22b('0xb')]);router[_0xc22b('0x8')](_0xc22b('0xc'),auth[_0xc22b('0x9')](),controller[_0xc22b('0xd')]);router['post']('/',auth[_0xc22b('0x9')](),controller['create']);router[_0xc22b('0xe')](_0xc22b('0xc'),auth[_0xc22b('0x9')](),controller[_0xc22b('0xf')]);router[_0xc22b('0x10')](_0xc22b('0xc'),auth[_0xc22b('0x9')](),controller[_0xc22b('0x11')]);module[_0xc22b('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c47159a..675d4e0 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 _0x31ee=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','diff','setDataValue','exitAt'];(function(_0x581cad,_0x355b2e){var _0x1a9f4b=function(_0x5c8461){while(--_0x5c8461){_0x581cad['push'](_0x581cad['shift']());}};_0x1a9f4b(++_0x355b2e);}(_0x31ee,0xf4));var _0xe31e=function(_0x294ba7,_0x3f0ec7){_0x294ba7=_0x294ba7-0x0;var _0x3606b6=_0x31ee[_0x294ba7];return _0x3606b6;};'use strict';var Sequelize=require(_0xe31e('0x0'));var moment=require(_0xe31e('0x1'));module[_0xe31e('0x2')]={'channel':{'type':Sequelize[_0xe31e('0x3')]},'membername':{'type':Sequelize[_0xe31e('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe31e('0x3')],'defaultValue':_0xe31e('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xe31e('0x5')]},'enterAt':{'type':Sequelize[_0xe31e('0x6')]},'exitAt':{'type':Sequelize[_0xe31e('0x6')],'set':function(_0x1483aa){var _0x10de21=moment(_0x1483aa);var _0x3ce090=moment(this['getDataValue'](_0xe31e('0x7')));var _0x24b27e=_0x10de21[_0xe31e('0x8')](_0x3ce090,'seconds');this[_0xe31e('0x9')](_0xe31e('0xa'),_0x1483aa);this[_0xe31e('0x9')](_0xe31e('0xb'),_0x24b27e>=0x0?_0x24b27e:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xe31e('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xe31e('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0xe31e('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0xe31e('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0xe31e('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xe31e('0x5')]},'uniqueid':{'type':Sequelize[_0xe31e('0x3')]}}; \ No newline at end of file +var _0x4696=['INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_0x4696,0xd8));var _0x6469=function(_0x1ead6c,_0x2d9795){_0x1ead6c=_0x1ead6c-0x0;var _0x48080d=_0x4696[_0x1ead6c];return _0x48080d;};'use strict';var Sequelize=require(_0x6469('0x0'));var moment=require('moment');module[_0x6469('0x1')]={'channel':{'type':Sequelize[_0x6469('0x2')]},'membername':{'type':Sequelize[_0x6469('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6469('0x2')],'defaultValue':_0x6469('0x3'),'comment':_0x6469('0x4')},'duration':{'type':Sequelize[_0x6469('0x5')]},'enterAt':{'type':Sequelize[_0x6469('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4b26ad){var _0x34b946=moment(_0x4b26ad);var _0x96f096=moment(this['getDataValue'](_0x6469('0x7')));var _0x486561=_0x34b946[_0x6469('0x8')](_0x96f096,_0x6469('0x9'));this[_0x6469('0xa')](_0x6469('0xb'),_0x4b26ad);this[_0x6469('0xa')](_0x6469('0xc'),_0x486561>=0x0?_0x486561:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x6469('0xd')},'data3':{'type':Sequelize[_0x6469('0x2')],'comment':_0x6469('0xe')},'data4':{'type':Sequelize[_0x6469('0x2')],'comment':_0x6469('0xf')},'data5':{'type':Sequelize[_0x6469('0x2')],'comment':_0x6469('0x10')},'role':{'type':Sequelize[_0x6469('0x2')]},'internal':{'type':Sequelize[_0x6469('0x5')]},'uniqueid':{'type':Sequelize[_0x6469('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 2d48c2a..a91243b 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1e88eb,_0x4d031e){var _0x23fe01=function(_0x42f79c){while(--_0x42f79c){_0x1e88eb['push'](_0x1e88eb['shift']());}};_0x23fe01(++_0x4d031e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _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(_0x4801be,_0x337b12){var _0x3ee896=function(_0x2b5fa8){while(--_0x2b5fa8){_0x4801be['push'](_0x4801be['shift']());}};_0x3ee896(++_0x337b12);}(_0x3e74,0x175));var _0x43e7=function(_0x51c160,_0x28530d){_0x51c160=_0x51c160-0x0;var _0x5de079=_0x3e74[_0x51c160];return _0x5de079;};'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 2eb3a9b..88901a3 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 _0x2036=['request-promise','path','rimraf','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2036,0x8c));var _0x6203=function(_0x134999,_0x4de0c9){_0x134999=_0x134999-0x0;var _0x46e471=_0x2036[_0x134999];return _0x46e471;};'use strict';var _=require('lodash');var util=require(_0x6203('0x0'));var logger=require(_0x6203('0x1'))(_0x6203('0x2'));var moment=require(_0x6203('0x3'));var BPromise=require('bluebird');var rp=require(_0x6203('0x4'));var fs=require('fs');var path=require(_0x6203('0x5'));var rimraf=require(_0x6203('0x6'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module['exports']=function(_0x20e11b,_0x136d1a){return _0x20e11b['define'](_0x6203('0x7'),attributes,{'tableName':_0x6203('0x8'),'paranoid':![],'indexes':[{'name':_0x6203('0x9'),'fields':[_0x6203('0xa'),_0x6203('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51d1=['request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0x51d1,0x1d6));var _0x151d=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x51d1[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x151d('0x0'));var util=require(_0x151d('0x1'));var logger=require(_0x151d('0x2'))(_0x151d('0x3'));var moment=require(_0x151d('0x4'));var BPromise=require(_0x151d('0x5'));var rp=require(_0x151d('0x6'));var fs=require('fs');var path=require(_0x151d('0x7'));var rimraf=require(_0x151d('0x8'));var config=require(_0x151d('0x9'));var attributes=require(_0x151d('0xa'));module['exports']=function(_0x556595,_0x3a7ebb){return _0x556595[_0x151d('0xb')](_0x151d('0xc'),attributes,{'tableName':_0x151d('0xd'),'paranoid':![],'indexes':[{'name':_0x151d('0xe'),'fields':[_0x151d('0xf'),_0x151d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ddddca8..243213b 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 _0xfa45=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','model','attributes','include','CreateMemberReport','create','UpdateMemberReport','body','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xfddf41,_0x25a9e7){var _0xb3956d=function(_0x2f2ffe){while(--_0x2f2ffe){_0xfddf41['push'](_0xfddf41['shift']());}};_0xb3956d(++_0x25a9e7);}(_0xfa45,0x11b));var _0x5fa4=function(_0x1c9c55,_0x4efedf){_0x1c9c55=_0x1c9c55-0x0;var _0x3287e5=_0xfa45[_0x1c9c55];return _0x3287e5;};'use strict';var _=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var moment=require(_0x5fa4('0x2'));var BPromise=require(_0x5fa4('0x3'));var rs=require(_0x5fa4('0x4'));var fs=require('fs');var Redis=require(_0x5fa4('0x5'));var db=require(_0x5fa4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fa4('0x7'))('rpc');var config=require(_0x5fa4('0x8'));var jayson=require(_0x5fa4('0x9'));var client=jayson[_0x5fa4('0xa')][_0x5fa4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28a266,_0x465a79,_0x298dce){return new BPromise(function(_0x108de1,_0xeb788d){return client[_0x5fa4('0xc')](_0x28a266,_0x298dce)['then'](function(_0x25d557){logger['info'](_0x5fa4('0xd'),_0x465a79,_0x5fa4('0xe'));logger[_0x5fa4('0xf')](_0x5fa4('0x10'),_0x465a79,_0x5fa4('0xe'),JSON[_0x5fa4('0x11')](_0x25d557));if(_0x25d557[_0x5fa4('0x12')]){if(_0x25d557[_0x5fa4('0x12')]['code']===0x1f4){logger[_0x5fa4('0x12')]('MemberReport,\x20%s,\x20%s',_0x465a79,_0x25d557[_0x5fa4('0x12')][_0x5fa4('0x13')]);return _0xeb788d(_0x25d557[_0x5fa4('0x12')][_0x5fa4('0x13')]);}logger[_0x5fa4('0x12')]('MemberReport,\x20%s,\x20%s',_0x465a79,_0x25d557[_0x5fa4('0x12')][_0x5fa4('0x13')]);return _0x108de1(_0x25d557['error'][_0x5fa4('0x13')]);}else{logger[_0x5fa4('0x14')]('MemberReport,\x20%s,\x20%s',_0x465a79,_0x5fa4('0xe'));_0x108de1(_0x25d557['result']['message']);}})[_0x5fa4('0x15')](function(_0x1645b1){logger[_0x5fa4('0x12')](_0x5fa4('0xd'),_0x465a79,_0x1645b1);_0xeb788d(_0x1645b1);});});}exports[_0x5fa4('0x16')]=function(_0x100a46){var _0x4a3924=this;return new Promise(function(_0x3d6380,_0x4ef44b){return db[_0x5fa4('0x17')][_0x5fa4('0x18')]({'raw':_0x100a46[_0x5fa4('0x19')]?_0x100a46[_0x5fa4('0x19')][_0x5fa4('0x1a')]===undefined?!![]:![]:!![],'where':_0x100a46[_0x5fa4('0x19')]?_0x100a46[_0x5fa4('0x19')][_0x5fa4('0x1b')]||null:null,'attributes':_0x100a46[_0x5fa4('0x19')]?_0x100a46[_0x5fa4('0x19')]['attributes']||null:null,'limit':_0x100a46['options']?_0x100a46[_0x5fa4('0x19')][_0x5fa4('0x1c')]||null:null,'include':_0x100a46[_0x5fa4('0x19')]?_0x100a46[_0x5fa4('0x19')]['include']?_['map'](_0x100a46[_0x5fa4('0x19')]['include'],function(_0xe63c6b){return{'model':db[_0xe63c6b[_0x5fa4('0x1d')]],'as':_0xe63c6b['as'],'attributes':_0xe63c6b[_0x5fa4('0x1e')],'include':_0xe63c6b[_0x5fa4('0x1f')]?_['map'](_0xe63c6b[_0x5fa4('0x1f')],function(_0x3d2abb){return{'model':db[_0x3d2abb[_0x5fa4('0x1d')]],'as':_0x3d2abb['as'],'attributes':_0x3d2abb[_0x5fa4('0x1e')],'include':_0x3d2abb['include']?_['map'](_0x3d2abb[_0x5fa4('0x1f')],function(_0x46a1d9){return{'model':db[_0x46a1d9[_0x5fa4('0x1d')]],'as':_0x46a1d9['as'],'attributes':_0x46a1d9[_0x5fa4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34006f){logger[_0x5fa4('0x14')](_0x5fa4('0x16'),_0x100a46);logger[_0x5fa4('0xf')]('GetMemberReport',_0x100a46,JSON['stringify'](_0x34006f));_0x3d6380(_0x34006f);})[_0x5fa4('0x15')](function(_0x379fff){logger[_0x5fa4('0x12')](_0x5fa4('0x16'),_0x379fff['message'],_0x100a46);_0x4ef44b(_0x4a3924[_0x5fa4('0x12')](0x1f4,_0x379fff[_0x5fa4('0x13')]));});});};exports[_0x5fa4('0x20')]=function(_0x25ce24){var _0x1f6b19=this;return new Promise(function(_0x1764b6,_0x2c5397){return db[_0x5fa4('0x17')][_0x5fa4('0x21')](_0x25ce24['body'],{'raw':_0x25ce24[_0x5fa4('0x19')]?_0x25ce24[_0x5fa4('0x19')][_0x5fa4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3b3f52){logger[_0x5fa4('0x14')](_0x5fa4('0x20'),_0x25ce24);logger[_0x5fa4('0xf')](_0x5fa4('0x20'),_0x25ce24,JSON[_0x5fa4('0x11')](_0x3b3f52));_0x1764b6(_0x3b3f52);})['catch'](function(_0x2f734f){logger[_0x5fa4('0x12')](_0x5fa4('0x20'),_0x2f734f[_0x5fa4('0x13')],_0x25ce24);_0x2c5397(_0x1f6b19[_0x5fa4('0x12')](0x1f4,_0x2f734f['message']));});});};exports[_0x5fa4('0x22')]=function(_0x2c31f8){var _0x51f03d=this;return new Promise(function(_0x254ec8,_0x508ff7){return db[_0x5fa4('0x17')]['update'](_0x2c31f8[_0x5fa4('0x23')],{'raw':_0x2c31f8[_0x5fa4('0x19')]?_0x2c31f8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c31f8['options']?_0x2c31f8[_0x5fa4('0x19')][_0x5fa4('0x1b')]||null:null,'attributes':_0x2c31f8[_0x5fa4('0x19')]?_0x2c31f8[_0x5fa4('0x19')]['attributes']||null:null,'limit':_0x2c31f8['options']?_0x2c31f8[_0x5fa4('0x19')][_0x5fa4('0x1c')]||null:null})[_0x5fa4('0x24')](function(_0x54f7be){logger[_0x5fa4('0x14')](_0x5fa4('0x22'),_0x2c31f8);logger[_0x5fa4('0xf')]('UpdateMemberReport',_0x2c31f8,JSON[_0x5fa4('0x11')](_0x54f7be));_0x254ec8(_0x54f7be);})[_0x5fa4('0x15')](function(_0x519c75){logger[_0x5fa4('0x12')]('UpdateMemberReport',_0x519c75[_0x5fa4('0x13')],_0x2c31f8);_0x508ff7(_0x51f03d[_0x5fa4('0x12')](0x1f4,_0x519c75[_0x5fa4('0x13')]));});});}; \ No newline at end of file +var _0xa49e=['map','model','then','info','catch','CreateMemberReport','UpdateMemberReport','update','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','MemberReport','findAll','options','where','attributes','include'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xa49e,0x1de));var _0xea49=function(_0x51f99e,_0x70684d){_0x51f99e=_0x51f99e-0x0;var _0x5b12cd=_0xa49e[_0x51f99e];return _0x5b12cd;};'use strict';var _=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var moment=require(_0xea49('0x2'));var BPromise=require(_0xea49('0x3'));var rs=require(_0xea49('0x4'));var fs=require('fs');var Redis=require(_0xea49('0x5'));var db=require(_0xea49('0x6'))['db'];var utils=require(_0xea49('0x7'));var logger=require('../../config/logger')(_0xea49('0x8'));var config=require(_0xea49('0x9'));var jayson=require(_0xea49('0xa'));var client=jayson['client'][_0xea49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x184e00,_0xc682a,_0x35c89e){return new BPromise(function(_0x304770,_0x4d4dee){return client[_0xea49('0xc')](_0x184e00,_0x35c89e)['then'](function(_0x1ab756){logger['info']('MemberReport,\x20%s,\x20%s',_0xc682a,'request\x20sent');logger[_0xea49('0xd')](_0xea49('0xe'),_0xc682a,_0xea49('0xf'),JSON[_0xea49('0x10')](_0x1ab756));if(_0x1ab756[_0xea49('0x11')]){if(_0x1ab756[_0xea49('0x11')][_0xea49('0x12')]===0x1f4){logger[_0xea49('0x11')](_0xea49('0x13'),_0xc682a,_0x1ab756[_0xea49('0x11')][_0xea49('0x14')]);return _0x4d4dee(_0x1ab756['error'][_0xea49('0x14')]);}logger[_0xea49('0x11')](_0xea49('0x13'),_0xc682a,_0x1ab756[_0xea49('0x11')]['message']);return _0x304770(_0x1ab756[_0xea49('0x11')][_0xea49('0x14')]);}else{logger['info'](_0xea49('0x13'),_0xc682a,_0xea49('0xf'));_0x304770(_0x1ab756[_0xea49('0x15')][_0xea49('0x14')]);}})['catch'](function(_0x538efa){logger[_0xea49('0x11')]('MemberReport,\x20%s,\x20%s',_0xc682a,_0x538efa);_0x4d4dee(_0x538efa);});});}exports[_0xea49('0x16')]=function(_0x2010a0){var _0x27d0a2=this;return new Promise(function(_0x5f2984,_0x2f0bf6){return db[_0xea49('0x17')][_0xea49('0x18')]({'raw':_0x2010a0['options']?_0x2010a0[_0xea49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2010a0[_0xea49('0x19')]?_0x2010a0[_0xea49('0x19')][_0xea49('0x1a')]||null:null,'attributes':_0x2010a0[_0xea49('0x19')]?_0x2010a0[_0xea49('0x19')][_0xea49('0x1b')]||null:null,'limit':_0x2010a0[_0xea49('0x19')]?_0x2010a0[_0xea49('0x19')]['limit']||null:null,'include':_0x2010a0[_0xea49('0x19')]?_0x2010a0['options'][_0xea49('0x1c')]?_[_0xea49('0x1d')](_0x2010a0[_0xea49('0x19')][_0xea49('0x1c')],function(_0x20c832){return{'model':db[_0x20c832['model']],'as':_0x20c832['as'],'attributes':_0x20c832[_0xea49('0x1b')],'include':_0x20c832[_0xea49('0x1c')]?_[_0xea49('0x1d')](_0x20c832[_0xea49('0x1c')],function(_0xb13981){return{'model':db[_0xb13981['model']],'as':_0xb13981['as'],'attributes':_0xb13981[_0xea49('0x1b')],'include':_0xb13981[_0xea49('0x1c')]?_[_0xea49('0x1d')](_0xb13981[_0xea49('0x1c')],function(_0x48deb4){return{'model':db[_0x48deb4[_0xea49('0x1e')]],'as':_0x48deb4['as'],'attributes':_0x48deb4[_0xea49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xea49('0x1f')](function(_0x180d2b){logger[_0xea49('0x20')]('GetMemberReport',_0x2010a0);logger[_0xea49('0xd')](_0xea49('0x16'),_0x2010a0,JSON[_0xea49('0x10')](_0x180d2b));_0x5f2984(_0x180d2b);})[_0xea49('0x21')](function(_0x1ed0d4){logger[_0xea49('0x11')](_0xea49('0x16'),_0x1ed0d4[_0xea49('0x14')],_0x2010a0);_0x2f0bf6(_0x27d0a2[_0xea49('0x11')](0x1f4,_0x1ed0d4['message']));});});};exports['CreateMemberReport']=function(_0x1e63a2){var _0x268266=this;return new Promise(function(_0x9d2618,_0x56d69c){return db[_0xea49('0x17')]['create'](_0x1e63a2['body'],{'raw':_0x1e63a2[_0xea49('0x19')]?_0x1e63a2[_0xea49('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xea49('0x1f')](function(_0x4cd235){logger[_0xea49('0x20')](_0xea49('0x22'),_0x1e63a2);logger[_0xea49('0xd')]('CreateMemberReport',_0x1e63a2,JSON[_0xea49('0x10')](_0x4cd235));_0x9d2618(_0x4cd235);})[_0xea49('0x21')](function(_0x3cf9cc){logger[_0xea49('0x11')](_0xea49('0x22'),_0x3cf9cc[_0xea49('0x14')],_0x1e63a2);_0x56d69c(_0x268266[_0xea49('0x11')](0x1f4,_0x3cf9cc[_0xea49('0x14')]));});});};exports[_0xea49('0x23')]=function(_0x502026){var _0x2c3fef=this;return new Promise(function(_0x40bbeb,_0x23ab88){return db['MemberReport'][_0xea49('0x24')](_0x502026[_0xea49('0x25')],{'raw':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')][_0xea49('0x1a')]||null:null,'attributes':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')][_0xea49('0x1b')]||null:null,'limit':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')][_0xea49('0x26')]||null:null})[_0xea49('0x1f')](function(_0x273a58){logger[_0xea49('0x20')](_0xea49('0x23'),_0x502026);logger['debug']('UpdateMemberReport',_0x502026,JSON[_0xea49('0x10')](_0x273a58));_0x40bbeb(_0x273a58);})[_0xea49('0x21')](function(_0x487c31){logger[_0xea49('0x11')](_0xea49('0x23'),_0x487c31['message'],_0x502026);_0x23ab88(_0x2c3fef['error'](0x1f4,_0x487c31['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 53f1fdd..ac1d2c2 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 _0x6927=['../../config/environment','./migration.controller','get','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x6927,0xf6));var _0x7692=function(_0x392591,_0xddb0b5){_0x392591=_0x392591-0x0;var _0x19f797=_0x6927[_0x392591];return _0x19f797;};'use strict';var multer=require(_0x7692('0x0'));var util=require('util');var path=require(_0x7692('0x1'));var timeout=require(_0x7692('0x2'));var express=require(_0x7692('0x3'));var router=express[_0x7692('0x4')]();var fs_extra=require(_0x7692('0x5'));var auth=require(_0x7692('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7692('0x7'));var controller=require(_0x7692('0x8'));router[_0x7692('0x9')]('/',controller['index']);module[_0x7692('0xa')]=router; \ No newline at end of file +var _0x79a8=['index','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x30a109,_0xfca8b5){var _0x510bf5=function(_0x1c8e52){while(--_0x1c8e52){_0x30a109['push'](_0x30a109['shift']());}};_0x510bf5(++_0xfca8b5);}(_0x79a8,0x1d0));var _0x879a=function(_0x3f25c4,_0x7d5eb5){_0x3f25c4=_0x3f25c4-0x0;var _0x2b213d=_0x79a8[_0x3f25c4];return _0x2b213d;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',controller[_0x879a('0x9')]);module[_0x879a('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4e1c858..9143ea0 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 _0x7fd9=['version','exports','STRING'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0x7fd9,0xfd));var _0x97fd=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x7fd9[_0x1ad926];return _0x1b81dc;};'use strict';var Sequelize=require('sequelize');module[_0x97fd('0x0')]={'version':{'type':Sequelize[_0x97fd('0x1')],'unique':_0x97fd('0x2')}}; \ No newline at end of file +var _0xfd78=['sequelize','version'];(function(_0x2b81d0,_0x4f0bad){var _0x4060d3=function(_0x34691b){while(--_0x34691b){_0x2b81d0['push'](_0x2b81d0['shift']());}};_0x4060d3(++_0x4f0bad);}(_0xfd78,0xee));var _0x8fd7=function(_0x428b70,_0x38fdd7){_0x428b70=_0x428b70-0x0;var _0x4442dc=_0xfd78[_0x428b70];return _0x4442dc;};'use strict';var Sequelize=require(_0x8fd7('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x8fd7('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 12f4e8f..4efc028 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 _0x1ff6=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','Migration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path'];(function(_0x356894,_0x178ae1){var _0x4f55d5=function(_0x523c57){while(--_0x523c57){_0x356894['push'](_0x356894['shift']());}};_0x4f55d5(++_0x178ae1);}(_0x1ff6,0x191));var _0x61ff=function(_0x5b5ae3,_0xff9830){_0x5b5ae3=_0x5b5ae3-0x0;var _0x242c57=_0x1ff6[_0x5b5ae3];return _0x242c57;};'use strict';var emlformat=require(_0x61ff('0x0'));var rimraf=require(_0x61ff('0x1'));var zipdir=require(_0x61ff('0x2'));var jsonpatch=require(_0x61ff('0x3'));var rp=require(_0x61ff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x61ff('0x5'));var path=require(_0x61ff('0x6'));var sox=require(_0x61ff('0x7'));var csv=require('to-csv');var ejs=require(_0x61ff('0x8'));var fs=require('fs');var fs_extra=require(_0x61ff('0x9'));var _=require(_0x61ff('0xa'));var squel=require(_0x61ff('0xb'));var crypto=require(_0x61ff('0xc'));var jsforce=require(_0x61ff('0xd'));var deskjs=require(_0x61ff('0xe'));var toCsv=require(_0x61ff('0xf'));var querystring=require(_0x61ff('0x10'));var Papa=require(_0x61ff('0x11'));var Redis=require('ioredis');var authService=require(_0x61ff('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x61ff('0x13'));var hardwareService=require(_0x61ff('0x14'));var logger=require('../../config/logger')(_0x61ff('0x15'));var utils=require('../../config/utils');var config=require(_0x61ff('0x16'));var licenseUtil=require(_0x61ff('0x17'));var db=require(_0x61ff('0x18'))['db'];function respondWithStatusCode(_0x4f14ec,_0x31414f){_0x31414f=_0x31414f||0xcc;return function(_0x212305){if(_0x212305){return _0x4f14ec['sendStatus'](_0x31414f);}return _0x4f14ec[_0x61ff('0x19')](_0x31414f)['end']();};}function respondWithResult(_0x4a744d,_0x1715d9){_0x1715d9=_0x1715d9||0xc8;return function(_0x441c4d){if(_0x441c4d){return _0x4a744d[_0x61ff('0x19')](_0x1715d9)[_0x61ff('0x1a')](_0x441c4d);}};}function respondWithFilteredResult(_0x2e1aba,_0x1cbbc9){return function(_0x128128){if(_0x128128){var _0x42fe0e=typeof _0x1cbbc9['offset']===_0x61ff('0x1b')&&typeof _0x1cbbc9[_0x61ff('0x1c')]===_0x61ff('0x1b');var _0x12d074=_0x128128[_0x61ff('0x1d')];var _0x4d8648=_0x42fe0e?0x0:_0x1cbbc9[_0x61ff('0x1e')];var _0x238949=_0x42fe0e?_0x128128[_0x61ff('0x1d')]:_0x1cbbc9['offset']+_0x1cbbc9[_0x61ff('0x1c')];var _0xd66ac7;if(_0x238949>=_0x12d074){_0x238949=_0x12d074;_0xd66ac7=0xc8;}else{_0xd66ac7=0xce;}_0x2e1aba[_0x61ff('0x19')](_0xd66ac7);return _0x2e1aba[_0x61ff('0x1f')](_0x61ff('0x20'),_0x4d8648+'-'+_0x238949+'/'+_0x12d074)[_0x61ff('0x1a')](_0x128128);}return null;};}function patchUpdates(_0x1976ec){return function(_0x148657){try{jsonpatch[_0x61ff('0x21')](_0x148657,_0x1976ec,!![]);}catch(_0x502ee7){return BPromise[_0x61ff('0x22')](_0x502ee7);}return _0x148657[_0x61ff('0x23')]();};}function saveUpdates(_0x2b9b58,_0x240962){return function(_0x2e461e){if(_0x2e461e){return _0x2e461e[_0x61ff('0x24')](_0x2b9b58)[_0x61ff('0x25')](function(_0x1dbd35){return _0x1dbd35;});}return null;};}function removeEntity(_0x5ec40e,_0x5de69d){return function(_0x472931){if(_0x472931){return _0x472931[_0x61ff('0x26')]()['then'](function(){_0x5ec40e['status'](0xcc)[_0x61ff('0x27')]();});}};}function handleEntityNotFound(_0x3efa10,_0x3ed80c){return function(_0x585ca9){if(!_0x585ca9){_0x3efa10['sendStatus'](0x194);}return _0x585ca9;};}function handleError(_0x3da36e,_0x5bebc4){_0x5bebc4=_0x5bebc4||0x1f4;return function(_0x4b0850){logger['error'](_0x4b0850['stack']);if(_0x4b0850[_0x61ff('0x28')]){delete _0x4b0850[_0x61ff('0x28')];}_0x3da36e['status'](_0x5bebc4)[_0x61ff('0x29')](_0x4b0850);};}exports[_0x61ff('0x2a')]=function(_0x48c178,_0x2f3305){var _0x3dfd8c={},_0x1f5d15={},_0x57aaf9={'count':0x0,'rows':[]};var _0x19b6c5=_[_0x61ff('0x2b')](db[_0x61ff('0x2c')]['rawAttributes'],function(_0x2a75a4){return{'name':_0x2a75a4[_0x61ff('0x2d')],'type':_0x2a75a4[_0x61ff('0x2e')][_0x61ff('0x2f')]};});_0x1f5d15[_0x61ff('0x30')]=_[_0x61ff('0x2b')](_0x19b6c5,_0x61ff('0x28'));_0x1f5d15['query']=_['keys'](_0x48c178[_0x61ff('0x31')]);_0x1f5d15[_0x61ff('0x32')]=_[_0x61ff('0x33')](_0x1f5d15['model'],_0x1f5d15[_0x61ff('0x31')]);_0x3dfd8c[_0x61ff('0x34')]=_['intersection'](_0x1f5d15['model'],qs[_0x61ff('0x35')](_0x48c178[_0x61ff('0x31')][_0x61ff('0x35')]));_0x3dfd8c['attributes']=_0x3dfd8c[_0x61ff('0x34')][_0x61ff('0x36')]?_0x3dfd8c['attributes']:_0x1f5d15[_0x61ff('0x30')];if(!_0x48c178[_0x61ff('0x31')][_0x61ff('0x37')](_0x61ff('0x38'))){_0x3dfd8c[_0x61ff('0x1c')]=qs[_0x61ff('0x1c')](_0x48c178['query']['limit']);_0x3dfd8c[_0x61ff('0x1e')]=qs[_0x61ff('0x1e')](_0x48c178[_0x61ff('0x31')]['offset']);}_0x3dfd8c[_0x61ff('0x39')]=qs[_0x61ff('0x3a')](_0x48c178[_0x61ff('0x31')][_0x61ff('0x3a')]);_0x3dfd8c[_0x61ff('0x3b')]=qs['filters'](_[_0x61ff('0x3c')](_0x48c178[_0x61ff('0x31')],_0x1f5d15[_0x61ff('0x32')]),_0x19b6c5);if(_0x48c178[_0x61ff('0x31')][_0x61ff('0x3d')]){_0x3dfd8c[_0x61ff('0x3b')]=_[_0x61ff('0x3e')](_0x3dfd8c[_0x61ff('0x3b')],{'$or':_[_0x61ff('0x2b')](_0x19b6c5,function(_0x31d4d9){if(_0x31d4d9['type']!=='VIRTUAL'){var _0x34d042={};_0x34d042[_0x31d4d9['name']]={'$like':'%'+_0x48c178[_0x61ff('0x31')][_0x61ff('0x3d')]+'%'};return _0x34d042;}})});}_0x3dfd8c=_[_0x61ff('0x3e')]({},_0x3dfd8c,_0x48c178[_0x61ff('0x3f')]);var _0x2c8ae5={'where':_0x3dfd8c[_0x61ff('0x3b')]};return db[_0x61ff('0x2c')][_0x61ff('0x1d')](_0x2c8ae5)['then'](function(_0x319658){_0x57aaf9['count']=_0x319658;if(_0x48c178[_0x61ff('0x31')][_0x61ff('0x40')]){_0x3dfd8c[_0x61ff('0x41')]=[{'all':!![]}];}return db[_0x61ff('0x2c')]['findAll'](_0x3dfd8c);})[_0x61ff('0x25')](function(_0x99ced0){_0x57aaf9[_0x61ff('0x42')]=_0x99ced0;return _0x57aaf9;})[_0x61ff('0x25')](respondWithFilteredResult(_0x2f3305,_0x3dfd8c))[_0x61ff('0x43')](handleError(_0x2f3305,null));}; \ No newline at end of file +var _0xe2e2=['filters','intersection','fields','attributes','length','model','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Migration','type','key','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2e2,0xe4));var _0x2e2e=function(_0x19de5d,_0x41f9fe){_0x19de5d=_0x19de5d-0x0;var _0x1a564b=_0xe2e2[_0x19de5d];return _0x1a564b;};'use strict';var emlformat=require(_0x2e2e('0x0'));var rimraf=require(_0x2e2e('0x1'));var zipdir=require(_0x2e2e('0x2'));var jsonpatch=require(_0x2e2e('0x3'));var rp=require(_0x2e2e('0x4'));var moment=require(_0x2e2e('0x5'));var BPromise=require(_0x2e2e('0x6'));var Mustache=require(_0x2e2e('0x7'));var util=require('util');var path=require(_0x2e2e('0x8'));var sox=require(_0x2e2e('0x9'));var csv=require(_0x2e2e('0xa'));var ejs=require(_0x2e2e('0xb'));var fs=require('fs');var fs_extra=require(_0x2e2e('0xc'));var _=require(_0x2e2e('0xd'));var squel=require(_0x2e2e('0xe'));var crypto=require(_0x2e2e('0xf'));var jsforce=require(_0x2e2e('0x10'));var deskjs=require(_0x2e2e('0x11'));var toCsv=require(_0x2e2e('0xa'));var querystring=require('querystring');var Papa=require(_0x2e2e('0x12'));var Redis=require(_0x2e2e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2e2e('0x14'));var as=require(_0x2e2e('0x15'));var hardwareService=require(_0x2e2e('0x16'));var logger=require('../../config/logger')(_0x2e2e('0x17'));var utils=require(_0x2e2e('0x18'));var config=require(_0x2e2e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e2e('0x1a'))['db'];function respondWithStatusCode(_0x15187e,_0x568adb){_0x568adb=_0x568adb||0xcc;return function(_0x3f7b39){if(_0x3f7b39){return _0x15187e[_0x2e2e('0x1b')](_0x568adb);}return _0x15187e[_0x2e2e('0x1c')](_0x568adb)['end']();};}function respondWithResult(_0x1b78bb,_0x2a7557){_0x2a7557=_0x2a7557||0xc8;return function(_0x4882ee){if(_0x4882ee){return _0x1b78bb[_0x2e2e('0x1c')](_0x2a7557)[_0x2e2e('0x1d')](_0x4882ee);}};}function respondWithFilteredResult(_0x5210af,_0x47c146){return function(_0xb106f3){if(_0xb106f3){var _0x10aace=typeof _0x47c146[_0x2e2e('0x1e')]==='undefined'&&typeof _0x47c146[_0x2e2e('0x1f')]===_0x2e2e('0x20');var _0x26eff4=_0xb106f3[_0x2e2e('0x21')];var _0x3f1021=_0x10aace?0x0:_0x47c146[_0x2e2e('0x1e')];var _0x4db8bc=_0x10aace?_0xb106f3['count']:_0x47c146['offset']+_0x47c146[_0x2e2e('0x1f')];var _0xf8b315;if(_0x4db8bc>=_0x26eff4){_0x4db8bc=_0x26eff4;_0xf8b315=0xc8;}else{_0xf8b315=0xce;}_0x5210af[_0x2e2e('0x1c')](_0xf8b315);return _0x5210af['set'](_0x2e2e('0x22'),_0x3f1021+'-'+_0x4db8bc+'/'+_0x26eff4)[_0x2e2e('0x1d')](_0xb106f3);}return null;};}function patchUpdates(_0x2e8f64){return function(_0x5108a5){try{jsonpatch[_0x2e2e('0x23')](_0x5108a5,_0x2e8f64,!![]);}catch(_0x5698ea){return BPromise[_0x2e2e('0x24')](_0x5698ea);}return _0x5108a5[_0x2e2e('0x25')]();};}function saveUpdates(_0x32e73d,_0x13676a){return function(_0x5a750a){if(_0x5a750a){return _0x5a750a[_0x2e2e('0x26')](_0x32e73d)[_0x2e2e('0x27')](function(_0x1a94bb){return _0x1a94bb;});}return null;};}function removeEntity(_0x12e8a2,_0x152ea6){return function(_0x17992d){if(_0x17992d){return _0x17992d[_0x2e2e('0x28')]()[_0x2e2e('0x27')](function(){_0x12e8a2[_0x2e2e('0x1c')](0xcc)[_0x2e2e('0x29')]();});}};}function handleEntityNotFound(_0x35322a,_0x424049){return function(_0x95f5a5){if(!_0x95f5a5){_0x35322a['sendStatus'](0x194);}return _0x95f5a5;};}function handleError(_0x26a12e,_0x564801){_0x564801=_0x564801||0x1f4;return function(_0x134663){logger[_0x2e2e('0x2a')](_0x134663[_0x2e2e('0x2b')]);if(_0x134663[_0x2e2e('0x2c')]){delete _0x134663[_0x2e2e('0x2c')];}_0x26a12e['status'](_0x564801)[_0x2e2e('0x2d')](_0x134663);};}exports[_0x2e2e('0x2e')]=function(_0xbdf479,_0x18c965){var _0x3484c6={},_0x2ef0b4={},_0x51671d={'count':0x0,'rows':[]};var _0x326559=_[_0x2e2e('0x2f')](db[_0x2e2e('0x30')]['rawAttributes'],function(_0x2ded83){return{'name':_0x2ded83['fieldName'],'type':_0x2ded83[_0x2e2e('0x31')][_0x2e2e('0x32')]};});_0x2ef0b4['model']=_[_0x2e2e('0x2f')](_0x326559,_0x2e2e('0x2c'));_0x2ef0b4[_0x2e2e('0x33')]=_['keys'](_0xbdf479[_0x2e2e('0x33')]);_0x2ef0b4[_0x2e2e('0x34')]=_[_0x2e2e('0x35')](_0x2ef0b4['model'],_0x2ef0b4[_0x2e2e('0x33')]);_0x3484c6['attributes']=_['intersection'](_0x2ef0b4['model'],qs[_0x2e2e('0x36')](_0xbdf479[_0x2e2e('0x33')][_0x2e2e('0x36')]));_0x3484c6[_0x2e2e('0x37')]=_0x3484c6['attributes'][_0x2e2e('0x38')]?_0x3484c6[_0x2e2e('0x37')]:_0x2ef0b4[_0x2e2e('0x39')];if(!_0xbdf479['query'][_0x2e2e('0x3a')]('nolimit')){_0x3484c6[_0x2e2e('0x1f')]=qs[_0x2e2e('0x1f')](_0xbdf479[_0x2e2e('0x33')]['limit']);_0x3484c6[_0x2e2e('0x1e')]=qs[_0x2e2e('0x1e')](_0xbdf479[_0x2e2e('0x33')][_0x2e2e('0x1e')]);}_0x3484c6['order']=qs[_0x2e2e('0x3b')](_0xbdf479['query'][_0x2e2e('0x3b')]);_0x3484c6['where']=qs['filters'](_[_0x2e2e('0x3c')](_0xbdf479[_0x2e2e('0x33')],_0x2ef0b4['filters']),_0x326559);if(_0xbdf479[_0x2e2e('0x33')][_0x2e2e('0x3d')]){_0x3484c6[_0x2e2e('0x3e')]=_['merge'](_0x3484c6[_0x2e2e('0x3e')],{'$or':_['map'](_0x326559,function(_0x3d37be){if(_0x3d37be[_0x2e2e('0x31')]!==_0x2e2e('0x3f')){var _0x3726fa={};_0x3726fa[_0x3d37be[_0x2e2e('0x2c')]]={'$like':'%'+_0xbdf479[_0x2e2e('0x33')]['filter']+'%'};return _0x3726fa;}})});}_0x3484c6=_[_0x2e2e('0x40')]({},_0x3484c6,_0xbdf479[_0x2e2e('0x41')]);var _0x4e2a97={'where':_0x3484c6[_0x2e2e('0x3e')]};return db['Migration']['count'](_0x4e2a97)[_0x2e2e('0x27')](function(_0x143e80){_0x51671d[_0x2e2e('0x21')]=_0x143e80;if(_0xbdf479[_0x2e2e('0x33')][_0x2e2e('0x42')]){_0x3484c6[_0x2e2e('0x43')]=[{'all':!![]}];}return db[_0x2e2e('0x30')]['findAll'](_0x3484c6);})['then'](function(_0xa3ef1f){_0x51671d[_0x2e2e('0x44')]=_0xa3ef1f;return _0x51671d;})[_0x2e2e('0x27')](respondWithFilteredResult(_0x18c965,_0x3484c6))[_0x2e2e('0x45')](handleError(_0x18c965,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e269f4d..f8d73ce 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 _0xa86f=['rimraf','../../config/environment','./migration.attributes','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x49be90,_0x34c3ab){var _0x202603=function(_0xdf8d74){while(--_0xdf8d74){_0x49be90['push'](_0x49be90['shift']());}};_0x202603(++_0x34c3ab);}(_0xa86f,0x95));var _0xfa86=function(_0x32eed6,_0xc5ca1b){_0x32eed6=_0x32eed6-0x0;var _0x2349ce=_0xa86f[_0x32eed6];return _0x2349ce;};'use strict';var _=require(_0xfa86('0x0'));var util=require(_0xfa86('0x1'));var logger=require(_0xfa86('0x2'))(_0xfa86('0x3'));var moment=require(_0xfa86('0x4'));var BPromise=require(_0xfa86('0x5'));var rp=require(_0xfa86('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa86('0x7'));var config=require(_0xfa86('0x8'));var attributes=require(_0xfa86('0x9'));module['exports']=function(_0x1e0503,_0x2fd5b4){return _0x1e0503[_0xfa86('0xa')](_0xfa86('0xb'),attributes,{'tableName':_0xfa86('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21d9=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration','migrations','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x21d9,0x182));var _0x921d=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x21d9[_0x55ff79];return _0x579067;};'use strict';var _=require('lodash');var util=require(_0x921d('0x0'));var logger=require(_0x921d('0x1'))(_0x921d('0x2'));var moment=require(_0x921d('0x3'));var BPromise=require(_0x921d('0x4'));var rp=require(_0x921d('0x5'));var fs=require('fs');var path=require(_0x921d('0x6'));var rimraf=require(_0x921d('0x7'));var config=require(_0x921d('0x8'));var attributes=require(_0x921d('0x9'));module['exports']=function(_0x30e926,_0x5c2f03){return _0x30e926[_0x921d('0xa')](_0x921d('0xb'),attributes,{'tableName':_0x921d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 8652115..846c767 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 _0x5bc5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5bc5,0xb2));var _0x55bc=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x5bc5[_0x10df1e];return _0x3e24fb;};'use strict';var _=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var moment=require(_0x55bc('0x2'));var BPromise=require(_0x55bc('0x3'));var rs=require(_0x55bc('0x4'));var fs=require('fs');var Redis=require(_0x55bc('0x5'));var db=require(_0x55bc('0x6'))['db'];var utils=require(_0x55bc('0x7'));var logger=require(_0x55bc('0x8'))(_0x55bc('0x9'));var config=require(_0x55bc('0xa'));var jayson=require(_0x55bc('0xb'));var client=jayson[_0x55bc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d78d6,_0x5719c9,_0x2a612b){return new BPromise(function(_0x38839e,_0x4d0610){return client[_0x55bc('0xd')](_0x4d78d6,_0x2a612b)[_0x55bc('0xe')](function(_0xc535ac){logger[_0x55bc('0xf')](_0x55bc('0x10'),_0x5719c9,_0x55bc('0x11'));logger[_0x55bc('0x12')](_0x55bc('0x13'),_0x5719c9,'request\x20sent',JSON[_0x55bc('0x14')](_0xc535ac));if(_0xc535ac[_0x55bc('0x15')]){if(_0xc535ac[_0x55bc('0x15')]['code']===0x1f4){logger[_0x55bc('0x15')]('Migration,\x20%s,\x20%s',_0x5719c9,_0xc535ac[_0x55bc('0x15')][_0x55bc('0x16')]);return _0x4d0610(_0xc535ac[_0x55bc('0x15')]['message']);}logger[_0x55bc('0x15')]('Migration,\x20%s,\x20%s',_0x5719c9,_0xc535ac[_0x55bc('0x15')][_0x55bc('0x16')]);return _0x38839e(_0xc535ac[_0x55bc('0x15')]['message']);}else{logger[_0x55bc('0xf')](_0x55bc('0x10'),_0x5719c9,'request\x20sent');_0x38839e(_0xc535ac['result'][_0x55bc('0x16')]);}})['catch'](function(_0x482eea){logger[_0x55bc('0x15')](_0x55bc('0x10'),_0x5719c9,_0x482eea);_0x4d0610(_0x482eea);});});} \ No newline at end of file +var _0x7b05=['error','code','Migration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2b2e69,_0x463fe8){var _0x5eb04d=function(_0x21d818){while(--_0x21d818){_0x2b2e69['push'](_0x2b2e69['shift']());}};_0x5eb04d(++_0x463fe8);}(_0x7b05,0x91));var _0x57b0=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x7b05[_0x2f3d29];return _0x53d69d;};'use strict';var _=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var moment=require(_0x57b0('0x2'));var BPromise=require(_0x57b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x57b0('0x5'));var logger=require(_0x57b0('0x6'))(_0x57b0('0x7'));var config=require(_0x57b0('0x8'));var jayson=require(_0x57b0('0x9'));var client=jayson['client'][_0x57b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d8aae,_0x2f67ae,_0x289bea){return new BPromise(function(_0x4c970f,_0x59e88a){return client['request'](_0x4d8aae,_0x289bea)['then'](function(_0x13988a){logger[_0x57b0('0xb')]('Migration,\x20%s,\x20%s',_0x2f67ae,'request\x20sent');logger['debug'](_0x57b0('0xc'),_0x2f67ae,_0x57b0('0xd'),JSON[_0x57b0('0xe')](_0x13988a));if(_0x13988a[_0x57b0('0xf')]){if(_0x13988a[_0x57b0('0xf')][_0x57b0('0x10')]===0x1f4){logger['error'](_0x57b0('0x11'),_0x2f67ae,_0x13988a[_0x57b0('0xf')][_0x57b0('0x12')]);return _0x59e88a(_0x13988a['error']['message']);}logger[_0x57b0('0xf')](_0x57b0('0x11'),_0x2f67ae,_0x13988a[_0x57b0('0xf')][_0x57b0('0x12')]);return _0x4c970f(_0x13988a['error'][_0x57b0('0x12')]);}else{logger['info'](_0x57b0('0x11'),_0x2f67ae,_0x57b0('0xd'));_0x4c970f(_0x13988a['result'][_0x57b0('0x12')]);}})[_0x57b0('0x13')](function(_0x8bb929){logger[_0x57b0('0xf')](_0x57b0('0x11'),_0x2f67ae,_0x8bb929);_0x59e88a(_0x8bb929);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index b680a5b..2d17ee7 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 _0x46c9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','path','connect-timeout','express','Router'];(function(_0x1102ef,_0x2d8385){var _0xbfbd56=function(_0x4c83c7){while(--_0x4c83c7){_0x1102ef['push'](_0x1102ef['shift']());}};_0xbfbd56(++_0x2d8385);}(_0x46c9,0x106));var _0x946c=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0x46c9[_0x118653];return _0xc11fa6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x946c('0x0'));var timeout=require(_0x946c('0x1'));var express=require(_0x946c('0x2'));var router=express[_0x946c('0x3')]();var fs_extra=require(_0x946c('0x4'));var auth=require(_0x946c('0x5'));var interaction=require(_0x946c('0x6'));var config=require(_0x946c('0x7'));var controller=require(_0x946c('0x8'));router[_0x946c('0x9')]('/',auth[_0x946c('0xa')](),controller[_0x946c('0xb')]);router[_0x946c('0x9')](_0x946c('0xc'),auth[_0x946c('0xa')](),controller[_0x946c('0xd')]);router[_0x946c('0xe')]('/',auth[_0x946c('0xa')](),controller[_0x946c('0xf')]);router[_0x946c('0x10')]('/:id',auth[_0x946c('0xa')](),controller[_0x946c('0x11')]);router['delete'](_0x946c('0xc'),auth['isAuthenticated'](),controller[_0x946c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7ebb=['../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2bdcfd,_0x32697d){var _0x53a635=function(_0x5de676){while(--_0x5de676){_0x2bdcfd['push'](_0x2bdcfd['shift']());}};_0x53a635(++_0x32697d);}(_0x7ebb,0x161));var _0xb7eb=function(_0x4e2861,_0x199be0){_0x4e2861=_0x4e2861-0x0;var _0x2265e3=_0x7ebb[_0x4e2861];return _0x2265e3;};'use strict';var multer=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var path=require(_0xb7eb('0x2'));var timeout=require(_0xb7eb('0x3'));var express=require(_0xb7eb('0x4'));var router=express[_0xb7eb('0x5')]();var fs_extra=require(_0xb7eb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb7eb('0x7'));var config=require(_0xb7eb('0x8'));var controller=require(_0xb7eb('0x9'));router[_0xb7eb('0xa')]('/',auth[_0xb7eb('0xb')](),controller[_0xb7eb('0xc')]);router[_0xb7eb('0xa')](_0xb7eb('0xd'),auth[_0xb7eb('0xb')](),controller[_0xb7eb('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb7eb('0xf')]);router[_0xb7eb('0x10')](_0xb7eb('0xd'),auth[_0xb7eb('0xb')](),controller['update']);router[_0xb7eb('0x11')](_0xb7eb('0xd'),auth['isAuthenticated'](),controller[_0xb7eb('0x12')]);module[_0xb7eb('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c46e10f..12f7481 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 _0x6ee5=['exports','ENUM','localnet','externip','turn','STRING','sequelize'];(function(_0x4f32e6,_0x4c9028){var _0x125c78=function(_0xe85e9b){while(--_0xe85e9b){_0x4f32e6['push'](_0x4f32e6['shift']());}};_0x125c78(++_0x4c9028);}(_0x6ee5,0x11e));var _0x56ee=function(_0x52fbf7,_0x426a02){_0x52fbf7=_0x52fbf7-0x0;var _0x160927=_0x6ee5[_0x52fbf7];return _0x160927;};'use strict';var Sequelize=require(_0x56ee('0x0'));module[_0x56ee('0x1')]={'type':{'type':Sequelize[_0x56ee('0x2')](_0x56ee('0x3'),_0x56ee('0x4'),'stun',_0x56ee('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x56ee('0x6')]}}; \ No newline at end of file +var _0x171b=['sequelize','exports','externip','turn','STRING'];(function(_0x7f133c,_0x283c22){var _0x4ee1a5=function(_0x1770f4){while(--_0x1770f4){_0x7f133c['push'](_0x7f133c['shift']());}};_0x4ee1a5(++_0x283c22);}(_0x171b,0xcd));var _0xb171=function(_0x339a61,_0x154b2c){_0x339a61=_0x339a61-0x0;var _0x23e543=_0x171b[_0x339a61];return _0x23e543;};'use strict';var Sequelize=require(_0xb171('0x0'));module[_0xb171('0x1')]={'type':{'type':Sequelize['ENUM']('localnet',_0xb171('0x2'),'stun',_0xb171('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb171('0x4')]},'password':{'type':Sequelize[_0xb171('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4548c9e..20327bc 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 _0x0fe8=['length','model','hasOwnProperty','sort','filter','where','merge','options','includeAll','include','create','findAll','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','find','params','root','body','toLowerCase','destroy','server/files/templates/network.ejs','util','path','ejs','lodash','../../components/parsers/qs','../../config/environment','jayson/promise','client','http','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Network,\x20%s,\x20%s','message','result','catch','status','limit','undefined','count','offset','set','Content-Range','json','update','end','sendStatus','name','send','map','Network','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields'];(function(_0x56a616,_0x5a3c7c){var _0xe94844=function(_0x1d3816){while(--_0x1d3816){_0x56a616['push'](_0x56a616['shift']());}};_0xe94844(++_0x5a3c7c);}(_0x0fe8,0xc4));var _0x80fe=function(_0x368e49,_0x35129c){_0x368e49=_0x368e49-0x0;var _0x35423e=_0x0fe8[_0x368e49];return _0x35423e;};'use strict';var util=require(_0x80fe('0x0'));var path=require(_0x80fe('0x1'));var ejs=require(_0x80fe('0x2'));var fs=require('fs');var _=require(_0x80fe('0x3'));var qs=require(_0x80fe('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x80fe('0x5'));var db=require('../../mysqldb')['db'];var jayson=require(_0x80fe('0x6'));var client=jayson[_0x80fe('0x7')][_0x80fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d4544,_0x56f33f,_0x14cfc2,_0x1869e8){return new Promise(function(_0x338c36,_0x4d5161){var _0x26891c=_0x1869e8||client;return _0x26891c['request'](_0x1d4544,_0x14cfc2)[_0x80fe('0x9')](function(_0x2d0163){logger[_0x80fe('0xa')]('Network,\x20%s,\x20%s',_0x56f33f,'request\x20sent');logger[_0x80fe('0xb')](_0x80fe('0xc'),_0x56f33f,_0x80fe('0xd'),JSON['stringify'](_0x2d0163));if(_0x2d0163[_0x80fe('0xe')]){if(_0x2d0163[_0x80fe('0xe')][_0x80fe('0xf')]===0x1f4){logger[_0x80fe('0xe')](_0x80fe('0x10'),_0x56f33f,_0x2d0163[_0x80fe('0xe')]['message']);return _0x4d5161(_0x2d0163[_0x80fe('0xe')][_0x80fe('0x11')]);}logger[_0x80fe('0xe')](_0x80fe('0x10'),_0x56f33f,_0x2d0163[_0x80fe('0xe')]['message']);return _0x338c36(_0x2d0163['error']['message']);}else{logger[_0x80fe('0xa')]('Network,\x20%s,\x20%s',_0x56f33f,_0x80fe('0xd'));_0x338c36(_0x2d0163[_0x80fe('0x12')][_0x80fe('0x11')]);}})[_0x80fe('0x13')](function(_0x5e1a5d){logger['error'](_0x80fe('0x10'),_0x56f33f,_0x5e1a5d);_0x4d5161(_0x5e1a5d);});});}function respondWithResult(_0x486fdb,_0x15359d){_0x15359d=_0x15359d||0xc8;return function(_0x1311f2){if(_0x1311f2){return _0x486fdb[_0x80fe('0x14')](_0x15359d)['json'](_0x1311f2);}};}function respondWithFilteredResult(_0x189248,_0x17a9a5){return function(_0x271b2a){if(_0x271b2a){var _0xbdb14=typeof _0x17a9a5['offset']==='undefined'&&typeof _0x17a9a5[_0x80fe('0x15')]===_0x80fe('0x16');var _0x5e7ca4=_0x271b2a[_0x80fe('0x17')];var _0x335bc4=_0xbdb14?0x0:_0x17a9a5[_0x80fe('0x18')];var _0x509a3d=_0xbdb14?_0x271b2a[_0x80fe('0x17')]:_0x17a9a5[_0x80fe('0x18')]+_0x17a9a5[_0x80fe('0x15')];var _0x511101;if(_0x509a3d>=_0x5e7ca4){_0x509a3d=_0x5e7ca4;_0x511101=0xc8;}else{_0x511101=0xce;}_0x189248[_0x80fe('0x14')](_0x511101);return _0x189248[_0x80fe('0x19')](_0x80fe('0x1a'),_0x335bc4+'-'+_0x509a3d+'/'+_0x5e7ca4)[_0x80fe('0x1b')](_0x271b2a);}return null;};}function saveUpdates(_0x40b220){return function(_0xc67e7d){if(_0xc67e7d){return _0xc67e7d[_0x80fe('0x1c')](_0x40b220)[_0x80fe('0x9')](function(_0x26fb74){return _0x26fb74;});}return null;};}function removeEntity(_0x5918a7){return function(_0x59f236){if(_0x59f236){return _0x59f236['destroy']()[_0x80fe('0x9')](function(){_0x5918a7['status'](0xcc)[_0x80fe('0x1d')]();});}};}function handleEntityNotFound(_0x4413d8){return function(_0x1ac0ec){if(!_0x1ac0ec){_0x4413d8[_0x80fe('0x1e')](0x194);}return _0x1ac0ec;};}function handleError(_0x4f21e9,_0x51020c){_0x51020c=_0x51020c||0x1f4;return function(_0x3dfdf1){logger[_0x80fe('0xe')](_0x3dfdf1['stack']);if(_0x3dfdf1['name']){delete _0x3dfdf1[_0x80fe('0x1f')];}_0x4f21e9[_0x80fe('0x14')](_0x51020c)[_0x80fe('0x20')](_0x3dfdf1);};}exports['index']=function(_0x5f2a26,_0x31c92d){var _0x437a85={},_0x3e8128={},_0x5269a4={'count':0x0,'rows':[]};var _0x805b39=_[_0x80fe('0x21')](db[_0x80fe('0x22')][_0x80fe('0x23')],function(_0x399d73){return{'name':_0x399d73[_0x80fe('0x24')],'type':_0x399d73[_0x80fe('0x25')][_0x80fe('0x26')]};});_0x3e8128['model']=_[_0x80fe('0x21')](_0x805b39,_0x80fe('0x1f'));_0x3e8128[_0x80fe('0x27')]=_[_0x80fe('0x28')](_0x5f2a26[_0x80fe('0x27')]);_0x3e8128['filters']=_[_0x80fe('0x29')](_0x3e8128['model'],_0x3e8128[_0x80fe('0x27')]);_0x437a85[_0x80fe('0x2a')]=_[_0x80fe('0x29')](_0x3e8128['model'],qs['fields'](_0x5f2a26[_0x80fe('0x27')][_0x80fe('0x2b')]));_0x437a85[_0x80fe('0x2a')]=_0x437a85['attributes'][_0x80fe('0x2c')]?_0x437a85['attributes']:_0x3e8128[_0x80fe('0x2d')];if(!_0x5f2a26[_0x80fe('0x27')][_0x80fe('0x2e')]('nolimit')){_0x437a85['limit']=qs[_0x80fe('0x15')](_0x5f2a26['query'][_0x80fe('0x15')]);_0x437a85[_0x80fe('0x18')]=qs['offset'](_0x5f2a26[_0x80fe('0x27')][_0x80fe('0x18')]);}_0x437a85['order']=qs[_0x80fe('0x2f')](_0x5f2a26[_0x80fe('0x27')]['sort']);_0x437a85['where']=qs['filters'](_['pick'](_0x5f2a26[_0x80fe('0x27')],_0x3e8128['filters']),_0x805b39);if(_0x5f2a26[_0x80fe('0x27')][_0x80fe('0x30')]){_0x437a85[_0x80fe('0x31')]=_[_0x80fe('0x32')](_0x437a85[_0x80fe('0x31')],{'$or':_[_0x80fe('0x21')](_0x805b39,function(_0x3f86ad){if(_0x3f86ad[_0x80fe('0x25')]!=='VIRTUAL'){var _0x1ee3d7={};_0x1ee3d7[_0x3f86ad[_0x80fe('0x1f')]]={'$like':'%'+_0x5f2a26[_0x80fe('0x27')][_0x80fe('0x30')]+'%'};return _0x1ee3d7;}})});}_0x437a85=_['merge']({},_0x437a85,_0x5f2a26[_0x80fe('0x33')]);var _0x36c3ad={'where':_0x437a85['where']};return db[_0x80fe('0x22')]['count'](_0x36c3ad)['then'](function(_0x4ff118){_0x5269a4[_0x80fe('0x17')]=_0x4ff118;if(_0x5f2a26[_0x80fe('0x27')][_0x80fe('0x34')]){_0x437a85[_0x80fe('0x35')]=[{'all':!![]}];}return db['Network']['findAll'](_0x437a85);})[_0x80fe('0x9')](function(_0x4b0a6c){_0x5269a4['rows']=_0x4b0a6c;return _0x5269a4;})[_0x80fe('0x9')](respondWithFilteredResult(_0x31c92d,_0x437a85))['catch'](handleError(_0x31c92d,null));};exports['show']=function(_0x47b4ff,_0x32c01f){var _0x19da4c={'raw':!![],'where':{'id':_0x47b4ff['params']['id']}},_0x274903={};_0x274903[_0x80fe('0x2d')]=_[_0x80fe('0x28')](db[_0x80fe('0x22')][_0x80fe('0x23')]);_0x274903[_0x80fe('0x27')]=_[_0x80fe('0x28')](_0x47b4ff['query']);_0x274903['filters']=_['intersection'](_0x274903[_0x80fe('0x2d')],_0x274903[_0x80fe('0x27')]);_0x19da4c[_0x80fe('0x2a')]=_['intersection'](_0x274903[_0x80fe('0x2d')],qs[_0x80fe('0x2b')](_0x47b4ff[_0x80fe('0x27')][_0x80fe('0x2b')]));_0x19da4c[_0x80fe('0x2a')]=_0x19da4c[_0x80fe('0x2a')]['length']?_0x19da4c[_0x80fe('0x2a')]:_0x274903[_0x80fe('0x2d')];if(_0x47b4ff[_0x80fe('0x27')][_0x80fe('0x34')]){_0x19da4c[_0x80fe('0x35')]=[{'all':!![]}];}_0x19da4c=_[_0x80fe('0x32')]({},_0x19da4c,_0x47b4ff['options']);return db['Network']['find'](_0x19da4c)[_0x80fe('0x9')](handleEntityNotFound(_0x32c01f,null))[_0x80fe('0x9')](respondWithResult(_0x32c01f,null))[_0x80fe('0x13')](handleError(_0x32c01f,null));};exports[_0x80fe('0x36')]=function(_0x3c88c7,_0x5f5df2){var _0x283c92;return db[_0x80fe('0x22')][_0x80fe('0x36')](_0x3c88c7['body'],{'raw':!![]})[_0x80fe('0x9')](function(_0x484699){_0x283c92=_0x484699;return db[_0x80fe('0x22')][_0x80fe('0x37')]({'where':{'type':_0x3c88c7['body'][_0x80fe('0x25')]},'raw':!![]});})[_0x80fe('0x9')](function(_0x4645f1){if(_0x283c92['type'][_0x80fe('0x38')]()==_0x80fe('0x39')){var _0x1a431c=fs[_0x80fe('0x3a')](path[_0x80fe('0x3b')](config['root'],_0x80fe('0x3c')),_0x80fe('0x3d'));var _0x13ab4c=ejs[_0x80fe('0x3e')](_0x1a431c,{'networks':_0x4645f1||[]});fs[_0x80fe('0x3f')](_0x80fe('0x40'),_0x13ab4c);return respondWithRpcPromise('Reload',_0x80fe('0x36'),{'module':_0x80fe('0x41')});}else if(_0x283c92[_0x80fe('0x25')][_0x80fe('0x38')]()==_0x80fe('0x42')){var _0x3c1847=fs[_0x80fe('0x3a')](path[_0x80fe('0x3b')](config['root'],_0x80fe('0x43')),_0x80fe('0x3d'));var _0x2f5f98=ejs[_0x80fe('0x3e')](_0x3c1847,{'networks':_0x4645f1||[]});fs[_0x80fe('0x3f')](_0x80fe('0x44'),_0x2f5f98);return respondWithRpcPromise(_0x80fe('0x45'),_0x80fe('0x36'),{'module':'res_stun_monitor.so'});}else{var _0x31f42c=fs[_0x80fe('0x3a')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x80fe('0x3d'));var _0x119837=ejs[_0x80fe('0x3e')](_0x31f42c,{'networks':_0x4645f1||[]});fs[_0x80fe('0x3f')](util[_0x80fe('0x46')](_0x80fe('0x47'),_0x3c88c7['body']['type']['toLowerCase']()),_0x119837);return respondWithRpcPromise(_0x80fe('0x45'),_0x80fe('0x36'),{'module':_0x80fe('0x48')});}})['then'](function(){return _0x283c92;})['then'](respondWithResult(_0x5f5df2,0xc9))[_0x80fe('0x13')](handleError(_0x5f5df2,null));};exports['update']=function(_0x33afd2,_0x279756){var _0x42df1f;return db['Network'][_0x80fe('0x49')]({'where':{'id':_0x33afd2[_0x80fe('0x4a')]['id']}})[_0x80fe('0x9')](handleEntityNotFound(_0x279756,null))['then'](saveUpdates(_0x33afd2['body'],null))[_0x80fe('0x9')](function(_0x378b6d){if(_0x378b6d){_0x42df1f=_0x378b6d;return db[_0x80fe('0x22')]['findAll']({'where':{'type':_0x42df1f[_0x80fe('0x25')]},'raw':!![]});}return null;})[_0x80fe('0x9')](function(_0x15c880){if(_0x42df1f[_0x80fe('0x25')][_0x80fe('0x38')]()=='STUN'){var _0x5bcd90=fs[_0x80fe('0x3a')](path[_0x80fe('0x3b')](config[_0x80fe('0x4b')],'server/files/templates/stun_multiple.ejs'),_0x80fe('0x3d'));var _0x44a394=ejs[_0x80fe('0x3e')](_0x5bcd90,{'networks':_0x15c880||[]});fs[_0x80fe('0x3f')](_0x80fe('0x40'),_0x44a394);return respondWithRpcPromise('Reload',_0x80fe('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x42df1f[_0x80fe('0x25')]['toUpperCase']()==_0x80fe('0x42')){var _0x41d8cc=fs['readFileSync'](path[_0x80fe('0x3b')](config['root'],_0x80fe('0x43')),'utf8');var _0x2b1bd8=ejs[_0x80fe('0x3e')](_0x41d8cc,{'networks':_0x15c880||[]});fs[_0x80fe('0x3f')]('/etc/asterisk/turn_xcally.conf',_0x2b1bd8);return respondWithRpcPromise(_0x80fe('0x45'),_0x80fe('0x1c'),{'module':_0x80fe('0x41')});}else{var _0x3b0d85=fs['readFileSync'](path['join'](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x5b26c8=ejs['render'](_0x3b0d85,{'networks':_0x15c880||[]});fs['writeFileSync'](util[_0x80fe('0x46')](_0x80fe('0x47'),_0x33afd2[_0x80fe('0x4c')][_0x80fe('0x25')][_0x80fe('0x4d')]()),_0x5b26c8);return respondWithRpcPromise(_0x80fe('0x45'),_0x80fe('0x1c'),{'module':_0x80fe('0x48')});}})[_0x80fe('0x9')](function(_0x5c0a9f){if(_0x5c0a9f){return _0x42df1f;}return null;})[_0x80fe('0x9')](respondWithResult(_0x279756,null))[_0x80fe('0x13')](handleError(_0x279756,null));};exports[_0x80fe('0x4e')]=function(_0x2cbd27,_0x45db0a){var _0x56798a;return db['Network'][_0x80fe('0x49')]({'where':{'id':_0x2cbd27['params']['id']}})[_0x80fe('0x9')](function(_0x2dcf9c){_0x56798a=_0x2dcf9c;return _0x2dcf9c;})[_0x80fe('0x9')](handleEntityNotFound(_0x45db0a,null))[_0x80fe('0x9')](removeEntity(_0x45db0a,null))[_0x80fe('0x9')](function(){if(_0x56798a){return db[_0x80fe('0x22')][_0x80fe('0x37')]({'where':{'type':_0x56798a['type']},'raw':!![]});}})[_0x80fe('0x9')](function(_0x2deed4){if(_0x56798a[_0x80fe('0x25')][_0x80fe('0x38')]()=='STUN'){var _0x1812b7=fs['readFileSync'](path['join'](config[_0x80fe('0x4b')],_0x80fe('0x3c')),_0x80fe('0x3d'));var _0x43be21=ejs['render'](_0x1812b7,{'networks':_0x2deed4||[]});fs[_0x80fe('0x3f')](_0x80fe('0x40'),_0x43be21);return respondWithRpcPromise(_0x80fe('0x45'),_0x80fe('0x4e'),{'module':_0x80fe('0x41')});}else if(_0x56798a[_0x80fe('0x25')][_0x80fe('0x38')]()==_0x80fe('0x42')){var _0x1fbf30=fs[_0x80fe('0x3a')](path['join'](config['root'],_0x80fe('0x43')),_0x80fe('0x3d'));var _0x1046bf=ejs[_0x80fe('0x3e')](_0x1fbf30,{'networks':_0x2deed4||[]});fs[_0x80fe('0x3f')](_0x80fe('0x44'),_0x1046bf);return respondWithRpcPromise(_0x80fe('0x45'),_0x80fe('0x4e'),{'module':_0x80fe('0x41')});}else{var _0x3395c1=fs[_0x80fe('0x3a')](path[_0x80fe('0x3b')](config['root'],_0x80fe('0x4f')),_0x80fe('0x3d'));var _0x3d8765=ejs['render'](_0x3395c1,{'networks':_0x2deed4||[]});fs[_0x80fe('0x3f')](util[_0x80fe('0x46')](_0x80fe('0x47'),_0x56798a[_0x80fe('0x25')][_0x80fe('0x4d')]()),_0x3d8765);return respondWithRpcPromise(_0x80fe('0x45'),_0x80fe('0x4e'),{'module':_0x80fe('0x48')});}})[_0x80fe('0x13')](handleError(_0x45db0a,null));}; \ No newline at end of file +var _0x481f=['ejs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','rows','show','params','include','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','server/files/templates/network.ejs','format'];(function(_0x40bbe4,_0x1ec429){var _0x3e4886=function(_0x33a67d){while(--_0x33a67d){_0x40bbe4['push'](_0x40bbe4['shift']());}};_0x3e4886(++_0x1ec429);}(_0x481f,0x158));var _0xf481=function(_0x322575,_0x3877f5){_0x322575=_0x322575-0x0;var _0x1b9b7c=_0x481f[_0x322575];return _0x1b9b7c;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0xf481('0x0'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xf481('0x1'))(_0xf481('0x2'));var config=require('../../config/environment');var db=require(_0xf481('0x3'))['db'];var jayson=require(_0xf481('0x4'));var client=jayson[_0xf481('0x5')][_0xf481('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xaef6b2,_0x4c05a0,_0x3237b4,_0x268b9e){return new Promise(function(_0x50ee47,_0x4753f8){var _0x5572ae=_0x268b9e||client;return _0x5572ae[_0xf481('0x7')](_0xaef6b2,_0x3237b4)[_0xf481('0x8')](function(_0x2e5a08){logger[_0xf481('0x9')]('Network,\x20%s,\x20%s',_0x4c05a0,_0xf481('0xa'));logger[_0xf481('0xb')](_0xf481('0xc'),_0x4c05a0,_0xf481('0xa'),JSON[_0xf481('0xd')](_0x2e5a08));if(_0x2e5a08[_0xf481('0xe')]){if(_0x2e5a08[_0xf481('0xe')][_0xf481('0xf')]===0x1f4){logger[_0xf481('0xe')](_0xf481('0x10'),_0x4c05a0,_0x2e5a08[_0xf481('0xe')][_0xf481('0x11')]);return _0x4753f8(_0x2e5a08[_0xf481('0xe')]['message']);}logger['error'](_0xf481('0x10'),_0x4c05a0,_0x2e5a08[_0xf481('0xe')][_0xf481('0x11')]);return _0x50ee47(_0x2e5a08[_0xf481('0xe')][_0xf481('0x11')]);}else{logger[_0xf481('0x9')](_0xf481('0x10'),_0x4c05a0,_0xf481('0xa'));_0x50ee47(_0x2e5a08[_0xf481('0x12')]['message']);}})[_0xf481('0x13')](function(_0x569ded){logger[_0xf481('0xe')](_0xf481('0x10'),_0x4c05a0,_0x569ded);_0x4753f8(_0x569ded);});});}function respondWithResult(_0x42bb07,_0x591c99){_0x591c99=_0x591c99||0xc8;return function(_0x4c890b){if(_0x4c890b){return _0x42bb07[_0xf481('0x14')](_0x591c99)[_0xf481('0x15')](_0x4c890b);}};}function respondWithFilteredResult(_0x121df0,_0x183a6e){return function(_0x5e57dc){if(_0x5e57dc){var _0x373678=typeof _0x183a6e['offset']===_0xf481('0x16')&&typeof _0x183a6e[_0xf481('0x17')]===_0xf481('0x16');var _0x4bb39f=_0x5e57dc[_0xf481('0x18')];var _0x58f6ad=_0x373678?0x0:_0x183a6e[_0xf481('0x19')];var _0x5da106=_0x373678?_0x5e57dc['count']:_0x183a6e[_0xf481('0x19')]+_0x183a6e['limit'];var _0x399145;if(_0x5da106>=_0x4bb39f){_0x5da106=_0x4bb39f;_0x399145=0xc8;}else{_0x399145=0xce;}_0x121df0['status'](_0x399145);return _0x121df0[_0xf481('0x1a')](_0xf481('0x1b'),_0x58f6ad+'-'+_0x5da106+'/'+_0x4bb39f)[_0xf481('0x15')](_0x5e57dc);}return null;};}function saveUpdates(_0x1f11a2){return function(_0x3073f8){if(_0x3073f8){return _0x3073f8[_0xf481('0x1c')](_0x1f11a2)[_0xf481('0x8')](function(_0x409296){return _0x409296;});}return null;};}function removeEntity(_0x2c4323){return function(_0xb1c4ae){if(_0xb1c4ae){return _0xb1c4ae[_0xf481('0x1d')]()[_0xf481('0x8')](function(){_0x2c4323['status'](0xcc)[_0xf481('0x1e')]();});}};}function handleEntityNotFound(_0x5cfa79){return function(_0x4920ff){if(!_0x4920ff){_0x5cfa79[_0xf481('0x1f')](0x194);}return _0x4920ff;};}function handleError(_0x3041ae,_0x3ddcb6){_0x3ddcb6=_0x3ddcb6||0x1f4;return function(_0x14a9cd){logger[_0xf481('0xe')](_0x14a9cd[_0xf481('0x20')]);if(_0x14a9cd[_0xf481('0x21')]){delete _0x14a9cd['name'];}_0x3041ae[_0xf481('0x14')](_0x3ddcb6)['send'](_0x14a9cd);};}exports[_0xf481('0x22')]=function(_0x55c47e,_0x53fb20){var _0x40ccfa={},_0x5e6949={},_0x1bb499={'count':0x0,'rows':[]};var _0x13dccf=_[_0xf481('0x23')](db[_0xf481('0x24')][_0xf481('0x25')],function(_0x4bec8c){return{'name':_0x4bec8c['fieldName'],'type':_0x4bec8c[_0xf481('0x26')][_0xf481('0x27')]};});_0x5e6949[_0xf481('0x28')]=_[_0xf481('0x23')](_0x13dccf,'name');_0x5e6949[_0xf481('0x29')]=_[_0xf481('0x2a')](_0x55c47e[_0xf481('0x29')]);_0x5e6949[_0xf481('0x2b')]=_[_0xf481('0x2c')](_0x5e6949[_0xf481('0x28')],_0x5e6949[_0xf481('0x29')]);_0x40ccfa[_0xf481('0x2d')]=_['intersection'](_0x5e6949[_0xf481('0x28')],qs[_0xf481('0x2e')](_0x55c47e[_0xf481('0x29')]['fields']));_0x40ccfa[_0xf481('0x2d')]=_0x40ccfa[_0xf481('0x2d')][_0xf481('0x2f')]?_0x40ccfa[_0xf481('0x2d')]:_0x5e6949[_0xf481('0x28')];if(!_0x55c47e[_0xf481('0x29')][_0xf481('0x30')]('nolimit')){_0x40ccfa[_0xf481('0x17')]=qs[_0xf481('0x17')](_0x55c47e[_0xf481('0x29')][_0xf481('0x17')]);_0x40ccfa[_0xf481('0x19')]=qs[_0xf481('0x19')](_0x55c47e[_0xf481('0x29')]['offset']);}_0x40ccfa[_0xf481('0x31')]=qs['sort'](_0x55c47e[_0xf481('0x29')][_0xf481('0x32')]);_0x40ccfa[_0xf481('0x33')]=qs[_0xf481('0x2b')](_[_0xf481('0x34')](_0x55c47e[_0xf481('0x29')],_0x5e6949['filters']),_0x13dccf);if(_0x55c47e[_0xf481('0x29')]['filter']){_0x40ccfa[_0xf481('0x33')]=_['merge'](_0x40ccfa['where'],{'$or':_[_0xf481('0x23')](_0x13dccf,function(_0x4c45ac){if(_0x4c45ac[_0xf481('0x26')]!==_0xf481('0x35')){var _0x1c9d62={};_0x1c9d62[_0x4c45ac[_0xf481('0x21')]]={'$like':'%'+_0x55c47e[_0xf481('0x29')][_0xf481('0x36')]+'%'};return _0x1c9d62;}})});}_0x40ccfa=_[_0xf481('0x37')]({},_0x40ccfa,_0x55c47e[_0xf481('0x38')]);var _0xdcc434={'where':_0x40ccfa[_0xf481('0x33')]};return db[_0xf481('0x24')][_0xf481('0x18')](_0xdcc434)[_0xf481('0x8')](function(_0x2620fc){_0x1bb499['count']=_0x2620fc;if(_0x55c47e[_0xf481('0x29')][_0xf481('0x39')]){_0x40ccfa['include']=[{'all':!![]}];}return db[_0xf481('0x24')]['findAll'](_0x40ccfa);})['then'](function(_0x1fe536){_0x1bb499[_0xf481('0x3a')]=_0x1fe536;return _0x1bb499;})[_0xf481('0x8')](respondWithFilteredResult(_0x53fb20,_0x40ccfa))[_0xf481('0x13')](handleError(_0x53fb20,null));};exports[_0xf481('0x3b')]=function(_0x4f23e2,_0x38b808){var _0x22701f={'raw':!![],'where':{'id':_0x4f23e2[_0xf481('0x3c')]['id']}},_0x8cfb88={};_0x8cfb88[_0xf481('0x28')]=_['keys'](db[_0xf481('0x24')][_0xf481('0x25')]);_0x8cfb88['query']=_[_0xf481('0x2a')](_0x4f23e2[_0xf481('0x29')]);_0x8cfb88[_0xf481('0x2b')]=_[_0xf481('0x2c')](_0x8cfb88[_0xf481('0x28')],_0x8cfb88[_0xf481('0x29')]);_0x22701f['attributes']=_[_0xf481('0x2c')](_0x8cfb88[_0xf481('0x28')],qs[_0xf481('0x2e')](_0x4f23e2[_0xf481('0x29')][_0xf481('0x2e')]));_0x22701f[_0xf481('0x2d')]=_0x22701f[_0xf481('0x2d')][_0xf481('0x2f')]?_0x22701f['attributes']:_0x8cfb88[_0xf481('0x28')];if(_0x4f23e2[_0xf481('0x29')][_0xf481('0x39')]){_0x22701f[_0xf481('0x3d')]=[{'all':!![]}];}_0x22701f=_[_0xf481('0x37')]({},_0x22701f,_0x4f23e2[_0xf481('0x38')]);return db['Network'][_0xf481('0x3e')](_0x22701f)['then'](handleEntityNotFound(_0x38b808,null))[_0xf481('0x8')](respondWithResult(_0x38b808,null))[_0xf481('0x13')](handleError(_0x38b808,null));};exports['create']=function(_0x4f5ba3,_0x46d02f){var _0x1e2a01;return db[_0xf481('0x24')][_0xf481('0x3f')](_0x4f5ba3[_0xf481('0x40')],{'raw':!![]})[_0xf481('0x8')](function(_0x50bdc8){_0x1e2a01=_0x50bdc8;return db[_0xf481('0x24')][_0xf481('0x41')]({'where':{'type':_0x4f5ba3[_0xf481('0x40')][_0xf481('0x26')]},'raw':!![]});})[_0xf481('0x8')](function(_0x58aa0f){if(_0x1e2a01[_0xf481('0x26')][_0xf481('0x42')]()==_0xf481('0x43')){var _0x332b27=fs[_0xf481('0x44')](path[_0xf481('0x45')](config[_0xf481('0x46')],_0xf481('0x47')),_0xf481('0x48'));var _0xc865ef=ejs['render'](_0x332b27,{'networks':_0x58aa0f||[]});fs[_0xf481('0x49')]('/etc/asterisk/stun_xcally.conf',_0xc865ef);return respondWithRpcPromise(_0xf481('0x4a'),_0xf481('0x3f'),{'module':_0xf481('0x4b')});}else if(_0x1e2a01[_0xf481('0x26')][_0xf481('0x42')]()==_0xf481('0x4c')){var _0x35a77a=fs[_0xf481('0x44')](path[_0xf481('0x45')](config[_0xf481('0x46')],_0xf481('0x4d')),_0xf481('0x48'));var _0x479b7c=ejs[_0xf481('0x4e')](_0x35a77a,{'networks':_0x58aa0f||[]});fs[_0xf481('0x49')](_0xf481('0x4f'),_0x479b7c);return respondWithRpcPromise(_0xf481('0x4a'),_0xf481('0x3f'),{'module':_0xf481('0x4b')});}else{var _0x4b5d3d=fs['readFileSync'](path[_0xf481('0x45')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x164695=ejs['render'](_0x4b5d3d,{'networks':_0x58aa0f||[]});fs['writeFileSync'](util['format'](_0xf481('0x50'),_0x4f5ba3['body'][_0xf481('0x26')][_0xf481('0x51')]()),_0x164695);return respondWithRpcPromise(_0xf481('0x4a'),'create',{'module':_0xf481('0x52')});}})[_0xf481('0x8')](function(){return _0x1e2a01;})[_0xf481('0x8')](respondWithResult(_0x46d02f,0xc9))[_0xf481('0x13')](handleError(_0x46d02f,null));};exports[_0xf481('0x1c')]=function(_0x3e3e6c,_0x2d84e0){var _0x573d8c;return db['Network'][_0xf481('0x3e')]({'where':{'id':_0x3e3e6c[_0xf481('0x3c')]['id']}})[_0xf481('0x8')](handleEntityNotFound(_0x2d84e0,null))['then'](saveUpdates(_0x3e3e6c[_0xf481('0x40')],null))['then'](function(_0x1f7619){if(_0x1f7619){_0x573d8c=_0x1f7619;return db[_0xf481('0x24')][_0xf481('0x41')]({'where':{'type':_0x573d8c[_0xf481('0x26')]},'raw':!![]});}return null;})[_0xf481('0x8')](function(_0x93e872){if(_0x573d8c[_0xf481('0x26')][_0xf481('0x42')]()==_0xf481('0x43')){var _0x27d378=fs['readFileSync'](path[_0xf481('0x45')](config[_0xf481('0x46')],'server/files/templates/stun_multiple.ejs'),_0xf481('0x48'));var _0x27c1fc=ejs[_0xf481('0x4e')](_0x27d378,{'networks':_0x93e872||[]});fs[_0xf481('0x49')](_0xf481('0x53'),_0x27c1fc);return respondWithRpcPromise(_0xf481('0x4a'),'update',{'module':_0xf481('0x4b')});}else if(_0x573d8c[_0xf481('0x26')]['toUpperCase']()==_0xf481('0x4c')){var _0x492f31=fs[_0xf481('0x44')](path['join'](config[_0xf481('0x46')],_0xf481('0x4d')),_0xf481('0x48'));var _0x399183=ejs[_0xf481('0x4e')](_0x492f31,{'networks':_0x93e872||[]});fs[_0xf481('0x49')](_0xf481('0x4f'),_0x399183);return respondWithRpcPromise('Reload','update',{'module':_0xf481('0x4b')});}else{var _0x18908b=fs['readFileSync'](path[_0xf481('0x45')](config[_0xf481('0x46')],_0xf481('0x54')),_0xf481('0x48'));var _0x49c01f=ejs[_0xf481('0x4e')](_0x18908b,{'networks':_0x93e872||[]});fs[_0xf481('0x49')](util[_0xf481('0x55')](_0xf481('0x50'),_0x3e3e6c[_0xf481('0x40')]['type'][_0xf481('0x51')]()),_0x49c01f);return respondWithRpcPromise(_0xf481('0x4a'),_0xf481('0x1c'),{'module':_0xf481('0x52')});}})[_0xf481('0x8')](function(_0x5c0001){if(_0x5c0001){return _0x573d8c;}return null;})[_0xf481('0x8')](respondWithResult(_0x2d84e0,null))[_0xf481('0x13')](handleError(_0x2d84e0,null));};exports['destroy']=function(_0xadf7a1,_0x598857){var _0x67eb2c;return db[_0xf481('0x24')][_0xf481('0x3e')]({'where':{'id':_0xadf7a1[_0xf481('0x3c')]['id']}})[_0xf481('0x8')](function(_0x3b0c30){_0x67eb2c=_0x3b0c30;return _0x3b0c30;})['then'](handleEntityNotFound(_0x598857,null))[_0xf481('0x8')](removeEntity(_0x598857,null))[_0xf481('0x8')](function(){if(_0x67eb2c){return db[_0xf481('0x24')][_0xf481('0x41')]({'where':{'type':_0x67eb2c['type']},'raw':!![]});}})['then'](function(_0x22eb48){if(_0x67eb2c[_0xf481('0x26')][_0xf481('0x42')]()=='STUN'){var _0x43c456=fs[_0xf481('0x44')](path[_0xf481('0x45')](config['root'],_0xf481('0x47')),_0xf481('0x48'));var _0x192f98=ejs[_0xf481('0x4e')](_0x43c456,{'networks':_0x22eb48||[]});fs[_0xf481('0x49')](_0xf481('0x53'),_0x192f98);return respondWithRpcPromise(_0xf481('0x4a'),'destroy',{'module':_0xf481('0x4b')});}else if(_0x67eb2c[_0xf481('0x26')][_0xf481('0x42')]()=='TURN'){var _0x4dd26c=fs[_0xf481('0x44')](path[_0xf481('0x45')](config[_0xf481('0x46')],_0xf481('0x4d')),_0xf481('0x48'));var _0x32d9d6=ejs['render'](_0x4dd26c,{'networks':_0x22eb48||[]});fs[_0xf481('0x49')](_0xf481('0x4f'),_0x32d9d6);return respondWithRpcPromise(_0xf481('0x4a'),_0xf481('0x1d'),{'module':_0xf481('0x4b')});}else{var _0xfca723=fs['readFileSync'](path[_0xf481('0x45')](config[_0xf481('0x46')],'server/files/templates/network.ejs'),_0xf481('0x48'));var _0x52d68a=ejs[_0xf481('0x4e')](_0xfca723,{'networks':_0x22eb48||[]});fs['writeFileSync'](util[_0xf481('0x55')](_0xf481('0x50'),_0x67eb2c[_0xf481('0x26')][_0xf481('0x51')]()),_0x52d68a);return respondWithRpcPromise(_0xf481('0x4a'),_0xf481('0x1d'),{'module':_0xf481('0x52')});}})[_0xf481('0x13')](handleError(_0x598857,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a777452..1ecce08 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 _0x4746=['rimraf','../../config/environment','exports','define','Network','network','lodash','util','api','bluebird','request-promise','path'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x4746,0xc6));var _0x6474=function(_0x47ccfc,_0x174e80){_0x47ccfc=_0x47ccfc-0x0;var _0x118cb0=_0x4746[_0x47ccfc];return _0x118cb0;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require('../../config/logger')(_0x6474('0x2'));var moment=require('moment');var BPromise=require(_0x6474('0x3'));var rp=require(_0x6474('0x4'));var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./network.attributes');module[_0x6474('0x8')]=function(_0x2bcf7c,_0x4cadd7){return _0x2bcf7c[_0x6474('0x9')](_0x6474('0xa'),attributes,{'tableName':_0x6474('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x878f=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x878f,0x173));var _0xf878=function(_0x4b2735,_0x3632ff){_0x4b2735=_0x4b2735-0x0;var _0xc21e02=_0x878f[_0x4b2735];return _0xc21e02;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'network','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 c9b7d1b..0daa4b1 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(_0x421580,_0xcaa76c){var _0x3adf8c=function(_0x58ce53){while(--_0x58ce53){_0x421580['push'](_0x421580['shift']());}};_0x3adf8c(++_0xcaa76c);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x354220,_0x1069e2){_0x354220=_0x354220-0x0;var _0x4b515d=_0x7a54[_0x354220];return _0x4b515d;};'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 6ed2a02..03e10b1 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 _0xe76d=['removeAnswers','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/applications','/:id/send','put','/:id','delete','destroy','removeDispositions'];(function(_0xa013a4,_0x2ff249){var _0x27f4a2=function(_0x1a5a6f){while(--_0x1a5a6f){_0xa013a4['push'](_0xa013a4['shift']());}};_0x27f4a2(++_0x2ff249);}(_0xe76d,0x1f0));var _0xde76=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xe76d[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0xde76('0x0'));var util=require('util');var path=require(_0xde76('0x1'));var timeout=require(_0xde76('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde76('0x3'));var auth=require(_0xde76('0x4'));var interaction=require(_0xde76('0x5'));var config=require(_0xde76('0x6'));var controller=require(_0xde76('0x7'));router['get']('/',auth[_0xde76('0x8')](),controller[_0xde76('0x9')]);router[_0xde76('0xa')](_0xde76('0xb'),auth['isAuthenticated'](),controller[_0xde76('0xc')]);router[_0xde76('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xde76('0xd')]);router[_0xde76('0xa')](_0xde76('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xde76('0xa')](_0xde76('0xf'),auth[_0xde76('0x8')](),controller[_0xde76('0x10')]);router[_0xde76('0xa')]('/:id/applications',auth[_0xde76('0x8')](),controller[_0xde76('0x11')]);router[_0xde76('0xa')](_0xde76('0x12'),auth['isAuthenticated'](),controller[_0xde76('0x13')]);router[_0xde76('0xa')](_0xde76('0x14'),auth[_0xde76('0x8')](),controller[_0xde76('0x15')]);router[_0xde76('0x16')]('/',auth['isAuthenticated'](),controller[_0xde76('0x17')]);router[_0xde76('0x16')](_0xde76('0xe'),auth[_0xde76('0x8')](),controller['addDisposition']);router['post'](_0xde76('0xf'),auth[_0xde76('0x8')](),controller[_0xde76('0x18')]);router[_0xde76('0x16')]('/:id/notify',controller['notify']);router[_0xde76('0x16')](_0xde76('0x19'),auth[_0xde76('0x8')](),controller['addApplications']);router[_0xde76('0x16')](_0xde76('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0xde76('0x16')](_0xde76('0x1a'),auth[_0xde76('0x8')](),controller['send']);router[_0xde76('0x1b')](_0xde76('0x1c'),auth['isAuthenticated'](),controller['update']);router[_0xde76('0x1d')](_0xde76('0x1c'),auth['isAuthenticated'](),controller[_0xde76('0x1e')]);router['delete'](_0xde76('0xe'),auth[_0xde76('0x8')](),controller[_0xde76('0x1f')]);router[_0xde76('0x1d')](_0xde76('0xf'),auth[_0xde76('0x8')](),controller[_0xde76('0x20')]);router[_0xde76('0x1d')](_0xde76('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x198e=['describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','post','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','express','fs-extra','./openchannelAccount.controller','get','isAuthenticated','/describe'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x198e,0x7f));var _0xe198=function(_0x459879,_0x16b25d){_0x459879=_0x459879-0x0;var _0xa84228=_0x198e[_0x459879];return _0xa84228;};'use strict';var multer=require(_0xe198('0x0'));var util=require(_0xe198('0x1'));var path=require(_0xe198('0x2'));var timeout=require('connect-timeout');var express=require(_0xe198('0x3'));var router=express['Router']();var fs_extra=require(_0xe198('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe198('0x5'));router[_0xe198('0x6')]('/',auth[_0xe198('0x7')](),controller['index']);router[_0xe198('0x6')](_0xe198('0x8'),auth[_0xe198('0x7')](),controller[_0xe198('0x9')]);router[_0xe198('0x6')](_0xe198('0xa'),auth['isAuthenticated'](),controller[_0xe198('0xb')]);router['get']('/:id/dispositions',auth[_0xe198('0x7')](),controller[_0xe198('0xc')]);router[_0xe198('0x6')](_0xe198('0xd'),auth[_0xe198('0x7')](),controller[_0xe198('0xe')]);router[_0xe198('0x6')](_0xe198('0xf'),auth[_0xe198('0x7')](),controller[_0xe198('0x10')]);router[_0xe198('0x6')]('/:id/interactions',auth[_0xe198('0x7')](),controller[_0xe198('0x11')]);router[_0xe198('0x6')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xe198('0x7')](),controller['create']);router[_0xe198('0x12')](_0xe198('0x13'),auth[_0xe198('0x7')](),controller[_0xe198('0x14')]);router[_0xe198('0x12')](_0xe198('0xd'),auth[_0xe198('0x7')](),controller['addAnswer']);router['post'](_0xe198('0x15'),controller[_0xe198('0x16')]);router[_0xe198('0x12')](_0xe198('0xf'),auth['isAuthenticated'](),controller[_0xe198('0x17')]);router[_0xe198('0x12')](_0xe198('0x18'),auth['isAuthenticated'](),controller[_0xe198('0x19')]);router[_0xe198('0x12')](_0xe198('0x1a'),auth[_0xe198('0x7')](),controller[_0xe198('0x1b')]);router[_0xe198('0x1c')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xe198('0xa'),auth[_0xe198('0x7')](),controller[_0xe198('0x1d')]);router[_0xe198('0x1e')](_0xe198('0x13'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xe198('0x1e')](_0xe198('0xd'),auth[_0xe198('0x7')](),controller[_0xe198('0x1f')]);router[_0xe198('0x1e')](_0xe198('0x18'),auth['isAuthenticated'](),controller[_0xe198('0x20')]);module[_0xe198('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9e95657..067ca00 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 _0xa0c9=['exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x52ece1,_0x425dc5){var _0x329205=function(_0xf76c47){while(--_0xf76c47){_0x52ece1['push'](_0x52ece1['shift']());}};_0x329205(++_0x425dc5);}(_0xa0c9,0xec));var _0x9a0c=function(_0x72f47d,_0x573fca){_0x72f47d=_0x72f47d-0x0;var _0x4cfc6a=_0xa0c9[_0x72f47d];return _0x4cfc6a;};'use strict';var Sequelize=require(_0x9a0c('0x0'));var rs=require(_0x9a0c('0x1'));module[_0x9a0c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x9a0c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9a0c('0x4')]},'token':{'type':Sequelize[_0x9a0c('0x4')],'defaultValue':function(){return rs[_0x9a0c('0x5')]();}},'replyUri':{'type':Sequelize[_0x9a0c('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9a0c('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9a0c('0x6')],'defaultValue':function(){return _0x9a0c('0x7');}},'notificationSound':{'type':Sequelize[_0x9a0c('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9a0c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9a0c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9a0c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9a0c('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x9a0c('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x9a0c('0x8')],'defaultValue':![],'comment':_0x9a0c('0xb'),'set':function(_0x2c7140){if(!_0x2c7140)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9a0c('0xc')](_0x9a0c('0xd'),_0x2c7140);}}}; \ No newline at end of file +var _0xa31a=['STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports'];(function(_0x14599a,_0x3d88ba){var _0x4f6c14=function(_0x42f907){while(--_0x42f907){_0x14599a['push'](_0x14599a['shift']());}};_0x4f6c14(++_0x3d88ba);}(_0xa31a,0x165));var _0xaa31=function(_0x11df60,_0x13b69c){_0x11df60=_0x11df60-0x0;var _0x5bfd2b=_0xa31a[_0x11df60];return _0x5bfd2b;};'use strict';var Sequelize=require(_0xaa31('0x0'));var rs=require(_0xaa31('0x1'));module[_0xaa31('0x2')]={'name':{'type':Sequelize[_0xaa31('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaa31('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xaa31('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaa31('0x5')],'defaultValue':function(){return _0xaa31('0x6');}},'notificationSound':{'type':Sequelize[_0xaa31('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaa31('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaa31('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaa31('0x3')]},'queueTransfer':{'type':Sequelize[_0xaa31('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaa31('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa31('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xaa31('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xaa31('0x7')],'defaultValue':![],'comment':_0xaa31('0xa'),'set':function(_0x2f2070){if(!_0x2f2070)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xaa31('0xb')]('mandatoryDisposition',_0x2f2070);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3a8e3dd..a215150 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 _0xb43b=['Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','request','then','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','Disposition','getDispositions','findOne','order','includeAll','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','Applications','account','applications','list','orderBy','priority','List','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out'];(function(_0x41e723,_0x5e6494){var _0x5cf973=function(_0x4ce435){while(--_0x4ce435){_0x41e723['push'](_0x41e723['shift']());}};_0x5cf973(++_0x5e6494);}(_0xb43b,0xbf));var _0xbb43=function(_0x3e532f,_0x12e9d1){_0x3e532f=_0x3e532f-0x0;var _0x26a1ab=_0xb43b[_0x3e532f];return _0x26a1ab;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x1'));var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require(_0xbb43('0x9'));var csv=require(_0xbb43('0xa'));var ejs=require(_0xbb43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xa'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbb43('0x17')]=_['defaults'](config[_0xbb43('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb43('0x18'))(new Redis(config[_0xbb43('0x17')]));require(_0xbb43('0x19'))[_0xbb43('0x1a')](socket);var jayson=require(_0xbb43('0x1b'));var client=jayson['client'][_0xbb43('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xbb43('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x32425c,_0x15182b,_0x10c91b,_0x3be44b){return new BPromise(function(_0x126f61,_0x3c4a5a){var _0x209c9c=_0x3be44b||client;return _0x209c9c[_0xbb43('0x1d')](_0x32425c,_0x10c91b)[_0xbb43('0x1e')](function(_0xe15a1b){logger['info'](_0xbb43('0x1f'),_0x15182b,'request\x20sent');logger[_0xbb43('0x20')](_0xbb43('0x21'),_0x15182b,_0xbb43('0x22'),JSON[_0xbb43('0x23')](_0xe15a1b));if(_0xe15a1b['error']){if(_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x25')]===0x1f4){logger[_0xbb43('0x24')](_0xbb43('0x1f'),_0x15182b,_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);return _0x3c4a5a(_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);}logger[_0xbb43('0x24')](_0xbb43('0x1f'),_0x15182b,_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);return _0x126f61(_0xe15a1b[_0xbb43('0x24')][_0xbb43('0x26')]);}else{logger['info'](_0xbb43('0x1f'),_0x15182b,_0xbb43('0x22'));_0x126f61(_0xe15a1b['result'][_0xbb43('0x26')]);}})[_0xbb43('0x27')](function(_0x25279b){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x15182b,_0x25279b);_0x3c4a5a(_0x25279b);});});}function respondWithStatusCode(_0x20f223,_0x16da8a){_0x16da8a=_0x16da8a||0xcc;return function(_0x5b21b6){if(_0x5b21b6){return _0x20f223['sendStatus'](_0x16da8a);}return _0x20f223[_0xbb43('0x28')](_0x16da8a)[_0xbb43('0x29')]();};}function respondWithResult(_0x268fb5,_0x4bb859){_0x4bb859=_0x4bb859||0xc8;return function(_0x27bb65){if(_0x27bb65){return _0x268fb5[_0xbb43('0x28')](_0x4bb859)[_0xbb43('0x2a')](_0x27bb65);}};}function respondWithFilteredResult(_0x1a6e2b,_0x5d613c){return function(_0x2a4766){if(_0x2a4766){var _0x170e7a=typeof _0x5d613c[_0xbb43('0x2b')]===_0xbb43('0x2c')&&typeof _0x5d613c[_0xbb43('0x2d')]===_0xbb43('0x2c');var _0x2860d8=_0x2a4766['count'];var _0x3b2290=_0x170e7a?0x0:_0x5d613c[_0xbb43('0x2b')];var _0x3c46c6=_0x170e7a?_0x2a4766['count']:_0x5d613c[_0xbb43('0x2b')]+_0x5d613c[_0xbb43('0x2d')];var _0x9384d8;if(_0x3c46c6>=_0x2860d8){_0x3c46c6=_0x2860d8;_0x9384d8=0xc8;}else{_0x9384d8=0xce;}_0x1a6e2b[_0xbb43('0x28')](_0x9384d8);return _0x1a6e2b[_0xbb43('0x2e')](_0xbb43('0x2f'),_0x3b2290+'-'+_0x3c46c6+'/'+_0x2860d8)[_0xbb43('0x2a')](_0x2a4766);}return null;};}function patchUpdates(_0xa86300){return function(_0xd579d8){try{jsonpatch['apply'](_0xd579d8,_0xa86300,!![]);}catch(_0x5253a4){return BPromise['reject'](_0x5253a4);}return _0xd579d8['save']();};}function saveUpdates(_0x352249,_0x1186fd){return function(_0x15c3e5){if(_0x15c3e5){return _0x15c3e5[_0xbb43('0x30')](_0x352249)[_0xbb43('0x1e')](function(_0xa153c9){return _0xa153c9;});}return null;};}function removeEntity(_0x3c8758,_0x3082b3){return function(_0x5c1270){if(_0x5c1270){return _0x5c1270[_0xbb43('0x31')]()[_0xbb43('0x1e')](function(){var _0x418b2a=_0x5c1270[_0xbb43('0x32')]({'plain':!![]});var _0x4c65d0=_0xbb43('0x33');return db[_0xbb43('0x34')][_0xbb43('0x31')]({'where':{'type':_0x4c65d0,'resourceId':_0x418b2a['id']}})[_0xbb43('0x1e')](function(){return _0x5c1270;});})['then'](function(){_0x3c8758[_0xbb43('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba581,_0x10014c){return function(_0x2b6efc){if(!_0x2b6efc){_0x3ba581[_0xbb43('0x35')](0x194);}return _0x2b6efc;};}function handleError(_0x1da15a,_0x1c1f8b){_0x1c1f8b=_0x1c1f8b||0x1f4;return function(_0x316ab1){logger[_0xbb43('0x24')](_0x316ab1[_0xbb43('0x36')]);if(_0x316ab1[_0xbb43('0x37')]){delete _0x316ab1[_0xbb43('0x37')];}_0x1da15a[_0xbb43('0x28')](_0x1c1f8b)['send'](_0x316ab1);};}exports[_0xbb43('0x38')]=function(_0x467009,_0x363e1a){var _0x2db230={'include':[{'model':db[_0xbb43('0x39')],'as':_0xbb43('0x3a')}]},_0x2a4b21={},_0x2a854d={'count':0x0,'rows':[]};var _0x92d7cf=_[_0xbb43('0x3b')](db[_0xbb43('0x3c')][_0xbb43('0x3d')],function(_0x202291){return{'name':_0x202291[_0xbb43('0x3e')],'type':_0x202291[_0xbb43('0x3f')]['key']};});_0x2a4b21[_0xbb43('0x40')]=_[_0xbb43('0x3b')](_0x92d7cf,_0xbb43('0x37'));_0x2a4b21[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x467009[_0xbb43('0x41')]);_0x2a4b21['filters']=_[_0xbb43('0x43')](_0x2a4b21[_0xbb43('0x40')],_0x2a4b21['query']);_0x2db230['attributes']=_[_0xbb43('0x43')](_0x2a4b21[_0xbb43('0x40')],qs[_0xbb43('0x44')](_0x467009[_0xbb43('0x41')][_0xbb43('0x44')]));_0x2db230['attributes']=_0x2db230['attributes'][_0xbb43('0x45')]?_0x2db230[_0xbb43('0x46')]:_0x2a4b21[_0xbb43('0x40')];if(!_0x467009[_0xbb43('0x41')][_0xbb43('0x47')](_0xbb43('0x48'))){_0x2db230[_0xbb43('0x2d')]=qs[_0xbb43('0x2d')](_0x467009[_0xbb43('0x41')][_0xbb43('0x2d')]);_0x2db230['offset']=qs['offset'](_0x467009[_0xbb43('0x41')][_0xbb43('0x2b')]);}_0x2db230['order']=qs[_0xbb43('0x49')](_0x467009[_0xbb43('0x41')][_0xbb43('0x49')]);_0x2db230[_0xbb43('0x4a')]=qs[_0xbb43('0x4b')](_[_0xbb43('0x4c')](_0x467009[_0xbb43('0x41')],_0x2a4b21['filters']),_0x92d7cf);if(_0x467009[_0xbb43('0x41')][_0xbb43('0x4d')]){_0x2db230['where']=_[_0xbb43('0x4e')](_0x2db230[_0xbb43('0x4a')],{'$or':_['map'](_0x92d7cf,function(_0x3ab5fb){if(_0x3ab5fb[_0xbb43('0x3f')]!==_0xbb43('0x4f')){var _0x15fab6={};_0x15fab6[_0x3ab5fb[_0xbb43('0x37')]]={'$like':'%'+_0x467009[_0xbb43('0x41')][_0xbb43('0x4d')]+'%'};return _0x15fab6;}})});}_0x2db230=_[_0xbb43('0x4e')]({},_0x2db230,_0x467009[_0xbb43('0x50')]);var _0x2f044f={'where':_0x2db230[_0xbb43('0x4a')]};return db[_0xbb43('0x3c')]['count'](_0x2f044f)[_0xbb43('0x1e')](function(_0x10c8d7){_0x2a854d[_0xbb43('0x51')]=_0x10c8d7;if(_0x467009[_0xbb43('0x41')]['includeAll']){_0x2db230[_0xbb43('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xbb43('0x53')](_0x2db230);})['then'](function(_0x21f78b){_0x2a854d[_0xbb43('0x54')]=_0x21f78b;return _0x2a854d;})[_0xbb43('0x1e')](respondWithFilteredResult(_0x363e1a,_0x2db230))['catch'](handleError(_0x363e1a,null));};exports[_0xbb43('0x55')]=function(_0x218da6,_0x3581c6){var _0x4dc5d4={'raw':![],'where':{'id':_0x218da6[_0xbb43('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xbb43('0x3a')}]},_0xd485c7={};_0xd485c7['model']=_[_0xbb43('0x42')](db[_0xbb43('0x3c')]['rawAttributes']);_0xd485c7[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x218da6[_0xbb43('0x41')]);_0xd485c7['filters']=_[_0xbb43('0x43')](_0xd485c7['model'],_0xd485c7[_0xbb43('0x41')]);_0x4dc5d4[_0xbb43('0x46')]=_[_0xbb43('0x43')](_0xd485c7['model'],qs[_0xbb43('0x44')](_0x218da6[_0xbb43('0x41')]['fields']));_0x4dc5d4['attributes']=_0x4dc5d4[_0xbb43('0x46')][_0xbb43('0x45')]?_0x4dc5d4['attributes']:_0xd485c7['model'];if(_0x218da6[_0xbb43('0x41')]['includeAll']){_0x4dc5d4[_0xbb43('0x52')]=[{'all':!![]}];}_0x4dc5d4=_[_0xbb43('0x4e')]({},_0x4dc5d4,_0x218da6[_0xbb43('0x50')]);return db['OpenchannelAccount']['find'](_0x4dc5d4)['then'](handleEntityNotFound(_0x3581c6,null))['then'](respondWithResult(_0x3581c6,null))['catch'](handleError(_0x3581c6,null));};exports[_0xbb43('0x57')]=function(_0x31d265,_0x2a726d){return db[_0xbb43('0x3c')][_0xbb43('0x57')](_0x31d265['body'],{})[_0xbb43('0x1e')](function(_0x529455){var _0x6e7c04=_0x31d265['user'][_0xbb43('0x32')]({'plain':!![]});if(!_0x6e7c04)throw new Error(_0xbb43('0x58'));if(_0x6e7c04[_0xbb43('0x59')]===_0xbb43('0x5a')){var _0x4c13ad=_0x529455[_0xbb43('0x32')]({'plain':!![]});var _0x511e60=_0xbb43('0x33');return db[_0xbb43('0x5b')]['find']({'where':{'name':_0x511e60,'userProfileId':_0x6e7c04[_0xbb43('0x5c')]},'raw':!![]})[_0xbb43('0x1e')](function(_0x5cde88){if(_0x5cde88&&_0x5cde88[_0xbb43('0x5d')]===0x0){return db[_0xbb43('0x34')][_0xbb43('0x57')]({'name':_0x4c13ad[_0xbb43('0x37')],'resourceId':_0x4c13ad['id'],'type':_0x5cde88[_0xbb43('0x37')],'sectionId':_0x5cde88['id']},{})[_0xbb43('0x1e')](function(){return _0x529455;});}else{return _0x529455;}})[_0xbb43('0x27')](function(_0x161556){logger['error'](_0xbb43('0x5e'),_0x161556);throw _0x161556;});}return _0x529455;})['then'](respondWithResult(_0x2a726d,0xc9))[_0xbb43('0x27')](handleError(_0x2a726d,null));};exports[_0xbb43('0x30')]=function(_0x5e5530,_0x1b7920){if(_0x5e5530[_0xbb43('0x5f')]['id']){delete _0x5e5530[_0xbb43('0x5f')]['id'];}return db[_0xbb43('0x3c')][_0xbb43('0x60')]({'where':{'id':_0x5e5530[_0xbb43('0x56')]['id']},'include':[{'model':db[_0xbb43('0x39')],'as':_0xbb43('0x3a')}]})['then'](handleEntityNotFound(_0x1b7920,null))[_0xbb43('0x1e')](saveUpdates(_0x5e5530[_0xbb43('0x5f')],null))[_0xbb43('0x1e')](respondWithResult(_0x1b7920,null))[_0xbb43('0x27')](handleError(_0x1b7920,null));};exports['destroy']=function(_0x226f27,_0x5d73a5){return db[_0xbb43('0x3c')]['find']({'where':{'id':_0x226f27[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x5d73a5,null))[_0xbb43('0x1e')](removeEntity(_0x5d73a5,null))[_0xbb43('0x27')](handleError(_0x5d73a5,null));};exports[_0xbb43('0x61')]=function(_0x43468e,_0x349699){return db[_0xbb43('0x3c')][_0xbb43('0x61')]()[_0xbb43('0x1e')](respondWithResult(_0x349699,null))['catch'](handleError(_0x349699,null));};exports[_0xbb43('0x62')]=function(_0x5f4dc2,_0x1b9280,_0x3efdd7){if(_0x5f4dc2[_0xbb43('0x5f')]['id']){delete _0x5f4dc2[_0xbb43('0x5f')]['id'];}return db[_0xbb43('0x3c')][_0xbb43('0x60')]({'where':{'id':_0x5f4dc2[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x1b9280,null))['then'](function(_0x405665){if(_0x405665){_0x5f4dc2['body']['OpenchannelAccountId']=_0x405665['id'];return db[_0xbb43('0x63')]['create'](_0x5f4dc2[_0xbb43('0x5f')]);}})[_0xbb43('0x1e')](respondWithResult(_0x1b9280,null))['catch'](handleError(_0x1b9280,null));};exports[_0xbb43('0x64')]=function(_0x347c53,_0x52bd44,_0x443173){var _0xec31d5={'raw':![],'where':{}};var _0x2a0df7={};var _0x14678c={'count':0x0,'rows':[]};return db[_0xbb43('0x3c')][_0xbb43('0x65')]({'where':{'id':_0x347c53[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x52bd44,null))[_0xbb43('0x1e')](function(_0x28ce3e){if(_0x28ce3e){_0x2a0df7[_0xbb43('0x40')]=_[_0xbb43('0x42')](db[_0xbb43('0x63')][_0xbb43('0x3d')]);_0x2a0df7[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x347c53[_0xbb43('0x41')]);_0x2a0df7[_0xbb43('0x4b')]=_[_0xbb43('0x43')](_0x2a0df7[_0xbb43('0x40')],_0x2a0df7[_0xbb43('0x41')]);_0xec31d5[_0xbb43('0x46')]=_[_0xbb43('0x43')](_0x2a0df7[_0xbb43('0x40')],qs[_0xbb43('0x44')](_0x347c53[_0xbb43('0x41')][_0xbb43('0x44')]));_0xec31d5[_0xbb43('0x46')]=_0xec31d5[_0xbb43('0x46')][_0xbb43('0x45')]?_0xec31d5['attributes']:_0x2a0df7[_0xbb43('0x40')];if(!_0x347c53[_0xbb43('0x41')][_0xbb43('0x47')](_0xbb43('0x48'))){_0xec31d5[_0xbb43('0x2d')]=qs[_0xbb43('0x2d')](_0x347c53['query'][_0xbb43('0x2d')]);_0xec31d5[_0xbb43('0x2b')]=qs['offset'](_0x347c53['query']['offset']);}_0xec31d5[_0xbb43('0x66')]=qs[_0xbb43('0x49')](_0x347c53[_0xbb43('0x41')][_0xbb43('0x49')]);_0xec31d5['where']=qs['filters'](_[_0xbb43('0x4c')](_0x347c53['query'],_0x2a0df7[_0xbb43('0x4b')]));_0xec31d5[_0xbb43('0x4a')]['OpenchannelAccountId']=_0x28ce3e['id'];if(_0x347c53[_0xbb43('0x41')][_0xbb43('0x4d')]){_0xec31d5[_0xbb43('0x4a')]=_['merge'](_0xec31d5[_0xbb43('0x4a')],{'$or':_['map'](_0xec31d5[_0xbb43('0x46')],function(_0x3492e6){var _0x4bd0d6={};_0x4bd0d6[_0x3492e6]={'$like':'%'+_0x347c53[_0xbb43('0x41')][_0xbb43('0x4d')]+'%'};return _0x4bd0d6;})});}_0xec31d5=_[_0xbb43('0x4e')]({},_0xec31d5,_0x347c53[_0xbb43('0x50')]);return db[_0xbb43('0x63')]['count']({'where':_0xec31d5['where']})[_0xbb43('0x1e')](function(_0x3d2008){_0x14678c[_0xbb43('0x51')]=_0x3d2008;if(_0x347c53[_0xbb43('0x41')][_0xbb43('0x67')]){_0xec31d5[_0xbb43('0x52')]=[{'all':!![]}];}return db[_0xbb43('0x63')][_0xbb43('0x53')](_0xec31d5);})['then'](function(_0x22c358){_0x14678c['rows']=_0x22c358;return _0x14678c;});}})[_0xbb43('0x1e')](respondWithFilteredResult(_0x52bd44,_0xec31d5))[_0xbb43('0x27')](handleError(_0x52bd44,null));};exports['removeDispositions']=function(_0x371a7c,_0x1ba677,_0xbcc283){return db[_0xbb43('0x3c')][_0xbb43('0x60')]({'where':{'id':_0x371a7c[_0xbb43('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ba677,null))[_0xbb43('0x1e')](function(_0x2d18e7){if(_0x2d18e7){return _0x2d18e7['removeDispositions'](_0x371a7c[_0xbb43('0x41')]['ids']);}})[_0xbb43('0x1e')](respondWithStatusCode(_0x1ba677,null))[_0xbb43('0x27')](handleError(_0x1ba677,null));};exports[_0xbb43('0x68')]=function(_0x1a6438,_0x6a1fa6,_0x126b2a){if(_0x1a6438[_0xbb43('0x5f')]['id']){delete _0x1a6438[_0xbb43('0x5f')]['id'];}return db[_0xbb43('0x3c')][_0xbb43('0x60')]({'where':{'id':_0x1a6438[_0xbb43('0x56')]['id']}})['then'](handleEntityNotFound(_0x6a1fa6,null))[_0xbb43('0x1e')](function(_0x50f5d0){if(_0x50f5d0){_0x1a6438[_0xbb43('0x5f')][_0xbb43('0x69')]=_0x50f5d0['id'];return db[_0xbb43('0x6a')][_0xbb43('0x57')](_0x1a6438[_0xbb43('0x5f')]);}})['then'](respondWithResult(_0x6a1fa6,null))[_0xbb43('0x27')](handleError(_0x6a1fa6,null));};exports[_0xbb43('0x6b')]=function(_0x2306fa,_0x3ba331,_0x3c5b72){var _0x5e26d1={'raw':![],'where':{}};var _0x36305d={};var _0x48efd9={'count':0x0,'rows':[]};return db[_0xbb43('0x3c')][_0xbb43('0x65')]({'where':{'id':_0x2306fa[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x3ba331,null))[_0xbb43('0x1e')](function(_0x5b2803){if(_0x5b2803){_0x36305d[_0xbb43('0x40')]=_['keys'](db[_0xbb43('0x6a')]['rawAttributes']);_0x36305d[_0xbb43('0x41')]=_['keys'](_0x2306fa[_0xbb43('0x41')]);_0x36305d[_0xbb43('0x4b')]=_[_0xbb43('0x43')](_0x36305d['model'],_0x36305d[_0xbb43('0x41')]);_0x5e26d1['attributes']=_[_0xbb43('0x43')](_0x36305d[_0xbb43('0x40')],qs['fields'](_0x2306fa[_0xbb43('0x41')][_0xbb43('0x44')]));_0x5e26d1[_0xbb43('0x46')]=_0x5e26d1[_0xbb43('0x46')]['length']?_0x5e26d1[_0xbb43('0x46')]:_0x36305d[_0xbb43('0x40')];if(!_0x2306fa['query']['hasOwnProperty']('nolimit')){_0x5e26d1[_0xbb43('0x2d')]=qs['limit'](_0x2306fa[_0xbb43('0x41')][_0xbb43('0x2d')]);_0x5e26d1[_0xbb43('0x2b')]=qs['offset'](_0x2306fa['query'][_0xbb43('0x2b')]);}_0x5e26d1[_0xbb43('0x66')]=qs[_0xbb43('0x49')](_0x2306fa[_0xbb43('0x41')]['sort']);_0x5e26d1[_0xbb43('0x4a')]=qs[_0xbb43('0x4b')](_[_0xbb43('0x4c')](_0x2306fa['query'],_0x36305d[_0xbb43('0x4b')]));_0x5e26d1[_0xbb43('0x4a')][_0xbb43('0x69')]=_0x5b2803['id'];if(_0x2306fa[_0xbb43('0x41')][_0xbb43('0x4d')]){_0x5e26d1['where']=_[_0xbb43('0x4e')](_0x5e26d1['where'],{'$or':_[_0xbb43('0x3b')](_0x5e26d1[_0xbb43('0x46')],function(_0x1055f9){var _0x2adf50={};_0x2adf50[_0x1055f9]={'$like':'%'+_0x2306fa['query'][_0xbb43('0x4d')]+'%'};return _0x2adf50;})});}_0x5e26d1=_['merge']({},_0x5e26d1,_0x2306fa[_0xbb43('0x50')]);return db[_0xbb43('0x6a')]['count']({'where':_0x5e26d1[_0xbb43('0x4a')]})[_0xbb43('0x1e')](function(_0x37345e){_0x48efd9[_0xbb43('0x51')]=_0x37345e;if(_0x2306fa['query']['includeAll']){_0x5e26d1['include']=[{'all':!![]}];}return db[_0xbb43('0x6a')][_0xbb43('0x53')](_0x5e26d1);})['then'](function(_0x3537d8){_0x48efd9[_0xbb43('0x54')]=_0x3537d8;return _0x48efd9;});}})[_0xbb43('0x1e')](respondWithFilteredResult(_0x3ba331,_0x5e26d1))[_0xbb43('0x27')](handleError(_0x3ba331,null));};exports[_0xbb43('0x6c')]=function(_0x174586,_0x6a0f62,_0xf3db56){return db[_0xbb43('0x3c')]['find']({'where':{'id':_0x174586[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x6a0f62,null))[_0xbb43('0x1e')](function(_0x394e1e){if(_0x394e1e){return _0x394e1e[_0xbb43('0x6c')](_0x174586[_0xbb43('0x41')][_0xbb43('0x6d')]);}})[_0xbb43('0x1e')](respondWithStatusCode(_0x6a0f62,null))[_0xbb43('0x27')](handleError(_0x6a0f62,null));};exports[_0xbb43('0x6e')]=function(_0x9edadf,_0x5e3539,_0x3299f8){var _0x29b93f={'body':_0x9edadf['body'],'channel':_0xbb43('0x6f')};var _0x3d4717=[];var _0x13e255=[];var _0x502af7={};var _0x58ba69=![];return db[_0xbb43('0x70')][_0xbb43('0x61')]()[_0xbb43('0x1e')](function(_0x187f44){if(!_0x187f44){throw new db[(_0xbb43('0x71'))][(_0xbb43('0x72'))](_0xbb43('0x73'));}_0x3d4717=_[_0xbb43('0x74')](_['keys'](_0x187f44),[_0xbb43('0x75'),_0xbb43('0x76')]);_0x13e255=_[_0xbb43('0x74')](_[_0xbb43('0x42')](_0x187f44),[_0xbb43('0x75'),'updatedAt','CompanyId',_0xbb43('0x77')]);if(_0x9edadf[_0xbb43('0x5f')]['id']){delete _0x9edadf[_0xbb43('0x5f')]['id'];}if(_[_0xbb43('0x78')](_0x9edadf['body'][_0xbb43('0x79')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0xbb43('0x78')](_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x5f')])||_0x9edadf['body'][_0xbb43('0x5f')]===''){throw new db[(_0xbb43('0x71'))][(_0xbb43('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbb43('0x78')](_0x9edadf['body'][_0xbb43('0x7a')])){throw new db[(_0xbb43('0x71'))][(_0xbb43('0x72'))](_0xbb43('0x7b')+_0x13e255);}if(!_[_0xbb43('0x7c')](_0x13e255,_0x9edadf['body'][_0xbb43('0x7a')])){throw new db[(_0xbb43('0x71'))]['ValidationError'](_0xbb43('0x7d')+_0x13e255);}_0x502af7[_0x9edadf['body']['mapKey']]=_0x9edadf[_0xbb43('0x5f')]['from'];})[_0xbb43('0x1e')](function(){return db[_0xbb43('0x3c')][_0xbb43('0x60')]({'where':{'id':_0x9edadf[_0xbb43('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xbb43('0x70')],'as':_0xbb43('0x7e'),'where':_0x502af7,'limit':0x1,'order':[[_0xbb43('0x76'),_0xbb43('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0xbb43('0x80')}]});})[_0xbb43('0x1e')](handleEntityNotFound(_0x5e3539,null))[_0xbb43('0x1e')](function(_0xad2232){if(_0xad2232&&_0xad2232['List']){_0x29b93f[_0xbb43('0x81')]=_0xad2232;_0x29b93f[_0xbb43('0x82')]=_0xad2232['Applications'];_0x29b93f[_0xbb43('0x83')]=_0xad2232['List'];_0x29b93f[_0xbb43('0x82')]=_[_0xbb43('0x84')](_0x29b93f[_0xbb43('0x82')],[_0xbb43('0x85')],['asc']);if(_0x29b93f[_0xbb43('0x81')][_0xbb43('0x80')]){delete _0x29b93f[_0xbb43('0x81')][_0xbb43('0x80')];}if(_0x29b93f[_0xbb43('0x81')][_0xbb43('0x86')]&&_0x29b93f['account'][_0xbb43('0x86')][_0xbb43('0x7e')][_0xbb43('0x45')]){return _0x29b93f[_0xbb43('0x81')][_0xbb43('0x86')]['Contacts'][0x0];}var _0x567dc8=_[_0xbb43('0x87')](_0x9edadf[_0xbb43('0x5f')],{'firstName':_0x9edadf['body'][_0xbb43('0x79')],'ListId':_0xad2232[_0xbb43('0x77')]});_0x567dc8[_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x7a')]]=_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x79')];return db[_0xbb43('0x70')][_0xbb43('0x57')](_0x567dc8,{'fields':_0x3d4717,'raw':!![]});}})[_0xbb43('0x1e')](handleEntityNotFound(_0x5e3539,null))[_0xbb43('0x1e')](function(_0x8b8045){_0x29b93f[_0xbb43('0x88')]=_0x8b8045;if(_0x8b8045){var _0x4703c7={'ContactId':_0x8b8045['id'],'OpenchannelAccountId':_0x9edadf[_0xbb43('0x56')]['id'],'from':(_0x8b8045[_0xbb43('0x89')]||'')+'\x20'+(_0x8b8045[_0xbb43('0x8a')]||'')};var _0x21151d={'OpenchannelAccountId':_0x9edadf[_0xbb43('0x56')]['id'],'closed':![]};if(_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x8b')]){_0x21151d[_0xbb43('0x8b')]=_0x9edadf['body'][_0xbb43('0x8b')];return db[_0xbb43('0x8c')][_0xbb43('0x60')]({'where':_0x21151d})[_0xbb43('0x1e')](function(_0x360524){if(_0x360524){return[_0x360524,![]];}_0x4703c7['threadId']=_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x8b')];_0x4703c7[_0xbb43('0x8d')]=_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x8d')];return db['OpenchannelInteraction']['create'](_0x4703c7)[_0xbb43('0x1e')](function(_0x408598){return[_0x408598,!![]];});});}else{_0x21151d[_0xbb43('0x8b')]=null;}_0x21151d['ContactId']=_0x8b8045['id'];return db['OpenchannelInteraction']['find']({'where':_0x21151d})[_0xbb43('0x1e')](function(_0x1bece2){if(_0x1bece2){return[_0x1bece2,![]];}return db['OpenchannelInteraction'][_0xbb43('0x57')](_0x4703c7)[_0xbb43('0x1e')](function(_0x3f07fc){return[_0x3f07fc,!![]];});});}})[_0xbb43('0x8e')](function(_0x55ca8d,_0x30cc03){if(_0x55ca8d){_0x58ba69=_0x30cc03;if(!_0x30cc03){var _0x445590={'from':(_0x29b93f[_0xbb43('0x88')][_0xbb43('0x89')]||'')+'\x20'+(_0x29b93f[_0xbb43('0x88')]['lastName']||'')};if(_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x8b')]&&_0x9edadf[_0xbb43('0x5f')]['messageId']&&_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x8b')]!=_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x8f')]){_0x445590[_0xbb43('0x8b')]=_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x8f')];}return _0x55ca8d['update'](_0x445590);}else{return _0x55ca8d;}}})['then'](function(_0x4e3636){_0x29b93f[_0xbb43('0x90')]=_0x4e3636[_0xbb43('0x32')]({'plain':!![]});_0x29b93f[_0xbb43('0x90')][_0xbb43('0x91')]=_0x58ba69;if(_0x29b93f[_0xbb43('0x90')]['created']){if(_0x29b93f['account'][_0xbb43('0x92')]){_0x29b93f['applications'][_0xbb43('0x93')]({'id':0x0,'priority':_0x29b93f['applications']['length']+0x1,'app':_0xbb43('0x94'),'appdata':_0xbb43('0x95'),'interval':'*,*,*,*'});}}return db[_0xbb43('0x96')]['create']({'body':_0x9edadf[_0xbb43('0x5f')]['body'],'OpenchannelAccountId':_0x9edadf['params']['id'],'OpenchannelInteractionId':_0x4e3636['id'],'direction':'in','ContactId':_0x29b93f['contact']['id'],'AttachmentId':_0x9edadf[_0xbb43('0x5f')][_0xbb43('0x97')]});})[_0xbb43('0x1e')](function(_0x27504a){_0x29b93f[_0xbb43('0x26')]=_0x27504a;if(_0x29b93f['interaction'][_0xbb43('0x98')]){return db[_0xbb43('0x99')][_0xbb43('0x60')]({'attributes':['id',_0xbb43('0x37')],'where':{'id':_0x29b93f[_0xbb43('0x90')][_0xbb43('0x98')]}})[_0xbb43('0x1e')](function(_0x53c49d){if(_0x53c49d){_0x29b93f[_0xbb43('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0xbb43('0x9a'),'appdata':_0x53c49d[_0xbb43('0x37')]+','+(_0x29b93f[_0xbb43('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xbb43('0x9b')});_0x29b93f[_0xbb43('0x9c')]=![];}return respondWithRpcPromise(_0xbb43('0x9d'),'startRouting',_0x29b93f);});}return respondWithRpcPromise(_0xbb43('0x9d'),_0xbb43('0x9e'),_0x29b93f);})[_0xbb43('0x1e')](function(_0xdd5a06){respondWithRpcPromise(_0xbb43('0x9f'),'EventManager',{'event':_0xbb43('0x6e'),'message':_0xdd5a06},client9002);return _0xdd5a06;})['then'](respondWithResult(_0x5e3539,null))[_0xbb43('0x27')](handleError(_0x5e3539,null));};exports[_0xbb43('0xa0')]=function(_0x45ba96,_0x3aed08){var _0xb9869e=_0x45ba96['params']['id'];var _0x42c68e=_0x45ba96[_0xbb43('0x5f')];var _0x1aa696=0xc8;var _0x3b829e=null;return db[_0xbb43('0xa1')][_0xbb43('0xa2')]({'isolationLevel':db[_0xbb43('0xa1')][_0xbb43('0xa3')][_0xbb43('0xa4')]['READ_COMMITTED']},function(_0x401e7b){return db[_0xbb43('0x3c')][_0xbb43('0x65')]({'where':{'id':_0xb9869e},'transaction':_0x401e7b})['then'](function(_0x3c7bda){if(_0x3c7bda){return db[_0xbb43('0xa5')][_0xbb43('0x31')]({'where':{'OpenchannelAccountId':_0xb9869e},'transaction':_0x401e7b})[_0xbb43('0x1e')](function(){var _0x18574c=_[_0xbb43('0x3b')](_0x42c68e,function(_0x236f6b){_0x236f6b[_0xbb43('0x69')]=_0xb9869e;return _0x236f6b;});return db[_0xbb43('0xa5')][_0xbb43('0xa6')](_0x18574c,{'transaction':_0x401e7b});});}else{_0x1aa696=0x194;_0x3b829e=[];}});})[_0xbb43('0x1e')](function(){if(_0x1aa696!==0x194){return db[_0xbb43('0xa5')][_0xbb43('0xa7')]({'where':{'OpenchannelAccountId':_0xb9869e},'order':_0xbb43('0x85')})[_0xbb43('0x1e')](function(_0x23bb72){_0x3b829e=_0x23bb72;});}})[_0xbb43('0x27')](function(_0x4afeed){_0x1aa696=0x1f4;logger[_0xbb43('0x24')](_0x4afeed[_0xbb43('0x36')]);if(_0x4afeed[_0xbb43('0x37')]){delete _0x4afeed['name'];}_0x3b829e=_0x4afeed;})['finally'](function(){if(_0x3b829e===null){_0x3aed08[_0xbb43('0x35')](_0x1aa696);}else{if(_0x1aa696===0x1f4){_0x3aed08[_0xbb43('0x28')](_0x1aa696)['send'](_0x3b829e);}else{_0x3aed08['status'](_0x1aa696)[_0xbb43('0x2a')](_0x3b829e);}}});};exports[_0xbb43('0xa8')]=function(_0x1954e8,_0x16eff3,_0x2ff011){var _0x5ccc92={};var _0x2651f9={};var _0x53c8dd;var _0x5313b6;return db['OpenchannelAccount'][_0xbb43('0x65')]({'where':{'id':_0x1954e8[_0xbb43('0x56')]['id']}})['then'](handleEntityNotFound(_0x16eff3,null))[_0xbb43('0x1e')](function(_0x3244ed){if(_0x3244ed){_0x53c8dd=_0x3244ed;_0x2651f9[_0xbb43('0x40')]=_[_0xbb43('0x42')](db[_0xbb43('0xa5')]['rawAttributes']);_0x2651f9[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x1954e8[_0xbb43('0x41')]);_0x2651f9[_0xbb43('0x4b')]=_['intersection'](_0x2651f9[_0xbb43('0x40')],_0x2651f9['query']);_0x5ccc92[_0xbb43('0x46')]=_[_0xbb43('0x43')](_0x2651f9[_0xbb43('0x40')],qs[_0xbb43('0x44')](_0x1954e8[_0xbb43('0x41')][_0xbb43('0x44')]));_0x5ccc92[_0xbb43('0x46')]=_0x5ccc92[_0xbb43('0x46')][_0xbb43('0x45')]?_0x5ccc92[_0xbb43('0x46')]:_0x2651f9[_0xbb43('0x40')];_0x5ccc92[_0xbb43('0x66')]=qs[_0xbb43('0x49')](_0x1954e8[_0xbb43('0x41')][_0xbb43('0x49')]);_0x5ccc92[_0xbb43('0x4a')]=qs['filters'](_['pick'](_0x1954e8[_0xbb43('0x41')],_0x2651f9[_0xbb43('0x4b')]));if(_0x1954e8['query'][_0xbb43('0x4d')]){_0x5ccc92[_0xbb43('0x4a')]=_[_0xbb43('0x4e')](_0x5ccc92[_0xbb43('0x4a')],{'$or':_[_0xbb43('0x3b')](_0x5ccc92['attributes'],function(_0x1a534c){var _0x5291bb={};_0x5291bb[_0x1a534c]={'$like':'%'+_0x1954e8['query'][_0xbb43('0x4d')]+'%'};return _0x5291bb;})});}_0x5ccc92=_['merge']({},_0x5ccc92,_0x1954e8[_0xbb43('0x50')]);return _0x53c8dd['getApplications'](_0x5ccc92);}})[_0xbb43('0x1e')](function(_0x1474ae){if(_0x1474ae){_0x5313b6=_0x1474ae[_0xbb43('0x45')];if(!_0x1954e8[_0xbb43('0x41')]['hasOwnProperty'](_0xbb43('0x48'))){_0x5ccc92[_0xbb43('0x2d')]=qs[_0xbb43('0x2d')](_0x1954e8[_0xbb43('0x41')]['limit']);_0x5ccc92[_0xbb43('0x2b')]=qs[_0xbb43('0x2b')](_0x1954e8[_0xbb43('0x41')]['offset']);}return _0x53c8dd[_0xbb43('0xa8')](_0x5ccc92);}})[_0xbb43('0x1e')](function(_0x22da55){if(_0x22da55){return _0x22da55?{'count':_0x5313b6,'rows':_0x22da55}:null;}})[_0xbb43('0x1e')](respondWithResult(_0x16eff3,null))[_0xbb43('0x27')](handleError(_0x16eff3,null));};exports['getInteractions']=function(_0x913569,_0x5b3250,_0x5ca869){var _0x4702cd={'raw':![],'where':{}};var _0x47967a={};var _0x1a61e1={'count':0x0,'rows':[]};return db[_0xbb43('0x3c')][_0xbb43('0x65')]({'where':{'id':_0x913569[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x5b3250,null))['then'](function(_0x28d33a){if(_0x28d33a){_0x47967a[_0xbb43('0x40')]=_['keys'](db[_0xbb43('0x8c')][_0xbb43('0x3d')]);_0x47967a[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x913569[_0xbb43('0x41')]);_0x47967a[_0xbb43('0x4b')]=_['intersection'](_0x47967a[_0xbb43('0x40')],_0x47967a[_0xbb43('0x41')]);_0x4702cd[_0xbb43('0x46')]=_[_0xbb43('0x43')](_0x47967a[_0xbb43('0x40')],qs[_0xbb43('0x44')](_0x913569[_0xbb43('0x41')][_0xbb43('0x44')]));_0x4702cd['attributes']=_0x4702cd[_0xbb43('0x46')][_0xbb43('0x45')]?_0x4702cd['attributes']:_0x47967a[_0xbb43('0x40')];if(!_0x913569[_0xbb43('0x41')][_0xbb43('0x47')](_0xbb43('0x48'))){_0x4702cd[_0xbb43('0x2d')]=qs[_0xbb43('0x2d')](_0x913569[_0xbb43('0x41')][_0xbb43('0x2d')]);_0x4702cd[_0xbb43('0x2b')]=qs[_0xbb43('0x2b')](_0x913569[_0xbb43('0x41')][_0xbb43('0x2b')]);}_0x4702cd[_0xbb43('0x66')]=qs['sort'](_0x913569[_0xbb43('0x41')][_0xbb43('0x49')]);_0x4702cd['where']=qs[_0xbb43('0x4b')](_['pick'](_0x913569[_0xbb43('0x41')],_0x47967a[_0xbb43('0x4b')]));_0x4702cd[_0xbb43('0x4a')][_0xbb43('0x69')]=_0x28d33a['id'];if(_0x913569[_0xbb43('0x41')][_0xbb43('0x4d')]){_0x4702cd[_0xbb43('0x4a')]=_[_0xbb43('0x4e')](_0x4702cd[_0xbb43('0x4a')],{'$or':_[_0xbb43('0x3b')](_0x4702cd[_0xbb43('0x46')],function(_0xff50df){var _0x54fca4={};_0x54fca4[_0xff50df]={'$like':'%'+_0x913569['query'][_0xbb43('0x4d')]+'%'};return _0x54fca4;})});}_0x4702cd=_[_0xbb43('0x4e')]({},_0x4702cd,_0x913569['options']);return db[_0xbb43('0x8c')]['count']({'where':_0x4702cd['where']})['then'](function(_0x140520){_0x1a61e1[_0xbb43('0x51')]=_0x140520;if(_0x913569[_0xbb43('0x41')][_0xbb43('0x67')]){_0x4702cd[_0xbb43('0x52')]=[{'model':db[_0xbb43('0x70')],'as':_0xbb43('0xa9'),'required':![]},{'model':db[_0xbb43('0x99')],'as':'Owner','attributes':[_0xbb43('0x37'),_0xbb43('0xaa'),'internal'],'required':![]},{'model':db[_0xbb43('0xab')],'as':_0xbb43('0xac'),'attributes':['id',_0xbb43('0x37'),_0xbb43('0xad')],'where':_0x913569[_0xbb43('0x41')][_0xbb43('0xae')]?{'id':_0x913569[_0xbb43('0x41')][_0xbb43('0xae')]}:undefined,'required':_0x913569[_0xbb43('0x41')]['tag']?!![]:![]}];}return db[_0xbb43('0x8c')][_0xbb43('0x53')](_0x4702cd);})['then'](function(_0x50921c){_0x1a61e1[_0xbb43('0x54')]=_0x50921c;return _0x1a61e1;});}})[_0xbb43('0x1e')](respondWithFilteredResult(_0x5b3250,_0x4702cd))[_0xbb43('0x27')](handleError(_0x5b3250,null));};exports[_0xbb43('0xaf')]=function(_0x4a5d08,_0x3130b3,_0x4b6cfe){return db[_0xbb43('0x3c')]['find']({'where':{'id':_0x4a5d08[_0xbb43('0x56')]['id']}})['then'](handleEntityNotFound(_0x3130b3,null))[_0xbb43('0x1e')](function(_0x68bd09){if(_0x68bd09){return _0x68bd09[_0xbb43('0xaf')](_0x4a5d08[_0xbb43('0x5f')]['ids'],_[_0xbb43('0xb0')](_0x4a5d08[_0xbb43('0x5f')],[_0xbb43('0x6d'),'id'])||{})[_0xbb43('0x8e')](function(_0x71d1d9){for(var _0x1fbd28=0x0;_0x1fbd28<_0x4a5d08['body'][_0xbb43('0x6d')]['length'];_0x1fbd28+=0x1){socket[_0xbb43('0xb1')](_0xbb43('0xb2'),{'UserId':Number(_0x4a5d08[_0xbb43('0x5f')]['ids'][_0x1fbd28]),'OpenchannelAccountId':Number(_0x4a5d08[_0xbb43('0x56')]['id'])});}return _0x71d1d9;});}})[_0xbb43('0x1e')](respondWithResult(_0x3130b3,null))['catch'](handleError(_0x3130b3,null));};exports[_0xbb43('0xb3')]=function(_0x1d7aa8,_0x2f6fe6,_0x34aa82){return db[_0xbb43('0x3c')][_0xbb43('0x60')]({'where':{'id':_0x1d7aa8['params']['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x2f6fe6,null))[_0xbb43('0x1e')](function(_0x4dd2c6){if(_0x4dd2c6){return _0x4dd2c6[_0xbb43('0xb3')](_0x1d7aa8['query']['ids'])['then'](function(){if(_[_0xbb43('0xb4')](_0x1d7aa8['query'][_0xbb43('0x6d')])){for(var _0x43088f=0x0;_0x43088f<_0x1d7aa8[_0xbb43('0x41')][_0xbb43('0x6d')][_0xbb43('0x45')];_0x43088f+=0x1){socket[_0xbb43('0xb1')](_0xbb43('0xb5'),{'UserId':Number(_0x1d7aa8[_0xbb43('0x41')]['ids'][_0x43088f]),'OpenchannelAccountId':Number(_0x1d7aa8[_0xbb43('0x56')]['id'])});}}else{socket[_0xbb43('0xb1')](_0xbb43('0xb5'),{'UserId':Number(_0x1d7aa8[_0xbb43('0x41')][_0xbb43('0x6d')]),'OpenchannelAccountId':Number(_0x1d7aa8[_0xbb43('0x56')]['id'])});}});}})[_0xbb43('0x1e')](respondWithStatusCode(_0x2f6fe6,null))[_0xbb43('0x27')](handleError(_0x2f6fe6,null));};exports[_0xbb43('0xb6')]=function(_0x2cb3d8,_0x32ef02,_0x2ff487){var _0x39d4b5={};var _0x256258={};var _0x50fc65;var _0x4a6256;return db[_0xbb43('0x3c')][_0xbb43('0x65')]({'where':{'id':_0x2cb3d8[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x32ef02,null))[_0xbb43('0x1e')](function(_0x3fa073){if(_0x3fa073){_0x50fc65=_0x3fa073;_0x256258['model']=_[_0xbb43('0x42')](db[_0xbb43('0x99')][_0xbb43('0x3d')]);_0x256258[_0xbb43('0x41')]=_[_0xbb43('0x42')](_0x2cb3d8[_0xbb43('0x41')]);_0x256258[_0xbb43('0x4b')]=_[_0xbb43('0x43')](_0x256258[_0xbb43('0x40')],_0x256258['query']);_0x39d4b5['attributes']=_[_0xbb43('0x43')](_0x256258[_0xbb43('0x40')],qs[_0xbb43('0x44')](_0x2cb3d8[_0xbb43('0x41')]['fields']));_0x39d4b5[_0xbb43('0x46')]=_0x39d4b5['attributes']['length']?_0x39d4b5[_0xbb43('0x46')]:_0x256258[_0xbb43('0x40')];_0x39d4b5[_0xbb43('0x66')]=qs[_0xbb43('0x49')](_0x2cb3d8[_0xbb43('0x41')][_0xbb43('0x49')]);_0x39d4b5[_0xbb43('0x4a')]=qs[_0xbb43('0x4b')](_[_0xbb43('0x4c')](_0x2cb3d8['query'],_0x256258[_0xbb43('0x4b')]));if(_0x2cb3d8[_0xbb43('0x41')][_0xbb43('0x4d')]){_0x39d4b5['where']=_['merge'](_0x39d4b5[_0xbb43('0x4a')],{'$or':_[_0xbb43('0x3b')](_0x39d4b5[_0xbb43('0x46')],function(_0x2b9f55){var _0x1f9e33={};_0x1f9e33[_0x2b9f55]={'$like':'%'+_0x2cb3d8[_0xbb43('0x41')][_0xbb43('0x4d')]+'%'};return _0x1f9e33;})});}_0x39d4b5=_[_0xbb43('0x4e')]({},_0x39d4b5,_0x2cb3d8['options']);return _0x50fc65[_0xbb43('0xb6')](_0x39d4b5);}})[_0xbb43('0x1e')](function(_0x543d05){if(_0x543d05){_0x4a6256=_0x543d05['length'];if(!_0x2cb3d8[_0xbb43('0x41')][_0xbb43('0x47')]('nolimit')){_0x39d4b5['limit']=qs[_0xbb43('0x2d')](_0x2cb3d8[_0xbb43('0x41')]['limit']);_0x39d4b5[_0xbb43('0x2b')]=qs[_0xbb43('0x2b')](_0x2cb3d8[_0xbb43('0x41')][_0xbb43('0x2b')]);}return _0x50fc65['getAgents'](_0x39d4b5);}})[_0xbb43('0x1e')](function(_0x582c77){if(_0x582c77){return _0x582c77?{'count':_0x4a6256,'rows':_0x582c77}:null;}})[_0xbb43('0x1e')](respondWithResult(_0x32ef02,null))['catch'](handleError(_0x32ef02,null));};exports[_0xbb43('0xb7')]=function(_0x16e5b1,_0x52220a,_0x185e5a){var _0x59b58f,_0x1e5988,_0x1de001;if(_[_0xbb43('0x78')](_0x16e5b1[_0xbb43('0x5f')]['body'])||_0x16e5b1[_0xbb43('0x5f')][_0xbb43('0x5f')]===''){throw new db['Sequelize'][(_0xbb43('0x72'))](_0xbb43('0xb8'));}if(_[_0xbb43('0x78')](_0x16e5b1[_0xbb43('0x5f')]['to'])){}_0x59b58f=_0x16e5b1[_0xbb43('0x5f')]['to'];return db[_0xbb43('0x3c')][_0xbb43('0x65')]({'where':{'id':_0x16e5b1[_0xbb43('0x56')]['id']}})[_0xbb43('0x1e')](handleEntityNotFound(_0x52220a,null))['then'](function(_0x10ced4){if(_0x10ced4){return db[_0xbb43('0x3c')]['find']({'where':{'id':_0x10ced4['id']},'include':[{'model':db[_0xbb43('0xb9')],'as':_0xbb43('0x86'),'include':[{'model':db[_0xbb43('0x70')],'as':'Contacts','where':{[_0x10ced4[_0xbb43('0x7a')]]:_0x59b58f},'limit':0x1,'order':[['updatedAt',_0xbb43('0x7f')]]}]}]})[_0xbb43('0x1e')](handleEntityNotFound(_0x52220a,null))['then'](function(_0x4ba2dc){if(_0x4ba2dc&&_0x4ba2dc[_0xbb43('0x86')]){_0x1e5988=_0x4ba2dc[_0xbb43('0x32')]({'plain':!![]});if(_0x1e5988[_0xbb43('0x86')]&&_0x1e5988[_0xbb43('0x86')]['Contacts'][_0xbb43('0x45')]){return _0x1e5988[_0xbb43('0x86')][_0xbb43('0x7e')][0x0];}return db['CmContact'][_0xbb43('0x57')](_[_0xbb43('0x87')](_0x16e5b1[_0xbb43('0x5f')],{'firstName':_0x59b58f,[_0x4ba2dc[_0xbb43('0x7a')]]:_0x59b58f,'phone':_0x59b58f,'ListId':_0x1e5988[_0xbb43('0x77')]}));}})['then'](handleEntityNotFound(_0x52220a,null))[_0xbb43('0x1e')](function(_0x5addc8){if(_0x5addc8){_0x1de001=_0x5addc8;return db[_0xbb43('0x8c')][_0xbb43('0x60')]({'where':{'ContactId':_0x1de001['id'],'closed':![],'OpenchannelAccountId':_0x1e5988['id']}})[_0xbb43('0x1e')](function(_0x34ba56){if(_0x34ba56){return[_0x34ba56,![]];}return db[_0xbb43('0x8c')]['create']({'UserId':_0x16e5b1[_0xbb43('0x5a')]['id'],'ContactId':_0x1de001['id'],'OpenchannelAccountId':_0x1e5988['id'],'lastMsgDirection':'out','firstMsgDirection':_0xbb43('0xba'),'Messages':[_[_0xbb43('0x4e')](_0x16e5b1['body'],{'read':![],'body':_0x16e5b1[_0xbb43('0x5f')][_0xbb43('0x5f')],'OpenchannelAccountId':_0x1e5988['id'],'UserId':_0x16e5b1[_0xbb43('0x5a')]['id'],'ContactId':_0x1de001['id']})]},{'include':[{'model':db[_0xbb43('0x96')],'as':_0xbb43('0xbb')}]})['then'](function(_0x496661){return[_0x496661,!![]];});});}})[_0xbb43('0x8e')](function(_0x385c4b,_0x50f964){if(_0x50f964){return _0x385c4b;}return db[_0xbb43('0x96')]['create'](_['merge'](_0x16e5b1['body'],{'read':![],'body':_0x16e5b1[_0xbb43('0x5f')][_0xbb43('0x5f')],'OpenchannelAccountId':_0x1e5988['id'],'OpenchannelInteractionId':_0x385c4b['id'],'UserId':_0x16e5b1[_0xbb43('0x5a')]['id'],'ContactId':_0x1de001['id']}))['then'](function(_0x2a0c02){_0x385c4b[_0xbb43('0xbc')][_0xbb43('0xbb')]=[];_0x385c4b[_0xbb43('0xbc')][_0xbb43('0xbb')][_0xbb43('0x93')](_0x2a0c02[_0xbb43('0xbc')]);return _0x385c4b;});});}})['then'](respondWithResult(_0x52220a,null))[_0xbb43('0x27')](handleError(_0x52220a,null));}; \ No newline at end of file +var _0x4f16=['describe','getDispositions','findOne','Disposition','pick','OpenchannelAccountId','filter','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','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','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','threadId','externalUrl','OpenchannelInteraction','lastName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','addAgents','omit','spread','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','bluebird','mustache','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelAccount.socket','client','http','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','findAll','rows','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4f16,0x11f));var _0x64f1=function(_0x5e3fb7,_0x4f0c05){_0x5e3fb7=_0x5e3fb7-0x0;var _0x3c9228=_0x4f16[_0x5e3fb7];return _0x3c9228;};'use strict';var emlformat=require(_0x64f1('0x0'));var rimraf=require(_0x64f1('0x1'));var zipdir=require(_0x64f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x64f1('0x3'));var Mustache=require(_0x64f1('0x4'));var util=require('util');var path=require(_0x64f1('0x5'));var sox=require('sox');var csv=require(_0x64f1('0x6'));var ejs=require(_0x64f1('0x7'));var fs=require('fs');var fs_extra=require(_0x64f1('0x8'));var _=require(_0x64f1('0x9'));var squel=require(_0x64f1('0xa'));var crypto=require(_0x64f1('0xb'));var jsforce=require(_0x64f1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x64f1('0x6'));var querystring=require(_0x64f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x64f1('0xe'));var authService=require(_0x64f1('0xf'));var qs=require(_0x64f1('0x10'));var as=require(_0x64f1('0x11'));var hardwareService=require(_0x64f1('0x12'));var logger=require(_0x64f1('0x13'))('api');var utils=require(_0x64f1('0x14'));var config=require(_0x64f1('0x15'));var licenseUtil=require(_0x64f1('0x16'));var db=require(_0x64f1('0x17'))['db'];config['redis']=_['defaults'](config[_0x64f1('0x18')],{'host':_0x64f1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x64f1('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x64f1('0x1b')][_0x64f1('0x1c')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd232,_0x532a1c,_0x12f05c,_0x33ab76){return new BPromise(function(_0x2217c1,_0x2f9464){var _0x598f2e=_0x33ab76||client;return _0x598f2e[_0x64f1('0x1d')](_0x4cd232,_0x12f05c)[_0x64f1('0x1e')](function(_0xb70e4d){logger[_0x64f1('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x532a1c,_0x64f1('0x20'));logger['debug'](_0x64f1('0x21'),_0x532a1c,'request\x20sent',JSON['stringify'](_0xb70e4d));if(_0xb70e4d['error']){if(_0xb70e4d[_0x64f1('0x22')][_0x64f1('0x23')]===0x1f4){logger[_0x64f1('0x22')](_0x64f1('0x24'),_0x532a1c,_0xb70e4d[_0x64f1('0x22')][_0x64f1('0x25')]);return _0x2f9464(_0xb70e4d[_0x64f1('0x22')][_0x64f1('0x25')]);}logger[_0x64f1('0x22')](_0x64f1('0x24'),_0x532a1c,_0xb70e4d[_0x64f1('0x22')][_0x64f1('0x25')]);return _0x2217c1(_0xb70e4d['error']['message']);}else{logger['info'](_0x64f1('0x24'),_0x532a1c,_0x64f1('0x20'));_0x2217c1(_0xb70e4d['result'][_0x64f1('0x25')]);}})[_0x64f1('0x26')](function(_0x1f01fb){logger[_0x64f1('0x22')](_0x64f1('0x24'),_0x532a1c,_0x1f01fb);_0x2f9464(_0x1f01fb);});});}function respondWithStatusCode(_0x85576a,_0x1edc1a){_0x1edc1a=_0x1edc1a||0xcc;return function(_0x229cb1){if(_0x229cb1){return _0x85576a[_0x64f1('0x27')](_0x1edc1a);}return _0x85576a[_0x64f1('0x28')](_0x1edc1a)['end']();};}function respondWithResult(_0x50545d,_0x557ba7){_0x557ba7=_0x557ba7||0xc8;return function(_0x73de5c){if(_0x73de5c){return _0x50545d[_0x64f1('0x28')](_0x557ba7)[_0x64f1('0x29')](_0x73de5c);}};}function respondWithFilteredResult(_0x15164b,_0x1f477b){return function(_0x8746a){if(_0x8746a){var _0x15e6d5=typeof _0x1f477b[_0x64f1('0x2a')]===_0x64f1('0x2b')&&typeof _0x1f477b['limit']===_0x64f1('0x2b');var _0x3ed740=_0x8746a[_0x64f1('0x2c')];var _0x18d162=_0x15e6d5?0x0:_0x1f477b[_0x64f1('0x2a')];var _0x2c388c=_0x15e6d5?_0x8746a[_0x64f1('0x2c')]:_0x1f477b[_0x64f1('0x2a')]+_0x1f477b[_0x64f1('0x2d')];var _0x2e27c9;if(_0x2c388c>=_0x3ed740){_0x2c388c=_0x3ed740;_0x2e27c9=0xc8;}else{_0x2e27c9=0xce;}_0x15164b['status'](_0x2e27c9);return _0x15164b['set'](_0x64f1('0x2e'),_0x18d162+'-'+_0x2c388c+'/'+_0x3ed740)[_0x64f1('0x29')](_0x8746a);}return null;};}function patchUpdates(_0x42a389){return function(_0x476748){try{jsonpatch[_0x64f1('0x2f')](_0x476748,_0x42a389,!![]);}catch(_0x452d6c){return BPromise[_0x64f1('0x30')](_0x452d6c);}return _0x476748[_0x64f1('0x31')]();};}function saveUpdates(_0x2ec623,_0x308c22){return function(_0x4d6bce){if(_0x4d6bce){return _0x4d6bce['update'](_0x2ec623)[_0x64f1('0x1e')](function(_0x420508){return _0x420508;});}return null;};}function removeEntity(_0x2bf19b,_0x3cef1a){return function(_0xadd35d){if(_0xadd35d){return _0xadd35d[_0x64f1('0x32')]()[_0x64f1('0x1e')](function(){var _0x7ecc97=_0xadd35d[_0x64f1('0x33')]({'plain':!![]});var _0x3c15bd='OpenchannelAccounts';return db[_0x64f1('0x34')]['destroy']({'where':{'type':_0x3c15bd,'resourceId':_0x7ecc97['id']}})['then'](function(){return _0xadd35d;});})[_0x64f1('0x1e')](function(){_0x2bf19b[_0x64f1('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1e584,_0x46c917){return function(_0x44d913){if(!_0x44d913){_0xd1e584['sendStatus'](0x194);}return _0x44d913;};}function handleError(_0x4ffb12,_0x2e7f8b){_0x2e7f8b=_0x2e7f8b||0x1f4;return function(_0x1a99b2){logger[_0x64f1('0x22')](_0x1a99b2[_0x64f1('0x35')]);if(_0x1a99b2[_0x64f1('0x36')]){delete _0x1a99b2[_0x64f1('0x36')];}_0x4ffb12[_0x64f1('0x28')](_0x2e7f8b)['send'](_0x1a99b2);};}exports[_0x64f1('0x37')]=function(_0x314724,_0x2aefb8){var _0x405bc6={'include':[{'model':db[_0x64f1('0x38')],'as':_0x64f1('0x39')}]},_0x20214e={},_0x34ba29={'count':0x0,'rows':[]};var _0x12b3cb=_[_0x64f1('0x3a')](db[_0x64f1('0x3b')][_0x64f1('0x3c')],function(_0xd5bd74){return{'name':_0xd5bd74[_0x64f1('0x3d')],'type':_0xd5bd74[_0x64f1('0x3e')]['key']};});_0x20214e[_0x64f1('0x3f')]=_[_0x64f1('0x3a')](_0x12b3cb,_0x64f1('0x36'));_0x20214e[_0x64f1('0x40')]=_[_0x64f1('0x41')](_0x314724[_0x64f1('0x40')]);_0x20214e[_0x64f1('0x42')]=_[_0x64f1('0x43')](_0x20214e[_0x64f1('0x3f')],_0x20214e[_0x64f1('0x40')]);_0x405bc6['attributes']=_[_0x64f1('0x43')](_0x20214e[_0x64f1('0x3f')],qs['fields'](_0x314724['query']['fields']));_0x405bc6[_0x64f1('0x44')]=_0x405bc6['attributes'][_0x64f1('0x45')]?_0x405bc6['attributes']:_0x20214e[_0x64f1('0x3f')];if(!_0x314724['query'][_0x64f1('0x46')](_0x64f1('0x47'))){_0x405bc6['limit']=qs[_0x64f1('0x2d')](_0x314724[_0x64f1('0x40')][_0x64f1('0x2d')]);_0x405bc6[_0x64f1('0x2a')]=qs[_0x64f1('0x2a')](_0x314724[_0x64f1('0x40')][_0x64f1('0x2a')]);}_0x405bc6[_0x64f1('0x48')]=qs[_0x64f1('0x49')](_0x314724[_0x64f1('0x40')]['sort']);_0x405bc6['where']=qs[_0x64f1('0x42')](_['pick'](_0x314724[_0x64f1('0x40')],_0x20214e['filters']),_0x12b3cb);if(_0x314724[_0x64f1('0x40')]['filter']){_0x405bc6[_0x64f1('0x4a')]=_[_0x64f1('0x4b')](_0x405bc6['where'],{'$or':_[_0x64f1('0x3a')](_0x12b3cb,function(_0x429d3e){if(_0x429d3e['type']!==_0x64f1('0x4c')){var _0x56f4d3={};_0x56f4d3[_0x429d3e['name']]={'$like':'%'+_0x314724[_0x64f1('0x40')]['filter']+'%'};return _0x56f4d3;}})});}_0x405bc6=_[_0x64f1('0x4b')]({},_0x405bc6,_0x314724[_0x64f1('0x4d')]);var _0x404082={'where':_0x405bc6[_0x64f1('0x4a')]};return db[_0x64f1('0x3b')][_0x64f1('0x2c')](_0x404082)['then'](function(_0x3d539b){_0x34ba29['count']=_0x3d539b;if(_0x314724[_0x64f1('0x40')]['includeAll']){_0x405bc6['include']=[{'all':!![]}];}return db[_0x64f1('0x3b')][_0x64f1('0x4e')](_0x405bc6);})[_0x64f1('0x1e')](function(_0x2bf7a9){_0x34ba29[_0x64f1('0x4f')]=_0x2bf7a9;return _0x34ba29;})[_0x64f1('0x1e')](respondWithFilteredResult(_0x2aefb8,_0x405bc6))[_0x64f1('0x26')](handleError(_0x2aefb8,null));};exports[_0x64f1('0x50')]=function(_0x5d9f9d,_0x491e08){var _0xa3c647={'raw':![],'where':{'id':_0x5d9f9d[_0x64f1('0x51')]['id']},'include':[{'model':db[_0x64f1('0x38')],'as':_0x64f1('0x39')}]},_0x29851d={};_0x29851d[_0x64f1('0x3f')]=_[_0x64f1('0x41')](db['OpenchannelAccount'][_0x64f1('0x3c')]);_0x29851d[_0x64f1('0x40')]=_[_0x64f1('0x41')](_0x5d9f9d[_0x64f1('0x40')]);_0x29851d[_0x64f1('0x42')]=_[_0x64f1('0x43')](_0x29851d[_0x64f1('0x3f')],_0x29851d[_0x64f1('0x40')]);_0xa3c647[_0x64f1('0x44')]=_[_0x64f1('0x43')](_0x29851d['model'],qs[_0x64f1('0x52')](_0x5d9f9d['query'][_0x64f1('0x52')]));_0xa3c647[_0x64f1('0x44')]=_0xa3c647[_0x64f1('0x44')][_0x64f1('0x45')]?_0xa3c647[_0x64f1('0x44')]:_0x29851d['model'];if(_0x5d9f9d[_0x64f1('0x40')]['includeAll']){_0xa3c647[_0x64f1('0x53')]=[{'all':!![]}];}_0xa3c647=_[_0x64f1('0x4b')]({},_0xa3c647,_0x5d9f9d[_0x64f1('0x4d')]);return db[_0x64f1('0x3b')][_0x64f1('0x54')](_0xa3c647)[_0x64f1('0x1e')](handleEntityNotFound(_0x491e08,null))[_0x64f1('0x1e')](respondWithResult(_0x491e08,null))[_0x64f1('0x26')](handleError(_0x491e08,null));};exports[_0x64f1('0x55')]=function(_0x174a88,_0x396af2){return db['OpenchannelAccount'][_0x64f1('0x55')](_0x174a88[_0x64f1('0x56')],{})[_0x64f1('0x1e')](function(_0x3380d2){var _0x289839=_0x174a88[_0x64f1('0x57')][_0x64f1('0x33')]({'plain':!![]});if(!_0x289839)throw new Error(_0x64f1('0x58'));if(_0x289839[_0x64f1('0x59')]==='user'){var _0x51bab4=_0x3380d2['get']({'plain':!![]});var _0x311caf=_0x64f1('0x5a');return db[_0x64f1('0x5b')]['find']({'where':{'name':_0x311caf,'userProfileId':_0x289839[_0x64f1('0x5c')]},'raw':!![]})['then'](function(_0x13dbf5){if(_0x13dbf5&&_0x13dbf5[_0x64f1('0x5d')]===0x0){return db[_0x64f1('0x34')][_0x64f1('0x55')]({'name':_0x51bab4[_0x64f1('0x36')],'resourceId':_0x51bab4['id'],'type':_0x13dbf5[_0x64f1('0x36')],'sectionId':_0x13dbf5['id']},{})['then'](function(){return _0x3380d2;});}else{return _0x3380d2;}})['catch'](function(_0x3d1b21){logger[_0x64f1('0x22')](_0x64f1('0x5e'),_0x3d1b21);throw _0x3d1b21;});}return _0x3380d2;})['then'](respondWithResult(_0x396af2,0xc9))[_0x64f1('0x26')](handleError(_0x396af2,null));};exports['update']=function(_0x121e2e,_0x5b0514){if(_0x121e2e[_0x64f1('0x56')]['id']){delete _0x121e2e[_0x64f1('0x56')]['id'];}return db[_0x64f1('0x3b')]['find']({'where':{'id':_0x121e2e[_0x64f1('0x51')]['id']},'include':[{'model':db[_0x64f1('0x38')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5b0514,null))[_0x64f1('0x1e')](saveUpdates(_0x121e2e[_0x64f1('0x56')],null))[_0x64f1('0x1e')](respondWithResult(_0x5b0514,null))[_0x64f1('0x26')](handleError(_0x5b0514,null));};exports[_0x64f1('0x32')]=function(_0x3027c0,_0xdbb3d2){return db['OpenchannelAccount'][_0x64f1('0x54')]({'where':{'id':_0x3027c0['params']['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0xdbb3d2,null))['then'](removeEntity(_0xdbb3d2,null))[_0x64f1('0x26')](handleError(_0xdbb3d2,null));};exports['describe']=function(_0x32fe25,_0x3afa0b){return db[_0x64f1('0x3b')][_0x64f1('0x5f')]()[_0x64f1('0x1e')](respondWithResult(_0x3afa0b,null))[_0x64f1('0x26')](handleError(_0x3afa0b,null));};exports['addDisposition']=function(_0x24c8d8,_0x134a5f,_0x13dd9d){if(_0x24c8d8['body']['id']){delete _0x24c8d8['body']['id'];}return db[_0x64f1('0x3b')][_0x64f1('0x54')]({'where':{'id':_0x24c8d8['params']['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x134a5f,null))[_0x64f1('0x1e')](function(_0x34cbbf){if(_0x34cbbf){_0x24c8d8['body']['OpenchannelAccountId']=_0x34cbbf['id'];return db['Disposition'][_0x64f1('0x55')](_0x24c8d8[_0x64f1('0x56')]);}})['then'](respondWithResult(_0x134a5f,null))['catch'](handleError(_0x134a5f,null));};exports[_0x64f1('0x60')]=function(_0x4e2fcf,_0x2a7916,_0x11038f){var _0x4feea0={'raw':![],'where':{}};var _0xf3940c={};var _0x3f645b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x64f1('0x61')]({'where':{'id':_0x4e2fcf[_0x64f1('0x51')]['id']}})['then'](handleEntityNotFound(_0x2a7916,null))[_0x64f1('0x1e')](function(_0x1e0d87){if(_0x1e0d87){_0xf3940c[_0x64f1('0x3f')]=_['keys'](db[_0x64f1('0x62')][_0x64f1('0x3c')]);_0xf3940c[_0x64f1('0x40')]=_['keys'](_0x4e2fcf[_0x64f1('0x40')]);_0xf3940c[_0x64f1('0x42')]=_[_0x64f1('0x43')](_0xf3940c[_0x64f1('0x3f')],_0xf3940c['query']);_0x4feea0[_0x64f1('0x44')]=_[_0x64f1('0x43')](_0xf3940c[_0x64f1('0x3f')],qs[_0x64f1('0x52')](_0x4e2fcf[_0x64f1('0x40')][_0x64f1('0x52')]));_0x4feea0[_0x64f1('0x44')]=_0x4feea0['attributes'][_0x64f1('0x45')]?_0x4feea0[_0x64f1('0x44')]:_0xf3940c[_0x64f1('0x3f')];if(!_0x4e2fcf['query']['hasOwnProperty'](_0x64f1('0x47'))){_0x4feea0[_0x64f1('0x2d')]=qs[_0x64f1('0x2d')](_0x4e2fcf[_0x64f1('0x40')][_0x64f1('0x2d')]);_0x4feea0['offset']=qs[_0x64f1('0x2a')](_0x4e2fcf[_0x64f1('0x40')][_0x64f1('0x2a')]);}_0x4feea0[_0x64f1('0x48')]=qs['sort'](_0x4e2fcf[_0x64f1('0x40')][_0x64f1('0x49')]);_0x4feea0[_0x64f1('0x4a')]=qs[_0x64f1('0x42')](_[_0x64f1('0x63')](_0x4e2fcf[_0x64f1('0x40')],_0xf3940c['filters']));_0x4feea0['where'][_0x64f1('0x64')]=_0x1e0d87['id'];if(_0x4e2fcf['query']['filter']){_0x4feea0[_0x64f1('0x4a')]=_['merge'](_0x4feea0[_0x64f1('0x4a')],{'$or':_[_0x64f1('0x3a')](_0x4feea0[_0x64f1('0x44')],function(_0x5c4d43){var _0x1d111f={};_0x1d111f[_0x5c4d43]={'$like':'%'+_0x4e2fcf['query'][_0x64f1('0x65')]+'%'};return _0x1d111f;})});}_0x4feea0=_[_0x64f1('0x4b')]({},_0x4feea0,_0x4e2fcf['options']);return db['Disposition']['count']({'where':_0x4feea0[_0x64f1('0x4a')]})[_0x64f1('0x1e')](function(_0x210b21){_0x3f645b[_0x64f1('0x2c')]=_0x210b21;if(_0x4e2fcf[_0x64f1('0x40')][_0x64f1('0x66')]){_0x4feea0[_0x64f1('0x53')]=[{'all':!![]}];}return db[_0x64f1('0x62')][_0x64f1('0x4e')](_0x4feea0);})[_0x64f1('0x1e')](function(_0x53540f){_0x3f645b['rows']=_0x53540f;return _0x3f645b;});}})[_0x64f1('0x1e')](respondWithFilteredResult(_0x2a7916,_0x4feea0))[_0x64f1('0x26')](handleError(_0x2a7916,null));};exports[_0x64f1('0x67')]=function(_0x3b3d27,_0xe2e730,_0x2082e1){return db['OpenchannelAccount'][_0x64f1('0x54')]({'where':{'id':_0x3b3d27[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0xe2e730,null))['then'](function(_0x13724c){if(_0x13724c){return _0x13724c[_0x64f1('0x67')](_0x3b3d27['query'][_0x64f1('0x68')]);}})['then'](respondWithStatusCode(_0xe2e730,null))[_0x64f1('0x26')](handleError(_0xe2e730,null));};exports[_0x64f1('0x69')]=function(_0x2b57c0,_0x3ed4e4,_0xd3e541){if(_0x2b57c0[_0x64f1('0x56')]['id']){delete _0x2b57c0[_0x64f1('0x56')]['id'];}return db[_0x64f1('0x3b')][_0x64f1('0x54')]({'where':{'id':_0x2b57c0[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x3ed4e4,null))[_0x64f1('0x1e')](function(_0x1fba2e){if(_0x1fba2e){_0x2b57c0[_0x64f1('0x56')][_0x64f1('0x64')]=_0x1fba2e['id'];return db[_0x64f1('0x6a')][_0x64f1('0x55')](_0x2b57c0[_0x64f1('0x56')]);}})[_0x64f1('0x1e')](respondWithResult(_0x3ed4e4,null))['catch'](handleError(_0x3ed4e4,null));};exports[_0x64f1('0x6b')]=function(_0x15cf9a,_0x25baee,_0x141ba3){var _0x5a16bd={'raw':![],'where':{}};var _0x58cb81={};var _0x58fd1a={'count':0x0,'rows':[]};return db[_0x64f1('0x3b')][_0x64f1('0x61')]({'where':{'id':_0x15cf9a[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x25baee,null))['then'](function(_0x18307d){if(_0x18307d){_0x58cb81[_0x64f1('0x3f')]=_['keys'](db[_0x64f1('0x6a')][_0x64f1('0x3c')]);_0x58cb81[_0x64f1('0x40')]=_['keys'](_0x15cf9a['query']);_0x58cb81[_0x64f1('0x42')]=_[_0x64f1('0x43')](_0x58cb81[_0x64f1('0x3f')],_0x58cb81[_0x64f1('0x40')]);_0x5a16bd[_0x64f1('0x44')]=_['intersection'](_0x58cb81[_0x64f1('0x3f')],qs['fields'](_0x15cf9a[_0x64f1('0x40')][_0x64f1('0x52')]));_0x5a16bd['attributes']=_0x5a16bd[_0x64f1('0x44')][_0x64f1('0x45')]?_0x5a16bd[_0x64f1('0x44')]:_0x58cb81['model'];if(!_0x15cf9a[_0x64f1('0x40')][_0x64f1('0x46')](_0x64f1('0x47'))){_0x5a16bd[_0x64f1('0x2d')]=qs[_0x64f1('0x2d')](_0x15cf9a['query'][_0x64f1('0x2d')]);_0x5a16bd[_0x64f1('0x2a')]=qs[_0x64f1('0x2a')](_0x15cf9a[_0x64f1('0x40')][_0x64f1('0x2a')]);}_0x5a16bd[_0x64f1('0x48')]=qs['sort'](_0x15cf9a['query'][_0x64f1('0x49')]);_0x5a16bd[_0x64f1('0x4a')]=qs[_0x64f1('0x42')](_[_0x64f1('0x63')](_0x15cf9a[_0x64f1('0x40')],_0x58cb81[_0x64f1('0x42')]));_0x5a16bd[_0x64f1('0x4a')][_0x64f1('0x64')]=_0x18307d['id'];if(_0x15cf9a[_0x64f1('0x40')][_0x64f1('0x65')]){_0x5a16bd[_0x64f1('0x4a')]=_[_0x64f1('0x4b')](_0x5a16bd['where'],{'$or':_[_0x64f1('0x3a')](_0x5a16bd[_0x64f1('0x44')],function(_0x25bd61){var _0x4ad3be={};_0x4ad3be[_0x25bd61]={'$like':'%'+_0x15cf9a[_0x64f1('0x40')][_0x64f1('0x65')]+'%'};return _0x4ad3be;})});}_0x5a16bd=_[_0x64f1('0x4b')]({},_0x5a16bd,_0x15cf9a[_0x64f1('0x4d')]);return db[_0x64f1('0x6a')]['count']({'where':_0x5a16bd[_0x64f1('0x4a')]})[_0x64f1('0x1e')](function(_0x496eb6){_0x58fd1a[_0x64f1('0x2c')]=_0x496eb6;if(_0x15cf9a[_0x64f1('0x40')][_0x64f1('0x66')]){_0x5a16bd[_0x64f1('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5a16bd);})['then'](function(_0x177471){_0x58fd1a[_0x64f1('0x4f')]=_0x177471;return _0x58fd1a;});}})['then'](respondWithFilteredResult(_0x25baee,_0x5a16bd))[_0x64f1('0x26')](handleError(_0x25baee,null));};exports[_0x64f1('0x6c')]=function(_0x5cb6c6,_0x1f2f5c,_0xbee17e){return db[_0x64f1('0x3b')][_0x64f1('0x54')]({'where':{'id':_0x5cb6c6['params']['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x1f2f5c,null))[_0x64f1('0x1e')](function(_0x471445){if(_0x471445){return _0x471445[_0x64f1('0x6c')](_0x5cb6c6[_0x64f1('0x40')][_0x64f1('0x68')]);}})[_0x64f1('0x1e')](respondWithStatusCode(_0x1f2f5c,null))['catch'](handleError(_0x1f2f5c,null));};exports[_0x64f1('0x6d')]=function(_0x1a2d3b,_0x1e7d8b,_0x339868){var _0x57f1bf={'body':_0x1a2d3b['body'],'channel':_0x64f1('0x6e')};var _0x3647a9=[];var _0x12436c=[];var _0xbff7bd={};var _0x49d728=![];return db[_0x64f1('0x6f')][_0x64f1('0x5f')]()[_0x64f1('0x1e')](function(_0x566ee8){if(!_0x566ee8){throw new db[(_0x64f1('0x70'))][(_0x64f1('0x71'))](_0x64f1('0x72'));}_0x3647a9=_['difference'](_[_0x64f1('0x41')](_0x566ee8),['createdAt',_0x64f1('0x73')]);_0x12436c=_[_0x64f1('0x74')](_['keys'](_0x566ee8),[_0x64f1('0x75'),'updatedAt',_0x64f1('0x76'),'ListId']);if(_0x1a2d3b['body']['id']){delete _0x1a2d3b[_0x64f1('0x56')]['id'];}if(_[_0x64f1('0x77')](_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x78')])){throw new db[(_0x64f1('0x70'))][(_0x64f1('0x71'))](_0x64f1('0x79'));}if(_[_0x64f1('0x77')](_0x1a2d3b[_0x64f1('0x56')]['body'])||_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x56')]===''){throw new db['Sequelize']['ValidationError'](_0x64f1('0x7a'));}if(_[_0x64f1('0x77')](_0x1a2d3b['body'][_0x64f1('0x7b')])){throw new db['Sequelize'][(_0x64f1('0x71'))](_0x64f1('0x7c')+_0x12436c);}if(!_['includes'](_0x12436c,_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x7b')])){throw new db[(_0x64f1('0x70'))]['ValidationError'](_0x64f1('0x7d')+_0x12436c);}_0xbff7bd[_0x1a2d3b['body'][_0x64f1('0x7b')]]=_0x1a2d3b['body'][_0x64f1('0x78')];})[_0x64f1('0x1e')](function(){return db['OpenchannelAccount'][_0x64f1('0x54')]({'where':{'id':_0x1a2d3b[_0x64f1('0x51')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x64f1('0x7e'),'where':_0xbff7bd,'limit':0x1,'order':[['updatedAt',_0x64f1('0x7f')]]}]},{'model':db[_0x64f1('0x80')],'as':_0x64f1('0x81')}]});})[_0x64f1('0x1e')](handleEntityNotFound(_0x1e7d8b,null))[_0x64f1('0x1e')](function(_0x3bc7b7){if(_0x3bc7b7&&_0x3bc7b7[_0x64f1('0x82')]){_0x57f1bf[_0x64f1('0x83')]=_0x3bc7b7;_0x57f1bf[_0x64f1('0x84')]=_0x3bc7b7[_0x64f1('0x81')];_0x57f1bf[_0x64f1('0x85')]=_0x3bc7b7[_0x64f1('0x82')];_0x57f1bf[_0x64f1('0x84')]=_[_0x64f1('0x86')](_0x57f1bf[_0x64f1('0x84')],[_0x64f1('0x87')],[_0x64f1('0x88')]);if(_0x57f1bf[_0x64f1('0x83')][_0x64f1('0x81')]){delete _0x57f1bf[_0x64f1('0x83')][_0x64f1('0x81')];}if(_0x57f1bf['account'][_0x64f1('0x82')]&&_0x57f1bf[_0x64f1('0x83')][_0x64f1('0x82')][_0x64f1('0x7e')][_0x64f1('0x45')]){return _0x57f1bf['account'][_0x64f1('0x82')][_0x64f1('0x7e')][0x0];}var _0x52bb9f=_[_0x64f1('0x89')](_0x1a2d3b[_0x64f1('0x56')],{'firstName':_0x1a2d3b['body'][_0x64f1('0x78')],'ListId':_0x3bc7b7['ListId']});_0x52bb9f[_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x7b')]]=_0x1a2d3b[_0x64f1('0x56')]['from'];return db[_0x64f1('0x6f')][_0x64f1('0x55')](_0x52bb9f,{'fields':_0x3647a9,'raw':!![]});}})['then'](handleEntityNotFound(_0x1e7d8b,null))[_0x64f1('0x1e')](function(_0x45ac5f){_0x57f1bf[_0x64f1('0x8a')]=_0x45ac5f;if(_0x45ac5f){var _0x394ee7={'ContactId':_0x45ac5f['id'],'OpenchannelAccountId':_0x1a2d3b[_0x64f1('0x51')]['id'],'from':(_0x45ac5f[_0x64f1('0x8b')]||'')+'\x20'+(_0x45ac5f['lastName']||'')};var _0x5d6c58={'OpenchannelAccountId':_0x1a2d3b[_0x64f1('0x51')]['id'],'closed':![]};if(_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x8c')]){_0x5d6c58[_0x64f1('0x8c')]=_0x1a2d3b['body'][_0x64f1('0x8c')];return db['OpenchannelInteraction']['find']({'where':_0x5d6c58})[_0x64f1('0x1e')](function(_0x523328){if(_0x523328){return[_0x523328,![]];}_0x394ee7['threadId']=_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x8c')];_0x394ee7[_0x64f1('0x8d')]=_0x1a2d3b['body'][_0x64f1('0x8d')];return db[_0x64f1('0x8e')]['create'](_0x394ee7)[_0x64f1('0x1e')](function(_0x44950b){return[_0x44950b,!![]];});});}else{_0x5d6c58[_0x64f1('0x8c')]=null;}_0x5d6c58['ContactId']=_0x45ac5f['id'];return db[_0x64f1('0x8e')]['find']({'where':_0x5d6c58})[_0x64f1('0x1e')](function(_0x1b7e6a){if(_0x1b7e6a){return[_0x1b7e6a,![]];}return db[_0x64f1('0x8e')][_0x64f1('0x55')](_0x394ee7)['then'](function(_0x574767){return[_0x574767,!![]];});});}})['spread'](function(_0x4d9961,_0x2e4094){if(_0x4d9961){_0x49d728=_0x2e4094;if(!_0x2e4094){var _0x61daf5={'from':(_0x57f1bf[_0x64f1('0x8a')][_0x64f1('0x8b')]||'')+'\x20'+(_0x57f1bf['contact'][_0x64f1('0x8f')]||'')};if(_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x8c')]&&_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x90')]&&_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x8c')]!=_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x90')]){_0x61daf5[_0x64f1('0x8c')]=_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x90')];}return _0x4d9961['update'](_0x61daf5);}else{return _0x4d9961;}}})[_0x64f1('0x1e')](function(_0x305f48){_0x57f1bf[_0x64f1('0x91')]=_0x305f48[_0x64f1('0x33')]({'plain':!![]});_0x57f1bf[_0x64f1('0x91')][_0x64f1('0x92')]=_0x49d728;if(_0x57f1bf['interaction']['created']){if(_0x57f1bf['account'][_0x64f1('0x93')]){_0x57f1bf[_0x64f1('0x84')][_0x64f1('0x94')]({'id':0x0,'priority':_0x57f1bf[_0x64f1('0x84')][_0x64f1('0x45')]+0x1,'app':'close','appdata':_0x64f1('0x95'),'interval':_0x64f1('0x96')});}}return db[_0x64f1('0x97')]['create']({'body':_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x56')],'OpenchannelAccountId':_0x1a2d3b[_0x64f1('0x51')]['id'],'OpenchannelInteractionId':_0x305f48['id'],'direction':'in','ContactId':_0x57f1bf['contact']['id'],'AttachmentId':_0x1a2d3b[_0x64f1('0x56')][_0x64f1('0x98')]});})['then'](function(_0x49ded3){_0x57f1bf[_0x64f1('0x25')]=_0x49ded3;if(_0x57f1bf[_0x64f1('0x91')][_0x64f1('0x99')]){return db[_0x64f1('0x9a')]['find']({'attributes':['id',_0x64f1('0x36')],'where':{'id':_0x57f1bf[_0x64f1('0x91')]['UserId']}})['then'](function(_0x4fc61c){if(_0x4fc61c){_0x57f1bf[_0x64f1('0x84')][_0x64f1('0x9b')]({'id':0x0,'priority':0x0,'app':_0x64f1('0x9c'),'appdata':_0x4fc61c[_0x64f1('0x36')]+','+(_0x57f1bf['account'][_0x64f1('0x9d')]||0xa),'interval':_0x64f1('0x96')});_0x57f1bf[_0x64f1('0x9e')]=![];}return respondWithRpcPromise('Start','startRouting',_0x57f1bf);});}return respondWithRpcPromise(_0x64f1('0x9f'),_0x64f1('0xa0'),_0x57f1bf);})[_0x64f1('0x1e')](function(_0x1d8def){respondWithRpcPromise('EventManager',_0x64f1('0xa1'),{'event':_0x64f1('0x6d'),'message':_0x1d8def},client9002);return _0x1d8def;})[_0x64f1('0x1e')](respondWithResult(_0x1e7d8b,null))[_0x64f1('0x26')](handleError(_0x1e7d8b,null));};exports[_0x64f1('0xa2')]=function(_0x2b734d,_0x53b2d6){var _0x109498=_0x2b734d[_0x64f1('0x51')]['id'];var _0x502ce2=_0x2b734d[_0x64f1('0x56')];var _0x5a6576=0xc8;var _0x4b0b8e=null;return db[_0x64f1('0xa3')][_0x64f1('0xa4')]({'isolationLevel':db[_0x64f1('0xa3')][_0x64f1('0xa5')][_0x64f1('0xa6')]['READ_COMMITTED']},function(_0x261a1d){return db[_0x64f1('0x3b')][_0x64f1('0x61')]({'where':{'id':_0x109498},'transaction':_0x261a1d})[_0x64f1('0x1e')](function(_0x3199b7){if(_0x3199b7){return db['OpenchannelApplication'][_0x64f1('0x32')]({'where':{'OpenchannelAccountId':_0x109498},'transaction':_0x261a1d})[_0x64f1('0x1e')](function(){var _0x3f825a=_[_0x64f1('0x3a')](_0x502ce2,function(_0xf1ae7a){_0xf1ae7a['OpenchannelAccountId']=_0x109498;return _0xf1ae7a;});return db['OpenchannelApplication']['bulkCreate'](_0x3f825a,{'transaction':_0x261a1d});});}else{_0x5a6576=0x194;_0x4b0b8e=[];}});})[_0x64f1('0x1e')](function(){if(_0x5a6576!==0x194){return db['OpenchannelApplication'][_0x64f1('0xa7')]({'where':{'OpenchannelAccountId':_0x109498},'order':'priority'})['then'](function(_0x6f7d22){_0x4b0b8e=_0x6f7d22;});}})[_0x64f1('0x26')](function(_0x3aca54){_0x5a6576=0x1f4;logger[_0x64f1('0x22')](_0x3aca54[_0x64f1('0x35')]);if(_0x3aca54[_0x64f1('0x36')]){delete _0x3aca54[_0x64f1('0x36')];}_0x4b0b8e=_0x3aca54;})[_0x64f1('0xa8')](function(){if(_0x4b0b8e===null){_0x53b2d6[_0x64f1('0x27')](_0x5a6576);}else{if(_0x5a6576===0x1f4){_0x53b2d6[_0x64f1('0x28')](_0x5a6576)['send'](_0x4b0b8e);}else{_0x53b2d6[_0x64f1('0x28')](_0x5a6576)[_0x64f1('0x29')](_0x4b0b8e);}}});};exports[_0x64f1('0xa9')]=function(_0x36f700,_0x2d8d3f,_0x180d1f){var _0x3f1ffa={};var _0x1967e6={};var _0x8fee8b;var _0x19934c;return db[_0x64f1('0x3b')][_0x64f1('0x61')]({'where':{'id':_0x36f700[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x2d8d3f,null))[_0x64f1('0x1e')](function(_0x2638b9){if(_0x2638b9){_0x8fee8b=_0x2638b9;_0x1967e6[_0x64f1('0x3f')]=_[_0x64f1('0x41')](db[_0x64f1('0x80')][_0x64f1('0x3c')]);_0x1967e6['query']=_[_0x64f1('0x41')](_0x36f700[_0x64f1('0x40')]);_0x1967e6[_0x64f1('0x42')]=_['intersection'](_0x1967e6[_0x64f1('0x3f')],_0x1967e6[_0x64f1('0x40')]);_0x3f1ffa[_0x64f1('0x44')]=_[_0x64f1('0x43')](_0x1967e6[_0x64f1('0x3f')],qs[_0x64f1('0x52')](_0x36f700['query'][_0x64f1('0x52')]));_0x3f1ffa[_0x64f1('0x44')]=_0x3f1ffa[_0x64f1('0x44')][_0x64f1('0x45')]?_0x3f1ffa[_0x64f1('0x44')]:_0x1967e6[_0x64f1('0x3f')];_0x3f1ffa['order']=qs[_0x64f1('0x49')](_0x36f700[_0x64f1('0x40')][_0x64f1('0x49')]);_0x3f1ffa[_0x64f1('0x4a')]=qs[_0x64f1('0x42')](_[_0x64f1('0x63')](_0x36f700['query'],_0x1967e6[_0x64f1('0x42')]));if(_0x36f700[_0x64f1('0x40')][_0x64f1('0x65')]){_0x3f1ffa[_0x64f1('0x4a')]=_[_0x64f1('0x4b')](_0x3f1ffa['where'],{'$or':_[_0x64f1('0x3a')](_0x3f1ffa[_0x64f1('0x44')],function(_0xdba269){var _0x31ef1a={};_0x31ef1a[_0xdba269]={'$like':'%'+_0x36f700['query'][_0x64f1('0x65')]+'%'};return _0x31ef1a;})});}_0x3f1ffa=_[_0x64f1('0x4b')]({},_0x3f1ffa,_0x36f700[_0x64f1('0x4d')]);return _0x8fee8b[_0x64f1('0xa9')](_0x3f1ffa);}})[_0x64f1('0x1e')](function(_0x437db8){if(_0x437db8){_0x19934c=_0x437db8[_0x64f1('0x45')];if(!_0x36f700[_0x64f1('0x40')][_0x64f1('0x46')](_0x64f1('0x47'))){_0x3f1ffa[_0x64f1('0x2d')]=qs[_0x64f1('0x2d')](_0x36f700[_0x64f1('0x40')][_0x64f1('0x2d')]);_0x3f1ffa[_0x64f1('0x2a')]=qs[_0x64f1('0x2a')](_0x36f700[_0x64f1('0x40')][_0x64f1('0x2a')]);}return _0x8fee8b[_0x64f1('0xa9')](_0x3f1ffa);}})[_0x64f1('0x1e')](function(_0x22d1dd){if(_0x22d1dd){return _0x22d1dd?{'count':_0x19934c,'rows':_0x22d1dd}:null;}})[_0x64f1('0x1e')](respondWithResult(_0x2d8d3f,null))[_0x64f1('0x26')](handleError(_0x2d8d3f,null));};exports[_0x64f1('0xaa')]=function(_0x1c7396,_0x77e06c,_0x2ca6d6){var _0x560d76={'raw':![],'where':{}};var _0x3e766d={};var _0x17e8c5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x64f1('0x61')]({'where':{'id':_0x1c7396[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x77e06c,null))['then'](function(_0x54fc48){if(_0x54fc48){_0x3e766d[_0x64f1('0x3f')]=_[_0x64f1('0x41')](db[_0x64f1('0x8e')]['rawAttributes']);_0x3e766d[_0x64f1('0x40')]=_[_0x64f1('0x41')](_0x1c7396[_0x64f1('0x40')]);_0x3e766d[_0x64f1('0x42')]=_[_0x64f1('0x43')](_0x3e766d[_0x64f1('0x3f')],_0x3e766d[_0x64f1('0x40')]);_0x560d76[_0x64f1('0x44')]=_[_0x64f1('0x43')](_0x3e766d[_0x64f1('0x3f')],qs[_0x64f1('0x52')](_0x1c7396[_0x64f1('0x40')][_0x64f1('0x52')]));_0x560d76[_0x64f1('0x44')]=_0x560d76[_0x64f1('0x44')][_0x64f1('0x45')]?_0x560d76[_0x64f1('0x44')]:_0x3e766d[_0x64f1('0x3f')];if(!_0x1c7396['query'][_0x64f1('0x46')](_0x64f1('0x47'))){_0x560d76[_0x64f1('0x2d')]=qs['limit'](_0x1c7396[_0x64f1('0x40')][_0x64f1('0x2d')]);_0x560d76['offset']=qs['offset'](_0x1c7396['query'][_0x64f1('0x2a')]);}_0x560d76['order']=qs[_0x64f1('0x49')](_0x1c7396['query']['sort']);_0x560d76[_0x64f1('0x4a')]=qs[_0x64f1('0x42')](_[_0x64f1('0x63')](_0x1c7396[_0x64f1('0x40')],_0x3e766d[_0x64f1('0x42')]));_0x560d76[_0x64f1('0x4a')][_0x64f1('0x64')]=_0x54fc48['id'];if(_0x1c7396[_0x64f1('0x40')][_0x64f1('0x65')]){_0x560d76['where']=_[_0x64f1('0x4b')](_0x560d76['where'],{'$or':_[_0x64f1('0x3a')](_0x560d76[_0x64f1('0x44')],function(_0x135199){var _0x2b4b57={};_0x2b4b57[_0x135199]={'$like':'%'+_0x1c7396[_0x64f1('0x40')][_0x64f1('0x65')]+'%'};return _0x2b4b57;})});}_0x560d76=_[_0x64f1('0x4b')]({},_0x560d76,_0x1c7396[_0x64f1('0x4d')]);return db[_0x64f1('0x8e')][_0x64f1('0x2c')]({'where':_0x560d76[_0x64f1('0x4a')]})[_0x64f1('0x1e')](function(_0x5ed8b3){_0x17e8c5[_0x64f1('0x2c')]=_0x5ed8b3;if(_0x1c7396[_0x64f1('0x40')][_0x64f1('0x66')]){_0x560d76[_0x64f1('0x53')]=[{'model':db[_0x64f1('0x6f')],'as':_0x64f1('0xab'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x64f1('0x36'),_0x64f1('0xac'),_0x64f1('0xad')],'required':![]},{'model':db['Tag'],'as':_0x64f1('0xae'),'attributes':['id','name',_0x64f1('0xaf')],'where':_0x1c7396[_0x64f1('0x40')][_0x64f1('0xb0')]?{'id':_0x1c7396[_0x64f1('0x40')]['tag']}:undefined,'required':_0x1c7396[_0x64f1('0x40')][_0x64f1('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x64f1('0x4e')](_0x560d76);})[_0x64f1('0x1e')](function(_0x5cee05){_0x17e8c5[_0x64f1('0x4f')]=_0x5cee05;return _0x17e8c5;});}})[_0x64f1('0x1e')](respondWithFilteredResult(_0x77e06c,_0x560d76))[_0x64f1('0x26')](handleError(_0x77e06c,null));};exports[_0x64f1('0xb1')]=function(_0x205c4e,_0xf71933,_0x4d7b4b){return db['OpenchannelAccount']['find']({'where':{'id':_0x205c4e['params']['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0xf71933,null))['then'](function(_0x54ef63){if(_0x54ef63){return _0x54ef63[_0x64f1('0xb1')](_0x205c4e[_0x64f1('0x56')]['ids'],_[_0x64f1('0xb2')](_0x205c4e[_0x64f1('0x56')],[_0x64f1('0x68'),'id'])||{})[_0x64f1('0xb3')](function(_0x5df703){for(var _0x55cabe=0x0;_0x55cabe<_0x205c4e['body'][_0x64f1('0x68')]['length'];_0x55cabe+=0x1){socket['emit'](_0x64f1('0xb4'),{'UserId':Number(_0x205c4e['body']['ids'][_0x55cabe]),'OpenchannelAccountId':Number(_0x205c4e[_0x64f1('0x51')]['id'])});}return _0x5df703;});}})[_0x64f1('0x1e')](respondWithResult(_0xf71933,null))[_0x64f1('0x26')](handleError(_0xf71933,null));};exports[_0x64f1('0xb5')]=function(_0x4d195c,_0x437e04,_0x10ebb6){return db[_0x64f1('0x3b')]['find']({'where':{'id':_0x4d195c[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x437e04,null))[_0x64f1('0x1e')](function(_0x1bbb6f){if(_0x1bbb6f){return _0x1bbb6f[_0x64f1('0xb5')](_0x4d195c['query'][_0x64f1('0x68')])[_0x64f1('0x1e')](function(){if(_[_0x64f1('0xb6')](_0x4d195c['query']['ids'])){for(var _0x564a0a=0x0;_0x564a0a<_0x4d195c[_0x64f1('0x40')][_0x64f1('0x68')][_0x64f1('0x45')];_0x564a0a+=0x1){socket[_0x64f1('0xb7')](_0x64f1('0xb8'),{'UserId':Number(_0x4d195c[_0x64f1('0x40')][_0x64f1('0x68')][_0x564a0a]),'OpenchannelAccountId':Number(_0x4d195c[_0x64f1('0x51')]['id'])});}}else{socket['emit'](_0x64f1('0xb8'),{'UserId':Number(_0x4d195c[_0x64f1('0x40')][_0x64f1('0x68')]),'OpenchannelAccountId':Number(_0x4d195c[_0x64f1('0x51')]['id'])});}});}})[_0x64f1('0x1e')](respondWithStatusCode(_0x437e04,null))[_0x64f1('0x26')](handleError(_0x437e04,null));};exports[_0x64f1('0xb9')]=function(_0x126dec,_0x180629,_0xab5536){var _0x48d57f={};var _0x17a07b={};var _0x2f08f8;var _0x2366f5;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x126dec[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x180629,null))[_0x64f1('0x1e')](function(_0x5b5f9b){if(_0x5b5f9b){_0x2f08f8=_0x5b5f9b;_0x17a07b['model']=_[_0x64f1('0x41')](db[_0x64f1('0x9a')][_0x64f1('0x3c')]);_0x17a07b[_0x64f1('0x40')]=_[_0x64f1('0x41')](_0x126dec[_0x64f1('0x40')]);_0x17a07b[_0x64f1('0x42')]=_[_0x64f1('0x43')](_0x17a07b[_0x64f1('0x3f')],_0x17a07b['query']);_0x48d57f[_0x64f1('0x44')]=_['intersection'](_0x17a07b[_0x64f1('0x3f')],qs['fields'](_0x126dec[_0x64f1('0x40')]['fields']));_0x48d57f[_0x64f1('0x44')]=_0x48d57f[_0x64f1('0x44')][_0x64f1('0x45')]?_0x48d57f['attributes']:_0x17a07b[_0x64f1('0x3f')];_0x48d57f['order']=qs[_0x64f1('0x49')](_0x126dec[_0x64f1('0x40')][_0x64f1('0x49')]);_0x48d57f[_0x64f1('0x4a')]=qs[_0x64f1('0x42')](_['pick'](_0x126dec['query'],_0x17a07b[_0x64f1('0x42')]));if(_0x126dec[_0x64f1('0x40')][_0x64f1('0x65')]){_0x48d57f[_0x64f1('0x4a')]=_[_0x64f1('0x4b')](_0x48d57f[_0x64f1('0x4a')],{'$or':_[_0x64f1('0x3a')](_0x48d57f['attributes'],function(_0x1413fd){var _0x375db8={};_0x375db8[_0x1413fd]={'$like':'%'+_0x126dec[_0x64f1('0x40')][_0x64f1('0x65')]+'%'};return _0x375db8;})});}_0x48d57f=_[_0x64f1('0x4b')]({},_0x48d57f,_0x126dec[_0x64f1('0x4d')]);return _0x2f08f8['getAgents'](_0x48d57f);}})[_0x64f1('0x1e')](function(_0x5489e7){if(_0x5489e7){_0x2366f5=_0x5489e7[_0x64f1('0x45')];if(!_0x126dec[_0x64f1('0x40')][_0x64f1('0x46')](_0x64f1('0x47'))){_0x48d57f['limit']=qs[_0x64f1('0x2d')](_0x126dec[_0x64f1('0x40')][_0x64f1('0x2d')]);_0x48d57f[_0x64f1('0x2a')]=qs[_0x64f1('0x2a')](_0x126dec[_0x64f1('0x40')][_0x64f1('0x2a')]);}return _0x2f08f8[_0x64f1('0xb9')](_0x48d57f);}})[_0x64f1('0x1e')](function(_0x267c6b){if(_0x267c6b){return _0x267c6b?{'count':_0x2366f5,'rows':_0x267c6b}:null;}})[_0x64f1('0x1e')](respondWithResult(_0x180629,null))[_0x64f1('0x26')](handleError(_0x180629,null));};exports[_0x64f1('0xba')]=function(_0x4a872a,_0x10ed49,_0x598021){var _0x563f9f,_0x59e1ec,_0x5725df;if(_['isNil'](_0x4a872a[_0x64f1('0x56')][_0x64f1('0x56')])||_0x4a872a[_0x64f1('0x56')][_0x64f1('0x56')]===''){throw new db[(_0x64f1('0x70'))][(_0x64f1('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x64f1('0x77')](_0x4a872a[_0x64f1('0x56')]['to'])){}_0x563f9f=_0x4a872a['body']['to'];return db[_0x64f1('0x3b')][_0x64f1('0x61')]({'where':{'id':_0x4a872a[_0x64f1('0x51')]['id']}})[_0x64f1('0x1e')](handleEntityNotFound(_0x10ed49,null))[_0x64f1('0x1e')](function(_0x321ca2){if(_0x321ca2){return db[_0x64f1('0x3b')][_0x64f1('0x54')]({'where':{'id':_0x321ca2['id']},'include':[{'model':db[_0x64f1('0xbb')],'as':'List','include':[{'model':db['CmContact'],'as':_0x64f1('0x7e'),'where':{[_0x321ca2[_0x64f1('0x7b')]]:_0x563f9f},'limit':0x1,'order':[[_0x64f1('0x73'),_0x64f1('0x7f')]]}]}]})[_0x64f1('0x1e')](handleEntityNotFound(_0x10ed49,null))[_0x64f1('0x1e')](function(_0x5d4975){if(_0x5d4975&&_0x5d4975[_0x64f1('0x82')]){_0x59e1ec=_0x5d4975[_0x64f1('0x33')]({'plain':!![]});if(_0x59e1ec[_0x64f1('0x82')]&&_0x59e1ec[_0x64f1('0x82')][_0x64f1('0x7e')][_0x64f1('0x45')]){return _0x59e1ec[_0x64f1('0x82')]['Contacts'][0x0];}return db[_0x64f1('0x6f')][_0x64f1('0x55')](_[_0x64f1('0x89')](_0x4a872a[_0x64f1('0x56')],{'firstName':_0x563f9f,[_0x5d4975[_0x64f1('0x7b')]]:_0x563f9f,'phone':_0x563f9f,'ListId':_0x59e1ec['ListId']}));}})[_0x64f1('0x1e')](handleEntityNotFound(_0x10ed49,null))['then'](function(_0xcfd326){if(_0xcfd326){_0x5725df=_0xcfd326;return db[_0x64f1('0x8e')]['find']({'where':{'ContactId':_0x5725df['id'],'closed':![],'OpenchannelAccountId':_0x59e1ec['id']}})[_0x64f1('0x1e')](function(_0x19932c){if(_0x19932c){return[_0x19932c,![]];}return db['OpenchannelInteraction'][_0x64f1('0x55')]({'UserId':_0x4a872a[_0x64f1('0x57')]['id'],'ContactId':_0x5725df['id'],'OpenchannelAccountId':_0x59e1ec['id'],'lastMsgDirection':_0x64f1('0xbc'),'firstMsgDirection':_0x64f1('0xbc'),'Messages':[_[_0x64f1('0x4b')](_0x4a872a['body'],{'read':![],'body':_0x4a872a['body'][_0x64f1('0x56')],'OpenchannelAccountId':_0x59e1ec['id'],'UserId':_0x4a872a[_0x64f1('0x57')]['id'],'ContactId':_0x5725df['id']})]},{'include':[{'model':db[_0x64f1('0x97')],'as':_0x64f1('0xbd')}]})[_0x64f1('0x1e')](function(_0x56c853){return[_0x56c853,!![]];});});}})[_0x64f1('0xb3')](function(_0x34b4f8,_0xe54787){if(_0xe54787){return _0x34b4f8;}return db[_0x64f1('0x97')][_0x64f1('0x55')](_[_0x64f1('0x4b')](_0x4a872a[_0x64f1('0x56')],{'read':![],'body':_0x4a872a[_0x64f1('0x56')][_0x64f1('0x56')],'OpenchannelAccountId':_0x59e1ec['id'],'OpenchannelInteractionId':_0x34b4f8['id'],'UserId':_0x4a872a[_0x64f1('0x57')]['id'],'ContactId':_0x5725df['id']}))[_0x64f1('0x1e')](function(_0x2ff001){_0x34b4f8[_0x64f1('0xbe')][_0x64f1('0xbd')]=[];_0x34b4f8[_0x64f1('0xbe')]['Messages'][_0x64f1('0x94')](_0x2ff001[_0x64f1('0xbe')]);return _0x34b4f8;});});}})[_0x64f1('0x1e')](respondWithResult(_0x10ed49,null))[_0x64f1('0x26')](handleError(_0x10ed49,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 5780fdd..86a19ef 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 _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb903,0x185));var _0x3b90=function(_0x400b22,_0xaa37e6){_0x400b22=_0x400b22-0x0;var _0x1410a1=_0xb903[_0x400b22];return _0x1410a1;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xda3f,0xec));var _0xfda3=function(_0x3d0aa7,_0x13767e){_0x3d0aa7=_0x3d0aa7-0x0;var _0x1ae109=_0xda3f[_0x3d0aa7];return _0x1ae109;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 9b1474f..c731f1b 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(_0x24d122,_0x325655){var _0x524cd2=function(_0x3e72b5){while(--_0x3e72b5){_0x24d122['push'](_0x24d122['shift']());}};_0x524cd2(++_0x325655);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x206542,_0x2b13fd){var _0x22b7b6=function(_0x32d495){while(--_0x32d495){_0x206542['push'](_0x206542['shift']());}};_0x22b7b6(++_0x2b13fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 fc633aa..4a77ea0 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 _0x6b20=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3a6c17,_0x276e1b){var _0x40c411=function(_0x3f1717){while(--_0x3f1717){_0x3a6c17['push'](_0x3a6c17['shift']());}};_0x40c411(++_0x276e1b);}(_0x6b20,0xd1));var _0x06b2=function(_0x235f1e,_0x27719c){_0x235f1e=_0x235f1e-0x0;var _0x12e98c=_0x6b20[_0x235f1e];return _0x12e98c;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});config[_0x06b2('0xb')]=_[_0x06b2('0xc')](config['redis'],{'host':_0x06b2('0xd'),'port':0x18eb});var socket=require(_0x06b2('0xe'))(new Redis(config[_0x06b2('0xb')]));require('./openchannelAccount.socket')[_0x06b2('0xf')](socket);function respondWithRpcPromise(_0x57f854,_0x2cc28f,_0x4da705){return new BPromise(function(_0x552cd8,_0x301519){return client[_0x06b2('0x10')](_0x57f854,_0x4da705)['then'](function(_0x182f8f){logger[_0x06b2('0x11')](_0x06b2('0x12'),_0x2cc28f,_0x06b2('0x13'));logger[_0x06b2('0x14')](_0x06b2('0x15'),_0x2cc28f,_0x06b2('0x13'),JSON[_0x06b2('0x16')](_0x182f8f));if(_0x182f8f[_0x06b2('0x17')]){if(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x18')]===0x1f4){logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f['error'][_0x06b2('0x19')]);return _0x301519(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f[_0x06b2('0x17')]['message']);return _0x552cd8(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}else{logger['info'](_0x06b2('0x12'),_0x2cc28f,'request\x20sent');_0x552cd8(_0x182f8f['result'][_0x06b2('0x19')]);}})[_0x06b2('0x1a')](function(_0x27852e){logger[_0x06b2('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cc28f,_0x27852e);_0x301519(_0x27852e);});});} \ No newline at end of file +var _0x1c7c=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','request\x20sent'];(function(_0x12e152,_0xddd5b7){var _0x4886d5=function(_0x5065b4){while(--_0x5065b4){_0x12e152['push'](_0x12e152['shift']());}};_0x4886d5(++_0xddd5b7);}(_0x1c7c,0x164));var _0xc1c7=function(_0xc12a0d,_0x7b597a){_0xc12a0d=_0xc12a0d-0x0;var _0x326c1b=_0x1c7c[_0xc12a0d];return _0x326c1b;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});config[_0xc1c7('0xc')]=_[_0xc1c7('0xd')](config[_0xc1c7('0xc')],{'host':_0xc1c7('0xe'),'port':0x18eb});var socket=require(_0xc1c7('0xf'))(new Redis(config[_0xc1c7('0xc')]));require(_0xc1c7('0x10'))[_0xc1c7('0x11')](socket);function respondWithRpcPromise(_0x301abf,_0x25a669,_0x4df577){return new BPromise(function(_0x3b0748,_0x246ced){return client['request'](_0x301abf,_0x4df577)[_0xc1c7('0x12')](function(_0x5ac140){logger[_0xc1c7('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x25a669,_0xc1c7('0x14'));logger[_0xc1c7('0x15')](_0xc1c7('0x16'),_0x25a669,_0xc1c7('0x14'),JSON[_0xc1c7('0x17')](_0x5ac140));if(_0x5ac140[_0xc1c7('0x18')]){if(_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x19')]===0x1f4){logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x1b')]);return _0x246ced(_0x5ac140['error'][_0xc1c7('0x1b')]);}logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x5ac140['error'][_0xc1c7('0x1b')]);return _0x3b0748(_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x1b')]);}else{logger[_0xc1c7('0x13')](_0xc1c7('0x1a'),_0x25a669,_0xc1c7('0x14'));_0x3b0748(_0x5ac140[_0xc1c7('0x1c')][_0xc1c7('0x1b')]);}})['catch'](function(_0x37d748){logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x37d748);_0x246ced(_0x37d748);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 03e5ec6..77fff91 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 _0x3ef0=['length','openchannelAccount:','./openchannelAccount.events','remove','emit','register'];(function(_0x506cbe,_0x818678){var _0x4fdaa7=function(_0x28db18){while(--_0x28db18){_0x506cbe['push'](_0x506cbe['shift']());}};_0x4fdaa7(++_0x818678);}(_0x3ef0,0x19a));var _0x03ef=function(_0x2bcfc8,_0x41618c){_0x2bcfc8=_0x2bcfc8-0x0;var _0x23308d=_0x3ef0[_0x2bcfc8];return _0x23308d;};'use strict';var OpenchannelAccountEvents=require(_0x03ef('0x0'));var events=['save',_0x03ef('0x1'),'update'];function createListener(_0x3ee9a3,_0x5367d2){return function(_0x2aa000){_0x5367d2[_0x03ef('0x2')](_0x3ee9a3,_0x2aa000);};}function removeListener(_0x321d93,_0x5298e7){return function(){OpenchannelAccountEvents['removeListener'](_0x321d93,_0x5298e7);};}exports[_0x03ef('0x3')]=function(_0xadf812){for(var _0x1ea0f9=0x0,_0x47e561=events[_0x03ef('0x4')];_0x1ea0f9<_0x47e561;_0x1ea0f9++){var _0x3c06ee=events[_0x1ea0f9];var _0x2d54e7=createListener(_0x03ef('0x5')+_0x3c06ee,_0xadf812);OpenchannelAccountEvents['on'](_0x3c06ee,_0x2d54e7);}}; \ No newline at end of file +var _0x9b00=['openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener','length'];(function(_0x2adaec,_0x29e57e){var _0x2e22c7=function(_0x14b841){while(--_0x14b841){_0x2adaec['push'](_0x2adaec['shift']());}};_0x2e22c7(++_0x29e57e);}(_0x9b00,0xcc));var _0x09b0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9b00[_0x502c7d];return _0x30b7ed;};'use strict';var OpenchannelAccountEvents=require(_0x09b0('0x0'));var events=[_0x09b0('0x1'),_0x09b0('0x2'),'update'];function createListener(_0x1737fd,_0x2bf951){return function(_0x18bb45){_0x2bf951[_0x09b0('0x3')](_0x1737fd,_0x18bb45);};}function removeListener(_0x405978,_0x3c02c5){return function(){OpenchannelAccountEvents[_0x09b0('0x4')](_0x405978,_0x3c02c5);};}exports['register']=function(_0x79bc56){for(var _0x57b9e0=0x0,_0x20c971=events[_0x09b0('0x5')];_0x57b9e0<_0x20c971;_0x57b9e0++){var _0x396bd6=events[_0x57b9e0];var _0x4290c7=createListener(_0x09b0('0x6')+_0x396bd6,_0x79bc56);OpenchannelAccountEvents['on'](_0x396bd6,_0x4290c7);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8e98e8b..e1de207 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 _0xc0a7=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x77b607,_0x18e6c8){var _0x136258=function(_0x469396){while(--_0x469396){_0x77b607['push'](_0x77b607['shift']());}};_0x136258(++_0x18e6c8);}(_0xc0a7,0x1b3));var _0x7c0a=function(_0x9e31aa,_0x2bf0d3){_0x9e31aa=_0x9e31aa-0x0;var _0x356c46=_0xc0a7[_0x9e31aa];return _0x356c46;};'use strict';var multer=require(_0x7c0a('0x0'));var util=require('util');var path=require(_0x7c0a('0x1'));var timeout=require(_0x7c0a('0x2'));var express=require(_0x7c0a('0x3'));var router=express[_0x7c0a('0x4')]();var fs_extra=require(_0x7c0a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c0a('0x6'));var config=require(_0x7c0a('0x7'));var controller=require(_0x7c0a('0x8'));router[_0x7c0a('0x9')]('/',auth[_0x7c0a('0xa')](),controller[_0x7c0a('0xb')]);router['get'](_0x7c0a('0xc'),auth[_0x7c0a('0xa')](),controller[_0x7c0a('0xd')]);router[_0x7c0a('0xe')]('/',auth['isAuthenticated'](),controller[_0x7c0a('0xf')]);router[_0x7c0a('0x10')](_0x7c0a('0xc'),auth[_0x7c0a('0xa')](),controller[_0x7c0a('0x11')]);router[_0x7c0a('0x12')](_0x7c0a('0xc'),auth[_0x7c0a('0xa')](),controller['destroy']);module[_0x7c0a('0x13')]=router; \ No newline at end of file +var _0x298e=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','update'];(function(_0x1ef08f,_0x5d0be3){var _0x48e2ae=function(_0x3fd840){while(--_0x3fd840){_0x1ef08f['push'](_0x1ef08f['shift']());}};_0x48e2ae(++_0x5d0be3);}(_0x298e,0x1c4));var _0xe298=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x298e[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xe298('0x0'));var util=require(_0xe298('0x1'));var path=require(_0xe298('0x2'));var timeout=require(_0xe298('0x3'));var express=require('express');var router=express[_0xe298('0x4')]();var fs_extra=require(_0xe298('0x5'));var auth=require(_0xe298('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe298('0x7'));var controller=require(_0xe298('0x8'));router[_0xe298('0x9')]('/',auth[_0xe298('0xa')](),controller[_0xe298('0xb')]);router[_0xe298('0x9')](_0xe298('0xc'),auth['isAuthenticated'](),controller[_0xe298('0xd')]);router[_0xe298('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe298('0xc'),auth[_0xe298('0xa')](),controller[_0xe298('0xf')]);router[_0xe298('0x10')](_0xe298('0xc'),auth[_0xe298('0xa')](),controller['destroy']);module[_0xe298('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 059258e..a342c8b 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 _0x0ada=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x53e4a0,_0x205bce){var _0x3d19e0=function(_0x303b8c){while(--_0x303b8c){_0x53e4a0['push'](_0x53e4a0['shift']());}};_0x3d19e0(++_0x205bce);}(_0x0ada,0x10f));var _0xa0ad=function(_0x6dce5e,_0x1fcf30){_0x6dce5e=_0x6dce5e-0x0;var _0x380732=_0x0ada[_0x6dce5e];return _0x380732;};'use strict';var Sequelize=require(_0xa0ad('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa0ad('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa0ad('0x2')],'allowNull':![],'defaultValue':_0xa0ad('0x3')},'appdata':{'type':Sequelize[_0xa0ad('0x4')]()},'description':{'type':Sequelize[_0xa0ad('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa0ad('0x5')}}; \ No newline at end of file +var _0xee53=['exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xee53,0xaf));var _0x3ee5=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0xee53[_0x53afa6];return _0x51f86a;};'use strict';var Sequelize=require('sequelize');module[_0x3ee5('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3ee5('0x1')],'allowNull':![],'defaultValue':_0x3ee5('0x2')},'appdata':{'type':Sequelize[_0x3ee5('0x3')]()},'description':{'type':Sequelize[_0x3ee5('0x1')]},'interval':{'type':Sequelize[_0x3ee5('0x1')],'defaultValue':_0x3ee5('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index acd8453..9669053 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 _0x010f=['reject','save','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','merge','VIRTUAL','where','includeAll','findAll','rows','catch','params','include','options','find','create','body','eml-format','rimraf','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply'];(function(_0x3c1176,_0x4e1850){var _0x52467f=function(_0x10dd03){while(--_0x10dd03){_0x3c1176['push'](_0x3c1176['shift']());}};_0x52467f(++_0x4e1850);}(_0x010f,0x14d));var _0xf010=function(_0x4ee872,_0x506594){_0x4ee872=_0x4ee872-0x0;var _0x51a0ad=_0x010f[_0x4ee872];return _0x51a0ad;};'use strict';var emlformat=require(_0xf010('0x0'));var rimraf=require(_0xf010('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf010('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf010('0x3'));var util=require(_0xf010('0x4'));var path=require(_0xf010('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf010('0x6'));var fs=require('fs');var fs_extra=require(_0xf010('0x7'));var _=require(_0xf010('0x8'));var squel=require(_0xf010('0x9'));var crypto=require('crypto');var jsforce=require(_0xf010('0xa'));var deskjs=require(_0xf010('0xb'));var toCsv=require(_0xf010('0xc'));var querystring=require('querystring');var Papa=require(_0xf010('0xd'));var Redis=require(_0xf010('0xe'));var authService=require(_0xf010('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf010('0x10'));var hardwareService=require(_0xf010('0x11'));var logger=require('../../config/logger')(_0xf010('0x12'));var utils=require(_0xf010('0x13'));var config=require(_0xf010('0x14'));var licenseUtil=require(_0xf010('0x15'));var db=require(_0xf010('0x16'))['db'];function respondWithStatusCode(_0x432a48,_0x875c93){_0x875c93=_0x875c93||0xcc;return function(_0x1ffc55){if(_0x1ffc55){return _0x432a48[_0xf010('0x17')](_0x875c93);}return _0x432a48[_0xf010('0x18')](_0x875c93)['end']();};}function respondWithResult(_0x2bfc28,_0x680fda){_0x680fda=_0x680fda||0xc8;return function(_0x75c548){if(_0x75c548){return _0x2bfc28[_0xf010('0x18')](_0x680fda)[_0xf010('0x19')](_0x75c548);}};}function respondWithFilteredResult(_0x552c1d,_0x3104e7){return function(_0x2d0e13){if(_0x2d0e13){var _0x33f23b=typeof _0x3104e7[_0xf010('0x1a')]==='undefined'&&typeof _0x3104e7[_0xf010('0x1b')]===_0xf010('0x1c');var _0x300219=_0x2d0e13[_0xf010('0x1d')];var _0x489433=_0x33f23b?0x0:_0x3104e7[_0xf010('0x1a')];var _0x78e53b=_0x33f23b?_0x2d0e13[_0xf010('0x1d')]:_0x3104e7[_0xf010('0x1a')]+_0x3104e7[_0xf010('0x1b')];var _0x55334d;if(_0x78e53b>=_0x300219){_0x78e53b=_0x300219;_0x55334d=0xc8;}else{_0x55334d=0xce;}_0x552c1d['status'](_0x55334d);return _0x552c1d['set'](_0xf010('0x1e'),_0x489433+'-'+_0x78e53b+'/'+_0x300219)[_0xf010('0x19')](_0x2d0e13);}return null;};}function patchUpdates(_0xac8856){return function(_0x5247f1){try{jsonpatch[_0xf010('0x1f')](_0x5247f1,_0xac8856,!![]);}catch(_0x3cdf14){return BPromise[_0xf010('0x20')](_0x3cdf14);}return _0x5247f1[_0xf010('0x21')]();};}function saveUpdates(_0x158c6d,_0xc6ee90){return function(_0x2580e0){if(_0x2580e0){return _0x2580e0['update'](_0x158c6d)[_0xf010('0x22')](function(_0x2bf4e1){return _0x2bf4e1;});}return null;};}function removeEntity(_0x312e90,_0x348b17){return function(_0x1d6c16){if(_0x1d6c16){return _0x1d6c16[_0xf010('0x23')]()[_0xf010('0x22')](function(){_0x312e90[_0xf010('0x18')](0xcc)[_0xf010('0x24')]();});}};}function handleEntityNotFound(_0x33053,_0x2a704f){return function(_0x1b19d2){if(!_0x1b19d2){_0x33053['sendStatus'](0x194);}return _0x1b19d2;};}function handleError(_0x1f8531,_0x588d6f){_0x588d6f=_0x588d6f||0x1f4;return function(_0x27541f){logger[_0xf010('0x25')](_0x27541f[_0xf010('0x26')]);if(_0x27541f[_0xf010('0x27')]){delete _0x27541f[_0xf010('0x27')];}_0x1f8531[_0xf010('0x18')](_0x588d6f)[_0xf010('0x28')](_0x27541f);};}exports[_0xf010('0x29')]=function(_0x2dc53a,_0x36a7f6){var _0x3a6cc9={},_0x52cb85={},_0x527782={'count':0x0,'rows':[]};var _0x283b98=_[_0xf010('0x2a')](db[_0xf010('0x2b')][_0xf010('0x2c')],function(_0x2714de){return{'name':_0x2714de['fieldName'],'type':_0x2714de[_0xf010('0x2d')][_0xf010('0x2e')]};});_0x52cb85['model']=_['map'](_0x283b98,_0xf010('0x27'));_0x52cb85[_0xf010('0x2f')]=_[_0xf010('0x30')](_0x2dc53a[_0xf010('0x2f')]);_0x52cb85['filters']=_[_0xf010('0x31')](_0x52cb85[_0xf010('0x32')],_0x52cb85[_0xf010('0x2f')]);_0x3a6cc9[_0xf010('0x33')]=_[_0xf010('0x31')](_0x52cb85[_0xf010('0x32')],qs['fields'](_0x2dc53a[_0xf010('0x2f')][_0xf010('0x34')]));_0x3a6cc9[_0xf010('0x33')]=_0x3a6cc9['attributes'][_0xf010('0x35')]?_0x3a6cc9[_0xf010('0x33')]:_0x52cb85[_0xf010('0x32')];if(!_0x2dc53a[_0xf010('0x2f')][_0xf010('0x36')](_0xf010('0x37'))){_0x3a6cc9['limit']=qs[_0xf010('0x1b')](_0x2dc53a['query'][_0xf010('0x1b')]);_0x3a6cc9[_0xf010('0x1a')]=qs['offset'](_0x2dc53a[_0xf010('0x2f')][_0xf010('0x1a')]);}_0x3a6cc9[_0xf010('0x38')]=qs['sort'](_0x2dc53a[_0xf010('0x2f')]['sort']);_0x3a6cc9['where']=qs[_0xf010('0x39')](_[_0xf010('0x3a')](_0x2dc53a[_0xf010('0x2f')],_0x52cb85['filters']),_0x283b98);if(_0x2dc53a[_0xf010('0x2f')][_0xf010('0x3b')]){_0x3a6cc9['where']=_[_0xf010('0x3c')](_0x3a6cc9['where'],{'$or':_[_0xf010('0x2a')](_0x283b98,function(_0x2e51af){if(_0x2e51af[_0xf010('0x2d')]!==_0xf010('0x3d')){var _0xbd1615={};_0xbd1615[_0x2e51af['name']]={'$like':'%'+_0x2dc53a[_0xf010('0x2f')][_0xf010('0x3b')]+'%'};return _0xbd1615;}})});}_0x3a6cc9=_[_0xf010('0x3c')]({},_0x3a6cc9,_0x2dc53a['options']);var _0x27c74f={'where':_0x3a6cc9[_0xf010('0x3e')]};return db[_0xf010('0x2b')][_0xf010('0x1d')](_0x27c74f)['then'](function(_0x2fc1b1){_0x527782['count']=_0x2fc1b1;if(_0x2dc53a[_0xf010('0x2f')][_0xf010('0x3f')]){_0x3a6cc9['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf010('0x40')](_0x3a6cc9);})[_0xf010('0x22')](function(_0x4d01b7){_0x527782[_0xf010('0x41')]=_0x4d01b7;return _0x527782;})[_0xf010('0x22')](respondWithFilteredResult(_0x36a7f6,_0x3a6cc9))[_0xf010('0x42')](handleError(_0x36a7f6,null));};exports['show']=function(_0x42512d,_0x228b43){var _0xd663af={'raw':!![],'where':{'id':_0x42512d[_0xf010('0x43')]['id']}},_0x868f13={};_0x868f13[_0xf010('0x32')]=_['keys'](db['OpenchannelApplication'][_0xf010('0x2c')]);_0x868f13['query']=_[_0xf010('0x30')](_0x42512d['query']);_0x868f13[_0xf010('0x39')]=_[_0xf010('0x31')](_0x868f13[_0xf010('0x32')],_0x868f13[_0xf010('0x2f')]);_0xd663af[_0xf010('0x33')]=_[_0xf010('0x31')](_0x868f13['model'],qs[_0xf010('0x34')](_0x42512d[_0xf010('0x2f')][_0xf010('0x34')]));_0xd663af[_0xf010('0x33')]=_0xd663af[_0xf010('0x33')][_0xf010('0x35')]?_0xd663af[_0xf010('0x33')]:_0x868f13[_0xf010('0x32')];if(_0x42512d[_0xf010('0x2f')][_0xf010('0x3f')]){_0xd663af[_0xf010('0x44')]=[{'all':!![]}];}_0xd663af=_[_0xf010('0x3c')]({},_0xd663af,_0x42512d[_0xf010('0x45')]);return db['OpenchannelApplication'][_0xf010('0x46')](_0xd663af)[_0xf010('0x22')](handleEntityNotFound(_0x228b43,null))['then'](respondWithResult(_0x228b43,null))[_0xf010('0x42')](handleError(_0x228b43,null));};exports[_0xf010('0x47')]=function(_0x919a29,_0x278f20){return db[_0xf010('0x2b')][_0xf010('0x47')](_0x919a29[_0xf010('0x48')],{})[_0xf010('0x22')](respondWithResult(_0x278f20,0xc9))[_0xf010('0x42')](handleError(_0x278f20,null));};exports['update']=function(_0x6b9aab,_0x1d38b7){if(_0x6b9aab[_0xf010('0x48')]['id']){delete _0x6b9aab[_0xf010('0x48')]['id'];}return db[_0xf010('0x2b')][_0xf010('0x46')]({'where':{'id':_0x6b9aab[_0xf010('0x43')]['id']}})[_0xf010('0x22')](handleEntityNotFound(_0x1d38b7,null))['then'](saveUpdates(_0x6b9aab[_0xf010('0x48')],null))[_0xf010('0x22')](respondWithResult(_0x1d38b7,null))[_0xf010('0x42')](handleError(_0x1d38b7,null));};exports[_0xf010('0x23')]=function(_0xcce7b6,_0x35ed11){return db['OpenchannelApplication'][_0xf010('0x46')]({'where':{'id':_0xcce7b6[_0xf010('0x43')]['id']}})[_0xf010('0x22')](handleEntityNotFound(_0x35ed11,null))['then'](removeEntity(_0x35ed11,null))[_0xf010('0x42')](handleError(_0x35ed11,null));}; \ No newline at end of file +var _0xd334=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelApplication','include','findAll','rows','params','includeAll','find','create','body','catch','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x6d65fb,_0x1cb95b){var _0x526952=function(_0x45f32c){while(--_0x45f32c){_0x6d65fb['push'](_0x6d65fb['shift']());}};_0x526952(++_0x1cb95b);}(_0xd334,0x121));var _0x4d33=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xd334[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4d33('0x0'));var jsonpatch=require(_0x4d33('0x1'));var rp=require(_0x4d33('0x2'));var moment=require('moment');var BPromise=require(_0x4d33('0x3'));var Mustache=require(_0x4d33('0x4'));var util=require(_0x4d33('0x5'));var path=require(_0x4d33('0x6'));var sox=require(_0x4d33('0x7'));var csv=require(_0x4d33('0x8'));var ejs=require(_0x4d33('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d33('0xa'));var squel=require(_0x4d33('0xb'));var crypto=require(_0x4d33('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4d33('0xd'));var toCsv=require(_0x4d33('0x8'));var querystring=require(_0x4d33('0xe'));var Papa=require(_0x4d33('0xf'));var Redis=require(_0x4d33('0x10'));var authService=require(_0x4d33('0x11'));var qs=require(_0x4d33('0x12'));var as=require(_0x4d33('0x13'));var hardwareService=require(_0x4d33('0x14'));var logger=require(_0x4d33('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4d33('0x16'));var licenseUtil=require(_0x4d33('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x188830,_0x5cf3d8){_0x5cf3d8=_0x5cf3d8||0xcc;return function(_0x1f9f56){if(_0x1f9f56){return _0x188830[_0x4d33('0x18')](_0x5cf3d8);}return _0x188830[_0x4d33('0x19')](_0x5cf3d8)[_0x4d33('0x1a')]();};}function respondWithResult(_0x161da6,_0x7b07e4){_0x7b07e4=_0x7b07e4||0xc8;return function(_0x6618e8){if(_0x6618e8){return _0x161da6[_0x4d33('0x19')](_0x7b07e4)['json'](_0x6618e8);}};}function respondWithFilteredResult(_0x34135f,_0x163c9f){return function(_0x2eb44a){if(_0x2eb44a){var _0x560d92=typeof _0x163c9f[_0x4d33('0x1b')]===_0x4d33('0x1c')&&typeof _0x163c9f[_0x4d33('0x1d')]===_0x4d33('0x1c');var _0x6475ed=_0x2eb44a[_0x4d33('0x1e')];var _0x67a4c2=_0x560d92?0x0:_0x163c9f[_0x4d33('0x1b')];var _0x21f04a=_0x560d92?_0x2eb44a[_0x4d33('0x1e')]:_0x163c9f[_0x4d33('0x1b')]+_0x163c9f[_0x4d33('0x1d')];var _0x3adc82;if(_0x21f04a>=_0x6475ed){_0x21f04a=_0x6475ed;_0x3adc82=0xc8;}else{_0x3adc82=0xce;}_0x34135f[_0x4d33('0x19')](_0x3adc82);return _0x34135f[_0x4d33('0x1f')](_0x4d33('0x20'),_0x67a4c2+'-'+_0x21f04a+'/'+_0x6475ed)[_0x4d33('0x21')](_0x2eb44a);}return null;};}function patchUpdates(_0x53cec2){return function(_0x226510){try{jsonpatch['apply'](_0x226510,_0x53cec2,!![]);}catch(_0x56ca60){return BPromise[_0x4d33('0x22')](_0x56ca60);}return _0x226510[_0x4d33('0x23')]();};}function saveUpdates(_0x2cbe66,_0x4341ad){return function(_0x55ea23){if(_0x55ea23){return _0x55ea23[_0x4d33('0x24')](_0x2cbe66)['then'](function(_0x533aaa){return _0x533aaa;});}return null;};}function removeEntity(_0x1678bf,_0xa83f6a){return function(_0x30c7cf){if(_0x30c7cf){return _0x30c7cf[_0x4d33('0x25')]()[_0x4d33('0x26')](function(){_0x1678bf[_0x4d33('0x19')](0xcc)[_0x4d33('0x1a')]();});}};}function handleEntityNotFound(_0x80af1,_0x4ad3a9){return function(_0x895cd2){if(!_0x895cd2){_0x80af1[_0x4d33('0x18')](0x194);}return _0x895cd2;};}function handleError(_0x1b3ef9,_0x3e79a4){_0x3e79a4=_0x3e79a4||0x1f4;return function(_0x2dcf22){logger[_0x4d33('0x27')](_0x2dcf22[_0x4d33('0x28')]);if(_0x2dcf22['name']){delete _0x2dcf22[_0x4d33('0x29')];}_0x1b3ef9[_0x4d33('0x19')](_0x3e79a4)[_0x4d33('0x2a')](_0x2dcf22);};}exports[_0x4d33('0x2b')]=function(_0x51daa9,_0x4ed6f5){var _0x445f04={},_0x4ed5a={},_0x469f8c={'count':0x0,'rows':[]};var _0x21b80d=_[_0x4d33('0x2c')](db['OpenchannelApplication'][_0x4d33('0x2d')],function(_0x302b13){return{'name':_0x302b13['fieldName'],'type':_0x302b13[_0x4d33('0x2e')][_0x4d33('0x2f')]};});_0x4ed5a[_0x4d33('0x30')]=_[_0x4d33('0x2c')](_0x21b80d,'name');_0x4ed5a[_0x4d33('0x31')]=_[_0x4d33('0x32')](_0x51daa9[_0x4d33('0x31')]);_0x4ed5a[_0x4d33('0x33')]=_[_0x4d33('0x34')](_0x4ed5a[_0x4d33('0x30')],_0x4ed5a[_0x4d33('0x31')]);_0x445f04[_0x4d33('0x35')]=_[_0x4d33('0x34')](_0x4ed5a[_0x4d33('0x30')],qs['fields'](_0x51daa9[_0x4d33('0x31')][_0x4d33('0x36')]));_0x445f04[_0x4d33('0x35')]=_0x445f04[_0x4d33('0x35')][_0x4d33('0x37')]?_0x445f04[_0x4d33('0x35')]:_0x4ed5a[_0x4d33('0x30')];if(!_0x51daa9[_0x4d33('0x31')][_0x4d33('0x38')]('nolimit')){_0x445f04[_0x4d33('0x1d')]=qs[_0x4d33('0x1d')](_0x51daa9['query'][_0x4d33('0x1d')]);_0x445f04[_0x4d33('0x1b')]=qs[_0x4d33('0x1b')](_0x51daa9['query'][_0x4d33('0x1b')]);}_0x445f04[_0x4d33('0x39')]=qs[_0x4d33('0x3a')](_0x51daa9[_0x4d33('0x31')][_0x4d33('0x3a')]);_0x445f04[_0x4d33('0x3b')]=qs[_0x4d33('0x33')](_[_0x4d33('0x3c')](_0x51daa9['query'],_0x4ed5a['filters']),_0x21b80d);if(_0x51daa9[_0x4d33('0x31')][_0x4d33('0x3d')]){_0x445f04[_0x4d33('0x3b')]=_['merge'](_0x445f04[_0x4d33('0x3b')],{'$or':_[_0x4d33('0x2c')](_0x21b80d,function(_0x29f079){if(_0x29f079[_0x4d33('0x2e')]!==_0x4d33('0x3e')){var _0x351278={};_0x351278[_0x29f079['name']]={'$like':'%'+_0x51daa9[_0x4d33('0x31')][_0x4d33('0x3d')]+'%'};return _0x351278;}})});}_0x445f04=_[_0x4d33('0x3f')]({},_0x445f04,_0x51daa9[_0x4d33('0x40')]);var _0x22f754={'where':_0x445f04[_0x4d33('0x3b')]};return db[_0x4d33('0x41')]['count'](_0x22f754)[_0x4d33('0x26')](function(_0x5a029c){_0x469f8c[_0x4d33('0x1e')]=_0x5a029c;if(_0x51daa9[_0x4d33('0x31')]['includeAll']){_0x445f04[_0x4d33('0x42')]=[{'all':!![]}];}return db[_0x4d33('0x41')][_0x4d33('0x43')](_0x445f04);})[_0x4d33('0x26')](function(_0x4d9541){_0x469f8c[_0x4d33('0x44')]=_0x4d9541;return _0x469f8c;})[_0x4d33('0x26')](respondWithFilteredResult(_0x4ed6f5,_0x445f04))['catch'](handleError(_0x4ed6f5,null));};exports['show']=function(_0x5d6d91,_0xd605a){var _0x4e4a6c={'raw':!![],'where':{'id':_0x5d6d91[_0x4d33('0x45')]['id']}},_0x3dc786={};_0x3dc786[_0x4d33('0x30')]=_[_0x4d33('0x32')](db[_0x4d33('0x41')]['rawAttributes']);_0x3dc786[_0x4d33('0x31')]=_['keys'](_0x5d6d91['query']);_0x3dc786[_0x4d33('0x33')]=_[_0x4d33('0x34')](_0x3dc786[_0x4d33('0x30')],_0x3dc786[_0x4d33('0x31')]);_0x4e4a6c['attributes']=_[_0x4d33('0x34')](_0x3dc786[_0x4d33('0x30')],qs[_0x4d33('0x36')](_0x5d6d91[_0x4d33('0x31')][_0x4d33('0x36')]));_0x4e4a6c['attributes']=_0x4e4a6c[_0x4d33('0x35')][_0x4d33('0x37')]?_0x4e4a6c['attributes']:_0x3dc786[_0x4d33('0x30')];if(_0x5d6d91[_0x4d33('0x31')][_0x4d33('0x46')]){_0x4e4a6c[_0x4d33('0x42')]=[{'all':!![]}];}_0x4e4a6c=_[_0x4d33('0x3f')]({},_0x4e4a6c,_0x5d6d91[_0x4d33('0x40')]);return db[_0x4d33('0x41')][_0x4d33('0x47')](_0x4e4a6c)[_0x4d33('0x26')](handleEntityNotFound(_0xd605a,null))['then'](respondWithResult(_0xd605a,null))['catch'](handleError(_0xd605a,null));};exports[_0x4d33('0x48')]=function(_0x576ba3,_0x489099){return db[_0x4d33('0x41')][_0x4d33('0x48')](_0x576ba3[_0x4d33('0x49')],{})['then'](respondWithResult(_0x489099,0xc9))['catch'](handleError(_0x489099,null));};exports[_0x4d33('0x24')]=function(_0x17c6ac,_0x5bb107){if(_0x17c6ac[_0x4d33('0x49')]['id']){delete _0x17c6ac[_0x4d33('0x49')]['id'];}return db[_0x4d33('0x41')][_0x4d33('0x47')]({'where':{'id':_0x17c6ac[_0x4d33('0x45')]['id']}})[_0x4d33('0x26')](handleEntityNotFound(_0x5bb107,null))[_0x4d33('0x26')](saveUpdates(_0x17c6ac[_0x4d33('0x49')],null))[_0x4d33('0x26')](respondWithResult(_0x5bb107,null))[_0x4d33('0x4a')](handleError(_0x5bb107,null));};exports['destroy']=function(_0x520bce,_0x981c0d){return db[_0x4d33('0x41')]['find']({'where':{'id':_0x520bce[_0x4d33('0x45')]['id']}})[_0x4d33('0x26')](handleEntityNotFound(_0x981c0d,null))[_0x4d33('0x26')](removeEntity(_0x981c0d,null))[_0x4d33('0x4a')](handleError(_0x981c0d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 229583a..a73493a 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 _0x7d8d=['utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','openchannel_applications','utf8mb4'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0x7d8d,0x18d));var _0xd7d8=function(_0x5e5cd5,_0x184819){_0x5e5cd5=_0x5e5cd5-0x0;var _0x2b266c=_0x7d8d[_0x5e5cd5];return _0x2b266c;};'use strict';var _=require(_0xd7d8('0x0'));var util=require(_0xd7d8('0x1'));var logger=require('../../config/logger')(_0xd7d8('0x2'));var moment=require('moment');var BPromise=require(_0xd7d8('0x3'));var rp=require(_0xd7d8('0x4'));var fs=require('fs');var path=require(_0xd7d8('0x5'));var rimraf=require('rimraf');var config=require(_0xd7d8('0x6'));var attributes=require(_0xd7d8('0x7'));module['exports']=function(_0x10e1ed,_0x1ae12c){return _0x10e1ed['define']('OpenchannelApplication',attributes,{'tableName':_0xd7d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd7d8('0x9'),'collate':_0xd7d8('0xa')});}; \ No newline at end of file +var _0xeb82=['OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x551795,_0x1ef301){var _0xaa8512=function(_0x388d29){while(--_0x388d29){_0x551795['push'](_0x551795['shift']());}};_0xaa8512(++_0x1ef301);}(_0xeb82,0x153));var _0x2eb8=function(_0x4082e3,_0x46da9f){_0x4082e3=_0x4082e3-0x0;var _0x523209=_0xeb82[_0x4082e3];return _0x523209;};'use strict';var _=require(_0x2eb8('0x0'));var util=require(_0x2eb8('0x1'));var logger=require(_0x2eb8('0x2'))('api');var moment=require(_0x2eb8('0x3'));var BPromise=require(_0x2eb8('0x4'));var rp=require(_0x2eb8('0x5'));var fs=require('fs');var path=require(_0x2eb8('0x6'));var rimraf=require(_0x2eb8('0x7'));var config=require(_0x2eb8('0x8'));var attributes=require(_0x2eb8('0x9'));module[_0x2eb8('0xa')]=function(_0x34e781,_0x3a6298){return _0x34e781['define'](_0x2eb8('0xb'),attributes,{'tableName':_0x2eb8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2eb8('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index bad472b..d78a4d8 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 _0xb07f=['raw','attributes','limit','UpdateOpenchannelApplication','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','OpenchannelApplication','update','options'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0xb07f,0x90));var _0xfb07=function(_0x680be8,_0x27ad4f){_0x680be8=_0x680be8-0x0;var _0x5ef590=_0xb07f[_0x680be8];return _0x5ef590;};'use strict';var _=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb07('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb07('0x3'))['db'];var utils=require(_0xfb07('0x4'));var logger=require(_0xfb07('0x5'))('rpc');var config=require(_0xfb07('0x6'));var jayson=require(_0xfb07('0x7'));var client=jayson[_0xfb07('0x8')][_0xfb07('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d51ca,_0x54bfef,_0x42f218){return new BPromise(function(_0x2ed021,_0x528c2f){return client['request'](_0x2d51ca,_0x42f218)[_0xfb07('0xa')](function(_0x4f7e9b){logger[_0xfb07('0xb')](_0xfb07('0xc'),_0x54bfef,'request\x20sent');logger[_0xfb07('0xd')](_0xfb07('0xe'),_0x54bfef,'request\x20sent',JSON[_0xfb07('0xf')](_0x4f7e9b));if(_0x4f7e9b['error']){if(_0x4f7e9b['error'][_0xfb07('0x10')]===0x1f4){logger[_0xfb07('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x54bfef,_0x4f7e9b['error'][_0xfb07('0x12')]);return _0x528c2f(_0x4f7e9b[_0xfb07('0x11')]['message']);}logger['error'](_0xfb07('0xc'),_0x54bfef,_0x4f7e9b[_0xfb07('0x11')][_0xfb07('0x12')]);return _0x2ed021(_0x4f7e9b['error']['message']);}else{logger[_0xfb07('0xb')](_0xfb07('0xc'),_0x54bfef,_0xfb07('0x13'));_0x2ed021(_0x4f7e9b[_0xfb07('0x14')][_0xfb07('0x12')]);}})['catch'](function(_0x219d8c){logger['error'](_0xfb07('0xc'),_0x54bfef,_0x219d8c);_0x528c2f(_0x219d8c);});});}exports['UpdateOpenchannelApplication']=function(_0x5a7d4a){var _0x2ca908=this;return new Promise(function(_0x1f49a7,_0x130740){return db[_0xfb07('0x15')][_0xfb07('0x16')](_0x5a7d4a['body'],{'raw':_0x5a7d4a[_0xfb07('0x17')]?_0x5a7d4a[_0xfb07('0x17')][_0xfb07('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7d4a[_0xfb07('0x17')]?_0x5a7d4a[_0xfb07('0x17')]['where']||null:null,'attributes':_0x5a7d4a[_0xfb07('0x17')]?_0x5a7d4a[_0xfb07('0x17')][_0xfb07('0x19')]||null:null,'limit':_0x5a7d4a[_0xfb07('0x17')]?_0x5a7d4a[_0xfb07('0x17')][_0xfb07('0x1a')]||null:null})[_0xfb07('0xa')](function(_0x429e9e){logger[_0xfb07('0xb')](_0xfb07('0x1b'),_0x5a7d4a);logger[_0xfb07('0xd')](_0xfb07('0x1b'),_0x5a7d4a,JSON['stringify'](_0x429e9e));_0x1f49a7(_0x429e9e);})['catch'](function(_0x1cff1a){logger[_0xfb07('0x11')]('UpdateOpenchannelApplication',_0x1cff1a['message'],_0x5a7d4a);_0x130740(_0x2ca908['error'](0x1f4,_0x1cff1a['message']));});});}; \ No newline at end of file +var _0x31dd=['message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x1fa3eb,_0x338e8b){var _0x38dcb6=function(_0x5e5a18){while(--_0x5e5a18){_0x1fa3eb['push'](_0x1fa3eb['shift']());}};_0x38dcb6(++_0x338e8b);}(_0x31dd,0xc6));var _0xd31d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x31dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd31d('0x0'));var util=require(_0xd31d('0x1'));var moment=require(_0xd31d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd31d('0x3'));var fs=require('fs');var Redis=require(_0xd31d('0x4'));var db=require(_0xd31d('0x5'))['db'];var utils=require(_0xd31d('0x6'));var logger=require(_0xd31d('0x7'))(_0xd31d('0x8'));var config=require(_0xd31d('0x9'));var jayson=require(_0xd31d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2af8,_0x11503f,_0x73af1c){return new BPromise(function(_0x195fb1,_0xe7a1c6){return client[_0xd31d('0xb')](_0x5f2af8,_0x73af1c)[_0xd31d('0xc')](function(_0x3ce7a5){logger[_0xd31d('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x11503f,'request\x20sent');logger[_0xd31d('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x11503f,_0xd31d('0xf'),JSON[_0xd31d('0x10')](_0x3ce7a5));if(_0x3ce7a5[_0xd31d('0x11')]){if(_0x3ce7a5[_0xd31d('0x11')]['code']===0x1f4){logger[_0xd31d('0x11')](_0xd31d('0x12'),_0x11503f,_0x3ce7a5[_0xd31d('0x11')]['message']);return _0xe7a1c6(_0x3ce7a5[_0xd31d('0x11')]['message']);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x11503f,_0x3ce7a5[_0xd31d('0x11')]['message']);return _0x195fb1(_0x3ce7a5['error'][_0xd31d('0x13')]);}else{logger['info'](_0xd31d('0x12'),_0x11503f,'request\x20sent');_0x195fb1(_0x3ce7a5[_0xd31d('0x14')][_0xd31d('0x13')]);}})[_0xd31d('0x15')](function(_0x43df00){logger[_0xd31d('0x11')](_0xd31d('0x12'),_0x11503f,_0x43df00);_0xe7a1c6(_0x43df00);});});}exports[_0xd31d('0x16')]=function(_0x404099){var _0x2e165d=this;return new Promise(function(_0x3546d7,_0x4c67b8){return db[_0xd31d('0x17')][_0xd31d('0x18')](_0x404099[_0xd31d('0x19')],{'raw':_0x404099['options']?_0x404099[_0xd31d('0x1a')][_0xd31d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x404099[_0xd31d('0x1a')]?_0x404099[_0xd31d('0x1a')][_0xd31d('0x1c')]||null:null,'attributes':_0x404099[_0xd31d('0x1a')]?_0x404099[_0xd31d('0x1a')][_0xd31d('0x1d')]||null:null,'limit':_0x404099['options']?_0x404099[_0xd31d('0x1a')][_0xd31d('0x1e')]||null:null})[_0xd31d('0xc')](function(_0xe5dd6f){logger[_0xd31d('0xd')]('UpdateOpenchannelApplication',_0x404099);logger[_0xd31d('0xe')](_0xd31d('0x16'),_0x404099,JSON[_0xd31d('0x10')](_0xe5dd6f));_0x3546d7(_0xe5dd6f);})['catch'](function(_0x5198af){logger['error'](_0xd31d('0x16'),_0x5198af[_0xd31d('0x13')],_0x404099);_0x4c67b8(_0x2e165d[_0xd31d('0x11')](0x1f4,_0x5198af[_0xd31d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 82efe99..bde210c 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 _0x5a63=['index','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated'];(function(_0x284e03,_0x4455b1){var _0x46a87e=function(_0x312f6c){while(--_0x312f6c){_0x284e03['push'](_0x284e03['shift']());}};_0x46a87e(++_0x4455b1);}(_0x5a63,0xa6));var _0x35a6=function(_0x16acf5,_0x14840e){_0x16acf5=_0x16acf5-0x0;var _0x15c56a=_0x5a63[_0x16acf5];return _0x15c56a;};'use strict';var multer=require('multer');var util=require(_0x35a6('0x0'));var path=require(_0x35a6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x35a6('0x2'));var auth=require(_0x35a6('0x3'));var interaction=require(_0x35a6('0x4'));var config=require(_0x35a6('0x5'));var controller=require(_0x35a6('0x6'));router['get']('/',auth[_0x35a6('0x7')](),controller[_0x35a6('0x8')]);router[_0x35a6('0x9')](_0x35a6('0xa'),auth[_0x35a6('0x7')](),controller['describe']);router['get'](_0x35a6('0xb'),auth[_0x35a6('0x7')](),controller[_0x35a6('0xc')]);router['get'](_0x35a6('0xd'),auth[_0x35a6('0x7')](),controller[_0x35a6('0xe')]);router[_0x35a6('0x9')](_0x35a6('0xf'),auth[_0x35a6('0x7')](),controller['download']);router[_0x35a6('0x10')]('/',auth[_0x35a6('0x7')](),controller[_0x35a6('0x11')]);router[_0x35a6('0x10')](_0x35a6('0xd'),auth[_0x35a6('0x7')](),controller[_0x35a6('0x12')]);router[_0x35a6('0x10')](_0x35a6('0x13'),auth['isAuthenticated'](),interaction[_0x35a6('0x14')](_0x35a6('0x15'),_0x35a6('0x16')),controller[_0x35a6('0x17')]);router[_0x35a6('0x18')](_0x35a6('0xb'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x35a6('0x19')),controller['update']);router[_0x35a6('0x1a')](_0x35a6('0xb'),auth[_0x35a6('0x7')](),interaction['tracked']('openchannel',_0x35a6('0x1b')),controller['destroy']);router[_0x35a6('0x1a')]('/:id/tags',auth[_0x35a6('0x7')](),controller[_0x35a6('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xd17e=['isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0xd17e,0x1bc));var _0xed17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd17e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed17('0x0'));var util=require(_0xed17('0x1'));var path=require(_0xed17('0x2'));var timeout=require('connect-timeout');var express=require(_0xed17('0x3'));var router=express[_0xed17('0x4')]();var fs_extra=require(_0xed17('0x5'));var auth=require(_0xed17('0x6'));var interaction=require(_0xed17('0x7'));var config=require(_0xed17('0x8'));var controller=require(_0xed17('0x9'));router[_0xed17('0xa')]('/',auth[_0xed17('0xb')](),controller[_0xed17('0xc')]);router[_0xed17('0xa')](_0xed17('0xd'),auth[_0xed17('0xb')](),controller[_0xed17('0xe')]);router[_0xed17('0xa')](_0xed17('0xf'),auth[_0xed17('0xb')](),controller['show']);router[_0xed17('0xa')](_0xed17('0x10'),auth[_0xed17('0xb')](),controller['getMessages']);router[_0xed17('0xa')](_0xed17('0x11'),auth[_0xed17('0xb')](),controller[_0xed17('0x12')]);router[_0xed17('0x13')]('/',auth[_0xed17('0xb')](),controller[_0xed17('0x14')]);router['post'](_0xed17('0x10'),auth[_0xed17('0xb')](),controller[_0xed17('0x15')]);router[_0xed17('0x13')](_0xed17('0x16'),auth[_0xed17('0xb')](),interaction[_0xed17('0x17')](_0xed17('0x18'),_0xed17('0x19')),controller[_0xed17('0x1a')]);router[_0xed17('0x1b')]('/:id',auth[_0xed17('0xb')](),interaction[_0xed17('0x17')](_0xed17('0x18'),_0xed17('0x1c')),controller[_0xed17('0x1d')]);router[_0xed17('0x1e')](_0xed17('0xf'),auth[_0xed17('0xb')](),interaction['tracked'](_0xed17('0x18'),_0xed17('0x1f')),controller[_0xed17('0x20')]);router[_0xed17('0x1e')](_0xed17('0x16'),auth[_0xed17('0xb')](),controller[_0xed17('0x21')]);module[_0xed17('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9284d33..bec23a3 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 _0x1e69=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x6f5442,_0x4293be){var _0x375af3=function(_0x5119d9){while(--_0x5119d9){_0x6f5442['push'](_0x6f5442['shift']());}};_0x375af3(++_0x4293be);}(_0x1e69,0x85));var _0x91e6=function(_0x4e56a2,_0x5a241c){_0x4e56a2=_0x4e56a2-0x0;var _0x1e819c=_0x1e69[_0x4e56a2];return _0x1e819c;};'use strict';var Sequelize=require('sequelize');module[_0x91e6('0x0')]={'closed':{'type':Sequelize[_0x91e6('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x91e6('0x2')]},'disposition':{'type':Sequelize[_0x91e6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x91e6('0x3')]},'read1stAt':{'type':Sequelize[_0x91e6('0x2')]},'threadId':{'type':Sequelize[_0x91e6('0x3')]},'externalUrl':{'type':Sequelize[_0x91e6('0x3')]},'lastMsgAt':{'type':Sequelize[_0x91e6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x91e6('0x4')]('in',_0x91e6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x91e6('0x4')]('in',_0x91e6('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x91e6('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x91e6('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xa631=['DATE','STRING','out','exports','BOOLEAN'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0xa631,0xe4));var _0x1a63=function(_0x43c955,_0x404935){_0x43c955=_0x43c955-0x0;var _0xadd610=_0xa631[_0x43c955];return _0xadd610;};'use strict';var Sequelize=require('sequelize');module[_0x1a63('0x0')]={'closed':{'type':Sequelize[_0x1a63('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1a63('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1a63('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1a63('0x2')]},'threadId':{'type':Sequelize[_0x1a63('0x3')]},'externalUrl':{'type':Sequelize[_0x1a63('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1a63('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1a63('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x1a63('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6311510..ba5f50a 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 _0x5228=['end','stack','name','index','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','create','body','find','params','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','sort','pick','where','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','files','attachments','push','User','fullname','Contact','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','N.A.','format','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','direction','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy'];(function(_0x281c79,_0x22d1be){var _0xfbfaf1=function(_0xf5af54){while(--_0xf5af54){_0x281c79['push'](_0x281c79['shift']());}};_0xfbfaf1(++_0x22d1be);}(_0x5228,0xe5));var _0x8522=function(_0x7d3fe6,_0x994062){_0x7d3fe6=_0x7d3fe6-0x0;var _0xd568f3=_0x5228[_0x7d3fe6];return _0xd568f3;};'use strict';var rimraf=require(_0x8522('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8522('0x1'));var util=require(_0x8522('0x2'));var path=require(_0x8522('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8522('0x4'));var Redis=require('ioredis');var interaction=require(_0x8522('0x5'));var qs=require(_0x8522('0x6'));var pdf=require(_0x8522('0x7'));var logger=require(_0x8522('0x8'))(_0x8522('0x9'));var config=require(_0x8522('0xa'));var db=require(_0x8522('0xb'))['db'];config[_0x8522('0xc')]=_[_0x8522('0xd')](config[_0x8522('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8522('0xe'))(new Redis(config[_0x8522('0xc')]));require('./openchannelInteraction.socket')[_0x8522('0xf')](socket);function respondWithStatusCode(_0x321d8a,_0xb375df){_0xb375df=_0xb375df||0xcc;return function(_0x1f0683){if(_0x1f0683){return _0x321d8a[_0x8522('0x10')](_0xb375df);}return _0x321d8a[_0x8522('0x11')](_0xb375df)['end']();};}function respondWithResult(_0x3b39d5,_0xe7220a){_0xe7220a=_0xe7220a||0xc8;return function(_0x217401){if(_0x217401){return _0x3b39d5['status'](_0xe7220a)['json'](_0x217401);}};}function respondWithFilteredResult(_0x210fb0,_0x5db6c4){return function(_0x10bc6f){if(_0x10bc6f){var _0x85a434=typeof _0x5db6c4[_0x8522('0x12')]===_0x8522('0x13')&&typeof _0x5db6c4[_0x8522('0x14')]===_0x8522('0x13');var _0x326be6=_0x10bc6f[_0x8522('0x15')];var _0x524d13=_0x85a434?0x0:_0x5db6c4[_0x8522('0x12')];var _0x362890=_0x85a434?_0x10bc6f[_0x8522('0x15')]:_0x5db6c4[_0x8522('0x12')]+_0x5db6c4['limit'];var _0x424372;if(_0x362890>=_0x326be6){_0x362890=_0x326be6;_0x424372=0xc8;}else{_0x424372=0xce;}_0x210fb0[_0x8522('0x11')](_0x424372);return _0x210fb0['set'](_0x8522('0x16'),_0x524d13+'-'+_0x362890+'/'+_0x326be6)[_0x8522('0x17')](_0x10bc6f);}return null;};}function saveUpdates(_0x29f3e2){return function(_0x5137f7){if(_0x5137f7){return _0x5137f7[_0x8522('0x18')](_0x29f3e2)[_0x8522('0x19')](function(_0x16e4fa){return _0x16e4fa;});}return null;};}function removeEntity(_0x44a2d2){return function(_0x4b691d){if(_0x4b691d){return _0x4b691d[_0x8522('0x1a')]()[_0x8522('0x19')](function(){_0x44a2d2[_0x8522('0x11')](0xcc)[_0x8522('0x1b')]();});}};}function handleEntityNotFound(_0x44a3cf){return function(_0xfbeff9){if(!_0xfbeff9){_0x44a3cf[_0x8522('0x10')](0x194);}return _0xfbeff9;};}function handleError(_0x8a6702,_0x1c41de){_0x1c41de=_0x1c41de||0x1f4;return function(_0x25e187){logger['error'](_0x25e187[_0x8522('0x1c')]);if(_0x25e187[_0x8522('0x1d')]){delete _0x25e187[_0x8522('0x1d')];}_0x8a6702[_0x8522('0x11')](_0x1c41de)['send'](_0x25e187);};}exports[_0x8522('0x1e')]=function(_0x1c8fd5,_0x33d8c8){var _0x6af37b={};var _0x38c332=_[_0x8522('0x1f')](db[_0x8522('0x20')][_0x8522('0x21')],function(_0x5d49ac){return{'name':_0x5d49ac['fieldName'],'type':_0x5d49ac[_0x8522('0x22')][_0x8522('0x23')]};});_0x6af37b=qs[_0x8522('0x24')](_0x38c332,_0x1c8fd5);return interaction[_0x8522('0x25')](_0x8522('0x26'),_0x1c8fd5[_0x8522('0x27')],_0x1c8fd5[_0x8522('0x28')],_0x6af37b,_0x38c332)[_0x8522('0x19')](respondWithFilteredResult(_0x33d8c8,_0x6af37b))[_0x8522('0x29')](handleError(_0x33d8c8,null));};exports[_0x8522('0x2a')]=function(_0x79b965,_0x44e293){var _0x5d1501={};if(_0x79b965['query'][_0x8522('0x22')]&&_0x79b965[_0x8522('0x27')][_0x8522('0x22')]==='from'){_0x5d1501[_0x8522('0x2b')]=_0x79b965['params']['id'];}else{_0x5d1501['id']=_0x79b965['params']['id'];}var _0x41820f={'raw':![],'where':_0x5d1501},_0x4204f1={};_0x4204f1[_0x8522('0x2c')]=_[_0x8522('0x2d')](db[_0x8522('0x20')][_0x8522('0x21')]);_0x4204f1[_0x8522('0x27')]=_[_0x8522('0x2d')](_0x79b965[_0x8522('0x27')]);_0x4204f1[_0x8522('0x2e')]=_[_0x8522('0x2f')](_0x4204f1[_0x8522('0x2c')],_0x4204f1[_0x8522('0x27')]);_0x41820f['attributes']=_[_0x8522('0x2f')](_0x4204f1[_0x8522('0x2c')],qs['fields'](_0x79b965['query'][_0x8522('0x30')]));_0x41820f[_0x8522('0x31')]=_0x41820f[_0x8522('0x31')][_0x8522('0x32')]?_0x41820f[_0x8522('0x31')]:_0x4204f1[_0x8522('0x2c')];if(_0x79b965[_0x8522('0x27')][_0x8522('0x33')]){_0x41820f[_0x8522('0x34')]=[{'all':!![]}];}_0x41820f=_[_0x8522('0x35')]({},_0x41820f,_0x79b965[_0x8522('0x36')]);return db[_0x8522('0x20')]['find'](_0x41820f)[_0x8522('0x19')](handleEntityNotFound(_0x44e293,null))[_0x8522('0x19')](respondWithResult(_0x44e293,null))[_0x8522('0x29')](handleError(_0x44e293,null));};exports[_0x8522('0x37')]=function(_0x2dd38e,_0x3586b2){return db[_0x8522('0x20')]['create'](_0x2dd38e[_0x8522('0x38')],{})[_0x8522('0x19')](respondWithResult(_0x3586b2,0xc9))[_0x8522('0x29')](handleError(_0x3586b2,null));};exports['update']=function(_0x220005,_0x134703){if(_0x220005[_0x8522('0x38')]['id']){delete _0x220005['body']['id'];}return db[_0x8522('0x20')][_0x8522('0x39')]({'where':{'id':_0x220005['params']['id']}})[_0x8522('0x19')](handleEntityNotFound(_0x134703,null))[_0x8522('0x19')](saveUpdates(_0x220005[_0x8522('0x38')],null))[_0x8522('0x19')](respondWithResult(_0x134703,null))[_0x8522('0x29')](handleError(_0x134703,null));};exports[_0x8522('0x1a')]=function(_0x250192,_0x3a9d35){return db['OpenchannelInteraction']['find']({'where':{'id':_0x250192[_0x8522('0x3a')]['id']}})[_0x8522('0x19')](handleEntityNotFound(_0x3a9d35,null))['then'](removeEntity(_0x3a9d35,null))[_0x8522('0x29')](handleError(_0x3a9d35,null));};exports[_0x8522('0x3b')]=function(_0x4c197c,_0x4134cd){return db[_0x8522('0x20')][_0x8522('0x3b')]()[_0x8522('0x19')](respondWithResult(_0x4134cd,null))[_0x8522('0x29')](handleError(_0x4134cd,null));};exports[_0x8522('0x3c')]=function(_0x3c1141,_0x5b1aff){return db['OpenchannelMessage'][_0x8522('0x39')]({'where':{'id':_0x3c1141['params']['id']}})[_0x8522('0x19')](handleEntityNotFound(_0x5b1aff,null))[_0x8522('0x19')](function(_0x46cd15){if(_0x46cd15){return _0x46cd15[_0x8522('0x3c')](_0x3c1141[_0x8522('0x38')]['ids'],_[_0x8522('0x3d')](_0x3c1141[_0x8522('0x38')],[_0x8522('0x3e'),'id'])||{});}})[_0x8522('0x19')](respondWithResult(_0x5b1aff,null))[_0x8522('0x29')](handleError(_0x5b1aff,null));};exports[_0x8522('0x3f')]=function(_0x298bb3,_0x5b85eb){var _0x48563c={'raw':![],'where':{}};var _0x505fd9={};var _0x2cd36e={'count':0x0,'rows':[]};return db[_0x8522('0x20')][_0x8522('0x40')]({'where':{'id':_0x298bb3[_0x8522('0x3a')]['id']}})[_0x8522('0x19')](handleEntityNotFound(_0x5b85eb,null))['then'](function(_0x5b7368){if(_0x5b7368){_0x505fd9[_0x8522('0x2c')]=_[_0x8522('0x2d')](db[_0x8522('0x41')]['rawAttributes']);_0x505fd9[_0x8522('0x27')]=_[_0x8522('0x2d')](_0x298bb3[_0x8522('0x27')]);_0x505fd9[_0x8522('0x2e')]=_[_0x8522('0x2f')](_0x505fd9[_0x8522('0x2c')],_0x505fd9['query']);_0x48563c[_0x8522('0x31')]=_[_0x8522('0x2f')](_0x505fd9[_0x8522('0x2c')],qs[_0x8522('0x30')](_0x298bb3[_0x8522('0x27')][_0x8522('0x30')]));_0x48563c[_0x8522('0x31')]=_0x48563c[_0x8522('0x31')][_0x8522('0x32')]?_0x48563c[_0x8522('0x31')]:_0x505fd9[_0x8522('0x2c')];if(!_0x298bb3['query'][_0x8522('0x42')](_0x8522('0x43'))){_0x48563c[_0x8522('0x14')]=qs[_0x8522('0x14')](_0x298bb3[_0x8522('0x27')]['limit']);_0x48563c[_0x8522('0x12')]=qs[_0x8522('0x12')](_0x298bb3['query'][_0x8522('0x12')]);}_0x48563c['order']=qs[_0x8522('0x44')](_0x298bb3['query'][_0x8522('0x44')]);_0x48563c['where']=qs['filters'](_[_0x8522('0x45')](_0x298bb3[_0x8522('0x27')],_0x505fd9['filters']));_0x48563c[_0x8522('0x46')][_0x8522('0x47')]=_0x5b7368['id'];if(_0x298bb3[_0x8522('0x27')][_0x8522('0x48')]){_0x48563c[_0x8522('0x46')]=_['merge'](_0x48563c[_0x8522('0x46')],{'$or':_[_0x8522('0x1f')](_0x48563c['attributes'],function(_0x5b82ad){var _0xde1e51={};_0xde1e51[_0x5b82ad]={'$like':'%'+_0x298bb3[_0x8522('0x27')][_0x8522('0x48')]+'%'};return _0xde1e51;})});}if(_0x298bb3['query'][_0x8522('0x49')]){var _0x2011e9=_0x298bb3[_0x8522('0x27')][_0x8522('0x49')][_0x8522('0x4a')](',');var _0x390108={};_0x390108[_0x2011e9[0x0]]={'$gte':moment(_0x2011e9[0x1])['format'](_0x8522('0x4b'))};_0x48563c[_0x8522('0x46')]=_['merge'](_0x48563c[_0x8522('0x46')],_0x390108);}_0x48563c=_['merge']({},_0x48563c,_0x298bb3['options']);return db['OpenchannelMessage']['count']({'where':_0x48563c[_0x8522('0x46')]})['then'](function(_0xff9f7a){_0x2cd36e[_0x8522('0x15')]=_0xff9f7a;if(_0x298bb3['query']['includeAll']){_0x48563c['include']=[{'all':!![]}];}return db[_0x8522('0x41')][_0x8522('0x25')](_0x48563c);})['then'](function(_0x5721a4){_0x2cd36e[_0x8522('0x4c')]=_0x5721a4;return _0x2cd36e;});}})[_0x8522('0x19')](respondWithFilteredResult(_0x5b85eb,_0x48563c))[_0x8522('0x29')](handleError(_0x5b85eb,null));};exports[_0x8522('0x4d')]=function(_0x20ed14,_0x3c3044){return db['OpenchannelInteraction'][_0x8522('0x39')]({'where':{'id':_0x20ed14['params']['id']}})['then'](handleEntityNotFound(_0x3c3044,null))[_0x8522('0x19')](function(_0x1912b6){if(_0x1912b6){return _0x1912b6[_0x8522('0x4e')](_0x20ed14[_0x8522('0x38')][_0x8522('0x3e')],_[_0x8522('0x3d')](_0x20ed14[_0x8522('0x38')],[_0x8522('0x3e'),'id'])||{})['spread'](function(){return db[_0x8522('0x4f')][_0x8522('0x25')]({'attributes':['id',_0x8522('0x1d'),'color'],'where':{'id':_0x20ed14[_0x8522('0x38')]['ids']}});})[_0x8522('0x19')](function(_0x295542){socket[_0x8522('0x50')](_0x8522('0x51'),{'id':Number(_0x20ed14['params']['id']),'tags':_0x295542||[]});return{'id':Number(_0x20ed14[_0x8522('0x3a')]['id']),'tags':_0x295542||[]};});}})[_0x8522('0x19')](respondWithResult(_0x3c3044,null))[_0x8522('0x29')](handleError(_0x3c3044,null));};exports[_0x8522('0x52')]=function(_0x1155e0,_0x5b70ca){return db[_0x8522('0x20')][_0x8522('0x39')]({'where':{'id':_0x1155e0[_0x8522('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5b70ca,null))[_0x8522('0x19')](function(_0x1894eb){if(_0x1894eb){return _0x1894eb['removeTags'](_0x1155e0[_0x8522('0x27')]['ids']);}})['then'](respondWithStatusCode(_0x5b70ca,null))['catch'](handleError(_0x5b70ca,null));};exports['download']=function(_0x463c63,_0x27ea5b){var _0x324945=moment()[_0x8522('0x53')]()[_0x8522('0x54')]();var _0xb88067=path[_0x8522('0x55')](config[_0x8522('0x56')],_0x8522('0x57'),'files','tmp');var _0x26fc76=path[_0x8522('0x55')](config[_0x8522('0x56')],_0x8522('0x57'),_0x8522('0x58'),_0x8522('0x59'));var _0x4dd89c=path[_0x8522('0x55')](_0xb88067,_0x324945);var _0x23dfe3=util['format']('transcript-%d-%s.zip',_0x463c63[_0x8522('0x3a')]['id'],_0x324945);var _0x2200b2=path[_0x8522('0x55')](_0xb88067,_0x23dfe3);var _0x212e8c=[];_0x212e8c[_0x8522('0x5a')]({'model':db[_0x8522('0x5b')],'as':_0x8522('0x5b'),'attributes':['id',_0x8522('0x5c')],'raw':!![]});_0x212e8c[_0x8522('0x5a')]({'model':db['CmContact'],'as':_0x8522('0x5d'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x463c63[_0x8522('0x27')][_0x8522('0x59')]){_0x212e8c[_0x8522('0x5a')]({'model':db[_0x8522('0x5e')],'as':_0x8522('0x5e'),'raw':!![]});}var _0x4bdc42=[{'model':db[_0x8522('0x41')],'as':_0x8522('0x5f'),'attributes':['id',_0x8522('0x38'),_0x8522('0x60'),'direction',_0x8522('0x61'),_0x8522('0x62')],'include':_0x212e8c}];_0x4bdc42['push']({'model':db[_0x8522('0x63')],'as':_0x8522('0x64'),'attributes':['id',_0x8522('0x1d')]});_0x4bdc42[_0x8522('0x5a')]({'model':db[_0x8522('0x5b')],'as':_0x8522('0x65'),'attributes':['id',_0x8522('0x5c')]});return db[_0x8522('0x20')]['find']({'where':{'id':_0x463c63[_0x8522('0x3a')]['id']},'include':_0x4bdc42})['then'](handleEntityNotFound(_0x27ea5b,null))[_0x8522('0x19')](function(_0x15230e){if(_0x15230e){var _0xd28da=_0x15230e[_0x8522('0x66')]({'plain':!![]});fs['mkdirSync'](_0x4dd89c);var _0x2f4fde={'channel':'Openchannel','account':_0xd28da[_0x8522('0x64')][_0x8522('0x1d')],'agent':_0xd28da['Owner']?_0xd28da['Owner'][_0x8522('0x5c')]:_0x8522('0x67'),'createdAt':moment(_0xd28da[_0x8522('0x60')])[_0x8522('0x68')](_0x8522('0x4b'))[_0x8522('0x54')](),'closedAt':_0xd28da[_0x8522('0x69')]?moment(_0xd28da[_0x8522('0x6a')])[_0x8522('0x68')](_0x8522('0x4b'))[_0x8522('0x54')]():'','disposition':_0xd28da['disposition'],'visibility':_0xd28da[_0x8522('0x6b')]?_0x8522('0x6c'):_0x8522('0x6d'),'messages':_(_0xd28da[_0x8522('0x5f')])[_0x8522('0x48')]({'secret':![]})[_0x8522('0x1f')](function(_0x592cdf){if(_0x592cdf[_0x8522('0x5e')]){var _0x3d83d9=path[_0x8522('0x55')](_0x26fc76,_0x592cdf[_0x8522('0x5e')][_0x8522('0x6e')]);if(fs[_0x8522('0x6f')](_0x3d83d9)){fs[_0x8522('0x70')](_0x3d83d9)[_0x8522('0x71')](fs[_0x8522('0x72')](path[_0x8522('0x55')](_0x4dd89c,_0x592cdf['Attachment']['basename'])));}}return{'date':moment(_0x592cdf[_0x8522('0x60')])['format'](_0x8522('0x4b'))[_0x8522('0x54')](),'sender':_0x592cdf['direction']===_0x8522('0x73')?_0x592cdf[_0x8522('0x5b')]?_0x592cdf[_0x8522('0x5b')][_0x8522('0x5c')]:_0x8522('0x74'):_0x592cdf[_0x8522('0x5d')]['firstName']+(_0x592cdf[_0x8522('0x5d')][_0x8522('0x75')]?'\x20'+_0x592cdf[_0x8522('0x5d')][_0x8522('0x75')]:''),'body':_0x592cdf[_0x8522('0x5e')]?_0x592cdf[_0x8522('0x5e')][_0x8522('0x6e')]:_0x592cdf['body'],'direction':_0x592cdf[_0x8522('0x76')]===_0x8522('0x73')?'A':'C','secret':_0x592cdf[_0x8522('0x61')],'read':_0x592cdf[_0x8522('0x62')],'attachment':_0x592cdf[_0x8522('0x5e')]};})[_0x8522('0x77')]()};return ejs['renderFile'](path[_0x8522('0x55')](config['root'],_0x8522('0x57'),_0x8522('0x78'),_0x8522('0x79')),{'interaction':_0x2f4fde})[_0x8522('0x19')](function(_0x2931b6){var _0x401043=path['join'](_0x4dd89c,_0x8522('0x7a')+_0xd28da['id']+'-'+_0x324945+_0x8522('0x7b'));var _0x11097e={'path':_0x401043,'channel':'Openchannel','interactionId':_0xd28da['id']};return pdf[_0x8522('0x7c')](_0x2931b6,_0x11097e);})[_0x8522('0x19')](function(){return new Promise(function(_0x26114b,_0x56ff0b){zipdir(_0x4dd89c,{'saveTo':_0x2200b2},function(_0x43e51e,_0x23ea64){if(_0x43e51e)return _0x56ff0b(_0x43e51e);return _0x26114b(_0x23ea64);});})[_0x8522('0x19')](function(){return new Promise(function(_0xfdc3f2,_0x43d4bd){rimraf(_0x4dd89c,function(_0x261e7e){if(_0x261e7e)_0x43d4bd(_0x261e7e);return _0xfdc3f2();});});})[_0x8522('0x19')](function(){return _0x27ea5b[_0x8522('0x7d')](_0x2200b2,_0x23dfe3,function(_0x30be5e){if(_0x30be5e){logger['error'](_0x8522('0x7e'),_0x30be5e);}else{fs[_0x8522('0x7f')](_0x2200b2);}});});});}else{return _0x27ea5b[_0x8522('0x10')](0xc8);}})[_0x8522('0x29')](handleError(_0x27ea5b,null));}; \ No newline at end of file +var _0x905d=['length','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','lastName','attachments','Attachment','createdAt','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','closed','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','firstName','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','offset','undefined','limit','count','set','json','update','then','destroy','end','sendStatus','error','stack','name','index','map','OpenchannelInteraction','fieldName','type','getOptions','findAll','openchannel','user','catch','show','query','from','params','model','keys','rawAttributes','intersection','fields','attributes'];(function(_0x2a313f,_0xa37452){var _0x3545d8=function(_0x73e414){while(--_0x73e414){_0x2a313f['push'](_0x2a313f['shift']());}};_0x3545d8(++_0xa37452);}(_0x905d,0xce));var _0xd905=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x905d[_0x2dafbe];return _0x58a45a;};'use strict';var rimraf=require(_0xd905('0x0'));var zipdir=require(_0xd905('0x1'));var moment=require('moment');var util=require(_0xd905('0x2'));var path=require('path');var ejs=require(_0xd905('0x3'));var fs=require('fs');var _=require(_0xd905('0x4'));var Redis=require('ioredis');var interaction=require(_0xd905('0x5'));var qs=require(_0xd905('0x6'));var pdf=require(_0xd905('0x7'));var logger=require(_0xd905('0x8'))(_0xd905('0x9'));var config=require(_0xd905('0xa'));var db=require('../../mysqldb')['db'];config[_0xd905('0xb')]=_[_0xd905('0xc')](config[_0xd905('0xb')],{'host':_0xd905('0xd'),'port':0x18eb});var socket=require(_0xd905('0xe'))(new Redis(config['redis']));require(_0xd905('0xf'))[_0xd905('0x10')](socket);function respondWithStatusCode(_0x197229,_0x51e8f4){_0x51e8f4=_0x51e8f4||0xcc;return function(_0xdf4e27){if(_0xdf4e27){return _0x197229['sendStatus'](_0x51e8f4);}return _0x197229[_0xd905('0x11')](_0x51e8f4)['end']();};}function respondWithResult(_0x590879,_0x3f0c2a){_0x3f0c2a=_0x3f0c2a||0xc8;return function(_0x51f1bd){if(_0x51f1bd){return _0x590879[_0xd905('0x11')](_0x3f0c2a)['json'](_0x51f1bd);}};}function respondWithFilteredResult(_0x216b01,_0x1d593a){return function(_0x461439){if(_0x461439){var _0x310f8c=typeof _0x1d593a[_0xd905('0x12')]===_0xd905('0x13')&&typeof _0x1d593a[_0xd905('0x14')]===_0xd905('0x13');var _0x575ae1=_0x461439[_0xd905('0x15')];var _0x40f22c=_0x310f8c?0x0:_0x1d593a['offset'];var _0x5eadf3=_0x310f8c?_0x461439[_0xd905('0x15')]:_0x1d593a['offset']+_0x1d593a[_0xd905('0x14')];var _0xf568eb;if(_0x5eadf3>=_0x575ae1){_0x5eadf3=_0x575ae1;_0xf568eb=0xc8;}else{_0xf568eb=0xce;}_0x216b01[_0xd905('0x11')](_0xf568eb);return _0x216b01[_0xd905('0x16')]('Content-Range',_0x40f22c+'-'+_0x5eadf3+'/'+_0x575ae1)[_0xd905('0x17')](_0x461439);}return null;};}function saveUpdates(_0x3016f7){return function(_0xef5540){if(_0xef5540){return _0xef5540[_0xd905('0x18')](_0x3016f7)[_0xd905('0x19')](function(_0x5c8322){return _0x5c8322;});}return null;};}function removeEntity(_0x22a294){return function(_0x1ac8a9){if(_0x1ac8a9){return _0x1ac8a9[_0xd905('0x1a')]()['then'](function(){_0x22a294[_0xd905('0x11')](0xcc)[_0xd905('0x1b')]();});}};}function handleEntityNotFound(_0x9b0139){return function(_0x18f65b){if(!_0x18f65b){_0x9b0139[_0xd905('0x1c')](0x194);}return _0x18f65b;};}function handleError(_0x5b662d,_0xbe446e){_0xbe446e=_0xbe446e||0x1f4;return function(_0x4a3f79){logger[_0xd905('0x1d')](_0x4a3f79[_0xd905('0x1e')]);if(_0x4a3f79['name']){delete _0x4a3f79[_0xd905('0x1f')];}_0x5b662d[_0xd905('0x11')](_0xbe446e)['send'](_0x4a3f79);};}exports[_0xd905('0x20')]=function(_0x244e5c,_0x2fc61b){var _0x119761={};var _0x190226=_[_0xd905('0x21')](db[_0xd905('0x22')]['rawAttributes'],function(_0x3bb74){return{'name':_0x3bb74[_0xd905('0x23')],'type':_0x3bb74[_0xd905('0x24')]['key']};});_0x119761=qs[_0xd905('0x25')](_0x190226,_0x244e5c);return interaction[_0xd905('0x26')](_0xd905('0x27'),_0x244e5c['query'],_0x244e5c[_0xd905('0x28')],_0x119761,_0x190226)[_0xd905('0x19')](respondWithFilteredResult(_0x2fc61b,_0x119761))[_0xd905('0x29')](handleError(_0x2fc61b,null));};exports[_0xd905('0x2a')]=function(_0xe796a3,_0x11e0fc){var _0x3b5db2={};if(_0xe796a3['query']['type']&&_0xe796a3[_0xd905('0x2b')][_0xd905('0x24')]===_0xd905('0x2c')){_0x3b5db2[_0xd905('0x2c')]=_0xe796a3[_0xd905('0x2d')]['id'];}else{_0x3b5db2['id']=_0xe796a3['params']['id'];}var _0x868dbf={'raw':![],'where':_0x3b5db2},_0x38018f={};_0x38018f[_0xd905('0x2e')]=_[_0xd905('0x2f')](db[_0xd905('0x22')][_0xd905('0x30')]);_0x38018f[_0xd905('0x2b')]=_[_0xd905('0x2f')](_0xe796a3[_0xd905('0x2b')]);_0x38018f['filters']=_[_0xd905('0x31')](_0x38018f[_0xd905('0x2e')],_0x38018f[_0xd905('0x2b')]);_0x868dbf['attributes']=_[_0xd905('0x31')](_0x38018f[_0xd905('0x2e')],qs['fields'](_0xe796a3['query'][_0xd905('0x32')]));_0x868dbf[_0xd905('0x33')]=_0x868dbf[_0xd905('0x33')][_0xd905('0x34')]?_0x868dbf[_0xd905('0x33')]:_0x38018f[_0xd905('0x2e')];if(_0xe796a3[_0xd905('0x2b')]['includeAll']){_0x868dbf[_0xd905('0x35')]=[{'all':!![]}];}_0x868dbf=_[_0xd905('0x36')]({},_0x868dbf,_0xe796a3[_0xd905('0x37')]);return db[_0xd905('0x22')][_0xd905('0x38')](_0x868dbf)[_0xd905('0x19')](handleEntityNotFound(_0x11e0fc,null))['then'](respondWithResult(_0x11e0fc,null))[_0xd905('0x29')](handleError(_0x11e0fc,null));};exports[_0xd905('0x39')]=function(_0x874d1d,_0x31ac9c){return db[_0xd905('0x22')][_0xd905('0x39')](_0x874d1d[_0xd905('0x3a')],{})['then'](respondWithResult(_0x31ac9c,0xc9))[_0xd905('0x29')](handleError(_0x31ac9c,null));};exports[_0xd905('0x18')]=function(_0x4c9e74,_0x3c4aad){if(_0x4c9e74[_0xd905('0x3a')]['id']){delete _0x4c9e74[_0xd905('0x3a')]['id'];}return db[_0xd905('0x22')]['find']({'where':{'id':_0x4c9e74['params']['id']}})[_0xd905('0x19')](handleEntityNotFound(_0x3c4aad,null))[_0xd905('0x19')](saveUpdates(_0x4c9e74[_0xd905('0x3a')],null))['then'](respondWithResult(_0x3c4aad,null))[_0xd905('0x29')](handleError(_0x3c4aad,null));};exports[_0xd905('0x1a')]=function(_0x551542,_0x39f2be){return db[_0xd905('0x22')]['find']({'where':{'id':_0x551542[_0xd905('0x2d')]['id']}})['then'](handleEntityNotFound(_0x39f2be,null))[_0xd905('0x19')](removeEntity(_0x39f2be,null))['catch'](handleError(_0x39f2be,null));};exports[_0xd905('0x3b')]=function(_0xf84c98,_0x128820){return db[_0xd905('0x22')]['describe']()[_0xd905('0x19')](respondWithResult(_0x128820,null))['catch'](handleError(_0x128820,null));};exports[_0xd905('0x3c')]=function(_0xdaa3f3,_0x1e30f2){return db[_0xd905('0x3d')][_0xd905('0x38')]({'where':{'id':_0xdaa3f3[_0xd905('0x2d')]['id']}})[_0xd905('0x19')](handleEntityNotFound(_0x1e30f2,null))['then'](function(_0x415cdb){if(_0x415cdb){return _0x415cdb['addMessage'](_0xdaa3f3[_0xd905('0x3a')][_0xd905('0x3e')],_[_0xd905('0x3f')](_0xdaa3f3[_0xd905('0x3a')],[_0xd905('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x1e30f2,null))[_0xd905('0x29')](handleError(_0x1e30f2,null));};exports[_0xd905('0x40')]=function(_0x8c4017,_0x16f619){var _0x10850f={'raw':![],'where':{}};var _0x6026={};var _0xe8a788={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xd905('0x41')]({'where':{'id':_0x8c4017[_0xd905('0x2d')]['id']}})[_0xd905('0x19')](handleEntityNotFound(_0x16f619,null))[_0xd905('0x19')](function(_0x301713){if(_0x301713){_0x6026['model']=_['keys'](db['OpenchannelMessage'][_0xd905('0x30')]);_0x6026['query']=_['keys'](_0x8c4017[_0xd905('0x2b')]);_0x6026[_0xd905('0x42')]=_[_0xd905('0x31')](_0x6026['model'],_0x6026[_0xd905('0x2b')]);_0x10850f[_0xd905('0x33')]=_['intersection'](_0x6026[_0xd905('0x2e')],qs[_0xd905('0x32')](_0x8c4017[_0xd905('0x2b')]['fields']));_0x10850f[_0xd905('0x33')]=_0x10850f['attributes'][_0xd905('0x34')]?_0x10850f['attributes']:_0x6026['model'];if(!_0x8c4017['query'][_0xd905('0x43')](_0xd905('0x44'))){_0x10850f[_0xd905('0x14')]=qs['limit'](_0x8c4017[_0xd905('0x2b')][_0xd905('0x14')]);_0x10850f[_0xd905('0x12')]=qs['offset'](_0x8c4017[_0xd905('0x2b')]['offset']);}_0x10850f[_0xd905('0x45')]=qs[_0xd905('0x46')](_0x8c4017[_0xd905('0x2b')][_0xd905('0x46')]);_0x10850f[_0xd905('0x47')]=qs['filters'](_[_0xd905('0x48')](_0x8c4017[_0xd905('0x2b')],_0x6026[_0xd905('0x42')]));_0x10850f[_0xd905('0x47')][_0xd905('0x49')]=_0x301713['id'];if(_0x8c4017[_0xd905('0x2b')][_0xd905('0x4a')]){_0x10850f[_0xd905('0x47')]=_[_0xd905('0x36')](_0x10850f[_0xd905('0x47')],{'$or':_['map'](_0x10850f['attributes'],function(_0x531e64){var _0x231eea={};_0x231eea[_0x531e64]={'$like':'%'+_0x8c4017['query'][_0xd905('0x4a')]+'%'};return _0x231eea;})});}if(_0x8c4017[_0xd905('0x2b')]['$gte']){var _0x338fcb=_0x8c4017['query']['$gte']['split'](',');var _0x3d3df8={};_0x3d3df8[_0x338fcb[0x0]]={'$gte':moment(_0x338fcb[0x1])[_0xd905('0x4b')](_0xd905('0x4c'))};_0x10850f[_0xd905('0x47')]=_['merge'](_0x10850f[_0xd905('0x47')],_0x3d3df8);}_0x10850f=_['merge']({},_0x10850f,_0x8c4017[_0xd905('0x37')]);return db[_0xd905('0x3d')][_0xd905('0x15')]({'where':_0x10850f[_0xd905('0x47')]})[_0xd905('0x19')](function(_0x331e94){_0xe8a788[_0xd905('0x15')]=_0x331e94;if(_0x8c4017['query'][_0xd905('0x4d')]){_0x10850f[_0xd905('0x35')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x10850f);})['then'](function(_0x23eaa9){_0xe8a788[_0xd905('0x4e')]=_0x23eaa9;return _0xe8a788;});}})['then'](respondWithFilteredResult(_0x16f619,_0x10850f))[_0xd905('0x29')](handleError(_0x16f619,null));};exports[_0xd905('0x4f')]=function(_0x48cdcf,_0x43af24){return db[_0xd905('0x22')]['find']({'where':{'id':_0x48cdcf[_0xd905('0x2d')]['id']}})['then'](handleEntityNotFound(_0x43af24,null))[_0xd905('0x19')](function(_0x324858){if(_0x324858){return _0x324858[_0xd905('0x50')](_0x48cdcf[_0xd905('0x3a')][_0xd905('0x3e')],_[_0xd905('0x3f')](_0x48cdcf[_0xd905('0x3a')],['ids','id'])||{})['spread'](function(){return db[_0xd905('0x51')][_0xd905('0x26')]({'attributes':['id',_0xd905('0x1f'),_0xd905('0x52')],'where':{'id':_0x48cdcf[_0xd905('0x3a')]['ids']}});})[_0xd905('0x19')](function(_0x3a1fe3){socket[_0xd905('0x53')](_0xd905('0x54'),{'id':Number(_0x48cdcf['params']['id']),'tags':_0x3a1fe3||[]});return{'id':Number(_0x48cdcf['params']['id']),'tags':_0x3a1fe3||[]};});}})['then'](respondWithResult(_0x43af24,null))[_0xd905('0x29')](handleError(_0x43af24,null));};exports[_0xd905('0x55')]=function(_0x51d060,_0x121ff1){return db[_0xd905('0x22')][_0xd905('0x38')]({'where':{'id':_0x51d060[_0xd905('0x2d')]['id']}})[_0xd905('0x19')](handleEntityNotFound(_0x121ff1,null))[_0xd905('0x19')](function(_0x3101a4){if(_0x3101a4){return _0x3101a4['removeTags'](_0x51d060[_0xd905('0x2b')][_0xd905('0x3e')]);}})[_0xd905('0x19')](respondWithStatusCode(_0x121ff1,null))[_0xd905('0x29')](handleError(_0x121ff1,null));};exports[_0xd905('0x56')]=function(_0x3ae083,_0x136e98){var _0x1e83cc=moment()[_0xd905('0x57')]()[_0xd905('0x58')]();var _0xbf81e=path[_0xd905('0x59')](config[_0xd905('0x5a')],_0xd905('0x5b'),_0xd905('0x5c'),_0xd905('0x5d'));var _0x1b0095=path[_0xd905('0x59')](config[_0xd905('0x5a')],_0xd905('0x5b'),_0xd905('0x5c'),'attachments');var _0x13aac0=path['join'](_0xbf81e,_0x1e83cc);var _0x2983fc=util['format'](_0xd905('0x5e'),_0x3ae083[_0xd905('0x2d')]['id'],_0x1e83cc);var _0x32b5ca=path[_0xd905('0x59')](_0xbf81e,_0x2983fc);var _0x178d30=[];_0x178d30[_0xd905('0x5f')]({'model':db[_0xd905('0x60')],'as':_0xd905('0x60'),'attributes':['id',_0xd905('0x61')],'raw':!![]});_0x178d30[_0xd905('0x5f')]({'model':db['CmContact'],'as':_0xd905('0x62'),'attributes':['id','firstName',_0xd905('0x63')],'raw':!![]});if(_0x3ae083[_0xd905('0x2b')][_0xd905('0x64')]){_0x178d30['push']({'model':db[_0xd905('0x65')],'as':_0xd905('0x65'),'raw':!![]});}var _0x11bdbe=[{'model':db[_0xd905('0x3d')],'as':'Messages','attributes':['id',_0xd905('0x3a'),_0xd905('0x66'),_0xd905('0x67'),_0xd905('0x68'),'read'],'include':_0x178d30}];_0x11bdbe[_0xd905('0x5f')]({'model':db[_0xd905('0x69')],'as':'Account','attributes':['id',_0xd905('0x1f')]});_0x11bdbe[_0xd905('0x5f')]({'model':db[_0xd905('0x60')],'as':_0xd905('0x6a'),'attributes':['id',_0xd905('0x61')]});return db[_0xd905('0x22')][_0xd905('0x38')]({'where':{'id':_0x3ae083['params']['id']},'include':_0x11bdbe})[_0xd905('0x19')](handleEntityNotFound(_0x136e98,null))[_0xd905('0x19')](function(_0x499795){if(_0x499795){var _0x14fe76=_0x499795[_0xd905('0x6b')]({'plain':!![]});fs[_0xd905('0x6c')](_0x13aac0);var _0x502b65={'channel':_0xd905('0x6d'),'account':_0x14fe76['Account'][_0xd905('0x1f')],'agent':_0x14fe76[_0xd905('0x6a')]?_0x14fe76[_0xd905('0x6a')]['fullname']:'N.A.','createdAt':moment(_0x14fe76['createdAt'])[_0xd905('0x4b')](_0xd905('0x4c'))['toString'](),'closedAt':_0x14fe76[_0xd905('0x6e')]?moment(_0x14fe76['closedAt'])[_0xd905('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd905('0x58')]():'','disposition':_0x14fe76[_0xd905('0x6f')],'visibility':_0x14fe76[_0xd905('0x70')]?'Public':_0xd905('0x71'),'messages':_(_0x14fe76[_0xd905('0x72')])[_0xd905('0x4a')]({'secret':![]})[_0xd905('0x21')](function(_0x228bdb){if(_0x228bdb['Attachment']){var _0x5806cf=path[_0xd905('0x59')](_0x1b0095,_0x228bdb[_0xd905('0x65')][_0xd905('0x73')]);if(fs[_0xd905('0x74')](_0x5806cf)){fs[_0xd905('0x75')](_0x5806cf)[_0xd905('0x76')](fs[_0xd905('0x77')](path[_0xd905('0x59')](_0x13aac0,_0x228bdb[_0xd905('0x65')][_0xd905('0x73')])));}}return{'date':moment(_0x228bdb[_0xd905('0x66')])['format'](_0xd905('0x4c'))[_0xd905('0x58')](),'sender':_0x228bdb[_0xd905('0x67')]==='out'?_0x228bdb['User']?_0x228bdb[_0xd905('0x60')][_0xd905('0x61')]:_0xd905('0x78'):_0x228bdb['Contact'][_0xd905('0x79')]+(_0x228bdb[_0xd905('0x62')][_0xd905('0x63')]?'\x20'+_0x228bdb[_0xd905('0x62')]['lastName']:''),'body':_0x228bdb[_0xd905('0x65')]?_0x228bdb['Attachment']['basename']:_0x228bdb[_0xd905('0x3a')],'direction':_0x228bdb[_0xd905('0x67')]==='out'?'A':'C','secret':_0x228bdb[_0xd905('0x68')],'read':_0x228bdb['read'],'attachment':_0x228bdb[_0xd905('0x65')]};})['value']()};return ejs[_0xd905('0x7a')](path['join'](config[_0xd905('0x5a')],'server',_0xd905('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x502b65})[_0xd905('0x19')](function(_0x57acb6){var _0x4d9620=path[_0xd905('0x59')](_0x13aac0,_0xd905('0x7c')+_0x14fe76['id']+'-'+_0x1e83cc+_0xd905('0x7d'));var _0x4f83c3={'path':_0x4d9620,'channel':_0xd905('0x6d'),'interactionId':_0x14fe76['id']};return pdf[_0xd905('0x7e')](_0x57acb6,_0x4f83c3);})[_0xd905('0x19')](function(){return new Promise(function(_0xb85804,_0x1c1f44){zipdir(_0x13aac0,{'saveTo':_0x32b5ca},function(_0x2aa908,_0x54abbd){if(_0x2aa908)return _0x1c1f44(_0x2aa908);return _0xb85804(_0x54abbd);});})[_0xd905('0x19')](function(){return new Promise(function(_0x2ee66b,_0x2ac02b){rimraf(_0x13aac0,function(_0x23aac5){if(_0x23aac5)_0x2ac02b(_0x23aac5);return _0x2ee66b();});});})[_0xd905('0x19')](function(){return _0x136e98[_0xd905('0x56')](_0x32b5ca,_0x2983fc,function(_0x2f0a4a){if(_0x2f0a4a){logger[_0xd905('0x1d')](_0xd905('0x7f'),_0x2f0a4a);}else{fs[_0xd905('0x80')](_0x32b5ca);}});});});}else{return _0x136e98[_0xd905('0x1c')](0xc8);}})[_0xd905('0x29')](handleError(_0x136e98,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f0c2683..8dc7bcb 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 _0xe399=['map','findAll','emit','catch','exports','OpenchannelInteraction','setMaxListeners','update','remove','then','setDataValue'];(function(_0x45207c,_0x5e6766){var _0x5a1b52=function(_0x2be81c){while(--_0x2be81c){_0x45207c['push'](_0x45207c['shift']());}};_0x5a1b52(++_0x5e6766);}(_0xe399,0xec));var _0x9e39=function(_0x534ae4,_0x5ab30f){_0x534ae4=_0x534ae4-0x0;var _0x249ee2=_0xe399[_0x534ae4];return _0x249ee2;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x9e39('0x0')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9e39('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e39('0x2'),'afterDestroy':_0x9e39('0x3')};function emitEvent(_0xba8a91){return function(_0x3b7803,_0x4e99b1,_0x1e7287){_0x3b7803['getUsers']({'attributes':['id'],'raw':!![]})[_0x9e39('0x4')](function(_0x361f91){_0x3b7803[_0x9e39('0x5')]('Users',_0x361f91[_0x9e39('0x6')](function(_0x1f7e02){return{'id':_0x1f7e02['id']};}));return OpenchannelMessage[_0x9e39('0x7')]({'where':{'OpenchannelInteractionId':_0x3b7803['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9e39('0x4')](function(_0x500021){_0x3b7803[_0x9e39('0x5')]('unreadMessages',_0x500021['length']);OpenchannelInteractionEvents[_0x9e39('0x8')](_0xba8a91+':'+_0x3b7803['id'],_0x3b7803);OpenchannelInteractionEvents[_0x9e39('0x8')](_0xba8a91,_0x3b7803);_0x1e7287(null);})[_0x9e39('0x9')](_0x1e7287(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x9e39('0xa')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4687=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','then','map','findAll','setDataValue','unreadMessages'];(function(_0x3b8aa5,_0x3d9652){var _0x39222a=function(_0x579079){while(--_0x579079){_0x3b8aa5['push'](_0x3b8aa5['shift']());}};_0x39222a(++_0x3d9652);}(_0x4687,0xe5));var _0x7468=function(_0x4080a0,_0x5d7cb5){_0x4080a0=_0x4080a0-0x0;var _0x422fb2=_0x4687[_0x4080a0];return _0x422fb2;};'use strict';var EventEmitter=require(_0x7468('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x7468('0x1'))['db'][_0x7468('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7468('0x3')](0x0);var events={'afterCreate':_0x7468('0x4'),'afterUpdate':'update','afterDestroy':_0x7468('0x5')};function emitEvent(_0x245d58){return function(_0x1335d0,_0x4d192f,_0x4c8dc5){_0x1335d0['getUsers']({'attributes':['id'],'raw':!![]})[_0x7468('0x6')](function(_0x3b022d){_0x1335d0['setDataValue']('Users',_0x3b022d[_0x7468('0x7')](function(_0x2463c9){return{'id':_0x2463c9['id']};}));return OpenchannelMessage[_0x7468('0x8')]({'where':{'OpenchannelInteractionId':_0x1335d0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7468('0x6')](function(_0x11ec41){_0x1335d0[_0x7468('0x9')](_0x7468('0xa'),_0x11ec41[_0x7468('0xb')]);OpenchannelInteractionEvents[_0x7468('0xc')](_0x245d58+':'+_0x1335d0['id'],_0x1335d0);OpenchannelInteractionEvents[_0x7468('0xc')](_0x245d58,_0x1335d0);_0x4c8dc5(null);})['catch'](_0x4c8dc5(null));};}for(var e in events){if(events[_0x7468('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x7468('0xe')](e,emitEvent(event));}}module[_0x7468('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c793c8d..9c73c37 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 _0x7a59=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','changed'];(function(_0x1bf1e3,_0x4e59ed){var _0x374780=function(_0x5f2531){while(--_0x5f2531){_0x1bf1e3['push'](_0x1bf1e3['shift']());}};_0x374780(++_0x4e59ed);}(_0x7a59,0x199));var _0x97a5=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x7a59[_0x223461];return _0x4dbe0a;};'use strict';var _=require('lodash');var util=require(_0x97a5('0x0'));var logger=require('../../config/logger')(_0x97a5('0x1'));var moment=require(_0x97a5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x97a5('0x3'));var config=require(_0x97a5('0x4'));var attributes=require(_0x97a5('0x5'));module[_0x97a5('0x6')]=function(_0x9d7d36,_0x4da73c){return _0x9d7d36[_0x97a5('0x7')]('OpenchannelInteraction',attributes,{'tableName':_0x97a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x97a5('0x9'),'hooks':{'beforeUpdate':function(_0x298b02,_0x43f79e,_0x9fb071){if(_0x298b02[_0x97a5('0xa')](_0x97a5('0xb'))){_0x298b02[_0x97a5('0xc')]=moment()[_0x97a5('0xd')](_0x97a5('0xe'));}_0x9fb071(null,_0x298b02);}}});}; \ No newline at end of file +var _0x5abc=['openchannel_interactions','utf8mb4','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x1ef5c8,_0xfa4ac9){var _0x30a363=function(_0x26ea3e){while(--_0x26ea3e){_0x1ef5c8['push'](_0x1ef5c8['shift']());}};_0x30a363(++_0xfa4ac9);}(_0x5abc,0x105));var _0xc5ab=function(_0x4e8530,_0x44e422){_0x4e8530=_0x4e8530-0x0;var _0x34ffcf=_0x5abc[_0x4e8530];return _0x34ffcf;};'use strict';var _=require(_0xc5ab('0x0'));var util=require(_0xc5ab('0x1'));var logger=require(_0xc5ab('0x2'))('api');var moment=require(_0xc5ab('0x3'));var BPromise=require(_0xc5ab('0x4'));var rp=require(_0xc5ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5ab('0x6'));var config=require('../../config/environment');var attributes=require(_0xc5ab('0x7'));module[_0xc5ab('0x8')]=function(_0x1e3ffa,_0x540ff7){return _0x1e3ffa[_0xc5ab('0x9')](_0xc5ab('0xa'),attributes,{'tableName':_0xc5ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc5ab('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2418b9,_0x44d90c,_0x5e7782){if(_0x2418b9[_0xc5ab('0xd')](_0xc5ab('0xe'))){_0x2418b9[_0xc5ab('0xf')]=moment()['format'](_0xc5ab('0x10'));}_0x5e7782(null,_0x2418b9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 325a335..11dfae8 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 _0xc878=['defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateOpenchannelInteraction','options','raw','attributes','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xc878,0x152));var _0x8c87=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0xc878[_0x10df1e];return _0x3e24fb;};'use strict';var _=require(_0x8c87('0x0'));var util=require(_0x8c87('0x1'));var moment=require(_0x8c87('0x2'));var BPromise=require(_0x8c87('0x3'));var rs=require(_0x8c87('0x4'));var fs=require('fs');var Redis=require(_0x8c87('0x5'));var db=require(_0x8c87('0x6'))['db'];var utils=require(_0x8c87('0x7'));var logger=require(_0x8c87('0x8'))(_0x8c87('0x9'));var config=require(_0x8c87('0xa'));var jayson=require(_0x8c87('0xb'));var client=jayson[_0x8c87('0xc')]['http']({'port':0x232a});config[_0x8c87('0xd')]=_[_0x8c87('0xe')](config[_0x8c87('0xd')],{'host':_0x8c87('0xf'),'port':0x18eb});var socket=require(_0x8c87('0x10'))(new Redis(config[_0x8c87('0xd')]));require('./openchannelInteraction.socket')[_0x8c87('0x11')](socket);function respondWithRpcPromise(_0x306ad5,_0x43bbb0,_0x452ed5){return new BPromise(function(_0x2a091d,_0xbe43cb){return client[_0x8c87('0x12')](_0x306ad5,_0x452ed5)[_0x8c87('0x13')](function(_0x5af379){logger[_0x8c87('0x14')](_0x8c87('0x15'),_0x43bbb0,_0x8c87('0x16'));logger[_0x8c87('0x17')](_0x8c87('0x18'),_0x43bbb0,_0x8c87('0x16'),JSON['stringify'](_0x5af379));if(_0x5af379[_0x8c87('0x19')]){if(_0x5af379[_0x8c87('0x19')][_0x8c87('0x1a')]===0x1f4){logger[_0x8c87('0x19')](_0x8c87('0x15'),_0x43bbb0,_0x5af379['error'][_0x8c87('0x1b')]);return _0xbe43cb(_0x5af379['error']['message']);}logger[_0x8c87('0x19')](_0x8c87('0x15'),_0x43bbb0,_0x5af379[_0x8c87('0x19')][_0x8c87('0x1b')]);return _0x2a091d(_0x5af379[_0x8c87('0x19')]['message']);}else{logger[_0x8c87('0x14')](_0x8c87('0x15'),_0x43bbb0,_0x8c87('0x16'));_0x2a091d(_0x5af379['result'][_0x8c87('0x1b')]);}})[_0x8c87('0x1c')](function(_0x4a4405){logger[_0x8c87('0x19')](_0x8c87('0x15'),_0x43bbb0,_0x4a4405);_0xbe43cb(_0x4a4405);});});}exports[_0x8c87('0x1d')]=function(_0x3ba562){var _0x9dc898=this;return new Promise(function(_0x2f01a0,_0x114600){return db['OpenchannelInteraction']['update'](_0x3ba562['body'],{'raw':_0x3ba562[_0x8c87('0x1e')]?_0x3ba562[_0x8c87('0x1e')][_0x8c87('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ba562['options']?_0x3ba562[_0x8c87('0x1e')]['where']||null:null,'attributes':_0x3ba562[_0x8c87('0x1e')]?_0x3ba562[_0x8c87('0x1e')][_0x8c87('0x20')]||null:null,'limit':_0x3ba562[_0x8c87('0x1e')]?_0x3ba562['options'][_0x8c87('0x21')]||null:null})['then'](function(_0x5bc38a){logger[_0x8c87('0x14')](_0x8c87('0x1d'),_0x3ba562);logger[_0x8c87('0x17')](_0x8c87('0x1d'),_0x3ba562,JSON[_0x8c87('0x22')](_0x5bc38a));_0x2f01a0(_0x5bc38a);})['catch'](function(_0x289d67){logger[_0x8c87('0x19')](_0x8c87('0x1d'),_0x289d67[_0x8c87('0x1b')],_0x3ba562);_0x114600(_0x9dc898[_0x8c87('0x19')](0x1f4,_0x289d67['message']));});});};exports[_0x8c87('0x23')]=function(_0x2ef4f1){return new Promise(function(_0x10dd60,_0x13212c){return db[_0x8c87('0x24')][_0x8c87('0x25')]({'where':_0x2ef4f1[_0x8c87('0x1e')]?_0x2ef4f1['options'][_0x8c87('0x26')]||null:null})[_0x8c87('0x13')](function(_0x8f347f){if(_0x8f347f){return _0x8f347f[_0x8c87('0x27')](_0x2ef4f1['body'][_0x8c87('0x28')],_[_0x8c87('0x29')](_0x2ef4f1['body'],[_0x8c87('0x28'),'id'])||{});}})[_0x8c87('0x2a')](function(_0x111af0){logger[_0x8c87('0x14')](_0x8c87('0x2b'),_0x2ef4f1);logger[_0x8c87('0x17')]('AddTags',_0x2ef4f1,JSON['stringify'](_0x111af0));_0x10dd60(_0x111af0);})[_0x8c87('0x1c')](function(_0x48c486){logger[_0x8c87('0x19')]('AddTags',_0x48c486[_0x8c87('0x1b')],_0x2ef4f1);_0x13212c(_this[_0x8c87('0x19')](0x1f4,_0x48c486['message']));});});}; \ No newline at end of file +var _0x9578=['AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelInteraction','update','body','options','where','attributes','limit','UpdateOpenchannelInteraction'];(function(_0x154b79,_0x12cf2d){var _0x27e15b=function(_0x30b1a6){while(--_0x30b1a6){_0x154b79['push'](_0x154b79['shift']());}};_0x27e15b(++_0x12cf2d);}(_0x9578,0x156));var _0x8957=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x9578[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x8957('0x0'));var util=require(_0x8957('0x1'));var moment=require('moment');var BPromise=require(_0x8957('0x2'));var rs=require(_0x8957('0x3'));var fs=require('fs');var Redis=require(_0x8957('0x4'));var db=require(_0x8957('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8957('0x6'))(_0x8957('0x7'));var config=require('../../config/environment');var jayson=require(_0x8957('0x8'));var client=jayson[_0x8957('0x9')][_0x8957('0xa')]({'port':0x232a});config[_0x8957('0xb')]=_[_0x8957('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8957('0xd'))[_0x8957('0xe')](socket);function respondWithRpcPromise(_0x12e7be,_0x17f138,_0x38ea3a){return new BPromise(function(_0x141833,_0x23a8e8){return client[_0x8957('0xf')](_0x12e7be,_0x38ea3a)[_0x8957('0x10')](function(_0x2a77a4){logger['info'](_0x8957('0x11'),_0x17f138,_0x8957('0x12'));logger[_0x8957('0x13')](_0x8957('0x14'),_0x17f138,_0x8957('0x12'),JSON[_0x8957('0x15')](_0x2a77a4));if(_0x2a77a4[_0x8957('0x16')]){if(_0x2a77a4['error'][_0x8957('0x17')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x17f138,_0x2a77a4[_0x8957('0x16')][_0x8957('0x18')]);return _0x23a8e8(_0x2a77a4['error'][_0x8957('0x18')]);}logger[_0x8957('0x16')](_0x8957('0x11'),_0x17f138,_0x2a77a4[_0x8957('0x16')]['message']);return _0x141833(_0x2a77a4['error'][_0x8957('0x18')]);}else{logger[_0x8957('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x17f138,_0x8957('0x12'));_0x141833(_0x2a77a4[_0x8957('0x1a')][_0x8957('0x18')]);}})[_0x8957('0x1b')](function(_0x56b2fc){logger[_0x8957('0x16')](_0x8957('0x11'),_0x17f138,_0x56b2fc);_0x23a8e8(_0x56b2fc);});});}exports['UpdateOpenchannelInteraction']=function(_0x514b88){var _0x316d00=this;return new Promise(function(_0x7bf03f,_0x4ce616){return db[_0x8957('0x1c')][_0x8957('0x1d')](_0x514b88[_0x8957('0x1e')],{'raw':_0x514b88[_0x8957('0x1f')]?_0x514b88[_0x8957('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514b88['options']?_0x514b88[_0x8957('0x1f')][_0x8957('0x20')]||null:null,'attributes':_0x514b88[_0x8957('0x1f')]?_0x514b88[_0x8957('0x1f')][_0x8957('0x21')]||null:null,'limit':_0x514b88[_0x8957('0x1f')]?_0x514b88[_0x8957('0x1f')][_0x8957('0x22')]||null:null})[_0x8957('0x10')](function(_0x1490f8){logger['info']('UpdateOpenchannelInteraction',_0x514b88);logger[_0x8957('0x13')](_0x8957('0x23'),_0x514b88,JSON[_0x8957('0x15')](_0x1490f8));_0x7bf03f(_0x1490f8);})[_0x8957('0x1b')](function(_0x15e39){logger[_0x8957('0x16')](_0x8957('0x23'),_0x15e39['message'],_0x514b88);_0x4ce616(_0x316d00[_0x8957('0x16')](0x1f4,_0x15e39[_0x8957('0x18')]));});});};exports[_0x8957('0x24')]=function(_0xc96564){return new Promise(function(_0x9a4bef,_0x36be24){return db[_0x8957('0x1c')][_0x8957('0x25')]({'where':_0xc96564['options']?_0xc96564['options'][_0x8957('0x20')]||null:null})[_0x8957('0x10')](function(_0x57523f){if(_0x57523f){return _0x57523f[_0x8957('0x26')](_0xc96564[_0x8957('0x1e')][_0x8957('0x27')],_[_0x8957('0x28')](_0xc96564[_0x8957('0x1e')],[_0x8957('0x27'),'id'])||{});}})['spread'](function(_0x294096){logger[_0x8957('0x19')](_0x8957('0x29'),_0xc96564);logger[_0x8957('0x13')](_0x8957('0x29'),_0xc96564,JSON[_0x8957('0x15')](_0x294096));_0x9a4bef(_0x294096);})['catch'](function(_0x7d293a){logger[_0x8957('0x16')]('AddTags',_0x7d293a[_0x8957('0x18')],_0xc96564);_0x36be24(_this['error'](0x1f4,_0x7d293a[_0x8957('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 032628c..c662570 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 _0xb61c=['emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb61c,0xca));var _0xcb61=function(_0x27d01b,_0x4e3a2b){_0x27d01b=_0x27d01b-0x0;var _0x5c2e08=_0xb61c[_0x27d01b];return _0x5c2e08;};'use strict';var OpenchannelInteractionEvents=require(_0xcb61('0x0'));var events=['save','remove',_0xcb61('0x1')];function createListener(_0x5e5d27,_0x10aa48){return function(_0x31b0a4){_0x10aa48[_0xcb61('0x2')](_0x5e5d27,_0x31b0a4);};}function removeListener(_0x528551,_0x1e9c00){return function(){OpenchannelInteractionEvents[_0xcb61('0x3')](_0x528551,_0x1e9c00);};}exports[_0xcb61('0x4')]=function(_0x12dbc1){for(var _0x3d137b=0x0,_0x8832d3=events['length'];_0x3d137b<_0x8832d3;_0x3d137b++){var _0x381dff=events[_0x3d137b];var _0xdb92ab=createListener(_0xcb61('0x5')+_0x381dff,_0x12dbc1);OpenchannelInteractionEvents['on'](_0x381dff,_0xdb92ab);}}; \ No newline at end of file +var _0x72d4=['./openchannelInteraction.events','save','update','emit','register','length'];(function(_0x435c2f,_0x51aa43){var _0x1ebff6=function(_0x38f3c4){while(--_0x38f3c4){_0x435c2f['push'](_0x435c2f['shift']());}};_0x1ebff6(++_0x51aa43);}(_0x72d4,0x174));var _0x472d=function(_0x30beaf,_0x587fb8){_0x30beaf=_0x30beaf-0x0;var _0x2244f=_0x72d4[_0x30beaf];return _0x2244f;};'use strict';var OpenchannelInteractionEvents=require(_0x472d('0x0'));var events=[_0x472d('0x1'),'remove',_0x472d('0x2')];function createListener(_0x47fa4f,_0x5d66b7){return function(_0x5779ff){_0x5d66b7[_0x472d('0x3')](_0x47fa4f,_0x5779ff);};}function removeListener(_0x3318bb,_0x52025b){return function(){OpenchannelInteractionEvents['removeListener'](_0x3318bb,_0x52025b);};}exports[_0x472d('0x4')]=function(_0x4f8449){for(var _0x9a731c=0x0,_0x3268bb=events[_0x472d('0x5')];_0x9a731c<_0x3268bb;_0x9a731c++){var _0x11ac85=events[_0x9a731c];var _0x1f0fc6=createListener('openchannelInteraction:'+_0x11ac85,_0x4f8449);OpenchannelInteractionEvents['on'](_0x11ac85,_0x1f0fc6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 978a577..68f9f62 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x4ad2f1,_0x46d6ab){var _0x268355=function(_0x425102){while(--_0x425102){_0x4ad2f1['push'](_0x4ad2f1['shift']());}};_0x268355(++_0x46d6ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _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(_0xb7df9d,_0x487e7d){var _0x28f1ec=function(_0x14b6dd){while(--_0x14b6dd){_0xb7df9d['push'](_0xb7df9d['shift']());}};_0x28f1ec(++_0x487e7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 3f159f8..bd0892c 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 _0x453b=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x20066c,_0x261dea){var _0x36d1f=function(_0x32a552){while(--_0x32a552){_0x20066c['push'](_0x20066c['shift']());}};_0x36d1f(++_0x261dea);}(_0x453b,0x164));var _0xb453=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0x453b[_0x11b19b];return _0x1daac1;};'use strict';var Sequelize=require(_0xb453('0x0'));module[_0xb453('0x1')]={'body':{'type':Sequelize[_0xb453('0x2')](_0xb453('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb453('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb453('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb453('0x5')]('in',_0xb453('0x6')),'defaultValue':_0xb453('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb453('0x7')]},'providerName':{'type':Sequelize[_0xb453('0x8')]},'providerResponse':{'type':Sequelize[_0xb453('0x2')]}}; \ No newline at end of file +var _0x2964=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0xa57477,_0x1a4a4e){var _0x5548be=function(_0x515062){while(--_0x515062){_0xa57477['push'](_0xa57477['shift']());}};_0x5548be(++_0x1a4a4e);}(_0x2964,0x108));var _0x4296=function(_0x5cbd16,_0x3e0ac7){_0x5cbd16=_0x5cbd16-0x0;var _0x33beef=_0x2964[_0x5cbd16];return _0x33beef;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'body':{'type':Sequelize[_0x4296('0x2')](_0x4296('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4296('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4296('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4296('0x5')]('in',_0x4296('0x6')),'defaultValue':_0x4296('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4296('0x7')]},'providerResponse':{'type':Sequelize[_0x4296('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b4ea4af..a4ed888 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 _0x47c8=['destroy','end','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','filter','options','findAll','show','params','include','find','create','body','describe','openchannel-interactions','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','read1stAt','format','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','agent','email','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','User','fullname','internal','interface','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','sendStatus','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47c8,0x1cc));var _0x847c=function(_0x2e2c20,_0x560cf0){_0x2e2c20=_0x2e2c20-0x0;var _0x151be4=_0x47c8[_0x2e2c20];return _0x151be4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x847c('0x0'));var jsonpatch=require(_0x847c('0x1'));var rp=require(_0x847c('0x2'));var moment=require(_0x847c('0x3'));var BPromise=require(_0x847c('0x4'));var Mustache=require(_0x847c('0x5'));var util=require('util');var path=require(_0x847c('0x6'));var sox=require(_0x847c('0x7'));var csv=require(_0x847c('0x8'));var ejs=require(_0x847c('0x9'));var fs=require('fs');var fs_extra=require(_0x847c('0xa'));var _=require(_0x847c('0xb'));var squel=require('squel');var crypto=require(_0x847c('0xc'));var jsforce=require(_0x847c('0xd'));var deskjs=require(_0x847c('0xe'));var toCsv=require(_0x847c('0x8'));var querystring=require(_0x847c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x847c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x847c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x847c('0x12'))(_0x847c('0x13'));var utils=require(_0x847c('0x14'));var config=require(_0x847c('0x15'));var licenseUtil=require(_0x847c('0x16'));var db=require('../../mysqldb')['db'];config[_0x847c('0x17')]=_[_0x847c('0x18')](config[_0x847c('0x17')],{'host':_0x847c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x847c('0x17')]));require(_0x847c('0x1a'))[_0x847c('0x1b')](socket);var jayson=require(_0x847c('0x1c'));var client=jayson[_0x847c('0x1d')][_0x847c('0x1e')]({'port':0x232c});var client9002=jayson[_0x847c('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4628,_0x5292ac,_0x3d335d,_0x16a548){return new BPromise(function(_0x2c612e,_0x1566ed){var _0xaa4e75=_0x16a548||client;return _0xaa4e75[_0x847c('0x1f')](_0x4d4628,_0x3d335d)['then'](function(_0x5101f4){logger['info'](_0x847c('0x20'),_0x5292ac,'request\x20sent');logger[_0x847c('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5292ac,_0x847c('0x22'),JSON['stringify'](_0x5101f4));if(_0x5101f4[_0x847c('0x23')]){if(_0x5101f4[_0x847c('0x23')]['code']===0x1f4){logger[_0x847c('0x23')](_0x847c('0x20'),_0x5292ac,_0x5101f4['error'][_0x847c('0x24')]);return _0x1566ed(_0x5101f4[_0x847c('0x23')][_0x847c('0x24')]);}logger[_0x847c('0x23')](_0x847c('0x20'),_0x5292ac,_0x5101f4['error'][_0x847c('0x24')]);return _0x2c612e(_0x5101f4[_0x847c('0x23')][_0x847c('0x24')]);}else{logger[_0x847c('0x25')](_0x847c('0x20'),_0x5292ac,_0x847c('0x22'));_0x2c612e(_0x5101f4[_0x847c('0x26')][_0x847c('0x24')]);}})[_0x847c('0x27')](function(_0x39baab){logger[_0x847c('0x23')](_0x847c('0x20'),_0x5292ac,_0x39baab);_0x1566ed(_0x39baab);});});}function respondWithStatusCode(_0xcfe953,_0x4e1715){_0x4e1715=_0x4e1715||0xcc;return function(_0x41f665){if(_0x41f665){return _0xcfe953[_0x847c('0x28')](_0x4e1715);}return _0xcfe953[_0x847c('0x29')](_0x4e1715)['end']();};}function respondWithResult(_0x9f3a86,_0x29bc64){_0x29bc64=_0x29bc64||0xc8;return function(_0x1904ff){if(_0x1904ff){return _0x9f3a86[_0x847c('0x29')](_0x29bc64)[_0x847c('0x2a')](_0x1904ff);}};}function respondWithFilteredResult(_0x377d95,_0xf58eb7){return function(_0x1f2efc){if(_0x1f2efc){var _0x3d85a7=typeof _0xf58eb7[_0x847c('0x2b')]==='undefined'&&typeof _0xf58eb7['limit']===_0x847c('0x2c');var _0x261b84=_0x1f2efc['count'];var _0x463ce1=_0x3d85a7?0x0:_0xf58eb7[_0x847c('0x2b')];var _0x5b2b7e=_0x3d85a7?_0x1f2efc['count']:_0xf58eb7[_0x847c('0x2b')]+_0xf58eb7['limit'];var _0x49f0df;if(_0x5b2b7e>=_0x261b84){_0x5b2b7e=_0x261b84;_0x49f0df=0xc8;}else{_0x49f0df=0xce;}_0x377d95[_0x847c('0x29')](_0x49f0df);return _0x377d95[_0x847c('0x2d')](_0x847c('0x2e'),_0x463ce1+'-'+_0x5b2b7e+'/'+_0x261b84)[_0x847c('0x2a')](_0x1f2efc);}return null;};}function patchUpdates(_0x1806ef){return function(_0x43a649){try{jsonpatch[_0x847c('0x2f')](_0x43a649,_0x1806ef,!![]);}catch(_0x279b6e){return BPromise[_0x847c('0x30')](_0x279b6e);}return _0x43a649[_0x847c('0x31')]();};}function saveUpdates(_0x5d84ca,_0x46ced1){return function(_0x3e100a){if(_0x3e100a){return _0x3e100a[_0x847c('0x32')](_0x5d84ca)[_0x847c('0x33')](function(_0x1828f0){return _0x1828f0;});}return null;};}function removeEntity(_0x5c7271,_0x24202f){return function(_0x1e65ae){if(_0x1e65ae){return _0x1e65ae[_0x847c('0x34')]()[_0x847c('0x33')](function(){_0x5c7271[_0x847c('0x29')](0xcc)[_0x847c('0x35')]();});}};}function handleEntityNotFound(_0x2035b6,_0x1a7f79){return function(_0x3b9149){if(!_0x3b9149){_0x2035b6['sendStatus'](0x194);}return _0x3b9149;};}function handleError(_0x1d6ccd,_0xa4cfbe){_0xa4cfbe=_0xa4cfbe||0x1f4;return function(_0x41cb82){logger[_0x847c('0x23')](_0x41cb82[_0x847c('0x36')]);if(_0x41cb82[_0x847c('0x37')]){delete _0x41cb82['name'];}_0x1d6ccd[_0x847c('0x29')](_0xa4cfbe)['send'](_0x41cb82);};}exports[_0x847c('0x38')]=function(_0x2fefb3,_0x403c63){var _0x401ed3={},_0x49ea45={},_0x435ef8={'count':0x0,'rows':[]};var _0x2965f5=_['map'](db[_0x847c('0x39')][_0x847c('0x3a')],function(_0x7d3855){return{'name':_0x7d3855[_0x847c('0x3b')],'type':_0x7d3855[_0x847c('0x3c')]['key']};});_0x49ea45[_0x847c('0x3d')]=_['map'](_0x2965f5,_0x847c('0x37'));_0x49ea45[_0x847c('0x3e')]=_[_0x847c('0x3f')](_0x2fefb3[_0x847c('0x3e')]);_0x49ea45[_0x847c('0x40')]=_['intersection'](_0x49ea45['model'],_0x49ea45[_0x847c('0x3e')]);_0x401ed3['attributes']=_[_0x847c('0x41')](_0x49ea45[_0x847c('0x3d')],qs[_0x847c('0x42')](_0x2fefb3[_0x847c('0x3e')][_0x847c('0x42')]));_0x401ed3[_0x847c('0x43')]=_0x401ed3[_0x847c('0x43')][_0x847c('0x44')]?_0x401ed3[_0x847c('0x43')]:_0x49ea45[_0x847c('0x3d')];if(!_0x2fefb3[_0x847c('0x3e')][_0x847c('0x45')](_0x847c('0x46'))){_0x401ed3[_0x847c('0x47')]=qs['limit'](_0x2fefb3[_0x847c('0x3e')][_0x847c('0x47')]);_0x401ed3[_0x847c('0x2b')]=qs[_0x847c('0x2b')](_0x2fefb3[_0x847c('0x3e')][_0x847c('0x2b')]);}_0x401ed3[_0x847c('0x48')]=qs[_0x847c('0x49')](_0x2fefb3[_0x847c('0x3e')][_0x847c('0x49')]);_0x401ed3[_0x847c('0x4a')]=qs['filters'](_[_0x847c('0x4b')](_0x2fefb3['query'],_0x49ea45[_0x847c('0x40')]),_0x2965f5);if(_0x2fefb3[_0x847c('0x3e')]['filter']){_0x401ed3[_0x847c('0x4a')]=_[_0x847c('0x4c')](_0x401ed3[_0x847c('0x4a')],{'$or':_[_0x847c('0x4d')](_0x2965f5,function(_0x3528be){if(_0x3528be[_0x847c('0x3c')]!=='VIRTUAL'){var _0x1b064c={};_0x1b064c[_0x3528be['name']]={'$like':'%'+_0x2fefb3[_0x847c('0x3e')][_0x847c('0x4e')]+'%'};return _0x1b064c;}})});}_0x401ed3=_[_0x847c('0x4c')]({},_0x401ed3,_0x2fefb3[_0x847c('0x4f')]);var _0x46ab10={'where':_0x401ed3[_0x847c('0x4a')]};return db[_0x847c('0x39')]['count'](_0x46ab10)[_0x847c('0x33')](function(_0x2f6c64){_0x435ef8['count']=_0x2f6c64;if(_0x2fefb3['query']['includeAll']){_0x401ed3['include']=[{'all':!![]}];}return db[_0x847c('0x39')][_0x847c('0x50')](_0x401ed3);})['then'](function(_0x278c15){_0x435ef8['rows']=_0x278c15;return _0x435ef8;})[_0x847c('0x33')](respondWithFilteredResult(_0x403c63,_0x401ed3))[_0x847c('0x27')](handleError(_0x403c63,null));};exports[_0x847c('0x51')]=function(_0xe10aab,_0x4d42c5){var _0x41ed94={'raw':!![],'where':{'id':_0xe10aab[_0x847c('0x52')]['id']}},_0x4c20ab={};_0x4c20ab[_0x847c('0x3d')]=_[_0x847c('0x3f')](db[_0x847c('0x39')]['rawAttributes']);_0x4c20ab[_0x847c('0x3e')]=_[_0x847c('0x3f')](_0xe10aab[_0x847c('0x3e')]);_0x4c20ab[_0x847c('0x40')]=_[_0x847c('0x41')](_0x4c20ab[_0x847c('0x3d')],_0x4c20ab['query']);_0x41ed94[_0x847c('0x43')]=_[_0x847c('0x41')](_0x4c20ab[_0x847c('0x3d')],qs[_0x847c('0x42')](_0xe10aab[_0x847c('0x3e')][_0x847c('0x42')]));_0x41ed94[_0x847c('0x43')]=_0x41ed94[_0x847c('0x43')][_0x847c('0x44')]?_0x41ed94['attributes']:_0x4c20ab[_0x847c('0x3d')];if(_0xe10aab['query']['includeAll']){_0x41ed94[_0x847c('0x53')]=[{'all':!![]}];}_0x41ed94=_[_0x847c('0x4c')]({},_0x41ed94,_0xe10aab[_0x847c('0x4f')]);return db[_0x847c('0x39')][_0x847c('0x54')](_0x41ed94)[_0x847c('0x33')](handleEntityNotFound(_0x4d42c5,null))[_0x847c('0x33')](respondWithResult(_0x4d42c5,null))['catch'](handleError(_0x4d42c5,null));};exports[_0x847c('0x55')]=function(_0x5e57a9,_0x3c0d7e){return db[_0x847c('0x39')][_0x847c('0x55')](_0x5e57a9['body'],{})[_0x847c('0x33')](respondWithResult(_0x3c0d7e,0xc9))[_0x847c('0x27')](handleError(_0x3c0d7e,null));};exports['update']=function(_0x4562e5,_0x197541){if(_0x4562e5['body']['id']){delete _0x4562e5[_0x847c('0x56')]['id'];}return db['OpenchannelMessage'][_0x847c('0x54')]({'where':{'id':_0x4562e5[_0x847c('0x52')]['id']}})['then'](handleEntityNotFound(_0x197541,null))['then'](saveUpdates(_0x4562e5[_0x847c('0x56')],null))[_0x847c('0x33')](respondWithResult(_0x197541,null))['catch'](handleError(_0x197541,null));};exports['destroy']=function(_0x230b23,_0x366ab5){return db['OpenchannelMessage'][_0x847c('0x54')]({'where':{'id':_0x230b23[_0x847c('0x52')]['id']}})[_0x847c('0x33')](handleEntityNotFound(_0x366ab5,null))[_0x847c('0x33')](removeEntity(_0x366ab5,null))[_0x847c('0x27')](handleError(_0x366ab5,null));};exports[_0x847c('0x57')]=function(_0x3dcc50,_0x10edf5){return db['OpenchannelMessage'][_0x847c('0x57')]()[_0x847c('0x33')](respondWithResult(_0x10edf5,null))[_0x847c('0x27')](handleError(_0x10edf5,null));};var interaction_log=require(_0x847c('0x12'))(_0x847c('0x58'));exports['accept']=function(_0x11577b,_0xc0887c,_0x60f6af){var _0x289238={'agent':{},'channel':'openchannel'};if(_0x11577b['body']['id']){delete _0x11577b[_0x847c('0x56')]['id'];}_0x11577b['body'][_0x847c('0x59')]=!![];_0x11577b[_0x847c('0x56')]['readAt']=moment()['format'](_0x847c('0x5a'));_0x11577b['body'][_0x847c('0x5b')]=_0x11577b[_0x847c('0x56')][_0x847c('0x5b')]||_0x11577b[_0x847c('0x5c')]['id'];_0x289238['agent']['id']=_0x11577b[_0x847c('0x56')][_0x847c('0x5b')];return db['OpenchannelMessage']['find']({'where':{'id':_0x11577b[_0x847c('0x52')]['id'],'UserId':null}})[_0x847c('0x33')](handleEntityNotFound(_0xc0887c,null))[_0x847c('0x33')](saveUpdates(_0x11577b[_0x847c('0x56')],null))['then'](function(_0x2c6741){if(_0x2c6741){_0x289238['message']=_0x2c6741[_0x847c('0x5d')]({'plain':!![]});return db['OpenchannelInteraction'][_0x847c('0x54')]({'where':{'id':_0x2c6741[_0x847c('0x5e')]}});}return null;})[_0x847c('0x33')](handleEntityNotFound(_0xc0887c,null))[_0x847c('0x33')](function(_0x15b719){if(_0x15b719){return _0x15b719[_0x847c('0x32')]({'UserId':_0x11577b[_0x847c('0x56')]['UserId'],'read1stAt':_['isNil'](_0x15b719[_0x847c('0x5f')])?moment()[_0x847c('0x60')](_0x847c('0x5a')):undefined});}return null;})[_0x847c('0x33')](function(_0x1efd16){if(_0x1efd16){_0x289238[_0x847c('0x61')]=_0x1efd16[_0x847c('0x5d')]({'plain':!![]});interaction_log[_0x847c('0x25')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11577b[_0x847c('0x5c')]['id'],_0x11577b['user']['name'],_0x11577b[_0x847c('0x5c')][_0x847c('0x62')],_0x289238[_0x847c('0x61')]['id'],_0x11577b[_0x847c('0x56')]?JSON[_0x847c('0x63')](_0x11577b[_0x847c('0x56')]):_0x847c('0x64'));return respondWithRpcPromise(_0x847c('0x65'),_0x847c('0x66'),_0x289238);}return null;})['then'](function(_0x50fa8b){var _0x4ad17c=_0x847c('0x67')+_0x50fa8b['message'][_0x847c('0x68')];return db[_0x847c('0x69')][_0x847c('0x3e')](_0x4ad17c,{'type':db['Sequelize'][_0x847c('0x6a')][_0x847c('0x6b')],'raw':!![]})['then'](function(_0x60dce1){return _0x60dce1;});})[_0x847c('0x33')](function(_0x50b3c0){if(_0x50b3c0){_0x289238[_0x847c('0x24')]['contact']=_0x50b3c0[0x0];if(!_0x11577b[_0x847c('0x56')][_0x847c('0x5b')])return;return db['User'][_0x847c('0x54')]({'where':{'id':_0x11577b[_0x847c('0x56')][_0x847c('0x5b')],'role':_0x847c('0x6c')},'attributes':['id',_0x847c('0x37'),'fullname',_0x847c('0x6d'),'internal'],'raw':!![]});}return null;})[_0x847c('0x33')](function(_0x3f14cf){if(!_0x3f14cf)return null;_0x289238[_0x847c('0x24')][_0x847c('0x6c')]=_0x3f14cf;return _0x289238;})[_0x847c('0x33')](function(_0x27a9f2){if(_0x27a9f2){if(_0x11577b[_0x847c('0x56')][_0x847c('0x6e')]){_0x289238['message']['interface']=util['format'](_0x847c('0x6f'),_0x11577b[_0x847c('0x5c')][_0x847c('0x37')]);_0x289238[_0x847c('0x24')][_0x847c('0x70')]=_0x289238[_0x847c('0x70')];_0x289238[_0x847c('0x24')][_0x847c('0x71')]=_0x289238['channel'];_0x289238[_0x847c('0x24')][_0x847c('0x72')]=_0x847c('0x73');return respondWithRpcPromise('EventManager',_0x847c('0x74'),{'event':_0x847c('0x75'),'message':_0x289238[_0x847c('0x24')]},client9002)[_0x847c('0x33')](function(){return _0x289238;});}return _0x289238;}return null;})[_0x847c('0x33')](respondWithResult(_0xc0887c,null))[_0x847c('0x27')](handleError(_0xc0887c,null));};var interaction_log=require(_0x847c('0x12'))(_0x847c('0x58'));exports[_0x847c('0x30')]=function(_0x163d6b,_0x3eae38,_0x4d7204){var _0x34118e={'agent':{},'channel':_0x847c('0x76')};if(_0x163d6b[_0x847c('0x56')]['id']){delete _0x163d6b['body']['id'];}_0x163d6b[_0x847c('0x56')][_0x847c('0x5b')]=_0x163d6b[_0x847c('0x56')]['UserId']||_0x163d6b[_0x847c('0x5c')]['id'];_0x34118e['agent']['id']=_0x163d6b['body'][_0x847c('0x5b')];return db['OpenchannelMessage']['find']({'where':{'id':_0x163d6b[_0x847c('0x52')]['id'],'UserId':null}})[_0x847c('0x33')](handleEntityNotFound(_0x3eae38,null))[_0x847c('0x33')](function(_0x54566d){if(_0x54566d){_0x34118e[_0x847c('0x24')]=_0x54566d['get']({'plain':!![]});return db[_0x847c('0x77')][_0x847c('0x54')]({'where':{'id':_0x54566d['OpenchannelInteractionId']}});}return null;})[_0x847c('0x33')](handleEntityNotFound(_0x3eae38,null))[_0x847c('0x33')](function(_0x816a45){if(_0x816a45){_0x34118e['interaction']=_0x816a45[_0x847c('0x5d')]({'plain':!![]});interaction_log[_0x847c('0x25')](_0x847c('0x78'),_0x163d6b['user']['id'],_0x163d6b[_0x847c('0x5c')]['name'],_0x163d6b['user'][_0x847c('0x62')],_0x34118e['interaction']['id'],_0x163d6b[_0x847c('0x56')]?JSON[_0x847c('0x63')](_0x163d6b[_0x847c('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0x847c('0x79'),_0x34118e);}return null;})[_0x847c('0x33')](function(_0x3d87bc){var _0x4427f2=_0x847c('0x67')+_0x3d87bc['message'][_0x847c('0x68')];return db[_0x847c('0x69')][_0x847c('0x3e')](_0x4427f2,{'type':db[_0x847c('0x7a')][_0x847c('0x6a')][_0x847c('0x6b')],'raw':!![]})[_0x847c('0x33')](function(_0x530ed8){return _0x530ed8;});})[_0x847c('0x33')](function(_0xf52dcd){if(_0xf52dcd){_0x34118e[_0x847c('0x24')]['contact']=_0xf52dcd[0x0];if(!_0x163d6b[_0x847c('0x56')][_0x847c('0x5b')])return;return db[_0x847c('0x7b')][_0x847c('0x54')]({'where':{'id':_0x163d6b[_0x847c('0x56')][_0x847c('0x5b')],'role':_0x847c('0x6c')},'attributes':['id',_0x847c('0x37'),_0x847c('0x7c'),_0x847c('0x6d'),_0x847c('0x7d')],'raw':!![]});}return null;})[_0x847c('0x33')](function(_0xaca41b){if(!_0xaca41b)return null;_0x34118e[_0x847c('0x24')][_0x847c('0x6c')]=_0xaca41b;return _0x34118e;})[_0x847c('0x33')](function(_0x4a57ed){if(_0x4a57ed){_0x4a57ed['message'][_0x847c('0x7e')]=util['format'](_0x847c('0x6f'),_0x163d6b['user'][_0x847c('0x37')]);_0x4a57ed['message'][_0x847c('0x70')]=_0x34118e[_0x847c('0x70')];_0x4a57ed['message'][_0x847c('0x71')]=_0x34118e[_0x847c('0x70')];_0x4a57ed[_0x847c('0x24')][_0x847c('0x72')]=_0x847c('0x30');respondWithRpcPromise(_0x847c('0x74'),_0x847c('0x74'),{'event':_0x847c('0x7f'),'message':_0x4a57ed[_0x847c('0x24')]},client9002);return _0x34118e;}return null;})[_0x847c('0x33')](respondWithResult(_0x3eae38,null))[_0x847c('0x27')](handleError(_0x3eae38,null));}; \ No newline at end of file +var _0xb681=['Content-Range','reject','save','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','show','intersection','find','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','email','internal','manual','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','role','RejectMessage','rejectMessage','User','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x169c83,_0xe00242){var _0x3ef8e1=function(_0x307f9c){while(--_0x307f9c){_0x169c83['push'](_0x169c83['shift']());}};_0x3ef8e1(++_0xe00242);}(_0xb681,0x153));var _0x1b68=function(_0x2cfd04,_0xba58){_0x2cfd04=_0x2cfd04-0x0;var _0x30de2d=_0xb681[_0x2cfd04];return _0x30de2d;};'use strict';var emlformat=require(_0x1b68('0x0'));var rimraf=require(_0x1b68('0x1'));var zipdir=require(_0x1b68('0x2'));var jsonpatch=require(_0x1b68('0x3'));var rp=require(_0x1b68('0x4'));var moment=require(_0x1b68('0x5'));var BPromise=require(_0x1b68('0x6'));var Mustache=require(_0x1b68('0x7'));var util=require(_0x1b68('0x8'));var path=require(_0x1b68('0x9'));var sox=require('sox');var csv=require(_0x1b68('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b68('0xb'));var _=require(_0x1b68('0xc'));var squel=require(_0x1b68('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1b68('0xe'));var Redis=require(_0x1b68('0xf'));var authService=require(_0x1b68('0x10'));var qs=require(_0x1b68('0x11'));var as=require(_0x1b68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b68('0x13'))('api');var utils=require(_0x1b68('0x14'));var config=require(_0x1b68('0x15'));var licenseUtil=require(_0x1b68('0x16'));var db=require(_0x1b68('0x17'))['db'];config[_0x1b68('0x18')]=_[_0x1b68('0x19')](config[_0x1b68('0x18')],{'host':_0x1b68('0x1a'),'port':0x18eb});var socket=require(_0x1b68('0x1b'))(new Redis(config[_0x1b68('0x18')]));require(_0x1b68('0x1c'))[_0x1b68('0x1d')](socket);var jayson=require(_0x1b68('0x1e'));var client=jayson[_0x1b68('0x1f')][_0x1b68('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x1b68('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2b9f85,_0x585a4b,_0x1c7742,_0x39e88d){return new BPromise(function(_0x2255cf,_0x11e1ca){var _0x138fe8=_0x39e88d||client;return _0x138fe8[_0x1b68('0x21')](_0x2b9f85,_0x1c7742)[_0x1b68('0x22')](function(_0x8d4ea8){logger[_0x1b68('0x23')](_0x1b68('0x24'),_0x585a4b,_0x1b68('0x25'));logger[_0x1b68('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x585a4b,'request\x20sent',JSON['stringify'](_0x8d4ea8));if(_0x8d4ea8[_0x1b68('0x27')]){if(_0x8d4ea8[_0x1b68('0x27')]['code']===0x1f4){logger[_0x1b68('0x27')](_0x1b68('0x24'),_0x585a4b,_0x8d4ea8[_0x1b68('0x27')][_0x1b68('0x28')]);return _0x11e1ca(_0x8d4ea8[_0x1b68('0x27')][_0x1b68('0x28')]);}logger['error'](_0x1b68('0x24'),_0x585a4b,_0x8d4ea8['error']['message']);return _0x2255cf(_0x8d4ea8['error'][_0x1b68('0x28')]);}else{logger[_0x1b68('0x23')](_0x1b68('0x24'),_0x585a4b,_0x1b68('0x25'));_0x2255cf(_0x8d4ea8[_0x1b68('0x29')][_0x1b68('0x28')]);}})[_0x1b68('0x2a')](function(_0x4b99f8){logger[_0x1b68('0x27')](_0x1b68('0x24'),_0x585a4b,_0x4b99f8);_0x11e1ca(_0x4b99f8);});});}function respondWithStatusCode(_0x506e4c,_0xc946aa){_0xc946aa=_0xc946aa||0xcc;return function(_0x3b1d72){if(_0x3b1d72){return _0x506e4c[_0x1b68('0x2b')](_0xc946aa);}return _0x506e4c['status'](_0xc946aa)['end']();};}function respondWithResult(_0x14e844,_0x191cc7){_0x191cc7=_0x191cc7||0xc8;return function(_0x3eb5e5){if(_0x3eb5e5){return _0x14e844[_0x1b68('0x2c')](_0x191cc7)[_0x1b68('0x2d')](_0x3eb5e5);}};}function respondWithFilteredResult(_0x3566bc,_0x73f793){return function(_0x26cdba){if(_0x26cdba){var _0x42260f=typeof _0x73f793[_0x1b68('0x2e')]===_0x1b68('0x2f')&&typeof _0x73f793[_0x1b68('0x30')]===_0x1b68('0x2f');var _0x553e84=_0x26cdba[_0x1b68('0x31')];var _0x39deb5=_0x42260f?0x0:_0x73f793[_0x1b68('0x2e')];var _0x57edb5=_0x42260f?_0x26cdba[_0x1b68('0x31')]:_0x73f793[_0x1b68('0x2e')]+_0x73f793[_0x1b68('0x30')];var _0x193422;if(_0x57edb5>=_0x553e84){_0x57edb5=_0x553e84;_0x193422=0xc8;}else{_0x193422=0xce;}_0x3566bc[_0x1b68('0x2c')](_0x193422);return _0x3566bc[_0x1b68('0x32')](_0x1b68('0x33'),_0x39deb5+'-'+_0x57edb5+'/'+_0x553e84)[_0x1b68('0x2d')](_0x26cdba);}return null;};}function patchUpdates(_0x5aa1e){return function(_0x303e87){try{jsonpatch['apply'](_0x303e87,_0x5aa1e,!![]);}catch(_0x37968e){return BPromise[_0x1b68('0x34')](_0x37968e);}return _0x303e87[_0x1b68('0x35')]();};}function saveUpdates(_0x57d166,_0x20aae9){return function(_0x42bce3){if(_0x42bce3){return _0x42bce3[_0x1b68('0x36')](_0x57d166)[_0x1b68('0x22')](function(_0x246b4d){return _0x246b4d;});}return null;};}function removeEntity(_0x3de95b,_0x291eb9){return function(_0x1deb33){if(_0x1deb33){return _0x1deb33[_0x1b68('0x37')]()['then'](function(){_0x3de95b[_0x1b68('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29693d,_0x3ab765){return function(_0x2d2627){if(!_0x2d2627){_0x29693d[_0x1b68('0x2b')](0x194);}return _0x2d2627;};}function handleError(_0x21b46c,_0x20b6ab){_0x20b6ab=_0x20b6ab||0x1f4;return function(_0x37f89b){logger[_0x1b68('0x27')](_0x37f89b[_0x1b68('0x38')]);if(_0x37f89b['name']){delete _0x37f89b[_0x1b68('0x39')];}_0x21b46c[_0x1b68('0x2c')](_0x20b6ab)[_0x1b68('0x3a')](_0x37f89b);};}exports['index']=function(_0x365a45,_0x16aa06){var _0x31259d={},_0x480dd1={},_0x590517={'count':0x0,'rows':[]};var _0x5e3ee4=_[_0x1b68('0x3b')](db[_0x1b68('0x3c')][_0x1b68('0x3d')],function(_0xc74179){return{'name':_0xc74179[_0x1b68('0x3e')],'type':_0xc74179[_0x1b68('0x3f')][_0x1b68('0x40')]};});_0x480dd1[_0x1b68('0x41')]=_[_0x1b68('0x3b')](_0x5e3ee4,'name');_0x480dd1[_0x1b68('0x42')]=_[_0x1b68('0x43')](_0x365a45[_0x1b68('0x42')]);_0x480dd1[_0x1b68('0x44')]=_['intersection'](_0x480dd1[_0x1b68('0x41')],_0x480dd1['query']);_0x31259d['attributes']=_['intersection'](_0x480dd1[_0x1b68('0x41')],qs['fields'](_0x365a45[_0x1b68('0x42')][_0x1b68('0x45')]));_0x31259d['attributes']=_0x31259d[_0x1b68('0x46')][_0x1b68('0x47')]?_0x31259d[_0x1b68('0x46')]:_0x480dd1['model'];if(!_0x365a45[_0x1b68('0x42')][_0x1b68('0x48')](_0x1b68('0x49'))){_0x31259d[_0x1b68('0x30')]=qs[_0x1b68('0x30')](_0x365a45[_0x1b68('0x42')]['limit']);_0x31259d[_0x1b68('0x2e')]=qs[_0x1b68('0x2e')](_0x365a45['query'][_0x1b68('0x2e')]);}_0x31259d[_0x1b68('0x4a')]=qs['sort'](_0x365a45['query'][_0x1b68('0x4b')]);_0x31259d[_0x1b68('0x4c')]=qs[_0x1b68('0x44')](_[_0x1b68('0x4d')](_0x365a45[_0x1b68('0x42')],_0x480dd1[_0x1b68('0x44')]),_0x5e3ee4);if(_0x365a45[_0x1b68('0x42')][_0x1b68('0x4e')]){_0x31259d[_0x1b68('0x4c')]=_[_0x1b68('0x4f')](_0x31259d['where'],{'$or':_[_0x1b68('0x3b')](_0x5e3ee4,function(_0x323f90){if(_0x323f90[_0x1b68('0x3f')]!=='VIRTUAL'){var _0x383e14={};_0x383e14[_0x323f90['name']]={'$like':'%'+_0x365a45[_0x1b68('0x42')][_0x1b68('0x4e')]+'%'};return _0x383e14;}})});}_0x31259d=_[_0x1b68('0x4f')]({},_0x31259d,_0x365a45['options']);var _0x29ff70={'where':_0x31259d[_0x1b68('0x4c')]};return db['OpenchannelMessage'][_0x1b68('0x31')](_0x29ff70)[_0x1b68('0x22')](function(_0x17c3e7){_0x590517['count']=_0x17c3e7;if(_0x365a45['query'][_0x1b68('0x50')]){_0x31259d[_0x1b68('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x31259d);})['then'](function(_0x3e2933){_0x590517[_0x1b68('0x52')]=_0x3e2933;return _0x590517;})[_0x1b68('0x22')](respondWithFilteredResult(_0x16aa06,_0x31259d))['catch'](handleError(_0x16aa06,null));};exports[_0x1b68('0x53')]=function(_0x37af7f,_0x109116){var _0x2f8a77={'raw':!![],'where':{'id':_0x37af7f['params']['id']}},_0x1025cc={};_0x1025cc[_0x1b68('0x41')]=_[_0x1b68('0x43')](db[_0x1b68('0x3c')][_0x1b68('0x3d')]);_0x1025cc[_0x1b68('0x42')]=_[_0x1b68('0x43')](_0x37af7f[_0x1b68('0x42')]);_0x1025cc[_0x1b68('0x44')]=_[_0x1b68('0x54')](_0x1025cc[_0x1b68('0x41')],_0x1025cc[_0x1b68('0x42')]);_0x2f8a77['attributes']=_['intersection'](_0x1025cc[_0x1b68('0x41')],qs[_0x1b68('0x45')](_0x37af7f['query'][_0x1b68('0x45')]));_0x2f8a77[_0x1b68('0x46')]=_0x2f8a77['attributes'][_0x1b68('0x47')]?_0x2f8a77['attributes']:_0x1025cc[_0x1b68('0x41')];if(_0x37af7f['query']['includeAll']){_0x2f8a77[_0x1b68('0x51')]=[{'all':!![]}];}_0x2f8a77=_[_0x1b68('0x4f')]({},_0x2f8a77,_0x37af7f['options']);return db['OpenchannelMessage'][_0x1b68('0x55')](_0x2f8a77)['then'](handleEntityNotFound(_0x109116,null))[_0x1b68('0x22')](respondWithResult(_0x109116,null))[_0x1b68('0x2a')](handleError(_0x109116,null));};exports['create']=function(_0x491237,_0x8c9a56){return db[_0x1b68('0x3c')]['create'](_0x491237[_0x1b68('0x56')],{})['then'](respondWithResult(_0x8c9a56,0xc9))[_0x1b68('0x2a')](handleError(_0x8c9a56,null));};exports['update']=function(_0x363699,_0x4612a1){if(_0x363699['body']['id']){delete _0x363699[_0x1b68('0x56')]['id'];}return db[_0x1b68('0x3c')]['find']({'where':{'id':_0x363699['params']['id']}})[_0x1b68('0x22')](handleEntityNotFound(_0x4612a1,null))['then'](saveUpdates(_0x363699[_0x1b68('0x56')],null))[_0x1b68('0x22')](respondWithResult(_0x4612a1,null))['catch'](handleError(_0x4612a1,null));};exports[_0x1b68('0x37')]=function(_0x3eab55,_0xb9411c){return db['OpenchannelMessage'][_0x1b68('0x55')]({'where':{'id':_0x3eab55[_0x1b68('0x57')]['id']}})[_0x1b68('0x22')](handleEntityNotFound(_0xb9411c,null))['then'](removeEntity(_0xb9411c,null))[_0x1b68('0x2a')](handleError(_0xb9411c,null));};exports[_0x1b68('0x58')]=function(_0xa12791,_0x52ec8a){return db[_0x1b68('0x3c')][_0x1b68('0x58')]()[_0x1b68('0x22')](respondWithResult(_0x52ec8a,null))[_0x1b68('0x2a')](handleError(_0x52ec8a,null));};var interaction_log=require('../../config/logger')(_0x1b68('0x59'));exports[_0x1b68('0x5a')]=function(_0x55c106,_0x1364e0,_0x383785){var _0x4e005f={'agent':{},'channel':_0x1b68('0x5b')};if(_0x55c106[_0x1b68('0x56')]['id']){delete _0x55c106[_0x1b68('0x56')]['id'];}_0x55c106[_0x1b68('0x56')][_0x1b68('0x5c')]=!![];_0x55c106[_0x1b68('0x56')][_0x1b68('0x5d')]=moment()['format'](_0x1b68('0x5e'));_0x55c106[_0x1b68('0x56')]['UserId']=_0x55c106[_0x1b68('0x56')][_0x1b68('0x5f')]||_0x55c106['user']['id'];_0x4e005f[_0x1b68('0x60')]['id']=_0x55c106[_0x1b68('0x56')]['UserId'];return db[_0x1b68('0x3c')][_0x1b68('0x55')]({'where':{'id':_0x55c106[_0x1b68('0x57')]['id'],'UserId':null}})[_0x1b68('0x22')](handleEntityNotFound(_0x1364e0,null))[_0x1b68('0x22')](saveUpdates(_0x55c106[_0x1b68('0x56')],null))[_0x1b68('0x22')](function(_0x39ed4d){if(_0x39ed4d){_0x4e005f['message']=_0x39ed4d[_0x1b68('0x61')]({'plain':!![]});return db[_0x1b68('0x62')]['find']({'where':{'id':_0x39ed4d[_0x1b68('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x1364e0,null))[_0x1b68('0x22')](function(_0x9fab30){if(_0x9fab30){return _0x9fab30[_0x1b68('0x36')]({'UserId':_0x55c106[_0x1b68('0x56')][_0x1b68('0x5f')],'read1stAt':_[_0x1b68('0x64')](_0x9fab30['read1stAt'])?moment()['format'](_0x1b68('0x5e')):undefined});}return null;})[_0x1b68('0x22')](function(_0x587833){if(_0x587833){_0x4e005f[_0x1b68('0x65')]=_0x587833[_0x1b68('0x61')]({'plain':!![]});interaction_log[_0x1b68('0x23')](_0x1b68('0x66'),_0x55c106[_0x1b68('0x67')]['id'],_0x55c106[_0x1b68('0x67')]['name'],_0x55c106[_0x1b68('0x67')]['role'],_0x4e005f[_0x1b68('0x65')]['id'],_0x55c106[_0x1b68('0x56')]?JSON[_0x1b68('0x68')](_0x55c106[_0x1b68('0x56')]):_0x1b68('0x69'));return respondWithRpcPromise(_0x1b68('0x6a'),_0x1b68('0x6b'),_0x4e005f);}return null;})['then'](function(_0x97f2f9){var _0x268453=_0x1b68('0x6c')+_0x97f2f9[_0x1b68('0x28')][_0x1b68('0x6d')];return db[_0x1b68('0x6e')][_0x1b68('0x42')](_0x268453,{'type':db[_0x1b68('0x6f')][_0x1b68('0x70')]['SELECT'],'raw':!![]})[_0x1b68('0x22')](function(_0x75c352){return _0x75c352;});})['then'](function(_0x149d6e){if(_0x149d6e){_0x4e005f[_0x1b68('0x28')][_0x1b68('0x71')]=_0x149d6e[0x0];if(!_0x55c106['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x55c106[_0x1b68('0x56')][_0x1b68('0x5f')],'role':_0x1b68('0x60')},'attributes':['id','name','fullname',_0x1b68('0x72'),_0x1b68('0x73')],'raw':!![]});}return null;})['then'](function(_0x4ae570){if(!_0x4ae570)return null;_0x4e005f[_0x1b68('0x28')][_0x1b68('0x60')]=_0x4ae570;return _0x4e005f;})[_0x1b68('0x22')](function(_0xc01359){if(_0xc01359){if(_0x55c106[_0x1b68('0x56')][_0x1b68('0x74')]){_0x4e005f['message'][_0x1b68('0x75')]=util[_0x1b68('0x76')](_0x1b68('0x77'),_0x55c106[_0x1b68('0x67')][_0x1b68('0x39')]);_0x4e005f[_0x1b68('0x28')][_0x1b68('0x78')]=_0x4e005f[_0x1b68('0x78')];_0x4e005f['message']['motionChannel']=_0x4e005f[_0x1b68('0x78')];_0x4e005f['message'][_0x1b68('0x79')]='accept';return respondWithRpcPromise(_0x1b68('0x7a'),_0x1b68('0x7a'),{'event':_0x1b68('0x7b'),'message':_0x4e005f['message']},client9002)[_0x1b68('0x22')](function(){return _0x4e005f;});}return _0x4e005f;}return null;})[_0x1b68('0x22')](respondWithResult(_0x1364e0,null))[_0x1b68('0x2a')](handleError(_0x1364e0,null));};var interaction_log=require(_0x1b68('0x13'))(_0x1b68('0x59'));exports[_0x1b68('0x34')]=function(_0xddae3e,_0x211708,_0x4d3b49){var _0x583a1d={'agent':{},'channel':_0x1b68('0x5b')};if(_0xddae3e['body']['id']){delete _0xddae3e['body']['id'];}_0xddae3e['body']['UserId']=_0xddae3e[_0x1b68('0x56')]['UserId']||_0xddae3e[_0x1b68('0x67')]['id'];_0x583a1d[_0x1b68('0x60')]['id']=_0xddae3e[_0x1b68('0x56')]['UserId'];return db['OpenchannelMessage'][_0x1b68('0x55')]({'where':{'id':_0xddae3e[_0x1b68('0x57')]['id'],'UserId':null}})[_0x1b68('0x22')](handleEntityNotFound(_0x211708,null))['then'](function(_0x397a58){if(_0x397a58){_0x583a1d['message']=_0x397a58[_0x1b68('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1b68('0x55')]({'where':{'id':_0x397a58[_0x1b68('0x63')]}});}return null;})[_0x1b68('0x22')](handleEntityNotFound(_0x211708,null))[_0x1b68('0x22')](function(_0x7abb49){if(_0x7abb49){_0x583a1d[_0x1b68('0x65')]=_0x7abb49[_0x1b68('0x61')]({'plain':!![]});interaction_log[_0x1b68('0x23')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xddae3e[_0x1b68('0x67')]['id'],_0xddae3e[_0x1b68('0x67')]['name'],_0xddae3e['user'][_0x1b68('0x7c')],_0x583a1d[_0x1b68('0x65')]['id'],_0xddae3e[_0x1b68('0x56')]?JSON['stringify'](_0xddae3e[_0x1b68('0x56')]):_0x1b68('0x69'));return respondWithRpcPromise(_0x1b68('0x7d'),_0x1b68('0x7e'),_0x583a1d);}return null;})[_0x1b68('0x22')](function(_0xa008c8){var _0x1e8645=_0x1b68('0x6c')+_0xa008c8[_0x1b68('0x28')][_0x1b68('0x6d')];return db['sequelize'][_0x1b68('0x42')](_0x1e8645,{'type':db[_0x1b68('0x6f')][_0x1b68('0x70')]['SELECT'],'raw':!![]})[_0x1b68('0x22')](function(_0x2cfb29){return _0x2cfb29;});})[_0x1b68('0x22')](function(_0x327cc4){if(_0x327cc4){_0x583a1d[_0x1b68('0x28')][_0x1b68('0x71')]=_0x327cc4[0x0];if(!_0xddae3e['body'][_0x1b68('0x5f')])return;return db[_0x1b68('0x7f')][_0x1b68('0x55')]({'where':{'id':_0xddae3e['body'][_0x1b68('0x5f')],'role':'agent'},'attributes':['id','name','fullname',_0x1b68('0x72'),_0x1b68('0x73')],'raw':!![]});}return null;})[_0x1b68('0x22')](function(_0x2ffc2f){if(!_0x2ffc2f)return null;_0x583a1d[_0x1b68('0x28')][_0x1b68('0x60')]=_0x2ffc2f;return _0x583a1d;})[_0x1b68('0x22')](function(_0x2b45b1){if(_0x2b45b1){_0x2b45b1['message']['interface']=util[_0x1b68('0x76')]('SIP/%s',_0xddae3e[_0x1b68('0x67')][_0x1b68('0x39')]);_0x2b45b1[_0x1b68('0x28')][_0x1b68('0x78')]=_0x583a1d[_0x1b68('0x78')];_0x2b45b1['message'][_0x1b68('0x80')]=_0x583a1d[_0x1b68('0x78')];_0x2b45b1[_0x1b68('0x28')][_0x1b68('0x79')]=_0x1b68('0x34');respondWithRpcPromise(_0x1b68('0x7a'),_0x1b68('0x7a'),{'event':_0x1b68('0x81'),'message':_0x2b45b1['message']},client9002);return _0x583a1d;}return null;})[_0x1b68('0x22')](respondWithResult(_0x211708,null))['catch'](handleError(_0x211708,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 99ca900..fd07e8e 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 _0x4b07=['emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x1ce25a,_0x46b990){var _0x5c6db8=function(_0x7cea){while(--_0x7cea){_0x1ce25a['push'](_0x1ce25a['shift']());}};_0x5c6db8(++_0x46b990);}(_0x4b07,0x16b));var _0x74b0=function(_0x29ccdd,_0x4f3d58){_0x29ccdd=_0x29ccdd-0x0;var _0x192ad4=_0x4b07[_0x29ccdd];return _0x192ad4;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x74b0('0x0'))['db'][_0x74b0('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x74b0('0x2')](0x0);var events={'afterCreate':_0x74b0('0x3'),'afterUpdate':_0x74b0('0x4'),'afterDestroy':_0x74b0('0x5')};function emitEvent(_0x261661){return function(_0x116cbb,_0x733dc8,_0x2869b6){OpenchannelMessageEvents[_0x74b0('0x6')](_0x261661+':'+_0x116cbb['id'],_0x116cbb);OpenchannelMessageEvents['emit'](_0x261661,_0x116cbb);_0x2869b6(null);};}for(var e in events){if(events[_0x74b0('0x7')](e)){var event=events[e];OpenchannelMessage[_0x74b0('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xbc4b=['setMaxListeners','update','remove','emit','hook','events'];(function(_0x1b425a,_0xe6f57b){var _0x5a60ed=function(_0x16d301){while(--_0x16d301){_0x1b425a['push'](_0x1b425a['shift']());}};_0x5a60ed(++_0xe6f57b);}(_0xbc4b,0x16d));var _0xbbc4=function(_0x55d7ca,_0x37b8b6){_0x55d7ca=_0x55d7ca-0x0;var _0xddab10=_0xbc4b[_0x55d7ca];return _0xddab10;};'use strict';var EventEmitter=require(_0xbbc4('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbbc4('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbbc4('0x2'),'afterDestroy':_0xbbc4('0x3')};function emitEvent(_0x1d3dd1){return function(_0x3f271e,_0x4f5db9,_0x4c0c10){OpenchannelMessageEvents[_0xbbc4('0x4')](_0x1d3dd1+':'+_0x3f271e['id'],_0x3f271e);OpenchannelMessageEvents['emit'](_0x1d3dd1,_0x3f271e);_0x4c0c10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xbbc4('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 96ef166..527ec5e 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 _0x8422=['update','afterCreate','inspect','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','catch','error','CmContact','describe','find','OpenchannelAccountId','keys','then','info','OpenchannelMessage,\x20%s,\x20%s','format','Interactions','Interaction','Contact','POST','replyUri','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId'];(function(_0x1b0d6a,_0x41ad9d){var _0x17950e=function(_0x29e2e8){while(--_0x29e2e8){_0x1b0d6a['push'](_0x1b0d6a['shift']());}};_0x17950e(++_0x41ad9d);}(_0x8422,0x137));var _0x2842=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x8422[_0x29b609];return _0x54c952;};'use strict';var _=require('lodash');var util=require(_0x2842('0x0'));var logger=require(_0x2842('0x1'))(_0x2842('0x2'));var moment=require(_0x2842('0x3'));var BPromise=require(_0x2842('0x4'));var rp=require(_0x2842('0x5'));var fs=require('fs');var path=require(_0x2842('0x6'));var rimraf=require(_0x2842('0x7'));var config=require(_0x2842('0x8'));var attributes=require(_0x2842('0x9'));module[_0x2842('0xa')]=function(_0x330a22,_0x5f114d){return _0x330a22[_0x2842('0xb')](_0x2842('0xc'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x2842('0xd'),'fields':[_0x2842('0xe')],'type':_0x2842('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x274f94,_0x463ca8,_0x580311){var _0x219ff3=_0x330a22[_0x2842('0x10')];var _0x32d18b=_0x274f94['get']({'plain':!![]});if(_0x32d18b[_0x2842('0x11')][_0x2842('0x12')]()==='in'||_0x32d18b[_0x2842('0x11')][_0x2842('0x12')]()===_0x2842('0x13')&&!_0x32d18b[_0x2842('0x14')]&&!_[_0x2842('0x15')](_0x32d18b[_0x2842('0x16')])){_0x219ff3[_0x2842('0x17')][_0x2842('0x18')]({'where':{'id':_0x32d18b[_0x2842('0x19')]}})['then'](function(_0x7f6e05){if(_0x7f6e05){_0x7f6e05['update']({'lastMsgAt':_0x32d18b['createdAt'],'lastMsgDirection':_0x32d18b[_0x2842('0x11')][_0x2842('0x12')]()});}})[_0x2842('0x1a')](function(_0x39a904){console[_0x2842('0x1b')](_0x39a904);});}if(_0x32d18b[_0x2842('0x11')]===_0x2842('0x13')&&!_0x32d18b[_0x2842('0x14')]){var _0x2b2e59;_0x219ff3[_0x2842('0x1c')][_0x2842('0x1d')]()['then'](function(_0x4eb722){return _0x219ff3['OpenchannelAccount'][_0x2842('0x1e')]({'where':{'id':_0x32d18b[_0x2842('0x1f')]},'include':[{'model':_0x219ff3['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x32d18b['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x219ff3[_0x2842('0x1c')],'as':'Contact','attributes':_[_0x2842('0x20')](_0x4eb722)}]}]});})[_0x2842('0x21')](function(_0x5acf80){_0x2b2e59=_0x5acf80['get']({'plain':!![]});if(_0x2b2e59&&_0x2b2e59['replyUri']){logger[_0x2842('0x22')](_0x2842('0x23'),'afterCreate',util[_0x2842('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x32d18b['id'],_0x2b2e59['replyUri']));if(_0x2b2e59[_0x2842('0x25')]&&_0x2b2e59[_0x2842('0x25')]['length']){_0x32d18b[_0x2842('0x26')]=_['omit'](_0x2b2e59[_0x2842('0x25')][0x0],_0x2842('0x27'));_0x32d18b['Contact']=_0x2b2e59[_0x2842('0x25')][0x0]['Contact'];}var _0x463ca8={'method':_0x2842('0x28'),'uri':encodeURI(_0x2b2e59[_0x2842('0x29')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x463ca8[_0x2842('0x2a')]){case _0x2842('0x2b'):_0x463ca8['qs']=_0x32d18b;break;case _0x2842('0x28'):_0x463ca8['body']=_0x32d18b;break;}return rp(_0x463ca8)[_0x2842('0x21')](function(_0x534ebc){logger['info'](_0x2842('0x23'),'afterCreate',util[_0x2842('0x24')](_0x2842('0x2c'),_0x32d18b['id'],_0x2b2e59[_0x2842('0x29')]));if(_0x534ebc['body'][_0x2842('0x2d')]&&_0x534ebc[_0x2842('0xe')][_0x2842('0x2d')]!=_0x32d18b['Interaction'][_0x2842('0x2d')]){return _0x219ff3[_0x2842('0x17')]['update']({'threadId':_0x534ebc[_0x2842('0xe')]['threadId']},{'where':{'id':_0x32d18b['Interaction']['id']}});}else{return;}})[_0x2842('0x21')](function(){return _0x274f94[_0x2842('0x2e')]({'read':!![]});})['catch'](function(_0x2299e3){logger[_0x2842('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0x2842('0x2f'),util[_0x2842('0x30')](_0x2299e3,{'showHidden':![],'depth':null}));_0x580311();});}else{_0x580311();}})[_0x2842('0x31')](function(){_0x580311();});}else{_0x580311();}}},'charset':_0x2842('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcce4=['replyUri','length','Interaction','omit','POST','method','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','Interactions','Contact','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x1199ed,_0x5a4baf){var _0x463e40=function(_0x247ad4){while(--_0x247ad4){_0x1199ed['push'](_0x1199ed['shift']());}};_0x463e40(++_0x5a4baf);}(_0xcce4,0x14b));var _0x4cce=function(_0xdad237,_0x361a1d){_0xdad237=_0xdad237-0x0;var _0x15c575=_0xcce4[_0xdad237];return _0x15c575;};'use strict';var _=require(_0x4cce('0x0'));var util=require(_0x4cce('0x1'));var logger=require(_0x4cce('0x2'))(_0x4cce('0x3'));var moment=require(_0x4cce('0x4'));var BPromise=require('bluebird');var rp=require(_0x4cce('0x5'));var fs=require('fs');var path=require(_0x4cce('0x6'));var rimraf=require(_0x4cce('0x7'));var config=require(_0x4cce('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0x4cce('0x9')]=function(_0x1ac78d,_0x5c9efb){return _0x1ac78d[_0x4cce('0xa')](_0x4cce('0xb'),attributes,{'tableName':_0x4cce('0xc'),'paranoid':![],'indexes':[{'name':_0x4cce('0xd'),'fields':[_0x4cce('0xe')],'type':_0x4cce('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57d777,_0x2d3bcf,_0x4fa99b){var _0x2c9c9d=_0x1ac78d[_0x4cce('0x10')];var _0xbfea0d=_0x57d777['get']({'plain':!![]});if(_0xbfea0d[_0x4cce('0x11')][_0x4cce('0x12')]()==='in'||_0xbfea0d[_0x4cce('0x11')][_0x4cce('0x12')]()===_0x4cce('0x13')&&!_0xbfea0d[_0x4cce('0x14')]&&!_[_0x4cce('0x15')](_0xbfea0d[_0x4cce('0x16')])){_0x2c9c9d[_0x4cce('0x17')][_0x4cce('0x18')]({'where':{'id':_0xbfea0d[_0x4cce('0x19')]}})['then'](function(_0x1caf9f){if(_0x1caf9f){_0x1caf9f[_0x4cce('0x1a')]({'lastMsgAt':_0xbfea0d[_0x4cce('0x1b')],'lastMsgDirection':_0xbfea0d[_0x4cce('0x11')][_0x4cce('0x12')]()});}})[_0x4cce('0x1c')](function(_0x2e9479){console[_0x4cce('0x1d')](_0x2e9479);});}if(_0xbfea0d[_0x4cce('0x11')]==='out'&&!_0xbfea0d[_0x4cce('0x14')]){var _0x244b93;_0x2c9c9d[_0x4cce('0x1e')][_0x4cce('0x1f')]()[_0x4cce('0x20')](function(_0x42e032){return _0x2c9c9d[_0x4cce('0x21')][_0x4cce('0x22')]({'where':{'id':_0xbfea0d['OpenchannelAccountId']},'include':[{'model':_0x2c9c9d[_0x4cce('0x17')],'as':_0x4cce('0x23'),'where':{'id':_0xbfea0d[_0x4cce('0x19')]},'limit':0x1,'include':[{'model':_0x2c9c9d[_0x4cce('0x1e')],'as':_0x4cce('0x24'),'attributes':_['keys'](_0x42e032)}]}]});})[_0x4cce('0x20')](function(_0x53ddac){_0x244b93=_0x53ddac['get']({'plain':!![]});if(_0x244b93&&_0x244b93['replyUri']){logger['info'](_0x4cce('0x25'),'afterCreate',util[_0x4cce('0x26')](_0x4cce('0x27'),_0xbfea0d['id'],_0x244b93[_0x4cce('0x28')]));if(_0x244b93[_0x4cce('0x23')]&&_0x244b93[_0x4cce('0x23')][_0x4cce('0x29')]){_0xbfea0d[_0x4cce('0x2a')]=_[_0x4cce('0x2b')](_0x244b93['Interactions'][0x0],_0x4cce('0x24'));_0xbfea0d[_0x4cce('0x24')]=_0x244b93[_0x4cce('0x23')][0x0][_0x4cce('0x24')];}var _0x2d3bcf={'method':_0x4cce('0x2c'),'uri':encodeURI(_0x244b93[_0x4cce('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2d3bcf[_0x4cce('0x2d')]){case'GET':_0x2d3bcf['qs']=_0xbfea0d;break;case'POST':_0x2d3bcf[_0x4cce('0xe')]=_0xbfea0d;break;}return rp(_0x2d3bcf)[_0x4cce('0x20')](function(_0x53c0d1){logger[_0x4cce('0x2e')](_0x4cce('0x25'),_0x4cce('0x2f'),util[_0x4cce('0x26')](_0x4cce('0x30'),_0xbfea0d['id'],_0x244b93[_0x4cce('0x28')]));if(_0x53c0d1[_0x4cce('0xe')][_0x4cce('0x31')]&&_0x53c0d1[_0x4cce('0xe')]['threadId']!=_0xbfea0d[_0x4cce('0x2a')][_0x4cce('0x31')]){return _0x2c9c9d[_0x4cce('0x17')][_0x4cce('0x1a')]({'threadId':_0x53c0d1['body'][_0x4cce('0x31')]},{'where':{'id':_0xbfea0d[_0x4cce('0x2a')]['id']}});}else{return;}})[_0x4cce('0x20')](function(){return _0x57d777[_0x4cce('0x1a')]({'read':!![]});})['catch'](function(_0x3a08ae){logger['error'](_0x4cce('0x25'),_0x4cce('0x2f'),util[_0x4cce('0x32')](_0x3a08ae,{'showHidden':![],'depth':null}));_0x4fa99b();});}else{_0x4fa99b();}})[_0x4cce('0x33')](function(){_0x4fa99b();});}else{_0x4fa99b();}}},'charset':_0x4cce('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e600e30..0064851 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x2ba054,_0x4cfa79){var _0x5d2153=function(_0xd698b4){while(--_0xd698b4){_0x2ba054['push'](_0x2ba054['shift']());}};_0x5d2153(++_0x4cfa79);}(_0xdb28,0x106));var _0x8db2=function(_0x299448,_0x15e0ea){_0x299448=_0x299448-0x0;var _0x243f7f=_0xdb28[_0x299448];return _0x243f7f;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _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(_0x4ffac9,_0x1737bd){var _0x1be752=function(_0x35738a){while(--_0x35738a){_0x4ffac9['push'](_0x4ffac9['shift']());}};_0x1be752(++_0x1737bd);}(_0x2ef3,0xba));var _0x32ef=function(_0x29297d,_0x459b29){_0x29297d=_0x29297d-0x0;var _0x5f1c10=_0x2ef3[_0x29297d];return _0x5f1c10;};'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 e1f3854..d9dbce9 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 _0xb353=['emit','removeListener','register','length','./openchannelMessage.events','save','remove'];(function(_0x5343b2,_0x3489ab){var _0x113bd3=function(_0x2a7776){while(--_0x2a7776){_0x5343b2['push'](_0x5343b2['shift']());}};_0x113bd3(++_0x3489ab);}(_0xb353,0xdd));var _0x3b35=function(_0x3c0f74,_0x38cce1){_0x3c0f74=_0x3c0f74-0x0;var _0x595116=_0xb353[_0x3c0f74];return _0x595116;};'use strict';var OpenchannelMessageEvents=require(_0x3b35('0x0'));var events=[_0x3b35('0x1'),_0x3b35('0x2'),'update'];function createListener(_0x72e594,_0xf793dd){return function(_0x263555){_0xf793dd[_0x3b35('0x3')](_0x72e594,_0x263555);};}function removeListener(_0x22509f,_0x172980){return function(){OpenchannelMessageEvents[_0x3b35('0x4')](_0x22509f,_0x172980);};}exports[_0x3b35('0x5')]=function(_0x4e3bbe){for(var _0x28638f=0x0,_0x48611f=events[_0x3b35('0x6')];_0x28638f<_0x48611f;_0x28638f++){var _0x37d4c9=events[_0x28638f];var _0x16a7c9=createListener('openchannelMessage:'+_0x37d4c9,_0x4e3bbe);OpenchannelMessageEvents['on'](_0x37d4c9,_0x16a7c9);}}; \ No newline at end of file +var _0xe87a=['save','remove','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x47d64a,_0x3a44d1){var _0xe07c70=function(_0x5edb0c){while(--_0x5edb0c){_0x47d64a['push'](_0x47d64a['shift']());}};_0xe07c70(++_0x3a44d1);}(_0xe87a,0x15f));var _0xae87=function(_0x233598,_0x1b303a){_0x233598=_0x233598-0x0;var _0x3a0473=_0xe87a[_0x233598];return _0x3a0473;};'use strict';var OpenchannelMessageEvents=require(_0xae87('0x0'));var events=[_0xae87('0x1'),_0xae87('0x2'),'update'];function createListener(_0x450662,_0x1245c3){return function(_0x196a39){_0x1245c3[_0xae87('0x3')](_0x450662,_0x196a39);};}function removeListener(_0x3a95d9,_0x1c7aa2){return function(){OpenchannelMessageEvents[_0xae87('0x4')](_0x3a95d9,_0x1c7aa2);};}exports[_0xae87('0x5')]=function(_0x3b5c49){for(var _0x1728d4=0x0,_0x5917f7=events[_0xae87('0x6')];_0x1728d4<_0x5917f7;_0x1728d4++){var _0x5ca8c5=events[_0x1728d4];var _0x5fc79=createListener(_0xae87('0x7')+_0x5ca8c5,_0x3b5c49);OpenchannelMessageEvents['on'](_0x5ca8c5,_0x5fc79);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9348464..a2296e0 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 _0x7d54=['update','delete','destroy','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','/describe','describe','get','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','create','addTeams','post','put'];(function(_0x3a7cf7,_0x51661){var _0x1f040c=function(_0x566236){while(--_0x566236){_0x3a7cf7['push'](_0x3a7cf7['shift']());}};_0x1f040c(++_0x51661);}(_0x7d54,0x1b4));var _0x47d5=function(_0x11238d,_0x499ac8){_0x11238d=_0x11238d-0x0;var _0x3686b0=_0x7d54[_0x11238d];return _0x3686b0;};'use strict';var multer=require(_0x47d5('0x0'));var util=require(_0x47d5('0x1'));var path=require(_0x47d5('0x2'));var timeout=require(_0x47d5('0x3'));var express=require('express');var router=express[_0x47d5('0x4')]();var fs_extra=require(_0x47d5('0x5'));var auth=require(_0x47d5('0x6'));var interaction=require(_0x47d5('0x7'));var config=require('../../config/environment');var controller=require(_0x47d5('0x8'));router['get']('/',auth[_0x47d5('0x9')](),controller['index']);router['get'](_0x47d5('0xa'),auth[_0x47d5('0x9')](),controller[_0x47d5('0xb')]);router[_0x47d5('0xc')](_0x47d5('0xd'),auth[_0x47d5('0x9')](),controller[_0x47d5('0xe')]);router[_0x47d5('0xc')]('/:id/members',auth[_0x47d5('0x9')](),controller[_0x47d5('0xf')]);router[_0x47d5('0xc')](_0x47d5('0x10'),auth[_0x47d5('0x9')](),controller[_0x47d5('0x11')]);router[_0x47d5('0xc')](_0x47d5('0x12'),auth[_0x47d5('0x9')](),controller['getAgents']);router['post']('/',auth[_0x47d5('0x9')](),controller[_0x47d5('0x13')]);router['post'](_0x47d5('0x10'),auth[_0x47d5('0x9')](),controller[_0x47d5('0x14')]);router[_0x47d5('0x15')](_0x47d5('0x12'),auth[_0x47d5('0x9')](),controller['addAgents']);router[_0x47d5('0x16')](_0x47d5('0xd'),auth[_0x47d5('0x9')](),controller[_0x47d5('0x17')]);router[_0x47d5('0x18')](_0x47d5('0xd'),auth[_0x47d5('0x9')](),controller[_0x47d5('0x19')]);router[_0x47d5('0x18')](_0x47d5('0x10'),auth[_0x47d5('0x9')](),controller[_0x47d5('0x1a')]);router[_0x47d5('0x18')](_0x47d5('0x12'),auth[_0x47d5('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4ce9=['describe','/:id','show','/:id/members','getTeams','/:id/users','create','/:id/teams','addTeams','post','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x58391a,_0x3cc666){var _0xe02c18=function(_0x5c1887){while(--_0x5c1887){_0x58391a['push'](_0x58391a['shift']());}};_0xe02c18(++_0x3cc666);}(_0x4ce9,0x196));var _0x94ce=function(_0x2dffaf,_0x4c6edf){_0x2dffaf=_0x2dffaf-0x0;var _0x259c9a=_0x4ce9[_0x2dffaf];return _0x259c9a;};'use strict';var multer=require(_0x94ce('0x0'));var util=require(_0x94ce('0x1'));var path=require(_0x94ce('0x2'));var timeout=require(_0x94ce('0x3'));var express=require(_0x94ce('0x4'));var router=express[_0x94ce('0x5')]();var fs_extra=require(_0x94ce('0x6'));var auth=require(_0x94ce('0x7'));var interaction=require(_0x94ce('0x8'));var config=require('../../config/environment');var controller=require(_0x94ce('0x9'));router[_0x94ce('0xa')]('/',auth[_0x94ce('0xb')](),controller[_0x94ce('0xc')]);router[_0x94ce('0xa')](_0x94ce('0xd'),auth[_0x94ce('0xb')](),controller[_0x94ce('0xe')]);router[_0x94ce('0xa')](_0x94ce('0xf'),auth[_0x94ce('0xb')](),controller[_0x94ce('0x10')]);router[_0x94ce('0xa')](_0x94ce('0x11'),auth[_0x94ce('0xb')](),controller['getMembers']);router[_0x94ce('0xa')]('/:id/teams',auth[_0x94ce('0xb')](),controller[_0x94ce('0x12')]);router[_0x94ce('0xa')](_0x94ce('0x13'),auth[_0x94ce('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x94ce('0x14')]);router['post'](_0x94ce('0x15'),auth['isAuthenticated'](),controller[_0x94ce('0x16')]);router[_0x94ce('0x17')]('/:id/users',auth[_0x94ce('0xb')](),controller[_0x94ce('0x18')]);router[_0x94ce('0x19')](_0x94ce('0xf'),auth[_0x94ce('0xb')](),controller['update']);router[_0x94ce('0x1a')](_0x94ce('0xf'),auth[_0x94ce('0xb')](),controller[_0x94ce('0x1b')]);router['delete'](_0x94ce('0x15'),auth[_0x94ce('0xb')](),controller['removeTeams']);router[_0x94ce('0x1a')](_0x94ce('0x13'),auth[_0x94ce('0xb')](),controller[_0x94ce('0x1c')]);module[_0x94ce('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 2ae82e7..02afdb9 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 _0x759e=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x173e65,_0x24a8bf){var _0x37d496=function(_0x34b441){while(--_0x34b441){_0x173e65['push'](_0x173e65['shift']());}};_0x37d496(++_0x24a8bf);}(_0x759e,0x1cd));var _0xe759=function(_0x5f4448,_0x266c9b){_0x5f4448=_0x5f4448-0x0;var _0x590c99=_0x759e[_0x5f4448];return _0x590c99;};'use strict';var Sequelize=require(_0xe759('0x0'));module[_0xe759('0x1')]={'name':{'type':Sequelize[_0xe759('0x2')],'unique':_0xe759('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe759('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe759('0x4')](_0xe759('0x5'),_0xe759('0x6'),_0xe759('0x7'))}}; \ No newline at end of file +var _0xa884=['roundrobin','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x3a0593,_0x48dc10){var _0x16033c=function(_0x3d7a9){while(--_0x3d7a9){_0x3a0593['push'](_0x3a0593['shift']());}};_0x16033c(++_0x48dc10);}(_0xa884,0x73));var _0x4a88=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xa884[_0x11155f];return _0xd07e48;};'use strict';var Sequelize=require(_0x4a88('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a88('0x1')],'unique':_0x4a88('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a88('0x3')](_0x4a88('0x4'),'beepall',_0x4a88('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 57d8556..595a6dd 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 _0x67e0=['options','OpenchannelQueue','include','findAll','rows','show','params','includeAll','find','create','body','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','OpenchannelQueueId','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','User','online','interface','flatMap','Agents','sequelize','findOrCreate','forEach','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','union','value','removeTeams','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x67e0,0x1f0));var _0x067e=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x67e0[_0x3f1710];return _0x528458;};'use strict';var emlformat=require(_0x067e('0x0'));var rimraf=require(_0x067e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x067e('0x2'));var moment=require(_0x067e('0x3'));var BPromise=require(_0x067e('0x4'));var Mustache=require(_0x067e('0x5'));var util=require(_0x067e('0x6'));var path=require(_0x067e('0x7'));var sox=require('sox');var csv=require(_0x067e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x067e('0x9'));var squel=require(_0x067e('0xa'));var crypto=require(_0x067e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x067e('0xc'));var toCsv=require(_0x067e('0x8'));var querystring=require(_0x067e('0xd'));var Papa=require(_0x067e('0xe'));var Redis=require(_0x067e('0xf'));var authService=require(_0x067e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x067e('0x11'));var hardwareService=require(_0x067e('0x12'));var logger=require('../../config/logger')(_0x067e('0x13'));var utils=require(_0x067e('0x14'));var config=require(_0x067e('0x15'));var licenseUtil=require(_0x067e('0x16'));var db=require(_0x067e('0x17'))['db'];config[_0x067e('0x18')]=_[_0x067e('0x19')](config[_0x067e('0x18')],{'host':_0x067e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x067e('0x1b'))[_0x067e('0x1c')](socket);function respondWithStatusCode(_0x349014,_0x1a398b){_0x1a398b=_0x1a398b||0xcc;return function(_0x4cc40b){if(_0x4cc40b){return _0x349014[_0x067e('0x1d')](_0x1a398b);}return _0x349014[_0x067e('0x1e')](_0x1a398b)[_0x067e('0x1f')]();};}function respondWithResult(_0x5e5c7e,_0x241439){_0x241439=_0x241439||0xc8;return function(_0x1e4c17){if(_0x1e4c17){return _0x5e5c7e[_0x067e('0x1e')](_0x241439)[_0x067e('0x20')](_0x1e4c17);}};}function respondWithFilteredResult(_0x8e7ca0,_0x2ff65a){return function(_0x4e91d9){if(_0x4e91d9){var _0x3268de=typeof _0x2ff65a[_0x067e('0x21')]===_0x067e('0x22')&&typeof _0x2ff65a[_0x067e('0x23')]==='undefined';var _0x270909=_0x4e91d9[_0x067e('0x24')];var _0x2b02b6=_0x3268de?0x0:_0x2ff65a[_0x067e('0x21')];var _0x4d780e=_0x3268de?_0x4e91d9[_0x067e('0x24')]:_0x2ff65a[_0x067e('0x21')]+_0x2ff65a[_0x067e('0x23')];var _0x2c29bd;if(_0x4d780e>=_0x270909){_0x4d780e=_0x270909;_0x2c29bd=0xc8;}else{_0x2c29bd=0xce;}_0x8e7ca0[_0x067e('0x1e')](_0x2c29bd);return _0x8e7ca0[_0x067e('0x25')](_0x067e('0x26'),_0x2b02b6+'-'+_0x4d780e+'/'+_0x270909)[_0x067e('0x20')](_0x4e91d9);}return null;};}function patchUpdates(_0x208ab5){return function(_0x203b45){try{jsonpatch[_0x067e('0x27')](_0x203b45,_0x208ab5,!![]);}catch(_0x46c936){return BPromise[_0x067e('0x28')](_0x46c936);}return _0x203b45[_0x067e('0x29')]();};}function saveUpdates(_0x22222e,_0x30c70f){return function(_0x5da9bf){if(_0x5da9bf){return _0x5da9bf[_0x067e('0x2a')](_0x22222e)[_0x067e('0x2b')](function(_0x30b0ab){return _0x30b0ab;});}return null;};}function removeEntity(_0x838011,_0x51efa5){return function(_0xe103f1){if(_0xe103f1){return _0xe103f1[_0x067e('0x2c')]()['then'](function(){var _0x1d8f5d=_0xe103f1[_0x067e('0x2d')]({'plain':!![]});var _0x1e151f='OpenchannelQueues';return db[_0x067e('0x2e')][_0x067e('0x2c')]({'where':{'type':_0x1e151f,'resourceId':_0x1d8f5d['id']}})[_0x067e('0x2b')](function(){return _0xe103f1;});})[_0x067e('0x2b')](function(){_0x838011['status'](0xcc)[_0x067e('0x1f')]();});}};}function handleEntityNotFound(_0x4920ea,_0x5e3999){return function(_0x4bd071){if(!_0x4bd071){_0x4920ea['sendStatus'](0x194);}return _0x4bd071;};}function handleError(_0x31a864,_0x5aeae9){_0x5aeae9=_0x5aeae9||0x1f4;return function(_0x3c6ed7){logger[_0x067e('0x2f')](_0x3c6ed7[_0x067e('0x30')]);if(_0x3c6ed7['name']){delete _0x3c6ed7['name'];}_0x31a864[_0x067e('0x1e')](_0x5aeae9)['send'](_0x3c6ed7);};}exports[_0x067e('0x31')]=function(_0x39178c,_0xc00207){var _0x24017e={},_0x36cb7b={},_0x5d59df={'count':0x0,'rows':[]};var _0x1e9078=_['map'](db['OpenchannelQueue'][_0x067e('0x32')],function(_0xf464c4){return{'name':_0xf464c4[_0x067e('0x33')],'type':_0xf464c4[_0x067e('0x34')][_0x067e('0x35')]};});_0x36cb7b[_0x067e('0x36')]=_[_0x067e('0x37')](_0x1e9078,'name');_0x36cb7b[_0x067e('0x38')]=_[_0x067e('0x39')](_0x39178c[_0x067e('0x38')]);_0x36cb7b[_0x067e('0x3a')]=_[_0x067e('0x3b')](_0x36cb7b['model'],_0x36cb7b[_0x067e('0x38')]);_0x24017e['attributes']=_[_0x067e('0x3b')](_0x36cb7b[_0x067e('0x36')],qs['fields'](_0x39178c[_0x067e('0x38')][_0x067e('0x3c')]));_0x24017e[_0x067e('0x3d')]=_0x24017e[_0x067e('0x3d')][_0x067e('0x3e')]?_0x24017e[_0x067e('0x3d')]:_0x36cb7b['model'];if(!_0x39178c['query'][_0x067e('0x3f')]('nolimit')){_0x24017e[_0x067e('0x23')]=qs[_0x067e('0x23')](_0x39178c[_0x067e('0x38')]['limit']);_0x24017e['offset']=qs[_0x067e('0x21')](_0x39178c[_0x067e('0x38')][_0x067e('0x21')]);}_0x24017e[_0x067e('0x40')]=qs['sort'](_0x39178c[_0x067e('0x38')][_0x067e('0x41')]);_0x24017e[_0x067e('0x42')]=qs[_0x067e('0x3a')](_[_0x067e('0x43')](_0x39178c[_0x067e('0x38')],_0x36cb7b[_0x067e('0x3a')]),_0x1e9078);if(_0x39178c[_0x067e('0x38')][_0x067e('0x44')]){_0x24017e['where']=_[_0x067e('0x45')](_0x24017e['where'],{'$or':_[_0x067e('0x37')](_0x1e9078,function(_0x99a74c){if(_0x99a74c[_0x067e('0x34')]!==_0x067e('0x46')){var _0x22d16e={};_0x22d16e[_0x99a74c[_0x067e('0x47')]]={'$like':'%'+_0x39178c[_0x067e('0x38')][_0x067e('0x44')]+'%'};return _0x22d16e;}})});}_0x24017e=_[_0x067e('0x45')]({},_0x24017e,_0x39178c[_0x067e('0x48')]);var _0x3b0c8e={'where':_0x24017e[_0x067e('0x42')]};return db[_0x067e('0x49')][_0x067e('0x24')](_0x3b0c8e)[_0x067e('0x2b')](function(_0x10e6db){_0x5d59df[_0x067e('0x24')]=_0x10e6db;if(_0x39178c[_0x067e('0x38')]['includeAll']){_0x24017e[_0x067e('0x4a')]=[{'all':!![]}];}return db[_0x067e('0x49')][_0x067e('0x4b')](_0x24017e);})[_0x067e('0x2b')](function(_0x18efa3){_0x5d59df[_0x067e('0x4c')]=_0x18efa3;return _0x5d59df;})['then'](respondWithFilteredResult(_0xc00207,_0x24017e))['catch'](handleError(_0xc00207,null));};exports[_0x067e('0x4d')]=function(_0x5cd26a,_0x41289e){var _0x35142f={'raw':!![],'where':{'id':_0x5cd26a[_0x067e('0x4e')]['id']}},_0x18a91a={};_0x18a91a[_0x067e('0x36')]=_[_0x067e('0x39')](db[_0x067e('0x49')][_0x067e('0x32')]);_0x18a91a[_0x067e('0x38')]=_[_0x067e('0x39')](_0x5cd26a[_0x067e('0x38')]);_0x18a91a[_0x067e('0x3a')]=_[_0x067e('0x3b')](_0x18a91a['model'],_0x18a91a['query']);_0x35142f[_0x067e('0x3d')]=_[_0x067e('0x3b')](_0x18a91a[_0x067e('0x36')],qs[_0x067e('0x3c')](_0x5cd26a[_0x067e('0x38')][_0x067e('0x3c')]));_0x35142f['attributes']=_0x35142f[_0x067e('0x3d')]['length']?_0x35142f[_0x067e('0x3d')]:_0x18a91a[_0x067e('0x36')];if(_0x5cd26a[_0x067e('0x38')][_0x067e('0x4f')]){_0x35142f['include']=[{'all':!![]}];}_0x35142f=_[_0x067e('0x45')]({},_0x35142f,_0x5cd26a[_0x067e('0x48')]);return db['OpenchannelQueue'][_0x067e('0x50')](_0x35142f)['then'](handleEntityNotFound(_0x41289e,null))[_0x067e('0x2b')](respondWithResult(_0x41289e,null))['catch'](handleError(_0x41289e,null));};exports[_0x067e('0x51')]=function(_0x2ef2cc,_0x56a1d4){return db[_0x067e('0x49')][_0x067e('0x51')](_0x2ef2cc[_0x067e('0x52')],{})['then'](function(_0x42503d){var _0x2f9600=_0x2ef2cc[_0x067e('0x53')][_0x067e('0x2d')]({'plain':!![]});if(!_0x2f9600)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f9600['role']===_0x067e('0x53')){var _0x116bfd=_0x42503d[_0x067e('0x2d')]({'plain':!![]});var _0x4141d6='OpenchannelQueues';return db[_0x067e('0x54')][_0x067e('0x50')]({'where':{'name':_0x4141d6,'userProfileId':_0x2f9600[_0x067e('0x55')]},'raw':!![]})[_0x067e('0x2b')](function(_0xcb4e68){if(_0xcb4e68&&_0xcb4e68['autoAssociation']===0x0){return db[_0x067e('0x2e')][_0x067e('0x51')]({'name':_0x116bfd['name'],'resourceId':_0x116bfd['id'],'type':_0xcb4e68[_0x067e('0x47')],'sectionId':_0xcb4e68['id']},{})[_0x067e('0x2b')](function(){return _0x42503d;});}else{return _0x42503d;}})[_0x067e('0x56')](function(_0x34a48a){logger[_0x067e('0x2f')](_0x067e('0x57'),_0x34a48a);throw _0x34a48a;});}return _0x42503d;})[_0x067e('0x2b')](respondWithResult(_0x56a1d4,0xc9))[_0x067e('0x56')](handleError(_0x56a1d4,null));};exports[_0x067e('0x2a')]=function(_0x4b97c,_0x536c46){if(_0x4b97c['body']['id']){delete _0x4b97c['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x4b97c[_0x067e('0x4e')]['id']}})[_0x067e('0x2b')](handleEntityNotFound(_0x536c46,null))[_0x067e('0x2b')](saveUpdates(_0x4b97c['body'],null))[_0x067e('0x2b')](respondWithResult(_0x536c46,null))[_0x067e('0x56')](handleError(_0x536c46,null));};exports[_0x067e('0x2c')]=function(_0x5d978f,_0x13ceda){return db[_0x067e('0x49')][_0x067e('0x50')]({'where':{'id':_0x5d978f[_0x067e('0x4e')]['id']}})[_0x067e('0x2b')](handleEntityNotFound(_0x13ceda,null))[_0x067e('0x2b')](removeEntity(_0x13ceda,null))[_0x067e('0x56')](handleError(_0x13ceda,null));};exports['describe']=function(_0x3997b2,_0x575845){return db[_0x067e('0x49')][_0x067e('0x58')]()[_0x067e('0x2b')](respondWithResult(_0x575845,null))[_0x067e('0x56')](handleError(_0x575845,null));};exports[_0x067e('0x59')]=function(_0x5ca2be,_0x5d5055,_0x15c886){var _0x4ce150={'raw':!![],'where':{}},_0x462a9b={},_0x474e7e;return db[_0x067e('0x49')][_0x067e('0x5a')]({'where':{'id':_0x5ca2be[_0x067e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5d5055,null))[_0x067e('0x2b')](function(_0xa57c09){if(_0xa57c09){_0x474e7e=_0xa57c09[_0x067e('0x2d')]({'plain':!![]});_0x462a9b['model']=_['keys'](db[_0x067e('0x5b')][_0x067e('0x32')]);_0x462a9b[_0x067e('0x38')]=_[_0x067e('0x39')](_0x5ca2be[_0x067e('0x38')]);_0x462a9b[_0x067e('0x3a')]=_[_0x067e('0x3b')](_0x462a9b[_0x067e('0x36')],_0x462a9b[_0x067e('0x38')]);_0x4ce150[_0x067e('0x3d')]=_['intersection'](_0x462a9b['model'],qs[_0x067e('0x3c')](_0x5ca2be['query']['fields']));_0x4ce150[_0x067e('0x3d')]=_0x4ce150[_0x067e('0x3d')][_0x067e('0x3e')]?_0x4ce150['attributes']:_0x462a9b[_0x067e('0x36')];if(!_0x5ca2be[_0x067e('0x38')][_0x067e('0x3f')](_0x067e('0x5c'))){_0x4ce150[_0x067e('0x23')]=qs[_0x067e('0x23')](_0x5ca2be['query']['limit']);_0x4ce150[_0x067e('0x21')]=qs[_0x067e('0x21')](_0x5ca2be['query'][_0x067e('0x21')]);}_0x4ce150['order']=qs[_0x067e('0x41')](_0x5ca2be[_0x067e('0x38')][_0x067e('0x41')]);_0x4ce150['where']=qs[_0x067e('0x3a')](_[_0x067e('0x43')](_0x5ca2be['query'],_0x462a9b[_0x067e('0x3a')]));_0x4ce150[_0x067e('0x42')][_0x067e('0x5d')]=_0xa57c09['id'];if(_0x5ca2be[_0x067e('0x38')][_0x067e('0x44')]){_0x4ce150[_0x067e('0x42')]=_[_0x067e('0x45')](_0x4ce150[_0x067e('0x42')],{'$or':_[_0x067e('0x37')](_0x4ce150[_0x067e('0x3d')],function(_0x53964f){var _0x1a8398={};_0x1a8398[_0x53964f]={'$like':'%'+_0x5ca2be[_0x067e('0x38')][_0x067e('0x44')]+'%'};return _0x1a8398;})});}_0x4ce150=_[_0x067e('0x45')]({},_0x4ce150,_0x5ca2be[_0x067e('0x48')]);return db[_0x067e('0x5b')]['findAll'](_0x4ce150);}})[_0x067e('0x2b')](function(_0x306dbe){if(_0x306dbe){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x306dbe,_0x067e('0x5e')),'role':_0x067e('0x5f')},'attributes':['id',_0x067e('0x47'),_0x067e('0x60'),_0x067e('0x61'),'createdAt']});}})[_0x067e('0x2b')](function(_0x3e2124){if(_0x3e2124){return{'count':_0x3e2124['count'],'rows':_[_0x067e('0x37')](_0x3e2124[_0x067e('0x4c')],function(_0x574715){return{'membername':_0x574715[_0x067e('0x47')],'UserId':_0x574715['id'],'queue_name':_0x474e7e[_0x067e('0x47')],'OpenchannelQueueId':_0x474e7e['id'],'interface':util[_0x067e('0x62')](_0x067e('0x63'),_0x067e('0x64'),_0x574715['name']),'penalty':0x0,'paused':_0x574715[_0x067e('0x60')],'createdAt':_0x574715[_0x067e('0x65')],'updatedAt':_0x574715[_0x067e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x067e('0x2b')](respondWithFilteredResult(_0x5d5055,_0x4ce150))['catch'](handleError(_0x5d5055,null));};exports[_0x067e('0x66')]=function(_0x4a10ed,_0x4b1453,_0x506176){var _0x30d514={};var _0x5009df={};var _0x2cd90f;var _0x1b84b7;return db['OpenchannelQueue'][_0x067e('0x5a')]({'where':{'id':_0x4a10ed[_0x067e('0x4e')]['id']}})[_0x067e('0x2b')](handleEntityNotFound(_0x4b1453,null))[_0x067e('0x2b')](function(_0x13dc76){if(_0x13dc76){_0x2cd90f=_0x13dc76;_0x5009df['model']=_[_0x067e('0x39')](db['Team']['rawAttributes']);_0x5009df[_0x067e('0x38')]=_[_0x067e('0x39')](_0x4a10ed[_0x067e('0x38')]);_0x5009df['filters']=_['intersection'](_0x5009df[_0x067e('0x36')],_0x5009df['query']);_0x30d514[_0x067e('0x3d')]=_[_0x067e('0x3b')](_0x5009df[_0x067e('0x36')],qs[_0x067e('0x3c')](_0x4a10ed[_0x067e('0x38')][_0x067e('0x3c')]));_0x30d514[_0x067e('0x3d')]=_0x30d514['attributes'][_0x067e('0x3e')]?_0x30d514['attributes']:_0x5009df[_0x067e('0x36')];_0x30d514[_0x067e('0x40')]=qs[_0x067e('0x41')](_0x4a10ed[_0x067e('0x38')][_0x067e('0x41')]);_0x30d514[_0x067e('0x42')]=qs[_0x067e('0x3a')](_[_0x067e('0x43')](_0x4a10ed[_0x067e('0x38')],_0x5009df[_0x067e('0x3a')]));if(_0x4a10ed[_0x067e('0x38')][_0x067e('0x44')]){_0x30d514[_0x067e('0x42')]=_[_0x067e('0x45')](_0x30d514[_0x067e('0x42')],{'$or':_[_0x067e('0x37')](_0x30d514['attributes'],function(_0x12f5d2){var _0x192182={};_0x192182[_0x12f5d2]={'$like':'%'+_0x4a10ed[_0x067e('0x38')]['filter']+'%'};return _0x192182;})});}_0x30d514=_['merge']({},_0x30d514,_0x4a10ed['options']);return _0x2cd90f[_0x067e('0x66')](_0x30d514);}})[_0x067e('0x2b')](function(_0xa91b58){if(_0xa91b58){_0x1b84b7=_0xa91b58[_0x067e('0x3e')];if(!_0x4a10ed[_0x067e('0x38')][_0x067e('0x3f')](_0x067e('0x5c'))){_0x30d514[_0x067e('0x23')]=qs[_0x067e('0x23')](_0x4a10ed[_0x067e('0x38')][_0x067e('0x23')]);_0x30d514[_0x067e('0x21')]=qs[_0x067e('0x21')](_0x4a10ed[_0x067e('0x38')][_0x067e('0x21')]);}return _0x2cd90f[_0x067e('0x66')](_0x30d514);}})[_0x067e('0x2b')](function(_0x20adce){if(_0x20adce){return _0x20adce?{'count':_0x1b84b7,'rows':_0x20adce}:null;}})[_0x067e('0x2b')](respondWithResult(_0x4b1453,null))[_0x067e('0x56')](handleError(_0x4b1453,null));};exports[_0x067e('0x67')]=function(_0x5b223e,_0x15c040,_0x2a7a86){var _0x70f27f=_0x5b223e[_0x067e('0x52')][_0x067e('0x68')];return db[_0x067e('0x69')][_0x067e('0x4b')]({'where':{'id':_0x70f27f},'attributes':['id'],'include':[{'model':db[_0x067e('0x6a')],'as':'Agents','attributes':['id',_0x067e('0x47'),_0x067e('0x6b'),'voicePause',_0x067e('0x6c')],'raw':!![]}]})[_0x067e('0x2b')](function(_0x4b5ecc){if(_0x4b5ecc){var _0x3a5cff=_[_0x067e('0x6d')](_0x4b5ecc,function(_0x1039e5){var _0x3052f4=_0x1039e5['get']({'plain':!![]});return _0x3052f4[_0x067e('0x6e')];});return db[_0x067e('0x49')][_0x067e('0x50')]({'where':{'id':_0x5b223e[_0x067e('0x4e')]['id']}})[_0x067e('0x2b')](function(_0x248f82){return db[_0x067e('0x6f')]['transaction'](function(_0x4313bd){return _0x248f82[_0x067e('0x67')](_0x70f27f,{'transaction':_0x4313bd})[_0x067e('0x2b')](function(){return BPromise['each'](_0x3a5cff,function(_0xb26686){return db[_0x067e('0x5b')][_0x067e('0x70')]({'where':{'UserId':_0xb26686['id'],'OpenchannelQueueId':_0x5b223e[_0x067e('0x4e')]['id']},'transaction':_0x4313bd});});})[_0x067e('0x2b')](function(){_0x3a5cff[_0x067e('0x71')](function(_0x58a71e){socket['emit'](_0x067e('0x72'),{'UserId':_0x58a71e['id'],'OpenchannelQueueId':_0x248f82['id']});});});});});}})[_0x067e('0x2b')](respondWithStatusCode(_0x15c040,null))[_0x067e('0x56')](handleError(_0x15c040,null));};exports['removeTeams']=function(_0x2d77f2,_0x482259,_0x28618d){return db[_0x067e('0x69')]['findAll']({'where':{'id':_0x2d77f2[_0x067e('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x067e('0x6a')],'as':_0x067e('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x067e('0x2b')](handleEntityNotFound(_0x482259,null))[_0x067e('0x2b')](function(_0xe48d3b){var _0x382e63=_[_0x067e('0x37')](_0xe48d3b,'id');var _0x1f28f6=[];var _0x644519=[];var _0x463ab5=squel[_0x067e('0x73')]();_0x463ab5[_0x067e('0x74')](_0x067e('0x75'))[_0x067e('0x76')](_0x067e('0x77'),'tq')[_0x067e('0x78')](_0x067e('0x79'),'ut',_0x067e('0x7a'))[_0x067e('0x42')](_0x067e('0x7b'),_0x2d77f2[_0x067e('0x4e')]['id']);for(var _0x39d4de=0x0;_0x39d4de<_0xe48d3b[_0x067e('0x3e')];_0x39d4de+=0x1){let _0x54c94d=_0xe48d3b[_0x39d4de];for(var _0x768f71=0x0;_0x768f71<_0x54c94d[_0x067e('0x6e')][_0x067e('0x3e')];_0x768f71+=0x1){let _0x1fde57=_0x54c94d[_0x067e('0x6e')][_0x768f71];var _0x572594=_0x463ab5[_0x067e('0x7c')]();_0x572594[_0x067e('0x42')](_0x067e('0x7d'),_0x1fde57['id']);_0x644519[_0x067e('0x7e')](db['sequelize']['query'](_0x572594['toString'](),{'type':db['sequelize'][_0x067e('0x7f')]['SELECT']})[_0x067e('0x2b')](function(_0xb11384){if(_0xb11384[_0x067e('0x3e')]===0x1){return _0x1fde57['id'];}else{var _0x26ce29=_[_0x067e('0x80')](_[_0x067e('0x37')](_0xb11384,_0x067e('0x81')),function(_0x6a64fa){return _[_0x067e('0x82')](_0x382e63,_0x6a64fa);});if(_0x26ce29){return _0x1fde57['id'];}}}));}}return BPromise['all'](_0x644519)[_0x067e('0x2b')](function(_0x5c0642){_0x1f28f6=_(_0x1f28f6)[_0x067e('0x83')](_0x5c0642)['compact']()[_0x067e('0x84')]();return db[_0x067e('0x49')][_0x067e('0x50')]({'where':{'id':_0x2d77f2[_0x067e('0x4e')]['id']}})[_0x067e('0x2b')](function(_0x5edf86){return db[_0x067e('0x6f')]['transaction'](function(_0x40ef66){return _0x5edf86[_0x067e('0x85')](_0x2d77f2[_0x067e('0x38')][_0x067e('0x68')],{'transaction':_0x40ef66})[_0x067e('0x2b')](function(){if(!_[_0x067e('0x86')](_0x1f28f6)){return _0x5edf86[_0x067e('0x87')](_0x1f28f6,{'transaction':_0x40ef66});}})['then'](function(){_0x1f28f6[_0x067e('0x71')](function(_0x5f765a){socket[_0x067e('0x88')](_0x067e('0x89'),{'UserId':_0x5f765a,'OpenchannelQueueId':_0x5edf86['id']});});});});});});})[_0x067e('0x2b')](respondWithStatusCode(_0x482259,null))[_0x067e('0x56')](handleError(_0x482259,null));};exports[_0x067e('0x8a')]=function(_0x46c03b,_0x3d5e5e,_0x48230e){return db[_0x067e('0x49')][_0x067e('0x50')]({'where':{'id':_0x46c03b[_0x067e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d5e5e,null))[_0x067e('0x2b')](function(_0x2e606a){if(_0x2e606a){return _0x2e606a[_0x067e('0x8a')](_0x46c03b['body']['ids'],_['omit'](_0x46c03b[_0x067e('0x52')],[_0x067e('0x68'),'id'])||{})[_0x067e('0x8b')](function(_0x56e0cf){for(var _0x362e57=0x0;_0x362e57<_0x46c03b[_0x067e('0x52')]['ids'][_0x067e('0x3e')];_0x362e57+=0x1){socket[_0x067e('0x88')](_0x067e('0x72'),{'UserId':Number(_0x46c03b[_0x067e('0x52')]['ids'][_0x362e57]),'OpenchannelQueueId':Number(_0x46c03b[_0x067e('0x4e')]['id'])});}return _0x56e0cf;});}})[_0x067e('0x2b')](respondWithResult(_0x3d5e5e,null))[_0x067e('0x56')](handleError(_0x3d5e5e,null));};exports[_0x067e('0x87')]=function(_0x4b51a9,_0x385b6a,_0xe95cc){return db[_0x067e('0x49')][_0x067e('0x50')]({'where':{'id':_0x4b51a9[_0x067e('0x4e')]['id']}})[_0x067e('0x2b')](handleEntityNotFound(_0x385b6a,null))[_0x067e('0x2b')](function(_0x4c0678){if(_0x4c0678){return _0x4c0678['removeAgents'](_0x4b51a9[_0x067e('0x38')][_0x067e('0x68')])['then'](function(){if(_[_0x067e('0x8c')](_0x4b51a9[_0x067e('0x38')][_0x067e('0x68')])){for(var _0x3ef36f=0x0;_0x3ef36f<_0x4b51a9['query'][_0x067e('0x68')][_0x067e('0x3e')];_0x3ef36f+=0x1){socket[_0x067e('0x88')](_0x067e('0x89'),{'UserId':Number(_0x4b51a9[_0x067e('0x38')]['ids'][_0x3ef36f]),'OpenchannelQueueId':Number(_0x4b51a9[_0x067e('0x4e')]['id'])});}}else{socket[_0x067e('0x88')](_0x067e('0x89'),{'UserId':Number(_0x4b51a9['query'][_0x067e('0x68')]),'OpenchannelQueueId':Number(_0x4b51a9[_0x067e('0x4e')]['id'])});}});}})[_0x067e('0x2b')](respondWithStatusCode(_0x385b6a,null))[_0x067e('0x56')](handleError(_0x385b6a,null));};exports['getAgents']=function(_0x46b472,_0x1d9542,_0x54d456){var _0x10a9cb={};var _0x1ad3e7={};var _0x128c6f;var _0x4098fb;return db[_0x067e('0x49')][_0x067e('0x5a')]({'where':{'id':_0x46b472['params']['id']}})[_0x067e('0x2b')](handleEntityNotFound(_0x1d9542,null))['then'](function(_0x39e6e1){if(_0x39e6e1){_0x128c6f=_0x39e6e1;_0x1ad3e7[_0x067e('0x36')]=_[_0x067e('0x39')](db[_0x067e('0x6a')][_0x067e('0x32')]);_0x1ad3e7[_0x067e('0x38')]=_['keys'](_0x46b472[_0x067e('0x38')]);_0x1ad3e7[_0x067e('0x3a')]=_[_0x067e('0x3b')](_0x1ad3e7[_0x067e('0x36')],_0x1ad3e7[_0x067e('0x38')]);_0x10a9cb['attributes']=_[_0x067e('0x3b')](_0x1ad3e7[_0x067e('0x36')],qs['fields'](_0x46b472['query'][_0x067e('0x3c')]));_0x10a9cb[_0x067e('0x3d')]=_0x10a9cb['attributes'][_0x067e('0x3e')]?_0x10a9cb[_0x067e('0x3d')]:_0x1ad3e7[_0x067e('0x36')];_0x10a9cb['order']=qs[_0x067e('0x41')](_0x46b472[_0x067e('0x38')]['sort']);_0x10a9cb[_0x067e('0x42')]=qs[_0x067e('0x3a')](_[_0x067e('0x43')](_0x46b472[_0x067e('0x38')],_0x1ad3e7[_0x067e('0x3a')]));if(_0x46b472['query'][_0x067e('0x44')]){_0x10a9cb[_0x067e('0x42')]=_[_0x067e('0x45')](_0x10a9cb[_0x067e('0x42')],{'$or':_[_0x067e('0x37')](_0x10a9cb[_0x067e('0x3d')],function(_0x3e78be){var _0x1cf01f={};_0x1cf01f[_0x3e78be]={'$like':'%'+_0x46b472[_0x067e('0x38')][_0x067e('0x44')]+'%'};return _0x1cf01f;})});}_0x10a9cb=_[_0x067e('0x45')]({},_0x10a9cb,_0x46b472[_0x067e('0x48')]);return _0x128c6f[_0x067e('0x8d')](_0x10a9cb);}})[_0x067e('0x2b')](function(_0x4e480b){if(_0x4e480b){_0x4098fb=_0x4e480b[_0x067e('0x3e')];if(!_0x46b472[_0x067e('0x38')][_0x067e('0x3f')](_0x067e('0x5c'))){_0x10a9cb[_0x067e('0x23')]=qs[_0x067e('0x23')](_0x46b472[_0x067e('0x38')][_0x067e('0x23')]);_0x10a9cb['offset']=qs['offset'](_0x46b472[_0x067e('0x38')][_0x067e('0x21')]);}return _0x128c6f[_0x067e('0x8d')](_0x10a9cb);}})['then'](function(_0x1b1e40){if(_0x1b1e40){return _0x1b1e40?{'count':_0x4098fb,'rows':_0x1b1e40}:null;}})['then'](respondWithResult(_0x1d9542,null))[_0x067e('0x56')](handleError(_0x1d9542,null));}; \ No newline at end of file +var _0xb0db=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','body','describe','getMembers','findOne','UserOpenchannelQueue','length','OpenchannelQueueId','filter','User','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x17947e,_0x55488f){var _0x221f61=function(_0x16ebfb){while(--_0x16ebfb){_0x17947e['push'](_0x17947e['shift']());}};_0x221f61(++_0x55488f);}(_0xb0db,0x86));var _0xbb0d=function(_0xbe1bbb,_0x12b407){_0xbe1bbb=_0xbe1bbb-0x0;var _0x3e9c57=_0xb0db[_0xbe1bbb];return _0x3e9c57;};'use strict';var emlformat=require(_0xbb0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb0d('0x1'));var jsonpatch=require(_0xbb0d('0x2'));var rp=require(_0xbb0d('0x3'));var moment=require(_0xbb0d('0x4'));var BPromise=require(_0xbb0d('0x5'));var Mustache=require(_0xbb0d('0x6'));var util=require(_0xbb0d('0x7'));var path=require(_0xbb0d('0x8'));var sox=require(_0xbb0d('0x9'));var csv=require(_0xbb0d('0xa'));var ejs=require(_0xbb0d('0xb'));var fs=require('fs');var fs_extra=require(_0xbb0d('0xc'));var _=require(_0xbb0d('0xd'));var squel=require(_0xbb0d('0xe'));var crypto=require(_0xbb0d('0xf'));var jsforce=require(_0xbb0d('0x10'));var deskjs=require(_0xbb0d('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbb0d('0x12'));var Papa=require(_0xbb0d('0x13'));var Redis=require('ioredis');var authService=require(_0xbb0d('0x14'));var qs=require(_0xbb0d('0x15'));var as=require(_0xbb0d('0x16'));var hardwareService=require(_0xbb0d('0x17'));var logger=require('../../config/logger')(_0xbb0d('0x18'));var utils=require(_0xbb0d('0x19'));var config=require(_0xbb0d('0x1a'));var licenseUtil=require(_0xbb0d('0x1b'));var db=require(_0xbb0d('0x1c'))['db'];config[_0xbb0d('0x1d')]=_[_0xbb0d('0x1e')](config['redis'],{'host':_0xbb0d('0x1f'),'port':0x18eb});var socket=require(_0xbb0d('0x20'))(new Redis(config[_0xbb0d('0x1d')]));require(_0xbb0d('0x21'))[_0xbb0d('0x22')](socket);function respondWithStatusCode(_0x327cd6,_0x245caf){_0x245caf=_0x245caf||0xcc;return function(_0x2c526c){if(_0x2c526c){return _0x327cd6[_0xbb0d('0x23')](_0x245caf);}return _0x327cd6[_0xbb0d('0x24')](_0x245caf)[_0xbb0d('0x25')]();};}function respondWithResult(_0x38fec9,_0x5a60a0){_0x5a60a0=_0x5a60a0||0xc8;return function(_0x55ccab){if(_0x55ccab){return _0x38fec9[_0xbb0d('0x24')](_0x5a60a0)[_0xbb0d('0x26')](_0x55ccab);}};}function respondWithFilteredResult(_0x31432a,_0x14aae4){return function(_0x3368ed){if(_0x3368ed){var _0x26bd59=typeof _0x14aae4[_0xbb0d('0x27')]===_0xbb0d('0x28')&&typeof _0x14aae4[_0xbb0d('0x29')]===_0xbb0d('0x28');var _0x3528a9=_0x3368ed[_0xbb0d('0x2a')];var _0x510fd7=_0x26bd59?0x0:_0x14aae4[_0xbb0d('0x27')];var _0x3bd980=_0x26bd59?_0x3368ed[_0xbb0d('0x2a')]:_0x14aae4[_0xbb0d('0x27')]+_0x14aae4[_0xbb0d('0x29')];var _0x245652;if(_0x3bd980>=_0x3528a9){_0x3bd980=_0x3528a9;_0x245652=0xc8;}else{_0x245652=0xce;}_0x31432a[_0xbb0d('0x24')](_0x245652);return _0x31432a[_0xbb0d('0x2b')](_0xbb0d('0x2c'),_0x510fd7+'-'+_0x3bd980+'/'+_0x3528a9)[_0xbb0d('0x26')](_0x3368ed);}return null;};}function patchUpdates(_0x58d25d){return function(_0x36bc56){try{jsonpatch[_0xbb0d('0x2d')](_0x36bc56,_0x58d25d,!![]);}catch(_0x298735){return BPromise[_0xbb0d('0x2e')](_0x298735);}return _0x36bc56[_0xbb0d('0x2f')]();};}function saveUpdates(_0x61b423,_0x4d343b){return function(_0x244657){if(_0x244657){return _0x244657[_0xbb0d('0x30')](_0x61b423)[_0xbb0d('0x31')](function(_0x1b7b04){return _0x1b7b04;});}return null;};}function removeEntity(_0x53e993,_0x12389a){return function(_0x27f46b){if(_0x27f46b){return _0x27f46b[_0xbb0d('0x32')]()[_0xbb0d('0x31')](function(){var _0x4e8f67=_0x27f46b[_0xbb0d('0x33')]({'plain':!![]});var _0x4a2101=_0xbb0d('0x34');return db[_0xbb0d('0x35')][_0xbb0d('0x32')]({'where':{'type':_0x4a2101,'resourceId':_0x4e8f67['id']}})[_0xbb0d('0x31')](function(){return _0x27f46b;});})[_0xbb0d('0x31')](function(){_0x53e993[_0xbb0d('0x24')](0xcc)[_0xbb0d('0x25')]();});}};}function handleEntityNotFound(_0xfb8eee,_0x1c27a6){return function(_0x4fea09){if(!_0x4fea09){_0xfb8eee['sendStatus'](0x194);}return _0x4fea09;};}function handleError(_0x3daab0,_0x10c602){_0x10c602=_0x10c602||0x1f4;return function(_0x6f57e6){logger[_0xbb0d('0x36')](_0x6f57e6[_0xbb0d('0x37')]);if(_0x6f57e6[_0xbb0d('0x38')]){delete _0x6f57e6[_0xbb0d('0x38')];}_0x3daab0[_0xbb0d('0x24')](_0x10c602)[_0xbb0d('0x39')](_0x6f57e6);};}exports[_0xbb0d('0x3a')]=function(_0x3729cc,_0x2a8b86){var _0x7167d7={},_0x100ae4={},_0x493188={'count':0x0,'rows':[]};var _0x142b4d=_['map'](db[_0xbb0d('0x3b')][_0xbb0d('0x3c')],function(_0x577249){return{'name':_0x577249[_0xbb0d('0x3d')],'type':_0x577249[_0xbb0d('0x3e')][_0xbb0d('0x3f')]};});_0x100ae4[_0xbb0d('0x40')]=_[_0xbb0d('0x41')](_0x142b4d,'name');_0x100ae4['query']=_[_0xbb0d('0x42')](_0x3729cc[_0xbb0d('0x43')]);_0x100ae4[_0xbb0d('0x44')]=_[_0xbb0d('0x45')](_0x100ae4[_0xbb0d('0x40')],_0x100ae4['query']);_0x7167d7['attributes']=_['intersection'](_0x100ae4[_0xbb0d('0x40')],qs[_0xbb0d('0x46')](_0x3729cc[_0xbb0d('0x43')][_0xbb0d('0x46')]));_0x7167d7['attributes']=_0x7167d7[_0xbb0d('0x47')]['length']?_0x7167d7[_0xbb0d('0x47')]:_0x100ae4[_0xbb0d('0x40')];if(!_0x3729cc['query'][_0xbb0d('0x48')](_0xbb0d('0x49'))){_0x7167d7[_0xbb0d('0x29')]=qs[_0xbb0d('0x29')](_0x3729cc[_0xbb0d('0x43')][_0xbb0d('0x29')]);_0x7167d7[_0xbb0d('0x27')]=qs[_0xbb0d('0x27')](_0x3729cc[_0xbb0d('0x43')][_0xbb0d('0x27')]);}_0x7167d7[_0xbb0d('0x4a')]=qs['sort'](_0x3729cc[_0xbb0d('0x43')][_0xbb0d('0x4b')]);_0x7167d7[_0xbb0d('0x4c')]=qs['filters'](_[_0xbb0d('0x4d')](_0x3729cc[_0xbb0d('0x43')],_0x100ae4[_0xbb0d('0x44')]),_0x142b4d);if(_0x3729cc[_0xbb0d('0x43')]['filter']){_0x7167d7[_0xbb0d('0x4c')]=_['merge'](_0x7167d7[_0xbb0d('0x4c')],{'$or':_['map'](_0x142b4d,function(_0x38e0a1){if(_0x38e0a1['type']!==_0xbb0d('0x4e')){var _0x467ad7={};_0x467ad7[_0x38e0a1['name']]={'$like':'%'+_0x3729cc[_0xbb0d('0x43')]['filter']+'%'};return _0x467ad7;}})});}_0x7167d7=_[_0xbb0d('0x4f')]({},_0x7167d7,_0x3729cc[_0xbb0d('0x50')]);var _0x377c23={'where':_0x7167d7['where']};return db['OpenchannelQueue'][_0xbb0d('0x2a')](_0x377c23)[_0xbb0d('0x31')](function(_0x370a95){_0x493188[_0xbb0d('0x2a')]=_0x370a95;if(_0x3729cc[_0xbb0d('0x43')][_0xbb0d('0x51')]){_0x7167d7[_0xbb0d('0x52')]=[{'all':!![]}];}return db[_0xbb0d('0x3b')][_0xbb0d('0x53')](_0x7167d7);})['then'](function(_0x8c7491){_0x493188[_0xbb0d('0x54')]=_0x8c7491;return _0x493188;})['then'](respondWithFilteredResult(_0x2a8b86,_0x7167d7))[_0xbb0d('0x55')](handleError(_0x2a8b86,null));};exports[_0xbb0d('0x56')]=function(_0x2417fc,_0x21139a){var _0x569c6f={'raw':!![],'where':{'id':_0x2417fc[_0xbb0d('0x57')]['id']}},_0x1fa39d={};_0x1fa39d[_0xbb0d('0x40')]=_[_0xbb0d('0x42')](db[_0xbb0d('0x3b')]['rawAttributes']);_0x1fa39d[_0xbb0d('0x43')]=_[_0xbb0d('0x42')](_0x2417fc[_0xbb0d('0x43')]);_0x1fa39d[_0xbb0d('0x44')]=_[_0xbb0d('0x45')](_0x1fa39d[_0xbb0d('0x40')],_0x1fa39d[_0xbb0d('0x43')]);_0x569c6f[_0xbb0d('0x47')]=_[_0xbb0d('0x45')](_0x1fa39d[_0xbb0d('0x40')],qs[_0xbb0d('0x46')](_0x2417fc[_0xbb0d('0x43')][_0xbb0d('0x46')]));_0x569c6f['attributes']=_0x569c6f[_0xbb0d('0x47')]['length']?_0x569c6f['attributes']:_0x1fa39d[_0xbb0d('0x40')];if(_0x2417fc[_0xbb0d('0x43')]['includeAll']){_0x569c6f[_0xbb0d('0x52')]=[{'all':!![]}];}_0x569c6f=_[_0xbb0d('0x4f')]({},_0x569c6f,_0x2417fc[_0xbb0d('0x50')]);return db[_0xbb0d('0x3b')][_0xbb0d('0x58')](_0x569c6f)[_0xbb0d('0x31')](handleEntityNotFound(_0x21139a,null))[_0xbb0d('0x31')](respondWithResult(_0x21139a,null))[_0xbb0d('0x55')](handleError(_0x21139a,null));};exports[_0xbb0d('0x59')]=function(_0x403dc1,_0xf4f38a){return db[_0xbb0d('0x3b')][_0xbb0d('0x59')](_0x403dc1['body'],{})[_0xbb0d('0x31')](function(_0x18d76b){var _0x26abd7=_0x403dc1['user'][_0xbb0d('0x33')]({'plain':!![]});if(!_0x26abd7)throw new Error(_0xbb0d('0x5a'));if(_0x26abd7[_0xbb0d('0x5b')]===_0xbb0d('0x5c')){var _0x24f5f1=_0x18d76b[_0xbb0d('0x33')]({'plain':!![]});var _0x32685c=_0xbb0d('0x34');return db[_0xbb0d('0x5d')][_0xbb0d('0x58')]({'where':{'name':_0x32685c,'userProfileId':_0x26abd7['userProfileId']},'raw':!![]})[_0xbb0d('0x31')](function(_0xd7c8f6){if(_0xd7c8f6&&_0xd7c8f6['autoAssociation']===0x0){return db[_0xbb0d('0x35')][_0xbb0d('0x59')]({'name':_0x24f5f1[_0xbb0d('0x38')],'resourceId':_0x24f5f1['id'],'type':_0xd7c8f6[_0xbb0d('0x38')],'sectionId':_0xd7c8f6['id']},{})[_0xbb0d('0x31')](function(){return _0x18d76b;});}else{return _0x18d76b;}})[_0xbb0d('0x55')](function(_0x512226){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x512226);throw _0x512226;});}return _0x18d76b;})[_0xbb0d('0x31')](respondWithResult(_0xf4f38a,0xc9))[_0xbb0d('0x55')](handleError(_0xf4f38a,null));};exports[_0xbb0d('0x30')]=function(_0x51fadb,_0x34bcf6){if(_0x51fadb[_0xbb0d('0x5e')]['id']){delete _0x51fadb[_0xbb0d('0x5e')]['id'];}return db[_0xbb0d('0x3b')][_0xbb0d('0x58')]({'where':{'id':_0x51fadb['params']['id']}})[_0xbb0d('0x31')](handleEntityNotFound(_0x34bcf6,null))[_0xbb0d('0x31')](saveUpdates(_0x51fadb['body'],null))[_0xbb0d('0x31')](respondWithResult(_0x34bcf6,null))[_0xbb0d('0x55')](handleError(_0x34bcf6,null));};exports['destroy']=function(_0x1ab0be,_0x4ec155){return db[_0xbb0d('0x3b')][_0xbb0d('0x58')]({'where':{'id':_0x1ab0be[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](handleEntityNotFound(_0x4ec155,null))[_0xbb0d('0x31')](removeEntity(_0x4ec155,null))[_0xbb0d('0x55')](handleError(_0x4ec155,null));};exports[_0xbb0d('0x5f')]=function(_0x264703,_0x28459a){return db[_0xbb0d('0x3b')]['describe']()[_0xbb0d('0x31')](respondWithResult(_0x28459a,null))['catch'](handleError(_0x28459a,null));};exports[_0xbb0d('0x60')]=function(_0x512b66,_0x5449ac,_0x17d7cd){var _0x1aa03e={'raw':!![],'where':{}},_0x4ad2f0={},_0x343478;return db[_0xbb0d('0x3b')][_0xbb0d('0x61')]({'where':{'id':_0x512b66[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](handleEntityNotFound(_0x5449ac,null))[_0xbb0d('0x31')](function(_0x15d173){if(_0x15d173){_0x343478=_0x15d173['get']({'plain':!![]});_0x4ad2f0['model']=_['keys'](db[_0xbb0d('0x62')][_0xbb0d('0x3c')]);_0x4ad2f0[_0xbb0d('0x43')]=_['keys'](_0x512b66[_0xbb0d('0x43')]);_0x4ad2f0['filters']=_[_0xbb0d('0x45')](_0x4ad2f0[_0xbb0d('0x40')],_0x4ad2f0[_0xbb0d('0x43')]);_0x1aa03e[_0xbb0d('0x47')]=_[_0xbb0d('0x45')](_0x4ad2f0['model'],qs[_0xbb0d('0x46')](_0x512b66[_0xbb0d('0x43')][_0xbb0d('0x46')]));_0x1aa03e['attributes']=_0x1aa03e[_0xbb0d('0x47')][_0xbb0d('0x63')]?_0x1aa03e[_0xbb0d('0x47')]:_0x4ad2f0['model'];if(!_0x512b66[_0xbb0d('0x43')][_0xbb0d('0x48')]('nolimit')){_0x1aa03e[_0xbb0d('0x29')]=qs[_0xbb0d('0x29')](_0x512b66[_0xbb0d('0x43')][_0xbb0d('0x29')]);_0x1aa03e[_0xbb0d('0x27')]=qs[_0xbb0d('0x27')](_0x512b66[_0xbb0d('0x43')][_0xbb0d('0x27')]);}_0x1aa03e['order']=qs[_0xbb0d('0x4b')](_0x512b66[_0xbb0d('0x43')]['sort']);_0x1aa03e[_0xbb0d('0x4c')]=qs['filters'](_[_0xbb0d('0x4d')](_0x512b66[_0xbb0d('0x43')],_0x4ad2f0['filters']));_0x1aa03e[_0xbb0d('0x4c')][_0xbb0d('0x64')]=_0x15d173['id'];if(_0x512b66[_0xbb0d('0x43')][_0xbb0d('0x65')]){_0x1aa03e[_0xbb0d('0x4c')]=_['merge'](_0x1aa03e[_0xbb0d('0x4c')],{'$or':_[_0xbb0d('0x41')](_0x1aa03e['attributes'],function(_0x50c3a2){var _0x3193ca={};_0x3193ca[_0x50c3a2]={'$like':'%'+_0x512b66[_0xbb0d('0x43')][_0xbb0d('0x65')]+'%'};return _0x3193ca;})});}_0x1aa03e=_['merge']({},_0x1aa03e,_0x512b66[_0xbb0d('0x50')]);return db[_0xbb0d('0x62')][_0xbb0d('0x53')](_0x1aa03e);}})['then'](function(_0x39415e){if(_0x39415e){return db[_0xbb0d('0x66')]['findAndCountAll']({'where':{'id':_[_0xbb0d('0x41')](_0x39415e,_0xbb0d('0x67')),'role':_0xbb0d('0x68')},'attributes':['id','name',_0xbb0d('0x69'),'updatedAt',_0xbb0d('0x6a')]});}})['then'](function(_0x2ac0ba){if(_0x2ac0ba){return{'count':_0x2ac0ba[_0xbb0d('0x2a')],'rows':_[_0xbb0d('0x41')](_0x2ac0ba['rows'],function(_0x27765){return{'membername':_0x27765[_0xbb0d('0x38')],'UserId':_0x27765['id'],'queue_name':_0x343478['name'],'OpenchannelQueueId':_0x343478['id'],'interface':util[_0xbb0d('0x6b')](_0xbb0d('0x6c'),_0xbb0d('0x6d'),_0x27765[_0xbb0d('0x38')]),'penalty':0x0,'paused':_0x27765['openchannelPause'],'createdAt':_0x27765[_0xbb0d('0x6a')],'updatedAt':_0x27765[_0xbb0d('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbb0d('0x31')](respondWithFilteredResult(_0x5449ac,_0x1aa03e))['catch'](handleError(_0x5449ac,null));};exports['getTeams']=function(_0x273d88,_0xae8e77,_0x58cac5){var _0x572349={};var _0x3f1309={};var _0xd367d;var _0x25a2fb;return db['OpenchannelQueue'][_0xbb0d('0x61')]({'where':{'id':_0x273d88[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](handleEntityNotFound(_0xae8e77,null))[_0xbb0d('0x31')](function(_0x540123){if(_0x540123){_0xd367d=_0x540123;_0x3f1309['model']=_[_0xbb0d('0x42')](db[_0xbb0d('0x6f')][_0xbb0d('0x3c')]);_0x3f1309[_0xbb0d('0x43')]=_[_0xbb0d('0x42')](_0x273d88[_0xbb0d('0x43')]);_0x3f1309[_0xbb0d('0x44')]=_[_0xbb0d('0x45')](_0x3f1309[_0xbb0d('0x40')],_0x3f1309[_0xbb0d('0x43')]);_0x572349[_0xbb0d('0x47')]=_['intersection'](_0x3f1309[_0xbb0d('0x40')],qs[_0xbb0d('0x46')](_0x273d88[_0xbb0d('0x43')][_0xbb0d('0x46')]));_0x572349['attributes']=_0x572349[_0xbb0d('0x47')]['length']?_0x572349['attributes']:_0x3f1309['model'];_0x572349['order']=qs['sort'](_0x273d88['query']['sort']);_0x572349['where']=qs[_0xbb0d('0x44')](_[_0xbb0d('0x4d')](_0x273d88[_0xbb0d('0x43')],_0x3f1309[_0xbb0d('0x44')]));if(_0x273d88[_0xbb0d('0x43')][_0xbb0d('0x65')]){_0x572349[_0xbb0d('0x4c')]=_['merge'](_0x572349[_0xbb0d('0x4c')],{'$or':_[_0xbb0d('0x41')](_0x572349[_0xbb0d('0x47')],function(_0x295471){var _0xac8ede={};_0xac8ede[_0x295471]={'$like':'%'+_0x273d88[_0xbb0d('0x43')][_0xbb0d('0x65')]+'%'};return _0xac8ede;})});}_0x572349=_[_0xbb0d('0x4f')]({},_0x572349,_0x273d88[_0xbb0d('0x50')]);return _0xd367d[_0xbb0d('0x70')](_0x572349);}})[_0xbb0d('0x31')](function(_0x272a64){if(_0x272a64){_0x25a2fb=_0x272a64[_0xbb0d('0x63')];if(!_0x273d88[_0xbb0d('0x43')][_0xbb0d('0x48')](_0xbb0d('0x49'))){_0x572349[_0xbb0d('0x29')]=qs[_0xbb0d('0x29')](_0x273d88[_0xbb0d('0x43')][_0xbb0d('0x29')]);_0x572349[_0xbb0d('0x27')]=qs[_0xbb0d('0x27')](_0x273d88[_0xbb0d('0x43')][_0xbb0d('0x27')]);}return _0xd367d[_0xbb0d('0x70')](_0x572349);}})[_0xbb0d('0x31')](function(_0x3ef266){if(_0x3ef266){return _0x3ef266?{'count':_0x25a2fb,'rows':_0x3ef266}:null;}})['then'](respondWithResult(_0xae8e77,null))[_0xbb0d('0x55')](handleError(_0xae8e77,null));};exports[_0xbb0d('0x71')]=function(_0x567c85,_0xd3558e,_0x3ac28a){var _0x4ed775=_0x567c85['body'][_0xbb0d('0x72')];return db[_0xbb0d('0x6f')][_0xbb0d('0x53')]({'where':{'id':_0x4ed775},'attributes':['id'],'include':[{'model':db[_0xbb0d('0x66')],'as':'Agents','attributes':['id',_0xbb0d('0x38'),'online','voicePause',_0xbb0d('0x73')],'raw':!![]}]})['then'](function(_0x306803){if(_0x306803){var _0x229494=_[_0xbb0d('0x74')](_0x306803,function(_0x2c1771){var _0xe900b3=_0x2c1771['get']({'plain':!![]});return _0xe900b3[_0xbb0d('0x75')];});return db[_0xbb0d('0x3b')]['find']({'where':{'id':_0x567c85[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](function(_0x538c32){return db[_0xbb0d('0x76')][_0xbb0d('0x77')](function(_0x3e14b1){return _0x538c32[_0xbb0d('0x71')](_0x4ed775,{'transaction':_0x3e14b1})['then'](function(){return BPromise[_0xbb0d('0x78')](_0x229494,function(_0x35c43f){return db[_0xbb0d('0x62')]['findOrCreate']({'where':{'UserId':_0x35c43f['id'],'OpenchannelQueueId':_0x567c85[_0xbb0d('0x57')]['id']},'transaction':_0x3e14b1});});})[_0xbb0d('0x31')](function(){_0x229494[_0xbb0d('0x79')](function(_0x722448){socket[_0xbb0d('0x7a')](_0xbb0d('0x7b'),{'UserId':_0x722448['id'],'OpenchannelQueueId':_0x538c32['id']});});});});});}})[_0xbb0d('0x31')](respondWithStatusCode(_0xd3558e,null))[_0xbb0d('0x55')](handleError(_0xd3558e,null));};exports[_0xbb0d('0x7c')]=function(_0x5c1243,_0x1921ed,_0x28b426){return db[_0xbb0d('0x6f')][_0xbb0d('0x53')]({'where':{'id':_0x5c1243[_0xbb0d('0x43')][_0xbb0d('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbb0d('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1921ed,null))['then'](function(_0x1c7187){var _0x1b9d9d=_['map'](_0x1c7187,'id');var _0x25c82d=[];var _0x3a382b=[];var _0xb1da28=squel[_0xbb0d('0x7d')]();_0xb1da28['field'](_0xbb0d('0x7e'))[_0xbb0d('0x7f')](_0xbb0d('0x80'),'tq')[_0xbb0d('0x81')](_0xbb0d('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbb0d('0x4c')]('OpenchannelQueueId\x20=\x20?',_0x5c1243[_0xbb0d('0x57')]['id']);for(var _0xfcd6b5=0x0;_0xfcd6b5<_0x1c7187[_0xbb0d('0x63')];_0xfcd6b5+=0x1){let _0x4040b6=_0x1c7187[_0xfcd6b5];for(var _0x4ebc70=0x0;_0x4ebc70<_0x4040b6['Agents'][_0xbb0d('0x63')];_0x4ebc70+=0x1){let _0x7f8391=_0x4040b6[_0xbb0d('0x75')][_0x4ebc70];var _0x162a67=_0xb1da28[_0xbb0d('0x83')]();_0x162a67[_0xbb0d('0x4c')](_0xbb0d('0x84'),_0x7f8391['id']);_0x3a382b[_0xbb0d('0x85')](db[_0xbb0d('0x76')]['query'](_0x162a67[_0xbb0d('0x86')](),{'type':db[_0xbb0d('0x76')][_0xbb0d('0x87')][_0xbb0d('0x88')]})[_0xbb0d('0x31')](function(_0x3eaa44){if(_0x3eaa44['length']===0x1){return _0x7f8391['id'];}else{var _0x573ced=_['every'](_[_0xbb0d('0x41')](_0x3eaa44,_0xbb0d('0x89')),function(_0x5b74b8){return _['includes'](_0x1b9d9d,_0x5b74b8);});if(_0x573ced){return _0x7f8391['id'];}}}));}}return BPromise['all'](_0x3a382b)[_0xbb0d('0x31')](function(_0x1f1b34){_0x25c82d=_(_0x25c82d)[_0xbb0d('0x8a')](_0x1f1b34)[_0xbb0d('0x8b')]()[_0xbb0d('0x8c')]();return db[_0xbb0d('0x3b')][_0xbb0d('0x58')]({'where':{'id':_0x5c1243[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](function(_0x36db41){return db[_0xbb0d('0x76')]['transaction'](function(_0x3565dc){return _0x36db41[_0xbb0d('0x7c')](_0x5c1243[_0xbb0d('0x43')][_0xbb0d('0x72')],{'transaction':_0x3565dc})['then'](function(){if(!_[_0xbb0d('0x8d')](_0x25c82d)){return _0x36db41['removeAgents'](_0x25c82d,{'transaction':_0x3565dc});}})[_0xbb0d('0x31')](function(){_0x25c82d[_0xbb0d('0x79')](function(_0x5916c5){socket['emit'](_0xbb0d('0x8e'),{'UserId':_0x5916c5,'OpenchannelQueueId':_0x36db41['id']});});});});});});})[_0xbb0d('0x31')](respondWithStatusCode(_0x1921ed,null))[_0xbb0d('0x55')](handleError(_0x1921ed,null));};exports[_0xbb0d('0x8f')]=function(_0x1a9cbc,_0x1db6af,_0x431e73){return db['OpenchannelQueue'][_0xbb0d('0x58')]({'where':{'id':_0x1a9cbc[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](handleEntityNotFound(_0x1db6af,null))[_0xbb0d('0x31')](function(_0x5776af){if(_0x5776af){return _0x5776af[_0xbb0d('0x8f')](_0x1a9cbc[_0xbb0d('0x5e')][_0xbb0d('0x72')],_[_0xbb0d('0x90')](_0x1a9cbc[_0xbb0d('0x5e')],['ids','id'])||{})[_0xbb0d('0x91')](function(_0x5ab79f){for(var _0x4b6c4c=0x0;_0x4b6c4c<_0x1a9cbc[_0xbb0d('0x5e')][_0xbb0d('0x72')][_0xbb0d('0x63')];_0x4b6c4c+=0x1){socket['emit'](_0xbb0d('0x7b'),{'UserId':Number(_0x1a9cbc[_0xbb0d('0x5e')][_0xbb0d('0x72')][_0x4b6c4c]),'OpenchannelQueueId':Number(_0x1a9cbc[_0xbb0d('0x57')]['id'])});}return _0x5ab79f;});}})[_0xbb0d('0x31')](respondWithResult(_0x1db6af,null))['catch'](handleError(_0x1db6af,null));};exports[_0xbb0d('0x92')]=function(_0x3a95e7,_0x2776cb,_0x29b731){return db[_0xbb0d('0x3b')][_0xbb0d('0x58')]({'where':{'id':_0x3a95e7[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](handleEntityNotFound(_0x2776cb,null))[_0xbb0d('0x31')](function(_0x9f2bef){if(_0x9f2bef){return _0x9f2bef[_0xbb0d('0x92')](_0x3a95e7['query'][_0xbb0d('0x72')])[_0xbb0d('0x31')](function(){if(_['isArray'](_0x3a95e7['query'][_0xbb0d('0x72')])){for(var _0x504d07=0x0;_0x504d07<_0x3a95e7[_0xbb0d('0x43')]['ids'][_0xbb0d('0x63')];_0x504d07+=0x1){socket[_0xbb0d('0x7a')](_0xbb0d('0x8e'),{'UserId':Number(_0x3a95e7[_0xbb0d('0x43')][_0xbb0d('0x72')][_0x504d07]),'OpenchannelQueueId':Number(_0x3a95e7[_0xbb0d('0x57')]['id'])});}}else{socket['emit'](_0xbb0d('0x8e'),{'UserId':Number(_0x3a95e7[_0xbb0d('0x43')]['ids']),'OpenchannelQueueId':Number(_0x3a95e7[_0xbb0d('0x57')]['id'])});}});}})[_0xbb0d('0x31')](respondWithStatusCode(_0x2776cb,null))[_0xbb0d('0x55')](handleError(_0x2776cb,null));};exports[_0xbb0d('0x93')]=function(_0x295bd1,_0x34bbbf,_0x235503){var _0x3f5563={};var _0x509e2c={};var _0x138a23;var _0x5ddf24;return db[_0xbb0d('0x3b')][_0xbb0d('0x61')]({'where':{'id':_0x295bd1[_0xbb0d('0x57')]['id']}})[_0xbb0d('0x31')](handleEntityNotFound(_0x34bbbf,null))[_0xbb0d('0x31')](function(_0x5450ad){if(_0x5450ad){_0x138a23=_0x5450ad;_0x509e2c['model']=_[_0xbb0d('0x42')](db[_0xbb0d('0x66')][_0xbb0d('0x3c')]);_0x509e2c['query']=_[_0xbb0d('0x42')](_0x295bd1[_0xbb0d('0x43')]);_0x509e2c['filters']=_[_0xbb0d('0x45')](_0x509e2c[_0xbb0d('0x40')],_0x509e2c['query']);_0x3f5563['attributes']=_[_0xbb0d('0x45')](_0x509e2c[_0xbb0d('0x40')],qs[_0xbb0d('0x46')](_0x295bd1[_0xbb0d('0x43')]['fields']));_0x3f5563[_0xbb0d('0x47')]=_0x3f5563['attributes'][_0xbb0d('0x63')]?_0x3f5563[_0xbb0d('0x47')]:_0x509e2c[_0xbb0d('0x40')];_0x3f5563['order']=qs[_0xbb0d('0x4b')](_0x295bd1[_0xbb0d('0x43')][_0xbb0d('0x4b')]);_0x3f5563[_0xbb0d('0x4c')]=qs[_0xbb0d('0x44')](_[_0xbb0d('0x4d')](_0x295bd1[_0xbb0d('0x43')],_0x509e2c[_0xbb0d('0x44')]));if(_0x295bd1[_0xbb0d('0x43')][_0xbb0d('0x65')]){_0x3f5563[_0xbb0d('0x4c')]=_[_0xbb0d('0x4f')](_0x3f5563[_0xbb0d('0x4c')],{'$or':_['map'](_0x3f5563[_0xbb0d('0x47')],function(_0xa330f6){var _0xf8422d={};_0xf8422d[_0xa330f6]={'$like':'%'+_0x295bd1[_0xbb0d('0x43')]['filter']+'%'};return _0xf8422d;})});}_0x3f5563=_[_0xbb0d('0x4f')]({},_0x3f5563,_0x295bd1[_0xbb0d('0x50')]);return _0x138a23[_0xbb0d('0x93')](_0x3f5563);}})[_0xbb0d('0x31')](function(_0x51f967){if(_0x51f967){_0x5ddf24=_0x51f967[_0xbb0d('0x63')];if(!_0x295bd1[_0xbb0d('0x43')][_0xbb0d('0x48')]('nolimit')){_0x3f5563[_0xbb0d('0x29')]=qs[_0xbb0d('0x29')](_0x295bd1['query']['limit']);_0x3f5563['offset']=qs[_0xbb0d('0x27')](_0x295bd1[_0xbb0d('0x43')]['offset']);}return _0x138a23[_0xbb0d('0x93')](_0x3f5563);}})[_0xbb0d('0x31')](function(_0x4cade8){if(_0x4cade8){return _0x4cade8?{'count':_0x5ddf24,'rows':_0x4cade8}:null;}})['then'](respondWithResult(_0x34bbbf,null))[_0xbb0d('0x55')](handleError(_0x34bbbf,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c01b98f..7488eaa 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 _0x394e=['hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x394e,0x18f));var _0xe394=function(_0x443242,_0x4d9878){_0x443242=_0x443242-0x0;var _0x2c7479=_0x394e[_0x443242];return _0x2c7479;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xe394('0x0'))['db'][_0xe394('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe394('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe394('0x3'),'afterDestroy':_0xe394('0x4')};function emitEvent(_0x499db5){return function(_0x4f318d,_0x68bf0a,_0x506bf8){OpenchannelQueueEvents[_0xe394('0x5')](_0x499db5+':'+_0x4f318d['id'],_0x4f318d);OpenchannelQueueEvents[_0xe394('0x5')](_0x499db5,_0x4f318d);_0x506bf8(null);};}for(var e in events){if(events[_0xe394('0x6')](e)){var event=events[e];OpenchannelQueue[_0xe394('0x7')](e,emitEvent(event));}}module[_0xe394('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x831c=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x831c,0x195));var _0xc831=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x831c[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xc831('0x0'));var OpenchannelQueue=require(_0xc831('0x1'))['db'][_0xc831('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc831('0x3')](0x0);var events={'afterCreate':_0xc831('0x4'),'afterUpdate':_0xc831('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b133b){return function(_0x4b1742,_0x4d4134,_0x5eae7e){OpenchannelQueueEvents[_0xc831('0x6')](_0x1b133b+':'+_0x4b1742['id'],_0x4b1742);OpenchannelQueueEvents[_0xc831('0x6')](_0x1b133b,_0x4b1742);_0x5eae7e(null);};}for(var e in events){if(events[_0xc831('0x7')](e)){var event=events[e];OpenchannelQueue[_0xc831('0x8')](e,emitEvent(event));}}module[_0xc831('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 6a8a4de..bc55c2a 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 _0xfb63=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','lodash'];(function(_0x2661ae,_0x252bed){var _0x18525a=function(_0x18b9f7){while(--_0x18b9f7){_0x2661ae['push'](_0x2661ae['shift']());}};_0x18525a(++_0x252bed);}(_0xfb63,0x154));var _0x3fb6=function(_0x7db3f8,_0x1135fd){_0x7db3f8=_0x7db3f8-0x0;var _0x239272=_0xfb63[_0x7db3f8];return _0x239272;};'use strict';var _=require(_0x3fb6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3fb6('0x1'));var moment=require(_0x3fb6('0x2'));var BPromise=require(_0x3fb6('0x3'));var rp=require(_0x3fb6('0x4'));var fs=require('fs');var path=require(_0x3fb6('0x5'));var rimraf=require(_0x3fb6('0x6'));var config=require(_0x3fb6('0x7'));var attributes=require(_0x3fb6('0x8'));module['exports']=function(_0x4f6dce,_0x525561){return _0x4f6dce[_0x3fb6('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x3fb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1910=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x324f7d,_0x3a0184){var _0x158d1e=function(_0x460f99){while(--_0x460f99){_0x324f7d['push'](_0x324f7d['shift']());}};_0x158d1e(++_0x3a0184);}(_0x1910,0x141));var _0x0191=function(_0x725a1b,_0x39e635){_0x725a1b=_0x725a1b-0x0;var _0x16d114=_0x1910[_0x725a1b];return _0x16d114;};'use strict';var _=require(_0x0191('0x0'));var util=require(_0x0191('0x1'));var logger=require(_0x0191('0x2'))(_0x0191('0x3'));var moment=require('moment');var BPromise=require(_0x0191('0x4'));var rp=require(_0x0191('0x5'));var fs=require('fs');var path=require(_0x0191('0x6'));var rimraf=require(_0x0191('0x7'));var config=require(_0x0191('0x8'));var attributes=require(_0x0191('0x9'));module[_0x0191('0xa')]=function(_0x36d130,_0xba76c4){return _0x36d130[_0x0191('0xb')]('OpenchannelQueue',attributes,{'tableName':_0x0191('0xc'),'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 f4286ea..9f43426 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 _0x76b9=['message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','map','include','ShowOpenchannelQueue','find','model','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e15c2,_0x25b65f){var _0xcf2e63=function(_0x1bede2){while(--_0x1bede2){_0x3e15c2['push'](_0x3e15c2['shift']());}};_0xcf2e63(++_0x25b65f);}(_0x76b9,0xec));var _0x976b=function(_0xfb3e6f,_0x334293){_0xfb3e6f=_0xfb3e6f-0x0;var _0x3c0ccf=_0x76b9[_0xfb3e6f];return _0x3c0ccf;};'use strict';var _=require(_0x976b('0x0'));var util=require('util');var moment=require(_0x976b('0x1'));var BPromise=require(_0x976b('0x2'));var rs=require(_0x976b('0x3'));var fs=require('fs');var Redis=require(_0x976b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x976b('0x5'));var logger=require(_0x976b('0x6'))(_0x976b('0x7'));var config=require(_0x976b('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x976b('0x9')]=_[_0x976b('0xa')](config['redis'],{'host':_0x976b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x976b('0x9')]));require(_0x976b('0xc'))[_0x976b('0xd')](socket);function respondWithRpcPromise(_0x58781f,_0x581f8c,_0x245bab){return new BPromise(function(_0x79c7a6,_0x88162e){return client['request'](_0x58781f,_0x245bab)[_0x976b('0xe')](function(_0x486f4b){logger[_0x976b('0xf')](_0x976b('0x10'),_0x581f8c,_0x976b('0x11'));logger[_0x976b('0x12')](_0x976b('0x13'),_0x581f8c,_0x976b('0x11'),JSON[_0x976b('0x14')](_0x486f4b));if(_0x486f4b['error']){if(_0x486f4b[_0x976b('0x15')][_0x976b('0x16')]===0x1f4){logger[_0x976b('0x15')](_0x976b('0x10'),_0x581f8c,_0x486f4b[_0x976b('0x15')][_0x976b('0x17')]);return _0x88162e(_0x486f4b[_0x976b('0x15')][_0x976b('0x17')]);}logger[_0x976b('0x15')](_0x976b('0x10'),_0x581f8c,_0x486f4b[_0x976b('0x15')][_0x976b('0x17')]);return _0x79c7a6(_0x486f4b['error'][_0x976b('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x581f8c,_0x976b('0x11'));_0x79c7a6(_0x486f4b[_0x976b('0x18')]['message']);}})[_0x976b('0x19')](function(_0x50662f){logger['error'](_0x976b('0x10'),_0x581f8c,_0x50662f);_0x88162e(_0x50662f);});});}exports[_0x976b('0x1a')]=function(_0x3a0e06){var _0x776923=this;return new Promise(function(_0x2f8c95,_0x1f536e){return db[_0x976b('0x1b')]['findAll']({'raw':_0x3a0e06[_0x976b('0x1c')]?_0x3a0e06[_0x976b('0x1c')][_0x976b('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a0e06['options']?_0x3a0e06[_0x976b('0x1c')][_0x976b('0x1e')]||null:null,'attributes':_0x3a0e06['options']?_0x3a0e06['options'][_0x976b('0x1f')]||null:null,'limit':_0x3a0e06[_0x976b('0x1c')]?_0x3a0e06[_0x976b('0x1c')]['limit']||null:null,'include':_0x3a0e06[_0x976b('0x1c')]?_0x3a0e06['options']['include']?_[_0x976b('0x20')](_0x3a0e06[_0x976b('0x1c')][_0x976b('0x21')],function(_0x3f3ab1){return{'model':db[_0x3f3ab1['model']],'as':_0x3f3ab1['as'],'attributes':_0x3f3ab1[_0x976b('0x1f')],'include':_0x3f3ab1[_0x976b('0x21')]?_[_0x976b('0x20')](_0x3f3ab1[_0x976b('0x21')],function(_0x3fdc61){return{'model':db[_0x3fdc61['model']],'as':_0x3fdc61['as'],'attributes':_0x3fdc61[_0x976b('0x1f')],'include':_0x3fdc61['include']?_[_0x976b('0x20')](_0x3fdc61['include'],function(_0x261577){return{'model':db[_0x261577['model']],'as':_0x261577['as'],'attributes':_0x261577[_0x976b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x976b('0xe')](function(_0x143e3d){logger[_0x976b('0xf')](_0x976b('0x1a'),_0x3a0e06);logger['debug']('GetOpenchannelQueue',_0x3a0e06,JSON['stringify'](_0x143e3d));_0x2f8c95(_0x143e3d);})['catch'](function(_0x9e5a5f){logger['error'](_0x976b('0x1a'),_0x9e5a5f['message'],_0x3a0e06);_0x1f536e(_0x776923[_0x976b('0x15')](0x1f4,_0x9e5a5f['message']));});});};exports[_0x976b('0x22')]=function(_0x3f4c54){var _0x5b4c35=this;return new Promise(function(_0x2adb5e,_0x31181d){return db['OpenchannelQueue'][_0x976b('0x23')]({'raw':_0x3f4c54['options']?_0x3f4c54[_0x976b('0x1c')][_0x976b('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f4c54[_0x976b('0x1c')]?_0x3f4c54[_0x976b('0x1c')][_0x976b('0x1e')]||null:null,'attributes':_0x3f4c54[_0x976b('0x1c')]?_0x3f4c54['options'][_0x976b('0x1f')]||null:null,'include':_0x3f4c54['options']?_0x3f4c54[_0x976b('0x1c')][_0x976b('0x21')]?_[_0x976b('0x20')](_0x3f4c54[_0x976b('0x1c')]['include'],function(_0x36448a){return{'model':db[_0x36448a['model']],'as':_0x36448a['as'],'attributes':_0x36448a['attributes'],'include':_0x36448a[_0x976b('0x21')]?_['map'](_0x36448a[_0x976b('0x21')],function(_0x1bbfb4){return{'model':db[_0x1bbfb4[_0x976b('0x24')]],'as':_0x1bbfb4['as'],'attributes':_0x1bbfb4[_0x976b('0x1f')],'include':_0x1bbfb4[_0x976b('0x21')]?_['map'](_0x1bbfb4[_0x976b('0x21')],function(_0xd2fe37){return{'model':db[_0xd2fe37['model']],'as':_0xd2fe37['as'],'attributes':_0xd2fe37[_0x976b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b7865){logger[_0x976b('0xf')]('ShowOpenchannelQueue',_0x3f4c54);logger[_0x976b('0x12')](_0x976b('0x22'),_0x3f4c54,JSON[_0x976b('0x14')](_0x4b7865));_0x2adb5e(_0x4b7865);})[_0x976b('0x19')](function(_0xdc461b){logger[_0x976b('0x15')](_0x976b('0x22'),_0xdc461b[_0x976b('0x17')],_0x3f4c54);_0x31181d(_0x5b4c35[_0x976b('0x15')](0x1f4,_0xdc461b['message']));});});}; \ No newline at end of file +var _0x3dfa=['socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','map','include','model','attributes','find','ShowOpenchannelQueue','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x246797,_0x26a633){var _0xc895f9=function(_0x27e431){while(--_0x27e431){_0x246797['push'](_0x246797['shift']());}};_0xc895f9(++_0x26a633);}(_0x3dfa,0x68));var _0xa3df=function(_0x54febe,_0xeb01b){_0x54febe=_0x54febe-0x0;var _0x20f7bc=_0x3dfa[_0x54febe];return _0x20f7bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa3df('0x0'));var BPromise=require(_0xa3df('0x1'));var rs=require(_0xa3df('0x2'));var fs=require('fs');var Redis=require(_0xa3df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3df('0x4'));var logger=require(_0xa3df('0x5'))(_0xa3df('0x6'));var config=require(_0xa3df('0x7'));var jayson=require(_0xa3df('0x8'));var client=jayson[_0xa3df('0x9')][_0xa3df('0xa')]({'port':0x232a});config[_0xa3df('0xb')]=_['defaults'](config['redis'],{'host':_0xa3df('0xc'),'port':0x18eb});var socket=require(_0xa3df('0xd'))(new Redis(config[_0xa3df('0xb')]));require(_0xa3df('0xe'))[_0xa3df('0xf')](socket);function respondWithRpcPromise(_0x3692d4,_0x2d46fd,_0x27ca17){return new BPromise(function(_0x300fa6,_0x3c3a53){return client[_0xa3df('0x10')](_0x3692d4,_0x27ca17)[_0xa3df('0x11')](function(_0x3dbea5){logger[_0xa3df('0x12')](_0xa3df('0x13'),_0x2d46fd,_0xa3df('0x14'));logger[_0xa3df('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2d46fd,'request\x20sent',JSON[_0xa3df('0x16')](_0x3dbea5));if(_0x3dbea5['error']){if(_0x3dbea5[_0xa3df('0x17')]['code']===0x1f4){logger['error'](_0xa3df('0x13'),_0x2d46fd,_0x3dbea5[_0xa3df('0x17')][_0xa3df('0x18')]);return _0x3c3a53(_0x3dbea5[_0xa3df('0x17')][_0xa3df('0x18')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2d46fd,_0x3dbea5['error'][_0xa3df('0x18')]);return _0x300fa6(_0x3dbea5[_0xa3df('0x17')][_0xa3df('0x18')]);}else{logger[_0xa3df('0x12')](_0xa3df('0x13'),_0x2d46fd,_0xa3df('0x14'));_0x300fa6(_0x3dbea5[_0xa3df('0x19')][_0xa3df('0x18')]);}})[_0xa3df('0x1a')](function(_0x324b9a){logger['error'](_0xa3df('0x13'),_0x2d46fd,_0x324b9a);_0x3c3a53(_0x324b9a);});});}exports[_0xa3df('0x1b')]=function(_0x1dc0f4){var _0x3c1d19=this;return new Promise(function(_0xab581f,_0xc4950){return db[_0xa3df('0x1c')][_0xa3df('0x1d')]({'raw':_0x1dc0f4[_0xa3df('0x1e')]?_0x1dc0f4['options'][_0xa3df('0x1f')]===undefined?!![]:![]:!![],'where':_0x1dc0f4['options']?_0x1dc0f4[_0xa3df('0x1e')][_0xa3df('0x20')]||null:null,'attributes':_0x1dc0f4[_0xa3df('0x1e')]?_0x1dc0f4[_0xa3df('0x1e')]['attributes']||null:null,'limit':_0x1dc0f4['options']?_0x1dc0f4['options']['limit']||null:null,'include':_0x1dc0f4[_0xa3df('0x1e')]?_0x1dc0f4[_0xa3df('0x1e')]['include']?_[_0xa3df('0x21')](_0x1dc0f4[_0xa3df('0x1e')][_0xa3df('0x22')],function(_0x5296cb){return{'model':db[_0x5296cb['model']],'as':_0x5296cb['as'],'attributes':_0x5296cb['attributes'],'include':_0x5296cb[_0xa3df('0x22')]?_[_0xa3df('0x21')](_0x5296cb['include'],function(_0x42a112){return{'model':db[_0x42a112[_0xa3df('0x23')]],'as':_0x42a112['as'],'attributes':_0x42a112[_0xa3df('0x24')],'include':_0x42a112['include']?_[_0xa3df('0x21')](_0x42a112[_0xa3df('0x22')],function(_0x529850){return{'model':db[_0x529850[_0xa3df('0x23')]],'as':_0x529850['as'],'attributes':_0x529850[_0xa3df('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa3df('0x11')](function(_0x226356){logger[_0xa3df('0x12')](_0xa3df('0x1b'),_0x1dc0f4);logger[_0xa3df('0x15')](_0xa3df('0x1b'),_0x1dc0f4,JSON[_0xa3df('0x16')](_0x226356));_0xab581f(_0x226356);})[_0xa3df('0x1a')](function(_0x19d0c3){logger[_0xa3df('0x17')]('GetOpenchannelQueue',_0x19d0c3[_0xa3df('0x18')],_0x1dc0f4);_0xc4950(_0x3c1d19[_0xa3df('0x17')](0x1f4,_0x19d0c3[_0xa3df('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0x35208d){var _0xa9c0ef=this;return new Promise(function(_0x1e8a3b,_0x136a2f){return db[_0xa3df('0x1c')][_0xa3df('0x25')]({'raw':_0x35208d[_0xa3df('0x1e')]?_0x35208d[_0xa3df('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x35208d[_0xa3df('0x1e')]?_0x35208d[_0xa3df('0x1e')][_0xa3df('0x20')]||null:null,'attributes':_0x35208d[_0xa3df('0x1e')]?_0x35208d[_0xa3df('0x1e')][_0xa3df('0x24')]||null:null,'include':_0x35208d[_0xa3df('0x1e')]?_0x35208d['options'][_0xa3df('0x22')]?_[_0xa3df('0x21')](_0x35208d['options'][_0xa3df('0x22')],function(_0x404daf){return{'model':db[_0x404daf[_0xa3df('0x23')]],'as':_0x404daf['as'],'attributes':_0x404daf[_0xa3df('0x24')],'include':_0x404daf['include']?_[_0xa3df('0x21')](_0x404daf[_0xa3df('0x22')],function(_0x528fc2){return{'model':db[_0x528fc2[_0xa3df('0x23')]],'as':_0x528fc2['as'],'attributes':_0x528fc2[_0xa3df('0x24')],'include':_0x528fc2['include']?_[_0xa3df('0x21')](_0x528fc2[_0xa3df('0x22')],function(_0x27ca29){return{'model':db[_0x27ca29[_0xa3df('0x23')]],'as':_0x27ca29['as'],'attributes':_0x27ca29[_0xa3df('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa3df('0x11')](function(_0xc3f792){logger[_0xa3df('0x12')](_0xa3df('0x26'),_0x35208d);logger[_0xa3df('0x15')](_0xa3df('0x26'),_0x35208d,JSON[_0xa3df('0x16')](_0xc3f792));_0x1e8a3b(_0xc3f792);})[_0xa3df('0x1a')](function(_0x14dfb2){logger[_0xa3df('0x17')](_0xa3df('0x26'),_0x14dfb2[_0xa3df('0x18')],_0x35208d);_0x136a2f(_0xa9c0ef[_0xa3df('0x17')](0x1f4,_0x14dfb2[_0xa3df('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8bee562..762b1db 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 _0x97c2=['length','openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener','register'];(function(_0x1a6a25,_0x2394f6){var _0x592ccb=function(_0x4f6994){while(--_0x4f6994){_0x1a6a25['push'](_0x1a6a25['shift']());}};_0x592ccb(++_0x2394f6);}(_0x97c2,0x18a));var _0x297c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c2[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelQueueEvents=require(_0x297c('0x0'));var events=['save',_0x297c('0x1'),_0x297c('0x2')];function createListener(_0x13f77a,_0x2249bd){return function(_0x1eeb59){_0x2249bd[_0x297c('0x3')](_0x13f77a,_0x1eeb59);};}function removeListener(_0x41f597,_0x8a5c08){return function(){OpenchannelQueueEvents[_0x297c('0x4')](_0x41f597,_0x8a5c08);};}exports[_0x297c('0x5')]=function(_0x11ecc7){for(var _0x36a739=0x0,_0x3a3180=events[_0x297c('0x6')];_0x36a739<_0x3a3180;_0x36a739++){var _0x449c40=events[_0x36a739];var _0x1422b1=createListener(_0x297c('0x7')+_0x449c40,_0x11ecc7);OpenchannelQueueEvents['on'](_0x449c40,_0x1422b1);}}; \ No newline at end of file +var _0x2529=['register','length','openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener'];(function(_0x2f1a1d,_0x2f9096){var _0x38085a=function(_0x843b41){while(--_0x843b41){_0x2f1a1d['push'](_0x2f1a1d['shift']());}};_0x38085a(++_0x2f9096);}(_0x2529,0x9b));var _0x9252=function(_0x283d4c,_0x426915){_0x283d4c=_0x283d4c-0x0;var _0x5daa13=_0x2529[_0x283d4c];return _0x5daa13;};'use strict';var OpenchannelQueueEvents=require(_0x9252('0x0'));var events=['save',_0x9252('0x1'),_0x9252('0x2')];function createListener(_0x1007d3,_0x58d37a){return function(_0x564de0){_0x58d37a[_0x9252('0x3')](_0x1007d3,_0x564de0);};}function removeListener(_0x54c8e7,_0x222a98){return function(){OpenchannelQueueEvents[_0x9252('0x4')](_0x54c8e7,_0x222a98);};}exports[_0x9252('0x5')]=function(_0x41fff8){for(var _0x35f9ed=0x0,_0x57c830=events[_0x9252('0x6')];_0x35f9ed<_0x57c830;_0x35f9ed++){var _0x18e7a3=events[_0x35f9ed];var _0x369d50=createListener(_0x9252('0x7')+_0x18e7a3,_0x41fff8);OpenchannelQueueEvents['on'](_0x18e7a3,_0x369d50);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e663965..a393205 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 _0x51c2=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','put','update','delete','/:id','destroy'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0x51c2,0xfc));var _0x251c=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x51c2[_0x235482];return _0x5f5bea;};'use strict';var multer=require('multer');var util=require(_0x251c('0x0'));var path=require(_0x251c('0x1'));var timeout=require('connect-timeout');var express=require(_0x251c('0x2'));var router=express[_0x251c('0x3')]();var fs_extra=require(_0x251c('0x4'));var auth=require(_0x251c('0x5'));var interaction=require(_0x251c('0x6'));var config=require(_0x251c('0x7'));var controller=require(_0x251c('0x8'));router[_0x251c('0x9')]('/',auth['isAuthenticated'](),controller[_0x251c('0xa')]);router['get'](_0x251c('0xb'),auth[_0x251c('0xc')](),controller[_0x251c('0xd')]);router[_0x251c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x251c('0xe')]);router[_0x251c('0xf')]('/',auth[_0x251c('0xc')](),controller['create']);router[_0x251c('0x10')]('/:id',auth[_0x251c('0xc')](),controller[_0x251c('0x11')]);router[_0x251c('0x12')](_0x251c('0x13'),auth[_0x251c('0xc')](),controller[_0x251c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x493c=['index','/describe','/:id','show','create','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated'];(function(_0x342b62,_0x81ab57){var _0x5641ef=function(_0x34f55c){while(--_0x34f55c){_0x342b62['push'](_0x342b62['shift']());}};_0x5641ef(++_0x81ab57);}(_0x493c,0x135));var _0xc493=function(_0x59ddc1,_0x38c909){_0x59ddc1=_0x59ddc1-0x0;var _0x70c30e=_0x493c[_0x59ddc1];return _0x70c30e;};'use strict';var multer=require(_0xc493('0x0'));var util=require(_0xc493('0x1'));var path=require(_0xc493('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc493('0x3')]();var fs_extra=require(_0xc493('0x4'));var auth=require(_0xc493('0x5'));var interaction=require(_0xc493('0x6'));var config=require(_0xc493('0x7'));var controller=require(_0xc493('0x8'));router[_0xc493('0x9')]('/',auth[_0xc493('0xa')](),controller[_0xc493('0xb')]);router['get'](_0xc493('0xc'),auth[_0xc493('0xa')](),controller['describe']);router['get'](_0xc493('0xd'),auth[_0xc493('0xa')](),controller[_0xc493('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc493('0xf')]);router[_0xc493('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc493('0x11')]);router[_0xc493('0x12')](_0xc493('0xd'),auth[_0xc493('0xa')](),controller[_0xc493('0x13')]);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 fba40d3..49c8e4e 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 _0x0303=['DATE','STRING'];(function(_0x493a07,_0x123d76){var _0x23d140=function(_0x1ae684){while(--_0x1ae684){_0x493a07['push'](_0x493a07['shift']());}};_0x23d140(++_0x123d76);}(_0x0303,0x159));var _0x3030=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0x0303[_0x246f0c];return _0x30fe50;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3030('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x3030('0x0')]},'joinAt':{'type':Sequelize[_0x3030('0x1')]},'leaveAt':{'type':Sequelize[_0x3030('0x1')]},'acceptAt':{'type':Sequelize[_0x3030('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3030('0x0')]}}; \ No newline at end of file +var _0x854c=['sequelize','exports','STRING','DATE','moment'];(function(_0x52e77e,_0x2a5e6e){var _0xad2eda=function(_0xfce95d){while(--_0xfce95d){_0x52e77e['push'](_0x52e77e['shift']());}};_0xad2eda(++_0x2a5e6e);}(_0x854c,0x12b));var _0xc854=function(_0x518031,_0x4ad507){_0x518031=_0x518031-0x0;var _0x2fb60a=_0x854c[_0x518031];return _0x2fb60a;};'use strict';var moment=require(_0xc854('0x0'));var Sequelize=require(_0xc854('0x1'));module[_0xc854('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc854('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc854('0x4')]},'exitAt':{'type':Sequelize[_0xc854('0x4')]},'reason':{'type':Sequelize[_0xc854('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2779a42..b089a5c 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 _0x0188=['stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x0188,0x164));var _0x8018=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x0188[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8018('0x0'));var zipdir=require(_0x8018('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8018('0x2'));var moment=require('moment');var BPromise=require(_0x8018('0x3'));var Mustache=require(_0x8018('0x4'));var util=require(_0x8018('0x5'));var path=require(_0x8018('0x6'));var sox=require('sox');var csv=require(_0x8018('0x7'));var ejs=require(_0x8018('0x8'));var fs=require('fs');var fs_extra=require(_0x8018('0x9'));var _=require(_0x8018('0xa'));var squel=require(_0x8018('0xb'));var crypto=require(_0x8018('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8018('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8018('0xe'));var Papa=require(_0x8018('0xf'));var Redis=require(_0x8018('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8018('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8018('0x12'));var logger=require(_0x8018('0x13'))(_0x8018('0x14'));var utils=require(_0x8018('0x15'));var config=require(_0x8018('0x16'));var licenseUtil=require(_0x8018('0x17'));var db=require(_0x8018('0x18'))['db'];function respondWithStatusCode(_0x20d05f,_0x21449d){_0x21449d=_0x21449d||0xcc;return function(_0x114ad6){if(_0x114ad6){return _0x20d05f[_0x8018('0x19')](_0x21449d);}return _0x20d05f[_0x8018('0x1a')](_0x21449d)['end']();};}function respondWithResult(_0x57145b,_0xecb2b8){_0xecb2b8=_0xecb2b8||0xc8;return function(_0x23d9b2){if(_0x23d9b2){return _0x57145b['status'](_0xecb2b8)[_0x8018('0x1b')](_0x23d9b2);}};}function respondWithFilteredResult(_0x3750b3,_0x2cf2cf){return function(_0x1185a7){if(_0x1185a7){var _0x296ff7=typeof _0x2cf2cf['offset']==='undefined'&&typeof _0x2cf2cf[_0x8018('0x1c')]==='undefined';var _0x122208=_0x1185a7[_0x8018('0x1d')];var _0x4dc7a4=_0x296ff7?0x0:_0x2cf2cf[_0x8018('0x1e')];var _0x3f4b3b=_0x296ff7?_0x1185a7[_0x8018('0x1d')]:_0x2cf2cf[_0x8018('0x1e')]+_0x2cf2cf[_0x8018('0x1c')];var _0xa191f2;if(_0x3f4b3b>=_0x122208){_0x3f4b3b=_0x122208;_0xa191f2=0xc8;}else{_0xa191f2=0xce;}_0x3750b3[_0x8018('0x1a')](_0xa191f2);return _0x3750b3[_0x8018('0x1f')](_0x8018('0x20'),_0x4dc7a4+'-'+_0x3f4b3b+'/'+_0x122208)[_0x8018('0x1b')](_0x1185a7);}return null;};}function patchUpdates(_0x496259){return function(_0x1a567b){try{jsonpatch[_0x8018('0x21')](_0x1a567b,_0x496259,!![]);}catch(_0x2e408b){return BPromise[_0x8018('0x22')](_0x2e408b);}return _0x1a567b[_0x8018('0x23')]();};}function saveUpdates(_0x26a76c,_0x4ed732){return function(_0x3e3b73){if(_0x3e3b73){return _0x3e3b73[_0x8018('0x24')](_0x26a76c)[_0x8018('0x25')](function(_0x283e7a){return _0x283e7a;});}return null;};}function removeEntity(_0xab0398,_0x2688f7){return function(_0x2ba7d5){if(_0x2ba7d5){return _0x2ba7d5['destroy']()[_0x8018('0x25')](function(){_0xab0398[_0x8018('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x463d3b,_0x3de9ca){return function(_0x426678){if(!_0x426678){_0x463d3b['sendStatus'](0x194);}return _0x426678;};}function handleError(_0x58e9d7,_0x231d7){_0x231d7=_0x231d7||0x1f4;return function(_0x511885){logger[_0x8018('0x26')](_0x511885[_0x8018('0x27')]);if(_0x511885['name']){delete _0x511885[_0x8018('0x28')];}_0x58e9d7[_0x8018('0x1a')](_0x231d7)[_0x8018('0x29')](_0x511885);};}exports[_0x8018('0x2a')]=function(_0x647675,_0x56d25e){var _0x4276ed={},_0xa07f4a={},_0x34fe68={'count':0x0,'rows':[]};var _0x5456f8=_[_0x8018('0x2b')](db['OpenchannelQueueReport'][_0x8018('0x2c')],function(_0x57362c){return{'name':_0x57362c[_0x8018('0x2d')],'type':_0x57362c[_0x8018('0x2e')][_0x8018('0x2f')]};});_0xa07f4a['model']=_[_0x8018('0x2b')](_0x5456f8,'name');_0xa07f4a['query']=_[_0x8018('0x30')](_0x647675[_0x8018('0x31')]);_0xa07f4a['filters']=_[_0x8018('0x32')](_0xa07f4a[_0x8018('0x33')],_0xa07f4a['query']);_0x4276ed[_0x8018('0x34')]=_['intersection'](_0xa07f4a[_0x8018('0x33')],qs[_0x8018('0x35')](_0x647675[_0x8018('0x31')]['fields']));_0x4276ed[_0x8018('0x34')]=_0x4276ed[_0x8018('0x34')][_0x8018('0x36')]?_0x4276ed['attributes']:_0xa07f4a[_0x8018('0x33')];if(!_0x647675['query'][_0x8018('0x37')](_0x8018('0x38'))){_0x4276ed['limit']=qs[_0x8018('0x1c')](_0x647675[_0x8018('0x31')][_0x8018('0x1c')]);_0x4276ed[_0x8018('0x1e')]=qs[_0x8018('0x1e')](_0x647675[_0x8018('0x31')][_0x8018('0x1e')]);}_0x4276ed[_0x8018('0x39')]=qs[_0x8018('0x3a')](_0x647675['query'][_0x8018('0x3a')]);_0x4276ed[_0x8018('0x3b')]=qs[_0x8018('0x3c')](_[_0x8018('0x3d')](_0x647675[_0x8018('0x31')],_0xa07f4a[_0x8018('0x3c')]),_0x5456f8);if(_0x647675['query']['filter']){_0x4276ed[_0x8018('0x3b')]=_[_0x8018('0x3e')](_0x4276ed[_0x8018('0x3b')],{'$or':_[_0x8018('0x2b')](_0x5456f8,function(_0x53f1fe){if(_0x53f1fe[_0x8018('0x2e')]!==_0x8018('0x3f')){var _0x2a420d={};_0x2a420d[_0x53f1fe[_0x8018('0x28')]]={'$like':'%'+_0x647675['query'][_0x8018('0x40')]+'%'};return _0x2a420d;}})});}_0x4276ed=_[_0x8018('0x3e')]({},_0x4276ed,_0x647675[_0x8018('0x41')]);var _0xbb0a3b={'where':_0x4276ed[_0x8018('0x3b')]};return db[_0x8018('0x42')][_0x8018('0x1d')](_0xbb0a3b)[_0x8018('0x25')](function(_0x5ded3f){_0x34fe68[_0x8018('0x1d')]=_0x5ded3f;if(_0x647675[_0x8018('0x31')][_0x8018('0x43')]){_0x4276ed[_0x8018('0x44')]=[{'all':!![]}];}return db[_0x8018('0x42')][_0x8018('0x45')](_0x4276ed);})[_0x8018('0x25')](function(_0x274915){_0x34fe68[_0x8018('0x46')]=_0x274915;return _0x34fe68;})[_0x8018('0x25')](respondWithFilteredResult(_0x56d25e,_0x4276ed))[_0x8018('0x47')](handleError(_0x56d25e,null));};exports[_0x8018('0x48')]=function(_0x3d82d7,_0x22ec20){var _0x3def26={'raw':!![],'where':{'id':_0x3d82d7[_0x8018('0x49')]['id']}},_0x3207a9={};_0x3207a9[_0x8018('0x33')]=_[_0x8018('0x30')](db[_0x8018('0x42')][_0x8018('0x2c')]);_0x3207a9[_0x8018('0x31')]=_[_0x8018('0x30')](_0x3d82d7['query']);_0x3207a9[_0x8018('0x3c')]=_[_0x8018('0x32')](_0x3207a9[_0x8018('0x33')],_0x3207a9[_0x8018('0x31')]);_0x3def26[_0x8018('0x34')]=_[_0x8018('0x32')](_0x3207a9[_0x8018('0x33')],qs[_0x8018('0x35')](_0x3d82d7['query'][_0x8018('0x35')]));_0x3def26[_0x8018('0x34')]=_0x3def26[_0x8018('0x34')][_0x8018('0x36')]?_0x3def26[_0x8018('0x34')]:_0x3207a9[_0x8018('0x33')];if(_0x3d82d7[_0x8018('0x31')][_0x8018('0x43')]){_0x3def26[_0x8018('0x44')]=[{'all':!![]}];}_0x3def26=_[_0x8018('0x3e')]({},_0x3def26,_0x3d82d7['options']);return db[_0x8018('0x42')][_0x8018('0x4a')](_0x3def26)[_0x8018('0x25')](handleEntityNotFound(_0x22ec20,null))[_0x8018('0x25')](respondWithResult(_0x22ec20,null))[_0x8018('0x47')](handleError(_0x22ec20,null));};exports[_0x8018('0x4b')]=function(_0x222805,_0x2896eb){return db[_0x8018('0x42')][_0x8018('0x4b')](_0x222805[_0x8018('0x4c')],{})['then'](respondWithResult(_0x2896eb,0xc9))[_0x8018('0x47')](handleError(_0x2896eb,null));};exports['update']=function(_0x243b8a,_0x24299d){if(_0x243b8a[_0x8018('0x4c')]['id']){delete _0x243b8a[_0x8018('0x4c')]['id'];}return db[_0x8018('0x42')][_0x8018('0x4a')]({'where':{'id':_0x243b8a['params']['id']}})[_0x8018('0x25')](handleEntityNotFound(_0x24299d,null))[_0x8018('0x25')](saveUpdates(_0x243b8a['body'],null))['then'](respondWithResult(_0x24299d,null))['catch'](handleError(_0x24299d,null));};exports[_0x8018('0x4d')]=function(_0x2d7dc9,_0x23b0c3){return db[_0x8018('0x42')][_0x8018('0x4a')]({'where':{'id':_0x2d7dc9['params']['id']}})['then'](handleEntityNotFound(_0x23b0c3,null))[_0x8018('0x25')](removeEntity(_0x23b0c3,null))[_0x8018('0x47')](handleError(_0x23b0c3,null));};exports['describe']=function(_0x454e53,_0x1fa272){return db[_0x8018('0x42')][_0x8018('0x4e')]()[_0x8018('0x25')](respondWithResult(_0x1fa272,null))['catch'](handleError(_0x1fa272,null));}; \ No newline at end of file +var _0xd95f=['includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','destroy','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','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/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','end','error','stack','name','send','index','map','OpenchannelQueueReport','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xd95f,0x18d));var _0xfd95=function(_0x1aa85b,_0x29bf59){_0x1aa85b=_0x1aa85b-0x0;var _0x4035f6=_0xd95f[_0x1aa85b];return _0x4035f6;};'use strict';var emlformat=require(_0xfd95('0x0'));var rimraf=require(_0xfd95('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfd95('0x2'));var moment=require(_0xfd95('0x3'));var BPromise=require(_0xfd95('0x4'));var Mustache=require(_0xfd95('0x5'));var util=require('util');var path=require(_0xfd95('0x6'));var sox=require(_0xfd95('0x7'));var csv=require(_0xfd95('0x8'));var ejs=require(_0xfd95('0x9'));var fs=require('fs');var fs_extra=require(_0xfd95('0xa'));var _=require(_0xfd95('0xb'));var squel=require(_0xfd95('0xc'));var crypto=require(_0xfd95('0xd'));var jsforce=require(_0xfd95('0xe'));var deskjs=require(_0xfd95('0xf'));var toCsv=require(_0xfd95('0x8'));var querystring=require('querystring');var Papa=require(_0xfd95('0x10'));var Redis=require(_0xfd95('0x11'));var authService=require(_0xfd95('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfd95('0x13'));var hardwareService=require(_0xfd95('0x14'));var logger=require(_0xfd95('0x15'))(_0xfd95('0x16'));var utils=require(_0xfd95('0x17'));var config=require(_0xfd95('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd95('0x19'))['db'];function respondWithStatusCode(_0x5c0b99,_0x781a1e){_0x781a1e=_0x781a1e||0xcc;return function(_0x4c1604){if(_0x4c1604){return _0x5c0b99[_0xfd95('0x1a')](_0x781a1e);}return _0x5c0b99[_0xfd95('0x1b')](_0x781a1e)['end']();};}function respondWithResult(_0x2e8c72,_0x5d166c){_0x5d166c=_0x5d166c||0xc8;return function(_0x113252){if(_0x113252){return _0x2e8c72['status'](_0x5d166c)[_0xfd95('0x1c')](_0x113252);}};}function respondWithFilteredResult(_0x39e7b0,_0xa8423a){return function(_0x1dac01){if(_0x1dac01){var _0x1e1b70=typeof _0xa8423a[_0xfd95('0x1d')]===_0xfd95('0x1e')&&typeof _0xa8423a[_0xfd95('0x1f')]===_0xfd95('0x1e');var _0x476699=_0x1dac01[_0xfd95('0x20')];var _0x1da225=_0x1e1b70?0x0:_0xa8423a[_0xfd95('0x1d')];var _0x3b6f14=_0x1e1b70?_0x1dac01[_0xfd95('0x20')]:_0xa8423a[_0xfd95('0x1d')]+_0xa8423a[_0xfd95('0x1f')];var _0x703ce8;if(_0x3b6f14>=_0x476699){_0x3b6f14=_0x476699;_0x703ce8=0xc8;}else{_0x703ce8=0xce;}_0x39e7b0['status'](_0x703ce8);return _0x39e7b0[_0xfd95('0x21')]('Content-Range',_0x1da225+'-'+_0x3b6f14+'/'+_0x476699)['json'](_0x1dac01);}return null;};}function patchUpdates(_0x51cff3){return function(_0x50dc77){try{jsonpatch['apply'](_0x50dc77,_0x51cff3,!![]);}catch(_0x33eb2a){return BPromise[_0xfd95('0x22')](_0x33eb2a);}return _0x50dc77[_0xfd95('0x23')]();};}function saveUpdates(_0x222bf3,_0x6c6b57){return function(_0x433c00){if(_0x433c00){return _0x433c00[_0xfd95('0x24')](_0x222bf3)['then'](function(_0x593bee){return _0x593bee;});}return null;};}function removeEntity(_0x2cd93c,_0x2ce68c){return function(_0x323b04){if(_0x323b04){return _0x323b04['destroy']()[_0xfd95('0x25')](function(){_0x2cd93c[_0xfd95('0x1b')](0xcc)[_0xfd95('0x26')]();});}};}function handleEntityNotFound(_0xee228a,_0x381b77){return function(_0x355e13){if(!_0x355e13){_0xee228a[_0xfd95('0x1a')](0x194);}return _0x355e13;};}function handleError(_0xba4140,_0x2984f9){_0x2984f9=_0x2984f9||0x1f4;return function(_0x4f38b9){logger[_0xfd95('0x27')](_0x4f38b9[_0xfd95('0x28')]);if(_0x4f38b9['name']){delete _0x4f38b9[_0xfd95('0x29')];}_0xba4140[_0xfd95('0x1b')](_0x2984f9)[_0xfd95('0x2a')](_0x4f38b9);};}exports[_0xfd95('0x2b')]=function(_0x8ca467,_0x1a7362){var _0x4492fe={},_0x35b32c={},_0x5951fd={'count':0x0,'rows':[]};var _0x412ba2=_[_0xfd95('0x2c')](db[_0xfd95('0x2d')]['rawAttributes'],function(_0x309c46){return{'name':_0x309c46['fieldName'],'type':_0x309c46[_0xfd95('0x2e')][_0xfd95('0x2f')]};});_0x35b32c['model']=_['map'](_0x412ba2,_0xfd95('0x29'));_0x35b32c[_0xfd95('0x30')]=_[_0xfd95('0x31')](_0x8ca467[_0xfd95('0x30')]);_0x35b32c['filters']=_['intersection'](_0x35b32c['model'],_0x35b32c[_0xfd95('0x30')]);_0x4492fe[_0xfd95('0x32')]=_[_0xfd95('0x33')](_0x35b32c[_0xfd95('0x34')],qs[_0xfd95('0x35')](_0x8ca467[_0xfd95('0x30')][_0xfd95('0x35')]));_0x4492fe[_0xfd95('0x32')]=_0x4492fe['attributes'][_0xfd95('0x36')]?_0x4492fe[_0xfd95('0x32')]:_0x35b32c[_0xfd95('0x34')];if(!_0x8ca467[_0xfd95('0x30')][_0xfd95('0x37')](_0xfd95('0x38'))){_0x4492fe['limit']=qs['limit'](_0x8ca467[_0xfd95('0x30')][_0xfd95('0x1f')]);_0x4492fe[_0xfd95('0x1d')]=qs[_0xfd95('0x1d')](_0x8ca467['query'][_0xfd95('0x1d')]);}_0x4492fe['order']=qs[_0xfd95('0x39')](_0x8ca467[_0xfd95('0x30')]['sort']);_0x4492fe[_0xfd95('0x3a')]=qs[_0xfd95('0x3b')](_[_0xfd95('0x3c')](_0x8ca467[_0xfd95('0x30')],_0x35b32c[_0xfd95('0x3b')]),_0x412ba2);if(_0x8ca467[_0xfd95('0x30')][_0xfd95('0x3d')]){_0x4492fe[_0xfd95('0x3a')]=_['merge'](_0x4492fe[_0xfd95('0x3a')],{'$or':_[_0xfd95('0x2c')](_0x412ba2,function(_0x1217da){if(_0x1217da[_0xfd95('0x2e')]!==_0xfd95('0x3e')){var _0x4bd91b={};_0x4bd91b[_0x1217da[_0xfd95('0x29')]]={'$like':'%'+_0x8ca467[_0xfd95('0x30')][_0xfd95('0x3d')]+'%'};return _0x4bd91b;}})});}_0x4492fe=_[_0xfd95('0x3f')]({},_0x4492fe,_0x8ca467[_0xfd95('0x40')]);var _0x421ece={'where':_0x4492fe[_0xfd95('0x3a')]};return db[_0xfd95('0x2d')][_0xfd95('0x20')](_0x421ece)['then'](function(_0x3eced4){_0x5951fd['count']=_0x3eced4;if(_0x8ca467[_0xfd95('0x30')][_0xfd95('0x41')]){_0x4492fe[_0xfd95('0x42')]=[{'all':!![]}];}return db[_0xfd95('0x2d')][_0xfd95('0x43')](_0x4492fe);})[_0xfd95('0x25')](function(_0x4241ea){_0x5951fd[_0xfd95('0x44')]=_0x4241ea;return _0x5951fd;})[_0xfd95('0x25')](respondWithFilteredResult(_0x1a7362,_0x4492fe))[_0xfd95('0x45')](handleError(_0x1a7362,null));};exports['show']=function(_0x2cd561,_0x5e644d){var _0x8b9393={'raw':!![],'where':{'id':_0x2cd561[_0xfd95('0x46')]['id']}},_0x4d659b={};_0x4d659b[_0xfd95('0x34')]=_[_0xfd95('0x31')](db['OpenchannelQueueReport'][_0xfd95('0x47')]);_0x4d659b[_0xfd95('0x30')]=_[_0xfd95('0x31')](_0x2cd561['query']);_0x4d659b[_0xfd95('0x3b')]=_[_0xfd95('0x33')](_0x4d659b['model'],_0x4d659b[_0xfd95('0x30')]);_0x8b9393[_0xfd95('0x32')]=_[_0xfd95('0x33')](_0x4d659b['model'],qs[_0xfd95('0x35')](_0x2cd561[_0xfd95('0x30')][_0xfd95('0x35')]));_0x8b9393['attributes']=_0x8b9393['attributes']['length']?_0x8b9393[_0xfd95('0x32')]:_0x4d659b['model'];if(_0x2cd561[_0xfd95('0x30')][_0xfd95('0x41')]){_0x8b9393['include']=[{'all':!![]}];}_0x8b9393=_[_0xfd95('0x3f')]({},_0x8b9393,_0x2cd561[_0xfd95('0x40')]);return db['OpenchannelQueueReport']['find'](_0x8b9393)['then'](handleEntityNotFound(_0x5e644d,null))['then'](respondWithResult(_0x5e644d,null))[_0xfd95('0x45')](handleError(_0x5e644d,null));};exports[_0xfd95('0x48')]=function(_0x32ffc9,_0x44a5a9){return db[_0xfd95('0x2d')][_0xfd95('0x48')](_0x32ffc9[_0xfd95('0x49')],{})[_0xfd95('0x25')](respondWithResult(_0x44a5a9,0xc9))[_0xfd95('0x45')](handleError(_0x44a5a9,null));};exports[_0xfd95('0x24')]=function(_0x990cdf,_0x358a29){if(_0x990cdf[_0xfd95('0x49')]['id']){delete _0x990cdf[_0xfd95('0x49')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x990cdf[_0xfd95('0x46')]['id']}})[_0xfd95('0x25')](handleEntityNotFound(_0x358a29,null))[_0xfd95('0x25')](saveUpdates(_0x990cdf[_0xfd95('0x49')],null))[_0xfd95('0x25')](respondWithResult(_0x358a29,null))['catch'](handleError(_0x358a29,null));};exports[_0xfd95('0x4a')]=function(_0xef6564,_0x378e7b){return db[_0xfd95('0x2d')][_0xfd95('0x4b')]({'where':{'id':_0xef6564['params']['id']}})[_0xfd95('0x25')](handleEntityNotFound(_0x378e7b,null))[_0xfd95('0x25')](removeEntity(_0x378e7b,null))['catch'](handleError(_0x378e7b,null));};exports[_0xfd95('0x4c')]=function(_0x4ef517,_0x1fe818){return db['OpenchannelQueueReport']['describe']()[_0xfd95('0x25')](respondWithResult(_0x1fe818,null))[_0xfd95('0x45')](handleError(_0x1fe818,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2f3b659..63f1287 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x814b,0x1a2));var _0xb814=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0x814b[_0x4cdcdc];return _0x4704ce;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x3b9a65,_0x1462fb){var _0x1b029a=function(_0x3bbb43){while(--_0x3bbb43){_0x3b9a65['push'](_0x3b9a65['shift']());}};_0x1b029a(++_0x1462fb);}(_0x1261,0x144));var _0x1126=function(_0x285f9b,_0xfcae6c){_0x285f9b=_0x285f9b-0x0;var _0x32dd58=_0x1261[_0x285f9b];return _0x32dd58;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 17327ca..78439b4 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 _0x5a13=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','attributes','limit','debug','lodash','util','bluebird','randomstring','ioredis'];(function(_0x9b64d0,_0x4f745d){var _0xa65edb=function(_0x433b9a){while(--_0x433b9a){_0x9b64d0['push'](_0x9b64d0['shift']());}};_0xa65edb(++_0x4f745d);}(_0x5a13,0x145));var _0x35a1=function(_0x215e5f,_0x47e622){_0x215e5f=_0x215e5f-0x0;var _0x4a341b=_0x5a13[_0x215e5f];return _0x4a341b;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});}exports[_0x35a1('0x17')]=function(_0x1de373){var _0x5e4317=this;return new Promise(function(_0x3b17dc,_0xbeb751){return db[_0x35a1('0x18')][_0x35a1('0x19')](_0x1de373[_0x35a1('0x1a')],{'raw':_0x1de373[_0x35a1('0x1b')]?_0x1de373[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![]})[_0x35a1('0xd')](function(_0x5929e5){logger[_0x35a1('0x14')](_0x35a1('0x17'),_0x1de373);logger['debug'](_0x35a1('0x17'),_0x1de373,JSON[_0x35a1('0x10')](_0x5929e5));_0x3b17dc(_0x5929e5);})['catch'](function(_0xc13bad){logger['error'](_0x35a1('0x17'),_0xc13bad[_0x35a1('0x12')],_0x1de373);_0xbeb751(_0x5e4317[_0x35a1('0x13')](0x1f4,_0xc13bad['message']));});});};exports[_0x35a1('0x1d')]=function(_0x2b87a1){var _0x48f1bd=this;return new Promise(function(_0x4c41ce,_0x5303b4){return db[_0x35a1('0x18')]['update'](_0x2b87a1['body'],{'raw':_0x2b87a1['options']?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')]['where']||null:null,'attributes':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1e')]||null:null,'limit':_0x2b87a1[_0x35a1('0x1b')]?_0x2b87a1[_0x35a1('0x1b')][_0x35a1('0x1f')]||null:null})[_0x35a1('0xd')](function(_0x24bb2d){logger[_0x35a1('0x14')](_0x35a1('0x1d'),_0x2b87a1);logger[_0x35a1('0x20')](_0x35a1('0x1d'),_0x2b87a1,JSON[_0x35a1('0x10')](_0x24bb2d));_0x4c41ce(_0x24bb2d);})[_0x35a1('0x16')](function(_0x2ae0ca){logger['error'](_0x35a1('0x1d'),_0x2ae0ca[_0x35a1('0x12')],_0x2b87a1);_0x5303b4(_0x48f1bd[_0x35a1('0x13')](0x1f4,_0x2ae0ca[_0x35a1('0x12')]));});});}; \ No newline at end of file +var _0x5ba3=['info','OpenchannelQueueReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then'];(function(_0x3c3f07,_0x221eda){var _0x39f927=function(_0x1a2644){while(--_0x1a2644){_0x3c3f07['push'](_0x3c3f07['shift']());}};_0x39f927(++_0x221eda);}(_0x5ba3,0x140));var _0x35ba=function(_0x53718b,_0x485041){_0x53718b=_0x53718b-0x0;var _0x396c8f=_0x5ba3[_0x53718b];return _0x396c8f;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ba('0x3'));var db=require(_0x35ba('0x4'))['db'];var utils=require(_0x35ba('0x5'));var logger=require('../../config/logger')(_0x35ba('0x6'));var config=require(_0x35ba('0x7'));var jayson=require(_0x35ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cd5f,_0x3264d3,_0x380ffb){return new BPromise(function(_0x4c55f3,_0x22bed8){return client['request'](_0x20cd5f,_0x380ffb)[_0x35ba('0x9')](function(_0x366ddc){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x3264d3,'request\x20sent');logger[_0x35ba('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x3264d3,'request\x20sent',JSON['stringify'](_0x366ddc));if(_0x366ddc[_0x35ba('0xd')]){if(_0x366ddc[_0x35ba('0xd')][_0x35ba('0xe')]===0x1f4){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x22bed8(_0x366ddc[_0x35ba('0xd')]['message']);}logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x4c55f3(_0x366ddc['error'][_0x35ba('0xf')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3264d3,_0x35ba('0x10'));_0x4c55f3(_0x366ddc[_0x35ba('0x11')]['message']);}})[_0x35ba('0x12')](function(_0x2b6b71){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x2b6b71);_0x22bed8(_0x2b6b71);});});}exports[_0x35ba('0x13')]=function(_0x374f91){var _0x4e96c6=this;return new Promise(function(_0x423666,_0x247440){return db['OpenchannelQueueReport'][_0x35ba('0x14')](_0x374f91[_0x35ba('0x15')],{'raw':_0x374f91[_0x35ba('0x16')]?_0x374f91[_0x35ba('0x16')][_0x35ba('0x17')]===undefined?!![]:![]:!![]})[_0x35ba('0x9')](function(_0x3f5e92){logger[_0x35ba('0xa')](_0x35ba('0x13'),_0x374f91);logger[_0x35ba('0xc')](_0x35ba('0x13'),_0x374f91,JSON[_0x35ba('0x18')](_0x3f5e92));_0x423666(_0x3f5e92);})['catch'](function(_0x2d3b2b){logger[_0x35ba('0xd')](_0x35ba('0x13'),_0x2d3b2b[_0x35ba('0xf')],_0x374f91);_0x247440(_0x4e96c6[_0x35ba('0xd')](0x1f4,_0x2d3b2b[_0x35ba('0xf')]));});});};exports[_0x35ba('0x19')]=function(_0x439f43){var _0x547e3d=this;return new Promise(function(_0x2191b4,_0x53fd3d){return db['OpenchannelQueueReport'][_0x35ba('0x1a')](_0x439f43['body'],{'raw':_0x439f43[_0x35ba('0x16')]?_0x439f43[_0x35ba('0x16')][_0x35ba('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x439f43[_0x35ba('0x16')]?_0x439f43[_0x35ba('0x16')][_0x35ba('0x1b')]||null:null,'attributes':_0x439f43[_0x35ba('0x16')]?_0x439f43[_0x35ba('0x16')][_0x35ba('0x1c')]||null:null,'limit':_0x439f43[_0x35ba('0x16')]?_0x439f43[_0x35ba('0x16')][_0x35ba('0x1d')]||null:null})[_0x35ba('0x9')](function(_0x1914e6){logger[_0x35ba('0xa')](_0x35ba('0x19'),_0x439f43);logger['debug'](_0x35ba('0x19'),_0x439f43,JSON[_0x35ba('0x18')](_0x1914e6));_0x2191b4(_0x1914e6);})[_0x35ba('0x12')](function(_0x2185dd){logger[_0x35ba('0xd')](_0x35ba('0x19'),_0x2185dd[_0x35ba('0xf')],_0x439f43);_0x53fd3d(_0x547e3d[_0x35ba('0xd')](0x1f4,_0x2185dd[_0x35ba('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 60f939a..de43588 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 _0x03ff=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','create'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x03ff,0x1a8));var _0xf03f=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x03ff[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xf03f('0x0'));var util=require(_0xf03f('0x1'));var path=require(_0xf03f('0x2'));var timeout=require(_0xf03f('0x3'));var express=require(_0xf03f('0x4'));var router=express[_0xf03f('0x5')]();var fs_extra=require(_0xf03f('0x6'));var auth=require(_0xf03f('0x7'));var interaction=require(_0xf03f('0x8'));var config=require(_0xf03f('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0xf03f('0xa')]('/',auth[_0xf03f('0xb')](),controller[_0xf03f('0xc')]);router[_0xf03f('0xa')]('/describe',auth[_0xf03f('0xb')](),controller[_0xf03f('0xd')]);router[_0xf03f('0xa')](_0xf03f('0xe'),auth[_0xf03f('0xb')](),controller['show']);router['post']('/',auth[_0xf03f('0xb')](),controller[_0xf03f('0xf')]);router[_0xf03f('0x10')](_0xf03f('0xe'),auth[_0xf03f('0xb')](),controller[_0xf03f('0x11')]);router['delete'](_0xf03f('0xe'),auth[_0xf03f('0xb')](),controller[_0xf03f('0x12')]);module[_0xf03f('0x13')]=router; \ No newline at end of file +var _0xbaa5=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update'];(function(_0x1ac41c,_0x1dacbf){var _0x561d64=function(_0x2654df){while(--_0x2654df){_0x1ac41c['push'](_0x1ac41c['shift']());}};_0x561d64(++_0x1dacbf);}(_0xbaa5,0x70));var _0x5baa=function(_0x272206,_0x5ba48a){_0x272206=_0x272206-0x0;var _0x535b6e=_0xbaa5[_0x272206];return _0x535b6e;};'use strict';var multer=require(_0x5baa('0x0'));var util=require(_0x5baa('0x1'));var path=require(_0x5baa('0x2'));var timeout=require(_0x5baa('0x3'));var express=require(_0x5baa('0x4'));var router=express[_0x5baa('0x5')]();var fs_extra=require(_0x5baa('0x6'));var auth=require(_0x5baa('0x7'));var interaction=require(_0x5baa('0x8'));var config=require(_0x5baa('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0x5baa('0xa')]('/',auth[_0x5baa('0xb')](),controller[_0x5baa('0xc')]);router[_0x5baa('0xa')](_0x5baa('0xd'),auth['isAuthenticated'](),controller[_0x5baa('0xe')]);router[_0x5baa('0xa')]('/:id',auth[_0x5baa('0xb')](),controller['show']);router[_0x5baa('0xf')]('/',auth[_0x5baa('0xb')](),controller[_0x5baa('0x10')]);router[_0x5baa('0x11')](_0x5baa('0x12'),auth[_0x5baa('0xb')](),controller[_0x5baa('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5baa('0x14')]);module[_0x5baa('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0f1ea84..b9e9dcc 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(_0x2c049f,_0x4afb47){var _0x3984d8=function(_0x231805){while(--_0x231805){_0x2c049f['push'](_0x2c049f['shift']());}};_0x3984d8(++_0x4afb47);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1bd344,_0x2e7deb){_0x1bd344=_0x1bd344-0x0;var _0x32ab08=_0xf4eb[_0x1bd344];return _0x32ab08;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x25fa1b,_0x43bf9e){var _0x178581=function(_0x1c0644){while(--_0x1c0644){_0x25fa1b['push'](_0x25fa1b['shift']());}};_0x178581(++_0x43bf9e);}(_0xaa88,0x137));var _0x8aa8=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0xaa88[_0x363b81];return _0x1d92fb;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9262476..caa7af8 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 _0x6658=['OpenchannelTransferReport','findAll','catch','keys','find','create','body','update','destroy','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x6658,0x1c1));var _0x8665=function(_0x1a185c,_0x498960){_0x1a185c=_0x1a185c-0x0;var _0x30ac6d=_0x6658[_0x1a185c];return _0x30ac6d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8665('0x0'));var jsonpatch=require(_0x8665('0x1'));var rp=require(_0x8665('0x2'));var moment=require(_0x8665('0x3'));var BPromise=require(_0x8665('0x4'));var Mustache=require(_0x8665('0x5'));var util=require(_0x8665('0x6'));var path=require(_0x8665('0x7'));var sox=require(_0x8665('0x8'));var csv=require(_0x8665('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8665('0xa'));var squel=require('squel');var crypto=require(_0x8665('0xb'));var jsforce=require(_0x8665('0xc'));var deskjs=require(_0x8665('0xd'));var toCsv=require(_0x8665('0x9'));var querystring=require(_0x8665('0xe'));var Papa=require(_0x8665('0xf'));var Redis=require(_0x8665('0x10'));var authService=require(_0x8665('0x11'));var qs=require(_0x8665('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8665('0x13'));var logger=require(_0x8665('0x14'))(_0x8665('0x15'));var utils=require(_0x8665('0x16'));var config=require(_0x8665('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8665('0x18'))['db'];function respondWithStatusCode(_0x3e9e8e,_0x3aeab8){_0x3aeab8=_0x3aeab8||0xcc;return function(_0x1059b8){if(_0x1059b8){return _0x3e9e8e[_0x8665('0x19')](_0x3aeab8);}return _0x3e9e8e[_0x8665('0x1a')](_0x3aeab8)['end']();};}function respondWithResult(_0x169caf,_0x2156ad){_0x2156ad=_0x2156ad||0xc8;return function(_0x25da75){if(_0x25da75){return _0x169caf[_0x8665('0x1a')](_0x2156ad)[_0x8665('0x1b')](_0x25da75);}};}function respondWithFilteredResult(_0x1bd04f,_0x2f3e4f){return function(_0x307c5a){if(_0x307c5a){var _0x22c79a=typeof _0x2f3e4f[_0x8665('0x1c')]==='undefined'&&typeof _0x2f3e4f[_0x8665('0x1d')]===_0x8665('0x1e');var _0x5ffbbb=_0x307c5a[_0x8665('0x1f')];var _0xd55040=_0x22c79a?0x0:_0x2f3e4f[_0x8665('0x1c')];var _0x5013a0=_0x22c79a?_0x307c5a[_0x8665('0x1f')]:_0x2f3e4f['offset']+_0x2f3e4f[_0x8665('0x1d')];var _0x3c6a55;if(_0x5013a0>=_0x5ffbbb){_0x5013a0=_0x5ffbbb;_0x3c6a55=0xc8;}else{_0x3c6a55=0xce;}_0x1bd04f[_0x8665('0x1a')](_0x3c6a55);return _0x1bd04f[_0x8665('0x20')](_0x8665('0x21'),_0xd55040+'-'+_0x5013a0+'/'+_0x5ffbbb)[_0x8665('0x1b')](_0x307c5a);}return null;};}function patchUpdates(_0x42b67a){return function(_0x30e102){try{jsonpatch['apply'](_0x30e102,_0x42b67a,!![]);}catch(_0x3a354a){return BPromise['reject'](_0x3a354a);}return _0x30e102[_0x8665('0x22')]();};}function saveUpdates(_0x17c444,_0x2cae7f){return function(_0x5497d8){if(_0x5497d8){return _0x5497d8['update'](_0x17c444)[_0x8665('0x23')](function(_0x2e24e0){return _0x2e24e0;});}return null;};}function removeEntity(_0x4ef640,_0x1eba53){return function(_0x284215){if(_0x284215){return _0x284215['destroy']()['then'](function(){_0x4ef640[_0x8665('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe92852,_0x3a7509){return function(_0x2892bf){if(!_0x2892bf){_0xe92852[_0x8665('0x19')](0x194);}return _0x2892bf;};}function handleError(_0x5f442e,_0x111758){_0x111758=_0x111758||0x1f4;return function(_0x2429b8){logger['error'](_0x2429b8[_0x8665('0x24')]);if(_0x2429b8[_0x8665('0x25')]){delete _0x2429b8[_0x8665('0x25')];}_0x5f442e[_0x8665('0x1a')](_0x111758)[_0x8665('0x26')](_0x2429b8);};}exports[_0x8665('0x27')]=function(_0x150815,_0x45a7fc){var _0x6f450c={},_0x47dc66={},_0x326a90={'count':0x0,'rows':[]};var _0x40dd95=_[_0x8665('0x28')](db['OpenchannelTransferReport'][_0x8665('0x29')],function(_0x1ed3fd){return{'name':_0x1ed3fd[_0x8665('0x2a')],'type':_0x1ed3fd['type'][_0x8665('0x2b')]};});_0x47dc66[_0x8665('0x2c')]=_[_0x8665('0x28')](_0x40dd95,_0x8665('0x25'));_0x47dc66[_0x8665('0x2d')]=_['keys'](_0x150815[_0x8665('0x2d')]);_0x47dc66['filters']=_[_0x8665('0x2e')](_0x47dc66['model'],_0x47dc66['query']);_0x6f450c['attributes']=_['intersection'](_0x47dc66[_0x8665('0x2c')],qs[_0x8665('0x2f')](_0x150815[_0x8665('0x2d')][_0x8665('0x2f')]));_0x6f450c[_0x8665('0x30')]=_0x6f450c[_0x8665('0x30')][_0x8665('0x31')]?_0x6f450c[_0x8665('0x30')]:_0x47dc66[_0x8665('0x2c')];if(!_0x150815[_0x8665('0x2d')][_0x8665('0x32')](_0x8665('0x33'))){_0x6f450c[_0x8665('0x1d')]=qs[_0x8665('0x1d')](_0x150815[_0x8665('0x2d')][_0x8665('0x1d')]);_0x6f450c[_0x8665('0x1c')]=qs[_0x8665('0x1c')](_0x150815[_0x8665('0x2d')][_0x8665('0x1c')]);}_0x6f450c[_0x8665('0x34')]=qs['sort'](_0x150815[_0x8665('0x2d')]['sort']);_0x6f450c[_0x8665('0x35')]=qs['filters'](_['pick'](_0x150815[_0x8665('0x2d')],_0x47dc66[_0x8665('0x36')]),_0x40dd95);if(_0x150815[_0x8665('0x2d')][_0x8665('0x37')]){_0x6f450c[_0x8665('0x35')]=_[_0x8665('0x38')](_0x6f450c[_0x8665('0x35')],{'$or':_[_0x8665('0x28')](_0x40dd95,function(_0x5cfd2c){if(_0x5cfd2c[_0x8665('0x39')]!==_0x8665('0x3a')){var _0xecd536={};_0xecd536[_0x5cfd2c[_0x8665('0x25')]]={'$like':'%'+_0x150815[_0x8665('0x2d')][_0x8665('0x37')]+'%'};return _0xecd536;}})});}_0x6f450c=_[_0x8665('0x38')]({},_0x6f450c,_0x150815[_0x8665('0x3b')]);var _0x4af215={'where':_0x6f450c[_0x8665('0x35')]};return db['OpenchannelTransferReport'][_0x8665('0x1f')](_0x4af215)[_0x8665('0x23')](function(_0x2543d7){_0x326a90[_0x8665('0x1f')]=_0x2543d7;if(_0x150815[_0x8665('0x2d')][_0x8665('0x3c')]){_0x6f450c[_0x8665('0x3d')]=[{'all':!![]}];}return db[_0x8665('0x3e')][_0x8665('0x3f')](_0x6f450c);})['then'](function(_0x1c00b8){_0x326a90['rows']=_0x1c00b8;return _0x326a90;})[_0x8665('0x23')](respondWithFilteredResult(_0x45a7fc,_0x6f450c))[_0x8665('0x40')](handleError(_0x45a7fc,null));};exports['show']=function(_0x3faf11,_0x34ae78){var _0x2b14b9={'raw':!![],'where':{'id':_0x3faf11['params']['id']}},_0x12a947={};_0x12a947[_0x8665('0x2c')]=_[_0x8665('0x41')](db['OpenchannelTransferReport'][_0x8665('0x29')]);_0x12a947[_0x8665('0x2d')]=_[_0x8665('0x41')](_0x3faf11[_0x8665('0x2d')]);_0x12a947[_0x8665('0x36')]=_[_0x8665('0x2e')](_0x12a947[_0x8665('0x2c')],_0x12a947[_0x8665('0x2d')]);_0x2b14b9[_0x8665('0x30')]=_[_0x8665('0x2e')](_0x12a947[_0x8665('0x2c')],qs[_0x8665('0x2f')](_0x3faf11['query'][_0x8665('0x2f')]));_0x2b14b9[_0x8665('0x30')]=_0x2b14b9[_0x8665('0x30')]['length']?_0x2b14b9[_0x8665('0x30')]:_0x12a947[_0x8665('0x2c')];if(_0x3faf11[_0x8665('0x2d')]['includeAll']){_0x2b14b9['include']=[{'all':!![]}];}_0x2b14b9=_[_0x8665('0x38')]({},_0x2b14b9,_0x3faf11[_0x8665('0x3b')]);return db[_0x8665('0x3e')][_0x8665('0x42')](_0x2b14b9)[_0x8665('0x23')](handleEntityNotFound(_0x34ae78,null))[_0x8665('0x23')](respondWithResult(_0x34ae78,null))[_0x8665('0x40')](handleError(_0x34ae78,null));};exports[_0x8665('0x43')]=function(_0x5c280b,_0xf0c2c7){return db[_0x8665('0x3e')]['create'](_0x5c280b[_0x8665('0x44')],{})['then'](respondWithResult(_0xf0c2c7,0xc9))['catch'](handleError(_0xf0c2c7,null));};exports[_0x8665('0x45')]=function(_0x39b12e,_0x1918d6){if(_0x39b12e['body']['id']){delete _0x39b12e[_0x8665('0x44')]['id'];}return db[_0x8665('0x3e')]['find']({'where':{'id':_0x39b12e['params']['id']}})[_0x8665('0x23')](handleEntityNotFound(_0x1918d6,null))[_0x8665('0x23')](saveUpdates(_0x39b12e[_0x8665('0x44')],null))['then'](respondWithResult(_0x1918d6,null))[_0x8665('0x40')](handleError(_0x1918d6,null));};exports[_0x8665('0x46')]=function(_0x2fffe5,_0xf7d19b){return db[_0x8665('0x3e')][_0x8665('0x42')]({'where':{'id':_0x2fffe5[_0x8665('0x47')]['id']}})[_0x8665('0x23')](handleEntityNotFound(_0xf7d19b,null))[_0x8665('0x23')](removeEntity(_0xf7d19b,null))['catch'](handleError(_0xf7d19b,null));};exports[_0x8665('0x48')]=function(_0x36b206,_0x4bd00f){return db['OpenchannelTransferReport'][_0x8665('0x48')]()[_0x8665('0x23')](respondWithResult(_0x4bd00f,null))[_0x8665('0x40')](handleError(_0x4bd00f,null));}; \ No newline at end of file +var _0x8f1d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','error','stack','name','status','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','length','find','create','body','catch','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x519857,_0x4524ed){var _0x3a40a4=function(_0x1ebbd7){while(--_0x1ebbd7){_0x519857['push'](_0x519857['shift']());}};_0x3a40a4(++_0x4524ed);}(_0x8f1d,0x122));var _0xd8f1=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x8f1d[_0x4c7935];return _0x30651d;};'use strict';var emlformat=require(_0xd8f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8f1('0x1'));var jsonpatch=require(_0xd8f1('0x2'));var rp=require(_0xd8f1('0x3'));var moment=require(_0xd8f1('0x4'));var BPromise=require(_0xd8f1('0x5'));var Mustache=require(_0xd8f1('0x6'));var util=require('util');var path=require(_0xd8f1('0x7'));var sox=require(_0xd8f1('0x8'));var csv=require(_0xd8f1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8f1('0xa'));var _=require(_0xd8f1('0xb'));var squel=require(_0xd8f1('0xc'));var crypto=require(_0xd8f1('0xd'));var jsforce=require(_0xd8f1('0xe'));var deskjs=require(_0xd8f1('0xf'));var toCsv=require(_0xd8f1('0x9'));var querystring=require(_0xd8f1('0x10'));var Papa=require('papaparse');var Redis=require(_0xd8f1('0x11'));var authService=require(_0xd8f1('0x12'));var qs=require(_0xd8f1('0x13'));var as=require(_0xd8f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8f1('0x15'))(_0xd8f1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f0fbd,_0x1a043f){_0x1a043f=_0x1a043f||0xcc;return function(_0x4a086d){if(_0x4a086d){return _0x3f0fbd[_0xd8f1('0x17')](_0x1a043f);}return _0x3f0fbd['status'](_0x1a043f)[_0xd8f1('0x18')]();};}function respondWithResult(_0x11f73c,_0x345bfb){_0x345bfb=_0x345bfb||0xc8;return function(_0x5e7090){if(_0x5e7090){return _0x11f73c['status'](_0x345bfb)['json'](_0x5e7090);}};}function respondWithFilteredResult(_0x562780,_0x49b57a){return function(_0x98e2d){if(_0x98e2d){var _0x5ebb2c=typeof _0x49b57a['offset']===_0xd8f1('0x19')&&typeof _0x49b57a[_0xd8f1('0x1a')]==='undefined';var _0x501b5c=_0x98e2d[_0xd8f1('0x1b')];var _0xbd45cb=_0x5ebb2c?0x0:_0x49b57a['offset'];var _0x5e9fa3=_0x5ebb2c?_0x98e2d[_0xd8f1('0x1b')]:_0x49b57a[_0xd8f1('0x1c')]+_0x49b57a[_0xd8f1('0x1a')];var _0x159731;if(_0x5e9fa3>=_0x501b5c){_0x5e9fa3=_0x501b5c;_0x159731=0xc8;}else{_0x159731=0xce;}_0x562780['status'](_0x159731);return _0x562780[_0xd8f1('0x1d')](_0xd8f1('0x1e'),_0xbd45cb+'-'+_0x5e9fa3+'/'+_0x501b5c)[_0xd8f1('0x1f')](_0x98e2d);}return null;};}function patchUpdates(_0x3c1c70){return function(_0x466b22){try{jsonpatch['apply'](_0x466b22,_0x3c1c70,!![]);}catch(_0x5786dd){return BPromise[_0xd8f1('0x20')](_0x5786dd);}return _0x466b22[_0xd8f1('0x21')]();};}function saveUpdates(_0x5a892e,_0x26f5e0){return function(_0x47f700){if(_0x47f700){return _0x47f700[_0xd8f1('0x22')](_0x5a892e)['then'](function(_0x1319bd){return _0x1319bd;});}return null;};}function removeEntity(_0xf1b45a,_0x2943a5){return function(_0x2f51db){if(_0x2f51db){return _0x2f51db['destroy']()[_0xd8f1('0x23')](function(){_0xf1b45a['status'](0xcc)[_0xd8f1('0x18')]();});}};}function handleEntityNotFound(_0x1996cf,_0x1b84ea){return function(_0x8b8fac){if(!_0x8b8fac){_0x1996cf[_0xd8f1('0x17')](0x194);}return _0x8b8fac;};}function handleError(_0x482191,_0x4aeb23){_0x4aeb23=_0x4aeb23||0x1f4;return function(_0x40d9bd){logger[_0xd8f1('0x24')](_0x40d9bd[_0xd8f1('0x25')]);if(_0x40d9bd[_0xd8f1('0x26')]){delete _0x40d9bd['name'];}_0x482191[_0xd8f1('0x27')](_0x4aeb23)['send'](_0x40d9bd);};}exports[_0xd8f1('0x28')]=function(_0x41d6c2,_0xf8c352){var _0x29cc7c={},_0x2d1a10={},_0x164f2b={'count':0x0,'rows':[]};var _0x1487c4=_[_0xd8f1('0x29')](db[_0xd8f1('0x2a')][_0xd8f1('0x2b')],function(_0x5cb4da){return{'name':_0x5cb4da[_0xd8f1('0x2c')],'type':_0x5cb4da[_0xd8f1('0x2d')][_0xd8f1('0x2e')]};});_0x2d1a10[_0xd8f1('0x2f')]=_[_0xd8f1('0x29')](_0x1487c4,_0xd8f1('0x26'));_0x2d1a10[_0xd8f1('0x30')]=_['keys'](_0x41d6c2[_0xd8f1('0x30')]);_0x2d1a10[_0xd8f1('0x31')]=_[_0xd8f1('0x32')](_0x2d1a10[_0xd8f1('0x2f')],_0x2d1a10[_0xd8f1('0x30')]);_0x29cc7c[_0xd8f1('0x33')]=_[_0xd8f1('0x32')](_0x2d1a10[_0xd8f1('0x2f')],qs[_0xd8f1('0x34')](_0x41d6c2[_0xd8f1('0x30')][_0xd8f1('0x34')]));_0x29cc7c[_0xd8f1('0x33')]=_0x29cc7c[_0xd8f1('0x33')]['length']?_0x29cc7c[_0xd8f1('0x33')]:_0x2d1a10['model'];if(!_0x41d6c2[_0xd8f1('0x30')][_0xd8f1('0x35')](_0xd8f1('0x36'))){_0x29cc7c[_0xd8f1('0x1a')]=qs[_0xd8f1('0x1a')](_0x41d6c2[_0xd8f1('0x30')][_0xd8f1('0x1a')]);_0x29cc7c[_0xd8f1('0x1c')]=qs[_0xd8f1('0x1c')](_0x41d6c2[_0xd8f1('0x30')][_0xd8f1('0x1c')]);}_0x29cc7c[_0xd8f1('0x37')]=qs[_0xd8f1('0x38')](_0x41d6c2[_0xd8f1('0x30')][_0xd8f1('0x38')]);_0x29cc7c[_0xd8f1('0x39')]=qs[_0xd8f1('0x31')](_[_0xd8f1('0x3a')](_0x41d6c2['query'],_0x2d1a10[_0xd8f1('0x31')]),_0x1487c4);if(_0x41d6c2['query']['filter']){_0x29cc7c[_0xd8f1('0x39')]=_[_0xd8f1('0x3b')](_0x29cc7c[_0xd8f1('0x39')],{'$or':_['map'](_0x1487c4,function(_0x571653){if(_0x571653['type']!==_0xd8f1('0x3c')){var _0x5758de={};_0x5758de[_0x571653['name']]={'$like':'%'+_0x41d6c2[_0xd8f1('0x30')][_0xd8f1('0x3d')]+'%'};return _0x5758de;}})});}_0x29cc7c=_[_0xd8f1('0x3b')]({},_0x29cc7c,_0x41d6c2[_0xd8f1('0x3e')]);var _0x685080={'where':_0x29cc7c['where']};return db[_0xd8f1('0x2a')]['count'](_0x685080)['then'](function(_0x32dc57){_0x164f2b[_0xd8f1('0x1b')]=_0x32dc57;if(_0x41d6c2['query'][_0xd8f1('0x3f')]){_0x29cc7c[_0xd8f1('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xd8f1('0x41')](_0x29cc7c);})[_0xd8f1('0x23')](function(_0x130ac6){_0x164f2b[_0xd8f1('0x42')]=_0x130ac6;return _0x164f2b;})[_0xd8f1('0x23')](respondWithFilteredResult(_0xf8c352,_0x29cc7c))['catch'](handleError(_0xf8c352,null));};exports[_0xd8f1('0x43')]=function(_0x56c611,_0x50dcaa){var _0x28a3ba={'raw':!![],'where':{'id':_0x56c611['params']['id']}},_0x57e3e8={};_0x57e3e8[_0xd8f1('0x2f')]=_[_0xd8f1('0x44')](db[_0xd8f1('0x2a')][_0xd8f1('0x2b')]);_0x57e3e8[_0xd8f1('0x30')]=_[_0xd8f1('0x44')](_0x56c611['query']);_0x57e3e8[_0xd8f1('0x31')]=_[_0xd8f1('0x32')](_0x57e3e8[_0xd8f1('0x2f')],_0x57e3e8['query']);_0x28a3ba[_0xd8f1('0x33')]=_[_0xd8f1('0x32')](_0x57e3e8[_0xd8f1('0x2f')],qs[_0xd8f1('0x34')](_0x56c611[_0xd8f1('0x30')]['fields']));_0x28a3ba[_0xd8f1('0x33')]=_0x28a3ba[_0xd8f1('0x33')][_0xd8f1('0x45')]?_0x28a3ba[_0xd8f1('0x33')]:_0x57e3e8[_0xd8f1('0x2f')];if(_0x56c611[_0xd8f1('0x30')][_0xd8f1('0x3f')]){_0x28a3ba[_0xd8f1('0x40')]=[{'all':!![]}];}_0x28a3ba=_['merge']({},_0x28a3ba,_0x56c611[_0xd8f1('0x3e')]);return db[_0xd8f1('0x2a')][_0xd8f1('0x46')](_0x28a3ba)[_0xd8f1('0x23')](handleEntityNotFound(_0x50dcaa,null))['then'](respondWithResult(_0x50dcaa,null))['catch'](handleError(_0x50dcaa,null));};exports[_0xd8f1('0x47')]=function(_0x13e3ed,_0x14b369){return db[_0xd8f1('0x2a')][_0xd8f1('0x47')](_0x13e3ed[_0xd8f1('0x48')],{})[_0xd8f1('0x23')](respondWithResult(_0x14b369,0xc9))[_0xd8f1('0x49')](handleError(_0x14b369,null));};exports[_0xd8f1('0x22')]=function(_0x21493f,_0x140a98){if(_0x21493f[_0xd8f1('0x48')]['id']){delete _0x21493f['body']['id'];}return db[_0xd8f1('0x2a')][_0xd8f1('0x46')]({'where':{'id':_0x21493f['params']['id']}})[_0xd8f1('0x23')](handleEntityNotFound(_0x140a98,null))[_0xd8f1('0x23')](saveUpdates(_0x21493f[_0xd8f1('0x48')],null))['then'](respondWithResult(_0x140a98,null))[_0xd8f1('0x49')](handleError(_0x140a98,null));};exports[_0xd8f1('0x4a')]=function(_0x3a7423,_0x31c70d){return db[_0xd8f1('0x2a')][_0xd8f1('0x46')]({'where':{'id':_0x3a7423[_0xd8f1('0x4b')]['id']}})[_0xd8f1('0x23')](handleEntityNotFound(_0x31c70d,null))[_0xd8f1('0x23')](removeEntity(_0x31c70d,null))[_0xd8f1('0x49')](handleError(_0x31c70d,null));};exports[_0xd8f1('0x4c')]=function(_0x550adb,_0xee9fb7){return db[_0xd8f1('0x2a')][_0xd8f1('0x4c')]()[_0xd8f1('0x23')](respondWithResult(_0xee9fb7,null))[_0xd8f1('0x49')](handleError(_0xee9fb7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b98d9b8..9d1a402 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 _0x821e=['../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x466f60,_0x3e306a){var _0x15fe8b=function(_0x5a665e){while(--_0x5a665e){_0x466f60['push'](_0x466f60['shift']());}};_0x15fe8b(++_0x3e306a);}(_0x821e,0x1f4));var _0xe821=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x821e[_0x3c81b5];return _0x5888c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe821('0x0'))(_0xe821('0x1'));var moment=require(_0xe821('0x2'));var BPromise=require(_0xe821('0x3'));var rp=require(_0xe821('0x4'));var fs=require('fs');var path=require(_0xe821('0x5'));var rimraf=require(_0xe821('0x6'));var config=require(_0xe821('0x7'));var attributes=require(_0xe821('0x8'));module['exports']=function(_0x15be81,_0x1e99e4){return _0x15be81[_0xe821('0x9')](_0xe821('0xa'),attributes,{'tableName':_0xe821('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe821('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x355e=['../../config/logger','api','moment','bluebird','path','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x355e,0xce));var _0xe355=function(_0x52bf06,_0x5dd574){_0x52bf06=_0x52bf06-0x0;var _0x504765=_0x355e[_0x52bf06];return _0x504765;};'use strict';var _=require(_0xe355('0x0'));var util=require(_0xe355('0x1'));var logger=require(_0xe355('0x2'))(_0xe355('0x3'));var moment=require(_0xe355('0x4'));var BPromise=require(_0xe355('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe355('0x6'));var rimraf=require(_0xe355('0x7'));var config=require('../../config/environment');var attributes=require(_0xe355('0x8'));module['exports']=function(_0x2149fa,_0x230e7c){return _0x2149fa[_0xe355('0x9')](_0xe355('0xa'),attributes,{'tableName':_0xe355('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe355('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1894a6f..6651db1 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 _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb11722,_0x122200){var _0x13f584=function(_0x44aa3e){while(--_0x44aa3e){_0xb11722['push'](_0xb11722['shift']());}};_0x13f584(++_0x122200);}(_0xdd0c,0x165));var _0xcdd0=function(_0x1e258f,_0x3b3465){_0x1e258f=_0x1e258f-0x0;var _0x4e8f5b=_0xdd0c[_0x1e258f];return _0x4e8f5b;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file +var _0x4148=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4148,0xc6));var _0x8414=function(_0x1aa0e7,_0x498fbd){_0x1aa0e7=_0x1aa0e7-0x0;var _0x55f771=_0x4148[_0x1aa0e7];return _0x55f771;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rs=require(_0x8414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8414('0x5'))['db'];var utils=require(_0x8414('0x6'));var logger=require(_0x8414('0x7'))(_0x8414('0x8'));var config=require('../../config/environment');var jayson=require(_0x8414('0x9'));var client=jayson['client'][_0x8414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507e0b,_0x51ab01,_0x131b88){return new BPromise(function(_0x2444b7,_0x1623c3){return client[_0x8414('0xb')](_0x507e0b,_0x131b88)[_0x8414('0xc')](function(_0xd625a7){logger[_0x8414('0xd')](_0x8414('0xe'),_0x51ab01,_0x8414('0xf'));logger[_0x8414('0x10')](_0x8414('0x11'),_0x51ab01,'request\x20sent',JSON[_0x8414('0x12')](_0xd625a7));if(_0xd625a7['error']){if(_0xd625a7[_0x8414('0x13')][_0x8414('0x14')]===0x1f4){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x1623c3(_0xd625a7['error'][_0x8414('0x15')]);}logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x2444b7(_0xd625a7[_0x8414('0x13')][_0x8414('0x15')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x51ab01,_0x8414('0xf'));_0x2444b7(_0xd625a7[_0x8414('0x16')][_0x8414('0x15')]);}})[_0x8414('0x17')](function(_0x5b92aa){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0x5b92aa);_0x1623c3(_0x5b92aa);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 31f166a..7016ef3 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 _0x3b34=['/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./pause.controller','get','index','isAuthenticated','show','post','create','put','update'];(function(_0x233662,_0x3b468f){var _0x32cf8d=function(_0x5c0e49){while(--_0x5c0e49){_0x233662['push'](_0x233662['shift']());}};_0x32cf8d(++_0x3b468f);}(_0x3b34,0xa4));var _0x43b3=function(_0x237398,_0xc0ef22){_0x237398=_0x237398-0x0;var _0x5598de=_0x3b34[_0x237398];return _0x5598de;};'use strict';var multer=require(_0x43b3('0x0'));var util=require('util');var path=require(_0x43b3('0x1'));var timeout=require(_0x43b3('0x2'));var express=require(_0x43b3('0x3'));var router=express[_0x43b3('0x4')]();var fs_extra=require(_0x43b3('0x5'));var auth=require(_0x43b3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x43b3('0x7'));router[_0x43b3('0x8')]('/',auth['isAuthenticated'](),controller[_0x43b3('0x9')]);router['get']('/:id',auth[_0x43b3('0xa')](),controller[_0x43b3('0xb')]);router[_0x43b3('0xc')]('/',auth['isAuthenticated'](),controller[_0x43b3('0xd')]);router[_0x43b3('0xe')]('/:id',auth[_0x43b3('0xa')](),controller[_0x43b3('0xf')]);router['delete'](_0x43b3('0x10'),auth[_0x43b3('0xa')](),controller[_0x43b3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x904d=['fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x4b96bb,_0x5d7378){var _0x4f3db6=function(_0x2de27c){while(--_0x2de27c){_0x4b96bb['push'](_0x4b96bb['shift']());}};_0x4f3db6(++_0x5d7378);}(_0x904d,0x93));var _0xd904=function(_0x3f52ee,_0x468aab){_0x3f52ee=_0x3f52ee-0x0;var _0x4f7924=_0x904d[_0x3f52ee];return _0x4f7924;};'use strict';var multer=require(_0xd904('0x0'));var util=require(_0xd904('0x1'));var path=require(_0xd904('0x2'));var timeout=require('connect-timeout');var express=require(_0xd904('0x3'));var router=express[_0xd904('0x4')]();var fs_extra=require(_0xd904('0x5'));var auth=require(_0xd904('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd904('0x7'));var controller=require(_0xd904('0x8'));router[_0xd904('0x9')]('/',auth[_0xd904('0xa')](),controller[_0xd904('0xb')]);router[_0xd904('0x9')](_0xd904('0xc'),auth['isAuthenticated'](),controller[_0xd904('0xd')]);router[_0xd904('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd904('0xf')]('/:id',auth[_0xd904('0xa')](),controller[_0xd904('0x10')]);router[_0xd904('0x11')](_0xd904('0xc'),auth[_0xd904('0xa')](),controller[_0xd904('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9aecb20..1528337 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 _0x4505=['STRING','sequelize','exports','name'];(function(_0x3283bc,_0x3d8a52){var _0x347e02=function(_0x166539){while(--_0x166539){_0x3283bc['push'](_0x3283bc['shift']());}};_0x347e02(++_0x3d8a52);}(_0x4505,0xcd));var _0x5450=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x4505[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require(_0x5450('0x0'));module[_0x5450('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5450('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5450('0x3')]}}; \ No newline at end of file +var _0x6fed=['STRING','name','sequelize'];(function(_0x1737a0,_0x5b96dc){var _0x625299=function(_0xff1e76){while(--_0xff1e76){_0x1737a0['push'](_0x1737a0['shift']());}};_0x625299(++_0x5b96dc);}(_0x6fed,0x110));var _0xd6fe=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6fed[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xd6fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xd6fe('0x1')],'unique':_0xd6fe('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd6fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 82c1af5..7f44641 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 _0x6f0d=['findAll','catch','keys','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','set','json','apply','reject','save','then','get','Pauses','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','options','count','includeAll','include','Pause'];(function(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0x6f0d,0x192));var _0xd6f0=function(_0x4bef8c,_0x57ab3b){_0x4bef8c=_0x4bef8c-0x0;var _0x51e1df=_0x6f0d[_0x4bef8c];return _0x51e1df;};'use strict';var emlformat=require(_0xd6f0('0x0'));var rimraf=require(_0xd6f0('0x1'));var zipdir=require(_0xd6f0('0x2'));var jsonpatch=require(_0xd6f0('0x3'));var rp=require(_0xd6f0('0x4'));var moment=require(_0xd6f0('0x5'));var BPromise=require(_0xd6f0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require(_0xd6f0('0x9'));var ejs=require(_0xd6f0('0xa'));var fs=require('fs');var fs_extra=require(_0xd6f0('0xb'));var _=require(_0xd6f0('0xc'));var squel=require(_0xd6f0('0xd'));var crypto=require(_0xd6f0('0xe'));var jsforce=require(_0xd6f0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd6f0('0x9'));var querystring=require(_0xd6f0('0x10'));var Papa=require(_0xd6f0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require(_0xd6f0('0x17'));var licenseUtil=require(_0xd6f0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457ea7,_0x521128){_0x521128=_0x521128||0xcc;return function(_0x134d00){if(_0x134d00){return _0x457ea7[_0xd6f0('0x19')](_0x521128);}return _0x457ea7[_0xd6f0('0x1a')](_0x521128)[_0xd6f0('0x1b')]();};}function respondWithResult(_0xc409ea,_0x37aef5){_0x37aef5=_0x37aef5||0xc8;return function(_0xb9ba35){if(_0xb9ba35){return _0xc409ea[_0xd6f0('0x1a')](_0x37aef5)['json'](_0xb9ba35);}};}function respondWithFilteredResult(_0x2167e3,_0x312d91){return function(_0x46d0cd){if(_0x46d0cd){var _0x38a1e1=typeof _0x312d91[_0xd6f0('0x1c')]===_0xd6f0('0x1d')&&typeof _0x312d91['limit']==='undefined';var _0x57fc04=_0x46d0cd['count'];var _0x41f87b=_0x38a1e1?0x0:_0x312d91['offset'];var _0xed9ad6=_0x38a1e1?_0x46d0cd['count']:_0x312d91[_0xd6f0('0x1c')]+_0x312d91['limit'];var _0x2d7dab;if(_0xed9ad6>=_0x57fc04){_0xed9ad6=_0x57fc04;_0x2d7dab=0xc8;}else{_0x2d7dab=0xce;}_0x2167e3[_0xd6f0('0x1a')](_0x2d7dab);return _0x2167e3[_0xd6f0('0x1e')]('Content-Range',_0x41f87b+'-'+_0xed9ad6+'/'+_0x57fc04)[_0xd6f0('0x1f')](_0x46d0cd);}return null;};}function patchUpdates(_0x469994){return function(_0x1a079e){try{jsonpatch[_0xd6f0('0x20')](_0x1a079e,_0x469994,!![]);}catch(_0x47c4e6){return BPromise[_0xd6f0('0x21')](_0x47c4e6);}return _0x1a079e[_0xd6f0('0x22')]();};}function saveUpdates(_0x129c2e,_0x4924b9){return function(_0x13974d){if(_0x13974d){return _0x13974d['update'](_0x129c2e)[_0xd6f0('0x23')](function(_0x2d3611){return _0x2d3611;});}return null;};}function removeEntity(_0x4d0f05,_0x5cac9c){return function(_0x2b3ee4){if(_0x2b3ee4){return _0x2b3ee4['destroy']()[_0xd6f0('0x23')](function(){var _0x176b55=_0x2b3ee4[_0xd6f0('0x24')]({'plain':!![]});var _0x4e4be8=_0xd6f0('0x25');return db[_0xd6f0('0x26')]['destroy']({'where':{'type':_0x4e4be8,'resourceId':_0x176b55['id']}})['then'](function(){return _0x2b3ee4;});})['then'](function(){_0x4d0f05[_0xd6f0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504384,_0x32c2f){return function(_0x4a7d1b){if(!_0x4a7d1b){_0x504384['sendStatus'](0x194);}return _0x4a7d1b;};}function handleError(_0x4015a5,_0x3ca61b){_0x3ca61b=_0x3ca61b||0x1f4;return function(_0x596629){logger[_0xd6f0('0x27')](_0x596629[_0xd6f0('0x28')]);if(_0x596629[_0xd6f0('0x29')]){delete _0x596629['name'];}_0x4015a5[_0xd6f0('0x1a')](_0x3ca61b)['send'](_0x596629);};}exports[_0xd6f0('0x2a')]=function(_0x595c48,_0x577d2e){var _0x49869a={},_0x5aa038={},_0x27ec96={'count':0x0,'rows':[]};var _0x4f9b30=_['map'](db['Pause'][_0xd6f0('0x2b')],function(_0x1cd232){return{'name':_0x1cd232[_0xd6f0('0x2c')],'type':_0x1cd232[_0xd6f0('0x2d')]['key']};});_0x5aa038['model']=_[_0xd6f0('0x2e')](_0x4f9b30,_0xd6f0('0x29'));_0x5aa038[_0xd6f0('0x2f')]=_['keys'](_0x595c48[_0xd6f0('0x2f')]);_0x5aa038[_0xd6f0('0x30')]=_[_0xd6f0('0x31')](_0x5aa038[_0xd6f0('0x32')],_0x5aa038['query']);_0x49869a[_0xd6f0('0x33')]=_[_0xd6f0('0x31')](_0x5aa038[_0xd6f0('0x32')],qs[_0xd6f0('0x34')](_0x595c48[_0xd6f0('0x2f')][_0xd6f0('0x34')]));_0x49869a[_0xd6f0('0x33')]=_0x49869a[_0xd6f0('0x33')][_0xd6f0('0x35')]?_0x49869a[_0xd6f0('0x33')]:_0x5aa038[_0xd6f0('0x32')];if(!_0x595c48[_0xd6f0('0x2f')]['hasOwnProperty'](_0xd6f0('0x36'))){_0x49869a[_0xd6f0('0x37')]=qs['limit'](_0x595c48[_0xd6f0('0x2f')][_0xd6f0('0x37')]);_0x49869a[_0xd6f0('0x1c')]=qs['offset'](_0x595c48['query'][_0xd6f0('0x1c')]);}_0x49869a[_0xd6f0('0x38')]=qs[_0xd6f0('0x39')](_0x595c48['query'][_0xd6f0('0x39')]);_0x49869a[_0xd6f0('0x3a')]=qs[_0xd6f0('0x30')](_['pick'](_0x595c48[_0xd6f0('0x2f')],_0x5aa038['filters']),_0x4f9b30);if(_0x595c48['query'][_0xd6f0('0x3b')]){_0x49869a[_0xd6f0('0x3a')]=_[_0xd6f0('0x3c')](_0x49869a['where'],{'$or':_[_0xd6f0('0x2e')](_0x4f9b30,function(_0x324e4b){if(_0x324e4b[_0xd6f0('0x2d')]!=='VIRTUAL'){var _0x29e5ac={};_0x29e5ac[_0x324e4b[_0xd6f0('0x29')]]={'$like':'%'+_0x595c48['query'][_0xd6f0('0x3b')]+'%'};return _0x29e5ac;}})});}_0x49869a=_['merge']({},_0x49869a,_0x595c48[_0xd6f0('0x3d')]);var _0x24ef9a={'where':_0x49869a[_0xd6f0('0x3a')]};return db['Pause'][_0xd6f0('0x3e')](_0x24ef9a)[_0xd6f0('0x23')](function(_0x20e447){_0x27ec96[_0xd6f0('0x3e')]=_0x20e447;if(_0x595c48[_0xd6f0('0x2f')][_0xd6f0('0x3f')]){_0x49869a[_0xd6f0('0x40')]=[{'all':!![]}];}return db[_0xd6f0('0x41')][_0xd6f0('0x42')](_0x49869a);})[_0xd6f0('0x23')](function(_0xa3560a){_0x27ec96['rows']=_0xa3560a;return _0x27ec96;})[_0xd6f0('0x23')](respondWithFilteredResult(_0x577d2e,_0x49869a))[_0xd6f0('0x43')](handleError(_0x577d2e,null));};exports['show']=function(_0x55ecf7,_0x417741){var _0x2e2a35={'raw':!![],'where':{'id':_0x55ecf7['params']['id']}},_0x2749d7={};_0x2749d7['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x41')][_0xd6f0('0x2b')]);_0x2749d7[_0xd6f0('0x2f')]=_[_0xd6f0('0x44')](_0x55ecf7[_0xd6f0('0x2f')]);_0x2749d7[_0xd6f0('0x30')]=_[_0xd6f0('0x31')](_0x2749d7[_0xd6f0('0x32')],_0x2749d7[_0xd6f0('0x2f')]);_0x2e2a35['attributes']=_[_0xd6f0('0x31')](_0x2749d7[_0xd6f0('0x32')],qs[_0xd6f0('0x34')](_0x55ecf7[_0xd6f0('0x2f')]['fields']));_0x2e2a35['attributes']=_0x2e2a35[_0xd6f0('0x33')][_0xd6f0('0x35')]?_0x2e2a35[_0xd6f0('0x33')]:_0x2749d7[_0xd6f0('0x32')];if(_0x55ecf7[_0xd6f0('0x2f')][_0xd6f0('0x3f')]){_0x2e2a35['include']=[{'all':!![]}];}_0x2e2a35=_['merge']({},_0x2e2a35,_0x55ecf7[_0xd6f0('0x3d')]);return db['Pause'][_0xd6f0('0x45')](_0x2e2a35)[_0xd6f0('0x23')](handleEntityNotFound(_0x417741,null))[_0xd6f0('0x23')](respondWithResult(_0x417741,null))[_0xd6f0('0x43')](handleError(_0x417741,null));};exports['create']=function(_0x4de620,_0x4bd38f){return db[_0xd6f0('0x41')]['create'](_0x4de620[_0xd6f0('0x46')],{})[_0xd6f0('0x23')](function(_0x209493){var _0x45e32d=_0x4de620['user'][_0xd6f0('0x24')]({'plain':!![]});if(!_0x45e32d)throw new Error(_0xd6f0('0x47'));if(_0x45e32d[_0xd6f0('0x48')]==='user'){var _0x45b45d=_0x209493[_0xd6f0('0x24')]({'plain':!![]});var _0x546af3=_0xd6f0('0x25');return db['UserProfileSection'][_0xd6f0('0x45')]({'where':{'name':_0x546af3,'userProfileId':_0x45e32d[_0xd6f0('0x49')]},'raw':!![]})[_0xd6f0('0x23')](function(_0x161ec3){if(_0x161ec3&&_0x161ec3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x45b45d[_0xd6f0('0x29')],'resourceId':_0x45b45d['id'],'type':_0x161ec3['name'],'sectionId':_0x161ec3['id']},{})[_0xd6f0('0x23')](function(){return _0x209493;});}else{return _0x209493;}})[_0xd6f0('0x43')](function(_0x570175){logger[_0xd6f0('0x27')](_0xd6f0('0x4a'),_0x570175);throw _0x570175;});}return _0x209493;})[_0xd6f0('0x23')](respondWithResult(_0x4bd38f,0xc9))[_0xd6f0('0x43')](handleError(_0x4bd38f,null));};exports[_0xd6f0('0x4b')]=function(_0x4b18b9,_0x270248){if(_0x4b18b9[_0xd6f0('0x46')]['id']){delete _0x4b18b9[_0xd6f0('0x46')]['id'];}return db['Pause'][_0xd6f0('0x45')]({'where':{'id':_0x4b18b9[_0xd6f0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x270248,null))[_0xd6f0('0x23')](saveUpdates(_0x4b18b9['body'],null))[_0xd6f0('0x23')](respondWithResult(_0x270248,null))[_0xd6f0('0x43')](handleError(_0x270248,null));};exports[_0xd6f0('0x4d')]=function(_0x22f81a,_0x4f937e){return db[_0xd6f0('0x41')][_0xd6f0('0x45')]({'where':{'id':_0x22f81a[_0xd6f0('0x4c')]['id']}})[_0xd6f0('0x23')](handleEntityNotFound(_0x4f937e,null))['then'](removeEntity(_0x4f937e,null))[_0xd6f0('0x43')](handleError(_0x4f937e,null));}; \ No newline at end of file +var _0x796d=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','index','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','Pause','include','findAll','catch','show','params','rawAttributes','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x3af6d3,_0xd6ff2e){var _0xf0c5a8=function(_0x392c56){while(--_0x392c56){_0x3af6d3['push'](_0x3af6d3['shift']());}};_0xf0c5a8(++_0xd6ff2e);}(_0x796d,0xaa));var _0xd796=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x796d[_0xfb0281];return _0x408dd3;};'use strict';var emlformat=require(_0xd796('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd796('0x1'));var jsonpatch=require(_0xd796('0x2'));var rp=require(_0xd796('0x3'));var moment=require(_0xd796('0x4'));var BPromise=require(_0xd796('0x5'));var Mustache=require(_0xd796('0x6'));var util=require(_0xd796('0x7'));var path=require('path');var sox=require(_0xd796('0x8'));var csv=require('to-csv');var ejs=require(_0xd796('0x9'));var fs=require('fs');var fs_extra=require(_0xd796('0xa'));var _=require('lodash');var squel=require(_0xd796('0xb'));var crypto=require(_0xd796('0xc'));var jsforce=require(_0xd796('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd796('0xe'));var Redis=require('ioredis');var authService=require(_0xd796('0xf'));var qs=require(_0xd796('0x10'));var as=require(_0xd796('0x11'));var hardwareService=require(_0xd796('0x12'));var logger=require(_0xd796('0x13'))(_0xd796('0x14'));var utils=require(_0xd796('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32653b,_0x3b5ba9){_0x3b5ba9=_0x3b5ba9||0xcc;return function(_0x3f5f08){if(_0x3f5f08){return _0x32653b['sendStatus'](_0x3b5ba9);}return _0x32653b['status'](_0x3b5ba9)[_0xd796('0x16')]();};}function respondWithResult(_0x72b41,_0x4e70d1){_0x4e70d1=_0x4e70d1||0xc8;return function(_0x42a82a){if(_0x42a82a){return _0x72b41[_0xd796('0x17')](_0x4e70d1)[_0xd796('0x18')](_0x42a82a);}};}function respondWithFilteredResult(_0x45a2a1,_0x106c5f){return function(_0x5b6ab8){if(_0x5b6ab8){var _0x11cd6f=typeof _0x106c5f[_0xd796('0x19')]===_0xd796('0x1a')&&typeof _0x106c5f['limit']===_0xd796('0x1a');var _0x31d51f=_0x5b6ab8[_0xd796('0x1b')];var _0x3e78fd=_0x11cd6f?0x0:_0x106c5f[_0xd796('0x19')];var _0x47adde=_0x11cd6f?_0x5b6ab8[_0xd796('0x1b')]:_0x106c5f['offset']+_0x106c5f['limit'];var _0x49e7be;if(_0x47adde>=_0x31d51f){_0x47adde=_0x31d51f;_0x49e7be=0xc8;}else{_0x49e7be=0xce;}_0x45a2a1[_0xd796('0x17')](_0x49e7be);return _0x45a2a1[_0xd796('0x1c')](_0xd796('0x1d'),_0x3e78fd+'-'+_0x47adde+'/'+_0x31d51f)[_0xd796('0x18')](_0x5b6ab8);}return null;};}function patchUpdates(_0x55d2b3){return function(_0x17050b){try{jsonpatch[_0xd796('0x1e')](_0x17050b,_0x55d2b3,!![]);}catch(_0x48a383){return BPromise['reject'](_0x48a383);}return _0x17050b[_0xd796('0x1f')]();};}function saveUpdates(_0x2b7d4,_0x58d7d5){return function(_0x5d7fcf){if(_0x5d7fcf){return _0x5d7fcf[_0xd796('0x20')](_0x2b7d4)[_0xd796('0x21')](function(_0x2957fa){return _0x2957fa;});}return null;};}function removeEntity(_0x5dfa05,_0x296352){return function(_0x3cf529){if(_0x3cf529){return _0x3cf529[_0xd796('0x22')]()[_0xd796('0x21')](function(){var _0x44ab24=_0x3cf529[_0xd796('0x23')]({'plain':!![]});var _0x255192=_0xd796('0x24');return db[_0xd796('0x25')][_0xd796('0x22')]({'where':{'type':_0x255192,'resourceId':_0x44ab24['id']}})[_0xd796('0x21')](function(){return _0x3cf529;});})[_0xd796('0x21')](function(){_0x5dfa05['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ebe01,_0x10947c){return function(_0x166786){if(!_0x166786){_0x2ebe01[_0xd796('0x26')](0x194);}return _0x166786;};}function handleError(_0xf5310c,_0x4a8ace){_0x4a8ace=_0x4a8ace||0x1f4;return function(_0x191723){logger[_0xd796('0x27')](_0x191723[_0xd796('0x28')]);if(_0x191723[_0xd796('0x29')]){delete _0x191723['name'];}_0xf5310c[_0xd796('0x17')](_0x4a8ace)['send'](_0x191723);};}exports[_0xd796('0x2a')]=function(_0x36f671,_0x20024d){var _0x5c3940={},_0x42ba14={},_0x2e7278={'count':0x0,'rows':[]};var _0x510d5b=_['map'](db['Pause']['rawAttributes'],function(_0x3c3e4c){return{'name':_0x3c3e4c[_0xd796('0x2b')],'type':_0x3c3e4c[_0xd796('0x2c')][_0xd796('0x2d')]};});_0x42ba14['model']=_['map'](_0x510d5b,'name');_0x42ba14[_0xd796('0x2e')]=_[_0xd796('0x2f')](_0x36f671[_0xd796('0x2e')]);_0x42ba14[_0xd796('0x30')]=_[_0xd796('0x31')](_0x42ba14[_0xd796('0x32')],_0x42ba14['query']);_0x5c3940[_0xd796('0x33')]=_[_0xd796('0x31')](_0x42ba14['model'],qs['fields'](_0x36f671[_0xd796('0x2e')]['fields']));_0x5c3940[_0xd796('0x33')]=_0x5c3940[_0xd796('0x33')][_0xd796('0x34')]?_0x5c3940[_0xd796('0x33')]:_0x42ba14[_0xd796('0x32')];if(!_0x36f671[_0xd796('0x2e')][_0xd796('0x35')](_0xd796('0x36'))){_0x5c3940[_0xd796('0x37')]=qs['limit'](_0x36f671['query'][_0xd796('0x37')]);_0x5c3940['offset']=qs[_0xd796('0x19')](_0x36f671[_0xd796('0x2e')][_0xd796('0x19')]);}_0x5c3940[_0xd796('0x38')]=qs[_0xd796('0x39')](_0x36f671['query']['sort']);_0x5c3940[_0xd796('0x3a')]=qs[_0xd796('0x30')](_[_0xd796('0x3b')](_0x36f671['query'],_0x42ba14[_0xd796('0x30')]),_0x510d5b);if(_0x36f671['query'][_0xd796('0x3c')]){_0x5c3940[_0xd796('0x3a')]=_['merge'](_0x5c3940[_0xd796('0x3a')],{'$or':_[_0xd796('0x3d')](_0x510d5b,function(_0x48add1){if(_0x48add1['type']!==_0xd796('0x3e')){var _0xe5c9c9={};_0xe5c9c9[_0x48add1[_0xd796('0x29')]]={'$like':'%'+_0x36f671[_0xd796('0x2e')]['filter']+'%'};return _0xe5c9c9;}})});}_0x5c3940=_[_0xd796('0x3f')]({},_0x5c3940,_0x36f671[_0xd796('0x40')]);var _0x2bddc7={'where':_0x5c3940[_0xd796('0x3a')]};return db[_0xd796('0x41')][_0xd796('0x1b')](_0x2bddc7)[_0xd796('0x21')](function(_0x3eed51){_0x2e7278[_0xd796('0x1b')]=_0x3eed51;if(_0x36f671[_0xd796('0x2e')]['includeAll']){_0x5c3940[_0xd796('0x42')]=[{'all':!![]}];}return db[_0xd796('0x41')][_0xd796('0x43')](_0x5c3940);})['then'](function(_0x56a989){_0x2e7278['rows']=_0x56a989;return _0x2e7278;})[_0xd796('0x21')](respondWithFilteredResult(_0x20024d,_0x5c3940))[_0xd796('0x44')](handleError(_0x20024d,null));};exports[_0xd796('0x45')]=function(_0x4af234,_0x43bf62){var _0x50562a={'raw':!![],'where':{'id':_0x4af234[_0xd796('0x46')]['id']}},_0x5ed22f={};_0x5ed22f[_0xd796('0x32')]=_[_0xd796('0x2f')](db[_0xd796('0x41')][_0xd796('0x47')]);_0x5ed22f[_0xd796('0x2e')]=_[_0xd796('0x2f')](_0x4af234[_0xd796('0x2e')]);_0x5ed22f['filters']=_[_0xd796('0x31')](_0x5ed22f['model'],_0x5ed22f[_0xd796('0x2e')]);_0x50562a[_0xd796('0x33')]=_[_0xd796('0x31')](_0x5ed22f[_0xd796('0x32')],qs[_0xd796('0x48')](_0x4af234[_0xd796('0x2e')]['fields']));_0x50562a[_0xd796('0x33')]=_0x50562a[_0xd796('0x33')]['length']?_0x50562a['attributes']:_0x5ed22f[_0xd796('0x32')];if(_0x4af234['query'][_0xd796('0x49')]){_0x50562a[_0xd796('0x42')]=[{'all':!![]}];}_0x50562a=_[_0xd796('0x3f')]({},_0x50562a,_0x4af234[_0xd796('0x40')]);return db[_0xd796('0x41')][_0xd796('0x4a')](_0x50562a)[_0xd796('0x21')](handleEntityNotFound(_0x43bf62,null))[_0xd796('0x21')](respondWithResult(_0x43bf62,null))[_0xd796('0x44')](handleError(_0x43bf62,null));};exports[_0xd796('0x4b')]=function(_0x468471,_0x4b41ad){return db['Pause'][_0xd796('0x4b')](_0x468471[_0xd796('0x4c')],{})['then'](function(_0x2e0053){var _0x2a49cf=_0x468471[_0xd796('0x4d')][_0xd796('0x23')]({'plain':!![]});if(!_0x2a49cf)throw new Error(_0xd796('0x4e'));if(_0x2a49cf[_0xd796('0x4f')]===_0xd796('0x4d')){var _0x580ab9=_0x2e0053[_0xd796('0x23')]({'plain':!![]});var _0x50dcaf=_0xd796('0x24');return db[_0xd796('0x50')]['find']({'where':{'name':_0x50dcaf,'userProfileId':_0x2a49cf[_0xd796('0x51')]},'raw':!![]})['then'](function(_0x1314ca){if(_0x1314ca&&_0x1314ca[_0xd796('0x52')]===0x0){return db[_0xd796('0x25')][_0xd796('0x4b')]({'name':_0x580ab9[_0xd796('0x29')],'resourceId':_0x580ab9['id'],'type':_0x1314ca[_0xd796('0x29')],'sectionId':_0x1314ca['id']},{})[_0xd796('0x21')](function(){return _0x2e0053;});}else{return _0x2e0053;}})['catch'](function(_0x30a494){logger[_0xd796('0x27')](_0xd796('0x53'),_0x30a494);throw _0x30a494;});}return _0x2e0053;})[_0xd796('0x21')](respondWithResult(_0x4b41ad,0xc9))[_0xd796('0x44')](handleError(_0x4b41ad,null));};exports['update']=function(_0x33accb,_0x4aa96b){if(_0x33accb[_0xd796('0x4c')]['id']){delete _0x33accb[_0xd796('0x4c')]['id'];}return db['Pause'][_0xd796('0x4a')]({'where':{'id':_0x33accb[_0xd796('0x46')]['id']}})['then'](handleEntityNotFound(_0x4aa96b,null))[_0xd796('0x21')](saveUpdates(_0x33accb[_0xd796('0x4c')],null))[_0xd796('0x21')](respondWithResult(_0x4aa96b,null))[_0xd796('0x44')](handleError(_0x4aa96b,null));};exports[_0xd796('0x22')]=function(_0x179837,_0x24ca57){return db[_0xd796('0x41')][_0xd796('0x4a')]({'where':{'id':_0x179837[_0xd796('0x46')]['id']}})[_0xd796('0x21')](handleEntityNotFound(_0x24ca57,null))[_0xd796('0x21')](removeEntity(_0x24ca57,null))[_0xd796('0x44')](handleError(_0x24ca57,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0e23c58..6d9b521 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x1c0007,_0x52d004){var _0x3429b2=function(_0x1faa72){while(--_0x1faa72){_0x1c0007['push'](_0x1c0007['shift']());}};_0x3429b2(++_0x52d004);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x5fc3[_0x2cd1fb];return _0x48fd2b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x36e3ba,_0x1912e8){_0x36e3ba=_0x36e3ba-0x0;var _0x7972c7=_0x7fbe[_0x36e3ba];return _0x7972c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c888f76..38ebb7f 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x176089,_0x15c28a){var _0xe4e1ba=function(_0x2d693b){while(--_0x2d693b){_0x176089['push'](_0x176089['shift']());}};_0xe4e1ba(++_0x15c28a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xb10b[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5cabc1,_0x2e7b4a){var _0x21eb70=function(_0x435dfb){while(--_0x435dfb){_0x5cabc1['push'](_0x5cabc1['shift']());}};_0x21eb70(++_0x2e7b4a);}(_0xb10b,0x12a));var _0xbb10=function(_0x41648f,_0x4a8936){_0x41648f=_0x41648f-0x0;var _0x20340a=_0xb10b[_0x41648f];return _0x20340a;};'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 f6305ca..63005fb 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 _0x04de=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','/webhook','webhookGet','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','webhookPost'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x04de,0x107));var _0xe04d=function(_0x5b2dea,_0x3da967){_0x5b2dea=_0x5b2dea-0x0;var _0x78f627=_0x04de[_0x5b2dea];return _0x78f627;};'use strict';var multer=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var path=require(_0xe04d('0x2'));var timeout=require(_0xe04d('0x3'));var express=require(_0xe04d('0x4'));var router=express[_0xe04d('0x5')]();var fs_extra=require(_0xe04d('0x6'));var auth=require(_0xe04d('0x7'));var interaction=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var controller=require(_0xe04d('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe04d('0xb'),controller[_0xe04d('0xc')]);router[_0xe04d('0xd')](_0xe04d('0xe'),auth[_0xe04d('0xf')](),controller[_0xe04d('0x10')]);router[_0xe04d('0xd')](_0xe04d('0x11'),auth['isAuthenticated'](),controller[_0xe04d('0x12')]);var upload=multer({'storage':multer[_0xe04d('0x13')]({'destination':function(_0x2576b2,_0x30c46b,_0xad5c34){_0xad5c34(null,path[_0xe04d('0x14')](config[_0xe04d('0x15')],_0xe04d('0x16')));},'filename':function(_0x3ccdc8,_0x53f59a,_0x8bf2d2){_0x53f59a[_0xe04d('0x17')]=_0x53f59a[_0xe04d('0x17')][_0xe04d('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8bf2d2(null,util[_0xe04d('0x19')](_0xe04d('0x1a'),path[_0xe04d('0x1b')](_0x53f59a[_0xe04d('0x17')],path[_0xe04d('0x1c')](_0x53f59a[_0xe04d('0x17')])),Date[_0xe04d('0x1d')](),path[_0xe04d('0x1c')](_0x53f59a['originalname'])));}})});router[_0xe04d('0x1e')]('/',upload['single'](_0xe04d('0x1f')),controller['upload']);router[_0xe04d('0x1e')](_0xe04d('0xb'),controller[_0xe04d('0x20')]);router[_0xe04d('0x21')](_0xe04d('0xe'),auth[_0xe04d('0xf')](),controller[_0xe04d('0x22')]);router[_0xe04d('0x23')](_0xe04d('0xe'),auth['isAuthenticated'](),controller[_0xe04d('0x23')]);module[_0xe04d('0x24')]=router; \ No newline at end of file +var _0xa37e=['../../config/environment','./plugin.controller','get','/:id','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','format','basename','extname','now','post','upload','/webhook','webhookPost','delete','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x52c3c1,_0xd8f6d3){var _0x1a960f=function(_0x121cfb){while(--_0x121cfb){_0x52c3c1['push'](_0x52c3c1['shift']());}};_0x1a960f(++_0xd8f6d3);}(_0xa37e,0x97));var _0xea37=function(_0x25ae3d,_0x1c7cb0){_0x25ae3d=_0x25ae3d-0x0;var _0x126405=_0xa37e[_0x25ae3d];return _0x126405;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea37('0x0'));var timeout=require(_0xea37('0x1'));var express=require(_0xea37('0x2'));var router=express[_0xea37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x5'));var controller=require(_0xea37('0x6'));router[_0xea37('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea37('0x7')]('/webhook',controller['webhookGet']);router[_0xea37('0x7')](_0xea37('0x8'),auth[_0xea37('0x9')](),controller[_0xea37('0xa')]);router['get'](_0xea37('0xb'),auth[_0xea37('0x9')](),controller[_0xea37('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5060cd,_0x9a39cd,_0x117ce1){_0x117ce1(null,path[_0xea37('0xd')](config['root'],_0xea37('0xe')));},'filename':function(_0x2a0460,_0x2a2bcd,_0x589a61){_0x2a2bcd[_0xea37('0xf')]=_0x2a2bcd[_0xea37('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x589a61(null,util[_0xea37('0x10')]('%s-%s%s',path[_0xea37('0x11')](_0x2a2bcd['originalname'],path[_0xea37('0x12')](_0x2a2bcd[_0xea37('0xf')])),Date[_0xea37('0x13')](),path[_0xea37('0x12')](_0x2a2bcd['originalname'])));}})});router[_0xea37('0x14')]('/',upload['single']('file'),controller[_0xea37('0x15')]);router['post'](_0xea37('0x16'),controller[_0xea37('0x17')]);router['put'](_0xea37('0x8'),auth[_0xea37('0x9')](),controller['update']);router[_0xea37('0x18')](_0xea37('0x8'),auth[_0xea37('0x9')](),controller[_0xea37('0x18')]);module[_0xea37('0x19')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index acf6edf..65330b6 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 _0x3796=['ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x3796,0x153));var _0x6379=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3796[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0x6379('0x0'));module['exports']={'name':{'type':Sequelize[_0x6379('0x1')]},'type':{'type':Sequelize[_0x6379('0x2')]('html',_0x6379('0x3'))},'description':{'type':Sequelize[_0x6379('0x4')]},'version':{'type':Sequelize[_0x6379('0x4')]},'path':{'type':Sequelize[_0x6379('0x1')],'comment':_0x6379('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6379('0x6')},'sidebar':{'type':Sequelize[_0x6379('0x2')](_0x6379('0x7'),_0x6379('0x8'),'always','never'),'defaultValue':_0x6379('0x9'),'comment':_0x6379('0xa')},'icon':{'type':Sequelize[_0x6379('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x6379('0x1')]},'scriptName':{'type':Sequelize[_0x6379('0x1')]},'scriptPath':{'type':Sequelize[_0x6379('0x1')]}}; \ No newline at end of file +var _0xc38c=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xc38c,0x198));var _0xcc38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc38c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcc38('0x0'));module[_0xcc38('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcc38('0x2')](_0xcc38('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xcc38('0x4')]},'path':{'type':Sequelize[_0xcc38('0x5')],'comment':_0xcc38('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xcc38('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0xcc38('0x8'),_0xcc38('0x9'),_0xcc38('0xa'),_0xcc38('0xb')),'defaultValue':_0xcc38('0xa'),'comment':_0xcc38('0xc')},'icon':{'type':Sequelize[_0xcc38('0x5')]},'adminUrl':{'type':Sequelize[_0xcc38('0x5')]},'agentUrl':{'type':Sequelize[_0xcc38('0x5')]},'scriptName':{'type':Sequelize[_0xcc38('0x5')]},'scriptPath':{'type':Sequelize[_0xcc38('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 960ad19..c12a9cf 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 _0x289e=['attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','catch','show','keys','find','params','server/files/plugins','format','%s.zip','basename','createWriteStream','code','ENOENT','error','Sequelize','Error','glob','**/*','root','join','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','plugins','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','end','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','query','filters','intersection','model'];(function(_0x60ce95,_0x2365a1){var _0x4676e1=function(_0x32430f){while(--_0x32430f){_0x60ce95['push'](_0x60ce95['shift']());}};_0x4676e1(++_0x2365a1);}(_0x289e,0x1b4));var _0xe289=function(_0x58236d,_0x365c03){_0x58236d=_0x58236d-0x0;var _0x322688=_0x289e[_0x58236d];return _0x322688;};'use strict';var emlformat=require(_0xe289('0x0'));var rimraf=require(_0xe289('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe289('0x2'));var rp=require(_0xe289('0x3'));var moment=require('moment');var BPromise=require(_0xe289('0x4'));var Mustache=require(_0xe289('0x5'));var util=require(_0xe289('0x6'));var path=require(_0xe289('0x7'));var sox=require(_0xe289('0x8'));var csv=require(_0xe289('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe289('0xa'));var _=require(_0xe289('0xb'));var squel=require('squel');var crypto=require(_0xe289('0xc'));var jsforce=require(_0xe289('0xd'));var deskjs=require(_0xe289('0xe'));var toCsv=require(_0xe289('0x9'));var querystring=require('querystring');var Papa=require(_0xe289('0xf'));var extract=require(_0xe289('0x10'));var rimraf=require('rimraf');var archiver=require(_0xe289('0x11'));var Redis=require('ioredis');var authService=require(_0xe289('0x12'));var qs=require(_0xe289('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe289('0x14'))(_0xe289('0x15'));var utils=require(_0xe289('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe289('0x17'))['db'];config[_0xe289('0x18')]=_[_0xe289('0x19')](config[_0xe289('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe289('0x1a'))(new Redis(config[_0xe289('0x18')]));require(_0xe289('0x1b'))['register'](socket);function respondWithStatusCode(_0x1a4b06,_0x3f1bd5){_0x3f1bd5=_0x3f1bd5||0xcc;return function(_0x1ee083){if(_0x1ee083){return _0x1a4b06[_0xe289('0x1c')](_0x3f1bd5);}return _0x1a4b06[_0xe289('0x1d')](_0x3f1bd5)['end']();};}function respondWithResult(_0x43891d,_0x14e36a){_0x14e36a=_0x14e36a||0xc8;return function(_0x6b5513){if(_0x6b5513){return _0x43891d[_0xe289('0x1d')](_0x14e36a)['json'](_0x6b5513);}};}function respondWithFilteredResult(_0x1bb5fa,_0x5f57db){return function(_0x17093c){if(_0x17093c){var _0x5d7454=typeof _0x5f57db[_0xe289('0x1e')]===_0xe289('0x1f')&&typeof _0x5f57db['limit']===_0xe289('0x1f');var _0x1e778b=_0x17093c[_0xe289('0x20')];var _0x2da97f=_0x5d7454?0x0:_0x5f57db[_0xe289('0x1e')];var _0x33c0ab=_0x5d7454?_0x17093c[_0xe289('0x20')]:_0x5f57db[_0xe289('0x1e')]+_0x5f57db[_0xe289('0x21')];var _0x616dc9;if(_0x33c0ab>=_0x1e778b){_0x33c0ab=_0x1e778b;_0x616dc9=0xc8;}else{_0x616dc9=0xce;}_0x1bb5fa[_0xe289('0x1d')](_0x616dc9);return _0x1bb5fa[_0xe289('0x22')](_0xe289('0x23'),_0x2da97f+'-'+_0x33c0ab+'/'+_0x1e778b)[_0xe289('0x24')](_0x17093c);}return null;};}function patchUpdates(_0x291954){return function(_0x374cad){try{jsonpatch[_0xe289('0x25')](_0x374cad,_0x291954,!![]);}catch(_0x3193cf){return BPromise[_0xe289('0x26')](_0x3193cf);}return _0x374cad[_0xe289('0x27')]();};}function saveUpdates(_0x9d7e75,_0x22aa8f){return function(_0x2919b6){if(_0x2919b6){return _0x2919b6['update'](_0x9d7e75)[_0xe289('0x28')](function(_0xfcdd4d){return _0xfcdd4d;});}return null;};}function removeEntity(_0x295488,_0x1819fd){return function(_0x4bc33d){if(_0x4bc33d){return _0x4bc33d[_0xe289('0x29')]()[_0xe289('0x28')](function(){var _0x5ebcd3=_0x4bc33d[_0xe289('0x2a')]({'plain':!![]});var _0x39ce9a=_0xe289('0x2b');return db[_0xe289('0x2c')]['destroy']({'where':{'type':_0x39ce9a,'resourceId':_0x5ebcd3['id']}})[_0xe289('0x28')](function(){return _0x4bc33d;});})['then'](function(){_0x295488[_0xe289('0x1d')](0xcc)[_0xe289('0x2d')]();});}};}function handleEntityNotFound(_0x1b9fe4,_0x38cc03){return function(_0x47c4fc){if(!_0x47c4fc){_0x1b9fe4[_0xe289('0x1c')](0x194);}return _0x47c4fc;};}function handleError(_0x58bd41,_0x1b8871){_0x1b8871=_0x1b8871||0x1f4;return function(_0x90bb76){logger['error'](_0x90bb76[_0xe289('0x2e')]);if(_0x90bb76[_0xe289('0x2f')]){delete _0x90bb76['name'];}_0x58bd41[_0xe289('0x1d')](_0x1b8871)[_0xe289('0x30')](_0x90bb76);};}exports[_0xe289('0x31')]=function(_0x5c5bcb,_0x215272){var _0x1d0ecb={},_0x7e1329={},_0x1c251a={'count':0x0,'rows':[]};var _0x27c1e1=_[_0xe289('0x32')](db[_0xe289('0x33')][_0xe289('0x34')],function(_0x4f9b96){return{'name':_0x4f9b96[_0xe289('0x35')],'type':_0x4f9b96['type'][_0xe289('0x36')]};});_0x7e1329['model']=_['map'](_0x27c1e1,_0xe289('0x2f'));_0x7e1329[_0xe289('0x37')]=_['keys'](_0x5c5bcb[_0xe289('0x37')]);_0x7e1329[_0xe289('0x38')]=_[_0xe289('0x39')](_0x7e1329[_0xe289('0x3a')],_0x7e1329[_0xe289('0x37')]);_0x1d0ecb[_0xe289('0x3b')]=_[_0xe289('0x39')](_0x7e1329['model'],qs[_0xe289('0x3c')](_0x5c5bcb['query']['fields']));_0x1d0ecb['attributes']=_0x1d0ecb['attributes'][_0xe289('0x3d')]?_0x1d0ecb[_0xe289('0x3b')]:_0x7e1329[_0xe289('0x3a')];if(!_0x5c5bcb[_0xe289('0x37')]['hasOwnProperty'](_0xe289('0x3e'))){_0x1d0ecb[_0xe289('0x21')]=qs['limit'](_0x5c5bcb[_0xe289('0x37')][_0xe289('0x21')]);_0x1d0ecb[_0xe289('0x1e')]=qs[_0xe289('0x1e')](_0x5c5bcb[_0xe289('0x37')][_0xe289('0x1e')]);}_0x1d0ecb[_0xe289('0x3f')]=qs[_0xe289('0x40')](_0x5c5bcb[_0xe289('0x37')][_0xe289('0x40')]);_0x1d0ecb[_0xe289('0x41')]=qs[_0xe289('0x38')](_[_0xe289('0x42')](_0x5c5bcb[_0xe289('0x37')],_0x7e1329[_0xe289('0x38')]),_0x27c1e1);if(_0x5c5bcb['query']['filter']){_0x1d0ecb[_0xe289('0x41')]=_['merge'](_0x1d0ecb[_0xe289('0x41')],{'$or':_[_0xe289('0x32')](_0x27c1e1,function(_0x52854a){if(_0x52854a[_0xe289('0x43')]!==_0xe289('0x44')){var _0x4c0ffa={};_0x4c0ffa[_0x52854a[_0xe289('0x2f')]]={'$like':'%'+_0x5c5bcb[_0xe289('0x37')][_0xe289('0x45')]+'%'};return _0x4c0ffa;}})});}_0x1d0ecb=_[_0xe289('0x46')]({},_0x1d0ecb,_0x5c5bcb[_0xe289('0x47')]);var _0x51a4d5={'where':_0x1d0ecb[_0xe289('0x41')]};return db['Plugin']['count'](_0x51a4d5)[_0xe289('0x28')](function(_0x52ea7e){_0x1c251a[_0xe289('0x20')]=_0x52ea7e;if(_0x5c5bcb[_0xe289('0x37')][_0xe289('0x48')]){_0x1d0ecb[_0xe289('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x1d0ecb);})['then'](function(_0x1a3d0b){_0x1c251a['rows']=_0x1a3d0b;return _0x1c251a;})['then'](respondWithFilteredResult(_0x215272,_0x1d0ecb))[_0xe289('0x4a')](handleError(_0x215272,null));};exports[_0xe289('0x4b')]=function(_0x537f7b,_0x333869){var _0x198d8e={'raw':!![],'where':{'id':_0x537f7b['params']['id']}},_0x3d43ef={};_0x3d43ef[_0xe289('0x3a')]=_[_0xe289('0x4c')](db['Plugin'][_0xe289('0x34')]);_0x3d43ef[_0xe289('0x37')]=_[_0xe289('0x4c')](_0x537f7b[_0xe289('0x37')]);_0x3d43ef[_0xe289('0x38')]=_[_0xe289('0x39')](_0x3d43ef[_0xe289('0x3a')],_0x3d43ef['query']);_0x198d8e['attributes']=_[_0xe289('0x39')](_0x3d43ef[_0xe289('0x3a')],qs[_0xe289('0x3c')](_0x537f7b[_0xe289('0x37')]['fields']));_0x198d8e[_0xe289('0x3b')]=_0x198d8e[_0xe289('0x3b')]['length']?_0x198d8e[_0xe289('0x3b')]:_0x3d43ef[_0xe289('0x3a')];if(_0x537f7b[_0xe289('0x37')][_0xe289('0x48')]){_0x198d8e['include']=[{'all':!![]}];}_0x198d8e=_[_0xe289('0x46')]({},_0x198d8e,_0x537f7b[_0xe289('0x47')]);return db['Plugin'][_0xe289('0x4d')](_0x198d8e)['then'](handleEntityNotFound(_0x333869,null))['then'](respondWithResult(_0x333869,null))[_0xe289('0x4a')](handleError(_0x333869,null));};exports['download']=function(_0xb79349,_0x4df448,_0xec0f9e){return db['Plugin'][_0xe289('0x4d')]({'where':{'id':_0xb79349[_0xe289('0x4e')]['id']},'attributes':[_0xe289('0x2f'),_0xe289('0x7')],'raw':!![]})[_0xe289('0x28')](handleEntityNotFound(_0x4df448,null))[_0xe289('0x28')](function(_0x597d10){if(_0x597d10){var _0x3807d2=path['join'](config['root'],_0xe289('0x4f'),util[_0xe289('0x50')](_0xe289('0x51'),path[_0xe289('0x52')](_0x597d10[_0xe289('0x7')])));var _0x40d045=fs[_0xe289('0x53')](_0x3807d2);var _0x44c391=archiver('zip',{'zlib':{'level':0x9}});_0x44c391['on']('warning',function(_0x36d39a){if(_0x36d39a[_0xe289('0x54')]===_0xe289('0x55')){logger[_0xe289('0x56')](_0x36d39a);}else{throw new db[(_0xe289('0x57'))][(_0xe289('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x44c391['on'](_0xe289('0x56'),function(_0x183690){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x44c391['pipe'](_0x40d045);_0x44c391[_0xe289('0x59')](_0xe289('0x5a'),{'cwd':path['join'](config[_0xe289('0x5b')],'server/files/plugins',path['dirname'](_0x597d10[_0xe289('0x7')])),'ignore':[path[_0xe289('0x5c')](path[_0xe289('0x52')](_0x597d10['path']),_0xe289('0x5d')),path[_0xe289('0x5c')](path['basename'](_0x597d10[_0xe289('0x7')]),'attachments/**/*')],'nodir':!![]})[_0xe289('0x5e')]();_0x40d045['on'](_0xe289('0x5f'),function(){if(!fs[_0xe289('0x60')](_0x3807d2)){throw new db['Sequelize'][(_0xe289('0x58'))](_0xe289('0x61'));}return _0x4df448[_0xe289('0x62')](_0x3807d2,util[_0xe289('0x50')](_0xe289('0x51'),path[_0xe289('0x52')](_0x597d10[_0xe289('0x7')])),function(_0xe10007){if(_0xe10007){throw new db[(_0xe289('0x57'))]['Error'](_0xe289('0x63'));}fs[_0xe289('0x64')](_0x3807d2);logger[_0xe289('0x65')](_0xe289('0x66'));logger[_0xe289('0x65')](_0xe289('0x67'));});});}return null;})[_0xe289('0x4a')](handleError(_0x4df448,null));};exports[_0xe289('0x68')]=function(_0xb6a759,_0x6d87ed,_0x3cf9a6){var _0x33e5b2=path[_0xe289('0x52')](_0xb6a759[_0xe289('0x69')][_0xe289('0x6a')],path['extname'](_0xb6a759[_0xe289('0x69')][_0xe289('0x6a')]));var _0x55556d=path[_0xe289('0x5c')](config[_0xe289('0x5b')],_0xe289('0x4f'),_0xb6a759[_0xe289('0x69')][_0xe289('0x6a')]);var _0x5790e3=path[_0xe289('0x5c')](config[_0xe289('0x5b')],_0xe289('0x4f'),_0x33e5b2);logger[_0xe289('0x65')](_0xe289('0x6b'),_0x55556d);logger[_0xe289('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x5790e3);try{fs[_0xe289('0x6c')](_0x55556d,parseInt(_0xe289('0x6d'),0x8));extract(_0x55556d,{'dir':_0x5790e3},function(_0x1715d3){if(_0x1715d3){logger['error'](_0x1715d3);handleError(_0x1715d3,!![]);};var _0x4dd918=fs[_0xe289('0x6e')](_0x5790e3);if(_0x4dd918[_0xe289('0x3d')]>0x1){removeReferences(_0x55556d,_0x5790e3);logger[_0xe289('0x56')](_0xe289('0x6f'));return _0x3cf9a6(new Error(_0xe289('0x6f')));}var _0x3d2614=fs['lstatSync'](path[_0xe289('0x5c')](_0x5790e3,_0x4dd918[0x0]));if(_0x3d2614[_0xe289('0x70')]()){removeReferences(_0x55556d,_0x5790e3);logger['error']('Invalid\x20plugin\x20structure');return _0x3cf9a6(new Error('Invalid\x20plugin\x20structure'));}if(_0x3d2614[_0xe289('0x71')]()){var _0x5c2eed=fs[_0xe289('0x6e')](path[_0xe289('0x5c')](_0x5790e3,_0x4dd918[0x0]));if(_0x5c2eed[_0xe289('0x3d')]===0x0){removeReferences(_0x55556d,_0x5790e3);logger[_0xe289('0x56')](_0xe289('0x6f'));return _0x3cf9a6(new Error(_0xe289('0x6f')));}var _0x5be6d8=_0x5c2eed[_0xe289('0x72')](function(_0x139f6e){return _0x139f6e==='manifest.json';});if(!_0x5be6d8){return _0x3cf9a6(new Error(_0xe289('0x73')));}var _0xedcbd4=fs['readFileSync'](path['join'](_0x5790e3,_0x4dd918[0x0],_0xe289('0x74')));var _0x3a42bf=JSON[_0xe289('0x75')](_0xedcbd4);if(_0xe289('0x1f')==typeof _0x3a42bf[_0xe289('0x2f')]){return _0x3cf9a6(new Error(_0xe289('0x76')));}if(_0xe289('0x1f')==typeof _0x3a42bf['type']){return _0x3cf9a6(new Error(_0xe289('0x77')));}if(_0xe289('0x1f')==typeof _0x3a42bf[_0xe289('0x78')]){return _0x3cf9a6(new Error(_0xe289('0x79')));}if('undefined'==typeof _0x3a42bf[_0xe289('0x7a')]){return _0x3cf9a6(new Error(_0xe289('0x7b')));}if(_0x3a42bf['type']===_0xe289('0x7c')){if('undefined'==typeof _0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')]){return _0x3cf9a6(new Error(_0xe289('0x7e')));}if(_0xe289('0x1f')==typeof _0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')][_0xe289('0x7f')]&&_0xe289('0x1f')==typeof _0x3a42bf[_0xe289('0x7a')]['views'][_0xe289('0x80')]){return _0x3cf9a6(new Error(_0xe289('0x81')));}}else if(_0x3a42bf[_0xe289('0x43')]===_0xe289('0x82')){if('undefined'==typeof _0x3a42bf[_0xe289('0x7a')][_0xe289('0x83')]){return _0x3cf9a6(new Error(_0xe289('0x84')));}if(_0xe289('0x1f')==typeof _0x3a42bf[_0xe289('0x7a')][_0xe289('0x85')]){return _0x3cf9a6(new Error(_0xe289('0x86')));}}else{return _0x3cf9a6(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x14fe2a=_0x3a42bf[_0xe289('0x2f')];var _0x20d4d6=_0x3a42bf[_0xe289('0x87')];var _0x1c77b5=_0x3a42bf['type'];var _0x5e5547=_0x3a42bf[_0xe289('0x88')]?_0x3a42bf[_0xe289('0x88')]:_0xe289('0x89');var _0x2fddc9=_0x3a42bf[_0xe289('0x8a')]?_0x3a42bf[_0xe289('0x8a')]:'icon-apps';var _0x9184bc='';var _0x124a4b='';var _0x2de70f='';var _0x5e0f0e='';var _0x26c575=_0x3a42bf[_0xe289('0x78')];if(_0x1c77b5===_0xe289('0x7c')){if(_0xe289('0x1f')!=typeof _0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')][_0xe289('0x7f')]){var _0x31763d=_0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x31763d)){_0x9184bc=path[_0xe289('0x5c')]('plugins',_0x33e5b2,_0x4dd918[0x0],_0x31763d);}else{_0x9184bc=_0x31763d;}}else{logger[_0xe289('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')]['agent']){var _0x53e263=_0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')][_0xe289('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xe289('0x8b')](_0x53e263)){_0x124a4b=path[_0xe289('0x5c')](_0xe289('0x8c'),_0x33e5b2,_0x4dd918[0x0],_0x53e263);}else{_0x124a4b=_0x53e263;}}else{logger[_0xe289('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x1c77b5===_0xe289('0x82')){_0x2de70f=_0x3a42bf[_0xe289('0x7a')]['scriptName'];_0x5e0f0e=_0x3a42bf['parameters'][_0xe289('0x85')];if(_0xe289('0x1f')!=typeof _0x3a42bf['parameters'][_0xe289('0x7d')]){if(_0xe289('0x1f')!=typeof _0x3a42bf[_0xe289('0x7a')]['views'][_0xe289('0x7f')]){var _0x31763d=_0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')][_0xe289('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x31763d)){_0x9184bc=path['join'](_0xe289('0x8c'),_0x33e5b2,_0x4dd918[0x0],_0x31763d);}else{_0x9184bc=_0x31763d;}}if(_0xe289('0x1f')!=typeof _0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')]['agent']){var _0x53e263=_0x3a42bf[_0xe289('0x7a')][_0xe289('0x7d')][_0xe289('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x53e263)){_0x124a4b=path[_0xe289('0x5c')](_0xe289('0x8c'),_0x33e5b2,_0x4dd918[0x0],_0x53e263);}else{_0x124a4b=_0x53e263;}}}}var _0xb10c4a={'name':_0x14fe2a,'description':_0x20d4d6,'path':path[_0xe289('0x5c')](_0x33e5b2,_0x4dd918[0x0]),'type':_0x1c77b5,'sidebar':_0x5e5547,'icon':_0x2fddc9,'adminUrl':_0x9184bc,'agentUrl':_0x124a4b,'scriptName':_0x2de70f,'scriptPath':_0x5e0f0e,'version':_0x26c575};removeReferences(_0x55556d,null);return db['Plugin'][_0xe289('0x8d')](_0xb10c4a)[_0xe289('0x28')](function(_0x5bffba){var _0x429529={'role':_0xb6a759[_0xe289('0x8e')][_0xe289('0x8f')],'userProfileId':_0xb6a759[_0xe289('0x8e')]['userProfileId']};if(!_0x429529)throw new Error(_0xe289('0x90'));if(_0x429529[_0xe289('0x8f')]===_0xe289('0x91')){var _0x26bfba=_0x5bffba[_0xe289('0x2a')]({'plain':!![]});return db[_0xe289('0x92')][_0xe289('0x4d')]({'where':{'name':_0xe289('0x2b'),'userProfileId':_0x429529['userProfileId']},'raw':!![]})[_0xe289('0x28')](function(_0x3db4aa){if(_0x3db4aa&&_0x3db4aa['autoAssociation']===0x0){return db['UserProfileResource'][_0xe289('0x8d')]({'name':_0x26bfba['name'],'resourceId':_0x26bfba['id'],'type':_0x3db4aa[_0xe289('0x2f')],'sectionId':_0x3db4aa['id']},{})[_0xe289('0x28')](function(){return _0x5bffba;});}else{return _0x5bffba;}})[_0xe289('0x4a')](function(_0x51df57){logger[_0xe289('0x56')](_0xe289('0x93'),_0x51df57);throw _0x51df57;});}return _0x5bffba;})['then'](respondWithResult(_0x6d87ed,null))[_0xe289('0x4a')](handleError(_0x6d87ed,null));}});}catch(_0x4668c2){_0x6d87ed[_0xe289('0x1d')](0x1f4)[_0xe289('0x30')](_0x4668c2);}};function removeReferences(_0x2b34dc,_0x474f1e){try{if(_0x2b34dc){fs[_0xe289('0x64')](_0x2b34dc);logger[_0xe289('0x65')](_0xe289('0x94'));}if(_0x474f1e){rimraf(_0x474f1e,function(){});logger[_0xe289('0x65')](_0xe289('0x95'));}}catch(_0x386bb6){logger[_0xe289('0x56')](_0x386bb6);}}exports[_0xe289('0x96')]=function(_0x256b45,_0x5d1b56,_0x4a5ce3){return db[_0xe289('0x33')][_0xe289('0x4d')]({'where':{'id':_0x256b45[_0xe289('0x4e')]['id']}})[_0xe289('0x28')](handleEntityNotFound(_0x5d1b56,null))['then'](saveUpdates(_0x256b45[_0xe289('0x8e')],null))[_0xe289('0x28')](respondWithResult(_0x5d1b56,null))[_0xe289('0x4a')](handleError(_0x5d1b56,null));};exports[_0xe289('0x97')]=function(_0x372c35,_0x9396fd,_0x4ae884){return db['Plugin'][_0xe289('0x4d')]({'where':{'id':_0x372c35[_0xe289('0x4e')]['id']}})['then'](function(_0x4e219c){if(_0x4e219c){return _0x4e219c[_0xe289('0x29')]();}})[_0xe289('0x28')](function(_0x490f0e){rimraf(path[_0xe289('0x5c')](config['root'],_0xe289('0x4f'),path['dirname'](_0x490f0e[_0xe289('0x7')])),function(){});return _0x490f0e;})[_0xe289('0x28')](handleEntityNotFound(_0x9396fd,null))[_0xe289('0x28')](respondWithStatusCode(_0x9396fd,null))[_0xe289('0x4a')](handleError(_0x9396fd,null));};exports[_0xe289('0x98')]=function(_0x117fea,_0x2ce417,_0x2f881d){return BPromise['resolve']()[_0xe289('0x28')](function(){if(!_0x117fea[_0xe289('0x37')][_0xe289('0x7')]){throw new Error(_0xe289('0x99'));}if(!_0x117fea['query']['port']){throw new Error(_0xe289('0x9a'));}var _0x59b8ef=_0x117fea['query']['hostname']?_0x117fea['query'][_0xe289('0x9b')]+':'+_0x117fea['query'][_0xe289('0x9c')]:'http://localhost:'+_0x117fea[_0xe289('0x37')][_0xe289('0x9c')];var _0x290d6e=_0x117fea[_0xe289('0x37')][_0xe289('0x24')]?_0x117fea[_0xe289('0x37')][_0xe289('0x24')]:!![];var _0x2be444=_0x117fea[_0xe289('0x37')][_0xe289('0x9d')]?_0x117fea[_0xe289('0x37')]['encoding']:null;var _0x316b55={'method':_0x117fea[_0xe289('0x9e')],'uri':util[_0xe289('0x50')](_0xe289('0x9f'),_0x59b8ef,_0x117fea[_0xe289('0x37')]['path']),'json':_0x290d6e,'resolveWithFullResponse':!![],'encoding':_0x2be444,'qs':_0x117fea[_0xe289('0x37')]};if(_0x117fea[_0xe289('0xa0')]){_0x316b55[_0xe289('0xa0')]=_0x117fea[_0xe289('0xa0')];if(_0x316b55['headers']['content-length']){delete _0x316b55[_0xe289('0xa0')][_0xe289('0xa1')];}}if(_0x316b55['headers'][_0xe289('0xa2')]){delete _0x316b55[_0xe289('0xa0')][_0xe289('0xa2')];}return rp(_0x316b55);})['then'](function(_0x3a1253){if(_0x3a1253){_0x2ce417[_0xe289('0x22')](_0x3a1253['headers']);logger[_0xe289('0x65')](_0x3a1253[_0xe289('0x8e')]);if(_[_0xe289('0xa3')](_0x117fea[_0xe289('0x37')][_0xe289('0x7')],_0xe289('0x62'))&&_0x3a1253['statusCode']==0x1f4){return _0x2ce417[_0xe289('0x1c')](_0x3a1253[_0xe289('0xa4')]);}else{return _0x2ce417['status'](_0x3a1253[_0xe289('0xa4')])[_0xe289('0x30')](_0x3a1253[_0xe289('0x8e')]);}}else{return _0x2ce417[_0xe289('0x1c')](0xc8);}})[_0xe289('0x4a')](handleError(_0x2ce417,null));};exports['webhookPost']=function(_0x55f6fc,_0x16419c,_0x4daa3e){return BPromise['resolve']()[_0xe289('0x28')](function(){if(!_0x55f6fc['query'][_0xe289('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x55f6fc[_0xe289('0x37')][_0xe289('0x9c')]){throw new Error(_0xe289('0x9a'));}var _0x474115=_0x55f6fc[_0xe289('0x37')]['hostname']?_0x55f6fc[_0xe289('0x37')]['hostname']+':'+_0x55f6fc[_0xe289('0x37')][_0xe289('0x9c')]:'http://localhost:'+_0x55f6fc['query']['port'];var _0x78e115=_0x55f6fc['query'][_0xe289('0x24')]?_0x55f6fc[_0xe289('0x37')][_0xe289('0x24')]:!![];var _0x2356d5=_0x55f6fc[_0xe289('0x37')][_0xe289('0x9d')]?_0x55f6fc[_0xe289('0x37')][_0xe289('0x9d')]:null;var _0x2a2474={'method':_0x55f6fc[_0xe289('0x9e')],'uri':util[_0xe289('0x50')](_0xe289('0x9f'),_0x474115,_0x55f6fc['query'][_0xe289('0x7')]),'json':_0x78e115,'resolveWithFullResponse':!![],'encoding':_0x2356d5,'body':_0x55f6fc[_0xe289('0x8e')]};if(_0x55f6fc[_0xe289('0xa0')]){_0x2a2474[_0xe289('0xa0')]=_0x55f6fc[_0xe289('0xa0')];if(_0x2a2474[_0xe289('0xa0')][_0xe289('0xa1')]){delete _0x2a2474[_0xe289('0xa0')][_0xe289('0xa1')];}}if(_0x2a2474[_0xe289('0xa0')][_0xe289('0xa2')]){delete _0x2a2474[_0xe289('0xa0')][_0xe289('0xa2')];}return rp(_0x2a2474);})[_0xe289('0x28')](function(_0x8c72e4){if(_0x8c72e4){_0x16419c[_0xe289('0x22')](_0x8c72e4[_0xe289('0xa0')]);logger[_0xe289('0x65')](_0x8c72e4['body']);return _0x16419c[_0xe289('0x1d')](_0x8c72e4[_0xe289('0xa4')])['send'](_0x8c72e4[_0xe289('0x8e')]);}else{return _0x16419c[_0xe289('0x1c')](0xc8);}})[_0xe289('0x4a')](handleError(_0x16419c,null));}; \ No newline at end of file +var _0xe498=['body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','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','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','download','join','root','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','server/files/plugins','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create'];(function(_0x340973,_0x870521){var _0x1040ee=function(_0x121134){while(--_0x121134){_0x340973['push'](_0x340973['shift']());}};_0x1040ee(++_0x870521);}(_0xe498,0x16f));var _0x8e49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe498[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8e49('0x0'));var rimraf=require(_0x8e49('0x1'));var zipdir=require(_0x8e49('0x2'));var jsonpatch=require(_0x8e49('0x3'));var rp=require(_0x8e49('0x4'));var moment=require(_0x8e49('0x5'));var BPromise=require(_0x8e49('0x6'));var Mustache=require('mustache');var util=require(_0x8e49('0x7'));var path=require(_0x8e49('0x8'));var sox=require(_0x8e49('0x9'));var csv=require(_0x8e49('0xa'));var ejs=require(_0x8e49('0xb'));var fs=require('fs');var fs_extra=require(_0x8e49('0xc'));var _=require(_0x8e49('0xd'));var squel=require(_0x8e49('0xe'));var crypto=require('crypto');var jsforce=require(_0x8e49('0xf'));var deskjs=require(_0x8e49('0x10'));var toCsv=require(_0x8e49('0xa'));var querystring=require('querystring');var Papa=require(_0x8e49('0x11'));var extract=require(_0x8e49('0x12'));var rimraf=require(_0x8e49('0x1'));var archiver=require('archiver');var Redis=require(_0x8e49('0x13'));var authService=require(_0x8e49('0x14'));var qs=require(_0x8e49('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e49('0x16'));var logger=require(_0x8e49('0x17'))('api');var utils=require(_0x8e49('0x18'));var config=require(_0x8e49('0x19'));var licenseUtil=require(_0x8e49('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8e49('0x1b')](config[_0x8e49('0x1c')],{'host':_0x8e49('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e49('0x1c')]));require('./plugin.socket')[_0x8e49('0x1e')](socket);function respondWithStatusCode(_0x448999,_0x37fd8e){_0x37fd8e=_0x37fd8e||0xcc;return function(_0x3dbd22){if(_0x3dbd22){return _0x448999[_0x8e49('0x1f')](_0x37fd8e);}return _0x448999[_0x8e49('0x20')](_0x37fd8e)[_0x8e49('0x21')]();};}function respondWithResult(_0xd1fbaa,_0xe690dc){_0xe690dc=_0xe690dc||0xc8;return function(_0x3226e4){if(_0x3226e4){return _0xd1fbaa['status'](_0xe690dc)[_0x8e49('0x22')](_0x3226e4);}};}function respondWithFilteredResult(_0x4ac4e4,_0x54f08d){return function(_0x3c6596){if(_0x3c6596){var _0x1d5895=typeof _0x54f08d['offset']===_0x8e49('0x23')&&typeof _0x54f08d[_0x8e49('0x24')]==='undefined';var _0xc6443=_0x3c6596[_0x8e49('0x25')];var _0x2c7193=_0x1d5895?0x0:_0x54f08d[_0x8e49('0x26')];var _0x1436a2=_0x1d5895?_0x3c6596[_0x8e49('0x25')]:_0x54f08d[_0x8e49('0x26')]+_0x54f08d['limit'];var _0x1060be;if(_0x1436a2>=_0xc6443){_0x1436a2=_0xc6443;_0x1060be=0xc8;}else{_0x1060be=0xce;}_0x4ac4e4[_0x8e49('0x20')](_0x1060be);return _0x4ac4e4[_0x8e49('0x27')](_0x8e49('0x28'),_0x2c7193+'-'+_0x1436a2+'/'+_0xc6443)[_0x8e49('0x22')](_0x3c6596);}return null;};}function patchUpdates(_0x444177){return function(_0x53dc98){try{jsonpatch[_0x8e49('0x29')](_0x53dc98,_0x444177,!![]);}catch(_0x39bf64){return BPromise[_0x8e49('0x2a')](_0x39bf64);}return _0x53dc98[_0x8e49('0x2b')]();};}function saveUpdates(_0x2f8c55,_0x529520){return function(_0x1c890a){if(_0x1c890a){return _0x1c890a[_0x8e49('0x2c')](_0x2f8c55)[_0x8e49('0x2d')](function(_0x59ab5f){return _0x59ab5f;});}return null;};}function removeEntity(_0x54e7d4,_0x466660){return function(_0x5611b6){if(_0x5611b6){return _0x5611b6[_0x8e49('0x2e')]()[_0x8e49('0x2d')](function(){var _0x4bf2e2=_0x5611b6[_0x8e49('0x2f')]({'plain':!![]});var _0x359085=_0x8e49('0x30');return db[_0x8e49('0x31')][_0x8e49('0x2e')]({'where':{'type':_0x359085,'resourceId':_0x4bf2e2['id']}})[_0x8e49('0x2d')](function(){return _0x5611b6;});})['then'](function(){_0x54e7d4[_0x8e49('0x20')](0xcc)[_0x8e49('0x21')]();});}};}function handleEntityNotFound(_0x15b2e7,_0x11c42e){return function(_0x46ff21){if(!_0x46ff21){_0x15b2e7[_0x8e49('0x1f')](0x194);}return _0x46ff21;};}function handleError(_0x445ada,_0x5d041b){_0x5d041b=_0x5d041b||0x1f4;return function(_0x3f48d4){logger[_0x8e49('0x32')](_0x3f48d4[_0x8e49('0x33')]);if(_0x3f48d4[_0x8e49('0x34')]){delete _0x3f48d4['name'];}_0x445ada[_0x8e49('0x20')](_0x5d041b)[_0x8e49('0x35')](_0x3f48d4);};}exports[_0x8e49('0x36')]=function(_0x56a119,_0x199aa9){var _0x31825b={},_0x4e8636={},_0x455ee1={'count':0x0,'rows':[]};var _0x17b39b=_[_0x8e49('0x37')](db[_0x8e49('0x38')][_0x8e49('0x39')],function(_0x34031a){return{'name':_0x34031a[_0x8e49('0x3a')],'type':_0x34031a[_0x8e49('0x3b')][_0x8e49('0x3c')]};});_0x4e8636[_0x8e49('0x3d')]=_['map'](_0x17b39b,'name');_0x4e8636[_0x8e49('0x3e')]=_[_0x8e49('0x3f')](_0x56a119['query']);_0x4e8636['filters']=_['intersection'](_0x4e8636['model'],_0x4e8636['query']);_0x31825b['attributes']=_[_0x8e49('0x40')](_0x4e8636[_0x8e49('0x3d')],qs[_0x8e49('0x41')](_0x56a119['query'][_0x8e49('0x41')]));_0x31825b[_0x8e49('0x42')]=_0x31825b[_0x8e49('0x42')][_0x8e49('0x43')]?_0x31825b[_0x8e49('0x42')]:_0x4e8636['model'];if(!_0x56a119[_0x8e49('0x3e')][_0x8e49('0x44')]('nolimit')){_0x31825b[_0x8e49('0x24')]=qs[_0x8e49('0x24')](_0x56a119[_0x8e49('0x3e')]['limit']);_0x31825b[_0x8e49('0x26')]=qs['offset'](_0x56a119[_0x8e49('0x3e')][_0x8e49('0x26')]);}_0x31825b['order']=qs[_0x8e49('0x45')](_0x56a119[_0x8e49('0x3e')][_0x8e49('0x45')]);_0x31825b[_0x8e49('0x46')]=qs[_0x8e49('0x47')](_[_0x8e49('0x48')](_0x56a119[_0x8e49('0x3e')],_0x4e8636['filters']),_0x17b39b);if(_0x56a119[_0x8e49('0x3e')][_0x8e49('0x49')]){_0x31825b[_0x8e49('0x46')]=_[_0x8e49('0x4a')](_0x31825b[_0x8e49('0x46')],{'$or':_[_0x8e49('0x37')](_0x17b39b,function(_0x58589f){if(_0x58589f[_0x8e49('0x3b')]!==_0x8e49('0x4b')){var _0x43ec9e={};_0x43ec9e[_0x58589f[_0x8e49('0x34')]]={'$like':'%'+_0x56a119[_0x8e49('0x3e')][_0x8e49('0x49')]+'%'};return _0x43ec9e;}})});}_0x31825b=_[_0x8e49('0x4a')]({},_0x31825b,_0x56a119[_0x8e49('0x4c')]);var _0x563a68={'where':_0x31825b[_0x8e49('0x46')]};return db[_0x8e49('0x38')][_0x8e49('0x25')](_0x563a68)[_0x8e49('0x2d')](function(_0x139854){_0x455ee1[_0x8e49('0x25')]=_0x139854;if(_0x56a119[_0x8e49('0x3e')][_0x8e49('0x4d')]){_0x31825b[_0x8e49('0x4e')]=[{'all':!![]}];}return db[_0x8e49('0x38')][_0x8e49('0x4f')](_0x31825b);})[_0x8e49('0x2d')](function(_0x1b7141){_0x455ee1[_0x8e49('0x50')]=_0x1b7141;return _0x455ee1;})['then'](respondWithFilteredResult(_0x199aa9,_0x31825b))['catch'](handleError(_0x199aa9,null));};exports['show']=function(_0x17ade0,_0x49df15){var _0x190096={'raw':!![],'where':{'id':_0x17ade0[_0x8e49('0x51')]['id']}},_0x170fc0={};_0x170fc0[_0x8e49('0x3d')]=_['keys'](db[_0x8e49('0x38')][_0x8e49('0x39')]);_0x170fc0['query']=_[_0x8e49('0x3f')](_0x17ade0[_0x8e49('0x3e')]);_0x170fc0[_0x8e49('0x47')]=_[_0x8e49('0x40')](_0x170fc0[_0x8e49('0x3d')],_0x170fc0['query']);_0x190096[_0x8e49('0x42')]=_[_0x8e49('0x40')](_0x170fc0[_0x8e49('0x3d')],qs['fields'](_0x17ade0['query'][_0x8e49('0x41')]));_0x190096[_0x8e49('0x42')]=_0x190096[_0x8e49('0x42')][_0x8e49('0x43')]?_0x190096[_0x8e49('0x42')]:_0x170fc0['model'];if(_0x17ade0[_0x8e49('0x3e')][_0x8e49('0x4d')]){_0x190096[_0x8e49('0x4e')]=[{'all':!![]}];}_0x190096=_[_0x8e49('0x4a')]({},_0x190096,_0x17ade0['options']);return db[_0x8e49('0x38')][_0x8e49('0x52')](_0x190096)[_0x8e49('0x2d')](handleEntityNotFound(_0x49df15,null))['then'](respondWithResult(_0x49df15,null))[_0x8e49('0x53')](handleError(_0x49df15,null));};exports[_0x8e49('0x54')]=function(_0x18de30,_0x95ccde,_0x452ad0){return db['Plugin'][_0x8e49('0x52')]({'where':{'id':_0x18de30[_0x8e49('0x51')]['id']},'attributes':[_0x8e49('0x34'),_0x8e49('0x8')],'raw':!![]})[_0x8e49('0x2d')](handleEntityNotFound(_0x95ccde,null))[_0x8e49('0x2d')](function(_0x2e11f3){if(_0x2e11f3){var _0x2d2a7d=path[_0x8e49('0x55')](config[_0x8e49('0x56')],'server/files/plugins',util['format']('%s.zip',path['basename'](_0x2e11f3['path'])));var _0x4d56e9=fs[_0x8e49('0x57')](_0x2d2a7d);var _0x5079ac=archiver(_0x8e49('0x58'),{'zlib':{'level':0x9}});_0x5079ac['on'](_0x8e49('0x59'),function(_0x16e8d4){if(_0x16e8d4['code']===_0x8e49('0x5a')){logger[_0x8e49('0x32')](_0x16e8d4);}else{throw new db[(_0x8e49('0x5b'))][(_0x8e49('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x5079ac['on'](_0x8e49('0x32'),function(_0x10610c){throw new db[(_0x8e49('0x5b'))][(_0x8e49('0x5c'))](_0x8e49('0x5d'));});_0x5079ac[_0x8e49('0x5e')](_0x4d56e9);_0x5079ac[_0x8e49('0x5f')]('**/*',{'cwd':path[_0x8e49('0x55')](config['root'],_0x8e49('0x60'),path[_0x8e49('0x61')](_0x2e11f3[_0x8e49('0x8')])),'ignore':[path[_0x8e49('0x55')](path[_0x8e49('0x62')](_0x2e11f3[_0x8e49('0x8')]),_0x8e49('0x63')),path[_0x8e49('0x55')](path[_0x8e49('0x62')](_0x2e11f3['path']),_0x8e49('0x64'))],'nodir':!![]})[_0x8e49('0x65')]();_0x4d56e9['on'](_0x8e49('0x66'),function(){if(!fs[_0x8e49('0x67')](_0x2d2a7d)){throw new db[(_0x8e49('0x5b'))][(_0x8e49('0x5c'))](_0x8e49('0x68'));}return _0x95ccde[_0x8e49('0x54')](_0x2d2a7d,util[_0x8e49('0x69')](_0x8e49('0x6a'),path[_0x8e49('0x62')](_0x2e11f3['path'])),function(_0x1c4452){if(_0x1c4452){throw new db[(_0x8e49('0x5b'))][(_0x8e49('0x5c'))](_0x8e49('0x6b'));}fs[_0x8e49('0x6c')](_0x2d2a7d);logger[_0x8e49('0x6d')](_0x8e49('0x6e'));logger[_0x8e49('0x6d')](_0x8e49('0x6f'));});});}return null;})[_0x8e49('0x53')](handleError(_0x95ccde,null));};exports[_0x8e49('0x70')]=function(_0x10a414,_0x31e0d6,_0x34b4c2){var _0x3d0198=path['basename'](_0x10a414['file'][_0x8e49('0x71')],path[_0x8e49('0x72')](_0x10a414[_0x8e49('0x73')][_0x8e49('0x71')]));var _0x349c6d=path[_0x8e49('0x55')](config[_0x8e49('0x56')],_0x8e49('0x60'),_0x10a414[_0x8e49('0x73')][_0x8e49('0x71')]);var _0x2f7c77=path[_0x8e49('0x55')](config['root'],_0x8e49('0x60'),_0x3d0198);logger[_0x8e49('0x6d')](_0x8e49('0x74'),_0x349c6d);logger['info'](_0x8e49('0x75'),_0x2f7c77);try{fs[_0x8e49('0x76')](_0x349c6d,parseInt(_0x8e49('0x77'),0x8));extract(_0x349c6d,{'dir':_0x2f7c77},function(_0x48343b){if(_0x48343b){logger[_0x8e49('0x32')](_0x48343b);handleError(_0x48343b,!![]);};var _0x16fffd=fs['readdirSync'](_0x2f7c77);if(_0x16fffd[_0x8e49('0x43')]>0x1){removeReferences(_0x349c6d,_0x2f7c77);logger[_0x8e49('0x32')](_0x8e49('0x78'));return _0x34b4c2(new Error(_0x8e49('0x78')));}var _0x7a0805=fs[_0x8e49('0x79')](path[_0x8e49('0x55')](_0x2f7c77,_0x16fffd[0x0]));if(_0x7a0805['isFile']()){removeReferences(_0x349c6d,_0x2f7c77);logger[_0x8e49('0x32')](_0x8e49('0x78'));return _0x34b4c2(new Error('Invalid\x20plugin\x20structure'));}if(_0x7a0805[_0x8e49('0x7a')]()){var _0x4bea4a=fs[_0x8e49('0x7b')](path[_0x8e49('0x55')](_0x2f7c77,_0x16fffd[0x0]));if(_0x4bea4a[_0x8e49('0x43')]===0x0){removeReferences(_0x349c6d,_0x2f7c77);logger[_0x8e49('0x32')](_0x8e49('0x78'));return _0x34b4c2(new Error(_0x8e49('0x78')));}var _0x5d1104=_0x4bea4a[_0x8e49('0x7c')](function(_0x46d487){return _0x46d487===_0x8e49('0x7d');});if(!_0x5d1104){return _0x34b4c2(new Error(_0x8e49('0x7e')));}var _0x575be2=fs[_0x8e49('0x7f')](path['join'](_0x2f7c77,_0x16fffd[0x0],_0x8e49('0x7d')));var _0x3f9455=JSON[_0x8e49('0x80')](_0x575be2);if(_0x8e49('0x23')==typeof _0x3f9455[_0x8e49('0x34')]){return _0x34b4c2(new Error(_0x8e49('0x81')));}if(_0x8e49('0x23')==typeof _0x3f9455[_0x8e49('0x3b')]){return _0x34b4c2(new Error(_0x8e49('0x82')));}if('undefined'==typeof _0x3f9455['version']){return _0x34b4c2(new Error(_0x8e49('0x83')));}if(_0x8e49('0x23')==typeof _0x3f9455[_0x8e49('0x84')]){return _0x34b4c2(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3f9455[_0x8e49('0x3b')]===_0x8e49('0x85')){if(_0x8e49('0x23')==typeof _0x3f9455[_0x8e49('0x84')][_0x8e49('0x86')]){return _0x34b4c2(new Error(_0x8e49('0x87')));}if('undefined'==typeof _0x3f9455[_0x8e49('0x84')][_0x8e49('0x86')][_0x8e49('0x88')]&&'undefined'==typeof _0x3f9455[_0x8e49('0x84')][_0x8e49('0x86')][_0x8e49('0x89')]){return _0x34b4c2(new Error(_0x8e49('0x8a')));}}else if(_0x3f9455['type']===_0x8e49('0x8b')){if('undefined'==typeof _0x3f9455['parameters'][_0x8e49('0x8c')]){return _0x34b4c2(new Error(_0x8e49('0x8d')));}if('undefined'==typeof _0x3f9455[_0x8e49('0x84')][_0x8e49('0x8e')]){return _0x34b4c2(new Error(_0x8e49('0x8f')));}}else{return _0x34b4c2(new Error(_0x8e49('0x90')));}var _0x430091=_0x3f9455['name'];var _0x283e04=_0x3f9455[_0x8e49('0x91')];var _0x59d32f=_0x3f9455[_0x8e49('0x3b')];var _0x2be238=_0x3f9455[_0x8e49('0x92')]?_0x3f9455[_0x8e49('0x92')]:_0x8e49('0x93');var _0x2d9c08=_0x3f9455[_0x8e49('0x94')]?_0x3f9455[_0x8e49('0x94')]:'icon-apps';var _0x39f84a='';var _0x3dd005='';var _0x5dbc06='';var _0x52d9a7='';var _0x419f8c=_0x3f9455[_0x8e49('0x95')];if(_0x59d32f==='html'){if('undefined'!=typeof _0x3f9455['parameters']['views'][_0x8e49('0x88')]){var _0x1684bc=_0x3f9455[_0x8e49('0x84')][_0x8e49('0x86')][_0x8e49('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x8e49('0x96')](_0x1684bc)){_0x39f84a=path[_0x8e49('0x55')](_0x8e49('0x97'),_0x3d0198,_0x16fffd[0x0],_0x1684bc);}else{_0x39f84a=_0x1684bc;}}else{logger[_0x8e49('0x6d')](_0x8e49('0x98'));}if(_0x8e49('0x23')!=typeof _0x3f9455[_0x8e49('0x84')][_0x8e49('0x86')]['agent']){var _0x2c7fea=_0x3f9455[_0x8e49('0x84')][_0x8e49('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x8e49('0x96')](_0x2c7fea)){_0x3dd005=path['join']('plugins',_0x3d0198,_0x16fffd[0x0],_0x2c7fea);}else{_0x3dd005=_0x2c7fea;}}else{logger[_0x8e49('0x6d')](_0x8e49('0x99'));}}else if(_0x59d32f==='script'){_0x5dbc06=_0x3f9455[_0x8e49('0x84')][_0x8e49('0x8c')];_0x52d9a7=_0x3f9455[_0x8e49('0x84')]['scriptPath'];if('undefined'!=typeof _0x3f9455[_0x8e49('0x84')]['views']){if('undefined'!=typeof _0x3f9455['parameters'][_0x8e49('0x86')][_0x8e49('0x88')]){var _0x1684bc=_0x3f9455[_0x8e49('0x84')]['views'][_0x8e49('0x88')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1684bc)){_0x39f84a=path['join'](_0x8e49('0x97'),_0x3d0198,_0x16fffd[0x0],_0x1684bc);}else{_0x39f84a=_0x1684bc;}}if(_0x8e49('0x23')!=typeof _0x3f9455['parameters'][_0x8e49('0x86')][_0x8e49('0x89')]){var _0x2c7fea=_0x3f9455[_0x8e49('0x84')]['views'][_0x8e49('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x8e49('0x96')](_0x2c7fea)){_0x3dd005=path['join'](_0x8e49('0x97'),_0x3d0198,_0x16fffd[0x0],_0x2c7fea);}else{_0x3dd005=_0x2c7fea;}}}}var _0xdb8df2={'name':_0x430091,'description':_0x283e04,'path':path[_0x8e49('0x55')](_0x3d0198,_0x16fffd[0x0]),'type':_0x59d32f,'sidebar':_0x2be238,'icon':_0x2d9c08,'adminUrl':_0x39f84a,'agentUrl':_0x3dd005,'scriptName':_0x5dbc06,'scriptPath':_0x52d9a7,'version':_0x419f8c};removeReferences(_0x349c6d,null);return db[_0x8e49('0x38')][_0x8e49('0x9a')](_0xdb8df2)['then'](function(_0x303335){var _0x38d81a={'role':_0x10a414[_0x8e49('0x9b')][_0x8e49('0x9c')],'userProfileId':_0x10a414[_0x8e49('0x9b')]['userProfileId']};if(!_0x38d81a)throw new Error(_0x8e49('0x9d'));if(_0x38d81a['role']===_0x8e49('0x9e')){var _0x49222c=_0x303335[_0x8e49('0x2f')]({'plain':!![]});return db[_0x8e49('0x9f')][_0x8e49('0x52')]({'where':{'name':_0x8e49('0x30'),'userProfileId':_0x38d81a['userProfileId']},'raw':!![]})[_0x8e49('0x2d')](function(_0x45081d){if(_0x45081d&&_0x45081d[_0x8e49('0xa0')]===0x0){return db[_0x8e49('0x31')][_0x8e49('0x9a')]({'name':_0x49222c[_0x8e49('0x34')],'resourceId':_0x49222c['id'],'type':_0x45081d[_0x8e49('0x34')],'sectionId':_0x45081d['id']},{})['then'](function(){return _0x303335;});}else{return _0x303335;}})[_0x8e49('0x53')](function(_0x4b1b92){logger[_0x8e49('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1b92);throw _0x4b1b92;});}return _0x303335;})['then'](respondWithResult(_0x31e0d6,null))['catch'](handleError(_0x31e0d6,null));}});}catch(_0x206432){_0x31e0d6[_0x8e49('0x20')](0x1f4)['send'](_0x206432);}};function removeReferences(_0x1ad24f,_0x149415){try{if(_0x1ad24f){fs[_0x8e49('0x6c')](_0x1ad24f);logger[_0x8e49('0x6d')]('Zip\x20archive\x20removed');}if(_0x149415){rimraf(_0x149415,function(){});logger[_0x8e49('0x6d')]('Extracted\x20folder\x20removed');}}catch(_0x187002){logger[_0x8e49('0x32')](_0x187002);}}exports[_0x8e49('0x2c')]=function(_0xa2b36e,_0x3f8a18,_0x54229a){return db[_0x8e49('0x38')][_0x8e49('0x52')]({'where':{'id':_0xa2b36e['params']['id']}})[_0x8e49('0x2d')](handleEntityNotFound(_0x3f8a18,null))[_0x8e49('0x2d')](saveUpdates(_0xa2b36e['body'],null))[_0x8e49('0x2d')](respondWithResult(_0x3f8a18,null))[_0x8e49('0x53')](handleError(_0x3f8a18,null));};exports['delete']=function(_0x2d2d0a,_0x200f52,_0x1f779a){return db[_0x8e49('0x38')][_0x8e49('0x52')]({'where':{'id':_0x2d2d0a['params']['id']}})[_0x8e49('0x2d')](function(_0xe58168){if(_0xe58168){return _0xe58168['destroy']();}})[_0x8e49('0x2d')](function(_0x3769fd){rimraf(path[_0x8e49('0x55')](config[_0x8e49('0x56')],_0x8e49('0x60'),path['dirname'](_0x3769fd[_0x8e49('0x8')])),function(){});return _0x3769fd;})['then'](handleEntityNotFound(_0x200f52,null))['then'](respondWithStatusCode(_0x200f52,null))[_0x8e49('0x53')](handleError(_0x200f52,null));};exports['webhookGet']=function(_0x35ee8a,_0x39f886,_0x5f2ddc){return BPromise[_0x8e49('0xa1')]()[_0x8e49('0x2d')](function(){if(!_0x35ee8a['query'][_0x8e49('0x8')]){throw new Error(_0x8e49('0xa2'));}if(!_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0xa3')]){throw new Error(_0x8e49('0xa4'));}var _0x248c66=_0x35ee8a['query'][_0x8e49('0xa5')]?_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0xa5')]+':'+_0x35ee8a['query'][_0x8e49('0xa3')]:_0x8e49('0xa6')+_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0xa3')];var _0x54d6f8=_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0x22')]?_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0x22')]:!![];var _0x482153=_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0xa7')]?_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0xa7')]:null;var _0x2ecbac={'method':_0x35ee8a[_0x8e49('0xa8')],'uri':util[_0x8e49('0x69')]('%s%s',_0x248c66,_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0x8')]),'json':_0x54d6f8,'resolveWithFullResponse':!![],'encoding':_0x482153,'qs':_0x35ee8a[_0x8e49('0x3e')]};if(_0x35ee8a[_0x8e49('0xa9')]){_0x2ecbac['headers']=_0x35ee8a[_0x8e49('0xa9')];if(_0x2ecbac[_0x8e49('0xa9')][_0x8e49('0xaa')]){delete _0x2ecbac[_0x8e49('0xa9')][_0x8e49('0xaa')];}}if(_0x2ecbac[_0x8e49('0xa9')][_0x8e49('0xab')]){delete _0x2ecbac['headers'][_0x8e49('0xab')];}return rp(_0x2ecbac);})[_0x8e49('0x2d')](function(_0x4e49cc){if(_0x4e49cc){_0x39f886['set'](_0x4e49cc[_0x8e49('0xa9')]);logger[_0x8e49('0x6d')](_0x4e49cc[_0x8e49('0x9b')]);if(_[_0x8e49('0xac')](_0x35ee8a[_0x8e49('0x3e')][_0x8e49('0x8')],_0x8e49('0x54'))&&_0x4e49cc['statusCode']==0x1f4){return _0x39f886[_0x8e49('0x1f')](_0x4e49cc['statusCode']);}else{return _0x39f886[_0x8e49('0x20')](_0x4e49cc[_0x8e49('0xad')])[_0x8e49('0x35')](_0x4e49cc['body']);}}else{return _0x39f886[_0x8e49('0x1f')](0xc8);}})[_0x8e49('0x53')](handleError(_0x39f886,null));};exports['webhookPost']=function(_0x4d72bb,_0x58ca3a,_0x44fbe2){return BPromise['resolve']()[_0x8e49('0x2d')](function(){if(!_0x4d72bb['query'][_0x8e49('0x8')]){throw new Error(_0x8e49('0xa2'));}if(!_0x4d72bb['query'][_0x8e49('0xa3')]){throw new Error(_0x8e49('0xa4'));}var _0x4a8172=_0x4d72bb[_0x8e49('0x3e')][_0x8e49('0xa5')]?_0x4d72bb[_0x8e49('0x3e')]['hostname']+':'+_0x4d72bb['query'][_0x8e49('0xa3')]:_0x8e49('0xa6')+_0x4d72bb[_0x8e49('0x3e')]['port'];var _0x22d08a=_0x4d72bb[_0x8e49('0x3e')][_0x8e49('0x22')]?_0x4d72bb['query'][_0x8e49('0x22')]:!![];var _0x531c3d=_0x4d72bb[_0x8e49('0x3e')][_0x8e49('0xa7')]?_0x4d72bb['query']['encoding']:null;var _0x24e113={'method':_0x4d72bb['method'],'uri':util[_0x8e49('0x69')]('%s%s',_0x4a8172,_0x4d72bb[_0x8e49('0x3e')][_0x8e49('0x8')]),'json':_0x22d08a,'resolveWithFullResponse':!![],'encoding':_0x531c3d,'body':_0x4d72bb[_0x8e49('0x9b')]};if(_0x4d72bb[_0x8e49('0xa9')]){_0x24e113['headers']=_0x4d72bb[_0x8e49('0xa9')];if(_0x24e113[_0x8e49('0xa9')]['content-length']){delete _0x24e113[_0x8e49('0xa9')]['content-length'];}}if(_0x24e113['headers']['content-type']){delete _0x24e113[_0x8e49('0xa9')][_0x8e49('0xab')];}return rp(_0x24e113);})[_0x8e49('0x2d')](function(_0x4d25d1){if(_0x4d25d1){_0x58ca3a['set'](_0x4d25d1[_0x8e49('0xa9')]);logger['info'](_0x4d25d1[_0x8e49('0x9b')]);return _0x58ca3a[_0x8e49('0x20')](_0x4d25d1[_0x8e49('0xad')])[_0x8e49('0x35')](_0x4d25d1[_0x8e49('0x9b')]);}else{return _0x58ca3a['sendStatus'](0xc8);}})[_0x8e49('0x53')](handleError(_0x58ca3a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index beae740..588a5a7 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 _0xadf0=['save','update','remove','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x2bb07d,_0x311fe5){var _0xa6660c=function(_0x1ed6d3){while(--_0x1ed6d3){_0x2bb07d['push'](_0x2bb07d['shift']());}};_0xa6660c(++_0x311fe5);}(_0xadf0,0x12d));var _0x0adf=function(_0x5a93e6,_0xed0d78){_0x5a93e6=_0x5a93e6-0x0;var _0x324f66=_0xadf0[_0x5a93e6];return _0x324f66;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x0adf('0x0'))['db'][_0x0adf('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x0adf('0x2')](0x0);var events={'afterCreate':_0x0adf('0x3'),'afterUpdate':_0x0adf('0x4'),'afterDestroy':_0x0adf('0x5')};function emitEvent(_0x911855){return function(_0x4b4b16,_0xb48987,_0x567ca2){PluginEvents['emit'](_0x911855+':'+_0x4b4b16['id'],_0x4b4b16);PluginEvents['emit'](_0x911855,_0x4b4b16);_0x567ca2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x0adf('0x6')](e,emitEvent(event));}}module[_0x0adf('0x7')]=PluginEvents; \ No newline at end of file +var _0x9a6b=['../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xf08837,_0x3e2c65){var _0x462cb3=function(_0x5451f8){while(--_0x5451f8){_0xf08837['push'](_0xf08837['shift']());}};_0x462cb3(++_0x3e2c65);}(_0x9a6b,0x77));var _0xb9a6=function(_0x29e846,_0x39c665){_0x29e846=_0x29e846-0x0;var _0x270e5c=_0x9a6b[_0x29e846];return _0x270e5c;};'use strict';var EventEmitter=require(_0xb9a6('0x0'));var Plugin=require(_0xb9a6('0x1'))['db'][_0xb9a6('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xb9a6('0x3')](0x0);var events={'afterCreate':_0xb9a6('0x4'),'afterUpdate':_0xb9a6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x24b4ed){return function(_0x4f9462,_0x1cb7b4,_0x6077e){PluginEvents[_0xb9a6('0x6')](_0x24b4ed+':'+_0x4f9462['id'],_0x4f9462);PluginEvents[_0xb9a6('0x6')](_0x24b4ed,_0x4f9462);_0x6077e(null);};}for(var e in events){if(events[_0xb9a6('0x7')](e)){var event=events[e];Plugin[_0xb9a6('0x8')](e,emitEvent(event));}}module[_0xb9a6('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4511517..b4208b0 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 _0x5410=['../../config/environment','./plugin.attributes','define','Plugin','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x491220,_0xb4cdc7){var _0x34a153=function(_0x4ef8d9){while(--_0x4ef8d9){_0x491220['push'](_0x491220['shift']());}};_0x34a153(++_0xb4cdc7);}(_0x5410,0xa0));var _0x0541=function(_0x5518eb,_0x26bcdf){_0x5518eb=_0x5518eb-0x0;var _0x3e5efd=_0x5410[_0x5518eb];return _0x3e5efd;};'use strict';var _=require('lodash');var util=require(_0x0541('0x0'));var logger=require(_0x0541('0x1'))(_0x0541('0x2'));var moment=require(_0x0541('0x3'));var BPromise=require(_0x0541('0x4'));var rp=require(_0x0541('0x5'));var fs=require('fs');var path=require(_0x0541('0x6'));var rimraf=require(_0x0541('0x7'));var config=require(_0x0541('0x8'));var attributes=require(_0x0541('0x9'));module['exports']=function(_0x19e8e5,_0x3a199b){return _0x19e8e5[_0x0541('0xa')](_0x0541('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8cc=['api','moment','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0xca7b4a,_0x368e12){var _0x1b54d3=function(_0x2699c3){while(--_0x2699c3){_0xca7b4a['push'](_0xca7b4a['shift']());}};_0x1b54d3(++_0x368e12);}(_0xf8cc,0x189));var _0xcf8c=function(_0x44f7eb,_0x29a2d4){_0x44f7eb=_0x44f7eb-0x0;var _0x5a36cb=_0xf8cc[_0x44f7eb];return _0x5a36cb;};'use strict';var _=require(_0xcf8c('0x0'));var util=require(_0xcf8c('0x1'));var logger=require(_0xcf8c('0x2'))(_0xcf8c('0x3'));var moment=require(_0xcf8c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf8c('0x5'));var rimraf=require(_0xcf8c('0x6'));var config=require(_0xcf8c('0x7'));var attributes=require(_0xcf8c('0x8'));module['exports']=function(_0x45951a,_0x594991){return _0x45951a[_0xcf8c('0x9')](_0xcf8c('0xa'),attributes,{'tableName':_0xcf8c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index c837732..0510069 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 _0xf056=['register','request','then','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','create','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket'];(function(_0x4821ad,_0x2f2805){var _0x403d28=function(_0x11d816){while(--_0x11d816){_0x4821ad['push'](_0x4821ad['shift']());}};_0x403d28(++_0x2f2805);}(_0xf056,0x186));var _0x6f05=function(_0x23dd95,_0x21623a){_0x23dd95=_0x23dd95-0x0;var _0x187fd2=_0xf056[_0x23dd95];return _0x187fd2;};'use strict';var _=require(_0x6f05('0x0'));var util=require(_0x6f05('0x1'));var moment=require(_0x6f05('0x2'));var BPromise=require(_0x6f05('0x3'));var rs=require(_0x6f05('0x4'));var fs=require('fs');var Redis=require(_0x6f05('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f05('0x6'));var logger=require(_0x6f05('0x7'))(_0x6f05('0x8'));var config=require(_0x6f05('0x9'));var jayson=require(_0x6f05('0xa'));var client=jayson[_0x6f05('0xb')][_0x6f05('0xc')]({'port':0x232a});config[_0x6f05('0xd')]=_[_0x6f05('0xe')](config['redis'],{'host':_0x6f05('0xf'),'port':0x18eb});var socket=require(_0x6f05('0x10'))(new Redis(config[_0x6f05('0xd')]));require(_0x6f05('0x11'))[_0x6f05('0x12')](socket);function respondWithRpcPromise(_0x99429f,_0x598d59,_0x2c6377){return new BPromise(function(_0x5a4bc2,_0x1a9396){return client[_0x6f05('0x13')](_0x99429f,_0x2c6377)[_0x6f05('0x14')](function(_0x59e8ba){logger[_0x6f05('0x15')](_0x6f05('0x16'),_0x598d59,'request\x20sent');logger[_0x6f05('0x17')]('Plugin,\x20%s,\x20%s,\x20%s',_0x598d59,_0x6f05('0x18'),JSON[_0x6f05('0x19')](_0x59e8ba));if(_0x59e8ba['error']){if(_0x59e8ba[_0x6f05('0x1a')][_0x6f05('0x1b')]===0x1f4){logger[_0x6f05('0x1a')]('Plugin,\x20%s,\x20%s',_0x598d59,_0x59e8ba['error'][_0x6f05('0x1c')]);return _0x1a9396(_0x59e8ba['error'][_0x6f05('0x1c')]);}logger[_0x6f05('0x1a')](_0x6f05('0x16'),_0x598d59,_0x59e8ba[_0x6f05('0x1a')][_0x6f05('0x1c')]);return _0x5a4bc2(_0x59e8ba['error'][_0x6f05('0x1c')]);}else{logger[_0x6f05('0x15')](_0x6f05('0x16'),_0x598d59,_0x6f05('0x18'));_0x5a4bc2(_0x59e8ba[_0x6f05('0x1d')][_0x6f05('0x1c')]);}})['catch'](function(_0x2fde5e){logger[_0x6f05('0x1a')](_0x6f05('0x16'),_0x598d59,_0x2fde5e);_0x1a9396(_0x2fde5e);});});}exports['CreatePlugin']=function(_0x3f3c59){var _0x36b5dc=this;return new Promise(function(_0x1eea5b,_0x268340){return db['Plugin'][_0x6f05('0x1e')](_0x3f3c59['body'],{'raw':_0x3f3c59[_0x6f05('0x1f')]?_0x3f3c59[_0x6f05('0x1f')][_0x6f05('0x20')]===undefined?!![]:![]:!![]})[_0x6f05('0x14')](function(_0x46f39e){logger[_0x6f05('0x15')](_0x6f05('0x21'),_0x3f3c59);logger['debug'](_0x6f05('0x21'),_0x3f3c59,JSON['stringify'](_0x46f39e));_0x1eea5b(_0x46f39e);})['catch'](function(_0x4c835b){logger[_0x6f05('0x1a')]('CreatePlugin',_0x4c835b[_0x6f05('0x1c')],_0x3f3c59);_0x268340(_0x36b5dc[_0x6f05('0x1a')](0x1f4,_0x4c835b[_0x6f05('0x1c')]));});});}; \ No newline at end of file +var _0x3086=['lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','body','raw'];(function(_0x2c35c4,_0xecba5b){var _0xa60269=function(_0x38dd8a){while(--_0x38dd8a){_0x2c35c4['push'](_0x2c35c4['shift']());}};_0xa60269(++_0xecba5b);}(_0x3086,0x1d1));var _0x6308=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x3086[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x6308('0x0'));var util=require(_0x6308('0x1'));var moment=require(_0x6308('0x2'));var BPromise=require(_0x6308('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6308('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6308('0x5'))(_0x6308('0x6'));var config=require('../../config/environment');var jayson=require(_0x6308('0x7'));var client=jayson['client'][_0x6308('0x8')]({'port':0x232a});config[_0x6308('0x9')]=_[_0x6308('0xa')](config[_0x6308('0x9')],{'host':_0x6308('0xb'),'port':0x18eb});var socket=require(_0x6308('0xc'))(new Redis(config[_0x6308('0x9')]));require(_0x6308('0xd'))[_0x6308('0xe')](socket);function respondWithRpcPromise(_0x123b93,_0xe773ac,_0x15d2c1){return new BPromise(function(_0x4f5d12,_0x49bc1d){return client['request'](_0x123b93,_0x15d2c1)[_0x6308('0xf')](function(_0x4c7d59){logger[_0x6308('0x10')](_0x6308('0x11'),_0xe773ac,_0x6308('0x12'));logger[_0x6308('0x13')](_0x6308('0x14'),_0xe773ac,_0x6308('0x12'),JSON[_0x6308('0x15')](_0x4c7d59));if(_0x4c7d59[_0x6308('0x16')]){if(_0x4c7d59[_0x6308('0x16')][_0x6308('0x17')]===0x1f4){logger[_0x6308('0x16')]('Plugin,\x20%s,\x20%s',_0xe773ac,_0x4c7d59[_0x6308('0x16')][_0x6308('0x18')]);return _0x49bc1d(_0x4c7d59[_0x6308('0x16')]['message']);}logger[_0x6308('0x16')](_0x6308('0x11'),_0xe773ac,_0x4c7d59['error'][_0x6308('0x18')]);return _0x4f5d12(_0x4c7d59[_0x6308('0x16')][_0x6308('0x18')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0xe773ac,_0x6308('0x12'));_0x4f5d12(_0x4c7d59[_0x6308('0x19')][_0x6308('0x18')]);}})[_0x6308('0x1a')](function(_0x553bfa){logger['error'](_0x6308('0x11'),_0xe773ac,_0x553bfa);_0x49bc1d(_0x553bfa);});});}exports[_0x6308('0x1b')]=function(_0x53a05c){var _0x35f031=this;return new Promise(function(_0x42d318,_0x2c6760){return db['Plugin'][_0x6308('0x1c')](_0x53a05c[_0x6308('0x1d')],{'raw':_0x53a05c['options']?_0x53a05c['options'][_0x6308('0x1e')]===undefined?!![]:![]:!![]})[_0x6308('0xf')](function(_0xb880c8){logger[_0x6308('0x10')]('CreatePlugin',_0x53a05c);logger[_0x6308('0x13')]('CreatePlugin',_0x53a05c,JSON['stringify'](_0xb880c8));_0x42d318(_0xb880c8);})['catch'](function(_0x5e3fec){logger[_0x6308('0x16')](_0x6308('0x1b'),_0x5e3fec[_0x6308('0x18')],_0x53a05c);_0x2c6760(_0x35f031['error'](0x1f4,_0x5e3fec[_0x6308('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5524d43..68dfd4d 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 _0xbd0e=['update','emit','removeListener','length','plugin:','./plugin.events','save','remove'];(function(_0x328b9b,_0x13082a){var _0x3a2d51=function(_0x63002b){while(--_0x63002b){_0x328b9b['push'](_0x328b9b['shift']());}};_0x3a2d51(++_0x13082a);}(_0xbd0e,0x10d));var _0xebd0=function(_0x1715a2,_0x13d1d3){_0x1715a2=_0x1715a2-0x0;var _0x447fc1=_0xbd0e[_0x1715a2];return _0x447fc1;};'use strict';var PluginEvents=require(_0xebd0('0x0'));var events=[_0xebd0('0x1'),_0xebd0('0x2'),_0xebd0('0x3')];function createListener(_0x49ab2a,_0x12fe6c){return function(_0x2c2a0a){_0x12fe6c[_0xebd0('0x4')](_0x49ab2a,_0x2c2a0a);};}function removeListener(_0x3cbefe,_0x5dba12){return function(){PluginEvents[_0xebd0('0x5')](_0x3cbefe,_0x5dba12);};}exports['register']=function(_0x24e19c){for(var _0x3f80cd=0x0,_0x496e03=events[_0xebd0('0x6')];_0x3f80cd<_0x496e03;_0x3f80cd++){var _0x248140=events[_0x3f80cd];var _0x5d2005=createListener(_0xebd0('0x7')+_0x248140,_0x24e19c);PluginEvents['on'](_0x248140,_0x5d2005);}}; \ No newline at end of file +var _0x9fb5=['./plugin.events','save','remove','removeListener','register','length','plugin:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fb5,0x181));var _0x59fb=function(_0x5b231f,_0x3fbfdb){_0x5b231f=_0x5b231f-0x0;var _0x5f2372=_0x9fb5[_0x5b231f];return _0x5f2372;};'use strict';var PluginEvents=require(_0x59fb('0x0'));var events=[_0x59fb('0x1'),_0x59fb('0x2'),'update'];function createListener(_0x4397cf,_0x132792){return function(_0x411dd1){_0x132792['emit'](_0x4397cf,_0x411dd1);};}function removeListener(_0x37fcbd,_0x20c81d){return function(){PluginEvents[_0x59fb('0x3')](_0x37fcbd,_0x20c81d);};}exports[_0x59fb('0x4')]=function(_0x58e951){for(var _0x172c12=0x0,_0x134bec=events[_0x59fb('0x5')];_0x172c12<_0x134bec;_0x172c12++){var _0x332731=events[_0x172c12];var _0x4ed0db=createListener(_0x59fb('0x6')+_0x332731,_0x58e951);PluginEvents['on'](_0x332731,_0x4ed0db);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 67c1864..0bae30b 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(_0x308182,_0x5c805a){var _0x423e4c=function(_0x4094b7){while(--_0x4094b7){_0x308182['push'](_0x308182['shift']());}};_0x423e4c(++_0x5c805a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x392ae3,_0x3bc500){var _0x2be08d=function(_0x2f9c4a){while(--_0x2f9c4a){_0x392ae3['push'](_0x392ae3['shift']());}};_0x2be08d(++_0x3bc500);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 529c615..94e0744 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 _0xa9e0=['list','then','reject','express','motion2','catch','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus','status','stack','name','send','info','error','index'];(function(_0x5700ed,_0x420ac4){var _0x926939=function(_0x285aae){while(--_0x285aae){_0x5700ed['push'](_0x5700ed['shift']());}};_0x926939(++_0x420ac4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var pm2=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var path=require('path');var exec=require(_0x0a9e('0x3'))['exec'];var BPromise=require(_0x0a9e('0x4'));function handleEntityNotFound(_0x432180,_0x2ab90b){return function(_0x991246){if(!_0x991246){_0x432180[_0x0a9e('0x5')](0x194);;}return _0x991246;};}function respondWithResult(_0x57b080,_0x219af0){_0x219af0=_0x219af0||0xc8;return function(_0x441e3a){if(_0x441e3a){return _0x57b080[_0x0a9e('0x6')](_0x219af0)['json'](_0x441e3a);}return null;};}function handleError(_0x503809,_0xe42b77){_0xe42b77=_0xe42b77||0x1f4;return function(_0x56465b){logger['error'](_0x56465b[_0x0a9e('0x7')]);if(_0x56465b[_0x0a9e('0x8')]){delete _0x56465b[_0x0a9e('0x8')];}_0x503809[_0x0a9e('0x6')](_0xe42b77)[_0x0a9e('0x9')](_0x56465b);};}function execChildProcess(){return new BPromise(function(_0xbd1168,_0x4a4c56){exec('npm\x20install',function(_0x527cdd,_0x4cfe67,_0x273d4d){logger[_0x0a9e('0xa')](_0x4cfe67);logger[_0x0a9e('0xa')](_0x273d4d);if(_0x527cdd){logger[_0x0a9e('0xb')](_0x527cdd);return _0x4a4c56(_0x527cdd);}return _0xbd1168(_0x4cfe67);});});}exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return pm2[_0x0a9e('0xd')]()[_0x0a9e('0xe')](function(_0x2b4227){if(_0x2b4227){var _0x281129=_[_0x0a9e('0xf')](_0x2b4227,function(_0x4d5611){return _0x4d5611['name']===_0x0a9e('0x10')||_0x4d5611['name']===_0x0a9e('0x11');});return{'rows':_0x281129,'count':_0x281129['length']};}return null;})[_0x0a9e('0xe')](respondWithResult(_0x5db4b0,null))[_0x0a9e('0x12')](handleError(_0x5db4b0,null));};exports['show']=function(_0x225616,_0x5a0a06){return pm2[_0x0a9e('0x13')](_0x225616[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x5a0a06,null))[_0x0a9e('0xe')](handleEntityNotFound(_0x5a0a06,null))[_0x0a9e('0x12')](handleError(_0x5a0a06,null));};exports[_0x0a9e('0x15')]=function(_0x530eb7,_0x20559e){if(_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')]&&_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x17')]){var _0x4bb1e3=path[_0x0a9e('0x18')](__dirname,_0x0a9e('0x19'),_0x530eb7['body'][_0x0a9e('0x17')]);var _0x5a09ef=process['cwd']();process[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x4bb1e3));return execChildProcess()[_0x0a9e('0xe')](function(_0x30bae6){process['chdir'](_0x5a09ef);return pm2[_0x0a9e('0x1c')]({'name':_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')],'script':_0x4bb1e3});})[_0x0a9e('0xe')](function(_0x370d86){pm2[_0x0a9e('0x1d')]();return _0x370d86[0x0];})[_0x0a9e('0xe')](respondWithResult(_0x20559e,0xc9))['catch'](handleError(_0x20559e,null));}else{return _0x20559e['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x1e')});}};exports[_0x0a9e('0x1f')]=function(_0x33161b,_0x526cf3){if(_0x33161b[_0x0a9e('0x16')]['id']){delete _0x33161b['body']['id'];}var _0x45a1e7={'online':'restart','stopped':_0x0a9e('0x20')};if(_0x45a1e7[_0x0a9e('0x21')](_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')])){return pm2[_0x45a1e7[_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')]]](_0x33161b[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x526cf3,0xc8))['catch'](handleError(_0x526cf3,null));}else{return _0x526cf3[_0x0a9e('0x6')](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x22')});}};exports[_0x0a9e('0x23')]=function(_0x5c877d,_0x15b200){if(_0x5c877d[_0x0a9e('0x16')]['id']){delete _0x5c877d[_0x0a9e('0x16')]['id'];}if(_0x5c877d[_0x0a9e('0x14')]['id']){return pm2[_0x0a9e('0x24')](_0x5c877d[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](function(_0x2e8759){pm2[_0x0a9e('0x1d')]();return _0x2e8759[0x0];})['then'](respondWithResult(_0x15b200,null))[_0x0a9e('0x12')](handleError(_0x15b200,null));}else{return _0x15b200['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x25')});}}; \ No newline at end of file +var _0x878f=['dirname','start','dump','restart','stop','hasOwnProperty','params','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','name','info','index','then','express','motion2','length','catch','show','describe','create','body','script','../../files/plugins','cwd','chdir'];(function(_0x4eb444,_0x2c4be1){var _0x23f2bf=function(_0x173740){while(--_0x173740){_0x4eb444['push'](_0x4eb444['shift']());}};_0x23f2bf(++_0x2c4be1);}(_0x878f,0x173));var _0xf878=function(_0x41a726,_0x3622a9){_0x41a726=_0x41a726-0x0;var _0x429412=_0x878f[_0x41a726];return _0x429412;};'use strict';var _=require('lodash');var pm2=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var path=require(_0xf878('0x3'));var exec=require(_0xf878('0x4'))[_0xf878('0x5')];var BPromise=require(_0xf878('0x6'));function handleEntityNotFound(_0x45a37b,_0x240b48){return function(_0xcf1927){if(!_0xcf1927){_0x45a37b[_0xf878('0x7')](0x194);;}return _0xcf1927;};}function respondWithResult(_0x4bc9aa,_0x4ac8d8){_0x4ac8d8=_0x4ac8d8||0xc8;return function(_0x3c5f5c){if(_0x3c5f5c){return _0x4bc9aa[_0xf878('0x8')](_0x4ac8d8)['json'](_0x3c5f5c);}return null;};}function handleError(_0x52851e,_0x530767){_0x530767=_0x530767||0x1f4;return function(_0x3329df){logger['error'](_0x3329df['stack']);if(_0x3329df[_0xf878('0x9')]){delete _0x3329df[_0xf878('0x9')];}_0x52851e[_0xf878('0x8')](_0x530767)['send'](_0x3329df);};}function execChildProcess(){return new BPromise(function(_0xb2863e,_0x1399a3){exec('npm\x20install',function(_0xdf76,_0x4f7e7f,_0x31d3d2){logger[_0xf878('0xa')](_0x4f7e7f);logger[_0xf878('0xa')](_0x31d3d2);if(_0xdf76){logger['error'](_0xdf76);return _0x1399a3(_0xdf76);}return _0xb2863e(_0x4f7e7f);});});}exports[_0xf878('0xb')]=function(_0x38eddf,_0x39b1bb){return pm2['list']()[_0xf878('0xc')](function(_0x3902f7){if(_0x3902f7){var _0x119e9e=_['reject'](_0x3902f7,function(_0x568a3a){return _0x568a3a[_0xf878('0x9')]===_0xf878('0xd')||_0x568a3a[_0xf878('0x9')]===_0xf878('0xe');});return{'rows':_0x119e9e,'count':_0x119e9e[_0xf878('0xf')]};}return null;})[_0xf878('0xc')](respondWithResult(_0x39b1bb,null))[_0xf878('0x10')](handleError(_0x39b1bb,null));};exports[_0xf878('0x11')]=function(_0x3c5dee,_0x3a55f3){return pm2[_0xf878('0x12')](_0x3c5dee['params']['id'])[_0xf878('0xc')](respondWithResult(_0x3a55f3,null))[_0xf878('0xc')](handleEntityNotFound(_0x3a55f3,null))[_0xf878('0x10')](handleError(_0x3a55f3,null));};exports[_0xf878('0x13')]=function(_0x3714f6,_0x237d15){if(_0x3714f6[_0xf878('0x14')]['name']&&_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]){var _0x250f85=path['join'](__dirname,_0xf878('0x16'),_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]);var _0x392822=process[_0xf878('0x17')]();process[_0xf878('0x18')](path[_0xf878('0x19')](_0x250f85));return execChildProcess()[_0xf878('0xc')](function(_0x212436){process[_0xf878('0x18')](_0x392822);return pm2[_0xf878('0x1a')]({'name':_0x3714f6['body'][_0xf878('0x9')],'script':_0x250f85});})['then'](function(_0xa3d3d3){pm2[_0xf878('0x1b')]();return _0xa3d3d3[0x0];})[_0xf878('0xc')](respondWithResult(_0x237d15,0xc9))[_0xf878('0x10')](handleError(_0x237d15,null));}else{return _0x237d15[_0xf878('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x242926,_0x3baba4){if(_0x242926[_0xf878('0x14')]['id']){delete _0x242926['body']['id'];}var _0xfa3e11={'online':_0xf878('0x1c'),'stopped':_0xf878('0x1d')};if(_0xfa3e11[_0xf878('0x1e')](_0x242926[_0xf878('0x14')]['status'])){return pm2[_0xfa3e11[_0x242926['body'][_0xf878('0x8')]]](_0x242926[_0xf878('0x1f')]['id'])['then'](respondWithResult(_0x3baba4,0xc8))[_0xf878('0x10')](handleError(_0x3baba4,null));}else{return _0x3baba4['status'](0x1f4)[_0xf878('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf878('0x21')]=function(_0x49e66a,_0x2630fb){if(_0x49e66a['body']['id']){delete _0x49e66a[_0xf878('0x14')]['id'];}if(_0x49e66a[_0xf878('0x1f')]['id']){return pm2[_0xf878('0x22')](_0x49e66a[_0xf878('0x1f')]['id'])[_0xf878('0xc')](function(_0x716782){pm2['dump']();return _0x716782[0x0];})[_0xf878('0xc')](respondWithResult(_0x2630fb,null))[_0xf878('0x10')](handleError(_0x2630fb,null));}else{return _0x2630fb[_0xf878('0x8')](0x1f4)[_0xf878('0x20')]({'message':_0xf878('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3cbaba4..081c390 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 _0x92f0=['express','../../components/auth/service','./realtime.controller','get','isAuthenticated','getQueues','exports'];(function(_0x4aa7cd,_0x2bd0fe){var _0x21fe4f=function(_0x5a5ca9){while(--_0x5a5ca9){_0x4aa7cd['push'](_0x4aa7cd['shift']());}};_0x21fe4f(++_0x2bd0fe);}(_0x92f0,0x181));var _0x092f=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x92f0[_0x3af6d3];return _0xf0c5a8;};'use strict';var express=require(_0x092f('0x0'));var router=express['Router']();var auth=require(_0x092f('0x1'));var controller=require(_0x092f('0x2'));router[_0x092f('0x3')]('/agents',auth[_0x092f('0x4')](),controller['getAgents']);router[_0x092f('0x3')]('/queues',auth[_0x092f('0x4')](),controller[_0x092f('0x5')]);module[_0x092f('0x6')]=router; \ No newline at end of file +var _0xa63c=['exports','Router','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues'];(function(_0x296fbb,_0x15571e){var _0x31f8e3=function(_0x5a9e42){while(--_0x5a9e42){_0x296fbb['push'](_0x296fbb['shift']());}};_0x31f8e3(++_0x15571e);}(_0xa63c,0xd0));var _0xca63=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa63c[_0x5b644e];return _0x49c6bf;};'use strict';var express=require('express');var router=express[_0xca63('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xca63('0x1'));router[_0xca63('0x2')](_0xca63('0x3'),auth[_0xca63('0x4')](),controller[_0xca63('0x5')]);router[_0xca63('0x2')](_0xca63('0x6'),auth['isAuthenticated'](),controller[_0xca63('0x7')]);module[_0xca63('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index f5a1c45..78f4367 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 _0xdc97=['util','../../components/realtime/agents','../../components/parsers/qs','../../mysqldb','../../errors/api','handleError','limit','undefined','count','offset','status','set','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','then','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','role','agent','online','getOptions','push','literal','FIELD(id,','order','forEach','*pause','Pause','where','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','map','find','filterAgentAttributes','merge','globalStatus','getAgentStatus','split','pick','catch','getQueues','startCase','Queue','type','key','name','voice','outbound','dialActive','dialMethod','join','Queues','getRealtimeQueues','initializeQueues','lodash'];(function(_0x39587d,_0x4857d5){var _0x22db5f=function(_0x23e58a){while(--_0x23e58a){_0x39587d['push'](_0x39587d['shift']());}};_0x22db5f(++_0x4857d5);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2f1a0e,_0x269e41){_0x2f1a0e=_0x2f1a0e-0x0;var _0x13e31a=_0xdc97[_0x2f1a0e];return _0x13e31a;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var rta=require(_0x7dc9('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x7dc9('0x3'));var utils=require('../../config/utils');var db=require(_0x7dc9('0x4'))['db'];var APIBadRequestError=require(_0x7dc9('0x5'))['APIBadRequestError'];var APIHandleError=require(_0x7dc9('0x5'))[_0x7dc9('0x6')];function respondWithFilteredResult(_0xb15a0b,_0x3ba3ca){return function(_0x589f02){if(_0x589f02){var _0x2636ef=typeof _0x3ba3ca['offset']==='undefined'&&typeof _0x3ba3ca[_0x7dc9('0x7')]===_0x7dc9('0x8');var _0x3318ea=_0x589f02[_0x7dc9('0x9')];var _0x3dd07e=_0x2636ef?0x0:_0x3ba3ca['offset'];var _0xb2fa2a=_0x2636ef?_0x589f02[_0x7dc9('0x9')]:_0x3ba3ca[_0x7dc9('0xa')]+_0x3ba3ca[_0x7dc9('0x7')];var _0x359c88;if(_0xb2fa2a>=_0x3318ea){_0xb2fa2a=_0x3318ea;_0x359c88=0xc8;}else{_0x359c88=0xce;}_0xb15a0b[_0x7dc9('0xb')](_0x359c88);return _0xb15a0b[_0x7dc9('0xc')]('Content-Range',_0x3dd07e+'-'+_0xb2fa2a+'/'+_0x3318ea)['json'](_0x589f02);}return null;};}exports['getAgents']=function(_0x599ef1,_0x94c75a){var _0x14e5db={'count':0x0,'rows':[]};var _0x5c6ca5={};var _0xbd06be;var _0x2f3acd=utils[_0x7dc9('0xd')]();var _0xf37bc7;var _0x31d43d;var _0x11af93=_0x599ef1['query'][_0x7dc9('0xe')];var _0x278191=_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x10')];var _0x11606f=_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x11')];var _0x389d36=_0x278191===_0x7dc9('0x12')||_0x278191==='*pause'?!![]:![];var _0x22577e=[];var _0x4afb47;var _0x1f5906;Promise[_0x7dc9('0x13')]()['then'](function(){if(_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x14')]){if(!utils[_0x7dc9('0x15')](_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x14')])){throw new APIBadRequestError(util[_0x7dc9('0x16')](_0x7dc9('0x17'),_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x14')]));}_0xbd06be=_0x599ef1[_0x7dc9('0xf')]['channel']['toLowerCase']();}if(!_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x18')]||!_0x599ef1['query'][_0x7dc9('0x18')][_0x7dc9('0x19')]('globalStatus')){_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x18')]=rta[_0x7dc9('0x1a')](_0x599ef1['query'][_0x7dc9('0x18')]);return;}var _0x1e3a8d=rta[_0x7dc9('0x1b')](_0x599ef1['query']['sort']);_0x599ef1['query'][_0x7dc9('0x18')]=_0x1e3a8d[_0x7dc9('0x1c')]['join'](',');_0x4afb47=_0x1e3a8d['order'];})[_0x7dc9('0x1d')](function(){if(!_0x11af93){return[];}return rta['getAgentIdsByQueues'](_0x11af93,_0xbd06be);})[_0x7dc9('0x1d')](function(_0x1c690b){_0x22577e=_0x1c690b;return rta[_0x7dc9('0x1e')]();})[_0x7dc9('0x1d')](function(_0xa2aaa9){_0x31d43d=_0xa2aaa9[_0x7dc9('0x1f')];if((!_0x278191||_0x389d36)&&!_0x4afb47){return _0x22577e;}if(_0x4afb47&&!_0x278191){return rta[_0x7dc9('0x20')](_0x31d43d,_0x22577e,_0x4afb47);}else{return rta[_0x7dc9('0x21')](_0x31d43d,_0x22577e,_0x278191);}})[_0x7dc9('0x1d')](function(_0x3c4379){_0x22577e=_0x3c4379;var _0x14083d=![];if(_0x22577e[_0x7dc9('0x22')]===0x0){if(_0x11af93||_0x278191){_0x14083d=!![];}if(_0x389d36){_0x14083d=![];}}if(_0x14083d){return _0x14e5db;}var _0x4bb716=_['map'](db['User']['rawAttributes'],function(_0x4a68f0){return{'name':_0x4a68f0['fieldName'],'type':_0x4a68f0['type']['key']};});_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x23')]=_0x7dc9('0x24');_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x25')]=!![];_0x5c6ca5=qs[_0x7dc9('0x26')](_0x4bb716,_0x599ef1);_0x5c6ca5['raw']=!![];var _0x5ce3e1=[];if(_0x22577e['length']>0x0){_0x5ce3e1[_0x7dc9('0x27')]({'id':{'$in':_0x22577e}});if(_0x4afb47&&!_0x278191){_0x1f5906=[db['sequelize'][_0x7dc9('0x28')](_0x7dc9('0x29')+_0x22577e+')')];_0x5c6ca5[_0x7dc9('0x2a')]=_0x1f5906;}}if(_0x389d36){_0x2f3acd[_0x7dc9('0x2b')](function(_0x109c66){var _0x165882=!![];if(_0x278191===_0x7dc9('0x2c')&&_0xbd06be!==_0x109c66){_0x165882=![];}_0x5ce3e1[_0x7dc9('0x27')]({[_0x109c66+'Pause']:_0x165882});});if(_0x11606f){_0x5ce3e1[_0x7dc9('0x27')]({'pauseType':_0x11606f});}}else if(_0x278191){_0x2f3acd['forEach'](function(_0x421e1a){_0x5ce3e1[_0x7dc9('0x27')]({[_0x421e1a+_0x7dc9('0x2d')]:![]});});}_0x5c6ca5[_0x7dc9('0x2e')]=_['merge'](_0x5c6ca5[_0x7dc9('0x2e')],{'$and':_0x5ce3e1});if(_0x599ef1['user'][_0x7dc9('0x23')]==='user'){var _0x590bed={'params':{'id':_0x599ef1[_0x7dc9('0x2f')][_0x7dc9('0x30')]},'query':{'section':_0x7dc9('0x31'),'role':_0x7dc9('0x24'),'online':!![],'raw':!![],'ids':_0x22577e,'customSorting':_0x1f5906}};if(_0x389d36){_0x590bed['query'][_0x7dc9('0x32')]=_0x5ce3e1;}_0x590bed[_0x7dc9('0xf')]=Object[_0x7dc9('0x33')](_0x590bed[_0x7dc9('0xf')],_0x599ef1[_0x7dc9('0xf')]);delete _0x590bed[_0x7dc9('0xf')]['id'];return db[_0x7dc9('0x34')][_0x7dc9('0x35')](_0x590bed);}return db[_0x7dc9('0x36')][_0x7dc9('0x37')](_0x5c6ca5);})[_0x7dc9('0x1d')](function(_0x3a8d80){_0x14e5db['count']=_0x3a8d80[_0x7dc9('0x9')];_0xf37bc7=_0x3a8d80[_0x7dc9('0x1f')];return _0xf37bc7[_0x7dc9('0x38')](function(_0xfd2612){var _0x4bcdce=_[_0x7dc9('0x39')](_0x31d43d,['id',_0xfd2612['id']]);if(_0x4bcdce){var _0x89db0e=rta[_0x7dc9('0x3a')](_0x4bcdce);_[_0x7dc9('0x3b')](_0xfd2612,_0x89db0e);}_0xfd2612[_0x7dc9('0x3c')]=rta[_0x7dc9('0x3d')](_0xfd2612);if(_0xfd2612['globalStatus']['includes'](_0x7dc9('0x12'))){_0x2f3acd[_0x7dc9('0x2b')](function(_0x495100){if(_0xfd2612[_0x495100+_0x7dc9('0x2d')]){_0xfd2612[_0x495100+'Status']=_0x7dc9('0x12');}});}return _0xfd2612;});})[_0x7dc9('0x1d')](function(_0x3bca9c){if(!_0x4afb47||_0x1f5906){return _0x3bca9c;}return rta['sortAgentsByStatus'](_0x3bca9c,_0x4afb47);})[_0x7dc9('0x1d')](function(_0x1df27f){var _0x1929b6=null;if(_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x1c')]){var _0x23499a=_0x599ef1[_0x7dc9('0xf')]['fields'][_0x7dc9('0x3e')](',');_0x1929b6=_0x1df27f['map'](function(_0x52d883){return _[_0x7dc9('0x3f')](_0x52d883,_0x23499a);});}_0x14e5db[_0x7dc9('0x1f')]=_0x1929b6||_0x1df27f;return _0x14e5db;})[_0x7dc9('0x1d')](respondWithFilteredResult(_0x94c75a,_0x5c6ca5))[_0x7dc9('0x40')](APIHandleError(_0x94c75a));};exports[_0x7dc9('0x41')]=function(_0x1bd3a7,_0x2ce57f){var _0x765fee={'count':0x0,'rows':[]};var _0x3b130f={};var _0x573b48;var _0x1c41ef;var _0x1971c7;Promise[_0x7dc9('0x13')]()[_0x7dc9('0x1d')](function(){if(_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x14')]){if(!utils['isValidChannel'](_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x14')])){throw new APIBadRequestError(util['format'](_0x7dc9('0x17'),_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x14')]));}_0x573b48=_0x1bd3a7['query'][_0x7dc9('0x14')]['toLowerCase']();}var _0x55826d=_[_0x7dc9('0x42')](_0x573b48)+_0x7dc9('0x43');var _0x36d591=_['map'](db[_0x55826d]['rawAttributes'],function(_0x415ebd){return{'name':_0x415ebd['fieldName'],'type':_0x415ebd[_0x7dc9('0x44')][_0x7dc9('0x45')]};});if(!_0x1bd3a7['query'][_0x7dc9('0x1c')]){var _0x1d6c0a=['id',_0x7dc9('0x46')];if(_0x573b48===_0x7dc9('0x47')){_0x1d6c0a[_0x7dc9('0x27')](_0x7dc9('0x44'));if(_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x44')]===_0x7dc9('0x48')){_0x1d6c0a[_0x7dc9('0x27')]([_0x7dc9('0x49'),_0x7dc9('0x4a')]);}}_0x1bd3a7[_0x7dc9('0xf')]['fields']=_0x1d6c0a[_0x7dc9('0x4b')](',');}_0x3b130f=qs['getOptions'](_0x36d591,_0x1bd3a7);if(_0x1bd3a7['user'][_0x7dc9('0x23')]===_0x7dc9('0x2f')){var _0x40e382={'params':{'id':_0x1bd3a7[_0x7dc9('0x2f')][_0x7dc9('0x30')]},'query':{'section':_0x573b48==='voice'&&_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x44')]===_0x7dc9('0x48')?'QueueCampaigns':_[_0x7dc9('0x42')](_0x573b48)+_0x7dc9('0x4c'),'type':_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x44')],'nolimit':!![],'sort':_0x7dc9('0x46'),'filter':_0x1bd3a7[_0x7dc9('0xf')]['filter']}};_0x40e382[_0x7dc9('0xf')]=Object[_0x7dc9('0x33')](_0x40e382[_0x7dc9('0xf')],_0x1bd3a7[_0x7dc9('0xf')]);delete _0x40e382[_0x7dc9('0xf')]['id'];return db[_0x7dc9('0x34')][_0x7dc9('0x35')](_0x40e382);}return db[_0x55826d][_0x7dc9('0x37')](_0x3b130f);})[_0x7dc9('0x1d')](function(_0x1de02f){_0x765fee[_0x7dc9('0x9')]=_0x1de02f[_0x7dc9('0x9')];_0x1c41ef=_0x1de02f['rows'];return rtq[_0x7dc9('0x4d')](_0x1bd3a7,_0x573b48);})[_0x7dc9('0x1d')](function(_0x38df9a){_0x1971c7=_0x38df9a[_0x7dc9('0x1f')];return rtq[_0x7dc9('0x4e')](_0x1c41ef,_0x1971c7,_0x573b48,_0x1bd3a7['query'][_0x7dc9('0x44')]);})[_0x7dc9('0x1d')](function(_0x2c1452){_0x765fee[_0x7dc9('0x1f')]=_0x2c1452;return _0x765fee;})[_0x7dc9('0x1d')](respondWithFilteredResult(_0x2ce57f,_0x3b130f))[_0x7dc9('0x40')](APIHandleError(_0x2ce57f));}; \ No newline at end of file +var _0xdbf5=['startCase','Queue','outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','assign','UserProfile','initializeQueues','util','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','status','json','query','globalQueueFilter','globalStatusFilter','pause','*pause','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','map','User','rawAttributes','fieldName','type','role','agent','online','getOptions','push','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','extraQueryConditions','getResources','findAndCountAll','find','filterAgentAttributes','globalStatus','Status','sortAgentsByStatus','pick','catch','getQueues','resolve','isValidChannel'];(function(_0xf1402a,_0x187f5c){var _0x4f7ead=function(_0x57dfd9){while(--_0x57dfd9){_0xf1402a['push'](_0xf1402a['shift']());}};_0x4f7ead(++_0x187f5c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1998aa,_0x3074b3){_0x1998aa=_0x1998aa-0x0;var _0x949944=_0xdbf5[_0x1998aa];return _0x949944;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require(_0x5dbf('0x1'));var utils=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var APIBadRequestError=require(_0x5dbf('0x4'))[_0x5dbf('0x5')];var APIHandleError=require(_0x5dbf('0x4'))[_0x5dbf('0x6')];function respondWithFilteredResult(_0x1decd2,_0x3f8628){return function(_0x3f8222){if(_0x3f8222){var _0x209b7d=typeof _0x3f8628[_0x5dbf('0x7')]===_0x5dbf('0x8')&&typeof _0x3f8628['limit']===_0x5dbf('0x8');var _0x501cb1=_0x3f8222[_0x5dbf('0x9')];var _0x3bec50=_0x209b7d?0x0:_0x3f8628[_0x5dbf('0x7')];var _0x1813bb=_0x209b7d?_0x3f8222['count']:_0x3f8628[_0x5dbf('0x7')]+_0x3f8628['limit'];var _0x5433f4;if(_0x1813bb>=_0x501cb1){_0x1813bb=_0x501cb1;_0x5433f4=0xc8;}else{_0x5433f4=0xce;}_0x1decd2[_0x5dbf('0xa')](_0x5433f4);return _0x1decd2['set']('Content-Range',_0x3bec50+'-'+_0x1813bb+'/'+_0x501cb1)[_0x5dbf('0xb')](_0x3f8222);}return null;};}exports['getAgents']=function(_0x182cec,_0x2bb7ed){var _0x1453a9={'count':0x0,'rows':[]};var _0x7cb848={};var _0x14493a;var _0x587e58=utils['getChannels']();var _0x2b4e1c;var _0x3480c8;var _0x48e7fd=_0x182cec[_0x5dbf('0xc')][_0x5dbf('0xd')];var _0x23f763=_0x182cec[_0x5dbf('0xc')][_0x5dbf('0xe')];var _0x472eb9=_0x182cec[_0x5dbf('0xc')]['pauseTypeFilter'];var _0x499cd9=_0x23f763===_0x5dbf('0xf')||_0x23f763===_0x5dbf('0x10')?!![]:![];var _0x39c7aa=[];var _0x14abf7;var _0x20c2b0;Promise['resolve']()[_0x5dbf('0x11')](function(){if(_0x182cec['query']['channel']){if(!utils['isValidChannel'](_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x12')])){throw new APIBadRequestError(util[_0x5dbf('0x13')](_0x5dbf('0x14'),_0x182cec[_0x5dbf('0xc')]['channel']));}_0x14493a=_0x182cec[_0x5dbf('0xc')]['channel'][_0x5dbf('0x15')]();}if(!_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x16')]||!_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x16')][_0x5dbf('0x17')]('globalStatus')){_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x16')]=rta[_0x5dbf('0x18')](_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x16')]);return;}var _0x226b93=rta[_0x5dbf('0x19')](_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x16')]);_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x16')]=_0x226b93[_0x5dbf('0x1a')][_0x5dbf('0x1b')](',');_0x14abf7=_0x226b93[_0x5dbf('0x1c')];})[_0x5dbf('0x11')](function(){if(!_0x48e7fd){return[];}return rta[_0x5dbf('0x1d')](_0x48e7fd,_0x14493a);})[_0x5dbf('0x11')](function(_0x3f8341){_0x39c7aa=_0x3f8341;return rta[_0x5dbf('0x1e')]();})[_0x5dbf('0x11')](function(_0x6a9757){_0x3480c8=_0x6a9757[_0x5dbf('0x1f')];if((!_0x23f763||_0x499cd9)&&!_0x14abf7){return _0x39c7aa;}if(_0x14abf7&&!_0x23f763){return rta[_0x5dbf('0x20')](_0x3480c8,_0x39c7aa,_0x14abf7);}else{return rta['getAgentIdsByStatus'](_0x3480c8,_0x39c7aa,_0x23f763);}})[_0x5dbf('0x11')](function(_0x24dc99){_0x39c7aa=_0x24dc99;var _0xc4748=![];if(_0x39c7aa[_0x5dbf('0x21')]===0x0){if(_0x48e7fd||_0x23f763){_0xc4748=!![];}if(_0x499cd9){_0xc4748=![];}}if(_0xc4748){return _0x1453a9;}var _0x38825a=_[_0x5dbf('0x22')](db[_0x5dbf('0x23')][_0x5dbf('0x24')],function(_0x406ce6){return{'name':_0x406ce6[_0x5dbf('0x25')],'type':_0x406ce6[_0x5dbf('0x26')]['key']};});_0x182cec['query'][_0x5dbf('0x27')]=_0x5dbf('0x28');_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x29')]=!![];_0x7cb848=qs[_0x5dbf('0x2a')](_0x38825a,_0x182cec);_0x7cb848['raw']=!![];var _0x5cc3f1=[];if(_0x39c7aa[_0x5dbf('0x21')]>0x0){_0x5cc3f1[_0x5dbf('0x2b')]({'id':{'$in':_0x39c7aa}});if(_0x14abf7&&!_0x23f763){_0x20c2b0=[db['sequelize'][_0x5dbf('0x2c')](_0x5dbf('0x2d')+_0x39c7aa+')')];_0x7cb848[_0x5dbf('0x1c')]=_0x20c2b0;}}if(_0x499cd9){_0x587e58[_0x5dbf('0x2e')](function(_0x27e058){var _0x5ab806=!![];if(_0x23f763===_0x5dbf('0x10')&&_0x14493a!==_0x27e058){_0x5ab806=![];}_0x5cc3f1[_0x5dbf('0x2b')]({[_0x27e058+_0x5dbf('0x2f')]:_0x5ab806});});if(_0x472eb9){_0x5cc3f1[_0x5dbf('0x2b')]({'pauseType':_0x472eb9});}}else if(_0x23f763){_0x587e58[_0x5dbf('0x2e')](function(_0x4e4518){_0x5cc3f1[_0x5dbf('0x2b')]({[_0x4e4518+_0x5dbf('0x2f')]:![]});});}_0x7cb848[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x7cb848['where'],{'$and':_0x5cc3f1});if(_0x182cec[_0x5dbf('0x32')][_0x5dbf('0x27')]===_0x5dbf('0x32')){var _0x3439da={'params':{'id':_0x182cec[_0x5dbf('0x32')][_0x5dbf('0x33')]},'query':{'section':_0x5dbf('0x34'),'role':_0x5dbf('0x28'),'online':!![],'raw':!![],'ids':_0x39c7aa,'customSorting':_0x20c2b0}};if(_0x499cd9){_0x3439da[_0x5dbf('0xc')][_0x5dbf('0x35')]=_0x5cc3f1;}_0x3439da[_0x5dbf('0xc')]=Object['assign'](_0x3439da[_0x5dbf('0xc')],_0x182cec[_0x5dbf('0xc')]);delete _0x3439da[_0x5dbf('0xc')]['id'];return db['UserProfile'][_0x5dbf('0x36')](_0x3439da);}return db[_0x5dbf('0x23')][_0x5dbf('0x37')](_0x7cb848);})['then'](function(_0x444814){_0x1453a9[_0x5dbf('0x9')]=_0x444814[_0x5dbf('0x9')];_0x2b4e1c=_0x444814['rows'];return _0x2b4e1c[_0x5dbf('0x22')](function(_0x29a62d){var _0x2ac162=_[_0x5dbf('0x38')](_0x3480c8,['id',_0x29a62d['id']]);if(_0x2ac162){var _0x10537d=rta[_0x5dbf('0x39')](_0x2ac162);_[_0x5dbf('0x31')](_0x29a62d,_0x10537d);}_0x29a62d[_0x5dbf('0x3a')]=rta['getAgentStatus'](_0x29a62d);if(_0x29a62d['globalStatus']['includes']('pause')){_0x587e58[_0x5dbf('0x2e')](function(_0x21122d){if(_0x29a62d[_0x21122d+'Pause']){_0x29a62d[_0x21122d+_0x5dbf('0x3b')]=_0x5dbf('0xf');}});}return _0x29a62d;});})['then'](function(_0x1a7ea9){if(!_0x14abf7||_0x20c2b0){return _0x1a7ea9;}return rta[_0x5dbf('0x3c')](_0x1a7ea9,_0x14abf7);})[_0x5dbf('0x11')](function(_0x2ee6b9){var _0x21ae10=null;if(_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x1a')]){var _0x1c020a=_0x182cec[_0x5dbf('0xc')][_0x5dbf('0x1a')]['split'](',');_0x21ae10=_0x2ee6b9[_0x5dbf('0x22')](function(_0x22f958){return _[_0x5dbf('0x3d')](_0x22f958,_0x1c020a);});}_0x1453a9['rows']=_0x21ae10||_0x2ee6b9;return _0x1453a9;})[_0x5dbf('0x11')](respondWithFilteredResult(_0x2bb7ed,_0x7cb848))[_0x5dbf('0x3e')](APIHandleError(_0x2bb7ed));};exports[_0x5dbf('0x3f')]=function(_0x1a0ec5,_0x4b0e91){var _0x3fba78={'count':0x0,'rows':[]};var _0x561a79={};var _0x336ba5;var _0x14002b;var _0x2d046b;Promise[_0x5dbf('0x40')]()['then'](function(){if(_0x1a0ec5['query'][_0x5dbf('0x12')]){if(!utils[_0x5dbf('0x41')](_0x1a0ec5[_0x5dbf('0xc')]['channel'])){throw new APIBadRequestError(util[_0x5dbf('0x13')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1a0ec5['query']['channel']));}_0x336ba5=_0x1a0ec5['query'][_0x5dbf('0x12')][_0x5dbf('0x15')]();}var _0x479220=_[_0x5dbf('0x42')](_0x336ba5)+_0x5dbf('0x43');var _0x4b6f30=_[_0x5dbf('0x22')](db[_0x479220][_0x5dbf('0x24')],function(_0x5b6990){return{'name':_0x5b6990[_0x5dbf('0x25')],'type':_0x5b6990['type']['key']};});if(!_0x1a0ec5[_0x5dbf('0xc')][_0x5dbf('0x1a')]){var _0x17a1c0=['id','name'];if(_0x336ba5==='voice'){_0x17a1c0[_0x5dbf('0x2b')](_0x5dbf('0x26'));if(_0x1a0ec5[_0x5dbf('0xc')][_0x5dbf('0x26')]===_0x5dbf('0x44')){_0x17a1c0[_0x5dbf('0x2b')]([_0x5dbf('0x45'),_0x5dbf('0x46')]);}}_0x1a0ec5['query'][_0x5dbf('0x1a')]=_0x17a1c0[_0x5dbf('0x1b')](',');}_0x561a79=qs[_0x5dbf('0x2a')](_0x4b6f30,_0x1a0ec5);if(_0x1a0ec5[_0x5dbf('0x32')][_0x5dbf('0x27')]===_0x5dbf('0x32')){var _0x328dc5={'params':{'id':_0x1a0ec5['user'][_0x5dbf('0x33')]},'query':{'section':_0x336ba5==='voice'&&_0x1a0ec5[_0x5dbf('0xc')][_0x5dbf('0x26')]===_0x5dbf('0x44')?_0x5dbf('0x47'):_[_0x5dbf('0x42')](_0x336ba5)+_0x5dbf('0x48'),'type':_0x1a0ec5[_0x5dbf('0xc')]['type'],'nolimit':!![],'sort':'name','filter':_0x1a0ec5['query'][_0x5dbf('0x49')]}};_0x328dc5[_0x5dbf('0xc')]=Object[_0x5dbf('0x4a')](_0x328dc5['query'],_0x1a0ec5['query']);delete _0x328dc5[_0x5dbf('0xc')]['id'];return db[_0x5dbf('0x4b')][_0x5dbf('0x36')](_0x328dc5);}return db[_0x479220]['findAndCountAll'](_0x561a79);})[_0x5dbf('0x11')](function(_0x56633d){_0x3fba78[_0x5dbf('0x9')]=_0x56633d[_0x5dbf('0x9')];_0x14002b=_0x56633d[_0x5dbf('0x1f')];return rtq['getRealtimeQueues'](_0x1a0ec5,_0x336ba5);})['then'](function(_0x1b316d){_0x2d046b=_0x1b316d[_0x5dbf('0x1f')];return rtq[_0x5dbf('0x4c')](_0x14002b,_0x2d046b,_0x336ba5,_0x1a0ec5[_0x5dbf('0xc')]['type']);})[_0x5dbf('0x11')](function(_0x4666ff){_0x3fba78['rows']=_0x4666ff;return _0x3fba78;})['then'](respondWithFilteredResult(_0x4b0e91,_0x561a79))[_0x5dbf('0x3e')](APIHandleError(_0x4b0e91));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 204886a..4f75072 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xf0f7ba,_0x48be70){var _0x44382c=function(_0x5b746c){while(--_0x5b746c){_0xf0f7ba['push'](_0xf0f7ba['shift']());}};_0x44382c(++_0x48be70);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x20bf0d,_0x2465e7){var _0x6ae676=function(_0x33884c){while(--_0x33884c){_0x20bf0d['push'](_0x20bf0d['shift']());}};_0x6ae676(++_0x2465e7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xcb91[_0x4a7631];return _0x1a5a6f;};'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 e65498f..c1f0126 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 _0xbe2c=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x3a7e45,_0x1b1eb3){var _0x278476=function(_0x3f13c9){while(--_0x3f13c9){_0x3a7e45['push'](_0x3a7e45['shift']());}};_0x278476(++_0x1b1eb3);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x219bb5,_0x451238){_0x219bb5=_0x219bb5-0x0;var _0x43e822=_0xbe2c[_0x219bb5];return _0x43e822;};'use strict';var Sequelize=require(_0xcbe2('0x0'));module[_0xcbe2('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xcbe2('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xcbe2('0x2')]},'starttime':{'type':Sequelize[_0xcbe2('0x3')]},'responsetime':{'type':Sequelize[_0xcbe2('0x3')]},'ringtime':{'type':Sequelize[_0xcbe2('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xcbe2('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xcbe2('0x2')]}}; \ No newline at end of file +var _0x2d2c=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x2d2c[_0x107f10];return _0x811cab;};'use strict';var Sequelize=require(_0xc2d2('0x0'));module[_0xc2d2('0x1')]={'state':{'type':Sequelize[_0xc2d2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc2d2('0x3')]},'scheduledat':{'type':Sequelize[_0xc2d2('0x4')]},'uniqueid':{'type':Sequelize[_0xc2d2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc2d2('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc2d2('0x3')]},'campaigntype':{'type':Sequelize[_0xc2d2('0x3')]},'membername':{'type':Sequelize[_0xc2d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a335d7d..1b5b773 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 _0x7629=['exports','define','ReportAgentPreview','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x5e1fd0,_0x394cf9){var _0x2ad6cf=function(_0x1641c){while(--_0x1641c){_0x5e1fd0['push'](_0x5e1fd0['shift']());}};_0x2ad6cf(++_0x394cf9);}(_0x7629,0xb9));var _0x9762=function(_0x475bd7,_0x2da876){_0x475bd7=_0x475bd7-0x0;var _0xe57553=_0x7629[_0x475bd7];return _0xe57553;};'use strict';var _=require('lodash');var util=require(_0x9762('0x0'));var logger=require(_0x9762('0x1'))(_0x9762('0x2'));var moment=require(_0x9762('0x3'));var BPromise=require(_0x9762('0x4'));var rp=require(_0x9762('0x5'));var fs=require('fs');var path=require(_0x9762('0x6'));var rimraf=require(_0x9762('0x7'));var config=require(_0x9762('0x8'));var attributes=require(_0x9762('0x9'));module[_0x9762('0xa')]=function(_0x5cba8d,_0x130213){return _0x5cba8d[_0x9762('0xb')](_0x9762('0xc'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc93=['ReportAgentPreview','report_agent_preview','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x46d501,_0x267039){var _0x3f7a0d=function(_0x1a471a){while(--_0x1a471a){_0x46d501['push'](_0x46d501['shift']());}};_0x3f7a0d(++_0x267039);}(_0xcc93,0x13a));var _0x3cc9=function(_0x52d428,_0x146267){_0x52d428=_0x52d428-0x0;var _0x994956=_0xcc93[_0x52d428];return _0x994956;};'use strict';var _=require('lodash');var util=require(_0x3cc9('0x0'));var logger=require(_0x3cc9('0x1'))(_0x3cc9('0x2'));var moment=require('moment');var BPromise=require(_0x3cc9('0x3'));var rp=require(_0x3cc9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cc9('0x5'));var config=require(_0x3cc9('0x6'));var attributes=require(_0x3cc9('0x7'));module[_0x3cc9('0x8')]=function(_0xc8c8b4,_0x4e86be){return _0xc8c8b4[_0x3cc9('0x9')](_0x3cc9('0xa'),attributes,{'tableName':_0x3cc9('0xb'),'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 9064956..d9165bd 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 _0xc280=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xc280,0x7e));var _0x0c28=function(_0x36f596,_0x1a8d7b){_0x36f596=_0x36f596-0x0;var _0x524378=_0xc280[_0x36f596];return _0x524378;};'use strict';var _=require(_0x0c28('0x0'));var util=require(_0x0c28('0x1'));var moment=require(_0x0c28('0x2'));var BPromise=require(_0x0c28('0x3'));var rs=require(_0x0c28('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c28('0x5'))['db'];var utils=require(_0x0c28('0x6'));var logger=require('../../config/logger')(_0x0c28('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0c28('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5892fa,_0x2cd880,_0x74a378){return new BPromise(function(_0x210a0f,_0x3c9788){return client[_0x0c28('0x9')](_0x5892fa,_0x74a378)[_0x0c28('0xa')](function(_0x2690b0){logger[_0x0c28('0xb')](_0x0c28('0xc'),_0x2cd880,_0x0c28('0xd'));logger[_0x0c28('0xe')](_0x0c28('0xf'),_0x2cd880,_0x0c28('0xd'),JSON['stringify'](_0x2690b0));if(_0x2690b0[_0x0c28('0x10')]){if(_0x2690b0[_0x0c28('0x10')][_0x0c28('0x11')]===0x1f4){logger[_0x0c28('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2cd880,_0x2690b0['error'][_0x0c28('0x12')]);return _0x3c9788(_0x2690b0[_0x0c28('0x10')][_0x0c28('0x12')]);}logger[_0x0c28('0x10')](_0x0c28('0xc'),_0x2cd880,_0x2690b0['error']['message']);return _0x210a0f(_0x2690b0[_0x0c28('0x10')]['message']);}else{logger[_0x0c28('0xb')](_0x0c28('0xc'),_0x2cd880,'request\x20sent');_0x210a0f(_0x2690b0[_0x0c28('0x13')]['message']);}})[_0x0c28('0x14')](function(_0x177e8f){logger[_0x0c28('0x10')](_0x0c28('0xc'),_0x2cd880,_0x177e8f);_0x3c9788(_0x177e8f);});});}exports[_0x0c28('0x15')]=function(_0x19ccde){var _0x18b4d8=this;return new Promise(function(_0xc691c0,_0x2bc61e){return db[_0x0c28('0x16')][_0x0c28('0x17')](_0x19ccde[_0x0c28('0x18')],{'raw':_0x19ccde['options']?_0x19ccde[_0x0c28('0x19')][_0x0c28('0x1a')]===undefined?!![]:![]:!![]})[_0x0c28('0xa')](function(_0x2b224b){logger[_0x0c28('0xb')](_0x0c28('0x15'),_0x19ccde);logger[_0x0c28('0xe')](_0x0c28('0x15'),_0x19ccde,JSON['stringify'](_0x2b224b));_0xc691c0(_0x2b224b);})['catch'](function(_0x270be0){logger['error'](_0x0c28('0x15'),_0x270be0['message'],_0x19ccde);_0x2bc61e(_0x18b4d8['error'](0x1f4,_0x270be0[_0x0c28('0x12')]));});});}; \ No newline at end of file +var _0x1337=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateReportAgentPreview','ReportAgentPreview','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','debug'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x1337,0x7d));var _0x7133=function(_0x3e7455,_0x578151){_0x3e7455=_0x3e7455-0x0;var _0x41c2ce=_0x1337[_0x3e7455];return _0x41c2ce;};'use strict';var _=require(_0x7133('0x0'));var util=require(_0x7133('0x1'));var moment=require(_0x7133('0x2'));var BPromise=require(_0x7133('0x3'));var rs=require(_0x7133('0x4'));var fs=require('fs');var Redis=require(_0x7133('0x5'));var db=require(_0x7133('0x6'))['db'];var utils=require(_0x7133('0x7'));var logger=require(_0x7133('0x8'))('rpc');var config=require(_0x7133('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a67fa,_0x527e2b,_0x1f8f7c){return new BPromise(function(_0x5cf016,_0x46cfb3){return client[_0x7133('0xb')](_0x4a67fa,_0x1f8f7c)[_0x7133('0xc')](function(_0x3376b6){logger[_0x7133('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x527e2b,'request\x20sent');logger[_0x7133('0xe')](_0x7133('0xf'),_0x527e2b,'request\x20sent',JSON[_0x7133('0x10')](_0x3376b6));if(_0x3376b6[_0x7133('0x11')]){if(_0x3376b6[_0x7133('0x11')][_0x7133('0x12')]===0x1f4){logger[_0x7133('0x11')](_0x7133('0x13'),_0x527e2b,_0x3376b6[_0x7133('0x11')]['message']);return _0x46cfb3(_0x3376b6[_0x7133('0x11')][_0x7133('0x14')]);}logger[_0x7133('0x11')](_0x7133('0x13'),_0x527e2b,_0x3376b6['error'][_0x7133('0x14')]);return _0x5cf016(_0x3376b6[_0x7133('0x11')]['message']);}else{logger['info'](_0x7133('0x13'),_0x527e2b,_0x7133('0x15'));_0x5cf016(_0x3376b6[_0x7133('0x16')][_0x7133('0x14')]);}})[_0x7133('0x17')](function(_0x535d2f){logger['error'](_0x7133('0x13'),_0x527e2b,_0x535d2f);_0x46cfb3(_0x535d2f);});});}exports[_0x7133('0x18')]=function(_0x337b75){var _0xa8fc33=this;return new Promise(function(_0x17aff0,_0x59c389){return db[_0x7133('0x19')]['create'](_0x337b75['body'],{'raw':_0x337b75['options']?_0x337b75[_0x7133('0x1a')][_0x7133('0x1b')]===undefined?!![]:![]:!![]})[_0x7133('0xc')](function(_0xdd3fa9){logger[_0x7133('0xd')](_0x7133('0x18'),_0x337b75);logger[_0x7133('0xe')]('CreateReportAgentPreview',_0x337b75,JSON[_0x7133('0x10')](_0xdd3fa9));_0x17aff0(_0xdd3fa9);})['catch'](function(_0x4853e){logger[_0x7133('0x11')](_0x7133('0x18'),_0x4853e[_0x7133('0x14')],_0x337b75);_0x59c389(_0xa8fc33[_0x7133('0x11')](0x1f4,_0x4853e['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 329da3e..0b9bb4f 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 _0xa841=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id','showMailQueues','post','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues'];(function(_0x1e1a40,_0x120381){var _0x233c8e=function(_0x134c29){while(--_0x134c29){_0x1e1a40['push'](_0x1e1a40['shift']());}};_0x233c8e(++_0x120381);}(_0xa841,0x181));var _0x1a84=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa841[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x1a84('0x0'));var util=require(_0x1a84('0x1'));var path=require(_0x1a84('0x2'));var express=require(_0x1a84('0x3'));var router=express[_0x1a84('0x4')]();var auth=require(_0x1a84('0x5'));var controller=require(_0x1a84('0x6'));router[_0x1a84('0x7')](_0x1a84('0x8'),auth[_0x1a84('0x9')](),controller['voiceChannels']);router[_0x1a84('0x7')](_0x1a84('0xa'),auth[_0x1a84('0x9')](),controller[_0x1a84('0xb')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x1a84('0x9')](),controller[_0x1a84('0xc')]);router[_0x1a84('0x7')](_0x1a84('0xd'),auth['isAuthenticated'](),controller[_0x1a84('0xe')]);router['get'](_0x1a84('0xf'),auth['isAuthenticated'](),controller['chatQueues']);router[_0x1a84('0x7')](_0x1a84('0x10'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x11')]);router[_0x1a84('0x7')]('/mail/accounts',auth[_0x1a84('0x9')](),controller[_0x1a84('0x12')]);router[_0x1a84('0x7')](_0x1a84('0x13'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x14')]);router[_0x1a84('0x7')](_0x1a84('0x15'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x16')]);router[_0x1a84('0x7')]('/whatsapp/queues',auth[_0x1a84('0x9')](),controller[_0x1a84('0x17')]);router['get'](_0x1a84('0x18'),auth[_0x1a84('0x9')](),controller['faxQueues']);router[_0x1a84('0x7')](_0x1a84('0x19'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x1a')]);router['get'](_0x1a84('0x1b'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x1c')]);router[_0x1a84('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x1a84('0x9')](),controller[_0x1a84('0x1d')]);router[_0x1a84('0x7')](_0x1a84('0x1e'),auth[_0x1a84('0x9')](),controller['voiceQueuesChannelHangup']);router[_0x1a84('0x7')](_0x1a84('0x1f'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x20')]);router[_0x1a84('0x7')](_0x1a84('0x21'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x22')]);router[_0x1a84('0x23')](_0x1a84('0x21'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x24')]);router['get'](_0x1a84('0x25'),auth['isAuthenticated'](),controller[_0x1a84('0x26')]);router[_0x1a84('0x7')](_0x1a84('0x27'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x1a84('0x7')](_0x1a84('0x28'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x29')]);router[_0x1a84('0x23')](_0x1a84('0x2a'),auth[_0x1a84('0x9')](),controller['agentCapacity']);router[_0x1a84('0x7')](_0x1a84('0x2b'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x2c')]);router['get'](_0x1a84('0x2d'),auth['isAuthenticated'](),controller[_0x1a84('0x2e')]);router[_0x1a84('0x7')](_0x1a84('0x2f'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x30')]);router[_0x1a84('0x7')](_0x1a84('0x31'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x32')]);router[_0x1a84('0x7')](_0x1a84('0x33'),auth[_0x1a84('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x1a84('0x7')](_0x1a84('0x34'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x35')]);router[_0x1a84('0x7')](_0x1a84('0x36'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x37')]);router[_0x1a84('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x1a84('0x7')]('/sms/queues/waitinginteractions',auth[_0x1a84('0x9')](),controller[_0x1a84('0x38')]);router[_0x1a84('0x7')](_0x1a84('0x39'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x3a')]);router['get'](_0x1a84('0x3b'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x3c')]);router['post']('/mail/queues/:id/notify',auth[_0x1a84('0x9')](),controller['queueNotify']('mail'));router[_0x1a84('0x7')](_0x1a84('0x3d'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x3e')]);router[_0x1a84('0x3f')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x1a84('0x40')]('chat'));router[_0x1a84('0x7')](_0x1a84('0x41'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x42')]);router[_0x1a84('0x3f')](_0x1a84('0x43'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x40')](_0x1a84('0x44')));router['get'](_0x1a84('0x45'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x46')]);router[_0x1a84('0x3f')](_0x1a84('0x47'),auth['isAuthenticated'](),controller[_0x1a84('0x40')](_0x1a84('0x48')));router[_0x1a84('0x7')](_0x1a84('0x49'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x4a')]);router[_0x1a84('0x3f')](_0x1a84('0x4b'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x40')](_0x1a84('0x4c')));router['post']('/whatsapp/queues/:id/notify',auth[_0x1a84('0x9')](),controller[_0x1a84('0x40')]('whatsapp'));router[_0x1a84('0x7')]('/sms/queues/:id',auth[_0x1a84('0x9')](),controller[_0x1a84('0x4d')]);router[_0x1a84('0x7')](_0x1a84('0x4e'),auth[_0x1a84('0x9')](),controller[_0x1a84('0x4f')]);router[_0x1a84('0x3f')]('/agents/:id/notify',auth[_0x1a84('0x9')](),controller[_0x1a84('0x50')]);module[_0x1a84('0x51')]=router; \ No newline at end of file +var _0x3325=['path','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','multer','util'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x3325,0x184));var _0x5332=function(_0x1bcb9d,_0x196e3d){_0x1bcb9d=_0x1bcb9d-0x0;var _0x5651f2=_0x3325[_0x1bcb9d];return _0x5651f2;};'use strict';var multer=require(_0x5332('0x0'));var util=require(_0x5332('0x1'));var path=require(_0x5332('0x2'));var express=require('express');var router=express[_0x5332('0x3')]();var auth=require(_0x5332('0x4'));var controller=require(_0x5332('0x5'));router['get']('/voice/channels',auth[_0x5332('0x6')](),controller[_0x5332('0x7')]);router[_0x5332('0x8')](_0x5332('0x9'),auth['isAuthenticated'](),controller[_0x5332('0xa')]);router[_0x5332('0x8')](_0x5332('0xb'),auth[_0x5332('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x5332('0x8')]('/voice/queues',auth['isAuthenticated'](),controller['voiceQueues']);router[_0x5332('0x8')](_0x5332('0xc'),auth[_0x5332('0x6')](),controller['chatQueues']);router[_0x5332('0x8')](_0x5332('0xd'),auth[_0x5332('0x6')](),controller[_0x5332('0xe')]);router[_0x5332('0x8')](_0x5332('0xf'),auth['isAuthenticated'](),controller[_0x5332('0x10')]);router[_0x5332('0x8')](_0x5332('0x11'),auth[_0x5332('0x6')](),controller['openchannelQueues']);router['get'](_0x5332('0x12'),auth[_0x5332('0x6')](),controller[_0x5332('0x13')]);router[_0x5332('0x8')](_0x5332('0x14'),auth[_0x5332('0x6')](),controller[_0x5332('0x15')]);router[_0x5332('0x8')](_0x5332('0x16'),auth[_0x5332('0x6')](),controller[_0x5332('0x17')]);router[_0x5332('0x8')](_0x5332('0x18'),auth['isAuthenticated'](),controller[_0x5332('0x19')]);router['get'](_0x5332('0x1a'),auth[_0x5332('0x6')](),controller[_0x5332('0x1b')]);router[_0x5332('0x8')](_0x5332('0x1c'),auth['isAuthenticated'](),controller[_0x5332('0x1d')]);router[_0x5332('0x8')](_0x5332('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x5332('0x8')](_0x5332('0x1f'),auth[_0x5332('0x6')](),controller[_0x5332('0x20')]);router[_0x5332('0x8')](_0x5332('0x21'),auth['isAuthenticated'](),controller[_0x5332('0x22')]);router[_0x5332('0x23')](_0x5332('0x21'),auth[_0x5332('0x6')](),controller['updateVoiceQueue']);router['get'](_0x5332('0x24'),auth[_0x5332('0x6')](),controller[_0x5332('0x25')]);router['get'](_0x5332('0x26'),auth[_0x5332('0x6')](),controller[_0x5332('0x27')]);router[_0x5332('0x8')](_0x5332('0x28'),auth[_0x5332('0x6')](),controller['agents']);router[_0x5332('0x23')](_0x5332('0x29'),auth['isAuthenticated'](),controller[_0x5332('0x2a')]);router[_0x5332('0x8')](_0x5332('0x2b'),auth[_0x5332('0x6')](),controller[_0x5332('0x2c')]);router[_0x5332('0x8')](_0x5332('0x2d'),auth[_0x5332('0x6')](),controller[_0x5332('0x2e')]);router[_0x5332('0x8')](_0x5332('0x2f'),auth[_0x5332('0x6')](),controller[_0x5332('0x30')]);router[_0x5332('0x8')](_0x5332('0x31'),auth[_0x5332('0x6')](),controller['faxAccounts']);router[_0x5332('0x8')](_0x5332('0x32'),auth[_0x5332('0x6')](),controller[_0x5332('0x33')]);router[_0x5332('0x8')](_0x5332('0x34'),auth[_0x5332('0x6')](),controller[_0x5332('0x35')]);router[_0x5332('0x8')](_0x5332('0x36'),auth[_0x5332('0x6')](),controller[_0x5332('0x37')]);router[_0x5332('0x8')](_0x5332('0x38'),auth[_0x5332('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0x5332('0x6')](),controller[_0x5332('0x39')]);router[_0x5332('0x8')](_0x5332('0x3a'),auth[_0x5332('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x5332('0x8')](_0x5332('0x3b'),auth[_0x5332('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x5332('0x3c')](_0x5332('0x3d'),auth[_0x5332('0x6')](),controller[_0x5332('0x3e')](_0x5332('0x3f')));router[_0x5332('0x8')](_0x5332('0x40'),auth[_0x5332('0x6')](),controller[_0x5332('0x41')]);router[_0x5332('0x3c')](_0x5332('0x42'),auth[_0x5332('0x6')](),controller[_0x5332('0x3e')]('chat'));router['get']('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router['post'](_0x5332('0x43'),auth[_0x5332('0x6')](),controller['queueNotify']('fax'));router[_0x5332('0x8')](_0x5332('0x44'),auth[_0x5332('0x6')](),controller['showFaxQueues']);router['post'](_0x5332('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0x5332('0x46')));router[_0x5332('0x8')](_0x5332('0x47'),auth[_0x5332('0x6')](),controller[_0x5332('0x48')]);router[_0x5332('0x3c')]('/sms/queues/:id/notify',auth[_0x5332('0x6')](),controller['queueNotify'](_0x5332('0x49')));router[_0x5332('0x3c')]('/whatsapp/queues/:id/notify',auth[_0x5332('0x6')](),controller['queueNotify'](_0x5332('0x4a')));router[_0x5332('0x8')](_0x5332('0x4b'),auth[_0x5332('0x6')](),controller[_0x5332('0x4c')]);router[_0x5332('0x8')]('/whatsapp/queues/:id',auth[_0x5332('0x6')](),controller[_0x5332('0x4d')]);router[_0x5332('0x3c')]('/agents/:id/notify',auth[_0x5332('0x6')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index eab2167..a10b00a 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 _0xefee=['campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','uniq','value','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','Queue','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','InteractionId','From','QueueId','TransferReport','Start','*,*,*,*','agentNotify','channel','chat','User','findOne','update','agentTransferTimeout','bluebird','util','../../mysqldb','../../config/logger','client','http','then','error','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','MemberReport','INTERACTION','format','length','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks'];(function(_0x37d9b1,_0x358b0d){var _0x580044=function(_0x23530f){while(--_0x23530f){_0x37d9b1['push'](_0x37d9b1['shift']());}};_0x580044(++_0x358b0d);}(_0xefee,0x122));var _0xeefe=function(_0x3eac17,_0x44d549){_0x3eac17=_0x3eac17-0x0;var _0x19c279=_0xefee[_0x3eac17];return _0x19c279;};'use strict';var BPromise=require(_0xeefe('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0xeefe('0x1'));var db=require(_0xeefe('0x2'))['db'];var logger=require(_0xeefe('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0xeefe('0x4')][_0xeefe('0x5')]({'port':0x232a});var mailClient=jayson[_0xeefe('0x4')][_0xeefe('0x5')]({'port':0x232b});var routingClient=jayson[_0xeefe('0x4')][_0xeefe('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x5c00a0,_0x580baa,_0x55a7a6){return new BPromise(function(_0x12d49b,_0x376186){var _0x1dd21f=_0x55a7a6?_0x55a7a6:amiClient;return _0x1dd21f['request'](_0x5c00a0,_0x580baa)[_0xeefe('0x6')](function(_0x3ea393){if(_0x3ea393[_0xeefe('0x7')]){if(_0x3ea393[_0xeefe('0x7')]['code']===0x1f4){return _0x376186(_0x3ea393[_0xeefe('0x7')][_0xeefe('0x8')]);}return _0x12d49b(_0x3ea393[_0xeefe('0x7')]['message']);}else{_0x12d49b(_0x3ea393[_0xeefe('0x9')]);}})[_0xeefe('0xa')](function(_0x25103d){_0x376186(_0x25103d);});});}function respondWithResult(_0x428716,_0x14d6f8){_0x14d6f8=_0x14d6f8||0xc8;return function(_0x3d8192){if(_0x3d8192){return _0x428716[_0xeefe('0xb')](_0x14d6f8)['json'](_0x3d8192);}return _0x428716[_0xeefe('0xc')](0x194);};}function handleError(_0x577e42,_0x2004ef){_0x2004ef=_0x2004ef||0x1f4;return function(_0x2b7fad){logger[_0xeefe('0x7')](_0x2b7fad[_0xeefe('0xd')]);if(_0x2b7fad[_0xeefe('0xe')]){delete _0x2b7fad['name'];}_0x577e42[_0xeefe('0xb')](_0x2004ef)[_0xeefe('0xf')](_0x2b7fad);};}function findById(_0x4bd904){return function(_0x2a2ccd){if(!_[_0xeefe('0x10')](_0x4bd904)&&!_[_0xeefe('0x10')](_0x2a2ccd)&&!_['isNil'](_0x2a2ccd[_0xeefe('0x11')])){return _[_0xeefe('0x12')](_0x2a2ccd[_0xeefe('0x11')],function(_0x430d24){return _0x430d24['id']==_0x4bd904;});}return null;};}exports[_0xeefe('0x13')]=function(_0x3fc6c5,_0x1f76f0){return respondWithRpcPromise('VoiceChannels',_0x3fc6c5[_0xeefe('0x14')])['then'](respondWithResult(_0x1f76f0,null))['catch'](handleError(_0x1f76f0,null));};exports['voiceChannelMixMonitor']=function(_0x17fdd8,_0x3da503){return respondWithRpcPromise(_0xeefe('0x15'),_[_0xeefe('0x16')](_0x17fdd8['query'],_0x17fdd8['params']))[_0xeefe('0x6')](respondWithResult(_0x3da503,null))[_0xeefe('0xa')](handleError(_0x3da503,null));};exports[_0xeefe('0x17')]=function(_0x43fcc7,_0x5ab7b6){return respondWithRpcPromise(_0xeefe('0x18'),_[_0xeefe('0x16')](_0x43fcc7[_0xeefe('0x14')],_0x43fcc7[_0xeefe('0x19')]))['then'](respondWithResult(_0x5ab7b6,null))[_0xeefe('0xa')](handleError(_0x5ab7b6,null));};exports['voiceQueues']=function(_0x26a363,_0x2ad5d6){return respondWithRpcPromise(_0xeefe('0x1a'),_0x26a363['query'])[_0xeefe('0x6')](respondWithResult(_0x2ad5d6,null))[_0xeefe('0xa')](handleError(_0x2ad5d6,null));};exports[_0xeefe('0x1b')]=function(_0x3e7b02,_0x27cf79){return respondWithRpcPromise(_0xeefe('0x1a'),_0x3e7b02[_0xeefe('0x14')])[_0xeefe('0x6')](findById(_0x3e7b02[_0xeefe('0x19')]['id']))[_0xeefe('0x6')](respondWithResult(_0x27cf79,null))[_0xeefe('0xa')](handleError(_0x27cf79,null));};exports['updateVoiceQueue']=function(_0x1d6a53,_0x3f7c90){return respondWithRpcPromise(_0xeefe('0x1c'),_[_0xeefe('0x16')](_0x1d6a53[_0xeefe('0x1d')],_0x1d6a53[_0xeefe('0x19')]))[_0xeefe('0x6')](respondWithResult(_0x3f7c90,null))['catch'](handleError(_0x3f7c90,null));};exports[_0xeefe('0x1e')]=function(_0x17aacc,_0x2e4128){return respondWithRpcPromise(_0xeefe('0x1f'),_['merge'](_0x17aacc[_0xeefe('0x14')],_0x17aacc['params']))[_0xeefe('0x6')](respondWithResult(_0x2e4128,null))[_0xeefe('0xa')](handleError(_0x2e4128,null));};exports[_0xeefe('0x20')]=function(_0x4c369d,_0x258702){return respondWithRpcPromise(_0xeefe('0x21'),_0x4c369d[_0xeefe('0x14')])[_0xeefe('0x6')](respondWithResult(_0x258702,null))[_0xeefe('0xa')](handleError(_0x258702,null));};exports[_0xeefe('0x22')]=function(_0x56de1a,_0x2772c2){return respondWithRpcPromise(_0xeefe('0x23'),_[_0xeefe('0x16')](_0x56de1a[_0xeefe('0x14')],_0x56de1a[_0xeefe('0x19')]))[_0xeefe('0x6')](respondWithResult(_0x2772c2,null))['catch'](handleError(_0x2772c2,null));};exports[_0xeefe('0x24')]=function(_0x3681ba,_0x4e3c81){return respondWithRpcPromise(_0xeefe('0x25'),_[_0xeefe('0x16')](_0x3681ba[_0xeefe('0x14')],_0x3681ba[_0xeefe('0x19')]))['then'](respondWithResult(_0x4e3c81,null))[_0xeefe('0xa')](handleError(_0x4e3c81,null));};exports['voiceQueuesChannelRedirect']=function(_0x35b477,_0x48bbc9){return respondWithRpcPromise(_0xeefe('0x26'),_[_0xeefe('0x16')](_0x35b477['query'],_0x35b477[_0xeefe('0x19')]))[_0xeefe('0x6')](respondWithResult(_0x48bbc9,null))[_0xeefe('0xa')](handleError(_0x48bbc9,null));};exports[_0xeefe('0x27')]=function(_0xe4512,_0x46fbff){return respondWithRpcPromise('Outbound',_0xe4512[_0xeefe('0x14')])[_0xeefe('0x6')](respondWithResult(_0x46fbff,null))['catch'](handleError(_0x46fbff,null));};exports[_0xeefe('0x28')]=function(_0x18f91a,_0x3292a3){return respondWithRpcPromise(_0xeefe('0x29'),_0x18f91a[_0xeefe('0x14')])[_0xeefe('0x6')](respondWithResult(_0x3292a3,null))[_0xeefe('0xa')](handleError(_0x3292a3,null));};exports[_0xeefe('0x2a')]=function(_0x409365,_0x1d2f01){var _0x2913fc;return respondWithRpcPromise(_0xeefe('0x2b'),_0x409365[_0xeefe('0x14')])[_0xeefe('0x6')](function(_0x17d3b9){_0x2913fc=_0x17d3b9;return respondWithRpcPromise('Agents',_0x409365[_0xeefe('0x14')],routingClient);})[_0xeefe('0x6')](function(_0x22d4b4){return _[_0xeefe('0x16')]({},_0x22d4b4,_0x2913fc);})[_0xeefe('0x6')](respondWithResult(_0x1d2f01,null))[_0xeefe('0xa')](handleError(_0x1d2f01,null));};exports[_0xeefe('0x2c')]=function(_0x44750a,_0x1f1fbd){if(_0x44750a['body']&&_0x44750a[_0xeefe('0x1d')][_0xeefe('0x2d')]&&_0x44750a[_0xeefe('0x2e')]&&_0x44750a['user'][_0xeefe('0xe')]){for(var _0x27a7c3 in _0x44750a[_0xeefe('0x1d')]['interaction']){if(_0x44750a['body'][_0xeefe('0x2d')]['hasOwnProperty'](_0x27a7c3)){db[_0xeefe('0x2f')]['findAll']({'where':{'channel':_0x27a7c3,'membername':_0x44750a[_0xeefe('0x2e')][_0xeefe('0xe')],'type':_0xeefe('0x30'),'exitAt':null,'uniqueid':_0x44750a['body'][_0xeefe('0x2d')][_0x27a7c3]&&_0x44750a[_0xeefe('0x1d')][_0xeefe('0x2d')][_0x27a7c3]['length']?{'$notIn':_0x44750a['body'][_0xeefe('0x2d')][_0x27a7c3]}:{'$ne':null}}})['then'](function(_0xd5083e){var _0x53622e=moment()[_0xeefe('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4cf419=0x0,_0x1a52b0=_0xd5083e[_0xeefe('0x32')];_0x4cf419<_0x1a52b0;_0x4cf419+=0x1){_0xd5083e[_0x4cf419]['updateAttributes']({'exitAt':_0x53622e});}});for(var _0x38effa=0x0;_0x38effa<_0x44750a[_0xeefe('0x1d')][_0xeefe('0x2d')][_0x27a7c3][_0xeefe('0x32')];_0x38effa+=0x1){db[_0xeefe('0x2f')][_0xeefe('0x33')]({'where':{'channel':_0x27a7c3,'membername':_0x44750a['user'][_0xeefe('0xe')],'type':'INTERACTION','uniqueid':_0x44750a[_0xeefe('0x1d')][_0xeefe('0x2d')][_0x27a7c3][_0x38effa],'exitAt':null},'defaults':{'channel':_0x27a7c3,'membername':_0x44750a['user'][_0xeefe('0xe')],'interface':_[_0xeefe('0x10')](_0x44750a[_0xeefe('0x2e')][_0xeefe('0x34')])?util[_0xeefe('0x31')](_0xeefe('0x35'),_0x44750a[_0xeefe('0x2e')][_0xeefe('0xe')]):_0x44750a[_0xeefe('0x2e')][_0xeefe('0x34')],'type':'INTERACTION','enterAt':moment()[_0xeefe('0x31')](_0xeefe('0x36')),'role':_0xeefe('0x37'),'internal':_0x44750a[_0xeefe('0x2e')][_0xeefe('0x38')],'uniqueid':_0x44750a[_0xeefe('0x1d')]['interaction'][_0x27a7c3][_0x38effa]}});}}}}return respondWithRpcPromise(_0xeefe('0x39'),{'id':_0x44750a[_0xeefe('0x19')]['id'],'capacity':_0x44750a['body'][_0xeefe('0x3a')]},routingClient)[_0xeefe('0x6')](respondWithResult(_0x1f1fbd,null))[_0xeefe('0xa')](handleError(_0x1f1fbd,null));};exports['telephones']=function(_0x566c2c,_0xf736df){return respondWithRpcPromise(_0xeefe('0x3b'),_0x566c2c[_0xeefe('0x14')])['then'](respondWithResult(_0xf736df,null))[_0xeefe('0xa')](handleError(_0xf736df,null));};exports[_0xeefe('0x3c')]=function(_0x1dd8e9,_0x2845ea){return respondWithRpcPromise('Trunks',_0x1dd8e9[_0xeefe('0x14')])['then'](respondWithResult(_0x2845ea,null))['catch'](handleError(_0x2845ea,null));};exports[_0xeefe('0x3d')]=function(_0x3b92e0,_0x5f2ee6){return respondWithRpcPromise(_0xeefe('0x3e'),_0x3b92e0[_0xeefe('0x14')])[_0xeefe('0x6')](respondWithResult(_0x5f2ee6,null))[_0xeefe('0xa')](handleError(_0x5f2ee6,null));};exports[_0xeefe('0x3f')]=function(_0x5830a2,_0x431612){return respondWithRpcPromise('ChatQueues',_0x5830a2[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](respondWithResult(_0x431612,null))[_0xeefe('0xa')](handleError(_0x431612,null));};exports[_0xeefe('0x40')]=function(_0x3a74ac,_0x17203c){return respondWithRpcPromise(_0xeefe('0x41'),_0x3a74ac[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](findById(_0x3a74ac[_0xeefe('0x19')]['id']))['then'](respondWithResult(_0x17203c,null))[_0xeefe('0xa')](handleError(_0x17203c,null));};exports[_0xeefe('0x42')]=function(_0x151a1f,_0x44bc81){return respondWithRpcPromise(_0xeefe('0x43'),_0x151a1f[_0xeefe('0x14')],routingClient)['then'](respondWithResult(_0x44bc81,null))[_0xeefe('0xa')](handleError(_0x44bc81,null));};exports[_0xeefe('0x44')]=function(_0x263bad,_0x2898b8){return respondWithRpcPromise(_0xeefe('0x43'),_0x263bad[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](findById(_0x263bad[_0xeefe('0x19')]['id']))[_0xeefe('0x6')](respondWithResult(_0x2898b8,null))[_0xeefe('0xa')](handleError(_0x2898b8,null));};exports['mailAccounts']=function(_0x334cf5,_0x46b5f9){return respondWithRpcPromise('MailAccounts',_0x334cf5[_0xeefe('0x14')],mailClient)['then'](respondWithResult(_0x46b5f9,null))[_0xeefe('0xa')](handleError(_0x46b5f9,null));};exports[_0xeefe('0x45')]=function(_0x29b15f,_0xda826){return respondWithRpcPromise(_0xeefe('0x46'),_0x29b15f[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](respondWithResult(_0xda826,null))[_0xeefe('0xa')](handleError(_0xda826,null));};exports[_0xeefe('0x47')]=function(_0x5784c8,_0x3e16a2){return respondWithRpcPromise(_0xeefe('0x46'),_0x5784c8[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](findById(_0x5784c8[_0xeefe('0x19')]['id']))['then'](respondWithResult(_0x3e16a2,null))[_0xeefe('0xa')](handleError(_0x3e16a2,null));};exports[_0xeefe('0x48')]=function(_0x241908,_0x28721f){return respondWithRpcPromise(_0xeefe('0x49'),_0x241908['query'],routingClient)[_0xeefe('0x6')](respondWithResult(_0x28721f,null))[_0xeefe('0xa')](handleError(_0x28721f,null));};exports[_0xeefe('0x4a')]=function(_0x3c4428,_0x42f5c2){return respondWithRpcPromise(_0xeefe('0x49'),_0x3c4428[_0xeefe('0x14')],routingClient)['then'](findById(_0x3c4428[_0xeefe('0x19')]['id']))[_0xeefe('0x6')](respondWithResult(_0x42f5c2,null))[_0xeefe('0xa')](handleError(_0x42f5c2,null));};exports[_0xeefe('0x4b')]=function(_0x41d534,_0x196de6){return respondWithRpcPromise(_0xeefe('0x4c'),_0x41d534[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](respondWithResult(_0x196de6,null))[_0xeefe('0xa')](handleError(_0x196de6,null));};exports[_0xeefe('0x4d')]=function(_0x1710d9,_0x30311c){return respondWithRpcPromise('WhatsappQueues',_0x1710d9['query'],routingClient)[_0xeefe('0x6')](findById(_0x1710d9[_0xeefe('0x19')]['id']))[_0xeefe('0x6')](respondWithResult(_0x30311c,null))[_0xeefe('0xa')](handleError(_0x30311c,null));};exports['faxQueues']=function(_0x354943,_0x9fe650){return respondWithRpcPromise(_0xeefe('0x4e'),_0x354943[_0xeefe('0x14')],routingClient)['then'](respondWithResult(_0x9fe650,null))[_0xeefe('0xa')](handleError(_0x9fe650,null));};exports[_0xeefe('0x4f')]=function(_0x3daef7,_0x30546e){return respondWithRpcPromise('FaxQueues',_0x3daef7[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](findById(_0x3daef7[_0xeefe('0x19')]['id']))[_0xeefe('0x6')](respondWithResult(_0x30546e,null))['catch'](handleError(_0x30546e,null));};exports[_0xeefe('0x50')]=function(_0x3bfe2a,_0xcd3aa2){return respondWithRpcPromise(_0xeefe('0x51'),_0x3bfe2a[_0xeefe('0x14')])['then'](respondWithResult(_0xcd3aa2,null))['catch'](handleError(_0xcd3aa2,null));};exports[_0xeefe('0x52')]=function(_0x4f4809,_0xbd9cdb){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4f4809['query'],routingClient)['then'](respondWithResult(_0xbd9cdb,null))[_0xeefe('0xa')](handleError(_0xbd9cdb,null));};exports[_0xeefe('0x53')]=function(_0x5d2ac0,_0x3dea6f){return respondWithRpcPromise(_0xeefe('0x54'),_0x5d2ac0[_0xeefe('0x14')],routingClient)['then'](respondWithResult(_0x3dea6f,null))[_0xeefe('0xa')](handleError(_0x3dea6f,null));};exports[_0xeefe('0x55')]=function(_0x235717,_0x49c8db){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x235717['query'],routingClient)['then'](respondWithResult(_0x49c8db,null))[_0xeefe('0xa')](handleError(_0x49c8db,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x35c980,_0x18b193){return respondWithRpcPromise(_0xeefe('0x56'),_0x35c980[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](function(_0x357df0){if(_0x35c980['query'][_0xeefe('0x57')]!==undefined){var _0x462592=_(_0x357df0[_0xeefe('0x11')])['filter']([_0x35c980[_0xeefe('0x14')][_0xeefe('0x57')],_0x35c980[_0xeefe('0x19')]['id']])[_0xeefe('0x58')]('queue_id')[_0xeefe('0x59')]()[_0xeefe('0x5a')]();return _0x357df0['rows']['filter'](function(_0x6ce027){return _0x462592[_0xeefe('0x5b')](_0x6ce027[_0xeefe('0x5c')])>-0x1;});}else{return _0x357df0[_0xeefe('0x11')]['filter'](function(_0xf3a3d2){return _0xf3a3d2[_0xeefe('0x5c')]===parseInt(_0x35c980[_0xeefe('0x19')]['id']);});}})[_0xeefe('0x6')](respondWithResult(_0x18b193,null))[_0xeefe('0xa')](handleError(_0x18b193,null));};exports['smsQueuesWaitingInteractions']=function(_0x4448f6,_0x48b606){return respondWithRpcPromise(_0xeefe('0x5d'),_0x4448f6[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](respondWithResult(_0x48b606,null))[_0xeefe('0xa')](handleError(_0x48b606,null));};exports[_0xeefe('0x5e')]=function(_0x3736a7,_0x55b3d5){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3736a7['query'],routingClient)[_0xeefe('0x6')](respondWithResult(_0x55b3d5,null))[_0xeefe('0xa')](handleError(_0x55b3d5,null));};exports[_0xeefe('0x5f')]=function(_0x27b892,_0xbee2bc){return respondWithRpcPromise(_0xeefe('0x60'),_0x27b892[_0xeefe('0x14')],routingClient)[_0xeefe('0x6')](respondWithResult(_0xbee2bc,null))[_0xeefe('0xa')](handleError(_0xbee2bc,null));};exports[_0xeefe('0x61')]=function(_0x3feaeb){return function(_0x18d656,_0xc74b16){var _0x40bb72,_0x46562f;var _0x579b24=_['capitalize'](_0x3feaeb);var _0x39b291=_0x3feaeb==='chat'?'Website':'Account';return db[_0x579b24+_0xeefe('0x62')]['findOne']({'raw':!![],'where':{'id':_0x18d656[_0xeefe('0x19')]['id']}})[_0xeefe('0x6')](function(_0x268873){if(_['isNil'](_0x268873)){throw new Error(_0x579b24+_0xeefe('0x63'));}_0x40bb72=_0x268873;return db[_0x579b24+'Message']['findOne']({'where':{'id':_0x18d656['body'][_0xeefe('0x64')]},'include':[{'model':db[_0x579b24+'Interaction'],'as':_0xeefe('0x65')},{'model':db[_0x579b24+_0x39b291],'as':_0xeefe('0x66')}]});})['then'](function(_0x132f59){if(_[_0xeefe('0x10')](_0x132f59)){throw new Error(_0x579b24+_0xeefe('0x67'));}_0x46562f=_0x132f59;return _0x132f59['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xeefe('0x6')](function(){var _0x18f1c9={'uniqueid':_0x3feaeb+'.'+_0x46562f['id']+'.'+_0x46562f['Interaction']['id'],'FromUserId':_0x18d656['user']['id'],'type':'queue'};_0x18f1c9[_0x579b24+'MessageId']=_0x46562f['id'];_0x18f1c9[_0x579b24+_0xeefe('0x68')]=_0x46562f['Interaction']['id'];_0x18f1c9[_0xeefe('0x69')+_0x579b24+_0x39b291+'Id']=_0x46562f[_0xeefe('0x66')]['id'];_0x18f1c9['To'+_0x579b24+_0xeefe('0x6a')]=_0x40bb72['id'];return db[_0x579b24+_0xeefe('0x6b')]['create'](_0x18f1c9);})[_0xeefe('0x6')](function(){return respondWithRpcPromise(_0xeefe('0x6c'),{'channel':_0x3feaeb,'interaction':_0x46562f['Interaction'],'message':_0x46562f,'account':_0x46562f[_0xeefe('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x40bb72[_0xeefe('0xe')]+','+(_0x46562f[_0xeefe('0x66')]['queueTransferTimeout']||0x12c),'interval':_0xeefe('0x6d')}]},routingClient);})[_0xeefe('0x6')](respondWithResult(_0xc74b16,null))[_0xeefe('0xa')](handleError(_0xc74b16,null));};};exports[_0xeefe('0x6e')]=function(_0x4576eb,_0x41b000){var _0x4c0d76,_0x4dedbb;if(_[_0xeefe('0x10')](_0x4576eb[_0xeefe('0x1d')][_0xeefe('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x20f65b=_0x4576eb['body'][_0xeefe('0x6f')];var _0x24b909=_['capitalize'](_0x20f65b);var _0x572182=_0x20f65b===_0xeefe('0x70')?'Website':_0xeefe('0x66');return db[_0xeefe('0x71')][_0xeefe('0x72')]({'raw':!![],'where':{'id':_0x4576eb[_0xeefe('0x19')]['id'],'role':_0xeefe('0x37')}})['then'](function(_0x197660){if(_[_0xeefe('0x10')](_0x197660)){throw new Error('Agent\x20not\x20found');}_0x4c0d76=_0x197660;return db[_0x24b909+'Message'][_0xeefe('0x72')]({'where':{'id':_0x4576eb[_0xeefe('0x1d')][_0xeefe('0x64')]},'include':[{'model':db[_0x24b909+'Interaction'],'as':_0xeefe('0x65')},{'model':db[_0x24b909+_0x572182],'as':_0xeefe('0x66')}]});})[_0xeefe('0x6')](function(_0x23fb39){if(_['isNil'](_0x23fb39)){throw new Error(_0x24b909+'\x20Message\x20not\x20found');}_0x4dedbb=_0x23fb39;return _0x23fb39[_0xeefe('0x73')]({'read':0x0,'readAt':null,'UserId':null});})[_0xeefe('0x6')](function(){var _0x1abe0d={'uniqueid':_0x20f65b+'.'+_0x4dedbb['id']+'.'+_0x4dedbb[_0xeefe('0x65')]['id'],'FromUserId':_0x4576eb[_0xeefe('0x2e')]['id'],'type':_0xeefe('0x37'),'ToUserId':_0x4c0d76['id']};_0x1abe0d[_0x24b909+'MessageId']=_0x4dedbb['id'];_0x1abe0d[_0x24b909+_0xeefe('0x68')]=_0x4dedbb[_0xeefe('0x65')]['id'];_0x1abe0d[_0xeefe('0x69')+_0x24b909+_0x572182+'Id']=_0x4dedbb[_0xeefe('0x66')]['id'];return db[_0x24b909+'TransferReport']['create'](_0x1abe0d);})[_0xeefe('0x6')](function(){return respondWithRpcPromise('Start',{'channel':_0x20f65b,'interaction':_0x4dedbb['Interaction'],'message':_0x4dedbb,'account':_0x4dedbb[_0xeefe('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0xeefe('0x37'),'appdata':_0x4c0d76[_0xeefe('0xe')]+','+(_0x4dedbb[_0xeefe('0x66')][_0xeefe('0x74')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xeefe('0x6')](respondWithResult(_0x41b000,null))[_0xeefe('0xa')](handleError(_0x41b000,null));}; \ No newline at end of file +var _0xd14a=['mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','From','*,*,*,*','bluebird','moment','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','status','json','name','send','isNil','find','rows','VoiceChannels','query','catch','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','outbound','outboundChannels','agents','Agents','agentCapacity','user','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','AgentCapacity','telephones','Telephones','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues'];(function(_0x3d2896,_0x56cff1){var _0x3ea7ef=function(_0x1ccbeb){while(--_0x1ccbeb){_0x3d2896['push'](_0x3d2896['shift']());}};_0x3ea7ef(++_0x56cff1);}(_0xd14a,0x1a8));var _0xad14=function(_0x4cac0e,_0x4d314c){_0x4cac0e=_0x4cac0e-0x0;var _0xb731e9=_0xd14a[_0x4cac0e];return _0xb731e9;};'use strict';var BPromise=require(_0xad14('0x0'));var moment=require(_0xad14('0x1'));var _=require('lodash');var util=require(_0xad14('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xad14('0x3'))(_0xad14('0x4'));var jayson=require(_0xad14('0x5'));var amiClient=jayson[_0xad14('0x6')][_0xad14('0x7')]({'port':0x232a});var mailClient=jayson[_0xad14('0x6')][_0xad14('0x7')]({'port':0x232b});var routingClient=jayson[_0xad14('0x6')][_0xad14('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x22c43b,_0x1ce276,_0x39172f){return new BPromise(function(_0x43ce89,_0x518990){var _0x370e21=_0x39172f?_0x39172f:amiClient;return _0x370e21[_0xad14('0x8')](_0x22c43b,_0x1ce276)[_0xad14('0x9')](function(_0x2ee049){if(_0x2ee049[_0xad14('0xa')]){if(_0x2ee049['error'][_0xad14('0xb')]===0x1f4){return _0x518990(_0x2ee049[_0xad14('0xa')][_0xad14('0xc')]);}return _0x43ce89(_0x2ee049['error'][_0xad14('0xc')]);}else{_0x43ce89(_0x2ee049[_0xad14('0xd')]);}})['catch'](function(_0x1ace66){_0x518990(_0x1ace66);});});}function respondWithResult(_0x6fbbbf,_0x150ce0){_0x150ce0=_0x150ce0||0xc8;return function(_0x25d397){if(_0x25d397){return _0x6fbbbf[_0xad14('0xe')](_0x150ce0)[_0xad14('0xf')](_0x25d397);}return _0x6fbbbf['sendStatus'](0x194);};}function handleError(_0x3a32c1,_0xc069d4){_0xc069d4=_0xc069d4||0x1f4;return function(_0x242c82){logger[_0xad14('0xa')](_0x242c82['stack']);if(_0x242c82[_0xad14('0x10')]){delete _0x242c82[_0xad14('0x10')];}_0x3a32c1[_0xad14('0xe')](_0xc069d4)[_0xad14('0x11')](_0x242c82);};}function findById(_0x334d8b){return function(_0x36d672){if(!_['isNil'](_0x334d8b)&&!_[_0xad14('0x12')](_0x36d672)&&!_[_0xad14('0x12')](_0x36d672['rows'])){return _[_0xad14('0x13')](_0x36d672[_0xad14('0x14')],function(_0x45dc4b){return _0x45dc4b['id']==_0x334d8b;});}return null;};}exports['voiceChannels']=function(_0x1e4231,_0x1720d4){return respondWithRpcPromise(_0xad14('0x15'),_0x1e4231[_0xad14('0x16')])[_0xad14('0x9')](respondWithResult(_0x1720d4,null))[_0xad14('0x17')](handleError(_0x1720d4,null));};exports['voiceChannelMixMonitor']=function(_0x5e90ce,_0x5bf1cb){return respondWithRpcPromise(_0xad14('0x18'),_['merge'](_0x5e90ce[_0xad14('0x16')],_0x5e90ce[_0xad14('0x19')]))['then'](respondWithResult(_0x5bf1cb,null))['catch'](handleError(_0x5bf1cb,null));};exports[_0xad14('0x1a')]=function(_0x281816,_0x5daf24){return respondWithRpcPromise(_0xad14('0x1b'),_[_0xad14('0x1c')](_0x281816['query'],_0x281816[_0xad14('0x19')]))[_0xad14('0x9')](respondWithResult(_0x5daf24,null))[_0xad14('0x17')](handleError(_0x5daf24,null));};exports[_0xad14('0x1d')]=function(_0x88995c,_0x59cc30){return respondWithRpcPromise(_0xad14('0x1e'),_0x88995c[_0xad14('0x16')])[_0xad14('0x9')](respondWithResult(_0x59cc30,null))[_0xad14('0x17')](handleError(_0x59cc30,null));};exports[_0xad14('0x1f')]=function(_0x393aab,_0x6e711f){return respondWithRpcPromise(_0xad14('0x1e'),_0x393aab['query'])['then'](findById(_0x393aab[_0xad14('0x19')]['id']))[_0xad14('0x9')](respondWithResult(_0x6e711f,null))[_0xad14('0x17')](handleError(_0x6e711f,null));};exports[_0xad14('0x20')]=function(_0xcfb0f0,_0x3e13ae){return respondWithRpcPromise(_0xad14('0x21'),_['merge'](_0xcfb0f0[_0xad14('0x22')],_0xcfb0f0[_0xad14('0x19')]))[_0xad14('0x9')](respondWithResult(_0x3e13ae,null))[_0xad14('0x17')](handleError(_0x3e13ae,null));};exports[_0xad14('0x23')]=function(_0x364142,_0x191291){return respondWithRpcPromise(_0xad14('0x24'),_['merge'](_0x364142[_0xad14('0x16')],_0x364142[_0xad14('0x19')]))['then'](respondWithResult(_0x191291,null))[_0xad14('0x17')](handleError(_0x191291,null));};exports[_0xad14('0x25')]=function(_0x4235bc,_0x109d0f){return respondWithRpcPromise('VoiceQueuesChannels',_0x4235bc[_0xad14('0x16')])['then'](respondWithResult(_0x109d0f,null))['catch'](handleError(_0x109d0f,null));};exports[_0xad14('0x26')]=function(_0x4dd6b6,_0x5efbbd){return respondWithRpcPromise(_0xad14('0x27'),_[_0xad14('0x1c')](_0x4dd6b6[_0xad14('0x16')],_0x4dd6b6[_0xad14('0x19')]))['then'](respondWithResult(_0x5efbbd,null))[_0xad14('0x17')](handleError(_0x5efbbd,null));};exports['voiceQueuesChannelHangup']=function(_0x1a7ff5,_0x105fab){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xad14('0x1c')](_0x1a7ff5[_0xad14('0x16')],_0x1a7ff5[_0xad14('0x19')]))[_0xad14('0x9')](respondWithResult(_0x105fab,null))[_0xad14('0x17')](handleError(_0x105fab,null));};exports['voiceQueuesChannelRedirect']=function(_0x44db42,_0x4e592b){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xad14('0x1c')](_0x44db42['query'],_0x44db42[_0xad14('0x19')]))[_0xad14('0x9')](respondWithResult(_0x4e592b,null))[_0xad14('0x17')](handleError(_0x4e592b,null));};exports[_0xad14('0x28')]=function(_0x36b80b,_0x2400f3){return respondWithRpcPromise('Outbound',_0x36b80b[_0xad14('0x16')])[_0xad14('0x9')](respondWithResult(_0x2400f3,null))[_0xad14('0x17')](handleError(_0x2400f3,null));};exports[_0xad14('0x29')]=function(_0x3c3123,_0x4e066d){return respondWithRpcPromise('OutboundChannels',_0x3c3123[_0xad14('0x16')])[_0xad14('0x9')](respondWithResult(_0x4e066d,null))[_0xad14('0x17')](handleError(_0x4e066d,null));};exports[_0xad14('0x2a')]=function(_0x5edef7,_0x16d5fd){var _0x2bd712;return respondWithRpcPromise(_0xad14('0x2b'),_0x5edef7[_0xad14('0x16')])['then'](function(_0x55bae5){_0x2bd712=_0x55bae5;return respondWithRpcPromise(_0xad14('0x2b'),_0x5edef7[_0xad14('0x16')],routingClient);})['then'](function(_0x1c967c){return _[_0xad14('0x1c')]({},_0x1c967c,_0x2bd712);})[_0xad14('0x9')](respondWithResult(_0x16d5fd,null))[_0xad14('0x17')](handleError(_0x16d5fd,null));};exports[_0xad14('0x2c')]=function(_0x1f74c4,_0x4a3d75){if(_0x1f74c4[_0xad14('0x22')]&&_0x1f74c4['body']['interaction']&&_0x1f74c4[_0xad14('0x2d')]&&_0x1f74c4[_0xad14('0x2d')][_0xad14('0x10')]){for(var _0x54f7f0 in _0x1f74c4['body'][_0xad14('0x2e')]){if(_0x1f74c4[_0xad14('0x22')]['interaction']['hasOwnProperty'](_0x54f7f0)){db[_0xad14('0x2f')][_0xad14('0x30')]({'where':{'channel':_0x54f7f0,'membername':_0x1f74c4['user'][_0xad14('0x10')],'type':_0xad14('0x31'),'exitAt':null,'uniqueid':_0x1f74c4[_0xad14('0x22')]['interaction'][_0x54f7f0]&&_0x1f74c4['body'][_0xad14('0x2e')][_0x54f7f0][_0xad14('0x32')]?{'$notIn':_0x1f74c4['body']['interaction'][_0x54f7f0]}:{'$ne':null}}})[_0xad14('0x9')](function(_0x2347de){var _0x3d018f=moment()[_0xad14('0x33')](_0xad14('0x34'));for(var _0x4c2a23=0x0,_0x1e2209=_0x2347de[_0xad14('0x32')];_0x4c2a23<_0x1e2209;_0x4c2a23+=0x1){_0x2347de[_0x4c2a23]['updateAttributes']({'exitAt':_0x3d018f});}});for(var _0xbafe34=0x0;_0xbafe34<_0x1f74c4[_0xad14('0x22')][_0xad14('0x2e')][_0x54f7f0][_0xad14('0x32')];_0xbafe34+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x54f7f0,'membername':_0x1f74c4[_0xad14('0x2d')][_0xad14('0x10')],'type':_0xad14('0x31'),'uniqueid':_0x1f74c4['body']['interaction'][_0x54f7f0][_0xbafe34],'exitAt':null},'defaults':{'channel':_0x54f7f0,'membername':_0x1f74c4[_0xad14('0x2d')]['name'],'interface':_[_0xad14('0x12')](_0x1f74c4['user'][_0xad14('0x35')])?util[_0xad14('0x33')]('SIP/%s',_0x1f74c4[_0xad14('0x2d')]['name']):_0x1f74c4[_0xad14('0x2d')][_0xad14('0x35')],'type':_0xad14('0x31'),'enterAt':moment()[_0xad14('0x33')](_0xad14('0x34')),'role':_0xad14('0x36'),'internal':_0x1f74c4[_0xad14('0x2d')][_0xad14('0x37')],'uniqueid':_0x1f74c4[_0xad14('0x22')][_0xad14('0x2e')][_0x54f7f0][_0xbafe34]}});}}}}return respondWithRpcPromise(_0xad14('0x38'),{'id':_0x1f74c4[_0xad14('0x19')]['id'],'capacity':_0x1f74c4['body']['capacity']},routingClient)[_0xad14('0x9')](respondWithResult(_0x4a3d75,null))['catch'](handleError(_0x4a3d75,null));};exports[_0xad14('0x39')]=function(_0xad1f2,_0x372b40){return respondWithRpcPromise(_0xad14('0x3a'),_0xad1f2['query'])[_0xad14('0x9')](respondWithResult(_0x372b40,null))['catch'](handleError(_0x372b40,null));};exports['trunks']=function(_0x596e35,_0x15f507){return respondWithRpcPromise('Trunks',_0x596e35[_0xad14('0x16')])[_0xad14('0x9')](respondWithResult(_0x15f507,null))[_0xad14('0x17')](handleError(_0x15f507,null));};exports[_0xad14('0x3b')]=function(_0x450803,_0x5bd5f7){return respondWithRpcPromise(_0xad14('0x3c'),_0x450803[_0xad14('0x16')])[_0xad14('0x9')](respondWithResult(_0x5bd5f7,null))[_0xad14('0x17')](handleError(_0x5bd5f7,null));};exports[_0xad14('0x3d')]=function(_0x2a1374,_0x3d5f59){return respondWithRpcPromise('ChatQueues',_0x2a1374['query'],routingClient)[_0xad14('0x9')](respondWithResult(_0x3d5f59,null))['catch'](handleError(_0x3d5f59,null));};exports[_0xad14('0x3e')]=function(_0x144ea4,_0x130389){return respondWithRpcPromise(_0xad14('0x3f'),_0x144ea4[_0xad14('0x16')],routingClient)[_0xad14('0x9')](findById(_0x144ea4[_0xad14('0x19')]['id']))[_0xad14('0x9')](respondWithResult(_0x130389,null))[_0xad14('0x17')](handleError(_0x130389,null));};exports[_0xad14('0x40')]=function(_0x3b9de2,_0x1b133b){return respondWithRpcPromise(_0xad14('0x41'),_0x3b9de2[_0xad14('0x16')],routingClient)[_0xad14('0x9')](respondWithResult(_0x1b133b,null))[_0xad14('0x17')](handleError(_0x1b133b,null));};exports[_0xad14('0x42')]=function(_0x558cbb,_0x52af06){return respondWithRpcPromise('MailQueues',_0x558cbb['query'],routingClient)['then'](findById(_0x558cbb[_0xad14('0x19')]['id']))[_0xad14('0x9')](respondWithResult(_0x52af06,null))[_0xad14('0x17')](handleError(_0x52af06,null));};exports[_0xad14('0x43')]=function(_0x2702b8,_0x243179){return respondWithRpcPromise(_0xad14('0x44'),_0x2702b8[_0xad14('0x16')],mailClient)[_0xad14('0x9')](respondWithResult(_0x243179,null))['catch'](handleError(_0x243179,null));};exports[_0xad14('0x45')]=function(_0x3769d5,_0x1f62c8){return respondWithRpcPromise(_0xad14('0x46'),_0x3769d5[_0xad14('0x16')],routingClient)['then'](respondWithResult(_0x1f62c8,null))['catch'](handleError(_0x1f62c8,null));};exports[_0xad14('0x47')]=function(_0x5b333b,_0x13ab1a){return respondWithRpcPromise(_0xad14('0x46'),_0x5b333b[_0xad14('0x16')],routingClient)[_0xad14('0x9')](findById(_0x5b333b[_0xad14('0x19')]['id']))[_0xad14('0x9')](respondWithResult(_0x13ab1a,null))['catch'](handleError(_0x13ab1a,null));};exports[_0xad14('0x48')]=function(_0x58ed97,_0x392943){return respondWithRpcPromise(_0xad14('0x49'),_0x58ed97['query'],routingClient)[_0xad14('0x9')](respondWithResult(_0x392943,null))[_0xad14('0x17')](handleError(_0x392943,null));};exports[_0xad14('0x4a')]=function(_0x1f85ad,_0x4538ef){return respondWithRpcPromise(_0xad14('0x49'),_0x1f85ad['query'],routingClient)['then'](findById(_0x1f85ad[_0xad14('0x19')]['id']))[_0xad14('0x9')](respondWithResult(_0x4538ef,null))['catch'](handleError(_0x4538ef,null));};exports[_0xad14('0x4b')]=function(_0x17048b,_0x126558){return respondWithRpcPromise(_0xad14('0x4c'),_0x17048b[_0xad14('0x16')],routingClient)[_0xad14('0x9')](respondWithResult(_0x126558,null))[_0xad14('0x17')](handleError(_0x126558,null));};exports['showWhatsappQueues']=function(_0x119f76,_0x573126){return respondWithRpcPromise(_0xad14('0x4c'),_0x119f76[_0xad14('0x16')],routingClient)[_0xad14('0x9')](findById(_0x119f76[_0xad14('0x19')]['id']))['then'](respondWithResult(_0x573126,null))[_0xad14('0x17')](handleError(_0x573126,null));};exports[_0xad14('0x4d')]=function(_0x5f1706,_0x4b9669){return respondWithRpcPromise(_0xad14('0x4e'),_0x5f1706[_0xad14('0x16')],routingClient)['then'](respondWithResult(_0x4b9669,null))[_0xad14('0x17')](handleError(_0x4b9669,null));};exports[_0xad14('0x4f')]=function(_0x2fa423,_0x12b358){return respondWithRpcPromise(_0xad14('0x4e'),_0x2fa423[_0xad14('0x16')],routingClient)[_0xad14('0x9')](findById(_0x2fa423[_0xad14('0x19')]['id']))[_0xad14('0x9')](respondWithResult(_0x12b358,null))[_0xad14('0x17')](handleError(_0x12b358,null));};exports['faxAccounts']=function(_0x3895c0,_0x8586d4){return respondWithRpcPromise('FaxAccounts',_0x3895c0[_0xad14('0x16')])['then'](respondWithResult(_0x8586d4,null))[_0xad14('0x17')](handleError(_0x8586d4,null));};exports[_0xad14('0x50')]=function(_0x2fb9ae,_0x389f4c){return respondWithRpcPromise(_0xad14('0x51'),_0x2fb9ae[_0xad14('0x16')],routingClient)[_0xad14('0x9')](respondWithResult(_0x389f4c,null))[_0xad14('0x17')](handleError(_0x389f4c,null));};exports[_0xad14('0x52')]=function(_0x155d0a,_0x11e76f){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x155d0a[_0xad14('0x16')],routingClient)[_0xad14('0x9')](respondWithResult(_0x11e76f,null))[_0xad14('0x17')](handleError(_0x11e76f,null));};exports[_0xad14('0x53')]=function(_0x58b6a6,_0x42ad85){return respondWithRpcPromise(_0xad14('0x54'),_0x58b6a6['query'],routingClient)[_0xad14('0x9')](respondWithResult(_0x42ad85,null))['catch'](handleError(_0x42ad85,null));};exports[_0xad14('0x55')]=function(_0x5f2af8,_0x12e074){return respondWithRpcPromise(_0xad14('0x54'),_0x5f2af8[_0xad14('0x16')],routingClient)[_0xad14('0x9')](function(_0x191537){if(_0x5f2af8[_0xad14('0x16')][_0xad14('0x56')]!==undefined){var _0x52f7aa=_(_0x191537[_0xad14('0x14')])[_0xad14('0x57')]([_0x5f2af8['query'][_0xad14('0x56')],_0x5f2af8[_0xad14('0x19')]['id']])[_0xad14('0x58')](_0xad14('0x59'))[_0xad14('0x5a')]()[_0xad14('0x5b')]();return _0x191537[_0xad14('0x14')][_0xad14('0x57')](function(_0x5db454){return _0x52f7aa['indexOf'](_0x5db454[_0xad14('0x59')])>-0x1;});}else{return _0x191537[_0xad14('0x14')]['filter'](function(_0x185e01){return _0x185e01['queue_id']===parseInt(_0x5f2af8[_0xad14('0x19')]['id']);});}})[_0xad14('0x9')](respondWithResult(_0x12e074,null))[_0xad14('0x17')](handleError(_0x12e074,null));};exports[_0xad14('0x5c')]=function(_0x141e8d,_0x1923e4){return respondWithRpcPromise(_0xad14('0x5d'),_0x141e8d[_0xad14('0x16')],routingClient)[_0xad14('0x9')](respondWithResult(_0x1923e4,null))['catch'](handleError(_0x1923e4,null));};exports[_0xad14('0x5e')]=function(_0x25447d,_0x1af44e){return respondWithRpcPromise(_0xad14('0x5f'),_0x25447d[_0xad14('0x16')],routingClient)[_0xad14('0x9')](respondWithResult(_0x1af44e,null))[_0xad14('0x17')](handleError(_0x1af44e,null));};exports[_0xad14('0x60')]=function(_0x3f8937,_0x168065){return respondWithRpcPromise(_0xad14('0x61'),_0x3f8937[_0xad14('0x16')],routingClient)['then'](respondWithResult(_0x168065,null))[_0xad14('0x17')](handleError(_0x168065,null));};exports[_0xad14('0x62')]=function(_0x67eafb){return function(_0x34a624,_0x199944){var _0xf7c2c,_0x3d09c6;var _0x509c5b=_[_0xad14('0x63')](_0x67eafb);var _0x107633=_0x67eafb==='chat'?_0xad14('0x64'):'Account';return db[_0x509c5b+'Queue']['findOne']({'raw':!![],'where':{'id':_0x34a624[_0xad14('0x19')]['id']}})[_0xad14('0x9')](function(_0x3fb294){if(_[_0xad14('0x12')](_0x3fb294)){throw new Error(_0x509c5b+'\x20Queue\x20not\x20found');}_0xf7c2c=_0x3fb294;return db[_0x509c5b+_0xad14('0x65')][_0xad14('0x66')]({'where':{'id':_0x34a624[_0xad14('0x22')][_0xad14('0x67')]},'include':[{'model':db[_0x509c5b+'Interaction'],'as':_0xad14('0x68')},{'model':db[_0x509c5b+_0x107633],'as':_0xad14('0x69')}]});})[_0xad14('0x9')](function(_0x404b99){if(_['isNil'](_0x404b99)){throw new Error(_0x509c5b+_0xad14('0x6a'));}_0x3d09c6=_0x404b99;return _0x404b99[_0xad14('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xad14('0x9')](function(){var _0x53b572={'uniqueid':_0x67eafb+'.'+_0x3d09c6['id']+'.'+_0x3d09c6['Interaction']['id'],'FromUserId':_0x34a624['user']['id'],'type':_0xad14('0x6c')};_0x53b572[_0x509c5b+_0xad14('0x6d')]=_0x3d09c6['id'];_0x53b572[_0x509c5b+_0xad14('0x6e')]=_0x3d09c6['Interaction']['id'];_0x53b572['From'+_0x509c5b+_0x107633+'Id']=_0x3d09c6[_0xad14('0x69')]['id'];_0x53b572['To'+_0x509c5b+_0xad14('0x6f')]=_0xf7c2c['id'];return db[_0x509c5b+_0xad14('0x70')][_0xad14('0x71')](_0x53b572);})[_0xad14('0x9')](function(){return respondWithRpcPromise(_0xad14('0x72'),{'channel':_0x67eafb,'interaction':_0x3d09c6['Interaction'],'message':_0x3d09c6,'account':_0x3d09c6[_0xad14('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xad14('0x6c'),'appdata':_0xf7c2c[_0xad14('0x10')]+','+(_0x3d09c6[_0xad14('0x69')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xad14('0x9')](respondWithResult(_0x199944,null))['catch'](handleError(_0x199944,null));};};exports['agentNotify']=function(_0x1ba8d9,_0xe8f761){var _0x165f39,_0x32111b;if(_[_0xad14('0x12')](_0x1ba8d9['body'][_0xad14('0x73')])){throw new Error(_0xad14('0x74'));}var _0x5dd5c7=_0x1ba8d9['body'][_0xad14('0x73')];var _0x226c07=_[_0xad14('0x63')](_0x5dd5c7);var _0x8722dd=_0x5dd5c7===_0xad14('0x75')?_0xad14('0x64'):_0xad14('0x69');return db[_0xad14('0x76')][_0xad14('0x66')]({'raw':!![],'where':{'id':_0x1ba8d9[_0xad14('0x19')]['id'],'role':_0xad14('0x36')}})[_0xad14('0x9')](function(_0x409ce4){if(_['isNil'](_0x409ce4)){throw new Error(_0xad14('0x77'));}_0x165f39=_0x409ce4;return db[_0x226c07+_0xad14('0x65')]['findOne']({'where':{'id':_0x1ba8d9['body']['messageId']},'include':[{'model':db[_0x226c07+_0xad14('0x68')],'as':_0xad14('0x68')},{'model':db[_0x226c07+_0x8722dd],'as':_0xad14('0x69')}]});})[_0xad14('0x9')](function(_0x58f237){if(_[_0xad14('0x12')](_0x58f237)){throw new Error(_0x226c07+'\x20Message\x20not\x20found');}_0x32111b=_0x58f237;return _0x58f237['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xad14('0x9')](function(){var _0x29b5d4={'uniqueid':_0x5dd5c7+'.'+_0x32111b['id']+'.'+_0x32111b[_0xad14('0x68')]['id'],'FromUserId':_0x1ba8d9[_0xad14('0x2d')]['id'],'type':_0xad14('0x36'),'ToUserId':_0x165f39['id']};_0x29b5d4[_0x226c07+_0xad14('0x6d')]=_0x32111b['id'];_0x29b5d4[_0x226c07+_0xad14('0x6e')]=_0x32111b[_0xad14('0x68')]['id'];_0x29b5d4[_0xad14('0x78')+_0x226c07+_0x8722dd+'Id']=_0x32111b['Account']['id'];return db[_0x226c07+_0xad14('0x70')][_0xad14('0x71')](_0x29b5d4);})[_0xad14('0x9')](function(){return respondWithRpcPromise(_0xad14('0x72'),{'channel':_0x5dd5c7,'interaction':_0x32111b[_0xad14('0x68')],'message':_0x32111b,'account':_0x32111b[_0xad14('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x165f39[_0xad14('0x10')]+','+(_0x32111b[_0xad14('0x69')]['agentTransferTimeout']||0x12c),'interval':_0xad14('0x79')}]},routingClient);})['then'](respondWithResult(_0xe8f761,null))['catch'](handleError(_0xe8f761,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index cb5c801..fc1b3ec 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 _0xb1c4=['express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xb1c4,0x81));var _0x4b1c=function(_0x45dd7a,_0x3f7de0){_0x45dd7a=_0x45dd7a-0x0;var _0x517f18=_0xb1c4[_0x45dd7a];return _0x517f18;};'use strict';var multer=require('multer');var util=require(_0x4b1c('0x0'));var path=require(_0x4b1c('0x1'));var timeout=require(_0x4b1c('0x2'));var express=require(_0x4b1c('0x3'));var router=express[_0x4b1c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b1c('0x5'));var config=require(_0x4b1c('0x6'));var controller=require(_0x4b1c('0x7'));router[_0x4b1c('0x8')]('/',auth[_0x4b1c('0x9')](),controller[_0x4b1c('0xa')]);router[_0x4b1c('0x8')](_0x4b1c('0xb'),auth[_0x4b1c('0x9')](),controller[_0x4b1c('0xc')]);router[_0x4b1c('0x8')](_0x4b1c('0xd'),auth['isAuthenticated'](),controller[_0x4b1c('0xe')]);router[_0x4b1c('0xf')]('/',auth['isAuthenticated'](),controller[_0x4b1c('0x10')]);router[_0x4b1c('0x11')](_0x4b1c('0xb'),auth[_0x4b1c('0x9')](),controller[_0x4b1c('0x12')]);router[_0x4b1c('0x13')](_0x4b1c('0xb'),auth[_0x4b1c('0x9')](),controller[_0x4b1c('0x14')]);module[_0x4b1c('0x15')]=router; \ No newline at end of file +var _0x69e3=['../../components/interaction/service','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x528311,_0x24014e){var _0x2ef5cf=function(_0x1d672f){while(--_0x1d672f){_0x528311['push'](_0x528311['shift']());}};_0x2ef5cf(++_0x24014e);}(_0x69e3,0x16f));var _0x369e=function(_0x9899fa,_0x1c7d70){_0x9899fa=_0x9899fa-0x0;var _0x57f432=_0x69e3[_0x9899fa];return _0x57f432;};'use strict';var multer=require(_0x369e('0x0'));var util=require(_0x369e('0x1'));var path=require(_0x369e('0x2'));var timeout=require('connect-timeout');var express=require(_0x369e('0x3'));var router=express[_0x369e('0x4')]();var fs_extra=require(_0x369e('0x5'));var auth=require(_0x369e('0x6'));var interaction=require(_0x369e('0x7'));var config=require('../../config/environment');var controller=require(_0x369e('0x8'));router['get']('/',auth[_0x369e('0x9')](),controller[_0x369e('0xa')]);router[_0x369e('0xb')](_0x369e('0xc'),auth[_0x369e('0x9')](),controller[_0x369e('0xd')]);router['get'](_0x369e('0xe'),auth['isAuthenticated'](),controller[_0x369e('0xf')]);router[_0x369e('0x10')]('/',auth[_0x369e('0x9')](),controller[_0x369e('0x11')]);router[_0x369e('0x12')](_0x369e('0xc'),auth[_0x369e('0x9')](),controller[_0x369e('0x13')]);router[_0x369e('0x14')](_0x369e('0xc'),auth[_0x369e('0x9')](),controller[_0x369e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 610e8c3..6a7be28 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 _0xb671=['sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','xlsx','custom','TEXT'];(function(_0x354be4,_0x2ff75c){var _0x804ed9=function(_0x2228f9){while(--_0x2228f9){_0x354be4['push'](_0x354be4['shift']());}};_0x804ed9(++_0x2ff75c);}(_0xb671,0xa2));var _0x1b67=function(_0x585fd0,_0x1ab3b0){_0x585fd0=_0x585fd0-0x0;var _0x1d04fa=_0xb671[_0x585fd0];return _0x1d04fa;};'use strict';var Sequelize=require(_0x1b67('0x0'));module[_0x1b67('0x1')]={'name':{'type':Sequelize[_0x1b67('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1b67('0x2')]},'active':{'type':Sequelize[_0x1b67('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1b67('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x1b67('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1b67('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1b67('0x6')](_0x1b67('0x7'),_0x1b67('0x8'),_0x1b67('0x9'),_0x1b67('0xa'),_0x1b67('0xb'),'hours',_0x1b67('0xc')),'allowNull':![],'defaultValue':_0x1b67('0xb')},'output':{'type':Sequelize[_0x1b67('0x6')](_0x1b67('0xd'),_0x1b67('0xe'),_0x1b67('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x1b67('0x6')](_0x1b67('0x10'),'default'),'allowNull':![],'defaultValue':_0x1b67('0x10')},'sendMail':{'type':Sequelize[_0x1b67('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1b67('0x2')]},'cc':{'type':Sequelize[_0x1b67('0x11')]},'bcc':{'type':Sequelize[_0x1b67('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x1b67('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x26ad=['pdf','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','quarters','months','hours','minutes','days','csv'];(function(_0x2647c5,_0x3fe809){var _0x17e8c5=function(_0x5c75d7){while(--_0x5c75d7){_0x2647c5['push'](_0x2647c5['shift']());}};_0x17e8c5(++_0x3fe809);}(_0x26ad,0xd4));var _0xd26a=function(_0x4d593e,_0x131776){_0x4d593e=_0x4d593e-0x0;var _0x31e2df=_0x26ad[_0x4d593e];return _0x31e2df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd26a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xd26a('0x0')]},'active':{'type':Sequelize[_0xd26a('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd26a('0x0')],'allowNull':![],'defaultValue':_0xd26a('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd26a('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd26a('0x4')](_0xd26a('0x5'),_0xd26a('0x6'),_0xd26a('0x7'),'weeks','days',_0xd26a('0x8'),_0xd26a('0x9')),'allowNull':![],'defaultValue':_0xd26a('0xa')},'output':{'type':Sequelize[_0xd26a('0x4')](_0xd26a('0xb'),_0xd26a('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xd26a('0xb')},'type':{'type':Sequelize[_0xd26a('0x4')](_0xd26a('0xd'),_0xd26a('0xe')),'allowNull':![],'defaultValue':_0xd26a('0xd')},'sendMail':{'type':Sequelize[_0xd26a('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xd26a('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xd26a('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xd26a('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 83e1712..a5cb685 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 _0xb637=['fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','params','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','get','Scheduler','destroy','error','stack','name','send','map','Schedule','fieldName','type','key','query','keys','intersection','model','attributes'];(function(_0x163d10,_0xe50522){var _0x5b7e47=function(_0x262a9c){while(--_0x262a9c){_0x163d10['push'](_0x163d10['shift']());}};_0x5b7e47(++_0xe50522);}(_0xb637,0x70));var _0x7b63=function(_0x28cbd6,_0x22bb6c){_0x28cbd6=_0x28cbd6-0x0;var _0xc7d851=_0xb637[_0x28cbd6];return _0xc7d851;};'use strict';var emlformat=require(_0x7b63('0x0'));var rimraf=require(_0x7b63('0x1'));var zipdir=require(_0x7b63('0x2'));var jsonpatch=require(_0x7b63('0x3'));var rp=require('request-promise');var moment=require(_0x7b63('0x4'));var BPromise=require(_0x7b63('0x5'));var Mustache=require(_0x7b63('0x6'));var util=require('util');var path=require(_0x7b63('0x7'));var sox=require(_0x7b63('0x8'));var csv=require(_0x7b63('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b63('0xa'));var _=require(_0x7b63('0xb'));var squel=require('squel');var crypto=require(_0x7b63('0xc'));var jsforce=require(_0x7b63('0xd'));var deskjs=require(_0x7b63('0xe'));var toCsv=require(_0x7b63('0x9'));var querystring=require(_0x7b63('0xf'));var Papa=require(_0x7b63('0x10'));var Redis=require(_0x7b63('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7b63('0x12'));var as=require(_0x7b63('0x13'));var hardwareService=require(_0x7b63('0x14'));var logger=require(_0x7b63('0x15'))(_0x7b63('0x16'));var utils=require(_0x7b63('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7b63('0x18'));var db=require(_0x7b63('0x19'))['db'];function respondWithStatusCode(_0x319f78,_0x26b37d){_0x26b37d=_0x26b37d||0xcc;return function(_0x58fb3d){if(_0x58fb3d){return _0x319f78[_0x7b63('0x1a')](_0x26b37d);}return _0x319f78[_0x7b63('0x1b')](_0x26b37d)[_0x7b63('0x1c')]();};}function respondWithResult(_0x288f8b,_0x202b89){_0x202b89=_0x202b89||0xc8;return function(_0x29bb3a){if(_0x29bb3a){return _0x288f8b[_0x7b63('0x1b')](_0x202b89)['json'](_0x29bb3a);}};}function respondWithFilteredResult(_0x46a9aa,_0x50af3c){return function(_0x15a133){if(_0x15a133){var _0xc7e334=typeof _0x50af3c[_0x7b63('0x1d')]===_0x7b63('0x1e')&&typeof _0x50af3c[_0x7b63('0x1f')]==='undefined';var _0x2885f6=_0x15a133[_0x7b63('0x20')];var _0x222b5b=_0xc7e334?0x0:_0x50af3c[_0x7b63('0x1d')];var _0x3ee432=_0xc7e334?_0x15a133[_0x7b63('0x20')]:_0x50af3c[_0x7b63('0x1d')]+_0x50af3c['limit'];var _0x4e8aba;if(_0x3ee432>=_0x2885f6){_0x3ee432=_0x2885f6;_0x4e8aba=0xc8;}else{_0x4e8aba=0xce;}_0x46a9aa[_0x7b63('0x1b')](_0x4e8aba);return _0x46a9aa[_0x7b63('0x21')](_0x7b63('0x22'),_0x222b5b+'-'+_0x3ee432+'/'+_0x2885f6)[_0x7b63('0x23')](_0x15a133);}return null;};}function patchUpdates(_0x3fc3c7){return function(_0x4eca16){try{jsonpatch['apply'](_0x4eca16,_0x3fc3c7,!![]);}catch(_0x1d8d86){return BPromise['reject'](_0x1d8d86);}return _0x4eca16[_0x7b63('0x24')]();};}function saveUpdates(_0x377a26,_0x2c291e){return function(_0x31d84f){if(_0x31d84f){return _0x31d84f[_0x7b63('0x25')](_0x377a26)[_0x7b63('0x26')](function(_0x2d8815){return _0x2d8815;});}return null;};}function removeEntity(_0x2b1f9c,_0x40e710){return function(_0xed2734){if(_0xed2734){return _0xed2734['destroy']()['then'](function(){var _0x4436ac=_0xed2734[_0x7b63('0x27')]({'plain':!![]});var _0x5426e9=_0x7b63('0x28');return db['UserProfileResource'][_0x7b63('0x29')]({'where':{'type':_0x5426e9,'resourceId':_0x4436ac['id']}})[_0x7b63('0x26')](function(){return _0xed2734;});})['then'](function(){_0x2b1f9c[_0x7b63('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ef2d,_0x355b3f){return function(_0x52f1b4){if(!_0x52f1b4){_0x13ef2d[_0x7b63('0x1a')](0x194);}return _0x52f1b4;};}function handleError(_0x763f3c,_0x160f4e){_0x160f4e=_0x160f4e||0x1f4;return function(_0x422052){logger[_0x7b63('0x2a')](_0x422052[_0x7b63('0x2b')]);if(_0x422052[_0x7b63('0x2c')]){delete _0x422052[_0x7b63('0x2c')];}_0x763f3c[_0x7b63('0x1b')](_0x160f4e)[_0x7b63('0x2d')](_0x422052);};}exports['index']=function(_0x25356a,_0x3dba3d){var _0x211b3e={},_0x3db25b={},_0x3f4728={'count':0x0,'rows':[]};var _0x2a57e9=_[_0x7b63('0x2e')](db[_0x7b63('0x2f')]['rawAttributes'],function(_0x333182){return{'name':_0x333182[_0x7b63('0x30')],'type':_0x333182[_0x7b63('0x31')][_0x7b63('0x32')]};});_0x3db25b['model']=_[_0x7b63('0x2e')](_0x2a57e9,'name');_0x3db25b[_0x7b63('0x33')]=_[_0x7b63('0x34')](_0x25356a[_0x7b63('0x33')]);_0x3db25b['filters']=_[_0x7b63('0x35')](_0x3db25b[_0x7b63('0x36')],_0x3db25b[_0x7b63('0x33')]);_0x211b3e[_0x7b63('0x37')]=_[_0x7b63('0x35')](_0x3db25b[_0x7b63('0x36')],qs[_0x7b63('0x38')](_0x25356a[_0x7b63('0x33')]['fields']));_0x211b3e[_0x7b63('0x37')]=_0x211b3e[_0x7b63('0x37')][_0x7b63('0x39')]?_0x211b3e[_0x7b63('0x37')]:_0x3db25b['model'];if(!_0x25356a['query']['hasOwnProperty'](_0x7b63('0x3a'))){_0x211b3e['limit']=qs[_0x7b63('0x1f')](_0x25356a[_0x7b63('0x33')][_0x7b63('0x1f')]);_0x211b3e['offset']=qs[_0x7b63('0x1d')](_0x25356a[_0x7b63('0x33')]['offset']);}_0x211b3e[_0x7b63('0x3b')]=qs[_0x7b63('0x3c')](_0x25356a[_0x7b63('0x33')][_0x7b63('0x3c')]);_0x211b3e['where']=qs[_0x7b63('0x3d')](_[_0x7b63('0x3e')](_0x25356a[_0x7b63('0x33')],_0x3db25b[_0x7b63('0x3d')]),_0x2a57e9);if(_0x25356a[_0x7b63('0x33')]['filter']){_0x211b3e[_0x7b63('0x3f')]=_[_0x7b63('0x40')](_0x211b3e[_0x7b63('0x3f')],{'$or':_[_0x7b63('0x2e')](_0x2a57e9,function(_0xb1dc17){if(_0xb1dc17[_0x7b63('0x31')]!==_0x7b63('0x41')){var _0x21d98e={};_0x21d98e[_0xb1dc17[_0x7b63('0x2c')]]={'$like':'%'+_0x25356a[_0x7b63('0x33')][_0x7b63('0x42')]+'%'};return _0x21d98e;}})});}_0x211b3e=_[_0x7b63('0x40')]({},_0x211b3e,_0x25356a['options']);var _0x1bcf3e={'where':_0x211b3e['where']};return db[_0x7b63('0x2f')]['count'](_0x1bcf3e)['then'](function(_0x50fa22){_0x3f4728[_0x7b63('0x20')]=_0x50fa22;if(_0x25356a[_0x7b63('0x33')][_0x7b63('0x43')]){_0x211b3e[_0x7b63('0x44')]=[{'all':!![]}];}return db['Schedule'][_0x7b63('0x45')](_0x211b3e);})[_0x7b63('0x26')](function(_0x1652a3){_0x3f4728[_0x7b63('0x46')]=_0x1652a3;return _0x3f4728;})[_0x7b63('0x26')](respondWithFilteredResult(_0x3dba3d,_0x211b3e))[_0x7b63('0x47')](handleError(_0x3dba3d,null));};exports[_0x7b63('0x48')]=function(_0x21bc85,_0x25b202){var _0x133cd9={'raw':![],'where':{'id':_0x21bc85['params']['id']}},_0x2afbe7={};_0x2afbe7[_0x7b63('0x36')]=_[_0x7b63('0x34')](db[_0x7b63('0x2f')][_0x7b63('0x49')]);_0x2afbe7[_0x7b63('0x33')]=_[_0x7b63('0x34')](_0x21bc85[_0x7b63('0x33')]);_0x2afbe7[_0x7b63('0x3d')]=_[_0x7b63('0x35')](_0x2afbe7['model'],_0x2afbe7[_0x7b63('0x33')]);_0x133cd9[_0x7b63('0x37')]=_['intersection'](_0x2afbe7[_0x7b63('0x36')],qs[_0x7b63('0x38')](_0x21bc85[_0x7b63('0x33')][_0x7b63('0x38')]));_0x133cd9[_0x7b63('0x37')]=_0x133cd9[_0x7b63('0x37')][_0x7b63('0x39')]?_0x133cd9[_0x7b63('0x37')]:_0x2afbe7[_0x7b63('0x36')];if(_0x21bc85['query'][_0x7b63('0x43')]){_0x133cd9[_0x7b63('0x44')]=[{'all':!![]}];}_0x133cd9=_['merge']({},_0x133cd9,_0x21bc85['options']);return db[_0x7b63('0x2f')][_0x7b63('0x4a')](_0x133cd9)[_0x7b63('0x26')](handleEntityNotFound(_0x25b202,null))['then'](respondWithResult(_0x25b202,null))[_0x7b63('0x47')](handleError(_0x25b202,null));};exports[_0x7b63('0x4b')]=function(_0x3532df,_0x21b847){return db[_0x7b63('0x2f')]['create'](_0x3532df['body'],{})[_0x7b63('0x26')](function(_0x2d5a31){var _0x4ab112=_0x3532df[_0x7b63('0x4c')]['get']({'plain':!![]});if(!_0x4ab112)throw new Error(_0x7b63('0x4d'));if(_0x4ab112[_0x7b63('0x4e')]==='user'){var _0x1e6aaa=_0x2d5a31[_0x7b63('0x27')]({'plain':!![]});var _0x413917=_0x7b63('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x413917,'userProfileId':_0x4ab112[_0x7b63('0x4f')]},'raw':!![]})[_0x7b63('0x26')](function(_0x33a0a7){if(_0x33a0a7&&_0x33a0a7[_0x7b63('0x50')]===0x0){return db['UserProfileResource'][_0x7b63('0x4b')]({'name':_0x1e6aaa[_0x7b63('0x2c')],'resourceId':_0x1e6aaa['id'],'type':_0x33a0a7[_0x7b63('0x2c')],'sectionId':_0x33a0a7['id']},{})[_0x7b63('0x26')](function(){return _0x2d5a31;});}else{return _0x2d5a31;}})[_0x7b63('0x47')](function(_0x178d3d){logger[_0x7b63('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x178d3d);throw _0x178d3d;});}return _0x2d5a31;})[_0x7b63('0x26')](respondWithResult(_0x21b847,0xc9))[_0x7b63('0x47')](handleError(_0x21b847,null));};exports[_0x7b63('0x25')]=function(_0x39dcdf,_0x4303d1){if(_0x39dcdf['body']['id']){delete _0x39dcdf[_0x7b63('0x51')]['id'];}return db[_0x7b63('0x2f')][_0x7b63('0x4a')]({'where':{'id':_0x39dcdf['params']['id']}})['then'](handleEntityNotFound(_0x4303d1,null))[_0x7b63('0x26')](saveUpdates(_0x39dcdf['body'],null))[_0x7b63('0x26')](respondWithResult(_0x4303d1,null))['catch'](handleError(_0x4303d1,null));};exports[_0x7b63('0x29')]=function(_0x1ee058,_0x554aa0){return db['Schedule']['find']({'where':{'id':_0x1ee058[_0x7b63('0x52')]['id']}})[_0x7b63('0x26')](handleEntityNotFound(_0x554aa0,null))[_0x7b63('0x26')](removeEntity(_0x554aa0,null))[_0x7b63('0x47')](handleError(_0x554aa0,null));};exports['run']=function(_0x4860ce,_0x54d202,_0x33e043){var _0x1f3068=require(_0x7b63('0x53'));return db['Schedule'][_0x7b63('0x4a')]({'where':{'id':_0x4860ce['params']['id']},'raw':!![]})[_0x7b63('0x26')](handleEntityNotFound(_0x54d202,null))[_0x7b63('0x26')](function(){_0x1f3068['run'](_0x4860ce['params']['id']);})[_0x7b63('0x26')](respondWithStatusCode(_0x54d202,null))[_0x7b63('0x47')](handleError(_0x54d202,null));}; \ No newline at end of file +var _0x854d=['run','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','save','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','Schedule','findAll','catch','show','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params'];(function(_0x4d883d,_0x62c688){var _0x3f2ef7=function(_0x32eec6){while(--_0x32eec6){_0x4d883d['push'](_0x4d883d['shift']());}};_0x3f2ef7(++_0x62c688);}(_0x854d,0x1be));var _0xd854=function(_0x5ed198,_0x121889){_0x5ed198=_0x5ed198-0x0;var _0x59d5d7=_0x854d[_0x5ed198];return _0x59d5d7;};'use strict';var emlformat=require(_0xd854('0x0'));var rimraf=require(_0xd854('0x1'));var zipdir=require(_0xd854('0x2'));var jsonpatch=require(_0xd854('0x3'));var rp=require(_0xd854('0x4'));var moment=require(_0xd854('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd854('0x6'));var util=require(_0xd854('0x7'));var path=require(_0xd854('0x8'));var sox=require(_0xd854('0x9'));var csv=require(_0xd854('0xa'));var ejs=require(_0xd854('0xb'));var fs=require('fs');var fs_extra=require(_0xd854('0xc'));var _=require(_0xd854('0xd'));var squel=require(_0xd854('0xe'));var crypto=require(_0xd854('0xf'));var jsforce=require(_0xd854('0x10'));var deskjs=require(_0xd854('0x11'));var toCsv=require(_0xd854('0xa'));var querystring=require(_0xd854('0x12'));var Papa=require(_0xd854('0x13'));var Redis=require(_0xd854('0x14'));var authService=require(_0xd854('0x15'));var qs=require(_0xd854('0x16'));var as=require(_0xd854('0x17'));var hardwareService=require(_0xd854('0x18'));var logger=require('../../config/logger')(_0xd854('0x19'));var utils=require(_0xd854('0x1a'));var config=require(_0xd854('0x1b'));var licenseUtil=require(_0xd854('0x1c'));var db=require(_0xd854('0x1d'))['db'];function respondWithStatusCode(_0x1c6bad,_0x4f62cf){_0x4f62cf=_0x4f62cf||0xcc;return function(_0x28ae2c){if(_0x28ae2c){return _0x1c6bad[_0xd854('0x1e')](_0x4f62cf);}return _0x1c6bad['status'](_0x4f62cf)[_0xd854('0x1f')]();};}function respondWithResult(_0x5887bd,_0x457e96){_0x457e96=_0x457e96||0xc8;return function(_0x2a20c0){if(_0x2a20c0){return _0x5887bd[_0xd854('0x20')](_0x457e96)['json'](_0x2a20c0);}};}function respondWithFilteredResult(_0x493871,_0x5423c1){return function(_0x3b1dcb){if(_0x3b1dcb){var _0xb3f414=typeof _0x5423c1[_0xd854('0x21')]===_0xd854('0x22')&&typeof _0x5423c1['limit']==='undefined';var _0x544ba7=_0x3b1dcb[_0xd854('0x23')];var _0x3f940a=_0xb3f414?0x0:_0x5423c1[_0xd854('0x21')];var _0x3aaa70=_0xb3f414?_0x3b1dcb[_0xd854('0x23')]:_0x5423c1['offset']+_0x5423c1[_0xd854('0x24')];var _0x107a16;if(_0x3aaa70>=_0x544ba7){_0x3aaa70=_0x544ba7;_0x107a16=0xc8;}else{_0x107a16=0xce;}_0x493871['status'](_0x107a16);return _0x493871[_0xd854('0x25')](_0xd854('0x26'),_0x3f940a+'-'+_0x3aaa70+'/'+_0x544ba7)['json'](_0x3b1dcb);}return null;};}function patchUpdates(_0x29a2da){return function(_0x52e86f){try{jsonpatch['apply'](_0x52e86f,_0x29a2da,!![]);}catch(_0x21938c){return BPromise['reject'](_0x21938c);}return _0x52e86f[_0xd854('0x27')]();};}function saveUpdates(_0x318e53,_0x4f195f){return function(_0x48eb17){if(_0x48eb17){return _0x48eb17[_0xd854('0x28')](_0x318e53)[_0xd854('0x29')](function(_0x1d7623){return _0x1d7623;});}return null;};}function removeEntity(_0x1242fc,_0x4149d6){return function(_0xc1e4c2){if(_0xc1e4c2){return _0xc1e4c2['destroy']()['then'](function(){var _0x45d7f8=_0xc1e4c2['get']({'plain':!![]});var _0x577e80=_0xd854('0x2a');return db[_0xd854('0x2b')][_0xd854('0x2c')]({'where':{'type':_0x577e80,'resourceId':_0x45d7f8['id']}})[_0xd854('0x29')](function(){return _0xc1e4c2;});})[_0xd854('0x29')](function(){_0x1242fc[_0xd854('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb77b,_0x268d2f){return function(_0xdb1ba1){if(!_0xdb1ba1){_0x2cb77b['sendStatus'](0x194);}return _0xdb1ba1;};}function handleError(_0x6c7371,_0x4e78c2){_0x4e78c2=_0x4e78c2||0x1f4;return function(_0x540e2f){logger[_0xd854('0x2d')](_0x540e2f[_0xd854('0x2e')]);if(_0x540e2f[_0xd854('0x2f')]){delete _0x540e2f['name'];}_0x6c7371[_0xd854('0x20')](_0x4e78c2)[_0xd854('0x30')](_0x540e2f);};}exports['index']=function(_0x2270ad,_0x12fe6d){var _0x584b51={},_0x8128a1={},_0x52ac7d={'count':0x0,'rows':[]};var _0x207724=_[_0xd854('0x31')](db['Schedule']['rawAttributes'],function(_0x377dc8){return{'name':_0x377dc8[_0xd854('0x32')],'type':_0x377dc8[_0xd854('0x33')][_0xd854('0x34')]};});_0x8128a1[_0xd854('0x35')]=_[_0xd854('0x31')](_0x207724,'name');_0x8128a1[_0xd854('0x36')]=_[_0xd854('0x37')](_0x2270ad[_0xd854('0x36')]);_0x8128a1[_0xd854('0x38')]=_[_0xd854('0x39')](_0x8128a1[_0xd854('0x35')],_0x8128a1['query']);_0x584b51[_0xd854('0x3a')]=_[_0xd854('0x39')](_0x8128a1[_0xd854('0x35')],qs['fields'](_0x2270ad[_0xd854('0x36')][_0xd854('0x3b')]));_0x584b51[_0xd854('0x3a')]=_0x584b51[_0xd854('0x3a')]['length']?_0x584b51[_0xd854('0x3a')]:_0x8128a1[_0xd854('0x35')];if(!_0x2270ad[_0xd854('0x36')][_0xd854('0x3c')](_0xd854('0x3d'))){_0x584b51[_0xd854('0x24')]=qs[_0xd854('0x24')](_0x2270ad[_0xd854('0x36')][_0xd854('0x24')]);_0x584b51[_0xd854('0x21')]=qs[_0xd854('0x21')](_0x2270ad[_0xd854('0x36')][_0xd854('0x21')]);}_0x584b51[_0xd854('0x3e')]=qs[_0xd854('0x3f')](_0x2270ad[_0xd854('0x36')][_0xd854('0x3f')]);_0x584b51[_0xd854('0x40')]=qs[_0xd854('0x38')](_[_0xd854('0x41')](_0x2270ad[_0xd854('0x36')],_0x8128a1[_0xd854('0x38')]),_0x207724);if(_0x2270ad[_0xd854('0x36')][_0xd854('0x42')]){_0x584b51[_0xd854('0x40')]=_['merge'](_0x584b51[_0xd854('0x40')],{'$or':_[_0xd854('0x31')](_0x207724,function(_0x3618a2){if(_0x3618a2[_0xd854('0x33')]!==_0xd854('0x43')){var _0x165172={};_0x165172[_0x3618a2[_0xd854('0x2f')]]={'$like':'%'+_0x2270ad['query'][_0xd854('0x42')]+'%'};return _0x165172;}})});}_0x584b51=_[_0xd854('0x44')]({},_0x584b51,_0x2270ad['options']);var _0x7a609d={'where':_0x584b51[_0xd854('0x40')]};return db['Schedule'][_0xd854('0x23')](_0x7a609d)[_0xd854('0x29')](function(_0x597143){_0x52ac7d[_0xd854('0x23')]=_0x597143;if(_0x2270ad[_0xd854('0x36')][_0xd854('0x45')]){_0x584b51['include']=[{'all':!![]}];}return db[_0xd854('0x46')][_0xd854('0x47')](_0x584b51);})['then'](function(_0x4a5d59){_0x52ac7d['rows']=_0x4a5d59;return _0x52ac7d;})['then'](respondWithFilteredResult(_0x12fe6d,_0x584b51))[_0xd854('0x48')](handleError(_0x12fe6d,null));};exports[_0xd854('0x49')]=function(_0x5e5746,_0x2d9600){var _0x4379b1={'raw':![],'where':{'id':_0x5e5746['params']['id']}},_0x3e8c3b={};_0x3e8c3b[_0xd854('0x35')]=_[_0xd854('0x37')](db[_0xd854('0x46')]['rawAttributes']);_0x3e8c3b[_0xd854('0x36')]=_[_0xd854('0x37')](_0x5e5746[_0xd854('0x36')]);_0x3e8c3b[_0xd854('0x38')]=_[_0xd854('0x39')](_0x3e8c3b['model'],_0x3e8c3b[_0xd854('0x36')]);_0x4379b1[_0xd854('0x3a')]=_[_0xd854('0x39')](_0x3e8c3b[_0xd854('0x35')],qs[_0xd854('0x3b')](_0x5e5746[_0xd854('0x36')]['fields']));_0x4379b1[_0xd854('0x3a')]=_0x4379b1['attributes'][_0xd854('0x4a')]?_0x4379b1[_0xd854('0x3a')]:_0x3e8c3b[_0xd854('0x35')];if(_0x5e5746[_0xd854('0x36')][_0xd854('0x45')]){_0x4379b1[_0xd854('0x4b')]=[{'all':!![]}];}_0x4379b1=_[_0xd854('0x44')]({},_0x4379b1,_0x5e5746['options']);return db[_0xd854('0x46')][_0xd854('0x4c')](_0x4379b1)[_0xd854('0x29')](handleEntityNotFound(_0x2d9600,null))[_0xd854('0x29')](respondWithResult(_0x2d9600,null))[_0xd854('0x48')](handleError(_0x2d9600,null));};exports[_0xd854('0x4d')]=function(_0x12d89a,_0x46777b){return db['Schedule'][_0xd854('0x4d')](_0x12d89a[_0xd854('0x4e')],{})[_0xd854('0x29')](function(_0x381ada){var _0x92bd5f=_0x12d89a['user'][_0xd854('0x4f')]({'plain':!![]});if(!_0x92bd5f)throw new Error(_0xd854('0x50'));if(_0x92bd5f[_0xd854('0x51')]===_0xd854('0x52')){var _0xa315b1=_0x381ada['get']({'plain':!![]});var _0x55a42a=_0xd854('0x2a');return db[_0xd854('0x53')][_0xd854('0x4c')]({'where':{'name':_0x55a42a,'userProfileId':_0x92bd5f[_0xd854('0x54')]},'raw':!![]})[_0xd854('0x29')](function(_0xc4edd2){if(_0xc4edd2&&_0xc4edd2[_0xd854('0x55')]===0x0){return db[_0xd854('0x2b')]['create']({'name':_0xa315b1[_0xd854('0x2f')],'resourceId':_0xa315b1['id'],'type':_0xc4edd2[_0xd854('0x2f')],'sectionId':_0xc4edd2['id']},{})[_0xd854('0x29')](function(){return _0x381ada;});}else{return _0x381ada;}})['catch'](function(_0x585438){logger['error'](_0xd854('0x56'),_0x585438);throw _0x585438;});}return _0x381ada;})[_0xd854('0x29')](respondWithResult(_0x46777b,0xc9))[_0xd854('0x48')](handleError(_0x46777b,null));};exports['update']=function(_0x39d0a3,_0x4f7678){if(_0x39d0a3['body']['id']){delete _0x39d0a3[_0xd854('0x4e')]['id'];}return db[_0xd854('0x46')][_0xd854('0x4c')]({'where':{'id':_0x39d0a3[_0xd854('0x57')]['id']}})[_0xd854('0x29')](handleEntityNotFound(_0x4f7678,null))['then'](saveUpdates(_0x39d0a3[_0xd854('0x4e')],null))[_0xd854('0x29')](respondWithResult(_0x4f7678,null))[_0xd854('0x48')](handleError(_0x4f7678,null));};exports[_0xd854('0x2c')]=function(_0x503762,_0x3a4d68){return db['Schedule'][_0xd854('0x4c')]({'where':{'id':_0x503762[_0xd854('0x57')]['id']}})[_0xd854('0x29')](handleEntityNotFound(_0x3a4d68,null))['then'](removeEntity(_0x3a4d68,null))[_0xd854('0x48')](handleError(_0x3a4d68,null));};exports['run']=function(_0x59d025,_0x31617d,_0x4190d0){var _0x1f2c67=require('../../config/schedule');return db[_0xd854('0x46')]['find']({'where':{'id':_0x59d025[_0xd854('0x57')]['id']},'raw':!![]})[_0xd854('0x29')](handleEntityNotFound(_0x31617d,null))['then'](function(){_0x1f2c67[_0xd854('0x58')](_0x59d025[_0xd854('0x57')]['id']);})['then'](respondWithStatusCode(_0x31617d,null))[_0xd854('0x48')](handleError(_0x31617d,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index fcaaa85..016a068 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 _0x01e5=['tools_schedules','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x01e5,0x15d));var _0x501e=function(_0x3e8ee0,_0x5adba1){_0x3e8ee0=_0x3e8ee0-0x0;var _0x17db42=_0x01e5[_0x3e8ee0];return _0x17db42;};'use strict';var _=require(_0x501e('0x0'));var util=require('util');var logger=require(_0x501e('0x1'))(_0x501e('0x2'));var moment=require(_0x501e('0x3'));var BPromise=require('bluebird');var rp=require(_0x501e('0x4'));var fs=require('fs');var path=require(_0x501e('0x5'));var rimraf=require(_0x501e('0x6'));var config=require(_0x501e('0x7'));var attributes=require(_0x501e('0x8'));module['exports']=function(_0x1a12f3,_0x2f3688){return _0x1a12f3[_0x501e('0x9')](_0x501e('0xa'),attributes,{'tableName':_0x501e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aeb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','define','tools_schedules','lodash'];(function(_0x1083fb,_0x4c413b){var _0x596c71=function(_0x8b1212){while(--_0x8b1212){_0x1083fb['push'](_0x1083fb['shift']());}};_0x596c71(++_0x4c413b);}(_0x0aeb,0x18b));var _0xb0ae=function(_0x16ee54,_0x48638a){_0x16ee54=_0x16ee54-0x0;var _0x581e61=_0x0aeb[_0x16ee54];return _0x581e61;};'use strict';var _=require(_0xb0ae('0x0'));var util=require('util');var logger=require(_0xb0ae('0x1'))(_0xb0ae('0x2'));var moment=require(_0xb0ae('0x3'));var BPromise=require(_0xb0ae('0x4'));var rp=require(_0xb0ae('0x5'));var fs=require('fs');var path=require(_0xb0ae('0x6'));var rimraf=require(_0xb0ae('0x7'));var config=require('../../config/environment');var attributes=require(_0xb0ae('0x8'));module['exports']=function(_0x4ca3b0,_0x1c0bde){return _0x4ca3b0[_0xb0ae('0x9')]('Schedule',attributes,{'tableName':_0xb0ae('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 bcaeacd..0012685 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 _0xbe46=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x49a612,_0x5692dd){var _0x2489f1=function(_0x4826bb){while(--_0x4826bb){_0x49a612['push'](_0x49a612['shift']());}};_0x2489f1(++_0x5692dd);}(_0xbe46,0x177));var _0x6be4=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xbe46[_0x4dbaad];return _0x226c72;};'use strict';var _=require('lodash');var util=require(_0x6be4('0x0'));var moment=require(_0x6be4('0x1'));var BPromise=require(_0x6be4('0x2'));var rs=require(_0x6be4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6be4('0x4'))['db'];var utils=require(_0x6be4('0x5'));var logger=require('../../config/logger')(_0x6be4('0x6'));var config=require(_0x6be4('0x7'));var jayson=require(_0x6be4('0x8'));var client=jayson[_0x6be4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1724,_0x1ada89,_0x4f254e){return new BPromise(function(_0x29d11c,_0x5155bb){return client['request'](_0x1d1724,_0x4f254e)[_0x6be4('0xa')](function(_0x4415ec){logger[_0x6be4('0xb')](_0x6be4('0xc'),_0x1ada89,_0x6be4('0xd'));logger[_0x6be4('0xe')](_0x6be4('0xf'),_0x1ada89,'request\x20sent',JSON[_0x6be4('0x10')](_0x4415ec));if(_0x4415ec['error']){if(_0x4415ec[_0x6be4('0x11')][_0x6be4('0x12')]===0x1f4){logger[_0x6be4('0x11')](_0x6be4('0xc'),_0x1ada89,_0x4415ec[_0x6be4('0x11')][_0x6be4('0x13')]);return _0x5155bb(_0x4415ec[_0x6be4('0x11')][_0x6be4('0x13')]);}logger['error'](_0x6be4('0xc'),_0x1ada89,_0x4415ec[_0x6be4('0x11')][_0x6be4('0x13')]);return _0x29d11c(_0x4415ec[_0x6be4('0x11')]['message']);}else{logger[_0x6be4('0xb')](_0x6be4('0xc'),_0x1ada89,'request\x20sent');_0x29d11c(_0x4415ec['result']['message']);}})[_0x6be4('0x14')](function(_0x934a6d){logger[_0x6be4('0x11')](_0x6be4('0xc'),_0x1ada89,_0x934a6d);_0x5155bb(_0x934a6d);});});} \ No newline at end of file +var _0x1166=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x328070,_0x5d88fd){var _0x28e491=function(_0x3f2f22){while(--_0x3f2f22){_0x328070['push'](_0x328070['shift']());}};_0x28e491(++_0x5d88fd);}(_0x1166,0x13f));var _0x6116=function(_0x4e056f,_0x382fcc){_0x4e056f=_0x4e056f-0x0;var _0x10b003=_0x1166[_0x4e056f];return _0x10b003;};'use strict';var _=require(_0x6116('0x0'));var util=require(_0x6116('0x1'));var moment=require(_0x6116('0x2'));var BPromise=require(_0x6116('0x3'));var rs=require(_0x6116('0x4'));var fs=require('fs');var Redis=require(_0x6116('0x5'));var db=require(_0x6116('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6116('0x7'))(_0x6116('0x8'));var config=require(_0x6116('0x9'));var jayson=require(_0x6116('0xa'));var client=jayson[_0x6116('0xb')][_0x6116('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59ed89,_0x22b67c,_0x26cd48){return new BPromise(function(_0x6f675,_0x2f7b93){return client[_0x6116('0xd')](_0x59ed89,_0x26cd48)[_0x6116('0xe')](function(_0xf70aad){logger['info'](_0x6116('0xf'),_0x22b67c,'request\x20sent');logger[_0x6116('0x10')](_0x6116('0x11'),_0x22b67c,_0x6116('0x12'),JSON[_0x6116('0x13')](_0xf70aad));if(_0xf70aad[_0x6116('0x14')]){if(_0xf70aad['error'][_0x6116('0x15')]===0x1f4){logger['error'](_0x6116('0xf'),_0x22b67c,_0xf70aad['error'][_0x6116('0x16')]);return _0x2f7b93(_0xf70aad[_0x6116('0x14')][_0x6116('0x16')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x22b67c,_0xf70aad[_0x6116('0x14')]['message']);return _0x6f675(_0xf70aad['error'][_0x6116('0x16')]);}else{logger[_0x6116('0x17')](_0x6116('0xf'),_0x22b67c,_0x6116('0x12'));_0x6f675(_0xf70aad['result'][_0x6116('0x16')]);}})[_0x6116('0x18')](function(_0x23a42c){logger[_0x6116('0x14')](_0x6116('0xf'),_0x22b67c,_0x23a42c);_0x2f7b93(_0x23a42c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 9f3e9db..b64b8df 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 _0xee53=['post','put','update','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xee53,0x1ea));var _0x3ee5=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xee53[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require('multer');var util=require(_0x3ee5('0x0'));var path=require(_0x3ee5('0x1'));var timeout=require('connect-timeout');var express=require(_0x3ee5('0x2'));var router=express['Router']();var fs_extra=require(_0x3ee5('0x3'));var auth=require(_0x3ee5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3ee5('0x5'));var controller=require(_0x3ee5('0x6'));router[_0x3ee5('0x7')]('/',auth[_0x3ee5('0x8')](),controller['index']);router[_0x3ee5('0x7')](_0x3ee5('0x9'),auth['isAuthenticated'](),controller[_0x3ee5('0xa')]);router[_0x3ee5('0x7')](_0x3ee5('0xb'),auth['isAuthenticated'](),controller[_0x3ee5('0xc')]);router[_0x3ee5('0x7')]('/:id/download',auth[_0x3ee5('0x8')](),controller[_0x3ee5('0xd')]);router[_0x3ee5('0xe')]('/',auth[_0x3ee5('0x8')](),controller['create']);router[_0x3ee5('0xf')](_0x3ee5('0xb'),auth['isAuthenticated'](),controller[_0x3ee5('0x10')]);router['delete']('/:id',auth[_0x3ee5('0x8')](),controller['destroy']);module[_0x3ee5('0x11')]=router; \ No newline at end of file +var _0xb3b8=['get','isAuthenticated','index','/describe','describe','/:id/download','download','post','create','put','update','destroy','util','path','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller'];(function(_0x4fa4ea,_0x4cf483){var _0x44bc8a=function(_0xde07c5){while(--_0xde07c5){_0x4fa4ea['push'](_0x4fa4ea['shift']());}};_0x44bc8a(++_0x4cf483);}(_0xb3b8,0x108));var _0x8b3b=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xb3b8[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require('multer');var util=require(_0x8b3b('0x0'));var path=require(_0x8b3b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8b3b('0x2'));var auth=require(_0x8b3b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8b3b('0x4'));var controller=require(_0x8b3b('0x5'));router[_0x8b3b('0x6')]('/',auth[_0x8b3b('0x7')](),controller[_0x8b3b('0x8')]);router['get'](_0x8b3b('0x9'),auth[_0x8b3b('0x7')](),controller[_0x8b3b('0xa')]);router[_0x8b3b('0x6')]('/:id',auth[_0x8b3b('0x7')](),controller['show']);router[_0x8b3b('0x6')](_0x8b3b('0xb'),auth[_0x8b3b('0x7')](),controller[_0x8b3b('0xc')]);router[_0x8b3b('0xd')]('/',auth['isAuthenticated'](),controller[_0x8b3b('0xe')]);router[_0x8b3b('0xf')]('/:id',auth[_0x8b3b('0x7')](),controller[_0x8b3b('0x10')]);router['delete']('/:id',auth[_0x8b3b('0x7')](),controller[_0x8b3b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index cfce263..be658c8 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 _0x672a=['exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','sequelize','moment','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x672a,0x122));var _0xa672=function(_0x53e9ca,_0x5dbe10){_0x53e9ca=_0x53e9ca-0x0;var _0x2c0404=_0x672a[_0x53e9ca];return _0x2c0404;};'use strict';var Sequelize=require(_0xa672('0x0'));var moment=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var config=require(_0xa672('0x3'));module[_0xa672('0x4')]={'format':{'type':Sequelize[_0xa672('0x5')],'get':function(){return this[_0xa672('0x6')](_0xa672('0x7'))?path[_0xa672('0x8')](this[_0xa672('0x6')](_0xa672('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa672('0x9')]},'value':{'type':Sequelize[_0xa672('0x9')],'set':function(_0x3a4797){var _0x33dd0c=_0x3a4797[_0xa672('0xa')](/\\/g,'/');this[_0xa672('0xb')](_0xa672('0x7'),_0x33dd0c);}},'rating':{'type':Sequelize[_0xa672('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa672('0xc')],'set':function(_0x370f20){this[_0xa672('0xb')](_0xa672('0xd'),moment()[_0xa672('0xe')](_0x370f20,'ms'));this[_0xa672('0xb')]('closedAt',moment());this[_0xa672('0xb')](_0xa672('0xf'),_0x370f20);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa672('0x6')](_0xa672('0xd')))[_0xa672('0x10')](_0xa672('0x11'))[_0xa672('0x12')]();}},'closedAt':{'type':Sequelize[_0xa672('0x13')],'get':function(){return moment(this[_0xa672('0x6')](_0xa672('0x14')))[_0xa672('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xa672('0x12')]();}},'createdAt':{'type':Sequelize[_0xa672('0x13')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xa672('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa672('0x6')]('updatedAt'))['format'](_0xa672('0x11'))[_0xa672('0x12')]();}}}; \ No newline at end of file +var _0x5bc1=['createdAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','DATE','toString'];(function(_0x39b75a,_0x1ac8aa){var _0xa2d83=function(_0x423b16){while(--_0x423b16){_0x39b75a['push'](_0x39b75a['shift']());}};_0xa2d83(++_0x1ac8aa);}(_0x5bc1,0xb5));var _0x15bc=function(_0x29bcd1,_0x321aab){_0x29bcd1=_0x29bcd1-0x0;var _0xe7f9cb=_0x5bc1[_0x29bcd1];return _0xe7f9cb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x15bc('0x0'));var path=require(_0x15bc('0x1'));var config=require(_0x15bc('0x2'));module[_0x15bc('0x3')]={'format':{'type':Sequelize[_0x15bc('0x4')],'get':function(){return this[_0x15bc('0x5')]('value')?path['extname'](this[_0x15bc('0x5')](_0x15bc('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x15bc('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x15bc('0x7')],'set':function(_0x483c6d){var _0x344121=_0x483c6d[_0x15bc('0x8')](/\\/g,'/');this[_0x15bc('0x9')](_0x15bc('0x6'),_0x344121);}},'rating':{'type':Sequelize[_0x15bc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x15bc('0xa')],'set':function(_0x2bc60a){this[_0x15bc('0x9')](_0x15bc('0xb'),moment()[_0x15bc('0xc')](_0x2bc60a,'ms'));this['setDataValue'](_0x15bc('0xd'),moment());this[_0x15bc('0x9')](_0x15bc('0xe'),_0x2bc60a);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x15bc('0x5')](_0x15bc('0xb')))[_0x15bc('0xf')](_0x15bc('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x15bc('0x11')],'get':function(){return moment(this[_0x15bc('0x5')](_0x15bc('0xd')))[_0x15bc('0xf')](_0x15bc('0x10'))[_0x15bc('0x12')]();}},'createdAt':{'type':Sequelize[_0x15bc('0x11')],'get':function(){return moment(this[_0x15bc('0x5')](_0x15bc('0x13')))[_0x15bc('0xf')](_0x15bc('0x10'))[_0x15bc('0x12')]();}},'updatedAt':{'type':Sequelize[_0x15bc('0x11')],'get':function(){return moment(this[_0x15bc('0x5')]('updatedAt'))[_0x15bc('0xf')](_0x15bc('0x10'))[_0x15bc('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5793bf2..4886fac 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 _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x4d0741,_0x51e0d2){var _0x381311=function(_0x2bcfed){while(--_0x2bcfed){_0x4d0741['push'](_0x4d0741['shift']());}};_0x381311(++_0x51e0d2);}(_0x98a8,0x12c));var _0x898a=function(_0x49890c,_0x3e8740){_0x49890c=_0x49890c-0x0;var _0x38292b=_0x98a8[_0x49890c];return _0x38292b;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file +var _0x4b84=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','closedAt','value','download','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format'];(function(_0x239d10,_0x3edfdc){var _0x7b42a4=function(_0x24d74a){while(--_0x24d74a){_0x239d10['push'](_0x239d10['shift']());}};_0x7b42a4(++_0x3edfdc);}(_0x4b84,0x1cc));var _0x44b8=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0x4b84[_0x54d52];return _0x968345;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['ScreenRecording'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_[_0x44b8('0x2b')](_0x5a544c,_0x44b8('0x23')),[_0x44b8('0x2c')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x242342[_0x44b8('0x2d')]);_0x4a182d['filters']=_[_0x44b8('0x2f')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2d')]);_0x2e0174[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x242342['query'][_0x44b8('0x31')]));_0x2e0174[_0x44b8('0x30')]=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x32')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d['model'];if(!_0x242342[_0x44b8('0x2d')][_0x44b8('0x33')](_0x44b8('0x34'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x36')]);_0x2e0174[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x242342[_0x44b8('0x2d')],_0x4a182d[_0x44b8('0x38')]),_0x5a544c);if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x2e0174['where']=_[_0x44b8('0x3b')](_0x2e0174[_0x44b8('0x37')],{'$or':_['map'](_0x5a544c,function(_0x25688b){if(_0x25688b[_0x44b8('0x27')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0x2e0174=_[_0x44b8('0x3b')]({},_0x2e0174,_0x242342[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0x2e0174[_0x44b8('0x37')]};return db[_0x44b8('0x3e')][_0x44b8('0x18')](_0x9cb2a)[_0x44b8('0x20')](function(_0x3d1be1){_0xfb0028[_0x44b8('0x18')]=_0x3d1be1;if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x2e0174[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x3e')][_0x44b8('0x41')](_0x2e0174);})['then'](function(_0x12a0a4){_0xfb0028[_0x44b8('0x42')]=_0x12a0a4;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))['catch'](handleError(_0x53d9c7,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x29')]=_[_0x44b8('0x2e')](db[_0x44b8('0x3e')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2e')](_0x1054c5[_0x44b8('0x2d')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],_0xbad4bb[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x31')]));_0x585a16[_0x44b8('0x30')]=_0x585a16[_0x44b8('0x30')][_0x44b8('0x32')]?_0x585a16[_0x44b8('0x30')]:_0xbad4bb[_0x44b8('0x29')];if(_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x3e')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x20')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x20')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['ScreenRecording'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x20')](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x1f')]=function(_0x35ca19,_0x491600){if(_0x35ca19[_0x44b8('0x48')]['id']){delete _0x35ca19[_0x44b8('0x48')]['id'];}delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x49')];delete _0x35ca19['body'][_0x44b8('0x4a')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4b')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4c')];return db[_0x44b8('0x3e')]['find']({'where':{'id':_0x35ca19[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x491600,null))[_0x44b8('0x20')](saveUpdates(_0x35ca19[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x491600,null))['catch'](handleError(_0x491600,null));};exports['describe']=function(_0x2516fc,_0x4eb344){return db[_0x44b8('0x3e')]['describe']()[_0x44b8('0x20')](respondWithResult(_0x4eb344,null))[_0x44b8('0x46')](handleError(_0x4eb344,null));};exports[_0x44b8('0x4d')]=function(_0x15f4c6,_0x2fa6b4,_0x32f588){var _0xdc67e8=require('../../components/encryptor');var _0x3ad278=![];var _0x37b2c2={};if(_0x15f4c6[_0x44b8('0x2d')]['type']&&_0x15f4c6[_0x44b8('0x2d')][_0x44b8('0x27')]===_0x44b8('0x4e')){_0x37b2c2[_0x44b8('0x4e')]=_0x15f4c6['params']['id'];}else{_0x37b2c2['id']=_0x15f4c6[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x3e')]['find']({'where':_0x37b2c2,'attributes':['id',_0x44b8('0x4c')],'raw':!![]})[_0x44b8('0x20')](handleEntityNotFound(_0x2fa6b4,null))[_0x44b8('0x20')](function(_0x3df6aa){if(_0x3df6aa){var _0xe86e34=path['join'](config['root'],_0x44b8('0x4f'),_0x3df6aa[_0x44b8('0x4c')]);var _0xa30834=util[_0x44b8('0x2c')](_0x44b8('0x50'),_0xe86e34);if(fs[_0x44b8('0x51')](_0xa30834)){_0x3ad278=!![];return _0xdc67e8[_0x44b8('0x52')](_0xa30834,_0xe86e34,config[_0x44b8('0x53')][_0x44b8('0x54')])[_0x44b8('0x20')](function(){return _0x3df6aa;});}return _0x3df6aa;}})[_0x44b8('0x20')](function(_0x3f7576){if(_0x3f7576){var _0x5af3e6=path[_0x44b8('0x55')](config[_0x44b8('0x56')],_0x44b8('0x4f'),_0x3f7576[_0x44b8('0x4c')]);if(!fs[_0x44b8('0x51')](_0x5af3e6)){throw new db[(_0x44b8('0x57'))][(_0x44b8('0x58'))](_0x44b8('0x59'));}if(_0x3f7576[_0x44b8('0x5a')]){return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,_0x3f7576[_0x44b8('0x5a')]+path[_0x44b8('0x5b')](_0x5af3e6),function(){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}else{return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,function(_0x2250bb){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}}})[_0x44b8('0x46')](function(_0x20e563){if(_0x20e563['message']===_0x44b8('0x59')){_0x2fa6b4[_0x44b8('0x14')](0x194)[_0x44b8('0x5d')](_0x44b8('0x5e'));}else{return handleError(_0x2fa6b4,null);}});};exports[_0x44b8('0x21')]=function(_0x29ed5d,_0x2ecf65){return db['ScreenRecording'][_0x44b8('0x45')]({'where':{'id':_0x29ed5d[_0x44b8('0x44')]['id']}})['then'](function(_0x2a95f6){if(_[_0x44b8('0x5f')](_0x2a95f6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a95f6;})[_0x44b8('0x20')](function(_0x454fe6){var _0x370618=path['join'](config[_0x44b8('0x56')],'server/files/screen_recordings',_0x454fe6[_0x44b8('0x4c')]);logger['info'](_0x44b8('0x60'),_0x370618);if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs[_0x44b8('0x51')](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b8('0x63')](_0x370618);}_0x370618=_0x370618+'.cypher';if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs['existsSync'](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+_0x44b8('0x64'));fs[_0x44b8('0x63')](_0x370618);}return _0x454fe6;})[_0x44b8('0x20')](function(_0x3774fe){if(!_0x3774fe)throw new InternalError();return _0x3774fe[_0x44b8('0x21')]();})[_0x44b8('0x20')](function(){_0x2ecf65[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();})[_0x44b8('0x46')](handleError(_0x2ecf65,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f328512..9098156 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 _0x89e0=['screen_recordings','interactionid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x2f1b59,_0x5a9460){var _0x5a659c=function(_0x266808){while(--_0x266808){_0x2f1b59['push'](_0x2f1b59['shift']());}};_0x5a659c(++_0x5a9460);}(_0x89e0,0x9e));var _0x089e=function(_0x6be757,_0x24affc){_0x6be757=_0x6be757-0x0;var _0x9b95aa=_0x89e0[_0x6be757];return _0x9b95aa;};'use strict';var _=require('lodash');var util=require(_0x089e('0x0'));var logger=require(_0x089e('0x1'))(_0x089e('0x2'));var moment=require(_0x089e('0x3'));var BPromise=require('bluebird');var rp=require(_0x089e('0x4'));var fs=require('fs');var path=require(_0x089e('0x5'));var rimraf=require(_0x089e('0x6'));var config=require(_0x089e('0x7'));var attributes=require(_0x089e('0x8'));module[_0x089e('0x9')]=function(_0x35450d,_0xc98b95){return _0x35450d[_0x089e('0xa')]('ScreenRecording',attributes,{'tableName':_0x089e('0xb'),'paranoid':![],'indexes':[{'name':_0x089e('0xc'),'fields':[_0x089e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabf4=['api','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0xa75559,_0x3daa78){var _0x74b86f=function(_0xda2aa7){while(--_0xda2aa7){_0xa75559['push'](_0xa75559['shift']());}};_0x74b86f(++_0x3daa78);}(_0xabf4,0x65));var _0x4abf=function(_0x4dfe50,_0x51fa39){_0x4dfe50=_0x4dfe50-0x0;var _0x1c8316=_0xabf4[_0x4dfe50];return _0x1c8316;};'use strict';var _=require(_0x4abf('0x0'));var util=require(_0x4abf('0x1'));var logger=require(_0x4abf('0x2'))(_0x4abf('0x3'));var moment=require('moment');var BPromise=require(_0x4abf('0x4'));var rp=require(_0x4abf('0x5'));var fs=require('fs');var path=require(_0x4abf('0x6'));var rimraf=require('rimraf');var config=require(_0x4abf('0x7'));var attributes=require(_0x4abf('0x8'));module[_0x4abf('0x9')]=function(_0x520802,_0x388411){return _0x520802['define'](_0x4abf('0xa'),attributes,{'tableName':_0x4abf('0xb'),'paranoid':![],'indexes':[{'name':_0x4abf('0xc'),'fields':[_0x4abf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 01dc0ca..a5a4e75 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 _0x70ce=['error','message','ScreenRecording,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x431488,_0x37f9d5){var _0x9ce3d1=function(_0x228d1a){while(--_0x228d1a){_0x431488['push'](_0x431488['shift']());}};_0x9ce3d1(++_0x37f9d5);}(_0x70ce,0x16c));var _0xe70c=function(_0x275983,_0x2e8bb0){_0x275983=_0x275983-0x0;var _0x234332=_0x70ce[_0x275983];return _0x234332;};'use strict';var _=require(_0xe70c('0x0'));var util=require(_0xe70c('0x1'));var moment=require(_0xe70c('0x2'));var BPromise=require(_0xe70c('0x3'));var rs=require(_0xe70c('0x4'));var fs=require('fs');var Redis=require(_0xe70c('0x5'));var db=require(_0xe70c('0x6'))['db'];var utils=require(_0xe70c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe70c('0x8'));var jayson=require(_0xe70c('0x9'));var client=jayson['client'][_0xe70c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ed7f7,_0x41f2c0,_0x2be15b){return new BPromise(function(_0x517a9b,_0x2e391c){return client['request'](_0x4ed7f7,_0x2be15b)[_0xe70c('0xb')](function(_0x4a6964){logger[_0xe70c('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x41f2c0,_0xe70c('0xd'));logger['debug'](_0xe70c('0xe'),_0x41f2c0,'request\x20sent',JSON[_0xe70c('0xf')](_0x4a6964));if(_0x4a6964[_0xe70c('0x10')]){if(_0x4a6964[_0xe70c('0x10')]['code']===0x1f4){logger[_0xe70c('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x41f2c0,_0x4a6964[_0xe70c('0x10')][_0xe70c('0x11')]);return _0x2e391c(_0x4a6964[_0xe70c('0x10')][_0xe70c('0x11')]);}logger[_0xe70c('0x10')](_0xe70c('0x12'),_0x41f2c0,_0x4a6964['error'][_0xe70c('0x11')]);return _0x517a9b(_0x4a6964['error'][_0xe70c('0x11')]);}else{logger[_0xe70c('0xc')](_0xe70c('0x12'),_0x41f2c0,'request\x20sent');_0x517a9b(_0x4a6964['result'][_0xe70c('0x11')]);}})[_0xe70c('0x13')](function(_0x5d6333){logger[_0xe70c('0x10')](_0xe70c('0x12'),_0x41f2c0,_0x5d6333);_0x2e391c(_0x5d6333);});});} \ No newline at end of file +var _0x29ae=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2126c7,_0x5cd37f){var _0x2d91f4=function(_0x172922){while(--_0x172922){_0x2126c7['push'](_0x2126c7['shift']());}};_0x2d91f4(++_0x5cd37f);}(_0x29ae,0x1c9));var _0xe29a=function(_0x4c66a2,_0x5a9aaa){_0x4c66a2=_0x4c66a2-0x0;var _0x3fabd4=_0x29ae[_0x4c66a2];return _0x3fabd4;};'use strict';var _=require(_0xe29a('0x0'));var util=require(_0xe29a('0x1'));var moment=require(_0xe29a('0x2'));var BPromise=require(_0xe29a('0x3'));var rs=require(_0xe29a('0x4'));var fs=require('fs');var Redis=require(_0xe29a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe29a('0x6'));var logger=require(_0xe29a('0x7'))(_0xe29a('0x8'));var config=require(_0xe29a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe29a('0xa')][_0xe29a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17369c,_0x40d9a9,_0x1a1368){return new BPromise(function(_0x47275f,_0x52c5a7){return client[_0xe29a('0xc')](_0x17369c,_0x1a1368)[_0xe29a('0xd')](function(_0x77d9d0){logger[_0xe29a('0xe')](_0xe29a('0xf'),_0x40d9a9,_0xe29a('0x10'));logger[_0xe29a('0x11')](_0xe29a('0x12'),_0x40d9a9,_0xe29a('0x10'),JSON[_0xe29a('0x13')](_0x77d9d0));if(_0x77d9d0[_0xe29a('0x14')]){if(_0x77d9d0[_0xe29a('0x14')][_0xe29a('0x15')]===0x1f4){logger[_0xe29a('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x40d9a9,_0x77d9d0[_0xe29a('0x14')][_0xe29a('0x16')]);return _0x52c5a7(_0x77d9d0[_0xe29a('0x14')][_0xe29a('0x16')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x40d9a9,_0x77d9d0[_0xe29a('0x14')][_0xe29a('0x16')]);return _0x47275f(_0x77d9d0[_0xe29a('0x14')]['message']);}else{logger[_0xe29a('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x40d9a9,'request\x20sent');_0x47275f(_0x77d9d0['result'][_0xe29a('0x16')]);}})[_0xe29a('0x17')](function(_0x5626aa){logger[_0xe29a('0x14')](_0xe29a('0xf'),_0x40d9a9,_0x5626aa);_0x52c5a7(_0x5626aa);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d234047..ada7662 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 _0xe98d=['diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','/:id/logo','single','file','addLogo','%s%s','extname','preferred','favicon','addFavicon','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/now','getDate','get','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon'];(function(_0x5d3376,_0x5c7ac5){var _0xc4d2b8=function(_0x4a5b08){while(--_0x4a5b08){_0x5d3376['push'](_0x5d3376['shift']());}};_0xc4d2b8(++_0x5c7ac5);}(_0xe98d,0x72));var _0xde98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xde98('0x0'));var util=require(_0xde98('0x1'));var path=require(_0xde98('0x2'));var timeout=require(_0xde98('0x3'));var express=require(_0xde98('0x4'));var router=express[_0xde98('0x5')]();var fs_extra=require(_0xde98('0x6'));var auth=require(_0xde98('0x7'));var interaction=require(_0xde98('0x8'));var config=require(_0xde98('0x9'));var controller=require('./setting.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xde98('0xa')]);router['get'](_0xde98('0xb'),controller[_0xde98('0xc')]);router[_0xde98('0xd')]('/:id',controller[_0xde98('0xe')]);router['get']('/:id/logo',controller[_0xde98('0xf')]);router[_0xde98('0xd')](_0xde98('0x10'),controller[_0xde98('0x11')]);router[_0xde98('0xd')](_0xde98('0x12'),controller[_0xde98('0x13')]);router[_0xde98('0xd')](_0xde98('0x14'),controller[_0xde98('0x15')]);router[_0xde98('0xd')](_0xde98('0x16'),controller[_0xde98('0x17')]);var upload=multer({'storage':multer[_0xde98('0x18')]({'destination':function(_0x44ed37,_0x1002fd,_0x6a1e61){_0x6a1e61(null,path[_0xde98('0x19')](config[_0xde98('0x1a')],_0xde98('0x1b')));},'filename':function(_0xb32683,_0x1ab586,_0x5b49e1){_0x5b49e1(null,util[_0xde98('0x1c')]('%s%s',_0xde98('0x1d'),path['extname'](_0x1ab586[_0xde98('0x1e')])));}})});router[_0xde98('0x1f')](_0xde98('0x20'),upload[_0xde98('0x21')](_0xde98('0x22')),controller[_0xde98('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb185c,_0x46b9f2,_0x1e691e){_0x1e691e(null,path[_0xde98('0x19')](config['root'],_0xde98('0x1b')));},'filename':function(_0x219e57,_0xa54bd8,_0x4029e2){_0x4029e2(null,util[_0xde98('0x1c')](_0xde98('0x24'),'logologin',path[_0xde98('0x25')](_0xa54bd8[_0xde98('0x1e')])));}})});router[_0xde98('0x1f')](_0xde98('0x10'),upload[_0xde98('0x21')](_0xde98('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xde98('0x18')]({'destination':function(_0x147784,_0x7af350,_0x5791c0){_0x5791c0(null,path[_0xde98('0x19')](config[_0xde98('0x1a')],'server/files/images/logos/'));},'filename':function(_0x7a45e1,_0x532f43,_0x260501){_0x260501(null,util[_0xde98('0x1c')](_0xde98('0x24'),_0xde98('0x26'),path['extname'](_0x532f43['originalname'])));}})});router[_0xde98('0x1f')](_0xde98('0x14'),upload[_0xde98('0x21')](_0xde98('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0xde98('0x18')]({'destination':function(_0x23f389,_0xc142f4,_0x111ca2){_0x111ca2(null,path[_0xde98('0x19')](config['root'],'server/files/images/logos/'));},'filename':function(_0x297215,_0x217870,_0x5b3e04){_0x5b3e04(null,util['format']('%s%s',_0xde98('0x27'),path[_0xde98('0x25')](_0x217870['originalname'])));}})});router['post'](_0xde98('0x16'),upload[_0xde98('0x21')](_0xde98('0x22')),controller[_0xde98('0x28')]);router[_0xde98('0x29')](_0xde98('0x2a'),auth[_0xde98('0x2b')](),controller[_0xde98('0x2c')]);module[_0xde98('0x2d')]=router; \ No newline at end of file +var _0x42b2=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','single','addLogo','%s%s','logologin','extname','post','file','preferred','originalname','addPreferred','favicon','addFavicon','update','exports'];(function(_0x1196d2,_0x46a53b){var _0x290b29=function(_0x43f190){while(--_0x43f190){_0x1196d2['push'](_0x1196d2['shift']());}};_0x290b29(++_0x46a53b);}(_0x42b2,0x17a));var _0x242b=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x42b2[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x242b('0x0'));var util=require(_0x242b('0x1'));var path=require('path');var timeout=require(_0x242b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x242b('0x3'));var auth=require(_0x242b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x242b('0x5'));var controller=require(_0x242b('0x6'));router[_0x242b('0x7')]('/',auth[_0x242b('0x8')](),controller[_0x242b('0x9')]);router[_0x242b('0x7')](_0x242b('0xa'),controller[_0x242b('0xb')]);router[_0x242b('0x7')](_0x242b('0xc'),controller[_0x242b('0xd')]);router[_0x242b('0x7')](_0x242b('0xe'),controller[_0x242b('0xf')]);router[_0x242b('0x7')](_0x242b('0x10'),controller['getLogoLogin']);router[_0x242b('0x7')](_0x242b('0x11'),controller[_0x242b('0x12')]);router['get']('/:id/preferred',controller[_0x242b('0x13')]);router['get'](_0x242b('0x14'),controller[_0x242b('0x15')]);var upload=multer({'storage':multer[_0x242b('0x16')]({'destination':function(_0x33f509,_0x8bbfb3,_0x4cbd57){_0x4cbd57(null,path[_0x242b('0x17')](config[_0x242b('0x18')],_0x242b('0x19')));},'filename':function(_0x46a82e,_0x28132c,_0x4ea3c7){_0x4ea3c7(null,util[_0x242b('0x1a')]('%s%s',_0x242b('0x1b'),path['extname'](_0x28132c['originalname'])));}})});router['post'](_0x242b('0xe'),upload[_0x242b('0x1c')]('file'),controller[_0x242b('0x1d')]);var upload=multer({'storage':multer[_0x242b('0x16')]({'destination':function(_0x3090b3,_0x264646,_0x4687c4){_0x4687c4(null,path[_0x242b('0x17')](config[_0x242b('0x18')],_0x242b('0x19')));},'filename':function(_0x4ffdbd,_0x4c436d,_0x1b1d3c){_0x1b1d3c(null,util['format'](_0x242b('0x1e'),_0x242b('0x1f'),path[_0x242b('0x20')](_0x4c436d['originalname'])));}})});router[_0x242b('0x21')](_0x242b('0x10'),upload[_0x242b('0x1c')](_0x242b('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x242b('0x16')]({'destination':function(_0x3ec971,_0x46ab9c,_0xa3486c){_0xa3486c(null,path[_0x242b('0x17')](config[_0x242b('0x18')],_0x242b('0x19')));},'filename':function(_0x24b058,_0x38cfdf,_0x69c5d0){_0x69c5d0(null,util[_0x242b('0x1a')](_0x242b('0x1e'),_0x242b('0x23'),path[_0x242b('0x20')](_0x38cfdf[_0x242b('0x24')])));}})});router[_0x242b('0x21')]('/:id/preferred',upload['single'](_0x242b('0x22')),controller[_0x242b('0x25')]);var upload=multer({'storage':multer[_0x242b('0x16')]({'destination':function(_0x336246,_0x421cb9,_0xff9845){_0xff9845(null,path[_0x242b('0x17')](config[_0x242b('0x18')],_0x242b('0x19')));},'filename':function(_0x4dea62,_0x5e6538,_0x25ffba){_0x25ffba(null,util[_0x242b('0x1a')](_0x242b('0x1e'),_0x242b('0x26'),path[_0x242b('0x20')](_0x5e6538[_0x242b('0x24')])));}})});router['post'](_0x242b('0x14'),upload[_0x242b('0x1c')]('file'),controller[_0x242b('0x27')]);router['put']('/:id',auth[_0x242b('0x8')](),controller[_0x242b('0x28')]);module[_0x242b('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 010014c..30c27ec 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(_0x1155a9,_0x370456){var _0x35ac41=function(_0x5a6298){while(--_0x5a6298){_0x1155a9['push'](_0x1155a9['shift']());}};_0x35ac41(++_0x370456);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x28cc47,_0x3728e1){var _0x5f1677=function(_0x56e830){while(--_0x56e830){_0x28cc47['push'](_0x28cc47['shift']());}};_0x5f1677(++_0x3728e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 061ee6c..af74ac5 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 _0x498a=['sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','stack','name','send','Setting','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','find','body','params','addLogo','file','logo','filename','addLogoLogin','getLogo','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','getLogoLogin','preferred','default_loginLogo.svg','\x20not\x20found','download','securePassword','addPreferred','getPreferred','server/files/images/logos','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5586e4,_0x13cab6){var _0x140f8b=function(_0x811038){while(--_0x811038){_0x5586e4['push'](_0x5586e4['shift']());}};_0x140f8b(++_0x13cab6);}(_0x498a,0x1bc));var _0xa498=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x498a[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xa498('0x0'));var rimraf=require(_0xa498('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa498('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa498('0x3'));var Mustache=require(_0xa498('0x4'));var util=require(_0xa498('0x5'));var path=require(_0xa498('0x6'));var sox=require('sox');var csv=require(_0xa498('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa498('0x8'));var _=require(_0xa498('0x9'));var squel=require('squel');var crypto=require(_0xa498('0xa'));var jsforce=require(_0xa498('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa498('0x7'));var querystring=require(_0xa498('0xc'));var Papa=require(_0xa498('0xd'));var Redis=require(_0xa498('0xe'));var authService=require(_0xa498('0xf'));var qs=require(_0xa498('0x10'));var as=require(_0xa498('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa498('0x12'))(_0xa498('0x13'));var utils=require(_0xa498('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa498('0x15'));var db=require(_0xa498('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa498('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4840ed,_0x6b54c0,_0xc2680f,_0x57fff2){return new BPromise(function(_0x25f378,_0x53210a){var _0x295a37=_0x57fff2||client;return _0x295a37[_0xa498('0x18')](_0x4840ed,_0xc2680f)[_0xa498('0x19')](function(_0x535a56){logger[_0xa498('0x1a')](_0xa498('0x1b'),_0x6b54c0,_0xa498('0x1c'));logger[_0xa498('0x1d')](_0xa498('0x1e'),_0x6b54c0,'request\x20sent',JSON[_0xa498('0x1f')](_0x535a56));if(_0x535a56[_0xa498('0x20')]){if(_0x535a56['error'][_0xa498('0x21')]===0x1f4){logger[_0xa498('0x20')](_0xa498('0x1b'),_0x6b54c0,_0x535a56['error'][_0xa498('0x22')]);return _0x53210a(_0x535a56[_0xa498('0x20')][_0xa498('0x22')]);}logger[_0xa498('0x20')](_0xa498('0x1b'),_0x6b54c0,_0x535a56[_0xa498('0x20')][_0xa498('0x22')]);return _0x25f378(_0x535a56[_0xa498('0x20')][_0xa498('0x22')]);}else{logger[_0xa498('0x1a')]('Setting,\x20%s,\x20%s',_0x6b54c0,'request\x20sent');_0x25f378(_0x535a56[_0xa498('0x23')][_0xa498('0x22')]);}})['catch'](function(_0x33ec37){logger[_0xa498('0x20')](_0xa498('0x1b'),_0x6b54c0,_0x33ec37);_0x53210a(_0x33ec37);});});}function respondWithStatusCode(_0x1a159c,_0x135ea4){_0x135ea4=_0x135ea4||0xcc;return function(_0x4b8a6e){if(_0x4b8a6e){return _0x1a159c[_0xa498('0x24')](_0x135ea4);}return _0x1a159c['status'](_0x135ea4)[_0xa498('0x25')]();};}function respondWithResult(_0x232b87,_0x572dff){_0x572dff=_0x572dff||0xc8;return function(_0x45bbd0){if(_0x45bbd0){return _0x232b87[_0xa498('0x26')](_0x572dff)[_0xa498('0x27')](_0x45bbd0);}};}function respondWithFilteredResult(_0x342c5e,_0xb5a355){return function(_0x289d1c){if(_0x289d1c){var _0x19b027=typeof _0xb5a355['offset']===_0xa498('0x28')&&typeof _0xb5a355[_0xa498('0x29')]==='undefined';var _0x489462=_0x289d1c[_0xa498('0x2a')];var _0x28ad1e=_0x19b027?0x0:_0xb5a355[_0xa498('0x2b')];var _0x1a25c5=_0x19b027?_0x289d1c[_0xa498('0x2a')]:_0xb5a355[_0xa498('0x2b')]+_0xb5a355[_0xa498('0x29')];var _0xeee628;if(_0x1a25c5>=_0x489462){_0x1a25c5=_0x489462;_0xeee628=0xc8;}else{_0xeee628=0xce;}_0x342c5e[_0xa498('0x26')](_0xeee628);return _0x342c5e[_0xa498('0x2c')](_0xa498('0x2d'),_0x28ad1e+'-'+_0x1a25c5+'/'+_0x489462)[_0xa498('0x27')](_0x289d1c);}return null;};}function patchUpdates(_0x32de72){return function(_0x3fc323){try{jsonpatch['apply'](_0x3fc323,_0x32de72,!![]);}catch(_0x39ea90){return BPromise[_0xa498('0x2e')](_0x39ea90);}return _0x3fc323[_0xa498('0x2f')]();};}function saveUpdates(_0x578bf4,_0x8527b7){return function(_0xb09e38){if(_0xb09e38){return _0xb09e38['update'](_0x578bf4)[_0xa498('0x19')](function(_0x95aa19){return _0x95aa19;});}return null;};}function removeEntity(_0x100c34,_0x5daef0){return function(_0xf0c8e9){if(_0xf0c8e9){return _0xf0c8e9['destroy']()[_0xa498('0x19')](function(){_0x100c34[_0xa498('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x80382f,_0x346771){return function(_0x491071){if(!_0x491071){_0x80382f[_0xa498('0x24')](0x194);}return _0x491071;};}function handleError(_0x48e030,_0x3d5b93){_0x3d5b93=_0x3d5b93||0x1f4;return function(_0x16520b){logger['error'](_0x16520b[_0xa498('0x30')]);if(_0x16520b[_0xa498('0x31')]){delete _0x16520b[_0xa498('0x31')];}_0x48e030[_0xa498('0x26')](_0x3d5b93)[_0xa498('0x32')](_0x16520b);};}exports['index']=function(_0x11f88e,_0x126191){var _0x50a1d9={},_0x346e75={},_0x52c170={'count':0x0,'rows':[]};var _0x4014b7=_['map'](db[_0xa498('0x33')][_0xa498('0x34')],function(_0x2ec7a3){return{'name':_0x2ec7a3['fieldName'],'type':_0x2ec7a3['type'][_0xa498('0x35')]};});_0x346e75[_0xa498('0x36')]=_['map'](_0x4014b7,_0xa498('0x31'));_0x346e75['query']=_['keys'](_0x11f88e[_0xa498('0x37')]);_0x346e75[_0xa498('0x38')]=_[_0xa498('0x39')](_0x346e75[_0xa498('0x36')],_0x346e75[_0xa498('0x37')]);_0x50a1d9[_0xa498('0x3a')]=_['intersection'](_0x346e75[_0xa498('0x36')],qs[_0xa498('0x3b')](_0x11f88e[_0xa498('0x37')]['fields']));_0x50a1d9[_0xa498('0x3a')]=_0x50a1d9[_0xa498('0x3a')][_0xa498('0x3c')]?_0x50a1d9['attributes']:_0x346e75['model'];if(!_0x11f88e[_0xa498('0x37')]['hasOwnProperty'](_0xa498('0x3d'))){_0x50a1d9['limit']=qs[_0xa498('0x29')](_0x11f88e[_0xa498('0x37')]['limit']);_0x50a1d9['offset']=qs[_0xa498('0x2b')](_0x11f88e[_0xa498('0x37')][_0xa498('0x2b')]);}_0x50a1d9[_0xa498('0x3e')]=qs['sort'](_0x11f88e[_0xa498('0x37')][_0xa498('0x3f')]);_0x50a1d9[_0xa498('0x40')]=qs[_0xa498('0x38')](_[_0xa498('0x41')](_0x11f88e['query'],_0x346e75['filters']),_0x4014b7);if(_0x11f88e[_0xa498('0x37')][_0xa498('0x42')]){_0x50a1d9['where']=_[_0xa498('0x43')](_0x50a1d9[_0xa498('0x40')],{'$or':_[_0xa498('0x44')](_0x4014b7,function(_0x3b3dd4){if(_0x3b3dd4[_0xa498('0x45')]!==_0xa498('0x46')){var _0x298806={};_0x298806[_0x3b3dd4[_0xa498('0x31')]]={'$like':'%'+_0x11f88e[_0xa498('0x37')][_0xa498('0x42')]+'%'};return _0x298806;}})});}_0x50a1d9=_[_0xa498('0x43')]({},_0x50a1d9,_0x11f88e['options']);var _0x51cb8f={'where':_0x50a1d9[_0xa498('0x40')]};return db['Setting'][_0xa498('0x2a')](_0x51cb8f)[_0xa498('0x19')](function(_0x4def8e){_0x52c170[_0xa498('0x2a')]=_0x4def8e;if(_0x11f88e[_0xa498('0x37')][_0xa498('0x47')]){_0x50a1d9[_0xa498('0x48')]=[{'all':!![]}];}return db[_0xa498('0x33')][_0xa498('0x49')](_0x50a1d9);})['then'](function(_0x23301e){_0x52c170[_0xa498('0x4a')]=_0x23301e;return _0x52c170;})['then'](respondWithFilteredResult(_0x126191,_0x50a1d9))[_0xa498('0x4b')](handleError(_0x126191,null));};exports['show']=function(_0xbf0aca,_0x229565){var _0x8e7cfe={'raw':![],'where':{'id':_0xbf0aca['params']['id']}},_0x14f7a6={};_0x14f7a6['model']=_[_0xa498('0x4c')](db[_0xa498('0x33')][_0xa498('0x34')]);_0x14f7a6['query']=_[_0xa498('0x4c')](_0xbf0aca['query']);_0x14f7a6[_0xa498('0x38')]=_['intersection'](_0x14f7a6['model'],_0x14f7a6[_0xa498('0x37')]);_0x8e7cfe['attributes']=_[_0xa498('0x39')](_0x14f7a6[_0xa498('0x36')],qs[_0xa498('0x3b')](_0xbf0aca[_0xa498('0x37')][_0xa498('0x3b')]));_0x8e7cfe[_0xa498('0x3a')]=_0x8e7cfe['attributes'][_0xa498('0x3c')]?_0x8e7cfe[_0xa498('0x3a')]:_0x14f7a6['model'];if(_0xbf0aca[_0xa498('0x37')]['includeAll']){_0x8e7cfe[_0xa498('0x48')]=[{'all':!![]}];}_0x8e7cfe=_['merge']({},_0x8e7cfe,_0xbf0aca[_0xa498('0x4d')]);return db[_0xa498('0x33')][_0xa498('0x4e')](_0x8e7cfe)['then'](handleEntityNotFound(_0x229565,null))[_0xa498('0x19')](respondWithResult(_0x229565,null))[_0xa498('0x4b')](handleError(_0x229565,null));};exports['update']=function(_0x552ae9,_0x4cdad6){if(_0x552ae9[_0xa498('0x4f')]['id']){delete _0x552ae9[_0xa498('0x4f')]['id'];}return db['Setting']['find']({'where':{'id':_0x552ae9[_0xa498('0x50')]['id']}})[_0xa498('0x19')](handleEntityNotFound(_0x4cdad6,null))[_0xa498('0x19')](saveUpdates(_0x552ae9['body'],null))['then'](respondWithResult(_0x4cdad6,null))['catch'](handleError(_0x4cdad6,null));};exports[_0xa498('0x51')]=function(_0x41b5f6,_0xd09e35,_0x5af64e){if(_0x41b5f6['file']&&_0x41b5f6[_0xa498('0x52')]['filename']){_0x41b5f6['body'][_0xa498('0x53')]=_0x41b5f6['file'][_0xa498('0x54')];}return db[_0xa498('0x33')][_0xa498('0x4e')]({'where':{'id':_0x41b5f6[_0xa498('0x50')]['id']}})[_0xa498('0x19')](handleEntityNotFound(_0xd09e35,null))[_0xa498('0x19')](saveUpdates(_0x41b5f6[_0xa498('0x4f')],null))[_0xa498('0x19')](respondWithResult(_0xd09e35,null))[_0xa498('0x4b')](handleError(_0xd09e35,null));};exports[_0xa498('0x55')]=function(_0x4fb2ba,_0x55f5d2,_0x4d52ef){if(_0x4fb2ba[_0xa498('0x52')]&&_0x4fb2ba[_0xa498('0x52')]['filename']){_0x4fb2ba['body']['loginLogo']=_0x4fb2ba[_0xa498('0x52')][_0xa498('0x54')];}return db[_0xa498('0x33')][_0xa498('0x4e')]({'where':{'id':_0x4fb2ba['params']['id']}})[_0xa498('0x19')](handleEntityNotFound(_0x55f5d2,null))[_0xa498('0x19')](saveUpdates(_0x4fb2ba[_0xa498('0x4f')],null))[_0xa498('0x19')](respondWithResult(_0x55f5d2,null))['catch'](handleError(_0x55f5d2,null));};var utilLicense=require('../../config/license/util');exports[_0xa498('0x56')]=function(_0x4d7826,_0x501701,_0x357ca9){var _0x23abb6='server/files/images/logos';var _0x26d40f={'custom':![]};return utilLicense['getLicense']()[_0xa498('0x19')](function(_0x566509){if(_0x566509){_0x26d40f=_0x566509;}return db[_0xa498('0x33')]['find']({'where':{'id':_0x4d7826[_0xa498('0x50')]['id']},'attributes':[_0xa498('0x53'),_0xa498('0x57'),'preferred',_0xa498('0x58'),_0xa498('0x59'),_0xa498('0x5a'),_0xa498('0x5b'),_0xa498('0x5c')],'raw':!![]});})[_0xa498('0x19')](handleEntityNotFound(_0x501701,null))[_0xa498('0x19')](function(_0x3db58a){if(_0x3db58a){var _0x410d5c=_0x3db58a[_0xa498('0x53')]&&fs[_0xa498('0x5d')](path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x23abb6,_[_0xa498('0x60')](_0x3db58a[_0xa498('0x53')])))?path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x23abb6,_[_0xa498('0x60')](_0x3db58a[_0xa498('0x53')])):path['join'](config['root'],_0x23abb6,_[_0xa498('0x60')](_0xa498('0x61')));var _0x299e93=_0xa498('0x62')+_['upperFirst'](_0xa498('0x53'));if(_0x3db58a[_0x299e93]||!_0x26d40f[_0xa498('0x63')]){_0x410d5c=path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x23abb6,_[_0xa498('0x60')](_0xa498('0x61')));}if(!fs[_0xa498('0x5d')](_0x410d5c)){throw new db[(_0xa498('0x64'))][(_0xa498('0x65'))](_[_0xa498('0x66')](_0xa498('0x53'))+'\x20not\x20found');}return _0x501701['download'](_0x410d5c);}})['catch'](handleError(_0x501701,null));};var utilLicense=require('../../config/license/util');exports[_0xa498('0x67')]=function(_0x13f3dc,_0x3d5d46,_0x166aed){var _0x45ea10='server/files/images/logos';var _0x2bfd4a={'custom':![]};return utilLicense['getLicense']()[_0xa498('0x19')](function(_0x550af1){if(_0x550af1){_0x2bfd4a=_0x550af1;}return db[_0xa498('0x33')][_0xa498('0x4e')]({'where':{'id':_0x13f3dc['params']['id']},'attributes':[_0xa498('0x53'),_0xa498('0x57'),_0xa498('0x68'),_0xa498('0x58'),_0xa498('0x59'),_0xa498('0x5a'),'defaultPreferred',_0xa498('0x5c')],'raw':!![]});})[_0xa498('0x19')](handleEntityNotFound(_0x3d5d46,null))[_0xa498('0x19')](function(_0x53503d){if(_0x53503d){var _0x50fc7c=_0x53503d['loginLogo']&&fs[_0xa498('0x5d')](path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x45ea10,_[_0xa498('0x60')](_0x53503d['loginLogo'])))?path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x45ea10,_[_0xa498('0x60')](_0x53503d[_0xa498('0x57')])):path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x45ea10,_[_0xa498('0x60')](_0xa498('0x69')));var _0xb35ac2=_0xa498('0x62')+_[_0xa498('0x66')](_0xa498('0x57'));if(_0x53503d[_0xb35ac2]||!_0x2bfd4a[_0xa498('0x63')]){_0x50fc7c=path[_0xa498('0x5e')](config['root'],_0x45ea10,_['toLower'](_0xa498('0x69')));}if(!fs[_0xa498('0x5d')](_0x50fc7c)){throw new db[(_0xa498('0x64'))][(_0xa498('0x65'))](_[_0xa498('0x66')]('loginLogo')+_0xa498('0x6a'));}return _0x3d5d46[_0xa498('0x6b')](_0x50fc7c);}})[_0xa498('0x4b')](handleError(_0x3d5d46,null));};exports['gdpr']=function(_0x4a3cf1,_0x586716){return db['Setting'][_0xa498('0x4e')]({'where':{'id':_0x4a3cf1[_0xa498('0x50')]['id']},'attributes':[_0xa498('0x6c')]})[_0xa498('0x19')](respondWithResult(_0x586716,null))['catch'](handleError(_0x586716,null));};exports[_0xa498('0x6d')]=function(_0x224ee6,_0x5e0c71,_0xb0e62c){if(_0x224ee6[_0xa498('0x52')]&&_0x224ee6[_0xa498('0x52')][_0xa498('0x54')]){_0x224ee6[_0xa498('0x4f')][_0xa498('0x68')]=_0x224ee6['file'][_0xa498('0x54')];}return db[_0xa498('0x33')][_0xa498('0x4e')]({'where':{'id':_0x224ee6[_0xa498('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e0c71,null))[_0xa498('0x19')](saveUpdates(_0x224ee6[_0xa498('0x4f')],null))[_0xa498('0x19')](respondWithResult(_0x5e0c71,null))[_0xa498('0x4b')](handleError(_0x5e0c71,null));};var utilLicense=require(_0xa498('0x15'));exports[_0xa498('0x6e')]=function(_0x4b5dfe,_0x20683b,_0x128e4e){var _0x52d03f=_0xa498('0x6f');var _0x14bf65={'custom':![]};return utilLicense[_0xa498('0x70')]()[_0xa498('0x19')](function(_0x3a0749){if(_0x3a0749){_0x14bf65=_0x3a0749;}return db[_0xa498('0x33')][_0xa498('0x4e')]({'where':{'id':_0x4b5dfe[_0xa498('0x50')]['id']},'attributes':['logo','loginLogo','preferred',_0xa498('0x58'),'defaultLogo',_0xa498('0x5a'),_0xa498('0x5b'),_0xa498('0x5c')],'raw':!![]});})[_0xa498('0x19')](handleEntityNotFound(_0x20683b,null))[_0xa498('0x19')](function(_0x58a2c5){if(_0x58a2c5){var _0x540f2d=_0x58a2c5[_0xa498('0x68')]&&fs['existsSync'](path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x52d03f,_[_0xa498('0x60')](_0x58a2c5[_0xa498('0x68')])))?path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x52d03f,_[_0xa498('0x60')](_0x58a2c5[_0xa498('0x68')])):path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x52d03f,_['toLower'](_0xa498('0x71')));var _0x40b064=_0xa498('0x62')+_[_0xa498('0x66')]('preferred');if(_0x58a2c5[_0x40b064]||!_0x14bf65[_0xa498('0x63')]||!_0x14bf65[_0xa498('0x68')]){_0x540f2d=path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x52d03f,_[_0xa498('0x60')](_0xa498('0x71')));}if(!fs[_0xa498('0x5d')](_0x540f2d)){throw new db[(_0xa498('0x64'))][(_0xa498('0x65'))](_[_0xa498('0x66')](_0xa498('0x68'))+_0xa498('0x6a'));}return _0x20683b[_0xa498('0x6b')](_0x540f2d);}})[_0xa498('0x4b')](handleError(_0x20683b,null));};exports[_0xa498('0x72')]=function(_0x100614,_0x22fd0e,_0x181cac){if(_0x100614[_0xa498('0x52')]&&_0x100614['file'][_0xa498('0x54')]){_0x100614[_0xa498('0x4f')][_0xa498('0x58')]=_0x100614['file'][_0xa498('0x54')];}return db['Setting']['find']({'where':{'id':_0x100614[_0xa498('0x50')]['id']}})['then'](handleEntityNotFound(_0x22fd0e,null))['then'](saveUpdates(_0x100614[_0xa498('0x4f')],null))['then'](respondWithResult(_0x22fd0e,null))[_0xa498('0x4b')](handleError(_0x22fd0e,null));};var utilLicense=require(_0xa498('0x15'));exports[_0xa498('0x73')]=function(_0x8473cc,_0x51d797,_0x41a606){var _0x766ea9=_0xa498('0x6f');var _0x448efb={'custom':![]};return utilLicense[_0xa498('0x70')]()[_0xa498('0x19')](function(_0x1577bb){if(_0x1577bb){_0x448efb=_0x1577bb;}return db[_0xa498('0x33')][_0xa498('0x4e')]({'where':{'id':_0x8473cc['params']['id']},'attributes':[_0xa498('0x53'),'loginLogo',_0xa498('0x68'),_0xa498('0x58'),_0xa498('0x59'),_0xa498('0x5a'),_0xa498('0x5b'),_0xa498('0x5c')],'raw':!![]});})[_0xa498('0x19')](handleEntityNotFound(_0x51d797,null))['then'](function(_0x246e36){if(_0x246e36){var _0x1d4987=_0x246e36[_0xa498('0x58')]&&fs[_0xa498('0x5d')](path[_0xa498('0x5e')](config['root'],_0x766ea9,_[_0xa498('0x60')](_0x246e36['favicon'])))?path['join'](config[_0xa498('0x5f')],_0x766ea9,_[_0xa498('0x60')](_0x246e36[_0xa498('0x58')])):path[_0xa498('0x5e')](config[_0xa498('0x5f')],_0x766ea9,_['toLower'](_0xa498('0x74')));var _0x5d0c88='default'+_[_0xa498('0x66')](_0xa498('0x58'));if(_0x246e36[_0x5d0c88]||!_0x448efb[_0xa498('0x63')]){_0x1d4987=path[_0xa498('0x5e')](config['root'],_0x766ea9,_[_0xa498('0x60')](_0xa498('0x74')));}if(!fs[_0xa498('0x5d')](_0x1d4987)){throw new db[(_0xa498('0x64'))]['ValidationError'](_[_0xa498('0x66')](_0xa498('0x58'))+'\x20not\x20found');}return _0x51d797[_0xa498('0x6b')](_0x1d4987);}})[_0xa498('0x4b')](handleError(_0x51d797,null));};exports['getDate']=function(_0x3fa732,_0x50000e){var _0x4f50e8={'offset':moment()[_0xa498('0x75')]()};_0x4f50e8['now']=moment()[_0xa498('0x75')](_0x4f50e8['offset'])[_0xa498('0x76')](_0xa498('0x77'));return _0x50000e['status'](0xc8)[_0xa498('0x32')](_0x4f50e8);}; \ No newline at end of file +var _0x7d74=['defaultFavicon','default_loginLogo.svg','gdpr','addPreferred','getPreferred','getFavicon','default_favicon.ico','utcOffset','now','format','eml-format','request-promise','moment','mustache','util','path','sox','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/environment','../../config/license/util','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','Setting','findAll','rows','show','rawAttributes','options','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','toLower','root','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','favicon'];(function(_0x13024a,_0x21573e){var _0x5ac98b=function(_0x3eb57d){while(--_0x3eb57d){_0x13024a['push'](_0x13024a['shift']());}};_0x5ac98b(++_0x21573e);}(_0x7d74,0x172));var _0x47d7=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7d74[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x47d7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47d7('0x1'));var moment=require(_0x47d7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x47d7('0x3'));var util=require(_0x47d7('0x4'));var path=require(_0x47d7('0x5'));var sox=require(_0x47d7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47d7('0x7'));var _=require('lodash');var squel=require(_0x47d7('0x8'));var crypto=require(_0x47d7('0x9'));var jsforce=require(_0x47d7('0xa'));var deskjs=require(_0x47d7('0xb'));var toCsv=require(_0x47d7('0xc'));var querystring=require(_0x47d7('0xd'));var Papa=require(_0x47d7('0xe'));var Redis=require(_0x47d7('0xf'));var authService=require(_0x47d7('0x10'));var qs=require(_0x47d7('0x11'));var as=require(_0x47d7('0x12'));var hardwareService=require(_0x47d7('0x13'));var logger=require(_0x47d7('0x14'))(_0x47d7('0x15'));var utils=require(_0x47d7('0x16'));var config=require(_0x47d7('0x17'));var licenseUtil=require(_0x47d7('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x47d7('0x19'));var client=jayson[_0x47d7('0x1a')][_0x47d7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x45eab9,_0x33279a,_0x948c12,_0x4fbf29){return new BPromise(function(_0x110992,_0x3ca79a){var _0x48cce0=_0x4fbf29||client;return _0x48cce0[_0x47d7('0x1c')](_0x45eab9,_0x948c12)['then'](function(_0x1083f1){logger['info'](_0x47d7('0x1d'),_0x33279a,_0x47d7('0x1e'));logger[_0x47d7('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x33279a,_0x47d7('0x1e'),JSON[_0x47d7('0x20')](_0x1083f1));if(_0x1083f1[_0x47d7('0x21')]){if(_0x1083f1[_0x47d7('0x21')]['code']===0x1f4){logger[_0x47d7('0x21')](_0x47d7('0x1d'),_0x33279a,_0x1083f1[_0x47d7('0x21')][_0x47d7('0x22')]);return _0x3ca79a(_0x1083f1[_0x47d7('0x21')][_0x47d7('0x22')]);}logger[_0x47d7('0x21')](_0x47d7('0x1d'),_0x33279a,_0x1083f1[_0x47d7('0x21')]['message']);return _0x110992(_0x1083f1[_0x47d7('0x21')][_0x47d7('0x22')]);}else{logger[_0x47d7('0x23')]('Setting,\x20%s,\x20%s',_0x33279a,_0x47d7('0x1e'));_0x110992(_0x1083f1['result'][_0x47d7('0x22')]);}})[_0x47d7('0x24')](function(_0xbf3903){logger[_0x47d7('0x21')](_0x47d7('0x1d'),_0x33279a,_0xbf3903);_0x3ca79a(_0xbf3903);});});}function respondWithStatusCode(_0x13f7b2,_0x37b5c){_0x37b5c=_0x37b5c||0xcc;return function(_0x17333c){if(_0x17333c){return _0x13f7b2['sendStatus'](_0x37b5c);}return _0x13f7b2[_0x47d7('0x25')](_0x37b5c)[_0x47d7('0x26')]();};}function respondWithResult(_0x22b85b,_0x464407){_0x464407=_0x464407||0xc8;return function(_0x388fe6){if(_0x388fe6){return _0x22b85b[_0x47d7('0x25')](_0x464407)[_0x47d7('0x27')](_0x388fe6);}};}function respondWithFilteredResult(_0x2a313d,_0x679df0){return function(_0x41e555){if(_0x41e555){var _0xebdecd=typeof _0x679df0[_0x47d7('0x28')]===_0x47d7('0x29')&&typeof _0x679df0[_0x47d7('0x2a')]==='undefined';var _0x588c4f=_0x41e555[_0x47d7('0x2b')];var _0x4daf85=_0xebdecd?0x0:_0x679df0[_0x47d7('0x28')];var _0x22ce97=_0xebdecd?_0x41e555['count']:_0x679df0['offset']+_0x679df0[_0x47d7('0x2a')];var _0x1d4b4c;if(_0x22ce97>=_0x588c4f){_0x22ce97=_0x588c4f;_0x1d4b4c=0xc8;}else{_0x1d4b4c=0xce;}_0x2a313d[_0x47d7('0x25')](_0x1d4b4c);return _0x2a313d['set'](_0x47d7('0x2c'),_0x4daf85+'-'+_0x22ce97+'/'+_0x588c4f)['json'](_0x41e555);}return null;};}function patchUpdates(_0x2c9447){return function(_0x5761b1){try{jsonpatch[_0x47d7('0x2d')](_0x5761b1,_0x2c9447,!![]);}catch(_0x114b49){return BPromise['reject'](_0x114b49);}return _0x5761b1[_0x47d7('0x2e')]();};}function saveUpdates(_0xde72a1,_0x52b15a){return function(_0x253f99){if(_0x253f99){return _0x253f99[_0x47d7('0x2f')](_0xde72a1)[_0x47d7('0x30')](function(_0x54c9c7){return _0x54c9c7;});}return null;};}function removeEntity(_0x3b0459,_0x49b595){return function(_0x134b7f){if(_0x134b7f){return _0x134b7f[_0x47d7('0x31')]()[_0x47d7('0x30')](function(){_0x3b0459['status'](0xcc)[_0x47d7('0x26')]();});}};}function handleEntityNotFound(_0x53dee6,_0x7f753){return function(_0x42b99f){if(!_0x42b99f){_0x53dee6[_0x47d7('0x32')](0x194);}return _0x42b99f;};}function handleError(_0x31f5c4,_0x3134c5){_0x3134c5=_0x3134c5||0x1f4;return function(_0x4809ff){logger[_0x47d7('0x21')](_0x4809ff['stack']);if(_0x4809ff[_0x47d7('0x33')]){delete _0x4809ff[_0x47d7('0x33')];}_0x31f5c4['status'](_0x3134c5)[_0x47d7('0x34')](_0x4809ff);};}exports[_0x47d7('0x35')]=function(_0x38f450,_0x435fcd){var _0x50bf4b={},_0xbefa52={},_0x17d7bb={'count':0x0,'rows':[]};var _0x26ddbc=_[_0x47d7('0x36')](db['Setting']['rawAttributes'],function(_0x56fafc){return{'name':_0x56fafc[_0x47d7('0x37')],'type':_0x56fafc[_0x47d7('0x38')]['key']};});_0xbefa52[_0x47d7('0x39')]=_[_0x47d7('0x36')](_0x26ddbc,_0x47d7('0x33'));_0xbefa52[_0x47d7('0x3a')]=_[_0x47d7('0x3b')](_0x38f450[_0x47d7('0x3a')]);_0xbefa52[_0x47d7('0x3c')]=_['intersection'](_0xbefa52[_0x47d7('0x39')],_0xbefa52[_0x47d7('0x3a')]);_0x50bf4b[_0x47d7('0x3d')]=_[_0x47d7('0x3e')](_0xbefa52[_0x47d7('0x39')],qs[_0x47d7('0x3f')](_0x38f450[_0x47d7('0x3a')]['fields']));_0x50bf4b['attributes']=_0x50bf4b[_0x47d7('0x3d')][_0x47d7('0x40')]?_0x50bf4b[_0x47d7('0x3d')]:_0xbefa52['model'];if(!_0x38f450[_0x47d7('0x3a')][_0x47d7('0x41')](_0x47d7('0x42'))){_0x50bf4b[_0x47d7('0x2a')]=qs[_0x47d7('0x2a')](_0x38f450[_0x47d7('0x3a')]['limit']);_0x50bf4b[_0x47d7('0x28')]=qs[_0x47d7('0x28')](_0x38f450['query'][_0x47d7('0x28')]);}_0x50bf4b[_0x47d7('0x43')]=qs[_0x47d7('0x44')](_0x38f450['query'][_0x47d7('0x44')]);_0x50bf4b[_0x47d7('0x45')]=qs[_0x47d7('0x3c')](_[_0x47d7('0x46')](_0x38f450['query'],_0xbefa52[_0x47d7('0x3c')]),_0x26ddbc);if(_0x38f450[_0x47d7('0x3a')][_0x47d7('0x47')]){_0x50bf4b[_0x47d7('0x45')]=_[_0x47d7('0x48')](_0x50bf4b[_0x47d7('0x45')],{'$or':_[_0x47d7('0x36')](_0x26ddbc,function(_0x5d7a15){if(_0x5d7a15[_0x47d7('0x38')]!=='VIRTUAL'){var _0x241458={};_0x241458[_0x5d7a15[_0x47d7('0x33')]]={'$like':'%'+_0x38f450[_0x47d7('0x3a')]['filter']+'%'};return _0x241458;}})});}_0x50bf4b=_[_0x47d7('0x48')]({},_0x50bf4b,_0x38f450['options']);var _0x274e45={'where':_0x50bf4b[_0x47d7('0x45')]};return db['Setting'][_0x47d7('0x2b')](_0x274e45)[_0x47d7('0x30')](function(_0x2618f1){_0x17d7bb['count']=_0x2618f1;if(_0x38f450[_0x47d7('0x3a')][_0x47d7('0x49')]){_0x50bf4b[_0x47d7('0x4a')]=[{'all':!![]}];}return db[_0x47d7('0x4b')][_0x47d7('0x4c')](_0x50bf4b);})[_0x47d7('0x30')](function(_0x4beced){_0x17d7bb[_0x47d7('0x4d')]=_0x4beced;return _0x17d7bb;})[_0x47d7('0x30')](respondWithFilteredResult(_0x435fcd,_0x50bf4b))[_0x47d7('0x24')](handleError(_0x435fcd,null));};exports[_0x47d7('0x4e')]=function(_0x218fb7,_0x37e80d){var _0x5ed410={'raw':![],'where':{'id':_0x218fb7['params']['id']}},_0x10c5f2={};_0x10c5f2[_0x47d7('0x39')]=_[_0x47d7('0x3b')](db['Setting'][_0x47d7('0x4f')]);_0x10c5f2['query']=_[_0x47d7('0x3b')](_0x218fb7[_0x47d7('0x3a')]);_0x10c5f2[_0x47d7('0x3c')]=_[_0x47d7('0x3e')](_0x10c5f2[_0x47d7('0x39')],_0x10c5f2[_0x47d7('0x3a')]);_0x5ed410[_0x47d7('0x3d')]=_['intersection'](_0x10c5f2['model'],qs[_0x47d7('0x3f')](_0x218fb7['query']['fields']));_0x5ed410[_0x47d7('0x3d')]=_0x5ed410[_0x47d7('0x3d')]['length']?_0x5ed410[_0x47d7('0x3d')]:_0x10c5f2[_0x47d7('0x39')];if(_0x218fb7[_0x47d7('0x3a')][_0x47d7('0x49')]){_0x5ed410[_0x47d7('0x4a')]=[{'all':!![]}];}_0x5ed410=_[_0x47d7('0x48')]({},_0x5ed410,_0x218fb7[_0x47d7('0x50')]);return db['Setting'][_0x47d7('0x51')](_0x5ed410)[_0x47d7('0x30')](handleEntityNotFound(_0x37e80d,null))[_0x47d7('0x30')](respondWithResult(_0x37e80d,null))[_0x47d7('0x24')](handleError(_0x37e80d,null));};exports[_0x47d7('0x2f')]=function(_0x4e0f8a,_0x17863a){if(_0x4e0f8a[_0x47d7('0x52')]['id']){delete _0x4e0f8a['body']['id'];}return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0x4e0f8a[_0x47d7('0x53')]['id']}})[_0x47d7('0x30')](handleEntityNotFound(_0x17863a,null))[_0x47d7('0x30')](saveUpdates(_0x4e0f8a[_0x47d7('0x52')],null))[_0x47d7('0x30')](respondWithResult(_0x17863a,null))['catch'](handleError(_0x17863a,null));};exports[_0x47d7('0x54')]=function(_0xc2e823,_0x3fa454,_0x162164){if(_0xc2e823[_0x47d7('0x55')]&&_0xc2e823[_0x47d7('0x55')][_0x47d7('0x56')]){_0xc2e823['body'][_0x47d7('0x57')]=_0xc2e823[_0x47d7('0x55')][_0x47d7('0x56')];}return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0xc2e823['params']['id']}})[_0x47d7('0x30')](handleEntityNotFound(_0x3fa454,null))['then'](saveUpdates(_0xc2e823[_0x47d7('0x52')],null))[_0x47d7('0x30')](respondWithResult(_0x3fa454,null))['catch'](handleError(_0x3fa454,null));};exports[_0x47d7('0x58')]=function(_0x3b32e6,_0x1a4253,_0xdce023){if(_0x3b32e6[_0x47d7('0x55')]&&_0x3b32e6['file'][_0x47d7('0x56')]){_0x3b32e6[_0x47d7('0x52')][_0x47d7('0x59')]=_0x3b32e6['file']['filename'];}return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0x3b32e6[_0x47d7('0x53')]['id']}})[_0x47d7('0x30')](handleEntityNotFound(_0x1a4253,null))[_0x47d7('0x30')](saveUpdates(_0x3b32e6[_0x47d7('0x52')],null))[_0x47d7('0x30')](respondWithResult(_0x1a4253,null))['catch'](handleError(_0x1a4253,null));};var utilLicense=require(_0x47d7('0x18'));exports[_0x47d7('0x5a')]=function(_0x34a7f0,_0x91cf7b,_0x4ef899){var _0x3f4fbe=_0x47d7('0x5b');var _0x50a11e={'custom':![]};return utilLicense[_0x47d7('0x5c')]()[_0x47d7('0x30')](function(_0x48df6d){if(_0x48df6d){_0x50a11e=_0x48df6d;}return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0x34a7f0['params']['id']},'attributes':[_0x47d7('0x57'),_0x47d7('0x59'),_0x47d7('0x5d'),'favicon',_0x47d7('0x5e'),_0x47d7('0x5f'),_0x47d7('0x60'),'defaultFavicon'],'raw':!![]});})[_0x47d7('0x30')](handleEntityNotFound(_0x91cf7b,null))['then'](function(_0x23b21f){if(_0x23b21f){var _0x1c03df=_0x23b21f['logo']&&fs[_0x47d7('0x61')](path['join'](config['root'],_0x3f4fbe,_[_0x47d7('0x62')](_0x23b21f[_0x47d7('0x57')])))?path['join'](config[_0x47d7('0x63')],_0x3f4fbe,_['toLower'](_0x23b21f[_0x47d7('0x57')])):path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x3f4fbe,_[_0x47d7('0x62')](_0x47d7('0x65')));var _0x132ecd=_0x47d7('0x66')+_[_0x47d7('0x67')](_0x47d7('0x57'));if(_0x23b21f[_0x132ecd]||!_0x50a11e[_0x47d7('0x68')]){_0x1c03df=path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x3f4fbe,_[_0x47d7('0x62')](_0x47d7('0x65')));}if(!fs[_0x47d7('0x61')](_0x1c03df)){throw new db[(_0x47d7('0x69'))][(_0x47d7('0x6a'))](_[_0x47d7('0x67')](_0x47d7('0x57'))+_0x47d7('0x6b'));}return _0x91cf7b[_0x47d7('0x6c')](_0x1c03df);}})[_0x47d7('0x24')](handleError(_0x91cf7b,null));};var utilLicense=require(_0x47d7('0x18'));exports['getLogoLogin']=function(_0x28ffa2,_0xd63375,_0x328b00){var _0x11a5c0='server/files/images/logos';var _0x2139cd={'custom':![]};return utilLicense[_0x47d7('0x5c')]()['then'](function(_0x264437){if(_0x264437){_0x2139cd=_0x264437;}return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0x28ffa2['params']['id']},'attributes':[_0x47d7('0x57'),_0x47d7('0x59'),'preferred',_0x47d7('0x6d'),'defaultLogo',_0x47d7('0x5f'),_0x47d7('0x60'),_0x47d7('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0xd63375,null))[_0x47d7('0x30')](function(_0x12334a){if(_0x12334a){var _0x5a3639=_0x12334a[_0x47d7('0x59')]&&fs[_0x47d7('0x61')](path['join'](config[_0x47d7('0x63')],_0x11a5c0,_[_0x47d7('0x62')](_0x12334a['loginLogo'])))?path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x11a5c0,_['toLower'](_0x12334a[_0x47d7('0x59')])):path[_0x47d7('0x64')](config['root'],_0x11a5c0,_[_0x47d7('0x62')](_0x47d7('0x6f')));var _0x3290f5=_0x47d7('0x66')+_['upperFirst'](_0x47d7('0x59'));if(_0x12334a[_0x3290f5]||!_0x2139cd[_0x47d7('0x68')]){_0x5a3639=path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x11a5c0,_[_0x47d7('0x62')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x5a3639)){throw new db[(_0x47d7('0x69'))][(_0x47d7('0x6a'))](_['upperFirst'](_0x47d7('0x59'))+_0x47d7('0x6b'));}return _0xd63375['download'](_0x5a3639);}})[_0x47d7('0x24')](handleError(_0xd63375,null));};exports[_0x47d7('0x70')]=function(_0x3d14d7,_0x1222e0){return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0x3d14d7[_0x47d7('0x53')]['id']},'attributes':['securePassword']})[_0x47d7('0x30')](respondWithResult(_0x1222e0,null))[_0x47d7('0x24')](handleError(_0x1222e0,null));};exports[_0x47d7('0x71')]=function(_0x19817,_0x134586,_0x1df090){if(_0x19817[_0x47d7('0x55')]&&_0x19817[_0x47d7('0x55')][_0x47d7('0x56')]){_0x19817['body'][_0x47d7('0x5d')]=_0x19817[_0x47d7('0x55')]['filename'];}return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0x19817[_0x47d7('0x53')]['id']}})[_0x47d7('0x30')](handleEntityNotFound(_0x134586,null))[_0x47d7('0x30')](saveUpdates(_0x19817[_0x47d7('0x52')],null))[_0x47d7('0x30')](respondWithResult(_0x134586,null))[_0x47d7('0x24')](handleError(_0x134586,null));};var utilLicense=require(_0x47d7('0x18'));exports[_0x47d7('0x72')]=function(_0x5c4dab,_0x15281d,_0x3dfeb5){var _0x5f23d5=_0x47d7('0x5b');var _0x3ca851={'custom':![]};return utilLicense[_0x47d7('0x5c')]()[_0x47d7('0x30')](function(_0x3ad0b2){if(_0x3ad0b2){_0x3ca851=_0x3ad0b2;}return db['Setting'][_0x47d7('0x51')]({'where':{'id':_0x5c4dab[_0x47d7('0x53')]['id']},'attributes':[_0x47d7('0x57'),_0x47d7('0x59'),'preferred',_0x47d7('0x6d'),_0x47d7('0x5e'),'defaultLoginLogo',_0x47d7('0x60'),_0x47d7('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x15281d,null))[_0x47d7('0x30')](function(_0x8cb337){if(_0x8cb337){var _0x2ae777=_0x8cb337[_0x47d7('0x5d')]&&fs[_0x47d7('0x61')](path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x5f23d5,_[_0x47d7('0x62')](_0x8cb337[_0x47d7('0x5d')])))?path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x5f23d5,_[_0x47d7('0x62')](_0x8cb337['preferred'])):path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x5f23d5,_[_0x47d7('0x62')]('default_preferred.png'));var _0x2811fc=_0x47d7('0x66')+_[_0x47d7('0x67')](_0x47d7('0x5d'));if(_0x8cb337[_0x2811fc]||!_0x3ca851[_0x47d7('0x68')]||!_0x3ca851[_0x47d7('0x5d')]){_0x2ae777=path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0x5f23d5,_['toLower']('default_preferred.png'));}if(!fs[_0x47d7('0x61')](_0x2ae777)){throw new db['Sequelize'][(_0x47d7('0x6a'))](_['upperFirst'](_0x47d7('0x5d'))+_0x47d7('0x6b'));}return _0x15281d[_0x47d7('0x6c')](_0x2ae777);}})[_0x47d7('0x24')](handleError(_0x15281d,null));};exports['addFavicon']=function(_0xdcd8b7,_0x1cce91,_0x46488f){if(_0xdcd8b7[_0x47d7('0x55')]&&_0xdcd8b7[_0x47d7('0x55')]['filename']){_0xdcd8b7[_0x47d7('0x52')][_0x47d7('0x6d')]=_0xdcd8b7[_0x47d7('0x55')]['filename'];}return db[_0x47d7('0x4b')][_0x47d7('0x51')]({'where':{'id':_0xdcd8b7['params']['id']}})[_0x47d7('0x30')](handleEntityNotFound(_0x1cce91,null))[_0x47d7('0x30')](saveUpdates(_0xdcd8b7[_0x47d7('0x52')],null))[_0x47d7('0x30')](respondWithResult(_0x1cce91,null))[_0x47d7('0x24')](handleError(_0x1cce91,null));};var utilLicense=require(_0x47d7('0x18'));exports[_0x47d7('0x73')]=function(_0x1e287a,_0x282442,_0x3d119e){var _0xd685be=_0x47d7('0x5b');var _0x1b32eb={'custom':![]};return utilLicense[_0x47d7('0x5c')]()[_0x47d7('0x30')](function(_0x36e0a3){if(_0x36e0a3){_0x1b32eb=_0x36e0a3;}return db[_0x47d7('0x4b')]['find']({'where':{'id':_0x1e287a['params']['id']},'attributes':[_0x47d7('0x57'),'loginLogo','preferred','favicon','defaultLogo',_0x47d7('0x5f'),_0x47d7('0x60'),_0x47d7('0x6e')],'raw':!![]});})[_0x47d7('0x30')](handleEntityNotFound(_0x282442,null))[_0x47d7('0x30')](function(_0xfa685f){if(_0xfa685f){var _0x3f84bc=_0xfa685f['favicon']&&fs[_0x47d7('0x61')](path[_0x47d7('0x64')](config['root'],_0xd685be,_[_0x47d7('0x62')](_0xfa685f['favicon'])))?path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0xd685be,_['toLower'](_0xfa685f[_0x47d7('0x6d')])):path[_0x47d7('0x64')](config['root'],_0xd685be,_[_0x47d7('0x62')](_0x47d7('0x74')));var _0xa51b91=_0x47d7('0x66')+_[_0x47d7('0x67')](_0x47d7('0x6d'));if(_0xfa685f[_0xa51b91]||!_0x1b32eb[_0x47d7('0x68')]){_0x3f84bc=path[_0x47d7('0x64')](config[_0x47d7('0x63')],_0xd685be,_[_0x47d7('0x62')](_0x47d7('0x74')));}if(!fs['existsSync'](_0x3f84bc)){throw new db[(_0x47d7('0x69'))][(_0x47d7('0x6a'))](_[_0x47d7('0x67')]('favicon')+'\x20not\x20found');}return _0x282442[_0x47d7('0x6c')](_0x3f84bc);}})[_0x47d7('0x24')](handleError(_0x282442,null));};exports['getDate']=function(_0xbfbcea,_0x133da5){var _0x3a24ca={'offset':moment()[_0x47d7('0x75')]()};_0x3a24ca[_0x47d7('0x76')]=moment()[_0x47d7('0x75')](_0x3a24ca['offset'])[_0x47d7('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x133da5['status'](0xc8)[_0x47d7('0x34')](_0x3a24ca);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b63f0b8..5813f14 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x435d49,_0xe63b56){var _0x40a43d=function(_0x427d95){while(--_0x427d95){_0x435d49['push'](_0x435d49['shift']());}};_0x40a43d(++_0xe63b56);}(_0x3e74,0x175));var _0x43e7=function(_0x1ecb52,_0xa019a8){_0x1ecb52=_0x1ecb52-0x0;var _0x472cf2=_0x3e74[_0x1ecb52];return _0x472cf2;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x3d09e2,_0x58e784){var _0x5d03cd=function(_0x40f355){while(--_0x40f355){_0x3d09e2['push'](_0x3d09e2['shift']());}};_0x5d03cd(++_0x58e784);}(_0x3e74,0x175));var _0x43e7=function(_0x513f8c,_0x448a83){_0x513f8c=_0x513f8c-0x0;var _0x5b1016=_0x3e74[_0x513f8c];return _0x5b1016;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 8a15904..4f7df46 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 _0x3192=['Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','options','attributes','include','model','map','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5b8f99,_0x1daa83){var _0x20cacd=function(_0x2c5f9a){while(--_0x2c5f9a){_0x5b8f99['push'](_0x5b8f99['shift']());}};_0x20cacd(++_0x1daa83);}(_0x3192,0x128));var _0x2319=function(_0x5bf763,_0x14340c){_0x5bf763=_0x5bf763-0x0;var _0x4ddae9=_0x3192[_0x5bf763];return _0x4ddae9;};'use strict';var _=require(_0x2319('0x0'));var util=require(_0x2319('0x1'));var moment=require(_0x2319('0x2'));var BPromise=require(_0x2319('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2319('0x4'))(_0x2319('0x5'));var config=require(_0x2319('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2319('0x7')][_0x2319('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x485b52,_0xe21804,_0x586960){return new BPromise(function(_0x179e26,_0x4c1d5b){return client[_0x2319('0x9')](_0x485b52,_0x586960)[_0x2319('0xa')](function(_0x13d23c){logger[_0x2319('0xb')](_0x2319('0xc'),_0xe21804,_0x2319('0xd'));logger[_0x2319('0xe')](_0x2319('0xf'),_0xe21804,_0x2319('0xd'),JSON[_0x2319('0x10')](_0x13d23c));if(_0x13d23c[_0x2319('0x11')]){if(_0x13d23c[_0x2319('0x11')][_0x2319('0x12')]===0x1f4){logger[_0x2319('0x11')](_0x2319('0xc'),_0xe21804,_0x13d23c['error'][_0x2319('0x13')]);return _0x4c1d5b(_0x13d23c[_0x2319('0x11')][_0x2319('0x13')]);}logger[_0x2319('0x11')](_0x2319('0xc'),_0xe21804,_0x13d23c['error']['message']);return _0x179e26(_0x13d23c[_0x2319('0x11')][_0x2319('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0xe21804,_0x2319('0xd'));_0x179e26(_0x13d23c[_0x2319('0x14')]['message']);}})[_0x2319('0x15')](function(_0x287c7b){logger[_0x2319('0x11')](_0x2319('0xc'),_0xe21804,_0x287c7b);_0x4c1d5b(_0x287c7b);});});}exports[_0x2319('0x16')]=function(_0x31f682){var _0x5e195d=this;return new Promise(function(_0x51400e,_0x1857ea){return db['Setting']['find']({'raw':_0x31f682['options']?_0x31f682[_0x2319('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31f682[_0x2319('0x17')]?_0x31f682['options']['where']||null:null,'attributes':_0x31f682[_0x2319('0x17')]?_0x31f682[_0x2319('0x17')][_0x2319('0x18')]||null:null,'include':_0x31f682['options']?_0x31f682[_0x2319('0x17')][_0x2319('0x19')]?_['map'](_0x31f682[_0x2319('0x17')][_0x2319('0x19')],function(_0x20b711){return{'model':db[_0x20b711[_0x2319('0x1a')]],'as':_0x20b711['as'],'attributes':_0x20b711['attributes'],'include':_0x20b711[_0x2319('0x19')]?_[_0x2319('0x1b')](_0x20b711[_0x2319('0x19')],function(_0x266852){return{'model':db[_0x266852['model']],'as':_0x266852['as'],'attributes':_0x266852[_0x2319('0x18')],'include':_0x266852[_0x2319('0x19')]?_['map'](_0x266852[_0x2319('0x19')],function(_0x5efdf6){return{'model':db[_0x5efdf6[_0x2319('0x1a')]],'as':_0x5efdf6['as'],'attributes':_0x5efdf6[_0x2319('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2319('0xa')](function(_0x2fe5a9){logger[_0x2319('0xb')](_0x2319('0x16'),_0x31f682);logger[_0x2319('0xe')](_0x2319('0x16'),_0x31f682,JSON['stringify'](_0x2fe5a9));_0x51400e(_0x2fe5a9);})[_0x2319('0x15')](function(_0xd63bdf){logger[_0x2319('0x11')](_0x2319('0x16'),_0xd63bdf['message'],_0x31f682);_0x1857ea(_0x5e195d[_0x2319('0x11')](0x1f4,_0xd63bdf['message']));});});}; \ No newline at end of file +var _0x674a=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','options','where','attributes','include','map','model','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x674a,0x7a));var _0xa674=function(_0x3d94b,_0x1bd1e1){_0x3d94b=_0x3d94b-0x0;var _0x368bc3=_0x674a[_0x3d94b];return _0x368bc3;};'use strict';var _=require(_0xa674('0x0'));var util=require(_0xa674('0x1'));var moment=require('moment');var BPromise=require(_0xa674('0x2'));var rs=require(_0xa674('0x3'));var fs=require('fs');var Redis=require(_0xa674('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa674('0x5'));var config=require(_0xa674('0x6'));var jayson=require(_0xa674('0x7'));var client=jayson[_0xa674('0x8')][_0xa674('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cbe7a,_0x4366c1,_0x372b3d){return new BPromise(function(_0x1ead6f,_0x43b737){return client[_0xa674('0xa')](_0x1cbe7a,_0x372b3d)[_0xa674('0xb')](function(_0x1f01ad){logger[_0xa674('0xc')](_0xa674('0xd'),_0x4366c1,_0xa674('0xe'));logger[_0xa674('0xf')](_0xa674('0x10'),_0x4366c1,_0xa674('0xe'),JSON[_0xa674('0x11')](_0x1f01ad));if(_0x1f01ad[_0xa674('0x12')]){if(_0x1f01ad[_0xa674('0x12')][_0xa674('0x13')]===0x1f4){logger[_0xa674('0x12')]('Setting,\x20%s,\x20%s',_0x4366c1,_0x1f01ad['error'][_0xa674('0x14')]);return _0x43b737(_0x1f01ad[_0xa674('0x12')]['message']);}logger[_0xa674('0x12')]('Setting,\x20%s,\x20%s',_0x4366c1,_0x1f01ad['error'][_0xa674('0x14')]);return _0x1ead6f(_0x1f01ad[_0xa674('0x12')]['message']);}else{logger[_0xa674('0xc')]('Setting,\x20%s,\x20%s',_0x4366c1,_0xa674('0xe'));_0x1ead6f(_0x1f01ad[_0xa674('0x15')][_0xa674('0x14')]);}})[_0xa674('0x16')](function(_0x4a7182){logger['error'](_0xa674('0xd'),_0x4366c1,_0x4a7182);_0x43b737(_0x4a7182);});});}exports[_0xa674('0x17')]=function(_0x4a2021){var _0x111dff=this;return new Promise(function(_0x10268e,_0x46148b){return db[_0xa674('0x18')]['find']({'raw':_0x4a2021[_0xa674('0x19')]?_0x4a2021[_0xa674('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4a2021[_0xa674('0x19')]?_0x4a2021[_0xa674('0x19')][_0xa674('0x1a')]||null:null,'attributes':_0x4a2021[_0xa674('0x19')]?_0x4a2021['options'][_0xa674('0x1b')]||null:null,'include':_0x4a2021['options']?_0x4a2021[_0xa674('0x19')][_0xa674('0x1c')]?_[_0xa674('0x1d')](_0x4a2021[_0xa674('0x19')][_0xa674('0x1c')],function(_0xc0ff43){return{'model':db[_0xc0ff43[_0xa674('0x1e')]],'as':_0xc0ff43['as'],'attributes':_0xc0ff43[_0xa674('0x1b')],'include':_0xc0ff43['include']?_['map'](_0xc0ff43[_0xa674('0x1c')],function(_0x3f87a3){return{'model':db[_0x3f87a3[_0xa674('0x1e')]],'as':_0x3f87a3['as'],'attributes':_0x3f87a3[_0xa674('0x1b')],'include':_0x3f87a3['include']?_[_0xa674('0x1d')](_0x3f87a3[_0xa674('0x1c')],function(_0x1bb12c){return{'model':db[_0x1bb12c['model']],'as':_0x1bb12c['as'],'attributes':_0x1bb12c[_0xa674('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12187b){logger[_0xa674('0xc')](_0xa674('0x17'),_0x4a2021);logger[_0xa674('0xf')](_0xa674('0x17'),_0x4a2021,JSON[_0xa674('0x11')](_0x12187b));_0x10268e(_0x12187b);})[_0xa674('0x16')](function(_0x5ded87){logger[_0xa674('0x12')](_0xa674('0x17'),_0x5ded87[_0xa674('0x14')],_0x4a2021);_0x46148b(_0x111dff[_0xa674('0x12')](0x1f4,_0x5ded87[_0xa674('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5a0f5bf..8db547e 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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x214140,_0x273e62){var _0x1f45fa=function(_0x1dd61f){while(--_0x1dd61f){_0x214140['push'](_0x214140['shift']());}};_0x1f45fa(++_0x273e62);}(_0x814b,0x1a2));var _0xb814=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0x814b[_0xcb19e1];return _0x121872;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x5d12bf,_0x109d45){var _0x40c47d=function(_0x2201aa){while(--_0x2201aa){_0x5d12bf['push'](_0x5d12bf['shift']());}};_0x40c47d(++_0x109d45);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 30e2f2d..30e0856 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 _0x1481=['plivo','clickatell','bandwidth','csc','infobip','intelepeer','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','skebby','connectel','clicksend'];(function(_0x509994,_0x2764b6){var _0x39c019=function(_0x19c6db){while(--_0x19c6db){_0x509994['push'](_0x509994['shift']());}};_0x39c019(++_0x2764b6);}(_0x1481,0x168));var _0x1148=function(_0x3c6634,_0x17499b){_0x3c6634=_0x3c6634-0x0;var _0x349302=_0x1481[_0x3c6634];return _0x349302;};'use strict';var Sequelize=require(_0x1148('0x0'));var rs=require('randomstring');module[_0x1148('0x1')]={'name':{'type':Sequelize[_0x1148('0x2')],'unique':_0x1148('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1148('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1148('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1148('0x2')],'defaultValue':function(){return rs[_0x1148('0x4')]();}},'phone':{'type':Sequelize[_0x1148('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0x1148('0x5'),_0x1148('0x6'),_0x1148('0x7'),_0x1148('0x8'),_0x1148('0x9'),_0x1148('0xa'),_0x1148('0xb'),_0x1148('0xc'),_0x1148('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x1148('0x2')]},'authToken':{'type':Sequelize[_0x1148('0x2')]},'smsMethod':{'type':Sequelize[_0x1148('0xe')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1148('0x2')]},'apiKey':{'type':Sequelize[_0x1148('0x2')]},'applicationId':{'type':Sequelize[_0x1148('0x2')]},'accountId':{'type':Sequelize[_0x1148('0x2')]},'senderString':{'type':Sequelize[_0x1148('0x2')]},'deliveryReport':{'type':Sequelize[_0x1148('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x1148('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1148('0x10');}},'notificationSound':{'type':Sequelize[_0x1148('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1148('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1148('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1148('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1148('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1148('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1148('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1148('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x1148('0xf')],'defaultValue':![],'comment':_0x1148('0x13'),'set':function(_0x21db94){if(!_0x21db94)this[_0x1148('0x14')](_0x1148('0x15'),null);this[_0x1148('0x14')](_0x1148('0x16'),_0x21db94);}}}; \ No newline at end of file +var _0x5367=['skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x38eb22,_0x458a8c){var _0x49553e=function(_0x2879fd){while(--_0x2879fd){_0x38eb22['push'](_0x38eb22['shift']());}};_0x49553e(++_0x458a8c);}(_0x5367,0x10a));var _0x7536=function(_0x340d94,_0x267bfe){_0x340d94=_0x340d94-0x0;var _0x148019=_0x5367[_0x340d94];return _0x148019;};'use strict';var Sequelize=require(_0x7536('0x0'));var rs=require(_0x7536('0x1'));module[_0x7536('0x2')]={'name':{'type':Sequelize[_0x7536('0x3')],'unique':_0x7536('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7536('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7536('0x5')]();}},'phone':{'type':Sequelize[_0x7536('0x3')]},'type':{'type':Sequelize[_0x7536('0x6')]('twilio',_0x7536('0x7'),_0x7536('0x8'),_0x7536('0x9'),_0x7536('0xa'),_0x7536('0xb'),_0x7536('0xc'),'csc',_0x7536('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0x7536('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7536('0x3')]},'smsMethod':{'type':Sequelize[_0x7536('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x7536('0x3')]},'password':{'type':Sequelize[_0x7536('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x7536('0x3')]},'senderString':{'type':Sequelize[_0x7536('0x3')]},'deliveryReport':{'type':Sequelize[_0x7536('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x7536('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7536('0xf')],'defaultValue':function(){return _0x7536('0x10');}},'notificationSound':{'type':Sequelize[_0x7536('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7536('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7536('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7536('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5609aa){if(!_0x5609aa)this[_0x7536('0x12')](_0x7536('0x13'),null);this[_0x7536('0x12')](_0x7536('0x14'),_0x5609aa);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2fcba8a..96d180c 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 _0x0c10=['Pause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','Body','MessageSid','skebby','sender','connectel','clicksend','messageId','message_id','plivo','From','Text','MessageUUID','results','text','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','Contacts','DESC','list','defaults','contact','SmsInteraction','autoclose','push','close','*,*,*,*','interaction','created','SmsMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','SmsApplication','stack','getApplications','nolimit','getInteractions','Contact','Owner','fullname','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','csc','state','message-id','addAgents','spread','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','./smsAccount.socket','register','request','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','SmsAccounts','name','send'];(function(_0x55717d,_0x24d4db){var _0x544dba=function(_0x1b4bf8){while(--_0x1b4bf8){_0x55717d['push'](_0x55717d['shift']());}};_0x544dba(++_0x24d4db);}(_0x0c10,0xa8));var _0x00c1=function(_0x53fda3,_0x5cc847){_0x53fda3=_0x53fda3-0x0;var _0x3c0742=_0x0c10[_0x53fda3];return _0x3c0742;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00c1('0x0'));var zipdir=require(_0x00c1('0x1'));var jsonpatch=require(_0x00c1('0x2'));var rp=require(_0x00c1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x00c1('0x4'));var sox=require(_0x00c1('0x5'));var csv=require(_0x00c1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00c1('0x7'));var _=require(_0x00c1('0x8'));var squel=require('squel');var crypto=require(_0x00c1('0x9'));var jsforce=require(_0x00c1('0xa'));var deskjs=require(_0x00c1('0xb'));var toCsv=require('to-csv');var querystring=require(_0x00c1('0xc'));var Papa=require(_0x00c1('0xd'));var Redis=require(_0x00c1('0xe'));var authService=require(_0x00c1('0xf'));var qs=require(_0x00c1('0x10'));var as=require(_0x00c1('0x11'));var hardwareService=require(_0x00c1('0x12'));var logger=require(_0x00c1('0x13'))('api');var utils=require(_0x00c1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x00c1('0x15'));var db=require(_0x00c1('0x16'))['db'];config[_0x00c1('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x00c1('0x18'))[_0x00c1('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3b9dd6,_0x23a4cb,_0xe23531,_0x321506){return new BPromise(function(_0x1eba94,_0x5b2cdd){var _0x46e8ab=_0x321506||client;return _0x46e8ab[_0x00c1('0x1a')](_0x3b9dd6,_0xe23531)['then'](function(_0x58b399){logger['info']('SmsAccount,\x20%s,\x20%s',_0x23a4cb,_0x00c1('0x1b'));logger[_0x00c1('0x1c')](_0x00c1('0x1d'),_0x23a4cb,_0x00c1('0x1b'),JSON['stringify'](_0x58b399));if(_0x58b399[_0x00c1('0x1e')]){if(_0x58b399['error'][_0x00c1('0x1f')]===0x1f4){logger[_0x00c1('0x1e')](_0x00c1('0x20'),_0x23a4cb,_0x58b399[_0x00c1('0x1e')]['message']);return _0x5b2cdd(_0x58b399[_0x00c1('0x1e')][_0x00c1('0x21')]);}logger['error'](_0x00c1('0x20'),_0x23a4cb,_0x58b399[_0x00c1('0x1e')]['message']);return _0x1eba94(_0x58b399[_0x00c1('0x1e')][_0x00c1('0x21')]);}else{logger[_0x00c1('0x22')](_0x00c1('0x20'),_0x23a4cb,_0x00c1('0x1b'));_0x1eba94(_0x58b399[_0x00c1('0x23')]['message']);}})[_0x00c1('0x24')](function(_0x14da54){logger[_0x00c1('0x1e')](_0x00c1('0x20'),_0x23a4cb,_0x14da54);_0x5b2cdd(_0x14da54);});});}function respondWithStatusCode(_0x5e727c,_0xb25703){_0xb25703=_0xb25703||0xcc;return function(_0x3f6f94){if(_0x3f6f94){return _0x5e727c[_0x00c1('0x25')](_0xb25703);}return _0x5e727c[_0x00c1('0x26')](_0xb25703)['end']();};}function respondWithResult(_0x48364a,_0x463923){_0x463923=_0x463923||0xc8;return function(_0x5b90e3){if(_0x5b90e3){return _0x48364a[_0x00c1('0x26')](_0x463923)[_0x00c1('0x27')](_0x5b90e3);}};}function respondWithFilteredResult(_0x405ae6,_0xa5f8d5){return function(_0x5ee53d){if(_0x5ee53d){var _0xc6618d=typeof _0xa5f8d5[_0x00c1('0x28')]===_0x00c1('0x29')&&typeof _0xa5f8d5[_0x00c1('0x2a')]==='undefined';var _0x514c83=_0x5ee53d[_0x00c1('0x2b')];var _0x475775=_0xc6618d?0x0:_0xa5f8d5['offset'];var _0x30cace=_0xc6618d?_0x5ee53d[_0x00c1('0x2b')]:_0xa5f8d5[_0x00c1('0x28')]+_0xa5f8d5[_0x00c1('0x2a')];var _0x2eaa99;if(_0x30cace>=_0x514c83){_0x30cace=_0x514c83;_0x2eaa99=0xc8;}else{_0x2eaa99=0xce;}_0x405ae6[_0x00c1('0x26')](_0x2eaa99);return _0x405ae6[_0x00c1('0x2c')](_0x00c1('0x2d'),_0x475775+'-'+_0x30cace+'/'+_0x514c83)[_0x00c1('0x27')](_0x5ee53d);}return null;};}function patchUpdates(_0x4e731c){return function(_0xe4e061){try{jsonpatch['apply'](_0xe4e061,_0x4e731c,!![]);}catch(_0xe7a748){return BPromise['reject'](_0xe7a748);}return _0xe4e061['save']();};}function saveUpdates(_0x345205,_0x6db468){return function(_0x17fe07){if(_0x17fe07){return _0x17fe07[_0x00c1('0x2e')](_0x345205)['then'](function(_0x15b229){return _0x15b229;});}return null;};}function removeEntity(_0x320e6d,_0x42713b){return function(_0x36861c){if(_0x36861c){return _0x36861c[_0x00c1('0x2f')]()[_0x00c1('0x30')](function(){var _0x38c75f=_0x36861c[_0x00c1('0x31')]({'plain':!![]});var _0x4ffbf7=_0x00c1('0x32');return db['UserProfileResource'][_0x00c1('0x2f')]({'where':{'type':_0x4ffbf7,'resourceId':_0x38c75f['id']}})['then'](function(){return _0x36861c;});})[_0x00c1('0x30')](function(){_0x320e6d[_0x00c1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57cad4,_0x1c1a32){return function(_0x4a6e3b){if(!_0x4a6e3b){_0x57cad4['sendStatus'](0x194);}return _0x4a6e3b;};}function handleError(_0x5ae52a,_0x7cc07c){_0x7cc07c=_0x7cc07c||0x1f4;return function(_0x5a5396){logger[_0x00c1('0x1e')](_0x5a5396['stack']);if(_0x5a5396[_0x00c1('0x33')]){delete _0x5a5396[_0x00c1('0x33')];}_0x5ae52a[_0x00c1('0x26')](_0x7cc07c)[_0x00c1('0x34')](_0x5a5396);};}exports['index']=function(_0x268cf0,_0x1593d4){var _0x4b2c6d={'include':[{'model':db[_0x00c1('0x35')],'as':'mandatoryDispositionPause'}]},_0x1019ca={},_0x45edd6={'count':0x0,'rows':[]};var _0x5ea885=_[_0x00c1('0x36')](db[_0x00c1('0x37')][_0x00c1('0x38')],function(_0xb2ecfa){return{'name':_0xb2ecfa['fieldName'],'type':_0xb2ecfa[_0x00c1('0x39')][_0x00c1('0x3a')]};});_0x1019ca[_0x00c1('0x3b')]=_[_0x00c1('0x36')](_0x5ea885,_0x00c1('0x33'));_0x1019ca[_0x00c1('0x3c')]=_[_0x00c1('0x3d')](_0x268cf0[_0x00c1('0x3c')]);_0x1019ca[_0x00c1('0x3e')]=_[_0x00c1('0x3f')](_0x1019ca[_0x00c1('0x3b')],_0x1019ca['query']);_0x4b2c6d[_0x00c1('0x40')]=_[_0x00c1('0x3f')](_0x1019ca[_0x00c1('0x3b')],qs[_0x00c1('0x41')](_0x268cf0[_0x00c1('0x3c')]['fields']));_0x4b2c6d[_0x00c1('0x40')]=_0x4b2c6d['attributes'][_0x00c1('0x42')]?_0x4b2c6d[_0x00c1('0x40')]:_0x1019ca[_0x00c1('0x3b')];if(!_0x268cf0['query'][_0x00c1('0x43')]('nolimit')){_0x4b2c6d[_0x00c1('0x2a')]=qs[_0x00c1('0x2a')](_0x268cf0[_0x00c1('0x3c')][_0x00c1('0x2a')]);_0x4b2c6d[_0x00c1('0x28')]=qs[_0x00c1('0x28')](_0x268cf0['query'][_0x00c1('0x28')]);}_0x4b2c6d[_0x00c1('0x44')]=qs[_0x00c1('0x45')](_0x268cf0[_0x00c1('0x3c')][_0x00c1('0x45')]);_0x4b2c6d[_0x00c1('0x46')]=qs[_0x00c1('0x3e')](_[_0x00c1('0x47')](_0x268cf0[_0x00c1('0x3c')],_0x1019ca['filters']),_0x5ea885);if(_0x268cf0['query'][_0x00c1('0x48')]){_0x4b2c6d['where']=_[_0x00c1('0x49')](_0x4b2c6d[_0x00c1('0x46')],{'$or':_[_0x00c1('0x36')](_0x5ea885,function(_0x166ea8){if(_0x166ea8[_0x00c1('0x39')]!==_0x00c1('0x4a')){var _0x4a29d4={};_0x4a29d4[_0x166ea8[_0x00c1('0x33')]]={'$like':'%'+_0x268cf0['query']['filter']+'%'};return _0x4a29d4;}})});}_0x4b2c6d=_[_0x00c1('0x49')]({},_0x4b2c6d,_0x268cf0['options']);var _0x5a14fb={'where':_0x4b2c6d[_0x00c1('0x46')]};return db['SmsAccount'][_0x00c1('0x2b')](_0x5a14fb)[_0x00c1('0x30')](function(_0x51f59a){_0x45edd6[_0x00c1('0x2b')]=_0x51f59a;if(_0x268cf0[_0x00c1('0x3c')][_0x00c1('0x4b')]){_0x4b2c6d[_0x00c1('0x4c')]=[{'all':!![]}];}return db[_0x00c1('0x37')][_0x00c1('0x4d')](_0x4b2c6d);})['then'](function(_0x865b95){_0x45edd6['rows']=_0x865b95;return _0x45edd6;})[_0x00c1('0x30')](respondWithFilteredResult(_0x1593d4,_0x4b2c6d))['catch'](handleError(_0x1593d4,null));};exports[_0x00c1('0x4e')]=function(_0x587c19,_0x3a8818){var _0x56326e={'raw':![],'where':{'id':_0x587c19[_0x00c1('0x4f')]['id']},'include':[{'model':db[_0x00c1('0x35')],'as':_0x00c1('0x50')}]},_0x3705cc={};_0x3705cc[_0x00c1('0x3b')]=_[_0x00c1('0x3d')](db[_0x00c1('0x37')][_0x00c1('0x38')]);_0x3705cc[_0x00c1('0x3c')]=_[_0x00c1('0x3d')](_0x587c19[_0x00c1('0x3c')]);_0x3705cc[_0x00c1('0x3e')]=_[_0x00c1('0x3f')](_0x3705cc[_0x00c1('0x3b')],_0x3705cc[_0x00c1('0x3c')]);_0x56326e[_0x00c1('0x40')]=_['intersection'](_0x3705cc[_0x00c1('0x3b')],qs['fields'](_0x587c19['query']['fields']));_0x56326e[_0x00c1('0x40')]=_0x56326e[_0x00c1('0x40')][_0x00c1('0x42')]?_0x56326e[_0x00c1('0x40')]:_0x3705cc[_0x00c1('0x3b')];if(_0x587c19[_0x00c1('0x3c')]['includeAll']){_0x56326e[_0x00c1('0x4c')]=[{'all':!![]}];}_0x56326e=_['merge']({},_0x56326e,_0x587c19['options']);return db[_0x00c1('0x37')][_0x00c1('0x51')](_0x56326e)[_0x00c1('0x30')](handleEntityNotFound(_0x3a8818,null))['then'](respondWithResult(_0x3a8818,null))[_0x00c1('0x24')](handleError(_0x3a8818,null));};exports[_0x00c1('0x52')]=function(_0x438047,_0x2798f1){return db[_0x00c1('0x37')]['create'](_0x438047['body'],{})['then'](function(_0x2e749c){var _0x31829d=_0x438047['user'][_0x00c1('0x31')]({'plain':!![]});if(!_0x31829d)throw new Error(_0x00c1('0x53'));if(_0x31829d[_0x00c1('0x54')]==='user'){var _0x24f63a=_0x2e749c['get']({'plain':!![]});var _0x5e0314=_0x00c1('0x32');return db[_0x00c1('0x55')][_0x00c1('0x51')]({'where':{'name':_0x5e0314,'userProfileId':_0x31829d['userProfileId']},'raw':!![]})[_0x00c1('0x30')](function(_0x3a18d2){if(_0x3a18d2&&_0x3a18d2['autoAssociation']===0x0){return db[_0x00c1('0x56')][_0x00c1('0x52')]({'name':_0x24f63a[_0x00c1('0x33')],'resourceId':_0x24f63a['id'],'type':_0x3a18d2[_0x00c1('0x33')],'sectionId':_0x3a18d2['id']},{})[_0x00c1('0x30')](function(){return _0x2e749c;});}else{return _0x2e749c;}})['catch'](function(_0xca4497){logger['error'](_0x00c1('0x57'),_0xca4497);throw _0xca4497;});}return _0x2e749c;})[_0x00c1('0x30')](respondWithResult(_0x2798f1,0xc9))[_0x00c1('0x24')](handleError(_0x2798f1,null));};exports[_0x00c1('0x2e')]=function(_0x36509f,_0x3b06d3){if(_0x36509f[_0x00c1('0x58')]['id']){delete _0x36509f[_0x00c1('0x58')]['id'];}return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0x36509f[_0x00c1('0x4f')]['id']},'include':[{'model':db[_0x00c1('0x35')],'as':_0x00c1('0x50')}]})[_0x00c1('0x30')](handleEntityNotFound(_0x3b06d3,null))['then'](saveUpdates(_0x36509f[_0x00c1('0x58')],null))[_0x00c1('0x30')](respondWithResult(_0x3b06d3,null))[_0x00c1('0x24')](handleError(_0x3b06d3,null));};exports['destroy']=function(_0x52b7cd,_0x743e4d){return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0x52b7cd[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x743e4d,null))['then'](removeEntity(_0x743e4d,null))[_0x00c1('0x24')](handleError(_0x743e4d,null));};exports[_0x00c1('0x59')]=function(_0xe42f20,_0x35be92){return db[_0x00c1('0x37')]['describe']()[_0x00c1('0x30')](respondWithResult(_0x35be92,null))['catch'](handleError(_0x35be92,null));};exports[_0x00c1('0x5a')]=function(_0x1d9c0a,_0x13818b,_0x429f11){if(_0x1d9c0a['body']['id']){delete _0x1d9c0a[_0x00c1('0x58')]['id'];}return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0x1d9c0a[_0x00c1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13818b,null))[_0x00c1('0x30')](function(_0x5d75f8){if(_0x5d75f8){_0x1d9c0a['body'][_0x00c1('0x5b')]=_0x5d75f8['id'];return db[_0x00c1('0x5c')][_0x00c1('0x52')](_0x1d9c0a['body']);}})['then'](respondWithResult(_0x13818b,null))[_0x00c1('0x24')](handleError(_0x13818b,null));};exports[_0x00c1('0x5d')]=function(_0x4bb698,_0x195ac3,_0xd70e7d){var _0x3504e3={'raw':![],'where':{}};var _0x718fb3={};var _0x206239={'count':0x0,'rows':[]};return db[_0x00c1('0x37')]['findOne']({'where':{'id':_0x4bb698[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x195ac3,null))[_0x00c1('0x30')](function(_0x246219){if(_0x246219){_0x718fb3[_0x00c1('0x3b')]=_['keys'](db[_0x00c1('0x5c')][_0x00c1('0x38')]);_0x718fb3[_0x00c1('0x3c')]=_['keys'](_0x4bb698[_0x00c1('0x3c')]);_0x718fb3[_0x00c1('0x3e')]=_[_0x00c1('0x3f')](_0x718fb3[_0x00c1('0x3b')],_0x718fb3[_0x00c1('0x3c')]);_0x3504e3[_0x00c1('0x40')]=_[_0x00c1('0x3f')](_0x718fb3[_0x00c1('0x3b')],qs[_0x00c1('0x41')](_0x4bb698[_0x00c1('0x3c')]['fields']));_0x3504e3[_0x00c1('0x40')]=_0x3504e3[_0x00c1('0x40')][_0x00c1('0x42')]?_0x3504e3[_0x00c1('0x40')]:_0x718fb3[_0x00c1('0x3b')];if(!_0x4bb698[_0x00c1('0x3c')]['hasOwnProperty']('nolimit')){_0x3504e3[_0x00c1('0x2a')]=qs[_0x00c1('0x2a')](_0x4bb698[_0x00c1('0x3c')][_0x00c1('0x2a')]);_0x3504e3[_0x00c1('0x28')]=qs[_0x00c1('0x28')](_0x4bb698['query']['offset']);}_0x3504e3[_0x00c1('0x44')]=qs[_0x00c1('0x45')](_0x4bb698[_0x00c1('0x3c')][_0x00c1('0x45')]);_0x3504e3[_0x00c1('0x46')]=qs['filters'](_[_0x00c1('0x47')](_0x4bb698['query'],_0x718fb3[_0x00c1('0x3e')]));_0x3504e3[_0x00c1('0x46')][_0x00c1('0x5b')]=_0x246219['id'];if(_0x4bb698[_0x00c1('0x3c')]['filter']){_0x3504e3[_0x00c1('0x46')]=_['merge'](_0x3504e3[_0x00c1('0x46')],{'$or':_[_0x00c1('0x36')](_0x3504e3['attributes'],function(_0x27ab32){var _0x33eccb={};_0x33eccb[_0x27ab32]={'$like':'%'+_0x4bb698['query'][_0x00c1('0x48')]+'%'};return _0x33eccb;})});}_0x3504e3=_[_0x00c1('0x49')]({},_0x3504e3,_0x4bb698[_0x00c1('0x5e')]);return db['Disposition'][_0x00c1('0x2b')]({'where':_0x3504e3[_0x00c1('0x46')]})[_0x00c1('0x30')](function(_0x3fd033){_0x206239[_0x00c1('0x2b')]=_0x3fd033;if(_0x4bb698['query'][_0x00c1('0x4b')]){_0x3504e3[_0x00c1('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0x00c1('0x4d')](_0x3504e3);})[_0x00c1('0x30')](function(_0x17365e){_0x206239['rows']=_0x17365e;return _0x206239;});}})['then'](respondWithFilteredResult(_0x195ac3,_0x3504e3))['catch'](handleError(_0x195ac3,null));};exports[_0x00c1('0x5f')]=function(_0x1c8df9,_0x1a1443,_0xb000e8){return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0x1c8df9[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x1a1443,null))[_0x00c1('0x30')](function(_0x349e80){if(_0x349e80){return _0x349e80[_0x00c1('0x5f')](_0x1c8df9[_0x00c1('0x3c')][_0x00c1('0x60')]);}})[_0x00c1('0x30')](respondWithStatusCode(_0x1a1443,null))[_0x00c1('0x24')](handleError(_0x1a1443,null));};exports[_0x00c1('0x61')]=function(_0x3a36d3,_0x4d8dd2,_0x1155d3){if(_0x3a36d3[_0x00c1('0x58')]['id']){delete _0x3a36d3[_0x00c1('0x58')]['id'];}return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0x3a36d3[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x4d8dd2,null))[_0x00c1('0x30')](function(_0x14f18c){if(_0x14f18c){_0x3a36d3[_0x00c1('0x58')][_0x00c1('0x5b')]=_0x14f18c['id'];return db[_0x00c1('0x62')][_0x00c1('0x52')](_0x3a36d3['body']);}})[_0x00c1('0x30')](respondWithResult(_0x4d8dd2,null))[_0x00c1('0x24')](handleError(_0x4d8dd2,null));};exports[_0x00c1('0x63')]=function(_0x282105,_0x2525f8,_0x1b33a8){var _0x4ba5c8={'raw':![],'where':{}};var _0x113dd4={};var _0x302ee5={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x282105[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x2525f8,null))[_0x00c1('0x30')](function(_0x16a2ec){if(_0x16a2ec){_0x113dd4[_0x00c1('0x3b')]=_[_0x00c1('0x3d')](db[_0x00c1('0x62')]['rawAttributes']);_0x113dd4['query']=_[_0x00c1('0x3d')](_0x282105['query']);_0x113dd4['filters']=_[_0x00c1('0x3f')](_0x113dd4[_0x00c1('0x3b')],_0x113dd4[_0x00c1('0x3c')]);_0x4ba5c8[_0x00c1('0x40')]=_[_0x00c1('0x3f')](_0x113dd4['model'],qs[_0x00c1('0x41')](_0x282105[_0x00c1('0x3c')][_0x00c1('0x41')]));_0x4ba5c8[_0x00c1('0x40')]=_0x4ba5c8[_0x00c1('0x40')]['length']?_0x4ba5c8[_0x00c1('0x40')]:_0x113dd4[_0x00c1('0x3b')];if(!_0x282105[_0x00c1('0x3c')][_0x00c1('0x43')]('nolimit')){_0x4ba5c8[_0x00c1('0x2a')]=qs[_0x00c1('0x2a')](_0x282105[_0x00c1('0x3c')][_0x00c1('0x2a')]);_0x4ba5c8[_0x00c1('0x28')]=qs[_0x00c1('0x28')](_0x282105['query'][_0x00c1('0x28')]);}_0x4ba5c8['order']=qs[_0x00c1('0x45')](_0x282105[_0x00c1('0x3c')]['sort']);_0x4ba5c8[_0x00c1('0x46')]=qs[_0x00c1('0x3e')](_['pick'](_0x282105[_0x00c1('0x3c')],_0x113dd4[_0x00c1('0x3e')]));_0x4ba5c8[_0x00c1('0x46')][_0x00c1('0x5b')]=_0x16a2ec['id'];if(_0x282105[_0x00c1('0x3c')][_0x00c1('0x48')]){_0x4ba5c8['where']=_[_0x00c1('0x49')](_0x4ba5c8['where'],{'$or':_[_0x00c1('0x36')](_0x4ba5c8[_0x00c1('0x40')],function(_0x91893c){var _0x2c9be7={};_0x2c9be7[_0x91893c]={'$like':'%'+_0x282105['query']['filter']+'%'};return _0x2c9be7;})});}_0x4ba5c8=_['merge']({},_0x4ba5c8,_0x282105[_0x00c1('0x5e')]);return db[_0x00c1('0x62')][_0x00c1('0x2b')]({'where':_0x4ba5c8[_0x00c1('0x46')]})['then'](function(_0x21d331){_0x302ee5[_0x00c1('0x2b')]=_0x21d331;if(_0x282105[_0x00c1('0x3c')][_0x00c1('0x4b')]){_0x4ba5c8[_0x00c1('0x4c')]=[{'all':!![]}];}return db[_0x00c1('0x62')][_0x00c1('0x4d')](_0x4ba5c8);})[_0x00c1('0x30')](function(_0x2ea24a){_0x302ee5[_0x00c1('0x64')]=_0x2ea24a;return _0x302ee5;});}})[_0x00c1('0x30')](respondWithFilteredResult(_0x2525f8,_0x4ba5c8))['catch'](handleError(_0x2525f8,null));};exports[_0x00c1('0x65')]=function(_0x48fbea,_0x28f7d5,_0x164360){return db['SmsAccount'][_0x00c1('0x51')]({'where':{'id':_0x48fbea[_0x00c1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x28f7d5,null))[_0x00c1('0x30')](function(_0x17a20d){if(_0x17a20d){return _0x17a20d[_0x00c1('0x65')](_0x48fbea[_0x00c1('0x3c')][_0x00c1('0x60')]);}})['then'](respondWithStatusCode(_0x28f7d5,null))[_0x00c1('0x24')](handleError(_0x28f7d5,null));};exports[_0x00c1('0x66')]=function(_0x5c21d1,_0x2f7d70,_0x532a6e){var _0x2545d7={'channel':_0x00c1('0x67')};var _0x295f7c=[];var _0x3df88a=[];var _0x585c86={};return db['SmsAccount'][_0x00c1('0x51')]({'where':{'id':_0x5c21d1[_0x00c1('0x4f')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x00c1('0x68')}]})['then'](handleEntityNotFound(_0x2f7d70,null))[_0x00c1('0x30')](function(_0x50211f){_0x2545d7[_0x00c1('0x69')]=_0x50211f;_0x2545d7[_0x00c1('0x6a')]=_[_0x00c1('0x6b')](_0x50211f[_0x00c1('0x68')],[_0x00c1('0x6c')],[_0x00c1('0x6d')]);if(_0x2545d7[_0x00c1('0x69')][_0x00c1('0x68')]){delete _0x2545d7['account'][_0x00c1('0x68')];}return db[_0x00c1('0x6e')][_0x00c1('0x59')]();})[_0x00c1('0x30')](function(_0x581a66){if(!_0x581a66){throw new db[(_0x00c1('0x6f'))][(_0x00c1('0x70'))](_0x00c1('0x71'));}_0x295f7c=_[_0x00c1('0x72')](_[_0x00c1('0x3d')](_0x581a66),['createdAt',_0x00c1('0x73')]);_0x3df88a=_[_0x00c1('0x72')](_[_0x00c1('0x3d')](_0x581a66),[_0x00c1('0x74'),_0x00c1('0x73'),_0x00c1('0x75'),'ListId']);_0x2545d7['body']={'mapKey':_0x00c1('0x76')};if(_0x2545d7['account'][_0x00c1('0x39')]){switch(_0x2545d7['account']['type']){case _0x00c1('0x77'):_0x2545d7['body'][_0x00c1('0x78')]=_0x5c21d1[_0x00c1('0x58')]['From'];_0x2545d7['body'][_0x00c1('0x58')]=_0x5c21d1['body'][_0x00c1('0x79')];_0x2545d7[_0x00c1('0x58')]['messageId']=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x7a')];break;case _0x00c1('0x7b'):_0x2545d7[_0x00c1('0x58')][_0x00c1('0x78')]='+'+_0x5c21d1['body'][_0x00c1('0x7c')];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')]['text'];break;case _0x00c1('0x7d'):_0x2545d7['body'][_0x00c1('0x78')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x78')];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x21')];break;case _0x00c1('0x7e'):_0x2545d7[_0x00c1('0x58')]['from']=_0x5c21d1['body'][_0x00c1('0x78')];_0x2545d7['body'][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x58')];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x7f')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x80')];break;case _0x00c1('0x81'):_0x2545d7['body']['from']=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x82')];_0x2545d7['body'][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x83')];_0x2545d7['body']['messageId']=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x84')];break;case'infobip':_0x2545d7[_0x00c1('0x58')]['from']='+'+_0x5c21d1['body'][_0x00c1('0x85')][0x0][_0x00c1('0x78')];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x85')][0x0][_0x00c1('0x86')];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x7f')]=_0x5c21d1[_0x00c1('0x58')]['results'][0x0]['messageId'];break;case'csc':_0x2545d7[_0x00c1('0x58')]['from']=_0x5c21d1[_0x00c1('0x58')]['originatingAddress'];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x87')]['message'];break;case _0x00c1('0x88'):_0x2545d7[_0x00c1('0x58')][_0x00c1('0x78')]=_0x5c21d1['body'][_0x00c1('0x89')];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')]=_0x5c21d1['body'][_0x00c1('0x86')];_0x2545d7['body'][_0x00c1('0x7f')]=_0x5c21d1['body'][_0x00c1('0x8a')];break;case _0x00c1('0x8b'):_0x2545d7[_0x00c1('0x58')]['messageId']=_0x5c21d1[_0x00c1('0x58')][0x0][_0x00c1('0x21')]['id'];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x78')]=_0x5c21d1['body'][0x0][_0x00c1('0x21')]['from'];_0x2545d7['body'][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')][0x0]['message'][_0x00c1('0x86')];break;case _0x00c1('0x8c'):_0x2545d7[_0x00c1('0x58')][_0x00c1('0x78')]=_0x5c21d1['body']['from'];_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')]=_0x5c21d1[_0x00c1('0x58')][_0x00c1('0x21')];_0x2545d7['body'][_0x00c1('0x7f')]=_0x5c21d1[_0x00c1('0x58')]['refid'];break;}}if(_0x2545d7[_0x00c1('0x58')]['id']){delete _0x2545d7[_0x00c1('0x58')]['id'];}if(_[_0x00c1('0x8d')](_0x2545d7[_0x00c1('0x58')][_0x00c1('0x78')])){throw new db['Sequelize']['ValidationError'](_0x00c1('0x8e'));}if(_['isNil'](_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')])||_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')]===''){throw new db['Sequelize'][(_0x00c1('0x70'))](_0x00c1('0x8f'));}if(_[_0x00c1('0x8d')](_0x2545d7[_0x00c1('0x58')][_0x00c1('0x90')])){throw new db[(_0x00c1('0x6f'))]['ValidationError'](_0x00c1('0x91')+_0x3df88a);}if(!_[_0x00c1('0x92')](_0x3df88a,_0x2545d7[_0x00c1('0x58')][_0x00c1('0x90')])){throw new db[(_0x00c1('0x6f'))][(_0x00c1('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3df88a);}_0x585c86[_0x2545d7[_0x00c1('0x58')][_0x00c1('0x90')]]=_0x2545d7[_0x00c1('0x58')]['from'];return db[_0x00c1('0x93')][_0x00c1('0x51')]({'where':{'id':_0x2545d7[_0x00c1('0x69')][_0x00c1('0x94')]},'include':[{'model':db['CmContact'],'as':_0x00c1('0x95'),'where':_0x585c86,'limit':0x1,'order':[[_0x00c1('0x73'),_0x00c1('0x96')]]}]});})[_0x00c1('0x30')](handleEntityNotFound(_0x2f7d70,null))[_0x00c1('0x30')](function(_0x1a01d3){if(_0x1a01d3){_0x2545d7[_0x00c1('0x97')]=_['omit'](_0x1a01d3,[_0x00c1('0x95')]);if(_0x1a01d3['Contacts'][_0x00c1('0x42')]){return _0x1a01d3[_0x00c1('0x95')][0x0];}var _0x203585=_[_0x00c1('0x98')](_0x2545d7[_0x00c1('0x58')],{'firstName':_0x2545d7[_0x00c1('0x58')][_0x00c1('0x78')],'ListId':_0x1a01d3['id']});_0x203585[_0x2545d7[_0x00c1('0x58')]['mapKey']]=_0x2545d7['body'][_0x00c1('0x78')];return db[_0x00c1('0x6e')][_0x00c1('0x52')](_0x203585,{'fields':_0x295f7c,'raw':!![]});}})['then'](handleEntityNotFound(_0x2f7d70,null))[_0x00c1('0x30')](function(_0x253eba){if(_0x253eba){_0x2545d7[_0x00c1('0x99')]=_0x253eba;var _0x564b31={'ContactId':_0x253eba['id'],'phone':_0x2545d7['body'][_0x00c1('0x78')],'SmsAccountId':_0x5c21d1[_0x00c1('0x4f')]['id']};var _0x548dde={'ContactId':_0x253eba['id'],'SmsAccountId':_0x5c21d1[_0x00c1('0x4f')]['id'],'closed':![]};return db[_0x00c1('0x9a')][_0x00c1('0x51')]({'where':_0x548dde})[_0x00c1('0x30')](function(_0x100908){if(_0x100908){return[_0x100908,![]];}return db[_0x00c1('0x9a')][_0x00c1('0x52')](_0x564b31)[_0x00c1('0x30')](function(_0x2bd438){return[_0x2bd438,!![]];});});}})['spread'](function(_0x5ee807,_0x5c85db){_0x2545d7['interaction']=_0x5ee807[_0x00c1('0x31')]({'plain':!![]});_0x2545d7['interaction']['created']=![];if(_0x5c85db){if(_0x2545d7[_0x00c1('0x69')][_0x00c1('0x9b')]){_0x2545d7[_0x00c1('0x6a')][_0x00c1('0x9c')]({'id':0x0,'priority':_0x2545d7[_0x00c1('0x6a')][_0x00c1('0x42')]+0x1,'app':_0x00c1('0x9d'),'appdata':'unmanaged','interval':_0x00c1('0x9e')});}_0x2545d7[_0x00c1('0x9f')][_0x00c1('0xa0')]=!![];}return db[_0x00c1('0xa1')][_0x00c1('0x52')]({'phone':_0x2545d7[_0x00c1('0x58')][_0x00c1('0x78')],'messageId':_0x2545d7['body'][_0x00c1('0x7f')],'body':_0x2545d7[_0x00c1('0x58')][_0x00c1('0x58')],'SmsAccountId':_0x5c21d1[_0x00c1('0x4f')]['id'],'SmsInteractionId':_0x5ee807['id'],'direction':'in','ContactId':_0x5ee807['ContactId'],'AttachmentId':_0x2545d7['body'][_0x00c1('0xa2')]});})[_0x00c1('0x30')](function(_0x1ff5e9){_0x2545d7[_0x00c1('0x21')]=_0x1ff5e9;if(_0x2545d7[_0x00c1('0x9f')][_0x00c1('0xa3')]){return db[_0x00c1('0xa4')][_0x00c1('0x51')]({'attributes':['id',_0x00c1('0x33')],'where':{'id':_0x2545d7[_0x00c1('0x9f')][_0x00c1('0xa3')]}})[_0x00c1('0x30')](function(_0x19140c){if(_0x19140c){_0x2545d7[_0x00c1('0x6a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x00c1('0xa5'),'appdata':_0x19140c[_0x00c1('0x33')]+','+(_0x2545d7[_0x00c1('0x69')][_0x00c1('0xa6')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x00c1('0xa7'),_0x2545d7);});}return respondWithRpcPromise(_0x00c1('0xa8'),_0x00c1('0xa7'),_0x2545d7);})[_0x00c1('0x30')](function(_0x14a55e){if(_0x14a55e){var _0x380a0d=0xc8;var _0x47d11c=_0x00c1('0xa9');logger[_0x00c1('0x22')](_0x00c1('0x1d'),_0x47d11c,_0x380a0d,'entity\x20found');logger[_0x00c1('0x1c')](_0x00c1('0xaa'),_0x47d11c,_0x380a0d,_0x00c1('0xab'),JSON[_0x00c1('0xac')](_0x14a55e));if(_0x2545d7[_0x00c1('0x69')][_0x00c1('0x39')]==='twilio'){return _0x2f7d70[_0x00c1('0x26')](_0x380a0d)[_0x00c1('0x2c')]('Content-Type',_0x00c1('0xad'))[_0x00c1('0x34')](_0x00c1('0xae'));}else{return _0x2f7d70['status'](_0x380a0d)['json'](_0x14a55e);}}})[_0x00c1('0x24')](handleError(_0x2f7d70,null));};exports[_0x00c1('0xaf')]=function(_0x2fe73e,_0x972fb5){var _0x2fe075=_0x2fe73e['params']['id'];var _0x59e520=_0x2fe73e[_0x00c1('0x58')];var _0x104b75=0xc8;var _0x1d5432=null;return db[_0x00c1('0xb0')][_0x00c1('0xb1')]({'isolationLevel':db['sequelize'][_0x00c1('0xb2')][_0x00c1('0xb3')]['READ_COMMITTED']},function(_0x5771ee){return db[_0x00c1('0x37')][_0x00c1('0xb4')]({'where':{'id':_0x2fe075},'transaction':_0x5771ee})[_0x00c1('0x30')](function(_0xc8f8d0){if(_0xc8f8d0){return db['SmsApplication'][_0x00c1('0x2f')]({'where':{'SmsAccountId':_0x2fe075},'transaction':_0x5771ee})[_0x00c1('0x30')](function(){var _0x224693=_[_0x00c1('0x36')](_0x59e520,function(_0x3eda6c){_0x3eda6c[_0x00c1('0x5b')]=_0x2fe075;return _0x3eda6c;});return db[_0x00c1('0xb5')]['bulkCreate'](_0x224693,{'transaction':_0x5771ee});});}else{_0x104b75=0x194;_0x1d5432=[];}});})['then'](function(){if(_0x104b75!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x2fe075},'order':_0x00c1('0x6c')})[_0x00c1('0x30')](function(_0x105856){_0x1d5432=_0x105856;});}})[_0x00c1('0x24')](function(_0xcf6740){_0x104b75=0x1f4;logger[_0x00c1('0x1e')](_0xcf6740[_0x00c1('0xb6')]);if(_0xcf6740[_0x00c1('0x33')]){delete _0xcf6740[_0x00c1('0x33')];}_0x1d5432=_0xcf6740;})['finally'](function(){if(_0x1d5432===null){_0x972fb5[_0x00c1('0x25')](_0x104b75);}else{if(_0x104b75===0x1f4){_0x972fb5[_0x00c1('0x26')](_0x104b75)[_0x00c1('0x34')](_0x1d5432);}else{_0x972fb5['status'](_0x104b75)['json'](_0x1d5432);}}});};exports[_0x00c1('0xb7')]=function(_0x3541d5,_0x24e817,_0x323470){var _0x5ba32c={};var _0x4c910c={};var _0x557116;var _0x2135cf;return db[_0x00c1('0x37')][_0x00c1('0xb4')]({'where':{'id':_0x3541d5['params']['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x24e817,null))[_0x00c1('0x30')](function(_0x4c3634){if(_0x4c3634){_0x557116=_0x4c3634;_0x4c910c['model']=_['keys'](db[_0x00c1('0xb5')][_0x00c1('0x38')]);_0x4c910c['query']=_['keys'](_0x3541d5['query']);_0x4c910c[_0x00c1('0x3e')]=_[_0x00c1('0x3f')](_0x4c910c[_0x00c1('0x3b')],_0x4c910c['query']);_0x5ba32c[_0x00c1('0x40')]=_[_0x00c1('0x3f')](_0x4c910c[_0x00c1('0x3b')],qs[_0x00c1('0x41')](_0x3541d5[_0x00c1('0x3c')]['fields']));_0x5ba32c['attributes']=_0x5ba32c[_0x00c1('0x40')][_0x00c1('0x42')]?_0x5ba32c[_0x00c1('0x40')]:_0x4c910c[_0x00c1('0x3b')];_0x5ba32c['order']=qs[_0x00c1('0x45')](_0x3541d5['query'][_0x00c1('0x45')]);_0x5ba32c[_0x00c1('0x46')]=qs[_0x00c1('0x3e')](_[_0x00c1('0x47')](_0x3541d5[_0x00c1('0x3c')],_0x4c910c['filters']));if(_0x3541d5[_0x00c1('0x3c')]['filter']){_0x5ba32c[_0x00c1('0x46')]=_['merge'](_0x5ba32c[_0x00c1('0x46')],{'$or':_[_0x00c1('0x36')](_0x5ba32c[_0x00c1('0x40')],function(_0x2a2ac3){var _0xdc7a23={};_0xdc7a23[_0x2a2ac3]={'$like':'%'+_0x3541d5[_0x00c1('0x3c')][_0x00c1('0x48')]+'%'};return _0xdc7a23;})});}_0x5ba32c=_['merge']({},_0x5ba32c,_0x3541d5[_0x00c1('0x5e')]);return _0x557116['getApplications'](_0x5ba32c);}})[_0x00c1('0x30')](function(_0x22becd){if(_0x22becd){_0x2135cf=_0x22becd['length'];if(!_0x3541d5[_0x00c1('0x3c')][_0x00c1('0x43')](_0x00c1('0xb8'))){_0x5ba32c[_0x00c1('0x2a')]=qs[_0x00c1('0x2a')](_0x3541d5[_0x00c1('0x3c')]['limit']);_0x5ba32c[_0x00c1('0x28')]=qs[_0x00c1('0x28')](_0x3541d5[_0x00c1('0x3c')]['offset']);}return _0x557116[_0x00c1('0xb7')](_0x5ba32c);}})[_0x00c1('0x30')](function(_0x450a73){if(_0x450a73){return _0x450a73?{'count':_0x2135cf,'rows':_0x450a73}:null;}})['then'](respondWithResult(_0x24e817,null))['catch'](handleError(_0x24e817,null));};exports[_0x00c1('0xb9')]=function(_0x3d0444,_0x3ca364,_0x3d841c){var _0x3eae66={'raw':![],'where':{}};var _0x198b3a={};var _0x118100={'count':0x0,'rows':[]};return db['SmsAccount'][_0x00c1('0xb4')]({'where':{'id':_0x3d0444[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x3ca364,null))[_0x00c1('0x30')](function(_0x36de01){if(_0x36de01){_0x198b3a[_0x00c1('0x3b')]=_[_0x00c1('0x3d')](db[_0x00c1('0x9a')][_0x00c1('0x38')]);_0x198b3a[_0x00c1('0x3c')]=_[_0x00c1('0x3d')](_0x3d0444['query']);_0x198b3a['filters']=_[_0x00c1('0x3f')](_0x198b3a['model'],_0x198b3a[_0x00c1('0x3c')]);_0x3eae66['attributes']=_[_0x00c1('0x3f')](_0x198b3a['model'],qs[_0x00c1('0x41')](_0x3d0444[_0x00c1('0x3c')][_0x00c1('0x41')]));_0x3eae66['attributes']=_0x3eae66[_0x00c1('0x40')][_0x00c1('0x42')]?_0x3eae66[_0x00c1('0x40')]:_0x198b3a['model'];if(!_0x3d0444[_0x00c1('0x3c')][_0x00c1('0x43')]('nolimit')){_0x3eae66['limit']=qs[_0x00c1('0x2a')](_0x3d0444[_0x00c1('0x3c')][_0x00c1('0x2a')]);_0x3eae66[_0x00c1('0x28')]=qs[_0x00c1('0x28')](_0x3d0444['query'][_0x00c1('0x28')]);}_0x3eae66[_0x00c1('0x44')]=qs['sort'](_0x3d0444[_0x00c1('0x3c')]['sort']);_0x3eae66[_0x00c1('0x46')]=qs[_0x00c1('0x3e')](_['pick'](_0x3d0444[_0x00c1('0x3c')],_0x198b3a[_0x00c1('0x3e')]));_0x3eae66[_0x00c1('0x46')][_0x00c1('0x5b')]=_0x36de01['id'];if(_0x3d0444[_0x00c1('0x3c')][_0x00c1('0x48')]){_0x3eae66[_0x00c1('0x46')]=_['merge'](_0x3eae66[_0x00c1('0x46')],{'$or':_[_0x00c1('0x36')](_0x3eae66[_0x00c1('0x40')],function(_0x173522){var _0x428496={};_0x428496[_0x173522]={'$like':'%'+_0x3d0444[_0x00c1('0x3c')][_0x00c1('0x48')]+'%'};return _0x428496;})});}_0x3eae66=_[_0x00c1('0x49')]({},_0x3eae66,_0x3d0444[_0x00c1('0x5e')]);return db[_0x00c1('0x9a')]['count']({'where':_0x3eae66[_0x00c1('0x46')]})[_0x00c1('0x30')](function(_0x1c0eaa){_0x118100['count']=_0x1c0eaa;if(_0x3d0444[_0x00c1('0x3c')][_0x00c1('0x4b')]){_0x3eae66[_0x00c1('0x4c')]=[{'model':db['CmContact'],'as':_0x00c1('0xba'),'required':![]},{'model':db['User'],'as':_0x00c1('0xbb'),'attributes':[_0x00c1('0x33'),_0x00c1('0xbc'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x00c1('0xbd'),'attributes':['id',_0x00c1('0x33'),_0x00c1('0xbe')],'where':_0x3d0444[_0x00c1('0x3c')][_0x00c1('0xbf')]?{'id':_0x3d0444[_0x00c1('0x3c')]['tag']}:undefined,'required':_0x3d0444[_0x00c1('0x3c')]['tag']?!![]:![]}];}return db[_0x00c1('0x9a')][_0x00c1('0x4d')](_0x3eae66);})[_0x00c1('0x30')](function(_0x3dcfad){_0x118100['rows']=_0x3dcfad;return _0x118100;});}})[_0x00c1('0x30')](respondWithFilteredResult(_0x3ca364,_0x3eae66))[_0x00c1('0x24')](handleError(_0x3ca364,null));};exports[_0x00c1('0x34')]=function(_0xb53658,_0x4a9074,_0x24ce95){var _0x5893ad,_0x1f18d2,_0x371b82;if(_[_0x00c1('0x8d')](_0xb53658[_0x00c1('0x58')][_0x00c1('0x58')])||_0xb53658[_0x00c1('0x58')][_0x00c1('0x58')]===''){throw new db['Sequelize'][(_0x00c1('0x70'))](_0x00c1('0x8f'));}if(_[_0x00c1('0x8d')](_0xb53658[_0x00c1('0x58')]['to'])){throw new db[(_0x00c1('0x6f'))][(_0x00c1('0x70'))]('to\x20is\x20mandatory');}_0x5893ad=_0xb53658[_0x00c1('0x58')]['to'];return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0xb53658['params']['id']},'include':[{'model':db[_0x00c1('0x93')],'as':_0x00c1('0xc0'),'include':[{'model':db[_0x00c1('0x6e')],'as':_0x00c1('0x95'),'where':{'mobile':_0x5893ad},'limit':0x1,'order':[[_0x00c1('0x73'),_0x00c1('0x96')]]}]}]})[_0x00c1('0x30')](handleEntityNotFound(_0x4a9074,null))[_0x00c1('0x30')](function(_0xa78889){if(_0xa78889&&_0xa78889[_0x00c1('0xc0')]){_0x1f18d2=_0xa78889[_0x00c1('0x31')]({'plain':!![]});if(_0x1f18d2[_0x00c1('0xc0')]&&_0x1f18d2[_0x00c1('0xc0')][_0x00c1('0x95')]['length']){return _0x1f18d2[_0x00c1('0xc0')][_0x00c1('0x95')][0x0];}return db[_0x00c1('0x6e')][_0x00c1('0x52')](_[_0x00c1('0x98')](_0xb53658[_0x00c1('0x58')],{'firstName':_0x5893ad,'mobile':_0x5893ad,'phone':_0x5893ad,'ListId':_0x1f18d2['ListId']}));}})[_0x00c1('0x30')](handleEntityNotFound(_0x4a9074,null))['then'](function(_0x55747e){if(_0x55747e){_0x371b82=_0x55747e;return db[_0x00c1('0x9a')][_0x00c1('0x51')]({'where':{'ContactId':_0x371b82['id'],'closed':![],'SmsAccountId':_0x1f18d2['id']}})['then'](function(_0xdc780a){if(_0xdc780a){return[_0xdc780a,![]];}return db[_0x00c1('0x9a')]['create']({'UserId':_0xb53658['user']['id'],'ContactId':_0x371b82['id'],'SmsAccountId':_0x1f18d2['id'],'phone':_0x5893ad,'firstMsgDirection':_0x00c1('0xc1'),'Messages':[_[_0x00c1('0x49')](_0xb53658[_0x00c1('0x58')],{'read':![],'body':_0xb53658[_0x00c1('0x58')][_0x00c1('0x58')],'phone':_0x5893ad,'SmsAccountId':_0x1f18d2['id'],'UserId':_0xb53658['user']['id'],'ContactId':_0x371b82['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x00c1('0xc2')}]})[_0x00c1('0x30')](function(_0x1215ef){return[_0x1215ef,!![]];});});}})['spread'](function(_0x35a601,_0x150645){if(_0x150645){return _0x35a601;}return db['SmsMessage'][_0x00c1('0x52')](_[_0x00c1('0x49')](_0xb53658[_0x00c1('0x58')],{'read':![],'body':_0xb53658[_0x00c1('0x58')][_0x00c1('0x58')],'phone':_0x5893ad,'SmsAccountId':_0x1f18d2['id'],'SmsInteractionId':_0x35a601['id'],'UserId':_0xb53658['user']['id'],'ContactId':_0x371b82['id']}))[_0x00c1('0x30')](function(_0x78ead){_0x35a601['dataValues'][_0x00c1('0xc2')]=[];_0x35a601[_0x00c1('0xc3')][_0x00c1('0xc2')][_0x00c1('0x9c')](_0x78ead[_0x00c1('0xc3')]);return _0x35a601;});})[_0x00c1('0x30')](respondWithResult(_0x4a9074,null))[_0x00c1('0x24')](handleError(_0x4a9074,null));};exports[_0x00c1('0x26')]=function(_0x429859,_0x3bf212,_0x175263){if(_0x429859[_0x00c1('0x58')]['id']){delete _0x429859[_0x00c1('0x58')]['id'];}var _0x362e92,_0x3a0aa9,_0x3b9bcd;return db['SmsAccount'][_0x00c1('0x51')]({'where':{'id':_0x429859[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x3bf212,null))['then'](function(_0x635d7a){if(_0x635d7a){_0x3b9bcd=_0x635d7a;logger[_0x00c1('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x00c1('0xc4'),_0x635d7a['type'],util[_0x00c1('0xc5')](_0x429859[_0x00c1('0x58')],{'showHidden':![],'depth':null}));switch(_0x635d7a['type']){case _0x00c1('0x7b'):if(_0x429859[_0x00c1('0x58')][_0x00c1('0xc6')]&&_0x429859[_0x00c1('0x58')]['status']){_0x3a0aa9=_0x429859[_0x00c1('0x58')]['status'];return db[_0x00c1('0xa1')][_0x00c1('0x51')]({'where':{'messageId':_0x429859[_0x00c1('0x58')][_0x00c1('0xc6')]}});}break;case _0x00c1('0x7d'):if(_0x429859['body'][_0x00c1('0xc7')]&&_0x429859[_0x00c1('0x58')][_0x00c1('0xc8')]){_0x3a0aa9=_0x429859['body'][_0x00c1('0xc8')];return db[_0x00c1('0xa1')][_0x00c1('0x51')]({'where':{'messageId':_0x429859[_0x00c1('0x58')][_0x00c1('0xc7')]}});}break;case _0x00c1('0x7e'):if(_0x429859['body']['message_id']&&_0x429859[_0x00c1('0x58')]['status_code']){_0x3a0aa9=_0x429859['body'][_0x00c1('0xc9')];return db[_0x00c1('0xa1')]['find']({'where':{'messageId':_0x429859[_0x00c1('0x58')][_0x00c1('0x80')]}});}break;case _0x00c1('0xca'):var _0x1ab6ad=_0x429859['body']['results'][0x0];if(_0x1ab6ad[_0x00c1('0x7f')]&&_0x1ab6ad[_0x00c1('0x26')][_0x00c1('0xcb')]==='DELIVERED'){_0x3a0aa9=_0x1ab6ad['status'][_0x00c1('0xcb')];return db['SmsMessage'][_0x00c1('0x51')]({'where':{'messageId':_0x1ab6ad[_0x00c1('0x7f')]}});}break;case _0x00c1('0x88'):if(_0x429859[_0x00c1('0x58')][_0x00c1('0x7f')]&&_0x429859['body']['status']){_0x3a0aa9=_0x429859[_0x00c1('0x58')][_0x00c1('0x26')];return db['SmsMessage'][_0x00c1('0x51')]({'where':{'messageId':_0x429859['body'][_0x00c1('0x7f')]}});}break;case _0x00c1('0x8b'):if(_0x429859[_0x00c1('0x58')][0x0][_0x00c1('0x21')]['id']){_0x3a0aa9=_0x429859[_0x00c1('0x58')][0x0][_0x00c1('0x39')];return db[_0x00c1('0xa1')][_0x00c1('0x51')]({'where':{'messageId':_0x429859[_0x00c1('0x58')][0x0][_0x00c1('0x21')]['id']}});}break;case _0x00c1('0x8c'):if(_0x429859[_0x00c1('0x58')][_0x00c1('0xcc')]&&_0x429859[_0x00c1('0x58')][_0x00c1('0x26')]){_0x3a0aa9=_0x429859[_0x00c1('0x58')]['status'];return db[_0x00c1('0xa1')]['find']({'where':{'messageId':_0x429859[_0x00c1('0x58')][_0x00c1('0xcc')]}});}break;}}})[_0x00c1('0x30')](handleEntityNotFound(_0x3bf212,null))['then'](function(_0x102978){if(_0x102978){_0x362e92=_0x102978;switch(_0x3b9bcd[_0x00c1('0x39')]){case'skebby':if(_0x3a0aa9===_0x00c1('0xcd')){return _0x362e92[_0x00c1('0x2e')]({'read':!![]});}else{logger[_0x00c1('0x1e')](_0x00c1('0x1d'),_0x00c1('0x26'),_0x00c1('0x7b'),util[_0x00c1('0xc5')](_0x429859[_0x00c1('0x58')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3a0aa9==='1'){return _0x362e92[_0x00c1('0x2e')]({'read':!![]});}else{logger['error'](_0x00c1('0x1d'),_0x00c1('0x26'),_0x00c1('0x7b'),util[_0x00c1('0xc5')](_0x429859[_0x00c1('0x58')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x429859['body'][_0x00c1('0xce')]&&_0x3a0aa9>=0xc8&&_0x3a0aa9<=0xce){return _0x362e92['update']({'read':!![]});}else{logger[_0x00c1('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x00c1('0x7e'),util[_0x00c1('0xc5')](_0x429859[_0x00c1('0x58')],{'showHidden':![],'depth':null}));}break;case _0x00c1('0xca'):var _0x49d83b=_0x429859['body']['results'][0x0];if(_0x49d83b[_0x00c1('0x26')]['groupName']===_0x00c1('0xcd')){return _0x362e92[_0x00c1('0x2e')]({'read':!![]});}else{logger['error'](_0x00c1('0x1d'),_0x00c1('0x26'),_0x00c1('0xca'),util['inspect'](_0x429859['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3a0aa9==_0x00c1('0xcf')||_0x3a0aa9==_0x00c1('0xd0')){return _0x362e92[_0x00c1('0x2e')]({'read':!![]});}else{logger['error'](_0x00c1('0x1d'),_0x00c1('0x26'),'clickatell',util['inspect'](_0x429859[_0x00c1('0x58')],{'showHidden':![],'depth':null}));}break;case _0x00c1('0x8b'):if(_0x3a0aa9=='message-delivered'){return _0x362e92[_0x00c1('0x2e')]({'read':!![]});}else{logger[_0x00c1('0x1e')](_0x00c1('0x1d'),_0x00c1('0x26'),'bandwidth',util['inspect'](_0x429859[_0x00c1('0x58')],{'showHidden':![],'depth':null}));}break;case _0x00c1('0x8c'):if(_0x3a0aa9===_0x00c1('0xd1')||_0x3a0aa9==='ACCEPTD'){return _0x362e92[_0x00c1('0x2e')]({'read':!![]});}else{logger[_0x00c1('0x1e')](_0x00c1('0x1d'),_0x00c1('0x26'),_0x00c1('0x8c'),util[_0x00c1('0xc5')](_0x429859[_0x00c1('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x362e92;}})[_0x00c1('0x30')](respondWithResult(_0x3bf212,null))[_0x00c1('0x24')](handleError(_0x3bf212,null));};exports[_0x00c1('0xd2')]=function(_0xc9c45a,_0x120042,_0x33bac5){var _0x4ea308,_0x3d1f45,_0x19a93d;return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0xc9c45a['params']['id']}})['then'](handleEntityNotFound(_0x120042,null))[_0x00c1('0x30')](function(_0x956146){if(_0x956146){_0x19a93d=_0x956146;logger[_0x00c1('0x1c')](_0x00c1('0x1d'),_0x00c1('0x26'),_0x00c1('0xc4'),_0x956146[_0x00c1('0x39')],util[_0x00c1('0xc5')](_0xc9c45a[_0x00c1('0x3c')],{'showHidden':![],'depth':null}));switch(_0x956146['type']){case _0x00c1('0xd3'):if(_0xc9c45a['query']['message-id']&&_0xc9c45a['query'][_0x00c1('0xd4')]){_0x3d1f45=_0xc9c45a[_0x00c1('0x3c')][_0x00c1('0xd4')];return db['SmsMessage'][_0x00c1('0x51')]({'where':{'messageId':_0xc9c45a['query'][_0x00c1('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x120042,null))['then'](function(_0x46599a){if(_0x46599a){_0x4ea308=_0x46599a;switch(_0x19a93d[_0x00c1('0x39')]){case _0x00c1('0xd3'):if(_0x3d1f45==='2'||_0x3d1f45==='6'){return _0x4ea308['update']({'read':!![]});}else{logger[_0x00c1('0x1e')](_0x00c1('0x1d'),'status',_0x00c1('0xd3'),util[_0x00c1('0xc5')](_0xc9c45a[_0x00c1('0x3c')],{'showHidden':![],'depth':null}));};break;}return _0x4ea308;}})[_0x00c1('0x30')](respondWithResult(_0x120042,null))[_0x00c1('0x24')](handleError(_0x120042,null));};exports[_0x00c1('0xd6')]=function(_0x4a9cb7,_0x5ad7b5,_0x4524ba){return db['SmsAccount'][_0x00c1('0x51')]({'where':{'id':_0x4a9cb7[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x5ad7b5,null))[_0x00c1('0x30')](function(_0x18ff18){if(_0x18ff18){return _0x18ff18[_0x00c1('0xd6')](_0x4a9cb7[_0x00c1('0x58')][_0x00c1('0x60')],_['omit'](_0x4a9cb7['body'],[_0x00c1('0x60'),'id'])||{})[_0x00c1('0xd7')](function(_0xba3dcd){for(var _0x55e003=0x0;_0x55e003<_0x4a9cb7[_0x00c1('0x58')]['ids'][_0x00c1('0x42')];_0x55e003+=0x1){socket[_0x00c1('0xd8')](_0x00c1('0xd9'),{'UserId':Number(_0x4a9cb7[_0x00c1('0x58')][_0x00c1('0x60')][_0x55e003]),'SmsAccountId':Number(_0x4a9cb7[_0x00c1('0x4f')]['id'])});}return _0xba3dcd;});}})[_0x00c1('0x30')](respondWithResult(_0x5ad7b5,null))[_0x00c1('0x24')](handleError(_0x5ad7b5,null));};exports[_0x00c1('0xda')]=function(_0x246ce5,_0x172fbd,_0x4895de){return db[_0x00c1('0x37')][_0x00c1('0x51')]({'where':{'id':_0x246ce5[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0x172fbd,null))['then'](function(_0x166020){if(_0x166020){return _0x166020[_0x00c1('0xda')](_0x246ce5[_0x00c1('0x3c')]['ids'])[_0x00c1('0x30')](function(){if(_[_0x00c1('0xdb')](_0x246ce5[_0x00c1('0x3c')][_0x00c1('0x60')])){for(var _0x35b247=0x0;_0x35b247<_0x246ce5[_0x00c1('0x3c')]['ids']['length'];_0x35b247+=0x1){socket['emit'](_0x00c1('0xdc'),{'UserId':Number(_0x246ce5[_0x00c1('0x3c')][_0x00c1('0x60')][_0x35b247]),'SmsAccountId':Number(_0x246ce5[_0x00c1('0x4f')]['id'])});}}else{socket['emit'](_0x00c1('0xdc'),{'UserId':Number(_0x246ce5[_0x00c1('0x3c')]['ids']),'SmsAccountId':Number(_0x246ce5['params']['id'])});}});}})[_0x00c1('0x30')](respondWithStatusCode(_0x172fbd,null))[_0x00c1('0x24')](handleError(_0x172fbd,null));};exports['getAgents']=function(_0x3c4869,_0xe0177c,_0xcf3813){var _0x298411={};var _0x9c89f7={};var _0x12a1fa;var _0x3da757;return db[_0x00c1('0x37')]['findOne']({'where':{'id':_0x3c4869[_0x00c1('0x4f')]['id']}})[_0x00c1('0x30')](handleEntityNotFound(_0xe0177c,null))['then'](function(_0x455e54){if(_0x455e54){_0x12a1fa=_0x455e54;_0x9c89f7[_0x00c1('0x3b')]=_[_0x00c1('0x3d')](db[_0x00c1('0xa4')][_0x00c1('0x38')]);_0x9c89f7[_0x00c1('0x3c')]=_['keys'](_0x3c4869[_0x00c1('0x3c')]);_0x9c89f7[_0x00c1('0x3e')]=_[_0x00c1('0x3f')](_0x9c89f7['model'],_0x9c89f7['query']);_0x298411['attributes']=_['intersection'](_0x9c89f7[_0x00c1('0x3b')],qs[_0x00c1('0x41')](_0x3c4869['query'][_0x00c1('0x41')]));_0x298411[_0x00c1('0x40')]=_0x298411['attributes'][_0x00c1('0x42')]?_0x298411[_0x00c1('0x40')]:_0x9c89f7[_0x00c1('0x3b')];_0x298411[_0x00c1('0x44')]=qs[_0x00c1('0x45')](_0x3c4869['query'][_0x00c1('0x45')]);_0x298411['where']=qs[_0x00c1('0x3e')](_['pick'](_0x3c4869[_0x00c1('0x3c')],_0x9c89f7[_0x00c1('0x3e')]));if(_0x3c4869['query'][_0x00c1('0x48')]){_0x298411['where']=_[_0x00c1('0x49')](_0x298411['where'],{'$or':_[_0x00c1('0x36')](_0x298411['attributes'],function(_0x5cb64a){var _0x3bd271={};_0x3bd271[_0x5cb64a]={'$like':'%'+_0x3c4869[_0x00c1('0x3c')][_0x00c1('0x48')]+'%'};return _0x3bd271;})});}_0x298411=_[_0x00c1('0x49')]({},_0x298411,_0x3c4869[_0x00c1('0x5e')]);return _0x12a1fa['getAgents'](_0x298411);}})[_0x00c1('0x30')](function(_0x5fbd9e){if(_0x5fbd9e){_0x3da757=_0x5fbd9e[_0x00c1('0x42')];if(!_0x3c4869[_0x00c1('0x3c')]['hasOwnProperty'](_0x00c1('0xb8'))){_0x298411[_0x00c1('0x2a')]=qs[_0x00c1('0x2a')](_0x3c4869[_0x00c1('0x3c')][_0x00c1('0x2a')]);_0x298411['offset']=qs[_0x00c1('0x28')](_0x3c4869[_0x00c1('0x3c')]['offset']);}return _0x12a1fa['getAgents'](_0x298411);}})[_0x00c1('0x30')](function(_0x482bef){if(_0x482bef){return _0x482bef?{'count':_0x3da757,'rows':_0x482bef}:null;}})['then'](respondWithResult(_0xe0177c,null))[_0x00c1('0x24')](handleError(_0xe0177c,null));}; \ No newline at end of file +var _0x61c9=['createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','sender','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','omit','Contacts','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','Contact','internal','Tag','Tags','color','tag','List','out','SmsMessage','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','json','offset','undefined','set','apply','reject','update','then','destroy','get','SmsAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','rows','catch','show','params','Pause','keys','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','findOne','Disposition','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference'];(function(_0x5b5fb1,_0x130d94){var _0x2fc9e5=function(_0xc930fa){while(--_0xc930fa){_0x5b5fb1['push'](_0x5b5fb1['shift']());}};_0x2fc9e5(++_0x130d94);}(_0x61c9,0x67));var _0x961c=function(_0x3b9815,_0x21a16f){_0x3b9815=_0x3b9815-0x0;var _0x46fa98=_0x61c9[_0x3b9815];return _0x46fa98;};'use strict';var emlformat=require(_0x961c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x961c('0x1'));var rp=require('request-promise');var moment=require(_0x961c('0x2'));var BPromise=require(_0x961c('0x3'));var Mustache=require(_0x961c('0x4'));var util=require(_0x961c('0x5'));var path=require('path');var sox=require(_0x961c('0x6'));var csv=require(_0x961c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x961c('0x8'));var _=require(_0x961c('0x9'));var squel=require(_0x961c('0xa'));var crypto=require('crypto');var jsforce=require(_0x961c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x961c('0x7'));var querystring=require(_0x961c('0xc'));var Papa=require(_0x961c('0xd'));var Redis=require(_0x961c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x961c('0xf'));var as=require(_0x961c('0x10'));var hardwareService=require(_0x961c('0x11'));var logger=require(_0x961c('0x12'))(_0x961c('0x13'));var utils=require(_0x961c('0x14'));var config=require(_0x961c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x961c('0x16'))['db'];config[_0x961c('0x17')]=_[_0x961c('0x18')](config[_0x961c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x961c('0x19'))(new Redis(config['redis']));require(_0x961c('0x1a'))[_0x961c('0x1b')](socket);var jayson=require(_0x961c('0x1c'));var client=jayson[_0x961c('0x1d')][_0x961c('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x441568,_0x1eefc0,_0x5af7d1,_0x1c3758){return new BPromise(function(_0x382be7,_0x462afd){var _0x41aa94=_0x1c3758||client;return _0x41aa94[_0x961c('0x1f')](_0x441568,_0x5af7d1)['then'](function(_0x140ddf){logger[_0x961c('0x20')](_0x961c('0x21'),_0x1eefc0,_0x961c('0x22'));logger[_0x961c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1eefc0,_0x961c('0x22'),JSON[_0x961c('0x24')](_0x140ddf));if(_0x140ddf[_0x961c('0x25')]){if(_0x140ddf['error']['code']===0x1f4){logger['error'](_0x961c('0x21'),_0x1eefc0,_0x140ddf[_0x961c('0x25')][_0x961c('0x26')]);return _0x462afd(_0x140ddf[_0x961c('0x25')][_0x961c('0x26')]);}logger[_0x961c('0x25')](_0x961c('0x21'),_0x1eefc0,_0x140ddf[_0x961c('0x25')][_0x961c('0x26')]);return _0x382be7(_0x140ddf[_0x961c('0x25')][_0x961c('0x26')]);}else{logger[_0x961c('0x20')](_0x961c('0x21'),_0x1eefc0,_0x961c('0x22'));_0x382be7(_0x140ddf[_0x961c('0x27')][_0x961c('0x26')]);}})['catch'](function(_0x546757){logger[_0x961c('0x25')](_0x961c('0x21'),_0x1eefc0,_0x546757);_0x462afd(_0x546757);});});}function respondWithStatusCode(_0x4c6c45,_0x4b703f){_0x4b703f=_0x4b703f||0xcc;return function(_0x213f2d){if(_0x213f2d){return _0x4c6c45['sendStatus'](_0x4b703f);}return _0x4c6c45[_0x961c('0x28')](_0x4b703f)['end']();};}function respondWithResult(_0x5532ee,_0x436f2b){_0x436f2b=_0x436f2b||0xc8;return function(_0x5cc413){if(_0x5cc413){return _0x5532ee[_0x961c('0x28')](_0x436f2b)[_0x961c('0x29')](_0x5cc413);}};}function respondWithFilteredResult(_0x1d5ec5,_0x35e018){return function(_0x5632bb){if(_0x5632bb){var _0x1bd9b6=typeof _0x35e018[_0x961c('0x2a')]===_0x961c('0x2b')&&typeof _0x35e018['limit']==='undefined';var _0x46819e=_0x5632bb['count'];var _0x23684b=_0x1bd9b6?0x0:_0x35e018[_0x961c('0x2a')];var _0x46ba88=_0x1bd9b6?_0x5632bb['count']:_0x35e018[_0x961c('0x2a')]+_0x35e018['limit'];var _0x4c832c;if(_0x46ba88>=_0x46819e){_0x46ba88=_0x46819e;_0x4c832c=0xc8;}else{_0x4c832c=0xce;}_0x1d5ec5[_0x961c('0x28')](_0x4c832c);return _0x1d5ec5[_0x961c('0x2c')]('Content-Range',_0x23684b+'-'+_0x46ba88+'/'+_0x46819e)[_0x961c('0x29')](_0x5632bb);}return null;};}function patchUpdates(_0x3d7f34){return function(_0x464fc7){try{jsonpatch[_0x961c('0x2d')](_0x464fc7,_0x3d7f34,!![]);}catch(_0x20925e){return BPromise[_0x961c('0x2e')](_0x20925e);}return _0x464fc7['save']();};}function saveUpdates(_0x4cad09,_0x50afb0){return function(_0x1494a8){if(_0x1494a8){return _0x1494a8[_0x961c('0x2f')](_0x4cad09)[_0x961c('0x30')](function(_0x4bf76f){return _0x4bf76f;});}return null;};}function removeEntity(_0x2d7a3d,_0x1c99b0){return function(_0x2926d3){if(_0x2926d3){return _0x2926d3[_0x961c('0x31')]()[_0x961c('0x30')](function(){var _0x5595d5=_0x2926d3[_0x961c('0x32')]({'plain':!![]});var _0x35d4ae=_0x961c('0x33');return db[_0x961c('0x34')][_0x961c('0x31')]({'where':{'type':_0x35d4ae,'resourceId':_0x5595d5['id']}})[_0x961c('0x30')](function(){return _0x2926d3;});})[_0x961c('0x30')](function(){_0x2d7a3d[_0x961c('0x28')](0xcc)[_0x961c('0x35')]();});}};}function handleEntityNotFound(_0x4ece14,_0x4839d6){return function(_0x2604b4){if(!_0x2604b4){_0x4ece14[_0x961c('0x36')](0x194);}return _0x2604b4;};}function handleError(_0x46007f,_0x35e60e){_0x35e60e=_0x35e60e||0x1f4;return function(_0x2976f7){logger[_0x961c('0x25')](_0x2976f7[_0x961c('0x37')]);if(_0x2976f7['name']){delete _0x2976f7[_0x961c('0x38')];}_0x46007f[_0x961c('0x28')](_0x35e60e)[_0x961c('0x39')](_0x2976f7);};}exports[_0x961c('0x3a')]=function(_0x18c1ff,_0x20c1da){var _0x4f260d={'include':[{'model':db['Pause'],'as':_0x961c('0x3b')}]},_0x80ca06={},_0x273148={'count':0x0,'rows':[]};var _0x48333f=_[_0x961c('0x3c')](db[_0x961c('0x3d')][_0x961c('0x3e')],function(_0x4aa2f4){return{'name':_0x4aa2f4['fieldName'],'type':_0x4aa2f4[_0x961c('0x3f')][_0x961c('0x40')]};});_0x80ca06[_0x961c('0x41')]=_[_0x961c('0x3c')](_0x48333f,_0x961c('0x38'));_0x80ca06[_0x961c('0x42')]=_['keys'](_0x18c1ff[_0x961c('0x42')]);_0x80ca06[_0x961c('0x43')]=_[_0x961c('0x44')](_0x80ca06[_0x961c('0x41')],_0x80ca06[_0x961c('0x42')]);_0x4f260d['attributes']=_[_0x961c('0x44')](_0x80ca06[_0x961c('0x41')],qs[_0x961c('0x45')](_0x18c1ff['query']['fields']));_0x4f260d[_0x961c('0x46')]=_0x4f260d[_0x961c('0x46')][_0x961c('0x47')]?_0x4f260d[_0x961c('0x46')]:_0x80ca06[_0x961c('0x41')];if(!_0x18c1ff['query'][_0x961c('0x48')](_0x961c('0x49'))){_0x4f260d['limit']=qs[_0x961c('0x4a')](_0x18c1ff[_0x961c('0x42')][_0x961c('0x4a')]);_0x4f260d['offset']=qs[_0x961c('0x2a')](_0x18c1ff[_0x961c('0x42')][_0x961c('0x2a')]);}_0x4f260d[_0x961c('0x4b')]=qs[_0x961c('0x4c')](_0x18c1ff[_0x961c('0x42')][_0x961c('0x4c')]);_0x4f260d[_0x961c('0x4d')]=qs['filters'](_[_0x961c('0x4e')](_0x18c1ff[_0x961c('0x42')],_0x80ca06['filters']),_0x48333f);if(_0x18c1ff[_0x961c('0x42')][_0x961c('0x4f')]){_0x4f260d[_0x961c('0x4d')]=_[_0x961c('0x50')](_0x4f260d[_0x961c('0x4d')],{'$or':_[_0x961c('0x3c')](_0x48333f,function(_0x43354d){if(_0x43354d[_0x961c('0x3f')]!==_0x961c('0x51')){var _0x21dc2d={};_0x21dc2d[_0x43354d[_0x961c('0x38')]]={'$like':'%'+_0x18c1ff[_0x961c('0x42')]['filter']+'%'};return _0x21dc2d;}})});}_0x4f260d=_[_0x961c('0x50')]({},_0x4f260d,_0x18c1ff['options']);var _0x1387e3={'where':_0x4f260d[_0x961c('0x4d')]};return db['SmsAccount']['count'](_0x1387e3)[_0x961c('0x30')](function(_0xa2ecdb){_0x273148[_0x961c('0x52')]=_0xa2ecdb;if(_0x18c1ff[_0x961c('0x42')][_0x961c('0x53')]){_0x4f260d['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x4f260d);})[_0x961c('0x30')](function(_0x373dce){_0x273148[_0x961c('0x54')]=_0x373dce;return _0x273148;})[_0x961c('0x30')](respondWithFilteredResult(_0x20c1da,_0x4f260d))[_0x961c('0x55')](handleError(_0x20c1da,null));};exports[_0x961c('0x56')]=function(_0x2e3c17,_0x465a6b){var _0x3525fa={'raw':![],'where':{'id':_0x2e3c17[_0x961c('0x57')]['id']},'include':[{'model':db[_0x961c('0x58')],'as':_0x961c('0x3b')}]},_0x3310c2={};_0x3310c2[_0x961c('0x41')]=_[_0x961c('0x59')](db[_0x961c('0x3d')][_0x961c('0x3e')]);_0x3310c2[_0x961c('0x42')]=_['keys'](_0x2e3c17[_0x961c('0x42')]);_0x3310c2[_0x961c('0x43')]=_[_0x961c('0x44')](_0x3310c2['model'],_0x3310c2[_0x961c('0x42')]);_0x3525fa['attributes']=_[_0x961c('0x44')](_0x3310c2['model'],qs['fields'](_0x2e3c17[_0x961c('0x42')]['fields']));_0x3525fa[_0x961c('0x46')]=_0x3525fa[_0x961c('0x46')][_0x961c('0x47')]?_0x3525fa[_0x961c('0x46')]:_0x3310c2[_0x961c('0x41')];if(_0x2e3c17[_0x961c('0x42')][_0x961c('0x53')]){_0x3525fa['include']=[{'all':!![]}];}_0x3525fa=_['merge']({},_0x3525fa,_0x2e3c17[_0x961c('0x5a')]);return db[_0x961c('0x3d')][_0x961c('0x5b')](_0x3525fa)['then'](handleEntityNotFound(_0x465a6b,null))[_0x961c('0x30')](respondWithResult(_0x465a6b,null))[_0x961c('0x55')](handleError(_0x465a6b,null));};exports[_0x961c('0x5c')]=function(_0x3a28ba,_0x359beb){return db[_0x961c('0x3d')]['create'](_0x3a28ba[_0x961c('0x5d')],{})['then'](function(_0x579f3b){var _0x2a8d71=_0x3a28ba[_0x961c('0x5e')][_0x961c('0x32')]({'plain':!![]});if(!_0x2a8d71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a8d71[_0x961c('0x5f')]==='user'){var _0x3a43f7=_0x579f3b['get']({'plain':!![]});var _0x529bf9='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x529bf9,'userProfileId':_0x2a8d71[_0x961c('0x60')]},'raw':!![]})[_0x961c('0x30')](function(_0xe136ea){if(_0xe136ea&&_0xe136ea[_0x961c('0x61')]===0x0){return db[_0x961c('0x34')][_0x961c('0x5c')]({'name':_0x3a43f7[_0x961c('0x38')],'resourceId':_0x3a43f7['id'],'type':_0xe136ea[_0x961c('0x38')],'sectionId':_0xe136ea['id']},{})['then'](function(){return _0x579f3b;});}else{return _0x579f3b;}})['catch'](function(_0x4a5dda){logger['error'](_0x961c('0x62'),_0x4a5dda);throw _0x4a5dda;});}return _0x579f3b;})[_0x961c('0x30')](respondWithResult(_0x359beb,0xc9))[_0x961c('0x55')](handleError(_0x359beb,null));};exports[_0x961c('0x2f')]=function(_0x5d0e25,_0x59091c){if(_0x5d0e25[_0x961c('0x5d')]['id']){delete _0x5d0e25[_0x961c('0x5d')]['id'];}return db[_0x961c('0x3d')][_0x961c('0x5b')]({'where':{'id':_0x5d0e25[_0x961c('0x57')]['id']},'include':[{'model':db[_0x961c('0x58')],'as':_0x961c('0x3b')}]})[_0x961c('0x30')](handleEntityNotFound(_0x59091c,null))[_0x961c('0x30')](saveUpdates(_0x5d0e25[_0x961c('0x5d')],null))['then'](respondWithResult(_0x59091c,null))[_0x961c('0x55')](handleError(_0x59091c,null));};exports['destroy']=function(_0x546b0f,_0x110b9e){return db[_0x961c('0x3d')][_0x961c('0x5b')]({'where':{'id':_0x546b0f[_0x961c('0x57')]['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x110b9e,null))[_0x961c('0x30')](removeEntity(_0x110b9e,null))[_0x961c('0x55')](handleError(_0x110b9e,null));};exports['describe']=function(_0x233e7b,_0x2fb846){return db[_0x961c('0x3d')][_0x961c('0x63')]()[_0x961c('0x30')](respondWithResult(_0x2fb846,null))[_0x961c('0x55')](handleError(_0x2fb846,null));};exports[_0x961c('0x64')]=function(_0x3e2878,_0x4bb8ee,_0x5ab960){if(_0x3e2878[_0x961c('0x5d')]['id']){delete _0x3e2878[_0x961c('0x5d')]['id'];}return db[_0x961c('0x3d')][_0x961c('0x5b')]({'where':{'id':_0x3e2878[_0x961c('0x57')]['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x4bb8ee,null))[_0x961c('0x30')](function(_0x402f82){if(_0x402f82){_0x3e2878[_0x961c('0x5d')][_0x961c('0x65')]=_0x402f82['id'];return db['Disposition']['create'](_0x3e2878[_0x961c('0x5d')]);}})[_0x961c('0x30')](respondWithResult(_0x4bb8ee,null))[_0x961c('0x55')](handleError(_0x4bb8ee,null));};exports['getDispositions']=function(_0x2c1386,_0x513c8b,_0x943b9b){var _0x5b7812={'raw':![],'where':{}};var _0x11fe6e={};var _0x2d5dab={'count':0x0,'rows':[]};return db[_0x961c('0x3d')][_0x961c('0x66')]({'where':{'id':_0x2c1386['params']['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x513c8b,null))[_0x961c('0x30')](function(_0xff26ed){if(_0xff26ed){_0x11fe6e[_0x961c('0x41')]=_['keys'](db[_0x961c('0x67')][_0x961c('0x3e')]);_0x11fe6e['query']=_[_0x961c('0x59')](_0x2c1386[_0x961c('0x42')]);_0x11fe6e[_0x961c('0x43')]=_[_0x961c('0x44')](_0x11fe6e[_0x961c('0x41')],_0x11fe6e[_0x961c('0x42')]);_0x5b7812[_0x961c('0x46')]=_[_0x961c('0x44')](_0x11fe6e[_0x961c('0x41')],qs[_0x961c('0x45')](_0x2c1386[_0x961c('0x42')][_0x961c('0x45')]));_0x5b7812[_0x961c('0x46')]=_0x5b7812[_0x961c('0x46')][_0x961c('0x47')]?_0x5b7812['attributes']:_0x11fe6e[_0x961c('0x41')];if(!_0x2c1386[_0x961c('0x42')][_0x961c('0x48')](_0x961c('0x49'))){_0x5b7812[_0x961c('0x4a')]=qs[_0x961c('0x4a')](_0x2c1386['query'][_0x961c('0x4a')]);_0x5b7812['offset']=qs['offset'](_0x2c1386['query']['offset']);}_0x5b7812['order']=qs[_0x961c('0x4c')](_0x2c1386[_0x961c('0x42')][_0x961c('0x4c')]);_0x5b7812[_0x961c('0x4d')]=qs['filters'](_[_0x961c('0x4e')](_0x2c1386['query'],_0x11fe6e['filters']));_0x5b7812[_0x961c('0x4d')][_0x961c('0x65')]=_0xff26ed['id'];if(_0x2c1386[_0x961c('0x42')]['filter']){_0x5b7812['where']=_[_0x961c('0x50')](_0x5b7812[_0x961c('0x4d')],{'$or':_[_0x961c('0x3c')](_0x5b7812[_0x961c('0x46')],function(_0x181c03){var _0x3d563a={};_0x3d563a[_0x181c03]={'$like':'%'+_0x2c1386[_0x961c('0x42')][_0x961c('0x4f')]+'%'};return _0x3d563a;})});}_0x5b7812=_['merge']({},_0x5b7812,_0x2c1386[_0x961c('0x5a')]);return db[_0x961c('0x67')][_0x961c('0x52')]({'where':_0x5b7812[_0x961c('0x4d')]})[_0x961c('0x30')](function(_0x1b2fc9){_0x2d5dab['count']=_0x1b2fc9;if(_0x2c1386[_0x961c('0x42')][_0x961c('0x53')]){_0x5b7812[_0x961c('0x68')]=[{'all':!![]}];}return db[_0x961c('0x67')][_0x961c('0x69')](_0x5b7812);})[_0x961c('0x30')](function(_0x260aeb){_0x2d5dab[_0x961c('0x54')]=_0x260aeb;return _0x2d5dab;});}})[_0x961c('0x30')](respondWithFilteredResult(_0x513c8b,_0x5b7812))[_0x961c('0x55')](handleError(_0x513c8b,null));};exports['removeDispositions']=function(_0x85ba5,_0x2369a1,_0x5608c2){return db['SmsAccount']['find']({'where':{'id':_0x85ba5[_0x961c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2369a1,null))[_0x961c('0x30')](function(_0x39bafd){if(_0x39bafd){return _0x39bafd[_0x961c('0x6a')](_0x85ba5[_0x961c('0x42')][_0x961c('0x6b')]);}})[_0x961c('0x30')](respondWithStatusCode(_0x2369a1,null))[_0x961c('0x55')](handleError(_0x2369a1,null));};exports[_0x961c('0x6c')]=function(_0x30ea1d,_0x115d9b,_0x9ef047){if(_0x30ea1d[_0x961c('0x5d')]['id']){delete _0x30ea1d[_0x961c('0x5d')]['id'];}return db[_0x961c('0x3d')][_0x961c('0x5b')]({'where':{'id':_0x30ea1d[_0x961c('0x57')]['id']}})['then'](handleEntityNotFound(_0x115d9b,null))['then'](function(_0x356ff2){if(_0x356ff2){_0x30ea1d['body'][_0x961c('0x65')]=_0x356ff2['id'];return db[_0x961c('0x6d')][_0x961c('0x5c')](_0x30ea1d[_0x961c('0x5d')]);}})[_0x961c('0x30')](respondWithResult(_0x115d9b,null))[_0x961c('0x55')](handleError(_0x115d9b,null));};exports[_0x961c('0x6e')]=function(_0x29e4cd,_0x4434b1,_0x29b38e){var _0x5b1fa0={'raw':![],'where':{}};var _0x44efeb={};var _0x5ac748={'count':0x0,'rows':[]};return db[_0x961c('0x3d')][_0x961c('0x66')]({'where':{'id':_0x29e4cd['params']['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x4434b1,null))['then'](function(_0x317c79){if(_0x317c79){_0x44efeb[_0x961c('0x41')]=_[_0x961c('0x59')](db[_0x961c('0x6d')][_0x961c('0x3e')]);_0x44efeb[_0x961c('0x42')]=_[_0x961c('0x59')](_0x29e4cd['query']);_0x44efeb[_0x961c('0x43')]=_['intersection'](_0x44efeb[_0x961c('0x41')],_0x44efeb[_0x961c('0x42')]);_0x5b1fa0[_0x961c('0x46')]=_[_0x961c('0x44')](_0x44efeb[_0x961c('0x41')],qs[_0x961c('0x45')](_0x29e4cd['query'][_0x961c('0x45')]));_0x5b1fa0['attributes']=_0x5b1fa0[_0x961c('0x46')]['length']?_0x5b1fa0[_0x961c('0x46')]:_0x44efeb[_0x961c('0x41')];if(!_0x29e4cd[_0x961c('0x42')][_0x961c('0x48')]('nolimit')){_0x5b1fa0[_0x961c('0x4a')]=qs[_0x961c('0x4a')](_0x29e4cd[_0x961c('0x42')]['limit']);_0x5b1fa0['offset']=qs[_0x961c('0x2a')](_0x29e4cd[_0x961c('0x42')][_0x961c('0x2a')]);}_0x5b1fa0[_0x961c('0x4b')]=qs[_0x961c('0x4c')](_0x29e4cd[_0x961c('0x42')][_0x961c('0x4c')]);_0x5b1fa0[_0x961c('0x4d')]=qs[_0x961c('0x43')](_['pick'](_0x29e4cd[_0x961c('0x42')],_0x44efeb['filters']));_0x5b1fa0[_0x961c('0x4d')][_0x961c('0x65')]=_0x317c79['id'];if(_0x29e4cd[_0x961c('0x42')][_0x961c('0x4f')]){_0x5b1fa0[_0x961c('0x4d')]=_['merge'](_0x5b1fa0[_0x961c('0x4d')],{'$or':_[_0x961c('0x3c')](_0x5b1fa0[_0x961c('0x46')],function(_0x436b03){var _0x19446c={};_0x19446c[_0x436b03]={'$like':'%'+_0x29e4cd[_0x961c('0x42')][_0x961c('0x4f')]+'%'};return _0x19446c;})});}_0x5b1fa0=_['merge']({},_0x5b1fa0,_0x29e4cd[_0x961c('0x5a')]);return db['CannedAnswer']['count']({'where':_0x5b1fa0[_0x961c('0x4d')]})[_0x961c('0x30')](function(_0x4cfcd3){_0x5ac748[_0x961c('0x52')]=_0x4cfcd3;if(_0x29e4cd[_0x961c('0x42')][_0x961c('0x53')]){_0x5b1fa0[_0x961c('0x68')]=[{'all':!![]}];}return db[_0x961c('0x6d')][_0x961c('0x69')](_0x5b1fa0);})[_0x961c('0x30')](function(_0x180c00){_0x5ac748['rows']=_0x180c00;return _0x5ac748;});}})[_0x961c('0x30')](respondWithFilteredResult(_0x4434b1,_0x5b1fa0))[_0x961c('0x55')](handleError(_0x4434b1,null));};exports[_0x961c('0x6f')]=function(_0x2b363d,_0x4875c9,_0x5879c7){return db[_0x961c('0x3d')][_0x961c('0x5b')]({'where':{'id':_0x2b363d['params']['id']}})['then'](handleEntityNotFound(_0x4875c9,null))[_0x961c('0x30')](function(_0x1873a9){if(_0x1873a9){return _0x1873a9[_0x961c('0x6f')](_0x2b363d[_0x961c('0x42')][_0x961c('0x6b')]);}})[_0x961c('0x30')](respondWithStatusCode(_0x4875c9,null))[_0x961c('0x55')](handleError(_0x4875c9,null));};exports[_0x961c('0x70')]=function(_0x43b3af,_0x3f80c5,_0xc18d49){var _0x2a71b2={'channel':_0x961c('0x71')};var _0x246cd5=[];var _0x51481b=[];var _0x18a00f={};return db[_0x961c('0x3d')]['find']({'where':{'id':_0x43b3af[_0x961c('0x57')]['id']},'include':[{'model':db[_0x961c('0x72')],'as':_0x961c('0x73')}]})['then'](handleEntityNotFound(_0x3f80c5,null))['then'](function(_0x3f96ba){_0x2a71b2['account']=_0x3f96ba;_0x2a71b2[_0x961c('0x74')]=_['orderBy'](_0x3f96ba[_0x961c('0x73')],[_0x961c('0x75')],[_0x961c('0x76')]);if(_0x2a71b2['account'][_0x961c('0x73')]){delete _0x2a71b2[_0x961c('0x77')][_0x961c('0x73')];}return db[_0x961c('0x78')][_0x961c('0x63')]();})[_0x961c('0x30')](function(_0x66ae39){if(!_0x66ae39){throw new db[(_0x961c('0x79'))][(_0x961c('0x7a'))](_0x961c('0x7b'));}_0x246cd5=_[_0x961c('0x7c')](_['keys'](_0x66ae39),[_0x961c('0x7d'),_0x961c('0x7e')]);_0x51481b=_[_0x961c('0x7c')](_['keys'](_0x66ae39),[_0x961c('0x7d'),_0x961c('0x7e'),_0x961c('0x7f'),_0x961c('0x80')]);_0x2a71b2['body']={'mapKey':_0x961c('0x81')};if(_0x2a71b2['account'][_0x961c('0x3f')]){switch(_0x2a71b2[_0x961c('0x77')][_0x961c('0x3f')]){case'twilio':_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x83')];_0x2a71b2['body'][_0x961c('0x5d')]=_0x43b3af['body'][_0x961c('0x84')];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x85')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x86')];break;case'skebby':_0x2a71b2['body'][_0x961c('0x82')]='+'+_0x43b3af[_0x961c('0x5d')][_0x961c('0x87')];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x5d')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x88')];break;case _0x961c('0x89'):_0x2a71b2[_0x961c('0x5d')]['from']=_0x43b3af[_0x961c('0x5d')][_0x961c('0x82')];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x5d')]=_0x43b3af[_0x961c('0x5d')]['message'];break;case'clicksend':_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')]=_0x43b3af['body'][_0x961c('0x82')];_0x2a71b2[_0x961c('0x5d')]['body']=_0x43b3af[_0x961c('0x5d')][_0x961c('0x5d')];_0x2a71b2[_0x961c('0x5d')]['messageId']=_0x43b3af[_0x961c('0x5d')][_0x961c('0x8a')];break;case _0x961c('0x8b'):_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x83')];_0x2a71b2[_0x961c('0x5d')]['body']=_0x43b3af[_0x961c('0x5d')][_0x961c('0x8c')];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x85')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x8d')];break;case _0x961c('0x8e'):_0x2a71b2[_0x961c('0x5d')]['from']='+'+_0x43b3af[_0x961c('0x5d')][_0x961c('0x8f')][0x0][_0x961c('0x82')];_0x2a71b2['body'][_0x961c('0x5d')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x8f')][0x0]['text'];_0x2a71b2['body'][_0x961c('0x85')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x8f')][0x0][_0x961c('0x85')];break;case _0x961c('0x90'):_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')]=_0x43b3af[_0x961c('0x5d')]['originatingAddress'];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x5d')]=_0x43b3af['body'][_0x961c('0x91')]['message'];break;case _0x961c('0x92'):_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x93')];_0x2a71b2[_0x961c('0x5d')]['body']=_0x43b3af[_0x961c('0x5d')][_0x961c('0x88')];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x85')]=_0x43b3af[_0x961c('0x5d')]['replyMessageId'];break;case _0x961c('0x94'):_0x2a71b2[_0x961c('0x5d')]['messageId']=_0x43b3af[_0x961c('0x5d')][0x0][_0x961c('0x26')]['id'];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')]=_0x43b3af['body'][0x0][_0x961c('0x26')][_0x961c('0x82')];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x5d')]=_0x43b3af[_0x961c('0x5d')][0x0][_0x961c('0x26')][_0x961c('0x88')];break;case _0x961c('0x95'):_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x82')];_0x2a71b2[_0x961c('0x5d')][_0x961c('0x5d')]=_0x43b3af[_0x961c('0x5d')][_0x961c('0x26')];_0x2a71b2[_0x961c('0x5d')]['messageId']=_0x43b3af[_0x961c('0x5d')][_0x961c('0x96')];break;}}if(_0x2a71b2['body']['id']){delete _0x2a71b2[_0x961c('0x5d')]['id'];}if(_[_0x961c('0x97')](_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')])){throw new db[(_0x961c('0x79'))][(_0x961c('0x7a'))](_0x961c('0x98'));}if(_['isNil'](_0x2a71b2['body'][_0x961c('0x5d')])||_0x2a71b2[_0x961c('0x5d')]['body']===''){throw new db['Sequelize'][(_0x961c('0x7a'))](_0x961c('0x99'));}if(_[_0x961c('0x97')](_0x2a71b2[_0x961c('0x5d')][_0x961c('0x9a')])){throw new db['Sequelize'][(_0x961c('0x7a'))](_0x961c('0x9b')+_0x51481b);}if(!_[_0x961c('0x9c')](_0x51481b,_0x2a71b2[_0x961c('0x5d')][_0x961c('0x9a')])){throw new db[(_0x961c('0x79'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x51481b);}_0x18a00f[_0x2a71b2[_0x961c('0x5d')]['mapKey']]=_0x2a71b2['body']['from'];return db[_0x961c('0x9d')][_0x961c('0x5b')]({'where':{'id':_0x2a71b2[_0x961c('0x77')][_0x961c('0x80')]},'include':[{'model':db[_0x961c('0x78')],'as':'Contacts','where':_0x18a00f,'limit':0x1,'order':[[_0x961c('0x7e'),_0x961c('0x9e')]]}]});})[_0x961c('0x30')](handleEntityNotFound(_0x3f80c5,null))[_0x961c('0x30')](function(_0xe5d035){if(_0xe5d035){_0x2a71b2['list']=_[_0x961c('0x9f')](_0xe5d035,[_0x961c('0xa0')]);if(_0xe5d035[_0x961c('0xa0')][_0x961c('0x47')]){return _0xe5d035['Contacts'][0x0];}var _0x4074f4=_[_0x961c('0x18')](_0x2a71b2[_0x961c('0x5d')],{'firstName':_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')],'ListId':_0xe5d035['id']});_0x4074f4[_0x2a71b2[_0x961c('0x5d')]['mapKey']]=_0x2a71b2['body']['from'];return db[_0x961c('0x78')][_0x961c('0x5c')](_0x4074f4,{'fields':_0x246cd5,'raw':!![]});}})['then'](handleEntityNotFound(_0x3f80c5,null))[_0x961c('0x30')](function(_0x278b69){if(_0x278b69){_0x2a71b2[_0x961c('0xa1')]=_0x278b69;var _0x1fc323={'ContactId':_0x278b69['id'],'phone':_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')],'SmsAccountId':_0x43b3af[_0x961c('0x57')]['id']};var _0x2dcbc4={'ContactId':_0x278b69['id'],'SmsAccountId':_0x43b3af[_0x961c('0x57')]['id'],'closed':![]};return db[_0x961c('0xa2')][_0x961c('0x5b')]({'where':_0x2dcbc4})[_0x961c('0x30')](function(_0x107529){if(_0x107529){return[_0x107529,![]];}return db[_0x961c('0xa2')][_0x961c('0x5c')](_0x1fc323)[_0x961c('0x30')](function(_0x48163c){return[_0x48163c,!![]];});});}})[_0x961c('0xa3')](function(_0x102390,_0xc430ab){_0x2a71b2['interaction']=_0x102390[_0x961c('0x32')]({'plain':!![]});_0x2a71b2[_0x961c('0xa4')][_0x961c('0xa5')]=![];if(_0xc430ab){if(_0x2a71b2['account']['autoclose']){_0x2a71b2['applications'][_0x961c('0xa6')]({'id':0x0,'priority':_0x2a71b2['applications']['length']+0x1,'app':_0x961c('0xa7'),'appdata':_0x961c('0xa8'),'interval':_0x961c('0xa9')});}_0x2a71b2[_0x961c('0xa4')][_0x961c('0xa5')]=!![];}return db['SmsMessage']['create']({'phone':_0x2a71b2[_0x961c('0x5d')][_0x961c('0x82')],'messageId':_0x2a71b2['body'][_0x961c('0x85')],'body':_0x2a71b2['body'][_0x961c('0x5d')],'SmsAccountId':_0x43b3af[_0x961c('0x57')]['id'],'SmsInteractionId':_0x102390['id'],'direction':'in','ContactId':_0x102390[_0x961c('0xaa')],'AttachmentId':_0x2a71b2[_0x961c('0x5d')][_0x961c('0xab')]});})[_0x961c('0x30')](function(_0x20e376){_0x2a71b2[_0x961c('0x26')]=_0x20e376;if(_0x2a71b2[_0x961c('0xa4')][_0x961c('0xac')]){return db[_0x961c('0xad')][_0x961c('0x5b')]({'attributes':['id','name'],'where':{'id':_0x2a71b2[_0x961c('0xa4')][_0x961c('0xac')]}})[_0x961c('0x30')](function(_0x28a89d){if(_0x28a89d){_0x2a71b2[_0x961c('0x74')][_0x961c('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x28a89d[_0x961c('0x38')]+','+(_0x2a71b2[_0x961c('0x77')][_0x961c('0xaf')]||0xa),'interval':_0x961c('0xa9')});}return respondWithRpcPromise(_0x961c('0xb0'),'startRouting',_0x2a71b2);});}return respondWithRpcPromise('Start',_0x961c('0xb1'),_0x2a71b2);})['then'](function(_0x9778a9){if(_0x9778a9){var _0x26b60c=0xc8;var _0x3280b5=_0x961c('0xb2');logger[_0x961c('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3280b5,_0x26b60c,_0x961c('0xb3'));logger[_0x961c('0x23')](_0x961c('0xb4'),_0x3280b5,_0x26b60c,_0x961c('0xb3'),JSON['stringify'](_0x9778a9));if(_0x2a71b2[_0x961c('0x77')][_0x961c('0x3f')]===_0x961c('0xb5')){return _0x3f80c5[_0x961c('0x28')](_0x26b60c)['set'](_0x961c('0xb6'),_0x961c('0xb7'))['send']('\x0a');}else{return _0x3f80c5['status'](_0x26b60c)[_0x961c('0x29')](_0x9778a9);}}})[_0x961c('0x55')](handleError(_0x3f80c5,null));};exports[_0x961c('0xb8')]=function(_0xeedae1,_0x858006){var _0x316db4=_0xeedae1[_0x961c('0x57')]['id'];var _0x1ba668=_0xeedae1[_0x961c('0x5d')];var _0x419351=0xc8;var _0x5204ac=null;return db[_0x961c('0xb9')][_0x961c('0xba')]({'isolationLevel':db[_0x961c('0xb9')][_0x961c('0xbb')][_0x961c('0xbc')][_0x961c('0xbd')]},function(_0x37584d){return db[_0x961c('0x3d')][_0x961c('0x66')]({'where':{'id':_0x316db4},'transaction':_0x37584d})[_0x961c('0x30')](function(_0x1b93f0){if(_0x1b93f0){return db[_0x961c('0x72')][_0x961c('0x31')]({'where':{'SmsAccountId':_0x316db4},'transaction':_0x37584d})['then'](function(){var _0x4cb230=_['map'](_0x1ba668,function(_0x2b7c56){_0x2b7c56[_0x961c('0x65')]=_0x316db4;return _0x2b7c56;});return db[_0x961c('0x72')][_0x961c('0xbe')](_0x4cb230,{'transaction':_0x37584d});});}else{_0x419351=0x194;_0x5204ac=[];}});})[_0x961c('0x30')](function(){if(_0x419351!==0x194){return db[_0x961c('0x72')][_0x961c('0xbf')]({'where':{'SmsAccountId':_0x316db4},'order':'priority'})[_0x961c('0x30')](function(_0x406401){_0x5204ac=_0x406401;});}})['catch'](function(_0x16e2d8){_0x419351=0x1f4;logger[_0x961c('0x25')](_0x16e2d8[_0x961c('0x37')]);if(_0x16e2d8[_0x961c('0x38')]){delete _0x16e2d8[_0x961c('0x38')];}_0x5204ac=_0x16e2d8;})['finally'](function(){if(_0x5204ac===null){_0x858006[_0x961c('0x36')](_0x419351);}else{if(_0x419351===0x1f4){_0x858006[_0x961c('0x28')](_0x419351)[_0x961c('0x39')](_0x5204ac);}else{_0x858006[_0x961c('0x28')](_0x419351)[_0x961c('0x29')](_0x5204ac);}}});};exports[_0x961c('0xc0')]=function(_0x17193a,_0x1540db,_0x1ad698){var _0x5a0e15={};var _0x5a4d2b={};var _0x271127;var _0x372267;return db['SmsAccount'][_0x961c('0x66')]({'where':{'id':_0x17193a[_0x961c('0x57')]['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x1540db,null))[_0x961c('0x30')](function(_0xfd48e6){if(_0xfd48e6){_0x271127=_0xfd48e6;_0x5a4d2b[_0x961c('0x41')]=_[_0x961c('0x59')](db[_0x961c('0x72')][_0x961c('0x3e')]);_0x5a4d2b[_0x961c('0x42')]=_[_0x961c('0x59')](_0x17193a[_0x961c('0x42')]);_0x5a4d2b[_0x961c('0x43')]=_['intersection'](_0x5a4d2b[_0x961c('0x41')],_0x5a4d2b['query']);_0x5a0e15[_0x961c('0x46')]=_[_0x961c('0x44')](_0x5a4d2b[_0x961c('0x41')],qs['fields'](_0x17193a[_0x961c('0x42')][_0x961c('0x45')]));_0x5a0e15[_0x961c('0x46')]=_0x5a0e15[_0x961c('0x46')][_0x961c('0x47')]?_0x5a0e15['attributes']:_0x5a4d2b[_0x961c('0x41')];_0x5a0e15[_0x961c('0x4b')]=qs['sort'](_0x17193a[_0x961c('0x42')][_0x961c('0x4c')]);_0x5a0e15[_0x961c('0x4d')]=qs[_0x961c('0x43')](_[_0x961c('0x4e')](_0x17193a[_0x961c('0x42')],_0x5a4d2b['filters']));if(_0x17193a[_0x961c('0x42')][_0x961c('0x4f')]){_0x5a0e15[_0x961c('0x4d')]=_['merge'](_0x5a0e15['where'],{'$or':_[_0x961c('0x3c')](_0x5a0e15['attributes'],function(_0x4e221f){var _0x905b2b={};_0x905b2b[_0x4e221f]={'$like':'%'+_0x17193a[_0x961c('0x42')][_0x961c('0x4f')]+'%'};return _0x905b2b;})});}_0x5a0e15=_[_0x961c('0x50')]({},_0x5a0e15,_0x17193a[_0x961c('0x5a')]);return _0x271127[_0x961c('0xc0')](_0x5a0e15);}})[_0x961c('0x30')](function(_0x8abc72){if(_0x8abc72){_0x372267=_0x8abc72[_0x961c('0x47')];if(!_0x17193a[_0x961c('0x42')][_0x961c('0x48')](_0x961c('0x49'))){_0x5a0e15[_0x961c('0x4a')]=qs[_0x961c('0x4a')](_0x17193a[_0x961c('0x42')]['limit']);_0x5a0e15['offset']=qs[_0x961c('0x2a')](_0x17193a[_0x961c('0x42')]['offset']);}return _0x271127['getApplications'](_0x5a0e15);}})['then'](function(_0x559f95){if(_0x559f95){return _0x559f95?{'count':_0x372267,'rows':_0x559f95}:null;}})[_0x961c('0x30')](respondWithResult(_0x1540db,null))[_0x961c('0x55')](handleError(_0x1540db,null));};exports['getInteractions']=function(_0x5b7b85,_0x10f7c6,_0x5290ea){var _0x4a8f41={'raw':![],'where':{}};var _0x112514={};var _0x1ad291={'count':0x0,'rows':[]};return db[_0x961c('0x3d')][_0x961c('0x66')]({'where':{'id':_0x5b7b85[_0x961c('0x57')]['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x10f7c6,null))[_0x961c('0x30')](function(_0x1aa17e){if(_0x1aa17e){_0x112514[_0x961c('0x41')]=_[_0x961c('0x59')](db[_0x961c('0xa2')]['rawAttributes']);_0x112514['query']=_[_0x961c('0x59')](_0x5b7b85[_0x961c('0x42')]);_0x112514[_0x961c('0x43')]=_[_0x961c('0x44')](_0x112514[_0x961c('0x41')],_0x112514[_0x961c('0x42')]);_0x4a8f41[_0x961c('0x46')]=_['intersection'](_0x112514[_0x961c('0x41')],qs['fields'](_0x5b7b85[_0x961c('0x42')]['fields']));_0x4a8f41[_0x961c('0x46')]=_0x4a8f41['attributes'][_0x961c('0x47')]?_0x4a8f41[_0x961c('0x46')]:_0x112514[_0x961c('0x41')];if(!_0x5b7b85[_0x961c('0x42')][_0x961c('0x48')](_0x961c('0x49'))){_0x4a8f41[_0x961c('0x4a')]=qs['limit'](_0x5b7b85[_0x961c('0x42')][_0x961c('0x4a')]);_0x4a8f41[_0x961c('0x2a')]=qs[_0x961c('0x2a')](_0x5b7b85[_0x961c('0x42')][_0x961c('0x2a')]);}_0x4a8f41[_0x961c('0x4b')]=qs['sort'](_0x5b7b85['query'][_0x961c('0x4c')]);_0x4a8f41[_0x961c('0x4d')]=qs[_0x961c('0x43')](_['pick'](_0x5b7b85['query'],_0x112514[_0x961c('0x43')]));_0x4a8f41[_0x961c('0x4d')][_0x961c('0x65')]=_0x1aa17e['id'];if(_0x5b7b85[_0x961c('0x42')][_0x961c('0x4f')]){_0x4a8f41[_0x961c('0x4d')]=_[_0x961c('0x50')](_0x4a8f41[_0x961c('0x4d')],{'$or':_[_0x961c('0x3c')](_0x4a8f41[_0x961c('0x46')],function(_0x5a0f81){var _0xbbe9f7={};_0xbbe9f7[_0x5a0f81]={'$like':'%'+_0x5b7b85[_0x961c('0x42')][_0x961c('0x4f')]+'%'};return _0xbbe9f7;})});}_0x4a8f41=_[_0x961c('0x50')]({},_0x4a8f41,_0x5b7b85[_0x961c('0x5a')]);return db[_0x961c('0xa2')][_0x961c('0x52')]({'where':_0x4a8f41[_0x961c('0x4d')]})[_0x961c('0x30')](function(_0x7e996){_0x1ad291['count']=_0x7e996;if(_0x5b7b85[_0x961c('0x42')]['includeAll']){_0x4a8f41[_0x961c('0x68')]=[{'model':db[_0x961c('0x78')],'as':_0x961c('0xc1'),'required':![]},{'model':db[_0x961c('0xad')],'as':'Owner','attributes':[_0x961c('0x38'),'fullname',_0x961c('0xc2')],'required':![]},{'model':db[_0x961c('0xc3')],'as':_0x961c('0xc4'),'attributes':['id',_0x961c('0x38'),_0x961c('0xc5')],'where':_0x5b7b85['query'][_0x961c('0xc6')]?{'id':_0x5b7b85[_0x961c('0x42')][_0x961c('0xc6')]}:undefined,'required':_0x5b7b85[_0x961c('0x42')][_0x961c('0xc6')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x4a8f41);})[_0x961c('0x30')](function(_0xbff488){_0x1ad291[_0x961c('0x54')]=_0xbff488;return _0x1ad291;});}})[_0x961c('0x30')](respondWithFilteredResult(_0x10f7c6,_0x4a8f41))[_0x961c('0x55')](handleError(_0x10f7c6,null));};exports[_0x961c('0x39')]=function(_0x53b44c,_0x4570e1,_0x39830f){var _0x1d3f47,_0x488d2b,_0x596e9d;if(_[_0x961c('0x97')](_0x53b44c[_0x961c('0x5d')][_0x961c('0x5d')])||_0x53b44c[_0x961c('0x5d')]['body']===''){throw new db[(_0x961c('0x79'))][(_0x961c('0x7a'))](_0x961c('0x99'));}if(_['isNil'](_0x53b44c[_0x961c('0x5d')]['to'])){throw new db[(_0x961c('0x79'))][(_0x961c('0x7a'))]('to\x20is\x20mandatory');}_0x1d3f47=_0x53b44c[_0x961c('0x5d')]['to'];return db['SmsAccount'][_0x961c('0x5b')]({'where':{'id':_0x53b44c[_0x961c('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x961c('0x78')],'as':_0x961c('0xa0'),'where':{'mobile':_0x1d3f47},'limit':0x1,'order':[[_0x961c('0x7e'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x4570e1,null))[_0x961c('0x30')](function(_0x5d1000){if(_0x5d1000&&_0x5d1000[_0x961c('0xc7')]){_0x488d2b=_0x5d1000[_0x961c('0x32')]({'plain':!![]});if(_0x488d2b[_0x961c('0xc7')]&&_0x488d2b[_0x961c('0xc7')][_0x961c('0xa0')][_0x961c('0x47')]){return _0x488d2b[_0x961c('0xc7')][_0x961c('0xa0')][0x0];}return db['CmContact'][_0x961c('0x5c')](_[_0x961c('0x18')](_0x53b44c[_0x961c('0x5d')],{'firstName':_0x1d3f47,'mobile':_0x1d3f47,'phone':_0x1d3f47,'ListId':_0x488d2b[_0x961c('0x80')]}));}})[_0x961c('0x30')](handleEntityNotFound(_0x4570e1,null))[_0x961c('0x30')](function(_0x45315e){if(_0x45315e){_0x596e9d=_0x45315e;return db[_0x961c('0xa2')][_0x961c('0x5b')]({'where':{'ContactId':_0x596e9d['id'],'closed':![],'SmsAccountId':_0x488d2b['id']}})[_0x961c('0x30')](function(_0x46c5d5){if(_0x46c5d5){return[_0x46c5d5,![]];}return db[_0x961c('0xa2')][_0x961c('0x5c')]({'UserId':_0x53b44c[_0x961c('0x5e')]['id'],'ContactId':_0x596e9d['id'],'SmsAccountId':_0x488d2b['id'],'phone':_0x1d3f47,'firstMsgDirection':_0x961c('0xc8'),'Messages':[_[_0x961c('0x50')](_0x53b44c[_0x961c('0x5d')],{'read':![],'body':_0x53b44c[_0x961c('0x5d')][_0x961c('0x5d')],'phone':_0x1d3f47,'SmsAccountId':_0x488d2b['id'],'UserId':_0x53b44c['user']['id'],'ContactId':_0x596e9d['id']})]},{'include':[{'model':db[_0x961c('0xc9')],'as':_0x961c('0xca')}]})[_0x961c('0x30')](function(_0x3e3a12){return[_0x3e3a12,!![]];});});}})[_0x961c('0xa3')](function(_0x45e719,_0x2a66ec){if(_0x2a66ec){return _0x45e719;}return db[_0x961c('0xc9')][_0x961c('0x5c')](_['merge'](_0x53b44c['body'],{'read':![],'body':_0x53b44c['body'][_0x961c('0x5d')],'phone':_0x1d3f47,'SmsAccountId':_0x488d2b['id'],'SmsInteractionId':_0x45e719['id'],'UserId':_0x53b44c[_0x961c('0x5e')]['id'],'ContactId':_0x596e9d['id']}))[_0x961c('0x30')](function(_0x55a5dd){_0x45e719[_0x961c('0xcb')]['Messages']=[];_0x45e719['dataValues']['Messages']['push'](_0x55a5dd[_0x961c('0xcb')]);return _0x45e719;});})[_0x961c('0x30')](respondWithResult(_0x4570e1,null))[_0x961c('0x55')](handleError(_0x4570e1,null));};exports['status']=function(_0x1d11bc,_0x32acde,_0x3e1210){if(_0x1d11bc[_0x961c('0x5d')]['id']){delete _0x1d11bc[_0x961c('0x5d')]['id'];}var _0x1be383,_0x5773e3,_0x30d030;return db[_0x961c('0x3d')][_0x961c('0x5b')]({'where':{'id':_0x1d11bc[_0x961c('0x57')]['id']}})['then'](handleEntityNotFound(_0x32acde,null))[_0x961c('0x30')](function(_0x44acf2){if(_0x44acf2){_0x30d030=_0x44acf2;logger[_0x961c('0x23')](_0x961c('0xcc'),_0x961c('0x28'),_0x961c('0xcd'),_0x44acf2['type'],util[_0x961c('0xce')](_0x1d11bc[_0x961c('0x5d')],{'showHidden':![],'depth':null}));switch(_0x44acf2[_0x961c('0x3f')]){case _0x961c('0xcf'):if(_0x1d11bc[_0x961c('0x5d')][_0x961c('0xd0')]&&_0x1d11bc[_0x961c('0x5d')][_0x961c('0x28')]){_0x5773e3=_0x1d11bc['body']['status'];return db[_0x961c('0xc9')]['find']({'where':{'messageId':_0x1d11bc['body'][_0x961c('0xd0')]}});}break;case _0x961c('0x89'):if(_0x1d11bc[_0x961c('0x5d')][_0x961c('0xd1')]&&_0x1d11bc[_0x961c('0x5d')]['statusInt']){_0x5773e3=_0x1d11bc['body']['statusInt'];return db[_0x961c('0xc9')][_0x961c('0x5b')]({'where':{'messageId':_0x1d11bc['body']['requestid']}});}break;case'clicksend':if(_0x1d11bc[_0x961c('0x5d')]['message_id']&&_0x1d11bc[_0x961c('0x5d')][_0x961c('0xd2')]){_0x5773e3=_0x1d11bc[_0x961c('0x5d')]['status_code'];return db[_0x961c('0xc9')][_0x961c('0x5b')]({'where':{'messageId':_0x1d11bc[_0x961c('0x5d')]['message_id']}});}break;case _0x961c('0x8e'):var _0x1ded7c=_0x1d11bc['body']['results'][0x0];if(_0x1ded7c['messageId']&&_0x1ded7c[_0x961c('0x28')][_0x961c('0xd3')]===_0x961c('0xd4')){_0x5773e3=_0x1ded7c[_0x961c('0x28')][_0x961c('0xd3')];return db[_0x961c('0xc9')][_0x961c('0x5b')]({'where':{'messageId':_0x1ded7c[_0x961c('0x85')]}});}break;case'clickatell':if(_0x1d11bc[_0x961c('0x5d')][_0x961c('0x85')]&&_0x1d11bc[_0x961c('0x5d')][_0x961c('0x28')]){_0x5773e3=_0x1d11bc['body'][_0x961c('0x28')];return db['SmsMessage'][_0x961c('0x5b')]({'where':{'messageId':_0x1d11bc['body']['messageId']}});}break;case _0x961c('0x94'):if(_0x1d11bc['body'][0x0][_0x961c('0x26')]['id']){_0x5773e3=_0x1d11bc[_0x961c('0x5d')][0x0]['type'];return db[_0x961c('0xc9')][_0x961c('0x5b')]({'where':{'messageId':_0x1d11bc[_0x961c('0x5d')][0x0][_0x961c('0x26')]['id']}});}break;case _0x961c('0x95'):if(_0x1d11bc['body'][_0x961c('0xd5')]&&_0x1d11bc[_0x961c('0x5d')]['status']){_0x5773e3=_0x1d11bc[_0x961c('0x5d')]['status'];return db[_0x961c('0xc9')][_0x961c('0x5b')]({'where':{'messageId':_0x1d11bc[_0x961c('0x5d')][_0x961c('0xd5')]}});}break;}}})[_0x961c('0x30')](handleEntityNotFound(_0x32acde,null))['then'](function(_0x56fcd0){if(_0x56fcd0){_0x1be383=_0x56fcd0;switch(_0x30d030['type']){case _0x961c('0xcf'):if(_0x5773e3===_0x961c('0xd4')){return _0x1be383['update']({'read':!![]});}else{logger[_0x961c('0x25')](_0x961c('0xcc'),'status',_0x961c('0xcf'),util[_0x961c('0xce')](_0x1d11bc['body'],{'showHidden':![],'depth':null}));}break;case _0x961c('0x89'):if(_0x5773e3==='1'){return _0x1be383[_0x961c('0x2f')]({'read':!![]});}else{logger['error'](_0x961c('0xcc'),_0x961c('0x28'),_0x961c('0xcf'),util[_0x961c('0xce')](_0x1d11bc[_0x961c('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1d11bc[_0x961c('0x5d')][_0x961c('0xd6')]&&_0x5773e3>=0xc8&&_0x5773e3<=0xce){return _0x1be383['update']({'read':!![]});}else{logger[_0x961c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x961c('0x28'),'clicksend',util['inspect'](_0x1d11bc[_0x961c('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x961c('0x8e'):var _0x27d5ec=_0x1d11bc[_0x961c('0x5d')][_0x961c('0x8f')][0x0];if(_0x27d5ec[_0x961c('0x28')][_0x961c('0xd3')]===_0x961c('0xd4')){return _0x1be383[_0x961c('0x2f')]({'read':!![]});}else{logger[_0x961c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x961c('0x28'),_0x961c('0x8e'),util[_0x961c('0xce')](_0x1d11bc[_0x961c('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x961c('0x92'):if(_0x5773e3=='DELIVERED_TO_GATEWAY'||_0x5773e3==_0x961c('0xd7')){return _0x1be383[_0x961c('0x2f')]({'read':!![]});}else{logger[_0x961c('0x25')](_0x961c('0xcc'),_0x961c('0x28'),_0x961c('0x92'),util[_0x961c('0xce')](_0x1d11bc[_0x961c('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x961c('0x94'):if(_0x5773e3==_0x961c('0xd8')){return _0x1be383[_0x961c('0x2f')]({'read':!![]});}else{logger[_0x961c('0x25')](_0x961c('0xcc'),_0x961c('0x28'),_0x961c('0x94'),util[_0x961c('0xce')](_0x1d11bc[_0x961c('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x961c('0x95'):if(_0x5773e3==='DELIVRD'||_0x5773e3===_0x961c('0xd9')){return _0x1be383[_0x961c('0x2f')]({'read':!![]});}else{logger['error'](_0x961c('0xcc'),_0x961c('0x28'),_0x961c('0x95'),util['inspect'](_0x1d11bc[_0x961c('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x1be383;}})['then'](respondWithResult(_0x32acde,null))[_0x961c('0x55')](handleError(_0x32acde,null));};exports[_0x961c('0xda')]=function(_0x3e7089,_0xb3e5b0,_0x10afe5){var _0x55249d,_0x1b46a0,_0x5a3794;return db[_0x961c('0x3d')]['find']({'where':{'id':_0x3e7089['params']['id']}})[_0x961c('0x30')](handleEntityNotFound(_0xb3e5b0,null))[_0x961c('0x30')](function(_0x2c504c){if(_0x2c504c){_0x5a3794=_0x2c504c;logger['debug'](_0x961c('0xcc'),_0x961c('0x28'),_0x961c('0xcd'),_0x2c504c[_0x961c('0x3f')],util[_0x961c('0xce')](_0x3e7089[_0x961c('0x42')],{'showHidden':![],'depth':null}));switch(_0x2c504c[_0x961c('0x3f')]){case _0x961c('0x90'):if(_0x3e7089[_0x961c('0x42')][_0x961c('0xdb')]&&_0x3e7089[_0x961c('0x42')]['state']){_0x1b46a0=_0x3e7089[_0x961c('0x42')][_0x961c('0xdc')];return db[_0x961c('0xc9')][_0x961c('0x5b')]({'where':{'messageId':_0x3e7089['query'][_0x961c('0xdb')]}});}break;}}})[_0x961c('0x30')](handleEntityNotFound(_0xb3e5b0,null))[_0x961c('0x30')](function(_0x3a7ba8){if(_0x3a7ba8){_0x55249d=_0x3a7ba8;switch(_0x5a3794[_0x961c('0x3f')]){case _0x961c('0x90'):if(_0x1b46a0==='2'||_0x1b46a0==='6'){return _0x55249d['update']({'read':!![]});}else{logger[_0x961c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x961c('0x28'),_0x961c('0x90'),util[_0x961c('0xce')](_0x3e7089[_0x961c('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x55249d;}})[_0x961c('0x30')](respondWithResult(_0xb3e5b0,null))[_0x961c('0x55')](handleError(_0xb3e5b0,null));};exports[_0x961c('0xdd')]=function(_0x4bd18b,_0x548d50,_0x3c51d5){return db['SmsAccount'][_0x961c('0x5b')]({'where':{'id':_0x4bd18b['params']['id']}})['then'](handleEntityNotFound(_0x548d50,null))[_0x961c('0x30')](function(_0xb477cb){if(_0xb477cb){return _0xb477cb[_0x961c('0xdd')](_0x4bd18b[_0x961c('0x5d')]['ids'],_[_0x961c('0x9f')](_0x4bd18b[_0x961c('0x5d')],['ids','id'])||{})[_0x961c('0xa3')](function(_0x66b049){for(var _0x2129ad=0x0;_0x2129ad<_0x4bd18b[_0x961c('0x5d')]['ids'][_0x961c('0x47')];_0x2129ad+=0x1){socket['emit'](_0x961c('0xde'),{'UserId':Number(_0x4bd18b[_0x961c('0x5d')]['ids'][_0x2129ad]),'SmsAccountId':Number(_0x4bd18b[_0x961c('0x57')]['id'])});}return _0x66b049;});}})[_0x961c('0x30')](respondWithResult(_0x548d50,null))['catch'](handleError(_0x548d50,null));};exports['removeAgents']=function(_0x5941c6,_0x1eab60,_0x24c878){return db[_0x961c('0x3d')][_0x961c('0x5b')]({'where':{'id':_0x5941c6[_0x961c('0x57')]['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x1eab60,null))[_0x961c('0x30')](function(_0x423ce4){if(_0x423ce4){return _0x423ce4[_0x961c('0xdf')](_0x5941c6['query']['ids'])[_0x961c('0x30')](function(){if(_[_0x961c('0xe0')](_0x5941c6[_0x961c('0x42')]['ids'])){for(var _0xeae54=0x0;_0xeae54<_0x5941c6[_0x961c('0x42')][_0x961c('0x6b')][_0x961c('0x47')];_0xeae54+=0x1){socket[_0x961c('0xe1')](_0x961c('0xe2'),{'UserId':Number(_0x5941c6[_0x961c('0x42')][_0x961c('0x6b')][_0xeae54]),'SmsAccountId':Number(_0x5941c6[_0x961c('0x57')]['id'])});}}else{socket[_0x961c('0xe1')](_0x961c('0xe2'),{'UserId':Number(_0x5941c6[_0x961c('0x42')][_0x961c('0x6b')]),'SmsAccountId':Number(_0x5941c6[_0x961c('0x57')]['id'])});}});}})[_0x961c('0x30')](respondWithStatusCode(_0x1eab60,null))[_0x961c('0x55')](handleError(_0x1eab60,null));};exports[_0x961c('0xe3')]=function(_0x24bd33,_0x3b1b82,_0x54bb44){var _0x3ac010={};var _0x117ea0={};var _0x6cefc5;var _0x1f1e05;return db['SmsAccount'][_0x961c('0x66')]({'where':{'id':_0x24bd33['params']['id']}})[_0x961c('0x30')](handleEntityNotFound(_0x3b1b82,null))[_0x961c('0x30')](function(_0x120602){if(_0x120602){_0x6cefc5=_0x120602;_0x117ea0[_0x961c('0x41')]=_['keys'](db[_0x961c('0xad')][_0x961c('0x3e')]);_0x117ea0[_0x961c('0x42')]=_['keys'](_0x24bd33[_0x961c('0x42')]);_0x117ea0[_0x961c('0x43')]=_[_0x961c('0x44')](_0x117ea0[_0x961c('0x41')],_0x117ea0['query']);_0x3ac010['attributes']=_[_0x961c('0x44')](_0x117ea0[_0x961c('0x41')],qs[_0x961c('0x45')](_0x24bd33[_0x961c('0x42')][_0x961c('0x45')]));_0x3ac010[_0x961c('0x46')]=_0x3ac010['attributes'][_0x961c('0x47')]?_0x3ac010[_0x961c('0x46')]:_0x117ea0['model'];_0x3ac010[_0x961c('0x4b')]=qs[_0x961c('0x4c')](_0x24bd33[_0x961c('0x42')][_0x961c('0x4c')]);_0x3ac010['where']=qs[_0x961c('0x43')](_[_0x961c('0x4e')](_0x24bd33[_0x961c('0x42')],_0x117ea0[_0x961c('0x43')]));if(_0x24bd33[_0x961c('0x42')][_0x961c('0x4f')]){_0x3ac010[_0x961c('0x4d')]=_['merge'](_0x3ac010['where'],{'$or':_[_0x961c('0x3c')](_0x3ac010[_0x961c('0x46')],function(_0x1aa998){var _0x110d9e={};_0x110d9e[_0x1aa998]={'$like':'%'+_0x24bd33[_0x961c('0x42')]['filter']+'%'};return _0x110d9e;})});}_0x3ac010=_[_0x961c('0x50')]({},_0x3ac010,_0x24bd33[_0x961c('0x5a')]);return _0x6cefc5['getAgents'](_0x3ac010);}})[_0x961c('0x30')](function(_0x35d2d9){if(_0x35d2d9){_0x1f1e05=_0x35d2d9[_0x961c('0x47')];if(!_0x24bd33[_0x961c('0x42')]['hasOwnProperty'](_0x961c('0x49'))){_0x3ac010[_0x961c('0x4a')]=qs[_0x961c('0x4a')](_0x24bd33[_0x961c('0x42')][_0x961c('0x4a')]);_0x3ac010[_0x961c('0x2a')]=qs['offset'](_0x24bd33[_0x961c('0x42')][_0x961c('0x2a')]);}return _0x6cefc5[_0x961c('0xe3')](_0x3ac010);}})[_0x961c('0x30')](function(_0x462092){if(_0x462092){return _0x462092?{'count':_0x1f1e05,'rows':_0x462092}:null;}})[_0x961c('0x30')](respondWithResult(_0x3b1b82,null))[_0x961c('0x55')](handleError(_0x3b1b82,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 20a128d..e27ae6b 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 _0x4814=['remove','emit','hasOwnProperty','hook','events','SmsAccount','save'];(function(_0x3efdd8,_0x3728e3){var _0x395759=function(_0x4adae5){while(--_0x4adae5){_0x3efdd8['push'](_0x3efdd8['shift']());}};_0x395759(++_0x3728e3);}(_0x4814,0x74));var _0x4481=function(_0x29b3b8,_0x387185){_0x29b3b8=_0x29b3b8-0x0;var _0x3ee7a5=_0x4814[_0x29b3b8];return _0x3ee7a5;};'use strict';var EventEmitter=require(_0x4481('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x4481('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4481('0x2'),'afterUpdate':'update','afterDestroy':_0x4481('0x3')};function emitEvent(_0x56728d){return function(_0x5c6201,_0x555e38,_0x43dc6d){SmsAccountEvents['emit'](_0x56728d+':'+_0x5c6201['id'],_0x5c6201);SmsAccountEvents[_0x4481('0x4')](_0x56728d,_0x5c6201);_0x43dc6d(null);};}for(var e in events){if(events[_0x4481('0x5')](e)){var event=events[e];SmsAccount[_0x4481('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xf963=['emit','hook','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x11b3bf,_0xca12c){var _0x2eeb8b=function(_0x47a388){while(--_0x47a388){_0x11b3bf['push'](_0x11b3bf['shift']());}};_0x2eeb8b(++_0xca12c);}(_0xf963,0x87));var _0x3f96=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf963[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x3f96('0x0'))['db'][_0x3f96('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3f96('0x2')](0x0);var events={'afterCreate':_0x3f96('0x3'),'afterUpdate':_0x3f96('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c5afe){return function(_0x4a60c9,_0x22d07f,_0x27ae42){SmsAccountEvents[_0x3f96('0x5')](_0x2c5afe+':'+_0x4a60c9['id'],_0x4a60c9);SmsAccountEvents[_0x3f96('0x5')](_0x2c5afe,_0x4a60c9);_0x27ae42(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x3f96('0x6')](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 406ccdd..816ff3b 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 _0x0395=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x0395,0xd5));var _0x5039=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0x0395[_0x45f4e9];return _0x559d8f;};'use strict';var _=require(_0x5039('0x0'));var util=require(_0x5039('0x1'));var logger=require(_0x5039('0x2'))('api');var moment=require(_0x5039('0x3'));var BPromise=require(_0x5039('0x4'));var rp=require(_0x5039('0x5'));var fs=require('fs');var path=require(_0x5039('0x6'));var rimraf=require(_0x5039('0x7'));var config=require(_0x5039('0x8'));var attributes=require(_0x5039('0x9'));module[_0x5039('0xa')]=function(_0xfed60f,_0x319d86){return _0xfed60f[_0x5039('0xb')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7b9=['api','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb7b9,0xd6));var _0x9b7b=function(_0x10c008,_0x44b86f){_0x10c008=_0x10c008-0x0;var _0x5cdf42=_0xb7b9[_0x10c008];return _0x5cdf42;};'use strict';var _=require(_0x9b7b('0x0'));var util=require('util');var logger=require(_0x9b7b('0x1'))(_0x9b7b('0x2'));var moment=require('moment');var BPromise=require(_0x9b7b('0x3'));var rp=require(_0x9b7b('0x4'));var fs=require('fs');var path=require(_0x9b7b('0x5'));var rimraf=require(_0x9b7b('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b7b('0x7'));module[_0x9b7b('0x8')]=function(_0x2b4b19,_0x825e5e){return _0x2b4b19[_0x9b7b('0x9')](_0x9b7b('0xa'),attributes,{'tableName':_0x9b7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 489648d..df2bde8 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 _0x9397=['model','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9397,0x15f));var _0x7939=function(_0x304107,_0xa47eaf){_0x304107=_0x304107-0x0;var _0x43d4af=_0x9397[_0x304107];return _0x43d4af;};'use strict';var _=require(_0x7939('0x0'));var util=require(_0x7939('0x1'));var moment=require('moment');var BPromise=require(_0x7939('0x2'));var rs=require(_0x7939('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7939('0x4'));var logger=require(_0x7939('0x5'))(_0x7939('0x6'));var config=require(_0x7939('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7939('0x8')][_0x7939('0x9')]({'port':0x232a});config[_0x7939('0xa')]=_[_0x7939('0xb')](config[_0x7939('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7939('0xc'))(new Redis(config['redis']));require(_0x7939('0xd'))[_0x7939('0xe')](socket);function respondWithRpcPromise(_0x3f7147,_0x226226,_0x590d2b){return new BPromise(function(_0x4297c0,_0x44c5bc){return client[_0x7939('0xf')](_0x3f7147,_0x590d2b)[_0x7939('0x10')](function(_0x5c27ac){logger[_0x7939('0x11')](_0x7939('0x12'),_0x226226,_0x7939('0x13'));logger[_0x7939('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x226226,_0x7939('0x13'),JSON[_0x7939('0x15')](_0x5c27ac));if(_0x5c27ac['error']){if(_0x5c27ac[_0x7939('0x16')][_0x7939('0x17')]===0x1f4){logger[_0x7939('0x16')](_0x7939('0x12'),_0x226226,_0x5c27ac[_0x7939('0x16')][_0x7939('0x18')]);return _0x44c5bc(_0x5c27ac[_0x7939('0x16')][_0x7939('0x18')]);}logger[_0x7939('0x16')](_0x7939('0x12'),_0x226226,_0x5c27ac[_0x7939('0x16')][_0x7939('0x18')]);return _0x4297c0(_0x5c27ac[_0x7939('0x16')][_0x7939('0x18')]);}else{logger['info'](_0x7939('0x12'),_0x226226,_0x7939('0x13'));_0x4297c0(_0x5c27ac['result'][_0x7939('0x18')]);}})[_0x7939('0x19')](function(_0x2055b6){logger[_0x7939('0x16')](_0x7939('0x12'),_0x226226,_0x2055b6);_0x44c5bc(_0x2055b6);});});}exports[_0x7939('0x1a')]=function(_0x879a86){var _0x3a605d=this;return new Promise(function(_0x3ce651,_0x550a17){return db['SmsAccount'][_0x7939('0x1b')]({'raw':_0x879a86[_0x7939('0x1c')]?_0x879a86[_0x7939('0x1c')][_0x7939('0x1d')]===undefined?!![]:![]:!![],'where':_0x879a86[_0x7939('0x1c')]?_0x879a86['options'][_0x7939('0x1e')]||null:null,'attributes':_0x879a86[_0x7939('0x1c')]?_0x879a86[_0x7939('0x1c')][_0x7939('0x1f')]||null:null,'include':_0x879a86['options']?_0x879a86[_0x7939('0x1c')][_0x7939('0x20')]?_[_0x7939('0x21')](_0x879a86[_0x7939('0x1c')][_0x7939('0x20')],function(_0x33f49c){return{'model':db[_0x33f49c['model']],'as':_0x33f49c['as'],'attributes':_0x33f49c['attributes'],'include':_0x33f49c['include']?_[_0x7939('0x21')](_0x33f49c[_0x7939('0x20')],function(_0x15b548){return{'model':db[_0x15b548[_0x7939('0x22')]],'as':_0x15b548['as'],'attributes':_0x15b548[_0x7939('0x1f')],'include':_0x15b548[_0x7939('0x20')]?_['map'](_0x15b548[_0x7939('0x20')],function(_0x131542){return{'model':db[_0x131542[_0x7939('0x22')]],'as':_0x131542['as'],'attributes':_0x131542[_0x7939('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7939('0x10')](function(_0x21172a){logger[_0x7939('0x11')](_0x7939('0x1a'),_0x879a86);logger[_0x7939('0x14')](_0x7939('0x1a'),_0x879a86,JSON[_0x7939('0x15')](_0x21172a));_0x3ce651(_0x21172a);})[_0x7939('0x19')](function(_0x345f6e){logger[_0x7939('0x16')]('ShowSmsAccount',_0x345f6e[_0x7939('0x18')],_0x879a86);_0x550a17(_0x3a605d['error'](0x1f4,_0x345f6e[_0x7939('0x18')]));});});}; \ No newline at end of file +var _0xc8db=['register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./smsAccount.socket'];(function(_0x26a8cb,_0x4197d4){var _0x1fb45a=function(_0x1ca383){while(--_0x1ca383){_0x26a8cb['push'](_0x26a8cb['shift']());}};_0x1fb45a(++_0x4197d4);}(_0xc8db,0x17f));var _0xbc8d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc8db[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xbc8d('0x0'));var util=require(_0xbc8d('0x1'));var moment=require(_0xbc8d('0x2'));var BPromise=require(_0xbc8d('0x3'));var rs=require(_0xbc8d('0x4'));var fs=require('fs');var Redis=require(_0xbc8d('0x5'));var db=require(_0xbc8d('0x6'))['db'];var utils=require(_0xbc8d('0x7'));var logger=require(_0xbc8d('0x8'))(_0xbc8d('0x9'));var config=require(_0xbc8d('0xa'));var jayson=require(_0xbc8d('0xb'));var client=jayson[_0xbc8d('0xc')][_0xbc8d('0xd')]({'port':0x232a});config[_0xbc8d('0xe')]=_[_0xbc8d('0xf')](config[_0xbc8d('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc8d('0xe')]));require(_0xbc8d('0x10'))[_0xbc8d('0x11')](socket);function respondWithRpcPromise(_0x323191,_0x4f0131,_0x11d877){return new BPromise(function(_0x5848c7,_0x1017fa){return client[_0xbc8d('0x12')](_0x323191,_0x11d877)[_0xbc8d('0x13')](function(_0x20cb1e){logger['info'](_0xbc8d('0x14'),_0x4f0131,_0xbc8d('0x15'));logger[_0xbc8d('0x16')](_0xbc8d('0x17'),_0x4f0131,_0xbc8d('0x15'),JSON[_0xbc8d('0x18')](_0x20cb1e));if(_0x20cb1e[_0xbc8d('0x19')]){if(_0x20cb1e['error'][_0xbc8d('0x1a')]===0x1f4){logger[_0xbc8d('0x19')](_0xbc8d('0x14'),_0x4f0131,_0x20cb1e[_0xbc8d('0x19')][_0xbc8d('0x1b')]);return _0x1017fa(_0x20cb1e[_0xbc8d('0x19')][_0xbc8d('0x1b')]);}logger[_0xbc8d('0x19')](_0xbc8d('0x14'),_0x4f0131,_0x20cb1e[_0xbc8d('0x19')]['message']);return _0x5848c7(_0x20cb1e['error']['message']);}else{logger['info'](_0xbc8d('0x14'),_0x4f0131,_0xbc8d('0x15'));_0x5848c7(_0x20cb1e[_0xbc8d('0x1c')][_0xbc8d('0x1b')]);}})['catch'](function(_0xbacd88){logger[_0xbc8d('0x19')](_0xbc8d('0x14'),_0x4f0131,_0xbacd88);_0x1017fa(_0xbacd88);});});}exports[_0xbc8d('0x1d')]=function(_0x2218a5){var _0x16dad7=this;return new Promise(function(_0x11d18d,_0x2d83dd){return db[_0xbc8d('0x1e')]['find']({'raw':_0x2218a5[_0xbc8d('0x1f')]?_0x2218a5['options'][_0xbc8d('0x20')]===undefined?!![]:![]:!![],'where':_0x2218a5[_0xbc8d('0x1f')]?_0x2218a5[_0xbc8d('0x1f')][_0xbc8d('0x21')]||null:null,'attributes':_0x2218a5[_0xbc8d('0x1f')]?_0x2218a5[_0xbc8d('0x1f')][_0xbc8d('0x22')]||null:null,'include':_0x2218a5['options']?_0x2218a5[_0xbc8d('0x1f')][_0xbc8d('0x23')]?_[_0xbc8d('0x24')](_0x2218a5[_0xbc8d('0x1f')][_0xbc8d('0x23')],function(_0x2795cd){return{'model':db[_0x2795cd[_0xbc8d('0x25')]],'as':_0x2795cd['as'],'attributes':_0x2795cd[_0xbc8d('0x22')],'include':_0x2795cd['include']?_[_0xbc8d('0x24')](_0x2795cd[_0xbc8d('0x23')],function(_0x9aa92f){return{'model':db[_0x9aa92f[_0xbc8d('0x25')]],'as':_0x9aa92f['as'],'attributes':_0x9aa92f[_0xbc8d('0x22')],'include':_0x9aa92f[_0xbc8d('0x23')]?_['map'](_0x9aa92f[_0xbc8d('0x23')],function(_0x345317){return{'model':db[_0x345317[_0xbc8d('0x25')]],'as':_0x345317['as'],'attributes':_0x345317[_0xbc8d('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbc8d('0x13')](function(_0x582cb8){logger[_0xbc8d('0x26')](_0xbc8d('0x1d'),_0x2218a5);logger[_0xbc8d('0x16')](_0xbc8d('0x1d'),_0x2218a5,JSON[_0xbc8d('0x18')](_0x582cb8));_0x11d18d(_0x582cb8);})[_0xbc8d('0x27')](function(_0x59918c){logger['error'](_0xbc8d('0x1d'),_0x59918c[_0xbc8d('0x1b')],_0x2218a5);_0x2d83dd(_0x16dad7[_0xbc8d('0x19')](0x1f4,_0x59918c[_0xbc8d('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 1af465e..7388fcd 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 928e5aa..02e0449 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 _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(_0x10cde6,_0x5c823a){var _0x1fd24e=function(_0x23f742){while(--_0x23f742){_0x10cde6['push'](_0x10cde6['shift']());}};_0x1fd24e(++_0x5c823a);}(_0x34e8,0x12c));var _0x834e=function(_0x5e4bc9,_0x28ad8c){_0x5e4bc9=_0x5e4bc9-0x0;var _0x30862e=_0x34e8[_0x5e4bc9];return _0x30862e;};'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 +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(_0x1ff77b,_0x2cd2f8){var _0x86467d=function(_0x5b67ee){while(--_0x5b67ee){_0x1ff77b['push'](_0x1ff77b['shift']());}};_0x86467d(++_0x2cd2f8);}(_0x34e8,0x12c));var _0x834e=function(_0x5435bb,_0x397a58){_0x5435bb=_0x5435bb-0x0;var _0x70040f=_0x34e8[_0x5435bb];return _0x70040f;};'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 382724e..e3836f4 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 _0x711f=['sequelize','exports','STRING','TEXT','*,*,*,*'];(function(_0x476419,_0x175333){var _0x3789bc=function(_0x2fa4dd){while(--_0x2fa4dd){_0x476419['push'](_0x476419['shift']());}};_0x3789bc(++_0x175333);}(_0x711f,0xbe));var _0xf711=function(_0x44ceee,_0x2a5e28){_0x44ceee=_0x44ceee-0x0;var _0x1a065c=_0x711f[_0x44ceee];return _0x1a065c;};'use strict';var Sequelize=require(_0xf711('0x0'));module[_0xf711('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf711('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf711('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf711('0x2')],'defaultValue':_0xf711('0x4')}}; \ No newline at end of file +var _0x7c5a=['*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7c5a,0x123));var _0xa7c5=function(_0xdd6a5b,_0x914b71){_0xdd6a5b=_0xdd6a5b-0x0;var _0x17b083=_0x7c5a[_0xdd6a5b];return _0x17b083;};'use strict';var Sequelize=require('sequelize');module[_0xa7c5('0x0')]={'priority':{'type':Sequelize[_0xa7c5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa7c5('0x2')],'allowNull':![],'defaultValue':_0xa7c5('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa7c5('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa7c5('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e04bc36..503be19 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 _0x05be=['type','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsApplication','rawAttributes','map','filters','intersection','model','query','fields','attributes','length','nolimit','limit','sort','where','pick','filter'];(function(_0x3798d0,_0x525b45){var _0x3d7214=function(_0x47824e){while(--_0x47824e){_0x3798d0['push'](_0x3798d0['shift']());}};_0x3d7214(++_0x525b45);}(_0x05be,0x1dc));var _0xe05b=function(_0x55d6bf,_0x27d38d){_0x55d6bf=_0x55d6bf-0x0;var _0x379799=_0x05be[_0x55d6bf];return _0x379799;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe05b('0x0'));var rp=require(_0xe05b('0x1'));var moment=require(_0xe05b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe05b('0x3'));var util=require('util');var path=require('path');var sox=require(_0xe05b('0x4'));var csv=require(_0xe05b('0x5'));var ejs=require(_0xe05b('0x6'));var fs=require('fs');var fs_extra=require(_0xe05b('0x7'));var _=require('lodash');var squel=require(_0xe05b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe05b('0x9'));var authService=require(_0xe05b('0xa'));var qs=require(_0xe05b('0xb'));var as=require(_0xe05b('0xc'));var hardwareService=require(_0xe05b('0xd'));var logger=require('../../config/logger')(_0xe05b('0xe'));var utils=require('../../config/utils');var config=require(_0xe05b('0xf'));var licenseUtil=require(_0xe05b('0x10'));var db=require(_0xe05b('0x11'))['db'];function respondWithStatusCode(_0x2b6bd5,_0x3cca38){_0x3cca38=_0x3cca38||0xcc;return function(_0x18adac){if(_0x18adac){return _0x2b6bd5['sendStatus'](_0x3cca38);}return _0x2b6bd5[_0xe05b('0x12')](_0x3cca38)[_0xe05b('0x13')]();};}function respondWithResult(_0x27923b,_0xef05cb){_0xef05cb=_0xef05cb||0xc8;return function(_0x257175){if(_0x257175){return _0x27923b[_0xe05b('0x12')](_0xef05cb)[_0xe05b('0x14')](_0x257175);}};}function respondWithFilteredResult(_0xc97ee0,_0xaa0a44){return function(_0x507f71){if(_0x507f71){var _0x582b31=typeof _0xaa0a44[_0xe05b('0x15')]===_0xe05b('0x16')&&typeof _0xaa0a44['limit']===_0xe05b('0x16');var _0x429922=_0x507f71[_0xe05b('0x17')];var _0x7f1fce=_0x582b31?0x0:_0xaa0a44[_0xe05b('0x15')];var _0x1e6f64=_0x582b31?_0x507f71[_0xe05b('0x17')]:_0xaa0a44[_0xe05b('0x15')]+_0xaa0a44['limit'];var _0x5a02a7;if(_0x1e6f64>=_0x429922){_0x1e6f64=_0x429922;_0x5a02a7=0xc8;}else{_0x5a02a7=0xce;}_0xc97ee0['status'](_0x5a02a7);return _0xc97ee0[_0xe05b('0x18')]('Content-Range',_0x7f1fce+'-'+_0x1e6f64+'/'+_0x429922)['json'](_0x507f71);}return null;};}function patchUpdates(_0xf00870){return function(_0x411857){try{jsonpatch[_0xe05b('0x19')](_0x411857,_0xf00870,!![]);}catch(_0x5ed095){return BPromise[_0xe05b('0x1a')](_0x5ed095);}return _0x411857[_0xe05b('0x1b')]();};}function saveUpdates(_0x3d3a30,_0x552c70){return function(_0x3e7827){if(_0x3e7827){return _0x3e7827[_0xe05b('0x1c')](_0x3d3a30)[_0xe05b('0x1d')](function(_0x572378){return _0x572378;});}return null;};}function removeEntity(_0x353aba,_0x36bc69){return function(_0x5509c3){if(_0x5509c3){return _0x5509c3[_0xe05b('0x1e')]()['then'](function(){_0x353aba[_0xe05b('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358f28,_0x4fbc9a){return function(_0x2b609d){if(!_0x2b609d){_0x358f28['sendStatus'](0x194);}return _0x2b609d;};}function handleError(_0x5ba829,_0x2a8d67){_0x2a8d67=_0x2a8d67||0x1f4;return function(_0x2aacb3){logger[_0xe05b('0x1f')](_0x2aacb3[_0xe05b('0x20')]);if(_0x2aacb3[_0xe05b('0x21')]){delete _0x2aacb3[_0xe05b('0x21')];}_0x5ba829['status'](_0x2a8d67)[_0xe05b('0x22')](_0x2aacb3);};}exports[_0xe05b('0x23')]=function(_0x230f56,_0x227f29){var _0x441767={},_0x22f57b={},_0x237a13={'count':0x0,'rows':[]};var _0x359335=_['map'](db[_0xe05b('0x24')][_0xe05b('0x25')],function(_0x2798e5){return{'name':_0x2798e5['fieldName'],'type':_0x2798e5['type']['key']};});_0x22f57b['model']=_[_0xe05b('0x26')](_0x359335,_0xe05b('0x21'));_0x22f57b['query']=_['keys'](_0x230f56['query']);_0x22f57b[_0xe05b('0x27')]=_[_0xe05b('0x28')](_0x22f57b[_0xe05b('0x29')],_0x22f57b[_0xe05b('0x2a')]);_0x441767['attributes']=_[_0xe05b('0x28')](_0x22f57b[_0xe05b('0x29')],qs['fields'](_0x230f56[_0xe05b('0x2a')][_0xe05b('0x2b')]));_0x441767[_0xe05b('0x2c')]=_0x441767[_0xe05b('0x2c')][_0xe05b('0x2d')]?_0x441767[_0xe05b('0x2c')]:_0x22f57b['model'];if(!_0x230f56[_0xe05b('0x2a')]['hasOwnProperty'](_0xe05b('0x2e'))){_0x441767['limit']=qs[_0xe05b('0x2f')](_0x230f56[_0xe05b('0x2a')][_0xe05b('0x2f')]);_0x441767[_0xe05b('0x15')]=qs['offset'](_0x230f56[_0xe05b('0x2a')][_0xe05b('0x15')]);}_0x441767['order']=qs['sort'](_0x230f56[_0xe05b('0x2a')][_0xe05b('0x30')]);_0x441767[_0xe05b('0x31')]=qs['filters'](_[_0xe05b('0x32')](_0x230f56['query'],_0x22f57b[_0xe05b('0x27')]),_0x359335);if(_0x230f56[_0xe05b('0x2a')][_0xe05b('0x33')]){_0x441767['where']=_['merge'](_0x441767[_0xe05b('0x31')],{'$or':_['map'](_0x359335,function(_0x3bdb0c){if(_0x3bdb0c[_0xe05b('0x34')]!=='VIRTUAL'){var _0x423e77={};_0x423e77[_0x3bdb0c[_0xe05b('0x21')]]={'$like':'%'+_0x230f56['query'][_0xe05b('0x33')]+'%'};return _0x423e77;}})});}_0x441767=_[_0xe05b('0x35')]({},_0x441767,_0x230f56[_0xe05b('0x36')]);var _0x3e8664={'where':_0x441767[_0xe05b('0x31')]};return db[_0xe05b('0x24')]['count'](_0x3e8664)[_0xe05b('0x1d')](function(_0x30a815){_0x237a13[_0xe05b('0x17')]=_0x30a815;if(_0x230f56['query'][_0xe05b('0x37')]){_0x441767[_0xe05b('0x38')]=[{'all':!![]}];}return db['SmsApplication'][_0xe05b('0x39')](_0x441767);})[_0xe05b('0x1d')](function(_0x8a619d){_0x237a13[_0xe05b('0x3a')]=_0x8a619d;return _0x237a13;})[_0xe05b('0x1d')](respondWithFilteredResult(_0x227f29,_0x441767))[_0xe05b('0x3b')](handleError(_0x227f29,null));};exports[_0xe05b('0x3c')]=function(_0x4aa76c,_0x44292d){var _0x38f149={'raw':!![],'where':{'id':_0x4aa76c[_0xe05b('0x3d')]['id']}},_0x2b3545={};_0x2b3545['model']=_['keys'](db[_0xe05b('0x24')]['rawAttributes']);_0x2b3545[_0xe05b('0x2a')]=_[_0xe05b('0x3e')](_0x4aa76c['query']);_0x2b3545[_0xe05b('0x27')]=_[_0xe05b('0x28')](_0x2b3545['model'],_0x2b3545[_0xe05b('0x2a')]);_0x38f149['attributes']=_[_0xe05b('0x28')](_0x2b3545[_0xe05b('0x29')],qs['fields'](_0x4aa76c['query'][_0xe05b('0x2b')]));_0x38f149[_0xe05b('0x2c')]=_0x38f149['attributes'][_0xe05b('0x2d')]?_0x38f149[_0xe05b('0x2c')]:_0x2b3545[_0xe05b('0x29')];if(_0x4aa76c[_0xe05b('0x2a')]['includeAll']){_0x38f149[_0xe05b('0x38')]=[{'all':!![]}];}_0x38f149=_[_0xe05b('0x35')]({},_0x38f149,_0x4aa76c[_0xe05b('0x36')]);return db[_0xe05b('0x24')][_0xe05b('0x3f')](_0x38f149)[_0xe05b('0x1d')](handleEntityNotFound(_0x44292d,null))[_0xe05b('0x1d')](respondWithResult(_0x44292d,null))[_0xe05b('0x3b')](handleError(_0x44292d,null));};exports[_0xe05b('0x40')]=function(_0x4e1156,_0x1ee26e){return db[_0xe05b('0x24')][_0xe05b('0x40')](_0x4e1156[_0xe05b('0x41')],{})['then'](respondWithResult(_0x1ee26e,0xc9))[_0xe05b('0x3b')](handleError(_0x1ee26e,null));};exports[_0xe05b('0x1c')]=function(_0x14d18c,_0x46728d){if(_0x14d18c[_0xe05b('0x41')]['id']){delete _0x14d18c[_0xe05b('0x41')]['id'];}return db[_0xe05b('0x24')]['find']({'where':{'id':_0x14d18c[_0xe05b('0x3d')]['id']}})[_0xe05b('0x1d')](handleEntityNotFound(_0x46728d,null))['then'](saveUpdates(_0x14d18c[_0xe05b('0x41')],null))[_0xe05b('0x1d')](respondWithResult(_0x46728d,null))['catch'](handleError(_0x46728d,null));};exports[_0xe05b('0x1e')]=function(_0x4be175,_0x26c7bd){return db['SmsApplication'][_0xe05b('0x3f')]({'where':{'id':_0x4be175['params']['id']}})['then'](handleEntityNotFound(_0x26c7bd,null))['then'](removeEntity(_0x26c7bd,null))[_0xe05b('0x3b')](handleError(_0x26c7bd,null));}; \ No newline at end of file +var _0x31c1=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','options','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','SmsApplication','rawAttributes','fieldName','type','key','name','query','keys'];(function(_0x51d058,_0x430649){var _0x5b4c4e=function(_0xf87ad6){while(--_0xf87ad6){_0x51d058['push'](_0x51d058['shift']());}};_0x5b4c4e(++_0x430649);}(_0x31c1,0xae));var _0x131c=function(_0x19e6a9,_0xb3a0a2){_0x19e6a9=_0x19e6a9-0x0;var _0x25c96f=_0x31c1[_0x19e6a9];return _0x25c96f;};'use strict';var emlformat=require(_0x131c('0x0'));var rimraf=require(_0x131c('0x1'));var zipdir=require(_0x131c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x131c('0x3'));var moment=require(_0x131c('0x4'));var BPromise=require(_0x131c('0x5'));var Mustache=require(_0x131c('0x6'));var util=require(_0x131c('0x7'));var path=require(_0x131c('0x8'));var sox=require(_0x131c('0x9'));var csv=require(_0x131c('0xa'));var ejs=require(_0x131c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x131c('0xc'));var squel=require(_0x131c('0xd'));var crypto=require(_0x131c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x131c('0xf'));var toCsv=require(_0x131c('0xa'));var querystring=require(_0x131c('0x10'));var Papa=require(_0x131c('0x11'));var Redis=require('ioredis');var authService=require(_0x131c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x131c('0x13'));var hardwareService=require(_0x131c('0x14'));var logger=require(_0x131c('0x15'))('api');var utils=require(_0x131c('0x16'));var config=require(_0x131c('0x17'));var licenseUtil=require(_0x131c('0x18'));var db=require(_0x131c('0x19'))['db'];function respondWithStatusCode(_0x2cd894,_0x2579fb){_0x2579fb=_0x2579fb||0xcc;return function(_0x32e2a1){if(_0x32e2a1){return _0x2cd894['sendStatus'](_0x2579fb);}return _0x2cd894[_0x131c('0x1a')](_0x2579fb)[_0x131c('0x1b')]();};}function respondWithResult(_0x1dbd62,_0x5e232e){_0x5e232e=_0x5e232e||0xc8;return function(_0xc9d1f0){if(_0xc9d1f0){return _0x1dbd62[_0x131c('0x1a')](_0x5e232e)['json'](_0xc9d1f0);}};}function respondWithFilteredResult(_0x5e55bf,_0x464246){return function(_0x3ca983){if(_0x3ca983){var _0x35c63f=typeof _0x464246[_0x131c('0x1c')]===_0x131c('0x1d')&&typeof _0x464246[_0x131c('0x1e')]===_0x131c('0x1d');var _0x3b61db=_0x3ca983['count'];var _0x476e78=_0x35c63f?0x0:_0x464246['offset'];var _0x231c4f=_0x35c63f?_0x3ca983[_0x131c('0x1f')]:_0x464246[_0x131c('0x1c')]+_0x464246[_0x131c('0x1e')];var _0x559d76;if(_0x231c4f>=_0x3b61db){_0x231c4f=_0x3b61db;_0x559d76=0xc8;}else{_0x559d76=0xce;}_0x5e55bf['status'](_0x559d76);return _0x5e55bf['set'](_0x131c('0x20'),_0x476e78+'-'+_0x231c4f+'/'+_0x3b61db)['json'](_0x3ca983);}return null;};}function patchUpdates(_0x59eadb){return function(_0xbc97c3){try{jsonpatch[_0x131c('0x21')](_0xbc97c3,_0x59eadb,!![]);}catch(_0x4458ca){return BPromise[_0x131c('0x22')](_0x4458ca);}return _0xbc97c3[_0x131c('0x23')]();};}function saveUpdates(_0x1b500d,_0x30fff4){return function(_0x19bc75){if(_0x19bc75){return _0x19bc75[_0x131c('0x24')](_0x1b500d)[_0x131c('0x25')](function(_0x2ee7da){return _0x2ee7da;});}return null;};}function removeEntity(_0x4f0fdc,_0x1146e9){return function(_0x751919){if(_0x751919){return _0x751919[_0x131c('0x26')]()[_0x131c('0x25')](function(){_0x4f0fdc[_0x131c('0x1a')](0xcc)[_0x131c('0x1b')]();});}};}function handleEntityNotFound(_0x5b99fc,_0x20f132){return function(_0x3be6c0){if(!_0x3be6c0){_0x5b99fc['sendStatus'](0x194);}return _0x3be6c0;};}function handleError(_0x59c9fe,_0x4bdcf6){_0x4bdcf6=_0x4bdcf6||0x1f4;return function(_0x150430){logger[_0x131c('0x27')](_0x150430[_0x131c('0x28')]);if(_0x150430['name']){delete _0x150430['name'];}_0x59c9fe['status'](_0x4bdcf6)['send'](_0x150430);};}exports[_0x131c('0x29')]=function(_0x2c129a,_0x58dee0){var _0x5e0873={},_0x53d79c={},_0x493f7b={'count':0x0,'rows':[]};var _0x4e56c1=_[_0x131c('0x2a')](db[_0x131c('0x2b')][_0x131c('0x2c')],function(_0x3bf86b){return{'name':_0x3bf86b[_0x131c('0x2d')],'type':_0x3bf86b[_0x131c('0x2e')][_0x131c('0x2f')]};});_0x53d79c['model']=_[_0x131c('0x2a')](_0x4e56c1,_0x131c('0x30'));_0x53d79c[_0x131c('0x31')]=_[_0x131c('0x32')](_0x2c129a[_0x131c('0x31')]);_0x53d79c[_0x131c('0x33')]=_[_0x131c('0x34')](_0x53d79c[_0x131c('0x35')],_0x53d79c[_0x131c('0x31')]);_0x5e0873[_0x131c('0x36')]=_[_0x131c('0x34')](_0x53d79c[_0x131c('0x35')],qs[_0x131c('0x37')](_0x2c129a['query']['fields']));_0x5e0873['attributes']=_0x5e0873[_0x131c('0x36')][_0x131c('0x38')]?_0x5e0873[_0x131c('0x36')]:_0x53d79c['model'];if(!_0x2c129a[_0x131c('0x31')][_0x131c('0x39')](_0x131c('0x3a'))){_0x5e0873[_0x131c('0x1e')]=qs[_0x131c('0x1e')](_0x2c129a[_0x131c('0x31')][_0x131c('0x1e')]);_0x5e0873[_0x131c('0x1c')]=qs[_0x131c('0x1c')](_0x2c129a[_0x131c('0x31')]['offset']);}_0x5e0873[_0x131c('0x3b')]=qs[_0x131c('0x3c')](_0x2c129a['query'][_0x131c('0x3c')]);_0x5e0873[_0x131c('0x3d')]=qs[_0x131c('0x33')](_[_0x131c('0x3e')](_0x2c129a[_0x131c('0x31')],_0x53d79c[_0x131c('0x33')]),_0x4e56c1);if(_0x2c129a['query'][_0x131c('0x3f')]){_0x5e0873['where']=_[_0x131c('0x40')](_0x5e0873[_0x131c('0x3d')],{'$or':_[_0x131c('0x2a')](_0x4e56c1,function(_0x30538b){if(_0x30538b[_0x131c('0x2e')]!==_0x131c('0x41')){var _0x4e3f8d={};_0x4e3f8d[_0x30538b[_0x131c('0x30')]]={'$like':'%'+_0x2c129a[_0x131c('0x31')][_0x131c('0x3f')]+'%'};return _0x4e3f8d;}})});}_0x5e0873=_[_0x131c('0x40')]({},_0x5e0873,_0x2c129a['options']);var _0x1834cb={'where':_0x5e0873['where']};return db[_0x131c('0x2b')][_0x131c('0x1f')](_0x1834cb)[_0x131c('0x25')](function(_0x36d563){_0x493f7b[_0x131c('0x1f')]=_0x36d563;if(_0x2c129a['query']['includeAll']){_0x5e0873[_0x131c('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x131c('0x43')](_0x5e0873);})[_0x131c('0x25')](function(_0x2ccf52){_0x493f7b[_0x131c('0x44')]=_0x2ccf52;return _0x493f7b;})[_0x131c('0x25')](respondWithFilteredResult(_0x58dee0,_0x5e0873))[_0x131c('0x45')](handleError(_0x58dee0,null));};exports[_0x131c('0x46')]=function(_0x570245,_0x28201e){var _0x526c46={'raw':!![],'where':{'id':_0x570245[_0x131c('0x47')]['id']}},_0x1f6601={};_0x1f6601[_0x131c('0x35')]=_[_0x131c('0x32')](db[_0x131c('0x2b')]['rawAttributes']);_0x1f6601[_0x131c('0x31')]=_[_0x131c('0x32')](_0x570245['query']);_0x1f6601[_0x131c('0x33')]=_['intersection'](_0x1f6601['model'],_0x1f6601[_0x131c('0x31')]);_0x526c46['attributes']=_[_0x131c('0x34')](_0x1f6601[_0x131c('0x35')],qs[_0x131c('0x37')](_0x570245[_0x131c('0x31')]['fields']));_0x526c46[_0x131c('0x36')]=_0x526c46[_0x131c('0x36')][_0x131c('0x38')]?_0x526c46['attributes']:_0x1f6601[_0x131c('0x35')];if(_0x570245['query']['includeAll']){_0x526c46[_0x131c('0x42')]=[{'all':!![]}];}_0x526c46=_[_0x131c('0x40')]({},_0x526c46,_0x570245[_0x131c('0x48')]);return db[_0x131c('0x2b')]['find'](_0x526c46)[_0x131c('0x25')](handleEntityNotFound(_0x28201e,null))[_0x131c('0x25')](respondWithResult(_0x28201e,null))[_0x131c('0x45')](handleError(_0x28201e,null));};exports[_0x131c('0x49')]=function(_0x43b625,_0x1a5a09){return db[_0x131c('0x2b')][_0x131c('0x49')](_0x43b625[_0x131c('0x4a')],{})['then'](respondWithResult(_0x1a5a09,0xc9))[_0x131c('0x45')](handleError(_0x1a5a09,null));};exports[_0x131c('0x24')]=function(_0x253728,_0x20981d){if(_0x253728[_0x131c('0x4a')]['id']){delete _0x253728[_0x131c('0x4a')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x253728[_0x131c('0x47')]['id']}})['then'](handleEntityNotFound(_0x20981d,null))['then'](saveUpdates(_0x253728[_0x131c('0x4a')],null))['then'](respondWithResult(_0x20981d,null))['catch'](handleError(_0x20981d,null));};exports['destroy']=function(_0xb6a4f0,_0x191be1){return db[_0x131c('0x2b')]['find']({'where':{'id':_0xb6a4f0[_0x131c('0x47')]['id']}})['then'](handleEntityNotFound(_0x191be1,null))[_0x131c('0x25')](removeEntity(_0x191be1,null))[_0x131c('0x45')](handleError(_0x191be1,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index bffc3ce..a17040b 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 _0x1f93=['SmsApplication','sms_applications','utf8mb4','util','../../config/logger','api','bluebird','request-promise','rimraf','./smsApplication.attributes','exports','define'];(function(_0x269672,_0x2e3531){var _0x38289d=function(_0x17bab4){while(--_0x17bab4){_0x269672['push'](_0x269672['shift']());}};_0x38289d(++_0x2e3531);}(_0x1f93,0x19b));var _0x31f9=function(_0xaa2eba,_0x43834e){_0xaa2eba=_0xaa2eba-0x0;var _0x4901fc=_0x1f93[_0xaa2eba];return _0x4901fc;};'use strict';var _=require('lodash');var util=require(_0x31f9('0x0'));var logger=require(_0x31f9('0x1'))(_0x31f9('0x2'));var moment=require('moment');var BPromise=require(_0x31f9('0x3'));var rp=require(_0x31f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31f9('0x5'));var config=require('../../config/environment');var attributes=require(_0x31f9('0x6'));module[_0x31f9('0x7')]=function(_0x584af2,_0x5f309c){return _0x584af2[_0x31f9('0x8')](_0x31f9('0x9'),attributes,{'tableName':_0x31f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31f9('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb524=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4569e3,_0x7d0348){var _0x32bee7=function(_0x3e8624){while(--_0x3e8624){_0x4569e3['push'](_0x4569e3['shift']());}};_0x32bee7(++_0x7d0348);}(_0xb524,0x78));var _0x4b52=function(_0x15290b,_0x1a073b){_0x15290b=_0x15290b-0x0;var _0x2e52cc=_0xb524[_0x15290b];return _0x2e52cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b52('0x0'))(_0x4b52('0x1'));var moment=require(_0x4b52('0x2'));var BPromise=require(_0x4b52('0x3'));var rp=require(_0x4b52('0x4'));var fs=require('fs');var path=require(_0x4b52('0x5'));var rimraf=require(_0x4b52('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b52('0x7'));module['exports']=function(_0x5ecb8a,_0x346647){return _0x5ecb8a['define'](_0x4b52('0x8'),attributes,{'tableName':_0x4b52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b52('0xa'),'collate':_0x4b52('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e9c08fc..cae8944 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 _0xf1f9=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1939e0,_0x2fbce2){var _0x2cfeec=function(_0x5222c8){while(--_0x5222c8){_0x1939e0['push'](_0x1939e0['shift']());}};_0x2cfeec(++_0x2fbce2);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x2e1a6c,_0x1e0fc0){_0x2e1a6c=_0x2e1a6c-0x0;var _0x2715a2=_0xf1f9[_0x2e1a6c];return _0x2715a2;};'use strict';var _=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var moment=require(_0x9f1f('0x2'));var BPromise=require(_0x9f1f('0x3'));var rs=require(_0x9f1f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f1f('0x5'))['db'];var utils=require(_0x9f1f('0x6'));var logger=require(_0x9f1f('0x7'))(_0x9f1f('0x8'));var config=require(_0x9f1f('0x9'));var jayson=require(_0x9f1f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x363d26,_0x373b98,_0x117fa5){return new BPromise(function(_0x12309e,_0x4e6054){return client[_0x9f1f('0xb')](_0x363d26,_0x117fa5)[_0x9f1f('0xc')](function(_0x3efac2){logger[_0x9f1f('0xd')](_0x9f1f('0xe'),_0x373b98,_0x9f1f('0xf'));logger[_0x9f1f('0x10')](_0x9f1f('0x11'),_0x373b98,'request\x20sent',JSON[_0x9f1f('0x12')](_0x3efac2));if(_0x3efac2[_0x9f1f('0x13')]){if(_0x3efac2[_0x9f1f('0x13')]['code']===0x1f4){logger['error'](_0x9f1f('0xe'),_0x373b98,_0x3efac2['error'][_0x9f1f('0x14')]);return _0x4e6054(_0x3efac2[_0x9f1f('0x13')][_0x9f1f('0x14')]);}logger[_0x9f1f('0x13')](_0x9f1f('0xe'),_0x373b98,_0x3efac2[_0x9f1f('0x13')][_0x9f1f('0x14')]);return _0x12309e(_0x3efac2['error'][_0x9f1f('0x14')]);}else{logger['info'](_0x9f1f('0xe'),_0x373b98,_0x9f1f('0xf'));_0x12309e(_0x3efac2[_0x9f1f('0x15')][_0x9f1f('0x14')]);}})[_0x9f1f('0x16')](function(_0x5645fc){logger[_0x9f1f('0x13')](_0x9f1f('0xe'),_0x373b98,_0x5645fc);_0x4e6054(_0x5645fc);});});} \ No newline at end of file +var _0x2250=['SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2250,0x178));var _0x0225=function(_0x2a5c01,_0x1d4a70){_0x2a5c01=_0x2a5c01-0x0;var _0xa07bf0=_0x2250[_0x2a5c01];return _0xa07bf0;};'use strict';var _=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var moment=require(_0x0225('0x2'));var BPromise=require(_0x0225('0x3'));var rs=require(_0x0225('0x4'));var fs=require('fs');var Redis=require(_0x0225('0x5'));var db=require(_0x0225('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0225('0x7'))(_0x0225('0x8'));var config=require(_0x0225('0x9'));var jayson=require(_0x0225('0xa'));var client=jayson[_0x0225('0xb')][_0x0225('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a9fd5,_0x229c55,_0x4b8eda){return new BPromise(function(_0x331807,_0x5b87cc){return client['request'](_0x1a9fd5,_0x4b8eda)[_0x0225('0xd')](function(_0x1991b5){logger[_0x0225('0xe')](_0x0225('0xf'),_0x229c55,_0x0225('0x10'));logger['debug'](_0x0225('0x11'),_0x229c55,_0x0225('0x10'),JSON[_0x0225('0x12')](_0x1991b5));if(_0x1991b5[_0x0225('0x13')]){if(_0x1991b5['error'][_0x0225('0x14')]===0x1f4){logger['error'](_0x0225('0xf'),_0x229c55,_0x1991b5[_0x0225('0x13')]['message']);return _0x5b87cc(_0x1991b5[_0x0225('0x13')][_0x0225('0x15')]);}logger[_0x0225('0x13')](_0x0225('0xf'),_0x229c55,_0x1991b5[_0x0225('0x13')][_0x0225('0x15')]);return _0x331807(_0x1991b5[_0x0225('0x13')][_0x0225('0x15')]);}else{logger[_0x0225('0xe')](_0x0225('0xf'),_0x229c55,_0x0225('0x10'));_0x331807(_0x1991b5['result'][_0x0225('0x15')]);}})[_0x0225('0x16')](function(_0x59e455){logger[_0x0225('0x13')]('SmsApplication,\x20%s,\x20%s',_0x229c55,_0x59e455);_0x5b87cc(_0x59e455);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a01dc24..57ad79b 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 _0x3266=['isAuthenticated','index','get','/:id','show','getMessages','/:id/download','download','post','create','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller'];(function(_0x2d0570,_0x454225){var _0x955d2f=function(_0x2073e7){while(--_0x2073e7){_0x2d0570['push'](_0x2d0570['shift']());}};_0x955d2f(++_0x454225);}(_0x3266,0x6a));var _0x6326=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x3266[_0xd1c39b];return _0x58f5bc;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/describe',auth[_0x6326('0xa')](),controller['describe']);router[_0x6326('0xc')](_0x6326('0xd'),auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xc')]('/:id/messages',auth[_0x6326('0xa')](),controller[_0x6326('0xf')]);router[_0x6326('0xc')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6326('0x14')]);router[_0x6326('0x12')]('/:id/tags',auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x16')),controller[_0x6326('0x17')]);router[_0x6326('0x18')](_0x6326('0xd'),auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),'smsinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x19')),controller[_0x6326('0x1a')]);router['delete']('/:id/tags',auth[_0x6326('0xa')](),controller[_0x6326('0x1b')]);module[_0x6326('0x1c')]=router; \ No newline at end of file +var _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x490074,_0x45d1d8){var _0x169b2f=function(_0x31a11d){while(--_0x31a11d){_0x490074['push'](_0x490074['shift']());}};_0x169b2f(++_0x45d1d8);}(_0xb03e,0x1eb));var _0xeb03=function(_0x567f70,_0x18821c){_0x567f70=_0x567f70-0x0;var _0x24dd6a=_0xb03e[_0x567f70];return _0x24dd6a;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e01c4d8..b0e1ad7 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 _0xdcc4=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x167564,_0x1f1c18){var _0x555f1a=function(_0x21b1ac){while(--_0x21b1ac){_0x167564['push'](_0x167564['shift']());}};_0x555f1a(++_0x1f1c18);}(_0xdcc4,0xea));var _0x4dcc=function(_0x4ebf6a,_0xfd0a40){_0x4ebf6a=_0x4ebf6a-0x0;var _0x1e7a72=_0xdcc4[_0x4ebf6a];return _0x1e7a72;};'use strict';var Sequelize=require(_0x4dcc('0x0'));var moment=require(_0x4dcc('0x1'));module[_0x4dcc('0x2')]={'closed':{'type':Sequelize[_0x4dcc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4dcc('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4dcc('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4dcc('0x5')]},'note':{'type':Sequelize[_0x4dcc('0x5')]},'phone':{'type':Sequelize[_0x4dcc('0x5')]},'read1stAt':{'type':Sequelize[_0x4dcc('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4dcc('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4dcc('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4dcc('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4dcc('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1a61=['ENUM','out','BOOLEAN','sequelize','exports','DATE','STRING'];(function(_0x178437,_0x5ced37){var _0x442365=function(_0x65f8df){while(--_0x65f8df){_0x178437['push'](_0x178437['shift']());}};_0x442365(++_0x5ced37);}(_0x1a61,0x1e6));var _0x11a6=function(_0x3c056e,_0x27be29){_0x3c056e=_0x3c056e-0x0;var _0x3f3d56=_0x1a61[_0x3c056e];return _0x3f3d56;};'use strict';var Sequelize=require(_0x11a6('0x0'));var moment=require('moment');module[_0x11a6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x11a6('0x2')]},'disposition':{'type':Sequelize[_0x11a6('0x3')]},'secondDisposition':{'type':Sequelize[_0x11a6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x11a6('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x11a6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x11a6('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x11a6('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x11a6('0x4')]('in',_0x11a6('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x11a6('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a75b7cd..f378499 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 _0x234d=['unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','defaults','redis','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','params','model','keys','intersection','attributes','fields','length','includeAll','include','find','catch','create','body','describe','addMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','SmsMessage','rows','addTags','setTags','color','smsInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','direction','secret','read','SmsAccount','Account','Owner','get','N.A.','createdAt','closedAt','disposition','Messages','out','System','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','err'];(function(_0xf947d9,_0x6a67fb){var _0x412e73=function(_0x63cd89){while(--_0x63cd89){_0xf947d9['push'](_0xf947d9['shift']());}};_0x412e73(++_0x6a67fb);}(_0x234d,0x1dd));var _0xd234=function(_0x3d74a2,_0x21d570){_0x3d74a2=_0x3d74a2-0x0;var _0x5e7a7a=_0x234d[_0x3d74a2];return _0x5e7a7a;};'use strict';var rimraf=require(_0xd234('0x0'));var zipdir=require(_0xd234('0x1'));var moment=require(_0xd234('0x2'));var BPromise=require(_0xd234('0x3'));var util=require('util');var path=require(_0xd234('0x4'));var ejs=require(_0xd234('0x5'));var fs=require('fs');var _=require(_0xd234('0x6'));var Redis=require(_0xd234('0x7'));var interaction=require(_0xd234('0x8'));var qs=require(_0xd234('0x9'));var pdf=require(_0xd234('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xd234('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd234('0xc')](config[_0xd234('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd234('0xd')]));require(_0xd234('0xe'))[_0xd234('0xf')](socket);function respondWithStatusCode(_0x183c9b,_0x40cb77){_0x40cb77=_0x40cb77||0xcc;return function(_0x401fd1){if(_0x401fd1){return _0x183c9b[_0xd234('0x10')](_0x40cb77);}return _0x183c9b[_0xd234('0x11')](_0x40cb77)[_0xd234('0x12')]();};}function respondWithResult(_0x568e63,_0x183d10){_0x183d10=_0x183d10||0xc8;return function(_0x1c6187){if(_0x1c6187){return _0x568e63[_0xd234('0x11')](_0x183d10)[_0xd234('0x13')](_0x1c6187);}};}function respondWithFilteredResult(_0x51f241,_0x56d8fa){return function(_0x47235d){if(_0x47235d){var _0x533232=typeof _0x56d8fa[_0xd234('0x14')]===_0xd234('0x15')&&typeof _0x56d8fa[_0xd234('0x16')]===_0xd234('0x15');var _0x5bc874=_0x47235d['count'];var _0x488a6b=_0x533232?0x0:_0x56d8fa[_0xd234('0x14')];var _0x32e6df=_0x533232?_0x47235d[_0xd234('0x17')]:_0x56d8fa[_0xd234('0x14')]+_0x56d8fa[_0xd234('0x16')];var _0x15c6b3;if(_0x32e6df>=_0x5bc874){_0x32e6df=_0x5bc874;_0x15c6b3=0xc8;}else{_0x15c6b3=0xce;}_0x51f241[_0xd234('0x11')](_0x15c6b3);return _0x51f241['set'](_0xd234('0x18'),_0x488a6b+'-'+_0x32e6df+'/'+_0x5bc874)[_0xd234('0x13')](_0x47235d);}return null;};}function saveUpdates(_0xb10e63){return function(_0x3d869e){if(_0x3d869e){return _0x3d869e[_0xd234('0x19')](_0xb10e63)[_0xd234('0x1a')](function(_0x2f42f8){return _0x2f42f8;});}return null;};}function removeEntity(_0x4e02c8){return function(_0x940eaf){if(_0x940eaf){return _0x940eaf[_0xd234('0x1b')]()[_0xd234('0x1a')](function(){_0x4e02c8[_0xd234('0x11')](0xcc)[_0xd234('0x12')]();});}};}function handleEntityNotFound(_0x4abbba){return function(_0x493669){if(!_0x493669){_0x4abbba[_0xd234('0x10')](0x194);}return _0x493669;};}function handleError(_0x2abf7c,_0x14fc9c){_0x14fc9c=_0x14fc9c||0x1f4;return function(_0x370ee8){logger[_0xd234('0x1c')](_0x370ee8[_0xd234('0x1d')]);if(_0x370ee8[_0xd234('0x1e')]){delete _0x370ee8[_0xd234('0x1e')];}_0x2abf7c[_0xd234('0x11')](_0x14fc9c)[_0xd234('0x1f')](_0x370ee8);};}exports[_0xd234('0x20')]=function(_0x1da4e4,_0x407ab9){var _0x25c175={};var _0x2395c6=_[_0xd234('0x21')](db[_0xd234('0x22')][_0xd234('0x23')],function(_0x5cc6f5){return{'name':_0x5cc6f5[_0xd234('0x24')],'type':_0x5cc6f5[_0xd234('0x25')][_0xd234('0x26')]};});_0x25c175=qs[_0xd234('0x27')](_0x2395c6,_0x1da4e4);return interaction[_0xd234('0x28')](_0xd234('0x29'),_0x1da4e4[_0xd234('0x2a')],_0x1da4e4[_0xd234('0x2b')],_0x25c175,_0x2395c6)['then'](respondWithFilteredResult(_0x407ab9,_0x25c175))['catch'](handleError(_0x407ab9,null));};exports['show']=function(_0x13dbea,_0x5636d2){var _0x5ba18d={'raw':![],'where':{'id':_0x13dbea[_0xd234('0x2c')]['id']}},_0x5982a8={};_0x5982a8[_0xd234('0x2d')]=_[_0xd234('0x2e')](db[_0xd234('0x22')]['rawAttributes']);_0x5982a8[_0xd234('0x2a')]=_['keys'](_0x13dbea['query']);_0x5982a8['filters']=_[_0xd234('0x2f')](_0x5982a8[_0xd234('0x2d')],_0x5982a8[_0xd234('0x2a')]);_0x5ba18d[_0xd234('0x30')]=_[_0xd234('0x2f')](_0x5982a8[_0xd234('0x2d')],qs['fields'](_0x13dbea['query'][_0xd234('0x31')]));_0x5ba18d[_0xd234('0x30')]=_0x5ba18d[_0xd234('0x30')][_0xd234('0x32')]?_0x5ba18d[_0xd234('0x30')]:_0x5982a8[_0xd234('0x2d')];if(_0x13dbea[_0xd234('0x2a')][_0xd234('0x33')]){_0x5ba18d[_0xd234('0x34')]=[{'all':!![]}];}_0x5ba18d=_['merge']({},_0x5ba18d,_0x13dbea['options']);return db[_0xd234('0x22')][_0xd234('0x35')](_0x5ba18d)['then'](handleEntityNotFound(_0x5636d2,null))['then'](respondWithResult(_0x5636d2,null))[_0xd234('0x36')](handleError(_0x5636d2,null));};exports[_0xd234('0x37')]=function(_0x3d6300,_0x5046dc){return db['SmsInteraction'][_0xd234('0x37')](_0x3d6300['body'],{})['then'](respondWithResult(_0x5046dc,0xc9))[_0xd234('0x36')](handleError(_0x5046dc,null));};exports[_0xd234('0x19')]=function(_0x92ad86,_0x2c2893){if(_0x92ad86[_0xd234('0x38')]['id']){delete _0x92ad86[_0xd234('0x38')]['id'];}return db['SmsInteraction'][_0xd234('0x35')]({'where':{'id':_0x92ad86[_0xd234('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2c2893,null))[_0xd234('0x1a')](saveUpdates(_0x92ad86[_0xd234('0x38')],null))['then'](respondWithResult(_0x2c2893,null))['catch'](handleError(_0x2c2893,null));};exports[_0xd234('0x1b')]=function(_0xff5138,_0x2ac2f4){return db[_0xd234('0x22')]['find']({'where':{'id':_0xff5138['params']['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0x2ac2f4,null))[_0xd234('0x1a')](removeEntity(_0x2ac2f4,null))[_0xd234('0x36')](handleError(_0x2ac2f4,null));};exports[_0xd234('0x39')]=function(_0x378114,_0x547ab2){return db[_0xd234('0x22')][_0xd234('0x39')]()[_0xd234('0x1a')](respondWithResult(_0x547ab2,null))[_0xd234('0x36')](handleError(_0x547ab2,null));};exports[_0xd234('0x3a')]=function(_0x24b742,_0x26cbf8){return db['SmsMessage'][_0xd234('0x35')]({'where':{'id':_0x24b742['params']['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0x26cbf8,null))[_0xd234('0x1a')](function(_0x210fbb){if(_0x210fbb){return _0x210fbb['addMessage'](_0x24b742['body'][_0xd234('0x3b')],_[_0xd234('0x3c')](_0x24b742[_0xd234('0x38')],[_0xd234('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x26cbf8,null))[_0xd234('0x36')](handleError(_0x26cbf8,null));};exports['getMessages']=function(_0x21e042,_0x20ea1f){var _0x294384={'raw':![],'where':{}};var _0x24b1b3={};var _0x1c9f87={'count':0x0,'rows':[]};return db[_0xd234('0x22')]['findOne']({'where':{'id':_0x21e042[_0xd234('0x2c')]['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0x20ea1f,null))['then'](function(_0x21f4db){if(_0x21f4db){_0x24b1b3['model']=_[_0xd234('0x2e')](db['SmsMessage'][_0xd234('0x23')]);_0x24b1b3[_0xd234('0x2a')]=_[_0xd234('0x2e')](_0x21e042[_0xd234('0x2a')]);_0x24b1b3['filters']=_[_0xd234('0x2f')](_0x24b1b3[_0xd234('0x2d')],_0x24b1b3[_0xd234('0x2a')]);_0x294384[_0xd234('0x30')]=_[_0xd234('0x2f')](_0x24b1b3[_0xd234('0x2d')],qs[_0xd234('0x31')](_0x21e042[_0xd234('0x2a')][_0xd234('0x31')]));_0x294384['attributes']=_0x294384[_0xd234('0x30')][_0xd234('0x32')]?_0x294384[_0xd234('0x30')]:_0x24b1b3[_0xd234('0x2d')];if(!_0x21e042[_0xd234('0x2a')][_0xd234('0x3d')](_0xd234('0x3e'))){_0x294384[_0xd234('0x16')]=qs[_0xd234('0x16')](_0x21e042[_0xd234('0x2a')][_0xd234('0x16')]);_0x294384['offset']=qs[_0xd234('0x14')](_0x21e042['query'][_0xd234('0x14')]);}_0x294384[_0xd234('0x3f')]=qs['sort'](_0x21e042[_0xd234('0x2a')][_0xd234('0x40')]);_0x294384[_0xd234('0x41')]=qs[_0xd234('0x42')](_[_0xd234('0x43')](_0x21e042['query'],_0x24b1b3['filters']));_0x294384[_0xd234('0x41')]['SmsInteractionId']=_0x21f4db['id'];if(_0x21e042['query'][_0xd234('0x44')]){_0x294384[_0xd234('0x41')]=_[_0xd234('0x45')](_0x294384[_0xd234('0x41')],{'$or':_['map'](_0x294384['attributes'],function(_0x559058){var _0x3add0f={};_0x3add0f[_0x559058]={'$like':'%'+_0x21e042[_0xd234('0x2a')][_0xd234('0x44')]+'%'};return _0x3add0f;})});}if(_0x21e042[_0xd234('0x2a')][_0xd234('0x46')]){var _0x513b11=_0x21e042[_0xd234('0x2a')]['$gte'][_0xd234('0x47')](',');var _0x3e8f4a={};_0x3e8f4a[_0x513b11[0x0]]={'$gte':moment(_0x513b11[0x1])[_0xd234('0x48')](_0xd234('0x49'))};_0x294384[_0xd234('0x41')]=_[_0xd234('0x45')](_0x294384[_0xd234('0x41')],_0x3e8f4a);}_0x294384=_['merge']({},_0x294384,_0x21e042[_0xd234('0x4a')]);return db['SmsMessage'][_0xd234('0x17')]({'where':_0x294384[_0xd234('0x41')]})[_0xd234('0x1a')](function(_0x8d7483){_0x1c9f87[_0xd234('0x17')]=_0x8d7483;if(_0x21e042[_0xd234('0x2a')][_0xd234('0x33')]){_0x294384['include']=[{'all':!![]}];}return db[_0xd234('0x4b')]['findAll'](_0x294384);})[_0xd234('0x1a')](function(_0x1d4a51){_0x1c9f87[_0xd234('0x4c')]=_0x1d4a51;return _0x1c9f87;});}})[_0xd234('0x1a')](respondWithFilteredResult(_0x20ea1f,_0x294384))[_0xd234('0x36')](handleError(_0x20ea1f,null));};exports[_0xd234('0x4d')]=function(_0x5c5508,_0xef2e53){return db[_0xd234('0x22')][_0xd234('0x35')]({'where':{'id':_0x5c5508[_0xd234('0x2c')]['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0xef2e53,null))['then'](function(_0x4dc215){if(_0x4dc215){return _0x4dc215[_0xd234('0x4e')](_0x5c5508[_0xd234('0x38')][_0xd234('0x3b')],_['omit'](_0x5c5508['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xd234('0x28')]({'attributes':['id',_0xd234('0x1e'),_0xd234('0x4f')],'where':{'id':_0x5c5508[_0xd234('0x38')][_0xd234('0x3b')]}});})[_0xd234('0x1a')](function(_0x4ec4bd){socket['emit'](_0xd234('0x50'),{'id':Number(_0x5c5508['params']['id']),'tags':_0x4ec4bd||[]});return{'id':Number(_0x5c5508[_0xd234('0x2c')]['id']),'tags':_0x4ec4bd||[]};});}})[_0xd234('0x1a')](respondWithResult(_0xef2e53,null))[_0xd234('0x36')](handleError(_0xef2e53,null));};exports['removeTags']=function(_0x49c892,_0x42e09a){return db['SmsInteraction'][_0xd234('0x35')]({'where':{'id':_0x49c892[_0xd234('0x2c')]['id']}})['then'](handleEntityNotFound(_0x42e09a,null))[_0xd234('0x1a')](function(_0x218d64){if(_0x218d64){return _0x218d64[_0xd234('0x51')](_0x49c892['query'][_0xd234('0x3b')]);}})[_0xd234('0x1a')](respondWithStatusCode(_0x42e09a,null))['catch'](handleError(_0x42e09a,null));};exports[_0xd234('0x52')]=function(_0x4fc9ea,_0x33a9b4){var _0xbbf51d=moment()['unix']()[_0xd234('0x53')]();var _0x4f2cc6=path[_0xd234('0x54')](config[_0xd234('0x55')],_0xd234('0x56'),_0xd234('0x57'),_0xd234('0x58'));var _0x2a84fa=path[_0xd234('0x54')](_0x4f2cc6,_0xbbf51d);var _0x52ba2a=util[_0xd234('0x48')](_0xd234('0x59'),_0x4fc9ea[_0xd234('0x2c')]['id'],_0xbbf51d);var _0x2aae43=path[_0xd234('0x54')](_0x4f2cc6,_0x52ba2a);var _0x57ccf8=[];_0x57ccf8[_0xd234('0x5a')]({'model':db['User'],'as':_0xd234('0x5b'),'attributes':['id',_0xd234('0x5c')],'raw':!![]});_0x57ccf8[_0xd234('0x5a')]({'model':db['CmContact'],'as':_0xd234('0x5d'),'attributes':['id',_0xd234('0x5e'),_0xd234('0x5f')],'raw':!![]});var _0xcf2387=[{'model':db[_0xd234('0x4b')],'as':'Messages','attributes':['id',_0xd234('0x38'),'createdAt',_0xd234('0x60'),_0xd234('0x61'),_0xd234('0x62')],'include':_0x57ccf8}];_0xcf2387[_0xd234('0x5a')]({'model':db[_0xd234('0x63')],'as':_0xd234('0x64'),'attributes':['id',_0xd234('0x1e')]});_0xcf2387[_0xd234('0x5a')]({'model':db['User'],'as':_0xd234('0x65'),'attributes':['id',_0xd234('0x5c')]});return db[_0xd234('0x22')][_0xd234('0x35')]({'where':{'id':_0x4fc9ea['params']['id']},'include':_0xcf2387})['then'](handleEntityNotFound(_0x33a9b4,null))[_0xd234('0x1a')](function(_0x370aba){if(_0x370aba){var _0x46b8b4=_0x370aba[_0xd234('0x66')]({'plain':!![]});fs['mkdirSync'](_0x2a84fa);var _0x4e6268={'channel':'Sms','account':_0x46b8b4[_0xd234('0x64')][_0xd234('0x1e')],'agent':_0x46b8b4[_0xd234('0x65')]?_0x46b8b4[_0xd234('0x65')][_0xd234('0x5c')]:_0xd234('0x67'),'createdAt':moment(_0x46b8b4[_0xd234('0x68')])[_0xd234('0x48')](_0xd234('0x49'))[_0xd234('0x53')](),'closedAt':_0x46b8b4['closed']?moment(_0x46b8b4[_0xd234('0x69')])[_0xd234('0x48')](_0xd234('0x49'))[_0xd234('0x53')]():'','disposition':_0x46b8b4[_0xd234('0x6a')],'messages':_(_0x46b8b4[_0xd234('0x6b')])[_0xd234('0x44')]({'secret':![]})['map'](function(_0x303bf9){return{'date':moment(_0x303bf9[_0xd234('0x68')])[_0xd234('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd234('0x53')](),'sender':_0x303bf9[_0xd234('0x60')]===_0xd234('0x6c')?_0x303bf9[_0xd234('0x5b')]?_0x303bf9[_0xd234('0x5b')]['fullname']:_0xd234('0x6d'):_0x303bf9[_0xd234('0x5d')]['firstName']+(_0x303bf9[_0xd234('0x5d')][_0xd234('0x5f')]?'\x20'+_0x303bf9[_0xd234('0x5d')][_0xd234('0x5f')]:''),'body':_0x303bf9[_0xd234('0x38')],'direction':_0x303bf9[_0xd234('0x60')]===_0xd234('0x6c')?'A':'C','secret':_0x303bf9[_0xd234('0x61')],'read':_0x303bf9[_0xd234('0x62')]};})[_0xd234('0x6e')]()};return ejs[_0xd234('0x6f')](path[_0xd234('0x54')](config['root'],_0xd234('0x56'),'views',_0xd234('0x70')),{'interaction':_0x4e6268})[_0xd234('0x1a')](function(_0x517282){var _0x1a22f4=path['join'](_0x2a84fa,_0xd234('0x71')+_0x46b8b4['id']+'-'+_0xbbf51d+_0xd234('0x72'));var _0x268e4f={'path':_0x1a22f4,'channel':_0xd234('0x73'),'interactionId':_0x46b8b4['id']};return pdf[_0xd234('0x74')](_0x517282,_0x268e4f);})[_0xd234('0x1a')](function(){return new BPromise(function(_0x438b56,_0x18a582){zipdir(_0x2a84fa,{'saveTo':_0x2aae43},function(_0x21e077,_0xad415b){if(_0x21e077)return _0x18a582(_0x21e077);return _0x438b56(_0xad415b);});})['then'](function(){return new BPromise(function(_0x25afa6,_0x5d0b9d){rimraf(_0x2a84fa,function(_0x27b9bc){if(_0x27b9bc)_0x5d0b9d(_0x27b9bc);return _0x25afa6();});});})[_0xd234('0x1a')](function(){return _0x33a9b4[_0xd234('0x52')](_0x2aae43,_0x52ba2a,function(_0x58ec22){if(_0x58ec22){console['log'](_0xd234('0x75'),_0x58ec22);}else{fs[_0xd234('0x76')](_0x2aae43);}});});});}else{return _0x33a9b4['sendStatus'](0xc8);}})[_0xd234('0x36')](handleError(_0x33a9b4,null));}; \ No newline at end of file +var _0x3a2c=['emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','format','User','push','CmContact','Contact','lastName','Messages','createdAt','direction','SmsAccount','Account','Owner','fullname','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','out','System','firstName','secret','read','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','show','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','create','body','find','params','describe','addMessage','omit','ids','getMessages','findOne','SmsMessage','length','hasOwnProperty','order','sort','where','filter','$gte','split','rows','addTags','setTags','spread','Tag','color'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x3a2c,0xa5));var _0xc3a2=function(_0x2f5071,_0x4a7a74){_0x2f5071=_0x2f5071-0x0;var _0x493e54=_0x3a2c[_0x2f5071];return _0x493e54;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc3a2('0x0'));var moment=require(_0xc3a2('0x1'));var BPromise=require(_0xc3a2('0x2'));var util=require(_0xc3a2('0x3'));var path=require(_0xc3a2('0x4'));var ejs=require(_0xc3a2('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc3a2('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xc3a2('0x7'));var pdf=require(_0xc3a2('0x8'));var logger=require(_0xc3a2('0x9'))(_0xc3a2('0xa'));var config=require(_0xc3a2('0xb'));var db=require(_0xc3a2('0xc'))['db'];config[_0xc3a2('0xd')]=_['defaults'](config['redis'],{'host':_0xc3a2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3a2('0xd')]));require('./smsInteraction.socket')[_0xc3a2('0xf')](socket);function respondWithStatusCode(_0x175842,_0x56d73c){_0x56d73c=_0x56d73c||0xcc;return function(_0x42e389){if(_0x42e389){return _0x175842[_0xc3a2('0x10')](_0x56d73c);}return _0x175842['status'](_0x56d73c)[_0xc3a2('0x11')]();};}function respondWithResult(_0x203555,_0x47bd8a){_0x47bd8a=_0x47bd8a||0xc8;return function(_0x2de2d0){if(_0x2de2d0){return _0x203555[_0xc3a2('0x12')](_0x47bd8a)[_0xc3a2('0x13')](_0x2de2d0);}};}function respondWithFilteredResult(_0x715eee,_0xebf6e7){return function(_0x31af7e){if(_0x31af7e){var _0x4efb90=typeof _0xebf6e7[_0xc3a2('0x14')]===_0xc3a2('0x15')&&typeof _0xebf6e7[_0xc3a2('0x16')]==='undefined';var _0x3a4e45=_0x31af7e['count'];var _0x2d8615=_0x4efb90?0x0:_0xebf6e7[_0xc3a2('0x14')];var _0x431b02=_0x4efb90?_0x31af7e[_0xc3a2('0x17')]:_0xebf6e7[_0xc3a2('0x14')]+_0xebf6e7[_0xc3a2('0x16')];var _0x241de3;if(_0x431b02>=_0x3a4e45){_0x431b02=_0x3a4e45;_0x241de3=0xc8;}else{_0x241de3=0xce;}_0x715eee['status'](_0x241de3);return _0x715eee[_0xc3a2('0x18')](_0xc3a2('0x19'),_0x2d8615+'-'+_0x431b02+'/'+_0x3a4e45)[_0xc3a2('0x13')](_0x31af7e);}return null;};}function saveUpdates(_0x48894b){return function(_0x588fb9){if(_0x588fb9){return _0x588fb9[_0xc3a2('0x1a')](_0x48894b)[_0xc3a2('0x1b')](function(_0x2a4653){return _0x2a4653;});}return null;};}function removeEntity(_0x1aafb6){return function(_0xe35b6c){if(_0xe35b6c){return _0xe35b6c[_0xc3a2('0x1c')]()['then'](function(){_0x1aafb6[_0xc3a2('0x12')](0xcc)[_0xc3a2('0x11')]();});}};}function handleEntityNotFound(_0x2c12a1){return function(_0x27fbb9){if(!_0x27fbb9){_0x2c12a1[_0xc3a2('0x10')](0x194);}return _0x27fbb9;};}function handleError(_0x5e3e19,_0x54f2ad){_0x54f2ad=_0x54f2ad||0x1f4;return function(_0x713d0){logger[_0xc3a2('0x1d')](_0x713d0[_0xc3a2('0x1e')]);if(_0x713d0[_0xc3a2('0x1f')]){delete _0x713d0[_0xc3a2('0x1f')];}_0x5e3e19[_0xc3a2('0x12')](_0x54f2ad)[_0xc3a2('0x20')](_0x713d0);};}exports[_0xc3a2('0x21')]=function(_0xf974b0,_0x3db3f5){var _0x2879d7={};var _0x532e60=_[_0xc3a2('0x22')](db[_0xc3a2('0x23')][_0xc3a2('0x24')],function(_0x503b88){return{'name':_0x503b88[_0xc3a2('0x25')],'type':_0x503b88[_0xc3a2('0x26')][_0xc3a2('0x27')]};});_0x2879d7=qs[_0xc3a2('0x28')](_0x532e60,_0xf974b0);return interaction[_0xc3a2('0x29')](_0xc3a2('0x2a'),_0xf974b0[_0xc3a2('0x2b')],_0xf974b0['user'],_0x2879d7,_0x532e60)[_0xc3a2('0x1b')](respondWithFilteredResult(_0x3db3f5,_0x2879d7))['catch'](handleError(_0x3db3f5,null));};exports[_0xc3a2('0x2c')]=function(_0x251676,_0x45eb79){var _0xa64aeb={'raw':![],'where':{'id':_0x251676['params']['id']}},_0x29efeb={};_0x29efeb[_0xc3a2('0x2d')]=_[_0xc3a2('0x2e')](db[_0xc3a2('0x23')]['rawAttributes']);_0x29efeb[_0xc3a2('0x2b')]=_[_0xc3a2('0x2e')](_0x251676[_0xc3a2('0x2b')]);_0x29efeb[_0xc3a2('0x2f')]=_[_0xc3a2('0x30')](_0x29efeb['model'],_0x29efeb[_0xc3a2('0x2b')]);_0xa64aeb[_0xc3a2('0x31')]=_[_0xc3a2('0x30')](_0x29efeb['model'],qs[_0xc3a2('0x32')](_0x251676[_0xc3a2('0x2b')]['fields']));_0xa64aeb[_0xc3a2('0x31')]=_0xa64aeb[_0xc3a2('0x31')]['length']?_0xa64aeb[_0xc3a2('0x31')]:_0x29efeb[_0xc3a2('0x2d')];if(_0x251676[_0xc3a2('0x2b')][_0xc3a2('0x33')]){_0xa64aeb[_0xc3a2('0x34')]=[{'all':!![]}];}_0xa64aeb=_[_0xc3a2('0x35')]({},_0xa64aeb,_0x251676[_0xc3a2('0x36')]);return db[_0xc3a2('0x23')]['find'](_0xa64aeb)[_0xc3a2('0x1b')](handleEntityNotFound(_0x45eb79,null))[_0xc3a2('0x1b')](respondWithResult(_0x45eb79,null))[_0xc3a2('0x37')](handleError(_0x45eb79,null));};exports[_0xc3a2('0x38')]=function(_0x11b431,_0xc8a69){return db[_0xc3a2('0x23')][_0xc3a2('0x38')](_0x11b431[_0xc3a2('0x39')],{})['then'](respondWithResult(_0xc8a69,0xc9))[_0xc3a2('0x37')](handleError(_0xc8a69,null));};exports['update']=function(_0x35964a,_0x59e3e5){if(_0x35964a['body']['id']){delete _0x35964a[_0xc3a2('0x39')]['id'];}return db[_0xc3a2('0x23')][_0xc3a2('0x3a')]({'where':{'id':_0x35964a['params']['id']}})[_0xc3a2('0x1b')](handleEntityNotFound(_0x59e3e5,null))[_0xc3a2('0x1b')](saveUpdates(_0x35964a[_0xc3a2('0x39')],null))[_0xc3a2('0x1b')](respondWithResult(_0x59e3e5,null))[_0xc3a2('0x37')](handleError(_0x59e3e5,null));};exports[_0xc3a2('0x1c')]=function(_0xf19c05,_0x5e3753){return db[_0xc3a2('0x23')][_0xc3a2('0x3a')]({'where':{'id':_0xf19c05[_0xc3a2('0x3b')]['id']}})[_0xc3a2('0x1b')](handleEntityNotFound(_0x5e3753,null))['then'](removeEntity(_0x5e3753,null))['catch'](handleError(_0x5e3753,null));};exports[_0xc3a2('0x3c')]=function(_0x5af6aa,_0x2833ac){return db[_0xc3a2('0x23')][_0xc3a2('0x3c')]()['then'](respondWithResult(_0x2833ac,null))[_0xc3a2('0x37')](handleError(_0x2833ac,null));};exports[_0xc3a2('0x3d')]=function(_0x17e933,_0x141ca9){return db['SmsMessage'][_0xc3a2('0x3a')]({'where':{'id':_0x17e933[_0xc3a2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x141ca9,null))[_0xc3a2('0x1b')](function(_0x3f60f6){if(_0x3f60f6){return _0x3f60f6[_0xc3a2('0x3d')](_0x17e933[_0xc3a2('0x39')]['ids'],_[_0xc3a2('0x3e')](_0x17e933[_0xc3a2('0x39')],[_0xc3a2('0x3f'),'id'])||{});}})[_0xc3a2('0x1b')](respondWithResult(_0x141ca9,null))[_0xc3a2('0x37')](handleError(_0x141ca9,null));};exports[_0xc3a2('0x40')]=function(_0xd39599,_0x19b970){var _0x4f8741={'raw':![],'where':{}};var _0x491f52={};var _0x2ffc2a={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xc3a2('0x41')]({'where':{'id':_0xd39599[_0xc3a2('0x3b')]['id']}})[_0xc3a2('0x1b')](handleEntityNotFound(_0x19b970,null))[_0xc3a2('0x1b')](function(_0x5e99bc){if(_0x5e99bc){_0x491f52[_0xc3a2('0x2d')]=_[_0xc3a2('0x2e')](db[_0xc3a2('0x42')]['rawAttributes']);_0x491f52[_0xc3a2('0x2b')]=_[_0xc3a2('0x2e')](_0xd39599[_0xc3a2('0x2b')]);_0x491f52['filters']=_['intersection'](_0x491f52[_0xc3a2('0x2d')],_0x491f52[_0xc3a2('0x2b')]);_0x4f8741[_0xc3a2('0x31')]=_['intersection'](_0x491f52['model'],qs['fields'](_0xd39599[_0xc3a2('0x2b')]['fields']));_0x4f8741[_0xc3a2('0x31')]=_0x4f8741['attributes'][_0xc3a2('0x43')]?_0x4f8741['attributes']:_0x491f52[_0xc3a2('0x2d')];if(!_0xd39599[_0xc3a2('0x2b')][_0xc3a2('0x44')]('nolimit')){_0x4f8741[_0xc3a2('0x16')]=qs['limit'](_0xd39599['query'][_0xc3a2('0x16')]);_0x4f8741[_0xc3a2('0x14')]=qs[_0xc3a2('0x14')](_0xd39599[_0xc3a2('0x2b')]['offset']);}_0x4f8741[_0xc3a2('0x45')]=qs[_0xc3a2('0x46')](_0xd39599['query']['sort']);_0x4f8741[_0xc3a2('0x47')]=qs[_0xc3a2('0x2f')](_['pick'](_0xd39599['query'],_0x491f52[_0xc3a2('0x2f')]));_0x4f8741[_0xc3a2('0x47')]['SmsInteractionId']=_0x5e99bc['id'];if(_0xd39599['query'][_0xc3a2('0x48')]){_0x4f8741['where']=_[_0xc3a2('0x35')](_0x4f8741[_0xc3a2('0x47')],{'$or':_[_0xc3a2('0x22')](_0x4f8741[_0xc3a2('0x31')],function(_0xedccf4){var _0x20af34={};_0x20af34[_0xedccf4]={'$like':'%'+_0xd39599[_0xc3a2('0x2b')][_0xc3a2('0x48')]+'%'};return _0x20af34;})});}if(_0xd39599[_0xc3a2('0x2b')][_0xc3a2('0x49')]){var _0x84da3f=_0xd39599['query']['$gte'][_0xc3a2('0x4a')](',');var _0x1e4bea={};_0x1e4bea[_0x84da3f[0x0]]={'$gte':moment(_0x84da3f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4f8741[_0xc3a2('0x47')]=_[_0xc3a2('0x35')](_0x4f8741['where'],_0x1e4bea);}_0x4f8741=_[_0xc3a2('0x35')]({},_0x4f8741,_0xd39599[_0xc3a2('0x36')]);return db['SmsMessage']['count']({'where':_0x4f8741['where']})[_0xc3a2('0x1b')](function(_0xdfe1a6){_0x2ffc2a[_0xc3a2('0x17')]=_0xdfe1a6;if(_0xd39599['query'][_0xc3a2('0x33')]){_0x4f8741[_0xc3a2('0x34')]=[{'all':!![]}];}return db[_0xc3a2('0x42')]['findAll'](_0x4f8741);})['then'](function(_0x3d4c7e){_0x2ffc2a[_0xc3a2('0x4b')]=_0x3d4c7e;return _0x2ffc2a;});}})[_0xc3a2('0x1b')](respondWithFilteredResult(_0x19b970,_0x4f8741))[_0xc3a2('0x37')](handleError(_0x19b970,null));};exports[_0xc3a2('0x4c')]=function(_0x99fb4d,_0x461357){return db[_0xc3a2('0x23')]['find']({'where':{'id':_0x99fb4d[_0xc3a2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x461357,null))[_0xc3a2('0x1b')](function(_0x26eeb4){if(_0x26eeb4){return _0x26eeb4[_0xc3a2('0x4d')](_0x99fb4d['body']['ids'],_[_0xc3a2('0x3e')](_0x99fb4d['body'],['ids','id'])||{})[_0xc3a2('0x4e')](function(){return db[_0xc3a2('0x4f')][_0xc3a2('0x29')]({'attributes':['id',_0xc3a2('0x1f'),_0xc3a2('0x50')],'where':{'id':_0x99fb4d[_0xc3a2('0x39')]['ids']}});})[_0xc3a2('0x1b')](function(_0x5f4de9){socket[_0xc3a2('0x51')](_0xc3a2('0x52'),{'id':Number(_0x99fb4d[_0xc3a2('0x3b')]['id']),'tags':_0x5f4de9||[]});return{'id':Number(_0x99fb4d['params']['id']),'tags':_0x5f4de9||[]};});}})[_0xc3a2('0x1b')](respondWithResult(_0x461357,null))[_0xc3a2('0x37')](handleError(_0x461357,null));};exports[_0xc3a2('0x53')]=function(_0x1491ae,_0x4f882d){return db['SmsInteraction'][_0xc3a2('0x3a')]({'where':{'id':_0x1491ae[_0xc3a2('0x3b')]['id']}})[_0xc3a2('0x1b')](handleEntityNotFound(_0x4f882d,null))['then'](function(_0x2563c6){if(_0x2563c6){return _0x2563c6[_0xc3a2('0x53')](_0x1491ae[_0xc3a2('0x2b')][_0xc3a2('0x3f')]);}})[_0xc3a2('0x1b')](respondWithStatusCode(_0x4f882d,null))['catch'](handleError(_0x4f882d,null));};exports[_0xc3a2('0x54')]=function(_0x306e59,_0x394625){var _0x5340d7=moment()[_0xc3a2('0x55')]()['toString']();var _0x1925fc=path[_0xc3a2('0x56')](config[_0xc3a2('0x57')],_0xc3a2('0x58'),_0xc3a2('0x59'),'tmp');var _0x3892b1=path[_0xc3a2('0x56')](_0x1925fc,_0x5340d7);var _0x4a7567=util[_0xc3a2('0x5a')]('transcript-%d-%s.zip',_0x306e59['params']['id'],_0x5340d7);var _0x44aee1=path[_0xc3a2('0x56')](_0x1925fc,_0x4a7567);var _0x2bd03b=[];_0x2bd03b['push']({'model':db[_0xc3a2('0x5b')],'as':_0xc3a2('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x2bd03b[_0xc3a2('0x5c')]({'model':db[_0xc3a2('0x5d')],'as':_0xc3a2('0x5e'),'attributes':['id','firstName',_0xc3a2('0x5f')],'raw':!![]});var _0x491fba=[{'model':db[_0xc3a2('0x42')],'as':_0xc3a2('0x60'),'attributes':['id','body',_0xc3a2('0x61'),_0xc3a2('0x62'),'secret','read'],'include':_0x2bd03b}];_0x491fba['push']({'model':db[_0xc3a2('0x63')],'as':_0xc3a2('0x64'),'attributes':['id',_0xc3a2('0x1f')]});_0x491fba[_0xc3a2('0x5c')]({'model':db['User'],'as':_0xc3a2('0x65'),'attributes':['id',_0xc3a2('0x66')]});return db[_0xc3a2('0x23')]['find']({'where':{'id':_0x306e59['params']['id']},'include':_0x491fba})['then'](handleEntityNotFound(_0x394625,null))[_0xc3a2('0x1b')](function(_0x500986){if(_0x500986){var _0x15b663=_0x500986[_0xc3a2('0x67')]({'plain':!![]});fs[_0xc3a2('0x68')](_0x3892b1);var _0x18758c={'channel':'Sms','account':_0x15b663['Account'][_0xc3a2('0x1f')],'agent':_0x15b663[_0xc3a2('0x65')]?_0x15b663[_0xc3a2('0x65')]['fullname']:_0xc3a2('0x69'),'createdAt':moment(_0x15b663[_0xc3a2('0x61')])[_0xc3a2('0x5a')](_0xc3a2('0x6a'))[_0xc3a2('0x6b')](),'closedAt':_0x15b663[_0xc3a2('0x6c')]?moment(_0x15b663[_0xc3a2('0x6d')])[_0xc3a2('0x5a')](_0xc3a2('0x6a'))[_0xc3a2('0x6b')]():'','disposition':_0x15b663[_0xc3a2('0x6e')],'messages':_(_0x15b663[_0xc3a2('0x60')])[_0xc3a2('0x48')]({'secret':![]})[_0xc3a2('0x22')](function(_0x5565ef){return{'date':moment(_0x5565ef[_0xc3a2('0x61')])[_0xc3a2('0x5a')](_0xc3a2('0x6a'))['toString'](),'sender':_0x5565ef['direction']===_0xc3a2('0x6f')?_0x5565ef[_0xc3a2('0x5b')]?_0x5565ef[_0xc3a2('0x5b')]['fullname']:_0xc3a2('0x70'):_0x5565ef[_0xc3a2('0x5e')][_0xc3a2('0x71')]+(_0x5565ef['Contact']['lastName']?'\x20'+_0x5565ef[_0xc3a2('0x5e')][_0xc3a2('0x5f')]:''),'body':_0x5565ef['body'],'direction':_0x5565ef[_0xc3a2('0x62')]===_0xc3a2('0x6f')?'A':'C','secret':_0x5565ef[_0xc3a2('0x72')],'read':_0x5565ef[_0xc3a2('0x73')]};})[_0xc3a2('0x74')]()};return ejs['renderFile'](path[_0xc3a2('0x56')](config[_0xc3a2('0x57')],_0xc3a2('0x58'),'views',_0xc3a2('0x75')),{'interaction':_0x18758c})[_0xc3a2('0x1b')](function(_0x164bb0){var _0xf400b0=path[_0xc3a2('0x56')](_0x3892b1,_0xc3a2('0x76')+_0x15b663['id']+'-'+_0x5340d7+_0xc3a2('0x77'));var _0x56a5d6={'path':_0xf400b0,'channel':'Sms','interactionId':_0x15b663['id']};return pdf[_0xc3a2('0x78')](_0x164bb0,_0x56a5d6);})[_0xc3a2('0x1b')](function(){return new BPromise(function(_0x430bae,_0x4700af){zipdir(_0x3892b1,{'saveTo':_0x44aee1},function(_0x1a6fa2,_0x3a4cc0){if(_0x1a6fa2)return _0x4700af(_0x1a6fa2);return _0x430bae(_0x3a4cc0);});})[_0xc3a2('0x1b')](function(){return new BPromise(function(_0x212abf,_0x309dce){rimraf(_0x3892b1,function(_0x1a1b3e){if(_0x1a1b3e)_0x309dce(_0x1a1b3e);return _0x212abf();});});})[_0xc3a2('0x1b')](function(){return _0x394625[_0xc3a2('0x54')](_0x44aee1,_0x4a7567,function(_0x4f13f2){if(_0x4f13f2){console[_0xc3a2('0x79')](_0xc3a2('0x7a'),_0x4f13f2);}else{fs['unlinkSync'](_0x44aee1);}});});});}else{return _0x394625[_0xc3a2('0x10')](0xc8);}})['catch'](handleError(_0x394625,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ff08130..b7ea9c4 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 _0x5fdc=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','map'];(function(_0x1cca0d,_0x19e33c){var _0x2185b8=function(_0x147f3c){while(--_0x147f3c){_0x1cca0d['push'](_0x1cca0d['shift']());}};_0x2185b8(++_0x19e33c);}(_0x5fdc,0x127));var _0xc5fd=function(_0x278617,_0x51d07f){_0x278617=_0x278617-0x0;var _0x5384b3=_0x5fdc[_0x278617];return _0x5384b3;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var SmsInteraction=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var SmsMessage=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5fd('0x4')](0x0);var events={'afterCreate':_0xc5fd('0x5'),'afterUpdate':_0xc5fd('0x6'),'afterDestroy':_0xc5fd('0x7')};function emitEvent(_0x1b6205){return function(_0xca27a0,_0xea5748,_0x44722b){_0xca27a0[_0xc5fd('0x8')]({'attributes':['id'],'raw':!![]})[_0xc5fd('0x9')](function(_0x5a2eb4){_0xca27a0['setDataValue']('Users',_0x5a2eb4[_0xc5fd('0xa')](function(_0x46bce3){return{'id':_0x46bce3['id']};}));return SmsMessage[_0xc5fd('0xb')]({'where':{'SmsInteractionId':_0xca27a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5fd('0x9')](function(_0x4e6d35){_0xca27a0['setDataValue'](_0xc5fd('0xc'),_0x4e6d35[_0xc5fd('0xd')]);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205+':'+_0xca27a0['id'],_0xca27a0);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205,_0xca27a0);_0x44722b(null);})[_0xc5fd('0xf')](_0x44722b(null));};}for(var e in events){if(events[_0xc5fd('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc5fd('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x59ead5,_0x21ca16){var _0x2526e4=function(_0x58a3f7){while(--_0x58a3f7){_0x59ead5['push'](_0x59ead5['shift']());}};_0x2526e4(++_0x21ca16);}(_0x1399,0x16c));var _0x9139=function(_0x3b7a19,_0xeeeb06){_0x3b7a19=_0x3b7a19-0x0;var _0x970876=_0x1399[_0x3b7a19];return _0x970876;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2ae1bc4..4020fe2 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 _0xefda=['lodash','../../config/logger','api','moment','path','rimraf','exports','define','SmsInteraction','closed','closedAt','format'];(function(_0x53cc96,_0xcada22){var _0x79eb8=function(_0x37747f){while(--_0x37747f){_0x53cc96['push'](_0x53cc96['shift']());}};_0x79eb8(++_0xcada22);}(_0xefda,0x1ec));var _0xaefd=function(_0x9d631c,_0x37f0fd){_0x9d631c=_0x9d631c-0x0;var _0xee8e8=_0xefda[_0x9d631c];return _0xee8e8;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require(_0xaefd('0x1'))(_0xaefd('0x2'));var moment=require(_0xaefd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xaefd('0x6')]=function(_0x3a5a97,_0x2ffb64){return _0x3a5a97[_0xaefd('0x7')](_0xaefd('0x8'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x73c796,_0x1e77b7,_0x44d202){if(_0x73c796['changed'](_0xaefd('0x9'))){_0x73c796[_0xaefd('0xa')]=moment()[_0xaefd('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x44d202(null,_0x73c796);}}});}; \ No newline at end of file +var _0x2807=['changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions'];(function(_0x16dcd6,_0x18c8b0){var _0x419b82=function(_0x49232b){while(--_0x49232b){_0x16dcd6['push'](_0x16dcd6['shift']());}};_0x419b82(++_0x18c8b0);}(_0x2807,0x1ca));var _0x7280=function(_0x54f57a,_0x4f08fb){_0x54f57a=_0x54f57a-0x0;var _0x175896=_0x2807[_0x54f57a];return _0x175896;};'use strict';var _=require(_0x7280('0x0'));var util=require(_0x7280('0x1'));var logger=require(_0x7280('0x2'))(_0x7280('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7280('0x4'));var config=require(_0x7280('0x5'));var attributes=require('./smsInteraction.attributes');module[_0x7280('0x6')]=function(_0xd13054,_0x2f0d79){return _0xd13054[_0x7280('0x7')](_0x7280('0x8'),attributes,{'tableName':_0x7280('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c66e7,_0x4e3582,_0x3d4170){if(_0x4c66e7[_0x7280('0xa')]('closed')){_0x4c66e7[_0x7280('0xb')]=moment()['format'](_0x7280('0xc'));}_0x3d4170(null,_0x4c66e7);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 81e9a28..9334b58 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 _0x1d16=['attributes','limit','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw'];(function(_0x574162,_0x2425ea){var _0x39c245=function(_0x46653f){while(--_0x46653f){_0x574162['push'](_0x574162['shift']());}};_0x39c245(++_0x2425ea);}(_0x1d16,0x10c));var _0x61d1=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x1d16[_0x175e89];return _0x2ed996;};'use strict';var _=require('lodash');var util=require(_0x61d1('0x0'));var moment=require('moment');var BPromise=require(_0x61d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61d1('0x2'));var db=require(_0x61d1('0x3'))['db'];var utils=require(_0x61d1('0x4'));var logger=require(_0x61d1('0x5'))(_0x61d1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x61d1('0x7')][_0x61d1('0x8')]({'port':0x232a});config[_0x61d1('0x9')]=_[_0x61d1('0xa')](config['redis'],{'host':_0x61d1('0xb'),'port':0x18eb});var socket=require(_0x61d1('0xc'))(new Redis(config[_0x61d1('0x9')]));require(_0x61d1('0xd'))[_0x61d1('0xe')](socket);function respondWithRpcPromise(_0x3823ab,_0x461b66,_0x18fb55){return new BPromise(function(_0x4f986c,_0x5d6701){return client[_0x61d1('0xf')](_0x3823ab,_0x18fb55)[_0x61d1('0x10')](function(_0x4e780c){logger[_0x61d1('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x461b66,'request\x20sent');logger[_0x61d1('0x12')](_0x61d1('0x13'),_0x461b66,'request\x20sent',JSON[_0x61d1('0x14')](_0x4e780c));if(_0x4e780c[_0x61d1('0x15')]){if(_0x4e780c[_0x61d1('0x15')][_0x61d1('0x16')]===0x1f4){logger[_0x61d1('0x15')](_0x61d1('0x17'),_0x461b66,_0x4e780c['error']['message']);return _0x5d6701(_0x4e780c[_0x61d1('0x15')][_0x61d1('0x18')]);}logger[_0x61d1('0x15')](_0x61d1('0x17'),_0x461b66,_0x4e780c[_0x61d1('0x15')][_0x61d1('0x18')]);return _0x4f986c(_0x4e780c[_0x61d1('0x15')][_0x61d1('0x18')]);}else{logger[_0x61d1('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x461b66,'request\x20sent');_0x4f986c(_0x4e780c[_0x61d1('0x19')]['message']);}})[_0x61d1('0x1a')](function(_0x4d03fe){logger[_0x61d1('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x461b66,_0x4d03fe);_0x5d6701(_0x4d03fe);});});}exports[_0x61d1('0x1b')]=function(_0x495c02){var _0x2fefbd=this;return new Promise(function(_0x550397,_0x2d8c34){return db[_0x61d1('0x1c')][_0x61d1('0x1d')](_0x495c02[_0x61d1('0x1e')],{'raw':_0x495c02[_0x61d1('0x1f')]?_0x495c02[_0x61d1('0x1f')][_0x61d1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x495c02[_0x61d1('0x1f')]?_0x495c02[_0x61d1('0x1f')]['where']||null:null,'attributes':_0x495c02[_0x61d1('0x1f')]?_0x495c02[_0x61d1('0x1f')][_0x61d1('0x21')]||null:null,'limit':_0x495c02[_0x61d1('0x1f')]?_0x495c02[_0x61d1('0x1f')][_0x61d1('0x22')]||null:null})[_0x61d1('0x10')](function(_0x30edf4){logger[_0x61d1('0x11')](_0x61d1('0x1b'),_0x495c02);logger[_0x61d1('0x12')](_0x61d1('0x1b'),_0x495c02,JSON[_0x61d1('0x14')](_0x30edf4));_0x550397(_0x30edf4);})[_0x61d1('0x1a')](function(_0x4ba3a9){logger['error'](_0x61d1('0x1b'),_0x4ba3a9['message'],_0x495c02);_0x2d8c34(_0x2fefbd[_0x61d1('0x15')](0x1f4,_0x4ba3a9[_0x61d1('0x18')]));});});};exports[_0x61d1('0x23')]=function(_0x1cacec){return new Promise(function(_0x14a047,_0x114a9f){return db[_0x61d1('0x1c')][_0x61d1('0x24')]({'where':_0x1cacec[_0x61d1('0x1f')]?_0x1cacec[_0x61d1('0x1f')][_0x61d1('0x25')]||null:null})['then'](function(_0x4d26b3){if(_0x4d26b3){return _0x4d26b3[_0x61d1('0x26')](_0x1cacec['body'][_0x61d1('0x27')],_[_0x61d1('0x28')](_0x1cacec[_0x61d1('0x1e')],[_0x61d1('0x27'),'id'])||{});}})[_0x61d1('0x29')](function(_0x5250cd){logger['info'](_0x61d1('0x2a'),_0x1cacec);logger[_0x61d1('0x12')](_0x61d1('0x2a'),_0x1cacec,JSON[_0x61d1('0x14')](_0x5250cd));_0x14a047(_0x5250cd);})[_0x61d1('0x1a')](function(_0x6a0f3f){logger[_0x61d1('0x15')](_0x61d1('0x2a'),_0x6a0f3f[_0x61d1('0x18')],_0x1cacec);_0x114a9f(_this[_0x61d1('0x15')](0x1f4,_0x6a0f3f[_0x61d1('0x18')]));});});}; \ No newline at end of file +var _0x4ac5=['then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x4ac5,0x160));var _0x54ac=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x4ac5[_0xed5f9c];return _0x3a1c43;};'use strict';var _=require(_0x54ac('0x0'));var util=require(_0x54ac('0x1'));var moment=require(_0x54ac('0x2'));var BPromise=require(_0x54ac('0x3'));var rs=require(_0x54ac('0x4'));var fs=require('fs');var Redis=require(_0x54ac('0x5'));var db=require(_0x54ac('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54ac('0x7'));var config=require(_0x54ac('0x8'));var jayson=require(_0x54ac('0x9'));var client=jayson[_0x54ac('0xa')]['http']({'port':0x232a});config[_0x54ac('0xb')]=_[_0x54ac('0xc')](config[_0x54ac('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x54ac('0xd'))(new Redis(config[_0x54ac('0xb')]));require(_0x54ac('0xe'))[_0x54ac('0xf')](socket);function respondWithRpcPromise(_0x3c790f,_0x3f5ea6,_0x1332c2){return new BPromise(function(_0x57b231,_0x311883){return client[_0x54ac('0x10')](_0x3c790f,_0x1332c2)[_0x54ac('0x11')](function(_0x2bb155){logger['info'](_0x54ac('0x12'),_0x3f5ea6,_0x54ac('0x13'));logger[_0x54ac('0x14')](_0x54ac('0x15'),_0x3f5ea6,'request\x20sent',JSON[_0x54ac('0x16')](_0x2bb155));if(_0x2bb155[_0x54ac('0x17')]){if(_0x2bb155[_0x54ac('0x17')][_0x54ac('0x18')]===0x1f4){logger[_0x54ac('0x17')](_0x54ac('0x12'),_0x3f5ea6,_0x2bb155[_0x54ac('0x17')][_0x54ac('0x19')]);return _0x311883(_0x2bb155[_0x54ac('0x17')][_0x54ac('0x19')]);}logger[_0x54ac('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x3f5ea6,_0x2bb155[_0x54ac('0x17')][_0x54ac('0x19')]);return _0x57b231(_0x2bb155[_0x54ac('0x17')][_0x54ac('0x19')]);}else{logger[_0x54ac('0x1a')](_0x54ac('0x12'),_0x3f5ea6,_0x54ac('0x13'));_0x57b231(_0x2bb155[_0x54ac('0x1b')][_0x54ac('0x19')]);}})[_0x54ac('0x1c')](function(_0x40d44e){logger[_0x54ac('0x17')](_0x54ac('0x12'),_0x3f5ea6,_0x40d44e);_0x311883(_0x40d44e);});});}exports['UpdateSmsInteraction']=function(_0x3657af){var _0x559667=this;return new Promise(function(_0x57dfe0,_0x16dae0){return db['SmsInteraction']['update'](_0x3657af['body'],{'raw':_0x3657af[_0x54ac('0x1d')]?_0x3657af['options'][_0x54ac('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3657af[_0x54ac('0x1d')]?_0x3657af['options'][_0x54ac('0x1f')]||null:null,'attributes':_0x3657af[_0x54ac('0x1d')]?_0x3657af[_0x54ac('0x1d')][_0x54ac('0x20')]||null:null,'limit':_0x3657af[_0x54ac('0x1d')]?_0x3657af['options'][_0x54ac('0x21')]||null:null})[_0x54ac('0x11')](function(_0x121c26){logger[_0x54ac('0x1a')]('UpdateSmsInteraction',_0x3657af);logger[_0x54ac('0x14')](_0x54ac('0x22'),_0x3657af,JSON[_0x54ac('0x16')](_0x121c26));_0x57dfe0(_0x121c26);})['catch'](function(_0x4cecc2){logger['error']('UpdateSmsInteraction',_0x4cecc2[_0x54ac('0x19')],_0x3657af);_0x16dae0(_0x559667[_0x54ac('0x17')](0x1f4,_0x4cecc2['message']));});});};exports[_0x54ac('0x23')]=function(_0x3692f7){return new Promise(function(_0x4a5319,_0x4c6841){return db['SmsInteraction']['find']({'where':_0x3692f7[_0x54ac('0x1d')]?_0x3692f7['options'][_0x54ac('0x1f')]||null:null})[_0x54ac('0x11')](function(_0x3f4abe){if(_0x3f4abe){return _0x3f4abe['addTags'](_0x3692f7[_0x54ac('0x24')]['ids'],_[_0x54ac('0x25')](_0x3692f7[_0x54ac('0x24')],[_0x54ac('0x26'),'id'])||{});}})[_0x54ac('0x27')](function(_0x57de1e){logger['info'](_0x54ac('0x28'),_0x3692f7);logger[_0x54ac('0x14')](_0x54ac('0x28'),_0x3692f7,JSON[_0x54ac('0x16')](_0x57de1e));_0x4a5319(_0x57de1e);})['catch'](function(_0xa4592b){logger[_0x54ac('0x17')](_0x54ac('0x28'),_0xa4592b[_0x54ac('0x19')],_0x3692f7);_0x4c6841(_this[_0x54ac('0x17')](0x1f4,_0xa4592b[_0x54ac('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c3268c2..a9211e0 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 _0x1607=['length','smsInteraction:','save','remove','emit','removeListener'];(function(_0x5720da,_0x446144){var _0x556b5c=function(_0x2fbd42){while(--_0x2fbd42){_0x5720da['push'](_0x5720da['shift']());}};_0x556b5c(++_0x446144);}(_0x1607,0x176));var _0x7160=function(_0x210c11,_0x42c127){_0x210c11=_0x210c11-0x0;var _0x520a62=_0x1607[_0x210c11];return _0x520a62;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x7160('0x0'),_0x7160('0x1'),'update'];function createListener(_0x5db28c,_0x33ec23){return function(_0x512805){_0x33ec23[_0x7160('0x2')](_0x5db28c,_0x512805);};}function removeListener(_0x3ac0cf,_0x3ddd27){return function(){SmsInteractionEvents[_0x7160('0x3')](_0x3ac0cf,_0x3ddd27);};}exports['register']=function(_0x4b28e0){for(var _0x53f68f=0x0,_0x3d72ae=events[_0x7160('0x4')];_0x53f68f<_0x3d72ae;_0x53f68f++){var _0x480052=events[_0x53f68f];var _0x275bd6=createListener(_0x7160('0x5')+_0x480052,_0x4b28e0);SmsInteractionEvents['on'](_0x480052,_0x275bd6);}}; \ No newline at end of file +var _0xaa32=['./smsInteraction.events','save','remove','emit','removeListener','register','length','smsInteraction:'];(function(_0x265721,_0x1503f2){var _0x11ec95=function(_0x907b1e){while(--_0x907b1e){_0x265721['push'](_0x265721['shift']());}};_0x11ec95(++_0x1503f2);}(_0xaa32,0xd0));var _0x2aa3=function(_0x26013b,_0x23d44e){_0x26013b=_0x26013b-0x0;var _0x16a91f=_0xaa32[_0x26013b];return _0x16a91f;};'use strict';var SmsInteractionEvents=require(_0x2aa3('0x0'));var events=[_0x2aa3('0x1'),_0x2aa3('0x2'),'update'];function createListener(_0x435de7,_0x1f61c4){return function(_0x3a90c0){_0x1f61c4[_0x2aa3('0x3')](_0x435de7,_0x3a90c0);};}function removeListener(_0x310173,_0x1124f4){return function(){SmsInteractionEvents[_0x2aa3('0x4')](_0x310173,_0x1124f4);};}exports[_0x2aa3('0x5')]=function(_0x300235){for(var _0x5e7423=0x0,_0x20f6ab=events[_0x2aa3('0x6')];_0x5e7423<_0x20f6ab;_0x5e7423++){var _0x45ae04=events[_0x5e7423];var _0x588367=createListener(_0x2aa3('0x7')+_0x45ae04,_0x300235);SmsInteractionEvents['on'](_0x45ae04,_0x588367);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c36d9f1..02705bd 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 _0x08bd=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','post','tracked','sms','create','/:id/status','put','/:id','update','/:id/accept','accept','reject','destroy','multer','util','path','connect-timeout','express'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x08bd,0xd3));var _0xd08b=function(_0x30de89,_0xf1be1){_0x30de89=_0x30de89-0x0;var _0x1f2cd5=_0x08bd[_0x30de89];return _0x1f2cd5;};'use strict';var multer=require(_0xd08b('0x0'));var util=require(_0xd08b('0x1'));var path=require(_0xd08b('0x2'));var timeout=require(_0xd08b('0x3'));var express=require(_0xd08b('0x4'));var router=express['Router']();var fs_extra=require(_0xd08b('0x5'));var auth=require(_0xd08b('0x6'));var interaction=require(_0xd08b('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0xd08b('0x8')]('/',auth[_0xd08b('0x9')](),controller['index']);router[_0xd08b('0x8')](_0xd08b('0xa'),auth[_0xd08b('0x9')](),controller[_0xd08b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd08b('0xc')]('/',auth[_0xd08b('0x9')](),interaction[_0xd08b('0xd')](_0xd08b('0xe'),'smsmessage:create'),controller[_0xd08b('0xf')]);router[_0xd08b('0xc')](_0xd08b('0x10'),controller['status']);router[_0xd08b('0x11')](_0xd08b('0x12'),auth[_0xd08b('0x9')](),controller[_0xd08b('0x13')]);router[_0xd08b('0x11')](_0xd08b('0x14'),auth['isAuthenticated'](),controller[_0xd08b('0x15')]);router[_0xd08b('0x11')]('/:id/reject',auth[_0xd08b('0x9')](),controller[_0xd08b('0x16')]);router['delete'](_0xd08b('0x12'),auth[_0xd08b('0x9')](),controller[_0xd08b('0x17')]);module['exports']=router; \ No newline at end of file +var _0xbac1=['../../config/environment','./smsMessage.controller','get','/describe','describe','/:id','show','post','isAuthenticated','tracked','smsmessage:create','create','/:id/status','status','put','accept','/:id/reject','reject','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3b8a3a,_0x59d60f){var _0x4e848a=function(_0x5a66f1){while(--_0x5a66f1){_0x3b8a3a['push'](_0x3b8a3a['shift']());}};_0x4e848a(++_0x59d60f);}(_0xbac1,0x17f));var _0x1bac=function(_0x4ecba5,_0x99ea6e){_0x4ecba5=_0x4ecba5-0x0;var _0x1bc3b7=_0xbac1[_0x4ecba5];return _0x1bc3b7;};'use strict';var multer=require('multer');var util=require(_0x1bac('0x0'));var path=require(_0x1bac('0x1'));var timeout=require(_0x1bac('0x2'));var express=require(_0x1bac('0x3'));var router=express[_0x1bac('0x4')]();var fs_extra=require(_0x1bac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1bac('0x6'));var config=require(_0x1bac('0x7'));var controller=require(_0x1bac('0x8'));router[_0x1bac('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1bac('0x9')](_0x1bac('0xa'),auth['isAuthenticated'](),controller[_0x1bac('0xb')]);router[_0x1bac('0x9')](_0x1bac('0xc'),auth['isAuthenticated'](),controller[_0x1bac('0xd')]);router[_0x1bac('0xe')]('/',auth[_0x1bac('0xf')](),interaction[_0x1bac('0x10')]('sms',_0x1bac('0x11')),controller[_0x1bac('0x12')]);router[_0x1bac('0xe')](_0x1bac('0x13'),controller[_0x1bac('0x14')]);router[_0x1bac('0x15')](_0x1bac('0xc'),auth[_0x1bac('0xf')](),controller['update']);router[_0x1bac('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0x1bac('0x16')]);router[_0x1bac('0x15')](_0x1bac('0x17'),auth[_0x1bac('0xf')](),controller[_0x1bac('0x18')]);router['delete'](_0x1bac('0xc'),auth['isAuthenticated'](),controller[_0x1bac('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index aab392e..4a3e8ca 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 _0x22c0=['out','DATE','STRING','TEXT','sequelize','exports','BOOLEAN','ENUM'];(function(_0x17da78,_0x3b3502){var _0x5ada33=function(_0x2c29ba){while(--_0x2c29ba){_0x17da78['push'](_0x17da78['shift']());}};_0x5ada33(++_0x3b3502);}(_0x22c0,0x1c4));var _0x022c=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x22c0[_0x46a3ff];return _0x404bc2;};'use strict';var Sequelize=require(_0x022c('0x0'));module[_0x022c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x022c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x022c('0x3')]('in',_0x022c('0x4')),'defaultValue':_0x022c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x022c('0x5')]},'secret':{'type':Sequelize[_0x022c('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x022c('0x6')]},'providerResponse':{'type':Sequelize[_0x022c('0x7')]}}; \ No newline at end of file +var _0x12d7=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x15a78a,_0x5734ca){var _0x552cd7=function(_0x20bda7){while(--_0x20bda7){_0x15a78a['push'](_0x15a78a['shift']());}};_0x552cd7(++_0x5734ca);}(_0x12d7,0x181));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x712d('0x0'));module['exports']={'body':{'type':Sequelize[_0x712d('0x1')](_0x712d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x712d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x712d('0x4')]('in',_0x712d('0x5')),'defaultValue':_0x712d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x712d('0x6')]},'readAt':{'type':Sequelize[_0x712d('0x7')]},'secret':{'type':Sequelize[_0x712d('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x712d('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0812bd1..fa39e9a 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 _0xe1c4=['read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','Sequelize','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','EventManager','SmsInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','motionChannel','event','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','end','name','send','index','map','SmsMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','sms-interactions','accept','sms'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xe1c4[_0x46efd7];return _0x5637e4;};'use strict';var emlformat=require(_0x4e1c('0x0'));var rimraf=require(_0x4e1c('0x1'));var zipdir=require(_0x4e1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e1c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4e1c('0x4'));var util=require(_0x4e1c('0x5'));var path=require(_0x4e1c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e1c('0x7'));var fs=require('fs');var fs_extra=require(_0x4e1c('0x8'));var _=require(_0x4e1c('0x9'));var squel=require(_0x4e1c('0xa'));var crypto=require(_0x4e1c('0xb'));var jsforce=require(_0x4e1c('0xc'));var deskjs=require(_0x4e1c('0xd'));var toCsv=require(_0x4e1c('0xe'));var querystring=require(_0x4e1c('0xf'));var Papa=require(_0x4e1c('0x10'));var Redis=require(_0x4e1c('0x11'));var authService=require(_0x4e1c('0x12'));var qs=require(_0x4e1c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e1c('0x14'));var logger=require(_0x4e1c('0x15'))('api');var utils=require(_0x4e1c('0x16'));var config=require(_0x4e1c('0x17'));var licenseUtil=require(_0x4e1c('0x18'));var db=require(_0x4e1c('0x19'))['db'];config['redis']=_[_0x4e1c('0x1a')](config[_0x4e1c('0x1b')],{'host':_0x4e1c('0x1c'),'port':0x18eb});var socket=require(_0x4e1c('0x1d'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x4e1c('0x1e'));var client=jayson[_0x4e1c('0x1f')][_0x4e1c('0x20')]({'port':0x232c});var client9002=jayson[_0x4e1c('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cd5bc,_0x374c78,_0x12811c,_0xdb080a){return new BPromise(function(_0x44a842,_0x109d84){var _0x58d9e3=_0xdb080a||client;return _0x58d9e3[_0x4e1c('0x21')](_0x2cd5bc,_0x12811c)[_0x4e1c('0x22')](function(_0x2af3db){logger[_0x4e1c('0x23')](_0x4e1c('0x24'),_0x374c78,_0x4e1c('0x25'));logger[_0x4e1c('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x374c78,_0x4e1c('0x25'),JSON[_0x4e1c('0x27')](_0x2af3db));if(_0x2af3db[_0x4e1c('0x28')]){if(_0x2af3db[_0x4e1c('0x28')][_0x4e1c('0x29')]===0x1f4){logger[_0x4e1c('0x28')](_0x4e1c('0x24'),_0x374c78,_0x2af3db['error'][_0x4e1c('0x2a')]);return _0x109d84(_0x2af3db[_0x4e1c('0x28')][_0x4e1c('0x2a')]);}logger[_0x4e1c('0x28')](_0x4e1c('0x24'),_0x374c78,_0x2af3db[_0x4e1c('0x28')][_0x4e1c('0x2a')]);return _0x44a842(_0x2af3db[_0x4e1c('0x28')][_0x4e1c('0x2a')]);}else{logger['info'](_0x4e1c('0x24'),_0x374c78,_0x4e1c('0x25'));_0x44a842(_0x2af3db[_0x4e1c('0x2b')]['message']);}})['catch'](function(_0x17f5a5){logger['error'](_0x4e1c('0x24'),_0x374c78,_0x17f5a5);_0x109d84(_0x17f5a5);});});}function respondWithStatusCode(_0xd9c771,_0x2a2ccb){_0x2a2ccb=_0x2a2ccb||0xcc;return function(_0x564b30){if(_0x564b30){return _0xd9c771[_0x4e1c('0x2c')](_0x2a2ccb);}return _0xd9c771[_0x4e1c('0x2d')](_0x2a2ccb)['end']();};}function respondWithResult(_0x53980c,_0x2526a6){_0x2526a6=_0x2526a6||0xc8;return function(_0x264c48){if(_0x264c48){return _0x53980c[_0x4e1c('0x2d')](_0x2526a6)[_0x4e1c('0x2e')](_0x264c48);}};}function respondWithFilteredResult(_0x5ef2f7,_0xeccf79){return function(_0x8e3e14){if(_0x8e3e14){var _0x1b5ba8=typeof _0xeccf79[_0x4e1c('0x2f')]==='undefined'&&typeof _0xeccf79[_0x4e1c('0x30')]===_0x4e1c('0x31');var _0x53bdc7=_0x8e3e14[_0x4e1c('0x32')];var _0x5ae521=_0x1b5ba8?0x0:_0xeccf79[_0x4e1c('0x2f')];var _0x3c007f=_0x1b5ba8?_0x8e3e14[_0x4e1c('0x32')]:_0xeccf79[_0x4e1c('0x2f')]+_0xeccf79['limit'];var _0x2656d1;if(_0x3c007f>=_0x53bdc7){_0x3c007f=_0x53bdc7;_0x2656d1=0xc8;}else{_0x2656d1=0xce;}_0x5ef2f7['status'](_0x2656d1);return _0x5ef2f7[_0x4e1c('0x33')]('Content-Range',_0x5ae521+'-'+_0x3c007f+'/'+_0x53bdc7)[_0x4e1c('0x2e')](_0x8e3e14);}return null;};}function patchUpdates(_0x3a4e3c){return function(_0x4a5e2e){try{jsonpatch[_0x4e1c('0x34')](_0x4a5e2e,_0x3a4e3c,!![]);}catch(_0x513a2e){return BPromise[_0x4e1c('0x35')](_0x513a2e);}return _0x4a5e2e[_0x4e1c('0x36')]();};}function saveUpdates(_0x22a506,_0x68c5dc){return function(_0xbde1d0){if(_0xbde1d0){return _0xbde1d0[_0x4e1c('0x37')](_0x22a506)[_0x4e1c('0x22')](function(_0xbfa994){return _0xbfa994;});}return null;};}function removeEntity(_0x415ba7,_0xd71946){return function(_0x51208f){if(_0x51208f){return _0x51208f[_0x4e1c('0x38')]()[_0x4e1c('0x22')](function(){_0x415ba7[_0x4e1c('0x2d')](0xcc)[_0x4e1c('0x39')]();});}};}function handleEntityNotFound(_0x10101c,_0x3f2b9a){return function(_0x4e3e96){if(!_0x4e3e96){_0x10101c['sendStatus'](0x194);}return _0x4e3e96;};}function handleError(_0xa37d6,_0x68640d){_0x68640d=_0x68640d||0x1f4;return function(_0x3bd9fb){logger[_0x4e1c('0x28')](_0x3bd9fb['stack']);if(_0x3bd9fb[_0x4e1c('0x3a')]){delete _0x3bd9fb[_0x4e1c('0x3a')];}_0xa37d6['status'](_0x68640d)[_0x4e1c('0x3b')](_0x3bd9fb);};}exports[_0x4e1c('0x3c')]=function(_0x729915,_0x5f0280){var _0x39bc52={},_0xa5b309={},_0x4853fc={'count':0x0,'rows':[]};var _0x4091de=_[_0x4e1c('0x3d')](db[_0x4e1c('0x3e')][_0x4e1c('0x3f')],function(_0x1cb1a3){return{'name':_0x1cb1a3[_0x4e1c('0x40')],'type':_0x1cb1a3['type']['key']};});_0xa5b309[_0x4e1c('0x41')]=_[_0x4e1c('0x3d')](_0x4091de,_0x4e1c('0x3a'));_0xa5b309[_0x4e1c('0x42')]=_[_0x4e1c('0x43')](_0x729915[_0x4e1c('0x42')]);_0xa5b309[_0x4e1c('0x44')]=_[_0x4e1c('0x45')](_0xa5b309[_0x4e1c('0x41')],_0xa5b309[_0x4e1c('0x42')]);_0x39bc52[_0x4e1c('0x46')]=_['intersection'](_0xa5b309['model'],qs[_0x4e1c('0x47')](_0x729915[_0x4e1c('0x42')][_0x4e1c('0x47')]));_0x39bc52[_0x4e1c('0x46')]=_0x39bc52[_0x4e1c('0x46')][_0x4e1c('0x48')]?_0x39bc52['attributes']:_0xa5b309[_0x4e1c('0x41')];if(!_0x729915[_0x4e1c('0x42')][_0x4e1c('0x49')](_0x4e1c('0x4a'))){_0x39bc52[_0x4e1c('0x30')]=qs[_0x4e1c('0x30')](_0x729915[_0x4e1c('0x42')][_0x4e1c('0x30')]);_0x39bc52[_0x4e1c('0x2f')]=qs[_0x4e1c('0x2f')](_0x729915[_0x4e1c('0x42')]['offset']);}_0x39bc52[_0x4e1c('0x4b')]=qs[_0x4e1c('0x4c')](_0x729915[_0x4e1c('0x42')][_0x4e1c('0x4c')]);_0x39bc52[_0x4e1c('0x4d')]=qs[_0x4e1c('0x44')](_[_0x4e1c('0x4e')](_0x729915[_0x4e1c('0x42')],_0xa5b309['filters']),_0x4091de);if(_0x729915[_0x4e1c('0x42')]['filter']){_0x39bc52[_0x4e1c('0x4d')]=_[_0x4e1c('0x4f')](_0x39bc52['where'],{'$or':_[_0x4e1c('0x3d')](_0x4091de,function(_0x11c8fe){if(_0x11c8fe['type']!=='VIRTUAL'){var _0x20d362={};_0x20d362[_0x11c8fe[_0x4e1c('0x3a')]]={'$like':'%'+_0x729915[_0x4e1c('0x42')][_0x4e1c('0x50')]+'%'};return _0x20d362;}})});}_0x39bc52=_['merge']({},_0x39bc52,_0x729915[_0x4e1c('0x51')]);var _0x2aa544={'where':_0x39bc52[_0x4e1c('0x4d')]};return db[_0x4e1c('0x3e')]['count'](_0x2aa544)[_0x4e1c('0x22')](function(_0x2d6e50){_0x4853fc[_0x4e1c('0x32')]=_0x2d6e50;if(_0x729915[_0x4e1c('0x42')][_0x4e1c('0x52')]){_0x39bc52[_0x4e1c('0x53')]=[{'all':!![]}];}return db[_0x4e1c('0x3e')][_0x4e1c('0x54')](_0x39bc52);})[_0x4e1c('0x22')](function(_0x53f269){_0x4853fc[_0x4e1c('0x55')]=_0x53f269;return _0x4853fc;})['then'](respondWithFilteredResult(_0x5f0280,_0x39bc52))[_0x4e1c('0x56')](handleError(_0x5f0280,null));};exports[_0x4e1c('0x57')]=function(_0x29f908,_0x56b317){var _0x5ea849={'raw':!![],'where':{'id':_0x29f908[_0x4e1c('0x58')]['id']}},_0x1c314c={};_0x1c314c['model']=_[_0x4e1c('0x43')](db[_0x4e1c('0x3e')]['rawAttributes']);_0x1c314c['query']=_[_0x4e1c('0x43')](_0x29f908['query']);_0x1c314c[_0x4e1c('0x44')]=_[_0x4e1c('0x45')](_0x1c314c[_0x4e1c('0x41')],_0x1c314c[_0x4e1c('0x42')]);_0x5ea849[_0x4e1c('0x46')]=_[_0x4e1c('0x45')](_0x1c314c[_0x4e1c('0x41')],qs[_0x4e1c('0x47')](_0x29f908['query'][_0x4e1c('0x47')]));_0x5ea849[_0x4e1c('0x46')]=_0x5ea849['attributes'][_0x4e1c('0x48')]?_0x5ea849['attributes']:_0x1c314c[_0x4e1c('0x41')];if(_0x29f908[_0x4e1c('0x42')][_0x4e1c('0x52')]){_0x5ea849['include']=[{'all':!![]}];}_0x5ea849=_[_0x4e1c('0x4f')]({},_0x5ea849,_0x29f908[_0x4e1c('0x51')]);return db['SmsMessage'][_0x4e1c('0x59')](_0x5ea849)[_0x4e1c('0x22')](handleEntityNotFound(_0x56b317,null))[_0x4e1c('0x22')](respondWithResult(_0x56b317,null))[_0x4e1c('0x56')](handleError(_0x56b317,null));};exports['create']=function(_0x384102,_0x16c15d){return db[_0x4e1c('0x3e')][_0x4e1c('0x5a')](_0x384102[_0x4e1c('0x5b')],{})[_0x4e1c('0x22')](respondWithResult(_0x16c15d,0xc9))[_0x4e1c('0x56')](handleError(_0x16c15d,null));};exports['update']=function(_0x1d5548,_0x13e096){if(_0x1d5548[_0x4e1c('0x5b')]['id']){delete _0x1d5548[_0x4e1c('0x5b')]['id'];}return db['SmsMessage'][_0x4e1c('0x59')]({'where':{'id':_0x1d5548[_0x4e1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x13e096,null))['then'](saveUpdates(_0x1d5548[_0x4e1c('0x5b')],null))[_0x4e1c('0x22')](respondWithResult(_0x13e096,null))[_0x4e1c('0x56')](handleError(_0x13e096,null));};exports[_0x4e1c('0x38')]=function(_0x30742e,_0x307626){return db[_0x4e1c('0x3e')][_0x4e1c('0x59')]({'where':{'id':_0x30742e[_0x4e1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x307626,null))[_0x4e1c('0x22')](removeEntity(_0x307626,null))['catch'](handleError(_0x307626,null));};exports[_0x4e1c('0x5c')]=function(_0x65874d,_0x2b78e2){return db['SmsMessage'][_0x4e1c('0x5c')]()[_0x4e1c('0x22')](respondWithResult(_0x2b78e2,null))[_0x4e1c('0x56')](handleError(_0x2b78e2,null));};var interaction_log=require('../../config/logger')(_0x4e1c('0x5d'));exports[_0x4e1c('0x5e')]=function(_0x5398fd,_0x335830,_0x380ba6){var _0x108765={'agent':{},'channel':_0x4e1c('0x5f')};if(_0x5398fd[_0x4e1c('0x5b')]['id']){delete _0x5398fd[_0x4e1c('0x5b')]['id'];}_0x5398fd[_0x4e1c('0x5b')][_0x4e1c('0x60')]=!![];_0x5398fd['body'][_0x4e1c('0x61')]=moment()[_0x4e1c('0x62')](_0x4e1c('0x63'));_0x5398fd['body'][_0x4e1c('0x64')]=_0x5398fd[_0x4e1c('0x5b')][_0x4e1c('0x64')]||_0x5398fd[_0x4e1c('0x65')]['id'];_0x108765[_0x4e1c('0x66')]['id']=_0x5398fd[_0x4e1c('0x5b')][_0x4e1c('0x64')];return db[_0x4e1c('0x3e')][_0x4e1c('0x59')]({'where':{'id':_0x5398fd[_0x4e1c('0x58')]['id'],'UserId':null}})[_0x4e1c('0x22')](handleEntityNotFound(_0x335830,null))[_0x4e1c('0x22')](saveUpdates(_0x5398fd[_0x4e1c('0x5b')],null))[_0x4e1c('0x22')](function(_0x506e3a){if(_0x506e3a){_0x108765['message']=_0x506e3a[_0x4e1c('0x67')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x506e3a['SmsInteractionId']}});}return null;})[_0x4e1c('0x22')](handleEntityNotFound(_0x335830,null))[_0x4e1c('0x22')](function(_0x43cda1){if(_0x43cda1){return _0x43cda1[_0x4e1c('0x37')]({'UserId':_0x5398fd[_0x4e1c('0x5b')][_0x4e1c('0x64')],'read1stAt':_['isNil'](_0x43cda1['read1stAt'])?moment()[_0x4e1c('0x62')](_0x4e1c('0x63')):undefined});}return null;})[_0x4e1c('0x22')](function(_0x399669){if(_0x399669){_0x108765[_0x4e1c('0x68')]=_0x399669[_0x4e1c('0x67')]({'plain':!![]});interaction_log[_0x4e1c('0x23')](_0x4e1c('0x69'),_0x5398fd['user']['id'],_0x5398fd[_0x4e1c('0x65')][_0x4e1c('0x3a')],_0x5398fd[_0x4e1c('0x65')][_0x4e1c('0x6a')],_0x108765[_0x4e1c('0x68')]['id'],_0x5398fd[_0x4e1c('0x5b')]?JSON[_0x4e1c('0x27')](_0x5398fd[_0x4e1c('0x5b')]):'null');return respondWithRpcPromise(_0x4e1c('0x6b'),_0x4e1c('0x6c'),_0x108765);}return null;})[_0x4e1c('0x22')](function(_0x5dafd2){var _0x515c7b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5dafd2['message']['ContactId'];return db['sequelize'][_0x4e1c('0x42')](_0x515c7b,{'type':db[_0x4e1c('0x6d')][_0x4e1c('0x6e')]['SELECT'],'raw':!![]})[_0x4e1c('0x22')](function(_0x156e56){return _0x156e56;});})[_0x4e1c('0x22')](function(_0xb53af){if(_0xb53af){_0x108765[_0x4e1c('0x2a')][_0x4e1c('0x6f')]=_0xb53af[0x0];if(!_0x5398fd[_0x4e1c('0x5b')][_0x4e1c('0x64')])return;return db[_0x4e1c('0x70')][_0x4e1c('0x59')]({'where':{'id':_0x5398fd[_0x4e1c('0x5b')][_0x4e1c('0x64')],'role':_0x4e1c('0x66')},'attributes':['id',_0x4e1c('0x3a'),_0x4e1c('0x71'),'email',_0x4e1c('0x72')],'raw':!![]});}return null;})[_0x4e1c('0x22')](function(_0x43fffc){if(!_0x43fffc)return null;_0x108765['message'][_0x4e1c('0x66')]=_0x43fffc;return _0x108765;})[_0x4e1c('0x22')](function(_0x696664){if(_0x696664){if(_0x5398fd[_0x4e1c('0x5b')][_0x4e1c('0x73')]){_0x108765[_0x4e1c('0x2a')][_0x4e1c('0x74')]=util[_0x4e1c('0x62')](_0x4e1c('0x75'),_0x5398fd['user'][_0x4e1c('0x3a')]);_0x108765[_0x4e1c('0x2a')][_0x4e1c('0x76')]=_0x108765[_0x4e1c('0x76')];_0x108765[_0x4e1c('0x2a')]['motionChannel']=_0x108765[_0x4e1c('0x76')];_0x108765[_0x4e1c('0x2a')]['event']=_0x4e1c('0x5e');return respondWithRpcPromise(_0x4e1c('0x77'),_0x4e1c('0x77'),{'event':'acceptmessage','message':_0x108765[_0x4e1c('0x2a')]},client9002)['then'](function(){return _0x108765;});}return _0x108765;}return null;})[_0x4e1c('0x22')](respondWithResult(_0x335830,null))['catch'](handleError(_0x335830,null));};var interaction_log=require(_0x4e1c('0x15'))(_0x4e1c('0x5d'));exports[_0x4e1c('0x35')]=function(_0x2390f4,_0x325360,_0x1feb4d){var _0x3b8846={'agent':{},'channel':_0x4e1c('0x5f')};if(_0x2390f4[_0x4e1c('0x5b')]['id']){delete _0x2390f4[_0x4e1c('0x5b')]['id'];}_0x2390f4[_0x4e1c('0x5b')][_0x4e1c('0x64')]=_0x2390f4[_0x4e1c('0x5b')][_0x4e1c('0x64')]||_0x2390f4[_0x4e1c('0x65')]['id'];_0x3b8846[_0x4e1c('0x66')]['id']=_0x2390f4['body'][_0x4e1c('0x64')];return db[_0x4e1c('0x3e')][_0x4e1c('0x59')]({'where':{'id':_0x2390f4[_0x4e1c('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x325360,null))['then'](function(_0x145d0a){if(_0x145d0a){_0x3b8846[_0x4e1c('0x2a')]=_0x145d0a[_0x4e1c('0x67')]({'plain':!![]});return db['SmsInteraction'][_0x4e1c('0x59')]({'where':{'id':_0x145d0a[_0x4e1c('0x78')]}});}return null;})[_0x4e1c('0x22')](handleEntityNotFound(_0x325360,null))['then'](function(_0x26de67){if(_0x26de67){_0x3b8846[_0x4e1c('0x68')]=_0x26de67[_0x4e1c('0x67')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2390f4[_0x4e1c('0x65')]['id'],_0x2390f4[_0x4e1c('0x65')]['name'],_0x2390f4[_0x4e1c('0x65')]['role'],_0x3b8846['interaction']['id'],_0x2390f4['body']?JSON[_0x4e1c('0x27')](_0x2390f4[_0x4e1c('0x5b')]):'null');return respondWithRpcPromise(_0x4e1c('0x79'),_0x4e1c('0x7a'),_0x3b8846);}return null;})[_0x4e1c('0x22')](function(_0x4c256b){var _0x5f107a=_0x4e1c('0x7b')+_0x4c256b[_0x4e1c('0x2a')][_0x4e1c('0x7c')];return db[_0x4e1c('0x7d')][_0x4e1c('0x42')](_0x5f107a,{'type':db[_0x4e1c('0x6d')][_0x4e1c('0x6e')][_0x4e1c('0x7e')],'raw':!![]})[_0x4e1c('0x22')](function(_0x4431b5){return _0x4431b5;});})[_0x4e1c('0x22')](function(_0x1eefd8){if(_0x1eefd8){_0x3b8846[_0x4e1c('0x2a')][_0x4e1c('0x6f')]=_0x1eefd8[0x0];if(!_0x2390f4[_0x4e1c('0x5b')][_0x4e1c('0x64')])return;return db[_0x4e1c('0x70')]['find']({'where':{'id':_0x2390f4[_0x4e1c('0x5b')]['UserId'],'role':_0x4e1c('0x66')},'attributes':['id',_0x4e1c('0x3a'),'fullname','email',_0x4e1c('0x72')],'raw':!![]});}return null;})[_0x4e1c('0x22')](function(_0x38a2de){if(!_0x38a2de)return null;_0x3b8846[_0x4e1c('0x2a')]['agent']=_0x38a2de;return _0x3b8846;})[_0x4e1c('0x22')](function(_0x9d273f){if(_0x9d273f){_0x9d273f[_0x4e1c('0x2a')][_0x4e1c('0x74')]=util[_0x4e1c('0x62')](_0x4e1c('0x75'),_0x2390f4[_0x4e1c('0x65')]['name']);_0x9d273f['message'][_0x4e1c('0x76')]=_0x3b8846[_0x4e1c('0x76')];_0x9d273f[_0x4e1c('0x2a')][_0x4e1c('0x7f')]=_0x3b8846[_0x4e1c('0x76')];_0x9d273f[_0x4e1c('0x2a')][_0x4e1c('0x80')]='reject';respondWithRpcPromise(_0x4e1c('0x77'),_0x4e1c('0x77'),{'event':_0x4e1c('0x81'),'message':_0x9d273f[_0x4e1c('0x2a')]},client9002);return _0x3b8846;}return null;})['then'](respondWithResult(_0x325360,null))[_0x4e1c('0x56')](handleError(_0x325360,null));};exports[_0x4e1c('0x2d')]=function(_0x45fb6d,_0x470a7f,_0x31ef9a){if(_0x45fb6d[_0x4e1c('0x5b')]['id']){delete _0x45fb6d[_0x4e1c('0x5b')]['id'];}var _0x5cc37f;return db['SmsMessage'][_0x4e1c('0x59')]({'where':{'id':_0x45fb6d['params']['id']}})[_0x4e1c('0x22')](handleEntityNotFound(_0x470a7f,null))[_0x4e1c('0x22')](function(_0x45e59e){if(_0x45e59e){_0x5cc37f=_0x45e59e;return db['SmsAccount'][_0x4e1c('0x59')]({'where':{'id':_0x45e59e[_0x4e1c('0x82')]}});}})[_0x4e1c('0x22')](handleEntityNotFound(_0x470a7f,null))['then'](function(_0x4d4242){if(_0x4d4242){logger[_0x4e1c('0x26')](_0x4e1c('0x83'),_0x4e1c('0x2d'),_0x4e1c('0x84'),_0x4d4242[_0x4e1c('0x85')],util[_0x4e1c('0x86')](_0x45fb6d[_0x4e1c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x4d4242[_0x4e1c('0x85')]){case'twilio':if(_0x45fb6d['body'][_0x4e1c('0x87')]&&_0x45fb6d['body'][_0x4e1c('0x87')]===_0x5cc37f[_0x4e1c('0x88')]){return _0x5cc37f[_0x4e1c('0x37')]({'read':!![]});}else{logger[_0x4e1c('0x28')](_0x4e1c('0x89'),_0x4e1c('0x2d'),_0x4e1c('0x8a'),util[_0x4e1c('0x86')](_0x45fb6d[_0x4e1c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4e1c('0x8b'):if(_0x45fb6d[_0x4e1c('0x5b')][_0x4e1c('0x8c')]&&_0x45fb6d[_0x4e1c('0x5b')]['MessageUUID']===_0x5cc37f[_0x4e1c('0x88')]&&_['indexOf']([_0x4e1c('0x8d'),_0x4e1c('0x8e')],_0x45fb6d[_0x4e1c('0x5b')][_0x4e1c('0x8f')])>=0x0){return _0x5cc37f[_0x4e1c('0x37')]({'read':!![]});}else{logger['error'](_0x4e1c('0x89'),_0x4e1c('0x2d'),_0x4e1c('0x90'),util['inspect'](_0x45fb6d[_0x4e1c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4e1c('0x91'):var _0x5f2c47=_0x45fb6d[_0x4e1c('0x5b')][_0x4e1c('0x92')][0x0];if(_0x5f2c47['status']['groupName']==='DELIVERED'){return _0x5cc37f[_0x4e1c('0x37')]({'read':!![]});}else{logger[_0x4e1c('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4e1c('0x2d'),_0x4e1c('0x91'),util[_0x4e1c('0x86')](_0x45fb6d[_0x4e1c('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5cc37f;}})[_0x4e1c('0x22')](respondWithResult(_0x470a7f,null))[_0x4e1c('0x56')](handleError(_0x470a7f,null));}; \ No newline at end of file +var _0x4529=['request\x20sent','debug','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','end','stack','send','map','SmsMessage','rawAttributes','fieldName','type','key','name','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','Sequelize','User','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','plivio','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s'];(function(_0x3ae24a,_0x7d32f9){var _0x18690f=function(_0x2c2389){while(--_0x2c2389){_0x3ae24a['push'](_0x3ae24a['shift']());}};_0x18690f(++_0x7d32f9);}(_0x4529,0x109));var _0x9452=function(_0x44e9b2,_0x429287){_0x44e9b2=_0x44e9b2-0x0;var _0x4884d2=_0x4529[_0x44e9b2];return _0x4884d2;};'use strict';var emlformat=require(_0x9452('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9452('0x1'));var jsonpatch=require(_0x9452('0x2'));var rp=require(_0x9452('0x3'));var moment=require(_0x9452('0x4'));var BPromise=require(_0x9452('0x5'));var Mustache=require(_0x9452('0x6'));var util=require(_0x9452('0x7'));var path=require(_0x9452('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9452('0x9'));var fs=require('fs');var fs_extra=require(_0x9452('0xa'));var _=require(_0x9452('0xb'));var squel=require(_0x9452('0xc'));var crypto=require(_0x9452('0xd'));var jsforce=require(_0x9452('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9452('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9452('0x10'));var as=require(_0x9452('0x11'));var hardwareService=require(_0x9452('0x12'));var logger=require(_0x9452('0x13'))(_0x9452('0x14'));var utils=require(_0x9452('0x15'));var config=require(_0x9452('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9452('0x17'))['db'];config[_0x9452('0x18')]=_[_0x9452('0x19')](config[_0x9452('0x18')],{'host':_0x9452('0x1a'),'port':0x18eb});var socket=require(_0x9452('0x1b'))(new Redis(config[_0x9452('0x18')]));require(_0x9452('0x1c'))['register'](socket);var jayson=require(_0x9452('0x1d'));var client=jayson[_0x9452('0x1e')][_0x9452('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x9452('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x517846,_0x14ab5d,_0x201582,_0x4d1f25){return new BPromise(function(_0x5ebb3a,_0x6b0594){var _0x45e0c9=_0x4d1f25||client;return _0x45e0c9['request'](_0x517846,_0x201582)[_0x9452('0x20')](function(_0x7a64e9){logger[_0x9452('0x21')](_0x9452('0x22'),_0x14ab5d,_0x9452('0x23'));logger[_0x9452('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14ab5d,_0x9452('0x23'),JSON['stringify'](_0x7a64e9));if(_0x7a64e9[_0x9452('0x25')]){if(_0x7a64e9[_0x9452('0x25')][_0x9452('0x26')]===0x1f4){logger[_0x9452('0x25')]('SmsMessage,\x20%s,\x20%s',_0x14ab5d,_0x7a64e9[_0x9452('0x25')][_0x9452('0x27')]);return _0x6b0594(_0x7a64e9[_0x9452('0x25')][_0x9452('0x27')]);}logger[_0x9452('0x25')](_0x9452('0x22'),_0x14ab5d,_0x7a64e9['error']['message']);return _0x5ebb3a(_0x7a64e9[_0x9452('0x25')][_0x9452('0x27')]);}else{logger[_0x9452('0x21')]('SmsMessage,\x20%s,\x20%s',_0x14ab5d,'request\x20sent');_0x5ebb3a(_0x7a64e9[_0x9452('0x28')][_0x9452('0x27')]);}})[_0x9452('0x29')](function(_0x528e4b){logger['error'](_0x9452('0x22'),_0x14ab5d,_0x528e4b);_0x6b0594(_0x528e4b);});});}function respondWithStatusCode(_0x25170c,_0x21fb54){_0x21fb54=_0x21fb54||0xcc;return function(_0x11e2a4){if(_0x11e2a4){return _0x25170c[_0x9452('0x2a')](_0x21fb54);}return _0x25170c[_0x9452('0x2b')](_0x21fb54)['end']();};}function respondWithResult(_0xc247eb,_0x5158a5){_0x5158a5=_0x5158a5||0xc8;return function(_0x3bc428){if(_0x3bc428){return _0xc247eb[_0x9452('0x2b')](_0x5158a5)['json'](_0x3bc428);}};}function respondWithFilteredResult(_0x384b6d,_0x3b0fed){return function(_0x438323){if(_0x438323){var _0x283278=typeof _0x3b0fed[_0x9452('0x2c')]===_0x9452('0x2d')&&typeof _0x3b0fed[_0x9452('0x2e')]===_0x9452('0x2d');var _0x231236=_0x438323[_0x9452('0x2f')];var _0x1301b0=_0x283278?0x0:_0x3b0fed[_0x9452('0x2c')];var _0x1addf1=_0x283278?_0x438323[_0x9452('0x2f')]:_0x3b0fed['offset']+_0x3b0fed[_0x9452('0x2e')];var _0x172a5c;if(_0x1addf1>=_0x231236){_0x1addf1=_0x231236;_0x172a5c=0xc8;}else{_0x172a5c=0xce;}_0x384b6d[_0x9452('0x2b')](_0x172a5c);return _0x384b6d[_0x9452('0x30')](_0x9452('0x31'),_0x1301b0+'-'+_0x1addf1+'/'+_0x231236)[_0x9452('0x32')](_0x438323);}return null;};}function patchUpdates(_0x38162c){return function(_0x3a7f69){try{jsonpatch['apply'](_0x3a7f69,_0x38162c,!![]);}catch(_0x5e4202){return BPromise[_0x9452('0x33')](_0x5e4202);}return _0x3a7f69[_0x9452('0x34')]();};}function saveUpdates(_0x2a8631,_0x497cc0){return function(_0x27bdd0){if(_0x27bdd0){return _0x27bdd0[_0x9452('0x35')](_0x2a8631)[_0x9452('0x20')](function(_0x253c9e){return _0x253c9e;});}return null;};}function removeEntity(_0x5533ba,_0x3357f0){return function(_0x531066){if(_0x531066){return _0x531066[_0x9452('0x36')]()[_0x9452('0x20')](function(){_0x5533ba[_0x9452('0x2b')](0xcc)[_0x9452('0x37')]();});}};}function handleEntityNotFound(_0x1c24cc,_0x3ec25d){return function(_0x2d3172){if(!_0x2d3172){_0x1c24cc['sendStatus'](0x194);}return _0x2d3172;};}function handleError(_0xf9419b,_0x146e2a){_0x146e2a=_0x146e2a||0x1f4;return function(_0x351b1d){logger[_0x9452('0x25')](_0x351b1d[_0x9452('0x38')]);if(_0x351b1d['name']){delete _0x351b1d['name'];}_0xf9419b[_0x9452('0x2b')](_0x146e2a)[_0x9452('0x39')](_0x351b1d);};}exports['index']=function(_0x49a6dc,_0x804c11){var _0x3d2fa0={},_0x5b7936={},_0x57d114={'count':0x0,'rows':[]};var _0x9301d5=_[_0x9452('0x3a')](db[_0x9452('0x3b')][_0x9452('0x3c')],function(_0x1e866d){return{'name':_0x1e866d[_0x9452('0x3d')],'type':_0x1e866d[_0x9452('0x3e')][_0x9452('0x3f')]};});_0x5b7936['model']=_[_0x9452('0x3a')](_0x9301d5,_0x9452('0x40'));_0x5b7936['query']=_[_0x9452('0x41')](_0x49a6dc['query']);_0x5b7936['filters']=_[_0x9452('0x42')](_0x5b7936[_0x9452('0x43')],_0x5b7936[_0x9452('0x44')]);_0x3d2fa0[_0x9452('0x45')]=_[_0x9452('0x42')](_0x5b7936[_0x9452('0x43')],qs[_0x9452('0x46')](_0x49a6dc[_0x9452('0x44')][_0x9452('0x46')]));_0x3d2fa0[_0x9452('0x45')]=_0x3d2fa0[_0x9452('0x45')][_0x9452('0x47')]?_0x3d2fa0[_0x9452('0x45')]:_0x5b7936['model'];if(!_0x49a6dc[_0x9452('0x44')]['hasOwnProperty'](_0x9452('0x48'))){_0x3d2fa0[_0x9452('0x2e')]=qs[_0x9452('0x2e')](_0x49a6dc[_0x9452('0x44')][_0x9452('0x2e')]);_0x3d2fa0['offset']=qs[_0x9452('0x2c')](_0x49a6dc[_0x9452('0x44')][_0x9452('0x2c')]);}_0x3d2fa0[_0x9452('0x49')]=qs[_0x9452('0x4a')](_0x49a6dc[_0x9452('0x44')][_0x9452('0x4a')]);_0x3d2fa0[_0x9452('0x4b')]=qs[_0x9452('0x4c')](_['pick'](_0x49a6dc[_0x9452('0x44')],_0x5b7936[_0x9452('0x4c')]),_0x9301d5);if(_0x49a6dc[_0x9452('0x44')]['filter']){_0x3d2fa0[_0x9452('0x4b')]=_[_0x9452('0x4d')](_0x3d2fa0['where'],{'$or':_[_0x9452('0x3a')](_0x9301d5,function(_0x30e247){if(_0x30e247[_0x9452('0x3e')]!==_0x9452('0x4e')){var _0x347c4f={};_0x347c4f[_0x30e247[_0x9452('0x40')]]={'$like':'%'+_0x49a6dc[_0x9452('0x44')][_0x9452('0x4f')]+'%'};return _0x347c4f;}})});}_0x3d2fa0=_[_0x9452('0x4d')]({},_0x3d2fa0,_0x49a6dc[_0x9452('0x50')]);var _0x11ed77={'where':_0x3d2fa0[_0x9452('0x4b')]};return db['SmsMessage'][_0x9452('0x2f')](_0x11ed77)[_0x9452('0x20')](function(_0x4628a2){_0x57d114[_0x9452('0x2f')]=_0x4628a2;if(_0x49a6dc[_0x9452('0x44')][_0x9452('0x51')]){_0x3d2fa0[_0x9452('0x52')]=[{'all':!![]}];}return db[_0x9452('0x3b')][_0x9452('0x53')](_0x3d2fa0);})[_0x9452('0x20')](function(_0x193b11){_0x57d114[_0x9452('0x54')]=_0x193b11;return _0x57d114;})[_0x9452('0x20')](respondWithFilteredResult(_0x804c11,_0x3d2fa0))[_0x9452('0x29')](handleError(_0x804c11,null));};exports[_0x9452('0x55')]=function(_0x4dbb9c,_0xb70f07){var _0x338910={'raw':!![],'where':{'id':_0x4dbb9c[_0x9452('0x56')]['id']}},_0x41ad84={};_0x41ad84[_0x9452('0x43')]=_[_0x9452('0x41')](db[_0x9452('0x3b')][_0x9452('0x3c')]);_0x41ad84[_0x9452('0x44')]=_[_0x9452('0x41')](_0x4dbb9c[_0x9452('0x44')]);_0x41ad84[_0x9452('0x4c')]=_[_0x9452('0x42')](_0x41ad84[_0x9452('0x43')],_0x41ad84[_0x9452('0x44')]);_0x338910[_0x9452('0x45')]=_['intersection'](_0x41ad84[_0x9452('0x43')],qs[_0x9452('0x46')](_0x4dbb9c[_0x9452('0x44')][_0x9452('0x46')]));_0x338910[_0x9452('0x45')]=_0x338910[_0x9452('0x45')]['length']?_0x338910['attributes']:_0x41ad84['model'];if(_0x4dbb9c[_0x9452('0x44')]['includeAll']){_0x338910[_0x9452('0x52')]=[{'all':!![]}];}_0x338910=_[_0x9452('0x4d')]({},_0x338910,_0x4dbb9c[_0x9452('0x50')]);return db[_0x9452('0x3b')][_0x9452('0x57')](_0x338910)['then'](handleEntityNotFound(_0xb70f07,null))[_0x9452('0x20')](respondWithResult(_0xb70f07,null))[_0x9452('0x29')](handleError(_0xb70f07,null));};exports[_0x9452('0x58')]=function(_0x5f4432,_0x514406){return db['SmsMessage'][_0x9452('0x58')](_0x5f4432[_0x9452('0x59')],{})['then'](respondWithResult(_0x514406,0xc9))[_0x9452('0x29')](handleError(_0x514406,null));};exports['update']=function(_0x335844,_0x19977c){if(_0x335844[_0x9452('0x59')]['id']){delete _0x335844['body']['id'];}return db['SmsMessage'][_0x9452('0x57')]({'where':{'id':_0x335844[_0x9452('0x56')]['id']}})['then'](handleEntityNotFound(_0x19977c,null))[_0x9452('0x20')](saveUpdates(_0x335844[_0x9452('0x59')],null))[_0x9452('0x20')](respondWithResult(_0x19977c,null))[_0x9452('0x29')](handleError(_0x19977c,null));};exports[_0x9452('0x36')]=function(_0xafc0a9,_0x6e0ae1){return db['SmsMessage'][_0x9452('0x57')]({'where':{'id':_0xafc0a9[_0x9452('0x56')]['id']}})[_0x9452('0x20')](handleEntityNotFound(_0x6e0ae1,null))['then'](removeEntity(_0x6e0ae1,null))[_0x9452('0x29')](handleError(_0x6e0ae1,null));};exports[_0x9452('0x5a')]=function(_0x4f9968,_0x135c15){return db['SmsMessage']['describe']()[_0x9452('0x20')](respondWithResult(_0x135c15,null))[_0x9452('0x29')](handleError(_0x135c15,null));};var interaction_log=require('../../config/logger')(_0x9452('0x5b'));exports[_0x9452('0x5c')]=function(_0x1d1674,_0xddad44,_0x945eff){var _0x4353a7={'agent':{},'channel':_0x9452('0x5d')};if(_0x1d1674[_0x9452('0x59')]['id']){delete _0x1d1674[_0x9452('0x59')]['id'];}_0x1d1674[_0x9452('0x59')][_0x9452('0x5e')]=!![];_0x1d1674[_0x9452('0x59')][_0x9452('0x5f')]=moment()[_0x9452('0x60')](_0x9452('0x61'));_0x1d1674[_0x9452('0x59')][_0x9452('0x62')]=_0x1d1674[_0x9452('0x59')]['UserId']||_0x1d1674['user']['id'];_0x4353a7[_0x9452('0x63')]['id']=_0x1d1674[_0x9452('0x59')]['UserId'];return db['SmsMessage'][_0x9452('0x57')]({'where':{'id':_0x1d1674[_0x9452('0x56')]['id'],'UserId':null}})[_0x9452('0x20')](handleEntityNotFound(_0xddad44,null))[_0x9452('0x20')](saveUpdates(_0x1d1674[_0x9452('0x59')],null))[_0x9452('0x20')](function(_0x1b45d8){if(_0x1b45d8){_0x4353a7[_0x9452('0x27')]=_0x1b45d8['get']({'plain':!![]});return db[_0x9452('0x64')][_0x9452('0x57')]({'where':{'id':_0x1b45d8[_0x9452('0x65')]}});}return null;})[_0x9452('0x20')](handleEntityNotFound(_0xddad44,null))['then'](function(_0x336bc3){if(_0x336bc3){return _0x336bc3[_0x9452('0x35')]({'UserId':_0x1d1674[_0x9452('0x59')][_0x9452('0x62')],'read1stAt':_[_0x9452('0x66')](_0x336bc3[_0x9452('0x67')])?moment()[_0x9452('0x60')](_0x9452('0x61')):undefined});}return null;})[_0x9452('0x20')](function(_0x84e120){if(_0x84e120){_0x4353a7[_0x9452('0x68')]=_0x84e120[_0x9452('0x69')]({'plain':!![]});interaction_log[_0x9452('0x21')](_0x9452('0x6a'),_0x1d1674[_0x9452('0x6b')]['id'],_0x1d1674[_0x9452('0x6b')]['name'],_0x1d1674[_0x9452('0x6b')][_0x9452('0x6c')],_0x4353a7[_0x9452('0x68')]['id'],_0x1d1674['body']?JSON[_0x9452('0x6d')](_0x1d1674[_0x9452('0x59')]):_0x9452('0x6e'));return respondWithRpcPromise(_0x9452('0x6f'),'acceptMessage',_0x4353a7);}return null;})[_0x9452('0x20')](function(_0x23e31f){var _0x589ccb=_0x9452('0x70')+_0x23e31f[_0x9452('0x27')][_0x9452('0x71')];return db['sequelize'][_0x9452('0x44')](_0x589ccb,{'type':db['Sequelize'][_0x9452('0x72')][_0x9452('0x73')],'raw':!![]})[_0x9452('0x20')](function(_0x213309){return _0x213309;});})['then'](function(_0x499968){if(_0x499968){_0x4353a7[_0x9452('0x27')][_0x9452('0x74')]=_0x499968[0x0];if(!_0x1d1674[_0x9452('0x59')][_0x9452('0x62')])return;return db['User'][_0x9452('0x57')]({'where':{'id':_0x1d1674[_0x9452('0x59')]['UserId'],'role':_0x9452('0x63')},'attributes':['id',_0x9452('0x40'),_0x9452('0x75'),_0x9452('0x76'),_0x9452('0x77')],'raw':!![]});}return null;})[_0x9452('0x20')](function(_0x4626b4){if(!_0x4626b4)return null;_0x4353a7[_0x9452('0x27')][_0x9452('0x63')]=_0x4626b4;return _0x4353a7;})[_0x9452('0x20')](function(_0xc142ee){if(_0xc142ee){if(_0x1d1674[_0x9452('0x59')][_0x9452('0x78')]){_0x4353a7[_0x9452('0x27')][_0x9452('0x79')]=util[_0x9452('0x60')](_0x9452('0x7a'),_0x1d1674[_0x9452('0x6b')][_0x9452('0x40')]);_0x4353a7[_0x9452('0x27')][_0x9452('0x7b')]=_0x4353a7[_0x9452('0x7b')];_0x4353a7[_0x9452('0x27')][_0x9452('0x7c')]=_0x4353a7['channel'];_0x4353a7[_0x9452('0x27')][_0x9452('0x7d')]='accept';return respondWithRpcPromise(_0x9452('0x7e'),_0x9452('0x7e'),{'event':_0x9452('0x7f'),'message':_0x4353a7['message']},client9002)[_0x9452('0x20')](function(){return _0x4353a7;});}return _0x4353a7;}return null;})[_0x9452('0x20')](respondWithResult(_0xddad44,null))[_0x9452('0x29')](handleError(_0xddad44,null));};var interaction_log=require(_0x9452('0x13'))('sms-interactions');exports[_0x9452('0x33')]=function(_0x2e048f,_0x11afb9,_0x89e94c){var _0x225206={'agent':{},'channel':_0x9452('0x5d')};if(_0x2e048f[_0x9452('0x59')]['id']){delete _0x2e048f[_0x9452('0x59')]['id'];}_0x2e048f['body'][_0x9452('0x62')]=_0x2e048f['body'][_0x9452('0x62')]||_0x2e048f[_0x9452('0x6b')]['id'];_0x225206[_0x9452('0x63')]['id']=_0x2e048f['body']['UserId'];return db[_0x9452('0x3b')][_0x9452('0x57')]({'where':{'id':_0x2e048f[_0x9452('0x56')]['id'],'UserId':null}})[_0x9452('0x20')](handleEntityNotFound(_0x11afb9,null))[_0x9452('0x20')](function(_0x43833a){if(_0x43833a){_0x225206[_0x9452('0x27')]=_0x43833a['get']({'plain':!![]});return db[_0x9452('0x64')]['find']({'where':{'id':_0x43833a[_0x9452('0x65')]}});}return null;})[_0x9452('0x20')](handleEntityNotFound(_0x11afb9,null))[_0x9452('0x20')](function(_0x3966ef){if(_0x3966ef){_0x225206[_0x9452('0x68')]=_0x3966ef[_0x9452('0x69')]({'plain':!![]});interaction_log['info'](_0x9452('0x80'),_0x2e048f['user']['id'],_0x2e048f[_0x9452('0x6b')][_0x9452('0x40')],_0x2e048f['user']['role'],_0x225206[_0x9452('0x68')]['id'],_0x2e048f['body']?JSON[_0x9452('0x6d')](_0x2e048f['body']):_0x9452('0x6e'));return respondWithRpcPromise(_0x9452('0x81'),'rejectMessage',_0x225206);}return null;})[_0x9452('0x20')](function(_0x2bed59){var _0x260eb3=_0x9452('0x70')+_0x2bed59[_0x9452('0x27')][_0x9452('0x71')];return db[_0x9452('0x82')][_0x9452('0x44')](_0x260eb3,{'type':db[_0x9452('0x83')][_0x9452('0x72')][_0x9452('0x73')],'raw':!![]})['then'](function(_0x22d75e){return _0x22d75e;});})[_0x9452('0x20')](function(_0x2026d5){if(_0x2026d5){_0x225206['message'][_0x9452('0x74')]=_0x2026d5[0x0];if(!_0x2e048f[_0x9452('0x59')]['UserId'])return;return db[_0x9452('0x84')][_0x9452('0x57')]({'where':{'id':_0x2e048f[_0x9452('0x59')][_0x9452('0x62')],'role':_0x9452('0x63')},'attributes':['id',_0x9452('0x40'),_0x9452('0x75'),'email',_0x9452('0x77')],'raw':!![]});}return null;})[_0x9452('0x20')](function(_0x13b9b1){if(!_0x13b9b1)return null;_0x225206['message'][_0x9452('0x63')]=_0x13b9b1;return _0x225206;})[_0x9452('0x20')](function(_0x3154ac){if(_0x3154ac){_0x3154ac[_0x9452('0x27')]['interface']=util[_0x9452('0x60')](_0x9452('0x7a'),_0x2e048f[_0x9452('0x6b')][_0x9452('0x40')]);_0x3154ac[_0x9452('0x27')]['channel']=_0x225206['channel'];_0x3154ac[_0x9452('0x27')]['motionChannel']=_0x225206[_0x9452('0x7b')];_0x3154ac[_0x9452('0x27')]['event']='reject';respondWithRpcPromise(_0x9452('0x7e'),_0x9452('0x7e'),{'event':_0x9452('0x85'),'message':_0x3154ac['message']},client9002);return _0x225206;}return null;})['then'](respondWithResult(_0x11afb9,null))[_0x9452('0x29')](handleError(_0x11afb9,null));};exports[_0x9452('0x2b')]=function(_0x15d10c,_0xd4f7b7,_0x392448){if(_0x15d10c[_0x9452('0x59')]['id']){delete _0x15d10c[_0x9452('0x59')]['id'];}var _0x247329;return db[_0x9452('0x3b')][_0x9452('0x57')]({'where':{'id':_0x15d10c[_0x9452('0x56')]['id']}})[_0x9452('0x20')](handleEntityNotFound(_0xd4f7b7,null))[_0x9452('0x20')](function(_0x5b2564){if(_0x5b2564){_0x247329=_0x5b2564;return db[_0x9452('0x86')][_0x9452('0x57')]({'where':{'id':_0x5b2564['SmsAccountId']}});}})[_0x9452('0x20')](handleEntityNotFound(_0xd4f7b7,null))['then'](function(_0x3eb407){if(_0x3eb407){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9452('0x2b'),_0x9452('0x87'),_0x3eb407[_0x9452('0x3e')],util[_0x9452('0x88')](_0x15d10c[_0x9452('0x59')],{'showHidden':![],'depth':null}));switch(_0x3eb407[_0x9452('0x3e')]){case _0x9452('0x89'):if(_0x15d10c[_0x9452('0x59')][_0x9452('0x8a')]&&_0x15d10c[_0x9452('0x59')][_0x9452('0x8a')]===_0x247329['messageId']){return _0x247329[_0x9452('0x35')]({'read':!![]});}else{logger[_0x9452('0x25')](_0x9452('0x8b'),_0x9452('0x2b'),_0x9452('0x89'),util[_0x9452('0x88')](_0x15d10c[_0x9452('0x59')],{'showHidden':![],'depth':null}));}break;case _0x9452('0x8c'):if(_0x15d10c[_0x9452('0x59')][_0x9452('0x8d')]&&_0x15d10c['body']['MessageUUID']===_0x247329[_0x9452('0x8e')]&&_[_0x9452('0x8f')]([_0x9452('0x90'),'delivered'],_0x15d10c['body']['Status'])>=0x0){return _0x247329[_0x9452('0x35')]({'read':!![]});}else{logger[_0x9452('0x25')](_0x9452('0x8b'),_0x9452('0x2b'),_0x9452('0x91'),util[_0x9452('0x88')](_0x15d10c[_0x9452('0x59')],{'showHidden':![],'depth':null}));}break;case _0x9452('0x92'):var _0x124beb=_0x15d10c[_0x9452('0x59')][_0x9452('0x93')][0x0];if(_0x124beb[_0x9452('0x2b')][_0x9452('0x94')]===_0x9452('0x95')){return _0x247329[_0x9452('0x35')]({'read':!![]});}else{logger[_0x9452('0x25')](_0x9452('0x8b'),_0x9452('0x2b'),_0x9452('0x92'),util[_0x9452('0x88')](_0x15d10c[_0x9452('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x247329;}})[_0x9452('0x20')](respondWithResult(_0xd4f7b7,null))[_0x9452('0x29')](handleError(_0xd4f7b7,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 3f427f8..e7f6ad5 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 _0xb4b5=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2be40f,_0x339623){var _0xbc6191=function(_0x22954c){while(--_0x22954c){_0x2be40f['push'](_0x2be40f['shift']());}};_0xbc6191(++_0x339623);}(_0xb4b5,0x142));var _0x5b4b=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xb4b5[_0x17a32f];return _0x15a293;};'use strict';var EventEmitter=require(_0x5b4b('0x0'));var SmsMessage=require(_0x5b4b('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5b4b('0x2')](0x0);var events={'afterCreate':_0x5b4b('0x3'),'afterUpdate':_0x5b4b('0x4'),'afterDestroy':_0x5b4b('0x5')};function emitEvent(_0x4c13b6){return function(_0x59913a,_0x5736ed,_0x31f950){SmsMessageEvents[_0x5b4b('0x6')](_0x4c13b6+':'+_0x59913a['id'],_0x59913a);SmsMessageEvents['emit'](_0x4c13b6,_0x59913a);_0x31f950(null);};}for(var e in events){if(events[_0x5b4b('0x7')](e)){var event=events[e];SmsMessage[_0x5b4b('0x8')](e,emitEvent(event));}}module[_0x5b4b('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x0552=['save','update','remove','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x19c5f2,_0x44ed13){var _0xb94caf=function(_0x1b3522){while(--_0x1b3522){_0x19c5f2['push'](_0x19c5f2['shift']());}};_0xb94caf(++_0x44ed13);}(_0x0552,0x1e6));var _0x2055=function(_0x44c1f6,_0x4c6abb){_0x44c1f6=_0x44c1f6-0x0;var _0xbb825f=_0x0552[_0x44c1f6];return _0xbb825f;};'use strict';var EventEmitter=require(_0x2055('0x0'));var SmsMessage=require(_0x2055('0x1'))['db'][_0x2055('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2055('0x3')](0x0);var events={'afterCreate':_0x2055('0x4'),'afterUpdate':_0x2055('0x5'),'afterDestroy':_0x2055('0x6')};function emitEvent(_0x3a1c45){return function(_0x338474,_0x3955d4,_0xad57d3){SmsMessageEvents[_0x2055('0x7')](_0x3a1c45+':'+_0x338474['id'],_0x338474);SmsMessageEvents[_0x2055('0x7')](_0x3a1c45,_0x338474);_0xad57d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2055('0x8')](e,emitEvent(event));}}module[_0x2055('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 5cbe501..99909ff 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 _0x1fcf=['session_key','internal_order_id','skebby','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','connectel','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/status?token=','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','digest','hex','/external/get/send.php?','csc','clickatell','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','Missing\x20parameters:\x20username,\x20password','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key'];(function(_0x3d3d7b,_0x5c0937){var _0x33e7c8=function(_0xe0ee81){while(--_0xe0ee81){_0x3d3d7b['push'](_0x3d3d7b['shift']());}};_0x33e7c8(++_0x5c0937);}(_0x1fcf,0x1c4));var _0xf1fc=function(_0x400347,_0x1cbcc1){_0x400347=_0x400347-0x0;var _0x52a0fb=_0x1fcf[_0x400347];return _0x52a0fb;};'use strict';var _=require(_0xf1fc('0x0'));var util=require(_0xf1fc('0x1'));var logger=require(_0xf1fc('0x2'))(_0xf1fc('0x3'));var moment=require(_0xf1fc('0x4'));var BPromise=require(_0xf1fc('0x5'));var rp=require(_0xf1fc('0x6'));var fs=require('fs');var path=require(_0xf1fc('0x7'));var rimraf=require(_0xf1fc('0x8'));var config=require(_0xf1fc('0x9'));var attributes=require(_0xf1fc('0xa'));module['exports']=function(_0x5aa6e2,_0x23dfe5){return _0x5aa6e2[_0xf1fc('0xb')](_0xf1fc('0xc'),attributes,{'tableName':_0xf1fc('0xd'),'paranoid':![],'indexes':[{'name':_0xf1fc('0xe'),'fields':[_0xf1fc('0xe')]},{'name':'fti_sms_messages','fields':[_0xf1fc('0xf')],'type':_0xf1fc('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c980e,_0x3729c2,_0x25ae8a){var _0x55b3a8=_0x5aa6e2[_0xf1fc('0x11')];var _0x476b31=_0x2c980e[_0xf1fc('0x12')]({'plain':!![]});if(_0x476b31[_0xf1fc('0x13')][_0xf1fc('0x14')]()==='in'||_0x476b31[_0xf1fc('0x13')][_0xf1fc('0x14')]()===_0xf1fc('0x15')&&!_0x476b31['secret']&&!_[_0xf1fc('0x16')](_0x476b31[_0xf1fc('0x17')])&&!_['isNil'](_0x476b31['SmsInteractionId'])){_0x55b3a8[_0xf1fc('0x18')]['findOne']({'where':{'id':_0x476b31[_0xf1fc('0x19')]}})[_0xf1fc('0x1a')](function(_0x387b46){if(_0x387b46){_0x387b46[_0xf1fc('0x1b')]({'lastMsgAt':_0x476b31[_0xf1fc('0x1c')],'lastMsgDirection':_0x476b31['direction'][_0xf1fc('0x14')]()});}})[_0xf1fc('0x1d')](function(_0x1b14c6){console[_0xf1fc('0x1e')](_0x1b14c6);});}if(_0x476b31[_0xf1fc('0x13')]===_0xf1fc('0x15')&&!_0x476b31['secret']){var _0x1d7d58;_0x55b3a8[_0xf1fc('0x1f')][_0xf1fc('0x20')]({'where':{'id':_0x476b31['SmsAccountId']},'raw':!![]})[_0xf1fc('0x1a')](function(_0x56e1b2){_0x1d7d58=_0x56e1b2;if(_0x1d7d58&&_0x1d7d58[_0xf1fc('0x21')]){switch(_0x1d7d58[_0xf1fc('0x21')]){case'twilio':var _0x8a887f=require(_0xf1fc('0x22'));if(_0x1d7d58['accountSid']&&_0x1d7d58[_0xf1fc('0x23')]&&_0x1d7d58[_0xf1fc('0x24')]){var _0x106b11=new _0x8a887f(_0x1d7d58[_0xf1fc('0x25')],_0x1d7d58[_0xf1fc('0x23')]);_0x106b11[_0xf1fc('0x26')][_0xf1fc('0x27')]({'body':_0x476b31[_0xf1fc('0xf')],'to':_0x476b31[_0xf1fc('0x24')],'from':_0x1d7d58[_0xf1fc('0x24')],'statusCallback':_0x1d7d58[_0xf1fc('0x28')]+_0xf1fc('0x29')+_0x476b31['id']+'/status?token='+_0x1d7d58[_0xf1fc('0x2a')]})['then'](function(_0x1f85f1){if(_0x1f85f1[_0xf1fc('0x2b')]){return _0x2c980e[_0xf1fc('0x1b')]({'messageId':_0x1f85f1[_0xf1fc('0x2b')]});}})[_0xf1fc('0x1d')](function(_0x46d6e3){logger[_0xf1fc('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1fc('0x2c'),_0xf1fc('0x22'),util[_0xf1fc('0x2d')](_0x46d6e3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x22'),_0xf1fc('0x2f'));}break;case'skebby':var _0x28e823=_0xf1fc('0x30');if(_0x1d7d58[_0xf1fc('0x31')]&&_0x1d7d58[_0xf1fc('0x32')]){var _0xaaa4da={'recipient':[_0x476b31[_0xf1fc('0x24')]],'message':_0x476b31['body'],'message_type':_0x1d7d58[_0xf1fc('0x33')]};if(_0x1d7d58['smsMethod']&&_0x1d7d58[_0xf1fc('0x33')]!=='SI'){_0xaaa4da[_0xf1fc('0x34')]=_0x1d7d58[_0xf1fc('0x24')];}var _0x133ceb={'url':_0x28e823+_0xf1fc('0x35')+_0x1d7d58['username']+_0xf1fc('0x36')+_0x1d7d58['password'],'method':_0xf1fc('0x37')};rp(_0x133ceb)[_0xf1fc('0x1a')](function(_0x4506f2){var _0x2585de=_0x4506f2[_0xf1fc('0x38')](';');var _0x59402d={'user_key':_0x2585de[0x0],'session_key':_0x2585de[0x1]};_0x133ceb={'url':_0x28e823+_0xf1fc('0x39'),'method':_0xf1fc('0x3a'),'headers':{'user_key':_0x59402d[_0xf1fc('0x3b')],'Session_key':_0x59402d[_0xf1fc('0x3c')]},'json':!![],'body':_0xaaa4da};return rp(_0x133ceb);})[_0xf1fc('0x1a')](function(_0xac1750){if(_0xac1750['total_sent']>=0x1){var _0x328952={'messageId':_0xac1750[_0xf1fc('0x3d')]};if(_0x1d7d58['smsMethod']!=='GP'||!_0x1d7d58['deliveryReport']){_0x328952['read']=!![];}return _0x2c980e[_0xf1fc('0x1b')](_0x328952);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1fc('0x2c'),_0xf1fc('0x3e'),util['inspect'](_0xac1750,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4dfd14){return logger[_0xf1fc('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1fc('0x2c'),_0xf1fc('0x3e'),util[_0xf1fc('0x2d')](_0x4dfd14,{'showHidden':![],'depth':null}));});}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x1d7d58[_0xf1fc('0x23')]){var _0x2e670b={'recipient':_0x476b31[_0xf1fc('0x24')],'message':_0x476b31[_0xf1fc('0xf')],'sender':_0x1d7d58['senderString']||_0x1d7d58[_0xf1fc('0x24')],'authorization':_0x1d7d58['authToken']};var _0x3729c2={'method':_0xf1fc('0x3a'),'uri':_0xf1fc('0x3f'),'body':_0x2e670b,'json':!![]};rp(_0x3729c2)[_0xf1fc('0x1a')](function(_0x968c2b){var _0x19443a={'messageId':_0x968c2b[_0xf1fc('0x40')]};if(!_0x1d7d58[_0xf1fc('0x41')]){_0x19443a[_0xf1fc('0x42')]=!![];}return _0x2c980e[_0xf1fc('0x1b')](_0x19443a);})[_0xf1fc('0x1d')](function(_0x1c3e06){logger['error'](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x43'),util['inspect'](_0x1c3e06,{'showHidden':![],'depth':null}));});}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),'afterCreate',_0xf1fc('0x43'),'Missing\x20parameters:\x20authToken');}break;case _0xf1fc('0x44'):if(_0x1d7d58[_0xf1fc('0x31')]&&_0x1d7d58[_0xf1fc('0x32')]){var _0x2e670b={'messages':[{'source':_0xf1fc('0x45'),'to':_0x476b31[_0xf1fc('0x24')],'body':_0x476b31['body'],'from':_0x1d7d58[_0xf1fc('0x46')]||_0x1d7d58['phone']}]};var _0x1beea8=util[_0xf1fc('0x47')](_0xf1fc('0x48'),_0x1d7d58['username'],_0x1d7d58['password']);var _0x3729c2={'method':_0xf1fc('0x3a'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2e670b,'headers':{'Authorization':util[_0xf1fc('0x47')](_0xf1fc('0x49'),new Buffer(_0x1beea8)[_0xf1fc('0x4a')](_0xf1fc('0x4b')))},'json':!![]};rp(_0x3729c2)['then'](function(_0x5d1d8f){if(_0x5d1d8f[_0xf1fc('0x4c')]>=0xc8&&_0x5d1d8f[_0xf1fc('0x4c')]<=0xce){if(_0x5d1d8f[_0xf1fc('0x4d')]&&_0x5d1d8f['data'][_0xf1fc('0x4e')]>0x0){var _0x6ecb2=_[_0xf1fc('0x4f')](_0x5d1d8f[_0xf1fc('0x4d')][_0xf1fc('0x26')]);var _0x2dae10={'messageId':_0x6ecb2[_0xf1fc('0x50')]};if(!_0x1d7d58[_0xf1fc('0x41')]){_0x2dae10['read']=!![];}return _0x2c980e[_0xf1fc('0x1b')](_0x2dae10);}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),'clickSend',util[_0xf1fc('0x2d')](_0x5d1d8f,{'showHidden':![],'depth':null}));}}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x51'),util[_0xf1fc('0x2d')](_0x5d1d8f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5cea18){logger[_0xf1fc('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf1fc('0x51'),util[_0xf1fc('0x2d')](_0x5cea18,{'showHidden':![],'depth':null}));});}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf1fc('0x52'):if(_0x1d7d58[_0xf1fc('0x53')]&&_0x1d7d58[_0xf1fc('0x23')]){var _0x2e670b={'dst':_0x476b31[_0xf1fc('0x24')],'text':_0x476b31[_0xf1fc('0xf')],'src':_0x1d7d58[_0xf1fc('0x46')]||_0x1d7d58[_0xf1fc('0x24')],'url':_0x1d7d58[_0xf1fc('0x28')]+_0xf1fc('0x29')+_0x476b31['id']+_0xf1fc('0x54')+_0x1d7d58[_0xf1fc('0x2a')]};var _0x1beea8=util[_0xf1fc('0x47')](_0xf1fc('0x48'),_0x1d7d58[_0xf1fc('0x53')],_0x1d7d58[_0xf1fc('0x23')]);var _0x3729c2={'method':_0xf1fc('0x3a'),'uri':util[_0xf1fc('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1d7d58[_0xf1fc('0x53')]),'body':_0x2e670b,'headers':{'Authorization':util[_0xf1fc('0x47')](_0xf1fc('0x49'),new Buffer(_0x1beea8)[_0xf1fc('0x4a')](_0xf1fc('0x4b')))},'json':!![]};rp(_0x3729c2)[_0xf1fc('0x1a')](function(_0xef4801){var _0x30d7e2={'messageId':_0xef4801[_0xf1fc('0x55')][0x0]};return _0x2c980e[_0xf1fc('0x1b')](_0x30d7e2);})[_0xf1fc('0x1d')](function(_0xc67ef2){logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x52'),util[_0xf1fc('0x2d')](_0xc67ef2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1fc('0x2c'),_0xf1fc('0x52'),_0xf1fc('0x56'));}break;case _0xf1fc('0x57'):if(_0x1d7d58[_0xf1fc('0x31')]&&_0x1d7d58[_0xf1fc('0x32')]){if(_0x1d7d58[_0xf1fc('0x58')]){var _0x296256={'method':_0xf1fc('0x3a'),'uri':_0x1d7d58[_0xf1fc('0x58')]+_0xf1fc('0x59'),'body':{'username':_0x1d7d58['username'],'password':_0x1d7d58[_0xf1fc('0x32')]},'json':!![]};return rp(_0x296256)[_0xf1fc('0x1a')](function(_0x21458f){var _0x44faac={'method':_0xf1fc('0x3a'),'uri':_0x1d7d58[_0xf1fc('0x58')]+_0xf1fc('0x5a'),'body':{'messages':[{'from':_0x1d7d58[_0xf1fc('0x24')],'destinations':[{'to':_0x476b31[_0xf1fc('0x24')]}],'text':_0x476b31[_0xf1fc('0xf')],'notifyUrl':_0x1d7d58['remote']+_0xf1fc('0x29')+_0x476b31['id']+_0xf1fc('0x54')+_0x1d7d58['token'],'notifyContentType':_0xf1fc('0x5b'),'callbackData':_0x1d7d58[_0xf1fc('0x24')]+';'+_0x476b31[_0xf1fc('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x21458f[_0xf1fc('0x2a')]},'json':!![]};return rp(_0x44faac)[_0xf1fc('0x1a')](function(_0x2d68cf){if(_0x2d68cf['messages']){var _0x2875d3={'messageId':_0x2d68cf[_0xf1fc('0x26')][0x0]['messageId']};if(!_0x1d7d58[_0xf1fc('0x41')]){_0x2875d3['read']=!![];}return _0x2c980e['update'](_0x2875d3);}else{return logger[_0xf1fc('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf1fc('0x57'),util[_0xf1fc('0x2d')](_0x2d68cf,{'showHidden':![],'depth':null}));}});})[_0xf1fc('0x1d')](function(_0x316c1d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1fc('0x2c'),_0xf1fc('0x57'),util[_0xf1fc('0x2d')](_0x316c1d,{'showHidden':![],'depth':null}));});}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),'infobip',_0xf1fc('0x5c'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x36bcd1=require(_0xf1fc('0x5d'));if(_0x1d7d58[_0xf1fc('0x5e')]){var _0x2f67a7={};_0x2f67a7[_0xf1fc('0x5f')]=_0x1d7d58[_0xf1fc('0x31')];_0x2f67a7['phone']=_0x476b31[_0xf1fc('0x24')];_0x2f67a7[_0xf1fc('0x34')]=_0x1d7d58[_0xf1fc('0x24')];_0x2f67a7[_0xf1fc('0x60')]=_0x476b31['body'];_0x2f67a7[_0xf1fc('0x61')]=+new Date();var _0x226727='';var _0x1d7a2b='';var _0x2a2c1b=Object[_0xf1fc('0x62')](_0x2f67a7);_0x2a2c1b[_0xf1fc('0x63')]();for(var _0x425bb2=0x0;_0x425bb2<_0x2a2c1b[_0xf1fc('0x64')];_0x425bb2++){if(_0x226727!=''){_0x226727+='&';}_0x226727+=_0x2a2c1b[_0x425bb2]+'='+encodeURIComponent(_0x2f67a7[_0x2a2c1b[_0x425bb2]]);_0x1d7a2b+=_0x2f67a7[_0x2a2c1b[_0x425bb2]];}_0x1d7a2b+=_0x1d7d58[_0xf1fc('0x5e')];_0x1d7a2b=_0x36bcd1[_0xf1fc('0x65')]('md5')[_0xf1fc('0x1b')](_0x1d7a2b)[_0xf1fc('0x66')](_0xf1fc('0x67'));if(_0x226727!==''){_0x226727+='&';}_0x226727+='signature='+_0x1d7a2b;var _0x133ceb={'method':_0xf1fc('0x37'),'uri':_0x1d7d58[_0xf1fc('0x58')]+_0xf1fc('0x68')+_0x226727,'json':!![]};return rp(_0x133ceb)[_0xf1fc('0x1a')](function(_0x2f2abb){var _0x39ce83=Object[_0xf1fc('0x62')](_0x2f2abb);if(_0x2f2abb[_0x39ce83[0x0]][_0xf1fc('0x1e')]&&parseInt(_0x2f2abb[_0x39ce83[0x0]][_0xf1fc('0x1e')])===0x0){var _0x51ad06={'messageId':_0x2f2abb[_0x39ce83[0x0]]['id_sms']};if(!_0x1d7d58['deliveryReport']){_0x51ad06['read']=!![];}return _0x2c980e[_0xf1fc('0x1b')](_0x51ad06);}else{return logger['error'](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x69'),util[_0xf1fc('0x2d')](_0x2f2abb[_0xf1fc('0x1e')],{'showHidden':![],'depth':null}));}})[_0xf1fc('0x1d')](function(_0x18a44b){return logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),'csc',util[_0xf1fc('0x2d')](_0x18a44b,{'showHidden':![],'depth':null}));});}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x69'),'Missing\x20parameters:\x20apiKey');}break;case _0xf1fc('0x6a'):if(_0x1d7d58[_0xf1fc('0x5e')]){var _0x31b986={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x1d7d58[_0xf1fc('0x5e')]},'body':{'content':_0x476b31['body'],'to':[_0x476b31['phone']],'from':_0x1d7d58[_0xf1fc('0x24')],'binary':![],'clientMessageId':_0xf1fc('0x6b'),'charset':_0xf1fc('0x6c')},'json':!![]};rp(_0x31b986)['then'](function(_0x5639ad){if(!_0x5639ad[_0xf1fc('0x1e')]){var _0x409218={'messageId':_0x5639ad['messages'][0x0][_0xf1fc('0x6d')]};if(!_0x1d7d58[_0xf1fc('0x41')]){_0x409218[_0xf1fc('0x42')]=!![];}return _0x2c980e[_0xf1fc('0x1b')](_0x409218);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1fc('0x2c'),_0xf1fc('0x6a'),util[_0xf1fc('0x2d')](_0x5639ad[_0xf1fc('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3b10e7){return logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x6a'),util[_0xf1fc('0x2d')](_0x3b10e7,{'showHidden':![],'depth':null}));});}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x6a'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x1d7d58[_0xf1fc('0x31')]&&_0x1d7d58[_0xf1fc('0x32')]){var _0x1beea8=util[_0xf1fc('0x47')](_0xf1fc('0x48'),_0x1d7d58[_0xf1fc('0x31')],_0x1d7d58[_0xf1fc('0x32')]);var _0x3729c2={'method':_0xf1fc('0x3a'),'uri':_0xf1fc('0x6e')+_0x1d7d58[_0xf1fc('0x6f')]+_0xf1fc('0x70'),'body':{'to':[_0x476b31[_0xf1fc('0x24')]],'text':_0x476b31[_0xf1fc('0xf')],'from':_0x1d7d58[_0xf1fc('0x24')],'applicationId':_0x1d7d58[_0xf1fc('0x71')]},'headers':{'Authorization':util[_0xf1fc('0x47')]('Basic\x20%s',new Buffer(_0x1beea8)[_0xf1fc('0x4a')](_0xf1fc('0x4b')))},'json':!![]};rp(_0x3729c2)[_0xf1fc('0x1a')](function(_0x3c1613){if(_0x3c1613['id']){var _0x3a5c62={'messageId':_0x3c1613['id']};return _0x2c980e[_0xf1fc('0x1b')](_0x3a5c62);}else{logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),_0xf1fc('0x2c'),_0xf1fc('0x72'),util['inspect'](_0x3c1613,{'showHidden':![],'depth':null}));}})[_0xf1fc('0x1d')](function(_0x4dcf8e){logger['error'](_0xf1fc('0x2e'),_0xf1fc('0x2c'),'bandwidth',util[_0xf1fc('0x2d')](_0x4dcf8e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf1fc('0x2e'),_0xf1fc('0x2c'),'bandwidth',_0xf1fc('0x73'));}break;case _0xf1fc('0x74'):if(_0x1d7d58['apiKey']){var _0x4201d7={};var _0x133ceb={'method':_0xf1fc('0x3a'),'uri':_0xf1fc('0x75'),'headers':{'Authorization':_0xf1fc('0x76')+_0x1d7d58[_0xf1fc('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x1d7d58[_0xf1fc('0x24')],'to':_0x476b31['phone'],'text':_0x476b31['body']},'json':!![]};return rp(_0x133ceb)[_0xf1fc('0x1a')](function(_0x484176){if(_0x484176[_0xf1fc('0x77')]==0xca){_0x4201d7[_0xf1fc('0x78')]=_0x484176;var _0x5d7903={'method':_0xf1fc('0x3a'),'uri':_0xf1fc('0x79'),'headers':{'Authorization':_0xf1fc('0x76')+_0x1d7d58['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x4201d7[_0xf1fc('0x78')][_0xf1fc('0x7a')]},'json':!![]};return rp(_0x5d7903)[_0xf1fc('0x1a')](function(_0x15f4f0){_0x4201d7[_0xf1fc('0x7b')]=_0x15f4f0;var _0x39a7b5={'messageId':_0x4201d7['message'][_0xf1fc('0x7a')],'read':!![]};return _0x2c980e['update'](_0x39a7b5);});}else{return logger[_0xf1fc('0x1e')](_0xf1fc('0x2e'),'afterCreate',_0xf1fc('0x74'),util[_0xf1fc('0x2d')](_0x484176,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4b94a3){return logger[_0xf1fc('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf1fc('0x2c'),_0xf1fc('0x74'),util['inspect'](_0x4b94a3,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xf1fc('0x2e'),'afterCreate','intelepeer',_0xf1fc('0x7c'));}break;}}})[_0xf1fc('0x7d')](function(){_0x25ae8a();});}else{_0x25ae8a();}}},'charset':_0xf1fc('0x7e'),'collate':_0xf1fc('0x7f')});}; \ No newline at end of file +var _0x7802=['csc','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','/messages','applicationId','bandwidth','intelepeer','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise','../../config/environment','./smsMessage.attributes','define','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','/auth/1/session','baseUrl','/sms/2/text/advanced','IBSSO\x20'];(function(_0x1035ab,_0x2f9249){var _0x451ef1=function(_0x179cbb){while(--_0x179cbb){_0x1035ab['push'](_0x1035ab['shift']());}};_0x451ef1(++_0x2f9249);}(_0x7802,0x93));var _0x2780=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x7802[_0x330414];return _0x99dbff;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2780('0x0'));var moment=require(_0x2780('0x1'));var BPromise=require('bluebird');var rp=require(_0x2780('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2780('0x3'));var attributes=require(_0x2780('0x4'));module['exports']=function(_0x26393d,_0x2214cc){return _0x26393d[_0x2780('0x5')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2780('0x6')]},{'name':_0x2780('0x7'),'fields':[_0x2780('0x8')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e89ba,_0x185a06,_0x583581){var _0x52ef8c=_0x26393d[_0x2780('0x9')];var _0x4f7d82=_0x5e89ba[_0x2780('0xa')]({'plain':!![]});if(_0x4f7d82[_0x2780('0xb')][_0x2780('0xc')]()==='in'||_0x4f7d82[_0x2780('0xb')][_0x2780('0xc')]()===_0x2780('0xd')&&!_0x4f7d82[_0x2780('0xe')]&&!_[_0x2780('0xf')](_0x4f7d82[_0x2780('0x10')])&&!_[_0x2780('0xf')](_0x4f7d82[_0x2780('0x11')])){_0x52ef8c['SmsInteraction'][_0x2780('0x12')]({'where':{'id':_0x4f7d82['SmsInteractionId']}})[_0x2780('0x13')](function(_0x1c9f70){if(_0x1c9f70){_0x1c9f70[_0x2780('0x14')]({'lastMsgAt':_0x4f7d82[_0x2780('0x15')],'lastMsgDirection':_0x4f7d82[_0x2780('0xb')][_0x2780('0xc')]()});}})['catch'](function(_0x363be7){console[_0x2780('0x16')](_0x363be7);});}if(_0x4f7d82[_0x2780('0xb')]===_0x2780('0xd')&&!_0x4f7d82[_0x2780('0xe')]){var _0x469c11;_0x52ef8c['SmsAccount'][_0x2780('0x17')]({'where':{'id':_0x4f7d82[_0x2780('0x18')]},'raw':!![]})[_0x2780('0x13')](function(_0x3726fd){_0x469c11=_0x3726fd;if(_0x469c11&&_0x469c11[_0x2780('0x19')]){switch(_0x469c11[_0x2780('0x19')]){case _0x2780('0x1a'):var _0x2a5bab=require(_0x2780('0x1a'));if(_0x469c11[_0x2780('0x1b')]&&_0x469c11[_0x2780('0x1c')]&&_0x469c11['phone']){var _0x1c3fdb=new _0x2a5bab(_0x469c11[_0x2780('0x1b')],_0x469c11[_0x2780('0x1c')]);_0x1c3fdb[_0x2780('0x1d')][_0x2780('0x1e')]({'body':_0x4f7d82['body'],'to':_0x4f7d82[_0x2780('0x1f')],'from':_0x469c11['phone'],'statusCallback':_0x469c11[_0x2780('0x20')]+_0x2780('0x21')+_0x4f7d82['id']+_0x2780('0x22')+_0x469c11[_0x2780('0x23')]})[_0x2780('0x13')](function(_0x5a38b2){if(_0x5a38b2[_0x2780('0x24')]){return _0x5e89ba[_0x2780('0x14')]({'messageId':_0x5a38b2[_0x2780('0x24')]});}})[_0x2780('0x25')](function(_0x338d0f){logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),'twilio',util['inspect'](_0x338d0f,{'showHidden':![],'depth':null}));});}else{logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),'twilio',_0x2780('0x28'));}break;case'skebby':var _0x152f81='https://api.skebby.it/API/v1.0/REST/';if(_0x469c11[_0x2780('0x29')]&&_0x469c11[_0x2780('0x2a')]){var _0x4a78a5={'recipient':[_0x4f7d82['phone']],'message':_0x4f7d82[_0x2780('0x8')],'message_type':_0x469c11['smsMethod']};if(_0x469c11['smsMethod']&&_0x469c11[_0x2780('0x2b')]!=='SI'){_0x4a78a5[_0x2780('0x2c')]=_0x469c11[_0x2780('0x1f')];}var _0x6d74a2={'url':_0x152f81+_0x2780('0x2d')+_0x469c11[_0x2780('0x29')]+_0x2780('0x2e')+_0x469c11[_0x2780('0x2a')],'method':_0x2780('0x2f')};rp(_0x6d74a2)[_0x2780('0x13')](function(_0x5a887c){var _0x547bbd=_0x5a887c['split'](';');var _0x1b2655={'user_key':_0x547bbd[0x0],'session_key':_0x547bbd[0x1]};_0x6d74a2={'url':_0x152f81+_0x2780('0x30'),'method':_0x2780('0x31'),'headers':{'user_key':_0x1b2655[_0x2780('0x32')],'Session_key':_0x1b2655[_0x2780('0x33')]},'json':!![],'body':_0x4a78a5};return rp(_0x6d74a2);})[_0x2780('0x13')](function(_0x2b900d){if(_0x2b900d[_0x2780('0x34')]>=0x1){var _0x5bafc9={'messageId':_0x2b900d[_0x2780('0x35')]};if(_0x469c11[_0x2780('0x2b')]!=='GP'||!_0x469c11[_0x2780('0x36')]){_0x5bafc9[_0x2780('0x37')]=!![];}return _0x5e89ba[_0x2780('0x14')](_0x5bafc9);}else{return logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x38'),util[_0x2780('0x39')](_0x2b900d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e0edc){return logger[_0x2780('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x2780('0x39')](_0x1e0edc,{'showHidden':![],'depth':null}));});}else{logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x38'),_0x2780('0x3a'));}break;case _0x2780('0x3b'):if(_0x469c11[_0x2780('0x1c')]){var _0x3f34d3={'recipient':_0x4f7d82[_0x2780('0x1f')],'message':_0x4f7d82[_0x2780('0x8')],'sender':_0x469c11[_0x2780('0x3c')]||_0x469c11['phone'],'authorization':_0x469c11[_0x2780('0x1c')]};var _0x185a06={'method':_0x2780('0x31'),'uri':_0x2780('0x3d'),'body':_0x3f34d3,'json':!![]};rp(_0x185a06)[_0x2780('0x13')](function(_0x419f2a){var _0x25e632={'messageId':_0x419f2a[_0x2780('0x3e')]};if(!_0x469c11[_0x2780('0x36')]){_0x25e632[_0x2780('0x37')]=!![];}return _0x5e89ba[_0x2780('0x14')](_0x25e632);})['catch'](function(_0x55fec0){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2780('0x3b'),util[_0x2780('0x39')](_0x55fec0,{'showHidden':![],'depth':null}));});}else{logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x2780('0x3f'):if(_0x469c11[_0x2780('0x29')]&&_0x469c11[_0x2780('0x2a')]){var _0x3f34d3={'messages':[{'source':_0x2780('0x40'),'to':_0x4f7d82[_0x2780('0x1f')],'body':_0x4f7d82[_0x2780('0x8')],'from':_0x469c11[_0x2780('0x3c')]||_0x469c11['phone']}]};var _0x330cc9=util[_0x2780('0x41')]('%s:%s',_0x469c11[_0x2780('0x29')],_0x469c11['password']);var _0x185a06={'method':'POST','uri':_0x2780('0x42'),'body':_0x3f34d3,'headers':{'Authorization':util['format'](_0x2780('0x43'),new Buffer(_0x330cc9)[_0x2780('0x44')](_0x2780('0x45')))},'json':!![]};rp(_0x185a06)[_0x2780('0x13')](function(_0x478522){if(_0x478522[_0x2780('0x46')]>=0xc8&&_0x478522['http_code']<=0xce){if(_0x478522[_0x2780('0x47')]&&_0x478522[_0x2780('0x47')]['queued_count']>0x0){var _0xdff9ba=_['head'](_0x478522[_0x2780('0x47')][_0x2780('0x1d')]);var _0x5d40c0={'messageId':_0xdff9ba['message_id']};if(!_0x469c11[_0x2780('0x36')]){_0x5d40c0['read']=!![];}return _0x5e89ba['update'](_0x5d40c0);}else{logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x48'),util[_0x2780('0x39')](_0x478522,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x48'),util[_0x2780('0x39')](_0x478522,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2867d3){logger['error'](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x48'),util['inspect'](_0x2867d3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x48'),_0x2780('0x3a'));}break;case _0x2780('0x49'):if(_0x469c11[_0x2780('0x4a')]&&_0x469c11[_0x2780('0x1c')]){var _0x3f34d3={'dst':_0x4f7d82[_0x2780('0x1f')],'text':_0x4f7d82['body'],'src':_0x469c11[_0x2780('0x3c')]||_0x469c11['phone'],'url':_0x469c11[_0x2780('0x20')]+_0x2780('0x21')+_0x4f7d82['id']+_0x2780('0x22')+_0x469c11['token']};var _0x330cc9=util[_0x2780('0x41')](_0x2780('0x4b'),_0x469c11[_0x2780('0x4a')],_0x469c11[_0x2780('0x1c')]);var _0x185a06={'method':_0x2780('0x31'),'uri':util[_0x2780('0x41')](_0x2780('0x4c'),_0x469c11[_0x2780('0x4a')]),'body':_0x3f34d3,'headers':{'Authorization':util[_0x2780('0x41')](_0x2780('0x43'),new Buffer(_0x330cc9)['toString'](_0x2780('0x45')))},'json':!![]};rp(_0x185a06)[_0x2780('0x13')](function(_0x138f89){var _0x5993a2={'messageId':_0x138f89[_0x2780('0x4d')][0x0]};return _0x5e89ba[_0x2780('0x14')](_0x5993a2);})[_0x2780('0x25')](function(_0x43f937){logger[_0x2780('0x16')](_0x2780('0x26'),'afterCreate',_0x2780('0x49'),util[_0x2780('0x39')](_0x43f937,{'showHidden':![],'depth':null}));});}else{logger[_0x2780('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2780('0x49'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x2780('0x4e'):if(_0x469c11[_0x2780('0x29')]&&_0x469c11[_0x2780('0x2a')]){if(_0x469c11['baseUrl']){var _0x5922ac={'method':_0x2780('0x31'),'uri':_0x469c11['baseUrl']+_0x2780('0x4f'),'body':{'username':_0x469c11[_0x2780('0x29')],'password':_0x469c11[_0x2780('0x2a')]},'json':!![]};return rp(_0x5922ac)[_0x2780('0x13')](function(_0x112f8f){var _0x22a8f0={'method':'POST','uri':_0x469c11[_0x2780('0x50')]+_0x2780('0x51'),'body':{'messages':[{'from':_0x469c11['phone'],'destinations':[{'to':_0x4f7d82['phone']}],'text':_0x4f7d82[_0x2780('0x8')],'notifyUrl':_0x469c11['remote']+_0x2780('0x21')+_0x4f7d82['id']+_0x2780('0x22')+_0x469c11[_0x2780('0x23')],'notifyContentType':'application/json','callbackData':_0x469c11['phone']+';'+_0x4f7d82[_0x2780('0x8')]}]},'headers':{'Authorization':_0x2780('0x52')+_0x112f8f[_0x2780('0x23')]},'json':!![]};return rp(_0x22a8f0)['then'](function(_0x4aa44f){if(_0x4aa44f['messages']){var _0x3daf20={'messageId':_0x4aa44f[_0x2780('0x1d')][0x0][_0x2780('0x6')]};if(!_0x469c11[_0x2780('0x36')]){_0x3daf20['read']=!![];}return _0x5e89ba[_0x2780('0x14')](_0x3daf20);}else{return logger['error'](_0x2780('0x26'),'afterCreate',_0x2780('0x4e'),util[_0x2780('0x39')](_0x4aa44f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3ad46a){return logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),'infobip',util[_0x2780('0x39')](_0x3ad46a,{'showHidden':![],'depth':null}));});}else{logger[_0x2780('0x16')](_0x2780('0x26'),'afterCreate',_0x2780('0x4e'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2780('0x53'):var _0x2926ca=require('crypto');if(_0x469c11[_0x2780('0x54')]){var _0x540887={};_0x540887[_0x2780('0x55')]=_0x469c11['username'];_0x540887['phone']=_0x4f7d82[_0x2780('0x1f')];_0x540887[_0x2780('0x2c')]=_0x469c11[_0x2780('0x1f')];_0x540887[_0x2780('0x56')]=_0x4f7d82[_0x2780('0x8')];_0x540887[_0x2780('0x57')]=+new Date();var _0xa604d1='';var _0x4a7c9c='';var _0x18bef6=Object[_0x2780('0x58')](_0x540887);_0x18bef6[_0x2780('0x59')]();for(var _0x5dabb0=0x0;_0x5dabb0<_0x18bef6[_0x2780('0x5a')];_0x5dabb0++){if(_0xa604d1!=''){_0xa604d1+='&';}_0xa604d1+=_0x18bef6[_0x5dabb0]+'='+encodeURIComponent(_0x540887[_0x18bef6[_0x5dabb0]]);_0x4a7c9c+=_0x540887[_0x18bef6[_0x5dabb0]];}_0x4a7c9c+=_0x469c11['apiKey'];_0x4a7c9c=_0x2926ca[_0x2780('0x5b')](_0x2780('0x5c'))[_0x2780('0x14')](_0x4a7c9c)[_0x2780('0x5d')](_0x2780('0x5e'));if(_0xa604d1!==''){_0xa604d1+='&';}_0xa604d1+='signature='+_0x4a7c9c;var _0x6d74a2={'method':'GET','uri':_0x469c11[_0x2780('0x50')]+'/external/get/send.php?'+_0xa604d1,'json':!![]};return rp(_0x6d74a2)[_0x2780('0x13')](function(_0x613b5f){var _0x16e5db=Object[_0x2780('0x58')](_0x613b5f);if(_0x613b5f[_0x16e5db[0x0]][_0x2780('0x16')]&&parseInt(_0x613b5f[_0x16e5db[0x0]][_0x2780('0x16')])===0x0){var _0x11d194={'messageId':_0x613b5f[_0x16e5db[0x0]]['id_sms']};if(!_0x469c11[_0x2780('0x36')]){_0x11d194[_0x2780('0x37')]=!![];}return _0x5e89ba[_0x2780('0x14')](_0x11d194);}else{return logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x53'),util['inspect'](_0x613b5f[_0x2780('0x16')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4904ab){return logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x53'),util[_0x2780('0x39')](_0x4904ab,{'showHidden':![],'depth':null}));});}else{logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x53'),_0x2780('0x5f'));}break;case _0x2780('0x60'):if(_0x469c11[_0x2780('0x54')]){var _0x530c51={'method':_0x2780('0x31'),'uri':_0x2780('0x61'),'headers':{'Authorization':_0x469c11[_0x2780('0x54')]},'body':{'content':_0x4f7d82['body'],'to':[_0x4f7d82[_0x2780('0x1f')]],'from':_0x469c11[_0x2780('0x1f')],'binary':![],'clientMessageId':_0x2780('0x62'),'charset':_0x2780('0x63')},'json':!![]};rp(_0x530c51)[_0x2780('0x13')](function(_0x1981fa){if(!_0x1981fa[_0x2780('0x16')]){var _0x59144a={'messageId':_0x1981fa['messages'][0x0][_0x2780('0x64')]};if(!_0x469c11[_0x2780('0x36')]){_0x59144a[_0x2780('0x37')]=!![];}return _0x5e89ba[_0x2780('0x14')](_0x59144a);}else{return logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),'clickatell',util['inspect'](_0x1981fa['error'],{'showHidden':![],'depth':null}));}})[_0x2780('0x25')](function(_0x4f5fb5){return logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),'clickatell',util[_0x2780('0x39')](_0x4f5fb5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2780('0x26'),'afterCreate',_0x2780('0x60'),_0x2780('0x5f'));}break;case'bandwidth':if(_0x469c11[_0x2780('0x29')]&&_0x469c11[_0x2780('0x2a')]){var _0x330cc9=util[_0x2780('0x41')]('%s:%s',_0x469c11[_0x2780('0x29')],_0x469c11[_0x2780('0x2a')]);var _0x185a06={'method':_0x2780('0x31'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x469c11['accountId']+_0x2780('0x65'),'body':{'to':[_0x4f7d82[_0x2780('0x1f')]],'text':_0x4f7d82['body'],'from':_0x469c11[_0x2780('0x1f')],'applicationId':_0x469c11[_0x2780('0x66')]},'headers':{'Authorization':util[_0x2780('0x41')]('Basic\x20%s',new Buffer(_0x330cc9)[_0x2780('0x44')](_0x2780('0x45')))},'json':!![]};rp(_0x185a06)[_0x2780('0x13')](function(_0x26de12){if(_0x26de12['id']){var _0x1aba88={'messageId':_0x26de12['id']};return _0x5e89ba['update'](_0x1aba88);}else{logger['error'](_0x2780('0x26'),'afterCreate',_0x2780('0x67'),util[_0x2780('0x39')](_0x26de12,{'showHidden':![],'depth':null}));}})[_0x2780('0x25')](function(_0x3595a3){logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x67'),util[_0x2780('0x39')](_0x3595a3,{'showHidden':![],'depth':null}));});}else{logger[_0x2780('0x16')](_0x2780('0x26'),_0x2780('0x27'),'bandwidth',_0x2780('0x3a'));}break;case _0x2780('0x68'):if(_0x469c11[_0x2780('0x54')]){var _0x1d78b4={};var _0x6d74a2={'method':_0x2780('0x31'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x469c11[_0x2780('0x54')],'Content-Type':_0x2780('0x69')},'body':{'from':_0x469c11[_0x2780('0x1f')],'to':_0x4f7d82[_0x2780('0x1f')],'text':_0x4f7d82[_0x2780('0x8')]},'json':!![]};return rp(_0x6d74a2)[_0x2780('0x13')](function(_0xdf39ef){if(_0xdf39ef[_0x2780('0x6a')]==0xca){_0x1d78b4[_0x2780('0x6b')]=_0xdf39ef;var _0x404763={'method':_0x2780('0x31'),'uri':_0x2780('0x6c'),'headers':{'Authorization':_0x2780('0x6d')+_0x469c11[_0x2780('0x54')],'Content-Type':_0x2780('0x69')},'body':{'refid':_0x1d78b4[_0x2780('0x6b')][_0x2780('0x6e')]},'json':!![]};return rp(_0x404763)[_0x2780('0x13')](function(_0x2fe79e){_0x1d78b4['status']=_0x2fe79e;var _0x1d2345={'messageId':_0x1d78b4[_0x2780('0x6b')]['refid'],'read':!![]};return _0x5e89ba[_0x2780('0x14')](_0x1d2345);});}else{return logger[_0x2780('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2780('0x68'),util['inspect'](_0xdf39ef,{'showHidden':![],'depth':null}));}})['catch'](function(_0x21dc86){return logger[_0x2780('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2780('0x27'),_0x2780('0x68'),util[_0x2780('0x39')](_0x21dc86,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x2780('0x26'),_0x2780('0x27'),_0x2780('0x68'),_0x2780('0x6f'));}break;}}})[_0x2780('0x70')](function(){_0x583581();});}else{_0x583581();}}},'charset':_0x2780('0x71'),'collate':_0x2780('0x72')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 52acf2e..9d3fb4f 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 _0x907c=['SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsMessage','SmsMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info'];(function(_0x240376,_0x434c95){var _0x3d9582=function(_0x54cf7f){while(--_0x54cf7f){_0x240376['push'](_0x240376['shift']());}};_0x3d9582(++_0x434c95);}(_0x907c,0x1bf));var _0xc907=function(_0x5322cf,_0x246e56){_0x5322cf=_0x5322cf-0x0;var _0xf74f1c=_0x907c[_0x5322cf];return _0xf74f1c;};'use strict';var _=require(_0xc907('0x0'));var util=require(_0xc907('0x1'));var moment=require(_0xc907('0x2'));var BPromise=require(_0xc907('0x3'));var rs=require(_0xc907('0x4'));var fs=require('fs');var Redis=require(_0xc907('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc907('0x6'));var logger=require(_0xc907('0x7'))(_0xc907('0x8'));var config=require(_0xc907('0x9'));var jayson=require(_0xc907('0xa'));var client=jayson['client'][_0xc907('0xb')]({'port':0x232a});config[_0xc907('0xc')]=_[_0xc907('0xd')](config[_0xc907('0xc')],{'host':_0xc907('0xe'),'port':0x18eb});var socket=require(_0xc907('0xf'))(new Redis(config[_0xc907('0xc')]));require(_0xc907('0x10'))[_0xc907('0x11')](socket);function respondWithRpcPromise(_0x30d13e,_0x357196,_0x15bef0){return new BPromise(function(_0x3cfe4b,_0x5a838c){return client[_0xc907('0x12')](_0x30d13e,_0x15bef0)[_0xc907('0x13')](function(_0x3c12ba){logger[_0xc907('0x14')](_0xc907('0x15'),_0x357196,_0xc907('0x16'));logger[_0xc907('0x17')](_0xc907('0x18'),_0x357196,_0xc907('0x16'),JSON[_0xc907('0x19')](_0x3c12ba));if(_0x3c12ba['error']){if(_0x3c12ba[_0xc907('0x1a')][_0xc907('0x1b')]===0x1f4){logger[_0xc907('0x1a')](_0xc907('0x15'),_0x357196,_0x3c12ba[_0xc907('0x1a')]['message']);return _0x5a838c(_0x3c12ba[_0xc907('0x1a')][_0xc907('0x1c')]);}logger['error'](_0xc907('0x15'),_0x357196,_0x3c12ba[_0xc907('0x1a')][_0xc907('0x1c')]);return _0x3cfe4b(_0x3c12ba[_0xc907('0x1a')][_0xc907('0x1c')]);}else{logger[_0xc907('0x14')](_0xc907('0x15'),_0x357196,_0xc907('0x16'));_0x3cfe4b(_0x3c12ba['result'][_0xc907('0x1c')]);}})['catch'](function(_0xb4042b){logger[_0xc907('0x1a')](_0xc907('0x15'),_0x357196,_0xb4042b);_0x5a838c(_0xb4042b);});});}exports[_0xc907('0x1d')]=function(_0x3f6eb6){var _0x2a61df=this;return new Promise(function(_0x111391,_0x45cbbb){return db[_0xc907('0x1e')][_0xc907('0x1f')](_0x3f6eb6[_0xc907('0x20')],{'raw':_0x3f6eb6[_0xc907('0x21')]?_0x3f6eb6['options'][_0xc907('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x20fd59){logger[_0xc907('0x14')](_0xc907('0x1d'),_0x3f6eb6);logger[_0xc907('0x17')](_0xc907('0x1d'),_0x3f6eb6,JSON[_0xc907('0x19')](_0x20fd59));_0x111391(_0x20fd59);})[_0xc907('0x23')](function(_0x557208){logger['error']('CreateSmsMessage',_0x557208[_0xc907('0x1c')],_0x3f6eb6);_0x45cbbb(_0x2a61df[_0xc907('0x1a')](0x1f4,_0x557208['message']));});});}; \ No newline at end of file +var _0x5ec8=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x6a3088,_0x50fb83){var _0x31a395=function(_0x47f161){while(--_0x47f161){_0x6a3088['push'](_0x6a3088['shift']());}};_0x31a395(++_0x50fb83);}(_0x5ec8,0xab));var _0x85ec=function(_0x248dc8,_0x10c027){_0x248dc8=_0x248dc8-0x0;var _0x15aaee=_0x5ec8[_0x248dc8];return _0x15aaee;};'use strict';var _=require(_0x85ec('0x0'));var util=require(_0x85ec('0x1'));var moment=require(_0x85ec('0x2'));var BPromise=require(_0x85ec('0x3'));var rs=require(_0x85ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85ec('0x5'))['db'];var utils=require(_0x85ec('0x6'));var logger=require(_0x85ec('0x7'))('rpc');var config=require(_0x85ec('0x8'));var jayson=require(_0x85ec('0x9'));var client=jayson[_0x85ec('0xa')][_0x85ec('0xb')]({'port':0x232a});config[_0x85ec('0xc')]=_[_0x85ec('0xd')](config['redis'],{'host':_0x85ec('0xe'),'port':0x18eb});var socket=require(_0x85ec('0xf'))(new Redis(config[_0x85ec('0xc')]));require(_0x85ec('0x10'))[_0x85ec('0x11')](socket);function respondWithRpcPromise(_0x542a6b,_0x5dbd52,_0x88f4cd){return new BPromise(function(_0x59556d,_0x1b2933){return client[_0x85ec('0x12')](_0x542a6b,_0x88f4cd)['then'](function(_0x40fbb5){logger['info'](_0x85ec('0x13'),_0x5dbd52,_0x85ec('0x14'));logger[_0x85ec('0x15')](_0x85ec('0x16'),_0x5dbd52,_0x85ec('0x14'),JSON['stringify'](_0x40fbb5));if(_0x40fbb5[_0x85ec('0x17')]){if(_0x40fbb5[_0x85ec('0x17')][_0x85ec('0x18')]===0x1f4){logger['error'](_0x85ec('0x13'),_0x5dbd52,_0x40fbb5[_0x85ec('0x17')]['message']);return _0x1b2933(_0x40fbb5[_0x85ec('0x17')][_0x85ec('0x19')]);}logger[_0x85ec('0x17')]('SmsMessage,\x20%s,\x20%s',_0x5dbd52,_0x40fbb5[_0x85ec('0x17')][_0x85ec('0x19')]);return _0x59556d(_0x40fbb5[_0x85ec('0x17')][_0x85ec('0x19')]);}else{logger[_0x85ec('0x1a')]('SmsMessage,\x20%s,\x20%s',_0x5dbd52,_0x85ec('0x14'));_0x59556d(_0x40fbb5[_0x85ec('0x1b')][_0x85ec('0x19')]);}})[_0x85ec('0x1c')](function(_0x2f8741){logger[_0x85ec('0x17')](_0x85ec('0x13'),_0x5dbd52,_0x2f8741);_0x1b2933(_0x2f8741);});});}exports[_0x85ec('0x1d')]=function(_0x4f279e){var _0x33e7ff=this;return new Promise(function(_0x569ac6,_0x4864c0){return db[_0x85ec('0x1e')][_0x85ec('0x1f')](_0x4f279e[_0x85ec('0x20')],{'raw':_0x4f279e['options']?_0x4f279e[_0x85ec('0x21')][_0x85ec('0x22')]===undefined?!![]:![]:!![]})[_0x85ec('0x23')](function(_0x5e4796){logger[_0x85ec('0x1a')](_0x85ec('0x1d'),_0x4f279e);logger[_0x85ec('0x15')](_0x85ec('0x1d'),_0x4f279e,JSON['stringify'](_0x5e4796));_0x569ac6(_0x5e4796);})[_0x85ec('0x1c')](function(_0x4a26f5){logger['error']('CreateSmsMessage',_0x4a26f5['message'],_0x4f279e);_0x4864c0(_0x33e7ff[_0x85ec('0x17')](0x1f4,_0x4a26f5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c7dffb3..f428e80 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 _0xc283=['remove','update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xc283,0x1ed));var _0x3c28=function(_0x4c3541,_0x404ed4){_0x4c3541=_0x4c3541-0x0;var _0x18fc7e=_0xc283[_0x4c3541];return _0x18fc7e;};'use strict';var SmsMessageEvents=require(_0x3c28('0x0'));var events=[_0x3c28('0x1'),_0x3c28('0x2'),_0x3c28('0x3')];function createListener(_0x2eaef3,_0x308517){return function(_0xb22392){_0x308517[_0x3c28('0x4')](_0x2eaef3,_0xb22392);};}function removeListener(_0x3940c9,_0x13a7c5){return function(){SmsMessageEvents[_0x3c28('0x5')](_0x3940c9,_0x13a7c5);};}exports[_0x3c28('0x6')]=function(_0x285a70){for(var _0x265f61=0x0,_0x54b860=events[_0x3c28('0x7')];_0x265f61<_0x54b860;_0x265f61++){var _0x9f7a0b=events[_0x265f61];var _0x101bb4=createListener(_0x3c28('0x8')+_0x9f7a0b,_0x285a70);SmsMessageEvents['on'](_0x9f7a0b,_0x101bb4);}}; \ No newline at end of file +var _0x1db2=['save','remove','update','emit','register','length','smsMessage:','./smsMessage.events'];(function(_0x55448f,_0x3e3e03){var _0x8f929b=function(_0x3c2a27){while(--_0x3c2a27){_0x55448f['push'](_0x55448f['shift']());}};_0x8f929b(++_0x3e3e03);}(_0x1db2,0x147));var _0x21db=function(_0x24cc71,_0x1e138c){_0x24cc71=_0x24cc71-0x0;var _0x500dee=_0x1db2[_0x24cc71];return _0x500dee;};'use strict';var SmsMessageEvents=require(_0x21db('0x0'));var events=[_0x21db('0x1'),_0x21db('0x2'),_0x21db('0x3')];function createListener(_0x36947a,_0x190b39){return function(_0x3aff7c){_0x190b39[_0x21db('0x4')](_0x36947a,_0x3aff7c);};}function removeListener(_0x399c74,_0x59780c){return function(){SmsMessageEvents['removeListener'](_0x399c74,_0x59780c);};}exports[_0x21db('0x5')]=function(_0x3d70cf){for(var _0x5d16c1=0x0,_0x554cb8=events[_0x21db('0x6')];_0x5d16c1<_0x554cb8;_0x5d16c1++){var _0x40cebf=events[_0x5d16c1];var _0x10da00=createListener(_0x21db('0x7')+_0x40cebf,_0x3d70cf);SmsMessageEvents['on'](_0x40cebf,_0x10da00);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7ce4ae7..4496b15 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 _0xef17=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','put','/:id','update','delete','destroy'];(function(_0x333db6,_0x4fde9e){var _0x59c239=function(_0x56f21b){while(--_0x56f21b){_0x333db6['push'](_0x333db6['shift']());}};_0x59c239(++_0x4fde9e);}(_0xef17,0x158));var _0x7ef1=function(_0x5bfd92,_0x2802c5){_0x5bfd92=_0x5bfd92-0x0;var _0xacb8f0=_0xef17[_0x5bfd92];return _0xacb8f0;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7ef1('0x8'));var controller=require('./smsQueue.controller');router[_0x7ef1('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ef1('0xa')]);router[_0x7ef1('0x9')](_0x7ef1('0xb'),auth[_0x7ef1('0xc')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0x9')]('/:id',auth[_0x7ef1('0xc')](),controller['show']);router[_0x7ef1('0x9')](_0x7ef1('0xe'),auth['isAuthenticated'](),controller[_0x7ef1('0xf')]);router[_0x7ef1('0x9')]('/:id/teams',auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x9')](_0x7ef1('0x11'),auth[_0x7ef1('0xc')](),controller['getAgents']);router['post']('/',auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x12')]);router[_0x7ef1('0x13')](_0x7ef1('0x14'),auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x15')]);router[_0x7ef1('0x13')]('/:id/users',auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x16')]);router[_0x7ef1('0x17')](_0x7ef1('0x18'),auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x19')]);router[_0x7ef1('0x1a')](_0x7ef1('0x18'),auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x1b')]);router[_0x7ef1('0x1a')](_0x7ef1('0x14'),auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x1c')]);router[_0x7ef1('0x1a')](_0x7ef1('0x11'),auth[_0x7ef1('0xc')](),controller[_0x7ef1('0x1d')]);module[_0x7ef1('0x1e')]=router; \ No newline at end of file +var _0xe951=['put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams'];(function(_0x3e64ab,_0x5aeb80){var _0x43009d=function(_0x4a6c80){while(--_0x4a6c80){_0x3e64ab['push'](_0x3e64ab['shift']());}};_0x43009d(++_0x5aeb80);}(_0xe951,0x10d));var _0x1e95=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xe951[_0x2601b4];return _0x3e3661;};'use strict';var multer=require('multer');var util=require(_0x1e95('0x0'));var path=require(_0x1e95('0x1'));var timeout=require('connect-timeout');var express=require(_0x1e95('0x2'));var router=express[_0x1e95('0x3')]();var fs_extra=require(_0x1e95('0x4'));var auth=require(_0x1e95('0x5'));var interaction=require(_0x1e95('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router['get']('/',auth[_0x1e95('0x7')](),controller[_0x1e95('0x8')]);router[_0x1e95('0x9')](_0x1e95('0xa'),auth[_0x1e95('0x7')](),controller[_0x1e95('0xb')]);router[_0x1e95('0x9')]('/:id',auth[_0x1e95('0x7')](),controller[_0x1e95('0xc')]);router[_0x1e95('0x9')](_0x1e95('0xd'),auth[_0x1e95('0x7')](),controller[_0x1e95('0xe')]);router['get'](_0x1e95('0xf'),auth[_0x1e95('0x7')](),controller[_0x1e95('0x10')]);router['get'](_0x1e95('0x11'),auth[_0x1e95('0x7')](),controller[_0x1e95('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1e95('0x13')](_0x1e95('0xf'),auth[_0x1e95('0x7')](),controller[_0x1e95('0x14')]);router[_0x1e95('0x13')](_0x1e95('0x11'),auth[_0x1e95('0x7')](),controller['addAgents']);router[_0x1e95('0x15')](_0x1e95('0x16'),auth[_0x1e95('0x7')](),controller[_0x1e95('0x17')]);router[_0x1e95('0x18')]('/:id',auth[_0x1e95('0x7')](),controller[_0x1e95('0x19')]);router[_0x1e95('0x18')]('/:id/teams',auth[_0x1e95('0x7')](),controller[_0x1e95('0x1a')]);router[_0x1e95('0x18')]('/:id/users',auth[_0x1e95('0x7')](),controller[_0x1e95('0x1b')]);module[_0x1e95('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 967f358..326bd70 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 _0x1760=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x26fbd9,_0x159518){var _0xb3e5d5=function(_0x39a4aa){while(--_0x39a4aa){_0x26fbd9['push'](_0x26fbd9['shift']());}};_0xb3e5d5(++_0x159518);}(_0x1760,0x9a));var _0x0176=function(_0x4690c7,_0x300faf){_0x4690c7=_0x4690c7-0x0;var _0x6912ab=_0x1760[_0x4690c7];return _0x6912ab;};'use strict';var Sequelize=require(_0x0176('0x0'));module[_0x0176('0x1')]={'name':{'type':Sequelize[_0x0176('0x2')],'unique':_0x0176('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0176('0x2')]},'timeout':{'type':Sequelize[_0x0176('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0176('0x5')](_0x0176('0x6'),'beepall',_0x0176('0x7'))}}; \ No newline at end of file +var _0x6fda=['exports','STRING','name','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x6fda,0x7d));var _0xa6fd=function(_0x4c7333,_0x3c708d){_0x4c7333=_0x4c7333-0x0;var _0x3033fb=_0x6fda[_0x4c7333];return _0x3033fb;};'use strict';var Sequelize=require(_0xa6fd('0x0'));module[_0xa6fd('0x1')]={'name':{'type':Sequelize[_0xa6fd('0x2')],'unique':_0xa6fd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6fd('0x2')]},'timeout':{'type':Sequelize[_0xa6fd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6fd('0x5')]('rrmemory','beepall',_0xa6fd('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0481d2a..91e30e8 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 _0x398a=['mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsQueue.socket','status','end','offset','undefined','limit','count','set','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','autoAssociation','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','%s/%s','smsPause','getTeams','nolimit','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userSmsQueue:save','removeTeams','Agents','select','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xbead20,_0x2876c4){var _0x5f07bd=function(_0x451c9a){while(--_0x451c9a){_0xbead20['push'](_0xbead20['shift']());}};_0x5f07bd(++_0x2876c4);}(_0x398a,0x7d));var _0xa398=function(_0x54a4a2,_0x3359fe){_0x54a4a2=_0x54a4a2-0x0;var _0x1d6351=_0x398a[_0x54a4a2];return _0x1d6351;};'use strict';var emlformat=require(_0xa398('0x0'));var rimraf=require(_0xa398('0x1'));var zipdir=require(_0xa398('0x2'));var jsonpatch=require(_0xa398('0x3'));var rp=require(_0xa398('0x4'));var moment=require(_0xa398('0x5'));var BPromise=require(_0xa398('0x6'));var Mustache=require(_0xa398('0x7'));var util=require(_0xa398('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa398('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa398('0xa'));var squel=require(_0xa398('0xb'));var crypto=require(_0xa398('0xc'));var jsforce=require(_0xa398('0xd'));var deskjs=require(_0xa398('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa398('0xf'));var Papa=require(_0xa398('0x10'));var Redis=require(_0xa398('0x11'));var authService=require(_0xa398('0x12'));var qs=require(_0xa398('0x13'));var as=require(_0xa398('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa398('0x15'));var utils=require(_0xa398('0x16'));var config=require(_0xa398('0x17'));var licenseUtil=require(_0xa398('0x18'));var db=require(_0xa398('0x19'))['db'];config[_0xa398('0x1a')]=_['defaults'](config[_0xa398('0x1a')],{'host':_0xa398('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa398('0x1a')]));require(_0xa398('0x1c'))['register'](socket);function respondWithStatusCode(_0x510bf9,_0x49bf48){_0x49bf48=_0x49bf48||0xcc;return function(_0xa81658){if(_0xa81658){return _0x510bf9['sendStatus'](_0x49bf48);}return _0x510bf9[_0xa398('0x1d')](_0x49bf48)[_0xa398('0x1e')]();};}function respondWithResult(_0x5696fd,_0x16aed7){_0x16aed7=_0x16aed7||0xc8;return function(_0x6ee48c){if(_0x6ee48c){return _0x5696fd[_0xa398('0x1d')](_0x16aed7)['json'](_0x6ee48c);}};}function respondWithFilteredResult(_0x27a3b8,_0x475860){return function(_0x2c56f9){if(_0x2c56f9){var _0xe64699=typeof _0x475860[_0xa398('0x1f')]===_0xa398('0x20')&&typeof _0x475860[_0xa398('0x21')]===_0xa398('0x20');var _0x547dda=_0x2c56f9[_0xa398('0x22')];var _0x24240d=_0xe64699?0x0:_0x475860[_0xa398('0x1f')];var _0x3addfa=_0xe64699?_0x2c56f9[_0xa398('0x22')]:_0x475860[_0xa398('0x1f')]+_0x475860['limit'];var _0x1437ff;if(_0x3addfa>=_0x547dda){_0x3addfa=_0x547dda;_0x1437ff=0xc8;}else{_0x1437ff=0xce;}_0x27a3b8[_0xa398('0x1d')](_0x1437ff);return _0x27a3b8[_0xa398('0x23')]('Content-Range',_0x24240d+'-'+_0x3addfa+'/'+_0x547dda)['json'](_0x2c56f9);}return null;};}function patchUpdates(_0x5a0712){return function(_0x3bd5ba){try{jsonpatch['apply'](_0x3bd5ba,_0x5a0712,!![]);}catch(_0x4d4bba){return BPromise['reject'](_0x4d4bba);}return _0x3bd5ba['save']();};}function saveUpdates(_0xe667b0,_0xb88abf){return function(_0x3cb403){if(_0x3cb403){return _0x3cb403[_0xa398('0x24')](_0xe667b0)[_0xa398('0x25')](function(_0x209acf){return _0x209acf;});}return null;};}function removeEntity(_0x4a87bd,_0x440a34){return function(_0x3ded3f){if(_0x3ded3f){return _0x3ded3f[_0xa398('0x26')]()[_0xa398('0x25')](function(){var _0xeda87b=_0x3ded3f['get']({'plain':!![]});var _0x30dc65='SmsQueues';return db[_0xa398('0x27')][_0xa398('0x26')]({'where':{'type':_0x30dc65,'resourceId':_0xeda87b['id']}})['then'](function(){return _0x3ded3f;});})['then'](function(){_0x4a87bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e631,_0x570a61){return function(_0xa4bbbf){if(!_0xa4bbbf){_0x23e631[_0xa398('0x28')](0x194);}return _0xa4bbbf;};}function handleError(_0x2aa2f5,_0x276748){_0x276748=_0x276748||0x1f4;return function(_0xe32a0d){logger[_0xa398('0x29')](_0xe32a0d[_0xa398('0x2a')]);if(_0xe32a0d['name']){delete _0xe32a0d[_0xa398('0x2b')];}_0x2aa2f5[_0xa398('0x1d')](_0x276748)[_0xa398('0x2c')](_0xe32a0d);};}exports[_0xa398('0x2d')]=function(_0x577fcf,_0x78f8fc){var _0x53ca08={},_0x527f98={},_0x2d17bb={'count':0x0,'rows':[]};var _0x708713=_[_0xa398('0x2e')](db[_0xa398('0x2f')][_0xa398('0x30')],function(_0x2acbd8){return{'name':_0x2acbd8['fieldName'],'type':_0x2acbd8['type'][_0xa398('0x31')]};});_0x527f98[_0xa398('0x32')]=_[_0xa398('0x2e')](_0x708713,_0xa398('0x2b'));_0x527f98[_0xa398('0x33')]=_[_0xa398('0x34')](_0x577fcf[_0xa398('0x33')]);_0x527f98[_0xa398('0x35')]=_[_0xa398('0x36')](_0x527f98[_0xa398('0x32')],_0x527f98['query']);_0x53ca08[_0xa398('0x37')]=_[_0xa398('0x36')](_0x527f98[_0xa398('0x32')],qs[_0xa398('0x38')](_0x577fcf[_0xa398('0x33')][_0xa398('0x38')]));_0x53ca08['attributes']=_0x53ca08['attributes'][_0xa398('0x39')]?_0x53ca08[_0xa398('0x37')]:_0x527f98[_0xa398('0x32')];if(!_0x577fcf[_0xa398('0x33')][_0xa398('0x3a')]('nolimit')){_0x53ca08['limit']=qs[_0xa398('0x21')](_0x577fcf[_0xa398('0x33')][_0xa398('0x21')]);_0x53ca08[_0xa398('0x1f')]=qs['offset'](_0x577fcf[_0xa398('0x33')][_0xa398('0x1f')]);}_0x53ca08[_0xa398('0x3b')]=qs['sort'](_0x577fcf[_0xa398('0x33')][_0xa398('0x3c')]);_0x53ca08['where']=qs[_0xa398('0x35')](_[_0xa398('0x3d')](_0x577fcf[_0xa398('0x33')],_0x527f98[_0xa398('0x35')]),_0x708713);if(_0x577fcf[_0xa398('0x33')][_0xa398('0x3e')]){_0x53ca08['where']=_['merge'](_0x53ca08[_0xa398('0x3f')],{'$or':_['map'](_0x708713,function(_0x1d5b2d){if(_0x1d5b2d['type']!=='VIRTUAL'){var _0x2f7bbe={};_0x2f7bbe[_0x1d5b2d['name']]={'$like':'%'+_0x577fcf['query'][_0xa398('0x3e')]+'%'};return _0x2f7bbe;}})});}_0x53ca08=_['merge']({},_0x53ca08,_0x577fcf[_0xa398('0x40')]);var _0xb963d0={'where':_0x53ca08[_0xa398('0x3f')]};return db[_0xa398('0x2f')][_0xa398('0x22')](_0xb963d0)[_0xa398('0x25')](function(_0xa2ad0a){_0x2d17bb[_0xa398('0x22')]=_0xa2ad0a;if(_0x577fcf[_0xa398('0x33')][_0xa398('0x41')]){_0x53ca08[_0xa398('0x42')]=[{'all':!![]}];}return db[_0xa398('0x2f')][_0xa398('0x43')](_0x53ca08);})[_0xa398('0x25')](function(_0x49882e){_0x2d17bb[_0xa398('0x44')]=_0x49882e;return _0x2d17bb;})[_0xa398('0x25')](respondWithFilteredResult(_0x78f8fc,_0x53ca08))[_0xa398('0x45')](handleError(_0x78f8fc,null));};exports['show']=function(_0x2f19e0,_0xad3c35){var _0x430872={'raw':!![],'where':{'id':_0x2f19e0[_0xa398('0x46')]['id']}},_0x26ed14={};_0x26ed14[_0xa398('0x32')]=_[_0xa398('0x34')](db[_0xa398('0x2f')]['rawAttributes']);_0x26ed14['query']=_[_0xa398('0x34')](_0x2f19e0[_0xa398('0x33')]);_0x26ed14['filters']=_[_0xa398('0x36')](_0x26ed14[_0xa398('0x32')],_0x26ed14[_0xa398('0x33')]);_0x430872[_0xa398('0x37')]=_[_0xa398('0x36')](_0x26ed14[_0xa398('0x32')],qs[_0xa398('0x38')](_0x2f19e0[_0xa398('0x33')][_0xa398('0x38')]));_0x430872[_0xa398('0x37')]=_0x430872[_0xa398('0x37')]['length']?_0x430872[_0xa398('0x37')]:_0x26ed14['model'];if(_0x2f19e0[_0xa398('0x33')][_0xa398('0x41')]){_0x430872[_0xa398('0x42')]=[{'all':!![]}];}_0x430872=_[_0xa398('0x47')]({},_0x430872,_0x2f19e0[_0xa398('0x40')]);return db['SmsQueue'][_0xa398('0x48')](_0x430872)['then'](handleEntityNotFound(_0xad3c35,null))[_0xa398('0x25')](respondWithResult(_0xad3c35,null))[_0xa398('0x45')](handleError(_0xad3c35,null));};exports[_0xa398('0x49')]=function(_0x539ee2,_0xd7cd46){return db['SmsQueue'][_0xa398('0x49')](_0x539ee2[_0xa398('0x4a')],{})[_0xa398('0x25')](function(_0x51f0a4){var _0x52e0b7=_0x539ee2[_0xa398('0x4b')][_0xa398('0x4c')]({'plain':!![]});if(!_0x52e0b7)throw new Error(_0xa398('0x4d'));if(_0x52e0b7[_0xa398('0x4e')]===_0xa398('0x4b')){var _0x423bba=_0x51f0a4[_0xa398('0x4c')]({'plain':!![]});var _0x37224b=_0xa398('0x4f');return db['UserProfileSection'][_0xa398('0x48')]({'where':{'name':_0x37224b,'userProfileId':_0x52e0b7[_0xa398('0x50')]},'raw':!![]})['then'](function(_0x3a5200){if(_0x3a5200&&_0x3a5200[_0xa398('0x51')]===0x0){return db[_0xa398('0x27')][_0xa398('0x49')]({'name':_0x423bba[_0xa398('0x2b')],'resourceId':_0x423bba['id'],'type':_0x3a5200[_0xa398('0x2b')],'sectionId':_0x3a5200['id']},{})['then'](function(){return _0x51f0a4;});}else{return _0x51f0a4;}})[_0xa398('0x45')](function(_0x55e967){logger[_0xa398('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55e967);throw _0x55e967;});}return _0x51f0a4;})[_0xa398('0x25')](respondWithResult(_0xd7cd46,0xc9))[_0xa398('0x45')](handleError(_0xd7cd46,null));};exports[_0xa398('0x24')]=function(_0x1bfa46,_0x3aff4c){if(_0x1bfa46[_0xa398('0x4a')]['id']){delete _0x1bfa46[_0xa398('0x4a')]['id'];}return db[_0xa398('0x2f')][_0xa398('0x48')]({'where':{'id':_0x1bfa46['params']['id']}})[_0xa398('0x25')](handleEntityNotFound(_0x3aff4c,null))[_0xa398('0x25')](saveUpdates(_0x1bfa46['body'],null))[_0xa398('0x25')](respondWithResult(_0x3aff4c,null))[_0xa398('0x45')](handleError(_0x3aff4c,null));};exports[_0xa398('0x26')]=function(_0x6f7d9f,_0x1e5206){return db[_0xa398('0x2f')][_0xa398('0x48')]({'where':{'id':_0x6f7d9f[_0xa398('0x46')]['id']}})[_0xa398('0x25')](handleEntityNotFound(_0x1e5206,null))[_0xa398('0x25')](removeEntity(_0x1e5206,null))[_0xa398('0x45')](handleError(_0x1e5206,null));};exports[_0xa398('0x52')]=function(_0x1e8d2c,_0x5d60d3){return db[_0xa398('0x2f')][_0xa398('0x52')]()[_0xa398('0x25')](respondWithResult(_0x5d60d3,null))['catch'](handleError(_0x5d60d3,null));};exports[_0xa398('0x53')]=function(_0x4de544,_0xb78a1d,_0x1f09a6){var _0x259d96={'raw':!![],'where':{}},_0x287fe5={},_0x3a16b6;return db[_0xa398('0x2f')][_0xa398('0x54')]({'where':{'id':_0x4de544[_0xa398('0x46')]['id']}})[_0xa398('0x25')](handleEntityNotFound(_0xb78a1d,null))[_0xa398('0x25')](function(_0x12fb0a){if(_0x12fb0a){_0x3a16b6=_0x12fb0a[_0xa398('0x4c')]({'plain':!![]});_0x287fe5[_0xa398('0x32')]=_[_0xa398('0x34')](db[_0xa398('0x55')][_0xa398('0x30')]);_0x287fe5[_0xa398('0x33')]=_[_0xa398('0x34')](_0x4de544[_0xa398('0x33')]);_0x287fe5[_0xa398('0x35')]=_[_0xa398('0x36')](_0x287fe5['model'],_0x287fe5[_0xa398('0x33')]);_0x259d96[_0xa398('0x37')]=_[_0xa398('0x36')](_0x287fe5[_0xa398('0x32')],qs['fields'](_0x4de544[_0xa398('0x33')][_0xa398('0x38')]));_0x259d96[_0xa398('0x37')]=_0x259d96[_0xa398('0x37')][_0xa398('0x39')]?_0x259d96['attributes']:_0x287fe5[_0xa398('0x32')];if(!_0x4de544[_0xa398('0x33')]['hasOwnProperty']('nolimit')){_0x259d96['limit']=qs[_0xa398('0x21')](_0x4de544[_0xa398('0x33')][_0xa398('0x21')]);_0x259d96[_0xa398('0x1f')]=qs[_0xa398('0x1f')](_0x4de544[_0xa398('0x33')][_0xa398('0x1f')]);}_0x259d96['order']=qs['sort'](_0x4de544[_0xa398('0x33')][_0xa398('0x3c')]);_0x259d96[_0xa398('0x3f')]=qs[_0xa398('0x35')](_[_0xa398('0x3d')](_0x4de544[_0xa398('0x33')],_0x287fe5[_0xa398('0x35')]));_0x259d96[_0xa398('0x3f')][_0xa398('0x56')]=_0x12fb0a['id'];if(_0x4de544[_0xa398('0x33')][_0xa398('0x3e')]){_0x259d96[_0xa398('0x3f')]=_['merge'](_0x259d96['where'],{'$or':_[_0xa398('0x2e')](_0x259d96[_0xa398('0x37')],function(_0x304e04){var _0x1cd570={};_0x1cd570[_0x304e04]={'$like':'%'+_0x4de544['query'][_0xa398('0x3e')]+'%'};return _0x1cd570;})});}_0x259d96=_['merge']({},_0x259d96,_0x4de544[_0xa398('0x40')]);return db['UserSmsQueue'][_0xa398('0x43')](_0x259d96);}})[_0xa398('0x25')](function(_0x4c9488){if(_0x4c9488){return db[_0xa398('0x57')][_0xa398('0x58')]({'where':{'id':_[_0xa398('0x2e')](_0x4c9488,_0xa398('0x59')),'role':_0xa398('0x5a')},'attributes':['id',_0xa398('0x2b'),'smsPause',_0xa398('0x5b'),'createdAt']});}})[_0xa398('0x25')](function(_0x61532a){if(_0x61532a){return{'count':_0x61532a['count'],'rows':_[_0xa398('0x2e')](_0x61532a[_0xa398('0x44')],function(_0x5b3359){return{'membername':_0x5b3359[_0xa398('0x2b')],'UserId':_0x5b3359['id'],'queue_name':_0x3a16b6[_0xa398('0x2b')],'SmsQueueId':_0x3a16b6['id'],'interface':util['format'](_0xa398('0x5c'),'SIP',_0x5b3359[_0xa398('0x2b')]),'penalty':0x0,'paused':_0x5b3359[_0xa398('0x5d')],'createdAt':_0x5b3359['createdAt'],'updatedAt':_0x5b3359[_0xa398('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa398('0x25')](respondWithFilteredResult(_0xb78a1d,_0x259d96))['catch'](handleError(_0xb78a1d,null));};exports[_0xa398('0x5e')]=function(_0x3a0aed,_0x4e4892,_0x2b02d1){var _0x21d488={};var _0x2d6751={};var _0x371d89;var _0x2637d5;return db[_0xa398('0x2f')]['findOne']({'where':{'id':_0x3a0aed[_0xa398('0x46')]['id']}})[_0xa398('0x25')](handleEntityNotFound(_0x4e4892,null))[_0xa398('0x25')](function(_0x1a2f1b){if(_0x1a2f1b){_0x371d89=_0x1a2f1b;_0x2d6751[_0xa398('0x32')]=_[_0xa398('0x34')](db['Team']['rawAttributes']);_0x2d6751[_0xa398('0x33')]=_['keys'](_0x3a0aed[_0xa398('0x33')]);_0x2d6751['filters']=_[_0xa398('0x36')](_0x2d6751['model'],_0x2d6751[_0xa398('0x33')]);_0x21d488['attributes']=_[_0xa398('0x36')](_0x2d6751[_0xa398('0x32')],qs[_0xa398('0x38')](_0x3a0aed[_0xa398('0x33')][_0xa398('0x38')]));_0x21d488[_0xa398('0x37')]=_0x21d488[_0xa398('0x37')][_0xa398('0x39')]?_0x21d488['attributes']:_0x2d6751[_0xa398('0x32')];_0x21d488[_0xa398('0x3b')]=qs[_0xa398('0x3c')](_0x3a0aed[_0xa398('0x33')][_0xa398('0x3c')]);_0x21d488['where']=qs[_0xa398('0x35')](_[_0xa398('0x3d')](_0x3a0aed[_0xa398('0x33')],_0x2d6751['filters']));if(_0x3a0aed[_0xa398('0x33')]['filter']){_0x21d488[_0xa398('0x3f')]=_[_0xa398('0x47')](_0x21d488[_0xa398('0x3f')],{'$or':_[_0xa398('0x2e')](_0x21d488[_0xa398('0x37')],function(_0x4bca09){var _0xc60e72={};_0xc60e72[_0x4bca09]={'$like':'%'+_0x3a0aed[_0xa398('0x33')][_0xa398('0x3e')]+'%'};return _0xc60e72;})});}_0x21d488=_[_0xa398('0x47')]({},_0x21d488,_0x3a0aed[_0xa398('0x40')]);return _0x371d89[_0xa398('0x5e')](_0x21d488);}})[_0xa398('0x25')](function(_0x45a151){if(_0x45a151){_0x2637d5=_0x45a151[_0xa398('0x39')];if(!_0x3a0aed['query'][_0xa398('0x3a')](_0xa398('0x5f'))){_0x21d488[_0xa398('0x21')]=qs[_0xa398('0x21')](_0x3a0aed['query']['limit']);_0x21d488[_0xa398('0x1f')]=qs[_0xa398('0x1f')](_0x3a0aed[_0xa398('0x33')]['offset']);}return _0x371d89[_0xa398('0x5e')](_0x21d488);}})[_0xa398('0x25')](function(_0x17d0e1){if(_0x17d0e1){return _0x17d0e1?{'count':_0x2637d5,'rows':_0x17d0e1}:null;}})[_0xa398('0x25')](respondWithResult(_0x4e4892,null))[_0xa398('0x45')](handleError(_0x4e4892,null));};exports[_0xa398('0x60')]=function(_0x1ad604,_0x5c67ef,_0x533612){var _0x11a701=_0x1ad604[_0xa398('0x4a')][_0xa398('0x61')];return db['Team'][_0xa398('0x43')]({'where':{'id':_0x11a701},'attributes':['id'],'include':[{'model':db[_0xa398('0x57')],'as':'Agents','attributes':['id',_0xa398('0x2b'),_0xa398('0x62'),_0xa398('0x63'),_0xa398('0x64')],'raw':!![]}]})[_0xa398('0x25')](function(_0x3d53a2){if(_0x3d53a2){var _0x13037d=_[_0xa398('0x65')](_0x3d53a2,function(_0x4f9e74){var _0x169ddf=_0x4f9e74[_0xa398('0x4c')]({'plain':!![]});return _0x169ddf['Agents'];});return db['SmsQueue'][_0xa398('0x48')]({'where':{'id':_0x1ad604[_0xa398('0x46')]['id']}})['then'](function(_0x703d8e){return db[_0xa398('0x66')][_0xa398('0x67')](function(_0x2d3484){return _0x703d8e[_0xa398('0x60')](_0x11a701,{'transaction':_0x2d3484})[_0xa398('0x25')](function(){return BPromise['each'](_0x13037d,function(_0x2805a4){return db[_0xa398('0x55')][_0xa398('0x68')]({'where':{'UserId':_0x2805a4['id'],'SmsQueueId':_0x1ad604[_0xa398('0x46')]['id']},'transaction':_0x2d3484});});})[_0xa398('0x25')](function(){_0x13037d['forEach'](function(_0x56a3b7){socket[_0xa398('0x69')](_0xa398('0x6a'),{'UserId':_0x56a3b7['id'],'SmsQueueId':_0x703d8e['id']});});});});});}})[_0xa398('0x25')](respondWithStatusCode(_0x5c67ef,null))[_0xa398('0x45')](handleError(_0x5c67ef,null));};exports[_0xa398('0x6b')]=function(_0x3206cf,_0x46bb0c,_0x591f1d){return db['Team'][_0xa398('0x43')]({'where':{'id':_0x3206cf[_0xa398('0x33')][_0xa398('0x61')]},'attributes':['id'],'include':[{'model':db[_0xa398('0x57')],'as':_0xa398('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xa398('0x25')](handleEntityNotFound(_0x46bb0c,null))['then'](function(_0x4207d2){var _0x105514=_[_0xa398('0x2e')](_0x4207d2,'id');var _0x263f40=[];var _0x4e80e9=[];var _0x579aa2=squel[_0xa398('0x6d')]();_0x579aa2['field']('tq.TeamId')[_0xa398('0x6e')](_0xa398('0x6f'),'tq')[_0xa398('0x70')](_0xa398('0x71'),'ut',_0xa398('0x72'))[_0xa398('0x3f')](_0xa398('0x73'),_0x3206cf[_0xa398('0x46')]['id']);for(var _0x33d4aa=0x0;_0x33d4aa<_0x4207d2[_0xa398('0x39')];_0x33d4aa+=0x1){let _0x32dcba=_0x4207d2[_0x33d4aa];for(var _0x37ec5b=0x0;_0x37ec5b<_0x32dcba['Agents'][_0xa398('0x39')];_0x37ec5b+=0x1){let _0x266c77=_0x32dcba[_0xa398('0x6c')][_0x37ec5b];var _0x3d9f05=_0x579aa2[_0xa398('0x74')]();_0x3d9f05[_0xa398('0x3f')]('ut.UserId\x20=\x20?',_0x266c77['id']);_0x4e80e9['push'](db['sequelize']['query'](_0x3d9f05['toString'](),{'type':db[_0xa398('0x66')][_0xa398('0x75')][_0xa398('0x76')]})[_0xa398('0x25')](function(_0x3ae9c7){if(_0x3ae9c7['length']===0x1){return _0x266c77['id'];}else{var _0x2d5f1c=_[_0xa398('0x77')](_['map'](_0x3ae9c7,_0xa398('0x78')),function(_0x2e312e){return _[_0xa398('0x79')](_0x105514,_0x2e312e);});if(_0x2d5f1c){return _0x266c77['id'];}}}));}}return BPromise[_0xa398('0x7a')](_0x4e80e9)[_0xa398('0x25')](function(_0x2d7c14){_0x263f40=_(_0x263f40)[_0xa398('0x7b')](_0x2d7c14)['compact']()[_0xa398('0x7c')]();return db[_0xa398('0x2f')][_0xa398('0x48')]({'where':{'id':_0x3206cf[_0xa398('0x46')]['id']}})[_0xa398('0x25')](function(_0x218e1a){return db[_0xa398('0x66')][_0xa398('0x67')](function(_0x4deecc){return _0x218e1a['removeTeams'](_0x3206cf['query']['ids'],{'transaction':_0x4deecc})[_0xa398('0x25')](function(){if(!_[_0xa398('0x7d')](_0x263f40)){return _0x218e1a[_0xa398('0x7e')](_0x263f40,{'transaction':_0x4deecc});}})[_0xa398('0x25')](function(){_0x263f40[_0xa398('0x7f')](function(_0x2648d5){socket['emit'](_0xa398('0x80'),{'UserId':_0x2648d5,'SmsQueueId':_0x218e1a['id']});});});});});});})['then'](respondWithStatusCode(_0x46bb0c,null))[_0xa398('0x45')](handleError(_0x46bb0c,null));};exports[_0xa398('0x81')]=function(_0xb2baf3,_0x229817,_0x324309){return db[_0xa398('0x2f')]['find']({'where':{'id':_0xb2baf3['params']['id']}})[_0xa398('0x25')](handleEntityNotFound(_0x229817,null))[_0xa398('0x25')](function(_0x39dccc){if(_0x39dccc){return _0x39dccc[_0xa398('0x81')](_0xb2baf3[_0xa398('0x4a')][_0xa398('0x61')],_['omit'](_0xb2baf3[_0xa398('0x4a')],[_0xa398('0x61'),'id'])||{})['spread'](function(_0x1d284c){for(var _0x22343e=0x0;_0x22343e<_0xb2baf3['body']['ids'][_0xa398('0x39')];_0x22343e+=0x1){socket[_0xa398('0x69')]('userSmsQueue:save',{'UserId':Number(_0xb2baf3[_0xa398('0x4a')][_0xa398('0x61')][_0x22343e]),'SmsQueueId':Number(_0xb2baf3[_0xa398('0x46')]['id'])});}return _0x1d284c;});}})['then'](respondWithResult(_0x229817,null))['catch'](handleError(_0x229817,null));};exports[_0xa398('0x7e')]=function(_0x47c1ac,_0x2a8e37,_0x481dad){return db[_0xa398('0x2f')]['find']({'where':{'id':_0x47c1ac[_0xa398('0x46')]['id']}})[_0xa398('0x25')](handleEntityNotFound(_0x2a8e37,null))[_0xa398('0x25')](function(_0x46989d){if(_0x46989d){return _0x46989d[_0xa398('0x7e')](_0x47c1ac['query'][_0xa398('0x61')])['then'](function(){if(_[_0xa398('0x82')](_0x47c1ac['query'][_0xa398('0x61')])){for(var _0x5a1065=0x0;_0x5a1065<_0x47c1ac[_0xa398('0x33')]['ids'][_0xa398('0x39')];_0x5a1065+=0x1){socket[_0xa398('0x69')](_0xa398('0x80'),{'UserId':Number(_0x47c1ac[_0xa398('0x33')][_0xa398('0x61')][_0x5a1065]),'SmsQueueId':Number(_0x47c1ac[_0xa398('0x46')]['id'])});}}else{socket['emit'](_0xa398('0x80'),{'UserId':Number(_0x47c1ac['query']['ids']),'SmsQueueId':Number(_0x47c1ac[_0xa398('0x46')]['id'])});}});}})[_0xa398('0x25')](respondWithStatusCode(_0x2a8e37,null))[_0xa398('0x45')](handleError(_0x2a8e37,null));};exports[_0xa398('0x83')]=function(_0x5dc754,_0x19b68c,_0x35fda4){var _0x2bb4e5={};var _0x14693f={};var _0x1c51b3;var _0x3e2119;return db[_0xa398('0x2f')]['findOne']({'where':{'id':_0x5dc754[_0xa398('0x46')]['id']}})['then'](handleEntityNotFound(_0x19b68c,null))['then'](function(_0x136ff1){if(_0x136ff1){_0x1c51b3=_0x136ff1;_0x14693f[_0xa398('0x32')]=_[_0xa398('0x34')](db[_0xa398('0x57')][_0xa398('0x30')]);_0x14693f[_0xa398('0x33')]=_[_0xa398('0x34')](_0x5dc754[_0xa398('0x33')]);_0x14693f[_0xa398('0x35')]=_[_0xa398('0x36')](_0x14693f[_0xa398('0x32')],_0x14693f['query']);_0x2bb4e5[_0xa398('0x37')]=_[_0xa398('0x36')](_0x14693f[_0xa398('0x32')],qs['fields'](_0x5dc754[_0xa398('0x33')][_0xa398('0x38')]));_0x2bb4e5[_0xa398('0x37')]=_0x2bb4e5[_0xa398('0x37')][_0xa398('0x39')]?_0x2bb4e5[_0xa398('0x37')]:_0x14693f[_0xa398('0x32')];_0x2bb4e5['order']=qs[_0xa398('0x3c')](_0x5dc754['query'][_0xa398('0x3c')]);_0x2bb4e5[_0xa398('0x3f')]=qs[_0xa398('0x35')](_[_0xa398('0x3d')](_0x5dc754['query'],_0x14693f[_0xa398('0x35')]));if(_0x5dc754[_0xa398('0x33')][_0xa398('0x3e')]){_0x2bb4e5['where']=_[_0xa398('0x47')](_0x2bb4e5[_0xa398('0x3f')],{'$or':_[_0xa398('0x2e')](_0x2bb4e5[_0xa398('0x37')],function(_0xe5bad3){var _0x17f047={};_0x17f047[_0xe5bad3]={'$like':'%'+_0x5dc754[_0xa398('0x33')][_0xa398('0x3e')]+'%'};return _0x17f047;})});}_0x2bb4e5=_[_0xa398('0x47')]({},_0x2bb4e5,_0x5dc754[_0xa398('0x40')]);return _0x1c51b3[_0xa398('0x83')](_0x2bb4e5);}})[_0xa398('0x25')](function(_0x3f4cd4){if(_0x3f4cd4){_0x3e2119=_0x3f4cd4[_0xa398('0x39')];if(!_0x5dc754['query'][_0xa398('0x3a')](_0xa398('0x5f'))){_0x2bb4e5[_0xa398('0x21')]=qs[_0xa398('0x21')](_0x5dc754[_0xa398('0x33')]['limit']);_0x2bb4e5['offset']=qs[_0xa398('0x1f')](_0x5dc754[_0xa398('0x33')]['offset']);}return _0x1c51b3['getAgents'](_0x2bb4e5);}})['then'](function(_0x1e1acc){if(_0x1e1acc){return _0x1e1acc?{'count':_0x3e2119,'rows':_0x1e1acc}:null;}})[_0xa398('0x25')](respondWithResult(_0x19b68c,null))['catch'](handleError(_0x19b68c,null));}; \ No newline at end of file +var _0x767b=['show','params','keys','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','rawAttributes','pick','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','value','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','sendStatus','status','end','offset','undefined','limit','count','reject','update','then','destroy','get','SmsQueues','stack','name','send','index','SmsQueue','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x30b057,_0x1d1505){var _0x331671=function(_0x30bcdf){while(--_0x30bcdf){_0x30b057['push'](_0x30b057['shift']());}};_0x331671(++_0x1d1505);}(_0x767b,0xd0));var _0xb767=function(_0x549a84,_0x225007){_0x549a84=_0x549a84-0x0;var _0x121d5d=_0x767b[_0x549a84];return _0x121d5d;};'use strict';var emlformat=require(_0xb767('0x0'));var rimraf=require(_0xb767('0x1'));var zipdir=require(_0xb767('0x2'));var jsonpatch=require(_0xb767('0x3'));var rp=require(_0xb767('0x4'));var moment=require(_0xb767('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb767('0x6'));var path=require('path');var sox=require(_0xb767('0x7'));var csv=require(_0xb767('0x8'));var ejs=require(_0xb767('0x9'));var fs=require('fs');var fs_extra=require(_0xb767('0xa'));var _=require(_0xb767('0xb'));var squel=require(_0xb767('0xc'));var crypto=require(_0xb767('0xd'));var jsforce=require(_0xb767('0xe'));var deskjs=require(_0xb767('0xf'));var toCsv=require(_0xb767('0x8'));var querystring=require(_0xb767('0x10'));var Papa=require(_0xb767('0x11'));var Redis=require(_0xb767('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb767('0x13'));var as=require(_0xb767('0x14'));var hardwareService=require(_0xb767('0x15'));var logger=require(_0xb767('0x16'))(_0xb767('0x17'));var utils=require(_0xb767('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb767('0x19'));var db=require(_0xb767('0x1a'))['db'];config[_0xb767('0x1b')]=_[_0xb767('0x1c')](config[_0xb767('0x1b')],{'host':_0xb767('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb767('0x1b')]));require(_0xb767('0x1e'))['register'](socket);function respondWithStatusCode(_0x26b618,_0xbca723){_0xbca723=_0xbca723||0xcc;return function(_0x558bf7){if(_0x558bf7){return _0x26b618[_0xb767('0x1f')](_0xbca723);}return _0x26b618[_0xb767('0x20')](_0xbca723)[_0xb767('0x21')]();};}function respondWithResult(_0x4f5e21,_0x4ee9a1){_0x4ee9a1=_0x4ee9a1||0xc8;return function(_0x37923b){if(_0x37923b){return _0x4f5e21[_0xb767('0x20')](_0x4ee9a1)['json'](_0x37923b);}};}function respondWithFilteredResult(_0x39ead2,_0x43bc23){return function(_0x5ab95f){if(_0x5ab95f){var _0x34670f=typeof _0x43bc23[_0xb767('0x22')]===_0xb767('0x23')&&typeof _0x43bc23[_0xb767('0x24')]===_0xb767('0x23');var _0x3627b9=_0x5ab95f[_0xb767('0x25')];var _0x55734c=_0x34670f?0x0:_0x43bc23[_0xb767('0x22')];var _0xd3b2c1=_0x34670f?_0x5ab95f[_0xb767('0x25')]:_0x43bc23[_0xb767('0x22')]+_0x43bc23['limit'];var _0x1080ce;if(_0xd3b2c1>=_0x3627b9){_0xd3b2c1=_0x3627b9;_0x1080ce=0xc8;}else{_0x1080ce=0xce;}_0x39ead2['status'](_0x1080ce);return _0x39ead2['set']('Content-Range',_0x55734c+'-'+_0xd3b2c1+'/'+_0x3627b9)['json'](_0x5ab95f);}return null;};}function patchUpdates(_0x1da400){return function(_0x2e30f5){try{jsonpatch['apply'](_0x2e30f5,_0x1da400,!![]);}catch(_0x12ddf3){return BPromise[_0xb767('0x26')](_0x12ddf3);}return _0x2e30f5['save']();};}function saveUpdates(_0x3bdf89,_0x139b97){return function(_0x352667){if(_0x352667){return _0x352667[_0xb767('0x27')](_0x3bdf89)[_0xb767('0x28')](function(_0x393044){return _0x393044;});}return null;};}function removeEntity(_0x553092,_0xb5c944){return function(_0x3f99ff){if(_0x3f99ff){return _0x3f99ff[_0xb767('0x29')]()[_0xb767('0x28')](function(){var _0x2251d6=_0x3f99ff[_0xb767('0x2a')]({'plain':!![]});var _0x1bac2e=_0xb767('0x2b');return db['UserProfileResource'][_0xb767('0x29')]({'where':{'type':_0x1bac2e,'resourceId':_0x2251d6['id']}})[_0xb767('0x28')](function(){return _0x3f99ff;});})['then'](function(){_0x553092[_0xb767('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a44ce,_0x332f46){return function(_0x487509){if(!_0x487509){_0x3a44ce['sendStatus'](0x194);}return _0x487509;};}function handleError(_0x3974d7,_0x300b1b){_0x300b1b=_0x300b1b||0x1f4;return function(_0x2e9715){logger['error'](_0x2e9715[_0xb767('0x2c')]);if(_0x2e9715[_0xb767('0x2d')]){delete _0x2e9715[_0xb767('0x2d')];}_0x3974d7[_0xb767('0x20')](_0x300b1b)[_0xb767('0x2e')](_0x2e9715);};}exports[_0xb767('0x2f')]=function(_0x50d27d,_0x5f0455){var _0x3bb61c={},_0x1c00f9={},_0x565b1c={'count':0x0,'rows':[]};var _0x463c8a=_['map'](db[_0xb767('0x30')]['rawAttributes'],function(_0x5ec14c){return{'name':_0x5ec14c[_0xb767('0x31')],'type':_0x5ec14c['type'][_0xb767('0x32')]};});_0x1c00f9['model']=_[_0xb767('0x33')](_0x463c8a,'name');_0x1c00f9['query']=_['keys'](_0x50d27d[_0xb767('0x34')]);_0x1c00f9[_0xb767('0x35')]=_[_0xb767('0x36')](_0x1c00f9[_0xb767('0x37')],_0x1c00f9[_0xb767('0x34')]);_0x3bb61c['attributes']=_[_0xb767('0x36')](_0x1c00f9[_0xb767('0x37')],qs['fields'](_0x50d27d[_0xb767('0x34')][_0xb767('0x38')]));_0x3bb61c[_0xb767('0x39')]=_0x3bb61c[_0xb767('0x39')][_0xb767('0x3a')]?_0x3bb61c[_0xb767('0x39')]:_0x1c00f9[_0xb767('0x37')];if(!_0x50d27d[_0xb767('0x34')][_0xb767('0x3b')](_0xb767('0x3c'))){_0x3bb61c['limit']=qs[_0xb767('0x24')](_0x50d27d[_0xb767('0x34')][_0xb767('0x24')]);_0x3bb61c['offset']=qs[_0xb767('0x22')](_0x50d27d[_0xb767('0x34')][_0xb767('0x22')]);}_0x3bb61c[_0xb767('0x3d')]=qs[_0xb767('0x3e')](_0x50d27d[_0xb767('0x34')][_0xb767('0x3e')]);_0x3bb61c[_0xb767('0x3f')]=qs[_0xb767('0x35')](_['pick'](_0x50d27d['query'],_0x1c00f9[_0xb767('0x35')]),_0x463c8a);if(_0x50d27d['query'][_0xb767('0x40')]){_0x3bb61c[_0xb767('0x3f')]=_[_0xb767('0x41')](_0x3bb61c[_0xb767('0x3f')],{'$or':_['map'](_0x463c8a,function(_0x5c431f){if(_0x5c431f[_0xb767('0x42')]!==_0xb767('0x43')){var _0x1e3226={};_0x1e3226[_0x5c431f[_0xb767('0x2d')]]={'$like':'%'+_0x50d27d[_0xb767('0x34')]['filter']+'%'};return _0x1e3226;}})});}_0x3bb61c=_[_0xb767('0x41')]({},_0x3bb61c,_0x50d27d['options']);var _0x2754fb={'where':_0x3bb61c[_0xb767('0x3f')]};return db[_0xb767('0x30')]['count'](_0x2754fb)['then'](function(_0x109690){_0x565b1c[_0xb767('0x25')]=_0x109690;if(_0x50d27d[_0xb767('0x34')][_0xb767('0x44')]){_0x3bb61c[_0xb767('0x45')]=[{'all':!![]}];}return db['SmsQueue'][_0xb767('0x46')](_0x3bb61c);})[_0xb767('0x28')](function(_0x3ffa39){_0x565b1c[_0xb767('0x47')]=_0x3ffa39;return _0x565b1c;})['then'](respondWithFilteredResult(_0x5f0455,_0x3bb61c))['catch'](handleError(_0x5f0455,null));};exports[_0xb767('0x48')]=function(_0xccb196,_0x19827d){var _0x1a97c7={'raw':!![],'where':{'id':_0xccb196[_0xb767('0x49')]['id']}},_0x4564b1={};_0x4564b1[_0xb767('0x37')]=_[_0xb767('0x4a')](db[_0xb767('0x30')]['rawAttributes']);_0x4564b1[_0xb767('0x34')]=_[_0xb767('0x4a')](_0xccb196[_0xb767('0x34')]);_0x4564b1[_0xb767('0x35')]=_[_0xb767('0x36')](_0x4564b1[_0xb767('0x37')],_0x4564b1['query']);_0x1a97c7[_0xb767('0x39')]=_[_0xb767('0x36')](_0x4564b1[_0xb767('0x37')],qs[_0xb767('0x38')](_0xccb196['query'][_0xb767('0x38')]));_0x1a97c7[_0xb767('0x39')]=_0x1a97c7[_0xb767('0x39')][_0xb767('0x3a')]?_0x1a97c7['attributes']:_0x4564b1[_0xb767('0x37')];if(_0xccb196[_0xb767('0x34')]['includeAll']){_0x1a97c7['include']=[{'all':!![]}];}_0x1a97c7=_['merge']({},_0x1a97c7,_0xccb196[_0xb767('0x4b')]);return db[_0xb767('0x30')]['find'](_0x1a97c7)['then'](handleEntityNotFound(_0x19827d,null))[_0xb767('0x28')](respondWithResult(_0x19827d,null))[_0xb767('0x4c')](handleError(_0x19827d,null));};exports[_0xb767('0x4d')]=function(_0x24c006,_0x269d3f){return db[_0xb767('0x30')][_0xb767('0x4d')](_0x24c006[_0xb767('0x4e')],{})[_0xb767('0x28')](function(_0x320d48){var _0x253009=_0x24c006[_0xb767('0x4f')][_0xb767('0x2a')]({'plain':!![]});if(!_0x253009)throw new Error(_0xb767('0x50'));if(_0x253009['role']==='user'){var _0x5a2ad4=_0x320d48[_0xb767('0x2a')]({'plain':!![]});var _0x2ffaa4=_0xb767('0x2b');return db[_0xb767('0x51')][_0xb767('0x52')]({'where':{'name':_0x2ffaa4,'userProfileId':_0x253009['userProfileId']},'raw':!![]})['then'](function(_0x39ea2b){if(_0x39ea2b&&_0x39ea2b['autoAssociation']===0x0){return db[_0xb767('0x53')][_0xb767('0x4d')]({'name':_0x5a2ad4['name'],'resourceId':_0x5a2ad4['id'],'type':_0x39ea2b[_0xb767('0x2d')],'sectionId':_0x39ea2b['id']},{})[_0xb767('0x28')](function(){return _0x320d48;});}else{return _0x320d48;}})[_0xb767('0x4c')](function(_0x48aae3){logger[_0xb767('0x54')](_0xb767('0x55'),_0x48aae3);throw _0x48aae3;});}return _0x320d48;})[_0xb767('0x28')](respondWithResult(_0x269d3f,0xc9))[_0xb767('0x4c')](handleError(_0x269d3f,null));};exports[_0xb767('0x27')]=function(_0x2420e7,_0x14ef68){if(_0x2420e7['body']['id']){delete _0x2420e7['body']['id'];}return db[_0xb767('0x30')][_0xb767('0x52')]({'where':{'id':_0x2420e7['params']['id']}})['then'](handleEntityNotFound(_0x14ef68,null))['then'](saveUpdates(_0x2420e7['body'],null))['then'](respondWithResult(_0x14ef68,null))[_0xb767('0x4c')](handleError(_0x14ef68,null));};exports['destroy']=function(_0x5f4bc8,_0x109d4d){return db['SmsQueue']['find']({'where':{'id':_0x5f4bc8['params']['id']}})[_0xb767('0x28')](handleEntityNotFound(_0x109d4d,null))[_0xb767('0x28')](removeEntity(_0x109d4d,null))[_0xb767('0x4c')](handleError(_0x109d4d,null));};exports[_0xb767('0x56')]=function(_0x597546,_0x403adf){return db[_0xb767('0x30')]['describe']()[_0xb767('0x28')](respondWithResult(_0x403adf,null))[_0xb767('0x4c')](handleError(_0x403adf,null));};exports[_0xb767('0x57')]=function(_0x2b9059,_0x2baa76,_0x1062af){var _0x49e3a6={'raw':!![],'where':{}},_0xcf6ba7={},_0x3656b4;return db[_0xb767('0x30')]['findOne']({'where':{'id':_0x2b9059[_0xb767('0x49')]['id']}})[_0xb767('0x28')](handleEntityNotFound(_0x2baa76,null))[_0xb767('0x28')](function(_0x4fad89){if(_0x4fad89){_0x3656b4=_0x4fad89[_0xb767('0x2a')]({'plain':!![]});_0xcf6ba7[_0xb767('0x37')]=_[_0xb767('0x4a')](db[_0xb767('0x58')][_0xb767('0x59')]);_0xcf6ba7['query']=_[_0xb767('0x4a')](_0x2b9059['query']);_0xcf6ba7[_0xb767('0x35')]=_['intersection'](_0xcf6ba7[_0xb767('0x37')],_0xcf6ba7[_0xb767('0x34')]);_0x49e3a6[_0xb767('0x39')]=_['intersection'](_0xcf6ba7[_0xb767('0x37')],qs['fields'](_0x2b9059['query'][_0xb767('0x38')]));_0x49e3a6[_0xb767('0x39')]=_0x49e3a6['attributes'][_0xb767('0x3a')]?_0x49e3a6[_0xb767('0x39')]:_0xcf6ba7['model'];if(!_0x2b9059[_0xb767('0x34')][_0xb767('0x3b')](_0xb767('0x3c'))){_0x49e3a6[_0xb767('0x24')]=qs[_0xb767('0x24')](_0x2b9059[_0xb767('0x34')][_0xb767('0x24')]);_0x49e3a6[_0xb767('0x22')]=qs[_0xb767('0x22')](_0x2b9059[_0xb767('0x34')][_0xb767('0x22')]);}_0x49e3a6[_0xb767('0x3d')]=qs[_0xb767('0x3e')](_0x2b9059[_0xb767('0x34')]['sort']);_0x49e3a6['where']=qs['filters'](_[_0xb767('0x5a')](_0x2b9059[_0xb767('0x34')],_0xcf6ba7[_0xb767('0x35')]));_0x49e3a6['where']['SmsQueueId']=_0x4fad89['id'];if(_0x2b9059['query'][_0xb767('0x40')]){_0x49e3a6['where']=_[_0xb767('0x41')](_0x49e3a6[_0xb767('0x3f')],{'$or':_[_0xb767('0x33')](_0x49e3a6[_0xb767('0x39')],function(_0x4ab039){var _0x1490a6={};_0x1490a6[_0x4ab039]={'$like':'%'+_0x2b9059['query'][_0xb767('0x40')]+'%'};return _0x1490a6;})});}_0x49e3a6=_['merge']({},_0x49e3a6,_0x2b9059[_0xb767('0x4b')]);return db['UserSmsQueue'][_0xb767('0x46')](_0x49e3a6);}})[_0xb767('0x28')](function(_0x10639e){if(_0x10639e){return db[_0xb767('0x5b')][_0xb767('0x5c')]({'where':{'id':_['map'](_0x10639e,_0xb767('0x5d')),'role':_0xb767('0x5e')},'attributes':['id','name',_0xb767('0x5f'),_0xb767('0x60'),_0xb767('0x61')]});}})[_0xb767('0x28')](function(_0x4801ff){if(_0x4801ff){return{'count':_0x4801ff[_0xb767('0x25')],'rows':_[_0xb767('0x33')](_0x4801ff['rows'],function(_0x5cc9ab){return{'membername':_0x5cc9ab['name'],'UserId':_0x5cc9ab['id'],'queue_name':_0x3656b4[_0xb767('0x2d')],'SmsQueueId':_0x3656b4['id'],'interface':util[_0xb767('0x62')](_0xb767('0x63'),_0xb767('0x64'),_0x5cc9ab[_0xb767('0x2d')]),'penalty':0x0,'paused':_0x5cc9ab[_0xb767('0x5f')],'createdAt':_0x5cc9ab[_0xb767('0x61')],'updatedAt':_0x5cc9ab['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb767('0x28')](respondWithFilteredResult(_0x2baa76,_0x49e3a6))['catch'](handleError(_0x2baa76,null));};exports[_0xb767('0x65')]=function(_0x507d3d,_0x281c8b,_0x44fd1c){var _0x12d28b={};var _0x4c5dd3={};var _0x1c15b1;var _0x189cbc;return db[_0xb767('0x30')][_0xb767('0x66')]({'where':{'id':_0x507d3d[_0xb767('0x49')]['id']}})[_0xb767('0x28')](handleEntityNotFound(_0x281c8b,null))['then'](function(_0x28121e){if(_0x28121e){_0x1c15b1=_0x28121e;_0x4c5dd3[_0xb767('0x37')]=_[_0xb767('0x4a')](db[_0xb767('0x67')][_0xb767('0x59')]);_0x4c5dd3[_0xb767('0x34')]=_[_0xb767('0x4a')](_0x507d3d[_0xb767('0x34')]);_0x4c5dd3[_0xb767('0x35')]=_[_0xb767('0x36')](_0x4c5dd3[_0xb767('0x37')],_0x4c5dd3['query']);_0x12d28b[_0xb767('0x39')]=_[_0xb767('0x36')](_0x4c5dd3['model'],qs['fields'](_0x507d3d[_0xb767('0x34')]['fields']));_0x12d28b[_0xb767('0x39')]=_0x12d28b[_0xb767('0x39')]['length']?_0x12d28b[_0xb767('0x39')]:_0x4c5dd3[_0xb767('0x37')];_0x12d28b['order']=qs[_0xb767('0x3e')](_0x507d3d[_0xb767('0x34')][_0xb767('0x3e')]);_0x12d28b[_0xb767('0x3f')]=qs[_0xb767('0x35')](_[_0xb767('0x5a')](_0x507d3d[_0xb767('0x34')],_0x4c5dd3[_0xb767('0x35')]));if(_0x507d3d[_0xb767('0x34')][_0xb767('0x40')]){_0x12d28b[_0xb767('0x3f')]=_[_0xb767('0x41')](_0x12d28b[_0xb767('0x3f')],{'$or':_[_0xb767('0x33')](_0x12d28b[_0xb767('0x39')],function(_0x241d34){var _0x280200={};_0x280200[_0x241d34]={'$like':'%'+_0x507d3d[_0xb767('0x34')]['filter']+'%'};return _0x280200;})});}_0x12d28b=_[_0xb767('0x41')]({},_0x12d28b,_0x507d3d[_0xb767('0x4b')]);return _0x1c15b1[_0xb767('0x65')](_0x12d28b);}})[_0xb767('0x28')](function(_0x2e5b72){if(_0x2e5b72){_0x189cbc=_0x2e5b72[_0xb767('0x3a')];if(!_0x507d3d[_0xb767('0x34')][_0xb767('0x3b')](_0xb767('0x3c'))){_0x12d28b[_0xb767('0x24')]=qs[_0xb767('0x24')](_0x507d3d[_0xb767('0x34')]['limit']);_0x12d28b[_0xb767('0x22')]=qs[_0xb767('0x22')](_0x507d3d[_0xb767('0x34')]['offset']);}return _0x1c15b1[_0xb767('0x65')](_0x12d28b);}})['then'](function(_0x34881e){if(_0x34881e){return _0x34881e?{'count':_0x189cbc,'rows':_0x34881e}:null;}})['then'](respondWithResult(_0x281c8b,null))[_0xb767('0x4c')](handleError(_0x281c8b,null));};exports[_0xb767('0x68')]=function(_0x3a713b,_0x4bdbfa,_0x550a07){var _0x44e348=_0x3a713b['body'][_0xb767('0x69')];return db['Team'][_0xb767('0x46')]({'where':{'id':_0x44e348},'attributes':['id'],'include':[{'model':db[_0xb767('0x5b')],'as':'Agents','attributes':['id',_0xb767('0x2d'),_0xb767('0x6a'),_0xb767('0x6b'),_0xb767('0x6c')],'raw':!![]}]})['then'](function(_0x5ad2e2){if(_0x5ad2e2){var _0x253f8d=_[_0xb767('0x6d')](_0x5ad2e2,function(_0x329c84){var _0x1f5039=_0x329c84['get']({'plain':!![]});return _0x1f5039[_0xb767('0x6e')];});return db[_0xb767('0x30')][_0xb767('0x52')]({'where':{'id':_0x3a713b['params']['id']}})[_0xb767('0x28')](function(_0x1680f8){return db[_0xb767('0x6f')][_0xb767('0x70')](function(_0x471c2e){return _0x1680f8['addTeams'](_0x44e348,{'transaction':_0x471c2e})[_0xb767('0x28')](function(){return BPromise[_0xb767('0x71')](_0x253f8d,function(_0x4c166c){return db['UserSmsQueue'][_0xb767('0x72')]({'where':{'UserId':_0x4c166c['id'],'SmsQueueId':_0x3a713b[_0xb767('0x49')]['id']},'transaction':_0x471c2e});});})[_0xb767('0x28')](function(){_0x253f8d[_0xb767('0x73')](function(_0x5b86c3){socket[_0xb767('0x74')](_0xb767('0x75'),{'UserId':_0x5b86c3['id'],'SmsQueueId':_0x1680f8['id']});});});});});}})['then'](respondWithStatusCode(_0x4bdbfa,null))[_0xb767('0x4c')](handleError(_0x4bdbfa,null));};exports[_0xb767('0x76')]=function(_0x1fd411,_0x38dbc1,_0x46ed36){return db[_0xb767('0x67')]['findAll']({'where':{'id':_0x1fd411[_0xb767('0x34')][_0xb767('0x69')]},'attributes':['id'],'include':[{'model':db[_0xb767('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb767('0x28')](handleEntityNotFound(_0x38dbc1,null))[_0xb767('0x28')](function(_0x257d32){var _0x444aa1=_['map'](_0x257d32,'id');var _0x3a35f1=[];var _0x416231=[];var _0x37abdb=squel['select']();_0x37abdb[_0xb767('0x77')]('tq.TeamId')[_0xb767('0x78')](_0xb767('0x79'),'tq')[_0xb767('0x7a')]('user_has_teams','ut',_0xb767('0x7b'))['where'](_0xb767('0x7c'),_0x1fd411['params']['id']);for(var _0x1dcdad=0x0;_0x1dcdad<_0x257d32[_0xb767('0x3a')];_0x1dcdad+=0x1){let _0x218bdb=_0x257d32[_0x1dcdad];for(var _0x2b3513=0x0;_0x2b3513<_0x218bdb[_0xb767('0x6e')][_0xb767('0x3a')];_0x2b3513+=0x1){let _0x3db262=_0x218bdb['Agents'][_0x2b3513];var _0x4d8230=_0x37abdb['clone']();_0x4d8230['where'](_0xb767('0x7d'),_0x3db262['id']);_0x416231[_0xb767('0x7e')](db[_0xb767('0x6f')]['query'](_0x4d8230['toString'](),{'type':db['sequelize'][_0xb767('0x7f')][_0xb767('0x80')]})[_0xb767('0x28')](function(_0x220b1d){if(_0x220b1d['length']===0x1){return _0x3db262['id'];}else{var _0x3b2b6b=_[_0xb767('0x81')](_['map'](_0x220b1d,'TeamId'),function(_0x2061fe){return _[_0xb767('0x82')](_0x444aa1,_0x2061fe);});if(_0x3b2b6b){return _0x3db262['id'];}}}));}}return BPromise[_0xb767('0x83')](_0x416231)['then'](function(_0x4fa625){_0x3a35f1=_(_0x3a35f1)['union'](_0x4fa625)['compact']()[_0xb767('0x84')]();return db[_0xb767('0x30')]['find']({'where':{'id':_0x1fd411[_0xb767('0x49')]['id']}})[_0xb767('0x28')](function(_0x16deec){return db[_0xb767('0x6f')][_0xb767('0x70')](function(_0x460736){return _0x16deec[_0xb767('0x76')](_0x1fd411[_0xb767('0x34')][_0xb767('0x69')],{'transaction':_0x460736})[_0xb767('0x28')](function(){if(!_['isEmpty'](_0x3a35f1)){return _0x16deec[_0xb767('0x85')](_0x3a35f1,{'transaction':_0x460736});}})[_0xb767('0x28')](function(){_0x3a35f1[_0xb767('0x73')](function(_0x48c066){socket[_0xb767('0x74')](_0xb767('0x86'),{'UserId':_0x48c066,'SmsQueueId':_0x16deec['id']});});});});});});})['then'](respondWithStatusCode(_0x38dbc1,null))[_0xb767('0x4c')](handleError(_0x38dbc1,null));};exports[_0xb767('0x87')]=function(_0x359efe,_0x57b517,_0x3850e7){return db['SmsQueue']['find']({'where':{'id':_0x359efe[_0xb767('0x49')]['id']}})[_0xb767('0x28')](handleEntityNotFound(_0x57b517,null))['then'](function(_0x11beae){if(_0x11beae){return _0x11beae['addAgents'](_0x359efe[_0xb767('0x4e')][_0xb767('0x69')],_[_0xb767('0x88')](_0x359efe[_0xb767('0x4e')],['ids','id'])||{})[_0xb767('0x89')](function(_0xf02092){for(var _0x1a6cc3=0x0;_0x1a6cc3<_0x359efe[_0xb767('0x4e')][_0xb767('0x69')][_0xb767('0x3a')];_0x1a6cc3+=0x1){socket[_0xb767('0x74')]('userSmsQueue:save',{'UserId':Number(_0x359efe[_0xb767('0x4e')]['ids'][_0x1a6cc3]),'SmsQueueId':Number(_0x359efe['params']['id'])});}return _0xf02092;});}})['then'](respondWithResult(_0x57b517,null))['catch'](handleError(_0x57b517,null));};exports[_0xb767('0x85')]=function(_0x5f2256,_0x4c9849,_0x3359dd){return db[_0xb767('0x30')][_0xb767('0x52')]({'where':{'id':_0x5f2256[_0xb767('0x49')]['id']}})[_0xb767('0x28')](handleEntityNotFound(_0x4c9849,null))[_0xb767('0x28')](function(_0x9c1382){if(_0x9c1382){return _0x9c1382[_0xb767('0x85')](_0x5f2256[_0xb767('0x34')][_0xb767('0x69')])[_0xb767('0x28')](function(){if(_[_0xb767('0x8a')](_0x5f2256[_0xb767('0x34')][_0xb767('0x69')])){for(var _0x5a5e16=0x0;_0x5a5e16<_0x5f2256['query'][_0xb767('0x69')]['length'];_0x5a5e16+=0x1){socket['emit'](_0xb767('0x86'),{'UserId':Number(_0x5f2256[_0xb767('0x34')][_0xb767('0x69')][_0x5a5e16]),'SmsQueueId':Number(_0x5f2256['params']['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5f2256[_0xb767('0x34')][_0xb767('0x69')]),'SmsQueueId':Number(_0x5f2256[_0xb767('0x49')]['id'])});}});}})[_0xb767('0x28')](respondWithStatusCode(_0x4c9849,null))[_0xb767('0x4c')](handleError(_0x4c9849,null));};exports[_0xb767('0x8b')]=function(_0x5ebd3b,_0x599d06,_0x3f30f4){var _0xe9bb14={};var _0x3b3bc5={};var _0xe3f223;var _0x369767;return db[_0xb767('0x30')]['findOne']({'where':{'id':_0x5ebd3b[_0xb767('0x49')]['id']}})[_0xb767('0x28')](handleEntityNotFound(_0x599d06,null))[_0xb767('0x28')](function(_0x5d0d12){if(_0x5d0d12){_0xe3f223=_0x5d0d12;_0x3b3bc5[_0xb767('0x37')]=_[_0xb767('0x4a')](db['User'][_0xb767('0x59')]);_0x3b3bc5[_0xb767('0x34')]=_[_0xb767('0x4a')](_0x5ebd3b[_0xb767('0x34')]);_0x3b3bc5[_0xb767('0x35')]=_[_0xb767('0x36')](_0x3b3bc5[_0xb767('0x37')],_0x3b3bc5[_0xb767('0x34')]);_0xe9bb14['attributes']=_['intersection'](_0x3b3bc5[_0xb767('0x37')],qs[_0xb767('0x38')](_0x5ebd3b[_0xb767('0x34')][_0xb767('0x38')]));_0xe9bb14[_0xb767('0x39')]=_0xe9bb14[_0xb767('0x39')][_0xb767('0x3a')]?_0xe9bb14[_0xb767('0x39')]:_0x3b3bc5[_0xb767('0x37')];_0xe9bb14[_0xb767('0x3d')]=qs['sort'](_0x5ebd3b['query']['sort']);_0xe9bb14[_0xb767('0x3f')]=qs['filters'](_[_0xb767('0x5a')](_0x5ebd3b[_0xb767('0x34')],_0x3b3bc5['filters']));if(_0x5ebd3b[_0xb767('0x34')][_0xb767('0x40')]){_0xe9bb14[_0xb767('0x3f')]=_[_0xb767('0x41')](_0xe9bb14[_0xb767('0x3f')],{'$or':_[_0xb767('0x33')](_0xe9bb14[_0xb767('0x39')],function(_0x3b108d){var _0x400dc3={};_0x400dc3[_0x3b108d]={'$like':'%'+_0x5ebd3b['query'][_0xb767('0x40')]+'%'};return _0x400dc3;})});}_0xe9bb14=_[_0xb767('0x41')]({},_0xe9bb14,_0x5ebd3b[_0xb767('0x4b')]);return _0xe3f223[_0xb767('0x8b')](_0xe9bb14);}})[_0xb767('0x28')](function(_0x544ad1){if(_0x544ad1){_0x369767=_0x544ad1[_0xb767('0x3a')];if(!_0x5ebd3b[_0xb767('0x34')][_0xb767('0x3b')]('nolimit')){_0xe9bb14['limit']=qs[_0xb767('0x24')](_0x5ebd3b[_0xb767('0x34')][_0xb767('0x24')]);_0xe9bb14[_0xb767('0x22')]=qs[_0xb767('0x22')](_0x5ebd3b['query']['offset']);}return _0xe3f223[_0xb767('0x8b')](_0xe9bb14);}})[_0xb767('0x28')](function(_0x233690){if(_0x233690){return _0x233690?{'count':_0x369767,'rows':_0x233690}:null;}})['then'](respondWithResult(_0x599d06,null))['catch'](handleError(_0x599d06,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3136b88..4b69386 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 _0xf699=['save','remove','emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xf699,0x72));var _0x9f69=function(_0xcca961,_0x394290){_0xcca961=_0xcca961-0x0;var _0x58712a=_0xf699[_0xcca961];return _0x58712a;};'use strict';var EventEmitter=require(_0x9f69('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x9f69('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9f69('0x2')](0x0);var events={'afterCreate':_0x9f69('0x3'),'afterUpdate':'update','afterDestroy':_0x9f69('0x4')};function emitEvent(_0x265da9){return function(_0x16a11b,_0x118d9a,_0x4df389){SmsQueueEvents[_0x9f69('0x5')](_0x265da9+':'+_0x16a11b['id'],_0x16a11b);SmsQueueEvents[_0x9f69('0x5')](_0x265da9,_0x16a11b);_0x4df389(null);};}for(var e in events){if(events[_0x9f69('0x6')](e)){var event=events[e];SmsQueue[_0x9f69('0x7')](e,emitEvent(event));}}module[_0x9f69('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x267e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x459bfc,_0x31521d){var _0x3c661f=function(_0x5b50a6){while(--_0x5b50a6){_0x459bfc['push'](_0x459bfc['shift']());}};_0x3c661f(++_0x31521d);}(_0x267e,0x15c));var _0xe267=function(_0x50e9dc,_0x5b8f4d){_0x50e9dc=_0x50e9dc-0x0;var _0x1cbb26=_0x267e[_0x50e9dc];return _0x1cbb26;};'use strict';var EventEmitter=require(_0xe267('0x0'));var SmsQueue=require(_0xe267('0x1'))['db'][_0xe267('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe267('0x3')](0x0);var events={'afterCreate':_0xe267('0x4'),'afterUpdate':_0xe267('0x5'),'afterDestroy':_0xe267('0x6')};function emitEvent(_0x31be04){return function(_0x31b1ee,_0xdd2902,_0x45e3a9){SmsQueueEvents[_0xe267('0x7')](_0x31be04+':'+_0x31b1ee['id'],_0x31b1ee);SmsQueueEvents[_0xe267('0x7')](_0x31be04,_0x31b1ee);_0x45e3a9(null);};}for(var e in events){if(events[_0xe267('0x8')](e)){var event=events[e];SmsQueue[_0xe267('0x9')](e,emitEvent(event));}}module[_0xe267('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 164c744..def37d8 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 _0x631c=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x631c,0x155));var _0xc631=function(_0x502ef0,_0x3ed837){_0x502ef0=_0x502ef0-0x0;var _0x1d5783=_0x631c[_0x502ef0];return _0x1d5783;};'use strict';var _=require(_0xc631('0x0'));var util=require(_0xc631('0x1'));var logger=require(_0xc631('0x2'))(_0xc631('0x3'));var moment=require(_0xc631('0x4'));var BPromise=require(_0xc631('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc631('0x6'));var rimraf=require(_0xc631('0x7'));var config=require(_0xc631('0x8'));var attributes=require(_0xc631('0x9'));module['exports']=function(_0x2e54f1,_0x3b1a4e){return _0x2e54f1[_0xc631('0xa')](_0xc631('0xb'),attributes,{'tableName':_0xc631('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95e0=['request-promise','path','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','util','moment','bluebird'];(function(_0x5bce33,_0x4a4b06){var _0x15bc20=function(_0x56c711){while(--_0x56c711){_0x5bce33['push'](_0x5bce33['shift']());}};_0x15bc20(++_0x4a4b06);}(_0x95e0,0x1e0));var _0x095e=function(_0x1df4db,_0xd0e0f3){_0x1df4db=_0x1df4db-0x0;var _0x3d8d3c=_0x95e0[_0x1df4db];return _0x3d8d3c;};'use strict';var _=require(_0x095e('0x0'));var util=require(_0x095e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x095e('0x2'));var BPromise=require(_0x095e('0x3'));var rp=require(_0x095e('0x4'));var fs=require('fs');var path=require(_0x095e('0x5'));var rimraf=require('rimraf');var config=require(_0x095e('0x6'));var attributes=require('./smsQueue.attributes');module[_0x095e('0x7')]=function(_0x32bd7b,_0x28b98){return _0x32bd7b[_0x095e('0x8')](_0x095e('0x9'),attributes,{'tableName':_0x095e('0xa'),'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 2ad8de3..ce597cf 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 _0x505e=['error','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','findAll','options','where','attributes','limit','include','model','map','debug','ShowSmsQueue','SmsQueue','find','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','request\x20sent','stringify'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x505e,0xa2));var _0xe505=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x505e[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require(_0xe505('0x0'));var util=require(_0xe505('0x1'));var moment=require(_0xe505('0x2'));var BPromise=require(_0xe505('0x3'));var rs=require(_0xe505('0x4'));var fs=require('fs');var Redis=require(_0xe505('0x5'));var db=require(_0xe505('0x6'))['db'];var utils=require(_0xe505('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe505('0x8')]({'port':0x232a});config[_0xe505('0x9')]=_[_0xe505('0xa')](config[_0xe505('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe505('0xb'))(new Redis(config[_0xe505('0x9')]));require(_0xe505('0xc'))[_0xe505('0xd')](socket);function respondWithRpcPromise(_0xcc346c,_0x5d2fad,_0x2a4fa0){return new BPromise(function(_0x5b464a,_0x3dcbb4){return client[_0xe505('0xe')](_0xcc346c,_0x2a4fa0)[_0xe505('0xf')](function(_0x490d85){logger['info']('SmsQueue,\x20%s,\x20%s',_0x5d2fad,_0xe505('0x10'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5d2fad,_0xe505('0x10'),JSON[_0xe505('0x11')](_0x490d85));if(_0x490d85[_0xe505('0x12')]){if(_0x490d85[_0xe505('0x12')]['code']===0x1f4){logger[_0xe505('0x12')](_0xe505('0x13'),_0x5d2fad,_0x490d85[_0xe505('0x12')]['message']);return _0x3dcbb4(_0x490d85['error']['message']);}logger[_0xe505('0x12')](_0xe505('0x13'),_0x5d2fad,_0x490d85[_0xe505('0x12')][_0xe505('0x14')]);return _0x5b464a(_0x490d85[_0xe505('0x12')]['message']);}else{logger['info'](_0xe505('0x13'),_0x5d2fad,_0xe505('0x10'));_0x5b464a(_0x490d85['result']['message']);}})[_0xe505('0x15')](function(_0x12d9da){logger[_0xe505('0x12')](_0xe505('0x13'),_0x5d2fad,_0x12d9da);_0x3dcbb4(_0x12d9da);});});}exports[_0xe505('0x16')]=function(_0x26a343){var _0x29b48c=this;return new Promise(function(_0x451027,_0x4271cf){return db['SmsQueue'][_0xe505('0x17')]({'raw':_0x26a343[_0xe505('0x18')]?_0x26a343[_0xe505('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x26a343['options']?_0x26a343[_0xe505('0x18')][_0xe505('0x19')]||null:null,'attributes':_0x26a343[_0xe505('0x18')]?_0x26a343['options'][_0xe505('0x1a')]||null:null,'limit':_0x26a343[_0xe505('0x18')]?_0x26a343['options'][_0xe505('0x1b')]||null:null,'include':_0x26a343[_0xe505('0x18')]?_0x26a343['options'][_0xe505('0x1c')]?_['map'](_0x26a343[_0xe505('0x18')][_0xe505('0x1c')],function(_0x4d0489){return{'model':db[_0x4d0489[_0xe505('0x1d')]],'as':_0x4d0489['as'],'attributes':_0x4d0489[_0xe505('0x1a')],'include':_0x4d0489['include']?_['map'](_0x4d0489[_0xe505('0x1c')],function(_0x57081d){return{'model':db[_0x57081d[_0xe505('0x1d')]],'as':_0x57081d['as'],'attributes':_0x57081d[_0xe505('0x1a')],'include':_0x57081d[_0xe505('0x1c')]?_[_0xe505('0x1e')](_0x57081d['include'],function(_0x5ccc51){return{'model':db[_0x5ccc51[_0xe505('0x1d')]],'as':_0x5ccc51['as'],'attributes':_0x5ccc51[_0xe505('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe505('0xf')](function(_0x39b0b2){logger['info']('GetSmsQueue',_0x26a343);logger[_0xe505('0x1f')](_0xe505('0x16'),_0x26a343,JSON[_0xe505('0x11')](_0x39b0b2));_0x451027(_0x39b0b2);})[_0xe505('0x15')](function(_0x28891c){logger[_0xe505('0x12')](_0xe505('0x16'),_0x28891c[_0xe505('0x14')],_0x26a343);_0x4271cf(_0x29b48c['error'](0x1f4,_0x28891c[_0xe505('0x14')]));});});};exports[_0xe505('0x20')]=function(_0x1b91d5){var _0x36e683=this;return new Promise(function(_0x1ae2b3,_0x1c41e0){return db[_0xe505('0x21')][_0xe505('0x22')]({'raw':_0x1b91d5[_0xe505('0x18')]?_0x1b91d5[_0xe505('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1b91d5[_0xe505('0x18')]?_0x1b91d5['options'][_0xe505('0x19')]||null:null,'attributes':_0x1b91d5['options']?_0x1b91d5[_0xe505('0x18')]['attributes']||null:null,'include':_0x1b91d5[_0xe505('0x18')]?_0x1b91d5[_0xe505('0x18')][_0xe505('0x1c')]?_[_0xe505('0x1e')](_0x1b91d5[_0xe505('0x18')][_0xe505('0x1c')],function(_0x3bb431){return{'model':db[_0x3bb431[_0xe505('0x1d')]],'as':_0x3bb431['as'],'attributes':_0x3bb431[_0xe505('0x1a')],'include':_0x3bb431[_0xe505('0x1c')]?_[_0xe505('0x1e')](_0x3bb431[_0xe505('0x1c')],function(_0x3823d9){return{'model':db[_0x3823d9[_0xe505('0x1d')]],'as':_0x3823d9['as'],'attributes':_0x3823d9[_0xe505('0x1a')],'include':_0x3823d9['include']?_[_0xe505('0x1e')](_0x3823d9[_0xe505('0x1c')],function(_0x83a3ca){return{'model':db[_0x83a3ca[_0xe505('0x1d')]],'as':_0x83a3ca['as'],'attributes':_0x83a3ca[_0xe505('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a2497){logger[_0xe505('0x23')](_0xe505('0x20'),_0x1b91d5);logger[_0xe505('0x1f')](_0xe505('0x20'),_0x1b91d5,JSON[_0xe505('0x11')](_0x4a2497));_0x1ae2b3(_0x4a2497);})[_0xe505('0x15')](function(_0x443cd6){logger['error'](_0xe505('0x20'),_0x443cd6['message'],_0x1b91d5);_0x1c41e0(_0x36e683['error'](0x1f4,_0x443cd6['message']));});});}; \ No newline at end of file +var _0x53dc=['map','model','catch','ShowSmsQueue','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include'];(function(_0x298957,_0x36c18b){var _0x1028b9=function(_0x1f233c){while(--_0x1f233c){_0x298957['push'](_0x298957['shift']());}};_0x1028b9(++_0x36c18b);}(_0x53dc,0x14e));var _0xc53d=function(_0x555816,_0xeab9f0){_0x555816=_0x555816-0x0;var _0x8be1c3=_0x53dc[_0x555816];return _0x8be1c3;};'use strict';var _=require('lodash');var util=require(_0xc53d('0x0'));var moment=require(_0xc53d('0x1'));var BPromise=require(_0xc53d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc53d('0x3'));var db=require(_0xc53d('0x4'))['db'];var utils=require(_0xc53d('0x5'));var logger=require('../../config/logger')(_0xc53d('0x6'));var config=require(_0xc53d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc53d('0x8')][_0xc53d('0x9')]({'port':0x232a});config[_0xc53d('0xa')]=_[_0xc53d('0xb')](config[_0xc53d('0xa')],{'host':_0xc53d('0xc'),'port':0x18eb});var socket=require(_0xc53d('0xd'))(new Redis(config[_0xc53d('0xa')]));require(_0xc53d('0xe'))['register'](socket);function respondWithRpcPromise(_0x401cb9,_0xd8ae7c,_0x3d7835){return new BPromise(function(_0x435036,_0x433195){return client[_0xc53d('0xf')](_0x401cb9,_0x3d7835)[_0xc53d('0x10')](function(_0x1332ac){logger[_0xc53d('0x11')](_0xc53d('0x12'),_0xd8ae7c,_0xc53d('0x13'));logger[_0xc53d('0x14')](_0xc53d('0x15'),_0xd8ae7c,_0xc53d('0x13'),JSON[_0xc53d('0x16')](_0x1332ac));if(_0x1332ac[_0xc53d('0x17')]){if(_0x1332ac[_0xc53d('0x17')][_0xc53d('0x18')]===0x1f4){logger['error'](_0xc53d('0x12'),_0xd8ae7c,_0x1332ac['error'][_0xc53d('0x19')]);return _0x433195(_0x1332ac[_0xc53d('0x17')][_0xc53d('0x19')]);}logger[_0xc53d('0x17')](_0xc53d('0x12'),_0xd8ae7c,_0x1332ac[_0xc53d('0x17')]['message']);return _0x435036(_0x1332ac[_0xc53d('0x17')][_0xc53d('0x19')]);}else{logger[_0xc53d('0x11')](_0xc53d('0x12'),_0xd8ae7c,'request\x20sent');_0x435036(_0x1332ac[_0xc53d('0x1a')][_0xc53d('0x19')]);}})['catch'](function(_0x2b8315){logger[_0xc53d('0x17')](_0xc53d('0x12'),_0xd8ae7c,_0x2b8315);_0x433195(_0x2b8315);});});}exports[_0xc53d('0x1b')]=function(_0x2b74d1){var _0x4ca24a=this;return new Promise(function(_0x53e0c4,_0x429626){return db[_0xc53d('0x1c')][_0xc53d('0x1d')]({'raw':_0x2b74d1[_0xc53d('0x1e')]?_0x2b74d1[_0xc53d('0x1e')][_0xc53d('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b74d1['options']?_0x2b74d1[_0xc53d('0x1e')]['where']||null:null,'attributes':_0x2b74d1[_0xc53d('0x1e')]?_0x2b74d1['options'][_0xc53d('0x20')]||null:null,'limit':_0x2b74d1['options']?_0x2b74d1[_0xc53d('0x1e')][_0xc53d('0x21')]||null:null,'include':_0x2b74d1['options']?_0x2b74d1['options'][_0xc53d('0x22')]?_[_0xc53d('0x23')](_0x2b74d1[_0xc53d('0x1e')][_0xc53d('0x22')],function(_0x588673){return{'model':db[_0x588673[_0xc53d('0x24')]],'as':_0x588673['as'],'attributes':_0x588673['attributes'],'include':_0x588673['include']?_[_0xc53d('0x23')](_0x588673[_0xc53d('0x22')],function(_0x506b89){return{'model':db[_0x506b89[_0xc53d('0x24')]],'as':_0x506b89['as'],'attributes':_0x506b89[_0xc53d('0x20')],'include':_0x506b89[_0xc53d('0x22')]?_[_0xc53d('0x23')](_0x506b89[_0xc53d('0x22')],function(_0x2be5b8){return{'model':db[_0x2be5b8['model']],'as':_0x2be5b8['as'],'attributes':_0x2be5b8[_0xc53d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc53d('0x10')](function(_0xf90191){logger[_0xc53d('0x11')](_0xc53d('0x1b'),_0x2b74d1);logger[_0xc53d('0x14')](_0xc53d('0x1b'),_0x2b74d1,JSON[_0xc53d('0x16')](_0xf90191));_0x53e0c4(_0xf90191);})[_0xc53d('0x25')](function(_0x2c3602){logger['error']('GetSmsQueue',_0x2c3602[_0xc53d('0x19')],_0x2b74d1);_0x429626(_0x4ca24a[_0xc53d('0x17')](0x1f4,_0x2c3602['message']));});});};exports[_0xc53d('0x26')]=function(_0xfd388f){var _0x1dd693=this;return new Promise(function(_0x4d5bea,_0x3988dc){return db[_0xc53d('0x1c')][_0xc53d('0x27')]({'raw':_0xfd388f[_0xc53d('0x1e')]?_0xfd388f[_0xc53d('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xfd388f[_0xc53d('0x1e')]?_0xfd388f['options'][_0xc53d('0x28')]||null:null,'attributes':_0xfd388f[_0xc53d('0x1e')]?_0xfd388f[_0xc53d('0x1e')][_0xc53d('0x20')]||null:null,'include':_0xfd388f['options']?_0xfd388f[_0xc53d('0x1e')][_0xc53d('0x22')]?_[_0xc53d('0x23')](_0xfd388f[_0xc53d('0x1e')]['include'],function(_0x97b9f4){return{'model':db[_0x97b9f4['model']],'as':_0x97b9f4['as'],'attributes':_0x97b9f4[_0xc53d('0x20')],'include':_0x97b9f4['include']?_['map'](_0x97b9f4['include'],function(_0x57afd2){return{'model':db[_0x57afd2['model']],'as':_0x57afd2['as'],'attributes':_0x57afd2[_0xc53d('0x20')],'include':_0x57afd2[_0xc53d('0x22')]?_[_0xc53d('0x23')](_0x57afd2[_0xc53d('0x22')],function(_0x392147){return{'model':db[_0x392147[_0xc53d('0x24')]],'as':_0x392147['as'],'attributes':_0x392147['attributes']};}):[]};}):[]};}):[]:[]})[_0xc53d('0x10')](function(_0x5e3f32){logger[_0xc53d('0x11')](_0xc53d('0x26'),_0xfd388f);logger['debug'](_0xc53d('0x26'),_0xfd388f,JSON[_0xc53d('0x16')](_0x5e3f32));_0x4d5bea(_0x5e3f32);})['catch'](function(_0xe919b1){logger[_0xc53d('0x17')](_0xc53d('0x26'),_0xe919b1[_0xc53d('0x19')],_0xfd388f);_0x3988dc(_0x1dd693[_0xc53d('0x17')](0x1f4,_0xe919b1[_0xc53d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2cc80f2..5a92097 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 _0xb4b7=['update','emit','removeListener','length','smsQueue:','./smsQueue.events','save'];(function(_0x3b6a6d,_0x3ba7df){var _0x13268d=function(_0x3f94f1){while(--_0x3f94f1){_0x3b6a6d['push'](_0x3b6a6d['shift']());}};_0x13268d(++_0x3ba7df);}(_0xb4b7,0x11d));var _0x7b4b=function(_0x1e6d64,_0xfe5157){_0x1e6d64=_0x1e6d64-0x0;var _0x1c97d4=_0xb4b7[_0x1e6d64];return _0x1c97d4;};'use strict';var SmsQueueEvents=require(_0x7b4b('0x0'));var events=[_0x7b4b('0x1'),'remove',_0x7b4b('0x2')];function createListener(_0x402213,_0x33c822){return function(_0x2b9db2){_0x33c822[_0x7b4b('0x3')](_0x402213,_0x2b9db2);};}function removeListener(_0x385250,_0x19ac62){return function(){SmsQueueEvents[_0x7b4b('0x4')](_0x385250,_0x19ac62);};}exports['register']=function(_0x3e3d7c){for(var _0x34c3c9=0x0,_0x4e09a9=events[_0x7b4b('0x5')];_0x34c3c9<_0x4e09a9;_0x34c3c9++){var _0x4bc82f=events[_0x34c3c9];var _0x3e0624=createListener(_0x7b4b('0x6')+_0x4bc82f,_0x3e3d7c);SmsQueueEvents['on'](_0x4bc82f,_0x3e0624);}}; \ No newline at end of file +var _0x5bb8=['save','update','register','length','smsQueue:','./smsQueue.events'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0x5bb8,0x101));var _0x85bb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5bb8[_0x14add3];return _0x4a174f;};'use strict';var SmsQueueEvents=require(_0x85bb('0x0'));var events=[_0x85bb('0x1'),'remove',_0x85bb('0x2')];function createListener(_0x52a91c,_0x202529){return function(_0x1ffd34){_0x202529['emit'](_0x52a91c,_0x1ffd34);};}function removeListener(_0x6a1d8d,_0x3bb2cf){return function(){SmsQueueEvents['removeListener'](_0x6a1d8d,_0x3bb2cf);};}exports[_0x85bb('0x3')]=function(_0x5e0755){for(var _0x5d9107=0x0,_0x6a4100=events[_0x85bb('0x4')];_0x5d9107<_0x6a4100;_0x5d9107++){var _0xdadf18=events[_0x5d9107];var _0x56c0f3=createListener(_0x85bb('0x5')+_0xdadf18,_0x5e0755);SmsQueueEvents['on'](_0xdadf18,_0x56c0f3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b1d70b4..6262210 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 _0xcca7=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcca7,0x1aa));var _0x7cca=function(_0x118355,_0x201311){_0x118355=_0x118355-0x0;var _0x32f7ea=_0xcca7[_0x118355];return _0x32f7ea;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var controller=require(_0x7cca('0x7'));router[_0x7cca('0x8')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xa')]);router['get']('/describe',auth[_0x7cca('0x9')](),controller[_0x7cca('0xb')]);router[_0x7cca('0x8')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller[_0x7cca('0xd')]);router[_0x7cca('0xe')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xf')]);router[_0x7cca('0x10')]('/:id',auth[_0x7cca('0x9')](),controller[_0x7cca('0x11')]);router[_0x7cca('0x12')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller['destroy']);module[_0x7cca('0x13')]=router; \ No newline at end of file +var _0xbd18=['/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd18,0x195));var _0x8bd1=function(_0x53e4a6,_0x4c3183){_0x53e4a6=_0x53e4a6-0x0;var _0x17c82e=_0xbd18[_0x53e4a6];return _0x17c82e;};'use strict';var multer=require(_0x8bd1('0x0'));var util=require(_0x8bd1('0x1'));var path=require(_0x8bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x8bd1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bd1('0x4'));var config=require(_0x8bd1('0x5'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x8bd1('0x6')](),controller[_0x8bd1('0x7')]);router[_0x8bd1('0x8')](_0x8bd1('0x9'),auth['isAuthenticated'](),controller[_0x8bd1('0xa')]);router[_0x8bd1('0x8')](_0x8bd1('0xb'),auth['isAuthenticated'](),controller[_0x8bd1('0xc')]);router[_0x8bd1('0xd')]('/',auth[_0x8bd1('0x6')](),controller[_0x8bd1('0xe')]);router['put'](_0x8bd1('0xb'),auth['isAuthenticated'](),controller[_0x8bd1('0xf')]);router[_0x8bd1('0x10')]('/:id',auth[_0x8bd1('0x6')](),controller['destroy']);module[_0x8bd1('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 34a6ed9..778e3a3 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 _0x1eab=['DATE','moment','exports','STRING'];(function(_0x4f65ea,_0x8dfc0e){var _0x5235d9=function(_0x5a2fa0){while(--_0x5a2fa0){_0x4f65ea['push'](_0x4f65ea['shift']());}};_0x5235d9(++_0x8dfc0e);}(_0x1eab,0xad));var _0xb1ea=function(_0x4aa3f3,_0x294d69){_0x4aa3f3=_0x4aa3f3-0x0;var _0x2704e9=_0x1eab[_0x4aa3f3];return _0x2704e9;};'use strict';var moment=require(_0xb1ea('0x0'));var Sequelize=require('sequelize');module[_0xb1ea('0x1')]={'uniqueid':{'type':Sequelize[_0xb1ea('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb1ea('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb1ea('0x3')]},'acceptAt':{'type':Sequelize[_0xb1ea('0x3')]},'exitAt':{'type':Sequelize[_0xb1ea('0x3')]},'reason':{'type':Sequelize[_0xb1ea('0x2')]}}; \ No newline at end of file +var _0xac12=['STRING','DATE','moment','sequelize','exports'];(function(_0x5e9064,_0x7340d7){var _0x26f531=function(_0x2dcbe6){while(--_0x2dcbe6){_0x5e9064['push'](_0x5e9064['shift']());}};_0x26f531(++_0x7340d7);}(_0xac12,0x1e7));var _0x2ac1=function(_0x124b6f,_0x1846ab){_0x124b6f=_0x124b6f-0x0;var _0x5a87d1=_0xac12[_0x124b6f];return _0x5a87d1;};'use strict';var moment=require(_0x2ac1('0x0'));var Sequelize=require(_0x2ac1('0x1'));module[_0x2ac1('0x2')]={'uniqueid':{'type':Sequelize[_0x2ac1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2ac1('0x3')]},'joinAt':{'type':Sequelize[_0x2ac1('0x4')]},'leaveAt':{'type':Sequelize[_0x2ac1('0x4')]},'acceptAt':{'type':Sequelize[_0x2ac1('0x4')]},'exitAt':{'type':Sequelize[_0x2ac1('0x4')]},'reason':{'type':Sequelize[_0x2ac1('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4462822..8ebb1e0 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 _0xb1b2=['length','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','destroy','then','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','include','catch','show','rawAttributes'];(function(_0x537433,_0x337fab){var _0x19e6b6=function(_0x3f3ca3){while(--_0x3f3ca3){_0x537433['push'](_0x537433['shift']());}};_0x19e6b6(++_0x337fab);}(_0xb1b2,0x183));var _0x2b1b=function(_0x3539d1,_0x2c1cb2){_0x3539d1=_0x3539d1-0x0;var _0x3ad7b7=_0xb1b2[_0x3539d1];return _0x3ad7b7;};'use strict';var emlformat=require(_0x2b1b('0x0'));var rimraf=require(_0x2b1b('0x1'));var zipdir=require(_0x2b1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b1b('0x3'));var moment=require(_0x2b1b('0x4'));var BPromise=require(_0x2b1b('0x5'));var Mustache=require(_0x2b1b('0x6'));var util=require(_0x2b1b('0x7'));var path=require(_0x2b1b('0x8'));var sox=require(_0x2b1b('0x9'));var csv=require(_0x2b1b('0xa'));var ejs=require(_0x2b1b('0xb'));var fs=require('fs');var fs_extra=require(_0x2b1b('0xc'));var _=require(_0x2b1b('0xd'));var squel=require(_0x2b1b('0xe'));var crypto=require('crypto');var jsforce=require(_0x2b1b('0xf'));var deskjs=require(_0x2b1b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2b1b('0x11'));var Papa=require(_0x2b1b('0x12'));var Redis=require(_0x2b1b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2b1b('0x14'));var as=require(_0x2b1b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b1b('0x16'))(_0x2b1b('0x17'));var utils=require('../../config/utils');var config=require(_0x2b1b('0x18'));var licenseUtil=require(_0x2b1b('0x19'));var db=require(_0x2b1b('0x1a'))['db'];function respondWithStatusCode(_0x14461d,_0x4d74e4){_0x4d74e4=_0x4d74e4||0xcc;return function(_0x22a347){if(_0x22a347){return _0x14461d[_0x2b1b('0x1b')](_0x4d74e4);}return _0x14461d[_0x2b1b('0x1c')](_0x4d74e4)[_0x2b1b('0x1d')]();};}function respondWithResult(_0x349efa,_0x60302b){_0x60302b=_0x60302b||0xc8;return function(_0x4d9904){if(_0x4d9904){return _0x349efa[_0x2b1b('0x1c')](_0x60302b)[_0x2b1b('0x1e')](_0x4d9904);}};}function respondWithFilteredResult(_0x202836,_0x3493f0){return function(_0x24f2d6){if(_0x24f2d6){var _0x3d1bb8=typeof _0x3493f0['offset']==='undefined'&&typeof _0x3493f0[_0x2b1b('0x1f')]===_0x2b1b('0x20');var _0x2d1eaa=_0x24f2d6[_0x2b1b('0x21')];var _0xafa3d9=_0x3d1bb8?0x0:_0x3493f0[_0x2b1b('0x22')];var _0xe32438=_0x3d1bb8?_0x24f2d6[_0x2b1b('0x21')]:_0x3493f0['offset']+_0x3493f0[_0x2b1b('0x1f')];var _0x4263a6;if(_0xe32438>=_0x2d1eaa){_0xe32438=_0x2d1eaa;_0x4263a6=0xc8;}else{_0x4263a6=0xce;}_0x202836['status'](_0x4263a6);return _0x202836['set'](_0x2b1b('0x23'),_0xafa3d9+'-'+_0xe32438+'/'+_0x2d1eaa)['json'](_0x24f2d6);}return null;};}function patchUpdates(_0x915a8c){return function(_0x2fb8ab){try{jsonpatch['apply'](_0x2fb8ab,_0x915a8c,!![]);}catch(_0x2e0fa8){return BPromise[_0x2b1b('0x24')](_0x2e0fa8);}return _0x2fb8ab[_0x2b1b('0x25')]();};}function saveUpdates(_0x203d59,_0x29abc7){return function(_0x5dcb46){if(_0x5dcb46){return _0x5dcb46['update'](_0x203d59)['then'](function(_0x4b89e3){return _0x4b89e3;});}return null;};}function removeEntity(_0x2a498f,_0x5464ef){return function(_0x2a311c){if(_0x2a311c){return _0x2a311c[_0x2b1b('0x26')]()[_0x2b1b('0x27')](function(){_0x2a498f[_0x2b1b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9069,_0x5dfa42){return function(_0x1130a3){if(!_0x1130a3){_0x3e9069[_0x2b1b('0x1b')](0x194);}return _0x1130a3;};}function handleError(_0x36735e,_0xc6957b){_0xc6957b=_0xc6957b||0x1f4;return function(_0x2284c3){logger[_0x2b1b('0x28')](_0x2284c3['stack']);if(_0x2284c3[_0x2b1b('0x29')]){delete _0x2284c3[_0x2b1b('0x29')];}_0x36735e[_0x2b1b('0x1c')](_0xc6957b)[_0x2b1b('0x2a')](_0x2284c3);};}exports[_0x2b1b('0x2b')]=function(_0x18b730,_0x18e59a){var _0x2d2d92={},_0x5596c5={},_0x1e043a={'count':0x0,'rows':[]};var _0x1b3a36=_[_0x2b1b('0x2c')](db['SmsQueueReport']['rawAttributes'],function(_0x4f4d7d){return{'name':_0x4f4d7d[_0x2b1b('0x2d')],'type':_0x4f4d7d[_0x2b1b('0x2e')][_0x2b1b('0x2f')]};});_0x5596c5['model']=_[_0x2b1b('0x2c')](_0x1b3a36,_0x2b1b('0x29'));_0x5596c5[_0x2b1b('0x30')]=_[_0x2b1b('0x31')](_0x18b730[_0x2b1b('0x30')]);_0x5596c5[_0x2b1b('0x32')]=_[_0x2b1b('0x33')](_0x5596c5[_0x2b1b('0x34')],_0x5596c5['query']);_0x2d2d92[_0x2b1b('0x35')]=_[_0x2b1b('0x33')](_0x5596c5['model'],qs[_0x2b1b('0x36')](_0x18b730['query'][_0x2b1b('0x36')]));_0x2d2d92[_0x2b1b('0x35')]=_0x2d2d92['attributes']['length']?_0x2d2d92[_0x2b1b('0x35')]:_0x5596c5['model'];if(!_0x18b730[_0x2b1b('0x30')][_0x2b1b('0x37')](_0x2b1b('0x38'))){_0x2d2d92[_0x2b1b('0x1f')]=qs[_0x2b1b('0x1f')](_0x18b730[_0x2b1b('0x30')]['limit']);_0x2d2d92[_0x2b1b('0x22')]=qs['offset'](_0x18b730[_0x2b1b('0x30')][_0x2b1b('0x22')]);}_0x2d2d92['order']=qs[_0x2b1b('0x39')](_0x18b730[_0x2b1b('0x30')][_0x2b1b('0x39')]);_0x2d2d92[_0x2b1b('0x3a')]=qs['filters'](_[_0x2b1b('0x3b')](_0x18b730[_0x2b1b('0x30')],_0x5596c5[_0x2b1b('0x32')]),_0x1b3a36);if(_0x18b730['query'][_0x2b1b('0x3c')]){_0x2d2d92['where']=_['merge'](_0x2d2d92[_0x2b1b('0x3a')],{'$or':_[_0x2b1b('0x2c')](_0x1b3a36,function(_0x406bcf){if(_0x406bcf['type']!=='VIRTUAL'){var _0x8368e6={};_0x8368e6[_0x406bcf[_0x2b1b('0x29')]]={'$like':'%'+_0x18b730[_0x2b1b('0x30')]['filter']+'%'};return _0x8368e6;}})});}_0x2d2d92=_[_0x2b1b('0x3d')]({},_0x2d2d92,_0x18b730[_0x2b1b('0x3e')]);var _0x2a307b={'where':_0x2d2d92[_0x2b1b('0x3a')]};return db[_0x2b1b('0x3f')][_0x2b1b('0x21')](_0x2a307b)[_0x2b1b('0x27')](function(_0x1b956c){_0x1e043a[_0x2b1b('0x21')]=_0x1b956c;if(_0x18b730[_0x2b1b('0x30')][_0x2b1b('0x40')]){_0x2d2d92[_0x2b1b('0x41')]=[{'all':!![]}];}return db[_0x2b1b('0x3f')]['findAll'](_0x2d2d92);})['then'](function(_0x4d039a){_0x1e043a['rows']=_0x4d039a;return _0x1e043a;})[_0x2b1b('0x27')](respondWithFilteredResult(_0x18e59a,_0x2d2d92))[_0x2b1b('0x42')](handleError(_0x18e59a,null));};exports[_0x2b1b('0x43')]=function(_0x15b346,_0x1e9d8c){var _0x26089f={'raw':!![],'where':{'id':_0x15b346['params']['id']}},_0x39c790={};_0x39c790[_0x2b1b('0x34')]=_[_0x2b1b('0x31')](db[_0x2b1b('0x3f')][_0x2b1b('0x44')]);_0x39c790[_0x2b1b('0x30')]=_['keys'](_0x15b346[_0x2b1b('0x30')]);_0x39c790[_0x2b1b('0x32')]=_['intersection'](_0x39c790['model'],_0x39c790[_0x2b1b('0x30')]);_0x26089f[_0x2b1b('0x35')]=_[_0x2b1b('0x33')](_0x39c790[_0x2b1b('0x34')],qs[_0x2b1b('0x36')](_0x15b346[_0x2b1b('0x30')]['fields']));_0x26089f[_0x2b1b('0x35')]=_0x26089f[_0x2b1b('0x35')][_0x2b1b('0x45')]?_0x26089f[_0x2b1b('0x35')]:_0x39c790['model'];if(_0x15b346['query']['includeAll']){_0x26089f['include']=[{'all':!![]}];}_0x26089f=_[_0x2b1b('0x3d')]({},_0x26089f,_0x15b346['options']);return db['SmsQueueReport'][_0x2b1b('0x46')](_0x26089f)[_0x2b1b('0x27')](handleEntityNotFound(_0x1e9d8c,null))[_0x2b1b('0x27')](respondWithResult(_0x1e9d8c,null))['catch'](handleError(_0x1e9d8c,null));};exports[_0x2b1b('0x47')]=function(_0x166766,_0x43361b){return db['SmsQueueReport'][_0x2b1b('0x47')](_0x166766[_0x2b1b('0x48')],{})[_0x2b1b('0x27')](respondWithResult(_0x43361b,0xc9))['catch'](handleError(_0x43361b,null));};exports[_0x2b1b('0x49')]=function(_0x304d89,_0x4037c9){if(_0x304d89[_0x2b1b('0x48')]['id']){delete _0x304d89[_0x2b1b('0x48')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x304d89[_0x2b1b('0x4a')]['id']}})[_0x2b1b('0x27')](handleEntityNotFound(_0x4037c9,null))[_0x2b1b('0x27')](saveUpdates(_0x304d89[_0x2b1b('0x48')],null))[_0x2b1b('0x27')](respondWithResult(_0x4037c9,null))[_0x2b1b('0x42')](handleError(_0x4037c9,null));};exports[_0x2b1b('0x26')]=function(_0x212f41,_0x6f4f7d){return db[_0x2b1b('0x3f')][_0x2b1b('0x46')]({'where':{'id':_0x212f41['params']['id']}})[_0x2b1b('0x27')](handleEntityNotFound(_0x6f4f7d,null))[_0x2b1b('0x27')](removeEntity(_0x6f4f7d,null))[_0x2b1b('0x42')](handleError(_0x6f4f7d,null));};exports[_0x2b1b('0x4b')]=function(_0x21868f,_0x4513a0){return db['SmsQueueReport'][_0x2b1b('0x4b')]()[_0x2b1b('0x27')](respondWithResult(_0x4513a0,null))[_0x2b1b('0x42')](handleError(_0x4513a0,null));}; \ No newline at end of file +var _0xfd7e=['rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','catch','show','keys','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','SmsQueueReport'];(function(_0x1b5a6e,_0x1e08ef){var _0x190c51=function(_0xfe59a3){while(--_0xfe59a3){_0x1b5a6e['push'](_0x1b5a6e['shift']());}};_0x190c51(++_0x1e08ef);}(_0xfd7e,0x19e));var _0xefd7=function(_0x1094fa,_0x582783){_0x1094fa=_0x1094fa-0x0;var _0x1faba2=_0xfd7e[_0x1094fa];return _0x1faba2;};'use strict';var emlformat=require(_0xefd7('0x0'));var rimraf=require(_0xefd7('0x1'));var zipdir=require(_0xefd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefd7('0x3'));var moment=require(_0xefd7('0x4'));var BPromise=require(_0xefd7('0x5'));var Mustache=require(_0xefd7('0x6'));var util=require(_0xefd7('0x7'));var path=require('path');var sox=require(_0xefd7('0x8'));var csv=require(_0xefd7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefd7('0xa'));var _=require(_0xefd7('0xb'));var squel=require(_0xefd7('0xc'));var crypto=require(_0xefd7('0xd'));var jsforce=require(_0xefd7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xefd7('0x9'));var querystring=require(_0xefd7('0xf'));var Papa=require(_0xefd7('0x10'));var Redis=require(_0xefd7('0x11'));var authService=require(_0xefd7('0x12'));var qs=require(_0xefd7('0x13'));var as=require(_0xefd7('0x14'));var hardwareService=require(_0xefd7('0x15'));var logger=require(_0xefd7('0x16'))(_0xefd7('0x17'));var utils=require('../../config/utils');var config=require(_0xefd7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xefd7('0x19'))['db'];function respondWithStatusCode(_0x2dd7d5,_0xad3d47){_0xad3d47=_0xad3d47||0xcc;return function(_0x1336fe){if(_0x1336fe){return _0x2dd7d5['sendStatus'](_0xad3d47);}return _0x2dd7d5[_0xefd7('0x1a')](_0xad3d47)[_0xefd7('0x1b')]();};}function respondWithResult(_0xf656d7,_0x1aa800){_0x1aa800=_0x1aa800||0xc8;return function(_0x27f812){if(_0x27f812){return _0xf656d7[_0xefd7('0x1a')](_0x1aa800)['json'](_0x27f812);}};}function respondWithFilteredResult(_0x5cf1ca,_0x4e8712){return function(_0x44fd76){if(_0x44fd76){var _0x5cde7d=typeof _0x4e8712['offset']===_0xefd7('0x1c')&&typeof _0x4e8712[_0xefd7('0x1d')]===_0xefd7('0x1c');var _0x2514b9=_0x44fd76[_0xefd7('0x1e')];var _0x35581c=_0x5cde7d?0x0:_0x4e8712[_0xefd7('0x1f')];var _0x233281=_0x5cde7d?_0x44fd76[_0xefd7('0x1e')]:_0x4e8712[_0xefd7('0x1f')]+_0x4e8712['limit'];var _0x341c3d;if(_0x233281>=_0x2514b9){_0x233281=_0x2514b9;_0x341c3d=0xc8;}else{_0x341c3d=0xce;}_0x5cf1ca['status'](_0x341c3d);return _0x5cf1ca[_0xefd7('0x20')](_0xefd7('0x21'),_0x35581c+'-'+_0x233281+'/'+_0x2514b9)[_0xefd7('0x22')](_0x44fd76);}return null;};}function patchUpdates(_0x48d35c){return function(_0x179392){try{jsonpatch[_0xefd7('0x23')](_0x179392,_0x48d35c,!![]);}catch(_0x33f322){return BPromise[_0xefd7('0x24')](_0x33f322);}return _0x179392[_0xefd7('0x25')]();};}function saveUpdates(_0x131f87,_0x11157d){return function(_0x5d73aa){if(_0x5d73aa){return _0x5d73aa[_0xefd7('0x26')](_0x131f87)[_0xefd7('0x27')](function(_0x1f8c04){return _0x1f8c04;});}return null;};}function removeEntity(_0x95dbec,_0x2aec34){return function(_0x1be142){if(_0x1be142){return _0x1be142[_0xefd7('0x28')]()[_0xefd7('0x27')](function(){_0x95dbec[_0xefd7('0x1a')](0xcc)[_0xefd7('0x1b')]();});}};}function handleEntityNotFound(_0x3b0018,_0x402d70){return function(_0x12d60f){if(!_0x12d60f){_0x3b0018[_0xefd7('0x29')](0x194);}return _0x12d60f;};}function handleError(_0x2a2b5a,_0x10efe9){_0x10efe9=_0x10efe9||0x1f4;return function(_0x3f509d){logger[_0xefd7('0x2a')](_0x3f509d[_0xefd7('0x2b')]);if(_0x3f509d['name']){delete _0x3f509d[_0xefd7('0x2c')];}_0x2a2b5a[_0xefd7('0x1a')](_0x10efe9)[_0xefd7('0x2d')](_0x3f509d);};}exports['index']=function(_0x19f561,_0x22f7e3){var _0x41b2e6={},_0x3387d9={},_0x194265={'count':0x0,'rows':[]};var _0x638d5c=_[_0xefd7('0x2e')](db[_0xefd7('0x2f')][_0xefd7('0x30')],function(_0x1ae23b){return{'name':_0x1ae23b[_0xefd7('0x31')],'type':_0x1ae23b['type'][_0xefd7('0x32')]};});_0x3387d9['model']=_[_0xefd7('0x2e')](_0x638d5c,_0xefd7('0x2c'));_0x3387d9[_0xefd7('0x33')]=_['keys'](_0x19f561[_0xefd7('0x33')]);_0x3387d9['filters']=_[_0xefd7('0x34')](_0x3387d9[_0xefd7('0x35')],_0x3387d9[_0xefd7('0x33')]);_0x41b2e6[_0xefd7('0x36')]=_[_0xefd7('0x34')](_0x3387d9[_0xefd7('0x35')],qs['fields'](_0x19f561[_0xefd7('0x33')][_0xefd7('0x37')]));_0x41b2e6[_0xefd7('0x36')]=_0x41b2e6[_0xefd7('0x36')][_0xefd7('0x38')]?_0x41b2e6[_0xefd7('0x36')]:_0x3387d9[_0xefd7('0x35')];if(!_0x19f561[_0xefd7('0x33')][_0xefd7('0x39')](_0xefd7('0x3a'))){_0x41b2e6[_0xefd7('0x1d')]=qs[_0xefd7('0x1d')](_0x19f561[_0xefd7('0x33')][_0xefd7('0x1d')]);_0x41b2e6[_0xefd7('0x1f')]=qs[_0xefd7('0x1f')](_0x19f561[_0xefd7('0x33')][_0xefd7('0x1f')]);}_0x41b2e6[_0xefd7('0x3b')]=qs['sort'](_0x19f561['query'][_0xefd7('0x3c')]);_0x41b2e6[_0xefd7('0x3d')]=qs[_0xefd7('0x3e')](_['pick'](_0x19f561[_0xefd7('0x33')],_0x3387d9['filters']),_0x638d5c);if(_0x19f561['query']['filter']){_0x41b2e6[_0xefd7('0x3d')]=_['merge'](_0x41b2e6[_0xefd7('0x3d')],{'$or':_[_0xefd7('0x2e')](_0x638d5c,function(_0x1fe013){if(_0x1fe013[_0xefd7('0x3f')]!==_0xefd7('0x40')){var _0xee851b={};_0xee851b[_0x1fe013[_0xefd7('0x2c')]]={'$like':'%'+_0x19f561[_0xefd7('0x33')][_0xefd7('0x41')]+'%'};return _0xee851b;}})});}_0x41b2e6=_[_0xefd7('0x42')]({},_0x41b2e6,_0x19f561[_0xefd7('0x43')]);var _0x77057a={'where':_0x41b2e6['where']};return db[_0xefd7('0x2f')][_0xefd7('0x1e')](_0x77057a)['then'](function(_0x5ade4f){_0x194265['count']=_0x5ade4f;if(_0x19f561['query'][_0xefd7('0x44')]){_0x41b2e6[_0xefd7('0x45')]=[{'all':!![]}];}return db[_0xefd7('0x2f')]['findAll'](_0x41b2e6);})[_0xefd7('0x27')](function(_0x2ab1e3){_0x194265['rows']=_0x2ab1e3;return _0x194265;})[_0xefd7('0x27')](respondWithFilteredResult(_0x22f7e3,_0x41b2e6))[_0xefd7('0x46')](handleError(_0x22f7e3,null));};exports[_0xefd7('0x47')]=function(_0x66fa98,_0x1f8a95){var _0x983035={'raw':!![],'where':{'id':_0x66fa98['params']['id']}},_0x134242={};_0x134242[_0xefd7('0x35')]=_[_0xefd7('0x48')](db[_0xefd7('0x2f')][_0xefd7('0x30')]);_0x134242[_0xefd7('0x33')]=_[_0xefd7('0x48')](_0x66fa98['query']);_0x134242[_0xefd7('0x3e')]=_['intersection'](_0x134242[_0xefd7('0x35')],_0x134242[_0xefd7('0x33')]);_0x983035[_0xefd7('0x36')]=_[_0xefd7('0x34')](_0x134242[_0xefd7('0x35')],qs[_0xefd7('0x37')](_0x66fa98[_0xefd7('0x33')][_0xefd7('0x37')]));_0x983035[_0xefd7('0x36')]=_0x983035[_0xefd7('0x36')][_0xefd7('0x38')]?_0x983035[_0xefd7('0x36')]:_0x134242[_0xefd7('0x35')];if(_0x66fa98['query'][_0xefd7('0x44')]){_0x983035[_0xefd7('0x45')]=[{'all':!![]}];}_0x983035=_[_0xefd7('0x42')]({},_0x983035,_0x66fa98[_0xefd7('0x43')]);return db[_0xefd7('0x2f')]['find'](_0x983035)[_0xefd7('0x27')](handleEntityNotFound(_0x1f8a95,null))['then'](respondWithResult(_0x1f8a95,null))[_0xefd7('0x46')](handleError(_0x1f8a95,null));};exports['create']=function(_0x4579da,_0x51fa54){return db[_0xefd7('0x2f')]['create'](_0x4579da[_0xefd7('0x49')],{})['then'](respondWithResult(_0x51fa54,0xc9))[_0xefd7('0x46')](handleError(_0x51fa54,null));};exports[_0xefd7('0x26')]=function(_0x1fdaf6,_0x4d4926){if(_0x1fdaf6[_0xefd7('0x49')]['id']){delete _0x1fdaf6[_0xefd7('0x49')]['id'];}return db[_0xefd7('0x2f')][_0xefd7('0x4a')]({'where':{'id':_0x1fdaf6[_0xefd7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d4926,null))[_0xefd7('0x27')](saveUpdates(_0x1fdaf6[_0xefd7('0x49')],null))[_0xefd7('0x27')](respondWithResult(_0x4d4926,null))[_0xefd7('0x46')](handleError(_0x4d4926,null));};exports['destroy']=function(_0x4e5035,_0x5c511a){return db[_0xefd7('0x2f')][_0xefd7('0x4a')]({'where':{'id':_0x4e5035[_0xefd7('0x4b')]['id']}})[_0xefd7('0x27')](handleEntityNotFound(_0x5c511a,null))[_0xefd7('0x27')](removeEntity(_0x5c511a,null))['catch'](handleError(_0x5c511a,null));};exports[_0xefd7('0x4c')]=function(_0x1feca0,_0x2cc258){return db[_0xefd7('0x2f')][_0xefd7('0x4c')]()['then'](respondWithResult(_0x2cc258,null))[_0xefd7('0x46')](handleError(_0x2cc258,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1b398ca..d29da7c 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3376a7,_0x56bb16){var _0x50ae0e=function(_0x5085ee){while(--_0x5085ee){_0x3376a7['push'](_0x3376a7['shift']());}};_0x50ae0e(++_0x56bb16);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f979fc2..69fce5d 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 _0x1396=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','update','where','limit','UpdateSmsQueueReport','lodash','util','moment'];(function(_0x1dded7,_0x4a9778){var _0x126eb5=function(_0x55132e){while(--_0x55132e){_0x1dded7['push'](_0x1dded7['shift']());}};_0x126eb5(++_0x4a9778);}(_0x1396,0x15d));var _0x6139=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x1396[_0x12254f];return _0x3a4fa2;};'use strict';var _=require(_0x6139('0x0'));var util=require(_0x6139('0x1'));var moment=require(_0x6139('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6139('0x3'));var db=require(_0x6139('0x4'))['db'];var utils=require(_0x6139('0x5'));var logger=require(_0x6139('0x6'))(_0x6139('0x7'));var config=require(_0x6139('0x8'));var jayson=require(_0x6139('0x9'));var client=jayson[_0x6139('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4704f7,_0x36290c,_0x428877){return new BPromise(function(_0x444127,_0x1961d2){return client['request'](_0x4704f7,_0x428877)['then'](function(_0x2065e1){logger[_0x6139('0xb')](_0x6139('0xc'),_0x36290c,_0x6139('0xd'));logger[_0x6139('0xe')](_0x6139('0xf'),_0x36290c,_0x6139('0xd'),JSON[_0x6139('0x10')](_0x2065e1));if(_0x2065e1['error']){if(_0x2065e1['error'][_0x6139('0x11')]===0x1f4){logger[_0x6139('0x12')](_0x6139('0xc'),_0x36290c,_0x2065e1[_0x6139('0x12')][_0x6139('0x13')]);return _0x1961d2(_0x2065e1[_0x6139('0x12')]['message']);}logger[_0x6139('0x12')](_0x6139('0xc'),_0x36290c,_0x2065e1['error'][_0x6139('0x13')]);return _0x444127(_0x2065e1[_0x6139('0x12')][_0x6139('0x13')]);}else{logger[_0x6139('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x36290c,_0x6139('0xd'));_0x444127(_0x2065e1[_0x6139('0x14')][_0x6139('0x13')]);}})['catch'](function(_0x25eccd){logger[_0x6139('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x36290c,_0x25eccd);_0x1961d2(_0x25eccd);});});}exports[_0x6139('0x15')]=function(_0x104bcb){var _0x5c9492=this;return new Promise(function(_0x1d7439,_0xfb3d96){return db[_0x6139('0x16')][_0x6139('0x17')](_0x104bcb[_0x6139('0x18')],{'raw':_0x104bcb['options']?_0x104bcb[_0x6139('0x19')][_0x6139('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4481ba){logger['info'](_0x6139('0x15'),_0x104bcb);logger['debug'](_0x6139('0x15'),_0x104bcb,JSON[_0x6139('0x10')](_0x4481ba));_0x1d7439(_0x4481ba);})[_0x6139('0x1b')](function(_0x5b9cdf){logger[_0x6139('0x12')](_0x6139('0x15'),_0x5b9cdf[_0x6139('0x13')],_0x104bcb);_0xfb3d96(_0x5c9492[_0x6139('0x12')](0x1f4,_0x5b9cdf[_0x6139('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x14e04e){var _0x1b834f=this;return new Promise(function(_0x2f2c38,_0x21e947){return db[_0x6139('0x16')][_0x6139('0x1c')](_0x14e04e['body'],{'raw':_0x14e04e['options']?_0x14e04e[_0x6139('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14e04e[_0x6139('0x19')]?_0x14e04e[_0x6139('0x19')][_0x6139('0x1d')]||null:null,'attributes':_0x14e04e[_0x6139('0x19')]?_0x14e04e[_0x6139('0x19')]['attributes']||null:null,'limit':_0x14e04e['options']?_0x14e04e['options'][_0x6139('0x1e')]||null:null})['then'](function(_0x56cb60){logger['info']('UpdateSmsQueueReport',_0x14e04e);logger[_0x6139('0xe')](_0x6139('0x1f'),_0x14e04e,JSON[_0x6139('0x10')](_0x56cb60));_0x2f2c38(_0x56cb60);})[_0x6139('0x1b')](function(_0x5955e5){logger[_0x6139('0x12')]('UpdateSmsQueueReport',_0x5955e5['message'],_0x14e04e);_0x21e947(_0x1b834f[_0x6139('0x12')](0x1f4,_0x5955e5[_0x6139('0x13')]));});});}; \ No newline at end of file +var _0x1a4d=['http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','info','UpdateSmsQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','client'];(function(_0x2811e8,_0x3a576c){var _0x41f1df=function(_0x1baf0f){while(--_0x1baf0f){_0x2811e8['push'](_0x2811e8['shift']());}};_0x41f1df(++_0x3a576c);}(_0x1a4d,0xca));var _0xd1a4=function(_0x2e3c1b,_0x46cd00){_0x2e3c1b=_0x2e3c1b-0x0;var _0x5b3666=_0x1a4d[_0x2e3c1b];return _0x5b3666;};'use strict';var _=require(_0xd1a4('0x0'));var util=require(_0xd1a4('0x1'));var moment=require(_0xd1a4('0x2'));var BPromise=require(_0xd1a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1a4('0x5'));var config=require(_0xd1a4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd1a4('0x7')][_0xd1a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xeb2d0a,_0x127889,_0x4f367b){return new BPromise(function(_0x1ba117,_0x3a6e4c){return client['request'](_0xeb2d0a,_0x4f367b)[_0xd1a4('0x9')](function(_0x498011){logger['info'](_0xd1a4('0xa'),_0x127889,_0xd1a4('0xb'));logger[_0xd1a4('0xc')](_0xd1a4('0xd'),_0x127889,'request\x20sent',JSON[_0xd1a4('0xe')](_0x498011));if(_0x498011[_0xd1a4('0xf')]){if(_0x498011[_0xd1a4('0xf')][_0xd1a4('0x10')]===0x1f4){logger[_0xd1a4('0xf')](_0xd1a4('0xa'),_0x127889,_0x498011['error'][_0xd1a4('0x11')]);return _0x3a6e4c(_0x498011['error'][_0xd1a4('0x11')]);}logger[_0xd1a4('0xf')](_0xd1a4('0xa'),_0x127889,_0x498011[_0xd1a4('0xf')][_0xd1a4('0x11')]);return _0x1ba117(_0x498011[_0xd1a4('0xf')][_0xd1a4('0x11')]);}else{logger['info'](_0xd1a4('0xa'),_0x127889,_0xd1a4('0xb'));_0x1ba117(_0x498011['result']['message']);}})[_0xd1a4('0x12')](function(_0x21f366){logger[_0xd1a4('0xf')](_0xd1a4('0xa'),_0x127889,_0x21f366);_0x3a6e4c(_0x21f366);});});}exports[_0xd1a4('0x13')]=function(_0x2fee0f){var _0x2fdcd0=this;return new Promise(function(_0x120845,_0x93abf4){return db[_0xd1a4('0x14')][_0xd1a4('0x15')](_0x2fee0f['body'],{'raw':_0x2fee0f[_0xd1a4('0x16')]?_0x2fee0f['options'][_0xd1a4('0x17')]===undefined?!![]:![]:!![]})[_0xd1a4('0x9')](function(_0x56249d){logger[_0xd1a4('0x18')](_0xd1a4('0x13'),_0x2fee0f);logger[_0xd1a4('0xc')](_0xd1a4('0x13'),_0x2fee0f,JSON[_0xd1a4('0xe')](_0x56249d));_0x120845(_0x56249d);})[_0xd1a4('0x12')](function(_0x1f571b){logger[_0xd1a4('0xf')](_0xd1a4('0x13'),_0x1f571b[_0xd1a4('0x11')],_0x2fee0f);_0x93abf4(_0x2fdcd0[_0xd1a4('0xf')](0x1f4,_0x1f571b['message']));});});};exports[_0xd1a4('0x19')]=function(_0x4e04ca){var _0x29de89=this;return new Promise(function(_0x5d0f71,_0x47c346){return db[_0xd1a4('0x14')][_0xd1a4('0x1a')](_0x4e04ca[_0xd1a4('0x1b')],{'raw':_0x4e04ca[_0xd1a4('0x16')]?_0x4e04ca[_0xd1a4('0x16')][_0xd1a4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e04ca['options']?_0x4e04ca[_0xd1a4('0x16')][_0xd1a4('0x1c')]||null:null,'attributes':_0x4e04ca[_0xd1a4('0x16')]?_0x4e04ca[_0xd1a4('0x16')][_0xd1a4('0x1d')]||null:null,'limit':_0x4e04ca[_0xd1a4('0x16')]?_0x4e04ca[_0xd1a4('0x16')]['limit']||null:null})[_0xd1a4('0x9')](function(_0x250e99){logger[_0xd1a4('0x18')](_0xd1a4('0x19'),_0x4e04ca);logger[_0xd1a4('0xc')](_0xd1a4('0x19'),_0x4e04ca,JSON[_0xd1a4('0xe')](_0x250e99));_0x5d0f71(_0x250e99);})['catch'](function(_0x2a3a27){logger[_0xd1a4('0xf')](_0xd1a4('0x19'),_0x2a3a27['message'],_0x4e04ca);_0x47c346(_0x29de89[_0xd1a4('0xf')](0x1f4,_0x2a3a27[_0xd1a4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c4662d4..9d2505c 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 _0x4006=['path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4006,0x1c7));var _0x6400=function(_0x34485c,_0x39cc2a){_0x34485c=_0x34485c-0x0;var _0x23e8d9=_0x4006[_0x34485c];return _0x23e8d9;};'use strict';var multer=require('multer');var util=require(_0x6400('0x0'));var path=require(_0x6400('0x1'));var timeout=require(_0x6400('0x2'));var express=require(_0x6400('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6400('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6400('0x5'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x6400('0x6')](),controller['index']);router[_0x6400('0x7')](_0x6400('0x8'),auth[_0x6400('0x6')](),controller[_0x6400('0x9')]);router['get'](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xb')]);router[_0x6400('0xc')]('/',auth[_0x6400('0x6')](),controller[_0x6400('0xd')]);router[_0x6400('0xe')](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xf')]);router[_0x6400('0x10')]('/:id',auth[_0x6400('0x6')](),controller[_0x6400('0x11')]);module[_0x6400('0x12')]=router; \ No newline at end of file +var _0x8c46=['destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0x8c46,0x171));var _0x68c4=function(_0x43d42c,_0x463065){_0x43d42c=_0x43d42c-0x0;var _0x30bee9=_0x8c46[_0x43d42c];return _0x30bee9;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x68c4('0x2'));var auth=require(_0x68c4('0x3'));var interaction=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var controller=require(_0x68c4('0x6'));router[_0x68c4('0x7')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x9')]);router[_0x68c4('0x7')](_0x68c4('0xa'),auth['isAuthenticated'](),controller[_0x68c4('0xb')]);router[_0x68c4('0x7')](_0x68c4('0xc'),auth['isAuthenticated'](),controller[_0x68c4('0xd')]);router[_0x68c4('0xe')]('/',auth[_0x68c4('0x8')](),controller['create']);router['put'](_0x68c4('0xc'),auth[_0x68c4('0x8')](),controller['update']);router['delete'](_0x68c4('0xc'),auth[_0x68c4('0x8')](),controller[_0x68c4('0xf')]);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 8f993c1..ee0cb6f 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(_0x34756e,_0x3c036a){var _0x365e63=function(_0xc96601){while(--_0xc96601){_0x34756e['push'](_0x34756e['shift']());}};_0x365e63(++_0x3c036a);}(_0x34e8,0x12c));var _0x834e=function(_0xb127e2,_0x2d2fc9){_0xb127e2=_0xb127e2-0x0;var _0x32a3f2=_0x34e8[_0xb127e2];return _0x32a3f2;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x178945,_0x564e34){var _0x3f146b=function(_0x1e017f){while(--_0x1e017f){_0x178945['push'](_0x178945['shift']());}};_0x3f146b(++_0x564e34);}(_0x70e0,0x17b));var _0x070e=function(_0x129162,_0x4b27eb){_0x129162=_0x129162-0x0;var _0x3feeb3=_0x70e0[_0x129162];return _0x3feeb3;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f88d452..9fd9f39 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 _0xa51e=['fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','SmsTransferReport','rawAttributes'];(function(_0x3091c1,_0x44233c){var _0x27a97d=function(_0x519263){while(--_0x519263){_0x3091c1['push'](_0x3091c1['shift']());}};_0x27a97d(++_0x44233c);}(_0xa51e,0x65));var _0xea51=function(_0xe67d1c,_0x1b21d1){_0xe67d1c=_0xe67d1c-0x0;var _0x11673c=_0xa51e[_0xe67d1c];return _0x11673c;};'use strict';var emlformat=require(_0xea51('0x0'));var rimraf=require(_0xea51('0x1'));var zipdir=require(_0xea51('0x2'));var jsonpatch=require(_0xea51('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xea51('0x4'));var Mustache=require('mustache');var util=require(_0xea51('0x5'));var path=require('path');var sox=require(_0xea51('0x6'));var csv=require('to-csv');var ejs=require(_0xea51('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xea51('0x8'));var crypto=require(_0xea51('0x9'));var jsforce=require(_0xea51('0xa'));var deskjs=require(_0xea51('0xb'));var toCsv=require(_0xea51('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xea51('0xd'));var authService=require(_0xea51('0xe'));var qs=require(_0xea51('0xf'));var as=require(_0xea51('0x10'));var hardwareService=require(_0xea51('0x11'));var logger=require(_0xea51('0x12'))(_0xea51('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea51('0x14'))['db'];function respondWithStatusCode(_0x634c2c,_0x2ea0a8){_0x2ea0a8=_0x2ea0a8||0xcc;return function(_0xa9fee2){if(_0xa9fee2){return _0x634c2c[_0xea51('0x15')](_0x2ea0a8);}return _0x634c2c[_0xea51('0x16')](_0x2ea0a8)['end']();};}function respondWithResult(_0x15a994,_0x161bb4){_0x161bb4=_0x161bb4||0xc8;return function(_0x3cd6de){if(_0x3cd6de){return _0x15a994['status'](_0x161bb4)[_0xea51('0x17')](_0x3cd6de);}};}function respondWithFilteredResult(_0x2838e5,_0x11cd2f){return function(_0x484e8c){if(_0x484e8c){var _0x32b74a=typeof _0x11cd2f[_0xea51('0x18')]===_0xea51('0x19')&&typeof _0x11cd2f[_0xea51('0x1a')]===_0xea51('0x19');var _0x2c3cab=_0x484e8c[_0xea51('0x1b')];var _0x7103d9=_0x32b74a?0x0:_0x11cd2f[_0xea51('0x18')];var _0x190dd4=_0x32b74a?_0x484e8c[_0xea51('0x1b')]:_0x11cd2f[_0xea51('0x18')]+_0x11cd2f[_0xea51('0x1a')];var _0x48b2cb;if(_0x190dd4>=_0x2c3cab){_0x190dd4=_0x2c3cab;_0x48b2cb=0xc8;}else{_0x48b2cb=0xce;}_0x2838e5['status'](_0x48b2cb);return _0x2838e5[_0xea51('0x1c')](_0xea51('0x1d'),_0x7103d9+'-'+_0x190dd4+'/'+_0x2c3cab)[_0xea51('0x17')](_0x484e8c);}return null;};}function patchUpdates(_0x4e2a49){return function(_0x4bae93){try{jsonpatch[_0xea51('0x1e')](_0x4bae93,_0x4e2a49,!![]);}catch(_0x1ebb0b){return BPromise[_0xea51('0x1f')](_0x1ebb0b);}return _0x4bae93['save']();};}function saveUpdates(_0x3771bd,_0xa0ede7){return function(_0x2062e6){if(_0x2062e6){return _0x2062e6[_0xea51('0x20')](_0x3771bd)[_0xea51('0x21')](function(_0x35c6ef){return _0x35c6ef;});}return null;};}function removeEntity(_0x56da30,_0xfa3195){return function(_0x2e763a){if(_0x2e763a){return _0x2e763a[_0xea51('0x22')]()[_0xea51('0x21')](function(){_0x56da30[_0xea51('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x131253,_0x104d7e){return function(_0x2ec2d4){if(!_0x2ec2d4){_0x131253['sendStatus'](0x194);}return _0x2ec2d4;};}function handleError(_0x11bb72,_0x4cf9a6){_0x4cf9a6=_0x4cf9a6||0x1f4;return function(_0x37570e){logger[_0xea51('0x23')](_0x37570e['stack']);if(_0x37570e[_0xea51('0x24')]){delete _0x37570e[_0xea51('0x24')];}_0x11bb72[_0xea51('0x16')](_0x4cf9a6)[_0xea51('0x25')](_0x37570e);};}exports[_0xea51('0x26')]=function(_0x269f4b,_0x2f70c2){var _0x41ed02={},_0x23cd77={},_0x4e4a28={'count':0x0,'rows':[]};var _0x3998d2=_['map'](db[_0xea51('0x27')][_0xea51('0x28')],function(_0x465049){return{'name':_0x465049[_0xea51('0x29')],'type':_0x465049[_0xea51('0x2a')][_0xea51('0x2b')]};});_0x23cd77[_0xea51('0x2c')]=_[_0xea51('0x2d')](_0x3998d2,_0xea51('0x24'));_0x23cd77[_0xea51('0x2e')]=_['keys'](_0x269f4b[_0xea51('0x2e')]);_0x23cd77['filters']=_['intersection'](_0x23cd77[_0xea51('0x2c')],_0x23cd77[_0xea51('0x2e')]);_0x41ed02[_0xea51('0x2f')]=_[_0xea51('0x30')](_0x23cd77[_0xea51('0x2c')],qs['fields'](_0x269f4b[_0xea51('0x2e')][_0xea51('0x31')]));_0x41ed02['attributes']=_0x41ed02[_0xea51('0x2f')][_0xea51('0x32')]?_0x41ed02[_0xea51('0x2f')]:_0x23cd77['model'];if(!_0x269f4b[_0xea51('0x2e')][_0xea51('0x33')]('nolimit')){_0x41ed02[_0xea51('0x1a')]=qs[_0xea51('0x1a')](_0x269f4b[_0xea51('0x2e')][_0xea51('0x1a')]);_0x41ed02[_0xea51('0x18')]=qs[_0xea51('0x18')](_0x269f4b['query'][_0xea51('0x18')]);}_0x41ed02['order']=qs[_0xea51('0x34')](_0x269f4b[_0xea51('0x2e')][_0xea51('0x34')]);_0x41ed02[_0xea51('0x35')]=qs[_0xea51('0x36')](_[_0xea51('0x37')](_0x269f4b[_0xea51('0x2e')],_0x23cd77[_0xea51('0x36')]),_0x3998d2);if(_0x269f4b[_0xea51('0x2e')][_0xea51('0x38')]){_0x41ed02['where']=_[_0xea51('0x39')](_0x41ed02[_0xea51('0x35')],{'$or':_[_0xea51('0x2d')](_0x3998d2,function(_0xa125e5){if(_0xa125e5[_0xea51('0x2a')]!==_0xea51('0x3a')){var _0x4f8a06={};_0x4f8a06[_0xa125e5[_0xea51('0x24')]]={'$like':'%'+_0x269f4b[_0xea51('0x2e')][_0xea51('0x38')]+'%'};return _0x4f8a06;}})});}_0x41ed02=_['merge']({},_0x41ed02,_0x269f4b[_0xea51('0x3b')]);var _0x50fcbf={'where':_0x41ed02['where']};return db[_0xea51('0x27')][_0xea51('0x1b')](_0x50fcbf)['then'](function(_0x55709c){_0x4e4a28[_0xea51('0x1b')]=_0x55709c;if(_0x269f4b['query']['includeAll']){_0x41ed02[_0xea51('0x3c')]=[{'all':!![]}];}return db[_0xea51('0x27')][_0xea51('0x3d')](_0x41ed02);})[_0xea51('0x21')](function(_0x22da2a){_0x4e4a28['rows']=_0x22da2a;return _0x4e4a28;})[_0xea51('0x21')](respondWithFilteredResult(_0x2f70c2,_0x41ed02))[_0xea51('0x3e')](handleError(_0x2f70c2,null));};exports[_0xea51('0x3f')]=function(_0x31bae5,_0x17964f){var _0x445162={'raw':!![],'where':{'id':_0x31bae5[_0xea51('0x40')]['id']}},_0x14528b={};_0x14528b[_0xea51('0x2c')]=_[_0xea51('0x41')](db[_0xea51('0x27')][_0xea51('0x28')]);_0x14528b['query']=_[_0xea51('0x41')](_0x31bae5[_0xea51('0x2e')]);_0x14528b['filters']=_[_0xea51('0x30')](_0x14528b['model'],_0x14528b[_0xea51('0x2e')]);_0x445162['attributes']=_['intersection'](_0x14528b[_0xea51('0x2c')],qs[_0xea51('0x31')](_0x31bae5[_0xea51('0x2e')][_0xea51('0x31')]));_0x445162['attributes']=_0x445162[_0xea51('0x2f')][_0xea51('0x32')]?_0x445162['attributes']:_0x14528b[_0xea51('0x2c')];if(_0x31bae5[_0xea51('0x2e')][_0xea51('0x42')]){_0x445162[_0xea51('0x3c')]=[{'all':!![]}];}_0x445162=_['merge']({},_0x445162,_0x31bae5[_0xea51('0x3b')]);return db[_0xea51('0x27')]['find'](_0x445162)[_0xea51('0x21')](handleEntityNotFound(_0x17964f,null))['then'](respondWithResult(_0x17964f,null))[_0xea51('0x3e')](handleError(_0x17964f,null));};exports['create']=function(_0x58cef4,_0x6407c2){return db[_0xea51('0x27')][_0xea51('0x43')](_0x58cef4[_0xea51('0x44')],{})[_0xea51('0x21')](respondWithResult(_0x6407c2,0xc9))[_0xea51('0x3e')](handleError(_0x6407c2,null));};exports[_0xea51('0x20')]=function(_0x4a9e16,_0x48c7d5){if(_0x4a9e16[_0xea51('0x44')]['id']){delete _0x4a9e16[_0xea51('0x44')]['id'];}return db[_0xea51('0x27')][_0xea51('0x45')]({'where':{'id':_0x4a9e16[_0xea51('0x40')]['id']}})[_0xea51('0x21')](handleEntityNotFound(_0x48c7d5,null))[_0xea51('0x21')](saveUpdates(_0x4a9e16[_0xea51('0x44')],null))[_0xea51('0x21')](respondWithResult(_0x48c7d5,null))[_0xea51('0x3e')](handleError(_0x48c7d5,null));};exports[_0xea51('0x22')]=function(_0x4bec5f,_0x281c0d){return db[_0xea51('0x27')][_0xea51('0x45')]({'where':{'id':_0x4bec5f[_0xea51('0x40')]['id']}})['then'](handleEntityNotFound(_0x281c0d,null))[_0xea51('0x21')](removeEntity(_0x281c0d,null))['catch'](handleError(_0x281c0d,null));};exports[_0xea51('0x46')]=function(_0x220a36,_0x231e0f){return db[_0xea51('0x27')][_0xea51('0x46')]()[_0xea51('0x21')](respondWithResult(_0x231e0f,null))[_0xea51('0x3e')](handleError(_0x231e0f,null));}; \ No newline at end of file +var _0x5789=['findAll','catch','params','keys','rawAttributes','fields','options','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','name','index','map','SmsTransferReport','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include'];(function(_0x14c912,_0xa61c59){var _0x394016=function(_0x59fda0){while(--_0x59fda0){_0x14c912['push'](_0x14c912['shift']());}};_0x394016(++_0xa61c59);}(_0x5789,0x178));var _0x9578=function(_0x573554,_0xdec67a){_0x573554=_0x573554-0x0;var _0x4b46d1=_0x5789[_0x573554];return _0x4b46d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9578('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9578('0x1'));var rp=require(_0x9578('0x2'));var moment=require('moment');var BPromise=require(_0x9578('0x3'));var Mustache=require(_0x9578('0x4'));var util=require(_0x9578('0x5'));var path=require(_0x9578('0x6'));var sox=require('sox');var csv=require(_0x9578('0x7'));var ejs=require(_0x9578('0x8'));var fs=require('fs');var fs_extra=require(_0x9578('0x9'));var _=require(_0x9578('0xa'));var squel=require(_0x9578('0xb'));var crypto=require(_0x9578('0xc'));var jsforce=require(_0x9578('0xd'));var deskjs=require(_0x9578('0xe'));var toCsv=require(_0x9578('0x7'));var querystring=require(_0x9578('0xf'));var Papa=require('papaparse');var Redis=require(_0x9578('0x10'));var authService=require(_0x9578('0x11'));var qs=require(_0x9578('0x12'));var as=require(_0x9578('0x13'));var hardwareService=require(_0x9578('0x14'));var logger=require(_0x9578('0x15'))(_0x9578('0x16'));var utils=require(_0x9578('0x17'));var config=require(_0x9578('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9578('0x19'))['db'];function respondWithStatusCode(_0x4cd5b7,_0x69f405){_0x69f405=_0x69f405||0xcc;return function(_0x27a9f0){if(_0x27a9f0){return _0x4cd5b7[_0x9578('0x1a')](_0x69f405);}return _0x4cd5b7[_0x9578('0x1b')](_0x69f405)[_0x9578('0x1c')]();};}function respondWithResult(_0x4c359e,_0xf11e1){_0xf11e1=_0xf11e1||0xc8;return function(_0x268520){if(_0x268520){return _0x4c359e[_0x9578('0x1b')](_0xf11e1)[_0x9578('0x1d')](_0x268520);}};}function respondWithFilteredResult(_0x4c2ece,_0x53f5ec){return function(_0x2d0afb){if(_0x2d0afb){var _0x196c6e=typeof _0x53f5ec['offset']===_0x9578('0x1e')&&typeof _0x53f5ec[_0x9578('0x1f')]===_0x9578('0x1e');var _0x4d6c03=_0x2d0afb['count'];var _0x56025d=_0x196c6e?0x0:_0x53f5ec['offset'];var _0x1d923c=_0x196c6e?_0x2d0afb[_0x9578('0x20')]:_0x53f5ec[_0x9578('0x21')]+_0x53f5ec[_0x9578('0x1f')];var _0x38e375;if(_0x1d923c>=_0x4d6c03){_0x1d923c=_0x4d6c03;_0x38e375=0xc8;}else{_0x38e375=0xce;}_0x4c2ece['status'](_0x38e375);return _0x4c2ece[_0x9578('0x22')](_0x9578('0x23'),_0x56025d+'-'+_0x1d923c+'/'+_0x4d6c03)[_0x9578('0x1d')](_0x2d0afb);}return null;};}function patchUpdates(_0x5016ee){return function(_0x504e9d){try{jsonpatch[_0x9578('0x24')](_0x504e9d,_0x5016ee,!![]);}catch(_0xd1ebcc){return BPromise['reject'](_0xd1ebcc);}return _0x504e9d[_0x9578('0x25')]();};}function saveUpdates(_0x56f3aa,_0x2e9212){return function(_0x39a08e){if(_0x39a08e){return _0x39a08e[_0x9578('0x26')](_0x56f3aa)[_0x9578('0x27')](function(_0x2f7cd3){return _0x2f7cd3;});}return null;};}function removeEntity(_0x571555,_0x590803){return function(_0x2878cd){if(_0x2878cd){return _0x2878cd['destroy']()[_0x9578('0x27')](function(){_0x571555['status'](0xcc)[_0x9578('0x1c')]();});}};}function handleEntityNotFound(_0x5516ed,_0x2a2a91){return function(_0x4ed723){if(!_0x4ed723){_0x5516ed[_0x9578('0x1a')](0x194);}return _0x4ed723;};}function handleError(_0x4550f0,_0x3122f4){_0x3122f4=_0x3122f4||0x1f4;return function(_0x1c6004){logger['error'](_0x1c6004['stack']);if(_0x1c6004[_0x9578('0x28')]){delete _0x1c6004[_0x9578('0x28')];}_0x4550f0['status'](_0x3122f4)['send'](_0x1c6004);};}exports[_0x9578('0x29')]=function(_0x6e4af0,_0x535c8){var _0x10046f={},_0x5f2696={},_0x4bb53b={'count':0x0,'rows':[]};var _0x3ff1c7=_[_0x9578('0x2a')](db[_0x9578('0x2b')]['rawAttributes'],function(_0x5d80eb){return{'name':_0x5d80eb[_0x9578('0x2c')],'type':_0x5d80eb[_0x9578('0x2d')]['key']};});_0x5f2696[_0x9578('0x2e')]=_[_0x9578('0x2a')](_0x3ff1c7,_0x9578('0x28'));_0x5f2696[_0x9578('0x2f')]=_['keys'](_0x6e4af0[_0x9578('0x2f')]);_0x5f2696[_0x9578('0x30')]=_[_0x9578('0x31')](_0x5f2696[_0x9578('0x2e')],_0x5f2696[_0x9578('0x2f')]);_0x10046f['attributes']=_['intersection'](_0x5f2696[_0x9578('0x2e')],qs['fields'](_0x6e4af0[_0x9578('0x2f')]['fields']));_0x10046f[_0x9578('0x32')]=_0x10046f[_0x9578('0x32')][_0x9578('0x33')]?_0x10046f[_0x9578('0x32')]:_0x5f2696['model'];if(!_0x6e4af0[_0x9578('0x2f')][_0x9578('0x34')](_0x9578('0x35'))){_0x10046f[_0x9578('0x1f')]=qs[_0x9578('0x1f')](_0x6e4af0[_0x9578('0x2f')]['limit']);_0x10046f[_0x9578('0x21')]=qs[_0x9578('0x21')](_0x6e4af0[_0x9578('0x2f')]['offset']);}_0x10046f[_0x9578('0x36')]=qs[_0x9578('0x37')](_0x6e4af0[_0x9578('0x2f')][_0x9578('0x37')]);_0x10046f[_0x9578('0x38')]=qs[_0x9578('0x30')](_[_0x9578('0x39')](_0x6e4af0[_0x9578('0x2f')],_0x5f2696[_0x9578('0x30')]),_0x3ff1c7);if(_0x6e4af0[_0x9578('0x2f')][_0x9578('0x3a')]){_0x10046f['where']=_[_0x9578('0x3b')](_0x10046f[_0x9578('0x38')],{'$or':_[_0x9578('0x2a')](_0x3ff1c7,function(_0x3bc3fa){if(_0x3bc3fa[_0x9578('0x2d')]!=='VIRTUAL'){var _0x2badbf={};_0x2badbf[_0x3bc3fa[_0x9578('0x28')]]={'$like':'%'+_0x6e4af0[_0x9578('0x2f')][_0x9578('0x3a')]+'%'};return _0x2badbf;}})});}_0x10046f=_[_0x9578('0x3b')]({},_0x10046f,_0x6e4af0['options']);var _0x5bf3ad={'where':_0x10046f[_0x9578('0x38')]};return db[_0x9578('0x2b')][_0x9578('0x20')](_0x5bf3ad)['then'](function(_0x483ab6){_0x4bb53b[_0x9578('0x20')]=_0x483ab6;if(_0x6e4af0[_0x9578('0x2f')][_0x9578('0x3c')]){_0x10046f[_0x9578('0x3d')]=[{'all':!![]}];}return db[_0x9578('0x2b')][_0x9578('0x3e')](_0x10046f);})[_0x9578('0x27')](function(_0x3cb31e){_0x4bb53b['rows']=_0x3cb31e;return _0x4bb53b;})['then'](respondWithFilteredResult(_0x535c8,_0x10046f))[_0x9578('0x3f')](handleError(_0x535c8,null));};exports['show']=function(_0x2bf475,_0x518878){var _0x42e048={'raw':!![],'where':{'id':_0x2bf475[_0x9578('0x40')]['id']}},_0x13907d={};_0x13907d[_0x9578('0x2e')]=_[_0x9578('0x41')](db[_0x9578('0x2b')][_0x9578('0x42')]);_0x13907d[_0x9578('0x2f')]=_[_0x9578('0x41')](_0x2bf475[_0x9578('0x2f')]);_0x13907d[_0x9578('0x30')]=_[_0x9578('0x31')](_0x13907d['model'],_0x13907d[_0x9578('0x2f')]);_0x42e048['attributes']=_[_0x9578('0x31')](_0x13907d[_0x9578('0x2e')],qs[_0x9578('0x43')](_0x2bf475[_0x9578('0x2f')][_0x9578('0x43')]));_0x42e048[_0x9578('0x32')]=_0x42e048['attributes'][_0x9578('0x33')]?_0x42e048['attributes']:_0x13907d[_0x9578('0x2e')];if(_0x2bf475[_0x9578('0x2f')]['includeAll']){_0x42e048[_0x9578('0x3d')]=[{'all':!![]}];}_0x42e048=_[_0x9578('0x3b')]({},_0x42e048,_0x2bf475[_0x9578('0x44')]);return db[_0x9578('0x2b')]['find'](_0x42e048)[_0x9578('0x27')](handleEntityNotFound(_0x518878,null))[_0x9578('0x27')](respondWithResult(_0x518878,null))[_0x9578('0x3f')](handleError(_0x518878,null));};exports[_0x9578('0x45')]=function(_0x9933df,_0x38f97d){return db[_0x9578('0x2b')][_0x9578('0x45')](_0x9933df[_0x9578('0x46')],{})[_0x9578('0x27')](respondWithResult(_0x38f97d,0xc9))[_0x9578('0x3f')](handleError(_0x38f97d,null));};exports[_0x9578('0x26')]=function(_0x149456,_0x4da27d){if(_0x149456['body']['id']){delete _0x149456[_0x9578('0x46')]['id'];}return db['SmsTransferReport'][_0x9578('0x47')]({'where':{'id':_0x149456[_0x9578('0x40')]['id']}})[_0x9578('0x27')](handleEntityNotFound(_0x4da27d,null))['then'](saveUpdates(_0x149456[_0x9578('0x46')],null))[_0x9578('0x27')](respondWithResult(_0x4da27d,null))[_0x9578('0x3f')](handleError(_0x4da27d,null));};exports['destroy']=function(_0x5dd381,_0x43bed7){return db['SmsTransferReport'][_0x9578('0x47')]({'where':{'id':_0x5dd381[_0x9578('0x40')]['id']}})[_0x9578('0x27')](handleEntityNotFound(_0x43bed7,null))['then'](removeEntity(_0x43bed7,null))[_0x9578('0x3f')](handleError(_0x43bed7,null));};exports[_0x9578('0x48')]=function(_0xcdd7fc,_0x1ec364){return db[_0x9578('0x2b')][_0x9578('0x48')]()[_0x9578('0x27')](respondWithResult(_0x1ec364,null))[_0x9578('0x3f')](handleError(_0x1ec364,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index fe143c5..dcb70b4 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 _0xac51=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x3e7699,_0x47b8ad){var _0x3c7347=function(_0x1b6d18){while(--_0x1b6d18){_0x3e7699['push'](_0x3e7699['shift']());}};_0x3c7347(++_0x47b8ad);}(_0xac51,0x184));var _0x1ac5=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0xac51[_0x5be795];return _0x4e8a3b;};'use strict';var _=require(_0x1ac5('0x0'));var util=require(_0x1ac5('0x1'));var logger=require(_0x1ac5('0x2'))(_0x1ac5('0x3'));var moment=require(_0x1ac5('0x4'));var BPromise=require(_0x1ac5('0x5'));var rp=require(_0x1ac5('0x6'));var fs=require('fs');var path=require(_0x1ac5('0x7'));var rimraf=require(_0x1ac5('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ac5('0x9'));module['exports']=function(_0x5a1571,_0x3ff85d){return _0x5a1571['define'](_0x1ac5('0xa'),attributes,{'tableName':_0x1ac5('0xb'),'paranoid':![],'indexes':[{'name':_0x1ac5('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2f566c,_0x1a0115){_0x2f566c=_0x2f566c-0x0;var _0x924ef0=_0x8d0e[_0x2f566c];return _0x924ef0;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[{'name':_0xe8d0('0xd'),'fields':[_0xe8d0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e4ffa9c..e0377b4 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 _0xde64=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4ec59f,_0x4fa23){var _0x53c04e=function(_0x4d618f){while(--_0x4d618f){_0x4ec59f['push'](_0x4ec59f['shift']());}};_0x53c04e(++_0x4fa23);}(_0xde64,0x17c));var _0x4de6=function(_0x23c2f7,_0x5d9c34){_0x23c2f7=_0x23c2f7-0x0;var _0x39a2dc=_0xde64[_0x23c2f7];return _0x39a2dc;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var moment=require(_0x4de6('0x2'));var BPromise=require(_0x4de6('0x3'));var rs=require(_0x4de6('0x4'));var fs=require('fs');var Redis=require(_0x4de6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4de6('0x6'));var logger=require(_0x4de6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4de6('0x8'));var client=jayson[_0x4de6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568496,_0x24edef,_0x35ae72){return new BPromise(function(_0x475fb9,_0x248e39){return client[_0x4de6('0xa')](_0x568496,_0x35ae72)[_0x4de6('0xb')](function(_0x48a974){logger[_0x4de6('0xc')](_0x4de6('0xd'),_0x24edef,_0x4de6('0xe'));logger['debug'](_0x4de6('0xf'),_0x24edef,_0x4de6('0xe'),JSON[_0x4de6('0x10')](_0x48a974));if(_0x48a974[_0x4de6('0x11')]){if(_0x48a974[_0x4de6('0x11')]['code']===0x1f4){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974[_0x4de6('0x11')]['message']);return _0x248e39(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974['error'][_0x4de6('0x12')]);return _0x475fb9(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}else{logger['info'](_0x4de6('0xd'),_0x24edef,'request\x20sent');_0x475fb9(_0x48a974['result'][_0x4de6('0x12')]);}})[_0x4de6('0x13')](function(_0x6dbcf3){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x6dbcf3);_0x248e39(_0x6dbcf3);});});} \ No newline at end of file +var _0x394e=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x53ee37,_0x594d2b){var _0x4261b3=function(_0x33bd9c){while(--_0x33bd9c){_0x53ee37['push'](_0x53ee37['shift']());}};_0x4261b3(++_0x594d2b);}(_0x394e,0x88));var _0xe394=function(_0xe7c3f1,_0x12326f){_0xe7c3f1=_0xe7c3f1-0x0;var _0x1a0934=_0x394e[_0xe7c3f1];return _0x1a0934;};'use strict';var _=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var moment=require('moment');var BPromise=require(_0xe394('0x2'));var rs=require(_0xe394('0x3'));var fs=require('fs');var Redis=require(_0xe394('0x4'));var db=require(_0xe394('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe394('0x6'))(_0xe394('0x7'));var config=require(_0xe394('0x8'));var jayson=require(_0xe394('0x9'));var client=jayson[_0xe394('0xa')][_0xe394('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337bff,_0x169910,_0xad826e){return new BPromise(function(_0x267d68,_0x1220a2){return client['request'](_0x337bff,_0xad826e)['then'](function(_0x5962d2){logger[_0xe394('0xc')](_0xe394('0xd'),_0x169910,_0xe394('0xe'));logger[_0xe394('0xf')](_0xe394('0x10'),_0x169910,_0xe394('0xe'),JSON[_0xe394('0x11')](_0x5962d2));if(_0x5962d2[_0xe394('0x12')]){if(_0x5962d2[_0xe394('0x12')][_0xe394('0x13')]===0x1f4){logger[_0xe394('0x12')](_0xe394('0xd'),_0x169910,_0x5962d2['error']['message']);return _0x1220a2(_0x5962d2['error'][_0xe394('0x14')]);}logger[_0xe394('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x169910,_0x5962d2[_0xe394('0x12')][_0xe394('0x14')]);return _0x267d68(_0x5962d2[_0xe394('0x12')][_0xe394('0x14')]);}else{logger[_0xe394('0xc')](_0xe394('0xd'),_0x169910,'request\x20sent');_0x267d68(_0x5962d2['result'][_0xe394('0x14')]);}})[_0xe394('0x15')](function(_0x3f11e7){logger[_0xe394('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x169910,_0x3f11e7);_0x1220a2(_0x3f11e7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 1b97ade..a4946c0 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 _0xabe4=['path','connect-timeout','fs-extra','./sound.controller','isAuthenticated','get','show','/:id/download','download','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','now','single','file','put','/:id','delete','exports','multer','util'];(function(_0x210a3a,_0x1f5265){var _0x328725=function(_0x21de5f){while(--_0x21de5f){_0x210a3a['push'](_0x210a3a['shift']());}};_0x328725(++_0x1f5265);}(_0xabe4,0x136));var _0x4abe=function(_0x3e36b6,_0x43de3b){_0x3e36b6=_0x3e36b6-0x0;var _0x4a3a36=_0xabe4[_0x3e36b6];return _0x4a3a36;};'use strict';var multer=require(_0x4abe('0x0'));var util=require(_0x4abe('0x1'));var path=require(_0x4abe('0x2'));var timeout=require(_0x4abe('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4abe('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4abe('0x5'));router['get']('/',auth[_0x4abe('0x6')](),controller['index']);router[_0x4abe('0x7')]('/:id',auth[_0x4abe('0x6')](),controller[_0x4abe('0x8')]);router[_0x4abe('0x7')](_0x4abe('0x9'),auth[_0x4abe('0x6')](),controller[_0x4abe('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f0efd,_0x1f7bf6,_0x5b62c4){_0x5b62c4(null,path[_0x4abe('0xb')](config['root'],_0x4abe('0xc')));},'filename':function(_0x143156,_0x3d376b,_0xb3d3b5){_0x3d376b[_0x4abe('0xd')]=_0x3d376b[_0x4abe('0xd')][_0x4abe('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb3d3b5(null,util[_0x4abe('0xf')](_0x4abe('0x10'),path['basename'](_0x3d376b['originalname'],path['extname'](_0x3d376b[_0x4abe('0xd')])),Date[_0x4abe('0x11')](),path['extname'](_0x3d376b[_0x4abe('0xd')])));}})});router['post']('/',upload[_0x4abe('0x12')](_0x4abe('0x13')),controller['create']);router[_0x4abe('0x14')](_0x4abe('0x15'),auth[_0x4abe('0x6')](),controller['update']);router[_0x4abe('0x16')](_0x4abe('0x15'),auth[_0x4abe('0x6')](),controller[_0x4abe('0x16')]);module[_0x4abe('0x17')]=router; \ No newline at end of file +var _0x76d3=['replace','format','%s-%s%s','basename','extname','now','post','single','file','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','index','/:id','show','/:id/download','isAuthenticated','diskStorage','join','root','originalname'];(function(_0x5a6260,_0x2332fe){var _0x571d3c=function(_0x56cbee){while(--_0x56cbee){_0x5a6260['push'](_0x5a6260['shift']());}};_0x571d3c(++_0x2332fe);}(_0x76d3,0x12d));var _0x376d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x76d3[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require(_0x376d('0x0'));var path=require(_0x376d('0x1'));var timeout=require(_0x376d('0x2'));var express=require(_0x376d('0x3'));var router=express[_0x376d('0x4')]();var fs_extra=require(_0x376d('0x5'));var auth=require(_0x376d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x376d('0x7'));var controller=require(_0x376d('0x8'));router[_0x376d('0x9')]('/',auth['isAuthenticated'](),controller[_0x376d('0xa')]);router[_0x376d('0x9')](_0x376d('0xb'),auth['isAuthenticated'](),controller[_0x376d('0xc')]);router[_0x376d('0x9')](_0x376d('0xd'),auth[_0x376d('0xe')](),controller['download']);var upload=multer({'storage':multer[_0x376d('0xf')]({'destination':function(_0x307cdb,_0x1aa458,_0x544c54){_0x544c54(null,path[_0x376d('0x10')](config[_0x376d('0x11')],'server/files/sounds/original/'));},'filename':function(_0x143f5d,_0x1ea0bd,_0x3967b1){_0x1ea0bd[_0x376d('0x12')]=_0x1ea0bd[_0x376d('0x12')][_0x376d('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3967b1(null,util[_0x376d('0x14')](_0x376d('0x15'),path[_0x376d('0x16')](_0x1ea0bd[_0x376d('0x12')],path[_0x376d('0x17')](_0x1ea0bd[_0x376d('0x12')])),Date[_0x376d('0x18')](),path[_0x376d('0x17')](_0x1ea0bd[_0x376d('0x12')])));}})});router[_0x376d('0x19')]('/',upload[_0x376d('0x1a')](_0x376d('0x1b')),controller['create']);router[_0x376d('0x1c')](_0x376d('0xb'),auth[_0x376d('0xe')](),controller[_0x376d('0x1d')]);router[_0x376d('0x1e')](_0x376d('0xb'),auth['isAuthenticated'](),controller[_0x376d('0x1e')]);module[_0x376d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 7180352..b692494 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 _0x1680=['exports','STRING','name','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1680,0x84));var _0x0168=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x1680[_0x220afa];return _0x1b79d1;};'use strict';var Sequelize=require(_0x0168('0x0'));module[_0x0168('0x1')]={'name':{'type':Sequelize[_0x0168('0x2')],'unique':_0x0168('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0168('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x0168('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x0168('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x0168('0x5')]},'original_bitRate':{'type':Sequelize[_0x0168('0x6')]},'original_sampleRate':{'type':Sequelize[_0x0168('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x0168('0x5')]},'converted_bitRate':{'type':Sequelize[_0x0168('0x6')]},'converted_sampleRate':{'type':Sequelize[_0x0168('0x5')]}}; \ No newline at end of file +var _0xb3e4=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xb3e4,0x172));var _0x4b3e=function(_0x2865fc,_0x31943d){_0x2865fc=_0x2865fc-0x0;var _0x201389=_0xb3e4[_0x2865fc];return _0x201389;};'use strict';var Sequelize=require(_0x4b3e('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b3e('0x1')],'unique':_0x4b3e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4b3e('0x1')]},'display_name':{'type':Sequelize[_0x4b3e('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x4b3e('0x1')]},'original_duration':{'type':Sequelize[_0x4b3e('0x3')]},'original_sampleCount':{'type':Sequelize[_0x4b3e('0x4')]},'original_channelCount':{'type':Sequelize[_0x4b3e('0x5')]},'original_bitRate':{'type':Sequelize[_0x4b3e('0x4')]},'original_sampleRate':{'type':Sequelize[_0x4b3e('0x5')]},'converted_format':{'type':Sequelize[_0x4b3e('0x1')]},'converted_duration':{'type':Sequelize[_0x4b3e('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x4b3e('0x4')]},'converted_channelCount':{'type':Sequelize[_0x4b3e('0x5')]},'converted_bitRate':{'type':Sequelize[_0x4b3e('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x4b3e('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index aa9d775..5898eed 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 _0x7a0b=['converted_sampleRate','body','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Sounds','UserProfileResource','destroy','status','end','error','stack','name','send','map','Sound','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate'];(function(_0x2b2751,_0x6635f){var _0x500fd0=function(_0x2487b5){while(--_0x2487b5){_0x2b2751['push'](_0x2b2751['shift']());}};_0x500fd0(++_0x6635f);}(_0x7a0b,0xfd));var _0xb7a0=function(_0x4f2b87,_0xe0661d){_0x4f2b87=_0x4f2b87-0x0;var _0xee4001=_0x7a0b[_0x4f2b87];return _0xee4001;};'use strict';var emlformat=require(_0xb7a0('0x0'));var rimraf=require(_0xb7a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7a0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb7a0('0x3'));var util=require(_0xb7a0('0x4'));var path=require(_0xb7a0('0x5'));var sox=require('sox');var csv=require(_0xb7a0('0x6'));var ejs=require(_0xb7a0('0x7'));var fs=require('fs');var fs_extra=require(_0xb7a0('0x8'));var _=require('lodash');var squel=require(_0xb7a0('0x9'));var crypto=require('crypto');var jsforce=require(_0xb7a0('0xa'));var deskjs=require(_0xb7a0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7a0('0xc'));var Redis=require(_0xb7a0('0xd'));var authService=require(_0xb7a0('0xe'));var qs=require(_0xb7a0('0xf'));var as=require(_0xb7a0('0x10'));var hardwareService=require(_0xb7a0('0x11'));var logger=require(_0xb7a0('0x12'))('api');var utils=require(_0xb7a0('0x13'));var config=require(_0xb7a0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x380101,_0x579294){_0x579294=_0x579294||0xcc;return function(_0x548f9c){if(_0x548f9c){return _0x380101[_0xb7a0('0x15')](_0x579294);}return _0x380101['status'](_0x579294)['end']();};}function respondWithResult(_0x340fa9,_0x12cfd0){_0x12cfd0=_0x12cfd0||0xc8;return function(_0x4bfa93){if(_0x4bfa93){return _0x340fa9['status'](_0x12cfd0)[_0xb7a0('0x16')](_0x4bfa93);}};}function respondWithFilteredResult(_0x5d2eae,_0x3dbf3e){return function(_0x49fa18){if(_0x49fa18){var _0x28827e=typeof _0x3dbf3e[_0xb7a0('0x17')]===_0xb7a0('0x18')&&typeof _0x3dbf3e[_0xb7a0('0x19')]===_0xb7a0('0x18');var _0x54317f=_0x49fa18['count'];var _0x28fba7=_0x28827e?0x0:_0x3dbf3e['offset'];var _0x11938e=_0x28827e?_0x49fa18[_0xb7a0('0x1a')]:_0x3dbf3e[_0xb7a0('0x17')]+_0x3dbf3e[_0xb7a0('0x19')];var _0x4a800d;if(_0x11938e>=_0x54317f){_0x11938e=_0x54317f;_0x4a800d=0xc8;}else{_0x4a800d=0xce;}_0x5d2eae['status'](_0x4a800d);return _0x5d2eae[_0xb7a0('0x1b')](_0xb7a0('0x1c'),_0x28fba7+'-'+_0x11938e+'/'+_0x54317f)[_0xb7a0('0x16')](_0x49fa18);}return null;};}function patchUpdates(_0x5b06e0){return function(_0x320bb8){try{jsonpatch[_0xb7a0('0x1d')](_0x320bb8,_0x5b06e0,!![]);}catch(_0x29c592){return BPromise['reject'](_0x29c592);}return _0x320bb8['save']();};}function saveUpdates(_0x5b8b9d,_0x517120){return function(_0x39a422){if(_0x39a422){return _0x39a422['update'](_0x5b8b9d)[_0xb7a0('0x1e')](function(_0x20ccfe){return _0x20ccfe;});}return null;};}function removeEntity(_0x5ef33b,_0x1a2936){return function(_0x1c69cf){if(_0x1c69cf){return _0x1c69cf['destroy']()[_0xb7a0('0x1e')](function(){var _0x392ff1=_0x1c69cf[_0xb7a0('0x1f')]({'plain':!![]});var _0x41aad4=_0xb7a0('0x20');return db[_0xb7a0('0x21')][_0xb7a0('0x22')]({'where':{'type':_0x41aad4,'resourceId':_0x392ff1['id']}})[_0xb7a0('0x1e')](function(){return _0x1c69cf;});})[_0xb7a0('0x1e')](function(){_0x5ef33b[_0xb7a0('0x23')](0xcc)[_0xb7a0('0x24')]();});}};}function handleEntityNotFound(_0x3858e9,_0x3b1de8){return function(_0x5245c4){if(!_0x5245c4){_0x3858e9[_0xb7a0('0x15')](0x194);}return _0x5245c4;};}function handleError(_0x43df3d,_0x1a0350){_0x1a0350=_0x1a0350||0x1f4;return function(_0xfb8b2d){logger[_0xb7a0('0x25')](_0xfb8b2d[_0xb7a0('0x26')]);if(_0xfb8b2d[_0xb7a0('0x27')]){delete _0xfb8b2d[_0xb7a0('0x27')];}_0x43df3d[_0xb7a0('0x23')](_0x1a0350)[_0xb7a0('0x28')](_0xfb8b2d);};}exports['index']=function(_0x40a473,_0x33a14f){var _0x16e29a={},_0x70240={},_0x38ab9b={'count':0x0,'rows':[]};var _0x246664=_[_0xb7a0('0x29')](db[_0xb7a0('0x2a')][_0xb7a0('0x2b')],function(_0x354d97){return{'name':_0x354d97[_0xb7a0('0x2c')],'type':_0x354d97['type']['key']};});_0x70240['model']=_['map'](_0x246664,_0xb7a0('0x27'));_0x70240[_0xb7a0('0x2d')]=_[_0xb7a0('0x2e')](_0x40a473['query']);_0x70240[_0xb7a0('0x2f')]=_[_0xb7a0('0x30')](_0x70240[_0xb7a0('0x31')],_0x70240['query']);_0x16e29a[_0xb7a0('0x32')]=_[_0xb7a0('0x30')](_0x70240[_0xb7a0('0x31')],qs[_0xb7a0('0x33')](_0x40a473[_0xb7a0('0x2d')][_0xb7a0('0x33')]));_0x16e29a[_0xb7a0('0x32')]=_0x16e29a[_0xb7a0('0x32')]['length']?_0x16e29a['attributes']:_0x70240['model'];if(!_0x40a473[_0xb7a0('0x2d')][_0xb7a0('0x34')](_0xb7a0('0x35'))){_0x16e29a['limit']=qs['limit'](_0x40a473[_0xb7a0('0x2d')][_0xb7a0('0x19')]);_0x16e29a[_0xb7a0('0x17')]=qs[_0xb7a0('0x17')](_0x40a473[_0xb7a0('0x2d')][_0xb7a0('0x17')]);}_0x16e29a[_0xb7a0('0x36')]=qs[_0xb7a0('0x37')](_0x40a473[_0xb7a0('0x2d')][_0xb7a0('0x37')]);_0x16e29a['where']=qs['filters'](_[_0xb7a0('0x38')](_0x40a473[_0xb7a0('0x2d')],_0x70240['filters']),_0x246664);if(_0x40a473[_0xb7a0('0x2d')][_0xb7a0('0x39')]){_0x16e29a[_0xb7a0('0x3a')]=_[_0xb7a0('0x3b')](_0x16e29a[_0xb7a0('0x3a')],{'$or':_[_0xb7a0('0x29')](_0x246664,function(_0x2ecd16){if(_0x2ecd16[_0xb7a0('0x3c')]!==_0xb7a0('0x3d')){var _0x6f9e05={};_0x6f9e05[_0x2ecd16[_0xb7a0('0x27')]]={'$like':'%'+_0x40a473['query'][_0xb7a0('0x39')]+'%'};return _0x6f9e05;}})});}_0x16e29a=_[_0xb7a0('0x3b')]({},_0x16e29a,_0x40a473[_0xb7a0('0x3e')]);var _0x29a526={'where':_0x16e29a[_0xb7a0('0x3a')]};return db[_0xb7a0('0x2a')][_0xb7a0('0x1a')](_0x29a526)['then'](function(_0x47bf49){_0x38ab9b[_0xb7a0('0x1a')]=_0x47bf49;if(_0x40a473[_0xb7a0('0x2d')][_0xb7a0('0x3f')]){_0x16e29a[_0xb7a0('0x40')]=[{'all':!![]}];}return db[_0xb7a0('0x2a')][_0xb7a0('0x41')](_0x16e29a);})[_0xb7a0('0x1e')](function(_0x32915f){_0x38ab9b[_0xb7a0('0x42')]=_0x32915f;return _0x38ab9b;})[_0xb7a0('0x1e')](respondWithFilteredResult(_0x33a14f,_0x16e29a))[_0xb7a0('0x43')](handleError(_0x33a14f,null));};exports[_0xb7a0('0x44')]=function(_0x2dc70b,_0x270a0f){var _0x169d35={'raw':!![],'where':{'id':_0x2dc70b['params']['id']}},_0x44677b={};_0x44677b['model']=_['keys'](db[_0xb7a0('0x2a')]['rawAttributes']);_0x44677b[_0xb7a0('0x2d')]=_[_0xb7a0('0x2e')](_0x2dc70b[_0xb7a0('0x2d')]);_0x44677b[_0xb7a0('0x2f')]=_[_0xb7a0('0x30')](_0x44677b[_0xb7a0('0x31')],_0x44677b[_0xb7a0('0x2d')]);_0x169d35[_0xb7a0('0x32')]=_[_0xb7a0('0x30')](_0x44677b[_0xb7a0('0x31')],qs[_0xb7a0('0x33')](_0x2dc70b[_0xb7a0('0x2d')]['fields']));_0x169d35[_0xb7a0('0x32')]=_0x169d35[_0xb7a0('0x32')]['length']?_0x169d35[_0xb7a0('0x32')]:_0x44677b['model'];if(_0x2dc70b['query'][_0xb7a0('0x3f')]){_0x169d35['include']=[{'all':!![]}];}_0x169d35=_[_0xb7a0('0x3b')]({},_0x169d35,_0x2dc70b[_0xb7a0('0x3e')]);return db[_0xb7a0('0x2a')][_0xb7a0('0x45')](_0x169d35)[_0xb7a0('0x1e')](handleEntityNotFound(_0x270a0f,null))[_0xb7a0('0x1e')](respondWithResult(_0x270a0f,null))[_0xb7a0('0x43')](handleError(_0x270a0f,null));};exports[_0xb7a0('0x46')]=function(_0x4567ec,_0x3168ed,_0x445a4d){return db[_0xb7a0('0x2a')][_0xb7a0('0x45')]({'where':{'id':_0x4567ec[_0xb7a0('0x47')]['id']},'attributes':['name',_0xb7a0('0x48'),_0xb7a0('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x3168ed,null))[_0xb7a0('0x1e')](function(_0x4b88a4){if(_0x4b88a4){if(!fs[_0xb7a0('0x4a')](path[_0xb7a0('0x4b')](config[_0xb7a0('0x4c')],_0xb7a0('0x4d'),_0x4b88a4[_0xb7a0('0x48')]+'.'+_0x4b88a4[_0xb7a0('0x49')]))){throw new db[(_0xb7a0('0x4e'))][(_0xb7a0('0x4f'))](_0xb7a0('0x50'));}return _0x3168ed[_0xb7a0('0x46')](path[_0xb7a0('0x4b')](config['root'],_0xb7a0('0x4d'),util['format'](_0xb7a0('0x51'),_0x4b88a4[_0xb7a0('0x48')],_0x4b88a4['converted_format'])),util[_0xb7a0('0x52')](_0xb7a0('0x51'),_0x4b88a4[_0xb7a0('0x27')],_0x4b88a4['converted_format']));}return null;})[_0xb7a0('0x43')](handleError(_0x3168ed,null));};exports[_0xb7a0('0x53')]=function(_0xe4279f,_0x5add51,_0x568c6a){var _0x5a0307={'name':path[_0xb7a0('0x54')](_0xe4279f[_0xb7a0('0x55')][_0xb7a0('0x56')],path[_0xb7a0('0x57')](_0xe4279f[_0xb7a0('0x55')][_0xb7a0('0x56')])),'save_name':path['basename'](_0xe4279f['file']['filename'],path['extname'](_0xe4279f[_0xb7a0('0x55')][_0xb7a0('0x58')])),'original_format':path[_0xb7a0('0x57')](_0xe4279f['file'][_0xb7a0('0x56')])[_0xb7a0('0x59')](0x1),'converted_format':_0xb7a0('0x5a')};var _0x2205eb=path['join'](config[_0xb7a0('0x4c')],_0xb7a0('0x5b'),_0xe4279f[_0xb7a0('0x55')][_0xb7a0('0x58')]);var _0x2b0e2e=path[_0xb7a0('0x4b')](config[_0xb7a0('0x4c')],'server/files/sounds/converted',util[_0xb7a0('0x52')]('%s.%s',path[_0xb7a0('0x54')](_0xe4279f[_0xb7a0('0x55')][_0xb7a0('0x58')],path['extname'](_0xe4279f[_0xb7a0('0x55')][_0xb7a0('0x58')])),_0x5a0307['converted_format']));logger[_0xb7a0('0x5c')](_0xb7a0('0x5d'),_0x2205eb);logger[_0xb7a0('0x5c')](_0xb7a0('0x5e'),_0x2b0e2e);try{fs[_0xb7a0('0x5f')](_0x2205eb,parseInt(_0xb7a0('0x60'),0x8));var _0x5a2e07=sox[_0xb7a0('0x61')](_0x2205eb,_0x2b0e2e,{'sampleRate':0x1f40,'format':_0xb7a0('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5a2e07['on'](_0xb7a0('0x25'),function(_0x1088cd){fs[_0xb7a0('0x62')](_0x2205eb);_0x5add51[_0xb7a0('0x23')](0x1f4)[_0xb7a0('0x28')](_0x1088cd);});_0x5a2e07['on'](_0xb7a0('0x63'),function(_0x2c1cab){_0x5a0307[_0xb7a0('0x64')]=isNaN(_0x2c1cab[_0xb7a0('0x65')])?null:_0x2c1cab[_0xb7a0('0x65')]*0x3e8;_0x5a0307[_0xb7a0('0x66')]=isNaN(_0x2c1cab['sampleCount'])?null:_0x2c1cab[_0xb7a0('0x67')];_0x5a0307['original_channelCount']=isNaN(_0x2c1cab[_0xb7a0('0x68')])?null:_0x2c1cab[_0xb7a0('0x68')];_0x5a0307['original_bitRate']=isNaN(_0x2c1cab[_0xb7a0('0x69')])?null:_0x2c1cab[_0xb7a0('0x69')];_0x5a0307[_0xb7a0('0x6a')]=isNaN(_0x2c1cab[_0xb7a0('0x6b')])?null:_0x2c1cab[_0xb7a0('0x6b')];});_0x5a2e07['on'](_0xb7a0('0x6c'),function(_0x547426){_0x5a0307[_0xb7a0('0x6d')]=isNaN(_0x547426[_0xb7a0('0x65')])?null:_0x547426[_0xb7a0('0x65')]*0x3e8;_0x5a0307[_0xb7a0('0x6e')]=isNaN(_0x547426['sampleCount'])?null:_0x547426['sampleCount'];_0x5a0307[_0xb7a0('0x6f')]=isNaN(_0x547426[_0xb7a0('0x68')])?null:_0x547426[_0xb7a0('0x68')];_0x5a0307[_0xb7a0('0x70')]=isNaN(_0x547426[_0xb7a0('0x69')])?null:_0x547426['bitRate'];_0x5a0307[_0xb7a0('0x71')]=isNaN(_0x547426['sampleRate'])?null:_0x547426['sampleRate'];});_0x5a2e07['on'](_0xb7a0('0x24'),function(){fs[_0xb7a0('0x5f')](_0x2b0e2e,parseInt(_0xb7a0('0x60'),0x8));return db[_0xb7a0('0x2a')]['create'](_0x5a0307)['then'](function(_0x13d47e){var _0x5d1b6f={'role':_0xe4279f[_0xb7a0('0x72')][_0xb7a0('0x73')],'userProfileId':_0xe4279f[_0xb7a0('0x72')][_0xb7a0('0x74')]};if(!_0x5d1b6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d1b6f[_0xb7a0('0x73')]==='user'){var _0x4205c8=_0x13d47e[_0xb7a0('0x1f')]({'plain':!![]});return db['UserProfileSection'][_0xb7a0('0x45')]({'where':{'name':_0xb7a0('0x20'),'userProfileId':_0x5d1b6f[_0xb7a0('0x74')]},'raw':!![]})[_0xb7a0('0x1e')](function(_0x4ad19f){if(_0x4ad19f&&_0x4ad19f[_0xb7a0('0x75')]===0x0){return db[_0xb7a0('0x21')][_0xb7a0('0x53')]({'name':_0x4205c8[_0xb7a0('0x27')],'resourceId':_0x4205c8['id'],'type':_0x4ad19f[_0xb7a0('0x27')],'sectionId':_0x4ad19f['id']},{})[_0xb7a0('0x1e')](function(){return _0x13d47e;});}else{return _0x13d47e;}})[_0xb7a0('0x43')](function(_0x103a9b){logger[_0xb7a0('0x25')](_0xb7a0('0x76'),_0x103a9b);throw _0x103a9b;});}return _0x13d47e;})[_0xb7a0('0x1e')](respondWithResult(_0x5add51,null))[_0xb7a0('0x43')](handleError(_0x5add51,null));});_0x5a2e07[_0xb7a0('0x77')]();}catch(_0x55bcb1){_0x5add51[_0xb7a0('0x23')](0x1f4)['send'](_0x55bcb1);}};exports['update']=function(_0x2e79b2,_0x569144,_0x2e9755){return db[_0xb7a0('0x2a')][_0xb7a0('0x45')]({'where':{'id':_0x2e79b2[_0xb7a0('0x47')]['id']}})[_0xb7a0('0x1e')](handleEntityNotFound(_0x569144,null))['then'](saveUpdates(_[_0xb7a0('0x38')](_0x2e79b2['body'],[_0xb7a0('0x27'),_0xb7a0('0x78')]),null))[_0xb7a0('0x1e')](respondWithResult(_0x569144,null))[_0xb7a0('0x43')](handleError(_0x569144,null));};exports['delete']=function(_0xbd5c9,_0x5c8bc9,_0x100091){return db[_0xb7a0('0x2a')][_0xb7a0('0x45')]({'where':{'id':_0xbd5c9['params']['id']}})[_0xb7a0('0x1e')](function(_0x3ceb10){if(_0x3ceb10){return _0x3ceb10[_0xb7a0('0x22')]();}})[_0xb7a0('0x1e')](function(_0x193c06){var _0x272860=path[_0xb7a0('0x4b')](config[_0xb7a0('0x4c')],_0xb7a0('0x5b'),util[_0xb7a0('0x52')](_0xb7a0('0x51'),_0x193c06[_0xb7a0('0x48')],_0x193c06[_0xb7a0('0x79')]));var _0x8c7892=path['join'](config[_0xb7a0('0x4c')],_0xb7a0('0x4d'),util['format'](_0xb7a0('0x51'),_0x193c06[_0xb7a0('0x48')],_0x193c06[_0xb7a0('0x49')]));fs[_0xb7a0('0x62')](_0x272860);fs[_0xb7a0('0x62')](_0x8c7892);return _0x193c06;})[_0xb7a0('0x1e')](function(_0x2007d1){if(_0x2007d1){return _0x5c8bc9['status'](0xcc)[_0xb7a0('0x24')]();}})[_0xb7a0('0x1e')](handleEntityNotFound(_0x5c8bc9,null))['catch'](handleError(_0x5c8bc9,null));}; \ No newline at end of file +var _0xea8c=['root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','file','originalname','basename','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','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','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','reject','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','length','find','catch','download','save_name','converted_format','existsSync','join'];(function(_0xacb3e0,_0x3d4101){var _0x4dd731=function(_0x5ddd84){while(--_0x5ddd84){_0xacb3e0['push'](_0xacb3e0['shift']());}};_0x4dd731(++_0x3d4101);}(_0xea8c,0xac));var _0xcea8=function(_0x269ab8,_0x4b7a1d){_0x269ab8=_0x269ab8-0x0;var _0x314c30=_0xea8c[_0x269ab8];return _0x314c30;};'use strict';var emlformat=require(_0xcea8('0x0'));var rimraf=require(_0xcea8('0x1'));var zipdir=require(_0xcea8('0x2'));var jsonpatch=require(_0xcea8('0x3'));var rp=require('request-promise');var moment=require(_0xcea8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xcea8('0x5'));var sox=require('sox');var csv=require(_0xcea8('0x6'));var ejs=require(_0xcea8('0x7'));var fs=require('fs');var fs_extra=require(_0xcea8('0x8'));var _=require(_0xcea8('0x9'));var squel=require('squel');var crypto=require(_0xcea8('0xa'));var jsforce=require(_0xcea8('0xb'));var deskjs=require(_0xcea8('0xc'));var toCsv=require(_0xcea8('0x6'));var querystring=require(_0xcea8('0xd'));var Papa=require('papaparse');var Redis=require(_0xcea8('0xe'));var authService=require(_0xcea8('0xf'));var qs=require(_0xcea8('0x10'));var as=require(_0xcea8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcea8('0x12'))(_0xcea8('0x13'));var utils=require(_0xcea8('0x14'));var config=require(_0xcea8('0x15'));var licenseUtil=require(_0xcea8('0x16'));var db=require(_0xcea8('0x17'))['db'];function respondWithStatusCode(_0x412b30,_0x133db8){_0x133db8=_0x133db8||0xcc;return function(_0x44a7c1){if(_0x44a7c1){return _0x412b30[_0xcea8('0x18')](_0x133db8);}return _0x412b30[_0xcea8('0x19')](_0x133db8)['end']();};}function respondWithResult(_0x227534,_0x169c9f){_0x169c9f=_0x169c9f||0xc8;return function(_0x1891a4){if(_0x1891a4){return _0x227534[_0xcea8('0x19')](_0x169c9f)[_0xcea8('0x1a')](_0x1891a4);}};}function respondWithFilteredResult(_0x112d94,_0x346dc7){return function(_0x2ba9e9){if(_0x2ba9e9){var _0x19a60e=typeof _0x346dc7[_0xcea8('0x1b')]==='undefined'&&typeof _0x346dc7['limit']==='undefined';var _0x574642=_0x2ba9e9['count'];var _0x65bbba=_0x19a60e?0x0:_0x346dc7[_0xcea8('0x1b')];var _0x31ddda=_0x19a60e?_0x2ba9e9[_0xcea8('0x1c')]:_0x346dc7[_0xcea8('0x1b')]+_0x346dc7[_0xcea8('0x1d')];var _0x118869;if(_0x31ddda>=_0x574642){_0x31ddda=_0x574642;_0x118869=0xc8;}else{_0x118869=0xce;}_0x112d94[_0xcea8('0x19')](_0x118869);return _0x112d94[_0xcea8('0x1e')]('Content-Range',_0x65bbba+'-'+_0x31ddda+'/'+_0x574642)[_0xcea8('0x1a')](_0x2ba9e9);}return null;};}function patchUpdates(_0x2e129f){return function(_0x52406e){try{jsonpatch['apply'](_0x52406e,_0x2e129f,!![]);}catch(_0x41ea13){return BPromise[_0xcea8('0x1f')](_0x41ea13);}return _0x52406e['save']();};}function saveUpdates(_0x53f57c,_0x4f5031){return function(_0x539b91){if(_0x539b91){return _0x539b91['update'](_0x53f57c)[_0xcea8('0x20')](function(_0x3d7495){return _0x3d7495;});}return null;};}function removeEntity(_0x2975a3,_0x46c04f){return function(_0x39c32c){if(_0x39c32c){return _0x39c32c[_0xcea8('0x21')]()[_0xcea8('0x20')](function(){var _0x377272=_0x39c32c[_0xcea8('0x22')]({'plain':!![]});var _0x3716a3=_0xcea8('0x23');return db[_0xcea8('0x24')][_0xcea8('0x21')]({'where':{'type':_0x3716a3,'resourceId':_0x377272['id']}})['then'](function(){return _0x39c32c;});})[_0xcea8('0x20')](function(){_0x2975a3[_0xcea8('0x19')](0xcc)[_0xcea8('0x25')]();});}};}function handleEntityNotFound(_0x4d7d8e,_0x50684d){return function(_0x445e21){if(!_0x445e21){_0x4d7d8e[_0xcea8('0x18')](0x194);}return _0x445e21;};}function handleError(_0x3d96bc,_0x474219){_0x474219=_0x474219||0x1f4;return function(_0x53ff4f){logger[_0xcea8('0x26')](_0x53ff4f[_0xcea8('0x27')]);if(_0x53ff4f['name']){delete _0x53ff4f[_0xcea8('0x28')];}_0x3d96bc[_0xcea8('0x19')](_0x474219)[_0xcea8('0x29')](_0x53ff4f);};}exports['index']=function(_0x13b09e,_0xebcf4e){var _0x28a75c={},_0x182b93={},_0x114adb={'count':0x0,'rows':[]};var _0x2a3dfc=_[_0xcea8('0x2a')](db[_0xcea8('0x2b')][_0xcea8('0x2c')],function(_0x5326a6){return{'name':_0x5326a6[_0xcea8('0x2d')],'type':_0x5326a6[_0xcea8('0x2e')][_0xcea8('0x2f')]};});_0x182b93[_0xcea8('0x30')]=_[_0xcea8('0x2a')](_0x2a3dfc,_0xcea8('0x28'));_0x182b93[_0xcea8('0x31')]=_[_0xcea8('0x32')](_0x13b09e[_0xcea8('0x31')]);_0x182b93['filters']=_[_0xcea8('0x33')](_0x182b93[_0xcea8('0x30')],_0x182b93['query']);_0x28a75c['attributes']=_[_0xcea8('0x33')](_0x182b93['model'],qs[_0xcea8('0x34')](_0x13b09e['query']['fields']));_0x28a75c[_0xcea8('0x35')]=_0x28a75c[_0xcea8('0x35')]['length']?_0x28a75c[_0xcea8('0x35')]:_0x182b93[_0xcea8('0x30')];if(!_0x13b09e[_0xcea8('0x31')][_0xcea8('0x36')](_0xcea8('0x37'))){_0x28a75c['limit']=qs[_0xcea8('0x1d')](_0x13b09e[_0xcea8('0x31')][_0xcea8('0x1d')]);_0x28a75c[_0xcea8('0x1b')]=qs[_0xcea8('0x1b')](_0x13b09e[_0xcea8('0x31')][_0xcea8('0x1b')]);}_0x28a75c[_0xcea8('0x38')]=qs[_0xcea8('0x39')](_0x13b09e['query'][_0xcea8('0x39')]);_0x28a75c['where']=qs[_0xcea8('0x3a')](_[_0xcea8('0x3b')](_0x13b09e['query'],_0x182b93['filters']),_0x2a3dfc);if(_0x13b09e['query'][_0xcea8('0x3c')]){_0x28a75c['where']=_[_0xcea8('0x3d')](_0x28a75c[_0xcea8('0x3e')],{'$or':_[_0xcea8('0x2a')](_0x2a3dfc,function(_0x212bfc){if(_0x212bfc[_0xcea8('0x2e')]!=='VIRTUAL'){var _0x5232c8={};_0x5232c8[_0x212bfc[_0xcea8('0x28')]]={'$like':'%'+_0x13b09e[_0xcea8('0x31')][_0xcea8('0x3c')]+'%'};return _0x5232c8;}})});}_0x28a75c=_[_0xcea8('0x3d')]({},_0x28a75c,_0x13b09e[_0xcea8('0x3f')]);var _0x245ee={'where':_0x28a75c[_0xcea8('0x3e')]};return db['Sound'][_0xcea8('0x1c')](_0x245ee)['then'](function(_0x187046){_0x114adb['count']=_0x187046;if(_0x13b09e[_0xcea8('0x31')][_0xcea8('0x40')]){_0x28a75c[_0xcea8('0x41')]=[{'all':!![]}];}return db[_0xcea8('0x2b')][_0xcea8('0x42')](_0x28a75c);})[_0xcea8('0x20')](function(_0x5e57a5){_0x114adb[_0xcea8('0x43')]=_0x5e57a5;return _0x114adb;})['then'](respondWithFilteredResult(_0xebcf4e,_0x28a75c))['catch'](handleError(_0xebcf4e,null));};exports[_0xcea8('0x44')]=function(_0x46f064,_0x11999d){var _0x244c21={'raw':!![],'where':{'id':_0x46f064[_0xcea8('0x45')]['id']}},_0xb21b19={};_0xb21b19[_0xcea8('0x30')]=_[_0xcea8('0x32')](db[_0xcea8('0x2b')][_0xcea8('0x2c')]);_0xb21b19['query']=_[_0xcea8('0x32')](_0x46f064['query']);_0xb21b19[_0xcea8('0x3a')]=_[_0xcea8('0x33')](_0xb21b19['model'],_0xb21b19['query']);_0x244c21[_0xcea8('0x35')]=_[_0xcea8('0x33')](_0xb21b19['model'],qs[_0xcea8('0x34')](_0x46f064['query'][_0xcea8('0x34')]));_0x244c21['attributes']=_0x244c21[_0xcea8('0x35')][_0xcea8('0x46')]?_0x244c21[_0xcea8('0x35')]:_0xb21b19[_0xcea8('0x30')];if(_0x46f064[_0xcea8('0x31')][_0xcea8('0x40')]){_0x244c21[_0xcea8('0x41')]=[{'all':!![]}];}_0x244c21=_[_0xcea8('0x3d')]({},_0x244c21,_0x46f064[_0xcea8('0x3f')]);return db['Sound'][_0xcea8('0x47')](_0x244c21)['then'](handleEntityNotFound(_0x11999d,null))[_0xcea8('0x20')](respondWithResult(_0x11999d,null))[_0xcea8('0x48')](handleError(_0x11999d,null));};exports[_0xcea8('0x49')]=function(_0x25c900,_0x1b500a,_0x20bd21){return db['Sound'][_0xcea8('0x47')]({'where':{'id':_0x25c900['params']['id']},'attributes':[_0xcea8('0x28'),_0xcea8('0x4a'),_0xcea8('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x1b500a,null))[_0xcea8('0x20')](function(_0xcb9489){if(_0xcb9489){if(!fs[_0xcea8('0x4c')](path[_0xcea8('0x4d')](config[_0xcea8('0x4e')],_0xcea8('0x4f'),_0xcb9489['save_name']+'.'+_0xcb9489[_0xcea8('0x4b')]))){throw new db['Sequelize'][(_0xcea8('0x50'))](_0xcea8('0x51'));}return _0x1b500a[_0xcea8('0x49')](path[_0xcea8('0x4d')](config[_0xcea8('0x4e')],_0xcea8('0x4f'),util[_0xcea8('0x52')]('%s.%s',_0xcb9489[_0xcea8('0x4a')],_0xcb9489[_0xcea8('0x4b')])),util['format'](_0xcea8('0x53'),_0xcb9489[_0xcea8('0x28')],_0xcb9489[_0xcea8('0x4b')]));}return null;})[_0xcea8('0x48')](handleError(_0x1b500a,null));};exports['create']=function(_0x3d2663,_0x5cb332,_0x380f37){var _0xe1726d={'name':path['basename'](_0x3d2663[_0xcea8('0x54')][_0xcea8('0x55')],path['extname'](_0x3d2663['file'][_0xcea8('0x55')])),'save_name':path[_0xcea8('0x56')](_0x3d2663[_0xcea8('0x54')][_0xcea8('0x57')],path['extname'](_0x3d2663[_0xcea8('0x54')][_0xcea8('0x57')])),'original_format':path[_0xcea8('0x58')](_0x3d2663[_0xcea8('0x54')][_0xcea8('0x55')])[_0xcea8('0x59')](0x1),'converted_format':_0xcea8('0x5a')};var _0xe3b297=path[_0xcea8('0x4d')](config[_0xcea8('0x4e')],_0xcea8('0x5b'),_0x3d2663[_0xcea8('0x54')][_0xcea8('0x57')]);var _0x519094=path['join'](config[_0xcea8('0x4e')],_0xcea8('0x4f'),util['format'](_0xcea8('0x53'),path[_0xcea8('0x56')](_0x3d2663['file'][_0xcea8('0x57')],path['extname'](_0x3d2663['file'][_0xcea8('0x57')])),_0xe1726d[_0xcea8('0x4b')]));logger[_0xcea8('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0xe3b297);logger[_0xcea8('0x5c')](_0xcea8('0x5d'),_0x519094);try{fs['chmodSync'](_0xe3b297,parseInt(_0xcea8('0x5e'),0x8));var _0x46b00b=sox['transcode'](_0xe3b297,_0x519094,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x46b00b['on'](_0xcea8('0x26'),function(_0x52eecf){fs['unlinkSync'](_0xe3b297);_0x5cb332[_0xcea8('0x19')](0x1f4)['send'](_0x52eecf);});_0x46b00b['on'](_0xcea8('0x5f'),function(_0x1b5f65){_0xe1726d[_0xcea8('0x60')]=isNaN(_0x1b5f65[_0xcea8('0x61')])?null:_0x1b5f65['duration']*0x3e8;_0xe1726d[_0xcea8('0x62')]=isNaN(_0x1b5f65[_0xcea8('0x63')])?null:_0x1b5f65[_0xcea8('0x63')];_0xe1726d[_0xcea8('0x64')]=isNaN(_0x1b5f65[_0xcea8('0x65')])?null:_0x1b5f65[_0xcea8('0x65')];_0xe1726d[_0xcea8('0x66')]=isNaN(_0x1b5f65['bitRate'])?null:_0x1b5f65[_0xcea8('0x67')];_0xe1726d[_0xcea8('0x68')]=isNaN(_0x1b5f65[_0xcea8('0x69')])?null:_0x1b5f65[_0xcea8('0x69')];});_0x46b00b['on']('dest',function(_0x18e609){_0xe1726d[_0xcea8('0x6a')]=isNaN(_0x18e609[_0xcea8('0x61')])?null:_0x18e609[_0xcea8('0x61')]*0x3e8;_0xe1726d[_0xcea8('0x6b')]=isNaN(_0x18e609[_0xcea8('0x63')])?null:_0x18e609[_0xcea8('0x63')];_0xe1726d[_0xcea8('0x6c')]=isNaN(_0x18e609[_0xcea8('0x65')])?null:_0x18e609[_0xcea8('0x65')];_0xe1726d[_0xcea8('0x6d')]=isNaN(_0x18e609[_0xcea8('0x67')])?null:_0x18e609[_0xcea8('0x67')];_0xe1726d[_0xcea8('0x6e')]=isNaN(_0x18e609['sampleRate'])?null:_0x18e609[_0xcea8('0x69')];});_0x46b00b['on'](_0xcea8('0x25'),function(){fs['chmodSync'](_0x519094,parseInt(_0xcea8('0x5e'),0x8));return db['Sound'][_0xcea8('0x6f')](_0xe1726d)[_0xcea8('0x20')](function(_0x41c5b0){var _0x4ec302={'role':_0x3d2663[_0xcea8('0x70')][_0xcea8('0x71')],'userProfileId':_0x3d2663[_0xcea8('0x70')][_0xcea8('0x72')]};if(!_0x4ec302)throw new Error(_0xcea8('0x73'));if(_0x4ec302[_0xcea8('0x71')]===_0xcea8('0x74')){var _0x1d113f=_0x41c5b0[_0xcea8('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xcea8('0x47')]({'where':{'name':_0xcea8('0x23'),'userProfileId':_0x4ec302['userProfileId']},'raw':!![]})['then'](function(_0x1bfc7b){if(_0x1bfc7b&&_0x1bfc7b[_0xcea8('0x75')]===0x0){return db[_0xcea8('0x24')][_0xcea8('0x6f')]({'name':_0x1d113f[_0xcea8('0x28')],'resourceId':_0x1d113f['id'],'type':_0x1bfc7b[_0xcea8('0x28')],'sectionId':_0x1bfc7b['id']},{})[_0xcea8('0x20')](function(){return _0x41c5b0;});}else{return _0x41c5b0;}})['catch'](function(_0x50574e){logger[_0xcea8('0x26')](_0xcea8('0x76'),_0x50574e);throw _0x50574e;});}return _0x41c5b0;})['then'](respondWithResult(_0x5cb332,null))[_0xcea8('0x48')](handleError(_0x5cb332,null));});_0x46b00b[_0xcea8('0x77')]();}catch(_0x468b2e){_0x5cb332['status'](0x1f4)['send'](_0x468b2e);}};exports[_0xcea8('0x78')]=function(_0x2f80e6,_0x5e6c42,_0x282395){return db[_0xcea8('0x2b')][_0xcea8('0x47')]({'where':{'id':_0x2f80e6[_0xcea8('0x45')]['id']}})[_0xcea8('0x20')](handleEntityNotFound(_0x5e6c42,null))[_0xcea8('0x20')](saveUpdates(_['pick'](_0x2f80e6[_0xcea8('0x70')],[_0xcea8('0x28'),_0xcea8('0x79')]),null))[_0xcea8('0x20')](respondWithResult(_0x5e6c42,null))[_0xcea8('0x48')](handleError(_0x5e6c42,null));};exports[_0xcea8('0x7a')]=function(_0x4ce63a,_0xf07eea,_0x3e36ee){return db[_0xcea8('0x2b')]['find']({'where':{'id':_0x4ce63a[_0xcea8('0x45')]['id']}})[_0xcea8('0x20')](function(_0x4b508e){if(_0x4b508e){return _0x4b508e[_0xcea8('0x21')]();}})[_0xcea8('0x20')](function(_0x3a6c4e){var _0x5c3ed8=path['join'](config[_0xcea8('0x4e')],'server/files/sounds/original',util[_0xcea8('0x52')](_0xcea8('0x53'),_0x3a6c4e['save_name'],_0x3a6c4e[_0xcea8('0x7b')]));var _0x28de50=path[_0xcea8('0x4d')](config[_0xcea8('0x4e')],_0xcea8('0x4f'),util['format']('%s.%s',_0x3a6c4e[_0xcea8('0x4a')],_0x3a6c4e[_0xcea8('0x4b')]));fs[_0xcea8('0x7c')](_0x5c3ed8);fs['unlinkSync'](_0x28de50);return _0x3a6c4e;})[_0xcea8('0x20')](function(_0x16db9a){if(_0x16db9a){return _0xf07eea[_0xcea8('0x19')](0xcc)[_0xcea8('0x25')]();}})[_0xcea8('0x20')](handleEntityNotFound(_0xf07eea,null))[_0xcea8('0x48')](handleError(_0xf07eea,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e7baf44..5404639 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 _0x082c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','../../config/logger','moment'];(function(_0x4eec2b,_0x588cb1){var _0x3447c7=function(_0x2fd20c){while(--_0x2fd20c){_0x4eec2b['push'](_0x4eec2b['shift']());}};_0x3447c7(++_0x588cb1);}(_0x082c,0x183));var _0xc082=function(_0x4c7a27,_0x3811bb){_0x4c7a27=_0x4c7a27-0x0;var _0x427aa5=_0x082c[_0x4c7a27];return _0x427aa5;};'use strict';var _=require(_0xc082('0x0'));var util=require('util');var logger=require(_0xc082('0x1'))('api');var moment=require(_0xc082('0x2'));var BPromise=require(_0xc082('0x3'));var rp=require(_0xc082('0x4'));var fs=require('fs');var path=require(_0xc082('0x5'));var rimraf=require(_0xc082('0x6'));var config=require(_0xc082('0x7'));var attributes=require('./sound.attributes');module[_0xc082('0x8')]=function(_0x46a9dd,_0x2b0ea5){return _0x46a9dd[_0xc082('0x9')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb054=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xb054,0x1ca));var _0x4b05=function(_0x4420ee,_0x2a5f02){_0x4420ee=_0x4420ee-0x0;var _0x174239=_0xb054[_0x4420ee];return _0x174239;};'use strict';var _=require(_0x4b05('0x0'));var util=require('util');var logger=require(_0x4b05('0x1'))(_0x4b05('0x2'));var moment=require(_0x4b05('0x3'));var BPromise=require(_0x4b05('0x4'));var rp=require(_0x4b05('0x5'));var fs=require('fs');var path=require(_0x4b05('0x6'));var rimraf=require(_0x4b05('0x7'));var config=require(_0x4b05('0x8'));var attributes=require(_0x4b05('0x9'));module[_0x4b05('0xa')]=function(_0x2cc5fb,_0x553407){return _0x2cc5fb[_0x4b05('0xb')](_0x4b05('0xc'),attributes,{'tableName':_0x4b05('0xd'),'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 9e5cf24..af31189 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 _0x3acf=['message','info','result','catch','Sound','find','raw','options','attributes','include','map','model','ShowSound','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s'];(function(_0x5f09b5,_0x29c29c){var _0xaa1a4f=function(_0x2b8f7d){while(--_0x2b8f7d){_0x5f09b5['push'](_0x5f09b5['shift']());}};_0xaa1a4f(++_0x29c29c);}(_0x3acf,0x1dc));var _0xf3ac=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0x3acf[_0x2637ac];return _0x4a5758;};'use strict';var _=require(_0xf3ac('0x0'));var util=require(_0xf3ac('0x1'));var moment=require(_0xf3ac('0x2'));var BPromise=require(_0xf3ac('0x3'));var rs=require(_0xf3ac('0x4'));var fs=require('fs');var Redis=require(_0xf3ac('0x5'));var db=require(_0xf3ac('0x6'))['db'];var utils=require(_0xf3ac('0x7'));var logger=require('../../config/logger')(_0xf3ac('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3ac('0x9'));var client=jayson[_0xf3ac('0xa')][_0xf3ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290e4c,_0x510480,_0x3cee5b){return new BPromise(function(_0x22a0d0,_0x6db29f){return client[_0xf3ac('0xc')](_0x290e4c,_0x3cee5b)['then'](function(_0x3f68c8){logger['info']('Sound,\x20%s,\x20%s',_0x510480,_0xf3ac('0xd'));logger[_0xf3ac('0xe')](_0xf3ac('0xf'),_0x510480,_0xf3ac('0xd'),JSON['stringify'](_0x3f68c8));if(_0x3f68c8[_0xf3ac('0x10')]){if(_0x3f68c8[_0xf3ac('0x10')][_0xf3ac('0x11')]===0x1f4){logger[_0xf3ac('0x10')](_0xf3ac('0x12'),_0x510480,_0x3f68c8[_0xf3ac('0x10')][_0xf3ac('0x13')]);return _0x6db29f(_0x3f68c8['error'][_0xf3ac('0x13')]);}logger[_0xf3ac('0x10')](_0xf3ac('0x12'),_0x510480,_0x3f68c8[_0xf3ac('0x10')]['message']);return _0x22a0d0(_0x3f68c8[_0xf3ac('0x10')][_0xf3ac('0x13')]);}else{logger[_0xf3ac('0x14')]('Sound,\x20%s,\x20%s',_0x510480,_0xf3ac('0xd'));_0x22a0d0(_0x3f68c8[_0xf3ac('0x15')][_0xf3ac('0x13')]);}})[_0xf3ac('0x16')](function(_0x138d35){logger[_0xf3ac('0x10')](_0xf3ac('0x12'),_0x510480,_0x138d35);_0x6db29f(_0x138d35);});});}exports['ShowSound']=function(_0x57a52){var _0x1cbd88=this;return new Promise(function(_0x288cc2,_0x242cff){return db[_0xf3ac('0x17')][_0xf3ac('0x18')]({'raw':_0x57a52['options']?_0x57a52['options'][_0xf3ac('0x19')]===undefined?!![]:![]:!![],'where':_0x57a52[_0xf3ac('0x1a')]?_0x57a52['options']['where']||null:null,'attributes':_0x57a52[_0xf3ac('0x1a')]?_0x57a52['options'][_0xf3ac('0x1b')]||null:null,'include':_0x57a52[_0xf3ac('0x1a')]?_0x57a52[_0xf3ac('0x1a')][_0xf3ac('0x1c')]?_['map'](_0x57a52[_0xf3ac('0x1a')][_0xf3ac('0x1c')],function(_0x104be9){return{'model':db[_0x104be9['model']],'as':_0x104be9['as'],'attributes':_0x104be9[_0xf3ac('0x1b')],'include':_0x104be9[_0xf3ac('0x1c')]?_[_0xf3ac('0x1d')](_0x104be9[_0xf3ac('0x1c')],function(_0x3762d8){return{'model':db[_0x3762d8[_0xf3ac('0x1e')]],'as':_0x3762d8['as'],'attributes':_0x3762d8[_0xf3ac('0x1b')],'include':_0x3762d8[_0xf3ac('0x1c')]?_[_0xf3ac('0x1d')](_0x3762d8[_0xf3ac('0x1c')],function(_0x1ea5fa){return{'model':db[_0x1ea5fa[_0xf3ac('0x1e')]],'as':_0x1ea5fa['as'],'attributes':_0x1ea5fa[_0xf3ac('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf5ea5c){logger['info']('ShowSound',_0x57a52);logger[_0xf3ac('0xe')](_0xf3ac('0x1f'),_0x57a52,JSON[_0xf3ac('0x20')](_0xf5ea5c));_0x288cc2(_0xf5ea5c);})[_0xf3ac('0x16')](function(_0x169a02){logger['error'](_0xf3ac('0x1f'),_0x169a02['message'],_0x57a52);_0x242cff(_0x1cbd88[_0xf3ac('0x10')](0x1f4,_0x169a02[_0xf3ac('0x13')]));});});}; \ No newline at end of file +var _0xaeb5=['stringify','error','code','message','catch','ShowSound','options','where','attributes','include','map','model','then','debug','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x20237d,_0x506c3d){var _0x5a5b92=function(_0xdca92d){while(--_0xdca92d){_0x20237d['push'](_0x20237d['shift']());}};_0x5a5b92(++_0x506c3d);}(_0xaeb5,0x16a));var _0x5aeb=function(_0x35a393,_0x4e2072){_0x35a393=_0x35a393-0x0;var _0x22cea8=_0xaeb5[_0x35a393];return _0x22cea8;};'use strict';var _=require(_0x5aeb('0x0'));var util=require(_0x5aeb('0x1'));var moment=require(_0x5aeb('0x2'));var BPromise=require('bluebird');var rs=require(_0x5aeb('0x3'));var fs=require('fs');var Redis=require(_0x5aeb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5aeb('0x5'));var config=require(_0x5aeb('0x6'));var jayson=require(_0x5aeb('0x7'));var client=jayson[_0x5aeb('0x8')][_0x5aeb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55f536,_0x1824d1,_0x157c77){return new BPromise(function(_0x2fd39d,_0x231130){return client[_0x5aeb('0xa')](_0x55f536,_0x157c77)['then'](function(_0x151a23){logger[_0x5aeb('0xb')](_0x5aeb('0xc'),_0x1824d1,_0x5aeb('0xd'));logger['debug'](_0x5aeb('0xe'),_0x1824d1,_0x5aeb('0xd'),JSON[_0x5aeb('0xf')](_0x151a23));if(_0x151a23[_0x5aeb('0x10')]){if(_0x151a23['error'][_0x5aeb('0x11')]===0x1f4){logger[_0x5aeb('0x10')](_0x5aeb('0xc'),_0x1824d1,_0x151a23[_0x5aeb('0x10')][_0x5aeb('0x12')]);return _0x231130(_0x151a23[_0x5aeb('0x10')][_0x5aeb('0x12')]);}logger[_0x5aeb('0x10')](_0x5aeb('0xc'),_0x1824d1,_0x151a23[_0x5aeb('0x10')]['message']);return _0x2fd39d(_0x151a23['error'][_0x5aeb('0x12')]);}else{logger[_0x5aeb('0xb')]('Sound,\x20%s,\x20%s',_0x1824d1,'request\x20sent');_0x2fd39d(_0x151a23['result']['message']);}})[_0x5aeb('0x13')](function(_0x442980){logger[_0x5aeb('0x10')](_0x5aeb('0xc'),_0x1824d1,_0x442980);_0x231130(_0x442980);});});}exports[_0x5aeb('0x14')]=function(_0x291fb4){var _0x18aae1=this;return new Promise(function(_0x330500,_0x1501e9){return db['Sound']['find']({'raw':_0x291fb4[_0x5aeb('0x15')]?_0x291fb4[_0x5aeb('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x291fb4['options']?_0x291fb4[_0x5aeb('0x15')][_0x5aeb('0x16')]||null:null,'attributes':_0x291fb4['options']?_0x291fb4[_0x5aeb('0x15')][_0x5aeb('0x17')]||null:null,'include':_0x291fb4[_0x5aeb('0x15')]?_0x291fb4[_0x5aeb('0x15')][_0x5aeb('0x18')]?_[_0x5aeb('0x19')](_0x291fb4[_0x5aeb('0x15')][_0x5aeb('0x18')],function(_0xf0fe3){return{'model':db[_0xf0fe3[_0x5aeb('0x1a')]],'as':_0xf0fe3['as'],'attributes':_0xf0fe3[_0x5aeb('0x17')],'include':_0xf0fe3[_0x5aeb('0x18')]?_['map'](_0xf0fe3[_0x5aeb('0x18')],function(_0x637046){return{'model':db[_0x637046[_0x5aeb('0x1a')]],'as':_0x637046['as'],'attributes':_0x637046[_0x5aeb('0x17')],'include':_0x637046[_0x5aeb('0x18')]?_['map'](_0x637046[_0x5aeb('0x18')],function(_0x745f56){return{'model':db[_0x745f56[_0x5aeb('0x1a')]],'as':_0x745f56['as'],'attributes':_0x745f56[_0x5aeb('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5aeb('0x1b')](function(_0x15f56c){logger['info'](_0x5aeb('0x14'),_0x291fb4);logger[_0x5aeb('0x1c')]('ShowSound',_0x291fb4,JSON[_0x5aeb('0xf')](_0x15f56c));_0x330500(_0x15f56c);})['catch'](function(_0x39b6db){logger[_0x5aeb('0x10')](_0x5aeb('0x14'),_0x39b6db[_0x5aeb('0x12')],_0x291fb4);_0x1501e9(_0x18aae1[_0x5aeb('0x10')](0x1f4,_0x39b6db[_0x5aeb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 39bfd0b..01d6229 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3c0467,_0x458f2e){var _0x4707e8=function(_0x2cc523){while(--_0x2cc523){_0x3c0467['push'](_0x3c0467['shift']());}};_0x4707e8(++_0x458f2e);}(_0xac4a,0x13f));var _0xaac4=function(_0xb381a0,_0x3e8cdf){_0xb381a0=_0xb381a0-0x0;var _0xeb0292=_0xac4a[_0xb381a0];return _0xeb0292;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=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(_0x1ee5be,_0x5f46e3){var _0x177140=function(_0x162779){while(--_0x162779){_0x1ee5be['push'](_0x1ee5be['shift']());}};_0x177140(++_0x5f46e3);}(_0x4fc2,0x111));var _0x24fc=function(_0x3ed528,_0x52481c){_0x3ed528=_0x3ed528-0x0;var _0x3ac7fb=_0x4fc2[_0x3ed528];return _0x3ac7fb;};'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 80132e9..a0a551f 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 _0xb39b=['out','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x1c9e6d,_0x5b9c3a){var _0x2f0d5c=function(_0xf9059c){while(--_0xf9059c){_0x1c9e6d['push'](_0x1c9e6d['shift']());}};_0x2f0d5c(++_0x5b9c3a);}(_0xb39b,0x128));var _0xbb39=function(_0x5395d2,_0x3edb99){_0x5395d2=_0x5395d2-0x0;var _0xf4c5ee=_0xb39b[_0x5395d2];return _0xf4c5ee;};'use strict';var Sequelize=require(_0xbb39('0x0'));module[_0xbb39('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xbb39('0x2')](_0xbb39('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xbb39('0x4')]('in',_0xbb39('0x5')),'defaultValue':_0xbb39('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xbb39('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x492c=['exports','medium','out','STRING','TEXT','sequelize'];(function(_0x7e74f0,_0x2eea97){var _0x1f5080=function(_0x2bd236){while(--_0x2bd236){_0x7e74f0['push'](_0x7e74f0['shift']());}};_0x1f5080(++_0x2eea97);}(_0x492c,0x18b));var _0xc492=function(_0x42d24f,_0x421ce6){_0x42d24f=_0x42d24f-0x0;var _0x20b0f9=_0x492c[_0x42d24f];return _0x20b0f9;};'use strict';var Sequelize=require(_0xc492('0x0'));module[_0xc492('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xc492('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xc492('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc492('0x4')]},'providerResponse':{'type':Sequelize[_0xc492('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 33ffda7..f1f3318 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 _0x5d2f=['end','json','offset','limit','count','Content-Range','apply','save','then','destroy','error','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2e2c03,_0x2462b0){var _0x457e3e=function(_0x130452){while(--_0x130452){_0x2e2c03['push'](_0x2e2c03['shift']());}};_0x457e3e(++_0x2462b0);}(_0x5d2f,0x17d));var _0xf5d2=function(_0x416f4e,_0x46a4b1){_0x416f4e=_0x416f4e-0x0;var _0x230028=_0x5d2f[_0x416f4e];return _0x230028;};'use strict';var emlformat=require(_0xf5d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5d2('0x1'));var jsonpatch=require(_0xf5d2('0x2'));var rp=require(_0xf5d2('0x3'));var moment=require(_0xf5d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf5d2('0x5'));var util=require(_0xf5d2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf5d2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5d2('0x8'));var _=require(_0xf5d2('0x9'));var squel=require(_0xf5d2('0xa'));var crypto=require('crypto');var jsforce=require(_0xf5d2('0xb'));var deskjs=require(_0xf5d2('0xc'));var toCsv=require(_0xf5d2('0x7'));var querystring=require(_0xf5d2('0xd'));var Papa=require(_0xf5d2('0xe'));var Redis=require(_0xf5d2('0xf'));var authService=require(_0xf5d2('0x10'));var qs=require(_0xf5d2('0x11'));var as=require(_0xf5d2('0x12'));var hardwareService=require(_0xf5d2('0x13'));var logger=require(_0xf5d2('0x14'))('api');var utils=require(_0xf5d2('0x15'));var config=require(_0xf5d2('0x16'));var licenseUtil=require(_0xf5d2('0x17'));var db=require(_0xf5d2('0x18'))['db'];function respondWithStatusCode(_0x862893,_0x45a78b){_0x45a78b=_0x45a78b||0xcc;return function(_0x18643d){if(_0x18643d){return _0x862893[_0xf5d2('0x19')](_0x45a78b);}return _0x862893[_0xf5d2('0x1a')](_0x45a78b)[_0xf5d2('0x1b')]();};}function respondWithResult(_0x4e3dbe,_0x3feeae){_0x3feeae=_0x3feeae||0xc8;return function(_0x235d16){if(_0x235d16){return _0x4e3dbe[_0xf5d2('0x1a')](_0x3feeae)[_0xf5d2('0x1c')](_0x235d16);}};}function respondWithFilteredResult(_0x19ff31,_0x10ebe5){return function(_0x1925d0){if(_0x1925d0){var _0x294af7=typeof _0x10ebe5[_0xf5d2('0x1d')]==='undefined'&&typeof _0x10ebe5[_0xf5d2('0x1e')]==='undefined';var _0x4feb1e=_0x1925d0[_0xf5d2('0x1f')];var _0xcce1ad=_0x294af7?0x0:_0x10ebe5[_0xf5d2('0x1d')];var _0x1f1d54=_0x294af7?_0x1925d0[_0xf5d2('0x1f')]:_0x10ebe5[_0xf5d2('0x1d')]+_0x10ebe5[_0xf5d2('0x1e')];var _0x20623c;if(_0x1f1d54>=_0x4feb1e){_0x1f1d54=_0x4feb1e;_0x20623c=0xc8;}else{_0x20623c=0xce;}_0x19ff31[_0xf5d2('0x1a')](_0x20623c);return _0x19ff31['set'](_0xf5d2('0x20'),_0xcce1ad+'-'+_0x1f1d54+'/'+_0x4feb1e)[_0xf5d2('0x1c')](_0x1925d0);}return null;};}function patchUpdates(_0x2b46ef){return function(_0x451743){try{jsonpatch[_0xf5d2('0x21')](_0x451743,_0x2b46ef,!![]);}catch(_0x2c5a3e){return BPromise['reject'](_0x2c5a3e);}return _0x451743[_0xf5d2('0x22')]();};}function saveUpdates(_0x1805e7,_0x446b27){return function(_0x43e3d4){if(_0x43e3d4){return _0x43e3d4['update'](_0x1805e7)[_0xf5d2('0x23')](function(_0x380234){return _0x380234;});}return null;};}function removeEntity(_0x1acdd1,_0x23dd3d){return function(_0xcbe249){if(_0xcbe249){return _0xcbe249[_0xf5d2('0x24')]()['then'](function(){_0x1acdd1[_0xf5d2('0x1a')](0xcc)[_0xf5d2('0x1b')]();});}};}function handleEntityNotFound(_0x285c31,_0x14c57a){return function(_0x5b07d0){if(!_0x5b07d0){_0x285c31[_0xf5d2('0x19')](0x194);}return _0x5b07d0;};}function handleError(_0x2e35e7,_0x2733eb){_0x2733eb=_0x2733eb||0x1f4;return function(_0x5f04ef){logger[_0xf5d2('0x25')](_0x5f04ef['stack']);if(_0x5f04ef[_0xf5d2('0x26')]){delete _0x5f04ef[_0xf5d2('0x26')];}_0x2e35e7[_0xf5d2('0x1a')](_0x2733eb)['send'](_0x5f04ef);};}exports[_0xf5d2('0x27')]=function(_0x5a4ce6,_0x4db99c){var _0x217a7e={},_0x581a79={},_0x4c9bb0={'count':0x0,'rows':[]};var _0x56f99c=_[_0xf5d2('0x28')](db[_0xf5d2('0x29')][_0xf5d2('0x2a')],function(_0x29727b){return{'name':_0x29727b[_0xf5d2('0x2b')],'type':_0x29727b[_0xf5d2('0x2c')][_0xf5d2('0x2d')]};});_0x581a79[_0xf5d2('0x2e')]=_['map'](_0x56f99c,'name');_0x581a79[_0xf5d2('0x2f')]=_[_0xf5d2('0x30')](_0x5a4ce6[_0xf5d2('0x2f')]);_0x581a79[_0xf5d2('0x31')]=_[_0xf5d2('0x32')](_0x581a79['model'],_0x581a79[_0xf5d2('0x2f')]);_0x217a7e[_0xf5d2('0x33')]=_['intersection'](_0x581a79[_0xf5d2('0x2e')],qs['fields'](_0x5a4ce6[_0xf5d2('0x2f')][_0xf5d2('0x34')]));_0x217a7e[_0xf5d2('0x33')]=_0x217a7e[_0xf5d2('0x33')][_0xf5d2('0x35')]?_0x217a7e[_0xf5d2('0x33')]:_0x581a79['model'];if(!_0x5a4ce6[_0xf5d2('0x2f')][_0xf5d2('0x36')]('nolimit')){_0x217a7e[_0xf5d2('0x1e')]=qs[_0xf5d2('0x1e')](_0x5a4ce6[_0xf5d2('0x2f')][_0xf5d2('0x1e')]);_0x217a7e[_0xf5d2('0x1d')]=qs[_0xf5d2('0x1d')](_0x5a4ce6[_0xf5d2('0x2f')][_0xf5d2('0x1d')]);}_0x217a7e['order']=qs['sort'](_0x5a4ce6[_0xf5d2('0x2f')][_0xf5d2('0x37')]);_0x217a7e[_0xf5d2('0x38')]=qs[_0xf5d2('0x31')](_['pick'](_0x5a4ce6['query'],_0x581a79['filters']),_0x56f99c);if(_0x5a4ce6[_0xf5d2('0x2f')][_0xf5d2('0x39')]){_0x217a7e[_0xf5d2('0x38')]=_[_0xf5d2('0x3a')](_0x217a7e['where'],{'$or':_[_0xf5d2('0x28')](_0x56f99c,function(_0x225e2b){if(_0x225e2b[_0xf5d2('0x2c')]!=='VIRTUAL'){var _0x21959b={};_0x21959b[_0x225e2b[_0xf5d2('0x26')]]={'$like':'%'+_0x5a4ce6[_0xf5d2('0x2f')][_0xf5d2('0x39')]+'%'};return _0x21959b;}})});}_0x217a7e=_[_0xf5d2('0x3a')]({},_0x217a7e,_0x5a4ce6[_0xf5d2('0x3b')]);var _0x1c8d0e={'where':_0x217a7e['where']};return db['SquareMessage'][_0xf5d2('0x1f')](_0x1c8d0e)[_0xf5d2('0x23')](function(_0x23bfbf){_0x4c9bb0[_0xf5d2('0x1f')]=_0x23bfbf;if(_0x5a4ce6['query'][_0xf5d2('0x3c')]){_0x217a7e[_0xf5d2('0x3d')]=[{'all':!![]}];}return db[_0xf5d2('0x29')][_0xf5d2('0x3e')](_0x217a7e);})['then'](function(_0x23dc08){_0x4c9bb0['rows']=_0x23dc08;return _0x4c9bb0;})[_0xf5d2('0x23')](respondWithFilteredResult(_0x4db99c,_0x217a7e))[_0xf5d2('0x3f')](handleError(_0x4db99c,null));};exports['show']=function(_0x5b8645,_0x1b2faa){var _0x115957={'raw':!![],'where':{'id':_0x5b8645[_0xf5d2('0x40')]['id']}},_0x1d2914={};_0x1d2914[_0xf5d2('0x2e')]=_['keys'](db[_0xf5d2('0x29')][_0xf5d2('0x2a')]);_0x1d2914['query']=_[_0xf5d2('0x30')](_0x5b8645[_0xf5d2('0x2f')]);_0x1d2914[_0xf5d2('0x31')]=_[_0xf5d2('0x32')](_0x1d2914[_0xf5d2('0x2e')],_0x1d2914[_0xf5d2('0x2f')]);_0x115957[_0xf5d2('0x33')]=_[_0xf5d2('0x32')](_0x1d2914['model'],qs[_0xf5d2('0x34')](_0x5b8645[_0xf5d2('0x2f')][_0xf5d2('0x34')]));_0x115957[_0xf5d2('0x33')]=_0x115957[_0xf5d2('0x33')][_0xf5d2('0x35')]?_0x115957[_0xf5d2('0x33')]:_0x1d2914[_0xf5d2('0x2e')];if(_0x5b8645['query'][_0xf5d2('0x3c')]){_0x115957[_0xf5d2('0x3d')]=[{'all':!![]}];}_0x115957=_['merge']({},_0x115957,_0x5b8645[_0xf5d2('0x3b')]);return db[_0xf5d2('0x29')][_0xf5d2('0x41')](_0x115957)[_0xf5d2('0x23')](handleEntityNotFound(_0x1b2faa,null))[_0xf5d2('0x23')](respondWithResult(_0x1b2faa,null))[_0xf5d2('0x3f')](handleError(_0x1b2faa,null));};exports[_0xf5d2('0x42')]=function(_0x23a0bc,_0x5e4115){return db[_0xf5d2('0x29')][_0xf5d2('0x42')](_0x23a0bc[_0xf5d2('0x43')],{})[_0xf5d2('0x23')](respondWithResult(_0x5e4115,0xc9))[_0xf5d2('0x3f')](handleError(_0x5e4115,null));};exports['update']=function(_0x4b2b6e,_0x37b3e0){if(_0x4b2b6e['body']['id']){delete _0x4b2b6e[_0xf5d2('0x43')]['id'];}return db[_0xf5d2('0x29')][_0xf5d2('0x41')]({'where':{'id':_0x4b2b6e['params']['id']}})[_0xf5d2('0x23')](handleEntityNotFound(_0x37b3e0,null))[_0xf5d2('0x23')](saveUpdates(_0x4b2b6e[_0xf5d2('0x43')],null))[_0xf5d2('0x23')](respondWithResult(_0x37b3e0,null))[_0xf5d2('0x3f')](handleError(_0x37b3e0,null));};exports['destroy']=function(_0x831fcd,_0x1a14db){return db[_0xf5d2('0x29')][_0xf5d2('0x41')]({'where':{'id':_0x831fcd['params']['id']}})[_0xf5d2('0x23')](handleEntityNotFound(_0x1a14db,null))[_0xf5d2('0x23')](removeEntity(_0x1a14db,null))[_0xf5d2('0x3f')](handleError(_0x1a14db,null));}; \ No newline at end of file +var _0xc50c=['limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','fields','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','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','sendStatus','status','end','json','offset','undefined'];(function(_0xfdcdaf,_0x2f84a2){var _0x3cbf9b=function(_0x2e2f5c){while(--_0x2e2f5c){_0xfdcdaf['push'](_0xfdcdaf['shift']());}};_0x3cbf9b(++_0x2f84a2);}(_0xc50c,0x11d));var _0xcc50=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc50c[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xcc50('0x0'));var rimraf=require(_0xcc50('0x1'));var zipdir=require(_0xcc50('0x2'));var jsonpatch=require(_0xcc50('0x3'));var rp=require(_0xcc50('0x4'));var moment=require(_0xcc50('0x5'));var BPromise=require(_0xcc50('0x6'));var Mustache=require(_0xcc50('0x7'));var util=require(_0xcc50('0x8'));var path=require(_0xcc50('0x9'));var sox=require(_0xcc50('0xa'));var csv=require(_0xcc50('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc50('0xc'));var _=require(_0xcc50('0xd'));var squel=require(_0xcc50('0xe'));var crypto=require(_0xcc50('0xf'));var jsforce=require(_0xcc50('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc50('0xb'));var querystring=require(_0xcc50('0x11'));var Papa=require(_0xcc50('0x12'));var Redis=require(_0xcc50('0x13'));var authService=require(_0xcc50('0x14'));var qs=require(_0xcc50('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc50('0x16'));var logger=require(_0xcc50('0x17'))(_0xcc50('0x18'));var utils=require(_0xcc50('0x19'));var config=require(_0xcc50('0x1a'));var licenseUtil=require(_0xcc50('0x1b'));var db=require(_0xcc50('0x1c'))['db'];function respondWithStatusCode(_0x4697f9,_0x24774d){_0x24774d=_0x24774d||0xcc;return function(_0x1c9334){if(_0x1c9334){return _0x4697f9[_0xcc50('0x1d')](_0x24774d);}return _0x4697f9[_0xcc50('0x1e')](_0x24774d)[_0xcc50('0x1f')]();};}function respondWithResult(_0x44cb6a,_0x577b6d){_0x577b6d=_0x577b6d||0xc8;return function(_0x267fd1){if(_0x267fd1){return _0x44cb6a[_0xcc50('0x1e')](_0x577b6d)[_0xcc50('0x20')](_0x267fd1);}};}function respondWithFilteredResult(_0x409ca3,_0x239f0b){return function(_0x2631d9){if(_0x2631d9){var _0x542d16=typeof _0x239f0b[_0xcc50('0x21')]===_0xcc50('0x22')&&typeof _0x239f0b[_0xcc50('0x23')]===_0xcc50('0x22');var _0x372cc3=_0x2631d9[_0xcc50('0x24')];var _0x58cc63=_0x542d16?0x0:_0x239f0b['offset'];var _0x296a99=_0x542d16?_0x2631d9[_0xcc50('0x24')]:_0x239f0b[_0xcc50('0x21')]+_0x239f0b[_0xcc50('0x23')];var _0x53351d;if(_0x296a99>=_0x372cc3){_0x296a99=_0x372cc3;_0x53351d=0xc8;}else{_0x53351d=0xce;}_0x409ca3[_0xcc50('0x1e')](_0x53351d);return _0x409ca3[_0xcc50('0x25')]('Content-Range',_0x58cc63+'-'+_0x296a99+'/'+_0x372cc3)[_0xcc50('0x20')](_0x2631d9);}return null;};}function patchUpdates(_0x3f9f53){return function(_0x4728c5){try{jsonpatch[_0xcc50('0x26')](_0x4728c5,_0x3f9f53,!![]);}catch(_0x1f6939){return BPromise['reject'](_0x1f6939);}return _0x4728c5[_0xcc50('0x27')]();};}function saveUpdates(_0x3f0eef,_0x141a71){return function(_0x4d5b3e){if(_0x4d5b3e){return _0x4d5b3e[_0xcc50('0x28')](_0x3f0eef)[_0xcc50('0x29')](function(_0x4ade47){return _0x4ade47;});}return null;};}function removeEntity(_0xfbf3a5,_0xb93bc6){return function(_0x3473ec){if(_0x3473ec){return _0x3473ec[_0xcc50('0x2a')]()['then'](function(){_0xfbf3a5[_0xcc50('0x1e')](0xcc)[_0xcc50('0x1f')]();});}};}function handleEntityNotFound(_0x1e433c,_0x133588){return function(_0x204cc8){if(!_0x204cc8){_0x1e433c['sendStatus'](0x194);}return _0x204cc8;};}function handleError(_0x495b1a,_0x34ed73){_0x34ed73=_0x34ed73||0x1f4;return function(_0x40e731){logger['error'](_0x40e731[_0xcc50('0x2b')]);if(_0x40e731[_0xcc50('0x2c')]){delete _0x40e731['name'];}_0x495b1a['status'](_0x34ed73)[_0xcc50('0x2d')](_0x40e731);};}exports[_0xcc50('0x2e')]=function(_0x156c47,_0x1f0ead){var _0x47ff32={},_0x517c4b={},_0x3e5593={'count':0x0,'rows':[]};var _0x33053b=_[_0xcc50('0x2f')](db[_0xcc50('0x30')][_0xcc50('0x31')],function(_0x43a366){return{'name':_0x43a366[_0xcc50('0x32')],'type':_0x43a366[_0xcc50('0x33')][_0xcc50('0x34')]};});_0x517c4b[_0xcc50('0x35')]=_[_0xcc50('0x2f')](_0x33053b,'name');_0x517c4b[_0xcc50('0x36')]=_[_0xcc50('0x37')](_0x156c47['query']);_0x517c4b[_0xcc50('0x38')]=_[_0xcc50('0x39')](_0x517c4b[_0xcc50('0x35')],_0x517c4b[_0xcc50('0x36')]);_0x47ff32[_0xcc50('0x3a')]=_[_0xcc50('0x39')](_0x517c4b['model'],qs['fields'](_0x156c47[_0xcc50('0x36')]['fields']));_0x47ff32[_0xcc50('0x3a')]=_0x47ff32[_0xcc50('0x3a')][_0xcc50('0x3b')]?_0x47ff32[_0xcc50('0x3a')]:_0x517c4b[_0xcc50('0x35')];if(!_0x156c47[_0xcc50('0x36')][_0xcc50('0x3c')](_0xcc50('0x3d'))){_0x47ff32[_0xcc50('0x23')]=qs['limit'](_0x156c47[_0xcc50('0x36')]['limit']);_0x47ff32[_0xcc50('0x21')]=qs[_0xcc50('0x21')](_0x156c47['query']['offset']);}_0x47ff32[_0xcc50('0x3e')]=qs[_0xcc50('0x3f')](_0x156c47[_0xcc50('0x36')][_0xcc50('0x3f')]);_0x47ff32['where']=qs[_0xcc50('0x38')](_['pick'](_0x156c47[_0xcc50('0x36')],_0x517c4b['filters']),_0x33053b);if(_0x156c47[_0xcc50('0x36')]['filter']){_0x47ff32[_0xcc50('0x40')]=_[_0xcc50('0x41')](_0x47ff32[_0xcc50('0x40')],{'$or':_[_0xcc50('0x2f')](_0x33053b,function(_0x3dad5b){if(_0x3dad5b[_0xcc50('0x33')]!==_0xcc50('0x42')){var _0x262043={};_0x262043[_0x3dad5b['name']]={'$like':'%'+_0x156c47[_0xcc50('0x36')][_0xcc50('0x43')]+'%'};return _0x262043;}})});}_0x47ff32=_['merge']({},_0x47ff32,_0x156c47[_0xcc50('0x44')]);var _0x3c4b01={'where':_0x47ff32['where']};return db[_0xcc50('0x30')]['count'](_0x3c4b01)[_0xcc50('0x29')](function(_0x18df17){_0x3e5593[_0xcc50('0x24')]=_0x18df17;if(_0x156c47[_0xcc50('0x36')]['includeAll']){_0x47ff32[_0xcc50('0x45')]=[{'all':!![]}];}return db[_0xcc50('0x30')][_0xcc50('0x46')](_0x47ff32);})[_0xcc50('0x29')](function(_0x25a4dd){_0x3e5593[_0xcc50('0x47')]=_0x25a4dd;return _0x3e5593;})[_0xcc50('0x29')](respondWithFilteredResult(_0x1f0ead,_0x47ff32))[_0xcc50('0x48')](handleError(_0x1f0ead,null));};exports[_0xcc50('0x49')]=function(_0x4106a8,_0xc21076){var _0x1b0410={'raw':!![],'where':{'id':_0x4106a8[_0xcc50('0x4a')]['id']}},_0x24dce6={};_0x24dce6['model']=_[_0xcc50('0x37')](db['SquareMessage']['rawAttributes']);_0x24dce6['query']=_[_0xcc50('0x37')](_0x4106a8[_0xcc50('0x36')]);_0x24dce6[_0xcc50('0x38')]=_[_0xcc50('0x39')](_0x24dce6[_0xcc50('0x35')],_0x24dce6[_0xcc50('0x36')]);_0x1b0410[_0xcc50('0x3a')]=_[_0xcc50('0x39')](_0x24dce6['model'],qs[_0xcc50('0x4b')](_0x4106a8[_0xcc50('0x36')]['fields']));_0x1b0410['attributes']=_0x1b0410[_0xcc50('0x3a')][_0xcc50('0x3b')]?_0x1b0410[_0xcc50('0x3a')]:_0x24dce6[_0xcc50('0x35')];if(_0x4106a8['query'][_0xcc50('0x4c')]){_0x1b0410[_0xcc50('0x45')]=[{'all':!![]}];}_0x1b0410=_[_0xcc50('0x41')]({},_0x1b0410,_0x4106a8[_0xcc50('0x44')]);return db[_0xcc50('0x30')]['find'](_0x1b0410)[_0xcc50('0x29')](handleEntityNotFound(_0xc21076,null))['then'](respondWithResult(_0xc21076,null))[_0xcc50('0x48')](handleError(_0xc21076,null));};exports[_0xcc50('0x4d')]=function(_0x5e3623,_0xd86646){return db[_0xcc50('0x30')]['create'](_0x5e3623[_0xcc50('0x4e')],{})[_0xcc50('0x29')](respondWithResult(_0xd86646,0xc9))[_0xcc50('0x48')](handleError(_0xd86646,null));};exports[_0xcc50('0x28')]=function(_0x2dc3ee,_0x5d7968){if(_0x2dc3ee[_0xcc50('0x4e')]['id']){delete _0x2dc3ee[_0xcc50('0x4e')]['id'];}return db[_0xcc50('0x30')][_0xcc50('0x4f')]({'where':{'id':_0x2dc3ee['params']['id']}})[_0xcc50('0x29')](handleEntityNotFound(_0x5d7968,null))[_0xcc50('0x29')](saveUpdates(_0x2dc3ee[_0xcc50('0x4e')],null))[_0xcc50('0x29')](respondWithResult(_0x5d7968,null))[_0xcc50('0x48')](handleError(_0x5d7968,null));};exports['destroy']=function(_0x1fabd5,_0x1cede7){return db['SquareMessage'][_0xcc50('0x4f')]({'where':{'id':_0x1fabd5['params']['id']}})[_0xcc50('0x29')](handleEntityNotFound(_0x1cede7,null))[_0xcc50('0x29')](removeEntity(_0x1cede7,null))[_0xcc50('0x48')](handleError(_0x1cede7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 50baba6..926bbc9 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 _0x1ddf=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x46c93c,_0x1d48e5){var _0x36ee26=function(_0x363750){while(--_0x363750){_0x46c93c['push'](_0x46c93c['shift']());}};_0x36ee26(++_0x1d48e5);}(_0x1ddf,0x186));var _0xf1dd=function(_0xf2726b,_0x87deb7){_0xf2726b=_0xf2726b-0x0;var _0xa61a5=_0x1ddf[_0xf2726b];return _0xa61a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf1dd('0x0'))(_0xf1dd('0x1'));var moment=require(_0xf1dd('0x2'));var BPromise=require(_0xf1dd('0x3'));var rp=require(_0xf1dd('0x4'));var fs=require('fs');var path=require(_0xf1dd('0x5'));var rimraf=require(_0xf1dd('0x6'));var config=require(_0xf1dd('0x7'));var attributes=require(_0xf1dd('0x8'));module[_0xf1dd('0x9')]=function(_0x12e5e9,_0x2d1fbc){return _0x12e5e9[_0xf1dd('0xa')]('SquareMessage',attributes,{'tableName':_0xf1dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e1e=['util','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash'];(function(_0x54784f,_0x2a24d8){var _0x241e1b=function(_0x3a4cc2){while(--_0x3a4cc2){_0x54784f['push'](_0x54784f['shift']());}};_0x241e1b(++_0x2a24d8);}(_0x0e1e,0x1e9));var _0xe0e1=function(_0x54c79b,_0x1045cd){_0x54c79b=_0x54c79b-0x0;var _0x5de62b=_0x0e1e[_0x54c79b];return _0x5de62b;};'use strict';var _=require(_0xe0e1('0x0'));var util=require(_0xe0e1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe0e1('0x2'));var fs=require('fs');var path=require(_0xe0e1('0x3'));var rimraf=require(_0xe0e1('0x4'));var config=require(_0xe0e1('0x5'));var attributes=require(_0xe0e1('0x6'));module[_0xe0e1('0x7')]=function(_0x59b99a,_0x48f1e3){return _0x59b99a[_0xe0e1('0x8')](_0xe0e1('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 caa56cd..7f0de90 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 _0xe2ef=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util'];(function(_0x49ac49,_0x59b723){var _0x58563b=function(_0xed6349){while(--_0xed6349){_0x49ac49['push'](_0x49ac49['shift']());}};_0x58563b(++_0x59b723);}(_0xe2ef,0xa6));var _0xfe2e=function(_0xd044d8,_0x4c5a2e){_0xd044d8=_0xd044d8-0x0;var _0x511785=_0xe2ef[_0xd044d8];return _0x511785;};'use strict';var _=require(_0xfe2e('0x0'));var util=require(_0xfe2e('0x1'));var moment=require(_0xfe2e('0x2'));var BPromise=require(_0xfe2e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2e('0x4'));var db=require(_0xfe2e('0x5'))['db'];var utils=require(_0xfe2e('0x6'));var logger=require('../../config/logger')(_0xfe2e('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe2e('0x8'));var client=jayson['client'][_0xfe2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x271e37,_0x4104e2,_0x17ba37){return new BPromise(function(_0x115c59,_0xf6ec81){return client[_0xfe2e('0xa')](_0x271e37,_0x17ba37)['then'](function(_0x571753){logger[_0xfe2e('0xb')](_0xfe2e('0xc'),_0x4104e2,_0xfe2e('0xd'));logger[_0xfe2e('0xe')](_0xfe2e('0xf'),_0x4104e2,'request\x20sent',JSON[_0xfe2e('0x10')](_0x571753));if(_0x571753[_0xfe2e('0x11')]){if(_0x571753[_0xfe2e('0x11')][_0xfe2e('0x12')]===0x1f4){logger[_0xfe2e('0x11')](_0xfe2e('0xc'),_0x4104e2,_0x571753['error'][_0xfe2e('0x13')]);return _0xf6ec81(_0x571753['error'][_0xfe2e('0x13')]);}logger['error'](_0xfe2e('0xc'),_0x4104e2,_0x571753[_0xfe2e('0x11')][_0xfe2e('0x13')]);return _0x115c59(_0x571753[_0xfe2e('0x11')][_0xfe2e('0x13')]);}else{logger[_0xfe2e('0xb')](_0xfe2e('0xc'),_0x4104e2,_0xfe2e('0xd'));_0x115c59(_0x571753[_0xfe2e('0x14')][_0xfe2e('0x13')]);}})[_0xfe2e('0x15')](function(_0x17f84f){logger[_0xfe2e('0x11')](_0xfe2e('0xc'),_0x4104e2,_0x17f84f);_0xf6ec81(_0x17f84f);});});}exports[_0xfe2e('0x16')]=function(_0x330f54){var _0x120988=this;return new Promise(function(_0x403faf,_0x384ea0){return db[_0xfe2e('0x17')][_0xfe2e('0x18')](_0x330f54[_0xfe2e('0x19')],{'raw':_0x330f54[_0xfe2e('0x1a')]?_0x330f54[_0xfe2e('0x1a')][_0xfe2e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x120155){logger[_0xfe2e('0xb')](_0xfe2e('0x16'),_0x330f54);logger['debug']('CreateSquareMessage',_0x330f54,JSON[_0xfe2e('0x10')](_0x120155));_0x403faf(_0x120155);})['catch'](function(_0x39f8cd){logger['error'](_0xfe2e('0x16'),_0x39f8cd[_0xfe2e('0x13')],_0x330f54);_0x384ea0(_0x120988[_0xfe2e('0x11')](0x1f4,_0x39f8cd['message']));});});}; \ No newline at end of file +var _0x8981=['info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message','CreateSquareMessage','create','body','options','raw','then','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x2c7b81,_0x48cb7f){var _0x4f890d=function(_0x28dc33){while(--_0x28dc33){_0x2c7b81['push'](_0x2c7b81['shift']());}};_0x4f890d(++_0x48cb7f);}(_0x8981,0x8c));var _0x1898=function(_0x3cfa8f,_0x2d97df){_0x3cfa8f=_0x3cfa8f-0x0;var _0x5a4862=_0x8981[_0x3cfa8f];return _0x5a4862;};'use strict';var _=require(_0x1898('0x0'));var util=require(_0x1898('0x1'));var moment=require(_0x1898('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1898('0x3'));var db=require(_0x1898('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1898('0x5'))(_0x1898('0x6'));var config=require(_0x1898('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1898('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ed03f,_0x317606,_0x522075){return new BPromise(function(_0x1319e3,_0x4cb7fd){return client[_0x1898('0x9')](_0x1ed03f,_0x522075)['then'](function(_0x4ed2ec){logger[_0x1898('0xa')]('SquareMessage,\x20%s,\x20%s',_0x317606,_0x1898('0xb'));logger[_0x1898('0xc')](_0x1898('0xd'),_0x317606,_0x1898('0xb'),JSON[_0x1898('0xe')](_0x4ed2ec));if(_0x4ed2ec[_0x1898('0xf')]){if(_0x4ed2ec[_0x1898('0xf')]['code']===0x1f4){logger[_0x1898('0xf')](_0x1898('0x10'),_0x317606,_0x4ed2ec['error'][_0x1898('0x11')]);return _0x4cb7fd(_0x4ed2ec[_0x1898('0xf')][_0x1898('0x11')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x317606,_0x4ed2ec['error']['message']);return _0x1319e3(_0x4ed2ec[_0x1898('0xf')]['message']);}else{logger[_0x1898('0xa')](_0x1898('0x10'),_0x317606,_0x1898('0xb'));_0x1319e3(_0x4ed2ec['result'][_0x1898('0x11')]);}})['catch'](function(_0x54a196){logger[_0x1898('0xf')](_0x1898('0x10'),_0x317606,_0x54a196);_0x4cb7fd(_0x54a196);});});}exports[_0x1898('0x12')]=function(_0xccb851){var _0x69219=this;return new Promise(function(_0x4f0d5b,_0x181c32){return db['SquareMessage'][_0x1898('0x13')](_0xccb851[_0x1898('0x14')],{'raw':_0xccb851[_0x1898('0x15')]?_0xccb851[_0x1898('0x15')][_0x1898('0x16')]===undefined?!![]:![]:!![]})[_0x1898('0x17')](function(_0x4d4028){logger['info'](_0x1898('0x12'),_0xccb851);logger['debug'](_0x1898('0x12'),_0xccb851,JSON[_0x1898('0xe')](_0x4d4028));_0x4f0d5b(_0x4d4028);})[_0x1898('0x18')](function(_0xe24c45){logger[_0x1898('0xf')](_0x1898('0x12'),_0xe24c45[_0x1898('0x11')],_0xccb851);_0x181c32(_0x69219[_0x1898('0xf')](0x1f4,_0xe24c45[_0x1898('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c13cd34..7edf1fb 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 _0x894a=['create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','show','/:id/test','test','post'];(function(_0x3f4478,_0xdfbf81){var _0x80941b=function(_0x2356d6){while(--_0x2356d6){_0x3f4478['push'](_0x3f4478['shift']());}};_0x80941b(++_0xdfbf81);}(_0x894a,0xcd));var _0xa894=function(_0x1a27a3,_0x27eba1){_0x1a27a3=_0x1a27a3-0x0;var _0x3c10dc=_0x894a[_0x1a27a3];return _0x3c10dc;};'use strict';var multer=require(_0xa894('0x0'));var util=require(_0xa894('0x1'));var path=require(_0xa894('0x2'));var timeout=require(_0xa894('0x3'));var express=require(_0xa894('0x4'));var router=express[_0xa894('0x5')]();var fs_extra=require(_0xa894('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa894('0x7'));var config=require('../../config/environment');var controller=require(_0xa894('0x8'));router[_0xa894('0x9')]('/',auth[_0xa894('0xa')](),controller['index']);router[_0xa894('0x9')]('/:id',auth[_0xa894('0xa')](),controller[_0xa894('0xb')]);router[_0xa894('0x9')](_0xa894('0xc'),auth[_0xa894('0xa')](),timeout('15s'),controller[_0xa894('0xd')]);router[_0xa894('0xe')]('/',auth['isAuthenticated'](),controller[_0xa894('0xf')]);router[_0xa894('0x10')](_0xa894('0x11'),auth[_0xa894('0xa')](),controller['update']);router[_0xa894('0x12')]('/:id',auth[_0xa894('0xa')](),controller[_0xa894('0x13')]);module['exports']=router; \ No newline at end of file +var _0x29a4=['put','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','create'];(function(_0x36d263,_0xac4ccb){var _0xe45579=function(_0x47483f){while(--_0x47483f){_0x36d263['push'](_0x36d263['shift']());}};_0xe45579(++_0xac4ccb);}(_0x29a4,0x94));var _0x429a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x29a4[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0x429a('0x0'));var path=require(_0x429a('0x1'));var timeout=require(_0x429a('0x2'));var express=require('express');var router=express[_0x429a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x429a('0x4'));var config=require('../../config/environment');var controller=require(_0x429a('0x5'));router[_0x429a('0x6')]('/',auth[_0x429a('0x7')](),controller[_0x429a('0x8')]);router[_0x429a('0x6')](_0x429a('0x9'),auth[_0x429a('0x7')](),controller[_0x429a('0xa')]);router[_0x429a('0x6')]('/:id/test',auth[_0x429a('0x7')](),timeout(_0x429a('0xb')),controller[_0x429a('0xc')]);router['post']('/',auth[_0x429a('0x7')](),controller[_0x429a('0xd')]);router[_0x429a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x429a('0xf')]);router[_0x429a('0x10')](_0x429a('0x9'),auth[_0x429a('0x7')](),controller[_0x429a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index cb1e7dd..c0235f3 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 _0x9861=['name','STRING','exports'];(function(_0x535d49,_0x5784a0){var _0x1153f8=function(_0x58ede0){while(--_0x58ede0){_0x535d49['push'](_0x535d49['shift']());}};_0x1153f8(++_0x5784a0);}(_0x9861,0x104));var _0x1986=function(_0x2d77d0,_0x375ca9){_0x2d77d0=_0x2d77d0-0x0;var _0x23ac57=_0x9861[_0x2d77d0];return _0x23ac57;};'use strict';var Sequelize=require('sequelize');module[_0x1986('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1986('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1986('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d64=['STRING','sequelize','exports'];(function(_0x454724,_0x3f207e){var _0x2417ec=function(_0x5daf9c){while(--_0x5daf9c){_0x454724['push'](_0x454724['shift']());}};_0x2417ec(++_0x3f207e);}(_0x8d64,0x14e));var _0x48d6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8d64[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x48d6('0x0'));module[_0x48d6('0x1')]={'name':{'type':Sequelize[_0x48d6('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x48d6('0x2')]},'description':{'type':Sequelize[_0x48d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 541cfe2..5c5b142 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 _0x37c9=['includeAll','include','rows','catch','params','keys','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','dsn','openSync','closeSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','error','name','map','SquareOdbc','rawAttributes','fieldName','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options'];(function(_0x2b75d9,_0x4e7c6e){var _0x5a2ac1=function(_0x8cc2ca){while(--_0x8cc2ca){_0x2b75d9['push'](_0x2b75d9['shift']());}};_0x5a2ac1(++_0x4e7c6e);}(_0x37c9,0xb4));var _0x937c=function(_0x23da97,_0x37718a){_0x23da97=_0x23da97-0x0;var _0x4c9aff=_0x37c9[_0x23da97];return _0x4c9aff;};'use strict';var emlformat=require(_0x937c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x937c('0x1'));var jsonpatch=require(_0x937c('0x2'));var rp=require('request-promise');var moment=require(_0x937c('0x3'));var BPromise=require(_0x937c('0x4'));var Mustache=require('mustache');var util=require(_0x937c('0x5'));var path=require(_0x937c('0x6'));var sox=require(_0x937c('0x7'));var csv=require(_0x937c('0x8'));var ejs=require(_0x937c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x937c('0xa'));var squel=require(_0x937c('0xb'));var crypto=require(_0x937c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x937c('0xd'));var toCsv=require(_0x937c('0x8'));var querystring=require(_0x937c('0xe'));var Papa=require(_0x937c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x937c('0x10'));var hardwareService=require(_0x937c('0x11'));var logger=require(_0x937c('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x937c('0x13'));var licenseUtil=require(_0x937c('0x14'));var db=require(_0x937c('0x15'))['db'];function respondWithStatusCode(_0x478b2e,_0x305a7f){_0x305a7f=_0x305a7f||0xcc;return function(_0x2850bb){if(_0x2850bb){return _0x478b2e[_0x937c('0x16')](_0x305a7f);}return _0x478b2e[_0x937c('0x17')](_0x305a7f)['end']();};}function respondWithResult(_0x188f1c,_0x2b58f4){_0x2b58f4=_0x2b58f4||0xc8;return function(_0x3bb6d7){if(_0x3bb6d7){return _0x188f1c[_0x937c('0x17')](_0x2b58f4)[_0x937c('0x18')](_0x3bb6d7);}};}function respondWithFilteredResult(_0x391736,_0x2a6011){return function(_0x3c4238){if(_0x3c4238){var _0x3bcb84=typeof _0x2a6011[_0x937c('0x19')]===_0x937c('0x1a')&&typeof _0x2a6011[_0x937c('0x1b')]===_0x937c('0x1a');var _0x52822a=_0x3c4238[_0x937c('0x1c')];var _0x3c94c7=_0x3bcb84?0x0:_0x2a6011[_0x937c('0x19')];var _0x5e560f=_0x3bcb84?_0x3c4238[_0x937c('0x1c')]:_0x2a6011[_0x937c('0x19')]+_0x2a6011['limit'];var _0x3c10dc;if(_0x5e560f>=_0x52822a){_0x5e560f=_0x52822a;_0x3c10dc=0xc8;}else{_0x3c10dc=0xce;}_0x391736[_0x937c('0x17')](_0x3c10dc);return _0x391736[_0x937c('0x1d')](_0x937c('0x1e'),_0x3c94c7+'-'+_0x5e560f+'/'+_0x52822a)[_0x937c('0x18')](_0x3c4238);}return null;};}function patchUpdates(_0x43c324){return function(_0x5e0873){try{jsonpatch[_0x937c('0x1f')](_0x5e0873,_0x43c324,!![]);}catch(_0x19c10e){return BPromise[_0x937c('0x20')](_0x19c10e);}return _0x5e0873[_0x937c('0x21')]();};}function saveUpdates(_0x217525,_0x3fb940){return function(_0x130492){if(_0x130492){return _0x130492[_0x937c('0x22')](_0x217525)[_0x937c('0x23')](function(_0x33bd26){return _0x33bd26;});}return null;};}function removeEntity(_0x621766,_0x204729){return function(_0x254578){if(_0x254578){return _0x254578[_0x937c('0x24')]()[_0x937c('0x23')](function(){var _0x3a954d=_0x254578['get']({'plain':!![]});var _0x4a0e46=_0x937c('0x25');return db['UserProfileResource'][_0x937c('0x24')]({'where':{'type':_0x4a0e46,'resourceId':_0x3a954d['id']}})['then'](function(){return _0x254578;});})[_0x937c('0x23')](function(){_0x621766[_0x937c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559896,_0x1e8c63){return function(_0x2335a0){if(!_0x2335a0){_0x559896[_0x937c('0x16')](0x194);}return _0x2335a0;};}function handleError(_0x16f0c3,_0xf1c3bb){_0xf1c3bb=_0xf1c3bb||0x1f4;return function(_0x53994b){logger[_0x937c('0x26')](_0x53994b['stack']);if(_0x53994b[_0x937c('0x27')]){delete _0x53994b[_0x937c('0x27')];}_0x16f0c3[_0x937c('0x17')](_0xf1c3bb)['send'](_0x53994b);};}exports['index']=function(_0x496f88,_0xabafcf){var _0x3ed729={},_0x51ece0={},_0x5efeea={'count':0x0,'rows':[]};var _0x4754cd=_[_0x937c('0x28')](db[_0x937c('0x29')][_0x937c('0x2a')],function(_0xed1a3f){return{'name':_0xed1a3f[_0x937c('0x2b')],'type':_0xed1a3f['type']['key']};});_0x51ece0[_0x937c('0x2c')]=_[_0x937c('0x28')](_0x4754cd,_0x937c('0x27'));_0x51ece0[_0x937c('0x2d')]=_['keys'](_0x496f88[_0x937c('0x2d')]);_0x51ece0[_0x937c('0x2e')]=_['intersection'](_0x51ece0[_0x937c('0x2c')],_0x51ece0['query']);_0x3ed729[_0x937c('0x2f')]=_[_0x937c('0x30')](_0x51ece0[_0x937c('0x2c')],qs['fields'](_0x496f88['query']['fields']));_0x3ed729[_0x937c('0x2f')]=_0x3ed729[_0x937c('0x2f')][_0x937c('0x31')]?_0x3ed729[_0x937c('0x2f')]:_0x51ece0[_0x937c('0x2c')];if(!_0x496f88[_0x937c('0x2d')][_0x937c('0x32')](_0x937c('0x33'))){_0x3ed729[_0x937c('0x1b')]=qs[_0x937c('0x1b')](_0x496f88['query']['limit']);_0x3ed729[_0x937c('0x19')]=qs[_0x937c('0x19')](_0x496f88[_0x937c('0x2d')][_0x937c('0x19')]);}_0x3ed729[_0x937c('0x34')]=qs[_0x937c('0x35')](_0x496f88[_0x937c('0x2d')]['sort']);_0x3ed729['where']=qs[_0x937c('0x2e')](_[_0x937c('0x36')](_0x496f88[_0x937c('0x2d')],_0x51ece0['filters']),_0x4754cd);if(_0x496f88[_0x937c('0x2d')]['filter']){_0x3ed729[_0x937c('0x37')]=_[_0x937c('0x38')](_0x3ed729[_0x937c('0x37')],{'$or':_['map'](_0x4754cd,function(_0x364511){if(_0x364511['type']!==_0x937c('0x39')){var _0x2b31af={};_0x2b31af[_0x364511[_0x937c('0x27')]]={'$like':'%'+_0x496f88['query'][_0x937c('0x3a')]+'%'};return _0x2b31af;}})});}_0x3ed729=_['merge']({},_0x3ed729,_0x496f88[_0x937c('0x3b')]);var _0x2c028a={'where':_0x3ed729[_0x937c('0x37')]};return db[_0x937c('0x29')][_0x937c('0x1c')](_0x2c028a)['then'](function(_0x4726fe){_0x5efeea['count']=_0x4726fe;if(_0x496f88[_0x937c('0x2d')][_0x937c('0x3c')]){_0x3ed729[_0x937c('0x3d')]=[{'all':!![]}];}return db[_0x937c('0x29')]['findAll'](_0x3ed729);})[_0x937c('0x23')](function(_0x36917e){_0x5efeea[_0x937c('0x3e')]=_0x36917e;return _0x5efeea;})[_0x937c('0x23')](respondWithFilteredResult(_0xabafcf,_0x3ed729))[_0x937c('0x3f')](handleError(_0xabafcf,null));};exports['show']=function(_0xa31c18,_0x3fe924){var _0x2b7b05={'raw':!![],'where':{'id':_0xa31c18[_0x937c('0x40')]['id']}},_0x2404c1={};_0x2404c1['model']=_['keys'](db[_0x937c('0x29')][_0x937c('0x2a')]);_0x2404c1[_0x937c('0x2d')]=_[_0x937c('0x41')](_0xa31c18[_0x937c('0x2d')]);_0x2404c1[_0x937c('0x2e')]=_[_0x937c('0x30')](_0x2404c1[_0x937c('0x2c')],_0x2404c1[_0x937c('0x2d')]);_0x2b7b05[_0x937c('0x2f')]=_[_0x937c('0x30')](_0x2404c1['model'],qs[_0x937c('0x42')](_0xa31c18['query']['fields']));_0x2b7b05[_0x937c('0x2f')]=_0x2b7b05[_0x937c('0x2f')][_0x937c('0x31')]?_0x2b7b05[_0x937c('0x2f')]:_0x2404c1['model'];if(_0xa31c18[_0x937c('0x2d')][_0x937c('0x3c')]){_0x2b7b05[_0x937c('0x3d')]=[{'all':!![]}];}_0x2b7b05=_[_0x937c('0x38')]({},_0x2b7b05,_0xa31c18[_0x937c('0x3b')]);return db[_0x937c('0x29')][_0x937c('0x43')](_0x2b7b05)[_0x937c('0x23')](handleEntityNotFound(_0x3fe924,null))['then'](respondWithResult(_0x3fe924,null))[_0x937c('0x3f')](handleError(_0x3fe924,null));};exports[_0x937c('0x44')]=function(_0x58def4,_0x449a8e){return db[_0x937c('0x29')][_0x937c('0x44')](_0x58def4[_0x937c('0x45')],{})[_0x937c('0x23')](function(_0x3c2a2b){var _0x49bb18=_0x58def4[_0x937c('0x46')][_0x937c('0x47')]({'plain':!![]});if(!_0x49bb18)throw new Error(_0x937c('0x48'));if(_0x49bb18['role']===_0x937c('0x46')){var _0x56ccc1=_0x3c2a2b[_0x937c('0x47')]({'plain':!![]});var _0x3de3e2=_0x937c('0x25');return db[_0x937c('0x49')][_0x937c('0x43')]({'where':{'name':_0x3de3e2,'userProfileId':_0x49bb18[_0x937c('0x4a')]},'raw':!![]})[_0x937c('0x23')](function(_0x36031f){if(_0x36031f&&_0x36031f[_0x937c('0x4b')]===0x0){return db[_0x937c('0x4c')][_0x937c('0x44')]({'name':_0x56ccc1['name'],'resourceId':_0x56ccc1['id'],'type':_0x36031f[_0x937c('0x27')],'sectionId':_0x36031f['id']},{})[_0x937c('0x23')](function(){return _0x3c2a2b;});}else{return _0x3c2a2b;}})[_0x937c('0x3f')](function(_0x1e68d5){logger[_0x937c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e68d5);throw _0x1e68d5;});}return _0x3c2a2b;})[_0x937c('0x23')](respondWithResult(_0x449a8e,0xc9))[_0x937c('0x3f')](handleError(_0x449a8e,null));};exports[_0x937c('0x22')]=function(_0x47ae6a,_0x389248){if(_0x47ae6a['body']['id']){delete _0x47ae6a[_0x937c('0x45')]['id'];}return db[_0x937c('0x29')]['find']({'where':{'id':_0x47ae6a[_0x937c('0x40')]['id']}})[_0x937c('0x23')](handleEntityNotFound(_0x389248,null))[_0x937c('0x23')](saveUpdates(_0x47ae6a['body'],null))[_0x937c('0x23')](respondWithResult(_0x389248,null))[_0x937c('0x3f')](handleError(_0x389248,null));};exports['destroy']=function(_0x1311e2,_0x59547e){return db[_0x937c('0x29')][_0x937c('0x43')]({'where':{'id':_0x1311e2['params']['id']}})[_0x937c('0x23')](handleEntityNotFound(_0x59547e,null))[_0x937c('0x23')](removeEntity(_0x59547e,null))['catch'](handleError(_0x59547e,null));};exports['test']=function(_0x2efdce,_0x122003,_0x106408){var _0x22a57a;return db[_0x937c('0x29')]['find']({'where':{'id':_0x2efdce['params']['id']},'attributes':['id',_0x937c('0x4d')]})[_0x937c('0x23')](handleEntityNotFound(_0x122003,null))[_0x937c('0x23')](function(_0x9ba7dc){if(_0x9ba7dc){var _0x3717a7=require('odbc')();_0x3717a7[_0x937c('0x4e')](_0x9ba7dc['dsn']);_0x3717a7[_0x937c('0x4f')]();return _0x9ba7dc;}})[_0x937c('0x23')](respondWithResult(_0x122003,null))[_0x937c('0x3f')](handleError(_0x122003,null));}; \ No newline at end of file +var _0x968c=['catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','index','map','SquareOdbc','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows'];(function(_0x4411cc,_0x52dd43){var _0x62e0be=function(_0x4ce456){while(--_0x4ce456){_0x4411cc['push'](_0x4411cc['shift']());}};_0x62e0be(++_0x52dd43);}(_0x968c,0x6e));var _0xc968=function(_0x239263,_0x11b35f){_0x239263=_0x239263-0x0;var _0x4668fa=_0x968c[_0x239263];return _0x4668fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc968('0x0'));var zipdir=require(_0xc968('0x1'));var jsonpatch=require(_0xc968('0x2'));var rp=require(_0xc968('0x3'));var moment=require(_0xc968('0x4'));var BPromise=require(_0xc968('0x5'));var Mustache=require(_0xc968('0x6'));var util=require(_0xc968('0x7'));var path=require(_0xc968('0x8'));var sox=require('sox');var csv=require(_0xc968('0x9'));var ejs=require(_0xc968('0xa'));var fs=require('fs');var fs_extra=require(_0xc968('0xb'));var _=require(_0xc968('0xc'));var squel=require(_0xc968('0xd'));var crypto=require('crypto');var jsforce=require(_0xc968('0xe'));var deskjs=require(_0xc968('0xf'));var toCsv=require(_0xc968('0x9'));var querystring=require(_0xc968('0x10'));var Papa=require(_0xc968('0x11'));var Redis=require(_0xc968('0x12'));var authService=require(_0xc968('0x13'));var qs=require(_0xc968('0x14'));var as=require(_0xc968('0x15'));var hardwareService=require(_0xc968('0x16'));var logger=require(_0xc968('0x17'))(_0xc968('0x18'));var utils=require(_0xc968('0x19'));var config=require(_0xc968('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc968('0x1b'))['db'];function respondWithStatusCode(_0x552836,_0xa01eea){_0xa01eea=_0xa01eea||0xcc;return function(_0x30819b){if(_0x30819b){return _0x552836[_0xc968('0x1c')](_0xa01eea);}return _0x552836['status'](_0xa01eea)[_0xc968('0x1d')]();};}function respondWithResult(_0x5e8bb9,_0x2fc1ea){_0x2fc1ea=_0x2fc1ea||0xc8;return function(_0x74e2ff){if(_0x74e2ff){return _0x5e8bb9[_0xc968('0x1e')](_0x2fc1ea)[_0xc968('0x1f')](_0x74e2ff);}};}function respondWithFilteredResult(_0x397deb,_0x47945a){return function(_0x26ac9a){if(_0x26ac9a){var _0x432831=typeof _0x47945a[_0xc968('0x20')]===_0xc968('0x21')&&typeof _0x47945a['limit']===_0xc968('0x21');var _0x546b9d=_0x26ac9a['count'];var _0x1d5a7a=_0x432831?0x0:_0x47945a[_0xc968('0x20')];var _0x415d1f=_0x432831?_0x26ac9a['count']:_0x47945a[_0xc968('0x20')]+_0x47945a[_0xc968('0x22')];var _0x37c719;if(_0x415d1f>=_0x546b9d){_0x415d1f=_0x546b9d;_0x37c719=0xc8;}else{_0x37c719=0xce;}_0x397deb[_0xc968('0x1e')](_0x37c719);return _0x397deb[_0xc968('0x23')](_0xc968('0x24'),_0x1d5a7a+'-'+_0x415d1f+'/'+_0x546b9d)[_0xc968('0x1f')](_0x26ac9a);}return null;};}function patchUpdates(_0x5056cd){return function(_0x24f2a6){try{jsonpatch[_0xc968('0x25')](_0x24f2a6,_0x5056cd,!![]);}catch(_0x28cf72){return BPromise[_0xc968('0x26')](_0x28cf72);}return _0x24f2a6['save']();};}function saveUpdates(_0x14d330,_0x1f344d){return function(_0x290513){if(_0x290513){return _0x290513[_0xc968('0x27')](_0x14d330)[_0xc968('0x28')](function(_0x4f6d88){return _0x4f6d88;});}return null;};}function removeEntity(_0x2f6c9d,_0xcbbeb7){return function(_0x210031){if(_0x210031){return _0x210031[_0xc968('0x29')]()['then'](function(){var _0x13959f=_0x210031[_0xc968('0x2a')]({'plain':!![]});var _0x477fb4='ODBC';return db[_0xc968('0x2b')][_0xc968('0x29')]({'where':{'type':_0x477fb4,'resourceId':_0x13959f['id']}})[_0xc968('0x28')](function(){return _0x210031;});})[_0xc968('0x28')](function(){_0x2f6c9d[_0xc968('0x1e')](0xcc)[_0xc968('0x1d')]();});}};}function handleEntityNotFound(_0x35451b,_0x33cbf3){return function(_0x42daed){if(!_0x42daed){_0x35451b[_0xc968('0x1c')](0x194);}return _0x42daed;};}function handleError(_0x2ed541,_0x37cfdd){_0x37cfdd=_0x37cfdd||0x1f4;return function(_0xe5f7fc){logger[_0xc968('0x2c')](_0xe5f7fc['stack']);if(_0xe5f7fc[_0xc968('0x2d')]){delete _0xe5f7fc['name'];}_0x2ed541[_0xc968('0x1e')](_0x37cfdd)['send'](_0xe5f7fc);};}exports[_0xc968('0x2e')]=function(_0x50adc5,_0x227c7c){var _0x9f0b53={},_0x4e19a3={},_0x5d97c6={'count':0x0,'rows':[]};var _0x59cb06=_[_0xc968('0x2f')](db[_0xc968('0x30')][_0xc968('0x31')],function(_0x41f977){return{'name':_0x41f977['fieldName'],'type':_0x41f977[_0xc968('0x32')]['key']};});_0x4e19a3[_0xc968('0x33')]=_[_0xc968('0x2f')](_0x59cb06,'name');_0x4e19a3[_0xc968('0x34')]=_[_0xc968('0x35')](_0x50adc5[_0xc968('0x34')]);_0x4e19a3[_0xc968('0x36')]=_['intersection'](_0x4e19a3[_0xc968('0x33')],_0x4e19a3[_0xc968('0x34')]);_0x9f0b53[_0xc968('0x37')]=_[_0xc968('0x38')](_0x4e19a3[_0xc968('0x33')],qs['fields'](_0x50adc5[_0xc968('0x34')][_0xc968('0x39')]));_0x9f0b53[_0xc968('0x37')]=_0x9f0b53[_0xc968('0x37')][_0xc968('0x3a')]?_0x9f0b53['attributes']:_0x4e19a3['model'];if(!_0x50adc5['query'][_0xc968('0x3b')](_0xc968('0x3c'))){_0x9f0b53[_0xc968('0x22')]=qs['limit'](_0x50adc5[_0xc968('0x34')][_0xc968('0x22')]);_0x9f0b53[_0xc968('0x20')]=qs[_0xc968('0x20')](_0x50adc5[_0xc968('0x34')][_0xc968('0x20')]);}_0x9f0b53['order']=qs[_0xc968('0x3d')](_0x50adc5[_0xc968('0x34')]['sort']);_0x9f0b53['where']=qs[_0xc968('0x36')](_[_0xc968('0x3e')](_0x50adc5[_0xc968('0x34')],_0x4e19a3[_0xc968('0x36')]),_0x59cb06);if(_0x50adc5['query'][_0xc968('0x3f')]){_0x9f0b53[_0xc968('0x40')]=_[_0xc968('0x41')](_0x9f0b53['where'],{'$or':_[_0xc968('0x2f')](_0x59cb06,function(_0x198c6c){if(_0x198c6c[_0xc968('0x32')]!==_0xc968('0x42')){var _0x10ea04={};_0x10ea04[_0x198c6c['name']]={'$like':'%'+_0x50adc5[_0xc968('0x34')]['filter']+'%'};return _0x10ea04;}})});}_0x9f0b53=_[_0xc968('0x41')]({},_0x9f0b53,_0x50adc5[_0xc968('0x43')]);var _0x183375={'where':_0x9f0b53[_0xc968('0x40')]};return db['SquareOdbc'][_0xc968('0x44')](_0x183375)[_0xc968('0x28')](function(_0x2ef4b5){_0x5d97c6['count']=_0x2ef4b5;if(_0x50adc5[_0xc968('0x34')][_0xc968('0x45')]){_0x9f0b53['include']=[{'all':!![]}];}return db[_0xc968('0x30')][_0xc968('0x46')](_0x9f0b53);})['then'](function(_0x1b7611){_0x5d97c6[_0xc968('0x47')]=_0x1b7611;return _0x5d97c6;})[_0xc968('0x28')](respondWithFilteredResult(_0x227c7c,_0x9f0b53))[_0xc968('0x48')](handleError(_0x227c7c,null));};exports[_0xc968('0x49')]=function(_0xee7612,_0x27541f){var _0x3f57b3={'raw':!![],'where':{'id':_0xee7612[_0xc968('0x4a')]['id']}},_0x4f1173={};_0x4f1173[_0xc968('0x33')]=_['keys'](db[_0xc968('0x30')]['rawAttributes']);_0x4f1173[_0xc968('0x34')]=_[_0xc968('0x35')](_0xee7612['query']);_0x4f1173[_0xc968('0x36')]=_[_0xc968('0x38')](_0x4f1173[_0xc968('0x33')],_0x4f1173[_0xc968('0x34')]);_0x3f57b3[_0xc968('0x37')]=_[_0xc968('0x38')](_0x4f1173['model'],qs[_0xc968('0x39')](_0xee7612[_0xc968('0x34')][_0xc968('0x39')]));_0x3f57b3[_0xc968('0x37')]=_0x3f57b3[_0xc968('0x37')][_0xc968('0x3a')]?_0x3f57b3[_0xc968('0x37')]:_0x4f1173[_0xc968('0x33')];if(_0xee7612[_0xc968('0x34')][_0xc968('0x45')]){_0x3f57b3[_0xc968('0x4b')]=[{'all':!![]}];}_0x3f57b3=_[_0xc968('0x41')]({},_0x3f57b3,_0xee7612[_0xc968('0x43')]);return db[_0xc968('0x30')][_0xc968('0x4c')](_0x3f57b3)[_0xc968('0x28')](handleEntityNotFound(_0x27541f,null))['then'](respondWithResult(_0x27541f,null))['catch'](handleError(_0x27541f,null));};exports[_0xc968('0x4d')]=function(_0xa34458,_0x529bd8){return db[_0xc968('0x30')][_0xc968('0x4d')](_0xa34458[_0xc968('0x4e')],{})[_0xc968('0x28')](function(_0x415893){var _0x21274b=_0xa34458[_0xc968('0x4f')][_0xc968('0x2a')]({'plain':!![]});if(!_0x21274b)throw new Error(_0xc968('0x50'));if(_0x21274b[_0xc968('0x51')]===_0xc968('0x4f')){var _0x322bf3=_0x415893['get']({'plain':!![]});var _0x170929=_0xc968('0x52');return db['UserProfileSection'][_0xc968('0x4c')]({'where':{'name':_0x170929,'userProfileId':_0x21274b[_0xc968('0x53')]},'raw':!![]})[_0xc968('0x28')](function(_0x35980b){if(_0x35980b&&_0x35980b[_0xc968('0x54')]===0x0){return db[_0xc968('0x2b')][_0xc968('0x4d')]({'name':_0x322bf3[_0xc968('0x2d')],'resourceId':_0x322bf3['id'],'type':_0x35980b[_0xc968('0x2d')],'sectionId':_0x35980b['id']},{})['then'](function(){return _0x415893;});}else{return _0x415893;}})[_0xc968('0x48')](function(_0x50b91e){logger[_0xc968('0x2c')](_0xc968('0x55'),_0x50b91e);throw _0x50b91e;});}return _0x415893;})[_0xc968('0x28')](respondWithResult(_0x529bd8,0xc9))[_0xc968('0x48')](handleError(_0x529bd8,null));};exports[_0xc968('0x27')]=function(_0x1fb0af,_0xf99f85){if(_0x1fb0af[_0xc968('0x4e')]['id']){delete _0x1fb0af[_0xc968('0x4e')]['id'];}return db[_0xc968('0x30')]['find']({'where':{'id':_0x1fb0af[_0xc968('0x4a')]['id']}})[_0xc968('0x28')](handleEntityNotFound(_0xf99f85,null))[_0xc968('0x28')](saveUpdates(_0x1fb0af['body'],null))['then'](respondWithResult(_0xf99f85,null))[_0xc968('0x48')](handleError(_0xf99f85,null));};exports[_0xc968('0x29')]=function(_0x54e3c7,_0x553c1f){return db[_0xc968('0x30')][_0xc968('0x4c')]({'where':{'id':_0x54e3c7[_0xc968('0x4a')]['id']}})['then'](handleEntityNotFound(_0x553c1f,null))['then'](removeEntity(_0x553c1f,null))[_0xc968('0x48')](handleError(_0x553c1f,null));};exports[_0xc968('0x56')]=function(_0x2127e9,_0x842883,_0x526900){var _0x8c9e0c;return db['SquareOdbc'][_0xc968('0x4c')]({'where':{'id':_0x2127e9[_0xc968('0x4a')]['id']},'attributes':['id',_0xc968('0x57')]})['then'](handleEntityNotFound(_0x842883,null))[_0xc968('0x28')](function(_0x366a92){if(_0x366a92){var _0x241179=require(_0xc968('0x58'))();_0x241179[_0xc968('0x59')](_0x366a92[_0xc968('0x57')]);_0x241179[_0xc968('0x5a')]();return _0x366a92;}})[_0xc968('0x28')](respondWithResult(_0x842883,null))[_0xc968('0x48')](handleError(_0x842883,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e81bf43..9c3188a 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 _0x5313=['path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x49bba6,_0x4ef0b9){var _0x4da95b=function(_0x504476){while(--_0x504476){_0x49bba6['push'](_0x49bba6['shift']());}};_0x4da95b(++_0x4ef0b9);}(_0x5313,0x1dd));var _0x3531=function(_0x39e376,_0x8d3339){_0x39e376=_0x39e376-0x0;var _0x488e7c=_0x5313[_0x39e376];return _0x488e7c;};'use strict';var _=require(_0x3531('0x0'));var util=require(_0x3531('0x1'));var logger=require(_0x3531('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3531('0x3'));var rimraf=require(_0x3531('0x4'));var config=require(_0x3531('0x5'));var attributes=require(_0x3531('0x6'));module['exports']=function(_0x540927,_0x18c7bb){return _0x540927[_0x3531('0x7')](_0x3531('0x8'),attributes,{'tableName':_0x3531('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a61=['square_odbc','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x3e963d,_0x711736){var _0x257559=function(_0x1087c8){while(--_0x1087c8){_0x3e963d['push'](_0x3e963d['shift']());}};_0x257559(++_0x711736);}(_0x1a61,0x1cd));var _0x11a6=function(_0x1ec168,_0x50a21b){_0x1ec168=_0x1ec168-0x0;var _0xc2a3c0=_0x1a61[_0x1ec168];return _0xc2a3c0;};'use strict';var _=require('lodash');var util=require(_0x11a6('0x0'));var logger=require('../../config/logger')(_0x11a6('0x1'));var moment=require(_0x11a6('0x2'));var BPromise=require(_0x11a6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11a6('0x4'));var rimraf=require(_0x11a6('0x5'));var config=require(_0x11a6('0x6'));var attributes=require(_0x11a6('0x7'));module[_0x11a6('0x8')]=function(_0x119cfb,_0x3634ad){return _0x119cfb['define']('SquareOdbc',attributes,{'tableName':_0x11a6('0x9'),'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 2d4f03d..c318408 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 _0x5ef7=['stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','include','map','attributes','model','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0xb6dcc9,_0x47a19c){var _0x4c0588=function(_0x5edaa4){while(--_0x5edaa4){_0xb6dcc9['push'](_0xb6dcc9['shift']());}};_0x4c0588(++_0x47a19c);}(_0x5ef7,0x1a2));var _0x75ef=function(_0x553790,_0xc60917){_0x553790=_0x553790-0x0;var _0x29b8f0=_0x5ef7[_0x553790];return _0x29b8f0;};'use strict';var _=require(_0x75ef('0x0'));var util=require('util');var moment=require(_0x75ef('0x1'));var BPromise=require(_0x75ef('0x2'));var rs=require(_0x75ef('0x3'));var fs=require('fs');var Redis=require(_0x75ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75ef('0x5'));var logger=require('../../config/logger')(_0x75ef('0x6'));var config=require(_0x75ef('0x7'));var jayson=require(_0x75ef('0x8'));var client=jayson[_0x75ef('0x9')][_0x75ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25f51f,_0x4611a2,_0x5ec303){return new BPromise(function(_0xbfe631,_0x55f3ad){return client['request'](_0x25f51f,_0x5ec303)[_0x75ef('0xb')](function(_0x293cc3){logger['info'](_0x75ef('0xc'),_0x4611a2,_0x75ef('0xd'));logger[_0x75ef('0xe')](_0x75ef('0xf'),_0x4611a2,_0x75ef('0xd'),JSON[_0x75ef('0x10')](_0x293cc3));if(_0x293cc3[_0x75ef('0x11')]){if(_0x293cc3['error'][_0x75ef('0x12')]===0x1f4){logger[_0x75ef('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4611a2,_0x293cc3[_0x75ef('0x11')][_0x75ef('0x13')]);return _0x55f3ad(_0x293cc3['error'][_0x75ef('0x13')]);}logger[_0x75ef('0x11')](_0x75ef('0xc'),_0x4611a2,_0x293cc3[_0x75ef('0x11')][_0x75ef('0x13')]);return _0xbfe631(_0x293cc3[_0x75ef('0x11')][_0x75ef('0x13')]);}else{logger[_0x75ef('0x14')](_0x75ef('0xc'),_0x4611a2,_0x75ef('0xd'));_0xbfe631(_0x293cc3[_0x75ef('0x15')][_0x75ef('0x13')]);}})[_0x75ef('0x16')](function(_0x39370f){logger[_0x75ef('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4611a2,_0x39370f);_0x55f3ad(_0x39370f);});});}exports[_0x75ef('0x17')]=function(_0x37734a){var _0x286af8=this;return new Promise(function(_0x18d1f9,_0x31fcf1){return db[_0x75ef('0x18')][_0x75ef('0x19')]({'raw':_0x37734a[_0x75ef('0x1a')]?_0x37734a[_0x75ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x37734a[_0x75ef('0x1a')]?_0x37734a[_0x75ef('0x1a')]['where']||null:null,'attributes':_0x37734a[_0x75ef('0x1a')]?_0x37734a[_0x75ef('0x1a')]['attributes']||null:null,'include':_0x37734a[_0x75ef('0x1a')]?_0x37734a[_0x75ef('0x1a')][_0x75ef('0x1b')]?_[_0x75ef('0x1c')](_0x37734a['options'][_0x75ef('0x1b')],function(_0xa4f3f9){return{'model':db[_0xa4f3f9['model']],'as':_0xa4f3f9['as'],'attributes':_0xa4f3f9[_0x75ef('0x1d')],'include':_0xa4f3f9[_0x75ef('0x1b')]?_[_0x75ef('0x1c')](_0xa4f3f9[_0x75ef('0x1b')],function(_0x14289d){return{'model':db[_0x14289d[_0x75ef('0x1e')]],'as':_0x14289d['as'],'attributes':_0x14289d[_0x75ef('0x1d')],'include':_0x14289d[_0x75ef('0x1b')]?_['map'](_0x14289d['include'],function(_0x46745c){return{'model':db[_0x46745c[_0x75ef('0x1e')]],'as':_0x46745c['as'],'attributes':_0x46745c[_0x75ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x75ef('0xb')](function(_0x4d3d33){logger[_0x75ef('0x14')]('ShowSquareOdbc',_0x37734a);logger[_0x75ef('0xe')](_0x75ef('0x17'),_0x37734a,JSON[_0x75ef('0x10')](_0x4d3d33));_0x18d1f9(_0x4d3d33);})[_0x75ef('0x16')](function(_0x39f553){logger[_0x75ef('0x11')](_0x75ef('0x17'),_0x39f553['message'],_0x37734a);_0x31fcf1(_0x286af8[_0x75ef('0x11')](0x1f4,_0x39f553[_0x75ef('0x13')]));});});}; \ No newline at end of file +var _0x0876=['result','ShowSquareOdbc','options','attributes','include','map','model','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x59a064,_0x46819e){var _0x1cef19=function(_0x325b41){while(--_0x325b41){_0x59a064['push'](_0x59a064['shift']());}};_0x1cef19(++_0x46819e);}(_0x0876,0x164));var _0x6087=function(_0x483800,_0x486762){_0x483800=_0x483800-0x0;var _0x5ee30b=_0x0876[_0x483800];return _0x5ee30b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6087('0x0'));var BPromise=require('bluebird');var rs=require(_0x6087('0x1'));var fs=require('fs');var Redis=require(_0x6087('0x2'));var db=require(_0x6087('0x3'))['db'];var utils=require(_0x6087('0x4'));var logger=require(_0x6087('0x5'))(_0x6087('0x6'));var config=require(_0x6087('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6087('0x8')][_0x6087('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d8b78,_0x345a6d,_0x17a0f6){return new BPromise(function(_0x503c40,_0x2e2b72){return client[_0x6087('0xa')](_0x5d8b78,_0x17a0f6)[_0x6087('0xb')](function(_0x551a00){logger[_0x6087('0xc')](_0x6087('0xd'),_0x345a6d,_0x6087('0xe'));logger[_0x6087('0xf')](_0x6087('0x10'),_0x345a6d,_0x6087('0xe'),JSON[_0x6087('0x11')](_0x551a00));if(_0x551a00[_0x6087('0x12')]){if(_0x551a00[_0x6087('0x12')][_0x6087('0x13')]===0x1f4){logger[_0x6087('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x345a6d,_0x551a00['error'][_0x6087('0x14')]);return _0x2e2b72(_0x551a00[_0x6087('0x12')]['message']);}logger[_0x6087('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x345a6d,_0x551a00[_0x6087('0x12')][_0x6087('0x14')]);return _0x503c40(_0x551a00[_0x6087('0x12')][_0x6087('0x14')]);}else{logger['info'](_0x6087('0xd'),_0x345a6d,'request\x20sent');_0x503c40(_0x551a00[_0x6087('0x15')][_0x6087('0x14')]);}})['catch'](function(_0x3dba88){logger[_0x6087('0x12')](_0x6087('0xd'),_0x345a6d,_0x3dba88);_0x2e2b72(_0x3dba88);});});}exports[_0x6087('0x16')]=function(_0x3ebdf3){var _0x30585d=this;return new Promise(function(_0x12f33c,_0x5b6ebe){return db['SquareOdbc']['find']({'raw':_0x3ebdf3[_0x6087('0x17')]?_0x3ebdf3[_0x6087('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3ebdf3[_0x6087('0x17')]?_0x3ebdf3[_0x6087('0x17')]['where']||null:null,'attributes':_0x3ebdf3['options']?_0x3ebdf3['options'][_0x6087('0x18')]||null:null,'include':_0x3ebdf3[_0x6087('0x17')]?_0x3ebdf3[_0x6087('0x17')][_0x6087('0x19')]?_[_0x6087('0x1a')](_0x3ebdf3[_0x6087('0x17')][_0x6087('0x19')],function(_0x4d1ef0){return{'model':db[_0x4d1ef0[_0x6087('0x1b')]],'as':_0x4d1ef0['as'],'attributes':_0x4d1ef0[_0x6087('0x18')],'include':_0x4d1ef0[_0x6087('0x19')]?_[_0x6087('0x1a')](_0x4d1ef0[_0x6087('0x19')],function(_0x3053e8){return{'model':db[_0x3053e8[_0x6087('0x1b')]],'as':_0x3053e8['as'],'attributes':_0x3053e8[_0x6087('0x18')],'include':_0x3053e8[_0x6087('0x19')]?_[_0x6087('0x1a')](_0x3053e8[_0x6087('0x19')],function(_0x25a010){return{'model':db[_0x25a010[_0x6087('0x1b')]],'as':_0x25a010['as'],'attributes':_0x25a010['attributes']};}):[]};}):[]};}):[]:[]})[_0x6087('0xb')](function(_0x43fc02){logger[_0x6087('0xc')](_0x6087('0x16'),_0x3ebdf3);logger['debug'](_0x6087('0x16'),_0x3ebdf3,JSON[_0x6087('0x11')](_0x43fc02));_0x12f33c(_0x43fc02);})[_0x6087('0x1c')](function(_0x13da9c){logger[_0x6087('0x12')](_0x6087('0x16'),_0x13da9c['message'],_0x3ebdf3);_0x5b6ebe(_0x30585d[_0x6087('0x12')](0x1f4,_0x13da9c[_0x6087('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 54887db..34f74e2 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 _0x19eb=['/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','index'];(function(_0x30b8da,_0x282d8f){var _0x429af1=function(_0x6348ee){while(--_0x6348ee){_0x30b8da['push'](_0x30b8da['shift']());}};_0x429af1(++_0x282d8f);}(_0x19eb,0x14b));var _0xb19e=function(_0x22c393,_0x1f2389){_0x22c393=_0x22c393-0x0;var _0x161580=_0x19eb[_0x22c393];return _0x161580;};'use strict';var multer=require(_0xb19e('0x0'));var util=require(_0xb19e('0x1'));var path=require(_0xb19e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb19e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb19e('0x4'));var interaction=require(_0xb19e('0x5'));var config=require('../../config/environment');var controller=require(_0xb19e('0x6'));router[_0xb19e('0x7')]('/',auth['isAuthenticated'](),controller[_0xb19e('0x8')]);router[_0xb19e('0x7')](_0xb19e('0x9'),auth[_0xb19e('0xa')](),controller['show']);router[_0xb19e('0xb')]('/',auth[_0xb19e('0xa')](),controller[_0xb19e('0xc')]);router[_0xb19e('0xd')](_0xb19e('0x9'),auth[_0xb19e('0xa')](),controller[_0xb19e('0xe')]);router[_0xb19e('0xf')](_0xb19e('0x9'),auth[_0xb19e('0xa')](),controller['destroy']);module[_0xb19e('0x10')]=router; \ No newline at end of file +var _0x5f6c=['update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x82658d,_0x2cb969){var _0x24b38f=function(_0x8778ac){while(--_0x8778ac){_0x82658d['push'](_0x82658d['shift']());}};_0x24b38f(++_0x2cb969);}(_0x5f6c,0x191));var _0xc5f6=function(_0x26503d,_0x3d4338){_0x26503d=_0x26503d-0x0;var _0xd9cb74=_0x5f6c[_0x26503d];return _0xd9cb74;};'use strict';var multer=require(_0xc5f6('0x0'));var util=require(_0xc5f6('0x1'));var path=require(_0xc5f6('0x2'));var timeout=require(_0xc5f6('0x3'));var express=require(_0xc5f6('0x4'));var router=express[_0xc5f6('0x5')]();var fs_extra=require(_0xc5f6('0x6'));var auth=require(_0xc5f6('0x7'));var interaction=require(_0xc5f6('0x8'));var config=require('../../config/environment');var controller=require(_0xc5f6('0x9'));router[_0xc5f6('0xa')]('/',auth[_0xc5f6('0xb')](),controller['index']);router[_0xc5f6('0xa')](_0xc5f6('0xc'),auth['isAuthenticated'](),controller[_0xc5f6('0xd')]);router[_0xc5f6('0xe')]('/',auth[_0xc5f6('0xb')](),controller[_0xc5f6('0xf')]);router[_0xc5f6('0x10')](_0xc5f6('0xc'),auth[_0xc5f6('0xb')](),controller[_0xc5f6('0x11')]);router[_0xc5f6('0x12')]('/:id',auth[_0xc5f6('0xb')](),controller['destroy']);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 66e17e1..2a32cb1 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 _0xb22c=['getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long'];(function(_0x4c99b4,_0x3f016a){var _0x4fe8ad=function(_0x31a8ee){while(--_0x31a8ee){_0x4c99b4['push'](_0x4c99b4['shift']());}};_0x4fe8ad(++_0x3f016a);}(_0xb22c,0x66));var _0xcb22=function(_0x317e0a,_0x274de1){_0x317e0a=_0x317e0a-0x0;var _0xa1e1f4=_0xb22c[_0x317e0a];return _0xa1e1f4;};'use strict';var Sequelize=require('sequelize');module[_0xcb22('0x0')]={'name':{'type':Sequelize[_0xcb22('0x1')],'unique':_0xcb22('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xcb22('0x1')]},'notes':{'type':Sequelize[_0xcb22('0x3')]},'preproduction':{'type':Sequelize[_0xcb22('0x4')](_0xcb22('0x5')),'get':function(){if(this[_0xcb22('0x6')](_0xcb22('0x7'))){return this['getDataValue'](_0xcb22('0x7'))[_0xcb22('0x8')](_0xcb22('0x9'));}}},'production':{'type':Sequelize[_0xcb22('0x4')](_0xcb22('0x5')),'get':function(){if(this['getDataValue'](_0xcb22('0xa'))){return this[_0xcb22('0x6')]('production')[_0xcb22('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0xcb22('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7919=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7919,0xeb));var _0x9791=function(_0x4223d9,_0x141f67){_0x4223d9=_0x4223d9-0x0;var _0x4caf41=_0x7919[_0x4223d9];return _0x4caf41;};'use strict';var Sequelize=require(_0x9791('0x0'));module[_0x9791('0x1')]={'name':{'type':Sequelize[_0x9791('0x2')],'unique':_0x9791('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9791('0x2')]},'notes':{'type':Sequelize[_0x9791('0x4')]},'preproduction':{'type':Sequelize[_0x9791('0x5')]('long'),'get':function(){if(this[_0x9791('0x6')](_0x9791('0x7'))){return this['getDataValue'](_0x9791('0x7'))[_0x9791('0x8')](_0x9791('0x9'));}}},'production':{'type':Sequelize[_0x9791('0x5')](_0x9791('0xa')),'get':function(){if(this['getDataValue'](_0x9791('0xb'))){return this['getDataValue'](_0x9791('0xb'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x9791('0xc')]},'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 f9bf5d7..8581fa5 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 _0xf221=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','lodash','ioredis','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','sendStatus','error','stack','name','index','SquareProject','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x465b3b,_0x501395){var _0x1d337d=function(_0x229aaa){while(--_0x229aaa){_0x465b3b['push'](_0x465b3b['shift']());}};_0x1d337d(++_0x501395);}(_0xf221,0xa8));var _0x1f22=function(_0x3cd6b1,_0x407231){_0x3cd6b1=_0x3cd6b1-0x0;var _0x282eb5=_0xf221[_0x3cd6b1];return _0x282eb5;};'use strict';var _=require(_0x1f22('0x0'));var Redis=require(_0x1f22('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1f22('0x2'))(_0x1f22('0x3'));var config=require(_0x1f22('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1f22('0x5')](config[_0x1f22('0x6')],{'host':_0x1f22('0x7'),'port':0x18eb});var socket=require(_0x1f22('0x8'))(new Redis(config[_0x1f22('0x6')]));require(_0x1f22('0x9'))['register'](socket);function respondWithResult(_0x4acdbb,_0x216ee2){_0x216ee2=_0x216ee2||0xc8;return function(_0x5d640c){if(_0x5d640c){return _0x4acdbb[_0x1f22('0xa')](_0x216ee2)[_0x1f22('0xb')](_0x5d640c);}};}function respondWithFilteredResult(_0x5681e2,_0x2649d9){return function(_0x4dee71){if(_0x4dee71){var _0x352924=typeof _0x2649d9[_0x1f22('0xc')]===_0x1f22('0xd')&&typeof _0x2649d9[_0x1f22('0xe')]===_0x1f22('0xd');var _0x249e97=_0x4dee71['count'];var _0x1ec599=_0x352924?0x0:_0x2649d9[_0x1f22('0xc')];var _0x16e928=_0x352924?_0x4dee71[_0x1f22('0xf')]:_0x2649d9[_0x1f22('0xc')]+_0x2649d9[_0x1f22('0xe')];var _0x2fb9fe;if(_0x16e928>=_0x249e97){_0x16e928=_0x249e97;_0x2fb9fe=0xc8;}else{_0x2fb9fe=0xce;}_0x5681e2[_0x1f22('0xa')](_0x2fb9fe);return _0x5681e2[_0x1f22('0x10')](_0x1f22('0x11'),_0x1ec599+'-'+_0x16e928+'/'+_0x249e97)[_0x1f22('0xb')](_0x4dee71);}return null;};}function saveUpdates(_0x400f33){return function(_0x25f83f){if(_0x25f83f){return _0x25f83f[_0x1f22('0x12')](_0x400f33)[_0x1f22('0x13')](function(_0x96426c){return _0x96426c;});}return null;};}function removeEntity(_0x5a9b9d){return function(_0x347a54){if(_0x347a54){return _0x347a54[_0x1f22('0x14')]()[_0x1f22('0x13')](function(){var _0x22b863=_0x347a54[_0x1f22('0x15')]({'plain':!![]});var _0x4bd1b5=_0x1f22('0x16');return db[_0x1f22('0x17')][_0x1f22('0x14')]({'where':{'type':_0x4bd1b5,'resourceId':_0x22b863['id']}})[_0x1f22('0x13')](function(){return _0x347a54;});})[_0x1f22('0x13')](function(){var _0x6e6836=new Redis(config['redis']);_0x6e6836[_0x1f22('0x18')](_0x1f22('0x19'),JSON['stringify']({'id':_0x347a54['id'],'deleted':!![]}));})[_0x1f22('0x13')](function(){_0x5a9b9d[_0x1f22('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a9ab){return function(_0x2cb63a){if(!_0x2cb63a){_0x44a9ab[_0x1f22('0x1a')](0x194);}return _0x2cb63a;};}function handleError(_0x49f6fe,_0xb96e85){_0xb96e85=_0xb96e85||0x1f4;return function(_0x2db613){logger[_0x1f22('0x1b')](_0x2db613[_0x1f22('0x1c')]);if(_0x2db613[_0x1f22('0x1d')]){delete _0x2db613[_0x1f22('0x1d')];}_0x49f6fe[_0x1f22('0xa')](_0xb96e85)['send'](_0x2db613);};}exports[_0x1f22('0x1e')]=function(_0x4fd35e,_0x377741){var _0x5c441f={},_0x593d31={},_0x374fae={'count':0x0,'rows':[]};var _0xb378ca=_['map'](db[_0x1f22('0x1f')][_0x1f22('0x20')],function(_0x53866e){return{'name':_0x53866e[_0x1f22('0x21')],'type':_0x53866e[_0x1f22('0x22')][_0x1f22('0x23')]};});_0x593d31[_0x1f22('0x24')]=_['map'](_0xb378ca,'name');_0x593d31[_0x1f22('0x25')]=_[_0x1f22('0x26')](_0x4fd35e[_0x1f22('0x25')]);_0x593d31[_0x1f22('0x27')]=_[_0x1f22('0x28')](_0x593d31[_0x1f22('0x24')],_0x593d31[_0x1f22('0x25')]);_0x5c441f[_0x1f22('0x29')]=_[_0x1f22('0x28')](_0x593d31['model'],qs[_0x1f22('0x2a')](_0x4fd35e['query'][_0x1f22('0x2a')]));_0x5c441f[_0x1f22('0x29')]=_0x5c441f['attributes'][_0x1f22('0x2b')]?_0x5c441f[_0x1f22('0x29')]:_0x593d31[_0x1f22('0x24')];if(!_0x4fd35e[_0x1f22('0x25')][_0x1f22('0x2c')](_0x1f22('0x2d'))){_0x5c441f['limit']=qs[_0x1f22('0xe')](_0x4fd35e[_0x1f22('0x25')][_0x1f22('0xe')]);_0x5c441f[_0x1f22('0xc')]=qs[_0x1f22('0xc')](_0x4fd35e[_0x1f22('0x25')][_0x1f22('0xc')]);}_0x5c441f[_0x1f22('0x2e')]=qs[_0x1f22('0x2f')](_0x4fd35e['query'][_0x1f22('0x2f')]);_0x5c441f[_0x1f22('0x30')]=qs['filters'](_[_0x1f22('0x31')](_0x4fd35e['query'],_0x593d31['filters']),_0xb378ca);if(_0x4fd35e[_0x1f22('0x25')][_0x1f22('0x32')]){_0x5c441f['where']=_[_0x1f22('0x33')](_0x5c441f['where'],{'$or':_['map'](_0xb378ca,function(_0x59594f){if(_0x59594f[_0x1f22('0x22')]!==_0x1f22('0x34')){var _0x3676ed={};_0x3676ed[_0x59594f['name']]={'$like':'%'+_0x4fd35e['query'][_0x1f22('0x32')]+'%'};return _0x3676ed;}})});}_0x5c441f=_[_0x1f22('0x33')]({},_0x5c441f,_0x4fd35e[_0x1f22('0x35')]);var _0x16ec13={'where':_0x5c441f[_0x1f22('0x30')]};return db[_0x1f22('0x1f')]['count'](_0x16ec13)['then'](function(_0x3fabaf){_0x374fae['count']=_0x3fabaf;if(_0x4fd35e[_0x1f22('0x25')][_0x1f22('0x36')]){_0x5c441f[_0x1f22('0x37')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x5c441f);})[_0x1f22('0x13')](function(_0x142a1e){_0x374fae['rows']=_0x142a1e;return _0x374fae;})[_0x1f22('0x13')](respondWithFilteredResult(_0x377741,_0x5c441f))[_0x1f22('0x38')](handleError(_0x377741,null));};exports[_0x1f22('0x39')]=function(_0x217c85,_0x382f9e){var _0x7a681c={'raw':![],'where':{'id':_0x217c85[_0x1f22('0x3a')]['id']}},_0x15f369={};_0x15f369[_0x1f22('0x24')]=_[_0x1f22('0x26')](db[_0x1f22('0x1f')]['rawAttributes']);_0x15f369['query']=_[_0x1f22('0x26')](_0x217c85[_0x1f22('0x25')]);_0x15f369['filters']=_[_0x1f22('0x28')](_0x15f369['model'],_0x15f369['query']);_0x7a681c['attributes']=_['intersection'](_0x15f369[_0x1f22('0x24')],qs[_0x1f22('0x2a')](_0x217c85['query'][_0x1f22('0x2a')]));_0x7a681c[_0x1f22('0x29')]=_0x7a681c[_0x1f22('0x29')][_0x1f22('0x2b')]?_0x7a681c[_0x1f22('0x29')]:_0x15f369[_0x1f22('0x24')];if(_0x217c85[_0x1f22('0x25')][_0x1f22('0x36')]){_0x7a681c[_0x1f22('0x37')]=[{'all':!![]}];}_0x7a681c=_[_0x1f22('0x33')]({},_0x7a681c,_0x217c85[_0x1f22('0x35')]);return db[_0x1f22('0x1f')][_0x1f22('0x3b')](_0x7a681c)['then'](handleEntityNotFound(_0x382f9e,null))[_0x1f22('0x13')](respondWithResult(_0x382f9e,null))[_0x1f22('0x38')](handleError(_0x382f9e,null));};exports[_0x1f22('0x3c')]=function(_0xcd0edc,_0x13e00f){return db[_0x1f22('0x1f')][_0x1f22('0x3c')](_0xcd0edc[_0x1f22('0x3d')],{})[_0x1f22('0x13')](function(_0x19dee5){var _0x2f2562=_0xcd0edc[_0x1f22('0x3e')][_0x1f22('0x15')]({'plain':!![]});if(!_0x2f2562)throw new Error(_0x1f22('0x3f'));if(_0x2f2562[_0x1f22('0x40')]==='user'){var _0x329d3c=_0x19dee5[_0x1f22('0x15')]({'plain':!![]});var _0x409c1c=_0x1f22('0x16');return db[_0x1f22('0x41')][_0x1f22('0x3b')]({'where':{'name':_0x409c1c,'userProfileId':_0x2f2562['userProfileId']},'raw':!![]})[_0x1f22('0x13')](function(_0x56bebf){if(_0x56bebf&&_0x56bebf[_0x1f22('0x42')]===0x0){return db[_0x1f22('0x17')]['create']({'name':_0x329d3c[_0x1f22('0x1d')],'resourceId':_0x329d3c['id'],'type':_0x56bebf[_0x1f22('0x1d')],'sectionId':_0x56bebf['id']},{})[_0x1f22('0x13')](function(){return _0x19dee5;});}else{return _0x19dee5;}})[_0x1f22('0x38')](function(_0x74f19c){logger[_0x1f22('0x1b')](_0x1f22('0x43'),_0x74f19c);throw _0x74f19c;});}return _0x19dee5;})[_0x1f22('0x13')](respondWithResult(_0x13e00f,0xc9))['catch'](handleError(_0x13e00f,null));};exports[_0x1f22('0x12')]=function(_0x3ee77c,_0x181a1d){if(_0x3ee77c[_0x1f22('0x3d')]['id']){delete _0x3ee77c[_0x1f22('0x3d')]['id'];}return db['SquareProject'][_0x1f22('0x3b')]({'where':{'id':_0x3ee77c[_0x1f22('0x3a')]['id']}})[_0x1f22('0x13')](handleEntityNotFound(_0x181a1d,null))[_0x1f22('0x13')](saveUpdates(_0x3ee77c[_0x1f22('0x3d')],null))['then'](function(_0x51308d){if(!_0x51308d)return;var _0x4ef2b=_0x51308d[_0x1f22('0x15')]({'plain':!![]});return _0x4ef2b;})[_0x1f22('0x13')](function(_0xeca44e){var _0x35bd6e=new Redis(config[_0x1f22('0x6')]);_0x35bd6e['publish'](_0x1f22('0x19'),JSON[_0x1f22('0x44')](_[_0x1f22('0x31')](_0xeca44e,['id',_0x1f22('0x1d'),'production'])));return _0xeca44e;})['then'](respondWithResult(_0x181a1d,null))[_0x1f22('0x38')](handleError(_0x181a1d,null));};exports[_0x1f22('0x14')]=function(_0x3105f3,_0x3ae4dd){return db[_0x1f22('0x1f')]['find']({'where':{'id':_0x3105f3['params']['id']}})[_0x1f22('0x13')](handleEntityNotFound(_0x3ae4dd,null))['then'](removeEntity(_0x3ae4dd,null))[_0x1f22('0x38')](handleError(_0x3ae4dd,null));}; \ No newline at end of file +var _0xdc3e=['includeAll','findAll','rows','catch','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','publish','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','agi','stringify','end','name','send','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options'];(function(_0x1a3010,_0x584f3e){var _0x1d02da=function(_0x532bd1){while(--_0x532bd1){_0x1a3010['push'](_0x1a3010['shift']());}};_0x1d02da(++_0x584f3e);}(_0xdc3e,0x190));var _0xedc3=function(_0x361b9c,_0x33feb7){_0x361b9c=_0x361b9c-0x0;var _0x17d57d=_0xdc3e[_0x361b9c];return _0x17d57d;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xedc3('0x0'))(_0xedc3('0x1'));var config=require(_0xedc3('0x2'));var db=require(_0xedc3('0x3'))['db'];config[_0xedc3('0x4')]=_[_0xedc3('0x5')](config['redis'],{'host':_0xedc3('0x6'),'port':0x18eb});var socket=require(_0xedc3('0x7'))(new Redis(config['redis']));require(_0xedc3('0x8'))['register'](socket);function respondWithResult(_0x251b4a,_0x36e4d0){_0x36e4d0=_0x36e4d0||0xc8;return function(_0x6369bc){if(_0x6369bc){return _0x251b4a[_0xedc3('0x9')](_0x36e4d0)[_0xedc3('0xa')](_0x6369bc);}};}function respondWithFilteredResult(_0x53882c,_0x3f7b59){return function(_0x391fb4){if(_0x391fb4){var _0x522fa4=typeof _0x3f7b59[_0xedc3('0xb')]===_0xedc3('0xc')&&typeof _0x3f7b59['limit']===_0xedc3('0xc');var _0x1d05c9=_0x391fb4[_0xedc3('0xd')];var _0x13a987=_0x522fa4?0x0:_0x3f7b59[_0xedc3('0xb')];var _0x1f4953=_0x522fa4?_0x391fb4[_0xedc3('0xd')]:_0x3f7b59['offset']+_0x3f7b59[_0xedc3('0xe')];var _0x9c6dc2;if(_0x1f4953>=_0x1d05c9){_0x1f4953=_0x1d05c9;_0x9c6dc2=0xc8;}else{_0x9c6dc2=0xce;}_0x53882c[_0xedc3('0x9')](_0x9c6dc2);return _0x53882c[_0xedc3('0xf')](_0xedc3('0x10'),_0x13a987+'-'+_0x1f4953+'/'+_0x1d05c9)['json'](_0x391fb4);}return null;};}function saveUpdates(_0x46f2b7){return function(_0x547f5c){if(_0x547f5c){return _0x547f5c[_0xedc3('0x11')](_0x46f2b7)[_0xedc3('0x12')](function(_0x1cade1){return _0x1cade1;});}return null;};}function removeEntity(_0xc3f0b0){return function(_0x20f96f){if(_0x20f96f){return _0x20f96f[_0xedc3('0x13')]()['then'](function(){var _0x2ef0f8=_0x20f96f['get']({'plain':!![]});var _0x10866a=_0xedc3('0x14');return db[_0xedc3('0x15')][_0xedc3('0x13')]({'where':{'type':_0x10866a,'resourceId':_0x2ef0f8['id']}})[_0xedc3('0x12')](function(){return _0x20f96f;});})['then'](function(){var _0xc20a40=new Redis(config[_0xedc3('0x4')]);_0xc20a40['publish'](_0xedc3('0x16'),JSON[_0xedc3('0x17')]({'id':_0x20f96f['id'],'deleted':!![]}));})['then'](function(){_0xc3f0b0[_0xedc3('0x9')](0xcc)[_0xedc3('0x18')]();});}};}function handleEntityNotFound(_0x24c520){return function(_0x488886){if(!_0x488886){_0x24c520['sendStatus'](0x194);}return _0x488886;};}function handleError(_0x4bc725,_0x1d55d8){_0x1d55d8=_0x1d55d8||0x1f4;return function(_0x2675ae){logger['error'](_0x2675ae['stack']);if(_0x2675ae[_0xedc3('0x19')]){delete _0x2675ae[_0xedc3('0x19')];}_0x4bc725[_0xedc3('0x9')](_0x1d55d8)[_0xedc3('0x1a')](_0x2675ae);};}exports['index']=function(_0x1e7ac9,_0x36a8ba){var _0x301a84={},_0x187709={},_0x28f89d={'count':0x0,'rows':[]};var _0x5d853b=_[_0xedc3('0x1b')](db[_0xedc3('0x1c')][_0xedc3('0x1d')],function(_0x381e69){return{'name':_0x381e69[_0xedc3('0x1e')],'type':_0x381e69[_0xedc3('0x1f')]['key']};});_0x187709[_0xedc3('0x20')]=_[_0xedc3('0x1b')](_0x5d853b,_0xedc3('0x19'));_0x187709[_0xedc3('0x21')]=_[_0xedc3('0x22')](_0x1e7ac9['query']);_0x187709[_0xedc3('0x23')]=_[_0xedc3('0x24')](_0x187709[_0xedc3('0x20')],_0x187709[_0xedc3('0x21')]);_0x301a84[_0xedc3('0x25')]=_[_0xedc3('0x24')](_0x187709['model'],qs['fields'](_0x1e7ac9['query'][_0xedc3('0x26')]));_0x301a84['attributes']=_0x301a84['attributes'][_0xedc3('0x27')]?_0x301a84[_0xedc3('0x25')]:_0x187709[_0xedc3('0x20')];if(!_0x1e7ac9[_0xedc3('0x21')][_0xedc3('0x28')]('nolimit')){_0x301a84[_0xedc3('0xe')]=qs[_0xedc3('0xe')](_0x1e7ac9[_0xedc3('0x21')][_0xedc3('0xe')]);_0x301a84[_0xedc3('0xb')]=qs[_0xedc3('0xb')](_0x1e7ac9['query']['offset']);}_0x301a84[_0xedc3('0x29')]=qs['sort'](_0x1e7ac9[_0xedc3('0x21')][_0xedc3('0x2a')]);_0x301a84[_0xedc3('0x2b')]=qs[_0xedc3('0x23')](_[_0xedc3('0x2c')](_0x1e7ac9[_0xedc3('0x21')],_0x187709[_0xedc3('0x23')]),_0x5d853b);if(_0x1e7ac9[_0xedc3('0x21')]['filter']){_0x301a84['where']=_[_0xedc3('0x2d')](_0x301a84[_0xedc3('0x2b')],{'$or':_[_0xedc3('0x1b')](_0x5d853b,function(_0x50eaf9){if(_0x50eaf9[_0xedc3('0x1f')]!=='VIRTUAL'){var _0x196e09={};_0x196e09[_0x50eaf9['name']]={'$like':'%'+_0x1e7ac9[_0xedc3('0x21')][_0xedc3('0x2e')]+'%'};return _0x196e09;}})});}_0x301a84=_[_0xedc3('0x2d')]({},_0x301a84,_0x1e7ac9[_0xedc3('0x2f')]);var _0x34ef9b={'where':_0x301a84['where']};return db['SquareProject'][_0xedc3('0xd')](_0x34ef9b)['then'](function(_0x103b64){_0x28f89d[_0xedc3('0xd')]=_0x103b64;if(_0x1e7ac9[_0xedc3('0x21')][_0xedc3('0x30')]){_0x301a84['include']=[{'all':!![]}];}return db[_0xedc3('0x1c')][_0xedc3('0x31')](_0x301a84);})['then'](function(_0x4c1386){_0x28f89d[_0xedc3('0x32')]=_0x4c1386;return _0x28f89d;})[_0xedc3('0x12')](respondWithFilteredResult(_0x36a8ba,_0x301a84))[_0xedc3('0x33')](handleError(_0x36a8ba,null));};exports['show']=function(_0x4908d0,_0x137b9c){var _0x343119={'raw':![],'where':{'id':_0x4908d0[_0xedc3('0x34')]['id']}},_0xc2c985={};_0xc2c985[_0xedc3('0x20')]=_[_0xedc3('0x22')](db[_0xedc3('0x1c')][_0xedc3('0x1d')]);_0xc2c985[_0xedc3('0x21')]=_[_0xedc3('0x22')](_0x4908d0[_0xedc3('0x21')]);_0xc2c985['filters']=_[_0xedc3('0x24')](_0xc2c985['model'],_0xc2c985['query']);_0x343119['attributes']=_[_0xedc3('0x24')](_0xc2c985['model'],qs['fields'](_0x4908d0[_0xedc3('0x21')][_0xedc3('0x26')]));_0x343119['attributes']=_0x343119['attributes'][_0xedc3('0x27')]?_0x343119[_0xedc3('0x25')]:_0xc2c985[_0xedc3('0x20')];if(_0x4908d0['query'][_0xedc3('0x30')]){_0x343119[_0xedc3('0x35')]=[{'all':!![]}];}_0x343119=_[_0xedc3('0x2d')]({},_0x343119,_0x4908d0[_0xedc3('0x2f')]);return db[_0xedc3('0x1c')][_0xedc3('0x36')](_0x343119)['then'](handleEntityNotFound(_0x137b9c,null))[_0xedc3('0x12')](respondWithResult(_0x137b9c,null))[_0xedc3('0x33')](handleError(_0x137b9c,null));};exports['create']=function(_0x265f08,_0x1d551f){return db[_0xedc3('0x1c')][_0xedc3('0x37')](_0x265f08[_0xedc3('0x38')],{})[_0xedc3('0x12')](function(_0x261ec6){var _0x40f954=_0x265f08['user']['get']({'plain':!![]});if(!_0x40f954)throw new Error(_0xedc3('0x39'));if(_0x40f954[_0xedc3('0x3a')]==='user'){var _0x2d41a3=_0x261ec6[_0xedc3('0x3b')]({'plain':!![]});var _0x21b433=_0xedc3('0x14');return db[_0xedc3('0x3c')]['find']({'where':{'name':_0x21b433,'userProfileId':_0x40f954[_0xedc3('0x3d')]},'raw':!![]})['then'](function(_0x46f359){if(_0x46f359&&_0x46f359[_0xedc3('0x3e')]===0x0){return db[_0xedc3('0x15')]['create']({'name':_0x2d41a3[_0xedc3('0x19')],'resourceId':_0x2d41a3['id'],'type':_0x46f359[_0xedc3('0x19')],'sectionId':_0x46f359['id']},{})[_0xedc3('0x12')](function(){return _0x261ec6;});}else{return _0x261ec6;}})[_0xedc3('0x33')](function(_0x448f9c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x448f9c);throw _0x448f9c;});}return _0x261ec6;})[_0xedc3('0x12')](respondWithResult(_0x1d551f,0xc9))['catch'](handleError(_0x1d551f,null));};exports[_0xedc3('0x11')]=function(_0x3ca0eb,_0x59d091){if(_0x3ca0eb['body']['id']){delete _0x3ca0eb[_0xedc3('0x38')]['id'];}return db[_0xedc3('0x1c')][_0xedc3('0x36')]({'where':{'id':_0x3ca0eb[_0xedc3('0x34')]['id']}})[_0xedc3('0x12')](handleEntityNotFound(_0x59d091,null))['then'](saveUpdates(_0x3ca0eb[_0xedc3('0x38')],null))[_0xedc3('0x12')](function(_0x287af6){if(!_0x287af6)return;var _0x42266e=_0x287af6[_0xedc3('0x3b')]({'plain':!![]});return _0x42266e;})['then'](function(_0x1b7e9f){var _0x3a3398=new Redis(config['redis']);_0x3a3398[_0xedc3('0x3f')](_0xedc3('0x16'),JSON['stringify'](_[_0xedc3('0x2c')](_0x1b7e9f,['id','name','production'])));return _0x1b7e9f;})[_0xedc3('0x12')](respondWithResult(_0x59d091,null))[_0xedc3('0x33')](handleError(_0x59d091,null));};exports[_0xedc3('0x13')]=function(_0x428a4c,_0x498a68){return db['SquareProject'][_0xedc3('0x36')]({'where':{'id':_0x428a4c[_0xedc3('0x34')]['id']}})[_0xedc3('0x12')](handleEntityNotFound(_0x498a68,null))[_0xedc3('0x12')](removeEntity(_0x498a68,null))[_0xedc3('0x33')](handleError(_0x498a68,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a26e04a..0ec3b1c 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 _0xca50=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x4a368e,_0x135d5a){var _0x1c26e7=function(_0x4ab668){while(--_0x4ab668){_0x4a368e['push'](_0x4a368e['shift']());}};_0x1c26e7(++_0x135d5a);}(_0xca50,0x118));var _0x0ca5=function(_0x4738ed,_0x1d267f){_0x4738ed=_0x4738ed-0x0;var _0x1abc73=_0xca50[_0x4738ed];return _0x1abc73;};'use strict';var EventEmitter=require(_0x0ca5('0x0'));var SquareProject=require(_0x0ca5('0x1'))['db'][_0x0ca5('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0ca5('0x3')](0x0);var events={'afterCreate':_0x0ca5('0x4'),'afterUpdate':_0x0ca5('0x5'),'afterDestroy':_0x0ca5('0x6')};function emitEvent(_0x45b98d){return function(_0x1ca35f,_0x7f5a80,_0x243080){SquareProjectEvents[_0x0ca5('0x7')](_0x45b98d+':'+_0x1ca35f['id'],_0x1ca35f);SquareProjectEvents[_0x0ca5('0x7')](_0x45b98d,_0x1ca35f);_0x243080(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xb13d=['hasOwnProperty','hook','events','../../mysqldb','SquareProject','save','update','remove','emit'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xb13d,0xf5));var _0xdb13=function(_0x4c1ea1,_0x491254){_0x4c1ea1=_0x4c1ea1-0x0;var _0x2b0714=_0xb13d[_0x4c1ea1];return _0x2b0714;};'use strict';var EventEmitter=require(_0xdb13('0x0'));var SquareProject=require(_0xdb13('0x1'))['db'][_0xdb13('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb13('0x3'),'afterUpdate':_0xdb13('0x4'),'afterDestroy':_0xdb13('0x5')};function emitEvent(_0x407a6f){return function(_0x348cb0,_0x537f5e,_0x4da6b2){SquareProjectEvents[_0xdb13('0x6')](_0x407a6f+':'+_0x348cb0['id'],_0x348cb0);SquareProjectEvents['emit'](_0x407a6f,_0x348cb0);_0x4da6b2(null);};}for(var e in events){if(events[_0xdb13('0x7')](e)){var event=events[e];SquareProject[_0xdb13('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a58b3e6..c737c3e 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 _0x8bc4=['publishedAt','format','lodash','api','moment','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x2b9c5f,_0x21307d){var _0x40e3f6=function(_0x47b79f){while(--_0x47b79f){_0x2b9c5f['push'](_0x2b9c5f['shift']());}};_0x40e3f6(++_0x21307d);}(_0x8bc4,0x145));var _0x48bc=function(_0x5acbe5,_0xf5b1fd){_0x5acbe5=_0x5acbe5-0x0;var _0x26798c=_0x8bc4[_0x5acbe5];return _0x26798c;};'use strict';var _=require(_0x48bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48bc('0x1'));var moment=require(_0x48bc('0x2'));var BPromise=require('bluebird');var rp=require(_0x48bc('0x3'));var fs=require('fs');var path=require(_0x48bc('0x4'));var rimraf=require('rimraf');var config=require(_0x48bc('0x5'));var attributes=require(_0x48bc('0x6'));module[_0x48bc('0x7')]=function(_0xed0208,_0x404e6c){return _0xed0208[_0x48bc('0x8')](_0x48bc('0x9'),attributes,{'tableName':_0x48bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22d96d,_0x31e85d,_0x26d8ea){if(_0x22d96d[_0x48bc('0xb')]('preproduction')){_0x22d96d[_0x48bc('0xc')]=moment()['format'](_0x48bc('0xd'));}if(_0x22d96d[_0x48bc('0xb')](_0x48bc('0xe'))){_0x22d96d[_0x48bc('0xf')]=moment()[_0x48bc('0x10')](_0x48bc('0xd'));}_0x26d8ea(null,_0x22d96d);}}});}; \ No newline at end of file +var _0xc1f2=['changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','moment','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x52f6a6,_0x36d44d){var _0xe0c398=function(_0x137960){while(--_0x137960){_0x52f6a6['push'](_0x52f6a6['shift']());}};_0xe0c398(++_0x36d44d);}(_0xc1f2,0xa7));var _0x2c1f=function(_0x3a5cac,_0x39f40a){_0x3a5cac=_0x3a5cac-0x0;var _0x1f81c2=_0xc1f2[_0x3a5cac];return _0x1f81c2;};'use strict';var _=require(_0x2c1f('0x0'));var util=require('util');var logger=require(_0x2c1f('0x1'))('api');var moment=require(_0x2c1f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2c1f('0x3'));var config=require(_0x2c1f('0x4'));var attributes=require(_0x2c1f('0x5'));module[_0x2c1f('0x6')]=function(_0x47097d,_0x2d8292){return _0x47097d[_0x2c1f('0x7')](_0x2c1f('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f576a,_0x2455e0,_0x3d6222){if(_0x5f576a[_0x2c1f('0x9')](_0x2c1f('0xa'))){_0x5f576a[_0x2c1f('0xb')]=moment()[_0x2c1f('0xc')](_0x2c1f('0xd'));}if(_0x5f576a[_0x2c1f('0x9')](_0x2c1f('0xe'))){_0x5f576a[_0x2c1f('0xf')]=moment()['format'](_0x2c1f('0xd'));}_0x3d6222(null,_0x5f576a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d77a86d..ecbf6b7 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 _0x48f3=['findAll','options','where','attributes','include','model','map','then','info','debug','stringify','catch','message','error','ShowSquareProject','find','raw','lodash','ioredis','../../mysqldb','../../config/logger','rpc','defaults','redis','localhost','GetSquareProjects','SquareProject'];(function(_0x29f3e2,_0x25d51b){var _0x3bb516=function(_0x49fe1a){while(--_0x49fe1a){_0x29f3e2['push'](_0x29f3e2['shift']());}};_0x3bb516(++_0x25d51b);}(_0x48f3,0x13a));var _0x348f=function(_0x40e0ab,_0x26d731){_0x40e0ab=_0x40e0ab-0x0;var _0x37479b=_0x48f3[_0x40e0ab];return _0x37479b;};'use strict';var _=require(_0x348f('0x0'));var Redis=require(_0x348f('0x1'));var db=require(_0x348f('0x2'))['db'];var logger=require(_0x348f('0x3'))(_0x348f('0x4'));var config=require('../../config/environment');config['redis']=_[_0x348f('0x5')](config[_0x348f('0x6')],{'host':_0x348f('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);exports[_0x348f('0x8')]=function(_0x31feb7){var _0x2cc146=this;return new Promise(function(_0x3d0cbf,_0x240ffd){return db[_0x348f('0x9')][_0x348f('0xa')]({'raw':_0x31feb7[_0x348f('0xb')]?_0x31feb7[_0x348f('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x31feb7[_0x348f('0xb')]?_0x31feb7[_0x348f('0xb')][_0x348f('0xc')]||null:null,'attributes':_0x31feb7[_0x348f('0xb')]?_0x31feb7[_0x348f('0xb')][_0x348f('0xd')]||null:null,'limit':_0x31feb7[_0x348f('0xb')]?_0x31feb7[_0x348f('0xb')]['limit']||null:null,'include':_0x31feb7[_0x348f('0xb')]?_0x31feb7[_0x348f('0xb')][_0x348f('0xe')]?_['map'](_0x31feb7[_0x348f('0xb')]['include'],function(_0x8e9c56){return{'model':db[_0x8e9c56[_0x348f('0xf')]],'as':_0x8e9c56['as'],'attributes':_0x8e9c56[_0x348f('0xd')],'include':_0x8e9c56[_0x348f('0xe')]?_[_0x348f('0x10')](_0x8e9c56[_0x348f('0xe')],function(_0xff3b55){return{'model':db[_0xff3b55[_0x348f('0xf')]],'as':_0xff3b55['as'],'attributes':_0xff3b55[_0x348f('0xd')],'include':_0xff3b55['include']?_['map'](_0xff3b55[_0x348f('0xe')],function(_0x4b80e4){return{'model':db[_0x4b80e4[_0x348f('0xf')]],'as':_0x4b80e4['as'],'attributes':_0x4b80e4['attributes']};}):[]};}):[]};}):[]:[]})[_0x348f('0x11')](function(_0x5625cf){logger[_0x348f('0x12')](_0x348f('0x8'),_0x31feb7);logger[_0x348f('0x13')]('GetSquareProjects',_0x31feb7,JSON[_0x348f('0x14')](_0x5625cf));_0x3d0cbf(_0x5625cf);})[_0x348f('0x15')](function(_0x3b9629){logger['error']('GetSquareProjects',_0x3b9629[_0x348f('0x16')],_0x31feb7);_0x240ffd(_0x2cc146[_0x348f('0x17')](0x1f4,_0x3b9629[_0x348f('0x16')]));});});};exports[_0x348f('0x18')]=function(_0x1a6fed){var _0x2333ea=this;return new Promise(function(_0x205f10,_0x2b4e19){return db[_0x348f('0x9')][_0x348f('0x19')]({'raw':_0x1a6fed['options']?_0x1a6fed[_0x348f('0xb')][_0x348f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a6fed[_0x348f('0xb')]?_0x1a6fed['options'][_0x348f('0xc')]||null:null,'attributes':_0x1a6fed[_0x348f('0xb')]?_0x1a6fed[_0x348f('0xb')][_0x348f('0xd')]||null:null,'include':_0x1a6fed[_0x348f('0xb')]?_0x1a6fed[_0x348f('0xb')][_0x348f('0xe')]?_['map'](_0x1a6fed['options'][_0x348f('0xe')],function(_0x47c79a){return{'model':db[_0x47c79a[_0x348f('0xf')]],'as':_0x47c79a['as'],'attributes':_0x47c79a[_0x348f('0xd')],'include':_0x47c79a[_0x348f('0xe')]?_['map'](_0x47c79a[_0x348f('0xe')],function(_0x204838){return{'model':db[_0x204838['model']],'as':_0x204838['as'],'attributes':_0x204838[_0x348f('0xd')],'include':_0x204838[_0x348f('0xe')]?_[_0x348f('0x10')](_0x204838[_0x348f('0xe')],function(_0x4e1af3){return{'model':db[_0x4e1af3['model']],'as':_0x4e1af3['as'],'attributes':_0x4e1af3[_0x348f('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56f656){logger[_0x348f('0x12')]('ShowSquareProject',_0x1a6fed);logger['debug'](_0x348f('0x18'),_0x1a6fed,JSON[_0x348f('0x14')](_0x56f656));_0x205f10(_0x56f656);})['catch'](function(_0x3a1e74){logger['error'](_0x348f('0x18'),_0x3a1e74['message'],_0x1a6fed);_0x2b4e19(_0x2333ea['error'](0x1f4,_0x3a1e74[_0x348f('0x16')]));});});}; \ No newline at end of file +var _0x26bc=['debug','stringify','catch','message','ShowSquareProject','find','model','error','lodash','../../mysqldb','../../config/logger','rpc','redis','localhost','socket.io-emitter','./squareProject.socket','findAll','options','raw','where','attributes','limit','map','include','then','info','GetSquareProjects'];(function(_0x7cdaf1,_0x40e620){var _0xf58e9a=function(_0xc05694){while(--_0xc05694){_0x7cdaf1['push'](_0x7cdaf1['shift']());}};_0xf58e9a(++_0x40e620);}(_0x26bc,0xe0));var _0xc26b=function(_0x44f6cb,_0x4c4db7){_0x44f6cb=_0x44f6cb-0x0;var _0x2a20a6=_0x26bc[_0x44f6cb];return _0x2a20a6;};'use strict';var _=require(_0xc26b('0x0'));var Redis=require('ioredis');var db=require(_0xc26b('0x1'))['db'];var logger=require(_0xc26b('0x2'))(_0xc26b('0x3'));var config=require('../../config/environment');config[_0xc26b('0x4')]=_['defaults'](config[_0xc26b('0x4')],{'host':_0xc26b('0x5'),'port':0x18eb});var socket=require(_0xc26b('0x6'))(new Redis(config[_0xc26b('0x4')]));require(_0xc26b('0x7'))['register'](socket);exports['GetSquareProjects']=function(_0x299706){var _0x4c837d=this;return new Promise(function(_0x474132,_0x3f3d2e){return db['SquareProject'][_0xc26b('0x8')]({'raw':_0x299706[_0xc26b('0x9')]?_0x299706[_0xc26b('0x9')][_0xc26b('0xa')]===undefined?!![]:![]:!![],'where':_0x299706[_0xc26b('0x9')]?_0x299706[_0xc26b('0x9')][_0xc26b('0xb')]||null:null,'attributes':_0x299706[_0xc26b('0x9')]?_0x299706['options'][_0xc26b('0xc')]||null:null,'limit':_0x299706[_0xc26b('0x9')]?_0x299706[_0xc26b('0x9')][_0xc26b('0xd')]||null:null,'include':_0x299706[_0xc26b('0x9')]?_0x299706[_0xc26b('0x9')]['include']?_[_0xc26b('0xe')](_0x299706[_0xc26b('0x9')]['include'],function(_0x5f5b17){return{'model':db[_0x5f5b17['model']],'as':_0x5f5b17['as'],'attributes':_0x5f5b17[_0xc26b('0xc')],'include':_0x5f5b17[_0xc26b('0xf')]?_['map'](_0x5f5b17[_0xc26b('0xf')],function(_0x1e68f6){return{'model':db[_0x1e68f6['model']],'as':_0x1e68f6['as'],'attributes':_0x1e68f6['attributes'],'include':_0x1e68f6[_0xc26b('0xf')]?_[_0xc26b('0xe')](_0x1e68f6[_0xc26b('0xf')],function(_0x2431fb){return{'model':db[_0x2431fb['model']],'as':_0x2431fb['as'],'attributes':_0x2431fb[_0xc26b('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc26b('0x10')](function(_0x509e1f){logger[_0xc26b('0x11')](_0xc26b('0x12'),_0x299706);logger[_0xc26b('0x13')](_0xc26b('0x12'),_0x299706,JSON[_0xc26b('0x14')](_0x509e1f));_0x474132(_0x509e1f);})[_0xc26b('0x15')](function(_0x313fff){logger['error'](_0xc26b('0x12'),_0x313fff[_0xc26b('0x16')],_0x299706);_0x3f3d2e(_0x4c837d['error'](0x1f4,_0x313fff['message']));});});};exports[_0xc26b('0x17')]=function(_0x5f411c){var _0x512069=this;return new Promise(function(_0x127b82,_0x3608c3){return db['SquareProject'][_0xc26b('0x18')]({'raw':_0x5f411c[_0xc26b('0x9')]?_0x5f411c[_0xc26b('0x9')][_0xc26b('0xa')]===undefined?!![]:![]:!![],'where':_0x5f411c[_0xc26b('0x9')]?_0x5f411c[_0xc26b('0x9')][_0xc26b('0xb')]||null:null,'attributes':_0x5f411c[_0xc26b('0x9')]?_0x5f411c[_0xc26b('0x9')][_0xc26b('0xc')]||null:null,'include':_0x5f411c[_0xc26b('0x9')]?_0x5f411c[_0xc26b('0x9')][_0xc26b('0xf')]?_[_0xc26b('0xe')](_0x5f411c[_0xc26b('0x9')]['include'],function(_0x21b8ba){return{'model':db[_0x21b8ba[_0xc26b('0x19')]],'as':_0x21b8ba['as'],'attributes':_0x21b8ba[_0xc26b('0xc')],'include':_0x21b8ba[_0xc26b('0xf')]?_['map'](_0x21b8ba[_0xc26b('0xf')],function(_0x392cbb){return{'model':db[_0x392cbb[_0xc26b('0x19')]],'as':_0x392cbb['as'],'attributes':_0x392cbb[_0xc26b('0xc')],'include':_0x392cbb[_0xc26b('0xf')]?_[_0xc26b('0xe')](_0x392cbb[_0xc26b('0xf')],function(_0xd78bb0){return{'model':db[_0xd78bb0[_0xc26b('0x19')]],'as':_0xd78bb0['as'],'attributes':_0xd78bb0[_0xc26b('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc26b('0x10')](function(_0x2d8e31){logger[_0xc26b('0x11')](_0xc26b('0x17'),_0x5f411c);logger[_0xc26b('0x13')](_0xc26b('0x17'),_0x5f411c,JSON[_0xc26b('0x14')](_0x2d8e31));_0x127b82(_0x2d8e31);})['catch'](function(_0x1ea299){logger[_0xc26b('0x1a')]('ShowSquareProject',_0x1ea299[_0xc26b('0x16')],_0x5f411c);_0x3608c3(_0x512069[_0xc26b('0x1a')](0x1f4,_0x1ea299[_0xc26b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d9281db..109f149 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 _0xd3b9=['length','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd3b9,0x109));var _0x9d3b=function(_0x400d58,_0x343289){_0x400d58=_0x400d58-0x0;var _0x53108d=_0xd3b9[_0x400d58];return _0x53108d;};'use strict';var SquareProjectEvents=require(_0x9d3b('0x0'));var events=[_0x9d3b('0x1'),_0x9d3b('0x2'),_0x9d3b('0x3')];function createListener(_0x240948,_0x5cddda){return function(_0x413654){_0x5cddda[_0x9d3b('0x4')](_0x240948,_0x413654);};}function removeListener(_0x359eba,_0x3ddf4b){return function(){SquareProjectEvents[_0x9d3b('0x5')](_0x359eba,_0x3ddf4b);};}exports[_0x9d3b('0x6')]=function(_0x218650){for(var _0x367fdd=0x0,_0x5f1573=events[_0x9d3b('0x7')];_0x367fdd<_0x5f1573;_0x367fdd++){var _0x5911c5=events[_0x367fdd];var _0x337db1=createListener('squareProject:'+_0x5911c5,_0x218650);SquareProjectEvents['on'](_0x5911c5,_0x337db1);}}; \ No newline at end of file +var _0x13c8=['squareProject:','./squareProject.events','remove','emit','removeListener'];(function(_0x4fcb2f,_0x4c9260){var _0x46fa42=function(_0x1f627a){while(--_0x1f627a){_0x4fcb2f['push'](_0x4fcb2f['shift']());}};_0x46fa42(++_0x4c9260);}(_0x13c8,0x1af));var _0x813c=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0x13c8[_0x1a72b8];return _0x39f72d;};'use strict';var SquareProjectEvents=require(_0x813c('0x0'));var events=['save',_0x813c('0x1'),'update'];function createListener(_0x41ebc7,_0x4d3538){return function(_0x324140){_0x4d3538[_0x813c('0x2')](_0x41ebc7,_0x324140);};}function removeListener(_0x27c1f9,_0x1e40b1){return function(){SquareProjectEvents[_0x813c('0x3')](_0x27c1f9,_0x1e40b1);};}exports['register']=function(_0x39066e){for(var _0x41f6cf=0x0,_0xc699c7=events['length'];_0x41f6cf<_0xc699c7;_0x41f6cf++){var _0x204ef3=events[_0x41f6cf];var _0x1befff=createListener(_0x813c('0x4')+_0x204ef3,_0x39066e);SquareProjectEvents['on'](_0x204ef3,_0x1befff);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 97554de..a4cc689 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2d884b,_0x527937){var _0x5aa715=function(_0x3cf298){while(--_0x3cf298){_0x2d884b['push'](_0x2d884b['shift']());}};_0x5aa715(++_0x527937);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x4bf170,_0x228d6b){var _0x14fb7e=function(_0x21ace4){while(--_0x21ace4){_0x4bf170['push'](_0x4bf170['shift']());}};_0x14fb7e(++_0x228d6b);}(_0x814b,0x1a2));var _0xb814=function(_0x27a5bb,_0x3f4cfb){_0x27a5bb=_0x27a5bb-0x0;var _0x2e17ea=_0x814b[_0x27a5bb];return _0x2e17ea;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0723bd7..aebd706 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 _0xee14=['VIRTUAL','getDataValue','savePath','substring','STRING'];(function(_0x5cb945,_0x341379){var _0x5b01ed=function(_0x4163da){while(--_0x4163da){_0x5cb945['push'](_0x5cb945['shift']());}};_0x5b01ed(++_0x341379);}(_0xee14,0x13a));var _0x4ee1=function(_0x5a35d3,_0x52ae68){_0x5a35d3=_0x5a35d3-0x0;var _0x4a0bd8=_0xee14[_0x5a35d3];return _0x4a0bd8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'callerid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'extension':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'dnid':{'type':Sequelize[_0x4ee1('0x0')]},'projectName':{'type':Sequelize[_0x4ee1('0x0')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4ee1('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4ee1('0x1')],'get':function(){var _0x3a45a3='';var _0x187656=this[_0x4ee1('0x2')](_0x4ee1('0x3'));if(_0x187656){_0x3a45a3=_0x187656[_0x4ee1('0x4')](_0x187656['lastIndexOf']('.'));}return _0x3a45a3;}}}; \ No newline at end of file +var _0x3e74=['getDataValue','savePath','substring','sequelize','STRING'];(function(_0x2b4264,_0x1774f0){var _0x2aabfa=function(_0x3c60d2){while(--_0x3c60d2){_0x2b4264['push'](_0x2b4264['shift']());}};_0x2aabfa(++_0x1774f0);}(_0x3e74,0x175));var _0x43e7=function(_0xe39e85,_0x56f218){_0xe39e85=_0xe39e85-0x0;var _0x146b35=_0x3e74[_0xe39e85];return _0x146b35;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'callerid':{'type':Sequelize[_0x43e7('0x1')]},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x43e7('0x1')]},'projectName':{'type':Sequelize[_0x43e7('0x1')]},'saveName':{'type':Sequelize[_0x43e7('0x1')]},'filename':{'type':Sequelize[_0x43e7('0x1')]},'savePath':{'type':Sequelize[_0x43e7('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x45a0d1='';var _0x3491d6=this[_0x43e7('0x2')](_0x43e7('0x3'));if(_0x3491d6){_0x45a0d1=_0x3491d6[_0x43e7('0x4')](_0x3491d6['lastIndexOf']('.'));}return _0x45a0d1;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 34af936..a895231 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 _0xfe3f=['intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','SquareRecording','rawAttributes','key','map','keys','query','filters','model'];(function(_0x52bace,_0x532af6){var _0x244ac7=function(_0x4a7d88){while(--_0x4a7d88){_0x52bace['push'](_0x52bace['shift']());}};_0x244ac7(++_0x532af6);}(_0xfe3f,0xeb));var _0xffe3=function(_0x340a6c,_0x5a0a84){_0x340a6c=_0x340a6c-0x0;var _0x1113be=_0xfe3f[_0x340a6c];return _0x1113be;};'use strict';var emlformat=require(_0xffe3('0x0'));var rimraf=require(_0xffe3('0x1'));var zipdir=require(_0xffe3('0x2'));var jsonpatch=require(_0xffe3('0x3'));var rp=require(_0xffe3('0x4'));var moment=require(_0xffe3('0x5'));var BPromise=require(_0xffe3('0x6'));var Mustache=require(_0xffe3('0x7'));var util=require('util');var path=require(_0xffe3('0x8'));var sox=require(_0xffe3('0x9'));var csv=require(_0xffe3('0xa'));var ejs=require(_0xffe3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffe3('0xc'));var squel=require('squel');var crypto=require(_0xffe3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xffe3('0xe'));var toCsv=require(_0xffe3('0xa'));var querystring=require(_0xffe3('0xf'));var Papa=require(_0xffe3('0x10'));var Redis=require('ioredis');var authService=require(_0xffe3('0x11'));var qs=require(_0xffe3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffe3('0x13'));var utils=require(_0xffe3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xffe3('0x15'));var db=require(_0xffe3('0x16'))['db'];function respondWithStatusCode(_0x2fbcb2,_0x18ab95){_0x18ab95=_0x18ab95||0xcc;return function(_0x18325b){if(_0x18325b){return _0x2fbcb2[_0xffe3('0x17')](_0x18ab95);}return _0x2fbcb2['status'](_0x18ab95)[_0xffe3('0x18')]();};}function respondWithResult(_0x1f25c3,_0x887f66){_0x887f66=_0x887f66||0xc8;return function(_0x26f2f8){if(_0x26f2f8){return _0x1f25c3[_0xffe3('0x19')](_0x887f66)['json'](_0x26f2f8);}};}function respondWithFilteredResult(_0x515637,_0x11cd1e){return function(_0x13f5fe){if(_0x13f5fe){var _0x3efc26=typeof _0x11cd1e[_0xffe3('0x1a')]===_0xffe3('0x1b')&&typeof _0x11cd1e[_0xffe3('0x1c')]===_0xffe3('0x1b');var _0x196f52=_0x13f5fe[_0xffe3('0x1d')];var _0x1dbc53=_0x3efc26?0x0:_0x11cd1e[_0xffe3('0x1a')];var _0x3c690c=_0x3efc26?_0x13f5fe['count']:_0x11cd1e[_0xffe3('0x1a')]+_0x11cd1e['limit'];var _0x111c4d;if(_0x3c690c>=_0x196f52){_0x3c690c=_0x196f52;_0x111c4d=0xc8;}else{_0x111c4d=0xce;}_0x515637[_0xffe3('0x19')](_0x111c4d);return _0x515637[_0xffe3('0x1e')](_0xffe3('0x1f'),_0x1dbc53+'-'+_0x3c690c+'/'+_0x196f52)[_0xffe3('0x20')](_0x13f5fe);}return null;};}function patchUpdates(_0x3e8585){return function(_0x38d5c3){try{jsonpatch[_0xffe3('0x21')](_0x38d5c3,_0x3e8585,!![]);}catch(_0xcf54f){return BPromise[_0xffe3('0x22')](_0xcf54f);}return _0x38d5c3[_0xffe3('0x23')]();};}function saveUpdates(_0x2e2a62,_0x4c878d){return function(_0x53b1f3){if(_0x53b1f3){return _0x53b1f3[_0xffe3('0x24')](_0x2e2a62)[_0xffe3('0x25')](function(_0x1d8f9b){return _0x1d8f9b;});}return null;};}function removeEntity(_0x166d60,_0x29ab48){return function(_0x17719e){if(_0x17719e){return _0x17719e['destroy']()[_0xffe3('0x25')](function(){_0x166d60[_0xffe3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d809a,_0x2dfdb7){return function(_0x137fd0){if(!_0x137fd0){_0x3d809a[_0xffe3('0x17')](0x194);}return _0x137fd0;};}function handleError(_0x47632b,_0x3ac0ac){_0x3ac0ac=_0x3ac0ac||0x1f4;return function(_0x156b23){logger['error'](_0x156b23[_0xffe3('0x26')]);if(_0x156b23['name']){delete _0x156b23[_0xffe3('0x27')];}_0x47632b['status'](_0x3ac0ac)[_0xffe3('0x28')](_0x156b23);};}exports[_0xffe3('0x29')]=function(_0xff42b,_0xe0ab8e){var _0x1fbf21={},_0x21534d={},_0x322c79={'count':0x0,'rows':[]};var _0x22287f=_['map'](db[_0xffe3('0x2a')][_0xffe3('0x2b')],function(_0x51a0a1){return{'name':_0x51a0a1['fieldName'],'type':_0x51a0a1['type'][_0xffe3('0x2c')]};});_0x21534d['model']=_[_0xffe3('0x2d')](_0x22287f,_0xffe3('0x27'));_0x21534d['query']=_[_0xffe3('0x2e')](_0xff42b[_0xffe3('0x2f')]);_0x21534d[_0xffe3('0x30')]=_['intersection'](_0x21534d[_0xffe3('0x31')],_0x21534d['query']);_0x1fbf21['attributes']=_[_0xffe3('0x32')](_0x21534d[_0xffe3('0x31')],qs[_0xffe3('0x33')](_0xff42b[_0xffe3('0x2f')]['fields']));_0x1fbf21[_0xffe3('0x34')]=_0x1fbf21['attributes'][_0xffe3('0x35')]?_0x1fbf21[_0xffe3('0x34')]:_0x21534d[_0xffe3('0x31')];if(!_0xff42b['query']['hasOwnProperty'](_0xffe3('0x36'))){_0x1fbf21[_0xffe3('0x1c')]=qs[_0xffe3('0x1c')](_0xff42b['query']['limit']);_0x1fbf21[_0xffe3('0x1a')]=qs[_0xffe3('0x1a')](_0xff42b[_0xffe3('0x2f')][_0xffe3('0x1a')]);}_0x1fbf21[_0xffe3('0x37')]=qs['sort'](_0xff42b[_0xffe3('0x2f')][_0xffe3('0x38')]);_0x1fbf21[_0xffe3('0x39')]=qs[_0xffe3('0x30')](_[_0xffe3('0x3a')](_0xff42b['query'],_0x21534d[_0xffe3('0x30')]),_0x22287f);if(_0xff42b['query'][_0xffe3('0x3b')]){_0x1fbf21[_0xffe3('0x39')]=_['merge'](_0x1fbf21[_0xffe3('0x39')],{'$or':_[_0xffe3('0x2d')](_0x22287f,function(_0x579905){if(_0x579905[_0xffe3('0x3c')]!==_0xffe3('0x3d')){var _0x294e85={};_0x294e85[_0x579905['name']]={'$like':'%'+_0xff42b[_0xffe3('0x2f')][_0xffe3('0x3b')]+'%'};return _0x294e85;}})});}_0x1fbf21=_[_0xffe3('0x3e')]({},_0x1fbf21,_0xff42b[_0xffe3('0x3f')]);var _0x51f90f={'where':_0x1fbf21[_0xffe3('0x39')]};return db[_0xffe3('0x2a')][_0xffe3('0x1d')](_0x51f90f)[_0xffe3('0x25')](function(_0x1f9a32){_0x322c79[_0xffe3('0x1d')]=_0x1f9a32;if(_0xff42b['query'][_0xffe3('0x40')]){_0x1fbf21[_0xffe3('0x41')]=[{'all':!![]}];}return db[_0xffe3('0x2a')]['findAll'](_0x1fbf21);})[_0xffe3('0x25')](function(_0x19353e){_0x322c79[_0xffe3('0x42')]=_0x19353e;return _0x322c79;})[_0xffe3('0x25')](respondWithFilteredResult(_0xe0ab8e,_0x1fbf21))[_0xffe3('0x43')](handleError(_0xe0ab8e,null));};exports[_0xffe3('0x44')]=function(_0x47594b,_0x20c89f){var _0x1a4f21={'raw':!![],'where':{'id':_0x47594b[_0xffe3('0x45')]['id']}},_0x67d3b5={};_0x67d3b5[_0xffe3('0x31')]=_['keys'](db['SquareRecording'][_0xffe3('0x2b')]);_0x67d3b5['query']=_[_0xffe3('0x2e')](_0x47594b[_0xffe3('0x2f')]);_0x67d3b5[_0xffe3('0x30')]=_['intersection'](_0x67d3b5[_0xffe3('0x31')],_0x67d3b5['query']);_0x1a4f21[_0xffe3('0x34')]=_[_0xffe3('0x32')](_0x67d3b5[_0xffe3('0x31')],qs[_0xffe3('0x33')](_0x47594b[_0xffe3('0x2f')]['fields']));_0x1a4f21['attributes']=_0x1a4f21[_0xffe3('0x34')][_0xffe3('0x35')]?_0x1a4f21[_0xffe3('0x34')]:_0x67d3b5['model'];if(_0x47594b[_0xffe3('0x2f')][_0xffe3('0x40')]){_0x1a4f21[_0xffe3('0x41')]=[{'all':!![]}];}_0x1a4f21=_[_0xffe3('0x3e')]({},_0x1a4f21,_0x47594b[_0xffe3('0x3f')]);return db[_0xffe3('0x2a')][_0xffe3('0x46')](_0x1a4f21)[_0xffe3('0x25')](handleEntityNotFound(_0x20c89f,null))['then'](respondWithResult(_0x20c89f,null))[_0xffe3('0x43')](handleError(_0x20c89f,null));};exports[_0xffe3('0x47')]=function(_0x45c0c0,_0x397d66){return db[_0xffe3('0x2a')][_0xffe3('0x47')](_0x45c0c0[_0xffe3('0x48')],{})[_0xffe3('0x25')](respondWithResult(_0x397d66,0xc9))[_0xffe3('0x43')](handleError(_0x397d66,null));};exports[_0xffe3('0x24')]=function(_0x51c48f,_0x4e3bfd){if(_0x51c48f[_0xffe3('0x48')]['id']){delete _0x51c48f[_0xffe3('0x48')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x51c48f[_0xffe3('0x45')]['id']}})[_0xffe3('0x25')](handleEntityNotFound(_0x4e3bfd,null))['then'](saveUpdates(_0x51c48f[_0xffe3('0x48')],null))[_0xffe3('0x25')](respondWithResult(_0x4e3bfd,null))[_0xffe3('0x43')](handleError(_0x4e3bfd,null));};exports[_0xffe3('0x49')]=function(_0x2ca115,_0x424730,_0x178d5a){var _0x5bb034=require(_0xffe3('0x4a'));var _0x5c2ff6=![];var _0x2f4827={};if(_0x2ca115[_0xffe3('0x2f')]['type']&&_0x2ca115['query']['type']===_0xffe3('0x4b')){_0x2f4827[_0xffe3('0x4b')]=_0x2ca115[_0xffe3('0x45')]['id'];}else{_0x2f4827['id']=_0x2ca115[_0xffe3('0x45')]['id'];}return db[_0xffe3('0x2a')]['find']({'where':_0x2f4827,'attributes':['id',_0xffe3('0x4c'),_0xffe3('0x4d')],'raw':!![]})[_0xffe3('0x25')](handleEntityNotFound(_0x424730,null))['then'](function(_0x254775){if(_0x254775){var _0x12e381=_0x254775[_0xffe3('0x4c')];var _0x757c9c=util[_0xffe3('0x4e')]('%s.cypher',_0x12e381);if(fs[_0xffe3('0x4f')](_0x757c9c)){_0x5c2ff6=!![];return _0x5bb034[_0xffe3('0x50')](_0x757c9c,_0x12e381,config['secrets'][_0xffe3('0x51')])[_0xffe3('0x25')](function(){return _0x254775;});}return _0x254775;}})[_0xffe3('0x25')](function(_0x37c2a2){if(_0x37c2a2){var _0xa5e51=_0x37c2a2['savePath'];if(!fs['existsSync'](_0xa5e51)){throw new db[(_0xffe3('0x52'))][(_0xffe3('0x53'))](_0xffe3('0x54'));}if(_0x37c2a2[_0xffe3('0x4d')]){return _0x424730[_0xffe3('0x49')](_0xa5e51,_0x37c2a2[_0xffe3('0x4d')]+path['extname'](_0xa5e51),function(){if(_0x5c2ff6){fs[_0xffe3('0x55')](_0xa5e51);}});}else{return _0x424730[_0xffe3('0x49')](_0xa5e51,function(_0x3ba020){if(_0x5c2ff6){fs['unlink'](_0xa5e51);}});}}})['catch'](function(_0x2028a7){if(_0x2028a7['message']==='SquareRecording\x20not\x20found'){_0x424730['status'](0x194)['send'](_0xffe3('0x56'));}else{return handleError(_0x424730,null);}});};exports[_0xffe3('0x57')]=function(_0x4bd2d2,_0x28b779){return db[_0xffe3('0x2a')][_0xffe3('0x46')]({'where':{'id':_0x4bd2d2['params']['id']}})['then'](function(_0x11e4e1){if(_[_0xffe3('0x58')](_0x11e4e1)){throw new ReferenceError(_0xffe3('0x59'));}return _0x11e4e1;})[_0xffe3('0x25')](function(_0x67dcb0){var _0x3f1ee2=_0x67dcb0[_0xffe3('0x4c')];logger[_0xffe3('0x5a')](_0xffe3('0x5b'),_0x3f1ee2);if(!_[_0xffe3('0x58')](_0x67dcb0[_0xffe3('0x4c')])&&fs['existsSync'](_0x3f1ee2)){logger[_0xffe3('0x5a')]('File:\x20\x22'+_0x3f1ee2+_0xffe3('0x5c'));fs[_0xffe3('0x5d')](_0x3f1ee2);}_0x3f1ee2=_0x3f1ee2+_0xffe3('0x5e');if(!_[_0xffe3('0x58')](_0x67dcb0[_0xffe3('0x4c')])&&fs[_0xffe3('0x4f')](_0x3f1ee2)){logger[_0xffe3('0x5a')]('File:\x20\x22'+_0x3f1ee2+_0xffe3('0x5c'));fs[_0xffe3('0x5d')](_0x3f1ee2);}return _0x67dcb0;})[_0xffe3('0x25')](function(_0x1dc9b2){if(!_0x1dc9b2)throw new InternalError();return _0x1dc9b2['destroy']();})[_0xffe3('0x25')](function(){_0x28b779[_0xffe3('0x19')](0xcc)[_0xffe3('0x18')]();})[_0xffe3('0x43')](handleError(_0x28b779,null));}; \ No newline at end of file +var _0x1775=['extname','unlink','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','destroy','then','error','stack','name','send','index','SquareRecording','fieldName','type','key','map','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','uniqueid','filename','savePath','format','%s.cypher','decryptFile','recording','existsSync','ValidationError','SquareRecording\x20not\x20found','download'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1775,0x65));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x5177('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5177('0x1'));var rp=require(_0x5177('0x2'));var moment=require('moment');var BPromise=require(_0x5177('0x3'));var Mustache=require('mustache');var util=require(_0x5177('0x4'));var path=require(_0x5177('0x5'));var sox=require('sox');var csv=require(_0x5177('0x6'));var ejs=require(_0x5177('0x7'));var fs=require('fs');var fs_extra=require(_0x5177('0x8'));var _=require('lodash');var squel=require(_0x5177('0x9'));var crypto=require('crypto');var jsforce=require(_0x5177('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5177('0x6'));var querystring=require(_0x5177('0xb'));var Papa=require(_0x5177('0xc'));var Redis=require(_0x5177('0xd'));var authService=require(_0x5177('0xe'));var qs=require(_0x5177('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5177('0x10'));var logger=require(_0x5177('0x11'))('api');var utils=require(_0x5177('0x12'));var config=require(_0x5177('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5177('0x14'))['db'];function respondWithStatusCode(_0x1618e1,_0x14635a){_0x14635a=_0x14635a||0xcc;return function(_0x241072){if(_0x241072){return _0x1618e1[_0x5177('0x15')](_0x14635a);}return _0x1618e1[_0x5177('0x16')](_0x14635a)[_0x5177('0x17')]();};}function respondWithResult(_0x3edc57,_0x2dce2d){_0x2dce2d=_0x2dce2d||0xc8;return function(_0x473098){if(_0x473098){return _0x3edc57[_0x5177('0x16')](_0x2dce2d)[_0x5177('0x18')](_0x473098);}};}function respondWithFilteredResult(_0x5b7250,_0x486af5){return function(_0x510e83){if(_0x510e83){var _0x22a5a4=typeof _0x486af5[_0x5177('0x19')]===_0x5177('0x1a')&&typeof _0x486af5[_0x5177('0x1b')]==='undefined';var _0x5ed6de=_0x510e83['count'];var _0x3c4e69=_0x22a5a4?0x0:_0x486af5[_0x5177('0x19')];var _0x4c6465=_0x22a5a4?_0x510e83[_0x5177('0x1c')]:_0x486af5[_0x5177('0x19')]+_0x486af5[_0x5177('0x1b')];var _0x190a72;if(_0x4c6465>=_0x5ed6de){_0x4c6465=_0x5ed6de;_0x190a72=0xc8;}else{_0x190a72=0xce;}_0x5b7250[_0x5177('0x16')](_0x190a72);return _0x5b7250['set']('Content-Range',_0x3c4e69+'-'+_0x4c6465+'/'+_0x5ed6de)['json'](_0x510e83);}return null;};}function patchUpdates(_0x25f6f5){return function(_0x581059){try{jsonpatch['apply'](_0x581059,_0x25f6f5,!![]);}catch(_0x54563a){return BPromise[_0x5177('0x1d')](_0x54563a);}return _0x581059['save']();};}function saveUpdates(_0x543a02,_0x18a00f){return function(_0x4c52ff){if(_0x4c52ff){return _0x4c52ff[_0x5177('0x1e')](_0x543a02)['then'](function(_0x2f4715){return _0x2f4715;});}return null;};}function removeEntity(_0x5ad472,_0x458b22){return function(_0x447e50){if(_0x447e50){return _0x447e50[_0x5177('0x1f')]()[_0x5177('0x20')](function(){_0x5ad472[_0x5177('0x16')](0xcc)[_0x5177('0x17')]();});}};}function handleEntityNotFound(_0x2f7c1a,_0x216ba2){return function(_0x4cd3dc){if(!_0x4cd3dc){_0x2f7c1a[_0x5177('0x15')](0x194);}return _0x4cd3dc;};}function handleError(_0x5656c4,_0x48c5aa){_0x48c5aa=_0x48c5aa||0x1f4;return function(_0xb8a492){logger[_0x5177('0x21')](_0xb8a492[_0x5177('0x22')]);if(_0xb8a492[_0x5177('0x23')]){delete _0xb8a492[_0x5177('0x23')];}_0x5656c4[_0x5177('0x16')](_0x48c5aa)[_0x5177('0x24')](_0xb8a492);};}exports[_0x5177('0x25')]=function(_0x5b1b,_0x117ae0){var _0x5d9753={},_0x2871f1={},_0x142225={'count':0x0,'rows':[]};var _0x18ec52=_['map'](db[_0x5177('0x26')]['rawAttributes'],function(_0x10399d){return{'name':_0x10399d[_0x5177('0x27')],'type':_0x10399d[_0x5177('0x28')][_0x5177('0x29')]};});_0x2871f1['model']=_[_0x5177('0x2a')](_0x18ec52,_0x5177('0x23'));_0x2871f1['query']=_[_0x5177('0x2b')](_0x5b1b[_0x5177('0x2c')]);_0x2871f1['filters']=_['intersection'](_0x2871f1[_0x5177('0x2d')],_0x2871f1[_0x5177('0x2c')]);_0x5d9753[_0x5177('0x2e')]=_[_0x5177('0x2f')](_0x2871f1[_0x5177('0x2d')],qs[_0x5177('0x30')](_0x5b1b[_0x5177('0x2c')]['fields']));_0x5d9753['attributes']=_0x5d9753[_0x5177('0x2e')][_0x5177('0x31')]?_0x5d9753[_0x5177('0x2e')]:_0x2871f1[_0x5177('0x2d')];if(!_0x5b1b[_0x5177('0x2c')][_0x5177('0x32')](_0x5177('0x33'))){_0x5d9753[_0x5177('0x1b')]=qs['limit'](_0x5b1b[_0x5177('0x2c')][_0x5177('0x1b')]);_0x5d9753['offset']=qs[_0x5177('0x19')](_0x5b1b['query'][_0x5177('0x19')]);}_0x5d9753[_0x5177('0x34')]=qs[_0x5177('0x35')](_0x5b1b['query']['sort']);_0x5d9753[_0x5177('0x36')]=qs['filters'](_[_0x5177('0x37')](_0x5b1b['query'],_0x2871f1['filters']),_0x18ec52);if(_0x5b1b[_0x5177('0x2c')][_0x5177('0x38')]){_0x5d9753['where']=_[_0x5177('0x39')](_0x5d9753['where'],{'$or':_[_0x5177('0x2a')](_0x18ec52,function(_0x19567f){if(_0x19567f[_0x5177('0x28')]!=='VIRTUAL'){var _0x2bf9dc={};_0x2bf9dc[_0x19567f[_0x5177('0x23')]]={'$like':'%'+_0x5b1b[_0x5177('0x2c')][_0x5177('0x38')]+'%'};return _0x2bf9dc;}})});}_0x5d9753=_[_0x5177('0x39')]({},_0x5d9753,_0x5b1b[_0x5177('0x3a')]);var _0x437c2f={'where':_0x5d9753[_0x5177('0x36')]};return db[_0x5177('0x26')][_0x5177('0x1c')](_0x437c2f)['then'](function(_0x2027a9){_0x142225[_0x5177('0x1c')]=_0x2027a9;if(_0x5b1b[_0x5177('0x2c')][_0x5177('0x3b')]){_0x5d9753[_0x5177('0x3c')]=[{'all':!![]}];}return db[_0x5177('0x26')][_0x5177('0x3d')](_0x5d9753);})[_0x5177('0x20')](function(_0x3df3d0){_0x142225[_0x5177('0x3e')]=_0x3df3d0;return _0x142225;})['then'](respondWithFilteredResult(_0x117ae0,_0x5d9753))['catch'](handleError(_0x117ae0,null));};exports[_0x5177('0x3f')]=function(_0x54c9e3,_0x54b063){var _0x12429e={'raw':!![],'where':{'id':_0x54c9e3['params']['id']}},_0x146684={};_0x146684[_0x5177('0x2d')]=_['keys'](db[_0x5177('0x26')][_0x5177('0x40')]);_0x146684['query']=_[_0x5177('0x2b')](_0x54c9e3[_0x5177('0x2c')]);_0x146684['filters']=_[_0x5177('0x2f')](_0x146684[_0x5177('0x2d')],_0x146684[_0x5177('0x2c')]);_0x12429e[_0x5177('0x2e')]=_[_0x5177('0x2f')](_0x146684[_0x5177('0x2d')],qs['fields'](_0x54c9e3[_0x5177('0x2c')][_0x5177('0x30')]));_0x12429e['attributes']=_0x12429e[_0x5177('0x2e')][_0x5177('0x31')]?_0x12429e[_0x5177('0x2e')]:_0x146684['model'];if(_0x54c9e3[_0x5177('0x2c')][_0x5177('0x3b')]){_0x12429e[_0x5177('0x3c')]=[{'all':!![]}];}_0x12429e=_['merge']({},_0x12429e,_0x54c9e3['options']);return db[_0x5177('0x26')][_0x5177('0x41')](_0x12429e)[_0x5177('0x20')](handleEntityNotFound(_0x54b063,null))[_0x5177('0x20')](respondWithResult(_0x54b063,null))[_0x5177('0x42')](handleError(_0x54b063,null));};exports[_0x5177('0x43')]=function(_0x265e54,_0x474309){return db[_0x5177('0x26')][_0x5177('0x43')](_0x265e54[_0x5177('0x44')],{})[_0x5177('0x20')](respondWithResult(_0x474309,0xc9))[_0x5177('0x42')](handleError(_0x474309,null));};exports[_0x5177('0x1e')]=function(_0x2c74ae,_0x6c0f4d){if(_0x2c74ae['body']['id']){delete _0x2c74ae[_0x5177('0x44')]['id'];}return db[_0x5177('0x26')][_0x5177('0x41')]({'where':{'id':_0x2c74ae[_0x5177('0x45')]['id']}})[_0x5177('0x20')](handleEntityNotFound(_0x6c0f4d,null))['then'](saveUpdates(_0x2c74ae['body'],null))[_0x5177('0x20')](respondWithResult(_0x6c0f4d,null))['catch'](handleError(_0x6c0f4d,null));};exports['download']=function(_0x3502fc,_0x266e3a,_0x23fdbb){var _0x371a73=require('../../components/encryptor');var _0x1e0ef2=![];var _0x2c5108={};if(_0x3502fc['query'][_0x5177('0x28')]&&_0x3502fc['query'][_0x5177('0x28')]===_0x5177('0x46')){_0x2c5108[_0x5177('0x46')]=_0x3502fc[_0x5177('0x45')]['id'];}else{_0x2c5108['id']=_0x3502fc['params']['id'];}return db[_0x5177('0x26')][_0x5177('0x41')]({'where':_0x2c5108,'attributes':['id','savePath',_0x5177('0x47')],'raw':!![]})[_0x5177('0x20')](handleEntityNotFound(_0x266e3a,null))[_0x5177('0x20')](function(_0x3f1e05){if(_0x3f1e05){var _0x5d7728=_0x3f1e05[_0x5177('0x48')];var _0x30762e=util[_0x5177('0x49')](_0x5177('0x4a'),_0x5d7728);if(fs['existsSync'](_0x30762e)){_0x1e0ef2=!![];return _0x371a73[_0x5177('0x4b')](_0x30762e,_0x5d7728,config['secrets'][_0x5177('0x4c')])[_0x5177('0x20')](function(){return _0x3f1e05;});}return _0x3f1e05;}})['then'](function(_0x35b068){if(_0x35b068){var _0x553408=_0x35b068[_0x5177('0x48')];if(!fs[_0x5177('0x4d')](_0x553408)){throw new db['Sequelize'][(_0x5177('0x4e'))](_0x5177('0x4f'));}if(_0x35b068[_0x5177('0x47')]){return _0x266e3a[_0x5177('0x50')](_0x553408,_0x35b068[_0x5177('0x47')]+path[_0x5177('0x51')](_0x553408),function(){if(_0x1e0ef2){fs[_0x5177('0x52')](_0x553408);}});}else{return _0x266e3a[_0x5177('0x50')](_0x553408,function(_0xabd07a){if(_0x1e0ef2){fs['unlink'](_0x553408);}});}}})[_0x5177('0x42')](function(_0x28623d){if(_0x28623d['message']===_0x5177('0x4f')){_0x266e3a[_0x5177('0x16')](0x194)[_0x5177('0x24')](_0x5177('0x53'));}else{return handleError(_0x266e3a,null);}});};exports[_0x5177('0x1f')]=function(_0x1a35de,_0x4667ae){return db[_0x5177('0x26')]['find']({'where':{'id':_0x1a35de[_0x5177('0x45')]['id']}})[_0x5177('0x20')](function(_0x205b55){if(_['isNil'](_0x205b55)){throw new ReferenceError('Entity\x20not\x20found');}return _0x205b55;})[_0x5177('0x20')](function(_0x496903){var _0x20401f=_0x496903[_0x5177('0x48')];logger[_0x5177('0x54')](_0x5177('0x55'),_0x20401f);if(!_['isNil'](_0x496903[_0x5177('0x48')])&&fs[_0x5177('0x4d')](_0x20401f)){logger[_0x5177('0x54')](_0x5177('0x56')+_0x20401f+_0x5177('0x57'));fs[_0x5177('0x58')](_0x20401f);}_0x20401f=_0x20401f+_0x5177('0x59');if(!_[_0x5177('0x5a')](_0x496903['savePath'])&&fs[_0x5177('0x4d')](_0x20401f)){logger[_0x5177('0x54')](_0x5177('0x56')+_0x20401f+_0x5177('0x57'));fs[_0x5177('0x58')](_0x20401f);}return _0x496903;})[_0x5177('0x20')](function(_0x3d9602){if(!_0x3d9602)throw new InternalError();return _0x3d9602[_0x5177('0x1f')]();})[_0x5177('0x20')](function(){_0x4667ae[_0x5177('0x16')](0xcc)[_0x5177('0x17')]();})['catch'](handleError(_0x4667ae,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1bff178..c3cfd35 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 _0xf981=['exports','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes'];(function(_0x28bc34,_0x5dabd2){var _0x87b2e3=function(_0x26ef09){while(--_0x26ef09){_0x28bc34['push'](_0x28bc34['shift']());}};_0x87b2e3(++_0x5dabd2);}(_0xf981,0xe6));var _0x1f98=function(_0x1a267d,_0x24dbe9){_0x1a267d=_0x1a267d-0x0;var _0x2fd328=_0xf981[_0x1a267d];return _0x2fd328;};'use strict';var _=require(_0x1f98('0x0'));var util=require(_0x1f98('0x1'));var logger=require(_0x1f98('0x2'))(_0x1f98('0x3'));var moment=require(_0x1f98('0x4'));var BPromise=require(_0x1f98('0x5'));var rp=require(_0x1f98('0x6'));var fs=require('fs');var path=require(_0x1f98('0x7'));var rimraf=require('rimraf');var config=require(_0x1f98('0x8'));var attributes=require(_0x1f98('0x9'));module[_0x1f98('0xa')]=function(_0x14bb19,_0x285cdc){return _0x14bb19['define']('SquareRecording',attributes,{'tableName':_0x1f98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x363e=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings'];(function(_0x141352,_0x5aa338){var _0x3d8110=function(_0x4f0508){while(--_0x4f0508){_0x141352['push'](_0x141352['shift']());}};_0x3d8110(++_0x5aa338);}(_0x363e,0x179));var _0xe363=function(_0x3289a5,_0x1ba0a6){_0x3289a5=_0x3289a5-0x0;var _0x5d35f4=_0x363e[_0x3289a5];return _0x5d35f4;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var logger=require('../../config/logger')(_0xe363('0x2'));var moment=require(_0xe363('0x3'));var BPromise=require(_0xe363('0x4'));var rp=require(_0xe363('0x5'));var fs=require('fs');var path=require(_0xe363('0x6'));var rimraf=require(_0xe363('0x7'));var config=require(_0xe363('0x8'));var attributes=require(_0xe363('0x9'));module[_0xe363('0xa')]=function(_0x1834ca,_0x8953cc){return _0x1834ca['define'](_0xe363('0xb'),attributes,{'tableName':_0xe363('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 60e2a1e..569c73d 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 _0x6de3=['rpc','../../config/environment','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','body','options','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4d7241,_0x32aa1f){var _0x59d9e2=function(_0x30e273){while(--_0x30e273){_0x4d7241['push'](_0x4d7241['shift']());}};_0x59d9e2(++_0x32aa1f);}(_0x6de3,0x14c));var _0x36de=function(_0x507534,_0x5372ab){_0x507534=_0x507534-0x0;var _0x363749=_0x6de3[_0x507534];return _0x363749;};'use strict';var _=require(_0x36de('0x0'));var util=require('util');var moment=require(_0x36de('0x1'));var BPromise=require('bluebird');var rs=require(_0x36de('0x2'));var fs=require('fs');var Redis=require(_0x36de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x36de('0x4'));var logger=require(_0x36de('0x5'))(_0x36de('0x6'));var config=require(_0x36de('0x7'));var jayson=require(_0x36de('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x595f2b,_0x2e36d6,_0x58caa1){return new BPromise(function(_0x2fa361,_0xea763e){return client[_0x36de('0x9')](_0x595f2b,_0x58caa1)[_0x36de('0xa')](function(_0xec2484){logger[_0x36de('0xb')](_0x36de('0xc'),_0x2e36d6,'request\x20sent');logger[_0x36de('0xd')](_0x36de('0xe'),_0x2e36d6,'request\x20sent',JSON[_0x36de('0xf')](_0xec2484));if(_0xec2484[_0x36de('0x10')]){if(_0xec2484[_0x36de('0x10')]['code']===0x1f4){logger['error'](_0x36de('0xc'),_0x2e36d6,_0xec2484[_0x36de('0x10')][_0x36de('0x11')]);return _0xea763e(_0xec2484[_0x36de('0x10')][_0x36de('0x11')]);}logger[_0x36de('0x10')](_0x36de('0xc'),_0x2e36d6,_0xec2484['error']['message']);return _0x2fa361(_0xec2484['error'][_0x36de('0x11')]);}else{logger[_0x36de('0xb')]('SquareRecording,\x20%s,\x20%s',_0x2e36d6,_0x36de('0x12'));_0x2fa361(_0xec2484[_0x36de('0x13')][_0x36de('0x11')]);}})[_0x36de('0x14')](function(_0x46cdee){logger[_0x36de('0x10')]('SquareRecording,\x20%s,\x20%s',_0x2e36d6,_0x46cdee);_0xea763e(_0x46cdee);});});}exports[_0x36de('0x15')]=function(_0x9ac554){var _0x500c97=this;return new Promise(function(_0x38a4f4,_0x481a38){return db[_0x36de('0x16')][_0x36de('0x17')](_0x9ac554[_0x36de('0x18')],{'raw':_0x9ac554[_0x36de('0x19')]?_0x9ac554[_0x36de('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x36de('0xa')](function(_0x4ddce9){logger['info'](_0x36de('0x15'),_0x9ac554);logger[_0x36de('0xd')](_0x36de('0x15'),_0x9ac554,JSON[_0x36de('0xf')](_0x4ddce9));_0x38a4f4(_0x4ddce9);})['catch'](function(_0x37ca99){logger[_0x36de('0x10')](_0x36de('0x15'),_0x37ca99[_0x36de('0x11')],_0x9ac554);_0x481a38(_0x500c97[_0x36de('0x10')](0x1f4,_0x37ca99[_0x36de('0x11')]));});});}; \ No newline at end of file +var _0xc527=['ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','debug','lodash','util','moment','randomstring'];(function(_0xaac2fd,_0x5357a7){var _0x57c27a=function(_0x28293f){while(--_0x28293f){_0xaac2fd['push'](_0xaac2fd['shift']());}};_0x57c27a(++_0x5357a7);}(_0xc527,0x168));var _0x7c52=function(_0x51a163,_0x10acbb){_0x51a163=_0x51a163-0x0;var _0x3a2cb4=_0xc527[_0x51a163];return _0x3a2cb4;};'use strict';var _=require(_0x7c52('0x0'));var util=require(_0x7c52('0x1'));var moment=require(_0x7c52('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c52('0x3'));var fs=require('fs');var Redis=require(_0x7c52('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7c52('0x5'))(_0x7c52('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c52('0x7'));var client=jayson[_0x7c52('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e266d,_0x5a079c,_0x370638){return new BPromise(function(_0xaef977,_0x3a719b){return client[_0x7c52('0x9')](_0x5e266d,_0x370638)[_0x7c52('0xa')](function(_0x4be1b5){logger[_0x7c52('0xb')]('SquareRecording,\x20%s,\x20%s',_0x5a079c,_0x7c52('0xc'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5a079c,_0x7c52('0xc'),JSON[_0x7c52('0xd')](_0x4be1b5));if(_0x4be1b5[_0x7c52('0xe')]){if(_0x4be1b5['error'][_0x7c52('0xf')]===0x1f4){logger['error'](_0x7c52('0x10'),_0x5a079c,_0x4be1b5[_0x7c52('0xe')][_0x7c52('0x11')]);return _0x3a719b(_0x4be1b5['error'][_0x7c52('0x11')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x5a079c,_0x4be1b5[_0x7c52('0xe')][_0x7c52('0x11')]);return _0xaef977(_0x4be1b5[_0x7c52('0xe')][_0x7c52('0x11')]);}else{logger[_0x7c52('0xb')](_0x7c52('0x10'),_0x5a079c,_0x7c52('0xc'));_0xaef977(_0x4be1b5[_0x7c52('0x12')][_0x7c52('0x11')]);}})[_0x7c52('0x13')](function(_0x41d2ab){logger[_0x7c52('0xe')]('SquareRecording,\x20%s,\x20%s',_0x5a079c,_0x41d2ab);_0x3a719b(_0x41d2ab);});});}exports[_0x7c52('0x14')]=function(_0x19ed72){var _0x380982=this;return new Promise(function(_0x361480,_0x5d0089){return db[_0x7c52('0x15')]['create'](_0x19ed72[_0x7c52('0x16')],{'raw':_0x19ed72['options']?_0x19ed72[_0x7c52('0x17')][_0x7c52('0x18')]===undefined?!![]:![]:!![]})[_0x7c52('0xa')](function(_0x33d4fb){logger[_0x7c52('0xb')](_0x7c52('0x14'),_0x19ed72);logger[_0x7c52('0x19')](_0x7c52('0x14'),_0x19ed72,JSON[_0x7c52('0xd')](_0x33d4fb));_0x361480(_0x33d4fb);})[_0x7c52('0x13')](function(_0x3d6ed6){logger[_0x7c52('0xe')](_0x7c52('0x14'),_0x3d6ed6[_0x7c52('0x11')],_0x19ed72);_0x5d0089(_0x380982['error'](0x1f4,_0x3d6ed6[_0x7c52('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7542b3b..989c8a4 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x101176,_0x1ad975){var _0x4ec27c=function(_0x13b7bb){while(--_0x13b7bb){_0x101176['push'](_0x101176['shift']());}};_0x4ec27c(++_0x1ad975);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x291769,_0x1302d5){var _0x148543=function(_0x5a1ecb){while(--_0x5a1ecb){_0x291769['push'](_0x291769['shift']());}};_0x148543(++_0x1302d5);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a7123e1..cdbbfe9 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 _0xa301=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0xa301,0xfb));var _0x1a30=function(_0x3a560b,_0x2977b7){_0x3a560b=_0x3a560b-0x0;var _0x165de0=_0xa301[_0x3a560b];return _0x165de0;};'use strict';var Sequelize=require(_0x1a30('0x0'));module[_0x1a30('0x1')]={'network':{'type':Sequelize[_0x1a30('0x2')]},'network_script':{'type':Sequelize[_0x1a30('0x2')]},'request':{'type':Sequelize[_0x1a30('0x2')]},'channel':{'type':Sequelize[_0x1a30('0x2')]},'language':{'type':Sequelize[_0x1a30('0x2')]},'type':{'type':Sequelize[_0x1a30('0x2')]},'uniqueid':{'type':Sequelize[_0x1a30('0x2')]},'version':{'type':Sequelize[_0x1a30('0x2')]},'callerid':{'type':Sequelize[_0x1a30('0x2')]},'calleridname':{'type':Sequelize[_0x1a30('0x2')]},'callingpres':{'type':Sequelize[_0x1a30('0x2')]},'callingani2':{'type':Sequelize[_0x1a30('0x2')]},'callington':{'type':Sequelize[_0x1a30('0x2')]},'callingtns':{'type':Sequelize[_0x1a30('0x2')]},'dnid':{'type':Sequelize[_0x1a30('0x2')]},'rdnis':{'type':Sequelize[_0x1a30('0x2')]},'context':{'type':Sequelize[_0x1a30('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x1a30('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x1a30('0x2')]},'project_name':{'type':Sequelize[_0x1a30('0x2')]},'joinAt':{'type':Sequelize[_0x1a30('0x3')]},'leaveAt':{'type':Sequelize[_0x1a30('0x3')]},'bot':{'type':Sequelize[_0x1a30('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xca81=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xca81,0x163));var _0x1ca8=function(_0x884c34,_0x134c96){_0x884c34=_0x884c34-0x0;var _0x593785=_0xca81[_0x884c34];return _0x593785;};'use strict';var Sequelize=require(_0x1ca8('0x0'));module[_0x1ca8('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x1ca8('0x2')]},'request':{'type':Sequelize[_0x1ca8('0x2')]},'channel':{'type':Sequelize[_0x1ca8('0x2')]},'language':{'type':Sequelize[_0x1ca8('0x2')]},'type':{'type':Sequelize[_0x1ca8('0x2')]},'uniqueid':{'type':Sequelize[_0x1ca8('0x2')]},'version':{'type':Sequelize[_0x1ca8('0x2')]},'callerid':{'type':Sequelize[_0x1ca8('0x2')]},'calleridname':{'type':Sequelize[_0x1ca8('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x1ca8('0x2')]},'callington':{'type':Sequelize[_0x1ca8('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x1ca8('0x2')]},'rdnis':{'type':Sequelize[_0x1ca8('0x2')]},'context':{'type':Sequelize[_0x1ca8('0x2')]},'extension':{'type':Sequelize[_0x1ca8('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x1ca8('0x2')]},'accountcode':{'type':Sequelize[_0x1ca8('0x2')]},'threadid':{'type':Sequelize[_0x1ca8('0x2')]},'project_name':{'type':Sequelize[_0x1ca8('0x2')]},'joinAt':{'type':Sequelize[_0x1ca8('0x3')]},'leaveAt':{'type':Sequelize[_0x1ca8('0x3')]},'bot':{'type':Sequelize[_0x1ca8('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 96ace0e..8f4b7e3 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 _0x095d=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','SquareReport','findAll','rows','catch','show','params','find','create','body','describe','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes'];(function(_0x185c76,_0x534cc3){var _0x7820b7=function(_0x3bcd58){while(--_0x3bcd58){_0x185c76['push'](_0x185c76['shift']());}};_0x7820b7(++_0x534cc3);}(_0x095d,0x148));var _0xd095=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0x095d[_0x4c2f30];return _0xb8854d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd095('0x0'));var Mustache=require(_0xd095('0x1'));var util=require(_0xd095('0x2'));var path=require('path');var sox=require(_0xd095('0x3'));var csv=require(_0xd095('0x4'));var ejs=require(_0xd095('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd095('0x6'));var squel=require(_0xd095('0x7'));var crypto=require(_0xd095('0x8'));var jsforce=require(_0xd095('0x9'));var deskjs=require(_0xd095('0xa'));var toCsv=require(_0xd095('0x4'));var querystring=require(_0xd095('0xb'));var Papa=require('papaparse');var Redis=require(_0xd095('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd095('0xd'));var as=require(_0xd095('0xe'));var hardwareService=require(_0xd095('0xf'));var logger=require('../../config/logger')(_0xd095('0x10'));var utils=require(_0xd095('0x11'));var config=require(_0xd095('0x12'));var licenseUtil=require(_0xd095('0x13'));var db=require(_0xd095('0x14'))['db'];function respondWithStatusCode(_0x141896,_0x21b02c){_0x21b02c=_0x21b02c||0xcc;return function(_0x3b3eee){if(_0x3b3eee){return _0x141896[_0xd095('0x15')](_0x21b02c);}return _0x141896[_0xd095('0x16')](_0x21b02c)[_0xd095('0x17')]();};}function respondWithResult(_0x2a4e9b,_0x541f70){_0x541f70=_0x541f70||0xc8;return function(_0xf1925b){if(_0xf1925b){return _0x2a4e9b[_0xd095('0x16')](_0x541f70)[_0xd095('0x18')](_0xf1925b);}};}function respondWithFilteredResult(_0x554ba5,_0x294df6){return function(_0x29db2f){if(_0x29db2f){var _0x281985=typeof _0x294df6[_0xd095('0x19')]===_0xd095('0x1a')&&typeof _0x294df6[_0xd095('0x1b')]===_0xd095('0x1a');var _0x33e1b1=_0x29db2f[_0xd095('0x1c')];var _0x11b000=_0x281985?0x0:_0x294df6[_0xd095('0x19')];var _0x1039bd=_0x281985?_0x29db2f[_0xd095('0x1c')]:_0x294df6[_0xd095('0x19')]+_0x294df6['limit'];var _0x8116c4;if(_0x1039bd>=_0x33e1b1){_0x1039bd=_0x33e1b1;_0x8116c4=0xc8;}else{_0x8116c4=0xce;}_0x554ba5[_0xd095('0x16')](_0x8116c4);return _0x554ba5[_0xd095('0x1d')](_0xd095('0x1e'),_0x11b000+'-'+_0x1039bd+'/'+_0x33e1b1)[_0xd095('0x18')](_0x29db2f);}return null;};}function patchUpdates(_0x6baab7){return function(_0x2e48b1){try{jsonpatch[_0xd095('0x1f')](_0x2e48b1,_0x6baab7,!![]);}catch(_0x41a988){return BPromise[_0xd095('0x20')](_0x41a988);}return _0x2e48b1[_0xd095('0x21')]();};}function saveUpdates(_0x79577f,_0x3ea7ad){return function(_0x53605b){if(_0x53605b){return _0x53605b[_0xd095('0x22')](_0x79577f)[_0xd095('0x23')](function(_0x42de13){return _0x42de13;});}return null;};}function removeEntity(_0x2ea895,_0x323759){return function(_0x13c6d5){if(_0x13c6d5){return _0x13c6d5[_0xd095('0x24')]()['then'](function(){_0x2ea895[_0xd095('0x16')](0xcc)[_0xd095('0x17')]();});}};}function handleEntityNotFound(_0xe926c8,_0x12b524){return function(_0x1aed0e){if(!_0x1aed0e){_0xe926c8[_0xd095('0x15')](0x194);}return _0x1aed0e;};}function handleError(_0x57e4e1,_0x1b2f84){_0x1b2f84=_0x1b2f84||0x1f4;return function(_0x486b6b){logger[_0xd095('0x25')](_0x486b6b[_0xd095('0x26')]);if(_0x486b6b[_0xd095('0x27')]){delete _0x486b6b['name'];}_0x57e4e1['status'](_0x1b2f84)['send'](_0x486b6b);};}exports[_0xd095('0x28')]=function(_0x354c9e,_0x45a277){var _0x5090e0={},_0x4e0d69={},_0x3ee10d={'count':0x0,'rows':[]};var _0x8ddafa=_['map'](db['SquareReport'][_0xd095('0x29')],function(_0x1e011c){return{'name':_0x1e011c[_0xd095('0x2a')],'type':_0x1e011c['type'][_0xd095('0x2b')]};});_0x4e0d69[_0xd095('0x2c')]=_['map'](_0x8ddafa,_0xd095('0x27'));_0x4e0d69[_0xd095('0x2d')]=_[_0xd095('0x2e')](_0x354c9e[_0xd095('0x2d')]);_0x4e0d69[_0xd095('0x2f')]=_[_0xd095('0x30')](_0x4e0d69[_0xd095('0x2c')],_0x4e0d69[_0xd095('0x2d')]);_0x5090e0['attributes']=_[_0xd095('0x30')](_0x4e0d69['model'],qs[_0xd095('0x31')](_0x354c9e[_0xd095('0x2d')][_0xd095('0x31')]));_0x5090e0[_0xd095('0x32')]=_0x5090e0[_0xd095('0x32')][_0xd095('0x33')]?_0x5090e0[_0xd095('0x32')]:_0x4e0d69[_0xd095('0x2c')];if(!_0x354c9e[_0xd095('0x2d')]['hasOwnProperty'](_0xd095('0x34'))){_0x5090e0[_0xd095('0x1b')]=qs['limit'](_0x354c9e[_0xd095('0x2d')][_0xd095('0x1b')]);_0x5090e0[_0xd095('0x19')]=qs[_0xd095('0x19')](_0x354c9e[_0xd095('0x2d')][_0xd095('0x19')]);}_0x5090e0[_0xd095('0x35')]=qs[_0xd095('0x36')](_0x354c9e[_0xd095('0x2d')][_0xd095('0x36')]);_0x5090e0['where']=qs['filters'](_[_0xd095('0x37')](_0x354c9e[_0xd095('0x2d')],_0x4e0d69[_0xd095('0x2f')]),_0x8ddafa);if(_0x354c9e[_0xd095('0x2d')][_0xd095('0x38')]){_0x5090e0[_0xd095('0x39')]=_[_0xd095('0x3a')](_0x5090e0['where'],{'$or':_[_0xd095('0x3b')](_0x8ddafa,function(_0xd6b93e){if(_0xd6b93e['type']!==_0xd095('0x3c')){var _0x3d7bba={};_0x3d7bba[_0xd6b93e[_0xd095('0x27')]]={'$like':'%'+_0x354c9e['query'][_0xd095('0x38')]+'%'};return _0x3d7bba;}})});}_0x5090e0=_[_0xd095('0x3a')]({},_0x5090e0,_0x354c9e[_0xd095('0x3d')]);var _0x2e7992={'where':_0x5090e0[_0xd095('0x39')]};return db['SquareReport']['count'](_0x2e7992)[_0xd095('0x23')](function(_0x493e1c){_0x3ee10d[_0xd095('0x1c')]=_0x493e1c;if(_0x354c9e[_0xd095('0x2d')][_0xd095('0x3e')]){_0x5090e0[_0xd095('0x3f')]=[{'all':!![]}];}return db[_0xd095('0x40')][_0xd095('0x41')](_0x5090e0);})[_0xd095('0x23')](function(_0xad100a){_0x3ee10d[_0xd095('0x42')]=_0xad100a;return _0x3ee10d;})['then'](respondWithFilteredResult(_0x45a277,_0x5090e0))[_0xd095('0x43')](handleError(_0x45a277,null));};exports[_0xd095('0x44')]=function(_0x27280a,_0x4759bb){var _0x3770e0={'raw':!![],'where':{'id':_0x27280a[_0xd095('0x45')]['id']}},_0x41442c={};_0x41442c[_0xd095('0x2c')]=_[_0xd095('0x2e')](db[_0xd095('0x40')][_0xd095('0x29')]);_0x41442c[_0xd095('0x2d')]=_[_0xd095('0x2e')](_0x27280a[_0xd095('0x2d')]);_0x41442c[_0xd095('0x2f')]=_[_0xd095('0x30')](_0x41442c[_0xd095('0x2c')],_0x41442c['query']);_0x3770e0[_0xd095('0x32')]=_[_0xd095('0x30')](_0x41442c[_0xd095('0x2c')],qs[_0xd095('0x31')](_0x27280a['query'][_0xd095('0x31')]));_0x3770e0[_0xd095('0x32')]=_0x3770e0[_0xd095('0x32')][_0xd095('0x33')]?_0x3770e0[_0xd095('0x32')]:_0x41442c[_0xd095('0x2c')];if(_0x27280a[_0xd095('0x2d')][_0xd095('0x3e')]){_0x3770e0['include']=[{'all':!![]}];}_0x3770e0=_[_0xd095('0x3a')]({},_0x3770e0,_0x27280a[_0xd095('0x3d')]);return db[_0xd095('0x40')][_0xd095('0x46')](_0x3770e0)[_0xd095('0x23')](handleEntityNotFound(_0x4759bb,null))[_0xd095('0x23')](respondWithResult(_0x4759bb,null))[_0xd095('0x43')](handleError(_0x4759bb,null));};exports[_0xd095('0x47')]=function(_0x3eaa39,_0xac2f80){return db[_0xd095('0x40')]['create'](_0x3eaa39['body'],{})['then'](respondWithResult(_0xac2f80,0xc9))[_0xd095('0x43')](handleError(_0xac2f80,null));};exports[_0xd095('0x22')]=function(_0x2b23eb,_0x3b0c20){if(_0x2b23eb[_0xd095('0x48')]['id']){delete _0x2b23eb[_0xd095('0x48')]['id'];}return db[_0xd095('0x40')][_0xd095('0x46')]({'where':{'id':_0x2b23eb[_0xd095('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b0c20,null))[_0xd095('0x23')](saveUpdates(_0x2b23eb[_0xd095('0x48')],null))[_0xd095('0x23')](respondWithResult(_0x3b0c20,null))[_0xd095('0x43')](handleError(_0x3b0c20,null));};exports['destroy']=function(_0x21ff4e,_0x479c2a){return db[_0xd095('0x40')][_0xd095('0x46')]({'where':{'id':_0x21ff4e[_0xd095('0x45')]['id']}})[_0xd095('0x23')](handleEntityNotFound(_0x479c2a,null))['then'](removeEntity(_0x479c2a,null))[_0xd095('0x43')](handleError(_0x479c2a,null));};exports[_0xd095('0x49')]=function(_0x4476ac,_0x446878){return db[_0xd095('0x40')][_0xd095('0x49')]()['then'](respondWithResult(_0x446878,null))[_0xd095('0x43')](handleError(_0x446878,null));}; \ No newline at end of file +var _0x921f=['mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','SquareReport','includeAll','findAll','rows','catch','rawAttributes','length','include','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4dcac4,_0x10e48a){var _0x2a238d=function(_0x25c6fc){while(--_0x25c6fc){_0x4dcac4['push'](_0x4dcac4['shift']());}};_0x2a238d(++_0x10e48a);}(_0x921f,0x92));var _0xf921=function(_0x466ef2,_0x577783){_0x466ef2=_0x466ef2-0x0;var _0x2e39b5=_0x921f[_0x466ef2];return _0x2e39b5;};'use strict';var emlformat=require(_0xf921('0x0'));var rimraf=require(_0xf921('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf921('0x2'));var rp=require(_0xf921('0x3'));var moment=require(_0xf921('0x4'));var BPromise=require(_0xf921('0x5'));var Mustache=require(_0xf921('0x6'));var util=require(_0xf921('0x7'));var path=require(_0xf921('0x8'));var sox=require('sox');var csv=require(_0xf921('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf921('0xa'));var squel=require(_0xf921('0xb'));var crypto=require(_0xf921('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf921('0xd'));var toCsv=require(_0xf921('0x9'));var querystring=require(_0xf921('0xe'));var Papa=require(_0xf921('0xf'));var Redis=require(_0xf921('0x10'));var authService=require(_0xf921('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf921('0x12'));var hardwareService=require(_0xf921('0x13'));var logger=require(_0xf921('0x14'))(_0xf921('0x15'));var utils=require(_0xf921('0x16'));var config=require(_0xf921('0x17'));var licenseUtil=require(_0xf921('0x18'));var db=require(_0xf921('0x19'))['db'];function respondWithStatusCode(_0x479326,_0x5b54d3){_0x5b54d3=_0x5b54d3||0xcc;return function(_0x5e043a){if(_0x5e043a){return _0x479326[_0xf921('0x1a')](_0x5b54d3);}return _0x479326[_0xf921('0x1b')](_0x5b54d3)['end']();};}function respondWithResult(_0x13c66c,_0x3193f7){_0x3193f7=_0x3193f7||0xc8;return function(_0x32b80e){if(_0x32b80e){return _0x13c66c['status'](_0x3193f7)[_0xf921('0x1c')](_0x32b80e);}};}function respondWithFilteredResult(_0x5365d5,_0x22a45e){return function(_0x44f1c1){if(_0x44f1c1){var _0x3cc37b=typeof _0x22a45e[_0xf921('0x1d')]==='undefined'&&typeof _0x22a45e[_0xf921('0x1e')]===_0xf921('0x1f');var _0x5aec6b=_0x44f1c1[_0xf921('0x20')];var _0xd5f5b3=_0x3cc37b?0x0:_0x22a45e[_0xf921('0x1d')];var _0xd693ec=_0x3cc37b?_0x44f1c1[_0xf921('0x20')]:_0x22a45e[_0xf921('0x1d')]+_0x22a45e[_0xf921('0x1e')];var _0x10e6c3;if(_0xd693ec>=_0x5aec6b){_0xd693ec=_0x5aec6b;_0x10e6c3=0xc8;}else{_0x10e6c3=0xce;}_0x5365d5[_0xf921('0x1b')](_0x10e6c3);return _0x5365d5[_0xf921('0x21')]('Content-Range',_0xd5f5b3+'-'+_0xd693ec+'/'+_0x5aec6b)[_0xf921('0x1c')](_0x44f1c1);}return null;};}function patchUpdates(_0x1d52e1){return function(_0x156218){try{jsonpatch['apply'](_0x156218,_0x1d52e1,!![]);}catch(_0x4d548d){return BPromise[_0xf921('0x22')](_0x4d548d);}return _0x156218['save']();};}function saveUpdates(_0x420348,_0x590cef){return function(_0x55438b){if(_0x55438b){return _0x55438b[_0xf921('0x23')](_0x420348)[_0xf921('0x24')](function(_0xfef976){return _0xfef976;});}return null;};}function removeEntity(_0x400a62,_0x1c2cd3){return function(_0x37eb29){if(_0x37eb29){return _0x37eb29[_0xf921('0x25')]()[_0xf921('0x24')](function(){_0x400a62[_0xf921('0x1b')](0xcc)[_0xf921('0x26')]();});}};}function handleEntityNotFound(_0x425132,_0x2945dd){return function(_0x328a44){if(!_0x328a44){_0x425132[_0xf921('0x1a')](0x194);}return _0x328a44;};}function handleError(_0x537979,_0x5f4e4d){_0x5f4e4d=_0x5f4e4d||0x1f4;return function(_0x319f13){logger[_0xf921('0x27')](_0x319f13[_0xf921('0x28')]);if(_0x319f13[_0xf921('0x29')]){delete _0x319f13[_0xf921('0x29')];}_0x537979[_0xf921('0x1b')](_0x5f4e4d)[_0xf921('0x2a')](_0x319f13);};}exports[_0xf921('0x2b')]=function(_0x46e033,_0x5bde27){var _0x472a7e={},_0x487d41={},_0x3598f6={'count':0x0,'rows':[]};var _0x474468=_[_0xf921('0x2c')](db['SquareReport']['rawAttributes'],function(_0x14ab0d){return{'name':_0x14ab0d[_0xf921('0x2d')],'type':_0x14ab0d[_0xf921('0x2e')]['key']};});_0x487d41[_0xf921('0x2f')]=_[_0xf921('0x2c')](_0x474468,_0xf921('0x29'));_0x487d41[_0xf921('0x30')]=_[_0xf921('0x31')](_0x46e033[_0xf921('0x30')]);_0x487d41[_0xf921('0x32')]=_[_0xf921('0x33')](_0x487d41[_0xf921('0x2f')],_0x487d41[_0xf921('0x30')]);_0x472a7e[_0xf921('0x34')]=_[_0xf921('0x33')](_0x487d41['model'],qs[_0xf921('0x35')](_0x46e033[_0xf921('0x30')][_0xf921('0x35')]));_0x472a7e['attributes']=_0x472a7e[_0xf921('0x34')]['length']?_0x472a7e[_0xf921('0x34')]:_0x487d41[_0xf921('0x2f')];if(!_0x46e033[_0xf921('0x30')][_0xf921('0x36')]('nolimit')){_0x472a7e[_0xf921('0x1e')]=qs[_0xf921('0x1e')](_0x46e033[_0xf921('0x30')]['limit']);_0x472a7e['offset']=qs[_0xf921('0x1d')](_0x46e033['query'][_0xf921('0x1d')]);}_0x472a7e[_0xf921('0x37')]=qs[_0xf921('0x38')](_0x46e033[_0xf921('0x30')]['sort']);_0x472a7e['where']=qs[_0xf921('0x32')](_[_0xf921('0x39')](_0x46e033['query'],_0x487d41['filters']),_0x474468);if(_0x46e033[_0xf921('0x30')][_0xf921('0x3a')]){_0x472a7e[_0xf921('0x3b')]=_[_0xf921('0x3c')](_0x472a7e[_0xf921('0x3b')],{'$or':_[_0xf921('0x2c')](_0x474468,function(_0x5672e7){if(_0x5672e7[_0xf921('0x2e')]!==_0xf921('0x3d')){var _0x5507bc={};_0x5507bc[_0x5672e7['name']]={'$like':'%'+_0x46e033[_0xf921('0x30')][_0xf921('0x3a')]+'%'};return _0x5507bc;}})});}_0x472a7e=_[_0xf921('0x3c')]({},_0x472a7e,_0x46e033['options']);var _0x2261e7={'where':_0x472a7e[_0xf921('0x3b')]};return db[_0xf921('0x3e')]['count'](_0x2261e7)[_0xf921('0x24')](function(_0x3c82a5){_0x3598f6[_0xf921('0x20')]=_0x3c82a5;if(_0x46e033[_0xf921('0x30')][_0xf921('0x3f')]){_0x472a7e['include']=[{'all':!![]}];}return db[_0xf921('0x3e')][_0xf921('0x40')](_0x472a7e);})[_0xf921('0x24')](function(_0x29e658){_0x3598f6[_0xf921('0x41')]=_0x29e658;return _0x3598f6;})['then'](respondWithFilteredResult(_0x5bde27,_0x472a7e))[_0xf921('0x42')](handleError(_0x5bde27,null));};exports['show']=function(_0x361a88,_0x3d54de){var _0x115691={'raw':!![],'where':{'id':_0x361a88['params']['id']}},_0x4b72bd={};_0x4b72bd[_0xf921('0x2f')]=_[_0xf921('0x31')](db['SquareReport'][_0xf921('0x43')]);_0x4b72bd['query']=_['keys'](_0x361a88[_0xf921('0x30')]);_0x4b72bd[_0xf921('0x32')]=_[_0xf921('0x33')](_0x4b72bd[_0xf921('0x2f')],_0x4b72bd[_0xf921('0x30')]);_0x115691[_0xf921('0x34')]=_['intersection'](_0x4b72bd[_0xf921('0x2f')],qs[_0xf921('0x35')](_0x361a88['query']['fields']));_0x115691[_0xf921('0x34')]=_0x115691[_0xf921('0x34')][_0xf921('0x44')]?_0x115691[_0xf921('0x34')]:_0x4b72bd[_0xf921('0x2f')];if(_0x361a88[_0xf921('0x30')][_0xf921('0x3f')]){_0x115691[_0xf921('0x45')]=[{'all':!![]}];}_0x115691=_['merge']({},_0x115691,_0x361a88[_0xf921('0x46')]);return db[_0xf921('0x3e')][_0xf921('0x47')](_0x115691)[_0xf921('0x24')](handleEntityNotFound(_0x3d54de,null))[_0xf921('0x24')](respondWithResult(_0x3d54de,null))['catch'](handleError(_0x3d54de,null));};exports[_0xf921('0x48')]=function(_0x113e57,_0x588901){return db[_0xf921('0x3e')][_0xf921('0x48')](_0x113e57[_0xf921('0x49')],{})[_0xf921('0x24')](respondWithResult(_0x588901,0xc9))[_0xf921('0x42')](handleError(_0x588901,null));};exports[_0xf921('0x23')]=function(_0x30eddc,_0x4e22cb){if(_0x30eddc['body']['id']){delete _0x30eddc[_0xf921('0x49')]['id'];}return db[_0xf921('0x3e')][_0xf921('0x47')]({'where':{'id':_0x30eddc[_0xf921('0x4a')]['id']}})[_0xf921('0x24')](handleEntityNotFound(_0x4e22cb,null))[_0xf921('0x24')](saveUpdates(_0x30eddc['body'],null))['then'](respondWithResult(_0x4e22cb,null))[_0xf921('0x42')](handleError(_0x4e22cb,null));};exports[_0xf921('0x25')]=function(_0x3c40a7,_0x1e1303){return db['SquareReport'][_0xf921('0x47')]({'where':{'id':_0x3c40a7['params']['id']}})[_0xf921('0x24')](handleEntityNotFound(_0x1e1303,null))[_0xf921('0x24')](removeEntity(_0x1e1303,null))[_0xf921('0x42')](handleError(_0x1e1303,null));};exports[_0xf921('0x4b')]=function(_0x243ea3,_0x1ea8b0){return db[_0xf921('0x3e')]['describe']()['then'](respondWithResult(_0x1ea8b0,null))['catch'](handleError(_0x1ea8b0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index fc7852c..9bfd90a 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 _0x2983=['leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2983,0xd1));var _0x3298=function(_0x2081b0,_0x536e38){_0x2081b0=_0x2081b0-0x0;var _0x98d948=_0x2983[_0x2081b0];return _0x98d948;};'use strict';var _=require(_0x3298('0x0'));var util=require(_0x3298('0x1'));var logger=require(_0x3298('0x2'))(_0x3298('0x3'));var moment=require(_0x3298('0x4'));var BPromise=require(_0x3298('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3298('0x6'));var rimraf=require(_0x3298('0x7'));var config=require(_0x3298('0x8'));var attributes=require('./squareReport.attributes');module[_0x3298('0x9')]=function(_0x2e49c0,_0x365301){return _0x2e49c0[_0x3298('0xa')](_0x3298('0xb'),attributes,{'tableName':_0x3298('0xc'),'paranoid':![],'indexes':[{'name':_0x3298('0xd'),'fields':[_0x3298('0xe'),'project_name']},{'name':'leaveAt','fields':[_0x3298('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb55d=['uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','path','rimraf','exports','report_square','uid_pname'];(function(_0x46e3aa,_0x39d0f4){var _0x1558d1=function(_0x1f2937){while(--_0x1f2937){_0x46e3aa['push'](_0x46e3aa['shift']());}};_0x1558d1(++_0x39d0f4);}(_0xb55d,0x189));var _0xdb55=function(_0xe7e679,_0xe03fca){_0xe7e679=_0xe7e679-0x0;var _0x1fcfd5=_0xb55d[_0xe7e679];return _0x1fcfd5;};'use strict';var _=require(_0xdb55('0x0'));var util=require(_0xdb55('0x1'));var logger=require('../../config/logger')(_0xdb55('0x2'));var moment=require(_0xdb55('0x3'));var BPromise=require(_0xdb55('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb55('0x5'));var rimraf=require(_0xdb55('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xdb55('0x7')]=function(_0x3e4fc1,_0x79c530){return _0x3e4fc1['define']('SquareReport',attributes,{'tableName':_0xdb55('0x8'),'paranoid':![],'indexes':[{'name':_0xdb55('0x9'),'fields':[_0xdb55('0xa'),_0xdb55('0xb')]},{'name':'leaveAt','fields':[_0xdb55('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 733531e..7811ddd 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 _0x6ed2=['where','attributes','limit','UpdateSquareReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareReport','SquareReport','create','body','options','debug','update','raw'];(function(_0x4d5d08,_0x5ef14d){var _0x3f5675=function(_0x416b36){while(--_0x416b36){_0x4d5d08['push'](_0x4d5d08['shift']());}};_0x3f5675(++_0x5ef14d);}(_0x6ed2,0xc4));var _0x26ed=function(_0x1efbf0,_0x340627){_0x1efbf0=_0x1efbf0-0x0;var _0x188287=_0x6ed2[_0x1efbf0];return _0x188287;};'use strict';var _=require('lodash');var util=require(_0x26ed('0x0'));var moment=require(_0x26ed('0x1'));var BPromise=require(_0x26ed('0x2'));var rs=require(_0x26ed('0x3'));var fs=require('fs');var Redis=require(_0x26ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26ed('0x5'));var logger=require(_0x26ed('0x6'))(_0x26ed('0x7'));var config=require('../../config/environment');var jayson=require(_0x26ed('0x8'));var client=jayson[_0x26ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22d8e7,_0x2d95e8,_0x25906f){return new BPromise(function(_0x35ed7e,_0x4015e8){return client[_0x26ed('0xa')](_0x22d8e7,_0x25906f)[_0x26ed('0xb')](function(_0x49f58d){logger[_0x26ed('0xc')](_0x26ed('0xd'),_0x2d95e8,_0x26ed('0xe'));logger['debug'](_0x26ed('0xf'),_0x2d95e8,'request\x20sent',JSON[_0x26ed('0x10')](_0x49f58d));if(_0x49f58d[_0x26ed('0x11')]){if(_0x49f58d[_0x26ed('0x11')]['code']===0x1f4){logger[_0x26ed('0x11')](_0x26ed('0xd'),_0x2d95e8,_0x49f58d[_0x26ed('0x11')][_0x26ed('0x12')]);return _0x4015e8(_0x49f58d[_0x26ed('0x11')][_0x26ed('0x12')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x2d95e8,_0x49f58d[_0x26ed('0x11')][_0x26ed('0x12')]);return _0x35ed7e(_0x49f58d[_0x26ed('0x11')][_0x26ed('0x12')]);}else{logger[_0x26ed('0xc')](_0x26ed('0xd'),_0x2d95e8,_0x26ed('0xe'));_0x35ed7e(_0x49f58d['result'][_0x26ed('0x12')]);}})[_0x26ed('0x13')](function(_0x353a06){logger[_0x26ed('0x11')](_0x26ed('0xd'),_0x2d95e8,_0x353a06);_0x4015e8(_0x353a06);});});}exports[_0x26ed('0x14')]=function(_0x39b21){var _0x17c134=this;return new Promise(function(_0x3e0b7a,_0x631a8){return db[_0x26ed('0x15')][_0x26ed('0x16')](_0x39b21[_0x26ed('0x17')],{'raw':_0x39b21[_0x26ed('0x18')]?_0x39b21[_0x26ed('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x26ed('0xb')](function(_0x3d6a15){logger['info'](_0x26ed('0x14'),_0x39b21);logger[_0x26ed('0x19')](_0x26ed('0x14'),_0x39b21,JSON[_0x26ed('0x10')](_0x3d6a15));_0x3e0b7a(_0x3d6a15);})[_0x26ed('0x13')](function(_0x1a86bc){logger[_0x26ed('0x11')](_0x26ed('0x14'),_0x1a86bc['message'],_0x39b21);_0x631a8(_0x17c134['error'](0x1f4,_0x1a86bc[_0x26ed('0x12')]));});});};exports['UpdateSquareReport']=function(_0x1fd79e){var _0x311973=this;return new Promise(function(_0x49f3f6,_0x20d5ea){return db[_0x26ed('0x15')][_0x26ed('0x1a')](_0x1fd79e[_0x26ed('0x17')],{'raw':_0x1fd79e[_0x26ed('0x18')]?_0x1fd79e[_0x26ed('0x18')][_0x26ed('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd79e[_0x26ed('0x18')]?_0x1fd79e['options'][_0x26ed('0x1c')]||null:null,'attributes':_0x1fd79e['options']?_0x1fd79e[_0x26ed('0x18')][_0x26ed('0x1d')]||null:null,'limit':_0x1fd79e[_0x26ed('0x18')]?_0x1fd79e['options'][_0x26ed('0x1e')]||null:null})[_0x26ed('0xb')](function(_0x4fcc10){logger[_0x26ed('0xc')](_0x26ed('0x1f'),_0x1fd79e);logger[_0x26ed('0x19')](_0x26ed('0x1f'),_0x1fd79e,JSON[_0x26ed('0x10')](_0x4fcc10));_0x49f3f6(_0x4fcc10);})[_0x26ed('0x13')](function(_0x23d5ce){logger[_0x26ed('0x11')](_0x26ed('0x1f'),_0x23d5ce['message'],_0x1fd79e);_0x20d5ea(_0x311973[_0x26ed('0x11')](0x1f4,_0x23d5ce[_0x26ed('0x12')]));});});}; \ No newline at end of file +var _0x3e31=['rpc','jayson/promise','client','http','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','SquareReport','options','raw','update','body','where','attributes','limit','UpdateSquareReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13ed50,_0x1037f6){var _0x245bf6=function(_0x2a1821){while(--_0x2a1821){_0x13ed50['push'](_0x13ed50['shift']());}};_0x245bf6(++_0x1037f6);}(_0x3e31,0x158));var _0x13e3=function(_0x237e39,_0x28327a){_0x237e39=_0x237e39-0x0;var _0x1917e9=_0x3e31[_0x237e39];return _0x1917e9;};'use strict';var _=require(_0x13e3('0x0'));var util=require('util');var moment=require(_0x13e3('0x1'));var BPromise=require(_0x13e3('0x2'));var rs=require(_0x13e3('0x3'));var fs=require('fs');var Redis=require(_0x13e3('0x4'));var db=require(_0x13e3('0x5'))['db'];var utils=require(_0x13e3('0x6'));var logger=require(_0x13e3('0x7'))(_0x13e3('0x8'));var config=require('../../config/environment');var jayson=require(_0x13e3('0x9'));var client=jayson[_0x13e3('0xa')][_0x13e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45bd5e,_0xb66321,_0xc2d741){return new BPromise(function(_0x836caa,_0xf105ff){return client['request'](_0x45bd5e,_0xc2d741)[_0x13e3('0xc')](function(_0xcd0171){logger[_0x13e3('0xd')]('SquareReport,\x20%s,\x20%s',_0xb66321,_0x13e3('0xe'));logger[_0x13e3('0xf')](_0x13e3('0x10'),_0xb66321,_0x13e3('0xe'),JSON[_0x13e3('0x11')](_0xcd0171));if(_0xcd0171[_0x13e3('0x12')]){if(_0xcd0171[_0x13e3('0x12')]['code']===0x1f4){logger[_0x13e3('0x12')](_0x13e3('0x13'),_0xb66321,_0xcd0171[_0x13e3('0x12')]['message']);return _0xf105ff(_0xcd0171[_0x13e3('0x12')][_0x13e3('0x14')]);}logger[_0x13e3('0x12')]('SquareReport,\x20%s,\x20%s',_0xb66321,_0xcd0171[_0x13e3('0x12')][_0x13e3('0x14')]);return _0x836caa(_0xcd0171[_0x13e3('0x12')][_0x13e3('0x14')]);}else{logger[_0x13e3('0xd')](_0x13e3('0x13'),_0xb66321,_0x13e3('0xe'));_0x836caa(_0xcd0171['result'][_0x13e3('0x14')]);}})[_0x13e3('0x15')](function(_0x3a63ac){logger['error'](_0x13e3('0x13'),_0xb66321,_0x3a63ac);_0xf105ff(_0x3a63ac);});});}exports[_0x13e3('0x16')]=function(_0x5d92bf){var _0x49864f=this;return new Promise(function(_0x18b25a,_0x31925f){return db[_0x13e3('0x17')]['create'](_0x5d92bf['body'],{'raw':_0x5d92bf[_0x13e3('0x18')]?_0x5d92bf[_0x13e3('0x18')][_0x13e3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x172cd3){logger[_0x13e3('0xd')](_0x13e3('0x16'),_0x5d92bf);logger['debug'](_0x13e3('0x16'),_0x5d92bf,JSON[_0x13e3('0x11')](_0x172cd3));_0x18b25a(_0x172cd3);})[_0x13e3('0x15')](function(_0x47f093){logger[_0x13e3('0x12')]('CreateSquareReport',_0x47f093[_0x13e3('0x14')],_0x5d92bf);_0x31925f(_0x49864f[_0x13e3('0x12')](0x1f4,_0x47f093[_0x13e3('0x14')]));});});};exports['UpdateSquareReport']=function(_0x210d95){var _0x281abc=this;return new Promise(function(_0x227722,_0x587a24){return db[_0x13e3('0x17')][_0x13e3('0x1a')](_0x210d95[_0x13e3('0x1b')],{'raw':_0x210d95[_0x13e3('0x18')]?_0x210d95[_0x13e3('0x18')][_0x13e3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210d95[_0x13e3('0x18')]?_0x210d95[_0x13e3('0x18')][_0x13e3('0x1c')]||null:null,'attributes':_0x210d95[_0x13e3('0x18')]?_0x210d95[_0x13e3('0x18')][_0x13e3('0x1d')]||null:null,'limit':_0x210d95[_0x13e3('0x18')]?_0x210d95[_0x13e3('0x18')][_0x13e3('0x1e')]||null:null})[_0x13e3('0xc')](function(_0x4fb194){logger['info'](_0x13e3('0x1f'),_0x210d95);logger['debug']('UpdateSquareReport',_0x210d95,JSON['stringify'](_0x4fb194));_0x227722(_0x4fb194);})['catch'](function(_0x3b463e){logger[_0x13e3('0x12')](_0x13e3('0x1f'),_0x3b463e[_0x13e3('0x14')],_0x210d95);_0x587a24(_0x281abc['error'](0x1f4,_0x3b463e[_0x13e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 64587d3..528ac91 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 _0xbeea=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4581d2,_0x5a938b){var _0x43315f=function(_0x2c7b43){while(--_0x2c7b43){_0x4581d2['push'](_0x4581d2['shift']());}};_0x43315f(++_0x5a938b);}(_0xbeea,0xd6));var _0xabee=function(_0x544afe,_0x256f92){_0x544afe=_0x544afe-0x0;var _0x12d9e9=_0xbeea[_0x544afe];return _0x12d9e9;};'use strict';var multer=require('multer');var util=require(_0xabee('0x0'));var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express[_0xabee('0x4')]();var fs_extra=require(_0xabee('0x5'));var auth=require(_0xabee('0x6'));var interaction=require(_0xabee('0x7'));var config=require(_0xabee('0x8'));var controller=require(_0xabee('0x9'));router[_0xabee('0xa')]('/',auth[_0xabee('0xb')](),controller[_0xabee('0xc')]);router[_0xabee('0xa')](_0xabee('0xd'),auth[_0xabee('0xb')](),controller['describe']);router[_0xabee('0xa')](_0xabee('0xe'),auth[_0xabee('0xb')](),controller[_0xabee('0xf')]);router[_0xabee('0x10')]('/',auth[_0xabee('0xb')](),controller[_0xabee('0x11')]);router[_0xabee('0x12')](_0xabee('0xe'),auth[_0xabee('0xb')](),controller[_0xabee('0x13')]);router[_0xabee('0x14')](_0xabee('0xe'),auth[_0xabee('0xb')](),controller[_0xabee('0x15')]);module[_0xabee('0x16')]=router; \ No newline at end of file +var _0xd901=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','post','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd901,0xc4));var _0x1d90=function(_0x13f1c8,_0x49a872){_0x13f1c8=_0x13f1c8-0x0;var _0x1e716a=_0xd901[_0x13f1c8];return _0x1e716a;};'use strict';var multer=require(_0x1d90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1d90('0x1'));var express=require(_0x1d90('0x2'));var router=express[_0x1d90('0x3')]();var fs_extra=require(_0x1d90('0x4'));var auth=require(_0x1d90('0x5'));var interaction=require(_0x1d90('0x6'));var config=require(_0x1d90('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1d90('0x8')]);router[_0x1d90('0x9')](_0x1d90('0xa'),auth[_0x1d90('0xb')](),controller[_0x1d90('0xc')]);router[_0x1d90('0x9')]('/:id',auth[_0x1d90('0xb')](),controller[_0x1d90('0xd')]);router[_0x1d90('0xe')]('/',auth[_0x1d90('0xb')](),controller['create']);router['put'](_0x1d90('0xf'),auth[_0x1d90('0xb')](),controller[_0x1d90('0x10')]);router[_0x1d90('0x11')](_0x1d90('0xf'),auth[_0x1d90('0xb')](),controller[_0x1d90('0x12')]);module[_0x1d90('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 bb654c4..0267a40 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 _0xe7e8=['STRING','exports'];(function(_0x32e9e9,_0x3df5aa){var _0x400b63=function(_0x5d0454){while(--_0x5d0454){_0x32e9e9['push'](_0x32e9e9['shift']());}};_0x400b63(++_0x3df5aa);}(_0xe7e8,0xe3));var _0x8e7e=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0xe7e8[_0x3a0ebd];return _0x51a660;};'use strict';var Sequelize=require('sequelize');module[_0x8e7e('0x0')]={'uniqueid':{'type':Sequelize[_0x8e7e('0x1')]},'node':{'type':Sequelize[_0x8e7e('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x8e7e('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x954f=['TEXT','exports','STRING'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x954f,0xdc));var _0xf954=function(_0x48d6f1,_0x23f072){_0x48d6f1=_0x48d6f1-0x0;var _0x22abdf=_0x954f[_0x48d6f1];return _0x22abdf;};'use strict';var Sequelize=require('sequelize');module[_0xf954('0x0')]={'uniqueid':{'type':Sequelize[_0xf954('0x1')]},'node':{'type':Sequelize[_0xf954('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xf954('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 11f78c3..1e3fde0 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 _0xfda0=['show','length','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch'];(function(_0x14a52c,_0x2adfba){var _0x19163b=function(_0x312900){while(--_0x312900){_0x14a52c['push'](_0x14a52c['shift']());}};_0x19163b(++_0x2adfba);}(_0xfda0,0x174));var _0x0fda=function(_0x313a13,_0x2bea73){_0x313a13=_0x313a13-0x0;var _0x4a737f=_0xfda0[_0x313a13];return _0x4a737f;};'use strict';var emlformat=require(_0x0fda('0x0'));var rimraf=require(_0x0fda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fda('0x2'));var rp=require(_0x0fda('0x3'));var moment=require(_0x0fda('0x4'));var BPromise=require(_0x0fda('0x5'));var Mustache=require(_0x0fda('0x6'));var util=require('util');var path=require(_0x0fda('0x7'));var sox=require(_0x0fda('0x8'));var csv=require(_0x0fda('0x9'));var ejs=require(_0x0fda('0xa'));var fs=require('fs');var fs_extra=require(_0x0fda('0xb'));var _=require('lodash');var squel=require(_0x0fda('0xc'));var crypto=require(_0x0fda('0xd'));var jsforce=require(_0x0fda('0xe'));var deskjs=require(_0x0fda('0xf'));var toCsv=require(_0x0fda('0x9'));var querystring=require('querystring');var Papa=require(_0x0fda('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0fda('0x11'));var hardwareService=require(_0x0fda('0x12'));var logger=require(_0x0fda('0x13'))(_0x0fda('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fda('0x15'))['db'];function respondWithStatusCode(_0x535788,_0x892e92){_0x892e92=_0x892e92||0xcc;return function(_0x21769d){if(_0x21769d){return _0x535788[_0x0fda('0x16')](_0x892e92);}return _0x535788[_0x0fda('0x17')](_0x892e92)[_0x0fda('0x18')]();};}function respondWithResult(_0x464066,_0x42ca5b){_0x42ca5b=_0x42ca5b||0xc8;return function(_0x1a20fd){if(_0x1a20fd){return _0x464066['status'](_0x42ca5b)[_0x0fda('0x19')](_0x1a20fd);}};}function respondWithFilteredResult(_0x5ba550,_0x19d105){return function(_0x27c3ce){if(_0x27c3ce){var _0x34c84f=typeof _0x19d105[_0x0fda('0x1a')]===_0x0fda('0x1b')&&typeof _0x19d105['limit']===_0x0fda('0x1b');var _0x1d311e=_0x27c3ce[_0x0fda('0x1c')];var _0x32ea7=_0x34c84f?0x0:_0x19d105[_0x0fda('0x1a')];var _0x1cc28a=_0x34c84f?_0x27c3ce['count']:_0x19d105['offset']+_0x19d105['limit'];var _0x2b67e0;if(_0x1cc28a>=_0x1d311e){_0x1cc28a=_0x1d311e;_0x2b67e0=0xc8;}else{_0x2b67e0=0xce;}_0x5ba550[_0x0fda('0x17')](_0x2b67e0);return _0x5ba550[_0x0fda('0x1d')]('Content-Range',_0x32ea7+'-'+_0x1cc28a+'/'+_0x1d311e)['json'](_0x27c3ce);}return null;};}function patchUpdates(_0x4a3804){return function(_0x43d029){try{jsonpatch[_0x0fda('0x1e')](_0x43d029,_0x4a3804,!![]);}catch(_0x2ef039){return BPromise[_0x0fda('0x1f')](_0x2ef039);}return _0x43d029[_0x0fda('0x20')]();};}function saveUpdates(_0x41b724,_0x508c68){return function(_0x4fbfee){if(_0x4fbfee){return _0x4fbfee[_0x0fda('0x21')](_0x41b724)[_0x0fda('0x22')](function(_0x5953a5){return _0x5953a5;});}return null;};}function removeEntity(_0x2eebee,_0x977cab){return function(_0x363625){if(_0x363625){return _0x363625[_0x0fda('0x23')]()[_0x0fda('0x22')](function(){_0x2eebee[_0x0fda('0x17')](0xcc)[_0x0fda('0x18')]();});}};}function handleEntityNotFound(_0x5e1923,_0x3301c4){return function(_0x4d0f43){if(!_0x4d0f43){_0x5e1923[_0x0fda('0x16')](0x194);}return _0x4d0f43;};}function handleError(_0x4ef61a,_0x18c709){_0x18c709=_0x18c709||0x1f4;return function(_0x2e8ef3){logger[_0x0fda('0x24')](_0x2e8ef3[_0x0fda('0x25')]);if(_0x2e8ef3[_0x0fda('0x26')]){delete _0x2e8ef3[_0x0fda('0x26')];}_0x4ef61a[_0x0fda('0x17')](_0x18c709)['send'](_0x2e8ef3);};}exports[_0x0fda('0x27')]=function(_0x364a56,_0x5b9a55){var _0x4fb080={},_0x4f0235={},_0xfc78ce={'count':0x0,'rows':[]};var _0x5ceb0a=_['map'](db[_0x0fda('0x28')][_0x0fda('0x29')],function(_0x3c896b){return{'name':_0x3c896b[_0x0fda('0x2a')],'type':_0x3c896b[_0x0fda('0x2b')]['key']};});_0x4f0235[_0x0fda('0x2c')]=_['map'](_0x5ceb0a,_0x0fda('0x26'));_0x4f0235[_0x0fda('0x2d')]=_[_0x0fda('0x2e')](_0x364a56[_0x0fda('0x2d')]);_0x4f0235[_0x0fda('0x2f')]=_[_0x0fda('0x30')](_0x4f0235[_0x0fda('0x2c')],_0x4f0235[_0x0fda('0x2d')]);_0x4fb080['attributes']=_[_0x0fda('0x30')](_0x4f0235[_0x0fda('0x2c')],qs['fields'](_0x364a56[_0x0fda('0x2d')][_0x0fda('0x31')]));_0x4fb080['attributes']=_0x4fb080[_0x0fda('0x32')]['length']?_0x4fb080[_0x0fda('0x32')]:_0x4f0235['model'];if(!_0x364a56[_0x0fda('0x2d')][_0x0fda('0x33')](_0x0fda('0x34'))){_0x4fb080[_0x0fda('0x35')]=qs['limit'](_0x364a56['query'][_0x0fda('0x35')]);_0x4fb080[_0x0fda('0x1a')]=qs['offset'](_0x364a56['query'][_0x0fda('0x1a')]);}_0x4fb080[_0x0fda('0x36')]=qs[_0x0fda('0x37')](_0x364a56[_0x0fda('0x2d')][_0x0fda('0x37')]);_0x4fb080[_0x0fda('0x38')]=qs[_0x0fda('0x2f')](_[_0x0fda('0x39')](_0x364a56['query'],_0x4f0235[_0x0fda('0x2f')]),_0x5ceb0a);if(_0x364a56[_0x0fda('0x2d')]['filter']){_0x4fb080[_0x0fda('0x38')]=_[_0x0fda('0x3a')](_0x4fb080[_0x0fda('0x38')],{'$or':_['map'](_0x5ceb0a,function(_0x3702af){if(_0x3702af['type']!==_0x0fda('0x3b')){var _0x2e8a07={};_0x2e8a07[_0x3702af[_0x0fda('0x26')]]={'$like':'%'+_0x364a56[_0x0fda('0x2d')][_0x0fda('0x3c')]+'%'};return _0x2e8a07;}})});}_0x4fb080=_[_0x0fda('0x3a')]({},_0x4fb080,_0x364a56[_0x0fda('0x3d')]);var _0x1009cd={'where':_0x4fb080['where']};return db['SquareDetailsReport'][_0x0fda('0x1c')](_0x1009cd)[_0x0fda('0x22')](function(_0x43bec3){_0xfc78ce['count']=_0x43bec3;if(_0x364a56[_0x0fda('0x2d')][_0x0fda('0x3e')]){_0x4fb080['include']=[{'all':!![]}];}return db[_0x0fda('0x28')][_0x0fda('0x3f')](_0x4fb080);})[_0x0fda('0x22')](function(_0x8c97c8){_0xfc78ce[_0x0fda('0x40')]=_0x8c97c8;return _0xfc78ce;})[_0x0fda('0x22')](respondWithFilteredResult(_0x5b9a55,_0x4fb080))[_0x0fda('0x41')](handleError(_0x5b9a55,null));};exports[_0x0fda('0x42')]=function(_0x26e21f,_0x3db142){var _0x5e579c={'raw':!![],'where':{'id':_0x26e21f['params']['id']}},_0x11d0bc={};_0x11d0bc[_0x0fda('0x2c')]=_[_0x0fda('0x2e')](db[_0x0fda('0x28')][_0x0fda('0x29')]);_0x11d0bc[_0x0fda('0x2d')]=_[_0x0fda('0x2e')](_0x26e21f[_0x0fda('0x2d')]);_0x11d0bc[_0x0fda('0x2f')]=_['intersection'](_0x11d0bc['model'],_0x11d0bc[_0x0fda('0x2d')]);_0x5e579c['attributes']=_['intersection'](_0x11d0bc[_0x0fda('0x2c')],qs['fields'](_0x26e21f[_0x0fda('0x2d')][_0x0fda('0x31')]));_0x5e579c['attributes']=_0x5e579c[_0x0fda('0x32')][_0x0fda('0x43')]?_0x5e579c['attributes']:_0x11d0bc[_0x0fda('0x2c')];if(_0x26e21f[_0x0fda('0x2d')][_0x0fda('0x3e')]){_0x5e579c['include']=[{'all':!![]}];}_0x5e579c=_['merge']({},_0x5e579c,_0x26e21f[_0x0fda('0x3d')]);return db[_0x0fda('0x28')]['find'](_0x5e579c)[_0x0fda('0x22')](handleEntityNotFound(_0x3db142,null))['then'](respondWithResult(_0x3db142,null))['catch'](handleError(_0x3db142,null));};exports[_0x0fda('0x44')]=function(_0x1b7d82,_0x3731ac){return db['SquareDetailsReport']['create'](_0x1b7d82[_0x0fda('0x45')],{})[_0x0fda('0x22')](respondWithResult(_0x3731ac,0xc9))['catch'](handleError(_0x3731ac,null));};exports[_0x0fda('0x21')]=function(_0x5a3ff4,_0x247048){if(_0x5a3ff4['body']['id']){delete _0x5a3ff4['body']['id'];}return db['SquareDetailsReport'][_0x0fda('0x46')]({'where':{'id':_0x5a3ff4[_0x0fda('0x47')]['id']}})[_0x0fda('0x22')](handleEntityNotFound(_0x247048,null))[_0x0fda('0x22')](saveUpdates(_0x5a3ff4[_0x0fda('0x45')],null))[_0x0fda('0x22')](respondWithResult(_0x247048,null))[_0x0fda('0x41')](handleError(_0x247048,null));};exports['destroy']=function(_0x3f024b,_0x4a9ac7){return db[_0x0fda('0x28')][_0x0fda('0x46')]({'where':{'id':_0x3f024b[_0x0fda('0x47')]['id']}})[_0x0fda('0x22')](handleEntityNotFound(_0x4a9ac7,null))[_0x0fda('0x22')](removeEntity(_0x4a9ac7,null))[_0x0fda('0x41')](handleError(_0x4a9ac7,null));};exports[_0x0fda('0x48')]=function(_0x16894b,_0x45a065){return db[_0x0fda('0x28')][_0x0fda('0x48')]()[_0x0fda('0x22')](respondWithResult(_0x45a065,null))['catch'](handleError(_0x45a065,null));}; \ No newline at end of file +var _0x441e=['key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../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','Content-Range','apply','reject','save','update','then','error','stack','send','map','SquareDetailsReport','rawAttributes','fieldName','type'];(function(_0x3d7afe,_0xcf50f7){var _0x13abff=function(_0x43e09e){while(--_0x43e09e){_0x3d7afe['push'](_0x3d7afe['shift']());}};_0x13abff(++_0xcf50f7);}(_0x441e,0x6b));var _0xe441=function(_0x16acb9,_0x270b64){_0x16acb9=_0x16acb9-0x0;var _0xa38810=_0x441e[_0x16acb9];return _0xa38810;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe441('0x0'));var jsonpatch=require(_0xe441('0x1'));var rp=require('request-promise');var moment=require(_0xe441('0x2'));var BPromise=require(_0xe441('0x3'));var Mustache=require(_0xe441('0x4'));var util=require('util');var path=require(_0xe441('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe441('0x6'));var fs=require('fs');var fs_extra=require(_0xe441('0x7'));var _=require(_0xe441('0x8'));var squel=require('squel');var crypto=require(_0xe441('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe441('0xa'));var toCsv=require(_0xe441('0xb'));var querystring=require(_0xe441('0xc'));var Papa=require(_0xe441('0xd'));var Redis=require(_0xe441('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe441('0xf'));var as=require(_0xe441('0x10'));var hardwareService=require(_0xe441('0x11'));var logger=require('../../config/logger')(_0xe441('0x12'));var utils=require(_0xe441('0x13'));var config=require(_0xe441('0x14'));var licenseUtil=require(_0xe441('0x15'));var db=require(_0xe441('0x16'))['db'];function respondWithStatusCode(_0x1377d6,_0x2c57f9){_0x2c57f9=_0x2c57f9||0xcc;return function(_0x381fbd){if(_0x381fbd){return _0x1377d6[_0xe441('0x17')](_0x2c57f9);}return _0x1377d6[_0xe441('0x18')](_0x2c57f9)[_0xe441('0x19')]();};}function respondWithResult(_0x49f9ee,_0x461762){_0x461762=_0x461762||0xc8;return function(_0x204462){if(_0x204462){return _0x49f9ee[_0xe441('0x18')](_0x461762)[_0xe441('0x1a')](_0x204462);}};}function respondWithFilteredResult(_0xb13956,_0x328374){return function(_0x3253bd){if(_0x3253bd){var _0x304c79=typeof _0x328374[_0xe441('0x1b')]===_0xe441('0x1c')&&typeof _0x328374[_0xe441('0x1d')]===_0xe441('0x1c');var _0x127d31=_0x3253bd[_0xe441('0x1e')];var _0x1cdaae=_0x304c79?0x0:_0x328374[_0xe441('0x1b')];var _0x278ddf=_0x304c79?_0x3253bd[_0xe441('0x1e')]:_0x328374['offset']+_0x328374[_0xe441('0x1d')];var _0x159300;if(_0x278ddf>=_0x127d31){_0x278ddf=_0x127d31;_0x159300=0xc8;}else{_0x159300=0xce;}_0xb13956[_0xe441('0x18')](_0x159300);return _0xb13956['set'](_0xe441('0x1f'),_0x1cdaae+'-'+_0x278ddf+'/'+_0x127d31)[_0xe441('0x1a')](_0x3253bd);}return null;};}function patchUpdates(_0x297959){return function(_0xa3e4f0){try{jsonpatch[_0xe441('0x20')](_0xa3e4f0,_0x297959,!![]);}catch(_0x43b96a){return BPromise[_0xe441('0x21')](_0x43b96a);}return _0xa3e4f0[_0xe441('0x22')]();};}function saveUpdates(_0x55376a,_0x599e56){return function(_0x3eba64){if(_0x3eba64){return _0x3eba64[_0xe441('0x23')](_0x55376a)[_0xe441('0x24')](function(_0x1bc465){return _0x1bc465;});}return null;};}function removeEntity(_0x534710,_0xdfa21c){return function(_0x4d68ed){if(_0x4d68ed){return _0x4d68ed['destroy']()[_0xe441('0x24')](function(){_0x534710['status'](0xcc)[_0xe441('0x19')]();});}};}function handleEntityNotFound(_0x9321c6,_0x112dc2){return function(_0x4db587){if(!_0x4db587){_0x9321c6[_0xe441('0x17')](0x194);}return _0x4db587;};}function handleError(_0x35887a,_0x20e677){_0x20e677=_0x20e677||0x1f4;return function(_0x333a2d){logger[_0xe441('0x25')](_0x333a2d[_0xe441('0x26')]);if(_0x333a2d['name']){delete _0x333a2d['name'];}_0x35887a[_0xe441('0x18')](_0x20e677)[_0xe441('0x27')](_0x333a2d);};}exports['index']=function(_0x2d08e6,_0xc32176){var _0x3c15af={},_0x42e428={},_0x32cd99={'count':0x0,'rows':[]};var _0x46b867=_[_0xe441('0x28')](db[_0xe441('0x29')][_0xe441('0x2a')],function(_0x5489b8){return{'name':_0x5489b8[_0xe441('0x2b')],'type':_0x5489b8[_0xe441('0x2c')][_0xe441('0x2d')]};});_0x42e428['model']=_[_0xe441('0x28')](_0x46b867,_0xe441('0x2e'));_0x42e428[_0xe441('0x2f')]=_['keys'](_0x2d08e6['query']);_0x42e428[_0xe441('0x30')]=_[_0xe441('0x31')](_0x42e428[_0xe441('0x32')],_0x42e428[_0xe441('0x2f')]);_0x3c15af[_0xe441('0x33')]=_['intersection'](_0x42e428[_0xe441('0x32')],qs[_0xe441('0x34')](_0x2d08e6[_0xe441('0x2f')][_0xe441('0x34')]));_0x3c15af[_0xe441('0x33')]=_0x3c15af[_0xe441('0x33')][_0xe441('0x35')]?_0x3c15af[_0xe441('0x33')]:_0x42e428[_0xe441('0x32')];if(!_0x2d08e6[_0xe441('0x2f')][_0xe441('0x36')](_0xe441('0x37'))){_0x3c15af[_0xe441('0x1d')]=qs[_0xe441('0x1d')](_0x2d08e6['query'][_0xe441('0x1d')]);_0x3c15af[_0xe441('0x1b')]=qs[_0xe441('0x1b')](_0x2d08e6[_0xe441('0x2f')][_0xe441('0x1b')]);}_0x3c15af[_0xe441('0x38')]=qs[_0xe441('0x39')](_0x2d08e6['query']['sort']);_0x3c15af[_0xe441('0x3a')]=qs[_0xe441('0x30')](_['pick'](_0x2d08e6['query'],_0x42e428['filters']),_0x46b867);if(_0x2d08e6['query'][_0xe441('0x3b')]){_0x3c15af[_0xe441('0x3a')]=_[_0xe441('0x3c')](_0x3c15af[_0xe441('0x3a')],{'$or':_[_0xe441('0x28')](_0x46b867,function(_0x760054){if(_0x760054[_0xe441('0x2c')]!==_0xe441('0x3d')){var _0xb8b9b8={};_0xb8b9b8[_0x760054[_0xe441('0x2e')]]={'$like':'%'+_0x2d08e6[_0xe441('0x2f')][_0xe441('0x3b')]+'%'};return _0xb8b9b8;}})});}_0x3c15af=_['merge']({},_0x3c15af,_0x2d08e6['options']);var _0x458b36={'where':_0x3c15af[_0xe441('0x3a')]};return db[_0xe441('0x29')][_0xe441('0x1e')](_0x458b36)['then'](function(_0x11f32b){_0x32cd99[_0xe441('0x1e')]=_0x11f32b;if(_0x2d08e6[_0xe441('0x2f')][_0xe441('0x3e')]){_0x3c15af[_0xe441('0x3f')]=[{'all':!![]}];}return db[_0xe441('0x29')][_0xe441('0x40')](_0x3c15af);})[_0xe441('0x24')](function(_0x32c3d9){_0x32cd99[_0xe441('0x41')]=_0x32c3d9;return _0x32cd99;})[_0xe441('0x24')](respondWithFilteredResult(_0xc32176,_0x3c15af))[_0xe441('0x42')](handleError(_0xc32176,null));};exports[_0xe441('0x43')]=function(_0x2ee875,_0x1cf33f){var _0x32933f={'raw':!![],'where':{'id':_0x2ee875[_0xe441('0x44')]['id']}},_0xbdd8cf={};_0xbdd8cf[_0xe441('0x32')]=_[_0xe441('0x45')](db['SquareDetailsReport']['rawAttributes']);_0xbdd8cf[_0xe441('0x2f')]=_[_0xe441('0x45')](_0x2ee875[_0xe441('0x2f')]);_0xbdd8cf[_0xe441('0x30')]=_[_0xe441('0x31')](_0xbdd8cf['model'],_0xbdd8cf[_0xe441('0x2f')]);_0x32933f[_0xe441('0x33')]=_[_0xe441('0x31')](_0xbdd8cf[_0xe441('0x32')],qs[_0xe441('0x34')](_0x2ee875[_0xe441('0x2f')]['fields']));_0x32933f[_0xe441('0x33')]=_0x32933f[_0xe441('0x33')][_0xe441('0x35')]?_0x32933f[_0xe441('0x33')]:_0xbdd8cf[_0xe441('0x32')];if(_0x2ee875[_0xe441('0x2f')]['includeAll']){_0x32933f['include']=[{'all':!![]}];}_0x32933f=_['merge']({},_0x32933f,_0x2ee875[_0xe441('0x46')]);return db[_0xe441('0x29')][_0xe441('0x47')](_0x32933f)[_0xe441('0x24')](handleEntityNotFound(_0x1cf33f,null))[_0xe441('0x24')](respondWithResult(_0x1cf33f,null))[_0xe441('0x42')](handleError(_0x1cf33f,null));};exports[_0xe441('0x48')]=function(_0x27ae66,_0x249862){return db[_0xe441('0x29')][_0xe441('0x48')](_0x27ae66['body'],{})[_0xe441('0x24')](respondWithResult(_0x249862,0xc9))['catch'](handleError(_0x249862,null));};exports[_0xe441('0x23')]=function(_0x50b9a9,_0xd7c0e4){if(_0x50b9a9[_0xe441('0x49')]['id']){delete _0x50b9a9[_0xe441('0x49')]['id'];}return db[_0xe441('0x29')][_0xe441('0x47')]({'where':{'id':_0x50b9a9[_0xe441('0x44')]['id']}})[_0xe441('0x24')](handleEntityNotFound(_0xd7c0e4,null))[_0xe441('0x24')](saveUpdates(_0x50b9a9[_0xe441('0x49')],null))[_0xe441('0x24')](respondWithResult(_0xd7c0e4,null))[_0xe441('0x42')](handleError(_0xd7c0e4,null));};exports[_0xe441('0x4a')]=function(_0x24f30f,_0x495952){return db[_0xe441('0x29')]['find']({'where':{'id':_0x24f30f[_0xe441('0x44')]['id']}})[_0xe441('0x24')](handleEntityNotFound(_0x495952,null))['then'](removeEntity(_0x495952,null))[_0xe441('0x42')](handleError(_0x495952,null));};exports[_0xe441('0x4b')]=function(_0x5727c1,_0x97b718){return db[_0xe441('0x29')][_0xe441('0x4b')]()[_0xe441('0x24')](respondWithResult(_0x97b718,null))[_0xe441('0x42')](handleError(_0x97b718,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1d20e1e..1cf16cd 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 _0x8616=['path','rimraf','./squareReportDetail.attributes','exports','report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x45fabc,_0x2f0df7){var _0x3012ac=function(_0x214f0f){while(--_0x214f0f){_0x45fabc['push'](_0x45fabc['shift']());}};_0x3012ac(++_0x2f0df7);}(_0x8616,0x165));var _0x6861=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0x8616[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x6861('0x0'));var util=require(_0x6861('0x1'));var logger=require(_0x6861('0x2'))(_0x6861('0x3'));var moment=require('moment');var BPromise=require(_0x6861('0x4'));var rp=require(_0x6861('0x5'));var fs=require('fs');var path=require(_0x6861('0x6'));var rimraf=require(_0x6861('0x7'));var config=require('../../config/environment');var attributes=require(_0x6861('0x8'));module[_0x6861('0x9')]=function(_0x273f81,_0x598138){return _0x273f81['define']('SquareDetailsReport',attributes,{'tableName':_0x6861('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdf0=['report_square_details','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x11f660,_0x560a64){var _0x13fb69=function(_0x17b043){while(--_0x17b043){_0x11f660['push'](_0x11f660['shift']());}};_0x13fb69(++_0x560a64);}(_0xcdf0,0x197));var _0x0cdf=function(_0x1e9338,_0x536136){_0x1e9338=_0x1e9338-0x0;var _0xf329c4=_0xcdf0[_0x1e9338];return _0xf329c4;};'use strict';var _=require(_0x0cdf('0x0'));var util=require(_0x0cdf('0x1'));var logger=require(_0x0cdf('0x2'))(_0x0cdf('0x3'));var moment=require(_0x0cdf('0x4'));var BPromise=require(_0x0cdf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cdf('0x6'));var rimraf=require(_0x0cdf('0x7'));var config=require(_0x0cdf('0x8'));var attributes=require(_0x0cdf('0x9'));module[_0x0cdf('0xa')]=function(_0x3d47e7,_0x37673d){return _0x3d47e7[_0x0cdf('0xb')](_0x0cdf('0xc'),attributes,{'tableName':_0x0cdf('0xd'),'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 ac7fc22..6bfc4b5 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 _0x4f7b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','raw','CreateSquareDetailsReport','debug','lodash'];(function(_0x41f5c5,_0x295c8f){var _0x493aad=function(_0x47155d){while(--_0x47155d){_0x41f5c5['push'](_0x41f5c5['shift']());}};_0x493aad(++_0x295c8f);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x5c8598,_0x3faf98){_0x5c8598=_0x5c8598-0x0;var _0x3666f7=_0x4f7b[_0x5c8598];return _0x3666f7;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateSquareDetailsReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});}; \ No newline at end of file +var _0x1a85=['then','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw'];(function(_0x27ccb6,_0x103913){var _0x412043=function(_0x3c1624){while(--_0x3c1624){_0x27ccb6['push'](_0x27ccb6['shift']());}};_0x412043(++_0x103913);}(_0x1a85,0x178));var _0x51a8=function(_0x24b5d8,_0x203128){_0x24b5d8=_0x24b5d8-0x0;var _0x54908d=_0x1a85[_0x24b5d8];return _0x54908d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['create'](_0x45a433[_0x51a8('0x15')],{'raw':_0x45a433[_0x51a8('0x16')]?_0x45a433[_0x51a8('0x16')][_0x51a8('0x17')]===undefined?!![]:![]:!![]})[_0x51a8('0x18')](function(_0x3bc044){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger['debug'](_0x51a8('0x13'),_0x45a433,JSON['stringify'](_0x3bc044));_0x23539e(_0x3bc044);})[_0x51a8('0x12')](function(_0x12c029){logger[_0x51a8('0xe')](_0x51a8('0x13'),_0x12c029['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x12c029['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 658ed25..6f300bc 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 _0x94fa=['killProcess','exports','express','Router','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x1f155a,_0x4694e9){var _0x410cfb=function(_0x5eeeb2){while(--_0x5eeeb2){_0x1f155a['push'](_0x1f155a['shift']());}};_0x410cfb(++_0x4694e9);}(_0x94fa,0x132));var _0xa94f=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x94fa[_0x18a79d];return _0x4f8848;};'use strict';var express=require(_0xa94f('0x0'));var router=express[_0xa94f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa94f('0x2'));router[_0xa94f('0x3')]('/',auth[_0xa94f('0x4')](),controller['index']);router[_0xa94f('0x3')](_0xa94f('0x5'),auth[_0xa94f('0x4')](),controller[_0xa94f('0x6')]);module[_0xa94f('0x7')]=router; \ No newline at end of file +var _0xcc59=['exports','express','Router','./system.controller','get','index','/process/:pid/kill','isAuthenticated'];(function(_0x35bc60,_0x4ed50a){var _0x381857=function(_0x3486eb){while(--_0x3486eb){_0x35bc60['push'](_0x35bc60['shift']());}};_0x381857(++_0x4ed50a);}(_0xcc59,0x109));var _0x9cc5=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xcc59[_0x7e2eb0];return _0xd92de4;};'use strict';var express=require(_0x9cc5('0x0'));var router=express[_0x9cc5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9cc5('0x2'));router[_0x9cc5('0x3')]('/',auth['isAuthenticated'](),controller[_0x9cc5('0x4')]);router[_0x9cc5('0x3')](_0x9cc5('0x5'),auth[_0x9cc5('0x6')](),controller['killProcess']);module[_0x9cc5('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 072e7c5..a47a155 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 _0xfcf9=['then','split','length','indexOf','format','kill','SIGINT','killProcess','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xfcf9,0x182));var _0x9fcf=function(_0x5a2d78,_0x1f0537){_0x5a2d78=_0x5a2d78-0x0;var _0x45d862=_0xfcf9[_0x5a2d78];return _0x45d862;};'use strict';var info=require('systeminformation');var exec=require(_0x9fcf('0x0'))[_0x9fcf('0x1')];var logger=require('../../config/logger')(_0x9fcf('0x2'));var util=require(_0x9fcf('0x3'));var BPromise=require(_0x9fcf('0x4'));var _=require(_0x9fcf('0x5'));function handleError(_0x1a52ab,_0x1e8920,_0x2c7b38){_0x1e8920=_0x1e8920||0x1f4;return function(_0x40d7a9){logger[_0x9fcf('0x6')](_0x9fcf('0x7'),_0x2c7b38,_0x1e8920,util['inspect'](_0x40d7a9,{'showHidden':![],'depth':null}));delete _0x40d7a9[_0x9fcf('0x8')];_0x1a52ab[_0x9fcf('0x9')](_0x1e8920)[_0x9fcf('0xa')](_0x40d7a9);};}exports[_0x9fcf('0xb')]=function(_0x1011dc,_0x405375){return info[_0x9fcf('0xc')]()['then'](function(_0xc612f9){return _0x405375['status'](0xc8)[_0x9fcf('0xd')](_0xc612f9);})[_0x9fcf('0xe')](function(_0x102c86){return _0x405375[_0x9fcf('0x9')](0x1f4)[_0x9fcf('0xd')](_0x102c86);});};exports['killProcess']=function(_0x30808f,_0xa4f6c1){var _0x320f77=[_0x9fcf('0xf')];return new BPromise(function(_0x59eb20,_0x12d3d9){return exec(util['format'](_0x9fcf('0x10'),_0x30808f[_0x9fcf('0x11')][_0x9fcf('0x12')]),function(_0x4291dd,_0x13196f,_0x5d6074){if(_0x4291dd){return _0x12d3d9(_0x4291dd);}return _0x59eb20(_0x13196f);});})[_0x9fcf('0x13')](function(_0x367859){var _0x45bc11=![];var _0x1ae5e6=_0x367859[_0x9fcf('0x14')](/\n/);for(var _0x44c65b=0x0,_0x4971e4=_0x320f77[_0x9fcf('0x15')];_0x44c65b<_0x4971e4,_0x45bc11===![];_0x44c65b+=0x1){if(_0x367859[_0x9fcf('0x16')](_0x320f77[_0x44c65b])>=0x0){_0x45bc11=!![];}}if(!_0x45bc11){throw new Error(util[_0x9fcf('0x17')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x30808f['params'][_0x9fcf('0x12')]));}process[_0x9fcf('0x18')](_0x30808f[_0x9fcf('0x11')][_0x9fcf('0x12')],_0x9fcf('0x19'));return _0xa4f6c1[_0x9fcf('0x9')](0xc8)[_0x9fcf('0xd')]({'message':util[_0x9fcf('0x17')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x30808f[_0x9fcf('0x11')]['pid'])});})[_0x9fcf('0xe')](handleError(_0xa4f6c1,null,_0x9fcf('0x1a')));}; \ No newline at end of file +var _0xbf28=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','bluebird'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xbf28,0x11d));var _0x8bf2=function(_0x54d984,_0xb52857){_0x54d984=_0x54d984-0x0;var _0x31fddf=_0xbf28[_0x54d984];return _0x31fddf;};'use strict';var info=require(_0x8bf2('0x0'));var exec=require(_0x8bf2('0x1'))['exec'];var logger=require(_0x8bf2('0x2'))(_0x8bf2('0x3'));var util=require('util');var BPromise=require(_0x8bf2('0x4'));var _=require(_0x8bf2('0x5'));function handleError(_0x4fd486,_0x423a8a,_0x38b02e){_0x423a8a=_0x423a8a||0x1f4;return function(_0x147ab8){logger[_0x8bf2('0x6')](_0x8bf2('0x7'),_0x38b02e,_0x423a8a,util[_0x8bf2('0x8')](_0x147ab8,{'showHidden':![],'depth':null}));delete _0x147ab8[_0x8bf2('0x9')];_0x4fd486[_0x8bf2('0xa')](_0x423a8a)[_0x8bf2('0xb')](_0x147ab8);};}exports[_0x8bf2('0xc')]=function(_0x158503,_0x12b9d3){return info[_0x8bf2('0xd')]()[_0x8bf2('0xe')](function(_0x51d357){return _0x12b9d3[_0x8bf2('0xa')](0xc8)[_0x8bf2('0xf')](_0x51d357);})[_0x8bf2('0x10')](function(_0x4732f1){return _0x12b9d3[_0x8bf2('0xa')](0x1f4)[_0x8bf2('0xf')](_0x4732f1);});};exports[_0x8bf2('0x11')]=function(_0x29ed49,_0x19200f){var _0x2afb5c=[_0x8bf2('0x12')];return new BPromise(function(_0x5e987c,_0x3a1807){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x29ed49[_0x8bf2('0x13')][_0x8bf2('0x14')]),function(_0x120bc5,_0x1c2f4e,_0x42c783){if(_0x120bc5){return _0x3a1807(_0x120bc5);}return _0x5e987c(_0x1c2f4e);});})[_0x8bf2('0xe')](function(_0x3b79f4){var _0x420340=![];var _0x3c3e4f=_0x3b79f4[_0x8bf2('0x15')](/\n/);for(var _0x4d5185=0x0,_0x4dac0d=_0x2afb5c[_0x8bf2('0x16')];_0x4d5185<_0x4dac0d,_0x420340===![];_0x4d5185+=0x1){if(_0x3b79f4[_0x8bf2('0x17')](_0x2afb5c[_0x4d5185])>=0x0){_0x420340=!![];}}if(!_0x420340){throw new Error(util[_0x8bf2('0x18')](_0x8bf2('0x19'),_0x29ed49[_0x8bf2('0x13')][_0x8bf2('0x14')]));}process[_0x8bf2('0x1a')](_0x29ed49[_0x8bf2('0x13')]['pid'],_0x8bf2('0x1b'));return _0x19200f[_0x8bf2('0xa')](0xc8)[_0x8bf2('0xf')]({'message':util[_0x8bf2('0x18')](_0x8bf2('0x1c'),_0x29ed49[_0x8bf2('0x13')]['pid'])});})[_0x8bf2('0x10')](handleError(_0x19200f,null,_0x8bf2('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 0fa8e36..0d855a1 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 _0xbc36=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0xc95c63,_0x5f0afb){var _0x174430=function(_0x1fe55a){while(--_0x1fe55a){_0xc95c63['push'](_0xc95c63['shift']());}};_0x174430(++_0x5f0afb);}(_0xbc36,0x169));var _0x6bc3=function(_0x420483,_0x5cd57f){_0x420483=_0x420483-0x0;var _0x2fdbe1=_0xbc36[_0x420483];return _0x2fdbe1;};'use strict';var multer=require(_0x6bc3('0x0'));var util=require('util');var path=require(_0x6bc3('0x1'));var timeout=require(_0x6bc3('0x2'));var express=require(_0x6bc3('0x3'));var router=express[_0x6bc3('0x4')]();var fs_extra=require(_0x6bc3('0x5'));var auth=require(_0x6bc3('0x6'));var interaction=require(_0x6bc3('0x7'));var config=require(_0x6bc3('0x8'));var controller=require(_0x6bc3('0x9'));router['get']('/',auth[_0x6bc3('0xa')](),controller[_0x6bc3('0xb')]);router['get'](_0x6bc3('0xc'),auth[_0x6bc3('0xa')](),controller[_0x6bc3('0xd')]);router['post']('/',auth[_0x6bc3('0xa')](),controller[_0x6bc3('0xe')]);router[_0x6bc3('0xf')](_0x6bc3('0xc'),auth['isAuthenticated'](),controller[_0x6bc3('0x10')]);router[_0x6bc3('0x11')](_0x6bc3('0xc'),auth[_0x6bc3('0xa')](),controller[_0x6bc3('0x12')]);module[_0x6bc3('0x13')]=router; \ No newline at end of file +var _0x0de2=['put','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','./tag.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x508072,_0x4548c8){var _0x4422bf=function(_0x1e567c){while(--_0x1e567c){_0x508072['push'](_0x508072['shift']());}};_0x4422bf(++_0x4548c8);}(_0x0de2,0xa4));var _0x20de=function(_0x23bcb1,_0xfb78d0){_0x23bcb1=_0x23bcb1-0x0;var _0x430484=_0x0de2[_0x23bcb1];return _0x430484;};'use strict';var multer=require('multer');var util=require(_0x20de('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x20de('0x1'));var router=express[_0x20de('0x2')]();var fs_extra=require(_0x20de('0x3'));var auth=require(_0x20de('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x20de('0x5'));router['get']('/',auth[_0x20de('0x6')](),controller[_0x20de('0x7')]);router['get'](_0x20de('0x8'),auth[_0x20de('0x6')](),controller[_0x20de('0x9')]);router[_0x20de('0xa')]('/',auth[_0x20de('0x6')](),controller[_0x20de('0xb')]);router[_0x20de('0xc')]('/:id',auth[_0x20de('0x6')](),controller[_0x20de('0xd')]);router[_0x20de('0xe')](_0x20de('0x8'),auth[_0x20de('0x6')](),controller['destroy']);module[_0x20de('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 66ddae8..221aca0 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 _0x3750=['exports','STRING','name','sequelize'];(function(_0x50412e,_0xda6a88){var _0x5545a3=function(_0x4a5167){while(--_0x4a5167){_0x50412e['push'](_0x50412e['shift']());}};_0x5545a3(++_0xda6a88);}(_0x3750,0xbb));var _0x0375=function(_0x5397f4,_0x3f2c05){_0x5397f4=_0x5397f4-0x0;var _0x4cba07=_0x3750[_0x5397f4];return _0x4cba07;};'use strict';var Sequelize=require(_0x0375('0x0'));module[_0x0375('0x1')]={'name':{'type':Sequelize[_0x0375('0x2')],'unique':_0x0375('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0375('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x0375('0x2')]}}; \ No newline at end of file +var _0x5706=['exports','STRING','sequelize'];(function(_0x4d7202,_0x4fc029){var _0x2996b9=function(_0x459f42){while(--_0x459f42){_0x4d7202['push'](_0x4d7202['shift']());}};_0x2996b9(++_0x4fc029);}(_0x5706,0xb0));var _0x6570=function(_0xbbf34a,_0x50d3c4){_0xbbf34a=_0xbbf34a-0x0;var _0x2f29c5=_0x5706[_0xbbf34a];return _0x2f29c5;};'use strict';var Sequelize=require(_0x6570('0x0'));module[_0x6570('0x1')]={'name':{'type':Sequelize[_0x6570('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6570('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x6570('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ea7a235..572861a 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 _0x6a24=['reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6a24,0xd1));var _0x46a2=function(_0x55a1c0,_0x17ae96){_0x55a1c0=_0x55a1c0-0x0;var _0x29001f=_0x6a24[_0x55a1c0];return _0x29001f;};'use strict';var emlformat=require(_0x46a2('0x0'));var rimraf=require(_0x46a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require(_0x46a2('0x5'));var Mustache=require(_0x46a2('0x6'));var util=require('util');var path=require(_0x46a2('0x7'));var sox=require(_0x46a2('0x8'));var csv=require('to-csv');var ejs=require(_0x46a2('0x9'));var fs=require('fs');var fs_extra=require(_0x46a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46a2('0xb'));var jsforce=require(_0x46a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46a2('0xd'));var querystring=require('querystring');var Papa=require(_0x46a2('0xe'));var Redis=require('ioredis');var authService=require(_0x46a2('0xf'));var qs=require(_0x46a2('0x10'));var as=require(_0x46a2('0x11'));var hardwareService=require(_0x46a2('0x12'));var logger=require(_0x46a2('0x13'))(_0x46a2('0x14'));var utils=require(_0x46a2('0x15'));var config=require(_0x46a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403282,_0x18e584){_0x18e584=_0x18e584||0xcc;return function(_0x5c5d10){if(_0x5c5d10){return _0x403282[_0x46a2('0x17')](_0x18e584);}return _0x403282[_0x46a2('0x18')](_0x18e584)[_0x46a2('0x19')]();};}function respondWithResult(_0x18a038,_0xddc328){_0xddc328=_0xddc328||0xc8;return function(_0x2fd383){if(_0x2fd383){return _0x18a038[_0x46a2('0x18')](_0xddc328)[_0x46a2('0x1a')](_0x2fd383);}};}function respondWithFilteredResult(_0x577591,_0x4a7e7a){return function(_0x3c81e8){if(_0x3c81e8){var _0x2deb20=typeof _0x4a7e7a['offset']===_0x46a2('0x1b')&&typeof _0x4a7e7a[_0x46a2('0x1c')]==='undefined';var _0xa2eb96=_0x3c81e8[_0x46a2('0x1d')];var _0x577f18=_0x2deb20?0x0:_0x4a7e7a[_0x46a2('0x1e')];var _0x24f75f=_0x2deb20?_0x3c81e8['count']:_0x4a7e7a[_0x46a2('0x1e')]+_0x4a7e7a[_0x46a2('0x1c')];var _0x5144c7;if(_0x24f75f>=_0xa2eb96){_0x24f75f=_0xa2eb96;_0x5144c7=0xc8;}else{_0x5144c7=0xce;}_0x577591[_0x46a2('0x18')](_0x5144c7);return _0x577591[_0x46a2('0x1f')](_0x46a2('0x20'),_0x577f18+'-'+_0x24f75f+'/'+_0xa2eb96)[_0x46a2('0x1a')](_0x3c81e8);}return null;};}function patchUpdates(_0x202294){return function(_0x2d65c2){try{jsonpatch[_0x46a2('0x21')](_0x2d65c2,_0x202294,!![]);}catch(_0x473cfb){return BPromise[_0x46a2('0x22')](_0x473cfb);}return _0x2d65c2[_0x46a2('0x23')]();};}function saveUpdates(_0x5c7586,_0xa37d90){return function(_0x504b9e){if(_0x504b9e){return _0x504b9e[_0x46a2('0x24')](_0x5c7586)[_0x46a2('0x25')](function(_0x511ff6){return _0x511ff6;});}return null;};}function removeEntity(_0x43dc69,_0x15e5bb){return function(_0x233c4e){if(_0x233c4e){return _0x233c4e[_0x46a2('0x26')]()['then'](function(){var _0x197230=_0x233c4e[_0x46a2('0x27')]({'plain':!![]});var _0x1e48f5=_0x46a2('0x28');return db[_0x46a2('0x29')][_0x46a2('0x26')]({'where':{'type':_0x1e48f5,'resourceId':_0x197230['id']}})[_0x46a2('0x25')](function(){return _0x233c4e;});})[_0x46a2('0x25')](function(){_0x43dc69[_0x46a2('0x18')](0xcc)[_0x46a2('0x19')]();});}};}function handleEntityNotFound(_0x44ffb4,_0x582ada){return function(_0x2b4d9f){if(!_0x2b4d9f){_0x44ffb4[_0x46a2('0x17')](0x194);}return _0x2b4d9f;};}function handleError(_0x1c059b,_0x35dcbf){_0x35dcbf=_0x35dcbf||0x1f4;return function(_0x435155){logger[_0x46a2('0x2a')](_0x435155['stack']);if(_0x435155[_0x46a2('0x2b')]){delete _0x435155[_0x46a2('0x2b')];}_0x1c059b[_0x46a2('0x18')](_0x35dcbf)[_0x46a2('0x2c')](_0x435155);};}exports[_0x46a2('0x2d')]=function(_0x511bea,_0x4024be){var _0x4bb07e={},_0x20a0a2={},_0x97a3bf={'count':0x0,'rows':[]};var _0x3c1fba=_[_0x46a2('0x2e')](db[_0x46a2('0x2f')][_0x46a2('0x30')],function(_0x4c294a){return{'name':_0x4c294a[_0x46a2('0x31')],'type':_0x4c294a[_0x46a2('0x32')]['key']};});_0x20a0a2[_0x46a2('0x33')]=_[_0x46a2('0x2e')](_0x3c1fba,_0x46a2('0x2b'));_0x20a0a2[_0x46a2('0x34')]=_[_0x46a2('0x35')](_0x511bea['query']);_0x20a0a2['filters']=_[_0x46a2('0x36')](_0x20a0a2[_0x46a2('0x33')],_0x20a0a2[_0x46a2('0x34')]);_0x4bb07e[_0x46a2('0x37')]=_[_0x46a2('0x36')](_0x20a0a2[_0x46a2('0x33')],qs['fields'](_0x511bea['query'][_0x46a2('0x38')]));_0x4bb07e['attributes']=_0x4bb07e[_0x46a2('0x37')][_0x46a2('0x39')]?_0x4bb07e[_0x46a2('0x37')]:_0x20a0a2[_0x46a2('0x33')];if(!_0x511bea['query'][_0x46a2('0x3a')](_0x46a2('0x3b'))){_0x4bb07e[_0x46a2('0x1c')]=qs[_0x46a2('0x1c')](_0x511bea['query'][_0x46a2('0x1c')]);_0x4bb07e[_0x46a2('0x1e')]=qs[_0x46a2('0x1e')](_0x511bea[_0x46a2('0x34')]['offset']);}_0x4bb07e[_0x46a2('0x3c')]=qs['sort'](_0x511bea[_0x46a2('0x34')]['sort']);_0x4bb07e[_0x46a2('0x3d')]=qs[_0x46a2('0x3e')](_['pick'](_0x511bea[_0x46a2('0x34')],_0x20a0a2['filters']),_0x3c1fba);if(_0x511bea['query'][_0x46a2('0x3f')]){_0x4bb07e[_0x46a2('0x3d')]=_[_0x46a2('0x40')](_0x4bb07e[_0x46a2('0x3d')],{'$or':_[_0x46a2('0x2e')](_0x3c1fba,function(_0x3b2c96){if(_0x3b2c96['type']!==_0x46a2('0x41')){var _0x49ace7={};_0x49ace7[_0x3b2c96[_0x46a2('0x2b')]]={'$like':'%'+_0x511bea[_0x46a2('0x34')][_0x46a2('0x3f')]+'%'};return _0x49ace7;}})});}_0x4bb07e=_[_0x46a2('0x40')]({},_0x4bb07e,_0x511bea[_0x46a2('0x42')]);var _0x27cd37={'where':_0x4bb07e[_0x46a2('0x3d')]};return db[_0x46a2('0x2f')]['count'](_0x27cd37)[_0x46a2('0x25')](function(_0x15ec39){_0x97a3bf[_0x46a2('0x1d')]=_0x15ec39;if(_0x511bea[_0x46a2('0x34')]['includeAll']){_0x4bb07e[_0x46a2('0x43')]=[{'all':!![]}];}return db[_0x46a2('0x2f')][_0x46a2('0x44')](_0x4bb07e);})[_0x46a2('0x25')](function(_0x1fcc03){_0x97a3bf['rows']=_0x1fcc03;return _0x97a3bf;})[_0x46a2('0x25')](respondWithFilteredResult(_0x4024be,_0x4bb07e))['catch'](handleError(_0x4024be,null));};exports[_0x46a2('0x45')]=function(_0x20968b,_0x5df93d){var _0x19fcc0={'raw':!![],'where':{'id':_0x20968b[_0x46a2('0x46')]['id']}},_0x1a7e45={};_0x1a7e45[_0x46a2('0x33')]=_[_0x46a2('0x35')](db[_0x46a2('0x2f')][_0x46a2('0x30')]);_0x1a7e45[_0x46a2('0x34')]=_[_0x46a2('0x35')](_0x20968b[_0x46a2('0x34')]);_0x1a7e45['filters']=_[_0x46a2('0x36')](_0x1a7e45[_0x46a2('0x33')],_0x1a7e45[_0x46a2('0x34')]);_0x19fcc0[_0x46a2('0x37')]=_[_0x46a2('0x36')](_0x1a7e45['model'],qs[_0x46a2('0x38')](_0x20968b[_0x46a2('0x34')][_0x46a2('0x38')]));_0x19fcc0[_0x46a2('0x37')]=_0x19fcc0[_0x46a2('0x37')]['length']?_0x19fcc0[_0x46a2('0x37')]:_0x1a7e45['model'];if(_0x20968b[_0x46a2('0x34')][_0x46a2('0x47')]){_0x19fcc0['include']=[{'all':!![]}];}_0x19fcc0=_[_0x46a2('0x40')]({},_0x19fcc0,_0x20968b[_0x46a2('0x42')]);return db[_0x46a2('0x2f')][_0x46a2('0x48')](_0x19fcc0)[_0x46a2('0x25')](handleEntityNotFound(_0x5df93d,null))[_0x46a2('0x25')](respondWithResult(_0x5df93d,null))[_0x46a2('0x49')](handleError(_0x5df93d,null));};exports['create']=function(_0x369015,_0x1f8640){return db[_0x46a2('0x2f')][_0x46a2('0x4a')](_0x369015['body'],{})[_0x46a2('0x25')](function(_0x4c40a6){var _0x12f268=_0x369015[_0x46a2('0x4b')]['get']({'plain':!![]});if(!_0x12f268)throw new Error(_0x46a2('0x4c'));if(_0x12f268['role']===_0x46a2('0x4b')){var _0x76ccd3=_0x4c40a6[_0x46a2('0x27')]({'plain':!![]});var _0x38e4e7=_0x46a2('0x28');return db[_0x46a2('0x4d')]['find']({'where':{'name':_0x38e4e7,'userProfileId':_0x12f268['userProfileId']},'raw':!![]})[_0x46a2('0x25')](function(_0x1a5cf4){if(_0x1a5cf4&&_0x1a5cf4[_0x46a2('0x4e')]===0x0){return db[_0x46a2('0x29')][_0x46a2('0x4a')]({'name':_0x76ccd3[_0x46a2('0x2b')],'resourceId':_0x76ccd3['id'],'type':_0x1a5cf4[_0x46a2('0x2b')],'sectionId':_0x1a5cf4['id']},{})['then'](function(){return _0x4c40a6;});}else{return _0x4c40a6;}})[_0x46a2('0x49')](function(_0x3665db){logger[_0x46a2('0x2a')](_0x46a2('0x4f'),_0x3665db);throw _0x3665db;});}return _0x4c40a6;})[_0x46a2('0x25')](respondWithResult(_0x1f8640,0xc9))[_0x46a2('0x49')](handleError(_0x1f8640,null));};exports[_0x46a2('0x24')]=function(_0x4ff5e6,_0x3ff55a){if(_0x4ff5e6[_0x46a2('0x50')]['id']){delete _0x4ff5e6['body']['id'];}return db[_0x46a2('0x2f')][_0x46a2('0x48')]({'where':{'id':_0x4ff5e6['params']['id']}})[_0x46a2('0x25')](handleEntityNotFound(_0x3ff55a,null))[_0x46a2('0x25')](saveUpdates(_0x4ff5e6['body'],null))[_0x46a2('0x25')](respondWithResult(_0x3ff55a,null))[_0x46a2('0x49')](handleError(_0x3ff55a,null));};exports['destroy']=function(_0x5e926e,_0x48f2c2){return db['Tag'][_0x46a2('0x48')]({'where':{'id':_0x5e926e['params']['id']}})['then'](handleEntityNotFound(_0x48f2c2,null))[_0x46a2('0x25')](removeEntity(_0x48f2c2,null))[_0x46a2('0x49')](handleError(_0x48f2c2,null));}; \ No newline at end of file +var _0x303a=['update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xf64e53,_0x4db24b){var _0x1e185e=function(_0x451dc3){while(--_0x451dc3){_0xf64e53['push'](_0xf64e53['shift']());}};_0x1e185e(++_0x4db24b);}(_0x303a,0x1a0));var _0xa303=function(_0x49f19e,_0x1c3aa3){_0x49f19e=_0x49f19e-0x0;var _0x280b5a=_0x303a[_0x49f19e];return _0x280b5a;};'use strict';var emlformat=require(_0xa303('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa303('0x1'));var jsonpatch=require(_0xa303('0x2'));var rp=require(_0xa303('0x3'));var moment=require(_0xa303('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa303('0x5'));var util=require(_0xa303('0x6'));var path=require(_0xa303('0x7'));var sox=require(_0xa303('0x8'));var csv=require(_0xa303('0x9'));var ejs=require(_0xa303('0xa'));var fs=require('fs');var fs_extra=require(_0xa303('0xb'));var _=require(_0xa303('0xc'));var squel=require(_0xa303('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa303('0x9'));var querystring=require(_0xa303('0xe'));var Papa=require('papaparse');var Redis=require(_0xa303('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa303('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa303('0x11'));var logger=require(_0xa303('0x12'))(_0xa303('0x13'));var utils=require(_0xa303('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa303('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf5df1e,_0x43a054){_0x43a054=_0x43a054||0xcc;return function(_0x2ed971){if(_0x2ed971){return _0xf5df1e['sendStatus'](_0x43a054);}return _0xf5df1e[_0xa303('0x16')](_0x43a054)[_0xa303('0x17')]();};}function respondWithResult(_0x28cd7f,_0xfa522c){_0xfa522c=_0xfa522c||0xc8;return function(_0xed0420){if(_0xed0420){return _0x28cd7f[_0xa303('0x16')](_0xfa522c)[_0xa303('0x18')](_0xed0420);}};}function respondWithFilteredResult(_0x2d1110,_0x4c8bc1){return function(_0x2c2939){if(_0x2c2939){var _0xd2e8ee=typeof _0x4c8bc1[_0xa303('0x19')]===_0xa303('0x1a')&&typeof _0x4c8bc1[_0xa303('0x1b')]===_0xa303('0x1a');var _0x5ec243=_0x2c2939[_0xa303('0x1c')];var _0x54ca49=_0xd2e8ee?0x0:_0x4c8bc1[_0xa303('0x19')];var _0x4cf535=_0xd2e8ee?_0x2c2939[_0xa303('0x1c')]:_0x4c8bc1['offset']+_0x4c8bc1[_0xa303('0x1b')];var _0xe263f9;if(_0x4cf535>=_0x5ec243){_0x4cf535=_0x5ec243;_0xe263f9=0xc8;}else{_0xe263f9=0xce;}_0x2d1110[_0xa303('0x16')](_0xe263f9);return _0x2d1110['set'](_0xa303('0x1d'),_0x54ca49+'-'+_0x4cf535+'/'+_0x5ec243)[_0xa303('0x18')](_0x2c2939);}return null;};}function patchUpdates(_0x1b0566){return function(_0x59e551){try{jsonpatch[_0xa303('0x1e')](_0x59e551,_0x1b0566,!![]);}catch(_0x3bc8c3){return BPromise[_0xa303('0x1f')](_0x3bc8c3);}return _0x59e551[_0xa303('0x20')]();};}function saveUpdates(_0x54b173,_0x14f9ab){return function(_0x2a2512){if(_0x2a2512){return _0x2a2512['update'](_0x54b173)[_0xa303('0x21')](function(_0x27c1d7){return _0x27c1d7;});}return null;};}function removeEntity(_0x25db9c,_0x122d1e){return function(_0x65ab0e){if(_0x65ab0e){return _0x65ab0e[_0xa303('0x22')]()[_0xa303('0x21')](function(){var _0x5d9dee=_0x65ab0e[_0xa303('0x23')]({'plain':!![]});var _0x57d584='Tags';return db['UserProfileResource']['destroy']({'where':{'type':_0x57d584,'resourceId':_0x5d9dee['id']}})['then'](function(){return _0x65ab0e;});})[_0xa303('0x21')](function(){_0x25db9c[_0xa303('0x16')](0xcc)[_0xa303('0x17')]();});}};}function handleEntityNotFound(_0xbb93f0,_0x94d3e4){return function(_0x48e79f){if(!_0x48e79f){_0xbb93f0[_0xa303('0x24')](0x194);}return _0x48e79f;};}function handleError(_0xb35c22,_0x561d73){_0x561d73=_0x561d73||0x1f4;return function(_0x221f59){logger[_0xa303('0x25')](_0x221f59[_0xa303('0x26')]);if(_0x221f59[_0xa303('0x27')]){delete _0x221f59[_0xa303('0x27')];}_0xb35c22[_0xa303('0x16')](_0x561d73)[_0xa303('0x28')](_0x221f59);};}exports[_0xa303('0x29')]=function(_0x411b42,_0x3383f4){var _0x9b7e61={},_0x217967={},_0x2f7775={'count':0x0,'rows':[]};var _0x1a44fc=_[_0xa303('0x2a')](db[_0xa303('0x2b')][_0xa303('0x2c')],function(_0x5de180){return{'name':_0x5de180['fieldName'],'type':_0x5de180[_0xa303('0x2d')][_0xa303('0x2e')]};});_0x217967[_0xa303('0x2f')]=_[_0xa303('0x2a')](_0x1a44fc,'name');_0x217967[_0xa303('0x30')]=_[_0xa303('0x31')](_0x411b42[_0xa303('0x30')]);_0x217967[_0xa303('0x32')]=_['intersection'](_0x217967[_0xa303('0x2f')],_0x217967[_0xa303('0x30')]);_0x9b7e61[_0xa303('0x33')]=_['intersection'](_0x217967[_0xa303('0x2f')],qs[_0xa303('0x34')](_0x411b42[_0xa303('0x30')]['fields']));_0x9b7e61[_0xa303('0x33')]=_0x9b7e61[_0xa303('0x33')][_0xa303('0x35')]?_0x9b7e61['attributes']:_0x217967[_0xa303('0x2f')];if(!_0x411b42[_0xa303('0x30')][_0xa303('0x36')](_0xa303('0x37'))){_0x9b7e61['limit']=qs[_0xa303('0x1b')](_0x411b42[_0xa303('0x30')][_0xa303('0x1b')]);_0x9b7e61[_0xa303('0x19')]=qs['offset'](_0x411b42[_0xa303('0x30')][_0xa303('0x19')]);}_0x9b7e61[_0xa303('0x38')]=qs[_0xa303('0x39')](_0x411b42[_0xa303('0x30')]['sort']);_0x9b7e61['where']=qs[_0xa303('0x32')](_[_0xa303('0x3a')](_0x411b42[_0xa303('0x30')],_0x217967['filters']),_0x1a44fc);if(_0x411b42['query'][_0xa303('0x3b')]){_0x9b7e61[_0xa303('0x3c')]=_[_0xa303('0x3d')](_0x9b7e61[_0xa303('0x3c')],{'$or':_['map'](_0x1a44fc,function(_0x59e413){if(_0x59e413[_0xa303('0x2d')]!==_0xa303('0x3e')){var _0x1c99b4={};_0x1c99b4[_0x59e413[_0xa303('0x27')]]={'$like':'%'+_0x411b42[_0xa303('0x30')]['filter']+'%'};return _0x1c99b4;}})});}_0x9b7e61=_[_0xa303('0x3d')]({},_0x9b7e61,_0x411b42[_0xa303('0x3f')]);var _0x468928={'where':_0x9b7e61[_0xa303('0x3c')]};return db['Tag']['count'](_0x468928)['then'](function(_0x1805f6){_0x2f7775[_0xa303('0x1c')]=_0x1805f6;if(_0x411b42[_0xa303('0x30')][_0xa303('0x40')]){_0x9b7e61[_0xa303('0x41')]=[{'all':!![]}];}return db[_0xa303('0x2b')][_0xa303('0x42')](_0x9b7e61);})[_0xa303('0x21')](function(_0x3615c5){_0x2f7775[_0xa303('0x43')]=_0x3615c5;return _0x2f7775;})[_0xa303('0x21')](respondWithFilteredResult(_0x3383f4,_0x9b7e61))['catch'](handleError(_0x3383f4,null));};exports['show']=function(_0x45fb2f,_0x54e558){var _0x839adf={'raw':!![],'where':{'id':_0x45fb2f[_0xa303('0x44')]['id']}},_0x564d59={};_0x564d59[_0xa303('0x2f')]=_[_0xa303('0x31')](db[_0xa303('0x2b')][_0xa303('0x2c')]);_0x564d59[_0xa303('0x30')]=_[_0xa303('0x31')](_0x45fb2f[_0xa303('0x30')]);_0x564d59[_0xa303('0x32')]=_[_0xa303('0x45')](_0x564d59[_0xa303('0x2f')],_0x564d59[_0xa303('0x30')]);_0x839adf[_0xa303('0x33')]=_['intersection'](_0x564d59[_0xa303('0x2f')],qs['fields'](_0x45fb2f[_0xa303('0x30')][_0xa303('0x34')]));_0x839adf[_0xa303('0x33')]=_0x839adf['attributes']['length']?_0x839adf[_0xa303('0x33')]:_0x564d59[_0xa303('0x2f')];if(_0x45fb2f[_0xa303('0x30')][_0xa303('0x40')]){_0x839adf[_0xa303('0x41')]=[{'all':!![]}];}_0x839adf=_[_0xa303('0x3d')]({},_0x839adf,_0x45fb2f[_0xa303('0x3f')]);return db[_0xa303('0x2b')][_0xa303('0x46')](_0x839adf)[_0xa303('0x21')](handleEntityNotFound(_0x54e558,null))['then'](respondWithResult(_0x54e558,null))[_0xa303('0x47')](handleError(_0x54e558,null));};exports[_0xa303('0x48')]=function(_0x532003,_0x3cc97a){return db['Tag'][_0xa303('0x48')](_0x532003[_0xa303('0x49')],{})[_0xa303('0x21')](function(_0x3fd1be){var _0x5a6da0=_0x532003[_0xa303('0x4a')][_0xa303('0x23')]({'plain':!![]});if(!_0x5a6da0)throw new Error(_0xa303('0x4b'));if(_0x5a6da0[_0xa303('0x4c')]===_0xa303('0x4a')){var _0x16242c=_0x3fd1be['get']({'plain':!![]});var _0x1a8bc0=_0xa303('0x4d');return db[_0xa303('0x4e')][_0xa303('0x46')]({'where':{'name':_0x1a8bc0,'userProfileId':_0x5a6da0['userProfileId']},'raw':!![]})['then'](function(_0x34547d){if(_0x34547d&&_0x34547d[_0xa303('0x4f')]===0x0){return db[_0xa303('0x50')]['create']({'name':_0x16242c[_0xa303('0x27')],'resourceId':_0x16242c['id'],'type':_0x34547d['name'],'sectionId':_0x34547d['id']},{})['then'](function(){return _0x3fd1be;});}else{return _0x3fd1be;}})['catch'](function(_0x51c4db){logger[_0xa303('0x25')](_0xa303('0x51'),_0x51c4db);throw _0x51c4db;});}return _0x3fd1be;})['then'](respondWithResult(_0x3cc97a,0xc9))[_0xa303('0x47')](handleError(_0x3cc97a,null));};exports[_0xa303('0x52')]=function(_0x33a667,_0x3cda19){if(_0x33a667[_0xa303('0x49')]['id']){delete _0x33a667['body']['id'];}return db[_0xa303('0x2b')][_0xa303('0x46')]({'where':{'id':_0x33a667[_0xa303('0x44')]['id']}})[_0xa303('0x21')](handleEntityNotFound(_0x3cda19,null))[_0xa303('0x21')](saveUpdates(_0x33a667['body'],null))['then'](respondWithResult(_0x3cda19,null))[_0xa303('0x47')](handleError(_0x3cda19,null));};exports[_0xa303('0x22')]=function(_0x3e377b,_0x87a096){return db[_0xa303('0x2b')][_0xa303('0x46')]({'where':{'id':_0x3e377b[_0xa303('0x44')]['id']}})[_0xa303('0x21')](handleEntityNotFound(_0x87a096,null))[_0xa303('0x21')](removeEntity(_0x87a096,null))['catch'](handleError(_0x87a096,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 943c608..986a20f 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 _0x0dc2=['request-promise','path','../../config/environment','exports','Tag','tools_tags','util','api','moment'];(function(_0x7e8ef5,_0x3117ab){var _0x4857e6=function(_0x313b49){while(--_0x313b49){_0x7e8ef5['push'](_0x7e8ef5['shift']());}};_0x4857e6(++_0x3117ab);}(_0x0dc2,0x1d1));var _0x20dc=function(_0x1e0565,_0x421106){_0x1e0565=_0x1e0565-0x0;var _0x455b90=_0x0dc2[_0x1e0565];return _0x455b90;};'use strict';var _=require('lodash');var util=require(_0x20dc('0x0'));var logger=require('../../config/logger')(_0x20dc('0x1'));var moment=require(_0x20dc('0x2'));var BPromise=require('bluebird');var rp=require(_0x20dc('0x3'));var fs=require('fs');var path=require(_0x20dc('0x4'));var rimraf=require('rimraf');var config=require(_0x20dc('0x5'));var attributes=require('./tag.attributes');module[_0x20dc('0x6')]=function(_0x6b265d,_0x4643e4){return _0x6b265d['define'](_0x20dc('0x7'),attributes,{'tableName':_0x20dc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb85=['moment','request-promise','./tag.attributes','exports','Tag','lodash','util','../../config/logger','api'];(function(_0x567a75,_0x29c962){var _0x1343a2=function(_0x16c87b){while(--_0x16c87b){_0x567a75['push'](_0x567a75['shift']());}};_0x1343a2(++_0x29c962);}(_0xfb85,0x12e));var _0x5fb8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfb85[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5fb8('0x0'));var util=require(_0x5fb8('0x1'));var logger=require(_0x5fb8('0x2'))(_0x5fb8('0x3'));var moment=require(_0x5fb8('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fb8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5fb8('0x6'));module[_0x5fb8('0x7')]=function(_0x136060,_0x2bee8b){return _0x136060['define'](_0x5fb8('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 44fd219..fae1307 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 _0x0faf=['../../config/utils','../../config/logger','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','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b05cc,_0x5ad8e){var _0x198ecf=function(_0x381112){while(--_0x381112){_0x4b05cc['push'](_0x4b05cc['shift']());}};_0x198ecf(++_0x5ad8e);}(_0x0faf,0x132));var _0xf0fa=function(_0x2b81be,_0x544bdf){_0x2b81be=_0x2b81be-0x0;var _0x8ed4a7=_0x0faf[_0x2b81be];return _0x8ed4a7;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b5c4,_0x3a703b,_0x2db1d9){return new BPromise(function(_0x587865,_0x42f7fd){return client[_0xf0fa('0xc')](_0x25b5c4,_0x2db1d9)['then'](function(_0x4df4d1){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x3a703b,_0xf0fa('0xf'),JSON[_0xf0fa('0x12')](_0x4df4d1));if(_0x4df4d1[_0xf0fa('0x13')]){if(_0x4df4d1['error'][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x3a703b,_0x4df4d1['error'][_0xf0fa('0x15')]);return _0x42f7fd(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3a703b,_0x4df4d1[_0xf0fa('0x13')]['message']);return _0x587865(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));_0x587865(_0x4df4d1[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x497542){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x3a703b,_0x497542);_0x42f7fd(_0x497542);});});} \ No newline at end of file +var _0x984b=['Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x5f108e,_0x16a6eb){var _0x294cb=function(_0x3c408d){while(--_0x3c408d){_0x5f108e['push'](_0x5f108e['shift']());}};_0x294cb(++_0x16a6eb);}(_0x984b,0xee));var _0xb984=function(_0x428780,_0x2b82a8){_0x428780=_0x428780-0x0;var _0x33fbaa=_0x984b[_0x428780];return _0x33fbaa;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d0a683e..a0dfcd3 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 9e6bc9e..50778cc 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 _0xb10b=['name','sequelize','STRING'];(function(_0x1df3f9,_0x1cd4b2){var _0x113cc9=function(_0x46d73a){while(--_0x46d73a){_0x1df3f9['push'](_0x1df3f9['shift']());}};_0x113cc9(++_0x1cd4b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xb10b[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x489d89,_0x29e69b){var _0x4a8a07=function(_0x2156a2){while(--_0x2156a2){_0x489d89['push'](_0x489d89['shift']());}};_0x4a8a07(++_0x29e69b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 57866c5..f77bc3e 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 _0xa535=['rows','catch','show','params','rawAttributes','intersection','length','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','Teams','end','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','add','ids','removeQueues','remove','isArray','Voice','Chat','Sms','Fax','Whatsapp','transaction','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','addAgents','spread','removeAgents','Mail','Openchannel','Queue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','Team','fieldName','key','model','keys','filters','query','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll'];(function(_0x2db7b6,_0x40ce34){var _0x58e113=function(_0x3e84e1){while(--_0x3e84e1){_0x2db7b6['push'](_0x2db7b6['shift']());}};_0x58e113(++_0x40ce34);}(_0xa535,0x19a));var _0x5a53=function(_0x405458,_0x101ac8){_0x405458=_0x405458-0x0;var _0x319511=_0xa535[_0x405458];return _0x319511;};'use strict';var emlformat=require(_0x5a53('0x0'));var rimraf=require(_0x5a53('0x1'));var zipdir=require(_0x5a53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a53('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a53('0x4'));var util=require('util');var path=require(_0x5a53('0x5'));var sox=require(_0x5a53('0x6'));var csv=require('to-csv');var ejs=require(_0x5a53('0x7'));var fs=require('fs');var fs_extra=require(_0x5a53('0x8'));var _=require(_0x5a53('0x9'));var squel=require(_0x5a53('0xa'));var crypto=require(_0x5a53('0xb'));var jsforce=require(_0x5a53('0xc'));var deskjs=require(_0x5a53('0xd'));var toCsv=require(_0x5a53('0xe'));var querystring=require(_0x5a53('0xf'));var Papa=require(_0x5a53('0x10'));var Redis=require('ioredis');var authService=require(_0x5a53('0x11'));var qs=require(_0x5a53('0x12'));var as=require(_0x5a53('0x13'));var hardwareService=require(_0x5a53('0x14'));var logger=require(_0x5a53('0x15'))(_0x5a53('0x16'));var utils=require(_0x5a53('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5a53('0x18'));var db=require(_0x5a53('0x19'))['db'];config[_0x5a53('0x1a')]=_[_0x5a53('0x1b')](config[_0x5a53('0x1a')],{'host':_0x5a53('0x1c'),'port':0x18eb});var socket=require(_0x5a53('0x1d'))(new Redis(config[_0x5a53('0x1a')]));require(_0x5a53('0x1e'))[_0x5a53('0x1f')](socket);function respondWithStatusCode(_0x4d34ca,_0x5031e5){_0x5031e5=_0x5031e5||0xcc;return function(_0x33f97a){if(_0x33f97a){return _0x4d34ca[_0x5a53('0x20')](_0x5031e5);}return _0x4d34ca[_0x5a53('0x21')](_0x5031e5)['end']();};}function respondWithResult(_0x1cbd67,_0x2cfa57){_0x2cfa57=_0x2cfa57||0xc8;return function(_0x4bdb7e){if(_0x4bdb7e){return _0x1cbd67[_0x5a53('0x21')](_0x2cfa57)[_0x5a53('0x22')](_0x4bdb7e);}};}function respondWithFilteredResult(_0xd6f4d3,_0x48e437){return function(_0x26619f){if(_0x26619f){var _0x1a28ab=typeof _0x48e437[_0x5a53('0x23')]===_0x5a53('0x24')&&typeof _0x48e437[_0x5a53('0x25')]===_0x5a53('0x24');var _0x29fe74=_0x26619f[_0x5a53('0x26')];var _0x47af71=_0x1a28ab?0x0:_0x48e437[_0x5a53('0x23')];var _0xc46f22=_0x1a28ab?_0x26619f[_0x5a53('0x26')]:_0x48e437[_0x5a53('0x23')]+_0x48e437['limit'];var _0x37895c;if(_0xc46f22>=_0x29fe74){_0xc46f22=_0x29fe74;_0x37895c=0xc8;}else{_0x37895c=0xce;}_0xd6f4d3[_0x5a53('0x21')](_0x37895c);return _0xd6f4d3[_0x5a53('0x27')](_0x5a53('0x28'),_0x47af71+'-'+_0xc46f22+'/'+_0x29fe74)[_0x5a53('0x22')](_0x26619f);}return null;};}function patchUpdates(_0x2dacb8){return function(_0x15f63b){try{jsonpatch['apply'](_0x15f63b,_0x2dacb8,!![]);}catch(_0x1f4fbe){return BPromise[_0x5a53('0x29')](_0x1f4fbe);}return _0x15f63b[_0x5a53('0x2a')]();};}function saveUpdates(_0x354fbb,_0x3bb080){return function(_0x147e71){if(_0x147e71){return _0x147e71[_0x5a53('0x2b')](_0x354fbb)[_0x5a53('0x2c')](function(_0x477934){return _0x477934;});}return null;};}function handleEntityNotFound(_0x3ca5e4,_0x90e620){return function(_0x2bacd2){if(!_0x2bacd2){_0x3ca5e4[_0x5a53('0x20')](0x194);}return _0x2bacd2;};}function handleError(_0x17088b,_0x3aaa17){_0x3aaa17=_0x3aaa17||0x1f4;return function(_0xefd877){logger['error'](_0xefd877[_0x5a53('0x2d')]);if(_0xefd877[_0x5a53('0x2e')]){delete _0xefd877['name'];}_0x17088b[_0x5a53('0x21')](_0x3aaa17)[_0x5a53('0x2f')](_0xefd877);};}exports[_0x5a53('0x30')]=function(_0x175b46,_0xa0e7ba){var _0x3c0edc={},_0xb6a75b={},_0x428e47={'count':0x0,'rows':[]};var _0x162e30=_[_0x5a53('0x31')](db[_0x5a53('0x32')]['rawAttributes'],function(_0x2af9df){return{'name':_0x2af9df[_0x5a53('0x33')],'type':_0x2af9df['type'][_0x5a53('0x34')]};});_0xb6a75b[_0x5a53('0x35')]=_[_0x5a53('0x31')](_0x162e30,_0x5a53('0x2e'));_0xb6a75b['query']=_[_0x5a53('0x36')](_0x175b46['query']);_0xb6a75b[_0x5a53('0x37')]=_['intersection'](_0xb6a75b[_0x5a53('0x35')],_0xb6a75b[_0x5a53('0x38')]);_0x3c0edc[_0x5a53('0x39')]=_['intersection'](_0xb6a75b['model'],qs[_0x5a53('0x3a')](_0x175b46[_0x5a53('0x38')][_0x5a53('0x3a')]));_0x3c0edc[_0x5a53('0x39')]=_0x3c0edc[_0x5a53('0x39')]['length']?_0x3c0edc[_0x5a53('0x39')]:_0xb6a75b[_0x5a53('0x35')];if(!_0x175b46[_0x5a53('0x38')]['hasOwnProperty'](_0x5a53('0x3b'))){_0x3c0edc[_0x5a53('0x25')]=qs[_0x5a53('0x25')](_0x175b46[_0x5a53('0x38')][_0x5a53('0x25')]);_0x3c0edc[_0x5a53('0x23')]=qs[_0x5a53('0x23')](_0x175b46['query'][_0x5a53('0x23')]);}_0x3c0edc['order']=qs[_0x5a53('0x3c')](_0x175b46[_0x5a53('0x38')][_0x5a53('0x3c')]);_0x3c0edc[_0x5a53('0x3d')]=qs[_0x5a53('0x37')](_[_0x5a53('0x3e')](_0x175b46[_0x5a53('0x38')],_0xb6a75b[_0x5a53('0x37')]),_0x162e30);if(_0x175b46['query'][_0x5a53('0x3f')]){_0x3c0edc[_0x5a53('0x3d')]=_[_0x5a53('0x40')](_0x3c0edc[_0x5a53('0x3d')],{'$or':_['map'](_0x162e30,function(_0x23625c){if(_0x23625c[_0x5a53('0x41')]!==_0x5a53('0x42')){var _0x9b85e4={};_0x9b85e4[_0x23625c[_0x5a53('0x2e')]]={'$like':'%'+_0x175b46['query']['filter']+'%'};return _0x9b85e4;}})});}_0x3c0edc=_[_0x5a53('0x40')]({},_0x3c0edc,_0x175b46[_0x5a53('0x43')]);var _0x585997={'where':_0x3c0edc[_0x5a53('0x3d')]};return db['Team'][_0x5a53('0x26')](_0x585997)[_0x5a53('0x2c')](function(_0x269d88){_0x428e47['count']=_0x269d88;if(_0x175b46[_0x5a53('0x38')]['includeAll']){_0x3c0edc[_0x5a53('0x44')]=[{'all':!![]}];}return db[_0x5a53('0x32')][_0x5a53('0x45')](_0x3c0edc);})[_0x5a53('0x2c')](function(_0x500171){_0x428e47[_0x5a53('0x46')]=_0x500171;return _0x428e47;})['then'](respondWithFilteredResult(_0xa0e7ba,_0x3c0edc))[_0x5a53('0x47')](handleError(_0xa0e7ba,null));};exports[_0x5a53('0x48')]=function(_0xbd3bd3,_0x366cee){var _0x430621={'raw':![],'where':{'id':_0xbd3bd3[_0x5a53('0x49')]['id']}},_0x20c6d6={};_0x20c6d6[_0x5a53('0x35')]=_[_0x5a53('0x36')](db[_0x5a53('0x32')][_0x5a53('0x4a')]);_0x20c6d6['query']=_[_0x5a53('0x36')](_0xbd3bd3[_0x5a53('0x38')]);_0x20c6d6[_0x5a53('0x37')]=_[_0x5a53('0x4b')](_0x20c6d6['model'],_0x20c6d6['query']);_0x430621[_0x5a53('0x39')]=_[_0x5a53('0x4b')](_0x20c6d6[_0x5a53('0x35')],qs[_0x5a53('0x3a')](_0xbd3bd3['query'][_0x5a53('0x3a')]));_0x430621[_0x5a53('0x39')]=_0x430621['attributes'][_0x5a53('0x4c')]?_0x430621[_0x5a53('0x39')]:_0x20c6d6[_0x5a53('0x35')];if(_0xbd3bd3[_0x5a53('0x38')]['includeAll']){_0x430621[_0x5a53('0x44')]=[{'all':!![]}];}_0x430621=_[_0x5a53('0x40')]({},_0x430621,_0xbd3bd3['options']);return db['Team']['find'](_0x430621)[_0x5a53('0x2c')](handleEntityNotFound(_0x366cee,null))[_0x5a53('0x2c')](respondWithResult(_0x366cee,null))[_0x5a53('0x47')](handleError(_0x366cee,null));};exports['create']=function(_0xec3cc6,_0x53697d){return db[_0x5a53('0x32')][_0x5a53('0x4d')](_0xec3cc6[_0x5a53('0x4e')],{})['then'](function(_0x449fa8){var _0x81dd5d=_0xec3cc6[_0x5a53('0x4f')][_0x5a53('0x50')]({'plain':!![]});if(!_0x81dd5d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81dd5d[_0x5a53('0x51')]===_0x5a53('0x4f')){var _0x5e6fe=_0x449fa8[_0x5a53('0x50')]({'plain':!![]});var _0x10b9a='Teams';return db[_0x5a53('0x52')]['find']({'where':{'name':_0x10b9a,'userProfileId':_0x81dd5d[_0x5a53('0x53')]},'raw':!![]})['then'](function(_0x2f955f){if(_0x2f955f&&_0x2f955f[_0x5a53('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e6fe[_0x5a53('0x2e')],'resourceId':_0x5e6fe['id'],'type':_0x2f955f[_0x5a53('0x2e')],'sectionId':_0x2f955f['id']},{})[_0x5a53('0x2c')](function(){return _0x449fa8;});}else{return _0x449fa8;}})[_0x5a53('0x47')](function(_0x4ee165){logger[_0x5a53('0x55')](_0x5a53('0x56'),_0x4ee165);throw _0x4ee165;});}return _0x449fa8;})[_0x5a53('0x2c')](respondWithResult(_0x53697d,0xc9))['catch'](handleError(_0x53697d,null));};exports['update']=function(_0x46b1ac,_0x158641){if(_0x46b1ac[_0x5a53('0x4e')]['id']){delete _0x46b1ac[_0x5a53('0x4e')]['id'];}return db['Team'][_0x5a53('0x57')]({'where':{'id':_0x46b1ac[_0x5a53('0x49')]['id']}})[_0x5a53('0x2c')](handleEntityNotFound(_0x158641,null))['then'](saveUpdates(_0x46b1ac[_0x5a53('0x4e')],null))['then'](respondWithResult(_0x158641,null))[_0x5a53('0x47')](handleError(_0x158641,null));};exports[_0x5a53('0x58')]=function(_0x348210,_0x3502e9){var _0x18db84=_0x348210[_0x5a53('0x49')]['id'];var _0x571bb8=[];return db[_0x5a53('0x59')]['transaction'](function(_0x19c783){var _0x5a696f=_0x5a53('0x5a')+_0x18db84;return db[_0x5a53('0x59')][_0x5a53('0x38')](_0x5a696f,{'type':db[_0x5a53('0x5b')][_0x5a53('0x5c')][_0x5a53('0x5d')],'raw':!![],'transaction':_0x19c783})[_0x5a53('0x2c')](function(_0x2e0671){_0x571bb8=_[_0x5a53('0x31')](_0x2e0671,function(_0xb99eae){return Number(_0xb99eae[_0x5a53('0x5e')]);});})[_0x5a53('0x2c')](function(){var _0xf62047=_0x5a53('0x5f')+_0x18db84;return db[_0x5a53('0x59')][_0x5a53('0x38')](_0xf62047,{'type':db[_0x5a53('0x5b')][_0x5a53('0x5c')][_0x5a53('0x5d')],'raw':!![],'transaction':_0x19c783});})[_0x5a53('0x2c')](function(_0x42c055){var _0x57f0bd=_['map'](_0x42c055,function(_0x3b3736){return Number(_0x3b3736['VoiceQueueId']);});return db[_0x5a53('0x60')][_0x5a53('0x58')]({'where':{'UserId':{'$in':_0x571bb8},'VoiceQueueId':{'$in':_0x57f0bd}},'transaction':_0x19c783});})[_0x5a53('0x2c')](function(){var _0x5e1684='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x18db84;return db['sequelize'][_0x5a53('0x38')](_0x5e1684,{'type':db[_0x5a53('0x5b')][_0x5a53('0x5c')]['SELECT'],'raw':!![],'transaction':_0x19c783});})[_0x5a53('0x2c')](function(_0x2a1884){var _0x25fdd0=_[_0x5a53('0x31')](_0x2a1884,function(_0x2ec4e6){return Number(_0x2ec4e6[_0x5a53('0x61')]);});return db[_0x5a53('0x62')][_0x5a53('0x58')]({'where':{'UserId':{'$in':_0x571bb8},'MailQueueId':{'$in':_0x25fdd0}},'transaction':_0x19c783});})[_0x5a53('0x2c')](function(){var _0x1fb878=_0x5a53('0x63')+_0x18db84;return db[_0x5a53('0x59')][_0x5a53('0x38')](_0x1fb878,{'type':db[_0x5a53('0x5b')][_0x5a53('0x5c')][_0x5a53('0x5d')],'raw':!![],'transaction':_0x19c783});})[_0x5a53('0x2c')](function(_0x40df1c){var _0x4c180f=_[_0x5a53('0x31')](_0x40df1c,function(_0x43f3e3){return Number(_0x43f3e3[_0x5a53('0x64')]);});return db[_0x5a53('0x65')][_0x5a53('0x58')]({'where':{'UserId':{'$in':_0x571bb8},'SmsQueueId':{'$in':_0x4c180f}},'transaction':_0x19c783});})['then'](function(){var _0x292a17=_0x5a53('0x66')+_0x18db84;return db[_0x5a53('0x59')][_0x5a53('0x38')](_0x292a17,{'type':db[_0x5a53('0x5b')][_0x5a53('0x5c')][_0x5a53('0x5d')],'raw':!![],'transaction':_0x19c783});})[_0x5a53('0x2c')](function(_0x4ce19e){var _0x608691=_['map'](_0x4ce19e,function(_0x26efc3){return Number(_0x26efc3[_0x5a53('0x67')]);});return db[_0x5a53('0x68')]['destroy']({'where':{'UserId':{'$in':_0x571bb8},'ChatQueueId':{'$in':_0x608691}},'transaction':_0x19c783});})['then'](function(){var _0x2770a6='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x18db84;return db[_0x5a53('0x59')]['query'](_0x2770a6,{'type':db[_0x5a53('0x5b')][_0x5a53('0x5c')][_0x5a53('0x5d')],'raw':!![],'transaction':_0x19c783});})[_0x5a53('0x2c')](function(_0x1a971d){var _0x47a42b=_['map'](_0x1a971d,function(_0x14e116){return Number(_0x14e116[_0x5a53('0x69')]);});return db[_0x5a53('0x6a')][_0x5a53('0x58')]({'where':{'UserId':{'$in':_0x571bb8},'FaxQueueId':{'$in':_0x47a42b}},'transaction':_0x19c783});})[_0x5a53('0x2c')](function(){var _0x4fe40e='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x18db84;return db['sequelize'][_0x5a53('0x38')](_0x4fe40e,{'type':db[_0x5a53('0x5b')]['QueryTypes'][_0x5a53('0x5d')],'raw':!![],'transaction':_0x19c783});})[_0x5a53('0x2c')](function(_0x467b49){var _0x29adab=_['map'](_0x467b49,function(_0x2f3d32){return Number(_0x2f3d32[_0x5a53('0x6b')]);});return db[_0x5a53('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x571bb8},'OpenchannelQueueId':{'$in':_0x29adab}},'transaction':_0x19c783});})[_0x5a53('0x2c')](function(){var _0x2a38bd=_0x5a53('0x6d')+_0x18db84;return db['sequelize']['query'](_0x2a38bd,{'type':db[_0x5a53('0x5b')][_0x5a53('0x5c')]['SELECT'],'raw':!![],'transaction':_0x19c783});})['then'](function(_0x1ba383){var _0x105b78=_[_0x5a53('0x31')](_0x1ba383,function(_0x15e1a2){return Number(_0x15e1a2['WhatsappQueueId']);});return db[_0x5a53('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x571bb8},'WhatsappQueueId':{'$in':_0x105b78}},'transaction':_0x19c783});})['then'](function(){return db[_0x5a53('0x6f')][_0x5a53('0x57')]({'where':{'TeamId':_0x18db84}});})[_0x5a53('0x2c')](function(_0x2cbd31){if(_0x2cbd31===null){return;}return db[_0x5a53('0x70')][_0x5a53('0x58')]({'where':{'UserId':{'$in':_0x571bb8},'VoicePrefixId':_0x2cbd31[_0x5a53('0x71')]},'transaction':_0x19c783});})[_0x5a53('0x2c')](function(){return db['Team']['destroy']({'where':{'id':_0x18db84},'cascade':!![],'transaction':_0x19c783});})[_0x5a53('0x2c')](function(_0x1ae1bf){if(_0x1ae1bf===0x0){_0x3502e9[_0x5a53('0x20')](0x194);}else{return db[_0x5a53('0x72')][_0x5a53('0x58')]({'where':{'type':_0x5a53('0x73'),'resourceId':_0x18db84},'cascade':!![],'transaction':_0x19c783})['then'](function(){_0x3502e9[_0x5a53('0x21')](0xcc)[_0x5a53('0x74')]();});}})[_0x5a53('0x47')](function(_0x22c46f){_0x3502e9[_0x5a53('0x21')](0x1f4)[_0x5a53('0x2f')](_0x22c46f);});});};exports['getQueues']=function(_0x239f05,_0x48721a,_0x11e80e){return db[_0x5a53('0x32')][_0x5a53('0x75')]({'where':{'id':_0x239f05['params']['id']}})[_0x5a53('0x2c')](handleEntityNotFound(_0x48721a,null))['then'](function(_0x57655a){if(!_0x239f05[_0x5a53('0x38')][_0x5a53('0x76')]||!utils[_0x5a53('0x77')](_0x239f05[_0x5a53('0x38')][_0x5a53('0x76')])){throw new db['Sequelize'][(_0x5a53('0x78'))](_0x5a53('0x79'));}var _0xae2bf={};var _0x4b1f42={};_0x4b1f42['model']=_[_0x5a53('0x36')](db[_[_0x5a53('0x7a')](_0x239f05['query'][_0x5a53('0x76')][_0x5a53('0x7b')]())+_0x5a53('0x7c')][_0x5a53('0x4a')]);_0x4b1f42[_0x5a53('0x38')]=_[_0x5a53('0x36')](_0x239f05[_0x5a53('0x38')]);_0x4b1f42[_0x5a53('0x37')]=_[_0x5a53('0x4b')](_0x4b1f42[_0x5a53('0x35')],_0x4b1f42['query']);_0xae2bf[_0x5a53('0x39')]=_[_0x5a53('0x4b')](_0x4b1f42[_0x5a53('0x35')],qs[_0x5a53('0x3a')](_0x239f05[_0x5a53('0x38')][_0x5a53('0x3a')]));_0xae2bf[_0x5a53('0x39')]=_0xae2bf[_0x5a53('0x39')][_0x5a53('0x4c')]?_0xae2bf[_0x5a53('0x39')]:_0x4b1f42['model'];_0xae2bf[_0x5a53('0x25')]=qs[_0x5a53('0x25')](_0x239f05[_0x5a53('0x38')][_0x5a53('0x25')]);_0xae2bf[_0x5a53('0x23')]=qs[_0x5a53('0x23')](_0x239f05['query'][_0x5a53('0x23')]);_0xae2bf[_0x5a53('0x7d')]=qs[_0x5a53('0x3c')](_0x239f05['query'][_0x5a53('0x3c')]);_0xae2bf[_0x5a53('0x3d')]=qs['filters'](_[_0x5a53('0x3e')](_0x239f05[_0x5a53('0x38')],_0x4b1f42[_0x5a53('0x37')]));_0xae2bf=_[_0x5a53('0x40')]({},_0xae2bf,_0x239f05[_0x5a53('0x43')]);return _0x57655a[_0x5a53('0x50')+_[_0x5a53('0x7a')](_0x239f05[_0x5a53('0x38')][_0x5a53('0x76')][_0x5a53('0x7b')]())+_0x5a53('0x7e')](_0xae2bf);})['then'](respondWithResult(_0x48721a,null))[_0x5a53('0x47')](handleError(_0x48721a,null));};exports['addQueues']=function(_0xb59b37,_0x5ed45b,_0x35702c){return db[_0x5a53('0x32')][_0x5a53('0x75')]({'where':{'id':_0xb59b37[_0x5a53('0x49')]['id']}})['then'](function(_0x447e98){if(_0x447e98){if(!_0xb59b37[_0x5a53('0x4e')]['channel']||!utils[_0x5a53('0x77')](_0xb59b37[_0x5a53('0x4e')][_0x5a53('0x76')])){throw new db[(_0x5a53('0x5b'))][(_0x5a53('0x78'))]('Unknown\x20channel');}return _0x447e98[_0x5a53('0x7f')+_[_0x5a53('0x7a')](_0xb59b37[_0x5a53('0x4e')][_0x5a53('0x76')]['toLowerCase']())+_0x5a53('0x7e')](_0xb59b37['body'][_0x5a53('0x80')]);}return null;})[_0x5a53('0x2c')](handleEntityNotFound(_0x5ed45b,null))[_0x5a53('0x2c')](respondWithStatusCode(_0x5ed45b,null))['catch'](handleError(_0x5ed45b,null));};exports[_0x5a53('0x81')]=function(_0x11bd6f,_0x4731fa,_0x11ac61){return db['Team']['findOne']({'where':{'id':_0x11bd6f[_0x5a53('0x49')]['id']}})[_0x5a53('0x2c')](function(_0x3ba47a){if(_0x3ba47a){if(!_0x11bd6f[_0x5a53('0x38')]['channel']||!utils[_0x5a53('0x77')](_0x11bd6f[_0x5a53('0x38')]['channel'])){throw new db[(_0x5a53('0x5b'))]['ValidationError'](_0x5a53('0x79'));}return _0x3ba47a[_0x5a53('0x82')+_[_0x5a53('0x7a')](_0x11bd6f[_0x5a53('0x38')][_0x5a53('0x76')][_0x5a53('0x7b')]())+'Queues'](_0x11bd6f[_0x5a53('0x38')][_0x5a53('0x80')]);}return null;})[_0x5a53('0x2c')](handleEntityNotFound(_0x4731fa,null))['then'](respondWithStatusCode(_0x4731fa,null))['catch'](handleError(_0x4731fa,null));};exports['addAgents']=function(_0x1798ee,_0x2ae351){var _0x471ef2=_[_0x5a53('0x83')](_0x1798ee[_0x5a53('0x4e')][_0x5a53('0x80')])?_0x1798ee[_0x5a53('0x4e')][_0x5a53('0x80')]:[_0x1798ee[_0x5a53('0x4e')]['ids']];var _0x25742a=_0x1798ee['params']['id'];return db[_0x5a53('0x32')][_0x5a53('0x57')]({'where':{'id':_0x25742a}})[_0x5a53('0x2c')](handleEntityNotFound(_0x2ae351,null))[_0x5a53('0x2c')](function(_0x577311){if(_0x577311){var _0x1fdbd3=[_0x5a53('0x84'),_0x5a53('0x85'),'Mail',_0x5a53('0x86'),_0x5a53('0x87'),'Openchannel',_0x5a53('0x88')];return db[_0x5a53('0x59')][_0x5a53('0x89')](function(_0x142ca1){var _0x892146=_[_0x5a53('0x31')](_0x1fdbd3,function(_0x2ad56d){var _0x362e2b={'attributes':['id',_0x5a53('0x2e')]};if(_0x2ad56d==='Voice'){_0x362e2b[_0x5a53('0x8a')]={'attributes':['penalty']};}return _0x577311[_0x5a53('0x50')+_0x2ad56d+'Queues'](_0x362e2b)['then'](function(_0x171c6d){var _0x4113de=_[_0x5a53('0x31')](_0x171c6d,function(_0x251ed8){var _0x571c11=_[_0x5a53('0x31')](_0x471ef2,function(_0x302180){var _0x37f5b7={'where':{'UserId':_0x302180,[_0x2ad56d+_0x5a53('0x8b')]:_0x251ed8['id']},'transaction':_0x142ca1};if(_0x2ad56d===_0x5a53('0x84')){_0x37f5b7[_0x5a53('0x1b')]={'penalty':_0x251ed8[_0x5a53('0x8c')][_0x5a53('0x8d')]};}return db[_0x5a53('0x8e')+_0x2ad56d+_0x5a53('0x7c')][_0x5a53('0x8f')](_0x37f5b7)[_0x5a53('0x2c')](function(){socket[_0x5a53('0x90')](_0x5a53('0x4f')+_0x2ad56d+_0x5a53('0x91'),{'UserId':_0x302180,[_0x2ad56d+_0x5a53('0x8b')]:_0x251ed8['id']});if(_0x2ad56d!==_0x5a53('0x84')){return;}return db[_0x5a53('0x8e')][_0x5a53('0x45')]({'where':{'id':_0x471ef2,'online':0x1},'attributes':['id',_0x5a53('0x2e'),_0x5a53('0x92'),_0x5a53('0x93'),_0x5a53('0x94')],'raw':!![]})[_0x5a53('0x2c')](function(_0x381a34){var _0x877a2e=_['map'](_0x381a34,function(_0x2ee778){return db[_0x5a53('0x95')][_0x5a53('0x96')]({'membername':_0x2ee778[_0x5a53('0x2e')],'UserId':_0x2ee778['id'],'queue_name':_0x251ed8[_0x5a53('0x2e')],'VoiceQueueId':_0x251ed8['id'],'interface':_[_0x5a53('0x97')](_0x2ee778['interface'])?util['format']('SIP/%s',_0x2ee778[_0x5a53('0x2e')]):_0x2ee778[_0x5a53('0x94')],'paused':_0x2ee778[_0x5a53('0x93')]||![],'penalty':_0x251ed8[_0x5a53('0x8c')]['penalty']},{'transaction':_0x142ca1});});return Promise[_0x5a53('0x98')](_0x877a2e);});});});return Promise[_0x5a53('0x98')](_0x571c11);});return Promise['all'](_0x4113de);})[_0x5a53('0x2c')](function(){return db[_0x5a53('0x6f')]['findOne']({'where':{'teamId':_0x25742a}})[_0x5a53('0x2c')](function(_0x541841){if(_0x541841){var _0x54d638=_[_0x5a53('0x31')](_0x471ef2,function(_0x4b210f){db[_0x5a53('0x70')]['upsert']({'UserId':_0x4b210f,'VoicePrefixId':_0x541841['VoicePrefixId']});});return Promise[_0x5a53('0x98')](_0x54d638);}});});});return Promise['all'](_0x892146)[_0x5a53('0x2c')](function(){return _0x577311[_0x5a53('0x99')](_0x471ef2,{'transaction':_0x142ca1})[_0x5a53('0x9a')](function(_0x29b126){return _0x29b126;});});});}})[_0x5a53('0x2c')](respondWithResult(_0x2ae351,null))[_0x5a53('0x47')](handleError(_0x2ae351,null));};exports[_0x5a53('0x9b')]=function(_0x2a9bf8,_0x53a5f8){var _0x2edbdb=_[_0x5a53('0x83')](_0x2a9bf8[_0x5a53('0x38')][_0x5a53('0x80')])?_0x2a9bf8[_0x5a53('0x38')][_0x5a53('0x80')]:[_0x2a9bf8[_0x5a53('0x38')]['ids']];var _0x388720=_0x2a9bf8['params']['id'];return db[_0x5a53('0x32')][_0x5a53('0x57')]({'where':{'id':_0x388720}})['then'](handleEntityNotFound(_0x53a5f8,null))[_0x5a53('0x2c')](function(_0x2fcef5){if(_0x2fcef5){var _0x50cbdb=[_0x5a53('0x84'),_0x5a53('0x85'),_0x5a53('0x9c'),'Sms','Fax',_0x5a53('0x9d'),'Whatsapp'];return db[_0x5a53('0x59')][_0x5a53('0x89')](function(_0x456ea4){var _0x33e7ca=_['map'](_0x50cbdb,function(_0x3b4d0b){var _0x125eaa={'attributes':['id',_0x5a53('0x2e')]};return _0x2fcef5[_0x5a53('0x50')+_0x3b4d0b+_0x5a53('0x7e')](_0x125eaa)[_0x5a53('0x2c')](function(_0x392e37){var _0x28bea3=_[_0x5a53('0x31')](_0x392e37,function(_0x313ff3){return _0x313ff3['removeAgents'](_0x2edbdb,{'transaction':_0x456ea4})[_0x5a53('0x2c')](function(){var _0xd695b1=_[_0x5a53('0x31')](_0x2edbdb,function(_0x90911a){socket['emit'](_0x5a53('0x4f')+_0x3b4d0b+_0x5a53('0x9e'),{'UserId':Number(_0x90911a),[_0x3b4d0b+_0x5a53('0x8b')]:_0x313ff3['id']});if(_0x3b4d0b!==_0x5a53('0x84')){return;}return db[_0x5a53('0x95')]['destroy']({'where':{'VoiceQueueId':_0x313ff3['id'],'UserId':_0x90911a},'transaction':_0x456ea4});});return Promise[_0x5a53('0x98')](_0xd695b1);});});return Promise[_0x5a53('0x98')](_0x28bea3);});});return Promise[_0x5a53('0x98')](_0x33e7ca)[_0x5a53('0x2c')](function(){return _0x2fcef5[_0x5a53('0x9b')](_0x2edbdb,{'transaction':_0x456ea4});})[_0x5a53('0x2c')](function(){return db[_0x5a53('0x6f')][_0x5a53('0x75')]({'where':{'teamId':_0x388720}})[_0x5a53('0x2c')](function(_0x4707ed){if(_0x4707ed){var _0x4f54bb=_[_0x5a53('0x31')](_0x2edbdb,function(_0x1a34cf){db[_0x5a53('0x70')][_0x5a53('0x58')]({'where':{'UserId':_0x1a34cf,'VoicePrefixId':_0x4707ed[_0x5a53('0x71')]}});});return Promise[_0x5a53('0x98')](_0x4f54bb);}});});});}})['then'](respondWithStatusCode(_0x53a5f8,null))[_0x5a53('0x47')](handleError(_0x53a5f8,null));};exports['getAgents']=function(_0x442539,_0xe9973a,_0x2d92aa){var _0x39c519={};var _0x4227b2={};var _0x2549bd;var _0x18feb9;return db[_0x5a53('0x32')][_0x5a53('0x75')]({'where':{'id':_0x442539[_0x5a53('0x49')]['id']}})[_0x5a53('0x2c')](handleEntityNotFound(_0xe9973a,null))[_0x5a53('0x2c')](function(_0x58f2b8){if(_0x58f2b8){_0x2549bd=_0x58f2b8;_0x4227b2['model']=_[_0x5a53('0x36')](db['User'][_0x5a53('0x4a')]);_0x4227b2[_0x5a53('0x38')]=_['keys'](_0x442539[_0x5a53('0x38')]);_0x4227b2[_0x5a53('0x37')]=_[_0x5a53('0x4b')](_0x4227b2[_0x5a53('0x35')],_0x4227b2[_0x5a53('0x38')]);_0x39c519[_0x5a53('0x39')]=_['intersection'](_0x4227b2[_0x5a53('0x35')],qs[_0x5a53('0x3a')](_0x442539[_0x5a53('0x38')][_0x5a53('0x3a')]));_0x39c519[_0x5a53('0x39')]=_0x39c519[_0x5a53('0x39')][_0x5a53('0x4c')]?_0x39c519[_0x5a53('0x39')]:_0x4227b2[_0x5a53('0x35')];_0x39c519[_0x5a53('0x7d')]=qs[_0x5a53('0x3c')](_0x442539['query']['sort']);_0x39c519[_0x5a53('0x3d')]=qs['filters'](_[_0x5a53('0x3e')](_0x442539[_0x5a53('0x38')],_0x4227b2[_0x5a53('0x37')]));if(_0x442539[_0x5a53('0x38')][_0x5a53('0x3f')]){_0x39c519['where']=_['merge'](_0x39c519[_0x5a53('0x3d')],{'$or':_[_0x5a53('0x31')](_0x39c519[_0x5a53('0x39')],function(_0x2a9676){var _0x4c678c={};_0x4c678c[_0x2a9676]={'$like':'%'+_0x442539['query'][_0x5a53('0x3f')]+'%'};return _0x4c678c;})});}_0x39c519=_['merge']({},_0x39c519,_0x442539['options']);return _0x2549bd['getAgents'](_0x39c519);}})[_0x5a53('0x2c')](function(_0x52ac2f){if(_0x52ac2f){_0x18feb9=_0x52ac2f['length'];if(!_0x442539[_0x5a53('0x38')]['hasOwnProperty'](_0x5a53('0x3b'))){_0x39c519[_0x5a53('0x25')]=qs[_0x5a53('0x25')](_0x442539[_0x5a53('0x38')][_0x5a53('0x25')]);_0x39c519[_0x5a53('0x23')]=qs['offset'](_0x442539[_0x5a53('0x38')][_0x5a53('0x23')]);}return _0x2549bd[_0x5a53('0x9f')](_0x39c519);}})[_0x5a53('0x2c')](function(_0x1343e5){if(_0x1343e5){return _0x1343e5?{'count':_0x18feb9,'rows':_0x1343e5}:null;}})[_0x5a53('0x2c')](respondWithResult(_0xe9973a,null))['catch'](handleError(_0xe9973a,null));}; \ No newline at end of file +var _0x1309=['send','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','ValidationError','add','Queues','ids','removeQueues','findOne','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','voicePause','interface','upsert','isNil','SIP/%s','all','UserVoicePrefix','VoicePrefixId','spread','removeAgents','Queue:remove','UserVoiceQueueRt','getAgents','User','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','Teams'];(function(_0x41bb8f,_0x5ec058){var _0x58ebb2=function(_0x5d40c9){while(--_0x5d40c9){_0x41bb8f['push'](_0x41bb8f['shift']());}};_0x58ebb2(++_0x5ec058);}(_0x1309,0xcb));var _0x9130=function(_0x1f45e1,_0x42b340){_0x1f45e1=_0x1f45e1-0x0;var _0x2f5873=_0x1309[_0x1f45e1];return _0x2f5873;};'use strict';var emlformat=require(_0x9130('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9130('0x1'));var jsonpatch=require(_0x9130('0x2'));var rp=require(_0x9130('0x3'));var moment=require('moment');var BPromise=require(_0x9130('0x4'));var Mustache=require('mustache');var util=require(_0x9130('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9130('0x6'));var _=require('lodash');var squel=require(_0x9130('0x7'));var crypto=require(_0x9130('0x8'));var jsforce=require(_0x9130('0x9'));var deskjs=require(_0x9130('0xa'));var toCsv=require(_0x9130('0xb'));var querystring=require(_0x9130('0xc'));var Papa=require(_0x9130('0xd'));var Redis=require(_0x9130('0xe'));var authService=require(_0x9130('0xf'));var qs=require(_0x9130('0x10'));var as=require(_0x9130('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9130('0x12'))(_0x9130('0x13'));var utils=require('../../config/utils');var config=require(_0x9130('0x14'));var licenseUtil=require(_0x9130('0x15'));var db=require(_0x9130('0x16'))['db'];config[_0x9130('0x17')]=_[_0x9130('0x18')](config['redis'],{'host':_0x9130('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9130('0x1a'))[_0x9130('0x1b')](socket);function respondWithStatusCode(_0xda1eac,_0x2aa761){_0x2aa761=_0x2aa761||0xcc;return function(_0x322e96){if(_0x322e96){return _0xda1eac[_0x9130('0x1c')](_0x2aa761);}return _0xda1eac[_0x9130('0x1d')](_0x2aa761)[_0x9130('0x1e')]();};}function respondWithResult(_0x2d8fad,_0x2412cf){_0x2412cf=_0x2412cf||0xc8;return function(_0x12632f){if(_0x12632f){return _0x2d8fad['status'](_0x2412cf)[_0x9130('0x1f')](_0x12632f);}};}function respondWithFilteredResult(_0x1fa567,_0x31d9cb){return function(_0x556131){if(_0x556131){var _0x3d1b57=typeof _0x31d9cb[_0x9130('0x20')]===_0x9130('0x21')&&typeof _0x31d9cb[_0x9130('0x22')]===_0x9130('0x21');var _0xc1ca8c=_0x556131[_0x9130('0x23')];var _0x1ad671=_0x3d1b57?0x0:_0x31d9cb[_0x9130('0x20')];var _0x271444=_0x3d1b57?_0x556131[_0x9130('0x23')]:_0x31d9cb[_0x9130('0x20')]+_0x31d9cb[_0x9130('0x22')];var _0x49b413;if(_0x271444>=_0xc1ca8c){_0x271444=_0xc1ca8c;_0x49b413=0xc8;}else{_0x49b413=0xce;}_0x1fa567[_0x9130('0x1d')](_0x49b413);return _0x1fa567[_0x9130('0x24')](_0x9130('0x25'),_0x1ad671+'-'+_0x271444+'/'+_0xc1ca8c)[_0x9130('0x1f')](_0x556131);}return null;};}function patchUpdates(_0x179d96){return function(_0x8477f8){try{jsonpatch[_0x9130('0x26')](_0x8477f8,_0x179d96,!![]);}catch(_0x46d9f7){return BPromise[_0x9130('0x27')](_0x46d9f7);}return _0x8477f8[_0x9130('0x28')]();};}function saveUpdates(_0x529857,_0x4c9f9f){return function(_0x9bd908){if(_0x9bd908){return _0x9bd908[_0x9130('0x29')](_0x529857)[_0x9130('0x2a')](function(_0x374f3a){return _0x374f3a;});}return null;};}function handleEntityNotFound(_0x5e4cb4,_0x21c99){return function(_0x5c1c9b){if(!_0x5c1c9b){_0x5e4cb4[_0x9130('0x1c')](0x194);}return _0x5c1c9b;};}function handleError(_0x3f9101,_0x4cb289){_0x4cb289=_0x4cb289||0x1f4;return function(_0xe9941b){logger['error'](_0xe9941b[_0x9130('0x2b')]);if(_0xe9941b[_0x9130('0x2c')]){delete _0xe9941b[_0x9130('0x2c')];}_0x3f9101[_0x9130('0x1d')](_0x4cb289)['send'](_0xe9941b);};}exports[_0x9130('0x2d')]=function(_0x3405ff,_0x512dd7){var _0x39c582={},_0x312c18={},_0x625e7a={'count':0x0,'rows':[]};var _0x7b7404=_[_0x9130('0x2e')](db[_0x9130('0x2f')][_0x9130('0x30')],function(_0x3cfc36){return{'name':_0x3cfc36[_0x9130('0x31')],'type':_0x3cfc36[_0x9130('0x32')][_0x9130('0x33')]};});_0x312c18[_0x9130('0x34')]=_[_0x9130('0x2e')](_0x7b7404,_0x9130('0x2c'));_0x312c18[_0x9130('0x35')]=_[_0x9130('0x36')](_0x3405ff['query']);_0x312c18[_0x9130('0x37')]=_[_0x9130('0x38')](_0x312c18[_0x9130('0x34')],_0x312c18['query']);_0x39c582[_0x9130('0x39')]=_['intersection'](_0x312c18[_0x9130('0x34')],qs[_0x9130('0x3a')](_0x3405ff['query']['fields']));_0x39c582[_0x9130('0x39')]=_0x39c582[_0x9130('0x39')][_0x9130('0x3b')]?_0x39c582['attributes']:_0x312c18['model'];if(!_0x3405ff[_0x9130('0x35')][_0x9130('0x3c')]('nolimit')){_0x39c582[_0x9130('0x22')]=qs[_0x9130('0x22')](_0x3405ff[_0x9130('0x35')][_0x9130('0x22')]);_0x39c582[_0x9130('0x20')]=qs[_0x9130('0x20')](_0x3405ff['query'][_0x9130('0x20')]);}_0x39c582[_0x9130('0x3d')]=qs[_0x9130('0x3e')](_0x3405ff[_0x9130('0x35')][_0x9130('0x3e')]);_0x39c582[_0x9130('0x3f')]=qs[_0x9130('0x37')](_['pick'](_0x3405ff[_0x9130('0x35')],_0x312c18[_0x9130('0x37')]),_0x7b7404);if(_0x3405ff[_0x9130('0x35')][_0x9130('0x40')]){_0x39c582[_0x9130('0x3f')]=_[_0x9130('0x41')](_0x39c582['where'],{'$or':_[_0x9130('0x2e')](_0x7b7404,function(_0x58f155){if(_0x58f155[_0x9130('0x32')]!==_0x9130('0x42')){var _0x30105c={};_0x30105c[_0x58f155[_0x9130('0x2c')]]={'$like':'%'+_0x3405ff['query'][_0x9130('0x40')]+'%'};return _0x30105c;}})});}_0x39c582=_[_0x9130('0x41')]({},_0x39c582,_0x3405ff[_0x9130('0x43')]);var _0x513f85={'where':_0x39c582[_0x9130('0x3f')]};return db[_0x9130('0x2f')][_0x9130('0x23')](_0x513f85)['then'](function(_0x1b5aa7){_0x625e7a[_0x9130('0x23')]=_0x1b5aa7;if(_0x3405ff['query'][_0x9130('0x44')]){_0x39c582[_0x9130('0x45')]=[{'all':!![]}];}return db['Team'][_0x9130('0x46')](_0x39c582);})[_0x9130('0x2a')](function(_0x1f5182){_0x625e7a[_0x9130('0x47')]=_0x1f5182;return _0x625e7a;})[_0x9130('0x2a')](respondWithFilteredResult(_0x512dd7,_0x39c582))['catch'](handleError(_0x512dd7,null));};exports[_0x9130('0x48')]=function(_0xefb635,_0x471c47){var _0xa10b72={'raw':![],'where':{'id':_0xefb635[_0x9130('0x49')]['id']}},_0x585e76={};_0x585e76[_0x9130('0x34')]=_['keys'](db[_0x9130('0x2f')][_0x9130('0x30')]);_0x585e76[_0x9130('0x35')]=_[_0x9130('0x36')](_0xefb635[_0x9130('0x35')]);_0x585e76[_0x9130('0x37')]=_[_0x9130('0x38')](_0x585e76[_0x9130('0x34')],_0x585e76[_0x9130('0x35')]);_0xa10b72[_0x9130('0x39')]=_[_0x9130('0x38')](_0x585e76[_0x9130('0x34')],qs[_0x9130('0x3a')](_0xefb635[_0x9130('0x35')][_0x9130('0x3a')]));_0xa10b72[_0x9130('0x39')]=_0xa10b72[_0x9130('0x39')]['length']?_0xa10b72[_0x9130('0x39')]:_0x585e76['model'];if(_0xefb635[_0x9130('0x35')][_0x9130('0x44')]){_0xa10b72['include']=[{'all':!![]}];}_0xa10b72=_[_0x9130('0x41')]({},_0xa10b72,_0xefb635[_0x9130('0x43')]);return db[_0x9130('0x2f')][_0x9130('0x4a')](_0xa10b72)[_0x9130('0x2a')](handleEntityNotFound(_0x471c47,null))[_0x9130('0x2a')](respondWithResult(_0x471c47,null))[_0x9130('0x4b')](handleError(_0x471c47,null));};exports[_0x9130('0x4c')]=function(_0x35223e,_0x341713){return db[_0x9130('0x2f')]['create'](_0x35223e[_0x9130('0x4d')],{})['then'](function(_0x28f771){var _0x1304eb=_0x35223e['user']['get']({'plain':!![]});if(!_0x1304eb)throw new Error(_0x9130('0x4e'));if(_0x1304eb['role']===_0x9130('0x4f')){var _0x4e3388=_0x28f771[_0x9130('0x50')]({'plain':!![]});var _0x344e39='Teams';return db[_0x9130('0x51')][_0x9130('0x4a')]({'where':{'name':_0x344e39,'userProfileId':_0x1304eb['userProfileId']},'raw':!![]})[_0x9130('0x2a')](function(_0x36c97c){if(_0x36c97c&&_0x36c97c[_0x9130('0x52')]===0x0){return db[_0x9130('0x53')][_0x9130('0x4c')]({'name':_0x4e3388['name'],'resourceId':_0x4e3388['id'],'type':_0x36c97c['name'],'sectionId':_0x36c97c['id']},{})['then'](function(){return _0x28f771;});}else{return _0x28f771;}})[_0x9130('0x4b')](function(_0x3459ff){logger[_0x9130('0x54')](_0x9130('0x55'),_0x3459ff);throw _0x3459ff;});}return _0x28f771;})[_0x9130('0x2a')](respondWithResult(_0x341713,0xc9))[_0x9130('0x4b')](handleError(_0x341713,null));};exports[_0x9130('0x29')]=function(_0x4c33ad,_0x1d3432){if(_0x4c33ad['body']['id']){delete _0x4c33ad[_0x9130('0x4d')]['id'];}return db[_0x9130('0x2f')][_0x9130('0x4a')]({'where':{'id':_0x4c33ad[_0x9130('0x49')]['id']}})[_0x9130('0x2a')](handleEntityNotFound(_0x1d3432,null))[_0x9130('0x2a')](saveUpdates(_0x4c33ad[_0x9130('0x4d')],null))[_0x9130('0x2a')](respondWithResult(_0x1d3432,null))[_0x9130('0x4b')](handleError(_0x1d3432,null));};exports[_0x9130('0x56')]=function(_0x301312,_0x29822e){var _0x2ae1ce=_0x301312[_0x9130('0x49')]['id'];var _0x217a66=[];return db[_0x9130('0x57')][_0x9130('0x58')](function(_0x58ba3e){var _0x479a87=_0x9130('0x59')+_0x2ae1ce;return db[_0x9130('0x57')][_0x9130('0x35')](_0x479a87,{'type':db[_0x9130('0x5a')][_0x9130('0x5b')][_0x9130('0x5c')],'raw':!![],'transaction':_0x58ba3e})['then'](function(_0x5ce392){_0x217a66=_[_0x9130('0x2e')](_0x5ce392,function(_0x1899c2){return Number(_0x1899c2[_0x9130('0x5d')]);});})[_0x9130('0x2a')](function(){var _0x53b7c=_0x9130('0x5e')+_0x2ae1ce;return db[_0x9130('0x57')]['query'](_0x53b7c,{'type':db['Sequelize']['QueryTypes'][_0x9130('0x5c')],'raw':!![],'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(_0x19f43b){var _0x518cb5=_['map'](_0x19f43b,function(_0x17d253){return Number(_0x17d253[_0x9130('0x5f')]);});return db['UserVoiceQueue'][_0x9130('0x56')]({'where':{'UserId':{'$in':_0x217a66},'VoiceQueueId':{'$in':_0x518cb5}},'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(){var _0x4460b8=_0x9130('0x60')+_0x2ae1ce;return db[_0x9130('0x57')]['query'](_0x4460b8,{'type':db[_0x9130('0x5a')][_0x9130('0x5b')][_0x9130('0x5c')],'raw':!![],'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(_0x2915a4){var _0x294680=_[_0x9130('0x2e')](_0x2915a4,function(_0x29ba69){return Number(_0x29ba69[_0x9130('0x61')]);});return db[_0x9130('0x62')]['destroy']({'where':{'UserId':{'$in':_0x217a66},'MailQueueId':{'$in':_0x294680}},'transaction':_0x58ba3e});})['then'](function(){var _0x556eb7='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2ae1ce;return db['sequelize']['query'](_0x556eb7,{'type':db[_0x9130('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x58ba3e});})['then'](function(_0x35b6e9){var _0x396ad3=_[_0x9130('0x2e')](_0x35b6e9,function(_0x252fc8){return Number(_0x252fc8[_0x9130('0x63')]);});return db[_0x9130('0x64')]['destroy']({'where':{'UserId':{'$in':_0x217a66},'SmsQueueId':{'$in':_0x396ad3}},'transaction':_0x58ba3e});})['then'](function(){var _0x486028='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2ae1ce;return db['sequelize'][_0x9130('0x35')](_0x486028,{'type':db[_0x9130('0x5a')][_0x9130('0x5b')][_0x9130('0x5c')],'raw':!![],'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(_0x16cd12){var _0x1027e7=_[_0x9130('0x2e')](_0x16cd12,function(_0x203637){return Number(_0x203637[_0x9130('0x65')]);});return db[_0x9130('0x66')]['destroy']({'where':{'UserId':{'$in':_0x217a66},'ChatQueueId':{'$in':_0x1027e7}},'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(){var _0x3082fe=_0x9130('0x67')+_0x2ae1ce;return db['sequelize'][_0x9130('0x35')](_0x3082fe,{'type':db[_0x9130('0x5a')][_0x9130('0x5b')][_0x9130('0x5c')],'raw':!![],'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(_0x31bdbc){var _0x57bf66=_['map'](_0x31bdbc,function(_0x9552e2){return Number(_0x9552e2['FaxQueueId']);});return db[_0x9130('0x68')][_0x9130('0x56')]({'where':{'UserId':{'$in':_0x217a66},'FaxQueueId':{'$in':_0x57bf66}},'transaction':_0x58ba3e});})['then'](function(){var _0x400c39=_0x9130('0x69')+_0x2ae1ce;return db[_0x9130('0x57')][_0x9130('0x35')](_0x400c39,{'type':db['Sequelize'][_0x9130('0x5b')][_0x9130('0x5c')],'raw':!![],'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(_0x4cb4af){var _0x393d68=_['map'](_0x4cb4af,function(_0x2a7082){return Number(_0x2a7082[_0x9130('0x6a')]);});return db[_0x9130('0x6b')][_0x9130('0x56')]({'where':{'UserId':{'$in':_0x217a66},'OpenchannelQueueId':{'$in':_0x393d68}},'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(){var _0x5c1b93=_0x9130('0x6c')+_0x2ae1ce;return db[_0x9130('0x57')]['query'](_0x5c1b93,{'type':db[_0x9130('0x5a')][_0x9130('0x5b')][_0x9130('0x5c')],'raw':!![],'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(_0x3906ec){var _0xb046a=_[_0x9130('0x2e')](_0x3906ec,function(_0x1e5e53){return Number(_0x1e5e53[_0x9130('0x6d')]);});return db[_0x9130('0x6e')][_0x9130('0x56')]({'where':{'UserId':{'$in':_0x217a66},'WhatsappQueueId':{'$in':_0xb046a}},'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(){return db[_0x9130('0x6f')]['find']({'where':{'TeamId':_0x2ae1ce}});})[_0x9130('0x2a')](function(_0x362c50){if(_0x362c50===null){return;}return db['UserVoicePrefix'][_0x9130('0x56')]({'where':{'UserId':{'$in':_0x217a66},'VoicePrefixId':_0x362c50['VoicePrefixId']},'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(){return db[_0x9130('0x2f')]['destroy']({'where':{'id':_0x2ae1ce},'cascade':!![],'transaction':_0x58ba3e});})[_0x9130('0x2a')](function(_0x450556){if(_0x450556===0x0){_0x29822e['sendStatus'](0x194);}else{return db[_0x9130('0x53')][_0x9130('0x56')]({'where':{'type':_0x9130('0x70'),'resourceId':_0x2ae1ce},'cascade':!![],'transaction':_0x58ba3e})[_0x9130('0x2a')](function(){_0x29822e[_0x9130('0x1d')](0xcc)['end']();});}})['catch'](function(_0x4f8ff0){_0x29822e[_0x9130('0x1d')](0x1f4)[_0x9130('0x71')](_0x4f8ff0);});});};exports[_0x9130('0x72')]=function(_0xc0326d,_0x2aedd7,_0x1e9257){return db[_0x9130('0x2f')]['findOne']({'where':{'id':_0xc0326d[_0x9130('0x49')]['id']}})['then'](handleEntityNotFound(_0x2aedd7,null))['then'](function(_0x116158){if(!_0xc0326d[_0x9130('0x35')][_0x9130('0x73')]||!utils[_0x9130('0x74')](_0xc0326d[_0x9130('0x35')][_0x9130('0x73')])){throw new db[(_0x9130('0x5a'))]['ValidationError'](_0x9130('0x75'));}var _0xd03913={};var _0x333462={};_0x333462[_0x9130('0x34')]=_[_0x9130('0x36')](db[_[_0x9130('0x76')](_0xc0326d[_0x9130('0x35')]['channel'][_0x9130('0x77')]())+_0x9130('0x78')]['rawAttributes']);_0x333462[_0x9130('0x35')]=_[_0x9130('0x36')](_0xc0326d[_0x9130('0x35')]);_0x333462[_0x9130('0x37')]=_[_0x9130('0x38')](_0x333462[_0x9130('0x34')],_0x333462[_0x9130('0x35')]);_0xd03913[_0x9130('0x39')]=_[_0x9130('0x38')](_0x333462[_0x9130('0x34')],qs[_0x9130('0x3a')](_0xc0326d['query'][_0x9130('0x3a')]));_0xd03913['attributes']=_0xd03913[_0x9130('0x39')]['length']?_0xd03913['attributes']:_0x333462[_0x9130('0x34')];_0xd03913[_0x9130('0x22')]=qs[_0x9130('0x22')](_0xc0326d[_0x9130('0x35')][_0x9130('0x22')]);_0xd03913[_0x9130('0x20')]=qs['offset'](_0xc0326d['query'][_0x9130('0x20')]);_0xd03913[_0x9130('0x3d')]=qs[_0x9130('0x3e')](_0xc0326d[_0x9130('0x35')][_0x9130('0x3e')]);_0xd03913[_0x9130('0x3f')]=qs[_0x9130('0x37')](_[_0x9130('0x79')](_0xc0326d[_0x9130('0x35')],_0x333462[_0x9130('0x37')]));_0xd03913=_[_0x9130('0x41')]({},_0xd03913,_0xc0326d[_0x9130('0x43')]);return _0x116158[_0x9130('0x50')+_[_0x9130('0x76')](_0xc0326d['query'][_0x9130('0x73')][_0x9130('0x77')]())+'Queues'](_0xd03913);})[_0x9130('0x2a')](respondWithResult(_0x2aedd7,null))[_0x9130('0x4b')](handleError(_0x2aedd7,null));};exports['addQueues']=function(_0x557091,_0x1d1775,_0x26033a){return db[_0x9130('0x2f')]['findOne']({'where':{'id':_0x557091['params']['id']}})[_0x9130('0x2a')](function(_0x577249){if(_0x577249){if(!_0x557091['body']['channel']||!utils[_0x9130('0x74')](_0x557091[_0x9130('0x4d')][_0x9130('0x73')])){throw new db['Sequelize'][(_0x9130('0x7a'))](_0x9130('0x75'));}return _0x577249[_0x9130('0x7b')+_[_0x9130('0x76')](_0x557091['body'][_0x9130('0x73')][_0x9130('0x77')]())+_0x9130('0x7c')](_0x557091[_0x9130('0x4d')][_0x9130('0x7d')]);}return null;})[_0x9130('0x2a')](handleEntityNotFound(_0x1d1775,null))[_0x9130('0x2a')](respondWithStatusCode(_0x1d1775,null))[_0x9130('0x4b')](handleError(_0x1d1775,null));};exports[_0x9130('0x7e')]=function(_0x1460a5,_0x4aed65,_0xd7f827){return db['Team'][_0x9130('0x7f')]({'where':{'id':_0x1460a5[_0x9130('0x49')]['id']}})[_0x9130('0x2a')](function(_0x469776){if(_0x469776){if(!_0x1460a5['query'][_0x9130('0x73')]||!utils[_0x9130('0x74')](_0x1460a5[_0x9130('0x35')][_0x9130('0x73')])){throw new db[(_0x9130('0x5a'))]['ValidationError'](_0x9130('0x75'));}return _0x469776[_0x9130('0x80')+_[_0x9130('0x76')](_0x1460a5['query'][_0x9130('0x73')][_0x9130('0x77')]())+'Queues'](_0x1460a5[_0x9130('0x35')][_0x9130('0x7d')]);}return null;})[_0x9130('0x2a')](handleEntityNotFound(_0x4aed65,null))['then'](respondWithStatusCode(_0x4aed65,null))['catch'](handleError(_0x4aed65,null));};exports[_0x9130('0x81')]=function(_0x3e3738,_0x464aea){var _0x5f3b7a=_[_0x9130('0x82')](_0x3e3738[_0x9130('0x4d')][_0x9130('0x7d')])?_0x3e3738[_0x9130('0x4d')]['ids']:[_0x3e3738[_0x9130('0x4d')][_0x9130('0x7d')]];var _0x42dd66=_0x3e3738[_0x9130('0x49')]['id'];return db[_0x9130('0x2f')][_0x9130('0x4a')]({'where':{'id':_0x42dd66}})[_0x9130('0x2a')](handleEntityNotFound(_0x464aea,null))[_0x9130('0x2a')](function(_0xc1eb30){if(_0xc1eb30){var _0x150422=[_0x9130('0x83'),_0x9130('0x84'),_0x9130('0x85'),_0x9130('0x86'),_0x9130('0x87'),_0x9130('0x88'),'Whatsapp'];return db[_0x9130('0x57')]['transaction'](function(_0x2764b3){var _0x7bbad2=_[_0x9130('0x2e')](_0x150422,function(_0x3b0e30){var _0xadb0f={'attributes':['id',_0x9130('0x2c')]};if(_0x3b0e30===_0x9130('0x83')){_0xadb0f[_0x9130('0x89')]={'attributes':[_0x9130('0x8a')]};}return _0xc1eb30[_0x9130('0x50')+_0x3b0e30+_0x9130('0x7c')](_0xadb0f)['then'](function(_0x122f36){var _0x51b789=_[_0x9130('0x2e')](_0x122f36,function(_0x5600e3){var _0x20b8cf=_[_0x9130('0x2e')](_0x5f3b7a,function(_0x3a4f71){var _0x42d4fe={'where':{'UserId':_0x3a4f71,[_0x3b0e30+_0x9130('0x8b')]:_0x5600e3['id']},'transaction':_0x2764b3};if(_0x3b0e30===_0x9130('0x83')){_0x42d4fe[_0x9130('0x18')]={'penalty':_0x5600e3[_0x9130('0x8c')][_0x9130('0x8a')]};}return db['User'+_0x3b0e30+_0x9130('0x78')][_0x9130('0x8d')](_0x42d4fe)[_0x9130('0x2a')](function(){socket[_0x9130('0x8e')](_0x9130('0x4f')+_0x3b0e30+'Queue:save',{'UserId':_0x3a4f71,[_0x3b0e30+'QueueId']:_0x5600e3['id']});if(_0x3b0e30!==_0x9130('0x83')){return;}return db['User'][_0x9130('0x46')]({'where':{'id':_0x5f3b7a,'online':0x1},'attributes':['id',_0x9130('0x2c'),'online',_0x9130('0x8f'),_0x9130('0x90')],'raw':!![]})[_0x9130('0x2a')](function(_0x289690){var _0x11008c=_['map'](_0x289690,function(_0x1dbf97){return db['UserVoiceQueueRt'][_0x9130('0x91')]({'membername':_0x1dbf97['name'],'UserId':_0x1dbf97['id'],'queue_name':_0x5600e3[_0x9130('0x2c')],'VoiceQueueId':_0x5600e3['id'],'interface':_[_0x9130('0x92')](_0x1dbf97['interface'])?util['format'](_0x9130('0x93'),_0x1dbf97[_0x9130('0x2c')]):_0x1dbf97[_0x9130('0x90')],'paused':_0x1dbf97['voicePause']||![],'penalty':_0x5600e3[_0x9130('0x8c')]['penalty']},{'transaction':_0x2764b3});});return Promise[_0x9130('0x94')](_0x11008c);});});});return Promise[_0x9130('0x94')](_0x20b8cf);});return Promise[_0x9130('0x94')](_0x51b789);})[_0x9130('0x2a')](function(){return db[_0x9130('0x6f')][_0x9130('0x7f')]({'where':{'teamId':_0x42dd66}})[_0x9130('0x2a')](function(_0x5910e6){if(_0x5910e6){var _0x204a7d=_['map'](_0x5f3b7a,function(_0x2f7e0d){db[_0x9130('0x95')][_0x9130('0x91')]({'UserId':_0x2f7e0d,'VoicePrefixId':_0x5910e6[_0x9130('0x96')]});});return Promise[_0x9130('0x94')](_0x204a7d);}});});});return Promise[_0x9130('0x94')](_0x7bbad2)['then'](function(){return _0xc1eb30[_0x9130('0x81')](_0x5f3b7a,{'transaction':_0x2764b3})[_0x9130('0x97')](function(_0x5b9274){return _0x5b9274;});});});}})[_0x9130('0x2a')](respondWithResult(_0x464aea,null))[_0x9130('0x4b')](handleError(_0x464aea,null));};exports[_0x9130('0x98')]=function(_0x34b596,_0x3302d5){var _0x2fbb0f=_[_0x9130('0x82')](_0x34b596['query'][_0x9130('0x7d')])?_0x34b596[_0x9130('0x35')][_0x9130('0x7d')]:[_0x34b596['query']['ids']];var _0x33cf19=_0x34b596[_0x9130('0x49')]['id'];return db[_0x9130('0x2f')][_0x9130('0x4a')]({'where':{'id':_0x33cf19}})[_0x9130('0x2a')](handleEntityNotFound(_0x3302d5,null))['then'](function(_0x3c36ca){if(_0x3c36ca){var _0x4e557e=[_0x9130('0x83'),_0x9130('0x84'),'Mail',_0x9130('0x86'),_0x9130('0x87'),'Openchannel','Whatsapp'];return db[_0x9130('0x57')][_0x9130('0x58')](function(_0x11c44b){var _0x10f3f5=_[_0x9130('0x2e')](_0x4e557e,function(_0x238a72){var _0x16e1e6={'attributes':['id',_0x9130('0x2c')]};return _0x3c36ca[_0x9130('0x50')+_0x238a72+'Queues'](_0x16e1e6)[_0x9130('0x2a')](function(_0x2010d1){var _0x380710=_['map'](_0x2010d1,function(_0x4400fb){return _0x4400fb['removeAgents'](_0x2fbb0f,{'transaction':_0x11c44b})[_0x9130('0x2a')](function(){var _0x39e8cb=_['map'](_0x2fbb0f,function(_0xec3ec2){socket['emit'](_0x9130('0x4f')+_0x238a72+_0x9130('0x99'),{'UserId':Number(_0xec3ec2),[_0x238a72+_0x9130('0x8b')]:_0x4400fb['id']});if(_0x238a72!==_0x9130('0x83')){return;}return db[_0x9130('0x9a')][_0x9130('0x56')]({'where':{'VoiceQueueId':_0x4400fb['id'],'UserId':_0xec3ec2},'transaction':_0x11c44b});});return Promise[_0x9130('0x94')](_0x39e8cb);});});return Promise[_0x9130('0x94')](_0x380710);});});return Promise[_0x9130('0x94')](_0x10f3f5)[_0x9130('0x2a')](function(){return _0x3c36ca[_0x9130('0x98')](_0x2fbb0f,{'transaction':_0x11c44b});})[_0x9130('0x2a')](function(){return db[_0x9130('0x6f')][_0x9130('0x7f')]({'where':{'teamId':_0x33cf19}})['then'](function(_0x3bf2e8){if(_0x3bf2e8){var _0x2d0b3b=_[_0x9130('0x2e')](_0x2fbb0f,function(_0x48406a){db[_0x9130('0x95')][_0x9130('0x56')]({'where':{'UserId':_0x48406a,'VoicePrefixId':_0x3bf2e8['VoicePrefixId']}});});return Promise[_0x9130('0x94')](_0x2d0b3b);}});});});}})[_0x9130('0x2a')](respondWithStatusCode(_0x3302d5,null))[_0x9130('0x4b')](handleError(_0x3302d5,null));};exports[_0x9130('0x9b')]=function(_0x322fe3,_0x513f1f,_0x3dc39b){var _0x2a3b38={};var _0x4effed={};var _0x3bd6e3;var _0x8f3796;return db['Team']['findOne']({'where':{'id':_0x322fe3[_0x9130('0x49')]['id']}})[_0x9130('0x2a')](handleEntityNotFound(_0x513f1f,null))[_0x9130('0x2a')](function(_0x13c2aa){if(_0x13c2aa){_0x3bd6e3=_0x13c2aa;_0x4effed[_0x9130('0x34')]=_[_0x9130('0x36')](db[_0x9130('0x9c')][_0x9130('0x30')]);_0x4effed[_0x9130('0x35')]=_[_0x9130('0x36')](_0x322fe3['query']);_0x4effed[_0x9130('0x37')]=_['intersection'](_0x4effed[_0x9130('0x34')],_0x4effed[_0x9130('0x35')]);_0x2a3b38['attributes']=_['intersection'](_0x4effed['model'],qs[_0x9130('0x3a')](_0x322fe3[_0x9130('0x35')][_0x9130('0x3a')]));_0x2a3b38[_0x9130('0x39')]=_0x2a3b38[_0x9130('0x39')][_0x9130('0x3b')]?_0x2a3b38[_0x9130('0x39')]:_0x4effed[_0x9130('0x34')];_0x2a3b38[_0x9130('0x3d')]=qs['sort'](_0x322fe3[_0x9130('0x35')][_0x9130('0x3e')]);_0x2a3b38[_0x9130('0x3f')]=qs['filters'](_['pick'](_0x322fe3['query'],_0x4effed[_0x9130('0x37')]));if(_0x322fe3[_0x9130('0x35')][_0x9130('0x40')]){_0x2a3b38['where']=_['merge'](_0x2a3b38[_0x9130('0x3f')],{'$or':_[_0x9130('0x2e')](_0x2a3b38[_0x9130('0x39')],function(_0x927953){var _0x1ba208={};_0x1ba208[_0x927953]={'$like':'%'+_0x322fe3[_0x9130('0x35')][_0x9130('0x40')]+'%'};return _0x1ba208;})});}_0x2a3b38=_['merge']({},_0x2a3b38,_0x322fe3[_0x9130('0x43')]);return _0x3bd6e3[_0x9130('0x9b')](_0x2a3b38);}})[_0x9130('0x2a')](function(_0x231cd6){if(_0x231cd6){_0x8f3796=_0x231cd6[_0x9130('0x3b')];if(!_0x322fe3[_0x9130('0x35')]['hasOwnProperty'](_0x9130('0x9d'))){_0x2a3b38[_0x9130('0x22')]=qs[_0x9130('0x22')](_0x322fe3['query'][_0x9130('0x22')]);_0x2a3b38[_0x9130('0x20')]=qs[_0x9130('0x20')](_0x322fe3[_0x9130('0x35')][_0x9130('0x20')]);}return _0x3bd6e3['getAgents'](_0x2a3b38);}})[_0x9130('0x2a')](function(_0x4327c5){if(_0x4327c5){return _0x4327c5?{'count':_0x8f3796,'rows':_0x4327c5}:null;}})[_0x9130('0x2a')](respondWithResult(_0x513f1f,null))['catch'](handleError(_0x513f1f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d324f04..d1d06af 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 _0x1414=['../../mysqldb','Team','setMaxListeners','update','emit','hook','exports','events'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x1414,0x1af));var _0x4141=function(_0x391e5d,_0x4d81ed){_0x391e5d=_0x391e5d-0x0;var _0xd37ca5=_0x1414[_0x391e5d];return _0xd37ca5;};'use strict';var EventEmitter=require(_0x4141('0x0'));var Team=require(_0x4141('0x1'))['db'][_0x4141('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4141('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4141('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49f5fb){return function(_0x416a57,_0x35bb56,_0x5dca2e){TeamEvents[_0x4141('0x5')](_0x49f5fb+':'+_0x416a57['id'],_0x416a57);TeamEvents[_0x4141('0x5')](_0x49f5fb,_0x416a57);_0x5dca2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x4141('0x6')](e,emitEvent(event));}}module[_0x4141('0x7')]=TeamEvents; \ No newline at end of file +var _0x7fe7=['update','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7fe7,0x19a));var _0x77fe=function(_0x1d50a3,_0x3213ff){_0x1d50a3=_0x1d50a3-0x0;var _0x4d8902=_0x7fe7[_0x1d50a3];return _0x4d8902;};'use strict';var EventEmitter=require(_0x77fe('0x0'));var Team=require(_0x77fe('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x77fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x77fe('0x3'),'afterDestroy':_0x77fe('0x4')};function emitEvent(_0x16bfc1){return function(_0x4bde30,_0x1d6e34,_0x4ff85b){TeamEvents['emit'](_0x16bfc1+':'+_0x4bde30['id'],_0x4bde30);TeamEvents[_0x77fe('0x5')](_0x16bfc1,_0x4bde30);_0x4ff85b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x77fe('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 63cf08e..e627d1b 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 _0x84a8=['get','then','map','setDataValue','channel','catch','teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp','resolve','lodash'];(function(_0x4f1369,_0x4c595c){var _0xcd26a4=function(_0x1a8515){while(--_0x1a8515){_0x4f1369['push'](_0x4f1369['shift']());}};_0xcd26a4(++_0x4c595c);}(_0x84a8,0x176));var _0x884a=function(_0x48317f,_0x12895a){_0x48317f=_0x48317f-0x0;var _0x4d1cce=_0x84a8[_0x48317f];return _0x4d1cce;};'use strict';var _=require(_0x884a('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x3c83a6,_0x53fdda){var _0x43ccfa=_0x884a('0x1')+_0x53fdda+'Queues';return _0x3c83a6[_0x43ccfa]()[_0x884a('0x2')](function(_0x184378){return _[_0x884a('0x3')](_0x184378,function(_0x2a7edd){_0x2a7edd[_0x884a('0x4')](_0x884a('0x5'),_0x53fdda);return _0x2a7edd;});})[_0x884a('0x6')](function(_0x376f8a){throw _0x376f8a;});}module['exports']=function(_0x59cd7c){return _0x59cd7c['define']('Team',attributes,{'tableName':_0x884a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xc87e40=this;var _0x23c1eb=[_0x884a('0x8'),_0x884a('0x9'),_0x884a('0xa'),_0x884a('0xb'),'Sms',_0x884a('0xc'),_0x884a('0xd')];return Promise[_0x884a('0xe')]()[_0x884a('0x2')](function(){var _0x215c1e=_[_0x884a('0x3')](_0x23c1eb,function(_0x38518c){return getQueuesByChannel(_0xc87e40,_0x38518c);});return Promise['all'](_0x215c1e);})[_0x884a('0x6')](function(_0x469e71){throw _0x469e71;});}}});}; \ No newline at end of file +var _0x74b6=['Mail','Openchannel','Sms','Whatsapp','resolve','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch','exports','define','Team','teams','Chat','Fax'];(function(_0x41b6a3,_0x58d1b1){var _0x524f0f=function(_0x1d1369){while(--_0x1d1369){_0x41b6a3['push'](_0x41b6a3['shift']());}};_0x524f0f(++_0x58d1b1);}(_0x74b6,0x148));var _0x674b=function(_0x3e760b,_0x557fb4){_0x3e760b=_0x3e760b-0x0;var _0x416537=_0x74b6[_0x3e760b];return _0x416537;};'use strict';var _=require(_0x674b('0x0'));var attributes=require(_0x674b('0x1'));function getQueuesByChannel(_0x5112e4,_0x3d9fc0){var _0x21491d=_0x674b('0x2')+_0x3d9fc0+_0x674b('0x3');return _0x5112e4[_0x21491d]()[_0x674b('0x4')](function(_0x36492e){return _[_0x674b('0x5')](_0x36492e,function(_0x2cc606){_0x2cc606[_0x674b('0x6')]('channel',_0x3d9fc0);return _0x2cc606;});})[_0x674b('0x7')](function(_0xe06a94){throw _0xe06a94;});}module[_0x674b('0x8')]=function(_0x1ff4d2){return _0x1ff4d2[_0x674b('0x9')](_0x674b('0xa'),attributes,{'tableName':_0x674b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1ef451=this;var _0x48de62=[_0x674b('0xc'),_0x674b('0xd'),_0x674b('0xe'),_0x674b('0xf'),_0x674b('0x10'),'Voice',_0x674b('0x11')];return Promise[_0x674b('0x12')]()['then'](function(){var _0x1094f9=_['map'](_0x48de62,function(_0x34f9a4){return getQueuesByChannel(_0x1ef451,_0x34f9a4);});return Promise['all'](_0x1094f9);})[_0x674b('0x7')](function(_0x3209dd){throw _0x3209dd;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d976267..91f8104 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 _0xe1ef=['then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x1bf8b1,_0x1b11cd){var _0x37fb94=function(_0x33a62c){while(--_0x33a62c){_0x1bf8b1['push'](_0x1bf8b1['shift']());}};_0x37fb94(++_0x1b11cd);}(_0xe1ef,0x72));var _0xfe1e=function(_0x2f140f,_0x235706){_0x2f140f=_0x2f140f-0x0;var _0xe01c51=_0xe1ef[_0x2f140f];return _0xe01c51;};'use strict';var _=require(_0xfe1e('0x0'));var util=require(_0xfe1e('0x1'));var moment=require(_0xfe1e('0x2'));var BPromise=require(_0xfe1e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe1e('0x4'))['db'];var utils=require(_0xfe1e('0x5'));var logger=require(_0xfe1e('0x6'))(_0xfe1e('0x7'));var config=require(_0xfe1e('0x8'));var jayson=require(_0xfe1e('0x9'));var client=jayson['client'][_0xfe1e('0xa')]({'port':0x232a});config[_0xfe1e('0xb')]=_[_0xfe1e('0xc')](config[_0xfe1e('0xb')],{'host':_0xfe1e('0xd'),'port':0x18eb});var socket=require(_0xfe1e('0xe'))(new Redis(config[_0xfe1e('0xb')]));require('./team.socket')[_0xfe1e('0xf')](socket);function respondWithRpcPromise(_0x35b248,_0xdca507,_0x48d608){return new BPromise(function(_0x4d091b,_0x211fec){return client['request'](_0x35b248,_0x48d608)[_0xfe1e('0x10')](function(_0x4ef247){logger['info'](_0xfe1e('0x11'),_0xdca507,'request\x20sent');logger[_0xfe1e('0x12')](_0xfe1e('0x13'),_0xdca507,_0xfe1e('0x14'),JSON[_0xfe1e('0x15')](_0x4ef247));if(_0x4ef247[_0xfe1e('0x16')]){if(_0x4ef247[_0xfe1e('0x16')]['code']===0x1f4){logger[_0xfe1e('0x16')](_0xfe1e('0x11'),_0xdca507,_0x4ef247[_0xfe1e('0x16')][_0xfe1e('0x17')]);return _0x211fec(_0x4ef247[_0xfe1e('0x16')][_0xfe1e('0x17')]);}logger[_0xfe1e('0x16')](_0xfe1e('0x11'),_0xdca507,_0x4ef247[_0xfe1e('0x16')]['message']);return _0x4d091b(_0x4ef247[_0xfe1e('0x16')][_0xfe1e('0x17')]);}else{logger[_0xfe1e('0x18')](_0xfe1e('0x11'),_0xdca507,_0xfe1e('0x14'));_0x4d091b(_0x4ef247[_0xfe1e('0x19')]['message']);}})['catch'](function(_0x4e18ac){logger[_0xfe1e('0x16')](_0xfe1e('0x11'),_0xdca507,_0x4e18ac);_0x211fec(_0x4e18ac);});});} \ No newline at end of file +var _0xa87c=['request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x284b57,_0x401352){var _0x58159f=function(_0x4ec9a4){while(--_0x4ec9a4){_0x284b57['push'](_0x284b57['shift']());}};_0x58159f(++_0x401352);}(_0xa87c,0x135));var _0xca87=function(_0x57d7f7,_0x335c81){_0x57d7f7=_0x57d7f7-0x0;var _0x1a6800=_0xa87c[_0x57d7f7];return _0x1a6800;};'use strict';var _=require(_0xca87('0x0'));var util=require(_0xca87('0x1'));var moment=require(_0xca87('0x2'));var BPromise=require(_0xca87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca87('0x4'));var db=require(_0xca87('0x5'))['db'];var utils=require(_0xca87('0x6'));var logger=require(_0xca87('0x7'))('rpc');var config=require(_0xca87('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca87('0x9')]({'port':0x232a});config[_0xca87('0xa')]=_[_0xca87('0xb')](config['redis'],{'host':_0xca87('0xc'),'port':0x18eb});var socket=require(_0xca87('0xd'))(new Redis(config[_0xca87('0xa')]));require('./team.socket')[_0xca87('0xe')](socket);function respondWithRpcPromise(_0x1dbd67,_0x5df034,_0x43f81c){return new BPromise(function(_0x3df787,_0x5768ba){return client[_0xca87('0xf')](_0x1dbd67,_0x43f81c)[_0xca87('0x10')](function(_0x221357){logger[_0xca87('0x11')](_0xca87('0x12'),_0x5df034,_0xca87('0x13'));logger[_0xca87('0x14')](_0xca87('0x15'),_0x5df034,_0xca87('0x13'),JSON[_0xca87('0x16')](_0x221357));if(_0x221357['error']){if(_0x221357['error'][_0xca87('0x17')]===0x1f4){logger[_0xca87('0x18')]('Team,\x20%s,\x20%s',_0x5df034,_0x221357[_0xca87('0x18')][_0xca87('0x19')]);return _0x5768ba(_0x221357[_0xca87('0x18')][_0xca87('0x19')]);}logger['error'](_0xca87('0x12'),_0x5df034,_0x221357[_0xca87('0x18')][_0xca87('0x19')]);return _0x3df787(_0x221357[_0xca87('0x18')]['message']);}else{logger[_0xca87('0x11')](_0xca87('0x12'),_0x5df034,'request\x20sent');_0x3df787(_0x221357[_0xca87('0x1a')][_0xca87('0x19')]);}})['catch'](function(_0x142e5a){logger[_0xca87('0x18')](_0xca87('0x12'),_0x5df034,_0x142e5a);_0x5768ba(_0x142e5a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f8b5f68..4ce0846 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 _0x6a59=['team:','./team.events','remove','update','emit','removeListener','register'];(function(_0x46804e,_0x9b240c){var _0x27d3ae=function(_0x63d57f){while(--_0x63d57f){_0x46804e['push'](_0x46804e['shift']());}};_0x27d3ae(++_0x9b240c);}(_0x6a59,0x1d6));var _0x96a5=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x6a59[_0x32b542];return _0x554d54;};'use strict';var TeamEvents=require(_0x96a5('0x0'));var events=['save',_0x96a5('0x1'),_0x96a5('0x2')];function createListener(_0x4d8ffa,_0x2eeff6){return function(_0x3a76f9){_0x2eeff6[_0x96a5('0x3')](_0x4d8ffa,_0x3a76f9);};}function removeListener(_0x1f63c1,_0x467abe){return function(){TeamEvents[_0x96a5('0x4')](_0x1f63c1,_0x467abe);};}exports[_0x96a5('0x5')]=function(_0x503d4f){for(var _0xdc370e=0x0,_0x400594=events['length'];_0xdc370e<_0x400594;_0xdc370e++){var _0x2989b8=events[_0xdc370e];var _0x277a8c=createListener(_0x96a5('0x6')+_0x2989b8,_0x503d4f);TeamEvents['on'](_0x2989b8,_0x277a8c);}}; \ No newline at end of file +var _0xe386=['removeListener','register','length','team:','save','remove','update','emit'];(function(_0x41f8ee,_0x1555b1){var _0x435e44=function(_0x285469){while(--_0x285469){_0x41f8ee['push'](_0x41f8ee['shift']());}};_0x435e44(++_0x1555b1);}(_0xe386,0x11c));var _0x6e38=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe386[_0x122ef9];return _0x42fba0;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6e38('0x0'),_0x6e38('0x1'),_0x6e38('0x2')];function createListener(_0x4a7eed,_0x1ce38a){return function(_0x3ead95){_0x1ce38a[_0x6e38('0x3')](_0x4a7eed,_0x3ead95);};}function removeListener(_0x1c0be0,_0x31cb98){return function(){TeamEvents[_0x6e38('0x4')](_0x1c0be0,_0x31cb98);};}exports[_0x6e38('0x5')]=function(_0x12c3dd){for(var _0x7c761c=0x0,_0x3a5b5f=events[_0x6e38('0x6')];_0x7c761c<_0x3a5b5f;_0x7c761c++){var _0x44a3e9=events[_0x7c761c];var _0x15b404=createListener(_0x6e38('0x7')+_0x44a3e9,_0x12c3dd);TeamEvents['on'](_0x44a3e9,_0x15b404);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 65368ce..f2f8c16 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 _0xbdb8=['INTEGER','sequelize','exports'];(function(_0x1189bf,_0x20195c){var _0x4236b6=function(_0x2e527f){while(--_0x2e527f){_0x1189bf['push'](_0x1189bf['shift']());}};_0x4236b6(++_0x20195c);}(_0xbdb8,0xe2));var _0x8bdb=function(_0x182cdd,_0x20c7d1){_0x182cdd=_0x182cdd-0x0;var _0x5c4424=_0xbdb8[_0x182cdd];return _0x5c4424;};'use strict';var Sequelize=require(_0x8bdb('0x0'));module[_0x8bdb('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x8bdb('0x2')]}}; \ No newline at end of file +var _0xcf14=['INTEGER','sequelize'];(function(_0x35bdac,_0x5c450f){var _0x46cb74=function(_0x70e7d0){while(--_0x70e7d0){_0x35bdac['push'](_0x35bdac['shift']());}};_0x46cb74(++_0x5c450f);}(_0xcf14,0xa1));var _0x4cf1=function(_0x270c39,_0x570917){_0x270c39=_0x270c39-0x0;var _0x1595d8=_0xcf14[_0x270c39];return _0x1595d8;};'use strict';var Sequelize=require(_0x4cf1('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x4cf1('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x4cf1('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index be5c4f8..75ece77 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 _0xf089=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util'];(function(_0x2ded05,_0x5ec1e6){var _0x57b50b=function(_0x5d0a3c){while(--_0x5d0a3c){_0x2ded05['push'](_0x2ded05['shift']());}};_0x57b50b(++_0x5ec1e6);}(_0xf089,0xba));var _0x9f08=function(_0x4d3da9,_0x620173){_0x4d3da9=_0x4d3da9-0x0;var _0x28bae6=_0xf089[_0x4d3da9];return _0x28bae6;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var logger=require(_0x9f08('0x1'))('api');var moment=require(_0x9f08('0x2'));var BPromise=require(_0x9f08('0x3'));var rp=require(_0x9f08('0x4'));var fs=require('fs');var path=require(_0x9f08('0x5'));var rimraf=require('rimraf');var config=require(_0x9f08('0x6'));var attributes=require(_0x9f08('0x7'));module[_0x9f08('0x8')]=function(_0x13768c,_0x38c9ea){return _0x13768c[_0x9f08('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x9f08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc87=['../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x167a84,_0x5184f3){var _0x129894=function(_0x4d4c5f){while(--_0x4d4c5f){_0x167a84['push'](_0x167a84['shift']());}};_0x129894(++_0x5184f3);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x3932d3,_0x2c360b){_0x3932d3=_0x3932d3-0x0;var _0x975b77=_0xbc87[_0x3932d3];return _0x975b77;};'use strict';var _=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var logger=require('../../config/logger')(_0x7bc8('0x2'));var moment=require(_0x7bc8('0x3'));var BPromise=require(_0x7bc8('0x4'));var rp=require(_0x7bc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bc8('0x6'));var config=require(_0x7bc8('0x7'));var attributes=require(_0x7bc8('0x8'));module[_0x7bc8('0x9')]=function(_0x3db27b,_0x4f291a){return _0x3db27b['define'](_0x7bc8('0xa'),attributes,{'tableName':_0x7bc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 7cfdde3..79ee814 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4f0d63,_0x11c460){var _0x474011=function(_0x3ba18b){while(--_0x3ba18b){_0x4f0d63['push'](_0x4f0d63['shift']());}};_0x474011(++_0x11c460);}(_0x70e0,0x17b));var _0x070e=function(_0x350f07,_0x448965){_0x350f07=_0x350f07-0x0;var _0x437d0c=_0x70e0[_0x350f07];return _0x437d0c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x10b321,_0x252810){var _0x42937e=function(_0x581ab5){while(--_0x581ab5){_0x10b321['push'](_0x10b321['shift']());}};_0x42937e(++_0x252810);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xcb91[_0x35007a];return _0x574f68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index eb38599..da21242 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 _0x3960=['INTEGER','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3960,0x125));var _0x0396=function(_0x3f0d6a,_0xa29f5b){_0x3f0d6a=_0x3f0d6a-0x0;var _0x5af2e0=_0x3960[_0x3f0d6a];return _0x5af2e0;};'use strict';var Sequelize=require(_0x0396('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0396('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe315=['INTEGER','exports'];(function(_0x42a632,_0x1be689){var _0x2562b0=function(_0x36e49c){while(--_0x36e49c){_0x42a632['push'](_0x42a632['shift']());}};_0x2562b0(++_0x1be689);}(_0xe315,0xcf));var _0x5e31=function(_0x212caf,_0x589c77){_0x212caf=_0x212caf-0x0;var _0x419dfa=_0xe315[_0x212caf];return _0x419dfa;};'use strict';var Sequelize=require('sequelize');module[_0x5e31('0x0')]={'penalty':{'type':Sequelize[_0x5e31('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 45994fb..4c343d3 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 _0x4ea3=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','path','./teamVoiceQueue.attributes','exports','define'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe77f=['request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash','util','api','moment'];(function(_0xe1a627,_0x2f909a){var _0x46a04b=function(_0x13558e){while(--_0x13558e){_0xe1a627['push'](_0xe1a627['shift']());}};_0x46a04b(++_0x2f909a);}(_0xe77f,0xba));var _0xfe77=function(_0xdc332,_0x5e44be){_0xdc332=_0xdc332-0x0;var _0x4b6a92=_0xe77f[_0xdc332];return _0x4b6a92;};'use strict';var _=require(_0xfe77('0x0'));var util=require(_0xfe77('0x1'));var logger=require('../../config/logger')(_0xfe77('0x2'));var moment=require(_0xfe77('0x3'));var BPromise=require('bluebird');var rp=require(_0xfe77('0x4'));var fs=require('fs');var path=require(_0xfe77('0x5'));var rimraf=require('rimraf');var config=require(_0xfe77('0x6'));var attributes=require(_0xfe77('0x7'));module[_0xfe77('0x8')]=function(_0x1ce970,_0x130b85){return _0x1ce970['define']('TeamVoiceQueue',attributes,{'tableName':_0xfe77('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 eec9e60..5779f4f 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 _0xab5c=['error','code','message','catch','util','moment','bluebird','ioredis','rpc','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x343443,_0x24d7cf){var _0x250872=function(_0x58b458){while(--_0x58b458){_0x343443['push'](_0x343443['shift']());}};_0x250872(++_0x24d7cf);}(_0xab5c,0x134));var _0xcab5=function(_0x815d8e,_0x45c2ee){_0x815d8e=_0x815d8e-0x0;var _0x587fe3=_0xab5c[_0x815d8e];return _0x587fe3;};'use strict';var _=require('lodash');var util=require(_0xcab5('0x0'));var moment=require(_0xcab5('0x1'));var BPromise=require(_0xcab5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcab5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcab5('0x4'));var config=require('../../config/environment');var jayson=require(_0xcab5('0x5'));var client=jayson[_0xcab5('0x6')][_0xcab5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b01ae,_0x1b289b,_0xc26c45){return new BPromise(function(_0x3e7d0e,_0x18f24e){return client[_0xcab5('0x8')](_0x3b01ae,_0xc26c45)['then'](function(_0x5ec330){logger[_0xcab5('0x9')](_0xcab5('0xa'),_0x1b289b,_0xcab5('0xb'));logger[_0xcab5('0xc')](_0xcab5('0xd'),_0x1b289b,_0xcab5('0xb'),JSON[_0xcab5('0xe')](_0x5ec330));if(_0x5ec330[_0xcab5('0xf')]){if(_0x5ec330[_0xcab5('0xf')][_0xcab5('0x10')]===0x1f4){logger[_0xcab5('0xf')](_0xcab5('0xa'),_0x1b289b,_0x5ec330[_0xcab5('0xf')][_0xcab5('0x11')]);return _0x18f24e(_0x5ec330['error'][_0xcab5('0x11')]);}logger['error'](_0xcab5('0xa'),_0x1b289b,_0x5ec330['error'][_0xcab5('0x11')]);return _0x3e7d0e(_0x5ec330[_0xcab5('0xf')][_0xcab5('0x11')]);}else{logger[_0xcab5('0x9')](_0xcab5('0xa'),_0x1b289b,_0xcab5('0xb'));_0x3e7d0e(_0x5ec330['result'][_0xcab5('0x11')]);}})[_0xcab5('0x12')](function(_0x529c35){logger[_0xcab5('0xf')](_0xcab5('0xa'),_0x1b289b,_0x529c35);_0x18f24e(_0x529c35);});});} \ No newline at end of file +var _0xf250=['client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ee352,_0xaf715f){var _0x29e820=function(_0x1cd6a4){while(--_0x1cd6a4){_0x1ee352['push'](_0x1ee352['shift']());}};_0x29e820(++_0xaf715f);}(_0xf250,0x73));var _0x0f25=function(_0x56b891,_0x2f117e){_0x56b891=_0x56b891-0x0;var _0x41d994=_0xf250[_0x56b891];return _0x41d994;};'use strict';var _=require(_0x0f25('0x0'));var util=require(_0x0f25('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0f25('0x2'));var fs=require('fs');var Redis=require(_0x0f25('0x3'));var db=require(_0x0f25('0x4'))['db'];var utils=require(_0x0f25('0x5'));var logger=require(_0x0f25('0x6'))(_0x0f25('0x7'));var config=require(_0x0f25('0x8'));var jayson=require(_0x0f25('0x9'));var client=jayson[_0x0f25('0xa')][_0x0f25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x322278,_0x2ee924,_0x5b18e6){return new BPromise(function(_0x53b64e,_0x2dbd0f){return client[_0x0f25('0xc')](_0x322278,_0x5b18e6)[_0x0f25('0xd')](function(_0x290e5a){logger['info'](_0x0f25('0xe'),_0x2ee924,_0x0f25('0xf'));logger[_0x0f25('0x10')](_0x0f25('0x11'),_0x2ee924,'request\x20sent',JSON[_0x0f25('0x12')](_0x290e5a));if(_0x290e5a['error']){if(_0x290e5a[_0x0f25('0x13')][_0x0f25('0x14')]===0x1f4){logger[_0x0f25('0x13')](_0x0f25('0xe'),_0x2ee924,_0x290e5a['error'][_0x0f25('0x15')]);return _0x2dbd0f(_0x290e5a['error'][_0x0f25('0x15')]);}logger[_0x0f25('0x13')](_0x0f25('0xe'),_0x2ee924,_0x290e5a[_0x0f25('0x13')][_0x0f25('0x15')]);return _0x53b64e(_0x290e5a[_0x0f25('0x13')][_0x0f25('0x15')]);}else{logger[_0x0f25('0x16')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2ee924,_0x0f25('0xf'));_0x53b64e(_0x290e5a[_0x0f25('0x17')][_0x0f25('0x15')]);}})[_0x0f25('0x18')](function(_0x1ebd19){logger[_0x0f25('0x13')](_0x0f25('0xe'),_0x2ee924,_0x1ebd19);_0x2dbd0f(_0x1ebd19);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d1549de..f66568c 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 _0x5454=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x5b311b,_0x3e0280){var _0x4fa0de=function(_0x5363ed){while(--_0x5363ed){_0x5b311b['push'](_0x5b311b['shift']());}};_0x4fa0de(++_0x3e0280);}(_0x5454,0x15b));var _0x4545=function(_0x18095b,_0x1dd198){_0x18095b=_0x18095b-0x0;var _0x579450=_0x5454[_0x18095b];return _0x579450;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4545('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4545('0x1'));var interaction=require(_0x4545('0x2'));var config=require(_0x4545('0x3'));var controller=require(_0x4545('0x4'));router['get']('/',auth[_0x4545('0x5')](),controller[_0x4545('0x6')]);router[_0x4545('0x7')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0x9')]);router[_0x4545('0xa')]('/',auth[_0x4545('0x5')](),controller[_0x4545('0xb')]);router[_0x4545('0xc')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xd')]);router['delete'](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xe')]);module[_0x4545('0xf')]=router; \ No newline at end of file +var _0xf417=['util','path','connect-timeout','Router','../../components/interaction/service','index','/:id','isAuthenticated','post','create','exports'];(function(_0x30fbfc,_0x1a25fa){var _0x3b3467=function(_0x5a01b6){while(--_0x5a01b6){_0x30fbfc['push'](_0x30fbfc['shift']());}};_0x3b3467(++_0x1a25fa);}(_0xf417,0x8f));var _0x7f41=function(_0x14fc67,_0x2ea1fe){_0x14fc67=_0x14fc67-0x0;var _0x3cb64b=_0xf417[_0x14fc67];return _0x3cb64b;};'use strict';var multer=require('multer');var util=require(_0x7f41('0x0'));var path=require(_0x7f41('0x1'));var timeout=require(_0x7f41('0x2'));var express=require('express');var router=express[_0x7f41('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f41('0x4'));var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7f41('0x5')]);router['get'](_0x7f41('0x6'),auth[_0x7f41('0x7')](),controller['show']);router[_0x7f41('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f41('0x9')]);router['put'](_0x7f41('0x6'),auth[_0x7f41('0x7')](),controller['update']);router['delete'](_0x7f41('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0x7f41('0xa')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 2f37e8d..bd17c46 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 _0x6348=['TEXT','sequelize','exports','STRING'];(function(_0x448f40,_0x382153){var _0x1abee3=function(_0x1301d0){while(--_0x1301d0){_0x448f40['push'](_0x448f40['shift']());}};_0x1abee3(++_0x382153);}(_0x6348,0xb9));var _0x8634=function(_0x2084f3,_0x423d9a){_0x2084f3=_0x2084f3-0x0;var _0x1e0ea3=_0x6348[_0x2084f3];return _0x1e0ea3;};'use strict';var Sequelize=require(_0x8634('0x0'));module[_0x8634('0x1')]={'name':{'type':Sequelize[_0x8634('0x2')]},'description':{'type':Sequelize[_0x8634('0x2')]},'html':{'type':Sequelize[_0x8634('0x3')]}}; \ No newline at end of file +var _0x770d=['STRING','TEXT'];(function(_0x543349,_0x8f9924){var _0x2f87da=function(_0x25be61){while(--_0x25be61){_0x543349['push'](_0x543349['shift']());}};_0x2f87da(++_0x8f9924);}(_0x770d,0x122));var _0xd770=function(_0x327ae5,_0x1b8936){_0x327ae5=_0x327ae5-0x0;var _0x43be4a=_0x770d[_0x327ae5];return _0x43be4a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd770('0x0')]},'html':{'type':Sequelize[_0xd770('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0f0f537..390dd3d 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 _0x1ac0=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','Templates','destroy','end','sendStatus','error','stack','index','Template','rawAttributes','fieldName','type','key','model','map','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash'];(function(_0x5ca4d8,_0x436be0){var _0x328566=function(_0x283f3f){while(--_0x283f3f){_0x5ca4d8['push'](_0x5ca4d8['shift']());}};_0x328566(++_0x436be0);}(_0x1ac0,0x8f));var _0x01ac=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1ac0[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x01ac('0x0'));var jsonpatch=require(_0x01ac('0x1'));var rp=require(_0x01ac('0x2'));var moment=require(_0x01ac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x01ac('0x4'));var util=require('util');var path=require('path');var sox=require(_0x01ac('0x5'));var csv=require(_0x01ac('0x6'));var ejs=require(_0x01ac('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01ac('0x8'));var squel=require(_0x01ac('0x9'));var crypto=require('crypto');var jsforce=require(_0x01ac('0xa'));var deskjs=require(_0x01ac('0xb'));var toCsv=require(_0x01ac('0x6'));var querystring=require(_0x01ac('0xc'));var Papa=require(_0x01ac('0xd'));var Redis=require(_0x01ac('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x01ac('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01ac('0x10'))(_0x01ac('0x11'));var utils=require(_0x01ac('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x01ac('0x13'))['db'];function respondWithStatusCode(_0x3ba5cf,_0xcce16){_0xcce16=_0xcce16||0xcc;return function(_0xa6584b){if(_0xa6584b){return _0x3ba5cf['sendStatus'](_0xcce16);}return _0x3ba5cf[_0x01ac('0x14')](_0xcce16)['end']();};}function respondWithResult(_0x414fb4,_0x427d99){_0x427d99=_0x427d99||0xc8;return function(_0x2cf3ff){if(_0x2cf3ff){return _0x414fb4[_0x01ac('0x14')](_0x427d99)[_0x01ac('0x15')](_0x2cf3ff);}};}function respondWithFilteredResult(_0x54c479,_0x17946c){return function(_0x2cb4ad){if(_0x2cb4ad){var _0x34a04a=typeof _0x17946c[_0x01ac('0x16')]===_0x01ac('0x17')&&typeof _0x17946c['limit']===_0x01ac('0x17');var _0x35884d=_0x2cb4ad[_0x01ac('0x18')];var _0x1dda3b=_0x34a04a?0x0:_0x17946c['offset'];var _0x1d86c7=_0x34a04a?_0x2cb4ad[_0x01ac('0x18')]:_0x17946c['offset']+_0x17946c[_0x01ac('0x19')];var _0x3b6696;if(_0x1d86c7>=_0x35884d){_0x1d86c7=_0x35884d;_0x3b6696=0xc8;}else{_0x3b6696=0xce;}_0x54c479[_0x01ac('0x14')](_0x3b6696);return _0x54c479[_0x01ac('0x1a')](_0x01ac('0x1b'),_0x1dda3b+'-'+_0x1d86c7+'/'+_0x35884d)[_0x01ac('0x15')](_0x2cb4ad);}return null;};}function patchUpdates(_0x2efbfe){return function(_0x4f5923){try{jsonpatch[_0x01ac('0x1c')](_0x4f5923,_0x2efbfe,!![]);}catch(_0xdc95f0){return BPromise['reject'](_0xdc95f0);}return _0x4f5923['save']();};}function saveUpdates(_0x34e938,_0xa20d8f){return function(_0x3858d3){if(_0x3858d3){return _0x3858d3[_0x01ac('0x1d')](_0x34e938)[_0x01ac('0x1e')](function(_0x56394e){return _0x56394e;});}return null;};}function removeEntity(_0x3f96e1,_0xe00f2){return function(_0x16d609){if(_0x16d609){return _0x16d609['destroy']()[_0x01ac('0x1e')](function(){var _0x4d49aa=_0x16d609['get']({'plain':!![]});var _0x3c3830=_0x01ac('0x1f');return db['UserProfileResource'][_0x01ac('0x20')]({'where':{'type':_0x3c3830,'resourceId':_0x4d49aa['id']}})[_0x01ac('0x1e')](function(){return _0x16d609;});})[_0x01ac('0x1e')](function(){_0x3f96e1[_0x01ac('0x14')](0xcc)[_0x01ac('0x21')]();});}};}function handleEntityNotFound(_0x178954,_0x1dffc2){return function(_0x2a6e68){if(!_0x2a6e68){_0x178954[_0x01ac('0x22')](0x194);}return _0x2a6e68;};}function handleError(_0x1623d6,_0x599479){_0x599479=_0x599479||0x1f4;return function(_0x362c91){logger[_0x01ac('0x23')](_0x362c91[_0x01ac('0x24')]);if(_0x362c91['name']){delete _0x362c91['name'];}_0x1623d6[_0x01ac('0x14')](_0x599479)['send'](_0x362c91);};}exports[_0x01ac('0x25')]=function(_0x321eed,_0x51a690){var _0x28a716={},_0x1d2da9={},_0x15fcf4={'count':0x0,'rows':[]};var _0x347f72=_['map'](db[_0x01ac('0x26')][_0x01ac('0x27')],function(_0x4a474c){return{'name':_0x4a474c[_0x01ac('0x28')],'type':_0x4a474c[_0x01ac('0x29')][_0x01ac('0x2a')]};});_0x1d2da9[_0x01ac('0x2b')]=_[_0x01ac('0x2c')](_0x347f72,_0x01ac('0x2d'));_0x1d2da9[_0x01ac('0x2e')]=_['keys'](_0x321eed['query']);_0x1d2da9['filters']=_[_0x01ac('0x2f')](_0x1d2da9[_0x01ac('0x2b')],_0x1d2da9[_0x01ac('0x2e')]);_0x28a716['attributes']=_[_0x01ac('0x2f')](_0x1d2da9[_0x01ac('0x2b')],qs[_0x01ac('0x30')](_0x321eed[_0x01ac('0x2e')]['fields']));_0x28a716['attributes']=_0x28a716[_0x01ac('0x31')]['length']?_0x28a716[_0x01ac('0x31')]:_0x1d2da9[_0x01ac('0x2b')];if(!_0x321eed[_0x01ac('0x2e')][_0x01ac('0x32')](_0x01ac('0x33'))){_0x28a716[_0x01ac('0x19')]=qs[_0x01ac('0x19')](_0x321eed['query'][_0x01ac('0x19')]);_0x28a716[_0x01ac('0x16')]=qs['offset'](_0x321eed[_0x01ac('0x2e')]['offset']);}_0x28a716[_0x01ac('0x34')]=qs['sort'](_0x321eed['query']['sort']);_0x28a716[_0x01ac('0x35')]=qs[_0x01ac('0x36')](_[_0x01ac('0x37')](_0x321eed[_0x01ac('0x2e')],_0x1d2da9[_0x01ac('0x36')]),_0x347f72);if(_0x321eed[_0x01ac('0x2e')]['filter']){_0x28a716[_0x01ac('0x35')]=_[_0x01ac('0x38')](_0x28a716[_0x01ac('0x35')],{'$or':_[_0x01ac('0x2c')](_0x347f72,function(_0x2f7ca5){if(_0x2f7ca5[_0x01ac('0x29')]!==_0x01ac('0x39')){var _0x3e94f2={};_0x3e94f2[_0x2f7ca5[_0x01ac('0x2d')]]={'$like':'%'+_0x321eed[_0x01ac('0x2e')][_0x01ac('0x3a')]+'%'};return _0x3e94f2;}})});}_0x28a716=_[_0x01ac('0x38')]({},_0x28a716,_0x321eed[_0x01ac('0x3b')]);var _0x24ddc5={'where':_0x28a716['where']};return db[_0x01ac('0x26')][_0x01ac('0x18')](_0x24ddc5)[_0x01ac('0x1e')](function(_0x5775e0){_0x15fcf4[_0x01ac('0x18')]=_0x5775e0;if(_0x321eed[_0x01ac('0x2e')][_0x01ac('0x3c')]){_0x28a716[_0x01ac('0x3d')]=[{'all':!![]}];}return db[_0x01ac('0x26')][_0x01ac('0x3e')](_0x28a716);})[_0x01ac('0x1e')](function(_0x2f5311){_0x15fcf4['rows']=_0x2f5311;return _0x15fcf4;})[_0x01ac('0x1e')](respondWithFilteredResult(_0x51a690,_0x28a716))[_0x01ac('0x3f')](handleError(_0x51a690,null));};exports[_0x01ac('0x40')]=function(_0x1ce4e2,_0x731db6){var _0x1128b7={'raw':!![],'where':{'id':_0x1ce4e2[_0x01ac('0x41')]['id']}},_0x50022f={};_0x50022f['model']=_[_0x01ac('0x42')](db[_0x01ac('0x26')][_0x01ac('0x27')]);_0x50022f[_0x01ac('0x2e')]=_[_0x01ac('0x42')](_0x1ce4e2[_0x01ac('0x2e')]);_0x50022f[_0x01ac('0x36')]=_[_0x01ac('0x2f')](_0x50022f[_0x01ac('0x2b')],_0x50022f[_0x01ac('0x2e')]);_0x1128b7[_0x01ac('0x31')]=_[_0x01ac('0x2f')](_0x50022f[_0x01ac('0x2b')],qs[_0x01ac('0x30')](_0x1ce4e2[_0x01ac('0x2e')][_0x01ac('0x30')]));_0x1128b7[_0x01ac('0x31')]=_0x1128b7['attributes'][_0x01ac('0x43')]?_0x1128b7[_0x01ac('0x31')]:_0x50022f[_0x01ac('0x2b')];if(_0x1ce4e2[_0x01ac('0x2e')][_0x01ac('0x3c')]){_0x1128b7['include']=[{'all':!![]}];}_0x1128b7=_[_0x01ac('0x38')]({},_0x1128b7,_0x1ce4e2[_0x01ac('0x3b')]);return db[_0x01ac('0x26')][_0x01ac('0x44')](_0x1128b7)['then'](handleEntityNotFound(_0x731db6,null))[_0x01ac('0x1e')](respondWithResult(_0x731db6,null))[_0x01ac('0x3f')](handleError(_0x731db6,null));};exports[_0x01ac('0x45')]=function(_0x34c07a,_0x1b2cd5){return db['Template'][_0x01ac('0x45')](_0x34c07a[_0x01ac('0x46')],{})[_0x01ac('0x1e')](function(_0x51237d){var _0x5c5dc2=_0x34c07a['user']['get']({'plain':!![]});if(!_0x5c5dc2)throw new Error(_0x01ac('0x47'));if(_0x5c5dc2[_0x01ac('0x48')]==='user'){var _0xbf7ebf=_0x51237d['get']({'plain':!![]});var _0x16f1b9='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x16f1b9,'userProfileId':_0x5c5dc2[_0x01ac('0x49')]},'raw':!![]})['then'](function(_0x5ae21b){if(_0x5ae21b&&_0x5ae21b['autoAssociation']===0x0){return db[_0x01ac('0x4a')][_0x01ac('0x45')]({'name':_0xbf7ebf['name'],'resourceId':_0xbf7ebf['id'],'type':_0x5ae21b[_0x01ac('0x2d')],'sectionId':_0x5ae21b['id']},{})[_0x01ac('0x1e')](function(){return _0x51237d;});}else{return _0x51237d;}})[_0x01ac('0x3f')](function(_0x52a690){logger['error'](_0x01ac('0x4b'),_0x52a690);throw _0x52a690;});}return _0x51237d;})[_0x01ac('0x1e')](respondWithResult(_0x1b2cd5,0xc9))['catch'](handleError(_0x1b2cd5,null));};exports[_0x01ac('0x1d')]=function(_0x37f4f4,_0x40adbf){if(_0x37f4f4['body']['id']){delete _0x37f4f4[_0x01ac('0x46')]['id'];}return db[_0x01ac('0x26')]['find']({'where':{'id':_0x37f4f4[_0x01ac('0x41')]['id']}})[_0x01ac('0x1e')](handleEntityNotFound(_0x40adbf,null))[_0x01ac('0x1e')](saveUpdates(_0x37f4f4[_0x01ac('0x46')],null))['then'](respondWithResult(_0x40adbf,null))['catch'](handleError(_0x40adbf,null));};exports[_0x01ac('0x20')]=function(_0x387872,_0x27f72f){return db[_0x01ac('0x26')][_0x01ac('0x44')]({'where':{'id':_0x387872[_0x01ac('0x41')]['id']}})['then'](handleEntityNotFound(_0x27f72f,null))['then'](removeEntity(_0x27f72f,null))[_0x01ac('0x3f')](handleError(_0x27f72f,null));}; \ No newline at end of file +var _0xf286=['request-promise','moment','bluebird','path','ejs','fs-extra','squel','crypto','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','end','error','stack','name','send','index','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','options','include','findAll','rows','Template','keys','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xf286,0x90));var _0x6f28=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xf286[_0x1b64dd];return _0xeb464c;};'use strict';var emlformat=require(_0x6f28('0x0'));var rimraf=require(_0x6f28('0x1'));var zipdir=require(_0x6f28('0x2'));var jsonpatch=require(_0x6f28('0x3'));var rp=require(_0x6f28('0x4'));var moment=require(_0x6f28('0x5'));var BPromise=require(_0x6f28('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f28('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f28('0x8'));var fs=require('fs');var fs_extra=require(_0x6f28('0x9'));var _=require('lodash');var squel=require(_0x6f28('0xa'));var crypto=require(_0x6f28('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f28('0xc'));var querystring=require(_0x6f28('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f28('0xe'));var as=require(_0x6f28('0xf'));var hardwareService=require(_0x6f28('0x10'));var logger=require(_0x6f28('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6f28('0x12'));var licenseUtil=require(_0x6f28('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x446a2d,_0x1599f5){_0x1599f5=_0x1599f5||0xcc;return function(_0x49f467){if(_0x49f467){return _0x446a2d['sendStatus'](_0x1599f5);}return _0x446a2d[_0x6f28('0x14')](_0x1599f5)['end']();};}function respondWithResult(_0x3fc3a4,_0x288224){_0x288224=_0x288224||0xc8;return function(_0x1c5702){if(_0x1c5702){return _0x3fc3a4[_0x6f28('0x14')](_0x288224)[_0x6f28('0x15')](_0x1c5702);}};}function respondWithFilteredResult(_0x4e0739,_0x488fdd){return function(_0xe0cb31){if(_0xe0cb31){var _0xfd3698=typeof _0x488fdd[_0x6f28('0x16')]===_0x6f28('0x17')&&typeof _0x488fdd[_0x6f28('0x18')]==='undefined';var _0x15b64b=_0xe0cb31[_0x6f28('0x19')];var _0x266e61=_0xfd3698?0x0:_0x488fdd[_0x6f28('0x16')];var _0x5e0292=_0xfd3698?_0xe0cb31[_0x6f28('0x19')]:_0x488fdd[_0x6f28('0x16')]+_0x488fdd['limit'];var _0x18fa71;if(_0x5e0292>=_0x15b64b){_0x5e0292=_0x15b64b;_0x18fa71=0xc8;}else{_0x18fa71=0xce;}_0x4e0739['status'](_0x18fa71);return _0x4e0739[_0x6f28('0x1a')](_0x6f28('0x1b'),_0x266e61+'-'+_0x5e0292+'/'+_0x15b64b)[_0x6f28('0x15')](_0xe0cb31);}return null;};}function patchUpdates(_0x57f52f){return function(_0x565a39){try{jsonpatch[_0x6f28('0x1c')](_0x565a39,_0x57f52f,!![]);}catch(_0x42cde2){return BPromise['reject'](_0x42cde2);}return _0x565a39[_0x6f28('0x1d')]();};}function saveUpdates(_0x517fdf,_0x3ddf1b){return function(_0xaa07f2){if(_0xaa07f2){return _0xaa07f2['update'](_0x517fdf)[_0x6f28('0x1e')](function(_0x1d45ed){return _0x1d45ed;});}return null;};}function removeEntity(_0x368911,_0x642397){return function(_0x52ec24){if(_0x52ec24){return _0x52ec24[_0x6f28('0x1f')]()[_0x6f28('0x1e')](function(){var _0x347815=_0x52ec24[_0x6f28('0x20')]({'plain':!![]});var _0x16c894='Templates';return db['UserProfileResource'][_0x6f28('0x1f')]({'where':{'type':_0x16c894,'resourceId':_0x347815['id']}})['then'](function(){return _0x52ec24;});})['then'](function(){_0x368911[_0x6f28('0x14')](0xcc)[_0x6f28('0x21')]();});}};}function handleEntityNotFound(_0x46fdd5,_0x59ea2e){return function(_0x1d3407){if(!_0x1d3407){_0x46fdd5['sendStatus'](0x194);}return _0x1d3407;};}function handleError(_0x5c9847,_0x3508f5){_0x3508f5=_0x3508f5||0x1f4;return function(_0x11d0e6){logger[_0x6f28('0x22')](_0x11d0e6[_0x6f28('0x23')]);if(_0x11d0e6[_0x6f28('0x24')]){delete _0x11d0e6[_0x6f28('0x24')];}_0x5c9847[_0x6f28('0x14')](_0x3508f5)[_0x6f28('0x25')](_0x11d0e6);};}exports[_0x6f28('0x26')]=function(_0x22e101,_0x436e3d){var _0x5412c2={},_0x21be7f={},_0x1f7718={'count':0x0,'rows':[]};var _0x4957fa=_['map'](db['Template'][_0x6f28('0x27')],function(_0x4aa95e){return{'name':_0x4aa95e['fieldName'],'type':_0x4aa95e['type'][_0x6f28('0x28')]};});_0x21be7f[_0x6f28('0x29')]=_[_0x6f28('0x2a')](_0x4957fa,_0x6f28('0x24'));_0x21be7f[_0x6f28('0x2b')]=_['keys'](_0x22e101[_0x6f28('0x2b')]);_0x21be7f[_0x6f28('0x2c')]=_[_0x6f28('0x2d')](_0x21be7f[_0x6f28('0x29')],_0x21be7f[_0x6f28('0x2b')]);_0x5412c2['attributes']=_[_0x6f28('0x2d')](_0x21be7f[_0x6f28('0x29')],qs[_0x6f28('0x2e')](_0x22e101[_0x6f28('0x2b')][_0x6f28('0x2e')]));_0x5412c2[_0x6f28('0x2f')]=_0x5412c2[_0x6f28('0x2f')][_0x6f28('0x30')]?_0x5412c2[_0x6f28('0x2f')]:_0x21be7f[_0x6f28('0x29')];if(!_0x22e101[_0x6f28('0x2b')][_0x6f28('0x31')](_0x6f28('0x32'))){_0x5412c2[_0x6f28('0x18')]=qs[_0x6f28('0x18')](_0x22e101[_0x6f28('0x2b')][_0x6f28('0x18')]);_0x5412c2[_0x6f28('0x16')]=qs[_0x6f28('0x16')](_0x22e101['query'][_0x6f28('0x16')]);}_0x5412c2[_0x6f28('0x33')]=qs[_0x6f28('0x34')](_0x22e101['query'][_0x6f28('0x34')]);_0x5412c2[_0x6f28('0x35')]=qs[_0x6f28('0x2c')](_['pick'](_0x22e101[_0x6f28('0x2b')],_0x21be7f['filters']),_0x4957fa);if(_0x22e101[_0x6f28('0x2b')]['filter']){_0x5412c2[_0x6f28('0x35')]=_[_0x6f28('0x36')](_0x5412c2[_0x6f28('0x35')],{'$or':_[_0x6f28('0x2a')](_0x4957fa,function(_0x38e792){if(_0x38e792[_0x6f28('0x37')]!=='VIRTUAL'){var _0x11644b={};_0x11644b[_0x38e792['name']]={'$like':'%'+_0x22e101[_0x6f28('0x2b')]['filter']+'%'};return _0x11644b;}})});}_0x5412c2=_[_0x6f28('0x36')]({},_0x5412c2,_0x22e101[_0x6f28('0x38')]);var _0x5446b0={'where':_0x5412c2[_0x6f28('0x35')]};return db['Template'][_0x6f28('0x19')](_0x5446b0)[_0x6f28('0x1e')](function(_0x60410d){_0x1f7718[_0x6f28('0x19')]=_0x60410d;if(_0x22e101[_0x6f28('0x2b')]['includeAll']){_0x5412c2[_0x6f28('0x39')]=[{'all':!![]}];}return db['Template'][_0x6f28('0x3a')](_0x5412c2);})[_0x6f28('0x1e')](function(_0x410272){_0x1f7718[_0x6f28('0x3b')]=_0x410272;return _0x1f7718;})['then'](respondWithFilteredResult(_0x436e3d,_0x5412c2))['catch'](handleError(_0x436e3d,null));};exports['show']=function(_0x26b9a4,_0x24ada1){var _0x49c7c3={'raw':!![],'where':{'id':_0x26b9a4['params']['id']}},_0x370301={};_0x370301[_0x6f28('0x29')]=_['keys'](db[_0x6f28('0x3c')][_0x6f28('0x27')]);_0x370301[_0x6f28('0x2b')]=_[_0x6f28('0x3d')](_0x26b9a4[_0x6f28('0x2b')]);_0x370301[_0x6f28('0x2c')]=_[_0x6f28('0x2d')](_0x370301[_0x6f28('0x29')],_0x370301[_0x6f28('0x2b')]);_0x49c7c3['attributes']=_[_0x6f28('0x2d')](_0x370301[_0x6f28('0x29')],qs['fields'](_0x26b9a4[_0x6f28('0x2b')]['fields']));_0x49c7c3['attributes']=_0x49c7c3[_0x6f28('0x2f')][_0x6f28('0x30')]?_0x49c7c3[_0x6f28('0x2f')]:_0x370301[_0x6f28('0x29')];if(_0x26b9a4[_0x6f28('0x2b')]['includeAll']){_0x49c7c3[_0x6f28('0x39')]=[{'all':!![]}];}_0x49c7c3=_[_0x6f28('0x36')]({},_0x49c7c3,_0x26b9a4[_0x6f28('0x38')]);return db[_0x6f28('0x3c')]['find'](_0x49c7c3)[_0x6f28('0x1e')](handleEntityNotFound(_0x24ada1,null))[_0x6f28('0x1e')](respondWithResult(_0x24ada1,null))[_0x6f28('0x3e')](handleError(_0x24ada1,null));};exports[_0x6f28('0x3f')]=function(_0x5eb8e5,_0xcff4dd){return db[_0x6f28('0x3c')][_0x6f28('0x3f')](_0x5eb8e5['body'],{})[_0x6f28('0x1e')](function(_0x356518){var _0x3f57b0=_0x5eb8e5[_0x6f28('0x40')][_0x6f28('0x20')]({'plain':!![]});if(!_0x3f57b0)throw new Error(_0x6f28('0x41'));if(_0x3f57b0['role']===_0x6f28('0x40')){var _0x4610a4=_0x356518[_0x6f28('0x20')]({'plain':!![]});var _0x18a515=_0x6f28('0x42');return db['UserProfileSection'][_0x6f28('0x43')]({'where':{'name':_0x18a515,'userProfileId':_0x3f57b0[_0x6f28('0x44')]},'raw':!![]})['then'](function(_0x5bfaec){if(_0x5bfaec&&_0x5bfaec['autoAssociation']===0x0){return db[_0x6f28('0x45')]['create']({'name':_0x4610a4[_0x6f28('0x24')],'resourceId':_0x4610a4['id'],'type':_0x5bfaec[_0x6f28('0x24')],'sectionId':_0x5bfaec['id']},{})['then'](function(){return _0x356518;});}else{return _0x356518;}})[_0x6f28('0x3e')](function(_0x1097a4){logger[_0x6f28('0x22')](_0x6f28('0x46'),_0x1097a4);throw _0x1097a4;});}return _0x356518;})['then'](respondWithResult(_0xcff4dd,0xc9))[_0x6f28('0x3e')](handleError(_0xcff4dd,null));};exports[_0x6f28('0x47')]=function(_0x432c83,_0x35f47c){if(_0x432c83[_0x6f28('0x48')]['id']){delete _0x432c83['body']['id'];}return db[_0x6f28('0x3c')]['find']({'where':{'id':_0x432c83[_0x6f28('0x49')]['id']}})[_0x6f28('0x1e')](handleEntityNotFound(_0x35f47c,null))[_0x6f28('0x1e')](saveUpdates(_0x432c83[_0x6f28('0x48')],null))[_0x6f28('0x1e')](respondWithResult(_0x35f47c,null))[_0x6f28('0x3e')](handleError(_0x35f47c,null));};exports[_0x6f28('0x1f')]=function(_0x6b156c,_0x2da280){return db[_0x6f28('0x3c')][_0x6f28('0x43')]({'where':{'id':_0x6b156c[_0x6f28('0x49')]['id']}})[_0x6f28('0x1e')](handleEntityNotFound(_0x2da280,null))[_0x6f28('0x1e')](removeEntity(_0x2da280,null))[_0x6f28('0x3e')](handleError(_0x2da280,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c3f8a71..788b99e 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 _0x8c48=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x151930,_0x534d26){var _0x743efc=function(_0x14afe8){while(--_0x14afe8){_0x151930['push'](_0x151930['shift']());}};_0x743efc(++_0x534d26);}(_0x8c48,0xb2));var _0x88c4=function(_0x153ee2,_0x4e3570){_0x153ee2=_0x153ee2-0x0;var _0x37db0d=_0x8c48[_0x153ee2];return _0x37db0d;};'use strict';var _=require(_0x88c4('0x0'));var util=require(_0x88c4('0x1'));var logger=require(_0x88c4('0x2'))(_0x88c4('0x3'));var moment=require('moment');var BPromise=require(_0x88c4('0x4'));var rp=require(_0x88c4('0x5'));var fs=require('fs');var path=require(_0x88c4('0x6'));var rimraf=require('rimraf');var config=require(_0x88c4('0x7'));var attributes=require(_0x88c4('0x8'));module[_0x88c4('0x9')]=function(_0xe2e64e,_0x30fe18){return _0xe2e64e[_0x88c4('0xa')]('Template',attributes,{'tableName':_0x88c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc98=['Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x59f628,_0xdeaae1){var _0x332501=function(_0x53613b){while(--_0x53613b){_0x59f628['push'](_0x59f628['shift']());}};_0x332501(++_0xdeaae1);}(_0xdc98,0x7a));var _0x8dc9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xdc98[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x8dc9('0x0'));var util=require(_0x8dc9('0x1'));var logger=require(_0x8dc9('0x2'))(_0x8dc9('0x3'));var moment=require(_0x8dc9('0x4'));var BPromise=require(_0x8dc9('0x5'));var rp=require(_0x8dc9('0x6'));var fs=require('fs');var path=require(_0x8dc9('0x7'));var rimraf=require(_0x8dc9('0x8'));var config=require(_0x8dc9('0x9'));var attributes=require(_0x8dc9('0xa'));module[_0x8dc9('0xb')]=function(_0x50ded1,_0x1760d7){return _0x50ded1[_0x8dc9('0xc')](_0x8dc9('0xd'),attributes,{'tableName':_0x8dc9('0xe'),'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 d8b5185..7e85992 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 _0x9ec9=['then','info','request\x20sent','debug','stringify','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x2d508a,_0x219313){var _0x3297bb=function(_0x52139d){while(--_0x52139d){_0x2d508a['push'](_0x2d508a['shift']());}};_0x3297bb(++_0x219313);}(_0x9ec9,0x8d));var _0x99ec=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0x9ec9[_0x110d59];return _0x2fce64;};'use strict';var _=require('lodash');var util=require(_0x99ec('0x0'));var moment=require('moment');var BPromise=require(_0x99ec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99ec('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x99ec('0x3'));var logger=require(_0x99ec('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x99ec('0x5'));var client=jayson[_0x99ec('0x6')][_0x99ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5acf6e,_0x2bccfd,_0x4c7885){return new BPromise(function(_0x3c4010,_0x29753a){return client[_0x99ec('0x8')](_0x5acf6e,_0x4c7885)[_0x99ec('0x9')](function(_0x172f24){logger[_0x99ec('0xa')]('Template,\x20%s,\x20%s',_0x2bccfd,_0x99ec('0xb'));logger[_0x99ec('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x2bccfd,_0x99ec('0xb'),JSON[_0x99ec('0xd')](_0x172f24));if(_0x172f24[_0x99ec('0xe')]){if(_0x172f24['error']['code']===0x1f4){logger['error'](_0x99ec('0xf'),_0x2bccfd,_0x172f24[_0x99ec('0xe')][_0x99ec('0x10')]);return _0x29753a(_0x172f24[_0x99ec('0xe')]['message']);}logger[_0x99ec('0xe')]('Template,\x20%s,\x20%s',_0x2bccfd,_0x172f24[_0x99ec('0xe')][_0x99ec('0x10')]);return _0x3c4010(_0x172f24[_0x99ec('0xe')]['message']);}else{logger['info']('Template,\x20%s,\x20%s',_0x2bccfd,'request\x20sent');_0x3c4010(_0x172f24[_0x99ec('0x11')][_0x99ec('0x10')]);}})[_0x99ec('0x12')](function(_0x2448f4){logger['error'](_0x99ec('0xf'),_0x2bccfd,_0x2448f4);_0x29753a(_0x2448f4);});});}exports[_0x99ec('0x13')]=function(_0x7b3dfd){var _0x1d774a=this;return new Promise(function(_0x263ce7,_0x42197c){return db[_0x99ec('0x14')][_0x99ec('0x15')]({'raw':_0x7b3dfd[_0x99ec('0x16')]?_0x7b3dfd[_0x99ec('0x16')][_0x99ec('0x17')]===undefined?!![]:![]:!![],'where':_0x7b3dfd[_0x99ec('0x16')]?_0x7b3dfd['options'][_0x99ec('0x18')]||null:null,'attributes':_0x7b3dfd[_0x99ec('0x16')]?_0x7b3dfd['options']['attributes']||null:null,'limit':_0x7b3dfd[_0x99ec('0x16')]?_0x7b3dfd[_0x99ec('0x16')][_0x99ec('0x19')]||null:null,'include':_0x7b3dfd['options']?_0x7b3dfd[_0x99ec('0x16')][_0x99ec('0x1a')]?_[_0x99ec('0x1b')](_0x7b3dfd[_0x99ec('0x16')][_0x99ec('0x1a')],function(_0x5e3083){return{'model':db[_0x5e3083['model']],'as':_0x5e3083['as'],'attributes':_0x5e3083['attributes'],'include':_0x5e3083[_0x99ec('0x1a')]?_['map'](_0x5e3083[_0x99ec('0x1a')],function(_0x1cdb1f){return{'model':db[_0x1cdb1f[_0x99ec('0x1c')]],'as':_0x1cdb1f['as'],'attributes':_0x1cdb1f[_0x99ec('0x1d')],'include':_0x1cdb1f[_0x99ec('0x1a')]?_[_0x99ec('0x1b')](_0x1cdb1f[_0x99ec('0x1a')],function(_0x290a3b){return{'model':db[_0x290a3b['model']],'as':_0x290a3b['as'],'attributes':_0x290a3b[_0x99ec('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x99ec('0x9')](function(_0x333ec8){logger[_0x99ec('0xa')]('GetTemplate',_0x7b3dfd);logger[_0x99ec('0xc')](_0x99ec('0x13'),_0x7b3dfd,JSON[_0x99ec('0xd')](_0x333ec8));_0x263ce7(_0x333ec8);})[_0x99ec('0x12')](function(_0x4e9615){logger[_0x99ec('0xe')](_0x99ec('0x13'),_0x4e9615[_0x99ec('0x10')],_0x7b3dfd);_0x42197c(_0x1d774a[_0x99ec('0xe')](0x1f4,_0x4e9615[_0x99ec('0x10')]));});});}; \ No newline at end of file +var _0x8427=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTemplate','findAll','options','raw','where','limit','include','map','model','attributes','then','lodash','util','moment'];(function(_0x2007c6,_0x18ae5b){var _0x5ec6a9=function(_0x2d86d2){while(--_0x2d86d2){_0x2007c6['push'](_0x2007c6['shift']());}};_0x5ec6a9(++_0x18ae5b);}(_0x8427,0x7d));var _0x7842=function(_0xdee95d,_0x23ff3a){_0xdee95d=_0xdee95d-0x0;var _0x86396d=_0x8427[_0xdee95d];return _0x86396d;};'use strict';var _=require(_0x7842('0x0'));var util=require(_0x7842('0x1'));var moment=require(_0x7842('0x2'));var BPromise=require('bluebird');var rs=require(_0x7842('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7842('0x4'))['db'];var utils=require(_0x7842('0x5'));var logger=require(_0x7842('0x6'))(_0x7842('0x7'));var config=require(_0x7842('0x8'));var jayson=require(_0x7842('0x9'));var client=jayson[_0x7842('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b8a9,_0x39c299,_0x518144){return new BPromise(function(_0x134d72,_0x3c781e){return client['request'](_0x27b8a9,_0x518144)['then'](function(_0x205d27){logger[_0x7842('0xb')](_0x7842('0xc'),_0x39c299,_0x7842('0xd'));logger[_0x7842('0xe')](_0x7842('0xf'),_0x39c299,_0x7842('0xd'),JSON[_0x7842('0x10')](_0x205d27));if(_0x205d27[_0x7842('0x11')]){if(_0x205d27['error'][_0x7842('0x12')]===0x1f4){logger[_0x7842('0x11')](_0x7842('0xc'),_0x39c299,_0x205d27['error'][_0x7842('0x13')]);return _0x3c781e(_0x205d27[_0x7842('0x11')][_0x7842('0x13')]);}logger[_0x7842('0x11')]('Template,\x20%s,\x20%s',_0x39c299,_0x205d27[_0x7842('0x11')][_0x7842('0x13')]);return _0x134d72(_0x205d27[_0x7842('0x11')][_0x7842('0x13')]);}else{logger[_0x7842('0xb')](_0x7842('0xc'),_0x39c299,'request\x20sent');_0x134d72(_0x205d27[_0x7842('0x14')][_0x7842('0x13')]);}})['catch'](function(_0x45bab4){logger[_0x7842('0x11')](_0x7842('0xc'),_0x39c299,_0x45bab4);_0x3c781e(_0x45bab4);});});}exports[_0x7842('0x15')]=function(_0x981f61){var _0x48ff54=this;return new Promise(function(_0x54ee44,_0xff4aa8){return db['Template'][_0x7842('0x16')]({'raw':_0x981f61['options']?_0x981f61[_0x7842('0x17')][_0x7842('0x18')]===undefined?!![]:![]:!![],'where':_0x981f61['options']?_0x981f61[_0x7842('0x17')][_0x7842('0x19')]||null:null,'attributes':_0x981f61[_0x7842('0x17')]?_0x981f61['options']['attributes']||null:null,'limit':_0x981f61[_0x7842('0x17')]?_0x981f61[_0x7842('0x17')][_0x7842('0x1a')]||null:null,'include':_0x981f61[_0x7842('0x17')]?_0x981f61[_0x7842('0x17')][_0x7842('0x1b')]?_[_0x7842('0x1c')](_0x981f61[_0x7842('0x17')][_0x7842('0x1b')],function(_0x39f22d){return{'model':db[_0x39f22d[_0x7842('0x1d')]],'as':_0x39f22d['as'],'attributes':_0x39f22d[_0x7842('0x1e')],'include':_0x39f22d[_0x7842('0x1b')]?_['map'](_0x39f22d['include'],function(_0x52b882){return{'model':db[_0x52b882[_0x7842('0x1d')]],'as':_0x52b882['as'],'attributes':_0x52b882[_0x7842('0x1e')],'include':_0x52b882[_0x7842('0x1b')]?_[_0x7842('0x1c')](_0x52b882[_0x7842('0x1b')],function(_0xd292a2){return{'model':db[_0xd292a2[_0x7842('0x1d')]],'as':_0xd292a2['as'],'attributes':_0xd292a2[_0x7842('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7842('0x1f')](function(_0x53820c){logger[_0x7842('0xb')](_0x7842('0x15'),_0x981f61);logger[_0x7842('0xe')](_0x7842('0x15'),_0x981f61,JSON[_0x7842('0x10')](_0x53820c));_0x54ee44(_0x53820c);})['catch'](function(_0x274cf6){logger[_0x7842('0x11')](_0x7842('0x15'),_0x274cf6[_0x7842('0x13')],_0x981f61);_0xff4aa8(_0x48ff54['error'](0x1f4,_0x274cf6[_0x7842('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 28b4991..74e0c71 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 _0x4732=['isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x1a19d8,_0x4f1d04){var _0xe88218=function(_0x43ca13){while(--_0x43ca13){_0x1a19d8['push'](_0x1a19d8['shift']());}};_0xe88218(++_0x4f1d04);}(_0x4732,0xf1));var _0x2473=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x4732[_0x26d6d9];return _0x1b4875;};'use strict';var multer=require(_0x2473('0x0'));var util=require('util');var path=require(_0x2473('0x1'));var timeout=require(_0x2473('0x2'));var express=require(_0x2473('0x3'));var router=express[_0x2473('0x4')]();var fs_extra=require(_0x2473('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2473('0x6'));var config=require(_0x2473('0x7'));var controller=require('./trigger.controller');router[_0x2473('0x8')]('/',auth['isAuthenticated'](),controller[_0x2473('0x9')]);router[_0x2473('0x8')](_0x2473('0xa'),auth[_0x2473('0xb')](),controller[_0x2473('0xc')]);router['get']('/:id/all_conditions',auth[_0x2473('0xb')](),controller[_0x2473('0xd')]);router[_0x2473('0x8')](_0x2473('0xe'),auth['isAuthenticated'](),controller[_0x2473('0xf')]);router[_0x2473('0x8')](_0x2473('0x10'),auth[_0x2473('0xb')](),controller['getActions']);router[_0x2473('0x11')]('/',auth['isAuthenticated'](),controller[_0x2473('0x12')]);router[_0x2473('0x11')](_0x2473('0x13'),auth[_0x2473('0xb')](),controller[_0x2473('0x14')]);router[_0x2473('0x11')](_0x2473('0xe'),auth[_0x2473('0xb')](),controller[_0x2473('0x15')]);router[_0x2473('0x11')](_0x2473('0x10'),auth['isAuthenticated'](),controller[_0x2473('0x16')]);router[_0x2473('0x17')]('/:id',auth[_0x2473('0xb')](),controller[_0x2473('0x18')]);router[_0x2473('0x19')](_0x2473('0xa'),auth[_0x2473('0xb')](),controller[_0x2473('0x1a')]);module[_0x2473('0x1b')]=router; \ No newline at end of file +var _0x7e74=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','delete','/:id','destroy','exports'];(function(_0x380cc9,_0x4466a8){var _0x2f9b38=function(_0xaa08c7){while(--_0xaa08c7){_0x380cc9['push'](_0x380cc9['shift']());}};_0x2f9b38(++_0x4466a8);}(_0x7e74,0xbd));var _0x47e7=function(_0x34b8bb,_0x4c16e2){_0x34b8bb=_0x34b8bb-0x0;var _0x178e80=_0x7e74[_0x34b8bb];return _0x178e80;};'use strict';var multer=require(_0x47e7('0x0'));var util=require('util');var path=require(_0x47e7('0x1'));var timeout=require(_0x47e7('0x2'));var express=require(_0x47e7('0x3'));var router=express[_0x47e7('0x4')]();var fs_extra=require(_0x47e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x47e7('0x6'));var config=require(_0x47e7('0x7'));var controller=require(_0x47e7('0x8'));router[_0x47e7('0x9')]('/',auth[_0x47e7('0xa')](),controller[_0x47e7('0xb')]);router[_0x47e7('0x9')]('/:id',auth[_0x47e7('0xa')](),controller['show']);router[_0x47e7('0x9')](_0x47e7('0xc'),auth[_0x47e7('0xa')](),controller[_0x47e7('0xd')]);router[_0x47e7('0x9')](_0x47e7('0xe'),auth[_0x47e7('0xa')](),controller[_0x47e7('0xf')]);router[_0x47e7('0x9')](_0x47e7('0x10'),auth[_0x47e7('0xa')](),controller[_0x47e7('0x11')]);router[_0x47e7('0x12')]('/',auth['isAuthenticated'](),controller[_0x47e7('0x13')]);router[_0x47e7('0x12')](_0x47e7('0xc'),auth['isAuthenticated'](),controller[_0x47e7('0x14')]);router[_0x47e7('0x12')](_0x47e7('0xe'),auth[_0x47e7('0xa')](),controller['addAnyCondition']);router[_0x47e7('0x12')](_0x47e7('0x10'),auth[_0x47e7('0xa')](),controller[_0x47e7('0x15')]);router[_0x47e7('0x16')]('/:id',auth[_0x47e7('0xa')](),controller['update']);router[_0x47e7('0x17')](_0x47e7('0x18'),auth[_0x47e7('0xa')](),controller[_0x47e7('0x19')]);module[_0x47e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 045ed82..4a33e25 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 _0x2535=['STRING','exports'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x2535,0xf1));var _0x5253=function(_0x595225,_0x296dfd){_0x595225=_0x595225-0x0;var _0x11cd17=_0x2535[_0x595225];return _0x11cd17;};'use strict';var Sequelize=require('sequelize');module[_0x5253('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5253('0x1')]},'description':{'type':Sequelize[_0x5253('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5ac4=['BOOLEAN','sequelize','exports','STRING'];(function(_0x41e62b,_0x36a196){var _0x1c7571=function(_0x5449cb){while(--_0x5449cb){_0x41e62b['push'](_0x41e62b['shift']());}};_0x1c7571(++_0x36a196);}(_0x5ac4,0x199));var _0x45ac=function(_0x3bdd9b,_0x578baf){_0x3bdd9b=_0x3bdd9b-0x0;var _0xfcad5d=_0x5ac4[_0x3bdd9b];return _0xfcad5d;};'use strict';var Sequelize=require(_0x45ac('0x0'));module[_0x45ac('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x45ac('0x2')]},'description':{'type':Sequelize[_0x45ac('0x2')]},'status':{'type':Sequelize[_0x45ac('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ac3ed72..4230c7f 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 _0xfe24=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','end','stack','name','send','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','update','Condition','findOne','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xfe24,0x1ab));var _0x4fe2=function(_0x5a6171,_0x576877){_0x5a6171=_0x5a6171-0x0;var _0x3c8e93=_0xfe24[_0x5a6171];return _0x3c8e93;};'use strict';var emlformat=require(_0x4fe2('0x0'));var rimraf=require(_0x4fe2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe2('0x2'));var rp=require('request-promise');var moment=require(_0x4fe2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4fe2('0x4'));var path=require(_0x4fe2('0x5'));var sox=require(_0x4fe2('0x6'));var csv=require(_0x4fe2('0x7'));var ejs=require(_0x4fe2('0x8'));var fs=require('fs');var fs_extra=require(_0x4fe2('0x9'));var _=require(_0x4fe2('0xa'));var squel=require(_0x4fe2('0xb'));var crypto=require('crypto');var jsforce=require(_0x4fe2('0xc'));var deskjs=require(_0x4fe2('0xd'));var toCsv=require(_0x4fe2('0x7'));var querystring=require(_0x4fe2('0xe'));var Papa=require(_0x4fe2('0xf'));var Redis=require(_0x4fe2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4fe2('0x11'));var as=require(_0x4fe2('0x12'));var hardwareService=require(_0x4fe2('0x13'));var logger=require('../../config/logger')(_0x4fe2('0x14'));var utils=require(_0x4fe2('0x15'));var config=require(_0x4fe2('0x16'));var licenseUtil=require(_0x4fe2('0x17'));var db=require(_0x4fe2('0x18'))['db'];function respondWithStatusCode(_0x4410bb,_0x3a163c){_0x3a163c=_0x3a163c||0xcc;return function(_0x52c3d0){if(_0x52c3d0){return _0x4410bb[_0x4fe2('0x19')](_0x3a163c);}return _0x4410bb[_0x4fe2('0x1a')](_0x3a163c)['end']();};}function respondWithResult(_0x18eed3,_0xe248ed){_0xe248ed=_0xe248ed||0xc8;return function(_0x4a9bf0){if(_0x4a9bf0){return _0x18eed3[_0x4fe2('0x1a')](_0xe248ed)[_0x4fe2('0x1b')](_0x4a9bf0);}};}function respondWithFilteredResult(_0x4dab34,_0x549baa){return function(_0x269a79){if(_0x269a79){var _0x3eb361=typeof _0x549baa[_0x4fe2('0x1c')]==='undefined'&&typeof _0x549baa['limit']==='undefined';var _0x354b1d=_0x269a79[_0x4fe2('0x1d')];var _0x3f1638=_0x3eb361?0x0:_0x549baa['offset'];var _0x243424=_0x3eb361?_0x269a79['count']:_0x549baa['offset']+_0x549baa[_0x4fe2('0x1e')];var _0x2574b7;if(_0x243424>=_0x354b1d){_0x243424=_0x354b1d;_0x2574b7=0xc8;}else{_0x2574b7=0xce;}_0x4dab34[_0x4fe2('0x1a')](_0x2574b7);return _0x4dab34['set']('Content-Range',_0x3f1638+'-'+_0x243424+'/'+_0x354b1d)[_0x4fe2('0x1b')](_0x269a79);}return null;};}function patchUpdates(_0x3f9ee3){return function(_0x4656dc){try{jsonpatch[_0x4fe2('0x1f')](_0x4656dc,_0x3f9ee3,!![]);}catch(_0xe5680){return BPromise[_0x4fe2('0x20')](_0xe5680);}return _0x4656dc[_0x4fe2('0x21')]();};}function saveUpdates(_0x44b49d,_0x1af3a6){return function(_0x59def6){if(_0x59def6){return _0x59def6['update'](_0x44b49d)[_0x4fe2('0x22')](function(_0x17fe71){return _0x17fe71;});}return null;};}function removeEntity(_0x2fcfd9,_0x310086){return function(_0x109d5f){if(_0x109d5f){return _0x109d5f[_0x4fe2('0x23')]()[_0x4fe2('0x22')](function(){var _0x1febc7=_0x109d5f[_0x4fe2('0x24')]({'plain':!![]});var _0x427750=_0x4fe2('0x25');return db[_0x4fe2('0x26')][_0x4fe2('0x23')]({'where':{'type':_0x427750,'resourceId':_0x1febc7['id']}})[_0x4fe2('0x22')](function(){return _0x109d5f;});})[_0x4fe2('0x22')](function(){_0x2fcfd9[_0x4fe2('0x1a')](0xcc)[_0x4fe2('0x27')]();});}};}function handleEntityNotFound(_0x5c9842,_0x449a76){return function(_0x256924){if(!_0x256924){_0x5c9842['sendStatus'](0x194);}return _0x256924;};}function handleError(_0xff1efc,_0x343eba){_0x343eba=_0x343eba||0x1f4;return function(_0x1cf25f){logger['error'](_0x1cf25f[_0x4fe2('0x28')]);if(_0x1cf25f[_0x4fe2('0x29')]){delete _0x1cf25f[_0x4fe2('0x29')];}_0xff1efc[_0x4fe2('0x1a')](_0x343eba)[_0x4fe2('0x2a')](_0x1cf25f);};}exports['index']=function(_0x1d9c3e,_0x211d1c){var _0x142503={},_0x17d1ff={},_0x2560ae={'count':0x0,'rows':[]};var _0x4264ca=_[_0x4fe2('0x2b')](db[_0x4fe2('0x2c')][_0x4fe2('0x2d')],function(_0x103263){return{'name':_0x103263[_0x4fe2('0x2e')],'type':_0x103263[_0x4fe2('0x2f')]['key']};});_0x17d1ff[_0x4fe2('0x30')]=_['map'](_0x4264ca,_0x4fe2('0x29'));_0x17d1ff[_0x4fe2('0x31')]=_[_0x4fe2('0x32')](_0x1d9c3e[_0x4fe2('0x31')]);_0x17d1ff[_0x4fe2('0x33')]=_[_0x4fe2('0x34')](_0x17d1ff[_0x4fe2('0x30')],_0x17d1ff[_0x4fe2('0x31')]);_0x142503[_0x4fe2('0x35')]=_[_0x4fe2('0x34')](_0x17d1ff['model'],qs[_0x4fe2('0x36')](_0x1d9c3e[_0x4fe2('0x31')][_0x4fe2('0x36')]));_0x142503['attributes']=_0x142503[_0x4fe2('0x35')][_0x4fe2('0x37')]?_0x142503[_0x4fe2('0x35')]:_0x17d1ff[_0x4fe2('0x30')];if(!_0x1d9c3e[_0x4fe2('0x31')][_0x4fe2('0x38')](_0x4fe2('0x39'))){_0x142503[_0x4fe2('0x1e')]=qs[_0x4fe2('0x1e')](_0x1d9c3e[_0x4fe2('0x31')]['limit']);_0x142503[_0x4fe2('0x1c')]=qs[_0x4fe2('0x1c')](_0x1d9c3e[_0x4fe2('0x31')][_0x4fe2('0x1c')]);}_0x142503[_0x4fe2('0x3a')]=qs[_0x4fe2('0x3b')](_0x1d9c3e[_0x4fe2('0x31')][_0x4fe2('0x3b')]);_0x142503[_0x4fe2('0x3c')]=qs[_0x4fe2('0x33')](_[_0x4fe2('0x3d')](_0x1d9c3e[_0x4fe2('0x31')],_0x17d1ff[_0x4fe2('0x33')]),_0x4264ca);if(_0x1d9c3e[_0x4fe2('0x31')]['filter']){_0x142503[_0x4fe2('0x3c')]=_['merge'](_0x142503[_0x4fe2('0x3c')],{'$or':_[_0x4fe2('0x2b')](_0x4264ca,function(_0x170362){if(_0x170362[_0x4fe2('0x2f')]!=='VIRTUAL'){var _0x168c47={};_0x168c47[_0x170362[_0x4fe2('0x29')]]={'$like':'%'+_0x1d9c3e[_0x4fe2('0x31')][_0x4fe2('0x3e')]+'%'};return _0x168c47;}})});}_0x142503=_[_0x4fe2('0x3f')]({},_0x142503,_0x1d9c3e[_0x4fe2('0x40')]);var _0x18f051={'where':_0x142503['where']};return db[_0x4fe2('0x2c')][_0x4fe2('0x1d')](_0x18f051)['then'](function(_0x4bab11){_0x2560ae['count']=_0x4bab11;if(_0x1d9c3e[_0x4fe2('0x31')][_0x4fe2('0x41')]){_0x142503[_0x4fe2('0x42')]=[{'all':!![]}];}return db[_0x4fe2('0x2c')]['findAll'](_0x142503);})[_0x4fe2('0x22')](function(_0x551ddc){_0x2560ae['rows']=_0x551ddc;return _0x2560ae;})['then'](respondWithFilteredResult(_0x211d1c,_0x142503))[_0x4fe2('0x43')](handleError(_0x211d1c,null));};exports[_0x4fe2('0x44')]=function(_0x3989fa,_0x3962ae){var _0x34e9b1={'raw':![],'where':{'id':_0x3989fa[_0x4fe2('0x45')]['id']}},_0x27c4b0={};_0x27c4b0[_0x4fe2('0x30')]=_[_0x4fe2('0x32')](db['Trigger'][_0x4fe2('0x2d')]);_0x27c4b0[_0x4fe2('0x31')]=_['keys'](_0x3989fa[_0x4fe2('0x31')]);_0x27c4b0[_0x4fe2('0x33')]=_[_0x4fe2('0x34')](_0x27c4b0['model'],_0x27c4b0['query']);_0x34e9b1['attributes']=_['intersection'](_0x27c4b0[_0x4fe2('0x30')],qs[_0x4fe2('0x36')](_0x3989fa['query'][_0x4fe2('0x36')]));_0x34e9b1[_0x4fe2('0x35')]=_0x34e9b1[_0x4fe2('0x35')][_0x4fe2('0x37')]?_0x34e9b1['attributes']:_0x27c4b0['model'];if(_0x3989fa[_0x4fe2('0x31')][_0x4fe2('0x41')]){_0x34e9b1[_0x4fe2('0x42')]=[{'all':!![]}];}_0x34e9b1=_[_0x4fe2('0x3f')]({},_0x34e9b1,_0x3989fa[_0x4fe2('0x40')]);return db[_0x4fe2('0x2c')][_0x4fe2('0x46')](_0x34e9b1)[_0x4fe2('0x22')](handleEntityNotFound(_0x3962ae,null))[_0x4fe2('0x22')](respondWithResult(_0x3962ae,null))[_0x4fe2('0x43')](handleError(_0x3962ae,null));};exports['create']=function(_0x491740,_0x5878d4){return db[_0x4fe2('0x2c')][_0x4fe2('0x47')](_0x491740[_0x4fe2('0x48')],{})[_0x4fe2('0x22')](function(_0x5dcf3f){var _0x4d1a17=_0x491740['user'][_0x4fe2('0x24')]({'plain':!![]});if(!_0x4d1a17)throw new Error(_0x4fe2('0x49'));if(_0x4d1a17[_0x4fe2('0x4a')]===_0x4fe2('0x4b')){var _0x476eeb=_0x5dcf3f[_0x4fe2('0x24')]({'plain':!![]});var _0x402d7e=_0x4fe2('0x25');return db[_0x4fe2('0x4c')][_0x4fe2('0x46')]({'where':{'name':_0x402d7e,'userProfileId':_0x4d1a17[_0x4fe2('0x4d')]},'raw':!![]})[_0x4fe2('0x22')](function(_0x4bea7a){if(_0x4bea7a&&_0x4bea7a['autoAssociation']===0x0){return db[_0x4fe2('0x26')][_0x4fe2('0x47')]({'name':_0x476eeb[_0x4fe2('0x29')],'resourceId':_0x476eeb['id'],'type':_0x4bea7a['name'],'sectionId':_0x4bea7a['id']},{})[_0x4fe2('0x22')](function(){return _0x5dcf3f;});}else{return _0x5dcf3f;}})['catch'](function(_0x5a5484){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a5484);throw _0x5a5484;});}return _0x5dcf3f;})[_0x4fe2('0x22')](respondWithResult(_0x5878d4,0xc9))['catch'](handleError(_0x5878d4,null));};exports[_0x4fe2('0x4e')]=function(_0x6fb06d,_0x6965af){if(_0x6fb06d[_0x4fe2('0x48')]['id']){delete _0x6fb06d[_0x4fe2('0x48')]['id'];}return db[_0x4fe2('0x2c')]['find']({'where':{'id':_0x6fb06d[_0x4fe2('0x45')]['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0x6965af,null))[_0x4fe2('0x22')](saveUpdates(_0x6fb06d[_0x4fe2('0x48')],null))[_0x4fe2('0x22')](respondWithResult(_0x6965af,null))[_0x4fe2('0x43')](handleError(_0x6965af,null));};exports['destroy']=function(_0x5a9bd9,_0x3d34cf){return db[_0x4fe2('0x2c')]['find']({'where':{'id':_0x5a9bd9[_0x4fe2('0x45')]['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0x3d34cf,null))['then'](removeEntity(_0x3d34cf,null))[_0x4fe2('0x43')](handleError(_0x3d34cf,null));};exports['addAllCondition']=function(_0x152ace,_0xaeefa3,_0x29c410){if(_0x152ace[_0x4fe2('0x48')]['id']){delete _0x152ace['body']['id'];}return db[_0x4fe2('0x2c')][_0x4fe2('0x46')]({'where':{'id':_0x152ace[_0x4fe2('0x45')]['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0xaeefa3,null))['then'](function(_0x8329a5){if(_0x8329a5){_0x152ace[_0x4fe2('0x48')]['TriggerAllId']=_0x8329a5['id'];return db[_0x4fe2('0x4f')][_0x4fe2('0x47')](_0x152ace[_0x4fe2('0x48')]);}})[_0x4fe2('0x22')](respondWithResult(_0xaeefa3,null))[_0x4fe2('0x43')](handleError(_0xaeefa3,null));};exports['addAnyCondition']=function(_0x2ab51b,_0x56de90,_0x1abc02){if(_0x2ab51b[_0x4fe2('0x48')]['id']){delete _0x2ab51b[_0x4fe2('0x48')]['id'];}return db[_0x4fe2('0x2c')][_0x4fe2('0x46')]({'where':{'id':_0x2ab51b[_0x4fe2('0x45')]['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0x56de90,null))['then'](function(_0x244152){if(_0x244152){_0x2ab51b['body']['TriggerAnyId']=_0x244152['id'];return db['Condition'][_0x4fe2('0x47')](_0x2ab51b[_0x4fe2('0x48')]);}})[_0x4fe2('0x22')](respondWithResult(_0x56de90,null))[_0x4fe2('0x43')](handleError(_0x56de90,null));};exports['getAllConditions']=function(_0x4f72a3,_0x564868,_0xd025b3){var _0x44cc9c={};var _0x18a6e5={};var _0xb21aeb;var _0x3d8712;return db[_0x4fe2('0x2c')][_0x4fe2('0x50')]({'where':{'id':_0x4f72a3['params']['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0x564868,null))[_0x4fe2('0x22')](function(_0x2dfd59){if(_0x2dfd59){_0xb21aeb=_0x2dfd59;_0x18a6e5['model']=_['keys'](db[_0x4fe2('0x4f')][_0x4fe2('0x2d')]);_0x18a6e5[_0x4fe2('0x31')]=_[_0x4fe2('0x32')](_0x4f72a3['query']);_0x18a6e5[_0x4fe2('0x33')]=_['intersection'](_0x18a6e5[_0x4fe2('0x30')],_0x18a6e5['query']);_0x44cc9c[_0x4fe2('0x35')]=_[_0x4fe2('0x34')](_0x18a6e5[_0x4fe2('0x30')],qs['fields'](_0x4f72a3[_0x4fe2('0x31')][_0x4fe2('0x36')]));_0x44cc9c[_0x4fe2('0x35')]=_0x44cc9c[_0x4fe2('0x35')][_0x4fe2('0x37')]?_0x44cc9c[_0x4fe2('0x35')]:_0x18a6e5['model'];_0x44cc9c[_0x4fe2('0x3a')]=qs[_0x4fe2('0x3b')](_0x4f72a3[_0x4fe2('0x31')][_0x4fe2('0x3b')]);_0x44cc9c['where']=qs[_0x4fe2('0x33')](_[_0x4fe2('0x3d')](_0x4f72a3[_0x4fe2('0x31')],_0x18a6e5[_0x4fe2('0x33')]));if(_0x4f72a3[_0x4fe2('0x31')]['filter']){_0x44cc9c[_0x4fe2('0x3c')]=_[_0x4fe2('0x3f')](_0x44cc9c[_0x4fe2('0x3c')],{'$or':_['map'](_0x44cc9c[_0x4fe2('0x35')],function(_0x38607a){var _0x39b7bc={};_0x39b7bc[_0x38607a]={'$like':'%'+_0x4f72a3[_0x4fe2('0x31')]['filter']+'%'};return _0x39b7bc;})});}_0x44cc9c=_[_0x4fe2('0x3f')]({},_0x44cc9c,_0x4f72a3['options']);return _0xb21aeb['getAllConditions'](_0x44cc9c);}})[_0x4fe2('0x22')](function(_0x15942a){if(_0x15942a){_0x3d8712=_0x15942a[_0x4fe2('0x37')];if(!_0x4f72a3[_0x4fe2('0x31')][_0x4fe2('0x38')](_0x4fe2('0x39'))){_0x44cc9c[_0x4fe2('0x1e')]=qs['limit'](_0x4f72a3['query'][_0x4fe2('0x1e')]);_0x44cc9c[_0x4fe2('0x1c')]=qs[_0x4fe2('0x1c')](_0x4f72a3[_0x4fe2('0x31')][_0x4fe2('0x1c')]);}return _0xb21aeb[_0x4fe2('0x51')](_0x44cc9c);}})[_0x4fe2('0x22')](function(_0xc627a3){if(_0xc627a3){return _0xc627a3?{'count':_0x3d8712,'rows':_0xc627a3}:null;}})[_0x4fe2('0x22')](respondWithResult(_0x564868,null))[_0x4fe2('0x43')](handleError(_0x564868,null));};exports['getAnyConditions']=function(_0x50673c,_0x1087e9,_0x559ca4){var _0x10f6df={};var _0x48bea3={};var _0x350327;var _0x27cc08;return db[_0x4fe2('0x2c')][_0x4fe2('0x50')]({'where':{'id':_0x50673c[_0x4fe2('0x45')]['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0x1087e9,null))[_0x4fe2('0x22')](function(_0x23f5e9){if(_0x23f5e9){_0x350327=_0x23f5e9;_0x48bea3[_0x4fe2('0x30')]=_[_0x4fe2('0x32')](db['Condition']['rawAttributes']);_0x48bea3[_0x4fe2('0x31')]=_[_0x4fe2('0x32')](_0x50673c[_0x4fe2('0x31')]);_0x48bea3[_0x4fe2('0x33')]=_[_0x4fe2('0x34')](_0x48bea3[_0x4fe2('0x30')],_0x48bea3['query']);_0x10f6df['attributes']=_[_0x4fe2('0x34')](_0x48bea3[_0x4fe2('0x30')],qs[_0x4fe2('0x36')](_0x50673c[_0x4fe2('0x31')][_0x4fe2('0x36')]));_0x10f6df[_0x4fe2('0x35')]=_0x10f6df[_0x4fe2('0x35')][_0x4fe2('0x37')]?_0x10f6df['attributes']:_0x48bea3[_0x4fe2('0x30')];_0x10f6df['order']=qs[_0x4fe2('0x3b')](_0x50673c[_0x4fe2('0x31')]['sort']);_0x10f6df[_0x4fe2('0x3c')]=qs['filters'](_['pick'](_0x50673c[_0x4fe2('0x31')],_0x48bea3[_0x4fe2('0x33')]));if(_0x50673c['query'][_0x4fe2('0x3e')]){_0x10f6df[_0x4fe2('0x3c')]=_[_0x4fe2('0x3f')](_0x10f6df[_0x4fe2('0x3c')],{'$or':_[_0x4fe2('0x2b')](_0x10f6df[_0x4fe2('0x35')],function(_0x46f14){var _0x28a78f={};_0x28a78f[_0x46f14]={'$like':'%'+_0x50673c['query'][_0x4fe2('0x3e')]+'%'};return _0x28a78f;})});}_0x10f6df=_[_0x4fe2('0x3f')]({},_0x10f6df,_0x50673c['options']);return _0x350327['getAnyConditions'](_0x10f6df);}})[_0x4fe2('0x22')](function(_0x34291c){if(_0x34291c){_0x27cc08=_0x34291c[_0x4fe2('0x37')];if(!_0x50673c[_0x4fe2('0x31')][_0x4fe2('0x38')](_0x4fe2('0x39'))){_0x10f6df[_0x4fe2('0x1e')]=qs[_0x4fe2('0x1e')](_0x50673c[_0x4fe2('0x31')][_0x4fe2('0x1e')]);_0x10f6df[_0x4fe2('0x1c')]=qs[_0x4fe2('0x1c')](_0x50673c[_0x4fe2('0x31')]['offset']);}return _0x350327[_0x4fe2('0x52')](_0x10f6df);}})[_0x4fe2('0x22')](function(_0x5da9ee){if(_0x5da9ee){return _0x5da9ee?{'count':_0x27cc08,'rows':_0x5da9ee}:null;}})[_0x4fe2('0x22')](respondWithResult(_0x1087e9,null))[_0x4fe2('0x43')](handleError(_0x1087e9,null));};exports[_0x4fe2('0x53')]=function(_0x429c52,_0x2323ce,_0x4559e9){if(_0x429c52[_0x4fe2('0x48')]['id']){delete _0x429c52[_0x4fe2('0x48')]['id'];}return db[_0x4fe2('0x2c')][_0x4fe2('0x46')]({'where':{'id':_0x429c52['params']['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0x2323ce,null))['then'](function(_0x52199a){if(_0x52199a){_0x429c52['body'][_0x4fe2('0x54')]=_0x52199a['id'];return db[_0x4fe2('0x55')][_0x4fe2('0x47')](_0x429c52[_0x4fe2('0x48')]);}})[_0x4fe2('0x22')](respondWithResult(_0x2323ce,null))[_0x4fe2('0x43')](handleError(_0x2323ce,null));};exports[_0x4fe2('0x56')]=function(_0x26a2bd,_0x265199,_0xb799e3){var _0x4f0ae4={};var _0x3cc090={};var _0x1b5997;var _0x223b4d;return db['Trigger'][_0x4fe2('0x50')]({'where':{'id':_0x26a2bd[_0x4fe2('0x45')]['id']}})[_0x4fe2('0x22')](handleEntityNotFound(_0x265199,null))[_0x4fe2('0x22')](function(_0x1a9d92){if(_0x1a9d92){_0x1b5997=_0x1a9d92;_0x3cc090['model']=_[_0x4fe2('0x32')](db[_0x4fe2('0x55')][_0x4fe2('0x2d')]);_0x3cc090[_0x4fe2('0x31')]=_[_0x4fe2('0x32')](_0x26a2bd['query']);_0x3cc090[_0x4fe2('0x33')]=_[_0x4fe2('0x34')](_0x3cc090['model'],_0x3cc090['query']);_0x4f0ae4[_0x4fe2('0x35')]=_[_0x4fe2('0x34')](_0x3cc090[_0x4fe2('0x30')],qs[_0x4fe2('0x36')](_0x26a2bd['query'][_0x4fe2('0x36')]));_0x4f0ae4[_0x4fe2('0x35')]=_0x4f0ae4['attributes'][_0x4fe2('0x37')]?_0x4f0ae4[_0x4fe2('0x35')]:_0x3cc090[_0x4fe2('0x30')];_0x4f0ae4[_0x4fe2('0x3a')]=qs[_0x4fe2('0x3b')](_0x26a2bd[_0x4fe2('0x31')]['sort']);_0x4f0ae4['where']=qs[_0x4fe2('0x33')](_[_0x4fe2('0x3d')](_0x26a2bd[_0x4fe2('0x31')],_0x3cc090[_0x4fe2('0x33')]));if(_0x26a2bd[_0x4fe2('0x31')]['filter']){_0x4f0ae4[_0x4fe2('0x3c')]=_['merge'](_0x4f0ae4['where'],{'$or':_[_0x4fe2('0x2b')](_0x4f0ae4[_0x4fe2('0x35')],function(_0x449a2a){var _0x53a51f={};_0x53a51f[_0x449a2a]={'$like':'%'+_0x26a2bd['query'][_0x4fe2('0x3e')]+'%'};return _0x53a51f;})});}_0x4f0ae4=_[_0x4fe2('0x3f')]({},_0x4f0ae4,_0x26a2bd[_0x4fe2('0x40')]);return _0x1b5997['getActions'](_0x4f0ae4);}})[_0x4fe2('0x22')](function(_0x116721){if(_0x116721){_0x223b4d=_0x116721['length'];if(!_0x26a2bd[_0x4fe2('0x31')][_0x4fe2('0x38')](_0x4fe2('0x39'))){_0x4f0ae4[_0x4fe2('0x1e')]=qs[_0x4fe2('0x1e')](_0x26a2bd[_0x4fe2('0x31')]['limit']);_0x4f0ae4[_0x4fe2('0x1c')]=qs[_0x4fe2('0x1c')](_0x26a2bd[_0x4fe2('0x31')]['offset']);}return _0x1b5997[_0x4fe2('0x56')](_0x4f0ae4);}})[_0x4fe2('0x22')](function(_0x4e97e7){if(_0x4e97e7){return _0x4e97e7?{'count':_0x223b4d,'rows':_0x4e97e7}:null;}})[_0x4fe2('0x22')](respondWithResult(_0x265199,null))[_0x4fe2('0x43')](handleError(_0x265199,null));}; \ No newline at end of file +var _0xdaee=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Triggers','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','rows','catch','keys','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','TriggerId','Action','rimraf'];(function(_0x13e210,_0x21ae57){var _0x5642b6=function(_0x5cb16e){while(--_0x5cb16e){_0x13e210['push'](_0x13e210['shift']());}};_0x5642b6(++_0x21ae57);}(_0xdaee,0x183));var _0xedae=function(_0x3c5d64,_0x4a80f7){_0x3c5d64=_0x3c5d64-0x0;var _0xad12cd=_0xdaee[_0x3c5d64];return _0xad12cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedae('0x0'));var zipdir=require(_0xedae('0x1'));var jsonpatch=require(_0xedae('0x2'));var rp=require(_0xedae('0x3'));var moment=require(_0xedae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xedae('0x5'));var util=require(_0xedae('0x6'));var path=require(_0xedae('0x7'));var sox=require(_0xedae('0x8'));var csv=require(_0xedae('0x9'));var ejs=require(_0xedae('0xa'));var fs=require('fs');var fs_extra=require(_0xedae('0xb'));var _=require(_0xedae('0xc'));var squel=require(_0xedae('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xedae('0xe'));var toCsv=require('to-csv');var querystring=require(_0xedae('0xf'));var Papa=require(_0xedae('0x10'));var Redis=require(_0xedae('0x11'));var authService=require(_0xedae('0x12'));var qs=require(_0xedae('0x13'));var as=require(_0xedae('0x14'));var hardwareService=require(_0xedae('0x15'));var logger=require('../../config/logger')(_0xedae('0x16'));var utils=require(_0xedae('0x17'));var config=require(_0xedae('0x18'));var licenseUtil=require(_0xedae('0x19'));var db=require(_0xedae('0x1a'))['db'];function respondWithStatusCode(_0x131d7e,_0x3ff74a){_0x3ff74a=_0x3ff74a||0xcc;return function(_0x591a76){if(_0x591a76){return _0x131d7e['sendStatus'](_0x3ff74a);}return _0x131d7e['status'](_0x3ff74a)[_0xedae('0x1b')]();};}function respondWithResult(_0x2ec6f5,_0x3f3f04){_0x3f3f04=_0x3f3f04||0xc8;return function(_0x5cbe8d){if(_0x5cbe8d){return _0x2ec6f5[_0xedae('0x1c')](_0x3f3f04)['json'](_0x5cbe8d);}};}function respondWithFilteredResult(_0x50f877,_0xb446c1){return function(_0x81a019){if(_0x81a019){var _0x19c891=typeof _0xb446c1[_0xedae('0x1d')]===_0xedae('0x1e')&&typeof _0xb446c1['limit']===_0xedae('0x1e');var _0x2a0c72=_0x81a019['count'];var _0x1eeb1a=_0x19c891?0x0:_0xb446c1['offset'];var _0x891606=_0x19c891?_0x81a019[_0xedae('0x1f')]:_0xb446c1[_0xedae('0x1d')]+_0xb446c1[_0xedae('0x20')];var _0x40d008;if(_0x891606>=_0x2a0c72){_0x891606=_0x2a0c72;_0x40d008=0xc8;}else{_0x40d008=0xce;}_0x50f877[_0xedae('0x1c')](_0x40d008);return _0x50f877[_0xedae('0x21')]('Content-Range',_0x1eeb1a+'-'+_0x891606+'/'+_0x2a0c72)['json'](_0x81a019);}return null;};}function patchUpdates(_0x4744d6){return function(_0x32c3c5){try{jsonpatch[_0xedae('0x22')](_0x32c3c5,_0x4744d6,!![]);}catch(_0x1be357){return BPromise[_0xedae('0x23')](_0x1be357);}return _0x32c3c5[_0xedae('0x24')]();};}function saveUpdates(_0x45e352,_0x3fbfbd){return function(_0x4a193a){if(_0x4a193a){return _0x4a193a[_0xedae('0x25')](_0x45e352)[_0xedae('0x26')](function(_0x24bbcd){return _0x24bbcd;});}return null;};}function removeEntity(_0x1ae249,_0x370caf){return function(_0x18be24){if(_0x18be24){return _0x18be24[_0xedae('0x27')]()[_0xedae('0x26')](function(){var _0x6024f2=_0x18be24[_0xedae('0x28')]({'plain':!![]});var _0x4ff35f=_0xedae('0x29');return db['UserProfileResource'][_0xedae('0x27')]({'where':{'type':_0x4ff35f,'resourceId':_0x6024f2['id']}})['then'](function(){return _0x18be24;});})['then'](function(){_0x1ae249['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x164fa7,_0x4dc6e5){return function(_0x2ee302){if(!_0x2ee302){_0x164fa7[_0xedae('0x2a')](0x194);}return _0x2ee302;};}function handleError(_0x587c89,_0x18ef1e){_0x18ef1e=_0x18ef1e||0x1f4;return function(_0x5bdd2f){logger[_0xedae('0x2b')](_0x5bdd2f[_0xedae('0x2c')]);if(_0x5bdd2f[_0xedae('0x2d')]){delete _0x5bdd2f['name'];}_0x587c89[_0xedae('0x1c')](_0x18ef1e)[_0xedae('0x2e')](_0x5bdd2f);};}exports[_0xedae('0x2f')]=function(_0x3685b1,_0x579652){var _0x6c302e={},_0x15dc1c={},_0x41e972={'count':0x0,'rows':[]};var _0x2c2630=_[_0xedae('0x30')](db[_0xedae('0x31')][_0xedae('0x32')],function(_0x37489a){return{'name':_0x37489a[_0xedae('0x33')],'type':_0x37489a['type'][_0xedae('0x34')]};});_0x15dc1c[_0xedae('0x35')]=_[_0xedae('0x30')](_0x2c2630,_0xedae('0x2d'));_0x15dc1c[_0xedae('0x36')]=_['keys'](_0x3685b1[_0xedae('0x36')]);_0x15dc1c[_0xedae('0x37')]=_['intersection'](_0x15dc1c[_0xedae('0x35')],_0x15dc1c['query']);_0x6c302e['attributes']=_[_0xedae('0x38')](_0x15dc1c[_0xedae('0x35')],qs[_0xedae('0x39')](_0x3685b1[_0xedae('0x36')][_0xedae('0x39')]));_0x6c302e[_0xedae('0x3a')]=_0x6c302e['attributes'][_0xedae('0x3b')]?_0x6c302e['attributes']:_0x15dc1c[_0xedae('0x35')];if(!_0x3685b1[_0xedae('0x36')][_0xedae('0x3c')](_0xedae('0x3d'))){_0x6c302e[_0xedae('0x20')]=qs['limit'](_0x3685b1['query'][_0xedae('0x20')]);_0x6c302e[_0xedae('0x1d')]=qs[_0xedae('0x1d')](_0x3685b1[_0xedae('0x36')][_0xedae('0x1d')]);}_0x6c302e['order']=qs[_0xedae('0x3e')](_0x3685b1[_0xedae('0x36')][_0xedae('0x3e')]);_0x6c302e[_0xedae('0x3f')]=qs[_0xedae('0x37')](_[_0xedae('0x40')](_0x3685b1['query'],_0x15dc1c[_0xedae('0x37')]),_0x2c2630);if(_0x3685b1[_0xedae('0x36')][_0xedae('0x41')]){_0x6c302e[_0xedae('0x3f')]=_['merge'](_0x6c302e[_0xedae('0x3f')],{'$or':_[_0xedae('0x30')](_0x2c2630,function(_0x408878){if(_0x408878[_0xedae('0x42')]!==_0xedae('0x43')){var _0x5891d9={};_0x5891d9[_0x408878['name']]={'$like':'%'+_0x3685b1[_0xedae('0x36')][_0xedae('0x41')]+'%'};return _0x5891d9;}})});}_0x6c302e=_[_0xedae('0x44')]({},_0x6c302e,_0x3685b1['options']);var _0x9a8d={'where':_0x6c302e['where']};return db[_0xedae('0x31')]['count'](_0x9a8d)[_0xedae('0x26')](function(_0x501dfd){_0x41e972[_0xedae('0x1f')]=_0x501dfd;if(_0x3685b1[_0xedae('0x36')][_0xedae('0x45')]){_0x6c302e[_0xedae('0x46')]=[{'all':!![]}];}return db[_0xedae('0x31')]['findAll'](_0x6c302e);})[_0xedae('0x26')](function(_0x4d0f75){_0x41e972[_0xedae('0x47')]=_0x4d0f75;return _0x41e972;})[_0xedae('0x26')](respondWithFilteredResult(_0x579652,_0x6c302e))[_0xedae('0x48')](handleError(_0x579652,null));};exports['show']=function(_0x16d43a,_0x302a0a){var _0x32624e={'raw':![],'where':{'id':_0x16d43a['params']['id']}},_0x42807b={};_0x42807b[_0xedae('0x35')]=_[_0xedae('0x49')](db[_0xedae('0x31')][_0xedae('0x32')]);_0x42807b['query']=_[_0xedae('0x49')](_0x16d43a[_0xedae('0x36')]);_0x42807b[_0xedae('0x37')]=_[_0xedae('0x38')](_0x42807b[_0xedae('0x35')],_0x42807b[_0xedae('0x36')]);_0x32624e['attributes']=_[_0xedae('0x38')](_0x42807b[_0xedae('0x35')],qs[_0xedae('0x39')](_0x16d43a['query'][_0xedae('0x39')]));_0x32624e[_0xedae('0x3a')]=_0x32624e[_0xedae('0x3a')]['length']?_0x32624e[_0xedae('0x3a')]:_0x42807b[_0xedae('0x35')];if(_0x16d43a[_0xedae('0x36')]['includeAll']){_0x32624e['include']=[{'all':!![]}];}_0x32624e=_[_0xedae('0x44')]({},_0x32624e,_0x16d43a[_0xedae('0x4a')]);return db[_0xedae('0x31')][_0xedae('0x4b')](_0x32624e)[_0xedae('0x26')](handleEntityNotFound(_0x302a0a,null))[_0xedae('0x26')](respondWithResult(_0x302a0a,null))[_0xedae('0x48')](handleError(_0x302a0a,null));};exports['create']=function(_0x6a12fe,_0x2be1fe){return db[_0xedae('0x31')]['create'](_0x6a12fe[_0xedae('0x4c')],{})['then'](function(_0x48fefc){var _0x4b587f=_0x6a12fe[_0xedae('0x4d')]['get']({'plain':!![]});if(!_0x4b587f)throw new Error(_0xedae('0x4e'));if(_0x4b587f[_0xedae('0x4f')]===_0xedae('0x4d')){var _0x95117f=_0x48fefc[_0xedae('0x28')]({'plain':!![]});var _0x131385=_0xedae('0x29');return db[_0xedae('0x50')][_0xedae('0x4b')]({'where':{'name':_0x131385,'userProfileId':_0x4b587f['userProfileId']},'raw':!![]})[_0xedae('0x26')](function(_0x22ad1e){if(_0x22ad1e&&_0x22ad1e[_0xedae('0x51')]===0x0){return db[_0xedae('0x52')][_0xedae('0x53')]({'name':_0x95117f[_0xedae('0x2d')],'resourceId':_0x95117f['id'],'type':_0x22ad1e[_0xedae('0x2d')],'sectionId':_0x22ad1e['id']},{})[_0xedae('0x26')](function(){return _0x48fefc;});}else{return _0x48fefc;}})[_0xedae('0x48')](function(_0x58521a){logger['error'](_0xedae('0x54'),_0x58521a);throw _0x58521a;});}return _0x48fefc;})['then'](respondWithResult(_0x2be1fe,0xc9))[_0xedae('0x48')](handleError(_0x2be1fe,null));};exports[_0xedae('0x25')]=function(_0x2c2744,_0x4cc087){if(_0x2c2744['body']['id']){delete _0x2c2744[_0xedae('0x4c')]['id'];}return db[_0xedae('0x31')][_0xedae('0x4b')]({'where':{'id':_0x2c2744['params']['id']}})['then'](handleEntityNotFound(_0x4cc087,null))[_0xedae('0x26')](saveUpdates(_0x2c2744['body'],null))[_0xedae('0x26')](respondWithResult(_0x4cc087,null))[_0xedae('0x48')](handleError(_0x4cc087,null));};exports['destroy']=function(_0x2a2f95,_0x4133f9){return db[_0xedae('0x31')][_0xedae('0x4b')]({'where':{'id':_0x2a2f95['params']['id']}})['then'](handleEntityNotFound(_0x4133f9,null))[_0xedae('0x26')](removeEntity(_0x4133f9,null))[_0xedae('0x48')](handleError(_0x4133f9,null));};exports['addAllCondition']=function(_0x311d28,_0x5d600d,_0x1224ea){if(_0x311d28[_0xedae('0x4c')]['id']){delete _0x311d28[_0xedae('0x4c')]['id'];}return db[_0xedae('0x31')]['find']({'where':{'id':_0x311d28[_0xedae('0x55')]['id']}})[_0xedae('0x26')](handleEntityNotFound(_0x5d600d,null))[_0xedae('0x26')](function(_0x44f537){if(_0x44f537){_0x311d28['body'][_0xedae('0x56')]=_0x44f537['id'];return db[_0xedae('0x57')][_0xedae('0x53')](_0x311d28['body']);}})[_0xedae('0x26')](respondWithResult(_0x5d600d,null))['catch'](handleError(_0x5d600d,null));};exports[_0xedae('0x58')]=function(_0x3dab46,_0x3f4a62,_0x11ae0b){if(_0x3dab46[_0xedae('0x4c')]['id']){delete _0x3dab46[_0xedae('0x4c')]['id'];}return db[_0xedae('0x31')][_0xedae('0x4b')]({'where':{'id':_0x3dab46[_0xedae('0x55')]['id']}})[_0xedae('0x26')](handleEntityNotFound(_0x3f4a62,null))['then'](function(_0x14bf8b){if(_0x14bf8b){_0x3dab46['body'][_0xedae('0x59')]=_0x14bf8b['id'];return db[_0xedae('0x57')][_0xedae('0x53')](_0x3dab46[_0xedae('0x4c')]);}})[_0xedae('0x26')](respondWithResult(_0x3f4a62,null))[_0xedae('0x48')](handleError(_0x3f4a62,null));};exports[_0xedae('0x5a')]=function(_0x20501d,_0x3298bc,_0x5163ff){var _0x4a97f2={};var _0x495625={};var _0x50ff4d;var _0x3f3ab5;return db['Trigger'][_0xedae('0x5b')]({'where':{'id':_0x20501d[_0xedae('0x55')]['id']}})[_0xedae('0x26')](handleEntityNotFound(_0x3298bc,null))[_0xedae('0x26')](function(_0x514d13){if(_0x514d13){_0x50ff4d=_0x514d13;_0x495625['model']=_['keys'](db['Condition']['rawAttributes']);_0x495625[_0xedae('0x36')]=_[_0xedae('0x49')](_0x20501d['query']);_0x495625[_0xedae('0x37')]=_['intersection'](_0x495625[_0xedae('0x35')],_0x495625[_0xedae('0x36')]);_0x4a97f2[_0xedae('0x3a')]=_[_0xedae('0x38')](_0x495625[_0xedae('0x35')],qs['fields'](_0x20501d['query'][_0xedae('0x39')]));_0x4a97f2[_0xedae('0x3a')]=_0x4a97f2[_0xedae('0x3a')][_0xedae('0x3b')]?_0x4a97f2[_0xedae('0x3a')]:_0x495625[_0xedae('0x35')];_0x4a97f2[_0xedae('0x5c')]=qs[_0xedae('0x3e')](_0x20501d[_0xedae('0x36')][_0xedae('0x3e')]);_0x4a97f2[_0xedae('0x3f')]=qs[_0xedae('0x37')](_[_0xedae('0x40')](_0x20501d[_0xedae('0x36')],_0x495625[_0xedae('0x37')]));if(_0x20501d[_0xedae('0x36')][_0xedae('0x41')]){_0x4a97f2[_0xedae('0x3f')]=_[_0xedae('0x44')](_0x4a97f2[_0xedae('0x3f')],{'$or':_[_0xedae('0x30')](_0x4a97f2[_0xedae('0x3a')],function(_0x460699){var _0x448bd3={};_0x448bd3[_0x460699]={'$like':'%'+_0x20501d[_0xedae('0x36')]['filter']+'%'};return _0x448bd3;})});}_0x4a97f2=_[_0xedae('0x44')]({},_0x4a97f2,_0x20501d[_0xedae('0x4a')]);return _0x50ff4d['getAllConditions'](_0x4a97f2);}})[_0xedae('0x26')](function(_0x4de28a){if(_0x4de28a){_0x3f3ab5=_0x4de28a[_0xedae('0x3b')];if(!_0x20501d[_0xedae('0x36')][_0xedae('0x3c')](_0xedae('0x3d'))){_0x4a97f2[_0xedae('0x20')]=qs['limit'](_0x20501d[_0xedae('0x36')][_0xedae('0x20')]);_0x4a97f2[_0xedae('0x1d')]=qs[_0xedae('0x1d')](_0x20501d[_0xedae('0x36')][_0xedae('0x1d')]);}return _0x50ff4d['getAllConditions'](_0x4a97f2);}})[_0xedae('0x26')](function(_0xd23438){if(_0xd23438){return _0xd23438?{'count':_0x3f3ab5,'rows':_0xd23438}:null;}})[_0xedae('0x26')](respondWithResult(_0x3298bc,null))['catch'](handleError(_0x3298bc,null));};exports[_0xedae('0x5d')]=function(_0x83942c,_0x2a171b,_0x3a1875){var _0x52b934={};var _0x42afdf={};var _0x43f3e4;var _0x43225e;return db[_0xedae('0x31')]['findOne']({'where':{'id':_0x83942c[_0xedae('0x55')]['id']}})[_0xedae('0x26')](handleEntityNotFound(_0x2a171b,null))[_0xedae('0x26')](function(_0x4ec09a){if(_0x4ec09a){_0x43f3e4=_0x4ec09a;_0x42afdf['model']=_[_0xedae('0x49')](db[_0xedae('0x57')]['rawAttributes']);_0x42afdf[_0xedae('0x36')]=_['keys'](_0x83942c[_0xedae('0x36')]);_0x42afdf[_0xedae('0x37')]=_[_0xedae('0x38')](_0x42afdf['model'],_0x42afdf[_0xedae('0x36')]);_0x52b934[_0xedae('0x3a')]=_[_0xedae('0x38')](_0x42afdf[_0xedae('0x35')],qs[_0xedae('0x39')](_0x83942c['query'][_0xedae('0x39')]));_0x52b934[_0xedae('0x3a')]=_0x52b934[_0xedae('0x3a')][_0xedae('0x3b')]?_0x52b934[_0xedae('0x3a')]:_0x42afdf['model'];_0x52b934[_0xedae('0x5c')]=qs[_0xedae('0x3e')](_0x83942c['query'][_0xedae('0x3e')]);_0x52b934[_0xedae('0x3f')]=qs[_0xedae('0x37')](_[_0xedae('0x40')](_0x83942c[_0xedae('0x36')],_0x42afdf[_0xedae('0x37')]));if(_0x83942c[_0xedae('0x36')][_0xedae('0x41')]){_0x52b934[_0xedae('0x3f')]=_[_0xedae('0x44')](_0x52b934[_0xedae('0x3f')],{'$or':_[_0xedae('0x30')](_0x52b934[_0xedae('0x3a')],function(_0x2d4cc8){var _0x1f442d={};_0x1f442d[_0x2d4cc8]={'$like':'%'+_0x83942c[_0xedae('0x36')][_0xedae('0x41')]+'%'};return _0x1f442d;})});}_0x52b934=_[_0xedae('0x44')]({},_0x52b934,_0x83942c[_0xedae('0x4a')]);return _0x43f3e4[_0xedae('0x5d')](_0x52b934);}})[_0xedae('0x26')](function(_0x3cad45){if(_0x3cad45){_0x43225e=_0x3cad45[_0xedae('0x3b')];if(!_0x83942c[_0xedae('0x36')]['hasOwnProperty'](_0xedae('0x3d'))){_0x52b934[_0xedae('0x20')]=qs[_0xedae('0x20')](_0x83942c[_0xedae('0x36')][_0xedae('0x20')]);_0x52b934[_0xedae('0x1d')]=qs[_0xedae('0x1d')](_0x83942c[_0xedae('0x36')][_0xedae('0x1d')]);}return _0x43f3e4[_0xedae('0x5d')](_0x52b934);}})['then'](function(_0x235734){if(_0x235734){return _0x235734?{'count':_0x43225e,'rows':_0x235734}:null;}})[_0xedae('0x26')](respondWithResult(_0x2a171b,null))[_0xedae('0x48')](handleError(_0x2a171b,null));};exports[_0xedae('0x5e')]=function(_0x278c7f,_0xd7a5c0,_0x541899){if(_0x278c7f[_0xedae('0x4c')]['id']){delete _0x278c7f[_0xedae('0x4c')]['id'];}return db[_0xedae('0x31')][_0xedae('0x4b')]({'where':{'id':_0x278c7f[_0xedae('0x55')]['id']}})[_0xedae('0x26')](handleEntityNotFound(_0xd7a5c0,null))[_0xedae('0x26')](function(_0x17016a){if(_0x17016a){_0x278c7f[_0xedae('0x4c')][_0xedae('0x5f')]=_0x17016a['id'];return db['Action']['create'](_0x278c7f[_0xedae('0x4c')]);}})[_0xedae('0x26')](respondWithResult(_0xd7a5c0,null))['catch'](handleError(_0xd7a5c0,null));};exports['getActions']=function(_0x58532f,_0x4654ac,_0x5c2b45){var _0x1cf4fa={};var _0xdaec22={};var _0x242631;var _0x132d70;return db[_0xedae('0x31')][_0xedae('0x5b')]({'where':{'id':_0x58532f[_0xedae('0x55')]['id']}})[_0xedae('0x26')](handleEntityNotFound(_0x4654ac,null))[_0xedae('0x26')](function(_0xf33ef5){if(_0xf33ef5){_0x242631=_0xf33ef5;_0xdaec22[_0xedae('0x35')]=_[_0xedae('0x49')](db[_0xedae('0x60')][_0xedae('0x32')]);_0xdaec22[_0xedae('0x36')]=_[_0xedae('0x49')](_0x58532f[_0xedae('0x36')]);_0xdaec22[_0xedae('0x37')]=_[_0xedae('0x38')](_0xdaec22[_0xedae('0x35')],_0xdaec22[_0xedae('0x36')]);_0x1cf4fa[_0xedae('0x3a')]=_['intersection'](_0xdaec22['model'],qs[_0xedae('0x39')](_0x58532f[_0xedae('0x36')]['fields']));_0x1cf4fa['attributes']=_0x1cf4fa[_0xedae('0x3a')]['length']?_0x1cf4fa[_0xedae('0x3a')]:_0xdaec22['model'];_0x1cf4fa[_0xedae('0x5c')]=qs[_0xedae('0x3e')](_0x58532f['query'][_0xedae('0x3e')]);_0x1cf4fa['where']=qs[_0xedae('0x37')](_[_0xedae('0x40')](_0x58532f['query'],_0xdaec22[_0xedae('0x37')]));if(_0x58532f['query'][_0xedae('0x41')]){_0x1cf4fa['where']=_[_0xedae('0x44')](_0x1cf4fa[_0xedae('0x3f')],{'$or':_['map'](_0x1cf4fa[_0xedae('0x3a')],function(_0x45b37a){var _0x2f5ec0={};_0x2f5ec0[_0x45b37a]={'$like':'%'+_0x58532f[_0xedae('0x36')][_0xedae('0x41')]+'%'};return _0x2f5ec0;})});}_0x1cf4fa=_[_0xedae('0x44')]({},_0x1cf4fa,_0x58532f['options']);return _0x242631['getActions'](_0x1cf4fa);}})['then'](function(_0x462944){if(_0x462944){_0x132d70=_0x462944[_0xedae('0x3b')];if(!_0x58532f['query'][_0xedae('0x3c')]('nolimit')){_0x1cf4fa[_0xedae('0x20')]=qs[_0xedae('0x20')](_0x58532f[_0xedae('0x36')][_0xedae('0x20')]);_0x1cf4fa['offset']=qs[_0xedae('0x1d')](_0x58532f[_0xedae('0x36')][_0xedae('0x1d')]);}return _0x242631['getActions'](_0x1cf4fa);}})[_0xedae('0x26')](function(_0x246d2e){if(_0x246d2e){return _0x246d2e?{'count':_0x132d70,'rows':_0x246d2e}:null;}})['then'](respondWithResult(_0x4654ac,null))[_0xedae('0x48')](handleError(_0x4654ac,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 20089a3..a31f773 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 _0x8b04=['./trigger.attributes','exports','define','tools_triggers','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x575313,_0x332159){var _0x44d907=function(_0x35d921){while(--_0x35d921){_0x575313['push'](_0x575313['shift']());}};_0x44d907(++_0x332159);}(_0x8b04,0x130));var _0x48b0=function(_0x295fff,_0x507dcc){_0x295fff=_0x295fff-0x0;var _0x247843=_0x8b04[_0x295fff];return _0x247843;};'use strict';var _=require(_0x48b0('0x0'));var util=require(_0x48b0('0x1'));var logger=require('../../config/logger')(_0x48b0('0x2'));var moment=require('moment');var BPromise=require(_0x48b0('0x3'));var rp=require(_0x48b0('0x4'));var fs=require('fs');var path=require(_0x48b0('0x5'));var rimraf=require(_0x48b0('0x6'));var config=require(_0x48b0('0x7'));var attributes=require(_0x48b0('0x8'));module[_0x48b0('0x9')]=function(_0x43e21c,_0x357849){return _0x43e21c[_0x48b0('0xa')]('Trigger',attributes,{'tableName':_0x48b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','tools_triggers'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0a12,0xb8));var _0x20a1=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x0a12[_0x4e6ae6];return _0x23c108;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('Trigger',attributes,{'tableName':_0x20a1('0x7'),'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 4e28720..c1da68d 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 _0x3a75=['options','raw','where','limit','include','map','model','attributes','debug','find','ShowTrigger','lodash','util','moment','ioredis','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x3a75,0xe4));var _0x53a7=function(_0x58518c,_0x246ed6){_0x58518c=_0x58518c-0x0;var _0x4192c8=_0x3a75[_0x58518c];return _0x4192c8;};'use strict';var _=require(_0x53a7('0x0'));var util=require(_0x53a7('0x1'));var moment=require(_0x53a7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53a7('0x4'));var config=require(_0x53a7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x53a7('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d76f,_0x9659be,_0x8b32de){return new BPromise(function(_0x3f7ea8,_0x5dd2cb){return client[_0x53a7('0x7')](_0x53d76f,_0x8b32de)[_0x53a7('0x8')](function(_0x577156){logger[_0x53a7('0x9')]('Trigger,\x20%s,\x20%s',_0x9659be,_0x53a7('0xa'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x9659be,_0x53a7('0xa'),JSON[_0x53a7('0xb')](_0x577156));if(_0x577156[_0x53a7('0xc')]){if(_0x577156[_0x53a7('0xc')][_0x53a7('0xd')]===0x1f4){logger['error'](_0x53a7('0xe'),_0x9659be,_0x577156[_0x53a7('0xc')][_0x53a7('0xf')]);return _0x5dd2cb(_0x577156['error'][_0x53a7('0xf')]);}logger[_0x53a7('0xc')](_0x53a7('0xe'),_0x9659be,_0x577156['error'][_0x53a7('0xf')]);return _0x3f7ea8(_0x577156[_0x53a7('0xc')][_0x53a7('0xf')]);}else{logger[_0x53a7('0x9')](_0x53a7('0xe'),_0x9659be,_0x53a7('0xa'));_0x3f7ea8(_0x577156[_0x53a7('0x10')][_0x53a7('0xf')]);}})[_0x53a7('0x11')](function(_0x35b3c0){logger[_0x53a7('0xc')]('Trigger,\x20%s,\x20%s',_0x9659be,_0x35b3c0);_0x5dd2cb(_0x35b3c0);});});}exports[_0x53a7('0x12')]=function(_0x337a64){var _0x5cf3f1=this;return new Promise(function(_0x29cd73,_0x331aa7){return db['Trigger'][_0x53a7('0x13')]({'raw':_0x337a64[_0x53a7('0x14')]?_0x337a64[_0x53a7('0x14')][_0x53a7('0x15')]===undefined?!![]:![]:!![],'where':_0x337a64[_0x53a7('0x14')]?_0x337a64['options'][_0x53a7('0x16')]||null:null,'attributes':_0x337a64[_0x53a7('0x14')]?_0x337a64[_0x53a7('0x14')]['attributes']||null:null,'limit':_0x337a64[_0x53a7('0x14')]?_0x337a64[_0x53a7('0x14')][_0x53a7('0x17')]||null:null,'include':_0x337a64[_0x53a7('0x14')]?_0x337a64[_0x53a7('0x14')][_0x53a7('0x18')]?_[_0x53a7('0x19')](_0x337a64[_0x53a7('0x14')]['include'],function(_0x837eb1){return{'model':db[_0x837eb1[_0x53a7('0x1a')]],'as':_0x837eb1['as'],'attributes':_0x837eb1[_0x53a7('0x1b')],'include':_0x837eb1['include']?_[_0x53a7('0x19')](_0x837eb1['include'],function(_0x143474){return{'model':db[_0x143474[_0x53a7('0x1a')]],'as':_0x143474['as'],'attributes':_0x143474[_0x53a7('0x1b')],'include':_0x143474[_0x53a7('0x18')]?_['map'](_0x143474[_0x53a7('0x18')],function(_0x5c4e58){return{'model':db[_0x5c4e58[_0x53a7('0x1a')]],'as':_0x5c4e58['as'],'attributes':_0x5c4e58[_0x53a7('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x516611){logger['info'](_0x53a7('0x12'),_0x337a64);logger[_0x53a7('0x1c')](_0x53a7('0x12'),_0x337a64,JSON['stringify'](_0x516611));_0x29cd73(_0x516611);})['catch'](function(_0x458b52){logger[_0x53a7('0xc')](_0x53a7('0x12'),_0x458b52[_0x53a7('0xf')],_0x337a64);_0x331aa7(_0x5cf3f1[_0x53a7('0xc')](0x1f4,_0x458b52[_0x53a7('0xf')]));});});};exports['ShowTrigger']=function(_0x11eac5){var _0x49cf64=this;return new Promise(function(_0x87f552,_0x375fa2){return db['Trigger'][_0x53a7('0x1d')]({'raw':_0x11eac5[_0x53a7('0x14')]?_0x11eac5['options'][_0x53a7('0x15')]===undefined?!![]:![]:!![],'where':_0x11eac5[_0x53a7('0x14')]?_0x11eac5[_0x53a7('0x14')]['where']||null:null,'attributes':_0x11eac5[_0x53a7('0x14')]?_0x11eac5['options'][_0x53a7('0x1b')]||null:null,'include':_0x11eac5[_0x53a7('0x14')]?_0x11eac5[_0x53a7('0x14')][_0x53a7('0x18')]?_[_0x53a7('0x19')](_0x11eac5[_0x53a7('0x14')][_0x53a7('0x18')],function(_0x2e9bc7){return{'model':db[_0x2e9bc7[_0x53a7('0x1a')]],'as':_0x2e9bc7['as'],'attributes':_0x2e9bc7[_0x53a7('0x1b')],'include':_0x2e9bc7['include']?_[_0x53a7('0x19')](_0x2e9bc7[_0x53a7('0x18')],function(_0x490881){return{'model':db[_0x490881[_0x53a7('0x1a')]],'as':_0x490881['as'],'attributes':_0x490881[_0x53a7('0x1b')],'include':_0x490881[_0x53a7('0x18')]?_[_0x53a7('0x19')](_0x490881[_0x53a7('0x18')],function(_0x89a1fc){return{'model':db[_0x89a1fc[_0x53a7('0x1a')]],'as':_0x89a1fc['as'],'attributes':_0x89a1fc[_0x53a7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x53a7('0x8')](function(_0x3feb98){logger['info']('ShowTrigger',_0x11eac5);logger[_0x53a7('0x1c')]('ShowTrigger',_0x11eac5,JSON[_0x53a7('0xb')](_0x3feb98));_0x87f552(_0x3feb98);})['catch'](function(_0x19dfae){logger[_0x53a7('0xc')](_0x53a7('0x1e'),_0x19dfae['message'],_0x11eac5);_0x375fa2(_0x49cf64['error'](0x1f4,_0x19dfae[_0x53a7('0xf')]));});});}; \ No newline at end of file +var _0x3355=['raw','where','attributes','include','map','model','GetTrigger','stringify','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','Trigger','findAll','options'];(function(_0x39b07e,_0x33b057){var _0x591dae=function(_0x5bdec5){while(--_0x5bdec5){_0x39b07e['push'](_0x39b07e['shift']());}};_0x591dae(++_0x33b057);}(_0x3355,0x9e));var _0x5335=function(_0x59b0f3,_0x1f6388){_0x59b0f3=_0x59b0f3-0x0;var _0x150d5c=_0x3355[_0x59b0f3];return _0x150d5c;};'use strict';var _=require(_0x5335('0x0'));var util=require(_0x5335('0x1'));var moment=require(_0x5335('0x2'));var BPromise=require(_0x5335('0x3'));var rs=require(_0x5335('0x4'));var fs=require('fs');var Redis=require(_0x5335('0x5'));var db=require(_0x5335('0x6'))['db'];var utils=require(_0x5335('0x7'));var logger=require(_0x5335('0x8'))(_0x5335('0x9'));var config=require(_0x5335('0xa'));var jayson=require(_0x5335('0xb'));var client=jayson['client'][_0x5335('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23868a,_0x3fe8fc,_0x23fae1){return new BPromise(function(_0x2f9f60,_0x31281b){return client[_0x5335('0xd')](_0x23868a,_0x23fae1)[_0x5335('0xe')](function(_0x4a8652){logger[_0x5335('0xf')](_0x5335('0x10'),_0x3fe8fc,'request\x20sent');logger[_0x5335('0x11')](_0x5335('0x12'),_0x3fe8fc,_0x5335('0x13'),JSON['stringify'](_0x4a8652));if(_0x4a8652['error']){if(_0x4a8652[_0x5335('0x14')][_0x5335('0x15')]===0x1f4){logger[_0x5335('0x14')]('Trigger,\x20%s,\x20%s',_0x3fe8fc,_0x4a8652[_0x5335('0x14')][_0x5335('0x16')]);return _0x31281b(_0x4a8652[_0x5335('0x14')]['message']);}logger['error'](_0x5335('0x10'),_0x3fe8fc,_0x4a8652[_0x5335('0x14')]['message']);return _0x2f9f60(_0x4a8652[_0x5335('0x14')]['message']);}else{logger[_0x5335('0xf')](_0x5335('0x10'),_0x3fe8fc,'request\x20sent');_0x2f9f60(_0x4a8652['result'][_0x5335('0x16')]);}})[_0x5335('0x17')](function(_0x30f0f6){logger[_0x5335('0x14')](_0x5335('0x10'),_0x3fe8fc,_0x30f0f6);_0x31281b(_0x30f0f6);});});}exports['GetTrigger']=function(_0x40661a){var _0x294835=this;return new Promise(function(_0x5e0d1e,_0x7ffd26){return db[_0x5335('0x18')][_0x5335('0x19')]({'raw':_0x40661a['options']?_0x40661a[_0x5335('0x1a')][_0x5335('0x1b')]===undefined?!![]:![]:!![],'where':_0x40661a[_0x5335('0x1a')]?_0x40661a[_0x5335('0x1a')][_0x5335('0x1c')]||null:null,'attributes':_0x40661a['options']?_0x40661a['options'][_0x5335('0x1d')]||null:null,'limit':_0x40661a[_0x5335('0x1a')]?_0x40661a[_0x5335('0x1a')]['limit']||null:null,'include':_0x40661a['options']?_0x40661a[_0x5335('0x1a')][_0x5335('0x1e')]?_[_0x5335('0x1f')](_0x40661a[_0x5335('0x1a')][_0x5335('0x1e')],function(_0x33809a){return{'model':db[_0x33809a['model']],'as':_0x33809a['as'],'attributes':_0x33809a[_0x5335('0x1d')],'include':_0x33809a[_0x5335('0x1e')]?_['map'](_0x33809a[_0x5335('0x1e')],function(_0x761ec9){return{'model':db[_0x761ec9[_0x5335('0x20')]],'as':_0x761ec9['as'],'attributes':_0x761ec9[_0x5335('0x1d')],'include':_0x761ec9[_0x5335('0x1e')]?_[_0x5335('0x1f')](_0x761ec9[_0x5335('0x1e')],function(_0x370a6c){return{'model':db[_0x370a6c['model']],'as':_0x370a6c['as'],'attributes':_0x370a6c[_0x5335('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5335('0xe')](function(_0x27e425){logger[_0x5335('0xf')](_0x5335('0x21'),_0x40661a);logger['debug'](_0x5335('0x21'),_0x40661a,JSON[_0x5335('0x22')](_0x27e425));_0x5e0d1e(_0x27e425);})[_0x5335('0x17')](function(_0x4c3037){logger[_0x5335('0x14')](_0x5335('0x21'),_0x4c3037['message'],_0x40661a);_0x7ffd26(_0x294835['error'](0x1f4,_0x4c3037[_0x5335('0x16')]));});});};exports[_0x5335('0x23')]=function(_0x1ebf91){var _0x34c4a5=this;return new Promise(function(_0x2efe28,_0x991e5f){return db[_0x5335('0x18')][_0x5335('0x24')]({'raw':_0x1ebf91['options']?_0x1ebf91[_0x5335('0x1a')][_0x5335('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ebf91[_0x5335('0x1a')]?_0x1ebf91[_0x5335('0x1a')][_0x5335('0x1c')]||null:null,'attributes':_0x1ebf91[_0x5335('0x1a')]?_0x1ebf91[_0x5335('0x1a')]['attributes']||null:null,'include':_0x1ebf91['options']?_0x1ebf91[_0x5335('0x1a')][_0x5335('0x1e')]?_['map'](_0x1ebf91['options'][_0x5335('0x1e')],function(_0x65bcc4){return{'model':db[_0x65bcc4['model']],'as':_0x65bcc4['as'],'attributes':_0x65bcc4['attributes'],'include':_0x65bcc4[_0x5335('0x1e')]?_[_0x5335('0x1f')](_0x65bcc4[_0x5335('0x1e')],function(_0x5a1b88){return{'model':db[_0x5a1b88['model']],'as':_0x5a1b88['as'],'attributes':_0x5a1b88[_0x5335('0x1d')],'include':_0x5a1b88[_0x5335('0x1e')]?_[_0x5335('0x1f')](_0x5a1b88[_0x5335('0x1e')],function(_0x132e44){return{'model':db[_0x132e44[_0x5335('0x20')]],'as':_0x132e44['as'],'attributes':_0x132e44[_0x5335('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x567adc){logger[_0x5335('0xf')]('ShowTrigger',_0x1ebf91);logger[_0x5335('0x11')](_0x5335('0x23'),_0x1ebf91,JSON[_0x5335('0x22')](_0x567adc));_0x2efe28(_0x567adc);})[_0x5335('0x17')](function(_0xde4baf){logger[_0x5335('0x14')](_0x5335('0x23'),_0xde4baf['message'],_0x1ebf91);_0x991e5f(_0x34c4a5[_0x5335('0x14')](0x1f4,_0xde4baf[_0x5335('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 51f5ce6..8e20aa0 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 _0x4797=['update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','clone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4797,0x1c5));var _0x7479=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4797[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x7479('0x0'));var path=require(_0x7479('0x1'));var timeout=require(_0x7479('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7479('0x3'));var auth=require(_0x7479('0x4'));var interaction=require(_0x7479('0x5'));var config=require(_0x7479('0x6'));var controller=require(_0x7479('0x7'));router[_0x7479('0x8')]('/',auth[_0x7479('0x9')](),controller['index']);router[_0x7479('0x8')](_0x7479('0xa'),auth[_0x7479('0x9')](),controller[_0x7479('0xb')]);router[_0x7479('0xc')](_0x7479('0xd'),auth['isAuthenticated'](),controller[_0x7479('0xe')]);router[_0x7479('0xc')]('/',auth[_0x7479('0x9')](),controller['create']);router['put'](_0x7479('0xa'),auth[_0x7479('0x9')](),controller[_0x7479('0xf')]);router['delete'](_0x7479('0xa'),auth[_0x7479('0x9')](),controller[_0x7479('0x10')]);module[_0x7479('0x11')]=router; \ No newline at end of file +var _0x4332=['./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb56a21,_0x3093c7){var _0x121573=function(_0x4bb965){while(--_0x4bb965){_0xb56a21['push'](_0xb56a21['shift']());}};_0x121573(++_0x3093c7);}(_0x4332,0x1d8));var _0x2433=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4332[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2433('0x0'));var timeout=require(_0x2433('0x1'));var express=require(_0x2433('0x2'));var router=express[_0x2433('0x3')]();var fs_extra=require(_0x2433('0x4'));var auth=require(_0x2433('0x5'));var interaction=require(_0x2433('0x6'));var config=require(_0x2433('0x7'));var controller=require(_0x2433('0x8'));router[_0x2433('0x9')]('/',auth[_0x2433('0xa')](),controller[_0x2433('0xb')]);router[_0x2433('0x9')](_0x2433('0xc'),auth[_0x2433('0xa')](),controller['show']);router[_0x2433('0xd')](_0x2433('0xe'),auth[_0x2433('0xa')](),controller[_0x2433('0xf')]);router[_0x2433('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2433('0x10')](_0x2433('0xc'),auth['isAuthenticated'](),controller[_0x2433('0x11')]);router[_0x2433('0x12')](_0x2433('0xc'),auth[_0x2433('0xa')](),controller[_0x2433('0x13')]);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 b0c5bcd..3ba81d2 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 _0x6593=['shortinfo','inband','auto','rfc2833','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai','fingerprint','active','passive','actpass','update,nonat','BOOLEAN','exports','name','ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info'];(function(_0x4fb306,_0x2c94a4){var _0x3110d6=function(_0xbb4fc1){while(--_0xbb4fc1){_0x4fb306['push'](_0x4fb306['shift']());}};_0x3110d6(++_0x2c94a4);}(_0x6593,0x1c4));var _0x3659=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0x6593[_0x7880d2];return _0x35ebbe;};'use strict';var Sequelize=require('sequelize');module[_0x3659('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3659('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x3'),'user',_0x3659('0x4')),'allowNull':![],'defaultValue':_0x3659('0x3')},'context':{'type':Sequelize[_0x3659('0x5')],'allowNull':![],'defaultValue':_0x3659('0x6')},'callingpres':{'type':Sequelize[_0x3659('0x2')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x3659('0x7'),'ALLOWED',_0x3659('0x8'),_0x3659('0x9'),_0x3659('0xa'),_0x3659('0xb'))},'deny':{'type':Sequelize[_0x3659('0x5')]},'permit':{'type':Sequelize[_0x3659('0x5')]},'secret':{'type':Sequelize[_0x3659('0x5')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x3659('0x5')]},'transport':{'type':Sequelize[_0x3659('0x5')],'defaultValue':_0x3659('0xc'),'set':function(_0x128548){this[_0x3659('0xd')]('transport',_0x128548?_0x128548['join'](','):null);},'get':function(){return this[_0x3659('0xe')]('transport')?this['getDataValue'](_0x3659('0xf'))['split'](','):null;},'comment':_0x3659('0x10')},'dtmfmode':{'type':Sequelize[_0x3659('0x2')]('rfc2833',_0x3659('0x11'),_0x3659('0x12'),_0x3659('0x13'),_0x3659('0x14')),'defaultValue':_0x3659('0x15')},'directmedia':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no',_0x3659('0x17'),_0x3659('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3659('0x5')]},'directmediadeny':{'type':Sequelize[_0x3659('0x5')]},'nat':{'type':Sequelize[_0x3659('0x5')],'defaultValue':'force_rport,comedia','set':function(_0x5d298e){this[_0x3659('0xd')](_0x3659('0x19'),_0x5d298e?_0x5d298e['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x3659('0xe')](_0x3659('0x19'))['split'](','):null;},'comment':_0x3659('0x1a')},'callgroup':{'type':Sequelize[_0x3659('0x5')]},'namedcallgroup':{'type':Sequelize[_0x3659('0x5')]},'pickupgroup':{'type':Sequelize[_0x3659('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3659('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3659('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3659('0x5')],'defaultValue':_0x3659('0x1b')},'allow':{'type':Sequelize[_0x3659('0x5')],'allowNull':![],'defaultValue':_0x3659('0x1c'),'set':function(_0x5a46f4){this['setDataValue'](_0x3659('0x1d'),_0x5a46f4?_0x5a46f4[_0x3659('0x1e')](';'):_0x3659('0x1c'));},'get':function(){return this[_0x3659('0xe')](_0x3659('0x1d'))?this[_0x3659('0xe')](_0x3659('0x1d'))[_0x3659('0x1f')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x1f9aee){this[_0x3659('0xd')]('insecure',_0x1f9aee?_0x1f9aee[_0x3659('0x1e')](','):null);},'get':function(){return this[_0x3659('0xe')](_0x3659('0x20'))?this['getDataValue'](_0x3659('0x20'))[_0x3659('0x1f')](','):null;},'comment':_0x3659('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x3659('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x3659('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x3659('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0x3659('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x3659('0x22')](0xb)},'setvar':{'type':Sequelize[_0x3659('0x5')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x3659('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x3659('0x16'),'no'),'defaultValue':_0x3659('0x16')},'busylevel':{'type':Sequelize[_0x3659('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x3659('0x5')]},'template':{'type':Sequelize[_0x3659('0x5')]},'videosupport':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3659('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3659('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x24'),_0x3659('0x25'),'originate')},'session_expires':{'type':Sequelize[_0x3659('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x3659('0x22')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x3659('0x26'),'uas'),'defaultValue':_0x3659('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x3659('0x5')]},'regexten':{'type':Sequelize[_0x3659('0x5')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x3659('0x5')]},'port':{'type':Sequelize[_0x3659('0x22')](0x5)},'qualify':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no'),'defaultValue':_0x3659('0x16')},'keepalive':{'type':Sequelize[_0x3659('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x3659('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3659('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3659('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no',_0x3659('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3659('0x5')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x3659('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3659('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x3659('0x5')]},'contactdeny':{'type':Sequelize[_0x3659('0x5')]},'contactacl':{'type':Sequelize[_0x3659('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0x3659('0x5')]},'use_q850_reason':{'type':Sequelize[_0x3659('0x5')]},'maxforwards':{'type':Sequelize[_0x3659('0x22')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x3659('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3659('0x16'),'no')},'force_avp':{'type':Sequelize[_0x3659('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x3659('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x3659('0x16'),'no',_0x3659('0x29'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3659('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3659('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x3659('0x5')]},'dtlscipher':{'type':Sequelize[_0x3659('0x5')]},'dtlscafile':{'type':Sequelize[_0x3659('0x5')]},'dtlscapath':{'type':Sequelize[_0x3659('0x5')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3659('0x2a'),_0x3659('0x2b'),_0x3659('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3659('0x5')]},'usereqphone':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x3659('0x5')]},'call_limit':{'type':Sequelize[_0x3659('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3659('0x2')](_0x3659('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x3659('0x2')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x3659('0x5')]},'mohsuggest':{'type':Sequelize[_0x3659('0x5')]},'parkinglot':{'type':Sequelize[_0x3659('0x5')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3659('0x5')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x3659('0x2')]('yes','no',_0x3659('0x17'),_0x3659('0x18'),_0x3659('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x3659('0x5')]},'active':{'type':Sequelize[_0x3659('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3659('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x83a1=['active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','setDataValue','transport','getDataValue','split','info','shortinfo','auto','update','outgoing','yes','force_rport,comedia','nat','join','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate'];(function(_0x36b675,_0x483ad1){var _0x3a8af3=function(_0x11694c){while(--_0x11694c){_0x36b675['push'](_0x36b675['shift']());}};_0x3a8af3(++_0x483ad1);}(_0x83a1,0x18e));var _0x183a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x83a1[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x183a('0x0')]={'name':{'type':Sequelize[_0x183a('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x3'),_0x183a('0x4'),_0x183a('0x5')),'allowNull':![],'defaultValue':_0x183a('0x3')},'context':{'type':Sequelize[_0x183a('0x1')],'allowNull':![],'defaultValue':_0x183a('0x6')},'callingpres':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x7'),_0x183a('0x8'),_0x183a('0x9'),_0x183a('0xa'),_0x183a('0xb'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x183a('0x1')]},'permit':{'type':Sequelize[_0x183a('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x183a('0x1')]},'remotesecret':{'type':Sequelize[_0x183a('0x1')]},'transport':{'type':Sequelize[_0x183a('0x1')],'defaultValue':_0x183a('0xc'),'set':function(_0x25e2d1){this[_0x183a('0xd')](_0x183a('0xe'),_0x25e2d1?_0x25e2d1['join'](','):null);},'get':function(){return this[_0x183a('0xf')](_0x183a('0xe'))?this[_0x183a('0xf')]('transport')[_0x183a('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x183a('0x2')]('rfc2833',_0x183a('0x11'),_0x183a('0x12'),'inband',_0x183a('0x13')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x183a('0x2')]('yes','no','nonat',_0x183a('0x14'),_0x183a('0x15')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x183a('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x183a('0x1')]},'nat':{'type':Sequelize[_0x183a('0x1')],'defaultValue':_0x183a('0x17'),'set':function(_0x5361e1){this[_0x183a('0xd')](_0x183a('0x18'),_0x5361e1?_0x5361e1[_0x183a('0x19')](','):null);},'get':function(){return this[_0x183a('0xf')]('nat')?this[_0x183a('0xf')](_0x183a('0x18'))[_0x183a('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x183a('0x1')]},'namedcallgroup':{'type':Sequelize[_0x183a('0x1')]},'pickupgroup':{'type':Sequelize[_0x183a('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x183a('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x183a('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x183a('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x183a('0x1')],'allowNull':![],'defaultValue':_0x183a('0x1a'),'set':function(_0x381960){this[_0x183a('0xd')](_0x183a('0x1b'),_0x381960?_0x381960['join'](';'):_0x183a('0x1a'));},'get':function(){return this[_0x183a('0xf')](_0x183a('0x1b'))?this['getDataValue'](_0x183a('0x1b'))[_0x183a('0x10')](';'):null;},'comment':_0x183a('0x1c')},'autoframing':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'insecure':{'type':Sequelize[_0x183a('0x1')],'defaultValue':_0x183a('0x1d'),'set':function(_0x823af4){this[_0x183a('0xd')]('insecure',_0x823af4?_0x823af4[_0x183a('0x19')](','):null);},'get':function(){return this[_0x183a('0xf')]('insecure')?this[_0x183a('0xf')](_0x183a('0x1e'))[_0x183a('0x10')](','):null;},'comment':_0x183a('0x1f')},'trustrpid':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'accountcode':{'type':Sequelize[_0x183a('0x20')](0xb)},'setvar':{'type':Sequelize[_0x183a('0x1')]},'callerid':{'type':Sequelize[_0x183a('0x1')],'defaultValue':_0x183a('0x21')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x183a('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x183a('0x16'),'no',_0x183a('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x183a('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x183a('0x1')]},'session_timers':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x23'),_0x183a('0x24'),_0x183a('0x25'))},'session_expires':{'type':Sequelize[_0x183a('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x183a('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x26'),_0x183a('0x27')),'defaultValue':_0x183a('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x183a('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x183a('0x1')]},'fromuser':{'type':Sequelize[_0x183a('0x1')]},'port':{'type':Sequelize[_0x183a('0x20')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x183a('0x16'),'no'),'defaultValue':_0x183a('0x16')},'keepalive':{'type':Sequelize[_0x183a('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x183a('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x183a('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x183a('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x183a('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no',_0x183a('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x183a('0x20')](0xb)},'timerb':{'type':Sequelize[_0x183a('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x183a('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x183a('0x1')]},'contactacl':{'type':Sequelize[_0x183a('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x183a('0x1')]},'use_q850_reason':{'type':Sequelize[_0x183a('0x1')]},'maxforwards':{'type':Sequelize[_0x183a('0x20')](0xb)},'encryption':{'type':Sequelize[_0x183a('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x183a('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'icesupport':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no',_0x183a('0x29'),_0x183a('0x2a'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x183a('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x183a('0x1')]},'dtlscipher':{'type':Sequelize[_0x183a('0x1')]},'dtlscafile':{'type':Sequelize[_0x183a('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x183a('0x2b'),_0x183a('0x2c'),_0x183a('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x183a('0x1')]},'usereqphone':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x183a('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x183a('0x2')](_0x183a('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x183a('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x183a('0x1')]},'host':{'type':Sequelize[_0x183a('0x1')],'defaultValue':_0x183a('0x2e')},'canreinvite':{'type':Sequelize[_0x183a('0x2')]('yes','no','nonat',_0x183a('0x14'),_0x183a('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x183a('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x183a('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index d3c2369..29b7fd6 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 _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x84ab,0x12f));var _0xb84a=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x84ab[_0x21b359];return _0x57b8e7;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file +var _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1ca6d8f..960cc2b 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 _0x52df=['rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','util','../../config/logger','api','bluebird'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x52df,0x13b));var _0xf52d=function(_0x4c797d,_0x4960ac){_0x4c797d=_0x4c797d-0x0;var _0x286e7a=_0x52df[_0x4c797d];return _0x286e7a;};'use strict';var _=require('lodash');var util=require(_0xf52d('0x0'));var logger=require(_0xf52d('0x1'))(_0xf52d('0x2'));var moment=require('moment');var BPromise=require(_0xf52d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf52d('0x4'));var config=require(_0xf52d('0x5'));var attributes=require(_0xf52d('0x6'));module[_0xf52d('0x7')]=function(_0xacf881,_0x2af19c){return _0xacf881[_0xf52d('0x8')](_0xf52d('0x9'),attributes,{'tableName':_0xf52d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1b0=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./trunk.attributes'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0xb1b0,0x100));var _0x0b1b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb1b0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0b1b('0x0'));var util=require(_0x0b1b('0x1'));var logger=require(_0x0b1b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0b1b('0x3'));var rp=require(_0x0b1b('0x4'));var fs=require('fs');var path=require(_0x0b1b('0x5'));var rimraf=require(_0x0b1b('0x6'));var config=require('../../config/environment');var attributes=require(_0x0b1b('0x7'));module[_0x0b1b('0x8')]=function(_0x59e403,_0x8878bf){return _0x59e403[_0x0b1b('0x9')](_0x0b1b('0xa'),attributes,{'tableName':_0x0b1b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 2ee142c..1d76521 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 _0x11b8=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Trunk','options','raw','where','attributes','limit','map','include','model','then','debug','GetTrunk','ShowTrunk','find','catch','lodash','util'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x11b8,0x142));var _0x811b=function(_0x421021,_0xf42b18){_0x421021=_0x421021-0x0;var _0x1b9d18=_0x11b8[_0x421021];return _0x1b9d18;};'use strict';var _=require(_0x811b('0x0'));var util=require(_0x811b('0x1'));var moment=require('moment');var BPromise=require(_0x811b('0x2'));var rs=require(_0x811b('0x3'));var fs=require('fs');var Redis=require(_0x811b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x811b('0x5'));var logger=require(_0x811b('0x6'))(_0x811b('0x7'));var config=require(_0x811b('0x8'));var jayson=require(_0x811b('0x9'));var client=jayson[_0x811b('0xa')][_0x811b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412d2d,_0x1dc0d7,_0x196b78){return new BPromise(function(_0x1b7d1b,_0x214ce9){return client[_0x811b('0xc')](_0x412d2d,_0x196b78)['then'](function(_0x53f2cc){logger[_0x811b('0xd')](_0x811b('0xe'),_0x1dc0d7,_0x811b('0xf'));logger['debug'](_0x811b('0x10'),_0x1dc0d7,_0x811b('0xf'),JSON[_0x811b('0x11')](_0x53f2cc));if(_0x53f2cc[_0x811b('0x12')]){if(_0x53f2cc[_0x811b('0x12')]['code']===0x1f4){logger[_0x811b('0x12')]('Trunk,\x20%s,\x20%s',_0x1dc0d7,_0x53f2cc[_0x811b('0x12')][_0x811b('0x13')]);return _0x214ce9(_0x53f2cc[_0x811b('0x12')]['message']);}logger[_0x811b('0x12')](_0x811b('0xe'),_0x1dc0d7,_0x53f2cc['error'][_0x811b('0x13')]);return _0x1b7d1b(_0x53f2cc['error'][_0x811b('0x13')]);}else{logger[_0x811b('0xd')](_0x811b('0xe'),_0x1dc0d7,'request\x20sent');_0x1b7d1b(_0x53f2cc[_0x811b('0x14')]['message']);}})['catch'](function(_0x17498){logger[_0x811b('0x12')]('Trunk,\x20%s,\x20%s',_0x1dc0d7,_0x17498);_0x214ce9(_0x17498);});});}exports['GetTrunk']=function(_0x4958ec){var _0x99f60c=this;return new Promise(function(_0x77b274,_0x566e24){return db[_0x811b('0x15')]['findAll']({'raw':_0x4958ec[_0x811b('0x16')]?_0x4958ec[_0x811b('0x16')][_0x811b('0x17')]===undefined?!![]:![]:!![],'where':_0x4958ec[_0x811b('0x16')]?_0x4958ec[_0x811b('0x16')][_0x811b('0x18')]||null:null,'attributes':_0x4958ec[_0x811b('0x16')]?_0x4958ec[_0x811b('0x16')][_0x811b('0x19')]||null:null,'limit':_0x4958ec[_0x811b('0x16')]?_0x4958ec[_0x811b('0x16')][_0x811b('0x1a')]||null:null,'include':_0x4958ec[_0x811b('0x16')]?_0x4958ec['options']['include']?_[_0x811b('0x1b')](_0x4958ec['options'][_0x811b('0x1c')],function(_0x450353){return{'model':db[_0x450353['model']],'as':_0x450353['as'],'attributes':_0x450353['attributes'],'include':_0x450353['include']?_['map'](_0x450353['include'],function(_0x644ecf){return{'model':db[_0x644ecf[_0x811b('0x1d')]],'as':_0x644ecf['as'],'attributes':_0x644ecf[_0x811b('0x19')],'include':_0x644ecf['include']?_[_0x811b('0x1b')](_0x644ecf[_0x811b('0x1c')],function(_0x270a89){return{'model':db[_0x270a89[_0x811b('0x1d')]],'as':_0x270a89['as'],'attributes':_0x270a89[_0x811b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x811b('0x1e')](function(_0x1adb4c){logger[_0x811b('0xd')]('GetTrunk',_0x4958ec);logger[_0x811b('0x1f')](_0x811b('0x20'),_0x4958ec,JSON[_0x811b('0x11')](_0x1adb4c));_0x77b274(_0x1adb4c);})['catch'](function(_0x1f551b){logger['error'](_0x811b('0x20'),_0x1f551b[_0x811b('0x13')],_0x4958ec);_0x566e24(_0x99f60c[_0x811b('0x12')](0x1f4,_0x1f551b[_0x811b('0x13')]));});});};exports[_0x811b('0x21')]=function(_0x2fc7c0){var _0x43506e=this;return new Promise(function(_0xbf9f7b,_0x2ff20f){return db['Trunk'][_0x811b('0x22')]({'raw':_0x2fc7c0[_0x811b('0x16')]?_0x2fc7c0[_0x811b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2fc7c0[_0x811b('0x16')]?_0x2fc7c0['options'][_0x811b('0x18')]||null:null,'attributes':_0x2fc7c0[_0x811b('0x16')]?_0x2fc7c0[_0x811b('0x16')][_0x811b('0x19')]||null:null,'include':_0x2fc7c0[_0x811b('0x16')]?_0x2fc7c0[_0x811b('0x16')][_0x811b('0x1c')]?_[_0x811b('0x1b')](_0x2fc7c0[_0x811b('0x16')][_0x811b('0x1c')],function(_0x37156b){return{'model':db[_0x37156b[_0x811b('0x1d')]],'as':_0x37156b['as'],'attributes':_0x37156b[_0x811b('0x19')],'include':_0x37156b[_0x811b('0x1c')]?_[_0x811b('0x1b')](_0x37156b['include'],function(_0x536c26){return{'model':db[_0x536c26[_0x811b('0x1d')]],'as':_0x536c26['as'],'attributes':_0x536c26[_0x811b('0x19')],'include':_0x536c26[_0x811b('0x1c')]?_[_0x811b('0x1b')](_0x536c26[_0x811b('0x1c')],function(_0x2d520f){return{'model':db[_0x2d520f['model']],'as':_0x2d520f['as'],'attributes':_0x2d520f['attributes']};}):[]};}):[]};}):[]:[]})[_0x811b('0x1e')](function(_0x133427){logger[_0x811b('0xd')](_0x811b('0x21'),_0x2fc7c0);logger['debug'](_0x811b('0x21'),_0x2fc7c0,JSON[_0x811b('0x11')](_0x133427));_0xbf9f7b(_0x133427);})[_0x811b('0x23')](function(_0x2caf08){logger[_0x811b('0x12')](_0x811b('0x21'),_0x2caf08['message'],_0x2fc7c0);_0x2ff20f(_0x43506e[_0x811b('0x12')](0x1f4,_0x2caf08['message']));});});}; \ No newline at end of file +var _0x2074=['raw','where','limit','include','map','model','attributes','ShowTrunk','find','util','moment','bluebird','ioredis','../../config/utils','rpc','client','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetTrunk','findAll','options'];(function(_0x22d655,_0x3941dd){var _0x257739=function(_0x98136e){while(--_0x98136e){_0x22d655['push'](_0x22d655['shift']());}};_0x257739(++_0x3941dd);}(_0x2074,0x129));var _0x4207=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2074[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x4207('0x0'));var moment=require(_0x4207('0x1'));var BPromise=require(_0x4207('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4207('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4207('0x4'));var logger=require('../../config/logger')(_0x4207('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4207('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d73b5,_0x32ae48,_0x899f2c){return new BPromise(function(_0x57858a,_0x45ab10){return client[_0x4207('0x7')](_0x2d73b5,_0x899f2c)[_0x4207('0x8')](function(_0x1a498e){logger['info'](_0x4207('0x9'),_0x32ae48,'request\x20sent');logger[_0x4207('0xa')](_0x4207('0xb'),_0x32ae48,_0x4207('0xc'),JSON[_0x4207('0xd')](_0x1a498e));if(_0x1a498e[_0x4207('0xe')]){if(_0x1a498e['error'][_0x4207('0xf')]===0x1f4){logger['error'](_0x4207('0x9'),_0x32ae48,_0x1a498e[_0x4207('0xe')]['message']);return _0x45ab10(_0x1a498e['error'][_0x4207('0x10')]);}logger[_0x4207('0xe')](_0x4207('0x9'),_0x32ae48,_0x1a498e['error'][_0x4207('0x10')]);return _0x57858a(_0x1a498e['error']['message']);}else{logger[_0x4207('0x11')]('Trunk,\x20%s,\x20%s',_0x32ae48,_0x4207('0xc'));_0x57858a(_0x1a498e[_0x4207('0x12')][_0x4207('0x10')]);}})[_0x4207('0x13')](function(_0x2f70e4){logger['error'](_0x4207('0x9'),_0x32ae48,_0x2f70e4);_0x45ab10(_0x2f70e4);});});}exports[_0x4207('0x14')]=function(_0x116f9f){var _0x27dd64=this;return new Promise(function(_0x27e710,_0xca1d31){return db['Trunk'][_0x4207('0x15')]({'raw':_0x116f9f[_0x4207('0x16')]?_0x116f9f[_0x4207('0x16')][_0x4207('0x17')]===undefined?!![]:![]:!![],'where':_0x116f9f[_0x4207('0x16')]?_0x116f9f[_0x4207('0x16')][_0x4207('0x18')]||null:null,'attributes':_0x116f9f['options']?_0x116f9f['options']['attributes']||null:null,'limit':_0x116f9f[_0x4207('0x16')]?_0x116f9f['options'][_0x4207('0x19')]||null:null,'include':_0x116f9f[_0x4207('0x16')]?_0x116f9f[_0x4207('0x16')][_0x4207('0x1a')]?_[_0x4207('0x1b')](_0x116f9f['options'][_0x4207('0x1a')],function(_0x3a66c8){return{'model':db[_0x3a66c8['model']],'as':_0x3a66c8['as'],'attributes':_0x3a66c8['attributes'],'include':_0x3a66c8[_0x4207('0x1a')]?_[_0x4207('0x1b')](_0x3a66c8[_0x4207('0x1a')],function(_0x3da74e){return{'model':db[_0x3da74e[_0x4207('0x1c')]],'as':_0x3da74e['as'],'attributes':_0x3da74e[_0x4207('0x1d')],'include':_0x3da74e[_0x4207('0x1a')]?_[_0x4207('0x1b')](_0x3da74e[_0x4207('0x1a')],function(_0x3713fe){return{'model':db[_0x3713fe[_0x4207('0x1c')]],'as':_0x3713fe['as'],'attributes':_0x3713fe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x364b83){logger[_0x4207('0x11')](_0x4207('0x14'),_0x116f9f);logger['debug'](_0x4207('0x14'),_0x116f9f,JSON[_0x4207('0xd')](_0x364b83));_0x27e710(_0x364b83);})[_0x4207('0x13')](function(_0x3aa807){logger[_0x4207('0xe')](_0x4207('0x14'),_0x3aa807[_0x4207('0x10')],_0x116f9f);_0xca1d31(_0x27dd64[_0x4207('0xe')](0x1f4,_0x3aa807[_0x4207('0x10')]));});});};exports[_0x4207('0x1e')]=function(_0x445d8f){var _0x9c0f3f=this;return new Promise(function(_0x36acdb,_0x4e4866){return db['Trunk'][_0x4207('0x1f')]({'raw':_0x445d8f['options']?_0x445d8f['options'][_0x4207('0x17')]===undefined?!![]:![]:!![],'where':_0x445d8f['options']?_0x445d8f[_0x4207('0x16')]['where']||null:null,'attributes':_0x445d8f[_0x4207('0x16')]?_0x445d8f[_0x4207('0x16')][_0x4207('0x1d')]||null:null,'include':_0x445d8f['options']?_0x445d8f[_0x4207('0x16')][_0x4207('0x1a')]?_[_0x4207('0x1b')](_0x445d8f[_0x4207('0x16')][_0x4207('0x1a')],function(_0x53b57c){return{'model':db[_0x53b57c[_0x4207('0x1c')]],'as':_0x53b57c['as'],'attributes':_0x53b57c[_0x4207('0x1d')],'include':_0x53b57c[_0x4207('0x1a')]?_[_0x4207('0x1b')](_0x53b57c['include'],function(_0x1c4b29){return{'model':db[_0x1c4b29[_0x4207('0x1c')]],'as':_0x1c4b29['as'],'attributes':_0x1c4b29[_0x4207('0x1d')],'include':_0x1c4b29['include']?_[_0x4207('0x1b')](_0x1c4b29[_0x4207('0x1a')],function(_0x57b772){return{'model':db[_0x57b772[_0x4207('0x1c')]],'as':_0x57b772['as'],'attributes':_0x57b772[_0x4207('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4207('0x8')](function(_0x52b089){logger[_0x4207('0x11')]('ShowTrunk',_0x445d8f);logger[_0x4207('0xa')](_0x4207('0x1e'),_0x445d8f,JSON[_0x4207('0xd')](_0x52b089));_0x36acdb(_0x52b089);})[_0x4207('0x13')](function(_0xa68b64){logger[_0x4207('0xe')](_0x4207('0x1e'),_0xa68b64[_0x4207('0x10')],_0x445d8f);_0x4e4866(_0x9c0f3f['error'](0x1f4,_0xa68b64[_0x4207('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 5a915eb..b823b8b 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 _0xebf1=['../../components/auth/service','./user-setting.controller','put','isAuthenticated','update','express','Router'];(function(_0x505000,_0x2869b1){var _0x246266=function(_0x1ea8de){while(--_0x1ea8de){_0x505000['push'](_0x505000['shift']());}};_0x246266(++_0x2869b1);}(_0xebf1,0x98));var _0x1ebf=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xebf1[_0xfc0976];return _0x23579f;};'use strict';var express=require(_0x1ebf('0x0'));var router=express[_0x1ebf('0x1')]();var auth=require(_0x1ebf('0x2'));var controller=require(_0x1ebf('0x3'));router[_0x1ebf('0x4')]('/:id',auth[_0x1ebf('0x5')](),controller[_0x1ebf('0x6')]);module['exports']=router; \ No newline at end of file +var _0xfefa=['isAuthenticated','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x46bfe1,_0x42d186){var _0x42c931=function(_0x230eaf){while(--_0x230eaf){_0x46bfe1['push'](_0x46bfe1['shift']());}};_0x42c931(++_0x42d186);}(_0xfefa,0x13a));var _0xafef=function(_0x3b28fd,_0x5f4ad9){_0x3b28fd=_0x3b28fd-0x0;var _0xf00b1a=_0xfefa[_0x3b28fd];return _0xf00b1a;};'use strict';var express=require(_0xafef('0x0'));var router=express[_0xafef('0x1')]();var auth=require(_0xafef('0x2'));var controller=require(_0xafef('0x3'));router[_0xafef('0x4')](_0xafef('0x5'),auth[_0xafef('0x6')](),controller['update']);module[_0xafef('0x7')]=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 0ebdc75..0934c56 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 _0xc498=['UserId','sequelize','error','warning','info','BOOLEAN','TEXT','DATE'];(function(_0x2d6d25,_0x5c8736){var _0x176a23=function(_0x423afa){while(--_0x423afa){_0x2d6d25['push'](_0x2d6d25['shift']());}};_0x176a23(++_0x5c8736);}(_0xc498,0x1e1));var _0x8c49=function(_0x13fa33,_0x5cb8b2){_0x13fa33=_0x13fa33-0x0;var _0xdd7bd6=_0xc498[_0x13fa33];return _0xdd7bd6;};'use strict';var Sequelize=require(_0x8c49('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x8c49('0x1'),_0x8c49('0x2'),_0x8c49('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8c49('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8c49('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8c49('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8c49('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x8c49('0x7')}}; \ No newline at end of file +var _0x7172=['warning','info','debug','exports','BOOLEAN','TEXT','DATE','sequelize','error'];(function(_0x53ef96,_0x4f9499){var _0x57de8f=function(_0x12aa4f){while(--_0x12aa4f){_0x53ef96['push'](_0x53ef96['shift']());}};_0x57de8f(++_0x4f9499);}(_0x7172,0x115));var _0x2717=function(_0x110f07,_0x523a8d){_0x110f07=_0x110f07-0x0;var _0x390dec=_0x7172[_0x110f07];return _0x390dec;};'use strict';var Sequelize=require(_0x2717('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x2717('0x1'),_0x2717('0x2'),_0x2717('0x3'),_0x2717('0x4')];module[_0x2717('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2717('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2717('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2717('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2717('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 0224241..f7c6d14 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 _0x292e=['Invalid\x20user\x20setting\x20id','UserSetting','body','lodash','ioredis','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','user','role','admin','Unauthorized'];(function(_0x20be74,_0x7790fa){var _0x2d9039=function(_0x305025){while(--_0x305025){_0x20be74['push'](_0x20be74['shift']());}};_0x2d9039(++_0x7790fa);}(_0x292e,0xcb));var _0xe292=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x292e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe292('0x0'));var Redis=require(_0xe292('0x1'));var logger=require(_0xe292('0x2'))(_0xe292('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xe292('0x4'))(new Redis(config[_0xe292('0x5')]));require(_0xe292('0x6'))[_0xe292('0x7')](socket);config['redis']=_[_0xe292('0x8')](config['redis'],{'host':_0xe292('0x9'),'port':0x18eb});function respondWithResult(_0x3de36e,_0x3fe83c){_0x3fe83c=_0x3fe83c||0xc8;return function(_0x11fd14){if(_0x11fd14){return _0x3de36e[_0xe292('0xa')](_0x3fe83c)[_0xe292('0xb')](_0x11fd14);}};}function saveUpdates(_0x4e9918){return function(_0x4af6e1){if(_0x4af6e1){return _0x4af6e1[_0xe292('0xc')](_0x4e9918)[_0xe292('0xd')](function(_0x36086d){return _0x36086d;});}return null;};}function handleEntityNotFound(_0x188913){return function(_0x55da61){if(!_0x55da61){_0x188913[_0xe292('0xe')](0x194);}return _0x55da61;};}function handleError(_0x3aa319,_0x58e84d){_0x58e84d=_0x58e84d||0x1f4;return function(_0x16e8f4){logger[_0xe292('0xf')](_0x16e8f4[_0xe292('0x10')]);if(_0x16e8f4[_0xe292('0x11')]){delete _0x16e8f4[_0xe292('0x11')];}_0x3aa319[_0xe292('0xa')](_0x58e84d)['send'](_0x16e8f4);};}exports[_0xe292('0xc')]=function(_0x1394f0,_0x22b178){if(_0x1394f0[_0xe292('0x12')][_0xe292('0x13')]!==_0xe292('0x14'))throw new Error(_0xe292('0x15'));if(isNaN(Number(_0x1394f0['params']['id'])))throw new Error(_0xe292('0x16'));return db[_0xe292('0x17')]['find']({'where':{'id':_0x1394f0['params']['id']}})[_0xe292('0xd')](handleEntityNotFound(_0x22b178,null))[_0xe292('0xd')](saveUpdates(_0x1394f0[_0xe292('0x18')],null))[_0xe292('0xd')](respondWithResult(_0x22b178,null))['catch'](handleError(_0x22b178,null));}; \ No newline at end of file +var _0x55e0=['name','send','update','user','role','admin','Unauthorized','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','then','sendStatus','stack'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x55e0,0xdc));var _0x055e=function(_0x18540d,_0x305bd5){_0x18540d=_0x18540d-0x0;var _0x1a02cd=_0x55e0[_0x18540d];return _0x1a02cd;};'use strict';var _=require(_0x055e('0x0'));var Redis=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x055e('0x4'))(new Redis(config[_0x055e('0x5')]));require(_0x055e('0x6'))[_0x055e('0x7')](socket);config[_0x055e('0x5')]=_[_0x055e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4384ff,_0x4a442e){_0x4a442e=_0x4a442e||0xc8;return function(_0x8e7824){if(_0x8e7824){return _0x4384ff[_0x055e('0x9')](_0x4a442e)[_0x055e('0xa')](_0x8e7824);}};}function saveUpdates(_0x230c32){return function(_0x444c82){if(_0x444c82){return _0x444c82['update'](_0x230c32)[_0x055e('0xb')](function(_0xd67814){return _0xd67814;});}return null;};}function handleEntityNotFound(_0xb816c){return function(_0xa0d384){if(!_0xa0d384){_0xb816c[_0x055e('0xc')](0x194);}return _0xa0d384;};}function handleError(_0x5237d9,_0x56c78a){_0x56c78a=_0x56c78a||0x1f4;return function(_0x187cce){logger['error'](_0x187cce[_0x055e('0xd')]);if(_0x187cce[_0x055e('0xe')]){delete _0x187cce[_0x055e('0xe')];}_0x5237d9[_0x055e('0x9')](_0x56c78a)[_0x055e('0xf')](_0x187cce);};}exports[_0x055e('0x10')]=function(_0x236a2b,_0x4bca5d){if(_0x236a2b[_0x055e('0x11')][_0x055e('0x12')]!==_0x055e('0x13'))throw new Error(_0x055e('0x14'));if(isNaN(Number(_0x236a2b[_0x055e('0x15')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x055e('0x16')][_0x055e('0x17')]({'where':{'id':_0x236a2b[_0x055e('0x15')]['id']}})['then'](handleEntityNotFound(_0x4bca5d,null))[_0x055e('0xb')](saveUpdates(_0x236a2b[_0x055e('0x18')],null))[_0x055e('0xb')](respondWithResult(_0x4bca5d,null))[_0x055e('0x19')](handleError(_0x4bca5d,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 c1d7b73..5cfdccf 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 _0x68de=['events','UserSetting','setMaxListeners','update','remove','hasOwnProperty','hook','exports'];(function(_0x46f22e,_0x90c15){var _0xe1a9f=function(_0x2f46c5){while(--_0x2f46c5){_0x46f22e['push'](_0x46f22e['shift']());}};_0xe1a9f(++_0x90c15);}(_0x68de,0x98));var _0xe68d=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x68de[_0x49052b];return _0x48c045;};'use strict';var EventEmitter=require(_0xe68d('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xe68d('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe68d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe68d('0x3'),'afterDestroy':_0xe68d('0x4')};function emitEvent(_0xa31857){return function(_0x32329d,_0x1d92e1,_0x1b21a5){UserSettingEvents['emit'](_0xa31857+':'+_0x32329d['id'],_0x32329d);UserSettingEvents['emit'](_0xa31857,_0x32329d);_0x1b21a5(null);};}for(var e in events){if(events[_0xe68d('0x5')](e)){var event=events[e];UserSetting[_0xe68d('0x6')](e,emitEvent(event));}}module[_0xe68d('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x7c3a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting'];(function(_0x2aec94,_0x31bc74){var _0x591be3=function(_0x2c3fd2){while(--_0x2c3fd2){_0x2aec94['push'](_0x2aec94['shift']());}};_0x591be3(++_0x31bc74);}(_0x7c3a,0x165));var _0xa7c3=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x7c3a[_0x539533];return _0x3942f3;};'use strict';var EventEmitter=require(_0xa7c3('0x0'));var UserSetting=require(_0xa7c3('0x1'))['db'][_0xa7c3('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa7c3('0x3')](0x0);var events={'afterCreate':_0xa7c3('0x4'),'afterUpdate':_0xa7c3('0x5'),'afterDestroy':_0xa7c3('0x6')};function emitEvent(_0x183157){return function(_0x3dcaa0,_0x3ab50b,_0x1b0c62){UserSettingEvents[_0xa7c3('0x7')](_0x183157+':'+_0x3dcaa0['id'],_0x3dcaa0);UserSettingEvents[_0xa7c3('0x7')](_0x183157,_0x3dcaa0);_0x1b0c62(null);};}for(var e in events){if(events[_0xa7c3('0x8')](e)){var event=events[e];UserSetting[_0xa7c3('0x9')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 73229cf..3eac6c1 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 _0xd523=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x31b338,_0x48dff4){var _0x461c6f=function(_0x3934d2){while(--_0x3934d2){_0x31b338['push'](_0x31b338['shift']());}};_0x461c6f(++_0x48dff4);}(_0xd523,0x153));var _0x3d52=function(_0x563317,_0x3c9404){_0x563317=_0x563317-0x0;var _0x22dca1=_0xd523[_0x563317];return _0x22dca1;};'use strict';var attributes=require(_0x3d52('0x0'));module[_0x3d52('0x1')]=function(_0x3d35b0){return _0x3d35b0[_0x3d52('0x2')]('UserSetting',attributes,{'tableName':_0x3d52('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b5ea1){if(!_0x1b5ea1[_0x3d52('0x4')])_0x1b5ea1['clientSideLoggingEnabledSince']=null;else if(_0x1b5ea1[_0x3d52('0x5')]===null)_0x1b5ea1[_0x3d52('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xde2c=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x2de4c3,_0x646aad){var _0xc324fd=function(_0x578822){while(--_0x578822){_0x2de4c3['push'](_0x2de4c3['shift']());}};_0xc324fd(++_0x646aad);}(_0xde2c,0x7f));var _0xcde2=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xde2c[_0x4b91c4];return _0x25cb80;};'use strict';var attributes=require(_0xcde2('0x0'));module[_0xcde2('0x1')]=function(_0x2f5f10){return _0x2f5f10[_0xcde2('0x2')](_0xcde2('0x3'),attributes,{'tableName':_0xcde2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33bb0c){if(!_0x33bb0c[_0xcde2('0x5')])_0x33bb0c['clientSideLoggingEnabledSince']=null;else if(_0x33bb0c[_0xcde2('0x6')]===null)_0x33bb0c[_0xcde2('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 05620e1..af85881 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 _0xeaf2=['register','save','emit','user-setting:update','user-setting:update:user-'];(function(_0x1bd111,_0x42d5f9){var _0x1c0ebb=function(_0x46e26d){while(--_0x46e26d){_0x1bd111['push'](_0x1bd111['shift']());}};_0x1c0ebb(++_0x42d5f9);}(_0xeaf2,0x83));var _0x2eaf=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xeaf2[_0x53b133];return _0x5647e0;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x2eaf('0x0'),'remove','update'];function createListener(_0x1b17ec,_0x16532f){return function(_0x1a06bd){_0x16532f[_0x2eaf('0x1')](_0x1b17ec,_0x1a06bd);if(_0x1b17ec===_0x2eaf('0x2')){_0x16532f[_0x2eaf('0x1')](_0x2eaf('0x3')+_0x1a06bd['UserId'],_0x1a06bd);}};}exports[_0x2eaf('0x4')]=function(_0xa90827){for(var _0xe6471e=0x0,_0x241f67=events['length'];_0xe6471e<_0x241f67;_0xe6471e++){var _0x35cd45=events[_0xe6471e];var _0x3e938a=createListener('user-setting:'+_0x35cd45,_0xa90827);UserSettingEvents['on'](_0x35cd45,_0x3e938a);}}; \ No newline at end of file +var _0xcebf=['user-setting:','./user-setting.events','remove','emit','user-setting:update','user-setting:update:user-','UserId','register','length'];(function(_0x14782d,_0x505352){var _0x46baa7=function(_0x4a79bd){while(--_0x4a79bd){_0x14782d['push'](_0x14782d['shift']());}};_0x46baa7(++_0x505352);}(_0xcebf,0x172));var _0xfceb=function(_0x5d5263,_0x52355e){_0x5d5263=_0x5d5263-0x0;var _0x4902b2=_0xcebf[_0x5d5263];return _0x4902b2;};'use strict';var UserSettingEvents=require(_0xfceb('0x0'));var events=['save',_0xfceb('0x1'),'update'];function createListener(_0x17f49c,_0x529f06){return function(_0x3f849b){_0x529f06[_0xfceb('0x2')](_0x17f49c,_0x3f849b);if(_0x17f49c===_0xfceb('0x3')){_0x529f06[_0xfceb('0x2')](_0xfceb('0x4')+_0x3f849b[_0xfceb('0x5')],_0x3f849b);}};}exports[_0xfceb('0x6')]=function(_0x4c913a){for(var _0x46c9b1=0x0,_0x5eedd1=events[_0xfceb('0x7')];_0x46c9b1<_0x5eedd1;_0x46c9b1++){var _0x3d3b3d=events[_0x46c9b1];var _0x14fda8=createListener(_0xfceb('0x8')+_0x3d3b3d,_0x4c913a);UserSettingEvents['on'](_0x3d3b3d,_0x14fda8);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index cb9ba4e..feb691e 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 _0x8978=['/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id','destroy','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','get','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','join','root','file','addAvatar','/:id/login','login','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x8978,0x1cc));var _0x8897=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8978[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8897('0x0'));var timeout=require('connect-timeout');var express=require(_0x8897('0x1'));var router=express['Router']();var fs_extra=require(_0x8897('0x2'));var auth=require(_0x8897('0x3'));var interaction=require(_0x8897('0x4'));var config=require(_0x8897('0x5'));var controller=require(_0x8897('0x6'));router['get']('/',auth[_0x8897('0x7')](),controller[_0x8897('0x8')]);router['get'](_0x8897('0x9'),auth[_0x8897('0x7')](),controller[_0x8897('0xa')]);router['get'](_0x8897('0xb'),auth['isAuthenticated'](),controller[_0x8897('0xc')]);router['get'](_0x8897('0xd'),auth[_0x8897('0x7')](),controller[_0x8897('0xe')]);router[_0x8897('0xf')]('/:id',auth[_0x8897('0x7')](),controller[_0x8897('0x10')]);router[_0x8897('0xf')](_0x8897('0x11'),controller[_0x8897('0x12')]);router[_0x8897('0xf')](_0x8897('0x13'),auth['isAuthenticated'](),controller[_0x8897('0x14')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x8897('0xf')](_0x8897('0x15'),auth[_0x8897('0x7')](),controller[_0x8897('0x16')]);router[_0x8897('0xf')](_0x8897('0x17'),auth[_0x8897('0x7')](),controller[_0x8897('0x18')]);router[_0x8897('0xf')](_0x8897('0x19'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x8897('0x1a'),auth['isAuthenticated'](),controller[_0x8897('0x1b')]);router['get']('/:id/screen_recordings',auth[_0x8897('0x7')](),controller['getScreenRecordings']);router[_0x8897('0xf')](_0x8897('0x1c'),auth[_0x8897('0x7')](),controller['getChatInteractions']);router[_0x8897('0xf')](_0x8897('0x1d'),auth[_0x8897('0x7')](),controller[_0x8897('0x1e')]);router[_0x8897('0xf')](_0x8897('0x1f'),auth[_0x8897('0x7')](),controller[_0x8897('0x20')]);router[_0x8897('0xf')](_0x8897('0x21'),auth[_0x8897('0x7')](),controller['getSmsInteractions']);router[_0x8897('0xf')](_0x8897('0x22'),auth[_0x8897('0x7')](),controller[_0x8897('0x23')]);router['get'](_0x8897('0x24'),auth[_0x8897('0x7')](),controller[_0x8897('0x25')]);router[_0x8897('0xf')](_0x8897('0x26'),auth['isAuthenticated'](),controller[_0x8897('0x27')]);router[_0x8897('0xf')](_0x8897('0x28'),auth['isAuthenticated'](),controller['getLists']);router[_0x8897('0xf')]('/:id/agents',auth[_0x8897('0x7')](),controller[_0x8897('0x29')]);router[_0x8897('0xf')](_0x8897('0x2a'),auth['isAuthenticated'](),controller[_0x8897('0x2b')]);router[_0x8897('0xf')](_0x8897('0x2c'),auth[_0x8897('0x7')](),controller[_0x8897('0x2d')]);router[_0x8897('0xf')](_0x8897('0x2e'),auth[_0x8897('0x7')](),controller['getMailAccounts']);router[_0x8897('0xf')]('/:id/openchannel_accounts',auth[_0x8897('0x7')](),controller[_0x8897('0x2f')]);router[_0x8897('0xf')]('/:id/sms_accounts',auth[_0x8897('0x7')](),controller[_0x8897('0x30')]);router[_0x8897('0xf')](_0x8897('0x31'),auth[_0x8897('0x7')](),controller[_0x8897('0x32')]);router[_0x8897('0xf')](_0x8897('0x33'),auth[_0x8897('0x7')](),controller[_0x8897('0x34')]);router['get'](_0x8897('0x35'),auth[_0x8897('0x7')](),controller[_0x8897('0x36')]);router[_0x8897('0xf')](_0x8897('0x37'),auth[_0x8897('0x7')](),controller['getApiKey']);router[_0x8897('0x38')](_0x8897('0x39'),auth[_0x8897('0x7')](),controller[_0x8897('0x3a')]);router[_0x8897('0x38')]('/',auth['isAuthenticated'](),controller[_0x8897('0x3b')]);router['post']('/create_many',auth[_0x8897('0x7')](),controller[_0x8897('0x3c')]);router['post'](_0x8897('0x15'),auth[_0x8897('0x7')](),controller[_0x8897('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f484b,_0x1196a9,_0x2cf1b1){_0x2cf1b1(null,path[_0x8897('0x3e')](config[_0x8897('0x3f')],'server/files/images/'));},'filename':function(_0x15d6fe,_0x3b4aa3,_0x5c168d){_0x5c168d(null,util['format']('%s-%s',Date['now'](),_0x3b4aa3['originalname']));}})});router[_0x8897('0x38')](_0x8897('0x11'),upload['single'](_0x8897('0x40')),controller[_0x8897('0x41')]);router['post'](_0x8897('0x42'),auth['isAuthenticated'](),controller[_0x8897('0x43')]);router[_0x8897('0x38')]('/:id/logout',auth[_0x8897('0x7')](),controller['logout']);router[_0x8897('0x38')](_0x8897('0x44'),auth[_0x8897('0x7')](),controller['pause']);router[_0x8897('0x38')]('/:id/unpause',auth[_0x8897('0x7')](),controller[_0x8897('0x45')]);router[_0x8897('0x38')](_0x8897('0x26'),auth[_0x8897('0x7')](),controller[_0x8897('0x46')]);router['post'](_0x8897('0x47'),auth[_0x8897('0x7')](),controller[_0x8897('0x48')]);router[_0x8897('0x38')](_0x8897('0x49'),auth[_0x8897('0x7')](),controller['addMailInteractions']);router[_0x8897('0x38')](_0x8897('0x4a'),auth[_0x8897('0x7')](),controller[_0x8897('0x4b')]);router[_0x8897('0x38')](_0x8897('0x4c'),auth[_0x8897('0x7')](),controller[_0x8897('0x4d')]);router[_0x8897('0x38')](_0x8897('0x4e'),auth[_0x8897('0x7')](),controller[_0x8897('0x4f')]);router[_0x8897('0x38')]('/:id/whatsapp_interactions',auth[_0x8897('0x7')](),controller[_0x8897('0x50')]);router[_0x8897('0x38')](_0x8897('0x2c'),auth['isAuthenticated'](),controller[_0x8897('0x51')]);router[_0x8897('0x38')](_0x8897('0x2e'),auth[_0x8897('0x7')](),controller[_0x8897('0x52')]);router['post'](_0x8897('0x53'),auth['isAuthenticated'](),controller[_0x8897('0x54')]);router[_0x8897('0x38')](_0x8897('0x55'),auth[_0x8897('0x7')](),controller[_0x8897('0x56')]);router[_0x8897('0x38')](_0x8897('0x31'),auth[_0x8897('0x7')](),controller[_0x8897('0x57')]);router[_0x8897('0x38')](_0x8897('0x33'),auth[_0x8897('0x7')](),controller[_0x8897('0x58')]);router['post']('/:id/api_key',auth[_0x8897('0x7')](),controller[_0x8897('0x59')]);router[_0x8897('0x5a')]('/:id',auth[_0x8897('0x7')](),controller[_0x8897('0x5b')]);router[_0x8897('0x5a')](_0x8897('0x5c'),auth['isAuthenticated'](),controller[_0x8897('0x5d')]);router[_0x8897('0x5e')](_0x8897('0x15'),auth[_0x8897('0x7')](),controller[_0x8897('0x5f')]);router[_0x8897('0x5e')](_0x8897('0x26'),auth[_0x8897('0x7')](),controller[_0x8897('0x60')]);router[_0x8897('0x5e')](_0x8897('0x61'),auth[_0x8897('0x7')](),controller[_0x8897('0x62')]);router[_0x8897('0x5e')](_0x8897('0x47'),auth['isAuthenticated'](),controller[_0x8897('0x63')]);router[_0x8897('0x5e')](_0x8897('0x49'),auth[_0x8897('0x7')](),controller['removeMailInteractions']);router[_0x8897('0x5e')](_0x8897('0x4a'),auth[_0x8897('0x7')](),controller[_0x8897('0x64')]);router[_0x8897('0x5e')](_0x8897('0x4c'),auth[_0x8897('0x7')](),controller['removeSmsInteractions']);router['delete'](_0x8897('0x4e'),auth[_0x8897('0x7')](),controller[_0x8897('0x65')]);router[_0x8897('0x5e')](_0x8897('0x66'),auth[_0x8897('0x7')](),controller[_0x8897('0x67')]);router[_0x8897('0x5e')]('/:id/fax_accounts',auth[_0x8897('0x7')](),controller[_0x8897('0x68')]);router['delete']('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x8897('0x53'),auth[_0x8897('0x7')](),controller[_0x8897('0x69')]);router[_0x8897('0x5e')](_0x8897('0x55'),auth['isAuthenticated'](),controller[_0x8897('0x6a')]);router[_0x8897('0x5e')]('/:id/chat_websites',auth[_0x8897('0x7')](),controller['removeChatWebsites']);router[_0x8897('0x5e')](_0x8897('0x33'),auth[_0x8897('0x7')](),controller['removeWhatsappAccounts']);router[_0x8897('0x5e')](_0x8897('0x37'),auth[_0x8897('0x7')](),controller[_0x8897('0x6b')]);module[_0x8897('0x6c')]=router; \ No newline at end of file +var _0xe773=['getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','getPresence','/:id','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions'];(function(_0x277540,_0x1df6cf){var _0x7bc907=function(_0x59b958){while(--_0x59b958){_0x277540['push'](_0x277540['shift']());}};_0x7bc907(++_0x1df6cf);}(_0xe773,0x19a));var _0x3e77=function(_0x5c89fa,_0x15d7fa){_0x5c89fa=_0x5c89fa-0x0;var _0x58cbe2=_0xe773[_0x5c89fa];return _0x58cbe2;};'use strict';var multer=require('multer');var util=require(_0x3e77('0x0'));var path=require(_0x3e77('0x1'));var timeout=require(_0x3e77('0x2'));var express=require('express');var router=express[_0x3e77('0x3')]();var fs_extra=require(_0x3e77('0x4'));var auth=require(_0x3e77('0x5'));var interaction=require(_0x3e77('0x6'));var config=require(_0x3e77('0x7'));var controller=require('./user.controller');router[_0x3e77('0x8')]('/',auth[_0x3e77('0x9')](),controller[_0x3e77('0xa')]);router[_0x3e77('0x8')](_0x3e77('0xb'),auth[_0x3e77('0x9')](),controller[_0x3e77('0xc')]);router[_0x3e77('0x8')](_0x3e77('0xd'),auth[_0x3e77('0x9')](),controller[_0x3e77('0xe')]);router['get']('/presence',auth[_0x3e77('0x9')](),controller[_0x3e77('0xf')]);router[_0x3e77('0x8')](_0x3e77('0x10'),auth[_0x3e77('0x9')](),controller['show']);router[_0x3e77('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x3e77('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x3e77('0x11')]);router[_0x3e77('0x8')](_0x3e77('0x12'),auth['isAuthenticated'](),controller[_0x3e77('0x13')]);router['get'](_0x3e77('0x14'),auth[_0x3e77('0x9')](),controller['getQueues']);router[_0x3e77('0x8')](_0x3e77('0x15'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x16')]);router[_0x3e77('0x8')](_0x3e77('0x17'),auth['isAuthenticated'](),controller[_0x3e77('0x18')]);router[_0x3e77('0x8')](_0x3e77('0x19'),auth[_0x3e77('0x9')](),controller['getRecordings']);router['get'](_0x3e77('0x1a'),auth['isAuthenticated'](),controller[_0x3e77('0x1b')]);router[_0x3e77('0x8')](_0x3e77('0x1c'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x1d')]);router[_0x3e77('0x8')]('/:id/openchannel/interactions',auth[_0x3e77('0x9')](),controller[_0x3e77('0x1e')]);router[_0x3e77('0x8')](_0x3e77('0x1f'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x20')]);router[_0x3e77('0x8')](_0x3e77('0x21'),auth['isAuthenticated'](),controller[_0x3e77('0x22')]);router[_0x3e77('0x8')](_0x3e77('0x23'),auth[_0x3e77('0x9')](),controller['getFaxInteractions']);router[_0x3e77('0x8')](_0x3e77('0x24'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x25')]);router[_0x3e77('0x8')](_0x3e77('0x26'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x27')]);router[_0x3e77('0x8')](_0x3e77('0x28'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x29')]);router['get'](_0x3e77('0x2a'),auth[_0x3e77('0x9')](),controller['getAgents']);router['get'](_0x3e77('0x2b'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x2c')]);router[_0x3e77('0x8')]('/:id/fax_accounts',auth[_0x3e77('0x9')](),controller['getFaxAccounts']);router[_0x3e77('0x8')](_0x3e77('0x2d'),auth[_0x3e77('0x9')](),controller['getMailAccounts']);router['get'](_0x3e77('0x2e'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x2f')]);router[_0x3e77('0x8')](_0x3e77('0x30'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x31')]);router['get'](_0x3e77('0x32'),auth[_0x3e77('0x9')](),controller['getChatWebsites']);router[_0x3e77('0x8')](_0x3e77('0x33'),auth[_0x3e77('0x9')](),controller['getWhatsappAccounts']);router[_0x3e77('0x8')](_0x3e77('0x34'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x35')]);router[_0x3e77('0x8')](_0x3e77('0x36'),auth[_0x3e77('0x9')](),controller['getApiKey']);router[_0x3e77('0x37')](_0x3e77('0x12'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x38')]);router['post']('/',auth[_0x3e77('0x9')](),controller[_0x3e77('0x39')]);router[_0x3e77('0x37')](_0x3e77('0x3a'),auth[_0x3e77('0x9')](),controller['bulkCreate']);router[_0x3e77('0x37')](_0x3e77('0x14'),auth['isAuthenticated'](),controller[_0x3e77('0x3b')]);var upload=multer({'storage':multer[_0x3e77('0x3c')]({'destination':function(_0x20a690,_0x869610,_0x1d58d4){_0x1d58d4(null,path[_0x3e77('0x3d')](config[_0x3e77('0x3e')],_0x3e77('0x3f')));},'filename':function(_0x260e31,_0x445045,_0x14e0ad){_0x14e0ad(null,util['format'](_0x3e77('0x40'),Date[_0x3e77('0x41')](),_0x445045[_0x3e77('0x42')]));}})});router['post'](_0x3e77('0x43'),upload[_0x3e77('0x44')](_0x3e77('0x45')),controller[_0x3e77('0x46')]);router[_0x3e77('0x37')](_0x3e77('0x47'),auth[_0x3e77('0x9')](),controller['login']);router[_0x3e77('0x37')](_0x3e77('0x48'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x49')]);router[_0x3e77('0x37')](_0x3e77('0x4a'),auth[_0x3e77('0x9')](),controller['pause']);router[_0x3e77('0x37')]('/:id/unpause',auth[_0x3e77('0x9')](),controller[_0x3e77('0x4b')]);router[_0x3e77('0x37')](_0x3e77('0x26'),auth[_0x3e77('0x9')](),controller['addTeams']);router[_0x3e77('0x37')]('/:id/chat_interactions',auth[_0x3e77('0x9')](),controller[_0x3e77('0x4c')]);router[_0x3e77('0x37')](_0x3e77('0x4d'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x4e')]);router['post']('/:id/fax_interactions',auth[_0x3e77('0x9')](),controller[_0x3e77('0x4f')]);router[_0x3e77('0x37')](_0x3e77('0x50'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x51')]);router['post']('/:id/openchannel_interactions',auth[_0x3e77('0x9')](),controller[_0x3e77('0x52')]);router[_0x3e77('0x37')](_0x3e77('0x53'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x54')]);router[_0x3e77('0x37')](_0x3e77('0x55'),auth[_0x3e77('0x9')](),controller['addFaxAccounts']);router[_0x3e77('0x37')](_0x3e77('0x2d'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x56')]);router[_0x3e77('0x37')]('/:id/openchannel_accounts',auth[_0x3e77('0x9')](),controller[_0x3e77('0x57')]);router[_0x3e77('0x37')](_0x3e77('0x30'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x58')]);router[_0x3e77('0x37')](_0x3e77('0x32'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x59')]);router['post'](_0x3e77('0x33'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x5a')]);router[_0x3e77('0x37')]('/:id/api_key',auth[_0x3e77('0x9')](),controller[_0x3e77('0x5b')]);router[_0x3e77('0x5c')]('/:id',auth[_0x3e77('0x9')](),controller[_0x3e77('0x5d')]);router[_0x3e77('0x5c')](_0x3e77('0x5e'),auth[_0x3e77('0x9')](),controller['changePassword']);router[_0x3e77('0x5f')](_0x3e77('0x14'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x60')]);router[_0x3e77('0x5f')](_0x3e77('0x26'),auth[_0x3e77('0x9')](),controller['removeTeams']);router[_0x3e77('0x5f')]('/:id',auth[_0x3e77('0x9')](),controller[_0x3e77('0x61')]);router[_0x3e77('0x5f')](_0x3e77('0x62'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x63')]);router[_0x3e77('0x5f')](_0x3e77('0x4d'),auth[_0x3e77('0x9')](),controller['removeMailInteractions']);router[_0x3e77('0x5f')](_0x3e77('0x64'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x65')]);router[_0x3e77('0x5f')](_0x3e77('0x50'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x66')]);router[_0x3e77('0x5f')](_0x3e77('0x67'),auth[_0x3e77('0x9')](),controller['removeOpenchannelInteractions']);router[_0x3e77('0x5f')]('/:id/whatsapp_interactions',auth[_0x3e77('0x9')](),controller['removeWhatsappInteractions']);router[_0x3e77('0x5f')](_0x3e77('0x55'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x68')]);router[_0x3e77('0x5f')](_0x3e77('0x2d'),auth[_0x3e77('0x9')](),controller['removeMailAccounts']);router['delete'](_0x3e77('0x2e'),auth['isAuthenticated'](),controller[_0x3e77('0x69')]);router[_0x3e77('0x5f')]('/:id/sms_accounts',auth[_0x3e77('0x9')](),controller[_0x3e77('0x6a')]);router[_0x3e77('0x5f')](_0x3e77('0x32'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x6b')]);router[_0x3e77('0x5f')]('/:id/whatsapp_accounts',auth[_0x3e77('0x9')](),controller[_0x3e77('0x6c')]);router[_0x3e77('0x5f')](_0x3e77('0x36'),auth[_0x3e77('0x9')](),controller[_0x3e77('0x6d')]);module[_0x3e77('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 22240c6..656c93a 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x1c3892,_0x4f5eef){var _0x388819=function(_0x2d0495){while(--_0x2d0495){_0x1c3892['push'](_0x1c3892['shift']());}};_0x388819(++_0x4f5eef);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xcb91[_0x79b649];return _0x1af9b1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b8c4cc7..9d944fd 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 _0xdd6d=['LOGININPAUSE','isMiddleware','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','removeAgent','UserVoicePrefix','getLists','getAgents','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$any','firstName','lastName','CmContact','Contact','VoiceQueue','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','getUserSetting','getPresence','queues','teams','inbound','flatten','lower','col','toString','asc','desc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','squel','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','redis','./user.socket','register','defaults','localhost','http','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','role','agent','userNotification:recalc:','destroy','Users','Agents','Telephones','telephone','ignore','map','value','find','sendStatus','stack','name','send','index','User','rawAttributes','fieldName','type','filter','includes','password','salt','where','includeAll','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','catch','model','differenceBy','keys','filters','intersection','fields','merge','options','body','params','describe','ids','omit','internal','Setting','findById','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','101','102','113','110','104','105','106','107','108','user','admin','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','userProfileId','create','UserProfileSection','autoAssociation','UserProfileResource','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','ValidationError','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','emit','Queue:save','voice','get','format','penalty','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','Tag','Tags','color','tag','getQueues','Queue','order','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','loginInPause','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xdd6d,0x90));var _0xddd6=function(_0x464872,_0x3a5a5f){_0x464872=_0x464872-0x0;var _0x2a369a=_0xdd6d[_0x464872];return _0x2a369a;};'use strict';var moment=require(_0xddd6('0x0'));var util=require(_0xddd6('0x1'));var path=require(_0xddd6('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xddd6('0x3'));var jayson=require(_0xddd6('0x4'));var Redis=require(_0xddd6('0x5'));var authService=require(_0xddd6('0x6'));var contacts=require(_0xddd6('0x7'));var qs=require(_0xddd6('0x8'));var logger=require(_0xddd6('0x9'))(_0xddd6('0xa'));var utils=require(_0xddd6('0xb'));var config=require(_0xddd6('0xc'));var licenseUtil=require(_0xddd6('0xd'));var APIBadRequestError=require(_0xddd6('0xe'))[_0xddd6('0xf')];var APINotFoundError=require(_0xddd6('0xe'))[_0xddd6('0x10')];var APIHandleError=require(_0xddd6('0xe'))[_0xddd6('0x11')];var db=require(_0xddd6('0x12'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xddd6('0x13')]));require(_0xddd6('0x14'))[_0xddd6('0x15')](socket);config[_0xddd6('0x13')]=_[_0xddd6('0x16')](config['redis'],{'host':_0xddd6('0x17'),'port':0x18eb});var amiClient=jayson['client'][_0xddd6('0x18')]({'port':0x232a});var values;function respondWithRpcPromise(_0x29814a,_0x9ba569,_0x316f7c,_0x1ce93b){return new Promise(function(_0x20fd16,_0xb81a0b){var _0x4eb439=_0x1ce93b||amiClient;return _0x4eb439['request'](_0x29814a,_0x316f7c)['then'](function(_0x5c6363){logger['info'](_0xddd6('0x19'),_0x9ba569,_0xddd6('0x1a'));logger[_0xddd6('0x1b')]('User,\x20%s,\x20%s,\x20%s',_0x9ba569,'request\x20sent',JSON[_0xddd6('0x1c')](_0x5c6363));if(_0x5c6363[_0xddd6('0x1d')]){if(_0x5c6363[_0xddd6('0x1d')][_0xddd6('0x1e')]===0x1f4){logger['error'](_0xddd6('0x19'),_0x9ba569,_0x5c6363['error'][_0xddd6('0x1f')]);return _0xb81a0b(_0x5c6363[_0xddd6('0x1d')][_0xddd6('0x1f')]);}logger['error'](_0xddd6('0x19'),_0x9ba569,_0x5c6363['error']['message']);return _0x20fd16(_0x5c6363[_0xddd6('0x1d')][_0xddd6('0x1f')]);}else{logger[_0xddd6('0x20')](_0xddd6('0x19'),_0x9ba569,_0xddd6('0x1a'));_0x20fd16(_0x5c6363[_0xddd6('0x21')]['message']);}})['catch'](function(_0x44c81a){logger[_0xddd6('0x1d')](_0xddd6('0x19'),_0x9ba569,_0x44c81a);_0xb81a0b(_0x44c81a);});});}function respondWithStatusCode(_0x3016c1,_0x12f884){_0x12f884=_0x12f884||0xcc;return function(_0x4b54be){if(_0x4b54be){return _0x3016c1['sendStatus'](_0x12f884);}return _0x3016c1[_0xddd6('0x22')](_0x12f884)[_0xddd6('0x23')]();};}function respondWithResult(_0x159e9e,_0x8cfb00){_0x8cfb00=_0x8cfb00||0xc8;return function(_0xa50a27){if(_0xa50a27){return _0x159e9e['status'](_0x8cfb00)[_0xddd6('0x24')](_0xa50a27);}};}function respondWithFilteredResult(_0xcd38b,_0x3ed9b9){return function(_0x3f3245){if(_0x3f3245){var _0x3465ca=typeof _0x3ed9b9[_0xddd6('0x25')]===_0xddd6('0x26')&&typeof _0x3ed9b9[_0xddd6('0x27')]===_0xddd6('0x26');var _0x3bb8a4=_0x3f3245[_0xddd6('0x28')];var _0x4a395e=_0x3465ca?0x0:_0x3ed9b9['offset'];var _0x4773ec=_0x3465ca?_0x3f3245['count']:_0x3ed9b9[_0xddd6('0x25')]+_0x3ed9b9['limit'];var _0xf5af97;if(_0x4773ec>=_0x3bb8a4){_0x4773ec=_0x3bb8a4;_0xf5af97=0xc8;}else{_0xf5af97=0xce;}_0xcd38b[_0xddd6('0x22')](_0xf5af97);return _0xcd38b[_0xddd6('0x29')](_0xddd6('0x2a'),_0x4a395e+'-'+_0x4773ec+'/'+_0x3bb8a4)[_0xddd6('0x24')](_0x3f3245);}return null;};}function saveUpdates(_0x299d5b){return function(_0x2006db){if(_0x2006db){return _0x2006db[_0xddd6('0x2b')](_0x299d5b)[_0xddd6('0x2c')](function(_0x278750){if(_0x278750[_0xddd6('0x2d')]===_0xddd6('0x2e')){socket['emit'](_0xddd6('0x2f')+_0x278750['id'],_0x278750);}return _0x278750;});}return null;};}function removeEntity(_0x1b0d2f){return function(_0x523b63){if(_0x523b63){return _0x523b63[_0xddd6('0x30')]()[_0xddd6('0x2c')](function(){var _0x269089=_0x523b63['get']({'plain':!![]});if(_0x269089['role']==='admin')return;var _0x3dc41d=[{'name':_0xddd6('0x31'),'value':'user','ignore':!![]},{'name':_0xddd6('0x32'),'value':_0xddd6('0x2e'),'ignore':![]},{'name':_0xddd6('0x33'),'value':_0xddd6('0x34'),'ignore':![]}];var _0x6d8759=_(_0x3dc41d)['filter'](_0xddd6('0x35'))[_0xddd6('0x36')](_0xddd6('0x37'))[_0xddd6('0x37')]();if(_['includes'](_0x6d8759,_0x269089[_0xddd6('0x2d')])){return;}var _0x5ec3f4=_[_0xddd6('0x38')](_0x3dc41d,[_0xddd6('0x37'),_0x269089[_0xddd6('0x2d')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x5ec3f4,'resourceId':_0x269089['id']}})['then'](function(){return _0x523b63;});})[_0xddd6('0x2c')](function(){_0x1b0d2f[_0xddd6('0x22')](0xcc)[_0xddd6('0x23')]();});}};}function handleEntityNotFound(_0x177f53){return function(_0xaee4b0){if(!_0xaee4b0){_0x177f53[_0xddd6('0x39')](0x194);}return _0xaee4b0;};}function handleError(_0x71ad2f,_0x1cf18f){_0x1cf18f=_0x1cf18f||0x1f4;return function(_0x5ba5de){logger[_0xddd6('0x1d')](_0x5ba5de[_0xddd6('0x3a')]);if(_0x5ba5de[_0xddd6('0x3b')]){delete _0x5ba5de[_0xddd6('0x3b')];}_0x71ad2f['status'](_0x1cf18f)[_0xddd6('0x3c')](_0x5ba5de);};}exports[_0xddd6('0x3d')]=function(_0x11c72a,_0x33513b){var _0x5e1100={},_0x50635d={'count':0x0,'rows':[]};var _0x546f0e=_(db[_0xddd6('0x3e')][_0xddd6('0x3f')])[_0xddd6('0x36')](function(_0x5f14a2){return{'name':_0x5f14a2[_0xddd6('0x40')],'type':_0x5f14a2[_0xddd6('0x41')]['key']};})[_0xddd6('0x42')](function(_0x371bde){return!_[_0xddd6('0x43')]([_0xddd6('0x44'),_0xddd6('0x45')],_0x371bde[_0xddd6('0x3b')]);})[_0xddd6('0x37')]();_0x5e1100=qs['getOptions'](_0x546f0e,_0x11c72a);var _0x26cbb2={'where':_0x5e1100[_0xddd6('0x46')]};return db[_0xddd6('0x3e')]['count'](_0x26cbb2)[_0xddd6('0x2c')](function(_0x4f2477){_0x50635d[_0xddd6('0x28')]=_0x4f2477;if(_0x11c72a['query'][_0xddd6('0x47')]){_0x5e1100[_0xddd6('0x48')]=[{'all':!![]}];}if(_0x11c72a[_0xddd6('0x49')][_0xddd6('0x4a')]===_0xddd6('0x4b')){_0x5e1100[_0xddd6('0x48')]=[{'model':db[_0xddd6('0x4c')],'as':_0xddd6('0x4a')}];}if(!_[_0xddd6('0x43')](_0x5e1100['attributes'],'id')){_0x5e1100[_0xddd6('0x4d')][_0xddd6('0x4e')]('id');}return db['User'][_0xddd6('0x4f')](_0x5e1100);})[_0xddd6('0x2c')](function(_0x4a304b){_0x50635d[_0xddd6('0x50')]=_0x4a304b;if(_0x11c72a[_0xddd6('0x49')][_0xddd6('0x51')]===_0xddd6('0x4b')){var _0x280842=[];for(var _0x29cd6d=0x0;_0x29cd6d<_0x50635d['rows'][_0xddd6('0x52')];_0x29cd6d++){_0x280842[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x53'),_0x50635d[_0xddd6('0x50')][_0x29cd6d][_0xddd6('0x54')]));_0x280842['push'](get_open_tabs(_0xddd6('0x55'),_0x50635d[_0xddd6('0x50')][_0x29cd6d][_0xddd6('0x54')]));_0x280842[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x56'),_0x50635d[_0xddd6('0x50')][_0x29cd6d]['dataValues']));_0x280842['push'](get_open_tabs(_0xddd6('0x57'),_0x50635d[_0xddd6('0x50')][_0x29cd6d][_0xddd6('0x54')]));_0x280842[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x58'),_0x50635d[_0xddd6('0x50')][_0x29cd6d][_0xddd6('0x54')]));_0x280842[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x59'),_0x50635d[_0xddd6('0x50')][_0x29cd6d][_0xddd6('0x54')]));}return Promise[_0xddd6('0x5a')](_0x280842)[_0xddd6('0x2c')](function(){return _0x50635d;});}else{return _0x50635d;}})[_0xddd6('0x2c')](respondWithFilteredResult(_0x33513b,_0x5e1100))[_0xddd6('0x5b')](handleError(_0x33513b,null));};exports['show']=function(_0x24d158,_0x27b219){var _0x5764a8={'raw':![],'where':{'id':_0x24d158['params']['id']}},_0x3ac8e8={};_0x3ac8e8[_0xddd6('0x5c')]=_[_0xddd6('0x5d')](_[_0xddd6('0x5e')](db['User'][_0xddd6('0x3f')]),[_0xddd6('0x44'),_0xddd6('0x45')]);_0x3ac8e8['query']=_[_0xddd6('0x5e')](_0x24d158[_0xddd6('0x49')]);_0x3ac8e8[_0xddd6('0x5f')]=_['intersection'](_0x3ac8e8['model'],_0x3ac8e8[_0xddd6('0x49')]);_0x5764a8[_0xddd6('0x4d')]=_[_0xddd6('0x60')](_0x3ac8e8['model'],qs[_0xddd6('0x61')](_0x24d158[_0xddd6('0x49')]['fields']));_0x5764a8[_0xddd6('0x4d')]=_0x5764a8[_0xddd6('0x4d')]['length']?_0x5764a8[_0xddd6('0x4d')]:_0x3ac8e8[_0xddd6('0x5c')];if(_0x24d158['query'][_0xddd6('0x47')]){_0x5764a8[_0xddd6('0x48')]=[{'all':!![]}];}if(_0x24d158[_0xddd6('0x49')][_0xddd6('0x4a')]===_0xddd6('0x4b')){_0x5764a8[_0xddd6('0x48')]=[{'model':db[_0xddd6('0x4c')],'as':_0xddd6('0x4a')}];}_0x5764a8=_[_0xddd6('0x62')]({},_0x5764a8,_0x24d158[_0xddd6('0x63')]);if(!_[_0xddd6('0x43')](_0x5764a8['attributes'],'id')){_0x5764a8[_0xddd6('0x4d')]['push']('id');}return db[_0xddd6('0x3e')]['find'](_0x5764a8)['then'](handleEntityNotFound(_0x27b219,null))[_0xddd6('0x2c')](function(_0x2d1c19){var _0x2495b1=[];values=_0x2d1c19;if(_0x24d158[_0xddd6('0x49')][_0xddd6('0x51')]==='true'){_0x2495b1[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x53'),_0x2d1c19['dataValues']));_0x2495b1[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x55'),_0x2d1c19['dataValues']));_0x2495b1['push'](get_open_tabs(_0xddd6('0x58'),_0x2d1c19[_0xddd6('0x54')]));_0x2495b1[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x59'),_0x2d1c19['dataValues']));_0x2495b1[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x56'),_0x2d1c19[_0xddd6('0x54')]));_0x2495b1['push'](get_open_tabs('mail',_0x2d1c19[_0xddd6('0x54')]));return Promise[_0xddd6('0x5a')](_0x2495b1);}else{return values;}})[_0xddd6('0x2c')](function(){return values;})[_0xddd6('0x2c')](respondWithResult(_0x27b219,null))[_0xddd6('0x5b')](handleError(_0x27b219,null));};exports[_0xddd6('0x2b')]=function(_0x2a2d0c,_0x429d93){if(_0x2a2d0c[_0xddd6('0x64')]['id']){delete _0x2a2d0c[_0xddd6('0x64')]['id'];}delete _0x2a2d0c[_0xddd6('0x64')][_0xddd6('0x2d')];return db['User']['find']({'where':{'id':_0x2a2d0c[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x429d93,null))[_0xddd6('0x2c')](saveUpdates(_0x2a2d0c[_0xddd6('0x64')],null))['then'](respondWithResult(_0x429d93,null))[_0xddd6('0x5b')](handleError(_0x429d93,null));};exports['describe']=function(_0x468017,_0x159ba7){return db[_0xddd6('0x3e')][_0xddd6('0x66')]()[_0xddd6('0x2c')](respondWithResult(_0x159ba7,null))['catch'](handleError(_0x159ba7,null));};exports['addContacts']=function(_0x2e26b6,_0x335c9d){return db['User'][_0xddd6('0x38')]({'where':{'id':_0x2e26b6[_0xddd6('0x65')]['id']}})['then'](handleEntityNotFound(_0x335c9d,null))['then'](function(_0x4c7e0b){if(_0x4c7e0b){return _0x4c7e0b['addContacts'](_0x2e26b6[_0xddd6('0x64')][_0xddd6('0x67')],_[_0xddd6('0x68')](_0x2e26b6[_0xddd6('0x64')],[_0xddd6('0x67'),'id'])||{});}})['then'](respondWithResult(_0x335c9d,null))[_0xddd6('0x5b')](handleError(_0x335c9d,null));};function validateUser(_0x35b674){return new Promise(function(_0x423279,_0x1df9c7){if(_0x35b674[_0xddd6('0x69')])return _0x423279(_0x35b674);return db[_0xddd6('0x6a')][_0xddd6('0x6b')](0x1)[_0xddd6('0x2c')](function(_0x515ca6){if(_0x515ca6['securePassword'])authService['validatePasswordPattern'](_0x35b674[_0xddd6('0x44')]);db['User']['max']('internal')['then'](function(_0x41ecef){if(_[_0xddd6('0x6c')](_0x41ecef)){_0x35b674['internal']=_0x515ca6['min_internal']||0x1;return;}if(_[_0xddd6('0x6c')](_0x515ca6[_0xddd6('0x6d')])||_0x515ca6[_0xddd6('0x6d')]===_0x41ecef){_0x35b674[_0xddd6('0x69')]=_0x41ecef+0x1;return;}if(_0x515ca6[_0xddd6('0x6d')]>_0x41ecef){_0x35b674[_0xddd6('0x69')]=_0x515ca6[_0xddd6('0x6d')];return;}return db[_0xddd6('0x6e')]['query'](_0xddd6('0x6f'),{'type':db['sequelize'][_0xddd6('0x70')][_0xddd6('0x71')]})[_0xddd6('0x2c')](function(_0x2d7d6d){if(_0x2d7d6d&&_0x2d7d6d[_0xddd6('0x52')]){for(var _0x7d20bc=0x0,_0x5ce630=_0x2d7d6d[_0xddd6('0x52')];_0x7d20bc<_0x5ce630&&_[_0xddd6('0x6c')](_0x35b674[_0xddd6('0x69')]);_0x7d20bc++){if(_0x515ca6['min_internal']<=_0x2d7d6d[_0x7d20bc][_0xddd6('0x72')]){_0x35b674[_0xddd6('0x69')]=_0x2d7d6d[_0x7d20bc][_0xddd6('0x72')];}else if(_0x515ca6[_0xddd6('0x6d')]>_0x2d7d6d[_0x7d20bc][_0xddd6('0x72')]&&_0x515ca6[_0xddd6('0x6d')]<=_0x2d7d6d[_0x7d20bc]['to']){_0x35b674[_0xddd6('0x69')]=_0x515ca6[_0xddd6('0x6d')];}}}if(_[_0xddd6('0x6c')](_0x35b674[_0xddd6('0x69')])){_0x35b674[_0xddd6('0x69')]=_0x41ecef+0x1;}return _0x423279(_0x35b674);});});})[_0xddd6('0x5b')](function(_0x229158){_0x1df9c7(_0x229158);});});}function updateUser(_0xb40de0){return new Promise(function(_0x268cd3,_0x48c031){try{if(_0xb40de0[_0xddd6('0x73')]){_0xb40de0[_0xddd6('0x74')]=_0xb40de0[_0xddd6('0x69')];_0xb40de0[_0xddd6('0x75')]={'mailbox':_0xb40de0[_0xddd6('0x69')],'password':_0xb40de0['password'],'fullname':_0xb40de0[_0xddd6('0x76')],'email':_0xb40de0[_0xddd6('0x77')]};}if(_0xb40de0[_0xddd6('0x2d')]===_0xddd6('0x2e')){if(!_0xb40de0[_0xddd6('0x78')])_0xb40de0[_0xddd6('0x78')]=[_0xddd6('0x79'),_0xddd6('0x7a'),'103',_0xddd6('0x7b'),_0xddd6('0x7c'),_0xddd6('0x7d'),_0xddd6('0x7e'),_0xddd6('0x7f'),_0xddd6('0x80'),_0xddd6('0x81'),'109','100','111','114','115'];}_0x268cd3(_0xb40de0);}catch(_0x1bb1b0){_0x48c031(_0x1bb1b0);}});}exports['create']=function(_0x5b6983,_0x2fb8ef){if(_0x5b6983[_0xddd6('0x82')][_0xddd6('0x2d')]===_0xddd6('0x2e'))throw new Error('Unauthorized');if(_0x5b6983[_0xddd6('0x64')]['role']===_0xddd6('0x82')&&_0x5b6983[_0xddd6('0x82')]['role']!==_0xddd6('0x83')){throw new Error(_0xddd6('0x84'));}if(_0x5b6983[_0xddd6('0x64')][_0xddd6('0x2d')]==='admin'&&_0x5b6983[_0xddd6('0x82')][_0xddd6('0x2d')]!==_0xddd6('0x83')){throw new Error(_0xddd6('0x85'));}return licenseUtil[_0xddd6('0x86')]([_0x5b6983[_0xddd6('0x64')]])[_0xddd6('0x2c')](function(){return validateUser(_0x5b6983[_0xddd6('0x64')]);})[_0xddd6('0x2c')](function(_0x28229f){return updateUser(_0x28229f)[_0xddd6('0x2c')](function(_0x5474c7){if(_0x5474c7['role']===_0xddd6('0x83')){_0x5474c7['settingsEnabled']=_0x5b6983[_0xddd6('0x82')][_0xddd6('0x87')];delete _0x5474c7[_0xddd6('0x88')];}return _0x5474c7;});})[_0xddd6('0x2c')](function(_0xbab0b){return db['User'][_0xddd6('0x89')](_0xbab0b,{'include':[{'model':db[_0xddd6('0x75')],'as':_0xddd6('0x75')}]});})[_0xddd6('0x2c')](function(_0x169992){if(_0x5b6983[_0xddd6('0x64')][_0xddd6('0x2d')]==='user')return _0x169992;if(_0x5b6983[_0xddd6('0x82')][_0xddd6('0x2d')]!==_0xddd6('0x82'))return _0x169992;return db[_0xddd6('0x8a')]['find']({'where':{'name':_0x169992[_0xddd6('0x2d')]===_0xddd6('0x2e')?_0xddd6('0x32'):'Telephones','userProfileId':_0x5b6983[_0xddd6('0x82')][_0xddd6('0x88')]},'raw':!![]})[_0xddd6('0x2c')](function(_0x2cc092){if(!_0x2cc092||_0x2cc092[_0xddd6('0x8b')]!=0x0)return _0x169992;return db[_0xddd6('0x8c')][_0xddd6('0x89')]({'name':_0x169992[_0xddd6('0x3b')],'resourceId':_0x169992['id'],'type':_0x2cc092[_0xddd6('0x3b')],'sectionId':_0x2cc092['id']},{})[_0xddd6('0x2c')](function(){return _0x169992;});})['catch'](function(_0x4acdf5){logger[_0xddd6('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4acdf5);throw _0x4acdf5;});})[_0xddd6('0x2c')](respondWithResult(_0x2fb8ef,0xc9))[_0xddd6('0x5b')](handleError(_0x2fb8ef,null));};exports[_0xddd6('0x8d')]=function(_0x4731e8,_0x78f142){var _0x505516=_0x4731e8['body'];var _0x66c8f6=[];if(_0x4731e8[_0xddd6('0x82')][_0xddd6('0x2d')]===_0xddd6('0x2e'))throw new Error(_0xddd6('0x8e'));if(_[_0xddd6('0x8f')](_0x505516,[_0xddd6('0x2d'),_0xddd6('0x82')])&&_0x4731e8[_0xddd6('0x82')][_0xddd6('0x2d')]!==_0xddd6('0x83')){throw new Error(_0xddd6('0x84'));}if(_[_0xddd6('0x8f')](_0x505516,[_0xddd6('0x2d'),_0xddd6('0x83')])&&_0x4731e8['user']['role']!==_0xddd6('0x83')){throw new Error(_0xddd6('0x90'));}return licenseUtil['checkUserLimits'](_0x505516)[_0xddd6('0x2c')](function(){return validateUser(_0x505516[0x0]);})[_0xddd6('0x2c')](function(){for(var _0x3f5c85=0x1;_0x3f5c85<_0x505516[_0xddd6('0x52')];_0x3f5c85++){var _0x4f4c25=_0x505516[_0x3f5c85-0x1][_0xddd6('0x69')];if(!_0x505516[_0x3f5c85][_0xddd6('0x69')])_0x505516[_0x3f5c85][_0xddd6('0x69')]=_0x4f4c25+0x1;_0x66c8f6[_0xddd6('0x4e')](validateUser(_0x505516[_0x3f5c85]));}return Promise['all'](_0x66c8f6);})[_0xddd6('0x2c')](function(){_0x66c8f6=[];for(var _0x1dcc64=0x0;_0x1dcc64<_0x505516[_0xddd6('0x52')];_0x1dcc64++){_0x66c8f6[_0xddd6('0x4e')](updateUser(_0x505516[_0x1dcc64]));}return Promise[_0xddd6('0x5a')](_0x66c8f6);})[_0xddd6('0x2c')](function(){_0x66c8f6=_0x505516['map'](function(_0x30e4c7){return db[_0xddd6('0x3e')][_0xddd6('0x89')](_0x30e4c7,{'include':[{'model':db[_0xddd6('0x75')],'as':_0xddd6('0x75')}]})[_0xddd6('0x2c')](function(_0x522132){_0x30e4c7['id']=_0x522132['id'];return _0x30e4c7;});});return Promise[_0xddd6('0x5a')](_0x66c8f6);})[_0xddd6('0x2c')](function(_0x30a43f){if(_0x4731e8['body'][_0xddd6('0x2d')]===_0xddd6('0x82'))return _0x30a43f;if(_0x4731e8[_0xddd6('0x82')][_0xddd6('0x2d')]!==_0xddd6('0x82'))return _0x30a43f;var _0x4b5037=_[_0xddd6('0x8f')](_0x30a43f,function(_0x159572){return _0x159572[_0xddd6('0x2d')]===_0xddd6('0x2e')||_0x159572[_0xddd6('0x2d')]===_0xddd6('0x34');});if(!_0x4b5037)return _0x30a43f;return db[_0xddd6('0x8a')][_0xddd6('0x4f')]({'where':{'name':{'$or':[_0xddd6('0x32'),_0xddd6('0x33')]},'userProfileId':_0x4731e8[_0xddd6('0x82')]['userProfileId']},'raw':!![]})['then'](function(_0xae6ee2){if(_[_0xddd6('0x91')](_0xae6ee2)||!_[_0xddd6('0x8f')](_0xae6ee2,[_0xddd6('0x8b'),0x0]))return _0x30a43f;_0x66c8f6=[];var _0x4a6e60=_(_0xae6ee2)[_0xddd6('0x36')](function(_0x4da5c0){if(_0x4da5c0['autoAssociation']===0x1)return;return _0x4da5c0[_0xddd6('0x3b')]==='Agents'?'agent':'telephone';})['compact']()[_0xddd6('0x37')]();for(var _0x364588=0x0;_0x364588<_0x30a43f[_0xddd6('0x52')];_0x364588++){if(!_[_0xddd6('0x43')](_0x4a6e60,_0x30a43f[_0x364588][_0xddd6('0x2d')]))return;var _0x11162a=_0x30a43f[_0x364588][_0xddd6('0x2d')]===_0xddd6('0x2e')?_0xddd6('0x32'):_0xddd6('0x33');_0x66c8f6[_0xddd6('0x4e')](db[_0xddd6('0x8c')][_0xddd6('0x89')]({'name':_0x30a43f[_0x364588][_0xddd6('0x3b')],'resourceId':_0x30a43f[_0x364588]['id'],'type':_0x11162a,'sectionId':_[_0xddd6('0x38')](_0xae6ee2,[_0xddd6('0x3b'),_0x11162a])['id']},{}));}return Promise[_0xddd6('0x5a')](_0x66c8f6);});})['then'](respondWithResult(_0x78f142,0xc9))['catch'](handleError(_0x78f142,null));};exports['changePassword']=function(_0x3828d1,_0xa270aa){if(_0x3828d1['body']['id']){delete _0x3828d1[_0xddd6('0x64')]['id'];}return db[_0xddd6('0x3e')][_0xddd6('0x38')]({'where':{'id':_0x3828d1[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](function(_0x56de52){if(!_0x56de52)return null;if(_0x56de52['id']===_0x3828d1[_0xddd6('0x82')]['id']){if(!_0x3828d1[_0xddd6('0x64')][_0xddd6('0x92')]||!_0x3828d1[_0xddd6('0x64')][_0xddd6('0x93')]){throw new db[(_0xddd6('0x94'))]['ValidationError'](_0xddd6('0x95'));}if(!_0x56de52[_0xddd6('0x96')](_0x3828d1[_0xddd6('0x64')][_0xddd6('0x92')])){throw new db['Sequelize']['ValidationError'](_0xddd6('0x97'));}if(_0x3828d1[_0xddd6('0x64')][_0xddd6('0x92')]===_0x3828d1[_0xddd6('0x64')][_0xddd6('0x93')]){throw new db[(_0xddd6('0x94'))][(_0xddd6('0x98'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x3828d1[_0xddd6('0x82')]['role']===_0xddd6('0x83')){if(!_0x3828d1[_0xddd6('0x64')][_0xddd6('0x93')]){throw new db[(_0xddd6('0x94'))][(_0xddd6('0x98'))](_0xddd6('0x99'));}}else if(_0x3828d1[_0xddd6('0x82')][_0xddd6('0x2d')]===_0xddd6('0x82')){if(!_0x3828d1['body'][_0xddd6('0x93')]){throw new db[(_0xddd6('0x94'))]['ValidationError'](_0xddd6('0x99'));}if(_0x56de52['role']!=='agent'){throw new db[(_0xddd6('0x94'))][(_0xddd6('0x98'))](_0xddd6('0x8e'));}}else{throw new db['Sequelize']['ValidationError'](_0xddd6('0x8e'));}return _0x56de52;})[_0xddd6('0x2c')](handleEntityNotFound(_0xa270aa,null))[_0xddd6('0x2c')](function(_0x524e65){return db[_0xddd6('0x6a')][_0xddd6('0x9a')]({'attributes':['id',_0xddd6('0x9b'),_0xddd6('0x9c'),_0xddd6('0x9d')]})[_0xddd6('0x2c')](function(_0x5057d4){if(_0x5057d4[_0xddd6('0x9b')])authService[_0xddd6('0x9e')](_0x3828d1[_0xddd6('0x64')][_0xddd6('0x93')]);if(!_0x5057d4['enforcePasswordHistory']||!_0x524e65[_0xddd6('0x9f')])return _0x524e65;authService[_0xddd6('0xa0')](_0x3828d1[_0xddd6('0x64')][_0xddd6('0x93')],_0x524e65[_0xddd6('0x9f')],_0x5057d4[_0xddd6('0x9d')]);return _0x524e65;})[_0xddd6('0x2c')](saveUpdates({'password':_0x3828d1[_0xddd6('0x64')][_0xddd6('0x93')],'passwordResetAt':_0x3828d1[_0xddd6('0x82')]['id']==_0x3828d1[_0xddd6('0x65')]['id']?moment():null,'previousPasswords':authService[_0xddd6('0xa1')](_0x3828d1[_0xddd6('0x64')][_0xddd6('0x93')],_0x524e65[_0xddd6('0x9f')])},null));})[_0xddd6('0x2c')](respondWithResult(_0xa270aa,null))[_0xddd6('0x5b')](handleError(_0xa270aa,null));};exports[_0xddd6('0xa2')]=function(_0xc312fd,_0x4497b1){var _0x48075a=_0xc312fd[_0xddd6('0x64')][_0xddd6('0xa3')];return db[_0xddd6('0x3e')][_0xddd6('0x38')]({'where':{'id':_0xc312fd['params']['id']},'attributes':['id',_0xddd6('0x3b'),'role',_0xddd6('0xa4'),'loginInPause',_0xddd6('0xa5'),_0xddd6('0xa6')]})[_0xddd6('0x2c')](handleEntityNotFound(_0x4497b1,null))[_0xddd6('0x2c')](function(_0x40196f){if(_0x40196f){if(!utils[_0xddd6('0xa7')](_0x48075a)){throw new db[(_0xddd6('0x94'))]['ValidationError'](_0xddd6('0xa8'));}return _0x40196f[_0xddd6('0xa9')+_[_0xddd6('0xaa')](_0x48075a[_0xddd6('0xab')]())+_0xddd6('0xac')](_0xc312fd[_0xddd6('0x64')][_0xddd6('0x67')],{'penalty':_0xc312fd[_0xddd6('0x64')]['penalty']||0x0})[_0xddd6('0xad')](function(_0x7fdff7){for(var _0x3f70a8=0x0;_0x3f70a8<_0xc312fd[_0xddd6('0x64')]['ids']['length'];_0x3f70a8+=0x1){var _0x3a65c7={'UserId':Number(_0xc312fd[_0xddd6('0x65')]['id'])};_0x3a65c7[_[_0xddd6('0xaa')](_0x48075a[_0xddd6('0xab')]())+_0xddd6('0xae')]=Number(_0xc312fd['body'][_0xddd6('0x67')][_0x3f70a8]);socket[_0xddd6('0xaf')](_0xddd6('0x82')+_[_0xddd6('0xaa')](_0x48075a[_0xddd6('0xab')]())+_0xddd6('0xb0'),_0x3a65c7);}return _0x7fdff7;})['then'](function(){if(_0x48075a===_0xddd6('0xb1')){return db['VoiceQueue'][_0xddd6('0x4f')]({'where':{'id':_0xc312fd[_0xddd6('0x64')][_0xddd6('0x67')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xddd6('0x2c')](function(_0x1217a7){var _0x3414f4=_0x40196f[_0xddd6('0xb2')]({'plain':!![]});var _0x153150=[];if(_0x48075a==='voice'&&_0x3414f4['role']===_0xddd6('0x2e')&&_0x3414f4['online']){for(let _0x1371d4=0x0;_0x1371d4<_0x1217a7[_0xddd6('0x52')];_0x1371d4+=0x1){_0x153150[_0xddd6('0x4e')]({'membername':_0x3414f4['name'],'UserId':_0x3414f4['id'],'queue_name':_0x1217a7[_0x1371d4]['name'],'VoiceQueueId':_0x1217a7[_0x1371d4]['id'],'interface':_[_0xddd6('0x6c')](_0x3414f4[_0xddd6('0xa6')])?util[_0xddd6('0xb3')]('SIP/%s',_0x3414f4['name']):_0x3414f4['interface'],'paused':_0x3414f4[_0xddd6('0xa5')]||![],'penalty':_0xc312fd[_0xddd6('0x64')][_0xddd6('0xb4')]||0x0});}return Promise[_0xddd6('0x5a')](_0x153150[_0xddd6('0x36')](function(_0x1d18bc){return db[_0xddd6('0xb5')]['upsert'](_0x1d18bc);}));}return _0x40196f;});}})[_0xddd6('0x2c')](respondWithStatusCode(_0x4497b1,null))['catch'](handleError(_0x4497b1,null));};exports[_0xddd6('0xb6')]=function(_0x34b4b2,_0x140e86){var _0x21563b,_0x79aea5;return db[_0xddd6('0x3e')]['find']({'where':{'id':_0x34b4b2[_0xddd6('0x65')]['id']},'attributes':['id',_0xddd6('0x3b'),_0xddd6('0x2d')]})['then'](handleEntityNotFound(_0x140e86,null))[_0xddd6('0x2c')](function(_0x33b8a6){if(_0x33b8a6){_0x21563b=_0x33b8a6;if(!_0x34b4b2[_0xddd6('0x49')][_0xddd6('0xa3')]||!utils['isValidChannel'](_0x34b4b2[_0xddd6('0x49')][_0xddd6('0xa3')])){throw new db[(_0xddd6('0x94'))][(_0xddd6('0x98'))](_0xddd6('0xa8'));}return _0x33b8a6[_0xddd6('0xb7')+_[_0xddd6('0xaa')](_0x34b4b2[_0xddd6('0x49')][_0xddd6('0xa3')]['toLowerCase']())+_0xddd6('0xac')](_0x34b4b2[_0xddd6('0x49')][_0xddd6('0x67')]);}})[_0xddd6('0x2c')](function(_0x2a851b){if(_[_0xddd6('0xb8')](_0x34b4b2[_0xddd6('0x49')][_0xddd6('0x67')])){for(var _0x591721=0x0;_0x591721<_0x34b4b2[_0xddd6('0x49')]['ids'][_0xddd6('0x52')];_0x591721+=0x1){_0x79aea5={'UserId':Number(_0x34b4b2['params']['id'])};_0x79aea5[_[_0xddd6('0xaa')](_0x34b4b2[_0xddd6('0x49')][_0xddd6('0xa3')][_0xddd6('0xab')]())+_0xddd6('0xae')]=Number(_0x34b4b2['query']['ids'][_0x591721]);socket[_0xddd6('0xaf')](_0xddd6('0x82')+_[_0xddd6('0xaa')](_0x34b4b2[_0xddd6('0x49')]['channel']['toLowerCase']())+_0xddd6('0xb9'),_0x79aea5);}}else{_0x79aea5={'UserId':Number(_0x34b4b2[_0xddd6('0x65')]['id'])};_0x79aea5[_['capitalize'](_0x34b4b2[_0xddd6('0x49')][_0xddd6('0xa3')]['toLowerCase']())+'QueueId']=Number(_0x34b4b2[_0xddd6('0x49')][_0xddd6('0x67')]);socket[_0xddd6('0xaf')]('user'+_[_0xddd6('0xaa')](_0x34b4b2['query'][_0xddd6('0xa3')][_0xddd6('0xab')]())+'Queue:remove',_0x79aea5);}return _0x2a851b;})[_0xddd6('0x2c')](function(){if(_0x34b4b2[_0xddd6('0x49')][_0xddd6('0xa3')]===_0xddd6('0xb1')){return db['UserVoiceQueueRt'][_0xddd6('0x30')]({'where':{'UserId':_0x34b4b2[_0xddd6('0x65')]['id'],'VoiceQueueId':_0x34b4b2[_0xddd6('0x49')][_0xddd6('0x67')]},'individualHooks':!![]})[_0xddd6('0x2c')](function(){return _0x21563b;});}return _0x21563b;})[_0xddd6('0x2c')](respondWithStatusCode(_0x140e86,null))['catch'](handleError(_0x140e86,null));};exports[_0xddd6('0xba')]=function(_0x20cf97,_0x59810c){_0x20cf97[_0xddd6('0x64')][_0xddd6('0xbb')]=_0x20cf97['file'][_0xddd6('0xbc')];return db['User'][_0xddd6('0x38')]({'where':{'id':_0x20cf97[_0xddd6('0x65')]['id']}})['then'](handleEntityNotFound(_0x59810c,null))[_0xddd6('0x2c')](saveUpdates(_0x20cf97[_0xddd6('0x64')],null))[_0xddd6('0x2c')](respondWithResult(_0x59810c,null))[_0xddd6('0x5b')](handleError(_0x59810c,null));};exports[_0xddd6('0xbd')]=function(_0x23cd25,_0x4c767d){var _0x198669=path[_0xddd6('0xbe')](config[_0xddd6('0xbf')],_0xddd6('0xc0'));return db[_0xddd6('0x3e')]['find']({'where':{'id':_0x23cd25[_0xddd6('0x65')]['id']},'attributes':['id',_0xddd6('0xbb')],'raw':!![]})['then'](handleEntityNotFound(_0x4c767d,null))['then'](function(_0x30ccfb){if(_0x30ccfb){if(_[_0xddd6('0x6c')](_0x30ccfb[_0xddd6('0xbb')])){return _0x4c767d[_0xddd6('0xc1')](_0x198669);}else{if(!fs[_0xddd6('0xc2')](path[_0xddd6('0xbe')](config['root'],_0xddd6('0xc3'),_0x30ccfb[_0xddd6('0xbb')]))){return _0x4c767d[_0xddd6('0xc1')](_0x198669);}return _0x4c767d[_0xddd6('0xc1')](path[_0xddd6('0xbe')](config[_0xddd6('0xbf')],_0xddd6('0xc3'),_0x30ccfb[_0xddd6('0xbb')]));}}})['catch'](handleError(_0x4c767d,null));};exports[_0xddd6('0xc4')]=function(_0x90f91a,_0x1eb051){return db[_0xddd6('0x3e')]['find']({'where':{'id':_0x90f91a['params']['id']},'attributes':['id']})[_0xddd6('0x2c')](handleEntityNotFound(_0x1eb051,null))['then'](function(_0x15c51a){var _0x5d5a2d=[];values=_0x15c51a[_0xddd6('0x54')];_0x5d5a2d[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x53'),_0x15c51a[_0xddd6('0x54')]));_0x5d5a2d[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x55'),_0x15c51a['dataValues']));_0x5d5a2d[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x58'),_0x15c51a[_0xddd6('0x54')]));_0x5d5a2d[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x59'),_0x15c51a[_0xddd6('0x54')]));_0x5d5a2d['push'](get_open_tabs(_0xddd6('0x56'),_0x15c51a[_0xddd6('0x54')]));_0x5d5a2d[_0xddd6('0x4e')](get_open_tabs(_0xddd6('0x57'),_0x15c51a['dataValues']));return Promise[_0xddd6('0x5a')](_0x5d5a2d);})['then'](function(_0x28ce66){if(_0x28ce66){var _0x31f792=_[_0xddd6('0x36')](values[_0xddd6('0xc5')],function(_0x395702){return{'channel':_0xddd6('0xc6'),'id':_0x395702['id'],'createdAt':_0x395702[_0xddd6('0xc7')]};});var _0x4424f9=_[_0xddd6('0x36')](values[_0xddd6('0xc8')],function(_0x37cc69){return{'channel':'FAX','id':_0x37cc69['id'],'createdAt':_0x37cc69[_0xddd6('0xc7')]};});var _0x356a60=_[_0xddd6('0x36')](values[_0xddd6('0xc9')],function(_0x3945bb){return{'channel':_0xddd6('0xca'),'id':_0x3945bb['id'],'createdAt':_0x3945bb[_0xddd6('0xc7')]};});var _0x37e6a7=_[_0xddd6('0x36')](values[_0xddd6('0xcb')],function(_0x13c7ed){return{'channel':_0xddd6('0xcc'),'id':_0x13c7ed['id'],'createdAt':_0x13c7ed[_0xddd6('0xc7')]};});var _0x180765=_[_0xddd6('0x36')](values[_0xddd6('0xcd')],function(_0x4ba3c3){return{'channel':_0xddd6('0xce'),'id':_0x4ba3c3['id'],'createdAt':_0x4ba3c3[_0xddd6('0xc7')]};});var _0x49ec9a=_[_0xddd6('0x36')](values[_0xddd6('0xcf')],function(_0x342eb3){return{'channel':_0xddd6('0xd0'),'id':_0x342eb3['id'],'createdAt':_0x342eb3['createdAt']};});var _0x3b54d3=_[_0xddd6('0xd1')](_0x31f792,_0x4424f9,_0x356a60,_0x37e6a7,_0x180765,_0x49ec9a);var _0x593189={'count':_0x3b54d3[_0xddd6('0x52')],'rows':_0x3b54d3};return _0x593189;}else return null;})['then'](respondWithResult(_0x1eb051,null))[_0xddd6('0x5b')](handleError(_0x1eb051,null));};exports['getContacts']=function(_0x241219,_0x56bac4){var _0x43ae44={};return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x241219['params']['id']}})[_0xddd6('0x2c')](function(_0x453cf3){if(!_0x453cf3){throw new APINotFoundError(util[_0xddd6('0xb3')](_0xddd6('0xd2'),_0x241219[_0xddd6('0x65')]['id']));}return contacts[_0xddd6('0x66')]();})[_0xddd6('0x2c')](function(_0x3c54ca){_0x241219[_0xddd6('0x49')]['User']=_0x241219[_0xddd6('0x65')]['id'];_0x43ae44=qs['getOptions'](_0x3c54ca,_0x241219);if(_0x241219['query'][_0xddd6('0xd3')](_0xddd6('0x47'))){_0x43ae44[_0xddd6('0x48')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xddd6('0xd4')],'as':_0xddd6('0xd5'),'attributes':['id',_0xddd6('0x3b'),_0xddd6('0xd6')],'where':_0x241219['query'][_0xddd6('0xd7')]?{'id':_0x241219[_0xddd6('0x49')][_0xddd6('0xd7')]}:undefined,'required':_0x241219[_0xddd6('0x49')][_0xddd6('0xd7')]?!![]:![]}];}return contacts[_0xddd6('0x4f')](_0x241219['query'],_0x241219['user'],_0x43ae44,_0x3c54ca);})['then'](respondWithFilteredResult(_0x56bac4,_0x43ae44))['catch'](APIHandleError(_0x56bac4));};exports[_0xddd6('0xd8')]=function(_0x82ea6,_0x1aa27b){var _0x44cb7f;var _0x65b099={};var _0x2a26ed;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x82ea6['params']['id']},'attributes':['id',_0xddd6('0x3b'),_0xddd6('0x2d')]})[_0xddd6('0x2c')](handleEntityNotFound(_0x1aa27b,null))['then'](function(_0x2b1c43){if(!utils['isValidChannel'](_0x82ea6[_0xddd6('0x49')][_0xddd6('0xa3')])){throw new db[(_0xddd6('0x94'))][(_0xddd6('0x98'))](_0xddd6('0xa8'));}_0x44cb7f=_0x2b1c43;var _0x5db397={};_0x5db397[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_['capitalize'](_0x82ea6[_0xddd6('0x49')][_0xddd6('0xa3')])+_0xddd6('0xd9')]['rawAttributes']);_0x5db397[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x82ea6['query']);_0x5db397[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x5db397['model'],_0x5db397[_0xddd6('0x49')]);_0x65b099[_0xddd6('0x4d')]=_['intersection'](_0x5db397[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x82ea6[_0xddd6('0x49')][_0xddd6('0x61')]));_0x65b099[_0xddd6('0x4d')]=_0x65b099['attributes']['length']?_0x65b099['attributes']:_0x5db397[_0xddd6('0x5c')];_0x65b099[_0xddd6('0xda')]=qs['sort'](_0x82ea6[_0xddd6('0x49')][_0xddd6('0xdb')]);_0x65b099[_0xddd6('0x46')]=qs[_0xddd6('0x5f')](_[_0xddd6('0xdc')](_0x82ea6[_0xddd6('0x49')],_0x5db397[_0xddd6('0x5f')]));if(_0x82ea6[_0xddd6('0x49')]['filter']){_0x65b099['where']=_['merge'](_0x65b099[_0xddd6('0x46')],{'$or':_['map'](_0x65b099[_0xddd6('0x4d')],function(_0x3cfe96){var _0x34f158={};_0x34f158[_0x3cfe96]={'$like':'%'+_0x82ea6['query']['filter']+'%'};return _0x34f158;})});}_0x65b099=_[_0xddd6('0x62')]({},_0x65b099,_0x82ea6[_0xddd6('0x63')]);switch(_0x44cb7f[_0xddd6('0x2d')]){case'admin':return db[_[_0xddd6('0xaa')](_0x82ea6['query'][_0xddd6('0xa3')])+_0xddd6('0xd9')][_0xddd6('0x4f')](_0x65b099);case _0xddd6('0x82'):case _0xddd6('0x2e'):return _0x44cb7f[_0xddd6('0xb2')+_[_0xddd6('0xaa')](_0x82ea6[_0xddd6('0x49')][_0xddd6('0xa3')])+_0xddd6('0xac')](_0x65b099);default:throw new db[(_0xddd6('0x94'))][(_0xddd6('0x98'))](_0xddd6('0xdd'));}})[_0xddd6('0x2c')](function(_0x571006){_0x2a26ed=_0x571006[_0xddd6('0x52')];if(!_0x82ea6['query'][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x65b099[_0xddd6('0x27')]=qs['limit'](_0x82ea6[_0xddd6('0x49')][_0xddd6('0x27')]);_0x65b099[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0x82ea6[_0xddd6('0x49')]['offset']);}switch(_0x44cb7f['role']){case _0xddd6('0x83'):return db[_[_0xddd6('0xaa')](_0x82ea6['query'][_0xddd6('0xa3')])+_0xddd6('0xd9')]['findAll'](_0x65b099);case _0xddd6('0x82'):case _0xddd6('0x2e'):return _0x44cb7f['get'+_[_0xddd6('0xaa')](_0x82ea6[_0xddd6('0x49')]['channel'])+'Queues'](_0x65b099);}})[_0xddd6('0x2c')](function(_0x353736){return{'count':_0x2a26ed,'rows':_0x353736};})[_0xddd6('0x2c')](respondWithResult(_0x1aa27b,null))[_0xddd6('0x5b')](handleError(_0x1aa27b,null));};exports[_0xddd6('0xdf')]=function(_0x1e568c,_0x17bd08){var _0x5a6a79={};var _0x4b80ca={};var _0x1f350f;var _0xc8ac77;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x1e568c[_0xddd6('0x65')]['id']}})['then'](handleEntityNotFound(_0x17bd08,null))[_0xddd6('0x2c')](function(_0x1afaca){if(_0x1afaca){_0x1f350f=_0x1afaca;_0x4b80ca[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_0xddd6('0xb5')][_0xddd6('0x3f')]);_0x4b80ca['query']=_[_0xddd6('0x5e')](_0x1e568c[_0xddd6('0x49')]);_0x4b80ca[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x4b80ca['model'],_0x4b80ca[_0xddd6('0x49')]);_0x5a6a79[_0xddd6('0x4d')]=_[_0xddd6('0x60')](_0x4b80ca[_0xddd6('0x5c')],qs['fields'](_0x1e568c[_0xddd6('0x49')][_0xddd6('0x61')]));_0x5a6a79[_0xddd6('0x4d')]=_0x5a6a79[_0xddd6('0x4d')][_0xddd6('0x52')]?_0x5a6a79['attributes']:_0x4b80ca[_0xddd6('0x5c')];_0x5a6a79[_0xddd6('0xda')]=qs['sort'](_0x1e568c[_0xddd6('0x49')][_0xddd6('0xdb')]);_0x5a6a79[_0xddd6('0x46')]=qs[_0xddd6('0x5f')](_[_0xddd6('0xdc')](_0x1e568c[_0xddd6('0x49')],_0x4b80ca['filters']));if(_0x1e568c[_0xddd6('0x49')]['filter']){_0x5a6a79[_0xddd6('0x46')]=_[_0xddd6('0x62')](_0x5a6a79['where'],{'$or':_['map'](_0x5a6a79[_0xddd6('0x4d')],function(_0x84dc64){var _0x2ff68c={};_0x2ff68c[_0x84dc64]={'$like':'%'+_0x1e568c[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x2ff68c;})});}_0x5a6a79=_['merge']({},_0x5a6a79,_0x1e568c[_0xddd6('0x63')]);return _0x1f350f[_0xddd6('0xdf')](_0x5a6a79);}})[_0xddd6('0x2c')](function(_0x4bc9d8){if(_0x4bc9d8){_0xc8ac77=_0x4bc9d8[_0xddd6('0x52')];if(!_0x1e568c[_0xddd6('0x49')][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x5a6a79[_0xddd6('0x27')]=qs[_0xddd6('0x27')](_0x1e568c[_0xddd6('0x49')][_0xddd6('0x27')]);_0x5a6a79[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0x1e568c[_0xddd6('0x49')]['offset']);}return _0x1f350f[_0xddd6('0xdf')](_0x5a6a79);}})['then'](function(_0x445ae3){if(_0x445ae3){return _0x445ae3?{'count':_0xc8ac77,'rows':_0x445ae3}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x17bd08,null))[_0xddd6('0x5b')](handleError(_0x17bd08,null));};exports[_0xddd6('0xe0')]=function(_0x3008c4,_0x419cad){var _0x2a27c0={};var _0x6b964e={};var _0x4d2aeb;var _0x126297;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x3008c4[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x419cad,null))[_0xddd6('0x2c')](function(_0x1c5d75){if(_0x1c5d75){_0x4d2aeb=_0x1c5d75;_0x6b964e[_0xddd6('0x5c')]=_['keys'](db['ChatGroup'][_0xddd6('0x3f')]);_0x6b964e[_0xddd6('0x49')]=_['keys'](_0x3008c4[_0xddd6('0x49')]);_0x6b964e[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x6b964e[_0xddd6('0x5c')],_0x6b964e[_0xddd6('0x49')]);_0x2a27c0[_0xddd6('0x4d')]=_['intersection'](_0x6b964e[_0xddd6('0x5c')],qs['fields'](_0x3008c4['query']['fields']));_0x2a27c0[_0xddd6('0x4d')]=_0x2a27c0[_0xddd6('0x4d')]['length']?_0x2a27c0[_0xddd6('0x4d')]:_0x6b964e[_0xddd6('0x5c')];_0x2a27c0['order']=qs[_0xddd6('0xdb')](_0x3008c4['query']['sort']);_0x2a27c0[_0xddd6('0x46')]=qs[_0xddd6('0x5f')](_['pick'](_0x3008c4[_0xddd6('0x49')],_0x6b964e[_0xddd6('0x5f')]));if(_0x3008c4[_0xddd6('0x49')][_0xddd6('0x42')]){_0x2a27c0['where']=_[_0xddd6('0x62')](_0x2a27c0[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0x2a27c0['attributes'],function(_0x2fb019){var _0x22c6e5={};_0x22c6e5[_0x2fb019]={'$like':'%'+_0x3008c4[_0xddd6('0x49')]['filter']+'%'};return _0x22c6e5;})});}_0x2a27c0=_[_0xddd6('0x62')]({},_0x2a27c0,_0x3008c4[_0xddd6('0x63')]);return _0x4d2aeb[_0xddd6('0xe0')](_0x2a27c0);}})[_0xddd6('0x2c')](function(_0x18625b){if(_0x18625b){_0x126297=_0x18625b['length'];if(!_0x3008c4[_0xddd6('0x49')][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x2a27c0[_0xddd6('0x27')]=qs['limit'](_0x3008c4[_0xddd6('0x49')][_0xddd6('0x27')]);_0x2a27c0[_0xddd6('0x25')]=qs['offset'](_0x3008c4[_0xddd6('0x49')]['offset']);}return _0x4d2aeb[_0xddd6('0xe0')](_0x2a27c0);}})[_0xddd6('0x2c')](function(_0x230fe4){if(_0x230fe4){return _0x230fe4?{'count':_0x126297,'rows':_0x230fe4}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x419cad,null))[_0xddd6('0x5b')](handleError(_0x419cad,null));};exports[_0xddd6('0xe1')]=function(_0xf33433,_0x561343){var _0x21cee6={'raw':!![],'where':{}};var _0x227679={};var _0x250934={'count':0x0,'rows':[]};return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0xf33433[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x561343,null))['then'](function(_0x1a5b7c){if(_0x1a5b7c){_0x227679[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_0xddd6('0xe2')][_0xddd6('0x3f')]);_0x227679[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0xf33433[_0xddd6('0x49')]);_0x227679['filters']=_['intersection'](_0x227679[_0xddd6('0x5c')],_0x227679[_0xddd6('0x49')]);_0x21cee6[_0xddd6('0x4d')]=_[_0xddd6('0x60')](_0x227679[_0xddd6('0x5c')],qs['fields'](_0xf33433[_0xddd6('0x49')]['fields']));_0x21cee6[_0xddd6('0x4d')]=_0x21cee6[_0xddd6('0x4d')][_0xddd6('0x52')]?_0x21cee6[_0xddd6('0x4d')]:_0x227679[_0xddd6('0x5c')];if(!_0xf33433[_0xddd6('0x49')][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x21cee6[_0xddd6('0x27')]=qs['limit'](_0xf33433['query'][_0xddd6('0x27')]);_0x21cee6[_0xddd6('0x25')]=qs['offset'](_0xf33433['query'][_0xddd6('0x25')]);}_0x21cee6[_0xddd6('0xda')]=qs['sort'](_0xf33433[_0xddd6('0x49')][_0xddd6('0xdb')]);_0x21cee6['where']=qs[_0xddd6('0x5f')](_[_0xddd6('0xdc')](_0xf33433[_0xddd6('0x49')],_0x227679['filters']));_0x21cee6[_0xddd6('0x46')][_0xddd6('0xe3')]=_0x1a5b7c['id'];if(_0xf33433[_0xddd6('0x49')][_0xddd6('0x42')]){_0x21cee6[_0xddd6('0x46')]=_[_0xddd6('0x62')](_0x21cee6[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0x21cee6[_0xddd6('0x4d')],function(_0x36402e){var _0x46f294={};_0x46f294[_0x36402e]={'$like':'%'+_0xf33433[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x46f294;})});}_0x21cee6=_[_0xddd6('0x62')]({},_0x21cee6,_0xf33433[_0xddd6('0x63')]);return db[_0xddd6('0xe2')][_0xddd6('0x28')]({'where':_0x21cee6['where']})[_0xddd6('0x2c')](function(_0x1095ad){_0x250934[_0xddd6('0x28')]=_0x1095ad;if(_0xf33433['query'][_0xddd6('0x47')]){_0x21cee6[_0xddd6('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0xddd6('0x4f')](_0x21cee6);})[_0xddd6('0x2c')](function(_0x58c950){_0x250934['rows']=_0x58c950;return _0x250934;});}})[_0xddd6('0x2c')](respondWithFilteredResult(_0x561343,_0x21cee6))['catch'](handleError(_0x561343,null));};exports[_0xddd6('0xe4')]=function(_0x145a0e,_0x1ae54f){var _0x56a646={'raw':!![],'where':{}};var _0x40398a={};var _0x59471a={'count':0x0,'rows':[]};return db['User'][_0xddd6('0x9a')]({'where':{'id':_0x145a0e[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x1ae54f,null))[_0xddd6('0x2c')](function(_0x276969){if(_0x276969){_0x40398a[_0xddd6('0x5c')]=_['keys'](db[_0xddd6('0xe5')]['rawAttributes']);_0x40398a[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x145a0e[_0xddd6('0x49')]);_0x40398a['filters']=_[_0xddd6('0x60')](_0x40398a[_0xddd6('0x5c')],_0x40398a[_0xddd6('0x49')]);_0x56a646['attributes']=_[_0xddd6('0x60')](_0x40398a[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x145a0e[_0xddd6('0x49')][_0xddd6('0x61')]));_0x56a646[_0xddd6('0x4d')]=_0x56a646[_0xddd6('0x4d')][_0xddd6('0x52')]?_0x56a646['attributes']:_0x40398a[_0xddd6('0x5c')];if(!_0x145a0e['query']['hasOwnProperty'](_0xddd6('0xde'))){_0x56a646[_0xddd6('0x27')]=qs[_0xddd6('0x27')](_0x145a0e[_0xddd6('0x49')][_0xddd6('0x27')]);_0x56a646[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0x145a0e[_0xddd6('0x49')][_0xddd6('0x25')]);}_0x56a646[_0xddd6('0xda')]=qs[_0xddd6('0xdb')](_0x145a0e['query'][_0xddd6('0xdb')]);_0x56a646[_0xddd6('0x46')]=qs['filters'](_[_0xddd6('0xdc')](_0x145a0e[_0xddd6('0x49')],_0x40398a[_0xddd6('0x5f')]));_0x56a646[_0xddd6('0x46')][_0xddd6('0xe3')]=_0x276969['id'];if(_0x145a0e[_0xddd6('0x49')][_0xddd6('0x42')]){_0x56a646[_0xddd6('0x46')]=_[_0xddd6('0x62')](_0x56a646['where'],{'$or':_[_0xddd6('0x36')](_0x56a646['attributes'],function(_0x4e51b3){var _0x14e0db={};_0x14e0db[_0x4e51b3]={'$like':'%'+_0x145a0e[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x14e0db;})});}_0x56a646=_[_0xddd6('0x62')]({},_0x56a646,_0x145a0e[_0xddd6('0x63')]);return db[_0xddd6('0xe5')]['count']({'where':_0x56a646[_0xddd6('0x46')]})[_0xddd6('0x2c')](function(_0x221650){_0x59471a['count']=_0x221650;if(_0x145a0e['query']['includeAll']){_0x56a646['include']=[{'all':!![]}];}return db[_0xddd6('0xe5')][_0xddd6('0x4f')](_0x56a646);})[_0xddd6('0x2c')](function(_0x30d639){_0x59471a[_0xddd6('0x50')]=_0x30d639;return _0x59471a;});}})[_0xddd6('0x2c')](respondWithFilteredResult(_0x1ae54f,_0x56a646))[_0xddd6('0x5b')](handleError(_0x1ae54f,null));};exports[_0xddd6('0xe6')]=function(_0x1dfd56,_0x1ee100){var _0xec3a65={};var _0x39a306={};var _0x126939;var _0x5267d6;return db['User'][_0xddd6('0x9a')]({'where':{'id':_0x1dfd56['params']['id']}})['then'](handleEntityNotFound(_0x1ee100,null))[_0xddd6('0x2c')](function(_0x4fda17){if(_0x4fda17){_0x126939=_0x4fda17;_0x39a306['model']=_[_0xddd6('0x5e')](db[_0xddd6('0xe7')][_0xddd6('0x3f')]);_0x39a306['query']=_[_0xddd6('0x5e')](_0x1dfd56[_0xddd6('0x49')]);_0x39a306[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x39a306[_0xddd6('0x5c')],_0x39a306['query']);_0xec3a65['attributes']=_[_0xddd6('0x60')](_0x39a306['model'],qs[_0xddd6('0x61')](_0x1dfd56['query'][_0xddd6('0x61')]));_0xec3a65[_0xddd6('0x4d')]=_0xec3a65[_0xddd6('0x4d')][_0xddd6('0x52')]?_0xec3a65[_0xddd6('0x4d')]:_0x39a306[_0xddd6('0x5c')];_0xec3a65[_0xddd6('0xda')]=qs[_0xddd6('0xdb')](_0x1dfd56[_0xddd6('0x49')][_0xddd6('0xdb')]);_0xec3a65[_0xddd6('0x46')]=qs['filters'](_['pick'](_0x1dfd56[_0xddd6('0x49')],_0x39a306[_0xddd6('0x5f')]));if(_0x1dfd56[_0xddd6('0x49')][_0xddd6('0x42')]){_0xec3a65[_0xddd6('0x46')]=_[_0xddd6('0x62')](_0xec3a65[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0xec3a65[_0xddd6('0x4d')],function(_0x57e18f){var _0x33eca5={};_0x33eca5[_0x57e18f]={'$like':'%'+_0x1dfd56[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x33eca5;})});}_0xec3a65=_['merge']({},_0xec3a65,_0x1dfd56[_0xddd6('0x63')]);return _0x126939[_0xddd6('0xe6')](_0xec3a65);}})['then'](function(_0x164ddc){if(_0x164ddc){_0x5267d6=_0x164ddc[_0xddd6('0x52')];if(!_0x1dfd56[_0xddd6('0x49')]['hasOwnProperty'](_0xddd6('0xde'))){_0xec3a65[_0xddd6('0x27')]=qs['limit'](_0x1dfd56[_0xddd6('0x49')]['limit']);_0xec3a65['offset']=qs['offset'](_0x1dfd56['query']['offset']);}return _0x126939['getChatInteractions'](_0xec3a65);}})[_0xddd6('0x2c')](function(_0x5aef98){if(_0x5aef98){return _0x5aef98?{'count':_0x5267d6,'rows':_0x5aef98}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x1ee100,null))['catch'](handleError(_0x1ee100,null));};exports[_0xddd6('0xe8')]=function(_0x239cfb,_0x26c91c){var _0x57d524={};var _0x5e360c={};var _0x136b12;var _0x1ab278;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x239cfb[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x26c91c,null))[_0xddd6('0x2c')](function(_0x42bbfd){if(_0x42bbfd){_0x136b12=_0x42bbfd;_0x5e360c[_0xddd6('0x5c')]=_['keys'](db[_0xddd6('0xe9')][_0xddd6('0x3f')]);_0x5e360c['query']=_['keys'](_0x239cfb[_0xddd6('0x49')]);_0x5e360c[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x5e360c[_0xddd6('0x5c')],_0x5e360c[_0xddd6('0x49')]);_0x57d524[_0xddd6('0x4d')]=_[_0xddd6('0x60')](_0x5e360c[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x239cfb[_0xddd6('0x49')]['fields']));_0x57d524['attributes']=_0x57d524[_0xddd6('0x4d')][_0xddd6('0x52')]?_0x57d524[_0xddd6('0x4d')]:_0x5e360c['model'];_0x57d524[_0xddd6('0xda')]=qs['sort'](_0x239cfb[_0xddd6('0x49')][_0xddd6('0xdb')]);_0x57d524[_0xddd6('0x46')]=qs['filters'](_[_0xddd6('0xdc')](_0x239cfb[_0xddd6('0x49')],_0x5e360c[_0xddd6('0x5f')]));if(_0x239cfb[_0xddd6('0x49')][_0xddd6('0x42')]){_0x57d524[_0xddd6('0x46')]=_['merge'](_0x57d524['where'],{'$or':_['map'](_0x57d524[_0xddd6('0x4d')],function(_0x16ec29){var _0x1e3c9e={};_0x1e3c9e[_0x16ec29]={'$like':'%'+_0x239cfb[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x1e3c9e;})});}_0x57d524=_[_0xddd6('0x62')]({},_0x57d524,_0x239cfb['options']);return _0x136b12[_0xddd6('0xe8')](_0x57d524);}})[_0xddd6('0x2c')](function(_0x1d09fc){if(_0x1d09fc){_0x1ab278=_0x1d09fc['length'];if(!_0x239cfb[_0xddd6('0x49')][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x57d524[_0xddd6('0x27')]=qs[_0xddd6('0x27')](_0x239cfb[_0xddd6('0x49')]['limit']);_0x57d524[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0x239cfb['query'][_0xddd6('0x25')]);}return _0x136b12[_0xddd6('0xe8')](_0x57d524);}})['then'](function(_0x2aa028){if(_0x2aa028){return _0x2aa028?{'count':_0x1ab278,'rows':_0x2aa028}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x26c91c,null))[_0xddd6('0x5b')](handleError(_0x26c91c,null));};exports['getMailInteractions']=function(_0x449e33,_0x5eb80a){var _0x43ab2e={'raw':!![],'where':{}};var _0x82b82c={};var _0x256fa5={'count':0x0,'rows':[]};return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x449e33['params']['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x5eb80a,null))[_0xddd6('0x2c')](function(_0x49df1c){if(_0x49df1c){_0x82b82c[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_0xddd6('0xea')][_0xddd6('0x3f')]);_0x82b82c[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x449e33['query']);_0x82b82c['filters']=_['intersection'](_0x82b82c[_0xddd6('0x5c')],_0x82b82c[_0xddd6('0x49')]);_0x43ab2e['attributes']=_['intersection'](_0x82b82c[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x449e33[_0xddd6('0x49')][_0xddd6('0x61')]));_0x43ab2e['attributes']=_0x43ab2e['attributes'][_0xddd6('0x52')]?_0x43ab2e[_0xddd6('0x4d')]:_0x82b82c[_0xddd6('0x5c')];if(!_0x449e33['query']['hasOwnProperty'](_0xddd6('0xde'))){_0x43ab2e[_0xddd6('0x27')]=qs[_0xddd6('0x27')](_0x449e33['query']['limit']);_0x43ab2e['offset']=qs[_0xddd6('0x25')](_0x449e33[_0xddd6('0x49')][_0xddd6('0x25')]);}_0x43ab2e[_0xddd6('0xda')]=qs['sort'](_0x449e33['query']['sort']);_0x43ab2e['where']=qs[_0xddd6('0x5f')](_[_0xddd6('0xdc')](_0x449e33['query'],_0x82b82c[_0xddd6('0x5f')]));_0x43ab2e[_0xddd6('0x46')][_0xddd6('0xe3')]=_0x49df1c['id'];if(_0x449e33[_0xddd6('0x49')][_0xddd6('0x42')]){_0x43ab2e[_0xddd6('0x46')]=_[_0xddd6('0x62')](_0x43ab2e[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0x43ab2e[_0xddd6('0x4d')],function(_0x2cedc9){var _0x13e62d={};_0x13e62d[_0x2cedc9]={'$like':'%'+_0x449e33[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x13e62d;})});}_0x43ab2e=_[_0xddd6('0x62')]({},_0x43ab2e,_0x449e33[_0xddd6('0x63')]);return db[_0xddd6('0xea')][_0xddd6('0x28')]({'where':_0x43ab2e[_0xddd6('0x46')]})[_0xddd6('0x2c')](function(_0x5113e7){_0x256fa5[_0xddd6('0x28')]=_0x5113e7;if(_0x449e33[_0xddd6('0x49')][_0xddd6('0x47')]){_0x43ab2e[_0xddd6('0x48')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x43ab2e);})[_0xddd6('0x2c')](function(_0x424aac){_0x256fa5[_0xddd6('0x50')]=_0x424aac;return _0x256fa5;});}})[_0xddd6('0x2c')](respondWithFilteredResult(_0x5eb80a,_0x43ab2e))['catch'](handleError(_0x5eb80a,null));};exports[_0xddd6('0xeb')]=function(_0x35c298,_0x3ab1eb){var _0x387a7d={};var _0x137ba1={};var _0xbf66dd;var _0x477108;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x35c298[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x3ab1eb,null))[_0xddd6('0x2c')](function(_0x285d43){if(_0x285d43){_0xbf66dd=_0x285d43;_0x137ba1[_0xddd6('0x5c')]=_['keys'](db[_0xddd6('0xec')][_0xddd6('0x3f')]);_0x137ba1[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x35c298['query']);_0x137ba1[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x137ba1[_0xddd6('0x5c')],_0x137ba1[_0xddd6('0x49')]);_0x387a7d['attributes']=_['intersection'](_0x137ba1[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x35c298[_0xddd6('0x49')][_0xddd6('0x61')]));_0x387a7d[_0xddd6('0x4d')]=_0x387a7d['attributes']['length']?_0x387a7d[_0xddd6('0x4d')]:_0x137ba1[_0xddd6('0x5c')];_0x387a7d[_0xddd6('0xda')]=qs[_0xddd6('0xdb')](_0x35c298[_0xddd6('0x49')]['sort']);_0x387a7d[_0xddd6('0x46')]=qs['filters'](_[_0xddd6('0xdc')](_0x35c298[_0xddd6('0x49')],_0x137ba1[_0xddd6('0x5f')]));if(_0x35c298[_0xddd6('0x49')]['filter']){_0x387a7d[_0xddd6('0x46')]=_[_0xddd6('0x62')](_0x387a7d['where'],{'$or':_[_0xddd6('0x36')](_0x387a7d[_0xddd6('0x4d')],function(_0x1bfb6b){var _0xf9866b={};_0xf9866b[_0x1bfb6b]={'$like':'%'+_0x35c298[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0xf9866b;})});}_0x387a7d=_[_0xddd6('0x62')]({},_0x387a7d,_0x35c298[_0xddd6('0x63')]);return _0xbf66dd[_0xddd6('0xeb')](_0x387a7d);}})[_0xddd6('0x2c')](function(_0x49e994){if(_0x49e994){_0x477108=_0x49e994[_0xddd6('0x52')];if(!_0x35c298[_0xddd6('0x49')][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x387a7d[_0xddd6('0x27')]=qs[_0xddd6('0x27')](_0x35c298[_0xddd6('0x49')][_0xddd6('0x27')]);_0x387a7d['offset']=qs[_0xddd6('0x25')](_0x35c298[_0xddd6('0x49')]['offset']);}return _0xbf66dd[_0xddd6('0xeb')](_0x387a7d);}})['then'](function(_0x1c113a){if(_0x1c113a){return _0x1c113a?{'count':_0x477108,'rows':_0x1c113a}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x3ab1eb,null))['catch'](handleError(_0x3ab1eb,null));};exports[_0xddd6('0xed')]=function(_0x181d63,_0x3944b1){var _0x184d51={};var _0x30a3dd={};var _0xb4301d;var _0x4c1ceb;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x181d63[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x3944b1,null))['then'](function(_0x22b938){if(_0x22b938){_0xb4301d=_0x22b938;_0x30a3dd[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_0xddd6('0xee')][_0xddd6('0x3f')]);_0x30a3dd[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x181d63[_0xddd6('0x49')]);_0x30a3dd['filters']=_['intersection'](_0x30a3dd[_0xddd6('0x5c')],_0x30a3dd[_0xddd6('0x49')]);_0x184d51['attributes']=_[_0xddd6('0x60')](_0x30a3dd['model'],qs[_0xddd6('0x61')](_0x181d63[_0xddd6('0x49')][_0xddd6('0x61')]));_0x184d51[_0xddd6('0x4d')]=_0x184d51[_0xddd6('0x4d')][_0xddd6('0x52')]?_0x184d51[_0xddd6('0x4d')]:_0x30a3dd[_0xddd6('0x5c')];_0x184d51[_0xddd6('0xda')]=qs['sort'](_0x181d63[_0xddd6('0x49')][_0xddd6('0xdb')]);_0x184d51['where']=qs[_0xddd6('0x5f')](_[_0xddd6('0xdc')](_0x181d63[_0xddd6('0x49')],_0x30a3dd[_0xddd6('0x5f')]));if(_0x181d63[_0xddd6('0x49')][_0xddd6('0x42')]){_0x184d51[_0xddd6('0x46')]=_['merge'](_0x184d51[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0x184d51[_0xddd6('0x4d')],function(_0x2a4d37){var _0x5bf257={};_0x5bf257[_0x2a4d37]={'$like':'%'+_0x181d63[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x5bf257;})});}_0x184d51=_[_0xddd6('0x62')]({},_0x184d51,_0x181d63[_0xddd6('0x63')]);return _0xb4301d[_0xddd6('0xed')](_0x184d51);}})[_0xddd6('0x2c')](function(_0x535993){if(_0x535993){_0x4c1ceb=_0x535993[_0xddd6('0x52')];if(!_0x181d63[_0xddd6('0x49')][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x184d51[_0xddd6('0x27')]=qs[_0xddd6('0x27')](_0x181d63['query'][_0xddd6('0x27')]);_0x184d51[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0x181d63['query'][_0xddd6('0x25')]);}return _0xb4301d[_0xddd6('0xed')](_0x184d51);}})[_0xddd6('0x2c')](function(_0x435310){if(_0x435310){return _0x435310?{'count':_0x4c1ceb,'rows':_0x435310}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x3944b1,null))['catch'](handleError(_0x3944b1,null));};exports[_0xddd6('0xef')]=function(_0x13b50a,_0x3d0582){var _0x4571d7={};var _0x1b027b={};var _0x1f6f3e;var _0x29c77f;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x13b50a[_0xddd6('0x65')]['id']}})[_0xddd6('0x2c')](handleEntityNotFound(_0x3d0582,null))[_0xddd6('0x2c')](function(_0x12ff6e){if(_0x12ff6e){_0x1f6f3e=_0x12ff6e;_0x1b027b[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_0xddd6('0xf0')][_0xddd6('0x3f')]);_0x1b027b[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x13b50a[_0xddd6('0x49')]);_0x1b027b[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x1b027b[_0xddd6('0x5c')],_0x1b027b[_0xddd6('0x49')]);_0x4571d7[_0xddd6('0x4d')]=_[_0xddd6('0x60')](_0x1b027b[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x13b50a[_0xddd6('0x49')][_0xddd6('0x61')]));_0x4571d7[_0xddd6('0x4d')]=_0x4571d7[_0xddd6('0x4d')]['length']?_0x4571d7[_0xddd6('0x4d')]:_0x1b027b['model'];_0x4571d7[_0xddd6('0xda')]=qs[_0xddd6('0xdb')](_0x13b50a['query']['sort']);_0x4571d7[_0xddd6('0x46')]=qs['filters'](_[_0xddd6('0xdc')](_0x13b50a[_0xddd6('0x49')],_0x1b027b['filters']));if(_0x13b50a[_0xddd6('0x49')][_0xddd6('0x42')]){_0x4571d7['where']=_[_0xddd6('0x62')](_0x4571d7[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0x4571d7[_0xddd6('0x4d')],function(_0x129726){var _0x47337f={};_0x47337f[_0x129726]={'$like':'%'+_0x13b50a[_0xddd6('0x49')]['filter']+'%'};return _0x47337f;})});}_0x4571d7=_[_0xddd6('0x62')]({},_0x4571d7,_0x13b50a[_0xddd6('0x63')]);return _0x1f6f3e[_0xddd6('0xef')](_0x4571d7);}})[_0xddd6('0x2c')](function(_0x2f7e01){if(_0x2f7e01){_0x29c77f=_0x2f7e01[_0xddd6('0x52')];if(!_0x13b50a['query'][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x4571d7[_0xddd6('0x27')]=qs[_0xddd6('0x27')](_0x13b50a['query'][_0xddd6('0x27')]);_0x4571d7[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0x13b50a['query']['offset']);}return _0x1f6f3e[_0xddd6('0xef')](_0x4571d7);}})[_0xddd6('0x2c')](function(_0xcc9dea){if(_0xcc9dea){return _0xcc9dea?{'count':_0x29c77f,'rows':_0xcc9dea}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x3d0582,null))[_0xddd6('0x5b')](handleError(_0x3d0582,null));};exports[_0xddd6('0xf1')]=function(_0x1a5831,_0x20c8db,_0x5baefd){var _0x884607;var _0x25d30c;var _0x35ab53;var _0x631a7a=!_[_0xddd6('0x6c')](_0x1a5831['params']['id'])?_0x1a5831['params']['id']:!_[_0xddd6('0x6c')](_0x1a5831[_0xddd6('0x82')]['id'])?_0x1a5831[_0xddd6('0x82')]['id']:null;return db[_0xddd6('0x3e')][_0xddd6('0x38')]({'where':{'id':_0x631a7a,'role':{'$or':[_0xddd6('0x83'),_0xddd6('0x82'),_0xddd6('0x2e')]}},'attributes':['id',_0xddd6('0x3b'),_0xddd6('0xf2'),_0xddd6('0xf3'),'role','internal','loginInPause']})[_0xddd6('0x2c')](function(_0x1d01e6){if(_0x1d01e6){if(_0x1d01e6[_0xddd6('0x2d')]===_0xddd6('0x2e')){_0x884607=_0x1d01e6;if(_0x1a5831[_0xddd6('0x64')][_0xddd6('0xa6')]){_0x35ab53=util[_0xddd6('0xb3')](_0xddd6('0xf4'),_0x884607[_0x1a5831[_0xddd6('0x64')][_0xddd6('0xa6')]]);}else if(_0x1a5831[_0xddd6('0x64')]['intrf']){_0x35ab53=util[_0xddd6('0xb3')](_0xddd6('0xf5'),_0x1a5831[_0xddd6('0x64')][_0xddd6('0xf6')]);}else{_0x35ab53=util[_0xddd6('0xb3')](_0xddd6('0xf5'),_0x884607[_0xddd6('0x3b')]);}socket['to'](util['format'](_0xddd6('0xf7'),_0x884607[_0xddd6('0x3b')]))[_0xddd6('0xaf')](_0xddd6('0xf8'),{'user':{'id':_0x884607['id'],'name':_0x884607[_0xddd6('0x3b')]},'ip':_0x1a5831[_0xddd6('0xf9')][_0xddd6('0xfa')]||_0x1a5831['connection']['remoteAddress']||_0x1a5831['socket']['remoteAddress']||_0x1a5831['connection']['socket'][_0xddd6('0xfb')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x884607[_0xddd6('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0xddd6('0x94'))][(_0xddd6('0x98'))](_0xddd6('0xfc'));}})[_0xddd6('0x2c')](function(){if(_0x884607){return _0x884607['getVoiceQueues']({'raw':!![]});}})[_0xddd6('0x2c')](function(_0x3129f2){if(_0x884607){if(_0x3129f2){_0x25d30c=_0x3129f2;if(_0x25d30c['length']){var _0x364e60=_0x25d30c['map'](function(_0x55b0c5){var _0x4dff16={'membername':_0x884607[_0xddd6('0x3b')],'UserId':_0x884607['id'],'queue_name':_0x55b0c5[_0xddd6('0x3b')],'VoiceQueueId':_0x55b0c5['id'],'interface':_0x35ab53,'paused':_0x884607[_0xddd6('0xfd')]||![],'penalty':_0x55b0c5[_0xddd6('0xfe')]||0x0};return db[_0xddd6('0xb5')][_0xddd6('0xff')](_0x4dff16);});return Promise[_0xddd6('0x5a')](_0x364e60);}}}})[_0xddd6('0x2c')](function(){if(_0x884607){return db[_0xddd6('0x100')][_0xddd6('0x4f')]({'where':{'membername':_0x884607['name'],'exitAt':null}});}})['then'](function(_0x15999f){if(_0x884607){var _0x216456=[];_0x15999f[_0xddd6('0x101')](function(_0x4caa84){_0x216456[_0xddd6('0x4e')](_0x4caa84[_0xddd6('0x2b')]({'exitAt':moment()['format'](_0xddd6('0x102'))}));});return Promise['all'](_0x216456);}})[_0xddd6('0x2c')](function(){if(_0x884607){var _0x1df430=[];var _0x2ab5c0=[];var _0xdb3205=utils[_0xddd6('0x103')]();var _0x331d6c={'membername':_0x884607['name'],'interface':_0x35ab53,'enterAt':moment()[_0xddd6('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x884607[_0xddd6('0x2d')],'internal':_0x884607[_0xddd6('0x69')]};_0xdb3205['forEach'](function(_0x161e5a){_0x1df430[_0xddd6('0x4e')](_[_0xddd6('0x62')]({'channel':_0x161e5a,'type':_0xddd6('0x104'),'data1':_0x1a5831[_0xddd6('0x64')][_0xddd6('0x105')],'data2':_0x35ab53},_0x331d6c));if(_0x884607['loginInPause']){_0x2ab5c0[_0xddd6('0x4e')](_[_0xddd6('0x62')]({'channel':_0x161e5a,'type':_0xddd6('0x106'),'data1':_0xddd6('0x107')},_0x331d6c));}});return db[_0xddd6('0x100')][_0xddd6('0x8d')](_0x1df430[_0xddd6('0xd1')](_0x2ab5c0),{'individualHooks':!![]});}})[_0xddd6('0x2c')](function(){if(_0x884607){return _0x884607[_0xddd6('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xddd6('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x884607[_0xddd6('0xfd')]||![],'mailPause':_0x884607['loginInPause']||![],'chatPause':_0x884607['loginInPause']||![],'faxPause':_0x884607[_0xddd6('0xfd')]||![],'smsPause':_0x884607['loginInPause']||![],'openchannelPause':_0x884607[_0xddd6('0xfd')]||![],'whatsappPause':_0x884607[_0xddd6('0xfd')]||![],'pauseType':_0x884607['loginInPause']?_0xddd6('0x107'):null,'interface':_0x35ab53,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xddd6('0x2c')](function(_0x34b09c){if(_0x1a5831[_0xddd6('0x108')]){return _0x5baefd();}else{return Promise['resolve'](_0x34b09c)[_0xddd6('0x2c')](respondWithResult(_0x20c8db,null));}})['catch'](handleError(_0x20c8db,null));};exports[_0xddd6('0x109')]=function(_0xd789a,_0x396781){var _0x281531;return db[_0xddd6('0x3e')]['find']({'where':{'id':_0xd789a['params']['id'],'role':_0xddd6('0x2e')},'attributes':['id',_0xddd6('0x3b'),_0xddd6('0x2d')]})[_0xddd6('0x2c')](handleEntityNotFound(_0x396781,null))[_0xddd6('0x2c')](function(_0x297248){if(_0x297248){_0x281531=_0x297248;return db[_0xddd6('0xb5')][_0xddd6('0x30')]({'where':{'membername':_0x281531[_0xddd6('0x3b')]},'individualHooks':!![]});}})[_0xddd6('0x2c')](function(){return db['MemberReport'][_0xddd6('0x4f')]({'where':{'membername':_0x281531[_0xddd6('0x3b')],'exitAt':null}});})[_0xddd6('0x2c')](function(_0x1e5267){var _0x19bc19=[];_0x1e5267[_0xddd6('0x101')](function(_0x4b1d16){_0x19bc19[_0xddd6('0x4e')](_0x4b1d16['update']({'exitAt':moment()['format'](_0xddd6('0x102'))}));});return Promise[_0xddd6('0x5a')](_0x19bc19);})[_0xddd6('0x2c')](function(){return _0x281531[_0xddd6('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xddd6('0x2c')](respondWithResult(_0x396781,null))[_0xddd6('0x5b')](handleError(_0x396781,null));};exports['pause']=function(_0x118210,_0x28fe0f){var _0x3898cf;return db['UserVoiceQueueRt'][_0xddd6('0x2b')]({'paused':0x1},{'where':{'UserId':_0x118210[_0xddd6('0x65')]['id']},'individualHooks':!![]})[_0xddd6('0x2c')](function(){return db['User']['find']({'where':{'id':_0x118210['params']['id'],'role':'agent'},'attributes':['id',_0xddd6('0x3b'),_0xddd6('0x2d'),'internal',_0xddd6('0xa6'),_0xddd6('0xa4')]});})[_0xddd6('0x2c')](handleEntityNotFound(_0x28fe0f,null))[_0xddd6('0x2c')](function(_0x18aa67){if(_0x18aa67){_0x3898cf=_0x18aa67;return respondWithRpcPromise(_0xddd6('0x10a'),_0xddd6('0x10b'),{'id':_0x3898cf['id'],'name':_0x3898cf['name'],'pause':!![]});}})['then'](function(){if(_0x3898cf){return db[_0xddd6('0x100')][_0xddd6('0x4f')]({'where':{'membername':_0x3898cf[_0xddd6('0x3b')],'type':_0xddd6('0x106'),'exitAt':null}});}})[_0xddd6('0x2c')](function(_0x5b0745){if(_0x5b0745[_0xddd6('0x52')]){var _0x4727f9=moment()[_0xddd6('0xb3')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4bf01a=0x0,_0x5327e3=_0x5b0745['length'];_0x4bf01a<_0x5327e3;_0x4bf01a++){_0x5b0745[_0x4bf01a][_0xddd6('0x10c')]({'exitAt':_0x4727f9});}}})['then'](function(){var _0xc86d64=[];var _0x504cbf=utils['getChannels']();_0x504cbf['forEach'](function(_0x22fcd1){_0xc86d64['push']({'channel':_0x22fcd1,'membername':_0x3898cf['name'],'interface':_[_0xddd6('0x6c')](_0x3898cf[_0xddd6('0xa6')])?util[_0xddd6('0xb3')](_0xddd6('0xf5'),_0x3898cf[_0xddd6('0x3b')]):_0x3898cf[_0xddd6('0xa6')],'type':'PAUSE','enterAt':moment()['format'](_0xddd6('0x102')),'data1':_0x118210[_0xddd6('0x64')][_0xddd6('0x41')]||_0xddd6('0x10d'),'role':_0x3898cf[_0xddd6('0x2d')],'internal':_0x3898cf[_0xddd6('0x69')]});});return db['MemberReport'][_0xddd6('0x8d')](_0xc86d64,{'individualHooks':!![]});})[_0xddd6('0x2c')](function(){return _0x3898cf[_0xddd6('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x118210[_0xddd6('0x64')][_0xddd6('0x41')]||_0xddd6('0x10d'),'lastPauseAt':moment()['format'](_0xddd6('0x102'))});})[_0xddd6('0x2c')](respondWithResult(_0x28fe0f,null))[_0xddd6('0x5b')](handleError(_0x28fe0f,null));};exports[_0xddd6('0x10e')]=function(_0x1e7f45,_0x840c19){if(_0x1e7f45[_0xddd6('0x64')][_0xddd6('0xa3')]&&!utils[_0xddd6('0xa7')](_0x1e7f45[_0xddd6('0x64')]['channel'])){throw new APIBadRequestError(util[_0xddd6('0xb3')](_0xddd6('0x10f'),_0x1e7f45['body'][_0xddd6('0xa3')]));}return db[_0xddd6('0x3e')][_0xddd6('0x38')]({'where':{'id':_0x1e7f45['params']['id']},'attributes':['id',_0xddd6('0x3b'),'role','internal','interface',_0xddd6('0xa4'),_0xddd6('0xa5'),_0xddd6('0x110'),_0xddd6('0x111'),_0xddd6('0x112'),'openchannelPause',_0xddd6('0x113'),_0xddd6('0x114'),_0xddd6('0x115'),'lastPauseAt']})[_0xddd6('0x2c')](function(_0x58760a){if(!_0x58760a){throw new APINotFoundError(util[_0xddd6('0xb3')](_0xddd6('0xd2'),_0x1e7f45[_0xddd6('0x65')]['id']));}return _0x58760a[_0xddd6('0x10e')](_0x1e7f45[_0xddd6('0x64')][_0xddd6('0xa3')]);})[_0xddd6('0x2c')](respondWithResult(_0x840c19,null))[_0xddd6('0x5b')](APIHandleError(_0x840c19));};exports[_0xddd6('0x116')]=function(_0xa3145a,_0xa0d442){var _0x10fbb9={};var _0xb53e7d={};var _0x297363;var _0x5cfc5a;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0xa3145a['params']['id']}})['then'](handleEntityNotFound(_0xa0d442,null))[_0xddd6('0x2c')](function(_0xaac96a){if(_0xaac96a){_0x297363=_0xaac96a;_0xb53e7d[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_0xddd6('0x117')][_0xddd6('0x3f')]);_0xb53e7d[_0xddd6('0x49')]=_['keys'](_0xa3145a['query']);_0xb53e7d[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0xb53e7d[_0xddd6('0x5c')],_0xb53e7d[_0xddd6('0x49')]);_0x10fbb9['attributes']=_[_0xddd6('0x60')](_0xb53e7d[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0xa3145a[_0xddd6('0x49')][_0xddd6('0x61')]));_0x10fbb9[_0xddd6('0x4d')]=_0x10fbb9[_0xddd6('0x4d')][_0xddd6('0x52')]?_0x10fbb9[_0xddd6('0x4d')]:_0xb53e7d['model'];_0x10fbb9['order']=qs[_0xddd6('0xdb')](_0xa3145a[_0xddd6('0x49')][_0xddd6('0xdb')]);_0x10fbb9[_0xddd6('0x46')]=qs[_0xddd6('0x5f')](_['pick'](_0xa3145a['query'],_0xb53e7d[_0xddd6('0x5f')]));if(_0xa3145a[_0xddd6('0x49')][_0xddd6('0x42')]){_0x10fbb9['where']=_[_0xddd6('0x62')](_0x10fbb9['where'],{'$or':_[_0xddd6('0x36')](_0x10fbb9[_0xddd6('0x4d')],function(_0x1f46b5){var _0x5e48b4={};_0x5e48b4[_0x1f46b5]={'$like':'%'+_0xa3145a[_0xddd6('0x49')][_0xddd6('0x42')]+'%'};return _0x5e48b4;})});}_0x10fbb9=_[_0xddd6('0x62')]({},_0x10fbb9,_0xa3145a['options']);return _0x297363[_0xddd6('0x116')](_0x10fbb9);}})[_0xddd6('0x2c')](function(_0x45bc5b){if(_0x45bc5b){_0x5cfc5a=_0x45bc5b[_0xddd6('0x52')];if(!_0xa3145a[_0xddd6('0x49')][_0xddd6('0xd3')]('nolimit')){_0x10fbb9['limit']=qs[_0xddd6('0x27')](_0xa3145a[_0xddd6('0x49')][_0xddd6('0x27')]);_0x10fbb9[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0xa3145a[_0xddd6('0x49')][_0xddd6('0x25')]);}return _0x297363['getTeams'](_0x10fbb9);}})['then'](function(_0x98ab20){if(_0x98ab20){return _0x98ab20?{'count':_0x5cfc5a,'rows':_0x98ab20}:null;}})[_0xddd6('0x2c')](respondWithResult(_0xa0d442,null))['catch'](handleError(_0xa0d442,null));};exports['addTeams']=function(_0x3f723d,_0x589be4){var _0x2e9965=_0x3f723d[_0xddd6('0x65')]['id'];var _0x3d7968=_0x3f723d[_0xddd6('0x64')]?_0x3f723d['body']['ids']:null;var _0x4ebf3f=[];return Promise['resolve']()[_0xddd6('0x2c')](function(){if(!_0x3d7968)throw new APIBadRequestError(_0xddd6('0x118'));})[_0xddd6('0x2c')](function(){return db['User'][_0xddd6('0x9a')]({'where':{'id':_0x2e9965}});})['then'](function(_0x4c151e){if(!_0x4c151e)throw new APINotFoundError(util[_0xddd6('0xb3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3f723d[_0xddd6('0x65')]['id']));return db[_0xddd6('0x6e')][_0xddd6('0x119')](function(_0x129f0a){return _0x4c151e[_0xddd6('0x11a')](_0x3d7968,{'transaction':_0x129f0a})[_0xddd6('0x2c')](function(){return db[_0xddd6('0x117')][_0xddd6('0x4f')]({'where':{'id':{'$in':_0x3d7968}}});})['then'](function(_0x49efc3){var _0x53b9bf=_[_0xddd6('0x36')](_0x49efc3,function(_0x34ce7e){return _0x34ce7e[_0xddd6('0x11b')]();});return Promise[_0xddd6('0x5a')](_0x53b9bf);})[_0xddd6('0x2c')](function(_0x14483a){_0x4ebf3f=_[_0xddd6('0x11c')](_0x14483a);var _0x10a6df=_[_0xddd6('0x36')](_0x4ebf3f,function(_0x9d6b4a){return _0x9d6b4a[_0xddd6('0x11d')](_0x4c151e['id'],{'transaction':_0x129f0a});});return Promise['all'](_0x10a6df);})[_0xddd6('0x2c')](function(){if(!_0x4c151e[_0xddd6('0xa4')])return;var _0x376b99=_[_0xddd6('0x42')](_0x4ebf3f,function(_0x5c31c3){return _0x5c31c3[_0xddd6('0x11e')](_0xddd6('0xa3'))===_0xddd6('0x11f');});var _0x1ad3b1=_['map'](_0x376b99,function(_0x260a4e){return db['UserVoiceQueueRt'][_0xddd6('0xff')]({'membername':_0x4c151e[_0xddd6('0x3b')],'UserId':_0x4c151e['id'],'queue_name':_0x260a4e[_0xddd6('0x3b')],'VoiceQueueId':_0x260a4e['id'],'interface':_[_0xddd6('0x6c')](_0x4c151e[_0xddd6('0xa6')])?util[_0xddd6('0xb3')](_0xddd6('0xf5'),_0x4c151e[_0xddd6('0x3b')]):_0x4c151e['interface'],'paused':_0x4c151e[_0xddd6('0xa5')]||![],'penalty':_0x4c151e[_0xddd6('0xb4')]},{'transaction':_0x129f0a});});return Promise['all'](_0x1ad3b1);})[_0xddd6('0x2c')](function(){return db[_0xddd6('0x120')][_0xddd6('0x4f')]({'where':{'teamId':{'$in':_0x3d7968}}});})[_0xddd6('0x2c')](function(_0x36c719){var _0x422ddd=_[_0xddd6('0x36')](_0x36c719,function(_0x53f2c7){return db['UserVoicePrefix'][_0xddd6('0x89')]({'UserId':_0x4c151e['id'],'VoicePrefixId':_0x53f2c7[_0xddd6('0x121')]},{'transaction':_0x129f0a});});return Promise[_0xddd6('0x5a')](_0x422ddd);});});})['then'](function(){for(var _0x4f8d26=0x0;_0x4f8d26<_0x4ebf3f[_0xddd6('0x52')];_0x4f8d26++){var _0x2d0295=_0x4ebf3f[_0x4f8d26][_0xddd6('0x11e')]('channel');var _0x98e0fe=_0x2d0295+_0xddd6('0xae');socket[_0xddd6('0xaf')](_0xddd6('0x82')+_0x2d0295+_0xddd6('0xb0'),{'UserId':_0x2e9965,['queueField']:_0x4ebf3f[_0x4f8d26]['id']});}})[_0xddd6('0x2c')](respondWithStatusCode(_0x589be4,null))[_0xddd6('0x5b')](APIHandleError(_0x589be4));};exports['removeTeams']=function(_0x16bd7c,_0x225707){var _0x494522=_0x16bd7c[_0xddd6('0x65')]['id'];var _0x2c02ff=null;if(_0x16bd7c['query'][_0xddd6('0x67')]){_0x2c02ff=_[_0xddd6('0xb8')](_0x16bd7c[_0xddd6('0x49')][_0xddd6('0x67')])?_0x16bd7c['query'][_0xddd6('0x67')]:[_0x16bd7c[_0xddd6('0x49')][_0xddd6('0x67')]];}var _0x28cbde=[];return Promise['resolve']()[_0xddd6('0x2c')](function(){if(!_0x2c02ff)throw new APIBadRequestError(_0xddd6('0x122'));})[_0xddd6('0x2c')](function(){return db[_0xddd6('0x3e')]['findOne']({'where':{'id':_0x494522}});})[_0xddd6('0x2c')](function(_0x281b10){if(!_0x281b10)throw new APINotFoundError(util[_0xddd6('0xb3')](_0xddd6('0xd2'),_0x16bd7c[_0xddd6('0x65')]['id']));return db['sequelize'][_0xddd6('0x119')](function(_0x2b93e2){return _0x281b10[_0xddd6('0x123')](_0x2c02ff,{'transaction':_0x2b93e2})['then'](function(){return db[_0xddd6('0x117')][_0xddd6('0x4f')]({'where':{'id':{'$in':_0x2c02ff}}});})['then'](function(_0x1fe2f2){var _0x4376f3=_[_0xddd6('0x36')](_0x1fe2f2,function(_0x4c47ea){return _0x4c47ea[_0xddd6('0x11b')]();});return Promise['all'](_0x4376f3);})[_0xddd6('0x2c')](function(_0x34808f){_0x28cbde=_[_0xddd6('0x11c')](_0x34808f);var _0x5d9333=_['map'](_0x28cbde,function(_0x5d96e0){return _0x5d96e0[_0xddd6('0x124')](_0x281b10['id'],{'transaction':_0x2b93e2});});return Promise['all'](_0x5d9333);})[_0xddd6('0x2c')](function(){if(!_0x281b10['online'])return;var _0x27f228=_[_0xddd6('0x42')](_0x28cbde,function(_0x360c19){return _0x360c19[_0xddd6('0x11e')](_0xddd6('0xa3'))===_0xddd6('0x11f');});var _0x22a667=_[_0xddd6('0x36')](_0x27f228,function(_0x2ebe0e){return db[_0xddd6('0xb5')][_0xddd6('0x30')]({'where':{'VoiceQueueId':_0x2ebe0e['id'],'UserId':_0x281b10['id']},'transaction':_0x2b93e2});});return Promise[_0xddd6('0x5a')](_0x22a667);})[_0xddd6('0x2c')](function(){return db[_0xddd6('0x120')][_0xddd6('0x4f')]({'where':{'teamId':{'$in':_0x2c02ff}}});})[_0xddd6('0x2c')](function(_0x391598){var _0x4d0a8b=_['map'](_0x391598,function(_0x1f4737){return db[_0xddd6('0x125')][_0xddd6('0x30')]({'where':{'UserId':_0x281b10['id'],'VoicePrefixId':_0x1f4737[_0xddd6('0x121')]}},{'transaction':_0x2b93e2});});return Promise['all'](_0x4d0a8b);});});})[_0xddd6('0x2c')](function(){for(var _0x50e316=0x0;_0x50e316<_0x28cbde[_0xddd6('0x52')];_0x50e316++){var _0x2b35f2=_0x28cbde[_0x50e316][_0xddd6('0x11e')](_0xddd6('0xa3'));var _0x32c605=_0x2b35f2+_0xddd6('0xae');socket['emit'](_0xddd6('0x82')+_0x2b35f2+'Queue:remove',{'UserId':_0x494522,['queueField']:_0x28cbde[_0x50e316]['id']});}})[_0xddd6('0x2c')](respondWithStatusCode(_0x225707,null))[_0xddd6('0x5b')](APIHandleError(_0x225707));};exports['getLists']=function(_0x3d827c,_0x77be7d){var _0x141e67={};var _0x3a3888={};var _0x233e12;var _0x2ec8a9;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x3d827c[_0xddd6('0x65')]['id']}})['then'](handleEntityNotFound(_0x77be7d,null))['then'](function(_0x5f5648){if(_0x5f5648){_0x233e12=_0x5f5648;_0x3a3888['model']=_[_0xddd6('0x5e')](db['CmList'][_0xddd6('0x3f')]);_0x3a3888[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x3d827c[_0xddd6('0x49')]);_0x3a3888[_0xddd6('0x5f')]=_[_0xddd6('0x60')](_0x3a3888[_0xddd6('0x5c')],_0x3a3888[_0xddd6('0x49')]);_0x141e67['attributes']=_[_0xddd6('0x60')](_0x3a3888[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x3d827c[_0xddd6('0x49')][_0xddd6('0x61')]));_0x141e67[_0xddd6('0x4d')]=_0x141e67[_0xddd6('0x4d')]['length']?_0x141e67['attributes']:_0x3a3888[_0xddd6('0x5c')];_0x141e67[_0xddd6('0xda')]=qs[_0xddd6('0xdb')](_0x3d827c[_0xddd6('0x49')][_0xddd6('0xdb')]);_0x141e67[_0xddd6('0x46')]=qs['filters'](_[_0xddd6('0xdc')](_0x3d827c[_0xddd6('0x49')],_0x3a3888['filters']));if(_0x3d827c['query']['filter']){_0x141e67['where']=_[_0xddd6('0x62')](_0x141e67[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0x141e67['attributes'],function(_0x1336aa){var _0x324acd={};_0x324acd[_0x1336aa]={'$like':'%'+_0x3d827c[_0xddd6('0x49')]['filter']+'%'};return _0x324acd;})});}_0x141e67=_[_0xddd6('0x62')]({},_0x141e67,_0x3d827c[_0xddd6('0x63')]);return _0x233e12['getLists'](_0x141e67);}})['then'](function(_0x525a5c){if(_0x525a5c){_0x2ec8a9=_0x525a5c[_0xddd6('0x52')];if(!_0x3d827c[_0xddd6('0x49')][_0xddd6('0xd3')](_0xddd6('0xde'))){_0x141e67['limit']=qs['limit'](_0x3d827c['query'][_0xddd6('0x27')]);_0x141e67[_0xddd6('0x25')]=qs[_0xddd6('0x25')](_0x3d827c[_0xddd6('0x49')][_0xddd6('0x25')]);}return _0x233e12[_0xddd6('0x126')](_0x141e67);}})[_0xddd6('0x2c')](function(_0x4e04be){if(_0x4e04be){return _0x4e04be?{'count':_0x2ec8a9,'rows':_0x4e04be}:null;}})[_0xddd6('0x2c')](respondWithResult(_0x77be7d,null))['catch'](handleError(_0x77be7d,null));};exports[_0xddd6('0x127')]=function(_0x516e27,_0x4facc7){var _0x44cdd4={};var _0x2e51e3={};var _0x1188c8;return db[_0xddd6('0x3e')][_0xddd6('0x9a')]({'where':{'id':_0x516e27['params']['id']}})['then'](handleEntityNotFound(_0x4facc7,null))[_0xddd6('0x2c')](function(_0x23959b){if(_0x23959b){_0x1188c8=_0x23959b;_0x2e51e3[_0xddd6('0x5c')]=_[_0xddd6('0x5e')](db[_0xddd6('0x3e')][_0xddd6('0x3f')]);_0x2e51e3[_0xddd6('0x49')]=_[_0xddd6('0x5e')](_0x516e27[_0xddd6('0x49')]);_0x2e51e3['filters']=_[_0xddd6('0x60')](_0x2e51e3[_0xddd6('0x5c')],_0x2e51e3[_0xddd6('0x49')]);_0x44cdd4[_0xddd6('0x4d')]=_[_0xddd6('0x60')](_0x2e51e3[_0xddd6('0x5c')],qs[_0xddd6('0x61')](_0x516e27[_0xddd6('0x49')][_0xddd6('0x61')]));_0x44cdd4[_0xddd6('0x4d')]=_0x44cdd4['attributes'][_0xddd6('0x52')]?_0x44cdd4[_0xddd6('0x4d')]:_0x2e51e3['model'];_0x44cdd4['order']=qs[_0xddd6('0xdb')](_0x516e27[_0xddd6('0x49')]['sort']);_0x44cdd4[_0xddd6('0x46')]=qs[_0xddd6('0x5f')](_[_0xddd6('0xdc')](_0x516e27[_0xddd6('0x49')],_0x2e51e3[_0xddd6('0x5f')]));if(_0x516e27[_0xddd6('0x49')][_0xddd6('0x42')]){_0x44cdd4[_0xddd6('0x46')]=_[_0xddd6('0x62')](_0x44cdd4[_0xddd6('0x46')],{'$or':_[_0xddd6('0x36')](_0x44cdd4[_0xddd6('0x4d')],function(_0x213a25){var _0xa9a0ff={};_0xa9a0ff[_0x213a25]={'$like':'%'+_0x516e27[_0xddd6('0x49')]['filter']+'%'};return _0xa9a0ff;})});}_0x44cdd4[_0xddd6('0x5c')]=db[_0xddd6('0x3e')];_0x44cdd4['as']=_0xddd6('0x32');_0x44cdd4=_['merge']({},_0x44cdd4,_0x516e27[_0xddd6('0x63')]);return _0x1188c8[_0xddd6('0x128')]({'include':[_0x44cdd4]});}})[_0xddd6('0x2c')](function(_0x5920da){if(_0x5920da){var _0x2cb0d6={},_0x34bce7=[];for(var _0xd833c1=0x0;_0xd833c1<_0x5920da['length'];_0xd833c1+=0x1){for(var _0x22a36b=0x0,_0x1b0304;_0x22a36b<_0x5920da[_0xd833c1]['Agents'][_0xddd6('0x52')];_0x22a36b+=0x1){_0x1b0304=_0x5920da[_0xd833c1][_0xddd6('0x32')][_0x22a36b][_0xddd6('0xb2')]({'plain':!![]});_0x2cb0d6[_0x1b0304['id']]=_0x1b0304;}}_0x2cb0d6=_[_0xddd6('0x129')](_0x2cb0d6);for(var _0x2612fa=qs[_0xddd6('0x25')](_0x516e27['query'][_0xddd6('0x25')]);_0x2612fa<_0x2cb0d6[_0xddd6('0x52')]&&_0x34bce7[_0xddd6('0x52')]=_0x44c71a){_0x45a71e=_0x44c71a;_0xb1e98a=0xc8;}else{_0xb1e98a=0xce;}_0xec4e32[_0xc616('0x1d')](_0xb1e98a);return _0xec4e32[_0xc616('0x22')](_0xc616('0x23'),_0x455eb0+'-'+_0x45a71e+'/'+_0x44c71a)[_0xc616('0x1f')](_0x4c15ee);}return null;};}function saveUpdates(_0xa47ae4){return function(_0x1ad3d8){if(_0x1ad3d8){return _0x1ad3d8[_0xc616('0x24')](_0xa47ae4)[_0xc616('0x11')](function(_0x58686c){if(_0x58686c[_0xc616('0x25')]===_0xc616('0x26')){socket['emit'](_0xc616('0x27')+_0x58686c['id'],_0x58686c);}return _0x58686c;});}return null;};}function removeEntity(_0x288b36){return function(_0x46c5a6){if(_0x46c5a6){return _0x46c5a6[_0xc616('0x28')]()['then'](function(){var _0x104fe0=_0x46c5a6['get']({'plain':!![]});if(_0x104fe0['role']==='admin')return;var _0x555594=[{'name':_0xc616('0x29'),'value':_0xc616('0x2a'),'ignore':!![]},{'name':_0xc616('0x2b'),'value':_0xc616('0x26'),'ignore':![]},{'name':_0xc616('0x2c'),'value':_0xc616('0x2d'),'ignore':![]}];var _0x44c61=_(_0x555594)[_0xc616('0x2e')](_0xc616('0x2f'))[_0xc616('0x30')](_0xc616('0x31'))[_0xc616('0x31')]();if(_[_0xc616('0x32')](_0x44c61,_0x104fe0['role'])){return;}var _0x4b4d5f=_[_0xc616('0x33')](_0x555594,[_0xc616('0x31'),_0x104fe0['role']])['name'];return db[_0xc616('0x34')]['destroy']({'where':{'type':_0x4b4d5f,'resourceId':_0x104fe0['id']}})['then'](function(){return _0x46c5a6;});})['then'](function(){_0x288b36[_0xc616('0x1d')](0xcc)[_0xc616('0x1e')]();});}};}function handleEntityNotFound(_0x562551){return function(_0x586cc2){if(!_0x586cc2){_0x562551[_0xc616('0x1c')](0x194);}return _0x586cc2;};}function handleError(_0xfcc75,_0x2d08e9){_0x2d08e9=_0x2d08e9||0x1f4;return function(_0x187a65){logger['error'](_0x187a65[_0xc616('0x35')]);if(_0x187a65[_0xc616('0x36')]){delete _0x187a65['name'];}_0xfcc75[_0xc616('0x1d')](_0x2d08e9)[_0xc616('0x37')](_0x187a65);};}exports[_0xc616('0x38')]=function(_0x553c02,_0x2c11b0){var _0x352af0={},_0x29c063={'count':0x0,'rows':[]};var _0x162280=_(db[_0xc616('0x39')][_0xc616('0x3a')])[_0xc616('0x30')](function(_0x44f0e4){return{'name':_0x44f0e4[_0xc616('0x3b')],'type':_0x44f0e4[_0xc616('0x3c')][_0xc616('0x3d')]};})[_0xc616('0x2e')](function(_0x27db2e){return!_[_0xc616('0x32')]([_0xc616('0x3e'),_0xc616('0x3f')],_0x27db2e['name']);})['value']();_0x352af0=qs[_0xc616('0x40')](_0x162280,_0x553c02);var _0x4440a2={'where':_0x352af0[_0xc616('0x41')]};return db[_0xc616('0x39')][_0xc616('0x42')](_0x4440a2)[_0xc616('0x11')](function(_0x3a8783){_0x29c063[_0xc616('0x42')]=_0x3a8783;if(_0x553c02[_0xc616('0x43')][_0xc616('0x44')]){_0x352af0[_0xc616('0x45')]=[{'all':!![]}];}if(_0x553c02['query'][_0xc616('0x46')]===_0xc616('0x47')){_0x352af0['include']=[{'model':db[_0xc616('0x48')],'as':_0xc616('0x46')}];}if(!_[_0xc616('0x32')](_0x352af0[_0xc616('0x49')],'id')){_0x352af0[_0xc616('0x49')][_0xc616('0x4a')]('id');}return db['User']['findAll'](_0x352af0);})[_0xc616('0x11')](function(_0x127618){_0x29c063[_0xc616('0x4b')]=_0x127618;if(_0x553c02['query'][_0xc616('0x4c')]===_0xc616('0x47')){var _0x55eb5e=[];for(var _0x4f77f0=0x0;_0x4f77f0<_0x29c063[_0xc616('0x4b')][_0xc616('0x4d')];_0x4f77f0++){_0x55eb5e[_0xc616('0x4a')](get_open_tabs('chat',_0x29c063[_0xc616('0x4b')][_0x4f77f0][_0xc616('0x4e')]));_0x55eb5e[_0xc616('0x4a')](get_open_tabs('sms',_0x29c063['rows'][_0x4f77f0]['dataValues']));_0x55eb5e['push'](get_open_tabs(_0xc616('0x4f'),_0x29c063[_0xc616('0x4b')][_0x4f77f0][_0xc616('0x4e')]));_0x55eb5e['push'](get_open_tabs(_0xc616('0x50'),_0x29c063['rows'][_0x4f77f0]['dataValues']));_0x55eb5e[_0xc616('0x4a')](get_open_tabs(_0xc616('0x51'),_0x29c063['rows'][_0x4f77f0][_0xc616('0x4e')]));_0x55eb5e[_0xc616('0x4a')](get_open_tabs(_0xc616('0x52'),_0x29c063[_0xc616('0x4b')][_0x4f77f0][_0xc616('0x4e')]));}return Promise['all'](_0x55eb5e)[_0xc616('0x11')](function(){return _0x29c063;});}else{return _0x29c063;}})[_0xc616('0x11')](respondWithFilteredResult(_0x2c11b0,_0x352af0))[_0xc616('0x1b')](handleError(_0x2c11b0,null));};exports[_0xc616('0x53')]=function(_0x5979b0,_0x140ffc){var _0x23a744={'raw':![],'where':{'id':_0x5979b0[_0xc616('0x54')]['id']}},_0x1130e2={};_0x1130e2['model']=_[_0xc616('0x55')](_[_0xc616('0x56')](db[_0xc616('0x39')][_0xc616('0x3a')]),[_0xc616('0x3e'),_0xc616('0x3f')]);_0x1130e2[_0xc616('0x43')]=_[_0xc616('0x56')](_0x5979b0[_0xc616('0x43')]);_0x1130e2['filters']=_['intersection'](_0x1130e2[_0xc616('0x57')],_0x1130e2['query']);_0x23a744[_0xc616('0x49')]=_[_0xc616('0x58')](_0x1130e2[_0xc616('0x57')],qs[_0xc616('0x59')](_0x5979b0[_0xc616('0x43')]['fields']));_0x23a744[_0xc616('0x49')]=_0x23a744['attributes'][_0xc616('0x4d')]?_0x23a744[_0xc616('0x49')]:_0x1130e2[_0xc616('0x57')];if(_0x5979b0[_0xc616('0x43')][_0xc616('0x44')]){_0x23a744[_0xc616('0x45')]=[{'all':!![]}];}if(_0x5979b0[_0xc616('0x43')]['userSetting']===_0xc616('0x47')){_0x23a744[_0xc616('0x45')]=[{'model':db['UserSetting'],'as':_0xc616('0x46')}];}_0x23a744=_[_0xc616('0x5a')]({},_0x23a744,_0x5979b0['options']);if(!_['includes'](_0x23a744[_0xc616('0x49')],'id')){_0x23a744[_0xc616('0x49')][_0xc616('0x4a')]('id');}return db[_0xc616('0x39')][_0xc616('0x33')](_0x23a744)[_0xc616('0x11')](handleEntityNotFound(_0x140ffc,null))[_0xc616('0x11')](function(_0x4eb208){var _0x4a6afc=[];values=_0x4eb208;if(_0x5979b0[_0xc616('0x43')]['openTabs']===_0xc616('0x47')){_0x4a6afc[_0xc616('0x4a')](get_open_tabs('chat',_0x4eb208['dataValues']));_0x4a6afc[_0xc616('0x4a')](get_open_tabs(_0xc616('0x5b'),_0x4eb208[_0xc616('0x4e')]));_0x4a6afc['push'](get_open_tabs('openchannel',_0x4eb208['dataValues']));_0x4a6afc[_0xc616('0x4a')](get_open_tabs(_0xc616('0x52'),_0x4eb208[_0xc616('0x4e')]));_0x4a6afc[_0xc616('0x4a')](get_open_tabs('fax',_0x4eb208[_0xc616('0x4e')]));_0x4a6afc['push'](get_open_tabs('mail',_0x4eb208[_0xc616('0x4e')]));return Promise[_0xc616('0x5c')](_0x4a6afc);}else{return values;}})[_0xc616('0x11')](function(){return values;})[_0xc616('0x11')](respondWithResult(_0x140ffc,null))[_0xc616('0x1b')](handleError(_0x140ffc,null));};exports[_0xc616('0x24')]=function(_0x91e106,_0x48a206){if(_0x91e106[_0xc616('0x5d')]['id']){delete _0x91e106[_0xc616('0x5d')]['id'];}delete _0x91e106[_0xc616('0x5d')][_0xc616('0x25')];return db['User'][_0xc616('0x33')]({'where':{'id':_0x91e106[_0xc616('0x54')]['id']}})['then'](handleEntityNotFound(_0x48a206,null))[_0xc616('0x11')](saveUpdates(_0x91e106[_0xc616('0x5d')],null))[_0xc616('0x11')](respondWithResult(_0x48a206,null))[_0xc616('0x1b')](handleError(_0x48a206,null));};exports[_0xc616('0x5e')]=function(_0x434476,_0x4e942c){return db[_0xc616('0x39')]['describe']()[_0xc616('0x11')](respondWithResult(_0x4e942c,null))[_0xc616('0x1b')](handleError(_0x4e942c,null));};exports[_0xc616('0x5f')]=function(_0x939e6e,_0xddfced){return db[_0xc616('0x39')]['find']({'where':{'id':_0x939e6e['params']['id']}})[_0xc616('0x11')](handleEntityNotFound(_0xddfced,null))[_0xc616('0x11')](function(_0x10718c){if(_0x10718c){return _0x10718c['addContacts'](_0x939e6e[_0xc616('0x5d')][_0xc616('0x60')],_[_0xc616('0x61')](_0x939e6e[_0xc616('0x5d')],[_0xc616('0x60'),'id'])||{});}})[_0xc616('0x11')](respondWithResult(_0xddfced,null))[_0xc616('0x1b')](handleError(_0xddfced,null));};function validateUser(_0x4bff4f){return new Promise(function(_0x164125,_0x3c6c27){if(_0x4bff4f[_0xc616('0x62')])return _0x164125(_0x4bff4f);return db[_0xc616('0x63')][_0xc616('0x64')](0x1)['then'](function(_0x4297d7){if(_0x4297d7[_0xc616('0x65')])authService[_0xc616('0x66')](_0x4bff4f[_0xc616('0x3e')]);db[_0xc616('0x39')][_0xc616('0x67')]('internal')[_0xc616('0x11')](function(_0x392270){if(_[_0xc616('0x68')](_0x392270)){_0x4bff4f[_0xc616('0x62')]=_0x4297d7['min_internal']||0x1;return;}if(_['isNil'](_0x4297d7[_0xc616('0x69')])||_0x4297d7[_0xc616('0x69')]===_0x392270){_0x4bff4f['internal']=_0x392270+0x1;return;}if(_0x4297d7[_0xc616('0x69')]>_0x392270){_0x4bff4f[_0xc616('0x62')]=_0x4297d7['min_internal'];return;}return db[_0xc616('0x6a')][_0xc616('0x43')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xc616('0x6a')][_0xc616('0x6b')][_0xc616('0x6c')]})[_0xc616('0x11')](function(_0x476cb9){if(_0x476cb9&&_0x476cb9[_0xc616('0x4d')]){for(var _0x5b1dac=0x0,_0x35f57a=_0x476cb9[_0xc616('0x4d')];_0x5b1dac<_0x35f57a&&_[_0xc616('0x68')](_0x4bff4f[_0xc616('0x62')]);_0x5b1dac++){if(_0x4297d7[_0xc616('0x69')]<=_0x476cb9[_0x5b1dac][_0xc616('0x6d')]){_0x4bff4f['internal']=_0x476cb9[_0x5b1dac][_0xc616('0x6d')];}else if(_0x4297d7['min_internal']>_0x476cb9[_0x5b1dac][_0xc616('0x6d')]&&_0x4297d7[_0xc616('0x69')]<=_0x476cb9[_0x5b1dac]['to']){_0x4bff4f[_0xc616('0x62')]=_0x4297d7['min_internal'];}}}if(_['isNil'](_0x4bff4f['internal'])){_0x4bff4f['internal']=_0x392270+0x1;}return _0x164125(_0x4bff4f);});});})[_0xc616('0x1b')](function(_0x516b01){_0x3c6c27(_0x516b01);});});}function updateUser(_0x29dc76){return new Promise(function(_0x3d99b2,_0x4431ac){try{if(_0x29dc76[_0xc616('0x6e')]){_0x29dc76[_0xc616('0x6f')]=_0x29dc76[_0xc616('0x62')];_0x29dc76[_0xc616('0x70')]={'mailbox':_0x29dc76['internal'],'password':_0x29dc76['password'],'fullname':_0x29dc76[_0xc616('0x71')],'email':_0x29dc76[_0xc616('0x72')]};}if(_0x29dc76['role']===_0xc616('0x26')){if(!_0x29dc76['permissions'])_0x29dc76[_0xc616('0x73')]=['101','102',_0xc616('0x74'),_0xc616('0x75'),'110','104',_0xc616('0x76'),_0xc616('0x77'),'107',_0xc616('0x78'),'109',_0xc616('0x79'),_0xc616('0x7a'),_0xc616('0x7b'),_0xc616('0x7c')];}_0x3d99b2(_0x29dc76);}catch(_0x363554){_0x4431ac(_0x363554);}});}exports[_0xc616('0x7d')]=function(_0x1bcdae,_0x1bea01){if(_0x1bcdae[_0xc616('0x2a')][_0xc616('0x25')]===_0xc616('0x26'))throw new Error('Unauthorized');if(_0x1bcdae[_0xc616('0x5d')][_0xc616('0x25')]==='user'&&_0x1bcdae[_0xc616('0x2a')][_0xc616('0x25')]!=='admin'){throw new Error(_0xc616('0x7e'));}if(_0x1bcdae[_0xc616('0x5d')]['role']===_0xc616('0x7f')&&_0x1bcdae['user'][_0xc616('0x25')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xc616('0x80')]([_0x1bcdae['body']])['then'](function(){return validateUser(_0x1bcdae[_0xc616('0x5d')]);})[_0xc616('0x11')](function(_0x33bc25){return updateUser(_0x33bc25)[_0xc616('0x11')](function(_0x49a950){if(_0x49a950['role']===_0xc616('0x7f')){_0x49a950['settingsEnabled']=_0x1bcdae[_0xc616('0x2a')][_0xc616('0x81')];delete _0x49a950['userProfileId'];}return _0x49a950;});})[_0xc616('0x11')](function(_0x2db2ea){return db[_0xc616('0x39')][_0xc616('0x7d')](_0x2db2ea,{'include':[{'model':db[_0xc616('0x70')],'as':_0xc616('0x70')}]});})[_0xc616('0x11')](function(_0x72ec03){if(_0x1bcdae['body'][_0xc616('0x25')]===_0xc616('0x2a'))return _0x72ec03;if(_0x1bcdae[_0xc616('0x2a')][_0xc616('0x25')]!=='user')return _0x72ec03;return db[_0xc616('0x82')][_0xc616('0x33')]({'where':{'name':_0x72ec03[_0xc616('0x25')]===_0xc616('0x26')?_0xc616('0x2b'):'Telephones','userProfileId':_0x1bcdae[_0xc616('0x2a')][_0xc616('0x83')]},'raw':!![]})[_0xc616('0x11')](function(_0x3ae30e){if(!_0x3ae30e||_0x3ae30e[_0xc616('0x84')]!=0x0)return _0x72ec03;return db['UserProfileResource'][_0xc616('0x7d')]({'name':_0x72ec03[_0xc616('0x36')],'resourceId':_0x72ec03['id'],'type':_0x3ae30e[_0xc616('0x36')],'sectionId':_0x3ae30e['id']},{})[_0xc616('0x11')](function(){return _0x72ec03;});})[_0xc616('0x1b')](function(_0x2773cc){logger[_0xc616('0x17')](_0xc616('0x85'),_0x2773cc);throw _0x2773cc;});})['then'](respondWithResult(_0x1bea01,0xc9))[_0xc616('0x1b')](handleError(_0x1bea01,null));};exports[_0xc616('0x86')]=function(_0x5a7071,_0x2b6a42){var _0xd03069=_0x5a7071[_0xc616('0x5d')];var _0x697ec4=[];if(_0x5a7071[_0xc616('0x2a')][_0xc616('0x25')]===_0xc616('0x26'))throw new Error(_0xc616('0x87'));if(_[_0xc616('0x88')](_0xd03069,[_0xc616('0x25'),_0xc616('0x2a')])&&_0x5a7071['user']['role']!==_0xc616('0x7f')){throw new Error(_0xc616('0x7e'));}if(_[_0xc616('0x88')](_0xd03069,[_0xc616('0x25'),_0xc616('0x7f')])&&_0x5a7071['user']['role']!==_0xc616('0x7f')){throw new Error(_0xc616('0x89'));}return licenseUtil[_0xc616('0x80')](_0xd03069)[_0xc616('0x11')](function(){return validateUser(_0xd03069[0x0]);})['then'](function(){for(var _0x3e61b5=0x1;_0x3e61b5<_0xd03069[_0xc616('0x4d')];_0x3e61b5++){var _0x2bbc26=_0xd03069[_0x3e61b5-0x1][_0xc616('0x62')];if(!_0xd03069[_0x3e61b5][_0xc616('0x62')])_0xd03069[_0x3e61b5][_0xc616('0x62')]=_0x2bbc26+0x1;_0x697ec4['push'](validateUser(_0xd03069[_0x3e61b5]));}return Promise[_0xc616('0x5c')](_0x697ec4);})['then'](function(){_0x697ec4=[];for(var _0x417f28=0x0;_0x417f28<_0xd03069[_0xc616('0x4d')];_0x417f28++){_0x697ec4['push'](updateUser(_0xd03069[_0x417f28]));}return Promise[_0xc616('0x5c')](_0x697ec4);})[_0xc616('0x11')](function(){_0x697ec4=_0xd03069[_0xc616('0x30')](function(_0x2e9c6d){return db['User'][_0xc616('0x7d')](_0x2e9c6d,{'include':[{'model':db[_0xc616('0x70')],'as':'VoiceMail'}]})[_0xc616('0x11')](function(_0x483276){_0x2e9c6d['id']=_0x483276['id'];return _0x2e9c6d;});});return Promise[_0xc616('0x5c')](_0x697ec4);})['then'](function(_0x3290dd){if(_0x5a7071[_0xc616('0x5d')][_0xc616('0x25')]===_0xc616('0x2a'))return _0x3290dd;if(_0x5a7071[_0xc616('0x2a')]['role']!==_0xc616('0x2a'))return _0x3290dd;var _0x51c623=_[_0xc616('0x88')](_0x3290dd,function(_0x256b6c){return _0x256b6c[_0xc616('0x25')]===_0xc616('0x26')||_0x256b6c[_0xc616('0x25')]===_0xc616('0x2d');});if(!_0x51c623)return _0x3290dd;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0xc616('0x2b'),_0xc616('0x2c')]},'userProfileId':_0x5a7071[_0xc616('0x2a')][_0xc616('0x83')]},'raw':!![]})[_0xc616('0x11')](function(_0x52a276){if(_['isEmpty'](_0x52a276)||!_[_0xc616('0x88')](_0x52a276,[_0xc616('0x84'),0x0]))return _0x3290dd;_0x697ec4=[];var _0xef549d=_(_0x52a276)['map'](function(_0x3d5dc5){if(_0x3d5dc5['autoAssociation']===0x1)return;return _0x3d5dc5['name']==='Agents'?_0xc616('0x26'):_0xc616('0x2d');})['compact']()['value']();for(var _0x27b8bf=0x0;_0x27b8bf<_0x3290dd[_0xc616('0x4d')];_0x27b8bf++){if(!_[_0xc616('0x32')](_0xef549d,_0x3290dd[_0x27b8bf]['role']))return;var _0x248514=_0x3290dd[_0x27b8bf]['role']===_0xc616('0x26')?_0xc616('0x2b'):'Telephones';_0x697ec4[_0xc616('0x4a')](db[_0xc616('0x34')][_0xc616('0x7d')]({'name':_0x3290dd[_0x27b8bf][_0xc616('0x36')],'resourceId':_0x3290dd[_0x27b8bf]['id'],'type':_0x248514,'sectionId':_[_0xc616('0x33')](_0x52a276,[_0xc616('0x36'),_0x248514])['id']},{}));}return Promise[_0xc616('0x5c')](_0x697ec4);});})[_0xc616('0x11')](respondWithResult(_0x2b6a42,0xc9))[_0xc616('0x1b')](handleError(_0x2b6a42,null));};exports[_0xc616('0x8a')]=function(_0x15973a,_0x4fd5dd){if(_0x15973a['body']['id']){delete _0x15973a[_0xc616('0x5d')]['id'];}return db['User'][_0xc616('0x33')]({'where':{'id':_0x15973a[_0xc616('0x54')]['id']}})['then'](function(_0x3b24c9){if(!_0x3b24c9)return null;if(_0x3b24c9['id']===_0x15973a[_0xc616('0x2a')]['id']){if(!_0x15973a[_0xc616('0x5d')]['oldPassword']||!_0x15973a[_0xc616('0x5d')][_0xc616('0x8b')]){throw new db[(_0xc616('0x8c'))][(_0xc616('0x8d'))](_0xc616('0x8e'));}if(!_0x3b24c9['authenticate'](_0x15973a[_0xc616('0x5d')][_0xc616('0x8f')])){throw new db[(_0xc616('0x8c'))][(_0xc616('0x8d'))](_0xc616('0x90'));}if(_0x15973a['body'][_0xc616('0x8f')]===_0x15973a[_0xc616('0x5d')]['newPassword']){throw new db[(_0xc616('0x8c'))][(_0xc616('0x8d'))](_0xc616('0x91'));}}else if(_0x15973a['user'][_0xc616('0x25')]===_0xc616('0x7f')){if(!_0x15973a[_0xc616('0x5d')][_0xc616('0x8b')]){throw new db[(_0xc616('0x8c'))][(_0xc616('0x8d'))](_0xc616('0x92'));}}else if(_0x15973a['user']['role']===_0xc616('0x2a')){if(!_0x15973a[_0xc616('0x5d')][_0xc616('0x8b')]){throw new db['Sequelize'][(_0xc616('0x8d'))](_0xc616('0x92'));}if(_0x3b24c9[_0xc616('0x25')]!=='agent'){throw new db['Sequelize'][(_0xc616('0x8d'))](_0xc616('0x87'));}}else{throw new db[(_0xc616('0x8c'))]['ValidationError'](_0xc616('0x87'));}return _0x3b24c9;})[_0xc616('0x11')](handleEntityNotFound(_0x4fd5dd,null))[_0xc616('0x11')](function(_0x2a2362){return db[_0xc616('0x63')][_0xc616('0x93')]({'attributes':['id','securePassword',_0xc616('0x94'),_0xc616('0x95')]})[_0xc616('0x11')](function(_0x1b54cc){if(_0x1b54cc['securePassword'])authService[_0xc616('0x66')](_0x15973a['body']['newPassword']);if(!_0x1b54cc[_0xc616('0x94')]||!_0x2a2362['previousPasswords'])return _0x2a2362;authService[_0xc616('0x96')](_0x15973a[_0xc616('0x5d')][_0xc616('0x8b')],_0x2a2362[_0xc616('0x97')],_0x1b54cc[_0xc616('0x95')]);return _0x2a2362;})['then'](saveUpdates({'password':_0x15973a['body'][_0xc616('0x8b')],'passwordResetAt':_0x15973a['user']['id']==_0x15973a[_0xc616('0x54')]['id']?moment():null,'previousPasswords':authService[_0xc616('0x98')](_0x15973a[_0xc616('0x5d')][_0xc616('0x8b')],_0x2a2362[_0xc616('0x97')])},null));})[_0xc616('0x11')](respondWithResult(_0x4fd5dd,null))[_0xc616('0x1b')](handleError(_0x4fd5dd,null));};exports[_0xc616('0x99')]=function(_0x4073ee,_0x5874eb){var _0x51b396=_0x4073ee[_0xc616('0x5d')][_0xc616('0x9a')];return db[_0xc616('0x39')][_0xc616('0x33')]({'where':{'id':_0x4073ee[_0xc616('0x54')]['id']},'attributes':['id',_0xc616('0x36'),_0xc616('0x25'),_0xc616('0x9b'),'loginInPause',_0xc616('0x9c'),'interface']})[_0xc616('0x11')](handleEntityNotFound(_0x5874eb,null))[_0xc616('0x11')](function(_0x55a407){if(_0x55a407){if(!utils['isValidChannel'](_0x51b396)){throw new db['Sequelize'][(_0xc616('0x8d'))](_0xc616('0x9d'));}return _0x55a407[_0xc616('0x9e')+_['capitalize'](_0x51b396[_0xc616('0x9f')]())+'Queues'](_0x4073ee[_0xc616('0x5d')][_0xc616('0x60')],{'penalty':_0x4073ee[_0xc616('0x5d')][_0xc616('0xa0')]||0x0})[_0xc616('0xa1')](function(_0x32aa91){for(var _0x2b74f5=0x0;_0x2b74f5<_0x4073ee[_0xc616('0x5d')][_0xc616('0x60')][_0xc616('0x4d')];_0x2b74f5+=0x1){var _0x14b35c={'UserId':Number(_0x4073ee[_0xc616('0x54')]['id'])};_0x14b35c[_[_0xc616('0xa2')](_0x51b396[_0xc616('0x9f')]())+_0xc616('0xa3')]=Number(_0x4073ee[_0xc616('0x5d')][_0xc616('0x60')][_0x2b74f5]);socket[_0xc616('0xa4')]('user'+_[_0xc616('0xa2')](_0x51b396[_0xc616('0x9f')]())+_0xc616('0xa5'),_0x14b35c);}return _0x32aa91;})[_0xc616('0x11')](function(){if(_0x51b396===_0xc616('0xa6')){return db['VoiceQueue'][_0xc616('0xa7')]({'where':{'id':_0x4073ee[_0xc616('0x5d')]['ids']||[]},'raw':!![],'attributes':['id',_0xc616('0x36')]});}})[_0xc616('0x11')](function(_0x5e3154){var _0x19c2a5=_0x55a407['get']({'plain':!![]});var _0x58ff70=[];if(_0x51b396===_0xc616('0xa6')&&_0x19c2a5[_0xc616('0x25')]==='agent'&&_0x19c2a5[_0xc616('0x9b')]){for(let _0x526d18=0x0;_0x526d18<_0x5e3154[_0xc616('0x4d')];_0x526d18+=0x1){_0x58ff70[_0xc616('0x4a')]({'membername':_0x19c2a5[_0xc616('0x36')],'UserId':_0x19c2a5['id'],'queue_name':_0x5e3154[_0x526d18]['name'],'VoiceQueueId':_0x5e3154[_0x526d18]['id'],'interface':_[_0xc616('0x68')](_0x19c2a5[_0xc616('0xa8')])?util[_0xc616('0xa9')](_0xc616('0xaa'),_0x19c2a5[_0xc616('0x36')]):_0x19c2a5[_0xc616('0xa8')],'paused':_0x19c2a5['voicePause']||![],'penalty':_0x4073ee[_0xc616('0x5d')][_0xc616('0xa0')]||0x0});}return Promise[_0xc616('0x5c')](_0x58ff70['map'](function(_0x5152be){return db['UserVoiceQueueRt'][_0xc616('0xab')](_0x5152be);}));}return _0x55a407;});}})[_0xc616('0x11')](respondWithStatusCode(_0x5874eb,null))['catch'](handleError(_0x5874eb,null));};exports[_0xc616('0xac')]=function(_0x3d7fec,_0x417df6){var _0x10bb87,_0x2185d8;return db[_0xc616('0x39')][_0xc616('0x33')]({'where':{'id':_0x3d7fec[_0xc616('0x54')]['id']},'attributes':['id',_0xc616('0x36'),_0xc616('0x25')]})[_0xc616('0x11')](handleEntityNotFound(_0x417df6,null))[_0xc616('0x11')](function(_0x1eb426){if(_0x1eb426){_0x10bb87=_0x1eb426;if(!_0x3d7fec['query'][_0xc616('0x9a')]||!utils[_0xc616('0xad')](_0x3d7fec[_0xc616('0x43')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xc616('0x9d'));}return _0x1eb426['remove'+_[_0xc616('0xa2')](_0x3d7fec['query']['channel'][_0xc616('0x9f')]())+'Queues'](_0x3d7fec[_0xc616('0x43')]['ids']);}})['then'](function(_0x390414){if(_['isArray'](_0x3d7fec[_0xc616('0x43')][_0xc616('0x60')])){for(var _0x4452e9=0x0;_0x4452e9<_0x3d7fec[_0xc616('0x43')][_0xc616('0x60')][_0xc616('0x4d')];_0x4452e9+=0x1){_0x2185d8={'UserId':Number(_0x3d7fec[_0xc616('0x54')]['id'])};_0x2185d8[_[_0xc616('0xa2')](_0x3d7fec[_0xc616('0x43')][_0xc616('0x9a')][_0xc616('0x9f')]())+_0xc616('0xa3')]=Number(_0x3d7fec[_0xc616('0x43')][_0xc616('0x60')][_0x4452e9]);socket[_0xc616('0xa4')](_0xc616('0x2a')+_['capitalize'](_0x3d7fec[_0xc616('0x43')][_0xc616('0x9a')][_0xc616('0x9f')]())+_0xc616('0xae'),_0x2185d8);}}else{_0x2185d8={'UserId':Number(_0x3d7fec['params']['id'])};_0x2185d8[_[_0xc616('0xa2')](_0x3d7fec[_0xc616('0x43')][_0xc616('0x9a')][_0xc616('0x9f')]())+_0xc616('0xa3')]=Number(_0x3d7fec['query'][_0xc616('0x60')]);socket[_0xc616('0xa4')](_0xc616('0x2a')+_['capitalize'](_0x3d7fec[_0xc616('0x43')][_0xc616('0x9a')][_0xc616('0x9f')]())+'Queue:remove',_0x2185d8);}return _0x390414;})[_0xc616('0x11')](function(){if(_0x3d7fec[_0xc616('0x43')][_0xc616('0x9a')]===_0xc616('0xa6')){return db[_0xc616('0xaf')][_0xc616('0x28')]({'where':{'UserId':_0x3d7fec[_0xc616('0x54')]['id'],'VoiceQueueId':_0x3d7fec[_0xc616('0x43')][_0xc616('0x60')]},'individualHooks':!![]})['then'](function(){return _0x10bb87;});}return _0x10bb87;})[_0xc616('0x11')](respondWithStatusCode(_0x417df6,null))[_0xc616('0x1b')](handleError(_0x417df6,null));};exports[_0xc616('0xb0')]=function(_0x302af2,_0x4b6501){_0x302af2[_0xc616('0x5d')][_0xc616('0xb1')]=_0x302af2['file'][_0xc616('0xb2')];return db[_0xc616('0x39')][_0xc616('0x33')]({'where':{'id':_0x302af2['params']['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x4b6501,null))[_0xc616('0x11')](saveUpdates(_0x302af2[_0xc616('0x5d')],null))['then'](respondWithResult(_0x4b6501,null))[_0xc616('0x1b')](handleError(_0x4b6501,null));};exports[_0xc616('0xb3')]=function(_0x252487,_0x4177f3){var _0x8d8666=path[_0xc616('0xb4')](config[_0xc616('0xb5')],_0xc616('0xb6'));return db[_0xc616('0x39')][_0xc616('0x33')]({'where':{'id':_0x252487[_0xc616('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x4177f3,null))[_0xc616('0x11')](function(_0x5a1ffb){if(_0x5a1ffb){if(_[_0xc616('0x68')](_0x5a1ffb[_0xc616('0xb1')])){return _0x4177f3[_0xc616('0xb7')](_0x8d8666);}else{if(!fs[_0xc616('0xb8')](path[_0xc616('0xb4')](config[_0xc616('0xb5')],'server/files/images/',_0x5a1ffb[_0xc616('0xb1')]))){return _0x4177f3[_0xc616('0xb7')](_0x8d8666);}return _0x4177f3[_0xc616('0xb7')](path[_0xc616('0xb4')](config[_0xc616('0xb5')],_0xc616('0xb9'),_0x5a1ffb['userpic']));}}})['catch'](handleError(_0x4177f3,null));};exports[_0xc616('0xba')]=function(_0x3493d9,_0x490873){return db['User']['find']({'where':{'id':_0x3493d9['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x490873,null))['then'](function(_0x9b8d17){var _0x959adb=[];values=_0x9b8d17[_0xc616('0x4e')];_0x959adb[_0xc616('0x4a')](get_open_tabs(_0xc616('0xbb'),_0x9b8d17[_0xc616('0x4e')]));_0x959adb[_0xc616('0x4a')](get_open_tabs(_0xc616('0x5b'),_0x9b8d17['dataValues']));_0x959adb[_0xc616('0x4a')](get_open_tabs('openchannel',_0x9b8d17[_0xc616('0x4e')]));_0x959adb[_0xc616('0x4a')](get_open_tabs(_0xc616('0x52'),_0x9b8d17[_0xc616('0x4e')]));_0x959adb[_0xc616('0x4a')](get_open_tabs('fax',_0x9b8d17[_0xc616('0x4e')]));_0x959adb[_0xc616('0x4a')](get_open_tabs(_0xc616('0x50'),_0x9b8d17[_0xc616('0x4e')]));return Promise[_0xc616('0x5c')](_0x959adb);})['then'](function(_0x3e256e){if(_0x3e256e){var _0x567784=_[_0xc616('0x30')](values['ChatOpenTabs'],function(_0xa52838){return{'channel':_0xc616('0xbc'),'id':_0xa52838['id'],'createdAt':_0xa52838['createdAt']};});var _0x545f12=_[_0xc616('0x30')](values[_0xc616('0xbd')],function(_0x11b7ea){return{'channel':_0xc616('0xbe'),'id':_0x11b7ea['id'],'createdAt':_0x11b7ea[_0xc616('0xbf')]};});var _0x49e91a=_[_0xc616('0x30')](values[_0xc616('0xc0')],function(_0x457c9b){return{'channel':_0xc616('0xc1'),'id':_0x457c9b['id'],'createdAt':_0x457c9b[_0xc616('0xbf')]};});var _0x5bf8e3=_[_0xc616('0x30')](values[_0xc616('0xc2')],function(_0xdf4ee5){return{'channel':_0xc616('0xc3'),'id':_0xdf4ee5['id'],'createdAt':_0xdf4ee5[_0xc616('0xbf')]};});var _0x598b71=_[_0xc616('0x30')](values[_0xc616('0xc4')],function(_0x23acab){return{'channel':_0xc616('0xc5'),'id':_0x23acab['id'],'createdAt':_0x23acab['createdAt']};});var _0x5c9454=_['map'](values['WhatsappOpenTabs'],function(_0x1c81f7){return{'channel':_0xc616('0xc6'),'id':_0x1c81f7['id'],'createdAt':_0x1c81f7['createdAt']};});var _0x3d8b2f=_[_0xc616('0xc7')](_0x567784,_0x545f12,_0x49e91a,_0x5bf8e3,_0x598b71,_0x5c9454);var _0x3dc96c={'count':_0x3d8b2f[_0xc616('0x4d')],'rows':_0x3d8b2f};return _0x3dc96c;}else return null;})[_0xc616('0x11')](respondWithResult(_0x490873,null))[_0xc616('0x1b')](handleError(_0x490873,null));};exports['getContacts']=function(_0x39dcd0,_0x130da4){var _0xbe38d2={};return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x39dcd0[_0xc616('0x54')]['id']}})[_0xc616('0x11')](function(_0x32793a){if(!_0x32793a){throw new APINotFoundError(util['format'](_0xc616('0xc8'),_0x39dcd0[_0xc616('0x54')]['id']));}return contacts[_0xc616('0x5e')]();})[_0xc616('0x11')](function(_0x5d9494){_0x39dcd0['query']['User']=_0x39dcd0[_0xc616('0x54')]['id'];_0xbe38d2=qs[_0xc616('0x40')](_0x5d9494,_0x39dcd0);if(_0x39dcd0['query'][_0xc616('0xc9')](_0xc616('0x44'))){_0xbe38d2[_0xc616('0x45')]=[{'model':db[_0xc616('0xca')],'as':_0xc616('0xcb'),'required':![]},{'model':db[_0xc616('0xcc')],'as':_0xc616('0xcd'),'attributes':['id',_0xc616('0x36'),'color'],'where':_0x39dcd0[_0xc616('0x43')]['tag']?{'id':_0x39dcd0['query']['tag']}:undefined,'required':_0x39dcd0[_0xc616('0x43')][_0xc616('0xce')]?!![]:![]}];}return contacts[_0xc616('0xa7')](_0x39dcd0['query'],_0x39dcd0[_0xc616('0x2a')],_0xbe38d2,_0x5d9494);})['then'](respondWithFilteredResult(_0x130da4,_0xbe38d2))[_0xc616('0x1b')](APIHandleError(_0x130da4));};exports[_0xc616('0xcf')]=function(_0x362145,_0x500de1){var _0x24c3ee;var _0x38cd09={};var _0x28b96e;return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x362145[_0xc616('0x54')]['id']},'attributes':['id',_0xc616('0x36'),'role']})['then'](handleEntityNotFound(_0x500de1,null))[_0xc616('0x11')](function(_0x128366){if(!utils[_0xc616('0xad')](_0x362145[_0xc616('0x43')]['channel'])){throw new db[(_0xc616('0x8c'))][(_0xc616('0x8d'))](_0xc616('0x9d'));}_0x24c3ee=_0x128366;var _0x353db9={};_0x353db9[_0xc616('0x57')]=_['keys'](db[_[_0xc616('0xa2')](_0x362145[_0xc616('0x43')][_0xc616('0x9a')])+_0xc616('0xd0')][_0xc616('0x3a')]);_0x353db9[_0xc616('0x43')]=_['keys'](_0x362145[_0xc616('0x43')]);_0x353db9[_0xc616('0xd1')]=_[_0xc616('0x58')](_0x353db9[_0xc616('0x57')],_0x353db9[_0xc616('0x43')]);_0x38cd09['attributes']=_[_0xc616('0x58')](_0x353db9[_0xc616('0x57')],qs[_0xc616('0x59')](_0x362145[_0xc616('0x43')][_0xc616('0x59')]));_0x38cd09[_0xc616('0x49')]=_0x38cd09['attributes'][_0xc616('0x4d')]?_0x38cd09[_0xc616('0x49')]:_0x353db9[_0xc616('0x57')];_0x38cd09[_0xc616('0xd2')]=qs[_0xc616('0xd3')](_0x362145['query'][_0xc616('0xd3')]);_0x38cd09[_0xc616('0x41')]=qs[_0xc616('0xd1')](_[_0xc616('0xd4')](_0x362145[_0xc616('0x43')],_0x353db9[_0xc616('0xd1')]));if(_0x362145[_0xc616('0x43')][_0xc616('0x2e')]){_0x38cd09[_0xc616('0x41')]=_[_0xc616('0x5a')](_0x38cd09[_0xc616('0x41')],{'$or':_['map'](_0x38cd09[_0xc616('0x49')],function(_0x46edb6){var _0x4f3563={};_0x4f3563[_0x46edb6]={'$like':'%'+_0x362145[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x4f3563;})});}_0x38cd09=_[_0xc616('0x5a')]({},_0x38cd09,_0x362145['options']);switch(_0x24c3ee[_0xc616('0x25')]){case _0xc616('0x7f'):return db[_[_0xc616('0xa2')](_0x362145['query']['channel'])+_0xc616('0xd0')]['findAll'](_0x38cd09);case _0xc616('0x2a'):case _0xc616('0x26'):return _0x24c3ee[_0xc616('0xd5')+_[_0xc616('0xa2')](_0x362145[_0xc616('0x43')][_0xc616('0x9a')])+_0xc616('0xd6')](_0x38cd09);default:throw new db[(_0xc616('0x8c'))][(_0xc616('0x8d'))]('Unknown\x20role');}})[_0xc616('0x11')](function(_0x303310){_0x28b96e=_0x303310['length'];if(!_0x362145['query']['hasOwnProperty'](_0xc616('0xd7'))){_0x38cd09[_0xc616('0xd8')]=qs['limit'](_0x362145[_0xc616('0x43')][_0xc616('0xd8')]);_0x38cd09[_0xc616('0x21')]=qs['offset'](_0x362145[_0xc616('0x43')]['offset']);}switch(_0x24c3ee['role']){case _0xc616('0x7f'):return db[_[_0xc616('0xa2')](_0x362145['query'][_0xc616('0x9a')])+_0xc616('0xd0')]['findAll'](_0x38cd09);case _0xc616('0x2a'):case _0xc616('0x26'):return _0x24c3ee[_0xc616('0xd5')+_[_0xc616('0xa2')](_0x362145[_0xc616('0x43')][_0xc616('0x9a')])+_0xc616('0xd6')](_0x38cd09);}})[_0xc616('0x11')](function(_0x36ecf6){return{'count':_0x28b96e,'rows':_0x36ecf6};})['then'](respondWithResult(_0x500de1,null))[_0xc616('0x1b')](handleError(_0x500de1,null));};exports[_0xc616('0xd9')]=function(_0x24531d,_0x5ae13d){var _0x1cbbad={};var _0x1c52f7={};var _0xdf0726;var _0x102f9f;return db[_0xc616('0x39')]['findOne']({'where':{'id':_0x24531d[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x5ae13d,null))[_0xc616('0x11')](function(_0x2aa0ad){if(_0x2aa0ad){_0xdf0726=_0x2aa0ad;_0x1c52f7[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0xaf')]['rawAttributes']);_0x1c52f7['query']=_[_0xc616('0x56')](_0x24531d[_0xc616('0x43')]);_0x1c52f7[_0xc616('0xd1')]=_['intersection'](_0x1c52f7['model'],_0x1c52f7[_0xc616('0x43')]);_0x1cbbad[_0xc616('0x49')]=_['intersection'](_0x1c52f7[_0xc616('0x57')],qs[_0xc616('0x59')](_0x24531d[_0xc616('0x43')][_0xc616('0x59')]));_0x1cbbad[_0xc616('0x49')]=_0x1cbbad[_0xc616('0x49')][_0xc616('0x4d')]?_0x1cbbad[_0xc616('0x49')]:_0x1c52f7[_0xc616('0x57')];_0x1cbbad[_0xc616('0xd2')]=qs['sort'](_0x24531d['query'][_0xc616('0xd3')]);_0x1cbbad[_0xc616('0x41')]=qs[_0xc616('0xd1')](_[_0xc616('0xd4')](_0x24531d['query'],_0x1c52f7[_0xc616('0xd1')]));if(_0x24531d[_0xc616('0x43')][_0xc616('0x2e')]){_0x1cbbad[_0xc616('0x41')]=_[_0xc616('0x5a')](_0x1cbbad[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0x1cbbad[_0xc616('0x49')],function(_0x4f26ce){var _0x5f4a74={};_0x5f4a74[_0x4f26ce]={'$like':'%'+_0x24531d['query'][_0xc616('0x2e')]+'%'};return _0x5f4a74;})});}_0x1cbbad=_[_0xc616('0x5a')]({},_0x1cbbad,_0x24531d[_0xc616('0xda')]);return _0xdf0726[_0xc616('0xd9')](_0x1cbbad);}})['then'](function(_0x5cde1d){if(_0x5cde1d){_0x102f9f=_0x5cde1d['length'];if(!_0x24531d[_0xc616('0x43')]['hasOwnProperty'](_0xc616('0xd7'))){_0x1cbbad[_0xc616('0xd8')]=qs[_0xc616('0xd8')](_0x24531d['query'][_0xc616('0xd8')]);_0x1cbbad[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x24531d[_0xc616('0x43')][_0xc616('0x21')]);}return _0xdf0726[_0xc616('0xd9')](_0x1cbbad);}})['then'](function(_0x6daf90){if(_0x6daf90){return _0x6daf90?{'count':_0x102f9f,'rows':_0x6daf90}:null;}})[_0xc616('0x11')](respondWithResult(_0x5ae13d,null))[_0xc616('0x1b')](handleError(_0x5ae13d,null));};exports[_0xc616('0xdb')]=function(_0x4d9a5c,_0x5872c5){var _0x24aa26={};var _0xd41b52={};var _0xa465f;var _0x38a874;return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x4d9a5c[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x5872c5,null))['then'](function(_0x44222e){if(_0x44222e){_0xa465f=_0x44222e;_0xd41b52[_0xc616('0x57')]=_[_0xc616('0x56')](db['ChatGroup']['rawAttributes']);_0xd41b52[_0xc616('0x43')]=_['keys'](_0x4d9a5c[_0xc616('0x43')]);_0xd41b52['filters']=_[_0xc616('0x58')](_0xd41b52[_0xc616('0x57')],_0xd41b52[_0xc616('0x43')]);_0x24aa26[_0xc616('0x49')]=_[_0xc616('0x58')](_0xd41b52[_0xc616('0x57')],qs[_0xc616('0x59')](_0x4d9a5c[_0xc616('0x43')][_0xc616('0x59')]));_0x24aa26['attributes']=_0x24aa26['attributes'][_0xc616('0x4d')]?_0x24aa26[_0xc616('0x49')]:_0xd41b52[_0xc616('0x57')];_0x24aa26[_0xc616('0xd2')]=qs[_0xc616('0xd3')](_0x4d9a5c[_0xc616('0x43')][_0xc616('0xd3')]);_0x24aa26['where']=qs[_0xc616('0xd1')](_['pick'](_0x4d9a5c[_0xc616('0x43')],_0xd41b52[_0xc616('0xd1')]));if(_0x4d9a5c['query']['filter']){_0x24aa26[_0xc616('0x41')]=_[_0xc616('0x5a')](_0x24aa26['where'],{'$or':_[_0xc616('0x30')](_0x24aa26['attributes'],function(_0xfb091f){var _0x39db74={};_0x39db74[_0xfb091f]={'$like':'%'+_0x4d9a5c[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x39db74;})});}_0x24aa26=_[_0xc616('0x5a')]({},_0x24aa26,_0x4d9a5c[_0xc616('0xda')]);return _0xa465f[_0xc616('0xdb')](_0x24aa26);}})[_0xc616('0x11')](function(_0xfc0098){if(_0xfc0098){_0x38a874=_0xfc0098['length'];if(!_0x4d9a5c[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0x24aa26[_0xc616('0xd8')]=qs[_0xc616('0xd8')](_0x4d9a5c['query'][_0xc616('0xd8')]);_0x24aa26[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x4d9a5c[_0xc616('0x43')][_0xc616('0x21')]);}return _0xa465f[_0xc616('0xdb')](_0x24aa26);}})[_0xc616('0x11')](function(_0x5ecde4){if(_0x5ecde4){return _0x5ecde4?{'count':_0x38a874,'rows':_0x5ecde4}:null;}})[_0xc616('0x11')](respondWithResult(_0x5872c5,null))[_0xc616('0x1b')](handleError(_0x5872c5,null));};exports[_0xc616('0xdc')]=function(_0x390d2d,_0xf9612b){var _0x51786f={'raw':!![],'where':{}};var _0x3057f7={};var _0x4d13eb={'count':0x0,'rows':[]};return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x390d2d['params']['id']}})[_0xc616('0x11')](handleEntityNotFound(_0xf9612b,null))['then'](function(_0x42fbd1){if(_0x42fbd1){_0x3057f7[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0xdd')][_0xc616('0x3a')]);_0x3057f7['query']=_[_0xc616('0x56')](_0x390d2d[_0xc616('0x43')]);_0x3057f7[_0xc616('0xd1')]=_['intersection'](_0x3057f7['model'],_0x3057f7['query']);_0x51786f[_0xc616('0x49')]=_[_0xc616('0x58')](_0x3057f7[_0xc616('0x57')],qs['fields'](_0x390d2d[_0xc616('0x43')][_0xc616('0x59')]));_0x51786f[_0xc616('0x49')]=_0x51786f[_0xc616('0x49')][_0xc616('0x4d')]?_0x51786f[_0xc616('0x49')]:_0x3057f7['model'];if(!_0x390d2d['query'][_0xc616('0xc9')]('nolimit')){_0x51786f[_0xc616('0xd8')]=qs[_0xc616('0xd8')](_0x390d2d[_0xc616('0x43')]['limit']);_0x51786f[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x390d2d[_0xc616('0x43')][_0xc616('0x21')]);}_0x51786f[_0xc616('0xd2')]=qs[_0xc616('0xd3')](_0x390d2d[_0xc616('0x43')][_0xc616('0xd3')]);_0x51786f[_0xc616('0x41')]=qs[_0xc616('0xd1')](_[_0xc616('0xd4')](_0x390d2d[_0xc616('0x43')],_0x3057f7[_0xc616('0xd1')]));_0x51786f[_0xc616('0x41')]['UserId']=_0x42fbd1['id'];if(_0x390d2d[_0xc616('0x43')]['filter']){_0x51786f[_0xc616('0x41')]=_[_0xc616('0x5a')](_0x51786f[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0x51786f[_0xc616('0x49')],function(_0xa03df5){var _0x172d9d={};_0x172d9d[_0xa03df5]={'$like':'%'+_0x390d2d[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x172d9d;})});}_0x51786f=_[_0xc616('0x5a')]({},_0x51786f,_0x390d2d[_0xc616('0xda')]);return db['VoiceRecording'][_0xc616('0x42')]({'where':_0x51786f[_0xc616('0x41')]})[_0xc616('0x11')](function(_0x2f0d01){_0x4d13eb[_0xc616('0x42')]=_0x2f0d01;if(_0x390d2d[_0xc616('0x43')]['includeAll']){_0x51786f[_0xc616('0x45')]=[{'all':!![]}];}return db[_0xc616('0xdd')]['findAll'](_0x51786f);})[_0xc616('0x11')](function(_0x4c3368){_0x4d13eb[_0xc616('0x4b')]=_0x4c3368;return _0x4d13eb;});}})[_0xc616('0x11')](respondWithFilteredResult(_0xf9612b,_0x51786f))[_0xc616('0x1b')](handleError(_0xf9612b,null));};exports['getScreenRecordings']=function(_0xb484ca,_0x4110a0){var _0x3e6bd4={'raw':!![],'where':{}};var _0x30220d={};var _0x448208={'count':0x0,'rows':[]};return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0xb484ca[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x4110a0,null))[_0xc616('0x11')](function(_0x243aa3){if(_0x243aa3){_0x30220d[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0xde')]['rawAttributes']);_0x30220d[_0xc616('0x43')]=_['keys'](_0xb484ca[_0xc616('0x43')]);_0x30220d['filters']=_[_0xc616('0x58')](_0x30220d[_0xc616('0x57')],_0x30220d[_0xc616('0x43')]);_0x3e6bd4[_0xc616('0x49')]=_[_0xc616('0x58')](_0x30220d['model'],qs['fields'](_0xb484ca[_0xc616('0x43')][_0xc616('0x59')]));_0x3e6bd4[_0xc616('0x49')]=_0x3e6bd4[_0xc616('0x49')][_0xc616('0x4d')]?_0x3e6bd4[_0xc616('0x49')]:_0x30220d[_0xc616('0x57')];if(!_0xb484ca[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0x3e6bd4[_0xc616('0xd8')]=qs[_0xc616('0xd8')](_0xb484ca['query'][_0xc616('0xd8')]);_0x3e6bd4[_0xc616('0x21')]=qs[_0xc616('0x21')](_0xb484ca[_0xc616('0x43')][_0xc616('0x21')]);}_0x3e6bd4[_0xc616('0xd2')]=qs['sort'](_0xb484ca[_0xc616('0x43')]['sort']);_0x3e6bd4['where']=qs['filters'](_[_0xc616('0xd4')](_0xb484ca['query'],_0x30220d[_0xc616('0xd1')]));_0x3e6bd4[_0xc616('0x41')]['UserId']=_0x243aa3['id'];if(_0xb484ca[_0xc616('0x43')][_0xc616('0x2e')]){_0x3e6bd4['where']=_['merge'](_0x3e6bd4[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0x3e6bd4[_0xc616('0x49')],function(_0x55defa){var _0x247b81={};_0x247b81[_0x55defa]={'$like':'%'+_0xb484ca['query'][_0xc616('0x2e')]+'%'};return _0x247b81;})});}_0x3e6bd4=_['merge']({},_0x3e6bd4,_0xb484ca[_0xc616('0xda')]);return db[_0xc616('0xde')][_0xc616('0x42')]({'where':_0x3e6bd4['where']})[_0xc616('0x11')](function(_0x2cfc0e){_0x448208[_0xc616('0x42')]=_0x2cfc0e;if(_0xb484ca[_0xc616('0x43')][_0xc616('0x44')]){_0x3e6bd4[_0xc616('0x45')]=[{'all':!![]}];}return db[_0xc616('0xde')][_0xc616('0xa7')](_0x3e6bd4);})[_0xc616('0x11')](function(_0x285660){_0x448208['rows']=_0x285660;return _0x448208;});}})[_0xc616('0x11')](respondWithFilteredResult(_0x4110a0,_0x3e6bd4))[_0xc616('0x1b')](handleError(_0x4110a0,null));};exports[_0xc616('0xdf')]=function(_0x42ed2d,_0x5a2708){var _0x3faadc={};var _0x353f93={};var _0x4665f1;var _0x10f75e;return db['User'][_0xc616('0x93')]({'where':{'id':_0x42ed2d['params']['id']}})['then'](handleEntityNotFound(_0x5a2708,null))[_0xc616('0x11')](function(_0x5aec05){if(_0x5aec05){_0x4665f1=_0x5aec05;_0x353f93['model']=_['keys'](db[_0xc616('0xe0')]['rawAttributes']);_0x353f93[_0xc616('0x43')]=_[_0xc616('0x56')](_0x42ed2d[_0xc616('0x43')]);_0x353f93[_0xc616('0xd1')]=_['intersection'](_0x353f93[_0xc616('0x57')],_0x353f93[_0xc616('0x43')]);_0x3faadc[_0xc616('0x49')]=_['intersection'](_0x353f93[_0xc616('0x57')],qs[_0xc616('0x59')](_0x42ed2d[_0xc616('0x43')][_0xc616('0x59')]));_0x3faadc[_0xc616('0x49')]=_0x3faadc[_0xc616('0x49')]['length']?_0x3faadc['attributes']:_0x353f93['model'];_0x3faadc[_0xc616('0xd2')]=qs[_0xc616('0xd3')](_0x42ed2d[_0xc616('0x43')][_0xc616('0xd3')]);_0x3faadc[_0xc616('0x41')]=qs[_0xc616('0xd1')](_['pick'](_0x42ed2d['query'],_0x353f93[_0xc616('0xd1')]));if(_0x42ed2d[_0xc616('0x43')][_0xc616('0x2e')]){_0x3faadc[_0xc616('0x41')]=_['merge'](_0x3faadc[_0xc616('0x41')],{'$or':_['map'](_0x3faadc[_0xc616('0x49')],function(_0x4f9008){var _0x406e84={};_0x406e84[_0x4f9008]={'$like':'%'+_0x42ed2d[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x406e84;})});}_0x3faadc=_[_0xc616('0x5a')]({},_0x3faadc,_0x42ed2d[_0xc616('0xda')]);return _0x4665f1[_0xc616('0xdf')](_0x3faadc);}})[_0xc616('0x11')](function(_0x1f6ff0){if(_0x1f6ff0){_0x10f75e=_0x1f6ff0[_0xc616('0x4d')];if(!_0x42ed2d[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0x3faadc[_0xc616('0xd8')]=qs['limit'](_0x42ed2d['query'][_0xc616('0xd8')]);_0x3faadc[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x42ed2d[_0xc616('0x43')]['offset']);}return _0x4665f1[_0xc616('0xdf')](_0x3faadc);}})['then'](function(_0x42cdd6){if(_0x42cdd6){return _0x42cdd6?{'count':_0x10f75e,'rows':_0x42cdd6}:null;}})[_0xc616('0x11')](respondWithResult(_0x5a2708,null))['catch'](handleError(_0x5a2708,null));};exports['getOpenchannelInteractions']=function(_0xc337dd,_0x3bc13f){var _0x294dff={};var _0x390ece={};var _0x4cf7be;var _0x5bd214;return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0xc337dd[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x3bc13f,null))['then'](function(_0x3547a4){if(_0x3547a4){_0x4cf7be=_0x3547a4;_0x390ece[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0xe1')]['rawAttributes']);_0x390ece['query']=_[_0xc616('0x56')](_0xc337dd[_0xc616('0x43')]);_0x390ece[_0xc616('0xd1')]=_[_0xc616('0x58')](_0x390ece[_0xc616('0x57')],_0x390ece[_0xc616('0x43')]);_0x294dff[_0xc616('0x49')]=_['intersection'](_0x390ece['model'],qs[_0xc616('0x59')](_0xc337dd[_0xc616('0x43')][_0xc616('0x59')]));_0x294dff[_0xc616('0x49')]=_0x294dff['attributes'][_0xc616('0x4d')]?_0x294dff[_0xc616('0x49')]:_0x390ece[_0xc616('0x57')];_0x294dff['order']=qs['sort'](_0xc337dd['query'][_0xc616('0xd3')]);_0x294dff[_0xc616('0x41')]=qs['filters'](_['pick'](_0xc337dd[_0xc616('0x43')],_0x390ece[_0xc616('0xd1')]));if(_0xc337dd[_0xc616('0x43')][_0xc616('0x2e')]){_0x294dff[_0xc616('0x41')]=_[_0xc616('0x5a')](_0x294dff[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0x294dff[_0xc616('0x49')],function(_0x3ae6be){var _0x299e2b={};_0x299e2b[_0x3ae6be]={'$like':'%'+_0xc337dd[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x299e2b;})});}_0x294dff=_[_0xc616('0x5a')]({},_0x294dff,_0xc337dd['options']);return _0x4cf7be[_0xc616('0xe2')](_0x294dff);}})['then'](function(_0x264213){if(_0x264213){_0x5bd214=_0x264213[_0xc616('0x4d')];if(!_0xc337dd[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0x294dff[_0xc616('0xd8')]=qs[_0xc616('0xd8')](_0xc337dd[_0xc616('0x43')][_0xc616('0xd8')]);_0x294dff[_0xc616('0x21')]=qs[_0xc616('0x21')](_0xc337dd[_0xc616('0x43')][_0xc616('0x21')]);}return _0x4cf7be[_0xc616('0xe2')](_0x294dff);}})[_0xc616('0x11')](function(_0x31fd1c){if(_0x31fd1c){return _0x31fd1c?{'count':_0x5bd214,'rows':_0x31fd1c}:null;}})[_0xc616('0x11')](respondWithResult(_0x3bc13f,null))[_0xc616('0x1b')](handleError(_0x3bc13f,null));};exports[_0xc616('0xe3')]=function(_0x29541c,_0x10ca4c){var _0xe6f30e={'raw':!![],'where':{}};var _0x2b2ca4={};var _0x26766b={'count':0x0,'rows':[]};return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x29541c['params']['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x10ca4c,null))[_0xc616('0x11')](function(_0x359d71){if(_0x359d71){_0x2b2ca4[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0xe4')][_0xc616('0x3a')]);_0x2b2ca4[_0xc616('0x43')]=_[_0xc616('0x56')](_0x29541c[_0xc616('0x43')]);_0x2b2ca4[_0xc616('0xd1')]=_[_0xc616('0x58')](_0x2b2ca4[_0xc616('0x57')],_0x2b2ca4[_0xc616('0x43')]);_0xe6f30e['attributes']=_['intersection'](_0x2b2ca4[_0xc616('0x57')],qs[_0xc616('0x59')](_0x29541c[_0xc616('0x43')]['fields']));_0xe6f30e[_0xc616('0x49')]=_0xe6f30e[_0xc616('0x49')]['length']?_0xe6f30e[_0xc616('0x49')]:_0x2b2ca4[_0xc616('0x57')];if(!_0x29541c[_0xc616('0x43')]['hasOwnProperty'](_0xc616('0xd7'))){_0xe6f30e['limit']=qs[_0xc616('0xd8')](_0x29541c[_0xc616('0x43')]['limit']);_0xe6f30e[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x29541c[_0xc616('0x43')][_0xc616('0x21')]);}_0xe6f30e[_0xc616('0xd2')]=qs[_0xc616('0xd3')](_0x29541c[_0xc616('0x43')][_0xc616('0xd3')]);_0xe6f30e[_0xc616('0x41')]=qs[_0xc616('0xd1')](_['pick'](_0x29541c[_0xc616('0x43')],_0x2b2ca4[_0xc616('0xd1')]));_0xe6f30e[_0xc616('0x41')]['UserId']=_0x359d71['id'];if(_0x29541c[_0xc616('0x43')][_0xc616('0x2e')]){_0xe6f30e[_0xc616('0x41')]=_[_0xc616('0x5a')](_0xe6f30e[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0xe6f30e[_0xc616('0x49')],function(_0x2d9988){var _0x50e804={};_0x50e804[_0x2d9988]={'$like':'%'+_0x29541c[_0xc616('0x43')]['filter']+'%'};return _0x50e804;})});}_0xe6f30e=_[_0xc616('0x5a')]({},_0xe6f30e,_0x29541c[_0xc616('0xda')]);return db[_0xc616('0xe4')][_0xc616('0x42')]({'where':_0xe6f30e[_0xc616('0x41')]})[_0xc616('0x11')](function(_0x20d87f){_0x26766b['count']=_0x20d87f;if(_0x29541c[_0xc616('0x43')][_0xc616('0x44')]){_0xe6f30e['include']=[{'all':!![]}];}return db[_0xc616('0xe4')][_0xc616('0xa7')](_0xe6f30e);})[_0xc616('0x11')](function(_0x51cb7a){_0x26766b[_0xc616('0x4b')]=_0x51cb7a;return _0x26766b;});}})[_0xc616('0x11')](respondWithFilteredResult(_0x10ca4c,_0xe6f30e))[_0xc616('0x1b')](handleError(_0x10ca4c,null));};exports[_0xc616('0xe5')]=function(_0x476202,_0x4cb102){var _0x524360={};var _0x4f7a93={};var _0x5c71b4;var _0xb0b0c7;return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x476202['params']['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x4cb102,null))[_0xc616('0x11')](function(_0x43e055){if(_0x43e055){_0x5c71b4=_0x43e055;_0x4f7a93['model']=_[_0xc616('0x56')](db[_0xc616('0xe6')]['rawAttributes']);_0x4f7a93[_0xc616('0x43')]=_['keys'](_0x476202[_0xc616('0x43')]);_0x4f7a93[_0xc616('0xd1')]=_[_0xc616('0x58')](_0x4f7a93[_0xc616('0x57')],_0x4f7a93[_0xc616('0x43')]);_0x524360[_0xc616('0x49')]=_[_0xc616('0x58')](_0x4f7a93[_0xc616('0x57')],qs[_0xc616('0x59')](_0x476202['query'][_0xc616('0x59')]));_0x524360[_0xc616('0x49')]=_0x524360['attributes'][_0xc616('0x4d')]?_0x524360[_0xc616('0x49')]:_0x4f7a93[_0xc616('0x57')];_0x524360[_0xc616('0xd2')]=qs['sort'](_0x476202[_0xc616('0x43')][_0xc616('0xd3')]);_0x524360['where']=qs[_0xc616('0xd1')](_['pick'](_0x476202['query'],_0x4f7a93[_0xc616('0xd1')]));if(_0x476202[_0xc616('0x43')][_0xc616('0x2e')]){_0x524360[_0xc616('0x41')]=_[_0xc616('0x5a')](_0x524360[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0x524360[_0xc616('0x49')],function(_0x3a03c2){var _0x45b90b={};_0x45b90b[_0x3a03c2]={'$like':'%'+_0x476202[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x45b90b;})});}_0x524360=_['merge']({},_0x524360,_0x476202[_0xc616('0xda')]);return _0x5c71b4[_0xc616('0xe5')](_0x524360);}})['then'](function(_0x20f9ce){if(_0x20f9ce){_0xb0b0c7=_0x20f9ce[_0xc616('0x4d')];if(!_0x476202[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0x524360[_0xc616('0xd8')]=qs['limit'](_0x476202[_0xc616('0x43')]['limit']);_0x524360[_0xc616('0x21')]=qs['offset'](_0x476202[_0xc616('0x43')][_0xc616('0x21')]);}return _0x5c71b4[_0xc616('0xe5')](_0x524360);}})[_0xc616('0x11')](function(_0x4e748e){if(_0x4e748e){return _0x4e748e?{'count':_0xb0b0c7,'rows':_0x4e748e}:null;}})['then'](respondWithResult(_0x4cb102,null))[_0xc616('0x1b')](handleError(_0x4cb102,null));};exports['getFaxInteractions']=function(_0x10cfb4,_0x1ef506){var _0xe57025={};var _0x481e45={};var _0x3d93b0;var _0x2a9d51;return db['User'][_0xc616('0x93')]({'where':{'id':_0x10cfb4[_0xc616('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ef506,null))[_0xc616('0x11')](function(_0x48abbd){if(_0x48abbd){_0x3d93b0=_0x48abbd;_0x481e45[_0xc616('0x57')]=_[_0xc616('0x56')](db['FaxInteraction'][_0xc616('0x3a')]);_0x481e45['query']=_[_0xc616('0x56')](_0x10cfb4[_0xc616('0x43')]);_0x481e45[_0xc616('0xd1')]=_[_0xc616('0x58')](_0x481e45[_0xc616('0x57')],_0x481e45[_0xc616('0x43')]);_0xe57025[_0xc616('0x49')]=_[_0xc616('0x58')](_0x481e45['model'],qs[_0xc616('0x59')](_0x10cfb4[_0xc616('0x43')][_0xc616('0x59')]));_0xe57025[_0xc616('0x49')]=_0xe57025[_0xc616('0x49')][_0xc616('0x4d')]?_0xe57025[_0xc616('0x49')]:_0x481e45[_0xc616('0x57')];_0xe57025['order']=qs['sort'](_0x10cfb4['query'][_0xc616('0xd3')]);_0xe57025['where']=qs[_0xc616('0xd1')](_[_0xc616('0xd4')](_0x10cfb4[_0xc616('0x43')],_0x481e45[_0xc616('0xd1')]));if(_0x10cfb4[_0xc616('0x43')]['filter']){_0xe57025[_0xc616('0x41')]=_['merge'](_0xe57025[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0xe57025['attributes'],function(_0x498d21){var _0x107593={};_0x107593[_0x498d21]={'$like':'%'+_0x10cfb4[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x107593;})});}_0xe57025=_[_0xc616('0x5a')]({},_0xe57025,_0x10cfb4['options']);return _0x3d93b0[_0xc616('0xe7')](_0xe57025);}})['then'](function(_0xaeafd3){if(_0xaeafd3){_0x2a9d51=_0xaeafd3[_0xc616('0x4d')];if(!_0x10cfb4[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0xe57025[_0xc616('0xd8')]=qs[_0xc616('0xd8')](_0x10cfb4[_0xc616('0x43')][_0xc616('0xd8')]);_0xe57025[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x10cfb4['query']['offset']);}return _0x3d93b0[_0xc616('0xe7')](_0xe57025);}})[_0xc616('0x11')](function(_0x4ed9be){if(_0x4ed9be){return _0x4ed9be?{'count':_0x2a9d51,'rows':_0x4ed9be}:null;}})[_0xc616('0x11')](respondWithResult(_0x1ef506,null))['catch'](handleError(_0x1ef506,null));};exports[_0xc616('0xe8')]=function(_0x2b7be2,_0x25be30){var _0x36e88a={};var _0x59c48c={};var _0x461d73;var _0x1b5275;return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x2b7be2[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x25be30,null))['then'](function(_0x5a8e19){if(_0x5a8e19){_0x461d73=_0x5a8e19;_0x59c48c[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0xe9')]['rawAttributes']);_0x59c48c['query']=_['keys'](_0x2b7be2[_0xc616('0x43')]);_0x59c48c[_0xc616('0xd1')]=_['intersection'](_0x59c48c['model'],_0x59c48c[_0xc616('0x43')]);_0x36e88a[_0xc616('0x49')]=_['intersection'](_0x59c48c['model'],qs['fields'](_0x2b7be2['query']['fields']));_0x36e88a[_0xc616('0x49')]=_0x36e88a[_0xc616('0x49')][_0xc616('0x4d')]?_0x36e88a[_0xc616('0x49')]:_0x59c48c['model'];_0x36e88a[_0xc616('0xd2')]=qs[_0xc616('0xd3')](_0x2b7be2[_0xc616('0x43')]['sort']);_0x36e88a[_0xc616('0x41')]=qs['filters'](_[_0xc616('0xd4')](_0x2b7be2['query'],_0x59c48c['filters']));if(_0x2b7be2[_0xc616('0x43')][_0xc616('0x2e')]){_0x36e88a['where']=_[_0xc616('0x5a')](_0x36e88a['where'],{'$or':_[_0xc616('0x30')](_0x36e88a[_0xc616('0x49')],function(_0x1c09a8){var _0x4d70b7={};_0x4d70b7[_0x1c09a8]={'$like':'%'+_0x2b7be2['query'][_0xc616('0x2e')]+'%'};return _0x4d70b7;})});}_0x36e88a=_[_0xc616('0x5a')]({},_0x36e88a,_0x2b7be2[_0xc616('0xda')]);return _0x461d73[_0xc616('0xe8')](_0x36e88a);}})[_0xc616('0x11')](function(_0x2fd112){if(_0x2fd112){_0x1b5275=_0x2fd112[_0xc616('0x4d')];if(!_0x2b7be2[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0x36e88a[_0xc616('0xd8')]=qs['limit'](_0x2b7be2[_0xc616('0x43')]['limit']);_0x36e88a[_0xc616('0x21')]=qs['offset'](_0x2b7be2[_0xc616('0x43')][_0xc616('0x21')]);}return _0x461d73['getWhatsappInteractions'](_0x36e88a);}})[_0xc616('0x11')](function(_0x5a9006){if(_0x5a9006){return _0x5a9006?{'count':_0x1b5275,'rows':_0x5a9006}:null;}})[_0xc616('0x11')](respondWithResult(_0x25be30,null))['catch'](handleError(_0x25be30,null));};exports[_0xc616('0xea')]=function(_0x28e594,_0x4b5bef,_0x119f64){var _0x581448;var _0x491a99;var _0xc5ea75;var _0x2e1d26=!_[_0xc616('0x68')](_0x28e594['params']['id'])?_0x28e594['params']['id']:!_[_0xc616('0x68')](_0x28e594[_0xc616('0x2a')]['id'])?_0x28e594['user']['id']:null;return db[_0xc616('0x39')][_0xc616('0x33')]({'where':{'id':_0x2e1d26,'role':{'$or':['admin',_0xc616('0x2a'),_0xc616('0x26')]}},'attributes':['id',_0xc616('0x36'),_0xc616('0xeb'),_0xc616('0xec'),_0xc616('0x25'),_0xc616('0x62'),_0xc616('0xed')]})[_0xc616('0x11')](function(_0x43fe6e){if(_0x43fe6e){if(_0x43fe6e['role']===_0xc616('0x26')){_0x581448=_0x43fe6e;if(_0x28e594[_0xc616('0x5d')][_0xc616('0xa8')]){_0xc5ea75=util['format']('LOCAL/%s@from-sip/n',_0x581448[_0x28e594['body'][_0xc616('0xa8')]]);}else if(_0x28e594['body']['intrf']){_0xc5ea75=util[_0xc616('0xa9')](_0xc616('0xaa'),_0x28e594[_0xc616('0x5d')]['intrf']);}else{_0xc5ea75=util[_0xc616('0xa9')](_0xc616('0xaa'),_0x581448[_0xc616('0x36')]);}socket['to'](util['format'](_0xc616('0xee'),_0x581448['name']))[_0xc616('0xa4')](_0xc616('0xef'),{'user':{'id':_0x581448['id'],'name':_0x581448['name']},'ip':_0x28e594[_0xc616('0xf0')][_0xc616('0xf1')]||_0x28e594['connection'][_0xc616('0xf2')]||_0x28e594[_0xc616('0xf3')][_0xc616('0xf2')]||_0x28e594[_0xc616('0xf4')]['socket'][_0xc616('0xf2')]});return db[_0xc616('0xaf')][_0xc616('0x28')]({'where':{'membername':_0x581448['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xc616('0x8d'))](_0xc616('0xf5'));}})[_0xc616('0x11')](function(){if(_0x581448){return _0x581448[_0xc616('0xf6')]({'raw':!![]});}})['then'](function(_0x1d91a0){if(_0x581448){if(_0x1d91a0){_0x491a99=_0x1d91a0;if(_0x491a99[_0xc616('0x4d')]){var _0x52eeec=_0x491a99['map'](function(_0x146321){var _0x4616f5={'membername':_0x581448[_0xc616('0x36')],'UserId':_0x581448['id'],'queue_name':_0x146321['name'],'VoiceQueueId':_0x146321['id'],'interface':_0xc5ea75,'paused':_0x581448[_0xc616('0xed')]||![],'penalty':_0x146321[_0xc616('0xf7')]||0x0};return db[_0xc616('0xaf')][_0xc616('0xab')](_0x4616f5);});return Promise[_0xc616('0x5c')](_0x52eeec);}}}})[_0xc616('0x11')](function(){if(_0x581448){return db['MemberReport'][_0xc616('0xa7')]({'where':{'membername':_0x581448['name'],'exitAt':null}});}})['then'](function(_0x294df2){if(_0x581448){var _0x3d6d42=[];_0x294df2['forEach'](function(_0x2ee322){_0x3d6d42[_0xc616('0x4a')](_0x2ee322[_0xc616('0x24')]({'exitAt':moment()[_0xc616('0xa9')](_0xc616('0xf8'))}));});return Promise[_0xc616('0x5c')](_0x3d6d42);}})[_0xc616('0x11')](function(){if(_0x581448){var _0x2b3167=[];var _0x53e600=[];var _0x500537=utils[_0xc616('0xf9')]();var _0x5c8516={'membername':_0x581448[_0xc616('0x36')],'interface':_0xc5ea75,'enterAt':moment()[_0xc616('0xa9')](_0xc616('0xf8')),'role':_0x581448['role'],'internal':_0x581448[_0xc616('0x62')]};_0x500537[_0xc616('0xfa')](function(_0x3370e1){_0x2b3167[_0xc616('0x4a')](_[_0xc616('0x5a')]({'channel':_0x3370e1,'type':_0xc616('0xfb'),'data1':_0x28e594[_0xc616('0x5d')][_0xc616('0xfc')],'data2':_0xc5ea75},_0x5c8516));if(_0x581448[_0xc616('0xed')]){_0x53e600[_0xc616('0x4a')](_['merge']({'channel':_0x3370e1,'type':'PAUSE','data1':_0xc616('0xfd')},_0x5c8516));}});return db[_0xc616('0xfe')][_0xc616('0x86')](_0x2b3167['concat'](_0x53e600),{'individualHooks':!![]});}})[_0xc616('0x11')](function(){if(_0x581448){return _0x581448[_0xc616('0x24')]({'online':!![],'lastLoginAt':moment()[_0xc616('0xa9')](_0xc616('0xf8')),'voicePause':_0x581448[_0xc616('0xed')]||![],'mailPause':_0x581448[_0xc616('0xed')]||![],'chatPause':_0x581448[_0xc616('0xed')]||![],'faxPause':_0x581448[_0xc616('0xed')]||![],'smsPause':_0x581448[_0xc616('0xed')]||![],'openchannelPause':_0x581448['loginInPause']||![],'whatsappPause':_0x581448[_0xc616('0xed')]||![],'pauseType':_0x581448['loginInPause']?_0xc616('0xfd'):null,'interface':_0xc5ea75,'lastPauseAt':moment()[_0xc616('0xa9')](_0xc616('0xf8'))});}})[_0xc616('0x11')](function(_0x2f9a25){if(_0x28e594[_0xc616('0xff')]){return _0x119f64();}else{return Promise['resolve'](_0x2f9a25)[_0xc616('0x11')](respondWithResult(_0x4b5bef,null));}})[_0xc616('0x1b')](handleError(_0x4b5bef,null));};exports[_0xc616('0x100')]=function(_0x257727,_0x413bd5){var _0x15c312;return db[_0xc616('0x39')][_0xc616('0x33')]({'where':{'id':_0x257727[_0xc616('0x54')]['id'],'role':_0xc616('0x26')},'attributes':['id',_0xc616('0x36'),'role']})['then'](handleEntityNotFound(_0x413bd5,null))[_0xc616('0x11')](function(_0xba42c9){if(_0xba42c9){_0x15c312=_0xba42c9;return db['UserVoiceQueueRt'][_0xc616('0x28')]({'where':{'membername':_0x15c312[_0xc616('0x36')]},'individualHooks':!![]});}})['then'](function(){return db[_0xc616('0xfe')][_0xc616('0xa7')]({'where':{'membername':_0x15c312[_0xc616('0x36')],'exitAt':null}});})[_0xc616('0x11')](function(_0xb47625){var _0x3e7a0d=[];_0xb47625[_0xc616('0xfa')](function(_0x105626){_0x3e7a0d['push'](_0x105626['update']({'exitAt':moment()[_0xc616('0xa9')](_0xc616('0xf8'))}));});return Promise['all'](_0x3e7a0d);})[_0xc616('0x11')](function(){return _0x15c312['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xc616('0x11')](respondWithResult(_0x413bd5,null))[_0xc616('0x1b')](handleError(_0x413bd5,null));};exports[_0xc616('0x101')]=function(_0x27c912,_0x149703){var _0x321110;return db[_0xc616('0xaf')][_0xc616('0x24')]({'paused':0x1},{'where':{'UserId':_0x27c912['params']['id']},'individualHooks':!![]})[_0xc616('0x11')](function(){return db['User'][_0xc616('0x33')]({'where':{'id':_0x27c912[_0xc616('0x54')]['id'],'role':_0xc616('0x26')},'attributes':['id','name','role',_0xc616('0x62'),'interface',_0xc616('0x9b')]});})[_0xc616('0x11')](handleEntityNotFound(_0x149703,null))[_0xc616('0x11')](function(_0x3613fa){if(_0x3613fa){_0x321110=_0x3613fa;return respondWithRpcPromise(_0xc616('0x102'),'pause',{'id':_0x321110['id'],'name':_0x321110[_0xc616('0x36')],'pause':!![]});}})[_0xc616('0x11')](function(){if(_0x321110){return db[_0xc616('0xfe')][_0xc616('0xa7')]({'where':{'membername':_0x321110[_0xc616('0x36')],'type':_0xc616('0x103'),'exitAt':null}});}})[_0xc616('0x11')](function(_0x55342e){if(_0x55342e[_0xc616('0x4d')]){var _0x2713a1=moment()[_0xc616('0xa9')](_0xc616('0xf8'));for(var _0x1421a7=0x0,_0x416095=_0x55342e[_0xc616('0x4d')];_0x1421a7<_0x416095;_0x1421a7++){_0x55342e[_0x1421a7][_0xc616('0x104')]({'exitAt':_0x2713a1});}}})[_0xc616('0x11')](function(){var _0x546dbc=[];var _0x389acf=utils['getChannels']();_0x389acf[_0xc616('0xfa')](function(_0x1b5a96){_0x546dbc[_0xc616('0x4a')]({'channel':_0x1b5a96,'membername':_0x321110['name'],'interface':_[_0xc616('0x68')](_0x321110[_0xc616('0xa8')])?util[_0xc616('0xa9')](_0xc616('0xaa'),_0x321110[_0xc616('0x36')]):_0x321110[_0xc616('0xa8')],'type':_0xc616('0x103'),'enterAt':moment()['format'](_0xc616('0xf8')),'data1':_0x27c912[_0xc616('0x5d')][_0xc616('0x3c')]||_0xc616('0x105'),'role':_0x321110['role'],'internal':_0x321110[_0xc616('0x62')]});});return db[_0xc616('0xfe')][_0xc616('0x86')](_0x546dbc,{'individualHooks':!![]});})[_0xc616('0x11')](function(){return _0x321110[_0xc616('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x27c912[_0xc616('0x5d')][_0xc616('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xc616('0xa9')](_0xc616('0xf8'))});})[_0xc616('0x11')](respondWithResult(_0x149703,null))[_0xc616('0x1b')](handleError(_0x149703,null));};exports[_0xc616('0x106')]=function(_0x16997a,_0x480287){if(_0x16997a['body'][_0xc616('0x9a')]&&!utils[_0xc616('0xad')](_0x16997a[_0xc616('0x5d')][_0xc616('0x9a')])){throw new APIBadRequestError(util[_0xc616('0xa9')](_0xc616('0x107'),_0x16997a[_0xc616('0x5d')][_0xc616('0x9a')]));}return db[_0xc616('0x39')][_0xc616('0x33')]({'where':{'id':_0x16997a[_0xc616('0x54')]['id']},'attributes':['id',_0xc616('0x36'),_0xc616('0x25'),'internal',_0xc616('0xa8'),_0xc616('0x9b'),_0xc616('0x9c'),_0xc616('0x108'),'chatPause',_0xc616('0x109'),'openchannelPause','smsPause','whatsappPause',_0xc616('0x10a'),_0xc616('0x10b')]})[_0xc616('0x11')](function(_0x5237f4){if(!_0x5237f4){throw new APINotFoundError(util['format'](_0xc616('0xc8'),_0x16997a[_0xc616('0x54')]['id']));}return _0x5237f4[_0xc616('0x106')](_0x16997a['body'][_0xc616('0x9a')]);})[_0xc616('0x11')](respondWithResult(_0x480287,null))[_0xc616('0x1b')](APIHandleError(_0x480287));};exports[_0xc616('0x10c')]=function(_0x4b4daf,_0x294727){var _0x508d8d={};var _0x7c9cdc={};var _0xc9c043;var _0x233667;return db['User'][_0xc616('0x93')]({'where':{'id':_0x4b4daf[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x294727,null))[_0xc616('0x11')](function(_0x4f7020){if(_0x4f7020){_0xc9c043=_0x4f7020;_0x7c9cdc[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0x10d')]['rawAttributes']);_0x7c9cdc['query']=_[_0xc616('0x56')](_0x4b4daf['query']);_0x7c9cdc[_0xc616('0xd1')]=_[_0xc616('0x58')](_0x7c9cdc[_0xc616('0x57')],_0x7c9cdc[_0xc616('0x43')]);_0x508d8d['attributes']=_[_0xc616('0x58')](_0x7c9cdc['model'],qs['fields'](_0x4b4daf[_0xc616('0x43')]['fields']));_0x508d8d['attributes']=_0x508d8d[_0xc616('0x49')]['length']?_0x508d8d[_0xc616('0x49')]:_0x7c9cdc[_0xc616('0x57')];_0x508d8d[_0xc616('0xd2')]=qs['sort'](_0x4b4daf[_0xc616('0x43')][_0xc616('0xd3')]);_0x508d8d[_0xc616('0x41')]=qs['filters'](_[_0xc616('0xd4')](_0x4b4daf[_0xc616('0x43')],_0x7c9cdc[_0xc616('0xd1')]));if(_0x4b4daf[_0xc616('0x43')][_0xc616('0x2e')]){_0x508d8d[_0xc616('0x41')]=_['merge'](_0x508d8d[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0x508d8d[_0xc616('0x49')],function(_0x2fdf82){var _0x2237eb={};_0x2237eb[_0x2fdf82]={'$like':'%'+_0x4b4daf[_0xc616('0x43')]['filter']+'%'};return _0x2237eb;})});}_0x508d8d=_[_0xc616('0x5a')]({},_0x508d8d,_0x4b4daf[_0xc616('0xda')]);return _0xc9c043[_0xc616('0x10c')](_0x508d8d);}})[_0xc616('0x11')](function(_0x27c7bb){if(_0x27c7bb){_0x233667=_0x27c7bb['length'];if(!_0x4b4daf[_0xc616('0x43')][_0xc616('0xc9')](_0xc616('0xd7'))){_0x508d8d['limit']=qs[_0xc616('0xd8')](_0x4b4daf[_0xc616('0x43')][_0xc616('0xd8')]);_0x508d8d[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x4b4daf[_0xc616('0x43')][_0xc616('0x21')]);}return _0xc9c043[_0xc616('0x10c')](_0x508d8d);}})[_0xc616('0x11')](function(_0x51db43){if(_0x51db43){return _0x51db43?{'count':_0x233667,'rows':_0x51db43}:null;}})[_0xc616('0x11')](respondWithResult(_0x294727,null))[_0xc616('0x1b')](handleError(_0x294727,null));};exports['addTeams']=function(_0x1ae3c7,_0x33ed5f){var _0x2c177b=_0x1ae3c7[_0xc616('0x54')]['id'];var _0x14ea34=_0x1ae3c7['body']?_0x1ae3c7[_0xc616('0x5d')]['ids']:null;var _0x1ec7e6=[];return Promise[_0xc616('0x10e')]()[_0xc616('0x11')](function(){if(!_0x14ea34)throw new APIBadRequestError(_0xc616('0x10f'));})[_0xc616('0x11')](function(){return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x2c177b}});})[_0xc616('0x11')](function(_0x54873c){if(!_0x54873c)throw new APINotFoundError(util[_0xc616('0xa9')](_0xc616('0xc8'),_0x1ae3c7[_0xc616('0x54')]['id']));return db[_0xc616('0x6a')][_0xc616('0x110')](function(_0xb50eff){return _0x54873c['addTeams'](_0x14ea34,{'transaction':_0xb50eff})[_0xc616('0x11')](function(){return db['Team'][_0xc616('0xa7')]({'where':{'id':{'$in':_0x14ea34}}});})[_0xc616('0x11')](function(_0x3961c1){var _0x5cfc19=_[_0xc616('0x30')](_0x3961c1,function(_0x243f02){return _0x243f02[_0xc616('0x111')]();});return Promise[_0xc616('0x5c')](_0x5cfc19);})[_0xc616('0x11')](function(_0x5c3f8c){_0x1ec7e6=_[_0xc616('0x112')](_0x5c3f8c);var _0x4c7922=_['map'](_0x1ec7e6,function(_0x34a654){return _0x34a654['addAgent'](_0x54873c['id'],{'transaction':_0xb50eff});});return Promise[_0xc616('0x5c')](_0x4c7922);})['then'](function(){if(!_0x54873c[_0xc616('0x9b')])return;var _0x34d53c=_[_0xc616('0x2e')](_0x1ec7e6,function(_0x3f3470){return _0x3f3470[_0xc616('0x113')](_0xc616('0x9a'))===_0xc616('0x114');});var _0x3f89f2=_[_0xc616('0x30')](_0x34d53c,function(_0x513bfd){return db[_0xc616('0xaf')][_0xc616('0xab')]({'membername':_0x54873c['name'],'UserId':_0x54873c['id'],'queue_name':_0x513bfd[_0xc616('0x36')],'VoiceQueueId':_0x513bfd['id'],'interface':_[_0xc616('0x68')](_0x54873c[_0xc616('0xa8')])?util[_0xc616('0xa9')](_0xc616('0xaa'),_0x54873c['name']):_0x54873c[_0xc616('0xa8')],'paused':_0x54873c['voicePause']||![],'penalty':_0x54873c[_0xc616('0xa0')]},{'transaction':_0xb50eff});});return Promise['all'](_0x3f89f2);})[_0xc616('0x11')](function(){return db[_0xc616('0x115')]['findAll']({'where':{'teamId':{'$in':_0x14ea34}}});})[_0xc616('0x11')](function(_0x32b2d3){var _0x261632=_[_0xc616('0x30')](_0x32b2d3,function(_0xe2b80c){return db['UserVoicePrefix'][_0xc616('0x7d')]({'UserId':_0x54873c['id'],'VoicePrefixId':_0xe2b80c['VoicePrefixId']},{'transaction':_0xb50eff});});return Promise[_0xc616('0x5c')](_0x261632);});});})[_0xc616('0x11')](function(){for(var _0x478884=0x0;_0x478884<_0x1ec7e6[_0xc616('0x4d')];_0x478884++){var _0x5a2992=_0x1ec7e6[_0x478884][_0xc616('0x113')](_0xc616('0x9a'));var _0x1856d1=_0x5a2992+'QueueId';socket[_0xc616('0xa4')]('user'+_0x5a2992+_0xc616('0xa5'),{'UserId':_0x2c177b,['queueField']:_0x1ec7e6[_0x478884]['id']});}})[_0xc616('0x11')](respondWithStatusCode(_0x33ed5f,null))['catch'](APIHandleError(_0x33ed5f));};exports[_0xc616('0x116')]=function(_0x5de0fa,_0x4f8b4e){var _0x16e818=_0x5de0fa['params']['id'];var _0x4187c8=null;if(_0x5de0fa[_0xc616('0x43')][_0xc616('0x60')]){_0x4187c8=_[_0xc616('0x117')](_0x5de0fa[_0xc616('0x43')][_0xc616('0x60')])?_0x5de0fa[_0xc616('0x43')][_0xc616('0x60')]:[_0x5de0fa[_0xc616('0x43')][_0xc616('0x60')]];}var _0x4aaf0a=[];return Promise[_0xc616('0x10e')]()[_0xc616('0x11')](function(){if(!_0x4187c8)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xc616('0x39')]['findOne']({'where':{'id':_0x16e818}});})[_0xc616('0x11')](function(_0x5a9b63){if(!_0x5a9b63)throw new APINotFoundError(util[_0xc616('0xa9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5de0fa[_0xc616('0x54')]['id']));return db[_0xc616('0x6a')]['transaction'](function(_0x392dcd){return _0x5a9b63[_0xc616('0x116')](_0x4187c8,{'transaction':_0x392dcd})['then'](function(){return db['Team'][_0xc616('0xa7')]({'where':{'id':{'$in':_0x4187c8}}});})['then'](function(_0x1378ad){var _0x168292=_[_0xc616('0x30')](_0x1378ad,function(_0x30eb72){return _0x30eb72['getAssociatedQueues']();});return Promise[_0xc616('0x5c')](_0x168292);})['then'](function(_0x3bf483){_0x4aaf0a=_[_0xc616('0x112')](_0x3bf483);var _0x350cc5=_[_0xc616('0x30')](_0x4aaf0a,function(_0x2b3428){return _0x2b3428['removeAgent'](_0x5a9b63['id'],{'transaction':_0x392dcd});});return Promise[_0xc616('0x5c')](_0x350cc5);})[_0xc616('0x11')](function(){if(!_0x5a9b63['online'])return;var _0x8cb623=_['filter'](_0x4aaf0a,function(_0x192107){return _0x192107[_0xc616('0x113')](_0xc616('0x9a'))==='Voice';});var _0x5f4eba=_[_0xc616('0x30')](_0x8cb623,function(_0x371d39){return db[_0xc616('0xaf')][_0xc616('0x28')]({'where':{'VoiceQueueId':_0x371d39['id'],'UserId':_0x5a9b63['id']},'transaction':_0x392dcd});});return Promise[_0xc616('0x5c')](_0x5f4eba);})[_0xc616('0x11')](function(){return db[_0xc616('0x115')]['findAll']({'where':{'teamId':{'$in':_0x4187c8}}});})[_0xc616('0x11')](function(_0x571474){var _0x2dd282=_[_0xc616('0x30')](_0x571474,function(_0x40eab8){return db['UserVoicePrefix'][_0xc616('0x28')]({'where':{'UserId':_0x5a9b63['id'],'VoicePrefixId':_0x40eab8[_0xc616('0x118')]}},{'transaction':_0x392dcd});});return Promise[_0xc616('0x5c')](_0x2dd282);});});})[_0xc616('0x11')](function(){for(var _0x34246b=0x0;_0x34246b<_0x4aaf0a[_0xc616('0x4d')];_0x34246b++){var _0x249d38=_0x4aaf0a[_0x34246b]['getDataValue'](_0xc616('0x9a'));var _0x27eea1=_0x249d38+_0xc616('0xa3');socket[_0xc616('0xa4')](_0xc616('0x2a')+_0x249d38+_0xc616('0xae'),{'UserId':_0x16e818,['queueField']:_0x4aaf0a[_0x34246b]['id']});}})[_0xc616('0x11')](respondWithStatusCode(_0x4f8b4e,null))[_0xc616('0x1b')](APIHandleError(_0x4f8b4e));};exports[_0xc616('0x119')]=function(_0x30895a,_0x15608e){var _0x10ef31={};var _0xdae945={};var _0x35b083;var _0x4841a4;return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x30895a[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x15608e,null))['then'](function(_0x8a9177){if(_0x8a9177){_0x35b083=_0x8a9177;_0xdae945['model']=_[_0xc616('0x56')](db[_0xc616('0xca')][_0xc616('0x3a')]);_0xdae945[_0xc616('0x43')]=_[_0xc616('0x56')](_0x30895a[_0xc616('0x43')]);_0xdae945[_0xc616('0xd1')]=_[_0xc616('0x58')](_0xdae945[_0xc616('0x57')],_0xdae945[_0xc616('0x43')]);_0x10ef31['attributes']=_['intersection'](_0xdae945[_0xc616('0x57')],qs[_0xc616('0x59')](_0x30895a[_0xc616('0x43')][_0xc616('0x59')]));_0x10ef31['attributes']=_0x10ef31['attributes'][_0xc616('0x4d')]?_0x10ef31[_0xc616('0x49')]:_0xdae945[_0xc616('0x57')];_0x10ef31['order']=qs[_0xc616('0xd3')](_0x30895a[_0xc616('0x43')][_0xc616('0xd3')]);_0x10ef31[_0xc616('0x41')]=qs['filters'](_[_0xc616('0xd4')](_0x30895a['query'],_0xdae945[_0xc616('0xd1')]));if(_0x30895a[_0xc616('0x43')][_0xc616('0x2e')]){_0x10ef31[_0xc616('0x41')]=_[_0xc616('0x5a')](_0x10ef31[_0xc616('0x41')],{'$or':_[_0xc616('0x30')](_0x10ef31[_0xc616('0x49')],function(_0x1c7204){var _0x1d220e={};_0x1d220e[_0x1c7204]={'$like':'%'+_0x30895a[_0xc616('0x43')]['filter']+'%'};return _0x1d220e;})});}_0x10ef31=_[_0xc616('0x5a')]({},_0x10ef31,_0x30895a[_0xc616('0xda')]);return _0x35b083[_0xc616('0x119')](_0x10ef31);}})[_0xc616('0x11')](function(_0x55de01){if(_0x55de01){_0x4841a4=_0x55de01[_0xc616('0x4d')];if(!_0x30895a['query'][_0xc616('0xc9')](_0xc616('0xd7'))){_0x10ef31['limit']=qs['limit'](_0x30895a[_0xc616('0x43')]['limit']);_0x10ef31[_0xc616('0x21')]=qs[_0xc616('0x21')](_0x30895a['query'][_0xc616('0x21')]);}return _0x35b083[_0xc616('0x119')](_0x10ef31);}})['then'](function(_0x46d0ff){if(_0x46d0ff){return _0x46d0ff?{'count':_0x4841a4,'rows':_0x46d0ff}:null;}})[_0xc616('0x11')](respondWithResult(_0x15608e,null))[_0xc616('0x1b')](handleError(_0x15608e,null));};exports[_0xc616('0x11a')]=function(_0x361b4f,_0x30a369){var _0x25409a={};var _0x51c977={};var _0x5843bd;return db[_0xc616('0x39')][_0xc616('0x93')]({'where':{'id':_0x361b4f[_0xc616('0x54')]['id']}})[_0xc616('0x11')](handleEntityNotFound(_0x30a369,null))[_0xc616('0x11')](function(_0x446cbb){if(_0x446cbb){_0x5843bd=_0x446cbb;_0x51c977[_0xc616('0x57')]=_[_0xc616('0x56')](db[_0xc616('0x39')][_0xc616('0x3a')]);_0x51c977[_0xc616('0x43')]=_[_0xc616('0x56')](_0x361b4f['query']);_0x51c977['filters']=_[_0xc616('0x58')](_0x51c977[_0xc616('0x57')],_0x51c977['query']);_0x25409a['attributes']=_[_0xc616('0x58')](_0x51c977['model'],qs[_0xc616('0x59')](_0x361b4f['query']['fields']));_0x25409a['attributes']=_0x25409a[_0xc616('0x49')][_0xc616('0x4d')]?_0x25409a[_0xc616('0x49')]:_0x51c977[_0xc616('0x57')];_0x25409a[_0xc616('0xd2')]=qs[_0xc616('0xd3')](_0x361b4f[_0xc616('0x43')]['sort']);_0x25409a[_0xc616('0x41')]=qs[_0xc616('0xd1')](_[_0xc616('0xd4')](_0x361b4f['query'],_0x51c977['filters']));if(_0x361b4f[_0xc616('0x43')]['filter']){_0x25409a['where']=_[_0xc616('0x5a')](_0x25409a['where'],{'$or':_[_0xc616('0x30')](_0x25409a[_0xc616('0x49')],function(_0x5d174b){var _0x338fdc={};_0x338fdc[_0x5d174b]={'$like':'%'+_0x361b4f[_0xc616('0x43')][_0xc616('0x2e')]+'%'};return _0x338fdc;})});}_0x25409a[_0xc616('0x57')]=db[_0xc616('0x39')];_0x25409a['as']=_0xc616('0x2b');_0x25409a=_[_0xc616('0x5a')]({},_0x25409a,_0x361b4f['options']);return _0x5843bd['getVoiceQueues']({'include':[_0x25409a]});}})['then'](function(_0x10e98c){if(_0x10e98c){var _0x47a3ad={},_0x54c2bc=[];for(var _0x3bafdf=0x0;_0x3bafdf<_0x10e98c[_0xc616('0x4d')];_0x3bafdf+=0x1){for(var _0x13c3ed=0x0,_0x50d869;_0x13c3ed<_0x10e98c[_0x3bafdf][_0xc616('0x2b')][_0xc616('0x4d')];_0x13c3ed+=0x1){_0x50d869=_0x10e98c[_0x3bafdf][_0xc616('0x2b')][_0x13c3ed][_0xc616('0xd5')]({'plain':!![]});_0x47a3ad[_0x50d869['id']]=_0x50d869;}}_0x47a3ad=_[_0xc616('0x11b')](_0x47a3ad);for(var _0x365c9c=qs[_0xc616('0x21')](_0x361b4f[_0xc616('0x43')][_0xc616('0x21')]);_0x365c9c<_0x47a3ad[_0xc616('0x4d')]&&_0x54c2bc[_0xc616('0x4d')]=_0xf7806f[_0x588e('0x51')]){throw new Error(_0x588e('0x52'));}})[_0x588e('0x1e')](function(){if(_0x59f244){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x59f244['name']},'individualHooks':!![]});}})[_0x588e('0x1e')](function(){if(_0x59f244){return _0x59f244[_0x588e('0x53')]({'raw':!![]});}})[_0x588e('0x1e')](function(_0x49ad92){if(_0x59f244){if(_0x49ad92){var _0x16b2e5=[];_0x59629e=_0x49ad92;if(_0x59629e[_0x588e('0x2b')]){for(var _0x392b58=0x0;_0x392b58<_0x59629e[_0x588e('0x2b')];_0x392b58++){_0x16b2e5[_0x588e('0x31')](db[_0x588e('0x28')][_0x588e('0x54')]({'membername':_0x59f244[_0x588e('0x32')],'UserId':_0x59f244['id'],'queue_name':_0x59629e[_0x392b58][_0x588e('0x32')],'VoiceQueueId':_0x59629e[_0x392b58]['id'],'interface':_0x1fbc67,'paused':_0x59f244[_0x588e('0x4d')]||![],'penalty':_0x59629e[_0x392b58][_0x588e('0x55')]||0x0}));}return BPromise['all'](_0x16b2e5);}}}})[_0x588e('0x1e')](function(){if(_0x59f244){return db[_0x588e('0x29')][_0x588e('0x4c')]({'where':{'membername':_0x59f244['name'],'exitAt':null}});}})['then'](function(_0x1076fe){if(_0x59f244){if(_0x1076fe&&_0x1076fe['length']){var _0x156872=[];_0x1076fe['forEach'](function(_0xf69154){_0x156872[_0x588e('0x31')](_0xf69154[_0x588e('0x39')]({'exitAt':moment()[_0x588e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x588e('0x56')](_0x156872);}}})[_0x588e('0x1e')](function(){if(_0x59f244){var _0x5b78e6=[];var _0x27adf1=[];var _0x34aad1=utils[_0x588e('0x2f')]();var _0x27863f={'membername':_0x59f244['name'],'interface':_0x1fbc67,'enterAt':moment()['format'](_0x588e('0x2d')),'role':_0x59f244[_0x588e('0x23')],'internal':_0x59f244[_0x588e('0x24')]};_0x34aad1['forEach'](function(_0x37e304){_0x5b78e6[_0x588e('0x31')](_['merge']({'channel':_0x37e304,'type':_0x588e('0x57'),'data1':_0x588e('0x58'),'data2':_0x1fbc67},_0x27863f));if(_0x59f244[_0x588e('0x4d')]){_0x27adf1[_0x588e('0x31')](_[_0x588e('0x59')]({'channel':_0x37e304,'type':_0x588e('0x2a'),'data1':_0x588e('0x5a')},_0x27863f));}});return db[_0x588e('0x29')][_0x588e('0x38')](_0x5b78e6[_0x588e('0x5b')](_0x27adf1),{'individualHooks':!![]});}})[_0x588e('0x1e')](function(){if(_0x59f244){return _0x59f244[_0x588e('0x39')]({'online':!![],'lastLoginAt':moment()[_0x588e('0x2c')](_0x588e('0x2d')),'voicePause':_0x59f244[_0x588e('0x4d')]||![],'mailPause':_0x59f244[_0x588e('0x4d')]||![],'chatPause':_0x59f244[_0x588e('0x4d')]||![],'faxPause':_0x59f244['loginInPause']||![],'smsPause':_0x59f244[_0x588e('0x4d')]||![],'openchannelPause':_0x59f244['loginInPause']||![],'pauseType':_0x59f244[_0x588e('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x588e('0x2d')),'interface':_0x1fbc67});}})['then'](function(_0x18ea27){_0x53e305(_0x18ea27);})[_0x588e('0x20')](function(_0x113f9d){_0x3c4fc3(_0x3cc065['error'](0x1f4,_0x113f9d['message']));});});}; \ No newline at end of file +var _0xc9ac=['include','map','model','then','stringify','message','error','ShowUser','debug','PauseUser','find','name','role','internal','format','User\x20with\x20id\x20%s\x20not\x20found','params','MemberReport','PAUSE','length','updateAttributes','getChannels','push','isNil','SIP/%s','interface','type','DEFAULT\x20PAUSE','body','bulkCreate','catch','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','unpause','system','UserVoiceQueueRt','destroy','forEach','update','YYYY-MM-DD\x20HH:mm:ss','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','redis','defaults','localhost','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit'];(function(_0x93093d,_0x447122){var _0x2580d5=function(_0x2dd1a2){while(--_0x2dd1a2){_0x93093d['push'](_0x93093d['shift']());}};_0x2580d5(++_0x447122);}(_0xc9ac,0xeb));var _0xcc9a=function(_0x3c0713,_0x118272){_0x3c0713=_0x3c0713-0x0;var _0xda81d3=_0xc9ac[_0x3c0713];return _0xda81d3;};'use strict';var _=require(_0xcc9a('0x0'));var util=require(_0xcc9a('0x1'));var moment=require(_0xcc9a('0x2'));var BPromise=require(_0xcc9a('0x3'));var Redis=require('ioredis');var db=require(_0xcc9a('0x4'))['db'];var utils=require(_0xcc9a('0x5'));var logger=require('../../config/logger')(_0xcc9a('0x6'));var config=require('../../config/environment');config[_0xcc9a('0x7')]=_[_0xcc9a('0x8')](config[_0xcc9a('0x7')],{'host':_0xcc9a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc9a('0x7')]));require(_0xcc9a('0xa'))[_0xcc9a('0xb')](socket);exports[_0xcc9a('0xc')]=function(_0x2ff6b7){var _0x18a5d7=this;return new Promise(function(_0x441ce2,_0x1a0226){return db[_0xcc9a('0xd')][_0xcc9a('0xe')]({'raw':_0x2ff6b7[_0xcc9a('0xf')]?_0x2ff6b7[_0xcc9a('0xf')][_0xcc9a('0x10')]===undefined?!![]:![]:!![],'where':_0x2ff6b7['options']?_0x2ff6b7[_0xcc9a('0xf')][_0xcc9a('0x11')]||null:null,'attributes':_0x2ff6b7['options']?_0x2ff6b7[_0xcc9a('0xf')][_0xcc9a('0x12')]||null:null,'limit':_0x2ff6b7[_0xcc9a('0xf')]?_0x2ff6b7[_0xcc9a('0xf')][_0xcc9a('0x13')]||null:null,'include':_0x2ff6b7[_0xcc9a('0xf')]?_0x2ff6b7['options'][_0xcc9a('0x14')]?_[_0xcc9a('0x15')](_0x2ff6b7[_0xcc9a('0xf')][_0xcc9a('0x14')],function(_0x3dc4cd){return{'model':db[_0x3dc4cd['model']],'as':_0x3dc4cd['as'],'attributes':_0x3dc4cd[_0xcc9a('0x12')],'include':_0x3dc4cd['include']?_[_0xcc9a('0x15')](_0x3dc4cd[_0xcc9a('0x14')],function(_0x5df9e1){return{'model':db[_0x5df9e1[_0xcc9a('0x16')]],'as':_0x5df9e1['as'],'attributes':_0x5df9e1['attributes'],'include':_0x5df9e1[_0xcc9a('0x14')]?_[_0xcc9a('0x15')](_0x5df9e1[_0xcc9a('0x14')],function(_0x3f2d85){return{'model':db[_0x3f2d85[_0xcc9a('0x16')]],'as':_0x3f2d85['as'],'attributes':_0x3f2d85[_0xcc9a('0x12')]};}):[]};}):[]};}):[]:[]})[_0xcc9a('0x17')](function(_0x47d60b){logger['info']('GetUser',_0x2ff6b7);logger['debug']('GetUser',_0x2ff6b7,JSON[_0xcc9a('0x18')](_0x47d60b));_0x441ce2(_0x47d60b);})['catch'](function(_0x5e23ab){logger['error'](_0xcc9a('0xc'),_0x5e23ab[_0xcc9a('0x19')],_0x2ff6b7);_0x1a0226(_0x18a5d7[_0xcc9a('0x1a')](0x1f4,_0x5e23ab[_0xcc9a('0x19')]));});});};exports[_0xcc9a('0x1b')]=function(_0x7f0837){var _0x440f1a=this;return new Promise(function(_0x4b0e0d,_0x29a869){return db[_0xcc9a('0xd')]['find']({'raw':_0x7f0837[_0xcc9a('0xf')]?_0x7f0837[_0xcc9a('0xf')][_0xcc9a('0x10')]===undefined?!![]:![]:!![],'where':_0x7f0837[_0xcc9a('0xf')]?_0x7f0837['options']['where']||null:null,'attributes':_0x7f0837[_0xcc9a('0xf')]?_0x7f0837[_0xcc9a('0xf')]['attributes']||null:null,'include':_0x7f0837['options']?_0x7f0837[_0xcc9a('0xf')][_0xcc9a('0x14')]?_[_0xcc9a('0x15')](_0x7f0837['options'][_0xcc9a('0x14')],function(_0x105775){return{'model':db[_0x105775[_0xcc9a('0x16')]],'as':_0x105775['as'],'attributes':_0x105775[_0xcc9a('0x12')],'include':_0x105775[_0xcc9a('0x14')]?_[_0xcc9a('0x15')](_0x105775['include'],function(_0x3f6a76){return{'model':db[_0x3f6a76[_0xcc9a('0x16')]],'as':_0x3f6a76['as'],'attributes':_0x3f6a76[_0xcc9a('0x12')],'include':_0x3f6a76[_0xcc9a('0x14')]?_['map'](_0x3f6a76[_0xcc9a('0x14')],function(_0x70f1a4){return{'model':db[_0x70f1a4['model']],'as':_0x70f1a4['as'],'attributes':_0x70f1a4[_0xcc9a('0x12')]};}):[]};}):[]};}):[]:[]})[_0xcc9a('0x17')](function(_0x34066d){logger['info'](_0xcc9a('0x1b'),_0x7f0837);logger[_0xcc9a('0x1c')](_0xcc9a('0x1b'),_0x7f0837,JSON[_0xcc9a('0x18')](_0x34066d));_0x4b0e0d(_0x34066d);})['catch'](function(_0x2db4c5){logger[_0xcc9a('0x1a')](_0xcc9a('0x1b'),_0x2db4c5['message'],_0x7f0837);_0x29a869(_0x440f1a['error'](0x1f4,_0x2db4c5[_0xcc9a('0x19')]));});});};exports[_0xcc9a('0x1d')]=function(_0x49fced){var _0x3e9146;return db[_0xcc9a('0xd')][_0xcc9a('0x1e')]({'where':_0x49fced[_0xcc9a('0xf')][_0xcc9a('0x11')]||{},'attributes':['id',_0xcc9a('0x1f'),_0xcc9a('0x20'),_0xcc9a('0x21'),'interface']})[_0xcc9a('0x17')](function(_0x3113de){if(!_0x3113de){throw new Error(util[_0xcc9a('0x22')](_0xcc9a('0x23'),_0x49fced[_0xcc9a('0x24')]['id']));}_0x3e9146=_0x3113de;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x3e9146['id']},'individualHooks':!![]});})[_0xcc9a('0x17')](function(){return db[_0xcc9a('0x25')][_0xcc9a('0xe')]({'where':{'membername':_0x3e9146[_0xcc9a('0x1f')],'type':_0xcc9a('0x26'),'exitAt':null}});})[_0xcc9a('0x17')](function(_0x3e5f75){if(_0x3e5f75&&_0x3e5f75['length']){var _0x4c4d02=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3072c1=0x0,_0xf9ca91=_0x3e5f75[_0xcc9a('0x27')];_0x3072c1<_0xf9ca91;_0x3072c1++){_0x3e5f75[_0x3072c1][_0xcc9a('0x28')]({'exitAt':_0x4c4d02});}}})[_0xcc9a('0x17')](function(){var _0x1f7a22=[];var _0x504a47=utils[_0xcc9a('0x29')]();_0x504a47['forEach'](function(_0x4728c6){_0x1f7a22[_0xcc9a('0x2a')]({'channel':_0x4728c6,'membername':_0x3e9146[_0xcc9a('0x1f')],'interface':_[_0xcc9a('0x2b')](_0x3e9146['interface'])?util['format'](_0xcc9a('0x2c'),_0x3e9146[_0xcc9a('0x1f')]):_0x3e9146[_0xcc9a('0x2d')],'type':_0xcc9a('0x26'),'enterAt':moment()[_0xcc9a('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x49fced['body'][_0xcc9a('0x2e')]||_0xcc9a('0x2f'),'role':_0x3e9146[_0xcc9a('0x20')],'internal':_0x3e9146[_0xcc9a('0x21')],'uniqueid':_0x49fced[_0xcc9a('0x30')]['uniqueid']||null});});return db['MemberReport'][_0xcc9a('0x31')](_0x1f7a22,{'individualHooks':!![]});})[_0xcc9a('0x17')](function(){return _0x3e9146['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x49fced[_0xcc9a('0x30')][_0xcc9a('0x2e')]||_0xcc9a('0x2f'),'lastPauseAt':moment()[_0xcc9a('0x22')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xcc9a('0x32')](function(_0x2a1f00){throw _0x2a1f00;});};exports[_0xcc9a('0x33')]=function(_0x2c4c72){return Promise[_0xcc9a('0x34')]()['then'](function(){if(_0x2c4c72['body']['channel']&&!utils['isValidChannel'](_0x2c4c72[_0xcc9a('0x30')][_0xcc9a('0x35')])){throw new Error(util['format'](_0xcc9a('0x36'),_0x2c4c72[_0xcc9a('0x30')]['channel']));}return db['User'][_0xcc9a('0x37')]({'where':_0x2c4c72[_0xcc9a('0xf')][_0xcc9a('0x11')]||{},'attributes':['id',_0xcc9a('0x1f'),'role',_0xcc9a('0x21'),'interface',_0xcc9a('0x38'),_0xcc9a('0x39'),_0xcc9a('0x3a'),'chatPause','faxPause',_0xcc9a('0x3b'),'smsPause',_0xcc9a('0x3c'),_0xcc9a('0x3d'),_0xcc9a('0x3e')]});})[_0xcc9a('0x17')](function(_0x16a7f0){if(!_0x16a7f0){throw new Error(util['format'](_0xcc9a('0x23'),_0x2c4c72[_0xcc9a('0x24')]['id']));}return _0x16a7f0[_0xcc9a('0x3f')](_0x2c4c72[_0xcc9a('0x30')][_0xcc9a('0x35')],_0xcc9a('0x40'));})['catch'](function(_0x11f111){throw _0x11f111;});};exports['LogoutUser']=function(_0x3b3832){var _0xe30741=this;return new Promise(function(_0xef4809,_0x16f19f){var _0x27decd;return db[_0xcc9a('0xd')][_0xcc9a('0x37')]({'where':_0x3b3832[_0xcc9a('0xf')][_0xcc9a('0x11')]||{},'attributes':['id',_0xcc9a('0x1f')]})[_0xcc9a('0x17')](function(_0x243808){if(_0x243808){_0x27decd=_0x243808;return db[_0xcc9a('0x41')][_0xcc9a('0x42')]({'where':{'membername':_0x27decd['name']},'individualHooks':!![]});}})['then'](function(){if(_0x27decd){return db[_0xcc9a('0x25')][_0xcc9a('0xe')]({'where':{'membername':_0x27decd[_0xcc9a('0x1f')],'exitAt':null}});}})['then'](function(_0x39c883){if(_0x27decd){if(_0x39c883&&_0x39c883[_0xcc9a('0x27')]){var _0x10f82f=[];_0x39c883[_0xcc9a('0x43')](function(_0x145dbd){_0x10f82f[_0xcc9a('0x2a')](_0x145dbd[_0xcc9a('0x44')]({'exitAt':moment()['format'](_0xcc9a('0x45'))}));});return BPromise[_0xcc9a('0x46')](_0x10f82f);}}})[_0xcc9a('0x17')](function(){if(_0x27decd){return _0x27decd[_0xcc9a('0x44')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xcc9a('0x17')](function(_0x219a29){_0xef4809(_0x219a29);})['catch'](function(_0x5ae048){_0x16f19f(_0xe30741[_0xcc9a('0x1a')](0x1f4,_0x5ae048[_0xcc9a('0x19')]));});});};exports[_0xcc9a('0x47')]=function(_0xe601de){var _0x42ccc1=this;return new Promise(function(_0x3bc239,_0x2a0c22){var _0x1a03b2;var _0x2b527e;var _0x21db76;var _0x33359e;return db[_0xcc9a('0xd')][_0xcc9a('0x37')]({'where':_0xe601de[_0xcc9a('0xf')][_0xcc9a('0x11')]||{},'attributes':['id',_0xcc9a('0x1f'),_0xcc9a('0x20'),_0xcc9a('0x48'),_0xcc9a('0x49'),_0xcc9a('0x21'),_0xcc9a('0x4a'),_0xcc9a('0x2d')]})[_0xcc9a('0x17')](function(_0x17041d){if(_0x17041d){_0x1a03b2=_0x17041d;_0x33359e=_0xe601de[_0xcc9a('0x30')][_0xcc9a('0x2d')]?_0xe601de[_0xcc9a('0x30')][_0xcc9a('0x2d')]:util[_0xcc9a('0x22')](_0xcc9a('0x2c'),_0x1a03b2[_0xcc9a('0x1f')]);return db[_0xcc9a('0xd')][_0xcc9a('0x4b')]({'where':{'role':_0xcc9a('0x4c'),'online':!![],'id':{'$ne':_0x1a03b2['id']}}});}})['then'](function(_0x390718){if(_0x390718){_0x21db76=_0x390718;return require(_0xcc9a('0x4d'))[_0xcc9a('0x4e')]();}})['then'](function(_0x2fe16b){if(_0x2fe16b&&_0x2fe16b[_0xcc9a('0x4f')]&&_0x21db76>=_0x2fe16b[_0xcc9a('0x4f')]){throw new Error(_0xcc9a('0x50'));}})[_0xcc9a('0x17')](function(){if(_0x1a03b2){return db[_0xcc9a('0x41')][_0xcc9a('0x42')]({'where':{'membername':_0x1a03b2[_0xcc9a('0x1f')]},'individualHooks':!![]});}})[_0xcc9a('0x17')](function(){if(_0x1a03b2){return _0x1a03b2['getVoiceQueues']({'raw':!![]});}})[_0xcc9a('0x17')](function(_0x355f4a){if(_0x1a03b2){if(_0x355f4a){var _0x55548f=[];_0x2b527e=_0x355f4a;if(_0x2b527e[_0xcc9a('0x27')]){for(var _0x1b0622=0x0;_0x1b0622<_0x2b527e[_0xcc9a('0x27')];_0x1b0622++){_0x55548f['push'](db[_0xcc9a('0x41')]['upsert']({'membername':_0x1a03b2[_0xcc9a('0x1f')],'UserId':_0x1a03b2['id'],'queue_name':_0x2b527e[_0x1b0622][_0xcc9a('0x1f')],'VoiceQueueId':_0x2b527e[_0x1b0622]['id'],'interface':_0x33359e,'paused':_0x1a03b2[_0xcc9a('0x4a')]||![],'penalty':_0x2b527e[_0x1b0622]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xcc9a('0x46')](_0x55548f);}}}})['then'](function(){if(_0x1a03b2){return db[_0xcc9a('0x25')][_0xcc9a('0xe')]({'where':{'membername':_0x1a03b2['name'],'exitAt':null}});}})['then'](function(_0x1df29e){if(_0x1a03b2){if(_0x1df29e&&_0x1df29e[_0xcc9a('0x27')]){var _0x2d1ef5=[];_0x1df29e[_0xcc9a('0x43')](function(_0x41299a){_0x2d1ef5['push'](_0x41299a['update']({'exitAt':moment()[_0xcc9a('0x22')](_0xcc9a('0x45'))}));});return BPromise[_0xcc9a('0x46')](_0x2d1ef5);}}})[_0xcc9a('0x17')](function(){if(_0x1a03b2){var _0x2a4c0b=[];var _0x22a342=[];var _0x52be9f=utils[_0xcc9a('0x29')]();var _0xdb4c02={'membername':_0x1a03b2[_0xcc9a('0x1f')],'interface':_0x33359e,'enterAt':moment()[_0xcc9a('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1a03b2[_0xcc9a('0x20')],'internal':_0x1a03b2['internal']};_0x52be9f[_0xcc9a('0x43')](function(_0x11632f){_0x2a4c0b[_0xcc9a('0x2a')](_[_0xcc9a('0x51')]({'channel':_0x11632f,'type':_0xcc9a('0x52'),'data1':_0xcc9a('0x53'),'data2':_0x33359e},_0xdb4c02));if(_0x1a03b2['loginInPause']){_0x22a342[_0xcc9a('0x2a')](_[_0xcc9a('0x51')]({'channel':_0x11632f,'type':'PAUSE','data1':_0xcc9a('0x54')},_0xdb4c02));}});return db[_0xcc9a('0x25')][_0xcc9a('0x31')](_0x2a4c0b['concat'](_0x22a342),{'individualHooks':!![]});}})['then'](function(){if(_0x1a03b2){return _0x1a03b2['update']({'online':!![],'lastLoginAt':moment()[_0xcc9a('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1a03b2['loginInPause']||![],'mailPause':_0x1a03b2['loginInPause']||![],'chatPause':_0x1a03b2[_0xcc9a('0x4a')]||![],'faxPause':_0x1a03b2[_0xcc9a('0x4a')]||![],'smsPause':_0x1a03b2[_0xcc9a('0x4a')]||![],'openchannelPause':_0x1a03b2[_0xcc9a('0x4a')]||![],'pauseType':_0x1a03b2[_0xcc9a('0x4a')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xcc9a('0x45')),'interface':_0x33359e});}})[_0xcc9a('0x17')](function(_0x16c5d2){_0x3bc239(_0x16c5d2);})['catch'](function(_0x322703){_0x2a0c22(_0x42ccc1[_0xcc9a('0x1a')](0x1f4,_0x322703['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1d09a90..0163d91 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 _0xf4a7=['update','register','user:','./user.events','remove'];(function(_0x3aba75,_0x231d0b){var _0xf00e69=function(_0x36d82c){while(--_0x36d82c){_0x3aba75['push'](_0x3aba75['shift']());}};_0xf00e69(++_0x231d0b);}(_0xf4a7,0x1d9));var _0x7f4a=function(_0x3b10b8,_0x56296e){_0x3b10b8=_0x3b10b8-0x0;var _0x5997ba=_0xf4a7[_0x3b10b8];return _0x5997ba;};'use strict';var UserEvents=require(_0x7f4a('0x0'));var events=['save',_0x7f4a('0x1'),_0x7f4a('0x2')];function createListener(_0x208c05,_0x475fea){return function(_0x560fba){_0x475fea['emit'](_0x208c05,_0x560fba);};}function removeListener(_0x2d9db5,_0x387052){return function(){UserEvents['removeListener'](_0x2d9db5,_0x387052);};}exports[_0x7f4a('0x3')]=function(_0x2fcf93){for(var _0xae4c30=0x0,_0xeb98a8=events['length'];_0xae4c30<_0xeb98a8;_0xae4c30++){var _0xe221c0=events[_0xae4c30];var _0x279277=createListener(_0x7f4a('0x4')+_0xe221c0,_0x2fcf93);UserEvents['on'](_0xe221c0,_0x279277);}}; \ No newline at end of file +var _0x135a=['./user.events','remove','emit','length','user:'];(function(_0x16ec8d,_0x4bf3f0){var _0x12bdbf=function(_0x1a73ba){while(--_0x1a73ba){_0x16ec8d['push'](_0x16ec8d['shift']());}};_0x12bdbf(++_0x4bf3f0);}(_0x135a,0x13b));var _0xa135=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x135a[_0x2c91e9];return _0x13f0ff;};'use strict';var UserEvents=require(_0xa135('0x0'));var events=['save',_0xa135('0x1'),'update'];function createListener(_0x370389,_0x5563c1){return function(_0x20545c){_0x5563c1[_0xa135('0x2')](_0x370389,_0x20545c);};}function removeListener(_0x3e1948,_0x575f23){return function(){UserEvents['removeListener'](_0x3e1948,_0x575f23);};}exports['register']=function(_0x468a65){for(var _0x2a5ae7=0x0,_0x274d3d=events[_0xa135('0x3')];_0x2a5ae7<_0x274d3d;_0x2a5ae7++){var _0x45e66e=events[_0x2a5ae7];var _0x15f5e8=createListener(_0xa135('0x4')+_0x45e66e,_0x468a65);UserEvents['on'](_0x45e66e,_0x15f5e8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index aed0588..b1f8dc6 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x14270b,_0x4d10f6){var _0x392388=function(_0x24b1be){while(--_0x24b1be){_0x14270b['push'](_0x14270b['shift']());}};_0x392388(++_0x4d10f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xcb91[_0x67f95e];return _0x538f5a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x259777,_0x333a47){var _0x4b1cda=function(_0x11c80e){while(--_0x11c80e){_0x259777['push'](_0x259777['shift']());}};_0x4b1cda(++_0x333a47);}(_0x70e0,0x17b));var _0x070e=function(_0x430204,_0x512098){_0x430204=_0x430204-0x0;var _0x242528=_0x70e0[_0x430204];return _0x242528;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index af5dd12..3d85df8 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 _0x3981=['sequelize','INTEGER'];(function(_0x4f7393,_0x337b2c){var _0x262904=function(_0x327049){while(--_0x327049){_0x4f7393['push'](_0x4f7393['shift']());}};_0x262904(++_0x337b2c);}(_0x3981,0x144));var _0x1398=function(_0x18dcdf,_0x41808c){_0x18dcdf=_0x18dcdf-0x0;var _0x34a6b4=_0x3981[_0x18dcdf];return _0x34a6b4;};'use strict';var Sequelize=require(_0x1398('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1398('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x134d=['sequelize','INTEGER'];(function(_0x5528e8,_0x36f360){var _0xafced6=function(_0xa6a765){while(--_0xa6a765){_0x5528e8['push'](_0x5528e8['shift']());}};_0xafced6(++_0x36f360);}(_0x134d,0xfc));var _0xd134=function(_0x10c7fb,_0x3d119d){_0x10c7fb=_0x10c7fb-0x0;var _0x256441=_0x134d[_0x10c7fb];return _0x256441;};'use strict';var Sequelize=require(_0xd134('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd134('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index c672886..37786d1 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 _0x06ff=['api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger'];(function(_0x587cbf,_0x5ac394){var _0x1abe6e=function(_0x4f583f){while(--_0x4f583f){_0x587cbf['push'](_0x587cbf['shift']());}};_0x1abe6e(++_0x5ac394);}(_0x06ff,0x9a));var _0xf06f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x06ff[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xf06f('0x0'));var logger=require(_0xf06f('0x1'))(_0xf06f('0x2'));var moment=require(_0xf06f('0x3'));var BPromise=require(_0xf06f('0x4'));var rp=require(_0xf06f('0x5'));var fs=require('fs');var path=require(_0xf06f('0x6'));var rimraf=require(_0xf06f('0x7'));var config=require('../../config/environment');var attributes=require(_0xf06f('0x8'));module[_0xf06f('0x9')]=function(_0x1a42e8,_0x4cb1e5){return _0x1a42e8[_0xf06f('0xa')](_0xf06f('0xb'),attributes,{'tableName':_0xf06f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fd9=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','request-promise','rimraf','../../config/environment'];(function(_0x292dc0,_0x182077){var _0x2a0169=function(_0x3d902e){while(--_0x3d902e){_0x292dc0['push'](_0x292dc0['shift']());}};_0x2a0169(++_0x182077);}(_0x0fd9,0x69));var _0x90fd=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0x0fd9[_0x3bfdde];return _0x3f752a;};'use strict';var _=require(_0x90fd('0x0'));var util=require(_0x90fd('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x90fd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90fd('0x3'));var config=require(_0x90fd('0x4'));var attributes=require(_0x90fd('0x5'));module[_0x90fd('0x6')]=function(_0x4104d2,_0x8a439){return _0x4104d2[_0x90fd('0x7')](_0x90fd('0x8'),attributes,{'tableName':_0x90fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index b170fe0..b68d154 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 _0x48a8=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x48a8,0x163));var _0x848a=function(_0x194099,_0x313873){_0x194099=_0x194099-0x0;var _0x8a7b9b=_0x48a8[_0x194099];return _0x8a7b9b;};'use strict';var _=require(_0x848a('0x0'));var util=require('util');var moment=require(_0x848a('0x1'));var BPromise=require(_0x848a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x848a('0x3'));var db=require(_0x848a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x848a('0x5'))(_0x848a('0x6'));var config=require(_0x848a('0x7'));var jayson=require(_0x848a('0x8'));var client=jayson['client'][_0x848a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ec46,_0x4b6108,_0x5d5a26){return new BPromise(function(_0x4a1e58,_0x79e7fa){return client[_0x848a('0xa')](_0x26ec46,_0x5d5a26)[_0x848a('0xb')](function(_0x26ef31){logger[_0x848a('0xc')](_0x848a('0xd'),_0x4b6108,_0x848a('0xe'));logger[_0x848a('0xf')](_0x848a('0x10'),_0x4b6108,_0x848a('0xe'),JSON[_0x848a('0x11')](_0x26ef31));if(_0x26ef31['error']){if(_0x26ef31['error'][_0x848a('0x12')]===0x1f4){logger['error'](_0x848a('0xd'),_0x4b6108,_0x26ef31[_0x848a('0x13')][_0x848a('0x14')]);return _0x79e7fa(_0x26ef31[_0x848a('0x13')]['message']);}logger[_0x848a('0x13')](_0x848a('0xd'),_0x4b6108,_0x26ef31[_0x848a('0x13')]['message']);return _0x4a1e58(_0x26ef31[_0x848a('0x13')][_0x848a('0x14')]);}else{logger[_0x848a('0xc')](_0x848a('0xd'),_0x4b6108,'request\x20sent');_0x4a1e58(_0x26ef31[_0x848a('0x15')][_0x848a('0x14')]);}})[_0x848a('0x16')](function(_0x19a203){logger[_0x848a('0x13')](_0x848a('0xd'),_0x4b6108,_0x19a203);_0x79e7fa(_0x19a203);});});} \ No newline at end of file +var _0xe7c5=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x430ff9,_0x41afb8){var _0x4b8fd8=function(_0x57f5fe){while(--_0x57f5fe){_0x430ff9['push'](_0x430ff9['shift']());}};_0x4b8fd8(++_0x41afb8);}(_0xe7c5,0x1ea));var _0x5e7c=function(_0xfba70b,_0x43fa8e){_0xfba70b=_0xfba70b-0x0;var _0x3022aa=_0xe7c5[_0xfba70b];return _0x3022aa;};'use strict';var _=require(_0x5e7c('0x0'));var util=require(_0x5e7c('0x1'));var moment=require(_0x5e7c('0x2'));var BPromise=require(_0x5e7c('0x3'));var rs=require(_0x5e7c('0x4'));var fs=require('fs');var Redis=require(_0x5e7c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5e7c('0x6'))(_0x5e7c('0x7'));var config=require(_0x5e7c('0x8'));var jayson=require(_0x5e7c('0x9'));var client=jayson[_0x5e7c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f3b50,_0x273302,_0x4a91bf){return new BPromise(function(_0x470b3e,_0x4bf909){return client[_0x5e7c('0xb')](_0x4f3b50,_0x4a91bf)[_0x5e7c('0xc')](function(_0x4599f9){logger[_0x5e7c('0xd')](_0x5e7c('0xe'),_0x273302,_0x5e7c('0xf'));logger['debug'](_0x5e7c('0x10'),_0x273302,_0x5e7c('0xf'),JSON[_0x5e7c('0x11')](_0x4599f9));if(_0x4599f9[_0x5e7c('0x12')]){if(_0x4599f9[_0x5e7c('0x12')]['code']===0x1f4){logger['error'](_0x5e7c('0xe'),_0x273302,_0x4599f9[_0x5e7c('0x12')]['message']);return _0x4bf909(_0x4599f9[_0x5e7c('0x12')][_0x5e7c('0x13')]);}logger[_0x5e7c('0x12')](_0x5e7c('0xe'),_0x273302,_0x4599f9['error'][_0x5e7c('0x13')]);return _0x470b3e(_0x4599f9['error'][_0x5e7c('0x13')]);}else{logger['info'](_0x5e7c('0xe'),_0x273302,_0x5e7c('0xf'));_0x470b3e(_0x4599f9[_0x5e7c('0x14')][_0x5e7c('0x13')]);}})[_0x5e7c('0x15')](function(_0x4b930c){logger[_0x5e7c('0x12')](_0x5e7c('0xe'),_0x273302,_0x4b930c);_0x4bf909(_0x4b930c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3fc91cd..81b75d8 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x72b6b9,_0x15c6fe){var _0x1103fa=function(_0x2e6836){while(--_0x2e6836){_0x72b6b9['push'](_0x72b6b9['shift']());}};_0x1103fa(++_0x15c6fe);}(_0xedd9,0xfc));var _0x9edd=function(_0x4676b9,_0x55fcd1){_0x4676b9=_0x4676b9-0x0;var _0x3a6e12=_0xedd9[_0x4676b9];return _0x3a6e12;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x41bf6a,_0x163b03){var _0xe1c3ae=function(_0x2541d9){while(--_0x2541d9){_0x41bf6a['push'](_0x41bf6a['shift']());}};_0xe1c3ae(++_0x163b03);}(_0x70e0,0x17b));var _0x070e=function(_0x119966,_0x160744){_0x119966=_0x119966-0x0;var _0x4ca38a=_0x70e0[_0x119966];return _0x4ca38a;};'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 f4c608f..e40b30d 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 _0xdae6=['INTEGER','STRING','sequelize','exports'];(function(_0x169836,_0x405907){var _0x2928f1=function(_0x332a81){while(--_0x332a81){_0x169836['push'](_0x169836['shift']());}};_0x2928f1(++_0x405907);}(_0xdae6,0x7a));var _0x6dae=function(_0x20d853,_0x15fc27){_0x20d853=_0x20d853-0x0;var _0x508734=_0xdae6[_0x20d853];return _0x508734;};'use strict';var Sequelize=require(_0x6dae('0x0'));module[_0x6dae('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6dae('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6dae('0x3')]}}; \ No newline at end of file +var _0xa3ef=['STRING','exports','INTEGER'];(function(_0x4b6cf5,_0x308fde){var _0x3e618e=function(_0x5213d8){while(--_0x5213d8){_0x4b6cf5['push'](_0x4b6cf5['shift']());}};_0x3e618e(++_0x308fde);}(_0xa3ef,0x124));var _0xfa3e=function(_0x3e709d,_0x22d870){_0x3e709d=_0x3e709d-0x0;var _0x9616ed=_0xa3ef[_0x3e709d];return _0x9616ed;};'use strict';var Sequelize=require('sequelize');module[_0xfa3e('0x0')]={'penalty':{'type':Sequelize[_0xfa3e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfa3e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfa3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8833291..2eaffe1 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 _0xf2a5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','api'];(function(_0x2eb66a,_0x1b5883){var _0x4abfef=function(_0x43979f){while(--_0x43979f){_0x2eb66a['push'](_0x2eb66a['shift']());}};_0x4abfef(++_0x1b5883);}(_0xf2a5,0xee));var _0x5f2a=function(_0x35432b,_0x55a7ab){_0x35432b=_0x35432b-0x0;var _0x1fdb00=_0xf2a5[_0x35432b];return _0x1fdb00;};'use strict';var _=require(_0x5f2a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f2a('0x1'));var moment=require(_0x5f2a('0x2'));var BPromise=require(_0x5f2a('0x3'));var rp=require(_0x5f2a('0x4'));var fs=require('fs');var path=require(_0x5f2a('0x5'));var rimraf=require(_0x5f2a('0x6'));var config=require(_0x5f2a('0x7'));var attributes=require(_0x5f2a('0x8'));module[_0x5f2a('0x9')]=function(_0x957668,_0x34c794){return _0x957668[_0x5f2a('0xa')]('UserFaxQueue',attributes,{'tableName':_0x5f2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','lodash','util'];(function(_0x1e11c4,_0x5dc691){var _0x49a85d=function(_0x536940){while(--_0x536940){_0x1e11c4['push'](_0x1e11c4['shift']());}};_0x49a85d(++_0x5dc691);}(_0x20e3,0x76));var _0x320e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x20e3[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x320e('0x0'));var util=require(_0x320e('0x1'));var logger=require('../../config/logger')(_0x320e('0x2'));var moment=require(_0x320e('0x3'));var BPromise=require(_0x320e('0x4'));var rp=require(_0x320e('0x5'));var fs=require('fs');var path=require(_0x320e('0x6'));var rimraf=require(_0x320e('0x7'));var config=require(_0x320e('0x8'));var attributes=require(_0x320e('0x9'));module[_0x320e('0xa')]=function(_0x43db82,_0x1d9f0e){return _0x43db82[_0x320e('0xb')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 801622b..e7f3029 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 _0xc7aa=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x11835b,_0x19a49a){var _0x2a9ee4=function(_0x4c3ada){while(--_0x4c3ada){_0x11835b['push'](_0x11835b['shift']());}};_0x2a9ee4(++_0x19a49a);}(_0xc7aa,0x189));var _0xac7a=function(_0x4934e4,_0x3ddf80){_0x4934e4=_0x4934e4-0x0;var _0x11a8f4=_0xc7aa[_0x4934e4];return _0x11a8f4;};'use strict';var _=require(_0xac7a('0x0'));var util=require(_0xac7a('0x1'));var moment=require(_0xac7a('0x2'));var BPromise=require(_0xac7a('0x3'));var rs=require(_0xac7a('0x4'));var fs=require('fs');var Redis=require(_0xac7a('0x5'));var db=require(_0xac7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7a('0x7'))(_0xac7a('0x8'));var config=require('../../config/environment');var jayson=require(_0xac7a('0x9'));var client=jayson['client'][_0xac7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27d7fb,_0x3f37e0,_0x6ca4dd){return new BPromise(function(_0x6324ab,_0x33069f){return client[_0xac7a('0xb')](_0x27d7fb,_0x6ca4dd)[_0xac7a('0xc')](function(_0x37eb61){logger[_0xac7a('0xd')](_0xac7a('0xe'),_0x3f37e0,_0xac7a('0xf'));logger[_0xac7a('0x10')](_0xac7a('0x11'),_0x3f37e0,'request\x20sent',JSON[_0xac7a('0x12')](_0x37eb61));if(_0x37eb61['error']){if(_0x37eb61[_0xac7a('0x13')]['code']===0x1f4){logger['error'](_0xac7a('0xe'),_0x3f37e0,_0x37eb61['error'][_0xac7a('0x14')]);return _0x33069f(_0x37eb61['error'][_0xac7a('0x14')]);}logger['error'](_0xac7a('0xe'),_0x3f37e0,_0x37eb61[_0xac7a('0x13')][_0xac7a('0x14')]);return _0x6324ab(_0x37eb61['error'][_0xac7a('0x14')]);}else{logger['info'](_0xac7a('0xe'),_0x3f37e0,_0xac7a('0xf'));_0x6324ab(_0x37eb61[_0xac7a('0x15')][_0xac7a('0x14')]);}})[_0xac7a('0x16')](function(_0x79e07a){logger['error'](_0xac7a('0xe'),_0x3f37e0,_0x79e07a);_0x33069f(_0x79e07a);});});} \ No newline at end of file +var _0x3350=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1af45e,_0x24c911){var _0x561e6b=function(_0x1a3b4c){while(--_0x1a3b4c){_0x1af45e['push'](_0x1af45e['shift']());}};_0x561e6b(++_0x24c911);}(_0x3350,0x171));var _0x0335=function(_0x357924,_0x196049){_0x357924=_0x357924-0x0;var _0x107e70=_0x3350[_0x357924];return _0x107e70;};'use strict';var _=require(_0x0335('0x0'));var util=require(_0x0335('0x1'));var moment=require(_0x0335('0x2'));var BPromise=require(_0x0335('0x3'));var rs=require(_0x0335('0x4'));var fs=require('fs');var Redis=require(_0x0335('0x5'));var db=require(_0x0335('0x6'))['db'];var utils=require(_0x0335('0x7'));var logger=require(_0x0335('0x8'))(_0x0335('0x9'));var config=require(_0x0335('0xa'));var jayson=require(_0x0335('0xb'));var client=jayson[_0x0335('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2a3e,_0x2bd632,_0x28a253){return new BPromise(function(_0x21d759,_0x399e3f){return client[_0x0335('0xd')](_0x4f2a3e,_0x28a253)[_0x0335('0xe')](function(_0x311bc9){logger[_0x0335('0xf')](_0x0335('0x10'),_0x2bd632,_0x0335('0x11'));logger['debug'](_0x0335('0x12'),_0x2bd632,_0x0335('0x11'),JSON[_0x0335('0x13')](_0x311bc9));if(_0x311bc9[_0x0335('0x14')]){if(_0x311bc9[_0x0335('0x14')][_0x0335('0x15')]===0x1f4){logger[_0x0335('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x2bd632,_0x311bc9[_0x0335('0x14')][_0x0335('0x16')]);return _0x399e3f(_0x311bc9['error'][_0x0335('0x16')]);}logger[_0x0335('0x14')](_0x0335('0x10'),_0x2bd632,_0x311bc9[_0x0335('0x14')][_0x0335('0x16')]);return _0x21d759(_0x311bc9[_0x0335('0x14')][_0x0335('0x16')]);}else{logger[_0x0335('0xf')](_0x0335('0x10'),_0x2bd632,_0x0335('0x11'));_0x21d759(_0x311bc9[_0x0335('0x17')][_0x0335('0x16')]);}})[_0x0335('0x18')](function(_0x25807b){logger[_0x0335('0x14')](_0x0335('0x10'),_0x2bd632,_0x25807b);_0x399e3f(_0x25807b);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 307bc96..729b40a 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(_0x411ce1,_0x5bbb1c){var _0x51bed0=function(_0x1d3e8f){while(--_0x1d3e8f){_0x411ce1['push'](_0x411ce1['shift']());}};_0x51bed0(++_0x5bbb1c);}(_0xedd9,0xfc));var _0x9edd=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xedd9[_0x403c20];return _0x2b271a;};'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(_0x362742,_0xb47803){var _0x2b9159=function(_0x355dfc){while(--_0x355dfc){_0x362742['push'](_0x362742['shift']());}};_0x2b9159(++_0xb47803);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9d35623..065d245 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 _0x3e20=['sequelize','exports'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x3e20,0xa0));var _0x03e2=function(_0xe8baba,_0x2a3830){_0xe8baba=_0xe8baba-0x0;var _0xbe157b=_0x3e20[_0xe8baba];return _0xbe157b;};'use strict';var Sequelize=require(_0x03e2('0x0'));module[_0x03e2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c99=['INTEGER','exports'];(function(_0x5941f8,_0x4aee3e){var _0xb94b96=function(_0x16ae07){while(--_0x16ae07){_0x5941f8['push'](_0x5941f8['shift']());}};_0xb94b96(++_0x4aee3e);}(_0x3c99,0xb9));var _0x93c9=function(_0x19b4d3,_0x536826){_0x19b4d3=_0x19b4d3-0x0;var _0x17c0e4=_0x3c99[_0x19b4d3];return _0x17c0e4;};'use strict';var Sequelize=require('sequelize');module[_0x93c9('0x0')]={'penalty':{'type':Sequelize[_0x93c9('0x1')],'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 205a96c..18caea2 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 _0x9260=['UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x1b87aa,_0x8ea857){var _0x834140=function(_0x3725b9){while(--_0x3725b9){_0x1b87aa['push'](_0x1b87aa['shift']());}};_0x834140(++_0x8ea857);}(_0x9260,0x17b));var _0x0926=function(_0x103ffc,_0x34565f){_0x103ffc=_0x103ffc-0x0;var _0x85d023=_0x9260[_0x103ffc];return _0x85d023;};'use strict';var _=require(_0x0926('0x0'));var util=require(_0x0926('0x1'));var logger=require('../../config/logger')(_0x0926('0x2'));var moment=require(_0x0926('0x3'));var BPromise=require(_0x0926('0x4'));var rp=require(_0x0926('0x5'));var fs=require('fs');var path=require(_0x0926('0x6'));var rimraf=require('rimraf');var config=require(_0x0926('0x7'));var attributes=require(_0x0926('0x8'));module[_0x0926('0x9')]=function(_0x415591,_0x12949b){return _0x415591[_0x0926('0xa')](_0x0926('0xb'),attributes,{'tableName':_0x0926('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49cd=['./userMailQueue.attributes','exports','UserMailQueue','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x252ef1,_0x2e0041){var _0x25817c=function(_0x243776){while(--_0x243776){_0x252ef1['push'](_0x252ef1['shift']());}};_0x25817c(++_0x2e0041);}(_0x49cd,0x161));var _0xd49c=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x49cd[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require('lodash');var util=require(_0xd49c('0x0'));var logger=require(_0xd49c('0x1'))('api');var moment=require(_0xd49c('0x2'));var BPromise=require('bluebird');var rp=require(_0xd49c('0x3'));var fs=require('fs');var path=require(_0xd49c('0x4'));var rimraf=require(_0xd49c('0x5'));var config=require(_0xd49c('0x6'));var attributes=require(_0xd49c('0x7'));module[_0xd49c('0x8')]=function(_0x57b2fe,_0x597394){return _0x57b2fe['define'](_0xd49c('0x9'),attributes,{'tableName':'user_has_mail_queues','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 8953ced..e150b06 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x576040,_0x39fb56){var _0x7c2205=function(_0x23abd9){while(--_0x23abd9){_0x576040['push'](_0x576040['shift']());}};_0x7c2205(++_0x39fb56);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x00bb[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0xf37598,_0x3a3d60){var _0xc8544c=function(_0x509657){while(--_0x509657){_0xf37598['push'](_0xf37598['shift']());}};_0xc8544c(++_0x3a3d60);}(_0x3e74,0x175));var _0x43e7=function(_0x5e46c8,_0x41055a){_0x5e46c8=_0x5e46c8-0x0;var _0x4134d4=_0x3e74[_0x5e46c8];return _0x4134d4;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 7693356..dc3ae0b 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 _0x6224=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util'];(function(_0x5a8f37,_0x3f06d9){var _0x5b6d7c=function(_0x1a99fb){while(--_0x1a99fb){_0x5a8f37['push'](_0x5a8f37['shift']());}};_0x5b6d7c(++_0x3f06d9);}(_0x6224,0x1ed));var _0x4622=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x6224[_0x148c09];return _0x18e613;};'use strict';var multer=require(_0x4622('0x0'));var util=require(_0x4622('0x1'));var path=require(_0x4622('0x2'));var timeout=require('connect-timeout');var express=require(_0x4622('0x3'));var router=express['Router']();var fs_extra=require(_0x4622('0x4'));var auth=require(_0x4622('0x5'));var interaction=require(_0x4622('0x6'));var config=require('../../config/environment');var controller=require(_0x4622('0x7'));router[_0x4622('0x8')]('/',auth[_0x4622('0x9')](),controller[_0x4622('0xa')]);module['exports']=router; \ No newline at end of file +var _0x28d0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','post','sendUserNotification','exports'];(function(_0x2e94c6,_0x4c5da0){var _0x2cb195=function(_0x3f9358){while(--_0x3f9358){_0x2e94c6['push'](_0x2e94c6['shift']());}};_0x2cb195(++_0x4c5da0);}(_0x28d0,0x87));var _0x028d=function(_0x2d9d2c,_0x5158a4){_0x2d9d2c=_0x2d9d2c-0x0;var _0xb7ac6d=_0x28d0[_0x2d9d2c];return _0xb7ac6d;};'use strict';var multer=require('multer');var util=require(_0x028d('0x0'));var path=require(_0x028d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x028d('0x2')]();var fs_extra=require(_0x028d('0x3'));var auth=require(_0x028d('0x4'));var interaction=require(_0x028d('0x5'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x028d('0x6')]('/',auth['isAuthenticated'](),controller[_0x028d('0x7')]);module[_0x028d('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2198ab3..3a1a4ab 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 _0x0d33=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x28b62e,_0x28fbe2){var _0x16b4a9=function(_0x39611c){while(--_0x39611c){_0x28b62e['push'](_0x28b62e['shift']());}};_0x16b4a9(++_0x28fbe2);}(_0x0d33,0x6f));var _0x30d3=function(_0x542063,_0x423b71){_0x542063=_0x542063-0x0;var _0x36f4d7=_0x0d33[_0x542063];return _0x36f4d7;};'use strict';var Sequelize=require(_0x30d3('0x0'));module[_0x30d3('0x1')]={'body':{'type':Sequelize[_0x30d3('0x2')]},'senderName':{'type':Sequelize[_0x30d3('0x3')]},'recipientsId':{'type':Sequelize[_0x30d3('0x2')]},'recipientsDescription':{'type':Sequelize[_0x30d3('0x3')]},'beep':{'type':Sequelize[_0x30d3('0x4')]}}; \ No newline at end of file +var _0xd155=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x1fe23d,_0x5cd903){var _0x11eb92=function(_0x49b226){while(--_0x49b226){_0x1fe23d['push'](_0x1fe23d['shift']());}};_0x11eb92(++_0x5cd903);}(_0xd155,0x10d));var _0x5d15=function(_0x25b439,_0xb20872){_0x25b439=_0x25b439-0x0;var _0xbf2210=_0xd155[_0x25b439];return _0xbf2210;};'use strict';var Sequelize=require(_0x5d15('0x0'));module['exports']={'body':{'type':Sequelize[_0x5d15('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x5d15('0x2')]},'beep':{'type':Sequelize[_0x5d15('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d1c9972..db50131 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 _0x66b5=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','openchannelqueue','smsqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','toLowerCase','replace','queue','ids','push','all','union','flatten','catch','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x66b5,0x1ea));var _0x566b=function(_0x3ca813,_0x24482a){_0x3ca813=_0x3ca813-0x0;var _0xf454e9=_0x66b5[_0x3ca813];return _0xf454e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x566b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x566b('0x1'));var rp=require(_0x566b('0x2'));var moment=require(_0x566b('0x3'));var BPromise=require(_0x566b('0x4'));var Mustache=require('mustache');var util=require(_0x566b('0x5'));var path=require(_0x566b('0x6'));var sox=require('sox');var csv=require(_0x566b('0x7'));var ejs=require(_0x566b('0x8'));var fs=require('fs');var fs_extra=require(_0x566b('0x9'));var _=require(_0x566b('0xa'));var squel=require(_0x566b('0xb'));var crypto=require('crypto');var jsforce=require(_0x566b('0xc'));var deskjs=require(_0x566b('0xd'));var toCsv=require(_0x566b('0x7'));var querystring=require(_0x566b('0xe'));var Papa=require(_0x566b('0xf'));var Redis=require(_0x566b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x566b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x566b('0x12'));var logger=require('../../config/logger')(_0x566b('0x13'));var utils=require(_0x566b('0x14'));var config=require(_0x566b('0x15'));var licenseUtil=require(_0x566b('0x16'));var db=require(_0x566b('0x17'))['db'];config['redis']=_[_0x566b('0x18')](config[_0x566b('0x19')],{'host':_0x566b('0x1a'),'port':0x18eb});var socket=require(_0x566b('0x1b'))(new Redis(config[_0x566b('0x19')]));require(_0x566b('0x1c'))[_0x566b('0x1d')](socket);function respondWithStatusCode(_0x231b5f,_0x13b36e){_0x13b36e=_0x13b36e||0xcc;return function(_0xe9fa59){if(_0xe9fa59){return _0x231b5f[_0x566b('0x1e')](_0x13b36e);}return _0x231b5f[_0x566b('0x1f')](_0x13b36e)[_0x566b('0x20')]();};}function respondWithResult(_0x4bf204,_0x22ffa0){_0x22ffa0=_0x22ffa0||0xc8;return function(_0x40356a){if(_0x40356a){return _0x4bf204[_0x566b('0x1f')](_0x22ffa0)['json'](_0x40356a);}};}function respondWithFilteredResult(_0x359cec,_0x4eb55e){return function(_0x1712fd){if(_0x1712fd){var _0x59fc4e=typeof _0x4eb55e[_0x566b('0x21')]===_0x566b('0x22')&&typeof _0x4eb55e[_0x566b('0x23')]===_0x566b('0x22');var _0x3c21ac=_0x1712fd[_0x566b('0x24')];var _0x12d9fc=_0x59fc4e?0x0:_0x4eb55e['offset'];var _0x2cef94=_0x59fc4e?_0x1712fd[_0x566b('0x24')]:_0x4eb55e['offset']+_0x4eb55e[_0x566b('0x23')];var _0x2549aa;if(_0x2cef94>=_0x3c21ac){_0x2cef94=_0x3c21ac;_0x2549aa=0xc8;}else{_0x2549aa=0xce;}_0x359cec[_0x566b('0x1f')](_0x2549aa);return _0x359cec[_0x566b('0x25')](_0x566b('0x26'),_0x12d9fc+'-'+_0x2cef94+'/'+_0x3c21ac)[_0x566b('0x27')](_0x1712fd);}return null;};}function patchUpdates(_0x6d5b57){return function(_0x3429da){try{jsonpatch['apply'](_0x3429da,_0x6d5b57,!![]);}catch(_0x43d47c){return BPromise[_0x566b('0x28')](_0x43d47c);}return _0x3429da[_0x566b('0x29')]();};}function saveUpdates(_0x1442e7,_0x5b085e){return function(_0x29a363){if(_0x29a363){return _0x29a363[_0x566b('0x2a')](_0x1442e7)[_0x566b('0x2b')](function(_0x5e08d8){return _0x5e08d8;});}return null;};}function removeEntity(_0x25f514,_0x96d131){return function(_0x5e965d){if(_0x5e965d){return _0x5e965d[_0x566b('0x2c')]()[_0x566b('0x2b')](function(){_0x25f514[_0x566b('0x1f')](0xcc)[_0x566b('0x20')]();});}};}function handleEntityNotFound(_0x227b84,_0x3ce8e3){return function(_0x3e1131){if(!_0x3e1131){_0x227b84[_0x566b('0x1e')](0x194);}return _0x3e1131;};}function handleError(_0x43a2bb,_0x5557c1){_0x5557c1=_0x5557c1||0x1f4;return function(_0x47a101){logger[_0x566b('0x2d')](_0x47a101[_0x566b('0x2e')]);if(_0x47a101[_0x566b('0x2f')]){delete _0x47a101[_0x566b('0x2f')];}_0x43a2bb[_0x566b('0x1f')](_0x5557c1)[_0x566b('0x30')](_0x47a101);};}exports[_0x566b('0x31')]=function(_0xa50eb,_0x4b354a,_0x267ea2){if(!_0xa50eb[_0x566b('0x32')][_0x566b('0x33')](_0x566b('0x34'))&&!_0xa50eb['body']['hasOwnProperty'](_0x566b('0x35'))){throw new db[(_0x566b('0x36'))][(_0x566b('0x37'))](_0x566b('0x38'));}else{if(_0xa50eb[_0x566b('0x32')]['hasOwnProperty']('TemplateId')&&!_0xa50eb[_0x566b('0x32')]['hasOwnProperty'](_0x566b('0x39'))){throw new db[(_0x566b('0x36'))]['ValidationError'](_0x566b('0x3a'));}if(!_0xa50eb['body'][_0x566b('0x33')](_0x566b('0x3b'))){throw new db[(_0x566b('0x36'))][(_0x566b('0x37'))](_0x566b('0x3c'));}else{try{var _0x36b7b1=JSON['parse'](_0xa50eb[_0x566b('0x32')]['recipients']);}catch(_0x2b0478){logger[_0x566b('0x2d')](_0x2b0478);throw new db[(_0x566b('0x36'))][(_0x566b('0x37'))](_0x566b('0x3d'));}var _0x4def86=['chatqueue','faxqueue','mailqueue',_0x566b('0x3e'),_0x566b('0x3f'),'voicequeue','whatsappqueue',_0x566b('0x40'),_0x566b('0x41')];if(_[_0x566b('0x42')](_0x36b7b1,function(_0x5562ab){return!_[_0x566b('0x43')](_0x4def86,_0x5562ab[_0x566b('0x44')]['toLowerCase']());})){throw new db[(_0x566b('0x36'))][(_0x566b('0x37'))](_0x566b('0x45'));}}}var _0x7c54f0={};_0x7c54f0[_0x566b('0x46')]=_0xa50eb['body']['hasOwnProperty'](_0x566b('0x46'))?_0xa50eb[_0x566b('0x32')][_0x566b('0x46')]:_0xa50eb[_0x566b('0x41')][_0x566b('0x47')];_0x7c54f0[_0x566b('0x48')]=_[_0x566b('0x49')](_0xa50eb[_0x566b('0x32')][_0x566b('0x48')])?null:_0xa50eb[_0x566b('0x32')][_0x566b('0x48')];_0x7c54f0[_0x566b('0x4a')]=_0xa50eb['body']['beep']||![];_0x7c54f0[_0x566b('0x4b')]=_0xa50eb[_0x566b('0x41')]['id'];return getContent(_0xa50eb[_0x566b('0x32')])[_0x566b('0x2b')](function(_0x342ae6){_0x7c54f0[_0x566b('0x32')]=_0x342ae6;return getRecipients(_0x36b7b1);})[_0x566b('0x2b')](function(_0x30656b){_0x7c54f0[_0x566b('0x4c')]=_[_0x566b('0x4d')](_0x30656b)[_0x566b('0x4e')](',');return db[_0x566b('0x4f')][_0x566b('0x50')](function(_0x263ac9){return db[_0x566b('0x51')]['create'](_0x7c54f0,{'raw':!![],'transaction':_0x263ac9})[_0x566b('0x2b')](function(_0xae84b8){var _0xa1840e={'sender':_0x7c54f0[_0x566b('0x46')],'description':_0x7c54f0['recipientsDescription'],'content':_0x7c54f0['body'],'beep':_0x7c54f0[_0x566b('0x4a')]};_0x30656b['forEach'](function(_0x1dd97d){_0xa1840e[_0x566b('0x52')]=_0x1dd97d;socket[_0x566b('0x53')](_0x566b('0x54'),_0xa1840e);});return _0xae84b8;});});})[_0x566b('0x2b')](respondWithResult(_0x4b354a,0xc9))['catch'](handleError(_0x4b354a,null));};function getContent(_0x5420a7){return new BPromise(function(_0x2be033,_0x2d366a){if(_0x5420a7['text']){_0x2be033(_0x5420a7[_0x566b('0x34')]);return;}return db[_0x566b('0x55')][_0x566b('0x56')]({'attributes':[_0x566b('0x57')],'where':{'id':_0x5420a7[_0x566b('0x35')]},'raw':!![]})[_0x566b('0x2b')](function(_0x2d12b2){if(!_0x2d12b2)throw new db[(_0x566b('0x36'))]['ValidationError'](_0x566b('0x58'));var _0xb58143=Mustache[_0x566b('0x59')](_0x2d12b2[_0x566b('0x57')],_0x5420a7[_0x566b('0x39')]);_0x2be033(_0xb58143);})['catch'](function(_0x1ff1cc){_0x2d366a(_0x1ff1cc);});});}function getRecipients(_0xc8abf6){return new BPromise(function(_0x5d8336,_0x1733d5){var _0x1f754b=[];var _0x4505eb=[];_0xc8abf6[_0x566b('0x5a')](function(_0x38a235){var _0x2e2e6c=_['startCase'](_0x38a235['model'][_0x566b('0x5b')]());if(_0x2e2e6c==='User'){_0x1f754b=_['union'](_0x1f754b,_0x38a235['ids']);}else{if(_['includes'](_0x2e2e6c,'queue'))_0x2e2e6c=_0x2e2e6c[_0x566b('0x5c')](_0x566b('0x5d'),'Queue');_0x38a235[_0x566b('0x5e')][_0x566b('0x5a')](function(_0x29e4a4){_0x4505eb[_0x566b('0x5f')](getAgents(_0x2e2e6c,_0x29e4a4));});}});return BPromise[_0x566b('0x60')](_0x4505eb)[_0x566b('0x2b')](function(_0x4dbf35){_0x1f754b=_[_0x566b('0x61')](_0x1f754b,_[_0x566b('0x62')](_0x4dbf35));_0x5d8336(_0x1f754b);})[_0x566b('0x63')](function(_0x136596){_0x1733d5(_0x136596);});});}function getAgents(_0x5b58b0,_0x21624b){return new BPromise(function(_0x559367,_0x4d0e5f){return db[_0x5b58b0]['findOne']({'where':{'id':_0x21624b}})[_0x566b('0x2b')](function(_0x4b9158){return _0x4b9158[_0x566b('0x64')]({'attributes':['id'],'raw':!![]})[_0x566b('0x2b')](function(_0x1413ca){var _0x7d1f2c=_['map'](_0x1413ca,'id');_0x559367(_0x7d1f2c);});})[_0x566b('0x63')](function(_0x292319){_0x4d0e5f(_0x292319);});});} \ No newline at end of file +var _0x1e1f=['limit','undefined','count','set','reject','save','then','destroy','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','emit','catch','Template','html','render','view','startCase','User','union','includes','queue','replace','ids','push','all','flatten','findOne','getAgents','map','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','end','json'];(function(_0x4ad22b,_0x253a0b){var _0x56c227=function(_0x2a0a10){while(--_0x2a0a10){_0x4ad22b['push'](_0x4ad22b['shift']());}};_0x56c227(++_0x253a0b);}(_0x1e1f,0x158));var _0xf1e1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1e1f[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1e1('0x0'));var zipdir=require(_0xf1e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1e1('0x2'));var moment=require(_0xf1e1('0x3'));var BPromise=require(_0xf1e1('0x4'));var Mustache=require(_0xf1e1('0x5'));var util=require('util');var path=require(_0xf1e1('0x6'));var sox=require(_0xf1e1('0x7'));var csv=require(_0xf1e1('0x8'));var ejs=require(_0xf1e1('0x9'));var fs=require('fs');var fs_extra=require(_0xf1e1('0xa'));var _=require(_0xf1e1('0xb'));var squel=require(_0xf1e1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf1e1('0xd'));var toCsv=require(_0xf1e1('0x8'));var querystring=require(_0xf1e1('0xe'));var Papa=require(_0xf1e1('0xf'));var Redis=require(_0xf1e1('0x10'));var authService=require(_0xf1e1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf1e1('0x12'));var hardwareService=require(_0xf1e1('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf1e1('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf1e1('0x15')]=_['defaults'](config[_0xf1e1('0x15')],{'host':_0xf1e1('0x16'),'port':0x18eb});var socket=require(_0xf1e1('0x17'))(new Redis(config[_0xf1e1('0x15')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x55a12f,_0x2076f1){_0x2076f1=_0x2076f1||0xcc;return function(_0x350fa0){if(_0x350fa0){return _0x55a12f[_0xf1e1('0x18')](_0x2076f1);}return _0x55a12f[_0xf1e1('0x19')](_0x2076f1)[_0xf1e1('0x1a')]();};}function respondWithResult(_0x58b63a,_0x5d9b4b){_0x5d9b4b=_0x5d9b4b||0xc8;return function(_0x170f85){if(_0x170f85){return _0x58b63a[_0xf1e1('0x19')](_0x5d9b4b)[_0xf1e1('0x1b')](_0x170f85);}};}function respondWithFilteredResult(_0x359574,_0x42a450){return function(_0x559d9e){if(_0x559d9e){var _0x1c62c2=typeof _0x42a450['offset']==='undefined'&&typeof _0x42a450[_0xf1e1('0x1c')]===_0xf1e1('0x1d');var _0x419bea=_0x559d9e[_0xf1e1('0x1e')];var _0x507c3d=_0x1c62c2?0x0:_0x42a450['offset'];var _0x32a64e=_0x1c62c2?_0x559d9e[_0xf1e1('0x1e')]:_0x42a450['offset']+_0x42a450[_0xf1e1('0x1c')];var _0xfcc248;if(_0x32a64e>=_0x419bea){_0x32a64e=_0x419bea;_0xfcc248=0xc8;}else{_0xfcc248=0xce;}_0x359574[_0xf1e1('0x19')](_0xfcc248);return _0x359574[_0xf1e1('0x1f')]('Content-Range',_0x507c3d+'-'+_0x32a64e+'/'+_0x419bea)[_0xf1e1('0x1b')](_0x559d9e);}return null;};}function patchUpdates(_0x4acd7c){return function(_0x93d414){try{jsonpatch['apply'](_0x93d414,_0x4acd7c,!![]);}catch(_0x38da7c){return BPromise[_0xf1e1('0x20')](_0x38da7c);}return _0x93d414[_0xf1e1('0x21')]();};}function saveUpdates(_0x2b0f20,_0x5d8521){return function(_0x31f6ae){if(_0x31f6ae){return _0x31f6ae['update'](_0x2b0f20)[_0xf1e1('0x22')](function(_0x2927d3){return _0x2927d3;});}return null;};}function removeEntity(_0x3609ca,_0x447e89){return function(_0x1b50f8){if(_0x1b50f8){return _0x1b50f8[_0xf1e1('0x23')]()[_0xf1e1('0x22')](function(){_0x3609ca[_0xf1e1('0x19')](0xcc)[_0xf1e1('0x1a')]();});}};}function handleEntityNotFound(_0x12d398,_0x25d280){return function(_0x1c1c7b){if(!_0x1c1c7b){_0x12d398[_0xf1e1('0x18')](0x194);}return _0x1c1c7b;};}function handleError(_0x5a2ef6,_0x12d29a){_0x12d29a=_0x12d29a||0x1f4;return function(_0x5a20d4){logger[_0xf1e1('0x24')](_0x5a20d4['stack']);if(_0x5a20d4[_0xf1e1('0x25')]){delete _0x5a20d4[_0xf1e1('0x25')];}_0x5a2ef6[_0xf1e1('0x19')](_0x12d29a)['send'](_0x5a20d4);};}exports[_0xf1e1('0x26')]=function(_0x35c7a7,_0x372601,_0x2ccecc){if(!_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x28')](_0xf1e1('0x29'))&&!_0x35c7a7[_0xf1e1('0x27')]['hasOwnProperty'](_0xf1e1('0x2a'))){throw new db[(_0xf1e1('0x2b'))][(_0xf1e1('0x2c'))](_0xf1e1('0x2d'));}else{if(_0x35c7a7['body'][_0xf1e1('0x28')](_0xf1e1('0x2a'))&&!_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x28')]('view')){throw new db[(_0xf1e1('0x2b'))][(_0xf1e1('0x2c'))](_0xf1e1('0x2e'));}if(!_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x28')]('recipients')){throw new db[(_0xf1e1('0x2b'))][(_0xf1e1('0x2c'))](_0xf1e1('0x2f'));}else{try{var _0x413961=JSON[_0xf1e1('0x30')](_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x31')]);}catch(_0x36ff11){logger[_0xf1e1('0x24')](_0x36ff11);throw new db[(_0xf1e1('0x2b'))][(_0xf1e1('0x2c'))](_0xf1e1('0x32'));}var _0x2caf1c=['chatqueue',_0xf1e1('0x33'),_0xf1e1('0x34'),_0xf1e1('0x35'),_0xf1e1('0x36'),_0xf1e1('0x37'),_0xf1e1('0x38'),'team',_0xf1e1('0x39')];if(_[_0xf1e1('0x3a')](_0x413961,function(_0x2aae84){return!_['includes'](_0x2caf1c,_0x2aae84[_0xf1e1('0x3b')][_0xf1e1('0x3c')]());})){throw new db[(_0xf1e1('0x2b'))]['ValidationError'](_0xf1e1('0x3d'));}}}var _0x24cd9d={};_0x24cd9d[_0xf1e1('0x3e')]=_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x28')]('senderName')?_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x3e')]:_0x35c7a7[_0xf1e1('0x39')][_0xf1e1('0x3f')];_0x24cd9d[_0xf1e1('0x40')]=_['isEmpty'](_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x40')])?null:_0x35c7a7[_0xf1e1('0x27')]['recipientsDescription'];_0x24cd9d['beep']=_0x35c7a7[_0xf1e1('0x27')][_0xf1e1('0x41')]||![];_0x24cd9d['SenderId']=_0x35c7a7['user']['id'];return getContent(_0x35c7a7[_0xf1e1('0x27')])[_0xf1e1('0x22')](function(_0x3395b3){_0x24cd9d[_0xf1e1('0x27')]=_0x3395b3;return getRecipients(_0x413961);})[_0xf1e1('0x22')](function(_0x3401e9){_0x24cd9d[_0xf1e1('0x42')]=_[_0xf1e1('0x43')](_0x3401e9)[_0xf1e1('0x44')](',');return db[_0xf1e1('0x45')][_0xf1e1('0x46')](function(_0x5054d1){return db[_0xf1e1('0x47')][_0xf1e1('0x48')](_0x24cd9d,{'raw':!![],'transaction':_0x5054d1})[_0xf1e1('0x22')](function(_0x81a214){var _0x1c93b8={'sender':_0x24cd9d['senderName'],'description':_0x24cd9d[_0xf1e1('0x40')],'content':_0x24cd9d[_0xf1e1('0x27')],'beep':_0x24cd9d[_0xf1e1('0x41')]};_0x3401e9[_0xf1e1('0x49')](function(_0x28c7f3){_0x1c93b8['recipient']=_0x28c7f3;socket[_0xf1e1('0x4a')]('userNotification:send',_0x1c93b8);});return _0x81a214;});});})['then'](respondWithResult(_0x372601,0xc9))[_0xf1e1('0x4b')](handleError(_0x372601,null));};function getContent(_0x3dce19){return new BPromise(function(_0x3a2f32,_0x2916bd){if(_0x3dce19[_0xf1e1('0x29')]){_0x3a2f32(_0x3dce19[_0xf1e1('0x29')]);return;}return db[_0xf1e1('0x4c')]['findOne']({'attributes':[_0xf1e1('0x4d')],'where':{'id':_0x3dce19['TemplateId']},'raw':!![]})['then'](function(_0x27cd57){if(!_0x27cd57)throw new db[(_0xf1e1('0x2b'))][(_0xf1e1('0x2c'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x57631c=Mustache[_0xf1e1('0x4e')](_0x27cd57['html'],_0x3dce19[_0xf1e1('0x4f')]);_0x3a2f32(_0x57631c);})[_0xf1e1('0x4b')](function(_0x500fbd){_0x2916bd(_0x500fbd);});});}function getRecipients(_0x2ea296){return new BPromise(function(_0x24653f,_0x3de6f5){var _0xcc6c38=[];var _0x5eddac=[];_0x2ea296[_0xf1e1('0x49')](function(_0x56dc28){var _0x17d72f=_[_0xf1e1('0x50')](_0x56dc28[_0xf1e1('0x3b')][_0xf1e1('0x3c')]());if(_0x17d72f===_0xf1e1('0x51')){_0xcc6c38=_[_0xf1e1('0x52')](_0xcc6c38,_0x56dc28['ids']);}else{if(_[_0xf1e1('0x53')](_0x17d72f,_0xf1e1('0x54')))_0x17d72f=_0x17d72f[_0xf1e1('0x55')]('queue','Queue');_0x56dc28[_0xf1e1('0x56')][_0xf1e1('0x49')](function(_0x15f0e8){_0x5eddac[_0xf1e1('0x57')](getAgents(_0x17d72f,_0x15f0e8));});}});return BPromise[_0xf1e1('0x58')](_0x5eddac)[_0xf1e1('0x22')](function(_0x483215){_0xcc6c38=_['union'](_0xcc6c38,_[_0xf1e1('0x59')](_0x483215));_0x24653f(_0xcc6c38);})[_0xf1e1('0x4b')](function(_0x499922){_0x3de6f5(_0x499922);});});}function getAgents(_0x5e5ec8,_0x3ca3d8){return new BPromise(function(_0x2fd3b5,_0x36f296){return db[_0x5e5ec8][_0xf1e1('0x5a')]({'where':{'id':_0x3ca3d8}})[_0xf1e1('0x22')](function(_0x2f4739){return _0x2f4739[_0xf1e1('0x5b')]({'attributes':['id'],'raw':!![]})[_0xf1e1('0x22')](function(_0x497e46){var _0x144783=_[_0xf1e1('0x5c')](_0x497e46,'id');_0x2fd3b5(_0x144783);});})[_0xf1e1('0x4b')](function(_0x311d81){_0x36f296(_0x311d81);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 0212ef0..a276662 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 _0xff3b=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0xff3b,0x139));var _0xbff3=function(_0x29326a,_0x97a415){_0x29326a=_0x29326a-0x0;var _0x26e7da=_0xff3b[_0x29326a];return _0x26e7da;};'use strict';var EventEmitter=require(_0xbff3('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbff3('0x1')](0x0);var events={'afterCreate':_0xbff3('0x2'),'afterUpdate':_0xbff3('0x3'),'afterDestroy':_0xbff3('0x4')};function emitEvent(_0x543c5a){return function(_0x4e33cc,_0x380c2c,_0x1b815a){UserNotificationEvents[_0xbff3('0x5')](_0x543c5a+':'+_0x4e33cc['id'],_0x4e33cc);UserNotificationEvents[_0xbff3('0x5')](_0x543c5a,_0x4e33cc);_0x1b815a(null);};}for(var e in events){if(events[_0xbff3('0x6')](e)){var event=events[e];UserNotification[_0xbff3('0x7')](e,emitEvent(event));}}module[_0xbff3('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xdcfa=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xdcfa,0xf6));var _0xadcf=function(_0x151188,_0x2e00b5){_0x151188=_0x151188-0x0;var _0xf86c2b=_0xdcfa[_0x151188];return _0xf86c2b;};'use strict';var EventEmitter=require(_0xadcf('0x0'));var UserNotification=require(_0xadcf('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xadcf('0x2')](0x0);var events={'afterCreate':_0xadcf('0x3'),'afterUpdate':_0xadcf('0x4'),'afterDestroy':_0xadcf('0x5')};function emitEvent(_0x6454cf){return function(_0x3cea2e,_0x3cc2c7,_0x1df2a7){UserNotificationEvents[_0xadcf('0x6')](_0x6454cf+':'+_0x3cea2e['id'],_0x3cea2e);UserNotificationEvents[_0xadcf('0x6')](_0x6454cf,_0x3cea2e);_0x1df2a7(null);};}for(var e in events){if(events[_0xadcf('0x7')](e)){var event=events[e];UserNotification[_0xadcf('0x8')](e,emitEvent(event));}}module[_0xadcf('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 48a0660..299e84a 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 _0xea54=['userNotifications','utf8mb4_unicode_ci','../../config/logger','path','../../config/environment','exports','define','UserNotification'];(function(_0x43d1db,_0x5204dc){var _0x5e4558=function(_0x3f4f83){while(--_0x3f4f83){_0x43d1db['push'](_0x43d1db['shift']());}};_0x5e4558(++_0x5204dc);}(_0xea54,0x142));var _0x4ea5=function(_0x44bfe7,_0x265f7a){_0x44bfe7=_0x44bfe7-0x0;var _0x565d5d=_0xea54[_0x44bfe7];return _0x565d5d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ea5('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ea5('0x1'));var rimraf=require('rimraf');var config=require(_0x4ea5('0x2'));var attributes=require('./userNotification.attributes');module[_0x4ea5('0x3')]=function(_0xc3e1b4,_0x57b36e){return _0xc3e1b4[_0x4ea5('0x4')](_0x4ea5('0x5'),attributes,{'tableName':_0x4ea5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4ea5('0x7')});}; \ No newline at end of file +var _0xf908=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','./userNotification.attributes','exports','UserNotification','userNotifications'];(function(_0x38b8ee,_0x3e2a19){var _0x5dce7b=function(_0x331c0e){while(--_0x331c0e){_0x38b8ee['push'](_0x38b8ee['shift']());}};_0x5dce7b(++_0x3e2a19);}(_0xf908,0x1bd));var _0x8f90=function(_0x2f138c,_0x25a7d5){_0x2f138c=_0x2f138c-0x0;var _0x4c44f0=_0xf908[_0x2f138c];return _0x4c44f0;};'use strict';var _=require(_0x8f90('0x0'));var util=require(_0x8f90('0x1'));var logger=require(_0x8f90('0x2'))(_0x8f90('0x3'));var moment=require('moment');var BPromise=require(_0x8f90('0x4'));var rp=require(_0x8f90('0x5'));var fs=require('fs');var path=require(_0x8f90('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f90('0x7'));module[_0x8f90('0x8')]=function(_0x231a5c,_0x105887){return _0x231a5c['define'](_0x8f90('0x9'),attributes,{'tableName':_0x8f90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8f90('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7f5cd4b..463b8c6 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 _0x9902=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x4b1434,_0x1fa900){var _0x9870da=function(_0x1e9432){while(--_0x1e9432){_0x4b1434['push'](_0x4b1434['shift']());}};_0x9870da(++_0x1fa900);}(_0x9902,0xac));var _0x2990=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9902[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x2990('0x0'));var util=require('util');var moment=require(_0x2990('0x1'));var BPromise=require(_0x2990('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2990('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2990('0x4'));var logger=require(_0x2990('0x5'))(_0x2990('0x6'));var config=require('../../config/environment');var jayson=require(_0x2990('0x7'));var client=jayson[_0x2990('0x8')][_0x2990('0x9')]({'port':0x232a});config[_0x2990('0xa')]=_[_0x2990('0xb')](config[_0x2990('0xa')],{'host':_0x2990('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2990('0xa')]));require(_0x2990('0xd'))[_0x2990('0xe')](socket);function respondWithRpcPromise(_0x40d6e2,_0x41ab25,_0x9b06fb){return new BPromise(function(_0x2c7319,_0x46a2bd){return client[_0x2990('0xf')](_0x40d6e2,_0x9b06fb)[_0x2990('0x10')](function(_0x56928d){logger['info'](_0x2990('0x11'),_0x41ab25,_0x2990('0x12'));logger['debug'](_0x2990('0x13'),_0x41ab25,_0x2990('0x12'),JSON['stringify'](_0x56928d));if(_0x56928d['error']){if(_0x56928d[_0x2990('0x14')][_0x2990('0x15')]===0x1f4){logger[_0x2990('0x14')](_0x2990('0x11'),_0x41ab25,_0x56928d[_0x2990('0x14')][_0x2990('0x16')]);return _0x46a2bd(_0x56928d[_0x2990('0x14')][_0x2990('0x16')]);}logger['error'](_0x2990('0x11'),_0x41ab25,_0x56928d[_0x2990('0x14')]['message']);return _0x2c7319(_0x56928d[_0x2990('0x14')][_0x2990('0x16')]);}else{logger['info'](_0x2990('0x11'),_0x41ab25,_0x2990('0x12'));_0x2c7319(_0x56928d[_0x2990('0x17')]['message']);}})[_0x2990('0x18')](function(_0x3643e9){logger['error'](_0x2990('0x11'),_0x41ab25,_0x3643e9);_0x46a2bd(_0x3643e9);});});} \ No newline at end of file +var _0x7c3f=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x428c50,_0x49dc7a){var _0x3779b6=function(_0x2f1274){while(--_0x2f1274){_0x428c50['push'](_0x428c50['shift']());}};_0x3779b6(++_0x49dc7a);}(_0x7c3f,0x192));var _0xf7c3=function(_0x160ec9,_0x169902){_0x160ec9=_0x160ec9-0x0;var _0xf1fa69=_0x7c3f[_0x160ec9];return _0xf1fa69;};'use strict';var _=require(_0xf7c3('0x0'));var util=require('util');var moment=require(_0xf7c3('0x1'));var BPromise=require(_0xf7c3('0x2'));var rs=require(_0xf7c3('0x3'));var fs=require('fs');var Redis=require(_0xf7c3('0x4'));var db=require(_0xf7c3('0x5'))['db'];var utils=require(_0xf7c3('0x6'));var logger=require(_0xf7c3('0x7'))(_0xf7c3('0x8'));var config=require(_0xf7c3('0x9'));var jayson=require(_0xf7c3('0xa'));var client=jayson['client'][_0xf7c3('0xb')]({'port':0x232a});config[_0xf7c3('0xc')]=_['defaults'](config[_0xf7c3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf7c3('0xd'))(new Redis(config[_0xf7c3('0xc')]));require(_0xf7c3('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f63ee,_0x31d6dd,_0x2fc196){return new BPromise(function(_0x141c0f,_0x5b3ba9){return client[_0xf7c3('0xf')](_0x3f63ee,_0x2fc196)[_0xf7c3('0x10')](function(_0x43edc1){logger[_0xf7c3('0x11')](_0xf7c3('0x12'),_0x31d6dd,_0xf7c3('0x13'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x31d6dd,_0xf7c3('0x13'),JSON[_0xf7c3('0x14')](_0x43edc1));if(_0x43edc1[_0xf7c3('0x15')]){if(_0x43edc1['error']['code']===0x1f4){logger[_0xf7c3('0x15')]('UserNotification,\x20%s,\x20%s',_0x31d6dd,_0x43edc1[_0xf7c3('0x15')][_0xf7c3('0x16')]);return _0x5b3ba9(_0x43edc1['error'][_0xf7c3('0x16')]);}logger['error'](_0xf7c3('0x12'),_0x31d6dd,_0x43edc1[_0xf7c3('0x15')]['message']);return _0x141c0f(_0x43edc1['error'][_0xf7c3('0x16')]);}else{logger[_0xf7c3('0x11')](_0xf7c3('0x12'),_0x31d6dd,_0xf7c3('0x13'));_0x141c0f(_0x43edc1[_0xf7c3('0x17')][_0xf7c3('0x16')]);}})[_0xf7c3('0x18')](function(_0x3b1bc4){logger[_0xf7c3('0x15')](_0xf7c3('0x12'),_0x31d6dd,_0x3b1bc4);_0x5b3ba9(_0x3b1bc4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8a3d6f5..7cb84f9 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 _0xd8e1=['emit','removeListener','length','userNotification:','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8e1,0xee));var _0x1d8e=function(_0x3f0c05,_0xc35686){_0x3f0c05=_0x3f0c05-0x0;var _0x1642af=_0xd8e1[_0x3f0c05];return _0x1642af;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1d8e('0x0'),_0x1d8e('0x1'),'update'];function createListener(_0x2ef48c,_0x32e5da){return function(_0x22e2da){_0x32e5da[_0x1d8e('0x2')](_0x2ef48c,_0x22e2da);};}function removeListener(_0x27b4cd,_0x5672e3){return function(){UserNotificationEvents[_0x1d8e('0x3')](_0x27b4cd,_0x5672e3);};}exports['register']=function(_0x5e90c9){for(var _0x42521b=0x0,_0xdbc50d=events[_0x1d8e('0x4')];_0x42521b<_0xdbc50d;_0x42521b++){var _0xce0faf=events[_0x42521b];var _0x2b399e=createListener(_0x1d8e('0x5')+_0xce0faf,_0x5e90c9);UserNotificationEvents['on'](_0xce0faf,_0x2b399e);}}; \ No newline at end of file +var _0xd8c1=['removeListener','register','userNotification:','save','remove','update','emit'];(function(_0x50912b,_0x1ff644){var _0x39a9b1=function(_0x4b466a){while(--_0x4b466a){_0x50912b['push'](_0x50912b['shift']());}};_0x39a9b1(++_0x1ff644);}(_0xd8c1,0x176));var _0x1d8c=function(_0xa57717,_0x4a4afe){_0xa57717=_0xa57717-0x0;var _0x11c797=_0xd8c1[_0xa57717];return _0x11c797;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1d8c('0x0'),_0x1d8c('0x1'),_0x1d8c('0x2')];function createListener(_0x3833d5,_0x4b10df){return function(_0x3e985f){_0x4b10df[_0x1d8c('0x3')](_0x3833d5,_0x3e985f);};}function removeListener(_0x702067,_0x1e203b){return function(){UserNotificationEvents[_0x1d8c('0x4')](_0x702067,_0x1e203b);};}exports[_0x1d8c('0x5')]=function(_0x4e2009){for(var _0x5c7f2b=0x0,_0x54af72=events['length'];_0x5c7f2b<_0x54af72;_0x5c7f2b++){var _0x280c6a=events[_0x5c7f2b];var _0x53169a=createListener(_0x1d8c('0x6')+_0x280c6a,_0x4e2009);UserNotificationEvents['on'](_0x280c6a,_0x53169a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 026c0ee..feddc18 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x22f2e9,_0x475d3c){var _0xc9f7cd=function(_0x3a1555){while(--_0x3a1555){_0x22f2e9['push'](_0x22f2e9['shift']());}};_0xc9f7cd(++_0x475d3c);}(_0xedd9,0xfc));var _0x9edd=function(_0x3351f0,_0x7b3fbe){_0x3351f0=_0x3351f0-0x0;var _0x56228b=_0xedd9[_0x3351f0];return _0x56228b;};'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(_0x3c330d,_0x4488d7){var _0x4be4eb=function(_0x50d7a9){while(--_0x50d7a9){_0x3c330d['push'](_0x3c330d['shift']());}};_0x4be4eb(++_0x4488d7);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0e702ed..ac64340 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 _0x7631=['sequelize','INTEGER'];(function(_0x304fd7,_0x34e584){var _0x407ed8=function(_0x7fa10f){while(--_0x7fa10f){_0x304fd7['push'](_0x304fd7['shift']());}};_0x407ed8(++_0x34e584);}(_0x7631,0x108));var _0x1763=function(_0x91953d,_0x4565e7){_0x91953d=_0x91953d-0x0;var _0x365cd8=_0x7631[_0x91953d];return _0x365cd8;};'use strict';var Sequelize=require(_0x1763('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1763('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x05a6=['exports','INTEGER','sequelize'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x05a6,0x8c));var _0x605a=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0x05a6[_0x2e53e1];return _0x3a23de;};'use strict';var Sequelize=require(_0x605a('0x0'));module[_0x605a('0x1')]={'penalty':{'type':Sequelize[_0x605a('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 b546079..97e2271 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 _0x936e=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x936e,0xb6));var _0xe936=function(_0x3f4875,_0x1eee06){_0x3f4875=_0x3f4875-0x0;var _0x1727cf=_0x936e[_0x3f4875];return _0x1727cf;};'use strict';var _=require(_0xe936('0x0'));var util=require(_0xe936('0x1'));var logger=require('../../config/logger')(_0xe936('0x2'));var moment=require(_0xe936('0x3'));var BPromise=require(_0xe936('0x4'));var rp=require(_0xe936('0x5'));var fs=require('fs');var path=require(_0xe936('0x6'));var rimraf=require(_0xe936('0x7'));var config=require(_0xe936('0x8'));var attributes=require(_0xe936('0x9'));module[_0xe936('0xa')]=function(_0x149141,_0x191a23){return _0x149141[_0xe936('0xb')](_0xe936('0xc'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a1b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue'];(function(_0x1138c4,_0x841d33){var _0x200cc1=function(_0x2f6d85){while(--_0x2f6d85){_0x1138c4['push'](_0x1138c4['shift']());}};_0x200cc1(++_0x841d33);}(_0x2a1b,0x82));var _0xb2a1=function(_0x65a54,_0x2251e0){_0x65a54=_0x65a54-0x0;var _0xce414d=_0x2a1b[_0x65a54];return _0xce414d;};'use strict';var _=require(_0xb2a1('0x0'));var util=require(_0xb2a1('0x1'));var logger=require(_0xb2a1('0x2'))(_0xb2a1('0x3'));var moment=require(_0xb2a1('0x4'));var BPromise=require(_0xb2a1('0x5'));var rp=require(_0xb2a1('0x6'));var fs=require('fs');var path=require(_0xb2a1('0x7'));var rimraf=require(_0xb2a1('0x8'));var config=require(_0xb2a1('0x9'));var attributes=require(_0xb2a1('0xa'));module['exports']=function(_0x54c72b,_0x52d9d3){return _0x54c72b[_0xb2a1('0xb')](_0xb2a1('0xc'),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 d5d4f9a..59a4886 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 _0xd524=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash'];(function(_0xa41d25,_0x16df43){var _0x3278de=function(_0x4e0001){while(--_0x4e0001){_0xa41d25['push'](_0xa41d25['shift']());}};_0x3278de(++_0x16df43);}(_0xd524,0x11c));var _0x4d52=function(_0xa24477,_0x224ba5){_0xa24477=_0xa24477-0x0;var _0x3ade21=_0xd524[_0xa24477];return _0x3ade21;};'use strict';var _=require(_0x4d52('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4d52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d52('0x2'));var db=require(_0x4d52('0x3'))['db'];var utils=require(_0x4d52('0x4'));var logger=require(_0x4d52('0x5'))('rpc');var config=require(_0x4d52('0x6'));var jayson=require(_0x4d52('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x581490,_0x15cb57,_0x56654b){return new BPromise(function(_0x19965c,_0x115368){return client[_0x4d52('0x8')](_0x581490,_0x56654b)[_0x4d52('0x9')](function(_0x19a05f){logger['info'](_0x4d52('0xa'),_0x15cb57,_0x4d52('0xb'));logger[_0x4d52('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x15cb57,_0x4d52('0xb'),JSON[_0x4d52('0xd')](_0x19a05f));if(_0x19a05f[_0x4d52('0xe')]){if(_0x19a05f[_0x4d52('0xe')][_0x4d52('0xf')]===0x1f4){logger[_0x4d52('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x15cb57,_0x19a05f[_0x4d52('0xe')][_0x4d52('0x10')]);return _0x115368(_0x19a05f[_0x4d52('0xe')][_0x4d52('0x10')]);}logger['error'](_0x4d52('0xa'),_0x15cb57,_0x19a05f[_0x4d52('0xe')][_0x4d52('0x10')]);return _0x19965c(_0x19a05f[_0x4d52('0xe')]['message']);}else{logger[_0x4d52('0x11')](_0x4d52('0xa'),_0x15cb57,_0x4d52('0xb'));_0x19965c(_0x19a05f['result']['message']);}})[_0x4d52('0x12')](function(_0x314e3b){logger[_0x4d52('0xe')](_0x4d52('0xa'),_0x15cb57,_0x314e3b);_0x115368(_0x314e3b);});});} \ No newline at end of file +var _0x8378=['debug','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0x4b53db,_0xe83b06){var _0xf99647=function(_0x3c6bf1){while(--_0x3c6bf1){_0x4b53db['push'](_0x4b53db['shift']());}};_0xf99647(++_0xe83b06);}(_0x8378,0xef));var _0x8837=function(_0x17b725,_0x413e02){_0x17b725=_0x17b725-0x0;var _0x5f2087=_0x8378[_0x17b725];return _0x5f2087;};'use strict';var _=require(_0x8837('0x0'));var util=require(_0x8837('0x1'));var moment=require(_0x8837('0x2'));var BPromise=require(_0x8837('0x3'));var rs=require(_0x8837('0x4'));var fs=require('fs');var Redis=require(_0x8837('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8837('0x6'));var logger=require('../../config/logger')(_0x8837('0x7'));var config=require(_0x8837('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8837('0x9')][_0x8837('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dcaa9,_0x2fb131,_0x1c67c1){return new BPromise(function(_0x112353,_0x1a5f9f){return client[_0x8837('0xb')](_0x2dcaa9,_0x1c67c1)['then'](function(_0xfb2120){logger[_0x8837('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2fb131,'request\x20sent');logger[_0x8837('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2fb131,'request\x20sent',JSON[_0x8837('0xe')](_0xfb2120));if(_0xfb2120[_0x8837('0xf')]){if(_0xfb2120[_0x8837('0xf')]['code']===0x1f4){logger[_0x8837('0xf')](_0x8837('0x10'),_0x2fb131,_0xfb2120['error']['message']);return _0x1a5f9f(_0xfb2120[_0x8837('0xf')][_0x8837('0x11')]);}logger[_0x8837('0xf')](_0x8837('0x10'),_0x2fb131,_0xfb2120[_0x8837('0xf')][_0x8837('0x11')]);return _0x112353(_0xfb2120[_0x8837('0xf')]['message']);}else{logger['info'](_0x8837('0x10'),_0x2fb131,_0x8837('0x12'));_0x112353(_0xfb2120[_0x8837('0x13')][_0x8837('0x11')]);}})[_0x8837('0x14')](function(_0x11c8ea){logger[_0x8837('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2fb131,_0x11c8ea);_0x1a5f9f(_0x11c8ea);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7565e2c..dc4f3c0 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 _0x2d5c=['get','index','isAuthenticated','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','addResources','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x2d5c,0x88));var _0xc2d5=function(_0xd03260,_0x25260a){_0xd03260=_0xd03260-0x0;var _0x19101e=_0x2d5c[_0xd03260];return _0x19101e;};'use strict';var multer=require(_0xc2d5('0x0'));var util=require(_0xc2d5('0x1'));var path=require(_0xc2d5('0x2'));var timeout=require(_0xc2d5('0x3'));var express=require(_0xc2d5('0x4'));var router=express[_0xc2d5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc2d5('0x6'));var config=require(_0xc2d5('0x7'));var controller=require(_0xc2d5('0x8'));router[_0xc2d5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc2d5('0xa')]);router[_0xc2d5('0x9')]('/describe',auth[_0xc2d5('0xb')](),controller['describe']);router[_0xc2d5('0x9')]('/:id',auth[_0xc2d5('0xb')](),controller[_0xc2d5('0xc')]);router[_0xc2d5('0x9')](_0xc2d5('0xd'),auth[_0xc2d5('0xb')](),controller[_0xc2d5('0xe')]);router[_0xc2d5('0x9')](_0xc2d5('0xf'),auth[_0xc2d5('0xb')](),controller[_0xc2d5('0x10')]);router[_0xc2d5('0x11')]('/',auth[_0xc2d5('0xb')](),controller['create']);router['post'](_0xc2d5('0x12'),auth[_0xc2d5('0xb')](),controller[_0xc2d5('0x13')]);router[_0xc2d5('0x11')](_0xc2d5('0xd'),auth[_0xc2d5('0xb')](),controller[_0xc2d5('0x14')]);router['post'](_0xc2d5('0xf'),auth[_0xc2d5('0xb')](),controller[_0xc2d5('0x15')]);router['put'](_0xc2d5('0x16'),auth['isAuthenticated'](),controller[_0xc2d5('0x17')]);router[_0xc2d5('0x18')](_0xc2d5('0x16'),auth[_0xc2d5('0xb')](),controller[_0xc2d5('0x19')]);router[_0xc2d5('0x18')](_0xc2d5('0xd'),auth[_0xc2d5('0xb')](),controller[_0xc2d5('0x1a')]);router[_0xc2d5('0x18')](_0xc2d5('0xf'),auth['isAuthenticated'](),controller[_0xc2d5('0x1b')]);module[_0xc2d5('0x1c')]=router; \ No newline at end of file +var _0x4796=['get','isAuthenticated','index','/describe','describe','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','/:id','update','delete','destroy','removeResources','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4796,0x18e));var _0x6479=function(_0x5939b1,_0xdaa9c3){_0x5939b1=_0x5939b1-0x0;var _0x3db38b=_0x4796[_0x5939b1];return _0x3db38b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6479('0x0'));var timeout=require('connect-timeout');var express=require(_0x6479('0x1'));var router=express['Router']();var fs_extra=require(_0x6479('0x2'));var auth=require(_0x6479('0x3'));var interaction=require(_0x6479('0x4'));var config=require(_0x6479('0x5'));var controller=require(_0x6479('0x6'));router[_0x6479('0x7')]('/',auth[_0x6479('0x8')](),controller[_0x6479('0x9')]);router[_0x6479('0x7')](_0x6479('0xa'),auth[_0x6479('0x8')](),controller[_0x6479('0xb')]);router['get']('/:id',auth[_0x6479('0x8')](),controller['show']);router[_0x6479('0x7')](_0x6479('0xc'),auth['isAuthenticated'](),controller['getSections']);router[_0x6479('0x7')](_0x6479('0xd'),auth[_0x6479('0x8')](),controller[_0x6479('0xe')]);router[_0x6479('0xf')]('/',auth[_0x6479('0x8')](),controller[_0x6479('0x10')]);router[_0x6479('0xf')](_0x6479('0x11'),auth[_0x6479('0x8')](),controller['clone']);router['post'](_0x6479('0xc'),auth[_0x6479('0x8')](),controller[_0x6479('0x12')]);router[_0x6479('0xf')](_0x6479('0xd'),auth[_0x6479('0x8')](),controller[_0x6479('0x13')]);router[_0x6479('0x14')](_0x6479('0x15'),auth[_0x6479('0x8')](),controller[_0x6479('0x16')]);router[_0x6479('0x17')](_0x6479('0x15'),auth[_0x6479('0x8')](),controller[_0x6479('0x18')]);router[_0x6479('0x17')](_0x6479('0xc'),auth[_0x6479('0x8')](),controller['removeSections']);router[_0x6479('0x17')](_0x6479('0xd'),auth['isAuthenticated'](),controller[_0x6479('0x19')]);module[_0x6479('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 05dd83f..47fa858 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 _0xb38c=['split','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x10e275,_0x38bddd){var _0x5007c7=function(_0x35ae4d){while(--_0x35ae4d){_0x10e275['push'](_0x10e275['shift']());}};_0x5007c7(++_0x38bddd);}(_0xb38c,0x12b));var _0xcb38=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0xb38c[_0xe1a3a5];return _0x362646;};'use strict';var Sequelize=require(_0xcb38('0x0'));module[_0xcb38('0x1')]={'name':{'type':Sequelize[_0xcb38('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xc77b55){this[_0xcb38('0x3')](_0xcb38('0x4'),_0xc77b55?_0xc77b55[_0xcb38('0x5')](''):[]);},'get':function(){return this[_0xcb38('0x6')](_0xcb38('0x4'))?this[_0xcb38('0x6')](_0xcb38('0x4'))[_0xcb38('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcb38('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcb38('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcb38('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcb38('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcb38('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcb38('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcb38('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa2ea=['STRING','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name'];(function(_0x3a3f4c,_0x327d36){var _0x4a5e5e=function(_0x997c82){while(--_0x997c82){_0x3a3f4c['push'](_0x3a3f4c['shift']());}};_0x4a5e5e(++_0x327d36);}(_0xa2ea,0xd5));var _0xaa2e=function(_0x5600ba,_0xe51f7c){_0x5600ba=_0x5600ba-0x0;var _0x2db0f1=_0xa2ea[_0x5600ba];return _0x2db0f1;};'use strict';var Sequelize=require(_0xaa2e('0x0'));module[_0xaa2e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaa2e('0x2')},'crudPermissions':{'type':Sequelize[_0xaa2e('0x3')],'set':function(_0x52f889){this['setDataValue'](_0xaa2e('0x4'),_0x52f889?_0x52f889[_0xaa2e('0x5')](''):[]);},'get':function(){return this[_0xaa2e('0x6')](_0xaa2e('0x4'))?this['getDataValue']('crudPermissions')[_0xaa2e('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xaa2e('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xaa2e('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xaa2e('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xaa2e('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xaa2e('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xaa2e('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 24755ae..5eafde7 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 _0x6e9a=['describe','addSections','sequelize','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','reject','then','destroy','error','stack','name','index','map','UserProfile','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update'];(function(_0x3b4493,_0x106e71){var _0x28fc72=function(_0x1c6ec5){while(--_0x1c6ec5){_0x3b4493['push'](_0x3b4493['shift']());}};_0x28fc72(++_0x106e71);}(_0x6e9a,0xfd));var _0xa6e9=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x6e9a[_0x5a8aa3];return _0x5d0458;};'use strict';var emlformat=require(_0xa6e9('0x0'));var rimraf=require(_0xa6e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6e9('0x2'));var rp=require(_0xa6e9('0x3'));var moment=require(_0xa6e9('0x4'));var BPromise=require(_0xa6e9('0x5'));var Mustache=require(_0xa6e9('0x6'));var util=require('util');var path=require(_0xa6e9('0x7'));var sox=require(_0xa6e9('0x8'));var csv=require(_0xa6e9('0x9'));var ejs=require(_0xa6e9('0xa'));var fs=require('fs');var fs_extra=require(_0xa6e9('0xb'));var _=require(_0xa6e9('0xc'));var squel=require(_0xa6e9('0xd'));var crypto=require(_0xa6e9('0xe'));var jsforce=require(_0xa6e9('0xf'));var deskjs=require(_0xa6e9('0x10'));var toCsv=require(_0xa6e9('0x9'));var querystring=require(_0xa6e9('0x11'));var Papa=require(_0xa6e9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6e9('0x14'))(_0xa6e9('0x15'));var utils=require(_0xa6e9('0x16'));var config=require(_0xa6e9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa6e9('0x18'))['db'];config['redis']=_[_0xa6e9('0x19')](config['redis'],{'host':_0xa6e9('0x1a'),'port':0x18eb});var socket=require(_0xa6e9('0x1b'))(new Redis(config['redis']));require(_0xa6e9('0x1c'))['register'](socket);function respondWithStatusCode(_0xb6495e,_0x7e6683){_0x7e6683=_0x7e6683||0xcc;return function(_0xb77b03){if(_0xb77b03){return _0xb6495e[_0xa6e9('0x1d')](_0x7e6683);}return _0xb6495e[_0xa6e9('0x1e')](_0x7e6683)[_0xa6e9('0x1f')]();};}function respondWithResult(_0x5146b7,_0x19a401){_0x19a401=_0x19a401||0xc8;return function(_0x70ada2){if(_0x70ada2){return _0x5146b7[_0xa6e9('0x1e')](_0x19a401)[_0xa6e9('0x20')](_0x70ada2);}};}function respondWithFilteredResult(_0x5cfa12,_0x5573b2){return function(_0xd897a){if(_0xd897a){var _0x46077c=typeof _0x5573b2['offset']===_0xa6e9('0x21')&&typeof _0x5573b2['limit']==='undefined';var _0x213a5b=_0xd897a['count'];var _0x5ea45b=_0x46077c?0x0:_0x5573b2[_0xa6e9('0x22')];var _0x47aa00=_0x46077c?_0xd897a['count']:_0x5573b2[_0xa6e9('0x22')]+_0x5573b2[_0xa6e9('0x23')];var _0x34fb64;if(_0x47aa00>=_0x213a5b){_0x47aa00=_0x213a5b;_0x34fb64=0xc8;}else{_0x34fb64=0xce;}_0x5cfa12[_0xa6e9('0x1e')](_0x34fb64);return _0x5cfa12[_0xa6e9('0x24')](_0xa6e9('0x25'),_0x5ea45b+'-'+_0x47aa00+'/'+_0x213a5b)['json'](_0xd897a);}return null;};}function patchUpdates(_0x30d53c){return function(_0x558653){try{jsonpatch['apply'](_0x558653,_0x30d53c,!![]);}catch(_0x1f8567){return BPromise[_0xa6e9('0x26')](_0x1f8567);}return _0x558653['save']();};}function saveUpdates(_0x230113,_0x29240b){return function(_0x2a9a6b){if(_0x2a9a6b){return _0x2a9a6b['update'](_0x230113)[_0xa6e9('0x27')](function(_0x3138bf){return _0x3138bf;});}return null;};}function removeEntity(_0x3141df,_0x15bd82){return function(_0x398647){if(_0x398647){return _0x398647[_0xa6e9('0x28')]()[_0xa6e9('0x27')](function(){_0x3141df[_0xa6e9('0x1e')](0xcc)[_0xa6e9('0x1f')]();});}};}function handleEntityNotFound(_0xd9400c,_0x91aa8b){return function(_0x27357c){if(!_0x27357c){_0xd9400c[_0xa6e9('0x1d')](0x194);}return _0x27357c;};}function handleError(_0x5c7d98,_0x393666){_0x393666=_0x393666||0x1f4;return function(_0x3c1894){logger[_0xa6e9('0x29')](_0x3c1894[_0xa6e9('0x2a')]);if(_0x3c1894[_0xa6e9('0x2b')]){delete _0x3c1894[_0xa6e9('0x2b')];}_0x5c7d98['status'](_0x393666)['send'](_0x3c1894);};}exports[_0xa6e9('0x2c')]=function(_0x4ef450,_0x3a637c){var _0x5ec61b={},_0x53e12a={},_0xfd9a30={'count':0x0,'rows':[]};var _0x22c162=_[_0xa6e9('0x2d')](db[_0xa6e9('0x2e')][_0xa6e9('0x2f')],function(_0x413f77){return{'name':_0x413f77['fieldName'],'type':_0x413f77[_0xa6e9('0x30')][_0xa6e9('0x31')]};});_0x53e12a['model']=_[_0xa6e9('0x2d')](_0x22c162,'name');_0x53e12a[_0xa6e9('0x32')]=_['keys'](_0x4ef450[_0xa6e9('0x32')]);_0x53e12a[_0xa6e9('0x33')]=_[_0xa6e9('0x34')](_0x53e12a[_0xa6e9('0x35')],_0x53e12a[_0xa6e9('0x32')]);_0x5ec61b[_0xa6e9('0x36')]=_[_0xa6e9('0x34')](_0x53e12a[_0xa6e9('0x35')],qs[_0xa6e9('0x37')](_0x4ef450[_0xa6e9('0x32')][_0xa6e9('0x37')]));_0x5ec61b[_0xa6e9('0x36')]=_0x5ec61b[_0xa6e9('0x36')]['length']?_0x5ec61b['attributes']:_0x53e12a[_0xa6e9('0x35')];if(!_0x4ef450['query'][_0xa6e9('0x38')]('nolimit')){_0x5ec61b[_0xa6e9('0x23')]=qs[_0xa6e9('0x23')](_0x4ef450[_0xa6e9('0x32')]['limit']);_0x5ec61b[_0xa6e9('0x22')]=qs['offset'](_0x4ef450[_0xa6e9('0x32')]['offset']);}_0x5ec61b[_0xa6e9('0x39')]=qs[_0xa6e9('0x3a')](_0x4ef450[_0xa6e9('0x32')]['sort']);_0x5ec61b[_0xa6e9('0x3b')]=qs[_0xa6e9('0x33')](_[_0xa6e9('0x3c')](_0x4ef450[_0xa6e9('0x32')],_0x53e12a[_0xa6e9('0x33')]),_0x22c162);if(_0x4ef450['query'][_0xa6e9('0x3d')]){_0x5ec61b[_0xa6e9('0x3b')]=_['merge'](_0x5ec61b['where'],{'$or':_[_0xa6e9('0x2d')](_0x22c162,function(_0x3481ee){if(_0x3481ee[_0xa6e9('0x30')]!=='VIRTUAL'){var _0x466ef5={};_0x466ef5[_0x3481ee[_0xa6e9('0x2b')]]={'$like':'%'+_0x4ef450[_0xa6e9('0x32')]['filter']+'%'};return _0x466ef5;}})});}_0x5ec61b=_[_0xa6e9('0x3e')]({},_0x5ec61b,_0x4ef450['options']);var _0x1944e3={'where':_0x5ec61b[_0xa6e9('0x3b')]};return db[_0xa6e9('0x2e')][_0xa6e9('0x3f')](_0x1944e3)[_0xa6e9('0x27')](function(_0x4730a5){_0xfd9a30[_0xa6e9('0x3f')]=_0x4730a5;if(_0x4ef450[_0xa6e9('0x32')][_0xa6e9('0x40')]){_0x5ec61b[_0xa6e9('0x41')]=[{'all':!![]}];}return db[_0xa6e9('0x2e')][_0xa6e9('0x42')](_0x5ec61b);})[_0xa6e9('0x27')](function(_0x2136b6){_0xfd9a30[_0xa6e9('0x43')]=_0x2136b6;return _0xfd9a30;})['then'](respondWithFilteredResult(_0x3a637c,_0x5ec61b))[_0xa6e9('0x44')](handleError(_0x3a637c,null));};exports[_0xa6e9('0x45')]=function(_0x19946c,_0x1a552a){var _0x4f7a1d={'raw':![],'where':{'id':_0x19946c[_0xa6e9('0x46')]['id']}},_0xbe7d41={};_0xbe7d41[_0xa6e9('0x35')]=_[_0xa6e9('0x47')](db['UserProfile'][_0xa6e9('0x2f')]);_0xbe7d41[_0xa6e9('0x32')]=_['keys'](_0x19946c['query']);_0xbe7d41[_0xa6e9('0x33')]=_['intersection'](_0xbe7d41[_0xa6e9('0x35')],_0xbe7d41[_0xa6e9('0x32')]);_0x4f7a1d[_0xa6e9('0x36')]=_['intersection'](_0xbe7d41[_0xa6e9('0x35')],qs[_0xa6e9('0x37')](_0x19946c['query'][_0xa6e9('0x37')]));_0x4f7a1d[_0xa6e9('0x36')]=_0x4f7a1d[_0xa6e9('0x36')][_0xa6e9('0x48')]?_0x4f7a1d[_0xa6e9('0x36')]:_0xbe7d41[_0xa6e9('0x35')];if(_0x19946c[_0xa6e9('0x32')]['includeAll']){_0x4f7a1d[_0xa6e9('0x41')]=[{'all':!![]}];}_0x4f7a1d=_[_0xa6e9('0x3e')]({},_0x4f7a1d,_0x19946c[_0xa6e9('0x49')]);return db[_0xa6e9('0x2e')][_0xa6e9('0x4a')](_0x4f7a1d)[_0xa6e9('0x27')](handleEntityNotFound(_0x1a552a,null))[_0xa6e9('0x27')](respondWithResult(_0x1a552a,null))[_0xa6e9('0x44')](handleError(_0x1a552a,null));};exports['create']=function(_0xae4991,_0x570b7c){return db['UserProfile'][_0xa6e9('0x4b')](_0xae4991[_0xa6e9('0x4c')],{})[_0xa6e9('0x27')](respondWithResult(_0x570b7c,0xc9))[_0xa6e9('0x44')](handleError(_0x570b7c,null));};exports[_0xa6e9('0x4d')]=function(_0x5764ec,_0x44d577){var _0xc2dd1c={'where':{'id':_0x5764ec[_0xa6e9('0x46')]['id']}},_0x6107ea={};_0x6107ea[_0xa6e9('0x35')]=_['keys'](db[_0xa6e9('0x2e')][_0xa6e9('0x2f')]);_0xc2dd1c['attributes']=_['intersection'](_0x6107ea[_0xa6e9('0x35')],qs['fields'](_0x5764ec['query'][_0xa6e9('0x37')]));_0xc2dd1c['attributes']=_0xc2dd1c[_0xa6e9('0x36')]['length']?_0xc2dd1c['attributes']:_0x6107ea[_0xa6e9('0x35')];if(_0x5764ec[_0xa6e9('0x32')][_0xa6e9('0x40')]){_0xc2dd1c[_0xa6e9('0x41')]=[{'all':!![]}];}_0xc2dd1c=_[_0xa6e9('0x3e')]({},_0xc2dd1c,_0x5764ec[_0xa6e9('0x49')]);return db[_0xa6e9('0x2e')][_0xa6e9('0x4a')](_0xc2dd1c)[_0xa6e9('0x27')](handleEntityNotFound(_0x44d577,null))[_0xa6e9('0x27')](function(_0x245441){if(_0x245441){var _0x2c37e3=_0x245441[_0xa6e9('0x4e')]({'plain':!![]});_0x2c37e3=qs[_0xa6e9('0x4f')](_0x2c37e3,['id',_0xa6e9('0x50'),_0xa6e9('0x51'),_0xa6e9('0x52')]);_0x5764ec[_0xa6e9('0x4c')]=_[_0xa6e9('0x4f')](_0x5764ec['body'],['id',_0xa6e9('0x50'),'updatedAt']);return db['sequelize'][_0xa6e9('0x53')](function(_0x19a415){return db[_0xa6e9('0x2e')]['create'](_[_0xa6e9('0x3e')](_0x2c37e3,_0x5764ec[_0xa6e9('0x4c')]),{'include':_0x5764ec[_0xa6e9('0x32')][_0xa6e9('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x19a415})['then'](function(_0x13b356){var _0x16002d=_0x13b356[_0xa6e9('0x4e')]({'plain':!![]});return db[_0xa6e9('0x54')]['findAll']({'where':{'userProfileId':_0x5764ec[_0xa6e9('0x46')]['id']},'raw':!![]})[_0xa6e9('0x27')](function(_0xed3bae){if(_0xed3bae){return BPromise[_0xa6e9('0x55')](_0xed3bae,function(_0x54c63c){return new BPromise(function(_0x54c69d,_0x123a81){if(_0x54c63c[_0xa6e9('0x56')]===null||_0x54c63c[_0xa6e9('0x56')]===0x1)_0x54c69d(null);return db[_0xa6e9('0x57')][_0xa6e9('0x42')]({'where':{'sectionId':_0x54c63c['id']},'raw':!![]})[_0xa6e9('0x27')](function(_0x547325){var _0x327632=_[_0xa6e9('0x2d')](_0x547325,function(_0x337218){return qs[_0xa6e9('0x4f')](_0x337218,['id',_0xa6e9('0x50'),_0xa6e9('0x51'),_0xa6e9('0x58')]);});_0x54c69d(_0x327632);})['catch'](function(_0x5b29ba){_0x123a81(_0x5b29ba);});})['then'](function(_0x374225){var _0x5994c2=qs[_0xa6e9('0x4f')](_0x54c63c,['id',_0xa6e9('0x50'),_0xa6e9('0x51')]);_0x5994c2[_0xa6e9('0x59')]=_0x16002d['id'];if(_0x374225)_0x5994c2[_0xa6e9('0x5a')]=_0x374225;return _0x5994c2;})['then'](function(_0x2d78fe){return db['UserProfileSection'][_0xa6e9('0x4b')](_0x2d78fe,{'include':[{'model':db[_0xa6e9('0x57')],'as':_0xa6e9('0x5a')}],'raw':!![],'transaction':_0x19a415});});})[_0xa6e9('0x27')](function(){return _0x16002d;});}});});});}})['then'](respondWithResult(_0x44d577,0xc9))[_0xa6e9('0x44')](handleError(_0x44d577,null));};exports[_0xa6e9('0x5b')]=function(_0x51e618,_0x197757){if(_0x51e618[_0xa6e9('0x4c')]['id']){delete _0x51e618[_0xa6e9('0x4c')]['id'];}return db[_0xa6e9('0x2e')][_0xa6e9('0x4a')]({'where':{'id':_0x51e618[_0xa6e9('0x46')]['id']}})[_0xa6e9('0x27')](handleEntityNotFound(_0x197757,null))[_0xa6e9('0x27')](saveUpdates(_0x51e618[_0xa6e9('0x4c')],null))[_0xa6e9('0x27')](respondWithResult(_0x197757,null))[_0xa6e9('0x44')](handleError(_0x197757,null));};exports['destroy']=function(_0x2ae581,_0x267f35){return db[_0xa6e9('0x2e')]['find']({'where':{'id':_0x2ae581['params']['id']}})[_0xa6e9('0x27')](handleEntityNotFound(_0x267f35,null))[_0xa6e9('0x27')](removeEntity(_0x267f35,null))[_0xa6e9('0x44')](handleError(_0x267f35,null));};exports['describe']=function(_0x6e4b99,_0x6ceb85){return db[_0xa6e9('0x2e')][_0xa6e9('0x5c')]()[_0xa6e9('0x27')](respondWithResult(_0x6ceb85,null))['catch'](handleError(_0x6ceb85,null));};exports[_0xa6e9('0x5d')]=function(_0x3c9463,_0x288169){var _0x3f4418=_0x3c9463['body'];return db['UserProfile'][_0xa6e9('0x4a')]({'where':{'id':_0x3c9463[_0xa6e9('0x46')]['id']}})[_0xa6e9('0x27')](handleEntityNotFound(_0x288169,null))['then'](function(_0x17f297){if(_0x17f297){return db[_0xa6e9('0x5e')]['transaction'](function(_0x2ec72f){return db[_0xa6e9('0x54')][_0xa6e9('0x28')]({'where':{'userProfileId':_0x3c9463['params']['id'],'sectionId':_[_0xa6e9('0x2d')](_0x3f4418,function(_0x3a813c){return _0x3a813c['sectionId'];})},'transaction':_0x2ec72f})[_0xa6e9('0x27')](function(){var _0x2ffe8b=_[_0xa6e9('0x2d')](_0x3f4418,function(_0x498c18){_0x498c18['userProfileId']=_0x3c9463[_0xa6e9('0x46')]['id'];return _0x498c18;});var _0x336793=[];return BPromise[_0xa6e9('0x55')](_0x2ffe8b,function(_0x531dc9){return db[_0xa6e9('0x54')]['create'](_0x531dc9,{'include':[{'model':db[_0xa6e9('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x2ec72f})['then'](function(_0x4be2f8){_0x336793[_0xa6e9('0x5f')](_0x4be2f8[_0xa6e9('0x4e')]({'plain':!![]}));});})[_0xa6e9('0x27')](function(){return _0x336793;});});});}})[_0xa6e9('0x27')](function(_0x1977f2){return _0x1977f2;})[_0xa6e9('0x27')](respondWithResult(_0x288169,null))[_0xa6e9('0x44')](handleError(_0x288169,null));};exports[_0xa6e9('0x60')]=function(_0x3352df,_0x506342){var _0x5b3434;return db['UserProfile'][_0xa6e9('0x4a')]({'where':{'id':_0x3352df[_0xa6e9('0x46')]['id']},'attributes':['id','name']})[_0xa6e9('0x27')](handleEntityNotFound(_0x506342,null))[_0xa6e9('0x27')](function(_0x460f7a){if(_0x460f7a){_0x5b3434=_0x460f7a;return db[_0xa6e9('0x54')][_0xa6e9('0x28')]({'where':{'userProfileId':_0x3352df[_0xa6e9('0x46')]['id'],'sectionId':_0x3352df['query'][_0xa6e9('0x61')]}});}})[_0xa6e9('0x27')](function(){return _0x5b3434;})['then'](respondWithStatusCode(_0x506342,null))[_0xa6e9('0x44')](handleError(_0x506342,null));};exports[_0xa6e9('0x62')]=function(_0x4348e4,_0x25449d){var _0xcf4525=[];var _0x37488f=[];return db[_0xa6e9('0x54')]['findAll']({'where':{'userProfileId':_0x4348e4[_0xa6e9('0x46')]['id']},'raw':!![]})['then'](function(_0x3c67dd){_0xcf4525=_[_0xa6e9('0x3d')](_0x3c67dd,function(_0x1a31b9){return _0x1a31b9[_0xa6e9('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x1a31b9[_0xa6e9('0x58')]);});if(!_['isEmpty'](_0xcf4525)){return _['map'](_0xcf4525,function(_0x4bfbb9){return _0x4bfbb9['sectionId'];});}else{return;}})['then'](function(_0x2cb4de){if(_0x2cb4de)_0x37488f=_0x2cb4de;if(_[_0xa6e9('0x64')](_0x37488f,0x64)){var _0x531acf=_[_0xa6e9('0x4a')](_0xcf4525,{'sectionId':0x64});return hasDefaultDashboard(_0x531acf)[_0xa6e9('0x27')](function(_0x5287b6){return _['map'](_0xcf4525,function(_0x381cae){if(_0x381cae[_0xa6e9('0x58')]===0x64){_0x381cae['subsections']=_0x5287b6;}return _0x381cae;});});}else{return;}})[_0xa6e9('0x27')](function(_0x243eb4){if(_0x243eb4)_0xcf4525=_0x243eb4;if(_[_0xa6e9('0x64')](_0x37488f,0x3eb)){var _0x2f95c6=_['find'](_0xcf4525,{'sectionId':0x3eb});return getCustomDashboards(_0x2f95c6)['then'](function(_0x275ffe){return _[_0xa6e9('0x2d')](_0xcf4525,function(_0xc8904){if(_0x2f95c6[_0xa6e9('0x63')]){if(_0xc8904['sectionId']===0x3eb){_0xc8904[_0xa6e9('0x65')]=_0x275ffe;}}else{if(_0xc8904['sectionId']===0x64){if(!_0xc8904[_0xa6e9('0x65')]){_0xc8904[_0xa6e9('0x65')]=[];}_0xc8904[_0xa6e9('0x65')]=_0xc8904[_0xa6e9('0x65')][_0xa6e9('0x66')](_0x275ffe);}}return _0xc8904;});});}else{return;}})['then'](function(_0x27436e){if(_0x27436e)_0xcf4525=_0x27436e;if(_['includes'](_0x37488f,0x709)){var _0x817d0e=_[_0xa6e9('0x4a')](_0xcf4525,{'sectionId':0x709});return getPlugins(_0x817d0e)['then'](function(_0x5d2078){if(_0x817d0e[_0xa6e9('0x63')]){return _['map'](_0xcf4525,function(_0x5b98fa){if(_0x5b98fa[_0xa6e9('0x58')]===0x709){_0x5b98fa[_0xa6e9('0x65')]=_0x5d2078;}return _0x5b98fa;});}else{var _0x22459b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5d2078};var _0x8d3b29=_[_0xa6e9('0x2d')](_0xcf4525);_0x8d3b29['push'](_0x22459b);return _0x8d3b29;}});}else{return;}})[_0xa6e9('0x27')](function(_0x55b8ba){if(_0x55b8ba)_0xcf4525=_0x55b8ba;return _[_0xa6e9('0x3d')](_0xcf4525,[_0xa6e9('0x63'),0x1]);})[_0xa6e9('0x27')](respondWithResult(_0x25449d,null))[_0xa6e9('0x44')](handleError(_0x25449d,null));};function hasDefaultDashboard(_0x4c6660){var _0x349e8=[0x65];return new BPromise(function(_0x90761b,_0x8aa29){try{if(_0x4c6660[_0xa6e9('0x56')]){_0x90761b(_0x349e8);}else{return db[_0xa6e9('0x57')][_0xa6e9('0x67')]({'where':{'sectionId':_0x4c6660['id']},'raw':!![]})[_0xa6e9('0x27')](function(_0x58d49e){_0x58d49e?_0x90761b(_0x349e8):_0x90761b();});}}catch(_0x131e48){_0x8aa29(_0x131e48);}});}function getCustomDashboards(_0x348667){var _0x553f16=[];return new BPromise(function(_0x444a4e,_0x57871b){try{if(_0x348667[_0xa6e9('0x56')]){return db[_0xa6e9('0x68')]['findAll']({'raw':!![]})[_0xa6e9('0x27')](function(_0xbe9024){_0xbe9024[_0xa6e9('0x69')](function(_0x3a2d91){_0x553f16[_0xa6e9('0x5f')](_0x3a2d91['id']+0x1869f);});_0x444a4e(_0x553f16);});}else{return db[_0xa6e9('0x57')]['findAll']({'where':{'sectionId':_0x348667['id']},'raw':!![]})['then'](function(_0x33126b){_0x33126b[_0xa6e9('0x69')](function(_0x31a0b6){_0x553f16[_0xa6e9('0x5f')](_0x31a0b6['resourceId']+0x1869f);});_0x444a4e(_0x553f16);});}}catch(_0x59aeb4){_0x57871b(_0x59aeb4);}});}function getPlugins(_0x1ba737){var _0x3ca376=[];return new BPromise(function(_0x51e04d,_0x4cc832){try{if(_0x1ba737['autoAssociation']){return db[_0xa6e9('0x6a')]['findAll']({'raw':!![]})[_0xa6e9('0x27')](function(_0x3f07c5){_0x3f07c5[_0xa6e9('0x69')](function(_0x3aaef4){_0x3ca376['push'](_0x3aaef4['id']+0x15b38);});_0x51e04d(_0x3ca376);});}else{return db[_0xa6e9('0x57')][_0xa6e9('0x42')]({'where':{'sectionId':_0x1ba737['id']},'raw':!![]})[_0xa6e9('0x27')](function(_0x456ff6){_0x456ff6[_0xa6e9('0x69')](function(_0x432408){_0x3ca376[_0xa6e9('0x5f')](_0x432408[_0xa6e9('0x6b')]+0x15b38);});_0x51e04d(_0x3ca376);});}}catch(_0x14a363){_0x4cc832(_0x14a363);}});}exports[_0xa6e9('0x6c')]=function(_0x11f28c,_0x3270c5){return db['UserProfile']['find']({'where':{'id':_0x11f28c[_0xa6e9('0x46')]['id']}})[_0xa6e9('0x27')](handleEntityNotFound(_0x3270c5,null))[_0xa6e9('0x27')](function(_0x2a69af){if(_0x2a69af){return db[_0xa6e9('0x5e')]['transaction'](function(_0x514d01){return db['UserProfileSection'][_0xa6e9('0x42')]({'where':{'userProfileId':_0x11f28c[_0xa6e9('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x64a48d){if(_0x64a48d){return db[_0xa6e9('0x54')][_0xa6e9('0x28')]({'where':{'userProfileId':_0x11f28c[_0xa6e9('0x46')]['id'],'id':_['map'](_0x64a48d,function(_0x59afff){return _0x59afff['id'];})},'transaction':_0x514d01});}})[_0xa6e9('0x27')](function(_0x5c672b){var _0xa82bab=_['map'](_0x11f28c[_0xa6e9('0x4c')],function(_0x2351f7){_0x2351f7[_0xa6e9('0x59')]=_0x11f28c[_0xa6e9('0x46')]['id'];return _0x2351f7;});return db[_0xa6e9('0x54')][_0xa6e9('0x6d')](_0xa82bab,{'raw':!![],'transaction':_0x514d01});})['then'](function(_0x3d1200){var _0x416207=_[_0xa6e9('0x3d')](_['map'](_0x3d1200,function(_0x2577b2){return _0x2577b2[_0xa6e9('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x416207){return db[_0xa6e9('0x54')]['findAll']({'where':{'userProfileId':_0x11f28c[_0xa6e9('0x46')]['id'],'sectionId':_['map'](_0x416207,function(_0x2e0b07){return _0x2e0b07[_0xa6e9('0x58')];})},'attributes':['id',_0xa6e9('0x58')],'raw':!![]})[_0xa6e9('0x27')](function(_0xa9ebab){var _0x4a2f01=_[_0xa6e9('0x2d')](_0x11f28c[_0xa6e9('0x4c')],function(_0x3b5ce1){_0x3b5ce1['userProfileId']=_0x11f28c[_0xa6e9('0x46')]['id'];return _0x3b5ce1;});return db[_0xa6e9('0x57')][_0xa6e9('0x6d')](_0x4a2f01,{'raw':!![],'transaction':_0x514d01});});}})[_0xa6e9('0x44')](handleError(_0x3270c5,null));});}})[_0xa6e9('0x27')](function(_0x430864){var _0x3ddf88=_[_0xa6e9('0x2d')](_0x430864,function(_0x2dd237){return _0x2dd237[_0xa6e9('0x4e')]({'plain':!![]});});})['then'](respondWithResult(_0x3270c5,null))[_0xa6e9('0x44')](handleError(_0x3270c5,null));};exports[_0xa6e9('0x6e')]=function(_0x4f0a8c,_0x120688,_0x200380){return db[_0xa6e9('0x2e')][_0xa6e9('0x4a')]({'where':{'id':_0x4f0a8c[_0xa6e9('0x46')]['id']}})[_0xa6e9('0x27')](handleEntityNotFound(_0x120688,null))['then'](function(_0x4ab7ff){if(_0x4ab7ff){return _0x4ab7ff['removeResources'](_0x4f0a8c[_0xa6e9('0x32')][_0xa6e9('0x61')]);}})[_0xa6e9('0x27')](respondWithStatusCode(_0x120688,null))['catch'](handleError(_0x120688,null));};exports[_0xa6e9('0x6f')]=function(_0x562f5b,_0x1da8e4){var _0xd9f8ce={};if(!_0x562f5b['query']['section'])throw new Error(_0xa6e9('0x70'));if(!_0x562f5b[_0xa6e9('0x32')][_0xa6e9('0x38')](_0xa6e9('0x71'))){_0xd9f8ce[_0xa6e9('0x23')]=qs[_0xa6e9('0x23')](_0x562f5b[_0xa6e9('0x32')][_0xa6e9('0x23')]);_0xd9f8ce[_0xa6e9('0x22')]=qs['offset'](_0x562f5b[_0xa6e9('0x32')][_0xa6e9('0x22')]);}return db[_0xa6e9('0x2e')][_0xa6e9('0x4a')]({'where':{'id':_0x562f5b[_0xa6e9('0x46')]['id']}})[_0xa6e9('0x27')](function(_0x53f0e4){if(!_0x53f0e4)throw new Error(_0xa6e9('0x72')+_0x562f5b[_0xa6e9('0x46')]['id']);return db[_0xa6e9('0x2e')]['getResources'](_0x562f5b);})['then'](respondWithFilteredResult(_0x1da8e4,_0xd9f8ce))[_0xa6e9('0x44')](handleError(_0x1da8e4,null));}; \ No newline at end of file +var _0x7297=['then','destroy','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','rows','catch','params','include','find','create','clone','omit','createdAt','updatedAt','crudPermissions','body','transaction','get','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','sectionId','removeSections','ids','getSections','enabled','includes','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0xc7b656,_0x3983fc){var _0x45479e=function(_0xd7e60e){while(--_0xd7e60e){_0xc7b656['push'](_0xc7b656['shift']());}};_0x45479e(++_0x3983fc);}(_0x7297,0x1ac));var _0x7729=function(_0x491b34,_0x27723d){_0x491b34=_0x491b34-0x0;var _0x1d929c=_0x7297[_0x491b34];return _0x1d929c;};'use strict';var emlformat=require(_0x7729('0x0'));var rimraf=require(_0x7729('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7729('0x2'));var rp=require(_0x7729('0x3'));var moment=require(_0x7729('0x4'));var BPromise=require(_0x7729('0x5'));var Mustache=require(_0x7729('0x6'));var util=require(_0x7729('0x7'));var path=require(_0x7729('0x8'));var sox=require(_0x7729('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7729('0xa'));var squel=require(_0x7729('0xb'));var crypto=require(_0x7729('0xc'));var jsforce=require(_0x7729('0xd'));var deskjs=require(_0x7729('0xe'));var toCsv=require(_0x7729('0xf'));var querystring=require(_0x7729('0x10'));var Papa=require(_0x7729('0x11'));var Redis=require(_0x7729('0x12'));var authService=require(_0x7729('0x13'));var qs=require(_0x7729('0x14'));var as=require(_0x7729('0x15'));var hardwareService=require(_0x7729('0x16'));var logger=require(_0x7729('0x17'))('api');var utils=require(_0x7729('0x18'));var config=require(_0x7729('0x19'));var licenseUtil=require(_0x7729('0x1a'));var db=require(_0x7729('0x1b'))['db'];config[_0x7729('0x1c')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7729('0x1d'))(new Redis(config[_0x7729('0x1c')]));require(_0x7729('0x1e'))['register'](socket);function respondWithStatusCode(_0x3fa64b,_0x5eaa56){_0x5eaa56=_0x5eaa56||0xcc;return function(_0x2c2ba2){if(_0x2c2ba2){return _0x3fa64b[_0x7729('0x1f')](_0x5eaa56);}return _0x3fa64b['status'](_0x5eaa56)[_0x7729('0x20')]();};}function respondWithResult(_0x5add67,_0x380c8a){_0x380c8a=_0x380c8a||0xc8;return function(_0x407f70){if(_0x407f70){return _0x5add67[_0x7729('0x21')](_0x380c8a)[_0x7729('0x22')](_0x407f70);}};}function respondWithFilteredResult(_0x443489,_0x3af3a4){return function(_0x41cf07){if(_0x41cf07){var _0x2571cf=typeof _0x3af3a4[_0x7729('0x23')]===_0x7729('0x24')&&typeof _0x3af3a4[_0x7729('0x25')]===_0x7729('0x24');var _0x3d174e=_0x41cf07[_0x7729('0x26')];var _0x3e9cfa=_0x2571cf?0x0:_0x3af3a4[_0x7729('0x23')];var _0x5f41c2=_0x2571cf?_0x41cf07[_0x7729('0x26')]:_0x3af3a4['offset']+_0x3af3a4['limit'];var _0x2d25f9;if(_0x5f41c2>=_0x3d174e){_0x5f41c2=_0x3d174e;_0x2d25f9=0xc8;}else{_0x2d25f9=0xce;}_0x443489[_0x7729('0x21')](_0x2d25f9);return _0x443489[_0x7729('0x27')](_0x7729('0x28'),_0x3e9cfa+'-'+_0x5f41c2+'/'+_0x3d174e)[_0x7729('0x22')](_0x41cf07);}return null;};}function patchUpdates(_0x5dc073){return function(_0x5dc151){try{jsonpatch[_0x7729('0x29')](_0x5dc151,_0x5dc073,!![]);}catch(_0x2583da){return BPromise['reject'](_0x2583da);}return _0x5dc151[_0x7729('0x2a')]();};}function saveUpdates(_0x4eed1d,_0x1c9243){return function(_0x1ede12){if(_0x1ede12){return _0x1ede12[_0x7729('0x2b')](_0x4eed1d)[_0x7729('0x2c')](function(_0x67213e){return _0x67213e;});}return null;};}function removeEntity(_0x5f3946,_0x322b9b){return function(_0x52739f){if(_0x52739f){return _0x52739f[_0x7729('0x2d')]()[_0x7729('0x2c')](function(){_0x5f3946['status'](0xcc)[_0x7729('0x20')]();});}};}function handleEntityNotFound(_0x3767ef,_0x4d8f3f){return function(_0x56b899){if(!_0x56b899){_0x3767ef[_0x7729('0x1f')](0x194);}return _0x56b899;};}function handleError(_0xb1296,_0xd14cd0){_0xd14cd0=_0xd14cd0||0x1f4;return function(_0x22aa8d){logger[_0x7729('0x2e')](_0x22aa8d[_0x7729('0x2f')]);if(_0x22aa8d[_0x7729('0x30')]){delete _0x22aa8d['name'];}_0xb1296[_0x7729('0x21')](_0xd14cd0)[_0x7729('0x31')](_0x22aa8d);};}exports[_0x7729('0x32')]=function(_0x196898,_0x5b1b23){var _0x184210={},_0x2fb7f9={},_0x42c871={'count':0x0,'rows':[]};var _0x14ea5a=_['map'](db[_0x7729('0x33')][_0x7729('0x34')],function(_0x20ca4e){return{'name':_0x20ca4e[_0x7729('0x35')],'type':_0x20ca4e[_0x7729('0x36')][_0x7729('0x37')]};});_0x2fb7f9[_0x7729('0x38')]=_['map'](_0x14ea5a,_0x7729('0x30'));_0x2fb7f9[_0x7729('0x39')]=_[_0x7729('0x3a')](_0x196898['query']);_0x2fb7f9[_0x7729('0x3b')]=_[_0x7729('0x3c')](_0x2fb7f9[_0x7729('0x38')],_0x2fb7f9[_0x7729('0x39')]);_0x184210[_0x7729('0x3d')]=_['intersection'](_0x2fb7f9[_0x7729('0x38')],qs[_0x7729('0x3e')](_0x196898['query'][_0x7729('0x3e')]));_0x184210[_0x7729('0x3d')]=_0x184210[_0x7729('0x3d')][_0x7729('0x3f')]?_0x184210[_0x7729('0x3d')]:_0x2fb7f9[_0x7729('0x38')];if(!_0x196898['query'][_0x7729('0x40')](_0x7729('0x41'))){_0x184210[_0x7729('0x25')]=qs['limit'](_0x196898[_0x7729('0x39')][_0x7729('0x25')]);_0x184210[_0x7729('0x23')]=qs['offset'](_0x196898[_0x7729('0x39')]['offset']);}_0x184210[_0x7729('0x42')]=qs[_0x7729('0x43')](_0x196898[_0x7729('0x39')][_0x7729('0x43')]);_0x184210[_0x7729('0x44')]=qs[_0x7729('0x3b')](_[_0x7729('0x45')](_0x196898['query'],_0x2fb7f9[_0x7729('0x3b')]),_0x14ea5a);if(_0x196898[_0x7729('0x39')]['filter']){_0x184210['where']=_[_0x7729('0x46')](_0x184210[_0x7729('0x44')],{'$or':_[_0x7729('0x47')](_0x14ea5a,function(_0x209117){if(_0x209117[_0x7729('0x36')]!=='VIRTUAL'){var _0x5efd7e={};_0x5efd7e[_0x209117['name']]={'$like':'%'+_0x196898[_0x7729('0x39')][_0x7729('0x48')]+'%'};return _0x5efd7e;}})});}_0x184210=_[_0x7729('0x46')]({},_0x184210,_0x196898[_0x7729('0x49')]);var _0x2779e8={'where':_0x184210[_0x7729('0x44')]};return db[_0x7729('0x33')][_0x7729('0x26')](_0x2779e8)[_0x7729('0x2c')](function(_0x226879){_0x42c871['count']=_0x226879;if(_0x196898[_0x7729('0x39')][_0x7729('0x4a')]){_0x184210['include']=[{'all':!![]}];}return db[_0x7729('0x33')]['findAll'](_0x184210);})[_0x7729('0x2c')](function(_0x3f0773){_0x42c871[_0x7729('0x4b')]=_0x3f0773;return _0x42c871;})['then'](respondWithFilteredResult(_0x5b1b23,_0x184210))[_0x7729('0x4c')](handleError(_0x5b1b23,null));};exports['show']=function(_0x87699f,_0x4b063b){var _0x10db57={'raw':![],'where':{'id':_0x87699f[_0x7729('0x4d')]['id']}},_0x113423={};_0x113423[_0x7729('0x38')]=_[_0x7729('0x3a')](db[_0x7729('0x33')][_0x7729('0x34')]);_0x113423[_0x7729('0x39')]=_[_0x7729('0x3a')](_0x87699f['query']);_0x113423['filters']=_[_0x7729('0x3c')](_0x113423[_0x7729('0x38')],_0x113423['query']);_0x10db57[_0x7729('0x3d')]=_['intersection'](_0x113423[_0x7729('0x38')],qs['fields'](_0x87699f[_0x7729('0x39')][_0x7729('0x3e')]));_0x10db57['attributes']=_0x10db57['attributes'][_0x7729('0x3f')]?_0x10db57[_0x7729('0x3d')]:_0x113423[_0x7729('0x38')];if(_0x87699f[_0x7729('0x39')][_0x7729('0x4a')]){_0x10db57[_0x7729('0x4e')]=[{'all':!![]}];}_0x10db57=_[_0x7729('0x46')]({},_0x10db57,_0x87699f[_0x7729('0x49')]);return db[_0x7729('0x33')][_0x7729('0x4f')](_0x10db57)[_0x7729('0x2c')](handleEntityNotFound(_0x4b063b,null))[_0x7729('0x2c')](respondWithResult(_0x4b063b,null))[_0x7729('0x4c')](handleError(_0x4b063b,null));};exports[_0x7729('0x50')]=function(_0x485b10,_0x1cf471){return db[_0x7729('0x33')]['create'](_0x485b10['body'],{})[_0x7729('0x2c')](respondWithResult(_0x1cf471,0xc9))[_0x7729('0x4c')](handleError(_0x1cf471,null));};exports[_0x7729('0x51')]=function(_0x37615d,_0xb03822){var _0x5bcdaf={'where':{'id':_0x37615d['params']['id']}},_0x5198c9={};_0x5198c9[_0x7729('0x38')]=_[_0x7729('0x3a')](db[_0x7729('0x33')][_0x7729('0x34')]);_0x5bcdaf[_0x7729('0x3d')]=_[_0x7729('0x3c')](_0x5198c9['model'],qs[_0x7729('0x3e')](_0x37615d['query']['fields']));_0x5bcdaf['attributes']=_0x5bcdaf[_0x7729('0x3d')][_0x7729('0x3f')]?_0x5bcdaf[_0x7729('0x3d')]:_0x5198c9[_0x7729('0x38')];if(_0x37615d[_0x7729('0x39')][_0x7729('0x4a')]){_0x5bcdaf[_0x7729('0x4e')]=[{'all':!![]}];}_0x5bcdaf=_['merge']({},_0x5bcdaf,_0x37615d[_0x7729('0x49')]);return db['UserProfile'][_0x7729('0x4f')](_0x5bcdaf)[_0x7729('0x2c')](handleEntityNotFound(_0xb03822,null))[_0x7729('0x2c')](function(_0x3f15b3){if(_0x3f15b3){var _0x5b3478=_0x3f15b3['get']({'plain':!![]});_0x5b3478=qs[_0x7729('0x52')](_0x5b3478,['id',_0x7729('0x53'),_0x7729('0x54'),_0x7729('0x55')]);_0x37615d[_0x7729('0x56')]=_[_0x7729('0x52')](_0x37615d[_0x7729('0x56')],['id',_0x7729('0x53'),'updatedAt']);return db['sequelize'][_0x7729('0x57')](function(_0x4eb60f){return db[_0x7729('0x33')][_0x7729('0x50')](_[_0x7729('0x46')](_0x5b3478,_0x37615d[_0x7729('0x56')]),{'include':_0x37615d['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4eb60f})[_0x7729('0x2c')](function(_0x1d675c){var _0x501972=_0x1d675c[_0x7729('0x58')]({'plain':!![]});return db[_0x7729('0x59')][_0x7729('0x5a')]({'where':{'userProfileId':_0x37615d['params']['id']},'raw':!![]})['then'](function(_0x163f56){if(_0x163f56){return BPromise[_0x7729('0x5b')](_0x163f56,function(_0x22a525){return new BPromise(function(_0x69b636,_0x550073){if(_0x22a525[_0x7729('0x5c')]===null||_0x22a525[_0x7729('0x5c')]===0x1)_0x69b636(null);return db[_0x7729('0x5d')][_0x7729('0x5a')]({'where':{'sectionId':_0x22a525['id']},'raw':!![]})[_0x7729('0x2c')](function(_0x14f691){var _0x4134fd=_['map'](_0x14f691,function(_0x2bdb8c){return qs[_0x7729('0x52')](_0x2bdb8c,['id',_0x7729('0x53'),_0x7729('0x54'),'sectionId']);});_0x69b636(_0x4134fd);})[_0x7729('0x4c')](function(_0x26dab7){_0x550073(_0x26dab7);});})[_0x7729('0x2c')](function(_0x43db08){var _0x27df8a=qs[_0x7729('0x52')](_0x22a525,['id',_0x7729('0x53'),_0x7729('0x54')]);_0x27df8a[_0x7729('0x5e')]=_0x501972['id'];if(_0x43db08)_0x27df8a[_0x7729('0x5f')]=_0x43db08;return _0x27df8a;})[_0x7729('0x2c')](function(_0x3f0f84){return db[_0x7729('0x59')][_0x7729('0x50')](_0x3f0f84,{'include':[{'model':db['UserProfileResource'],'as':_0x7729('0x5f')}],'raw':!![],'transaction':_0x4eb60f});});})[_0x7729('0x2c')](function(){return _0x501972;});}});});});}})[_0x7729('0x2c')](respondWithResult(_0xb03822,0xc9))[_0x7729('0x4c')](handleError(_0xb03822,null));};exports[_0x7729('0x2b')]=function(_0x565e81,_0x554e18){if(_0x565e81[_0x7729('0x56')]['id']){delete _0x565e81[_0x7729('0x56')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x565e81[_0x7729('0x4d')]['id']}})['then'](handleEntityNotFound(_0x554e18,null))[_0x7729('0x2c')](saveUpdates(_0x565e81[_0x7729('0x56')],null))[_0x7729('0x2c')](respondWithResult(_0x554e18,null))[_0x7729('0x4c')](handleError(_0x554e18,null));};exports[_0x7729('0x2d')]=function(_0x2a6f4c,_0x13427a){return db[_0x7729('0x33')][_0x7729('0x4f')]({'where':{'id':_0x2a6f4c['params']['id']}})[_0x7729('0x2c')](handleEntityNotFound(_0x13427a,null))['then'](removeEntity(_0x13427a,null))[_0x7729('0x4c')](handleError(_0x13427a,null));};exports[_0x7729('0x60')]=function(_0x5b83f6,_0x338b1e){return db[_0x7729('0x33')][_0x7729('0x60')]()[_0x7729('0x2c')](respondWithResult(_0x338b1e,null))[_0x7729('0x4c')](handleError(_0x338b1e,null));};exports[_0x7729('0x61')]=function(_0x103fae,_0x75b22a){var _0x4b4167=_0x103fae[_0x7729('0x56')];return db[_0x7729('0x33')][_0x7729('0x4f')]({'where':{'id':_0x103fae['params']['id']}})['then'](handleEntityNotFound(_0x75b22a,null))['then'](function(_0x43a3b6){if(_0x43a3b6){return db[_0x7729('0x62')][_0x7729('0x57')](function(_0x2a397c){return db['UserProfileSection'][_0x7729('0x2d')]({'where':{'userProfileId':_0x103fae[_0x7729('0x4d')]['id'],'sectionId':_['map'](_0x4b4167,function(_0x42b487){return _0x42b487[_0x7729('0x63')];})},'transaction':_0x2a397c})[_0x7729('0x2c')](function(){var _0x45412f=_[_0x7729('0x47')](_0x4b4167,function(_0x40ff7d){_0x40ff7d[_0x7729('0x5e')]=_0x103fae[_0x7729('0x4d')]['id'];return _0x40ff7d;});var _0x63407b=[];return BPromise[_0x7729('0x5b')](_0x45412f,function(_0x5aa0da){return db[_0x7729('0x59')][_0x7729('0x50')](_0x5aa0da,{'include':[{'model':db[_0x7729('0x5d')],'as':_0x7729('0x5f')}],'raw':!![],'transaction':_0x2a397c})[_0x7729('0x2c')](function(_0x2c1ec7){_0x63407b['push'](_0x2c1ec7[_0x7729('0x58')]({'plain':!![]}));});})[_0x7729('0x2c')](function(){return _0x63407b;});});});}})[_0x7729('0x2c')](function(_0x2cf0b7){return _0x2cf0b7;})[_0x7729('0x2c')](respondWithResult(_0x75b22a,null))['catch'](handleError(_0x75b22a,null));};exports[_0x7729('0x64')]=function(_0x5dbd05,_0x52a3c3){var _0x57c568;return db[_0x7729('0x33')]['find']({'where':{'id':_0x5dbd05[_0x7729('0x4d')]['id']},'attributes':['id','name']})[_0x7729('0x2c')](handleEntityNotFound(_0x52a3c3,null))[_0x7729('0x2c')](function(_0x43b7b2){if(_0x43b7b2){_0x57c568=_0x43b7b2;return db[_0x7729('0x59')][_0x7729('0x2d')]({'where':{'userProfileId':_0x5dbd05[_0x7729('0x4d')]['id'],'sectionId':_0x5dbd05[_0x7729('0x39')][_0x7729('0x65')]}});}})[_0x7729('0x2c')](function(){return _0x57c568;})[_0x7729('0x2c')](respondWithStatusCode(_0x52a3c3,null))[_0x7729('0x4c')](handleError(_0x52a3c3,null));};exports[_0x7729('0x66')]=function(_0x2b8be1,_0x26ac7d){var _0x5b5317=[];var _0x4410a8=[];return db['UserProfileSection'][_0x7729('0x5a')]({'where':{'userProfileId':_0x2b8be1[_0x7729('0x4d')]['id']},'raw':!![]})[_0x7729('0x2c')](function(_0x2a0e4a){_0x5b5317=_[_0x7729('0x48')](_0x2a0e4a,function(_0x1dd04c){return _0x1dd04c[_0x7729('0x67')]===0x1||_[_0x7729('0x68')]([0x3eb,0x709],_0x1dd04c[_0x7729('0x63')]);});if(!_['isEmpty'](_0x5b5317)){return _['map'](_0x5b5317,function(_0x4faba9){return _0x4faba9[_0x7729('0x63')];});}else{return;}})[_0x7729('0x2c')](function(_0x3ffd38){if(_0x3ffd38)_0x4410a8=_0x3ffd38;if(_[_0x7729('0x68')](_0x4410a8,0x64)){var _0x26d9f1=_['find'](_0x5b5317,{'sectionId':0x64});return hasDefaultDashboard(_0x26d9f1)[_0x7729('0x2c')](function(_0x2238b8){return _[_0x7729('0x47')](_0x5b5317,function(_0x5b70b9){if(_0x5b70b9[_0x7729('0x63')]===0x64){_0x5b70b9[_0x7729('0x69')]=_0x2238b8;}return _0x5b70b9;});});}else{return;}})['then'](function(_0xf01693){if(_0xf01693)_0x5b5317=_0xf01693;if(_[_0x7729('0x68')](_0x4410a8,0x3eb)){var _0x561cd6=_[_0x7729('0x4f')](_0x5b5317,{'sectionId':0x3eb});return getCustomDashboards(_0x561cd6)[_0x7729('0x2c')](function(_0xc3697e){return _[_0x7729('0x47')](_0x5b5317,function(_0x297581){if(_0x561cd6[_0x7729('0x67')]){if(_0x297581['sectionId']===0x3eb){_0x297581[_0x7729('0x69')]=_0xc3697e;}}else{if(_0x297581[_0x7729('0x63')]===0x64){if(!_0x297581[_0x7729('0x69')]){_0x297581['subsections']=[];}_0x297581[_0x7729('0x69')]=_0x297581[_0x7729('0x69')]['concat'](_0xc3697e);}}return _0x297581;});});}else{return;}})[_0x7729('0x2c')](function(_0x3e49e1){if(_0x3e49e1)_0x5b5317=_0x3e49e1;if(_['includes'](_0x4410a8,0x709)){var _0x44df55=_[_0x7729('0x4f')](_0x5b5317,{'sectionId':0x709});return getPlugins(_0x44df55)['then'](function(_0x507d29){if(_0x44df55[_0x7729('0x67')]){return _[_0x7729('0x47')](_0x5b5317,function(_0x15cdbb){if(_0x15cdbb[_0x7729('0x63')]===0x709){_0x15cdbb[_0x7729('0x69')]=_0x507d29;}return _0x15cdbb;});}else{var _0x2716e8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x507d29};var _0x158439=_[_0x7729('0x47')](_0x5b5317);_0x158439[_0x7729('0x6a')](_0x2716e8);return _0x158439;}});}else{return;}})['then'](function(_0x2a3f0e){if(_0x2a3f0e)_0x5b5317=_0x2a3f0e;return _[_0x7729('0x48')](_0x5b5317,['enabled',0x1]);})[_0x7729('0x2c')](respondWithResult(_0x26ac7d,null))[_0x7729('0x4c')](handleError(_0x26ac7d,null));};function hasDefaultDashboard(_0x5319a4){var _0x558252=[0x65];return new BPromise(function(_0x3bee9b,_0x166d36){try{if(_0x5319a4[_0x7729('0x5c')]){_0x3bee9b(_0x558252);}else{return db[_0x7729('0x5d')][_0x7729('0x6b')]({'where':{'sectionId':_0x5319a4['id']},'raw':!![]})[_0x7729('0x2c')](function(_0x3a67dd){_0x3a67dd?_0x3bee9b(_0x558252):_0x3bee9b();});}}catch(_0x5a0bf5){_0x166d36(_0x5a0bf5);}});}function getCustomDashboards(_0x12b1e5){var _0x5a015a=[];return new BPromise(function(_0x3e9914,_0x355bb5){try{if(_0x12b1e5[_0x7729('0x5c')]){return db[_0x7729('0x6c')]['findAll']({'raw':!![]})[_0x7729('0x2c')](function(_0x5ce338){_0x5ce338[_0x7729('0x6d')](function(_0x397bfc){_0x5a015a['push'](_0x397bfc['id']+0x1869f);});_0x3e9914(_0x5a015a);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x12b1e5['id']},'raw':!![]})[_0x7729('0x2c')](function(_0x1f92f2){_0x1f92f2['forEach'](function(_0x736045){_0x5a015a['push'](_0x736045[_0x7729('0x6e')]+0x1869f);});_0x3e9914(_0x5a015a);});}}catch(_0x2b8bbd){_0x355bb5(_0x2b8bbd);}});}function getPlugins(_0x4cf7cd){var _0x1a1301=[];return new BPromise(function(_0x3047b5,_0x259e03){try{if(_0x4cf7cd['autoAssociation']){return db[_0x7729('0x6f')][_0x7729('0x5a')]({'raw':!![]})[_0x7729('0x2c')](function(_0x36c02e){_0x36c02e['forEach'](function(_0xf8be32){_0x1a1301[_0x7729('0x6a')](_0xf8be32['id']+0x15b38);});_0x3047b5(_0x1a1301);});}else{return db[_0x7729('0x5d')][_0x7729('0x5a')]({'where':{'sectionId':_0x4cf7cd['id']},'raw':!![]})['then'](function(_0x2c7ca8){_0x2c7ca8['forEach'](function(_0x2643e7){_0x1a1301[_0x7729('0x6a')](_0x2643e7[_0x7729('0x6e')]+0x15b38);});_0x3047b5(_0x1a1301);});}}catch(_0x23a4de){_0x259e03(_0x23a4de);}});}exports[_0x7729('0x70')]=function(_0x629cd5,_0x4cd18d){return db[_0x7729('0x33')][_0x7729('0x4f')]({'where':{'id':_0x629cd5[_0x7729('0x4d')]['id']}})[_0x7729('0x2c')](handleEntityNotFound(_0x4cd18d,null))[_0x7729('0x2c')](function(_0x520a22){if(_0x520a22){return db[_0x7729('0x62')][_0x7729('0x57')](function(_0x5ec282){return db[_0x7729('0x59')][_0x7729('0x5a')]({'where':{'userProfileId':_0x629cd5[_0x7729('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x7729('0x2c')](function(_0x518fa9){if(_0x518fa9){return db[_0x7729('0x59')]['destroy']({'where':{'userProfileId':_0x629cd5['params']['id'],'id':_[_0x7729('0x47')](_0x518fa9,function(_0x4d3a4c){return _0x4d3a4c['id'];})},'transaction':_0x5ec282});}})['then'](function(_0x4a4a00){var _0x116ea3=_[_0x7729('0x47')](_0x629cd5['body'],function(_0x4c16ce){_0x4c16ce[_0x7729('0x5e')]=_0x629cd5[_0x7729('0x4d')]['id'];return _0x4c16ce;});return db['UserProfileSection']['bulkCreate'](_0x116ea3,{'raw':!![],'transaction':_0x5ec282});})[_0x7729('0x2c')](function(_0x11fcf0){var _0x5059a5=_[_0x7729('0x48')](_[_0x7729('0x47')](_0x11fcf0,function(_0x5d04fa){return _0x5d04fa[_0x7729('0x58')]({'plain':!![]});}),{'includeAll':![]});if(_0x5059a5){return db[_0x7729('0x59')][_0x7729('0x5a')]({'where':{'userProfileId':_0x629cd5[_0x7729('0x4d')]['id'],'sectionId':_['map'](_0x5059a5,function(_0x1cf320){return _0x1cf320[_0x7729('0x63')];})},'attributes':['id',_0x7729('0x63')],'raw':!![]})[_0x7729('0x2c')](function(_0x3c2b37){var _0x39d12d=_[_0x7729('0x47')](_0x629cd5[_0x7729('0x56')],function(_0xf2861b){_0xf2861b[_0x7729('0x5e')]=_0x629cd5[_0x7729('0x4d')]['id'];return _0xf2861b;});return db['UserProfileResource'][_0x7729('0x71')](_0x39d12d,{'raw':!![],'transaction':_0x5ec282});});}})[_0x7729('0x4c')](handleError(_0x4cd18d,null));});}})[_0x7729('0x2c')](function(_0x5841f9){var _0x2d80c4=_[_0x7729('0x47')](_0x5841f9,function(_0x575932){return _0x575932[_0x7729('0x58')]({'plain':!![]});});})[_0x7729('0x2c')](respondWithResult(_0x4cd18d,null))[_0x7729('0x4c')](handleError(_0x4cd18d,null));};exports[_0x7729('0x72')]=function(_0x2d4630,_0x25718f,_0xc2a9d9){return db[_0x7729('0x33')]['find']({'where':{'id':_0x2d4630[_0x7729('0x4d')]['id']}})[_0x7729('0x2c')](handleEntityNotFound(_0x25718f,null))[_0x7729('0x2c')](function(_0x3de216){if(_0x3de216){return _0x3de216[_0x7729('0x72')](_0x2d4630[_0x7729('0x39')][_0x7729('0x65')]);}})['then'](respondWithStatusCode(_0x25718f,null))[_0x7729('0x4c')](handleError(_0x25718f,null));};exports[_0x7729('0x73')]=function(_0x551dbf,_0x587a15){var _0x56fa13={};if(!_0x551dbf['query'][_0x7729('0x74')])throw new Error('Missing\x20section\x20parameter');if(!_0x551dbf[_0x7729('0x39')]['hasOwnProperty'](_0x7729('0x41'))){_0x56fa13[_0x7729('0x25')]=qs[_0x7729('0x25')](_0x551dbf[_0x7729('0x39')][_0x7729('0x25')]);_0x56fa13[_0x7729('0x23')]=qs['offset'](_0x551dbf[_0x7729('0x39')][_0x7729('0x23')]);}return db[_0x7729('0x33')]['find']({'where':{'id':_0x551dbf[_0x7729('0x4d')]['id']}})[_0x7729('0x2c')](function(_0x2e8522){if(!_0x2e8522)throw new Error(_0x7729('0x75')+_0x551dbf[_0x7729('0x4d')]['id']);return db[_0x7729('0x33')][_0x7729('0x73')](_0x551dbf);})[_0x7729('0x2c')](respondWithFilteredResult(_0x587a15,_0x56fa13))[_0x7729('0x4c')](handleError(_0x587a15,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6d7a114..d4f9707 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 _0xd959=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','save','update'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xd959,0x94));var _0x9d95=function(_0x4f5f52,_0x3438eb){_0x4f5f52=_0x4f5f52-0x0;var _0xc65bc=_0xd959[_0x4f5f52];return _0xc65bc;};'use strict';var EventEmitter=require(_0x9d95('0x0'));var UserProfile=require(_0x9d95('0x1'))['db'][_0x9d95('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9d95('0x3'),'afterUpdate':_0x9d95('0x4'),'afterDestroy':_0x9d95('0x5')};function emitEvent(_0x261f81){return function(_0x2d997b,_0x5567d7,_0x277e44){UserProfileEvents[_0x9d95('0x6')](_0x261f81+':'+_0x2d997b['id'],_0x2d997b);UserProfileEvents[_0x9d95('0x6')](_0x261f81,_0x2d997b);_0x277e44(null);};}for(var e in events){if(events[_0x9d95('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x9d95('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xb7de=['hook','events','../../mysqldb','UserProfile','save','update','remove','emit','hasOwnProperty'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xb7de,0xc7));var _0xeb7d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb7de[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0xeb7d('0x0'));var UserProfile=require(_0xeb7d('0x1'))['db'][_0xeb7d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb7d('0x3'),'afterUpdate':_0xeb7d('0x4'),'afterDestroy':_0xeb7d('0x5')};function emitEvent(_0x219063){return function(_0x6b96c8,_0x57a908,_0x16d106){UserProfileEvents[_0xeb7d('0x6')](_0x219063+':'+_0x6b96c8['id'],_0x6b96c8);UserProfileEvents[_0xeb7d('0x6')](_0x219063,_0x6b96c8);_0x16d106(null);};}for(var e in events){if(events[_0xeb7d('0x7')](e)){var event=events[e];UserProfile[_0xeb7d('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 6c373ec..8e91200 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 _0x0617=['childModel','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','ListId','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','role','agent','Telephones','membername','User','telephone','queue','VoiceQueue','type','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Template','triggers','trunks','Trunk','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','keys','filters','intersection','fields','attributes','nolimit','limit','offset','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','count','rows','ids','customSorting','order','extraQueryConditions','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','exports','filter','findAll','then','map','catch','field','value','model','associatedResources','name','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects'];(function(_0x22423d,_0x1188f3){var _0x3ad626=function(_0xb472d2){while(--_0xb472d2){_0x22423d['push'](_0x22423d['shift']());}};_0x3ad626(++_0x1188f3);}(_0x0617,0x16d));var _0x7061=function(_0x4930ee,_0x442983){_0x4930ee=_0x4930ee-0x0;var _0x24f2b3=_0x0617[_0x4930ee];return _0x24f2b3;};'use strict';var _=require(_0x7061('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x7061('0x1'));var squel=require(_0x7061('0x2'));module[_0x7061('0x3')]=function(_0xf8e90a){var _0x1fc255=_0xf8e90a['models'];function _0x35c155(_0x4c512a,_0x1eb5a4){return new Promise(function(_0x1473f3,_0x3844fa){if(!_0x1eb5a4)return _0x1473f3(null);var _0x205a4a=_0x1eb5a4[_0x7061('0x4')]?{[_0x1eb5a4['filter']['field']]:_0x1eb5a4[_0x7061('0x4')]['value']}:undefined;return _0x1fc255[_0x4c512a][_0x7061('0x5')]({'where':_0x205a4a,'raw':!![]})[_0x7061('0x6')](function(_0x5d273f){_0x1eb5a4['associatedResources']=_[_0x7061('0x7')](_0x5d273f,'id');_0x1473f3(_0x1eb5a4);})[_0x7061('0x8')](function(_0x1bd97c){_0x3844fa(_0x1bd97c);});});}function _0xedb4a8(_0x215a95,_0x50721f){return new Promise(function(_0x218ddd,_0x275992){var _0xfab499=_0x215a95[_0x7061('0x4')]?{[_0x215a95['filter'][_0x7061('0x9')]]:_0x215a95[_0x7061('0x4')][_0x7061('0xa')]}:undefined;return _0x1fc255[_0x215a95[_0x7061('0xb')]][_0x7061('0x5')]({'where':_0xfab499,'raw':!![]})[_0x7061('0x6')](function(_0x46b254){_0x50721f[_0x7061('0xc')]=_[_0x7061('0x7')](_0x46b254,function(_0x423c4e){return _0x423c4e[_0x7061('0xd')];});_0x218ddd(_0x50721f);})['catch'](function(_0x5c0fdf){_0x275992(_0x5c0fdf);});});}function _0x4fe5a2(_0x489a4f,_0x2cdd14,_0x2e4c6f){if(!_0x2cdd14)return Promise['resolve'](null);return new Promise(function(_0x56878d,_0x2ef4c2){return _0x1fc255[_0x7061('0xe')][_0x7061('0x5')]({'where':{'sectionId':_0x2cdd14['id']},'raw':!![]})['then'](function(_0x1ee93b){if(_0x489a4f['field']&&_0x489a4f[_0x7061('0x9')]!=='id'){_0x2cdd14[_0x7061('0xc')]=_[_0x7061('0x7')](_0x1ee93b,function(_0x5d9223){return _0x5d9223[_0x489a4f[_0x7061('0x9')]];});}else{if(_0x2e4c6f===_0x7061('0xf')){_0x2cdd14[_0x7061('0xc')]=_[_0x7061('0x7')](_0x1ee93b,function(_0x4cec44){return{'id':_0x4cec44[_0x7061('0x10')],'type':_0x4cec44['type']};});}else{_0x2cdd14[_0x7061('0xc')]=_['map'](_0x1ee93b,function(_0x537ff9){return _0x537ff9['resourceId'];});}}_0x56878d(_0x2cdd14);})[_0x7061('0x8')](function(_0x4780f4){_0x2ef4c2(_0x4780f4);});});}function _0x39dd99(_0x13f2e8,_0x1b307d){var _0x14fed3={'parentSections':[]};switch(_0x13f2e8[_0x7061('0x11')]()){case _0x7061('0x12'):_0x14fed3[_0x7061('0x13')]='SquareProject';break;case _0x7061('0x14'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x15');break;case'squarerecordings':_0x14fed3['childModel']=_0x7061('0x16');_0x14fed3[_0x7061('0x17')]=[{'name':_0x7061('0x18'),'field':_0x7061('0xd'),'foreignKey':'projectName'}];break;case'projects':_0x14fed3[_0x7061('0x13')]=_0x7061('0x19');break;case _0x7061('0x1a'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x1b');_0x14fed3[_0x7061('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0x7061('0x1c')}];break;case'lists':_0x14fed3[_0x7061('0x13')]=_0x7061('0x1d');break;case _0x7061('0x1e'):_0x14fed3[_0x7061('0x13')]='CmCompany';break;case _0x7061('0x1f'):_0x14fed3['childModel']=_0x7061('0x20');break;case _0x7061('0x21'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x22');break;case _0x7061('0x23'):_0x14fed3[_0x7061('0x13')]='ChatWebsite';break;case _0x7061('0x24'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x25');break;case _0x7061('0x26'):_0x14fed3['childModel']=_0x7061('0x27');break;case _0x7061('0x28'):case _0x7061('0x29'):case _0x7061('0x2a'):_0x14fed3[_0x7061('0x13')]='VoiceExtension';break;case _0x7061('0x2b'):_0x14fed3['childModel']=_0x7061('0x2c');break;case _0x7061('0x2d'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x2e');break;case _0x7061('0x2f'):_0x14fed3[_0x7061('0x13')]='VoiceRecording';_0x14fed3[_0x7061('0x17')]=[{'name':_0x7061('0x30'),'field':_0x7061('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0x7061('0x31'),'value':[_0x7061('0x32')]}},{'name':_0x7061('0x33'),'field':_0x7061('0xd'),'foreignKey':_0x7061('0x34'),'model':_0x7061('0x35'),'filter':{'field':'role','value':[_0x7061('0x36')]}},{'name':'VoiceQueues','field':_0x7061('0xd'),'foreignKey':_0x7061('0x37'),'model':_0x7061('0x38'),'filter':{'field':_0x7061('0x39'),'value':[_0x7061('0x3a')]}},{'name':'QueueCampaigns','field':_0x7061('0xd'),'foreignKey':_0x7061('0x37'),'model':_0x7061('0x38'),'filter':{'field':_0x7061('0x39'),'value':[_0x7061('0x3b')]}}];break;case _0x7061('0x3c'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x3d');break;case _0x7061('0x3e'):_0x14fed3[_0x7061('0x13')]='VoiceChanSpy';break;case _0x7061('0x3f'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x40');break;case _0x7061('0x41'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x42');break;case _0x7061('0x43'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x44');break;case _0x7061('0x45'):_0x14fed3[_0x7061('0x13')]='MailAccount';break;case'mailsubstatuses':_0x14fed3[_0x7061('0x13')]=_0x7061('0x46');break;case _0x7061('0x47'):_0x14fed3[_0x7061('0x13')]='OpenchannelQueue';break;case _0x7061('0x48'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x49');break;case _0x7061('0x4a'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x4b');break;case'smsaccounts':_0x14fed3[_0x7061('0x13')]='SmsAccount';break;case'whatsappqueues':_0x14fed3[_0x7061('0x13')]='WhatsappQueue';break;case _0x7061('0x4c'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x4d');break;case _0x7061('0x4e'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x4f');break;case _0x7061('0x50'):case _0x7061('0x51'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x38');if(_0x1b307d){_0x14fed3[_0x7061('0x17')]=[{'name':_0x7061('0x52')},{'name':'QueueCampaigns'}];}break;case _0x7061('0x53'):case _0x7061('0x54'):case _0x7061('0x55'):_0x14fed3['childModel']=_0x7061('0x35');if(_0x1b307d){_0x14fed3[_0x7061('0x17')]=[{'name':_0x7061('0x56'),'filter':{'field':_0x7061('0x31'),'value':['admin',_0x7061('0x57')]},'ignore':!![]},{'name':_0x7061('0x30')},{'name':'Telephones'}];}break;case _0x7061('0x58'):_0x14fed3[_0x7061('0x13')]='ZendeskAccount';break;case _0x7061('0x59'):_0x14fed3['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x14fed3[_0x7061('0x13')]='FreshdeskAccount';break;case _0x7061('0x5a'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x5b');break;case _0x7061('0x5c'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x5d');break;case _0x7061('0x5e'):_0x14fed3['childModel']='ZohoAccount';break;case _0x7061('0x5f'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x35');break;case _0x7061('0x60'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x61');break;case _0x7061('0x62'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x63');break;case _0x7061('0x64'):_0x14fed3['childModel']=_0x7061('0x65');break;case _0x7061('0x66'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x67');break;case _0x7061('0x68'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x69');break;case'scheduler':_0x14fed3[_0x7061('0x13')]=_0x7061('0x6a');break;case _0x7061('0x6b'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x6c');break;case _0x7061('0x6d'):_0x14fed3[_0x7061('0x13')]='Tag';break;case'templates':_0x14fed3['childModel']=_0x7061('0x6e');break;case _0x7061('0x6f'):_0x14fed3[_0x7061('0x13')]='Trigger';break;case _0x7061('0x70'):_0x14fed3['childModel']=_0x7061('0x71');break;case'variables':_0x14fed3[_0x7061('0x13')]=_0x7061('0x72');break;case'plugins':_0x14fed3[_0x7061('0x13')]=_0x7061('0x73');break;case _0x7061('0x74'):_0x14fed3[_0x7061('0x13')]=_0x7061('0xf');_0x14fed3[_0x7061('0x17')]=[{'name':_0x7061('0x75'),'field':'id','foreignKey':_0x7061('0x76')}];break;case _0x7061('0x77'):_0x14fed3[_0x7061('0x13')]=_0x7061('0x78');break;}return _0x14fed3;}function _0x1bcd2d(_0x3d7e4b,_0x46177f){var _0x5521ab=_0x3d7e4b[_0x7061('0x79')](0x0)[_0x7061('0x7a')]()+_0x3d7e4b[_0x7061('0x7b')](0x1);var _0x1095ad={'type':_0x1fc255[_0x7061('0x7c')][_0x7061('0x7d')][_0x7061('0x7e')],'raw':!![]};return new Promise(function(_0x4753d9,_0x4fdd91){var _0x5cb634=squel[_0x7061('0x7f')]()[_0x7061('0x9')](_0x7061('0x80')+_0x5521ab+_0x7061('0x81'),'id')[_0x7061('0x9')](_0x7061('0x82'))[_0x7061('0x83')](_0x7061('0x84')+_0x3d7e4b+_0x7061('0x85'),'ui')[_0x7061('0x86')](_0x7061('0x87'),_0x46177f['id']);return _0x1fc255[_0x7061('0x88')][_0x7061('0x89')](_0x5cb634['toString'](),_0x1095ad)[_0x7061('0x6')](function(_0x4db535){_0x46177f[_0x5521ab+'OpenTabs']=_0x4db535;_0x4753d9(_0x4db535);})['catch'](function(_0x5b0ca8){_0x4fdd91(_0x5b0ca8);});});}return _0xf8e90a['define'](_0x7061('0x8a'),attributes,{'tableName':_0x7061('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x28fea9){var _0x2c62cd={'raw':_0x28fea9['query'][_0x7061('0x8c')],'where':{}};var _0x40ee5e={};var _0x2e87ca={'count':0x0,'rows':[]};var _0x1a7da2=_0x28fea9[_0x7061('0x89')]['section'];var _0x515513=_0x28fea9['query'][_0x7061('0x8d')]||![];var _0x34b2ba=_0x39dd99(_0x1a7da2,_0x515513);if(!_0x34b2ba[_0x7061('0x13')])throw new Error(_0x7061('0x8e')+_0x1a7da2+'\x27');var _0x155b65=[{'name':_0x1a7da2}];if(!_[_0x7061('0x8f')](_0x34b2ba['parentSections']))_0x155b65=_0x34b2ba['parentSections'];var _0x52587d=[];for(var _0x4ab193=0x0;_0x4ab193<_0x155b65[_0x7061('0x90')];_0x4ab193++){_0x52587d[_0x7061('0x91')](_0x1fc255[_0x7061('0x92')][_0x7061('0x93')]({'where':{'userProfileId':_0x28fea9[_0x7061('0x94')]['id'],'name':_0x155b65[_0x4ab193]['name']},'raw':!![]}));}return Promise[_0x7061('0x95')](_0x52587d)[_0x7061('0x6')](function(_0x30ea26){var _0x2f49f7=_['filter'](_0x30ea26,function(_0xf4301d){return _0xf4301d?_0xf4301d:undefined;});var _0x481743=_['filter'](_0x155b65,[_0x7061('0x96'),!![]]);var _0x5a2c9e=_[_0x7061('0x8f')](_0x2f49f7)&&_['isEmpty'](_0x481743)?null:_[_0x7061('0x97')](_0x481743,_0x2f49f7);if(!_0x5a2c9e)return null;var _0x2fe5ac=[];for(var _0x29a31b=0x0;_0x29a31b<_0x5a2c9e[_0x7061('0x90')];_0x29a31b++){var _0x5a05b3=_['find'](_0x155b65,function(_0x5fce6a){return _0x5a2c9e[_0x29a31b]?_0x5fce6a[_0x7061('0xd')]===_0x5a2c9e[_0x29a31b][_0x7061('0xd')]:null;});if(_0x5a05b3){if(_0x5a2c9e[_0x29a31b]['ignore']){_0x2fe5ac['push'](_0x35c155(_0x34b2ba[_0x7061('0x13')],_0x5a2c9e[_0x29a31b]));}else{if(!_0x5a2c9e[_0x29a31b][_0x7061('0x98')]){_0x2fe5ac[_0x7061('0x91')](_0x4fe5a2(_0x5a05b3,_0x5a2c9e[_0x29a31b],_0x34b2ba[_0x7061('0x13')]));}else{if(_0x5a05b3[_0x7061('0xb')]){_0x2fe5ac[_0x7061('0x91')](_0xedb4a8(_0x5a05b3,_0x5a2c9e[_0x29a31b]));}}}}}return Promise['all'](_0x2fe5ac);})[_0x7061('0x6')](function(_0xd0838){var _0x45a412=_0xd0838;var _0x57509e=null;if(_0x45a412){_0x57509e=_0x45a412['length']===0x1?_0x45a412[0x0]:null;}if(!_0x57509e&&!_0x45a412)return _0x2e87ca;var _0x5ed10b=_0x1fc255[_0x34b2ba[_0x7061('0x13')]]['rawAttributes'];_0x40ee5e['model']=_[_0x7061('0x99')](_0x5ed10b);_0x40ee5e[_0x7061('0x89')]=_[_0x7061('0x99')](_0x28fea9[_0x7061('0x89')]);_0x40ee5e[_0x7061('0x9a')]=_[_0x7061('0x9b')](_0x40ee5e[_0x7061('0xb')],_0x40ee5e[_0x7061('0x89')]);_0x2c62cd['attributes']=_['intersection'](_0x40ee5e[_0x7061('0xb')],qs[_0x7061('0x9c')](_0x28fea9[_0x7061('0x89')]['fields']));_0x2c62cd[_0x7061('0x9d')]=_0x2c62cd[_0x7061('0x9d')][_0x7061('0x90')]?_0x2c62cd['attributes']:_0x40ee5e['model'];if(!_0x28fea9['query']['hasOwnProperty'](_0x7061('0x9e'))){_0x2c62cd[_0x7061('0x9f')]=qs[_0x7061('0x9f')](_0x28fea9[_0x7061('0x89')][_0x7061('0x9f')]);_0x2c62cd[_0x7061('0xa0')]=qs['offset'](_0x28fea9['query']['offset']);}_0x2c62cd['order']=qs[_0x7061('0xa1')](_0x28fea9[_0x7061('0x89')][_0x7061('0xa1')]);_0x2c62cd[_0x7061('0x86')]=qs[_0x7061('0x9a')](_['pick'](_0x28fea9['query'],_0x40ee5e['filters']));if(_0x28fea9[_0x7061('0x89')][_0x7061('0x4')]){_0x2c62cd[_0x7061('0x86')]=_[_0x7061('0xa2')](_0x2c62cd[_0x7061('0x86')],{'$or':_[_0x7061('0x7')](_0x5ed10b,function(_0x2c9404){if(_0x2c9404['type'][_0x7061('0xa3')]!==_0x7061('0xa4')){var _0x2b9938={};_0x2b9938[_0x2c9404[_0x7061('0x9')]]={'$like':'%'+_0x28fea9[_0x7061('0x89')][_0x7061('0x4')]+'%'};return _0x2b9938;}})});}var _0x4e2e83=[];var _0x16d722=null;var _0x19e2b2={};if(_0x57509e){_0x16d722=_[_0x7061('0x93')](_0x155b65,['name',_0x57509e[_0x7061('0xd')]]);if(_0x16d722[_0x7061('0x9')]){_0x19e2b2={};if(_0x34b2ba[_0x7061('0x13')]==='AnalyticExtractedReport'){_0x19e2b2[_0x16d722[_0x7061('0xa5')]]=_['map'](_0x57509e[_0x7061('0xc')],'id');}else{_0x19e2b2[_0x16d722[_0x7061('0xa5')]]=_0x57509e[_0x7061('0xc')];}_0x4e2e83[_0x7061('0x91')](_0x19e2b2);}else{_0x2c62cd[_0x7061('0x86')]['id']=_0x57509e[_0x7061('0xc')];}}else{for(var _0x5833bf=0x0;_0x5833bf<_0x45a412[_0x7061('0x90')];_0x5833bf++){_0x16d722=_[_0x7061('0x93')](_0x155b65,[_0x7061('0xd'),_0x45a412[_0x5833bf][_0x7061('0xd')]]);if(_0x16d722[_0x7061('0x9')]){_0x19e2b2={};_0x19e2b2[_0x16d722[_0x7061('0xa5')]]=_0x45a412[_0x5833bf]['associatedResources'];_0x4e2e83[_0x7061('0x91')](_0x19e2b2);}else{if(!_0x2c62cd['where']['id'])_0x2c62cd[_0x7061('0x86')]['id']=[];_0x45a412[_0x5833bf][_0x7061('0xc')][_0x7061('0xa6')](function(_0xcb9d12){_0x2c62cd[_0x7061('0x86')]['id'][_0x7061('0x91')](_0xcb9d12);});}}}if(!_['isEmpty'](_0x4e2e83)){_0x2c62cd[_0x7061('0x86')]=_[_0x7061('0xa2')](_0x2c62cd[_0x7061('0x86')],{'$and':{'$or':_0x4e2e83}});}_0x2c62cd=_[_0x7061('0xa2')]({},_0x2c62cd,_0x28fea9[_0x7061('0xa7')]);if(_0x57509e&&!_0x57509e[_0x7061('0x98')]&&_0x34b2ba[_0x7061('0x13')]==='AnalyticExtractedReport'){if(_0x28fea9[_0x7061('0x89')][_0x7061('0xa8')]){_0x2c62cd[_0x7061('0xa9')]=[{'all':!![]}];}return _0x1fc255[_0x34b2ba[_0x7061('0x13')]][_0x7061('0x5')](_0x2c62cd)['then'](function(_0x392e7d){var _0x2f4a5d=[];_0x392e7d['forEach'](function(_0x112af2){var _0x4f8ef4;switch(_0x112af2[_0x7061('0xaa')]){case _0x7061('0xab'):_0x4f8ef4=_[_0x7061('0x93')](_0x57509e[_0x7061('0xc')],function(_0x275574){return _0x275574['id']===_0x112af2['reportId']&&_0x275574['type']===_0x7061('0xac');});break;case'custom':_0x4f8ef4=_[_0x7061('0x93')](_0x57509e[_0x7061('0xc')],function(_0x287d7f){return _0x287d7f['id']===_0x112af2[_0x7061('0x76')]&&_0x287d7f['type']==='CustomReports';});break;}if(_0x4f8ef4)_0x2f4a5d[_0x7061('0x91')](_0x112af2);});_0x2e87ca[_0x7061('0xad')]=_0x2f4a5d['length'];_0x2e87ca[_0x7061('0xae')]=_0x2f4a5d;return _0x2e87ca;});}else{if(!_[_0x7061('0x8f')](_0x28fea9['query'][_0x7061('0xaf')])){_0x2c62cd[_0x7061('0x86')]['id']=_0x2c62cd[_0x7061('0x86')]['id']?_['intersection'](_0x2c62cd[_0x7061('0x86')]['id'],_0x28fea9[_0x7061('0x89')][_0x7061('0xaf')]):_0x28fea9['query'][_0x7061('0xaf')];if(_0x28fea9['query'][_0x7061('0xb0')]){_0x2c62cd[_0x7061('0xb1')]=_0x28fea9['query']['customSorting'];}}if(_0x28fea9[_0x7061('0x89')]['extraQueryConditions']){_0x2c62cd['where']=_['merge'](_0x2c62cd[_0x7061('0x86')],{'$and':_0x28fea9['query'][_0x7061('0xb2')]});}return _0x1fc255[_0x34b2ba[_0x7061('0x13')]][_0x7061('0xad')]({'where':_0x2c62cd[_0x7061('0x86')]})[_0x7061('0x6')](function(_0x573ca8){_0x2e87ca[_0x7061('0xad')]=_0x573ca8;if(_0x28fea9[_0x7061('0x89')][_0x7061('0xa8')]){if(_0x34b2ba[_0x7061('0x13')]===_0x7061('0x1b')){_0x2c62cd['include']=[{'model':_0x1fc255[_0x7061('0xb3')],'as':_0x7061('0xb4'),'attributes':['id',_0x7061('0xd'),_0x7061('0xb5')],'required':_0x28fea9[_0x7061('0x89')][_0x7061('0xb6')]?!![]:![]},{'model':_0x1fc255[_0x7061('0xb3')],'as':_0x7061('0xb7'),'attributes':['id','name',_0x7061('0xb5')],'through':_0x28fea9['query'][_0x7061('0xb6')]?{'attributes':[],'where':{'TagId':_0x28fea9[_0x7061('0x89')][_0x7061('0xb6')]||undefined}}:{},'required':_0x28fea9[_0x7061('0x89')]['tag']?!![]:![]}];}else{_0x2c62cd['include']=[{'all':!![]}];}}return _0x1fc255[_0x34b2ba[_0x7061('0x13')]][_0x7061('0x5')](_0x2c62cd);})[_0x7061('0x6')](function(_0x2b9de7){_0x2e87ca[_0x7061('0xae')]=_0x2b9de7;if(_0x1a7da2===_0x7061('0x30')&&_0x28fea9[_0x7061('0x89')][_0x7061('0xb8')]===_0x7061('0xb9')){var _0x469976=[];for(var _0x2da69a=0x0;_0x2da69a<_0x2e87ca[_0x7061('0xae')][_0x7061('0x90')];_0x2da69a++){_0x469976[_0x7061('0x91')](_0x1bcd2d(_0x7061('0xba'),_0x2e87ca[_0x7061('0xae')][_0x2da69a][_0x7061('0xbb')]));_0x469976[_0x7061('0x91')](_0x1bcd2d(_0x7061('0xbc'),_0x2e87ca[_0x7061('0xae')][_0x2da69a]['dataValues']));_0x469976[_0x7061('0x91')](_0x1bcd2d('fax',_0x2e87ca[_0x7061('0xae')][_0x2da69a][_0x7061('0xbb')]));_0x469976[_0x7061('0x91')](_0x1bcd2d(_0x7061('0xbd'),_0x2e87ca['rows'][_0x2da69a][_0x7061('0xbb')]));_0x469976[_0x7061('0x91')](_0x1bcd2d(_0x7061('0xbe'),_0x2e87ca['rows'][_0x2da69a][_0x7061('0xbb')]));_0x469976['push'](_0x1bcd2d(_0x7061('0xbf'),_0x2e87ca[_0x7061('0xae')][_0x2da69a][_0x7061('0xbb')]));}return Promise[_0x7061('0x95')](_0x469976)[_0x7061('0x6')](function(){return _0x2e87ca;});}return _0x2e87ca;});}});}}});}; \ No newline at end of file +var _0x8f62=['pauses','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trunk','variables','Variable','Plugin','Reports','reportId','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','order','extraQueryConditions','color','ThroughTags','tag','Agents','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceContext','voicemails','voicerecordings','VoiceRecording','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','smsaccounts','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals'];(function(_0x19fb70,_0x42e32c){var _0x1ecdea=function(_0x704616){while(--_0x704616){_0x19fb70['push'](_0x19fb70['shift']());}};_0x1ecdea(++_0x42e32c);}(_0x8f62,0x110));var _0x28f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f62[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x28f6('0x0'));var attributes=require(_0x28f6('0x1'));var qs=require(_0x28f6('0x2'));var squel=require('squel');module[_0x28f6('0x3')]=function(_0x128705){var _0x5a5b86=_0x128705[_0x28f6('0x4')];function _0x17113e(_0x487576,_0x103312){return new Promise(function(_0x40e90b,_0x425788){if(!_0x103312)return _0x40e90b(null);var _0x3b8cbf=_0x103312['filter']?{[_0x103312[_0x28f6('0x5')][_0x28f6('0x6')]]:_0x103312[_0x28f6('0x5')][_0x28f6('0x7')]}:undefined;return _0x5a5b86[_0x487576][_0x28f6('0x8')]({'where':_0x3b8cbf,'raw':!![]})[_0x28f6('0x9')](function(_0xae33fc){_0x103312['associatedResources']=_[_0x28f6('0xa')](_0xae33fc,'id');_0x40e90b(_0x103312);})[_0x28f6('0xb')](function(_0x182fc6){_0x425788(_0x182fc6);});});}function _0x20a920(_0x5b8518,_0x1843dd){return new Promise(function(_0x42f2bf,_0x8b8d88){var _0x257b0f=_0x5b8518[_0x28f6('0x5')]?{[_0x5b8518[_0x28f6('0x5')]['field']]:_0x5b8518[_0x28f6('0x5')][_0x28f6('0x7')]}:undefined;return _0x5a5b86[_0x5b8518[_0x28f6('0xc')]][_0x28f6('0x8')]({'where':_0x257b0f,'raw':!![]})[_0x28f6('0x9')](function(_0x5bc330){_0x1843dd[_0x28f6('0xd')]=_[_0x28f6('0xa')](_0x5bc330,function(_0x357155){return _0x357155[_0x28f6('0xe')];});_0x42f2bf(_0x1843dd);})[_0x28f6('0xb')](function(_0x50dd11){_0x8b8d88(_0x50dd11);});});}function _0x448ab6(_0xefbbe3,_0x5e5e17,_0x4d33a8){if(!_0x5e5e17)return Promise[_0x28f6('0xf')](null);return new Promise(function(_0x4b34a7,_0x53a97b){return _0x5a5b86[_0x28f6('0x10')][_0x28f6('0x8')]({'where':{'sectionId':_0x5e5e17['id']},'raw':!![]})[_0x28f6('0x9')](function(_0x6d7e81){if(_0xefbbe3[_0x28f6('0x6')]&&_0xefbbe3[_0x28f6('0x6')]!=='id'){_0x5e5e17['associatedResources']=_[_0x28f6('0xa')](_0x6d7e81,function(_0x2c3b34){return _0x2c3b34[_0xefbbe3[_0x28f6('0x6')]];});}else{if(_0x4d33a8==='AnalyticExtractedReport'){_0x5e5e17[_0x28f6('0xd')]=_['map'](_0x6d7e81,function(_0x2c4a8c){return{'id':_0x2c4a8c[_0x28f6('0x11')],'type':_0x2c4a8c[_0x28f6('0x12')]};});}else{_0x5e5e17[_0x28f6('0xd')]=_[_0x28f6('0xa')](_0x6d7e81,function(_0x414bb2){return _0x414bb2[_0x28f6('0x11')];});}}_0x4b34a7(_0x5e5e17);})['catch'](function(_0x1a1401){_0x53a97b(_0x1a1401);});});}function _0x434383(_0x4119ec,_0x28364e){var _0x5296e4={'parentSections':[]};switch(_0x4119ec['toLowerCase']()){case _0x28f6('0x13'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x15');break;case _0x28f6('0x16'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x17');break;case'squarerecordings':_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x18');_0x5296e4[_0x28f6('0x19')]=[{'name':'SquareProjects','field':'name','foreignKey':_0x28f6('0x1a')}];break;case _0x28f6('0x1b'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x1c');break;case _0x28f6('0x1d'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x1e');_0x5296e4['parentSections']=[{'name':_0x28f6('0x1f'),'field':'id','foreignKey':_0x28f6('0x20')}];break;case _0x28f6('0x21'):_0x5296e4[_0x28f6('0x14')]='CmList';break;case _0x28f6('0x22'):_0x5296e4[_0x28f6('0x14')]='CmCompany';break;case _0x28f6('0x23'):_0x5296e4['childModel']='CmCustomField';break;case _0x28f6('0x24'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x25');break;case'chatwebsites':_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x26');break;case _0x28f6('0x27'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x28');break;case'faxaccounts':_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x29');break;case _0x28f6('0x2a'):case _0x28f6('0x2b'):case _0x28f6('0x2c'):_0x5296e4[_0x28f6('0x14')]='VoiceExtension';break;case'contexts':_0x5296e4['childModel']=_0x28f6('0x2d');break;case _0x28f6('0x2e'):_0x5296e4['childModel']='VoiceMail';break;case _0x28f6('0x2f'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x30');_0x5296e4[_0x28f6('0x19')]=[{'name':'Agents','field':_0x28f6('0xe'),'foreignKey':'membername','model':_0x28f6('0x31'),'filter':{'field':_0x28f6('0x32'),'value':[_0x28f6('0x33')]}},{'name':_0x28f6('0x34'),'field':_0x28f6('0xe'),'foreignKey':_0x28f6('0x35'),'model':_0x28f6('0x31'),'filter':{'field':'role','value':[_0x28f6('0x36')]}},{'name':_0x28f6('0x37'),'field':'name','foreignKey':_0x28f6('0x38'),'model':_0x28f6('0x39'),'filter':{'field':_0x28f6('0x12'),'value':[_0x28f6('0x3a')]}},{'name':_0x28f6('0x3b'),'field':_0x28f6('0xe'),'foreignKey':_0x28f6('0x38'),'model':_0x28f6('0x39'),'filter':{'field':_0x28f6('0x12'),'value':[_0x28f6('0x3c')]}}];break;case _0x28f6('0x3d'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x3e');break;case'chanspies':_0x5296e4['childModel']='VoiceChanSpy';break;case _0x28f6('0x3f'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x40');break;case'ivrcampaigns':_0x5296e4[_0x28f6('0x14')]='Campaign';break;case _0x28f6('0x41'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x42');break;case _0x28f6('0x43'):_0x5296e4['childModel']=_0x28f6('0x44');break;case'mailsubstatuses':_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x45');break;case _0x28f6('0x46'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x47');break;case'openchannelaccounts':_0x5296e4['childModel']='OpenchannelAccount';break;case'smsqueues':_0x5296e4[_0x28f6('0x14')]='SmsQueue';break;case _0x28f6('0x48'):_0x5296e4[_0x28f6('0x14')]='SmsAccount';break;case'whatsappqueues':_0x5296e4[_0x28f6('0x14')]='WhatsappQueue';break;case _0x28f6('0x49'):_0x5296e4[_0x28f6('0x14')]='WhatsappAccount';break;case _0x28f6('0x4a'):_0x5296e4['childModel']=_0x28f6('0x4b');break;case _0x28f6('0x4c'):case _0x28f6('0x4d'):_0x5296e4[_0x28f6('0x14')]='VoiceQueue';if(_0x28364e){_0x5296e4[_0x28f6('0x19')]=[{'name':_0x28f6('0x37')},{'name':_0x28f6('0x3b')}];}break;case _0x28f6('0x4e'):case _0x28f6('0x4f'):case _0x28f6('0x50'):_0x5296e4['childModel']='User';if(_0x28364e){_0x5296e4['parentSections']=[{'name':_0x28f6('0x51'),'filter':{'field':'role','value':[_0x28f6('0x52'),_0x28f6('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x28f6('0x54'):_0x5296e4['childModel']=_0x28f6('0x55');break;case _0x28f6('0x56'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x57');break;case'freshdeskaccounts':_0x5296e4['childModel']='FreshdeskAccount';break;case _0x28f6('0x58'):_0x5296e4[_0x28f6('0x14')]='SugarcrmAccount';break;case _0x28f6('0x59'):_0x5296e4['childModel']='DeskAccount';break;case _0x28f6('0x5a'):_0x5296e4[_0x28f6('0x14')]='ZohoAccount';break;case _0x28f6('0x5b'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x31');break;case _0x28f6('0x5c'):_0x5296e4['childModel']=_0x28f6('0x5d');break;case _0x28f6('0x5e'):_0x5296e4['childModel']=_0x28f6('0x5f');break;case _0x28f6('0x60'):_0x5296e4[_0x28f6('0x14')]='Dashboard';break;case _0x28f6('0x61'):_0x5296e4[_0x28f6('0x14')]='Interval';break;case _0x28f6('0x62'):_0x5296e4[_0x28f6('0x14')]='Pause';break;case'scheduler':_0x5296e4['childModel']=_0x28f6('0x63');break;case _0x28f6('0x64'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x65');break;case _0x28f6('0x66'):_0x5296e4['childModel']=_0x28f6('0x67');break;case _0x28f6('0x68'):_0x5296e4[_0x28f6('0x14')]='Template';break;case _0x28f6('0x69'):_0x5296e4['childModel']='Trigger';break;case'trunks':_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x6a');break;case _0x28f6('0x6b'):_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x6c');break;case'plugins':_0x5296e4[_0x28f6('0x14')]=_0x28f6('0x6d');break;case'extractedreports':_0x5296e4[_0x28f6('0x14')]='AnalyticExtractedReport';_0x5296e4[_0x28f6('0x19')]=[{'name':_0x28f6('0x6e'),'field':'id','foreignKey':_0x28f6('0x6f')}];break;case'metrics':_0x5296e4[_0x28f6('0x14')]='AnalyticMetric';break;}return _0x5296e4;}function _0x39e4fd(_0x263e64,_0x193ffa){var _0x21b34d=_0x263e64[_0x28f6('0x70')](0x0)[_0x28f6('0x71')]()+_0x263e64[_0x28f6('0x72')](0x1);var _0x55246e={'type':_0x5a5b86[_0x28f6('0x73')][_0x28f6('0x74')][_0x28f6('0x75')],'raw':!![]};return new Promise(function(_0x2e324d,_0x160bd2){var _0x310407=squel[_0x28f6('0x76')]()[_0x28f6('0x6')](_0x28f6('0x77')+_0x21b34d+_0x28f6('0x78'),'id')[_0x28f6('0x6')](_0x28f6('0x79'))['from'](_0x28f6('0x7a')+_0x263e64+_0x28f6('0x7b'),'ui')['where'](_0x28f6('0x7c'),_0x193ffa['id']);return _0x5a5b86[_0x28f6('0x7d')][_0x28f6('0x7e')](_0x310407[_0x28f6('0x7f')](),_0x55246e)[_0x28f6('0x9')](function(_0x4fef53){_0x193ffa[_0x21b34d+_0x28f6('0x80')]=_0x4fef53;_0x2e324d(_0x4fef53);})[_0x28f6('0xb')](function(_0x4f5993){_0x160bd2(_0x4f5993);});});}return _0x128705['define'](_0x28f6('0x81'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x7acc98){var _0x59baa3={'raw':_0x7acc98[_0x28f6('0x7e')][_0x28f6('0x82')],'where':{}};var _0x58d79c={};var _0x2590ec={'count':0x0,'rows':[]};var _0x19432c=_0x7acc98[_0x28f6('0x7e')][_0x28f6('0x83')];var _0x263590=_0x7acc98['query'][_0x28f6('0x84')]||![];var _0x1af940=_0x434383(_0x19432c,_0x263590);if(!_0x1af940[_0x28f6('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x19432c+'\x27');var _0x52411e=[{'name':_0x19432c}];if(!_[_0x28f6('0x85')](_0x1af940[_0x28f6('0x19')]))_0x52411e=_0x1af940[_0x28f6('0x19')];var _0x34f21d=[];for(var _0x2413d7=0x0;_0x2413d7<_0x52411e[_0x28f6('0x86')];_0x2413d7++){_0x34f21d[_0x28f6('0x87')](_0x5a5b86[_0x28f6('0x88')][_0x28f6('0x89')]({'where':{'userProfileId':_0x7acc98[_0x28f6('0x8a')]['id'],'name':_0x52411e[_0x2413d7][_0x28f6('0xe')]},'raw':!![]}));}return Promise[_0x28f6('0x8b')](_0x34f21d)['then'](function(_0x3566df){var _0x2121b4=_[_0x28f6('0x5')](_0x3566df,function(_0x5cbf7e){return _0x5cbf7e?_0x5cbf7e:undefined;});var _0x2e9f65=_[_0x28f6('0x5')](_0x52411e,[_0x28f6('0x8c'),!![]]);var _0x4b9f21=_[_0x28f6('0x85')](_0x2121b4)&&_[_0x28f6('0x85')](_0x2e9f65)?null:_['union'](_0x2e9f65,_0x2121b4);if(!_0x4b9f21)return null;var _0x3df9c4=[];for(var _0x533d06=0x0;_0x533d06<_0x4b9f21[_0x28f6('0x86')];_0x533d06++){var _0x48db00=_['find'](_0x52411e,function(_0x4904fa){return _0x4b9f21[_0x533d06]?_0x4904fa[_0x28f6('0xe')]===_0x4b9f21[_0x533d06][_0x28f6('0xe')]:null;});if(_0x48db00){if(_0x4b9f21[_0x533d06][_0x28f6('0x8c')]){_0x3df9c4[_0x28f6('0x87')](_0x17113e(_0x1af940['childModel'],_0x4b9f21[_0x533d06]));}else{if(!_0x4b9f21[_0x533d06][_0x28f6('0x8d')]){_0x3df9c4['push'](_0x448ab6(_0x48db00,_0x4b9f21[_0x533d06],_0x1af940[_0x28f6('0x14')]));}else{if(_0x48db00['model']){_0x3df9c4[_0x28f6('0x87')](_0x20a920(_0x48db00,_0x4b9f21[_0x533d06]));}}}}}return Promise[_0x28f6('0x8b')](_0x3df9c4);})[_0x28f6('0x9')](function(_0x3c9f82){var _0x52d633=_0x3c9f82;var _0x3e21a8=null;if(_0x52d633){_0x3e21a8=_0x52d633['length']===0x1?_0x52d633[0x0]:null;}if(!_0x3e21a8&&!_0x52d633)return _0x2590ec;var _0x53e965=_0x5a5b86[_0x1af940[_0x28f6('0x14')]][_0x28f6('0x8e')];_0x58d79c['model']=_[_0x28f6('0x8f')](_0x53e965);_0x58d79c[_0x28f6('0x7e')]=_['keys'](_0x7acc98[_0x28f6('0x7e')]);_0x58d79c[_0x28f6('0x90')]=_[_0x28f6('0x91')](_0x58d79c[_0x28f6('0xc')],_0x58d79c[_0x28f6('0x7e')]);_0x59baa3[_0x28f6('0x92')]=_[_0x28f6('0x91')](_0x58d79c[_0x28f6('0xc')],qs[_0x28f6('0x93')](_0x7acc98[_0x28f6('0x7e')][_0x28f6('0x93')]));_0x59baa3[_0x28f6('0x92')]=_0x59baa3['attributes']['length']?_0x59baa3[_0x28f6('0x92')]:_0x58d79c[_0x28f6('0xc')];if(!_0x7acc98['query'][_0x28f6('0x94')](_0x28f6('0x95'))){_0x59baa3[_0x28f6('0x96')]=qs['limit'](_0x7acc98[_0x28f6('0x7e')][_0x28f6('0x96')]);_0x59baa3[_0x28f6('0x97')]=qs[_0x28f6('0x97')](_0x7acc98['query'][_0x28f6('0x97')]);}_0x59baa3['order']=qs['sort'](_0x7acc98['query'][_0x28f6('0x98')]);_0x59baa3[_0x28f6('0x99')]=qs[_0x28f6('0x90')](_[_0x28f6('0x9a')](_0x7acc98[_0x28f6('0x7e')],_0x58d79c[_0x28f6('0x90')]));if(_0x7acc98[_0x28f6('0x7e')][_0x28f6('0x5')]){_0x59baa3[_0x28f6('0x99')]=_[_0x28f6('0x9b')](_0x59baa3['where'],{'$or':_[_0x28f6('0xa')](_0x53e965,function(_0x6d66e2){if(_0x6d66e2['type']['key']!==_0x28f6('0x9c')){var _0x580a49={};_0x580a49[_0x6d66e2[_0x28f6('0x6')]]={'$like':'%'+_0x7acc98[_0x28f6('0x7e')][_0x28f6('0x5')]+'%'};return _0x580a49;}})});}var _0xcd320d=[];var _0x5812b6=null;var _0x3ea4e3={};if(_0x3e21a8){_0x5812b6=_[_0x28f6('0x89')](_0x52411e,[_0x28f6('0xe'),_0x3e21a8[_0x28f6('0xe')]]);if(_0x5812b6[_0x28f6('0x6')]){_0x3ea4e3={};if(_0x1af940[_0x28f6('0x14')]===_0x28f6('0x9d')){_0x3ea4e3[_0x5812b6[_0x28f6('0x9e')]]=_['map'](_0x3e21a8[_0x28f6('0xd')],'id');}else{_0x3ea4e3[_0x5812b6['foreignKey']]=_0x3e21a8[_0x28f6('0xd')];}_0xcd320d[_0x28f6('0x87')](_0x3ea4e3);}else{_0x59baa3[_0x28f6('0x99')]['id']=_0x3e21a8['associatedResources'];}}else{for(var _0x1ed7fb=0x0;_0x1ed7fb<_0x52d633[_0x28f6('0x86')];_0x1ed7fb++){_0x5812b6=_['find'](_0x52411e,[_0x28f6('0xe'),_0x52d633[_0x1ed7fb][_0x28f6('0xe')]]);if(_0x5812b6['field']){_0x3ea4e3={};_0x3ea4e3[_0x5812b6[_0x28f6('0x9e')]]=_0x52d633[_0x1ed7fb][_0x28f6('0xd')];_0xcd320d[_0x28f6('0x87')](_0x3ea4e3);}else{if(!_0x59baa3[_0x28f6('0x99')]['id'])_0x59baa3[_0x28f6('0x99')]['id']=[];_0x52d633[_0x1ed7fb][_0x28f6('0xd')][_0x28f6('0x9f')](function(_0x2f73d3){_0x59baa3[_0x28f6('0x99')]['id'][_0x28f6('0x87')](_0x2f73d3);});}}}if(!_[_0x28f6('0x85')](_0xcd320d)){_0x59baa3[_0x28f6('0x99')]=_['merge'](_0x59baa3[_0x28f6('0x99')],{'$and':{'$or':_0xcd320d}});}_0x59baa3=_[_0x28f6('0x9b')]({},_0x59baa3,_0x7acc98[_0x28f6('0xa0')]);if(_0x3e21a8&&!_0x3e21a8[_0x28f6('0x8d')]&&_0x1af940[_0x28f6('0x14')]===_0x28f6('0x9d')){if(_0x7acc98['query'][_0x28f6('0xa1')]){_0x59baa3[_0x28f6('0xa2')]=[{'all':!![]}];}return _0x5a5b86[_0x1af940[_0x28f6('0x14')]][_0x28f6('0x8')](_0x59baa3)['then'](function(_0x6cae65){var _0x43ed1c=[];_0x6cae65[_0x28f6('0x9f')](function(_0x4090f1){var _0x21fb6b;switch(_0x4090f1[_0x28f6('0xa3')]){case _0x28f6('0xa4'):_0x21fb6b=_['find'](_0x3e21a8[_0x28f6('0xd')],function(_0x5ca661){return _0x5ca661['id']===_0x4090f1[_0x28f6('0x6f')]&&_0x5ca661[_0x28f6('0x12')]===_0x28f6('0xa5');});break;case _0x28f6('0xa6'):_0x21fb6b=_[_0x28f6('0x89')](_0x3e21a8['associatedResources'],function(_0x193020){return _0x193020['id']===_0x4090f1[_0x28f6('0x6f')]&&_0x193020[_0x28f6('0x12')]===_0x28f6('0xa7');});break;}if(_0x21fb6b)_0x43ed1c[_0x28f6('0x87')](_0x4090f1);});_0x2590ec[_0x28f6('0xa8')]=_0x43ed1c['length'];_0x2590ec[_0x28f6('0xa9')]=_0x43ed1c;return _0x2590ec;});}else{if(!_[_0x28f6('0x85')](_0x7acc98[_0x28f6('0x7e')][_0x28f6('0xaa')])){_0x59baa3['where']['id']=_0x59baa3[_0x28f6('0x99')]['id']?_[_0x28f6('0x91')](_0x59baa3[_0x28f6('0x99')]['id'],_0x7acc98[_0x28f6('0x7e')][_0x28f6('0xaa')]):_0x7acc98['query'][_0x28f6('0xaa')];if(_0x7acc98[_0x28f6('0x7e')]['customSorting']){_0x59baa3[_0x28f6('0xab')]=_0x7acc98[_0x28f6('0x7e')]['customSorting'];}}if(_0x7acc98['query'][_0x28f6('0xac')]){_0x59baa3[_0x28f6('0x99')]=_[_0x28f6('0x9b')](_0x59baa3[_0x28f6('0x99')],{'$and':_0x7acc98[_0x28f6('0x7e')][_0x28f6('0xac')]});}return _0x5a5b86[_0x1af940[_0x28f6('0x14')]][_0x28f6('0xa8')]({'where':_0x59baa3[_0x28f6('0x99')]})['then'](function(_0x1a99ef){_0x2590ec[_0x28f6('0xa8')]=_0x1a99ef;if(_0x7acc98[_0x28f6('0x7e')]['includeAll']){if(_0x1af940['childModel']===_0x28f6('0x1e')){_0x59baa3['include']=[{'model':_0x5a5b86['Tag'],'as':'Tags','attributes':['id',_0x28f6('0xe'),_0x28f6('0xad')],'required':_0x7acc98['query']['tag']?!![]:![]},{'model':_0x5a5b86['Tag'],'as':_0x28f6('0xae'),'attributes':['id','name','color'],'through':_0x7acc98[_0x28f6('0x7e')]['tag']?{'attributes':[],'where':{'TagId':_0x7acc98[_0x28f6('0x7e')][_0x28f6('0xaf')]||undefined}}:{},'required':_0x7acc98[_0x28f6('0x7e')][_0x28f6('0xaf')]?!![]:![]}];}else{_0x59baa3[_0x28f6('0xa2')]=[{'all':!![]}];}}return _0x5a5b86[_0x1af940[_0x28f6('0x14')]]['findAll'](_0x59baa3);})[_0x28f6('0x9')](function(_0x2b986c){_0x2590ec[_0x28f6('0xa9')]=_0x2b986c;if(_0x19432c===_0x28f6('0xb0')&&_0x7acc98[_0x28f6('0x7e')][_0x28f6('0xb1')]===_0x28f6('0xb2')){var _0xbece6c=[];for(var _0x5a2c5e=0x0;_0x5a2c5e<_0x2590ec[_0x28f6('0xa9')][_0x28f6('0x86')];_0x5a2c5e++){_0xbece6c[_0x28f6('0x87')](_0x39e4fd(_0x28f6('0xb3'),_0x2590ec[_0x28f6('0xa9')][_0x5a2c5e][_0x28f6('0xb4')]));_0xbece6c['push'](_0x39e4fd('sms',_0x2590ec['rows'][_0x5a2c5e]['dataValues']));_0xbece6c['push'](_0x39e4fd(_0x28f6('0xb5'),_0x2590ec['rows'][_0x5a2c5e]['dataValues']));_0xbece6c[_0x28f6('0x87')](_0x39e4fd(_0x28f6('0xb6'),_0x2590ec[_0x28f6('0xa9')][_0x5a2c5e]['dataValues']));_0xbece6c[_0x28f6('0x87')](_0x39e4fd(_0x28f6('0xb7'),_0x2590ec['rows'][_0x5a2c5e][_0x28f6('0xb4')]));_0xbece6c[_0x28f6('0x87')](_0x39e4fd(_0x28f6('0xb8'),_0x2590ec['rows'][_0x5a2c5e][_0x28f6('0xb4')]));}return Promise[_0x28f6('0x8b')](_0xbece6c)[_0x28f6('0x9')](function(){return _0x2590ec;});}return _0x2590ec;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f3b5500..1669c7b 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 _0x095b=['UserProfile,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x36f353,_0x1b2dee){var _0x5961eb=function(_0x47512f){while(--_0x47512f){_0x36f353['push'](_0x36f353['shift']());}};_0x5961eb(++_0x1b2dee);}(_0x095b,0x6e));var _0xb095=function(_0x530987,_0x448881){_0x530987=_0x530987-0x0;var _0x2cd406=_0x095b[_0x530987];return _0x2cd406;};'use strict';var _=require(_0xb095('0x0'));var util=require('util');var moment=require(_0xb095('0x1'));var BPromise=require(_0xb095('0x2'));var rs=require(_0xb095('0x3'));var fs=require('fs');var Redis=require(_0xb095('0x4'));var db=require(_0xb095('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb095('0x6'))(_0xb095('0x7'));var config=require(_0xb095('0x8'));var jayson=require(_0xb095('0x9'));var client=jayson[_0xb095('0xa')][_0xb095('0xb')]({'port':0x232a});config[_0xb095('0xc')]=_[_0xb095('0xd')](config[_0xb095('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb095('0xe'))(new Redis(config[_0xb095('0xc')]));require(_0xb095('0xf'))[_0xb095('0x10')](socket);function respondWithRpcPromise(_0x10efbe,_0x311c57,_0x5c3522){return new BPromise(function(_0x47f74d,_0x2e510a){return client[_0xb095('0x11')](_0x10efbe,_0x5c3522)['then'](function(_0x192d2){logger[_0xb095('0x12')]('UserProfile,\x20%s,\x20%s',_0x311c57,_0xb095('0x13'));logger['debug'](_0xb095('0x14'),_0x311c57,_0xb095('0x13'),JSON[_0xb095('0x15')](_0x192d2));if(_0x192d2[_0xb095('0x16')]){if(_0x192d2[_0xb095('0x16')][_0xb095('0x17')]===0x1f4){logger[_0xb095('0x16')]('UserProfile,\x20%s,\x20%s',_0x311c57,_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);return _0x2e510a(_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);}logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x192d2['error']['message']);return _0x47f74d(_0x192d2['error'][_0xb095('0x18')]);}else{logger[_0xb095('0x12')](_0xb095('0x19'),_0x311c57,_0xb095('0x13'));_0x47f74d(_0x192d2[_0xb095('0x1a')][_0xb095('0x18')]);}})['catch'](function(_0x7f9045){logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x7f9045);_0x2e510a(_0x7f9045);});});} \ No newline at end of file +var _0xd2f5=['socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x268a71,_0x320096){var _0xd456b3=function(_0x200e01){while(--_0x200e01){_0x268a71['push'](_0x268a71['shift']());}};_0xd456b3(++_0x320096);}(_0xd2f5,0x144));var _0x5d2f=function(_0x2481f9,_0x4cfd65){_0x2481f9=_0x2481f9-0x0;var _0x2b4b14=_0xd2f5[_0x2481f9];return _0x2b4b14;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});config['redis']=_[_0x5d2f('0xb')](config[_0x5d2f('0xc')],{'host':_0x5d2f('0xd'),'port':0x18eb});var socket=require(_0x5d2f('0xe'))(new Redis(config[_0x5d2f('0xc')]));require(_0x5d2f('0xf'))['register'](socket);function respondWithRpcPromise(_0x305434,_0xcd29b4,_0x4e24af){return new BPromise(function(_0x90b987,_0xd738c6){return client[_0x5d2f('0x10')](_0x305434,_0x4e24af)['then'](function(_0x39b43b){logger[_0x5d2f('0x11')](_0x5d2f('0x12'),_0xcd29b4,'request\x20sent');logger['debug'](_0x5d2f('0x13'),_0xcd29b4,'request\x20sent',JSON[_0x5d2f('0x14')](_0x39b43b));if(_0x39b43b[_0x5d2f('0x15')]){if(_0x39b43b['error'][_0x5d2f('0x16')]===0x1f4){logger['error'](_0x5d2f('0x12'),_0xcd29b4,_0x39b43b[_0x5d2f('0x15')][_0x5d2f('0x17')]);return _0xd738c6(_0x39b43b['error'][_0x5d2f('0x17')]);}logger[_0x5d2f('0x15')](_0x5d2f('0x12'),_0xcd29b4,_0x39b43b[_0x5d2f('0x15')][_0x5d2f('0x17')]);return _0x90b987(_0x39b43b['error'][_0x5d2f('0x17')]);}else{logger[_0x5d2f('0x11')](_0x5d2f('0x12'),_0xcd29b4,_0x5d2f('0x18'));_0x90b987(_0x39b43b['result'][_0x5d2f('0x17')]);}})[_0x5d2f('0x19')](function(_0x36ddf1){logger[_0x5d2f('0x15')](_0x5d2f('0x12'),_0xcd29b4,_0x36ddf1);_0xd738c6(_0x36ddf1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c466ebf..34d5984 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 _0x6e2b=['emit','removeListener','register','length','./userProfile.events','save','update'];(function(_0x3e7e5e,_0x4e55e3){var _0x2a0636=function(_0x5df80b){while(--_0x5df80b){_0x3e7e5e['push'](_0x3e7e5e['shift']());}};_0x2a0636(++_0x4e55e3);}(_0x6e2b,0x1a8));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var UserProfileEvents=require(_0xb6e2('0x0'));var events=[_0xb6e2('0x1'),'remove',_0xb6e2('0x2')];function createListener(_0x50f9ef,_0x980123){return function(_0x29bdae){_0x980123[_0xb6e2('0x3')](_0x50f9ef,_0x29bdae);};}function removeListener(_0x5f5a15,_0x4c683a){return function(){UserProfileEvents[_0xb6e2('0x4')](_0x5f5a15,_0x4c683a);};}exports[_0xb6e2('0x5')]=function(_0xbcc4b3){for(var _0xdf4e21=0x0,_0x3fb7e8=events[_0xb6e2('0x6')];_0xdf4e21<_0x3fb7e8;_0xdf4e21++){var _0x2c5ba4=events[_0xdf4e21];var _0xaa119b=createListener('userProfile:'+_0x2c5ba4,_0xbcc4b3);UserProfileEvents['on'](_0x2c5ba4,_0xaa119b);}}; \ No newline at end of file +var _0x9a5f=['length','save','remove','update','removeListener','register'];(function(_0x40c364,_0x45955e){var _0x5caac0=function(_0x4bcc5a){while(--_0x4bcc5a){_0x40c364['push'](_0x40c364['shift']());}};_0x5caac0(++_0x45955e);}(_0x9a5f,0x1b1));var _0xf9a5=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x9a5f[_0x28394f];return _0x2618d2;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xf9a5('0x0'),_0xf9a5('0x1'),_0xf9a5('0x2')];function createListener(_0x45a030,_0xfc5584){return function(_0x4aa372){_0xfc5584['emit'](_0x45a030,_0x4aa372);};}function removeListener(_0x3244a5,_0x2757c3){return function(){UserProfileEvents[_0xf9a5('0x3')](_0x3244a5,_0x2757c3);};}exports[_0xf9a5('0x4')]=function(_0x2e4adc){for(var _0x26bc20=0x0,_0x4d799d=events[_0xf9a5('0x5')];_0x26bc20<_0x4d799d;_0x26bc20++){var _0x32e580=events[_0x26bc20];var _0xd4dd28=createListener('userProfile:'+_0x32e580,_0x2e4adc);UserProfileEvents['on'](_0x32e580,_0xd4dd28);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fcf8b39..03fc271 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 _0xa87e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','create','update','delete','/:id','util','path','connect-timeout'];(function(_0x4a8f8d,_0x58bfe9){var _0x39e20d=function(_0x1f8a89){while(--_0x1f8a89){_0x4a8f8d['push'](_0x4a8f8d['shift']());}};_0x39e20d(++_0x58bfe9);}(_0xa87e,0x173));var _0xea87=function(_0x452ae3,_0x9e166b){_0x452ae3=_0x452ae3-0x0;var _0x6683d2=_0xa87e[_0x452ae3];return _0x6683d2;};'use strict';var multer=require('multer');var util=require(_0xea87('0x0'));var path=require(_0xea87('0x1'));var timeout=require(_0xea87('0x2'));var express=require('express');var router=express[_0xea87('0x3')]();var fs_extra=require(_0xea87('0x4'));var auth=require(_0xea87('0x5'));var interaction=require(_0xea87('0x6'));var config=require(_0xea87('0x7'));var controller=require('./userProfileResource.controller');router[_0xea87('0x8')]('/',auth[_0xea87('0x9')](),controller['index']);router[_0xea87('0x8')](_0xea87('0xa'),auth[_0xea87('0x9')](),controller[_0xea87('0xb')]);router[_0xea87('0x8')]('/:id',auth[_0xea87('0x9')](),controller[_0xea87('0xc')]);router['post']('/',auth[_0xea87('0x9')](),controller[_0xea87('0xd')]);router['put']('/:id',auth[_0xea87('0x9')](),controller[_0xea87('0xe')]);router[_0xea87('0xf')](_0xea87('0x10'),auth[_0xea87('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc29b=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x3f802f,_0x20d103){var _0x5dd12d=function(_0x5c99c9){while(--_0x5c99c9){_0x3f802f['push'](_0x3f802f['shift']());}};_0x5dd12d(++_0x20d103);}(_0xc29b,0x12d));var _0xbc29=function(_0x3ab888,_0x8b3d89){_0x3ab888=_0x3ab888-0x0;var _0x2d3cb3=_0xc29b[_0x3ab888];return _0x2d3cb3;};'use strict';var multer=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var path=require(_0xbc29('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc29('0x3'));var router=express[_0xbc29('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbc29('0x5'));var interaction=require(_0xbc29('0x6'));var config=require(_0xbc29('0x7'));var controller=require(_0xbc29('0x8'));router[_0xbc29('0x9')]('/',auth[_0xbc29('0xa')](),controller[_0xbc29('0xb')]);router[_0xbc29('0x9')](_0xbc29('0xc'),auth[_0xbc29('0xa')](),controller[_0xbc29('0xd')]);router[_0xbc29('0x9')](_0xbc29('0xe'),auth[_0xbc29('0xa')](),controller[_0xbc29('0xf')]);router[_0xbc29('0x10')]('/',auth[_0xbc29('0xa')](),controller[_0xbc29('0x11')]);router[_0xbc29('0x12')](_0xbc29('0xe'),auth['isAuthenticated'](),controller[_0xbc29('0x13')]);router[_0xbc29('0x14')](_0xbc29('0xe'),auth[_0xbc29('0xa')](),controller[_0xbc29('0x15')]);module[_0xbc29('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a95fee2..03f500e 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 _0xd476=['exports','STRING','sequelize'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0xd476,0x1c4));var _0x6d47=function(_0x21abd4,_0x38a273){_0x21abd4=_0x21abd4-0x0;var _0x24398a=_0xd476[_0x21abd4];return _0x24398a;};'use strict';var Sequelize=require(_0x6d47('0x0'));module[_0x6d47('0x1')]={'name':{'type':Sequelize[_0x6d47('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x6d47('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5e7c=['INTEGER','sequelize','STRING'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x5e7c,0x8e));var _0xc5e7=function(_0x2e9b42,_0x58922a){_0x2e9b42=_0x2e9b42-0x0;var _0x2d8653=_0x5e7c[_0x2e9b42];return _0x2d8653;};'use strict';var Sequelize=require(_0xc5e7('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5e7('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc5e7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc5e7('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 595453c..48f73ce 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 _0x7880=['destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0x3d784f,_0x100ef1){var _0x32340e=function(_0xfd0c00){while(--_0xfd0c00){_0x3d784f['push'](_0x3d784f['shift']());}};_0x32340e(++_0x100ef1);}(_0x7880,0x1f4));var _0x0788=function(_0x324f55,_0x2e6ca4){_0x324f55=_0x324f55-0x0;var _0x284952=_0x7880[_0x324f55];return _0x284952;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['UserProfileResource'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));};exports['describe']=function(_0x1693d0,_0x5d32ae){return db['UserProfileResource'][_0x0788('0x4c')]()[_0x0788('0x26')](respondWithResult(_0x5d32ae,null))[_0x0788('0x44')](handleError(_0x5d32ae,null));}; \ No newline at end of file +var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','UserProfileResource','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x5d1f3c,_0x8bbd32){var _0x3c8c9c=function(_0x43ab16){while(--_0x43ab16){_0x5d1f3c['push'](_0x5d1f3c['shift']());}};_0x3c8c9c(++_0x8bbd32);}(_0x2ef3,0xba));var _0x32ef=function(_0x32da4b,_0x568dc0){_0x32da4b=_0x32da4b-0x0;var _0x31c750=_0x2ef3[_0x32da4b];return _0x31c750;};'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['UserProfileResource'][_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['UserProfileResource'][_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['UserProfileResource']['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));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b0233a2..48b52d3 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 _0xe512=['user_profile_has_resources','sectionId','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource'];(function(_0x56c2c7,_0x5f4831){var _0x2a9dfb=function(_0x48de17){while(--_0x48de17){_0x56c2c7['push'](_0x56c2c7['shift']());}};_0x2a9dfb(++_0x5f4831);}(_0xe512,0x116));var _0x2e51=function(_0xe7ded6,_0x422156){_0xe7ded6=_0xe7ded6-0x0;var _0x23312b=_0xe512[_0xe7ded6];return _0x23312b;};'use strict';var _=require(_0x2e51('0x0'));var util=require(_0x2e51('0x1'));var logger=require('../../config/logger')(_0x2e51('0x2'));var moment=require(_0x2e51('0x3'));var BPromise=require(_0x2e51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e51('0x5'));var config=require(_0x2e51('0x6'));var attributes=require(_0x2e51('0x7'));module[_0x2e51('0x8')]=function(_0x3ad517,_0x566593){return _0x3ad517['define'](_0x2e51('0x9'),attributes,{'tableName':_0x2e51('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x2e51('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x495b=['path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','resourceId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0x495b,0x19a));var _0xb495=function(_0x50a010,_0x131e1a){_0x50a010=_0x50a010-0x0;var _0x54841a=_0x495b[_0x50a010];return _0x54841a;};'use strict';var _=require(_0xb495('0x0'));var util=require(_0xb495('0x1'));var logger=require(_0xb495('0x2'))(_0xb495('0x3'));var moment=require(_0xb495('0x4'));var BPromise=require('bluebird');var rp=require(_0xb495('0x5'));var fs=require('fs');var path=require(_0xb495('0x6'));var rimraf=require(_0xb495('0x7'));var config=require('../../config/environment');var attributes=require(_0xb495('0x8'));module[_0xb495('0x9')]=function(_0x441f05,_0xced9a1){return _0x441f05[_0xb495('0xa')](_0xb495('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb495('0xc'),'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 ffac34a..f7d9d92 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 _0xf458=['../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x467ef6,_0x932cef){var _0x3e4aa2=function(_0xb56bb5){while(--_0xb56bb5){_0x467ef6['push'](_0x467ef6['shift']());}};_0x3e4aa2(++_0x932cef);}(_0xf458,0x1e9));var _0x8f45=function(_0xdef75a,_0x278770){_0xdef75a=_0xdef75a-0x0;var _0x36a968=_0xf458[_0xdef75a];return _0x36a968;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f45('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f45('0x1'))['db'];var utils=require(_0x8f45('0x2'));var logger=require('../../config/logger')(_0x8f45('0x3'));var config=require(_0x8f45('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8f45('0x5')][_0x8f45('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3d4bdc,_0x59a80c,_0x126dca){return new BPromise(function(_0x45531d,_0x1c7efa){return client[_0x8f45('0x7')](_0x3d4bdc,_0x126dca)[_0x8f45('0x8')](function(_0x43ffc4){logger[_0x8f45('0x9')](_0x8f45('0xa'),_0x59a80c,_0x8f45('0xb'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x59a80c,'request\x20sent',JSON[_0x8f45('0xc')](_0x43ffc4));if(_0x43ffc4['error']){if(_0x43ffc4[_0x8f45('0xd')]['code']===0x1f4){logger[_0x8f45('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x59a80c,_0x43ffc4['error'][_0x8f45('0xe')]);return _0x1c7efa(_0x43ffc4[_0x8f45('0xd')][_0x8f45('0xe')]);}logger[_0x8f45('0xd')](_0x8f45('0xa'),_0x59a80c,_0x43ffc4[_0x8f45('0xd')][_0x8f45('0xe')]);return _0x45531d(_0x43ffc4['error'][_0x8f45('0xe')]);}else{logger['info'](_0x8f45('0xa'),_0x59a80c,_0x8f45('0xb'));_0x45531d(_0x43ffc4[_0x8f45('0xf')]['message']);}})[_0x8f45('0x10')](function(_0x52f747){logger[_0x8f45('0xd')](_0x8f45('0xa'),_0x59a80c,_0x52f747);_0x1c7efa(_0x52f747);});});} \ No newline at end of file +var _0x9410=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','client','http','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x15e273,_0x46895a){var _0x150632=function(_0x52706a){while(--_0x52706a){_0x15e273['push'](_0x15e273['shift']());}};_0x150632(++_0x46895a);}(_0x9410,0x116));var _0x0941=function(_0x501fe3,_0x1430b8){_0x501fe3=_0x501fe3-0x0;var _0x4555c3=_0x9410[_0x501fe3];return _0x4555c3;};'use strict';var _=require(_0x0941('0x0'));var util=require(_0x0941('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0941('0x2'));var fs=require('fs');var Redis=require(_0x0941('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0941('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0941('0x5')][_0x0941('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x590cc9,_0x5ea7ba,_0x44df9f){return new BPromise(function(_0xac0641,_0x227f3f){return client['request'](_0x590cc9,_0x44df9f)[_0x0941('0x7')](function(_0x29aec1){logger[_0x0941('0x8')](_0x0941('0x9'),_0x5ea7ba,'request\x20sent');logger[_0x0941('0xa')](_0x0941('0xb'),_0x5ea7ba,'request\x20sent',JSON['stringify'](_0x29aec1));if(_0x29aec1[_0x0941('0xc')]){if(_0x29aec1[_0x0941('0xc')][_0x0941('0xd')]===0x1f4){logger[_0x0941('0xc')](_0x0941('0x9'),_0x5ea7ba,_0x29aec1['error'][_0x0941('0xe')]);return _0x227f3f(_0x29aec1[_0x0941('0xc')]['message']);}logger[_0x0941('0xc')](_0x0941('0x9'),_0x5ea7ba,_0x29aec1[_0x0941('0xc')]['message']);return _0xac0641(_0x29aec1['error'][_0x0941('0xe')]);}else{logger['info'](_0x0941('0x9'),_0x5ea7ba,'request\x20sent');_0xac0641(_0x29aec1[_0x0941('0xf')]['message']);}})['catch'](function(_0x138360){logger[_0x0941('0xc')](_0x0941('0x9'),_0x5ea7ba,_0x138360);_0x227f3f(_0x138360);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 31c588b..ed7ad27 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 _0x01d7=['describe','/:id','show','create','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','index','/describe'];(function(_0x288f3d,_0x53316c){var _0x18d679=function(_0x481cd7){while(--_0x481cd7){_0x288f3d['push'](_0x288f3d['shift']());}};_0x18d679(++_0x53316c);}(_0x01d7,0x14b));var _0x701d=function(_0x4973a7,_0x15466c){_0x4973a7=_0x4973a7-0x0;var _0x922942=_0x01d7[_0x4973a7];return _0x922942;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x701d('0x0'));var express=require(_0x701d('0x1'));var router=express[_0x701d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x701d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x701d('0x4'));router[_0x701d('0x5')]('/',auth[_0x701d('0x6')](),controller[_0x701d('0x7')]);router['get'](_0x701d('0x8'),auth['isAuthenticated'](),controller[_0x701d('0x9')]);router[_0x701d('0x5')](_0x701d('0xa'),auth[_0x701d('0x6')](),controller[_0x701d('0xb')]);router['post']('/',auth[_0x701d('0x6')](),controller[_0x701d('0xc')]);router['put'](_0x701d('0xa'),auth[_0x701d('0x6')](),controller[_0x701d('0xd')]);router[_0x701d('0xe')]('/:id',auth[_0x701d('0x6')](),controller[_0x701d('0xf')]);module[_0x701d('0x10')]=router; \ No newline at end of file +var _0x36c3=['Router','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x2d2f8d,_0x49aadb){var _0x119da5=function(_0x2c9170){while(--_0x2c9170){_0x2d2f8d['push'](_0x2d2f8d['shift']());}};_0x119da5(++_0x49aadb);}(_0x36c3,0x1ef));var _0x336c=function(_0x3b9859,_0x52b534){_0x3b9859=_0x3b9859-0x0;var _0x3bc080=_0x36c3[_0x3b9859];return _0x3bc080;};'use strict';var multer=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var path=require(_0x336c('0x2'));var timeout=require(_0x336c('0x3'));var express=require(_0x336c('0x4'));var router=express[_0x336c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x336c('0x6'));var config=require('../../config/environment');var controller=require(_0x336c('0x7'));router[_0x336c('0x8')]('/',auth[_0x336c('0x9')](),controller[_0x336c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x336c('0xb')]);router['get'](_0x336c('0xc'),auth[_0x336c('0x9')](),controller[_0x336c('0xd')]);router[_0x336c('0xe')]('/',auth['isAuthenticated'](),controller[_0x336c('0xf')]);router[_0x336c('0x10')](_0x336c('0xc'),auth[_0x336c('0x9')](),controller[_0x336c('0x11')]);router[_0x336c('0x12')]('/:id',auth[_0x336c('0x9')](),controller[_0x336c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 04e362f..cfbef1d 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 _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x5d1ce1,_0x106716){var _0x282ee4=function(_0x250a2d){while(--_0x250a2d){_0x5d1ce1['push'](_0x5d1ce1['shift']());}};_0x282ee4(++_0x106716);}(_0x6cb4,0xff));var _0x46cb=function(_0xd43768,_0x553c8c){_0xd43768=_0xd43768-0x0;var _0x4b6a89=_0x6cb4[_0xd43768];return _0x4b6a89;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file +var _0xfcbb=['BOOLEAN','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','STRING'];(function(_0x1e6c20,_0x1993d3){var _0x52978a=function(_0x1b743a){while(--_0x1b743a){_0x1e6c20['push'](_0x1e6c20['shift']());}};_0x52978a(++_0x1993d3);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xc37462,_0x412d44){_0xc37462=_0xc37462-0x0;var _0x5f3592=_0xfcbb[_0xc37462];return _0x5f3592;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'name':{'type':Sequelize[_0xbfcb('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbfcb('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbfcb('0x2')],'set':function(_0x135741){this[_0xbfcb('0x4')]('crudPermissions',_0x135741?_0x135741['join'](''):[]);},'get':function(){return this[_0xbfcb('0x5')](_0xbfcb('0x6'))?this[_0xbfcb('0x5')](_0xbfcb('0x6'))[_0xbfcb('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d513b9e..6d1a3d4 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 _0xba0d=['order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xba0d,0x142));var _0xdba0=function(_0x5901e2,_0x11b970){_0x5901e2=_0x5901e2-0x0;var _0x14ebba=_0xba0d[_0x5901e2];return _0x14ebba;};'use strict';var emlformat=require(_0xdba0('0x0'));var rimraf=require(_0xdba0('0x1'));var zipdir=require(_0xdba0('0x2'));var jsonpatch=require(_0xdba0('0x3'));var rp=require('request-promise');var moment=require(_0xdba0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdba0('0x5'));var util=require(_0xdba0('0x6'));var path=require(_0xdba0('0x7'));var sox=require(_0xdba0('0x8'));var csv=require(_0xdba0('0x9'));var ejs=require(_0xdba0('0xa'));var fs=require('fs');var fs_extra=require(_0xdba0('0xb'));var _=require(_0xdba0('0xc'));var squel=require('squel');var crypto=require(_0xdba0('0xd'));var jsforce=require(_0xdba0('0xe'));var deskjs=require(_0xdba0('0xf'));var toCsv=require(_0xdba0('0x9'));var querystring=require(_0xdba0('0x10'));var Papa=require('papaparse');var Redis=require(_0xdba0('0x11'));var authService=require(_0xdba0('0x12'));var qs=require(_0xdba0('0x13'));var as=require(_0xdba0('0x14'));var hardwareService=require(_0xdba0('0x15'));var logger=require('../../config/logger')(_0xdba0('0x16'));var utils=require('../../config/utils');var config=require(_0xdba0('0x17'));var licenseUtil=require(_0xdba0('0x18'));var db=require(_0xdba0('0x19'))['db'];function respondWithStatusCode(_0x3d805e,_0x156cf6){_0x156cf6=_0x156cf6||0xcc;return function(_0x2e76d5){if(_0x2e76d5){return _0x3d805e[_0xdba0('0x1a')](_0x156cf6);}return _0x3d805e[_0xdba0('0x1b')](_0x156cf6)['end']();};}function respondWithResult(_0x5b506a,_0x1876b6){_0x1876b6=_0x1876b6||0xc8;return function(_0x1cd6ea){if(_0x1cd6ea){return _0x5b506a[_0xdba0('0x1b')](_0x1876b6)[_0xdba0('0x1c')](_0x1cd6ea);}};}function respondWithFilteredResult(_0x2c0ccf,_0x4240ae){return function(_0x5349a9){if(_0x5349a9){var _0x2ca541=typeof _0x4240ae[_0xdba0('0x1d')]===_0xdba0('0x1e')&&typeof _0x4240ae[_0xdba0('0x1f')]===_0xdba0('0x1e');var _0x592e52=_0x5349a9[_0xdba0('0x20')];var _0x42ea42=_0x2ca541?0x0:_0x4240ae[_0xdba0('0x1d')];var _0x5db68b=_0x2ca541?_0x5349a9['count']:_0x4240ae[_0xdba0('0x1d')]+_0x4240ae[_0xdba0('0x1f')];var _0x5940b7;if(_0x5db68b>=_0x592e52){_0x5db68b=_0x592e52;_0x5940b7=0xc8;}else{_0x5940b7=0xce;}_0x2c0ccf[_0xdba0('0x1b')](_0x5940b7);return _0x2c0ccf['set'](_0xdba0('0x21'),_0x42ea42+'-'+_0x5db68b+'/'+_0x592e52)[_0xdba0('0x1c')](_0x5349a9);}return null;};}function patchUpdates(_0x2ee491){return function(_0xb007ce){try{jsonpatch[_0xdba0('0x22')](_0xb007ce,_0x2ee491,!![]);}catch(_0x2598f7){return BPromise[_0xdba0('0x23')](_0x2598f7);}return _0xb007ce[_0xdba0('0x24')]();};}function saveUpdates(_0x5b6be9,_0x19a65c){return function(_0x582874){if(_0x582874){return _0x582874[_0xdba0('0x25')](_0x5b6be9)['then'](function(_0x3ed3df){return _0x3ed3df;});}return null;};}function removeEntity(_0x157bb0,_0x77689b){return function(_0x4cb1ea){if(_0x4cb1ea){return _0x4cb1ea[_0xdba0('0x26')]()[_0xdba0('0x27')](function(){_0x157bb0['status'](0xcc)[_0xdba0('0x28')]();});}};}function handleEntityNotFound(_0x2c5c7b,_0x50a616){return function(_0x4e7ca3){if(!_0x4e7ca3){_0x2c5c7b['sendStatus'](0x194);}return _0x4e7ca3;};}function handleError(_0x486cea,_0x8c0a4c){_0x8c0a4c=_0x8c0a4c||0x1f4;return function(_0xe15e11){logger['error'](_0xe15e11[_0xdba0('0x29')]);if(_0xe15e11['name']){delete _0xe15e11[_0xdba0('0x2a')];}_0x486cea[_0xdba0('0x1b')](_0x8c0a4c)[_0xdba0('0x2b')](_0xe15e11);};}exports[_0xdba0('0x2c')]=function(_0x3a0a3c,_0xdca2f1){var _0x4ec7b0={},_0x5d7dd8={},_0x1539c3={'count':0x0,'rows':[]};var _0x51fd95=_['map'](db[_0xdba0('0x2d')][_0xdba0('0x2e')],function(_0x36403d){return{'name':_0x36403d[_0xdba0('0x2f')],'type':_0x36403d[_0xdba0('0x30')][_0xdba0('0x31')]};});_0x5d7dd8['model']=_[_0xdba0('0x32')](_0x51fd95,_0xdba0('0x2a'));_0x5d7dd8[_0xdba0('0x33')]=_[_0xdba0('0x34')](_0x3a0a3c[_0xdba0('0x33')]);_0x5d7dd8['filters']=_[_0xdba0('0x35')](_0x5d7dd8[_0xdba0('0x36')],_0x5d7dd8['query']);_0x4ec7b0[_0xdba0('0x37')]=_['intersection'](_0x5d7dd8[_0xdba0('0x36')],qs[_0xdba0('0x38')](_0x3a0a3c[_0xdba0('0x33')][_0xdba0('0x38')]));_0x4ec7b0[_0xdba0('0x37')]=_0x4ec7b0[_0xdba0('0x37')]['length']?_0x4ec7b0[_0xdba0('0x37')]:_0x5d7dd8[_0xdba0('0x36')];if(!_0x3a0a3c[_0xdba0('0x33')][_0xdba0('0x39')]('nolimit')){_0x4ec7b0[_0xdba0('0x1f')]=qs[_0xdba0('0x1f')](_0x3a0a3c[_0xdba0('0x33')][_0xdba0('0x1f')]);_0x4ec7b0[_0xdba0('0x1d')]=qs[_0xdba0('0x1d')](_0x3a0a3c[_0xdba0('0x33')][_0xdba0('0x1d')]);}_0x4ec7b0[_0xdba0('0x3a')]=qs['sort'](_0x3a0a3c[_0xdba0('0x33')]['sort']);_0x4ec7b0[_0xdba0('0x3b')]=qs[_0xdba0('0x3c')](_[_0xdba0('0x3d')](_0x3a0a3c[_0xdba0('0x33')],_0x5d7dd8['filters']),_0x51fd95);if(_0x3a0a3c['query'][_0xdba0('0x3e')]){_0x4ec7b0[_0xdba0('0x3b')]=_[_0xdba0('0x3f')](_0x4ec7b0[_0xdba0('0x3b')],{'$or':_['map'](_0x51fd95,function(_0x4d3bf3){if(_0x4d3bf3[_0xdba0('0x30')]!==_0xdba0('0x40')){var _0x227f4f={};_0x227f4f[_0x4d3bf3[_0xdba0('0x2a')]]={'$like':'%'+_0x3a0a3c['query']['filter']+'%'};return _0x227f4f;}})});}_0x4ec7b0=_[_0xdba0('0x3f')]({},_0x4ec7b0,_0x3a0a3c[_0xdba0('0x41')]);var _0x17ead0={'where':_0x4ec7b0[_0xdba0('0x3b')]};return db[_0xdba0('0x2d')][_0xdba0('0x20')](_0x17ead0)[_0xdba0('0x27')](function(_0x359062){_0x1539c3[_0xdba0('0x20')]=_0x359062;if(_0x3a0a3c[_0xdba0('0x33')]['includeAll']){_0x4ec7b0[_0xdba0('0x42')]=[{'all':!![]}];}return db[_0xdba0('0x2d')][_0xdba0('0x43')](_0x4ec7b0);})[_0xdba0('0x27')](function(_0x3a178c){_0x1539c3[_0xdba0('0x44')]=_0x3a178c;return _0x1539c3;})[_0xdba0('0x27')](respondWithFilteredResult(_0xdca2f1,_0x4ec7b0))['catch'](handleError(_0xdca2f1,null));};exports['show']=function(_0x1d8b88,_0x170d96){var _0x50efed={'raw':![],'where':{'id':_0x1d8b88[_0xdba0('0x45')]['id']}},_0x291cc5={};_0x291cc5[_0xdba0('0x36')]=_[_0xdba0('0x34')](db['UserProfileSection'][_0xdba0('0x2e')]);_0x291cc5[_0xdba0('0x33')]=_[_0xdba0('0x34')](_0x1d8b88[_0xdba0('0x33')]);_0x291cc5[_0xdba0('0x3c')]=_[_0xdba0('0x35')](_0x291cc5[_0xdba0('0x36')],_0x291cc5['query']);_0x50efed[_0xdba0('0x37')]=_['intersection'](_0x291cc5[_0xdba0('0x36')],qs[_0xdba0('0x38')](_0x1d8b88[_0xdba0('0x33')][_0xdba0('0x38')]));_0x50efed[_0xdba0('0x37')]=_0x50efed[_0xdba0('0x37')][_0xdba0('0x46')]?_0x50efed[_0xdba0('0x37')]:_0x291cc5[_0xdba0('0x36')];if(_0x1d8b88['query'][_0xdba0('0x47')]){_0x50efed[_0xdba0('0x42')]=[{'all':!![]}];}_0x50efed=_[_0xdba0('0x3f')]({},_0x50efed,_0x1d8b88[_0xdba0('0x41')]);return db[_0xdba0('0x2d')][_0xdba0('0x48')](_0x50efed)[_0xdba0('0x27')](handleEntityNotFound(_0x170d96,null))[_0xdba0('0x27')](respondWithResult(_0x170d96,null))[_0xdba0('0x49')](handleError(_0x170d96,null));};exports['create']=function(_0x2ae6d9,_0x11443d){return db['UserProfileSection']['create'](_0x2ae6d9[_0xdba0('0x4a')],{})['then'](respondWithResult(_0x11443d,0xc9))[_0xdba0('0x49')](handleError(_0x11443d,null));};exports[_0xdba0('0x25')]=function(_0x3e4573,_0x250b25){if(_0x3e4573[_0xdba0('0x4a')]['id']){delete _0x3e4573[_0xdba0('0x4a')]['id'];}return db[_0xdba0('0x2d')][_0xdba0('0x48')]({'where':{'id':_0x3e4573[_0xdba0('0x45')]['id']}})[_0xdba0('0x27')](handleEntityNotFound(_0x250b25,null))[_0xdba0('0x27')](saveUpdates(_0x3e4573[_0xdba0('0x4a')],null))[_0xdba0('0x27')](respondWithResult(_0x250b25,null))[_0xdba0('0x49')](handleError(_0x250b25,null));};exports[_0xdba0('0x26')]=function(_0x220e28,_0x48b2b6){return db[_0xdba0('0x2d')][_0xdba0('0x48')]({'where':{'id':_0x220e28[_0xdba0('0x45')]['id']}})[_0xdba0('0x27')](handleEntityNotFound(_0x48b2b6,null))[_0xdba0('0x27')](removeEntity(_0x48b2b6,null))[_0xdba0('0x49')](handleError(_0x48b2b6,null));};exports['describe']=function(_0xcabcd4,_0x4f0589){return db['UserProfileSection'][_0xdba0('0x4b')]()[_0xdba0('0x27')](respondWithResult(_0x4f0589,null))[_0xdba0('0x49')](handleError(_0x4f0589,null));}; \ No newline at end of file +var _0xa558=['json','offset','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','create','body','params','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x64a3d4,_0x43e9f4){var _0x335e93=function(_0x19ef3d){while(--_0x19ef3d){_0x64a3d4['push'](_0x64a3d4['shift']());}};_0x335e93(++_0x43e9f4);}(_0xa558,0x1ad));var _0x8a55=function(_0x5d0b0c,_0x5dd878){_0x5d0b0c=_0x5d0b0c-0x0;var _0x265ebd=_0xa558[_0x5d0b0c];return _0x265ebd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a55('0x0'));var zipdir=require(_0x8a55('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a55('0x2'));var moment=require(_0x8a55('0x3'));var BPromise=require(_0x8a55('0x4'));var Mustache=require(_0x8a55('0x5'));var util=require('util');var path=require(_0x8a55('0x6'));var sox=require(_0x8a55('0x7'));var csv=require('to-csv');var ejs=require(_0x8a55('0x8'));var fs=require('fs');var fs_extra=require(_0x8a55('0x9'));var _=require(_0x8a55('0xa'));var squel=require(_0x8a55('0xb'));var crypto=require(_0x8a55('0xc'));var jsforce=require(_0x8a55('0xd'));var deskjs=require(_0x8a55('0xe'));var toCsv=require(_0x8a55('0xf'));var querystring=require(_0x8a55('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a55('0x11'));var qs=require(_0x8a55('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a55('0x13'));var logger=require('../../config/logger')(_0x8a55('0x14'));var utils=require('../../config/utils');var config=require(_0x8a55('0x15'));var licenseUtil=require(_0x8a55('0x16'));var db=require(_0x8a55('0x17'))['db'];function respondWithStatusCode(_0x3e4295,_0x5d468c){_0x5d468c=_0x5d468c||0xcc;return function(_0x28587c){if(_0x28587c){return _0x3e4295[_0x8a55('0x18')](_0x5d468c);}return _0x3e4295[_0x8a55('0x19')](_0x5d468c)[_0x8a55('0x1a')]();};}function respondWithResult(_0x4af493,_0x38e0d8){_0x38e0d8=_0x38e0d8||0xc8;return function(_0x432469){if(_0x432469){return _0x4af493['status'](_0x38e0d8)[_0x8a55('0x1b')](_0x432469);}};}function respondWithFilteredResult(_0x54824c,_0x135900){return function(_0x40906f){if(_0x40906f){var _0x11f4b6=typeof _0x135900[_0x8a55('0x1c')]==='undefined'&&typeof _0x135900[_0x8a55('0x1d')]==='undefined';var _0x2acdb1=_0x40906f['count'];var _0x1f1af9=_0x11f4b6?0x0:_0x135900[_0x8a55('0x1c')];var _0x3f96f9=_0x11f4b6?_0x40906f[_0x8a55('0x1e')]:_0x135900['offset']+_0x135900[_0x8a55('0x1d')];var _0x39d8a3;if(_0x3f96f9>=_0x2acdb1){_0x3f96f9=_0x2acdb1;_0x39d8a3=0xc8;}else{_0x39d8a3=0xce;}_0x54824c[_0x8a55('0x19')](_0x39d8a3);return _0x54824c[_0x8a55('0x1f')](_0x8a55('0x20'),_0x1f1af9+'-'+_0x3f96f9+'/'+_0x2acdb1)[_0x8a55('0x1b')](_0x40906f);}return null;};}function patchUpdates(_0x57ad4a){return function(_0x4c169a){try{jsonpatch[_0x8a55('0x21')](_0x4c169a,_0x57ad4a,!![]);}catch(_0x5b1cc0){return BPromise[_0x8a55('0x22')](_0x5b1cc0);}return _0x4c169a[_0x8a55('0x23')]();};}function saveUpdates(_0x4839f1,_0x4a3b04){return function(_0x3622de){if(_0x3622de){return _0x3622de['update'](_0x4839f1)['then'](function(_0x16879a){return _0x16879a;});}return null;};}function removeEntity(_0x129580,_0x5aa346){return function(_0x687afb){if(_0x687afb){return _0x687afb['destroy']()[_0x8a55('0x24')](function(){_0x129580[_0x8a55('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267e03,_0x5c8c23){return function(_0x4421a4){if(!_0x4421a4){_0x267e03[_0x8a55('0x18')](0x194);}return _0x4421a4;};}function handleError(_0x58d3ca,_0x1f78be){_0x1f78be=_0x1f78be||0x1f4;return function(_0xd3b53f){logger[_0x8a55('0x25')](_0xd3b53f['stack']);if(_0xd3b53f[_0x8a55('0x26')]){delete _0xd3b53f[_0x8a55('0x26')];}_0x58d3ca[_0x8a55('0x19')](_0x1f78be)[_0x8a55('0x27')](_0xd3b53f);};}exports[_0x8a55('0x28')]=function(_0x4f30eb,_0x5d8ff7){var _0x5086c5={},_0x3dce87={},_0x586709={'count':0x0,'rows':[]};var _0x5ee12d=_[_0x8a55('0x29')](db[_0x8a55('0x2a')][_0x8a55('0x2b')],function(_0xac41ca){return{'name':_0xac41ca[_0x8a55('0x2c')],'type':_0xac41ca[_0x8a55('0x2d')][_0x8a55('0x2e')]};});_0x3dce87[_0x8a55('0x2f')]=_[_0x8a55('0x29')](_0x5ee12d,'name');_0x3dce87[_0x8a55('0x30')]=_[_0x8a55('0x31')](_0x4f30eb[_0x8a55('0x30')]);_0x3dce87['filters']=_[_0x8a55('0x32')](_0x3dce87[_0x8a55('0x2f')],_0x3dce87['query']);_0x5086c5[_0x8a55('0x33')]=_['intersection'](_0x3dce87['model'],qs['fields'](_0x4f30eb[_0x8a55('0x30')]['fields']));_0x5086c5['attributes']=_0x5086c5[_0x8a55('0x33')][_0x8a55('0x34')]?_0x5086c5[_0x8a55('0x33')]:_0x3dce87[_0x8a55('0x2f')];if(!_0x4f30eb[_0x8a55('0x30')][_0x8a55('0x35')](_0x8a55('0x36'))){_0x5086c5[_0x8a55('0x1d')]=qs[_0x8a55('0x1d')](_0x4f30eb[_0x8a55('0x30')][_0x8a55('0x1d')]);_0x5086c5[_0x8a55('0x1c')]=qs[_0x8a55('0x1c')](_0x4f30eb[_0x8a55('0x30')][_0x8a55('0x1c')]);}_0x5086c5[_0x8a55('0x37')]=qs[_0x8a55('0x38')](_0x4f30eb[_0x8a55('0x30')][_0x8a55('0x38')]);_0x5086c5[_0x8a55('0x39')]=qs[_0x8a55('0x3a')](_[_0x8a55('0x3b')](_0x4f30eb[_0x8a55('0x30')],_0x3dce87[_0x8a55('0x3a')]),_0x5ee12d);if(_0x4f30eb['query'][_0x8a55('0x3c')]){_0x5086c5['where']=_[_0x8a55('0x3d')](_0x5086c5[_0x8a55('0x39')],{'$or':_[_0x8a55('0x29')](_0x5ee12d,function(_0x4bf0b4){if(_0x4bf0b4[_0x8a55('0x2d')]!==_0x8a55('0x3e')){var _0x2ce9a1={};_0x2ce9a1[_0x4bf0b4[_0x8a55('0x26')]]={'$like':'%'+_0x4f30eb[_0x8a55('0x30')][_0x8a55('0x3c')]+'%'};return _0x2ce9a1;}})});}_0x5086c5=_[_0x8a55('0x3d')]({},_0x5086c5,_0x4f30eb[_0x8a55('0x3f')]);var _0x77a29d={'where':_0x5086c5[_0x8a55('0x39')]};return db['UserProfileSection']['count'](_0x77a29d)['then'](function(_0x1633c8){_0x586709[_0x8a55('0x1e')]=_0x1633c8;if(_0x4f30eb[_0x8a55('0x30')][_0x8a55('0x40')]){_0x5086c5[_0x8a55('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0x8a55('0x42')](_0x5086c5);})[_0x8a55('0x24')](function(_0x35b62a){_0x586709[_0x8a55('0x43')]=_0x35b62a;return _0x586709;})['then'](respondWithFilteredResult(_0x5d8ff7,_0x5086c5))[_0x8a55('0x44')](handleError(_0x5d8ff7,null));};exports[_0x8a55('0x45')]=function(_0x12e9fa,_0x1f5d30){var _0x840d26={'raw':![],'where':{'id':_0x12e9fa['params']['id']}},_0x585eba={};_0x585eba[_0x8a55('0x2f')]=_[_0x8a55('0x31')](db[_0x8a55('0x2a')][_0x8a55('0x2b')]);_0x585eba[_0x8a55('0x30')]=_[_0x8a55('0x31')](_0x12e9fa[_0x8a55('0x30')]);_0x585eba[_0x8a55('0x3a')]=_['intersection'](_0x585eba['model'],_0x585eba[_0x8a55('0x30')]);_0x840d26['attributes']=_[_0x8a55('0x32')](_0x585eba[_0x8a55('0x2f')],qs[_0x8a55('0x46')](_0x12e9fa[_0x8a55('0x30')][_0x8a55('0x46')]));_0x840d26[_0x8a55('0x33')]=_0x840d26['attributes'][_0x8a55('0x34')]?_0x840d26[_0x8a55('0x33')]:_0x585eba['model'];if(_0x12e9fa[_0x8a55('0x30')][_0x8a55('0x40')]){_0x840d26['include']=[{'all':!![]}];}_0x840d26=_[_0x8a55('0x3d')]({},_0x840d26,_0x12e9fa[_0x8a55('0x3f')]);return db['UserProfileSection']['find'](_0x840d26)['then'](handleEntityNotFound(_0x1f5d30,null))[_0x8a55('0x24')](respondWithResult(_0x1f5d30,null))['catch'](handleError(_0x1f5d30,null));};exports[_0x8a55('0x47')]=function(_0xcfa2f8,_0x4e8638){return db['UserProfileSection'][_0x8a55('0x47')](_0xcfa2f8[_0x8a55('0x48')],{})[_0x8a55('0x24')](respondWithResult(_0x4e8638,0xc9))[_0x8a55('0x44')](handleError(_0x4e8638,null));};exports['update']=function(_0x578613,_0x49d8da){if(_0x578613[_0x8a55('0x48')]['id']){delete _0x578613[_0x8a55('0x48')]['id'];}return db[_0x8a55('0x2a')]['find']({'where':{'id':_0x578613[_0x8a55('0x49')]['id']}})[_0x8a55('0x24')](handleEntityNotFound(_0x49d8da,null))[_0x8a55('0x24')](saveUpdates(_0x578613[_0x8a55('0x48')],null))['then'](respondWithResult(_0x49d8da,null))[_0x8a55('0x44')](handleError(_0x49d8da,null));};exports['destroy']=function(_0xa36134,_0x12221b){return db[_0x8a55('0x2a')][_0x8a55('0x4a')]({'where':{'id':_0xa36134[_0x8a55('0x49')]['id']}})[_0x8a55('0x24')](handleEntityNotFound(_0x12221b,null))[_0x8a55('0x24')](removeEntity(_0x12221b,null))[_0x8a55('0x44')](handleError(_0x12221b,null));};exports[_0x8a55('0x4b')]=function(_0x9706f1,_0x273b51){return db['UserProfileSection'][_0x8a55('0x4b')]()[_0x8a55('0x24')](respondWithResult(_0x273b51,null))[_0x8a55('0x44')](handleError(_0x273b51,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index f1a0f2a..045d625 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 _0xa343=['userProfileId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId'];(function(_0x3cbe21,_0x43fada){var _0x42adcb=function(_0x4c8209){while(--_0x4c8209){_0x3cbe21['push'](_0x3cbe21['shift']());}};_0x42adcb(++_0x43fada);}(_0xa343,0x1a1));var _0x3a34=function(_0x1266f9,_0xbba76f){_0x1266f9=_0x1266f9-0x0;var _0x282acb=_0xa343[_0x1266f9];return _0x282acb;};'use strict';var _=require(_0x3a34('0x0'));var util=require(_0x3a34('0x1'));var logger=require(_0x3a34('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3a34('0x3'));var rp=require(_0x3a34('0x4'));var fs=require('fs');var path=require(_0x3a34('0x5'));var rimraf=require(_0x3a34('0x6'));var config=require(_0x3a34('0x7'));var attributes=require(_0x3a34('0x8'));module[_0x3a34('0x9')]=function(_0x2ad51b,_0xbb8daf){return _0x2ad51b[_0x3a34('0xa')](_0x3a34('0xb'),attributes,{'tableName':_0x3a34('0xc'),'paranoid':![],'indexes':[{'name':_0x3a34('0xd'),'fields':[_0x3a34('0xe'),_0x3a34('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b4c=['bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x94c877,_0xda72b3){var _0x453dd2=function(_0x37870e){while(--_0x37870e){_0x94c877['push'](_0x94c877['shift']());}};_0x453dd2(++_0xda72b3);}(_0x8b4c,0x87));var _0xc8b4=function(_0x50d3bb,_0x4c960d){_0x50d3bb=_0x50d3bb-0x0;var _0x33e454=_0x8b4c[_0x50d3bb];return _0x33e454;};'use strict';var _=require(_0xc8b4('0x0'));var util=require(_0xc8b4('0x1'));var logger=require(_0xc8b4('0x2'))(_0xc8b4('0x3'));var moment=require(_0xc8b4('0x4'));var BPromise=require(_0xc8b4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8b4('0x6'));var rimraf=require(_0xc8b4('0x7'));var config=require(_0xc8b4('0x8'));var attributes=require(_0xc8b4('0x9'));module[_0xc8b4('0xa')]=function(_0x4f3e61,_0x1e0e43){return _0x4f3e61[_0xc8b4('0xb')]('UserProfileSection',attributes,{'tableName':_0xc8b4('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xc8b4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 19bfdfb..b30670f 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 _0xf2a0=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0xf2a0,0x7d));var _0x0f2a=function(_0xcf82b2,_0x49ab9a){_0xcf82b2=_0xcf82b2-0x0;var _0x4275e9=_0xf2a0[_0xcf82b2];return _0x4275e9;};'use strict';var _=require('lodash');var util=require(_0x0f2a('0x0'));var moment=require(_0x0f2a('0x1'));var BPromise=require(_0x0f2a('0x2'));var rs=require(_0x0f2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f2a('0x4'))['db'];var utils=require(_0x0f2a('0x5'));var logger=require(_0x0f2a('0x6'))('rpc');var config=require(_0x0f2a('0x7'));var jayson=require(_0x0f2a('0x8'));var client=jayson['client'][_0x0f2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bba9e,_0x4c685e,_0xbeb280){return new BPromise(function(_0x4259f4,_0xcca97){return client['request'](_0x3bba9e,_0xbeb280)[_0x0f2a('0xa')](function(_0x45a74b){logger[_0x0f2a('0xb')](_0x0f2a('0xc'),_0x4c685e,_0x0f2a('0xd'));logger['debug'](_0x0f2a('0xe'),_0x4c685e,'request\x20sent',JSON[_0x0f2a('0xf')](_0x45a74b));if(_0x45a74b[_0x0f2a('0x10')]){if(_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x11')]===0x1f4){logger[_0x0f2a('0x10')](_0x0f2a('0xc'),_0x4c685e,_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);return _0xcca97(_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);}logger[_0x0f2a('0x10')](_0x0f2a('0xc'),_0x4c685e,_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);return _0x4259f4(_0x45a74b[_0x0f2a('0x10')][_0x0f2a('0x12')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4c685e,_0x0f2a('0xd'));_0x4259f4(_0x45a74b['result'][_0x0f2a('0x12')]);}})[_0x0f2a('0x13')](function(_0x246b43){logger[_0x0f2a('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4c685e,_0x246b43);_0xcca97(_0x246b43);});});} \ No newline at end of file +var _0xd3fd=['result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','request\x20sent'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0xd3fd,0x10a));var _0xdd3f=function(_0x50f21c,_0x32eda5){_0x50f21c=_0x50f21c-0x0;var _0x318718=_0xd3fd[_0x50f21c];return _0x318718;};'use strict';var _=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var moment=require(_0xdd3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd3f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd3f('0x4'));var logger=require('../../config/logger')(_0xdd3f('0x5'));var config=require(_0xdd3f('0x6'));var jayson=require(_0xdd3f('0x7'));var client=jayson['client'][_0xdd3f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x295731,_0x4db26f,_0x5459e2){return new BPromise(function(_0x4ef598,_0x31770b){return client[_0xdd3f('0x9')](_0x295731,_0x5459e2)[_0xdd3f('0xa')](function(_0x365fd9){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4db26f,'request\x20sent');logger[_0xdd3f('0xb')](_0xdd3f('0xc'),_0x4db26f,'request\x20sent',JSON[_0xdd3f('0xd')](_0x365fd9));if(_0x365fd9[_0xdd3f('0xe')]){if(_0x365fd9[_0xdd3f('0xe')][_0xdd3f('0xf')]===0x1f4){logger[_0xdd3f('0xe')](_0xdd3f('0x10'),_0x4db26f,_0x365fd9[_0xdd3f('0xe')]['message']);return _0x31770b(_0x365fd9[_0xdd3f('0xe')]['message']);}logger['error'](_0xdd3f('0x10'),_0x4db26f,_0x365fd9[_0xdd3f('0xe')][_0xdd3f('0x11')]);return _0x4ef598(_0x365fd9['error'][_0xdd3f('0x11')]);}else{logger[_0xdd3f('0x12')](_0xdd3f('0x10'),_0x4db26f,_0xdd3f('0x13'));_0x4ef598(_0x365fd9[_0xdd3f('0x14')][_0xdd3f('0x11')]);}})[_0xdd3f('0x15')](function(_0x4d771a){logger[_0xdd3f('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x4db26f,_0x4d771a);_0x31770b(_0x4d771a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f014d28..05bc174 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x12dfdd,_0x2fc66c){var _0x17b8c0=function(_0x2f7932){while(--_0x2f7932){_0x12dfdd['push'](_0x12dfdd['shift']());}};_0x17b8c0(++_0x2fc66c);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2dd81a,_0xe73ee7){var _0x371ada=function(_0x593e70){while(--_0x593e70){_0x2dd81a['push'](_0x2dd81a['shift']());}};_0x371ada(++_0xe73ee7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 efc4bc7..1d0d050 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 _0xd1bd=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1bd,0x8a));var _0xdd1b=function(_0x425d57,_0x4826c8){_0x425d57=_0x425d57-0x0;var _0x254d05=_0xd1bd[_0x425d57];return _0x254d05;};'use strict';var Sequelize=require(_0xdd1b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdd1b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x09c9=['INTEGER','exports'];(function(_0x2416b2,_0x134439){var _0x159c30=function(_0x2e335c){while(--_0x2e335c){_0x2416b2['push'](_0x2416b2['shift']());}};_0x159c30(++_0x134439);}(_0x09c9,0x1d7));var _0x909c=function(_0x24e0b2,_0x1f0572){_0x24e0b2=_0x24e0b2-0x0;var _0x43db17=_0x09c9[_0x24e0b2];return _0x43db17;};'use strict';var Sequelize=require('sequelize');module[_0x909c('0x0')]={'penalty':{'type':Sequelize[_0x909c('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 fc64fe0..b4ed1ac 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 _0x6050=['../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1a79e3,_0x3ba6b5){var _0x2ec90b=function(_0x591b8e){while(--_0x591b8e){_0x1a79e3['push'](_0x1a79e3['shift']());}};_0x2ec90b(++_0x3ba6b5);}(_0x6050,0x196));var _0x0605=function(_0x1ca34e,_0x3b7269){_0x1ca34e=_0x1ca34e-0x0;var _0x2bd22f=_0x6050[_0x1ca34e];return _0x2bd22f;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9a5a,0x194));var _0xa9a5=function(_0x2adcfb,_0x1395ae){_0x2adcfb=_0x2adcfb-0x0;var _0x4de5b6=_0x9a5a[_0x2adcfb];return _0x4de5b6;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'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 cfad7dd..3a6bf17 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 _0xd18a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2eefad,_0x378913){var _0x431c35=function(_0x2d504f){while(--_0x2d504f){_0x2eefad['push'](_0x2eefad['shift']());}};_0x431c35(++_0x378913);}(_0xd18a,0x161));var _0xad18=function(_0x506f57,_0x1310b7){_0x506f57=_0x506f57-0x0;var _0x359c6c=_0xd18a[_0x506f57];return _0x359c6c;};'use strict';var _=require(_0xad18('0x0'));var util=require(_0xad18('0x1'));var moment=require('moment');var BPromise=require(_0xad18('0x2'));var rs=require(_0xad18('0x3'));var fs=require('fs');var Redis=require(_0xad18('0x4'));var db=require(_0xad18('0x5'))['db'];var utils=require(_0xad18('0x6'));var logger=require(_0xad18('0x7'))(_0xad18('0x8'));var config=require(_0xad18('0x9'));var jayson=require(_0xad18('0xa'));var client=jayson['client'][_0xad18('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4586da,_0x288860,_0x2996fd){return new BPromise(function(_0x10c971,_0xb5db44){return client[_0xad18('0xc')](_0x4586da,_0x2996fd)[_0xad18('0xd')](function(_0xf70997){logger[_0xad18('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x288860,_0xad18('0xf'));logger['debug'](_0xad18('0x10'),_0x288860,_0xad18('0xf'),JSON[_0xad18('0x11')](_0xf70997));if(_0xf70997[_0xad18('0x12')]){if(_0xf70997[_0xad18('0x12')][_0xad18('0x13')]===0x1f4){logger[_0xad18('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x288860,_0xf70997[_0xad18('0x12')][_0xad18('0x14')]);return _0xb5db44(_0xf70997[_0xad18('0x12')]['message']);}logger[_0xad18('0x12')](_0xad18('0x15'),_0x288860,_0xf70997[_0xad18('0x12')][_0xad18('0x14')]);return _0x10c971(_0xf70997[_0xad18('0x12')]['message']);}else{logger[_0xad18('0xe')](_0xad18('0x15'),_0x288860,_0xad18('0xf'));_0x10c971(_0xf70997[_0xad18('0x16')][_0xad18('0x14')]);}})[_0xad18('0x17')](function(_0x251e7a){logger[_0xad18('0x12')](_0xad18('0x15'),_0x288860,_0x251e7a);_0xb5db44(_0x251e7a);});});} \ No newline at end of file +var _0xb852=['../../config/environment','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x67bf12,_0x6471c4){var _0x5d477b=function(_0x3cb6d8){while(--_0x3cb6d8){_0x67bf12['push'](_0x67bf12['shift']());}};_0x5d477b(++_0x6471c4);}(_0xb852,0x8b));var _0x2b85=function(_0x5857ff,_0x161d2f){_0x5857ff=_0x5857ff-0x0;var _0x24cfc5=_0xb852[_0x5857ff];return _0x24cfc5;};'use strict';var _=require(_0x2b85('0x0'));var util=require(_0x2b85('0x1'));var moment=require(_0x2b85('0x2'));var BPromise=require(_0x2b85('0x3'));var rs=require(_0x2b85('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b85('0x5'))['db'];var utils=require(_0x2b85('0x6'));var logger=require('../../config/logger')(_0x2b85('0x7'));var config=require(_0x2b85('0x8'));var jayson=require(_0x2b85('0x9'));var client=jayson['client'][_0x2b85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10e675,_0x361441,_0x5dc0a0){return new BPromise(function(_0x68d1f3,_0x2cfa35){return client['request'](_0x10e675,_0x5dc0a0)['then'](function(_0xb6a087){logger[_0x2b85('0xb')](_0x2b85('0xc'),_0x361441,'request\x20sent');logger['debug'](_0x2b85('0xd'),_0x361441,_0x2b85('0xe'),JSON[_0x2b85('0xf')](_0xb6a087));if(_0xb6a087['error']){if(_0xb6a087[_0x2b85('0x10')][_0x2b85('0x11')]===0x1f4){logger[_0x2b85('0x10')](_0x2b85('0xc'),_0x361441,_0xb6a087[_0x2b85('0x10')][_0x2b85('0x12')]);return _0x2cfa35(_0xb6a087['error']['message']);}logger[_0x2b85('0x10')](_0x2b85('0xc'),_0x361441,_0xb6a087[_0x2b85('0x10')]['message']);return _0x68d1f3(_0xb6a087[_0x2b85('0x10')]['message']);}else{logger[_0x2b85('0xb')](_0x2b85('0xc'),_0x361441,_0x2b85('0xe'));_0x68d1f3(_0xb6a087[_0x2b85('0x13')][_0x2b85('0x12')]);}})[_0x2b85('0x14')](function(_0x21fd49){logger['error'](_0x2b85('0xc'),_0x361441,_0x21fd49);_0x2cfa35(_0x21fd49);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0c86f52..97f17aa 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 _0xb86f=['sequelize','INTEGER'];(function(_0x22aa48,_0x4f917c){var _0x51dce0=function(_0x15847b){while(--_0x15847b){_0x22aa48['push'](_0x22aa48['shift']());}};_0x51dce0(++_0x4f917c);}(_0xb86f,0x10e));var _0xfb86=function(_0x5d5265,_0x416f73){_0x5d5265=_0x5d5265-0x0;var _0x183831=_0xb86f[_0x5d5265];return _0x183831;};'use strict';var Sequelize=require(_0xfb86('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xfb86('0x1')]}}; \ No newline at end of file +var _0xb940=['INTEGER','sequelize','exports'];(function(_0x44d0d2,_0x462c3d){var _0x1e37a6=function(_0x2b4497){while(--_0x2b4497){_0x44d0d2['push'](_0x44d0d2['shift']());}};_0x1e37a6(++_0x462c3d);}(_0xb940,0x145));var _0x0b94=function(_0x221637,_0x42a5e0){_0x221637=_0x221637-0x0;var _0x11bf9e=_0xb940[_0x221637];return _0x11bf9e;};'use strict';var Sequelize=require(_0x0b94('0x0'));module[_0x0b94('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x0b94('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 0f340fa..3960e37 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(_0x2282ac,_0x3e51b5){var _0x37322b=function(_0x181079){while(--_0x181079){_0x2282ac['push'](_0x2282ac['shift']());}};_0x37322b(++_0x3e51b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x175296,_0x5e7916){var _0x1abca8=function(_0x153290){while(--_0x153290){_0x175296['push'](_0x175296['shift']());}};_0x1abca8(++_0x5e7916);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 f9c7bcc..cb9dd1e 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x11dbbe,_0x7b04d3){var _0x475061=function(_0x3677d3){while(--_0x3677d3){_0x11dbbe['push'](_0x11dbbe['shift']());}};_0x475061(++_0x7b04d3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6d175c7..74a4651 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 _0x3d94=['INTEGER','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3d94,0xd7));var _0x43d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d94[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x43d9('0x0')]={'penalty':{'type':Sequelize[_0x43d9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf1c7=['INTEGER','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf1c7,0x193));var _0x7f1c=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0xf1c7[_0x3bab09];return _0x164376;};'use strict';var Sequelize=require(_0x7f1c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7f1c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index c276f9b..e93c636 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 _0x8347=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x2b3023,_0x194fe6){var _0x24a20e=function(_0x3bc312){while(--_0x3bc312){_0x2b3023['push'](_0x2b3023['shift']());}};_0x24a20e(++_0x194fe6);}(_0x8347,0x1ad));var _0x7834=function(_0x3d11bd,_0x3534e7){_0x3d11bd=_0x3d11bd-0x0;var _0x1c1e0e=_0x8347[_0x3d11bd];return _0x1c1e0e;};'use strict';var _=require(_0x7834('0x0'));var util=require(_0x7834('0x1'));var logger=require(_0x7834('0x2'))(_0x7834('0x3'));var moment=require(_0x7834('0x4'));var BPromise=require(_0x7834('0x5'));var rp=require(_0x7834('0x6'));var fs=require('fs');var path=require(_0x7834('0x7'));var rimraf=require(_0x7834('0x8'));var config=require(_0x7834('0x9'));var attributes=require('./userVoiceQueue.attributes');module[_0x7834('0xa')]=function(_0x2360bf,_0xbfb40f){return _0x2360bf[_0x7834('0xb')](_0x7834('0xc'),attributes,{'tableName':_0x7834('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87c1=['UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x87c1,0xe2));var _0x187c=function(_0x5ead09,_0x29640f){_0x5ead09=_0x5ead09-0x0;var _0x5b8473=_0x87c1[_0x5ead09];return _0x5b8473;};'use strict';var _=require(_0x187c('0x0'));var util=require(_0x187c('0x1'));var logger=require(_0x187c('0x2'))(_0x187c('0x3'));var moment=require(_0x187c('0x4'));var BPromise=require(_0x187c('0x5'));var rp=require(_0x187c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x187c('0x7'));var config=require(_0x187c('0x8'));var attributes=require(_0x187c('0x9'));module[_0x187c('0xa')]=function(_0x15f900,_0x8568a5){return _0x15f900[_0x187c('0xb')](_0x187c('0xc'),attributes,{'tableName':_0x187c('0xd'),'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 44af248..516e2f0 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 _0xf24b=['UserVoiceQueue,\x20%s,\x20%s','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0xf24b,0xad));var _0xbf24=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xf24b[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf24('0x4'))['db'];var utils=require(_0xbf24('0x5'));var logger=require('../../config/logger')(_0xbf24('0x6'));var config=require(_0xbf24('0x7'));var jayson=require(_0xbf24('0x8'));var client=jayson[_0xbf24('0x9')][_0xbf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd757,_0x10ae5f,_0x3e983e){return new BPromise(function(_0x455e1e,_0x519ad7){return client['request'](_0x4dd757,_0x3e983e)[_0xbf24('0xb')](function(_0x3a94e7){logger[_0xbf24('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x10ae5f,_0xbf24('0xd'));logger['debug'](_0xbf24('0xe'),_0x10ae5f,'request\x20sent',JSON['stringify'](_0x3a94e7));if(_0x3a94e7[_0xbf24('0xf')]){if(_0x3a94e7[_0xbf24('0xf')]['code']===0x1f4){logger[_0xbf24('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x10ae5f,_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);return _0x519ad7(_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);}logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x3a94e7[_0xbf24('0xf')]['message']);return _0x455e1e(_0x3a94e7['error'][_0xbf24('0x10')]);}else{logger[_0xbf24('0xc')](_0xbf24('0x11'),_0x10ae5f,_0xbf24('0xd'));_0x455e1e(_0x3a94e7[_0xbf24('0x12')][_0xbf24('0x10')]);}})['catch'](function(_0x188217){logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x188217);_0x519ad7(_0x188217);});});} \ No newline at end of file +var _0xf6b6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf6b6,0x151));var _0x6f6b=function(_0x34947a,_0x4153cd){_0x34947a=_0x34947a-0x0;var _0x58a304=_0xf6b6[_0x34947a];return _0x58a304;};'use strict';var _=require(_0x6f6b('0x0'));var util=require(_0x6f6b('0x1'));var moment=require(_0x6f6b('0x2'));var BPromise=require(_0x6f6b('0x3'));var rs=require(_0x6f6b('0x4'));var fs=require('fs');var Redis=require(_0x6f6b('0x5'));var db=require(_0x6f6b('0x6'))['db'];var utils=require(_0x6f6b('0x7'));var logger=require('../../config/logger')(_0x6f6b('0x8'));var config=require(_0x6f6b('0x9'));var jayson=require(_0x6f6b('0xa'));var client=jayson[_0x6f6b('0xb')][_0x6f6b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x331276,_0x43cdbb,_0x3cb609){return new BPromise(function(_0x1234ef,_0x3887a){return client['request'](_0x331276,_0x3cb609)[_0x6f6b('0xd')](function(_0x3fa16c){logger[_0x6f6b('0xe')](_0x6f6b('0xf'),_0x43cdbb,_0x6f6b('0x10'));logger['debug'](_0x6f6b('0x11'),_0x43cdbb,_0x6f6b('0x10'),JSON['stringify'](_0x3fa16c));if(_0x3fa16c[_0x6f6b('0x12')]){if(_0x3fa16c['error']['code']===0x1f4){logger[_0x6f6b('0x12')](_0x6f6b('0xf'),_0x43cdbb,_0x3fa16c[_0x6f6b('0x12')][_0x6f6b('0x13')]);return _0x3887a(_0x3fa16c['error']['message']);}logger[_0x6f6b('0x12')](_0x6f6b('0xf'),_0x43cdbb,_0x3fa16c[_0x6f6b('0x12')][_0x6f6b('0x13')]);return _0x1234ef(_0x3fa16c[_0x6f6b('0x12')][_0x6f6b('0x13')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x43cdbb,_0x6f6b('0x10'));_0x1234ef(_0x3fa16c['result'][_0x6f6b('0x13')]);}})[_0x6f6b('0x14')](function(_0x48245d){logger[_0x6f6b('0x12')](_0x6f6b('0xf'),_0x43cdbb,_0x48245d);_0x3887a(_0x48245d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7199a43..6ada658 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(_0x411c2e,_0x4ece66){var _0x5ed361=function(_0x193b6c){while(--_0x193b6c){_0x411c2e['push'](_0x411c2e['shift']());}};_0x5ed361(++_0x4ece66);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x571e24,_0xaf86c2){var _0x46ef62=function(_0x163209){while(--_0x163209){_0x571e24['push'](_0x571e24['shift']());}};_0x46ef62(++_0xaf86c2);}(_0xe706,0xa3));var _0x6e70=function(_0x25f983,_0x352b9d){_0x25f983=_0x25f983-0x0;var _0x50a304=_0xe706[_0x25f983];return _0x50a304;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0eb03b9..3e74ba9 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 _0x15cd=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15cd,0xfd));var _0xd15c=function(_0x5bb488,_0x405570){_0x5bb488=_0x5bb488-0x0;var _0x3a541a=_0x15cd[_0x5bb488];return _0x3a541a;};'use strict';var Sequelize=require(_0xd15c('0x0'));module[_0xd15c('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd15c('0x2')},'membername':{'type':Sequelize[_0xd15c('0x3')],'allowNull':![],'comment':_0xd15c('0x2')},'UserId':{'type':Sequelize[_0xd15c('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xd15c('0x3')],'allowNull':![],'unique':_0xd15c('0x5'),'comment':_0xd15c('0x2')},'VoiceQueueId':{'type':Sequelize[_0xd15c('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xd15c('0x3')],'allowNull':![],'unique':_0xd15c('0x5'),'comment':_0xd15c('0x2')},'penalty':{'type':Sequelize[_0xd15c('0x4')](0xb),'defaultValue':0x0,'comment':_0xd15c('0x2')},'paused':{'type':Sequelize[_0xd15c('0x4')](0xb),'defaultValue':0x0,'comment':_0xd15c('0x2')}}; \ No newline at end of file +var _0xc87a=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc87a,0xfb));var _0xac87=function(_0x54ec0c,_0x10ba8d){_0x54ec0c=_0x54ec0c-0x0;var _0x2f24e1=_0xc87a[_0x54ec0c];return _0x2f24e1;};'use strict';var Sequelize=require(_0xac87('0x0'));module[_0xac87('0x1')]={'uniqueid':{'type':Sequelize[_0xac87('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xac87('0x3')},'membername':{'type':Sequelize[_0xac87('0x4')],'allowNull':![],'comment':_0xac87('0x3')},'UserId':{'type':Sequelize[_0xac87('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xac87('0x4')],'allowNull':![],'unique':_0xac87('0x5'),'comment':_0xac87('0x3')},'VoiceQueueId':{'type':Sequelize[_0xac87('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xac87('0x4')],'allowNull':![],'unique':_0xac87('0x5'),'comment':_0xac87('0x3')},'penalty':{'type':Sequelize[_0xac87('0x2')](0xb),'defaultValue':0x0,'comment':_0xac87('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xac87('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c6229a2..b146db4 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 _0x01c3=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x01c3,0xc5));var _0x301c=function(_0x3b836e,_0x1071de){_0x3b836e=_0x3b836e-0x0;var _0x171999=_0x01c3[_0x3b836e];return _0x171999;};'use strict';var EventEmitter=require(_0x301c('0x0'));var UserVoiceQueueRt=require(_0x301c('0x1'))['db'][_0x301c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x301c('0x3')](0x0);var events={'afterCreate':_0x301c('0x4'),'afterUpdate':_0x301c('0x5'),'afterDestroy':_0x301c('0x6')};function emitEvent(_0x18d229){return function(_0x20c02e,_0x1d2331,_0xc5f68f){UserVoiceQueueRtEvents[_0x301c('0x7')](_0x18d229+':'+_0x20c02e['id'],_0x20c02e);UserVoiceQueueRtEvents[_0x301c('0x7')](_0x18d229,_0x20c02e);_0xc5f68f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x301c('0x8')](e,emitEvent(event));}}module[_0x301c('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x81e9=['emit','hook','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x383766,_0x341506){var _0x1e16f5=function(_0x1a3627){while(--_0x1a3627){_0x383766['push'](_0x383766['shift']());}};_0x1e16f5(++_0x341506);}(_0x81e9,0x1d8));var _0x981e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x81e9[_0x29b609];return _0x54c952;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x981e('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x981e('0x1')](0x0);var events={'afterCreate':_0x981e('0x2'),'afterUpdate':'update','afterDestroy':_0x981e('0x3')};function emitEvent(_0x4717b2){return function(_0x530535,_0x36badb,_0x18751d){UserVoiceQueueRtEvents[_0x981e('0x4')](_0x4717b2+':'+_0x530535['id'],_0x530535);UserVoiceQueueRtEvents[_0x981e('0x4')](_0x4717b2,_0x530535);_0x18751d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x981e('0x5')](e,emitEvent(event));}}module[_0x981e('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3fba496..cd5c4c7 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 _0x3397=['path','rimraf','../../config/environment','define','UserVoiceQueueRt','lodash','moment','bluebird'];(function(_0x5271af,_0x1bdaf9){var _0xa07929=function(_0x46ba1a){while(--_0x46ba1a){_0x5271af['push'](_0x5271af['shift']());}};_0xa07929(++_0x1bdaf9);}(_0x3397,0x1c5));var _0x7339=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x3397[_0x5550b3];return _0x4b8fc4;};'use strict';var _=require(_0x7339('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7339('0x1'));var BPromise=require(_0x7339('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7339('0x3'));var rimraf=require(_0x7339('0x4'));var config=require(_0x7339('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x395b36,_0x1ab592){return _0x395b36[_0x7339('0x6')](_0x7339('0x7'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ae=['api','moment','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xd4ae,0x82));var _0xed4a=function(_0x1cd585,_0x54276b){_0x1cd585=_0x1cd585-0x0;var _0x3ca87f=_0xd4ae[_0x1cd585];return _0x3ca87f;};'use strict';var _=require(_0xed4a('0x0'));var util=require(_0xed4a('0x1'));var logger=require('../../config/logger')(_0xed4a('0x2'));var moment=require(_0xed4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xed4a('0x4'));var fs=require('fs');var path=require(_0xed4a('0x5'));var rimraf=require('rimraf');var config=require(_0xed4a('0x6'));var attributes=require(_0xed4a('0x7'));module[_0xed4a('0x8')]=function(_0x125a1c,_0x4979fb){return _0x125a1c[_0xed4a('0x9')](_0xed4a('0xa'),attributes,{'tableName':_0xed4a('0xb'),'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 c32a1d5..c439e00 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 _0x1972=['client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23516c,_0x16ea34){var _0x591310=function(_0x428292){while(--_0x428292){_0x23516c['push'](_0x23516c['shift']());}};_0x591310(++_0x16ea34);}(_0x1972,0x1c0));var _0x2197=function(_0x30fb43,_0x5b4cfb){_0x30fb43=_0x30fb43-0x0;var _0x56f3b5=_0x1972[_0x30fb43];return _0x56f3b5;};'use strict';var _=require('lodash');var util=require(_0x2197('0x0'));var moment=require(_0x2197('0x1'));var BPromise=require(_0x2197('0x2'));var rs=require(_0x2197('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2197('0x4'))['db'];var utils=require(_0x2197('0x5'));var logger=require(_0x2197('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2197('0x7')][_0x2197('0x8')]({'port':0x232a});config[_0x2197('0x9')]=_[_0x2197('0xa')](config[_0x2197('0x9')],{'host':_0x2197('0xb'),'port':0x18eb});var socket=require(_0x2197('0xc'))(new Redis(config['redis']));require(_0x2197('0xd'))[_0x2197('0xe')](socket);function respondWithRpcPromise(_0x3811ff,_0x11f49b,_0x37da4e){return new BPromise(function(_0x7ac217,_0x321ae2){return client[_0x2197('0xf')](_0x3811ff,_0x37da4e)[_0x2197('0x10')](function(_0x596b2c){logger[_0x2197('0x11')](_0x2197('0x12'),_0x11f49b,'request\x20sent');logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x11f49b,_0x2197('0x13'),JSON[_0x2197('0x14')](_0x596b2c));if(_0x596b2c[_0x2197('0x15')]){if(_0x596b2c[_0x2197('0x15')][_0x2197('0x16')]===0x1f4){logger['error'](_0x2197('0x12'),_0x11f49b,_0x596b2c[_0x2197('0x15')]['message']);return _0x321ae2(_0x596b2c[_0x2197('0x15')][_0x2197('0x17')]);}logger[_0x2197('0x15')](_0x2197('0x12'),_0x11f49b,_0x596b2c[_0x2197('0x15')][_0x2197('0x17')]);return _0x7ac217(_0x596b2c['error'][_0x2197('0x17')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x11f49b,'request\x20sent');_0x7ac217(_0x596b2c[_0x2197('0x18')][_0x2197('0x17')]);}})[_0x2197('0x19')](function(_0x131c49){logger[_0x2197('0x15')](_0x2197('0x12'),_0x11f49b,_0x131c49);_0x321ae2(_0x131c49);});});}exports[_0x2197('0x1a')]=function(_0x41c28b){var _0xa0f38=this;return new Promise(function(_0x4dc295,_0x3d8a26){return db[_0x2197('0x1b')]['findAll']({'raw':_0x41c28b[_0x2197('0x1c')]?_0x41c28b[_0x2197('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x41c28b[_0x2197('0x1c')]?_0x41c28b['options'][_0x2197('0x1d')]||null:null,'attributes':[[db[_0x2197('0x1e')]['fn'](_0x2197('0x1f'),db['sequelize']['fn']('IF',db[_0x2197('0x1e')]['literal'](_0x2197('0x20')))),_0x2197('0x21')]]})[_0x2197('0x10')](function(_0x1fcd31){logger['info']('GetVoiceQueueRtPauses',_0x41c28b);logger[_0x2197('0x22')]('GetVoiceQueueRtPauses',_0x41c28b,JSON[_0x2197('0x14')](_0x1fcd31));_0x4dc295(_0x1fcd31);})[_0x2197('0x19')](function(_0x93804e){logger['error'](_0x2197('0x1a'),_0x93804e['message'],_0x41c28b);_0x3d8a26(_0xa0f38['error'](0x1f4,_0x93804e[_0x2197('0x17')]));});});}; \ No newline at end of file +var _0xaab2=['info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueueRtPauses','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0xaab2,0x10f));var _0x2aab=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xaab2[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x2aab('0x0'));var util=require(_0x2aab('0x1'));var moment=require(_0x2aab('0x2'));var BPromise=require(_0x2aab('0x3'));var rs=require(_0x2aab('0x4'));var fs=require('fs');var Redis=require(_0x2aab('0x5'));var db=require(_0x2aab('0x6'))['db'];var utils=require(_0x2aab('0x7'));var logger=require('../../config/logger')(_0x2aab('0x8'));var config=require(_0x2aab('0x9'));var jayson=require(_0x2aab('0xa'));var client=jayson[_0x2aab('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2aab('0xc')],{'host':_0x2aab('0xd'),'port':0x18eb});var socket=require(_0x2aab('0xe'))(new Redis(config[_0x2aab('0xc')]));require('./userVoiceQueueRt.socket')[_0x2aab('0xf')](socket);function respondWithRpcPromise(_0x5a10d2,_0x12014b,_0x38f18b){return new BPromise(function(_0x1d0348,_0x312835){return client[_0x2aab('0x10')](_0x5a10d2,_0x38f18b)['then'](function(_0x312e57){logger[_0x2aab('0x11')](_0x2aab('0x12'),_0x12014b,_0x2aab('0x13'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x12014b,'request\x20sent',JSON['stringify'](_0x312e57));if(_0x312e57[_0x2aab('0x14')]){if(_0x312e57[_0x2aab('0x14')]['code']===0x1f4){logger[_0x2aab('0x14')](_0x2aab('0x12'),_0x12014b,_0x312e57[_0x2aab('0x14')][_0x2aab('0x15')]);return _0x312835(_0x312e57['error'][_0x2aab('0x15')]);}logger[_0x2aab('0x14')](_0x2aab('0x12'),_0x12014b,_0x312e57[_0x2aab('0x14')][_0x2aab('0x15')]);return _0x1d0348(_0x312e57[_0x2aab('0x14')][_0x2aab('0x15')]);}else{logger['info'](_0x2aab('0x12'),_0x12014b,_0x2aab('0x13'));_0x1d0348(_0x312e57[_0x2aab('0x16')]['message']);}})[_0x2aab('0x17')](function(_0x2f43a5){logger[_0x2aab('0x14')](_0x2aab('0x12'),_0x12014b,_0x2f43a5);_0x312835(_0x2f43a5);});});}exports[_0x2aab('0x18')]=function(_0x134ada){var _0x1c2800=this;return new Promise(function(_0x35054c,_0xa933f2){return db['UserVoiceQueueRt']['findAll']({'raw':_0x134ada['options']?_0x134ada[_0x2aab('0x19')][_0x2aab('0x1a')]===undefined?!![]:![]:!![],'where':_0x134ada[_0x2aab('0x19')]?_0x134ada['options'][_0x2aab('0x1b')]||null:null,'attributes':[[db[_0x2aab('0x1c')]['fn'](_0x2aab('0x1d'),db[_0x2aab('0x1c')]['fn']('IF',db[_0x2aab('0x1c')][_0x2aab('0x1e')](_0x2aab('0x1f')))),_0x2aab('0x20')]]})[_0x2aab('0x21')](function(_0x24f5b7){logger[_0x2aab('0x11')]('GetVoiceQueueRtPauses',_0x134ada);logger[_0x2aab('0x22')]('GetVoiceQueueRtPauses',_0x134ada,JSON[_0x2aab('0x23')](_0x24f5b7));_0x35054c(_0x24f5b7);})[_0x2aab('0x17')](function(_0x5af6cd){logger[_0x2aab('0x14')](_0x2aab('0x18'),_0x5af6cd['message'],_0x134ada);_0xa933f2(_0x1c2800[_0x2aab('0x14')](0x1f4,_0x5af6cd[_0x2aab('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6f95283..2026582 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 _0x2d95=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2d95,0xca));var _0x52d9=function(_0x368d4c,_0x168710){_0x368d4c=_0x368d4c-0x0;var _0x16bca8=_0x2d95[_0x368d4c];return _0x16bca8;};'use strict';var UserVoiceQueueRtEvents=require(_0x52d9('0x0'));var events=['save',_0x52d9('0x1'),'update'];function createListener(_0x2d961b,_0x14ee56){return function(_0x4206cb){_0x14ee56['emit'](_0x2d961b,_0x4206cb);};}function removeListener(_0x323dcd,_0x7aff8f){return function(){UserVoiceQueueRtEvents[_0x52d9('0x2')](_0x323dcd,_0x7aff8f);};}exports[_0x52d9('0x3')]=function(_0x16eb99){for(var _0x2735cc=0x0,_0x3b3202=events[_0x52d9('0x4')];_0x2735cc<_0x3b3202;_0x2735cc++){var _0x27d7cd=events[_0x2735cc];var _0x45cf52=createListener(_0x52d9('0x5')+_0x27d7cd,_0x16eb99);UserVoiceQueueRtEvents['on'](_0x27d7cd,_0x45cf52);}}; \ No newline at end of file +var _0xa7be=['update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x4d0cdb,_0xdf8c5f){var _0x4a5e4a=function(_0x5d2c83){while(--_0x5d2c83){_0x4d0cdb['push'](_0x4d0cdb['shift']());}};_0x4a5e4a(++_0xdf8c5f);}(_0xa7be,0xfd));var _0xea7b=function(_0x17c408,_0x17e4a4){_0x17c408=_0x17c408-0x0;var _0x13387a=_0xa7be[_0x17c408];return _0x13387a;};'use strict';var UserVoiceQueueRtEvents=require(_0xea7b('0x0'));var events=[_0xea7b('0x1'),_0xea7b('0x2'),_0xea7b('0x3')];function createListener(_0x200bf3,_0x56bfb4){return function(_0x49ed41){_0x56bfb4[_0xea7b('0x4')](_0x200bf3,_0x49ed41);};}function removeListener(_0x98ad19,_0x3a1456){return function(){UserVoiceQueueRtEvents['removeListener'](_0x98ad19,_0x3a1456);};}exports[_0xea7b('0x5')]=function(_0x1bf6cb){for(var _0x3078c9=0x0,_0x211831=events[_0xea7b('0x6')];_0x3078c9<_0x211831;_0x3078c9++){var _0x3601b3=events[_0x3078c9];var _0x1c789e=createListener(_0xea7b('0x7')+_0x3601b3,_0x1bf6cb);UserVoiceQueueRtEvents['on'](_0x3601b3,_0x1c789e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4911072..e7f0dbb 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x49c7dc,_0xd081b6){var _0xba7793=function(_0x462fb2){while(--_0x462fb2){_0x49c7dc['push'](_0x49c7dc['shift']());}};_0xba7793(++_0xd081b6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x28cdcf,_0xdc3a60){var _0x4490d7=function(_0x4fff15){while(--_0x4fff15){_0x28cdcf['push'](_0x28cdcf['shift']());}};_0x4490d7(++_0xdc3a60);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 7f22b78..8614ff6 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 _0x5aaa=['exports'];(function(_0x91644a,_0x49d2c2){var _0x852339=function(_0x38d717){while(--_0x38d717){_0x91644a['push'](_0x91644a['shift']());}};_0x852339(++_0x49d2c2);}(_0x5aaa,0x119));var _0xa5aa=function(_0x3eb8ed,_0x544fbd){_0x3eb8ed=_0x3eb8ed-0x0;var _0x589ad4=_0x5aaa[_0x3eb8ed];return _0x589ad4;};'use strict';var Sequelize=require('sequelize');module[_0xa5aa('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4e3d=['exports','sequelize'];(function(_0x4be613,_0x315df1){var _0x3d901e=function(_0x4ab839){while(--_0x4ab839){_0x4be613['push'](_0x4be613['shift']());}};_0x3d901e(++_0x315df1);}(_0x4e3d,0x12b));var _0xd4e3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4e3d[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xd4e3('0x0'));module[_0xd4e3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9d8bf9c..1ed3086 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 _0x2096=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x2096,0x8c));var _0x6209=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x2096[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x6209('0x0'));var logger=require(_0x6209('0x1'))(_0x6209('0x2'));var moment=require(_0x6209('0x3'));var BPromise=require(_0x6209('0x4'));var rp=require(_0x6209('0x5'));var fs=require('fs');var path=require(_0x6209('0x6'));var rimraf=require(_0x6209('0x7'));var config=require('../../config/environment');var attributes=require(_0x6209('0x8'));module[_0x6209('0x9')]=function(_0x1d1dca,_0x24989e){return _0x1d1dca['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa476=['UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','bluebird','path','rimraf','./userWhatsappQueue.attributes','exports','define'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa476,0x91));var _0x6a47=function(_0x21e5b6,_0x2bc8c0){_0x21e5b6=_0x21e5b6-0x0;var _0x63edbe=_0xa476[_0x21e5b6];return _0x63edbe;};'use strict';var _=require('lodash');var util=require(_0x6a47('0x0'));var logger=require('../../config/logger')(_0x6a47('0x1'));var moment=require(_0x6a47('0x2'));var BPromise=require(_0x6a47('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a47('0x4'));var rimraf=require(_0x6a47('0x5'));var config=require('../../config/environment');var attributes=require(_0x6a47('0x6'));module[_0x6a47('0x7')]=function(_0x2526df,_0x4bdc25){return _0x2526df[_0x6a47('0x8')](_0x6a47('0x9'),attributes,{'tableName':_0x6a47('0xa'),'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 862581d..74b6851 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 _0x47f9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x1ca634,_0x5e6c10){var _0x10dc1e=function(_0x5acf48){while(--_0x5acf48){_0x1ca634['push'](_0x1ca634['shift']());}};_0x10dc1e(++_0x5e6c10);}(_0x47f9,0x85));var _0x947f=function(_0x486df7,_0x5f803a){_0x486df7=_0x486df7-0x0;var _0x3c0d43=_0x47f9[_0x486df7];return _0x3c0d43;};'use strict';var _=require(_0x947f('0x0'));var util=require(_0x947f('0x1'));var moment=require(_0x947f('0x2'));var BPromise=require(_0x947f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x947f('0x4'));var db=require(_0x947f('0x5'))['db'];var utils=require(_0x947f('0x6'));var logger=require(_0x947f('0x7'))(_0x947f('0x8'));var config=require(_0x947f('0x9'));var jayson=require(_0x947f('0xa'));var client=jayson[_0x947f('0xb')][_0x947f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d0dd0,_0x30af14,_0x1e47c6){return new BPromise(function(_0x677360,_0xe93d0c){return client['request'](_0x3d0dd0,_0x1e47c6)[_0x947f('0xd')](function(_0x27a71d){logger[_0x947f('0xe')](_0x947f('0xf'),_0x30af14,_0x947f('0x10'));logger[_0x947f('0x11')](_0x947f('0x12'),_0x30af14,_0x947f('0x10'),JSON['stringify'](_0x27a71d));if(_0x27a71d[_0x947f('0x13')]){if(_0x27a71d[_0x947f('0x13')][_0x947f('0x14')]===0x1f4){logger[_0x947f('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x30af14,_0x27a71d[_0x947f('0x13')][_0x947f('0x15')]);return _0xe93d0c(_0x27a71d[_0x947f('0x13')][_0x947f('0x15')]);}logger[_0x947f('0x13')](_0x947f('0xf'),_0x30af14,_0x27a71d[_0x947f('0x13')][_0x947f('0x15')]);return _0x677360(_0x27a71d['error'][_0x947f('0x15')]);}else{logger[_0x947f('0xe')](_0x947f('0xf'),_0x30af14,'request\x20sent');_0x677360(_0x27a71d['result'][_0x947f('0x15')]);}})[_0x947f('0x16')](function(_0x1101eb){logger['error'](_0x947f('0xf'),_0x30af14,_0x1101eb);_0xe93d0c(_0x1101eb);});});} \ No newline at end of file +var _0x7139=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x585716,_0x2c9d83){var _0x4e8e2f=function(_0x213d60){while(--_0x213d60){_0x585716['push'](_0x585716['shift']());}};_0x4e8e2f(++_0x2c9d83);}(_0x7139,0x17f));var _0x9713=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7139[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9713('0x0'));var util=require(_0x9713('0x1'));var moment=require('moment');var BPromise=require(_0x9713('0x2'));var rs=require(_0x9713('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9713('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9713('0x5'))(_0x9713('0x6'));var config=require(_0x9713('0x7'));var jayson=require(_0x9713('0x8'));var client=jayson[_0x9713('0x9')][_0x9713('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8caab7,_0x2a4d0c,_0x3652c9){return new BPromise(function(_0x1504d9,_0x2d0ade){return client['request'](_0x8caab7,_0x3652c9)[_0x9713('0xb')](function(_0x44a98a){logger[_0x9713('0xc')](_0x9713('0xd'),_0x2a4d0c,_0x9713('0xe'));logger[_0x9713('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2a4d0c,_0x9713('0xe'),JSON[_0x9713('0x10')](_0x44a98a));if(_0x44a98a[_0x9713('0x11')]){if(_0x44a98a[_0x9713('0x11')][_0x9713('0x12')]===0x1f4){logger[_0x9713('0x11')](_0x9713('0xd'),_0x2a4d0c,_0x44a98a[_0x9713('0x11')]['message']);return _0x2d0ade(_0x44a98a['error'][_0x9713('0x13')]);}logger[_0x9713('0x11')](_0x9713('0xd'),_0x2a4d0c,_0x44a98a[_0x9713('0x11')][_0x9713('0x13')]);return _0x1504d9(_0x44a98a[_0x9713('0x11')]['message']);}else{logger[_0x9713('0xc')](_0x9713('0xd'),_0x2a4d0c,'request\x20sent');_0x1504d9(_0x44a98a[_0x9713('0x14')][_0x9713('0x13')]);}})[_0x9713('0x15')](function(_0x3d76a3){logger[_0x9713('0x11')](_0x9713('0xd'),_0x2a4d0c,_0x3d76a3);_0x2d0ade(_0x3d76a3);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 74611c4..f4c6bbb 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 _0xd4d1=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','post','create'];(function(_0xa049b2,_0x176ae0){var _0x10c432=function(_0x4174fc){while(--_0x4174fc){_0xa049b2['push'](_0xa049b2['shift']());}};_0x10c432(++_0x176ae0);}(_0xd4d1,0x123));var _0x1d4d=function(_0x196553,_0x125e14){_0x196553=_0x196553-0x0;var _0x347c85=_0xd4d1[_0x196553];return _0x347c85;};'use strict';var multer=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var path=require(_0x1d4d('0x2'));var timeout=require(_0x1d4d('0x3'));var express=require(_0x1d4d('0x4'));var router=express['Router']();var fs_extra=require(_0x1d4d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d4d('0x6'));var config=require('../../config/environment');var controller=require(_0x1d4d('0x7'));router['get']('/',auth[_0x1d4d('0x8')](),controller[_0x1d4d('0x9')]);router[_0x1d4d('0xa')]('/:id',auth[_0x1d4d('0x8')](),controller['show']);router[_0x1d4d('0xb')]('/',auth['isAuthenticated'](),controller[_0x1d4d('0xc')]);router[_0x1d4d('0xd')](_0x1d4d('0xe'),auth['isAuthenticated'](),controller[_0x1d4d('0xf')]);router[_0x1d4d('0x10')](_0x1d4d('0xe'),auth['isAuthenticated'](),controller[_0x1d4d('0x11')]);module[_0x1d4d('0x12')]=router; \ No newline at end of file +var _0x6fb8=['post','create','update','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6fb8,0x104));var _0x86fb=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0x6fb8[_0x4706a6];return _0x1bb705;};'use strict';var multer=require(_0x86fb('0x0'));var util=require('util');var path=require(_0x86fb('0x1'));var timeout=require(_0x86fb('0x2'));var express=require('express');var router=express[_0x86fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var controller=require(_0x86fb('0x6'));router[_0x86fb('0x7')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0x9')]);router[_0x86fb('0x7')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0xb')]);router[_0x86fb('0xc')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0xd')]);router['put'](_0x86fb('0xa'),auth['isAuthenticated'](),controller[_0x86fb('0xe')]);router[_0x86fb('0xf')](_0x86fb('0xa'),auth['isAuthenticated'](),controller[_0x86fb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8c2e939..12005ce 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 _0xe476=['STRING'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xe476,0x95));var _0x6e47=function(_0x9c84a2,_0x5bfa5b){_0x9c84a2=_0x9c84a2-0x0;var _0x5580db=_0xe476[_0x9c84a2];return _0x5580db;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6e47('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6e47('0x0')]}}; \ No newline at end of file +var _0xbe7c=['sequelize','exports','STRING','name'];(function(_0x150fc8,_0x14f156){var _0x4dbe12=function(_0xc7414e){while(--_0xc7414e){_0x150fc8['push'](_0x150fc8['shift']());}};_0x4dbe12(++_0x14f156);}(_0xbe7c,0x108));var _0xcbe7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbe7c[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xcbe7('0x0'));module[_0xcbe7('0x1')]={'name':{'type':Sequelize[_0xcbe7('0x2')],'unique':_0xcbe7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcbe7('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c093846..ebd8cf5 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 _0xcdd1=['then','destroy','Variables','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','options','Variable','includeAll','include','findAll','rows','catch','show','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','update'];(function(_0x192cd8,_0x39edf4){var _0x5be47b=function(_0x5ba4f2){while(--_0x5ba4f2){_0x192cd8['push'](_0x192cd8['shift']());}};_0x5be47b(++_0x39edf4);}(_0xcdd1,0x87));var _0x1cdd=function(_0x22cb10,_0x20db4f){_0x22cb10=_0x22cb10-0x0;var _0x38a6f8=_0xcdd1[_0x22cb10];return _0x38a6f8;};'use strict';var emlformat=require(_0x1cdd('0x0'));var rimraf=require(_0x1cdd('0x1'));var zipdir=require(_0x1cdd('0x2'));var jsonpatch=require(_0x1cdd('0x3'));var rp=require('request-promise');var moment=require(_0x1cdd('0x4'));var BPromise=require(_0x1cdd('0x5'));var Mustache=require(_0x1cdd('0x6'));var util=require(_0x1cdd('0x7'));var path=require(_0x1cdd('0x8'));var sox=require(_0x1cdd('0x9'));var csv=require(_0x1cdd('0xa'));var ejs=require(_0x1cdd('0xb'));var fs=require('fs');var fs_extra=require(_0x1cdd('0xc'));var _=require('lodash');var squel=require(_0x1cdd('0xd'));var crypto=require(_0x1cdd('0xe'));var jsforce=require(_0x1cdd('0xf'));var deskjs=require(_0x1cdd('0x10'));var toCsv=require(_0x1cdd('0xa'));var querystring=require(_0x1cdd('0x11'));var Papa=require(_0x1cdd('0x12'));var Redis=require(_0x1cdd('0x13'));var authService=require(_0x1cdd('0x14'));var qs=require(_0x1cdd('0x15'));var as=require(_0x1cdd('0x16'));var hardwareService=require(_0x1cdd('0x17'));var logger=require(_0x1cdd('0x18'))(_0x1cdd('0x19'));var utils=require(_0x1cdd('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x1cdd('0x1b'));var db=require(_0x1cdd('0x1c'))['db'];function respondWithStatusCode(_0xbdbd05,_0x9c5afb){_0x9c5afb=_0x9c5afb||0xcc;return function(_0xd2464e){if(_0xd2464e){return _0xbdbd05['sendStatus'](_0x9c5afb);}return _0xbdbd05[_0x1cdd('0x1d')](_0x9c5afb)['end']();};}function respondWithResult(_0x16a11c,_0x135d60){_0x135d60=_0x135d60||0xc8;return function(_0x5105ce){if(_0x5105ce){return _0x16a11c[_0x1cdd('0x1d')](_0x135d60)[_0x1cdd('0x1e')](_0x5105ce);}};}function respondWithFilteredResult(_0x17c490,_0x198bbe){return function(_0x12841f){if(_0x12841f){var _0x288246=typeof _0x198bbe['offset']===_0x1cdd('0x1f')&&typeof _0x198bbe[_0x1cdd('0x20')]===_0x1cdd('0x1f');var _0x5dcd46=_0x12841f['count'];var _0x3918e8=_0x288246?0x0:_0x198bbe[_0x1cdd('0x21')];var _0x4496c4=_0x288246?_0x12841f[_0x1cdd('0x22')]:_0x198bbe[_0x1cdd('0x21')]+_0x198bbe[_0x1cdd('0x20')];var _0x440585;if(_0x4496c4>=_0x5dcd46){_0x4496c4=_0x5dcd46;_0x440585=0xc8;}else{_0x440585=0xce;}_0x17c490['status'](_0x440585);return _0x17c490[_0x1cdd('0x23')]('Content-Range',_0x3918e8+'-'+_0x4496c4+'/'+_0x5dcd46)[_0x1cdd('0x1e')](_0x12841f);}return null;};}function patchUpdates(_0x25df40){return function(_0x586538){try{jsonpatch[_0x1cdd('0x24')](_0x586538,_0x25df40,!![]);}catch(_0x335753){return BPromise[_0x1cdd('0x25')](_0x335753);}return _0x586538['save']();};}function saveUpdates(_0xf34176,_0x214529){return function(_0xe17b42){if(_0xe17b42){return _0xe17b42[_0x1cdd('0x26')](_0xf34176)[_0x1cdd('0x27')](function(_0x3ab91d){return _0x3ab91d;});}return null;};}function removeEntity(_0x175576,_0x5815a5){return function(_0x4cf72f){if(_0x4cf72f){return _0x4cf72f[_0x1cdd('0x28')]()[_0x1cdd('0x27')](function(){var _0x2c9ecf=_0x4cf72f['get']({'plain':!![]});var _0x21d842=_0x1cdd('0x29');return db[_0x1cdd('0x2a')]['destroy']({'where':{'type':_0x21d842,'resourceId':_0x2c9ecf['id']}})[_0x1cdd('0x27')](function(){return _0x4cf72f;});})[_0x1cdd('0x27')](function(){_0x175576['status'](0xcc)[_0x1cdd('0x2b')]();});}};}function handleEntityNotFound(_0x1b8be6,_0x21c561){return function(_0x11424f){if(!_0x11424f){_0x1b8be6['sendStatus'](0x194);}return _0x11424f;};}function handleError(_0x2c05ec,_0x4088c0){_0x4088c0=_0x4088c0||0x1f4;return function(_0x293916){logger[_0x1cdd('0x2c')](_0x293916[_0x1cdd('0x2d')]);if(_0x293916[_0x1cdd('0x2e')]){delete _0x293916[_0x1cdd('0x2e')];}_0x2c05ec[_0x1cdd('0x1d')](_0x4088c0)[_0x1cdd('0x2f')](_0x293916);};}exports[_0x1cdd('0x30')]=function(_0x5a8780,_0x86a824){var _0x36360d={},_0x4f5dda={},_0x5687b0={'count':0x0,'rows':[]};var _0xab7578=_[_0x1cdd('0x31')](db['Variable'][_0x1cdd('0x32')],function(_0xb431a1){return{'name':_0xb431a1[_0x1cdd('0x33')],'type':_0xb431a1[_0x1cdd('0x34')][_0x1cdd('0x35')]};});_0x4f5dda[_0x1cdd('0x36')]=_['map'](_0xab7578,'name');_0x4f5dda[_0x1cdd('0x37')]=_[_0x1cdd('0x38')](_0x5a8780['query']);_0x4f5dda[_0x1cdd('0x39')]=_[_0x1cdd('0x3a')](_0x4f5dda['model'],_0x4f5dda['query']);_0x36360d[_0x1cdd('0x3b')]=_[_0x1cdd('0x3a')](_0x4f5dda[_0x1cdd('0x36')],qs[_0x1cdd('0x3c')](_0x5a8780[_0x1cdd('0x37')][_0x1cdd('0x3c')]));_0x36360d[_0x1cdd('0x3b')]=_0x36360d[_0x1cdd('0x3b')][_0x1cdd('0x3d')]?_0x36360d[_0x1cdd('0x3b')]:_0x4f5dda[_0x1cdd('0x36')];if(!_0x5a8780[_0x1cdd('0x37')]['hasOwnProperty'](_0x1cdd('0x3e'))){_0x36360d[_0x1cdd('0x20')]=qs['limit'](_0x5a8780[_0x1cdd('0x37')][_0x1cdd('0x20')]);_0x36360d[_0x1cdd('0x21')]=qs[_0x1cdd('0x21')](_0x5a8780[_0x1cdd('0x37')]['offset']);}_0x36360d[_0x1cdd('0x3f')]=qs[_0x1cdd('0x40')](_0x5a8780[_0x1cdd('0x37')][_0x1cdd('0x40')]);_0x36360d[_0x1cdd('0x41')]=qs[_0x1cdd('0x39')](_[_0x1cdd('0x42')](_0x5a8780[_0x1cdd('0x37')],_0x4f5dda[_0x1cdd('0x39')]),_0xab7578);if(_0x5a8780[_0x1cdd('0x37')][_0x1cdd('0x43')]){_0x36360d[_0x1cdd('0x41')]=_['merge'](_0x36360d[_0x1cdd('0x41')],{'$or':_[_0x1cdd('0x31')](_0xab7578,function(_0x452851){if(_0x452851[_0x1cdd('0x34')]!=='VIRTUAL'){var _0x35c93f={};_0x35c93f[_0x452851[_0x1cdd('0x2e')]]={'$like':'%'+_0x5a8780[_0x1cdd('0x37')][_0x1cdd('0x43')]+'%'};return _0x35c93f;}})});}_0x36360d=_['merge']({},_0x36360d,_0x5a8780[_0x1cdd('0x44')]);var _0x200399={'where':_0x36360d['where']};return db[_0x1cdd('0x45')][_0x1cdd('0x22')](_0x200399)[_0x1cdd('0x27')](function(_0x4b3d24){_0x5687b0['count']=_0x4b3d24;if(_0x5a8780[_0x1cdd('0x37')][_0x1cdd('0x46')]){_0x36360d[_0x1cdd('0x47')]=[{'all':!![]}];}return db[_0x1cdd('0x45')][_0x1cdd('0x48')](_0x36360d);})[_0x1cdd('0x27')](function(_0x58ba71){_0x5687b0[_0x1cdd('0x49')]=_0x58ba71;return _0x5687b0;})[_0x1cdd('0x27')](respondWithFilteredResult(_0x86a824,_0x36360d))[_0x1cdd('0x4a')](handleError(_0x86a824,null));};exports[_0x1cdd('0x4b')]=function(_0x4a2c1e,_0x42762a){var _0x430013={'raw':!![],'where':{'id':_0x4a2c1e[_0x1cdd('0x4c')]['id']}},_0x433327={};_0x433327[_0x1cdd('0x36')]=_['keys'](db[_0x1cdd('0x45')]['rawAttributes']);_0x433327[_0x1cdd('0x37')]=_[_0x1cdd('0x38')](_0x4a2c1e[_0x1cdd('0x37')]);_0x433327[_0x1cdd('0x39')]=_[_0x1cdd('0x3a')](_0x433327['model'],_0x433327['query']);_0x430013[_0x1cdd('0x3b')]=_['intersection'](_0x433327['model'],qs[_0x1cdd('0x3c')](_0x4a2c1e[_0x1cdd('0x37')][_0x1cdd('0x3c')]));_0x430013[_0x1cdd('0x3b')]=_0x430013['attributes'][_0x1cdd('0x3d')]?_0x430013['attributes']:_0x433327[_0x1cdd('0x36')];if(_0x4a2c1e[_0x1cdd('0x37')][_0x1cdd('0x46')]){_0x430013[_0x1cdd('0x47')]=[{'all':!![]}];}_0x430013=_[_0x1cdd('0x4d')]({},_0x430013,_0x4a2c1e[_0x1cdd('0x44')]);return db[_0x1cdd('0x45')][_0x1cdd('0x4e')](_0x430013)['then'](handleEntityNotFound(_0x42762a,null))[_0x1cdd('0x27')](respondWithResult(_0x42762a,null))['catch'](handleError(_0x42762a,null));};exports[_0x1cdd('0x4f')]=function(_0x13371a,_0x26f598){return db[_0x1cdd('0x45')][_0x1cdd('0x4f')](_0x13371a['body'],{})['then'](function(_0x46cff5){var _0x9d7864=_0x13371a[_0x1cdd('0x50')]['get']({'plain':!![]});if(!_0x9d7864)throw new Error(_0x1cdd('0x51'));if(_0x9d7864[_0x1cdd('0x52')]===_0x1cdd('0x50')){var _0x81ec76=_0x46cff5['get']({'plain':!![]});var _0x4844a9=_0x1cdd('0x29');return db[_0x1cdd('0x53')][_0x1cdd('0x4e')]({'where':{'name':_0x4844a9,'userProfileId':_0x9d7864[_0x1cdd('0x54')]},'raw':!![]})[_0x1cdd('0x27')](function(_0x2552e8){if(_0x2552e8&&_0x2552e8[_0x1cdd('0x55')]===0x0){return db[_0x1cdd('0x2a')]['create']({'name':_0x81ec76[_0x1cdd('0x2e')],'resourceId':_0x81ec76['id'],'type':_0x2552e8[_0x1cdd('0x2e')],'sectionId':_0x2552e8['id']},{})[_0x1cdd('0x27')](function(){return _0x46cff5;});}else{return _0x46cff5;}})['catch'](function(_0x4cd8a9){logger[_0x1cdd('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cd8a9);throw _0x4cd8a9;});}return _0x46cff5;})[_0x1cdd('0x27')](respondWithResult(_0x26f598,0xc9))[_0x1cdd('0x4a')](handleError(_0x26f598,null));};exports['update']=function(_0x17c9c9,_0x23845d){if(_0x17c9c9[_0x1cdd('0x56')]['id']){delete _0x17c9c9['body']['id'];}return db[_0x1cdd('0x45')][_0x1cdd('0x4e')]({'where':{'id':_0x17c9c9[_0x1cdd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23845d,null))['then'](saveUpdates(_0x17c9c9[_0x1cdd('0x56')],null))[_0x1cdd('0x27')](respondWithResult(_0x23845d,null))['catch'](handleError(_0x23845d,null));};exports[_0x1cdd('0x28')]=function(_0x2a3179,_0x31562d){return db['Variable'][_0x1cdd('0x4e')]({'where':{'id':_0x2a3179['params']['id']}})[_0x1cdd('0x27')](handleEntityNotFound(_0x31562d,null))[_0x1cdd('0x27')](removeEntity(_0x31562d,null))[_0x1cdd('0x4a')](handleError(_0x31562d,null));}; \ No newline at end of file +var _0xa8cd=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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/environment','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Variables','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Variable','findAll','rows','catch','show','params','rawAttributes','includeAll','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0xa8cd,0xac));var _0xda8c=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0xa8cd[_0x5ee3d3];return _0x4b272f;};'use strict';var emlformat=require(_0xda8c('0x0'));var rimraf=require(_0xda8c('0x1'));var zipdir=require(_0xda8c('0x2'));var jsonpatch=require(_0xda8c('0x3'));var rp=require(_0xda8c('0x4'));var moment=require(_0xda8c('0x5'));var BPromise=require(_0xda8c('0x6'));var Mustache=require(_0xda8c('0x7'));var util=require(_0xda8c('0x8'));var path=require('path');var sox=require(_0xda8c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda8c('0xa'));var squel=require('squel');var crypto=require(_0xda8c('0xb'));var jsforce=require(_0xda8c('0xc'));var deskjs=require(_0xda8c('0xd'));var toCsv=require(_0xda8c('0xe'));var querystring=require(_0xda8c('0xf'));var Papa=require(_0xda8c('0x10'));var Redis=require(_0xda8c('0x11'));var authService=require(_0xda8c('0x12'));var qs=require(_0xda8c('0x13'));var as=require(_0xda8c('0x14'));var hardwareService=require(_0xda8c('0x15'));var logger=require(_0xda8c('0x16'))('api');var utils=require(_0xda8c('0x17'));var config=require(_0xda8c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34da20,_0x1bdc0f){_0x1bdc0f=_0x1bdc0f||0xcc;return function(_0x2935e2){if(_0x2935e2){return _0x34da20[_0xda8c('0x19')](_0x1bdc0f);}return _0x34da20['status'](_0x1bdc0f)[_0xda8c('0x1a')]();};}function respondWithResult(_0x5d2400,_0x118f00){_0x118f00=_0x118f00||0xc8;return function(_0x4fbc37){if(_0x4fbc37){return _0x5d2400[_0xda8c('0x1b')](_0x118f00)[_0xda8c('0x1c')](_0x4fbc37);}};}function respondWithFilteredResult(_0x593dcb,_0x2b1106){return function(_0x25a85d){if(_0x25a85d){var _0xa0c45=typeof _0x2b1106['offset']===_0xda8c('0x1d')&&typeof _0x2b1106['limit']===_0xda8c('0x1d');var _0x32c145=_0x25a85d[_0xda8c('0x1e')];var _0x2dadd6=_0xa0c45?0x0:_0x2b1106[_0xda8c('0x1f')];var _0x57d59c=_0xa0c45?_0x25a85d['count']:_0x2b1106[_0xda8c('0x1f')]+_0x2b1106[_0xda8c('0x20')];var _0x3f8844;if(_0x57d59c>=_0x32c145){_0x57d59c=_0x32c145;_0x3f8844=0xc8;}else{_0x3f8844=0xce;}_0x593dcb[_0xda8c('0x1b')](_0x3f8844);return _0x593dcb[_0xda8c('0x21')](_0xda8c('0x22'),_0x2dadd6+'-'+_0x57d59c+'/'+_0x32c145)[_0xda8c('0x1c')](_0x25a85d);}return null;};}function patchUpdates(_0x115c76){return function(_0x22200a){try{jsonpatch['apply'](_0x22200a,_0x115c76,!![]);}catch(_0x2d4d9e){return BPromise[_0xda8c('0x23')](_0x2d4d9e);}return _0x22200a[_0xda8c('0x24')]();};}function saveUpdates(_0x4abd27,_0x139715){return function(_0x5a3786){if(_0x5a3786){return _0x5a3786[_0xda8c('0x25')](_0x4abd27)[_0xda8c('0x26')](function(_0x53be60){return _0x53be60;});}return null;};}function removeEntity(_0x3797c7,_0x5c34f2){return function(_0x1cd923){if(_0x1cd923){return _0x1cd923[_0xda8c('0x27')]()[_0xda8c('0x26')](function(){var _0x5a3851=_0x1cd923[_0xda8c('0x28')]({'plain':!![]});var _0x1ecc2b=_0xda8c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x1ecc2b,'resourceId':_0x5a3851['id']}})['then'](function(){return _0x1cd923;});})['then'](function(){_0x3797c7['status'](0xcc)[_0xda8c('0x1a')]();});}};}function handleEntityNotFound(_0x5213f3,_0x1541eb){return function(_0x1a8725){if(!_0x1a8725){_0x5213f3[_0xda8c('0x19')](0x194);}return _0x1a8725;};}function handleError(_0x56a440,_0x4e29a9){_0x4e29a9=_0x4e29a9||0x1f4;return function(_0x376fb1){logger['error'](_0x376fb1[_0xda8c('0x2a')]);if(_0x376fb1[_0xda8c('0x2b')]){delete _0x376fb1['name'];}_0x56a440[_0xda8c('0x1b')](_0x4e29a9)[_0xda8c('0x2c')](_0x376fb1);};}exports[_0xda8c('0x2d')]=function(_0x28f983,_0xb06bba){var _0x3fcf44={},_0x586cda={},_0x6f4f77={'count':0x0,'rows':[]};var _0x56e680=_[_0xda8c('0x2e')](db['Variable']['rawAttributes'],function(_0x1330af){return{'name':_0x1330af[_0xda8c('0x2f')],'type':_0x1330af[_0xda8c('0x30')][_0xda8c('0x31')]};});_0x586cda['model']=_[_0xda8c('0x2e')](_0x56e680,_0xda8c('0x2b'));_0x586cda[_0xda8c('0x32')]=_[_0xda8c('0x33')](_0x28f983[_0xda8c('0x32')]);_0x586cda[_0xda8c('0x34')]=_[_0xda8c('0x35')](_0x586cda[_0xda8c('0x36')],_0x586cda[_0xda8c('0x32')]);_0x3fcf44[_0xda8c('0x37')]=_['intersection'](_0x586cda[_0xda8c('0x36')],qs['fields'](_0x28f983[_0xda8c('0x32')][_0xda8c('0x38')]));_0x3fcf44[_0xda8c('0x37')]=_0x3fcf44[_0xda8c('0x37')][_0xda8c('0x39')]?_0x3fcf44['attributes']:_0x586cda['model'];if(!_0x28f983[_0xda8c('0x32')][_0xda8c('0x3a')](_0xda8c('0x3b'))){_0x3fcf44[_0xda8c('0x20')]=qs[_0xda8c('0x20')](_0x28f983[_0xda8c('0x32')][_0xda8c('0x20')]);_0x3fcf44[_0xda8c('0x1f')]=qs['offset'](_0x28f983['query'][_0xda8c('0x1f')]);}_0x3fcf44[_0xda8c('0x3c')]=qs['sort'](_0x28f983[_0xda8c('0x32')][_0xda8c('0x3d')]);_0x3fcf44[_0xda8c('0x3e')]=qs[_0xda8c('0x34')](_[_0xda8c('0x3f')](_0x28f983[_0xda8c('0x32')],_0x586cda['filters']),_0x56e680);if(_0x28f983[_0xda8c('0x32')][_0xda8c('0x40')]){_0x3fcf44[_0xda8c('0x3e')]=_[_0xda8c('0x41')](_0x3fcf44['where'],{'$or':_[_0xda8c('0x2e')](_0x56e680,function(_0x20fdb5){if(_0x20fdb5[_0xda8c('0x30')]!==_0xda8c('0x42')){var _0x233c7d={};_0x233c7d[_0x20fdb5['name']]={'$like':'%'+_0x28f983[_0xda8c('0x32')][_0xda8c('0x40')]+'%'};return _0x233c7d;}})});}_0x3fcf44=_[_0xda8c('0x41')]({},_0x3fcf44,_0x28f983['options']);var _0x31a8cb={'where':_0x3fcf44[_0xda8c('0x3e')]};return db['Variable'][_0xda8c('0x1e')](_0x31a8cb)[_0xda8c('0x26')](function(_0xac7df9){_0x6f4f77[_0xda8c('0x1e')]=_0xac7df9;if(_0x28f983[_0xda8c('0x32')]['includeAll']){_0x3fcf44['include']=[{'all':!![]}];}return db[_0xda8c('0x43')][_0xda8c('0x44')](_0x3fcf44);})[_0xda8c('0x26')](function(_0x3a72a8){_0x6f4f77[_0xda8c('0x45')]=_0x3a72a8;return _0x6f4f77;})['then'](respondWithFilteredResult(_0xb06bba,_0x3fcf44))[_0xda8c('0x46')](handleError(_0xb06bba,null));};exports[_0xda8c('0x47')]=function(_0x1c574a,_0x4865ae){var _0x4f3708={'raw':!![],'where':{'id':_0x1c574a[_0xda8c('0x48')]['id']}},_0xa2569d={};_0xa2569d[_0xda8c('0x36')]=_[_0xda8c('0x33')](db[_0xda8c('0x43')][_0xda8c('0x49')]);_0xa2569d['query']=_[_0xda8c('0x33')](_0x1c574a['query']);_0xa2569d[_0xda8c('0x34')]=_[_0xda8c('0x35')](_0xa2569d[_0xda8c('0x36')],_0xa2569d[_0xda8c('0x32')]);_0x4f3708['attributes']=_['intersection'](_0xa2569d[_0xda8c('0x36')],qs[_0xda8c('0x38')](_0x1c574a[_0xda8c('0x32')][_0xda8c('0x38')]));_0x4f3708[_0xda8c('0x37')]=_0x4f3708['attributes'][_0xda8c('0x39')]?_0x4f3708[_0xda8c('0x37')]:_0xa2569d[_0xda8c('0x36')];if(_0x1c574a[_0xda8c('0x32')][_0xda8c('0x4a')]){_0x4f3708[_0xda8c('0x4b')]=[{'all':!![]}];}_0x4f3708=_[_0xda8c('0x41')]({},_0x4f3708,_0x1c574a['options']);return db['Variable']['find'](_0x4f3708)[_0xda8c('0x26')](handleEntityNotFound(_0x4865ae,null))[_0xda8c('0x26')](respondWithResult(_0x4865ae,null))[_0xda8c('0x46')](handleError(_0x4865ae,null));};exports['create']=function(_0x221b76,_0x87c028){return db[_0xda8c('0x43')]['create'](_0x221b76[_0xda8c('0x4c')],{})[_0xda8c('0x26')](function(_0x555d1c){var _0x4d4768=_0x221b76[_0xda8c('0x4d')]['get']({'plain':!![]});if(!_0x4d4768)throw new Error(_0xda8c('0x4e'));if(_0x4d4768[_0xda8c('0x4f')]===_0xda8c('0x4d')){var _0x153956=_0x555d1c[_0xda8c('0x28')]({'plain':!![]});var _0x3ae869=_0xda8c('0x29');return db[_0xda8c('0x50')][_0xda8c('0x51')]({'where':{'name':_0x3ae869,'userProfileId':_0x4d4768[_0xda8c('0x52')]},'raw':!![]})[_0xda8c('0x26')](function(_0x94e9e9){if(_0x94e9e9&&_0x94e9e9[_0xda8c('0x53')]===0x0){return db[_0xda8c('0x54')]['create']({'name':_0x153956[_0xda8c('0x2b')],'resourceId':_0x153956['id'],'type':_0x94e9e9['name'],'sectionId':_0x94e9e9['id']},{})['then'](function(){return _0x555d1c;});}else{return _0x555d1c;}})[_0xda8c('0x46')](function(_0x43e56b){logger[_0xda8c('0x55')](_0xda8c('0x56'),_0x43e56b);throw _0x43e56b;});}return _0x555d1c;})[_0xda8c('0x26')](respondWithResult(_0x87c028,0xc9))[_0xda8c('0x46')](handleError(_0x87c028,null));};exports[_0xda8c('0x25')]=function(_0x1e19ca,_0x2d8743){if(_0x1e19ca[_0xda8c('0x4c')]['id']){delete _0x1e19ca[_0xda8c('0x4c')]['id'];}return db[_0xda8c('0x43')][_0xda8c('0x51')]({'where':{'id':_0x1e19ca[_0xda8c('0x48')]['id']}})[_0xda8c('0x26')](handleEntityNotFound(_0x2d8743,null))[_0xda8c('0x26')](saveUpdates(_0x1e19ca[_0xda8c('0x4c')],null))[_0xda8c('0x26')](respondWithResult(_0x2d8743,null))['catch'](handleError(_0x2d8743,null));};exports[_0xda8c('0x27')]=function(_0xb3b185,_0x496d5b){return db[_0xda8c('0x43')][_0xda8c('0x51')]({'where':{'id':_0xb3b185['params']['id']}})[_0xda8c('0x26')](handleEntityNotFound(_0x496d5b,null))[_0xda8c('0x26')](removeEntity(_0x496d5b,null))[_0xda8c('0x46')](handleError(_0x496d5b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5446379..70e2684 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 _0x0852=['../../config/environment','./variable.attributes','exports','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x543d3c,_0x509981){var _0xf5fb6d=function(_0x28c53a){while(--_0x28c53a){_0x543d3c['push'](_0x543d3c['shift']());}};_0xf5fb6d(++_0x509981);}(_0x0852,0xd5));var _0x2085=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0852[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2085('0x0'))(_0x2085('0x1'));var moment=require(_0x2085('0x2'));var BPromise=require(_0x2085('0x3'));var rp=require(_0x2085('0x4'));var fs=require('fs');var path=require(_0x2085('0x5'));var rimraf=require(_0x2085('0x6'));var config=require(_0x2085('0x7'));var attributes=require(_0x2085('0x8'));module[_0x2085('0x9')]=function(_0x33c531,_0x2b4404){return _0x33c531['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf4c=['lodash','moment','request-promise','rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables'];(function(_0x563c20,_0x3db900){var _0x5e6df7=function(_0x281802){while(--_0x281802){_0x563c20['push'](_0x563c20['shift']());}};_0x5e6df7(++_0x3db900);}(_0xdf4c,0x1d4));var _0xcdf4=function(_0x465b0c,_0x569d90){_0x465b0c=_0x465b0c-0x0;var _0x502ff0=_0xdf4c[_0x465b0c];return _0x502ff0;};'use strict';var _=require(_0xcdf4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcdf4('0x1'));var BPromise=require('bluebird');var rp=require(_0xcdf4('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdf4('0x3'));var config=require(_0xcdf4('0x4'));var attributes=require(_0xcdf4('0x5'));module[_0xcdf4('0x6')]=function(_0x3848f0,_0x338716){return _0x3848f0['define'](_0xcdf4('0x7'),attributes,{'tableName':_0xcdf4('0x8'),'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 54d2cbd..d7c8a17 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0xb98e6e,_0xe56cbc){var _0x26751c=function(_0x123ccc){while(--_0x123ccc){_0xb98e6e['push'](_0xb98e6e['shift']());}};_0x26751c(++_0xe56cbc);}(_0x55ca,0x126));var _0xa55c=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x55ca[_0x320b8e];return _0x55a10a;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +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(_0x516006,_0x1dadc0){var _0xb7ee43=function(_0x5c8120){while(--_0x5c8120){_0x516006['push'](_0x516006['shift']());}};_0xb7ee43(++_0x1dadc0);}(_0x814b,0x1a2));var _0xb814=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x814b[_0xed9fea];return _0x198f12;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index c8c6d8e..475b59a 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 _0x980a=['./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service'];(function(_0x4bd626,_0x2dc566){var _0x29a074=function(_0x406a4e){while(--_0x406a4e){_0x4bd626['push'](_0x4bd626['shift']());}};_0x29a074(++_0x2dc566);}(_0x980a,0x74));var _0xa980=function(_0x3cc897,_0x1d0c16){_0x3cc897=_0x3cc897-0x0;var _0x4fb315=_0x980a[_0x3cc897];return _0x4fb315;};'use strict';var express=require(_0xa980('0x0'));var router=express[_0xa980('0x1')]();var auth=require(_0xa980('0x2'));var controller=require(_0xa980('0x3'));router[_0xa980('0x4')]('/',controller[_0xa980('0x5')]);router[_0xa980('0x4')](_0xa980('0x6'),auth[_0xa980('0x7')](),auth[_0xa980('0x8')](),controller[_0xa980('0x9')]);router[_0xa980('0x4')](_0xa980('0xa'),auth[_0xa980('0x7')](),auth['canUpdate'](),controller[_0xa980('0xb')]);router[_0xa980('0x4')]('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa980('0xc')]);router[_0xa980('0x4')]('/restart',auth[_0xa980('0x7')](),controller[_0xa980('0xd')]);router[_0xa980('0x4')](_0xa980('0xe'),controller[_0xa980('0xf')]);module[_0xa980('0x10')]=router; \ No newline at end of file +var _0xdf89=['pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','fetch','/reset','isAuthenticated','canUpdate','reset'];(function(_0x30ce9d,_0x42261a){var _0x4879b4=function(_0x5cb1eb){while(--_0x5cb1eb){_0x30ce9d['push'](_0x30ce9d['shift']());}};_0x4879b4(++_0x42261a);}(_0xdf89,0x1b5));var _0x9df8=function(_0x3bfbf4,_0x27699b){_0x3bfbf4=_0x3bfbf4-0x0;var _0x744620=_0xdf89[_0x3bfbf4];return _0x744620;};'use strict';var express=require(_0x9df8('0x0'));var router=express[_0x9df8('0x1')]();var auth=require(_0x9df8('0x2'));var controller=require(_0x9df8('0x3'));router['get']('/',controller[_0x9df8('0x4')]);router[_0x9df8('0x5')]('/fetch',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x9df8('0x6')]);router[_0x9df8('0x5')](_0x9df8('0x7'),auth[_0x9df8('0x8')](),auth[_0x9df8('0x9')](),controller[_0x9df8('0xa')]);router['get']('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x9df8('0xb')]);router[_0x9df8('0x5')](_0x9df8('0xc'),auth[_0x9df8('0x8')](),controller[_0x9df8('0xd')]);router[_0x9df8('0x5')](_0x9df8('0xe'),controller['migrations']);module[_0x9df8('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9dba097..dfd60e2 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 _0x3277=['fetch','tags','version','2.0.0','status','json','origin','info','git\x20fetch','reset','--hard','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','.js','push','length','sort','Migration','getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest'];(function(_0x1f6fe9,_0x20c7c2){var _0x4a6b71=function(_0x3b86e8){while(--_0x3b86e8){_0x1f6fe9['push'](_0x1f6fe9['shift']());}};_0x4a6b71(++_0x20c7c2);}(_0x3277,0x93));var _0x7327=function(_0x3b3a8c,_0x78cec9){_0x3b3a8c=_0x3b3a8c-0x0;var _0x3b4ba6=_0x3277[_0x3b3a8c];return _0x3b4ba6;};'use strict';var Umzug=require(_0x7327('0x0'));var path=require(_0x7327('0x1'));var fs=require('fs');var _=require(_0x7327('0x2'));var pkginfo=require(_0x7327('0x3'))(module,'version');var compareVersions=require(_0x7327('0x4'));var exec=require(_0x7327('0x5'))[_0x7327('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x7327('0x7'));var pm2=require(_0x7327('0x8'));var logger=require(_0x7327('0x9'))('update');var git=require('simple-git')(config[_0x7327('0xa')]);exports[_0x7327('0xb')]=function(_0x15874c,_0x4aa9ba){var _0x1207f3={'current':module[_0x7327('0xc')]['version'],'phonebar':0x2};if(_0x15874c[_0x7327('0xd')]&&_0x15874c['query'][_0x7327('0xe')]){return git[_0x7327('0xf')]()[_0x7327('0x10')](function(_0x72a264,_0x5f3666){_0x1207f3[_0x7327('0xe')]=(_0x72a264?module['exports'][_0x7327('0x11')]:_0x5f3666[_0x7327('0xe')])||_0x7327('0x12');return _0x4aa9ba[_0x7327('0x13')](0xc8)[_0x7327('0x14')](_0x1207f3);});}else{return _0x4aa9ba[_0x7327('0x13')](0xc8)[_0x7327('0x14')](_0x1207f3);}};exports[_0x7327('0xf')]=function(_0x450226,_0x5c8736){return git[_0x7327('0xf')]([_0x7327('0x15'),'master'],function(_0x842200){if(_0x842200){logger['error'](_0x842200);return _0x5c8736['status'](0x1f4)['json'](_0x842200);}logger[_0x7327('0x16')](_0x7327('0x17'));return _0x5c8736[_0x7327('0x13')](0xc8)[_0x7327('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x7327('0x18')]=function(_0x43b28e,_0x382618){return git[_0x7327('0x18')]([_0x7327('0x19'),'FETCH_HEAD'],function(_0x580d6f){if(_0x580d6f){logger[_0x7327('0x1a')](_0x580d6f);return _0x382618['status'](0x1f4)['json'](_0x580d6f);}logger[_0x7327('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x382618['status'](0xc8)[_0x7327('0x14')]({'output':_0x7327('0x1b')});});};exports[_0x7327('0x1c')]=function(_0x3dd3d7,_0x4ffb74){exec(_0x7327('0x1d'),function(_0x5df6b9,_0x567ddc,_0x59f115){logger[_0x7327('0x16')](_0x567ddc);logger[_0x7327('0x16')](_0x59f115);if(_0x5df6b9){logger[_0x7327('0x1a')](_0x5df6b9);return _0x4ffb74[_0x7327('0x13')](0x1f4)[_0x7327('0x14')](_0x5df6b9);}return _0x4ffb74['status'](0xc8)['json']({'output':_0x567ddc});});};exports['restart']=function(_0x1f179a,_0x1f6875){return pm2[_0x7327('0x1e')](_0x7327('0x1f'))[_0x7327('0x20')](function(_0x50fbe6){logger[_0x7327('0x16')]('pm2\x20restart\x20motion\x20%s',_0x50fbe6);return _0x1f6875[_0x7327('0x13')](0xc8)[_0x7327('0x14')]({'output':_0x7327('0x21')});})['catch'](function(_0x189349){logger['error'](_0x189349);return _0x1f6875['status'](0x1f4)[_0x7327('0x14')](_0x189349);});};exports[_0x7327('0x22')]=function(_0x2a3d8e,_0x18e8a2){var _0x155fa0=fs[_0x7327('0x23')](path[_0x7327('0x24')](config[_0x7327('0xa')],_0x7327('0x25'),_0x7327('0x22')));var _0x3f07b5=[];for(var _0x4cf28f=0x0;_0x4cf28f<_0x155fa0['length'];_0x4cf28f++){var _0x1c50aa=_0x155fa0[_0x4cf28f]['replace'](_0x7327('0x26'),'');if(compareVersions(module[_0x7327('0xc')][_0x7327('0x11')],_0x1c50aa)===-0x1){_0x3f07b5[_0x7327('0x27')](_0x1c50aa);}}if(_0x3f07b5[_0x7327('0x28')]){var _0x44c0bc=_0x3f07b5[_0x7327('0x29')](compareVersions);var _0x201010=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x7327('0x2a'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x7327('0x2b')](),db[_0x7327('0x2c')][_0x7327('0x2d')],function(){throw new Error(_0x7327('0x2e'));}],'path':path['join'](config[_0x7327('0xa')],'server','migrations'),'pattern':/\.js$/}});_0x201010['up']({'migrations':_[_0x7327('0x2f')](_0x44c0bc,function(_0x22a46f){return _0x22a46f+_0x7327('0x26');})})['then'](function(){return _0x18e8a2[_0x7327('0x13')](0xc8)[_0x7327('0x14')]({'output':_0x7327('0x30')+module[_0x7327('0xc')][_0x7327('0x11')]+_0x7327('0x31')+_[_0x7327('0x32')](_0x44c0bc),'migrations':_['join'](_0x44c0bc)});})[_0x7327('0x33')](function(_0x2ddd62){if(_0x2ddd62 instanceof db[_0x7327('0x2c')][_0x7327('0x34')]){return _0x18e8a2['status'](0xc8)['json']({'output':_0x7327('0x35')});}else{return _0x18e8a2[_0x7327('0x13')](0x1f4)[_0x7327('0x14')](_0x2ddd62);}});}else{return _0x18e8a2[_0x7327('0x13')](0xc8)[_0x7327('0x14')]({'output':_0x7327('0x35')});}}; \ No newline at end of file +var _0xf013=['query','latest','fetch','tags','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sequelize','Migration','getQueryInterface','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports'];(function(_0xd7100f,_0x13bdcd){var _0x5cf70e=function(_0x3ac391){while(--_0x3ac391){_0xd7100f['push'](_0xd7100f['shift']());}};_0x5cf70e(++_0x13bdcd);}(_0xf013,0xea));var _0x3f01=function(_0x52aded,_0x90edd4){_0x52aded=_0x52aded-0x0;var _0x431415=_0xf013[_0x52aded];return _0x431415;};'use strict';var Umzug=require(_0x3f01('0x0'));var path=require(_0x3f01('0x1'));var fs=require('fs');var _=require(_0x3f01('0x2'));var pkginfo=require(_0x3f01('0x3'))(module,_0x3f01('0x4'));var compareVersions=require(_0x3f01('0x5'));var exec=require(_0x3f01('0x6'))[_0x3f01('0x7')];var db=require(_0x3f01('0x8'))['db'];var config=require(_0x3f01('0x9'));var pm2=require(_0x3f01('0xa'));var logger=require('../../config/logger')(_0x3f01('0xb'));var git=require(_0x3f01('0xc'))(config[_0x3f01('0xd')]);exports[_0x3f01('0xe')]=function(_0x2119fb,_0x410352){var _0x5f5ee0={'current':module[_0x3f01('0xf')]['version'],'phonebar':0x2};if(_0x2119fb[_0x3f01('0x10')]&&_0x2119fb['query'][_0x3f01('0x11')]){return git[_0x3f01('0x12')]()[_0x3f01('0x13')](function(_0x22b851,_0x40198b){_0x5f5ee0[_0x3f01('0x11')]=(_0x22b851?module[_0x3f01('0xf')][_0x3f01('0x4')]:_0x40198b[_0x3f01('0x11')])||'2.0.0';return _0x410352[_0x3f01('0x14')](0xc8)['json'](_0x5f5ee0);});}else{return _0x410352[_0x3f01('0x14')](0xc8)[_0x3f01('0x15')](_0x5f5ee0);}};exports['fetch']=function(_0x493faf,_0x459895){return git[_0x3f01('0x12')]([_0x3f01('0x16'),'master'],function(_0x598710){if(_0x598710){logger[_0x3f01('0x17')](_0x598710);return _0x459895[_0x3f01('0x14')](0x1f4)['json'](_0x598710);}logger[_0x3f01('0x18')](_0x3f01('0x19'));return _0x459895[_0x3f01('0x14')](0xc8)[_0x3f01('0x15')]({'output':_0x3f01('0x1a')});});};exports[_0x3f01('0x1b')]=function(_0x5c7d3a,_0xb3049e){return git['reset']([_0x3f01('0x1c'),'FETCH_HEAD'],function(_0xb9ea4d){if(_0xb9ea4d){logger[_0x3f01('0x17')](_0xb9ea4d);return _0xb3049e[_0x3f01('0x14')](0x1f4)['json'](_0xb9ea4d);}logger[_0x3f01('0x18')](_0x3f01('0x1d'));return _0xb3049e['status'](0xc8)[_0x3f01('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0x3f01('0x1e')]=function(_0x3aad15,_0x3a946f){exec('npm\x20install\x20--production',function(_0x21c49c,_0x3a9c0f,_0x9599a6){logger['info'](_0x3a9c0f);logger[_0x3f01('0x18')](_0x9599a6);if(_0x21c49c){logger[_0x3f01('0x17')](_0x21c49c);return _0x3a946f[_0x3f01('0x14')](0x1f4)[_0x3f01('0x15')](_0x21c49c);}return _0x3a946f[_0x3f01('0x14')](0xc8)[_0x3f01('0x15')]({'output':_0x3a9c0f});});};exports[_0x3f01('0x1f')]=function(_0x34ba13,_0x490e90){return pm2['restart']('motion2')[_0x3f01('0x20')](function(_0x1bc0a2){logger[_0x3f01('0x18')]('pm2\x20restart\x20motion\x20%s',_0x1bc0a2);return _0x490e90[_0x3f01('0x14')](0xc8)[_0x3f01('0x15')]({'output':_0x3f01('0x21')});})[_0x3f01('0x22')](function(_0x3f6ec4){logger[_0x3f01('0x17')](_0x3f6ec4);return _0x490e90[_0x3f01('0x14')](0x1f4)[_0x3f01('0x15')](_0x3f6ec4);});};exports[_0x3f01('0x23')]=function(_0x5f4dfd,_0x9d4286){var _0x350941=fs[_0x3f01('0x24')](path[_0x3f01('0x25')](config[_0x3f01('0xd')],_0x3f01('0x26'),_0x3f01('0x23')));var _0x592791=[];for(var _0x5ccc7e=0x0;_0x5ccc7e<_0x350941[_0x3f01('0x27')];_0x5ccc7e++){var _0x134653=_0x350941[_0x5ccc7e]['replace'](_0x3f01('0x28'),'');if(compareVersions(module[_0x3f01('0xf')][_0x3f01('0x4')],_0x134653)===-0x1){_0x592791[_0x3f01('0x29')](_0x134653);}}if(_0x592791[_0x3f01('0x27')]){var _0x151aad=_0x592791['sort'](compareVersions);var _0x5c7b03=new Umzug({'storage':_0x3f01('0x2a'),'storageOptions':{'model':db[_0x3f01('0x2b')],'modelName':'Migration','columnName':_0x3f01('0x4')},'migrations':{'params':[db['sequelize'][_0x3f01('0x2c')](),db[_0x3f01('0x2a')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x3f01('0x25')](config['root'],_0x3f01('0x26'),_0x3f01('0x23')),'pattern':/\.js$/}});_0x5c7b03['up']({'migrations':_['map'](_0x151aad,function(_0x863c4f){return _0x863c4f+_0x3f01('0x28');})})['then'](function(){return _0x9d4286[_0x3f01('0x14')](0xc8)[_0x3f01('0x15')]({'output':_0x3f01('0x2d')+module[_0x3f01('0xf')][_0x3f01('0x4')]+_0x3f01('0x2e')+_[_0x3f01('0x2f')](_0x151aad),'migrations':_[_0x3f01('0x25')](_0x151aad)});})[_0x3f01('0x22')](function(_0x507de4){if(_0x507de4 instanceof db[_0x3f01('0x2a')][_0x3f01('0x30')]){return _0x9d4286['status'](0xc8)['json']({'output':_0x3f01('0x31')});}else{return _0x9d4286[_0x3f01('0x14')](0x1f4)['json'](_0x507de4);}});}else{return _0x9d4286[_0x3f01('0x14')](0xc8)[_0x3f01('0x15')]({'output':_0x3f01('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 23b64c9..26e692b 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 _0x8bca=['/describe','isAuthenticated','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','get'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x8bca,0x145));var _0xa8bc=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8bca[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0xa8bc('0x0'));var path=require(_0xa8bc('0x1'));var timeout=require(_0xa8bc('0x2'));var express=require('express');var router=express[_0xa8bc('0x3')]();var fs_extra=require(_0xa8bc('0x4'));var auth=require(_0xa8bc('0x5'));var interaction=require(_0xa8bc('0x6'));var config=require(_0xa8bc('0x7'));var controller=require(_0xa8bc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa8bc('0x9')]);router[_0xa8bc('0xa')](_0xa8bc('0xb'),auth[_0xa8bc('0xc')](),controller[_0xa8bc('0xd')]);router[_0xa8bc('0xa')](_0xa8bc('0xe'),auth['isAuthenticated'](),controller[_0xa8bc('0xf')]);router[_0xa8bc('0x10')]('/',auth[_0xa8bc('0xc')](),controller['create']);router['put'](_0xa8bc('0xe'),auth['isAuthenticated'](),controller[_0xa8bc('0x11')]);router[_0xa8bc('0x12')](_0xa8bc('0xe'),auth[_0xa8bc('0xc')](),controller[_0xa8bc('0x13')]);module[_0xa8bc('0x14')]=router; \ No newline at end of file +var _0x3aed=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3aed,0x1e0));var _0xd3ae=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x3aed[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xd3ae('0x0'));var util=require(_0xd3ae('0x1'));var path=require('path');var timeout=require(_0xd3ae('0x2'));var express=require('express');var router=express[_0xd3ae('0x3')]();var fs_extra=require(_0xd3ae('0x4'));var auth=require(_0xd3ae('0x5'));var interaction=require(_0xd3ae('0x6'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xd3ae('0x7')]('/',auth[_0xd3ae('0x8')](),controller[_0xd3ae('0x9')]);router[_0xd3ae('0x7')](_0xd3ae('0xa'),auth[_0xd3ae('0x8')](),controller[_0xd3ae('0xb')]);router[_0xd3ae('0x7')](_0xd3ae('0xc'),auth['isAuthenticated'](),controller[_0xd3ae('0xd')]);router[_0xd3ae('0xe')]('/',auth[_0xd3ae('0x8')](),controller[_0xd3ae('0xf')]);router[_0xd3ae('0x10')](_0xd3ae('0xc'),auth[_0xd3ae('0x8')](),controller[_0xd3ae('0x11')]);router[_0xd3ae('0x12')]('/:id',auth[_0xd3ae('0x8')](),controller[_0xd3ae('0x13')]);module[_0xd3ae('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 47bc848..f8c1fcc 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 _0x14a0=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x3da01e,_0x1823fd){var _0x553703=function(_0x205526){while(--_0x205526){_0x3da01e['push'](_0x3da01e['shift']());}};_0x553703(++_0x1823fd);}(_0x14a0,0x8e));var _0x014a=function(_0x4de29d,_0x10a255){_0x4de29d=_0x4de29d-0x0;var _0x37013b=_0x14a0[_0x4de29d];return _0x37013b;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'type':{'type':Sequelize[_0x014a('0x1')]},'uniqueid':{'type':Sequelize[_0x014a('0x1')]},'calleridnum':{'type':Sequelize[_0x014a('0x1')]},'calleridname':{'type':Sequelize[_0x014a('0x1')]},'queue':{'type':Sequelize[_0x014a('0x1')]},'interface':{'type':Sequelize[_0x014a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x014a('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x014a('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x014a('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x014a('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x014a('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x014a('0x1')]},'language':{'type':Sequelize[_0x014a('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x014a('0x1')]},'exten':{'type':Sequelize[_0x014a('0x1')]},'priority':{'type':Sequelize[_0x014a('0x1')]},'destchannel':{'type':Sequelize[_0x014a('0x1')]},'destchannelstate':{'type':Sequelize[_0x014a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x014a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x014a('0x1')]},'destcalleridname':{'type':Sequelize[_0x014a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x014a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x014a('0x1')]},'destlanguage':{'type':Sequelize[_0x014a('0x1')]},'destaccountcode':{'type':Sequelize[_0x014a('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x014a('0x1')]},'destpriority':{'type':Sequelize[_0x014a('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x014a('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x014a('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x014a('0x1')],'comment':_0x014a('0x5')},'transferexten':{'type':Sequelize[_0x014a('0x1')]},'transferuniqueid':{'type':Sequelize[_0x014a('0x1')]},'agententerreason':{'type':Sequelize[_0x014a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4fad=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0x4fad,0xcb));var _0xd4fa=function(_0x5986a1,_0x400afd){_0x5986a1=_0x5986a1-0x0;var _0x4dbf6b=_0x4fad[_0x5986a1];return _0x4dbf6b;};'use strict';var Sequelize=require(_0xd4fa('0x0'));module[_0xd4fa('0x1')]={'type':{'type':Sequelize[_0xd4fa('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd4fa('0x2')]},'calleridname':{'type':Sequelize[_0xd4fa('0x2')]},'queue':{'type':Sequelize[_0xd4fa('0x2')]},'interface':{'type':Sequelize[_0xd4fa('0x2')]},'membername':{'type':Sequelize[_0xd4fa('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd4fa('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd4fa('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd4fa('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xd4fa('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd4fa('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd4fa('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd4fa('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd4fa('0x5')]},'agentacw':{'type':Sequelize[_0xd4fa('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd4fa('0x2')]},'lastevent':{'type':Sequelize[_0xd4fa('0x2')]},'channel':{'type':Sequelize[_0xd4fa('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd4fa('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd4fa('0x2')]},'connectedlinename':{'type':Sequelize[_0xd4fa('0x2')]},'language':{'type':Sequelize[_0xd4fa('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd4fa('0x2')]},'exten':{'type':Sequelize[_0xd4fa('0x2')]},'priority':{'type':Sequelize[_0xd4fa('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd4fa('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xd4fa('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd4fa('0x2')]},'destcalleridname':{'type':Sequelize[_0xd4fa('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd4fa('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd4fa('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd4fa('0x2')]},'destcontext':{'type':Sequelize[_0xd4fa('0x2')]},'destexten':{'type':Sequelize[_0xd4fa('0x2')]},'destpriority':{'type':Sequelize[_0xd4fa('0x2')]},'destuniqueid':{'type':Sequelize[_0xd4fa('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd4fa('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd4fa('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd4fa('0x2')],'comment':_0xd4fa('0x6')},'transferexten':{'type':Sequelize[_0xd4fa('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'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 6f314cb..36a6092 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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 f90c793..89afc07 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 _0x425d=['define','VoiceAgentReport','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x425d,0x1e0));var _0xd425=function(_0x7642c,_0x2ec4b0){_0x7642c=_0x7642c-0x0;var _0x5412fd=_0x425d[_0x7642c];return _0x5412fd;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var fs=require('fs');var path=require(_0xd425('0x6'));var rimraf=require(_0xd425('0x7'));var config=require('../../config/environment');var attributes=require(_0xd425('0x8'));module[_0xd425('0x9')]=function(_0xc4e080,_0x36866e){return _0xc4e080[_0xd425('0xa')](_0xd425('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xd425('0xc'),_0xd425('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0689=['uniqueid','destuniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x1259b1,_0x495584){var _0x30a3e5=function(_0x18a866){while(--_0x18a866){_0x1259b1['push'](_0x1259b1['shift']());}};_0x30a3e5(++_0x495584);}(_0x0689,0x161));var _0x9068=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0x0689[_0x5300b6];return _0x58980e;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var logger=require('../../config/logger')(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var BPromise=require(_0x9068('0x3'));var rp=require(_0x9068('0x4'));var fs=require('fs');var path=require(_0x9068('0x5'));var rimraf=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var attributes=require(_0x9068('0x8'));module[_0x9068('0x9')]=function(_0x287846,_0x5ce5a7){return _0x287846[_0x9068('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9068('0xb'),_0x9068('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b62f16f..3bd3bc5 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 _0x9ff5=['VoiceAgentReport','create','body','options','stringify','catch','CreateVoiceAgentReport','UpdateVoiceAgentReport','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x56975e,_0x587d46){var _0x16c8d2=function(_0x2b52e6){while(--_0x2b52e6){_0x56975e['push'](_0x56975e['shift']());}};_0x16c8d2(++_0x587d46);}(_0x9ff5,0x1aa));var _0x59ff=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x9ff5[_0x261522];return _0x98a25a;};'use strict';var _=require(_0x59ff('0x0'));var util=require(_0x59ff('0x1'));var moment=require(_0x59ff('0x2'));var BPromise=require(_0x59ff('0x3'));var rs=require(_0x59ff('0x4'));var fs=require('fs');var Redis=require(_0x59ff('0x5'));var db=require(_0x59ff('0x6'))['db'];var utils=require(_0x59ff('0x7'));var logger=require(_0x59ff('0x8'))('rpc');var config=require(_0x59ff('0x9'));var jayson=require(_0x59ff('0xa'));var client=jayson[_0x59ff('0xb')][_0x59ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x265e66,_0x360496,_0x383f08){return new BPromise(function(_0x402f2d,_0x597393){return client['request'](_0x265e66,_0x383f08)['then'](function(_0x4eb627){logger[_0x59ff('0xd')](_0x59ff('0xe'),_0x360496,_0x59ff('0xf'));logger[_0x59ff('0x10')](_0x59ff('0x11'),_0x360496,_0x59ff('0xf'),JSON['stringify'](_0x4eb627));if(_0x4eb627[_0x59ff('0x12')]){if(_0x4eb627['error'][_0x59ff('0x13')]===0x1f4){logger[_0x59ff('0x12')](_0x59ff('0xe'),_0x360496,_0x4eb627[_0x59ff('0x12')][_0x59ff('0x14')]);return _0x597393(_0x4eb627[_0x59ff('0x12')][_0x59ff('0x14')]);}logger[_0x59ff('0x12')](_0x59ff('0xe'),_0x360496,_0x4eb627['error'][_0x59ff('0x14')]);return _0x402f2d(_0x4eb627[_0x59ff('0x12')][_0x59ff('0x14')]);}else{logger[_0x59ff('0xd')](_0x59ff('0xe'),_0x360496,_0x59ff('0xf'));_0x402f2d(_0x4eb627[_0x59ff('0x15')][_0x59ff('0x14')]);}})['catch'](function(_0x15b9b9){logger[_0x59ff('0x12')](_0x59ff('0xe'),_0x360496,_0x15b9b9);_0x597393(_0x15b9b9);});});}exports['CreateVoiceAgentReport']=function(_0x505ec2){var _0x15d295=this;return new Promise(function(_0xc251ef,_0x29b73b){return db[_0x59ff('0x16')][_0x59ff('0x17')](_0x505ec2[_0x59ff('0x18')],{'raw':_0x505ec2['options']?_0x505ec2[_0x59ff('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5171b5){logger[_0x59ff('0xd')]('CreateVoiceAgentReport',_0x505ec2);logger['debug']('CreateVoiceAgentReport',_0x505ec2,JSON[_0x59ff('0x1a')](_0x5171b5));_0xc251ef(_0x5171b5);})[_0x59ff('0x1b')](function(_0x59aa13){logger[_0x59ff('0x12')](_0x59ff('0x1c'),_0x59aa13[_0x59ff('0x14')],_0x505ec2);_0x29b73b(_0x15d295[_0x59ff('0x12')](0x1f4,_0x59aa13[_0x59ff('0x14')]));});});};exports[_0x59ff('0x1d')]=function(_0x482b32){var _0x2afde2=this;return new Promise(function(_0x32d070,_0x22daf4){return db[_0x59ff('0x16')]['update'](_0x482b32[_0x59ff('0x18')],{'raw':_0x482b32[_0x59ff('0x19')]?_0x482b32[_0x59ff('0x19')][_0x59ff('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482b32[_0x59ff('0x19')]?_0x482b32[_0x59ff('0x19')]['where']||null:null,'attributes':_0x482b32['options']?_0x482b32[_0x59ff('0x19')][_0x59ff('0x1f')]||null:null,'limit':_0x482b32['options']?_0x482b32[_0x59ff('0x19')]['limit']||null:null})['then'](function(_0x8f78f4){logger[_0x59ff('0xd')](_0x59ff('0x1d'),_0x482b32);logger[_0x59ff('0x10')]('UpdateVoiceAgentReport',_0x482b32,JSON[_0x59ff('0x1a')](_0x8f78f4));_0x32d070(_0x8f78f4);})[_0x59ff('0x1b')](function(_0x585380){logger['error'](_0x59ff('0x1d'),_0x585380['message'],_0x482b32);_0x22daf4(_0x2afde2[_0x59ff('0x12')](0x1f4,_0x585380['message']));});});}; \ No newline at end of file +var _0xe243=['catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1bb22d,_0x44413c){var _0xa2b45=function(_0x28ec90){while(--_0x28ec90){_0x1bb22d['push'](_0x1bb22d['shift']());}};_0xa2b45(++_0x44413c);}(_0xe243,0x1e7));var _0x3e24=function(_0x5ee287,_0x49b6a1){_0x5ee287=_0x5ee287-0x0;var _0x2a1adf=_0xe243[_0x5ee287];return _0x2a1adf;};'use strict';var _=require('lodash');var util=require(_0x3e24('0x0'));var moment=require(_0x3e24('0x1'));var BPromise=require(_0x3e24('0x2'));var rs=require(_0x3e24('0x3'));var fs=require('fs');var Redis=require(_0x3e24('0x4'));var db=require(_0x3e24('0x5'))['db'];var utils=require(_0x3e24('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e24('0x7'));var jayson=require(_0x3e24('0x8'));var client=jayson[_0x3e24('0x9')][_0x3e24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc534c4,_0x1996e9,_0x2833f4){return new BPromise(function(_0x5c0132,_0x451ef2){return client[_0x3e24('0xb')](_0xc534c4,_0x2833f4)[_0x3e24('0xc')](function(_0xc93a49){logger[_0x3e24('0xd')](_0x3e24('0xe'),_0x1996e9,_0x3e24('0xf'));logger[_0x3e24('0x10')](_0x3e24('0x11'),_0x1996e9,_0x3e24('0xf'),JSON[_0x3e24('0x12')](_0xc93a49));if(_0xc93a49[_0x3e24('0x13')]){if(_0xc93a49[_0x3e24('0x13')][_0x3e24('0x14')]===0x1f4){logger[_0x3e24('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x1996e9,_0xc93a49['error'][_0x3e24('0x15')]);return _0x451ef2(_0xc93a49[_0x3e24('0x13')][_0x3e24('0x15')]);}logger[_0x3e24('0x13')](_0x3e24('0xe'),_0x1996e9,_0xc93a49[_0x3e24('0x13')]['message']);return _0x5c0132(_0xc93a49[_0x3e24('0x13')]['message']);}else{logger[_0x3e24('0xd')](_0x3e24('0xe'),_0x1996e9,_0x3e24('0xf'));_0x5c0132(_0xc93a49[_0x3e24('0x16')][_0x3e24('0x15')]);}})[_0x3e24('0x17')](function(_0x27d612){logger['error'](_0x3e24('0xe'),_0x1996e9,_0x27d612);_0x451ef2(_0x27d612);});});}exports[_0x3e24('0x18')]=function(_0xcfafa6){var _0x8aee77=this;return new Promise(function(_0x2306f4,_0x38761f){return db[_0x3e24('0x19')][_0x3e24('0x1a')](_0xcfafa6[_0x3e24('0x1b')],{'raw':_0xcfafa6[_0x3e24('0x1c')]?_0xcfafa6[_0x3e24('0x1c')][_0x3e24('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x37e7f6){logger[_0x3e24('0xd')](_0x3e24('0x18'),_0xcfafa6);logger['debug']('CreateVoiceAgentReport',_0xcfafa6,JSON[_0x3e24('0x12')](_0x37e7f6));_0x2306f4(_0x37e7f6);})[_0x3e24('0x17')](function(_0x801897){logger[_0x3e24('0x13')]('CreateVoiceAgentReport',_0x801897[_0x3e24('0x15')],_0xcfafa6);_0x38761f(_0x8aee77[_0x3e24('0x13')](0x1f4,_0x801897[_0x3e24('0x15')]));});});};exports[_0x3e24('0x1e')]=function(_0x506f30){var _0x141c67=this;return new Promise(function(_0x194b67,_0x5ed363){return db[_0x3e24('0x19')][_0x3e24('0x1f')](_0x506f30[_0x3e24('0x1b')],{'raw':_0x506f30[_0x3e24('0x1c')]?_0x506f30[_0x3e24('0x1c')][_0x3e24('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x506f30[_0x3e24('0x1c')]?_0x506f30[_0x3e24('0x1c')][_0x3e24('0x20')]||null:null,'attributes':_0x506f30[_0x3e24('0x1c')]?_0x506f30[_0x3e24('0x1c')]['attributes']||null:null,'limit':_0x506f30[_0x3e24('0x1c')]?_0x506f30[_0x3e24('0x1c')][_0x3e24('0x21')]||null:null})[_0x3e24('0xc')](function(_0x2784a6){logger[_0x3e24('0xd')](_0x3e24('0x1e'),_0x506f30);logger['debug'](_0x3e24('0x1e'),_0x506f30,JSON[_0x3e24('0x12')](_0x2784a6));_0x194b67(_0x2784a6);})['catch'](function(_0x5c4588){logger[_0x3e24('0x13')]('UpdateVoiceAgentReport',_0x5c4588[_0x3e24('0x15')],_0x506f30);_0x5ed363(_0x141c67['error'](0x1f4,_0x5c4588[_0x3e24('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6139d51..7a4c137 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 _0x4bc3=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x508fb1,_0x5da7c5){var _0x3e73fe=function(_0x5bde79){while(--_0x5bde79){_0x508fb1['push'](_0x508fb1['shift']());}};_0x3e73fe(++_0x5da7c5);}(_0x4bc3,0x16e));var _0x34bc=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4bc3[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x10')]('/:id',auth[_0x34bc('0xa')](),controller[_0x34bc('0x11')]);module[_0x34bc('0x12')]=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./voiceCallReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dcc75,_0x25a501){var _0x21f06f=function(_0x537354){while(--_0x537354){_0x3dcc75['push'](_0x3dcc75['shift']());}};_0x21f06f(++_0x25a501);}(_0xe5b3,0x133));var _0x3e5b=function(_0x16e8a1,_0x4da812){_0x16e8a1=_0x16e8a1-0x0;var _0x573867=_0xe5b3[_0x16e8a1];return _0x573867;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d8a9b54..4e49139 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 _0x9140=['outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','inbound-fax'];(function(_0x3b00b4,_0x413db0){var _0x1f83a4=function(_0x5f1a3b){while(--_0x5f1a3b){_0x3b00b4['push'](_0x3b00b4['shift']());}};_0x1f83a4(++_0x413db0);}(_0x9140,0x185));var _0x0914=function(_0x2aba20,_0x1852fb){_0x2aba20=_0x2aba20-0x0;var _0x326961=_0x9140[_0x2aba20];return _0x326961;};'use strict';var Sequelize=require(_0x0914('0x0'));module[_0x0914('0x1')]={'uniqueid':{'type':Sequelize[_0x0914('0x2')]},'type':{'type':Sequelize[_0x0914('0x3')](_0x0914('0x4'),'internal',_0x0914('0x5'),_0x0914('0x6'),_0x0914('0x7'),'dialer')},'tag':{'type':Sequelize[_0x0914('0x2')]},'accountcode':{'type':Sequelize[_0x0914('0x2')]},'source':{'type':Sequelize[_0x0914('0x2')]},'destination':{'type':Sequelize[_0x0914('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0914('0x2')]},'channel':{'type':Sequelize[_0x0914('0x2')]},'destinationchannel':{'type':Sequelize[_0x0914('0x2')]},'lastapplication':{'type':Sequelize[_0x0914('0x2')]},'lastdata':{'type':Sequelize[_0x0914('0x8')]},'starttime':{'type':Sequelize[_0x0914('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0914('0x9')]},'endtime':{'type':Sequelize[_0x0914('0x9')]},'duration':{'type':Sequelize[_0x0914('0xa')]},'billableseconds':{'type':Sequelize[_0x0914('0xa')]},'mohtime':{'type':Sequelize[_0x0914('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0914('0x2')]},'userfield':{'type':Sequelize[_0x0914('0x2')]},'userDisposition':{'type':Sequelize[_0x0914('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x0914('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x0914('0x2')]},'note':{'type':Sequelize[_0x0914('0x2')]},'prefix':{'type':Sequelize[_0x0914('0x2')]},'routeid':{'type':Sequelize[_0x0914('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x831b=['outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x13c49e,_0x118ba2){var _0x383b91=function(_0x3826c3){while(--_0x3826c3){_0x13c49e['push'](_0x13c49e['shift']());}};_0x383b91(++_0x118ba2);}(_0x831b,0x160));var _0xb831=function(_0x4fa1b2,_0x4d1f9c){_0x4fa1b2=_0x4fa1b2-0x0;var _0x4c4c13=_0x831b[_0x4fa1b2];return _0x4c4c13;};'use strict';var Sequelize=require(_0xb831('0x0'));module[_0xb831('0x1')]={'uniqueid':{'type':Sequelize[_0xb831('0x2')]},'type':{'type':Sequelize[_0xb831('0x3')](_0xb831('0x4'),_0xb831('0x5'),_0xb831('0x6'),_0xb831('0x7'),_0xb831('0x8'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb831('0x2')]},'source':{'type':Sequelize[_0xb831('0x2')]},'destination':{'type':Sequelize[_0xb831('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb831('0x2')]},'channel':{'type':Sequelize[_0xb831('0x2')]},'destinationchannel':{'type':Sequelize[_0xb831('0x2')]},'lastapplication':{'type':Sequelize[_0xb831('0x2')]},'lastdata':{'type':Sequelize[_0xb831('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xb831('0xa')]},'answertime':{'type':Sequelize[_0xb831('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xb831('0xb')]},'billableseconds':{'type':Sequelize[_0xb831('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xb831('0x2')]},'userfield':{'type':Sequelize[_0xb831('0x2')]},'userDisposition':{'type':Sequelize[_0xb831('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xb831('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xb831('0x2')]},'note':{'type':Sequelize[_0xb831('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xb831('0xb')]},'sipcallid':{'type':Sequelize[_0xb831('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 70445ab..7a74fe5 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 _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(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0xadb5,0xad));var _0x5adb=function(_0x32049a,_0x1d8838){_0x32049a=_0x32049a-0x0;var _0xc657c0=_0xadb5[_0x32049a];return _0xc657c0;};'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 +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x2ef3,0xba));var _0x32ef=function(_0x938b09,_0x5924c5){_0x938b09=_0x938b09-0x0;var _0x467330=_0x2ef3[_0x938b09];return _0x467330;};'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['VoiceCallReport'][_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')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 187d044..95d1c90 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 _0x6bc9=['../../config/environment','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x26f444,_0x4cc2dc){var _0x2c1afa=function(_0x4b0781){while(--_0x4b0781){_0x26f444['push'](_0x26f444['shift']());}};_0x2c1afa(++_0x4cc2dc);}(_0x6bc9,0x1cc));var _0x96bc=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6bc9[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var logger=require(_0x96bc('0x2'))(_0x96bc('0x3'));var moment=require(_0x96bc('0x4'));var BPromise=require('bluebird');var rp=require(_0x96bc('0x5'));var fs=require('fs');var path=require(_0x96bc('0x6'));var rimraf=require(_0x96bc('0x7'));var config=require(_0x96bc('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x44bc83,_0x1b2f9c){return _0x44bc83[_0x96bc('0x9')](_0x96bc('0xa'),attributes,{'tableName':_0x96bc('0xb'),'paranoid':![],'indexes':[{'fields':[_0x96bc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e0d=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x5dcc6c,_0x55118c){var _0x465f31=function(_0x27a0a3){while(--_0x27a0a3){_0x5dcc6c['push'](_0x5dcc6c['shift']());}};_0x465f31(++_0x55118c);}(_0x9e0d,0x9b));var _0xd9e0=function(_0x301aa3,_0x464a2a){_0x301aa3=_0x301aa3-0x0;var _0x50bbcd=_0x9e0d[_0x301aa3];return _0x50bbcd;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var logger=require(_0xd9e0('0x2'))(_0xd9e0('0x3'));var moment=require(_0xd9e0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9e0('0x5'));var rimraf=require(_0xd9e0('0x6'));var config=require(_0xd9e0('0x7'));var attributes=require(_0xd9e0('0x8'));module['exports']=function(_0x2808e9,_0x36ad03){return _0x2808e9[_0xd9e0('0x9')](_0xd9e0('0xa'),attributes,{'tableName':_0xd9e0('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd9e0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c27903e..9d06361 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 _0x8758=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','map','model','attributes','CreateVoiceCallReport','create','raw','UpdateVoiceCallReport','update','body','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x8758,0x151));var _0x8875=function(_0x9e8f96,_0x4f83e8){_0x9e8f96=_0x9e8f96-0x0;var _0x45bed3=_0x8758[_0x9e8f96];return _0x45bed3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8875('0x0'));var rs=require(_0x8875('0x1'));var fs=require('fs');var Redis=require(_0x8875('0x2'));var db=require(_0x8875('0x3'))['db'];var utils=require(_0x8875('0x4'));var logger=require(_0x8875('0x5'))(_0x8875('0x6'));var config=require(_0x8875('0x7'));var jayson=require(_0x8875('0x8'));var client=jayson[_0x8875('0x9')][_0x8875('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1298cd,_0x5c9bbc,_0x4b0204){return new BPromise(function(_0x1d8a68,_0x8eadb2){return client['request'](_0x1298cd,_0x4b0204)[_0x8875('0xb')](function(_0x19ca7f){logger['info'](_0x8875('0xc'),_0x5c9bbc,_0x8875('0xd'));logger[_0x8875('0xe')](_0x8875('0xf'),_0x5c9bbc,_0x8875('0xd'),JSON[_0x8875('0x10')](_0x19ca7f));if(_0x19ca7f[_0x8875('0x11')]){if(_0x19ca7f[_0x8875('0x11')]['code']===0x1f4){logger[_0x8875('0x11')](_0x8875('0xc'),_0x5c9bbc,_0x19ca7f[_0x8875('0x11')][_0x8875('0x12')]);return _0x8eadb2(_0x19ca7f[_0x8875('0x11')][_0x8875('0x12')]);}logger[_0x8875('0x11')](_0x8875('0xc'),_0x5c9bbc,_0x19ca7f['error'][_0x8875('0x12')]);return _0x1d8a68(_0x19ca7f['error']['message']);}else{logger[_0x8875('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x5c9bbc,_0x8875('0xd'));_0x1d8a68(_0x19ca7f[_0x8875('0x14')]['message']);}})[_0x8875('0x15')](function(_0x531908){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5c9bbc,_0x531908);_0x8eadb2(_0x531908);});});}exports[_0x8875('0x16')]=function(_0x21538a){var _0x2b41be=this;return new Promise(function(_0x4444cf,_0x5f362c){return db[_0x8875('0x17')][_0x8875('0x18')]({'raw':_0x21538a['options']?_0x21538a['options']['raw']===undefined?!![]:![]:!![],'where':_0x21538a['options']?_0x21538a[_0x8875('0x19')][_0x8875('0x1a')]||null:null,'attributes':_0x21538a[_0x8875('0x19')]?_0x21538a[_0x8875('0x19')]['attributes']||null:null,'limit':_0x21538a['options']?_0x21538a[_0x8875('0x19')][_0x8875('0x1b')]||null:null,'include':_0x21538a['options']?_0x21538a['options'][_0x8875('0x1c')]?_[_0x8875('0x1d')](_0x21538a['options'][_0x8875('0x1c')],function(_0x227fa1){return{'model':db[_0x227fa1[_0x8875('0x1e')]],'as':_0x227fa1['as'],'attributes':_0x227fa1[_0x8875('0x1f')],'include':_0x227fa1[_0x8875('0x1c')]?_['map'](_0x227fa1[_0x8875('0x1c')],function(_0x51a9e9){return{'model':db[_0x51a9e9['model']],'as':_0x51a9e9['as'],'attributes':_0x51a9e9[_0x8875('0x1f')],'include':_0x51a9e9['include']?_[_0x8875('0x1d')](_0x51a9e9[_0x8875('0x1c')],function(_0x48d297){return{'model':db[_0x48d297[_0x8875('0x1e')]],'as':_0x48d297['as'],'attributes':_0x48d297[_0x8875('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8875('0xb')](function(_0x1b420d){logger[_0x8875('0x13')](_0x8875('0x16'),_0x21538a);logger[_0x8875('0xe')](_0x8875('0x16'),_0x21538a,JSON[_0x8875('0x10')](_0x1b420d));_0x4444cf(_0x1b420d);})['catch'](function(_0x5235cb){logger[_0x8875('0x11')](_0x8875('0x16'),_0x5235cb[_0x8875('0x12')],_0x21538a);_0x5f362c(_0x2b41be[_0x8875('0x11')](0x1f4,_0x5235cb[_0x8875('0x12')]));});});};exports[_0x8875('0x20')]=function(_0x5203e1){var _0x58021d=this;return new Promise(function(_0x194a7a,_0x476283){return db['VoiceCallReport'][_0x8875('0x21')](_0x5203e1['body'],{'raw':_0x5203e1[_0x8875('0x19')]?_0x5203e1[_0x8875('0x19')][_0x8875('0x22')]===undefined?!![]:![]:!![]})[_0x8875('0xb')](function(_0x2a0205){logger[_0x8875('0x13')](_0x8875('0x20'),_0x5203e1);logger[_0x8875('0xe')](_0x8875('0x20'),_0x5203e1,JSON['stringify'](_0x2a0205));_0x194a7a(_0x2a0205);})[_0x8875('0x15')](function(_0x23c70f){logger[_0x8875('0x11')](_0x8875('0x20'),_0x23c70f[_0x8875('0x12')],_0x5203e1);_0x476283(_0x58021d[_0x8875('0x11')](0x1f4,_0x23c70f[_0x8875('0x12')]));});});};exports[_0x8875('0x23')]=function(_0x4d65d0){var _0x5f274c=this;return new Promise(function(_0x248783,_0x57c587){return db[_0x8875('0x17')][_0x8875('0x24')](_0x4d65d0[_0x8875('0x25')],{'raw':_0x4d65d0[_0x8875('0x19')]?_0x4d65d0[_0x8875('0x19')][_0x8875('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d65d0[_0x8875('0x19')]?_0x4d65d0['options'][_0x8875('0x1a')]||null:null,'attributes':_0x4d65d0[_0x8875('0x19')]?_0x4d65d0[_0x8875('0x19')][_0x8875('0x1f')]||null:null,'limit':_0x4d65d0[_0x8875('0x19')]?_0x4d65d0[_0x8875('0x19')][_0x8875('0x1b')]||null:null})['then'](function(_0x38e7a4){logger[_0x8875('0x13')](_0x8875('0x23'),_0x4d65d0);logger[_0x8875('0xe')](_0x8875('0x23'),_0x4d65d0,JSON['stringify'](_0x38e7a4));_0x248783(_0x38e7a4);})['catch'](function(_0xc54905){logger[_0x8875('0x11')](_0x8875('0x23'),_0xc54905[_0x8875('0x12')],_0x4d65d0);_0x57c587(_0x5f274c[_0x8875('0x11')](0x1f4,_0xc54905[_0x8875('0x12')]));});});}; \ No newline at end of file +var _0x0a6b=['attributes','limit','include','model','then','debug','stringify','catch','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where'];(function(_0x2cb1bd,_0x42b64c){var _0x393fdf=function(_0x532988){while(--_0x532988){_0x2cb1bd['push'](_0x2cb1bd['shift']());}};_0x393fdf(++_0x42b64c);}(_0x0a6b,0x18e));var _0xb0a6=function(_0xecd8a2,_0x1fb96b){_0xecd8a2=_0xecd8a2-0x0;var _0x1c9756=_0x0a6b[_0xecd8a2];return _0x1c9756;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('VoiceCallReport,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});}exports[_0xb0a6('0x10')]=function(_0x18f994){var _0x10f504=this;return new Promise(function(_0x13a1c8,_0x567dd5){return db[_0xb0a6('0x11')][_0xb0a6('0x12')]({'raw':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x15')]||null:null,'attributes':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'limit':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x17')]||null:null,'include':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x18')]?_['map'](_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4997df){return{'model':db[_0x4997df['model']],'as':_0x4997df['as'],'attributes':_0x4997df[_0xb0a6('0x16')],'include':_0x4997df[_0xb0a6('0x18')]?_['map'](_0x4997df[_0xb0a6('0x18')],function(_0x24574a){return{'model':db[_0x24574a[_0xb0a6('0x19')]],'as':_0x24574a['as'],'attributes':_0x24574a[_0xb0a6('0x16')],'include':_0x24574a['include']?_['map'](_0x24574a[_0xb0a6('0x18')],function(_0x1e9947){return{'model':db[_0x1e9947[_0xb0a6('0x19')]],'as':_0x1e9947['as'],'attributes':_0x1e9947['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x3347ac){logger[_0xb0a6('0x8')](_0xb0a6('0x10'),_0x18f994);logger[_0xb0a6('0x1b')](_0xb0a6('0x10'),_0x18f994,JSON[_0xb0a6('0x1c')](_0x3347ac));_0x13a1c8(_0x3347ac);})[_0xb0a6('0x1d')](function(_0x4255b9){logger['error'](_0xb0a6('0x10'),_0x4255b9[_0xb0a6('0xe')],_0x18f994);_0x567dd5(_0x10f504[_0xb0a6('0xc')](0x1f4,_0x4255b9['message']));});});};exports[_0xb0a6('0x1e')]=function(_0x582fc2){var _0x131e46=this;return new Promise(function(_0x309a91,_0x114f91){return db[_0xb0a6('0x11')][_0xb0a6('0x1f')](_0x582fc2[_0xb0a6('0x20')],{'raw':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![]})[_0xb0a6('0x1a')](function(_0x481067){logger['info'](_0xb0a6('0x1e'),_0x582fc2);logger[_0xb0a6('0x1b')](_0xb0a6('0x1e'),_0x582fc2,JSON[_0xb0a6('0x1c')](_0x481067));_0x309a91(_0x481067);})[_0xb0a6('0x1d')](function(_0x3bc0a4){logger[_0xb0a6('0xc')](_0xb0a6('0x1e'),_0x3bc0a4['message'],_0x582fc2);_0x114f91(_0x131e46[_0xb0a6('0xc')](0x1f4,_0x3bc0a4[_0xb0a6('0xe')]));});});};exports['UpdateVoiceCallReport']=function(_0x8502f8){var _0x88f3b1=this;return new Promise(function(_0x52e397,_0x5a4de3){return db[_0xb0a6('0x11')][_0xb0a6('0x21')](_0x8502f8[_0xb0a6('0x20')],{'raw':_0x8502f8[_0xb0a6('0x13')]?_0x8502f8[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8502f8['options']?_0x8502f8[_0xb0a6('0x13')]['where']||null:null,'attributes':_0x8502f8[_0xb0a6('0x13')]?_0x8502f8[_0xb0a6('0x13')]['attributes']||null:null,'limit':_0x8502f8['options']?_0x8502f8['options'][_0xb0a6('0x17')]||null:null})[_0xb0a6('0x1a')](function(_0xa9e807){logger[_0xb0a6('0x8')](_0xb0a6('0x22'),_0x8502f8);logger['debug'](_0xb0a6('0x22'),_0x8502f8,JSON[_0xb0a6('0x1c')](_0xa9e807));_0x52e397(_0xa9e807);})[_0xb0a6('0x1d')](function(_0x362752){logger['error'](_0xb0a6('0x22'),_0x362752[_0xb0a6('0xe')],_0x8502f8);_0x5a4de3(_0x88f3b1[_0xb0a6('0xc')](0x1f4,_0x362752[_0xb0a6('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index da0df79..9c40efa 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 _0x351f=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x214a14,_0xd2ff16){var _0x4c2e6c=function(_0x2a42d4){while(--_0x2a42d4){_0x214a14['push'](_0x214a14['shift']());}};_0x4c2e6c(++_0xd2ff16);}(_0x351f,0x16a));var _0xf351=function(_0x3f93b8,_0x5112e0){_0x3f93b8=_0x3f93b8-0x0;var _0x523876=_0x351f[_0x3f93b8];return _0x523876;};'use strict';var multer=require(_0xf351('0x0'));var util=require(_0xf351('0x1'));var path=require(_0xf351('0x2'));var timeout=require('connect-timeout');var express=require(_0xf351('0x3'));var router=express[_0xf351('0x4')]();var fs_extra=require(_0xf351('0x5'));var auth=require(_0xf351('0x6'));var interaction=require(_0xf351('0x7'));var config=require(_0xf351('0x8'));var controller=require(_0xf351('0x9'));router[_0xf351('0xa')]('/',auth[_0xf351('0xb')](),controller[_0xf351('0xc')]);router[_0xf351('0xa')](_0xf351('0xd'),auth[_0xf351('0xb')](),controller[_0xf351('0xe')]);router['post']('/',auth[_0xf351('0xb')](),controller[_0xf351('0xf')]);router[_0xf351('0x10')](_0xf351('0xd'),auth[_0xf351('0xb')](),controller[_0xf351('0x11')]);router[_0xf351('0x12')](_0xf351('0xd'),auth['isAuthenticated'](),controller[_0xf351('0x13')]);module[_0xf351('0x14')]=router; \ No newline at end of file +var _0x82e3=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','delete','destroy','util'];(function(_0x660c3b,_0x3c9ff2){var _0x36977d=function(_0x3c5796){while(--_0x3c5796){_0x660c3b['push'](_0x660c3b['shift']());}};_0x36977d(++_0x3c9ff2);}(_0x82e3,0xc2));var _0x382e=function(_0x19ec7c,_0x5765f1){_0x19ec7c=_0x19ec7c-0x0;var _0x435150=_0x82e3[_0x19ec7c];return _0x435150;};'use strict';var multer=require('multer');var util=require(_0x382e('0x0'));var path=require(_0x382e('0x1'));var timeout=require(_0x382e('0x2'));var express=require('express');var router=express[_0x382e('0x3')]();var fs_extra=require(_0x382e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x382e('0x5'));var config=require(_0x382e('0x6'));var controller=require(_0x382e('0x7'));router[_0x382e('0x8')]('/',auth[_0x382e('0x9')](),controller[_0x382e('0xa')]);router[_0x382e('0x8')](_0x382e('0xb'),auth[_0x382e('0x9')](),controller[_0x382e('0xc')]);router['post']('/',auth[_0x382e('0x9')](),controller['create']);router['put']('/:id',auth[_0x382e('0x9')](),controller['update']);router[_0x382e('0xd')](_0x382e('0xb'),auth[_0x382e('0x9')](),controller[_0x382e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a6d3378..5818e9f 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 _0xef20=['join','options','getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xef20,0x191));var _0x0ef2=function(_0x36b611,_0x307a18){_0x36b611=_0x36b611-0x0;var _0x18e148=_0xef20[_0x36b611];return _0x18e148;};'use strict';var Sequelize=require(_0x0ef2('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ef2('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x0ef2('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x0ef2('0x1')],'set':function(_0x2651fe){this[_0x0ef2('0x3')]('options',_0x2651fe?_0x2651fe[_0x0ef2('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x0ef2('0x5'))?this[_0x0ef2('0x6')](_0x0ef2('0x5'))[_0x0ef2('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0ef2('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x0ef2('0x1')]},'record':{'type':Sequelize[_0x0ef2('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0ef2('0x1')]},'description':{'type':Sequelize[_0x0ef2('0x1')]}}; \ No newline at end of file +var _0x7a11=['exports','name','STRING','setDataValue','options','getDataValue','split','BOOLEAN','sequelize'];(function(_0x35590f,_0x4d1750){var _0x1e41c7=function(_0x189bdb){while(--_0x189bdb){_0x35590f['push'](_0x35590f['shift']());}};_0x1e41c7(++_0x4d1750);}(_0x7a11,0x1c1));var _0x17a1=function(_0x101ba9,_0x377658){_0x101ba9=_0x101ba9-0x0;var _0x5dcebc=_0x7a11[_0x101ba9];return _0x5dcebc;};'use strict';var Sequelize=require(_0x17a1('0x0'));module[_0x17a1('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x17a1('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x17a1('0x3')],'set':function(_0x1a16f6){this[_0x17a1('0x4')](_0x17a1('0x5'),_0x1a16f6?_0x1a16f6['join'](''):[]);},'get':function(){return this[_0x17a1('0x6')](_0x17a1('0x5'))?this['getDataValue'](_0x17a1('0x5'))[_0x17a1('0x7')](''):[];}},'auth':{'type':Sequelize[_0x17a1('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x17a1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x17a1('0x3')]},'description':{'type':Sequelize[_0x17a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 4c9db63..604d2b3 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 _0x32c0=['model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','options','include','findAll','catch','params','intersection','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key'];(function(_0x3d53da,_0x3f0d17){var _0x153388=function(_0x3b9a30){while(--_0x3b9a30){_0x3d53da['push'](_0x3d53da['shift']());}};_0x153388(++_0x3f0d17);}(_0x32c0,0x1f3));var _0x032c=function(_0x12b1f8,_0xf1ef6e){_0x12b1f8=_0x12b1f8-0x0;var _0x53ae5d=_0x32c0[_0x12b1f8];return _0x53ae5d;};'use strict';var emlformat=require(_0x032c('0x0'));var rimraf=require(_0x032c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x032c('0x2'));var rp=require(_0x032c('0x3'));var moment=require('moment');var BPromise=require(_0x032c('0x4'));var Mustache=require(_0x032c('0x5'));var util=require(_0x032c('0x6'));var path=require(_0x032c('0x7'));var sox=require('sox');var csv=require(_0x032c('0x8'));var ejs=require(_0x032c('0x9'));var fs=require('fs');var fs_extra=require(_0x032c('0xa'));var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var licenseUtil=require(_0x032c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25af77,_0xc88e78){_0xc88e78=_0xc88e78||0xcc;return function(_0x364605){if(_0x364605){return _0x25af77[_0x032c('0x16')](_0xc88e78);}return _0x25af77['status'](_0xc88e78)[_0x032c('0x17')]();};}function respondWithResult(_0x2650d6,_0x1ec9d8){_0x1ec9d8=_0x1ec9d8||0xc8;return function(_0x216984){if(_0x216984){return _0x2650d6[_0x032c('0x18')](_0x1ec9d8)[_0x032c('0x19')](_0x216984);}};}function respondWithFilteredResult(_0x51266f,_0xb678d5){return function(_0x15ddb8){if(_0x15ddb8){var _0x3ebda8=typeof _0xb678d5[_0x032c('0x1a')]===_0x032c('0x1b')&&typeof _0xb678d5[_0x032c('0x1c')]==='undefined';var _0x1444bb=_0x15ddb8[_0x032c('0x1d')];var _0x4435ad=_0x3ebda8?0x0:_0xb678d5[_0x032c('0x1a')];var _0x2b2693=_0x3ebda8?_0x15ddb8[_0x032c('0x1d')]:_0xb678d5[_0x032c('0x1a')]+_0xb678d5[_0x032c('0x1c')];var _0x3a6f71;if(_0x2b2693>=_0x1444bb){_0x2b2693=_0x1444bb;_0x3a6f71=0xc8;}else{_0x3a6f71=0xce;}_0x51266f[_0x032c('0x18')](_0x3a6f71);return _0x51266f[_0x032c('0x1e')](_0x032c('0x1f'),_0x4435ad+'-'+_0x2b2693+'/'+_0x1444bb)[_0x032c('0x19')](_0x15ddb8);}return null;};}function patchUpdates(_0x515409){return function(_0x8a8f30){try{jsonpatch['apply'](_0x8a8f30,_0x515409,!![]);}catch(_0x5341e6){return BPromise['reject'](_0x5341e6);}return _0x8a8f30['save']();};}function saveUpdates(_0x2a24f7,_0x4c0c4b){return function(_0x2ce758){if(_0x2ce758){return _0x2ce758[_0x032c('0x20')](_0x2a24f7)[_0x032c('0x21')](function(_0x51ad8c){return _0x51ad8c;});}return null;};}function removeEntity(_0x135612,_0x16d40f){return function(_0x28ae24){if(_0x28ae24){return _0x28ae24[_0x032c('0x22')]()[_0x032c('0x21')](function(){var _0x54a46=_0x28ae24[_0x032c('0x23')]({'plain':!![]});var _0x58894b=_0x032c('0x24');return db[_0x032c('0x25')][_0x032c('0x22')]({'where':{'type':_0x58894b,'resourceId':_0x54a46['id']}})['then'](function(){return _0x28ae24;});})[_0x032c('0x21')](function(){_0x135612[_0x032c('0x18')](0xcc)[_0x032c('0x17')]();});}};}function handleEntityNotFound(_0x12e3df,_0x58de77){return function(_0x37a292){if(!_0x37a292){_0x12e3df[_0x032c('0x16')](0x194);}return _0x37a292;};}function handleError(_0x1a38e1,_0x3403b3){_0x3403b3=_0x3403b3||0x1f4;return function(_0x51d679){logger[_0x032c('0x26')](_0x51d679[_0x032c('0x27')]);if(_0x51d679[_0x032c('0x28')]){delete _0x51d679[_0x032c('0x28')];}_0x1a38e1[_0x032c('0x18')](_0x3403b3)[_0x032c('0x29')](_0x51d679);};}exports[_0x032c('0x2a')]=function(_0x5a2297,_0x50a3f8){var _0x3e99b1={},_0x5d0503={},_0x6f72ba={'count':0x0,'rows':[]};var _0x3bb5e3=_['map'](db[_0x032c('0x2b')][_0x032c('0x2c')],function(_0x3488f1){return{'name':_0x3488f1[_0x032c('0x2d')],'type':_0x3488f1['type'][_0x032c('0x2e')]};});_0x5d0503[_0x032c('0x2f')]=_['map'](_0x3bb5e3,_0x032c('0x28'));_0x5d0503[_0x032c('0x30')]=_[_0x032c('0x31')](_0x5a2297[_0x032c('0x30')]);_0x5d0503[_0x032c('0x32')]=_['intersection'](_0x5d0503[_0x032c('0x2f')],_0x5d0503['query']);_0x3e99b1[_0x032c('0x33')]=_['intersection'](_0x5d0503[_0x032c('0x2f')],qs[_0x032c('0x34')](_0x5a2297[_0x032c('0x30')][_0x032c('0x34')]));_0x3e99b1[_0x032c('0x33')]=_0x3e99b1[_0x032c('0x33')]['length']?_0x3e99b1[_0x032c('0x33')]:_0x5d0503[_0x032c('0x2f')];if(!_0x5a2297['query'][_0x032c('0x35')](_0x032c('0x36'))){_0x3e99b1[_0x032c('0x1c')]=qs['limit'](_0x5a2297[_0x032c('0x30')][_0x032c('0x1c')]);_0x3e99b1[_0x032c('0x1a')]=qs[_0x032c('0x1a')](_0x5a2297[_0x032c('0x30')][_0x032c('0x1a')]);}_0x3e99b1[_0x032c('0x37')]=qs['sort'](_0x5a2297[_0x032c('0x30')][_0x032c('0x38')]);_0x3e99b1[_0x032c('0x39')]=qs[_0x032c('0x32')](_[_0x032c('0x3a')](_0x5a2297[_0x032c('0x30')],_0x5d0503[_0x032c('0x32')]),_0x3bb5e3);if(_0x5a2297[_0x032c('0x30')]['filter']){_0x3e99b1[_0x032c('0x39')]=_['merge'](_0x3e99b1[_0x032c('0x39')],{'$or':_['map'](_0x3bb5e3,function(_0x5f1881){if(_0x5f1881[_0x032c('0x3b')]!==_0x032c('0x3c')){var _0x5ef439={};_0x5ef439[_0x5f1881['name']]={'$like':'%'+_0x5a2297[_0x032c('0x30')]['filter']+'%'};return _0x5ef439;}})});}_0x3e99b1=_['merge']({},_0x3e99b1,_0x5a2297[_0x032c('0x3d')]);var _0x6a9676={'where':_0x3e99b1[_0x032c('0x39')]};return db[_0x032c('0x2b')][_0x032c('0x1d')](_0x6a9676)[_0x032c('0x21')](function(_0x49b83a){_0x6f72ba[_0x032c('0x1d')]=_0x49b83a;if(_0x5a2297['query']['includeAll']){_0x3e99b1[_0x032c('0x3e')]=[{'all':!![]}];}return db[_0x032c('0x2b')][_0x032c('0x3f')](_0x3e99b1);})[_0x032c('0x21')](function(_0x47360a){_0x6f72ba['rows']=_0x47360a;return _0x6f72ba;})['then'](respondWithFilteredResult(_0x50a3f8,_0x3e99b1))[_0x032c('0x40')](handleError(_0x50a3f8,null));};exports['show']=function(_0x3ed5c9,_0x43ba20){var _0x3f3891={'raw':![],'where':{'id':_0x3ed5c9[_0x032c('0x41')]['id']}},_0x2e2df8={};_0x2e2df8[_0x032c('0x2f')]=_[_0x032c('0x31')](db[_0x032c('0x2b')][_0x032c('0x2c')]);_0x2e2df8['query']=_[_0x032c('0x31')](_0x3ed5c9['query']);_0x2e2df8['filters']=_[_0x032c('0x42')](_0x2e2df8[_0x032c('0x2f')],_0x2e2df8[_0x032c('0x30')]);_0x3f3891[_0x032c('0x33')]=_[_0x032c('0x42')](_0x2e2df8['model'],qs['fields'](_0x3ed5c9['query'][_0x032c('0x34')]));_0x3f3891['attributes']=_0x3f3891[_0x032c('0x33')][_0x032c('0x43')]?_0x3f3891['attributes']:_0x2e2df8[_0x032c('0x2f')];if(_0x3ed5c9[_0x032c('0x30')][_0x032c('0x44')]){_0x3f3891[_0x032c('0x3e')]=[{'all':!![]}];}_0x3f3891=_[_0x032c('0x45')]({},_0x3f3891,_0x3ed5c9[_0x032c('0x3d')]);return db[_0x032c('0x2b')][_0x032c('0x46')](_0x3f3891)[_0x032c('0x21')](handleEntityNotFound(_0x43ba20,null))['then'](respondWithResult(_0x43ba20,null))[_0x032c('0x40')](handleError(_0x43ba20,null));};exports['create']=function(_0x367638,_0x13f1a7){return db[_0x032c('0x2b')][_0x032c('0x47')](_0x367638[_0x032c('0x48')],{})[_0x032c('0x21')](function(_0x1eed24){var _0x110a5f=_0x367638[_0x032c('0x49')]['get']({'plain':!![]});if(!_0x110a5f)throw new Error(_0x032c('0x4a'));if(_0x110a5f['role']===_0x032c('0x49')){var _0x2f1032=_0x1eed24['get']({'plain':!![]});var _0x3fd7dc=_0x032c('0x24');return db['UserProfileSection'][_0x032c('0x46')]({'where':{'name':_0x3fd7dc,'userProfileId':_0x110a5f[_0x032c('0x4b')]},'raw':!![]})[_0x032c('0x21')](function(_0x4ff7f7){if(_0x4ff7f7&&_0x4ff7f7[_0x032c('0x4c')]===0x0){return db[_0x032c('0x25')][_0x032c('0x47')]({'name':_0x2f1032[_0x032c('0x28')],'resourceId':_0x2f1032['id'],'type':_0x4ff7f7[_0x032c('0x28')],'sectionId':_0x4ff7f7['id']},{})[_0x032c('0x21')](function(){return _0x1eed24;});}else{return _0x1eed24;}})[_0x032c('0x40')](function(_0x3d6749){logger[_0x032c('0x26')](_0x032c('0x4d'),_0x3d6749);throw _0x3d6749;});}return _0x1eed24;})['then'](respondWithResult(_0x13f1a7,0xc9))[_0x032c('0x40')](handleError(_0x13f1a7,null));};exports[_0x032c('0x20')]=function(_0x28bb7c,_0x100d0b){if(_0x28bb7c[_0x032c('0x48')]['id']){delete _0x28bb7c[_0x032c('0x48')]['id'];}return db[_0x032c('0x2b')][_0x032c('0x46')]({'where':{'id':_0x28bb7c['params']['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x100d0b,null))[_0x032c('0x21')](saveUpdates(_0x28bb7c[_0x032c('0x48')],null))[_0x032c('0x21')](respondWithResult(_0x100d0b,null))[_0x032c('0x40')](handleError(_0x100d0b,null));};exports['destroy']=function(_0x3ca559,_0x157324){return db[_0x032c('0x2b')][_0x032c('0x46')]({'where':{'id':_0x3ca559[_0x032c('0x41')]['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x157324,null))[_0x032c('0x21')](removeEntity(_0x157324,null))[_0x032c('0x40')](handleError(_0x157324,null));}; \ No newline at end of file +var _0x9434=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x1dddb3,_0x4bfa0d){var _0x4ef7cd=function(_0x250c8d){while(--_0x250c8d){_0x1dddb3['push'](_0x1dddb3['shift']());}};_0x4ef7cd(++_0x4bfa0d);}(_0x9434,0x168));var _0x4943=function(_0x5a20e3,_0x15ec4a){_0x5a20e3=_0x5a20e3-0x0;var _0x231f30=_0x9434[_0x5a20e3];return _0x231f30;};'use strict';var emlformat=require(_0x4943('0x0'));var rimraf=require(_0x4943('0x1'));var zipdir=require(_0x4943('0x2'));var jsonpatch=require(_0x4943('0x3'));var rp=require(_0x4943('0x4'));var moment=require(_0x4943('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4943('0x6'));var util=require(_0x4943('0x7'));var path=require('path');var sox=require(_0x4943('0x8'));var csv=require(_0x4943('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4943('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0x9'));var querystring=require(_0x4943('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0xf'));var qs=require(_0x4943('0x10'));var as=require(_0x4943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x12'))(_0x4943('0x13'));var utils=require('../../config/utils');var config=require(_0x4943('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x943461,_0x1e95be){_0x1e95be=_0x1e95be||0xcc;return function(_0x33fd73){if(_0x33fd73){return _0x943461[_0x4943('0x15')](_0x1e95be);}return _0x943461[_0x4943('0x16')](_0x1e95be)[_0x4943('0x17')]();};}function respondWithResult(_0x4077f1,_0x524c8a){_0x524c8a=_0x524c8a||0xc8;return function(_0x902712){if(_0x902712){return _0x4077f1[_0x4943('0x16')](_0x524c8a)[_0x4943('0x18')](_0x902712);}};}function respondWithFilteredResult(_0x13d758,_0x37c843){return function(_0x39b4e3){if(_0x39b4e3){var _0x4b075e=typeof _0x37c843[_0x4943('0x19')]===_0x4943('0x1a')&&typeof _0x37c843[_0x4943('0x1b')]==='undefined';var _0x53377c=_0x39b4e3[_0x4943('0x1c')];var _0x4cba96=_0x4b075e?0x0:_0x37c843[_0x4943('0x19')];var _0x33b2d0=_0x4b075e?_0x39b4e3['count']:_0x37c843[_0x4943('0x19')]+_0x37c843[_0x4943('0x1b')];var _0x38749b;if(_0x33b2d0>=_0x53377c){_0x33b2d0=_0x53377c;_0x38749b=0xc8;}else{_0x38749b=0xce;}_0x13d758['status'](_0x38749b);return _0x13d758[_0x4943('0x1d')]('Content-Range',_0x4cba96+'-'+_0x33b2d0+'/'+_0x53377c)[_0x4943('0x18')](_0x39b4e3);}return null;};}function patchUpdates(_0x52fa3b){return function(_0x258079){try{jsonpatch[_0x4943('0x1e')](_0x258079,_0x52fa3b,!![]);}catch(_0x278569){return BPromise[_0x4943('0x1f')](_0x278569);}return _0x258079['save']();};}function saveUpdates(_0x1ceb6f,_0x205eb2){return function(_0x34e322){if(_0x34e322){return _0x34e322[_0x4943('0x20')](_0x1ceb6f)[_0x4943('0x21')](function(_0xd88a73){return _0xd88a73;});}return null;};}function removeEntity(_0x793d18,_0x340077){return function(_0x5dd061){if(_0x5dd061){return _0x5dd061['destroy']()[_0x4943('0x21')](function(){var _0x127a53=_0x5dd061[_0x4943('0x22')]({'plain':!![]});var _0x5d8cbe=_0x4943('0x23');return db[_0x4943('0x24')]['destroy']({'where':{'type':_0x5d8cbe,'resourceId':_0x127a53['id']}})[_0x4943('0x21')](function(){return _0x5dd061;});})[_0x4943('0x21')](function(){_0x793d18[_0x4943('0x16')](0xcc)[_0x4943('0x17')]();});}};}function handleEntityNotFound(_0x35f393,_0x16eba6){return function(_0x307478){if(!_0x307478){_0x35f393[_0x4943('0x15')](0x194);}return _0x307478;};}function handleError(_0x3c1c15,_0x3443ca){_0x3443ca=_0x3443ca||0x1f4;return function(_0x170e78){logger[_0x4943('0x25')](_0x170e78[_0x4943('0x26')]);if(_0x170e78[_0x4943('0x27')]){delete _0x170e78[_0x4943('0x27')];}_0x3c1c15[_0x4943('0x16')](_0x3443ca)[_0x4943('0x28')](_0x170e78);};}exports[_0x4943('0x29')]=function(_0x5d792c,_0x43b11f){var _0x5e2e4f={},_0x18b22a={},_0x36999c={'count':0x0,'rows':[]};var _0x2957d2=_[_0x4943('0x2a')](db[_0x4943('0x2b')][_0x4943('0x2c')],function(_0x3dd058){return{'name':_0x3dd058[_0x4943('0x2d')],'type':_0x3dd058['type'][_0x4943('0x2e')]};});_0x18b22a[_0x4943('0x2f')]=_['map'](_0x2957d2,_0x4943('0x27'));_0x18b22a[_0x4943('0x30')]=_['keys'](_0x5d792c[_0x4943('0x30')]);_0x18b22a[_0x4943('0x31')]=_[_0x4943('0x32')](_0x18b22a['model'],_0x18b22a[_0x4943('0x30')]);_0x5e2e4f[_0x4943('0x33')]=_[_0x4943('0x32')](_0x18b22a[_0x4943('0x2f')],qs[_0x4943('0x34')](_0x5d792c['query'][_0x4943('0x34')]));_0x5e2e4f[_0x4943('0x33')]=_0x5e2e4f[_0x4943('0x33')][_0x4943('0x35')]?_0x5e2e4f[_0x4943('0x33')]:_0x18b22a[_0x4943('0x2f')];if(!_0x5d792c[_0x4943('0x30')][_0x4943('0x36')](_0x4943('0x37'))){_0x5e2e4f[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x5d792c['query'][_0x4943('0x1b')]);_0x5e2e4f[_0x4943('0x19')]=qs[_0x4943('0x19')](_0x5d792c[_0x4943('0x30')][_0x4943('0x19')]);}_0x5e2e4f['order']=qs['sort'](_0x5d792c['query'][_0x4943('0x38')]);_0x5e2e4f[_0x4943('0x39')]=qs['filters'](_[_0x4943('0x3a')](_0x5d792c['query'],_0x18b22a[_0x4943('0x31')]),_0x2957d2);if(_0x5d792c[_0x4943('0x30')][_0x4943('0x3b')]){_0x5e2e4f[_0x4943('0x39')]=_[_0x4943('0x3c')](_0x5e2e4f[_0x4943('0x39')],{'$or':_[_0x4943('0x2a')](_0x2957d2,function(_0x86a31c){if(_0x86a31c[_0x4943('0x3d')]!==_0x4943('0x3e')){var _0x25d36e={};_0x25d36e[_0x86a31c[_0x4943('0x27')]]={'$like':'%'+_0x5d792c[_0x4943('0x30')][_0x4943('0x3b')]+'%'};return _0x25d36e;}})});}_0x5e2e4f=_[_0x4943('0x3c')]({},_0x5e2e4f,_0x5d792c[_0x4943('0x3f')]);var _0xbe0e00={'where':_0x5e2e4f[_0x4943('0x39')]};return db[_0x4943('0x2b')][_0x4943('0x1c')](_0xbe0e00)[_0x4943('0x21')](function(_0x11ee4a){_0x36999c[_0x4943('0x1c')]=_0x11ee4a;if(_0x5d792c[_0x4943('0x30')][_0x4943('0x40')]){_0x5e2e4f[_0x4943('0x41')]=[{'all':!![]}];}return db[_0x4943('0x2b')]['findAll'](_0x5e2e4f);})[_0x4943('0x21')](function(_0x147179){_0x36999c['rows']=_0x147179;return _0x36999c;})['then'](respondWithFilteredResult(_0x43b11f,_0x5e2e4f))[_0x4943('0x42')](handleError(_0x43b11f,null));};exports['show']=function(_0x1479a7,_0x498a5e){var _0xe11bdf={'raw':![],'where':{'id':_0x1479a7[_0x4943('0x43')]['id']}},_0x54db13={};_0x54db13['model']=_[_0x4943('0x44')](db[_0x4943('0x2b')][_0x4943('0x2c')]);_0x54db13['query']=_['keys'](_0x1479a7[_0x4943('0x30')]);_0x54db13['filters']=_[_0x4943('0x32')](_0x54db13['model'],_0x54db13[_0x4943('0x30')]);_0xe11bdf[_0x4943('0x33')]=_[_0x4943('0x32')](_0x54db13[_0x4943('0x2f')],qs['fields'](_0x1479a7['query'][_0x4943('0x34')]));_0xe11bdf['attributes']=_0xe11bdf['attributes'][_0x4943('0x35')]?_0xe11bdf[_0x4943('0x33')]:_0x54db13[_0x4943('0x2f')];if(_0x1479a7[_0x4943('0x30')][_0x4943('0x40')]){_0xe11bdf[_0x4943('0x41')]=[{'all':!![]}];}_0xe11bdf=_[_0x4943('0x3c')]({},_0xe11bdf,_0x1479a7['options']);return db[_0x4943('0x2b')][_0x4943('0x45')](_0xe11bdf)['then'](handleEntityNotFound(_0x498a5e,null))[_0x4943('0x21')](respondWithResult(_0x498a5e,null))[_0x4943('0x42')](handleError(_0x498a5e,null));};exports[_0x4943('0x46')]=function(_0x4d1a31,_0x350f55){return db[_0x4943('0x2b')]['create'](_0x4d1a31[_0x4943('0x47')],{})[_0x4943('0x21')](function(_0x5d0b9b){var _0x445908=_0x4d1a31[_0x4943('0x48')][_0x4943('0x22')]({'plain':!![]});if(!_0x445908)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x445908[_0x4943('0x49')]==='user'){var _0x51636a=_0x5d0b9b[_0x4943('0x22')]({'plain':!![]});var _0x33a332=_0x4943('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x33a332,'userProfileId':_0x445908['userProfileId']},'raw':!![]})[_0x4943('0x21')](function(_0x49fbfb){if(_0x49fbfb&&_0x49fbfb['autoAssociation']===0x0){return db[_0x4943('0x24')]['create']({'name':_0x51636a['name'],'resourceId':_0x51636a['id'],'type':_0x49fbfb['name'],'sectionId':_0x49fbfb['id']},{})[_0x4943('0x21')](function(){return _0x5d0b9b;});}else{return _0x5d0b9b;}})[_0x4943('0x42')](function(_0x24288a){logger['error'](_0x4943('0x4a'),_0x24288a);throw _0x24288a;});}return _0x5d0b9b;})[_0x4943('0x21')](respondWithResult(_0x350f55,0xc9))[_0x4943('0x42')](handleError(_0x350f55,null));};exports['update']=function(_0x17f132,_0x44bcae){if(_0x17f132['body']['id']){delete _0x17f132['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x17f132[_0x4943('0x43')]['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x44bcae,null))[_0x4943('0x21')](saveUpdates(_0x17f132[_0x4943('0x47')],null))['then'](respondWithResult(_0x44bcae,null))[_0x4943('0x42')](handleError(_0x44bcae,null));};exports['destroy']=function(_0x574e4b,_0x22cda5){return db[_0x4943('0x2b')][_0x4943('0x45')]({'where':{'id':_0x574e4b['params']['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x22cda5,null))[_0x4943('0x21')](removeEntity(_0x22cda5,null))[_0x4943('0x42')](handleError(_0x22cda5,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 660c40c..d345ef2 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 _0xa3c1=['length','concat','internal','findAll','agent','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','prefix','system','merge','Set','CDR(type)=%s','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','SIP/%s,%s','name','options','join','record','StopMixMonitor'];(function(_0x38c908,_0x5b07c4){var _0x4f6ffd=function(_0x317c89){while(--_0x317c89){_0x38c908['push'](_0x38c908['shift']());}};_0x4f6ffd(++_0x5b07c4);}(_0xa3c1,0xa2));var _0x1a3c=function(_0x237e70,_0x217052){_0x237e70=_0x237e70-0x0;var _0x5d93e6=_0xa3c1[_0x237e70];return _0x5d93e6;};'use strict';var _=require(_0x1a3c('0x0'));var util=require(_0x1a3c('0x1'));var BPromise=require(_0x1a3c('0x2'));var attributes=require(_0x1a3c('0x3'));var getUserApplications=function(_0x32295c,_0x5c38d6,_0xf6f70b){var _0x222047=0x1;var _0x51dbaf=[];var _0x19da88={'context':_0x5c38d6[_0x1a3c('0x4')]||'from-sip','exten':util[_0x1a3c('0x5')]('%s%s',_0x32295c[_0x1a3c('0x6')],_0xf6f70b),'type':_0x1a3c('0x7'),'isApp':![],'ChanSpyId':_0x32295c['id'],'UserId':_0x5c38d6['id']};_0x51dbaf['push'](_[_0x1a3c('0x8')]({'app':_0x1a3c('0x9'),'appdata':util[_0x1a3c('0x5')](_0x1a3c('0xa'),'chanspy'),'priority':_0x222047++},_0x19da88));if(_0x32295c['record']){_0x51dbaf[_0x1a3c('0xb')](_[_0x1a3c('0x8')]({'app':_0x1a3c('0xc'),'appdata':util['format'](_0x1a3c('0xd'),_0x32295c[_0x1a3c('0xe')]),'priority':_0x222047++},_0x19da88));}if(_0x32295c[_0x1a3c('0xf')]){_0x51dbaf[_0x1a3c('0xb')](_[_0x1a3c('0x8')]({'app':'Authenticate','appdata':_0x32295c[_0x1a3c('0x10')],'priority':_0x222047++},_0x19da88));}_0x51dbaf[_0x1a3c('0xb')](_[_0x1a3c('0x8')]({'app':'ChanSpy','appdata':util['format'](_0x1a3c('0x11'),_0x5c38d6[_0x1a3c('0x12')],_0x32295c[_0x1a3c('0x13')]?_0x32295c['options'][_0x1a3c('0x14')](''):''),'priority':_0x222047++},_0x19da88));if(_0x32295c[_0x1a3c('0x15')]){_0x51dbaf['push'](_[_0x1a3c('0x8')]({'app':_0x1a3c('0x16'),'priority':_0x222047++},_0x19da88));}return _0x51dbaf;};var getChanSpyApplications=function(_0x9bbe1c,_0x5e81c2){var _0x3907b7=[];for(var _0x4e03d7=0x0,_0x245883=0x1;_0x4e03d7<_0x5e81c2[_0x1a3c('0x17')];_0x4e03d7++,_0x245883=0x1){_0x3907b7=_0x3907b7[_0x1a3c('0x18')](getUserApplications(_0x9bbe1c,_0x5e81c2[_0x4e03d7],_0x5e81c2[_0x4e03d7][_0x1a3c('0x19')]));if(_0x5e81c2[_0x4e03d7]['internal']!=_0x5e81c2[_0x4e03d7][_0x1a3c('0x12')]){_0x3907b7=_0x3907b7[_0x1a3c('0x18')](getUserApplications(_0x9bbe1c,_0x5e81c2[_0x4e03d7],_0x5e81c2[_0x4e03d7][_0x1a3c('0x12')]));}}return _0x3907b7;};var getChanSpyPromise=function(_0x145c00,_0x515774){return new BPromise(function(_0x1a426a,_0x2f9aa0){return _0x145c00['User'][_0x1a3c('0x1a')]({'attributes':['id',_0x1a3c('0x12'),_0x1a3c('0x19')],'where':{'role':_0x1a3c('0x1b'),'chanspy':!![]},'raw':!![]})[_0x1a3c('0x1c')](function(_0x400b9c){if(_0x400b9c){return _0x1a426a(getChanSpyApplications(_0x515774,_0x400b9c));}return _0x1a426a([]);})['catch'](function(_0x4debc3){_0x2f9aa0(_0x4debc3);});});};module[_0x1a3c('0x1d')]=function(_0x3e555b,_0x3e466e){var _0x2d9e24=_0x3e555b[_0x1a3c('0x1e')];return _0x3e555b['define'](_0x1a3c('0x1f'),attributes,{'tableName':_0x1a3c('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa4afe4,_0x2d84a8,_0x43edb9){return getChanSpyPromise(_0x2d9e24,_0xa4afe4)['then'](function(_0x10b858){if(_0x10b858&&_0x10b858[_0x1a3c('0x17')]){return _0x2d9e24[_0x1a3c('0x21')][_0x1a3c('0x22')](_0x10b858);}})[_0x1a3c('0x1c')](function(){_0x43edb9();})[_0x1a3c('0x23')](function(_0x21ef1b){_0x43edb9(_0x21ef1b);});},'afterUpdate':function(_0xcdd704,_0x42b2c7,_0x55f574){return _0x2d9e24[_0x1a3c('0x21')][_0x1a3c('0x24')]({'where':{'ChanSpyId':_0xcdd704['id']}})['then'](function(){return getChanSpyPromise(_0x2d9e24,_0xcdd704);})['then'](function(_0x2fe762){if(_0x2fe762&&_0x2fe762[_0x1a3c('0x17')]){return _0x2d9e24[_0x1a3c('0x21')][_0x1a3c('0x22')](_0x2fe762);}})[_0x1a3c('0x1c')](function(){_0x55f574();})[_0x1a3c('0x23')](function(_0x17670c){_0x55f574(_0x17670c);});},'afterDestroy':function(_0x298441,_0x230050,_0x3f2fdf){return _0x2d9e24[_0x1a3c('0x21')][_0x1a3c('0x24')]({'where':{'ChanSpyId':_0x298441['id']}})['then'](function(){_0x3f2fdf();})[_0x1a3c('0x23')](function(_0x19c0e1){_0x3f2fdf(_0x19c0e1);});}}});}; \ No newline at end of file +var _0x6468=['system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','from-sip','format','prefix'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6468,0x6c));var _0x8646=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x6468[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x8646('0x0'));var util=require(_0x8646('0x1'));var BPromise=require(_0x8646('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3932cb,_0x28d680,_0xca931c){var _0x2f0fbd=0x1;var _0x4b71d8=[];var _0x5d6065={'context':_0x28d680['context']||_0x8646('0x3'),'exten':util[_0x8646('0x4')]('%s%s',_0x3932cb[_0x8646('0x5')],_0xca931c),'type':_0x8646('0x6'),'isApp':![],'ChanSpyId':_0x3932cb['id'],'UserId':_0x28d680['id']};_0x4b71d8[_0x8646('0x7')](_['merge']({'app':_0x8646('0x8'),'appdata':util[_0x8646('0x4')](_0x8646('0x9'),_0x8646('0xa')),'priority':_0x2f0fbd++},_0x5d6065));if(_0x3932cb[_0x8646('0xb')]){_0x4b71d8[_0x8646('0x7')](_[_0x8646('0xc')]({'app':_0x8646('0xd'),'appdata':util[_0x8646('0x4')]('${UNIQUEID}.%s,a',_0x3932cb[_0x8646('0xe')]),'priority':_0x2f0fbd++},_0x5d6065));}if(_0x3932cb[_0x8646('0xf')]){_0x4b71d8[_0x8646('0x7')](_[_0x8646('0xc')]({'app':'Authenticate','appdata':_0x3932cb[_0x8646('0x10')],'priority':_0x2f0fbd++},_0x5d6065));}_0x4b71d8[_0x8646('0x7')](_[_0x8646('0xc')]({'app':_0x8646('0x11'),'appdata':util[_0x8646('0x4')](_0x8646('0x12'),_0x28d680['name'],_0x3932cb[_0x8646('0x13')]?_0x3932cb['options'][_0x8646('0x14')](''):''),'priority':_0x2f0fbd++},_0x5d6065));if(_0x3932cb[_0x8646('0xb')]){_0x4b71d8[_0x8646('0x7')](_[_0x8646('0xc')]({'app':_0x8646('0x15'),'priority':_0x2f0fbd++},_0x5d6065));}return _0x4b71d8;};var getChanSpyApplications=function(_0x3eeb1b,_0x32fb33){var _0x3a3f93=[];for(var _0x50d5d5=0x0,_0x2209a3=0x1;_0x50d5d5<_0x32fb33['length'];_0x50d5d5++,_0x2209a3=0x1){_0x3a3f93=_0x3a3f93[_0x8646('0x16')](getUserApplications(_0x3eeb1b,_0x32fb33[_0x50d5d5],_0x32fb33[_0x50d5d5][_0x8646('0x17')]));if(_0x32fb33[_0x50d5d5][_0x8646('0x17')]!=_0x32fb33[_0x50d5d5][_0x8646('0x18')]){_0x3a3f93=_0x3a3f93[_0x8646('0x16')](getUserApplications(_0x3eeb1b,_0x32fb33[_0x50d5d5],_0x32fb33[_0x50d5d5][_0x8646('0x18')]));}}return _0x3a3f93;};var getChanSpyPromise=function(_0x29b84f,_0x3a416b){return new BPromise(function(_0x297cef,_0x3900bf){return _0x29b84f[_0x8646('0x19')][_0x8646('0x1a')]({'attributes':['id',_0x8646('0x18'),'internal'],'where':{'role':_0x8646('0x1b'),'chanspy':!![]},'raw':!![]})[_0x8646('0x1c')](function(_0x213834){if(_0x213834){return _0x297cef(getChanSpyApplications(_0x3a416b,_0x213834));}return _0x297cef([]);})[_0x8646('0x1d')](function(_0x1a1ca3){_0x3900bf(_0x1a1ca3);});});};module[_0x8646('0x1e')]=function(_0x293db5,_0x359afa){var _0xa5a128=_0x293db5[_0x8646('0x1f')];return _0x293db5['define'](_0x8646('0x20'),attributes,{'tableName':_0x8646('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x362d14,_0x24c8c7,_0x425d49){return getChanSpyPromise(_0xa5a128,_0x362d14)['then'](function(_0x2e2a7c){if(_0x2e2a7c&&_0x2e2a7c[_0x8646('0x22')]){return _0xa5a128[_0x8646('0x23')][_0x8646('0x24')](_0x2e2a7c);}})[_0x8646('0x1c')](function(){_0x425d49();})[_0x8646('0x1d')](function(_0x5d65b2){_0x425d49(_0x5d65b2);});},'afterUpdate':function(_0x5ea9ce,_0x5f3b8f,_0x48557c){return _0xa5a128[_0x8646('0x23')][_0x8646('0x25')]({'where':{'ChanSpyId':_0x5ea9ce['id']}})['then'](function(){return getChanSpyPromise(_0xa5a128,_0x5ea9ce);})[_0x8646('0x1c')](function(_0x279f98){if(_0x279f98&&_0x279f98[_0x8646('0x22')]){return _0xa5a128[_0x8646('0x23')][_0x8646('0x24')](_0x279f98);}})[_0x8646('0x1c')](function(){_0x48557c();})['catch'](function(_0x19ec92){_0x48557c(_0x19ec92);});},'afterDestroy':function(_0x1201d4,_0x3115c8,_0x4e52c7){return _0xa5a128['VoiceExtension'][_0x8646('0x25')]({'where':{'ChanSpyId':_0x1201d4['id']}})[_0x8646('0x1c')](function(){_0x4e52c7();})['catch'](function(_0xd9dd2a){_0x4e52c7(_0xd9dd2a);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 064d561..0d4061d 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 _0x19ea=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x50f2a2,_0x1e5f90){var _0x3b6449=function(_0x3469a9){while(--_0x3469a9){_0x50f2a2['push'](_0x50f2a2['shift']());}};_0x3b6449(++_0x1e5f90);}(_0x19ea,0xfe));var _0xa19e=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x19ea[_0x484c03];return _0x294127;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});} \ No newline at end of file +var _0xb28a=['catch','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x508fc9,_0x354544){var _0x39e966=function(_0x404fe2){while(--_0x404fe2){_0x508fc9['push'](_0x508fc9['shift']());}};_0x39e966(++_0x354544);}(_0xb28a,0x166));var _0xab28=function(_0x3e1926,_0x11e729){_0x3e1926=_0x3e1926-0x0;var _0x5517e9=_0xb28a[_0x3e1926];return _0x5517e9;};'use strict';var _=require('lodash');var util=require(_0xab28('0x0'));var moment=require(_0xab28('0x1'));var BPromise=require('bluebird');var rs=require(_0xab28('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab28('0x3'))(_0xab28('0x4'));var config=require(_0xab28('0x5'));var jayson=require(_0xab28('0x6'));var client=jayson[_0xab28('0x7')][_0xab28('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x450e5b,_0x3b2507,_0x48949b){return new BPromise(function(_0x479267,_0x294e36){return client[_0xab28('0x9')](_0x450e5b,_0x48949b)[_0xab28('0xa')](function(_0x2508ef){logger[_0xab28('0xb')](_0xab28('0xc'),_0x3b2507,'request\x20sent');logger[_0xab28('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3b2507,_0xab28('0xe'),JSON[_0xab28('0xf')](_0x2508ef));if(_0x2508ef[_0xab28('0x10')]){if(_0x2508ef[_0xab28('0x10')][_0xab28('0x11')]===0x1f4){logger[_0xab28('0x10')](_0xab28('0xc'),_0x3b2507,_0x2508ef[_0xab28('0x10')]['message']);return _0x294e36(_0x2508ef[_0xab28('0x10')][_0xab28('0x12')]);}logger[_0xab28('0x10')](_0xab28('0xc'),_0x3b2507,_0x2508ef[_0xab28('0x10')][_0xab28('0x12')]);return _0x479267(_0x2508ef['error']['message']);}else{logger[_0xab28('0xb')](_0xab28('0xc'),_0x3b2507,_0xab28('0xe'));_0x479267(_0x2508ef[_0xab28('0x13')]['message']);}})[_0xab28('0x14')](function(_0x4912fa){logger[_0xab28('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x3b2507,_0x4912fa);_0x294e36(_0x4912fa);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8db835c..1da84ad 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 _0x1c7f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1c7f,0x1e2));var _0xf1c7=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x1c7f[_0x532112];return _0x23e5fb;};'use strict';var multer=require(_0xf1c7('0x0'));var util=require('util');var path=require(_0xf1c7('0x1'));var timeout=require(_0xf1c7('0x2'));var express=require('express');var router=express[_0xf1c7('0x3')]();var fs_extra=require(_0xf1c7('0x4'));var auth=require(_0xf1c7('0x5'));var interaction=require(_0xf1c7('0x6'));var config=require(_0xf1c7('0x7'));var controller=require(_0xf1c7('0x8'));router[_0xf1c7('0x9')]('/',auth[_0xf1c7('0xa')](),controller['index']);router[_0xf1c7('0x9')](_0xf1c7('0xb'),auth[_0xf1c7('0xa')](),controller['show']);router[_0xf1c7('0xc')]('/',auth[_0xf1c7('0xa')](),controller[_0xf1c7('0xd')]);router[_0xf1c7('0xe')](_0xf1c7('0xb'),auth[_0xf1c7('0xa')](),controller[_0xf1c7('0xf')]);router[_0xf1c7('0x10')]('/:id',auth[_0xf1c7('0xa')](),controller['destroy']);module[_0xf1c7('0x11')]=router; \ No newline at end of file +var _0xe7bc=['create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','/:id','show','post','isAuthenticated'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xe7bc,0x8d));var _0xce7b=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xe7bc[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0xce7b('0x0'));var util=require('util');var path=require(_0xce7b('0x1'));var timeout=require(_0xce7b('0x2'));var express=require('express');var router=express[_0xce7b('0x3')]();var fs_extra=require(_0xce7b('0x4'));var auth=require(_0xce7b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xce7b('0x6'));var controller=require(_0xce7b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xce7b('0x8'),auth['isAuthenticated'](),controller[_0xce7b('0x9')]);router[_0xce7b('0xa')]('/',auth[_0xce7b('0xb')](),controller[_0xce7b('0xc')]);router[_0xce7b('0xd')](_0xce7b('0x8'),auth[_0xce7b('0xb')](),controller[_0xce7b('0xe')]);router[_0xce7b('0xf')](_0xce7b('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xce7b('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 83d4ed3..17d560b 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 _0xbad6=['BOOLEAN','exports','STRING'];(function(_0x5a6503,_0x4935fd){var _0x3692ab=function(_0x27c9ee){while(--_0x27c9ee){_0x5a6503['push'](_0x5a6503['shift']());}};_0x3692ab(++_0x4935fd);}(_0xbad6,0x1f0));var _0x6bad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbad6[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x6bad('0x0')]={'name':{'type':Sequelize[_0x6bad('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x6bad('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6bad('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7c68=['sequelize','exports','STRING'];(function(_0x752f9b,_0x1abff2){var _0x4cdc28=function(_0x25a1d5){while(--_0x25a1d5){_0x752f9b['push'](_0x752f9b['shift']());}};_0x4cdc28(++_0x1abff2);}(_0x7c68,0x189));var _0x87c6=function(_0x5a9a96,_0x4ea72d){_0x5a9a96=_0x5a9a96-0x0;var _0x53d013=_0x7c68[_0x5a9a96];return _0x53d013;};'use strict';var Sequelize=require(_0x87c6('0x0'));module[_0x87c6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x87c6('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 63f8c6b..483d289 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 _0x1d68=['stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','utf8','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','Contexts','UserProfileResource','sendStatus'];(function(_0x41aacc,_0x182b3){var _0x2962c7=function(_0xb7c11){while(--_0xb7c11){_0x41aacc['push'](_0x41aacc['shift']());}};_0x2962c7(++_0x182b3);}(_0x1d68,0x108));var _0x81d6=function(_0x35a9fd,_0x540c82){_0x35a9fd=_0x35a9fd-0x0;var _0x26242e=_0x1d68[_0x35a9fd];return _0x26242e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81d6('0x0'));var zipdir=require(_0x81d6('0x1'));var jsonpatch=require(_0x81d6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x81d6('0x3'));var Mustache=require(_0x81d6('0x4'));var util=require(_0x81d6('0x5'));var path=require(_0x81d6('0x6'));var sox=require('sox');var csv=require(_0x81d6('0x7'));var ejs=require(_0x81d6('0x8'));var fs=require('fs');var fs_extra=require(_0x81d6('0x9'));var _=require(_0x81d6('0xa'));var squel=require(_0x81d6('0xb'));var crypto=require(_0x81d6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x81d6('0xd'));var toCsv=require(_0x81d6('0x7'));var querystring=require(_0x81d6('0xe'));var Papa=require(_0x81d6('0xf'));var Redis=require(_0x81d6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x81d6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81d6('0x12'));var logger=require(_0x81d6('0x13'))(_0x81d6('0x14'));var utils=require(_0x81d6('0x15'));var config=require(_0x81d6('0x16'));var licenseUtil=require(_0x81d6('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x81d6('0x18'));var client=jayson[_0x81d6('0x19')][_0x81d6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x38edd4,_0x1d1ebe,_0x2a00f5,_0x5b467c){return new BPromise(function(_0x485814,_0x4cf98e){var _0x5ee0a5=_0x5b467c||client;return _0x5ee0a5['request'](_0x38edd4,_0x2a00f5)[_0x81d6('0x1b')](function(_0x477110){logger[_0x81d6('0x1c')](_0x81d6('0x1d'),_0x1d1ebe,_0x81d6('0x1e'));logger[_0x81d6('0x1f')](_0x81d6('0x20'),_0x1d1ebe,_0x81d6('0x1e'),JSON['stringify'](_0x477110));if(_0x477110[_0x81d6('0x21')]){if(_0x477110['error'][_0x81d6('0x22')]===0x1f4){logger[_0x81d6('0x21')]('VoiceContext,\x20%s,\x20%s',_0x1d1ebe,_0x477110[_0x81d6('0x21')][_0x81d6('0x23')]);return _0x4cf98e(_0x477110[_0x81d6('0x21')][_0x81d6('0x23')]);}logger['error'](_0x81d6('0x1d'),_0x1d1ebe,_0x477110['error']['message']);return _0x485814(_0x477110[_0x81d6('0x21')][_0x81d6('0x23')]);}else{logger[_0x81d6('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x1d1ebe,_0x81d6('0x1e'));_0x485814(_0x477110[_0x81d6('0x24')][_0x81d6('0x23')]);}})[_0x81d6('0x25')](function(_0xe10b90){logger[_0x81d6('0x21')](_0x81d6('0x1d'),_0x1d1ebe,_0xe10b90);_0x4cf98e(_0xe10b90);});});}function respondWithStatusCode(_0x331d20,_0x2b5b53){_0x2b5b53=_0x2b5b53||0xcc;return function(_0x4e5566){if(_0x4e5566){return _0x331d20['sendStatus'](_0x2b5b53);}return _0x331d20[_0x81d6('0x26')](_0x2b5b53)[_0x81d6('0x27')]();};}function respondWithResult(_0x5409a1,_0x54bc51){_0x54bc51=_0x54bc51||0xc8;return function(_0xef2963){if(_0xef2963){return _0x5409a1[_0x81d6('0x26')](_0x54bc51)[_0x81d6('0x28')](_0xef2963);}};}function respondWithFilteredResult(_0x5bd8a4,_0x7bf108){return function(_0x3e3aaa){if(_0x3e3aaa){var _0x18131e=typeof _0x7bf108[_0x81d6('0x29')]===_0x81d6('0x2a')&&typeof _0x7bf108[_0x81d6('0x2b')]===_0x81d6('0x2a');var _0x3036d6=_0x3e3aaa[_0x81d6('0x2c')];var _0x467483=_0x18131e?0x0:_0x7bf108['offset'];var _0x3d4a1d=_0x18131e?_0x3e3aaa[_0x81d6('0x2c')]:_0x7bf108[_0x81d6('0x29')]+_0x7bf108[_0x81d6('0x2b')];var _0x478a05;if(_0x3d4a1d>=_0x3036d6){_0x3d4a1d=_0x3036d6;_0x478a05=0xc8;}else{_0x478a05=0xce;}_0x5bd8a4[_0x81d6('0x26')](_0x478a05);return _0x5bd8a4['set'](_0x81d6('0x2d'),_0x467483+'-'+_0x3d4a1d+'/'+_0x3036d6)[_0x81d6('0x28')](_0x3e3aaa);}return null;};}function patchUpdates(_0x136e3a){return function(_0x367cba){try{jsonpatch[_0x81d6('0x2e')](_0x367cba,_0x136e3a,!![]);}catch(_0xa933b2){return BPromise[_0x81d6('0x2f')](_0xa933b2);}return _0x367cba[_0x81d6('0x30')]();};}function saveUpdates(_0x6ede7d,_0x5f221f){return function(_0x21f940){if(_0x21f940){return _0x21f940[_0x81d6('0x31')](_0x6ede7d)[_0x81d6('0x1b')](function(_0x517a16){return _0x517a16;});}return null;};}function removeEntity(_0x354604,_0x35f2b3){return function(_0x53e31a){if(_0x53e31a){return _0x53e31a[_0x81d6('0x32')]()[_0x81d6('0x1b')](function(){var _0x1f552e=_0x53e31a['get']({'plain':!![]});var _0x1f09b3=_0x81d6('0x33');return db[_0x81d6('0x34')][_0x81d6('0x32')]({'where':{'type':_0x1f09b3,'resourceId':_0x1f552e['id']}})[_0x81d6('0x1b')](function(){return _0x53e31a;});})[_0x81d6('0x1b')](function(){_0x354604[_0x81d6('0x26')](0xcc)[_0x81d6('0x27')]();});}};}function handleEntityNotFound(_0x119a1d,_0x5252ce){return function(_0xd12377){if(!_0xd12377){_0x119a1d[_0x81d6('0x35')](0x194);}return _0xd12377;};}function handleError(_0x442936,_0x38875e){_0x38875e=_0x38875e||0x1f4;return function(_0x5dc19d){logger[_0x81d6('0x21')](_0x5dc19d[_0x81d6('0x36')]);if(_0x5dc19d['name']){delete _0x5dc19d[_0x81d6('0x37')];}_0x442936[_0x81d6('0x26')](_0x38875e)[_0x81d6('0x38')](_0x5dc19d);};}exports[_0x81d6('0x39')]=function(_0x57d702,_0x456ae0){var _0x26bb99={},_0x4662a8={},_0x5aa865={'count':0x0,'rows':[]};var _0x33bfc0=_[_0x81d6('0x3a')](db[_0x81d6('0x3b')][_0x81d6('0x3c')],function(_0x378cb){return{'name':_0x378cb[_0x81d6('0x3d')],'type':_0x378cb[_0x81d6('0x3e')][_0x81d6('0x3f')]};});_0x4662a8['model']=_[_0x81d6('0x3a')](_0x33bfc0,'name');_0x4662a8['query']=_['keys'](_0x57d702['query']);_0x4662a8[_0x81d6('0x40')]=_[_0x81d6('0x41')](_0x4662a8[_0x81d6('0x42')],_0x4662a8[_0x81d6('0x43')]);_0x26bb99[_0x81d6('0x44')]=_[_0x81d6('0x41')](_0x4662a8[_0x81d6('0x42')],qs[_0x81d6('0x45')](_0x57d702[_0x81d6('0x43')][_0x81d6('0x45')]));_0x26bb99['attributes']=_0x26bb99[_0x81d6('0x44')]['length']?_0x26bb99[_0x81d6('0x44')]:_0x4662a8[_0x81d6('0x42')];if(!_0x57d702[_0x81d6('0x43')][_0x81d6('0x46')]('nolimit')){_0x26bb99['limit']=qs[_0x81d6('0x2b')](_0x57d702[_0x81d6('0x43')]['limit']);_0x26bb99['offset']=qs[_0x81d6('0x29')](_0x57d702[_0x81d6('0x43')][_0x81d6('0x29')]);}_0x26bb99[_0x81d6('0x47')]=qs['sort'](_0x57d702['query'][_0x81d6('0x48')]);_0x26bb99[_0x81d6('0x49')]=qs[_0x81d6('0x40')](_[_0x81d6('0x4a')](_0x57d702[_0x81d6('0x43')],_0x4662a8[_0x81d6('0x40')]),_0x33bfc0);if(_0x57d702[_0x81d6('0x43')]['filter']){_0x26bb99['where']=_[_0x81d6('0x4b')](_0x26bb99[_0x81d6('0x49')],{'$or':_[_0x81d6('0x3a')](_0x33bfc0,function(_0x19f81b){if(_0x19f81b['type']!==_0x81d6('0x4c')){var _0x139d0f={};_0x139d0f[_0x19f81b[_0x81d6('0x37')]]={'$like':'%'+_0x57d702[_0x81d6('0x43')]['filter']+'%'};return _0x139d0f;}})});}_0x26bb99=_['merge']({},_0x26bb99,_0x57d702[_0x81d6('0x4d')]);var _0x264f39={'where':_0x26bb99[_0x81d6('0x49')]};return db[_0x81d6('0x3b')][_0x81d6('0x2c')](_0x264f39)['then'](function(_0x26ae44){_0x5aa865[_0x81d6('0x2c')]=_0x26ae44;if(_0x57d702[_0x81d6('0x43')][_0x81d6('0x4e')]){_0x26bb99[_0x81d6('0x4f')]=[{'all':!![]}];}return db[_0x81d6('0x3b')][_0x81d6('0x50')](_0x26bb99);})[_0x81d6('0x1b')](function(_0x575005){_0x5aa865[_0x81d6('0x51')]=_0x575005;return _0x5aa865;})['then'](respondWithFilteredResult(_0x456ae0,_0x26bb99))[_0x81d6('0x25')](handleError(_0x456ae0,null));};exports[_0x81d6('0x52')]=function(_0x7d2f30,_0x436c1d){var _0xc4e5fc={'raw':![],'where':{'id':_0x7d2f30['params']['id']}},_0x380645={};_0x380645['model']=_['keys'](db['VoiceContext']['rawAttributes']);_0x380645[_0x81d6('0x43')]=_[_0x81d6('0x53')](_0x7d2f30[_0x81d6('0x43')]);_0x380645[_0x81d6('0x40')]=_[_0x81d6('0x41')](_0x380645[_0x81d6('0x42')],_0x380645[_0x81d6('0x43')]);_0xc4e5fc[_0x81d6('0x44')]=_['intersection'](_0x380645[_0x81d6('0x42')],qs[_0x81d6('0x45')](_0x7d2f30['query']['fields']));_0xc4e5fc[_0x81d6('0x44')]=_0xc4e5fc[_0x81d6('0x44')]['length']?_0xc4e5fc[_0x81d6('0x44')]:_0x380645[_0x81d6('0x42')];if(_0x7d2f30[_0x81d6('0x43')][_0x81d6('0x4e')]){_0xc4e5fc[_0x81d6('0x4f')]=[{'all':!![]}];}_0xc4e5fc=_[_0x81d6('0x4b')]({},_0xc4e5fc,_0x7d2f30[_0x81d6('0x4d')]);return db[_0x81d6('0x3b')]['find'](_0xc4e5fc)[_0x81d6('0x1b')](handleEntityNotFound(_0x436c1d,null))[_0x81d6('0x1b')](respondWithResult(_0x436c1d,null))[_0x81d6('0x25')](handleError(_0x436c1d,null));};exports[_0x81d6('0x54')]=function(_0x58c0be,_0xb2b68c,_0x3efa6a){var _0x2e642e;return db[_0x81d6('0x3b')][_0x81d6('0x54')](_0x58c0be[_0x81d6('0x55')],{'raw':!![]})[_0x81d6('0x1b')](function(_0x7da283){_0x2e642e=_0x7da283;return db[_0x81d6('0x3b')][_0x81d6('0x50')]({'raw':!![]});})[_0x81d6('0x1b')](function(_0x26e6c9){var _0x5cfccf=fs[_0x81d6('0x56')](path[_0x81d6('0x57')](config[_0x81d6('0x58')],_0x81d6('0x59')),'utf8');var _0x5c1574=ejs[_0x81d6('0x5a')](_0x5cfccf,{'contexts':_0x26e6c9||[]});fs[_0x81d6('0x5b')](_0x81d6('0x5c'),_0x5c1574);})[_0x81d6('0x1b')](function(){return respondWithRpcPromise(_0x81d6('0x5d'),'create',{'module':_0x81d6('0x5e')});})[_0x81d6('0x1b')](function(){var _0x2ee216=_0x58c0be[_0x81d6('0x5f')][_0x81d6('0x60')]({'plain':!![]});if(!_0x2ee216)throw new Error(_0x81d6('0x61'));if(_0x2ee216[_0x81d6('0x62')]==='user'){var _0xbb1212=_0x2e642e['get']({'plain':!![]});return db[_0x81d6('0x63')][_0x81d6('0x64')]({'where':{'name':_0x81d6('0x33'),'userProfileId':_0x2ee216[_0x81d6('0x65')]},'raw':!![]})[_0x81d6('0x1b')](function(_0x1c456f){if(_0x1c456f&&_0x1c456f[_0x81d6('0x66')]===0x0){return db['UserProfileResource'][_0x81d6('0x54')]({'name':_0xbb1212[_0x81d6('0x37')],'resourceId':_0xbb1212['id'],'type':_0x1c456f[_0x81d6('0x37')],'sectionId':_0x1c456f['id']},{})[_0x81d6('0x1b')](function(){return _0x2e642e;});}else{return _0x2e642e;}})[_0x81d6('0x25')](function(_0x550fe7){logger[_0x81d6('0x21')](_0x81d6('0x67'),_0x550fe7);throw _0x550fe7;});}return _0x2e642e;})[_0x81d6('0x1b')](respondWithResult(_0xb2b68c,0xc9))['catch'](handleError(_0xb2b68c,null));};exports[_0x81d6('0x31')]=function(_0x5a3307,_0x395c4a,_0x36a167){var _0x15eb71;return db[_0x81d6('0x3b')][_0x81d6('0x64')]({'where':{'id':_0x5a3307[_0x81d6('0x68')]['id']}})[_0x81d6('0x1b')](handleEntityNotFound(_0x395c4a,null))['then'](saveUpdates(_0x5a3307[_0x81d6('0x55')],null))[_0x81d6('0x1b')](function(_0x122998){if(_0x122998){_0x15eb71=_0x122998;return db[_0x81d6('0x3b')][_0x81d6('0x50')]({'raw':!![]});}})[_0x81d6('0x1b')](function(_0xd5789b){var _0x40ccff=fs['readFileSync'](path[_0x81d6('0x57')](config[_0x81d6('0x58')],_0x81d6('0x59')),_0x81d6('0x69'));var _0x2097d1=ejs['render'](_0x40ccff,{'contexts':_0xd5789b||[]});fs[_0x81d6('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2097d1);})[_0x81d6('0x1b')](function(){return respondWithRpcPromise(_0x81d6('0x5d'),_0x81d6('0x31'),{'module':_0x81d6('0x5e')});})[_0x81d6('0x1b')](function(){return _0x15eb71;})[_0x81d6('0x1b')](respondWithResult(_0x395c4a,null))['catch'](handleError(_0x395c4a,null));};exports['destroy']=function(_0x4d703a,_0x2d1290,_0x1cf2a3){var _0x1ba5fe;return db['VoiceContext']['find']({'where':{'id':_0x4d703a['params']['id']}})[_0x81d6('0x1b')](handleEntityNotFound(_0x2d1290,null))[_0x81d6('0x1b')](removeEntity(_0x2d1290,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x81d6('0x1b')](function(_0x1cf060){var _0xbd12c1=fs[_0x81d6('0x56')](path[_0x81d6('0x57')](config[_0x81d6('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x41b89b=ejs[_0x81d6('0x5a')](_0xbd12c1,{'contexts':_0x1cf060});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x41b89b);return respondWithRpcPromise('Reload','destroy',{'module':_0x81d6('0x5e')});})[_0x81d6('0x25')](handleError(_0x2d1290,null));}; \ No newline at end of file +var _0x5c77=['attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','VoiceContext','includeAll','include','rows','show','params','model','options','find','create','body','readFileSync','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','Reload','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Contexts','UserProfileResource','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5c77,0x1ad));var _0x75c7=function(_0x2b3dfe,_0x2e9db2){_0x2b3dfe=_0x2b3dfe-0x0;var _0xe18ef1=_0x5c77[_0x2b3dfe];return _0xe18ef1;};'use strict';var emlformat=require(_0x75c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x75c7('0x1'));var jsonpatch=require(_0x75c7('0x2'));var rp=require(_0x75c7('0x3'));var moment=require(_0x75c7('0x4'));var BPromise=require(_0x75c7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x75c7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75c7('0x7'));var _=require(_0x75c7('0x8'));var squel=require(_0x75c7('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x75c7('0x6'));var querystring=require(_0x75c7('0xa'));var Papa=require(_0x75c7('0xb'));var Redis=require(_0x75c7('0xc'));var authService=require(_0x75c7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x75c7('0xe'));var hardwareService=require(_0x75c7('0xf'));var logger=require(_0x75c7('0x10'))('api');var utils=require(_0x75c7('0x11'));var config=require(_0x75c7('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x75c7('0x13'));var client=jayson[_0x75c7('0x14')][_0x75c7('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1b0609,_0x534eaf,_0x4f5ca9,_0x3863a3){return new BPromise(function(_0x2f14de,_0x409cda){var _0x2cc52b=_0x3863a3||client;return _0x2cc52b['request'](_0x1b0609,_0x4f5ca9)['then'](function(_0x414cda){logger[_0x75c7('0x16')]('VoiceContext,\x20%s,\x20%s',_0x534eaf,'request\x20sent');logger[_0x75c7('0x17')](_0x75c7('0x18'),_0x534eaf,_0x75c7('0x19'),JSON[_0x75c7('0x1a')](_0x414cda));if(_0x414cda[_0x75c7('0x1b')]){if(_0x414cda[_0x75c7('0x1b')][_0x75c7('0x1c')]===0x1f4){logger[_0x75c7('0x1b')](_0x75c7('0x1d'),_0x534eaf,_0x414cda[_0x75c7('0x1b')][_0x75c7('0x1e')]);return _0x409cda(_0x414cda[_0x75c7('0x1b')][_0x75c7('0x1e')]);}logger[_0x75c7('0x1b')](_0x75c7('0x1d'),_0x534eaf,_0x414cda['error']['message']);return _0x2f14de(_0x414cda[_0x75c7('0x1b')][_0x75c7('0x1e')]);}else{logger[_0x75c7('0x16')](_0x75c7('0x1d'),_0x534eaf,_0x75c7('0x19'));_0x2f14de(_0x414cda[_0x75c7('0x1f')][_0x75c7('0x1e')]);}})[_0x75c7('0x20')](function(_0x4c4025){logger['error'](_0x75c7('0x1d'),_0x534eaf,_0x4c4025);_0x409cda(_0x4c4025);});});}function respondWithStatusCode(_0x36f1e9,_0x51db87){_0x51db87=_0x51db87||0xcc;return function(_0x1e2ebc){if(_0x1e2ebc){return _0x36f1e9[_0x75c7('0x21')](_0x51db87);}return _0x36f1e9[_0x75c7('0x22')](_0x51db87)[_0x75c7('0x23')]();};}function respondWithResult(_0x5587ae,_0x55146a){_0x55146a=_0x55146a||0xc8;return function(_0x26047f){if(_0x26047f){return _0x5587ae[_0x75c7('0x22')](_0x55146a)[_0x75c7('0x24')](_0x26047f);}};}function respondWithFilteredResult(_0x3f7906,_0x4bfce7){return function(_0xc2d6c7){if(_0xc2d6c7){var _0x33534b=typeof _0x4bfce7[_0x75c7('0x25')]===_0x75c7('0x26')&&typeof _0x4bfce7[_0x75c7('0x27')]==='undefined';var _0x313b3b=_0xc2d6c7[_0x75c7('0x28')];var _0x226518=_0x33534b?0x0:_0x4bfce7[_0x75c7('0x25')];var _0x2dfe3a=_0x33534b?_0xc2d6c7['count']:_0x4bfce7[_0x75c7('0x25')]+_0x4bfce7[_0x75c7('0x27')];var _0x23b790;if(_0x2dfe3a>=_0x313b3b){_0x2dfe3a=_0x313b3b;_0x23b790=0xc8;}else{_0x23b790=0xce;}_0x3f7906['status'](_0x23b790);return _0x3f7906[_0x75c7('0x29')]('Content-Range',_0x226518+'-'+_0x2dfe3a+'/'+_0x313b3b)[_0x75c7('0x24')](_0xc2d6c7);}return null;};}function patchUpdates(_0x1de723){return function(_0x3d931e){try{jsonpatch[_0x75c7('0x2a')](_0x3d931e,_0x1de723,!![]);}catch(_0x52fea){return BPromise[_0x75c7('0x2b')](_0x52fea);}return _0x3d931e[_0x75c7('0x2c')]();};}function saveUpdates(_0x22bbeb,_0x5ae40e){return function(_0x314be0){if(_0x314be0){return _0x314be0[_0x75c7('0x2d')](_0x22bbeb)[_0x75c7('0x2e')](function(_0x49c59b){return _0x49c59b;});}return null;};}function removeEntity(_0x294810,_0x547341){return function(_0x4e5e75){if(_0x4e5e75){return _0x4e5e75[_0x75c7('0x2f')]()[_0x75c7('0x2e')](function(){var _0x5b3a4b=_0x4e5e75['get']({'plain':!![]});var _0x23be5a=_0x75c7('0x30');return db[_0x75c7('0x31')]['destroy']({'where':{'type':_0x23be5a,'resourceId':_0x5b3a4b['id']}})[_0x75c7('0x2e')](function(){return _0x4e5e75;});})['then'](function(){_0x294810['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b7a7,_0x547dfd){return function(_0x2404ff){if(!_0x2404ff){_0x59b7a7[_0x75c7('0x21')](0x194);}return _0x2404ff;};}function handleError(_0x72f567,_0x5097a5){_0x5097a5=_0x5097a5||0x1f4;return function(_0x2c3fb7){logger['error'](_0x2c3fb7['stack']);if(_0x2c3fb7['name']){delete _0x2c3fb7[_0x75c7('0x32')];}_0x72f567['status'](_0x5097a5)['send'](_0x2c3fb7);};}exports[_0x75c7('0x33')]=function(_0xdd84ed,_0x40980c){var _0x15978e={},_0x29b3b8={},_0x52eeac={'count':0x0,'rows':[]};var _0x3814df=_[_0x75c7('0x34')](db['VoiceContext'][_0x75c7('0x35')],function(_0x43afad){return{'name':_0x43afad[_0x75c7('0x36')],'type':_0x43afad[_0x75c7('0x37')][_0x75c7('0x38')]};});_0x29b3b8['model']=_[_0x75c7('0x34')](_0x3814df,_0x75c7('0x32'));_0x29b3b8['query']=_[_0x75c7('0x39')](_0xdd84ed[_0x75c7('0x3a')]);_0x29b3b8[_0x75c7('0x3b')]=_[_0x75c7('0x3c')](_0x29b3b8['model'],_0x29b3b8[_0x75c7('0x3a')]);_0x15978e[_0x75c7('0x3d')]=_[_0x75c7('0x3c')](_0x29b3b8['model'],qs[_0x75c7('0x3e')](_0xdd84ed['query']['fields']));_0x15978e['attributes']=_0x15978e[_0x75c7('0x3d')][_0x75c7('0x3f')]?_0x15978e[_0x75c7('0x3d')]:_0x29b3b8['model'];if(!_0xdd84ed[_0x75c7('0x3a')][_0x75c7('0x40')]('nolimit')){_0x15978e['limit']=qs[_0x75c7('0x27')](_0xdd84ed[_0x75c7('0x3a')][_0x75c7('0x27')]);_0x15978e[_0x75c7('0x25')]=qs[_0x75c7('0x25')](_0xdd84ed[_0x75c7('0x3a')][_0x75c7('0x25')]);}_0x15978e['order']=qs[_0x75c7('0x41')](_0xdd84ed[_0x75c7('0x3a')][_0x75c7('0x41')]);_0x15978e['where']=qs[_0x75c7('0x3b')](_['pick'](_0xdd84ed['query'],_0x29b3b8['filters']),_0x3814df);if(_0xdd84ed[_0x75c7('0x3a')][_0x75c7('0x42')]){_0x15978e[_0x75c7('0x43')]=_[_0x75c7('0x44')](_0x15978e[_0x75c7('0x43')],{'$or':_[_0x75c7('0x34')](_0x3814df,function(_0x3cd0d7){if(_0x3cd0d7['type']!==_0x75c7('0x45')){var _0x404cd0={};_0x404cd0[_0x3cd0d7['name']]={'$like':'%'+_0xdd84ed['query'][_0x75c7('0x42')]+'%'};return _0x404cd0;}})});}_0x15978e=_[_0x75c7('0x44')]({},_0x15978e,_0xdd84ed['options']);var _0x1dffb6={'where':_0x15978e['where']};return db[_0x75c7('0x46')][_0x75c7('0x28')](_0x1dffb6)[_0x75c7('0x2e')](function(_0x3c81c3){_0x52eeac['count']=_0x3c81c3;if(_0xdd84ed[_0x75c7('0x3a')][_0x75c7('0x47')]){_0x15978e[_0x75c7('0x48')]=[{'all':!![]}];}return db[_0x75c7('0x46')]['findAll'](_0x15978e);})[_0x75c7('0x2e')](function(_0x107272){_0x52eeac[_0x75c7('0x49')]=_0x107272;return _0x52eeac;})[_0x75c7('0x2e')](respondWithFilteredResult(_0x40980c,_0x15978e))['catch'](handleError(_0x40980c,null));};exports[_0x75c7('0x4a')]=function(_0x12b425,_0x317370){var _0x55689d={'raw':![],'where':{'id':_0x12b425[_0x75c7('0x4b')]['id']}},_0x8268de={};_0x8268de[_0x75c7('0x4c')]=_[_0x75c7('0x39')](db[_0x75c7('0x46')][_0x75c7('0x35')]);_0x8268de[_0x75c7('0x3a')]=_[_0x75c7('0x39')](_0x12b425[_0x75c7('0x3a')]);_0x8268de[_0x75c7('0x3b')]=_[_0x75c7('0x3c')](_0x8268de[_0x75c7('0x4c')],_0x8268de[_0x75c7('0x3a')]);_0x55689d[_0x75c7('0x3d')]=_['intersection'](_0x8268de[_0x75c7('0x4c')],qs[_0x75c7('0x3e')](_0x12b425[_0x75c7('0x3a')]['fields']));_0x55689d[_0x75c7('0x3d')]=_0x55689d[_0x75c7('0x3d')][_0x75c7('0x3f')]?_0x55689d[_0x75c7('0x3d')]:_0x8268de[_0x75c7('0x4c')];if(_0x12b425[_0x75c7('0x3a')][_0x75c7('0x47')]){_0x55689d[_0x75c7('0x48')]=[{'all':!![]}];}_0x55689d=_[_0x75c7('0x44')]({},_0x55689d,_0x12b425[_0x75c7('0x4d')]);return db[_0x75c7('0x46')][_0x75c7('0x4e')](_0x55689d)[_0x75c7('0x2e')](handleEntityNotFound(_0x317370,null))['then'](respondWithResult(_0x317370,null))['catch'](handleError(_0x317370,null));};exports[_0x75c7('0x4f')]=function(_0x5ad9a9,_0x14c3c0,_0x45ac93){var _0x2c26a1;return db[_0x75c7('0x46')][_0x75c7('0x4f')](_0x5ad9a9[_0x75c7('0x50')],{'raw':!![]})[_0x75c7('0x2e')](function(_0x5f3340){_0x2c26a1=_0x5f3340;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x75c7('0x2e')](function(_0x287b90){var _0x20769c=fs[_0x75c7('0x51')](path['join'](config['root'],_0x75c7('0x52')),_0x75c7('0x53'));var _0x23bed2=ejs[_0x75c7('0x54')](_0x20769c,{'contexts':_0x287b90||[]});fs[_0x75c7('0x55')](_0x75c7('0x56'),_0x23bed2);})[_0x75c7('0x2e')](function(){return respondWithRpcPromise('Reload',_0x75c7('0x4f'),{'module':_0x75c7('0x57')});})[_0x75c7('0x2e')](function(){var _0x40884e=_0x5ad9a9[_0x75c7('0x58')][_0x75c7('0x59')]({'plain':!![]});if(!_0x40884e)throw new Error(_0x75c7('0x5a'));if(_0x40884e[_0x75c7('0x5b')]===_0x75c7('0x58')){var _0x2262f8=_0x2c26a1[_0x75c7('0x59')]({'plain':!![]});return db['UserProfileSection'][_0x75c7('0x4e')]({'where':{'name':_0x75c7('0x30'),'userProfileId':_0x40884e[_0x75c7('0x5c')]},'raw':!![]})[_0x75c7('0x2e')](function(_0x39904c){if(_0x39904c&&_0x39904c['autoAssociation']===0x0){return db[_0x75c7('0x31')][_0x75c7('0x4f')]({'name':_0x2262f8['name'],'resourceId':_0x2262f8['id'],'type':_0x39904c[_0x75c7('0x32')],'sectionId':_0x39904c['id']},{})[_0x75c7('0x2e')](function(){return _0x2c26a1;});}else{return _0x2c26a1;}})[_0x75c7('0x20')](function(_0x469b85){logger[_0x75c7('0x1b')](_0x75c7('0x5d'),_0x469b85);throw _0x469b85;});}return _0x2c26a1;})['then'](respondWithResult(_0x14c3c0,0xc9))[_0x75c7('0x20')](handleError(_0x14c3c0,null));};exports[_0x75c7('0x2d')]=function(_0x5747cd,_0x5ce9da,_0x1e05c2){var _0x6ccd6f;return db[_0x75c7('0x46')][_0x75c7('0x4e')]({'where':{'id':_0x5747cd[_0x75c7('0x4b')]['id']}})[_0x75c7('0x2e')](handleEntityNotFound(_0x5ce9da,null))['then'](saveUpdates(_0x5747cd[_0x75c7('0x50')],null))[_0x75c7('0x2e')](function(_0x407f24){if(_0x407f24){_0x6ccd6f=_0x407f24;return db[_0x75c7('0x46')]['findAll']({'raw':!![]});}})[_0x75c7('0x2e')](function(_0x264db8){var _0x50a680=fs['readFileSync'](path[_0x75c7('0x5e')](config[_0x75c7('0x5f')],'server/files/templates/context.ejs'),_0x75c7('0x53'));var _0x5087d2=ejs[_0x75c7('0x54')](_0x50a680,{'contexts':_0x264db8||[]});fs[_0x75c7('0x55')](_0x75c7('0x56'),_0x5087d2);})[_0x75c7('0x2e')](function(){return respondWithRpcPromise(_0x75c7('0x60'),_0x75c7('0x2d'),{'module':_0x75c7('0x57')});})[_0x75c7('0x2e')](function(){return _0x6ccd6f;})['then'](respondWithResult(_0x5ce9da,null))[_0x75c7('0x20')](handleError(_0x5ce9da,null));};exports['destroy']=function(_0x36a37f,_0x543341,_0x335b90){var _0x230d39;return db[_0x75c7('0x46')][_0x75c7('0x4e')]({'where':{'id':_0x36a37f[_0x75c7('0x4b')]['id']}})[_0x75c7('0x2e')](handleEntityNotFound(_0x543341,null))[_0x75c7('0x2e')](removeEntity(_0x543341,null))['then'](function(){return db['VoiceContext'][_0x75c7('0x61')]({'raw':!![]});})['then'](function(_0x19eac8){var _0x5574fc=fs[_0x75c7('0x51')](path[_0x75c7('0x5e')](config[_0x75c7('0x5f')],_0x75c7('0x52')),_0x75c7('0x53'));var _0xea2665=ejs[_0x75c7('0x54')](_0x5574fc,{'contexts':_0x19eac8});fs[_0x75c7('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xea2665);return respondWithRpcPromise(_0x75c7('0x60'),_0x75c7('0x2f'),{'module':_0x75c7('0x57')});})[_0x75c7('0x20')](handleError(_0x543341,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 40c3bf3..1083c33 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 _0x41a9=['moment','request-promise','path','../../config/environment','define','VoiceContext','voice_contexts','util','api'];(function(_0x1fe53b,_0x3c0fd6){var _0x3d8cb2=function(_0x24b463){while(--_0x24b463){_0x1fe53b['push'](_0x1fe53b['shift']());}};_0x3d8cb2(++_0x3c0fd6);}(_0x41a9,0x1a5));var _0x941a=function(_0x565ed6,_0x426675){_0x565ed6=_0x565ed6-0x0;var _0x37cada=_0x41a9[_0x565ed6];return _0x37cada;};'use strict';var _=require('lodash');var util=require(_0x941a('0x0'));var logger=require('../../config/logger')(_0x941a('0x1'));var moment=require(_0x941a('0x2'));var BPromise=require('bluebird');var rp=require(_0x941a('0x3'));var fs=require('fs');var path=require(_0x941a('0x4'));var rimraf=require('rimraf');var config=require(_0x941a('0x5'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x32ed03,_0x370266){return _0x32ed03[_0x941a('0x6')](_0x941a('0x7'),attributes,{'tableName':_0x941a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x840a=['util','../../config/logger','moment','request-promise','path','../../config/environment','./voiceContext.attributes','exports','VoiceContext','lodash'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0x840a,0x77));var _0xa840=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x840a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa840('0x0'));var util=require(_0xa840('0x1'));var logger=require(_0xa840('0x2'))('api');var moment=require(_0xa840('0x3'));var BPromise=require('bluebird');var rp=require(_0xa840('0x4'));var fs=require('fs');var path=require(_0xa840('0x5'));var rimraf=require('rimraf');var config=require(_0xa840('0x6'));var attributes=require(_0xa840('0x7'));module[_0xa840('0x8')]=function(_0x155172,_0xa1e41e){return _0x155172['define'](_0xa840('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 2eae119..d09ce96 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 _0x6f2f=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','VoiceContext,\x20%s,\x20%s','message','result','catch'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x6f2f[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('VoiceContext,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});} \ No newline at end of file +var _0xd786=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1a4df4,_0x37538b){var _0xad8c8f=function(_0x47a806){while(--_0x47a806){_0x1a4df4['push'](_0x1a4df4['shift']());}};_0xad8c8f(++_0x37538b);}(_0xd786,0x1dc));var _0x6d78=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd786[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));var BPromise=require(_0x6d78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d78('0x4'));var db=require(_0x6d78('0x5'))['db'];var utils=require(_0x6d78('0x6'));var logger=require(_0x6d78('0x7'))(_0x6d78('0x8'));var config=require(_0x6d78('0x9'));var jayson=require(_0x6d78('0xa'));var client=jayson['client'][_0x6d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e9e5,_0x5c3f38,_0x44db98){return new BPromise(function(_0x33b85e,_0x10f58a){return client[_0x6d78('0xc')](_0x30e9e5,_0x44db98)['then'](function(_0x3198b6){logger[_0x6d78('0xd')](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');logger[_0x6d78('0xf')](_0x6d78('0x10'),_0x5c3f38,_0x6d78('0x11'),JSON[_0x6d78('0x12')](_0x3198b6));if(_0x3198b6[_0x6d78('0x13')]){if(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x14')]===0x1f4){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x10f58a(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x15')]);}logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x33b85e(_0x3198b6['error'][_0x6d78('0x15')]);}else{logger['info'](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');_0x33b85e(_0x3198b6[_0x6d78('0x16')]['message']);}})[_0x6d78('0x17')](function(_0x378c59){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x378c59);_0x10f58a(_0x378c59);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 68907e0..88821c9 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 _0xa382=['./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','update','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0xa382,0x1cd));var _0x2a38=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa382[_0x5f3f88];return _0xd08119;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2a38('0x0'));var timeout=require(_0x2a38('0x1'));var express=require('express');var router=express[_0x2a38('0x2')]();var fs_extra=require(_0x2a38('0x3'));var auth=require(_0x2a38('0x4'));var interaction=require(_0x2a38('0x5'));var config=require(_0x2a38('0x6'));var controller=require(_0x2a38('0x7'));router[_0x2a38('0x8')]('/',auth['isAuthenticated'](),controller[_0x2a38('0x9')]);router[_0x2a38('0x8')](_0x2a38('0xa'),auth[_0x2a38('0xb')](),controller[_0x2a38('0xc')]);router[_0x2a38('0x8')](_0x2a38('0xd'),auth[_0x2a38('0xb')](),controller[_0x2a38('0xe')]);router[_0x2a38('0xf')]('/',auth[_0x2a38('0xb')](),controller['create']);router['put']('/:id',auth[_0x2a38('0xb')](),controller[_0x2a38('0x10')]);router['delete'](_0x2a38('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a38('0x11')]=router; \ No newline at end of file +var _0x1307=['describe','/:id','show','post','create','put','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x3baedc,_0x23c184){var _0x1c77f8=function(_0x584aef){while(--_0x584aef){_0x3baedc['push'](_0x3baedc['shift']());}};_0x1c77f8(++_0x23c184);}(_0x1307,0xa1));var _0x7130=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1307[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x7130('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7130('0x1'));var express=require('express');var router=express[_0x7130('0x2')]();var fs_extra=require(_0x7130('0x3'));var auth=require(_0x7130('0x4'));var interaction=require(_0x7130('0x5'));var config=require('../../config/environment');var controller=require(_0x7130('0x6'));router[_0x7130('0x7')]('/',auth[_0x7130('0x8')](),controller[_0x7130('0x9')]);router['get']('/describe',auth[_0x7130('0x8')](),controller[_0x7130('0xa')]);router[_0x7130('0x7')](_0x7130('0xb'),auth[_0x7130('0x8')](),controller[_0x7130('0xc')]);router[_0x7130('0xd')]('/',auth[_0x7130('0x8')](),controller[_0x7130('0xe')]);router[_0x7130('0xf')](_0x7130('0xb'),auth['isAuthenticated'](),controller[_0x7130('0x10')]);router[_0x7130('0x11')]('/:id',auth[_0x7130('0x8')](),controller[_0x7130('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7e3ff9d..5a7e2e3 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(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x8ef6,0xf2));var _0x68ef=function(_0x53919d,_0x5cd5f5){_0x53919d=_0x53919d-0x0;var _0x1dd1af=_0x8ef6[_0x53919d];return _0x1dd1af;};'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 _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x54ef,0x112));var _0xf54e=function(_0x43f5be,_0x131a06){_0x43f5be=_0x43f5be-0x0;var _0x3ffab1=_0x54ef[_0x43f5be];return _0x3ffab1;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 40f90fe..3ddc30e 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 _0x3dfa=['sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x11d005,_0x323675){var _0x34734c=function(_0x3ea3ab){while(--_0x3ea3ab){_0x11d005['push'](_0x11d005['shift']());}};_0x34734c(++_0x323675);}(_0x3dfa,0x183));var _0xa3df=function(_0x44c8a3,_0x30e450){_0x44c8a3=_0x44c8a3-0x0;var _0x3b3e5b=_0x3dfa[_0x44c8a3];return _0x3b3e5b;};'use strict';var emlformat=require(_0xa3df('0x0'));var rimraf=require(_0xa3df('0x1'));var zipdir=require(_0xa3df('0x2'));var jsonpatch=require(_0xa3df('0x3'));var rp=require(_0xa3df('0x4'));var moment=require(_0xa3df('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3df('0x6'));var path=require(_0xa3df('0x7'));var sox=require(_0xa3df('0x8'));var csv=require(_0xa3df('0x9'));var ejs=require(_0xa3df('0xa'));var fs=require('fs');var fs_extra=require(_0xa3df('0xb'));var _=require(_0xa3df('0xc'));var squel=require('squel');var crypto=require(_0xa3df('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3df('0xe'));var Papa=require(_0xa3df('0xf'));var Redis=require(_0xa3df('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa3df('0x11'));var as=require(_0xa3df('0x12'));var hardwareService=require(_0xa3df('0x13'));var logger=require(_0xa3df('0x14'))('api');var utils=require(_0xa3df('0x15'));var config=require(_0xa3df('0x16'));var licenseUtil=require(_0xa3df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc67793,_0x487b8d){_0x487b8d=_0x487b8d||0xcc;return function(_0x555f59){if(_0x555f59){return _0xc67793[_0xa3df('0x18')](_0x487b8d);}return _0xc67793[_0xa3df('0x19')](_0x487b8d)[_0xa3df('0x1a')]();};}function respondWithResult(_0x6c74cb,_0xaf0122){_0xaf0122=_0xaf0122||0xc8;return function(_0x42d760){if(_0x42d760){return _0x6c74cb[_0xa3df('0x19')](_0xaf0122)['json'](_0x42d760);}};}function respondWithFilteredResult(_0x472f20,_0x2eff74){return function(_0x486476){if(_0x486476){var _0x329050=typeof _0x2eff74['offset']===_0xa3df('0x1b')&&typeof _0x2eff74[_0xa3df('0x1c')]===_0xa3df('0x1b');var _0x2bfa56=_0x486476['count'];var _0x15c08d=_0x329050?0x0:_0x2eff74[_0xa3df('0x1d')];var _0x254f76=_0x329050?_0x486476[_0xa3df('0x1e')]:_0x2eff74[_0xa3df('0x1d')]+_0x2eff74[_0xa3df('0x1c')];var _0x1a3034;if(_0x254f76>=_0x2bfa56){_0x254f76=_0x2bfa56;_0x1a3034=0xc8;}else{_0x1a3034=0xce;}_0x472f20[_0xa3df('0x19')](_0x1a3034);return _0x472f20[_0xa3df('0x1f')]('Content-Range',_0x15c08d+'-'+_0x254f76+'/'+_0x2bfa56)[_0xa3df('0x20')](_0x486476);}return null;};}function patchUpdates(_0x534226){return function(_0x3f2886){try{jsonpatch['apply'](_0x3f2886,_0x534226,!![]);}catch(_0x5919c7){return BPromise[_0xa3df('0x21')](_0x5919c7);}return _0x3f2886[_0xa3df('0x22')]();};}function saveUpdates(_0xfaa076,_0x1f67d7){return function(_0x4a4bf4){if(_0x4a4bf4){return _0x4a4bf4[_0xa3df('0x23')](_0xfaa076)[_0xa3df('0x24')](function(_0x3101bb){return _0x3101bb;});}return null;};}function removeEntity(_0x566e1f,_0x1bdf9b){return function(_0x1d48e3){if(_0x1d48e3){return _0x1d48e3[_0xa3df('0x25')]()[_0xa3df('0x24')](function(){_0x566e1f[_0xa3df('0x19')](0xcc)[_0xa3df('0x1a')]();});}};}function handleEntityNotFound(_0x274693,_0x24df38){return function(_0x1df40d){if(!_0x1df40d){_0x274693['sendStatus'](0x194);}return _0x1df40d;};}function handleError(_0x61e0fb,_0x548f6c){_0x548f6c=_0x548f6c||0x1f4;return function(_0x5a071e){logger[_0xa3df('0x26')](_0x5a071e['stack']);if(_0x5a071e['name']){delete _0x5a071e[_0xa3df('0x27')];}_0x61e0fb[_0xa3df('0x19')](_0x548f6c)[_0xa3df('0x28')](_0x5a071e);};}exports[_0xa3df('0x29')]=function(_0x464bd5,_0x3be8dc){var _0x16260a={},_0x2a13d1={},_0x2bc83e={'count':0x0,'rows':[]};var _0x571cd6=_[_0xa3df('0x2a')](db[_0xa3df('0x2b')][_0xa3df('0x2c')],function(_0x2a32bf){return{'name':_0x2a32bf['fieldName'],'type':_0x2a32bf[_0xa3df('0x2d')][_0xa3df('0x2e')]};});_0x2a13d1[_0xa3df('0x2f')]=_['map'](_0x571cd6,_0xa3df('0x27'));_0x2a13d1['query']=_[_0xa3df('0x30')](_0x464bd5[_0xa3df('0x31')]);_0x2a13d1['filters']=_[_0xa3df('0x32')](_0x2a13d1[_0xa3df('0x2f')],_0x2a13d1[_0xa3df('0x31')]);_0x16260a['attributes']=_[_0xa3df('0x32')](_0x2a13d1['model'],qs[_0xa3df('0x33')](_0x464bd5[_0xa3df('0x31')][_0xa3df('0x33')]));_0x16260a[_0xa3df('0x34')]=_0x16260a[_0xa3df('0x34')][_0xa3df('0x35')]?_0x16260a[_0xa3df('0x34')]:_0x2a13d1[_0xa3df('0x2f')];if(!_0x464bd5[_0xa3df('0x31')][_0xa3df('0x36')](_0xa3df('0x37'))){_0x16260a[_0xa3df('0x1c')]=qs['limit'](_0x464bd5[_0xa3df('0x31')][_0xa3df('0x1c')]);_0x16260a[_0xa3df('0x1d')]=qs[_0xa3df('0x1d')](_0x464bd5[_0xa3df('0x31')][_0xa3df('0x1d')]);}_0x16260a[_0xa3df('0x38')]=qs[_0xa3df('0x39')](_0x464bd5[_0xa3df('0x31')][_0xa3df('0x39')]);_0x16260a[_0xa3df('0x3a')]=qs[_0xa3df('0x3b')](_[_0xa3df('0x3c')](_0x464bd5['query'],_0x2a13d1['filters']),_0x571cd6);if(_0x464bd5[_0xa3df('0x31')][_0xa3df('0x3d')]){_0x16260a[_0xa3df('0x3a')]=_['merge'](_0x16260a[_0xa3df('0x3a')],{'$or':_['map'](_0x571cd6,function(_0x1ff352){if(_0x1ff352[_0xa3df('0x2d')]!=='VIRTUAL'){var _0x1bd33a={};_0x1bd33a[_0x1ff352[_0xa3df('0x27')]]={'$like':'%'+_0x464bd5['query']['filter']+'%'};return _0x1bd33a;}})});}_0x16260a=_[_0xa3df('0x3e')]({},_0x16260a,_0x464bd5['options']);var _0x22502d={'where':_0x16260a[_0xa3df('0x3a')]};return db[_0xa3df('0x2b')][_0xa3df('0x1e')](_0x22502d)[_0xa3df('0x24')](function(_0x414926){_0x2bc83e[_0xa3df('0x1e')]=_0x414926;if(_0x464bd5[_0xa3df('0x31')][_0xa3df('0x3f')]){_0x16260a[_0xa3df('0x40')]=[{'all':!![]}];}return db[_0xa3df('0x2b')][_0xa3df('0x41')](_0x16260a);})[_0xa3df('0x24')](function(_0x19c436){_0x2bc83e[_0xa3df('0x42')]=_0x19c436;return _0x2bc83e;})[_0xa3df('0x24')](respondWithFilteredResult(_0x3be8dc,_0x16260a))[_0xa3df('0x43')](handleError(_0x3be8dc,null));};exports[_0xa3df('0x44')]=function(_0x1ce2d5,_0x143e52){var _0x19291f={'raw':!![],'where':{'id':_0x1ce2d5[_0xa3df('0x45')]['id']}},_0x44e486={};_0x44e486[_0xa3df('0x2f')]=_['keys'](db[_0xa3df('0x2b')]['rawAttributes']);_0x44e486[_0xa3df('0x31')]=_[_0xa3df('0x30')](_0x1ce2d5[_0xa3df('0x31')]);_0x44e486[_0xa3df('0x3b')]=_['intersection'](_0x44e486['model'],_0x44e486['query']);_0x19291f[_0xa3df('0x34')]=_[_0xa3df('0x32')](_0x44e486[_0xa3df('0x2f')],qs[_0xa3df('0x33')](_0x1ce2d5[_0xa3df('0x31')][_0xa3df('0x33')]));_0x19291f['attributes']=_0x19291f[_0xa3df('0x34')][_0xa3df('0x35')]?_0x19291f[_0xa3df('0x34')]:_0x44e486['model'];if(_0x1ce2d5[_0xa3df('0x31')][_0xa3df('0x3f')]){_0x19291f[_0xa3df('0x40')]=[{'all':!![]}];}_0x19291f=_[_0xa3df('0x3e')]({},_0x19291f,_0x1ce2d5['options']);return db[_0xa3df('0x2b')][_0xa3df('0x46')](_0x19291f)[_0xa3df('0x24')](handleEntityNotFound(_0x143e52,null))[_0xa3df('0x24')](respondWithResult(_0x143e52,null))[_0xa3df('0x43')](handleError(_0x143e52,null));};exports[_0xa3df('0x47')]=function(_0xd4a3e6,_0x1ecf2b){return db[_0xa3df('0x2b')][_0xa3df('0x47')](_0xd4a3e6[_0xa3df('0x48')],{})[_0xa3df('0x24')](respondWithResult(_0x1ecf2b,0xc9))[_0xa3df('0x43')](handleError(_0x1ecf2b,null));};exports[_0xa3df('0x23')]=function(_0x2b348e,_0x2e0e36){if(_0x2b348e[_0xa3df('0x48')]['id']){delete _0x2b348e[_0xa3df('0x48')]['id'];}return db['VoiceDialReport'][_0xa3df('0x46')]({'where':{'id':_0x2b348e[_0xa3df('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e0e36,null))[_0xa3df('0x24')](saveUpdates(_0x2b348e[_0xa3df('0x48')],null))[_0xa3df('0x24')](respondWithResult(_0x2e0e36,null))[_0xa3df('0x43')](handleError(_0x2e0e36,null));};exports[_0xa3df('0x25')]=function(_0x374d5d,_0x13a24b){return db[_0xa3df('0x2b')][_0xa3df('0x46')]({'where':{'id':_0x374d5d['params']['id']}})[_0xa3df('0x24')](handleEntityNotFound(_0x13a24b,null))[_0xa3df('0x24')](removeEntity(_0x13a24b,null))[_0xa3df('0x43')](handleError(_0x13a24b,null));};exports[_0xa3df('0x49')]=function(_0x527a39,_0x48ac53){return db[_0xa3df('0x2b')][_0xa3df('0x49')]()[_0xa3df('0x24')](respondWithResult(_0x48ac53,null))[_0xa3df('0x43')](handleError(_0x48ac53,null));}; \ No newline at end of file +var _0x65e9=['offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','sort','filter','where','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','catch','show','params','fields','length','find','create','body','describe','eml-format','request-promise','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/environment','../../mysqldb','sendStatus','end','json'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x65e9,0x1e4));var _0x965e=function(_0x1b9f1a,_0x3284e5){_0x1b9f1a=_0x1b9f1a-0x0;var _0x493c43=_0x65e9[_0x1b9f1a];return _0x493c43;};'use strict';var emlformat=require(_0x965e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x965e('0x1'));var moment=require(_0x965e('0x2'));var BPromise=require(_0x965e('0x3'));var Mustache=require(_0x965e('0x4'));var util=require(_0x965e('0x5'));var path=require(_0x965e('0x6'));var sox=require(_0x965e('0x7'));var csv=require('to-csv');var ejs=require(_0x965e('0x8'));var fs=require('fs');var fs_extra=require(_0x965e('0x9'));var _=require(_0x965e('0xa'));var squel=require('squel');var crypto=require(_0x965e('0xb'));var jsforce=require(_0x965e('0xc'));var deskjs=require(_0x965e('0xd'));var toCsv=require(_0x965e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x965e('0xf'));var authService=require(_0x965e('0x10'));var qs=require(_0x965e('0x11'));var as=require(_0x965e('0x12'));var hardwareService=require(_0x965e('0x13'));var logger=require(_0x965e('0x14'))(_0x965e('0x15'));var utils=require('../../config/utils');var config=require(_0x965e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x965e('0x17'))['db'];function respondWithStatusCode(_0x138e7e,_0x133e66){_0x133e66=_0x133e66||0xcc;return function(_0x52631c){if(_0x52631c){return _0x138e7e[_0x965e('0x18')](_0x133e66);}return _0x138e7e['status'](_0x133e66)[_0x965e('0x19')]();};}function respondWithResult(_0x4e1656,_0x1a6495){_0x1a6495=_0x1a6495||0xc8;return function(_0x311c9b){if(_0x311c9b){return _0x4e1656['status'](_0x1a6495)[_0x965e('0x1a')](_0x311c9b);}};}function respondWithFilteredResult(_0x3601d7,_0x33ee1c){return function(_0x345cc7){if(_0x345cc7){var _0x489317=typeof _0x33ee1c[_0x965e('0x1b')]===_0x965e('0x1c')&&typeof _0x33ee1c[_0x965e('0x1d')]===_0x965e('0x1c');var _0x346a62=_0x345cc7[_0x965e('0x1e')];var _0x46d2cf=_0x489317?0x0:_0x33ee1c[_0x965e('0x1b')];var _0x4661ec=_0x489317?_0x345cc7[_0x965e('0x1e')]:_0x33ee1c[_0x965e('0x1b')]+_0x33ee1c['limit'];var _0x5a92df;if(_0x4661ec>=_0x346a62){_0x4661ec=_0x346a62;_0x5a92df=0xc8;}else{_0x5a92df=0xce;}_0x3601d7[_0x965e('0x1f')](_0x5a92df);return _0x3601d7[_0x965e('0x20')](_0x965e('0x21'),_0x46d2cf+'-'+_0x4661ec+'/'+_0x346a62)[_0x965e('0x1a')](_0x345cc7);}return null;};}function patchUpdates(_0x232a2a){return function(_0x17c918){try{jsonpatch[_0x965e('0x22')](_0x17c918,_0x232a2a,!![]);}catch(_0x36d454){return BPromise['reject'](_0x36d454);}return _0x17c918[_0x965e('0x23')]();};}function saveUpdates(_0x5885eb,_0x3f184b){return function(_0x216063){if(_0x216063){return _0x216063[_0x965e('0x24')](_0x5885eb)[_0x965e('0x25')](function(_0x4a5246){return _0x4a5246;});}return null;};}function removeEntity(_0x1927af,_0x3669cb){return function(_0x24804d){if(_0x24804d){return _0x24804d[_0x965e('0x26')]()['then'](function(){_0x1927af[_0x965e('0x1f')](0xcc)[_0x965e('0x19')]();});}};}function handleEntityNotFound(_0x1f06fa,_0x1b915d){return function(_0x2d6657){if(!_0x2d6657){_0x1f06fa[_0x965e('0x18')](0x194);}return _0x2d6657;};}function handleError(_0x3e938c,_0x34fba0){_0x34fba0=_0x34fba0||0x1f4;return function(_0x2569d1){logger[_0x965e('0x27')](_0x2569d1[_0x965e('0x28')]);if(_0x2569d1[_0x965e('0x29')]){delete _0x2569d1[_0x965e('0x29')];}_0x3e938c[_0x965e('0x1f')](_0x34fba0)[_0x965e('0x2a')](_0x2569d1);};}exports[_0x965e('0x2b')]=function(_0x104e6a,_0x210df8){var _0x55534a={},_0x48adb7={},_0x4ef529={'count':0x0,'rows':[]};var _0x554670=_[_0x965e('0x2c')](db['VoiceDialReport'][_0x965e('0x2d')],function(_0x56effc){return{'name':_0x56effc[_0x965e('0x2e')],'type':_0x56effc[_0x965e('0x2f')][_0x965e('0x30')]};});_0x48adb7[_0x965e('0x31')]=_[_0x965e('0x2c')](_0x554670,_0x965e('0x29'));_0x48adb7[_0x965e('0x32')]=_[_0x965e('0x33')](_0x104e6a[_0x965e('0x32')]);_0x48adb7[_0x965e('0x34')]=_[_0x965e('0x35')](_0x48adb7[_0x965e('0x31')],_0x48adb7[_0x965e('0x32')]);_0x55534a[_0x965e('0x36')]=_['intersection'](_0x48adb7[_0x965e('0x31')],qs['fields'](_0x104e6a[_0x965e('0x32')]['fields']));_0x55534a['attributes']=_0x55534a['attributes']['length']?_0x55534a[_0x965e('0x36')]:_0x48adb7[_0x965e('0x31')];if(!_0x104e6a[_0x965e('0x32')]['hasOwnProperty']('nolimit')){_0x55534a['limit']=qs[_0x965e('0x1d')](_0x104e6a['query'][_0x965e('0x1d')]);_0x55534a[_0x965e('0x1b')]=qs[_0x965e('0x1b')](_0x104e6a[_0x965e('0x32')][_0x965e('0x1b')]);}_0x55534a['order']=qs[_0x965e('0x37')](_0x104e6a[_0x965e('0x32')]['sort']);_0x55534a['where']=qs['filters'](_['pick'](_0x104e6a[_0x965e('0x32')],_0x48adb7[_0x965e('0x34')]),_0x554670);if(_0x104e6a[_0x965e('0x32')][_0x965e('0x38')]){_0x55534a[_0x965e('0x39')]=_[_0x965e('0x3a')](_0x55534a['where'],{'$or':_['map'](_0x554670,function(_0x2410fd){if(_0x2410fd[_0x965e('0x2f')]!==_0x965e('0x3b')){var _0x23e164={};_0x23e164[_0x2410fd['name']]={'$like':'%'+_0x104e6a['query'][_0x965e('0x38')]+'%'};return _0x23e164;}})});}_0x55534a=_['merge']({},_0x55534a,_0x104e6a[_0x965e('0x3c')]);var _0x1be0e4={'where':_0x55534a['where']};return db[_0x965e('0x3d')][_0x965e('0x1e')](_0x1be0e4)[_0x965e('0x25')](function(_0x48d3a0){_0x4ef529[_0x965e('0x1e')]=_0x48d3a0;if(_0x104e6a['query'][_0x965e('0x3e')]){_0x55534a[_0x965e('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x55534a);})[_0x965e('0x25')](function(_0xb64794){_0x4ef529['rows']=_0xb64794;return _0x4ef529;})[_0x965e('0x25')](respondWithFilteredResult(_0x210df8,_0x55534a))[_0x965e('0x40')](handleError(_0x210df8,null));};exports[_0x965e('0x41')]=function(_0x3cad,_0x11b573){var _0x13819f={'raw':!![],'where':{'id':_0x3cad[_0x965e('0x42')]['id']}},_0x21476c={};_0x21476c[_0x965e('0x31')]=_['keys'](db[_0x965e('0x3d')][_0x965e('0x2d')]);_0x21476c[_0x965e('0x32')]=_[_0x965e('0x33')](_0x3cad[_0x965e('0x32')]);_0x21476c[_0x965e('0x34')]=_[_0x965e('0x35')](_0x21476c[_0x965e('0x31')],_0x21476c[_0x965e('0x32')]);_0x13819f['attributes']=_[_0x965e('0x35')](_0x21476c[_0x965e('0x31')],qs['fields'](_0x3cad['query'][_0x965e('0x43')]));_0x13819f[_0x965e('0x36')]=_0x13819f[_0x965e('0x36')][_0x965e('0x44')]?_0x13819f['attributes']:_0x21476c[_0x965e('0x31')];if(_0x3cad[_0x965e('0x32')]['includeAll']){_0x13819f['include']=[{'all':!![]}];}_0x13819f=_['merge']({},_0x13819f,_0x3cad[_0x965e('0x3c')]);return db[_0x965e('0x3d')][_0x965e('0x45')](_0x13819f)['then'](handleEntityNotFound(_0x11b573,null))['then'](respondWithResult(_0x11b573,null))[_0x965e('0x40')](handleError(_0x11b573,null));};exports[_0x965e('0x46')]=function(_0x3487b5,_0x2c2128){return db[_0x965e('0x3d')]['create'](_0x3487b5['body'],{})[_0x965e('0x25')](respondWithResult(_0x2c2128,0xc9))['catch'](handleError(_0x2c2128,null));};exports['update']=function(_0x41be0c,_0x2959e9){if(_0x41be0c[_0x965e('0x47')]['id']){delete _0x41be0c[_0x965e('0x47')]['id'];}return db[_0x965e('0x3d')][_0x965e('0x45')]({'where':{'id':_0x41be0c[_0x965e('0x42')]['id']}})[_0x965e('0x25')](handleEntityNotFound(_0x2959e9,null))[_0x965e('0x25')](saveUpdates(_0x41be0c['body'],null))['then'](respondWithResult(_0x2959e9,null))[_0x965e('0x40')](handleError(_0x2959e9,null));};exports['destroy']=function(_0xe241d0,_0x583036){return db[_0x965e('0x3d')][_0x965e('0x45')]({'where':{'id':_0xe241d0[_0x965e('0x42')]['id']}})[_0x965e('0x25')](handleEntityNotFound(_0x583036,null))[_0x965e('0x25')](removeEntity(_0x583036,null))[_0x965e('0x40')](handleError(_0x583036,null));};exports[_0x965e('0x48')]=function(_0x35728d,_0x781284){return db['VoiceDialReport'][_0x965e('0x48')]()[_0x965e('0x25')](respondWithResult(_0x781284,null))[_0x965e('0x40')](handleError(_0x781284,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 31ce61e..e3330d3 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 _0xe87a=['moment','bluebird','request-promise','path','../../config/environment','exports','define','report_dial','uniqueid','util','../../config/logger','api'];(function(_0x5afab7,_0x32fbc3){var _0x3b15e4=function(_0x58f7d2){while(--_0x58f7d2){_0x5afab7['push'](_0x5afab7['shift']());}};_0x3b15e4(++_0x32fbc3);}(_0xe87a,0xed));var _0xae87=function(_0x43f528,_0x3b1c32){_0x43f528=_0x43f528-0x0;var _0xe0c481=_0xe87a[_0x43f528];return _0xe0c481;};'use strict';var _=require('lodash');var util=require(_0xae87('0x0'));var logger=require(_0xae87('0x1'))(_0xae87('0x2'));var moment=require(_0xae87('0x3'));var BPromise=require(_0xae87('0x4'));var rp=require(_0xae87('0x5'));var fs=require('fs');var path=require(_0xae87('0x6'));var rimraf=require('rimraf');var config=require(_0xae87('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xae87('0x8')]=function(_0x24023c,_0x5d16be){return _0x24023c[_0xae87('0x9')]('VoiceDialReport',attributes,{'tableName':_0xae87('0xa'),'paranoid':![],'indexes':[{'fields':[_0xae87('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5145=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5145,0x93));var _0x5514=function(_0x35f19d,_0x40921c){_0x35f19d=_0x35f19d-0x0;var _0x6bf100=_0x5145[_0x35f19d];return _0x6bf100;};'use strict';var _=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var logger=require(_0x5514('0x2'))('api');var moment=require(_0x5514('0x3'));var BPromise=require('bluebird');var rp=require(_0x5514('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5514('0x5'));var config=require(_0x5514('0x6'));var attributes=require(_0x5514('0x7'));module[_0x5514('0x8')]=function(_0x399032,_0x205a65){return _0x399032[_0x5514('0x9')](_0x5514('0xa'),attributes,{'tableName':_0x5514('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5514('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index aadd267..9cf3c20 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 _0x800a=['where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateVoiceDialReport','create','options','debug','VoiceDialReport','update','body','raw'];(function(_0x507c8f,_0x312b56){var _0x408fd5=function(_0x478863){while(--_0x478863){_0x507c8f['push'](_0x507c8f['shift']());}};_0x408fd5(++_0x312b56);}(_0x800a,0xb8));var _0xa800=function(_0x58d551,_0x4d6f41){_0x58d551=_0x58d551-0x0;var _0x2080e9=_0x800a[_0x58d551];return _0x2080e9;};'use strict';var _=require(_0xa800('0x0'));var util=require(_0xa800('0x1'));var moment=require(_0xa800('0x2'));var BPromise=require('bluebird');var rs=require(_0xa800('0x3'));var fs=require('fs');var Redis=require(_0xa800('0x4'));var db=require(_0xa800('0x5'))['db'];var utils=require(_0xa800('0x6'));var logger=require(_0xa800('0x7'))(_0xa800('0x8'));var config=require(_0xa800('0x9'));var jayson=require(_0xa800('0xa'));var client=jayson[_0xa800('0xb')][_0xa800('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x514555,_0x11219b,_0x128232){return new BPromise(function(_0x132d5d,_0x3831a2){return client[_0xa800('0xd')](_0x514555,_0x128232)[_0xa800('0xe')](function(_0x47be72){logger[_0xa800('0xf')](_0xa800('0x10'),_0x11219b,'request\x20sent');logger['debug'](_0xa800('0x11'),_0x11219b,'request\x20sent',JSON[_0xa800('0x12')](_0x47be72));if(_0x47be72[_0xa800('0x13')]){if(_0x47be72['error'][_0xa800('0x14')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x11219b,_0x47be72[_0xa800('0x13')][_0xa800('0x15')]);return _0x3831a2(_0x47be72[_0xa800('0x13')][_0xa800('0x15')]);}logger[_0xa800('0x13')](_0xa800('0x10'),_0x11219b,_0x47be72[_0xa800('0x13')][_0xa800('0x15')]);return _0x132d5d(_0x47be72[_0xa800('0x13')][_0xa800('0x15')]);}else{logger['info'](_0xa800('0x10'),_0x11219b,_0xa800('0x16'));_0x132d5d(_0x47be72['result'][_0xa800('0x15')]);}})[_0xa800('0x17')](function(_0x26e7ec){logger[_0xa800('0x13')](_0xa800('0x10'),_0x11219b,_0x26e7ec);_0x3831a2(_0x26e7ec);});});}exports[_0xa800('0x18')]=function(_0x1c9b2c){var _0x399580=this;return new Promise(function(_0x1ff44a,_0x22f754){return db['VoiceDialReport'][_0xa800('0x19')](_0x1c9b2c['body'],{'raw':_0x1c9b2c[_0xa800('0x1a')]?_0x1c9b2c[_0xa800('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x791056){logger[_0xa800('0xf')]('CreateVoiceDialReport',_0x1c9b2c);logger[_0xa800('0x1b')](_0xa800('0x18'),_0x1c9b2c,JSON['stringify'](_0x791056));_0x1ff44a(_0x791056);})[_0xa800('0x17')](function(_0x143dee){logger[_0xa800('0x13')](_0xa800('0x18'),_0x143dee[_0xa800('0x15')],_0x1c9b2c);_0x22f754(_0x399580[_0xa800('0x13')](0x1f4,_0x143dee['message']));});});};exports['UpdateVoiceDialReport']=function(_0xe9dc9a){var _0x2c82f3=this;return new Promise(function(_0x3f6d7f,_0x3db405){return db[_0xa800('0x1c')][_0xa800('0x1d')](_0xe9dc9a[_0xa800('0x1e')],{'raw':_0xe9dc9a[_0xa800('0x1a')]?_0xe9dc9a[_0xa800('0x1a')][_0xa800('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9dc9a[_0xa800('0x1a')]?_0xe9dc9a['options'][_0xa800('0x20')]||null:null,'attributes':_0xe9dc9a['options']?_0xe9dc9a[_0xa800('0x1a')][_0xa800('0x21')]||null:null,'limit':_0xe9dc9a[_0xa800('0x1a')]?_0xe9dc9a[_0xa800('0x1a')][_0xa800('0x22')]||null:null})['then'](function(_0x5bdc29){logger[_0xa800('0xf')](_0xa800('0x23'),_0xe9dc9a);logger['debug']('UpdateVoiceDialReport',_0xe9dc9a,JSON['stringify'](_0x5bdc29));_0x3f6d7f(_0x5bdc29);})[_0xa800('0x17')](function(_0x42c9cc){logger['error'](_0xa800('0x23'),_0x42c9cc[_0xa800('0x15')],_0xe9dc9a);_0x3db405(_0x2c82f3[_0xa800('0x13')](0x1f4,_0x42c9cc[_0xa800('0x15')]));});});}; \ No newline at end of file +var _0x2826=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','options','raw','catch','VoiceDialReport','update','body','where','limit','UpdateVoiceDialReport','lodash','moment','ioredis','../../mysqldb'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x2826,0xb0));var _0x6282=function(_0x2c0c25,_0x5b0a19){_0x2c0c25=_0x2c0c25-0x0;var _0x2d8cf8=_0x2826[_0x2c0c25];return _0x2d8cf8;};'use strict';var _=require(_0x6282('0x0'));var util=require('util');var moment=require(_0x6282('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6282('0x2'));var db=require(_0x6282('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6282('0x4'))('rpc');var config=require(_0x6282('0x5'));var jayson=require(_0x6282('0x6'));var client=jayson[_0x6282('0x7')][_0x6282('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x569883,_0x116cc3,_0x3e555c){return new BPromise(function(_0x3d987f,_0x3e8391){return client['request'](_0x569883,_0x3e555c)[_0x6282('0x9')](function(_0x257870){logger[_0x6282('0xa')](_0x6282('0xb'),_0x116cc3,_0x6282('0xc'));logger[_0x6282('0xd')](_0x6282('0xe'),_0x116cc3,_0x6282('0xc'),JSON[_0x6282('0xf')](_0x257870));if(_0x257870[_0x6282('0x10')]){if(_0x257870[_0x6282('0x10')][_0x6282('0x11')]===0x1f4){logger[_0x6282('0x10')](_0x6282('0xb'),_0x116cc3,_0x257870['error'][_0x6282('0x12')]);return _0x3e8391(_0x257870[_0x6282('0x10')][_0x6282('0x12')]);}logger['error'](_0x6282('0xb'),_0x116cc3,_0x257870['error'][_0x6282('0x12')]);return _0x3d987f(_0x257870[_0x6282('0x10')]['message']);}else{logger[_0x6282('0xa')](_0x6282('0xb'),_0x116cc3,_0x6282('0xc'));_0x3d987f(_0x257870[_0x6282('0x13')]['message']);}})['catch'](function(_0x5665b8){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x116cc3,_0x5665b8);_0x3e8391(_0x5665b8);});});}exports[_0x6282('0x14')]=function(_0x112a98){var _0x502fd8=this;return new Promise(function(_0x4b1b8a,_0x36c460){return db['VoiceDialReport']['create'](_0x112a98['body'],{'raw':_0x112a98[_0x6282('0x15')]?_0x112a98[_0x6282('0x15')][_0x6282('0x16')]===undefined?!![]:![]:!![]})[_0x6282('0x9')](function(_0x1e6dc5){logger[_0x6282('0xa')]('CreateVoiceDialReport',_0x112a98);logger[_0x6282('0xd')](_0x6282('0x14'),_0x112a98,JSON['stringify'](_0x1e6dc5));_0x4b1b8a(_0x1e6dc5);})[_0x6282('0x17')](function(_0x44c536){logger[_0x6282('0x10')](_0x6282('0x14'),_0x44c536[_0x6282('0x12')],_0x112a98);_0x36c460(_0x502fd8['error'](0x1f4,_0x44c536[_0x6282('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0xf1182){var _0xd620f8=this;return new Promise(function(_0x6f9cc1,_0x274fd0){return db[_0x6282('0x18')][_0x6282('0x19')](_0xf1182[_0x6282('0x1a')],{'raw':_0xf1182[_0x6282('0x15')]?_0xf1182[_0x6282('0x15')][_0x6282('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1182[_0x6282('0x15')]?_0xf1182[_0x6282('0x15')][_0x6282('0x1b')]||null:null,'attributes':_0xf1182['options']?_0xf1182['options']['attributes']||null:null,'limit':_0xf1182[_0x6282('0x15')]?_0xf1182[_0x6282('0x15')][_0x6282('0x1c')]||null:null})[_0x6282('0x9')](function(_0x4f4284){logger['info'](_0x6282('0x1d'),_0xf1182);logger['debug'](_0x6282('0x1d'),_0xf1182,JSON[_0x6282('0xf')](_0x4f4284));_0x6f9cc1(_0x4f4284);})[_0x6282('0x17')](function(_0x301ebb){logger['error']('UpdateVoiceDialReport',_0x301ebb[_0x6282('0x12')],_0xf1182);_0x274fd0(_0xd620f8['error'](0x1f4,_0x301ebb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 27c9236..b31ee11 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 _0x68ca=['/:id/applications','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ca,0xb9));var _0xa68c=function(_0x1aeef0,_0x2b89eb){_0x1aeef0=_0x1aeef0-0x0;var _0x117217=_0x68ca[_0x1aeef0];return _0x117217;};'use strict';var multer=require(_0xa68c('0x0'));var util=require(_0xa68c('0x1'));var path=require('path');var timeout=require(_0xa68c('0x2'));var express=require(_0xa68c('0x3'));var router=express[_0xa68c('0x4')]();var fs_extra=require(_0xa68c('0x5'));var auth=require(_0xa68c('0x6'));var interaction=require(_0xa68c('0x7'));var config=require('../../config/environment');var controller=require(_0xa68c('0x8'));router[_0xa68c('0x9')]('/',auth[_0xa68c('0xa')](),controller['index']);router[_0xa68c('0x9')](_0xa68c('0xb'),auth[_0xa68c('0xa')](),controller[_0xa68c('0xc')]);router[_0xa68c('0xd')]('/',auth[_0xa68c('0xa')](),controller[_0xa68c('0xe')]);router[_0xa68c('0xd')](_0xa68c('0xf'),auth[_0xa68c('0xa')](),controller['addApplications']);router['put'](_0xa68c('0xb'),auth['isAuthenticated'](),controller[_0xa68c('0x10')]);router[_0xa68c('0x11')](_0xa68c('0xb'),auth[_0xa68c('0xa')](),controller[_0xa68c('0x12')]);module[_0xa68c('0x13')]=router; \ No newline at end of file +var _0xa439=['show','post','create','/:id/applications','addApplications','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','/:id'];(function(_0x392c54,_0x421876){var _0x340cb8=function(_0xdc70b2){while(--_0xdc70b2){_0x392c54['push'](_0x392c54['shift']());}};_0x340cb8(++_0x421876);}(_0xa439,0x8d));var _0x9a43=function(_0x43d145,_0x16128d){_0x43d145=_0x43d145-0x0;var _0x3f0ed2=_0xa439[_0x43d145];return _0x3f0ed2;};'use strict';var multer=require(_0x9a43('0x0'));var util=require(_0x9a43('0x1'));var path=require(_0x9a43('0x2'));var timeout=require(_0x9a43('0x3'));var express=require(_0x9a43('0x4'));var router=express[_0x9a43('0x5')]();var fs_extra=require(_0x9a43('0x6'));var auth=require(_0x9a43('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9a43('0x8'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x9a43('0x9')](),controller['index']);router['get'](_0x9a43('0xa'),auth['isAuthenticated'](),controller[_0x9a43('0xb')]);router[_0x9a43('0xc')]('/',auth[_0x9a43('0x9')](),controller[_0x9a43('0xd')]);router['post'](_0x9a43('0xe'),auth[_0x9a43('0x9')](),controller[_0x9a43('0xf')]);router[_0x9a43('0x10')](_0x9a43('0xa'),auth[_0x9a43('0x9')](),controller[_0x9a43('0x11')]);router['delete'](_0x9a43('0xa'),auth[_0x9a43('0x9')](),controller['destroy']);module[_0x9a43('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 4f3e886..4fceef4 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 _0x64f7=['inbound','outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM'];(function(_0x191fb4,_0x2f7dc7){var _0x1474bb=function(_0x50d02e){while(--_0x50d02e){_0x191fb4['push'](_0x191fb4['shift']());}};_0x1474bb(++_0x2f7dc7);}(_0x64f7,0xd8));var _0x764f=function(_0x145201,_0xe5a96a){_0x145201=_0x145201-0x0;var _0x675a29=_0x64f7[_0x145201];return _0x675a29;};'use strict';var Sequelize=require(_0x764f('0x0'));module['exports']={'context':{'type':Sequelize[_0x764f('0x1')],'allowNull':![],'unique':_0x764f('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x764f('0x2')},'priority':{'type':Sequelize[_0x764f('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x764f('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x764f('0x1')],'allowNull':![],'defaultValue':_0x764f('0x3')},'appdata':{'type':Sequelize[_0x764f('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x764f('0x4')](_0x764f('0x5'),_0x764f('0x6'),'internal',_0x764f('0x7'),_0x764f('0x8'),_0x764f('0x9'),_0x764f('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x764f('0x1')]},'interval':{'type':Sequelize[_0x764f('0x1')],'allowNull':![],'defaultValue':_0x764f('0xb')},'IntervalId':{'type':Sequelize[_0x764f('0xc')]},'isApp':{'type':Sequelize[_0x764f('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x764f('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x764f('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x764f('0xc')]},'recordingFormat':{'type':Sequelize[_0x764f('0x1')],'defaultValue':_0x764f('0xe')},'answer':{'type':Sequelize[_0x764f('0xd')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f50cb){return this[_0x764f('0xf')](_0x764f('0x10'));}},'alias':{'type':Sequelize[_0x764f('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x1d24=['compositeIndex','STRING','NoOp','ENUM','inbound','internal','any','*,*,*,*','BOOLEAN','VIRTUAL','exten','sequelize','exports'];(function(_0x252d0b,_0x4c1c60){var _0x30ee18=function(_0xa42df){while(--_0xa42df){_0x252d0b['push'](_0x252d0b['shift']());}};_0x30ee18(++_0x4c1c60);}(_0x1d24,0x1df));var _0x41d2=function(_0x12e682,_0x33f3a3){_0x12e682=_0x12e682-0x0;var _0x26e600=_0x1d24[_0x12e682];return _0x26e600;};'use strict';var Sequelize=require(_0x41d2('0x0'));module[_0x41d2('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x41d2('0x2')},'priority':{'type':Sequelize[_0x41d2('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x41d2('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x41d2('0x3')],'allowNull':![],'defaultValue':_0x41d2('0x4')},'appdata':{'type':Sequelize[_0x41d2('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x41d2('0x5')](_0x41d2('0x6'),'outbound',_0x41d2('0x7'),'inbound-fax','outbound-fax','system',_0x41d2('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x41d2('0x3')],'allowNull':![],'defaultValue':_0x41d2('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x41d2('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x41d2('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x41d2('0x3')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x41d2('0xb')],'get':function(_0x1918b6){return this['getDataValue'](_0x41d2('0xc'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ec57d95..3ba9d74 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 _0x8bc5=['findAndCountAll','stack','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','destroy','outbound','InternalRoutes','internal','filter','ignore','includes','type','find','value','name','UserProfileResource','then','end','sendStatus','error','send','index','fieldName','key','map','keys','query','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filters','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','rawAttributes','length','merge','params','startsWith','exten','body','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','inbound','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate'];(function(_0x509eea,_0x3ab965){var _0x29024e=function(_0x42b894){while(--_0x42b894){_0x509eea['push'](_0x509eea['shift']());}};_0x29024e(++_0x3ab965);}(_0x8bc5,0xc2));var _0x58bc=function(_0x514fcb,_0x55f11e){_0x514fcb=_0x514fcb-0x0;var _0x4c2897=_0x8bc5[_0x514fcb];return _0x4c2897;};'use strict';var _=require(_0x58bc('0x0'));var Redis=require(_0x58bc('0x1'));var qs=require(_0x58bc('0x2'));var logger=require('../../config/logger')('api');var config=require(_0x58bc('0x3'));var db=require(_0x58bc('0x4'))['db'];config[_0x58bc('0x5')]=_[_0x58bc('0x6')](config[_0x58bc('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x58bc('0x7'))(new Redis(config[_0x58bc('0x5')]));require(_0x58bc('0x8'))[_0x58bc('0x9')](socket);function respondWithStatusCode(_0x39b670,_0x25c9c2){_0x25c9c2=_0x25c9c2||0xcc;return function(_0xc87d26){if(_0xc87d26){return _0x39b670['sendStatus'](_0x25c9c2);}return _0x39b670[_0x58bc('0xa')](_0x25c9c2)['end']();};}function respondWithResult(_0x94f734,_0x151e57){_0x151e57=_0x151e57||0xc8;return function(_0x5248ca){if(_0x5248ca){return _0x94f734[_0x58bc('0xa')](_0x151e57)[_0x58bc('0xb')](_0x5248ca);}};}function respondWithFilteredResult(_0xb853dd,_0x5e61a6){return function(_0x1ceff4){if(_0x1ceff4){var _0x33d3c8=typeof _0x5e61a6[_0x58bc('0xc')]===_0x58bc('0xd')&&typeof _0x5e61a6[_0x58bc('0xe')]===_0x58bc('0xd');var _0x420fa5=_0x1ceff4[_0x58bc('0xf')];var _0x384953=_0x33d3c8?0x0:_0x5e61a6[_0x58bc('0xc')];var _0x341de6=_0x33d3c8?_0x1ceff4[_0x58bc('0xf')]:_0x5e61a6[_0x58bc('0xc')]+_0x5e61a6[_0x58bc('0xe')];var _0x61e632;if(_0x341de6>=_0x420fa5){_0x341de6=_0x420fa5;_0x61e632=0xc8;}else{_0x61e632=0xce;}_0xb853dd[_0x58bc('0xa')](_0x61e632);return _0xb853dd[_0x58bc('0x10')](_0x58bc('0x11'),_0x384953+'-'+_0x341de6+'/'+_0x420fa5)[_0x58bc('0xb')](_0x1ceff4);}return null;};}function removeEntity(_0x36690b){return function(_0x39f3da){if(_0x39f3da){return _0x39f3da[_0x58bc('0x12')]()['then'](function(){var _0x19b6a8=_0x39f3da['get']({'plain':!![]});var _0x3d456b=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x58bc('0x13'),'ignore':![]},{'name':_0x58bc('0x14'),'value':_0x58bc('0x15'),'ignore':![]}];var _0x441163=_(_0x3d456b)[_0x58bc('0x16')](_0x58bc('0x17'))['map']('value')['value']();if(_[_0x58bc('0x18')](_0x441163,_0x19b6a8[_0x58bc('0x19')])){return;}var _0x7fee8d=_[_0x58bc('0x1a')](_0x3d456b,[_0x58bc('0x1b'),_0x19b6a8[_0x58bc('0x19')]])[_0x58bc('0x1c')];return db[_0x58bc('0x1d')][_0x58bc('0x12')]({'where':{'type':_0x7fee8d,'resourceId':_0x19b6a8['id']}})[_0x58bc('0x1e')](function(){return _0x39f3da;});})[_0x58bc('0x1e')](function(){_0x36690b[_0x58bc('0xa')](0xcc)[_0x58bc('0x1f')]();});}};}function handleEntityNotFound(_0x5eeca2){return function(_0x4063cb){if(!_0x4063cb){_0x5eeca2[_0x58bc('0x20')](0x194);}return _0x4063cb;};}function handleError(_0x17daf0,_0x5274ca){_0x5274ca=_0x5274ca||0x1f4;return function(_0x477faf){logger[_0x58bc('0x21')](_0x477faf['stack']);if(_0x477faf[_0x58bc('0x1c')]){delete _0x477faf['name'];}_0x17daf0[_0x58bc('0xa')](_0x5274ca)[_0x58bc('0x22')](_0x477faf);};}exports[_0x58bc('0x23')]=function(_0x151907,_0x15c5f0){var _0x403c65={},_0x3a7967={},_0xea1b51={'count':0x0,'rows':[]};var _0x83344e=_['map'](db['VoiceExtension']['rawAttributes'],function(_0xc0a366){return{'name':_0xc0a366[_0x58bc('0x24')],'type':_0xc0a366[_0x58bc('0x19')][_0x58bc('0x25')]};});_0x3a7967['model']=_[_0x58bc('0x26')](_0x83344e,_0x58bc('0x1c'));_0x3a7967['query']=_[_0x58bc('0x27')](_0x151907[_0x58bc('0x28')]);_0x3a7967['filters']=_[_0x58bc('0x29')](_0x3a7967['model'],_0x3a7967[_0x58bc('0x28')]);_0x403c65[_0x58bc('0x2a')]=_[_0x58bc('0x29')](_0x3a7967[_0x58bc('0x2b')],qs[_0x58bc('0x2c')](_0x151907[_0x58bc('0x28')][_0x58bc('0x2c')]));_0x403c65[_0x58bc('0x2a')]=_0x403c65[_0x58bc('0x2a')]['length']?_0x403c65[_0x58bc('0x2a')]:_0x3a7967[_0x58bc('0x2b')];if(!_0x151907[_0x58bc('0x28')][_0x58bc('0x2d')]('nolimit')){_0x403c65[_0x58bc('0xe')]=qs[_0x58bc('0xe')](_0x151907['query'][_0x58bc('0xe')]);_0x403c65[_0x58bc('0xc')]=qs['offset'](_0x151907['query'][_0x58bc('0xc')]);}_0x403c65[_0x58bc('0x2e')]=qs[_0x58bc('0x2f')](_0x151907[_0x58bc('0x28')][_0x58bc('0x2f')]);_0x403c65[_0x58bc('0x30')]=qs[_0x58bc('0x31')](_['pick'](_0x151907['query'],_0x3a7967[_0x58bc('0x31')]),_0x83344e);if(_0x151907['query']['filter']){_0x403c65[_0x58bc('0x30')]=_['merge'](_0x403c65['where'],{'$or':_['map'](_0x83344e,function(_0x27405b){if(_0x27405b['type']!==_0x58bc('0x32')){var _0x57b03b={};_0x57b03b[_0x27405b['name']]={'$like':'%'+_0x151907[_0x58bc('0x28')]['filter']+'%'};return _0x57b03b;}})});}_0x403c65=_['merge']({},_0x403c65,_0x151907[_0x58bc('0x33')]);var _0x62b8e7={'where':_0x403c65[_0x58bc('0x30')]};return db[_0x58bc('0x34')][_0x58bc('0xf')](_0x62b8e7)[_0x58bc('0x1e')](function(_0x2b0555){_0xea1b51[_0x58bc('0xf')]=_0x2b0555;if(_0x151907[_0x58bc('0x28')][_0x58bc('0x35')]){_0x403c65[_0x58bc('0x36')]=[{'all':!![]}];}return db[_0x58bc('0x34')]['findAll'](_0x403c65);})['then'](function(_0x1a9b90){_0xea1b51[_0x58bc('0x37')]=_0x1a9b90;return _0xea1b51;})['then'](respondWithFilteredResult(_0x15c5f0,_0x403c65))[_0x58bc('0x38')](handleError(_0x15c5f0,null));};exports[_0x58bc('0x39')]=function(_0x2a4310,_0x3b5007){var _0x1bb693={'raw':![],'where':{'id':_0x2a4310['params']['id']}},_0x477934={};_0x477934[_0x58bc('0x2b')]=_[_0x58bc('0x27')](db[_0x58bc('0x34')][_0x58bc('0x3a')]);_0x477934[_0x58bc('0x28')]=_[_0x58bc('0x27')](_0x2a4310[_0x58bc('0x28')]);_0x477934[_0x58bc('0x31')]=_[_0x58bc('0x29')](_0x477934['model'],_0x477934[_0x58bc('0x28')]);_0x1bb693[_0x58bc('0x2a')]=_[_0x58bc('0x29')](_0x477934[_0x58bc('0x2b')],qs[_0x58bc('0x2c')](_0x2a4310[_0x58bc('0x28')]['fields']));_0x1bb693[_0x58bc('0x2a')]=_0x1bb693['attributes'][_0x58bc('0x3b')]?_0x1bb693[_0x58bc('0x2a')]:_0x477934[_0x58bc('0x2b')];if(_0x2a4310[_0x58bc('0x28')][_0x58bc('0x35')]){_0x1bb693[_0x58bc('0x36')]=[{'all':!![]}];}_0x1bb693=_[_0x58bc('0x3c')]({},_0x1bb693,_0x2a4310[_0x58bc('0x33')]);return db['VoiceExtension'][_0x58bc('0x1a')](_0x1bb693)[_0x58bc('0x1e')](handleEntityNotFound(_0x3b5007,null))[_0x58bc('0x1e')](respondWithResult(_0x3b5007,null))[_0x58bc('0x38')](handleError(_0x3b5007,null));};exports[_0x58bc('0x12')]=function(_0x1eba08,_0x36d157){return db[_0x58bc('0x34')][_0x58bc('0x1a')]({'where':{'id':_0x1eba08[_0x58bc('0x3d')]['id']}})['then'](handleEntityNotFound(_0x36d157,null))[_0x58bc('0x1e')](removeEntity(_0x36d157,null))[_0x58bc('0x38')](handleError(_0x36d157,null));};exports['create']=function(_0x1907d4,_0x1b1856){if(_0x1907d4['body'][_0x58bc('0x19')]===_0x58bc('0x13')&&!_[_0x58bc('0x3e')](_0x1907d4['body'][_0x58bc('0x3f')],'_')){_0x1907d4[_0x58bc('0x40')][_0x58bc('0x3f')]='_'[_0x58bc('0x41')](_0x1907d4['body']['exten']);}return db[_0x58bc('0x34')][_0x58bc('0x42')](_0x1907d4[_0x58bc('0x40')],{'raw':![]})[_0x58bc('0x1e')](function(_0x1880df){var _0x352032=_0x1907d4[_0x58bc('0x43')][_0x58bc('0x44')]({'plain':!![]});if(!_0x352032)throw new Error(_0x58bc('0x45'));if(_0x352032[_0x58bc('0x46')]===_0x58bc('0x43')){var _0x1925e1=_0x1880df[_0x58bc('0x44')]({'plain':!![]});var _0x672927=[{'name':_0x58bc('0x47'),'value':_0x58bc('0x48')},{'name':_0x58bc('0x49'),'value':_0x58bc('0x13')},{'name':_0x58bc('0x14'),'value':'internal'}];var _0x2ccf87=_['find'](_0x672927,['value',_0x1925e1[_0x58bc('0x19')]])[_0x58bc('0x1c')];return db[_0x58bc('0x4a')]['find']({'where':{'name':_0x2ccf87,'userProfileId':_0x352032[_0x58bc('0x4b')]},'raw':!![]})[_0x58bc('0x1e')](function(_0x1af7be){if(_0x1af7be&&_0x1af7be[_0x58bc('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x1925e1[_0x58bc('0x1c')],'resourceId':_0x1925e1['id'],'type':_0x1af7be['name'],'sectionId':_0x1af7be['id']},{})[_0x58bc('0x1e')](function(){return _0x1880df;});}else{return _0x1880df;}})[_0x58bc('0x38')](function(_0x268001){logger[_0x58bc('0x21')](_0x58bc('0x4d'),_0x268001);throw _0x268001;});}return _0x1880df;})[_0x58bc('0x1e')](respondWithResult(_0x1b1856,0xc9))[_0x58bc('0x38')](handleError(_0x1b1856,null));};exports['update']=function(_0x5be6c9,_0x45d70b){if(_0x5be6c9[_0x58bc('0x40')]['id']){delete _0x5be6c9['body']['id'];}return db[_0x58bc('0x34')][_0x58bc('0x1a')]({'where':{'id':_0x5be6c9[_0x58bc('0x3d')]['id']}})[_0x58bc('0x1e')](handleEntityNotFound(_0x45d70b,null))[_0x58bc('0x1e')](function(_0x3b6878){if(_0x3b6878){return db[_0x58bc('0x34')][_0x58bc('0x4e')](_[_0x58bc('0x4f')](_0x5be6c9[_0x58bc('0x40')],['exten',_0x58bc('0x50'),_0x58bc('0x51'),'recordingFormat',_0x58bc('0x52'),_0x58bc('0x53'),_0x58bc('0x54')]),{'where':{'context':_0x3b6878[_0x58bc('0x50')],'exten':_0x3b6878[_0x58bc('0x3f')]},'individualHooks':!![]})[_0x58bc('0x1e')](function(_0x5778f3){return _0x5778f3;});}return null;})[_0x58bc('0x1e')](respondWithStatusCode(_0x45d70b,null))[_0x58bc('0x38')](handleError(_0x45d70b,null));};exports[_0x58bc('0x55')]=function(_0x319d8c,_0x18ea73){var _0x5a587f=_0x319d8c[_0x58bc('0x3d')]['id'];var _0x5aed6a=_0x319d8c['body'];var _0x2509ea=0xc8;var _0x85f852=null;return db[_0x58bc('0x56')][_0x58bc('0x57')]({'isolationLevel':db[_0x58bc('0x56')]['Transaction']['ISOLATION_LEVELS'][_0x58bc('0x58')]},function(_0x2f5ebd){return db[_0x58bc('0x34')][_0x58bc('0x59')]({'where':{'id':_0x5a587f},'transaction':_0x2f5ebd})[_0x58bc('0x1e')](function(_0x4d1234){if(_0x4d1234){return db[_0x58bc('0x34')]['destroy']({'where':{'VoiceExtensionId':_0x5a587f},'transaction':_0x2f5ebd})[_0x58bc('0x1e')](function(){var _0x5dbf02=_[_0x58bc('0x26')](_0x5aed6a,function(_0xd8570c){_0xd8570c[_0x58bc('0x5a')]=_0x5a587f;_0xd8570c[_0x58bc('0x5b')]=!![];return _0xd8570c;});return _0x4d1234[_0x58bc('0x5c')](_0x5dbf02);})['then'](function(_0xa8a01b){return db[_0x58bc('0x34')][_0x58bc('0x5d')](_0xa8a01b,{'transaction':_0x2f5ebd});});}else{_0x2509ea=0x194;_0x85f852=[];}});})[_0x58bc('0x1e')](function(){if(_0x2509ea!==0x194){return db[_0x58bc('0x34')][_0x58bc('0x5e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5a587f},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x6dcebd){_0x85f852=_0x6dcebd;});}})[_0x58bc('0x38')](function(_0x1d09a4){_0x2509ea=0x1f4;logger['error'](_0x1d09a4[_0x58bc('0x5f')]);if(_0x1d09a4['name']){delete _0x1d09a4[_0x58bc('0x1c')];}_0x85f852=_0x1d09a4;})['finally'](function(){if(_0x85f852===null){_0x18ea73[_0x58bc('0x20')](_0x2509ea);}else{if(_0x2509ea===0x1f4){_0x18ea73['status'](_0x2509ea)['send'](_0x85f852);}else{_0x18ea73[_0x58bc('0xa')](_0x2509ea)['json'](_0x85f852);}}});}; \ No newline at end of file +var _0xd5e2=['addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','destroy','then','get','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','VIRTUAL','options','includeAll','include','VoiceExtension','findAll','catch','show','params','intersection','length','create','body','outbound','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','error','update','pick','description','recordingFormat','mandatoryDisposition','alias'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd5e2,0xc7));var _0x2d5e=function(_0x3a3aa2,_0x16fada){_0x3a3aa2=_0x3a3aa2-0x0;var _0x2beb2a=_0xd5e2[_0x3a3aa2];return _0x2beb2a;};'use strict';var _=require(_0x2d5e('0x0'));var Redis=require(_0x2d5e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2d5e('0x2'))(_0x2d5e('0x3'));var config=require(_0x2d5e('0x4'));var db=require(_0x2d5e('0x5'))['db'];config[_0x2d5e('0x6')]=_[_0x2d5e('0x7')](config[_0x2d5e('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d5e('0x8'))(new Redis(config[_0x2d5e('0x6')]));require(_0x2d5e('0x9'))['register'](socket);function respondWithStatusCode(_0xd8e547,_0x27f98d){_0x27f98d=_0x27f98d||0xcc;return function(_0x7c324a){if(_0x7c324a){return _0xd8e547[_0x2d5e('0xa')](_0x27f98d);}return _0xd8e547[_0x2d5e('0xb')](_0x27f98d)[_0x2d5e('0xc')]();};}function respondWithResult(_0x8e6703,_0x6660b5){_0x6660b5=_0x6660b5||0xc8;return function(_0x53277b){if(_0x53277b){return _0x8e6703['status'](_0x6660b5)['json'](_0x53277b);}};}function respondWithFilteredResult(_0xaf6714,_0x4cacf2){return function(_0x1a6d5f){if(_0x1a6d5f){var _0x258339=typeof _0x4cacf2['offset']===_0x2d5e('0xd')&&typeof _0x4cacf2['limit']===_0x2d5e('0xd');var _0x2805fe=_0x1a6d5f[_0x2d5e('0xe')];var _0xaae883=_0x258339?0x0:_0x4cacf2[_0x2d5e('0xf')];var _0x2cb344=_0x258339?_0x1a6d5f['count']:_0x4cacf2['offset']+_0x4cacf2[_0x2d5e('0x10')];var _0x270c20;if(_0x2cb344>=_0x2805fe){_0x2cb344=_0x2805fe;_0x270c20=0xc8;}else{_0x270c20=0xce;}_0xaf6714[_0x2d5e('0xb')](_0x270c20);return _0xaf6714['set'](_0x2d5e('0x11'),_0xaae883+'-'+_0x2cb344+'/'+_0x2805fe)[_0x2d5e('0x12')](_0x1a6d5f);}return null;};}function removeEntity(_0x3c03e8){return function(_0x530099){if(_0x530099){return _0x530099[_0x2d5e('0x13')]()[_0x2d5e('0x14')](function(){var _0x48a645=_0x530099[_0x2d5e('0x15')]({'plain':!![]});var _0xec82b0=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x2d5e('0x16'),'value':'outbound','ignore':![]},{'name':_0x2d5e('0x17'),'value':_0x2d5e('0x18'),'ignore':![]}];var _0x1f73e3=_(_0xec82b0)[_0x2d5e('0x19')](_0x2d5e('0x1a'))[_0x2d5e('0x1b')](_0x2d5e('0x1c'))[_0x2d5e('0x1c')]();if(_[_0x2d5e('0x1d')](_0x1f73e3,_0x48a645['type'])){return;}var _0x26cffb=_[_0x2d5e('0x1e')](_0xec82b0,[_0x2d5e('0x1c'),_0x48a645[_0x2d5e('0x1f')]])['name'];return db[_0x2d5e('0x20')][_0x2d5e('0x13')]({'where':{'type':_0x26cffb,'resourceId':_0x48a645['id']}})[_0x2d5e('0x14')](function(){return _0x530099;});})[_0x2d5e('0x14')](function(){_0x3c03e8[_0x2d5e('0xb')](0xcc)[_0x2d5e('0xc')]();});}};}function handleEntityNotFound(_0x3dcebe){return function(_0x162613){if(!_0x162613){_0x3dcebe[_0x2d5e('0xa')](0x194);}return _0x162613;};}function handleError(_0x356ed7,_0xd38886){_0xd38886=_0xd38886||0x1f4;return function(_0x169669){logger['error'](_0x169669[_0x2d5e('0x21')]);if(_0x169669[_0x2d5e('0x22')]){delete _0x169669[_0x2d5e('0x22')];}_0x356ed7['status'](_0xd38886)[_0x2d5e('0x23')](_0x169669);};}exports[_0x2d5e('0x24')]=function(_0xba3051,_0x10538f){var _0x25e3b0={},_0x578e0d={},_0x4365ff={'count':0x0,'rows':[]};var _0x26a402=_[_0x2d5e('0x1b')](db['VoiceExtension'][_0x2d5e('0x25')],function(_0x2835b9){return{'name':_0x2835b9[_0x2d5e('0x26')],'type':_0x2835b9[_0x2d5e('0x1f')]['key']};});_0x578e0d[_0x2d5e('0x27')]=_[_0x2d5e('0x1b')](_0x26a402,_0x2d5e('0x22'));_0x578e0d[_0x2d5e('0x28')]=_[_0x2d5e('0x29')](_0xba3051[_0x2d5e('0x28')]);_0x578e0d[_0x2d5e('0x2a')]=_['intersection'](_0x578e0d['model'],_0x578e0d[_0x2d5e('0x28')]);_0x25e3b0[_0x2d5e('0x2b')]=_['intersection'](_0x578e0d[_0x2d5e('0x27')],qs[_0x2d5e('0x2c')](_0xba3051[_0x2d5e('0x28')][_0x2d5e('0x2c')]));_0x25e3b0[_0x2d5e('0x2b')]=_0x25e3b0[_0x2d5e('0x2b')]['length']?_0x25e3b0['attributes']:_0x578e0d[_0x2d5e('0x27')];if(!_0xba3051['query']['hasOwnProperty'](_0x2d5e('0x2d'))){_0x25e3b0[_0x2d5e('0x10')]=qs[_0x2d5e('0x10')](_0xba3051['query'][_0x2d5e('0x10')]);_0x25e3b0[_0x2d5e('0xf')]=qs[_0x2d5e('0xf')](_0xba3051[_0x2d5e('0x28')][_0x2d5e('0xf')]);}_0x25e3b0[_0x2d5e('0x2e')]=qs[_0x2d5e('0x2f')](_0xba3051[_0x2d5e('0x28')][_0x2d5e('0x2f')]);_0x25e3b0[_0x2d5e('0x30')]=qs['filters'](_['pick'](_0xba3051[_0x2d5e('0x28')],_0x578e0d[_0x2d5e('0x2a')]),_0x26a402);if(_0xba3051['query'][_0x2d5e('0x19')]){_0x25e3b0[_0x2d5e('0x30')]=_['merge'](_0x25e3b0[_0x2d5e('0x30')],{'$or':_[_0x2d5e('0x1b')](_0x26a402,function(_0x5962f3){if(_0x5962f3[_0x2d5e('0x1f')]!==_0x2d5e('0x31')){var _0x11383a={};_0x11383a[_0x5962f3[_0x2d5e('0x22')]]={'$like':'%'+_0xba3051[_0x2d5e('0x28')]['filter']+'%'};return _0x11383a;}})});}_0x25e3b0=_['merge']({},_0x25e3b0,_0xba3051[_0x2d5e('0x32')]);var _0x13005c={'where':_0x25e3b0[_0x2d5e('0x30')]};return db['VoiceExtension'][_0x2d5e('0xe')](_0x13005c)[_0x2d5e('0x14')](function(_0x1ab969){_0x4365ff['count']=_0x1ab969;if(_0xba3051[_0x2d5e('0x28')][_0x2d5e('0x33')]){_0x25e3b0[_0x2d5e('0x34')]=[{'all':!![]}];}return db[_0x2d5e('0x35')][_0x2d5e('0x36')](_0x25e3b0);})[_0x2d5e('0x14')](function(_0x1b01f0){_0x4365ff['rows']=_0x1b01f0;return _0x4365ff;})[_0x2d5e('0x14')](respondWithFilteredResult(_0x10538f,_0x25e3b0))[_0x2d5e('0x37')](handleError(_0x10538f,null));};exports[_0x2d5e('0x38')]=function(_0x34058f,_0x17aca0){var _0x3329a1={'raw':![],'where':{'id':_0x34058f[_0x2d5e('0x39')]['id']}},_0x2a6543={};_0x2a6543[_0x2d5e('0x27')]=_[_0x2d5e('0x29')](db[_0x2d5e('0x35')][_0x2d5e('0x25')]);_0x2a6543[_0x2d5e('0x28')]=_[_0x2d5e('0x29')](_0x34058f['query']);_0x2a6543['filters']=_[_0x2d5e('0x3a')](_0x2a6543[_0x2d5e('0x27')],_0x2a6543[_0x2d5e('0x28')]);_0x3329a1['attributes']=_[_0x2d5e('0x3a')](_0x2a6543[_0x2d5e('0x27')],qs[_0x2d5e('0x2c')](_0x34058f[_0x2d5e('0x28')]['fields']));_0x3329a1[_0x2d5e('0x2b')]=_0x3329a1[_0x2d5e('0x2b')][_0x2d5e('0x3b')]?_0x3329a1[_0x2d5e('0x2b')]:_0x2a6543['model'];if(_0x34058f[_0x2d5e('0x28')][_0x2d5e('0x33')]){_0x3329a1[_0x2d5e('0x34')]=[{'all':!![]}];}_0x3329a1=_['merge']({},_0x3329a1,_0x34058f[_0x2d5e('0x32')]);return db[_0x2d5e('0x35')][_0x2d5e('0x1e')](_0x3329a1)[_0x2d5e('0x14')](handleEntityNotFound(_0x17aca0,null))['then'](respondWithResult(_0x17aca0,null))[_0x2d5e('0x37')](handleError(_0x17aca0,null));};exports[_0x2d5e('0x13')]=function(_0x5aff5f,_0x3edf7c){return db[_0x2d5e('0x35')][_0x2d5e('0x1e')]({'where':{'id':_0x5aff5f[_0x2d5e('0x39')]['id']}})[_0x2d5e('0x14')](handleEntityNotFound(_0x3edf7c,null))[_0x2d5e('0x14')](removeEntity(_0x3edf7c,null))[_0x2d5e('0x37')](handleError(_0x3edf7c,null));};exports[_0x2d5e('0x3c')]=function(_0x1daef5,_0x52f019){if(_0x1daef5[_0x2d5e('0x3d')][_0x2d5e('0x1f')]===_0x2d5e('0x3e')&&!_[_0x2d5e('0x3f')](_0x1daef5[_0x2d5e('0x3d')][_0x2d5e('0x40')],'_')){_0x1daef5[_0x2d5e('0x3d')][_0x2d5e('0x40')]='_'[_0x2d5e('0x41')](_0x1daef5[_0x2d5e('0x3d')]['exten']);}return db[_0x2d5e('0x35')][_0x2d5e('0x3c')](_0x1daef5[_0x2d5e('0x3d')],{'raw':![]})['then'](function(_0xb96ded){var _0x5e857e=_0x1daef5['user'][_0x2d5e('0x15')]({'plain':!![]});if(!_0x5e857e)throw new Error(_0x2d5e('0x42'));if(_0x5e857e[_0x2d5e('0x43')]===_0x2d5e('0x44')){var _0x123f39=_0xb96ded['get']({'plain':!![]});var _0x5ce3df=[{'name':_0x2d5e('0x45'),'value':'inbound'},{'name':_0x2d5e('0x16'),'value':_0x2d5e('0x3e')},{'name':_0x2d5e('0x17'),'value':_0x2d5e('0x18')}];var _0x22208d=_[_0x2d5e('0x1e')](_0x5ce3df,[_0x2d5e('0x1c'),_0x123f39[_0x2d5e('0x1f')]])[_0x2d5e('0x22')];return db[_0x2d5e('0x46')][_0x2d5e('0x1e')]({'where':{'name':_0x22208d,'userProfileId':_0x5e857e[_0x2d5e('0x47')]},'raw':!![]})[_0x2d5e('0x14')](function(_0x14a38d){if(_0x14a38d&&_0x14a38d[_0x2d5e('0x48')]===0x0){return db[_0x2d5e('0x20')][_0x2d5e('0x3c')]({'name':_0x123f39['name'],'resourceId':_0x123f39['id'],'type':_0x14a38d[_0x2d5e('0x22')],'sectionId':_0x14a38d['id']},{})[_0x2d5e('0x14')](function(){return _0xb96ded;});}else{return _0xb96ded;}})[_0x2d5e('0x37')](function(_0x1aa71f){logger[_0x2d5e('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1aa71f);throw _0x1aa71f;});}return _0xb96ded;})[_0x2d5e('0x14')](respondWithResult(_0x52f019,0xc9))['catch'](handleError(_0x52f019,null));};exports[_0x2d5e('0x4a')]=function(_0x7cb8ce,_0x4fb5f7){if(_0x7cb8ce[_0x2d5e('0x3d')]['id']){delete _0x7cb8ce['body']['id'];}return db[_0x2d5e('0x35')][_0x2d5e('0x1e')]({'where':{'id':_0x7cb8ce[_0x2d5e('0x39')]['id']}})[_0x2d5e('0x14')](handleEntityNotFound(_0x4fb5f7,null))['then'](function(_0x2eac51){if(_0x2eac51){return db[_0x2d5e('0x35')][_0x2d5e('0x4a')](_[_0x2d5e('0x4b')](_0x7cb8ce[_0x2d5e('0x3d')],['exten','context',_0x2d5e('0x4c'),_0x2d5e('0x4d'),'cutdigits',_0x2d5e('0x4e'),_0x2d5e('0x4f')]),{'where':{'context':_0x2eac51['context'],'exten':_0x2eac51[_0x2d5e('0x40')]},'individualHooks':!![]})['then'](function(_0x2fa223){return _0x2fa223;});}return null;})[_0x2d5e('0x14')](respondWithStatusCode(_0x4fb5f7,null))['catch'](handleError(_0x4fb5f7,null));};exports[_0x2d5e('0x50')]=function(_0x415fc8,_0x4b4e5d){var _0x12c7ac=_0x415fc8['params']['id'];var _0x556ce9=_0x415fc8[_0x2d5e('0x3d')];var _0x5417b4=0xc8;var _0x8b49c4=null;return db[_0x2d5e('0x51')][_0x2d5e('0x52')]({'isolationLevel':db['sequelize']['Transaction'][_0x2d5e('0x53')][_0x2d5e('0x54')]},function(_0x26c82e){return db[_0x2d5e('0x35')][_0x2d5e('0x55')]({'where':{'id':_0x12c7ac},'transaction':_0x26c82e})[_0x2d5e('0x14')](function(_0x852995){if(_0x852995){return db[_0x2d5e('0x35')][_0x2d5e('0x13')]({'where':{'VoiceExtensionId':_0x12c7ac},'transaction':_0x26c82e})['then'](function(){var _0x41adfb=_[_0x2d5e('0x1b')](_0x556ce9,function(_0x43e316){_0x43e316[_0x2d5e('0x56')]=_0x12c7ac;_0x43e316[_0x2d5e('0x57')]=!![];return _0x43e316;});return _0x852995[_0x2d5e('0x58')](_0x41adfb);})[_0x2d5e('0x14')](function(_0x4adae1){return db[_0x2d5e('0x35')][_0x2d5e('0x59')](_0x4adae1,{'transaction':_0x26c82e});});}else{_0x5417b4=0x194;_0x8b49c4=[];}});})[_0x2d5e('0x14')](function(){if(_0x5417b4!==0x194){return db[_0x2d5e('0x35')][_0x2d5e('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x12c7ac},'order':_0x2d5e('0x5b')})[_0x2d5e('0x14')](function(_0x49e748){_0x8b49c4=_0x49e748;});}})[_0x2d5e('0x37')](function(_0x399ac0){_0x5417b4=0x1f4;logger[_0x2d5e('0x49')](_0x399ac0['stack']);if(_0x399ac0[_0x2d5e('0x22')]){delete _0x399ac0['name'];}_0x8b49c4=_0x399ac0;})[_0x2d5e('0x5c')](function(){if(_0x8b49c4===null){_0x4b4e5d[_0x2d5e('0xa')](_0x5417b4);}else{if(_0x5417b4===0x1f4){_0x4b4e5d['status'](_0x5417b4)['send'](_0x8b49c4);}else{_0x4b4e5d[_0x2d5e('0xb')](_0x5417b4)[_0x2d5e('0x12')](_0x8b49c4);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cd3506a..35ea06e 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 _0x6bd2=['emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','remove'];(function(_0x44b5e1,_0x3d2933){var _0x435099=function(_0x1d7ea4){while(--_0x1d7ea4){_0x44b5e1['push'](_0x44b5e1['shift']());}};_0x435099(++_0x3d2933);}(_0x6bd2,0xf6));var _0x26bd=function(_0x3b67e4,_0x2a5d46){_0x3b67e4=_0x3b67e4-0x0;var _0x21adcf=_0x6bd2[_0x3b67e4];return _0x21adcf;};'use strict';var EventEmitter=require(_0x26bd('0x0'));var VoiceExtension=require(_0x26bd('0x1'))['db'][_0x26bd('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x26bd('0x3')](0x0);var events={'afterCreate':_0x26bd('0x4'),'afterUpdate':'update','afterDestroy':_0x26bd('0x5')};function emitEvent(_0x40277d){return function(_0x3b2f30,_0x3a5492,_0x57cef6){VoiceExtensionEvents[_0x26bd('0x6')](_0x40277d+':'+_0x3b2f30['id'],_0x3b2f30);VoiceExtensionEvents[_0x26bd('0x6')](_0x40277d,_0x3b2f30);_0x57cef6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x26bd('0x7')](e,emitEvent(event));}}module[_0x26bd('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x4d04=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x4d04,0x128));var _0x44d0=function(_0x82804c,_0x380ad0){_0x82804c=_0x82804c-0x0;var _0x59fc31=_0x4d04[_0x82804c];return _0x59fc31;};'use strict';var EventEmitter=require(_0x44d0('0x0'));var VoiceExtension=require(_0x44d0('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x44d0('0x2')](0x0);var events={'afterCreate':_0x44d0('0x3'),'afterUpdate':_0x44d0('0x4'),'afterDestroy':_0x44d0('0x5')};function emitEvent(_0x5036e2){return function(_0x5c6a29,_0x591f6e,_0x44a0a0){VoiceExtensionEvents[_0x44d0('0x6')](_0x5036e2+':'+_0x5c6a29['id'],_0x5c6a29);VoiceExtensionEvents[_0x44d0('0x6')](_0x5036e2,_0x5c6a29);_0x44a0a0(null);};}for(var e in events){if(events[_0x44d0('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x44d0('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a31f491..a0b4000 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 _0x528f=['./voiceExtension.attributes','exports','models','type','CDR(type)=','exten','alias','Set','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','options','url','split','length','name','trunk','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','then','intervals','IntervalId','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','define','voice_extensions','concat','Hangup'];(function(_0x5d4f9f,_0x25ab08){var _0x4c7afa=function(_0x218a93){while(--_0x218a93){_0x5d4f9f['push'](_0x5d4f9f['shift']());}};_0x4c7afa(++_0x25ab08);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var attributes=require(_0xf528('0x0'));module[_0xf528('0x1')]=function(_0x303dad){var _0x42142d=_0x303dad[_0xf528('0x2')];function _0x5a32b9(_0x1265fe){var _0x4c9c0e=0x2;var _0x4b2bda=[{'type':_0x1265fe[_0xf528('0x3')],'app':'Set','appdata':_0xf528('0x4')+_0x1265fe[_0xf528('0x3')],'context':_0x1265fe['context'],'exten':_0x1265fe[_0xf528('0x5')],'priority':_0x4c9c0e++,'VoiceExtensionId':_0x1265fe['id']},{'type':_0x1265fe[_0xf528('0x3')],'app':_0x1265fe[_0xf528('0x6')]?_0xf528('0x7'):'NoOp','appdata':_0x1265fe['alias']?_0xf528('0x8')+_0x1265fe['alias']:_0xf528('0x9'),'context':_0x1265fe['context'],'exten':_0x1265fe['exten'],'priority':_0x4c9c0e++,'VoiceExtensionId':_0x1265fe['id']}];if(_0x1265fe[_0xf528('0x3')]==='inbound'){_0x4b2bda[_0xf528('0xa')]({'type':_0xf528('0xb'),'app':_0xf528('0x7'),'appdata':_0xf528('0xc')+_0x1265fe['id'],'context':_0x1265fe[_0xf528('0xd')],'exten':_0x1265fe[_0xf528('0x5')],'priority':_0x4c9c0e++,'VoiceExtensionId':_0x1265fe['id']});}_0x4b2bda['push']({'type':_0x1265fe[_0xf528('0x3')],'app':_0xf528('0x7'),'appdata':_0xf528('0xe'),'context':_0x1265fe[_0xf528('0xd')],'exten':_0x1265fe[_0xf528('0x5')],'priority':_0x4c9c0e++,'VoiceExtensionId':_0x1265fe['id']},{'type':_0x1265fe[_0xf528('0x3')],'app':_0xf528('0x7'),'appdata':_0xf528('0xf'),'context':_0x1265fe[_0xf528('0xd')],'exten':_0x1265fe[_0xf528('0x5')],'priority':_0x4c9c0e++,'VoiceExtensionId':_0x1265fe['id']},{'type':_0x1265fe['type'],'app':_0xf528('0x7'),'appdata':_0xf528('0x10'),'context':_0x1265fe[_0xf528('0xd')],'exten':_0x1265fe[_0xf528('0x5')],'priority':_0x4c9c0e++,'VoiceExtensionId':_0x1265fe['id']});return _0x4b2bda;}function _0x2712f9(_0x1470f4){var _0x4bae1a=0x2;var _0x5ebb50=[{'type':_0xf528('0x11'),'app':_0xf528('0x7'),'appdata':_0xf528('0x12'),'context':_0x1470f4['context'],'exten':_0x1470f4['exten'],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':_0xf528('0x11'),'app':_0x1470f4['alias']?_0xf528('0x7'):_0xf528('0x13'),'appdata':_0x1470f4[_0xf528('0x6')]?_0xf528('0x8')+_0x1470f4[_0xf528('0x6')]:_0xf528('0x9'),'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':'outbound','app':_0xf528('0x7'),'appdata':_0xf528('0x14')+(_0x1470f4[_0xf528('0x15')]?_0xf528('0x16')+_0x1470f4[_0xf528('0x15')]+'}':_0xf528('0x17')),'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':'outbound','app':_0xf528('0x7'),'appdata':_0xf528('0xc')+_0x1470f4['id'],'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':_0xf528('0x11'),'app':_0xf528('0x18'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4bae1a+0x2)+_0xf528('0x19')+(_0x4bae1a+0x1)+')','context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4['exten'],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':_0xf528('0x11'),'app':_0xf528('0x7'),'appdata':_0x1470f4['cutdigits']?_0xf528('0x1a')+_0x1470f4['cutdigits']+'}':_0xf528('0x1b'),'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':'outbound','app':'Set','appdata':_0xf528('0xe'),'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':_0xf528('0x11'),'app':_0xf528('0x7'),'appdata':_0xf528('0xf'),'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':_0xf528('0x11'),'app':_0xf528('0x7'),'appdata':_0xf528('0x10'),'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':_0xf528('0x11'),'app':_0xf528('0x7'),'appdata':_0xf528('0x1c')+_0x1470f4['id'],'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4['exten'],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']}];if(_0x1470f4[_0xf528('0x1d')](_0xf528('0x1e'))&&_0x1470f4[_0xf528('0x1e')]!==_0xf528('0x1f')){_0x5ebb50[_0xf528('0xa')]({'type':_0xf528('0x11'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']},{'type':_0xf528('0x11'),'app':_0xf528('0x7'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1470f4[_0xf528('0x1e')]||_0xf528('0x20'),'context':_0x1470f4[_0xf528('0xd')],'exten':_0x1470f4[_0xf528('0x5')],'priority':_0x4bae1a++,'VoiceExtensionId':_0x1470f4['id']});}return _0x5ebb50;}function _0x1a9849(_0x143849,_0x41b9e2){var _0x122597=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0xf528('0x21'),'param':0x2},{'name':_0xf528('0x22'),'param':0x3}];var _0x7c24b1={};var _0x67e6da=_0x41b9e2[_0xf528('0x23')](',');var _0x228eea=[];for(var _0x1940ef=0x0;_0x1940ef<_0x122597[_0xf528('0x24')];_0x1940ef++){switch(_0x122597[_0x1940ef][_0xf528('0x25')]){case _0xf528('0x26'):_0x7c24b1['trunk']=_0x67e6da[_0x122597[_0x1940ef][_0xf528('0x27')]]['split']('/')[0x1];_0x7c24b1[_0xf528('0x28')]=_0x67e6da[_0x122597[_0x1940ef][_0xf528('0x27')]][_0xf528('0x23')]('/')[0x2];_0x7c24b1['prefix']=_0x7c24b1[_0xf528('0x28')]?_0x7c24b1[_0xf528('0x28')][_0xf528('0x23')]('$')[0x0]:undefined;_0x7c24b1[_0xf528('0x28')]=_0x143849['cutdigits']?(_0x7c24b1[_0xf528('0x29')]||'')+'${EXTEN:'+_0x143849[_0xf528('0x15')]+'}':(_0x7c24b1[_0xf528('0x29')]||'')+_0xf528('0x17');_0x228eea[_0x122597[_0x1940ef][_0xf528('0x27')]]=['SIP',_0x7c24b1[_0xf528('0x26')],_0x7c24b1[_0xf528('0x28')]][_0xf528('0x2a')]('/');break;case'options':_0x7c24b1[_0xf528('0x21')]=_0x67e6da[_0x122597[_0x1940ef]['param']];if(_0x143849[_0xf528('0x1e')]!==_0xf528('0x1f')){if(_0x7c24b1[_0xf528('0x21')][_0xf528('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x7c24b1[_0xf528('0x21')]+=_0xf528('0x2c');}}else{_0x7c24b1['options']=_0x7c24b1[_0xf528('0x21')][_0xf528('0x2d')]('U(xcally-mixmonitor-context)','');}_0x228eea[_0x122597[_0x1940ef][_0xf528('0x27')]]=_0x7c24b1[_0xf528('0x21')];break;default:_0x228eea[_0x122597[_0x1940ef]['param']]=_0x67e6da[_0x122597[_0x1940ef][_0xf528('0x27')]];}}return _0x228eea[_0xf528('0x2a')](',');}function _0x493f5e(_0x4d3ed3,_0x1188b9,_0x2cb7ac){return new Promise(function(_0xb1bbe2,_0x201b90){var _0x80897b=[];if(_[_0xf528('0x2e')](_0x1188b9))return _0xb1bbe2(_0x80897b);_0x42142d['Interval'][_0xf528('0x2f')]({'attributes':['id',_0xf528('0x30'),'IntervalId'],'raw':!![]})[_0xf528('0x31')](function(_0x21cbec){for(var _0x76f9c5=0x0,_0x47a3ff=0x0;_0x76f9c5<_0x1188b9['length'];_0x76f9c5++,_0x47a3ff=0x0){var _0x22d410=_0x1188b9[_0x76f9c5];var _0x55f25d=[];var _0x24b720=[];delete _0x22d410['id'];if(_0x22d410[_0xf528('0x30')]!=='*,*,*,*'){_0x22d410[_0xf528('0x32')]=[_0x22d410[_0xf528('0x30')]];}else{_0x22d410[_0xf528('0x32')]=_0x22d410[_0xf528('0x33')]?_[_0xf528('0x34')](_[_0xf528('0x35')](_0x21cbec,{'IntervalId':_0x22d410[_0xf528('0x33')]}),'interval'):[];}_0x22d410[_0xf528('0xd')]=_0x4d3ed3[_0xf528('0xd')];_0x22d410[_0xf528('0x5')]=_0x4d3ed3[_0xf528('0x5')];if(_0x22d410[_0xf528('0x3')])_0x22d410[_0xf528('0x3')]=_0x22d410[_0xf528('0x3')]['toLowerCase']();if(_0x4d3ed3['type']===_0xf528('0x11')){if(_0x22d410[_0xf528('0x1d')]('tag')&&_0x22d410[_0xf528('0x36')]&&_0x22d410[_0xf528('0x36')]!=='--'){_0x55f25d[_0xf528('0xa')]({'type':_0x22d410[_0xf528('0x3')][_0xf528('0x37')](),'app':_0xf528('0x7'),'appdata':_0xf528('0x38')+_0x22d410[_0xf528('0x36')],'context':_0x4d3ed3[_0xf528('0xd')],'exten':_0x4d3ed3[_0xf528('0x5')],'priority':_0x22d410[_0xf528('0x32')][_0xf528('0x24')]+_0x2cb7ac+_0x47a3ff++,'VoiceExtensionId':_0x4d3ed3['id']});}_0x55f25d[_0xf528('0xa')]({'type':_0x22d410[_0xf528('0x3')][_0xf528('0x37')](),'app':'ExecIf','appdata':_0xf528('0x39')+(_0x22d410[_0xf528('0x3a')]?_0xf528('0x3b')+_0x22d410[_0xf528('0x3a')]+')':_0xf528('0x3c')),'context':_0x4d3ed3[_0xf528('0xd')],'exten':_0x4d3ed3[_0xf528('0x5')],'priority':_0x22d410[_0xf528('0x32')][_0xf528('0x24')]+_0x2cb7ac+_0x47a3ff++,'VoiceExtensionId':_0x4d3ed3['id']});}else{if(_0x22d410[_0xf528('0x1d')](_0xf528('0x3d'))){if(['queue',_0xf528('0x3e')][_0xf528('0x3f')](_0x22d410[_0xf528('0x40')][_0xf528('0x37')]())&&_0x22d410[_0xf528('0x41')]!=='custom'){if(_0x22d410['answer']){_0x55f25d[_0xf528('0xa')]({'type':_0x22d410[_0xf528('0x3')][_0xf528('0x37')](),'app':_0xf528('0x18'),'appdata':_0xf528('0x42'),'context':_0x4d3ed3[_0xf528('0xd')],'exten':_0x4d3ed3[_0xf528('0x5')],'priority':_0x22d410[_0xf528('0x32')]['length']+_0x2cb7ac+_0x47a3ff++,'VoiceExtensionId':_0x4d3ed3['id']});_0x55f25d[_0xf528('0xa')]({'type':_0x22d410[_0xf528('0x3')][_0xf528('0x37')](),'app':'Set','appdata':_0xf528('0x43'),'context':_0x4d3ed3[_0xf528('0xd')],'exten':_0x4d3ed3[_0xf528('0x5')],'priority':_0x22d410[_0xf528('0x32')][_0xf528('0x24')]+_0x2cb7ac+_0x47a3ff++,'VoiceExtensionId':_0x4d3ed3['id']});}else{_0x55f25d[_0xf528('0xa')]({'type':_0x22d410['type'][_0xf528('0x37')](),'app':_0xf528('0x18'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4d3ed3[_0xf528('0xd')],'exten':_0x4d3ed3[_0xf528('0x5')],'priority':_0x22d410[_0xf528('0x32')]['length']+_0x2cb7ac+_0x47a3ff++,'VoiceExtensionId':_0x4d3ed3['id']});_0x55f25d[_0xf528('0xa')]({'type':_0x22d410['type'][_0xf528('0x37')](),'app':_0xf528('0x7'),'appdata':_0xf528('0x44'),'context':_0x4d3ed3[_0xf528('0xd')],'exten':_0x4d3ed3[_0xf528('0x5')],'priority':_0x22d410[_0xf528('0x32')]['length']+_0x2cb7ac+_0x47a3ff++,'VoiceExtensionId':_0x4d3ed3['id']});}}}}for(var _0xfd78ce=0x0;_0xfd78ce<_0x22d410[_0xf528('0x32')][_0xf528('0x24')];_0xfd78ce++){var _0x563d10=_0x2cb7ac+_0x22d410[_0xf528('0x32')][_0xf528('0x24')];var _0xb3922d=_0xfd78ce===_0x22d410[_0xf528('0x32')][_0xf528('0x24')]-0x1?_0x2cb7ac+_0x55f25d['length']+_0x24b720[_0xf528('0x24')]+0x2:_0x2cb7ac+_0xfd78ce+0x1;_0x55f25d[_0xf528('0x45')](_0xfd78ce,0x0,{'type':_0x4d3ed3[_0xf528('0x3')],'app':_0xf528('0x46'),'appdata':_0x22d410[_0xf528('0x32')][_0xfd78ce]+'?'+_0x4d3ed3['context']+_0xf528('0x47')+_0x563d10+':'+_0x4d3ed3['context']+_0xf528('0x47')+_0xb3922d,'exten':_0x4d3ed3[_0xf528('0x5')],'context':_0x4d3ed3[_0xf528('0xd')],'priority':_0x2cb7ac+_0xfd78ce,'VoiceExtensionId':_0x4d3ed3['id']});}if(_0x22d410[_0xf528('0x41')]===_0xf528('0x48'))_0x22d410[_0xf528('0x49')]=_0x1a9849(_0x4d3ed3,_0x22d410[_0xf528('0x49')]);_0x22d410['priority']=_0x55f25d['length']?_[_0xf528('0x4a')](_0x55f25d)[_0xf528('0x4b')]+0x1:_0x2cb7ac;_0x80897b=_['concat'](_0x80897b,_0x55f25d,[_0x22d410],_0x24b720);_0x2cb7ac=_['last'](_0x80897b)[_0xf528('0x4b')]+0x1;}return _0xb1bbe2(_0x80897b);})['catch'](function(_0x4fae01){_0x201b90(_0x4fae01);});});}return _0x303dad[_0xf528('0x4c')]('VoiceExtension',attributes,{'tableName':_0xf528('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x357573){var _0x39b8ba=this['get']({'plain':!![]});var _0x5bd9ae=_0x39b8ba[_0xf528('0x3')]===_0xf528('0x11')?_0x2712f9(_0x39b8ba):_0x5a32b9(_0x39b8ba);return _0x493f5e(_0x39b8ba,_0x357573,_[_0xf528('0x4a')](_0x5bd9ae)['priority']+0x1)[_0xf528('0x31')](function(_0x52d36a){var _0x1234b9=_[_0xf528('0x4e')](_0x5bd9ae,_0x52d36a);_0x1234b9[_0xf528('0xa')]({'type':_0x39b8ba[_0xf528('0x3')],'app':_0xf528('0x4f'),'exten':_0x39b8ba[_0xf528('0x5')],'context':_0x39b8ba['context'],'priority':_['last'](_0x1234b9)[_0xf528('0x4b')]+0x1,'VoiceExtensionId':_0x39b8ba['id']});return _0x1234b9;});}}});}; \ No newline at end of file +var _0x0e49=['findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','callerID','answer','queue','includes','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','exten','type','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','trunk','options','url','split','length','name','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty'];(function(_0xe231d2,_0x3dc13c){var _0x121ebe=function(_0x5779d7){while(--_0x5779d7){_0xe231d2['push'](_0xe231d2['shift']());}};_0x121ebe(++_0x3dc13c);}(_0x0e49,0x1ad));var _0x90e4=function(_0x1b3a72,_0x3a1f98){_0x1b3a72=_0x1b3a72-0x0;var _0x8b247f=_0x0e49[_0x1b3a72];return _0x8b247f;};'use strict';var _=require(_0x90e4('0x0'));var attributes=require(_0x90e4('0x1'));module['exports']=function(_0x210258){var _0x3b94ad=_0x210258[_0x90e4('0x2')];function _0x569449(_0x305b1a){var _0x568831=0x2;var _0x758c1c=[{'type':_0x305b1a['type'],'app':_0x90e4('0x3'),'appdata':_0x90e4('0x4')+_0x305b1a['type'],'context':_0x305b1a['context'],'exten':_0x305b1a[_0x90e4('0x5')],'priority':_0x568831++,'VoiceExtensionId':_0x305b1a['id']},{'type':_0x305b1a[_0x90e4('0x6')],'app':_0x305b1a['alias']?_0x90e4('0x3'):_0x90e4('0x7'),'appdata':_0x305b1a[_0x90e4('0x8')]?_0x90e4('0x9')+_0x305b1a['alias']:_0x90e4('0xa'),'context':_0x305b1a[_0x90e4('0xb')],'exten':_0x305b1a[_0x90e4('0x5')],'priority':_0x568831++,'VoiceExtensionId':_0x305b1a['id']}];if(_0x305b1a['type']===_0x90e4('0xc')){_0x758c1c['push']({'type':_0x90e4('0xc'),'app':_0x90e4('0x3'),'appdata':_0x90e4('0xd')+_0x305b1a['id'],'context':_0x305b1a[_0x90e4('0xb')],'exten':_0x305b1a[_0x90e4('0x5')],'priority':_0x568831++,'VoiceExtensionId':_0x305b1a['id']});}_0x758c1c[_0x90e4('0xe')]({'type':_0x305b1a[_0x90e4('0x6')],'app':'Set','appdata':_0x90e4('0xf'),'context':_0x305b1a['context'],'exten':_0x305b1a[_0x90e4('0x5')],'priority':_0x568831++,'VoiceExtensionId':_0x305b1a['id']},{'type':_0x305b1a[_0x90e4('0x6')],'app':'Set','appdata':_0x90e4('0x10'),'context':_0x305b1a[_0x90e4('0xb')],'exten':_0x305b1a[_0x90e4('0x5')],'priority':_0x568831++,'VoiceExtensionId':_0x305b1a['id']},{'type':_0x305b1a[_0x90e4('0x6')],'app':'Set','appdata':_0x90e4('0x11'),'context':_0x305b1a[_0x90e4('0xb')],'exten':_0x305b1a[_0x90e4('0x5')],'priority':_0x568831++,'VoiceExtensionId':_0x305b1a['id']});return _0x758c1c;}function _0x24b401(_0x28a74c){var _0x278f22=0x2;var _0xc53046=[{'type':'outbound','app':_0x90e4('0x3'),'appdata':_0x90e4('0x12'),'context':_0x28a74c[_0x90e4('0xb')],'exten':_0x28a74c['exten'],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':_0x28a74c['alias']?_0x90e4('0x3'):_0x90e4('0x7'),'appdata':_0x28a74c[_0x90e4('0x8')]?_0x90e4('0x9')+_0x28a74c[_0x90e4('0x8')]:_0x90e4('0xa'),'context':_0x28a74c['context'],'exten':_0x28a74c[_0x90e4('0x5')],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':_0x90e4('0x3'),'appdata':'CDR(destination)='+(_0x28a74c['cutdigits']?_0x90e4('0x14')+_0x28a74c[_0x90e4('0x15')]+'}':_0x90e4('0x16')),'context':_0x28a74c[_0x90e4('0xb')],'exten':_0x28a74c[_0x90e4('0x5')],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':'outbound','app':_0x90e4('0x3'),'appdata':_0x90e4('0xd')+_0x28a74c['id'],'context':_0x28a74c['context'],'exten':_0x28a74c[_0x90e4('0x5')],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':'ExecIf','appdata':_0x90e4('0x17')+(_0x278f22+0x2)+_0x90e4('0x18')+(_0x278f22+0x1)+')','context':_0x28a74c['context'],'exten':_0x28a74c['exten'],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':'Set','appdata':_0x28a74c[_0x90e4('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x28a74c[_0x90e4('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x28a74c[_0x90e4('0xb')],'exten':_0x28a74c[_0x90e4('0x5')],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':_0x90e4('0x3'),'appdata':_0x90e4('0xf'),'context':_0x28a74c['context'],'exten':_0x28a74c['exten'],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':_0x90e4('0x3'),'appdata':_0x90e4('0x10'),'context':_0x28a74c[_0x90e4('0xb')],'exten':_0x28a74c[_0x90e4('0x5')],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':_0x90e4('0x3'),'appdata':_0x90e4('0x11'),'context':_0x28a74c[_0x90e4('0xb')],'exten':_0x28a74c['exten'],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':_0x90e4('0x3'),'appdata':_0x90e4('0x19')+_0x28a74c['id'],'context':_0x28a74c['context'],'exten':_0x28a74c[_0x90e4('0x5')],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']}];if(_0x28a74c[_0x90e4('0x1a')](_0x90e4('0x1b'))&&_0x28a74c[_0x90e4('0x1b')]!==_0x90e4('0x1c')){_0xc53046[_0x90e4('0xe')]({'type':'outbound','app':_0x90e4('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x28a74c[_0x90e4('0xb')],'exten':_0x28a74c['exten'],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']},{'type':_0x90e4('0x13'),'app':_0x90e4('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x28a74c[_0x90e4('0x1b')]||_0x90e4('0x1d'),'context':_0x28a74c[_0x90e4('0xb')],'exten':_0x28a74c[_0x90e4('0x5')],'priority':_0x278f22++,'VoiceExtensionId':_0x28a74c['id']});}return _0xc53046;}function _0x264766(_0x4c4e61,_0x5b769d){var _0x4f6a54=[{'name':_0x90e4('0x1e'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x90e4('0x1f'),'param':0x2},{'name':_0x90e4('0x20'),'param':0x3}];var _0x22f27d={};var _0x5dd4c3=_0x5b769d[_0x90e4('0x21')](',');var _0x2e85ea=[];for(var _0x54dc53=0x0;_0x54dc53<_0x4f6a54[_0x90e4('0x22')];_0x54dc53++){switch(_0x4f6a54[_0x54dc53][_0x90e4('0x23')]){case _0x90e4('0x1e'):_0x22f27d['trunk']=_0x5dd4c3[_0x4f6a54[_0x54dc53][_0x90e4('0x24')]][_0x90e4('0x21')]('/')[0x1];_0x22f27d['phone']=_0x5dd4c3[_0x4f6a54[_0x54dc53][_0x90e4('0x24')]][_0x90e4('0x21')]('/')[0x2];_0x22f27d[_0x90e4('0x25')]=_0x22f27d[_0x90e4('0x26')]?_0x22f27d[_0x90e4('0x26')][_0x90e4('0x21')]('$')[0x0]:undefined;_0x22f27d[_0x90e4('0x26')]=_0x4c4e61[_0x90e4('0x15')]?(_0x22f27d['prefix']||'')+_0x90e4('0x14')+_0x4c4e61[_0x90e4('0x15')]+'}':(_0x22f27d[_0x90e4('0x25')]||'')+_0x90e4('0x16');_0x2e85ea[_0x4f6a54[_0x54dc53][_0x90e4('0x24')]]=[_0x90e4('0x27'),_0x22f27d[_0x90e4('0x1e')],_0x22f27d[_0x90e4('0x26')]][_0x90e4('0x28')]('/');break;case _0x90e4('0x1f'):_0x22f27d[_0x90e4('0x1f')]=_0x5dd4c3[_0x4f6a54[_0x54dc53][_0x90e4('0x24')]];if(_0x4c4e61[_0x90e4('0x1b')]!=='none'){if(_0x22f27d[_0x90e4('0x1f')][_0x90e4('0x29')](_0x90e4('0x2a'))<0x0){_0x22f27d['options']+='U(xcally-mixmonitor-context)';}}else{_0x22f27d[_0x90e4('0x1f')]=_0x22f27d['options'][_0x90e4('0x2b')](_0x90e4('0x2a'),'');}_0x2e85ea[_0x4f6a54[_0x54dc53][_0x90e4('0x24')]]=_0x22f27d[_0x90e4('0x1f')];break;default:_0x2e85ea[_0x4f6a54[_0x54dc53][_0x90e4('0x24')]]=_0x5dd4c3[_0x4f6a54[_0x54dc53]['param']];}}return _0x2e85ea['join'](',');}function _0x2ce721(_0x40fe1a,_0x46ec0e,_0x510698){return new Promise(function(_0x294a70,_0x2db8b4){var _0x1881ff=[];if(_[_0x90e4('0x2c')](_0x46ec0e))return _0x294a70(_0x1881ff);_0x3b94ad['Interval'][_0x90e4('0x2d')]({'attributes':['id',_0x90e4('0x2e'),_0x90e4('0x2f')],'raw':!![]})[_0x90e4('0x30')](function(_0x43c3fb){for(var _0x6f5e67=0x0,_0x5b45bb=0x0;_0x6f5e67<_0x46ec0e[_0x90e4('0x22')];_0x6f5e67++,_0x5b45bb=0x0){var _0x12681c=_0x46ec0e[_0x6f5e67];var _0x2be810=[];var _0x4222ac=[];delete _0x12681c['id'];if(_0x12681c[_0x90e4('0x2e')]!==_0x90e4('0x31')){_0x12681c[_0x90e4('0x32')]=[_0x12681c[_0x90e4('0x2e')]];}else{_0x12681c[_0x90e4('0x32')]=_0x12681c['IntervalId']?_[_0x90e4('0x33')](_[_0x90e4('0x34')](_0x43c3fb,{'IntervalId':_0x12681c[_0x90e4('0x2f')]}),_0x90e4('0x2e')):[];}_0x12681c[_0x90e4('0xb')]=_0x40fe1a[_0x90e4('0xb')];_0x12681c[_0x90e4('0x5')]=_0x40fe1a[_0x90e4('0x5')];if(_0x12681c['type'])_0x12681c['type']=_0x12681c[_0x90e4('0x6')][_0x90e4('0x35')]();if(_0x40fe1a['type']==='outbound'){if(_0x12681c['hasOwnProperty'](_0x90e4('0x36'))&&_0x12681c[_0x90e4('0x36')]&&_0x12681c[_0x90e4('0x36')]!=='--'){_0x2be810[_0x90e4('0xe')]({'type':_0x12681c[_0x90e4('0x6')]['toLowerCase'](),'app':'Set','appdata':_0x90e4('0x37')+_0x12681c['tag'],'context':_0x40fe1a['context'],'exten':_0x40fe1a[_0x90e4('0x5')],'priority':_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')]+_0x510698+_0x5b45bb++,'VoiceExtensionId':_0x40fe1a['id']});}_0x2be810[_0x90e4('0xe')]({'type':_0x12681c[_0x90e4('0x6')]['toLowerCase'](),'app':_0x90e4('0x38'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x12681c[_0x90e4('0x39')]?'Set(CALLERID(all)='+_0x12681c[_0x90e4('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x40fe1a[_0x90e4('0xb')],'exten':_0x40fe1a['exten'],'priority':_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')]+_0x510698+_0x5b45bb++,'VoiceExtensionId':_0x40fe1a['id']});}else{if(_0x12681c[_0x90e4('0x1a')](_0x90e4('0x3a'))){if([_0x90e4('0x3b'),'playback'][_0x90e4('0x3c')](_0x12681c['app'][_0x90e4('0x35')]())&&_0x12681c[_0x90e4('0x3d')]!==_0x90e4('0x3e')){if(_0x12681c[_0x90e4('0x3a')]){_0x2be810['push']({'type':_0x12681c[_0x90e4('0x6')][_0x90e4('0x35')](),'app':_0x90e4('0x38'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x40fe1a[_0x90e4('0xb')],'exten':_0x40fe1a[_0x90e4('0x5')],'priority':_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')]+_0x510698+_0x5b45bb++,'VoiceExtensionId':_0x40fe1a['id']});_0x2be810[_0x90e4('0xe')]({'type':_0x12681c[_0x90e4('0x6')][_0x90e4('0x35')](),'app':_0x90e4('0x3'),'appdata':_0x90e4('0x3f'),'context':_0x40fe1a[_0x90e4('0xb')],'exten':_0x40fe1a['exten'],'priority':_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')]+_0x510698+_0x5b45bb++,'VoiceExtensionId':_0x40fe1a['id']});}else{_0x2be810[_0x90e4('0xe')]({'type':_0x12681c[_0x90e4('0x6')][_0x90e4('0x35')](),'app':_0x90e4('0x38'),'appdata':_0x90e4('0x40'),'context':_0x40fe1a[_0x90e4('0xb')],'exten':_0x40fe1a[_0x90e4('0x5')],'priority':_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')]+_0x510698+_0x5b45bb++,'VoiceExtensionId':_0x40fe1a['id']});_0x2be810[_0x90e4('0xe')]({'type':_0x12681c[_0x90e4('0x6')][_0x90e4('0x35')](),'app':_0x90e4('0x3'),'appdata':_0x90e4('0x41'),'context':_0x40fe1a[_0x90e4('0xb')],'exten':_0x40fe1a[_0x90e4('0x5')],'priority':_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')]+_0x510698+_0x5b45bb++,'VoiceExtensionId':_0x40fe1a['id']});}}}}for(var _0x545fd6=0x0;_0x545fd6<_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')];_0x545fd6++){var _0xc9fcf6=_0x510698+_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')];var _0x1c2c42=_0x545fd6===_0x12681c[_0x90e4('0x32')]['length']-0x1?_0x510698+_0x2be810['length']+_0x4222ac['length']+0x2:_0x510698+_0x545fd6+0x1;_0x2be810['splice'](_0x545fd6,0x0,{'type':_0x40fe1a[_0x90e4('0x6')],'app':_0x90e4('0x42'),'appdata':_0x12681c[_0x90e4('0x32')][_0x545fd6]+'?'+_0x40fe1a[_0x90e4('0xb')]+_0x90e4('0x43')+_0xc9fcf6+':'+_0x40fe1a[_0x90e4('0xb')]+_0x90e4('0x43')+_0x1c2c42,'exten':_0x40fe1a[_0x90e4('0x5')],'context':_0x40fe1a[_0x90e4('0xb')],'priority':_0x510698+_0x545fd6,'VoiceExtensionId':_0x40fe1a['id']});}if(_0x12681c['appType']===_0x90e4('0x44')){_0x12681c[_0x90e4('0x45')]=_0x264766(_0x40fe1a,_0x12681c['appdata']);}if(_0x12681c[_0x90e4('0x3d')]===_0x90e4('0x46')){_0x2be810[_0x90e4('0xe')]({'type':_0x12681c[_0x90e4('0x6')]['toLowerCase'](),'app':_0x90e4('0x3'),'appdata':_0x90e4('0x47'),'context':_0x40fe1a[_0x90e4('0xb')],'exten':_0x40fe1a[_0x90e4('0x5')],'priority':_0x12681c[_0x90e4('0x32')][_0x90e4('0x22')]+_0x510698+_0x5b45bb++,'VoiceExtensionId':_0x40fe1a['id']});}_0x12681c[_0x90e4('0x48')]=_0x2be810[_0x90e4('0x22')]?_[_0x90e4('0x49')](_0x2be810)['priority']+0x1:_0x510698;_0x1881ff=_['concat'](_0x1881ff,_0x2be810,[_0x12681c],_0x4222ac);_0x510698=_['last'](_0x1881ff)[_0x90e4('0x48')]+0x1;}return _0x294a70(_0x1881ff);})[_0x90e4('0x4a')](function(_0x1125f5){_0x2db8b4(_0x1125f5);});});}return _0x210258[_0x90e4('0x4b')](_0x90e4('0x4c'),attributes,{'tableName':_0x90e4('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1dc883){var _0x5a3927=this['get']({'plain':!![]});var _0x3a7400=_0x5a3927['type']===_0x90e4('0x13')?_0x24b401(_0x5a3927):_0x569449(_0x5a3927);return _0x2ce721(_0x5a3927,_0x1dc883,_[_0x90e4('0x49')](_0x3a7400)[_0x90e4('0x48')]+0x1)[_0x90e4('0x30')](function(_0x2c2687){var _0x370b74=_['concat'](_0x3a7400,_0x2c2687);_0x370b74[_0x90e4('0xe')]({'type':_0x5a3927[_0x90e4('0x6')],'app':_0x90e4('0x4e'),'exten':_0x5a3927['exten'],'context':_0x5a3927['context'],'priority':_[_0x90e4('0x49')](_0x370b74)[_0x90e4('0x48')]+0x1,'VoiceExtensionId':_0x5a3927['id']});return _0x370b74;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6f2cb5e..45538f7 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 _0x5024=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','map','include','model','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x5c93aa,_0x129d04){var _0xa5e311=function(_0x517237){while(--_0x517237){_0x5c93aa['push'](_0x5c93aa['shift']());}};_0xa5e311(++_0x129d04);}(_0x5024,0xf7));var _0x4502=function(_0xaf9828,_0x3670be){_0xaf9828=_0xaf9828-0x0;var _0x55e448=_0x5024[_0xaf9828];return _0x55e448;};'use strict';var _=require(_0x4502('0x0'));var util=require(_0x4502('0x1'));var moment=require(_0x4502('0x2'));var BPromise=require(_0x4502('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4502('0x4'));var db=require(_0x4502('0x5'))['db'];var utils=require(_0x4502('0x6'));var logger=require(_0x4502('0x7'))(_0x4502('0x8'));var config=require(_0x4502('0x9'));var jayson=require(_0x4502('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x4502('0xb')]=_['defaults'](config[_0x4502('0xb')],{'host':_0x4502('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4502('0xd'))[_0x4502('0xe')](socket);function respondWithRpcPromise(_0x5e3297,_0x391152,_0x19ae0c){return new BPromise(function(_0x4ae910,_0x367b85){return client[_0x4502('0xf')](_0x5e3297,_0x19ae0c)[_0x4502('0x10')](function(_0x16236b){logger[_0x4502('0x11')](_0x4502('0x12'),_0x391152,'request\x20sent');logger[_0x4502('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x391152,_0x4502('0x14'),JSON[_0x4502('0x15')](_0x16236b));if(_0x16236b['error']){if(_0x16236b[_0x4502('0x16')][_0x4502('0x17')]===0x1f4){logger[_0x4502('0x16')](_0x4502('0x12'),_0x391152,_0x16236b[_0x4502('0x16')][_0x4502('0x18')]);return _0x367b85(_0x16236b['error'][_0x4502('0x18')]);}logger[_0x4502('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x391152,_0x16236b[_0x4502('0x16')][_0x4502('0x18')]);return _0x4ae910(_0x16236b[_0x4502('0x16')][_0x4502('0x18')]);}else{logger['info'](_0x4502('0x12'),_0x391152,_0x4502('0x14'));_0x4ae910(_0x16236b[_0x4502('0x19')]['message']);}})['catch'](function(_0x1217a4){logger[_0x4502('0x16')](_0x4502('0x12'),_0x391152,_0x1217a4);_0x367b85(_0x1217a4);});});}exports[_0x4502('0x1a')]=function(_0x8ecd0b){var _0x4ae9e8=this;return new Promise(function(_0x5616c6,_0x80f964){return db[_0x4502('0x1b')]['findAll']({'raw':_0x8ecd0b['options']?_0x8ecd0b[_0x4502('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x8ecd0b[_0x4502('0x1c')]?_0x8ecd0b[_0x4502('0x1c')][_0x4502('0x1d')]||null:null,'attributes':_0x8ecd0b[_0x4502('0x1c')]?_0x8ecd0b[_0x4502('0x1c')][_0x4502('0x1e')]||null:null,'limit':_0x8ecd0b[_0x4502('0x1c')]?_0x8ecd0b[_0x4502('0x1c')][_0x4502('0x1f')]||null:null,'include':_0x8ecd0b[_0x4502('0x1c')]?_0x8ecd0b[_0x4502('0x1c')]['include']?_[_0x4502('0x20')](_0x8ecd0b[_0x4502('0x1c')][_0x4502('0x21')],function(_0x46a560){return{'model':db[_0x46a560[_0x4502('0x22')]],'as':_0x46a560['as'],'attributes':_0x46a560[_0x4502('0x1e')],'include':_0x46a560[_0x4502('0x21')]?_[_0x4502('0x20')](_0x46a560[_0x4502('0x21')],function(_0xeb30d3){return{'model':db[_0xeb30d3[_0x4502('0x22')]],'as':_0xeb30d3['as'],'attributes':_0xeb30d3[_0x4502('0x1e')],'include':_0xeb30d3[_0x4502('0x21')]?_[_0x4502('0x20')](_0xeb30d3['include'],function(_0x4bcb5f){return{'model':db[_0x4bcb5f[_0x4502('0x22')]],'as':_0x4bcb5f['as'],'attributes':_0x4bcb5f[_0x4502('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4502('0x10')](function(_0x54597c){logger[_0x4502('0x11')](_0x4502('0x1a'),_0x8ecd0b);logger[_0x4502('0x13')]('GetVoiceExtension',_0x8ecd0b,JSON[_0x4502('0x15')](_0x54597c));_0x5616c6(_0x54597c);})[_0x4502('0x23')](function(_0x3f212b){logger[_0x4502('0x16')](_0x4502('0x1a'),_0x3f212b[_0x4502('0x18')],_0x8ecd0b);_0x80f964(_0x4ae9e8[_0x4502('0x16')](0x1f4,_0x3f212b[_0x4502('0x18')]));});});}; \ No newline at end of file +var _0x078c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','info','GetVoiceExtension','catch','lodash','moment','bluebird'];(function(_0x10766c,_0x27e5d0){var _0x5a13af=function(_0x17631c){while(--_0x17631c){_0x10766c['push'](_0x10766c['shift']());}};_0x5a13af(++_0x27e5d0);}(_0x078c,0x19f));var _0xc078=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x078c[_0x297eea];return _0x1c42d2;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var moment=require(_0xc078('0x1'));var BPromise=require(_0xc078('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc078('0x3'));var db=require(_0xc078('0x4'))['db'];var utils=require(_0xc078('0x5'));var logger=require(_0xc078('0x6'))('rpc');var config=require(_0xc078('0x7'));var jayson=require(_0xc078('0x8'));var client=jayson[_0xc078('0x9')][_0xc078('0xa')]({'port':0x232a});config[_0xc078('0xb')]=_[_0xc078('0xc')](config[_0xc078('0xb')],{'host':_0xc078('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0xc078('0xe')](socket);function respondWithRpcPromise(_0x1bd3ba,_0x47aca0,_0xf3ab2c){return new BPromise(function(_0x7eeb05,_0x3119f7){return client[_0xc078('0xf')](_0x1bd3ba,_0xf3ab2c)[_0xc078('0x10')](function(_0x5cd849){logger['info'](_0xc078('0x11'),_0x47aca0,_0xc078('0x12'));logger[_0xc078('0x13')](_0xc078('0x14'),_0x47aca0,_0xc078('0x12'),JSON[_0xc078('0x15')](_0x5cd849));if(_0x5cd849[_0xc078('0x16')]){if(_0x5cd849[_0xc078('0x16')][_0xc078('0x17')]===0x1f4){logger[_0xc078('0x16')](_0xc078('0x11'),_0x47aca0,_0x5cd849[_0xc078('0x16')][_0xc078('0x18')]);return _0x3119f7(_0x5cd849[_0xc078('0x16')][_0xc078('0x18')]);}logger['error'](_0xc078('0x11'),_0x47aca0,_0x5cd849[_0xc078('0x16')][_0xc078('0x18')]);return _0x7eeb05(_0x5cd849['error'][_0xc078('0x18')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x47aca0,_0xc078('0x12'));_0x7eeb05(_0x5cd849['result'][_0xc078('0x18')]);}})['catch'](function(_0x9d3868){logger[_0xc078('0x16')](_0xc078('0x11'),_0x47aca0,_0x9d3868);_0x3119f7(_0x9d3868);});});}exports['GetVoiceExtension']=function(_0x2e0825){var _0x4a05ee=this;return new Promise(function(_0xcf2627,_0x2a9bbf){return db[_0xc078('0x19')][_0xc078('0x1a')]({'raw':_0x2e0825[_0xc078('0x1b')]?_0x2e0825['options'][_0xc078('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e0825[_0xc078('0x1b')]?_0x2e0825[_0xc078('0x1b')][_0xc078('0x1d')]||null:null,'attributes':_0x2e0825['options']?_0x2e0825[_0xc078('0x1b')][_0xc078('0x1e')]||null:null,'limit':_0x2e0825[_0xc078('0x1b')]?_0x2e0825[_0xc078('0x1b')][_0xc078('0x1f')]||null:null,'include':_0x2e0825[_0xc078('0x1b')]?_0x2e0825[_0xc078('0x1b')][_0xc078('0x20')]?_[_0xc078('0x21')](_0x2e0825[_0xc078('0x1b')][_0xc078('0x20')],function(_0x531945){return{'model':db[_0x531945['model']],'as':_0x531945['as'],'attributes':_0x531945[_0xc078('0x1e')],'include':_0x531945['include']?_['map'](_0x531945['include'],function(_0x3c7843){return{'model':db[_0x3c7843['model']],'as':_0x3c7843['as'],'attributes':_0x3c7843[_0xc078('0x1e')],'include':_0x3c7843[_0xc078('0x20')]?_[_0xc078('0x21')](_0x3c7843[_0xc078('0x20')],function(_0xd43338){return{'model':db[_0xd43338[_0xc078('0x22')]],'as':_0xd43338['as'],'attributes':_0xd43338[_0xc078('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc078('0x10')](function(_0x50e5d){logger[_0xc078('0x23')](_0xc078('0x24'),_0x2e0825);logger['debug'](_0xc078('0x24'),_0x2e0825,JSON['stringify'](_0x50e5d));_0xcf2627(_0x50e5d);})[_0xc078('0x25')](function(_0x10949c){logger[_0xc078('0x16')](_0xc078('0x24'),_0x10949c['message'],_0x2e0825);_0x2a9bbf(_0x4a05ee[_0xc078('0x16')](0x1f4,_0x10949c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index e76bec0..80e774d 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 _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x814b,0x1a2));var _0xb814=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x814b[_0x55fa03];return _0x2cd7cd;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x2d440f,_0xd012d7){var _0x1f8fa7=function(_0x3884b2){while(--_0x3884b2){_0x2d440f['push'](_0x2d440f['shift']());}};_0x1f8fa7(++_0xd012d7);}(_0x7a54,0x106));var _0x47a5=function(_0x2c18ed,_0x52c65b){_0x2c18ed=_0x2c18ed-0x0;var _0x53c041=_0x7a54[_0x2c18ed];return _0x53c041;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d719687..925c107 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 _0xd046=['get','show','getMessages','isAuthenticated','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./voiceMail.controller','index'];(function(_0x33d9c0,_0x9f9a2f){var _0x1b4de9=function(_0x15e496){while(--_0x15e496){_0x33d9c0['push'](_0x33d9c0['shift']());}};_0x1b4de9(++_0x9f9a2f);}(_0xd046,0x129));var _0x6d04=function(_0x1bcb69,_0x2aa047){_0x1bcb69=_0x1bcb69-0x0;var _0xbcc0b7=_0xd046[_0x1bcb69];return _0xbcc0b7;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['post']('/',auth[_0x6d04('0xa')](),controller['create']);router['put']('/:id',auth[_0x6d04('0xa')](),controller[_0x6d04('0xb')]);router[_0x6d04('0xc')](_0x6d04('0xd'),auth['isAuthenticated'](),controller[_0x6d04('0xe')]);module[_0x6d04('0xf')]=router; \ No newline at end of file +var _0x4325=['get','/:id/messages','getMessages','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','/:id','show'];(function(_0x4cb068,_0x4c1496){var _0x1dc46e=function(_0x2d6dc4){while(--_0x2d6dc4){_0x4cb068['push'](_0x4cb068['shift']());}};_0x1dc46e(++_0x4c1496);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var path=require('path');var timeout=require(_0x5432('0x2'));var express=require(_0x5432('0x3'));var router=express[_0x5432('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var controller=require(_0x5432('0x7'));router['get']('/',auth[_0x5432('0x8')](),controller[_0x5432('0x9')]);router['get'](_0x5432('0xa'),auth['isAuthenticated'](),controller[_0x5432('0xb')]);router[_0x5432('0xc')](_0x5432('0xd'),auth[_0x5432('0x8')](),controller[_0x5432('0xe')]);router['post']('/',auth[_0x5432('0x8')](),controller['create']);router[_0x5432('0xf')](_0x5432('0xa'),auth[_0x5432('0x8')](),controller[_0x5432('0x10')]);router['delete']('/:id',auth[_0x5432('0x8')](),controller[_0x5432('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ec57191..3441df9 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 _0x91fb=['VIRTUAL','getDataValue','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x29c3a0,_0x32be87){var _0x430f8a=function(_0x4143d9){while(--_0x4143d9){_0x29c3a0['push'](_0x29c3a0['shift']());}};_0x430f8a(++_0x32be87);}(_0x91fb,0x9b));var _0xb91f=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x91fb[_0x25a42a];return _0x1129b1;};'use strict';var Sequelize=require(_0xb91f('0x0'));module[_0xb91f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb91f('0x2')],'defaultValue':_0xb91f('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xb91f('0x2')],'defaultValue':'','allowNull':![],'unique':_0xb91f('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xb91f('0x2')]},'email':{'type':Sequelize[_0xb91f('0x2')],'validate':{'isEmail':!![]},'set':function(_0xe26684){this[_0xb91f('0x5')](_0xb91f('0x6'),typeof _0xe26684===_0xb91f('0x7')&&_0xe26684[_0xb91f('0x8')]()?_0xe26684[_0xb91f('0x8')]():null);}},'pager':{'type':Sequelize[_0xb91f('0x2')]},'tz':{'type':Sequelize[_0xb91f('0x2')],'defaultValue':_0xb91f('0x9')},'attach':{'type':Sequelize[_0xb91f('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xb91f('0xa')](_0xb91f('0xb'),'no'),'defaultValue':_0xb91f('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xb91f('0x2')]},'callback':{'type':Sequelize[_0xb91f('0x2')]},'review':{'type':Sequelize[_0xb91f('0xa')](_0xb91f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xb91f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xb91f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xb91f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb91f('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb91f('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xb91f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb91f('0xa')](_0xb91f('0xb'),'no'),'defaultValue':_0xb91f('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb91f('0xa')](_0xb91f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb91f('0xa')](_0xb91f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb91f('0xa')]('yes','no'),'defaultValue':_0xb91f('0xb'),'allowNull':![]},'stamp':{'type':_0xb91f('0xd')},'emailsubject':{'type':Sequelize[_0xb91f('0x2')]},'emailbody':{'type':Sequelize[_0xb91f('0x2')]},'maxsecs':{'type':Sequelize[_0xb91f('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb91f('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb91f('0xf')],'get':function(){return this[_0xb91f('0x10')]('fullname')+'\x20-\x20'+this[_0xb91f('0x10')]('mailbox');}}}; \ No newline at end of file +var _0x4a33=['central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','setDataValue','email','trim'];(function(_0x3e2394,_0x2dc34c){var _0x29743b=function(_0x44ede3){while(--_0x44ede3){_0x3e2394['push'](_0x3e2394['shift']());}};_0x29743b(++_0x2dc34c);}(_0x4a33,0x1da));var _0x34a3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4a33[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x34a3('0x0'));module[_0x34a3('0x1')]={'customer_id':{'type':Sequelize[_0x34a3('0x2')]},'context':{'type':Sequelize[_0x34a3('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x34a3('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x34a3('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1eb2bb){this[_0x34a3('0x3')](_0x34a3('0x4'),typeof _0x1eb2bb==='string'&&_0x1eb2bb[_0x34a3('0x5')]()?_0x1eb2bb[_0x34a3('0x5')]():null);}},'pager':{'type':Sequelize[_0x34a3('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x34a3('0x6')},'attach':{'type':Sequelize['ENUM'](_0x34a3('0x7'),'no'),'defaultValue':_0x34a3('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x34a3('0x7'),'no'),'defaultValue':_0x34a3('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x34a3('0x2')]},'callback':{'type':Sequelize[_0x34a3('0x2')]},'review':{'type':Sequelize[_0x34a3('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x34a3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x34a3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x34a3('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x34a3('0x8')](_0x34a3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x34a3('0x8')](_0x34a3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x34a3('0x8')](_0x34a3('0x7'),'no'),'defaultValue':_0x34a3('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x34a3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x34a3('0x8')](_0x34a3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x34a3('0xa')},'emailsubject':{'type':Sequelize[_0x34a3('0x2')]},'emailbody':{'type':Sequelize[_0x34a3('0x2')]},'maxsecs':{'type':Sequelize[_0x34a3('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x34a3('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x34a3('0xc')](_0x34a3('0xd'))+_0x34a3('0xe')+this[_0x34a3('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index a73bef9..24daaff 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 _0x1339=['../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VoiceMail','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','pick','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1339,0x1ed));var _0x9133=function(_0x2fb3d7,_0x363767){_0x2fb3d7=_0x2fb3d7-0x0;var _0xfafe56=_0x1339[_0x2fb3d7];return _0xfafe56;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){var _0x187e32=_0x4f26e8[_0x9133('0x22')]({'plain':!![]});var _0x3f278d=_0x9133('0x23');return db[_0x9133('0x24')][_0x9133('0x21')]({'where':{'type':_0x3f278d,'resourceId':_0x187e32['id']}})[_0x9133('0x20')](function(){return _0x4f26e8;});})[_0x9133('0x20')](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x25')]();});}};}function handleEntityNotFound(_0x51de62,_0x517e7b){return function(_0x477bf1){if(!_0x477bf1){_0x51de62[_0x9133('0x26')](0x194);}return _0x477bf1;};}function handleError(_0x428e18,_0x348486){_0x348486=_0x348486||0x1f4;return function(_0x4de894){logger['error'](_0x4de894[_0x9133('0x27')]);if(_0x4de894[_0x9133('0x28')]){delete _0x4de894[_0x9133('0x28')];}_0x428e18[_0x9133('0x1a')](_0x348486)[_0x9133('0x29')](_0x4de894);};}exports[_0x9133('0x2a')]=function(_0x48c713,_0x58afe0){var _0x5a27c1={},_0x1ad222={},_0x4a4a8e={'count':0x0,'rows':[]};var _0x43b5f3=_[_0x9133('0x2b')](db['VoiceMail'][_0x9133('0x2c')],function(_0x5dd90b){return{'name':_0x5dd90b[_0x9133('0x2d')],'type':_0x5dd90b[_0x9133('0x2e')][_0x9133('0x2f')]};});_0x1ad222['model']=_[_0x9133('0x2b')](_0x43b5f3,_0x9133('0x28'));_0x1ad222[_0x9133('0x30')]=_['keys'](_0x48c713[_0x9133('0x30')]);_0x1ad222[_0x9133('0x31')]=_[_0x9133('0x32')](_0x1ad222['model'],_0x1ad222[_0x9133('0x30')]);_0x5a27c1[_0x9133('0x33')]=_[_0x9133('0x32')](_0x1ad222[_0x9133('0x34')],qs['fields'](_0x48c713[_0x9133('0x30')][_0x9133('0x35')]));_0x5a27c1['attributes']=_0x5a27c1[_0x9133('0x33')][_0x9133('0x36')]?_0x5a27c1[_0x9133('0x33')]:_0x1ad222[_0x9133('0x34')];if(!_0x48c713[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x5a27c1[_0x9133('0x1d')]=qs[_0x9133('0x1d')](_0x48c713[_0x9133('0x30')][_0x9133('0x1d')]);_0x5a27c1['offset']=qs[_0x9133('0x1e')](_0x48c713[_0x9133('0x30')]['offset']);}_0x5a27c1[_0x9133('0x39')]=qs[_0x9133('0x3a')](_0x48c713[_0x9133('0x30')][_0x9133('0x3a')]);_0x5a27c1[_0x9133('0x3b')]=qs[_0x9133('0x31')](_['pick'](_0x48c713['query'],_0x1ad222[_0x9133('0x31')]),_0x43b5f3);if(_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]){_0x5a27c1[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x5a27c1[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x43b5f3,function(_0x2ee83e){if(_0x2ee83e[_0x9133('0x2e')]!=='VIRTUAL'){var _0xafd8f9={};_0xafd8f9[_0x2ee83e[_0x9133('0x28')]]={'$like':'%'+_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]+'%'};return _0xafd8f9;}})});}_0x5a27c1=_[_0x9133('0x3d')]({},_0x5a27c1,_0x48c713['options']);var _0x3c691e={'where':_0x5a27c1[_0x9133('0x3b')]};return db[_0x9133('0x3e')][_0x9133('0x3f')](_0x3c691e)['then'](function(_0x146734){_0x4a4a8e[_0x9133('0x3f')]=_0x146734;if(_0x48c713[_0x9133('0x30')][_0x9133('0x40')]){_0x5a27c1[_0x9133('0x41')]=[{'all':!![]}];}return db[_0x9133('0x3e')][_0x9133('0x42')](_0x5a27c1);})['then'](function(_0x7f6cd9){_0x4a4a8e['rows']=_0x7f6cd9;return _0x4a4a8e;})['then'](respondWithFilteredResult(_0x58afe0,_0x5a27c1))[_0x9133('0x43')](handleError(_0x58afe0,null));};exports[_0x9133('0x44')]=function(_0x46156d,_0x264df4){var _0xdd485f={'raw':!![],'where':{'id':_0x46156d[_0x9133('0x45')]['id']}},_0x2d2bf7={};_0x2d2bf7[_0x9133('0x34')]=_[_0x9133('0x46')](db['VoiceMail'][_0x9133('0x2c')]);_0x2d2bf7[_0x9133('0x30')]=_[_0x9133('0x46')](_0x46156d['query']);_0x2d2bf7['filters']=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],_0x2d2bf7['query']);_0xdd485f[_0x9133('0x33')]=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],qs[_0x9133('0x35')](_0x46156d[_0x9133('0x30')]['fields']));_0xdd485f[_0x9133('0x33')]=_0xdd485f[_0x9133('0x33')][_0x9133('0x36')]?_0xdd485f['attributes']:_0x2d2bf7[_0x9133('0x34')];if(_0x46156d[_0x9133('0x30')]['includeAll']){_0xdd485f['include']=[{'all':!![]}];}_0xdd485f=_[_0x9133('0x3d')]({},_0xdd485f,_0x46156d[_0x9133('0x47')]);return db[_0x9133('0x3e')][_0x9133('0x48')](_0xdd485f)[_0x9133('0x20')](handleEntityNotFound(_0x264df4,null))[_0x9133('0x20')](respondWithResult(_0x264df4,null))[_0x9133('0x43')](handleError(_0x264df4,null));};exports[_0x9133('0x49')]=function(_0x23f134,_0xf07fbb){return db[_0x9133('0x3e')][_0x9133('0x49')](_0x23f134['body'],{})['then'](function(_0xf2e098){var _0x4dc2f3=_0x23f134[_0x9133('0x4a')][_0x9133('0x22')]({'plain':!![]});if(!_0x4dc2f3)throw new Error(_0x9133('0x4b'));if(_0x4dc2f3[_0x9133('0x4c')]==='user'){var _0x2a3848=_0xf2e098[_0x9133('0x22')]({'plain':!![]});var _0x799772='Voicemails';return db[_0x9133('0x4d')][_0x9133('0x48')]({'where':{'name':_0x799772,'userProfileId':_0x4dc2f3[_0x9133('0x4e')]},'raw':!![]})['then'](function(_0x14c825){if(_0x14c825&&_0x14c825['autoAssociation']===0x0){return db[_0x9133('0x24')][_0x9133('0x49')]({'name':_0x2a3848[_0x9133('0x28')],'resourceId':_0x2a3848['id'],'type':_0x14c825[_0x9133('0x28')],'sectionId':_0x14c825['id']},{})['then'](function(){return _0xf2e098;});}else{return _0xf2e098;}})['catch'](function(_0x2f09f6){logger[_0x9133('0x4f')](_0x9133('0x50'),_0x2f09f6);throw _0x2f09f6;});}return _0xf2e098;})[_0x9133('0x20')](respondWithResult(_0xf07fbb,0xc9))[_0x9133('0x43')](handleError(_0xf07fbb,null));};exports['update']=function(_0x554bb9,_0x33599b){if(_0x554bb9[_0x9133('0x51')]['id']){delete _0x554bb9['body']['id'];}return db[_0x9133('0x3e')][_0x9133('0x48')]({'where':{'id':_0x554bb9['params']['id']}})['then'](handleEntityNotFound(_0x33599b,null))['then'](saveUpdates(_0x554bb9[_0x9133('0x51')],null))['then'](respondWithResult(_0x33599b,null))[_0x9133('0x43')](handleError(_0x33599b,null));};exports[_0x9133('0x21')]=function(_0x439258,_0x3d6daa){return db['VoiceMail'][_0x9133('0x48')]({'where':{'id':_0x439258['params']['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3d6daa,null))[_0x9133('0x20')](removeEntity(_0x3d6daa,null))[_0x9133('0x43')](handleError(_0x3d6daa,null));};exports[_0x9133('0x52')]=function(_0x3b9927,_0x3534bf,_0x56861c){return db['VoiceMail']['findOne']({'where':{'id':_0x3b9927[_0x9133('0x45')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3534bf,null))[_0x9133('0x20')](function(_0x54a330){var _0x3f4cd7;var _0x1f6684={},_0x415d55={};_0x415d55[_0x9133('0x34')]=_[_0x9133('0x46')](db[_0x9133('0x53')][_0x9133('0x2c')]);_0x415d55[_0x9133('0x30')]=_['keys'](_0x3b9927[_0x9133('0x30')]);_0x415d55['filters']=_[_0x9133('0x32')](_0x415d55['model'],_0x415d55[_0x9133('0x30')]);_0x1f6684[_0x9133('0x33')]=_['intersection'](_0x415d55['model'],qs[_0x9133('0x35')](_0x3b9927[_0x9133('0x30')][_0x9133('0x35')]));_0x1f6684[_0x9133('0x33')]=_0x1f6684[_0x9133('0x33')][_0x9133('0x36')]?_0x1f6684[_0x9133('0x33')]:_0x415d55[_0x9133('0x34')];if(!_0x3b9927[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x1f6684['limit']=qs[_0x9133('0x1d')](_0x3b9927['query'][_0x9133('0x1d')]);_0x1f6684[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x3b9927[_0x9133('0x30')][_0x9133('0x1e')]);}_0x1f6684['order']=qs[_0x9133('0x3a')](_0x3b9927[_0x9133('0x30')][_0x9133('0x3a')]);_0x1f6684[_0x9133('0x3b')]=qs['filters'](_[_0x9133('0x54')](_0x3b9927[_0x9133('0x30')],_0x415d55[_0x9133('0x31')]));if(_0x3b9927[_0x9133('0x30')]['filter']){_0x1f6684['where']=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x1f6684[_0x9133('0x33')],function(_0x28cc46){var _0x2cfaf8={};_0x2cfaf8[_0x28cc46]={'$like':'%'+_0x3b9927['query'][_0x9133('0x3c')]+'%'};return _0x2cfaf8;})});}_0x1f6684[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'mailboxuser':_0x54a330['mailbox']});_0x1f6684=_[_0x9133('0x3d')]({},_0x1f6684,_0x3b9927['options']);return db[_0x9133('0x53')][_0x9133('0x55')](_0x1f6684)[_0x9133('0x20')](respondWithFilteredResult(_0x3534bf,_0x1f6684));})[_0x9133('0x43')](handleError(_0x3534bf,null));}; \ No newline at end of file +var _0x76dc=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','send','VoiceMail','fieldName','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','rawAttributes','sort','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x2c507b,_0x343d21){var _0x346f0d=function(_0x26c941){while(--_0x26c941){_0x2c507b['push'](_0x2c507b['shift']());}};_0x346f0d(++_0x343d21);}(_0x76dc,0x1f2));var _0xc76d=function(_0x6a1d96,_0x294737){_0x6a1d96=_0x6a1d96-0x0;var _0xe0008d=_0x76dc[_0x6a1d96];return _0xe0008d;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];function respondWithStatusCode(_0x2e02e9,_0x1722b3){_0x1722b3=_0x1722b3||0xcc;return function(_0x311814){if(_0x311814){return _0x2e02e9[_0xc76d('0x17')](_0x1722b3);}return _0x2e02e9[_0xc76d('0x18')](_0x1722b3)[_0xc76d('0x19')]();};}function respondWithResult(_0x3ed1bd,_0x5cda20){_0x5cda20=_0x5cda20||0xc8;return function(_0x8696db){if(_0x8696db){return _0x3ed1bd[_0xc76d('0x18')](_0x5cda20)['json'](_0x8696db);}};}function respondWithFilteredResult(_0x4741a4,_0x2d23d2){return function(_0x47a4ee){if(_0x47a4ee){var _0x6f94e=typeof _0x2d23d2['offset']===_0xc76d('0x1a')&&typeof _0x2d23d2['limit']==='undefined';var _0x45a83e=_0x47a4ee[_0xc76d('0x1b')];var _0x339623=_0x6f94e?0x0:_0x2d23d2[_0xc76d('0x1c')];var _0xd1d16f=_0x6f94e?_0x47a4ee['count']:_0x2d23d2[_0xc76d('0x1c')]+_0x2d23d2[_0xc76d('0x1d')];var _0xa0c5b6;if(_0xd1d16f>=_0x45a83e){_0xd1d16f=_0x45a83e;_0xa0c5b6=0xc8;}else{_0xa0c5b6=0xce;}_0x4741a4[_0xc76d('0x18')](_0xa0c5b6);return _0x4741a4[_0xc76d('0x1e')]('Content-Range',_0x339623+'-'+_0xd1d16f+'/'+_0x45a83e)[_0xc76d('0x1f')](_0x47a4ee);}return null;};}function patchUpdates(_0x324db7){return function(_0x5dffde){try{jsonpatch[_0xc76d('0x20')](_0x5dffde,_0x324db7,!![]);}catch(_0x777f22){return BPromise[_0xc76d('0x21')](_0x777f22);}return _0x5dffde[_0xc76d('0x22')]();};}function saveUpdates(_0x18f546,_0x3d357b){return function(_0x42b89c){if(_0x42b89c){return _0x42b89c[_0xc76d('0x23')](_0x18f546)[_0xc76d('0x24')](function(_0x20e09c){return _0x20e09c;});}return null;};}function removeEntity(_0x15328d,_0x5de11f){return function(_0x11b42f){if(_0x11b42f){return _0x11b42f[_0xc76d('0x25')]()['then'](function(){var _0x637d68=_0x11b42f[_0xc76d('0x26')]({'plain':!![]});var _0x55ca79=_0xc76d('0x27');return db[_0xc76d('0x28')][_0xc76d('0x25')]({'where':{'type':_0x55ca79,'resourceId':_0x637d68['id']}})[_0xc76d('0x24')](function(){return _0x11b42f;});})[_0xc76d('0x24')](function(){_0x15328d[_0xc76d('0x18')](0xcc)[_0xc76d('0x19')]();});}};}function handleEntityNotFound(_0x59ebd1,_0x59dabf){return function(_0x285430){if(!_0x285430){_0x59ebd1[_0xc76d('0x17')](0x194);}return _0x285430;};}function handleError(_0x5069ea,_0x31501a){_0x31501a=_0x31501a||0x1f4;return function(_0x52a79a){logger[_0xc76d('0x29')](_0x52a79a['stack']);if(_0x52a79a[_0xc76d('0x2a')]){delete _0x52a79a['name'];}_0x5069ea[_0xc76d('0x18')](_0x31501a)[_0xc76d('0x2b')](_0x52a79a);};}exports['index']=function(_0x3d4076,_0x1c68f3){var _0x9ab96c={},_0x2cf501={},_0x4feeda={'count':0x0,'rows':[]};var _0x283e16=_['map'](db[_0xc76d('0x2c')]['rawAttributes'],function(_0x30769f){return{'name':_0x30769f[_0xc76d('0x2d')],'type':_0x30769f['type']['key']};});_0x2cf501['model']=_['map'](_0x283e16,_0xc76d('0x2a'));_0x2cf501[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x3d4076[_0xc76d('0x2e')]);_0x2cf501[_0xc76d('0x30')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],_0x2cf501['query']);_0x9ab96c[_0xc76d('0x32')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x9ab96c[_0xc76d('0x32')]=_0x9ab96c['attributes'][_0xc76d('0x34')]?_0x9ab96c[_0xc76d('0x32')]:_0x2cf501[_0xc76d('0x31')];if(!_0x3d4076['query'][_0xc76d('0x35')](_0xc76d('0x36'))){_0x9ab96c[_0xc76d('0x1d')]=qs['limit'](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1d')]);_0x9ab96c[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x9ab96c['order']=qs['sort'](_0x3d4076[_0xc76d('0x2e')]['sort']);_0x9ab96c[_0xc76d('0x37')]=qs[_0xc76d('0x30')](_[_0xc76d('0x38')](_0x3d4076[_0xc76d('0x2e')],_0x2cf501['filters']),_0x283e16);if(_0x3d4076['query'][_0xc76d('0x39')]){_0x9ab96c[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x9ab96c[_0xc76d('0x37')],{'$or':_[_0xc76d('0x3b')](_0x283e16,function(_0x58c724){if(_0x58c724[_0xc76d('0x3c')]!==_0xc76d('0x3d')){var _0x321989={};_0x321989[_0x58c724[_0xc76d('0x2a')]]={'$like':'%'+_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x39')]+'%'};return _0x321989;}})});}_0x9ab96c=_[_0xc76d('0x3a')]({},_0x9ab96c,_0x3d4076[_0xc76d('0x3e')]);var _0x305f7d={'where':_0x9ab96c[_0xc76d('0x37')]};return db['VoiceMail']['count'](_0x305f7d)[_0xc76d('0x24')](function(_0x2a0759){_0x4feeda[_0xc76d('0x1b')]=_0x2a0759;if(_0x3d4076[_0xc76d('0x2e')]['includeAll']){_0x9ab96c['include']=[{'all':!![]}];}return db[_0xc76d('0x2c')][_0xc76d('0x3f')](_0x9ab96c);})[_0xc76d('0x24')](function(_0x15eb42){_0x4feeda[_0xc76d('0x40')]=_0x15eb42;return _0x4feeda;})[_0xc76d('0x24')](respondWithFilteredResult(_0x1c68f3,_0x9ab96c))[_0xc76d('0x41')](handleError(_0x1c68f3,null));};exports[_0xc76d('0x42')]=function(_0x50e922,_0x7bf0){var _0x95193f={'raw':!![],'where':{'id':_0x50e922[_0xc76d('0x43')]['id']}},_0x1bf8a0={};_0x1bf8a0['model']=_['keys'](db['VoiceMail']['rawAttributes']);_0x1bf8a0['query']=_['keys'](_0x50e922['query']);_0x1bf8a0[_0xc76d('0x30')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],_0x1bf8a0[_0xc76d('0x2e')]);_0x95193f[_0xc76d('0x32')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x50e922['query'][_0xc76d('0x33')]));_0x95193f[_0xc76d('0x32')]=_0x95193f[_0xc76d('0x32')][_0xc76d('0x34')]?_0x95193f[_0xc76d('0x32')]:_0x1bf8a0[_0xc76d('0x31')];if(_0x50e922[_0xc76d('0x2e')][_0xc76d('0x45')]){_0x95193f[_0xc76d('0x46')]=[{'all':!![]}];}_0x95193f=_['merge']({},_0x95193f,_0x50e922['options']);return db[_0xc76d('0x2c')][_0xc76d('0x47')](_0x95193f)[_0xc76d('0x24')](handleEntityNotFound(_0x7bf0,null))[_0xc76d('0x24')](respondWithResult(_0x7bf0,null))[_0xc76d('0x41')](handleError(_0x7bf0,null));};exports['create']=function(_0x25fc9d,_0x1ede13){return db['VoiceMail']['create'](_0x25fc9d[_0xc76d('0x48')],{})[_0xc76d('0x24')](function(_0x48cad0){var _0xe44a25=_0x25fc9d[_0xc76d('0x49')][_0xc76d('0x26')]({'plain':!![]});if(!_0xe44a25)throw new Error(_0xc76d('0x4a'));if(_0xe44a25[_0xc76d('0x4b')]===_0xc76d('0x49')){var _0x25a549=_0x48cad0[_0xc76d('0x26')]({'plain':!![]});var _0x4452a8=_0xc76d('0x27');return db['UserProfileSection'][_0xc76d('0x47')]({'where':{'name':_0x4452a8,'userProfileId':_0xe44a25[_0xc76d('0x4c')]},'raw':!![]})[_0xc76d('0x24')](function(_0x55e3af){if(_0x55e3af&&_0x55e3af[_0xc76d('0x4d')]===0x0){return db[_0xc76d('0x28')]['create']({'name':_0x25a549[_0xc76d('0x2a')],'resourceId':_0x25a549['id'],'type':_0x55e3af['name'],'sectionId':_0x55e3af['id']},{})[_0xc76d('0x24')](function(){return _0x48cad0;});}else{return _0x48cad0;}})[_0xc76d('0x41')](function(_0x316978){logger[_0xc76d('0x29')](_0xc76d('0x4e'),_0x316978);throw _0x316978;});}return _0x48cad0;})['then'](respondWithResult(_0x1ede13,0xc9))['catch'](handleError(_0x1ede13,null));};exports['update']=function(_0x320483,_0x746759){if(_0x320483[_0xc76d('0x48')]['id']){delete _0x320483[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x320483['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x746759,null))[_0xc76d('0x24')](saveUpdates(_0x320483[_0xc76d('0x48')],null))[_0xc76d('0x24')](respondWithResult(_0x746759,null))[_0xc76d('0x41')](handleError(_0x746759,null));};exports['destroy']=function(_0x275dfd,_0x463cbe){return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x275dfd[_0xc76d('0x43')]['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x463cbe,null))['then'](removeEntity(_0x463cbe,null))[_0xc76d('0x41')](handleError(_0x463cbe,null));};exports[_0xc76d('0x4f')]=function(_0x49105d,_0x5f3973,_0x1e9461){return db['VoiceMail'][_0xc76d('0x50')]({'where':{'id':_0x49105d[_0xc76d('0x43')]['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x5f3973,null))[_0xc76d('0x24')](function(_0x254128){var _0x4746a5;var _0x106c85={},_0x1db7bc={};_0x1db7bc[_0xc76d('0x31')]=_[_0xc76d('0x2f')](db[_0xc76d('0x51')][_0xc76d('0x52')]);_0x1db7bc[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x49105d['query']);_0x1db7bc[_0xc76d('0x30')]=_[_0xc76d('0x44')](_0x1db7bc[_0xc76d('0x31')],_0x1db7bc[_0xc76d('0x2e')]);_0x106c85[_0xc76d('0x32')]=_['intersection'](_0x1db7bc[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x49105d['query']['fields']));_0x106c85['attributes']=_0x106c85[_0xc76d('0x32')][_0xc76d('0x34')]?_0x106c85[_0xc76d('0x32')]:_0x1db7bc[_0xc76d('0x31')];if(!_0x49105d[_0xc76d('0x2e')][_0xc76d('0x35')](_0xc76d('0x36'))){_0x106c85[_0xc76d('0x1d')]=qs['limit'](_0x49105d[_0xc76d('0x2e')]['limit']);_0x106c85['offset']=qs[_0xc76d('0x1c')](_0x49105d[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x106c85['order']=qs[_0xc76d('0x53')](_0x49105d['query']['sort']);_0x106c85['where']=qs[_0xc76d('0x30')](_[_0xc76d('0x38')](_0x49105d['query'],_0x1db7bc[_0xc76d('0x30')]));if(_0x49105d[_0xc76d('0x2e')][_0xc76d('0x39')]){_0x106c85[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x106c85[_0xc76d('0x37')],{'$or':_[_0xc76d('0x3b')](_0x106c85['attributes'],function(_0x5035fd){var _0x4c523f={};_0x4c523f[_0x5035fd]={'$like':'%'+_0x49105d[_0xc76d('0x2e')][_0xc76d('0x39')]+'%'};return _0x4c523f;})});}_0x106c85[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x106c85[_0xc76d('0x37')],{'mailboxuser':_0x254128['mailbox']});_0x106c85=_[_0xc76d('0x3a')]({},_0x106c85,_0x49105d[_0xc76d('0x3e')]);return db[_0xc76d('0x51')][_0xc76d('0x54')](_0x106c85)[_0xc76d('0x24')](respondWithFilteredResult(_0x5f3973,_0x106c85));})[_0xc76d('0x41')](handleError(_0x5f3973,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1289857..4741470 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 _0x99dd=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99dd,0x188));var _0xd99d=function(_0x2a3d74,_0x487ab5){_0x2a3d74=_0x2a3d74-0x0;var _0x219489=_0x99dd[_0x2a3d74];return _0x219489;};'use strict';var _=require(_0xd99d('0x0'));var util=require(_0xd99d('0x1'));var logger=require(_0xd99d('0x2'))('api');var moment=require(_0xd99d('0x3'));var BPromise=require('bluebird');var rp=require(_0xd99d('0x4'));var fs=require('fs');var path=require(_0xd99d('0x5'));var rimraf=require(_0xd99d('0x6'));var config=require(_0xd99d('0x7'));var attributes=require(_0xd99d('0x8'));module[_0xd99d('0x9')]=function(_0x264208,_0x55b60a){return _0x264208[_0xd99d('0xa')](_0xd99d('0xb'),attributes,{'tableName':_0xd99d('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xd99d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7d9=['voice_voicemail','mailbox','context','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail'];(function(_0x4edd2a,_0x4578b4){var _0x351d32=function(_0x3b1519){while(--_0x3b1519){_0x4edd2a['push'](_0x4edd2a['shift']());}};_0x351d32(++_0x4578b4);}(_0xe7d9,0xb9));var _0x9e7d=function(_0x85391a,_0x2f217b){_0x85391a=_0x85391a-0x0;var _0xef269b=_0xe7d9[_0x85391a];return _0xef269b;};'use strict';var _=require(_0x9e7d('0x0'));var util=require(_0x9e7d('0x1'));var logger=require(_0x9e7d('0x2'))('api');var moment=require(_0x9e7d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e7d('0x4'));var rimraf=require(_0x9e7d('0x5'));var config=require(_0x9e7d('0x6'));var attributes=require(_0x9e7d('0x7'));module['exports']=function(_0x2f60ee,_0x252a06){return _0x2f60ee[_0x9e7d('0x8')](_0x9e7d('0x9'),attributes,{'tableName':_0x9e7d('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x9e7d('0xb'),_0x9e7d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4a0df22..b4abf84 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 _0x4b8d=['request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4b8d,0x1ed));var _0xd4b8=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x4b8d[_0x3a2e49];return _0x257140;};'use strict';var _=require(_0xd4b8('0x0'));var util=require(_0xd4b8('0x1'));var moment=require(_0xd4b8('0x2'));var BPromise=require(_0xd4b8('0x3'));var rs=require(_0xd4b8('0x4'));var fs=require('fs');var Redis=require(_0xd4b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4b8('0x6'));var logger=require('../../config/logger')(_0xd4b8('0x7'));var config=require(_0xd4b8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd4b8('0x9')][_0xd4b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x689c14,_0x1593cb,_0xff75e7){return new BPromise(function(_0x3685e6,_0x1708b8){return client[_0xd4b8('0xb')](_0x689c14,_0xff75e7)[_0xd4b8('0xc')](function(_0x4bb0cb){logger[_0xd4b8('0xd')]('VoiceMail,\x20%s,\x20%s',_0x1593cb,_0xd4b8('0xe'));logger[_0xd4b8('0xf')](_0xd4b8('0x10'),_0x1593cb,_0xd4b8('0xe'),JSON[_0xd4b8('0x11')](_0x4bb0cb));if(_0x4bb0cb[_0xd4b8('0x12')]){if(_0x4bb0cb[_0xd4b8('0x12')][_0xd4b8('0x13')]===0x1f4){logger[_0xd4b8('0x12')](_0xd4b8('0x14'),_0x1593cb,_0x4bb0cb[_0xd4b8('0x12')][_0xd4b8('0x15')]);return _0x1708b8(_0x4bb0cb[_0xd4b8('0x12')]['message']);}logger[_0xd4b8('0x12')](_0xd4b8('0x14'),_0x1593cb,_0x4bb0cb[_0xd4b8('0x12')][_0xd4b8('0x15')]);return _0x3685e6(_0x4bb0cb[_0xd4b8('0x12')][_0xd4b8('0x15')]);}else{logger[_0xd4b8('0xd')](_0xd4b8('0x14'),_0x1593cb,_0xd4b8('0xe'));_0x3685e6(_0x4bb0cb[_0xd4b8('0x16')][_0xd4b8('0x15')]);}})[_0xd4b8('0x17')](function(_0x1bd3dd){logger[_0xd4b8('0x12')](_0xd4b8('0x14'),_0x1593cb,_0x1bd3dd);_0x1708b8(_0x1bd3dd);});});} \ No newline at end of file +var _0xad4f=['info','request\x20sent','debug','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','then'];(function(_0x75f524,_0x7b6ca9){var _0x4567c4=function(_0x42677e){while(--_0x42677e){_0x75f524['push'](_0x75f524['shift']());}};_0x4567c4(++_0x7b6ca9);}(_0xad4f,0x127));var _0xfad4=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xad4f[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xfad4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfad4('0x1'));var rs=require(_0xfad4('0x2'));var fs=require('fs');var Redis=require(_0xfad4('0x3'));var db=require(_0xfad4('0x4'))['db'];var utils=require(_0xfad4('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfad4('0x6'));var client=jayson[_0xfad4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4686d1,_0x5395ad,_0x110a87){return new BPromise(function(_0x1242b6,_0x46bcb7){return client['request'](_0x4686d1,_0x110a87)[_0xfad4('0x8')](function(_0x1ba2a7){logger[_0xfad4('0x9')]('VoiceMail,\x20%s,\x20%s',_0x5395ad,_0xfad4('0xa'));logger[_0xfad4('0xb')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5395ad,_0xfad4('0xa'),JSON[_0xfad4('0xc')](_0x1ba2a7));if(_0x1ba2a7[_0xfad4('0xd')]){if(_0x1ba2a7[_0xfad4('0xd')][_0xfad4('0xe')]===0x1f4){logger[_0xfad4('0xd')]('VoiceMail,\x20%s,\x20%s',_0x5395ad,_0x1ba2a7['error']['message']);return _0x46bcb7(_0x1ba2a7[_0xfad4('0xd')][_0xfad4('0xf')]);}logger[_0xfad4('0xd')](_0xfad4('0x10'),_0x5395ad,_0x1ba2a7[_0xfad4('0xd')][_0xfad4('0xf')]);return _0x1242b6(_0x1ba2a7['error'][_0xfad4('0xf')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x5395ad,_0xfad4('0xa'));_0x1242b6(_0x1ba2a7[_0xfad4('0x11')][_0xfad4('0xf')]);}})[_0xfad4('0x12')](function(_0x411676){logger['error'](_0xfad4('0x10'),_0x5395ad,_0x411676);_0x46bcb7(_0x411676);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index ef1c724..61ef980 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 _0xc24f=['delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','update'];(function(_0x43f853,_0x7d78b){var _0x438270=function(_0x5d74e8){while(--_0x5d74e8){_0x43f853['push'](_0x43f853['shift']());}};_0x438270(++_0x7d78b);}(_0xc24f,0x1a7));var _0xfc24=function(_0x53cd30,_0x41dc3e){_0x53cd30=_0x53cd30-0x0;var _0x21a342=_0xc24f[_0x53cd30];return _0x21a342;};'use strict';var multer=require('multer');var util=require(_0xfc24('0x0'));var path=require('path');var timeout=require(_0xfc24('0x1'));var express=require('express');var router=express[_0xfc24('0x2')]();var fs_extra=require(_0xfc24('0x3'));var auth=require(_0xfc24('0x4'));var interaction=require(_0xfc24('0x5'));var config=require(_0xfc24('0x6'));var controller=require(_0xfc24('0x7'));router[_0xfc24('0x8')]('/',auth[_0xfc24('0x9')](),controller[_0xfc24('0xa')]);router[_0xfc24('0x8')]('/:id',auth[_0xfc24('0x9')](),controller[_0xfc24('0xb')]);router[_0xfc24('0x8')](_0xfc24('0xc'),auth[_0xfc24('0x9')](),controller[_0xfc24('0xd')]);router[_0xfc24('0xe')]('/',auth[_0xfc24('0x9')](),controller[_0xfc24('0xf')]);router['put'](_0xfc24('0x10'),auth[_0xfc24('0x9')](),controller[_0xfc24('0x11')]);router[_0xfc24('0x12')](_0xfc24('0x10'),auth[_0xfc24('0x9')](),controller[_0xfc24('0x13')]);module[_0xfc24('0x14')]=router; \ No newline at end of file +var _0xc1d9=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','download','post','put'];(function(_0x11807a,_0xb04cc2){var _0x347921=function(_0x12389a){while(--_0x12389a){_0x11807a['push'](_0x11807a['shift']());}};_0x347921(++_0xb04cc2);}(_0xc1d9,0x7b));var _0x9c1d=function(_0x355aee,_0x3de5cc){_0x355aee=_0x355aee-0x0;var _0x541500=_0xc1d9[_0x355aee];return _0x541500;};'use strict';var multer=require(_0x9c1d('0x0'));var util=require(_0x9c1d('0x1'));var path=require(_0x9c1d('0x2'));var timeout=require(_0x9c1d('0x3'));var express=require(_0x9c1d('0x4'));var router=express[_0x9c1d('0x5')]();var fs_extra=require(_0x9c1d('0x6'));var auth=require(_0x9c1d('0x7'));var interaction=require(_0x9c1d('0x8'));var config=require('../../config/environment');var controller=require(_0x9c1d('0x9'));router[_0x9c1d('0xa')]('/',auth[_0x9c1d('0xb')](),controller[_0x9c1d('0xc')]);router[_0x9c1d('0xa')]('/:id',auth[_0x9c1d('0xb')](),controller['show']);router[_0x9c1d('0xa')](_0x9c1d('0xd'),auth[_0x9c1d('0xb')](),controller[_0x9c1d('0xe')]);router[_0x9c1d('0xf')]('/',auth[_0x9c1d('0xb')](),controller['create']);router[_0x9c1d('0x10')]('/:id',auth[_0x9c1d('0xb')](),controller[_0x9c1d('0x11')]);router['delete']('/:id',auth[_0x9c1d('0xb')](),controller[_0x9c1d('0x12')]);module[_0x9c1d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4601014..ab77dcc 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 _0x488d=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','BLOB','TIMESTAMP'];(function(_0x73acf8,_0x5e2655){var _0x58a2b4=function(_0x31b37e){while(--_0x31b37e){_0x73acf8['push'](_0x73acf8['shift']());}};_0x58a2b4(++_0x5e2655);}(_0x488d,0x13a));var _0xd488=function(_0x41e3bc,_0x1c137f){_0x41e3bc=_0x41e3bc-0x0;var _0x116b05=_0x488d[_0x41e3bc];return _0x116b05;};'use strict';var Sequelize=require('sequelize');module[_0xd488('0x0')]={'name':{'type':Sequelize[_0xd488('0x1')],'get':function(_0x997b5){return this[_0xd488('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd488('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xd488('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xd488('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd488('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd488('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xd488('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xd488('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd488('0x3')],'defaultValue':''},'stamp':{'type':_0xd488('0x5'),'defaultValue':Sequelize[_0xd488('0x6')](_0xd488('0x7'))}}; \ No newline at end of file +var _0x4975=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','getDataValue','INTEGER','STRING','BLOB'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x4975,0x83));var _0x5497=function(_0x5ad639,_0x3b79c2){_0x5ad639=_0x5ad639-0x0;var _0xa38177=_0x4975[_0x5ad639];return _0xa38177;};'use strict';var Sequelize=require('sequelize');module[_0x5497('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x528571){return this[_0x5497('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x5497('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5497('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5497('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5497('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x5497('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5497('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5497('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x5497('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5497('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x5497('0x5'),'defaultValue':Sequelize[_0x5497('0x6')](_0x5497('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 759ad8f..8fd82e0 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 _0x6e19=['map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','download','msg_id','recording','ValidationError','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','index'];(function(_0x30f5e3,_0x41d3ba){var _0x22ed90=function(_0x1b2020){while(--_0x1b2020){_0x30f5e3['push'](_0x30f5e3['shift']());}};_0x22ed90(++_0x41d3ba);}(_0x6e19,0x16c));var _0x96e1=function(_0xbae42b,_0x288fc5){_0xbae42b=_0xbae42b-0x0;var _0x408e41=_0x6e19[_0xbae42b];return _0x408e41;};'use strict';var emlformat=require(_0x96e1('0x0'));var rimraf=require(_0x96e1('0x1'));var zipdir=require(_0x96e1('0x2'));var jsonpatch=require(_0x96e1('0x3'));var rp=require(_0x96e1('0x4'));var moment=require('moment');var BPromise=require(_0x96e1('0x5'));var Mustache=require('mustache');var util=require(_0x96e1('0x6'));var path=require('path');var sox=require(_0x96e1('0x7'));var csv=require(_0x96e1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96e1('0x9'));var _=require(_0x96e1('0xa'));var squel=require(_0x96e1('0xb'));var crypto=require(_0x96e1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x96e1('0xd'));var toCsv=require(_0x96e1('0x8'));var querystring=require(_0x96e1('0xe'));var Papa=require('papaparse');var Redis=require(_0x96e1('0xf'));var authService=require(_0x96e1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96e1('0x11'));var logger=require(_0x96e1('0x12'))('api');var utils=require(_0x96e1('0x13'));var config=require(_0x96e1('0x14'));var licenseUtil=require(_0x96e1('0x15'));var db=require(_0x96e1('0x16'))['db'];function respondWithStatusCode(_0x474142,_0x119b38){_0x119b38=_0x119b38||0xcc;return function(_0x5687e8){if(_0x5687e8){return _0x474142[_0x96e1('0x17')](_0x119b38);}return _0x474142['status'](_0x119b38)[_0x96e1('0x18')]();};}function respondWithResult(_0x1c82d3,_0x2a19d1){_0x2a19d1=_0x2a19d1||0xc8;return function(_0x4100c2){if(_0x4100c2){return _0x1c82d3[_0x96e1('0x19')](_0x2a19d1)[_0x96e1('0x1a')](_0x4100c2);}};}function respondWithFilteredResult(_0x2182ea,_0x2634cd){return function(_0x15415c){if(_0x15415c){var _0x167d05=typeof _0x2634cd[_0x96e1('0x1b')]===_0x96e1('0x1c')&&typeof _0x2634cd[_0x96e1('0x1d')]===_0x96e1('0x1c');var _0x195843=_0x15415c[_0x96e1('0x1e')];var _0x69090f=_0x167d05?0x0:_0x2634cd[_0x96e1('0x1b')];var _0x16eab4=_0x167d05?_0x15415c[_0x96e1('0x1e')]:_0x2634cd[_0x96e1('0x1b')]+_0x2634cd[_0x96e1('0x1d')];var _0x1c56e0;if(_0x16eab4>=_0x195843){_0x16eab4=_0x195843;_0x1c56e0=0xc8;}else{_0x1c56e0=0xce;}_0x2182ea['status'](_0x1c56e0);return _0x2182ea['set']('Content-Range',_0x69090f+'-'+_0x16eab4+'/'+_0x195843)[_0x96e1('0x1a')](_0x15415c);}return null;};}function patchUpdates(_0x30b3bc){return function(_0x1c026e){try{jsonpatch[_0x96e1('0x1f')](_0x1c026e,_0x30b3bc,!![]);}catch(_0x49532c){return BPromise[_0x96e1('0x20')](_0x49532c);}return _0x1c026e[_0x96e1('0x21')]();};}function saveUpdates(_0x52cb5e,_0x17c8e1){return function(_0x2fb4ce){if(_0x2fb4ce){return _0x2fb4ce[_0x96e1('0x22')](_0x52cb5e)[_0x96e1('0x23')](function(_0x38fe1e){return _0x38fe1e;});}return null;};}function removeEntity(_0x8f91e6,_0x3ba085){return function(_0x64017b){if(_0x64017b){return _0x64017b['destroy']()[_0x96e1('0x23')](function(){_0x8f91e6[_0x96e1('0x19')](0xcc)[_0x96e1('0x18')]();});}};}function handleEntityNotFound(_0x1e95d2,_0x2d3c04){return function(_0x2ce86a){if(!_0x2ce86a){_0x1e95d2[_0x96e1('0x17')](0x194);}return _0x2ce86a;};}function handleError(_0x5a2b60,_0x16609a){_0x16609a=_0x16609a||0x1f4;return function(_0xf54cab){logger[_0x96e1('0x24')](_0xf54cab[_0x96e1('0x25')]);if(_0xf54cab[_0x96e1('0x26')]){delete _0xf54cab[_0x96e1('0x26')];}_0x5a2b60[_0x96e1('0x19')](_0x16609a)[_0x96e1('0x27')](_0xf54cab);};}exports[_0x96e1('0x28')]=function(_0x2e547c,_0x1dce62){var _0x509b22={},_0xf6e4a5={},_0x30c4ae={'count':0x0,'rows':[]};var _0x539822=_[_0x96e1('0x29')](db[_0x96e1('0x2a')][_0x96e1('0x2b')],function(_0x5e13d0){return{'name':_0x5e13d0[_0x96e1('0x2c')],'type':_0x5e13d0[_0x96e1('0x2d')][_0x96e1('0x2e')]};});_0xf6e4a5['model']=_[_0x96e1('0x2f')](_[_0x96e1('0x29')](_0x539822,_0x96e1('0x26')),['name']);_0xf6e4a5[_0x96e1('0x30')]=_[_0x96e1('0x31')](_0x2e547c[_0x96e1('0x30')]);_0xf6e4a5[_0x96e1('0x32')]=_[_0x96e1('0x33')](_0xf6e4a5[_0x96e1('0x34')],_0xf6e4a5[_0x96e1('0x30')]);_0x509b22[_0x96e1('0x35')]=_[_0x96e1('0x33')](_0xf6e4a5[_0x96e1('0x34')],qs[_0x96e1('0x36')](_0x2e547c['query']['fields']));_0x509b22['attributes']=_0x509b22['attributes'][_0x96e1('0x37')]?_0x509b22['attributes']:_0xf6e4a5[_0x96e1('0x34')];if(!_0x2e547c[_0x96e1('0x30')][_0x96e1('0x38')](_0x96e1('0x39'))){_0x509b22['limit']=qs[_0x96e1('0x1d')](_0x2e547c['query']['limit']);_0x509b22[_0x96e1('0x1b')]=qs[_0x96e1('0x1b')](_0x2e547c[_0x96e1('0x30')][_0x96e1('0x1b')]);}_0x509b22[_0x96e1('0x3a')]=qs[_0x96e1('0x3b')](_0x2e547c['query']['sort']);_0x509b22[_0x96e1('0x3c')]=qs[_0x96e1('0x32')](_['pick'](_0x2e547c['query'],_0xf6e4a5[_0x96e1('0x32')]),_0x539822);if(_0x2e547c[_0x96e1('0x30')]['filter']){_0x509b22[_0x96e1('0x3c')]=_[_0x96e1('0x3d')](_0x509b22['where'],{'$or':_['map'](_0x539822,function(_0x11499c){if(_0x11499c[_0x96e1('0x2d')]!==_0x96e1('0x3e')){var _0xcae90={};_0xcae90[_0x11499c[_0x96e1('0x26')]]={'$like':'%'+_0x2e547c['query']['filter']+'%'};return _0xcae90;}})});}_0x509b22=_['merge']({},_0x509b22,_0x2e547c[_0x96e1('0x3f')]);var _0xffc3b9={'where':_0x509b22[_0x96e1('0x3c')]};return db['VoiceMailMessage']['count'](_0xffc3b9)[_0x96e1('0x23')](function(_0x937a53){_0x30c4ae[_0x96e1('0x1e')]=_0x937a53;if(_0x2e547c['query'][_0x96e1('0x40')]){_0x509b22[_0x96e1('0x41')]=[{'all':!![]}];}return db[_0x96e1('0x2a')][_0x96e1('0x42')](_0x509b22);})[_0x96e1('0x23')](function(_0x1e0b77){_0x30c4ae[_0x96e1('0x43')]=_0x1e0b77;return _0x30c4ae;})['then'](respondWithFilteredResult(_0x1dce62,_0x509b22))['catch'](handleError(_0x1dce62,null));};exports[_0x96e1('0x44')]=function(_0x315121,_0x2c09f1){var _0xdfb8a2={'raw':!![],'where':{'id':_0x315121[_0x96e1('0x45')]['id']}},_0x2b9f2e={};_0x2b9f2e['model']=_['keys'](db['VoiceMailMessage'][_0x96e1('0x2b')]);_0x2b9f2e['query']=_[_0x96e1('0x31')](_0x315121[_0x96e1('0x30')]);_0x2b9f2e[_0x96e1('0x32')]=_[_0x96e1('0x33')](_0x2b9f2e['model'],_0x2b9f2e[_0x96e1('0x30')]);_0xdfb8a2['attributes']=_[_0x96e1('0x33')](_0x2b9f2e[_0x96e1('0x34')],qs[_0x96e1('0x36')](_0x315121[_0x96e1('0x30')][_0x96e1('0x36')]));_0xdfb8a2[_0x96e1('0x35')]=_0xdfb8a2['attributes'][_0x96e1('0x37')]?_0xdfb8a2[_0x96e1('0x35')]:_0x2b9f2e[_0x96e1('0x34')];if(_0x315121['query']['includeAll']){_0xdfb8a2[_0x96e1('0x41')]=[{'all':!![]}];}_0xdfb8a2=_['merge']({},_0xdfb8a2,_0x315121[_0x96e1('0x3f')]);return db[_0x96e1('0x2a')][_0x96e1('0x46')](_0xdfb8a2)['then'](handleEntityNotFound(_0x2c09f1,null))[_0x96e1('0x23')](respondWithResult(_0x2c09f1,null))[_0x96e1('0x47')](handleError(_0x2c09f1,null));};exports[_0x96e1('0x48')]=function(_0x31a1f3,_0x16b3e9){return db[_0x96e1('0x2a')][_0x96e1('0x48')](_0x31a1f3[_0x96e1('0x49')],{})[_0x96e1('0x23')](respondWithResult(_0x16b3e9,0xc9))[_0x96e1('0x47')](handleError(_0x16b3e9,null));};exports[_0x96e1('0x22')]=function(_0x8544c,_0x16fef4){if(_0x8544c[_0x96e1('0x49')]['id']){delete _0x8544c['body']['id'];}return db[_0x96e1('0x2a')]['find']({'where':{'id':_0x8544c['params']['id']}})[_0x96e1('0x23')](handleEntityNotFound(_0x16fef4,null))[_0x96e1('0x23')](saveUpdates(_0x8544c[_0x96e1('0x49')],null))[_0x96e1('0x23')](respondWithResult(_0x16fef4,null))['catch'](handleError(_0x16fef4,null));};exports[_0x96e1('0x4a')]=function(_0x536251,_0x372f5f){return db[_0x96e1('0x2a')][_0x96e1('0x46')]({'where':{'id':_0x536251[_0x96e1('0x45')]['id']}})[_0x96e1('0x23')](handleEntityNotFound(_0x372f5f,null))['then'](removeEntity(_0x372f5f,null))[_0x96e1('0x47')](handleError(_0x372f5f,null));};exports[_0x96e1('0x4b')]=function(_0x313344,_0x3ac8cb,_0x123a36){return db[_0x96e1('0x2a')][_0x96e1('0x46')]({'where':{'id':_0x313344[_0x96e1('0x45')]['id']},'attributes':['id','recording',_0x96e1('0x4c')]})[_0x96e1('0x23')](handleEntityNotFound(_0x3ac8cb,null))['then'](function(_0x280283){if(_0x280283){if(!_0x280283[_0x96e1('0x4d')]){throw new db['Sequelize'][(_0x96e1('0x4e'))]('VoiceMailMessage\x20not\x20found');}var _0x5a9c4c={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x280283[_0x96e1('0x4c')]){_0x5a9c4c[_0x96e1('0x4f')]='attachment;\x20filename=\x22'+_0x280283['msg_id']+_0x96e1('0x50');}_0x3ac8cb['set'](_0x5a9c4c);return _0x3ac8cb['send'](new Buffer(_0x280283[_0x96e1('0x4d')]));}})['catch'](handleError(_0x3ac8cb,null));}; \ No newline at end of file +var _0x8535=['count','set','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','VoiceMailMessage','rawAttributes','key','model','differenceBy','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','merge','find','create','body','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x26dc6e,_0x12054a){var _0x3cbfc3=function(_0x10ad19){while(--_0x10ad19){_0x26dc6e['push'](_0x26dc6e['shift']());}};_0x3cbfc3(++_0x12054a);}(_0x8535,0x12d));var _0x5853=function(_0xdd1fa5,_0x2f2ba0){_0xdd1fa5=_0xdd1fa5-0x0;var _0x47b1e6=_0x8535[_0xdd1fa5];return _0x47b1e6;};'use strict';var emlformat=require(_0x5853('0x0'));var rimraf=require(_0x5853('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5853('0x2'));var moment=require(_0x5853('0x3'));var BPromise=require(_0x5853('0x4'));var Mustache=require(_0x5853('0x5'));var util=require('util');var path=require(_0x5853('0x6'));var sox=require('sox');var csv=require(_0x5853('0x7'));var ejs=require(_0x5853('0x8'));var fs=require('fs');var fs_extra=require(_0x5853('0x9'));var _=require(_0x5853('0xa'));var squel=require(_0x5853('0xb'));var crypto=require(_0x5853('0xc'));var jsforce=require(_0x5853('0xd'));var deskjs=require(_0x5853('0xe'));var toCsv=require(_0x5853('0x7'));var querystring=require(_0x5853('0xf'));var Papa=require(_0x5853('0x10'));var Redis=require(_0x5853('0x11'));var authService=require(_0x5853('0x12'));var qs=require(_0x5853('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5853('0x14'));var logger=require(_0x5853('0x15'))('api');var utils=require(_0x5853('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5853('0x17'));var db=require(_0x5853('0x18'))['db'];function respondWithStatusCode(_0x2ef443,_0x322bc8){_0x322bc8=_0x322bc8||0xcc;return function(_0x312e1f){if(_0x312e1f){return _0x2ef443['sendStatus'](_0x322bc8);}return _0x2ef443[_0x5853('0x19')](_0x322bc8)[_0x5853('0x1a')]();};}function respondWithResult(_0x166398,_0x422fa3){_0x422fa3=_0x422fa3||0xc8;return function(_0x3106c7){if(_0x3106c7){return _0x166398[_0x5853('0x19')](_0x422fa3)[_0x5853('0x1b')](_0x3106c7);}};}function respondWithFilteredResult(_0x3b91cc,_0x275652){return function(_0x5b2a56){if(_0x5b2a56){var _0x3792f5=typeof _0x275652[_0x5853('0x1c')]===_0x5853('0x1d')&&typeof _0x275652[_0x5853('0x1e')]===_0x5853('0x1d');var _0x3e509c=_0x5b2a56['count'];var _0x22ca19=_0x3792f5?0x0:_0x275652[_0x5853('0x1c')];var _0x33d471=_0x3792f5?_0x5b2a56[_0x5853('0x1f')]:_0x275652[_0x5853('0x1c')]+_0x275652[_0x5853('0x1e')];var _0x515ba8;if(_0x33d471>=_0x3e509c){_0x33d471=_0x3e509c;_0x515ba8=0xc8;}else{_0x515ba8=0xce;}_0x3b91cc[_0x5853('0x19')](_0x515ba8);return _0x3b91cc[_0x5853('0x20')]('Content-Range',_0x22ca19+'-'+_0x33d471+'/'+_0x3e509c)['json'](_0x5b2a56);}return null;};}function patchUpdates(_0x1ce9d3){return function(_0x34fa85){try{jsonpatch[_0x5853('0x21')](_0x34fa85,_0x1ce9d3,!![]);}catch(_0x49bb58){return BPromise[_0x5853('0x22')](_0x49bb58);}return _0x34fa85[_0x5853('0x23')]();};}function saveUpdates(_0x2a6def,_0x2ba8b7){return function(_0xc293fa){if(_0xc293fa){return _0xc293fa[_0x5853('0x24')](_0x2a6def)['then'](function(_0x315b3c){return _0x315b3c;});}return null;};}function removeEntity(_0x2fbff9,_0x22a764){return function(_0x512257){if(_0x512257){return _0x512257['destroy']()[_0x5853('0x25')](function(){_0x2fbff9[_0x5853('0x19')](0xcc)[_0x5853('0x1a')]();});}};}function handleEntityNotFound(_0x53582f,_0x445fa8){return function(_0x5420bc){if(!_0x5420bc){_0x53582f[_0x5853('0x26')](0x194);}return _0x5420bc;};}function handleError(_0x3de35b,_0x532061){_0x532061=_0x532061||0x1f4;return function(_0x5bd3b1){logger[_0x5853('0x27')](_0x5bd3b1[_0x5853('0x28')]);if(_0x5bd3b1[_0x5853('0x29')]){delete _0x5bd3b1[_0x5853('0x29')];}_0x3de35b[_0x5853('0x19')](_0x532061)['send'](_0x5bd3b1);};}exports[_0x5853('0x2a')]=function(_0x5b3575,_0x21f530){var _0x44d868={},_0x2be13a={},_0x500984={'count':0x0,'rows':[]};var _0x5e16a5=_[_0x5853('0x2b')](db[_0x5853('0x2c')][_0x5853('0x2d')],function(_0x39276f){return{'name':_0x39276f['fieldName'],'type':_0x39276f['type'][_0x5853('0x2e')]};});_0x2be13a[_0x5853('0x2f')]=_[_0x5853('0x30')](_['map'](_0x5e16a5,_0x5853('0x29')),[_0x5853('0x29')]);_0x2be13a[_0x5853('0x31')]=_[_0x5853('0x32')](_0x5b3575[_0x5853('0x31')]);_0x2be13a['filters']=_['intersection'](_0x2be13a[_0x5853('0x2f')],_0x2be13a[_0x5853('0x31')]);_0x44d868['attributes']=_[_0x5853('0x33')](_0x2be13a[_0x5853('0x2f')],qs[_0x5853('0x34')](_0x5b3575[_0x5853('0x31')][_0x5853('0x34')]));_0x44d868['attributes']=_0x44d868[_0x5853('0x35')][_0x5853('0x36')]?_0x44d868[_0x5853('0x35')]:_0x2be13a[_0x5853('0x2f')];if(!_0x5b3575[_0x5853('0x31')]['hasOwnProperty'](_0x5853('0x37'))){_0x44d868['limit']=qs[_0x5853('0x1e')](_0x5b3575[_0x5853('0x31')][_0x5853('0x1e')]);_0x44d868['offset']=qs[_0x5853('0x1c')](_0x5b3575['query'][_0x5853('0x1c')]);}_0x44d868['order']=qs['sort'](_0x5b3575[_0x5853('0x31')][_0x5853('0x38')]);_0x44d868[_0x5853('0x39')]=qs[_0x5853('0x3a')](_[_0x5853('0x3b')](_0x5b3575[_0x5853('0x31')],_0x2be13a[_0x5853('0x3a')]),_0x5e16a5);if(_0x5b3575[_0x5853('0x31')][_0x5853('0x3c')]){_0x44d868[_0x5853('0x39')]=_['merge'](_0x44d868[_0x5853('0x39')],{'$or':_[_0x5853('0x2b')](_0x5e16a5,function(_0x215ac5){if(_0x215ac5[_0x5853('0x3d')]!==_0x5853('0x3e')){var _0x11ddb3={};_0x11ddb3[_0x215ac5[_0x5853('0x29')]]={'$like':'%'+_0x5b3575['query'][_0x5853('0x3c')]+'%'};return _0x11ddb3;}})});}_0x44d868=_['merge']({},_0x44d868,_0x5b3575[_0x5853('0x3f')]);var _0x9b3a5a={'where':_0x44d868['where']};return db[_0x5853('0x2c')][_0x5853('0x1f')](_0x9b3a5a)[_0x5853('0x25')](function(_0x1782f8){_0x500984[_0x5853('0x1f')]=_0x1782f8;if(_0x5b3575[_0x5853('0x31')]['includeAll']){_0x44d868['include']=[{'all':!![]}];}return db[_0x5853('0x2c')][_0x5853('0x40')](_0x44d868);})[_0x5853('0x25')](function(_0x2624cb){_0x500984[_0x5853('0x41')]=_0x2624cb;return _0x500984;})[_0x5853('0x25')](respondWithFilteredResult(_0x21f530,_0x44d868))[_0x5853('0x42')](handleError(_0x21f530,null));};exports['show']=function(_0xb40521,_0x2f7e2d){var _0x3fbd1f={'raw':!![],'where':{'id':_0xb40521[_0x5853('0x43')]['id']}},_0x295503={};_0x295503[_0x5853('0x2f')]=_['keys'](db['VoiceMailMessage'][_0x5853('0x2d')]);_0x295503[_0x5853('0x31')]=_[_0x5853('0x32')](_0xb40521['query']);_0x295503['filters']=_[_0x5853('0x33')](_0x295503[_0x5853('0x2f')],_0x295503[_0x5853('0x31')]);_0x3fbd1f[_0x5853('0x35')]=_[_0x5853('0x33')](_0x295503[_0x5853('0x2f')],qs[_0x5853('0x34')](_0xb40521[_0x5853('0x31')][_0x5853('0x34')]));_0x3fbd1f['attributes']=_0x3fbd1f['attributes']['length']?_0x3fbd1f[_0x5853('0x35')]:_0x295503[_0x5853('0x2f')];if(_0xb40521[_0x5853('0x31')][_0x5853('0x44')]){_0x3fbd1f[_0x5853('0x45')]=[{'all':!![]}];}_0x3fbd1f=_[_0x5853('0x46')]({},_0x3fbd1f,_0xb40521['options']);return db[_0x5853('0x2c')][_0x5853('0x47')](_0x3fbd1f)['then'](handleEntityNotFound(_0x2f7e2d,null))['then'](respondWithResult(_0x2f7e2d,null))['catch'](handleError(_0x2f7e2d,null));};exports['create']=function(_0x275530,_0x11854f){return db[_0x5853('0x2c')][_0x5853('0x48')](_0x275530[_0x5853('0x49')],{})[_0x5853('0x25')](respondWithResult(_0x11854f,0xc9))[_0x5853('0x42')](handleError(_0x11854f,null));};exports[_0x5853('0x24')]=function(_0x43916e,_0x5533c1){if(_0x43916e[_0x5853('0x49')]['id']){delete _0x43916e[_0x5853('0x49')]['id'];}return db['VoiceMailMessage'][_0x5853('0x47')]({'where':{'id':_0x43916e['params']['id']}})[_0x5853('0x25')](handleEntityNotFound(_0x5533c1,null))[_0x5853('0x25')](saveUpdates(_0x43916e['body'],null))[_0x5853('0x25')](respondWithResult(_0x5533c1,null))['catch'](handleError(_0x5533c1,null));};exports['destroy']=function(_0x59d7b0,_0x23770d){return db[_0x5853('0x2c')][_0x5853('0x47')]({'where':{'id':_0x59d7b0[_0x5853('0x43')]['id']}})['then'](handleEntityNotFound(_0x23770d,null))['then'](removeEntity(_0x23770d,null))['catch'](handleError(_0x23770d,null));};exports['download']=function(_0x578308,_0x56ab3f,_0x141ab0){return db['VoiceMailMessage'][_0x5853('0x47')]({'where':{'id':_0x578308[_0x5853('0x43')]['id']},'attributes':['id','recording',_0x5853('0x4a')]})[_0x5853('0x25')](handleEntityNotFound(_0x56ab3f,null))[_0x5853('0x25')](function(_0x4103ad){if(_0x4103ad){if(!_0x4103ad[_0x5853('0x4b')]){throw new db[(_0x5853('0x4c'))]['ValidationError'](_0x5853('0x4d'));}var _0xc4fec3={'Content-Type':_0x5853('0x4e'),'Content-Disposition':_0x5853('0x4f')};if(_0x4103ad['msg_id']){_0xc4fec3['Content-Disposition']=_0x5853('0x50')+_0x4103ad[_0x5853('0x4a')]+_0x5853('0x51');}_0x56ab3f[_0x5853('0x20')](_0xc4fec3);return _0x56ab3f[_0x5853('0x52')](new Buffer(_0x4103ad[_0x5853('0x4b')]));}})[_0x5853('0x42')](handleError(_0x56ab3f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4831136..0494cd3 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 _0x1514=['exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0xd5d454,_0x5397e4){var _0x2415d0=function(_0x137c7b){while(--_0x137c7b){_0xd5d454['push'](_0xd5d454['shift']());}};_0x2415d0(++_0x5397e4);}(_0x1514,0x122));var _0x4151=function(_0x1ee5ab,_0x4f8777){_0x1ee5ab=_0x1ee5ab-0x0;var _0x3305b2=_0x1514[_0x1ee5ab];return _0x3305b2;};'use strict';var _=require(_0x4151('0x0'));var util=require(_0x4151('0x1'));var logger=require('../../config/logger')(_0x4151('0x2'));var moment=require(_0x4151('0x3'));var BPromise=require('bluebird');var rp=require(_0x4151('0x4'));var fs=require('fs');var path=require(_0x4151('0x5'));var rimraf=require(_0x4151('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x4151('0x7')]=function(_0x55d610,_0x2a4774){return _0x55d610['define'](_0x4151('0x8'),attributes,{'tableName':_0x4151('0x9'),'paranoid':![],'indexes':[{'name':_0x4151('0xa'),'fields':[_0x4151('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9e0a=['VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','request-promise','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x3b1e12,_0x16f637){var _0x3e56f6=function(_0x304cad){while(--_0x304cad){_0x3b1e12['push'](_0x3b1e12['shift']());}};_0x3e56f6(++_0x16f637);}(_0x9e0a,0x1e3));var _0xa9e0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9e0a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa9e0('0x0'));var logger=require(_0xa9e0('0x1'))(_0xa9e0('0x2'));var moment=require(_0xa9e0('0x3'));var BPromise=require('bluebird');var rp=require(_0xa9e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9e0('0x5'));var attributes=require(_0xa9e0('0x6'));module[_0xa9e0('0x7')]=function(_0xcd970c,_0x5b6158){return _0xcd970c[_0xa9e0('0x8')](_0xa9e0('0x9'),attributes,{'tableName':_0xa9e0('0xa'),'paranoid':![],'indexes':[{'name':_0xa9e0('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 78bb99b..5eadf66 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 _0x220b=['request\x20sent','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x40650c,_0x4344e5){var _0x2efa5a=function(_0x3e6267){while(--_0x3e6267){_0x40650c['push'](_0x40650c['shift']());}};_0x2efa5a(++_0x4344e5);}(_0x220b,0x1a1));var _0xb220=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x220b[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb220('0x1'));var fs=require('fs');var Redis=require(_0xb220('0x2'));var db=require(_0xb220('0x3'))['db'];var utils=require(_0xb220('0x4'));var logger=require('../../config/logger')(_0xb220('0x5'));var config=require(_0xb220('0x6'));var jayson=require(_0xb220('0x7'));var client=jayson[_0xb220('0x8')][_0xb220('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aef73,_0x46b617,_0x4ab250){return new BPromise(function(_0x12b4a1,_0x353bc2){return client[_0xb220('0xa')](_0x2aef73,_0x4ab250)[_0xb220('0xb')](function(_0x53f980){logger['info'](_0xb220('0xc'),_0x46b617,'request\x20sent');logger[_0xb220('0xd')](_0xb220('0xe'),_0x46b617,'request\x20sent',JSON[_0xb220('0xf')](_0x53f980));if(_0x53f980[_0xb220('0x10')]){if(_0x53f980[_0xb220('0x10')][_0xb220('0x11')]===0x1f4){logger[_0xb220('0x10')](_0xb220('0xc'),_0x46b617,_0x53f980[_0xb220('0x10')][_0xb220('0x12')]);return _0x353bc2(_0x53f980[_0xb220('0x10')]['message']);}logger[_0xb220('0x10')](_0xb220('0xc'),_0x46b617,_0x53f980[_0xb220('0x10')][_0xb220('0x12')]);return _0x12b4a1(_0x53f980[_0xb220('0x10')][_0xb220('0x12')]);}else{logger[_0xb220('0x13')](_0xb220('0xc'),_0x46b617,_0xb220('0x14'));_0x12b4a1(_0x53f980[_0xb220('0x15')][_0xb220('0x12')]);}})[_0xb220('0x16')](function(_0x328984){logger[_0xb220('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x46b617,_0x328984);_0x353bc2(_0x328984);});});} \ No newline at end of file +var _0xbc3f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x171051,_0x531bcb){var _0x385569=function(_0x472f6d){while(--_0x472f6d){_0x171051['push'](_0x171051['shift']());}};_0x385569(++_0x531bcb);}(_0xbc3f,0x190));var _0xfbc3=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xbc3f[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0xfbc3('0x0'));var util=require(_0xfbc3('0x1'));var moment=require(_0xfbc3('0x2'));var BPromise=require(_0xfbc3('0x3'));var rs=require(_0xfbc3('0x4'));var fs=require('fs');var Redis=require(_0xfbc3('0x5'));var db=require(_0xfbc3('0x6'))['db'];var utils=require(_0xfbc3('0x7'));var logger=require(_0xfbc3('0x8'))(_0xfbc3('0x9'));var config=require(_0xfbc3('0xa'));var jayson=require(_0xfbc3('0xb'));var client=jayson[_0xfbc3('0xc')][_0xfbc3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb3f,_0x39321c,_0x37dedb){return new BPromise(function(_0x5275ea,_0xd34155){return client[_0xfbc3('0xe')](_0x2bdb3f,_0x37dedb)[_0xfbc3('0xf')](function(_0x2b7347){logger[_0xfbc3('0x10')](_0xfbc3('0x11'),_0x39321c,_0xfbc3('0x12'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x39321c,_0xfbc3('0x12'),JSON[_0xfbc3('0x13')](_0x2b7347));if(_0x2b7347['error']){if(_0x2b7347[_0xfbc3('0x14')][_0xfbc3('0x15')]===0x1f4){logger[_0xfbc3('0x14')](_0xfbc3('0x11'),_0x39321c,_0x2b7347[_0xfbc3('0x14')][_0xfbc3('0x16')]);return _0xd34155(_0x2b7347[_0xfbc3('0x14')][_0xfbc3('0x16')]);}logger[_0xfbc3('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x39321c,_0x2b7347['error'][_0xfbc3('0x16')]);return _0x5275ea(_0x2b7347['error'][_0xfbc3('0x16')]);}else{logger['info'](_0xfbc3('0x11'),_0x39321c,_0xfbc3('0x12'));_0x5275ea(_0x2b7347['result'][_0xfbc3('0x16')]);}})[_0xfbc3('0x17')](function(_0x48f80d){logger[_0xfbc3('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x39321c,_0x48f80d);_0xd34155(_0x48f80d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index de5fd65..8e4eb0c 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 _0x0a1b=['destroy','/:id/sounds/:id2','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','update','delete'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x0a1b,0x9d));var _0xb0a1=function(_0x170633,_0x2a65f0){_0x170633=_0x170633-0x0;var _0x1419a7=_0x0a1b[_0x170633];return _0x1419a7;};'use strict';var multer=require(_0xb0a1('0x0'));var util=require(_0xb0a1('0x1'));var path=require(_0xb0a1('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0a1('0x3'));var router=express['Router']();var fs_extra=require(_0xb0a1('0x4'));var auth=require(_0xb0a1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb0a1('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xb0a1('0x7')]('/',auth[_0xb0a1('0x8')](),controller[_0xb0a1('0x9')]);router[_0xb0a1('0x7')](_0xb0a1('0xa'),auth[_0xb0a1('0x8')](),controller[_0xb0a1('0xb')]);router[_0xb0a1('0x7')](_0xb0a1('0xc'),auth[_0xb0a1('0x8')](),controller['getSounds']);router[_0xb0a1('0xd')]('/',auth[_0xb0a1('0x8')](),controller[_0xb0a1('0xe')]);router['post'](_0xb0a1('0xc'),auth[_0xb0a1('0x8')](),controller[_0xb0a1('0xf')]);router[_0xb0a1('0x10')](_0xb0a1('0xa'),auth[_0xb0a1('0x8')](),controller[_0xb0a1('0x11')]);router[_0xb0a1('0x12')]('/:id',auth[_0xb0a1('0x8')](),controller[_0xb0a1('0x13')]);router[_0xb0a1('0x12')](_0xb0a1('0x14'),auth[_0xb0a1('0x8')](),controller['removeSound']);module[_0xb0a1('0x15')]=router; \ No newline at end of file +var _0xe0d8=['destroy','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete'];(function(_0x4439e5,_0xebd31d){var _0x29b858=function(_0x535c8c){while(--_0x535c8c){_0x4439e5['push'](_0x4439e5['shift']());}};_0x29b858(++_0xebd31d);}(_0xe0d8,0x80));var _0x8e0d=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0xe0d8[_0x427217];return _0x5b28fb;};'use strict';var multer=require('multer');var util=require(_0x8e0d('0x0'));var path=require(_0x8e0d('0x1'));var timeout=require(_0x8e0d('0x2'));var express=require(_0x8e0d('0x3'));var router=express[_0x8e0d('0x4')]();var fs_extra=require(_0x8e0d('0x5'));var auth=require(_0x8e0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e0d('0x7'));var controller=require(_0x8e0d('0x8'));router[_0x8e0d('0x9')]('/',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xb')]);router[_0x8e0d('0x9')](_0x8e0d('0xc'),auth['isAuthenticated'](),controller[_0x8e0d('0xd')]);router[_0x8e0d('0x9')](_0x8e0d('0xe'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xf')]);router[_0x8e0d('0x10')]('/',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x11')]);router[_0x8e0d('0x10')](_0x8e0d('0xe'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x12')]);router[_0x8e0d('0x13')](_0x8e0d('0xc'),auth['isAuthenticated'](),controller[_0x8e0d('0x14')]);router[_0x8e0d('0x15')](_0x8e0d('0xc'),auth['isAuthenticated'](),controller[_0x8e0d('0x16')]);router[_0x8e0d('0x15')]('/:id/sounds/:id2',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x17')]);module[_0x8e0d('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 17a6982..b83c0fb 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 _0xa083=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha'];(function(_0x100331,_0x296d8b){var _0x3b43d1=function(_0x505ac8){while(--_0x505ac8){_0x100331['push'](_0x100331['shift']());}};_0x3b43d1(++_0x296d8b);}(_0xa083,0x120));var _0x3a08=function(_0x3ff0ca,_0x1f9755){_0x3ff0ca=_0x3ff0ca-0x0;var _0x2e444c=_0xa083[_0x3ff0ca];return _0x2e444c;};'use strict';var Sequelize=require(_0x3a08('0x0'));module[_0x3a08('0x1')]={'name':{'type':Sequelize[_0x3a08('0x2')],'allowNull':![],'unique':_0x3a08('0x3')},'mode':{'type':Sequelize[_0x3a08('0x4')](_0x3a08('0x5'),_0x3a08('0x6'),_0x3a08('0x7'),_0x3a08('0x8'),'quietmp3',_0x3a08('0x9')),'allowNull':!![],'defaultValue':_0x3a08('0x6')},'directory':{'type':Sequelize[_0x3a08('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x3a08('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x3a08('0x2')],'allowNull':!![],'defaultValue':_0x3a08('0xa')},'format':{'type':Sequelize[_0x3a08('0x2')],'allowNull':!![]},'stamp':{'type':_0x3a08('0xb')},'defaultEntry':{'type':Sequelize[_0x3a08('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1fec=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','STRING'];(function(_0x16fc15,_0x1757f3){var _0x3572fd=function(_0x4db0eb){while(--_0x4db0eb){_0x16fc15['push'](_0x16fc15['shift']());}};_0x3572fd(++_0x1757f3);}(_0x1fec,0x14d));var _0xc1fe=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x1fec[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0xc1fe('0x0'));module[_0xc1fe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc1fe('0x2')},'mode':{'type':Sequelize[_0xc1fe('0x3')](_0xc1fe('0x4'),_0xc1fe('0x5'),'mp3nb','quietmp3nb','quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xc1fe('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0xc1fe('0x6')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xc1fe('0x6')],'allowNull':!![],'defaultValue':_0xc1fe('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xc1fe('0x8')},'defaultEntry':{'type':Sequelize[_0xc1fe('0x9')],'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 8f02639..4f828eb 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 _0x80d4=['0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','root','%s.%s','basename','extname','server/files/moh','format','converted_format','symlinkSync','removeSound','getSounds','length','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','body','find','params','create','transaction','files','directory','join','mkdirSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d4,0x100));var _0x480d=function(_0x5aa6b2,_0x153315){_0x5aa6b2=_0x5aa6b2-0x0;var _0x37ac98=_0x80d4[_0x5aa6b2];return _0x37ac98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x480d('0x0'));var zipdir=require(_0x480d('0x1'));var jsonpatch=require(_0x480d('0x2'));var rp=require(_0x480d('0x3'));var moment=require(_0x480d('0x4'));var BPromise=require(_0x480d('0x5'));var Mustache=require(_0x480d('0x6'));var util=require(_0x480d('0x7'));var path=require('path');var sox=require(_0x480d('0x8'));var csv=require('to-csv');var ejs=require(_0x480d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x480d('0xa'));var crypto=require(_0x480d('0xb'));var jsforce=require(_0x480d('0xc'));var deskjs=require(_0x480d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x480d('0xe'));var authService=require(_0x480d('0xf'));var qs=require(_0x480d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x480d('0x11'));var logger=require(_0x480d('0x12'))(_0x480d('0x13'));var utils=require(_0x480d('0x14'));var config=require(_0x480d('0x15'));var licenseUtil=require(_0x480d('0x16'));var db=require(_0x480d('0x17'))['db'];function respondWithStatusCode(_0x5a2e37,_0x3ab8af){_0x3ab8af=_0x3ab8af||0xcc;return function(_0x3e8e21){if(_0x3e8e21){return _0x5a2e37['sendStatus'](_0x3ab8af);}return _0x5a2e37[_0x480d('0x18')](_0x3ab8af)['end']();};}function respondWithResult(_0xb09b76,_0x392d01){_0x392d01=_0x392d01||0xc8;return function(_0x28c01f){if(_0x28c01f){return _0xb09b76[_0x480d('0x18')](_0x392d01)[_0x480d('0x19')](_0x28c01f);}};}function respondWithFilteredResult(_0x207e8d,_0x143147){return function(_0x4b66d7){if(_0x4b66d7){var _0x3dd0cf=typeof _0x143147[_0x480d('0x1a')]===_0x480d('0x1b')&&typeof _0x143147[_0x480d('0x1c')]===_0x480d('0x1b');var _0x448bba=_0x4b66d7[_0x480d('0x1d')];var _0x28bd09=_0x3dd0cf?0x0:_0x143147[_0x480d('0x1a')];var _0x1ba1ff=_0x3dd0cf?_0x4b66d7['count']:_0x143147[_0x480d('0x1a')]+_0x143147['limit'];var _0x2d5a5e;if(_0x1ba1ff>=_0x448bba){_0x1ba1ff=_0x448bba;_0x2d5a5e=0xc8;}else{_0x2d5a5e=0xce;}_0x207e8d[_0x480d('0x18')](_0x2d5a5e);return _0x207e8d[_0x480d('0x1e')](_0x480d('0x1f'),_0x28bd09+'-'+_0x1ba1ff+'/'+_0x448bba)['json'](_0x4b66d7);}return null;};}function patchUpdates(_0x1a11af){return function(_0x2f8445){try{jsonpatch['apply'](_0x2f8445,_0x1a11af,!![]);}catch(_0x3bb388){return BPromise['reject'](_0x3bb388);}return _0x2f8445[_0x480d('0x20')]();};}function saveUpdates(_0x49738f,_0x1ce857){return function(_0x3af71e){if(_0x3af71e){return _0x3af71e[_0x480d('0x21')](_0x49738f)[_0x480d('0x22')](function(_0x569876){return _0x569876;});}return null;};}function removeEntity(_0x148646,_0x1edf1b){return function(_0x4f5eda){if(_0x4f5eda){return _0x4f5eda[_0x480d('0x23')]()[_0x480d('0x22')](function(){var _0x2d842c=_0x4f5eda['get']({'plain':!![]});var _0x2f0f21='MusicOnHolds';return db[_0x480d('0x24')]['destroy']({'where':{'type':_0x2f0f21,'resourceId':_0x2d842c['id']}})['then'](function(){return _0x4f5eda;});})[_0x480d('0x22')](function(){_0x148646[_0x480d('0x18')](0xcc)[_0x480d('0x25')]();});}};}function handleEntityNotFound(_0x2bc93b,_0x46b8a3){return function(_0x4acce2){if(!_0x4acce2){_0x2bc93b['sendStatus'](0x194);}return _0x4acce2;};}function handleError(_0x2ea0dd,_0x25b3dd){_0x25b3dd=_0x25b3dd||0x1f4;return function(_0x56813c){logger[_0x480d('0x26')](_0x56813c[_0x480d('0x27')]);if(_0x56813c[_0x480d('0x28')]){delete _0x56813c[_0x480d('0x28')];}_0x2ea0dd['status'](_0x25b3dd)[_0x480d('0x29')](_0x56813c);};}exports[_0x480d('0x2a')]=function(_0x34e481,_0x286cc4){var _0x3c5fdf={},_0x5ef96b={},_0x8126fe={'count':0x0,'rows':[]};var _0x2a4c97=_['map'](db['VoiceMusicOnHold'][_0x480d('0x2b')],function(_0x19d631){return{'name':_0x19d631['fieldName'],'type':_0x19d631['type'][_0x480d('0x2c')]};});_0x5ef96b['model']=_[_0x480d('0x2d')](_0x2a4c97,_0x480d('0x28'));_0x5ef96b[_0x480d('0x2e')]=_[_0x480d('0x2f')](_0x34e481[_0x480d('0x2e')]);_0x5ef96b[_0x480d('0x30')]=_[_0x480d('0x31')](_0x5ef96b[_0x480d('0x32')],_0x5ef96b[_0x480d('0x2e')]);_0x3c5fdf[_0x480d('0x33')]=_['intersection'](_0x5ef96b[_0x480d('0x32')],qs['fields'](_0x34e481['query'][_0x480d('0x34')]));_0x3c5fdf[_0x480d('0x33')]=_0x3c5fdf[_0x480d('0x33')]['length']?_0x3c5fdf[_0x480d('0x33')]:_0x5ef96b[_0x480d('0x32')];if(!_0x34e481[_0x480d('0x2e')][_0x480d('0x35')](_0x480d('0x36'))){_0x3c5fdf[_0x480d('0x1c')]=qs[_0x480d('0x1c')](_0x34e481['query']['limit']);_0x3c5fdf[_0x480d('0x1a')]=qs[_0x480d('0x1a')](_0x34e481['query'][_0x480d('0x1a')]);}_0x3c5fdf[_0x480d('0x37')]=qs['sort'](_0x34e481[_0x480d('0x2e')]['sort']);delete _0x34e481[_0x480d('0x2e')][_0x480d('0x38')];_0x3c5fdf[_0x480d('0x39')]=qs[_0x480d('0x30')](_[_0x480d('0x3a')](_0x34e481[_0x480d('0x2e')],_0x5ef96b[_0x480d('0x30')]),_0x2a4c97);if(_0x34e481[_0x480d('0x2e')][_0x480d('0x3b')]){_0x3c5fdf[_0x480d('0x39')]=_[_0x480d('0x3c')](_0x3c5fdf['where'],{'$or':_[_0x480d('0x2d')](_0x2a4c97,function(_0x49b011){if(_0x49b011[_0x480d('0x3d')]!==_0x480d('0x3e')){var _0x3aa498={};_0x3aa498[_0x49b011[_0x480d('0x28')]]={'$like':'%'+_0x34e481[_0x480d('0x2e')][_0x480d('0x3b')]+'%'};return _0x3aa498;}})});}_0x3c5fdf=_['merge']({},_0x3c5fdf,_0x34e481[_0x480d('0x3f')]);var _0x198813={'where':_0x3c5fdf[_0x480d('0x39')]};return db[_0x480d('0x40')]['count'](_0x198813)[_0x480d('0x22')](function(_0x52df0d){_0x8126fe[_0x480d('0x1d')]=_0x52df0d;if(_0x34e481[_0x480d('0x2e')][_0x480d('0x41')]){_0x3c5fdf[_0x480d('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x480d('0x43')](_0x3c5fdf);})[_0x480d('0x22')](function(_0x140d03){_0x8126fe[_0x480d('0x44')]=_0x140d03;return _0x8126fe;})[_0x480d('0x22')](respondWithFilteredResult(_0x286cc4,_0x3c5fdf))[_0x480d('0x45')](handleError(_0x286cc4,null));};exports[_0x480d('0x46')]=function(_0x421a04,_0xb07e56){var _0x341136={'raw':![],'where':{'id':_0x421a04['params']['id']}},_0x1e1b69={};_0x1e1b69[_0x480d('0x32')]=_[_0x480d('0x2f')](db[_0x480d('0x40')]['rawAttributes']);_0x1e1b69[_0x480d('0x2e')]=_['keys'](_0x421a04['query']);_0x1e1b69['filters']=_[_0x480d('0x31')](_0x1e1b69[_0x480d('0x32')],_0x1e1b69[_0x480d('0x2e')]);_0x341136[_0x480d('0x33')]=_[_0x480d('0x31')](_0x1e1b69['model'],qs[_0x480d('0x34')](_0x421a04[_0x480d('0x2e')]['fields']));_0x341136[_0x480d('0x33')]=_0x341136[_0x480d('0x33')]['length']?_0x341136[_0x480d('0x33')]:_0x1e1b69[_0x480d('0x32')];if(_0x421a04[_0x480d('0x2e')][_0x480d('0x41')]){_0x341136[_0x480d('0x42')]=[{'all':!![]}];}_0x341136=_[_0x480d('0x3c')]({},_0x341136,_0x421a04[_0x480d('0x3f')]);return db[_0x480d('0x40')]['find'](_0x341136)[_0x480d('0x22')](handleEntityNotFound(_0xb07e56,null))['then'](respondWithResult(_0xb07e56,null))[_0x480d('0x45')](handleError(_0xb07e56,null));};exports[_0x480d('0x21')]=function(_0x368cad,_0x3ad3cd){if(_0x368cad[_0x480d('0x47')]['id']){delete _0x368cad[_0x480d('0x47')]['id'];}return db[_0x480d('0x40')][_0x480d('0x48')]({'where':{'id':_0x368cad[_0x480d('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ad3cd,null))[_0x480d('0x22')](saveUpdates(_0x368cad[_0x480d('0x47')],null))['then'](respondWithResult(_0x3ad3cd,null))['catch'](handleError(_0x3ad3cd,null));};exports[_0x480d('0x4a')]=function(_0x3b5e6c,_0xdf164d,_0x4ca07f){return db['sequelize'][_0x480d('0x4b')](function(_0x1a79eb){if(_0x3b5e6c[_0x480d('0x47')]['mode']===_0x480d('0x4c')){_0x3b5e6c['body'][_0x480d('0x4d')]=path[_0x480d('0x4e')](config['root'],'server/files/moh',_0x3b5e6c[_0x480d('0x47')]['name']);}return db[_0x480d('0x40')][_0x480d('0x4a')](_0x3b5e6c['body'],{'transaction':_0x1a79eb})['then'](function(_0x2f9044){if(_0x3b5e6c['body']['mode']==='files'){fs[_0x480d('0x4f')](_0x2f9044[_0x480d('0x4d')],parseInt(_0x480d('0x50'),0x8));}var _0x5be7c6=_0x3b5e6c[_0x480d('0x51')][_0x480d('0x52')]({'plain':!![]});if(!_0x5be7c6)throw new Error(_0x480d('0x53'));if(_0x5be7c6[_0x480d('0x54')]===_0x480d('0x51')){var _0x492403=_0x2f9044[_0x480d('0x52')]({'plain':!![]});return db[_0x480d('0x55')][_0x480d('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x5be7c6[_0x480d('0x56')]},'raw':!![]})[_0x480d('0x22')](function(_0xfd97ac){if(_0xfd97ac&&_0xfd97ac[_0x480d('0x57')]===0x0){return db[_0x480d('0x24')][_0x480d('0x4a')]({'name':_0x492403[_0x480d('0x28')],'resourceId':_0x492403['id'],'type':_0xfd97ac[_0x480d('0x28')],'sectionId':_0xfd97ac['id']},{})[_0x480d('0x22')](function(){return _0x2f9044;});}else{return _0x2f9044;}})[_0x480d('0x45')](function(_0x5d5dc6){logger[_0x480d('0x26')](_0x480d('0x58'),_0x5d5dc6);});}return _0x2f9044;});})[_0x480d('0x22')](respondWithResult(_0xdf164d,0xc9))['catch'](handleError(_0xdf164d,null));};exports[_0x480d('0x23')]=function(_0x40a359,_0x44e257,_0x4d0015){var _0x4c93b6;return db[_0x480d('0x40')][_0x480d('0x48')]({'where':{'id':_0x40a359[_0x480d('0x49')]['id']}})['then'](function(_0x61ed2e){if(_0x61ed2e){return db[_0x480d('0x59')]['transaction'](function(_0x50ede9){return _0x61ed2e['destroy']({'transaction':_0x50ede9,'raw':!![]})[_0x480d('0x22')](function(_0x34f50f){if(_0x34f50f[_0x480d('0x4d')]){fs[_0x480d('0x5a')](_0x34f50f[_0x480d('0x4d')])['forEach'](function(_0x4fb94e){fs[_0x480d('0x5b')](path[_0x480d('0x4e')](_0x34f50f['directory'],_0x4fb94e));});fs[_0x480d('0x5c')](_0x34f50f[_0x480d('0x4d')]);}return _0x34f50f;});})['catch'](function(_0x179fa8){throw new db[(_0x480d('0x5d'))][(_0x480d('0x5e'))](_0x179fa8[_0x480d('0x5f')]);});}})[_0x480d('0x22')](handleEntityNotFound(_0x44e257,null))[_0x480d('0x22')](removeEntity(_0x44e257,null))[_0x480d('0x45')](handleError(_0x44e257,null));};exports[_0x480d('0x60')]=function(_0x176154,_0x382c0b,_0x5e66d1){return db[_0x480d('0x59')][_0x480d('0x4b')](function(_0x4eb01c){var _0x5195a3;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x176154['params']['id']}})['then'](function(_0x2a4f27){if(_0x2a4f27){_0x5195a3=_0x2a4f27;return _0x2a4f27[_0x480d('0x60')](_0x176154[_0x480d('0x47')]['id'],{'transaction':_0x4eb01c});}})[_0x480d('0x22')](function(_0xee93bf){if(_0xee93bf){return db[_0x480d('0x61')][_0x480d('0x62')]({'where':{'id':_0x176154['body']['id']},'attributes':['id','name',_0x480d('0x63'),'converted_format',_0x480d('0x64')],'raw':!![]});}})[_0x480d('0x22')](function(_0x42e012){if(_0x42e012){var _0x1e477d=path[_0x480d('0x4e')](config[_0x480d('0x65')],'server/files/sounds/converted',util['format'](_0x480d('0x66'),path[_0x480d('0x67')](_0x42e012[_0x480d('0x63')],path[_0x480d('0x68')](_0x42e012[_0x480d('0x63')])),_0x42e012['converted_format']));var _0x531eb1=path[_0x480d('0x4e')](config[_0x480d('0x65')],_0x480d('0x69'),_0x5195a3['name'],util[_0x480d('0x6a')]('%s.%s',_0x42e012[_0x480d('0x28')],_0x42e012[_0x480d('0x6b')]));fs[_0x480d('0x6c')](_0x1e477d,_0x531eb1);return _0x42e012;}})[_0x480d('0x45')](function(_0x219088){throw new db[(_0x480d('0x5d'))][(_0x480d('0x5e'))](_0x219088[_0x480d('0x5f')]);});})['then'](handleEntityNotFound(_0x382c0b,null))[_0x480d('0x22')](respondWithResult(_0x382c0b,0xc9))['catch'](handleError(_0x382c0b,null));};exports[_0x480d('0x6d')]=function(_0x4aa308,_0x1e65e3,_0x62c374){return db[_0x480d('0x59')]['transaction'](function(_0x965213){var _0x11e632;return db[_0x480d('0x40')][_0x480d('0x62')]({'where':{'id':_0x4aa308[_0x480d('0x49')]['id']}})[_0x480d('0x22')](handleEntityNotFound(_0x1e65e3,null))[_0x480d('0x22')](function(_0x448a97){if(_0x448a97){_0x11e632=_0x448a97;return _0x448a97[_0x480d('0x6d')](_0x4aa308['params']['id2']);}})[_0x480d('0x22')](function(_0x4c06db){if(_0x4c06db){return db[_0x480d('0x61')][_0x480d('0x62')]({'where':{'id':_0x4aa308[_0x480d('0x49')]['id2']},'attributes':['id','name','save_name',_0x480d('0x6b'),_0x480d('0x64')],'raw':!![]});}})[_0x480d('0x22')](function(_0x26871e){if(_0x26871e){fs['unlinkSync'](path[_0x480d('0x4e')](_0x11e632[_0x480d('0x4d')],util[_0x480d('0x6a')](_0x480d('0x66'),_0x26871e[_0x480d('0x28')],_0x26871e[_0x480d('0x6b')])));return _0x26871e;}})['catch'](function(_0x1e2958){throw new db[(_0x480d('0x5d'))][(_0x480d('0x5e'))](_0x1e2958[_0x480d('0x5f')]);});})[_0x480d('0x22')](handleEntityNotFound(_0x1e65e3,null))[_0x480d('0x22')](respondWithStatusCode(_0x1e65e3,0xcc))[_0x480d('0x45')](handleError(_0x1e65e3,null));};exports[_0x480d('0x6e')]=function(_0x26bdb8,_0x1b6df0,_0x38c918){var _0x3b047d={};var _0x3059d8={};var _0xe96923;var _0x12572b;return db[_0x480d('0x40')][_0x480d('0x62')]({'where':{'id':_0x26bdb8['params']['id']}})[_0x480d('0x22')](handleEntityNotFound(_0x1b6df0,null))['then'](function(_0x535002){if(_0x535002){_0xe96923=_0x535002;_0x3059d8[_0x480d('0x32')]=_[_0x480d('0x2f')](db['Sound'][_0x480d('0x2b')]);_0x3059d8[_0x480d('0x2e')]=_[_0x480d('0x2f')](_0x26bdb8[_0x480d('0x2e')]);_0x3059d8[_0x480d('0x30')]=_[_0x480d('0x31')](_0x3059d8[_0x480d('0x32')],_0x3059d8[_0x480d('0x2e')]);_0x3b047d[_0x480d('0x33')]=_[_0x480d('0x31')](_0x3059d8[_0x480d('0x32')],qs[_0x480d('0x34')](_0x26bdb8[_0x480d('0x2e')][_0x480d('0x34')]));_0x3b047d[_0x480d('0x33')]=_0x3b047d[_0x480d('0x33')][_0x480d('0x6f')]?_0x3b047d[_0x480d('0x33')]:_0x3059d8[_0x480d('0x32')];_0x3b047d[_0x480d('0x37')]=qs[_0x480d('0x38')](_0x26bdb8[_0x480d('0x2e')][_0x480d('0x38')]);_0x3b047d[_0x480d('0x39')]=qs[_0x480d('0x30')](_[_0x480d('0x3a')](_0x26bdb8[_0x480d('0x2e')],_0x3059d8['filters']));if(_0x26bdb8[_0x480d('0x2e')][_0x480d('0x3b')]){_0x3b047d[_0x480d('0x39')]=_[_0x480d('0x3c')](_0x3b047d[_0x480d('0x39')],{'$or':_[_0x480d('0x2d')](_0x3b047d['attributes'],function(_0x500594){var _0x21dd7a={};_0x21dd7a[_0x500594]={'$like':'%'+_0x26bdb8['query'][_0x480d('0x3b')]+'%'};return _0x21dd7a;})});}_0x3b047d=_[_0x480d('0x3c')]({},_0x3b047d,_0x26bdb8['options']);return _0xe96923[_0x480d('0x6e')](_0x3b047d);}})[_0x480d('0x22')](function(_0x5763b3){if(_0x5763b3){_0x12572b=_0x5763b3[_0x480d('0x6f')];if(!_0x26bdb8[_0x480d('0x2e')][_0x480d('0x35')]('nolimit')){_0x3b047d[_0x480d('0x1c')]=qs['limit'](_0x26bdb8[_0x480d('0x2e')][_0x480d('0x1c')]);_0x3b047d[_0x480d('0x1a')]=qs['offset'](_0x26bdb8[_0x480d('0x2e')][_0x480d('0x1a')]);}return _0xe96923[_0x480d('0x6e')](_0x3b047d);}})[_0x480d('0x22')](function(_0x58e031){if(_0x58e031){return _0x58e031?{'count':_0x12572b,'rows':_0x58e031}:null;}})[_0x480d('0x22')](respondWithResult(_0x1b6df0,null))[_0x480d('0x45')](handleError(_0x1b6df0,null));}; \ No newline at end of file +var _0x5b98=['options','VoiceMusicOnHold','includeAll','include','rows','catch','show','params','keys','fields','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','createdAt','getSounds','pick','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','index','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map'];(function(_0x39b68b,_0x4ad96d){var _0xae091f=function(_0x13b5e1){while(--_0x13b5e1){_0x39b68b['push'](_0x39b68b['shift']());}};_0xae091f(++_0x4ad96d);}(_0x5b98,0x112));var _0x85b9=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x5b98[_0x18cac4];return _0x2227c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85b9('0x0'));var zipdir=require(_0x85b9('0x1'));var jsonpatch=require(_0x85b9('0x2'));var rp=require(_0x85b9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85b9('0x4'));var util=require(_0x85b9('0x5'));var path=require(_0x85b9('0x6'));var sox=require(_0x85b9('0x7'));var csv=require(_0x85b9('0x8'));var ejs=require(_0x85b9('0x9'));var fs=require('fs');var fs_extra=require(_0x85b9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x85b9('0xb'));var jsforce=require(_0x85b9('0xc'));var deskjs=require(_0x85b9('0xd'));var toCsv=require(_0x85b9('0x8'));var querystring=require('querystring');var Papa=require(_0x85b9('0xe'));var Redis=require(_0x85b9('0xf'));var authService=require(_0x85b9('0x10'));var qs=require(_0x85b9('0x11'));var as=require(_0x85b9('0x12'));var hardwareService=require(_0x85b9('0x13'));var logger=require(_0x85b9('0x14'))(_0x85b9('0x15'));var utils=require(_0x85b9('0x16'));var config=require(_0x85b9('0x17'));var licenseUtil=require(_0x85b9('0x18'));var db=require(_0x85b9('0x19'))['db'];function respondWithStatusCode(_0x1f9ab2,_0x1d7ce2){_0x1d7ce2=_0x1d7ce2||0xcc;return function(_0x2180c8){if(_0x2180c8){return _0x1f9ab2[_0x85b9('0x1a')](_0x1d7ce2);}return _0x1f9ab2[_0x85b9('0x1b')](_0x1d7ce2)[_0x85b9('0x1c')]();};}function respondWithResult(_0x4d88d2,_0x3696c3){_0x3696c3=_0x3696c3||0xc8;return function(_0x1d8f0c){if(_0x1d8f0c){return _0x4d88d2['status'](_0x3696c3)['json'](_0x1d8f0c);}};}function respondWithFilteredResult(_0x57f2b0,_0x128966){return function(_0x4e90e2){if(_0x4e90e2){var _0x30900c=typeof _0x128966[_0x85b9('0x1d')]===_0x85b9('0x1e')&&typeof _0x128966[_0x85b9('0x1f')]===_0x85b9('0x1e');var _0x15ef5a=_0x4e90e2[_0x85b9('0x20')];var _0x37adbf=_0x30900c?0x0:_0x128966[_0x85b9('0x1d')];var _0x456d4e=_0x30900c?_0x4e90e2[_0x85b9('0x20')]:_0x128966[_0x85b9('0x1d')]+_0x128966['limit'];var _0x194c17;if(_0x456d4e>=_0x15ef5a){_0x456d4e=_0x15ef5a;_0x194c17=0xc8;}else{_0x194c17=0xce;}_0x57f2b0[_0x85b9('0x1b')](_0x194c17);return _0x57f2b0['set']('Content-Range',_0x37adbf+'-'+_0x456d4e+'/'+_0x15ef5a)[_0x85b9('0x21')](_0x4e90e2);}return null;};}function patchUpdates(_0x2a4933){return function(_0x38d6c0){try{jsonpatch['apply'](_0x38d6c0,_0x2a4933,!![]);}catch(_0x220a1c){return BPromise['reject'](_0x220a1c);}return _0x38d6c0[_0x85b9('0x22')]();};}function saveUpdates(_0x19cb8f,_0x3711e0){return function(_0x19bc35){if(_0x19bc35){return _0x19bc35[_0x85b9('0x23')](_0x19cb8f)[_0x85b9('0x24')](function(_0x2db7c4){return _0x2db7c4;});}return null;};}function removeEntity(_0x5be172,_0x470a41){return function(_0x4c7d33){if(_0x4c7d33){return _0x4c7d33[_0x85b9('0x25')]()[_0x85b9('0x24')](function(){var _0x17f88a=_0x4c7d33[_0x85b9('0x26')]({'plain':!![]});var _0x2dc08f=_0x85b9('0x27');return db[_0x85b9('0x28')][_0x85b9('0x25')]({'where':{'type':_0x2dc08f,'resourceId':_0x17f88a['id']}})['then'](function(){return _0x4c7d33;});})[_0x85b9('0x24')](function(){_0x5be172[_0x85b9('0x1b')](0xcc)[_0x85b9('0x1c')]();});}};}function handleEntityNotFound(_0xd96afb,_0x47f385){return function(_0xa7d5af){if(!_0xa7d5af){_0xd96afb[_0x85b9('0x1a')](0x194);}return _0xa7d5af;};}function handleError(_0x4d3c4c,_0x3b3a8b){_0x3b3a8b=_0x3b3a8b||0x1f4;return function(_0x508b8b){logger[_0x85b9('0x29')](_0x508b8b['stack']);if(_0x508b8b['name']){delete _0x508b8b[_0x85b9('0x2a')];}_0x4d3c4c[_0x85b9('0x1b')](_0x3b3a8b)['send'](_0x508b8b);};}exports[_0x85b9('0x2b')]=function(_0x29a17b,_0x38989d){var _0x32caa6={},_0x3e06b2={},_0x5854e6={'count':0x0,'rows':[]};var _0x5caa00=_['map'](db['VoiceMusicOnHold'][_0x85b9('0x2c')],function(_0x3d488a){return{'name':_0x3d488a[_0x85b9('0x2d')],'type':_0x3d488a[_0x85b9('0x2e')][_0x85b9('0x2f')]};});_0x3e06b2[_0x85b9('0x30')]=_['map'](_0x5caa00,'name');_0x3e06b2['query']=_['keys'](_0x29a17b[_0x85b9('0x31')]);_0x3e06b2[_0x85b9('0x32')]=_['intersection'](_0x3e06b2['model'],_0x3e06b2[_0x85b9('0x31')]);_0x32caa6[_0x85b9('0x33')]=_[_0x85b9('0x34')](_0x3e06b2[_0x85b9('0x30')],qs['fields'](_0x29a17b['query']['fields']));_0x32caa6[_0x85b9('0x33')]=_0x32caa6[_0x85b9('0x33')][_0x85b9('0x35')]?_0x32caa6['attributes']:_0x3e06b2['model'];if(!_0x29a17b[_0x85b9('0x31')][_0x85b9('0x36')](_0x85b9('0x37'))){_0x32caa6[_0x85b9('0x1f')]=qs[_0x85b9('0x1f')](_0x29a17b[_0x85b9('0x31')][_0x85b9('0x1f')]);_0x32caa6[_0x85b9('0x1d')]=qs[_0x85b9('0x1d')](_0x29a17b[_0x85b9('0x31')][_0x85b9('0x1d')]);}_0x32caa6[_0x85b9('0x38')]=qs[_0x85b9('0x39')](_0x29a17b[_0x85b9('0x31')][_0x85b9('0x39')]);delete _0x29a17b[_0x85b9('0x31')][_0x85b9('0x39')];_0x32caa6['where']=qs[_0x85b9('0x32')](_['pick'](_0x29a17b[_0x85b9('0x31')],_0x3e06b2[_0x85b9('0x32')]),_0x5caa00);if(_0x29a17b[_0x85b9('0x31')][_0x85b9('0x3a')]){_0x32caa6[_0x85b9('0x3b')]=_[_0x85b9('0x3c')](_0x32caa6[_0x85b9('0x3b')],{'$or':_[_0x85b9('0x3d')](_0x5caa00,function(_0x500801){if(_0x500801[_0x85b9('0x2e')]!=='VIRTUAL'){var _0x1d6cef={};_0x1d6cef[_0x500801[_0x85b9('0x2a')]]={'$like':'%'+_0x29a17b['query'][_0x85b9('0x3a')]+'%'};return _0x1d6cef;}})});}_0x32caa6=_[_0x85b9('0x3c')]({},_0x32caa6,_0x29a17b[_0x85b9('0x3e')]);var _0x2e2657={'where':_0x32caa6[_0x85b9('0x3b')]};return db[_0x85b9('0x3f')][_0x85b9('0x20')](_0x2e2657)[_0x85b9('0x24')](function(_0x49e4be){_0x5854e6[_0x85b9('0x20')]=_0x49e4be;if(_0x29a17b['query'][_0x85b9('0x40')]){_0x32caa6[_0x85b9('0x41')]=[{'all':!![]}];}return db[_0x85b9('0x3f')]['findAll'](_0x32caa6);})[_0x85b9('0x24')](function(_0x5eb774){_0x5854e6[_0x85b9('0x42')]=_0x5eb774;return _0x5854e6;})[_0x85b9('0x24')](respondWithFilteredResult(_0x38989d,_0x32caa6))[_0x85b9('0x43')](handleError(_0x38989d,null));};exports[_0x85b9('0x44')]=function(_0x584411,_0x1142d3){var _0x30c03e={'raw':![],'where':{'id':_0x584411[_0x85b9('0x45')]['id']}},_0x59f402={};_0x59f402['model']=_[_0x85b9('0x46')](db[_0x85b9('0x3f')][_0x85b9('0x2c')]);_0x59f402[_0x85b9('0x31')]=_[_0x85b9('0x46')](_0x584411['query']);_0x59f402['filters']=_['intersection'](_0x59f402[_0x85b9('0x30')],_0x59f402[_0x85b9('0x31')]);_0x30c03e[_0x85b9('0x33')]=_[_0x85b9('0x34')](_0x59f402[_0x85b9('0x30')],qs[_0x85b9('0x47')](_0x584411[_0x85b9('0x31')][_0x85b9('0x47')]));_0x30c03e['attributes']=_0x30c03e[_0x85b9('0x33')][_0x85b9('0x35')]?_0x30c03e[_0x85b9('0x33')]:_0x59f402[_0x85b9('0x30')];if(_0x584411[_0x85b9('0x31')][_0x85b9('0x40')]){_0x30c03e['include']=[{'all':!![]}];}_0x30c03e=_[_0x85b9('0x3c')]({},_0x30c03e,_0x584411[_0x85b9('0x3e')]);return db[_0x85b9('0x3f')][_0x85b9('0x48')](_0x30c03e)[_0x85b9('0x24')](handleEntityNotFound(_0x1142d3,null))[_0x85b9('0x24')](respondWithResult(_0x1142d3,null))[_0x85b9('0x43')](handleError(_0x1142d3,null));};exports['update']=function(_0x3a7d85,_0x430a79){if(_0x3a7d85[_0x85b9('0x49')]['id']){delete _0x3a7d85[_0x85b9('0x49')]['id'];}return db[_0x85b9('0x3f')][_0x85b9('0x48')]({'where':{'id':_0x3a7d85[_0x85b9('0x45')]['id']}})[_0x85b9('0x24')](handleEntityNotFound(_0x430a79,null))['then'](saveUpdates(_0x3a7d85['body'],null))['then'](respondWithResult(_0x430a79,null))[_0x85b9('0x43')](handleError(_0x430a79,null));};exports[_0x85b9('0x4a')]=function(_0x3347e6,_0x5e0086,_0x2b3201){return db[_0x85b9('0x4b')][_0x85b9('0x4c')](function(_0x325fbf){if(_0x3347e6[_0x85b9('0x49')][_0x85b9('0x4d')]===_0x85b9('0x4e')){_0x3347e6[_0x85b9('0x49')][_0x85b9('0x4f')]=path[_0x85b9('0x50')](config[_0x85b9('0x51')],_0x85b9('0x52'),_0x3347e6['body'][_0x85b9('0x2a')]);}return db[_0x85b9('0x3f')][_0x85b9('0x4a')](_0x3347e6[_0x85b9('0x49')],{'transaction':_0x325fbf})['then'](function(_0x4249f4){if(_0x3347e6[_0x85b9('0x49')][_0x85b9('0x4d')]===_0x85b9('0x4e')){fs['mkdirSync'](_0x4249f4[_0x85b9('0x4f')],parseInt(_0x85b9('0x53'),0x8));}var _0x81849f=_0x3347e6[_0x85b9('0x54')]['get']({'plain':!![]});if(!_0x81849f)throw new Error(_0x85b9('0x55'));if(_0x81849f[_0x85b9('0x56')]===_0x85b9('0x54')){var _0xa26e0f=_0x4249f4[_0x85b9('0x26')]({'plain':!![]});return db[_0x85b9('0x57')][_0x85b9('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x81849f[_0x85b9('0x58')]},'raw':!![]})[_0x85b9('0x24')](function(_0x1b49ec){if(_0x1b49ec&&_0x1b49ec[_0x85b9('0x59')]===0x0){return db[_0x85b9('0x28')][_0x85b9('0x4a')]({'name':_0xa26e0f[_0x85b9('0x2a')],'resourceId':_0xa26e0f['id'],'type':_0x1b49ec['name'],'sectionId':_0x1b49ec['id']},{})[_0x85b9('0x24')](function(){return _0x4249f4;});}else{return _0x4249f4;}})[_0x85b9('0x43')](function(_0x29dd49){logger[_0x85b9('0x29')](_0x85b9('0x5a'),_0x29dd49);});}return _0x4249f4;});})[_0x85b9('0x24')](respondWithResult(_0x5e0086,0xc9))[_0x85b9('0x43')](handleError(_0x5e0086,null));};exports[_0x85b9('0x25')]=function(_0x7fb22c,_0x208cf1,_0x25d0cf){var _0x4b46ac;return db[_0x85b9('0x3f')]['find']({'where':{'id':_0x7fb22c['params']['id']}})['then'](function(_0x4503f3){if(_0x4503f3){return db['sequelize'][_0x85b9('0x4c')](function(_0x1f9cbb){return _0x4503f3[_0x85b9('0x25')]({'transaction':_0x1f9cbb,'raw':!![]})['then'](function(_0x5afc2d){if(_0x5afc2d[_0x85b9('0x4f')]){fs[_0x85b9('0x5b')](_0x5afc2d[_0x85b9('0x4f')])['forEach'](function(_0x55bed2){fs[_0x85b9('0x5c')](path[_0x85b9('0x50')](_0x5afc2d[_0x85b9('0x4f')],_0x55bed2));});fs[_0x85b9('0x5d')](_0x5afc2d[_0x85b9('0x4f')]);}return _0x5afc2d;});})[_0x85b9('0x43')](function(_0x135979){throw new db[(_0x85b9('0x5e'))][(_0x85b9('0x5f'))](_0x135979[_0x85b9('0x60')]);});}})[_0x85b9('0x24')](handleEntityNotFound(_0x208cf1,null))['then'](removeEntity(_0x208cf1,null))['catch'](handleError(_0x208cf1,null));};exports[_0x85b9('0x61')]=function(_0x2a15f9,_0x3ee410,_0x8db7da){return db[_0x85b9('0x4b')]['transaction'](function(_0x52e17a){var _0x133e76;return db[_0x85b9('0x3f')][_0x85b9('0x48')]({'where':{'id':_0x2a15f9[_0x85b9('0x45')]['id']}})[_0x85b9('0x24')](function(_0x4638c6){if(_0x4638c6){_0x133e76=_0x4638c6;return _0x4638c6[_0x85b9('0x61')](_0x2a15f9[_0x85b9('0x49')]['id'],{'transaction':_0x52e17a});}})[_0x85b9('0x24')](function(_0x3a07b0){if(_0x3a07b0){return db[_0x85b9('0x62')][_0x85b9('0x63')]({'where':{'id':_0x2a15f9['body']['id']},'attributes':['id',_0x85b9('0x2a'),_0x85b9('0x64'),_0x85b9('0x65'),'createdAt'],'raw':!![]});}})['then'](function(_0x3b451b){if(_0x3b451b){var _0x32142e=path[_0x85b9('0x50')](config['root'],_0x85b9('0x66'),util[_0x85b9('0x67')](_0x85b9('0x68'),path[_0x85b9('0x69')](_0x3b451b[_0x85b9('0x64')],path[_0x85b9('0x6a')](_0x3b451b[_0x85b9('0x64')])),_0x3b451b[_0x85b9('0x65')]));var _0x1daae6=path['join'](config[_0x85b9('0x51')],_0x85b9('0x52'),_0x133e76[_0x85b9('0x2a')],util['format'](_0x85b9('0x68'),_0x3b451b[_0x85b9('0x2a')],_0x3b451b[_0x85b9('0x65')]));fs['symlinkSync'](_0x32142e,_0x1daae6);return _0x3b451b;}})[_0x85b9('0x43')](function(_0x5f18f7){throw new db[(_0x85b9('0x5e'))]['ValidationError'](_0x5f18f7['message']);});})[_0x85b9('0x24')](handleEntityNotFound(_0x3ee410,null))[_0x85b9('0x24')](respondWithResult(_0x3ee410,0xc9))[_0x85b9('0x43')](handleError(_0x3ee410,null));};exports[_0x85b9('0x6b')]=function(_0x31ada1,_0x1c8a4f,_0x3ae1c8){return db[_0x85b9('0x4b')][_0x85b9('0x4c')](function(_0x13050e){var _0x3ede83;return db[_0x85b9('0x3f')][_0x85b9('0x63')]({'where':{'id':_0x31ada1[_0x85b9('0x45')]['id']}})[_0x85b9('0x24')](handleEntityNotFound(_0x1c8a4f,null))[_0x85b9('0x24')](function(_0x383cba){if(_0x383cba){_0x3ede83=_0x383cba;return _0x383cba[_0x85b9('0x6b')](_0x31ada1['params'][_0x85b9('0x6c')]);}})[_0x85b9('0x24')](function(_0x2709ea){if(_0x2709ea){return db[_0x85b9('0x62')][_0x85b9('0x63')]({'where':{'id':_0x31ada1[_0x85b9('0x45')]['id2']},'attributes':['id','name',_0x85b9('0x64'),'converted_format',_0x85b9('0x6d')],'raw':!![]});}})[_0x85b9('0x24')](function(_0x3ebd36){if(_0x3ebd36){fs['unlinkSync'](path[_0x85b9('0x50')](_0x3ede83[_0x85b9('0x4f')],util[_0x85b9('0x67')]('%s.%s',_0x3ebd36[_0x85b9('0x2a')],_0x3ebd36['converted_format'])));return _0x3ebd36;}})['catch'](function(_0x38ee0e){throw new db[(_0x85b9('0x5e'))][(_0x85b9('0x5f'))](_0x38ee0e[_0x85b9('0x60')]);});})[_0x85b9('0x24')](handleEntityNotFound(_0x1c8a4f,null))[_0x85b9('0x24')](respondWithStatusCode(_0x1c8a4f,0xcc))[_0x85b9('0x43')](handleError(_0x1c8a4f,null));};exports[_0x85b9('0x6e')]=function(_0x5bbbbe,_0x2e2ea1,_0x3c6a82){var _0x1f1bbd={};var _0x2ef024={};var _0x550bb7;var _0x48b3ac;return db[_0x85b9('0x3f')]['findOne']({'where':{'id':_0x5bbbbe['params']['id']}})[_0x85b9('0x24')](handleEntityNotFound(_0x2e2ea1,null))[_0x85b9('0x24')](function(_0x3e8cd0){if(_0x3e8cd0){_0x550bb7=_0x3e8cd0;_0x2ef024[_0x85b9('0x30')]=_[_0x85b9('0x46')](db[_0x85b9('0x62')]['rawAttributes']);_0x2ef024['query']=_[_0x85b9('0x46')](_0x5bbbbe['query']);_0x2ef024[_0x85b9('0x32')]=_[_0x85b9('0x34')](_0x2ef024[_0x85b9('0x30')],_0x2ef024[_0x85b9('0x31')]);_0x1f1bbd[_0x85b9('0x33')]=_['intersection'](_0x2ef024[_0x85b9('0x30')],qs[_0x85b9('0x47')](_0x5bbbbe[_0x85b9('0x31')][_0x85b9('0x47')]));_0x1f1bbd['attributes']=_0x1f1bbd[_0x85b9('0x33')][_0x85b9('0x35')]?_0x1f1bbd[_0x85b9('0x33')]:_0x2ef024[_0x85b9('0x30')];_0x1f1bbd[_0x85b9('0x38')]=qs[_0x85b9('0x39')](_0x5bbbbe[_0x85b9('0x31')]['sort']);_0x1f1bbd[_0x85b9('0x3b')]=qs[_0x85b9('0x32')](_[_0x85b9('0x6f')](_0x5bbbbe[_0x85b9('0x31')],_0x2ef024[_0x85b9('0x32')]));if(_0x5bbbbe[_0x85b9('0x31')][_0x85b9('0x3a')]){_0x1f1bbd[_0x85b9('0x3b')]=_['merge'](_0x1f1bbd['where'],{'$or':_[_0x85b9('0x3d')](_0x1f1bbd['attributes'],function(_0x2e0b94){var _0x25a17f={};_0x25a17f[_0x2e0b94]={'$like':'%'+_0x5bbbbe['query'][_0x85b9('0x3a')]+'%'};return _0x25a17f;})});}_0x1f1bbd=_[_0x85b9('0x3c')]({},_0x1f1bbd,_0x5bbbbe[_0x85b9('0x3e')]);return _0x550bb7[_0x85b9('0x6e')](_0x1f1bbd);}})['then'](function(_0x284db0){if(_0x284db0){_0x48b3ac=_0x284db0[_0x85b9('0x35')];if(!_0x5bbbbe['query'][_0x85b9('0x36')](_0x85b9('0x37'))){_0x1f1bbd['limit']=qs[_0x85b9('0x1f')](_0x5bbbbe['query']['limit']);_0x1f1bbd[_0x85b9('0x1d')]=qs['offset'](_0x5bbbbe[_0x85b9('0x31')][_0x85b9('0x1d')]);}return _0x550bb7[_0x85b9('0x6e')](_0x1f1bbd);}})[_0x85b9('0x24')](function(_0x10eb85){if(_0x10eb85){return _0x10eb85?{'count':_0x48b3ac,'rows':_0x10eb85}:null;}})['then'](respondWithResult(_0x2e2ea1,null))['catch'](handleError(_0x2e2ea1,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 904e618..ac9cc48 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 _0xd0e9=['lodash','util','api','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold'];(function(_0x2fb136,_0x31d182){var _0x170aa0=function(_0x573c82){while(--_0x573c82){_0x2fb136['push'](_0x2fb136['shift']());}};_0x170aa0(++_0x31d182);}(_0xd0e9,0xe1));var _0x9d0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0e9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d0e('0x0'));var util=require(_0x9d0e('0x1'));var logger=require('../../config/logger')(_0x9d0e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9d0e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d0e('0x4'));var config=require(_0x9d0e('0x5'));var attributes=require(_0x9d0e('0x6'));module['exports']=function(_0xac5727,_0x501ed5){return _0xac5727[_0x9d0e('0x7')](_0x9d0e('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb38f=['path','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','bluebird'];(function(_0xe006b0,_0x14782f){var _0x4f78c8=function(_0x360a98){while(--_0x360a98){_0xe006b0['push'](_0xe006b0['shift']());}};_0x4f78c8(++_0x14782f);}(_0xb38f,0x15b));var _0xfb38=function(_0x424329,_0x1a3e61){_0x424329=_0x424329-0x0;var _0x324625=_0xb38f[_0x424329];return _0x324625;};'use strict';var _=require('lodash');var util=require(_0xfb38('0x0'));var logger=require(_0xfb38('0x1'))(_0xfb38('0x2'));var moment=require('moment');var BPromise=require(_0xfb38('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb38('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb38('0x5'));module['exports']=function(_0x26a4cd,_0x525ccd){return _0x26a4cd[_0xfb38('0x6')](_0xfb38('0x7'),attributes,{'tableName':_0xfb38('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 96b7ea6..ff7e070 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5b6102,_0x151ea4){var _0x4aea90=function(_0x569785){while(--_0x569785){_0x5b6102['push'](_0x5b6102['shift']());}};_0x4aea90(++_0x151ea4);}(_0x34e8,0x12c));var _0x834e=function(_0x5adc15,_0x36d22a){_0x5adc15=_0x5adc15-0x0;var _0x54271b=_0x34e8[_0x5adc15];return _0x54271b;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x5c2c48,_0x3377a5){var _0x455400=function(_0xe7dfbd){while(--_0xe7dfbd){_0x5c2c48['push'](_0x5c2c48['shift']());}};_0x455400(++_0x3377a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0xcb91[_0x2c6810];return _0x213881;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b37a462..c68252b 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 _0xd847=['/describe','describe','/:id','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams','put','update','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','get'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0xd847,0x18a));var _0x7d84=function(_0x560964,_0x2c0ad6){_0x560964=_0x560964-0x0;var _0xe78f82=_0xd847[_0x560964];return _0xe78f82;};'use strict';var multer=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var path=require(_0x7d84('0x2'));var timeout=require(_0x7d84('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7d84('0x4'));var auth=require(_0x7d84('0x5'));var interaction=require(_0x7d84('0x6'));var config=require(_0x7d84('0x7'));var controller=require(_0x7d84('0x8'));router['get']('/',auth[_0x7d84('0x9')](),controller['index']);router[_0x7d84('0xa')](_0x7d84('0xb'),auth[_0x7d84('0x9')](),controller[_0x7d84('0xc')]);router[_0x7d84('0xa')](_0x7d84('0xd'),auth['isAuthenticated'](),controller[_0x7d84('0xe')]);router['get']('/:id/users',auth[_0x7d84('0x9')](),controller[_0x7d84('0xf')]);router[_0x7d84('0xa')](_0x7d84('0x10'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x11')]);router[_0x7d84('0x12')]('/',auth[_0x7d84('0x9')](),controller[_0x7d84('0x13')]);router[_0x7d84('0x12')](_0x7d84('0x14'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x15')]);router[_0x7d84('0x12')](_0x7d84('0x10'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x16')]);router[_0x7d84('0x17')](_0x7d84('0xd'),auth[_0x7d84('0x9')](),controller[_0x7d84('0x18')]);router['delete'](_0x7d84('0xd'),auth[_0x7d84('0x9')](),controller['destroy']);router['delete']('/:id/users',auth[_0x7d84('0x9')](),controller[_0x7d84('0x19')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module[_0x7d84('0x1a')]=router; \ No newline at end of file +var _0x3f7d=['destroy','removeAgents','removeTeams','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','update','delete'];(function(_0x1acd39,_0x1f5c5b){var _0x4d5ac4=function(_0x3203d2){while(--_0x3203d2){_0x1acd39['push'](_0x1acd39['shift']());}};_0x4d5ac4(++_0x1f5c5b);}(_0x3f7d,0x18b));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd3f7('0x0'));var util=require(_0xd3f7('0x1'));var path=require(_0xd3f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xd3f7('0x3'));var router=express['Router']();var fs_extra=require(_0xd3f7('0x4'));var auth=require(_0xd3f7('0x5'));var interaction=require(_0xd3f7('0x6'));var config=require(_0xd3f7('0x7'));var controller=require(_0xd3f7('0x8'));router[_0xd3f7('0x9')]('/',auth[_0xd3f7('0xa')](),controller[_0xd3f7('0xb')]);router[_0xd3f7('0x9')](_0xd3f7('0xc'),auth[_0xd3f7('0xa')](),controller[_0xd3f7('0xd')]);router['get'](_0xd3f7('0xe'),auth['isAuthenticated'](),controller[_0xd3f7('0xf')]);router[_0xd3f7('0x9')](_0xd3f7('0x10'),auth[_0xd3f7('0xa')](),controller['getAgents']);router[_0xd3f7('0x9')](_0xd3f7('0x11'),auth[_0xd3f7('0xa')](),controller[_0xd3f7('0x12')]);router[_0xd3f7('0x13')]('/',auth[_0xd3f7('0xa')](),controller[_0xd3f7('0x14')]);router[_0xd3f7('0x13')](_0xd3f7('0x10'),auth['isAuthenticated'](),controller[_0xd3f7('0x15')]);router[_0xd3f7('0x13')](_0xd3f7('0x11'),auth[_0xd3f7('0xa')](),controller[_0xd3f7('0x16')]);router['put'](_0xd3f7('0xe'),auth[_0xd3f7('0xa')](),controller[_0xd3f7('0x17')]);router[_0xd3f7('0x18')](_0xd3f7('0xe'),auth[_0xd3f7('0xa')](),controller[_0xd3f7('0x19')]);router[_0xd3f7('0x18')](_0xd3f7('0x10'),auth[_0xd3f7('0xa')](),controller[_0xd3f7('0x1a')]);router[_0xd3f7('0x18')]('/:id/teams',auth[_0xd3f7('0xa')](),controller[_0xd3f7('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4da47c3..cfccdc1 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 _0x757a=['VIRTUAL','INTEGER','sequelize','exports','STRING','name'];(function(_0xfbc9ca,_0x2ed120){var _0xe8f463=function(_0x1953cf){while(--_0x1953cf){_0xfbc9ca['push'](_0xfbc9ca['shift']());}};_0xe8f463(++_0x2ed120);}(_0x757a,0x17c));var _0xa757=function(_0x31cc71,_0x382caf){_0x31cc71=_0x31cc71-0x0;var _0x3c268a=_0x757a[_0x31cc71];return _0x3c268a;};'use strict';var Sequelize=require(_0xa757('0x0'));module[_0xa757('0x1')]={'name':{'type':Sequelize[_0xa757('0x2')],'allowNull':![],'unique':_0xa757('0x3')},'prefix':{'type':Sequelize[_0xa757('0x4')],'get':function(_0x57dd91){return'system-'+this['getDataValue'](_0xa757('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xa757('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xa757('0x5')]}}; \ No newline at end of file +var _0x80a7=['system-','getDataValue','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x80a7,0x1a6));var _0x780a=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x80a7[_0x279d37];return _0x530173;};'use strict';var Sequelize=require(_0x780a('0x0'));module[_0x780a('0x1')]={'name':{'type':Sequelize[_0x780a('0x2')],'allowNull':![],'unique':_0x780a('0x3')},'prefix':{'type':Sequelize[_0x780a('0x4')],'get':function(_0x43a06d){return _0x780a('0x5')+this[_0x780a('0x6')](_0x780a('0x3'))+'-';}},'description':{'type':Sequelize[_0x780a('0x2')]},'callerIdAll':{'type':Sequelize[_0x780a('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 79f2896..c4fcfd9 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 _0x93e9=['VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','${EXTEN:','length','charAt','body','system-','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','options','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','catch','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','appdata','prefix','NoOp'];(function(_0x1e5243,_0x3d6959){var _0x459137=function(_0x1d7a10){while(--_0x1d7a10){_0x1e5243['push'](_0x1e5243['shift']());}};_0x459137(++_0x3d6959);}(_0x93e9,0xcc));var _0x993e=function(_0x23e5ce,_0x57584d){_0x23e5ce=_0x23e5ce-0x0;var _0x2ce19b=_0x93e9[_0x23e5ce];return _0x2ce19b;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];config['redis']=_['defaults'](config[_0x993e('0x19')],{'host':_0x993e('0x1a'),'port':0x18eb});var socket=require(_0x993e('0x1b'))(new Redis(config[_0x993e('0x19')]));require(_0x993e('0x1c'))[_0x993e('0x1d')](socket);function respondWithStatusCode(_0x34ddda,_0x20f32a){_0x20f32a=_0x20f32a||0xcc;return function(_0x2a184b){if(_0x2a184b){return _0x34ddda[_0x993e('0x1e')](_0x20f32a);}return _0x34ddda[_0x993e('0x1f')](_0x20f32a)[_0x993e('0x20')]();};}function respondWithResult(_0x3df0e7,_0x125322){_0x125322=_0x125322||0xc8;return function(_0x1f267f){if(_0x1f267f){return _0x3df0e7[_0x993e('0x1f')](_0x125322)[_0x993e('0x21')](_0x1f267f);}};}function respondWithFilteredResult(_0x526e06,_0x22f7cc){return function(_0x1acd21){if(_0x1acd21){var _0x3cc2b9=typeof _0x22f7cc[_0x993e('0x22')]===_0x993e('0x23')&&typeof _0x22f7cc[_0x993e('0x24')]==='undefined';var _0x11cd41=_0x1acd21[_0x993e('0x25')];var _0x1eaf57=_0x3cc2b9?0x0:_0x22f7cc[_0x993e('0x22')];var _0x130a8a=_0x3cc2b9?_0x1acd21[_0x993e('0x25')]:_0x22f7cc[_0x993e('0x22')]+_0x22f7cc[_0x993e('0x24')];var _0x4bbe9c;if(_0x130a8a>=_0x11cd41){_0x130a8a=_0x11cd41;_0x4bbe9c=0xc8;}else{_0x4bbe9c=0xce;}_0x526e06[_0x993e('0x1f')](_0x4bbe9c);return _0x526e06['set'](_0x993e('0x26'),_0x1eaf57+'-'+_0x130a8a+'/'+_0x11cd41)[_0x993e('0x21')](_0x1acd21);}return null;};}function patchUpdates(_0x32b09e){return function(_0x5ba2a1){try{jsonpatch[_0x993e('0x27')](_0x5ba2a1,_0x32b09e,!![]);}catch(_0x13db4e){return BPromise[_0x993e('0x28')](_0x13db4e);}return _0x5ba2a1[_0x993e('0x29')]();};}function saveUpdates(_0x3b45ef,_0x328d22){return function(_0xa1c83e){if(_0xa1c83e){return _0xa1c83e[_0x993e('0x2a')](_0x3b45ef)[_0x993e('0x2b')](function(_0x18f6ac){return _0x18f6ac;});}return null;};}function removeEntity(_0x3fe099,_0x3603fa){return function(_0x4fe471){if(_0x4fe471){return _0x4fe471[_0x993e('0x2c')]()[_0x993e('0x2b')](function(){var _0x52b727=_0x4fe471[_0x993e('0x2d')]({'plain':!![]});var _0x4f5cc1=_0x993e('0x2e');return db[_0x993e('0x2f')][_0x993e('0x2c')]({'where':{'type':_0x4f5cc1,'resourceId':_0x52b727['id']}})[_0x993e('0x2b')](function(){return _0x4fe471;});})['then'](function(){_0x3fe099['status'](0xcc)[_0x993e('0x20')]();});}};}function handleEntityNotFound(_0x466d63,_0x4a4f00){return function(_0x223af0){if(!_0x223af0){_0x466d63[_0x993e('0x1e')](0x194);}return _0x223af0;};}function handleError(_0x248354,_0x4c5ee3){_0x4c5ee3=_0x4c5ee3||0x1f4;return function(_0x2495b7){logger[_0x993e('0x30')](_0x2495b7[_0x993e('0x31')]);if(_0x2495b7[_0x993e('0x32')]){delete _0x2495b7[_0x993e('0x32')];}_0x248354['status'](_0x4c5ee3)[_0x993e('0x33')](_0x2495b7);};}exports['index']=function(_0x782298,_0x5ba163){var _0x1da357={},_0x567ed4={},_0x3b9c3c={'count':0x0,'rows':[]};var _0x2ce5d5=_[_0x993e('0x34')](db[_0x993e('0x35')][_0x993e('0x36')],function(_0x360e2d){return{'name':_0x360e2d['fieldName'],'type':_0x360e2d[_0x993e('0x37')]['key']};});_0x567ed4['model']=_[_0x993e('0x34')](_0x2ce5d5,'name');_0x567ed4[_0x993e('0x38')]=_[_0x993e('0x39')](_0x782298[_0x993e('0x38')]);_0x567ed4[_0x993e('0x3a')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],_0x567ed4[_0x993e('0x38')]);_0x1da357[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x782298[_0x993e('0x38')][_0x993e('0x3e')]));_0x1da357[_0x993e('0x3d')]=_0x1da357[_0x993e('0x3d')]['length']?_0x1da357[_0x993e('0x3d')]:_0x567ed4[_0x993e('0x3c')];if(!_0x782298[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1da357[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x782298[_0x993e('0x38')][_0x993e('0x24')]);_0x1da357['offset']=qs[_0x993e('0x22')](_0x782298['query'][_0x993e('0x22')]);}_0x1da357[_0x993e('0x41')]=qs[_0x993e('0x42')](_0x782298[_0x993e('0x38')][_0x993e('0x42')]);_0x1da357[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x782298['query'],_0x567ed4[_0x993e('0x3a')]),_0x2ce5d5);if(_0x782298['query'][_0x993e('0x45')]){_0x1da357['where']=_[_0x993e('0x46')](_0x1da357[_0x993e('0x43')],{'$or':_[_0x993e('0x34')](_0x2ce5d5,function(_0x1f1327){if(_0x1f1327[_0x993e('0x37')]!==_0x993e('0x47')){var _0xb728cf={};_0xb728cf[_0x1f1327[_0x993e('0x32')]]={'$like':'%'+_0x782298['query'][_0x993e('0x45')]+'%'};return _0xb728cf;}})});}_0x1da357=_['merge']({},_0x1da357,_0x782298['options']);var _0x1a2712={'where':_0x1da357[_0x993e('0x43')]};return db[_0x993e('0x35')]['count'](_0x1a2712)[_0x993e('0x2b')](function(_0x40719d){_0x3b9c3c[_0x993e('0x25')]=_0x40719d;if(_0x782298['query']['includeAll']){_0x1da357['include']=[{'all':!![]}];}return db[_0x993e('0x35')][_0x993e('0x48')](_0x1da357);})[_0x993e('0x2b')](function(_0x539c9d){_0x3b9c3c[_0x993e('0x49')]=_0x539c9d;return _0x3b9c3c;})[_0x993e('0x2b')](respondWithFilteredResult(_0x5ba163,_0x1da357))['catch'](handleError(_0x5ba163,null));};exports[_0x993e('0x4a')]=function(_0x5f7563,_0x5074a6){var _0x258795={'raw':![],'where':{'id':_0x5f7563[_0x993e('0x4b')]['id']}},_0x576ea={};_0x576ea['model']=_['keys'](db['VoicePrefix'][_0x993e('0x36')]);_0x576ea[_0x993e('0x38')]=_[_0x993e('0x39')](_0x5f7563[_0x993e('0x38')]);_0x576ea['filters']=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],_0x576ea[_0x993e('0x38')]);_0x258795[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],qs['fields'](_0x5f7563['query'][_0x993e('0x3e')]));_0x258795[_0x993e('0x3d')]=_0x258795['attributes']['length']?_0x258795[_0x993e('0x3d')]:_0x576ea[_0x993e('0x3c')];if(_0x5f7563[_0x993e('0x38')][_0x993e('0x4c')]){_0x258795[_0x993e('0x4d')]=[{'all':!![]}];}_0x258795=_[_0x993e('0x46')]({},_0x258795,_0x5f7563['options']);return db[_0x993e('0x35')]['find'](_0x258795)[_0x993e('0x2b')](handleEntityNotFound(_0x5074a6,null))[_0x993e('0x2b')](respondWithResult(_0x5074a6,null))[_0x993e('0x4e')](handleError(_0x5074a6,null));};exports[_0x993e('0x2c')]=function(_0x2cba37,_0x276b99){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x2cba37['params']['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x276b99,null))[_0x993e('0x2b')](removeEntity(_0x276b99,null))[_0x993e('0x4e')](handleError(_0x276b99,null));};exports['describe']=function(_0x355912,_0x53c1e9){return db[_0x993e('0x35')][_0x993e('0x50')]()['then'](respondWithResult(_0x53c1e9,null))[_0x993e('0x4e')](handleError(_0x53c1e9,null));};exports[_0x993e('0x51')]=function(_0x579c43,_0x3809ef){var _0x207e27;return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x2e368e){return db['VoicePrefix']['create'](_0x579c43['body'],{'transaction':_0x2e368e})[_0x993e('0x2b')](function(_0x29f8a5){_0x207e27=_0x29f8a5[_0x993e('0x2d')]({'plain':!![]});return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x207e27[_0x993e('0x55')]},'raw':!![]})['then'](function(_0x3a897d){return createVoicePrefixExtensions(_0x207e27,_0x3a897d,_0x2e368e);});});})[_0x993e('0x2b')](function(){var _0x15c8ed=_0x579c43['user'][_0x993e('0x2d')]({'plain':!![]});if(!_0x15c8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c8ed['role']===_0x993e('0x56')){var _0x37d7b1=_0x207e27;return db['UserProfileSection'][_0x993e('0x4f')]({'where':{'name':'VoicePrefixes','userProfileId':_0x15c8ed[_0x993e('0x57')]},'raw':!![]})[_0x993e('0x2b')](function(_0x4a0dbd){if(_0x4a0dbd&&_0x4a0dbd['autoAssociation']===0x0){return db[_0x993e('0x2f')][_0x993e('0x51')]({'name':_0x37d7b1[_0x993e('0x32')],'resourceId':_0x37d7b1['id'],'type':_0x4a0dbd[_0x993e('0x32')],'sectionId':_0x4a0dbd['id']},{})[_0x993e('0x2b')](function(){return _0x207e27;});}else{return _0x207e27;}})[_0x993e('0x4e')](function(_0x4f9225){logger[_0x993e('0x30')](_0x993e('0x58'),_0x4f9225);throw _0x4f9225;});}return _0x207e27;})['then'](respondWithResult(_0x3809ef,null))[_0x993e('0x4e')](handleError(_0x3809ef,null));};function Extension(_0x473e00,_0x1b2113,_0x5ebaec,_0x426341){this[_0x993e('0x59')]=_0x993e('0x5a');this['exten']=_0x473e00;this[_0x993e('0x5b')]=_0x5ebaec;this[_0x993e('0x37')]=_0x993e('0x5c');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x1b2113;this[_0x993e('0x5d')]=_0x426341;}function createVoicePrefixExtensions(_0x98d16c,_0x3a3d29,_0x411484){return new BPromise(function(_0xc62106,_0x55a347){var _0x18367f=new Extension(formatPrefixName(_0x98d16c[_0x993e('0x5e')]),0x1,_0x993e('0x5f'),'Voice\x20Prefix');_0x18367f[_0x993e('0x60')]=_0x98d16c['id'];return db[_0x993e('0x54')][_0x993e('0x51')](_0x18367f,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x5e4ab1){var _0x54417b=_0x5e4ab1[_0x993e('0x2d')]({'plain':!![]});var _0x51cec9=_['map'](addVoicePrefixExtensions(_0x98d16c,_0x3a3d29),function(_0x17c7f7){_0x17c7f7[_0x993e('0x55')]=_0x54417b['id'];_0x17c7f7[_0x993e('0x60')]=_0x98d16c['id'];return _0x17c7f7;});return db[_0x993e('0x54')][_0x993e('0x61')](_0x51cec9,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x211204){if(!_0x211204){return _0x55a347(_0x993e('0x62'));}else{return _0xc62106(_0x211204);}})[_0x993e('0x4e')](function(_0x113395){return _0x55a347(_0x113395);});});;});};function addVoicePrefixExtensions(_0x300a93,_0x44def2){var _0x2ddc16=[];var _0x609430=formatPrefixName(_0x300a93[_0x993e('0x5e')]);_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x2,'Set',_0x993e('0x64')+_0x300a93[_0x993e('0x32')]));if(_0x300a93['callerIdAll']){_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'Set',_0x993e('0x65')+_0x300a93[_0x993e('0x66')]));}else{_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'NoOp',_0x993e('0x67')));}_0x2ddc16['push'](new Extension(_0x609430,0x4,'goto',_0x44def2[_0x993e('0x59')]+','+_0x993e('0x68')+(0x8+_0x300a93[_0x993e('0x32')][_0x993e('0x69')])+'}'+','+0x1));return _0x2ddc16;}function formatPrefixName(_0x2a243a){var _0x5194de='_';for(var _0x120d51=0x0;_0x120d51<_0x2a243a[_0x993e('0x69')];_0x120d51++){if(_0x2a243a[_0x993e('0x6a')](_0x120d51)=='-'){_0x5194de+=_0x2a243a['charAt'](_0x120d51);}else{_0x5194de+='['+_0x2a243a[_0x993e('0x6a')](_0x120d51)+']';}}_0x5194de+='.';return _0x5194de;}exports['update']=function(_0x1ab10e,_0x6ef96,_0x42288d){var _0x5afba1=_0x1ab10e[_0x993e('0x6b')];_0x5afba1[_0x993e('0x5e')]=_0x993e('0x6c')+_0x5afba1[_0x993e('0x32')]+'-';return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x108cad){return db[_0x993e('0x35')][_0x993e('0x2a')](_0x5afba1,{'where':{'id':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db['VoiceExtension'][_0x993e('0x2c')]({'where':{'VoicePrefixId':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x5afba1[_0x993e('0x55')]},'raw':!![]})[_0x993e('0x2b')](function(_0x282c53){return createVoicePrefixExtensions(_0x5afba1,_0x282c53,_0x108cad);});});});})[_0x993e('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5afba1['id']);})[_0x993e('0x2b')](respondWithResult(_0x6ef96,null))['catch'](handleError(_0x6ef96,null));};exports[_0x993e('0x6d')]=function(_0x444da6,_0x2ce913,_0x49788e){return db[_0x993e('0x35')]['find']({'where':{'id':_0x444da6[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x2ce913,null))[_0x993e('0x2b')](function(_0x40768a){if(_0x40768a){return _0x40768a[_0x993e('0x6d')](_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')],_[_0x993e('0x6f')](_0x444da6['body'],['ids','id'])||{})[_0x993e('0x70')](function(_0x5a70ff){for(var _0x2fb182=0x0;_0x2fb182<_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x993e('0x69')];_0x2fb182+=0x1){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':Number(_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x2fb182]),'VoicePrefixId':Number(_0x444da6[_0x993e('0x4b')]['id'])});}return _0x5a70ff;});}})[_0x993e('0x2b')](respondWithResult(_0x2ce913,null))['catch'](handleError(_0x2ce913,null));};exports[_0x993e('0x73')]=function(_0x14347f,_0x4a0002,_0x4742d9){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x14347f[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x4a0002,null))[_0x993e('0x2b')](function(_0x4157b6){if(_0x4157b6){return _0x4157b6[_0x993e('0x73')](_0x14347f[_0x993e('0x38')]['ids'])[_0x993e('0x2b')](function(){if(_[_0x993e('0x74')](_0x14347f[_0x993e('0x38')][_0x993e('0x6e')])){for(var _0x53ce16=0x0;_0x53ce16<_0x14347f['query'][_0x993e('0x6e')]['length'];_0x53ce16+=0x1){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')][_0x53ce16]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}}else{socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a0002,null))[_0x993e('0x4e')](handleError(_0x4a0002,null));};exports[_0x993e('0x76')]=function(_0x3abd3a,_0x278c2a,_0x3f6347){var _0x1a3967={};var _0x1079e7={};var _0x5c634a;var _0x47c3b6;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x3abd3a[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x278c2a,null))[_0x993e('0x2b')](function(_0x53b0c8){if(_0x53b0c8){_0x5c634a=_0x53b0c8;_0x1079e7['model']=_['keys'](db[_0x993e('0x78')][_0x993e('0x36')]);_0x1079e7[_0x993e('0x38')]=_[_0x993e('0x39')](_0x3abd3a[_0x993e('0x38')]);_0x1079e7['filters']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],_0x1079e7[_0x993e('0x38')]);_0x1a3967['attributes']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x3e')]));_0x1a3967[_0x993e('0x3d')]=_0x1a3967['attributes'][_0x993e('0x69')]?_0x1a3967['attributes']:_0x1079e7['model'];_0x1a3967['order']=qs['sort'](_0x3abd3a[_0x993e('0x38')][_0x993e('0x42')]);_0x1a3967[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x3abd3a[_0x993e('0x38')],_0x1079e7[_0x993e('0x3a')]));if(_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]){_0x1a3967['where']=_[_0x993e('0x46')](_0x1a3967['where'],{'$or':_[_0x993e('0x34')](_0x1a3967[_0x993e('0x3d')],function(_0x3e7793){var _0x65c6f0={};_0x65c6f0[_0x3e7793]={'$like':'%'+_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x65c6f0;})});}_0x1a3967=_[_0x993e('0x46')]({},_0x1a3967,_0x3abd3a['options']);return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})[_0x993e('0x2b')](function(_0x285c93){if(_0x285c93){_0x47c3b6=_0x285c93['length'];if(!_0x3abd3a[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1a3967['limit']=qs[_0x993e('0x24')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x24')]);_0x1a3967[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x22')]);}return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})['then'](function(_0x412d21){if(_0x412d21){return _0x412d21?{'count':_0x47c3b6,'rows':_0x412d21}:null;}})['then'](respondWithResult(_0x278c2a,null))[_0x993e('0x4e')](handleError(_0x278c2a,null));};exports[_0x993e('0x79')]=function(_0x4d6d94,_0x505f28,_0x4e2ccf){var _0x4506cb={};var _0x31e947={};var _0x7800d4;var _0x4e1fcf;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x4d6d94[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x505f28,null))['then'](function(_0xc35545){if(_0xc35545){_0x7800d4=_0xc35545;_0x31e947['model']=_[_0x993e('0x39')](db['Team']['rawAttributes']);_0x31e947[_0x993e('0x38')]=_[_0x993e('0x39')](_0x4d6d94[_0x993e('0x38')]);_0x31e947[_0x993e('0x3a')]=_['intersection'](_0x31e947['model'],_0x31e947['query']);_0x4506cb[_0x993e('0x3d')]=_['intersection'](_0x31e947[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x3e')]));_0x4506cb[_0x993e('0x3d')]=_0x4506cb['attributes'][_0x993e('0x69')]?_0x4506cb[_0x993e('0x3d')]:_0x31e947['model'];_0x4506cb[_0x993e('0x41')]=qs['sort'](_0x4d6d94[_0x993e('0x38')][_0x993e('0x42')]);_0x4506cb[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x4d6d94[_0x993e('0x38')],_0x31e947[_0x993e('0x3a')]));if(_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]){_0x4506cb['where']=_[_0x993e('0x46')](_0x4506cb['where'],{'$or':_[_0x993e('0x34')](_0x4506cb[_0x993e('0x3d')],function(_0x50dd66){var _0x48acd5={};_0x48acd5[_0x50dd66]={'$like':'%'+_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x48acd5;})});}_0x4506cb=_['merge']({},_0x4506cb,_0x4d6d94[_0x993e('0x7a')]);return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0xc56e5a){if(_0xc56e5a){_0x4e1fcf=_0xc56e5a['length'];if(!_0x4d6d94[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x4506cb[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x4d6d94['query'][_0x993e('0x24')]);_0x4506cb[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x22')]);}return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0x5d2b00){if(_0x5d2b00){return _0x5d2b00?{'count':_0x4e1fcf,'rows':_0x5d2b00}:null;}})[_0x993e('0x2b')](respondWithResult(_0x505f28,null))['catch'](handleError(_0x505f28,null));};exports[_0x993e('0x7b')]=function(_0x8dc65,_0x4a5755,_0x43b5c5){var _0x4d53d1=_0x8dc65['body'][_0x993e('0x6e')];var _0x371be2;return db['Team'][_0x993e('0x48')]({'where':{'id':_0x4d53d1},'attributes':['id'],'include':[{'model':db[_0x993e('0x78')],'as':_0x993e('0x7c'),'attributes':['id',_0x993e('0x32'),'online',_0x993e('0x7d'),'interface'],'raw':!![]}]})[_0x993e('0x2b')](function(_0x5c9960){if(_0x5c9960){_0x371be2=_0x5c9960;var _0x4286a0=_[_0x993e('0x7e')](_0x5c9960,function(_0x2540e4){var _0x56a23a=_0x2540e4['get']({'plain':!![]});return _0x56a23a[_0x993e('0x7c')];});return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x8dc65[_0x993e('0x4b')]['id']}})['then'](function(_0x37409f){return db['sequelize'][_0x993e('0x53')](function(_0xa16043){return _0x37409f[_0x993e('0x7b')](_0x4d53d1,{'transaction':_0xa16043})['then'](function(){return BPromise[_0x993e('0x7f')](_0x371be2,function(_0x30f7a3){return db[_0x993e('0x80')][_0x993e('0x81')]({'TeamId':_0x30f7a3['id'],'VoicePrefixId':_0x8dc65[_0x993e('0x4b')]['id']},{'transaction':_0xa16043});});})[_0x993e('0x2b')](function(){return BPromise[_0x993e('0x7f')](_0x4286a0,function(_0x3e61d2){return db[_0x993e('0x82')]['findOrCreate']({'where':{'UserId':_0x3e61d2['id'],'VoicePrefixId':_0x8dc65['params']['id']},'transaction':_0xa16043});});})['then'](function(){_0x4286a0[_0x993e('0x83')](function(_0x47c230){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':_0x47c230['id'],'VoicePrefixId':_0x37409f['id']});});});});});}})[_0x993e('0x2b')](respondWithStatusCode(_0x4a5755,null))[_0x993e('0x4e')](handleError(_0x4a5755,null));};exports['removeTeams']=function(_0x548dfb,_0x123dcd,_0x4e7340){return db[_0x993e('0x84')][_0x993e('0x48')]({'where':{'id':_0x548dfb[_0x993e('0x38')][_0x993e('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x993e('0x7c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x123dcd,null))['then'](function(_0x242374){var _0x1a3779=_[_0x993e('0x34')](_0x242374,'id');var _0x366809=[];var _0x11ba3a=[];var _0x1b2ca0=squel[_0x993e('0x85')]();_0x1b2ca0[_0x993e('0x86')](_0x993e('0x87'))[_0x993e('0x88')](_0x993e('0x89'),'tq')[_0x993e('0x8a')]('user_has_teams','ut',_0x993e('0x8b'))[_0x993e('0x43')](_0x993e('0x8c'),_0x548dfb[_0x993e('0x4b')]['id']);for(var _0x23ecf0=0x0;_0x23ecf0<_0x242374[_0x993e('0x69')];_0x23ecf0+=0x1){let _0x2fcfaa=_0x242374[_0x23ecf0];for(var _0x5303c9=0x0;_0x5303c9<_0x2fcfaa[_0x993e('0x7c')]['length'];_0x5303c9+=0x1){let _0x5d5dc8=_0x2fcfaa[_0x993e('0x7c')][_0x5303c9];var _0x102393=_0x1b2ca0[_0x993e('0x8d')]();_0x102393['where'](_0x993e('0x8e'),_0x5d5dc8['id']);_0x11ba3a[_0x993e('0x63')](db[_0x993e('0x52')][_0x993e('0x38')](_0x102393[_0x993e('0x8f')](),{'type':db[_0x993e('0x52')][_0x993e('0x90')]['SELECT']})[_0x993e('0x2b')](function(_0x6ee3c0){if(_0x6ee3c0['length']===0x1){return _0x5d5dc8['id'];}else{var _0x58fee1=_[_0x993e('0x91')](_[_0x993e('0x34')](_0x6ee3c0,_0x993e('0x92')),function(_0x2f0669){return _[_0x993e('0x93')](_0x1a3779,_0x2f0669);});if(_0x58fee1){return _0x5d5dc8['id'];}}}));}}return BPromise['all'](_0x11ba3a)[_0x993e('0x2b')](function(_0x3725b5){_0x366809=_(_0x366809)['union'](_0x3725b5)[_0x993e('0x94')]()['value']();return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x548dfb['params']['id']}})[_0x993e('0x2b')](function(_0x5ee2e0){return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x289772){return _0x5ee2e0['removeTeams'](_0x548dfb['query'][_0x993e('0x6e')],{'transaction':_0x289772})[_0x993e('0x2b')](function(){if(!_[_0x993e('0x95')](_0x366809)){return _0x5ee2e0[_0x993e('0x73')](_0x366809,{'transaction':_0x289772});}})[_0x993e('0x2b')](function(){_0x366809[_0x993e('0x83')](function(_0x366f8f){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':_0x366f8f,'VoicePrefixId':_0x5ee2e0['id']});});});});});});})['then'](respondWithStatusCode(_0x123dcd,null))[_0x993e('0x4e')](handleError(_0x123dcd,null));}; \ No newline at end of file +var _0xc900=['voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VoicePrefix','includeAll','include','findAll','show','params','options','catch','destroy','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','${EXTEN:','update','system-','sequelize','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','Team','getTeams','addTeams','Agents'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xc900,0xb3));var _0x0c90=function(_0x45243b,_0x18053b){_0x45243b=_0x45243b-0x0;var _0x5913c6=_0xc900[_0x45243b];return _0x5913c6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];config['redis']=_[_0x0c90('0x19')](config[_0x0c90('0x1a')],{'host':_0x0c90('0x1b'),'port':0x18eb});var socket=require(_0x0c90('0x1c'))(new Redis(config[_0x0c90('0x1a')]));require('./voicePrefix.socket')[_0x0c90('0x1d')](socket);function respondWithStatusCode(_0x4451e0,_0x4f35f4){_0x4f35f4=_0x4f35f4||0xcc;return function(_0x2c82a4){if(_0x2c82a4){return _0x4451e0[_0x0c90('0x1e')](_0x4f35f4);}return _0x4451e0[_0x0c90('0x1f')](_0x4f35f4)['end']();};}function respondWithResult(_0x5daeb7,_0x412635){_0x412635=_0x412635||0xc8;return function(_0x15ca42){if(_0x15ca42){return _0x5daeb7[_0x0c90('0x1f')](_0x412635)[_0x0c90('0x20')](_0x15ca42);}};}function respondWithFilteredResult(_0x276b92,_0x2cab22){return function(_0x42321a){if(_0x42321a){var _0x57b9a6=typeof _0x2cab22[_0x0c90('0x21')]===_0x0c90('0x22')&&typeof _0x2cab22[_0x0c90('0x23')]===_0x0c90('0x22');var _0x594267=_0x42321a[_0x0c90('0x24')];var _0xd129ca=_0x57b9a6?0x0:_0x2cab22[_0x0c90('0x21')];var _0x1241a9=_0x57b9a6?_0x42321a[_0x0c90('0x24')]:_0x2cab22[_0x0c90('0x21')]+_0x2cab22['limit'];var _0x365a42;if(_0x1241a9>=_0x594267){_0x1241a9=_0x594267;_0x365a42=0xc8;}else{_0x365a42=0xce;}_0x276b92['status'](_0x365a42);return _0x276b92[_0x0c90('0x25')](_0x0c90('0x26'),_0xd129ca+'-'+_0x1241a9+'/'+_0x594267)['json'](_0x42321a);}return null;};}function patchUpdates(_0x2a053a){return function(_0x43ddc3){try{jsonpatch[_0x0c90('0x27')](_0x43ddc3,_0x2a053a,!![]);}catch(_0x86dee){return BPromise[_0x0c90('0x28')](_0x86dee);}return _0x43ddc3[_0x0c90('0x29')]();};}function saveUpdates(_0x4dfbc3,_0x26f0a3){return function(_0x12f22c){if(_0x12f22c){return _0x12f22c['update'](_0x4dfbc3)['then'](function(_0x28d005){return _0x28d005;});}return null;};}function removeEntity(_0x3ea861,_0x35c243){return function(_0x109a5f){if(_0x109a5f){return _0x109a5f['destroy']()[_0x0c90('0x2a')](function(){var _0x438652=_0x109a5f[_0x0c90('0x2b')]({'plain':!![]});var _0x277d4a=_0x0c90('0x2c');return db[_0x0c90('0x2d')]['destroy']({'where':{'type':_0x277d4a,'resourceId':_0x438652['id']}})[_0x0c90('0x2a')](function(){return _0x109a5f;});})[_0x0c90('0x2a')](function(){_0x3ea861[_0x0c90('0x1f')](0xcc)[_0x0c90('0x2e')]();});}};}function handleEntityNotFound(_0x52d28d,_0x4c8603){return function(_0x1f27f1){if(!_0x1f27f1){_0x52d28d[_0x0c90('0x1e')](0x194);}return _0x1f27f1;};}function handleError(_0x3bff04,_0x122a4f){_0x122a4f=_0x122a4f||0x1f4;return function(_0x119e09){logger['error'](_0x119e09[_0x0c90('0x2f')]);if(_0x119e09[_0x0c90('0x30')]){delete _0x119e09[_0x0c90('0x30')];}_0x3bff04['status'](_0x122a4f)[_0x0c90('0x31')](_0x119e09);};}exports['index']=function(_0x54a3f5,_0x886634){var _0x5071b={},_0x2f0835={},_0x41189f={'count':0x0,'rows':[]};var _0x58c01a=_[_0x0c90('0x32')](db['VoicePrefix'][_0x0c90('0x33')],function(_0x5a0e75){return{'name':_0x5a0e75[_0x0c90('0x34')],'type':_0x5a0e75[_0x0c90('0x35')]['key']};});_0x2f0835[_0x0c90('0x36')]=_[_0x0c90('0x32')](_0x58c01a,_0x0c90('0x30'));_0x2f0835[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x54a3f5[_0x0c90('0x37')]);_0x2f0835[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x2f0835['model'],_0x2f0835[_0x0c90('0x37')]);_0x5071b[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x2f0835[_0x0c90('0x36')],qs['fields'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x5071b[_0x0c90('0x3b')]=_0x5071b[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x5071b[_0x0c90('0x3b')]:_0x2f0835[_0x0c90('0x36')];if(!_0x54a3f5[_0x0c90('0x37')]['hasOwnProperty'](_0x0c90('0x3e'))){_0x5071b[_0x0c90('0x23')]=qs['limit'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x23')]);_0x5071b[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x54a3f5[_0x0c90('0x37')]['offset']);}_0x5071b[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x40')]);_0x5071b[_0x0c90('0x41')]=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x54a3f5[_0x0c90('0x37')],_0x2f0835[_0x0c90('0x39')]),_0x58c01a);if(_0x54a3f5['query'][_0x0c90('0x43')]){_0x5071b['where']=_[_0x0c90('0x44')](_0x5071b['where'],{'$or':_[_0x0c90('0x32')](_0x58c01a,function(_0x62e316){if(_0x62e316['type']!=='VIRTUAL'){var _0x27ef6f={};_0x27ef6f[_0x62e316['name']]={'$like':'%'+_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x27ef6f;}})});}_0x5071b=_[_0x0c90('0x44')]({},_0x5071b,_0x54a3f5['options']);var _0x2ad8eb={'where':_0x5071b[_0x0c90('0x41')]};return db[_0x0c90('0x45')][_0x0c90('0x24')](_0x2ad8eb)[_0x0c90('0x2a')](function(_0x1184c4){_0x41189f['count']=_0x1184c4;if(_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x46')]){_0x5071b[_0x0c90('0x47')]=[{'all':!![]}];}return db[_0x0c90('0x45')][_0x0c90('0x48')](_0x5071b);})[_0x0c90('0x2a')](function(_0x30b9df){_0x41189f['rows']=_0x30b9df;return _0x41189f;})[_0x0c90('0x2a')](respondWithFilteredResult(_0x886634,_0x5071b))['catch'](handleError(_0x886634,null));};exports[_0x0c90('0x49')]=function(_0x2470ce,_0x1a7a36){var _0x1179b0={'raw':![],'where':{'id':_0x2470ce[_0x0c90('0x4a')]['id']}},_0x38842c={};_0x38842c[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x45')][_0x0c90('0x33')]);_0x38842c[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2470ce[_0x0c90('0x37')]);_0x38842c[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x38842c['model'],_0x38842c[_0x0c90('0x37')]);_0x1179b0[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x38842c[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x2470ce[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x1179b0[_0x0c90('0x3b')]=_0x1179b0[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x1179b0[_0x0c90('0x3b')]:_0x38842c[_0x0c90('0x36')];if(_0x2470ce[_0x0c90('0x37')][_0x0c90('0x46')]){_0x1179b0['include']=[{'all':!![]}];}_0x1179b0=_[_0x0c90('0x44')]({},_0x1179b0,_0x2470ce[_0x0c90('0x4b')]);return db['VoicePrefix']['find'](_0x1179b0)['then'](handleEntityNotFound(_0x1a7a36,null))[_0x0c90('0x2a')](respondWithResult(_0x1a7a36,null))[_0x0c90('0x4c')](handleError(_0x1a7a36,null));};exports[_0x0c90('0x4d')]=function(_0x3fbdfc,_0x11d2de){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x3fbdfc[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x11d2de,null))['then'](removeEntity(_0x11d2de,null))[_0x0c90('0x4c')](handleError(_0x11d2de,null));};exports[_0x0c90('0x4f')]=function(_0xd639a1,_0xb483e7){return db[_0x0c90('0x45')][_0x0c90('0x4f')]()[_0x0c90('0x2a')](respondWithResult(_0xb483e7,null))[_0x0c90('0x4c')](handleError(_0xb483e7,null));};exports[_0x0c90('0x50')]=function(_0xeeee3b,_0x5e288e){var _0xac80b2;return db['sequelize'][_0x0c90('0x51')](function(_0x67539d){return db[_0x0c90('0x45')][_0x0c90('0x50')](_0xeeee3b[_0x0c90('0x52')],{'transaction':_0x67539d})[_0x0c90('0x2a')](function(_0x58dcfc){_0xac80b2=_0x58dcfc['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xac80b2[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x3bf5de){return createVoicePrefixExtensions(_0xac80b2,_0x3bf5de,_0x67539d);});});})['then'](function(){var _0x202666=_0xeeee3b[_0x0c90('0x54')]['get']({'plain':!![]});if(!_0x202666)throw new Error(_0x0c90('0x55'));if(_0x202666['role']===_0x0c90('0x54')){var _0x8951f2=_0xac80b2;return db[_0x0c90('0x56')][_0x0c90('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x202666[_0x0c90('0x57')]},'raw':!![]})['then'](function(_0x344613){if(_0x344613&&_0x344613[_0x0c90('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x8951f2['name'],'resourceId':_0x8951f2['id'],'type':_0x344613[_0x0c90('0x30')],'sectionId':_0x344613['id']},{})[_0x0c90('0x2a')](function(){return _0xac80b2;});}else{return _0xac80b2;}})[_0x0c90('0x4c')](function(_0x2f61cb){logger[_0x0c90('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f61cb);throw _0x2f61cb;});}return _0xac80b2;})[_0x0c90('0x2a')](respondWithResult(_0x5e288e,null))[_0x0c90('0x4c')](handleError(_0x5e288e,null));};function Extension(_0x5ee971,_0x3eb725,_0x5a11e5,_0x24326b){this[_0x0c90('0x5a')]='from-sip';this[_0x0c90('0x5b')]=_0x5ee971;this['app']=_0x5a11e5;this['type']='system';this[_0x0c90('0x5c')]=_0x0c90('0x5d');this[_0x0c90('0x5e')]=_0x3eb725;this[_0x0c90('0x5f')]=_0x24326b;}function createVoicePrefixExtensions(_0x536a26,_0x5b385b,_0x426f65){return new BPromise(function(_0xd982c5,_0x120b88){var _0x4c4e5a=new Extension(formatPrefixName(_0x536a26[_0x0c90('0x60')]),0x1,_0x0c90('0x61'),_0x0c90('0x62'));_0x4c4e5a['VoicePrefixId']=_0x536a26['id'];return db[_0x0c90('0x63')][_0x0c90('0x50')](_0x4c4e5a,{'transaction':_0x426f65})[_0x0c90('0x2a')](function(_0x521436){var _0x31343b=_0x521436[_0x0c90('0x2b')]({'plain':!![]});var _0x1a198b=_[_0x0c90('0x32')](addVoicePrefixExtensions(_0x536a26,_0x5b385b),function(_0xf58a25){_0xf58a25[_0x0c90('0x53')]=_0x31343b['id'];_0xf58a25[_0x0c90('0x64')]=_0x536a26['id'];return _0xf58a25;});return db[_0x0c90('0x63')][_0x0c90('0x65')](_0x1a198b,{'transaction':_0x426f65})['then'](function(_0x530bbe){if(!_0x530bbe){return _0x120b88(_0x0c90('0x66'));}else{return _0xd982c5(_0x530bbe);}})[_0x0c90('0x4c')](function(_0x3a44df){return _0x120b88(_0x3a44df);});});;});};function addVoicePrefixExtensions(_0x2faf14,_0x19dae5){var _0x2dad30=[];var _0x2f1459=formatPrefixName(_0x2faf14[_0x0c90('0x60')]);_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x2,_0x0c90('0x68'),_0x0c90('0x69')+_0x2faf14[_0x0c90('0x30')]));if(_0x2faf14[_0x0c90('0x6a')]){_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x68'),'PREFIX-CALLERIDALL='+_0x2faf14[_0x0c90('0x6a')]));}else{_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x61'),'No\x20callerid\x20available'));}_0x2dad30['push'](new Extension(_0x2f1459,0x4,_0x0c90('0x6b'),_0x19dae5['context']+','+_0x0c90('0x6c')+(0x8+_0x2faf14[_0x0c90('0x30')]['length'])+'}'+','+0x1));return _0x2dad30;}function formatPrefixName(_0x2c64e0){var _0x3f4819='_';for(var _0x25ef97=0x0;_0x25ef97<_0x2c64e0[_0x0c90('0x3d')];_0x25ef97++){if(_0x2c64e0['charAt'](_0x25ef97)=='-'){_0x3f4819+=_0x2c64e0['charAt'](_0x25ef97);}else{_0x3f4819+='['+_0x2c64e0['charAt'](_0x25ef97)+']';}}_0x3f4819+='.';return _0x3f4819;}exports[_0x0c90('0x6d')]=function(_0x2d3287,_0x3bc90d,_0x2d5fe3){var _0x4a801f=_0x2d3287[_0x0c90('0x52')];_0x4a801f['prefix']=_0x0c90('0x6e')+_0x4a801f[_0x0c90('0x30')]+'-';return db[_0x0c90('0x6f')]['transaction'](function(_0x10f686){return db[_0x0c90('0x45')][_0x0c90('0x6d')](_0x4a801f,{'where':{'id':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension'][_0x0c90('0x4e')]({'where':{'id':_0x4a801f[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x4a59b5){return createVoicePrefixExtensions(_0x4a801f,_0x4a59b5,_0x10f686);});});});})[_0x0c90('0x2a')](function(){return db[_0x0c90('0x45')][_0x0c90('0x70')](_0x4a801f['id']);})[_0x0c90('0x2a')](respondWithResult(_0x3bc90d,null))[_0x0c90('0x4c')](handleError(_0x3bc90d,null));};exports[_0x0c90('0x71')]=function(_0x53779b,_0x28a2f0,_0x431828){return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x53779b[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x28a2f0,null))[_0x0c90('0x2a')](function(_0x1777ac){if(_0x1777ac){return _0x1777ac[_0x0c90('0x71')](_0x53779b[_0x0c90('0x52')]['ids'],_[_0x0c90('0x72')](_0x53779b[_0x0c90('0x52')],[_0x0c90('0x73'),'id'])||{})[_0x0c90('0x74')](function(_0x4e8330){for(var _0x2e68ea=0x0;_0x2e68ea<_0x53779b[_0x0c90('0x52')][_0x0c90('0x73')]['length'];_0x2e68ea+=0x1){socket[_0x0c90('0x75')](_0x0c90('0x76'),{'UserId':Number(_0x53779b['body'][_0x0c90('0x73')][_0x2e68ea]),'VoicePrefixId':Number(_0x53779b['params']['id'])});}return _0x4e8330;});}})[_0x0c90('0x2a')](respondWithResult(_0x28a2f0,null))['catch'](handleError(_0x28a2f0,null));};exports['removeAgents']=function(_0x42e76a,_0x137c30,_0x56a38b){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x42e76a[_0x0c90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137c30,null))['then'](function(_0x250d41){if(_0x250d41){return _0x250d41['removeAgents'](_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')])[_0x0c90('0x2a')](function(){if(_[_0x0c90('0x77')](_0x42e76a[_0x0c90('0x37')]['ids'])){for(var _0x471caa=0x0;_0x471caa<_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')]['length'];_0x471caa+=0x1){socket['emit'](_0x0c90('0x78'),{'UserId':Number(_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')][_0x471caa]),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x42e76a[_0x0c90('0x37')]['ids']),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x137c30,null))['catch'](handleError(_0x137c30,null));};exports[_0x0c90('0x79')]=function(_0x2ca017,_0x1bf6e0,_0x29ede1){var _0x16c383={};var _0x56a3bc={};var _0x5562cc;var _0x57eab8;return db[_0x0c90('0x45')][_0x0c90('0x7a')]({'where':{'id':_0x2ca017[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x1bf6e0,null))[_0x0c90('0x2a')](function(_0x3d5521){if(_0x3d5521){_0x5562cc=_0x3d5521;_0x56a3bc['model']=_[_0x0c90('0x38')](db[_0x0c90('0x7b')][_0x0c90('0x33')]);_0x56a3bc[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2ca017[_0x0c90('0x37')]);_0x56a3bc[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x56a3bc[_0x0c90('0x36')],_0x56a3bc[_0x0c90('0x37')]);_0x16c383[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x56a3bc['model'],qs[_0x0c90('0x3c')](_0x2ca017['query'][_0x0c90('0x3c')]));_0x16c383['attributes']=_0x16c383[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x16c383[_0x0c90('0x3b')]:_0x56a3bc[_0x0c90('0x36')];_0x16c383['order']=qs['sort'](_0x2ca017[_0x0c90('0x37')][_0x0c90('0x40')]);_0x16c383['where']=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x2ca017['query'],_0x56a3bc[_0x0c90('0x39')]));if(_0x2ca017[_0x0c90('0x37')]['filter']){_0x16c383[_0x0c90('0x41')]=_['merge'](_0x16c383[_0x0c90('0x41')],{'$or':_[_0x0c90('0x32')](_0x16c383[_0x0c90('0x3b')],function(_0x1b95db){var _0x519f74={};_0x519f74[_0x1b95db]={'$like':'%'+_0x2ca017[_0x0c90('0x37')]['filter']+'%'};return _0x519f74;})});}_0x16c383=_[_0x0c90('0x44')]({},_0x16c383,_0x2ca017[_0x0c90('0x4b')]);return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})[_0x0c90('0x2a')](function(_0x1306bb){if(_0x1306bb){_0x57eab8=_0x1306bb['length'];if(!_0x2ca017[_0x0c90('0x37')][_0x0c90('0x7c')](_0x0c90('0x3e'))){_0x16c383[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x2ca017[_0x0c90('0x37')]['limit']);_0x16c383[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x2ca017['query'][_0x0c90('0x21')]);}return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})['then'](function(_0x199d05){if(_0x199d05){return _0x199d05?{'count':_0x57eab8,'rows':_0x199d05}:null;}})[_0x0c90('0x2a')](respondWithResult(_0x1bf6e0,null))['catch'](handleError(_0x1bf6e0,null));};exports['getTeams']=function(_0x13c69c,_0x407c6e,_0x4859e9){var _0x391e3f={};var _0x4fee0e={};var _0x37d1d5;var _0x4c142b;return db['VoicePrefix'][_0x0c90('0x7a')]({'where':{'id':_0x13c69c[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x407c6e,null))['then'](function(_0x54846c){if(_0x54846c){_0x37d1d5=_0x54846c;_0x4fee0e[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x7d')][_0x0c90('0x33')]);_0x4fee0e[_0x0c90('0x37')]=_['keys'](_0x13c69c[_0x0c90('0x37')]);_0x4fee0e['filters']=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],_0x4fee0e[_0x0c90('0x37')]);_0x391e3f[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x13c69c['query']['fields']));_0x391e3f[_0x0c90('0x3b')]=_0x391e3f[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x391e3f[_0x0c90('0x3b')]:_0x4fee0e[_0x0c90('0x36')];_0x391e3f[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x13c69c[_0x0c90('0x37')]['sort']);_0x391e3f[_0x0c90('0x41')]=qs['filters'](_[_0x0c90('0x42')](_0x13c69c[_0x0c90('0x37')],_0x4fee0e[_0x0c90('0x39')]));if(_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]){_0x391e3f[_0x0c90('0x41')]=_[_0x0c90('0x44')](_0x391e3f['where'],{'$or':_['map'](_0x391e3f[_0x0c90('0x3b')],function(_0x4a001d){var _0x2204fe={};_0x2204fe[_0x4a001d]={'$like':'%'+_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x2204fe;})});}_0x391e3f=_['merge']({},_0x391e3f,_0x13c69c[_0x0c90('0x4b')]);return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x30be13){if(_0x30be13){_0x4c142b=_0x30be13[_0x0c90('0x3d')];if(!_0x13c69c['query']['hasOwnProperty'](_0x0c90('0x3e'))){_0x391e3f[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x23')]);_0x391e3f[_0x0c90('0x21')]=qs['offset'](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x21')]);}return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x5103ae){if(_0x5103ae){return _0x5103ae?{'count':_0x4c142b,'rows':_0x5103ae}:null;}})['then'](respondWithResult(_0x407c6e,null))[_0x0c90('0x4c')](handleError(_0x407c6e,null));};exports[_0x0c90('0x7f')]=function(_0x59e8d9,_0x9bed36,_0x379a0e){var _0x19a144=_0x59e8d9[_0x0c90('0x52')][_0x0c90('0x73')];var _0x5379bc;return db[_0x0c90('0x7d')]['findAll']({'where':{'id':_0x19a144},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id',_0x0c90('0x30'),'online',_0x0c90('0x81'),_0x0c90('0x82')],'raw':!![]}]})[_0x0c90('0x2a')](function(_0x5f295e){if(_0x5f295e){_0x5379bc=_0x5f295e;var _0x5a2961=_['flatMap'](_0x5f295e,function(_0x4930cd){var _0x2858a9=_0x4930cd[_0x0c90('0x2b')]({'plain':!![]});return _0x2858a9['Agents'];});return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x59e8d9['params']['id']}})[_0x0c90('0x2a')](function(_0x13c0f2){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x1091fb){return _0x13c0f2['addTeams'](_0x19a144,{'transaction':_0x1091fb})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5379bc,function(_0x35ee25){return db[_0x0c90('0x84')][_0x0c90('0x85')]({'TeamId':_0x35ee25['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},{'transaction':_0x1091fb});});})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5a2961,function(_0x3614d1){return db[_0x0c90('0x86')]['findOrCreate']({'where':{'UserId':_0x3614d1['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},'transaction':_0x1091fb});});})['then'](function(){_0x5a2961[_0x0c90('0x87')](function(_0x40dd25){socket[_0x0c90('0x75')]('userVoicePrefix:save',{'UserId':_0x40dd25['id'],'VoicePrefixId':_0x13c0f2['id']});});});});});}})[_0x0c90('0x2a')](respondWithStatusCode(_0x9bed36,null))['catch'](handleError(_0x9bed36,null));};exports[_0x0c90('0x88')]=function(_0x1c2814,_0x2f542b,_0x3f3787){return db[_0x0c90('0x7d')][_0x0c90('0x48')]({'where':{'id':_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')]},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f542b,null))[_0x0c90('0x2a')](function(_0x31dde9){var _0x37acdc=_['map'](_0x31dde9,'id');var _0x5f431d=[];var _0x2dabe6=[];var _0x28736e=squel['select']();_0x28736e['field'](_0x0c90('0x89'))[_0x0c90('0x8a')]('team_has_voice_prefixes','tq')[_0x0c90('0x8b')](_0x0c90('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c90('0x41')](_0x0c90('0x8d'),_0x1c2814['params']['id']);for(var _0x1fb55a=0x0;_0x1fb55a<_0x31dde9['length'];_0x1fb55a+=0x1){let _0x5aa532=_0x31dde9[_0x1fb55a];for(var _0x8e8e30=0x0;_0x8e8e30<_0x5aa532[_0x0c90('0x80')]['length'];_0x8e8e30+=0x1){let _0x5c942d=_0x5aa532[_0x0c90('0x80')][_0x8e8e30];var _0x155915=_0x28736e[_0x0c90('0x8e')]();_0x155915[_0x0c90('0x41')](_0x0c90('0x8f'),_0x5c942d['id']);_0x2dabe6['push'](db[_0x0c90('0x6f')][_0x0c90('0x37')](_0x155915[_0x0c90('0x90')](),{'type':db[_0x0c90('0x6f')][_0x0c90('0x91')][_0x0c90('0x92')]})['then'](function(_0x18cc89){if(_0x18cc89['length']===0x1){return _0x5c942d['id'];}else{var _0x5e6e8f=_['every'](_[_0x0c90('0x32')](_0x18cc89,_0x0c90('0x93')),function(_0x53c760){return _[_0x0c90('0x94')](_0x37acdc,_0x53c760);});if(_0x5e6e8f){return _0x5c942d['id'];}}}));}}return BPromise['all'](_0x2dabe6)['then'](function(_0x22b3df){_0x5f431d=_(_0x5f431d)[_0x0c90('0x95')](_0x22b3df)[_0x0c90('0x96')]()[_0x0c90('0x97')]();return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x1c2814[_0x0c90('0x4a')]['id']}})['then'](function(_0x2eece9){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x3817a4){return _0x2eece9[_0x0c90('0x88')](_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')],{'transaction':_0x3817a4})[_0x0c90('0x2a')](function(){if(!_[_0x0c90('0x98')](_0x5f431d)){return _0x2eece9[_0x0c90('0x99')](_0x5f431d,{'transaction':_0x3817a4});}})[_0x0c90('0x2a')](function(){_0x5f431d[_0x0c90('0x87')](function(_0x9187af){socket[_0x0c90('0x75')]('userVoicePrefix:remove',{'UserId':_0x9187af,'VoicePrefixId':_0x2eece9['id']});});});});});});})[_0x0c90('0x2a')](respondWithStatusCode(_0x2f542b,null))[_0x0c90('0x4c')](handleError(_0x2f542b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 01728f2..0c7ea08 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 _0x2f5b=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1c9348,_0xac86cd){var _0x3f567d=function(_0x119dcc){while(--_0x119dcc){_0x1c9348['push'](_0x1c9348['shift']());}};_0x3f567d(++_0xac86cd);}(_0x2f5b,0xd1));var _0xb2f5=function(_0x2d4cec,_0x19500c){_0x2d4cec=_0x2d4cec-0x0;var _0x32f0ca=_0x2f5b[_0x2d4cec];return _0x32f0ca;};'use strict';var EventEmitter=require(_0xb2f5('0x0'));var VoicePrefix=require(_0xb2f5('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb2f5('0x2')](0x0);var events={'afterCreate':_0xb2f5('0x3'),'afterUpdate':_0xb2f5('0x4'),'afterDestroy':_0xb2f5('0x5')};function emitEvent(_0x22dd08){return function(_0x9dd2a2,_0x4055f4,_0x2c863f){VoicePrefixEvents[_0xb2f5('0x6')](_0x22dd08+':'+_0x9dd2a2['id'],_0x9dd2a2);VoicePrefixEvents[_0xb2f5('0x6')](_0x22dd08,_0x9dd2a2);_0x2c863f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xb2f5('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xd8e8=['save','update','remove','exports','events','../../mysqldb'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd8e8,0xac));var _0x8d8e=function(_0xc3961b,_0x105f9b){_0xc3961b=_0xc3961b-0x0;var _0x17b3e2=_0xd8e8[_0xc3961b];return _0x17b3e2;};'use strict';var EventEmitter=require(_0x8d8e('0x0'));var VoicePrefix=require(_0x8d8e('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d8e('0x2'),'afterUpdate':_0x8d8e('0x3'),'afterDestroy':_0x8d8e('0x4')};function emitEvent(_0x1ef213){return function(_0x20d417,_0x4f570e,_0x4926a4){VoicePrefixEvents['emit'](_0x1ef213+':'+_0x20d417['id'],_0x20d417);VoicePrefixEvents['emit'](_0x1ef213,_0x20d417);_0x4926a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x8d8e('0x5')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 65a1d17..59379f6 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 _0xdd9c=['voice_prefixes','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0xa650fb,_0x104a00){var _0x99f4de=function(_0x5f4d31){while(--_0x5f4d31){_0xa650fb['push'](_0xa650fb['shift']());}};_0x99f4de(++_0x104a00);}(_0xdd9c,0x18d));var _0xcdd9=function(_0x2928bc,_0x4f5a2f){_0x2928bc=_0x2928bc-0x0;var _0x4aae60=_0xdd9c[_0x2928bc];return _0x4aae60;};'use strict';var _=require(_0xcdd9('0x0'));var util=require('util');var logger=require(_0xcdd9('0x1'))(_0xcdd9('0x2'));var moment=require('moment');var BPromise=require(_0xcdd9('0x3'));var rp=require(_0xcdd9('0x4'));var fs=require('fs');var path=require(_0xcdd9('0x5'));var rimraf=require(_0xcdd9('0x6'));var config=require('../../config/environment');var attributes=require(_0xcdd9('0x7'));module[_0xcdd9('0x8')]=function(_0x29ce8c,_0x4586a7){return _0x29ce8c[_0xcdd9('0x9')](_0xcdd9('0xa'),attributes,{'tableName':_0xcdd9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9b5=['request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x45f196,_0x458695){var _0x1c3704=function(_0x40765f){while(--_0x40765f){_0x45f196['push'](_0x45f196['shift']());}};_0x1c3704(++_0x458695);}(_0xb9b5,0xeb));var _0x5b9b=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xb9b5[_0x424501];return _0xb719af;};'use strict';var _=require(_0x5b9b('0x0'));var util=require(_0x5b9b('0x1'));var logger=require(_0x5b9b('0x2'))('api');var moment=require(_0x5b9b('0x3'));var BPromise=require(_0x5b9b('0x4'));var rp=require(_0x5b9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b9b('0x6'));var config=require(_0x5b9b('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x5b9b('0x8')]=function(_0x58d2b3,_0x23724e){return _0x58d2b3[_0x5b9b('0x9')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index afb8007..6a29d73 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 _0x288a=['info','result','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1efb6b,_0x1547a3){var _0x44cce2=function(_0x5a5d28){while(--_0x5a5d28){_0x1efb6b['push'](_0x1efb6b['shift']());}};_0x44cce2(++_0x1547a3);}(_0x288a,0x188));var _0xa288=function(_0x189589,_0x129a36){_0x189589=_0x189589-0x0;var _0x10a4b4=_0x288a[_0x189589];return _0x10a4b4;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var moment=require(_0xa288('0x1'));var BPromise=require(_0xa288('0x2'));var rs=require(_0xa288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa288('0x4'));var logger=require('../../config/logger')(_0xa288('0x5'));var config=require(_0xa288('0x6'));var jayson=require(_0xa288('0x7'));var client=jayson['client'][_0xa288('0x8')]({'port':0x232a});config[_0xa288('0x9')]=_[_0xa288('0xa')](config['redis'],{'host':_0xa288('0xb'),'port':0x18eb});var socket=require(_0xa288('0xc'))(new Redis(config[_0xa288('0x9')]));require(_0xa288('0xd'))[_0xa288('0xe')](socket);function respondWithRpcPromise(_0x3181e6,_0x3095cf,_0x360396){return new BPromise(function(_0x4eafe2,_0x5cf5f1){return client['request'](_0x3181e6,_0x360396)[_0xa288('0xf')](function(_0x34a4ec){logger['info'](_0xa288('0x10'),_0x3095cf,_0xa288('0x11'));logger[_0xa288('0x12')](_0xa288('0x13'),_0x3095cf,_0xa288('0x11'),JSON[_0xa288('0x14')](_0x34a4ec));if(_0x34a4ec[_0xa288('0x15')]){if(_0x34a4ec[_0xa288('0x15')][_0xa288('0x16')]===0x1f4){logger[_0xa288('0x15')](_0xa288('0x10'),_0x3095cf,_0x34a4ec[_0xa288('0x15')][_0xa288('0x17')]);return _0x5cf5f1(_0x34a4ec[_0xa288('0x15')][_0xa288('0x17')]);}logger[_0xa288('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x3095cf,_0x34a4ec[_0xa288('0x15')][_0xa288('0x17')]);return _0x4eafe2(_0x34a4ec[_0xa288('0x15')][_0xa288('0x17')]);}else{logger[_0xa288('0x18')](_0xa288('0x10'),_0x3095cf,'request\x20sent');_0x4eafe2(_0x34a4ec[_0xa288('0x19')][_0xa288('0x17')]);}})['catch'](function(_0x58fa1a){logger[_0xa288('0x15')](_0xa288('0x10'),_0x3095cf,_0x58fa1a);_0x5cf5f1(_0x58fa1a);});});} \ No newline at end of file +var _0x16ce=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http'];(function(_0x50f6b6,_0x472b1e){var _0x4a4dfb=function(_0x3a0cc9){while(--_0x3a0cc9){_0x50f6b6['push'](_0x50f6b6['shift']());}};_0x4a4dfb(++_0x472b1e);}(_0x16ce,0xfb));var _0xe16c=function(_0x364c17,_0x473932){_0x364c17=_0x364c17-0x0;var _0x1739c5=_0x16ce[_0x364c17];return _0x1739c5;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var moment=require(_0xe16c('0x1'));var BPromise=require(_0xe16c('0x2'));var rs=require(_0xe16c('0x3'));var fs=require('fs');var Redis=require(_0xe16c('0x4'));var db=require(_0xe16c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe16c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe16c('0x7')][_0xe16c('0x8')]({'port':0x232a});config[_0xe16c('0x9')]=_[_0xe16c('0xa')](config[_0xe16c('0x9')],{'host':_0xe16c('0xb'),'port':0x18eb});var socket=require(_0xe16c('0xc'))(new Redis(config[_0xe16c('0x9')]));require('./voicePrefix.socket')[_0xe16c('0xd')](socket);function respondWithRpcPromise(_0x1dfa84,_0x3cc96b,_0x2e59ad){return new BPromise(function(_0x1b7da7,_0x280e21){return client[_0xe16c('0xe')](_0x1dfa84,_0x2e59ad)[_0xe16c('0xf')](function(_0x1b460c){logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,'request\x20sent');logger[_0xe16c('0x12')](_0xe16c('0x13'),_0x3cc96b,_0xe16c('0x14'),JSON[_0xe16c('0x15')](_0x1b460c));if(_0x1b460c['error']){if(_0x1b460c['error'][_0xe16c('0x16')]===0x1f4){logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x280e21(_0x1b460c[_0xe16c('0x17')]['message']);}logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x1b7da7(_0x1b460c[_0xe16c('0x17')][_0xe16c('0x18')]);}else{logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,_0xe16c('0x14'));_0x1b7da7(_0x1b460c['result'][_0xe16c('0x18')]);}})[_0xe16c('0x19')](function(_0x22fe04){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x3cc96b,_0x22fe04);_0x280e21(_0x22fe04);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 66058c5..7a81230 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 _0xd957=['register','length','voicePrefix:','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0xd957,0x153));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var VoicePrefixEvents=require(_0x7d95('0x0'));var events=[_0x7d95('0x1'),'remove',_0x7d95('0x2')];function createListener(_0x2035b7,_0x5d0023){return function(_0xf7608a){_0x5d0023[_0x7d95('0x3')](_0x2035b7,_0xf7608a);};}function removeListener(_0x291309,_0x9750e1){return function(){VoicePrefixEvents[_0x7d95('0x4')](_0x291309,_0x9750e1);};}exports[_0x7d95('0x5')]=function(_0x2de581){for(var _0x514355=0x0,_0x181ca5=events[_0x7d95('0x6')];_0x514355<_0x181ca5;_0x514355++){var _0x4f10ec=events[_0x514355];var _0xfd14f6=createListener(_0x7d95('0x7')+_0x4f10ec,_0x2de581);VoicePrefixEvents['on'](_0x4f10ec,_0xfd14f6);}}; \ No newline at end of file +var _0x98e5=['length','voicePrefix:','update','emit'];(function(_0x4869d4,_0x495061){var _0x1b4efa=function(_0x356575){while(--_0x356575){_0x4869d4['push'](_0x4869d4['shift']());}};_0x1b4efa(++_0x495061);}(_0x98e5,0x8a));var _0x598e=function(_0xfac2e2,_0x32bec1){_0xfac2e2=_0xfac2e2-0x0;var _0x47c74f=_0x98e5[_0xfac2e2];return _0x47c74f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save','remove',_0x598e('0x0')];function createListener(_0x3e343b,_0x5207d0){return function(_0x196f8a){_0x5207d0[_0x598e('0x1')](_0x3e343b,_0x196f8a);};}function removeListener(_0x5cc274,_0x3af01f){return function(){VoicePrefixEvents['removeListener'](_0x5cc274,_0x3af01f);};}exports['register']=function(_0x154755){for(var _0x568749=0x0,_0x4292c3=events[_0x598e('0x2')];_0x568749<_0x4292c3;_0x568749++){var _0x10bf8e=events[_0x568749];var _0x3e0212=createListener(_0x598e('0x3')+_0x10bf8e,_0x154755);VoicePrefixEvents['on'](_0x10bf8e,_0x3e0212);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4981d71..25defe0 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(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0xb10b[_0x3d00db];return _0x41f115;};'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 _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x29774f,_0x208efe){var _0x33f5d2=function(_0xb6e636){while(--_0xb6e636){_0x29774f['push'](_0x29774f['shift']());}};_0x33f5d2(++_0x208efe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 94cf14a..af69318 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 _0x1839=['#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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','type','getDataValue','dialMethod','strategy','preview','booked','roundrobin','INTEGER','yes','all','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x424231,_0x2139fb){var _0x49b278=function(_0x3ad0c3){while(--_0x3ad0c3){_0x424231['push'](_0x424231['shift']());}};_0x49b278(++_0x2139fb);}(_0x1839,0xbd));var _0x9183=function(_0x5a72e3,_0x2cdde8){_0x5a72e3=_0x5a72e3-0x0;var _0x3b2c74=_0x1839[_0x5a72e3];return _0x3b2c74;};'use strict';var Sequelize=require('sequelize');module[_0x9183('0x0')]={'name':{'type':Sequelize[_0x9183('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9183('0x2')]('inbound',_0x9183('0x3')),'allowNull':![],'defaultValue':_0x9183('0x4')},'musiconhold':{'type':Sequelize[_0x9183('0x1')],'defaultValue':_0x9183('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x9183('0x2')]('rr',_0x9183('0x6'),_0x9183('0x7'),_0x9183('0x8'),'random',_0x9183('0x9'),'linear',_0x9183('0xa'),_0x9183('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x3e13d9){this['setDataValue']('strategy',_0x3e13d9?_0x3e13d9:_0x9183('0x9'));},'get':function(){var _0x216cd=this['getDataValue'](_0x9183('0xc'));var _0x33bff9=this[_0x9183('0xd')](_0x9183('0xe'));var _0x36dd05=this[_0x9183('0xd')](_0x9183('0xf'));if(_0x216cd==='outbound'){if(_0x33bff9===_0x9183('0x10')){return null;}if(_0x33bff9===_0x9183('0x11')&&![_0x9183('0x9'),_0x9183('0x12')]['includes'](_0x36dd05)){this['setDataValue']('strategy',_0x9183('0x9'));}}return _0x36dd05;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9183('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9183('0x1')]},'weight':{'type':Sequelize[_0x9183('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9183('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x9183('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x14'),'no',_0x9183('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9183('0x13')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x9183('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x9183('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x9183('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9183('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9183('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x14'),'no'),'defaultValue':_0x9183('0x14')},'announce_holdtime':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x14'),'no',_0x9183('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x9183('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x9183('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9183('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9183('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x9183('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9183('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9183('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9183('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9183('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9183('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9183('0x1')]},'queue_quantity1':{'type':Sequelize[_0x9183('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x5cede2){this[_0x9183('0x17')](_0x9183('0x18'),_0x5cede2?_0x5cede2[_0x9183('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0x9183('0x18'))?this['getDataValue'](_0x9183('0x18'))[_0x9183('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x9183('0x1')],'defaultValue':_0x9183('0x14'),'set':function(_0x41a440){this[_0x9183('0x17')](_0x9183('0x1b'),_0x41a440?_0x41a440[_0x9183('0x19')](','):undefined);},'get':function(){return this[_0x9183('0xd')](_0x9183('0x1b'))?this[_0x9183('0xd')](_0x9183('0x1b'))[_0x9183('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9183('0x1')],'defaultValue':'no','set':function(_0x27b05f){this[_0x9183('0x17')](_0x9183('0x1c'),_0x27b05f?_0x27b05f[_0x9183('0x19')](','):undefined);},'get':function(){return this[_0x9183('0xd')](_0x9183('0x1c'))?this['getDataValue']('leavewhenempty')[_0x9183('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9183('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9183('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9183('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9183('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x9183('0x1d')],'defaultValue':0x0,'set':function(_0x39b19a){this[_0x9183('0x17')](_0x9183('0x1e'),_0x39b19a);if(_0x39b19a){if(this[_0x9183('0xd')](_0x9183('0x1f'))<0x2){this[_0x9183('0x17')](_0x9183('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9183('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9183('0x1d')],'defaultValue':0x0,'comment':_0x9183('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x9183('0x21'),'power',_0x9183('0x22'),_0x9183('0x11')),'defaultValue':'progressive','comment':_0x9183('0x23')},'dialLimitChannel':{'type':Sequelize[_0x9183('0x13')](0x4)[_0x9183('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x9183('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9183('0x25')},'dialPowerLevel':{'type':Sequelize[_0x9183('0x26')](0x2)[_0x9183('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9183('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x28'),_0x9183('0x29')),'defaultValue':_0x9183('0x29'),'comment':_0x9183('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9183('0x26')](0x2)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9183('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9183('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x9183('0x1')],'defaultValue':_0x9183('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x2e')},'dialQueueProject':{'type':Sequelize[_0x9183('0x1')],'comment':_0x9183('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9183('0x13')](0x5)[_0x9183('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9183('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9183('0x13')](0x5)[_0x9183('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9183('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x3,'comment':_0x9183('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9183('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9183('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9183('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9183('0x1')],'defaultValue':_0x9183('0x36')},'dialPrefix':{'type':Sequelize[_0x9183('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9183('0x2')](_0x9183('0x37'),'never',_0x9183('0x38')),'defaultValue':_0x9183('0x37')},'dialAMDActive':{'type':Sequelize[_0x9183('0x1d')],'defaultValue':0x0,'comment':_0x9183('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x9183('0x13')](0x9)[_0x9183('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9183('0x13')](0x9)[_0x9183('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9183('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9183('0x13')](0x9)[_0x9183('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9183('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9183('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9183('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x9183('0x13')](0x9)[_0x9183('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9183('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9183('0x13')](0x9)[_0x9183('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9183('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9183('0x13')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9183('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9183('0x13')](0x5)[_0x9183('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9183('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9183('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x9183('0x13')](0x5)[_0x9183('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9183('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x9183('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x9183('0x2')]('DESC','ASC'),'defaultValue':_0x9183('0x42')},'dialQueueProject2':{'type':Sequelize[_0x9183('0x1')],'comment':_0x9183('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9183('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9183('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9183('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9183('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x9183('0x13')](0x5)[_0x9183('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9183('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9183('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9183('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9183('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9183('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9183('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9183('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9183('0x13')],'allowNull':!![],'comment':_0x9183('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9183('0x4d'),'set':function(_0x36d391){if(!_0x36d391)this[_0x9183('0x17')](_0x9183('0x4e'),null);this[_0x9183('0x17')](_0x9183('0x4f'),_0x36d391);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9183('0x13')](0x3)[_0x9183('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x9183('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x4eba=['leastrecent','fewestcalls','random','wrandom','rrordered','strategy','getDataValue','type','dialMethod','outbound','booked','rrmemory','roundrobin','includes','setDataValue','INTEGER','yes','all','once','TEXT','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','name','ENUM','STRING','default','ringall'];(function(_0x447dab,_0x4cad14){var _0x15ecf3=function(_0x4175ff){while(--_0x4175ff){_0x447dab['push'](_0x447dab['shift']());}};_0x15ecf3(++_0x4cad14);}(_0x4eba,0xd5));var _0xa4eb=function(_0x304ac7,_0x305e74){_0x304ac7=_0x304ac7-0x0;var _0x35270f=_0x4eba[_0x304ac7];return _0x35270f;};'use strict';var Sequelize=require(_0xa4eb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa4eb('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa4eb('0x2')]('inbound','outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':_0xa4eb('0x4')},'announce':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa4eb('0x2')]('rr',_0xa4eb('0x5'),_0xa4eb('0x6'),_0xa4eb('0x7'),_0xa4eb('0x8'),'rrmemory','linear',_0xa4eb('0x9'),_0xa4eb('0xa')),'allowNull':![],'defaultValue':_0xa4eb('0x5'),'set':function(_0x309bcd){this['setDataValue'](_0xa4eb('0xb'),_0x309bcd?_0x309bcd:'rrmemory');},'get':function(){var _0x35b499=this[_0xa4eb('0xc')](_0xa4eb('0xd'));var _0x1432a1=this[_0xa4eb('0xc')](_0xa4eb('0xe'));var _0x2b73b8=this[_0xa4eb('0xc')]('strategy');if(_0x35b499===_0xa4eb('0xf')){if(_0x1432a1==='preview'){return null;}if(_0x1432a1===_0xa4eb('0x10')&&![_0xa4eb('0x11'),_0xa4eb('0x12')][_0xa4eb('0x13')](_0x2b73b8)){this[_0xa4eb('0x14')]('strategy',_0xa4eb('0x11'));}}return _0x2b73b8;}},'servicelevel':{'type':Sequelize[_0xa4eb('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa4eb('0x15')](0xb)},'timeout':{'type':Sequelize[_0xa4eb('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xa4eb('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':_0xa4eb('0x16')},'autopause':{'type':Sequelize['ENUM'](_0xa4eb('0x16'),'no',_0xa4eb('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa4eb('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa4eb('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa4eb('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa4eb('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':_0xa4eb('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xa4eb('0x16'),'no',_0xa4eb('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xa4eb('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xa4eb('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa4eb('0x3')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa4eb('0x3')]},'queue_quantity1':{'type':Sequelize[_0xa4eb('0x3')]},'queue_quantity2':{'type':Sequelize[_0xa4eb('0x3')]},'queue_periodic_announce':{'type':Sequelize[_0xa4eb('0x3')]},'queue_less_than':{'type':Sequelize[_0xa4eb('0x3')]},'periodic_announce':{'type':Sequelize[_0xa4eb('0x19')],'set':function(_0x38e30b){this[_0xa4eb('0x14')]('periodic_announce',_0x38e30b?_0x38e30b[_0xa4eb('0x1a')](','):[]);},'get':function(){return this[_0xa4eb('0xc')]('periodic_announce')?this[_0xa4eb('0xc')]('periodic_announce')[_0xa4eb('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xa4eb('0x16'),'set':function(_0x50a6fc){this[_0xa4eb('0x14')](_0xa4eb('0x1c'),_0x50a6fc?_0x50a6fc[_0xa4eb('0x1a')](','):undefined);},'get':function(){return this[_0xa4eb('0xc')](_0xa4eb('0x1c'))?this[_0xa4eb('0xc')](_0xa4eb('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':'no','set':function(_0x56b674){this[_0xa4eb('0x14')](_0xa4eb('0x1d'),_0x56b674?_0x56b674[_0xa4eb('0x1a')](','):undefined);},'get':function(){return this[_0xa4eb('0xc')](_0xa4eb('0x1d'))?this[_0xa4eb('0xc')]('leavewhenempty')[_0xa4eb('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xa4eb('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa4eb('0x3')]},'acw':{'type':Sequelize[_0xa4eb('0x1e')],'defaultValue':0x0,'set':function(_0x45be13){this[_0xa4eb('0x14')]('acw',_0x45be13);if(_0x45be13){if(this[_0xa4eb('0xc')](_0xa4eb('0x1f'))<0x2){this[_0xa4eb('0x14')](_0xa4eb('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa4eb('0x20')},'dialMethod':{'type':Sequelize[_0xa4eb('0x2')]('preview','progressive',_0xa4eb('0x21'),_0xa4eb('0x22'),_0xa4eb('0x10')),'defaultValue':'progressive','comment':_0xa4eb('0x23')},'dialLimitChannel':{'type':Sequelize[_0xa4eb('0x15')](0x4)[_0xa4eb('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa4eb('0x25')},'dialLimitQueue':{'type':Sequelize[_0xa4eb('0x15')](0x4)[_0xa4eb('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa4eb('0x26')},'dialPowerLevel':{'type':Sequelize[_0xa4eb('0x27')](0x2)[_0xa4eb('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x28'),_0xa4eb('0x29')),'defaultValue':_0xa4eb('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa4eb('0x27')](0x2)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa4eb('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa4eb('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa4eb('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa4eb('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4eb('0x2b')},'dialQueueOptions':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':'tTxX','comment':_0xa4eb('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4eb('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xa4eb('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4eb('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4eb('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4eb('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa4eb('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4eb('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa4eb('0x34')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xa4eb('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa4eb('0x2')](_0xa4eb('0x35'),_0xa4eb('0x36'),_0xa4eb('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xa4eb('0x1e')],'defaultValue':0x0,'comment':_0xa4eb('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xa4eb('0x15')](0x9)[_0xa4eb('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa4eb('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xa4eb('0x15')](0x9)[_0xa4eb('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa4eb('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa4eb('0x15')](0x9)[_0xa4eb('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa4eb('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xa4eb('0x15')](0x9)[_0xa4eb('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa4eb('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa4eb('0x15')](0x9)[_0xa4eb('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa4eb('0x15')](0x9)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa4eb('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa4eb('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa4eb('0x15')](0x9)[_0xa4eb('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa4eb('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa4eb('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xa4eb('0x1e')],'defaultValue':0x0,'comment':_0xa4eb('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa4eb('0x2')]('DESC','ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xa4eb('0x3')],'comment':_0xa4eb('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa4eb('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa4eb('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa4eb('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4eb('0x41')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4eb('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4eb('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4eb('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa4eb('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa4eb('0x15')](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa4eb('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa4eb('0x15')](0x3)[_0xa4eb('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa4eb('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xa4eb('0x47')},'mandatoryDisposition':{'type':Sequelize[_0xa4eb('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2e1bbe){if(!_0x2e1bbe)this[_0xa4eb('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xa4eb('0x48'),_0x2e1bbe);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xa4eb('0x15')](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[_0xa4eb('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xa4eb('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa4eb('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c630abc..a337fc7 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 _0xcedf=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','transaction','ids','removeAgents','addAgents','spread','User','isEmpty','upsert','isArray','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','updatedAt','select','ContactId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','push','CmHopperId','OrderBy','h.id','ci.OrderBy+1','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','squel','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','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','inbound','QueueCampaigns','ignore','map','value','type','find','name','UserProfileResource','error','stack','index','VoiceQueue','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','outbound','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','interface','emit','userVoiceQueue:save','removeTeams','field','tq.TeamId','from'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xcedf,0x1b6));var _0xfced=function(_0x34baa4,_0x3b683b){_0x34baa4=_0x34baa4-0x0;var _0x26b3fc=_0xcedf[_0x34baa4];return _0x26b3fc;};'use strict';var emlformat=require(_0xfced('0x0'));var rimraf=require(_0xfced('0x1'));var zipdir=require(_0xfced('0x2'));var jsonpatch=require(_0xfced('0x3'));var rp=require('request-promise');var moment=require(_0xfced('0x4'));var BPromise=require(_0xfced('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfced('0x6'));var sox=require('sox');var csv=require(_0xfced('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfced('0x8'));var _=require('lodash');var squel=require(_0xfced('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfced('0xa'));var toCsv=require(_0xfced('0x7'));var querystring=require(_0xfced('0xb'));var Papa=require(_0xfced('0xc'));var Redis=require('ioredis');var authService=require(_0xfced('0xd'));var qs=require(_0xfced('0xe'));var as=require(_0xfced('0xf'));var hardwareService=require(_0xfced('0x10'));var logger=require(_0xfced('0x11'))(_0xfced('0x12'));var utils=require(_0xfced('0x13'));var config=require(_0xfced('0x14'));var licenseUtil=require(_0xfced('0x15'));var db=require('../../mysqldb')['db'];config[_0xfced('0x16')]=_['defaults'](config[_0xfced('0x16')],{'host':_0xfced('0x17'),'port':0x18eb});var socket=require(_0xfced('0x18'))(new Redis(config[_0xfced('0x16')]));require('./voiceQueue.socket')[_0xfced('0x19')](socket);function respondWithStatusCode(_0x28cc02,_0x26a0d8){_0x26a0d8=_0x26a0d8||0xcc;return function(_0xf35a7f){if(_0xf35a7f){return _0x28cc02[_0xfced('0x1a')](_0x26a0d8);}return _0x28cc02[_0xfced('0x1b')](_0x26a0d8)[_0xfced('0x1c')]();};}function respondWithResult(_0xe3a203,_0x486519){_0x486519=_0x486519||0xc8;return function(_0x95b06f){if(_0x95b06f){return _0xe3a203['status'](_0x486519)[_0xfced('0x1d')](_0x95b06f);}};}function respondWithFilteredResult(_0x2111ce,_0x194805){return function(_0x2d00dc){if(_0x2d00dc){var _0x38528a=typeof _0x194805[_0xfced('0x1e')]===_0xfced('0x1f')&&typeof _0x194805[_0xfced('0x20')]===_0xfced('0x1f');var _0x16d442=_0x2d00dc['count'];var _0x29494c=_0x38528a?0x0:_0x194805[_0xfced('0x1e')];var _0x409f38=_0x38528a?_0x2d00dc[_0xfced('0x21')]:_0x194805[_0xfced('0x1e')]+_0x194805['limit'];var _0x595036;if(_0x409f38>=_0x16d442){_0x409f38=_0x16d442;_0x595036=0xc8;}else{_0x595036=0xce;}_0x2111ce[_0xfced('0x1b')](_0x595036);return _0x2111ce[_0xfced('0x22')]('Content-Range',_0x29494c+'-'+_0x409f38+'/'+_0x16d442)[_0xfced('0x1d')](_0x2d00dc);}return null;};}function patchUpdates(_0x445862){return function(_0x2732cc){try{jsonpatch[_0xfced('0x23')](_0x2732cc,_0x445862,!![]);}catch(_0xbc5ed4){return BPromise[_0xfced('0x24')](_0xbc5ed4);}return _0x2732cc['save']();};}function saveUpdates(_0x16d9a3,_0x2722d9){return function(_0xe2c4e0){if(_0xe2c4e0){return _0xe2c4e0[_0xfced('0x25')](_0x16d9a3)[_0xfced('0x26')](function(_0x56a26e){return _0x56a26e;});}return null;};}function removeEntity(_0x4edb87,_0x3c6fdb){return function(_0x3c9eb8){if(_0x3c9eb8){return _0x3c9eb8[_0xfced('0x27')]()[_0xfced('0x26')](function(){var _0x4d67bf=_0x3c9eb8[_0xfced('0x28')]({'plain':!![]});var _0x4ef6a0=[{'name':'VoiceQueues','value':_0xfced('0x29'),'ignore':![]},{'name':_0xfced('0x2a'),'value':'outbound','ignore':![]}];var _0x1adea4=_(_0x4ef6a0)['filter'](_0xfced('0x2b'))[_0xfced('0x2c')](_0xfced('0x2d'))[_0xfced('0x2d')]();if(_['includes'](_0x1adea4,_0x4d67bf[_0xfced('0x2e')])){return;}var _0x3431ea=_[_0xfced('0x2f')](_0x4ef6a0,[_0xfced('0x2d'),_0x4d67bf['type']])[_0xfced('0x30')];return db[_0xfced('0x31')][_0xfced('0x27')]({'where':{'type':_0x3431ea,'resourceId':_0x4d67bf['id']}})['then'](function(){return _0x3c9eb8;});})[_0xfced('0x26')](function(){_0x4edb87[_0xfced('0x1b')](0xcc)[_0xfced('0x1c')]();});}};}function handleEntityNotFound(_0xed15c9,_0x513ba8){return function(_0x1131d2){if(!_0x1131d2){_0xed15c9[_0xfced('0x1a')](0x194);}return _0x1131d2;};}function handleError(_0x13f42c,_0x46df0f){_0x46df0f=_0x46df0f||0x1f4;return function(_0x10c5da){logger[_0xfced('0x32')](_0x10c5da[_0xfced('0x33')]);if(_0x10c5da[_0xfced('0x30')]){delete _0x10c5da['name'];}_0x13f42c['status'](_0x46df0f)['send'](_0x10c5da);};}exports[_0xfced('0x34')]=function(_0x1a72cb,_0x3d462d){var _0x421f09={},_0xe017fd={},_0x5bba5c={'count':0x0,'rows':[]};var _0x173c1f=_[_0xfced('0x2c')](db[_0xfced('0x35')][_0xfced('0x36')],function(_0x34e759){return{'name':_0x34e759['fieldName'],'type':_0x34e759['type'][_0xfced('0x37')]};});_0xe017fd['model']=_[_0xfced('0x2c')](_0x173c1f,_0xfced('0x30'));_0xe017fd['query']=_[_0xfced('0x38')](_0x1a72cb['query']);_0xe017fd[_0xfced('0x39')]=_[_0xfced('0x3a')](_0xe017fd[_0xfced('0x3b')],_0xe017fd[_0xfced('0x3c')]);_0x421f09[_0xfced('0x3d')]=_[_0xfced('0x3a')](_0xe017fd[_0xfced('0x3b')],qs[_0xfced('0x3e')](_0x1a72cb[_0xfced('0x3c')]['fields']));_0x421f09[_0xfced('0x3d')]=_0x421f09[_0xfced('0x3d')][_0xfced('0x3f')]?_0x421f09[_0xfced('0x3d')]:_0xe017fd[_0xfced('0x3b')];if(!_0x1a72cb[_0xfced('0x3c')][_0xfced('0x40')](_0xfced('0x41'))){_0x421f09[_0xfced('0x20')]=qs[_0xfced('0x20')](_0x1a72cb[_0xfced('0x3c')][_0xfced('0x20')]);_0x421f09[_0xfced('0x1e')]=qs[_0xfced('0x1e')](_0x1a72cb[_0xfced('0x3c')][_0xfced('0x1e')]);}_0x421f09[_0xfced('0x42')]=qs[_0xfced('0x43')](_0x1a72cb[_0xfced('0x3c')][_0xfced('0x43')]);_0x421f09[_0xfced('0x44')]=qs[_0xfced('0x39')](_[_0xfced('0x45')](_0x1a72cb[_0xfced('0x3c')],_0xe017fd[_0xfced('0x39')]),_0x173c1f);if(_0x1a72cb[_0xfced('0x3c')][_0xfced('0x46')]){_0x421f09[_0xfced('0x44')]=_[_0xfced('0x47')](_0x421f09[_0xfced('0x44')],{'$or':_['map'](_0x173c1f,function(_0x4dad70){if(_0x4dad70['type']!=='VIRTUAL'){var _0x438ea5={};_0x438ea5[_0x4dad70['name']]={'$like':'%'+_0x1a72cb[_0xfced('0x3c')]['filter']+'%'};return _0x438ea5;}})});}_0x421f09=_[_0xfced('0x47')]({},_0x421f09,_0x1a72cb[_0xfced('0x48')]);var _0x4d5e72={'where':_0x421f09[_0xfced('0x44')]};return db[_0xfced('0x35')][_0xfced('0x21')](_0x4d5e72)[_0xfced('0x26')](function(_0x19da77){_0x5bba5c[_0xfced('0x21')]=_0x19da77;if(_0x1a72cb[_0xfced('0x3c')][_0xfced('0x49')]){_0x421f09[_0xfced('0x4a')]=[{'all':!![]}];}return db['VoiceQueue'][_0xfced('0x4b')](_0x421f09);})[_0xfced('0x26')](function(_0x42758f){_0x5bba5c[_0xfced('0x4c')]=_0x42758f;return _0x5bba5c;})[_0xfced('0x26')](respondWithFilteredResult(_0x3d462d,_0x421f09))[_0xfced('0x4d')](handleError(_0x3d462d,null));};exports[_0xfced('0x4e')]=function(_0xb9c2b6,_0x5dc9c5){var _0x4120a6={'raw':![],'where':{'id':_0xb9c2b6[_0xfced('0x4f')]['id']}},_0x322dca={};_0x322dca[_0xfced('0x3b')]=_['keys'](db[_0xfced('0x35')][_0xfced('0x36')]);_0x322dca[_0xfced('0x3c')]=_[_0xfced('0x38')](_0xb9c2b6[_0xfced('0x3c')]);_0x322dca['filters']=_[_0xfced('0x3a')](_0x322dca['model'],_0x322dca[_0xfced('0x3c')]);_0x4120a6['attributes']=_[_0xfced('0x3a')](_0x322dca['model'],qs[_0xfced('0x3e')](_0xb9c2b6['query']['fields']));_0x4120a6['attributes']=_0x4120a6[_0xfced('0x3d')][_0xfced('0x3f')]?_0x4120a6[_0xfced('0x3d')]:_0x322dca[_0xfced('0x3b')];if(_0xb9c2b6[_0xfced('0x3c')]['includeAll']){_0x4120a6['include']=[{'all':!![]}];}_0x4120a6=_[_0xfced('0x47')]({},_0x4120a6,_0xb9c2b6[_0xfced('0x48')]);return db[_0xfced('0x35')][_0xfced('0x2f')](_0x4120a6)[_0xfced('0x26')](handleEntityNotFound(_0x5dc9c5,null))['then'](respondWithResult(_0x5dc9c5,null))[_0xfced('0x4d')](handleError(_0x5dc9c5,null));};exports['create']=function(_0x2be71d,_0x4f0a1f){return db[_0xfced('0x35')][_0xfced('0x50')](_0x2be71d[_0xfced('0x51')],{})[_0xfced('0x26')](function(_0x57e410){var _0x24f1c8=_0x2be71d[_0xfced('0x52')][_0xfced('0x28')]({'plain':!![]});if(!_0x24f1c8)throw new Error(_0xfced('0x53'));if(_0x24f1c8[_0xfced('0x54')]===_0xfced('0x52')){var _0x12217c=_0x57e410[_0xfced('0x28')]({'plain':!![]});var _0x28c8b8=[{'name':_0xfced('0x55'),'value':'inbound'},{'name':_0xfced('0x2a'),'value':'outbound'}];var _0x16caec=_[_0xfced('0x2f')](_0x28c8b8,['value',_0x12217c[_0xfced('0x2e')]])[_0xfced('0x30')];return db[_0xfced('0x56')][_0xfced('0x2f')]({'where':{'name':_0x16caec,'userProfileId':_0x24f1c8[_0xfced('0x57')]},'raw':!![]})[_0xfced('0x26')](function(_0x120612){if(_0x120612&&_0x120612[_0xfced('0x58')]===0x0){return db[_0xfced('0x31')][_0xfced('0x50')]({'name':_0x12217c[_0xfced('0x30')],'resourceId':_0x12217c['id'],'type':_0x120612[_0xfced('0x30')],'sectionId':_0x120612['id']},{})[_0xfced('0x26')](function(){return _0x57e410;});}else{return _0x57e410;}})[_0xfced('0x4d')](function(_0x527dc8){logger[_0xfced('0x32')](_0xfced('0x59'),_0x527dc8);throw _0x527dc8;});}return _0x57e410;})[_0xfced('0x26')](respondWithResult(_0x4f0a1f,0xc9))['catch'](handleError(_0x4f0a1f,null));};exports[_0xfced('0x5a')]=function(_0x5c5790,_0x33d456){var _0x28e002={'where':{'id':_0x5c5790[_0xfced('0x4f')]['id']}},_0xcbecee={};_0xcbecee[_0xfced('0x3b')]=_[_0xfced('0x38')](db[_0xfced('0x35')][_0xfced('0x36')]);_0x28e002[_0xfced('0x3d')]=_[_0xfced('0x3a')](_0xcbecee[_0xfced('0x3b')],qs[_0xfced('0x3e')](_0x5c5790[_0xfced('0x3c')][_0xfced('0x3e')]));_0x28e002[_0xfced('0x3d')]=_0x28e002[_0xfced('0x3d')]['length']?_0x28e002[_0xfced('0x3d')]:_0xcbecee[_0xfced('0x3b')];if(_0x5c5790[_0xfced('0x3c')][_0xfced('0x49')]){_0x28e002[_0xfced('0x4a')]=[{'all':!![]}];}_0x28e002=_[_0xfced('0x47')]({},_0x28e002,_0x5c5790[_0xfced('0x48')]);return db[_0xfced('0x35')][_0xfced('0x2f')](_0x28e002)[_0xfced('0x26')](handleEntityNotFound(_0x33d456,null))[_0xfced('0x26')](function(_0x5a434b){if(_0x5a434b){var _0x10e9b0=_0x5a434b[_0xfced('0x28')]({'plain':!![]});_0x10e9b0=qs[_0xfced('0x5b')](_0x10e9b0,['id',_0xfced('0x5c'),'updatedAt']);_0x5c5790[_0xfced('0x51')]=_[_0xfced('0x5b')](_0x5c5790[_0xfced('0x51')],['id','createdAt','updatedAt']);return db[_0xfced('0x35')][_0xfced('0x50')](_[_0xfced('0x47')](_0x10e9b0,_0x5c5790[_0xfced('0x51')]),{'include':_0x5c5790[_0xfced('0x3c')][_0xfced('0x49')]?[{'all':!![]}]:undefined})[_0xfced('0x26')](function(_0x4b03ed){var _0x1f50d5=_0x5c5790[_0xfced('0x52')][_0xfced('0x28')]({'plain':!![]});if(!_0x1f50d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f50d5['role']===_0xfced('0x52')){var _0x8d7d9b=_0x4b03ed[_0xfced('0x28')]({'plain':!![]});var _0x21a837=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xfced('0x5d')}];var _0x3f4d1b=_[_0xfced('0x2f')](_0x21a837,['value',_0x8d7d9b['type']])['name'];return db['UserProfileSection'][_0xfced('0x2f')]({'where':{'name':_0x3f4d1b,'userProfileId':_0x1f50d5['userProfileId']},'raw':!![]})[_0xfced('0x26')](function(_0x9c7ac6){if(_0x9c7ac6&&_0x9c7ac6[_0xfced('0x58')]===0x0){return db[_0xfced('0x31')][_0xfced('0x50')]({'name':_0x8d7d9b[_0xfced('0x30')],'resourceId':_0x8d7d9b['id'],'type':_0x9c7ac6[_0xfced('0x30')],'sectionId':_0x9c7ac6['id']},{})['then'](function(){return _0x4b03ed;});}else{return _0x4b03ed;}})[_0xfced('0x4d')](function(_0x4e4c89){logger[_0xfced('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e4c89);throw _0x4e4c89;});}return _0x4b03ed;});}})[_0xfced('0x26')](respondWithResult(_0x33d456,0xc9))['catch'](handleError(_0x33d456,null));};exports[_0xfced('0x25')]=function(_0x8eedf8,_0x470b42){if(_0x8eedf8[_0xfced('0x51')]['id']){delete _0x8eedf8[_0xfced('0x51')]['id'];}return db[_0xfced('0x35')][_0xfced('0x2f')]({'where':{'id':_0x8eedf8['params']['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x470b42,null))[_0xfced('0x26')](saveUpdates(_0x8eedf8[_0xfced('0x51')],null))[_0xfced('0x26')](respondWithResult(_0x470b42,null))[_0xfced('0x4d')](handleError(_0x470b42,null));};exports[_0xfced('0x27')]=function(_0x3c6c9e,_0x1c9c8c){return db[_0xfced('0x35')]['find']({'where':{'id':_0x3c6c9e[_0xfced('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c9c8c,null))[_0xfced('0x26')](removeEntity(_0x1c9c8c,null))[_0xfced('0x4d')](handleError(_0x1c9c8c,null));};exports[_0xfced('0x5e')]=function(_0x3e2491,_0x302cdb,_0x237ccd){var _0x5a0d6d={'raw':![],'where':{}};var _0x18a921={};var _0x20868b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xfced('0x5f')]({'where':{'id':_0x3e2491[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x302cdb,null))[_0xfced('0x26')](function(_0x32b4ba){if(_0x32b4ba){_0x18a921[_0xfced('0x3b')]=_['keys'](db[_0xfced('0x60')][_0xfced('0x36')]);_0x18a921[_0xfced('0x3c')]=_[_0xfced('0x38')](_0x3e2491[_0xfced('0x3c')]);_0x18a921['filters']=_[_0xfced('0x3a')](_0x18a921[_0xfced('0x3b')],_0x18a921[_0xfced('0x3c')]);_0x5a0d6d[_0xfced('0x3d')]=_[_0xfced('0x3a')](_0x18a921[_0xfced('0x3b')],qs['fields'](_0x3e2491[_0xfced('0x3c')][_0xfced('0x3e')]));_0x5a0d6d[_0xfced('0x3d')]=_0x5a0d6d[_0xfced('0x3d')]['length']?_0x5a0d6d['attributes']:_0x18a921[_0xfced('0x3b')];if(!_0x3e2491[_0xfced('0x3c')][_0xfced('0x40')](_0xfced('0x41'))){_0x5a0d6d[_0xfced('0x20')]=qs[_0xfced('0x20')](_0x3e2491[_0xfced('0x3c')][_0xfced('0x20')]);_0x5a0d6d[_0xfced('0x1e')]=qs[_0xfced('0x1e')](_0x3e2491[_0xfced('0x3c')]['offset']);}_0x5a0d6d[_0xfced('0x42')]=qs[_0xfced('0x43')](_0x3e2491['query']['sort']);_0x5a0d6d[_0xfced('0x44')]=qs['filters'](_[_0xfced('0x45')](_0x3e2491[_0xfced('0x3c')],_0x18a921['filters']));_0x5a0d6d['where'][_0xfced('0x61')]=_0x32b4ba['id'];if(_0x3e2491['query'][_0xfced('0x46')]){_0x5a0d6d[_0xfced('0x44')]=_[_0xfced('0x47')](_0x5a0d6d[_0xfced('0x44')],{'$or':_[_0xfced('0x2c')](_0x5a0d6d[_0xfced('0x3d')],function(_0x1e9038){var _0x30b408={};_0x30b408[_0x1e9038]={'$like':'%'+_0x3e2491[_0xfced('0x3c')][_0xfced('0x46')]+'%'};return _0x30b408;})});}_0x5a0d6d=_[_0xfced('0x47')]({},_0x5a0d6d,_0x3e2491[_0xfced('0x48')]);return db[_0xfced('0x60')]['count']({'where':_0x5a0d6d['where']})['then'](function(_0x1c666c){_0x20868b[_0xfced('0x21')]=_0x1c666c;if(_0x3e2491['query'][_0xfced('0x49')]){_0x5a0d6d[_0xfced('0x4a')]=[{'all':!![]}];}return db[_0xfced('0x60')]['findAll'](_0x5a0d6d);})[_0xfced('0x26')](function(_0x4e8227){_0x20868b['rows']=_0x4e8227;return _0x20868b;});}})[_0xfced('0x26')](respondWithFilteredResult(_0x302cdb,_0x5a0d6d))[_0xfced('0x4d')](handleError(_0x302cdb,null));};exports[_0xfced('0x62')]=function(_0x4af702,_0x98f0a,_0x443f23){var _0x1bb789={'raw':!![],'where':{}};var _0x32f3a7={};var _0x1f4ffc={'count':0x0,'rows':[]};return db[_0xfced('0x35')][_0xfced('0x5f')]({'where':{'id':_0x4af702[_0xfced('0x4f')]['id']}})['then'](handleEntityNotFound(_0x98f0a,null))[_0xfced('0x26')](function(_0x569e48){if(_0x569e48){_0x32f3a7[_0xfced('0x3b')]=_[_0xfced('0x38')](db[_0xfced('0x63')][_0xfced('0x36')]);_0x32f3a7[_0xfced('0x3c')]=_[_0xfced('0x38')](_0x4af702[_0xfced('0x3c')]);_0x32f3a7['filters']=_[_0xfced('0x3a')](_0x32f3a7[_0xfced('0x3b')],_0x32f3a7[_0xfced('0x3c')]);_0x1bb789['attributes']=_[_0xfced('0x3a')](_0x32f3a7['model'],qs[_0xfced('0x3e')](_0x4af702['query'][_0xfced('0x3e')]));_0x1bb789[_0xfced('0x3d')]=_0x1bb789[_0xfced('0x3d')]['length']?_0x1bb789[_0xfced('0x3d')]:_0x32f3a7['model'];if(!_0x4af702['query'][_0xfced('0x40')]('nolimit')){_0x1bb789['limit']=qs[_0xfced('0x20')](_0x4af702[_0xfced('0x3c')][_0xfced('0x20')]);_0x1bb789[_0xfced('0x1e')]=qs[_0xfced('0x1e')](_0x4af702[_0xfced('0x3c')][_0xfced('0x1e')]);}_0x1bb789['order']=qs[_0xfced('0x43')](_0x4af702['query']['sort']);_0x1bb789[_0xfced('0x44')]=qs[_0xfced('0x39')](_[_0xfced('0x45')](_0x4af702['query'],_0x32f3a7[_0xfced('0x39')]));_0x1bb789['where'][_0xfced('0x61')]=_0x569e48['id'];if(_0x4af702['query'][_0xfced('0x46')]){_0x1bb789['where']=_['merge'](_0x1bb789[_0xfced('0x44')],{'$or':_['map'](_0x1bb789[_0xfced('0x3d')],function(_0x40e2a6){var _0x59f32a={};_0x59f32a[_0x40e2a6]={'$like':'%'+_0x4af702[_0xfced('0x3c')]['filter']+'%'};return _0x59f32a;})});}_0x1bb789=_[_0xfced('0x47')]({},_0x1bb789,_0x4af702[_0xfced('0x48')]);return db['CmHopperHistory'][_0xfced('0x21')]({'where':_0x1bb789[_0xfced('0x44')]})['then'](function(_0x167cb2){_0x1f4ffc[_0xfced('0x21')]=_0x167cb2;if(_0x4af702[_0xfced('0x3c')][_0xfced('0x49')]){_0x1bb789['include']=[{'all':!![]}];}return db[_0xfced('0x63')][_0xfced('0x4b')](_0x1bb789);})[_0xfced('0x26')](function(_0x145188){_0x1f4ffc[_0xfced('0x4c')]=_0x145188;return _0x1f4ffc;});}})[_0xfced('0x26')](respondWithFilteredResult(_0x98f0a,_0x1bb789))[_0xfced('0x4d')](handleError(_0x98f0a,null));};exports['getHopperFinals']=function(_0x5c6a6e,_0x1761bc,_0x1af41b){var _0x1a0b3e={'raw':!![],'where':{}};var _0x9ee373={};var _0x3f7744={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5c6a6e[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x1761bc,null))[_0xfced('0x26')](function(_0x3c56c1){if(_0x3c56c1){_0x9ee373['model']=_[_0xfced('0x38')](db[_0xfced('0x64')][_0xfced('0x36')]);_0x9ee373[_0xfced('0x3c')]=_[_0xfced('0x38')](_0x5c6a6e[_0xfced('0x3c')]);_0x9ee373[_0xfced('0x39')]=_[_0xfced('0x3a')](_0x9ee373[_0xfced('0x3b')],_0x9ee373[_0xfced('0x3c')]);_0x1a0b3e[_0xfced('0x3d')]=_['intersection'](_0x9ee373[_0xfced('0x3b')],qs[_0xfced('0x3e')](_0x5c6a6e[_0xfced('0x3c')][_0xfced('0x3e')]));_0x1a0b3e[_0xfced('0x3d')]=_0x1a0b3e[_0xfced('0x3d')][_0xfced('0x3f')]?_0x1a0b3e[_0xfced('0x3d')]:_0x9ee373[_0xfced('0x3b')];if(!_0x5c6a6e[_0xfced('0x3c')]['hasOwnProperty']('nolimit')){_0x1a0b3e['limit']=qs[_0xfced('0x20')](_0x5c6a6e['query'][_0xfced('0x20')]);_0x1a0b3e[_0xfced('0x1e')]=qs[_0xfced('0x1e')](_0x5c6a6e[_0xfced('0x3c')][_0xfced('0x1e')]);}_0x1a0b3e[_0xfced('0x42')]=qs['sort'](_0x5c6a6e[_0xfced('0x3c')][_0xfced('0x43')]);_0x1a0b3e[_0xfced('0x44')]=qs['filters'](_['pick'](_0x5c6a6e[_0xfced('0x3c')],_0x9ee373[_0xfced('0x39')]));_0x1a0b3e[_0xfced('0x44')][_0xfced('0x61')]=_0x3c56c1['id'];if(_0x5c6a6e[_0xfced('0x3c')]['filter']){_0x1a0b3e[_0xfced('0x44')]=_['merge'](_0x1a0b3e[_0xfced('0x44')],{'$or':_['map'](_0x1a0b3e[_0xfced('0x3d')],function(_0x3812ea){var _0x39d185={};_0x39d185[_0x3812ea]={'$like':'%'+_0x5c6a6e[_0xfced('0x3c')][_0xfced('0x46')]+'%'};return _0x39d185;})});}_0x1a0b3e=_[_0xfced('0x47')]({},_0x1a0b3e,_0x5c6a6e[_0xfced('0x48')]);return db[_0xfced('0x64')][_0xfced('0x21')]({'where':_0x1a0b3e[_0xfced('0x44')]})[_0xfced('0x26')](function(_0x3d6c5b){_0x3f7744[_0xfced('0x21')]=_0x3d6c5b;if(_0x5c6a6e['query']['includeAll']){_0x1a0b3e[_0xfced('0x4a')]=[{'all':!![]}];}return db[_0xfced('0x64')][_0xfced('0x4b')](_0x1a0b3e);})[_0xfced('0x26')](function(_0x25f436){_0x3f7744['rows']=_0x25f436;return _0x3f7744;});}})[_0xfced('0x26')](respondWithFilteredResult(_0x1761bc,_0x1a0b3e))[_0xfced('0x4d')](handleError(_0x1761bc,null));};exports['getHopperBlacks']=function(_0x3437df,_0x412a34,_0x3e1f3c){var _0x4b1d6e={'raw':!![],'where':{}};var _0x44c0fe={};var _0x5d4ae5={'count':0x0,'rows':[]};return db[_0xfced('0x35')]['findOne']({'where':{'id':_0x3437df['params']['id']}})['then'](handleEntityNotFound(_0x412a34,null))[_0xfced('0x26')](function(_0x597eaa){if(_0x597eaa){_0x44c0fe['model']=_[_0xfced('0x38')](db[_0xfced('0x65')][_0xfced('0x36')]);_0x44c0fe[_0xfced('0x3c')]=_[_0xfced('0x38')](_0x3437df[_0xfced('0x3c')]);_0x44c0fe['filters']=_[_0xfced('0x3a')](_0x44c0fe[_0xfced('0x3b')],_0x44c0fe[_0xfced('0x3c')]);_0x4b1d6e['attributes']=_[_0xfced('0x3a')](_0x44c0fe[_0xfced('0x3b')],qs[_0xfced('0x3e')](_0x3437df['query'][_0xfced('0x3e')]));_0x4b1d6e['attributes']=_0x4b1d6e[_0xfced('0x3d')][_0xfced('0x3f')]?_0x4b1d6e[_0xfced('0x3d')]:_0x44c0fe['model'];if(!_0x3437df['query'][_0xfced('0x40')](_0xfced('0x41'))){_0x4b1d6e[_0xfced('0x20')]=qs[_0xfced('0x20')](_0x3437df[_0xfced('0x3c')][_0xfced('0x20')]);_0x4b1d6e['offset']=qs[_0xfced('0x1e')](_0x3437df[_0xfced('0x3c')]['offset']);}_0x4b1d6e[_0xfced('0x42')]=qs[_0xfced('0x43')](_0x3437df[_0xfced('0x3c')][_0xfced('0x43')]);_0x4b1d6e[_0xfced('0x44')]=qs['filters'](_[_0xfced('0x45')](_0x3437df[_0xfced('0x3c')],_0x44c0fe[_0xfced('0x39')]));_0x4b1d6e['where'][_0xfced('0x61')]=_0x597eaa['id'];if(_0x3437df[_0xfced('0x3c')][_0xfced('0x46')]){_0x4b1d6e['where']=_['merge'](_0x4b1d6e['where'],{'$or':_['map'](_0x4b1d6e[_0xfced('0x3d')],function(_0x2637cc){var _0x37cccf={};_0x37cccf[_0x2637cc]={'$like':'%'+_0x3437df[_0xfced('0x3c')]['filter']+'%'};return _0x37cccf;})});}_0x4b1d6e=_[_0xfced('0x47')]({},_0x4b1d6e,_0x3437df[_0xfced('0x48')]);return db['CmHopperBlack'][_0xfced('0x21')]({'where':_0x4b1d6e[_0xfced('0x44')]})[_0xfced('0x26')](function(_0x4e529c){_0x5d4ae5[_0xfced('0x21')]=_0x4e529c;if(_0x3437df[_0xfced('0x3c')][_0xfced('0x49')]){_0x4b1d6e[_0xfced('0x4a')]=[{'all':!![]}];}return db[_0xfced('0x65')]['findAll'](_0x4b1d6e);})['then'](function(_0x32b622){_0x5d4ae5[_0xfced('0x4c')]=_0x32b622;return _0x5d4ae5;});}})[_0xfced('0x26')](respondWithFilteredResult(_0x412a34,_0x4b1d6e))[_0xfced('0x4d')](handleError(_0x412a34,null));};exports[_0xfced('0x66')]=function(_0xef3879,_0x2ba891,_0x43f98a){var _0x611a9f={};var _0x5879c7={};var _0x72a40e;var _0x54de38;return db[_0xfced('0x35')][_0xfced('0x5f')]({'where':{'id':_0xef3879['params']['id']}})['then'](handleEntityNotFound(_0x2ba891,null))[_0xfced('0x26')](function(_0x892968){if(_0x892968){_0x72a40e=_0x892968;_0x5879c7['model']=_[_0xfced('0x38')](db['Team'][_0xfced('0x36')]);_0x5879c7['query']=_[_0xfced('0x38')](_0xef3879[_0xfced('0x3c')]);_0x5879c7['filters']=_['intersection'](_0x5879c7[_0xfced('0x3b')],_0x5879c7[_0xfced('0x3c')]);_0x611a9f[_0xfced('0x3d')]=_['intersection'](_0x5879c7[_0xfced('0x3b')],qs[_0xfced('0x3e')](_0xef3879[_0xfced('0x3c')][_0xfced('0x3e')]));_0x611a9f['attributes']=_0x611a9f[_0xfced('0x3d')][_0xfced('0x3f')]?_0x611a9f['attributes']:_0x5879c7[_0xfced('0x3b')];_0x611a9f[_0xfced('0x42')]=qs[_0xfced('0x43')](_0xef3879[_0xfced('0x3c')][_0xfced('0x43')]);_0x611a9f[_0xfced('0x44')]=qs['filters'](_[_0xfced('0x45')](_0xef3879[_0xfced('0x3c')],_0x5879c7['filters']));if(_0xef3879[_0xfced('0x3c')][_0xfced('0x46')]){_0x611a9f[_0xfced('0x44')]=_[_0xfced('0x47')](_0x611a9f[_0xfced('0x44')],{'$or':_[_0xfced('0x2c')](_0x611a9f['attributes'],function(_0x3c2c8b){var _0x55bb5d={};_0x55bb5d[_0x3c2c8b]={'$like':'%'+_0xef3879['query'][_0xfced('0x46')]+'%'};return _0x55bb5d;})});}_0x611a9f=_['merge']({},_0x611a9f,_0xef3879[_0xfced('0x48')]);return _0x72a40e[_0xfced('0x66')](_0x611a9f);}})['then'](function(_0x3bb5e4){if(_0x3bb5e4){_0x54de38=_0x3bb5e4[_0xfced('0x3f')];if(!_0xef3879['query'][_0xfced('0x40')](_0xfced('0x41'))){_0x611a9f[_0xfced('0x20')]=qs['limit'](_0xef3879['query'][_0xfced('0x20')]);_0x611a9f['offset']=qs[_0xfced('0x1e')](_0xef3879[_0xfced('0x3c')][_0xfced('0x1e')]);}return _0x72a40e[_0xfced('0x66')](_0x611a9f);}})['then'](function(_0x46bc5c){if(_0x46bc5c){return _0x46bc5c?{'count':_0x54de38,'rows':_0x46bc5c}:null;}})[_0xfced('0x26')](respondWithResult(_0x2ba891,null))[_0xfced('0x4d')](handleError(_0x2ba891,null));};exports[_0xfced('0x67')]=function(_0x4133af,_0x16aa75,_0x21d7b7){var _0xf0212a=_0x4133af['body'][_0xfced('0x68')];var _0x5a2787=_[_0xfced('0x2c')](_0xf0212a,'id');return db[_0xfced('0x69')][_0xfced('0x4b')]({'where':{'id':_0x5a2787},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfced('0x6a'),'attributes':['id',_0xfced('0x30'),_0xfced('0x6b'),_0xfced('0x6c'),'interface'],'raw':!![]}]})['then'](function(_0x5e5a74){if(_0x5e5a74){var _0x318e7a=_[_0xfced('0x6d')](_0x5e5a74,function(_0xd69e22){var _0x302035=_0xd69e22[_0xfced('0x28')]({'plain':!![]});_0x302035[_0xfced('0x6a')][_0xfced('0x6e')](function(_0x1c631c){_0x1c631c['penalty']=_['find'](_0xf0212a,{'id':_0x302035['id']})[_0xfced('0x6f')];});return _0x302035['Agents'];});return db[_0xfced('0x35')][_0xfced('0x2f')]({'where':{'id':_0x4133af['params']['id']}})[_0xfced('0x26')](function(_0x4aa7a7){return db[_0xfced('0x70')]['transaction'](function(_0x399345){return _0x4aa7a7[_0xfced('0x67')](_0x5a2787,{'transaction':_0x399345})[_0xfced('0x26')](function(){return BPromise[_0xfced('0x71')](_0xf0212a,function(_0x22135d){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x22135d['id'],'VoiceQueueId':_0x4133af[_0xfced('0x4f')]['id'],'penalty':_0x22135d['penalty']},{'transaction':_0x399345});});})[_0xfced('0x26')](function(){return BPromise[_0xfced('0x71')](_0x318e7a,function(_0x30aab4){return db[_0xfced('0x72')][_0xfced('0x73')]({'where':{'UserId':_0x30aab4['id'],'VoiceQueueId':_0x4133af['params']['id']},'defaults':{'penalty':_0x30aab4[_0xfced('0x6f')]},'transaction':_0x399345});});})[_0xfced('0x26')](function(){return BPromise[_0xfced('0x71')](_[_0xfced('0x46')](_0x318e7a,{'online':!![]}),function(_0x36cfd6){return db[_0xfced('0x74')]['upsert']({'membername':_0x36cfd6[_0xfced('0x30')],'UserId':_0x36cfd6['id'],'queue_name':_0x4aa7a7['name'],'VoiceQueueId':_0x4aa7a7['id'],'interface':_[_0xfced('0x75')](_0x36cfd6['interface'])?util['format'](_0xfced('0x76'),_0x36cfd6['name']):_0x36cfd6[_0xfced('0x77')],'paused':_0x36cfd6[_0xfced('0x6c')]||![],'penalty':_0x36cfd6[_0xfced('0x6f')]},{'transaction':_0x399345});});})[_0xfced('0x26')](function(){_0x318e7a[_0xfced('0x6e')](function(_0x2f48d4){socket[_0xfced('0x78')](_0xfced('0x79'),{'UserId':_0x2f48d4['id'],'VoiceQueueId':_0x4aa7a7['id']});});});});});}})['then'](respondWithStatusCode(_0x16aa75,null))[_0xfced('0x4d')](handleError(_0x16aa75,null));};exports[_0xfced('0x7a')]=function(_0x38ce64,_0xcdf30,_0x2f4759){return db['Team']['findAll']({'where':{'id':_0x38ce64['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfced('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xcdf30,null))[_0xfced('0x26')](function(_0x4608f9){var _0x21df1e=_[_0xfced('0x2c')](_0x4608f9,'id');var _0x5d344e=[];var _0x4831ed=[];var _0x443ec3=squel['select']();_0x443ec3[_0xfced('0x7b')](_0xfced('0x7c'))[_0xfced('0x7d')]('team_has_voice_queues','tq')[_0xfced('0x7e')](_0xfced('0x7f'),'ut',_0xfced('0x80'))[_0xfced('0x44')](_0xfced('0x81'),_0x38ce64['params']['id']);for(var _0x55ffe9=0x0;_0x55ffe9<_0x4608f9[_0xfced('0x3f')];_0x55ffe9+=0x1){let _0x3fcb6f=_0x4608f9[_0x55ffe9];for(var _0x233f15=0x0;_0x233f15<_0x3fcb6f[_0xfced('0x6a')][_0xfced('0x3f')];_0x233f15+=0x1){let _0x10f2a4=_0x3fcb6f[_0xfced('0x6a')][_0x233f15];var _0x48f209=_0x443ec3[_0xfced('0x5a')]();_0x48f209[_0xfced('0x44')]('ut.UserId\x20=\x20?',_0x10f2a4['id']);_0x4831ed['push'](db[_0xfced('0x70')][_0xfced('0x3c')](_0x48f209[_0xfced('0x82')](),{'type':db['sequelize'][_0xfced('0x83')][_0xfced('0x84')]})[_0xfced('0x26')](function(_0xbf7a1b){if(_0xbf7a1b[_0xfced('0x3f')]===0x1){return _0x10f2a4['id'];}else{var _0x299d3b=_[_0xfced('0x85')](_[_0xfced('0x2c')](_0xbf7a1b,_0xfced('0x86')),function(_0x220413){return _[_0xfced('0x87')](_0x21df1e,_0x220413);});if(_0x299d3b){return _0x10f2a4['id'];}}}));}}return BPromise[_0xfced('0x88')](_0x4831ed)[_0xfced('0x26')](function(_0x2d2a61){_0x5d344e=_(_0x5d344e)[_0xfced('0x89')](_0x2d2a61)['compact']()['value']();return db['VoiceQueue'][_0xfced('0x2f')]({'where':{'id':_0x38ce64['params']['id']}})[_0xfced('0x26')](function(_0x4def54){return db['sequelize'][_0xfced('0x8a')](function(_0x23aa77){return _0x4def54[_0xfced('0x7a')](_0x38ce64['query'][_0xfced('0x8b')],{'transaction':_0x23aa77})[_0xfced('0x26')](function(){if(!_['isEmpty'](_0x5d344e)){return _0x4def54[_0xfced('0x8c')](_0x5d344e,{'transaction':_0x23aa77})[_0xfced('0x26')](function(){return db[_0xfced('0x74')]['destroy']({'where':{'VoiceQueueId':_0x38ce64[_0xfced('0x4f')]['id'],'UserId':_0x5d344e},'transaction':_0x23aa77});});}})[_0xfced('0x26')](function(){_0x5d344e[_0xfced('0x6e')](function(_0x38691f){socket['emit']('userVoiceQueue:remove',{'UserId':_0x38691f,'VoiceQueueId':_0x4def54['id']});});});});});});})[_0xfced('0x26')](respondWithStatusCode(_0xcdf30,null))[_0xfced('0x4d')](handleError(_0xcdf30,null));};exports[_0xfced('0x8d')]=function(_0x1e7e75,_0x3023e6,_0x1b3ab6){var _0x57d7b0,_0x1f8552;return db[_0xfced('0x35')][_0xfced('0x2f')]({'where':{'id':_0x1e7e75[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x3023e6,null))[_0xfced('0x26')](function(_0x4c4e34){if(_0x4c4e34){_0x1f8552=_0x4c4e34;return _0x4c4e34[_0xfced('0x8d')](_0x1e7e75[_0xfced('0x51')][_0xfced('0x8b')],_['omit'](_0x1e7e75[_0xfced('0x51')],[_0xfced('0x8b'),'id'])||{})[_0xfced('0x8e')](function(_0x60232){for(var _0xc7b278=0x0;_0xc7b278<_0x1e7e75[_0xfced('0x51')][_0xfced('0x8b')]['length'];_0xc7b278+=0x1){socket[_0xfced('0x78')](_0xfced('0x79'),{'UserId':Number(_0x1e7e75[_0xfced('0x51')][_0xfced('0x8b')][_0xc7b278]),'VoiceQueueId':Number(_0x1e7e75['params']['id'])});}return _0x60232;});}})[_0xfced('0x26')](function(_0x235b70){_0x57d7b0=_0x235b70||[];if(_0x1f8552){return db[_0xfced('0x8f')][_0xfced('0x4b')]({'where':{'id':_0x1e7e75[_0xfced('0x51')][_0xfced('0x8b')]},'attributes':['id','name',_0xfced('0x6b'),_0xfced('0x6c'),_0xfced('0x77')],'raw':!![]});}})['then'](function(_0x2c1b67){if(!_[_0xfced('0x90')](_0x2c1b67)){var _0x3a063a=[];for(var _0x3b08d6=0x0;_0x3b08d6<_0x2c1b67[_0xfced('0x3f')];_0x3b08d6++){if(_0x2c1b67[_0x3b08d6]['online']){_0x3a063a['push'](db[_0xfced('0x74')][_0xfced('0x91')]({'membername':_0x2c1b67[_0x3b08d6][_0xfced('0x30')],'UserId':_0x2c1b67[_0x3b08d6]['id'],'queue_name':_0x1f8552[_0xfced('0x30')],'VoiceQueueId':_0x1f8552['id'],'interface':_[_0xfced('0x75')](_0x2c1b67[_0x3b08d6][_0xfced('0x77')])?util['format']('SIP/%s',_0x2c1b67[_0x3b08d6][_0xfced('0x30')]):_0x2c1b67[_0x3b08d6]['interface'],'paused':_0x2c1b67[_0x3b08d6]['voicePause']||![],'penalty':_0x1e7e75[_0xfced('0x51')]['penalty']||0x0}));}}return BPromise[_0xfced('0x88')](_0x3a063a);}})['then'](function(){return _0x57d7b0;})[_0xfced('0x26')](respondWithResult(_0x3023e6,null))['catch'](handleError(_0x3023e6,null));};exports['removeAgents']=function(_0x1f91bc,_0x5731bb,_0xc1a885){return db['VoiceQueue']['find']({'where':{'id':_0x1f91bc['params']['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x5731bb,null))[_0xfced('0x26')](function(_0x265316){if(_0x265316){return _0x265316[_0xfced('0x8c')](_0x1f91bc[_0xfced('0x3c')][_0xfced('0x8b')])[_0xfced('0x26')](function(){if(_[_0xfced('0x92')](_0x1f91bc[_0xfced('0x3c')][_0xfced('0x8b')])){for(var _0x7d7965=0x0;_0x7d7965<_0x1f91bc['query']['ids'][_0xfced('0x3f')];_0x7d7965+=0x1){socket[_0xfced('0x78')]('userVoiceQueue:remove',{'UserId':Number(_0x1f91bc[_0xfced('0x3c')][_0xfced('0x8b')][_0x7d7965]),'VoiceQueueId':Number(_0x1f91bc[_0xfced('0x4f')]['id'])});}}else{socket[_0xfced('0x78')]('userVoiceQueue:remove',{'UserId':Number(_0x1f91bc[_0xfced('0x3c')]['ids']),'VoiceQueueId':Number(_0x1f91bc[_0xfced('0x4f')]['id'])});}});}})['then'](function(_0x4725ea){return db[_0xfced('0x74')][_0xfced('0x27')]({'where':{'VoiceQueueId':_0x1f91bc['params']['id'],'UserId':_0x1f91bc['query'][_0xfced('0x8b')]}})[_0xfced('0x26')](function(){return _0x4725ea;});})['then'](respondWithStatusCode(_0x5731bb,null))[_0xfced('0x4d')](handleError(_0x5731bb,null));};exports[_0xfced('0x93')]=function(_0x1cdebc,_0x9e47fe,_0x22ee6e){var _0x3845d3={};var _0xe9e6fc={};var _0x599b5c;var _0x3f6f21;return db[_0xfced('0x35')][_0xfced('0x5f')]({'where':{'id':_0x1cdebc[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x9e47fe,null))['then'](function(_0x76227a){if(_0x76227a){_0x599b5c=_0x76227a;_0xe9e6fc[_0xfced('0x3b')]=_[_0xfced('0x38')](db[_0xfced('0x8f')][_0xfced('0x36')]);_0xe9e6fc[_0xfced('0x3c')]=_[_0xfced('0x38')](_0x1cdebc[_0xfced('0x3c')]);_0xe9e6fc[_0xfced('0x39')]=_['intersection'](_0xe9e6fc[_0xfced('0x3b')],_0xe9e6fc['query']);_0x3845d3[_0xfced('0x3d')]=_[_0xfced('0x3a')](_0xe9e6fc[_0xfced('0x3b')],qs[_0xfced('0x3e')](_0x1cdebc[_0xfced('0x3c')][_0xfced('0x3e')]));_0x3845d3[_0xfced('0x3d')]=_0x3845d3[_0xfced('0x3d')]['length']?_0x3845d3[_0xfced('0x3d')]:_0xe9e6fc[_0xfced('0x3b')];_0x3845d3[_0xfced('0x42')]=qs['sort'](_0x1cdebc['query'][_0xfced('0x43')]);_0x3845d3[_0xfced('0x44')]=qs[_0xfced('0x39')](_[_0xfced('0x45')](_0x1cdebc[_0xfced('0x3c')],_0xe9e6fc['filters']));if(_0x1cdebc[_0xfced('0x3c')][_0xfced('0x46')]){_0x3845d3[_0xfced('0x44')]=_[_0xfced('0x47')](_0x3845d3[_0xfced('0x44')],{'$or':_[_0xfced('0x2c')](_0x3845d3[_0xfced('0x3d')],function(_0x405864){var _0x326498={};_0x326498[_0x405864]={'$like':'%'+_0x1cdebc[_0xfced('0x3c')]['filter']+'%'};return _0x326498;})});}_0x3845d3=_['merge']({},_0x3845d3,_0x1cdebc[_0xfced('0x48')]);return _0x599b5c[_0xfced('0x93')](_0x3845d3);}})[_0xfced('0x26')](function(_0xf8963c){if(_0xf8963c){_0x3f6f21=_0xf8963c[_0xfced('0x3f')];if(!_0x1cdebc[_0xfced('0x3c')]['hasOwnProperty'](_0xfced('0x41'))){_0x3845d3[_0xfced('0x20')]=qs[_0xfced('0x20')](_0x1cdebc[_0xfced('0x3c')][_0xfced('0x20')]);_0x3845d3[_0xfced('0x1e')]=qs[_0xfced('0x1e')](_0x1cdebc['query'][_0xfced('0x1e')]);}return _0x599b5c[_0xfced('0x93')](_0x3845d3);}})[_0xfced('0x26')](function(_0x2be67f){if(_0x2be67f){return _0x2be67f?{'count':_0x3f6f21,'rows':_0x2be67f}:null;}})['then'](respondWithResult(_0x9e47fe,null))[_0xfced('0x4d')](handleError(_0x9e47fe,null));};exports[_0xfced('0x94')]=function(_0x53de26,_0x147a56,_0x3a0e85){var _0x13364d={};var _0x4d7d4f={};var _0x1f32b6;var _0x67cf9a;return db[_0xfced('0x35')][_0xfced('0x5f')]({'where':{'id':_0x53de26['params']['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x147a56,null))[_0xfced('0x26')](function(_0x2f46e6){if(_0x2f46e6){_0x1f32b6=_0x2f46e6;_0x4d7d4f[_0xfced('0x3b')]=_[_0xfced('0x38')](db[_0xfced('0x74')]['rawAttributes']);_0x4d7d4f['query']=_['keys'](_0x53de26[_0xfced('0x3c')]);_0x4d7d4f['filters']=_[_0xfced('0x3a')](_0x4d7d4f[_0xfced('0x3b')],_0x4d7d4f[_0xfced('0x3c')]);_0x13364d[_0xfced('0x3d')]=_[_0xfced('0x3a')](_0x4d7d4f['model'],qs[_0xfced('0x3e')](_0x53de26[_0xfced('0x3c')][_0xfced('0x3e')]));_0x13364d[_0xfced('0x3d')]=_0x13364d[_0xfced('0x3d')][_0xfced('0x3f')]?_0x13364d[_0xfced('0x3d')]:_0x4d7d4f['model'];_0x13364d['order']=qs[_0xfced('0x43')](_0x53de26['query'][_0xfced('0x43')]);_0x13364d[_0xfced('0x44')]=qs[_0xfced('0x39')](_[_0xfced('0x45')](_0x53de26[_0xfced('0x3c')],_0x4d7d4f['filters']));if(_0x53de26[_0xfced('0x3c')][_0xfced('0x46')]){_0x13364d[_0xfced('0x44')]=_[_0xfced('0x47')](_0x13364d[_0xfced('0x44')],{'$or':_[_0xfced('0x2c')](_0x13364d[_0xfced('0x3d')],function(_0x4e25ee){var _0x779186={};_0x779186[_0x4e25ee]={'$like':'%'+_0x53de26[_0xfced('0x3c')]['filter']+'%'};return _0x779186;})});}_0x13364d=_['merge']({},_0x13364d,_0x53de26['options']);return _0x1f32b6[_0xfced('0x94')](_0x13364d);}})[_0xfced('0x26')](function(_0x381ce6){if(_0x381ce6){_0x67cf9a=_0x381ce6[_0xfced('0x3f')];if(!_0x53de26[_0xfced('0x3c')]['hasOwnProperty']('nolimit')){_0x13364d[_0xfced('0x20')]=qs['limit'](_0x53de26['query'][_0xfced('0x20')]);_0x13364d['offset']=qs[_0xfced('0x1e')](_0x53de26[_0xfced('0x3c')][_0xfced('0x1e')]);}return _0x1f32b6[_0xfced('0x94')](_0x13364d);}})['then'](function(_0x5a5d2f){return _0x5a5d2f?{'count':_0x67cf9a,'rows':_0x5a5d2f}:null;})[_0xfced('0x26')](respondWithResult(_0x147a56,null))[_0xfced('0x4d')](handleError(_0x147a56,null));};exports[_0xfced('0x95')]=function(_0x41d616,_0x5e33e1,_0x5c197c){var _0x4e6a2c={};var _0x115d46={};var _0x24eb84;var _0x4698e7;return db[_0xfced('0x35')][_0xfced('0x5f')]({'where':{'id':_0x41d616['params']['id']}})['then'](handleEntityNotFound(_0x5e33e1,null))[_0xfced('0x26')](function(_0x5aa831){if(_0x5aa831){_0x24eb84=_0x5aa831;_0x115d46[_0xfced('0x3b')]=_[_0xfced('0x38')](db[_0xfced('0x96')][_0xfced('0x36')]);_0x115d46[_0xfced('0x3c')]=_[_0xfced('0x38')](_0x41d616[_0xfced('0x3c')]);_0x115d46[_0xfced('0x39')]=_['intersection'](_0x115d46[_0xfced('0x3b')],_0x115d46[_0xfced('0x3c')]);_0x4e6a2c[_0xfced('0x3d')]=_[_0xfced('0x3a')](_0x115d46[_0xfced('0x3b')],qs[_0xfced('0x3e')](_0x41d616[_0xfced('0x3c')][_0xfced('0x3e')]));_0x4e6a2c[_0xfced('0x3d')]=_0x4e6a2c[_0xfced('0x3d')][_0xfced('0x3f')]?_0x4e6a2c[_0xfced('0x3d')]:_0x115d46['model'];_0x4e6a2c[_0xfced('0x42')]=qs[_0xfced('0x43')](_0x41d616[_0xfced('0x3c')][_0xfced('0x43')]);_0x4e6a2c[_0xfced('0x44')]=qs[_0xfced('0x39')](_['pick'](_0x41d616[_0xfced('0x3c')],_0x115d46[_0xfced('0x39')]));if(_0x41d616[_0xfced('0x3c')][_0xfced('0x46')]){_0x4e6a2c['where']=_['merge'](_0x4e6a2c[_0xfced('0x44')],{'$or':_[_0xfced('0x2c')](_0x4e6a2c[_0xfced('0x3d')],function(_0x2e2b30){var _0x3d3900={};_0x3d3900[_0x2e2b30]={'$like':'%'+_0x41d616['query'][_0xfced('0x46')]+'%'};return _0x3d3900;})});}_0x4e6a2c=_[_0xfced('0x47')]({},_0x4e6a2c,_0x41d616[_0xfced('0x48')]);return _0x24eb84[_0xfced('0x95')](_0x4e6a2c);}})[_0xfced('0x26')](function(_0x45d2c4){if(_0x45d2c4){_0x4698e7=_0x45d2c4[_0xfced('0x3f')];if(!_0x41d616[_0xfced('0x3c')]['hasOwnProperty'](_0xfced('0x41'))){_0x4e6a2c['limit']=qs[_0xfced('0x20')](_0x41d616[_0xfced('0x3c')][_0xfced('0x20')]);_0x4e6a2c[_0xfced('0x1e')]=qs['offset'](_0x41d616['query'][_0xfced('0x1e')]);}return _0x24eb84[_0xfced('0x95')](_0x4e6a2c);}})[_0xfced('0x26')](function(_0x48d529){if(_0x48d529){return _0x48d529?{'count':_0x4698e7,'rows':_0x48d529}:null;}})[_0xfced('0x26')](respondWithResult(_0x5e33e1,null))[_0xfced('0x4d')](handleError(_0x5e33e1,null));};exports['addLists']=function(_0x44bae0,_0x30d71d,_0x6abd63){var _0xccda05=moment()['format'](_0xfced('0x97'));var _0x217359,_0x5a401e;return db[_0xfced('0x35')][_0xfced('0x2f')]({'where':{'id':_0x44bae0['params']['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x30d71d,null))[_0xfced('0x26')](function(_0x5e3875){if(_0x5e3875){_0x5a401e=_0x5e3875;return _0x5e3875[_0xfced('0x98')](_0x44bae0['body']['ids'],_[_0xfced('0x5b')](_0x44bae0[_0xfced('0x51')],[_0xfced('0x8b'),'id'])||{});}return null;})['spread'](function(_0x5ca414){var _0x162fb3;_0x217359=_0x5ca414||[];var _0x5c3622=[];if(_0x5ca414){for(var _0x221677=0x0;_0x221677<_0x5ca414[_0xfced('0x3f')];_0x221677+=0x1){var _0x47bcf5=_0x5ca414[_0x221677][_0xfced('0x28')]({'plain':!![]});_0x5a401e['dialCheckDuplicateType']=_0x44bae0[_0xfced('0x51')][_0xfced('0x99')]?_0x44bae0[_0xfced('0x51')]['dialCheckDuplicateType']:_0x5a401e[_0xfced('0x99')];switch(_0x5a401e[_0xfced('0x99')]){case _0xfced('0x9a'):_0x162fb3=squel['insert']()[_0xfced('0x9b')](_0xfced('0x9c'))[_0xfced('0x9d')]([_0xfced('0x9e'),_0xfced('0x9f'),'ContactId',_0xfced('0xa0'),'VoiceQueueId',_0xfced('0x5c'),_0xfced('0xa1')],squel[_0xfced('0xa2')]()[_0xfced('0x7b')]('phone',_0xfced('0x9e'))[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27','scheduledAt')['field']('id',_0xfced('0xa3'))[_0xfced('0x7b')](_0x47bcf5[_0xfced('0xa4')][_0xfced('0x82')](),_0xfced('0xa0'))[_0xfced('0x7b')](_0x44bae0[_0xfced('0x4f')]['id'][_0xfced('0x82')](),'VoiceQueueId')[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27',_0xfced('0x5c'))[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27','updatedAt')[_0xfced('0x7d')](_0xfced('0xa5'))['where'](_0xfced('0xa6'))[_0xfced('0x44')](_0xfced('0xa7'),_0x47bcf5[_0xfced('0xa4')][_0xfced('0x82')]())['where'](_0xfced('0xa8'))[_0xfced('0x44')](_0xfced('0xa9'),squel['select']()[_0xfced('0x7b')]('COALESCE(calleridnum,\x27\x27)')[_0xfced('0x7d')]('cm_hopper_final')[_0xfced('0x44')](_0xfced('0x81'),_0x44bae0[_0xfced('0x4f')]['id']['toString']()))[_0xfced('0x44')](_0xfced('0xa9'),squel[_0xfced('0xa2')]()['field'](_0xfced('0xaa'))[_0xfced('0x7d')](_0xfced('0x9c'))[_0xfced('0x44')](_0xfced('0x81'),_0x44bae0['params']['id'][_0xfced('0x82')]())))[_0xfced('0x82')]();break;case _0xfced('0xab'):_0x162fb3=squel[_0xfced('0xac')]()['into']('cm_hopper')[_0xfced('0x9d')]([_0xfced('0x9e'),'scheduledAt',_0xfced('0xa3'),'ListId','VoiceQueueId',_0xfced('0x5c'),_0xfced('0xa1')],squel['select']()[_0xfced('0x7b')](_0xfced('0x9e'),'phone')[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27',_0xfced('0x9f'))[_0xfced('0x7b')]('id',_0xfced('0xa3'))['field'](_0x47bcf5[_0xfced('0xa4')][_0xfced('0x82')](),'ListId')[_0xfced('0x7b')](_0x44bae0[_0xfced('0x4f')]['id'][_0xfced('0x82')](),_0xfced('0x61'))['field']('\x27'+_0xccda05+'\x27',_0xfced('0x5c'))[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27','updatedAt')[_0xfced('0x7d')]('cm_contacts')[_0xfced('0x44')](_0xfced('0xa6'))['where']('ListId\x20=\x20?',_0x47bcf5[_0xfced('0xa4')][_0xfced('0x82')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xfced('0x44')](_0xfced('0xa9'),squel['select']()[_0xfced('0x7b')]('COALESCE(phone,\x27\x27)')['from'](_0xfced('0x9c'))[_0xfced('0x44')](_0xfced('0x81'),_0x44bae0[_0xfced('0x4f')]['id']['toString']())))['toString']();break;default:_0x162fb3=squel[_0xfced('0xac')]()[_0xfced('0x9b')](_0xfced('0x9c'))[_0xfced('0x9d')]([_0xfced('0x9e'),_0xfced('0x9f'),_0xfced('0xa3'),_0xfced('0xa0'),_0xfced('0x61'),_0xfced('0x5c'),_0xfced('0xa1')],squel[_0xfced('0xa2')]()['field'](_0xfced('0x9e'),_0xfced('0x9e'))[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27',_0xfced('0x9f'))[_0xfced('0x7b')]('id',_0xfced('0xa3'))['field'](_0x47bcf5[_0xfced('0xa4')]['toString'](),'ListId')[_0xfced('0x7b')](_0x44bae0['params']['id'][_0xfced('0x82')](),_0xfced('0x61'))[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27','createdAt')['field']('\x27'+_0xccda05+'\x27','updatedAt')[_0xfced('0x7d')]('cm_contacts')[_0xfced('0x44')](_0xfced('0xa6'))[_0xfced('0x44')](_0xfced('0xa7'),_0x47bcf5[_0xfced('0xa4')][_0xfced('0x82')]())[_0xfced('0x44')](_0xfced('0xa8')))['toString']();}_0x5c3622[_0xfced('0xad')](db[_0xfced('0x70')]['query'](_0x162fb3));}return BPromise[_0xfced('0x88')](_0x5c3622);}})[_0xfced('0x26')](function(){var _0x4754d4=[];var _0x408ac0=squel[_0xfced('0xac')]()[_0xfced('0x9b')]('cm_hopper_additional_phones')[_0xfced('0x9d')]([_0xfced('0xae'),'phone',_0xfced('0xaf'),_0xfced('0x5c'),_0xfced('0xa1')],squel['select']()[_0xfced('0x7b')](_0xfced('0xb0'))[_0xfced('0x7b')]('ci.item')['field'](_0xfced('0xb1'))[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27',_0xfced('0x5c'))[_0xfced('0x7b')]('\x27'+_0xccda05+'\x27',_0xfced('0xa1'))['from']('cm_contact_has_items','ci')[_0xfced('0x7e')](_0xfced('0x9c'),'h',_0xfced('0xb2'))['where'](_0xfced('0xb3'),_0xccda05)[_0xfced('0x44')](_0xfced('0xb4'),_0xfced('0xb5')))[_0xfced('0x82')]();_0x4754d4['push'](db[_0xfced('0x70')][_0xfced('0x3c')](_0x408ac0));return BPromise[_0xfced('0x88')](_0x4754d4);})[_0xfced('0x26')](function(){return _0x217359;})[_0xfced('0x26')](respondWithResult(_0x30d71d,null))['catch'](handleError(_0x30d71d,null));};exports['removeLists']=function(_0x5af6cb,_0x5e7acc,_0x1fbe64){return db[_0xfced('0x35')][_0xfced('0x2f')]({'where':{'id':_0x5af6cb[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x5e7acc,null))[_0xfced('0x26')](function(_0xa2fb86){if(_0xa2fb86){return _0xa2fb86[_0xfced('0xb6')](_0x5af6cb[_0xfced('0x3c')][_0xfced('0x8b')]);}})[_0xfced('0x26')](function(_0x116574){if(_0x116574){return db['CmHopper'][_0xfced('0x27')]({'where':{'ListId':_0x5af6cb[_0xfced('0x3c')]['ids'],'VoiceQueueId':_0x5af6cb[_0xfced('0x4f')]['id']}})['then'](function(){return _0x116574;});}})[_0xfced('0x26')](respondWithStatusCode(_0x5e7acc,null))[_0xfced('0x4d')](handleError(_0x5e7acc,null));};exports[_0xfced('0xb7')]=function(_0x449952,_0x2586d8,_0x371a36){var _0x1efaec={};var _0x47a3be={};var _0x4fc613;var _0x4f974a;return db[_0xfced('0x35')][_0xfced('0x5f')]({'where':{'id':_0x449952[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x2586d8,null))[_0xfced('0x26')](function(_0x34a320){if(_0x34a320){_0x4fc613=_0x34a320;_0x47a3be['model']=_[_0xfced('0x38')](db['CmList']['rawAttributes']);_0x47a3be[_0xfced('0x3c')]=_[_0xfced('0x38')](_0x449952['query']);_0x47a3be[_0xfced('0x39')]=_[_0xfced('0x3a')](_0x47a3be[_0xfced('0x3b')],_0x47a3be[_0xfced('0x3c')]);_0x1efaec['attributes']=_[_0xfced('0x3a')](_0x47a3be[_0xfced('0x3b')],qs['fields'](_0x449952[_0xfced('0x3c')][_0xfced('0x3e')]));_0x1efaec['attributes']=_0x1efaec[_0xfced('0x3d')][_0xfced('0x3f')]?_0x1efaec['attributes']:_0x47a3be[_0xfced('0x3b')];_0x1efaec['order']=qs[_0xfced('0x43')](_0x449952[_0xfced('0x3c')]['sort']);_0x1efaec[_0xfced('0x44')]=qs[_0xfced('0x39')](_['pick'](_0x449952[_0xfced('0x3c')],_0x47a3be[_0xfced('0x39')]));if(_0x449952[_0xfced('0x3c')][_0xfced('0x46')]){_0x1efaec[_0xfced('0x44')]=_[_0xfced('0x47')](_0x1efaec[_0xfced('0x44')],{'$or':_[_0xfced('0x2c')](_0x1efaec[_0xfced('0x3d')],function(_0x5db59e){var _0x2837af={};_0x2837af[_0x5db59e]={'$like':'%'+_0x449952[_0xfced('0x3c')]['filter']+'%'};return _0x2837af;})});}_0x1efaec=_[_0xfced('0x47')]({},_0x1efaec,_0x449952[_0xfced('0x48')]);return _0x4fc613['getBlackLists'](_0x1efaec);}})[_0xfced('0x26')](function(_0x27178b){if(_0x27178b){_0x4f974a=_0x27178b[_0xfced('0x3f')];if(!_0x449952[_0xfced('0x3c')]['hasOwnProperty'](_0xfced('0x41'))){_0x1efaec[_0xfced('0x20')]=qs[_0xfced('0x20')](_0x449952[_0xfced('0x3c')][_0xfced('0x20')]);_0x1efaec[_0xfced('0x1e')]=qs['offset'](_0x449952['query']['offset']);}return _0x4fc613['getBlackLists'](_0x1efaec);}})['then'](function(_0x240d25){if(_0x240d25){return _0x240d25?{'count':_0x4f974a,'rows':_0x240d25}:null;}})['then'](respondWithResult(_0x2586d8,null))[_0xfced('0x4d')](handleError(_0x2586d8,null));};exports[_0xfced('0xb8')]=function(_0x4a6270,_0x58b4e5,_0x34cb3e){var _0x7516d4,_0x221e7b;return db[_0xfced('0x35')][_0xfced('0x2f')]({'where':{'id':_0x4a6270[_0xfced('0x4f')]['id']}})['then'](handleEntityNotFound(_0x58b4e5,null))['then'](function(_0x1cf072){if(_0x1cf072){_0x221e7b=_0x1cf072;return _0x1cf072[_0xfced('0xb8')](_0x4a6270[_0xfced('0x51')][_0xfced('0x8b')],_['omit'](_0x4a6270[_0xfced('0x51')],[_0xfced('0x8b'),'id'])||{});}return null;})['spread'](function(_0x17884a){var _0xa3c0eb;_0x7516d4=_0x17884a||[];var _0x17671b=[];if(_0x17884a){for(var _0x3e76d7=0x0;_0x3e76d7<_0x17884a['length'];_0x3e76d7+=0x1){var _0x5caeb7=_0x17884a[_0x3e76d7]['get']({'plain':!![]});_0xa3c0eb=squel[_0xfced('0xac')]()[_0xfced('0x9b')](_0xfced('0xb9'))[_0xfced('0x9d')]([_0xfced('0x9e'),_0xfced('0xa3'),'ListId',_0xfced('0x61'),_0xfced('0x5c'),_0xfced('0xa1')],squel[_0xfced('0xa2')]()[_0xfced('0x7b')](_0xfced('0x9e'),_0xfced('0x9e'))[_0xfced('0x7b')]('id',_0xfced('0xa3'))[_0xfced('0x7b')](_0x5caeb7[_0xfced('0xa4')][_0xfced('0x82')](),_0xfced('0xa0'))['field'](_0x4a6270[_0xfced('0x4f')]['id'][_0xfced('0x82')](),'VoiceQueueId')['field'](_0xfced('0xba'),'createdAt')[_0xfced('0x7b')]('NOW()',_0xfced('0xa1'))[_0xfced('0x7d')](_0xfced('0xa5'))['where'](_0xfced('0xa6'))[_0xfced('0x44')]('ListId\x20=\x20?',_0x5caeb7[_0xfced('0xa4')][_0xfced('0x82')]())[_0xfced('0x44')](_0xfced('0xa8')))[_0xfced('0x82')]();_0x17671b[_0xfced('0xad')](db[_0xfced('0x70')][_0xfced('0x3c')](_0xa3c0eb));}return BPromise[_0xfced('0x88')](_0x17671b);}})[_0xfced('0x26')](function(){return _0x7516d4;})[_0xfced('0x26')](respondWithResult(_0x58b4e5,null))[_0xfced('0x4d')](handleError(_0x58b4e5,null));};exports['removeBlackLists']=function(_0x48906e,_0x261513,_0x28b616){return db[_0xfced('0x35')]['find']({'where':{'id':_0x48906e[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](handleEntityNotFound(_0x261513,null))[_0xfced('0x26')](function(_0x17970c){if(_0x17970c){return _0x17970c[_0xfced('0xbb')](_0x48906e[_0xfced('0x3c')][_0xfced('0x8b')]);}})[_0xfced('0x26')](function(_0x8aa1e0){if(_0x8aa1e0){return db[_0xfced('0x65')][_0xfced('0x27')]({'where':{'ListId':_0x48906e[_0xfced('0x3c')]['ids'],'VoiceQueueId':_0x48906e[_0xfced('0x4f')]['id']}})[_0xfced('0x26')](function(){return _0x8aa1e0;});}})[_0xfced('0x26')](respondWithStatusCode(_0x261513,null))[_0xfced('0x4d')](handleError(_0x261513,null));}; \ No newline at end of file +var _0xfcf0=['options','VoiceQueue','includeAll','findAll','catch','show','params','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','value','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','body','userProfileId','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','VoiceQueueId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','pick','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','online','interface','flatMap','penalty','sequelize','each','upsert','findOrCreate','isNil','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','TeamId','union','compact','transaction','isEmpty','removeAgents','UserVoiceQueueRt','emit','addAgents','spread','User','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','from','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','cm_contact_has_items','join','ci.ItemClass=?','removeLists','CmList','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','ignore','includes','find','type','name','UserProfileResource','sendStatus','error','stack','send','index','rawAttributes','key','model','query','keys','intersection','fields','attributes','order','sort','where','filters','merge','map','VIRTUAL'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0xfcf0[_0x2605dc];return _0x4568c9;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];config[_0x0fcf('0x18')]=_['defaults'](config[_0x0fcf('0x18')],{'host':_0x0fcf('0x19'),'port':0x18eb});var socket=require(_0x0fcf('0x1a'))(new Redis(config[_0x0fcf('0x18')]));require(_0x0fcf('0x1b'))['register'](socket);function respondWithStatusCode(_0xa32692,_0x3701c9){_0x3701c9=_0x3701c9||0xcc;return function(_0x1fcb47){if(_0x1fcb47){return _0xa32692['sendStatus'](_0x3701c9);}return _0xa32692[_0x0fcf('0x1c')](_0x3701c9)[_0x0fcf('0x1d')]();};}function respondWithResult(_0x445207,_0x177c8f){_0x177c8f=_0x177c8f||0xc8;return function(_0x48dd53){if(_0x48dd53){return _0x445207[_0x0fcf('0x1c')](_0x177c8f)[_0x0fcf('0x1e')](_0x48dd53);}};}function respondWithFilteredResult(_0x1a8477,_0x8581bd){return function(_0x19cfbd){if(_0x19cfbd){var _0x567320=typeof _0x8581bd[_0x0fcf('0x1f')]===_0x0fcf('0x20')&&typeof _0x8581bd['limit']===_0x0fcf('0x20');var _0x1b9a90=_0x19cfbd['count'];var _0x2022e1=_0x567320?0x0:_0x8581bd['offset'];var _0x3fc9e6=_0x567320?_0x19cfbd[_0x0fcf('0x21')]:_0x8581bd['offset']+_0x8581bd[_0x0fcf('0x22')];var _0x3f28d0;if(_0x3fc9e6>=_0x1b9a90){_0x3fc9e6=_0x1b9a90;_0x3f28d0=0xc8;}else{_0x3f28d0=0xce;}_0x1a8477[_0x0fcf('0x1c')](_0x3f28d0);return _0x1a8477['set'](_0x0fcf('0x23'),_0x2022e1+'-'+_0x3fc9e6+'/'+_0x1b9a90)[_0x0fcf('0x1e')](_0x19cfbd);}return null;};}function patchUpdates(_0x196d30){return function(_0x41b20b){try{jsonpatch[_0x0fcf('0x24')](_0x41b20b,_0x196d30,!![]);}catch(_0x30e1b0){return BPromise['reject'](_0x30e1b0);}return _0x41b20b[_0x0fcf('0x25')]();};}function saveUpdates(_0x253641,_0x6021b4){return function(_0xd6f8b5){if(_0xd6f8b5){return _0xd6f8b5[_0x0fcf('0x26')](_0x253641)[_0x0fcf('0x27')](function(_0x2ce990){return _0x2ce990;});}return null;};}function removeEntity(_0x18f269,_0x117510){return function(_0x588685){if(_0x588685){return _0x588685[_0x0fcf('0x28')]()[_0x0fcf('0x27')](function(){var _0x41b7a2=_0x588685[_0x0fcf('0x29')]({'plain':!![]});var _0x3876ed=[{'name':_0x0fcf('0x2a'),'value':_0x0fcf('0x2b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x0fcf('0x2c'),'ignore':![]}];var _0xbaa4d8=_(_0x3876ed)[_0x0fcf('0x2d')](_0x0fcf('0x2e'))['map']('value')['value']();if(_[_0x0fcf('0x2f')](_0xbaa4d8,_0x41b7a2['type'])){return;}var _0x26c3bc=_[_0x0fcf('0x30')](_0x3876ed,['value',_0x41b7a2[_0x0fcf('0x31')]])[_0x0fcf('0x32')];return db[_0x0fcf('0x33')][_0x0fcf('0x28')]({'where':{'type':_0x26c3bc,'resourceId':_0x41b7a2['id']}})[_0x0fcf('0x27')](function(){return _0x588685;});})[_0x0fcf('0x27')](function(){_0x18f269['status'](0xcc)[_0x0fcf('0x1d')]();});}};}function handleEntityNotFound(_0x256e2b,_0x40e5ff){return function(_0x2ad226){if(!_0x2ad226){_0x256e2b[_0x0fcf('0x34')](0x194);}return _0x2ad226;};}function handleError(_0x436e82,_0x4d3e37){_0x4d3e37=_0x4d3e37||0x1f4;return function(_0x208433){logger[_0x0fcf('0x35')](_0x208433[_0x0fcf('0x36')]);if(_0x208433[_0x0fcf('0x32')]){delete _0x208433[_0x0fcf('0x32')];}_0x436e82[_0x0fcf('0x1c')](_0x4d3e37)[_0x0fcf('0x37')](_0x208433);};}exports[_0x0fcf('0x38')]=function(_0x20198c,_0x23562a){var _0x219caf={},_0x38826c={},_0x2aeef8={'count':0x0,'rows':[]};var _0x17346e=_['map'](db['VoiceQueue'][_0x0fcf('0x39')],function(_0x4ccbdf){return{'name':_0x4ccbdf['fieldName'],'type':_0x4ccbdf[_0x0fcf('0x31')][_0x0fcf('0x3a')]};});_0x38826c[_0x0fcf('0x3b')]=_['map'](_0x17346e,'name');_0x38826c[_0x0fcf('0x3c')]=_[_0x0fcf('0x3d')](_0x20198c[_0x0fcf('0x3c')]);_0x38826c['filters']=_[_0x0fcf('0x3e')](_0x38826c[_0x0fcf('0x3b')],_0x38826c[_0x0fcf('0x3c')]);_0x219caf['attributes']=_['intersection'](_0x38826c['model'],qs[_0x0fcf('0x3f')](_0x20198c[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x219caf[_0x0fcf('0x40')]=_0x219caf[_0x0fcf('0x40')]['length']?_0x219caf[_0x0fcf('0x40')]:_0x38826c[_0x0fcf('0x3b')];if(!_0x20198c[_0x0fcf('0x3c')]['hasOwnProperty']('nolimit')){_0x219caf[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x20198c[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x219caf[_0x0fcf('0x1f')]=qs['offset'](_0x20198c[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}_0x219caf[_0x0fcf('0x41')]=qs[_0x0fcf('0x42')](_0x20198c['query']['sort']);_0x219caf[_0x0fcf('0x43')]=qs[_0x0fcf('0x44')](_['pick'](_0x20198c[_0x0fcf('0x3c')],_0x38826c[_0x0fcf('0x44')]),_0x17346e);if(_0x20198c['query'][_0x0fcf('0x2d')]){_0x219caf[_0x0fcf('0x43')]=_[_0x0fcf('0x45')](_0x219caf[_0x0fcf('0x43')],{'$or':_[_0x0fcf('0x46')](_0x17346e,function(_0x5efc41){if(_0x5efc41[_0x0fcf('0x31')]!==_0x0fcf('0x47')){var _0x5994af={};_0x5994af[_0x5efc41['name']]={'$like':'%'+_0x20198c[_0x0fcf('0x3c')]['filter']+'%'};return _0x5994af;}})});}_0x219caf=_['merge']({},_0x219caf,_0x20198c[_0x0fcf('0x48')]);var _0x1050dd={'where':_0x219caf[_0x0fcf('0x43')]};return db[_0x0fcf('0x49')][_0x0fcf('0x21')](_0x1050dd)[_0x0fcf('0x27')](function(_0x5848c4){_0x2aeef8[_0x0fcf('0x21')]=_0x5848c4;if(_0x20198c[_0x0fcf('0x3c')][_0x0fcf('0x4a')]){_0x219caf['include']=[{'all':!![]}];}return db[_0x0fcf('0x49')][_0x0fcf('0x4b')](_0x219caf);})[_0x0fcf('0x27')](function(_0x4b2308){_0x2aeef8['rows']=_0x4b2308;return _0x2aeef8;})[_0x0fcf('0x27')](respondWithFilteredResult(_0x23562a,_0x219caf))[_0x0fcf('0x4c')](handleError(_0x23562a,null));};exports[_0x0fcf('0x4d')]=function(_0x405bbe,_0x59e167){var _0x592bb4={'raw':![],'where':{'id':_0x405bbe[_0x0fcf('0x4e')]['id']}},_0x19e14c={};_0x19e14c[_0x0fcf('0x3b')]=_[_0x0fcf('0x3d')](db[_0x0fcf('0x49')][_0x0fcf('0x39')]);_0x19e14c[_0x0fcf('0x3c')]=_[_0x0fcf('0x3d')](_0x405bbe['query']);_0x19e14c['filters']=_[_0x0fcf('0x3e')](_0x19e14c[_0x0fcf('0x3b')],_0x19e14c[_0x0fcf('0x3c')]);_0x592bb4[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x19e14c[_0x0fcf('0x3b')],qs['fields'](_0x405bbe[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x592bb4['attributes']=_0x592bb4[_0x0fcf('0x40')][_0x0fcf('0x4f')]?_0x592bb4[_0x0fcf('0x40')]:_0x19e14c[_0x0fcf('0x3b')];if(_0x405bbe['query'][_0x0fcf('0x4a')]){_0x592bb4[_0x0fcf('0x50')]=[{'all':!![]}];}_0x592bb4=_[_0x0fcf('0x45')]({},_0x592bb4,_0x405bbe[_0x0fcf('0x48')]);return db[_0x0fcf('0x49')][_0x0fcf('0x30')](_0x592bb4)[_0x0fcf('0x27')](handleEntityNotFound(_0x59e167,null))[_0x0fcf('0x27')](respondWithResult(_0x59e167,null))[_0x0fcf('0x4c')](handleError(_0x59e167,null));};exports[_0x0fcf('0x51')]=function(_0xdee737,_0x364733){return db[_0x0fcf('0x49')][_0x0fcf('0x51')](_0xdee737['body'],{})[_0x0fcf('0x27')](function(_0x5dc1cc){var _0x469fa3=_0xdee737[_0x0fcf('0x52')][_0x0fcf('0x29')]({'plain':!![]});if(!_0x469fa3)throw new Error(_0x0fcf('0x53'));if(_0x469fa3[_0x0fcf('0x54')]==='user'){var _0x12b8d2=_0x5dc1cc['get']({'plain':!![]});var _0x48b60a=[{'name':_0x0fcf('0x2a'),'value':'inbound'},{'name':_0x0fcf('0x55'),'value':_0x0fcf('0x2c')}];var _0x490cb6=_[_0x0fcf('0x30')](_0x48b60a,[_0x0fcf('0x56'),_0x12b8d2[_0x0fcf('0x31')]])[_0x0fcf('0x32')];return db[_0x0fcf('0x57')]['find']({'where':{'name':_0x490cb6,'userProfileId':_0x469fa3['userProfileId']},'raw':!![]})[_0x0fcf('0x27')](function(_0x50fc2c){if(_0x50fc2c&&_0x50fc2c[_0x0fcf('0x58')]===0x0){return db[_0x0fcf('0x33')]['create']({'name':_0x12b8d2['name'],'resourceId':_0x12b8d2['id'],'type':_0x50fc2c[_0x0fcf('0x32')],'sectionId':_0x50fc2c['id']},{})[_0x0fcf('0x27')](function(){return _0x5dc1cc;});}else{return _0x5dc1cc;}})[_0x0fcf('0x4c')](function(_0x5d8724){logger[_0x0fcf('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d8724);throw _0x5d8724;});}return _0x5dc1cc;})[_0x0fcf('0x27')](respondWithResult(_0x364733,0xc9))[_0x0fcf('0x4c')](handleError(_0x364733,null));};exports[_0x0fcf('0x59')]=function(_0x4911dd,_0x1362d7){var _0x29c0b8={'where':{'id':_0x4911dd[_0x0fcf('0x4e')]['id']}},_0x3452f8={};_0x3452f8[_0x0fcf('0x3b')]=_[_0x0fcf('0x3d')](db[_0x0fcf('0x49')][_0x0fcf('0x39')]);_0x29c0b8[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x3452f8[_0x0fcf('0x3b')],qs['fields'](_0x4911dd[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x29c0b8[_0x0fcf('0x40')]=_0x29c0b8[_0x0fcf('0x40')][_0x0fcf('0x4f')]?_0x29c0b8[_0x0fcf('0x40')]:_0x3452f8[_0x0fcf('0x3b')];if(_0x4911dd['query']['includeAll']){_0x29c0b8[_0x0fcf('0x50')]=[{'all':!![]}];}_0x29c0b8=_[_0x0fcf('0x45')]({},_0x29c0b8,_0x4911dd['options']);return db[_0x0fcf('0x49')][_0x0fcf('0x30')](_0x29c0b8)[_0x0fcf('0x27')](handleEntityNotFound(_0x1362d7,null))[_0x0fcf('0x27')](function(_0x484b9c){if(_0x484b9c){var _0x540859=_0x484b9c[_0x0fcf('0x29')]({'plain':!![]});_0x540859=qs[_0x0fcf('0x5a')](_0x540859,['id',_0x0fcf('0x5b'),_0x0fcf('0x5c')]);_0x4911dd[_0x0fcf('0x5d')]=_['omit'](_0x4911dd[_0x0fcf('0x5d')],['id',_0x0fcf('0x5b'),_0x0fcf('0x5c')]);return db[_0x0fcf('0x49')][_0x0fcf('0x51')](_['merge'](_0x540859,_0x4911dd['body']),{'include':_0x4911dd[_0x0fcf('0x3c')][_0x0fcf('0x4a')]?[{'all':!![]}]:undefined})[_0x0fcf('0x27')](function(_0x44b81d){var _0x2066f6=_0x4911dd[_0x0fcf('0x52')][_0x0fcf('0x29')]({'plain':!![]});if(!_0x2066f6)throw new Error(_0x0fcf('0x53'));if(_0x2066f6[_0x0fcf('0x54')]===_0x0fcf('0x52')){var _0x5d54f0=_0x44b81d[_0x0fcf('0x29')]({'plain':!![]});var _0x231559=[{'name':_0x0fcf('0x2a'),'value':_0x0fcf('0x2b')},{'name':_0x0fcf('0x55'),'value':_0x0fcf('0x2c')}];var _0x21d767=_[_0x0fcf('0x30')](_0x231559,[_0x0fcf('0x56'),_0x5d54f0['type']])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x21d767,'userProfileId':_0x2066f6[_0x0fcf('0x5e')]},'raw':!![]})['then'](function(_0x31e763){if(_0x31e763&&_0x31e763[_0x0fcf('0x58')]===0x0){return db[_0x0fcf('0x33')]['create']({'name':_0x5d54f0['name'],'resourceId':_0x5d54f0['id'],'type':_0x31e763[_0x0fcf('0x32')],'sectionId':_0x31e763['id']},{})[_0x0fcf('0x27')](function(){return _0x44b81d;});}else{return _0x44b81d;}})['catch'](function(_0x105c75){logger[_0x0fcf('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x105c75);throw _0x105c75;});}return _0x44b81d;});}})[_0x0fcf('0x27')](respondWithResult(_0x1362d7,0xc9))[_0x0fcf('0x4c')](handleError(_0x1362d7,null));};exports[_0x0fcf('0x26')]=function(_0x7402bb,_0x7cc9a0){if(_0x7402bb[_0x0fcf('0x5d')]['id']){delete _0x7402bb[_0x0fcf('0x5d')]['id'];}return db['VoiceQueue'][_0x0fcf('0x30')]({'where':{'id':_0x7402bb[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x7cc9a0,null))[_0x0fcf('0x27')](saveUpdates(_0x7402bb[_0x0fcf('0x5d')],null))[_0x0fcf('0x27')](respondWithResult(_0x7cc9a0,null))['catch'](handleError(_0x7cc9a0,null));};exports['destroy']=function(_0x39b8da,_0xeabc36){return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x39b8da['params']['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0xeabc36,null))[_0x0fcf('0x27')](removeEntity(_0xeabc36,null))[_0x0fcf('0x4c')](handleError(_0xeabc36,null));};exports[_0x0fcf('0x5f')]=function(_0x305bd5,_0x4a4ecb,_0x49d165){var _0x2c28b0={'raw':![],'where':{}};var _0x55e438={};var _0x18a675={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0fcf('0x60')]({'where':{'id':_0x305bd5[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x4a4ecb,null))[_0x0fcf('0x27')](function(_0x2bde0e){if(_0x2bde0e){_0x55e438['model']=_[_0x0fcf('0x3d')](db[_0x0fcf('0x61')][_0x0fcf('0x39')]);_0x55e438[_0x0fcf('0x3c')]=_['keys'](_0x305bd5[_0x0fcf('0x3c')]);_0x55e438['filters']=_[_0x0fcf('0x3e')](_0x55e438['model'],_0x55e438[_0x0fcf('0x3c')]);_0x2c28b0[_0x0fcf('0x40')]=_['intersection'](_0x55e438[_0x0fcf('0x3b')],qs[_0x0fcf('0x3f')](_0x305bd5[_0x0fcf('0x3c')]['fields']));_0x2c28b0['attributes']=_0x2c28b0['attributes'][_0x0fcf('0x4f')]?_0x2c28b0['attributes']:_0x55e438[_0x0fcf('0x3b')];if(!_0x305bd5[_0x0fcf('0x3c')][_0x0fcf('0x62')](_0x0fcf('0x63'))){_0x2c28b0[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x305bd5[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x2c28b0[_0x0fcf('0x1f')]=qs['offset'](_0x305bd5[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}_0x2c28b0[_0x0fcf('0x41')]=qs[_0x0fcf('0x42')](_0x305bd5[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x2c28b0[_0x0fcf('0x43')]=qs[_0x0fcf('0x44')](_['pick'](_0x305bd5[_0x0fcf('0x3c')],_0x55e438[_0x0fcf('0x44')]));_0x2c28b0[_0x0fcf('0x43')][_0x0fcf('0x64')]=_0x2bde0e['id'];if(_0x305bd5[_0x0fcf('0x3c')][_0x0fcf('0x2d')]){_0x2c28b0[_0x0fcf('0x43')]=_['merge'](_0x2c28b0[_0x0fcf('0x43')],{'$or':_['map'](_0x2c28b0[_0x0fcf('0x40')],function(_0x9e933e){var _0xc1bef9={};_0xc1bef9[_0x9e933e]={'$like':'%'+_0x305bd5['query']['filter']+'%'};return _0xc1bef9;})});}_0x2c28b0=_['merge']({},_0x2c28b0,_0x305bd5['options']);return db[_0x0fcf('0x61')][_0x0fcf('0x21')]({'where':_0x2c28b0[_0x0fcf('0x43')]})[_0x0fcf('0x27')](function(_0x34de38){_0x18a675[_0x0fcf('0x21')]=_0x34de38;if(_0x305bd5[_0x0fcf('0x3c')][_0x0fcf('0x4a')]){_0x2c28b0[_0x0fcf('0x50')]=[{'all':!![]}];}return db[_0x0fcf('0x61')][_0x0fcf('0x4b')](_0x2c28b0);})['then'](function(_0x1af57f){_0x18a675[_0x0fcf('0x65')]=_0x1af57f;return _0x18a675;});}})['then'](respondWithFilteredResult(_0x4a4ecb,_0x2c28b0))[_0x0fcf('0x4c')](handleError(_0x4a4ecb,null));};exports['getHopperHistories']=function(_0x33d024,_0x2e0a03,_0x5f1927){var _0x57a045={'raw':!![],'where':{}};var _0x36d4e5={};var _0x3785b4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0fcf('0x60')]({'where':{'id':_0x33d024[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x2e0a03,null))[_0x0fcf('0x27')](function(_0x9d5c34){if(_0x9d5c34){_0x36d4e5[_0x0fcf('0x3b')]=_[_0x0fcf('0x3d')](db[_0x0fcf('0x66')]['rawAttributes']);_0x36d4e5[_0x0fcf('0x3c')]=_[_0x0fcf('0x3d')](_0x33d024[_0x0fcf('0x3c')]);_0x36d4e5[_0x0fcf('0x44')]=_['intersection'](_0x36d4e5[_0x0fcf('0x3b')],_0x36d4e5['query']);_0x57a045['attributes']=_['intersection'](_0x36d4e5[_0x0fcf('0x3b')],qs[_0x0fcf('0x3f')](_0x33d024[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x57a045[_0x0fcf('0x40')]=_0x57a045[_0x0fcf('0x40')][_0x0fcf('0x4f')]?_0x57a045[_0x0fcf('0x40')]:_0x36d4e5[_0x0fcf('0x3b')];if(!_0x33d024['query'][_0x0fcf('0x62')](_0x0fcf('0x63'))){_0x57a045[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x33d024[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x57a045[_0x0fcf('0x1f')]=qs[_0x0fcf('0x1f')](_0x33d024[_0x0fcf('0x3c')]['offset']);}_0x57a045['order']=qs['sort'](_0x33d024[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x57a045[_0x0fcf('0x43')]=qs[_0x0fcf('0x44')](_['pick'](_0x33d024['query'],_0x36d4e5['filters']));_0x57a045[_0x0fcf('0x43')]['VoiceQueueId']=_0x9d5c34['id'];if(_0x33d024[_0x0fcf('0x3c')]['filter']){_0x57a045[_0x0fcf('0x43')]=_['merge'](_0x57a045[_0x0fcf('0x43')],{'$or':_['map'](_0x57a045['attributes'],function(_0x426625){var _0x4ccae3={};_0x4ccae3[_0x426625]={'$like':'%'+_0x33d024[_0x0fcf('0x3c')][_0x0fcf('0x2d')]+'%'};return _0x4ccae3;})});}_0x57a045=_[_0x0fcf('0x45')]({},_0x57a045,_0x33d024[_0x0fcf('0x48')]);return db[_0x0fcf('0x66')][_0x0fcf('0x21')]({'where':_0x57a045[_0x0fcf('0x43')]})[_0x0fcf('0x27')](function(_0x524a12){_0x3785b4[_0x0fcf('0x21')]=_0x524a12;if(_0x33d024[_0x0fcf('0x3c')][_0x0fcf('0x4a')]){_0x57a045[_0x0fcf('0x50')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0fcf('0x4b')](_0x57a045);})[_0x0fcf('0x27')](function(_0x2dbd72){_0x3785b4[_0x0fcf('0x65')]=_0x2dbd72;return _0x3785b4;});}})[_0x0fcf('0x27')](respondWithFilteredResult(_0x2e0a03,_0x57a045))[_0x0fcf('0x4c')](handleError(_0x2e0a03,null));};exports[_0x0fcf('0x67')]=function(_0x41c36b,_0x297078,_0x50a5bb){var _0x3410ae={'raw':!![],'where':{}};var _0x54ad5={};var _0x26d31c={'count':0x0,'rows':[]};return db[_0x0fcf('0x49')][_0x0fcf('0x60')]({'where':{'id':_0x41c36b[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x297078,null))[_0x0fcf('0x27')](function(_0x38f7de){if(_0x38f7de){_0x54ad5[_0x0fcf('0x3b')]=_[_0x0fcf('0x3d')](db[_0x0fcf('0x68')][_0x0fcf('0x39')]);_0x54ad5['query']=_[_0x0fcf('0x3d')](_0x41c36b[_0x0fcf('0x3c')]);_0x54ad5['filters']=_[_0x0fcf('0x3e')](_0x54ad5[_0x0fcf('0x3b')],_0x54ad5[_0x0fcf('0x3c')]);_0x3410ae[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x54ad5['model'],qs['fields'](_0x41c36b['query'][_0x0fcf('0x3f')]));_0x3410ae['attributes']=_0x3410ae[_0x0fcf('0x40')][_0x0fcf('0x4f')]?_0x3410ae['attributes']:_0x54ad5[_0x0fcf('0x3b')];if(!_0x41c36b[_0x0fcf('0x3c')][_0x0fcf('0x62')](_0x0fcf('0x63'))){_0x3410ae[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x41c36b[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x3410ae[_0x0fcf('0x1f')]=qs['offset'](_0x41c36b[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}_0x3410ae[_0x0fcf('0x41')]=qs['sort'](_0x41c36b[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x3410ae[_0x0fcf('0x43')]=qs[_0x0fcf('0x44')](_[_0x0fcf('0x69')](_0x41c36b[_0x0fcf('0x3c')],_0x54ad5[_0x0fcf('0x44')]));_0x3410ae['where'][_0x0fcf('0x64')]=_0x38f7de['id'];if(_0x41c36b[_0x0fcf('0x3c')][_0x0fcf('0x2d')]){_0x3410ae[_0x0fcf('0x43')]=_['merge'](_0x3410ae[_0x0fcf('0x43')],{'$or':_['map'](_0x3410ae[_0x0fcf('0x40')],function(_0x13f0ad){var _0x5ddf0b={};_0x5ddf0b[_0x13f0ad]={'$like':'%'+_0x41c36b['query'][_0x0fcf('0x2d')]+'%'};return _0x5ddf0b;})});}_0x3410ae=_[_0x0fcf('0x45')]({},_0x3410ae,_0x41c36b[_0x0fcf('0x48')]);return db[_0x0fcf('0x68')][_0x0fcf('0x21')]({'where':_0x3410ae[_0x0fcf('0x43')]})[_0x0fcf('0x27')](function(_0x1a480e){_0x26d31c[_0x0fcf('0x21')]=_0x1a480e;if(_0x41c36b[_0x0fcf('0x3c')]['includeAll']){_0x3410ae[_0x0fcf('0x50')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3410ae);})[_0x0fcf('0x27')](function(_0x56d4a4){_0x26d31c['rows']=_0x56d4a4;return _0x26d31c;});}})['then'](respondWithFilteredResult(_0x297078,_0x3410ae))[_0x0fcf('0x4c')](handleError(_0x297078,null));};exports[_0x0fcf('0x6a')]=function(_0x3d7267,_0x1e43af,_0x1169f5){var _0x17486b={'raw':!![],'where':{}};var _0x2198ef={};var _0x5c393f={'count':0x0,'rows':[]};return db[_0x0fcf('0x49')]['findOne']({'where':{'id':_0x3d7267[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x1e43af,null))[_0x0fcf('0x27')](function(_0x34c190){if(_0x34c190){_0x2198ef[_0x0fcf('0x3b')]=_[_0x0fcf('0x3d')](db['CmHopperBlack'][_0x0fcf('0x39')]);_0x2198ef[_0x0fcf('0x3c')]=_[_0x0fcf('0x3d')](_0x3d7267[_0x0fcf('0x3c')]);_0x2198ef[_0x0fcf('0x44')]=_['intersection'](_0x2198ef[_0x0fcf('0x3b')],_0x2198ef[_0x0fcf('0x3c')]);_0x17486b[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x2198ef[_0x0fcf('0x3b')],qs['fields'](_0x3d7267[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x17486b[_0x0fcf('0x40')]=_0x17486b[_0x0fcf('0x40')]['length']?_0x17486b[_0x0fcf('0x40')]:_0x2198ef[_0x0fcf('0x3b')];if(!_0x3d7267[_0x0fcf('0x3c')]['hasOwnProperty']('nolimit')){_0x17486b[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x3d7267[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x17486b[_0x0fcf('0x1f')]=qs['offset'](_0x3d7267[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}_0x17486b[_0x0fcf('0x41')]=qs['sort'](_0x3d7267[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x17486b['where']=qs[_0x0fcf('0x44')](_[_0x0fcf('0x69')](_0x3d7267[_0x0fcf('0x3c')],_0x2198ef[_0x0fcf('0x44')]));_0x17486b[_0x0fcf('0x43')]['VoiceQueueId']=_0x34c190['id'];if(_0x3d7267[_0x0fcf('0x3c')]['filter']){_0x17486b[_0x0fcf('0x43')]=_['merge'](_0x17486b['where'],{'$or':_[_0x0fcf('0x46')](_0x17486b[_0x0fcf('0x40')],function(_0x1bb710){var _0x26e2f5={};_0x26e2f5[_0x1bb710]={'$like':'%'+_0x3d7267[_0x0fcf('0x3c')][_0x0fcf('0x2d')]+'%'};return _0x26e2f5;})});}_0x17486b=_[_0x0fcf('0x45')]({},_0x17486b,_0x3d7267[_0x0fcf('0x48')]);return db[_0x0fcf('0x6b')]['count']({'where':_0x17486b[_0x0fcf('0x43')]})[_0x0fcf('0x27')](function(_0x1dd802){_0x5c393f[_0x0fcf('0x21')]=_0x1dd802;if(_0x3d7267[_0x0fcf('0x3c')][_0x0fcf('0x4a')]){_0x17486b[_0x0fcf('0x50')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0fcf('0x4b')](_0x17486b);})[_0x0fcf('0x27')](function(_0x581f80){_0x5c393f[_0x0fcf('0x65')]=_0x581f80;return _0x5c393f;});}})['then'](respondWithFilteredResult(_0x1e43af,_0x17486b))[_0x0fcf('0x4c')](handleError(_0x1e43af,null));};exports['getTeams']=function(_0x1725c7,_0x26d4cb,_0x1d99bf){var _0x4bdd2a={};var _0x2df2a5={};var _0x291b94;var _0x53f460;return db[_0x0fcf('0x49')][_0x0fcf('0x60')]({'where':{'id':_0x1725c7[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x26d4cb,null))[_0x0fcf('0x27')](function(_0x4cf71e){if(_0x4cf71e){_0x291b94=_0x4cf71e;_0x2df2a5['model']=_[_0x0fcf('0x3d')](db[_0x0fcf('0x6c')][_0x0fcf('0x39')]);_0x2df2a5[_0x0fcf('0x3c')]=_[_0x0fcf('0x3d')](_0x1725c7['query']);_0x2df2a5[_0x0fcf('0x44')]=_[_0x0fcf('0x3e')](_0x2df2a5['model'],_0x2df2a5['query']);_0x4bdd2a[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x2df2a5[_0x0fcf('0x3b')],qs[_0x0fcf('0x3f')](_0x1725c7[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x4bdd2a[_0x0fcf('0x40')]=_0x4bdd2a[_0x0fcf('0x40')][_0x0fcf('0x4f')]?_0x4bdd2a[_0x0fcf('0x40')]:_0x2df2a5[_0x0fcf('0x3b')];_0x4bdd2a[_0x0fcf('0x41')]=qs[_0x0fcf('0x42')](_0x1725c7[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x4bdd2a[_0x0fcf('0x43')]=qs['filters'](_['pick'](_0x1725c7[_0x0fcf('0x3c')],_0x2df2a5[_0x0fcf('0x44')]));if(_0x1725c7[_0x0fcf('0x3c')][_0x0fcf('0x2d')]){_0x4bdd2a[_0x0fcf('0x43')]=_[_0x0fcf('0x45')](_0x4bdd2a['where'],{'$or':_[_0x0fcf('0x46')](_0x4bdd2a['attributes'],function(_0x3dbdfd){var _0x5f4613={};_0x5f4613[_0x3dbdfd]={'$like':'%'+_0x1725c7['query'][_0x0fcf('0x2d')]+'%'};return _0x5f4613;})});}_0x4bdd2a=_[_0x0fcf('0x45')]({},_0x4bdd2a,_0x1725c7[_0x0fcf('0x48')]);return _0x291b94['getTeams'](_0x4bdd2a);}})['then'](function(_0x1f944e){if(_0x1f944e){_0x53f460=_0x1f944e[_0x0fcf('0x4f')];if(!_0x1725c7[_0x0fcf('0x3c')][_0x0fcf('0x62')](_0x0fcf('0x63'))){_0x4bdd2a['limit']=qs[_0x0fcf('0x22')](_0x1725c7[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x4bdd2a[_0x0fcf('0x1f')]=qs[_0x0fcf('0x1f')](_0x1725c7[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}return _0x291b94[_0x0fcf('0x6d')](_0x4bdd2a);}})[_0x0fcf('0x27')](function(_0x135e8d){if(_0x135e8d){return _0x135e8d?{'count':_0x53f460,'rows':_0x135e8d}:null;}})[_0x0fcf('0x27')](respondWithResult(_0x26d4cb,null))[_0x0fcf('0x4c')](handleError(_0x26d4cb,null));};exports[_0x0fcf('0x6e')]=function(_0x96b73,_0x36dd2e,_0x3acf67){var _0x4e80c7=_0x96b73['body']['teams'];var _0xd0e0f0=_['map'](_0x4e80c7,'id');return db[_0x0fcf('0x6c')][_0x0fcf('0x4b')]({'where':{'id':_0xd0e0f0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0fcf('0x6f'),'attributes':['id','name',_0x0fcf('0x70'),'voicePause',_0x0fcf('0x71')],'raw':!![]}]})[_0x0fcf('0x27')](function(_0x3fb151){if(_0x3fb151){var _0x3481f0=_[_0x0fcf('0x72')](_0x3fb151,function(_0x2fee4a){var _0x4bccfb=_0x2fee4a[_0x0fcf('0x29')]({'plain':!![]});_0x4bccfb[_0x0fcf('0x6f')]['forEach'](function(_0x1710fe){_0x1710fe['penalty']=_['find'](_0x4e80c7,{'id':_0x4bccfb['id']})[_0x0fcf('0x73')];});return _0x4bccfb[_0x0fcf('0x6f')];});return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x96b73[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](function(_0x2473bf){return db[_0x0fcf('0x74')]['transaction'](function(_0x117ad3){return _0x2473bf[_0x0fcf('0x6e')](_0xd0e0f0,{'transaction':_0x117ad3})[_0x0fcf('0x27')](function(){return BPromise[_0x0fcf('0x75')](_0x4e80c7,function(_0x5814b2){return db['TeamVoiceQueue'][_0x0fcf('0x76')]({'TeamId':_0x5814b2['id'],'VoiceQueueId':_0x96b73[_0x0fcf('0x4e')]['id'],'penalty':_0x5814b2[_0x0fcf('0x73')]},{'transaction':_0x117ad3});});})[_0x0fcf('0x27')](function(){return BPromise[_0x0fcf('0x75')](_0x3481f0,function(_0x59ef74){return db['UserVoiceQueue'][_0x0fcf('0x77')]({'where':{'UserId':_0x59ef74['id'],'VoiceQueueId':_0x96b73[_0x0fcf('0x4e')]['id']},'defaults':{'penalty':_0x59ef74[_0x0fcf('0x73')]},'transaction':_0x117ad3});});})[_0x0fcf('0x27')](function(){return BPromise['each'](_[_0x0fcf('0x2d')](_0x3481f0,{'online':!![]}),function(_0x40b58c){return db['UserVoiceQueueRt'][_0x0fcf('0x76')]({'membername':_0x40b58c[_0x0fcf('0x32')],'UserId':_0x40b58c['id'],'queue_name':_0x2473bf['name'],'VoiceQueueId':_0x2473bf['id'],'interface':_[_0x0fcf('0x78')](_0x40b58c[_0x0fcf('0x71')])?util[_0x0fcf('0x79')](_0x0fcf('0x7a'),_0x40b58c[_0x0fcf('0x32')]):_0x40b58c[_0x0fcf('0x71')],'paused':_0x40b58c[_0x0fcf('0x7b')]||![],'penalty':_0x40b58c['penalty']},{'transaction':_0x117ad3});});})[_0x0fcf('0x27')](function(){_0x3481f0[_0x0fcf('0x7c')](function(_0x1cd8be){socket['emit'](_0x0fcf('0x7d'),{'UserId':_0x1cd8be['id'],'VoiceQueueId':_0x2473bf['id']});});});});});}})[_0x0fcf('0x27')](respondWithStatusCode(_0x36dd2e,null))[_0x0fcf('0x4c')](handleError(_0x36dd2e,null));};exports[_0x0fcf('0x7e')]=function(_0x2039c5,_0x804545,_0x42dc5f){return db[_0x0fcf('0x6c')][_0x0fcf('0x4b')]({'where':{'id':_0x2039c5[_0x0fcf('0x3c')][_0x0fcf('0x7f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0fcf('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x804545,null))[_0x0fcf('0x27')](function(_0x3aad0f){var _0x426ab2=_['map'](_0x3aad0f,'id');var _0x29ea68=[];var _0x5a24dd=[];var _0x60989c=squel['select']();_0x60989c[_0x0fcf('0x80')](_0x0fcf('0x81'))['from'](_0x0fcf('0x82'),'tq')['join'](_0x0fcf('0x83'),'ut',_0x0fcf('0x84'))[_0x0fcf('0x43')]('VoiceQueueId\x20=\x20?',_0x2039c5[_0x0fcf('0x4e')]['id']);for(var _0x5cf237=0x0;_0x5cf237<_0x3aad0f[_0x0fcf('0x4f')];_0x5cf237+=0x1){let _0x46fafb=_0x3aad0f[_0x5cf237];for(var _0x38de26=0x0;_0x38de26<_0x46fafb[_0x0fcf('0x6f')][_0x0fcf('0x4f')];_0x38de26+=0x1){let _0x394831=_0x46fafb[_0x0fcf('0x6f')][_0x38de26];var _0x3a6ae0=_0x60989c[_0x0fcf('0x59')]();_0x3a6ae0[_0x0fcf('0x43')]('ut.UserId\x20=\x20?',_0x394831['id']);_0x5a24dd[_0x0fcf('0x85')](db[_0x0fcf('0x74')][_0x0fcf('0x3c')](_0x3a6ae0[_0x0fcf('0x86')](),{'type':db['sequelize']['QueryTypes'][_0x0fcf('0x87')]})[_0x0fcf('0x27')](function(_0x2f30cf){if(_0x2f30cf['length']===0x1){return _0x394831['id'];}else{var _0x33b234=_[_0x0fcf('0x88')](_[_0x0fcf('0x46')](_0x2f30cf,_0x0fcf('0x89')),function(_0x4c0dc9){return _['includes'](_0x426ab2,_0x4c0dc9);});if(_0x33b234){return _0x394831['id'];}}}));}}return BPromise['all'](_0x5a24dd)[_0x0fcf('0x27')](function(_0x441d95){_0x29ea68=_(_0x29ea68)[_0x0fcf('0x8a')](_0x441d95)[_0x0fcf('0x8b')]()[_0x0fcf('0x56')]();return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x2039c5['params']['id']}})['then'](function(_0x3415a4){return db[_0x0fcf('0x74')][_0x0fcf('0x8c')](function(_0x467e50){return _0x3415a4[_0x0fcf('0x7e')](_0x2039c5['query'][_0x0fcf('0x7f')],{'transaction':_0x467e50})[_0x0fcf('0x27')](function(){if(!_[_0x0fcf('0x8d')](_0x29ea68)){return _0x3415a4[_0x0fcf('0x8e')](_0x29ea68,{'transaction':_0x467e50})[_0x0fcf('0x27')](function(){return db[_0x0fcf('0x8f')][_0x0fcf('0x28')]({'where':{'VoiceQueueId':_0x2039c5[_0x0fcf('0x4e')]['id'],'UserId':_0x29ea68},'transaction':_0x467e50});});}})[_0x0fcf('0x27')](function(){_0x29ea68['forEach'](function(_0x27ac8d){socket[_0x0fcf('0x90')]('userVoiceQueue:remove',{'UserId':_0x27ac8d,'VoiceQueueId':_0x3415a4['id']});});});});});});})[_0x0fcf('0x27')](respondWithStatusCode(_0x804545,null))[_0x0fcf('0x4c')](handleError(_0x804545,null));};exports[_0x0fcf('0x91')]=function(_0x30f087,_0x588741,_0x323ca2){var _0xe5bd72,_0x1a503c;return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x30f087[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x588741,null))['then'](function(_0x1df121){if(_0x1df121){_0x1a503c=_0x1df121;return _0x1df121[_0x0fcf('0x91')](_0x30f087[_0x0fcf('0x5d')][_0x0fcf('0x7f')],_[_0x0fcf('0x5a')](_0x30f087[_0x0fcf('0x5d')],['ids','id'])||{})[_0x0fcf('0x92')](function(_0x1ad61d){for(var _0x5cd084=0x0;_0x5cd084<_0x30f087[_0x0fcf('0x5d')]['ids']['length'];_0x5cd084+=0x1){socket['emit'](_0x0fcf('0x7d'),{'UserId':Number(_0x30f087[_0x0fcf('0x5d')]['ids'][_0x5cd084]),'VoiceQueueId':Number(_0x30f087[_0x0fcf('0x4e')]['id'])});}return _0x1ad61d;});}})['then'](function(_0x1af092){_0xe5bd72=_0x1af092||[];if(_0x1a503c){return db[_0x0fcf('0x93')][_0x0fcf('0x4b')]({'where':{'id':_0x30f087[_0x0fcf('0x5d')][_0x0fcf('0x7f')]},'attributes':['id',_0x0fcf('0x32'),'online',_0x0fcf('0x7b'),'interface'],'raw':!![]});}})[_0x0fcf('0x27')](function(_0x1024e7){if(!_[_0x0fcf('0x8d')](_0x1024e7)){var _0x55b88a=[];for(var _0x2e5c58=0x0;_0x2e5c58<_0x1024e7['length'];_0x2e5c58++){if(_0x1024e7[_0x2e5c58][_0x0fcf('0x70')]){_0x55b88a[_0x0fcf('0x85')](db[_0x0fcf('0x8f')][_0x0fcf('0x76')]({'membername':_0x1024e7[_0x2e5c58][_0x0fcf('0x32')],'UserId':_0x1024e7[_0x2e5c58]['id'],'queue_name':_0x1a503c['name'],'VoiceQueueId':_0x1a503c['id'],'interface':_[_0x0fcf('0x78')](_0x1024e7[_0x2e5c58][_0x0fcf('0x71')])?util['format'](_0x0fcf('0x7a'),_0x1024e7[_0x2e5c58]['name']):_0x1024e7[_0x2e5c58][_0x0fcf('0x71')],'paused':_0x1024e7[_0x2e5c58][_0x0fcf('0x7b')]||![],'penalty':_0x30f087[_0x0fcf('0x5d')][_0x0fcf('0x73')]||0x0}));}}return BPromise[_0x0fcf('0x94')](_0x55b88a);}})[_0x0fcf('0x27')](function(){return _0xe5bd72;})[_0x0fcf('0x27')](respondWithResult(_0x588741,null))[_0x0fcf('0x4c')](handleError(_0x588741,null));};exports[_0x0fcf('0x8e')]=function(_0x4a4b87,_0x32925e,_0x4cacb0){return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x4a4b87['params']['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x32925e,null))[_0x0fcf('0x27')](function(_0x381a70){if(_0x381a70){return _0x381a70[_0x0fcf('0x8e')](_0x4a4b87[_0x0fcf('0x3c')][_0x0fcf('0x7f')])[_0x0fcf('0x27')](function(){if(_[_0x0fcf('0x95')](_0x4a4b87[_0x0fcf('0x3c')][_0x0fcf('0x7f')])){for(var _0x4e687d=0x0;_0x4e687d<_0x4a4b87[_0x0fcf('0x3c')]['ids'][_0x0fcf('0x4f')];_0x4e687d+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x4a4b87['query'][_0x0fcf('0x7f')][_0x4e687d]),'VoiceQueueId':Number(_0x4a4b87[_0x0fcf('0x4e')]['id'])});}}else{socket['emit'](_0x0fcf('0x96'),{'UserId':Number(_0x4a4b87[_0x0fcf('0x3c')][_0x0fcf('0x7f')]),'VoiceQueueId':Number(_0x4a4b87[_0x0fcf('0x4e')]['id'])});}});}})[_0x0fcf('0x27')](function(_0x3fbdf1){return db[_0x0fcf('0x8f')]['destroy']({'where':{'VoiceQueueId':_0x4a4b87[_0x0fcf('0x4e')]['id'],'UserId':_0x4a4b87['query'][_0x0fcf('0x7f')]}})['then'](function(){return _0x3fbdf1;});})[_0x0fcf('0x27')](respondWithStatusCode(_0x32925e,null))[_0x0fcf('0x4c')](handleError(_0x32925e,null));};exports[_0x0fcf('0x97')]=function(_0x144293,_0x5b6d33,_0x2e721b){var _0x2e14d9={};var _0x1ba9f4={};var _0x1c19f4;var _0x12e40f;return db[_0x0fcf('0x49')][_0x0fcf('0x60')]({'where':{'id':_0x144293['params']['id']}})['then'](handleEntityNotFound(_0x5b6d33,null))['then'](function(_0x5e8396){if(_0x5e8396){_0x1c19f4=_0x5e8396;_0x1ba9f4[_0x0fcf('0x3b')]=_[_0x0fcf('0x3d')](db['User'][_0x0fcf('0x39')]);_0x1ba9f4[_0x0fcf('0x3c')]=_['keys'](_0x144293['query']);_0x1ba9f4[_0x0fcf('0x44')]=_[_0x0fcf('0x3e')](_0x1ba9f4[_0x0fcf('0x3b')],_0x1ba9f4[_0x0fcf('0x3c')]);_0x2e14d9[_0x0fcf('0x40')]=_['intersection'](_0x1ba9f4[_0x0fcf('0x3b')],qs['fields'](_0x144293[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x2e14d9['attributes']=_0x2e14d9[_0x0fcf('0x40')]['length']?_0x2e14d9[_0x0fcf('0x40')]:_0x1ba9f4[_0x0fcf('0x3b')];_0x2e14d9['order']=qs[_0x0fcf('0x42')](_0x144293[_0x0fcf('0x3c')]['sort']);_0x2e14d9[_0x0fcf('0x43')]=qs[_0x0fcf('0x44')](_[_0x0fcf('0x69')](_0x144293['query'],_0x1ba9f4[_0x0fcf('0x44')]));if(_0x144293['query'][_0x0fcf('0x2d')]){_0x2e14d9['where']=_[_0x0fcf('0x45')](_0x2e14d9['where'],{'$or':_[_0x0fcf('0x46')](_0x2e14d9[_0x0fcf('0x40')],function(_0x2844d9){var _0x4b3711={};_0x4b3711[_0x2844d9]={'$like':'%'+_0x144293[_0x0fcf('0x3c')]['filter']+'%'};return _0x4b3711;})});}_0x2e14d9=_[_0x0fcf('0x45')]({},_0x2e14d9,_0x144293[_0x0fcf('0x48')]);return _0x1c19f4['getAgents'](_0x2e14d9);}})[_0x0fcf('0x27')](function(_0x3cf124){if(_0x3cf124){_0x12e40f=_0x3cf124[_0x0fcf('0x4f')];if(!_0x144293[_0x0fcf('0x3c')][_0x0fcf('0x62')](_0x0fcf('0x63'))){_0x2e14d9[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x144293[_0x0fcf('0x3c')]['limit']);_0x2e14d9[_0x0fcf('0x1f')]=qs[_0x0fcf('0x1f')](_0x144293[_0x0fcf('0x3c')]['offset']);}return _0x1c19f4[_0x0fcf('0x97')](_0x2e14d9);}})[_0x0fcf('0x27')](function(_0x287dd4){if(_0x287dd4){return _0x287dd4?{'count':_0x12e40f,'rows':_0x287dd4}:null;}})['then'](respondWithResult(_0x5b6d33,null))[_0x0fcf('0x4c')](handleError(_0x5b6d33,null));};exports['getMembers']=function(_0x33a077,_0x23bb38,_0x719ca4){var _0x16d726={};var _0x44a12a={};var _0x460f25;var _0x3972d7;return db['VoiceQueue'][_0x0fcf('0x60')]({'where':{'id':_0x33a077[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x23bb38,null))['then'](function(_0x822f6b){if(_0x822f6b){_0x460f25=_0x822f6b;_0x44a12a['model']=_[_0x0fcf('0x3d')](db['UserVoiceQueueRt']['rawAttributes']);_0x44a12a[_0x0fcf('0x3c')]=_[_0x0fcf('0x3d')](_0x33a077[_0x0fcf('0x3c')]);_0x44a12a[_0x0fcf('0x44')]=_[_0x0fcf('0x3e')](_0x44a12a[_0x0fcf('0x3b')],_0x44a12a['query']);_0x16d726[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x44a12a[_0x0fcf('0x3b')],qs[_0x0fcf('0x3f')](_0x33a077[_0x0fcf('0x3c')]['fields']));_0x16d726[_0x0fcf('0x40')]=_0x16d726[_0x0fcf('0x40')]['length']?_0x16d726[_0x0fcf('0x40')]:_0x44a12a[_0x0fcf('0x3b')];_0x16d726[_0x0fcf('0x41')]=qs[_0x0fcf('0x42')](_0x33a077[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x16d726['where']=qs[_0x0fcf('0x44')](_[_0x0fcf('0x69')](_0x33a077['query'],_0x44a12a[_0x0fcf('0x44')]));if(_0x33a077[_0x0fcf('0x3c')][_0x0fcf('0x2d')]){_0x16d726[_0x0fcf('0x43')]=_[_0x0fcf('0x45')](_0x16d726[_0x0fcf('0x43')],{'$or':_[_0x0fcf('0x46')](_0x16d726[_0x0fcf('0x40')],function(_0x2a4d78){var _0x2f2075={};_0x2f2075[_0x2a4d78]={'$like':'%'+_0x33a077[_0x0fcf('0x3c')][_0x0fcf('0x2d')]+'%'};return _0x2f2075;})});}_0x16d726=_[_0x0fcf('0x45')]({},_0x16d726,_0x33a077[_0x0fcf('0x48')]);return _0x460f25['getMembers'](_0x16d726);}})['then'](function(_0x2df4bc){if(_0x2df4bc){_0x3972d7=_0x2df4bc['length'];if(!_0x33a077[_0x0fcf('0x3c')][_0x0fcf('0x62')](_0x0fcf('0x63'))){_0x16d726[_0x0fcf('0x22')]=qs['limit'](_0x33a077['query']['limit']);_0x16d726['offset']=qs[_0x0fcf('0x1f')](_0x33a077[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}return _0x460f25[_0x0fcf('0x98')](_0x16d726);}})['then'](function(_0x316ed6){return _0x316ed6?{'count':_0x3972d7,'rows':_0x316ed6}:null;})[_0x0fcf('0x27')](respondWithResult(_0x23bb38,null))[_0x0fcf('0x4c')](handleError(_0x23bb38,null));};exports[_0x0fcf('0x99')]=function(_0x5a3316,_0x5adb32,_0x22c6ce){var _0x1f2e43={};var _0x58aac4={};var _0x456db0;var _0x1a7a40;return db[_0x0fcf('0x49')]['findOne']({'where':{'id':_0x5a3316[_0x0fcf('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5adb32,null))[_0x0fcf('0x27')](function(_0x2ab0d7){if(_0x2ab0d7){_0x456db0=_0x2ab0d7;_0x58aac4[_0x0fcf('0x3b')]=_['keys'](db['CmList'][_0x0fcf('0x39')]);_0x58aac4[_0x0fcf('0x3c')]=_['keys'](_0x5a3316[_0x0fcf('0x3c')]);_0x58aac4['filters']=_[_0x0fcf('0x3e')](_0x58aac4[_0x0fcf('0x3b')],_0x58aac4[_0x0fcf('0x3c')]);_0x1f2e43[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x58aac4['model'],qs['fields'](_0x5a3316[_0x0fcf('0x3c')][_0x0fcf('0x3f')]));_0x1f2e43[_0x0fcf('0x40')]=_0x1f2e43['attributes'][_0x0fcf('0x4f')]?_0x1f2e43['attributes']:_0x58aac4['model'];_0x1f2e43[_0x0fcf('0x41')]=qs[_0x0fcf('0x42')](_0x5a3316[_0x0fcf('0x3c')][_0x0fcf('0x42')]);_0x1f2e43[_0x0fcf('0x43')]=qs[_0x0fcf('0x44')](_[_0x0fcf('0x69')](_0x5a3316[_0x0fcf('0x3c')],_0x58aac4[_0x0fcf('0x44')]));if(_0x5a3316['query'][_0x0fcf('0x2d')]){_0x1f2e43['where']=_[_0x0fcf('0x45')](_0x1f2e43[_0x0fcf('0x43')],{'$or':_[_0x0fcf('0x46')](_0x1f2e43[_0x0fcf('0x40')],function(_0x16645d){var _0x1dc10d={};_0x1dc10d[_0x16645d]={'$like':'%'+_0x5a3316[_0x0fcf('0x3c')]['filter']+'%'};return _0x1dc10d;})});}_0x1f2e43=_[_0x0fcf('0x45')]({},_0x1f2e43,_0x5a3316[_0x0fcf('0x48')]);return _0x456db0[_0x0fcf('0x99')](_0x1f2e43);}})[_0x0fcf('0x27')](function(_0x59d7d4){if(_0x59d7d4){_0x1a7a40=_0x59d7d4[_0x0fcf('0x4f')];if(!_0x5a3316[_0x0fcf('0x3c')]['hasOwnProperty']('nolimit')){_0x1f2e43[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x5a3316[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x1f2e43[_0x0fcf('0x1f')]=qs[_0x0fcf('0x1f')](_0x5a3316[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}return _0x456db0['getLists'](_0x1f2e43);}})[_0x0fcf('0x27')](function(_0x1310a7){if(_0x1310a7){return _0x1310a7?{'count':_0x1a7a40,'rows':_0x1310a7}:null;}})[_0x0fcf('0x27')](respondWithResult(_0x5adb32,null))[_0x0fcf('0x4c')](handleError(_0x5adb32,null));};exports['addLists']=function(_0x48ea93,_0x37de1d,_0x4f908a){var _0x2f5658=moment()[_0x0fcf('0x79')](_0x0fcf('0x9a'));var _0x2bf420,_0x317fd5;return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x48ea93[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x37de1d,null))[_0x0fcf('0x27')](function(_0xca1603){if(_0xca1603){_0x317fd5=_0xca1603;return _0xca1603[_0x0fcf('0x9b')](_0x48ea93[_0x0fcf('0x5d')][_0x0fcf('0x7f')],_['omit'](_0x48ea93[_0x0fcf('0x5d')],['ids','id'])||{});}return null;})[_0x0fcf('0x92')](function(_0x3f5f1f){var _0xbd21c3;_0x2bf420=_0x3f5f1f||[];var _0x437119=[];if(_0x3f5f1f){for(var _0x1c3540=0x0;_0x1c3540<_0x3f5f1f[_0x0fcf('0x4f')];_0x1c3540+=0x1){var _0x37c97a=_0x3f5f1f[_0x1c3540]['get']({'plain':!![]});_0x317fd5[_0x0fcf('0x9c')]=_0x48ea93['body'][_0x0fcf('0x9c')]?_0x48ea93[_0x0fcf('0x5d')][_0x0fcf('0x9c')]:_0x317fd5[_0x0fcf('0x9c')];switch(_0x317fd5[_0x0fcf('0x9c')]){case _0x0fcf('0x9d'):_0xbd21c3=squel[_0x0fcf('0x9e')]()['into'](_0x0fcf('0x9f'))[_0x0fcf('0xa0')]([_0x0fcf('0xa1'),_0x0fcf('0xa2'),_0x0fcf('0xa3'),_0x0fcf('0xa4'),_0x0fcf('0x64'),_0x0fcf('0x5b'),'updatedAt'],squel[_0x0fcf('0xa5')]()[_0x0fcf('0x80')](_0x0fcf('0xa1'),_0x0fcf('0xa1'))[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0xa2'))[_0x0fcf('0x80')]('id','ContactId')[_0x0fcf('0x80')](_0x37c97a['CmListId'][_0x0fcf('0x86')](),_0x0fcf('0xa4'))[_0x0fcf('0x80')](_0x48ea93['params']['id'][_0x0fcf('0x86')](),'VoiceQueueId')['field']('\x27'+_0x2f5658+'\x27','createdAt')[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0x5c'))[_0x0fcf('0xa6')]('cm_contacts')[_0x0fcf('0x43')]('deletedAt\x20IS\x20NULL')[_0x0fcf('0x43')](_0x0fcf('0xa7'),_0x37c97a[_0x0fcf('0xa8')][_0x0fcf('0x86')]())[_0x0fcf('0x43')](_0x0fcf('0xa9'))[_0x0fcf('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0fcf('0xa5')]()[_0x0fcf('0x80')](_0x0fcf('0xaa'))['from'](_0x0fcf('0xab'))[_0x0fcf('0x43')](_0x0fcf('0xac'),_0x48ea93['params']['id']['toString']()))[_0x0fcf('0x43')](_0x0fcf('0xad'),squel[_0x0fcf('0xa5')]()[_0x0fcf('0x80')](_0x0fcf('0xae'))[_0x0fcf('0xa6')]('cm_hopper')[_0x0fcf('0x43')](_0x0fcf('0xac'),_0x48ea93[_0x0fcf('0x4e')]['id'][_0x0fcf('0x86')]())))[_0x0fcf('0x86')]();break;case _0x0fcf('0xaf'):_0xbd21c3=squel['insert']()[_0x0fcf('0xb0')](_0x0fcf('0x9f'))[_0x0fcf('0xa0')]([_0x0fcf('0xa1'),_0x0fcf('0xa2'),_0x0fcf('0xa3'),_0x0fcf('0xa4'),_0x0fcf('0x64'),_0x0fcf('0x5b'),_0x0fcf('0x5c')],squel['select']()[_0x0fcf('0x80')](_0x0fcf('0xa1'),_0x0fcf('0xa1'))[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0xa2'))[_0x0fcf('0x80')]('id',_0x0fcf('0xa3'))[_0x0fcf('0x80')](_0x37c97a['CmListId'][_0x0fcf('0x86')](),_0x0fcf('0xa4'))[_0x0fcf('0x80')](_0x48ea93[_0x0fcf('0x4e')]['id'][_0x0fcf('0x86')](),'VoiceQueueId')['field']('\x27'+_0x2f5658+'\x27',_0x0fcf('0x5b'))[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0x5c'))[_0x0fcf('0xa6')](_0x0fcf('0xb1'))[_0x0fcf('0x43')](_0x0fcf('0xb2'))[_0x0fcf('0x43')](_0x0fcf('0xa7'),_0x37c97a['CmListId'][_0x0fcf('0x86')]())[_0x0fcf('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x0fcf('0x43')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0fcf('0x80')](_0x0fcf('0xae'))['from'](_0x0fcf('0x9f'))[_0x0fcf('0x43')](_0x0fcf('0xac'),_0x48ea93['params']['id'][_0x0fcf('0x86')]())))[_0x0fcf('0x86')]();break;default:_0xbd21c3=squel[_0x0fcf('0x9e')]()[_0x0fcf('0xb0')](_0x0fcf('0x9f'))['fromQuery']([_0x0fcf('0xa1'),_0x0fcf('0xa2'),_0x0fcf('0xa3'),_0x0fcf('0xa4'),_0x0fcf('0x64'),'createdAt',_0x0fcf('0x5c')],squel[_0x0fcf('0xa5')]()['field']('phone',_0x0fcf('0xa1'))[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0xa2'))[_0x0fcf('0x80')]('id',_0x0fcf('0xa3'))[_0x0fcf('0x80')](_0x37c97a[_0x0fcf('0xa8')][_0x0fcf('0x86')](),'ListId')['field'](_0x48ea93[_0x0fcf('0x4e')]['id'][_0x0fcf('0x86')](),_0x0fcf('0x64'))[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0x5b'))['field']('\x27'+_0x2f5658+'\x27','updatedAt')[_0x0fcf('0xa6')]('cm_contacts')['where'](_0x0fcf('0xb2'))['where']('ListId\x20=\x20?',_0x37c97a['CmListId'][_0x0fcf('0x86')]())[_0x0fcf('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0fcf('0x86')]();}_0x437119[_0x0fcf('0x85')](db[_0x0fcf('0x74')]['query'](_0xbd21c3));}return BPromise[_0x0fcf('0x94')](_0x437119);}})['then'](function(){var _0x11cdaf=[];var _0x1e8a5b=squel[_0x0fcf('0x9e')]()[_0x0fcf('0xb0')](_0x0fcf('0xb3'))['fromQuery']([_0x0fcf('0xb4'),_0x0fcf('0xa1'),'OrderBy',_0x0fcf('0x5b'),_0x0fcf('0x5c')],squel[_0x0fcf('0xa5')]()[_0x0fcf('0x80')](_0x0fcf('0xb5'))[_0x0fcf('0x80')](_0x0fcf('0xb6'))['field']('ci.OrderBy+1')[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0x5b'))[_0x0fcf('0x80')]('\x27'+_0x2f5658+'\x27',_0x0fcf('0x5c'))[_0x0fcf('0xa6')](_0x0fcf('0xb7'),'ci')[_0x0fcf('0xb8')](_0x0fcf('0x9f'),'h','h.ContactId=ci.CmContactId')[_0x0fcf('0x43')]('h.scheduledat=?',_0x2f5658)[_0x0fcf('0x43')](_0x0fcf('0xb9'),'PHONE'))['toString']();_0x11cdaf[_0x0fcf('0x85')](db['sequelize'][_0x0fcf('0x3c')](_0x1e8a5b));return BPromise[_0x0fcf('0x94')](_0x11cdaf);})['then'](function(){return _0x2bf420;})[_0x0fcf('0x27')](respondWithResult(_0x37de1d,null))[_0x0fcf('0x4c')](handleError(_0x37de1d,null));};exports['removeLists']=function(_0x2c13b6,_0x5ed665,_0x562445){return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x2c13b6[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x5ed665,null))[_0x0fcf('0x27')](function(_0x2dd1e8){if(_0x2dd1e8){return _0x2dd1e8[_0x0fcf('0xba')](_0x2c13b6[_0x0fcf('0x3c')][_0x0fcf('0x7f')]);}})[_0x0fcf('0x27')](function(_0x3f7af9){if(_0x3f7af9){return db[_0x0fcf('0x61')][_0x0fcf('0x28')]({'where':{'ListId':_0x2c13b6[_0x0fcf('0x3c')][_0x0fcf('0x7f')],'VoiceQueueId':_0x2c13b6['params']['id']}})[_0x0fcf('0x27')](function(){return _0x3f7af9;});}})[_0x0fcf('0x27')](respondWithStatusCode(_0x5ed665,null))[_0x0fcf('0x4c')](handleError(_0x5ed665,null));};exports['getBlackLists']=function(_0x3f169c,_0x541439,_0x31a881){var _0x112bb6={};var _0x251f6a={};var _0x306a8f;var _0x7b6dd;return db[_0x0fcf('0x49')]['findOne']({'where':{'id':_0x3f169c[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x541439,null))[_0x0fcf('0x27')](function(_0x3eec19){if(_0x3eec19){_0x306a8f=_0x3eec19;_0x251f6a['model']=_[_0x0fcf('0x3d')](db[_0x0fcf('0xbb')][_0x0fcf('0x39')]);_0x251f6a[_0x0fcf('0x3c')]=_[_0x0fcf('0x3d')](_0x3f169c[_0x0fcf('0x3c')]);_0x251f6a[_0x0fcf('0x44')]=_[_0x0fcf('0x3e')](_0x251f6a[_0x0fcf('0x3b')],_0x251f6a[_0x0fcf('0x3c')]);_0x112bb6[_0x0fcf('0x40')]=_[_0x0fcf('0x3e')](_0x251f6a['model'],qs['fields'](_0x3f169c[_0x0fcf('0x3c')]['fields']));_0x112bb6['attributes']=_0x112bb6[_0x0fcf('0x40')]['length']?_0x112bb6[_0x0fcf('0x40')]:_0x251f6a['model'];_0x112bb6[_0x0fcf('0x41')]=qs[_0x0fcf('0x42')](_0x3f169c['query'][_0x0fcf('0x42')]);_0x112bb6[_0x0fcf('0x43')]=qs[_0x0fcf('0x44')](_[_0x0fcf('0x69')](_0x3f169c['query'],_0x251f6a[_0x0fcf('0x44')]));if(_0x3f169c[_0x0fcf('0x3c')][_0x0fcf('0x2d')]){_0x112bb6[_0x0fcf('0x43')]=_['merge'](_0x112bb6[_0x0fcf('0x43')],{'$or':_['map'](_0x112bb6[_0x0fcf('0x40')],function(_0x33a14a){var _0x523079={};_0x523079[_0x33a14a]={'$like':'%'+_0x3f169c[_0x0fcf('0x3c')][_0x0fcf('0x2d')]+'%'};return _0x523079;})});}_0x112bb6=_[_0x0fcf('0x45')]({},_0x112bb6,_0x3f169c[_0x0fcf('0x48')]);return _0x306a8f[_0x0fcf('0xbc')](_0x112bb6);}})['then'](function(_0x13181f){if(_0x13181f){_0x7b6dd=_0x13181f[_0x0fcf('0x4f')];if(!_0x3f169c[_0x0fcf('0x3c')][_0x0fcf('0x62')](_0x0fcf('0x63'))){_0x112bb6[_0x0fcf('0x22')]=qs[_0x0fcf('0x22')](_0x3f169c[_0x0fcf('0x3c')][_0x0fcf('0x22')]);_0x112bb6['offset']=qs['offset'](_0x3f169c[_0x0fcf('0x3c')][_0x0fcf('0x1f')]);}return _0x306a8f['getBlackLists'](_0x112bb6);}})['then'](function(_0x2c59e7){if(_0x2c59e7){return _0x2c59e7?{'count':_0x7b6dd,'rows':_0x2c59e7}:null;}})[_0x0fcf('0x27')](respondWithResult(_0x541439,null))['catch'](handleError(_0x541439,null));};exports[_0x0fcf('0xbd')]=function(_0x2fb036,_0x39429c,_0x2934e5){var _0x55c118,_0x5f3eed;return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x2fb036['params']['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x39429c,null))[_0x0fcf('0x27')](function(_0x37b65b){if(_0x37b65b){_0x5f3eed=_0x37b65b;return _0x37b65b[_0x0fcf('0xbd')](_0x2fb036[_0x0fcf('0x5d')]['ids'],_[_0x0fcf('0x5a')](_0x2fb036['body'],[_0x0fcf('0x7f'),'id'])||{});}return null;})[_0x0fcf('0x92')](function(_0x32eb87){var _0x31376b;_0x55c118=_0x32eb87||[];var _0x4777d8=[];if(_0x32eb87){for(var _0x254118=0x0;_0x254118<_0x32eb87['length'];_0x254118+=0x1){var _0x40dbec=_0x32eb87[_0x254118]['get']({'plain':!![]});_0x31376b=squel[_0x0fcf('0x9e')]()[_0x0fcf('0xb0')]('cm_hopper_black')[_0x0fcf('0xa0')](['phone','ContactId','ListId',_0x0fcf('0x64'),_0x0fcf('0x5b'),_0x0fcf('0x5c')],squel[_0x0fcf('0xa5')]()[_0x0fcf('0x80')](_0x0fcf('0xa1'),_0x0fcf('0xa1'))[_0x0fcf('0x80')]('id',_0x0fcf('0xa3'))[_0x0fcf('0x80')](_0x40dbec['CmListId'][_0x0fcf('0x86')](),_0x0fcf('0xa4'))[_0x0fcf('0x80')](_0x2fb036[_0x0fcf('0x4e')]['id'][_0x0fcf('0x86')](),_0x0fcf('0x64'))[_0x0fcf('0x80')](_0x0fcf('0xbe'),_0x0fcf('0x5b'))[_0x0fcf('0x80')](_0x0fcf('0xbe'),_0x0fcf('0x5c'))[_0x0fcf('0xa6')](_0x0fcf('0xb1'))[_0x0fcf('0x43')](_0x0fcf('0xb2'))[_0x0fcf('0x43')]('ListId\x20=\x20?',_0x40dbec['CmListId'][_0x0fcf('0x86')]())[_0x0fcf('0x43')](_0x0fcf('0xa9')))['toString']();_0x4777d8[_0x0fcf('0x85')](db['sequelize'][_0x0fcf('0x3c')](_0x31376b));}return BPromise[_0x0fcf('0x94')](_0x4777d8);}})['then'](function(){return _0x55c118;})[_0x0fcf('0x27')](respondWithResult(_0x39429c,null))[_0x0fcf('0x4c')](handleError(_0x39429c,null));};exports[_0x0fcf('0xbf')]=function(_0x1b4251,_0x3351d6,_0x140513){return db[_0x0fcf('0x49')][_0x0fcf('0x30')]({'where':{'id':_0x1b4251[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](handleEntityNotFound(_0x3351d6,null))[_0x0fcf('0x27')](function(_0x570421){if(_0x570421){return _0x570421[_0x0fcf('0xbf')](_0x1b4251[_0x0fcf('0x3c')]['ids']);}})['then'](function(_0x180feb){if(_0x180feb){return db[_0x0fcf('0x6b')][_0x0fcf('0x28')]({'where':{'ListId':_0x1b4251[_0x0fcf('0x3c')][_0x0fcf('0x7f')],'VoiceQueueId':_0x1b4251[_0x0fcf('0x4e')]['id']}})[_0x0fcf('0x27')](function(){return _0x180feb;});}})[_0x0fcf('0x27')](respondWithStatusCode(_0x3351d6,null))[_0x0fcf('0x4c')](handleError(_0x3351d6,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6effdff..d614261 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 _0x517b=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x517b,0x1f3));var _0xb517=function(_0x14d7b8,_0x2419b6){_0x14d7b8=_0x14d7b8-0x0;var _0x35c7cc=_0x517b[_0x14d7b8];return _0x35c7cc;};'use strict';var EventEmitter=require(_0xb517('0x0'));var VoiceQueue=require(_0xb517('0x1'))['db'][_0xb517('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb517('0x3')](0x0);var events={'afterCreate':_0xb517('0x4'),'afterUpdate':_0xb517('0x5'),'afterDestroy':'remove'};function emitEvent(_0x66ca8a){return function(_0x1495db,_0x7c2e26,_0x20fef7){VoiceQueueEvents[_0xb517('0x6')](_0x66ca8a+':'+_0x1495db['id'],_0x1495db);VoiceQueueEvents['emit'](_0x66ca8a,_0x1495db);_0x20fef7(null);};}for(var e in events){if(events[_0xb517('0x7')](e)){var event=events[e];VoiceQueue[_0xb517('0x8')](e,emitEvent(event));}}module[_0xb517('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xba42=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1f6e46,_0x463bba){var _0x312487=function(_0x27660b){while(--_0x27660b){_0x1f6e46['push'](_0x1f6e46['shift']());}};_0x312487(++_0x463bba);}(_0xba42,0x1d8));var _0x2ba4=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0xba42[_0x568a61];return _0x334c3b;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x2ba4('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2ba4('0x1'),'afterUpdate':_0x2ba4('0x2'),'afterDestroy':_0x2ba4('0x3')};function emitEvent(_0x31fb00){return function(_0x29eb76,_0x26af46,_0x396fa9){VoiceQueueEvents[_0x2ba4('0x4')](_0x31fb00+':'+_0x29eb76['id'],_0x29eb76);VoiceQueueEvents['emit'](_0x31fb00,_0x29eb76);_0x396fa9(null);};}for(var e in events){if(events[_0x2ba4('0x5')](e)){var event=events[e];VoiceQueue[_0x2ba4('0x6')](e,emitEvent(event));}}module[_0x2ba4('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 5d196a4..844cb65 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x3f6f78,_0x222d85){var _0x534963=function(_0x42a95b){while(--_0x42a95b){_0x3f6f78['push'](_0x3f6f78['shift']());}};_0x534963(++_0x222d85);}(_0x3e74,0x175));var _0x43e7=function(_0x2a2b04,_0x3a81bc){_0x2a2b04=_0x2a2b04-0x0;var _0x7bd707=_0x3e74[_0x2a2b04];return _0x7bd707;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x97a80f,_0x3d70d7){var _0x534071=function(_0xd8966e){while(--_0xd8966e){_0x97a80f['push'](_0x97a80f['shift']());}};_0x534071(++_0x3d70d7);}(_0x008c,0x188));var _0xc008=function(_0x41c842,_0x3865f6){_0x41c842=_0x41c842-0x0;var _0x15ee6b=_0x008c[_0x41c842];return _0x15ee6b;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1935194..a2a6239 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 _0x3c0e=['options','raw','attributes','limit','include','model','map','GetVoiceQueue','debug','catch','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','request\x20sent','findAll'];(function(_0x21fe87,_0x1cf583){var _0x4f2b4d=function(_0x287762){while(--_0x287762){_0x21fe87['push'](_0x21fe87['shift']());}};_0x4f2b4d(++_0x1cf583);}(_0x3c0e,0x192));var _0xe3c0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3c0e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe3c0('0x0'));var util=require('util');var moment=require(_0xe3c0('0x1'));var BPromise=require(_0xe3c0('0x2'));var rs=require(_0xe3c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3c0('0x4'))['db'];var utils=require(_0xe3c0('0x5'));var logger=require(_0xe3c0('0x6'))(_0xe3c0('0x7'));var config=require(_0xe3c0('0x8'));var jayson=require(_0xe3c0('0x9'));var client=jayson[_0xe3c0('0xa')]['http']({'port':0x232a});config[_0xe3c0('0xb')]=_['defaults'](config[_0xe3c0('0xb')],{'host':_0xe3c0('0xc'),'port':0x18eb});var socket=require(_0xe3c0('0xd'))(new Redis(config['redis']));require(_0xe3c0('0xe'))[_0xe3c0('0xf')](socket);function respondWithRpcPromise(_0x4ab2a4,_0x47bab2,_0x1dfe0c){return new BPromise(function(_0xfe0cb,_0x55f173){return client[_0xe3c0('0x10')](_0x4ab2a4,_0x1dfe0c)[_0xe3c0('0x11')](function(_0x63c06d){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x47bab2,'request\x20sent');logger['debug'](_0xe3c0('0x12'),_0x47bab2,'request\x20sent',JSON[_0xe3c0('0x13')](_0x63c06d));if(_0x63c06d['error']){if(_0x63c06d[_0xe3c0('0x14')][_0xe3c0('0x15')]===0x1f4){logger[_0xe3c0('0x14')](_0xe3c0('0x16'),_0x47bab2,_0x63c06d[_0xe3c0('0x14')][_0xe3c0('0x17')]);return _0x55f173(_0x63c06d[_0xe3c0('0x14')]['message']);}logger[_0xe3c0('0x14')](_0xe3c0('0x16'),_0x47bab2,_0x63c06d['error'][_0xe3c0('0x17')]);return _0xfe0cb(_0x63c06d['error']['message']);}else{logger[_0xe3c0('0x18')](_0xe3c0('0x16'),_0x47bab2,_0xe3c0('0x19'));_0xfe0cb(_0x63c06d['result'][_0xe3c0('0x17')]);}})['catch'](function(_0x4997d5){logger[_0xe3c0('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x47bab2,_0x4997d5);_0x55f173(_0x4997d5);});});}exports['GetVoiceQueue']=function(_0x50baff){var _0x411c4e=this;return new Promise(function(_0x488f94,_0x3937d5){return db['VoiceQueue'][_0xe3c0('0x1a')]({'raw':_0x50baff[_0xe3c0('0x1b')]?_0x50baff['options'][_0xe3c0('0x1c')]===undefined?!![]:![]:!![],'where':_0x50baff[_0xe3c0('0x1b')]?_0x50baff[_0xe3c0('0x1b')]['where']||null:null,'attributes':_0x50baff[_0xe3c0('0x1b')]?_0x50baff['options'][_0xe3c0('0x1d')]||null:null,'limit':_0x50baff[_0xe3c0('0x1b')]?_0x50baff['options'][_0xe3c0('0x1e')]||null:null,'include':_0x50baff['options']?_0x50baff[_0xe3c0('0x1b')][_0xe3c0('0x1f')]?_['map'](_0x50baff[_0xe3c0('0x1b')]['include'],function(_0x18f624){return{'model':db[_0x18f624[_0xe3c0('0x20')]],'as':_0x18f624['as'],'attributes':_0x18f624[_0xe3c0('0x1d')],'include':_0x18f624['include']?_['map'](_0x18f624[_0xe3c0('0x1f')],function(_0x3379b5){return{'model':db[_0x3379b5['model']],'as':_0x3379b5['as'],'attributes':_0x3379b5['attributes'],'include':_0x3379b5[_0xe3c0('0x1f')]?_[_0xe3c0('0x21')](_0x3379b5[_0xe3c0('0x1f')],function(_0xb179c4){return{'model':db[_0xb179c4[_0xe3c0('0x20')]],'as':_0xb179c4['as'],'attributes':_0xb179c4[_0xe3c0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42d67b){logger[_0xe3c0('0x18')](_0xe3c0('0x22'),_0x50baff);logger[_0xe3c0('0x23')](_0xe3c0('0x22'),_0x50baff,JSON[_0xe3c0('0x13')](_0x42d67b));_0x488f94(_0x42d67b);})[_0xe3c0('0x24')](function(_0x1d730a){logger[_0xe3c0('0x14')]('GetVoiceQueue',_0x1d730a['message'],_0x50baff);_0x3937d5(_0x411c4e[_0xe3c0('0x14')](0x1f4,_0x1d730a[_0xe3c0('0x17')]));});});};exports[_0xe3c0('0x25')]=function(_0x4d095c){var _0x5a7855=this;return new Promise(function(_0x3646c5,_0x51037d){return db['VoiceQueue'][_0xe3c0('0x26')]({'raw':_0x4d095c[_0xe3c0('0x1b')]?_0x4d095c['options'][_0xe3c0('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d095c['options']?_0x4d095c[_0xe3c0('0x1b')]['where']||null:null,'attributes':_0x4d095c[_0xe3c0('0x1b')]?_0x4d095c[_0xe3c0('0x1b')][_0xe3c0('0x1d')]||null:null,'include':_0x4d095c[_0xe3c0('0x1b')]?_0x4d095c[_0xe3c0('0x1b')][_0xe3c0('0x1f')]?_[_0xe3c0('0x21')](_0x4d095c[_0xe3c0('0x1b')][_0xe3c0('0x1f')],function(_0x5d6d35){return{'model':db[_0x5d6d35[_0xe3c0('0x20')]],'as':_0x5d6d35['as'],'attributes':_0x5d6d35[_0xe3c0('0x1d')],'include':_0x5d6d35[_0xe3c0('0x1f')]?_[_0xe3c0('0x21')](_0x5d6d35['include'],function(_0x557631){return{'model':db[_0x557631[_0xe3c0('0x20')]],'as':_0x557631['as'],'attributes':_0x557631['attributes'],'include':_0x557631[_0xe3c0('0x1f')]?_[_0xe3c0('0x21')](_0x557631['include'],function(_0x230681){return{'model':db[_0x230681[_0xe3c0('0x20')]],'as':_0x230681['as'],'attributes':_0x230681[_0xe3c0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe3c0('0x11')](function(_0x14e328){logger[_0xe3c0('0x18')](_0xe3c0('0x25'),_0x4d095c);logger[_0xe3c0('0x23')](_0xe3c0('0x25'),_0x4d095c,JSON[_0xe3c0('0x13')](_0x14e328));_0x3646c5(_0x14e328);})[_0xe3c0('0x24')](function(_0x2f10b2){logger[_0xe3c0('0x14')](_0xe3c0('0x25'),_0x2f10b2[_0xe3c0('0x17')],_0x4d095c);_0x51037d(_0x5a7855[_0xe3c0('0x14')](0x1f4,_0x2f10b2[_0xe3c0('0x17')]));});});}; \ No newline at end of file +var _0x9454=['VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueue','ShowVoiceQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x7b148d,_0x1fc376){var _0x5b617c=function(_0x58afac){while(--_0x58afac){_0x7b148d['push'](_0x7b148d['shift']());}};_0x5b617c(++_0x1fc376);}(_0x9454,0x18f));var _0x4945=function(_0x55d9ca,_0x28f676){_0x55d9ca=_0x55d9ca-0x0;var _0x1f06a9=_0x9454[_0x55d9ca];return _0x1f06a9;};'use strict';var _=require(_0x4945('0x0'));var util=require(_0x4945('0x1'));var moment=require(_0x4945('0x2'));var BPromise=require(_0x4945('0x3'));var rs=require(_0x4945('0x4'));var fs=require('fs');var Redis=require(_0x4945('0x5'));var db=require(_0x4945('0x6'))['db'];var utils=require(_0x4945('0x7'));var logger=require('../../config/logger')(_0x4945('0x8'));var config=require('../../config/environment');var jayson=require(_0x4945('0x9'));var client=jayson[_0x4945('0xa')][_0x4945('0xb')]({'port':0x232a});config[_0x4945('0xc')]=_['defaults'](config[_0x4945('0xc')],{'host':_0x4945('0xd'),'port':0x18eb});var socket=require(_0x4945('0xe'))(new Redis(config[_0x4945('0xc')]));require(_0x4945('0xf'))[_0x4945('0x10')](socket);function respondWithRpcPromise(_0x16d866,_0x81618,_0x57679a){return new BPromise(function(_0x5dd5e0,_0x43f8cb){return client[_0x4945('0x11')](_0x16d866,_0x57679a)['then'](function(_0x22a91c){logger[_0x4945('0x12')](_0x4945('0x13'),_0x81618,_0x4945('0x14'));logger['debug'](_0x4945('0x15'),_0x81618,_0x4945('0x14'),JSON[_0x4945('0x16')](_0x22a91c));if(_0x22a91c[_0x4945('0x17')]){if(_0x22a91c['error'][_0x4945('0x18')]===0x1f4){logger[_0x4945('0x17')](_0x4945('0x13'),_0x81618,_0x22a91c[_0x4945('0x17')]['message']);return _0x43f8cb(_0x22a91c[_0x4945('0x17')][_0x4945('0x19')]);}logger[_0x4945('0x17')](_0x4945('0x13'),_0x81618,_0x22a91c[_0x4945('0x17')][_0x4945('0x19')]);return _0x5dd5e0(_0x22a91c[_0x4945('0x17')][_0x4945('0x19')]);}else{logger['info'](_0x4945('0x13'),_0x81618,'request\x20sent');_0x5dd5e0(_0x22a91c[_0x4945('0x1a')][_0x4945('0x19')]);}})[_0x4945('0x1b')](function(_0xaba7f0){logger[_0x4945('0x17')](_0x4945('0x13'),_0x81618,_0xaba7f0);_0x43f8cb(_0xaba7f0);});});}exports['GetVoiceQueue']=function(_0x15ed4d){var _0x5587a2=this;return new Promise(function(_0x372654,_0xcafae7){return db[_0x4945('0x1c')][_0x4945('0x1d')]({'raw':_0x15ed4d[_0x4945('0x1e')]?_0x15ed4d[_0x4945('0x1e')][_0x4945('0x1f')]===undefined?!![]:![]:!![],'where':_0x15ed4d[_0x4945('0x1e')]?_0x15ed4d[_0x4945('0x1e')][_0x4945('0x20')]||null:null,'attributes':_0x15ed4d[_0x4945('0x1e')]?_0x15ed4d[_0x4945('0x1e')][_0x4945('0x21')]||null:null,'limit':_0x15ed4d['options']?_0x15ed4d[_0x4945('0x1e')][_0x4945('0x22')]||null:null,'include':_0x15ed4d['options']?_0x15ed4d[_0x4945('0x1e')][_0x4945('0x23')]?_[_0x4945('0x24')](_0x15ed4d['options'][_0x4945('0x23')],function(_0x1e9390){return{'model':db[_0x1e9390[_0x4945('0x25')]],'as':_0x1e9390['as'],'attributes':_0x1e9390['attributes'],'include':_0x1e9390[_0x4945('0x23')]?_[_0x4945('0x24')](_0x1e9390[_0x4945('0x23')],function(_0x5efd0f){return{'model':db[_0x5efd0f[_0x4945('0x25')]],'as':_0x5efd0f['as'],'attributes':_0x5efd0f[_0x4945('0x21')],'include':_0x5efd0f['include']?_['map'](_0x5efd0f[_0x4945('0x23')],function(_0x335230){return{'model':db[_0x335230[_0x4945('0x25')]],'as':_0x335230['as'],'attributes':_0x335230['attributes']};}):[]};}):[]};}):[]:[]})[_0x4945('0x26')](function(_0x51f96d){logger[_0x4945('0x12')](_0x4945('0x27'),_0x15ed4d);logger['debug']('GetVoiceQueue',_0x15ed4d,JSON[_0x4945('0x16')](_0x51f96d));_0x372654(_0x51f96d);})[_0x4945('0x1b')](function(_0xd937a){logger['error'](_0x4945('0x27'),_0xd937a[_0x4945('0x19')],_0x15ed4d);_0xcafae7(_0x5587a2[_0x4945('0x17')](0x1f4,_0xd937a[_0x4945('0x19')]));});});};exports[_0x4945('0x28')]=function(_0x3d2cce){var _0x2d65fe=this;return new Promise(function(_0x26c383,_0x152826){return db[_0x4945('0x1c')]['find']({'raw':_0x3d2cce[_0x4945('0x1e')]?_0x3d2cce[_0x4945('0x1e')][_0x4945('0x1f')]===undefined?!![]:![]:!![],'where':_0x3d2cce[_0x4945('0x1e')]?_0x3d2cce[_0x4945('0x1e')][_0x4945('0x20')]||null:null,'attributes':_0x3d2cce[_0x4945('0x1e')]?_0x3d2cce['options'][_0x4945('0x21')]||null:null,'include':_0x3d2cce[_0x4945('0x1e')]?_0x3d2cce[_0x4945('0x1e')]['include']?_['map'](_0x3d2cce[_0x4945('0x1e')]['include'],function(_0x2dac29){return{'model':db[_0x2dac29[_0x4945('0x25')]],'as':_0x2dac29['as'],'attributes':_0x2dac29[_0x4945('0x21')],'include':_0x2dac29[_0x4945('0x23')]?_['map'](_0x2dac29[_0x4945('0x23')],function(_0x578309){return{'model':db[_0x578309[_0x4945('0x25')]],'as':_0x578309['as'],'attributes':_0x578309[_0x4945('0x21')],'include':_0x578309['include']?_[_0x4945('0x24')](_0x578309[_0x4945('0x23')],function(_0xa02b52){return{'model':db[_0xa02b52[_0x4945('0x25')]],'as':_0xa02b52['as'],'attributes':_0xa02b52[_0x4945('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4945('0x26')](function(_0x52217f){logger[_0x4945('0x12')](_0x4945('0x28'),_0x3d2cce);logger[_0x4945('0x29')]('ShowVoiceQueue',_0x3d2cce,JSON[_0x4945('0x16')](_0x52217f));_0x26c383(_0x52217f);})[_0x4945('0x1b')](function(_0x20a4df){logger[_0x4945('0x17')](_0x4945('0x28'),_0x20a4df['message'],_0x3d2cce);_0x152826(_0x2d65fe['error'](0x1f4,_0x20a4df['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4508739..47f4e1b 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 _0x1e0c=['save','remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x1e0c,0xe9));var _0xc1e0=function(_0x581bdf,_0x11d27f){_0x581bdf=_0x581bdf-0x0;var _0x44e862=_0x1e0c[_0x581bdf];return _0x44e862;};'use strict';var VoiceQueueEvents=require(_0xc1e0('0x0'));var events=[_0xc1e0('0x1'),_0xc1e0('0x2'),_0xc1e0('0x3')];function createListener(_0x240e98,_0x530e8a){return function(_0x3a9f89){_0x530e8a[_0xc1e0('0x4')](_0x240e98,_0x3a9f89);};}function removeListener(_0x11e56c,_0x543918){return function(){VoiceQueueEvents[_0xc1e0('0x5')](_0x11e56c,_0x543918);};}exports[_0xc1e0('0x6')]=function(_0x3d493b){for(var _0x3c283d=0x0,_0x5ba0a5=events[_0xc1e0('0x7')];_0x3c283d<_0x5ba0a5;_0x3c283d++){var _0x26a689=events[_0x3c283d];var _0x4550cb=createListener(_0xc1e0('0x8')+_0x26a689,_0x3d493b);VoiceQueueEvents['on'](_0x26a689,_0x4550cb);}}; \ No newline at end of file +var _0x4022=['save','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x4999f1,_0x10a2c9){var _0x4dfa37=function(_0x1f92a9){while(--_0x1f92a9){_0x4999f1['push'](_0x4999f1['shift']());}};_0x4dfa37(++_0x10a2c9);}(_0x4022,0x160));var _0x2402=function(_0x82be4d,_0x12df80){_0x82be4d=_0x82be4d-0x0;var _0x3a7400=_0x4022[_0x82be4d];return _0x3a7400;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x2402('0x0'),_0x2402('0x1'),_0x2402('0x2')];function createListener(_0x51b957,_0x3b588a){return function(_0x4876ea){_0x3b588a[_0x2402('0x3')](_0x51b957,_0x4876ea);};}function removeListener(_0x36e8ea,_0x2bffd1){return function(){VoiceQueueEvents[_0x2402('0x4')](_0x36e8ea,_0x2bffd1);};}exports[_0x2402('0x5')]=function(_0x5a30ee){for(var _0x1d0550=0x0,_0x194ee2=events[_0x2402('0x6')];_0x1d0550<_0x194ee2;_0x1d0550++){var _0x40cfa3=events[_0x1d0550];var _0x20831b=createListener(_0x2402('0x7')+_0x40cfa3,_0x5a30ee);VoiceQueueEvents['on'](_0x40cfa3,_0x20831b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 789e6af..b3b2844 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 _0x864b=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','create','put','update','delete','destroy','exports','multer','path'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x864b,0x19c));var _0xb864=function(_0x202a26,_0x5612f3){_0x202a26=_0x202a26-0x0;var _0x3b2f19=_0x864b[_0x202a26];return _0x3b2f19;};'use strict';var multer=require(_0xb864('0x0'));var util=require('util');var path=require(_0xb864('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb864('0x2')]();var fs_extra=require(_0xb864('0x3'));var auth=require(_0xb864('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xb864('0x5')]('/',auth[_0xb864('0x6')](),controller[_0xb864('0x7')]);router['get'](_0xb864('0x8'),auth[_0xb864('0x6')](),controller[_0xb864('0x9')]);router[_0xb864('0x5')]('/index',auth[_0xb864('0x6')](),controller[_0xb864('0xa')]);router[_0xb864('0x5')](_0xb864('0xb'),auth[_0xb864('0x6')](),controller['show']);router['post']('/',auth[_0xb864('0x6')](),controller[_0xb864('0xc')]);router[_0xb864('0xd')](_0xb864('0xb'),auth['isAuthenticated'](),controller[_0xb864('0xe')]);router[_0xb864('0xf')](_0xb864('0xb'),auth[_0xb864('0x6')](),controller[_0xb864('0x10')]);module[_0xb864('0x11')]=router; \ No newline at end of file +var _0x2c40=['multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','post','create','/:id','update','delete','destroy','exports'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0x2c40,0x98));var _0x02c4=function(_0x31a9c8,_0x5dbb11){_0x31a9c8=_0x31a9c8-0x0;var _0x377a0a=_0x2c40[_0x31a9c8];return _0x377a0a;};'use strict';var multer=require(_0x02c4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02c4('0x1'));var router=express[_0x02c4('0x2')]();var fs_extra=require(_0x02c4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x02c4('0x4'));var config=require(_0x02c4('0x5'));var controller=require(_0x02c4('0x6'));router[_0x02c4('0x7')]('/',auth[_0x02c4('0x8')](),controller[_0x02c4('0x9')]);router[_0x02c4('0x7')]('/describe',auth[_0x02c4('0x8')](),controller['describe']);router[_0x02c4('0x7')](_0x02c4('0xa'),auth['isAuthenticated'](),controller[_0x02c4('0xb')]);router[_0x02c4('0x7')]('/:id',auth[_0x02c4('0x8')](),controller['show']);router[_0x02c4('0xc')]('/',auth[_0x02c4('0x8')](),controller[_0x02c4('0xd')]);router['put'](_0x02c4('0xe'),auth[_0x02c4('0x8')](),controller[_0x02c4('0xf')]);router[_0x02c4('0x10')](_0x02c4('0xe'),auth[_0x02c4('0x8')](),controller[_0x02c4('0x11')]);module[_0x02c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e3dd48d..b9c29bd 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 _0xd938=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER'];(function(_0x1d6d91,_0xbd3395){var _0x374d64=function(_0x2d3872){while(--_0x2d3872){_0x1d6d91['push'](_0x1d6d91['shift']());}};_0x374d64(++_0xbd3395);}(_0xd938,0x8a));var _0x8d93=function(_0x4a1fb8,_0x244265){_0x4a1fb8=_0x4a1fb8-0x0;var _0x33ddf9=_0xd938[_0x4a1fb8];return _0x33ddf9;};'use strict';var Sequelize=require(_0x8d93('0x0'));var moment=require(_0x8d93('0x1'));module['exports']={'type':{'type':Sequelize[_0x8d93('0x2')]},'uniqueid':{'type':Sequelize[_0x8d93('0x2')]},'calleridnum':{'type':Sequelize[_0x8d93('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8d93('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x8d93('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x28fb5e){var _0x55824b=moment(_0x28fb5e);var _0x306520=moment(this[_0x8d93('0x4')]('queuecallerjoinAt'))[_0x8d93('0x5')](_0x8d93('0x6'));var _0x175d76=_0x55824b[_0x8d93('0x7')](_0x306520,_0x8d93('0x8'));this[_0x8d93('0x9')]('queuecallerleaveAt',_0x28fb5e);this[_0x8d93('0x9')](_0x8d93('0xa'),_0x175d76||null);}},'position':{'type':Sequelize[_0x8d93('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x8d93('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8d93('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x8d93('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8d93('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8d93('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x8d93('0x2')],'comment':_0x8d93('0xd')},'originalposition':{'type':Sequelize[_0x8d93('0xb')]},'channel':{'type':Sequelize[_0x8d93('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8d93('0x2')]},'connectedlinename':{'type':Sequelize[_0x8d93('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8d93('0x2')]},'exten':{'type':Sequelize[_0x8d93('0x2')]},'priority':{'type':Sequelize[_0x8d93('0x2')]},'holdtime':{'type':Sequelize[_0x8d93('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8d93('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8d93('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8d93('0x2')],'comment':_0x8d93('0xe')},'transferexten':{'type':Sequelize[_0x8d93('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8d93('0x2')]},'disposition':{'type':Sequelize[_0x8d93('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8d93('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x8d93('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaac9=['setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x4efbe4,_0x2b7a8d){var _0x1a373a=function(_0x5493db){while(--_0x5493db){_0x4efbe4['push'](_0x4efbe4['shift']());}};_0x1a373a(++_0x2b7a8d);}(_0xaac9,0x138));var _0x9aac=function(_0x144c0c,_0x113cfe){_0x144c0c=_0x144c0c-0x0;var _0x436221=_0xaac9[_0x144c0c];return _0x436221;};'use strict';var Sequelize=require(_0x9aac('0x0'));var moment=require(_0x9aac('0x1'));module[_0x9aac('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9aac('0x3')]},'calleridnum':{'type':Sequelize[_0x9aac('0x3')]},'calleridname':{'type':Sequelize[_0x9aac('0x3')]},'queue':{'type':Sequelize[_0x9aac('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x9aac('0x4')],'set':function(_0x1a28ba){var _0x5cb4b7=moment(_0x1a28ba);var _0x49b712=moment(this[_0x9aac('0x5')](_0x9aac('0x6')))[_0x9aac('0x7')](_0x9aac('0x8'));var _0x2c8d11=_0x5cb4b7[_0x9aac('0x9')](_0x49b712,_0x9aac('0xa'));this[_0x9aac('0xb')](_0x9aac('0xc'),_0x1a28ba);this[_0x9aac('0xb')]('holdtime',_0x2c8d11||null);}},'position':{'type':Sequelize[_0x9aac('0xd')]},'count':{'type':Sequelize[_0x9aac('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x9aac('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x9aac('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x9aac('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x9aac('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9aac('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9aac('0x3')]},'holdtime':{'type':Sequelize[_0x9aac('0xd')]},'mohtime':{'type':Sequelize[_0x9aac('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9aac('0x3')]},'transfer':{'type':Sequelize[_0x9aac('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9aac('0x3')],'comment':_0x9aac('0x10')},'transferexten':{'type':Sequelize[_0x9aac('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9aac('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x9aac('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9aac('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8a1a0a6..6cdf2a7 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 _0x8803=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','end','json','undefined','count','offset','Content-Range','save','update','then','destroy','sendStatus','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','describe','nolimit','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8803,0xa0));var _0x3880=function(_0x308616,_0x1dd844){_0x308616=_0x308616-0x0;var _0x47ce3c=_0x8803[_0x308616];return _0x47ce3c;};'use strict';var emlformat=require(_0x3880('0x0'));var rimraf=require(_0x3880('0x1'));var zipdir=require(_0x3880('0x2'));var jsonpatch=require(_0x3880('0x3'));var rp=require(_0x3880('0x4'));var moment=require('moment');var BPromise=require(_0x3880('0x5'));var Mustache=require('mustache');var util=require(_0x3880('0x6'));var path=require('path');var sox=require(_0x3880('0x7'));var csv=require(_0x3880('0x8'));var ejs=require(_0x3880('0x9'));var fs=require('fs');var fs_extra=require(_0x3880('0xa'));var _=require(_0x3880('0xb'));var squel=require(_0x3880('0xc'));var crypto=require(_0x3880('0xd'));var jsforce=require(_0x3880('0xe'));var deskjs=require(_0x3880('0xf'));var toCsv=require(_0x3880('0x8'));var querystring=require(_0x3880('0x10'));var Papa=require(_0x3880('0x11'));var Redis=require(_0x3880('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3880('0x13'));var hardwareService=require(_0x3880('0x14'));var logger=require(_0x3880('0x15'))(_0x3880('0x16'));var utils=require(_0x3880('0x17'));var config=require(_0x3880('0x18'));var licenseUtil=require(_0x3880('0x19'));var db=require(_0x3880('0x1a'))['db'];config[_0x3880('0x1b')]=_[_0x3880('0x1c')](config[_0x3880('0x1b')],{'host':_0x3880('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3880('0x1e'))[_0x3880('0x1f')](socket);function respondWithStatusCode(_0x347bbb,_0x5c0da2){_0x5c0da2=_0x5c0da2||0xcc;return function(_0x235257){if(_0x235257){return _0x347bbb['sendStatus'](_0x5c0da2);}return _0x347bbb[_0x3880('0x20')](_0x5c0da2)[_0x3880('0x21')]();};}function respondWithResult(_0x2af258,_0x228cbd){_0x228cbd=_0x228cbd||0xc8;return function(_0x18de7d){if(_0x18de7d){return _0x2af258[_0x3880('0x20')](_0x228cbd)[_0x3880('0x22')](_0x18de7d);}};}function respondWithFilteredResult(_0x16b4e2,_0x4eac26){return function(_0xb43ce1){if(_0xb43ce1){var _0x5b1d43=typeof _0x4eac26['offset']==='undefined'&&typeof _0x4eac26['limit']===_0x3880('0x23');var _0x283a3f=_0xb43ce1[_0x3880('0x24')];var _0x5c4170=_0x5b1d43?0x0:_0x4eac26[_0x3880('0x25')];var _0x14b5f5=_0x5b1d43?_0xb43ce1[_0x3880('0x24')]:_0x4eac26[_0x3880('0x25')]+_0x4eac26['limit'];var _0xcfb7a0;if(_0x14b5f5>=_0x283a3f){_0x14b5f5=_0x283a3f;_0xcfb7a0=0xc8;}else{_0xcfb7a0=0xce;}_0x16b4e2[_0x3880('0x20')](_0xcfb7a0);return _0x16b4e2['set'](_0x3880('0x26'),_0x5c4170+'-'+_0x14b5f5+'/'+_0x283a3f)['json'](_0xb43ce1);}return null;};}function patchUpdates(_0x40be7d){return function(_0x2f383e){try{jsonpatch['apply'](_0x2f383e,_0x40be7d,!![]);}catch(_0x9f0caa){return BPromise['reject'](_0x9f0caa);}return _0x2f383e[_0x3880('0x27')]();};}function saveUpdates(_0x2939e5,_0x9c0234){return function(_0x20868f){if(_0x20868f){return _0x20868f[_0x3880('0x28')](_0x2939e5)[_0x3880('0x29')](function(_0x80e647){return _0x80e647;});}return null;};}function removeEntity(_0x41a22f,_0x77da5d){return function(_0x3732d6){if(_0x3732d6){return _0x3732d6[_0x3880('0x2a')]()[_0x3880('0x29')](function(){_0x41a22f[_0x3880('0x20')](0xcc)[_0x3880('0x21')]();});}};}function handleEntityNotFound(_0x56c926,_0x1577ec){return function(_0x484b7c){if(!_0x484b7c){_0x56c926[_0x3880('0x2b')](0x194);}return _0x484b7c;};}function handleError(_0x8405a,_0x31a1d9){_0x31a1d9=_0x31a1d9||0x1f4;return function(_0xefbeed){logger[_0x3880('0x2c')](_0xefbeed['stack']);if(_0xefbeed[_0x3880('0x2d')]){delete _0xefbeed['name'];}_0x8405a[_0x3880('0x20')](_0x31a1d9)[_0x3880('0x2e')](_0xefbeed);};}exports['index']=function(_0x82d70f,_0x22a693){var _0x5906b9={},_0x13a9d8={},_0x92553e={'count':0x0,'rows':[]};var _0x224f7a=_[_0x3880('0x2f')](db[_0x3880('0x30')][_0x3880('0x31')],function(_0x2639e8){return{'name':_0x2639e8[_0x3880('0x32')],'type':_0x2639e8['type'][_0x3880('0x33')]};});_0x13a9d8[_0x3880('0x34')]=_[_0x3880('0x2f')](_0x224f7a,_0x3880('0x2d'));_0x13a9d8[_0x3880('0x35')]=_[_0x3880('0x36')](_0x82d70f['query']);_0x13a9d8[_0x3880('0x37')]=_['intersection'](_0x13a9d8[_0x3880('0x34')],_0x13a9d8[_0x3880('0x35')]);_0x5906b9[_0x3880('0x38')]=_['intersection'](_0x13a9d8[_0x3880('0x34')],qs['fields'](_0x82d70f['query'][_0x3880('0x39')]));_0x5906b9[_0x3880('0x38')]=_0x5906b9['attributes'][_0x3880('0x3a')]?_0x5906b9[_0x3880('0x38')]:_0x13a9d8[_0x3880('0x34')];if(!_0x82d70f[_0x3880('0x35')][_0x3880('0x3b')]('nolimit')){_0x5906b9[_0x3880('0x3c')]=qs[_0x3880('0x3c')](_0x82d70f['query']['limit']);_0x5906b9['offset']=qs[_0x3880('0x25')](_0x82d70f[_0x3880('0x35')]['offset']);}_0x5906b9[_0x3880('0x3d')]=qs[_0x3880('0x3e')](_0x82d70f[_0x3880('0x35')][_0x3880('0x3e')]);_0x5906b9['where']=qs[_0x3880('0x37')](_[_0x3880('0x3f')](_0x82d70f['query'],_0x13a9d8[_0x3880('0x37')]),_0x224f7a);if(_0x82d70f[_0x3880('0x35')][_0x3880('0x40')]){_0x5906b9['where']=_['merge'](_0x5906b9[_0x3880('0x41')],{'$or':_[_0x3880('0x2f')](_0x224f7a,function(_0xb35089){if(_0xb35089[_0x3880('0x42')]!==_0x3880('0x43')){var _0x58a27e={};_0x58a27e[_0xb35089[_0x3880('0x2d')]]={'$like':'%'+_0x82d70f[_0x3880('0x35')]['filter']+'%'};return _0x58a27e;}})});}_0x5906b9=_[_0x3880('0x44')]({},_0x5906b9,_0x82d70f['options']);var _0x3ec561={'where':_0x5906b9[_0x3880('0x41')]};return db[_0x3880('0x30')][_0x3880('0x24')](_0x3ec561)[_0x3880('0x29')](function(_0x681431){_0x92553e[_0x3880('0x24')]=_0x681431;if(_0x82d70f[_0x3880('0x35')][_0x3880('0x45')]){_0x5906b9[_0x3880('0x46')]=[{'all':!![]}];}return db[_0x3880('0x30')][_0x3880('0x47')](_0x5906b9);})[_0x3880('0x29')](function(_0x2bb51c){_0x92553e[_0x3880('0x48')]=_0x2bb51c;return _0x92553e;})[_0x3880('0x29')](respondWithFilteredResult(_0x22a693,_0x5906b9))[_0x3880('0x49')](handleError(_0x22a693,null));};exports[_0x3880('0x4a')]=function(_0x37c75c,_0x2b4c64){var _0x473448={'raw':![],'where':{'id':_0x37c75c[_0x3880('0x4b')]['id']}},_0x2654bc={};_0x2654bc[_0x3880('0x34')]=_[_0x3880('0x36')](db[_0x3880('0x30')]['rawAttributes']);_0x2654bc[_0x3880('0x35')]=_[_0x3880('0x36')](_0x37c75c[_0x3880('0x35')]);_0x2654bc[_0x3880('0x37')]=_[_0x3880('0x4c')](_0x2654bc['model'],_0x2654bc['query']);_0x473448['attributes']=_['intersection'](_0x2654bc[_0x3880('0x34')],qs[_0x3880('0x39')](_0x37c75c[_0x3880('0x35')][_0x3880('0x39')]));_0x473448['attributes']=_0x473448['attributes'][_0x3880('0x3a')]?_0x473448[_0x3880('0x38')]:_0x2654bc[_0x3880('0x34')];if(_0x37c75c[_0x3880('0x35')][_0x3880('0x45')]){_0x473448[_0x3880('0x46')]=[{'all':!![]}];}_0x473448=_[_0x3880('0x44')]({},_0x473448,_0x37c75c[_0x3880('0x4d')]);return db[_0x3880('0x30')][_0x3880('0x4e')](_0x473448)[_0x3880('0x29')](handleEntityNotFound(_0x2b4c64,null))[_0x3880('0x29')](respondWithResult(_0x2b4c64,null))[_0x3880('0x49')](handleError(_0x2b4c64,null));};exports[_0x3880('0x4f')]=function(_0x11f1c3,_0x24a7c8){return db[_0x3880('0x30')]['create'](_0x11f1c3[_0x3880('0x50')],{})[_0x3880('0x29')](respondWithResult(_0x24a7c8,0xc9))[_0x3880('0x49')](handleError(_0x24a7c8,null));};exports[_0x3880('0x28')]=function(_0x10189e,_0x323a12){if(_0x10189e[_0x3880('0x50')]['id']){delete _0x10189e[_0x3880('0x50')]['id'];}return db[_0x3880('0x30')][_0x3880('0x4e')]({'where':{'id':_0x10189e[_0x3880('0x4b')]['id']}})[_0x3880('0x29')](handleEntityNotFound(_0x323a12,null))[_0x3880('0x29')](saveUpdates(_0x10189e[_0x3880('0x50')],null))[_0x3880('0x29')](respondWithResult(_0x323a12,null))[_0x3880('0x49')](handleError(_0x323a12,null));};exports[_0x3880('0x2a')]=function(_0x1a4718,_0x4d064f){return db['VoiceQueueReport'][_0x3880('0x4e')]({'where':{'id':_0x1a4718[_0x3880('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d064f,null))[_0x3880('0x29')](removeEntity(_0x4d064f,null))['catch'](handleError(_0x4d064f,null));};exports[_0x3880('0x51')]=function(_0x489d64,_0xf111a1){return db['VoiceQueueReport'][_0x3880('0x51')]()[_0x3880('0x29')](respondWithResult(_0xf111a1,null))[_0x3880('0x49')](handleError(_0xf111a1,null));};exports['getVoiceQueuesReport']=function(_0x296eba,_0xd508a3){var _0x7f8d33={},_0x4d51b9={},_0x24da3b={'count':0x0,'rows':[]};_0x4d51b9[_0x3880('0x34')]=_['keys'](db[_0x3880('0x30')]['rawAttributes']);_0x4d51b9[_0x3880('0x35')]=_['keys'](_0x296eba[_0x3880('0x35')]);_0x4d51b9[_0x3880('0x37')]=_[_0x3880('0x4c')](_0x4d51b9[_0x3880('0x34')],_0x4d51b9[_0x3880('0x35')]);_0x7f8d33[_0x3880('0x38')]=_[_0x3880('0x4c')](_0x4d51b9['model'],qs[_0x3880('0x39')](_0x296eba[_0x3880('0x35')]['fields']));_0x7f8d33[_0x3880('0x38')]=_0x7f8d33[_0x3880('0x38')]['length']?_0x7f8d33[_0x3880('0x38')]:_0x4d51b9[_0x3880('0x34')];if(!_0x296eba[_0x3880('0x35')][_0x3880('0x3b')](_0x3880('0x52'))){_0x7f8d33['limit']=qs['limit'](_0x296eba[_0x3880('0x35')][_0x3880('0x3c')]);_0x7f8d33[_0x3880('0x25')]=qs['offset'](_0x296eba[_0x3880('0x35')][_0x3880('0x25')]);}_0x7f8d33[_0x3880('0x3d')]=qs[_0x3880('0x3e')](_0x296eba['query']['sort']);_0x7f8d33[_0x3880('0x41')]=qs[_0x3880('0x37')](_[_0x3880('0x3f')](_0x296eba['query'],_0x4d51b9[_0x3880('0x37')]));if(_0x296eba['query'][_0x3880('0x40')]){_0x7f8d33[_0x3880('0x41')]=_[_0x3880('0x44')](_0x7f8d33[_0x3880('0x41')],{'$or':_['map'](_0x7f8d33[_0x3880('0x38')],function(_0x465d4b){var _0x5e1746={};_0x5e1746[_0x465d4b]={'$like':'%'+_0x296eba[_0x3880('0x35')][_0x3880('0x40')]+'%'};return _0x5e1746;})});}_0x7f8d33=_['merge']({},_0x7f8d33,_0x296eba['options']);var _0x36fdfa={'where':_0x7f8d33[_0x3880('0x41')]};return db[_0x3880('0x30')][_0x3880('0x24')](_0x36fdfa)['then'](function(_0x362910){_0x24da3b['count']=_0x362910;if(_0x296eba['query'][_0x3880('0x45')]){_0x7f8d33[_0x3880('0x46')]=[{'all':!![]}];}return db[_0x3880('0x30')][_0x3880('0x47')](_0x7f8d33);})['then'](function(_0x51fddf){_0x24da3b[_0x3880('0x48')]=_0x51fddf;return _0x24da3b;})[_0x3880('0x29')](respondWithFilteredResult(_0xd508a3,_0x7f8d33,_0x3880('0x53')))[_0x3880('0x49')](handleError(_0xd508a3,null,_0x3880('0x53')));}; \ No newline at end of file +var _0xec7e=['offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','VoiceQueueReport','includeAll','include','findAll','show','params','keys','fields','options','find','create','catch','update','body','describe','getVoiceQueuesReport','rows','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end'];(function(_0x3fab8d,_0x3a43e0){var _0x652a13=function(_0x53cf7d){while(--_0x53cf7d){_0x3fab8d['push'](_0x3fab8d['shift']());}};_0x652a13(++_0x3a43e0);}(_0xec7e,0x82));var _0xeec7=function(_0x59e495,_0x49c037){_0x59e495=_0x59e495-0x0;var _0x1295a3=_0xec7e[_0x59e495];return _0x1295a3;};'use strict';var emlformat=require(_0xeec7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeec7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeec7('0x2'));var BPromise=require(_0xeec7('0x3'));var Mustache=require(_0xeec7('0x4'));var util=require(_0xeec7('0x5'));var path=require(_0xeec7('0x6'));var sox=require(_0xeec7('0x7'));var csv=require(_0xeec7('0x8'));var ejs=require(_0xeec7('0x9'));var fs=require('fs');var fs_extra=require(_0xeec7('0xa'));var _=require(_0xeec7('0xb'));var squel=require(_0xeec7('0xc'));var crypto=require(_0xeec7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeec7('0xe'));var toCsv=require(_0xeec7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeec7('0xf'));var hardwareService=require(_0xeec7('0x10'));var logger=require(_0xeec7('0x11'))(_0xeec7('0x12'));var utils=require(_0xeec7('0x13'));var config=require(_0xeec7('0x14'));var licenseUtil=require(_0xeec7('0x15'));var db=require(_0xeec7('0x16'))['db'];config[_0xeec7('0x17')]=_[_0xeec7('0x18')](config['redis'],{'host':_0xeec7('0x19'),'port':0x18eb});var socket=require(_0xeec7('0x1a'))(new Redis(config[_0xeec7('0x17')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x1e829f,_0x283801){_0x283801=_0x283801||0xcc;return function(_0xf306b7){if(_0xf306b7){return _0x1e829f[_0xeec7('0x1b')](_0x283801);}return _0x1e829f[_0xeec7('0x1c')](_0x283801)[_0xeec7('0x1d')]();};}function respondWithResult(_0x519c25,_0x4be93a){_0x4be93a=_0x4be93a||0xc8;return function(_0x39987a){if(_0x39987a){return _0x519c25[_0xeec7('0x1c')](_0x4be93a)['json'](_0x39987a);}};}function respondWithFilteredResult(_0x5b3e76,_0x3d890a){return function(_0x5fafba){if(_0x5fafba){var _0x594fa7=typeof _0x3d890a[_0xeec7('0x1e')]===_0xeec7('0x1f')&&typeof _0x3d890a[_0xeec7('0x20')]===_0xeec7('0x1f');var _0x59dc1f=_0x5fafba[_0xeec7('0x21')];var _0x35d455=_0x594fa7?0x0:_0x3d890a[_0xeec7('0x1e')];var _0x1134f6=_0x594fa7?_0x5fafba['count']:_0x3d890a[_0xeec7('0x1e')]+_0x3d890a[_0xeec7('0x20')];var _0x37e122;if(_0x1134f6>=_0x59dc1f){_0x1134f6=_0x59dc1f;_0x37e122=0xc8;}else{_0x37e122=0xce;}_0x5b3e76[_0xeec7('0x1c')](_0x37e122);return _0x5b3e76[_0xeec7('0x22')](_0xeec7('0x23'),_0x35d455+'-'+_0x1134f6+'/'+_0x59dc1f)[_0xeec7('0x24')](_0x5fafba);}return null;};}function patchUpdates(_0x3aa191){return function(_0x4ff1ac){try{jsonpatch[_0xeec7('0x25')](_0x4ff1ac,_0x3aa191,!![]);}catch(_0x12a470){return BPromise['reject'](_0x12a470);}return _0x4ff1ac['save']();};}function saveUpdates(_0x4dc6b5,_0x160d20){return function(_0x4c6cdb){if(_0x4c6cdb){return _0x4c6cdb['update'](_0x4dc6b5)[_0xeec7('0x26')](function(_0x5bd9b3){return _0x5bd9b3;});}return null;};}function removeEntity(_0x2b89bb,_0x27678b){return function(_0xc2598b){if(_0xc2598b){return _0xc2598b[_0xeec7('0x27')]()[_0xeec7('0x26')](function(){_0x2b89bb[_0xeec7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bbc84,_0x37ad38){return function(_0xe22fc8){if(!_0xe22fc8){_0x1bbc84['sendStatus'](0x194);}return _0xe22fc8;};}function handleError(_0x332528,_0x374d3a){_0x374d3a=_0x374d3a||0x1f4;return function(_0x590964){logger[_0xeec7('0x28')](_0x590964[_0xeec7('0x29')]);if(_0x590964[_0xeec7('0x2a')]){delete _0x590964[_0xeec7('0x2a')];}_0x332528['status'](_0x374d3a)[_0xeec7('0x2b')](_0x590964);};}exports[_0xeec7('0x2c')]=function(_0x424ed2,_0x3daced){var _0x4f24d9={},_0x13a570={},_0x35244b={'count':0x0,'rows':[]};var _0x590288=_['map'](db['VoiceQueueReport'][_0xeec7('0x2d')],function(_0x5db7bc){return{'name':_0x5db7bc[_0xeec7('0x2e')],'type':_0x5db7bc['type']['key']};});_0x13a570[_0xeec7('0x2f')]=_[_0xeec7('0x30')](_0x590288,_0xeec7('0x2a'));_0x13a570[_0xeec7('0x31')]=_['keys'](_0x424ed2[_0xeec7('0x31')]);_0x13a570[_0xeec7('0x32')]=_[_0xeec7('0x33')](_0x13a570['model'],_0x13a570[_0xeec7('0x31')]);_0x4f24d9[_0xeec7('0x34')]=_[_0xeec7('0x33')](_0x13a570['model'],qs['fields'](_0x424ed2[_0xeec7('0x31')]['fields']));_0x4f24d9[_0xeec7('0x34')]=_0x4f24d9['attributes'][_0xeec7('0x35')]?_0x4f24d9[_0xeec7('0x34')]:_0x13a570['model'];if(!_0x424ed2['query'][_0xeec7('0x36')](_0xeec7('0x37'))){_0x4f24d9[_0xeec7('0x20')]=qs['limit'](_0x424ed2['query'][_0xeec7('0x20')]);_0x4f24d9[_0xeec7('0x1e')]=qs[_0xeec7('0x1e')](_0x424ed2['query'][_0xeec7('0x1e')]);}_0x4f24d9[_0xeec7('0x38')]=qs[_0xeec7('0x39')](_0x424ed2[_0xeec7('0x31')][_0xeec7('0x39')]);_0x4f24d9[_0xeec7('0x3a')]=qs[_0xeec7('0x32')](_[_0xeec7('0x3b')](_0x424ed2[_0xeec7('0x31')],_0x13a570[_0xeec7('0x32')]),_0x590288);if(_0x424ed2['query']['filter']){_0x4f24d9[_0xeec7('0x3a')]=_[_0xeec7('0x3c')](_0x4f24d9[_0xeec7('0x3a')],{'$or':_[_0xeec7('0x30')](_0x590288,function(_0x38cc66){if(_0x38cc66['type']!==_0xeec7('0x3d')){var _0x553010={};_0x553010[_0x38cc66[_0xeec7('0x2a')]]={'$like':'%'+_0x424ed2['query'][_0xeec7('0x3e')]+'%'};return _0x553010;}})});}_0x4f24d9=_[_0xeec7('0x3c')]({},_0x4f24d9,_0x424ed2['options']);var _0xfea1f4={'where':_0x4f24d9[_0xeec7('0x3a')]};return db[_0xeec7('0x3f')][_0xeec7('0x21')](_0xfea1f4)[_0xeec7('0x26')](function(_0xc645bc){_0x35244b[_0xeec7('0x21')]=_0xc645bc;if(_0x424ed2[_0xeec7('0x31')][_0xeec7('0x40')]){_0x4f24d9[_0xeec7('0x41')]=[{'all':!![]}];}return db[_0xeec7('0x3f')][_0xeec7('0x42')](_0x4f24d9);})['then'](function(_0x20f753){_0x35244b['rows']=_0x20f753;return _0x35244b;})[_0xeec7('0x26')](respondWithFilteredResult(_0x3daced,_0x4f24d9))['catch'](handleError(_0x3daced,null));};exports[_0xeec7('0x43')]=function(_0x300dd8,_0x543d4b){var _0x32aeee={'raw':![],'where':{'id':_0x300dd8[_0xeec7('0x44')]['id']}},_0x415d14={};_0x415d14[_0xeec7('0x2f')]=_[_0xeec7('0x45')](db[_0xeec7('0x3f')][_0xeec7('0x2d')]);_0x415d14[_0xeec7('0x31')]=_[_0xeec7('0x45')](_0x300dd8['query']);_0x415d14[_0xeec7('0x32')]=_['intersection'](_0x415d14[_0xeec7('0x2f')],_0x415d14[_0xeec7('0x31')]);_0x32aeee[_0xeec7('0x34')]=_[_0xeec7('0x33')](_0x415d14[_0xeec7('0x2f')],qs[_0xeec7('0x46')](_0x300dd8[_0xeec7('0x31')][_0xeec7('0x46')]));_0x32aeee[_0xeec7('0x34')]=_0x32aeee[_0xeec7('0x34')][_0xeec7('0x35')]?_0x32aeee[_0xeec7('0x34')]:_0x415d14[_0xeec7('0x2f')];if(_0x300dd8['query']['includeAll']){_0x32aeee[_0xeec7('0x41')]=[{'all':!![]}];}_0x32aeee=_[_0xeec7('0x3c')]({},_0x32aeee,_0x300dd8[_0xeec7('0x47')]);return db['VoiceQueueReport'][_0xeec7('0x48')](_0x32aeee)['then'](handleEntityNotFound(_0x543d4b,null))[_0xeec7('0x26')](respondWithResult(_0x543d4b,null))['catch'](handleError(_0x543d4b,null));};exports[_0xeec7('0x49')]=function(_0x382dec,_0x4ebd0d){return db['VoiceQueueReport']['create'](_0x382dec['body'],{})['then'](respondWithResult(_0x4ebd0d,0xc9))[_0xeec7('0x4a')](handleError(_0x4ebd0d,null));};exports[_0xeec7('0x4b')]=function(_0x3bcf97,_0xf7dc67){if(_0x3bcf97[_0xeec7('0x4c')]['id']){delete _0x3bcf97[_0xeec7('0x4c')]['id'];}return db[_0xeec7('0x3f')][_0xeec7('0x48')]({'where':{'id':_0x3bcf97[_0xeec7('0x44')]['id']}})[_0xeec7('0x26')](handleEntityNotFound(_0xf7dc67,null))[_0xeec7('0x26')](saveUpdates(_0x3bcf97['body'],null))[_0xeec7('0x26')](respondWithResult(_0xf7dc67,null))[_0xeec7('0x4a')](handleError(_0xf7dc67,null));};exports['destroy']=function(_0x52e45c,_0x2f1e51){return db['VoiceQueueReport']['find']({'where':{'id':_0x52e45c[_0xeec7('0x44')]['id']}})[_0xeec7('0x26')](handleEntityNotFound(_0x2f1e51,null))[_0xeec7('0x26')](removeEntity(_0x2f1e51,null))[_0xeec7('0x4a')](handleError(_0x2f1e51,null));};exports['describe']=function(_0x25f67e,_0x251c44){return db[_0xeec7('0x3f')][_0xeec7('0x4d')]()[_0xeec7('0x26')](respondWithResult(_0x251c44,null))['catch'](handleError(_0x251c44,null));};exports[_0xeec7('0x4e')]=function(_0x380e0e,_0x44847f){var _0x1ee538={},_0x3bbe87={},_0x601405={'count':0x0,'rows':[]};_0x3bbe87[_0xeec7('0x2f')]=_[_0xeec7('0x45')](db[_0xeec7('0x3f')]['rawAttributes']);_0x3bbe87[_0xeec7('0x31')]=_[_0xeec7('0x45')](_0x380e0e['query']);_0x3bbe87[_0xeec7('0x32')]=_[_0xeec7('0x33')](_0x3bbe87[_0xeec7('0x2f')],_0x3bbe87[_0xeec7('0x31')]);_0x1ee538['attributes']=_[_0xeec7('0x33')](_0x3bbe87[_0xeec7('0x2f')],qs[_0xeec7('0x46')](_0x380e0e['query'][_0xeec7('0x46')]));_0x1ee538[_0xeec7('0x34')]=_0x1ee538['attributes'][_0xeec7('0x35')]?_0x1ee538[_0xeec7('0x34')]:_0x3bbe87[_0xeec7('0x2f')];if(!_0x380e0e[_0xeec7('0x31')][_0xeec7('0x36')]('nolimit')){_0x1ee538[_0xeec7('0x20')]=qs[_0xeec7('0x20')](_0x380e0e['query'][_0xeec7('0x20')]);_0x1ee538['offset']=qs[_0xeec7('0x1e')](_0x380e0e[_0xeec7('0x31')][_0xeec7('0x1e')]);}_0x1ee538[_0xeec7('0x38')]=qs['sort'](_0x380e0e[_0xeec7('0x31')][_0xeec7('0x39')]);_0x1ee538[_0xeec7('0x3a')]=qs[_0xeec7('0x32')](_[_0xeec7('0x3b')](_0x380e0e[_0xeec7('0x31')],_0x3bbe87[_0xeec7('0x32')]));if(_0x380e0e[_0xeec7('0x31')][_0xeec7('0x3e')]){_0x1ee538[_0xeec7('0x3a')]=_[_0xeec7('0x3c')](_0x1ee538[_0xeec7('0x3a')],{'$or':_[_0xeec7('0x30')](_0x1ee538[_0xeec7('0x34')],function(_0xeca068){var _0x56a50c={};_0x56a50c[_0xeca068]={'$like':'%'+_0x380e0e['query'][_0xeec7('0x3e')]+'%'};return _0x56a50c;})});}_0x1ee538=_[_0xeec7('0x3c')]({},_0x1ee538,_0x380e0e[_0xeec7('0x47')]);var _0x425e86={'where':_0x1ee538[_0xeec7('0x3a')]};return db[_0xeec7('0x3f')][_0xeec7('0x21')](_0x425e86)[_0xeec7('0x26')](function(_0x452697){_0x601405[_0xeec7('0x21')]=_0x452697;if(_0x380e0e['query'][_0xeec7('0x40')]){_0x1ee538[_0xeec7('0x41')]=[{'all':!![]}];}return db[_0xeec7('0x3f')][_0xeec7('0x42')](_0x1ee538);})[_0xeec7('0x26')](function(_0x41db36){_0x601405[_0xeec7('0x4f')]=_0x41db36;return _0x601405;})[_0xeec7('0x26')](respondWithFilteredResult(_0x44847f,_0x1ee538,_0xeec7('0x4e')))['catch'](handleError(_0x44847f,null,_0xeec7('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 24d8199..6187fe0 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 _0x6b9a=['events','../../mysqldb','VoiceQueueReport','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x6b9a,0x10e));var _0xa6b9=function(_0x4c3641,_0x168c09){_0x4c3641=_0x4c3641-0x0;var _0x166f37=_0x6b9a[_0x4c3641];return _0x166f37;};'use strict';var EventEmitter=require(_0xa6b9('0x0'));var VoiceQueueReport=require(_0xa6b9('0x1'))['db'][_0xa6b9('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6b9('0x3'),'afterDestroy':_0xa6b9('0x4')};function emitEvent(_0x2fa7f3){return function(_0x4a3df3,_0x5a1502,_0x4fb65b){VoiceQueueReportEvents['emit'](_0x2fa7f3+':'+_0x4a3df3['id'],_0x4a3df3);VoiceQueueReportEvents[_0xa6b9('0x5')](_0x2fa7f3,_0x4a3df3);_0x4fb65b(null);};}for(var e in events){if(events[_0xa6b9('0x6')](e)){var event=events[e];VoiceQueueReport[_0xa6b9('0x7')](e,emitEvent(event));}}module[_0xa6b9('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc8e6=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x14c696,_0x43e421){var _0x39d58e=function(_0x109913){while(--_0x109913){_0x14c696['push'](_0x14c696['shift']());}};_0x39d58e(++_0x43e421);}(_0xc8e6,0x1d7));var _0x6c8e=function(_0x199c9b,_0xd6e4c3){_0x199c9b=_0x199c9b-0x0;var _0x2f4c42=_0xc8e6[_0x199c9b];return _0x2f4c42;};'use strict';var EventEmitter=require(_0x6c8e('0x0'));var VoiceQueueReport=require(_0x6c8e('0x1'))['db'][_0x6c8e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c8e('0x3'),'afterUpdate':_0x6c8e('0x4'),'afterDestroy':_0x6c8e('0x5')};function emitEvent(_0x58f98f){return function(_0x205615,_0x54ff66,_0xbb1e8a){VoiceQueueReportEvents[_0x6c8e('0x6')](_0x58f98f+':'+_0x205615['id'],_0x205615);VoiceQueueReportEvents[_0x6c8e('0x6')](_0x58f98f,_0x205615);_0xbb1e8a(null);};}for(var e in events){if(events[_0x6c8e('0x7')](e)){var event=events[e];VoiceQueueReport[_0x6c8e('0x8')](e,emitEvent(event));}}module[_0x6c8e('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 69b05ef..b8c5b8f 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 _0x6110=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','uniqueid','calleridnum'];(function(_0x389e11,_0x4e3f3b){var _0x1613b7=function(_0xc42a2f){while(--_0xc42a2f){_0x389e11['push'](_0x389e11['shift']());}};_0x1613b7(++_0x4e3f3b);}(_0x6110,0x12b));var _0x0611=function(_0x3abf41,_0x496a68){_0x3abf41=_0x3abf41-0x0;var _0x3255f2=_0x6110[_0x3abf41];return _0x3255f2;};'use strict';var _=require(_0x0611('0x0'));var util=require(_0x0611('0x1'));var logger=require(_0x0611('0x2'))(_0x0611('0x3'));var moment=require(_0x0611('0x4'));var BPromise=require(_0x0611('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0611('0x6'));var config=require(_0x0611('0x7'));var attributes=require(_0x0611('0x8'));module[_0x0611('0x9')]=function(_0x4cefdc,_0x4487db){return _0x4cefdc['define']('VoiceQueueReport',attributes,{'tableName':_0x0611('0xa'),'paranoid':![],'indexes':[{'fields':[_0x0611('0xb')]},{'fields':[_0x0611('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd438=['bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x4e23dd,_0x462f7c){var _0x37c34c=function(_0x387554){while(--_0x387554){_0x4e23dd['push'](_0x4e23dd['shift']());}};_0x37c34c(++_0x462f7c);}(_0xd438,0xf3));var _0x8d43=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xd438[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x8d43('0x0'));var util=require(_0x8d43('0x1'));var logger=require(_0x8d43('0x2'))('api');var moment=require(_0x8d43('0x3'));var BPromise=require(_0x8d43('0x4'));var rp=require(_0x8d43('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d43('0x6'));var attributes=require(_0x8d43('0x7'));module[_0x8d43('0x8')]=function(_0x3290a0,_0x3227f5){return _0x3290a0[_0x8d43('0x9')](_0x8d43('0xa'),attributes,{'tableName':_0x8d43('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8d43('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 65b82ca..f8162d9 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 _0x072d=['defaults','localhost','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x172f5d,_0x2bff0f){var _0x268a72=function(_0x3dba89){while(--_0x3dba89){_0x172f5d['push'](_0x172f5d['shift']());}};_0x268a72(++_0x2bff0f);}(_0x072d,0x1b6));var _0xd072=function(_0x2df79e,_0x25ec37){_0x2df79e=_0x2df79e-0x0;var _0x4b2df7=_0x072d[_0x2df79e];return _0x4b2df7;};'use strict';var _=require(_0xd072('0x0'));var util=require(_0xd072('0x1'));var moment=require(_0xd072('0x2'));var BPromise=require(_0xd072('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd072('0x4'));var db=require(_0xd072('0x5'))['db'];var utils=require(_0xd072('0x6'));var logger=require(_0xd072('0x7'))(_0xd072('0x8'));var config=require(_0xd072('0x9'));var jayson=require(_0xd072('0xa'));var client=jayson['client'][_0xd072('0xb')]({'port':0x232a});config[_0xd072('0xc')]=_[_0xd072('0xd')](config[_0xd072('0xc')],{'host':_0xd072('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd072('0xc')]));require(_0xd072('0xf'))[_0xd072('0x10')](socket);function respondWithRpcPromise(_0x3343c4,_0x5d51e2,_0x394479){return new BPromise(function(_0x4bf72e,_0x69ca4e){return client['request'](_0x3343c4,_0x394479)[_0xd072('0x11')](function(_0x3a5646){logger['info'](_0xd072('0x12'),_0x5d51e2,'request\x20sent');logger[_0xd072('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5d51e2,_0xd072('0x14'),JSON[_0xd072('0x15')](_0x3a5646));if(_0x3a5646['error']){if(_0x3a5646['error'][_0xd072('0x16')]===0x1f4){logger[_0xd072('0x17')](_0xd072('0x12'),_0x5d51e2,_0x3a5646[_0xd072('0x17')][_0xd072('0x18')]);return _0x69ca4e(_0x3a5646[_0xd072('0x17')]['message']);}logger[_0xd072('0x17')](_0xd072('0x12'),_0x5d51e2,_0x3a5646[_0xd072('0x17')]['message']);return _0x4bf72e(_0x3a5646[_0xd072('0x17')][_0xd072('0x18')]);}else{logger[_0xd072('0x19')](_0xd072('0x12'),_0x5d51e2,_0xd072('0x14'));_0x4bf72e(_0x3a5646['result'][_0xd072('0x18')]);}})[_0xd072('0x1a')](function(_0x2cf4b9){logger[_0xd072('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x5d51e2,_0x2cf4b9);_0x69ca4e(_0x2cf4b9);});});}exports[_0xd072('0x1b')]=function(_0x1cb605){var _0x1d1caa=this;return new Promise(function(_0x3a8a67,_0x1937ee){return db[_0xd072('0x1c')]['findAll']({'raw':_0x1cb605[_0xd072('0x1d')]?_0x1cb605[_0xd072('0x1d')][_0xd072('0x1e')]===undefined?!![]:![]:!![],'where':_0x1cb605[_0xd072('0x1d')]?_0x1cb605['options'][_0xd072('0x1f')]||null:null,'attributes':_0x1cb605[_0xd072('0x1d')]?_0x1cb605[_0xd072('0x1d')][_0xd072('0x20')]||null:null,'limit':_0x1cb605[_0xd072('0x1d')]?_0x1cb605[_0xd072('0x1d')]['limit']||null:null,'include':_0x1cb605['options']?_0x1cb605[_0xd072('0x1d')][_0xd072('0x21')]?_['map'](_0x1cb605[_0xd072('0x1d')][_0xd072('0x21')],function(_0x949408){return{'model':db[_0x949408['model']],'as':_0x949408['as'],'attributes':_0x949408[_0xd072('0x20')],'include':_0x949408[_0xd072('0x21')]?_[_0xd072('0x22')](_0x949408['include'],function(_0x47b935){return{'model':db[_0x47b935[_0xd072('0x23')]],'as':_0x47b935['as'],'attributes':_0x47b935[_0xd072('0x20')],'include':_0x47b935['include']?_[_0xd072('0x22')](_0x47b935[_0xd072('0x21')],function(_0x15171d){return{'model':db[_0x15171d[_0xd072('0x23')]],'as':_0x15171d['as'],'attributes':_0x15171d[_0xd072('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39f61b){logger[_0xd072('0x19')]('GetVoiceQueueReport',_0x1cb605);logger[_0xd072('0x13')](_0xd072('0x1b'),_0x1cb605,JSON[_0xd072('0x15')](_0x39f61b));_0x3a8a67(_0x39f61b);})['catch'](function(_0x18e099){logger[_0xd072('0x17')](_0xd072('0x1b'),_0x18e099[_0xd072('0x18')],_0x1cb605);_0x1937ee(_0x1d1caa['error'](0x1f4,_0x18e099['message']));});});};exports[_0xd072('0x24')]=function(_0x3291ae){var _0x398cab=this;return new Promise(function(_0x4295d9,_0xc0afdc){return db['VoiceQueueReport']['create'](_0x3291ae[_0xd072('0x25')],{'raw':_0x3291ae['options']?_0x3291ae[_0xd072('0x1d')][_0xd072('0x1e')]===undefined?!![]:![]:!![]})[_0xd072('0x11')](function(_0x839620){logger[_0xd072('0x19')](_0xd072('0x24'),_0x3291ae);logger[_0xd072('0x13')](_0xd072('0x24'),_0x3291ae,JSON[_0xd072('0x15')](_0x839620));_0x4295d9(_0x839620);})[_0xd072('0x1a')](function(_0xb81151){logger['error']('CreateVoiceQueueReport',_0xb81151['message'],_0x3291ae);_0xc0afdc(_0x398cab[_0xd072('0x17')](0x1f4,_0xb81151[_0xd072('0x18')]));});});};exports[_0xd072('0x26')]=function(_0xda14ec){var _0x3fa086=this;return new Promise(function(_0x167c26,_0x18012d){return db[_0xd072('0x1c')][_0xd072('0x27')](_0xda14ec['body'],{'raw':_0xda14ec[_0xd072('0x1d')]?_0xda14ec[_0xd072('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xda14ec[_0xd072('0x1d')]?_0xda14ec[_0xd072('0x1d')][_0xd072('0x1f')]||null:null,'attributes':_0xda14ec[_0xd072('0x1d')]?_0xda14ec[_0xd072('0x1d')][_0xd072('0x20')]||null:null,'limit':_0xda14ec['options']?_0xda14ec[_0xd072('0x1d')][_0xd072('0x28')]||null:null})[_0xd072('0x11')](function(_0x51f021){logger[_0xd072('0x19')](_0xd072('0x26'),_0xda14ec);logger[_0xd072('0x13')](_0xd072('0x26'),_0xda14ec,JSON[_0xd072('0x15')](_0x51f021));_0x167c26(_0x51f021);})[_0xd072('0x1a')](function(_0x426a1e){logger[_0xd072('0x17')]('UpdateVoiceQueueReport',_0x426a1e[_0xd072('0x18')],_0xda14ec);_0x18012d(_0x3fa086[_0xd072('0x17')](0x1f4,_0x426a1e['message']));});});}; \ No newline at end of file +var _0x7000=['../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','request\x20sent','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','GetVoiceQueueReport','findAll','options','raw','attributes','limit','map','model','include','catch','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4ce960,_0x4258e9){var _0x43a9d1=function(_0xc221e3){while(--_0xc221e3){_0x4ce960['push'](_0x4ce960['shift']());}};_0x43a9d1(++_0x4258e9);}(_0x7000,0x11d));var _0x0700=function(_0x52195d,_0x52e4fd){_0x52195d=_0x52195d-0x0;var _0x522e83=_0x7000[_0x52195d];return _0x522e83;};'use strict';var _=require(_0x0700('0x0'));var util=require(_0x0700('0x1'));var moment=require(_0x0700('0x2'));var BPromise=require(_0x0700('0x3'));var rs=require(_0x0700('0x4'));var fs=require('fs');var Redis=require(_0x0700('0x5'));var db=require(_0x0700('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0700('0x7'))(_0x0700('0x8'));var config=require(_0x0700('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0700('0xa')]({'port':0x232a});config[_0x0700('0xb')]=_[_0x0700('0xc')](config[_0x0700('0xb')],{'host':_0x0700('0xd'),'port':0x18eb});var socket=require(_0x0700('0xe'))(new Redis(config[_0x0700('0xb')]));require(_0x0700('0xf'))['register'](socket);function respondWithRpcPromise(_0x238ff9,_0x36ccc5,_0x2c501a){return new BPromise(function(_0xe7b4eb,_0x4a757c){return client[_0x0700('0x10')](_0x238ff9,_0x2c501a)[_0x0700('0x11')](function(_0x29030c){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x36ccc5,_0x0700('0x12'));logger[_0x0700('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x36ccc5,'request\x20sent',JSON[_0x0700('0x14')](_0x29030c));if(_0x29030c[_0x0700('0x15')]){if(_0x29030c[_0x0700('0x15')][_0x0700('0x16')]===0x1f4){logger[_0x0700('0x15')](_0x0700('0x17'),_0x36ccc5,_0x29030c['error']['message']);return _0x4a757c(_0x29030c[_0x0700('0x15')][_0x0700('0x18')]);}logger[_0x0700('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x36ccc5,_0x29030c['error'][_0x0700('0x18')]);return _0xe7b4eb(_0x29030c['error']['message']);}else{logger[_0x0700('0x19')](_0x0700('0x17'),_0x36ccc5,_0x0700('0x12'));_0xe7b4eb(_0x29030c['result'][_0x0700('0x18')]);}})['catch'](function(_0xa53bb6){logger[_0x0700('0x15')](_0x0700('0x17'),_0x36ccc5,_0xa53bb6);_0x4a757c(_0xa53bb6);});});}exports[_0x0700('0x1a')]=function(_0x4dab1b){var _0x3fe450=this;return new Promise(function(_0x23855e,_0x3377a1){return db['VoiceQueueReport'][_0x0700('0x1b')]({'raw':_0x4dab1b[_0x0700('0x1c')]?_0x4dab1b[_0x0700('0x1c')][_0x0700('0x1d')]===undefined?!![]:![]:!![],'where':_0x4dab1b[_0x0700('0x1c')]?_0x4dab1b['options']['where']||null:null,'attributes':_0x4dab1b[_0x0700('0x1c')]?_0x4dab1b[_0x0700('0x1c')][_0x0700('0x1e')]||null:null,'limit':_0x4dab1b['options']?_0x4dab1b[_0x0700('0x1c')][_0x0700('0x1f')]||null:null,'include':_0x4dab1b['options']?_0x4dab1b[_0x0700('0x1c')]['include']?_[_0x0700('0x20')](_0x4dab1b[_0x0700('0x1c')]['include'],function(_0x2aa489){return{'model':db[_0x2aa489[_0x0700('0x21')]],'as':_0x2aa489['as'],'attributes':_0x2aa489[_0x0700('0x1e')],'include':_0x2aa489[_0x0700('0x22')]?_[_0x0700('0x20')](_0x2aa489['include'],function(_0x4b637d){return{'model':db[_0x4b637d[_0x0700('0x21')]],'as':_0x4b637d['as'],'attributes':_0x4b637d[_0x0700('0x1e')],'include':_0x4b637d[_0x0700('0x22')]?_[_0x0700('0x20')](_0x4b637d['include'],function(_0x2b0142){return{'model':db[_0x2b0142[_0x0700('0x21')]],'as':_0x2b0142['as'],'attributes':_0x2b0142[_0x0700('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0700('0x11')](function(_0x5cad2d){logger[_0x0700('0x19')](_0x0700('0x1a'),_0x4dab1b);logger[_0x0700('0x13')](_0x0700('0x1a'),_0x4dab1b,JSON['stringify'](_0x5cad2d));_0x23855e(_0x5cad2d);})[_0x0700('0x23')](function(_0x4f08e3){logger[_0x0700('0x15')](_0x0700('0x1a'),_0x4f08e3['message'],_0x4dab1b);_0x3377a1(_0x3fe450['error'](0x1f4,_0x4f08e3[_0x0700('0x18')]));});});};exports[_0x0700('0x24')]=function(_0xc2c6b){var _0x5e2a9e=this;return new Promise(function(_0x5cba84,_0x27592a){return db[_0x0700('0x25')][_0x0700('0x26')](_0xc2c6b[_0x0700('0x27')],{'raw':_0xc2c6b[_0x0700('0x1c')]?_0xc2c6b[_0x0700('0x1c')][_0x0700('0x1d')]===undefined?!![]:![]:!![]})[_0x0700('0x11')](function(_0x17fb74){logger[_0x0700('0x19')](_0x0700('0x24'),_0xc2c6b);logger[_0x0700('0x13')](_0x0700('0x24'),_0xc2c6b,JSON['stringify'](_0x17fb74));_0x5cba84(_0x17fb74);})[_0x0700('0x23')](function(_0x50666b){logger[_0x0700('0x15')](_0x0700('0x24'),_0x50666b[_0x0700('0x18')],_0xc2c6b);_0x27592a(_0x5e2a9e[_0x0700('0x15')](0x1f4,_0x50666b['message']));});});};exports[_0x0700('0x28')]=function(_0xabebca){var _0x467372=this;return new Promise(function(_0x256df8,_0xe8f00c){return db[_0x0700('0x25')][_0x0700('0x29')](_0xabebca['body'],{'raw':_0xabebca[_0x0700('0x1c')]?_0xabebca[_0x0700('0x1c')][_0x0700('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabebca[_0x0700('0x1c')]?_0xabebca[_0x0700('0x1c')]['where']||null:null,'attributes':_0xabebca[_0x0700('0x1c')]?_0xabebca[_0x0700('0x1c')][_0x0700('0x1e')]||null:null,'limit':_0xabebca[_0x0700('0x1c')]?_0xabebca[_0x0700('0x1c')]['limit']||null:null})[_0x0700('0x11')](function(_0xd7eca0){logger[_0x0700('0x19')](_0x0700('0x28'),_0xabebca);logger[_0x0700('0x13')](_0x0700('0x28'),_0xabebca,JSON[_0x0700('0x14')](_0xd7eca0));_0x256df8(_0xd7eca0);})['catch'](function(_0x181c02){logger[_0x0700('0x15')](_0x0700('0x28'),_0x181c02[_0x0700('0x18')],_0xabebca);_0xe8f00c(_0x467372[_0x0700('0x15')](0x1f4,_0x181c02[_0x0700('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 02743ff..f1c3cec 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 _0xe157=['emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x4f61a1,_0x35820b){var _0xae8b64=function(_0x4f784c){while(--_0x4f784c){_0x4f61a1['push'](_0x4f61a1['shift']());}};_0xae8b64(++_0x35820b);}(_0xe157,0x13c));var _0x7e15=function(_0x308ed8,_0x385254){_0x308ed8=_0x308ed8-0x0;var _0x21bfc9=_0xe157[_0x308ed8];return _0x21bfc9;};'use strict';var VoiceQueueReportEvents=require(_0x7e15('0x0'));var events=[_0x7e15('0x1'),_0x7e15('0x2'),_0x7e15('0x3')];function createListener(_0x47cf94,_0x4a8e73){return function(_0x5d4a3d){_0x4a8e73[_0x7e15('0x4')](_0x47cf94,_0x5d4a3d);};}function removeListener(_0x1d57f0,_0x1d90ea){return function(){VoiceQueueReportEvents[_0x7e15('0x5')](_0x1d57f0,_0x1d90ea);};}exports[_0x7e15('0x6')]=function(_0x331934){for(var _0x422932=0x0,_0x324e63=events['length'];_0x422932<_0x324e63;_0x422932++){var _0x2bf5e2=events[_0x422932];var _0x3532cb=createListener(_0x7e15('0x7')+_0x2bf5e2,_0x331934);VoiceQueueReportEvents['on'](_0x2bf5e2,_0x3532cb);}}; \ No newline at end of file +var _0x3212=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x3212,0x6f));var _0x2321=function(_0x3d8ca7,_0xcea54a){_0x3d8ca7=_0x3d8ca7-0x0;var _0x16336e=_0x3212[_0x3d8ca7];return _0x16336e;};'use strict';var VoiceQueueReportEvents=require(_0x2321('0x0'));var events=[_0x2321('0x1'),_0x2321('0x2'),_0x2321('0x3')];function createListener(_0x305ffa,_0x232e6c){return function(_0x13a610){_0x232e6c[_0x2321('0x4')](_0x305ffa,_0x13a610);};}function removeListener(_0x4732b7,_0x3e090a){return function(){VoiceQueueReportEvents[_0x2321('0x5')](_0x4732b7,_0x3e090a);};}exports[_0x2321('0x6')]=function(_0x53d2e1){for(var _0x14b94e=0x0,_0x17a560=events[_0x2321('0x7')];_0x14b94e<_0x17a560;_0x14b94e++){var _0x4ff02a=events[_0x14b94e];var _0x900de6=createListener(_0x2321('0x8')+_0x4ff02a,_0x53d2e1);VoiceQueueReportEvents['on'](_0x4ff02a,_0x900de6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 7e59909..c5baa04 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 _0x2feb=['destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x2944b1,_0x729496){var _0xcabfeb=function(_0x46dd9e){while(--_0x46dd9e){_0x2944b1['push'](_0x2944b1['shift']());}};_0xcabfeb(++_0x729496);}(_0x2feb,0x10c));var _0xb2fe=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x2feb[_0x43b08];return _0x5e05f4;};'use strict';var multer=require(_0xb2fe('0x0'));var util=require('util');var path=require(_0xb2fe('0x1'));var timeout=require(_0xb2fe('0x2'));var express=require(_0xb2fe('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2fe('0x4'));var interaction=require(_0xb2fe('0x5'));var config=require(_0xb2fe('0x6'));var controller=require(_0xb2fe('0x7'));router[_0xb2fe('0x8')]('/',auth[_0xb2fe('0x9')](),controller['index']);router[_0xb2fe('0x8')](_0xb2fe('0xa'),auth[_0xb2fe('0x9')](),controller[_0xb2fe('0xb')]);router[_0xb2fe('0xc')]('/',auth[_0xb2fe('0x9')](),controller[_0xb2fe('0xd')]);router[_0xb2fe('0xe')](_0xb2fe('0xa'),auth[_0xb2fe('0x9')](),controller[_0xb2fe('0xf')]);router[_0xb2fe('0x10')](_0xb2fe('0xa'),auth[_0xb2fe('0x9')](),controller[_0xb2fe('0x11')]);module[_0xb2fe('0x12')]=router; \ No newline at end of file +var _0x117d=['./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a007b,_0x2a5ffb){var _0x2482d3=function(_0x4b2c4a){while(--_0x4b2c4a){_0x3a007b['push'](_0x3a007b['shift']());}};_0x2482d3(++_0x2a5ffb);}(_0x117d,0xac));var _0xd117=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x117d[_0x1477ef];return _0x164acd;};'use strict';var multer=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var path=require(_0xd117('0x2'));var timeout=require('connect-timeout');var express=require(_0xd117('0x3'));var router=express[_0xd117('0x4')]();var fs_extra=require(_0xd117('0x5'));var auth=require(_0xd117('0x6'));var interaction=require(_0xd117('0x7'));var config=require('../../config/environment');var controller=require(_0xd117('0x8'));router[_0xd117('0x9')]('/',auth[_0xd117('0xa')](),controller[_0xd117('0xb')]);router['get']('/:id',auth[_0xd117('0xa')](),controller[_0xd117('0xc')]);router[_0xd117('0xd')]('/',auth[_0xd117('0xa')](),controller[_0xd117('0xe')]);router[_0xd117('0xf')](_0xd117('0x10'),auth[_0xd117('0xa')](),controller[_0xd117('0x11')]);router[_0xd117('0x12')](_0xd117('0x10'),auth[_0xd117('0xa')](),controller[_0xd117('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2de6b53..58aee9f 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 _0xf752=['moment','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xf752,0xdc));var _0x2f75=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf752[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2f75('0x0'));module[_0x2f75('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2f75('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2f75('0x3')](_0x2f75('0x4'))}}; \ No newline at end of file +var _0x8655=['moment','exports','STRING','DATE','literal','sequelize'];(function(_0x2478ea,_0x49b6cf){var _0x5bfac9=function(_0x5cad9a){while(--_0x5cad9a){_0x2478ea['push'](_0x2478ea['shift']());}};_0x5bfac9(++_0x49b6cf);}(_0x8655,0x1f1));var _0x5865=function(_0x78849c,_0x10b202){_0x78849c=_0x78849c-0x0;var _0xb7a4b1=_0x8655[_0x78849c];return _0xb7a4b1;};'use strict';var Sequelize=require(_0x5865('0x0'));var moment=require(_0x5865('0x1'));module[_0x5865('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5865('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5865('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5865('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5865('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5865('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5865('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5865('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x5865('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 6d323bf..8e7c94c 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 _0xcf83=['order','sort','pick','filter','where','merge','type','include','rows','show','params','includeAll','options','VoiceQueuesLog','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset'];(function(_0x230a82,_0x505225){var _0x64d7fc=function(_0x5ece6d){while(--_0x5ece6d){_0x230a82['push'](_0x230a82['shift']());}};_0x64d7fc(++_0x505225);}(_0xcf83,0x1c8));var _0x3cf8=function(_0x51a6a5,_0x48ec9c){_0x51a6a5=_0x51a6a5-0x0;var _0x30b481=_0xcf83[_0x51a6a5];return _0x30b481;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cf8('0x0'));var zipdir=require(_0x3cf8('0x1'));var jsonpatch=require(_0x3cf8('0x2'));var rp=require(_0x3cf8('0x3'));var moment=require(_0x3cf8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3cf8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3cf8('0x6'));var csv=require('to-csv');var ejs=require(_0x3cf8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3cf8('0x8'));var squel=require(_0x3cf8('0x9'));var crypto=require(_0x3cf8('0xa'));var jsforce=require(_0x3cf8('0xb'));var deskjs=require(_0x3cf8('0xc'));var toCsv=require(_0x3cf8('0xd'));var querystring=require(_0x3cf8('0xe'));var Papa=require(_0x3cf8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3cf8('0x10'));var as=require(_0x3cf8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cf8('0x12'))(_0x3cf8('0x13'));var utils=require(_0x3cf8('0x14'));var config=require(_0x3cf8('0x15'));var licenseUtil=require(_0x3cf8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x179101,_0x2e7c46){_0x2e7c46=_0x2e7c46||0xcc;return function(_0x435e55){if(_0x435e55){return _0x179101['sendStatus'](_0x2e7c46);}return _0x179101[_0x3cf8('0x17')](_0x2e7c46)[_0x3cf8('0x18')]();};}function respondWithResult(_0x363282,_0x2e2844){_0x2e2844=_0x2e2844||0xc8;return function(_0x5cf17f){if(_0x5cf17f){return _0x363282[_0x3cf8('0x17')](_0x2e2844)[_0x3cf8('0x19')](_0x5cf17f);}};}function respondWithFilteredResult(_0x579bdc,_0x1debfd){return function(_0x51ae85){if(_0x51ae85){var _0x25fb70=typeof _0x1debfd['offset']===_0x3cf8('0x1a')&&typeof _0x1debfd[_0x3cf8('0x1b')]===_0x3cf8('0x1a');var _0x106875=_0x51ae85[_0x3cf8('0x1c')];var _0x5d884e=_0x25fb70?0x0:_0x1debfd['offset'];var _0x4a88c4=_0x25fb70?_0x51ae85['count']:_0x1debfd['offset']+_0x1debfd['limit'];var _0x2c2e22;if(_0x4a88c4>=_0x106875){_0x4a88c4=_0x106875;_0x2c2e22=0xc8;}else{_0x2c2e22=0xce;}_0x579bdc['status'](_0x2c2e22);return _0x579bdc[_0x3cf8('0x1d')](_0x3cf8('0x1e'),_0x5d884e+'-'+_0x4a88c4+'/'+_0x106875)[_0x3cf8('0x19')](_0x51ae85);}return null;};}function patchUpdates(_0x480afa){return function(_0x305e20){try{jsonpatch[_0x3cf8('0x1f')](_0x305e20,_0x480afa,!![]);}catch(_0x3ae3ef){return BPromise[_0x3cf8('0x20')](_0x3ae3ef);}return _0x305e20['save']();};}function saveUpdates(_0x3af73,_0x354f99){return function(_0x2acf76){if(_0x2acf76){return _0x2acf76[_0x3cf8('0x21')](_0x3af73)['then'](function(_0x5cb015){return _0x5cb015;});}return null;};}function removeEntity(_0x1467f1,_0x6d24c0){return function(_0x2eb8c7){if(_0x2eb8c7){return _0x2eb8c7[_0x3cf8('0x22')]()[_0x3cf8('0x23')](function(){_0x1467f1[_0x3cf8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42374b,_0x951d95){return function(_0x28e755){if(!_0x28e755){_0x42374b[_0x3cf8('0x24')](0x194);}return _0x28e755;};}function handleError(_0x6d36a5,_0x248b19){_0x248b19=_0x248b19||0x1f4;return function(_0x5dcea4){logger[_0x3cf8('0x25')](_0x5dcea4[_0x3cf8('0x26')]);if(_0x5dcea4['name']){delete _0x5dcea4[_0x3cf8('0x27')];}_0x6d36a5[_0x3cf8('0x17')](_0x248b19)[_0x3cf8('0x28')](_0x5dcea4);};}exports['index']=function(_0x4ec6e2,_0x1f75fb){var _0x511203={},_0x51de2e={},_0x20e739={'count':0x0,'rows':[]};var _0x5b4413=_[_0x3cf8('0x29')](db['VoiceQueuesLog'][_0x3cf8('0x2a')],function(_0x3bd83a){return{'name':_0x3bd83a[_0x3cf8('0x2b')],'type':_0x3bd83a['type']['key']};});_0x51de2e[_0x3cf8('0x2c')]=_[_0x3cf8('0x29')](_0x5b4413,_0x3cf8('0x27'));_0x51de2e[_0x3cf8('0x2d')]=_[_0x3cf8('0x2e')](_0x4ec6e2['query']);_0x51de2e[_0x3cf8('0x2f')]=_[_0x3cf8('0x30')](_0x51de2e[_0x3cf8('0x2c')],_0x51de2e[_0x3cf8('0x2d')]);_0x511203[_0x3cf8('0x31')]=_[_0x3cf8('0x30')](_0x51de2e[_0x3cf8('0x2c')],qs['fields'](_0x4ec6e2[_0x3cf8('0x2d')][_0x3cf8('0x32')]));_0x511203[_0x3cf8('0x31')]=_0x511203['attributes'][_0x3cf8('0x33')]?_0x511203[_0x3cf8('0x31')]:_0x51de2e['model'];if(!_0x4ec6e2[_0x3cf8('0x2d')][_0x3cf8('0x34')](_0x3cf8('0x35'))){_0x511203[_0x3cf8('0x1b')]=qs[_0x3cf8('0x1b')](_0x4ec6e2[_0x3cf8('0x2d')]['limit']);_0x511203[_0x3cf8('0x36')]=qs[_0x3cf8('0x36')](_0x4ec6e2[_0x3cf8('0x2d')][_0x3cf8('0x36')]);}_0x511203[_0x3cf8('0x37')]=qs[_0x3cf8('0x38')](_0x4ec6e2[_0x3cf8('0x2d')][_0x3cf8('0x38')]);_0x511203['where']=qs[_0x3cf8('0x2f')](_[_0x3cf8('0x39')](_0x4ec6e2[_0x3cf8('0x2d')],_0x51de2e[_0x3cf8('0x2f')]),_0x5b4413);if(_0x4ec6e2[_0x3cf8('0x2d')][_0x3cf8('0x3a')]){_0x511203[_0x3cf8('0x3b')]=_[_0x3cf8('0x3c')](_0x511203['where'],{'$or':_['map'](_0x5b4413,function(_0x322813){if(_0x322813[_0x3cf8('0x3d')]!=='VIRTUAL'){var _0x876b55={};_0x876b55[_0x322813['name']]={'$like':'%'+_0x4ec6e2[_0x3cf8('0x2d')][_0x3cf8('0x3a')]+'%'};return _0x876b55;}})});}_0x511203=_['merge']({},_0x511203,_0x4ec6e2['options']);var _0x4e84b7={'where':_0x511203[_0x3cf8('0x3b')]};return db['VoiceQueuesLog']['count'](_0x4e84b7)[_0x3cf8('0x23')](function(_0x515959){_0x20e739[_0x3cf8('0x1c')]=_0x515959;if(_0x4ec6e2[_0x3cf8('0x2d')]['includeAll']){_0x511203[_0x3cf8('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x511203);})[_0x3cf8('0x23')](function(_0x1650fb){_0x20e739[_0x3cf8('0x3f')]=_0x1650fb;return _0x20e739;})[_0x3cf8('0x23')](respondWithFilteredResult(_0x1f75fb,_0x511203))['catch'](handleError(_0x1f75fb,null));};exports[_0x3cf8('0x40')]=function(_0x1fdfb2,_0x11bc0b){var _0x2efd61={'raw':!![],'where':{'id':_0x1fdfb2[_0x3cf8('0x41')]['id']}},_0x3767ad={};_0x3767ad[_0x3cf8('0x2c')]=_[_0x3cf8('0x2e')](db['VoiceQueuesLog'][_0x3cf8('0x2a')]);_0x3767ad[_0x3cf8('0x2d')]=_[_0x3cf8('0x2e')](_0x1fdfb2[_0x3cf8('0x2d')]);_0x3767ad[_0x3cf8('0x2f')]=_[_0x3cf8('0x30')](_0x3767ad[_0x3cf8('0x2c')],_0x3767ad['query']);_0x2efd61['attributes']=_[_0x3cf8('0x30')](_0x3767ad[_0x3cf8('0x2c')],qs[_0x3cf8('0x32')](_0x1fdfb2[_0x3cf8('0x2d')]['fields']));_0x2efd61[_0x3cf8('0x31')]=_0x2efd61['attributes'][_0x3cf8('0x33')]?_0x2efd61[_0x3cf8('0x31')]:_0x3767ad[_0x3cf8('0x2c')];if(_0x1fdfb2[_0x3cf8('0x2d')][_0x3cf8('0x42')]){_0x2efd61[_0x3cf8('0x3e')]=[{'all':!![]}];}_0x2efd61=_[_0x3cf8('0x3c')]({},_0x2efd61,_0x1fdfb2[_0x3cf8('0x43')]);return db[_0x3cf8('0x44')][_0x3cf8('0x45')](_0x2efd61)[_0x3cf8('0x23')](handleEntityNotFound(_0x11bc0b,null))[_0x3cf8('0x23')](respondWithResult(_0x11bc0b,null))['catch'](handleError(_0x11bc0b,null));};exports[_0x3cf8('0x46')]=function(_0x4dea0b,_0x2aaffc){return db[_0x3cf8('0x44')][_0x3cf8('0x46')](_0x4dea0b['body'],{})[_0x3cf8('0x23')](respondWithResult(_0x2aaffc,0xc9))[_0x3cf8('0x47')](handleError(_0x2aaffc,null));};exports[_0x3cf8('0x21')]=function(_0x3ac9ae,_0x4c5362){if(_0x3ac9ae['body']['id']){delete _0x3ac9ae[_0x3cf8('0x48')]['id'];}return db[_0x3cf8('0x44')]['find']({'where':{'id':_0x3ac9ae['params']['id']}})[_0x3cf8('0x23')](handleEntityNotFound(_0x4c5362,null))[_0x3cf8('0x23')](saveUpdates(_0x3ac9ae['body'],null))[_0x3cf8('0x23')](respondWithResult(_0x4c5362,null))[_0x3cf8('0x47')](handleError(_0x4c5362,null));};exports[_0x3cf8('0x22')]=function(_0xd83b5d,_0x4cd423){return db[_0x3cf8('0x44')][_0x3cf8('0x45')]({'where':{'id':_0xd83b5d[_0x3cf8('0x41')]['id']}})[_0x3cf8('0x23')](handleEntityNotFound(_0x4cd423,null))[_0x3cf8('0x23')](removeEntity(_0x4cd423,null))[_0x3cf8('0x47')](handleError(_0x4cd423,null));}; \ No newline at end of file +var _0xb743=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','reject','save','destroy','then','stack','name','send','index','VoiceQueuesLog','rawAttributes','key','model','map','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3bcb70,_0x59959d){var _0x3ff689=function(_0x3bd3c1){while(--_0x3bd3c1){_0x3bcb70['push'](_0x3bcb70['shift']());}};_0x3ff689(++_0x59959d);}(_0xb743,0x7c));var _0x3b74=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xb743[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x3b74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b74('0x1'));var jsonpatch=require(_0x3b74('0x2'));var rp=require(_0x3b74('0x3'));var moment=require(_0x3b74('0x4'));var BPromise=require(_0x3b74('0x5'));var Mustache=require(_0x3b74('0x6'));var util=require(_0x3b74('0x7'));var path=require(_0x3b74('0x8'));var sox=require(_0x3b74('0x9'));var csv=require(_0x3b74('0xa'));var ejs=require(_0x3b74('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b74('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3b74('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b74('0xe'));var Redis=require(_0x3b74('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3b74('0x10'));var as=require(_0x3b74('0x11'));var hardwareService=require(_0x3b74('0x12'));var logger=require(_0x3b74('0x13'))(_0x3b74('0x14'));var utils=require(_0x3b74('0x15'));var config=require(_0x3b74('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b74('0x17'))['db'];function respondWithStatusCode(_0x42f9e0,_0x3c8738){_0x3c8738=_0x3c8738||0xcc;return function(_0x2a061e){if(_0x2a061e){return _0x42f9e0[_0x3b74('0x18')](_0x3c8738);}return _0x42f9e0[_0x3b74('0x19')](_0x3c8738)['end']();};}function respondWithResult(_0x2437cf,_0x237c51){_0x237c51=_0x237c51||0xc8;return function(_0x4d88de){if(_0x4d88de){return _0x2437cf[_0x3b74('0x19')](_0x237c51)[_0x3b74('0x1a')](_0x4d88de);}};}function respondWithFilteredResult(_0x1d60b8,_0x3f63e2){return function(_0x2cd925){if(_0x2cd925){var _0x47e2f6=typeof _0x3f63e2[_0x3b74('0x1b')]==='undefined'&&typeof _0x3f63e2['limit']===_0x3b74('0x1c');var _0x3d5840=_0x2cd925[_0x3b74('0x1d')];var _0x3ce1d9=_0x47e2f6?0x0:_0x3f63e2['offset'];var _0x4b9d42=_0x47e2f6?_0x2cd925[_0x3b74('0x1d')]:_0x3f63e2['offset']+_0x3f63e2[_0x3b74('0x1e')];var _0x561813;if(_0x4b9d42>=_0x3d5840){_0x4b9d42=_0x3d5840;_0x561813=0xc8;}else{_0x561813=0xce;}_0x1d60b8['status'](_0x561813);return _0x1d60b8['set']('Content-Range',_0x3ce1d9+'-'+_0x4b9d42+'/'+_0x3d5840)[_0x3b74('0x1a')](_0x2cd925);}return null;};}function patchUpdates(_0x51cfad){return function(_0x590795){try{jsonpatch['apply'](_0x590795,_0x51cfad,!![]);}catch(_0x4f20d9){return BPromise[_0x3b74('0x1f')](_0x4f20d9);}return _0x590795[_0x3b74('0x20')]();};}function saveUpdates(_0x1f7eec,_0x297954){return function(_0x30bc29){if(_0x30bc29){return _0x30bc29['update'](_0x1f7eec)['then'](function(_0xaf64bd){return _0xaf64bd;});}return null;};}function removeEntity(_0x26e1b4,_0x37b0c1){return function(_0x3299e8){if(_0x3299e8){return _0x3299e8[_0x3b74('0x21')]()[_0x3b74('0x22')](function(){_0x26e1b4[_0x3b74('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a1ead,_0x2e6c5b){return function(_0xf17109){if(!_0xf17109){_0x2a1ead[_0x3b74('0x18')](0x194);}return _0xf17109;};}function handleError(_0x5631a7,_0xb63004){_0xb63004=_0xb63004||0x1f4;return function(_0x3d5095){logger['error'](_0x3d5095[_0x3b74('0x23')]);if(_0x3d5095['name']){delete _0x3d5095[_0x3b74('0x24')];}_0x5631a7[_0x3b74('0x19')](_0xb63004)[_0x3b74('0x25')](_0x3d5095);};}exports[_0x3b74('0x26')]=function(_0x55eab1,_0xa8ebe0){var _0x4482fd={},_0x3973e3={},_0x3b11e8={'count':0x0,'rows':[]};var _0x10aa2b=_['map'](db[_0x3b74('0x27')][_0x3b74('0x28')],function(_0x299860){return{'name':_0x299860['fieldName'],'type':_0x299860['type'][_0x3b74('0x29')]};});_0x3973e3[_0x3b74('0x2a')]=_[_0x3b74('0x2b')](_0x10aa2b,'name');_0x3973e3[_0x3b74('0x2c')]=_[_0x3b74('0x2d')](_0x55eab1[_0x3b74('0x2c')]);_0x3973e3[_0x3b74('0x2e')]=_['intersection'](_0x3973e3['model'],_0x3973e3['query']);_0x4482fd[_0x3b74('0x2f')]=_['intersection'](_0x3973e3[_0x3b74('0x2a')],qs[_0x3b74('0x30')](_0x55eab1[_0x3b74('0x2c')][_0x3b74('0x30')]));_0x4482fd[_0x3b74('0x2f')]=_0x4482fd[_0x3b74('0x2f')][_0x3b74('0x31')]?_0x4482fd[_0x3b74('0x2f')]:_0x3973e3[_0x3b74('0x2a')];if(!_0x55eab1['query']['hasOwnProperty'](_0x3b74('0x32'))){_0x4482fd[_0x3b74('0x1e')]=qs[_0x3b74('0x1e')](_0x55eab1[_0x3b74('0x2c')][_0x3b74('0x1e')]);_0x4482fd[_0x3b74('0x1b')]=qs[_0x3b74('0x1b')](_0x55eab1[_0x3b74('0x2c')][_0x3b74('0x1b')]);}_0x4482fd['order']=qs['sort'](_0x55eab1['query'][_0x3b74('0x33')]);_0x4482fd[_0x3b74('0x34')]=qs[_0x3b74('0x2e')](_[_0x3b74('0x35')](_0x55eab1[_0x3b74('0x2c')],_0x3973e3['filters']),_0x10aa2b);if(_0x55eab1['query'][_0x3b74('0x36')]){_0x4482fd[_0x3b74('0x34')]=_[_0x3b74('0x37')](_0x4482fd[_0x3b74('0x34')],{'$or':_[_0x3b74('0x2b')](_0x10aa2b,function(_0x1b3d01){if(_0x1b3d01[_0x3b74('0x38')]!==_0x3b74('0x39')){var _0x1b61a1={};_0x1b61a1[_0x1b3d01['name']]={'$like':'%'+_0x55eab1[_0x3b74('0x2c')][_0x3b74('0x36')]+'%'};return _0x1b61a1;}})});}_0x4482fd=_[_0x3b74('0x37')]({},_0x4482fd,_0x55eab1[_0x3b74('0x3a')]);var _0x3d45d6={'where':_0x4482fd[_0x3b74('0x34')]};return db[_0x3b74('0x27')][_0x3b74('0x1d')](_0x3d45d6)[_0x3b74('0x22')](function(_0x2337e2){_0x3b11e8[_0x3b74('0x1d')]=_0x2337e2;if(_0x55eab1[_0x3b74('0x2c')][_0x3b74('0x3b')]){_0x4482fd[_0x3b74('0x3c')]=[{'all':!![]}];}return db[_0x3b74('0x27')][_0x3b74('0x3d')](_0x4482fd);})[_0x3b74('0x22')](function(_0x5f39ba){_0x3b11e8[_0x3b74('0x3e')]=_0x5f39ba;return _0x3b11e8;})[_0x3b74('0x22')](respondWithFilteredResult(_0xa8ebe0,_0x4482fd))['catch'](handleError(_0xa8ebe0,null));};exports[_0x3b74('0x3f')]=function(_0xfd4f4b,_0x4380c8){var _0x1818b5={'raw':!![],'where':{'id':_0xfd4f4b[_0x3b74('0x40')]['id']}},_0x3a9124={};_0x3a9124['model']=_[_0x3b74('0x2d')](db[_0x3b74('0x27')][_0x3b74('0x28')]);_0x3a9124[_0x3b74('0x2c')]=_[_0x3b74('0x2d')](_0xfd4f4b[_0x3b74('0x2c')]);_0x3a9124[_0x3b74('0x2e')]=_['intersection'](_0x3a9124[_0x3b74('0x2a')],_0x3a9124[_0x3b74('0x2c')]);_0x1818b5['attributes']=_[_0x3b74('0x41')](_0x3a9124[_0x3b74('0x2a')],qs['fields'](_0xfd4f4b['query'][_0x3b74('0x30')]));_0x1818b5[_0x3b74('0x2f')]=_0x1818b5[_0x3b74('0x2f')][_0x3b74('0x31')]?_0x1818b5[_0x3b74('0x2f')]:_0x3a9124[_0x3b74('0x2a')];if(_0xfd4f4b[_0x3b74('0x2c')][_0x3b74('0x3b')]){_0x1818b5[_0x3b74('0x3c')]=[{'all':!![]}];}_0x1818b5=_[_0x3b74('0x37')]({},_0x1818b5,_0xfd4f4b['options']);return db[_0x3b74('0x27')][_0x3b74('0x42')](_0x1818b5)[_0x3b74('0x22')](handleEntityNotFound(_0x4380c8,null))[_0x3b74('0x22')](respondWithResult(_0x4380c8,null))[_0x3b74('0x43')](handleError(_0x4380c8,null));};exports['create']=function(_0x9d3d71,_0xfef656){return db[_0x3b74('0x27')][_0x3b74('0x44')](_0x9d3d71[_0x3b74('0x45')],{})[_0x3b74('0x22')](respondWithResult(_0xfef656,0xc9))[_0x3b74('0x43')](handleError(_0xfef656,null));};exports[_0x3b74('0x46')]=function(_0x3de7b9,_0xdba13a){if(_0x3de7b9[_0x3b74('0x45')]['id']){delete _0x3de7b9[_0x3b74('0x45')]['id'];}return db[_0x3b74('0x27')]['find']({'where':{'id':_0x3de7b9[_0x3b74('0x40')]['id']}})[_0x3b74('0x22')](handleEntityNotFound(_0xdba13a,null))[_0x3b74('0x22')](saveUpdates(_0x3de7b9['body'],null))[_0x3b74('0x22')](respondWithResult(_0xdba13a,null))[_0x3b74('0x43')](handleError(_0xdba13a,null));};exports[_0x3b74('0x21')]=function(_0x47d9b3,_0x57eeb2){return db[_0x3b74('0x27')][_0x3b74('0x42')]({'where':{'id':_0x47d9b3[_0x3b74('0x40')]['id']}})[_0x3b74('0x22')](handleEntityNotFound(_0x57eeb2,null))[_0x3b74('0x22')](removeEntity(_0x57eeb2,null))[_0x3b74('0x43')](handleError(_0x57eeb2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2a56460..b6a5bfc 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 _0xf579=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','moment','bluebird'];(function(_0x2dd83b,_0x3a09a1){var _0x4c356c=function(_0x459ae0){while(--_0x459ae0){_0x2dd83b['push'](_0x2dd83b['shift']());}};_0x4c356c(++_0x3a09a1);}(_0xf579,0x1bc));var _0x9f57=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xf579[_0x16d10f];return _0x50c823;};'use strict';var _=require('lodash');var util=require(_0x9f57('0x0'));var logger=require(_0x9f57('0x1'))('api');var moment=require(_0x9f57('0x2'));var BPromise=require(_0x9f57('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f57('0x4'));var rimraf=require(_0x9f57('0x5'));var config=require(_0x9f57('0x6'));var attributes=require(_0x9f57('0x7'));module['exports']=function(_0x43f7d4,_0x4a8c49){return _0x43f7d4[_0x9f57('0x8')](_0x9f57('0x9'),attributes,{'tableName':_0x9f57('0xa'),'paranoid':![],'indexes':[{'name':_0x9f57('0xb'),'fields':[_0x9f57('0xc'),_0x9f57('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb081=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','lodash'];(function(_0x123b4a,_0x5e03a7){var _0x1b3507=function(_0x178917){while(--_0x178917){_0x123b4a['push'](_0x123b4a['shift']());}};_0x1b3507(++_0x5e03a7);}(_0xb081,0x1a3));var _0x1b08=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0xb081[_0x20ae13];return _0x533fd5;};'use strict';var _=require(_0x1b08('0x0'));var util=require(_0x1b08('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1b08('0x2'));var BPromise=require(_0x1b08('0x3'));var rp=require(_0x1b08('0x4'));var fs=require('fs');var path=require(_0x1b08('0x5'));var rimraf=require(_0x1b08('0x6'));var config=require(_0x1b08('0x7'));var attributes=require(_0x1b08('0x8'));module[_0x1b08('0x9')]=function(_0x1e2564,_0x20ad4a){return _0x1e2564[_0x1b08('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x1b08('0xb'),'paranoid':![],'indexes':[{'name':_0x1b08('0xc'),'fields':[_0x1b08('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0325884..7d9d1b1 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 _0x0689=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x26e062,_0x16c30a){var _0x31067b=function(_0x673bad){while(--_0x673bad){_0x26e062['push'](_0x26e062['shift']());}};_0x31067b(++_0x16c30a);}(_0x0689,0x10f));var _0x9068=function(_0x1e660a,_0x5bb483){_0x1e660a=_0x1e660a-0x0;var _0x11507b=_0x0689[_0x1e660a];return _0x11507b;};'use strict';var _=require(_0x9068('0x0'));var util=require('util');var moment=require(_0x9068('0x1'));var BPromise=require('bluebird');var rs=require(_0x9068('0x2'));var fs=require('fs');var Redis=require(_0x9068('0x3'));var db=require(_0x9068('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9068('0x5'))('rpc');var config=require(_0x9068('0x6'));var jayson=require(_0x9068('0x7'));var client=jayson[_0x9068('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554a90,_0xea1f21,_0x3a7c67){return new BPromise(function(_0x34e96b,_0x1169e6){return client[_0x9068('0x9')](_0x554a90,_0x3a7c67)[_0x9068('0xa')](function(_0x3ed4ab){logger[_0x9068('0xb')](_0x9068('0xc'),_0xea1f21,_0x9068('0xd'));logger[_0x9068('0xe')](_0x9068('0xf'),_0xea1f21,_0x9068('0xd'),JSON[_0x9068('0x10')](_0x3ed4ab));if(_0x3ed4ab[_0x9068('0x11')]){if(_0x3ed4ab[_0x9068('0x11')]['code']===0x1f4){logger[_0x9068('0x11')](_0x9068('0xc'),_0xea1f21,_0x3ed4ab[_0x9068('0x11')]['message']);return _0x1169e6(_0x3ed4ab['error'][_0x9068('0x12')]);}logger[_0x9068('0x11')](_0x9068('0xc'),_0xea1f21,_0x3ed4ab[_0x9068('0x11')][_0x9068('0x12')]);return _0x34e96b(_0x3ed4ab[_0x9068('0x11')][_0x9068('0x12')]);}else{logger[_0x9068('0xb')](_0x9068('0xc'),_0xea1f21,_0x9068('0xd'));_0x34e96b(_0x3ed4ab['result'][_0x9068('0x12')]);}})[_0x9068('0x13')](function(_0x3f02bb){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xea1f21,_0x3f02bb);_0x1169e6(_0x3f02bb);});});} \ No newline at end of file +var _0xbb50=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5c07ed,_0x1ab3b8){var _0x2163ea=function(_0x59867e){while(--_0x59867e){_0x5c07ed['push'](_0x5c07ed['shift']());}};_0x2163ea(++_0x1ab3b8);}(_0xbb50,0x11b));var _0x0bb5=function(_0x50526c,_0x1c5b97){_0x50526c=_0x50526c-0x0;var _0x57ec3f=_0xbb50[_0x50526c];return _0x57ec3f;};'use strict';var _=require(_0x0bb5('0x0'));var util=require(_0x0bb5('0x1'));var moment=require(_0x0bb5('0x2'));var BPromise=require(_0x0bb5('0x3'));var rs=require(_0x0bb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bb5('0x6'))('rpc');var config=require(_0x0bb5('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3efc5e,_0x4f5873,_0x68048b){return new BPromise(function(_0x39f686,_0x2f3d34){return client['request'](_0x3efc5e,_0x68048b)[_0x0bb5('0x8')](function(_0x2b814e){logger[_0x0bb5('0x9')](_0x0bb5('0xa'),_0x4f5873,_0x0bb5('0xb'));logger[_0x0bb5('0xc')](_0x0bb5('0xd'),_0x4f5873,_0x0bb5('0xb'),JSON[_0x0bb5('0xe')](_0x2b814e));if(_0x2b814e[_0x0bb5('0xf')]){if(_0x2b814e['error'][_0x0bb5('0x10')]===0x1f4){logger[_0x0bb5('0xf')](_0x0bb5('0xa'),_0x4f5873,_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);return _0x2f3d34(_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);}logger[_0x0bb5('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4f5873,_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);return _0x39f686(_0x2b814e[_0x0bb5('0xf')][_0x0bb5('0x11')]);}else{logger['info'](_0x0bb5('0xa'),_0x4f5873,_0x0bb5('0xb'));_0x39f686(_0x2b814e[_0x0bb5('0x12')]['message']);}})[_0x0bb5('0x13')](function(_0x54b2a0){logger[_0x0bb5('0xf')](_0x0bb5('0xa'),_0x4f5873,_0x54b2a0);_0x2f3d34(_0x54b2a0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c3e6655..0205dde 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 _0x5ef9=['downloadTranscribe','post','create','runTranscribe','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/download','download','downloads','/:id/transcribe'];(function(_0x53ef36,_0x3ca663){var _0x1546e9=function(_0x5ca783){while(--_0x5ca783){_0x53ef36['push'](_0x53ef36['shift']());}};_0x1546e9(++_0x3ca663);}(_0x5ef9,0x198));var _0x95ef=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x5ef9[_0x4063a4];return _0x17908d;};'use strict';var multer=require(_0x95ef('0x0'));var util=require(_0x95ef('0x1'));var path=require(_0x95ef('0x2'));var timeout=require(_0x95ef('0x3'));var express=require(_0x95ef('0x4'));var router=express[_0x95ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x95ef('0x6'));var interaction=require(_0x95ef('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x95ef('0x8')]('/',auth[_0x95ef('0x9')](),controller[_0x95ef('0xa')]);router[_0x95ef('0x8')]('/describe',auth[_0x95ef('0x9')](),controller[_0x95ef('0xb')]);router[_0x95ef('0x8')](_0x95ef('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x95ef('0x8')](_0x95ef('0xd'),auth[_0x95ef('0x9')](),controller[_0x95ef('0xe')]);router['get']('/:id/downloads',controller[_0x95ef('0xf')]);router[_0x95ef('0x8')](_0x95ef('0x10'),auth[_0x95ef('0x9')](),controller[_0x95ef('0x11')]);router[_0x95ef('0x12')]('/',auth['isAuthenticated'](),controller[_0x95ef('0x13')]);router[_0x95ef('0x12')](_0x95ef('0x10'),auth[_0x95ef('0x9')](),controller[_0x95ef('0x14')]);router[_0x95ef('0x15')]('/:id',auth[_0x95ef('0x9')](),controller[_0x95ef('0x16')]);router['delete'](_0x95ef('0xc'),auth[_0x95ef('0x9')](),controller[_0x95ef('0x17')]);module[_0x95ef('0x18')]=router; \ No newline at end of file +var _0xe453=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','downloadTranscribe','post','create','/:id/transcribe','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4ac3b6,_0x349bb0){var _0x1f0b18=function(_0x4665eb){while(--_0x4665eb){_0x4ac3b6['push'](_0x4ac3b6['shift']());}};_0x1f0b18(++_0x349bb0);}(_0xe453,0x1f1));var _0x3e45=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe453[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x3e45('0x0'));var path=require(_0x3e45('0x1'));var timeout=require(_0x3e45('0x2'));var express=require(_0x3e45('0x3'));var router=express['Router']();var fs_extra=require(_0x3e45('0x4'));var auth=require(_0x3e45('0x5'));var interaction=require(_0x3e45('0x6'));var config=require(_0x3e45('0x7'));var controller=require(_0x3e45('0x8'));router[_0x3e45('0x9')]('/',auth[_0x3e45('0xa')](),controller['index']);router[_0x3e45('0x9')](_0x3e45('0xb'),auth[_0x3e45('0xa')](),controller[_0x3e45('0xc')]);router[_0x3e45('0x9')](_0x3e45('0xd'),auth['isAuthenticated'](),controller[_0x3e45('0xe')]);router['get'](_0x3e45('0xf'),auth[_0x3e45('0xa')](),controller[_0x3e45('0x10')]);router[_0x3e45('0x9')]('/:id/downloads',controller['downloads']);router[_0x3e45('0x9')]('/:id/transcribe',auth[_0x3e45('0xa')](),controller[_0x3e45('0x11')]);router[_0x3e45('0x12')]('/',auth[_0x3e45('0xa')](),controller[_0x3e45('0x13')]);router[_0x3e45('0x12')](_0x3e45('0x14'),auth[_0x3e45('0xa')](),controller['runTranscribe']);router['put'](_0x3e45('0xd'),auth[_0x3e45('0xa')](),controller[_0x3e45('0x15')]);router[_0x3e45('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x3e45('0x17')]);module[_0x3e45('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 f510431..b5716c5 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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 aff1394..863652c 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 _0x13da=['[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data2','Cloud\x20Provider\x20not\x20configured','data1','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','stack','index','map','VoiceRecording','rawAttributes','key','model','differenceBy','name','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','type','filter','options','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','downloads','sequelize','MD5','col','$and','push','%s.cypher','recording','ValidationError','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','listBuckets','createBucket','upload'];(function(_0x1daafa,_0x5562d5){var _0x421f30=function(_0x348eea){while(--_0x348eea){_0x1daafa['push'](_0x1daafa['shift']());}};_0x421f30(++_0x5562d5);}(_0x13da,0x1e2));var _0xa13d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x13da[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xa13d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa13d('0x1'));var jsonpatch=require(_0xa13d('0x2'));var rp=require(_0xa13d('0x3'));var moment=require(_0xa13d('0x4'));var BPromise=require(_0xa13d('0x5'));var Mustache=require(_0xa13d('0x6'));var util=require(_0xa13d('0x7'));var path=require(_0xa13d('0x8'));var sox=require(_0xa13d('0x9'));var csv=require('to-csv');var ejs=require(_0xa13d('0xa'));var fs=require('fs');var fs_extra=require(_0xa13d('0xb'));var _=require(_0xa13d('0xc'));var squel=require(_0xa13d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa13d('0xe'));var toCsv=require(_0xa13d('0xf'));var querystring=require(_0xa13d('0x10'));var Papa=require(_0xa13d('0x11'));var AWS=require(_0xa13d('0x12'));var uuidv4=require(_0xa13d('0x13'));var Redis=require('ioredis');var authService=require(_0xa13d('0x14'));var qs=require(_0xa13d('0x15'));var as=require(_0xa13d('0x16'));var hardwareService=require(_0xa13d('0x17'));var logger=require(_0xa13d('0x18'))(_0xa13d('0x19'));var utils=require(_0xa13d('0x1a'));var config=require(_0xa13d('0x1b'));var licenseUtil=require(_0xa13d('0x1c'));var db=require(_0xa13d('0x1d'))['db'];function respondWithStatusCode(_0x307148,_0x31b97f){_0x31b97f=_0x31b97f||0xcc;return function(_0x3d1ea1){if(_0x3d1ea1){return _0x307148[_0xa13d('0x1e')](_0x31b97f);}return _0x307148['status'](_0x31b97f)[_0xa13d('0x1f')]();};}function respondWithResult(_0x4874a7,_0x2b6927){_0x2b6927=_0x2b6927||0xc8;return function(_0x19fbc0){if(_0x19fbc0){return _0x4874a7[_0xa13d('0x20')](_0x2b6927)[_0xa13d('0x21')](_0x19fbc0);}};}function respondWithFilteredResult(_0x54910a,_0x38a288){return function(_0x4d0995){if(_0x4d0995){var _0x1b600d=typeof _0x38a288[_0xa13d('0x22')]===_0xa13d('0x23')&&typeof _0x38a288[_0xa13d('0x24')]===_0xa13d('0x23');var _0x3cb1c5=_0x4d0995[_0xa13d('0x25')];var _0x3b57b=_0x1b600d?0x0:_0x38a288[_0xa13d('0x22')];var _0x2f32de=_0x1b600d?_0x4d0995[_0xa13d('0x25')]:_0x38a288[_0xa13d('0x22')]+_0x38a288[_0xa13d('0x24')];var _0xa662fd;if(_0x2f32de>=_0x3cb1c5){_0x2f32de=_0x3cb1c5;_0xa662fd=0xc8;}else{_0xa662fd=0xce;}_0x54910a[_0xa13d('0x20')](_0xa662fd);return _0x54910a[_0xa13d('0x26')]('Content-Range',_0x3b57b+'-'+_0x2f32de+'/'+_0x3cb1c5)[_0xa13d('0x21')](_0x4d0995);}return null;};}function patchUpdates(_0x2ceb70){return function(_0x146281){try{jsonpatch['apply'](_0x146281,_0x2ceb70,!![]);}catch(_0x1675fc){return BPromise[_0xa13d('0x27')](_0x1675fc);}return _0x146281[_0xa13d('0x28')]();};}function saveUpdates(_0x12d8ea,_0x4416c6){return function(_0x37d4b3){if(_0x37d4b3){return _0x37d4b3[_0xa13d('0x29')](_0x12d8ea)['then'](function(_0x25fef2){return _0x25fef2;});}return null;};}function removeEntity(_0x2b0ad2,_0x5c2c77){return function(_0x2b2880){if(_0x2b2880){return _0x2b2880[_0xa13d('0x2a')]()[_0xa13d('0x2b')](function(){_0x2b0ad2[_0xa13d('0x20')](0xcc)[_0xa13d('0x1f')]();});}};}function handleEntityNotFound(_0xb84912,_0x5baa4c){return function(_0x188e12){if(!_0x188e12){_0xb84912[_0xa13d('0x1e')](0x194);}return _0x188e12;};}function handleError(_0x4ffefc,_0x24d5b1){_0x24d5b1=_0x24d5b1||0x1f4;return function(_0x3e6251){logger['error'](_0x3e6251[_0xa13d('0x2c')]);if(_0x3e6251['name']){delete _0x3e6251['name'];}_0x4ffefc['status'](_0x24d5b1)['send'](_0x3e6251);};}exports[_0xa13d('0x2d')]=function(_0x35cff8,_0x570e03){var _0x255def={},_0x3766d1={},_0x1aa0bc={'count':0x0,'rows':[]};var _0x2f8bb3=_[_0xa13d('0x2e')](db[_0xa13d('0x2f')][_0xa13d('0x30')],function(_0x563bfd){return{'name':_0x563bfd['fieldName'],'type':_0x563bfd['type'][_0xa13d('0x31')]};});_0x3766d1[_0xa13d('0x32')]=_[_0xa13d('0x33')](_[_0xa13d('0x2e')](_0x2f8bb3,_0xa13d('0x34')),[_0xa13d('0x35')]);_0x3766d1['query']=_[_0xa13d('0x36')](_0x35cff8[_0xa13d('0x37')]);_0x3766d1[_0xa13d('0x38')]=_[_0xa13d('0x39')](_0x3766d1[_0xa13d('0x32')],_0x3766d1['query']);_0x255def['attributes']=_[_0xa13d('0x39')](_0x3766d1['model'],qs[_0xa13d('0x3a')](_0x35cff8[_0xa13d('0x37')][_0xa13d('0x3a')]));_0x255def[_0xa13d('0x3b')]=_0x255def[_0xa13d('0x3b')][_0xa13d('0x3c')]?_0x255def[_0xa13d('0x3b')]:_0x3766d1[_0xa13d('0x32')];if(!_0x35cff8[_0xa13d('0x37')][_0xa13d('0x3d')]('nolimit')){_0x255def['limit']=qs[_0xa13d('0x24')](_0x35cff8[_0xa13d('0x37')][_0xa13d('0x24')]);_0x255def[_0xa13d('0x22')]=qs['offset'](_0x35cff8[_0xa13d('0x37')][_0xa13d('0x22')]);}_0x255def[_0xa13d('0x3e')]=qs[_0xa13d('0x3f')](_0x35cff8['query'][_0xa13d('0x3f')]);_0x255def[_0xa13d('0x40')]=qs['filters'](_['pick'](_0x35cff8[_0xa13d('0x37')],_0x3766d1[_0xa13d('0x38')]),_0x2f8bb3);if(_0x35cff8[_0xa13d('0x37')]['filter']){_0x255def[_0xa13d('0x40')]=_['merge'](_0x255def[_0xa13d('0x40')],{'$or':_[_0xa13d('0x2e')](_0x2f8bb3,function(_0x5d7c8c){if(_0x5d7c8c[_0xa13d('0x41')]!=='VIRTUAL'){var _0x52bb74={};_0x52bb74[_0x5d7c8c[_0xa13d('0x34')]]={'$like':'%'+_0x35cff8[_0xa13d('0x37')][_0xa13d('0x42')]+'%'};return _0x52bb74;}})});}_0x255def=_['merge']({},_0x255def,_0x35cff8[_0xa13d('0x43')]);var _0x9f66fc={'where':_0x255def[_0xa13d('0x40')]};return db[_0xa13d('0x2f')]['count'](_0x9f66fc)[_0xa13d('0x2b')](function(_0x4fed35){_0x1aa0bc[_0xa13d('0x25')]=_0x4fed35;if(_0x35cff8['query'][_0xa13d('0x44')]){_0x255def[_0xa13d('0x45')]=[{'all':!![]}];}return db[_0xa13d('0x2f')]['findAll'](_0x255def);})[_0xa13d('0x2b')](function(_0x3a2d5a){_0x1aa0bc[_0xa13d('0x46')]=_0x3a2d5a;return _0x1aa0bc;})[_0xa13d('0x2b')](respondWithFilteredResult(_0x570e03,_0x255def))[_0xa13d('0x47')](handleError(_0x570e03,null));};exports[_0xa13d('0x48')]=function(_0x2bf7f0,_0x2e0ad4){var _0x47c9ad={'raw':![],'where':{'id':_0x2bf7f0[_0xa13d('0x49')]['id']}},_0x3ad338={};_0x3ad338[_0xa13d('0x32')]=_['keys'](db[_0xa13d('0x2f')][_0xa13d('0x30')]);_0x3ad338['query']=_[_0xa13d('0x36')](_0x2bf7f0['query']);_0x3ad338['filters']=_['intersection'](_0x3ad338[_0xa13d('0x32')],_0x3ad338[_0xa13d('0x37')]);_0x47c9ad['attributes']=_[_0xa13d('0x39')](_0x3ad338[_0xa13d('0x32')],qs[_0xa13d('0x3a')](_0x2bf7f0[_0xa13d('0x37')][_0xa13d('0x3a')]));_0x47c9ad['attributes']=_0x47c9ad[_0xa13d('0x3b')][_0xa13d('0x3c')]?_0x47c9ad[_0xa13d('0x3b')]:_0x3ad338[_0xa13d('0x32')];if(_0x2bf7f0[_0xa13d('0x37')][_0xa13d('0x44')]){_0x47c9ad['include']=[{'all':!![]}];}_0x47c9ad=_[_0xa13d('0x4a')]({},_0x47c9ad,_0x2bf7f0['options']);return db[_0xa13d('0x2f')][_0xa13d('0x4b')](_0x47c9ad)[_0xa13d('0x2b')](handleEntityNotFound(_0x2e0ad4,null))['then'](respondWithResult(_0x2e0ad4,null))[_0xa13d('0x47')](handleError(_0x2e0ad4,null));};exports[_0xa13d('0x4c')]=function(_0x4ab6ad,_0x350ef9){return db[_0xa13d('0x2f')][_0xa13d('0x4c')](_0x4ab6ad['body'],{})['then'](respondWithResult(_0x350ef9,0xc9))[_0xa13d('0x47')](handleError(_0x350ef9,null));};exports[_0xa13d('0x29')]=function(_0x598f6,_0x2533fc){if(_0x598f6[_0xa13d('0x4d')]['id']){delete _0x598f6[_0xa13d('0x4d')]['id'];}return db[_0xa13d('0x2f')][_0xa13d('0x4b')]({'where':{'id':_0x598f6[_0xa13d('0x49')]['id']}})[_0xa13d('0x2b')](handleEntityNotFound(_0x2533fc,null))['then'](saveUpdates(_0x598f6[_0xa13d('0x4d')],null))[_0xa13d('0x2b')](respondWithResult(_0x2533fc,null))['catch'](handleError(_0x2533fc,null));};exports[_0xa13d('0x4e')]=function(_0xa562df,_0x12c4c4){return db[_0xa13d('0x2f')][_0xa13d('0x4e')]()['then'](respondWithResult(_0x12c4c4,null))[_0xa13d('0x47')](handleError(_0x12c4c4,null));};exports[_0xa13d('0x4f')]=function(_0xa5dd8,_0xec69f8,_0x4333c9){var _0xe9e71f=require(_0xa13d('0x50'));var _0x3d7f26=![];var _0x3345ee={};if(_0xa5dd8[_0xa13d('0x37')][_0xa13d('0x41')]&&_0xa5dd8[_0xa13d('0x37')]['type']==='uniqueid'){_0x3345ee[_0xa13d('0x51')]=_0xa5dd8[_0xa13d('0x49')]['id'];}else{_0x3345ee['id']=_0xa5dd8[_0xa13d('0x49')]['id'];}return db['VoiceRecording'][_0xa13d('0x4b')]({'where':_0x3345ee,'attributes':['id',_0xa13d('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0xec69f8,null))[_0xa13d('0x2b')](function(_0x2bc04d){if(_0x2bc04d){var _0x4788e7=_0x2bc04d[_0xa13d('0x52')];var _0xd4f768=util[_0xa13d('0x35')]('%s.cypher',_0x4788e7);if(fs[_0xa13d('0x53')](_0xd4f768)){_0x3d7f26=!![];return _0xe9e71f[_0xa13d('0x54')](_0xd4f768,_0x4788e7,config[_0xa13d('0x55')]['recording'])[_0xa13d('0x2b')](function(){return _0x2bc04d;});}return _0x2bc04d;}})[_0xa13d('0x2b')](function(_0x38c941){if(_0x38c941){var _0x464f2d=_0x38c941[_0xa13d('0x52')];if(!fs[_0xa13d('0x53')](_0x464f2d)){throw new db[(_0xa13d('0x56'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x38c941[_0xa13d('0x57')]){return _0xec69f8['download'](_0x464f2d,_0x38c941[_0xa13d('0x57')]+path[_0xa13d('0x58')](_0x464f2d),function(){if(_0x3d7f26){fs['unlink'](_0x464f2d);}});}else{return _0xec69f8[_0xa13d('0x4f')](_0x464f2d,function(_0x26a836){if(_0x3d7f26){fs[_0xa13d('0x59')](_0x464f2d);}});}}})[_0xa13d('0x47')](function(_0x532975){if(_0x532975[_0xa13d('0x5a')]===_0xa13d('0x5b')){_0xec69f8[_0xa13d('0x20')](0x194)[_0xa13d('0x5c')]('Not\x20found');}else{return handleError(_0xec69f8,null);}});};exports[_0xa13d('0x5d')]=function(_0x3cfcd0,_0x1d9be9,_0x2d1507){var _0x54ed43=require(_0xa13d('0x50'));var _0x3d0f16=![];var _0x4793b3={'$and':[db[_0xa13d('0x5e')]['where'](db[_0xa13d('0x5e')]['fn'](_0xa13d('0x5f'),db[_0xa13d('0x5e')][_0xa13d('0x60')](_0xa13d('0x51'))),_0x3cfcd0[_0xa13d('0x37')]['token'])]};if(_0x3cfcd0[_0xa13d('0x37')][_0xa13d('0x41')]&&_0x3cfcd0['query']['type']===_0xa13d('0x51')){_0x4793b3[_0xa13d('0x61')]['push']({'uniqueid':_0x3cfcd0['params']['id']});}else{_0x4793b3['$and'][_0xa13d('0x62')]({'id':_0x3cfcd0[_0xa13d('0x49')]['id']});}return db[_0xa13d('0x2f')][_0xa13d('0x4b')]({'where':_0x4793b3,'attributes':['id','value'],'raw':!![]})[_0xa13d('0x2b')](handleEntityNotFound(_0x1d9be9,null))[_0xa13d('0x2b')](function(_0x4076fb){if(_0x4076fb){var _0x5cd0bd=util['format'](_0xa13d('0x63'),_0x4076fb[_0xa13d('0x52')]);if(fs['existsSync'](_0x5cd0bd)){_0x3d0f16=!![];return _0x54ed43[_0xa13d('0x54')](_0x5cd0bd,_0x4076fb[_0xa13d('0x52')],config[_0xa13d('0x55')][_0xa13d('0x64')])[_0xa13d('0x2b')](function(){return _0x4076fb;});}return _0x4076fb;}})['then'](function(_0x49da8d){if(_0x49da8d){if(!fs[_0xa13d('0x53')](_0x49da8d[_0xa13d('0x52')])){throw new db['Sequelize'][(_0xa13d('0x65'))](_0xa13d('0x5b'));}if(_0x49da8d[_0xa13d('0x57')]){return _0x1d9be9[_0xa13d('0x4f')](_0x49da8d[_0xa13d('0x52')],_0x49da8d[_0xa13d('0x57')]+path[_0xa13d('0x58')](_0x49da8d[_0xa13d('0x52')]),function(){if(_0x3d0f16){fs['unlink'](_0x49da8d[_0xa13d('0x52')]);}});}else{return _0x1d9be9[_0xa13d('0x4f')](_0x49da8d[_0xa13d('0x52')],function(_0x4d6369){if(_0x3d0f16){fs[_0xa13d('0x59')](_0x49da8d[_0xa13d('0x52')]);}});}}})[_0xa13d('0x47')](handleError(_0x1d9be9,null));};exports[_0xa13d('0x2a')]=function(_0x12bcec,_0x4d7551){return db[_0xa13d('0x2f')][_0xa13d('0x4b')]({'where':{'id':_0x12bcec[_0xa13d('0x49')]['id']}})[_0xa13d('0x2b')](function(_0x3e7cbc){if(_['isNil'](_0x3e7cbc)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3e7cbc;})[_0xa13d('0x2b')](function(_0xec27b1){var _0x2145f2=_0xec27b1[_0xa13d('0x52')];logger['info'](_0xa13d('0x66'),_0x2145f2);if(!_['isNil'](_0xec27b1['value'])&&fs[_0xa13d('0x53')](_0x2145f2)){logger[_0xa13d('0x67')](_0xa13d('0x68')+_0x2145f2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa13d('0x69')](_0x2145f2);}_0x2145f2=_0x2145f2+_0xa13d('0x6a');if(!_['isNil'](_0xec27b1[_0xa13d('0x52')])&&fs['existsSync'](_0x2145f2)){logger[_0xa13d('0x67')](_0xa13d('0x68')+_0x2145f2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2145f2);}return _0xec27b1;})[_0xa13d('0x2b')](function(_0x27cfd8){if(!_0x27cfd8)throw new InternalError();return _0x27cfd8['destroy']();})[_0xa13d('0x2b')](function(){_0x4d7551[_0xa13d('0x20')](0xcc)['end']();})[_0xa13d('0x47')](handleError(_0x4d7551,null));};function getBucketslist(_0x4a8322,_0x575284,_0x585a61){return new Promise(function(_0x3e68d6,_0x32fa96){var _0x42ecb6=new AWS['S3']({'accessKeyId':_0x575284,'secretAccessKey':_0x4a8322,'region':_0x585a61});_0x42ecb6[_0xa13d('0x6b')]({},function(_0x565573,_0x22871a){if(_0x565573){return _0x32fa96(_0x565573);}else{return _0x3e68d6(_0x22871a);}});});}function createBucket(_0x412d5b,_0x3fb1bb,_0x35e769,_0x259ed7){return new Promise(function(_0x108e89,_0x35facf){var _0x27376c=new AWS['S3']({'accessKeyId':_0x3fb1bb,'secretAccessKey':_0x412d5b,'region':_0x35e769});_0x27376c[_0xa13d('0x6c')]({'Bucket':_0x259ed7},function(_0x56f2bf,_0x16445a){if(_0x56f2bf){return _0x35facf(_0x56f2bf);}else{return _0x108e89(_0x16445a);}});});}function uploadFile(_0x4b0b31,_0x1ab663,_0x406b0a,_0x2f621f,_0x5e187f,_0x131630){return new Promise(function(_0x79f77,_0x4c8a98){var _0x5df40c=new AWS['S3']({'accessKeyId':_0x1ab663,'secretAccessKey':_0x4b0b31,'region':_0x406b0a});_0x5df40c[_0xa13d('0x6d')]({'Bucket':_0x2f621f,'Key':_0x5e187f,'Body':_0x131630},function(_0x343c4b,_0x2fdf64){if(_0x343c4b){return _0x4c8a98(_0x343c4b);}else{return _0x79f77(_0x2fdf64);}});});}function startTranscribe(_0x26fc3f,_0x1dc7d9,_0x4226b3,_0x6bbe0,_0x1fc706,_0xd69fd8){return new Promise(function(_0x1ccd5a,_0x405551){var _0x4a8b01=new AWS['TranscribeService']({'accessKeyId':_0x1dc7d9,'secretAccessKey':_0x26fc3f,'region':_0x4226b3});_0x4a8b01['startTranscriptionJob']({'TranscriptionJobName':_0x6bbe0,'LanguageCode':_0x1fc706,'Media':{'MediaFileUri':_0xd69fd8}},function(_0x4dad83,_0x2b5035){if(_0x4dad83){return _0x405551(_0x4dad83);}else{return _0x1ccd5a(_0x2b5035);}});});}function transcribe(_0xe0ecbc,_0x1fe95f,_0x38747d,_0x124a35,_0x7d2d9f,_0x46d6f0,_0x210e60){return new Promise(function(_0x2fec48,_0x589f16){var _0x147410={};logger[_0xa13d('0x67')](util[_0xa13d('0x35')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xe0ecbc,_0x7d2d9f));return uploadFile(_0x1fe95f,_0x38747d,_0x124a35,_0x7d2d9f,path['basename'](_0x46d6f0),fs['readFileSync'](_0x46d6f0))[_0xa13d('0x2b')](function(_0xe608b5){logger[_0xa13d('0x67')](util[_0xa13d('0x35')](_0xa13d('0x6e'),_0xe0ecbc,_0x7d2d9f,_0xe608b5[_0xa13d('0x6f')]));_0x147410[_0xa13d('0x70')]=_0xe608b5[_0xa13d('0x71')];_0x147410[_0xa13d('0x72')]=_0xe608b5[_0xa13d('0x6f')];logger[_0xa13d('0x67')](util[_0xa13d('0x35')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xe0ecbc));return startTranscribe(_0x1fe95f,_0x38747d,_0x124a35,uuidv4(),_0x210e60,_0xe608b5[_0xa13d('0x6f')]);})[_0xa13d('0x2b')](function(_0x249675){logger['info'](util[_0xa13d('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xe0ecbc,_0x249675[_0xa13d('0x73')][_0xa13d('0x74')]));_0x147410[_0xa13d('0x75')]=_0x249675[_0xa13d('0x73')][_0xa13d('0x74')];_0x147410[_0xa13d('0x76')]=_0x249675[_0xa13d('0x73')][_0xa13d('0x77')];return _0x2fec48(_0x147410);})[_0xa13d('0x47')](function(_0x5b472c){return _0x589f16(_0x5b472c);});});}exports[_0xa13d('0x78')]=function(_0x7182aa,_0xf038ae,_0x30436c){var _0x2ab221;var _0x51f147;var _0x38785e;var _0x3ee78b=require(_0xa13d('0x50'));return db[_0xa13d('0x2f')][_0xa13d('0x79')]({'where':{'id':_0x7182aa[_0xa13d('0x49')]['id']}})[_0xa13d('0x2b')](function(_0x594748){if(_0x594748){var _0xe8c9e2=util['format']('%s.cypher',_0x594748[_0xa13d('0x52')]);if(fs[_0xa13d('0x53')](_0xe8c9e2)){cypher=!![];return _0x3ee78b[_0xa13d('0x54')](_0xe8c9e2,_0x594748[_0xa13d('0x52')],config[_0xa13d('0x55')][_0xa13d('0x64')])[_0xa13d('0x2b')](function(){return _0x594748;});}return _0x594748;}})[_0xa13d('0x2b')](function(_0x205ec1){if(!_0x205ec1){throw new db[(_0xa13d('0x56'))][(_0xa13d('0x65'))]('Voice\x20Recording\x20not\x20found');}_0x51f147=_0x205ec1;return db['Setting'][_0xa13d('0x79')]({'where':{'id':0x1}});})[_0xa13d('0x2b')](handleEntityNotFound(_0xf038ae,null))['then'](function(_0x6a2ea7){if(_0x6a2ea7){_0x2ab221=_0x6a2ea7;if(!_0x2ab221[_0xa13d('0x7a')]||!_0x2ab221['transcribeAccountId']||!_0x2ab221['transcribeRegion']||!_0x2ab221[_0xa13d('0x7b')]||!_0x2ab221[_0xa13d('0x70')]){throw new db[(_0xa13d('0x56'))][(_0xa13d('0x65'))](_0xa13d('0x7c'));}if(_0x7182aa[_0xa13d('0x4d')][_0xa13d('0x7d')]&&(!_0x2ab221[_0xa13d('0x7e')]||!_0x2ab221[_0xa13d('0x7f')]||!_0x2ab221[_0xa13d('0x80')]||!_0x2ab221[_0xa13d('0x7b')]||!_0x2ab221[_0xa13d('0x70')])){throw new db[(_0xa13d('0x56'))][(_0xa13d('0x65'))](_0xa13d('0x81'));}return db[_0xa13d('0x82')][_0xa13d('0x79')]({'where':{'id':_0x2ab221[_0xa13d('0x83')]}});}})[_0xa13d('0x2b')](function(_0x371302){if(!_0x371302){throw new db[(_0xa13d('0x56'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x371302['data1']||!_0x371302[_0xa13d('0x84')]){throw new db[(_0xa13d('0x56'))][(_0xa13d('0x65'))](_0xa13d('0x85'));}_0x38785e=_0x371302;return getBucketslist(_0x38785e[_0xa13d('0x86')],_0x38785e[_0xa13d('0x84')],_0x2ab221[_0xa13d('0x87')]);})['then'](function(_0x39755d){if(_0x39755d&&_0x39755d[_0xa13d('0x88')]){var _0x4ed276=_[_0xa13d('0x4b')](_0x39755d[_0xa13d('0x88')],function(_0x424dbf){return _0x424dbf['Name']===_0x2ab221[_0xa13d('0x70')];});if(!_0x4ed276){logger[_0xa13d('0x67')](util['format'](_0xa13d('0x89'),_0x7182aa[_0xa13d('0x49')]['id'],_0x2ab221['bucket']));return createBucket(_0x38785e['data1'],_0x38785e[_0xa13d('0x84')],_0x2ab221[_0xa13d('0x87')],_0x2ab221[_0xa13d('0x70')]);}logger[_0xa13d('0x67')](util[_0xa13d('0x35')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x7182aa['params']['id'],_0x2ab221['bucket']));return;}})[_0xa13d('0x2b')](function(_0x4e9d5c){if(_0x51f147[_0xa13d('0x76')]===_0xa13d('0x8a')){return transcribe(_0x7182aa[_0xa13d('0x49')]['id'],_0x38785e[_0xa13d('0x86')],_0x38785e[_0xa13d('0x84')],_0x2ab221[_0xa13d('0x87')],_0x2ab221[_0xa13d('0x70')],_0x51f147[_0xa13d('0x52')],_0x2ab221['language']);}else{logger[_0xa13d('0x67')](util[_0xa13d('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x7182aa['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xa13d('0x2b')](function(_0x1a1699){if(_0x1a1699){_0x1a1699[_0xa13d('0x8b')]=_0x7182aa[_0xa13d('0x4d')]['runSentiment'];return _0x51f147[_0xa13d('0x8c')](_0x1a1699);}})[_0xa13d('0x2b')](respondWithResult(_0xf038ae,null))['catch'](handleError(_0xf038ae,null));};function writeFile(_0x57434d,_0x391112){return new Promise(function(_0x446644,_0x227346){fs[_0xa13d('0x8d')](_0x391112,_0x57434d,function(_0x403772,_0x286e14){if(_0x403772){return _0x227346(_0x403772);}else{return _0x446644(_0x286e14);}});});}exports[_0xa13d('0x8e')]=function(_0x4cfd75,_0x3bda4b,_0xc6612d){return db[_0xa13d('0x2f')][_0xa13d('0x79')]({'where':{'id':_0x4cfd75[_0xa13d('0x49')]['id']}})[_0xa13d('0x2b')](handleEntityNotFound(_0x3bda4b))[_0xa13d('0x2b')](function(_0x4e5762){if(_0x4e5762&&_0x4e5762[_0xa13d('0x8f')]){var _0x20923b=_0x4e5762[_0xa13d('0x8f')];var _0x44584f=config[_0xa13d('0x90')]+_0xa13d('0x91')+_0x4e5762['id']+_0xa13d('0x92');if(fs[_0xa13d('0x53')](_0x44584f)){return _0x44584f;}return writeFile(_0x20923b,_0x44584f)[_0xa13d('0x2b')](function(){return _0x44584f;});}else{throw new db[(_0xa13d('0x56'))][(_0xa13d('0x65'))](_0xa13d('0x93'));}})[_0xa13d('0x2b')](function(_0x4ddf2b){return _0x3bda4b['download'](_0x4ddf2b);})[_0xa13d('0x47')](handleError(_0x3bda4b));}; \ No newline at end of file +var _0x7bdf=['destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','runSentiment','sentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','.txt','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','fields','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','col','$and','format','decryptFile'];(function(_0x32ab87,_0x5803d0){var _0x5ae2b0=function(_0x3af5d3){while(--_0x3af5d3){_0x32ab87['push'](_0x32ab87['shift']());}};_0x5ae2b0(++_0x5803d0);}(_0x7bdf,0xc9));var _0xf7bd=function(_0x230000,_0x49fa14){_0x230000=_0x230000-0x0;var _0x358d35=_0x7bdf[_0x230000];return _0x358d35;};'use strict';var emlformat=require(_0xf7bd('0x0'));var rimraf=require(_0xf7bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7bd('0x2'));var moment=require(_0xf7bd('0x3'));var BPromise=require(_0xf7bd('0x4'));var Mustache=require(_0xf7bd('0x5'));var util=require(_0xf7bd('0x6'));var path=require(_0xf7bd('0x7'));var sox=require(_0xf7bd('0x8'));var csv=require(_0xf7bd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7bd('0xa'));var _=require('lodash');var squel=require(_0xf7bd('0xb'));var crypto=require(_0xf7bd('0xc'));var jsforce=require(_0xf7bd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xf7bd('0xe'));var uuidv4=require(_0xf7bd('0xf'));var Redis=require(_0xf7bd('0x10'));var authService=require(_0xf7bd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf7bd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7bd('0x13'))(_0xf7bd('0x14'));var utils=require(_0xf7bd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf7bd('0x16'));var db=require(_0xf7bd('0x17'))['db'];function respondWithStatusCode(_0x2360f6,_0x121a6b){_0x121a6b=_0x121a6b||0xcc;return function(_0x3fe4ee){if(_0x3fe4ee){return _0x2360f6['sendStatus'](_0x121a6b);}return _0x2360f6['status'](_0x121a6b)[_0xf7bd('0x18')]();};}function respondWithResult(_0x4cb82d,_0x51aba7){_0x51aba7=_0x51aba7||0xc8;return function(_0x31d97c){if(_0x31d97c){return _0x4cb82d[_0xf7bd('0x19')](_0x51aba7)[_0xf7bd('0x1a')](_0x31d97c);}};}function respondWithFilteredResult(_0x38f441,_0x1d16eb){return function(_0x4c30e6){if(_0x4c30e6){var _0x4bd019=typeof _0x1d16eb[_0xf7bd('0x1b')]==='undefined'&&typeof _0x1d16eb[_0xf7bd('0x1c')]===_0xf7bd('0x1d');var _0x4fab5b=_0x4c30e6['count'];var _0x210a80=_0x4bd019?0x0:_0x1d16eb['offset'];var _0x58bab7=_0x4bd019?_0x4c30e6[_0xf7bd('0x1e')]:_0x1d16eb[_0xf7bd('0x1b')]+_0x1d16eb[_0xf7bd('0x1c')];var _0xd2348f;if(_0x58bab7>=_0x4fab5b){_0x58bab7=_0x4fab5b;_0xd2348f=0xc8;}else{_0xd2348f=0xce;}_0x38f441[_0xf7bd('0x19')](_0xd2348f);return _0x38f441[_0xf7bd('0x1f')](_0xf7bd('0x20'),_0x210a80+'-'+_0x58bab7+'/'+_0x4fab5b)[_0xf7bd('0x1a')](_0x4c30e6);}return null;};}function patchUpdates(_0x5d606b){return function(_0x30651f){try{jsonpatch[_0xf7bd('0x21')](_0x30651f,_0x5d606b,!![]);}catch(_0x22d41f){return BPromise[_0xf7bd('0x22')](_0x22d41f);}return _0x30651f[_0xf7bd('0x23')]();};}function saveUpdates(_0x3d25ed,_0x59d89b){return function(_0x31fd29){if(_0x31fd29){return _0x31fd29[_0xf7bd('0x24')](_0x3d25ed)['then'](function(_0x62f2b6){return _0x62f2b6;});}return null;};}function removeEntity(_0x40299e,_0x4d1449){return function(_0x2055e9){if(_0x2055e9){return _0x2055e9['destroy']()[_0xf7bd('0x25')](function(){_0x40299e['status'](0xcc)[_0xf7bd('0x18')]();});}};}function handleEntityNotFound(_0x4eb574,_0xd30d1c){return function(_0x5a41dc){if(!_0x5a41dc){_0x4eb574[_0xf7bd('0x26')](0x194);}return _0x5a41dc;};}function handleError(_0x4cd835,_0x37b039){_0x37b039=_0x37b039||0x1f4;return function(_0x47873d){logger['error'](_0x47873d[_0xf7bd('0x27')]);if(_0x47873d[_0xf7bd('0x28')]){delete _0x47873d[_0xf7bd('0x28')];}_0x4cd835['status'](_0x37b039)[_0xf7bd('0x29')](_0x47873d);};}exports[_0xf7bd('0x2a')]=function(_0x37d0da,_0x1c2151){var _0x46f9c7={},_0x47c78b={},_0xa85aec={'count':0x0,'rows':[]};var _0x3d4af7=_['map'](db[_0xf7bd('0x2b')][_0xf7bd('0x2c')],function(_0x81eb93){return{'name':_0x81eb93[_0xf7bd('0x2d')],'type':_0x81eb93[_0xf7bd('0x2e')][_0xf7bd('0x2f')]};});_0x47c78b[_0xf7bd('0x30')]=_[_0xf7bd('0x31')](_[_0xf7bd('0x32')](_0x3d4af7,_0xf7bd('0x28')),['format']);_0x47c78b['query']=_['keys'](_0x37d0da[_0xf7bd('0x33')]);_0x47c78b[_0xf7bd('0x34')]=_[_0xf7bd('0x35')](_0x47c78b[_0xf7bd('0x30')],_0x47c78b['query']);_0x46f9c7[_0xf7bd('0x36')]=_[_0xf7bd('0x35')](_0x47c78b[_0xf7bd('0x30')],qs['fields'](_0x37d0da['query']['fields']));_0x46f9c7[_0xf7bd('0x36')]=_0x46f9c7['attributes'][_0xf7bd('0x37')]?_0x46f9c7[_0xf7bd('0x36')]:_0x47c78b[_0xf7bd('0x30')];if(!_0x37d0da[_0xf7bd('0x33')][_0xf7bd('0x38')](_0xf7bd('0x39'))){_0x46f9c7[_0xf7bd('0x1c')]=qs[_0xf7bd('0x1c')](_0x37d0da[_0xf7bd('0x33')][_0xf7bd('0x1c')]);_0x46f9c7[_0xf7bd('0x1b')]=qs[_0xf7bd('0x1b')](_0x37d0da[_0xf7bd('0x33')][_0xf7bd('0x1b')]);}_0x46f9c7[_0xf7bd('0x3a')]=qs[_0xf7bd('0x3b')](_0x37d0da[_0xf7bd('0x33')][_0xf7bd('0x3b')]);_0x46f9c7[_0xf7bd('0x3c')]=qs[_0xf7bd('0x34')](_[_0xf7bd('0x3d')](_0x37d0da['query'],_0x47c78b['filters']),_0x3d4af7);if(_0x37d0da[_0xf7bd('0x33')][_0xf7bd('0x3e')]){_0x46f9c7[_0xf7bd('0x3c')]=_['merge'](_0x46f9c7['where'],{'$or':_[_0xf7bd('0x32')](_0x3d4af7,function(_0x5aaaeb){if(_0x5aaaeb[_0xf7bd('0x2e')]!==_0xf7bd('0x3f')){var _0x150a71={};_0x150a71[_0x5aaaeb[_0xf7bd('0x28')]]={'$like':'%'+_0x37d0da['query'][_0xf7bd('0x3e')]+'%'};return _0x150a71;}})});}_0x46f9c7=_[_0xf7bd('0x40')]({},_0x46f9c7,_0x37d0da[_0xf7bd('0x41')]);var _0x11675a={'where':_0x46f9c7[_0xf7bd('0x3c')]};return db[_0xf7bd('0x2b')][_0xf7bd('0x1e')](_0x11675a)[_0xf7bd('0x25')](function(_0x286f58){_0xa85aec[_0xf7bd('0x1e')]=_0x286f58;if(_0x37d0da[_0xf7bd('0x33')]['includeAll']){_0x46f9c7['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xf7bd('0x42')](_0x46f9c7);})[_0xf7bd('0x25')](function(_0x5a33b3){_0xa85aec[_0xf7bd('0x43')]=_0x5a33b3;return _0xa85aec;})[_0xf7bd('0x25')](respondWithFilteredResult(_0x1c2151,_0x46f9c7))[_0xf7bd('0x44')](handleError(_0x1c2151,null));};exports[_0xf7bd('0x45')]=function(_0x50aebe,_0x2a664c){var _0x1bbe7e={'raw':![],'where':{'id':_0x50aebe[_0xf7bd('0x46')]['id']}},_0x5a1352={};_0x5a1352[_0xf7bd('0x30')]=_[_0xf7bd('0x47')](db[_0xf7bd('0x2b')][_0xf7bd('0x2c')]);_0x5a1352[_0xf7bd('0x33')]=_[_0xf7bd('0x47')](_0x50aebe['query']);_0x5a1352[_0xf7bd('0x34')]=_[_0xf7bd('0x35')](_0x5a1352[_0xf7bd('0x30')],_0x5a1352[_0xf7bd('0x33')]);_0x1bbe7e[_0xf7bd('0x36')]=_[_0xf7bd('0x35')](_0x5a1352[_0xf7bd('0x30')],qs[_0xf7bd('0x48')](_0x50aebe[_0xf7bd('0x33')][_0xf7bd('0x48')]));_0x1bbe7e['attributes']=_0x1bbe7e[_0xf7bd('0x36')][_0xf7bd('0x37')]?_0x1bbe7e[_0xf7bd('0x36')]:_0x5a1352['model'];if(_0x50aebe[_0xf7bd('0x33')]['includeAll']){_0x1bbe7e[_0xf7bd('0x49')]=[{'all':!![]}];}_0x1bbe7e=_[_0xf7bd('0x40')]({},_0x1bbe7e,_0x50aebe[_0xf7bd('0x41')]);return db['VoiceRecording'][_0xf7bd('0x4a')](_0x1bbe7e)[_0xf7bd('0x25')](handleEntityNotFound(_0x2a664c,null))[_0xf7bd('0x25')](respondWithResult(_0x2a664c,null))[_0xf7bd('0x44')](handleError(_0x2a664c,null));};exports[_0xf7bd('0x4b')]=function(_0x882d47,_0x34abd6){return db[_0xf7bd('0x2b')][_0xf7bd('0x4b')](_0x882d47[_0xf7bd('0x4c')],{})[_0xf7bd('0x25')](respondWithResult(_0x34abd6,0xc9))[_0xf7bd('0x44')](handleError(_0x34abd6,null));};exports[_0xf7bd('0x24')]=function(_0x30c935,_0x38bea5){if(_0x30c935[_0xf7bd('0x4c')]['id']){delete _0x30c935[_0xf7bd('0x4c')]['id'];}return db[_0xf7bd('0x2b')][_0xf7bd('0x4a')]({'where':{'id':_0x30c935[_0xf7bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x38bea5,null))['then'](saveUpdates(_0x30c935['body'],null))['then'](respondWithResult(_0x38bea5,null))[_0xf7bd('0x44')](handleError(_0x38bea5,null));};exports['describe']=function(_0x579dbc,_0x5940bc){return db[_0xf7bd('0x2b')][_0xf7bd('0x4d')]()[_0xf7bd('0x25')](respondWithResult(_0x5940bc,null))[_0xf7bd('0x44')](handleError(_0x5940bc,null));};exports[_0xf7bd('0x4e')]=function(_0x1b4968,_0x31b42d,_0x3efdc9){var _0xba168f=require(_0xf7bd('0x4f'));var _0xd8fecf=![];var _0x2ffbb7={};if(_0x1b4968[_0xf7bd('0x33')][_0xf7bd('0x2e')]&&_0x1b4968[_0xf7bd('0x33')]['type']===_0xf7bd('0x50')){_0x2ffbb7[_0xf7bd('0x50')]=_0x1b4968[_0xf7bd('0x46')]['id'];}else{_0x2ffbb7['id']=_0x1b4968['params']['id'];}return db[_0xf7bd('0x2b')][_0xf7bd('0x4a')]({'where':_0x2ffbb7,'attributes':['id',_0xf7bd('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x31b42d,null))['then'](function(_0x5d4e4e){if(_0x5d4e4e){var _0x1b4f6a=_0x5d4e4e[_0xf7bd('0x51')];var _0x1d49fa=util['format'](_0xf7bd('0x52'),_0x1b4f6a);if(fs[_0xf7bd('0x53')](_0x1d49fa)){_0xd8fecf=!![];return _0xba168f['decryptFile'](_0x1d49fa,_0x1b4f6a,config[_0xf7bd('0x54')][_0xf7bd('0x55')])[_0xf7bd('0x25')](function(){return _0x5d4e4e;});}return _0x5d4e4e;}})['then'](function(_0x2f098d){if(_0x2f098d){var _0x1ad3e2=_0x2f098d[_0xf7bd('0x51')];if(!fs[_0xf7bd('0x53')](_0x1ad3e2)){throw new db[(_0xf7bd('0x56'))][(_0xf7bd('0x57'))](_0xf7bd('0x58'));}if(_0x2f098d[_0xf7bd('0x59')]){return _0x31b42d[_0xf7bd('0x4e')](_0x1ad3e2,_0x2f098d[_0xf7bd('0x59')]+path[_0xf7bd('0x5a')](_0x1ad3e2),function(){if(_0xd8fecf){fs[_0xf7bd('0x5b')](_0x1ad3e2);}});}else{return _0x31b42d[_0xf7bd('0x4e')](_0x1ad3e2,function(_0x15f41e){if(_0xd8fecf){fs[_0xf7bd('0x5b')](_0x1ad3e2);}});}}})[_0xf7bd('0x44')](function(_0x400cbb){if(_0x400cbb['message']===_0xf7bd('0x58')){_0x31b42d['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x31b42d,null);}});};exports[_0xf7bd('0x5c')]=function(_0x1b6ac0,_0x5b7b2e,_0x31e041){var _0x38910a=require(_0xf7bd('0x4f'));var _0xea4c21=![];var _0x1f4652={'$and':[db[_0xf7bd('0x5d')]['where'](db['sequelize']['fn'](_0xf7bd('0x5e'),db['sequelize'][_0xf7bd('0x5f')](_0xf7bd('0x50'))),_0x1b6ac0[_0xf7bd('0x33')]['token'])]};if(_0x1b6ac0[_0xf7bd('0x33')][_0xf7bd('0x2e')]&&_0x1b6ac0['query'][_0xf7bd('0x2e')]==='uniqueid'){_0x1f4652[_0xf7bd('0x60')]['push']({'uniqueid':_0x1b6ac0['params']['id']});}else{_0x1f4652[_0xf7bd('0x60')]['push']({'id':_0x1b6ac0[_0xf7bd('0x46')]['id']});}return db['VoiceRecording'][_0xf7bd('0x4a')]({'where':_0x1f4652,'attributes':['id',_0xf7bd('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x5b7b2e,null))[_0xf7bd('0x25')](function(_0x2d4246){if(_0x2d4246){var _0x83267c=util[_0xf7bd('0x61')]('%s.cypher',_0x2d4246['value']);if(fs[_0xf7bd('0x53')](_0x83267c)){_0xea4c21=!![];return _0x38910a[_0xf7bd('0x62')](_0x83267c,_0x2d4246[_0xf7bd('0x51')],config[_0xf7bd('0x54')][_0xf7bd('0x55')])['then'](function(){return _0x2d4246;});}return _0x2d4246;}})[_0xf7bd('0x25')](function(_0x531f9b){if(_0x531f9b){if(!fs[_0xf7bd('0x53')](_0x531f9b[_0xf7bd('0x51')])){throw new db[(_0xf7bd('0x56'))]['ValidationError'](_0xf7bd('0x58'));}if(_0x531f9b['filename']){return _0x5b7b2e[_0xf7bd('0x4e')](_0x531f9b[_0xf7bd('0x51')],_0x531f9b[_0xf7bd('0x59')]+path[_0xf7bd('0x5a')](_0x531f9b[_0xf7bd('0x51')]),function(){if(_0xea4c21){fs[_0xf7bd('0x5b')](_0x531f9b['value']);}});}else{return _0x5b7b2e['download'](_0x531f9b[_0xf7bd('0x51')],function(_0x4a9d4f){if(_0xea4c21){fs['unlink'](_0x531f9b[_0xf7bd('0x51')]);}});}}})['catch'](handleError(_0x5b7b2e,null));};exports[_0xf7bd('0x63')]=function(_0xf1374b,_0x59cff7){return db['VoiceRecording']['find']({'where':{'id':_0xf1374b['params']['id']}})[_0xf7bd('0x25')](function(_0x21b4b7){if(_['isNil'](_0x21b4b7)){throw new ReferenceError(_0xf7bd('0x64'));}return _0x21b4b7;})['then'](function(_0x28bac3){var _0x2ed054=_0x28bac3[_0xf7bd('0x51')];logger[_0xf7bd('0x65')](_0xf7bd('0x66'),_0x2ed054);if(!_[_0xf7bd('0x67')](_0x28bac3[_0xf7bd('0x51')])&&fs[_0xf7bd('0x53')](_0x2ed054)){logger[_0xf7bd('0x65')](_0xf7bd('0x68')+_0x2ed054+_0xf7bd('0x69'));fs[_0xf7bd('0x6a')](_0x2ed054);}_0x2ed054=_0x2ed054+'.cypher';if(!_[_0xf7bd('0x67')](_0x28bac3['value'])&&fs[_0xf7bd('0x53')](_0x2ed054)){logger[_0xf7bd('0x65')]('File:\x20\x22'+_0x2ed054+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf7bd('0x6a')](_0x2ed054);}return _0x28bac3;})[_0xf7bd('0x25')](function(_0x3a5f77){if(!_0x3a5f77)throw new InternalError();return _0x3a5f77[_0xf7bd('0x63')]();})[_0xf7bd('0x25')](function(){_0x59cff7[_0xf7bd('0x19')](0xcc)[_0xf7bd('0x18')]();})[_0xf7bd('0x44')](handleError(_0x59cff7,null));};function getBucketslist(_0x561c0e,_0x42ac41,_0x1fb2ee){return new Promise(function(_0x516cc5,_0x2af480){var _0x2964bd=new AWS['S3']({'accessKeyId':_0x42ac41,'secretAccessKey':_0x561c0e,'region':_0x1fb2ee});_0x2964bd[_0xf7bd('0x6b')]({},function(_0x4bdfea,_0x2e296e){if(_0x4bdfea){return _0x2af480(_0x4bdfea);}else{return _0x516cc5(_0x2e296e);}});});}function createBucket(_0x42353d,_0x271968,_0xb47197,_0x4b6831){return new Promise(function(_0x45bc07,_0x55abc6){var _0x39291c=new AWS['S3']({'accessKeyId':_0x271968,'secretAccessKey':_0x42353d,'region':_0xb47197});_0x39291c['createBucket']({'Bucket':_0x4b6831},function(_0x2d5bde,_0x26046a){if(_0x2d5bde){return _0x55abc6(_0x2d5bde);}else{return _0x45bc07(_0x26046a);}});});}function uploadFile(_0x36aaeb,_0x219fbe,_0x4750b8,_0x1fe900,_0x308859,_0x2781ca){return new Promise(function(_0x1bb6cf,_0xf6afaa){var _0x314e3c=new AWS['S3']({'accessKeyId':_0x219fbe,'secretAccessKey':_0x36aaeb,'region':_0x4750b8});_0x314e3c[_0xf7bd('0x6c')]({'Bucket':_0x1fe900,'Key':_0x308859,'Body':_0x2781ca},function(_0x24ad52,_0x347929){if(_0x24ad52){return _0xf6afaa(_0x24ad52);}else{return _0x1bb6cf(_0x347929);}});});}function startTranscribe(_0x4e7288,_0x2e6f40,_0x13260f,_0x1a6ef0,_0x326969,_0x5c13ea){return new Promise(function(_0x3e030,_0x46173a){var _0x2d5955=new AWS['TranscribeService']({'accessKeyId':_0x2e6f40,'secretAccessKey':_0x4e7288,'region':_0x13260f});_0x2d5955['startTranscriptionJob']({'TranscriptionJobName':_0x1a6ef0,'LanguageCode':_0x326969,'Media':{'MediaFileUri':_0x5c13ea}},function(_0x3f473d,_0x4cdd49){if(_0x3f473d){return _0x46173a(_0x3f473d);}else{return _0x3e030(_0x4cdd49);}});});}function transcribe(_0x1e510b,_0x516fbf,_0x5b2555,_0x228df2,_0x4e2cc3,_0xf4290a,_0x49a883){return new Promise(function(_0x29ebc6,_0x20f309){var _0x17d8d3={};logger[_0xf7bd('0x65')](util['format'](_0xf7bd('0x6d'),_0x1e510b,_0x4e2cc3));return uploadFile(_0x516fbf,_0x5b2555,_0x228df2,_0x4e2cc3,path['basename'](_0xf4290a),fs[_0xf7bd('0x6e')](_0xf4290a))[_0xf7bd('0x25')](function(_0x3c4239){logger[_0xf7bd('0x65')](util[_0xf7bd('0x61')](_0xf7bd('0x6f'),_0x1e510b,_0x4e2cc3,_0x3c4239[_0xf7bd('0x70')]));_0x17d8d3['bucket']=_0x3c4239[_0xf7bd('0x71')];_0x17d8d3[_0xf7bd('0x72')]=_0x3c4239[_0xf7bd('0x70')];logger[_0xf7bd('0x65')](util[_0xf7bd('0x61')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1e510b));return startTranscribe(_0x516fbf,_0x5b2555,_0x228df2,uuidv4(),_0x49a883,_0x3c4239[_0xf7bd('0x70')]);})['then'](function(_0x3df3e){logger['info'](util[_0xf7bd('0x61')](_0xf7bd('0x73'),_0x1e510b,_0x3df3e[_0xf7bd('0x74')][_0xf7bd('0x75')]));_0x17d8d3[_0xf7bd('0x76')]=_0x3df3e[_0xf7bd('0x74')]['TranscriptionJobName'];_0x17d8d3[_0xf7bd('0x77')]=_0x3df3e['TranscriptionJob'][_0xf7bd('0x78')];return _0x29ebc6(_0x17d8d3);})[_0xf7bd('0x44')](function(_0x2fd88c){return _0x20f309(_0x2fd88c);});});}exports['runTranscribe']=function(_0xe66a3d,_0x407fe4,_0x42c248){var _0x55911e;var _0x756ec7;var _0x224edb;var _0x9ff1d0=require('../../components/encryptor');return db[_0xf7bd('0x2b')][_0xf7bd('0x79')]({'where':{'id':_0xe66a3d[_0xf7bd('0x46')]['id']}})[_0xf7bd('0x25')](function(_0x3e90a5){if(_0x3e90a5){var _0x38c091=util[_0xf7bd('0x61')](_0xf7bd('0x52'),_0x3e90a5[_0xf7bd('0x51')]);if(fs[_0xf7bd('0x53')](_0x38c091)){cypher=!![];return _0x9ff1d0[_0xf7bd('0x62')](_0x38c091,_0x3e90a5[_0xf7bd('0x51')],config[_0xf7bd('0x54')][_0xf7bd('0x55')])[_0xf7bd('0x25')](function(){return _0x3e90a5;});}return _0x3e90a5;}})[_0xf7bd('0x25')](function(_0x10a809){if(!_0x10a809){throw new db[(_0xf7bd('0x56'))]['ValidationError'](_0xf7bd('0x7a'));}_0x756ec7=_0x10a809;return db[_0xf7bd('0x7b')][_0xf7bd('0x79')]({'where':{'id':0x1}});})[_0xf7bd('0x25')](handleEntityNotFound(_0x407fe4,null))[_0xf7bd('0x25')](function(_0x4a5d7c){if(_0x4a5d7c){_0x55911e=_0x4a5d7c;if(!_0x55911e[_0xf7bd('0x7c')]||!_0x55911e[_0xf7bd('0x7d')]||!_0x55911e[_0xf7bd('0x7e')]||!_0x55911e[_0xf7bd('0x7f')]||!_0x55911e[_0xf7bd('0x80')]){throw new db[(_0xf7bd('0x56'))][(_0xf7bd('0x57'))]('Transcribe\x20not\x20configured');}if(_0xe66a3d[_0xf7bd('0x4c')][_0xf7bd('0x81')]&&(!_0x55911e[_0xf7bd('0x82')]||!_0x55911e[_0xf7bd('0x83')]||!_0x55911e['sentimentRegion']||!_0x55911e[_0xf7bd('0x7f')]||!_0x55911e['bucket'])){throw new db['Sequelize'][(_0xf7bd('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xf7bd('0x84')][_0xf7bd('0x79')]({'where':{'id':_0x55911e[_0xf7bd('0x7d')]}});}})['then'](function(_0x4934c2){if(!_0x4934c2){throw new db[(_0xf7bd('0x56'))]['ValidationError'](_0xf7bd('0x85'));}if(!_0x4934c2[_0xf7bd('0x86')]||!_0x4934c2[_0xf7bd('0x87')]){throw new db[(_0xf7bd('0x56'))][(_0xf7bd('0x57'))](_0xf7bd('0x88'));}_0x224edb=_0x4934c2;return getBucketslist(_0x224edb['data1'],_0x224edb['data2'],_0x55911e[_0xf7bd('0x7e')]);})[_0xf7bd('0x25')](function(_0x18ca22){if(_0x18ca22&&_0x18ca22[_0xf7bd('0x89')]){var _0x41f21b=_[_0xf7bd('0x4a')](_0x18ca22[_0xf7bd('0x89')],function(_0x1cbb0a){return _0x1cbb0a[_0xf7bd('0x8a')]===_0x55911e[_0xf7bd('0x80')];});if(!_0x41f21b){logger['info'](util[_0xf7bd('0x61')](_0xf7bd('0x8b'),_0xe66a3d[_0xf7bd('0x46')]['id'],_0x55911e[_0xf7bd('0x80')]));return createBucket(_0x224edb[_0xf7bd('0x86')],_0x224edb[_0xf7bd('0x87')],_0x55911e['transcribeRegion'],_0x55911e[_0xf7bd('0x80')]);}logger[_0xf7bd('0x65')](util['format'](_0xf7bd('0x8c'),_0xe66a3d['params']['id'],_0x55911e[_0xf7bd('0x80')]));return;}})[_0xf7bd('0x25')](function(_0x300643){if(_0x756ec7[_0xf7bd('0x77')]===_0xf7bd('0x8d')){return transcribe(_0xe66a3d[_0xf7bd('0x46')]['id'],_0x224edb[_0xf7bd('0x86')],_0x224edb[_0xf7bd('0x87')],_0x55911e[_0xf7bd('0x7e')],_0x55911e[_0xf7bd('0x80')],_0x756ec7[_0xf7bd('0x51')],_0x55911e[_0xf7bd('0x7f')]);}else{logger[_0xf7bd('0x65')](util[_0xf7bd('0x61')](_0xf7bd('0x8e'),_0xe66a3d[_0xf7bd('0x46')]['id']));return{'transcribeStatus':_0xf7bd('0x8f')};}})[_0xf7bd('0x25')](function(_0x133251){if(_0x133251){_0x133251[_0xf7bd('0x90')]=_0xe66a3d['body']['runSentiment'];return _0x756ec7[_0xf7bd('0x91')](_0x133251);}})[_0xf7bd('0x25')](respondWithResult(_0x407fe4,null))[_0xf7bd('0x44')](handleError(_0x407fe4,null));};function writeFile(_0x383753,_0x2b1c6d){return new Promise(function(_0x1dd550,_0x2c2438){fs['writeFile'](_0x2b1c6d,_0x383753,function(_0x457eed,_0x55f072){if(_0x457eed){return _0x2c2438(_0x457eed);}else{return _0x1dd550(_0x55f072);}});});}exports[_0xf7bd('0x92')]=function(_0x4d43e1,_0xc11944,_0x179fd5){return db[_0xf7bd('0x2b')][_0xf7bd('0x79')]({'where':{'id':_0x4d43e1[_0xf7bd('0x46')]['id']}})[_0xf7bd('0x25')](handleEntityNotFound(_0xc11944))[_0xf7bd('0x25')](function(_0x1114fd){if(_0x1114fd&&_0x1114fd[_0xf7bd('0x93')]){var _0x2d8909=_0x1114fd[_0xf7bd('0x93')];var _0x23d62b=config[_0xf7bd('0x94')]+'/server/files/transcribes/transcribe_'+_0x1114fd['id']+_0xf7bd('0x95');if(fs[_0xf7bd('0x53')](_0x23d62b)){return _0x23d62b;}return writeFile(_0x2d8909,_0x23d62b)[_0xf7bd('0x25')](function(){return _0x23d62b;});}else{throw new db[(_0xf7bd('0x56'))][(_0xf7bd('0x57'))]('Transcript\x20not\x20available');}})[_0xf7bd('0x25')](function(_0x553264){return _0xc11944[_0xf7bd('0x4e')](_0x553264);})[_0xf7bd('0x44')](handleError(_0xc11944));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 97b3484..0997bed 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 _0x4f17=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','VoiceRecording'];(function(_0xe43a3c,_0x3600b3){var _0x50e76a=function(_0x4f0eb3){while(--_0x4f0eb3){_0xe43a3c['push'](_0xe43a3c['shift']());}};_0x50e76a(++_0x3600b3);}(_0x4f17,0x9e));var _0x74f1=function(_0x5c6c64,_0x12d4cb){_0x5c6c64=_0x5c6c64-0x0;var _0x172174=_0x4f17[_0x5c6c64];return _0x172174;};'use strict';var attributes=require(_0x74f1('0x0'));module['exports']=function(_0xc7f009,_0xfcf99c){return _0xc7f009['define'](_0x74f1('0x1'),attributes,{'tableName':_0x74f1('0x2'),'paranoid':![],'indexes':[{'name':_0x74f1('0x3'),'fields':[_0x74f1('0x3')]},{'name':_0x74f1('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c96=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x6c96,0x1c1));var _0x66c9=function(_0x50e977,_0x11d3e3){_0x50e977=_0x50e977-0x0;var _0x5f52f0=_0x6c96[_0x50e977];return _0x5f52f0;};'use strict';var attributes=require(_0x66c9('0x0'));module['exports']=function(_0x130ba8,_0x58d6e7){return _0x130ba8['define'](_0x66c9('0x1'),attributes,{'tableName':_0x66c9('0x2'),'paranoid':![],'indexes':[{'name':_0x66c9('0x3'),'fields':[_0x66c9('0x3')]},{'name':_0x66c9('0x4'),'fields':[_0x66c9('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 33966b6..b312af2 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 _0x0295=['client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8591ff,_0x26a0d9){var _0x91ae2=function(_0x327001){while(--_0x327001){_0x8591ff['push'](_0x8591ff['shift']());}};_0x91ae2(++_0x26a0d9);}(_0x0295,0x1f0));var _0x5029=function(_0x4b3300,_0x1137f1){_0x4b3300=_0x4b3300-0x0;var _0x2d26d3=_0x0295[_0x4b3300];return _0x2d26d3;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['UpdateVoiceRecording']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')](_0x1ed567[_0x5029('0x17')],{'raw':_0x1ed567['options']?_0x1ed567[_0x5029('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed567[_0x5029('0x18')]?_0x1ed567[_0x5029('0x18')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options']['attributes']||null:null,'limit':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options'][_0x5029('0x1a')]||null:null})[_0x5029('0xa')](function(_0x1eb228){logger[_0x5029('0xb')](_0x5029('0x1b'),_0x1ed567);logger[_0x5029('0xd')](_0x5029('0x1b'),_0x1ed567,JSON[_0x5029('0xf')](_0x1eb228));_0x35de81(_0x1eb228);})[_0x5029('0x14')](function(_0x4ceaae){logger['error']('UpdateVoiceRecording',_0x4ceaae[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155[_0x5029('0x10')](0x1f4,_0x4ceaae['message']));});});};exports['CreateVoiceRecording']=function(_0x181da0){var _0x1e7e61=this;return new Promise(function(_0x36d810,_0x5527fc){var _0x2c501f=require(_0x5029('0x1c'));var _0x5e45c4;return db[_0x5029('0x1d')][_0x5029('0x1e')]({'attributes':['id',_0x5029('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32da06){_0x5e45c4=_0x32da06;return db[_0x5029('0x15')][_0x5029('0x20')](_0x181da0['body']);})[_0x5029('0xa')](function(_0x2bb398){if(_0x5e45c4['callRecordingEncryption']&&fs[_0x5029('0x21')](_0x2bb398[_0x5029('0x22')])){var _0x4434ff=util[_0x5029('0x23')](_0x5029('0x24'),_0x2bb398[_0x5029('0x22')]);return _0x2c501f[_0x5029('0x25')](_0x2bb398[_0x5029('0x22')],_0x4434ff,config[_0x5029('0x26')][_0x5029('0x27')])[_0x5029('0xa')](function(){fs[_0x5029('0x28')](_0x2bb398['value']);logger[_0x5029('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2bb398;});}return _0x2bb398;})[_0x5029('0xa')](function(_0x4f672e){logger['info'](_0x5029('0x29'),_0x181da0);logger[_0x5029('0xd')](_0x5029('0x29'),_0x181da0,JSON['stringify'](_0x4f672e));_0x36d810(_0x4f672e);})[_0x5029('0x14')](function(_0x15d882){logger[_0x5029('0x10')](_0x5029('0x29'),_0x15d882[_0x5029('0x12')],_0x181da0);_0x5527fc(_0x1e7e61[_0x5029('0x10')](0x1f4,_0x15d882[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x4325=['attributes','CreateVoiceRecording','Setting','findOne','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where'];(function(_0x1bab7d,_0x422688){var _0x42e972=function(_0x28bcfa){while(--_0x28bcfa){_0x1bab7d['push'](_0x1bab7d['shift']());}};_0x42e972(++_0x422688);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe60['options']?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1d')]||null:null,'attributes':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1e')]||null:null,'limit':_0x32fe60['options']?_0x32fe60['options']['limit']||null:null})[_0x5432('0xb')](function(_0xb900f2){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug']('UpdateVoiceRecording',_0x32fe60,JSON[_0x5432('0x10')](_0xb900f2));_0x5f011f(_0xb900f2);})[_0x5432('0x16')](function(_0x4a40fc){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4a40fc[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x4a40fc[_0x5432('0x13')]));});});};exports[_0x5432('0x1f')]=function(_0xe7eda2){var _0x520da1=this;return new Promise(function(_0x4ab09d,_0x1f2055){var _0x2114b8=require('../../components/encryptor');var _0x1abe73;return db[_0x5432('0x20')][_0x5432('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5432('0xb')](function(_0x5be867){_0x1abe73=_0x5be867;return db['VoiceRecording'][_0x5432('0x22')](_0xe7eda2['body']);})[_0x5432('0xb')](function(_0x578281){if(_0x1abe73['callRecordingEncryption']&&fs[_0x5432('0x23')](_0x578281[_0x5432('0x24')])){var _0x345b51=util['format'](_0x5432('0x25'),_0x578281[_0x5432('0x24')]);return _0x2114b8[_0x5432('0x26')](_0x578281[_0x5432('0x24')],_0x345b51,config[_0x5432('0x27')][_0x5432('0x28')])[_0x5432('0xb')](function(){fs[_0x5432('0x29')](_0x578281[_0x5432('0x24')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x578281;});}return _0x578281;})[_0x5432('0xb')](function(_0x42ab1e){logger[_0x5432('0x14')](_0x5432('0x1f'),_0xe7eda2);logger[_0x5432('0xd')]('CreateVoiceRecording',_0xe7eda2,JSON[_0x5432('0x10')](_0x42ab1e));_0x4ab09d(_0x42ab1e);})['catch'](function(_0x2955e0){logger[_0x5432('0x12')](_0x5432('0x1f'),_0x2955e0[_0x5432('0x13')],_0xe7eda2);_0x1f2055(_0x520da1[_0x5432('0x12')](0x1f4,_0x2955e0[_0x5432('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 0195c61..b10fae1 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 _0x6575=['../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x124bb6,_0x382802){var _0x5531e2=function(_0x299bf5){while(--_0x299bf5){_0x124bb6['push'](_0x124bb6['shift']());}};_0x5531e2(++_0x382802);}(_0x6575,0x11c));var _0x5657=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x6575[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x5657('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5657('0x1'));var express=require(_0x5657('0x2'));var router=express[_0x5657('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5657('0x4'));var interaction=require(_0x5657('0x5'));var config=require('../../config/environment');var controller=require(_0x5657('0x6'));router[_0x5657('0x7')]('/',auth[_0x5657('0x8')](),controller[_0x5657('0x9')]);router[_0x5657('0x7')](_0x5657('0xa'),auth[_0x5657('0x8')](),controller[_0x5657('0xb')]);router[_0x5657('0x7')](_0x5657('0xc'),auth[_0x5657('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5657('0xd')](_0x5657('0xc'),auth[_0x5657('0x8')](),controller[_0x5657('0xe')]);router[_0x5657('0xf')](_0x5657('0xc'),auth[_0x5657('0x8')](),controller['destroy']);module[_0x5657('0x10')]=router; \ No newline at end of file +var _0x0ddb=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update'];(function(_0x2049e9,_0x33d90c){var _0x566375=function(_0x1266a0){while(--_0x1266a0){_0x2049e9['push'](_0x2049e9['shift']());}};_0x566375(++_0x33d90c);}(_0x0ddb,0x143));var _0xb0dd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ddb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb0dd('0x0'));var path=require(_0xb0dd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb0dd('0x2'));var router=express[_0xb0dd('0x3')]();var fs_extra=require(_0xb0dd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb0dd('0x5'));var config=require(_0xb0dd('0x6'));var controller=require(_0xb0dd('0x7'));router[_0xb0dd('0x8')]('/',auth[_0xb0dd('0x9')](),controller[_0xb0dd('0xa')]);router['get'](_0xb0dd('0xb'),auth['isAuthenticated'](),controller[_0xb0dd('0xc')]);router['get'](_0xb0dd('0xd'),auth[_0xb0dd('0x9')](),controller['show']);router['post']('/',auth[_0xb0dd('0x9')](),controller[_0xb0dd('0xe')]);router[_0xb0dd('0xf')]('/:id',auth[_0xb0dd('0x9')](),controller[_0xb0dd('0x10')]);router[_0xb0dd('0x11')](_0xb0dd('0xd'),auth['isAuthenticated'](),controller[_0xb0dd('0x12')]);module[_0xb0dd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1272e6e..24aafd7 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 _0x84c0=['exports','ENUM','blind','attended','STRING','Yes','moment'];(function(_0x3780dc,_0x196bff){var _0x4ae839=function(_0x45f6dc){while(--_0x45f6dc){_0x3780dc['push'](_0x3780dc['shift']());}};_0x4ae839(++_0x196bff);}(_0x84c0,0x1e9));var _0x084c=function(_0x2ce2e9,_0x516733){_0x2ce2e9=_0x2ce2e9-0x0;var _0x51c0a1=_0x84c0[_0x2ce2e9];return _0x51c0a1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x084c('0x0'));module[_0x084c('0x1')]={'type':{'type':Sequelize[_0x084c('0x2')](_0x084c('0x3'),_0x084c('0x4'))},'result':{'type':Sequelize[_0x084c('0x5')]},'transfererchannel':{'type':Sequelize[_0x084c('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x084c('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x084c('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x084c('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x084c('0x5')]},'transferercontext':{'type':Sequelize[_0x084c('0x5')]},'transfererexten':{'type':Sequelize[_0x084c('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x084c('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x084c('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x084c('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x084c('0x5')]},'transfereecontext':{'type':Sequelize[_0x084c('0x5')]},'transfereeexten':{'type':Sequelize[_0x084c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x084c('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x084c('0x6'),'No')},'context':{'type':Sequelize[_0x084c('0x5')]},'extension':{'type':Sequelize[_0x084c('0x5')]}}; \ No newline at end of file +var _0xe6b8=['sequelize','moment','exports','blind','attended','STRING','Yes'];(function(_0x2bd0be,_0xf63d47){var _0x3e8e85=function(_0xdc0fbc){while(--_0xdc0fbc){_0x2bd0be['push'](_0x2bd0be['shift']());}};_0x3e8e85(++_0xf63d47);}(_0xe6b8,0x1b2));var _0x8e6b=function(_0x362de6,_0x43216d){_0x362de6=_0x362de6-0x0;var _0x41c2b5=_0xe6b8[_0x362de6];return _0x41c2b5;};'use strict';var Sequelize=require(_0x8e6b('0x0'));var moment=require(_0x8e6b('0x1'));module[_0x8e6b('0x2')]={'type':{'type':Sequelize['ENUM'](_0x8e6b('0x3'),_0x8e6b('0x4'))},'result':{'type':Sequelize[_0x8e6b('0x5')]},'transfererchannel':{'type':Sequelize[_0x8e6b('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8e6b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8e6b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x8e6b('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x8e6b('0x5')]},'transferercontext':{'type':Sequelize[_0x8e6b('0x5')]},'transfererexten':{'type':Sequelize[_0x8e6b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8e6b('0x5')]},'transfereechannel':{'type':Sequelize[_0x8e6b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8e6b('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8e6b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x8e6b('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8e6b('0x5')]},'transfereeexten':{'type':Sequelize[_0x8e6b('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8e6b('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x8e6b('0x6'),'No')},'context':{'type':Sequelize[_0x8e6b('0x5')]},'extension':{'type':Sequelize[_0x8e6b('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 360fbc7..010f3bd 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 _0xa984=['VIRTUAL','VoiceTransferReport','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge'];(function(_0x547c57,_0x5b52bb){var _0x3dc551=function(_0x3815d7){while(--_0x3815d7){_0x547c57['push'](_0x547c57['shift']());}};_0x3dc551(++_0x5b52bb);}(_0xa984,0xf0));var _0x4a98=function(_0x2b7806,_0x3b0257){_0x2b7806=_0x2b7806-0x0;var _0x162485=_0xa984[_0x2b7806];return _0x162485;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a98('0x0'));var zipdir=require(_0x4a98('0x1'));var jsonpatch=require(_0x4a98('0x2'));var rp=require(_0x4a98('0x3'));var moment=require(_0x4a98('0x4'));var BPromise=require(_0x4a98('0x5'));var Mustache=require(_0x4a98('0x6'));var util=require('util');var path=require(_0x4a98('0x7'));var sox=require(_0x4a98('0x8'));var csv=require(_0x4a98('0x9'));var ejs=require(_0x4a98('0xa'));var fs=require('fs');var fs_extra=require(_0x4a98('0xb'));var _=require('lodash');var squel=require(_0x4a98('0xc'));var crypto=require(_0x4a98('0xd'));var jsforce=require(_0x4a98('0xe'));var deskjs=require(_0x4a98('0xf'));var toCsv=require(_0x4a98('0x9'));var querystring=require(_0x4a98('0x10'));var Papa=require('papaparse');var Redis=require(_0x4a98('0x11'));var authService=require(_0x4a98('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4a98('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a98('0x14'));var utils=require('../../config/utils');var config=require(_0x4a98('0x15'));var licenseUtil=require(_0x4a98('0x16'));var db=require(_0x4a98('0x17'))['db'];function respondWithStatusCode(_0x5d5360,_0x13b11f){_0x13b11f=_0x13b11f||0xcc;return function(_0x149d8d){if(_0x149d8d){return _0x5d5360['sendStatus'](_0x13b11f);}return _0x5d5360[_0x4a98('0x18')](_0x13b11f)[_0x4a98('0x19')]();};}function respondWithResult(_0x4db43f,_0xc87c43){_0xc87c43=_0xc87c43||0xc8;return function(_0x44eb9c){if(_0x44eb9c){return _0x4db43f['status'](_0xc87c43)[_0x4a98('0x1a')](_0x44eb9c);}};}function respondWithFilteredResult(_0x2408fa,_0x4c00a6){return function(_0x463d72){if(_0x463d72){var _0x2d335e=typeof _0x4c00a6[_0x4a98('0x1b')]===_0x4a98('0x1c')&&typeof _0x4c00a6[_0x4a98('0x1d')]===_0x4a98('0x1c');var _0x41c765=_0x463d72['count'];var _0x3d0c39=_0x2d335e?0x0:_0x4c00a6[_0x4a98('0x1b')];var _0x46baa0=_0x2d335e?_0x463d72[_0x4a98('0x1e')]:_0x4c00a6[_0x4a98('0x1b')]+_0x4c00a6[_0x4a98('0x1d')];var _0x55ea92;if(_0x46baa0>=_0x41c765){_0x46baa0=_0x41c765;_0x55ea92=0xc8;}else{_0x55ea92=0xce;}_0x2408fa[_0x4a98('0x18')](_0x55ea92);return _0x2408fa[_0x4a98('0x1f')](_0x4a98('0x20'),_0x3d0c39+'-'+_0x46baa0+'/'+_0x41c765)[_0x4a98('0x1a')](_0x463d72);}return null;};}function patchUpdates(_0x17949e){return function(_0x3d42af){try{jsonpatch[_0x4a98('0x21')](_0x3d42af,_0x17949e,!![]);}catch(_0x227d72){return BPromise[_0x4a98('0x22')](_0x227d72);}return _0x3d42af['save']();};}function saveUpdates(_0x11b8a5,_0x3db4df){return function(_0x405de7){if(_0x405de7){return _0x405de7[_0x4a98('0x23')](_0x11b8a5)[_0x4a98('0x24')](function(_0x7eadf1){return _0x7eadf1;});}return null;};}function removeEntity(_0x5b79ef,_0x4172c9){return function(_0x32d2f3){if(_0x32d2f3){return _0x32d2f3['destroy']()['then'](function(){_0x5b79ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1d4d,_0x2bc800){return function(_0x48707){if(!_0x48707){_0x5f1d4d[_0x4a98('0x25')](0x194);}return _0x48707;};}function handleError(_0x1f1489,_0xf3d37d){_0xf3d37d=_0xf3d37d||0x1f4;return function(_0x2a6ce3){logger['error'](_0x2a6ce3[_0x4a98('0x26')]);if(_0x2a6ce3['name']){delete _0x2a6ce3[_0x4a98('0x27')];}_0x1f1489['status'](_0xf3d37d)[_0x4a98('0x28')](_0x2a6ce3);};}exports[_0x4a98('0x29')]=function(_0x652380,_0x57bb2e){var _0x124cf7={},_0x5b28cd={},_0x4438df={'count':0x0,'rows':[]};var _0x322783=_[_0x4a98('0x2a')](db['VoiceTransferReport'][_0x4a98('0x2b')],function(_0x5c792e){return{'name':_0x5c792e[_0x4a98('0x2c')],'type':_0x5c792e[_0x4a98('0x2d')]['key']};});_0x5b28cd[_0x4a98('0x2e')]=_[_0x4a98('0x2a')](_0x322783,'name');_0x5b28cd[_0x4a98('0x2f')]=_[_0x4a98('0x30')](_0x652380[_0x4a98('0x2f')]);_0x5b28cd['filters']=_['intersection'](_0x5b28cd['model'],_0x5b28cd[_0x4a98('0x2f')]);_0x124cf7[_0x4a98('0x31')]=_[_0x4a98('0x32')](_0x5b28cd[_0x4a98('0x2e')],qs['fields'](_0x652380[_0x4a98('0x2f')]['fields']));_0x124cf7['attributes']=_0x124cf7['attributes'][_0x4a98('0x33')]?_0x124cf7[_0x4a98('0x31')]:_0x5b28cd[_0x4a98('0x2e')];if(!_0x652380[_0x4a98('0x2f')][_0x4a98('0x34')](_0x4a98('0x35'))){_0x124cf7[_0x4a98('0x1d')]=qs[_0x4a98('0x1d')](_0x652380['query'][_0x4a98('0x1d')]);_0x124cf7[_0x4a98('0x1b')]=qs[_0x4a98('0x1b')](_0x652380[_0x4a98('0x2f')][_0x4a98('0x1b')]);}_0x124cf7[_0x4a98('0x36')]=qs['sort'](_0x652380[_0x4a98('0x2f')]['sort']);_0x124cf7['where']=qs[_0x4a98('0x37')](_[_0x4a98('0x38')](_0x652380['query'],_0x5b28cd[_0x4a98('0x37')]),_0x322783);if(_0x652380[_0x4a98('0x2f')][_0x4a98('0x39')]){_0x124cf7[_0x4a98('0x3a')]=_[_0x4a98('0x3b')](_0x124cf7[_0x4a98('0x3a')],{'$or':_[_0x4a98('0x2a')](_0x322783,function(_0x4ea21c){if(_0x4ea21c[_0x4a98('0x2d')]!==_0x4a98('0x3c')){var _0x3614c0={};_0x3614c0[_0x4ea21c[_0x4a98('0x27')]]={'$like':'%'+_0x652380[_0x4a98('0x2f')]['filter']+'%'};return _0x3614c0;}})});}_0x124cf7=_[_0x4a98('0x3b')]({},_0x124cf7,_0x652380['options']);var _0x321caf={'where':_0x124cf7['where']};return db[_0x4a98('0x3d')][_0x4a98('0x1e')](_0x321caf)[_0x4a98('0x24')](function(_0x3b0b2b){_0x4438df[_0x4a98('0x1e')]=_0x3b0b2b;if(_0x652380[_0x4a98('0x2f')]['includeAll']){_0x124cf7[_0x4a98('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x4a98('0x3f')](_0x124cf7);})['then'](function(_0x828ade){_0x4438df[_0x4a98('0x40')]=_0x828ade;return _0x4438df;})['then'](respondWithFilteredResult(_0x57bb2e,_0x124cf7))[_0x4a98('0x41')](handleError(_0x57bb2e,null));};exports[_0x4a98('0x42')]=function(_0x3bb215,_0x2f4bed){var _0x20364d={'raw':!![],'where':{'id':_0x3bb215['params']['id']}},_0x3e7f3c={};_0x3e7f3c[_0x4a98('0x2e')]=_['keys'](db[_0x4a98('0x3d')][_0x4a98('0x2b')]);_0x3e7f3c['query']=_[_0x4a98('0x30')](_0x3bb215['query']);_0x3e7f3c[_0x4a98('0x37')]=_[_0x4a98('0x32')](_0x3e7f3c[_0x4a98('0x2e')],_0x3e7f3c[_0x4a98('0x2f')]);_0x20364d[_0x4a98('0x31')]=_['intersection'](_0x3e7f3c[_0x4a98('0x2e')],qs[_0x4a98('0x43')](_0x3bb215[_0x4a98('0x2f')]['fields']));_0x20364d[_0x4a98('0x31')]=_0x20364d[_0x4a98('0x31')][_0x4a98('0x33')]?_0x20364d['attributes']:_0x3e7f3c[_0x4a98('0x2e')];if(_0x3bb215[_0x4a98('0x2f')][_0x4a98('0x44')]){_0x20364d[_0x4a98('0x3e')]=[{'all':!![]}];}_0x20364d=_[_0x4a98('0x3b')]({},_0x20364d,_0x3bb215['options']);return db[_0x4a98('0x3d')][_0x4a98('0x45')](_0x20364d)['then'](handleEntityNotFound(_0x2f4bed,null))[_0x4a98('0x24')](respondWithResult(_0x2f4bed,null))[_0x4a98('0x41')](handleError(_0x2f4bed,null));};exports[_0x4a98('0x46')]=function(_0x412bc6,_0x4efd64){return db[_0x4a98('0x3d')]['create'](_0x412bc6['body'],{})[_0x4a98('0x24')](respondWithResult(_0x4efd64,0xc9))[_0x4a98('0x41')](handleError(_0x4efd64,null));};exports[_0x4a98('0x23')]=function(_0x34ca45,_0x31e9a4){if(_0x34ca45[_0x4a98('0x47')]['id']){delete _0x34ca45['body']['id'];}return db['VoiceTransferReport'][_0x4a98('0x45')]({'where':{'id':_0x34ca45[_0x4a98('0x48')]['id']}})[_0x4a98('0x24')](handleEntityNotFound(_0x31e9a4,null))['then'](saveUpdates(_0x34ca45[_0x4a98('0x47')],null))[_0x4a98('0x24')](respondWithResult(_0x31e9a4,null))[_0x4a98('0x41')](handleError(_0x31e9a4,null));};exports[_0x4a98('0x49')]=function(_0x96022b,_0x12f746){return db['VoiceTransferReport']['find']({'where':{'id':_0x96022b[_0x4a98('0x48')]['id']}})[_0x4a98('0x24')](handleEntityNotFound(_0x12f746,null))['then'](removeEntity(_0x12f746,null))['catch'](handleError(_0x12f746,null));};exports[_0x4a98('0x4a')]=function(_0x473ea1,_0x311077){return db['VoiceTransferReport'][_0x4a98('0x4a')]()[_0x4a98('0x24')](respondWithResult(_0x311077,null))[_0x4a98('0x41')](handleError(_0x311077,null));}; \ No newline at end of file +var _0x7bb4=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','error','stack','send','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','name','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','VoiceTransferReport','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1d2f15,_0x1107c6){var _0x19efd2=function(_0x5e7bf7){while(--_0x5e7bf7){_0x1d2f15['push'](_0x1d2f15['shift']());}};_0x19efd2(++_0x1107c6);}(_0x7bb4,0x89));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x47bb('0x0'));var rimraf=require(_0x47bb('0x1'));var zipdir=require(_0x47bb('0x2'));var jsonpatch=require(_0x47bb('0x3'));var rp=require(_0x47bb('0x4'));var moment=require(_0x47bb('0x5'));var BPromise=require(_0x47bb('0x6'));var Mustache=require('mustache');var util=require(_0x47bb('0x7'));var path=require(_0x47bb('0x8'));var sox=require('sox');var csv=require(_0x47bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47bb('0xa'));var _=require(_0x47bb('0xb'));var squel=require(_0x47bb('0xc'));var crypto=require(_0x47bb('0xd'));var jsforce=require(_0x47bb('0xe'));var deskjs=require(_0x47bb('0xf'));var toCsv=require(_0x47bb('0x9'));var querystring=require(_0x47bb('0x10'));var Papa=require(_0x47bb('0x11'));var Redis=require('ioredis');var authService=require(_0x47bb('0x12'));var qs=require(_0x47bb('0x13'));var as=require(_0x47bb('0x14'));var hardwareService=require(_0x47bb('0x15'));var logger=require(_0x47bb('0x16'))(_0x47bb('0x17'));var utils=require('../../config/utils');var config=require(_0x47bb('0x18'));var licenseUtil=require(_0x47bb('0x19'));var db=require(_0x47bb('0x1a'))['db'];function respondWithStatusCode(_0x40f1a3,_0x587845){_0x587845=_0x587845||0xcc;return function(_0x475a3b){if(_0x475a3b){return _0x40f1a3[_0x47bb('0x1b')](_0x587845);}return _0x40f1a3[_0x47bb('0x1c')](_0x587845)[_0x47bb('0x1d')]();};}function respondWithResult(_0x39e68e,_0x8c1184){_0x8c1184=_0x8c1184||0xc8;return function(_0x5bf17f){if(_0x5bf17f){return _0x39e68e['status'](_0x8c1184)[_0x47bb('0x1e')](_0x5bf17f);}};}function respondWithFilteredResult(_0x7220cb,_0x466bda){return function(_0x5a01b8){if(_0x5a01b8){var _0x509373=typeof _0x466bda['offset']==='undefined'&&typeof _0x466bda[_0x47bb('0x1f')]===_0x47bb('0x20');var _0x4bab51=_0x5a01b8[_0x47bb('0x21')];var _0x19224a=_0x509373?0x0:_0x466bda[_0x47bb('0x22')];var _0x58678f=_0x509373?_0x5a01b8[_0x47bb('0x21')]:_0x466bda[_0x47bb('0x22')]+_0x466bda[_0x47bb('0x1f')];var _0x2974dc;if(_0x58678f>=_0x4bab51){_0x58678f=_0x4bab51;_0x2974dc=0xc8;}else{_0x2974dc=0xce;}_0x7220cb['status'](_0x2974dc);return _0x7220cb[_0x47bb('0x23')]('Content-Range',_0x19224a+'-'+_0x58678f+'/'+_0x4bab51)['json'](_0x5a01b8);}return null;};}function patchUpdates(_0x51faad){return function(_0x4aab87){try{jsonpatch[_0x47bb('0x24')](_0x4aab87,_0x51faad,!![]);}catch(_0x34b8e9){return BPromise[_0x47bb('0x25')](_0x34b8e9);}return _0x4aab87['save']();};}function saveUpdates(_0x30499,_0x2be8f5){return function(_0x56ae4a){if(_0x56ae4a){return _0x56ae4a[_0x47bb('0x26')](_0x30499)[_0x47bb('0x27')](function(_0x29d791){return _0x29d791;});}return null;};}function removeEntity(_0x35d920,_0xe56c36){return function(_0x1c55c5){if(_0x1c55c5){return _0x1c55c5['destroy']()[_0x47bb('0x27')](function(){_0x35d920[_0x47bb('0x1c')](0xcc)[_0x47bb('0x1d')]();});}};}function handleEntityNotFound(_0x474164,_0x1f7295){return function(_0x8922fa){if(!_0x8922fa){_0x474164[_0x47bb('0x1b')](0x194);}return _0x8922fa;};}function handleError(_0x59c2f7,_0x3251c1){_0x3251c1=_0x3251c1||0x1f4;return function(_0x3c061e){logger[_0x47bb('0x28')](_0x3c061e[_0x47bb('0x29')]);if(_0x3c061e['name']){delete _0x3c061e['name'];}_0x59c2f7[_0x47bb('0x1c')](_0x3251c1)[_0x47bb('0x2a')](_0x3c061e);};}exports[_0x47bb('0x2b')]=function(_0x122c42,_0x500c12){var _0x532770={},_0x567102={},_0x331759={'count':0x0,'rows':[]};var _0x2e2c98=_['map'](db['VoiceTransferReport'][_0x47bb('0x2c')],function(_0x6fa736){return{'name':_0x6fa736[_0x47bb('0x2d')],'type':_0x6fa736[_0x47bb('0x2e')]['key']};});_0x567102['model']=_[_0x47bb('0x2f')](_0x2e2c98,'name');_0x567102[_0x47bb('0x30')]=_['keys'](_0x122c42[_0x47bb('0x30')]);_0x567102[_0x47bb('0x31')]=_[_0x47bb('0x32')](_0x567102[_0x47bb('0x33')],_0x567102[_0x47bb('0x30')]);_0x532770['attributes']=_[_0x47bb('0x32')](_0x567102[_0x47bb('0x33')],qs['fields'](_0x122c42[_0x47bb('0x30')]['fields']));_0x532770['attributes']=_0x532770['attributes'][_0x47bb('0x34')]?_0x532770[_0x47bb('0x35')]:_0x567102[_0x47bb('0x33')];if(!_0x122c42['query'][_0x47bb('0x36')](_0x47bb('0x37'))){_0x532770[_0x47bb('0x1f')]=qs[_0x47bb('0x1f')](_0x122c42['query'][_0x47bb('0x1f')]);_0x532770['offset']=qs['offset'](_0x122c42[_0x47bb('0x30')][_0x47bb('0x22')]);}_0x532770[_0x47bb('0x38')]=qs[_0x47bb('0x39')](_0x122c42[_0x47bb('0x30')][_0x47bb('0x39')]);_0x532770[_0x47bb('0x3a')]=qs['filters'](_[_0x47bb('0x3b')](_0x122c42['query'],_0x567102[_0x47bb('0x31')]),_0x2e2c98);if(_0x122c42['query'][_0x47bb('0x3c')]){_0x532770[_0x47bb('0x3a')]=_['merge'](_0x532770[_0x47bb('0x3a')],{'$or':_[_0x47bb('0x2f')](_0x2e2c98,function(_0x31b484){if(_0x31b484[_0x47bb('0x2e')]!=='VIRTUAL'){var _0x15e857={};_0x15e857[_0x31b484[_0x47bb('0x3d')]]={'$like':'%'+_0x122c42[_0x47bb('0x30')][_0x47bb('0x3c')]+'%'};return _0x15e857;}})});}_0x532770=_[_0x47bb('0x3e')]({},_0x532770,_0x122c42[_0x47bb('0x3f')]);var _0x284795={'where':_0x532770['where']};return db['VoiceTransferReport'][_0x47bb('0x21')](_0x284795)[_0x47bb('0x27')](function(_0x5d03dd){_0x331759[_0x47bb('0x21')]=_0x5d03dd;if(_0x122c42[_0x47bb('0x30')][_0x47bb('0x40')]){_0x532770[_0x47bb('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x47bb('0x42')](_0x532770);})['then'](function(_0x2798cf){_0x331759[_0x47bb('0x43')]=_0x2798cf;return _0x331759;})['then'](respondWithFilteredResult(_0x500c12,_0x532770))[_0x47bb('0x44')](handleError(_0x500c12,null));};exports[_0x47bb('0x45')]=function(_0x28670f,_0x4c0ff2){var _0x5cf9b9={'raw':!![],'where':{'id':_0x28670f[_0x47bb('0x46')]['id']}},_0x196c16={};_0x196c16[_0x47bb('0x33')]=_[_0x47bb('0x47')](db[_0x47bb('0x48')]['rawAttributes']);_0x196c16[_0x47bb('0x30')]=_[_0x47bb('0x47')](_0x28670f[_0x47bb('0x30')]);_0x196c16[_0x47bb('0x31')]=_['intersection'](_0x196c16[_0x47bb('0x33')],_0x196c16['query']);_0x5cf9b9[_0x47bb('0x35')]=_[_0x47bb('0x32')](_0x196c16[_0x47bb('0x33')],qs[_0x47bb('0x49')](_0x28670f[_0x47bb('0x30')][_0x47bb('0x49')]));_0x5cf9b9[_0x47bb('0x35')]=_0x5cf9b9[_0x47bb('0x35')][_0x47bb('0x34')]?_0x5cf9b9['attributes']:_0x196c16['model'];if(_0x28670f[_0x47bb('0x30')][_0x47bb('0x40')]){_0x5cf9b9[_0x47bb('0x41')]=[{'all':!![]}];}_0x5cf9b9=_[_0x47bb('0x3e')]({},_0x5cf9b9,_0x28670f[_0x47bb('0x3f')]);return db['VoiceTransferReport'][_0x47bb('0x4a')](_0x5cf9b9)['then'](handleEntityNotFound(_0x4c0ff2,null))[_0x47bb('0x27')](respondWithResult(_0x4c0ff2,null))['catch'](handleError(_0x4c0ff2,null));};exports[_0x47bb('0x4b')]=function(_0xa34ddf,_0x41881f){return db['VoiceTransferReport'][_0x47bb('0x4b')](_0xa34ddf[_0x47bb('0x4c')],{})[_0x47bb('0x27')](respondWithResult(_0x41881f,0xc9))[_0x47bb('0x44')](handleError(_0x41881f,null));};exports[_0x47bb('0x26')]=function(_0x3b0e00,_0x27a125){if(_0x3b0e00[_0x47bb('0x4c')]['id']){delete _0x3b0e00[_0x47bb('0x4c')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x3b0e00[_0x47bb('0x46')]['id']}})[_0x47bb('0x27')](handleEntityNotFound(_0x27a125,null))['then'](saveUpdates(_0x3b0e00[_0x47bb('0x4c')],null))[_0x47bb('0x27')](respondWithResult(_0x27a125,null))[_0x47bb('0x44')](handleError(_0x27a125,null));};exports[_0x47bb('0x4d')]=function(_0x2f42cb,_0x304182){return db['VoiceTransferReport']['find']({'where':{'id':_0x2f42cb[_0x47bb('0x46')]['id']}})[_0x47bb('0x27')](handleEntityNotFound(_0x304182,null))[_0x47bb('0x27')](removeEntity(_0x304182,null))['catch'](handleError(_0x304182,null));};exports['describe']=function(_0x7e277c,_0x3c0c13){return db[_0x47bb('0x48')][_0x47bb('0x4e')]()[_0x47bb('0x27')](respondWithResult(_0x3c0c13,null))[_0x47bb('0x44')](handleError(_0x3c0c13,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6e5fbde..609eca3 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 _0xed46=['request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x29492d,_0x4152e9){var _0x2b9592=function(_0x4cdd06){while(--_0x4cdd06){_0x29492d['push'](_0x29492d['shift']());}};_0x2b9592(++_0x4152e9);}(_0xed46,0x1ce));var _0x6ed4=function(_0x43d604,_0x38a6d3){_0x43d604=_0x43d604-0x0;var _0x2f0f74=_0xed46[_0x43d604];return _0x2f0f74;};'use strict';var _=require(_0x6ed4('0x0'));var util=require(_0x6ed4('0x1'));var logger=require(_0x6ed4('0x2'))(_0x6ed4('0x3'));var moment=require(_0x6ed4('0x4'));var BPromise=require(_0x6ed4('0x5'));var rp=require(_0x6ed4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ed4('0x7'));var config=require(_0x6ed4('0x8'));var attributes=require(_0x6ed4('0x9'));module[_0x6ed4('0xa')]=function(_0x14bad4,_0x282d82){return _0x14bad4[_0x6ed4('0xb')]('VoiceTransferReport',attributes,{'tableName':_0x6ed4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb12a=['api','bluebird','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','../../config/logger'];(function(_0x128a1c,_0x4b455c){var _0x2c4f02=function(_0x47aa34){while(--_0x47aa34){_0x128a1c['push'](_0x128a1c['shift']());}};_0x2c4f02(++_0x4b455c);}(_0xb12a,0x1b6));var _0xab12=function(_0x3ee2d5,_0x268c60){_0x3ee2d5=_0x3ee2d5-0x0;var _0x51d818=_0xb12a[_0x3ee2d5];return _0x51d818;};'use strict';var _=require(_0xab12('0x0'));var util=require('util');var logger=require(_0xab12('0x1'))(_0xab12('0x2'));var moment=require('moment');var BPromise=require(_0xab12('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab12('0x4'));var config=require(_0xab12('0x5'));var attributes=require(_0xab12('0x6'));module[_0xab12('0x7')]=function(_0x3d51e7,_0x21993b){return _0x3d51e7[_0xab12('0x8')](_0xab12('0x9'),attributes,{'tableName':'report_call_transfer','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 79f69b3..a7eefd5 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 _0xeec1=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','VoiceTransferReport','body','options','then','CreateVoiceTransferReport','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0xeec1,0xd7));var _0x1eec=function(_0x5ce6f1,_0x23d85b){_0x5ce6f1=_0x5ce6f1-0x0;var _0x3e70f6=_0xeec1[_0x5ce6f1];return _0x3e70f6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1eec('0x0'));var rs=require(_0x1eec('0x1'));var fs=require('fs');var Redis=require(_0x1eec('0x2'));var db=require(_0x1eec('0x3'))['db'];var utils=require(_0x1eec('0x4'));var logger=require('../../config/logger')(_0x1eec('0x5'));var config=require('../../config/environment');var jayson=require(_0x1eec('0x6'));var client=jayson['client'][_0x1eec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2ca0,_0x50ddb4,_0x4f6bb3){return new BPromise(function(_0x1ee530,_0x34c400){return client[_0x1eec('0x8')](_0x5e2ca0,_0x4f6bb3)['then'](function(_0x4b4117){logger['info'](_0x1eec('0x9'),_0x50ddb4,'request\x20sent');logger[_0x1eec('0xa')](_0x1eec('0xb'),_0x50ddb4,'request\x20sent',JSON[_0x1eec('0xc')](_0x4b4117));if(_0x4b4117[_0x1eec('0xd')]){if(_0x4b4117['error'][_0x1eec('0xe')]===0x1f4){logger['error'](_0x1eec('0x9'),_0x50ddb4,_0x4b4117[_0x1eec('0xd')][_0x1eec('0xf')]);return _0x34c400(_0x4b4117[_0x1eec('0xd')][_0x1eec('0xf')]);}logger[_0x1eec('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x50ddb4,_0x4b4117['error'][_0x1eec('0xf')]);return _0x1ee530(_0x4b4117['error'][_0x1eec('0xf')]);}else{logger[_0x1eec('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x50ddb4,_0x1eec('0x11'));_0x1ee530(_0x4b4117[_0x1eec('0x12')][_0x1eec('0xf')]);}})[_0x1eec('0x13')](function(_0x1c9d07){logger[_0x1eec('0xd')](_0x1eec('0x9'),_0x50ddb4,_0x1c9d07);_0x34c400(_0x1c9d07);});});}exports['CreateVoiceTransferReport']=function(_0x2468fa){var _0x495ebe=this;return new Promise(function(_0x4d0df1,_0x41a4e1){return db[_0x1eec('0x14')]['create'](_0x2468fa[_0x1eec('0x15')],{'raw':_0x2468fa[_0x1eec('0x16')]?_0x2468fa[_0x1eec('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1eec('0x17')](function(_0x1cd4a9){logger[_0x1eec('0x10')](_0x1eec('0x18'),_0x2468fa);logger[_0x1eec('0xa')]('CreateVoiceTransferReport',_0x2468fa,JSON[_0x1eec('0xc')](_0x1cd4a9));_0x4d0df1(_0x1cd4a9);})[_0x1eec('0x13')](function(_0x3b8f0d){logger[_0x1eec('0xd')](_0x1eec('0x18'),_0x3b8f0d[_0x1eec('0xf')],_0x2468fa);_0x41a4e1(_0x495ebe[_0x1eec('0xd')](0x1f4,_0x3b8f0d[_0x1eec('0xf')]));});});}; \ No newline at end of file +var _0xbb38=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw'];(function(_0xdcd43c,_0x5aef36){var _0x15897f=function(_0x2a37ac){while(--_0x2a37ac){_0xdcd43c['push'](_0xdcd43c['shift']());}};_0x15897f(++_0x5aef36);}(_0xbb38,0x1e0));var _0x8bb3=function(_0x4e9861,_0x25fe5f){_0x4e9861=_0x4e9861-0x0;var _0x49802f=_0xbb38[_0x4e9861];return _0x49802f;};'use strict';var _=require(_0x8bb3('0x0'));var util=require('util');var moment=require(_0x8bb3('0x1'));var BPromise=require('bluebird');var rs=require(_0x8bb3('0x2'));var fs=require('fs');var Redis=require(_0x8bb3('0x3'));var db=require(_0x8bb3('0x4'))['db'];var utils=require(_0x8bb3('0x5'));var logger=require(_0x8bb3('0x6'))(_0x8bb3('0x7'));var config=require(_0x8bb3('0x8'));var jayson=require(_0x8bb3('0x9'));var client=jayson[_0x8bb3('0xa')][_0x8bb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10d30b,_0x5e162b,_0x336440){return new BPromise(function(_0x2c504b,_0x34fc0f){return client[_0x8bb3('0xc')](_0x10d30b,_0x336440)[_0x8bb3('0xd')](function(_0x503367){logger[_0x8bb3('0xe')](_0x8bb3('0xf'),_0x5e162b,_0x8bb3('0x10'));logger[_0x8bb3('0x11')](_0x8bb3('0x12'),_0x5e162b,'request\x20sent',JSON[_0x8bb3('0x13')](_0x503367));if(_0x503367['error']){if(_0x503367[_0x8bb3('0x14')][_0x8bb3('0x15')]===0x1f4){logger[_0x8bb3('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x5e162b,_0x503367['error']['message']);return _0x34fc0f(_0x503367['error'][_0x8bb3('0x16')]);}logger[_0x8bb3('0x14')](_0x8bb3('0xf'),_0x5e162b,_0x503367[_0x8bb3('0x14')][_0x8bb3('0x16')]);return _0x2c504b(_0x503367[_0x8bb3('0x14')][_0x8bb3('0x16')]);}else{logger[_0x8bb3('0xe')](_0x8bb3('0xf'),_0x5e162b,'request\x20sent');_0x2c504b(_0x503367[_0x8bb3('0x17')][_0x8bb3('0x16')]);}})[_0x8bb3('0x18')](function(_0x17f90a){logger[_0x8bb3('0x14')](_0x8bb3('0xf'),_0x5e162b,_0x17f90a);_0x34fc0f(_0x17f90a);});});}exports[_0x8bb3('0x19')]=function(_0x4ef542){var _0x25fb46=this;return new Promise(function(_0x3b579f,_0x3ba590){return db[_0x8bb3('0x1a')]['create'](_0x4ef542[_0x8bb3('0x1b')],{'raw':_0x4ef542[_0x8bb3('0x1c')]?_0x4ef542[_0x8bb3('0x1c')][_0x8bb3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3b389a){logger['info'](_0x8bb3('0x19'),_0x4ef542);logger[_0x8bb3('0x11')](_0x8bb3('0x19'),_0x4ef542,JSON[_0x8bb3('0x13')](_0x3b389a));_0x3b579f(_0x3b389a);})[_0x8bb3('0x18')](function(_0x1fc6eb){logger[_0x8bb3('0x14')](_0x8bb3('0x19'),_0x1fc6eb[_0x8bb3('0x16')],_0x4ef542);_0x3ba590(_0x25fb46[_0x8bb3('0x14')](0x1f4,_0x1fc6eb[_0x8bb3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9e11ff0..3030eee 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 _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xcb91[_0x455c6c];return _0x488242;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x593683,_0x2b3213){var _0x44cc39=function(_0x5f085d){while(--_0x5f085d){_0x593683['push'](_0x593683['shift']());}};_0x44cc39(++_0x2b3213);}(_0xb821,0xa7));var _0x1b82=function(_0x223e30,_0x372680){_0x223e30=_0x223e30-0x0;var _0x5f3f14=_0xb821[_0x223e30];return _0x5f3f14;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 851eceb..ebab5a0 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 _0x24cf=['userId','callbackUrl','entityFound:','format','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','user:%s','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','all','filter','UserId','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','localhost','redis','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','agent','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json'];(function(_0x6f16b9,_0x91743){var _0xdccdaa=function(_0x951aa3){while(--_0x951aa3){_0x6f16b9['push'](_0x6f16b9['shift']());}};_0xdccdaa(++_0x91743);}(_0x24cf,0x1d5));var _0xf24c=function(_0x5c396f,_0x109517){_0x5c396f=_0x5c396f-0x0;var _0x4a2675=_0x24cf[_0x5c396f];return _0x4a2675;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xf24c('0x0'))['db'];var config=require(_0xf24c('0x1'));var util=require(_0xf24c('0x2'));var BPromise=require(_0xf24c('0x3'));var jayson=require(_0xf24c('0x4'));var amiClient=jayson['client'][_0xf24c('0x5')]({'port':0x232a});var logger=require(_0xf24c('0x6'))(_0xf24c('0x7'));var Redis=require(_0xf24c('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0xf24c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf24c('0xa')]));var Schema=require(_0xf24c('0xb'));var originateValidation=new Schema({'userId':{'type':_0xf24c('0xc'),'required':[!![],_0xf24c('0xd')]},'callNumber':{'type':'string','required':[!![],_0xf24c('0xe')]},'callerId':{'type':_0xf24c('0xf')},'callbackUrl':{'type':_0xf24c('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xf24c('0xc'),'required':[!![],_0xf24c('0xd')]},'sessionId':{'type':_0xf24c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf24c('0xd')]},'sessionId':{'type':_0xf24c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf24c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf24c('0xf'),'required':[!![],_0xf24c('0x10')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xf24c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf24c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf24c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf24c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf24c('0xc'),'required':[!![],_0xf24c('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf24c('0xc'),'required':[!![],_0xf24c('0xd')]}});function emit(_0x4f20cd,_0x5c46a5,_0x32787d){logger[_0xf24c('0x11')](_0x4f20cd,_0x5c46a5,JSON['stringify'](_0x32787d));io['to'](_0x4f20cd)[_0xf24c('0x12')](_0x5c46a5,_0x32787d);}function handleError(_0x35eb58){return function(_0x2d9015){console[_0xf24c('0x13')](_0xf24c('0x14'),_0x2d9015,_0x2d9015 instanceof RangeError);logger[_0xf24c('0x15')](_0x2d9015[_0xf24c('0x16')]);if(_0x2d9015 instanceof RangeError){if(_0x2d9015[_0xf24c('0x17')]){delete _0x2d9015[_0xf24c('0x17')];}_0x35eb58[_0xf24c('0x18')](0x194)[_0xf24c('0x19')](_0x2d9015);}else{if(_0x2d9015[_0xf24c('0x17')]){delete _0x2d9015['name'];}_0x35eb58[_0xf24c('0x18')](0x1f4)[_0xf24c('0x19')](_0x2d9015);}};}function checkError(){return function(_0x56ffff){if(!_0x56ffff){throw new RangeError(_0xf24c('0x1a'));}return _0x56ffff;};}function respondWithRpcPromise(_0x171190,_0x3ab497){return new BPromise(function(_0x47af64,_0x5885a5){var _0x5090e6=amiClient;return _0x5090e6[_0xf24c('0x1b')](_0x171190,_0x3ab497)[_0xf24c('0x1c')](function(_0x4c5984){if(_0x4c5984[_0xf24c('0x15')]){if(_0x4c5984[_0xf24c('0x15')][_0xf24c('0x1d')]===0x1f4){return _0x5885a5(_0x4c5984[_0xf24c('0x15')][_0xf24c('0x1e')]);}return _0x47af64(_0x4c5984[_0xf24c('0x15')][_0xf24c('0x1e')]);}else{_0x47af64(_0x4c5984[_0xf24c('0x1f')]);}})[_0xf24c('0x20')](function(_0xc9fd87){_0x5885a5(_0xc9fd87);});});}function getAgent(_0x14003a){return db['User']['findOne']({'where':{'id':_0x14003a,'role':_0xf24c('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x535e78,_0x46d94b){return new BPromise(function(_0x5eb931,_0x191c46){var _0x379f9a=respondWithRpcPromise('VoiceChannels');var _0x563ebe=getAgent(_0x535e78);Promise['all']([_0x379f9a,_0x563ebe])[_0xf24c('0x1c')](function(_0x52427b){var _0x33f5b9=_0x52427b[0x0];var _0x266cfe=_0x52427b[0x1];var _0x2ee712=_['filter'](_0x33f5b9[_0xf24c('0x22')],function(_0x4f0777){return _0x4f0777['UserId']==_0x266cfe['id']&&_0x4f0777[_0xf24c('0x23')]==_0x46d94b;});if(_0x2ee712[_0xf24c('0x24')]==0x1){_0x5eb931(_0x266cfe);}else{_0x191c46(new RangeError(_0xf24c('0x25')+_0x46d94b+_0xf24c('0x26')));}});});}exports['originate']=function(_0x27026f,_0x13adfb){logger[_0xf24c('0x11')](_0xf24c('0x27'),_0x27026f[_0xf24c('0x28')]);var _0x16c827=originateValidation['validate'](_0x27026f[_0xf24c('0x28')]);if(_0x16c827[_0xf24c('0x24')]>0x0){return _0x13adfb[_0xf24c('0x18')](0x190)[_0xf24c('0x29')](_0x16c827);}var _0x2f399a=_0x27026f[_0xf24c('0x28')][_0xf24c('0x2a')];var _0x5c8f4a=_0x27026f[_0xf24c('0x28')]['callNumber'];var _0x428d8b=_0x27026f[_0xf24c('0x28')]['callerId'];var _0x30c240=_0x27026f['body'][_0xf24c('0x2b')];return getAgent(_0x2f399a)[_0xf24c('0x1c')](function(_0x17f2b7){logger['info'](_0xf24c('0x2c'),_0x17f2b7['name']);emit(util[_0xf24c('0x2d')]('user:%s',_0x17f2b7['name']),'webbar:originate',{'callNumber':_0x5c8f4a,'callerId':_0x428d8b,'callbackUrl':_0x30c240});return _0x13adfb[_0xf24c('0x18')](0xc8)[_0xf24c('0x29')]({'error':![],'message':_0xf24c('0x2e')});})[_0xf24c('0x20')](handleError(_0x13adfb));};exports[_0xf24c('0x2f')]=function(_0x191d7a,_0x3ddc56){logger['info'](_0xf24c('0x30'),_0x191d7a[_0xf24c('0x28')]);var _0x2332e6=hangupValidation[_0xf24c('0xb')](_0x191d7a[_0xf24c('0x28')]);if(_0x2332e6['length']>0x0){return _0x3ddc56[_0xf24c('0x18')](0x190)['json'](_0x2332e6);}var _0x3e027f=_0x191d7a[_0xf24c('0x28')][_0xf24c('0x2a')];var _0x1939de=_0x191d7a[_0xf24c('0x28')][_0xf24c('0x23')];return getAgent(_0x3e027f)[_0xf24c('0x1c')](function(_0x37f00a){logger[_0xf24c('0x11')](_0xf24c('0x2c'),_0x37f00a[_0xf24c('0x17')]);emit(util['format']('user:%s',_0x37f00a[_0xf24c('0x17')]),_0xf24c('0x31'),{'sessionId':_0x1939de});return _0x3ddc56[_0xf24c('0x18')](0xc8)[_0xf24c('0x29')]({'error':![],'message':_0xf24c('0x32')});})[_0xf24c('0x20')](handleError(_0x3ddc56));};exports[_0xf24c('0x33')]=function(_0x3e5a27,_0x39b45b){logger[_0xf24c('0x11')](_0xf24c('0x34'),_0x3e5a27['body']);var _0x18eb16=answerValidation['validate'](_0x3e5a27[_0xf24c('0x28')]);if(_0x18eb16[_0xf24c('0x24')]>0x0){return _0x39b45b[_0xf24c('0x18')](0x190)[_0xf24c('0x29')](_0x18eb16);}var _0x174820=_0x3e5a27[_0xf24c('0x28')][_0xf24c('0x2a')];var _0x462354=_0x3e5a27[_0xf24c('0x28')][_0xf24c('0x23')];return getAgent(_0x174820)[_0xf24c('0x1c')](function(_0xcadea1){logger[_0xf24c('0x11')](_0xf24c('0x2c'),_0xcadea1[_0xf24c('0x17')]);emit(util['format']('user:%s',_0xcadea1[_0xf24c('0x17')]),_0xf24c('0x35'),{'sessionId':_0x462354});return _0x39b45b[_0xf24c('0x18')](0xc8)[_0xf24c('0x29')]({'error':![],'message':_0xf24c('0x36')});})['catch'](handleError(_0x39b45b));};exports[_0xf24c('0x37')]=function(_0x3f8610,_0x10c3c8){logger[_0xf24c('0x11')]('hold\x20fired:',_0x3f8610[_0xf24c('0x28')]);var _0xe6f8ab=holdValidation[_0xf24c('0xb')](_0x3f8610[_0xf24c('0x28')]);if(_0xe6f8ab[_0xf24c('0x24')]>0x0){return _0x10c3c8[_0xf24c('0x18')](0x190)[_0xf24c('0x29')](_0xe6f8ab);}var _0x3e8876=_0x3f8610[_0xf24c('0x28')][_0xf24c('0x2a')];var _0x4054c4=_0x3f8610[_0xf24c('0x28')][_0xf24c('0x23')];return getAgent(_0x3e8876)[_0xf24c('0x1c')](function(_0x343099){logger[_0xf24c('0x11')](_0xf24c('0x2c'),_0x343099['name']);emit(util[_0xf24c('0x2d')](_0xf24c('0x38'),_0x343099[_0xf24c('0x17')]),_0xf24c('0x39'),{'sessionId':_0x4054c4});return _0x10c3c8[_0xf24c('0x18')](0xc8)[_0xf24c('0x29')]({'error':![],'message':_0xf24c('0x3a')});})[_0xf24c('0x20')](handleError(_0x10c3c8));};exports[_0xf24c('0x3b')]=function(_0x42fad2,_0x5747de){logger[_0xf24c('0x11')](_0xf24c('0x3c'),_0x42fad2['body']);var _0x517dbf=unholdValidation[_0xf24c('0xb')](_0x42fad2[_0xf24c('0x28')]);if(_0x517dbf[_0xf24c('0x24')]>0x0){return _0x5747de[_0xf24c('0x18')](0x190)[_0xf24c('0x29')](_0x517dbf);}var _0x2108f8=_0x42fad2[_0xf24c('0x28')][_0xf24c('0x2a')];var _0x382cd1=_0x42fad2['body'][_0xf24c('0x23')];return getAgent(_0x2108f8)['then'](function(_0x4e3154){logger[_0xf24c('0x11')](_0xf24c('0x2c'),_0x4e3154[_0xf24c('0x17')]);emit(util[_0xf24c('0x2d')](_0xf24c('0x38'),_0x4e3154[_0xf24c('0x17')]),_0xf24c('0x3d'),{'sessionId':_0x382cd1});return _0x5747de[_0xf24c('0x18')](0xc8)[_0xf24c('0x29')]({'error':![],'message':_0xf24c('0x3e')});})['catch'](handleError(_0x5747de));};exports['calls']=function(_0x524ef2,_0x4fca6c){logger[_0xf24c('0x11')](_0xf24c('0x3f'),_0x4fca6c[_0xf24c('0x28')]);var _0xfca4a6=callsValidation[_0xf24c('0xb')](_0x524ef2[_0xf24c('0x28')]);if(_0xfca4a6[_0xf24c('0x24')]>0x0){return _0x4fca6c[_0xf24c('0x18')](0x190)[_0xf24c('0x29')](_0xfca4a6);}var _0x35b71b=_0x524ef2[_0xf24c('0x28')][_0xf24c('0x2a')];var _0x4b669e=respondWithRpcPromise('VoiceChannels');var _0x35d85b=getAgent(_0x35b71b);return Promise[_0xf24c('0x40')]([_0x4b669e,_0x35d85b])['then'](function(_0x296ea4){var _0x2943b4=_0x296ea4[0x0];var _0x257006=_0x296ea4[0x1];var _0x431ffb=_[_0xf24c('0x41')](_0x2943b4['rows'],function(_0x1efd79){return _0x1efd79[_0xf24c('0x42')]==_0x257006['id'];});return _0x4fca6c['status'](0xc8)['json']({'count':_0x431ffb['length'],'rows':_0x431ffb});})[_0xf24c('0x20')](handleError(_0x4fca6c));};exports['conference']=function(_0x2307d2,_0x22860c){logger['info']('conference\x20fired:',_0x2307d2['body']);var _0x53cd01=conferenceValidation[_0xf24c('0xb')](_0x2307d2['body']);if(_0x53cd01[_0xf24c('0x24')]>0x0){return _0x22860c[_0xf24c('0x18')](0x190)['json'](_0x53cd01);}var _0x9e58ba=_0x2307d2[_0xf24c('0x28')][_0xf24c('0x2a')];return getAgent(_0x9e58ba)[_0xf24c('0x1c')](function(_0x403c01){logger['info']('entityFound:',_0x403c01[_0xf24c('0x17')]);emit(util[_0xf24c('0x2d')]('user:%s',_0x403c01[_0xf24c('0x17')]),_0xf24c('0x43'));return _0x22860c[_0xf24c('0x18')](0xc8)[_0xf24c('0x29')]({'error':![],'message':_0xf24c('0x44')});})[_0xf24c('0x20')](handleError(_0x22860c));};exports[_0xf24c('0x45')]=function(_0x31d3b2,_0x10b432){logger[_0xf24c('0x11')](_0xf24c('0x46'),_0x31d3b2[_0xf24c('0x28')]);var _0x1bd68c=transferValidation['validate'](_0x31d3b2[_0xf24c('0x28')]);if(_0x1bd68c[_0xf24c('0x24')]>0x0){return _0x10b432[_0xf24c('0x18')](0x190)['json'](_0x1bd68c);}var _0x2bb95d=_0x31d3b2[_0xf24c('0x28')][_0xf24c('0x2a')];var _0x5b7d33=_0x31d3b2[_0xf24c('0x28')]['sessionId'];var _0x153639=_0x31d3b2[_0xf24c('0x28')][_0xf24c('0x47')];return getAgent(_0x2bb95d)['then'](function(_0xcabeb){logger[_0xf24c('0x11')](_0xf24c('0x2c'),_0xcabeb[_0xf24c('0x17')]);emit(util[_0xf24c('0x2d')](_0xf24c('0x38'),_0xcabeb[_0xf24c('0x17')]),'webbar:transfer',{'sessionId':_0x5b7d33,'transferNumber':_0x153639});return _0x10b432['status'](0xc8)[_0xf24c('0x29')]({'error':![],'message':_0xf24c('0x48')});})[_0xf24c('0x20')](handleError(_0x10b432));}; \ No newline at end of file +var _0x5c12=['name','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','all','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','handleError:','error','status','send'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x5c12,0x188));var _0x25c1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5c12[_0x40a045];return _0x1a687c;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x25c1('0x0'));var db=require(_0x25c1('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var jayson=require(_0x25c1('0x4'));var amiClient=jayson[_0x25c1('0x5')][_0x25c1('0x6')]({'port':0x232a});var logger=require(_0x25c1('0x7'))(_0x25c1('0x8'));var Redis=require('ioredis');config[_0x25c1('0x9')]=_[_0x25c1('0xa')](config[_0x25c1('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25c1('0x9')]));var Schema=require(_0x25c1('0xb'));var originateValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'callNumber':{'type':_0x25c1('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x25c1('0xe')},'callbackUrl':{'type':_0x25c1('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':[!![],_0x25c1('0xf')]},'transferNumber':{'type':_0x25c1('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]}});function emit(_0x55b62d,_0x5d631e,_0x5b852a){logger[_0x25c1('0x10')](_0x55b62d,_0x5d631e,JSON[_0x25c1('0x11')](_0x5b852a));io['to'](_0x55b62d)['emit'](_0x5d631e,_0x5b852a);}function handleError(_0x4c55e7){return function(_0x61a29f){console['log'](_0x25c1('0x12'),_0x61a29f,_0x61a29f instanceof RangeError);logger[_0x25c1('0x13')](_0x61a29f['stack']);if(_0x61a29f instanceof RangeError){if(_0x61a29f['name']){delete _0x61a29f['name'];}_0x4c55e7[_0x25c1('0x14')](0x194)[_0x25c1('0x15')](_0x61a29f);}else{if(_0x61a29f[_0x25c1('0x16')]){delete _0x61a29f[_0x25c1('0x16')];}_0x4c55e7['status'](0x1f4)[_0x25c1('0x15')](_0x61a29f);}};}function checkError(){return function(_0x9f54e3){if(!_0x9f54e3){throw new RangeError(_0x25c1('0x17'));}return _0x9f54e3;};}function respondWithRpcPromise(_0x29e637,_0x517a46){return new BPromise(function(_0x4c3259,_0x2a8a84){var _0xac3335=amiClient;return _0xac3335[_0x25c1('0x18')](_0x29e637,_0x517a46)[_0x25c1('0x19')](function(_0x15cf2f){if(_0x15cf2f[_0x25c1('0x13')]){if(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1a')]===0x1f4){return _0x2a8a84(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}return _0x4c3259(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}else{_0x4c3259(_0x15cf2f[_0x25c1('0x1c')]);}})['catch'](function(_0x2dadae){_0x2a8a84(_0x2dadae);});});}function getAgent(_0x20dbb9){return db[_0x25c1('0x1d')][_0x25c1('0x1e')]({'where':{'id':_0x20dbb9,'role':_0x25c1('0x1f')}})[_0x25c1('0x19')](checkError());}function getAgentCheckSession(_0x5ad776,_0x17c924){return new BPromise(function(_0x428ce8,_0x6cb14f){var _0x38c1d5=respondWithRpcPromise(_0x25c1('0x20'));var _0x193a68=getAgent(_0x5ad776);Promise['all']([_0x38c1d5,_0x193a68])[_0x25c1('0x19')](function(_0x478f1e){var _0x76b360=_0x478f1e[0x0];var _0x31c153=_0x478f1e[0x1];var _0x2c42b9=_[_0x25c1('0x21')](_0x76b360[_0x25c1('0x22')],function(_0x21069c){return _0x21069c[_0x25c1('0x23')]==_0x31c153['id']&&_0x21069c[_0x25c1('0x24')]==_0x17c924;});if(_0x2c42b9[_0x25c1('0x25')]==0x1){_0x428ce8(_0x31c153);}else{_0x6cb14f(new RangeError('sessionId\x20'+_0x17c924+_0x25c1('0x26')));}});});}exports['originate']=function(_0x492715,_0x3db0ee){logger[_0x25c1('0x10')]('originate\x20fired:',_0x492715[_0x25c1('0x27')]);var _0x5a5a32=originateValidation[_0x25c1('0xb')](_0x492715['body']);if(_0x5a5a32[_0x25c1('0x25')]>0x0){return _0x3db0ee[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x5a5a32);}var _0x148e2a=_0x492715[_0x25c1('0x27')][_0x25c1('0x29')];var _0x461d23=_0x492715[_0x25c1('0x27')]['callNumber'];var _0x20a273=_0x492715['body'][_0x25c1('0x2a')];var _0x56de5e=_0x492715[_0x25c1('0x27')][_0x25c1('0x2b')];return getAgent(_0x148e2a)[_0x25c1('0x19')](function(_0x2f86de){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x2f86de[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x2f86de[_0x25c1('0x16')]),_0x25c1('0x2f'),{'callNumber':_0x461d23,'callerId':_0x20a273,'callbackUrl':_0x56de5e});return _0x3db0ee[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x30')});})[_0x25c1('0x31')](handleError(_0x3db0ee));};exports[_0x25c1('0x32')]=function(_0x349aef,_0x30b1d7){logger[_0x25c1('0x10')](_0x25c1('0x33'),_0x349aef['body']);var _0x32cc49=hangupValidation[_0x25c1('0xb')](_0x349aef['body']);if(_0x32cc49[_0x25c1('0x25')]>0x0){return _0x30b1d7['status'](0x190)[_0x25c1('0x28')](_0x32cc49);}var _0x4f978c=_0x349aef[_0x25c1('0x27')][_0x25c1('0x29')];var _0x1cf0b8=_0x349aef[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x4f978c)['then'](function(_0x1fe6d7){logger['info'](_0x25c1('0x2c'),_0x1fe6d7[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x1fe6d7['name']),'webbar:hangup',{'sessionId':_0x1cf0b8});return _0x30b1d7['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x34')});})['catch'](handleError(_0x30b1d7));};exports[_0x25c1('0x35')]=function(_0x58792d,_0x3d5172){logger[_0x25c1('0x10')](_0x25c1('0x36'),_0x58792d['body']);var _0x5502c1=answerValidation['validate'](_0x58792d[_0x25c1('0x27')]);if(_0x5502c1[_0x25c1('0x25')]>0x0){return _0x3d5172['status'](0x190)[_0x25c1('0x28')](_0x5502c1);}var _0x4c90f6=_0x58792d[_0x25c1('0x27')]['userId'];var _0x5e43dc=_0x58792d['body']['sessionId'];return getAgent(_0x4c90f6)[_0x25c1('0x19')](function(_0x259250){logger['info'](_0x25c1('0x2c'),_0x259250[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x259250[_0x25c1('0x16')]),_0x25c1('0x37'),{'sessionId':_0x5e43dc});return _0x3d5172[_0x25c1('0x14')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x25c1('0x31')](handleError(_0x3d5172));};exports[_0x25c1('0x38')]=function(_0x389547,_0x4bed0a){logger[_0x25c1('0x10')](_0x25c1('0x39'),_0x389547[_0x25c1('0x27')]);var _0xa009d1=holdValidation['validate'](_0x389547[_0x25c1('0x27')]);if(_0xa009d1[_0x25c1('0x25')]>0x0){return _0x4bed0a[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0xa009d1);}var _0x5d2ecc=_0x389547['body'][_0x25c1('0x29')];var _0x2cd055=_0x389547[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5d2ecc)['then'](function(_0x6eff9e){logger[_0x25c1('0x10')]('entityFound:',_0x6eff9e[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x6eff9e[_0x25c1('0x16')]),'webbar:hold',{'sessionId':_0x2cd055});return _0x4bed0a['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x3a')});})[_0x25c1('0x31')](handleError(_0x4bed0a));};exports['unhold']=function(_0x19028a,_0x2d874b){logger['info'](_0x25c1('0x3b'),_0x19028a[_0x25c1('0x27')]);var _0x2b58a3=unholdValidation[_0x25c1('0xb')](_0x19028a[_0x25c1('0x27')]);if(_0x2b58a3[_0x25c1('0x25')]>0x0){return _0x2d874b[_0x25c1('0x14')](0x190)['json'](_0x2b58a3);}var _0x5344da=_0x19028a['body'][_0x25c1('0x29')];var _0x5c588c=_0x19028a[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5344da)[_0x25c1('0x19')](function(_0x153603){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x153603['name']);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x153603[_0x25c1('0x16')]),_0x25c1('0x3c'),{'sessionId':_0x5c588c});return _0x2d874b[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':'unhold\x20executed!'});})[_0x25c1('0x31')](handleError(_0x2d874b));};exports[_0x25c1('0x3d')]=function(_0x18f7c5,_0xbff8ad){logger[_0x25c1('0x10')]('calls\x20fired:',_0xbff8ad[_0x25c1('0x27')]);var _0x3df219=callsValidation['validate'](_0x18f7c5[_0x25c1('0x27')]);if(_0x3df219[_0x25c1('0x25')]>0x0){return _0xbff8ad[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x3df219);}var _0x30ca5d=_0x18f7c5[_0x25c1('0x27')]['userId'];var _0x20ff17=respondWithRpcPromise(_0x25c1('0x20'));var _0x2760ef=getAgent(_0x30ca5d);return Promise[_0x25c1('0x3e')]([_0x20ff17,_0x2760ef])[_0x25c1('0x19')](function(_0x4052c1){var _0x2745b6=_0x4052c1[0x0];var _0x5d54cd=_0x4052c1[0x1];var _0x321833=_[_0x25c1('0x21')](_0x2745b6[_0x25c1('0x22')],function(_0x2d9e6b){return _0x2d9e6b[_0x25c1('0x23')]==_0x5d54cd['id'];});return _0xbff8ad[_0x25c1('0x14')](0xc8)['json']({'count':_0x321833[_0x25c1('0x25')],'rows':_0x321833});})[_0x25c1('0x31')](handleError(_0xbff8ad));};exports[_0x25c1('0x3f')]=function(_0x7a1d7a,_0x3d3ea2){logger[_0x25c1('0x10')](_0x25c1('0x40'),_0x7a1d7a['body']);var _0x44efc9=conferenceValidation['validate'](_0x7a1d7a[_0x25c1('0x27')]);if(_0x44efc9[_0x25c1('0x25')]>0x0){return _0x3d3ea2[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x44efc9);}var _0x3b0785=_0x7a1d7a[_0x25c1('0x27')][_0x25c1('0x29')];return getAgent(_0x3b0785)[_0x25c1('0x19')](function(_0x4c435c){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x4c435c[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x4c435c[_0x25c1('0x16')]),_0x25c1('0x41'));return _0x3d3ea2['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x3d3ea2));};exports['transfer']=function(_0x188b51,_0x4b1ead){logger[_0x25c1('0x10')](_0x25c1('0x42'),_0x188b51[_0x25c1('0x27')]);var _0x58c743=transferValidation[_0x25c1('0xb')](_0x188b51['body']);if(_0x58c743[_0x25c1('0x25')]>0x0){return _0x4b1ead[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x58c743);}var _0x34579c=_0x188b51[_0x25c1('0x27')][_0x25c1('0x29')];var _0x11bdc4=_0x188b51['body'][_0x25c1('0x24')];var _0x46f71f=_0x188b51[_0x25c1('0x27')][_0x25c1('0x43')];return getAgent(_0x34579c)[_0x25c1('0x19')](function(_0x425f3e){logger['info'](_0x25c1('0x2c'),_0x425f3e['name']);emit(util[_0x25c1('0x2d')]('user:%s',_0x425f3e['name']),_0x25c1('0x44'),{'sessionId':_0x11bdc4,'transferNumber':_0x46f71f});return _0x4b1ead['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4b1ead));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 364e9c7..6e012f2 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 _0x4137=['get','index','/describe','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','create','/:id/dispositions','post','addAnswer','addAgents','addApplications','notify','/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller'];(function(_0x21febe,_0x3b5256){var _0x3b7362=function(_0x4d5451){while(--_0x4d5451){_0x21febe['push'](_0x21febe['shift']());}};_0x3b7362(++_0x3b5256);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0xb')]('/:id/dispositions',auth[_0x7413('0xe')](),controller[_0x7413('0x11')]);router[_0x7413('0xb')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller['getAnswers']);router[_0x7413('0xb')](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x14')]);router[_0x7413('0xb')](_0x7413('0x15'),auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0x7413('0xe')](),controller[_0x7413('0x16')]);router['post'](_0x7413('0x17'),auth[_0x7413('0xe')](),controller['addDisposition']);router[_0x7413('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7413('0x19')]);router['post'](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x1a')]);router[_0x7413('0x18')](_0x7413('0x15'),auth[_0x7413('0xe')](),controller[_0x7413('0x1b')]);router[_0x7413('0x18')]('/:id/notify',controller[_0x7413('0x1c')]);router[_0x7413('0x18')](_0x7413('0x1d'),auth[_0x7413('0xe')](),controller['send']);router[_0x7413('0x1e')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x1f')]);router[_0x7413('0x20')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x21')]);router['delete']('/:id/dispositions',auth[_0x7413('0xe')](),controller['removeDispositions']);router[_0x7413('0x20')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller[_0x7413('0x22')]);router[_0x7413('0x20')](_0x7413('0x13'),auth[_0x7413('0xe')](),controller[_0x7413('0x23')]);module[_0x7413('0x24')]=router; \ No newline at end of file +var _0x47c5=['/:id/notify','notify','send','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x47c5,0x165));var _0x547c=function(_0x4f004f,_0x3ec1ca){_0x4f004f=_0x4f004f-0x0;var _0x3cd3bf=_0x47c5[_0x4f004f];return _0x3cd3bf;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0x9')](_0x547c('0xe'),auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x9')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x9')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);router['get'](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['getAgents']);router[_0x547c('0x9')](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x16')]);router[_0x547c('0x17')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0x18')]);router[_0x547c('0x17')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x19')]);router[_0x547c('0x17')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x1a')]);router[_0x547c('0x17')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['addAgents']);router['post'](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x1b')]);router['post'](_0x547c('0x1c'),controller[_0x547c('0x1d')]);router[_0x547c('0x17')]('/:id/send',auth[_0x547c('0xc')](),controller[_0x547c('0x1e')]);router['put']('/:id',auth[_0x547c('0xc')](),controller[_0x547c('0x1f')]);router['delete'](_0x547c('0xe'),auth[_0x547c('0xc')](),controller['destroy']);router[_0x547c('0x20')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller['removeDispositions']);router[_0x547c('0x20')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x21')]);router[_0x547c('0x20')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller[_0x547c('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 4a59d2e..b9b0ea9 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 _0xab66=['twilio','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','setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab66,0x70));var _0x6ab6=function(_0x4a2c90,_0x559f07){_0x4a2c90=_0x4a2c90-0x0;var _0x49ccf0=_0xab66[_0x4a2c90];return _0x49ccf0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6ab6('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ab6('0x1')],'unique':_0x6ab6('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6ab6('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x6ab6('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x6ab6('0x1')],'defaultValue':function(){return rs[_0x6ab6('0x3')]();}},'phone':{'type':Sequelize[_0x6ab6('0x1')]},'type':{'type':Sequelize[_0x6ab6('0x4')](_0x6ab6('0x5'),_0x6ab6('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6ab6('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6ab6('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6ab6('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ab6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6ab6('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ab6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ab6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ab6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ab6('0x9')],'comment':_0x6ab6('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6ab6('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x58fe56){if(!_0x58fe56){this[_0x6ab6('0xb')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x6ab6('0xc'),_0x58fe56);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xad35=['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','sequelize','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x31c66b,_0x427648){var _0x3753a7=function(_0x14ec67){while(--_0x14ec67){_0x31c66b['push'](_0x31c66b['shift']());}};_0x3753a7(++_0x427648);}(_0xad35,0x116));var _0x5ad3=function(_0x16f8fa,_0x180a28){_0x16f8fa=_0x16f8fa-0x0;var _0x295cf1=_0xad35[_0x16f8fa];return _0x295cf1;};'use strict';var Sequelize=require(_0x5ad3('0x0'));var rs=require(_0x5ad3('0x1'));module[_0x5ad3('0x2')]={'name':{'type':Sequelize[_0x5ad3('0x3')],'unique':_0x5ad3('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5ad3('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5ad3('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5ad3('0x6')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0x5ad3('0x3')]},'baseUrl':{'type':Sequelize[_0x5ad3('0x3')]},'authToken':{'type':Sequelize[_0x5ad3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5ad3('0x7')],'defaultValue':function(){return _0x5ad3('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5ad3('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5ad3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5ad3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5ad3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ad3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ad3('0xa')],'comment':_0x5ad3('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5ad3('0xc'),'set':function(_0x256476){if(!_0x256476){this[_0x5ad3('0xd')](_0x5ad3('0xe'),null);}this[_0x5ad3('0xd')]('mandatoryDisposition',_0x256476);}},'description':{'type':Sequelize[_0x5ad3('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 4896fc5..aabf051 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 _0x9ae5=['whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','to\x20is\x20mandatory','List','defaults','out','spread','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','show','params','Pause','includeAll','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','findAll','rows','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','message_id','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','replace'];(function(_0x1f2d53,_0x1fa718){var _0x3c7450=function(_0x3e6dd4){while(--_0x3e6dd4){_0x1f2d53['push'](_0x1f2d53['shift']());}};_0x3c7450(++_0x1fa718);}(_0x9ae5,0xf1));var _0x59ae=function(_0x510715,_0x3c0d3f){_0x510715=_0x510715-0x0;var _0x56c811=_0x9ae5[_0x510715];return _0x56c811;};'use strict';var emlformat=require(_0x59ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59ae('0x1'));var jsonpatch=require(_0x59ae('0x2'));var rp=require(_0x59ae('0x3'));var moment=require(_0x59ae('0x4'));var BPromise=require(_0x59ae('0x5'));var Mustache=require(_0x59ae('0x6'));var util=require(_0x59ae('0x7'));var path=require(_0x59ae('0x8'));var sox=require(_0x59ae('0x9'));var csv=require(_0x59ae('0xa'));var ejs=require(_0x59ae('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x59ae('0xc'));var crypto=require('crypto');var jsforce=require(_0x59ae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x59ae('0xa'));var querystring=require(_0x59ae('0xe'));var Papa=require(_0x59ae('0xf'));var Redis=require(_0x59ae('0x10'));var authService=require(_0x59ae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x59ae('0x12'));var hardwareService=require(_0x59ae('0x13'));var logger=require(_0x59ae('0x14'))(_0x59ae('0x15'));var utils=require(_0x59ae('0x16'));var config=require(_0x59ae('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x59ae('0x18'))['db'];config['redis']=_['defaults'](config[_0x59ae('0x19')],{'host':_0x59ae('0x1a'),'port':0x18eb});var socket=require(_0x59ae('0x1b'))(new Redis(config['redis']));require(_0x59ae('0x1c'))[_0x59ae('0x1d')](socket);var jayson=require(_0x59ae('0x1e'));var client=jayson['client'][_0x59ae('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x12a915,_0x35427a,_0x2bfcfb,_0x1c97d3){return new BPromise(function(_0x3d3f8a,_0x3cb2d4){var _0x141a2a=_0x1c97d3||client;return _0x141a2a['request'](_0x12a915,_0x2bfcfb)['then'](function(_0x1e5538){logger[_0x59ae('0x20')](_0x59ae('0x21'),_0x35427a,_0x59ae('0x22'));logger[_0x59ae('0x23')](_0x59ae('0x24'),_0x35427a,'request\x20sent',JSON['stringify'](_0x1e5538));if(_0x1e5538['error']){if(_0x1e5538[_0x59ae('0x25')][_0x59ae('0x26')]===0x1f4){logger[_0x59ae('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x35427a,_0x1e5538[_0x59ae('0x25')][_0x59ae('0x27')]);return _0x3cb2d4(_0x1e5538[_0x59ae('0x25')]['message']);}logger[_0x59ae('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x35427a,_0x1e5538[_0x59ae('0x25')][_0x59ae('0x27')]);return _0x3d3f8a(_0x1e5538[_0x59ae('0x25')][_0x59ae('0x27')]);}else{logger['info'](_0x59ae('0x21'),_0x35427a,'request\x20sent');_0x3d3f8a(_0x1e5538[_0x59ae('0x28')][_0x59ae('0x27')]);}})['catch'](function(_0xd26bf7){logger[_0x59ae('0x25')](_0x59ae('0x21'),_0x35427a,_0xd26bf7);_0x3cb2d4(_0xd26bf7);});});}function respondWithStatusCode(_0x10b0bf,_0x5280ae){_0x5280ae=_0x5280ae||0xcc;return function(_0x51096f){if(_0x51096f){return _0x10b0bf[_0x59ae('0x29')](_0x5280ae);}return _0x10b0bf[_0x59ae('0x2a')](_0x5280ae)[_0x59ae('0x2b')]();};}function respondWithResult(_0x3f1591,_0x319706){_0x319706=_0x319706||0xc8;return function(_0x5d544e){if(_0x5d544e){return _0x3f1591['status'](_0x319706)['json'](_0x5d544e);}};}function respondWithFilteredResult(_0x2a6fcf,_0xc15e1c){return function(_0x3e95f6){if(_0x3e95f6){var _0x548a25=typeof _0xc15e1c[_0x59ae('0x2c')]===_0x59ae('0x2d')&&typeof _0xc15e1c['limit']===_0x59ae('0x2d');var _0x11300b=_0x3e95f6['count'];var _0x341e4a=_0x548a25?0x0:_0xc15e1c[_0x59ae('0x2c')];var _0x323c64=_0x548a25?_0x3e95f6[_0x59ae('0x2e')]:_0xc15e1c[_0x59ae('0x2c')]+_0xc15e1c['limit'];var _0x472629;if(_0x323c64>=_0x11300b){_0x323c64=_0x11300b;_0x472629=0xc8;}else{_0x472629=0xce;}_0x2a6fcf['status'](_0x472629);return _0x2a6fcf[_0x59ae('0x2f')](_0x59ae('0x30'),_0x341e4a+'-'+_0x323c64+'/'+_0x11300b)[_0x59ae('0x31')](_0x3e95f6);}return null;};}function patchUpdates(_0x58632d){return function(_0x201776){try{jsonpatch[_0x59ae('0x32')](_0x201776,_0x58632d,!![]);}catch(_0x8ccb4){return BPromise[_0x59ae('0x33')](_0x8ccb4);}return _0x201776['save']();};}function saveUpdates(_0x1ab0ca,_0x1e9e74){return function(_0x54bd1c){if(_0x54bd1c){return _0x54bd1c[_0x59ae('0x34')](_0x1ab0ca)[_0x59ae('0x35')](function(_0x5a27b0){return _0x5a27b0;});}return null;};}function removeEntity(_0x2ca116,_0x35e301){return function(_0xb590ca){if(_0xb590ca){return _0xb590ca[_0x59ae('0x36')]()[_0x59ae('0x35')](function(){var _0x2300a7=_0xb590ca['get']({'plain':!![]});var _0x1fe1d9=_0x59ae('0x37');return db[_0x59ae('0x38')]['destroy']({'where':{'type':_0x1fe1d9,'resourceId':_0x2300a7['id']}})[_0x59ae('0x35')](function(){return _0xb590ca;});})[_0x59ae('0x35')](function(){_0x2ca116['status'](0xcc)[_0x59ae('0x2b')]();});}};}function handleEntityNotFound(_0x5f2db8,_0x179341){return function(_0x47f053){if(!_0x47f053){_0x5f2db8[_0x59ae('0x29')](0x194);}return _0x47f053;};}function handleError(_0x7cfe4c,_0x423b78){_0x423b78=_0x423b78||0x1f4;return function(_0x59dd85){logger[_0x59ae('0x25')](_0x59dd85[_0x59ae('0x39')]);if(_0x59dd85[_0x59ae('0x3a')]){delete _0x59dd85[_0x59ae('0x3a')];}_0x7cfe4c[_0x59ae('0x2a')](_0x423b78)[_0x59ae('0x3b')](_0x59dd85);};}exports['index']=function(_0xfb74d6,_0x2d4f74){var _0x27cb54={'include':[{'model':db['Pause'],'as':_0x59ae('0x3c')}]},_0x1efcca={},_0x40f20c={'count':0x0,'rows':[]};var _0x590264=_['map'](db[_0x59ae('0x3d')][_0x59ae('0x3e')],function(_0x4102c9){return{'name':_0x4102c9[_0x59ae('0x3f')],'type':_0x4102c9[_0x59ae('0x40')][_0x59ae('0x41')]};});_0x1efcca['model']=_['map'](_0x590264,_0x59ae('0x3a'));_0x1efcca[_0x59ae('0x42')]=_[_0x59ae('0x43')](_0xfb74d6['query']);_0x1efcca[_0x59ae('0x44')]=_['intersection'](_0x1efcca[_0x59ae('0x45')],_0x1efcca[_0x59ae('0x42')]);_0x27cb54[_0x59ae('0x46')]=_[_0x59ae('0x47')](_0x1efcca[_0x59ae('0x45')],qs['fields'](_0xfb74d6[_0x59ae('0x42')][_0x59ae('0x48')]));_0x27cb54[_0x59ae('0x46')]=_0x27cb54['attributes'][_0x59ae('0x49')]?_0x27cb54[_0x59ae('0x46')]:_0x1efcca[_0x59ae('0x45')];if(!_0xfb74d6[_0x59ae('0x42')][_0x59ae('0x4a')](_0x59ae('0x4b'))){_0x27cb54[_0x59ae('0x4c')]=qs[_0x59ae('0x4c')](_0xfb74d6[_0x59ae('0x42')][_0x59ae('0x4c')]);_0x27cb54[_0x59ae('0x2c')]=qs[_0x59ae('0x2c')](_0xfb74d6[_0x59ae('0x42')][_0x59ae('0x2c')]);}_0x27cb54['order']=qs['sort'](_0xfb74d6[_0x59ae('0x42')][_0x59ae('0x4d')]);_0x27cb54[_0x59ae('0x4e')]=qs['filters'](_[_0x59ae('0x4f')](_0xfb74d6[_0x59ae('0x42')],_0x1efcca[_0x59ae('0x44')]),_0x590264);if(_0xfb74d6[_0x59ae('0x42')][_0x59ae('0x50')]){_0x27cb54['where']=_[_0x59ae('0x51')](_0x27cb54['where'],{'$or':_[_0x59ae('0x52')](_0x590264,function(_0x18c8cf){if(_0x18c8cf[_0x59ae('0x40')]!==_0x59ae('0x53')){var _0x153bf9={};_0x153bf9[_0x18c8cf[_0x59ae('0x3a')]]={'$like':'%'+_0xfb74d6[_0x59ae('0x42')]['filter']+'%'};return _0x153bf9;}})});}_0x27cb54=_[_0x59ae('0x51')]({},_0x27cb54,_0xfb74d6[_0x59ae('0x54')]);var _0x67de7e={'where':_0x27cb54[_0x59ae('0x4e')]};return db['WhatsappAccount'][_0x59ae('0x2e')](_0x67de7e)['then'](function(_0x51e05a){_0x40f20c[_0x59ae('0x2e')]=_0x51e05a;if(_0xfb74d6['query']['includeAll']){_0x27cb54['include']=[{'all':!![]}];}return db[_0x59ae('0x3d')]['findAll'](_0x27cb54);})[_0x59ae('0x35')](function(_0x388345){_0x40f20c['rows']=_0x388345;return _0x40f20c;})[_0x59ae('0x35')](respondWithFilteredResult(_0x2d4f74,_0x27cb54))['catch'](handleError(_0x2d4f74,null));};exports[_0x59ae('0x55')]=function(_0x560b9f,_0x23542d){var _0x1af51f={'raw':![],'where':{'id':_0x560b9f[_0x59ae('0x56')]['id']},'include':[{'model':db[_0x59ae('0x57')],'as':_0x59ae('0x3c')}]},_0x535d04={};_0x535d04[_0x59ae('0x45')]=_['keys'](db[_0x59ae('0x3d')]['rawAttributes']);_0x535d04[_0x59ae('0x42')]=_[_0x59ae('0x43')](_0x560b9f[_0x59ae('0x42')]);_0x535d04[_0x59ae('0x44')]=_['intersection'](_0x535d04[_0x59ae('0x45')],_0x535d04['query']);_0x1af51f[_0x59ae('0x46')]=_['intersection'](_0x535d04['model'],qs[_0x59ae('0x48')](_0x560b9f['query'][_0x59ae('0x48')]));_0x1af51f[_0x59ae('0x46')]=_0x1af51f['attributes'][_0x59ae('0x49')]?_0x1af51f['attributes']:_0x535d04[_0x59ae('0x45')];if(_0x560b9f[_0x59ae('0x42')][_0x59ae('0x58')]){_0x1af51f[_0x59ae('0x59')]=[{'all':!![]}];}_0x1af51f=_[_0x59ae('0x51')]({},_0x1af51f,_0x560b9f[_0x59ae('0x54')]);return db[_0x59ae('0x3d')]['find'](_0x1af51f)['then'](handleEntityNotFound(_0x23542d,null))['then'](respondWithResult(_0x23542d,null))['catch'](handleError(_0x23542d,null));};exports[_0x59ae('0x5a')]=function(_0x11dfc6,_0xc6d8f0){return db[_0x59ae('0x3d')]['create'](_0x11dfc6['body'],{})[_0x59ae('0x35')](function(_0x118479){var _0x349da7=_0x11dfc6[_0x59ae('0x5b')][_0x59ae('0x5c')]({'plain':!![]});if(!_0x349da7)throw new Error(_0x59ae('0x5d'));if(_0x349da7['role']===_0x59ae('0x5b')){var _0xe7aed3=_0x118479[_0x59ae('0x5c')]({'plain':!![]});var _0x23f4a8=_0x59ae('0x37');return db['UserProfileSection'][_0x59ae('0x5e')]({'where':{'name':_0x23f4a8,'userProfileId':_0x349da7[_0x59ae('0x5f')]},'raw':!![]})['then'](function(_0x56e22b){if(_0x56e22b&&_0x56e22b['autoAssociation']===0x0){return db['UserProfileResource'][_0x59ae('0x5a')]({'name':_0xe7aed3[_0x59ae('0x3a')],'resourceId':_0xe7aed3['id'],'type':_0x56e22b[_0x59ae('0x3a')],'sectionId':_0x56e22b['id']},{})[_0x59ae('0x35')](function(){return _0x118479;});}else{return _0x118479;}})[_0x59ae('0x60')](function(_0x2209b4){logger[_0x59ae('0x25')](_0x59ae('0x61'),_0x2209b4);throw _0x2209b4;});}return _0x118479;})['then'](respondWithResult(_0xc6d8f0,0xc9))[_0x59ae('0x60')](handleError(_0xc6d8f0,null));};exports[_0x59ae('0x34')]=function(_0x4e5edc,_0x2cc86c){if(_0x4e5edc['body']['id']){delete _0x4e5edc[_0x59ae('0x62')]['id'];}return db['WhatsappAccount'][_0x59ae('0x5e')]({'where':{'id':_0x4e5edc[_0x59ae('0x56')]['id']},'include':[{'model':db[_0x59ae('0x57')],'as':_0x59ae('0x3c')}]})['then'](handleEntityNotFound(_0x2cc86c,null))[_0x59ae('0x35')](saveUpdates(_0x4e5edc[_0x59ae('0x62')],null))[_0x59ae('0x35')](respondWithResult(_0x2cc86c,null))[_0x59ae('0x60')](handleError(_0x2cc86c,null));};exports[_0x59ae('0x36')]=function(_0x497620,_0x120e37){return db[_0x59ae('0x3d')][_0x59ae('0x5e')]({'where':{'id':_0x497620[_0x59ae('0x56')]['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x120e37,null))[_0x59ae('0x35')](removeEntity(_0x120e37,null))[_0x59ae('0x60')](handleError(_0x120e37,null));};exports[_0x59ae('0x63')]=function(_0x46525d,_0x2bcb68){return db['WhatsappAccount'][_0x59ae('0x63')]()[_0x59ae('0x35')](respondWithResult(_0x2bcb68,null))[_0x59ae('0x60')](handleError(_0x2bcb68,null));};exports[_0x59ae('0x64')]=function(_0x1b2f12,_0x571df1,_0x1ce46a){if(_0x1b2f12['body']['id']){delete _0x1b2f12[_0x59ae('0x62')]['id'];}return db[_0x59ae('0x3d')][_0x59ae('0x5e')]({'where':{'id':_0x1b2f12[_0x59ae('0x56')]['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x571df1,null))[_0x59ae('0x35')](function(_0x9e02ad){if(_0x9e02ad){_0x1b2f12[_0x59ae('0x62')][_0x59ae('0x65')]=_0x9e02ad['id'];return db[_0x59ae('0x66')][_0x59ae('0x5a')](_0x1b2f12['body']);}})[_0x59ae('0x35')](respondWithResult(_0x571df1,null))[_0x59ae('0x60')](handleError(_0x571df1,null));};exports['getDispositions']=function(_0x4e5d52,_0x1aa28a,_0x1bc422){var _0x5f0dd6={'raw':![],'where':{}};var _0x5984e3={};var _0x1915b6={'count':0x0,'rows':[]};return db[_0x59ae('0x3d')]['findOne']({'where':{'id':_0x4e5d52[_0x59ae('0x56')]['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x1aa28a,null))[_0x59ae('0x35')](function(_0x24c8b5){if(_0x24c8b5){_0x5984e3[_0x59ae('0x45')]=_[_0x59ae('0x43')](db[_0x59ae('0x66')]['rawAttributes']);_0x5984e3[_0x59ae('0x42')]=_[_0x59ae('0x43')](_0x4e5d52[_0x59ae('0x42')]);_0x5984e3['filters']=_[_0x59ae('0x47')](_0x5984e3[_0x59ae('0x45')],_0x5984e3[_0x59ae('0x42')]);_0x5f0dd6[_0x59ae('0x46')]=_[_0x59ae('0x47')](_0x5984e3['model'],qs[_0x59ae('0x48')](_0x4e5d52['query'][_0x59ae('0x48')]));_0x5f0dd6[_0x59ae('0x46')]=_0x5f0dd6[_0x59ae('0x46')][_0x59ae('0x49')]?_0x5f0dd6[_0x59ae('0x46')]:_0x5984e3[_0x59ae('0x45')];if(!_0x4e5d52[_0x59ae('0x42')][_0x59ae('0x4a')]('nolimit')){_0x5f0dd6[_0x59ae('0x4c')]=qs[_0x59ae('0x4c')](_0x4e5d52['query'][_0x59ae('0x4c')]);_0x5f0dd6['offset']=qs[_0x59ae('0x2c')](_0x4e5d52[_0x59ae('0x42')][_0x59ae('0x2c')]);}_0x5f0dd6['order']=qs[_0x59ae('0x4d')](_0x4e5d52[_0x59ae('0x42')][_0x59ae('0x4d')]);_0x5f0dd6[_0x59ae('0x4e')]=qs['filters'](_[_0x59ae('0x4f')](_0x4e5d52[_0x59ae('0x42')],_0x5984e3[_0x59ae('0x44')]));_0x5f0dd6['where'][_0x59ae('0x65')]=_0x24c8b5['id'];if(_0x4e5d52[_0x59ae('0x42')][_0x59ae('0x50')]){_0x5f0dd6[_0x59ae('0x4e')]=_['merge'](_0x5f0dd6[_0x59ae('0x4e')],{'$or':_[_0x59ae('0x52')](_0x5f0dd6[_0x59ae('0x46')],function(_0x1421fd){var _0x4e8664={};_0x4e8664[_0x1421fd]={'$like':'%'+_0x4e5d52[_0x59ae('0x42')][_0x59ae('0x50')]+'%'};return _0x4e8664;})});}_0x5f0dd6=_[_0x59ae('0x51')]({},_0x5f0dd6,_0x4e5d52[_0x59ae('0x54')]);return db['Disposition'][_0x59ae('0x2e')]({'where':_0x5f0dd6[_0x59ae('0x4e')]})[_0x59ae('0x35')](function(_0x203926){_0x1915b6['count']=_0x203926;if(_0x4e5d52[_0x59ae('0x42')][_0x59ae('0x58')]){_0x5f0dd6['include']=[{'all':!![]}];}return db[_0x59ae('0x66')]['findAll'](_0x5f0dd6);})['then'](function(_0x17eaa6){_0x1915b6['rows']=_0x17eaa6;return _0x1915b6;});}})['then'](respondWithFilteredResult(_0x1aa28a,_0x5f0dd6))[_0x59ae('0x60')](handleError(_0x1aa28a,null));};exports[_0x59ae('0x67')]=function(_0x4526c1,_0x10948b,_0x244d67){return db[_0x59ae('0x3d')]['find']({'where':{'id':_0x4526c1[_0x59ae('0x56')]['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x10948b,null))[_0x59ae('0x35')](function(_0x2fdcc9){if(_0x2fdcc9){return _0x2fdcc9['removeDispositions'](_0x4526c1['query'][_0x59ae('0x68')]);}})['then'](respondWithStatusCode(_0x10948b,null))[_0x59ae('0x60')](handleError(_0x10948b,null));};exports[_0x59ae('0x69')]=function(_0x2d3402,_0x3deea8,_0x5242bd){if(_0x2d3402['body']['id']){delete _0x2d3402[_0x59ae('0x62')]['id'];}return db[_0x59ae('0x3d')][_0x59ae('0x5e')]({'where':{'id':_0x2d3402[_0x59ae('0x56')]['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x3deea8,null))[_0x59ae('0x35')](function(_0x1e2a26){if(_0x1e2a26){_0x2d3402[_0x59ae('0x62')]['WhatsappAccountId']=_0x1e2a26['id'];return db[_0x59ae('0x6a')][_0x59ae('0x5a')](_0x2d3402[_0x59ae('0x62')]);}})['then'](respondWithResult(_0x3deea8,null))[_0x59ae('0x60')](handleError(_0x3deea8,null));};exports[_0x59ae('0x6b')]=function(_0x5f40eb,_0x2bc756,_0x37dc50){var _0x14b4d1={'raw':![],'where':{}};var _0x42ef1d={};var _0x120779={'count':0x0,'rows':[]};return db[_0x59ae('0x3d')][_0x59ae('0x6c')]({'where':{'id':_0x5f40eb['params']['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x2bc756,null))[_0x59ae('0x35')](function(_0x530386){if(_0x530386){_0x42ef1d[_0x59ae('0x45')]=_[_0x59ae('0x43')](db[_0x59ae('0x6a')][_0x59ae('0x3e')]);_0x42ef1d['query']=_[_0x59ae('0x43')](_0x5f40eb[_0x59ae('0x42')]);_0x42ef1d[_0x59ae('0x44')]=_[_0x59ae('0x47')](_0x42ef1d[_0x59ae('0x45')],_0x42ef1d[_0x59ae('0x42')]);_0x14b4d1[_0x59ae('0x46')]=_[_0x59ae('0x47')](_0x42ef1d[_0x59ae('0x45')],qs[_0x59ae('0x48')](_0x5f40eb[_0x59ae('0x42')][_0x59ae('0x48')]));_0x14b4d1[_0x59ae('0x46')]=_0x14b4d1[_0x59ae('0x46')][_0x59ae('0x49')]?_0x14b4d1[_0x59ae('0x46')]:_0x42ef1d[_0x59ae('0x45')];if(!_0x5f40eb[_0x59ae('0x42')][_0x59ae('0x4a')](_0x59ae('0x4b'))){_0x14b4d1[_0x59ae('0x4c')]=qs['limit'](_0x5f40eb['query'][_0x59ae('0x4c')]);_0x14b4d1[_0x59ae('0x2c')]=qs[_0x59ae('0x2c')](_0x5f40eb[_0x59ae('0x42')][_0x59ae('0x2c')]);}_0x14b4d1[_0x59ae('0x6d')]=qs[_0x59ae('0x4d')](_0x5f40eb[_0x59ae('0x42')]['sort']);_0x14b4d1['where']=qs['filters'](_['pick'](_0x5f40eb[_0x59ae('0x42')],_0x42ef1d[_0x59ae('0x44')]));_0x14b4d1[_0x59ae('0x4e')][_0x59ae('0x65')]=_0x530386['id'];if(_0x5f40eb[_0x59ae('0x42')][_0x59ae('0x50')]){_0x14b4d1['where']=_[_0x59ae('0x51')](_0x14b4d1[_0x59ae('0x4e')],{'$or':_[_0x59ae('0x52')](_0x14b4d1[_0x59ae('0x46')],function(_0x41be9a){var _0xe45ec5={};_0xe45ec5[_0x41be9a]={'$like':'%'+_0x5f40eb[_0x59ae('0x42')]['filter']+'%'};return _0xe45ec5;})});}_0x14b4d1=_[_0x59ae('0x51')]({},_0x14b4d1,_0x5f40eb[_0x59ae('0x54')]);return db[_0x59ae('0x6a')][_0x59ae('0x2e')]({'where':_0x14b4d1['where']})[_0x59ae('0x35')](function(_0x1d4522){_0x120779[_0x59ae('0x2e')]=_0x1d4522;if(_0x5f40eb[_0x59ae('0x42')][_0x59ae('0x58')]){_0x14b4d1[_0x59ae('0x59')]=[{'all':!![]}];}return db[_0x59ae('0x6a')][_0x59ae('0x6e')](_0x14b4d1);})[_0x59ae('0x35')](function(_0x4de287){_0x120779[_0x59ae('0x6f')]=_0x4de287;return _0x120779;});}})[_0x59ae('0x35')](respondWithFilteredResult(_0x2bc756,_0x14b4d1))[_0x59ae('0x60')](handleError(_0x2bc756,null));};exports[_0x59ae('0x70')]=function(_0x3002a0,_0x218175,_0x44a0fa){return db['WhatsappAccount'][_0x59ae('0x5e')]({'where':{'id':_0x3002a0['params']['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x218175,null))['then'](function(_0x38c1c8){if(_0x38c1c8){return _0x38c1c8[_0x59ae('0x70')](_0x3002a0[_0x59ae('0x42')][_0x59ae('0x68')]);}})['then'](respondWithStatusCode(_0x218175,null))[_0x59ae('0x60')](handleError(_0x218175,null));};exports['addAgents']=function(_0x420bfe,_0x5bb767,_0x17a3b9){return db[_0x59ae('0x3d')][_0x59ae('0x5e')]({'where':{'id':_0x420bfe['params']['id']}})['then'](handleEntityNotFound(_0x5bb767,null))[_0x59ae('0x35')](function(_0x272570){if(_0x272570){return _0x272570[_0x59ae('0x71')](_0x420bfe[_0x59ae('0x62')][_0x59ae('0x68')],_[_0x59ae('0x72')](_0x420bfe[_0x59ae('0x62')],['ids','id'])||{})['spread'](function(_0x44befe){for(var _0x3a34c3=0x0;_0x3a34c3<_0x420bfe[_0x59ae('0x62')][_0x59ae('0x68')][_0x59ae('0x49')];_0x3a34c3+=0x1){socket[_0x59ae('0x73')](_0x59ae('0x74'),{'UserId':Number(_0x420bfe['body'][_0x59ae('0x68')][_0x3a34c3]),'WhatsappAccountId':Number(_0x420bfe[_0x59ae('0x56')]['id'])});}return _0x44befe;});}})[_0x59ae('0x35')](respondWithResult(_0x5bb767,null))['catch'](handleError(_0x5bb767,null));};exports[_0x59ae('0x75')]=function(_0x1733e7,_0xe3f7c4,_0x2e294a){return db[_0x59ae('0x3d')][_0x59ae('0x5e')]({'where':{'id':_0x1733e7['params']['id']}})['then'](handleEntityNotFound(_0xe3f7c4,null))[_0x59ae('0x35')](function(_0x35d2ea){if(_0x35d2ea){return _0x35d2ea[_0x59ae('0x75')](_0x1733e7['query'][_0x59ae('0x68')])[_0x59ae('0x35')](function(){if(_['isArray'](_0x1733e7[_0x59ae('0x42')]['ids'])){for(var _0x32f04a=0x0;_0x32f04a<_0x1733e7['query']['ids'][_0x59ae('0x49')];_0x32f04a+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x1733e7[_0x59ae('0x42')][_0x59ae('0x68')][_0x32f04a]),'WhatsappAccountId':Number(_0x1733e7[_0x59ae('0x56')]['id'])});}}else{socket[_0x59ae('0x73')](_0x59ae('0x76'),{'UserId':Number(_0x1733e7[_0x59ae('0x42')][_0x59ae('0x68')]),'WhatsappAccountId':Number(_0x1733e7['params']['id'])});}});}})[_0x59ae('0x35')](respondWithStatusCode(_0xe3f7c4,null))[_0x59ae('0x60')](handleError(_0xe3f7c4,null));};exports['getAgents']=function(_0x1ebe94,_0x3d2661,_0x44a684){var _0x36e8ad={};var _0x777678={};var _0x366d40;var _0x204498;return db[_0x59ae('0x3d')]['findOne']({'where':{'id':_0x1ebe94[_0x59ae('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d2661,null))[_0x59ae('0x35')](function(_0x4869da){if(_0x4869da){_0x366d40=_0x4869da;_0x777678[_0x59ae('0x45')]=_[_0x59ae('0x43')](db['User'][_0x59ae('0x3e')]);_0x777678['query']=_[_0x59ae('0x43')](_0x1ebe94[_0x59ae('0x42')]);_0x777678['filters']=_[_0x59ae('0x47')](_0x777678[_0x59ae('0x45')],_0x777678[_0x59ae('0x42')]);_0x36e8ad[_0x59ae('0x46')]=_['intersection'](_0x777678['model'],qs['fields'](_0x1ebe94[_0x59ae('0x42')][_0x59ae('0x48')]));_0x36e8ad[_0x59ae('0x46')]=_0x36e8ad[_0x59ae('0x46')][_0x59ae('0x49')]?_0x36e8ad[_0x59ae('0x46')]:_0x777678['model'];_0x36e8ad[_0x59ae('0x6d')]=qs[_0x59ae('0x4d')](_0x1ebe94[_0x59ae('0x42')]['sort']);_0x36e8ad[_0x59ae('0x4e')]=qs[_0x59ae('0x44')](_[_0x59ae('0x4f')](_0x1ebe94['query'],_0x777678[_0x59ae('0x44')]));if(_0x1ebe94[_0x59ae('0x42')]['filter']){_0x36e8ad[_0x59ae('0x4e')]=_[_0x59ae('0x51')](_0x36e8ad['where'],{'$or':_[_0x59ae('0x52')](_0x36e8ad[_0x59ae('0x46')],function(_0x5c7dd3){var _0x46ade5={};_0x46ade5[_0x5c7dd3]={'$like':'%'+_0x1ebe94['query'][_0x59ae('0x50')]+'%'};return _0x46ade5;})});}_0x36e8ad=_[_0x59ae('0x51')]({},_0x36e8ad,_0x1ebe94[_0x59ae('0x54')]);return _0x366d40['getAgents'](_0x36e8ad);}})[_0x59ae('0x35')](function(_0x40eca8){if(_0x40eca8){_0x204498=_0x40eca8[_0x59ae('0x49')];if(!_0x1ebe94[_0x59ae('0x42')][_0x59ae('0x4a')](_0x59ae('0x4b'))){_0x36e8ad[_0x59ae('0x4c')]=qs[_0x59ae('0x4c')](_0x1ebe94[_0x59ae('0x42')][_0x59ae('0x4c')]);_0x36e8ad[_0x59ae('0x2c')]=qs[_0x59ae('0x2c')](_0x1ebe94[_0x59ae('0x42')][_0x59ae('0x2c')]);}return _0x366d40['getAgents'](_0x36e8ad);}})['then'](function(_0x237c24){if(_0x237c24){return _0x237c24?{'count':_0x204498,'rows':_0x237c24}:null;}})[_0x59ae('0x35')](respondWithResult(_0x3d2661,null))['catch'](handleError(_0x3d2661,null));};exports['addApplications']=function(_0x46b92d,_0x2c9441){var _0x5e6370=_0x46b92d[_0x59ae('0x56')]['id'];var _0x18a94c=_0x46b92d[_0x59ae('0x62')];var _0x3ca9dc=0xc8;var _0x4e9566=null;return db[_0x59ae('0x77')][_0x59ae('0x78')]({'isolationLevel':db[_0x59ae('0x77')][_0x59ae('0x79')][_0x59ae('0x7a')]['READ_COMMITTED']},function(_0x35a567){return db[_0x59ae('0x3d')][_0x59ae('0x6c')]({'where':{'id':_0x5e6370},'transaction':_0x35a567})[_0x59ae('0x35')](function(_0x21d168){if(_0x21d168){return db[_0x59ae('0x7b')][_0x59ae('0x36')]({'where':{'WhatsappAccountId':_0x5e6370},'transaction':_0x35a567})[_0x59ae('0x35')](function(){var _0x201c9b=_[_0x59ae('0x52')](_0x18a94c,function(_0x38d959){_0x38d959[_0x59ae('0x65')]=_0x5e6370;return _0x38d959;});return db[_0x59ae('0x7b')][_0x59ae('0x7c')](_0x201c9b,{'transaction':_0x35a567});});}else{_0x3ca9dc=0x194;_0x4e9566=[];}});})[_0x59ae('0x35')](function(){if(_0x3ca9dc!==0x194){return db[_0x59ae('0x7b')][_0x59ae('0x7d')]({'where':{'WhatsappAccountId':_0x5e6370},'order':'priority'})[_0x59ae('0x35')](function(_0x2110e7){_0x4e9566=_0x2110e7;});}})[_0x59ae('0x60')](function(_0x491f3f){_0x3ca9dc=0x1f4;logger[_0x59ae('0x25')](_0x491f3f['stack']);if(_0x491f3f[_0x59ae('0x3a')]){delete _0x491f3f[_0x59ae('0x3a')];}_0x4e9566=_0x491f3f;})['finally'](function(){if(_0x4e9566===null){_0x2c9441[_0x59ae('0x29')](_0x3ca9dc);}else{if(_0x3ca9dc===0x1f4){_0x2c9441[_0x59ae('0x2a')](_0x3ca9dc)[_0x59ae('0x3b')](_0x4e9566);}else{_0x2c9441['status'](_0x3ca9dc)['json'](_0x4e9566);}}});};exports[_0x59ae('0x7e')]=function(_0x442755,_0x3b5d0b,_0x159baa){var _0x18462a={};var _0x5734c1={};var _0x4240ea;var _0x6e0706;return db['WhatsappAccount'][_0x59ae('0x6c')]({'where':{'id':_0x442755[_0x59ae('0x56')]['id']}})[_0x59ae('0x35')](handleEntityNotFound(_0x3b5d0b,null))[_0x59ae('0x35')](function(_0x5da79b){if(_0x5da79b){_0x4240ea=_0x5da79b;_0x5734c1[_0x59ae('0x45')]=_[_0x59ae('0x43')](db[_0x59ae('0x7b')][_0x59ae('0x3e')]);_0x5734c1['query']=_[_0x59ae('0x43')](_0x442755[_0x59ae('0x42')]);_0x5734c1['filters']=_[_0x59ae('0x47')](_0x5734c1[_0x59ae('0x45')],_0x5734c1[_0x59ae('0x42')]);_0x18462a[_0x59ae('0x46')]=_[_0x59ae('0x47')](_0x5734c1[_0x59ae('0x45')],qs['fields'](_0x442755['query']['fields']));_0x18462a[_0x59ae('0x46')]=_0x18462a['attributes'][_0x59ae('0x49')]?_0x18462a[_0x59ae('0x46')]:_0x5734c1['model'];_0x18462a['order']=qs[_0x59ae('0x4d')](_0x442755[_0x59ae('0x42')]['sort']);_0x18462a[_0x59ae('0x4e')]=qs[_0x59ae('0x44')](_[_0x59ae('0x4f')](_0x442755[_0x59ae('0x42')],_0x5734c1['filters']));if(_0x442755[_0x59ae('0x42')][_0x59ae('0x50')]){_0x18462a[_0x59ae('0x4e')]=_[_0x59ae('0x51')](_0x18462a[_0x59ae('0x4e')],{'$or':_[_0x59ae('0x52')](_0x18462a['attributes'],function(_0x1896f2){var _0x2b63a0={};_0x2b63a0[_0x1896f2]={'$like':'%'+_0x442755[_0x59ae('0x42')][_0x59ae('0x50')]+'%'};return _0x2b63a0;})});}_0x18462a=_[_0x59ae('0x51')]({},_0x18462a,_0x442755[_0x59ae('0x54')]);return _0x4240ea[_0x59ae('0x7e')](_0x18462a);}})['then'](function(_0x417824){if(_0x417824){_0x6e0706=_0x417824[_0x59ae('0x49')];if(!_0x442755[_0x59ae('0x42')][_0x59ae('0x4a')](_0x59ae('0x4b'))){_0x18462a[_0x59ae('0x4c')]=qs[_0x59ae('0x4c')](_0x442755[_0x59ae('0x42')][_0x59ae('0x4c')]);_0x18462a['offset']=qs['offset'](_0x442755['query']['offset']);}return _0x4240ea[_0x59ae('0x7e')](_0x18462a);}})['then'](function(_0x2fafd9){if(_0x2fafd9){return _0x2fafd9?{'count':_0x6e0706,'rows':_0x2fafd9}:null;}})[_0x59ae('0x35')](respondWithResult(_0x3b5d0b,null))['catch'](handleError(_0x3b5d0b,null));};exports[_0x59ae('0x7f')]=function(_0x37fed2,_0x3bef78,_0x5483ee){var _0x23bbcf={'channel':_0x59ae('0x80')};var _0x3458a0=[];var _0x1f910d=[];var _0x445a9c={};return db[_0x59ae('0x3d')][_0x59ae('0x5e')]({'where':{'id':_0x37fed2[_0x59ae('0x56')]['id']},'include':[{'model':db[_0x59ae('0x7b')],'as':_0x59ae('0x81')}]})['then'](handleEntityNotFound(_0x3bef78,null))['then'](function(_0x17aecd){_0x23bbcf[_0x59ae('0x82')]=_0x17aecd;if(_0x23bbcf[_0x59ae('0x82')]&&_0x23bbcf[_0x59ae('0x82')]['type']===_0x59ae('0x83')&&_0x37fed2[_0x59ae('0x62')][_0x59ae('0x84')]){if(_0x37fed2[_0x59ae('0x62')][_0x59ae('0x84')][_0x59ae('0x49')]===0x0)return;if(_0x37fed2[_0x59ae('0x62')][_0x59ae('0x84')][0x0]['state']!==_0x59ae('0x85'))return;return db['WhatsappMessage'][_0x59ae('0x34')]({'read':!![],'readAt':_0x37fed2[_0x59ae('0x62')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x37fed2['body'][_0x59ae('0x84')][0x0][_0x59ae('0x86')]},'individualHooks':!![]})[_0x59ae('0x35')](function(_0x2e339a){return _0x3bef78[_0x59ae('0x2a')](0xc8)[_0x59ae('0x31')](_0x2e339a);});}_0x23bbcf[_0x59ae('0x87')]=_[_0x59ae('0x88')](_0x17aecd[_0x59ae('0x81')],[_0x59ae('0x89')],['asc']);if(_0x23bbcf[_0x59ae('0x82')][_0x59ae('0x81')]){delete _0x23bbcf['account']['Applications'];}return db[_0x59ae('0x8a')][_0x59ae('0x63')]()[_0x59ae('0x35')](function(_0x1b7db6){if(!_0x1b7db6){throw new db[(_0x59ae('0x8b'))][(_0x59ae('0x8c'))](_0x59ae('0x8d'));}_0x3458a0=_[_0x59ae('0x8e')](_[_0x59ae('0x43')](_0x1b7db6),[_0x59ae('0x8f'),_0x59ae('0x90')]);_0x1f910d=_['difference'](_[_0x59ae('0x43')](_0x1b7db6),[_0x59ae('0x8f'),'updatedAt',_0x59ae('0x91'),'ListId']);_0x23bbcf[_0x59ae('0x62')]={'mapKey':'mobile'};if(_0x23bbcf[_0x59ae('0x82')]&&_0x23bbcf[_0x59ae('0x82')]['type']===_0x59ae('0x92')){_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x93')]=_0x37fed2[_0x59ae('0x62')]['From'][_0x59ae('0x94')](_0x59ae('0x95'),'');_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x62')]=_0x37fed2[_0x59ae('0x62')]['Body'];_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x96')]=_0x37fed2[_0x59ae('0x62')][_0x59ae('0x97')];}if(_0x23bbcf[_0x59ae('0x82')]&&_0x23bbcf[_0x59ae('0x82')][_0x59ae('0x40')]===_0x59ae('0x83')){_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x93')]=_0x37fed2[_0x59ae('0x62')][_0x59ae('0x98')][0x0][_0x59ae('0x93')];_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x62')]=_0x37fed2[_0x59ae('0x62')]['notifications'][0x0][_0x59ae('0x27')][_0x59ae('0x62')];_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x96')]=_0x37fed2[_0x59ae('0x62')][_0x59ae('0x98')][0x0]['message_id'];}if(_0x23bbcf[_0x59ae('0x62')]['id']){delete _0x23bbcf[_0x59ae('0x62')]['id'];}if(_[_0x59ae('0x99')](_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x93')])){throw new db[(_0x59ae('0x8b'))][(_0x59ae('0x8c'))](_0x59ae('0x9a'));}if(_[_0x59ae('0x99')](_0x23bbcf[_0x59ae('0x62')]['body'])||_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x62')]===''){throw new db[(_0x59ae('0x8b'))][(_0x59ae('0x8c'))](_0x59ae('0x9b'));}if(_['isNil'](_0x23bbcf[_0x59ae('0x62')]['mapKey'])){throw new db[(_0x59ae('0x8b'))][(_0x59ae('0x8c'))](_0x59ae('0x9c')+_0x1f910d);}if(!_[_0x59ae('0x9d')](_0x1f910d,_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x9e')])){throw new db[(_0x59ae('0x8b'))][(_0x59ae('0x8c'))](_0x59ae('0x9f')+_0x1f910d);}_0x445a9c[_0x23bbcf[_0x59ae('0x62')]['mapKey']]=_0x23bbcf[_0x59ae('0x62')]['from'];return db[_0x59ae('0xa0')][_0x59ae('0x5e')]({'where':{'id':_0x23bbcf[_0x59ae('0x82')][_0x59ae('0xa1')]},'include':[{'model':db[_0x59ae('0x8a')],'as':_0x59ae('0xa2'),'where':_0x445a9c,'limit':0x1,'order':[[_0x59ae('0x90'),_0x59ae('0xa3')]]}]});})[_0x59ae('0x35')](handleEntityNotFound(_0x3bef78,null))[_0x59ae('0x35')](function(_0x1af053){if(_0x1af053){_0x23bbcf[_0x59ae('0xa4')]=_[_0x59ae('0x72')](_0x1af053,[_0x59ae('0xa2')]);if(_0x1af053[_0x59ae('0xa2')][_0x59ae('0x49')]){return _0x1af053[_0x59ae('0xa2')][0x0];}var _0x4faf9c=_['defaults'](_0x23bbcf[_0x59ae('0x62')],{'firstName':_0x23bbcf[_0x59ae('0x62')]['from'],'ListId':_0x1af053['id']});_0x4faf9c[_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x9e')]]=_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x93')];return db[_0x59ae('0x8a')][_0x59ae('0x5a')](_0x4faf9c,{'fields':_0x3458a0,'raw':!![]});}})[_0x59ae('0x35')](handleEntityNotFound(_0x3bef78,null))[_0x59ae('0x35')](function(_0xf7ca52){if(_0xf7ca52){_0x23bbcf['contact']=_0xf7ca52;var _0x257057={'ContactId':_0xf7ca52['id'],'phone':_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x93')],'WhatsappAccountId':_0x37fed2[_0x59ae('0x56')]['id']};var _0x3dc1a2={'ContactId':_0xf7ca52['id'],'WhatsappAccountId':_0x37fed2[_0x59ae('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x59ae('0x5e')]({'where':_0x3dc1a2})['then'](function(_0x3ac65e){if(_0x3ac65e){return[_0x3ac65e,![]];}return db[_0x59ae('0xa5')]['create'](_0x257057)[_0x59ae('0x35')](function(_0x25734b){return[_0x25734b,!![]];});});}})['spread'](function(_0x20f2b2,_0x5628df){_0x23bbcf[_0x59ae('0xa6')]=_0x20f2b2[_0x59ae('0x5c')]({'plain':!![]});_0x23bbcf[_0x59ae('0xa6')][_0x59ae('0xa7')]=![];if(_0x5628df){if(_0x23bbcf[_0x59ae('0x82')][_0x59ae('0xa8')]){_0x23bbcf[_0x59ae('0x87')][_0x59ae('0xa9')]({'id':0x0,'priority':_0x23bbcf[_0x59ae('0x87')][_0x59ae('0x49')]+0x1,'app':_0x59ae('0xaa'),'appdata':_0x59ae('0xab'),'interval':_0x59ae('0xac')});}_0x23bbcf[_0x59ae('0xa6')][_0x59ae('0xa7')]=!![];}return db[_0x59ae('0xad')][_0x59ae('0x5a')]({'phone':_0x23bbcf[_0x59ae('0x62')][_0x59ae('0x93')],'messageId':_0x23bbcf['body'][_0x59ae('0x96')],'body':_0x23bbcf[_0x59ae('0x62')]['body'],'WhatsappAccountId':_0x37fed2[_0x59ae('0x56')]['id'],'WhatsappInteractionId':_0x20f2b2['id'],'direction':'in','ContactId':_0x20f2b2[_0x59ae('0xae')],'AttachmentId':_0x23bbcf[_0x59ae('0x62')]['AttachmentId']});})[_0x59ae('0x35')](function(_0x4bc8a8){_0x23bbcf['message']=_0x4bc8a8;if(_0x23bbcf[_0x59ae('0xa6')]['UserId']){return db[_0x59ae('0xaf')]['find']({'attributes':['id',_0x59ae('0x3a')],'where':{'id':_0x23bbcf[_0x59ae('0xa6')][_0x59ae('0xb0')]}})['then'](function(_0x25af5e){if(_0x25af5e){_0x23bbcf['applications'][_0x59ae('0xb1')]({'id':0x0,'priority':0x0,'app':_0x59ae('0xb2'),'appdata':_0x25af5e[_0x59ae('0x3a')]+','+(_0x23bbcf[_0x59ae('0x82')][_0x59ae('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x59ae('0xb4'),_0x59ae('0xb5'),_0x23bbcf);});}return respondWithRpcPromise(_0x59ae('0xb4'),'startRouting',_0x23bbcf);})[_0x59ae('0x35')](function(_0xf4a331){if(_0xf4a331){var _0x50f096=0xc8;var _0x5509cd=_0x59ae('0xb6');logger['info'](_0x59ae('0x24'),_0x5509cd,_0x50f096,_0x59ae('0xb7'));logger['debug'](_0x59ae('0xb8'),_0x5509cd,_0x50f096,_0x59ae('0xb7'),JSON[_0x59ae('0xb9')](_0xf4a331));if(_0x23bbcf['account'][_0x59ae('0x40')]===_0x59ae('0x92')){return _0x3bef78['status'](_0x50f096)['set'](_0x59ae('0xba'),'text/xml')['send'](_0x59ae('0xbb'));}else{return _0x3bef78[_0x59ae('0x2a')](_0x50f096)[_0x59ae('0x31')](_0xf4a331);}}});})['catch'](handleError(_0x3bef78,null));};exports['send']=function(_0x275e77,_0x453a74,_0x15cfa3){var _0x1d9fd0,_0x5c05f3,_0x4f1a5c;if(_[_0x59ae('0x99')](_0x275e77['body'][_0x59ae('0x62')])||_0x275e77[_0x59ae('0x62')][_0x59ae('0x62')]===''){throw new db['Sequelize'][(_0x59ae('0x8c'))](_0x59ae('0x9b'));}if(_[_0x59ae('0x99')](_0x275e77['body']['to'])){throw new db[(_0x59ae('0x8b'))][(_0x59ae('0x8c'))](_0x59ae('0xbc'));}_0x1d9fd0=_0x275e77['body']['to'];return db[_0x59ae('0x3d')][_0x59ae('0x5e')]({'where':{'id':_0x275e77['params']['id']},'include':[{'model':db[_0x59ae('0xa0')],'as':_0x59ae('0xbd'),'include':[{'model':db[_0x59ae('0x8a')],'as':_0x59ae('0xa2'),'where':{'mobile':_0x1d9fd0},'limit':0x1,'order':[[_0x59ae('0x90'),'DESC']]}]}]})[_0x59ae('0x35')](handleEntityNotFound(_0x453a74,null))['then'](function(_0x399e10){if(_0x399e10&&_0x399e10[_0x59ae('0xbd')]){_0x5c05f3=_0x399e10[_0x59ae('0x5c')]({'plain':!![]});if(_0x5c05f3[_0x59ae('0xbd')]&&_0x5c05f3[_0x59ae('0xbd')][_0x59ae('0xa2')]['length']){return _0x5c05f3[_0x59ae('0xbd')][_0x59ae('0xa2')][0x0];}return db[_0x59ae('0x8a')][_0x59ae('0x5a')](_[_0x59ae('0xbe')](_0x275e77['body'],{'firstName':_0x1d9fd0,'mobile':_0x1d9fd0,'phone':_0x1d9fd0,'ListId':_0x5c05f3[_0x59ae('0xa1')]}));}})[_0x59ae('0x35')](handleEntityNotFound(_0x453a74,null))[_0x59ae('0x35')](function(_0x546650){if(_0x546650){_0x4f1a5c=_0x546650;return db[_0x59ae('0xa5')][_0x59ae('0x5e')]({'where':{'ContactId':_0x4f1a5c['id'],'closed':![],'WhatsappAccountId':_0x5c05f3['id']}})[_0x59ae('0x35')](function(_0x595fc8){if(_0x595fc8){return[_0x595fc8,![]];}return db['WhatsappInteraction'][_0x59ae('0x5a')]({'UserId':_0x275e77['user']['id'],'ContactId':_0x4f1a5c['id'],'WhatsappAccountId':_0x5c05f3['id'],'phone':_0x1d9fd0,'firstMsgDirection':_0x59ae('0xbf'),'Messages':[_[_0x59ae('0x51')](_0x275e77[_0x59ae('0x62')],{'read':![],'body':_0x275e77[_0x59ae('0x62')]['body'],'phone':_0x1d9fd0,'WhatsappAccountId':_0x5c05f3['id'],'UserId':_0x275e77[_0x59ae('0x5b')]['id'],'ContactId':_0x4f1a5c['id']})]},{'include':[{'model':db[_0x59ae('0xad')],'as':'Messages'}]})[_0x59ae('0x35')](function(_0x425912){return[_0x425912,!![]];});});}})[_0x59ae('0xc0')](function(_0x2d6830,_0x406c85){if(_0x406c85){return _0x2d6830;}return db['WhatsappMessage'][_0x59ae('0x5a')](_[_0x59ae('0x51')](_0x275e77['body'],{'read':![],'body':_0x275e77[_0x59ae('0x62')][_0x59ae('0x62')],'phone':_0x1d9fd0,'WhatsappAccountId':_0x5c05f3['id'],'WhatsappInteractionId':_0x2d6830['id'],'UserId':_0x275e77[_0x59ae('0x5b')]['id'],'ContactId':_0x4f1a5c['id']}))[_0x59ae('0x35')](function(_0x52c136){_0x2d6830['dataValues'][_0x59ae('0xc1')]=[];_0x2d6830[_0x59ae('0xc2')][_0x59ae('0xc1')][_0x59ae('0xa9')](_0x52c136[_0x59ae('0xc2')]);return _0x2d6830;});})[_0x59ae('0x35')](respondWithResult(_0x453a74,null))[_0x59ae('0x60')](handleError(_0x453a74,null));}; \ No newline at end of file +var _0x331c=['MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','Contacts','WhatsappInteraction','interaction','get','created','autoclose','push','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','Pause','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','hasOwnProperty','removeDispositions','ids','findOne','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','whatsapp:','Body','messageId'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x331c,0xe9));var _0xc331=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x331c[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0xc331('0x0'));var rimraf=require(_0xc331('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc331('0x2'));var rp=require(_0xc331('0x3'));var moment=require(_0xc331('0x4'));var BPromise=require(_0xc331('0x5'));var Mustache=require(_0xc331('0x6'));var util=require('util');var path=require(_0xc331('0x7'));var sox=require(_0xc331('0x8'));var csv=require(_0xc331('0x9'));var ejs=require(_0xc331('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc331('0xb'));var squel=require(_0xc331('0xc'));var crypto=require(_0xc331('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc331('0xe'));var toCsv=require(_0xc331('0x9'));var querystring=require(_0xc331('0xf'));var Papa=require(_0xc331('0x10'));var Redis=require(_0xc331('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc331('0x12'));var as=require(_0xc331('0x13'));var hardwareService=require(_0xc331('0x14'));var logger=require(_0xc331('0x15'))('api');var utils=require(_0xc331('0x16'));var config=require(_0xc331('0x17'));var licenseUtil=require(_0xc331('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc331('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc331('0x1a'))(new Redis(config[_0xc331('0x1b')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc331('0x1c')][_0xc331('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x20b7b3,_0x53b20a,_0xbd338c,_0xaf9ef2){return new BPromise(function(_0x249f00,_0x23cd66){var _0x27be32=_0xaf9ef2||client;return _0x27be32['request'](_0x20b7b3,_0xbd338c)[_0xc331('0x1e')](function(_0x2968b6){logger[_0xc331('0x1f')](_0xc331('0x20'),_0x53b20a,'request\x20sent');logger[_0xc331('0x21')](_0xc331('0x22'),_0x53b20a,_0xc331('0x23'),JSON[_0xc331('0x24')](_0x2968b6));if(_0x2968b6[_0xc331('0x25')]){if(_0x2968b6[_0xc331('0x25')][_0xc331('0x26')]===0x1f4){logger['error'](_0xc331('0x20'),_0x53b20a,_0x2968b6[_0xc331('0x25')][_0xc331('0x27')]);return _0x23cd66(_0x2968b6[_0xc331('0x25')][_0xc331('0x27')]);}logger[_0xc331('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x53b20a,_0x2968b6['error']['message']);return _0x249f00(_0x2968b6[_0xc331('0x25')]['message']);}else{logger[_0xc331('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x53b20a,'request\x20sent');_0x249f00(_0x2968b6[_0xc331('0x28')][_0xc331('0x27')]);}})[_0xc331('0x29')](function(_0x128c7e){logger['error'](_0xc331('0x20'),_0x53b20a,_0x128c7e);_0x23cd66(_0x128c7e);});});}function respondWithStatusCode(_0x583e3e,_0xbd4643){_0xbd4643=_0xbd4643||0xcc;return function(_0x5405c1){if(_0x5405c1){return _0x583e3e[_0xc331('0x2a')](_0xbd4643);}return _0x583e3e['status'](_0xbd4643)['end']();};}function respondWithResult(_0x727f59,_0x12b76d){_0x12b76d=_0x12b76d||0xc8;return function(_0x921090){if(_0x921090){return _0x727f59[_0xc331('0x2b')](_0x12b76d)[_0xc331('0x2c')](_0x921090);}};}function respondWithFilteredResult(_0x590889,_0x3c4938){return function(_0x3e160f){if(_0x3e160f){var _0x1635b0=typeof _0x3c4938['offset']==='undefined'&&typeof _0x3c4938[_0xc331('0x2d')]===_0xc331('0x2e');var _0x1f3ca5=_0x3e160f[_0xc331('0x2f')];var _0x13ca7e=_0x1635b0?0x0:_0x3c4938[_0xc331('0x30')];var _0x542e8c=_0x1635b0?_0x3e160f[_0xc331('0x2f')]:_0x3c4938[_0xc331('0x30')]+_0x3c4938[_0xc331('0x2d')];var _0x8f0ef5;if(_0x542e8c>=_0x1f3ca5){_0x542e8c=_0x1f3ca5;_0x8f0ef5=0xc8;}else{_0x8f0ef5=0xce;}_0x590889[_0xc331('0x2b')](_0x8f0ef5);return _0x590889[_0xc331('0x31')]('Content-Range',_0x13ca7e+'-'+_0x542e8c+'/'+_0x1f3ca5)[_0xc331('0x2c')](_0x3e160f);}return null;};}function patchUpdates(_0x73e203){return function(_0x57e20a){try{jsonpatch[_0xc331('0x32')](_0x57e20a,_0x73e203,!![]);}catch(_0x588489){return BPromise[_0xc331('0x33')](_0x588489);}return _0x57e20a[_0xc331('0x34')]();};}function saveUpdates(_0x5d8825,_0x35f9bd){return function(_0x9b08bd){if(_0x9b08bd){return _0x9b08bd[_0xc331('0x35')](_0x5d8825)[_0xc331('0x1e')](function(_0x23a38e){return _0x23a38e;});}return null;};}function removeEntity(_0x5ee097,_0x1c4bc4){return function(_0x3de1d7){if(_0x3de1d7){return _0x3de1d7[_0xc331('0x36')]()[_0xc331('0x1e')](function(){var _0x31f9ae=_0x3de1d7['get']({'plain':!![]});var _0x4909ad=_0xc331('0x37');return db[_0xc331('0x38')]['destroy']({'where':{'type':_0x4909ad,'resourceId':_0x31f9ae['id']}})[_0xc331('0x1e')](function(){return _0x3de1d7;});})[_0xc331('0x1e')](function(){_0x5ee097[_0xc331('0x2b')](0xcc)[_0xc331('0x39')]();});}};}function handleEntityNotFound(_0x39fd2a,_0x1bd5fd){return function(_0x436722){if(!_0x436722){_0x39fd2a[_0xc331('0x2a')](0x194);}return _0x436722;};}function handleError(_0x25c702,_0x305ac0){_0x305ac0=_0x305ac0||0x1f4;return function(_0x543e01){logger[_0xc331('0x25')](_0x543e01[_0xc331('0x3a')]);if(_0x543e01[_0xc331('0x3b')]){delete _0x543e01[_0xc331('0x3b')];}_0x25c702[_0xc331('0x2b')](_0x305ac0)[_0xc331('0x3c')](_0x543e01);};}exports[_0xc331('0x3d')]=function(_0x44a96a,_0x4e6d3a){var _0x2e9591={'include':[{'model':db['Pause'],'as':_0xc331('0x3e')}]},_0x1e8057={},_0x354585={'count':0x0,'rows':[]};var _0x5aeb0a=_[_0xc331('0x3f')](db[_0xc331('0x40')]['rawAttributes'],function(_0xf4b61c){return{'name':_0xf4b61c[_0xc331('0x41')],'type':_0xf4b61c[_0xc331('0x42')][_0xc331('0x43')]};});_0x1e8057[_0xc331('0x44')]=_[_0xc331('0x3f')](_0x5aeb0a,_0xc331('0x3b'));_0x1e8057[_0xc331('0x45')]=_[_0xc331('0x46')](_0x44a96a[_0xc331('0x45')]);_0x1e8057[_0xc331('0x47')]=_[_0xc331('0x48')](_0x1e8057['model'],_0x1e8057[_0xc331('0x45')]);_0x2e9591[_0xc331('0x49')]=_[_0xc331('0x48')](_0x1e8057[_0xc331('0x44')],qs[_0xc331('0x4a')](_0x44a96a[_0xc331('0x45')][_0xc331('0x4a')]));_0x2e9591[_0xc331('0x49')]=_0x2e9591[_0xc331('0x49')][_0xc331('0x4b')]?_0x2e9591[_0xc331('0x49')]:_0x1e8057['model'];if(!_0x44a96a['query']['hasOwnProperty'](_0xc331('0x4c'))){_0x2e9591[_0xc331('0x2d')]=qs[_0xc331('0x2d')](_0x44a96a[_0xc331('0x45')]['limit']);_0x2e9591[_0xc331('0x30')]=qs['offset'](_0x44a96a['query'][_0xc331('0x30')]);}_0x2e9591[_0xc331('0x4d')]=qs[_0xc331('0x4e')](_0x44a96a[_0xc331('0x45')][_0xc331('0x4e')]);_0x2e9591[_0xc331('0x4f')]=qs['filters'](_[_0xc331('0x50')](_0x44a96a[_0xc331('0x45')],_0x1e8057[_0xc331('0x47')]),_0x5aeb0a);if(_0x44a96a[_0xc331('0x45')][_0xc331('0x51')]){_0x2e9591[_0xc331('0x4f')]=_[_0xc331('0x52')](_0x2e9591[_0xc331('0x4f')],{'$or':_[_0xc331('0x3f')](_0x5aeb0a,function(_0x3fe12e){if(_0x3fe12e[_0xc331('0x42')]!=='VIRTUAL'){var _0x3c4500={};_0x3c4500[_0x3fe12e['name']]={'$like':'%'+_0x44a96a[_0xc331('0x45')]['filter']+'%'};return _0x3c4500;}})});}_0x2e9591=_[_0xc331('0x52')]({},_0x2e9591,_0x44a96a[_0xc331('0x53')]);var _0x27df0d={'where':_0x2e9591[_0xc331('0x4f')]};return db[_0xc331('0x40')][_0xc331('0x2f')](_0x27df0d)['then'](function(_0xfbfdd){_0x354585[_0xc331('0x2f')]=_0xfbfdd;if(_0x44a96a['query'][_0xc331('0x54')]){_0x2e9591['include']=[{'all':!![]}];}return db[_0xc331('0x40')][_0xc331('0x55')](_0x2e9591);})[_0xc331('0x1e')](function(_0x5205a3){_0x354585[_0xc331('0x56')]=_0x5205a3;return _0x354585;})[_0xc331('0x1e')](respondWithFilteredResult(_0x4e6d3a,_0x2e9591))[_0xc331('0x29')](handleError(_0x4e6d3a,null));};exports['show']=function(_0x2cbe31,_0x5c4b29){var _0x5e562f={'raw':![],'where':{'id':_0x2cbe31[_0xc331('0x57')]['id']},'include':[{'model':db[_0xc331('0x58')],'as':_0xc331('0x3e')}]},_0x342867={};_0x342867[_0xc331('0x44')]=_[_0xc331('0x46')](db[_0xc331('0x40')][_0xc331('0x59')]);_0x342867[_0xc331('0x45')]=_[_0xc331('0x46')](_0x2cbe31['query']);_0x342867[_0xc331('0x47')]=_[_0xc331('0x48')](_0x342867['model'],_0x342867[_0xc331('0x45')]);_0x5e562f['attributes']=_[_0xc331('0x48')](_0x342867[_0xc331('0x44')],qs[_0xc331('0x4a')](_0x2cbe31['query'][_0xc331('0x4a')]));_0x5e562f[_0xc331('0x49')]=_0x5e562f['attributes']['length']?_0x5e562f['attributes']:_0x342867[_0xc331('0x44')];if(_0x2cbe31[_0xc331('0x45')]['includeAll']){_0x5e562f[_0xc331('0x5a')]=[{'all':!![]}];}_0x5e562f=_['merge']({},_0x5e562f,_0x2cbe31[_0xc331('0x53')]);return db[_0xc331('0x40')][_0xc331('0x5b')](_0x5e562f)[_0xc331('0x1e')](handleEntityNotFound(_0x5c4b29,null))[_0xc331('0x1e')](respondWithResult(_0x5c4b29,null))[_0xc331('0x29')](handleError(_0x5c4b29,null));};exports[_0xc331('0x5c')]=function(_0x463ebd,_0x3bf3d1){return db[_0xc331('0x40')][_0xc331('0x5c')](_0x463ebd['body'],{})[_0xc331('0x1e')](function(_0x40921d){var _0x45a87e=_0x463ebd[_0xc331('0x5d')]['get']({'plain':!![]});if(!_0x45a87e)throw new Error(_0xc331('0x5e'));if(_0x45a87e[_0xc331('0x5f')]===_0xc331('0x5d')){var _0x33d07a=_0x40921d['get']({'plain':!![]});var _0x58d237=_0xc331('0x37');return db[_0xc331('0x60')][_0xc331('0x5b')]({'where':{'name':_0x58d237,'userProfileId':_0x45a87e[_0xc331('0x61')]},'raw':!![]})['then'](function(_0xb2c264){if(_0xb2c264&&_0xb2c264['autoAssociation']===0x0){return db[_0xc331('0x38')]['create']({'name':_0x33d07a[_0xc331('0x3b')],'resourceId':_0x33d07a['id'],'type':_0xb2c264[_0xc331('0x3b')],'sectionId':_0xb2c264['id']},{})['then'](function(){return _0x40921d;});}else{return _0x40921d;}})[_0xc331('0x29')](function(_0x90d3e7){logger[_0xc331('0x25')](_0xc331('0x62'),_0x90d3e7);throw _0x90d3e7;});}return _0x40921d;})[_0xc331('0x1e')](respondWithResult(_0x3bf3d1,0xc9))['catch'](handleError(_0x3bf3d1,null));};exports[_0xc331('0x35')]=function(_0x1eb3cb,_0x2a66e1){if(_0x1eb3cb[_0xc331('0x63')]['id']){delete _0x1eb3cb['body']['id'];}return db[_0xc331('0x40')][_0xc331('0x5b')]({'where':{'id':_0x1eb3cb[_0xc331('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc331('0x1e')](handleEntityNotFound(_0x2a66e1,null))[_0xc331('0x1e')](saveUpdates(_0x1eb3cb[_0xc331('0x63')],null))['then'](respondWithResult(_0x2a66e1,null))[_0xc331('0x29')](handleError(_0x2a66e1,null));};exports[_0xc331('0x36')]=function(_0x51d88a,_0xa9b86f){return db['WhatsappAccount'][_0xc331('0x5b')]({'where':{'id':_0x51d88a[_0xc331('0x57')]['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0xa9b86f,null))[_0xc331('0x1e')](removeEntity(_0xa9b86f,null))['catch'](handleError(_0xa9b86f,null));};exports['describe']=function(_0x558ef1,_0x595909){return db[_0xc331('0x40')][_0xc331('0x64')]()[_0xc331('0x1e')](respondWithResult(_0x595909,null))[_0xc331('0x29')](handleError(_0x595909,null));};exports[_0xc331('0x65')]=function(_0x3e4bcb,_0x4a764d,_0x3f3906){if(_0x3e4bcb[_0xc331('0x63')]['id']){delete _0x3e4bcb[_0xc331('0x63')]['id'];}return db['WhatsappAccount'][_0xc331('0x5b')]({'where':{'id':_0x3e4bcb[_0xc331('0x57')]['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0x4a764d,null))[_0xc331('0x1e')](function(_0x41c952){if(_0x41c952){_0x3e4bcb[_0xc331('0x63')][_0xc331('0x66')]=_0x41c952['id'];return db['Disposition'][_0xc331('0x5c')](_0x3e4bcb[_0xc331('0x63')]);}})['then'](respondWithResult(_0x4a764d,null))[_0xc331('0x29')](handleError(_0x4a764d,null));};exports['getDispositions']=function(_0x3b4bd0,_0x3c1ae0,_0x4ff1e6){var _0x276ea2={'raw':![],'where':{}};var _0x22c41f={};var _0x535511={'count':0x0,'rows':[]};return db[_0xc331('0x40')]['findOne']({'where':{'id':_0x3b4bd0[_0xc331('0x57')]['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0x3c1ae0,null))[_0xc331('0x1e')](function(_0x14f115){if(_0x14f115){_0x22c41f[_0xc331('0x44')]=_[_0xc331('0x46')](db[_0xc331('0x67')][_0xc331('0x59')]);_0x22c41f[_0xc331('0x45')]=_[_0xc331('0x46')](_0x3b4bd0[_0xc331('0x45')]);_0x22c41f[_0xc331('0x47')]=_[_0xc331('0x48')](_0x22c41f[_0xc331('0x44')],_0x22c41f[_0xc331('0x45')]);_0x276ea2[_0xc331('0x49')]=_[_0xc331('0x48')](_0x22c41f['model'],qs[_0xc331('0x4a')](_0x3b4bd0[_0xc331('0x45')][_0xc331('0x4a')]));_0x276ea2[_0xc331('0x49')]=_0x276ea2[_0xc331('0x49')]['length']?_0x276ea2['attributes']:_0x22c41f['model'];if(!_0x3b4bd0[_0xc331('0x45')][_0xc331('0x68')](_0xc331('0x4c'))){_0x276ea2[_0xc331('0x2d')]=qs['limit'](_0x3b4bd0[_0xc331('0x45')][_0xc331('0x2d')]);_0x276ea2['offset']=qs[_0xc331('0x30')](_0x3b4bd0[_0xc331('0x45')]['offset']);}_0x276ea2[_0xc331('0x4d')]=qs[_0xc331('0x4e')](_0x3b4bd0[_0xc331('0x45')]['sort']);_0x276ea2[_0xc331('0x4f')]=qs[_0xc331('0x47')](_[_0xc331('0x50')](_0x3b4bd0[_0xc331('0x45')],_0x22c41f['filters']));_0x276ea2['where'][_0xc331('0x66')]=_0x14f115['id'];if(_0x3b4bd0[_0xc331('0x45')][_0xc331('0x51')]){_0x276ea2[_0xc331('0x4f')]=_['merge'](_0x276ea2['where'],{'$or':_[_0xc331('0x3f')](_0x276ea2[_0xc331('0x49')],function(_0x47a099){var _0x502df0={};_0x502df0[_0x47a099]={'$like':'%'+_0x3b4bd0[_0xc331('0x45')][_0xc331('0x51')]+'%'};return _0x502df0;})});}_0x276ea2=_[_0xc331('0x52')]({},_0x276ea2,_0x3b4bd0[_0xc331('0x53')]);return db[_0xc331('0x67')]['count']({'where':_0x276ea2[_0xc331('0x4f')]})['then'](function(_0x1e9141){_0x535511[_0xc331('0x2f')]=_0x1e9141;if(_0x3b4bd0[_0xc331('0x45')][_0xc331('0x54')]){_0x276ea2['include']=[{'all':!![]}];}return db[_0xc331('0x67')][_0xc331('0x55')](_0x276ea2);})['then'](function(_0x601dd9){_0x535511[_0xc331('0x56')]=_0x601dd9;return _0x535511;});}})[_0xc331('0x1e')](respondWithFilteredResult(_0x3c1ae0,_0x276ea2))[_0xc331('0x29')](handleError(_0x3c1ae0,null));};exports[_0xc331('0x69')]=function(_0x4f3dfd,_0x22d413,_0x2a1169){return db[_0xc331('0x40')]['find']({'where':{'id':_0x4f3dfd[_0xc331('0x57')]['id']}})['then'](handleEntityNotFound(_0x22d413,null))[_0xc331('0x1e')](function(_0x3ed4c3){if(_0x3ed4c3){return _0x3ed4c3['removeDispositions'](_0x4f3dfd[_0xc331('0x45')][_0xc331('0x6a')]);}})[_0xc331('0x1e')](respondWithStatusCode(_0x22d413,null))[_0xc331('0x29')](handleError(_0x22d413,null));};exports['addAnswer']=function(_0x11f75a,_0x632a46,_0x8ef1bb){if(_0x11f75a[_0xc331('0x63')]['id']){delete _0x11f75a['body']['id'];}return db['WhatsappAccount'][_0xc331('0x5b')]({'where':{'id':_0x11f75a[_0xc331('0x57')]['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0x632a46,null))[_0xc331('0x1e')](function(_0x4c1ad3){if(_0x4c1ad3){_0x11f75a[_0xc331('0x63')][_0xc331('0x66')]=_0x4c1ad3['id'];return db['CannedAnswer'][_0xc331('0x5c')](_0x11f75a[_0xc331('0x63')]);}})[_0xc331('0x1e')](respondWithResult(_0x632a46,null))['catch'](handleError(_0x632a46,null));};exports['getAnswers']=function(_0x2ce733,_0x49a578,_0x5c2ef6){var _0x2b88d5={'raw':![],'where':{}};var _0x267fc8={};var _0x1ad50e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc331('0x6b')]({'where':{'id':_0x2ce733[_0xc331('0x57')]['id']}})['then'](handleEntityNotFound(_0x49a578,null))[_0xc331('0x1e')](function(_0x211e95){if(_0x211e95){_0x267fc8[_0xc331('0x44')]=_[_0xc331('0x46')](db['CannedAnswer'][_0xc331('0x59')]);_0x267fc8[_0xc331('0x45')]=_[_0xc331('0x46')](_0x2ce733[_0xc331('0x45')]);_0x267fc8[_0xc331('0x47')]=_[_0xc331('0x48')](_0x267fc8[_0xc331('0x44')],_0x267fc8['query']);_0x2b88d5[_0xc331('0x49')]=_[_0xc331('0x48')](_0x267fc8[_0xc331('0x44')],qs[_0xc331('0x4a')](_0x2ce733[_0xc331('0x45')]['fields']));_0x2b88d5['attributes']=_0x2b88d5[_0xc331('0x49')]['length']?_0x2b88d5[_0xc331('0x49')]:_0x267fc8[_0xc331('0x44')];if(!_0x2ce733[_0xc331('0x45')][_0xc331('0x68')](_0xc331('0x4c'))){_0x2b88d5[_0xc331('0x2d')]=qs[_0xc331('0x2d')](_0x2ce733[_0xc331('0x45')]['limit']);_0x2b88d5[_0xc331('0x30')]=qs[_0xc331('0x30')](_0x2ce733['query']['offset']);}_0x2b88d5[_0xc331('0x4d')]=qs[_0xc331('0x4e')](_0x2ce733['query'][_0xc331('0x4e')]);_0x2b88d5[_0xc331('0x4f')]=qs[_0xc331('0x47')](_[_0xc331('0x50')](_0x2ce733['query'],_0x267fc8['filters']));_0x2b88d5['where']['WhatsappAccountId']=_0x211e95['id'];if(_0x2ce733[_0xc331('0x45')][_0xc331('0x51')]){_0x2b88d5['where']=_['merge'](_0x2b88d5[_0xc331('0x4f')],{'$or':_['map'](_0x2b88d5[_0xc331('0x49')],function(_0x5c1228){var _0x4ef639={};_0x4ef639[_0x5c1228]={'$like':'%'+_0x2ce733[_0xc331('0x45')]['filter']+'%'};return _0x4ef639;})});}_0x2b88d5=_[_0xc331('0x52')]({},_0x2b88d5,_0x2ce733[_0xc331('0x53')]);return db[_0xc331('0x6c')][_0xc331('0x2f')]({'where':_0x2b88d5[_0xc331('0x4f')]})[_0xc331('0x1e')](function(_0x1e719f){_0x1ad50e[_0xc331('0x2f')]=_0x1e719f;if(_0x2ce733['query']['includeAll']){_0x2b88d5[_0xc331('0x5a')]=[{'all':!![]}];}return db[_0xc331('0x6c')]['findAll'](_0x2b88d5);})[_0xc331('0x1e')](function(_0x1cda96){_0x1ad50e[_0xc331('0x56')]=_0x1cda96;return _0x1ad50e;});}})['then'](respondWithFilteredResult(_0x49a578,_0x2b88d5))[_0xc331('0x29')](handleError(_0x49a578,null));};exports[_0xc331('0x6d')]=function(_0x2cf863,_0x28f529,_0x3a042f){return db[_0xc331('0x40')][_0xc331('0x5b')]({'where':{'id':_0x2cf863['params']['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0x28f529,null))['then'](function(_0x15e58f){if(_0x15e58f){return _0x15e58f[_0xc331('0x6d')](_0x2cf863[_0xc331('0x45')][_0xc331('0x6a')]);}})['then'](respondWithStatusCode(_0x28f529,null))[_0xc331('0x29')](handleError(_0x28f529,null));};exports[_0xc331('0x6e')]=function(_0x13e464,_0x1ca46a,_0x11e32a){return db[_0xc331('0x40')]['find']({'where':{'id':_0x13e464['params']['id']}})['then'](handleEntityNotFound(_0x1ca46a,null))['then'](function(_0x167c3a){if(_0x167c3a){return _0x167c3a['addAgents'](_0x13e464[_0xc331('0x63')][_0xc331('0x6a')],_[_0xc331('0x6f')](_0x13e464[_0xc331('0x63')],[_0xc331('0x6a'),'id'])||{})[_0xc331('0x70')](function(_0x159dc4){for(var _0x57b043=0x0;_0x57b043<_0x13e464[_0xc331('0x63')]['ids']['length'];_0x57b043+=0x1){socket[_0xc331('0x71')](_0xc331('0x72'),{'UserId':Number(_0x13e464[_0xc331('0x63')][_0xc331('0x6a')][_0x57b043]),'WhatsappAccountId':Number(_0x13e464[_0xc331('0x57')]['id'])});}return _0x159dc4;});}})[_0xc331('0x1e')](respondWithResult(_0x1ca46a,null))['catch'](handleError(_0x1ca46a,null));};exports['removeAgents']=function(_0x113600,_0x14f286,_0x4babf9){return db[_0xc331('0x40')][_0xc331('0x5b')]({'where':{'id':_0x113600['params']['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0x14f286,null))[_0xc331('0x1e')](function(_0x5dbab1){if(_0x5dbab1){return _0x5dbab1[_0xc331('0x73')](_0x113600[_0xc331('0x45')][_0xc331('0x6a')])[_0xc331('0x1e')](function(){if(_[_0xc331('0x74')](_0x113600[_0xc331('0x45')][_0xc331('0x6a')])){for(var _0x2abe69=0x0;_0x2abe69<_0x113600[_0xc331('0x45')][_0xc331('0x6a')][_0xc331('0x4b')];_0x2abe69+=0x1){socket[_0xc331('0x71')](_0xc331('0x75'),{'UserId':Number(_0x113600[_0xc331('0x45')][_0xc331('0x6a')][_0x2abe69]),'WhatsappAccountId':Number(_0x113600['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x113600[_0xc331('0x45')][_0xc331('0x6a')]),'WhatsappAccountId':Number(_0x113600['params']['id'])});}});}})['then'](respondWithStatusCode(_0x14f286,null))[_0xc331('0x29')](handleError(_0x14f286,null));};exports[_0xc331('0x76')]=function(_0x13c4e4,_0x4cc94b,_0x4920f1){var _0x509e55={};var _0x148ae1={};var _0x1e3dfa;var _0xb4a6d2;return db['WhatsappAccount'][_0xc331('0x6b')]({'where':{'id':_0x13c4e4[_0xc331('0x57')]['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0x4cc94b,null))[_0xc331('0x1e')](function(_0x487164){if(_0x487164){_0x1e3dfa=_0x487164;_0x148ae1[_0xc331('0x44')]=_[_0xc331('0x46')](db[_0xc331('0x77')][_0xc331('0x59')]);_0x148ae1[_0xc331('0x45')]=_[_0xc331('0x46')](_0x13c4e4[_0xc331('0x45')]);_0x148ae1['filters']=_[_0xc331('0x48')](_0x148ae1['model'],_0x148ae1['query']);_0x509e55[_0xc331('0x49')]=_[_0xc331('0x48')](_0x148ae1[_0xc331('0x44')],qs[_0xc331('0x4a')](_0x13c4e4[_0xc331('0x45')][_0xc331('0x4a')]));_0x509e55[_0xc331('0x49')]=_0x509e55[_0xc331('0x49')][_0xc331('0x4b')]?_0x509e55[_0xc331('0x49')]:_0x148ae1[_0xc331('0x44')];_0x509e55[_0xc331('0x4d')]=qs[_0xc331('0x4e')](_0x13c4e4[_0xc331('0x45')][_0xc331('0x4e')]);_0x509e55[_0xc331('0x4f')]=qs[_0xc331('0x47')](_[_0xc331('0x50')](_0x13c4e4[_0xc331('0x45')],_0x148ae1[_0xc331('0x47')]));if(_0x13c4e4[_0xc331('0x45')][_0xc331('0x51')]){_0x509e55['where']=_['merge'](_0x509e55[_0xc331('0x4f')],{'$or':_[_0xc331('0x3f')](_0x509e55[_0xc331('0x49')],function(_0x45a910){var _0x3a9d44={};_0x3a9d44[_0x45a910]={'$like':'%'+_0x13c4e4[_0xc331('0x45')][_0xc331('0x51')]+'%'};return _0x3a9d44;})});}_0x509e55=_[_0xc331('0x52')]({},_0x509e55,_0x13c4e4[_0xc331('0x53')]);return _0x1e3dfa[_0xc331('0x76')](_0x509e55);}})[_0xc331('0x1e')](function(_0x178e34){if(_0x178e34){_0xb4a6d2=_0x178e34['length'];if(!_0x13c4e4[_0xc331('0x45')][_0xc331('0x68')]('nolimit')){_0x509e55[_0xc331('0x2d')]=qs['limit'](_0x13c4e4['query'][_0xc331('0x2d')]);_0x509e55['offset']=qs[_0xc331('0x30')](_0x13c4e4[_0xc331('0x45')][_0xc331('0x30')]);}return _0x1e3dfa['getAgents'](_0x509e55);}})[_0xc331('0x1e')](function(_0x6eabb1){if(_0x6eabb1){return _0x6eabb1?{'count':_0xb4a6d2,'rows':_0x6eabb1}:null;}})[_0xc331('0x1e')](respondWithResult(_0x4cc94b,null))[_0xc331('0x29')](handleError(_0x4cc94b,null));};exports[_0xc331('0x78')]=function(_0x5bdfba,_0x40a9cb){var _0x87381c=_0x5bdfba[_0xc331('0x57')]['id'];var _0x4b4ba0=_0x5bdfba['body'];var _0xb6c1a8=0xc8;var _0x390692=null;return db[_0xc331('0x79')]['transaction']({'isolationLevel':db[_0xc331('0x79')][_0xc331('0x7a')][_0xc331('0x7b')][_0xc331('0x7c')]},function(_0x112623){return db[_0xc331('0x40')][_0xc331('0x6b')]({'where':{'id':_0x87381c},'transaction':_0x112623})[_0xc331('0x1e')](function(_0xc1f17d){if(_0xc1f17d){return db[_0xc331('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x87381c},'transaction':_0x112623})[_0xc331('0x1e')](function(){var _0xaef472=_[_0xc331('0x3f')](_0x4b4ba0,function(_0x20a4d9){_0x20a4d9[_0xc331('0x66')]=_0x87381c;return _0x20a4d9;});return db['WhatsappApplication'][_0xc331('0x7e')](_0xaef472,{'transaction':_0x112623});});}else{_0xb6c1a8=0x194;_0x390692=[];}});})[_0xc331('0x1e')](function(){if(_0xb6c1a8!==0x194){return db['WhatsappApplication'][_0xc331('0x7f')]({'where':{'WhatsappAccountId':_0x87381c},'order':_0xc331('0x80')})[_0xc331('0x1e')](function(_0x49bd23){_0x390692=_0x49bd23;});}})[_0xc331('0x29')](function(_0x13412b){_0xb6c1a8=0x1f4;logger[_0xc331('0x25')](_0x13412b[_0xc331('0x3a')]);if(_0x13412b[_0xc331('0x3b')]){delete _0x13412b['name'];}_0x390692=_0x13412b;})[_0xc331('0x81')](function(){if(_0x390692===null){_0x40a9cb[_0xc331('0x2a')](_0xb6c1a8);}else{if(_0xb6c1a8===0x1f4){_0x40a9cb['status'](_0xb6c1a8)[_0xc331('0x3c')](_0x390692);}else{_0x40a9cb[_0xc331('0x2b')](_0xb6c1a8)[_0xc331('0x2c')](_0x390692);}}});};exports[_0xc331('0x82')]=function(_0x4761d6,_0x503d6a,_0x297d56){var _0x5958be={};var _0x13a735={};var _0x3bfba9;var _0xdd9db0;return db[_0xc331('0x40')]['findOne']({'where':{'id':_0x4761d6['params']['id']}})[_0xc331('0x1e')](handleEntityNotFound(_0x503d6a,null))[_0xc331('0x1e')](function(_0x5bab4d){if(_0x5bab4d){_0x3bfba9=_0x5bab4d;_0x13a735['model']=_[_0xc331('0x46')](db[_0xc331('0x7d')]['rawAttributes']);_0x13a735['query']=_[_0xc331('0x46')](_0x4761d6[_0xc331('0x45')]);_0x13a735[_0xc331('0x47')]=_['intersection'](_0x13a735[_0xc331('0x44')],_0x13a735[_0xc331('0x45')]);_0x5958be['attributes']=_['intersection'](_0x13a735[_0xc331('0x44')],qs[_0xc331('0x4a')](_0x4761d6[_0xc331('0x45')][_0xc331('0x4a')]));_0x5958be['attributes']=_0x5958be['attributes'][_0xc331('0x4b')]?_0x5958be[_0xc331('0x49')]:_0x13a735[_0xc331('0x44')];_0x5958be[_0xc331('0x4d')]=qs[_0xc331('0x4e')](_0x4761d6[_0xc331('0x45')][_0xc331('0x4e')]);_0x5958be['where']=qs[_0xc331('0x47')](_[_0xc331('0x50')](_0x4761d6[_0xc331('0x45')],_0x13a735[_0xc331('0x47')]));if(_0x4761d6[_0xc331('0x45')][_0xc331('0x51')]){_0x5958be[_0xc331('0x4f')]=_[_0xc331('0x52')](_0x5958be['where'],{'$or':_[_0xc331('0x3f')](_0x5958be[_0xc331('0x49')],function(_0x12f4a8){var _0x381cb1={};_0x381cb1[_0x12f4a8]={'$like':'%'+_0x4761d6[_0xc331('0x45')]['filter']+'%'};return _0x381cb1;})});}_0x5958be=_[_0xc331('0x52')]({},_0x5958be,_0x4761d6[_0xc331('0x53')]);return _0x3bfba9[_0xc331('0x82')](_0x5958be);}})['then'](function(_0x2b70e8){if(_0x2b70e8){_0xdd9db0=_0x2b70e8[_0xc331('0x4b')];if(!_0x4761d6[_0xc331('0x45')][_0xc331('0x68')](_0xc331('0x4c'))){_0x5958be[_0xc331('0x2d')]=qs['limit'](_0x4761d6[_0xc331('0x45')][_0xc331('0x2d')]);_0x5958be[_0xc331('0x30')]=qs[_0xc331('0x30')](_0x4761d6[_0xc331('0x45')][_0xc331('0x30')]);}return _0x3bfba9[_0xc331('0x82')](_0x5958be);}})['then'](function(_0x3ccccc){if(_0x3ccccc){return _0x3ccccc?{'count':_0xdd9db0,'rows':_0x3ccccc}:null;}})[_0xc331('0x1e')](respondWithResult(_0x503d6a,null))[_0xc331('0x29')](handleError(_0x503d6a,null));};exports[_0xc331('0x83')]=function(_0x58ac36,_0x41c8c7,_0x30060b){var _0x43e069={'channel':_0xc331('0x84')};var _0x2f4fe5=[];var _0x3723b8=[];var _0x57d77b={};return db[_0xc331('0x40')][_0xc331('0x5b')]({'where':{'id':_0x58ac36[_0xc331('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xc331('0x1e')](handleEntityNotFound(_0x41c8c7,null))[_0xc331('0x1e')](function(_0x88c13c){_0x43e069['account']=_0x88c13c;if(_0x43e069[_0xc331('0x85')]&&_0x43e069[_0xc331('0x85')]['type']==='sinch'&&_0x58ac36['body'][_0xc331('0x86')]){if(_0x58ac36[_0xc331('0x63')][_0xc331('0x86')][_0xc331('0x4b')]===0x0)return;if(_0x58ac36[_0xc331('0x63')]['statuses'][0x0][_0xc331('0x87')]!==_0xc331('0x88'))return;return db[_0xc331('0x89')][_0xc331('0x35')]({'read':!![],'readAt':_0x58ac36[_0xc331('0x63')][_0xc331('0x86')][0x0][_0xc331('0x8a')]},{'where':{'messageId':_0x58ac36[_0xc331('0x63')][_0xc331('0x86')][0x0][_0xc331('0x8b')]},'individualHooks':!![]})[_0xc331('0x1e')](function(_0x34d8c3){return _0x41c8c7[_0xc331('0x2b')](0xc8)[_0xc331('0x2c')](_0x34d8c3);});}_0x43e069[_0xc331('0x8c')]=_[_0xc331('0x8d')](_0x88c13c[_0xc331('0x8e')],[_0xc331('0x80')],['asc']);if(_0x43e069[_0xc331('0x85')]['Applications']){delete _0x43e069['account'][_0xc331('0x8e')];}return db[_0xc331('0x8f')][_0xc331('0x64')]()[_0xc331('0x1e')](function(_0x669ebd){if(!_0x669ebd){throw new db[(_0xc331('0x90'))][(_0xc331('0x91'))]('no\x20available\x20attributes');}_0x2f4fe5=_['difference'](_[_0xc331('0x46')](_0x669ebd),[_0xc331('0x92'),_0xc331('0x93')]);_0x3723b8=_[_0xc331('0x94')](_[_0xc331('0x46')](_0x669ebd),[_0xc331('0x92'),_0xc331('0x93'),_0xc331('0x95'),'ListId']);_0x43e069['body']={'mapKey':_0xc331('0x96')};if(_0x43e069[_0xc331('0x85')]&&_0x43e069[_0xc331('0x85')][_0xc331('0x42')]===_0xc331('0x97')){_0x43e069[_0xc331('0x63')][_0xc331('0x98')]=_0x58ac36[_0xc331('0x63')][_0xc331('0x99')]['replace'](_0xc331('0x9a'),'');_0x43e069[_0xc331('0x63')][_0xc331('0x63')]=_0x58ac36[_0xc331('0x63')][_0xc331('0x9b')];_0x43e069[_0xc331('0x63')][_0xc331('0x9c')]=_0x58ac36['body'][_0xc331('0x9d')];}if(_0x43e069[_0xc331('0x85')]&&_0x43e069[_0xc331('0x85')][_0xc331('0x42')]==='sinch'){_0x43e069[_0xc331('0x63')][_0xc331('0x98')]=_0x58ac36[_0xc331('0x63')]['notifications'][0x0][_0xc331('0x98')];_0x43e069['body'][_0xc331('0x63')]=_0x58ac36['body'][_0xc331('0x9e')][0x0][_0xc331('0x27')][_0xc331('0x63')];_0x43e069['body'][_0xc331('0x9c')]=_0x58ac36['body'][_0xc331('0x9e')][0x0]['message_id'];}if(_0x43e069[_0xc331('0x63')]['id']){delete _0x43e069['body']['id'];}if(_[_0xc331('0x9f')](_0x43e069[_0xc331('0x63')][_0xc331('0x98')])){throw new db[(_0xc331('0x90'))]['ValidationError'](_0xc331('0xa0'));}if(_[_0xc331('0x9f')](_0x43e069['body'][_0xc331('0x63')])||_0x43e069[_0xc331('0x63')]['body']===''){throw new db[(_0xc331('0x90'))][(_0xc331('0x91'))](_0xc331('0xa1'));}if(_[_0xc331('0x9f')](_0x43e069[_0xc331('0x63')][_0xc331('0xa2')])){throw new db['Sequelize'][(_0xc331('0x91'))](_0xc331('0xa3')+_0x3723b8);}if(!_[_0xc331('0xa4')](_0x3723b8,_0x43e069[_0xc331('0x63')]['mapKey'])){throw new db[(_0xc331('0x90'))]['ValidationError'](_0xc331('0xa5')+_0x3723b8);}_0x57d77b[_0x43e069[_0xc331('0x63')]['mapKey']]=_0x43e069[_0xc331('0x63')]['from'];return db[_0xc331('0xa6')][_0xc331('0x5b')]({'where':{'id':_0x43e069[_0xc331('0x85')][_0xc331('0xa7')]},'include':[{'model':db[_0xc331('0x8f')],'as':'Contacts','where':_0x57d77b,'limit':0x1,'order':[[_0xc331('0x93'),_0xc331('0xa8')]]}]});})['then'](handleEntityNotFound(_0x41c8c7,null))['then'](function(_0x4d82e5){if(_0x4d82e5){_0x43e069[_0xc331('0xa9')]=_[_0xc331('0x6f')](_0x4d82e5,[_0xc331('0xaa')]);if(_0x4d82e5['Contacts'][_0xc331('0x4b')]){return _0x4d82e5[_0xc331('0xaa')][0x0];}var _0x2b1b37=_[_0xc331('0x19')](_0x43e069[_0xc331('0x63')],{'firstName':_0x43e069['body'][_0xc331('0x98')],'ListId':_0x4d82e5['id']});_0x2b1b37[_0x43e069[_0xc331('0x63')][_0xc331('0xa2')]]=_0x43e069[_0xc331('0x63')][_0xc331('0x98')];return db[_0xc331('0x8f')][_0xc331('0x5c')](_0x2b1b37,{'fields':_0x2f4fe5,'raw':!![]});}})[_0xc331('0x1e')](handleEntityNotFound(_0x41c8c7,null))[_0xc331('0x1e')](function(_0x164f0b){if(_0x164f0b){_0x43e069['contact']=_0x164f0b;var _0x4acefe={'ContactId':_0x164f0b['id'],'phone':_0x43e069[_0xc331('0x63')][_0xc331('0x98')],'WhatsappAccountId':_0x58ac36[_0xc331('0x57')]['id']};var _0x1342e0={'ContactId':_0x164f0b['id'],'WhatsappAccountId':_0x58ac36[_0xc331('0x57')]['id'],'closed':![]};return db[_0xc331('0xab')][_0xc331('0x5b')]({'where':_0x1342e0})['then'](function(_0x5c77be){if(_0x5c77be){return[_0x5c77be,![]];}return db['WhatsappInteraction'][_0xc331('0x5c')](_0x4acefe)[_0xc331('0x1e')](function(_0x5ec719){return[_0x5ec719,!![]];});});}})['spread'](function(_0x225d0d,_0x43da25){_0x43e069[_0xc331('0xac')]=_0x225d0d[_0xc331('0xad')]({'plain':!![]});_0x43e069[_0xc331('0xac')][_0xc331('0xae')]=![];if(_0x43da25){if(_0x43e069[_0xc331('0x85')][_0xc331('0xaf')]){_0x43e069['applications'][_0xc331('0xb0')]({'id':0x0,'priority':_0x43e069['applications'][_0xc331('0x4b')]+0x1,'app':'close','appdata':_0xc331('0xb1'),'interval':_0xc331('0xb2')});}_0x43e069[_0xc331('0xac')]['created']=!![];}return db[_0xc331('0x89')]['create']({'phone':_0x43e069[_0xc331('0x63')][_0xc331('0x98')],'messageId':_0x43e069[_0xc331('0x63')][_0xc331('0x9c')],'body':_0x43e069['body'][_0xc331('0x63')],'WhatsappAccountId':_0x58ac36['params']['id'],'WhatsappInteractionId':_0x225d0d['id'],'direction':'in','ContactId':_0x225d0d[_0xc331('0xb3')],'AttachmentId':_0x43e069[_0xc331('0x63')]['AttachmentId']});})[_0xc331('0x1e')](function(_0x449ca1){_0x43e069[_0xc331('0x27')]=_0x449ca1;if(_0x43e069[_0xc331('0xac')][_0xc331('0xb4')]){return db[_0xc331('0x77')]['find']({'attributes':['id',_0xc331('0x3b')],'where':{'id':_0x43e069['interaction'][_0xc331('0xb4')]}})['then'](function(_0x226fe1){if(_0x226fe1){_0x43e069[_0xc331('0x8c')][_0xc331('0xb5')]({'id':0x0,'priority':0x0,'app':_0xc331('0xb6'),'appdata':_0x226fe1[_0xc331('0x3b')]+','+(_0x43e069[_0xc331('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0xc331('0xb2')});}return respondWithRpcPromise(_0xc331('0xb7'),_0xc331('0xb8'),_0x43e069);});}return respondWithRpcPromise(_0xc331('0xb7'),_0xc331('0xb8'),_0x43e069);})[_0xc331('0x1e')](function(_0x466de2){if(_0x466de2){var _0x483c04=0xc8;var _0x299603='receiveMessage';logger[_0xc331('0x1f')](_0xc331('0x22'),_0x299603,_0x483c04,_0xc331('0xb9'));logger[_0xc331('0x21')](_0xc331('0xba'),_0x299603,_0x483c04,_0xc331('0xb9'),JSON['stringify'](_0x466de2));if(_0x43e069['account'][_0xc331('0x42')]===_0xc331('0x97')){return _0x41c8c7[_0xc331('0x2b')](_0x483c04)['set'](_0xc331('0xbb'),_0xc331('0xbc'))[_0xc331('0x3c')](_0xc331('0xbd'));}else{return _0x41c8c7[_0xc331('0x2b')](_0x483c04)[_0xc331('0x2c')](_0x466de2);}}});})[_0xc331('0x29')](handleError(_0x41c8c7,null));};exports[_0xc331('0x3c')]=function(_0x2a889e,_0x41626b,_0x916f2a){var _0x41fc9c,_0x3f7bb5,_0x107464;if(_[_0xc331('0x9f')](_0x2a889e[_0xc331('0x63')]['body'])||_0x2a889e[_0xc331('0x63')][_0xc331('0x63')]===''){throw new db[(_0xc331('0x90'))][(_0xc331('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc331('0x9f')](_0x2a889e['body']['to'])){throw new db[(_0xc331('0x90'))][(_0xc331('0x91'))](_0xc331('0xbe'));}_0x41fc9c=_0x2a889e[_0xc331('0x63')]['to'];return db['WhatsappAccount'][_0xc331('0x5b')]({'where':{'id':_0x2a889e[_0xc331('0x57')]['id']},'include':[{'model':db[_0xc331('0xa6')],'as':'List','include':[{'model':db[_0xc331('0x8f')],'as':_0xc331('0xaa'),'where':{'mobile':_0x41fc9c},'limit':0x1,'order':[[_0xc331('0x93'),_0xc331('0xa8')]]}]}]})[_0xc331('0x1e')](handleEntityNotFound(_0x41626b,null))[_0xc331('0x1e')](function(_0x505dd3){if(_0x505dd3&&_0x505dd3[_0xc331('0xbf')]){_0x3f7bb5=_0x505dd3[_0xc331('0xad')]({'plain':!![]});if(_0x3f7bb5[_0xc331('0xbf')]&&_0x3f7bb5[_0xc331('0xbf')]['Contacts'][_0xc331('0x4b')]){return _0x3f7bb5[_0xc331('0xbf')][_0xc331('0xaa')][0x0];}return db[_0xc331('0x8f')][_0xc331('0x5c')](_[_0xc331('0x19')](_0x2a889e[_0xc331('0x63')],{'firstName':_0x41fc9c,'mobile':_0x41fc9c,'phone':_0x41fc9c,'ListId':_0x3f7bb5[_0xc331('0xa7')]}));}})[_0xc331('0x1e')](handleEntityNotFound(_0x41626b,null))['then'](function(_0x55454e){if(_0x55454e){_0x107464=_0x55454e;return db[_0xc331('0xab')]['find']({'where':{'ContactId':_0x107464['id'],'closed':![],'WhatsappAccountId':_0x3f7bb5['id']}})[_0xc331('0x1e')](function(_0x294561){if(_0x294561){return[_0x294561,![]];}return db[_0xc331('0xab')][_0xc331('0x5c')]({'UserId':_0x2a889e[_0xc331('0x5d')]['id'],'ContactId':_0x107464['id'],'WhatsappAccountId':_0x3f7bb5['id'],'phone':_0x41fc9c,'firstMsgDirection':_0xc331('0xc0'),'Messages':[_[_0xc331('0x52')](_0x2a889e[_0xc331('0x63')],{'read':![],'body':_0x2a889e[_0xc331('0x63')][_0xc331('0x63')],'phone':_0x41fc9c,'WhatsappAccountId':_0x3f7bb5['id'],'UserId':_0x2a889e[_0xc331('0x5d')]['id'],'ContactId':_0x107464['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0xc331('0x1e')](function(_0x2a7ae6){return[_0x2a7ae6,!![]];});});}})['spread'](function(_0x244969,_0x14378b){if(_0x14378b){return _0x244969;}return db[_0xc331('0x89')][_0xc331('0x5c')](_[_0xc331('0x52')](_0x2a889e[_0xc331('0x63')],{'read':![],'body':_0x2a889e['body']['body'],'phone':_0x41fc9c,'WhatsappAccountId':_0x3f7bb5['id'],'WhatsappInteractionId':_0x244969['id'],'UserId':_0x2a889e[_0xc331('0x5d')]['id'],'ContactId':_0x107464['id']}))[_0xc331('0x1e')](function(_0x4058f8){_0x244969[_0xc331('0xc1')][_0xc331('0xc2')]=[];_0x244969['dataValues']['Messages'][_0xc331('0xb0')](_0x4058f8['dataValues']);return _0x244969;});})[_0xc331('0x1e')](respondWithResult(_0x41626b,null))[_0xc331('0x29')](handleError(_0x41626b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a051ad9..e2d6567 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 _0xfbaf=['update','remove','emit','exports','WhatsappAccount','setMaxListeners','save'];(function(_0x15f6a0,_0x5b34fc){var _0x10f8c7=function(_0x5b7d95){while(--_0x5b7d95){_0x15f6a0['push'](_0x15f6a0['shift']());}};_0x10f8c7(++_0x5b34fc);}(_0xfbaf,0xc8));var _0xffba=function(_0x5e1cdc,_0x206724){_0x5e1cdc=_0x5e1cdc-0x0;var _0x40f50f=_0xfbaf[_0x5e1cdc];return _0x40f50f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0xffba('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xffba('0x1')](0x0);var events={'afterCreate':_0xffba('0x2'),'afterUpdate':_0xffba('0x3'),'afterDestroy':_0xffba('0x4')};function emitEvent(_0x5a2e41){return function(_0x4ca24a,_0x106c61,_0xe86037){WhatsappAccountEvents[_0xffba('0x5')](_0x5a2e41+':'+_0x4ca24a['id'],_0x4ca24a);WhatsappAccountEvents['emit'](_0x5a2e41,_0x4ca24a);_0xe86037(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xffba('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x60c9=['update','remove','emit','events','setMaxListeners','save'];(function(_0x292b2c,_0x5cfd18){var _0x3eda0b=function(_0x2610fb){while(--_0x2610fb){_0x292b2c['push'](_0x292b2c['shift']());}};_0x3eda0b(++_0x5cfd18);}(_0x60c9,0x8d));var _0x960c=function(_0x341d0d,_0x20db38){_0x341d0d=_0x341d0d-0x0;var _0x2f50a1=_0x60c9[_0x341d0d];return _0x2f50a1;};'use strict';var EventEmitter=require(_0x960c('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x960c('0x1')](0x0);var events={'afterCreate':_0x960c('0x2'),'afterUpdate':_0x960c('0x3'),'afterDestroy':_0x960c('0x4')};function emitEvent(_0x534ed3){return function(_0x4429ae,_0x1e5453,_0x56d318){WhatsappAccountEvents[_0x960c('0x5')](_0x534ed3+':'+_0x4429ae['id'],_0x4429ae);WhatsappAccountEvents[_0x960c('0x5')](_0x534ed3,_0x4429ae);_0x56d318(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1a5ac8e..fccec39 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 _0x4d5a=['path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2a6885,_0x12293c){var _0x344c08=function(_0x2bf62a){while(--_0x2bf62a){_0x2a6885['push'](_0x2a6885['shift']());}};_0x344c08(++_0x12293c);}(_0x4d5a,0x132));var _0xa4d5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4d5a[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xa4d5('0x0'));var util=require(_0xa4d5('0x1'));var logger=require(_0xa4d5('0x2'))('api');var moment=require(_0xa4d5('0x3'));var BPromise=require(_0xa4d5('0x4'));var rp=require(_0xa4d5('0x5'));var fs=require('fs');var path=require(_0xa4d5('0x6'));var rimraf=require(_0xa4d5('0x7'));var config=require(_0xa4d5('0x8'));var attributes=require(_0xa4d5('0x9'));module[_0xa4d5('0xa')]=function(_0x2bf9ee,_0x3816f7){return _0x2bf9ee['define'](_0xa4d5('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5968=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','WhatsappAccount','lodash','util'];(function(_0x49574c,_0x5bfd6){var _0x2596cd=function(_0xe5e9a6){while(--_0xe5e9a6){_0x49574c['push'](_0x49574c['shift']());}};_0x2596cd(++_0x5bfd6);}(_0x5968,0x1e2));var _0x8596=function(_0x17ccd2,_0x17a784){_0x17ccd2=_0x17ccd2-0x0;var _0x594adb=_0x5968[_0x17ccd2];return _0x594adb;};'use strict';var _=require(_0x8596('0x0'));var util=require(_0x8596('0x1'));var logger=require(_0x8596('0x2'))(_0x8596('0x3'));var moment=require('moment');var BPromise=require(_0x8596('0x4'));var rp=require(_0x8596('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8596('0x6'));var config=require(_0x8596('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x8596('0x8')]=function(_0x3ab466,_0x23e0a5){return _0x3ab466[_0x8596('0x9')](_0x8596('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 6c39f70..c56c45c 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 _0xc2ab=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x37bd46,_0x2cd9de){var _0x560101=function(_0x447878){while(--_0x447878){_0x37bd46['push'](_0x37bd46['shift']());}};_0x560101(++_0x2cd9de);}(_0xc2ab,0x1cd));var _0xbc2a=function(_0x3eddab,_0x2179e6){_0x3eddab=_0x3eddab-0x0;var _0x2c6877=_0xc2ab[_0x3eddab];return _0x2c6877;};'use strict';var _=require(_0xbc2a('0x0'));var util=require(_0xbc2a('0x1'));var moment=require(_0xbc2a('0x2'));var BPromise=require(_0xbc2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc2a('0x4'));var db=require(_0xbc2a('0x5'))['db'];var utils=require(_0xbc2a('0x6'));var logger=require(_0xbc2a('0x7'))(_0xbc2a('0x8'));var config=require(_0xbc2a('0x9'));var jayson=require(_0xbc2a('0xa'));var client=jayson[_0xbc2a('0xb')][_0xbc2a('0xc')]({'port':0x232a});config[_0xbc2a('0xd')]=_['defaults'](config[_0xbc2a('0xd')],{'host':_0xbc2a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc2a('0xd')]));require('./whatsappAccount.socket')[_0xbc2a('0xf')](socket);function respondWithRpcPromise(_0x30e35f,_0x548c68,_0x20d00c){return new BPromise(function(_0x2c5f6e,_0x3a6e53){return client['request'](_0x30e35f,_0x20d00c)[_0xbc2a('0x10')](function(_0x396adf){logger[_0xbc2a('0x11')](_0xbc2a('0x12'),_0x548c68,_0xbc2a('0x13'));logger[_0xbc2a('0x14')](_0xbc2a('0x15'),_0x548c68,'request\x20sent',JSON[_0xbc2a('0x16')](_0x396adf));if(_0x396adf[_0xbc2a('0x17')]){if(_0x396adf[_0xbc2a('0x17')][_0xbc2a('0x18')]===0x1f4){logger[_0xbc2a('0x17')](_0xbc2a('0x12'),_0x548c68,_0x396adf[_0xbc2a('0x17')][_0xbc2a('0x19')]);return _0x3a6e53(_0x396adf[_0xbc2a('0x17')][_0xbc2a('0x19')]);}logger[_0xbc2a('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x548c68,_0x396adf[_0xbc2a('0x17')][_0xbc2a('0x19')]);return _0x2c5f6e(_0x396adf[_0xbc2a('0x17')]['message']);}else{logger[_0xbc2a('0x11')](_0xbc2a('0x12'),_0x548c68,_0xbc2a('0x13'));_0x2c5f6e(_0x396adf[_0xbc2a('0x1a')][_0xbc2a('0x19')]);}})[_0xbc2a('0x1b')](function(_0x5262a0){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x548c68,_0x5262a0);_0x3a6e53(_0x5262a0);});});}exports[_0xbc2a('0x1c')]=function(_0x2168f9){var _0xe7c5f3=this;return new Promise(function(_0x3f75c3,_0x113282){return db[_0xbc2a('0x1d')][_0xbc2a('0x1e')]({'raw':_0x2168f9[_0xbc2a('0x1f')]?_0x2168f9[_0xbc2a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2168f9[_0xbc2a('0x1f')]?_0x2168f9[_0xbc2a('0x1f')][_0xbc2a('0x20')]||null:null,'attributes':_0x2168f9[_0xbc2a('0x1f')]?_0x2168f9[_0xbc2a('0x1f')][_0xbc2a('0x21')]||null:null,'include':_0x2168f9[_0xbc2a('0x1f')]?_0x2168f9[_0xbc2a('0x1f')][_0xbc2a('0x22')]?_[_0xbc2a('0x23')](_0x2168f9['options']['include'],function(_0xf0b0c4){return{'model':db[_0xf0b0c4['model']],'as':_0xf0b0c4['as'],'attributes':_0xf0b0c4[_0xbc2a('0x21')],'include':_0xf0b0c4['include']?_[_0xbc2a('0x23')](_0xf0b0c4[_0xbc2a('0x22')],function(_0x3fb556){return{'model':db[_0x3fb556[_0xbc2a('0x24')]],'as':_0x3fb556['as'],'attributes':_0x3fb556['attributes'],'include':_0x3fb556['include']?_[_0xbc2a('0x23')](_0x3fb556[_0xbc2a('0x22')],function(_0xe816a2){return{'model':db[_0xe816a2[_0xbc2a('0x24')]],'as':_0xe816a2['as'],'attributes':_0xe816a2[_0xbc2a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c274c){logger[_0xbc2a('0x11')]('ShowWhatsappAccount',_0x2168f9);logger[_0xbc2a('0x14')](_0xbc2a('0x1c'),_0x2168f9,JSON[_0xbc2a('0x16')](_0x5c274c));_0x3f75c3(_0x5c274c);})['catch'](function(_0x22b273){logger['error']('ShowWhatsappAccount',_0x22b273[_0xbc2a('0x19')],_0x2168f9);_0x113282(_0xe7c5f3[_0xbc2a('0x17')](0x1f4,_0x22b273[_0xbc2a('0x19')]));});});}; \ No newline at end of file +var _0xd0ce=['../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','find','options','include','map','model','attributes','debug','util','moment','bluebird','randomstring','ioredis'];(function(_0x4ac824,_0x313c51){var _0x18895b=function(_0xe8822a){while(--_0xe8822a){_0x4ac824['push'](_0x4ac824['shift']());}};_0x18895b(++_0x313c51);}(_0xd0ce,0x166));var _0xed0c=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0xd0ce[_0x15dbca];return _0x326533;};'use strict';var _=require('lodash');var util=require(_0xed0c('0x0'));var moment=require(_0xed0c('0x1'));var BPromise=require(_0xed0c('0x2'));var rs=require(_0xed0c('0x3'));var fs=require('fs');var Redis=require(_0xed0c('0x4'));var db=require(_0xed0c('0x5'))['db'];var utils=require(_0xed0c('0x6'));var logger=require(_0xed0c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed0c('0x8')][_0xed0c('0x9')]({'port':0x232a});config['redis']=_[_0xed0c('0xa')](config[_0xed0c('0xb')],{'host':_0xed0c('0xc'),'port':0x18eb});var socket=require(_0xed0c('0xd'))(new Redis(config[_0xed0c('0xb')]));require('./whatsappAccount.socket')[_0xed0c('0xe')](socket);function respondWithRpcPromise(_0x675dac,_0x50a151,_0x1d7291){return new BPromise(function(_0x1db44a,_0x465e9a){return client['request'](_0x675dac,_0x1d7291)[_0xed0c('0xf')](function(_0x8654f2){logger[_0xed0c('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x50a151,_0xed0c('0x11'));logger['debug'](_0xed0c('0x12'),_0x50a151,_0xed0c('0x11'),JSON[_0xed0c('0x13')](_0x8654f2));if(_0x8654f2[_0xed0c('0x14')]){if(_0x8654f2[_0xed0c('0x14')][_0xed0c('0x15')]===0x1f4){logger[_0xed0c('0x14')](_0xed0c('0x16'),_0x50a151,_0x8654f2[_0xed0c('0x14')][_0xed0c('0x17')]);return _0x465e9a(_0x8654f2['error']['message']);}logger[_0xed0c('0x14')](_0xed0c('0x16'),_0x50a151,_0x8654f2[_0xed0c('0x14')]['message']);return _0x1db44a(_0x8654f2[_0xed0c('0x14')]['message']);}else{logger[_0xed0c('0x10')](_0xed0c('0x16'),_0x50a151,_0xed0c('0x11'));_0x1db44a(_0x8654f2['result'][_0xed0c('0x17')]);}})[_0xed0c('0x18')](function(_0x406263){logger[_0xed0c('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x50a151,_0x406263);_0x465e9a(_0x406263);});});}exports[_0xed0c('0x19')]=function(_0x204827){var _0x44fe40=this;return new Promise(function(_0x183319,_0x3fc13d){return db['WhatsappAccount'][_0xed0c('0x1a')]({'raw':_0x204827[_0xed0c('0x1b')]?_0x204827['options']['raw']===undefined?!![]:![]:!![],'where':_0x204827[_0xed0c('0x1b')]?_0x204827['options']['where']||null:null,'attributes':_0x204827['options']?_0x204827[_0xed0c('0x1b')]['attributes']||null:null,'include':_0x204827[_0xed0c('0x1b')]?_0x204827[_0xed0c('0x1b')][_0xed0c('0x1c')]?_[_0xed0c('0x1d')](_0x204827[_0xed0c('0x1b')][_0xed0c('0x1c')],function(_0x2d8f23){return{'model':db[_0x2d8f23[_0xed0c('0x1e')]],'as':_0x2d8f23['as'],'attributes':_0x2d8f23[_0xed0c('0x1f')],'include':_0x2d8f23[_0xed0c('0x1c')]?_['map'](_0x2d8f23[_0xed0c('0x1c')],function(_0x5379bf){return{'model':db[_0x5379bf[_0xed0c('0x1e')]],'as':_0x5379bf['as'],'attributes':_0x5379bf[_0xed0c('0x1f')],'include':_0x5379bf['include']?_[_0xed0c('0x1d')](_0x5379bf['include'],function(_0x4e0011){return{'model':db[_0x4e0011[_0xed0c('0x1e')]],'as':_0x4e0011['as'],'attributes':_0x4e0011[_0xed0c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xed0c('0xf')](function(_0x142156){logger[_0xed0c('0x10')](_0xed0c('0x19'),_0x204827);logger[_0xed0c('0x20')](_0xed0c('0x19'),_0x204827,JSON['stringify'](_0x142156));_0x183319(_0x142156);})[_0xed0c('0x18')](function(_0x95b535){logger[_0xed0c('0x14')](_0xed0c('0x19'),_0x95b535[_0xed0c('0x17')],_0x204827);_0x3fc13d(_0x44fe40[_0xed0c('0x14')](0x1f4,_0x95b535['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d59a4c4..8ad7e28 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 _0x2f72=['whatsappAccount:','./whatsappAccount.events','remove','update','removeListener','register','length'];(function(_0x27efcf,_0x320952){var _0xdb0237=function(_0x2a7389){while(--_0x2a7389){_0x27efcf['push'](_0x27efcf['shift']());}};_0xdb0237(++_0x320952);}(_0x2f72,0x9b));var _0x22f7=function(_0x437c87,_0x15c6ce){_0x437c87=_0x437c87-0x0;var _0x31293c=_0x2f72[_0x437c87];return _0x31293c;};'use strict';var WhatsappAccountEvents=require(_0x22f7('0x0'));var events=['save',_0x22f7('0x1'),_0x22f7('0x2')];function createListener(_0x451fa2,_0x43bd82){return function(_0x4104da){_0x43bd82['emit'](_0x451fa2,_0x4104da);};}function removeListener(_0x433e78,_0xcf5199){return function(){WhatsappAccountEvents[_0x22f7('0x3')](_0x433e78,_0xcf5199);};}exports[_0x22f7('0x4')]=function(_0x294edd){for(var _0x5d210b=0x0,_0x2847ef=events[_0x22f7('0x5')];_0x5d210b<_0x2847ef;_0x5d210b++){var _0x42206a=events[_0x5d210b];var _0x10e663=createListener(_0x22f7('0x6')+_0x42206a,_0x294edd);WhatsappAccountEvents['on'](_0x42206a,_0x10e663);}}; \ No newline at end of file +var _0x0174=['save','remove','update','emit','removeListener','register','length'];(function(_0x42001b,_0xbccdaa){var _0x570c09=function(_0x47e1df){while(--_0x47e1df){_0x42001b['push'](_0x42001b['shift']());}};_0x570c09(++_0xbccdaa);}(_0x0174,0xf5));var _0x4017=function(_0x3cb9e3,_0x3419b2){_0x3cb9e3=_0x3cb9e3-0x0;var _0x18fa49=_0x0174[_0x3cb9e3];return _0x18fa49;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x4017('0x0'),_0x4017('0x1'),_0x4017('0x2')];function createListener(_0x1e4b4e,_0x42c9af){return function(_0x417cdb){_0x42c9af[_0x4017('0x3')](_0x1e4b4e,_0x417cdb);};}function removeListener(_0x59a841,_0x4ed3f7){return function(){WhatsappAccountEvents[_0x4017('0x4')](_0x59a841,_0x4ed3f7);};}exports[_0x4017('0x5')]=function(_0xdf85d7){for(var _0x1108ce=0x0,_0x1533e0=events[_0x4017('0x6')];_0x1108ce<_0x1533e0;_0x1108ce++){var _0x1135a2=events[_0x1108ce];var _0x227047=createListener('whatsappAccount:'+_0x1135a2,_0xdf85d7);WhatsappAccountEvents['on'](_0x1135a2,_0x227047);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 37210c9..84cc343 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 _0x49ce=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x45ceb6,_0x2feeac){var _0xa9296d=function(_0x56d85a){while(--_0x56d85a){_0x45ceb6['push'](_0x45ceb6['shift']());}};_0xa9296d(++_0x2feeac);}(_0x49ce,0x145));var _0xe49c=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0x49ce[_0x4dda69];return _0x9014a9;};'use strict';var multer=require(_0xe49c('0x0'));var util=require(_0xe49c('0x1'));var path=require(_0xe49c('0x2'));var timeout=require(_0xe49c('0x3'));var express=require(_0xe49c('0x4'));var router=express['Router']();var fs_extra=require(_0xe49c('0x5'));var auth=require(_0xe49c('0x6'));var interaction=require(_0xe49c('0x7'));var config=require(_0xe49c('0x8'));var controller=require(_0xe49c('0x9'));router[_0xe49c('0xa')]('/',auth[_0xe49c('0xb')](),controller['index']);router[_0xe49c('0xa')](_0xe49c('0xc'),auth['isAuthenticated'](),controller[_0xe49c('0xd')]);router[_0xe49c('0xe')]('/',auth[_0xe49c('0xb')](),controller['create']);router[_0xe49c('0xf')](_0xe49c('0xc'),auth['isAuthenticated'](),controller[_0xe49c('0x10')]);router['delete'](_0xe49c('0xc'),auth[_0xe49c('0xb')](),controller[_0xe49c('0x11')]);module[_0xe49c('0x12')]=router; \ No newline at end of file +var _0xae2d=['isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x222b3f,_0x133be7){var _0x20b57a=function(_0x408ec3){while(--_0x408ec3){_0x222b3f['push'](_0x222b3f['shift']());}};_0x20b57a(++_0x133be7);}(_0xae2d,0x161));var _0xdae2=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0xae2d[_0x9fb081];return _0x43f8b0;};'use strict';var multer=require('multer');var util=require(_0xdae2('0x0'));var path=require(_0xdae2('0x1'));var timeout=require(_0xdae2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdae2('0x3'));var auth=require(_0xdae2('0x4'));var interaction=require(_0xdae2('0x5'));var config=require(_0xdae2('0x6'));var controller=require(_0xdae2('0x7'));router['get']('/',auth[_0xdae2('0x8')](),controller[_0xdae2('0x9')]);router[_0xdae2('0xa')](_0xdae2('0xb'),auth[_0xdae2('0x8')](),controller[_0xdae2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdae2('0xd')]);router[_0xdae2('0xe')](_0xdae2('0xb'),auth[_0xdae2('0x8')](),controller[_0xdae2('0xf')]);router[_0xdae2('0x10')](_0xdae2('0xb'),auth[_0xdae2('0x8')](),controller[_0xdae2('0x11')]);module[_0xdae2('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3b3282c..73d6152 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 _0x8572=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x2ee65b,_0x1386d8){var _0x220cc2=function(_0x44c66f){while(--_0x44c66f){_0x2ee65b['push'](_0x2ee65b['shift']());}};_0x220cc2(++_0x1386d8);}(_0x8572,0x1f0));var _0x2857=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8572[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x2857('0x0'));module[_0x2857('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2857('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2857('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2857('0x2')],'defaultValue':_0x2857('0x4')}}; \ No newline at end of file +var _0x1609=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x221e4e,_0x974c53){var _0x1aaf96=function(_0xb32d5e){while(--_0xb32d5e){_0x221e4e['push'](_0x221e4e['shift']());}};_0x1aaf96(++_0x974c53);}(_0x1609,0x12a));var _0x9160=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x1609[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x9160('0x0'));module[_0x9160('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9160('0x2')],'allowNull':![],'defaultValue':_0x9160('0x3')},'appdata':{'type':Sequelize[_0x9160('0x4')]()},'description':{'type':Sequelize[_0x9160('0x2')]},'interval':{'type':Sequelize[_0x9160('0x2')],'defaultValue':_0x9160('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index acd5e86..089a022 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 _0x8fcd=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','merge','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x5819ba,_0x231913){_0x5819ba=_0x5819ba-0x0;var _0x13642c=_0x8fcd[_0x5819ba];return _0x13642c;};'use strict';var emlformat=require(_0xd8fc('0x0'));var rimraf=require(_0xd8fc('0x1'));var zipdir=require(_0xd8fc('0x2'));var jsonpatch=require(_0xd8fc('0x3'));var rp=require(_0xd8fc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8fc('0x5'));var util=require(_0xd8fc('0x6'));var path=require(_0xd8fc('0x7'));var sox=require(_0xd8fc('0x8'));var csv=require(_0xd8fc('0x9'));var ejs=require(_0xd8fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8fc('0xc'));var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0x9'));var querystring=require(_0xd8fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd8fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8fc('0x10'));var logger=require(_0xd8fc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd8fc('0x12'));var licenseUtil=require(_0xd8fc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c41e9,_0x955550){_0x955550=_0x955550||0xcc;return function(_0x2b9d7e){if(_0x2b9d7e){return _0x3c41e9[_0xd8fc('0x14')](_0x955550);}return _0x3c41e9[_0xd8fc('0x15')](_0x955550)['end']();};}function respondWithResult(_0x32b375,_0x4f1064){_0x4f1064=_0x4f1064||0xc8;return function(_0x4761f){if(_0x4761f){return _0x32b375[_0xd8fc('0x15')](_0x4f1064)[_0xd8fc('0x16')](_0x4761f);}};}function respondWithFilteredResult(_0x524bac,_0x426e56){return function(_0x233c7e){if(_0x233c7e){var _0x57838b=typeof _0x426e56['offset']===_0xd8fc('0x17')&&typeof _0x426e56[_0xd8fc('0x18')]===_0xd8fc('0x17');var _0x4daf69=_0x233c7e[_0xd8fc('0x19')];var _0x1c744d=_0x57838b?0x0:_0x426e56[_0xd8fc('0x1a')];var _0x1cb0d4=_0x57838b?_0x233c7e[_0xd8fc('0x19')]:_0x426e56[_0xd8fc('0x1a')]+_0x426e56[_0xd8fc('0x18')];var _0x1d7e77;if(_0x1cb0d4>=_0x4daf69){_0x1cb0d4=_0x4daf69;_0x1d7e77=0xc8;}else{_0x1d7e77=0xce;}_0x524bac[_0xd8fc('0x15')](_0x1d7e77);return _0x524bac['set'](_0xd8fc('0x1b'),_0x1c744d+'-'+_0x1cb0d4+'/'+_0x4daf69)[_0xd8fc('0x16')](_0x233c7e);}return null;};}function patchUpdates(_0x24001d){return function(_0x3f9d57){try{jsonpatch[_0xd8fc('0x1c')](_0x3f9d57,_0x24001d,!![]);}catch(_0xd24b3f){return BPromise['reject'](_0xd24b3f);}return _0x3f9d57[_0xd8fc('0x1d')]();};}function saveUpdates(_0x3f0196,_0x5cd1f9){return function(_0x37a93b){if(_0x37a93b){return _0x37a93b['update'](_0x3f0196)[_0xd8fc('0x1e')](function(_0x370a62){return _0x370a62;});}return null;};}function removeEntity(_0x59b0ef,_0x5c852a){return function(_0x47ccff){if(_0x47ccff){return _0x47ccff[_0xd8fc('0x1f')]()[_0xd8fc('0x1e')](function(){_0x59b0ef[_0xd8fc('0x15')](0xcc)[_0xd8fc('0x20')]();});}};}function handleEntityNotFound(_0x495bd2,_0x71dcc1){return function(_0x45ac21){if(!_0x45ac21){_0x495bd2['sendStatus'](0x194);}return _0x45ac21;};}function handleError(_0x270204,_0x5e50c4){_0x5e50c4=_0x5e50c4||0x1f4;return function(_0x200a2b){logger[_0xd8fc('0x21')](_0x200a2b[_0xd8fc('0x22')]);if(_0x200a2b[_0xd8fc('0x23')]){delete _0x200a2b['name'];}_0x270204[_0xd8fc('0x15')](_0x5e50c4)['send'](_0x200a2b);};}exports[_0xd8fc('0x24')]=function(_0x1692d0,_0x4e823d){var _0x4a5383={},_0x56a980={},_0x3bec97={'count':0x0,'rows':[]};var _0x2081ca=_[_0xd8fc('0x25')](db[_0xd8fc('0x26')][_0xd8fc('0x27')],function(_0x281559){return{'name':_0x281559[_0xd8fc('0x28')],'type':_0x281559[_0xd8fc('0x29')][_0xd8fc('0x2a')]};});_0x56a980['model']=_[_0xd8fc('0x25')](_0x2081ca,_0xd8fc('0x23'));_0x56a980['query']=_[_0xd8fc('0x2b')](_0x1692d0[_0xd8fc('0x2c')]);_0x56a980[_0xd8fc('0x2d')]=_['intersection'](_0x56a980[_0xd8fc('0x2e')],_0x56a980[_0xd8fc('0x2c')]);_0x4a5383[_0xd8fc('0x2f')]=_['intersection'](_0x56a980['model'],qs['fields'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0x4a5383[_0xd8fc('0x2f')]=_0x4a5383[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0x4a5383[_0xd8fc('0x2f')]:_0x56a980[_0xd8fc('0x2e')];if(!_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x32')](_0xd8fc('0x33'))){_0x4a5383['limit']=qs[_0xd8fc('0x18')](_0x1692d0['query'][_0xd8fc('0x18')]);_0x4a5383['offset']=qs['offset'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x1a')]);}_0x4a5383[_0xd8fc('0x34')]=qs[_0xd8fc('0x35')](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x35')]);_0x4a5383['where']=qs[_0xd8fc('0x2d')](_[_0xd8fc('0x36')](_0x1692d0[_0xd8fc('0x2c')],_0x56a980['filters']),_0x2081ca);if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x37')]){_0x4a5383['where']=_['merge'](_0x4a5383[_0xd8fc('0x38')],{'$or':_['map'](_0x2081ca,function(_0x1ac864){if(_0x1ac864['type']!==_0xd8fc('0x39')){var _0x2cd726={};_0x2cd726[_0x1ac864[_0xd8fc('0x23')]]={'$like':'%'+_0x1692d0['query'][_0xd8fc('0x37')]+'%'};return _0x2cd726;}})});}_0x4a5383=_['merge']({},_0x4a5383,_0x1692d0[_0xd8fc('0x3a')]);var _0x16f411={'where':_0x4a5383['where']};return db[_0xd8fc('0x26')][_0xd8fc('0x19')](_0x16f411)[_0xd8fc('0x1e')](function(_0x17dba2){_0x3bec97['count']=_0x17dba2;if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x3b')]){_0x4a5383[_0xd8fc('0x3c')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x4a5383);})['then'](function(_0x17ffbb){_0x3bec97[_0xd8fc('0x3d')]=_0x17ffbb;return _0x3bec97;})[_0xd8fc('0x1e')](respondWithFilteredResult(_0x4e823d,_0x4a5383))[_0xd8fc('0x3e')](handleError(_0x4e823d,null));};exports['show']=function(_0x32c555,_0x145f37){var _0xaaa4b2={'raw':!![],'where':{'id':_0x32c555[_0xd8fc('0x3f')]['id']}},_0x126ff4={};_0x126ff4[_0xd8fc('0x2e')]=_[_0xd8fc('0x2b')](db['WhatsappApplication'][_0xd8fc('0x27')]);_0x126ff4[_0xd8fc('0x2c')]=_['keys'](_0x32c555[_0xd8fc('0x2c')]);_0x126ff4[_0xd8fc('0x2d')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],_0x126ff4[_0xd8fc('0x2c')]);_0xaaa4b2[_0xd8fc('0x2f')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],qs[_0xd8fc('0x30')](_0x32c555[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0xaaa4b2[_0xd8fc('0x2f')]=_0xaaa4b2[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0xaaa4b2['attributes']:_0x126ff4['model'];if(_0x32c555['query'][_0xd8fc('0x3b')]){_0xaaa4b2[_0xd8fc('0x3c')]=[{'all':!![]}];}_0xaaa4b2=_[_0xd8fc('0x41')]({},_0xaaa4b2,_0x32c555[_0xd8fc('0x3a')]);return db['WhatsappApplication'][_0xd8fc('0x42')](_0xaaa4b2)[_0xd8fc('0x1e')](handleEntityNotFound(_0x145f37,null))[_0xd8fc('0x1e')](respondWithResult(_0x145f37,null))[_0xd8fc('0x3e')](handleError(_0x145f37,null));};exports[_0xd8fc('0x43')]=function(_0x19b43e,_0xc12ace){return db['WhatsappApplication']['create'](_0x19b43e['body'],{})[_0xd8fc('0x1e')](respondWithResult(_0xc12ace,0xc9))[_0xd8fc('0x3e')](handleError(_0xc12ace,null));};exports[_0xd8fc('0x44')]=function(_0x13cd5d,_0x2dd8e0){if(_0x13cd5d[_0xd8fc('0x45')]['id']){delete _0x13cd5d[_0xd8fc('0x45')]['id'];}return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x13cd5d['params']['id']}})['then'](handleEntityNotFound(_0x2dd8e0,null))[_0xd8fc('0x1e')](saveUpdates(_0x13cd5d['body'],null))[_0xd8fc('0x1e')](respondWithResult(_0x2dd8e0,null))['catch'](handleError(_0x2dd8e0,null));};exports[_0xd8fc('0x1f')]=function(_0x3d913a,_0x57206c){return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x3d913a[_0xd8fc('0x3f')]['id']}})[_0xd8fc('0x1e')](handleEntityNotFound(_0x57206c,null))[_0xd8fc('0x1e')](removeEntity(_0x57206c,null))[_0xd8fc('0x3e')](handleError(_0x57206c,null));}; \ No newline at end of file +var _0x0755=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','findAll','show','params','includeAll','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x275ae6,_0x51d1cb){var _0x4e6bd3=function(_0x507fea){while(--_0x507fea){_0x275ae6['push'](_0x275ae6['shift']());}};_0x4e6bd3(++_0x51d1cb);}(_0x0755,0x7c));var _0x5075=function(_0xe7ded6,_0x422156){_0xe7ded6=_0xe7ded6-0x0;var _0x23312b=_0x0755[_0xe7ded6];return _0x23312b;};'use strict';var emlformat=require(_0x5075('0x0'));var rimraf=require(_0x5075('0x1'));var zipdir=require(_0x5075('0x2'));var jsonpatch=require(_0x5075('0x3'));var rp=require(_0x5075('0x4'));var moment=require(_0x5075('0x5'));var BPromise=require(_0x5075('0x6'));var Mustache=require(_0x5075('0x7'));var util=require(_0x5075('0x8'));var path=require(_0x5075('0x9'));var sox=require('sox');var csv=require(_0x5075('0xa'));var ejs=require(_0x5075('0xb'));var fs=require('fs');var fs_extra=require(_0x5075('0xc'));var _=require(_0x5075('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5075('0xe'));var toCsv=require(_0x5075('0xa'));var querystring=require('querystring');var Papa=require(_0x5075('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5075('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5075('0x11'))(_0x5075('0x12'));var utils=require(_0x5075('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5075('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c5e3,_0x1a131e){_0x1a131e=_0x1a131e||0xcc;return function(_0x413cec){if(_0x413cec){return _0x11c5e3[_0x5075('0x15')](_0x1a131e);}return _0x11c5e3[_0x5075('0x16')](_0x1a131e)[_0x5075('0x17')]();};}function respondWithResult(_0x92710a,_0x32b1a1){_0x32b1a1=_0x32b1a1||0xc8;return function(_0x339420){if(_0x339420){return _0x92710a[_0x5075('0x16')](_0x32b1a1)[_0x5075('0x18')](_0x339420);}};}function respondWithFilteredResult(_0x13e267,_0x4235cd){return function(_0x49ff22){if(_0x49ff22){var _0x128a1b=typeof _0x4235cd[_0x5075('0x19')]===_0x5075('0x1a')&&typeof _0x4235cd[_0x5075('0x1b')]===_0x5075('0x1a');var _0x57fedb=_0x49ff22[_0x5075('0x1c')];var _0xc8b69a=_0x128a1b?0x0:_0x4235cd['offset'];var _0x2159a8=_0x128a1b?_0x49ff22[_0x5075('0x1c')]:_0x4235cd[_0x5075('0x19')]+_0x4235cd[_0x5075('0x1b')];var _0x53232c;if(_0x2159a8>=_0x57fedb){_0x2159a8=_0x57fedb;_0x53232c=0xc8;}else{_0x53232c=0xce;}_0x13e267[_0x5075('0x16')](_0x53232c);return _0x13e267['set'](_0x5075('0x1d'),_0xc8b69a+'-'+_0x2159a8+'/'+_0x57fedb)['json'](_0x49ff22);}return null;};}function patchUpdates(_0x17382e){return function(_0x545364){try{jsonpatch[_0x5075('0x1e')](_0x545364,_0x17382e,!![]);}catch(_0x4c65c7){return BPromise[_0x5075('0x1f')](_0x4c65c7);}return _0x545364[_0x5075('0x20')]();};}function saveUpdates(_0x5ea539,_0x530244){return function(_0x510d4e){if(_0x510d4e){return _0x510d4e[_0x5075('0x21')](_0x5ea539)[_0x5075('0x22')](function(_0xd48fad){return _0xd48fad;});}return null;};}function removeEntity(_0x396c08,_0x1d7758){return function(_0x4e2c16){if(_0x4e2c16){return _0x4e2c16[_0x5075('0x23')]()[_0x5075('0x22')](function(){_0x396c08[_0x5075('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f16cc,_0x212438){return function(_0x57fcb5){if(!_0x57fcb5){_0x1f16cc[_0x5075('0x15')](0x194);}return _0x57fcb5;};}function handleError(_0x3b178d,_0x1340ea){_0x1340ea=_0x1340ea||0x1f4;return function(_0x38a4ea){logger['error'](_0x38a4ea['stack']);if(_0x38a4ea['name']){delete _0x38a4ea[_0x5075('0x24')];}_0x3b178d[_0x5075('0x16')](_0x1340ea)['send'](_0x38a4ea);};}exports[_0x5075('0x25')]=function(_0x36dbf7,_0x444c06){var _0x4efb14={},_0x264777={},_0x514349={'count':0x0,'rows':[]};var _0x5d3a5c=_[_0x5075('0x26')](db[_0x5075('0x27')][_0x5075('0x28')],function(_0x1102cc){return{'name':_0x1102cc['fieldName'],'type':_0x1102cc[_0x5075('0x29')][_0x5075('0x2a')]};});_0x264777[_0x5075('0x2b')]=_['map'](_0x5d3a5c,_0x5075('0x24'));_0x264777[_0x5075('0x2c')]=_[_0x5075('0x2d')](_0x36dbf7[_0x5075('0x2c')]);_0x264777['filters']=_[_0x5075('0x2e')](_0x264777[_0x5075('0x2b')],_0x264777[_0x5075('0x2c')]);_0x4efb14['attributes']=_[_0x5075('0x2e')](_0x264777[_0x5075('0x2b')],qs[_0x5075('0x2f')](_0x36dbf7[_0x5075('0x2c')][_0x5075('0x2f')]));_0x4efb14['attributes']=_0x4efb14[_0x5075('0x30')][_0x5075('0x31')]?_0x4efb14['attributes']:_0x264777[_0x5075('0x2b')];if(!_0x36dbf7['query']['hasOwnProperty']('nolimit')){_0x4efb14[_0x5075('0x1b')]=qs[_0x5075('0x1b')](_0x36dbf7[_0x5075('0x2c')]['limit']);_0x4efb14[_0x5075('0x19')]=qs['offset'](_0x36dbf7['query'][_0x5075('0x19')]);}_0x4efb14['order']=qs[_0x5075('0x32')](_0x36dbf7[_0x5075('0x2c')]['sort']);_0x4efb14[_0x5075('0x33')]=qs[_0x5075('0x34')](_[_0x5075('0x35')](_0x36dbf7['query'],_0x264777[_0x5075('0x34')]),_0x5d3a5c);if(_0x36dbf7[_0x5075('0x2c')][_0x5075('0x36')]){_0x4efb14[_0x5075('0x33')]=_[_0x5075('0x37')](_0x4efb14[_0x5075('0x33')],{'$or':_[_0x5075('0x26')](_0x5d3a5c,function(_0x1f230a){if(_0x1f230a[_0x5075('0x29')]!=='VIRTUAL'){var _0x4c9568={};_0x4c9568[_0x1f230a[_0x5075('0x24')]]={'$like':'%'+_0x36dbf7[_0x5075('0x2c')][_0x5075('0x36')]+'%'};return _0x4c9568;}})});}_0x4efb14=_[_0x5075('0x37')]({},_0x4efb14,_0x36dbf7['options']);var _0x63b935={'where':_0x4efb14[_0x5075('0x33')]};return db[_0x5075('0x27')][_0x5075('0x1c')](_0x63b935)[_0x5075('0x22')](function(_0xbb29e8){_0x514349[_0x5075('0x1c')]=_0xbb29e8;if(_0x36dbf7['query']['includeAll']){_0x4efb14['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x5075('0x38')](_0x4efb14);})[_0x5075('0x22')](function(_0x12f169){_0x514349['rows']=_0x12f169;return _0x514349;})[_0x5075('0x22')](respondWithFilteredResult(_0x444c06,_0x4efb14))['catch'](handleError(_0x444c06,null));};exports[_0x5075('0x39')]=function(_0x1e5a34,_0x1f9165){var _0x2afa26={'raw':!![],'where':{'id':_0x1e5a34[_0x5075('0x3a')]['id']}},_0x42d4b4={};_0x42d4b4['model']=_[_0x5075('0x2d')](db[_0x5075('0x27')][_0x5075('0x28')]);_0x42d4b4[_0x5075('0x2c')]=_[_0x5075('0x2d')](_0x1e5a34['query']);_0x42d4b4[_0x5075('0x34')]=_[_0x5075('0x2e')](_0x42d4b4[_0x5075('0x2b')],_0x42d4b4['query']);_0x2afa26[_0x5075('0x30')]=_[_0x5075('0x2e')](_0x42d4b4[_0x5075('0x2b')],qs[_0x5075('0x2f')](_0x1e5a34[_0x5075('0x2c')][_0x5075('0x2f')]));_0x2afa26[_0x5075('0x30')]=_0x2afa26[_0x5075('0x30')][_0x5075('0x31')]?_0x2afa26[_0x5075('0x30')]:_0x42d4b4[_0x5075('0x2b')];if(_0x1e5a34[_0x5075('0x2c')][_0x5075('0x3b')]){_0x2afa26['include']=[{'all':!![]}];}_0x2afa26=_['merge']({},_0x2afa26,_0x1e5a34[_0x5075('0x3c')]);return db['WhatsappApplication']['find'](_0x2afa26)[_0x5075('0x22')](handleEntityNotFound(_0x1f9165,null))[_0x5075('0x22')](respondWithResult(_0x1f9165,null))[_0x5075('0x3d')](handleError(_0x1f9165,null));};exports['create']=function(_0x49b9a0,_0x35f55d){return db['WhatsappApplication'][_0x5075('0x3e')](_0x49b9a0['body'],{})['then'](respondWithResult(_0x35f55d,0xc9))[_0x5075('0x3d')](handleError(_0x35f55d,null));};exports[_0x5075('0x21')]=function(_0x137e67,_0x3cbcf5){if(_0x137e67['body']['id']){delete _0x137e67[_0x5075('0x3f')]['id'];}return db[_0x5075('0x27')][_0x5075('0x40')]({'where':{'id':_0x137e67[_0x5075('0x3a')]['id']}})[_0x5075('0x22')](handleEntityNotFound(_0x3cbcf5,null))[_0x5075('0x22')](saveUpdates(_0x137e67[_0x5075('0x3f')],null))['then'](respondWithResult(_0x3cbcf5,null))[_0x5075('0x3d')](handleError(_0x3cbcf5,null));};exports['destroy']=function(_0x4d386c,_0x4113e7){return db['WhatsappApplication']['find']({'where':{'id':_0x4d386c['params']['id']}})['then'](handleEntityNotFound(_0x4113e7,null))[_0x5075('0x22')](removeEntity(_0x4113e7,null))[_0x5075('0x3d')](handleError(_0x4113e7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 6215c23..38fe809 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 _0xe015=['path','rimraf','../../config/environment','./whatsappApplication.attributes','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x4054cc,_0x57d25b){var _0x548965=function(_0x54fb07){while(--_0x54fb07){_0x4054cc['push'](_0x4054cc['shift']());}};_0x548965(++_0x57d25b);}(_0xe015,0x13b));var _0x5e01=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe015[_0x432682];return _0x463d05;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('WhatsappApplication',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e01('0x9'),'collate':_0x5e01('0xa')});}; \ No newline at end of file +var _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications'];(function(_0x361109,_0x29d5f0){var _0x283f6c=function(_0x246b07){while(--_0x246b07){_0x361109['push'](_0x361109['shift']());}};_0x283f6c(++_0x29d5f0);}(_0x0a12,0xb8));var _0x20a1=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x0a12[_0x39e84d];return _0x1991bc;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('WhatsappApplication',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 3b6fc81..dc404eb 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x367ea9,_0x290a63){var _0x5cb616=function(_0x5c9a22){while(--_0x5c9a22){_0x367ea9['push'](_0x367ea9['shift']());}};_0x5cb616(++_0x290a63);}(_0x54ef,0x112));var _0xf54e=function(_0x2f11fd,_0x7992b7){_0x2f11fd=_0x2f11fd-0x0;var _0x424ed1=_0x54ef[_0x2f11fd];return _0x424ed1;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0xe14d=['../../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','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x14a9e6,_0xbad1d4){var _0x323d21=function(_0x356f31){while(--_0x356f31){_0x14a9e6['push'](_0x14a9e6['shift']());}};_0x323d21(++_0xbad1d4);}(_0xe14d,0x1ee));var _0xde14=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe14d[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index cb848ae..cfecea7 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 _0xfd87=['index','/describe','describe','get','/:id','show','/:id/messages','/:id/download','download','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated'];(function(_0x5a645b,_0x1d42bd){var _0x4420c4=function(_0x3fad18){while(--_0x3fad18){_0x5a645b['push'](_0x5a645b['shift']());}};_0x4420c4(++_0x1d42bd);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router['get']('/',auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xc')]);router['get'](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xe')]);router[_0x7fd8('0xf')](_0x7fd8('0x10'),auth['isAuthenticated'](),controller[_0x7fd8('0x11')]);router[_0x7fd8('0xf')](_0x7fd8('0x12'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x7fd8('0x13'),auth['isAuthenticated'](),controller[_0x7fd8('0x14')]);router[_0x7fd8('0x15')]('/',auth[_0x7fd8('0xb')](),controller['create']);router[_0x7fd8('0x15')](_0x7fd8('0x12'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0x16')]);router[_0x7fd8('0x15')]('/:id/tags',auth[_0x7fd8('0xb')](),interaction[_0x7fd8('0x17')](_0x7fd8('0x18'),_0x7fd8('0x19')),controller[_0x7fd8('0x1a')]);router[_0x7fd8('0x1b')](_0x7fd8('0x10'),auth[_0x7fd8('0xb')](),interaction[_0x7fd8('0x17')](_0x7fd8('0x18'),_0x7fd8('0x1c')),controller['update']);router['delete']('/:id',auth[_0x7fd8('0xb')](),interaction[_0x7fd8('0x17')]('whatsapp',_0x7fd8('0x1d')),controller[_0x7fd8('0x1e')]);router[_0x7fd8('0x1f')](_0x7fd8('0x20'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0x21')]);module[_0x7fd8('0x22')]=router; \ No newline at end of file +var _0x0e4b=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','express','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x147b81,_0x474407){var _0x18554a=function(_0x40ed0c){while(--_0x40ed0c){_0x147b81['push'](_0x147b81['shift']());}};_0x18554a(++_0x474407);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x493a21,_0x8c32ad){_0x493a21=_0x493a21-0x0;var _0x16557d=_0x0e4b[_0x493a21];return _0x16557d;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require(_0xb0e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e4('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(_0xb0e4('0x4'));var controller=require(_0xb0e4('0x5'));router['get']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x7')]);router[_0xb0e4('0x8')](_0xb0e4('0x9'),auth[_0xb0e4('0x6')](),controller['describe']);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xb')]);router[_0xb0e4('0x8')](_0xb0e4('0xc'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xd')]);router[_0xb0e4('0x8')](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xf')]);router[_0xb0e4('0x10')]('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x11')]);router[_0xb0e4('0x10')]('/:id/messages',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x12')]);router['post'](_0xb0e4('0x13'),auth[_0xb0e4('0x6')](),interaction[_0xb0e4('0x14')](_0xb0e4('0x15'),_0xb0e4('0x16')),controller['addTags']);router['put'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),interaction['tracked'](_0xb0e4('0x15'),_0xb0e4('0x17')),controller[_0xb0e4('0x18')]);router[_0xb0e4('0x19')](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller[_0xb0e4('0x1a')]);router[_0xb0e4('0x19')](_0xb0e4('0x13'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x1b')]);module[_0xb0e4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9b345b4..b5868ac 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 _0xfb82=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x510f44,_0x401207){var _0x4c8a33=function(_0x283924){while(--_0x283924){_0x510f44['push'](_0x510f44['shift']());}};_0x4c8a33(++_0x401207);}(_0xfb82,0x17f));var _0x2fb8=function(_0x268f60,_0x24a661){_0x268f60=_0x268f60-0x0;var _0x172f4b=_0xfb82[_0x268f60];return _0x172f4b;};'use strict';var Sequelize=require(_0x2fb8('0x0'));var moment=require(_0x2fb8('0x1'));module[_0x2fb8('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2fb8('0x3')]},'disposition':{'type':Sequelize[_0x2fb8('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2fb8('0x4')]},'note':{'type':Sequelize[_0x2fb8('0x4')]},'phone':{'type':Sequelize[_0x2fb8('0x4')]},'read1stAt':{'type':Sequelize[_0x2fb8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2fb8('0x5')]('in',_0x2fb8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2fb8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2fb8('0x5')]('in',_0x2fb8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2fb8('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x3eea=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x4b6a73,_0x136ad1){var _0x1af181=function(_0x42e026){while(--_0x42e026){_0x4b6a73['push'](_0x4b6a73['shift']());}};_0x1af181(++_0x136ad1);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2ecc00,_0x1c0a1d){_0x2ecc00=_0x2ecc00-0x0;var _0x388e66=_0x3eea[_0x2ecc00];return _0x388e66;};'use strict';var Sequelize=require(_0xa3ee('0x0'));var moment=require('moment');module[_0xa3ee('0x1')]={'closed':{'type':Sequelize[_0xa3ee('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa3ee('0x3')]},'disposition':{'type':Sequelize[_0xa3ee('0x4')]},'secondDisposition':{'type':Sequelize[_0xa3ee('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa3ee('0x4')]},'note':{'type':Sequelize[_0xa3ee('0x4')]},'phone':{'type':Sequelize[_0xa3ee('0x4')]},'read1stAt':{'type':Sequelize[_0xa3ee('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa3ee('0x5')]('in',_0xa3ee('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa3ee('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index fbe9324..08d4dea 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 _0x86f8=['./whatsappInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','getOptions','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','create','body','find','describe','WhatsappMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','options','findAll','rows','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','tmp','files','format','push','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','read','Account','Owner','fullname','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','createReadStream','createWriteStream','basename','direction','out','User','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','log','unlinkSync','zip-dir','bluebird','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0x86f8,0xed));var _0x886f=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0x86f8[_0x3c6b7d];return _0x1d3ed2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x886f('0x0'));var moment=require('moment');var BPromise=require(_0x886f('0x1'));var util=require('util');var path=require('path');var ejs=require(_0x886f('0x2'));var fs=require('fs');var _=require(_0x886f('0x3'));var Redis=require(_0x886f('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x886f('0x5'));var pdf=require(_0x886f('0x6'));var logger=require(_0x886f('0x7'))(_0x886f('0x8'));var config=require(_0x886f('0x9'));var db=require(_0x886f('0xa'))['db'];config[_0x886f('0xb')]=_[_0x886f('0xc')](config['redis'],{'host':_0x886f('0xd'),'port':0x18eb});var socket=require(_0x886f('0xe'))(new Redis(config[_0x886f('0xb')]));require(_0x886f('0xf'))[_0x886f('0x10')](socket);function respondWithStatusCode(_0x3358e4,_0x5e9e45){_0x5e9e45=_0x5e9e45||0xcc;return function(_0x2447c8){if(_0x2447c8){return _0x3358e4[_0x886f('0x11')](_0x5e9e45);}return _0x3358e4['status'](_0x5e9e45)[_0x886f('0x12')]();};}function respondWithResult(_0x91e50e,_0x5c1f8c){_0x5c1f8c=_0x5c1f8c||0xc8;return function(_0x3a4521){if(_0x3a4521){return _0x91e50e[_0x886f('0x13')](_0x5c1f8c)[_0x886f('0x14')](_0x3a4521);}};}function respondWithFilteredResult(_0x533df9,_0x291056){return function(_0x2dfda3){if(_0x2dfda3){var _0x550090=typeof _0x291056[_0x886f('0x15')]==='undefined'&&typeof _0x291056[_0x886f('0x16')]===_0x886f('0x17');var _0x4ad246=_0x2dfda3[_0x886f('0x18')];var _0x41f002=_0x550090?0x0:_0x291056['offset'];var _0x4ddaeb=_0x550090?_0x2dfda3[_0x886f('0x18')]:_0x291056[_0x886f('0x15')]+_0x291056[_0x886f('0x16')];var _0x4bc944;if(_0x4ddaeb>=_0x4ad246){_0x4ddaeb=_0x4ad246;_0x4bc944=0xc8;}else{_0x4bc944=0xce;}_0x533df9[_0x886f('0x13')](_0x4bc944);return _0x533df9[_0x886f('0x19')](_0x886f('0x1a'),_0x41f002+'-'+_0x4ddaeb+'/'+_0x4ad246)[_0x886f('0x14')](_0x2dfda3);}return null;};}function saveUpdates(_0x2f7b4c){return function(_0x363ec1){if(_0x363ec1){return _0x363ec1[_0x886f('0x1b')](_0x2f7b4c)[_0x886f('0x1c')](function(_0x50003b){return _0x50003b;});}return null;};}function removeEntity(_0x2836d4){return function(_0x528570){if(_0x528570){return _0x528570[_0x886f('0x1d')]()[_0x886f('0x1c')](function(){_0x2836d4[_0x886f('0x13')](0xcc)[_0x886f('0x12')]();});}};}function handleEntityNotFound(_0x412a34){return function(_0x54a684){if(!_0x54a684){_0x412a34['sendStatus'](0x194);}return _0x54a684;};}function handleError(_0x23b99b,_0x1ab079){_0x1ab079=_0x1ab079||0x1f4;return function(_0x1f41d9){logger[_0x886f('0x1e')](_0x1f41d9[_0x886f('0x1f')]);if(_0x1f41d9['name']){delete _0x1f41d9[_0x886f('0x20')];}_0x23b99b[_0x886f('0x13')](_0x1ab079)[_0x886f('0x21')](_0x1f41d9);};}exports[_0x886f('0x22')]=function(_0x2a90f4,_0x55b0cf){var _0xf6d94d={};var _0x3a69e7=_[_0x886f('0x23')](db[_0x886f('0x24')][_0x886f('0x25')],function(_0xedd352){return{'name':_0xedd352['fieldName'],'type':_0xedd352['type']['key']};});_0xf6d94d=qs[_0x886f('0x26')](_0x3a69e7,_0x2a90f4);return interaction['findAll']('whatsapp',_0x2a90f4[_0x886f('0x27')],_0x2a90f4[_0x886f('0x28')],_0xf6d94d,_0x3a69e7)['then'](respondWithFilteredResult(_0x55b0cf,_0xf6d94d))[_0x886f('0x29')](handleError(_0x55b0cf,null));};exports[_0x886f('0x2a')]=function(_0x3dba25,_0x6eee0c){var _0x146eac={'raw':![],'where':{'id':_0x3dba25[_0x886f('0x2b')]['id']}},_0x49fbe1={};_0x49fbe1[_0x886f('0x2c')]=_[_0x886f('0x2d')](db['WhatsappInteraction'][_0x886f('0x25')]);_0x49fbe1[_0x886f('0x27')]=_['keys'](_0x3dba25[_0x886f('0x27')]);_0x49fbe1[_0x886f('0x2e')]=_[_0x886f('0x2f')](_0x49fbe1[_0x886f('0x2c')],_0x49fbe1[_0x886f('0x27')]);_0x146eac['attributes']=_[_0x886f('0x2f')](_0x49fbe1['model'],qs[_0x886f('0x30')](_0x3dba25[_0x886f('0x27')][_0x886f('0x30')]));_0x146eac[_0x886f('0x31')]=_0x146eac['attributes'][_0x886f('0x32')]?_0x146eac[_0x886f('0x31')]:_0x49fbe1[_0x886f('0x2c')];if(_0x3dba25[_0x886f('0x27')][_0x886f('0x33')]){_0x146eac[_0x886f('0x34')]=[{'all':!![]}];}_0x146eac=_[_0x886f('0x35')]({},_0x146eac,_0x3dba25['options']);return db['WhatsappInteraction']['find'](_0x146eac)[_0x886f('0x1c')](handleEntityNotFound(_0x6eee0c,null))['then'](respondWithResult(_0x6eee0c,null))[_0x886f('0x29')](handleError(_0x6eee0c,null));};exports[_0x886f('0x36')]=function(_0x3d7986,_0x495ebc){return db['WhatsappInteraction'][_0x886f('0x36')](_0x3d7986[_0x886f('0x37')],{})[_0x886f('0x1c')](respondWithResult(_0x495ebc,0xc9))['catch'](handleError(_0x495ebc,null));};exports[_0x886f('0x1b')]=function(_0x5dfd09,_0x19ef5c){if(_0x5dfd09[_0x886f('0x37')]['id']){delete _0x5dfd09[_0x886f('0x37')]['id'];}return db['WhatsappInteraction'][_0x886f('0x38')]({'where':{'id':_0x5dfd09['params']['id']}})[_0x886f('0x1c')](handleEntityNotFound(_0x19ef5c,null))[_0x886f('0x1c')](saveUpdates(_0x5dfd09[_0x886f('0x37')],null))['then'](respondWithResult(_0x19ef5c,null))[_0x886f('0x29')](handleError(_0x19ef5c,null));};exports[_0x886f('0x1d')]=function(_0x2068c,_0x301310){return db[_0x886f('0x24')][_0x886f('0x38')]({'where':{'id':_0x2068c['params']['id']}})['then'](handleEntityNotFound(_0x301310,null))[_0x886f('0x1c')](removeEntity(_0x301310,null))[_0x886f('0x29')](handleError(_0x301310,null));};exports[_0x886f('0x39')]=function(_0x421841,_0x1cc6f9){return db[_0x886f('0x24')]['describe']()[_0x886f('0x1c')](respondWithResult(_0x1cc6f9,null))[_0x886f('0x29')](handleError(_0x1cc6f9,null));};exports['addMessage']=function(_0x53917f,_0x3b79cf){return db[_0x886f('0x3a')]['find']({'where':{'id':_0x53917f[_0x886f('0x2b')]['id']}})[_0x886f('0x1c')](handleEntityNotFound(_0x3b79cf,null))[_0x886f('0x1c')](function(_0x3f1716){if(_0x3f1716){return _0x3f1716['addMessage'](_0x53917f['body']['ids'],_[_0x886f('0x3b')](_0x53917f[_0x886f('0x37')],[_0x886f('0x3c'),'id'])||{});}})[_0x886f('0x1c')](respondWithResult(_0x3b79cf,null))[_0x886f('0x29')](handleError(_0x3b79cf,null));};exports[_0x886f('0x3d')]=function(_0x14e3a6,_0x4357ea){var _0x355d90={'raw':![],'where':{}};var _0x26d329={};var _0x36fbaa={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x886f('0x3e')]({'where':{'id':_0x14e3a6[_0x886f('0x2b')]['id']}})[_0x886f('0x1c')](handleEntityNotFound(_0x4357ea,null))[_0x886f('0x1c')](function(_0x3d41bd){if(_0x3d41bd){_0x26d329[_0x886f('0x2c')]=_[_0x886f('0x2d')](db[_0x886f('0x3a')]['rawAttributes']);_0x26d329[_0x886f('0x27')]=_[_0x886f('0x2d')](_0x14e3a6[_0x886f('0x27')]);_0x26d329['filters']=_['intersection'](_0x26d329[_0x886f('0x2c')],_0x26d329['query']);_0x355d90[_0x886f('0x31')]=_['intersection'](_0x26d329[_0x886f('0x2c')],qs[_0x886f('0x30')](_0x14e3a6[_0x886f('0x27')][_0x886f('0x30')]));_0x355d90[_0x886f('0x31')]=_0x355d90[_0x886f('0x31')][_0x886f('0x32')]?_0x355d90[_0x886f('0x31')]:_0x26d329['model'];if(!_0x14e3a6[_0x886f('0x27')][_0x886f('0x3f')](_0x886f('0x40'))){_0x355d90[_0x886f('0x16')]=qs[_0x886f('0x16')](_0x14e3a6[_0x886f('0x27')][_0x886f('0x16')]);_0x355d90['offset']=qs[_0x886f('0x15')](_0x14e3a6[_0x886f('0x27')][_0x886f('0x15')]);}_0x355d90[_0x886f('0x41')]=qs['sort'](_0x14e3a6['query'][_0x886f('0x42')]);_0x355d90[_0x886f('0x43')]=qs[_0x886f('0x2e')](_[_0x886f('0x44')](_0x14e3a6[_0x886f('0x27')],_0x26d329['filters']));_0x355d90['where']['WhatsappInteractionId']=_0x3d41bd['id'];if(_0x14e3a6['query'][_0x886f('0x45')]){_0x355d90[_0x886f('0x43')]=_[_0x886f('0x35')](_0x355d90[_0x886f('0x43')],{'$or':_['map'](_0x355d90[_0x886f('0x31')],function(_0x4fc7ac){var _0x17da2d={};_0x17da2d[_0x4fc7ac]={'$like':'%'+_0x14e3a6[_0x886f('0x27')][_0x886f('0x45')]+'%'};return _0x17da2d;})});}if(_0x14e3a6[_0x886f('0x27')][_0x886f('0x46')]){var _0x5eec2d=_0x14e3a6[_0x886f('0x27')][_0x886f('0x46')][_0x886f('0x47')](',');var _0x51a190={};_0x51a190[_0x5eec2d[0x0]]={'$gte':moment(_0x5eec2d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x355d90[_0x886f('0x43')]=_['merge'](_0x355d90[_0x886f('0x43')],_0x51a190);}_0x355d90=_['merge']({},_0x355d90,_0x14e3a6[_0x886f('0x48')]);return db[_0x886f('0x3a')][_0x886f('0x18')]({'where':_0x355d90[_0x886f('0x43')]})[_0x886f('0x1c')](function(_0x3b55a9){_0x36fbaa['count']=_0x3b55a9;if(_0x14e3a6[_0x886f('0x27')][_0x886f('0x33')]){_0x355d90[_0x886f('0x34')]=[{'all':!![]}];}return db[_0x886f('0x3a')][_0x886f('0x49')](_0x355d90);})[_0x886f('0x1c')](function(_0x241c4c){_0x36fbaa[_0x886f('0x4a')]=_0x241c4c;return _0x36fbaa;});}})['then'](respondWithFilteredResult(_0x4357ea,_0x355d90))[_0x886f('0x29')](handleError(_0x4357ea,null));};exports[_0x886f('0x4b')]=function(_0x30f5aa,_0x2d4a5e){return db['WhatsappInteraction'][_0x886f('0x38')]({'where':{'id':_0x30f5aa[_0x886f('0x2b')]['id']}})[_0x886f('0x1c')](handleEntityNotFound(_0x2d4a5e,null))[_0x886f('0x1c')](function(_0x2563bb){if(_0x2563bb){return _0x2563bb[_0x886f('0x4c')](_0x30f5aa[_0x886f('0x37')][_0x886f('0x3c')],_['omit'](_0x30f5aa[_0x886f('0x37')],['ids','id'])||{})['spread'](function(){return db[_0x886f('0x4d')][_0x886f('0x49')]({'attributes':['id',_0x886f('0x20'),_0x886f('0x4e')],'where':{'id':_0x30f5aa[_0x886f('0x37')][_0x886f('0x3c')]}});})[_0x886f('0x1c')](function(_0x4f611e){socket[_0x886f('0x4f')](_0x886f('0x50'),{'id':Number(_0x30f5aa[_0x886f('0x2b')]['id']),'tags':_0x4f611e||[]});return{'id':Number(_0x30f5aa[_0x886f('0x2b')]['id']),'tags':_0x4f611e||[]};});}})[_0x886f('0x1c')](respondWithResult(_0x2d4a5e,null))[_0x886f('0x29')](handleError(_0x2d4a5e,null));};exports[_0x886f('0x51')]=function(_0x29db94,_0x55b416){return db[_0x886f('0x24')][_0x886f('0x38')]({'where':{'id':_0x29db94[_0x886f('0x2b')]['id']}})[_0x886f('0x1c')](handleEntityNotFound(_0x55b416,null))['then'](function(_0x563947){if(_0x563947){return _0x563947[_0x886f('0x51')](_0x29db94[_0x886f('0x27')][_0x886f('0x3c')]);}})[_0x886f('0x1c')](respondWithStatusCode(_0x55b416,null))[_0x886f('0x29')](handleError(_0x55b416,null));};exports[_0x886f('0x52')]=function(_0x2f22aa,_0xc07b76){var _0x1e9471=moment()['unix']()[_0x886f('0x53')]();var _0x26cf7a=path[_0x886f('0x54')](config[_0x886f('0x55')],_0x886f('0x56'),'files',_0x886f('0x57'));var _0x20b322=path['join'](config['root'],_0x886f('0x56'),_0x886f('0x58'),'attachments');var _0x34142a=path['join'](_0x26cf7a,_0x1e9471);var _0x52cab8=util[_0x886f('0x59')]('transcript-%d-%s.zip',_0x2f22aa[_0x886f('0x2b')]['id'],_0x1e9471);var _0x4fdf72=path[_0x886f('0x54')](_0x26cf7a,_0x52cab8);var _0x44ee94=[];_0x44ee94[_0x886f('0x5a')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x44ee94[_0x886f('0x5a')]({'model':db[_0x886f('0x5b')],'as':_0x886f('0x5c'),'attributes':['id',_0x886f('0x5d'),_0x886f('0x5e')],'raw':!![]});if(_0x2f22aa[_0x886f('0x27')][_0x886f('0x5f')]){_0x44ee94[_0x886f('0x5a')]({'model':db[_0x886f('0x60')],'as':_0x886f('0x60'),'raw':!![]});}var _0x13e50a=[{'model':db[_0x886f('0x3a')],'as':_0x886f('0x61'),'attributes':['id',_0x886f('0x37'),_0x886f('0x62'),'direction',_0x886f('0x63'),_0x886f('0x64')],'include':_0x44ee94}];_0x13e50a[_0x886f('0x5a')]({'model':db['WhatsappAccount'],'as':_0x886f('0x65'),'attributes':['id',_0x886f('0x20')]});_0x13e50a[_0x886f('0x5a')]({'model':db['User'],'as':_0x886f('0x66'),'attributes':['id',_0x886f('0x67')]});return db['WhatsappInteraction'][_0x886f('0x38')]({'where':{'id':_0x2f22aa[_0x886f('0x2b')]['id']},'include':_0x13e50a})[_0x886f('0x1c')](handleEntityNotFound(_0xc07b76,null))[_0x886f('0x1c')](function(_0x3589c7){if(_0x3589c7){var _0x22be2f=_0x3589c7[_0x886f('0x68')]({'plain':!![]});fs[_0x886f('0x69')](_0x34142a);var _0x12ff40={'channel':'Whatsapp','account':_0x22be2f[_0x886f('0x65')][_0x886f('0x20')],'agent':_0x22be2f[_0x886f('0x66')]?_0x22be2f[_0x886f('0x66')][_0x886f('0x67')]:_0x886f('0x6a'),'createdAt':moment(_0x22be2f['createdAt'])[_0x886f('0x59')](_0x886f('0x6b'))['toString'](),'closedAt':_0x22be2f[_0x886f('0x6c')]?moment(_0x22be2f['closedAt'])[_0x886f('0x59')](_0x886f('0x6b'))['toString']():'','disposition':_0x22be2f[_0x886f('0x6d')],'messages':_(_0x22be2f[_0x886f('0x61')])['filter']({'secret':![]})['map'](function(_0x44c312){if(_0x44c312[_0x886f('0x60')]){var _0x2a79e7=path[_0x886f('0x54')](_0x20b322,_0x44c312['Attachment']['basename']);if(fs['existsSync'](_0x2a79e7)){fs[_0x886f('0x6e')](_0x2a79e7)['pipe'](fs[_0x886f('0x6f')](path['join'](_0x34142a,_0x44c312[_0x886f('0x60')][_0x886f('0x70')])));}}return{'date':moment(_0x44c312[_0x886f('0x62')])['format'](_0x886f('0x6b'))[_0x886f('0x53')](),'sender':_0x44c312[_0x886f('0x71')]===_0x886f('0x72')?_0x44c312[_0x886f('0x73')]?_0x44c312[_0x886f('0x73')][_0x886f('0x67')]:_0x886f('0x74'):_0x44c312[_0x886f('0x5c')][_0x886f('0x5d')]+(_0x44c312['Contact'][_0x886f('0x5e')]?'\x20'+_0x44c312[_0x886f('0x5c')]['lastName']:''),'body':_0x44c312[_0x886f('0x60')]?_0x44c312[_0x886f('0x60')]['basename']:_0x44c312[_0x886f('0x37')],'direction':_0x44c312['direction']===_0x886f('0x72')?'A':'C','secret':_0x44c312[_0x886f('0x63')],'read':_0x44c312[_0x886f('0x64')],'attachment':_0x44c312[_0x886f('0x60')]};})[_0x886f('0x75')]()};return ejs[_0x886f('0x76')](path[_0x886f('0x54')](config[_0x886f('0x55')],_0x886f('0x56'),_0x886f('0x77'),_0x886f('0x78')),{'interaction':_0x12ff40})['then'](function(_0x3e3353){var _0x346057=path[_0x886f('0x54')](_0x34142a,_0x886f('0x79')+_0x22be2f['id']+'-'+_0x1e9471+_0x886f('0x7a'));var _0xdb8a69={'path':_0x346057,'channel':_0x886f('0x7b'),'interactionId':_0x22be2f['id']};return pdf['createPdfFromHTML'](_0x3e3353,_0xdb8a69);})[_0x886f('0x1c')](function(){return new BPromise(function(_0x98651d,_0x121904){zipdir(_0x34142a,{'saveTo':_0x4fdf72},function(_0x3dfa59,_0x47eb54){if(_0x3dfa59)return _0x121904(_0x3dfa59);return _0x98651d(_0x47eb54);});})[_0x886f('0x1c')](function(){return new BPromise(function(_0x4032f6,_0x3babb2){rimraf(_0x34142a,function(_0x551d63){if(_0x551d63)_0x3babb2(_0x551d63);return _0x4032f6();});});})[_0x886f('0x1c')](function(){return _0xc07b76[_0x886f('0x52')](_0x4fdf72,_0x52cab8,function(_0x38fbff){if(_0x38fbff){console[_0x886f('0x7c')]('err',_0x38fbff);}else{fs[_0x886f('0x7d')](_0x4fdf72);}});});});}else{return _0xc07b76[_0x886f('0x11')](0xc8);}})['catch'](handleError(_0xc07b76,null));}; \ No newline at end of file +var _0x8512=['./whatsappInteraction.socket','status','end','json','offset','undefined','count','limit','set','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','findAll','query','user','catch','show','WhatsappInteraction','rawAttributes','filters','intersection','model','attributes','fields','includeAll','options','find','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','keys','length','hasOwnProperty','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','include','rows','addTags','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Owner','fullname','mkdirSync','Whatsapp','Account','N.A.','toString','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x342aab,_0x5e3af0){var _0xcde178=function(_0xf57a91){while(--_0xf57a91){_0x342aab['push'](_0x342aab['shift']());}};_0xcde178(++_0x5e3af0);}(_0x8512,0x70));var _0x2851=function(_0x52c1ec,_0x402a8f){_0x52c1ec=_0x52c1ec-0x0;var _0x495ecd=_0x8512[_0x52c1ec];return _0x495ecd;};'use strict';var rimraf=require(_0x2851('0x0'));var zipdir=require(_0x2851('0x1'));var moment=require(_0x2851('0x2'));var BPromise=require(_0x2851('0x3'));var util=require(_0x2851('0x4'));var path=require(_0x2851('0x5'));var ejs=require(_0x2851('0x6'));var fs=require('fs');var _=require(_0x2851('0x7'));var Redis=require(_0x2851('0x8'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x2851('0x9'));var logger=require('../../config/logger')(_0x2851('0xa'));var config=require(_0x2851('0xb'));var db=require(_0x2851('0xc'))['db'];config[_0x2851('0xd')]=_[_0x2851('0xe')](config[_0x2851('0xd')],{'host':_0x2851('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2851('0xd')]));require(_0x2851('0x10'))['register'](socket);function respondWithStatusCode(_0x4de9dd,_0x51677a){_0x51677a=_0x51677a||0xcc;return function(_0x52f979){if(_0x52f979){return _0x4de9dd['sendStatus'](_0x51677a);}return _0x4de9dd[_0x2851('0x11')](_0x51677a)[_0x2851('0x12')]();};}function respondWithResult(_0x27c6cf,_0x830c64){_0x830c64=_0x830c64||0xc8;return function(_0x3fa23e){if(_0x3fa23e){return _0x27c6cf['status'](_0x830c64)[_0x2851('0x13')](_0x3fa23e);}};}function respondWithFilteredResult(_0x4e1720,_0x39ff36){return function(_0x5e53e5){if(_0x5e53e5){var _0x11d88f=typeof _0x39ff36[_0x2851('0x14')]===_0x2851('0x15')&&typeof _0x39ff36['limit']===_0x2851('0x15');var _0x34d5dd=_0x5e53e5[_0x2851('0x16')];var _0x12ae36=_0x11d88f?0x0:_0x39ff36[_0x2851('0x14')];var _0xacba08=_0x11d88f?_0x5e53e5[_0x2851('0x16')]:_0x39ff36[_0x2851('0x14')]+_0x39ff36[_0x2851('0x17')];var _0x3ac723;if(_0xacba08>=_0x34d5dd){_0xacba08=_0x34d5dd;_0x3ac723=0xc8;}else{_0x3ac723=0xce;}_0x4e1720[_0x2851('0x11')](_0x3ac723);return _0x4e1720[_0x2851('0x18')]('Content-Range',_0x12ae36+'-'+_0xacba08+'/'+_0x34d5dd)[_0x2851('0x13')](_0x5e53e5);}return null;};}function saveUpdates(_0x24f49c){return function(_0x20385c){if(_0x20385c){return _0x20385c[_0x2851('0x19')](_0x24f49c)[_0x2851('0x1a')](function(_0x4e2988){return _0x4e2988;});}return null;};}function removeEntity(_0x3bce50){return function(_0x211d92){if(_0x211d92){return _0x211d92[_0x2851('0x1b')]()[_0x2851('0x1a')](function(){_0x3bce50[_0x2851('0x11')](0xcc)[_0x2851('0x12')]();});}};}function handleEntityNotFound(_0x31d0a2){return function(_0x261c7e){if(!_0x261c7e){_0x31d0a2[_0x2851('0x1c')](0x194);}return _0x261c7e;};}function handleError(_0x40bf71,_0x30aeb2){_0x30aeb2=_0x30aeb2||0x1f4;return function(_0x4737fe){logger[_0x2851('0x1d')](_0x4737fe[_0x2851('0x1e')]);if(_0x4737fe[_0x2851('0x1f')]){delete _0x4737fe['name'];}_0x40bf71[_0x2851('0x11')](_0x30aeb2)[_0x2851('0x20')](_0x4737fe);};}exports[_0x2851('0x21')]=function(_0x11d690,_0x14824b){var _0x333df7={};var _0x1f1b70=_[_0x2851('0x22')](db['WhatsappInteraction']['rawAttributes'],function(_0x5e84a7){return{'name':_0x5e84a7[_0x2851('0x23')],'type':_0x5e84a7[_0x2851('0x24')][_0x2851('0x25')]};});_0x333df7=qs['getOptions'](_0x1f1b70,_0x11d690);return interaction[_0x2851('0x26')]('whatsapp',_0x11d690[_0x2851('0x27')],_0x11d690[_0x2851('0x28')],_0x333df7,_0x1f1b70)['then'](respondWithFilteredResult(_0x14824b,_0x333df7))[_0x2851('0x29')](handleError(_0x14824b,null));};exports[_0x2851('0x2a')]=function(_0x1f06dd,_0x5159d7){var _0x112c5e={'raw':![],'where':{'id':_0x1f06dd['params']['id']}},_0x1452c7={};_0x1452c7['model']=_['keys'](db[_0x2851('0x2b')][_0x2851('0x2c')]);_0x1452c7[_0x2851('0x27')]=_['keys'](_0x1f06dd['query']);_0x1452c7[_0x2851('0x2d')]=_[_0x2851('0x2e')](_0x1452c7[_0x2851('0x2f')],_0x1452c7[_0x2851('0x27')]);_0x112c5e[_0x2851('0x30')]=_[_0x2851('0x2e')](_0x1452c7[_0x2851('0x2f')],qs[_0x2851('0x31')](_0x1f06dd[_0x2851('0x27')][_0x2851('0x31')]));_0x112c5e[_0x2851('0x30')]=_0x112c5e[_0x2851('0x30')]['length']?_0x112c5e[_0x2851('0x30')]:_0x1452c7[_0x2851('0x2f')];if(_0x1f06dd[_0x2851('0x27')][_0x2851('0x32')]){_0x112c5e['include']=[{'all':!![]}];}_0x112c5e=_['merge']({},_0x112c5e,_0x1f06dd[_0x2851('0x33')]);return db[_0x2851('0x2b')][_0x2851('0x34')](_0x112c5e)['then'](handleEntityNotFound(_0x5159d7,null))[_0x2851('0x1a')](respondWithResult(_0x5159d7,null))[_0x2851('0x29')](handleError(_0x5159d7,null));};exports['create']=function(_0x36a4d4,_0x2bef3f){return db[_0x2851('0x2b')][_0x2851('0x35')](_0x36a4d4[_0x2851('0x36')],{})['then'](respondWithResult(_0x2bef3f,0xc9))[_0x2851('0x29')](handleError(_0x2bef3f,null));};exports[_0x2851('0x19')]=function(_0x2d378c,_0xaef1){if(_0x2d378c['body']['id']){delete _0x2d378c[_0x2851('0x36')]['id'];}return db[_0x2851('0x2b')][_0x2851('0x34')]({'where':{'id':_0x2d378c[_0x2851('0x37')]['id']}})['then'](handleEntityNotFound(_0xaef1,null))['then'](saveUpdates(_0x2d378c[_0x2851('0x36')],null))[_0x2851('0x1a')](respondWithResult(_0xaef1,null))[_0x2851('0x29')](handleError(_0xaef1,null));};exports['destroy']=function(_0x19c876,_0x3068c4){return db[_0x2851('0x2b')][_0x2851('0x34')]({'where':{'id':_0x19c876['params']['id']}})[_0x2851('0x1a')](handleEntityNotFound(_0x3068c4,null))[_0x2851('0x1a')](removeEntity(_0x3068c4,null))[_0x2851('0x29')](handleError(_0x3068c4,null));};exports['describe']=function(_0x233aea,_0x43b070){return db[_0x2851('0x2b')][_0x2851('0x38')]()['then'](respondWithResult(_0x43b070,null))[_0x2851('0x29')](handleError(_0x43b070,null));};exports[_0x2851('0x39')]=function(_0x2cc09c,_0xab18ef){return db[_0x2851('0x3a')][_0x2851('0x34')]({'where':{'id':_0x2cc09c[_0x2851('0x37')]['id']}})['then'](handleEntityNotFound(_0xab18ef,null))['then'](function(_0x1cb13b){if(_0x1cb13b){return _0x1cb13b[_0x2851('0x39')](_0x2cc09c[_0x2851('0x36')][_0x2851('0x3b')],_[_0x2851('0x3c')](_0x2cc09c[_0x2851('0x36')],[_0x2851('0x3b'),'id'])||{});}})[_0x2851('0x1a')](respondWithResult(_0xab18ef,null))[_0x2851('0x29')](handleError(_0xab18ef,null));};exports[_0x2851('0x3d')]=function(_0x31a357,_0x565d41){var _0x31fd6d={'raw':![],'where':{}};var _0x4e9261={};var _0x1e80ac={'count':0x0,'rows':[]};return db[_0x2851('0x2b')][_0x2851('0x3e')]({'where':{'id':_0x31a357[_0x2851('0x37')]['id']}})['then'](handleEntityNotFound(_0x565d41,null))['then'](function(_0x2f5989){if(_0x2f5989){_0x4e9261[_0x2851('0x2f')]=_[_0x2851('0x3f')](db[_0x2851('0x3a')][_0x2851('0x2c')]);_0x4e9261['query']=_[_0x2851('0x3f')](_0x31a357[_0x2851('0x27')]);_0x4e9261[_0x2851('0x2d')]=_[_0x2851('0x2e')](_0x4e9261[_0x2851('0x2f')],_0x4e9261['query']);_0x31fd6d[_0x2851('0x30')]=_[_0x2851('0x2e')](_0x4e9261[_0x2851('0x2f')],qs[_0x2851('0x31')](_0x31a357['query']['fields']));_0x31fd6d['attributes']=_0x31fd6d['attributes'][_0x2851('0x40')]?_0x31fd6d['attributes']:_0x4e9261[_0x2851('0x2f')];if(!_0x31a357[_0x2851('0x27')][_0x2851('0x41')]('nolimit')){_0x31fd6d[_0x2851('0x17')]=qs[_0x2851('0x17')](_0x31a357['query'][_0x2851('0x17')]);_0x31fd6d[_0x2851('0x14')]=qs['offset'](_0x31a357['query']['offset']);}_0x31fd6d[_0x2851('0x42')]=qs[_0x2851('0x43')](_0x31a357[_0x2851('0x27')][_0x2851('0x43')]);_0x31fd6d['where']=qs[_0x2851('0x2d')](_[_0x2851('0x44')](_0x31a357[_0x2851('0x27')],_0x4e9261[_0x2851('0x2d')]));_0x31fd6d[_0x2851('0x45')][_0x2851('0x46')]=_0x2f5989['id'];if(_0x31a357['query']['filter']){_0x31fd6d[_0x2851('0x45')]=_['merge'](_0x31fd6d[_0x2851('0x45')],{'$or':_['map'](_0x31fd6d[_0x2851('0x30')],function(_0x26903d){var _0x46e011={};_0x46e011[_0x26903d]={'$like':'%'+_0x31a357[_0x2851('0x27')][_0x2851('0x47')]+'%'};return _0x46e011;})});}if(_0x31a357[_0x2851('0x27')]['$gte']){var _0x1aa0c8=_0x31a357['query'][_0x2851('0x48')][_0x2851('0x49')](',');var _0x513cbe={};_0x513cbe[_0x1aa0c8[0x0]]={'$gte':moment(_0x1aa0c8[0x1])[_0x2851('0x4a')](_0x2851('0x4b'))};_0x31fd6d['where']=_['merge'](_0x31fd6d['where'],_0x513cbe);}_0x31fd6d=_[_0x2851('0x4c')]({},_0x31fd6d,_0x31a357['options']);return db['WhatsappMessage'][_0x2851('0x16')]({'where':_0x31fd6d[_0x2851('0x45')]})[_0x2851('0x1a')](function(_0x56e4b8){_0x1e80ac[_0x2851('0x16')]=_0x56e4b8;if(_0x31a357['query'][_0x2851('0x32')]){_0x31fd6d[_0x2851('0x4d')]=[{'all':!![]}];}return db[_0x2851('0x3a')]['findAll'](_0x31fd6d);})[_0x2851('0x1a')](function(_0x1490c6){_0x1e80ac[_0x2851('0x4e')]=_0x1490c6;return _0x1e80ac;});}})[_0x2851('0x1a')](respondWithFilteredResult(_0x565d41,_0x31fd6d))[_0x2851('0x29')](handleError(_0x565d41,null));};exports[_0x2851('0x4f')]=function(_0x172ded,_0x28abcb){return db[_0x2851('0x2b')][_0x2851('0x34')]({'where':{'id':_0x172ded[_0x2851('0x37')]['id']}})['then'](handleEntityNotFound(_0x28abcb,null))[_0x2851('0x1a')](function(_0x95f7be){if(_0x95f7be){return _0x95f7be[_0x2851('0x50')](_0x172ded[_0x2851('0x36')]['ids'],_[_0x2851('0x3c')](_0x172ded[_0x2851('0x36')],[_0x2851('0x3b'),'id'])||{})[_0x2851('0x51')](function(){return db[_0x2851('0x52')][_0x2851('0x26')]({'attributes':['id',_0x2851('0x1f'),'color'],'where':{'id':_0x172ded[_0x2851('0x36')][_0x2851('0x3b')]}});})[_0x2851('0x1a')](function(_0x20b7b4){socket['emit'](_0x2851('0x53'),{'id':Number(_0x172ded['params']['id']),'tags':_0x20b7b4||[]});return{'id':Number(_0x172ded['params']['id']),'tags':_0x20b7b4||[]};});}})[_0x2851('0x1a')](respondWithResult(_0x28abcb,null))['catch'](handleError(_0x28abcb,null));};exports[_0x2851('0x54')]=function(_0x1774d0,_0x2bb580){return db[_0x2851('0x2b')][_0x2851('0x34')]({'where':{'id':_0x1774d0[_0x2851('0x37')]['id']}})[_0x2851('0x1a')](handleEntityNotFound(_0x2bb580,null))[_0x2851('0x1a')](function(_0x2ae91a){if(_0x2ae91a){return _0x2ae91a[_0x2851('0x54')](_0x1774d0['query'][_0x2851('0x3b')]);}})[_0x2851('0x1a')](respondWithStatusCode(_0x2bb580,null))[_0x2851('0x29')](handleError(_0x2bb580,null));};exports[_0x2851('0x55')]=function(_0x50d562,_0x8fdf61){var _0x5821fd=moment()[_0x2851('0x56')]()['toString']();var _0x191965=path[_0x2851('0x57')](config[_0x2851('0x58')],_0x2851('0x59'),_0x2851('0x5a'),'tmp');var _0x13193b=path[_0x2851('0x57')](config[_0x2851('0x58')],'server',_0x2851('0x5a'),_0x2851('0x5b'));var _0x1b6bee=path[_0x2851('0x57')](_0x191965,_0x5821fd);var _0x6d3693=util[_0x2851('0x4a')]('transcript-%d-%s.zip',_0x50d562[_0x2851('0x37')]['id'],_0x5821fd);var _0x39b146=path[_0x2851('0x57')](_0x191965,_0x6d3693);var _0x3281e4=[];_0x3281e4[_0x2851('0x5c')]({'model':db[_0x2851('0x5d')],'as':_0x2851('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x3281e4[_0x2851('0x5c')]({'model':db[_0x2851('0x5e')],'as':_0x2851('0x5f'),'attributes':['id',_0x2851('0x60'),_0x2851('0x61')],'raw':!![]});if(_0x50d562['query']['attachments']){_0x3281e4[_0x2851('0x5c')]({'model':db[_0x2851('0x62')],'as':_0x2851('0x62'),'raw':!![]});}var _0x3ac660=[{'model':db[_0x2851('0x3a')],'as':_0x2851('0x63'),'attributes':['id','body',_0x2851('0x64'),_0x2851('0x65'),_0x2851('0x66'),_0x2851('0x67')],'include':_0x3281e4}];_0x3ac660[_0x2851('0x5c')]({'model':db[_0x2851('0x68')],'as':'Account','attributes':['id','name']});_0x3ac660['push']({'model':db[_0x2851('0x5d')],'as':_0x2851('0x69'),'attributes':['id',_0x2851('0x6a')]});return db[_0x2851('0x2b')][_0x2851('0x34')]({'where':{'id':_0x50d562[_0x2851('0x37')]['id']},'include':_0x3ac660})[_0x2851('0x1a')](handleEntityNotFound(_0x8fdf61,null))['then'](function(_0x520241){if(_0x520241){var _0x7a900c=_0x520241['get']({'plain':!![]});fs[_0x2851('0x6b')](_0x1b6bee);var _0x565c6f={'channel':_0x2851('0x6c'),'account':_0x7a900c[_0x2851('0x6d')][_0x2851('0x1f')],'agent':_0x7a900c[_0x2851('0x69')]?_0x7a900c['Owner']['fullname']:_0x2851('0x6e'),'createdAt':moment(_0x7a900c[_0x2851('0x64')])[_0x2851('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2851('0x6f')](),'closedAt':_0x7a900c[_0x2851('0x70')]?moment(_0x7a900c[_0x2851('0x71')])[_0x2851('0x4a')](_0x2851('0x4b'))[_0x2851('0x6f')]():'','disposition':_0x7a900c[_0x2851('0x72')],'messages':_(_0x7a900c[_0x2851('0x63')])[_0x2851('0x47')]({'secret':![]})[_0x2851('0x22')](function(_0x383d88){if(_0x383d88[_0x2851('0x62')]){var _0x7755d3=path[_0x2851('0x57')](_0x13193b,_0x383d88[_0x2851('0x62')][_0x2851('0x73')]);if(fs[_0x2851('0x74')](_0x7755d3)){fs[_0x2851('0x75')](_0x7755d3)[_0x2851('0x76')](fs[_0x2851('0x77')](path['join'](_0x1b6bee,_0x383d88[_0x2851('0x62')][_0x2851('0x73')])));}}return{'date':moment(_0x383d88['createdAt'])[_0x2851('0x4a')](_0x2851('0x4b'))[_0x2851('0x6f')](),'sender':_0x383d88[_0x2851('0x65')]===_0x2851('0x78')?_0x383d88[_0x2851('0x5d')]?_0x383d88[_0x2851('0x5d')][_0x2851('0x6a')]:'System':_0x383d88[_0x2851('0x5f')][_0x2851('0x60')]+(_0x383d88[_0x2851('0x5f')][_0x2851('0x61')]?'\x20'+_0x383d88['Contact'][_0x2851('0x61')]:''),'body':_0x383d88['Attachment']?_0x383d88[_0x2851('0x62')][_0x2851('0x73')]:_0x383d88[_0x2851('0x36')],'direction':_0x383d88['direction']===_0x2851('0x78')?'A':'C','secret':_0x383d88[_0x2851('0x66')],'read':_0x383d88[_0x2851('0x67')],'attachment':_0x383d88[_0x2851('0x62')]};})[_0x2851('0x79')]()};return ejs[_0x2851('0x7a')](path['join'](config[_0x2851('0x58')],'server',_0x2851('0x7b'),_0x2851('0x7c')),{'interaction':_0x565c6f})[_0x2851('0x1a')](function(_0x54be99){var _0x1f98c3=path['join'](_0x1b6bee,'transcript-'+_0x7a900c['id']+'-'+_0x5821fd+'.pdf');var _0x557a49={'path':_0x1f98c3,'channel':_0x2851('0x6c'),'interactionId':_0x7a900c['id']};return pdf['createPdfFromHTML'](_0x54be99,_0x557a49);})[_0x2851('0x1a')](function(){return new BPromise(function(_0x38a0e5,_0x44aea4){zipdir(_0x1b6bee,{'saveTo':_0x39b146},function(_0x152e7c,_0x5217f4){if(_0x152e7c)return _0x44aea4(_0x152e7c);return _0x38a0e5(_0x5217f4);});})[_0x2851('0x1a')](function(){return new BPromise(function(_0x47cf0a,_0x4323fc){rimraf(_0x1b6bee,function(_0x23d1ea){if(_0x23d1ea)_0x4323fc(_0x23d1ea);return _0x47cf0a();});});})[_0x2851('0x1a')](function(){return _0x8fdf61[_0x2851('0x55')](_0x39b146,_0x6d3693,function(_0x352f4c){if(_0x352f4c){console[_0x2851('0x7d')](_0x2851('0x7e'),_0x352f4c);}else{fs[_0x2851('0x7f')](_0x39b146);}});});});}else{return _0x8fdf61[_0x2851('0x1c')](0xc8);}})['catch'](handleError(_0x8fdf61,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a9ac814..834d7c9 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 _0xc737=['events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x58e8eb,_0x2ac0c7){var _0x168540=function(_0x47ad20){while(--_0x47ad20){_0x58e8eb['push'](_0x58e8eb['shift']());}};_0x168540(++_0x2ac0c7);}(_0xc737,0x154));var _0x7c73=function(_0x5aae05,_0x128e99){_0x5aae05=_0x5aae05-0x0;var _0x5a2dfd=_0xc737[_0x5aae05];return _0x5a2dfd;};'use strict';var EventEmitter=require(_0x7c73('0x0'));var WhatsappInteraction=require(_0x7c73('0x1'))['db'][_0x7c73('0x2')];var WhatsappMessage=require(_0x7c73('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7c73('0x3')](0x0);var events={'afterCreate':_0x7c73('0x4'),'afterUpdate':_0x7c73('0x5'),'afterDestroy':'remove'};function emitEvent(_0x36583e){return function(_0xe6e9b8,_0x58d01c,_0x5ad227){_0xe6e9b8[_0x7c73('0x6')]({'attributes':['id'],'raw':!![]})[_0x7c73('0x7')](function(_0x57e442){_0xe6e9b8[_0x7c73('0x8')](_0x7c73('0x9'),_0x57e442['map'](function(_0x4f73d8){return{'id':_0x4f73d8['id']};}));return WhatsappMessage[_0x7c73('0xa')]({'where':{'WhatsappInteractionId':_0xe6e9b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c73('0x7')](function(_0x378c59){_0xe6e9b8['setDataValue'](_0x7c73('0xb'),_0x378c59[_0x7c73('0xc')]);WhatsappInteractionEvents['emit'](_0x36583e+':'+_0xe6e9b8['id'],_0xe6e9b8);WhatsappInteractionEvents[_0x7c73('0xd')](_0x36583e,_0xe6e9b8);_0x5ad227(null);})['catch'](_0x5ad227(null));};}for(var e in events){if(events[_0x7c73('0xe')](e)){var event=events[e];WhatsappInteraction[_0x7c73('0xf')](e,emitEvent(event));}}module[_0x7c73('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x028d=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x20d53b,_0x32586d){var _0x46123b=function(_0x414b6d){while(--_0x414b6d){_0x20d53b['push'](_0x20d53b['shift']());}};_0x46123b(++_0x32586d);}(_0x028d,0xff));var _0xd028=function(_0x1d65c6,_0x29c4c8){_0x1d65c6=_0x1d65c6-0x0;var _0x4397b3=_0x028d[_0x1d65c6];return _0x4397b3;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd028('0x0'))['db'][_0xd028('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xd028('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd028('0x3')](0x0);var events={'afterCreate':_0xd028('0x4'),'afterUpdate':_0xd028('0x5'),'afterDestroy':_0xd028('0x6')};function emitEvent(_0x67d150){return function(_0x5094d8,_0x153af8,_0x4592fd){_0x5094d8[_0xd028('0x7')]({'attributes':['id'],'raw':!![]})[_0xd028('0x8')](function(_0x110b50){_0x5094d8[_0xd028('0x9')](_0xd028('0xa'),_0x110b50[_0xd028('0xb')](function(_0xadea4b){return{'id':_0xadea4b['id']};}));return WhatsappMessage[_0xd028('0xc')]({'where':{'WhatsappInteractionId':_0x5094d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd028('0x8')](function(_0x1211c6){_0x5094d8[_0xd028('0x9')](_0xd028('0xd'),_0x1211c6['length']);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150+':'+_0x5094d8['id'],_0x5094d8);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150,_0x5094d8);_0x4592fd(null);})[_0xd028('0xf')](_0x4592fd(null));};}for(var e in events){if(events[_0xd028('0x10')](e)){var event=events[e];WhatsappInteraction[_0xd028('0x11')](e,emitEvent(event));}}module[_0xd028('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 8eb9fe2..7d98a52 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 _0xeff5=['path','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xdf25b2,_0xcb05d0){var _0x226517=function(_0x7a41d5){while(--_0x7a41d5){_0xdf25b2['push'](_0xdf25b2['shift']());}};_0x226517(++_0xcb05d0);}(_0xeff5,0x182));var _0x5eff=function(_0x1d721d,_0x3e29e1){_0x1d721d=_0x1d721d-0x0;var _0x3859fe=_0xeff5[_0x1d721d];return _0x3859fe;};'use strict';var _=require(_0x5eff('0x0'));var util=require(_0x5eff('0x1'));var logger=require(_0x5eff('0x2'))(_0x5eff('0x3'));var moment=require(_0x5eff('0x4'));var BPromise=require(_0x5eff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5eff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5eff('0x7'));module[_0x5eff('0x8')]=function(_0xad75ca,_0x5c523d){return _0xad75ca[_0x5eff('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x5eff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11038e,_0xbcb023,_0x51ab63){if(_0x11038e['changed'](_0x5eff('0xb'))){_0x11038e[_0x5eff('0xc')]=moment()[_0x5eff('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x51ab63(null,_0x11038e);}}});}; \ No newline at end of file +var _0xd15d=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x22b8cf,_0x54a2fe){var _0x54ba21=function(_0x1067d8){while(--_0x1067d8){_0x22b8cf['push'](_0x22b8cf['shift']());}};_0x54ba21(++_0x54a2fe);}(_0xd15d,0x172));var _0xdd15=function(_0x4f5185,_0x3f5e83){_0x4f5185=_0x4f5185-0x0;var _0x4f70d8=_0xd15d[_0x4f5185];return _0x4f70d8;};'use strict';var _=require('lodash');var util=require(_0xdd15('0x0'));var logger=require(_0xdd15('0x1'))(_0xdd15('0x2'));var moment=require(_0xdd15('0x3'));var BPromise=require(_0xdd15('0x4'));var rp=require(_0xdd15('0x5'));var fs=require('fs');var path=require(_0xdd15('0x6'));var rimraf=require(_0xdd15('0x7'));var config=require(_0xdd15('0x8'));var attributes=require(_0xdd15('0x9'));module[_0xdd15('0xa')]=function(_0x30bbe8,_0x22ec81){return _0x30bbe8[_0xdd15('0xb')](_0xdd15('0xc'),attributes,{'tableName':_0xdd15('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x124f60,_0x4c536b,_0x1ffb02){if(_0x124f60[_0xdd15('0xe')](_0xdd15('0xf'))){_0x124f60['closedAt']=moment()[_0xdd15('0x10')](_0xdd15('0x11'));}_0x1ffb02(null,_0x124f60);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1f9196d..4441fe7 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 _0x0e95=['raw','attributes','limit','then','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','AddTags','debug','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','body','options'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x0e95,0x116));var _0x50e9=function(_0x27f002,_0x5a0715){_0x27f002=_0x27f002-0x0;var _0x511094=_0x0e95[_0x27f002];return _0x511094;};'use strict';var _=require('lodash');var util=require(_0x50e9('0x0'));var moment=require('moment');var BPromise=require(_0x50e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x50e9('0x2'));var logger=require(_0x50e9('0x3'))('rpc');var config=require(_0x50e9('0x4'));var jayson=require(_0x50e9('0x5'));var client=jayson[_0x50e9('0x6')][_0x50e9('0x7')]({'port':0x232a});config[_0x50e9('0x8')]=_[_0x50e9('0x9')](config[_0x50e9('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x50e9('0xa'))(new Redis(config[_0x50e9('0x8')]));require(_0x50e9('0xb'))[_0x50e9('0xc')](socket);function respondWithRpcPromise(_0x5c8fc1,_0x4fdc5,_0x38e647){return new BPromise(function(_0x3701ec,_0x5799bd){return client[_0x50e9('0xd')](_0x5c8fc1,_0x38e647)['then'](function(_0x2d415f){logger[_0x50e9('0xe')](_0x50e9('0xf'),_0x4fdc5,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4fdc5,_0x50e9('0x10'),JSON[_0x50e9('0x11')](_0x2d415f));if(_0x2d415f[_0x50e9('0x12')]){if(_0x2d415f['error'][_0x50e9('0x13')]===0x1f4){logger['error'](_0x50e9('0xf'),_0x4fdc5,_0x2d415f['error'][_0x50e9('0x14')]);return _0x5799bd(_0x2d415f[_0x50e9('0x12')][_0x50e9('0x14')]);}logger[_0x50e9('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x4fdc5,_0x2d415f[_0x50e9('0x12')][_0x50e9('0x14')]);return _0x3701ec(_0x2d415f['error'][_0x50e9('0x14')]);}else{logger[_0x50e9('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x4fdc5,_0x50e9('0x10'));_0x3701ec(_0x2d415f[_0x50e9('0x15')]['message']);}})[_0x50e9('0x16')](function(_0x3b28ab){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x4fdc5,_0x3b28ab);_0x5799bd(_0x3b28ab);});});}exports[_0x50e9('0x17')]=function(_0x1638a5){var _0x3865be=this;return new Promise(function(_0x1fa107,_0x27f751){return db['WhatsappInteraction']['update'](_0x1638a5[_0x50e9('0x18')],{'raw':_0x1638a5[_0x50e9('0x19')]?_0x1638a5[_0x50e9('0x19')][_0x50e9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1638a5[_0x50e9('0x19')]?_0x1638a5[_0x50e9('0x19')]['where']||null:null,'attributes':_0x1638a5[_0x50e9('0x19')]?_0x1638a5[_0x50e9('0x19')][_0x50e9('0x1b')]||null:null,'limit':_0x1638a5[_0x50e9('0x19')]?_0x1638a5[_0x50e9('0x19')][_0x50e9('0x1c')]||null:null})[_0x50e9('0x1d')](function(_0x347546){logger[_0x50e9('0xe')](_0x50e9('0x17'),_0x1638a5);logger['debug'](_0x50e9('0x17'),_0x1638a5,JSON['stringify'](_0x347546));_0x1fa107(_0x347546);})['catch'](function(_0x45b1eb){logger['error']('UpdateWhatsappInteraction',_0x45b1eb[_0x50e9('0x14')],_0x1638a5);_0x27f751(_0x3865be[_0x50e9('0x12')](0x1f4,_0x45b1eb[_0x50e9('0x14')]));});});};exports[_0x50e9('0x1e')]=function(_0x2c869a){return new Promise(function(_0x52bac6,_0x415af6){return db[_0x50e9('0x1f')][_0x50e9('0x20')]({'where':_0x2c869a[_0x50e9('0x19')]?_0x2c869a[_0x50e9('0x19')]['where']||null:null})[_0x50e9('0x1d')](function(_0x511deb){if(_0x511deb){return _0x511deb[_0x50e9('0x21')](_0x2c869a[_0x50e9('0x18')][_0x50e9('0x22')],_[_0x50e9('0x23')](_0x2c869a['body'],[_0x50e9('0x22'),'id'])||{});}})['spread'](function(_0x402597){logger['info'](_0x50e9('0x24'),_0x2c869a);logger[_0x50e9('0x25')](_0x50e9('0x24'),_0x2c869a,JSON[_0x50e9('0x11')](_0x402597));_0x52bac6(_0x402597);})[_0x50e9('0x16')](function(_0x2e3f0e){logger['error'](_0x50e9('0x24'),_0x2e3f0e[_0x50e9('0x14')],_0x2c869a);_0x415af6(_this[_0x50e9('0x12')](0x1f4,_0x2e3f0e[_0x50e9('0x14')]));});});}; \ No newline at end of file +var _0xb3c3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xb3c3,0xa2));var _0x3b3c=function(_0x8e4310,_0x49fda9){_0x8e4310=_0x8e4310-0x0;var _0xa9fbeb=_0xb3c3[_0x8e4310];return _0xa9fbeb;};'use strict';var _=require('lodash');var util=require(_0x3b3c('0x0'));var moment=require('moment');var BPromise=require(_0x3b3c('0x1'));var rs=require(_0x3b3c('0x2'));var fs=require('fs');var Redis=require(_0x3b3c('0x3'));var db=require(_0x3b3c('0x4'))['db'];var utils=require(_0x3b3c('0x5'));var logger=require(_0x3b3c('0x6'))(_0x3b3c('0x7'));var config=require(_0x3b3c('0x8'));var jayson=require(_0x3b3c('0x9'));var client=jayson[_0x3b3c('0xa')][_0x3b3c('0xb')]({'port':0x232a});config['redis']=_[_0x3b3c('0xc')](config[_0x3b3c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b3c('0xe'))(new Redis(config[_0x3b3c('0xd')]));require(_0x3b3c('0xf'))['register'](socket);function respondWithRpcPromise(_0x3d939e,_0x27b530,_0x2e99c1){return new BPromise(function(_0x5f21ad,_0x1b5821){return client['request'](_0x3d939e,_0x2e99c1)[_0x3b3c('0x10')](function(_0x1c754b){logger['info'](_0x3b3c('0x11'),_0x27b530,_0x3b3c('0x12'));logger[_0x3b3c('0x13')](_0x3b3c('0x14'),_0x27b530,_0x3b3c('0x12'),JSON[_0x3b3c('0x15')](_0x1c754b));if(_0x1c754b['error']){if(_0x1c754b[_0x3b3c('0x16')][_0x3b3c('0x17')]===0x1f4){logger['error'](_0x3b3c('0x11'),_0x27b530,_0x1c754b[_0x3b3c('0x16')][_0x3b3c('0x18')]);return _0x1b5821(_0x1c754b[_0x3b3c('0x16')][_0x3b3c('0x18')]);}logger[_0x3b3c('0x16')](_0x3b3c('0x11'),_0x27b530,_0x1c754b[_0x3b3c('0x16')][_0x3b3c('0x18')]);return _0x5f21ad(_0x1c754b['error']['message']);}else{logger[_0x3b3c('0x19')](_0x3b3c('0x11'),_0x27b530,'request\x20sent');_0x5f21ad(_0x1c754b[_0x3b3c('0x1a')]['message']);}})[_0x3b3c('0x1b')](function(_0x3096b9){logger[_0x3b3c('0x16')](_0x3b3c('0x11'),_0x27b530,_0x3096b9);_0x1b5821(_0x3096b9);});});}exports[_0x3b3c('0x1c')]=function(_0x3c6b80){var _0x19bcf5=this;return new Promise(function(_0x294280,_0x2db192){return db[_0x3b3c('0x1d')][_0x3b3c('0x1e')](_0x3c6b80[_0x3b3c('0x1f')],{'raw':_0x3c6b80[_0x3b3c('0x20')]?_0x3c6b80[_0x3b3c('0x20')][_0x3b3c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c6b80[_0x3b3c('0x20')]?_0x3c6b80[_0x3b3c('0x20')][_0x3b3c('0x22')]||null:null,'attributes':_0x3c6b80[_0x3b3c('0x20')]?_0x3c6b80[_0x3b3c('0x20')]['attributes']||null:null,'limit':_0x3c6b80[_0x3b3c('0x20')]?_0x3c6b80[_0x3b3c('0x20')][_0x3b3c('0x23')]||null:null})[_0x3b3c('0x10')](function(_0x26ea94){logger[_0x3b3c('0x19')](_0x3b3c('0x1c'),_0x3c6b80);logger[_0x3b3c('0x13')](_0x3b3c('0x1c'),_0x3c6b80,JSON[_0x3b3c('0x15')](_0x26ea94));_0x294280(_0x26ea94);})['catch'](function(_0x54c5d0){logger[_0x3b3c('0x16')]('UpdateWhatsappInteraction',_0x54c5d0[_0x3b3c('0x18')],_0x3c6b80);_0x2db192(_0x19bcf5[_0x3b3c('0x16')](0x1f4,_0x54c5d0['message']));});});};exports[_0x3b3c('0x24')]=function(_0x5c3abc){return new Promise(function(_0x3f6001,_0x11f135){return db[_0x3b3c('0x1d')][_0x3b3c('0x25')]({'where':_0x5c3abc[_0x3b3c('0x20')]?_0x5c3abc['options'][_0x3b3c('0x22')]||null:null})['then'](function(_0x4555d5){if(_0x4555d5){return _0x4555d5['addTags'](_0x5c3abc[_0x3b3c('0x1f')][_0x3b3c('0x26')],_[_0x3b3c('0x27')](_0x5c3abc[_0x3b3c('0x1f')],[_0x3b3c('0x26'),'id'])||{});}})[_0x3b3c('0x28')](function(_0x49be46){logger[_0x3b3c('0x19')]('AddTags',_0x5c3abc);logger[_0x3b3c('0x13')](_0x3b3c('0x29'),_0x5c3abc,JSON['stringify'](_0x49be46));_0x3f6001(_0x49be46);})['catch'](function(_0x261cad){logger[_0x3b3c('0x16')](_0x3b3c('0x29'),_0x261cad['message'],_0x5c3abc);_0x11f135(_this['error'](0x1f4,_0x261cad['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 0c1073e..ae53907 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 _0x654b=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x361bd6,_0x3c03ee){var _0x56956f=function(_0xe37e03){while(--_0xe37e03){_0x361bd6['push'](_0x361bd6['shift']());}};_0x56956f(++_0x3c03ee);}(_0x654b,0xcc));var _0xb654=function(_0x236906,_0x1c2803){_0x236906=_0x236906-0x0;var _0x21199e=_0x654b[_0x236906];return _0x21199e;};'use strict';var WhatsappInteractionEvents=require(_0xb654('0x0'));var events=[_0xb654('0x1'),_0xb654('0x2'),_0xb654('0x3')];function createListener(_0x6395c5,_0x5acfa4){return function(_0x1075de){_0x5acfa4[_0xb654('0x4')](_0x6395c5,_0x1075de);};}function removeListener(_0x437536,_0x568cde){return function(){WhatsappInteractionEvents[_0xb654('0x5')](_0x437536,_0x568cde);};}exports[_0xb654('0x6')]=function(_0x2c912e){for(var _0x25da29=0x0,_0x1212c0=events[_0xb654('0x7')];_0x25da29<_0x1212c0;_0x25da29++){var _0x295ecc=events[_0x25da29];var _0x1fe245=createListener(_0xb654('0x8')+_0x295ecc,_0x2c912e);WhatsappInteractionEvents['on'](_0x295ecc,_0x1fe245);}}; \ No newline at end of file +var _0x52fb=['length','whatsappInteraction:','save','remove','update','register'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x52fb,0x9e));var _0xb52f=function(_0x538480,_0x471f12){_0x538480=_0x538480-0x0;var _0x2cda49=_0x52fb[_0x538480];return _0x2cda49;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xb52f('0x0'),_0xb52f('0x1'),_0xb52f('0x2')];function createListener(_0x5c8938,_0xdbc3c0){return function(_0x11428f){_0xdbc3c0['emit'](_0x5c8938,_0x11428f);};}function removeListener(_0x5896a6,_0x2c4f30){return function(){WhatsappInteractionEvents['removeListener'](_0x5896a6,_0x2c4f30);};}exports[_0xb52f('0x3')]=function(_0x26b049){for(var _0x33a985=0x0,_0x49b950=events[_0xb52f('0x4')];_0x33a985<_0x49b950;_0x33a985++){var _0x42b10c=events[_0x33a985];var _0x21196a=createListener(_0xb52f('0x5')+_0x42b10c,_0x26b049);WhatsappInteractionEvents['on'](_0x42b10c,_0x21196a);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 62582a5..139631a 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 _0xaafc=['reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0xcc376e,_0x427228){var _0x39fb84=function(_0xebc24){while(--_0xebc24){_0xcc376e['push'](_0xcc376e['shift']());}};_0x39fb84(++_0x427228);}(_0xaafc,0x143));var _0xcaaf=function(_0x4b6a12,_0x48aca0){_0x4b6a12=_0x4b6a12-0x0;var _0x4e1847=_0xaafc[_0x4b6a12];return _0x4e1847;};'use strict';var multer=require('multer');var util=require(_0xcaaf('0x0'));var path=require(_0xcaaf('0x1'));var timeout=require(_0xcaaf('0x2'));var express=require(_0xcaaf('0x3'));var router=express[_0xcaaf('0x4')]();var fs_extra=require(_0xcaaf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcaaf('0x6'));var config=require(_0xcaaf('0x7'));var controller=require(_0xcaaf('0x8'));router[_0xcaaf('0x9')]('/',auth[_0xcaaf('0xa')](),controller[_0xcaaf('0xb')]);router[_0xcaaf('0x9')](_0xcaaf('0xc'),auth[_0xcaaf('0xa')](),controller['describe']);router[_0xcaaf('0x9')](_0xcaaf('0xd'),auth[_0xcaaf('0xa')](),controller[_0xcaaf('0xe')]);router[_0xcaaf('0xf')]('/',auth['isAuthenticated'](),interaction[_0xcaaf('0x10')]('whatsapp',_0xcaaf('0x11')),controller['create']);router[_0xcaaf('0xf')](_0xcaaf('0x12'),controller[_0xcaaf('0x13')]);router[_0xcaaf('0x14')]('/:id',auth[_0xcaaf('0xa')](),controller[_0xcaaf('0x15')]);router['put'](_0xcaaf('0x16'),auth[_0xcaaf('0xa')](),controller[_0xcaaf('0x17')]);router[_0xcaaf('0x14')](_0xcaaf('0x18'),auth[_0xcaaf('0xa')](),controller[_0xcaaf('0x19')]);router[_0xcaaf('0x1a')](_0xcaaf('0xd'),auth[_0xcaaf('0xa')](),controller[_0xcaaf('0x1b')]);module[_0xcaaf('0x1c')]=router; \ No newline at end of file +var _0xe05d=['reject','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','post','tracked','whatsapp','create','status','put','update','/:id/accept','accept'];(function(_0x1d243b,_0x16e3a9){var _0x2e40e2=function(_0x453a9a){while(--_0x453a9a){_0x1d243b['push'](_0x1d243b['shift']());}};_0x2e40e2(++_0x16e3a9);}(_0xe05d,0x106));var _0xde05=function(_0x325aa2,_0x29bd7f){_0x325aa2=_0x325aa2-0x0;var _0x451a67=_0xe05d[_0x325aa2];return _0x451a67;};'use strict';var multer=require(_0xde05('0x0'));var util=require(_0xde05('0x1'));var path=require(_0xde05('0x2'));var timeout=require(_0xde05('0x3'));var express=require(_0xde05('0x4'));var router=express[_0xde05('0x5')]();var fs_extra=require(_0xde05('0x6'));var auth=require(_0xde05('0x7'));var interaction=require(_0xde05('0x8'));var config=require(_0xde05('0x9'));var controller=require(_0xde05('0xa'));router[_0xde05('0xb')]('/',auth[_0xde05('0xc')](),controller['index']);router[_0xde05('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xde05('0xd')]);router[_0xde05('0xb')](_0xde05('0xe'),auth[_0xde05('0xc')](),controller['show']);router[_0xde05('0xf')]('/',auth[_0xde05('0xc')](),interaction[_0xde05('0x10')](_0xde05('0x11'),'whatsappmessage:create'),controller[_0xde05('0x12')]);router['post']('/:id/status',controller[_0xde05('0x13')]);router[_0xde05('0x14')](_0xde05('0xe'),auth[_0xde05('0xc')](),controller[_0xde05('0x15')]);router[_0xde05('0x14')](_0xde05('0x16'),auth['isAuthenticated'](),controller[_0xde05('0x17')]);router[_0xde05('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xde05('0x18')]);router[_0xde05('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 04ff4e6..e768706 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 _0x5e3c=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x5aed32,_0x2a5832){var _0x4d897f=function(_0x4486cc){while(--_0x4486cc){_0x5aed32['push'](_0x5aed32['shift']());}};_0x4d897f(++_0x2a5832);}(_0x5e3c,0x16b));var _0xc5e3=function(_0x58baf9,_0x175ba5){_0x58baf9=_0x58baf9-0x0;var _0x5f4471=_0x5e3c[_0x58baf9];return _0x5f4471;};'use strict';var Sequelize=require(_0xc5e3('0x0'));module[_0xc5e3('0x1')]={'body':{'type':Sequelize[_0xc5e3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc5e3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc5e3('0x4')]('in','out'),'defaultValue':_0xc5e3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc5e3('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc5e3('0x6')]},'readAt':{'type':Sequelize[_0xc5e3('0x7')]},'secret':{'type':Sequelize[_0xc5e3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc5e3('0x2')]}}; \ No newline at end of file +var _0x9ffb=['exports','BOOLEAN','out','STRING','DATE','TEXT'];(function(_0xa2c790,_0x2d889b){var _0x2ea206=function(_0x105c9e){while(--_0x105c9e){_0xa2c790['push'](_0xa2c790['shift']());}};_0x2ea206(++_0x2d889b);}(_0x9ffb,0xde));var _0xb9ff=function(_0x475d44,_0x354e06){_0x475d44=_0x475d44-0x0;var _0x2bf64a=_0x9ffb[_0x475d44];return _0x2bf64a;};'use strict';var Sequelize=require('sequelize');module[_0xb9ff('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb9ff('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xb9ff('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb9ff('0x3')](0xbe)},'phone':{'type':Sequelize[_0xb9ff('0x3')]},'readAt':{'type':Sequelize[_0xb9ff('0x4')]},'secret':{'type':Sequelize[_0xb9ff('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb9ff('0x3')]},'providerResponse':{'type':Sequelize[_0xb9ff('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c06bedf..f6b378e 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 _0x6486=['undefined','limit','count','set','Content-Range','save','update','destroy','index','WhatsappMessage','rawAttributes','fieldName','key','map','name','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','AcceptMessage','acceptMessage','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','null','RejectMessage','rejectMessage','ContactId','sequelize','WhatsappAccount','debug','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset'];(function(_0x5d76cc,_0x195736){var _0x4acce4=function(_0x3b889d){while(--_0x3b889d){_0x5d76cc['push'](_0x5d76cc['shift']());}};_0x4acce4(++_0x195736);}(_0x6486,0x1e8));var _0x6648=function(_0x5e4cc1,_0x5af8ab){_0x5e4cc1=_0x5e4cc1-0x0;var _0x5f4c56=_0x6486[_0x5e4cc1];return _0x5f4c56;};'use strict';var emlformat=require(_0x6648('0x0'));var rimraf=require(_0x6648('0x1'));var zipdir=require(_0x6648('0x2'));var jsonpatch=require(_0x6648('0x3'));var rp=require(_0x6648('0x4'));var moment=require(_0x6648('0x5'));var BPromise=require(_0x6648('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6648('0x7'));var csv=require(_0x6648('0x8'));var ejs=require(_0x6648('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6648('0xa'));var squel=require('squel');var crypto=require(_0x6648('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6648('0xc'));var toCsv=require(_0x6648('0x8'));var querystring=require(_0x6648('0xd'));var Papa=require(_0x6648('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6648('0xf'));var as=require(_0x6648('0x10'));var hardwareService=require(_0x6648('0x11'));var logger=require(_0x6648('0x12'))(_0x6648('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6648('0x14'));var db=require(_0x6648('0x15'))['db'];config['redis']=_['defaults'](config[_0x6648('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x6648('0x17'))(new Redis(config[_0x6648('0x16')]));require(_0x6648('0x18'))[_0x6648('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6648('0x1a')][_0x6648('0x1b')]({'port':0x232c});var client9002=jayson[_0x6648('0x1a')][_0x6648('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x263088,_0x49aca8,_0x331145,_0x407814){return new BPromise(function(_0x5a29b8,_0x17221c){var _0xba6528=_0x407814||client;return _0xba6528[_0x6648('0x1c')](_0x263088,_0x331145)[_0x6648('0x1d')](function(_0x5ee248){logger[_0x6648('0x1e')](_0x6648('0x1f'),_0x49aca8,_0x6648('0x20'));logger['debug'](_0x6648('0x21'),_0x49aca8,_0x6648('0x20'),JSON[_0x6648('0x22')](_0x5ee248));if(_0x5ee248[_0x6648('0x23')]){if(_0x5ee248['error']['code']===0x1f4){logger[_0x6648('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x49aca8,_0x5ee248[_0x6648('0x23')][_0x6648('0x24')]);return _0x17221c(_0x5ee248[_0x6648('0x23')]['message']);}logger[_0x6648('0x23')](_0x6648('0x1f'),_0x49aca8,_0x5ee248['error'][_0x6648('0x24')]);return _0x5a29b8(_0x5ee248[_0x6648('0x23')][_0x6648('0x24')]);}else{logger[_0x6648('0x1e')](_0x6648('0x1f'),_0x49aca8,_0x6648('0x20'));_0x5a29b8(_0x5ee248[_0x6648('0x25')][_0x6648('0x24')]);}})[_0x6648('0x26')](function(_0x3b02b7){logger[_0x6648('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x49aca8,_0x3b02b7);_0x17221c(_0x3b02b7);});});}function respondWithStatusCode(_0x50036e,_0x474b0d){_0x474b0d=_0x474b0d||0xcc;return function(_0x127b82){if(_0x127b82){return _0x50036e[_0x6648('0x27')](_0x474b0d);}return _0x50036e[_0x6648('0x28')](_0x474b0d)[_0x6648('0x29')]();};}function respondWithResult(_0x31115a,_0xacd8d0){_0xacd8d0=_0xacd8d0||0xc8;return function(_0x4639ac){if(_0x4639ac){return _0x31115a[_0x6648('0x28')](_0xacd8d0)[_0x6648('0x2a')](_0x4639ac);}};}function respondWithFilteredResult(_0x47219d,_0x410d13){return function(_0x459ac9){if(_0x459ac9){var _0x180740=typeof _0x410d13[_0x6648('0x2b')]===_0x6648('0x2c')&&typeof _0x410d13[_0x6648('0x2d')]===_0x6648('0x2c');var _0x301d95=_0x459ac9[_0x6648('0x2e')];var _0x52c47d=_0x180740?0x0:_0x410d13[_0x6648('0x2b')];var _0x719f04=_0x180740?_0x459ac9[_0x6648('0x2e')]:_0x410d13[_0x6648('0x2b')]+_0x410d13[_0x6648('0x2d')];var _0x1596fb;if(_0x719f04>=_0x301d95){_0x719f04=_0x301d95;_0x1596fb=0xc8;}else{_0x1596fb=0xce;}_0x47219d[_0x6648('0x28')](_0x1596fb);return _0x47219d[_0x6648('0x2f')](_0x6648('0x30'),_0x52c47d+'-'+_0x719f04+'/'+_0x301d95)[_0x6648('0x2a')](_0x459ac9);}return null;};}function patchUpdates(_0xd8d20a){return function(_0x2cc77e){try{jsonpatch['apply'](_0x2cc77e,_0xd8d20a,!![]);}catch(_0x4bcae1){return BPromise['reject'](_0x4bcae1);}return _0x2cc77e[_0x6648('0x31')]();};}function saveUpdates(_0x2474d4,_0x2aa184){return function(_0x497317){if(_0x497317){return _0x497317[_0x6648('0x32')](_0x2474d4)[_0x6648('0x1d')](function(_0x1646c6){return _0x1646c6;});}return null;};}function removeEntity(_0x30d9bd,_0xc7cad7){return function(_0x494a42){if(_0x494a42){return _0x494a42[_0x6648('0x33')]()[_0x6648('0x1d')](function(){_0x30d9bd[_0x6648('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2be905,_0x3ec7a2){return function(_0x1905c8){if(!_0x1905c8){_0x2be905[_0x6648('0x27')](0x194);}return _0x1905c8;};}function handleError(_0x12bebf,_0xbd8409){_0xbd8409=_0xbd8409||0x1f4;return function(_0x5cb9ad){logger[_0x6648('0x23')](_0x5cb9ad['stack']);if(_0x5cb9ad['name']){delete _0x5cb9ad['name'];}_0x12bebf[_0x6648('0x28')](_0xbd8409)['send'](_0x5cb9ad);};}exports[_0x6648('0x34')]=function(_0x22077c,_0x38262e){var _0x591eec={},_0x4b7f26={},_0x33c35a={'count':0x0,'rows':[]};var _0x8c7e3c=_['map'](db[_0x6648('0x35')][_0x6648('0x36')],function(_0x4a3550){return{'name':_0x4a3550[_0x6648('0x37')],'type':_0x4a3550['type'][_0x6648('0x38')]};});_0x4b7f26['model']=_[_0x6648('0x39')](_0x8c7e3c,_0x6648('0x3a'));_0x4b7f26['query']=_[_0x6648('0x3b')](_0x22077c[_0x6648('0x3c')]);_0x4b7f26['filters']=_[_0x6648('0x3d')](_0x4b7f26[_0x6648('0x3e')],_0x4b7f26['query']);_0x591eec['attributes']=_[_0x6648('0x3d')](_0x4b7f26[_0x6648('0x3e')],qs[_0x6648('0x3f')](_0x22077c[_0x6648('0x3c')][_0x6648('0x3f')]));_0x591eec[_0x6648('0x40')]=_0x591eec[_0x6648('0x40')]['length']?_0x591eec['attributes']:_0x4b7f26[_0x6648('0x3e')];if(!_0x22077c['query'][_0x6648('0x41')](_0x6648('0x42'))){_0x591eec[_0x6648('0x2d')]=qs[_0x6648('0x2d')](_0x22077c['query']['limit']);_0x591eec[_0x6648('0x2b')]=qs['offset'](_0x22077c[_0x6648('0x3c')][_0x6648('0x2b')]);}_0x591eec[_0x6648('0x43')]=qs['sort'](_0x22077c[_0x6648('0x3c')]['sort']);_0x591eec[_0x6648('0x44')]=qs['filters'](_[_0x6648('0x45')](_0x22077c['query'],_0x4b7f26[_0x6648('0x46')]),_0x8c7e3c);if(_0x22077c[_0x6648('0x3c')]['filter']){_0x591eec['where']=_[_0x6648('0x47')](_0x591eec[_0x6648('0x44')],{'$or':_[_0x6648('0x39')](_0x8c7e3c,function(_0x52cf7d){if(_0x52cf7d['type']!==_0x6648('0x48')){var _0x47976d={};_0x47976d[_0x52cf7d[_0x6648('0x3a')]]={'$like':'%'+_0x22077c[_0x6648('0x3c')][_0x6648('0x49')]+'%'};return _0x47976d;}})});}_0x591eec=_[_0x6648('0x47')]({},_0x591eec,_0x22077c[_0x6648('0x4a')]);var _0x8d940={'where':_0x591eec['where']};return db[_0x6648('0x35')]['count'](_0x8d940)[_0x6648('0x1d')](function(_0x153016){_0x33c35a[_0x6648('0x2e')]=_0x153016;if(_0x22077c[_0x6648('0x3c')][_0x6648('0x4b')]){_0x591eec[_0x6648('0x4c')]=[{'all':!![]}];}return db[_0x6648('0x35')][_0x6648('0x4d')](_0x591eec);})[_0x6648('0x1d')](function(_0x2b882e){_0x33c35a[_0x6648('0x4e')]=_0x2b882e;return _0x33c35a;})[_0x6648('0x1d')](respondWithFilteredResult(_0x38262e,_0x591eec))['catch'](handleError(_0x38262e,null));};exports['show']=function(_0x27108c,_0x372031){var _0x275e45={'raw':!![],'where':{'id':_0x27108c[_0x6648('0x4f')]['id']}},_0x5646b2={};_0x5646b2[_0x6648('0x3e')]=_[_0x6648('0x3b')](db[_0x6648('0x35')][_0x6648('0x36')]);_0x5646b2[_0x6648('0x3c')]=_['keys'](_0x27108c[_0x6648('0x3c')]);_0x5646b2[_0x6648('0x46')]=_[_0x6648('0x3d')](_0x5646b2[_0x6648('0x3e')],_0x5646b2['query']);_0x275e45[_0x6648('0x40')]=_['intersection'](_0x5646b2[_0x6648('0x3e')],qs[_0x6648('0x3f')](_0x27108c[_0x6648('0x3c')][_0x6648('0x3f')]));_0x275e45[_0x6648('0x40')]=_0x275e45['attributes'][_0x6648('0x50')]?_0x275e45[_0x6648('0x40')]:_0x5646b2[_0x6648('0x3e')];if(_0x27108c[_0x6648('0x3c')][_0x6648('0x4b')]){_0x275e45['include']=[{'all':!![]}];}_0x275e45=_[_0x6648('0x47')]({},_0x275e45,_0x27108c[_0x6648('0x4a')]);return db[_0x6648('0x35')]['find'](_0x275e45)[_0x6648('0x1d')](handleEntityNotFound(_0x372031,null))[_0x6648('0x1d')](respondWithResult(_0x372031,null))[_0x6648('0x26')](handleError(_0x372031,null));};exports[_0x6648('0x51')]=function(_0x25ba21,_0xcd6428){return db[_0x6648('0x35')][_0x6648('0x51')](_0x25ba21['body'],{})[_0x6648('0x1d')](respondWithResult(_0xcd6428,0xc9))[_0x6648('0x26')](handleError(_0xcd6428,null));};exports['update']=function(_0x124140,_0x1cc194){if(_0x124140[_0x6648('0x52')]['id']){delete _0x124140['body']['id'];}return db[_0x6648('0x35')][_0x6648('0x53')]({'where':{'id':_0x124140[_0x6648('0x4f')]['id']}})[_0x6648('0x1d')](handleEntityNotFound(_0x1cc194,null))[_0x6648('0x1d')](saveUpdates(_0x124140['body'],null))[_0x6648('0x1d')](respondWithResult(_0x1cc194,null))['catch'](handleError(_0x1cc194,null));};exports[_0x6648('0x33')]=function(_0x24ca35,_0x21efa5){return db['WhatsappMessage'][_0x6648('0x53')]({'where':{'id':_0x24ca35['params']['id']}})[_0x6648('0x1d')](handleEntityNotFound(_0x21efa5,null))[_0x6648('0x1d')](removeEntity(_0x21efa5,null))[_0x6648('0x26')](handleError(_0x21efa5,null));};exports[_0x6648('0x54')]=function(_0x18fa34,_0x5de24f){return db[_0x6648('0x35')]['describe']()['then'](respondWithResult(_0x5de24f,null))[_0x6648('0x26')](handleError(_0x5de24f,null));};var interaction_log=require(_0x6648('0x12'))(_0x6648('0x55'));exports[_0x6648('0x56')]=function(_0x7e959f,_0x51e526,_0x5b3a68){var _0x58527f={'agent':{},'channel':_0x6648('0x57')};if(_0x7e959f[_0x6648('0x52')]['id']){delete _0x7e959f[_0x6648('0x52')]['id'];}_0x7e959f[_0x6648('0x52')][_0x6648('0x58')]=!![];_0x7e959f[_0x6648('0x52')][_0x6648('0x59')]=moment()[_0x6648('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x7e959f[_0x6648('0x52')][_0x6648('0x5b')]=_0x7e959f['body'][_0x6648('0x5b')]||_0x7e959f['user']['id'];_0x58527f[_0x6648('0x5c')]['id']=_0x7e959f[_0x6648('0x52')][_0x6648('0x5b')];return db['WhatsappMessage'][_0x6648('0x53')]({'where':{'id':_0x7e959f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51e526,null))['then'](saveUpdates(_0x7e959f['body'],null))[_0x6648('0x1d')](function(_0x146b63){if(_0x146b63){_0x58527f[_0x6648('0x24')]=_0x146b63[_0x6648('0x5d')]({'plain':!![]});return db[_0x6648('0x5e')][_0x6648('0x53')]({'where':{'id':_0x146b63[_0x6648('0x5f')]}});}return null;})[_0x6648('0x1d')](handleEntityNotFound(_0x51e526,null))[_0x6648('0x1d')](function(_0xbae3b2){if(_0xbae3b2){return _0xbae3b2[_0x6648('0x32')]({'UserId':_0x7e959f[_0x6648('0x52')][_0x6648('0x5b')],'read1stAt':_[_0x6648('0x60')](_0xbae3b2['read1stAt'])?moment()[_0x6648('0x5a')](_0x6648('0x61')):undefined});}return null;})[_0x6648('0x1d')](function(_0x4b1b02){if(_0x4b1b02){_0x58527f['interaction']=_0x4b1b02[_0x6648('0x5d')]({'plain':!![]});interaction_log[_0x6648('0x1e')](_0x6648('0x62'),_0x7e959f['user']['id'],_0x7e959f['user'][_0x6648('0x3a')],_0x7e959f[_0x6648('0x63')][_0x6648('0x64')],_0x58527f[_0x6648('0x65')]['id'],_0x7e959f[_0x6648('0x52')]?JSON[_0x6648('0x22')](_0x7e959f[_0x6648('0x52')]):'null');return respondWithRpcPromise(_0x6648('0x66'),_0x6648('0x67'),_0x58527f);}return null;})[_0x6648('0x1d')](function(_0x4e471c){var _0x5ec8ab='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e471c['message']['ContactId'];return db['sequelize'][_0x6648('0x3c')](_0x5ec8ab,{'type':db[_0x6648('0x68')][_0x6648('0x69')][_0x6648('0x6a')],'raw':!![]})['then'](function(_0x55ad74){return _0x55ad74;});})['then'](function(_0x32caba){if(_0x32caba){_0x58527f[_0x6648('0x24')]['contact']=_0x32caba[0x0];if(!_0x7e959f[_0x6648('0x52')][_0x6648('0x5b')])return;return db[_0x6648('0x6b')][_0x6648('0x53')]({'where':{'id':_0x7e959f['body']['UserId'],'role':_0x6648('0x5c')},'attributes':['id',_0x6648('0x3a'),_0x6648('0x6c'),_0x6648('0x6d'),_0x6648('0x6e')],'raw':!![]});}return null;})[_0x6648('0x1d')](function(_0x4d3524){if(!_0x4d3524)return null;_0x58527f[_0x6648('0x24')][_0x6648('0x5c')]=_0x4d3524;return _0x58527f;})[_0x6648('0x1d')](function(_0xa13d8a){if(_0xa13d8a){if(_0x7e959f[_0x6648('0x52')][_0x6648('0x6f')]){_0x58527f[_0x6648('0x24')][_0x6648('0x70')]=util['format'](_0x6648('0x71'),_0x7e959f[_0x6648('0x63')][_0x6648('0x3a')]);_0x58527f[_0x6648('0x24')][_0x6648('0x72')]=_0x58527f[_0x6648('0x72')];_0x58527f[_0x6648('0x24')][_0x6648('0x73')]=_0x58527f[_0x6648('0x72')];_0x58527f[_0x6648('0x24')][_0x6648('0x74')]=_0x6648('0x56');return respondWithRpcPromise(_0x6648('0x75'),'EventManager',{'event':_0x6648('0x76'),'message':_0x58527f[_0x6648('0x24')]},client9002)[_0x6648('0x1d')](function(){return _0x58527f;});}return _0x58527f;}return null;})[_0x6648('0x1d')](respondWithResult(_0x51e526,null))[_0x6648('0x26')](handleError(_0x51e526,null));};var interaction_log=require(_0x6648('0x12'))(_0x6648('0x55'));exports[_0x6648('0x77')]=function(_0x125e45,_0x3ee0c4,_0x53f2c2){var _0x53510b={'agent':{},'channel':_0x6648('0x57')};if(_0x125e45[_0x6648('0x52')]['id']){delete _0x125e45[_0x6648('0x52')]['id'];}_0x125e45[_0x6648('0x52')]['UserId']=_0x125e45[_0x6648('0x52')]['UserId']||_0x125e45[_0x6648('0x63')]['id'];_0x53510b[_0x6648('0x5c')]['id']=_0x125e45['body'][_0x6648('0x5b')];return db[_0x6648('0x35')]['find']({'where':{'id':_0x125e45[_0x6648('0x4f')]['id'],'UserId':null}})[_0x6648('0x1d')](handleEntityNotFound(_0x3ee0c4,null))[_0x6648('0x1d')](function(_0x8f05e9){if(_0x8f05e9){_0x53510b[_0x6648('0x24')]=_0x8f05e9[_0x6648('0x5d')]({'plain':!![]});return db['WhatsappInteraction'][_0x6648('0x53')]({'where':{'id':_0x8f05e9[_0x6648('0x5f')]}});}return null;})[_0x6648('0x1d')](handleEntityNotFound(_0x3ee0c4,null))['then'](function(_0x3cc6f3){if(_0x3cc6f3){_0x53510b[_0x6648('0x65')]=_0x3cc6f3[_0x6648('0x5d')]({'plain':!![]});interaction_log[_0x6648('0x1e')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x125e45[_0x6648('0x63')]['id'],_0x125e45[_0x6648('0x63')][_0x6648('0x3a')],_0x125e45[_0x6648('0x63')][_0x6648('0x64')],_0x53510b['interaction']['id'],_0x125e45[_0x6648('0x52')]?JSON[_0x6648('0x22')](_0x125e45[_0x6648('0x52')]):_0x6648('0x78'));return respondWithRpcPromise(_0x6648('0x79'),_0x6648('0x7a'),_0x53510b);}return null;})[_0x6648('0x1d')](function(_0x47a0dc){var _0x59dd85='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x47a0dc['message'][_0x6648('0x7b')];return db[_0x6648('0x7c')]['query'](_0x59dd85,{'type':db[_0x6648('0x68')][_0x6648('0x69')][_0x6648('0x6a')],'raw':!![]})[_0x6648('0x1d')](function(_0x9a5b8f){return _0x9a5b8f;});})[_0x6648('0x1d')](function(_0x5513c9){if(_0x5513c9){_0x53510b[_0x6648('0x24')]['contact']=_0x5513c9[0x0];if(!_0x125e45[_0x6648('0x52')][_0x6648('0x5b')])return;return db['User'][_0x6648('0x53')]({'where':{'id':_0x125e45[_0x6648('0x52')][_0x6648('0x5b')],'role':_0x6648('0x5c')},'attributes':['id',_0x6648('0x3a'),_0x6648('0x6c'),_0x6648('0x6d'),'internal'],'raw':!![]});}return null;})[_0x6648('0x1d')](function(_0x443e91){if(!_0x443e91)return null;_0x53510b[_0x6648('0x24')][_0x6648('0x5c')]=_0x443e91;return _0x53510b;})[_0x6648('0x1d')](function(_0x1c0bf5){if(_0x1c0bf5){_0x1c0bf5[_0x6648('0x24')][_0x6648('0x70')]=util['format'](_0x6648('0x71'),_0x125e45['user']['name']);_0x1c0bf5[_0x6648('0x24')][_0x6648('0x72')]=_0x53510b['channel'];_0x1c0bf5['message'][_0x6648('0x73')]=_0x53510b['channel'];_0x1c0bf5[_0x6648('0x24')][_0x6648('0x74')]=_0x6648('0x77');respondWithRpcPromise('EventManager',_0x6648('0x75'),{'event':'rejectmessage','message':_0x1c0bf5['message']},client9002);return _0x53510b;}return null;})[_0x6648('0x1d')](respondWithResult(_0x3ee0c4,null))[_0x6648('0x26')](handleError(_0x3ee0c4,null));};exports[_0x6648('0x28')]=function(_0x527a2e,_0x2deca2,_0x154c66){if(_0x527a2e[_0x6648('0x52')]['id']){delete _0x527a2e[_0x6648('0x52')]['id'];}var _0x3a763d;return db[_0x6648('0x35')]['find']({'where':{'id':_0x527a2e[_0x6648('0x4f')]['id']}})[_0x6648('0x1d')](handleEntityNotFound(_0x2deca2,null))[_0x6648('0x1d')](function(_0x51b85f){if(_0x51b85f){_0x3a763d=_0x51b85f;return db[_0x6648('0x7d')][_0x6648('0x53')]({'where':{'id':_0x51b85f['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x2deca2,null))['then'](function(_0x340b77){if(_0x340b77){logger[_0x6648('0x7e')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x6648('0x28'),'received\x20delivery\x20report\x20from',_0x340b77['type'],util[_0x6648('0x7f')](_0x527a2e['body'],{'showHidden':![],'depth':null}));switch(_0x340b77['type']){case _0x6648('0x80'):if(_0x527a2e[_0x6648('0x52')][_0x6648('0x81')]&&_0x527a2e[_0x6648('0x52')][_0x6648('0x81')]===_0x3a763d[_0x6648('0x82')]&&_0x527a2e[_0x6648('0x52')]['MessageStatus']&&_0x527a2e['body'][_0x6648('0x83')]===_0x6648('0x58')){return _0x3a763d[_0x6648('0x32')]({'read':!![]});}else{logger[_0x6648('0x23')](_0x6648('0x84'),'status',_0x6648('0x80'),util[_0x6648('0x7f')](_0x527a2e['body'],{'showHidden':![],'depth':null}));}break;}return _0x3a763d;}})[_0x6648('0x1d')](respondWithResult(_0x2deca2,null))[_0x6648('0x26')](handleError(_0x2deca2,null));}; \ No newline at end of file +var _0x0aef=['manual','interface','SIP/%s','channel','motionChannel','event','EventManager','params','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','count','set','reject','update','destroy','stack','index','WhatsappMessage','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','map','VIRTUAL','merge','options','includeAll','include','rows','show','length','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname'];(function(_0x1e3dae,_0x13e381){var _0xdc7cc6=function(_0x188357){while(--_0x188357){_0x1e3dae['push'](_0x1e3dae['shift']());}};_0xdc7cc6(++_0x13e381);}(_0x0aef,0x1a3));var _0xf0ae=function(_0x223d1e,_0x32ce90){_0x223d1e=_0x223d1e-0x0;var _0x3538aa=_0x0aef[_0x223d1e];return _0x3538aa;};'use strict';var emlformat=require(_0xf0ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ae('0x1'));var jsonpatch=require(_0xf0ae('0x2'));var rp=require('request-promise');var moment=require(_0xf0ae('0x3'));var BPromise=require(_0xf0ae('0x4'));var Mustache=require(_0xf0ae('0x5'));var util=require(_0xf0ae('0x6'));var path=require('path');var sox=require(_0xf0ae('0x7'));var csv=require(_0xf0ae('0x8'));var ejs=require(_0xf0ae('0x9'));var fs=require('fs');var fs_extra=require(_0xf0ae('0xa'));var _=require('lodash');var squel=require(_0xf0ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xf0ae('0xc'));var deskjs=require(_0xf0ae('0xd'));var toCsv=require(_0xf0ae('0x8'));var querystring=require('querystring');var Papa=require(_0xf0ae('0xe'));var Redis=require(_0xf0ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf0ae('0x10'));var as=require(_0xf0ae('0x11'));var hardwareService=require(_0xf0ae('0x12'));var logger=require(_0xf0ae('0x13'))(_0xf0ae('0x14'));var utils=require('../../config/utils');var config=require(_0xf0ae('0x15'));var licenseUtil=require(_0xf0ae('0x16'));var db=require(_0xf0ae('0x17'))['db'];config[_0xf0ae('0x18')]=_[_0xf0ae('0x19')](config[_0xf0ae('0x18')],{'host':_0xf0ae('0x1a'),'port':0x18eb});var socket=require(_0xf0ae('0x1b'))(new Redis(config[_0xf0ae('0x18')]));require(_0xf0ae('0x1c'))[_0xf0ae('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf0ae('0x1e')][_0xf0ae('0x1f')]({'port':0x232c});var client9002=jayson[_0xf0ae('0x1e')][_0xf0ae('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x319081,_0xf70647,_0x2bc75d,_0x8a95b){return new BPromise(function(_0x3e46d4,_0x35da68){var _0x4bf5bc=_0x8a95b||client;return _0x4bf5bc[_0xf0ae('0x20')](_0x319081,_0x2bc75d)[_0xf0ae('0x21')](function(_0x5caac9){logger['info'](_0xf0ae('0x22'),_0xf70647,_0xf0ae('0x23'));logger[_0xf0ae('0x24')](_0xf0ae('0x25'),_0xf70647,_0xf0ae('0x23'),JSON[_0xf0ae('0x26')](_0x5caac9));if(_0x5caac9[_0xf0ae('0x27')]){if(_0x5caac9['error'][_0xf0ae('0x28')]===0x1f4){logger[_0xf0ae('0x27')](_0xf0ae('0x22'),_0xf70647,_0x5caac9[_0xf0ae('0x27')][_0xf0ae('0x29')]);return _0x35da68(_0x5caac9[_0xf0ae('0x27')][_0xf0ae('0x29')]);}logger[_0xf0ae('0x27')](_0xf0ae('0x22'),_0xf70647,_0x5caac9[_0xf0ae('0x27')][_0xf0ae('0x29')]);return _0x3e46d4(_0x5caac9[_0xf0ae('0x27')][_0xf0ae('0x29')]);}else{logger[_0xf0ae('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0xf70647,_0xf0ae('0x23'));_0x3e46d4(_0x5caac9[_0xf0ae('0x2b')][_0xf0ae('0x29')]);}})[_0xf0ae('0x2c')](function(_0x1757da){logger[_0xf0ae('0x27')](_0xf0ae('0x22'),_0xf70647,_0x1757da);_0x35da68(_0x1757da);});});}function respondWithStatusCode(_0x263ebd,_0x4fcd21){_0x4fcd21=_0x4fcd21||0xcc;return function(_0x252671){if(_0x252671){return _0x263ebd['sendStatus'](_0x4fcd21);}return _0x263ebd[_0xf0ae('0x2d')](_0x4fcd21)[_0xf0ae('0x2e')]();};}function respondWithResult(_0x2fd787,_0x3b712f){_0x3b712f=_0x3b712f||0xc8;return function(_0x1e20d){if(_0x1e20d){return _0x2fd787['status'](_0x3b712f)[_0xf0ae('0x2f')](_0x1e20d);}};}function respondWithFilteredResult(_0x461cce,_0x547c5a){return function(_0x16aec8){if(_0x16aec8){var _0x3ab750=typeof _0x547c5a[_0xf0ae('0x30')]==='undefined'&&typeof _0x547c5a[_0xf0ae('0x31')]==='undefined';var _0x1f2d82=_0x16aec8['count'];var _0x4dc3bb=_0x3ab750?0x0:_0x547c5a[_0xf0ae('0x30')];var _0x3da358=_0x3ab750?_0x16aec8[_0xf0ae('0x32')]:_0x547c5a[_0xf0ae('0x30')]+_0x547c5a[_0xf0ae('0x31')];var _0x54e4d7;if(_0x3da358>=_0x1f2d82){_0x3da358=_0x1f2d82;_0x54e4d7=0xc8;}else{_0x54e4d7=0xce;}_0x461cce[_0xf0ae('0x2d')](_0x54e4d7);return _0x461cce[_0xf0ae('0x33')]('Content-Range',_0x4dc3bb+'-'+_0x3da358+'/'+_0x1f2d82)[_0xf0ae('0x2f')](_0x16aec8);}return null;};}function patchUpdates(_0x24d03f){return function(_0xec1d5f){try{jsonpatch['apply'](_0xec1d5f,_0x24d03f,!![]);}catch(_0x74f94a){return BPromise[_0xf0ae('0x34')](_0x74f94a);}return _0xec1d5f['save']();};}function saveUpdates(_0x2704c2,_0x1aa0c0){return function(_0x142cae){if(_0x142cae){return _0x142cae[_0xf0ae('0x35')](_0x2704c2)['then'](function(_0x4acd5c){return _0x4acd5c;});}return null;};}function removeEntity(_0x63043e,_0x2a5b53){return function(_0x2cb851){if(_0x2cb851){return _0x2cb851[_0xf0ae('0x36')]()[_0xf0ae('0x21')](function(){_0x63043e['status'](0xcc)[_0xf0ae('0x2e')]();});}};}function handleEntityNotFound(_0x25ce6b,_0x21dbbf){return function(_0x4640eb){if(!_0x4640eb){_0x25ce6b['sendStatus'](0x194);}return _0x4640eb;};}function handleError(_0x463d6a,_0x4eadcf){_0x4eadcf=_0x4eadcf||0x1f4;return function(_0x2bfd9e){logger[_0xf0ae('0x27')](_0x2bfd9e[_0xf0ae('0x37')]);if(_0x2bfd9e['name']){delete _0x2bfd9e['name'];}_0x463d6a[_0xf0ae('0x2d')](_0x4eadcf)['send'](_0x2bfd9e);};}exports[_0xf0ae('0x38')]=function(_0x539a19,_0x1e6c3c){var _0x114ccb={},_0x15db36={},_0x5c10c0={'count':0x0,'rows':[]};var _0x29e79c=_['map'](db[_0xf0ae('0x39')][_0xf0ae('0x3a')],function(_0x2d9d51){return{'name':_0x2d9d51[_0xf0ae('0x3b')],'type':_0x2d9d51[_0xf0ae('0x3c')][_0xf0ae('0x3d')]};});_0x15db36['model']=_['map'](_0x29e79c,_0xf0ae('0x3e'));_0x15db36['query']=_[_0xf0ae('0x3f')](_0x539a19[_0xf0ae('0x40')]);_0x15db36[_0xf0ae('0x41')]=_[_0xf0ae('0x42')](_0x15db36[_0xf0ae('0x43')],_0x15db36['query']);_0x114ccb[_0xf0ae('0x44')]=_['intersection'](_0x15db36[_0xf0ae('0x43')],qs[_0xf0ae('0x45')](_0x539a19[_0xf0ae('0x40')][_0xf0ae('0x45')]));_0x114ccb[_0xf0ae('0x44')]=_0x114ccb[_0xf0ae('0x44')]['length']?_0x114ccb[_0xf0ae('0x44')]:_0x15db36['model'];if(!_0x539a19[_0xf0ae('0x40')][_0xf0ae('0x46')](_0xf0ae('0x47'))){_0x114ccb[_0xf0ae('0x31')]=qs[_0xf0ae('0x31')](_0x539a19[_0xf0ae('0x40')][_0xf0ae('0x31')]);_0x114ccb[_0xf0ae('0x30')]=qs[_0xf0ae('0x30')](_0x539a19['query']['offset']);}_0x114ccb[_0xf0ae('0x48')]=qs['sort'](_0x539a19['query'][_0xf0ae('0x49')]);_0x114ccb[_0xf0ae('0x4a')]=qs[_0xf0ae('0x41')](_['pick'](_0x539a19[_0xf0ae('0x40')],_0x15db36[_0xf0ae('0x41')]),_0x29e79c);if(_0x539a19['query']['filter']){_0x114ccb[_0xf0ae('0x4a')]=_['merge'](_0x114ccb[_0xf0ae('0x4a')],{'$or':_[_0xf0ae('0x4b')](_0x29e79c,function(_0x3af8eb){if(_0x3af8eb[_0xf0ae('0x3c')]!==_0xf0ae('0x4c')){var _0x3bc980={};_0x3bc980[_0x3af8eb[_0xf0ae('0x3e')]]={'$like':'%'+_0x539a19[_0xf0ae('0x40')]['filter']+'%'};return _0x3bc980;}})});}_0x114ccb=_[_0xf0ae('0x4d')]({},_0x114ccb,_0x539a19[_0xf0ae('0x4e')]);var _0x18f19b={'where':_0x114ccb['where']};return db[_0xf0ae('0x39')][_0xf0ae('0x32')](_0x18f19b)[_0xf0ae('0x21')](function(_0x4869f3){_0x5c10c0[_0xf0ae('0x32')]=_0x4869f3;if(_0x539a19[_0xf0ae('0x40')][_0xf0ae('0x4f')]){_0x114ccb[_0xf0ae('0x50')]=[{'all':!![]}];}return db[_0xf0ae('0x39')]['findAll'](_0x114ccb);})[_0xf0ae('0x21')](function(_0x59f09a){_0x5c10c0[_0xf0ae('0x51')]=_0x59f09a;return _0x5c10c0;})[_0xf0ae('0x21')](respondWithFilteredResult(_0x1e6c3c,_0x114ccb))[_0xf0ae('0x2c')](handleError(_0x1e6c3c,null));};exports[_0xf0ae('0x52')]=function(_0x3f8fe7,_0x3fb3dc){var _0xf2ccac={'raw':!![],'where':{'id':_0x3f8fe7['params']['id']}},_0x4c4ca7={};_0x4c4ca7['model']=_[_0xf0ae('0x3f')](db[_0xf0ae('0x39')][_0xf0ae('0x3a')]);_0x4c4ca7[_0xf0ae('0x40')]=_[_0xf0ae('0x3f')](_0x3f8fe7[_0xf0ae('0x40')]);_0x4c4ca7[_0xf0ae('0x41')]=_[_0xf0ae('0x42')](_0x4c4ca7[_0xf0ae('0x43')],_0x4c4ca7['query']);_0xf2ccac[_0xf0ae('0x44')]=_['intersection'](_0x4c4ca7[_0xf0ae('0x43')],qs[_0xf0ae('0x45')](_0x3f8fe7['query'][_0xf0ae('0x45')]));_0xf2ccac[_0xf0ae('0x44')]=_0xf2ccac['attributes'][_0xf0ae('0x53')]?_0xf2ccac[_0xf0ae('0x44')]:_0x4c4ca7[_0xf0ae('0x43')];if(_0x3f8fe7[_0xf0ae('0x40')]['includeAll']){_0xf2ccac[_0xf0ae('0x50')]=[{'all':!![]}];}_0xf2ccac=_[_0xf0ae('0x4d')]({},_0xf2ccac,_0x3f8fe7['options']);return db['WhatsappMessage'][_0xf0ae('0x54')](_0xf2ccac)[_0xf0ae('0x21')](handleEntityNotFound(_0x3fb3dc,null))[_0xf0ae('0x21')](respondWithResult(_0x3fb3dc,null))[_0xf0ae('0x2c')](handleError(_0x3fb3dc,null));};exports[_0xf0ae('0x55')]=function(_0x3eafa5,_0xaff478){return db[_0xf0ae('0x39')]['create'](_0x3eafa5[_0xf0ae('0x56')],{})[_0xf0ae('0x21')](respondWithResult(_0xaff478,0xc9))[_0xf0ae('0x2c')](handleError(_0xaff478,null));};exports[_0xf0ae('0x35')]=function(_0x4f03a6,_0x6bdef2){if(_0x4f03a6[_0xf0ae('0x56')]['id']){delete _0x4f03a6[_0xf0ae('0x56')]['id'];}return db[_0xf0ae('0x39')]['find']({'where':{'id':_0x4f03a6['params']['id']}})[_0xf0ae('0x21')](handleEntityNotFound(_0x6bdef2,null))[_0xf0ae('0x21')](saveUpdates(_0x4f03a6['body'],null))['then'](respondWithResult(_0x6bdef2,null))[_0xf0ae('0x2c')](handleError(_0x6bdef2,null));};exports[_0xf0ae('0x36')]=function(_0x10063c,_0x59ce6d){return db[_0xf0ae('0x39')][_0xf0ae('0x54')]({'where':{'id':_0x10063c['params']['id']}})[_0xf0ae('0x21')](handleEntityNotFound(_0x59ce6d,null))['then'](removeEntity(_0x59ce6d,null))[_0xf0ae('0x2c')](handleError(_0x59ce6d,null));};exports['describe']=function(_0x152199,_0x431ae0){return db[_0xf0ae('0x39')][_0xf0ae('0x57')]()[_0xf0ae('0x21')](respondWithResult(_0x431ae0,null))[_0xf0ae('0x2c')](handleError(_0x431ae0,null));};var interaction_log=require(_0xf0ae('0x13'))(_0xf0ae('0x58'));exports[_0xf0ae('0x59')]=function(_0x3d4713,_0xc227ce,_0x2afbed){var _0x325194={'agent':{},'channel':'whatsapp'};if(_0x3d4713[_0xf0ae('0x56')]['id']){delete _0x3d4713[_0xf0ae('0x56')]['id'];}_0x3d4713[_0xf0ae('0x56')][_0xf0ae('0x5a')]=!![];_0x3d4713['body'][_0xf0ae('0x5b')]=moment()[_0xf0ae('0x5c')](_0xf0ae('0x5d'));_0x3d4713[_0xf0ae('0x56')][_0xf0ae('0x5e')]=_0x3d4713[_0xf0ae('0x56')][_0xf0ae('0x5e')]||_0x3d4713[_0xf0ae('0x5f')]['id'];_0x325194[_0xf0ae('0x60')]['id']=_0x3d4713[_0xf0ae('0x56')][_0xf0ae('0x5e')];return db['WhatsappMessage'][_0xf0ae('0x54')]({'where':{'id':_0x3d4713['params']['id'],'UserId':null}})[_0xf0ae('0x21')](handleEntityNotFound(_0xc227ce,null))['then'](saveUpdates(_0x3d4713['body'],null))['then'](function(_0x441763){if(_0x441763){_0x325194[_0xf0ae('0x29')]=_0x441763[_0xf0ae('0x61')]({'plain':!![]});return db[_0xf0ae('0x62')][_0xf0ae('0x54')]({'where':{'id':_0x441763[_0xf0ae('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xc227ce,null))[_0xf0ae('0x21')](function(_0x553093){if(_0x553093){return _0x553093[_0xf0ae('0x35')]({'UserId':_0x3d4713['body'][_0xf0ae('0x5e')],'read1stAt':_['isNil'](_0x553093['read1stAt'])?moment()[_0xf0ae('0x5c')](_0xf0ae('0x5d')):undefined});}return null;})[_0xf0ae('0x21')](function(_0x39e44d){if(_0x39e44d){_0x325194['interaction']=_0x39e44d[_0xf0ae('0x61')]({'plain':!![]});interaction_log['info'](_0xf0ae('0x64'),_0x3d4713[_0xf0ae('0x5f')]['id'],_0x3d4713[_0xf0ae('0x5f')][_0xf0ae('0x3e')],_0x3d4713[_0xf0ae('0x5f')][_0xf0ae('0x65')],_0x325194['interaction']['id'],_0x3d4713[_0xf0ae('0x56')]?JSON[_0xf0ae('0x26')](_0x3d4713['body']):_0xf0ae('0x66'));return respondWithRpcPromise(_0xf0ae('0x67'),_0xf0ae('0x68'),_0x325194);}return null;})[_0xf0ae('0x21')](function(_0x490093){var _0x2d482f=_0xf0ae('0x69')+_0x490093['message']['ContactId'];return db[_0xf0ae('0x6a')][_0xf0ae('0x40')](_0x2d482f,{'type':db[_0xf0ae('0x6b')][_0xf0ae('0x6c')][_0xf0ae('0x6d')],'raw':!![]})[_0xf0ae('0x21')](function(_0x4e1492){return _0x4e1492;});})[_0xf0ae('0x21')](function(_0x5d0b46){if(_0x5d0b46){_0x325194[_0xf0ae('0x29')][_0xf0ae('0x6e')]=_0x5d0b46[0x0];if(!_0x3d4713[_0xf0ae('0x56')][_0xf0ae('0x5e')])return;return db[_0xf0ae('0x6f')][_0xf0ae('0x54')]({'where':{'id':_0x3d4713[_0xf0ae('0x56')][_0xf0ae('0x5e')],'role':_0xf0ae('0x60')},'attributes':['id',_0xf0ae('0x3e'),_0xf0ae('0x70'),'email','internal'],'raw':!![]});}return null;})[_0xf0ae('0x21')](function(_0xc33939){if(!_0xc33939)return null;_0x325194[_0xf0ae('0x29')][_0xf0ae('0x60')]=_0xc33939;return _0x325194;})[_0xf0ae('0x21')](function(_0x3d8b05){if(_0x3d8b05){if(_0x3d4713[_0xf0ae('0x56')][_0xf0ae('0x71')]){_0x325194[_0xf0ae('0x29')][_0xf0ae('0x72')]=util[_0xf0ae('0x5c')](_0xf0ae('0x73'),_0x3d4713[_0xf0ae('0x5f')][_0xf0ae('0x3e')]);_0x325194[_0xf0ae('0x29')]['channel']=_0x325194[_0xf0ae('0x74')];_0x325194[_0xf0ae('0x29')][_0xf0ae('0x75')]=_0x325194['channel'];_0x325194[_0xf0ae('0x29')][_0xf0ae('0x76')]=_0xf0ae('0x59');return respondWithRpcPromise(_0xf0ae('0x77'),_0xf0ae('0x77'),{'event':'acceptmessage','message':_0x325194[_0xf0ae('0x29')]},client9002)[_0xf0ae('0x21')](function(){return _0x325194;});}return _0x325194;}return null;})[_0xf0ae('0x21')](respondWithResult(_0xc227ce,null))[_0xf0ae('0x2c')](handleError(_0xc227ce,null));};var interaction_log=require(_0xf0ae('0x13'))('whatsapp-interactions');exports[_0xf0ae('0x34')]=function(_0x1bdb03,_0x128036,_0xbcfc14){var _0x44616e={'agent':{},'channel':'whatsapp'};if(_0x1bdb03['body']['id']){delete _0x1bdb03['body']['id'];}_0x1bdb03[_0xf0ae('0x56')][_0xf0ae('0x5e')]=_0x1bdb03[_0xf0ae('0x56')][_0xf0ae('0x5e')]||_0x1bdb03['user']['id'];_0x44616e['agent']['id']=_0x1bdb03['body'][_0xf0ae('0x5e')];return db['WhatsappMessage']['find']({'where':{'id':_0x1bdb03[_0xf0ae('0x78')]['id'],'UserId':null}})[_0xf0ae('0x21')](handleEntityNotFound(_0x128036,null))[_0xf0ae('0x21')](function(_0x33ef67){if(_0x33ef67){_0x44616e[_0xf0ae('0x29')]=_0x33ef67['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x33ef67[_0xf0ae('0x63')]}});}return null;})[_0xf0ae('0x21')](handleEntityNotFound(_0x128036,null))['then'](function(_0x4a9ed4){if(_0x4a9ed4){_0x44616e[_0xf0ae('0x79')]=_0x4a9ed4[_0xf0ae('0x61')]({'plain':!![]});interaction_log['info'](_0xf0ae('0x7a'),_0x1bdb03[_0xf0ae('0x5f')]['id'],_0x1bdb03[_0xf0ae('0x5f')]['name'],_0x1bdb03[_0xf0ae('0x5f')][_0xf0ae('0x65')],_0x44616e['interaction']['id'],_0x1bdb03[_0xf0ae('0x56')]?JSON[_0xf0ae('0x26')](_0x1bdb03[_0xf0ae('0x56')]):_0xf0ae('0x66'));return respondWithRpcPromise(_0xf0ae('0x7b'),'rejectMessage',_0x44616e);}return null;})[_0xf0ae('0x21')](function(_0x51f012){var _0x3cae80=_0xf0ae('0x69')+_0x51f012[_0xf0ae('0x29')]['ContactId'];return db['sequelize'][_0xf0ae('0x40')](_0x3cae80,{'type':db[_0xf0ae('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0xf0ae('0x21')](function(_0x189227){return _0x189227;});})[_0xf0ae('0x21')](function(_0x2a16ca){if(_0x2a16ca){_0x44616e[_0xf0ae('0x29')][_0xf0ae('0x6e')]=_0x2a16ca[0x0];if(!_0x1bdb03[_0xf0ae('0x56')][_0xf0ae('0x5e')])return;return db[_0xf0ae('0x6f')][_0xf0ae('0x54')]({'where':{'id':_0x1bdb03['body'][_0xf0ae('0x5e')],'role':_0xf0ae('0x60')},'attributes':['id','name',_0xf0ae('0x70'),'email',_0xf0ae('0x7c')],'raw':!![]});}return null;})[_0xf0ae('0x21')](function(_0x57a9c4){if(!_0x57a9c4)return null;_0x44616e['message']['agent']=_0x57a9c4;return _0x44616e;})[_0xf0ae('0x21')](function(_0x125a71){if(_0x125a71){_0x125a71[_0xf0ae('0x29')][_0xf0ae('0x72')]=util[_0xf0ae('0x5c')](_0xf0ae('0x73'),_0x1bdb03['user'][_0xf0ae('0x3e')]);_0x125a71[_0xf0ae('0x29')][_0xf0ae('0x74')]=_0x44616e['channel'];_0x125a71[_0xf0ae('0x29')][_0xf0ae('0x75')]=_0x44616e[_0xf0ae('0x74')];_0x125a71[_0xf0ae('0x29')][_0xf0ae('0x76')]=_0xf0ae('0x34');respondWithRpcPromise(_0xf0ae('0x77'),_0xf0ae('0x77'),{'event':_0xf0ae('0x7d'),'message':_0x125a71[_0xf0ae('0x29')]},client9002);return _0x44616e;}return null;})[_0xf0ae('0x21')](respondWithResult(_0x128036,null))[_0xf0ae('0x2c')](handleError(_0x128036,null));};exports[_0xf0ae('0x2d')]=function(_0x395628,_0x278444,_0x4b8d8e){if(_0x395628['body']['id']){delete _0x395628[_0xf0ae('0x56')]['id'];}var _0x3b7fd3;return db[_0xf0ae('0x39')][_0xf0ae('0x54')]({'where':{'id':_0x395628[_0xf0ae('0x78')]['id']}})[_0xf0ae('0x21')](handleEntityNotFound(_0x278444,null))[_0xf0ae('0x21')](function(_0x2cd433){if(_0x2cd433){_0x3b7fd3=_0x2cd433;return db[_0xf0ae('0x7e')][_0xf0ae('0x54')]({'where':{'id':_0x2cd433[_0xf0ae('0x7f')]}});}})[_0xf0ae('0x21')](handleEntityNotFound(_0x278444,null))[_0xf0ae('0x21')](function(_0x47257a){if(_0x47257a){logger[_0xf0ae('0x24')](_0xf0ae('0x80'),_0xf0ae('0x2d'),'received\x20delivery\x20report\x20from',_0x47257a[_0xf0ae('0x3c')],util['inspect'](_0x395628[_0xf0ae('0x56')],{'showHidden':![],'depth':null}));switch(_0x47257a[_0xf0ae('0x3c')]){case'twilio':if(_0x395628[_0xf0ae('0x56')]['MessageSid']&&_0x395628['body']['MessageSid']===_0x3b7fd3[_0xf0ae('0x81')]&&_0x395628[_0xf0ae('0x56')][_0xf0ae('0x82')]&&_0x395628[_0xf0ae('0x56')]['MessageStatus']===_0xf0ae('0x5a')){return _0x3b7fd3[_0xf0ae('0x35')]({'read':!![]});}else{logger['error'](_0xf0ae('0x83'),_0xf0ae('0x2d'),'twilio',util[_0xf0ae('0x84')](_0x395628['body'],{'showHidden':![],'depth':null}));}break;}return _0x3b7fd3;}})['then'](respondWithResult(_0x278444,null))[_0xf0ae('0x2c')](handleError(_0x278444,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3e8fa0e..9c1af41 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 _0x7894=['WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x7894,0x170));var _0x4789=function(_0x25eee3,_0x401901){_0x25eee3=_0x25eee3-0x0;var _0x525d80=_0x7894[_0x25eee3];return _0x525d80;};'use strict';var EventEmitter=require(_0x4789('0x0'));var WhatsappMessage=require(_0x4789('0x1'))['db'][_0x4789('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4789('0x3')](0x0);var events={'afterCreate':_0x4789('0x4'),'afterUpdate':_0x4789('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd4bd76){return function(_0x2b2dd3,_0x4e2393,_0x3394f6){WhatsappMessageEvents[_0x4789('0x6')](_0xd4bd76+':'+_0x2b2dd3['id'],_0x2b2dd3);WhatsappMessageEvents[_0x4789('0x6')](_0xd4bd76,_0x2b2dd3);_0x3394f6(null);};}for(var e in events){if(events[_0x4789('0x7')](e)){var event=events[e];WhatsappMessage[_0x4789('0x8')](e,emitEvent(event));}}module[_0x4789('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb62e=['hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x302732,_0x5e014d){var _0x4f3fd2=function(_0x45384f){while(--_0x45384f){_0x302732['push'](_0x302732['shift']());}};_0x4f3fd2(++_0x5e014d);}(_0xb62e,0x1de));var _0xeb62=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb62e[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xeb62('0x0'));var WhatsappMessage=require(_0xeb62('0x1'))['db'][_0xeb62('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xeb62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb62('0x4'),'afterDestroy':_0xeb62('0x5')};function emitEvent(_0x45728e){return function(_0x929329,_0x3c7ad5,_0x1ebdbb){WhatsappMessageEvents['emit'](_0x45728e+':'+_0x929329['id'],_0x929329);WhatsappMessageEvents[_0xeb62('0x6')](_0x45728e,_0x929329);_0x1ebdbb(null);};}for(var e in events){if(events[_0xeb62('0x7')](e)){var event=events[e];WhatsappMessage[_0xeb62('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c8f30c0..44adfde 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 _0xd9a0=['../../config/logger','api','moment','node-fetch','path','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','UserId','WhatsappInteraction','then','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','authToken','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','/whatsapp/v1/','/messages/','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dae49,_0x300a62){var _0x1d5745=function(_0x436772){while(--_0x436772){_0x3dae49['push'](_0x3dae49['shift']());}};_0x1d5745(++_0x300a62);}(_0xd9a0,0x68));var _0x0d9a=function(_0xb63d93,_0x1fb747){_0xb63d93=_0xb63d93-0x0;var _0x27979d=_0xd9a0[_0xb63d93];return _0x27979d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d9a('0x0'))(_0x0d9a('0x1'));var moment=require(_0x0d9a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x0d9a('0x3'));var fs=require('fs');var path=require(_0x0d9a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0d9a('0x5'));module[_0x0d9a('0x6')]=function(_0x491fb9,_0x59bca5){return _0x491fb9[_0x0d9a('0x7')](_0x0d9a('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x0d9a('0x9'),'fields':[_0x0d9a('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0x0d9a('0xa')],'type':_0x0d9a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38b457,_0x3825f3,_0x5e222f){var _0x577880=_0x491fb9[_0x0d9a('0xc')];var _0x25f116=_0x38b457[_0x0d9a('0xd')]({'plain':!![]});if(_0x25f116[_0x0d9a('0xe')][_0x0d9a('0xf')]()==='in'||_0x25f116[_0x0d9a('0xe')][_0x0d9a('0xf')]()==='out'&&!_0x25f116['secret']&&!_['isNil'](_0x25f116[_0x0d9a('0x10')])){_0x577880[_0x0d9a('0x11')]['findOne']({'where':{'id':_0x25f116['WhatsappInteractionId']}})[_0x0d9a('0x12')](function(_0x2df179){if(_0x2df179){_0x2df179[_0x0d9a('0x13')]({'lastMsgAt':_0x25f116[_0x0d9a('0x14')],'lastMsgDirection':_0x25f116[_0x0d9a('0xe')][_0x0d9a('0xf')]()});}})[_0x0d9a('0x15')](function(_0x59e168){console[_0x0d9a('0x16')](_0x59e168);});}if(_0x25f116[_0x0d9a('0xe')]==='out'&&!_0x25f116[_0x0d9a('0x17')]){var _0x57ddf6;_0x577880[_0x0d9a('0x18')][_0x0d9a('0x19')]({'where':{'id':_0x25f116[_0x0d9a('0x1a')]},'raw':!![]})['then'](function(_0x593443){_0x57ddf6=_0x593443;if(_0x57ddf6&&_0x57ddf6[_0x0d9a('0x1b')]){switch(_0x57ddf6[_0x0d9a('0x1b')]){case _0x0d9a('0x1c'):var _0x86d084=require(_0x0d9a('0x1c'));if(_0x57ddf6['accountSid']&&_0x57ddf6['authToken']&&_0x57ddf6[_0x0d9a('0x1d')]){var _0x3c8e8e=new _0x86d084(_0x57ddf6['accountSid'],_0x57ddf6[_0x0d9a('0x1e')]);_0x3c8e8e['messages'][_0x0d9a('0x1f')]({'body':_0x25f116[_0x0d9a('0xa')],'to':_0x0d9a('0x20')+_0x25f116[_0x0d9a('0x1d')],'from':_0x0d9a('0x20')+_0x57ddf6[_0x0d9a('0x1d')],'statusCallback':_0x57ddf6[_0x0d9a('0x21')]+_0x0d9a('0x22')+_0x25f116['id']+_0x0d9a('0x23')+_0x57ddf6[_0x0d9a('0x24')]})[_0x0d9a('0x12')](function(_0x45a7bf){if(_0x45a7bf[_0x0d9a('0x25')]){return _0x38b457[_0x0d9a('0x13')]({'messageId':_0x45a7bf[_0x0d9a('0x25')]});}})[_0x0d9a('0x15')](function(_0xc83ca1){logger['error'](_0x0d9a('0x26'),'afterCreate','twilio',util['inspect'](_0xc83ca1,{'showHidden':![],'depth':null}));});}else{logger[_0x0d9a('0x16')](_0x0d9a('0x26'),'afterCreate',_0x0d9a('0x1c'),_0x0d9a('0x27'));}break;case _0x0d9a('0x28'):var _0x39393b=_0x57ddf6[_0x0d9a('0x29')];var _0x502d2e=_0x57ddf6[_0x0d9a('0x1e')];var _0x278d5a=_0x57ddf6['baseUrl']+_0x0d9a('0x2a')+_0x39393b+_0x0d9a('0x2b');var _0x27e4ba={'to':[_0x25f116[_0x0d9a('0x1d')]],'message':{'type':'text','text':_0x25f116[_0x0d9a('0xa')]}};var _0x31c20d={'method':_0x0d9a('0x2c'),'uri':_0x278d5a,'headers':{'Authorization':'Bearer\x20'+_0x502d2e,'Content-Type':_0x0d9a('0x2d')},'body':_0x27e4ba,'json':!![]};rp(_0x31c20d)['then'](function(_0x30152f){if(_0x30152f[_0x0d9a('0x2e')][0x0][_0x0d9a('0x2f')]){return _0x38b457[_0x0d9a('0x13')]({'messageId':_0x30152f[_0x0d9a('0x2e')][0x0][_0x0d9a('0x2f')]});}})['catch'](function(_0x310e44){logger[_0x0d9a('0x30')](_0x0d9a('0x31'),_0x310e44);});break;}}})['finally'](function(){_0x5e222f();});}else{_0x5e222f();}}},'charset':_0x0d9a('0x32'),'collate':_0x0d9a('0x33')});}; \ No newline at end of file +var _0x13f5=['WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteractionId','then','update','catch','error'];(function(_0x3dbeae,_0x48de1c){var _0x545eff=function(_0x2c08d1){while(--_0x2c08d1){_0x3dbeae['push'](_0x3dbeae['shift']());}};_0x545eff(++_0x48de1c);}(_0x13f5,0x16c));var _0x513f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x13f5[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x513f('0x0'));var logger=require(_0x513f('0x1'))(_0x513f('0x2'));var moment=require(_0x513f('0x3'));var BPromise=require(_0x513f('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x513f('0x5'));var rimraf=require(_0x513f('0x6'));var config=require(_0x513f('0x7'));var attributes=require(_0x513f('0x8'));module['exports']=function(_0x26dd1d,_0xb27fdc){return _0x26dd1d[_0x513f('0x9')](_0x513f('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x513f('0xb'),'fields':[_0x513f('0xb')]},{'name':_0x513f('0xc'),'fields':[_0x513f('0xd')],'type':_0x513f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x296beb,_0x593ada,_0x15731a){var _0xd10450=_0x26dd1d[_0x513f('0xf')];var _0x43bc6a=_0x296beb[_0x513f('0x10')]({'plain':!![]});if(_0x43bc6a[_0x513f('0x11')][_0x513f('0x12')]()==='in'||_0x43bc6a[_0x513f('0x11')][_0x513f('0x12')]()===_0x513f('0x13')&&!_0x43bc6a[_0x513f('0x14')]&&!_[_0x513f('0x15')](_0x43bc6a[_0x513f('0x16')])){_0xd10450['WhatsappInteraction']['findOne']({'where':{'id':_0x43bc6a[_0x513f('0x17')]}})[_0x513f('0x18')](function(_0x11b4d9){if(_0x11b4d9){_0x11b4d9[_0x513f('0x19')]({'lastMsgAt':_0x43bc6a['createdAt'],'lastMsgDirection':_0x43bc6a[_0x513f('0x11')][_0x513f('0x12')]()});}})[_0x513f('0x1a')](function(_0x297978){console[_0x513f('0x1b')](_0x297978);});}if(_0x43bc6a[_0x513f('0x11')]===_0x513f('0x13')&&!_0x43bc6a[_0x513f('0x14')]){var _0x540fdc;_0xd10450[_0x513f('0x1c')][_0x513f('0x1d')]({'where':{'id':_0x43bc6a[_0x513f('0x1e')]},'raw':!![]})[_0x513f('0x18')](function(_0x1d2534){_0x540fdc=_0x1d2534;if(_0x540fdc&&_0x540fdc[_0x513f('0x1f')]){switch(_0x540fdc[_0x513f('0x1f')]){case _0x513f('0x20'):var _0x30cb31=require(_0x513f('0x20'));if(_0x540fdc['accountSid']&&_0x540fdc[_0x513f('0x21')]&&_0x540fdc[_0x513f('0x22')]){var _0x1d064f=new _0x30cb31(_0x540fdc[_0x513f('0x23')],_0x540fdc[_0x513f('0x21')]);_0x1d064f[_0x513f('0x24')][_0x513f('0x25')]({'body':_0x43bc6a[_0x513f('0xd')],'to':'whatsapp:'+_0x43bc6a['phone'],'from':_0x513f('0x26')+_0x540fdc['phone'],'statusCallback':_0x540fdc['remote']+_0x513f('0x27')+_0x43bc6a['id']+'/status?token='+_0x540fdc[_0x513f('0x28')]})['then'](function(_0x502cca){if(_0x502cca[_0x513f('0x29')]){return _0x296beb[_0x513f('0x19')]({'messageId':_0x502cca[_0x513f('0x29')]});}})[_0x513f('0x1a')](function(_0x46b990){logger['error'](_0x513f('0x2a'),_0x513f('0x2b'),_0x513f('0x20'),util[_0x513f('0x2c')](_0x46b990,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x513f('0x2a'),_0x513f('0x2b'),'twilio',_0x513f('0x2d'));}break;case _0x513f('0x2e'):var _0x5fba9c=_0x540fdc[_0x513f('0x23')];var _0xc977ef=_0x540fdc[_0x513f('0x21')];var _0x6fb66d=_0x540fdc['baseUrl']+_0x513f('0x2f')+_0x5fba9c+'/messages/';var _0x4c5867={'to':[_0x43bc6a[_0x513f('0x22')]],'message':{'type':_0x513f('0x30'),'text':_0x43bc6a[_0x513f('0xd')]}};var _0x26ccda={'method':_0x513f('0x31'),'uri':_0x6fb66d,'headers':{'Authorization':_0x513f('0x32')+_0xc977ef,'Content-Type':'application/json'},'body':_0x4c5867,'json':!![]};rp(_0x26ccda)[_0x513f('0x18')](function(_0xa4468c){if(_0xa4468c[_0x513f('0x33')][0x0][_0x513f('0x34')]){return _0x296beb[_0x513f('0x19')]({'messageId':_0xa4468c[_0x513f('0x33')][0x0][_0x513f('0x34')]});}})[_0x513f('0x1a')](function(_0x1377b8){logger[_0x513f('0x35')](_0x513f('0x36'),_0x1377b8);});break;}}})[_0x513f('0x37')](function(){_0x15731a();});}else{_0x15731a();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index fedd535..c778c82 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 _0x4210=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','then','lodash','moment','bluebird','randomstring'];(function(_0x1995da,_0x570dec){var _0x47a138=function(_0x649b70){while(--_0x649b70){_0x1995da['push'](_0x1995da['shift']());}};_0x47a138(++_0x570dec);}(_0x4210,0xa1));var _0x0421=function(_0x394e29,_0x1ca037){_0x394e29=_0x394e29-0x0;var _0x21f585=_0x4210[_0x394e29];return _0x21f585;};'use strict';var _=require(_0x0421('0x0'));var util=require('util');var moment=require(_0x0421('0x1'));var BPromise=require(_0x0421('0x2'));var rs=require(_0x0421('0x3'));var fs=require('fs');var Redis=require(_0x0421('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0421('0x5'));var logger=require(_0x0421('0x6'))(_0x0421('0x7'));var config=require(_0x0421('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0421('0x9')]({'port':0x232a});config[_0x0421('0xa')]=_[_0x0421('0xb')](config[_0x0421('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0421('0xc'))(new Redis(config[_0x0421('0xa')]));require(_0x0421('0xd'))[_0x0421('0xe')](socket);function respondWithRpcPromise(_0x344fbe,_0x455d2f,_0x92612d){return new BPromise(function(_0x559421,_0x6c5c2f){return client[_0x0421('0xf')](_0x344fbe,_0x92612d)['then'](function(_0x15da1c){logger[_0x0421('0x10')](_0x0421('0x11'),_0x455d2f,_0x0421('0x12'));logger[_0x0421('0x13')](_0x0421('0x14'),_0x455d2f,_0x0421('0x12'),JSON[_0x0421('0x15')](_0x15da1c));if(_0x15da1c[_0x0421('0x16')]){if(_0x15da1c[_0x0421('0x16')][_0x0421('0x17')]===0x1f4){logger[_0x0421('0x16')](_0x0421('0x11'),_0x455d2f,_0x15da1c[_0x0421('0x16')][_0x0421('0x18')]);return _0x6c5c2f(_0x15da1c[_0x0421('0x16')][_0x0421('0x18')]);}logger['error'](_0x0421('0x11'),_0x455d2f,_0x15da1c['error']['message']);return _0x559421(_0x15da1c['error']['message']);}else{logger[_0x0421('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x455d2f,_0x0421('0x12'));_0x559421(_0x15da1c[_0x0421('0x19')][_0x0421('0x18')]);}})[_0x0421('0x1a')](function(_0x699355){logger[_0x0421('0x16')](_0x0421('0x11'),_0x455d2f,_0x699355);_0x6c5c2f(_0x699355);});});}exports[_0x0421('0x1b')]=function(_0x17c809){var _0x4b21f2=this;return new Promise(function(_0x2e429a,_0x47b5a0){return db[_0x0421('0x1c')][_0x0421('0x1d')](_0x17c809['body'],{'raw':_0x17c809[_0x0421('0x1e')]?_0x17c809[_0x0421('0x1e')][_0x0421('0x1f')]===undefined?!![]:![]:!![]})[_0x0421('0x20')](function(_0x3612aa){logger[_0x0421('0x10')](_0x0421('0x1b'),_0x17c809);logger['debug']('CreateWhatsappMessage',_0x17c809,JSON['stringify'](_0x3612aa));_0x2e429a(_0x3612aa);})[_0x0421('0x1a')](function(_0x2f3300){logger[_0x0421('0x16')](_0x0421('0x1b'),_0x2f3300[_0x0421('0x18')],_0x17c809);_0x47b5a0(_0x4b21f2[_0x0421('0x16')](0x1f4,_0x2f3300[_0x0421('0x18')]));});});}; \ No newline at end of file +var _0x9323=['body','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create'];(function(_0x247a0d,_0xbb4651){var _0x34601e=function(_0x558706){while(--_0x558706){_0x247a0d['push'](_0x247a0d['shift']());}};_0x34601e(++_0xbb4651);}(_0x9323,0x6c));var _0x3932=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9323[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3932('0x0'));var util=require(_0x3932('0x1'));var moment=require(_0x3932('0x2'));var BPromise=require(_0x3932('0x3'));var rs=require(_0x3932('0x4'));var fs=require('fs');var Redis=require(_0x3932('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3932('0x6'));var logger=require(_0x3932('0x7'))(_0x3932('0x8'));var config=require(_0x3932('0x9'));var jayson=require(_0x3932('0xa'));var client=jayson['client'][_0x3932('0xb')]({'port':0x232a});config[_0x3932('0xc')]=_['defaults'](config['redis'],{'host':_0x3932('0xd'),'port':0x18eb});var socket=require(_0x3932('0xe'))(new Redis(config[_0x3932('0xc')]));require(_0x3932('0xf'))[_0x3932('0x10')](socket);function respondWithRpcPromise(_0x54febd,_0x508949,_0x7e1719){return new BPromise(function(_0x506671,_0x5679d9){return client[_0x3932('0x11')](_0x54febd,_0x7e1719)['then'](function(_0x18d921){logger[_0x3932('0x12')](_0x3932('0x13'),_0x508949,_0x3932('0x14'));logger[_0x3932('0x15')](_0x3932('0x16'),_0x508949,'request\x20sent',JSON[_0x3932('0x17')](_0x18d921));if(_0x18d921[_0x3932('0x18')]){if(_0x18d921[_0x3932('0x18')][_0x3932('0x19')]===0x1f4){logger['error'](_0x3932('0x13'),_0x508949,_0x18d921[_0x3932('0x18')]['message']);return _0x5679d9(_0x18d921['error']['message']);}logger[_0x3932('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x508949,_0x18d921[_0x3932('0x18')][_0x3932('0x1a')]);return _0x506671(_0x18d921['error'][_0x3932('0x1a')]);}else{logger[_0x3932('0x12')](_0x3932('0x13'),_0x508949,_0x3932('0x14'));_0x506671(_0x18d921[_0x3932('0x1b')]['message']);}})[_0x3932('0x1c')](function(_0x14067f){logger[_0x3932('0x18')](_0x3932('0x13'),_0x508949,_0x14067f);_0x5679d9(_0x14067f);});});}exports[_0x3932('0x1d')]=function(_0x53da4d){var _0x5f24c8=this;return new Promise(function(_0x456157,_0x5dfa14){return db[_0x3932('0x1e')][_0x3932('0x1f')](_0x53da4d[_0x3932('0x20')],{'raw':_0x53da4d['options']?_0x53da4d['options'][_0x3932('0x21')]===undefined?!![]:![]:!![]})[_0x3932('0x22')](function(_0x5ecc1b){logger['info'](_0x3932('0x1d'),_0x53da4d);logger[_0x3932('0x15')]('CreateWhatsappMessage',_0x53da4d,JSON['stringify'](_0x5ecc1b));_0x456157(_0x5ecc1b);})['catch'](function(_0x417c1f){logger[_0x3932('0x18')]('CreateWhatsappMessage',_0x417c1f[_0x3932('0x1a')],_0x53da4d);_0x5dfa14(_0x5f24c8[_0x3932('0x18')](0x1f4,_0x417c1f[_0x3932('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index bcbdfe4..4447b2e 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 _0xa721=['removeListener','register','./whatsappMessage.events','save','remove','emit'];(function(_0x3c4a4f,_0x19eb56){var _0x6c7fc0=function(_0x1064b9){while(--_0x1064b9){_0x3c4a4f['push'](_0x3c4a4f['shift']());}};_0x6c7fc0(++_0x19eb56);}(_0xa721,0x12e));var _0x1a72=function(_0x3a93dd,_0x3d9241){_0x3a93dd=_0x3a93dd-0x0;var _0x1994e7=_0xa721[_0x3a93dd];return _0x1994e7;};'use strict';var WhatsappMessageEvents=require(_0x1a72('0x0'));var events=[_0x1a72('0x1'),_0x1a72('0x2'),'update'];function createListener(_0x526a04,_0x31bf5c){return function(_0x561b1d){_0x31bf5c[_0x1a72('0x3')](_0x526a04,_0x561b1d);};}function removeListener(_0x58d767,_0x33e78e){return function(){WhatsappMessageEvents[_0x1a72('0x4')](_0x58d767,_0x33e78e);};}exports[_0x1a72('0x5')]=function(_0x51cda9){for(var _0x379249=0x0,_0x17d46b=events['length'];_0x379249<_0x17d46b;_0x379249++){var _0x100654=events[_0x379249];var _0x57e84f=createListener('whatsappMessage:'+_0x100654,_0x51cda9);WhatsappMessageEvents['on'](_0x100654,_0x57e84f);}}; \ No newline at end of file +var _0xd295=['update','emit','removeListener','length','./whatsappMessage.events','save','remove'];(function(_0x347cd0,_0xb2fbb2){var _0x41133c=function(_0x218504){while(--_0x218504){_0x347cd0['push'](_0x347cd0['shift']());}};_0x41133c(++_0xb2fbb2);}(_0xd295,0xe4));var _0x5d29=function(_0x47ee09,_0x50e857){_0x47ee09=_0x47ee09-0x0;var _0xe33d33=_0xd295[_0x47ee09];return _0xe33d33;};'use strict';var WhatsappMessageEvents=require(_0x5d29('0x0'));var events=[_0x5d29('0x1'),_0x5d29('0x2'),_0x5d29('0x3')];function createListener(_0x3a3302,_0x36006e){return function(_0x1d22d1){_0x36006e[_0x5d29('0x4')](_0x3a3302,_0x1d22d1);};}function removeListener(_0x5168d1,_0x4c8780){return function(){WhatsappMessageEvents[_0x5d29('0x5')](_0x5168d1,_0x4c8780);};}exports['register']=function(_0x281924){for(var _0xc8afe4=0x0,_0x110c30=events[_0x5d29('0x6')];_0xc8afe4<_0x110c30;_0xc8afe4++){var _0x250924=events[_0xc8afe4];var _0x2c2cec=createListener('whatsappMessage:'+_0x250924,_0x281924);WhatsappMessageEvents['on'](_0x250924,_0x2c2cec);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c1666f1..e1c703d 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 _0xfc5d=['get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller'];(function(_0x4d4690,_0x553bf8){var _0x5f32d1=function(_0x383771){while(--_0x383771){_0x4d4690['push'](_0x4d4690['shift']());}};_0x5f32d1(++_0x553bf8);}(_0xfc5d,0x116));var _0xdfc5=function(_0x485161,_0x3a5d6f){_0x485161=_0x485161-0x0;var _0x2c9dc0=_0xfc5d[_0x485161];return _0x2c9dc0;};'use strict';var multer=require(_0xdfc5('0x0'));var util=require(_0xdfc5('0x1'));var path=require(_0xdfc5('0x2'));var timeout=require(_0xdfc5('0x3'));var express=require(_0xdfc5('0x4'));var router=express[_0xdfc5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdfc5('0x6'));var interaction=require(_0xdfc5('0x7'));var config=require(_0xdfc5('0x8'));var controller=require(_0xdfc5('0x9'));router[_0xdfc5('0xa')]('/',auth[_0xdfc5('0xb')](),controller['index']);router[_0xdfc5('0xa')](_0xdfc5('0xc'),auth[_0xdfc5('0xb')](),controller[_0xdfc5('0xd')]);router['get']('/:id',auth[_0xdfc5('0xb')](),controller[_0xdfc5('0xe')]);router[_0xdfc5('0xa')](_0xdfc5('0xf'),auth[_0xdfc5('0xb')](),controller[_0xdfc5('0x10')]);router[_0xdfc5('0xa')](_0xdfc5('0x11'),auth[_0xdfc5('0xb')](),controller['getTeams']);router[_0xdfc5('0xa')](_0xdfc5('0x12'),auth[_0xdfc5('0xb')](),controller[_0xdfc5('0x13')]);router[_0xdfc5('0x14')]('/',auth[_0xdfc5('0xb')](),controller[_0xdfc5('0x15')]);router[_0xdfc5('0x14')](_0xdfc5('0x11'),auth['isAuthenticated'](),controller[_0xdfc5('0x16')]);router[_0xdfc5('0x14')](_0xdfc5('0x12'),auth[_0xdfc5('0xb')](),controller[_0xdfc5('0x17')]);router[_0xdfc5('0x18')](_0xdfc5('0x19'),auth['isAuthenticated'](),controller[_0xdfc5('0x1a')]);router[_0xdfc5('0x1b')](_0xdfc5('0x19'),auth[_0xdfc5('0xb')](),controller[_0xdfc5('0x1c')]);router[_0xdfc5('0x1b')](_0xdfc5('0x11'),auth['isAuthenticated'](),controller[_0xdfc5('0x1d')]);router[_0xdfc5('0x1b')](_0xdfc5('0x12'),auth[_0xdfc5('0xb')](),controller[_0xdfc5('0x1e')]);module[_0xdfc5('0x1f')]=router; \ No newline at end of file +var _0x4405=['path','connect-timeout','express','../../config/environment','./whatsappQueue.controller','isAuthenticated','describe','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','util'];(function(_0xe501ff,_0x955b7e){var _0x17135d=function(_0x8e3458){while(--_0x8e3458){_0xe501ff['push'](_0xe501ff['shift']());}};_0x17135d(++_0x955b7e);}(_0x4405,0xce));var _0x5440=function(_0x12348f,_0x25c8ab){_0x12348f=_0x12348f-0x0;var _0x3a9293=_0x4405[_0x12348f];return _0x3a9293;};'use strict';var multer=require(_0x5440('0x0'));var util=require(_0x5440('0x1'));var path=require(_0x5440('0x2'));var timeout=require(_0x5440('0x3'));var express=require(_0x5440('0x4'));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(_0x5440('0x5'));var controller=require(_0x5440('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x5440('0x7')](),controller[_0x5440('0x8')]);router['get'](_0x5440('0x9'),auth[_0x5440('0x7')](),controller[_0x5440('0xa')]);router[_0x5440('0xb')](_0x5440('0xc'),auth[_0x5440('0x7')](),controller[_0x5440('0xd')]);router[_0x5440('0xb')](_0x5440('0xe'),auth['isAuthenticated'](),controller[_0x5440('0xf')]);router[_0x5440('0xb')]('/:id/users',auth[_0x5440('0x7')](),controller[_0x5440('0x10')]);router[_0x5440('0x11')]('/',auth[_0x5440('0x7')](),controller['create']);router[_0x5440('0x11')](_0x5440('0xe'),auth[_0x5440('0x7')](),controller[_0x5440('0x12')]);router[_0x5440('0x11')]('/:id/users',auth[_0x5440('0x7')](),controller[_0x5440('0x13')]);router[_0x5440('0x14')](_0x5440('0x9'),auth[_0x5440('0x7')](),controller['update']);router['delete']('/:id',auth[_0x5440('0x7')](),controller['destroy']);router[_0x5440('0x15')](_0x5440('0xe'),auth[_0x5440('0x7')](),controller[_0x5440('0x16')]);router[_0x5440('0x15')](_0x5440('0x17'),auth[_0x5440('0x7')](),controller[_0x5440('0x18')]);module[_0x5440('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 4ecf9da..d6f595d 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 _0xbc9d=['sequelize','exports','STRING','name','INTEGER','roundrobin'];(function(_0x1b40a6,_0x529535){var _0x310ae0=function(_0x58a555){while(--_0x58a555){_0x1b40a6['push'](_0x1b40a6['shift']());}};_0x310ae0(++_0x529535);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x2da1ef,_0x4c0fbd){_0x2da1ef=_0x2da1ef-0x0;var _0x5900a4=_0xbc9d[_0x2da1ef];return _0x5900a4;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'unique':_0xdbc9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdbc9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xdbc9('0x5'))},'description':{'type':Sequelize[_0xdbc9('0x2')]}}; \ No newline at end of file +var _0x0434=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x1cabe5,_0x16524b){var _0x28d6de=function(_0x853899){while(--_0x853899){_0x1cabe5['push'](_0x1cabe5['shift']());}};_0x28d6de(++_0x16524b);}(_0x0434,0x1ad));var _0x4043=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x0434[_0x1d87fc];return _0x492b56;};'use strict';var Sequelize=require(_0x4043('0x0'));module[_0x4043('0x1')]={'name':{'type':Sequelize[_0x4043('0x2')],'unique':_0x4043('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4043('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x4043('0x5'),_0x4043('0x6'))},'description':{'type':Sequelize[_0x4043('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d79fedb..1adacd7 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 _0x98d3=['map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserWhatsappQueue','order','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','User','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','send'];(function(_0x9ddcfd,_0x53c5e9){var _0x572d20=function(_0x1db8a2){while(--_0x1db8a2){_0x9ddcfd['push'](_0x9ddcfd['shift']());}};_0x572d20(++_0x53c5e9);}(_0x98d3,0xf0));var _0x398d=function(_0x3adf2f,_0x454485){_0x3adf2f=_0x3adf2f-0x0;var _0x2ead70=_0x98d3[_0x3adf2f];return _0x2ead70;};'use strict';var emlformat=require(_0x398d('0x0'));var rimraf=require(_0x398d('0x1'));var zipdir=require(_0x398d('0x2'));var jsonpatch=require(_0x398d('0x3'));var rp=require(_0x398d('0x4'));var moment=require(_0x398d('0x5'));var BPromise=require(_0x398d('0x6'));var Mustache=require(_0x398d('0x7'));var util=require('util');var path=require(_0x398d('0x8'));var sox=require(_0x398d('0x9'));var csv=require(_0x398d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x398d('0xb'));var _=require('lodash');var squel=require(_0x398d('0xc'));var crypto=require(_0x398d('0xd'));var jsforce=require(_0x398d('0xe'));var deskjs=require(_0x398d('0xf'));var toCsv=require(_0x398d('0xa'));var querystring=require(_0x398d('0x10'));var Papa=require('papaparse');var Redis=require(_0x398d('0x11'));var authService=require(_0x398d('0x12'));var qs=require(_0x398d('0x13'));var as=require(_0x398d('0x14'));var hardwareService=require(_0x398d('0x15'));var logger=require('../../config/logger')(_0x398d('0x16'));var utils=require(_0x398d('0x17'));var config=require(_0x398d('0x18'));var licenseUtil=require(_0x398d('0x19'));var db=require('../../mysqldb')['db'];config[_0x398d('0x1a')]=_[_0x398d('0x1b')](config[_0x398d('0x1a')],{'host':_0x398d('0x1c'),'port':0x18eb});var socket=require(_0x398d('0x1d'))(new Redis(config[_0x398d('0x1a')]));require(_0x398d('0x1e'))[_0x398d('0x1f')](socket);function respondWithStatusCode(_0x5c9fe7,_0xd3ea46){_0xd3ea46=_0xd3ea46||0xcc;return function(_0x2c4d1e){if(_0x2c4d1e){return _0x5c9fe7[_0x398d('0x20')](_0xd3ea46);}return _0x5c9fe7[_0x398d('0x21')](_0xd3ea46)['end']();};}function respondWithResult(_0x1fbd6f,_0x3c2475){_0x3c2475=_0x3c2475||0xc8;return function(_0x5d8859){if(_0x5d8859){return _0x1fbd6f[_0x398d('0x21')](_0x3c2475)[_0x398d('0x22')](_0x5d8859);}};}function respondWithFilteredResult(_0x2f59ed,_0x35b2b3){return function(_0x21b792){if(_0x21b792){var _0xa51dfc=typeof _0x35b2b3[_0x398d('0x23')]===_0x398d('0x24')&&typeof _0x35b2b3[_0x398d('0x25')]===_0x398d('0x24');var _0x144b49=_0x21b792['count'];var _0xb2e1c5=_0xa51dfc?0x0:_0x35b2b3[_0x398d('0x23')];var _0x386816=_0xa51dfc?_0x21b792[_0x398d('0x26')]:_0x35b2b3[_0x398d('0x23')]+_0x35b2b3[_0x398d('0x25')];var _0x684d4f;if(_0x386816>=_0x144b49){_0x386816=_0x144b49;_0x684d4f=0xc8;}else{_0x684d4f=0xce;}_0x2f59ed[_0x398d('0x21')](_0x684d4f);return _0x2f59ed[_0x398d('0x27')]('Content-Range',_0xb2e1c5+'-'+_0x386816+'/'+_0x144b49)['json'](_0x21b792);}return null;};}function patchUpdates(_0x5adc50){return function(_0x4672b8){try{jsonpatch[_0x398d('0x28')](_0x4672b8,_0x5adc50,!![]);}catch(_0x3d8f8d){return BPromise[_0x398d('0x29')](_0x3d8f8d);}return _0x4672b8[_0x398d('0x2a')]();};}function saveUpdates(_0x2583b1,_0x3aa9cb){return function(_0x4cb9d8){if(_0x4cb9d8){return _0x4cb9d8[_0x398d('0x2b')](_0x2583b1)[_0x398d('0x2c')](function(_0x1a87a9){return _0x1a87a9;});}return null;};}function removeEntity(_0x2cc61f,_0x281e64){return function(_0x5670a9){if(_0x5670a9){return _0x5670a9['destroy']()[_0x398d('0x2c')](function(){var _0x22581c=_0x5670a9[_0x398d('0x2d')]({'plain':!![]});var _0x301964=_0x398d('0x2e');return db[_0x398d('0x2f')][_0x398d('0x30')]({'where':{'type':_0x301964,'resourceId':_0x22581c['id']}})['then'](function(){return _0x5670a9;});})[_0x398d('0x2c')](function(){_0x2cc61f[_0x398d('0x21')](0xcc)[_0x398d('0x31')]();});}};}function handleEntityNotFound(_0x23f010,_0x4366dc){return function(_0x42ea58){if(!_0x42ea58){_0x23f010[_0x398d('0x20')](0x194);}return _0x42ea58;};}function handleError(_0x44e5f4,_0x5ae847){_0x5ae847=_0x5ae847||0x1f4;return function(_0x1c927e){logger[_0x398d('0x32')](_0x1c927e[_0x398d('0x33')]);if(_0x1c927e[_0x398d('0x34')]){delete _0x1c927e[_0x398d('0x34')];}_0x44e5f4[_0x398d('0x21')](_0x5ae847)[_0x398d('0x35')](_0x1c927e);};}exports['index']=function(_0x46cba3,_0x2a69d4){var _0x1b90e5={},_0x28a29c={},_0x14a6c2={'count':0x0,'rows':[]};var _0x22ef44=_[_0x398d('0x36')](db[_0x398d('0x37')][_0x398d('0x38')],function(_0xc3582a){return{'name':_0xc3582a[_0x398d('0x39')],'type':_0xc3582a[_0x398d('0x3a')][_0x398d('0x3b')]};});_0x28a29c[_0x398d('0x3c')]=_[_0x398d('0x36')](_0x22ef44,'name');_0x28a29c[_0x398d('0x3d')]=_[_0x398d('0x3e')](_0x46cba3[_0x398d('0x3d')]);_0x28a29c[_0x398d('0x3f')]=_[_0x398d('0x40')](_0x28a29c['model'],_0x28a29c[_0x398d('0x3d')]);_0x1b90e5[_0x398d('0x41')]=_['intersection'](_0x28a29c[_0x398d('0x3c')],qs['fields'](_0x46cba3[_0x398d('0x3d')][_0x398d('0x42')]));_0x1b90e5[_0x398d('0x41')]=_0x1b90e5[_0x398d('0x41')][_0x398d('0x43')]?_0x1b90e5['attributes']:_0x28a29c[_0x398d('0x3c')];if(!_0x46cba3[_0x398d('0x3d')][_0x398d('0x44')](_0x398d('0x45'))){_0x1b90e5['limit']=qs[_0x398d('0x25')](_0x46cba3[_0x398d('0x3d')][_0x398d('0x25')]);_0x1b90e5[_0x398d('0x23')]=qs['offset'](_0x46cba3[_0x398d('0x3d')][_0x398d('0x23')]);}_0x1b90e5['order']=qs[_0x398d('0x46')](_0x46cba3[_0x398d('0x3d')][_0x398d('0x46')]);_0x1b90e5[_0x398d('0x47')]=qs[_0x398d('0x3f')](_[_0x398d('0x48')](_0x46cba3[_0x398d('0x3d')],_0x28a29c['filters']),_0x22ef44);if(_0x46cba3[_0x398d('0x3d')][_0x398d('0x49')]){_0x1b90e5[_0x398d('0x47')]=_['merge'](_0x1b90e5[_0x398d('0x47')],{'$or':_[_0x398d('0x36')](_0x22ef44,function(_0x43bb72){if(_0x43bb72['type']!==_0x398d('0x4a')){var _0x4d9e38={};_0x4d9e38[_0x43bb72[_0x398d('0x34')]]={'$like':'%'+_0x46cba3['query'][_0x398d('0x49')]+'%'};return _0x4d9e38;}})});}_0x1b90e5=_[_0x398d('0x4b')]({},_0x1b90e5,_0x46cba3[_0x398d('0x4c')]);var _0x30321e={'where':_0x1b90e5[_0x398d('0x47')]};return db['WhatsappQueue'][_0x398d('0x26')](_0x30321e)['then'](function(_0x4cf061){_0x14a6c2[_0x398d('0x26')]=_0x4cf061;if(_0x46cba3['query']['includeAll']){_0x1b90e5[_0x398d('0x4d')]=[{'all':!![]}];}return db[_0x398d('0x37')][_0x398d('0x4e')](_0x1b90e5);})[_0x398d('0x2c')](function(_0x5db6b2){_0x14a6c2[_0x398d('0x4f')]=_0x5db6b2;return _0x14a6c2;})[_0x398d('0x2c')](respondWithFilteredResult(_0x2a69d4,_0x1b90e5))[_0x398d('0x50')](handleError(_0x2a69d4,null));};exports[_0x398d('0x51')]=function(_0x48a1e4,_0x4a2999){var _0x66eb1={'raw':!![],'where':{'id':_0x48a1e4[_0x398d('0x52')]['id']}},_0x387c7b={};_0x387c7b[_0x398d('0x3c')]=_[_0x398d('0x3e')](db['WhatsappQueue'][_0x398d('0x38')]);_0x387c7b[_0x398d('0x3d')]=_[_0x398d('0x3e')](_0x48a1e4[_0x398d('0x3d')]);_0x387c7b[_0x398d('0x3f')]=_[_0x398d('0x40')](_0x387c7b[_0x398d('0x3c')],_0x387c7b[_0x398d('0x3d')]);_0x66eb1[_0x398d('0x41')]=_[_0x398d('0x40')](_0x387c7b[_0x398d('0x3c')],qs[_0x398d('0x42')](_0x48a1e4[_0x398d('0x3d')][_0x398d('0x42')]));_0x66eb1[_0x398d('0x41')]=_0x66eb1['attributes'][_0x398d('0x43')]?_0x66eb1[_0x398d('0x41')]:_0x387c7b[_0x398d('0x3c')];if(_0x48a1e4[_0x398d('0x3d')][_0x398d('0x53')]){_0x66eb1[_0x398d('0x4d')]=[{'all':!![]}];}_0x66eb1=_[_0x398d('0x4b')]({},_0x66eb1,_0x48a1e4[_0x398d('0x4c')]);return db[_0x398d('0x37')]['find'](_0x66eb1)[_0x398d('0x2c')](handleEntityNotFound(_0x4a2999,null))[_0x398d('0x2c')](respondWithResult(_0x4a2999,null))[_0x398d('0x50')](handleError(_0x4a2999,null));};exports['create']=function(_0x2c4728,_0x4b56b6){return db[_0x398d('0x37')]['create'](_0x2c4728[_0x398d('0x54')],{})['then'](function(_0x505eee){var _0x3233ec=_0x2c4728[_0x398d('0x55')][_0x398d('0x2d')]({'plain':!![]});if(!_0x3233ec)throw new Error(_0x398d('0x56'));if(_0x3233ec[_0x398d('0x57')]===_0x398d('0x55')){var _0x15b0e0=_0x505eee['get']({'plain':!![]});var _0xcbf686=_0x398d('0x2e');return db[_0x398d('0x58')]['find']({'where':{'name':_0xcbf686,'userProfileId':_0x3233ec[_0x398d('0x59')]},'raw':!![]})['then'](function(_0x2c4fb8){if(_0x2c4fb8&&_0x2c4fb8[_0x398d('0x5a')]===0x0){return db[_0x398d('0x2f')]['create']({'name':_0x15b0e0['name'],'resourceId':_0x15b0e0['id'],'type':_0x2c4fb8['name'],'sectionId':_0x2c4fb8['id']},{})[_0x398d('0x2c')](function(){return _0x505eee;});}else{return _0x505eee;}})[_0x398d('0x50')](function(_0x4c7c3a){logger['error'](_0x398d('0x5b'),_0x4c7c3a);throw _0x4c7c3a;});}return _0x505eee;})[_0x398d('0x2c')](respondWithResult(_0x4b56b6,0xc9))['catch'](handleError(_0x4b56b6,null));};exports[_0x398d('0x2b')]=function(_0x1efc8b,_0xc374cf){if(_0x1efc8b['body']['id']){delete _0x1efc8b[_0x398d('0x54')]['id'];}return db[_0x398d('0x37')][_0x398d('0x5c')]({'where':{'id':_0x1efc8b[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](handleEntityNotFound(_0xc374cf,null))[_0x398d('0x2c')](saveUpdates(_0x1efc8b['body'],null))[_0x398d('0x2c')](respondWithResult(_0xc374cf,null))[_0x398d('0x50')](handleError(_0xc374cf,null));};exports['destroy']=function(_0x33106f,_0x47db75){return db[_0x398d('0x37')]['find']({'where':{'id':_0x33106f[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](handleEntityNotFound(_0x47db75,null))[_0x398d('0x2c')](removeEntity(_0x47db75,null))[_0x398d('0x50')](handleError(_0x47db75,null));};exports[_0x398d('0x5d')]=function(_0x18c755,_0x46e965){return db['WhatsappQueue'][_0x398d('0x5d')]()[_0x398d('0x2c')](respondWithResult(_0x46e965,null))[_0x398d('0x50')](handleError(_0x46e965,null));};exports['getMembers']=function(_0xd62919,_0x3f0392,_0x52e69c){var _0x1e4763={'raw':!![],'where':{}},_0x41347f={},_0x133283;return db[_0x398d('0x37')][_0x398d('0x5e')]({'where':{'id':_0xd62919[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](handleEntityNotFound(_0x3f0392,null))[_0x398d('0x2c')](function(_0x21bee8){if(_0x21bee8){_0x133283=_0x21bee8['get']({'plain':!![]});_0x41347f[_0x398d('0x3c')]=_[_0x398d('0x3e')](db[_0x398d('0x5f')][_0x398d('0x38')]);_0x41347f[_0x398d('0x3d')]=_[_0x398d('0x3e')](_0xd62919[_0x398d('0x3d')]);_0x41347f[_0x398d('0x3f')]=_['intersection'](_0x41347f[_0x398d('0x3c')],_0x41347f['query']);_0x1e4763[_0x398d('0x41')]=_['intersection'](_0x41347f['model'],qs[_0x398d('0x42')](_0xd62919[_0x398d('0x3d')][_0x398d('0x42')]));_0x1e4763[_0x398d('0x41')]=_0x1e4763[_0x398d('0x41')]['length']?_0x1e4763['attributes']:_0x41347f[_0x398d('0x3c')];if(!_0xd62919['query'][_0x398d('0x44')]('nolimit')){_0x1e4763['limit']=qs[_0x398d('0x25')](_0xd62919[_0x398d('0x3d')]['limit']);_0x1e4763[_0x398d('0x23')]=qs[_0x398d('0x23')](_0xd62919[_0x398d('0x3d')][_0x398d('0x23')]);}_0x1e4763[_0x398d('0x60')]=qs[_0x398d('0x46')](_0xd62919[_0x398d('0x3d')][_0x398d('0x46')]);_0x1e4763[_0x398d('0x47')]=qs[_0x398d('0x3f')](_['pick'](_0xd62919[_0x398d('0x3d')],_0x41347f['filters']));_0x1e4763[_0x398d('0x47')][_0x398d('0x61')]=_0x21bee8['id'];if(_0xd62919[_0x398d('0x3d')][_0x398d('0x49')]){_0x1e4763[_0x398d('0x47')]=_[_0x398d('0x4b')](_0x1e4763['where'],{'$or':_[_0x398d('0x36')](_0x1e4763[_0x398d('0x41')],function(_0x580581){var _0x1ac7ba={};_0x1ac7ba[_0x580581]={'$like':'%'+_0xd62919['query']['filter']+'%'};return _0x1ac7ba;})});}_0x1e4763=_['merge']({},_0x1e4763,_0xd62919[_0x398d('0x4c')]);return db[_0x398d('0x5f')]['findAll'](_0x1e4763);}})[_0x398d('0x2c')](function(_0x50bae3){if(_0x50bae3){return db['User'][_0x398d('0x62')]({'where':{'id':_['map'](_0x50bae3,_0x398d('0x63')),'role':_0x398d('0x64')},'attributes':['id',_0x398d('0x34'),_0x398d('0x65'),'updatedAt',_0x398d('0x66')]});}})['then'](function(_0x5d0f7a){if(_0x5d0f7a){return{'count':_0x5d0f7a[_0x398d('0x26')],'rows':_[_0x398d('0x36')](_0x5d0f7a[_0x398d('0x4f')],function(_0x20ded8){return{'membername':_0x20ded8['name'],'UserId':_0x20ded8['id'],'queue_name':_0x133283[_0x398d('0x34')],'WhatsappQueueId':_0x133283['id'],'interface':util['format'](_0x398d('0x67'),_0x398d('0x68'),_0x20ded8[_0x398d('0x34')]),'penalty':0x0,'paused':_0x20ded8[_0x398d('0x65')],'createdAt':_0x20ded8[_0x398d('0x66')],'updatedAt':_0x20ded8[_0x398d('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x398d('0x2c')](respondWithFilteredResult(_0x3f0392,_0x1e4763))[_0x398d('0x50')](handleError(_0x3f0392,null));};exports['getTeams']=function(_0xe12e22,_0x365090,_0x522dd0){var _0x47e9ba={};var _0xdfa500={};var _0x45bcc5;var _0x509b88;return db[_0x398d('0x37')]['findOne']({'where':{'id':_0xe12e22[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](handleEntityNotFound(_0x365090,null))['then'](function(_0x17c818){if(_0x17c818){_0x45bcc5=_0x17c818;_0xdfa500[_0x398d('0x3c')]=_[_0x398d('0x3e')](db[_0x398d('0x6a')][_0x398d('0x38')]);_0xdfa500['query']=_['keys'](_0xe12e22[_0x398d('0x3d')]);_0xdfa500[_0x398d('0x3f')]=_[_0x398d('0x40')](_0xdfa500['model'],_0xdfa500['query']);_0x47e9ba['attributes']=_[_0x398d('0x40')](_0xdfa500[_0x398d('0x3c')],qs[_0x398d('0x42')](_0xe12e22[_0x398d('0x3d')][_0x398d('0x42')]));_0x47e9ba[_0x398d('0x41')]=_0x47e9ba[_0x398d('0x41')]['length']?_0x47e9ba[_0x398d('0x41')]:_0xdfa500[_0x398d('0x3c')];_0x47e9ba['order']=qs[_0x398d('0x46')](_0xe12e22['query']['sort']);_0x47e9ba[_0x398d('0x47')]=qs['filters'](_[_0x398d('0x48')](_0xe12e22[_0x398d('0x3d')],_0xdfa500[_0x398d('0x3f')]));if(_0xe12e22[_0x398d('0x3d')][_0x398d('0x49')]){_0x47e9ba[_0x398d('0x47')]=_[_0x398d('0x4b')](_0x47e9ba[_0x398d('0x47')],{'$or':_[_0x398d('0x36')](_0x47e9ba[_0x398d('0x41')],function(_0x55394e){var _0x2e0d38={};_0x2e0d38[_0x55394e]={'$like':'%'+_0xe12e22[_0x398d('0x3d')]['filter']+'%'};return _0x2e0d38;})});}_0x47e9ba=_[_0x398d('0x4b')]({},_0x47e9ba,_0xe12e22[_0x398d('0x4c')]);return _0x45bcc5['getTeams'](_0x47e9ba);}})['then'](function(_0x5bb973){if(_0x5bb973){_0x509b88=_0x5bb973[_0x398d('0x43')];if(!_0xe12e22[_0x398d('0x3d')][_0x398d('0x44')]('nolimit')){_0x47e9ba[_0x398d('0x25')]=qs[_0x398d('0x25')](_0xe12e22[_0x398d('0x3d')][_0x398d('0x25')]);_0x47e9ba[_0x398d('0x23')]=qs[_0x398d('0x23')](_0xe12e22[_0x398d('0x3d')][_0x398d('0x23')]);}return _0x45bcc5[_0x398d('0x6b')](_0x47e9ba);}})[_0x398d('0x2c')](function(_0x2e9a8a){if(_0x2e9a8a){return _0x2e9a8a?{'count':_0x509b88,'rows':_0x2e9a8a}:null;}})[_0x398d('0x2c')](respondWithResult(_0x365090,null))['catch'](handleError(_0x365090,null));};exports['addTeams']=function(_0x3bac7a,_0x30fd7c,_0x2d075c){var _0x1c5ad5=_0x3bac7a[_0x398d('0x54')]['ids'];return db[_0x398d('0x6a')][_0x398d('0x4e')]({'where':{'id':_0x1c5ad5},'attributes':['id'],'include':[{'model':db[_0x398d('0x6c')],'as':_0x398d('0x6d'),'attributes':['id',_0x398d('0x34'),'online','voicePause',_0x398d('0x6e')],'raw':!![]}]})[_0x398d('0x2c')](function(_0x4dec23){if(_0x4dec23){var _0x2169ba=_[_0x398d('0x6f')](_0x4dec23,function(_0x5d880d){var _0x179bf9=_0x5d880d['get']({'plain':!![]});return _0x179bf9[_0x398d('0x6d')];});return db[_0x398d('0x37')]['find']({'where':{'id':_0x3bac7a[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](function(_0xc53fd7){return db[_0x398d('0x70')][_0x398d('0x71')](function(_0x3d16ec){return _0xc53fd7[_0x398d('0x72')](_0x1c5ad5,{'transaction':_0x3d16ec})['then'](function(){return BPromise[_0x398d('0x73')](_0x2169ba,function(_0x49d445){return db[_0x398d('0x5f')][_0x398d('0x74')]({'where':{'UserId':_0x49d445['id'],'WhatsappQueueId':_0x3bac7a[_0x398d('0x52')]['id']},'transaction':_0x3d16ec});});})[_0x398d('0x2c')](function(){_0x2169ba[_0x398d('0x75')](function(_0x472f0f){socket[_0x398d('0x76')](_0x398d('0x77'),{'UserId':_0x472f0f['id'],'WhatsappQueueId':_0xc53fd7['id']});});});});});}})[_0x398d('0x2c')](respondWithStatusCode(_0x30fd7c,null))[_0x398d('0x50')](handleError(_0x30fd7c,null));};exports['removeTeams']=function(_0x165a0e,_0x377121,_0x31a393){return db[_0x398d('0x6a')]['findAll']({'where':{'id':_0x165a0e[_0x398d('0x3d')][_0x398d('0x78')]},'attributes':['id'],'include':[{'model':db[_0x398d('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x398d('0x2c')](handleEntityNotFound(_0x377121,null))[_0x398d('0x2c')](function(_0x26d333){var _0x289036=_[_0x398d('0x36')](_0x26d333,'id');var _0xad2e03=[];var _0x5033d0=[];var _0x884be=squel[_0x398d('0x79')]();_0x884be[_0x398d('0x7a')]('tq.TeamId')[_0x398d('0x7b')]('team_has_whatsapp_queues','tq')[_0x398d('0x7c')](_0x398d('0x7d'),'ut',_0x398d('0x7e'))['where'](_0x398d('0x7f'),_0x165a0e[_0x398d('0x52')]['id']);for(var _0xf6b6c1=0x0;_0xf6b6c1<_0x26d333[_0x398d('0x43')];_0xf6b6c1+=0x1){let _0x420459=_0x26d333[_0xf6b6c1];for(var _0x575a11=0x0;_0x575a11<_0x420459['Agents'][_0x398d('0x43')];_0x575a11+=0x1){let _0x3a86a0=_0x420459[_0x398d('0x6d')][_0x575a11];var _0x24de8d=_0x884be[_0x398d('0x80')]();_0x24de8d[_0x398d('0x47')](_0x398d('0x81'),_0x3a86a0['id']);_0x5033d0[_0x398d('0x82')](db[_0x398d('0x70')][_0x398d('0x3d')](_0x24de8d[_0x398d('0x83')](),{'type':db['sequelize'][_0x398d('0x84')][_0x398d('0x85')]})['then'](function(_0x473fb5){if(_0x473fb5['length']===0x1){return _0x3a86a0['id'];}else{var _0x412566=_[_0x398d('0x86')](_[_0x398d('0x36')](_0x473fb5,_0x398d('0x87')),function(_0x4fe0d0){return _[_0x398d('0x88')](_0x289036,_0x4fe0d0);});if(_0x412566){return _0x3a86a0['id'];}}}));}}return BPromise[_0x398d('0x89')](_0x5033d0)[_0x398d('0x2c')](function(_0x5f40a7){_0xad2e03=_(_0xad2e03)[_0x398d('0x8a')](_0x5f40a7)[_0x398d('0x8b')]()['value']();return db[_0x398d('0x37')][_0x398d('0x5c')]({'where':{'id':_0x165a0e[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](function(_0x1683c2){return db[_0x398d('0x70')][_0x398d('0x71')](function(_0x41805b){return _0x1683c2[_0x398d('0x8c')](_0x165a0e[_0x398d('0x3d')][_0x398d('0x78')],{'transaction':_0x41805b})[_0x398d('0x2c')](function(){if(!_[_0x398d('0x8d')](_0xad2e03)){return _0x1683c2[_0x398d('0x8e')](_0xad2e03,{'transaction':_0x41805b});}})['then'](function(){_0xad2e03['forEach'](function(_0x3cf67f){socket[_0x398d('0x76')](_0x398d('0x8f'),{'UserId':_0x3cf67f,'WhatsappQueueId':_0x1683c2['id']});});});});});});})[_0x398d('0x2c')](respondWithStatusCode(_0x377121,null))[_0x398d('0x50')](handleError(_0x377121,null));};exports['addAgents']=function(_0x5deb0a,_0x416b3e,_0x49b020){return db['WhatsappQueue'][_0x398d('0x5c')]({'where':{'id':_0x5deb0a[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](handleEntityNotFound(_0x416b3e,null))[_0x398d('0x2c')](function(_0x33d148){if(_0x33d148){return _0x33d148['addAgents'](_0x5deb0a['body'][_0x398d('0x78')],_[_0x398d('0x90')](_0x5deb0a['body'],[_0x398d('0x78'),'id'])||{})[_0x398d('0x91')](function(_0xc1e75){for(var _0xbdf7c=0x0;_0xbdf7c<_0x5deb0a[_0x398d('0x54')][_0x398d('0x78')][_0x398d('0x43')];_0xbdf7c+=0x1){socket[_0x398d('0x76')](_0x398d('0x77'),{'UserId':Number(_0x5deb0a[_0x398d('0x54')][_0x398d('0x78')][_0xbdf7c]),'WhatsappQueueId':Number(_0x5deb0a[_0x398d('0x52')]['id'])});}return _0xc1e75;});}})[_0x398d('0x2c')](respondWithResult(_0x416b3e,null))[_0x398d('0x50')](handleError(_0x416b3e,null));};exports[_0x398d('0x8e')]=function(_0x5e3b0d,_0x14d281,_0x24d1b5){return db[_0x398d('0x37')][_0x398d('0x5c')]({'where':{'id':_0x5e3b0d[_0x398d('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d281,null))['then'](function(_0xe177d0){if(_0xe177d0){return _0xe177d0[_0x398d('0x8e')](_0x5e3b0d[_0x398d('0x3d')][_0x398d('0x78')])[_0x398d('0x2c')](function(){if(_['isArray'](_0x5e3b0d[_0x398d('0x3d')]['ids'])){for(var _0x261602=0x0;_0x261602<_0x5e3b0d[_0x398d('0x3d')][_0x398d('0x78')][_0x398d('0x43')];_0x261602+=0x1){socket[_0x398d('0x76')](_0x398d('0x8f'),{'UserId':Number(_0x5e3b0d['query']['ids'][_0x261602]),'WhatsappQueueId':Number(_0x5e3b0d[_0x398d('0x52')]['id'])});}}else{socket[_0x398d('0x76')](_0x398d('0x8f'),{'UserId':Number(_0x5e3b0d[_0x398d('0x3d')][_0x398d('0x78')]),'WhatsappQueueId':Number(_0x5e3b0d['params']['id'])});}});}})[_0x398d('0x2c')](respondWithStatusCode(_0x14d281,null))['catch'](handleError(_0x14d281,null));};exports['getAgents']=function(_0x555814,_0x331204,_0x543cf8){var _0x11c431={};var _0xa65fdb={};var _0x1ab74b;var _0x131ef1;return db[_0x398d('0x37')][_0x398d('0x5e')]({'where':{'id':_0x555814[_0x398d('0x52')]['id']}})[_0x398d('0x2c')](handleEntityNotFound(_0x331204,null))['then'](function(_0x4dce51){if(_0x4dce51){_0x1ab74b=_0x4dce51;_0xa65fdb['model']=_[_0x398d('0x3e')](db[_0x398d('0x6c')][_0x398d('0x38')]);_0xa65fdb[_0x398d('0x3d')]=_[_0x398d('0x3e')](_0x555814['query']);_0xa65fdb[_0x398d('0x3f')]=_['intersection'](_0xa65fdb[_0x398d('0x3c')],_0xa65fdb[_0x398d('0x3d')]);_0x11c431[_0x398d('0x41')]=_[_0x398d('0x40')](_0xa65fdb['model'],qs[_0x398d('0x42')](_0x555814[_0x398d('0x3d')]['fields']));_0x11c431['attributes']=_0x11c431['attributes'][_0x398d('0x43')]?_0x11c431[_0x398d('0x41')]:_0xa65fdb[_0x398d('0x3c')];_0x11c431['order']=qs[_0x398d('0x46')](_0x555814['query'][_0x398d('0x46')]);_0x11c431[_0x398d('0x47')]=qs[_0x398d('0x3f')](_['pick'](_0x555814['query'],_0xa65fdb[_0x398d('0x3f')]));if(_0x555814[_0x398d('0x3d')]['filter']){_0x11c431[_0x398d('0x47')]=_['merge'](_0x11c431[_0x398d('0x47')],{'$or':_[_0x398d('0x36')](_0x11c431[_0x398d('0x41')],function(_0x2eb0db){var _0x3d0844={};_0x3d0844[_0x2eb0db]={'$like':'%'+_0x555814[_0x398d('0x3d')][_0x398d('0x49')]+'%'};return _0x3d0844;})});}_0x11c431=_[_0x398d('0x4b')]({},_0x11c431,_0x555814[_0x398d('0x4c')]);return _0x1ab74b['getAgents'](_0x11c431);}})[_0x398d('0x2c')](function(_0x409b99){if(_0x409b99){_0x131ef1=_0x409b99[_0x398d('0x43')];if(!_0x555814[_0x398d('0x3d')][_0x398d('0x44')]('nolimit')){_0x11c431[_0x398d('0x25')]=qs[_0x398d('0x25')](_0x555814['query']['limit']);_0x11c431[_0x398d('0x23')]=qs[_0x398d('0x23')](_0x555814[_0x398d('0x3d')][_0x398d('0x23')]);}return _0x1ab74b[_0x398d('0x92')](_0x11c431);}})['then'](function(_0xef69df){if(_0xef69df){return _0xef69df?{'count':_0x131ef1,'rows':_0xef69df}:null;}})['then'](respondWithResult(_0x331204,null))[_0x398d('0x50')](handleError(_0x331204,null));}; \ No newline at end of file +var _0xd0db=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','find','userProfileId','params','describe','findOne','nolimit','pick','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','createdAt','rows','%s/%s','SIP','whatsappPause','getTeams','Team','Agents','online','interface','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','ids','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xda2239,_0x1565a9){var _0x2ef359=function(_0x368ac9){while(--_0x368ac9){_0xda2239['push'](_0xda2239['shift']());}};_0x2ef359(++_0x1565a9);}(_0xd0db,0x78));var _0xbd0d=function(_0x140d73,_0x10598d){_0x140d73=_0x140d73-0x0;var _0x50ca4d=_0xd0db[_0x140d73];return _0x50ca4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd0d('0x0'));var zipdir=require(_0xbd0d('0x1'));var jsonpatch=require(_0xbd0d('0x2'));var rp=require(_0xbd0d('0x3'));var moment=require('moment');var BPromise=require(_0xbd0d('0x4'));var Mustache=require(_0xbd0d('0x5'));var util=require(_0xbd0d('0x6'));var path=require(_0xbd0d('0x7'));var sox=require(_0xbd0d('0x8'));var csv=require(_0xbd0d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd0d('0xa'));var _=require('lodash');var squel=require(_0xbd0d('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0d('0xc'));var deskjs=require(_0xbd0d('0xd'));var toCsv=require(_0xbd0d('0x9'));var querystring=require(_0xbd0d('0xe'));var Papa=require(_0xbd0d('0xf'));var Redis=require(_0xbd0d('0x10'));var authService=require(_0xbd0d('0x11'));var qs=require(_0xbd0d('0x12'));var as=require(_0xbd0d('0x13'));var hardwareService=require(_0xbd0d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbd0d('0x15'));var config=require(_0xbd0d('0x16'));var licenseUtil=require(_0xbd0d('0x17'));var db=require(_0xbd0d('0x18'))['db'];config[_0xbd0d('0x19')]=_[_0xbd0d('0x1a')](config[_0xbd0d('0x19')],{'host':_0xbd0d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd0d('0x19')]));require(_0xbd0d('0x1c'))['register'](socket);function respondWithStatusCode(_0x2b84c9,_0x5bd0f){_0x5bd0f=_0x5bd0f||0xcc;return function(_0x371907){if(_0x371907){return _0x2b84c9['sendStatus'](_0x5bd0f);}return _0x2b84c9[_0xbd0d('0x1d')](_0x5bd0f)[_0xbd0d('0x1e')]();};}function respondWithResult(_0x24c23c,_0x1d37d4){_0x1d37d4=_0x1d37d4||0xc8;return function(_0x22d40c){if(_0x22d40c){return _0x24c23c['status'](_0x1d37d4)[_0xbd0d('0x1f')](_0x22d40c);}};}function respondWithFilteredResult(_0x9a144a,_0x185b3b){return function(_0x31ebaf){if(_0x31ebaf){var _0x47fae5=typeof _0x185b3b['offset']===_0xbd0d('0x20')&&typeof _0x185b3b[_0xbd0d('0x21')]===_0xbd0d('0x20');var _0x2772f3=_0x31ebaf['count'];var _0x198b04=_0x47fae5?0x0:_0x185b3b[_0xbd0d('0x22')];var _0x1fe9a8=_0x47fae5?_0x31ebaf[_0xbd0d('0x23')]:_0x185b3b[_0xbd0d('0x22')]+_0x185b3b['limit'];var _0x354551;if(_0x1fe9a8>=_0x2772f3){_0x1fe9a8=_0x2772f3;_0x354551=0xc8;}else{_0x354551=0xce;}_0x9a144a['status'](_0x354551);return _0x9a144a[_0xbd0d('0x24')](_0xbd0d('0x25'),_0x198b04+'-'+_0x1fe9a8+'/'+_0x2772f3)[_0xbd0d('0x1f')](_0x31ebaf);}return null;};}function patchUpdates(_0x34be3c){return function(_0x4998f0){try{jsonpatch[_0xbd0d('0x26')](_0x4998f0,_0x34be3c,!![]);}catch(_0x201a56){return BPromise[_0xbd0d('0x27')](_0x201a56);}return _0x4998f0[_0xbd0d('0x28')]();};}function saveUpdates(_0x48721a,_0x4f4e2e){return function(_0x2cb121){if(_0x2cb121){return _0x2cb121[_0xbd0d('0x29')](_0x48721a)[_0xbd0d('0x2a')](function(_0x475150){return _0x475150;});}return null;};}function removeEntity(_0x1a49a6,_0x380658){return function(_0x9cadd0){if(_0x9cadd0){return _0x9cadd0[_0xbd0d('0x2b')]()['then'](function(){var _0x4a016a=_0x9cadd0[_0xbd0d('0x2c')]({'plain':!![]});var _0x125694='WhatsappQueues';return db[_0xbd0d('0x2d')][_0xbd0d('0x2b')]({'where':{'type':_0x125694,'resourceId':_0x4a016a['id']}})['then'](function(){return _0x9cadd0;});})[_0xbd0d('0x2a')](function(){_0x1a49a6[_0xbd0d('0x1d')](0xcc)[_0xbd0d('0x1e')]();});}};}function handleEntityNotFound(_0x518386,_0x1e8e3e){return function(_0x463374){if(!_0x463374){_0x518386[_0xbd0d('0x2e')](0x194);}return _0x463374;};}function handleError(_0x2498f4,_0x21189b){_0x21189b=_0x21189b||0x1f4;return function(_0x328977){logger[_0xbd0d('0x2f')](_0x328977[_0xbd0d('0x30')]);if(_0x328977[_0xbd0d('0x31')]){delete _0x328977[_0xbd0d('0x31')];}_0x2498f4['status'](_0x21189b)[_0xbd0d('0x32')](_0x328977);};}exports['index']=function(_0x4b0139,_0x9abe95){var _0x1f8489={},_0x3a20f9={},_0x1d47d6={'count':0x0,'rows':[]};var _0x32bfc3=_[_0xbd0d('0x33')](db[_0xbd0d('0x34')][_0xbd0d('0x35')],function(_0x416410){return{'name':_0x416410[_0xbd0d('0x36')],'type':_0x416410['type'][_0xbd0d('0x37')]};});_0x3a20f9[_0xbd0d('0x38')]=_[_0xbd0d('0x33')](_0x32bfc3,_0xbd0d('0x31'));_0x3a20f9[_0xbd0d('0x39')]=_['keys'](_0x4b0139['query']);_0x3a20f9[_0xbd0d('0x3a')]=_[_0xbd0d('0x3b')](_0x3a20f9['model'],_0x3a20f9[_0xbd0d('0x39')]);_0x1f8489[_0xbd0d('0x3c')]=_[_0xbd0d('0x3b')](_0x3a20f9[_0xbd0d('0x38')],qs[_0xbd0d('0x3d')](_0x4b0139[_0xbd0d('0x39')]['fields']));_0x1f8489['attributes']=_0x1f8489['attributes'][_0xbd0d('0x3e')]?_0x1f8489[_0xbd0d('0x3c')]:_0x3a20f9[_0xbd0d('0x38')];if(!_0x4b0139[_0xbd0d('0x39')][_0xbd0d('0x3f')]('nolimit')){_0x1f8489[_0xbd0d('0x21')]=qs[_0xbd0d('0x21')](_0x4b0139[_0xbd0d('0x39')]['limit']);_0x1f8489[_0xbd0d('0x22')]=qs[_0xbd0d('0x22')](_0x4b0139[_0xbd0d('0x39')][_0xbd0d('0x22')]);}_0x1f8489[_0xbd0d('0x40')]=qs[_0xbd0d('0x41')](_0x4b0139[_0xbd0d('0x39')][_0xbd0d('0x41')]);_0x1f8489[_0xbd0d('0x42')]=qs[_0xbd0d('0x3a')](_['pick'](_0x4b0139['query'],_0x3a20f9[_0xbd0d('0x3a')]),_0x32bfc3);if(_0x4b0139[_0xbd0d('0x39')][_0xbd0d('0x43')]){_0x1f8489[_0xbd0d('0x42')]=_[_0xbd0d('0x44')](_0x1f8489[_0xbd0d('0x42')],{'$or':_[_0xbd0d('0x33')](_0x32bfc3,function(_0x5d78a1){if(_0x5d78a1[_0xbd0d('0x45')]!==_0xbd0d('0x46')){var _0x476aa6={};_0x476aa6[_0x5d78a1['name']]={'$like':'%'+_0x4b0139[_0xbd0d('0x39')][_0xbd0d('0x43')]+'%'};return _0x476aa6;}})});}_0x1f8489=_[_0xbd0d('0x44')]({},_0x1f8489,_0x4b0139[_0xbd0d('0x47')]);var _0xb74c23={'where':_0x1f8489[_0xbd0d('0x42')]};return db[_0xbd0d('0x34')][_0xbd0d('0x23')](_0xb74c23)[_0xbd0d('0x2a')](function(_0x335c2c){_0x1d47d6[_0xbd0d('0x23')]=_0x335c2c;if(_0x4b0139['query'][_0xbd0d('0x48')]){_0x1f8489[_0xbd0d('0x49')]=[{'all':!![]}];}return db[_0xbd0d('0x34')][_0xbd0d('0x4a')](_0x1f8489);})[_0xbd0d('0x2a')](function(_0x548ded){_0x1d47d6['rows']=_0x548ded;return _0x1d47d6;})[_0xbd0d('0x2a')](respondWithFilteredResult(_0x9abe95,_0x1f8489))[_0xbd0d('0x4b')](handleError(_0x9abe95,null));};exports[_0xbd0d('0x4c')]=function(_0x4e7ec4,_0x3edc5a){var _0x1451ca={'raw':!![],'where':{'id':_0x4e7ec4['params']['id']}},_0x38b3e4={};_0x38b3e4[_0xbd0d('0x38')]=_[_0xbd0d('0x4d')](db[_0xbd0d('0x34')]['rawAttributes']);_0x38b3e4['query']=_['keys'](_0x4e7ec4[_0xbd0d('0x39')]);_0x38b3e4[_0xbd0d('0x3a')]=_['intersection'](_0x38b3e4['model'],_0x38b3e4[_0xbd0d('0x39')]);_0x1451ca[_0xbd0d('0x3c')]=_[_0xbd0d('0x3b')](_0x38b3e4[_0xbd0d('0x38')],qs[_0xbd0d('0x3d')](_0x4e7ec4['query']['fields']));_0x1451ca[_0xbd0d('0x3c')]=_0x1451ca[_0xbd0d('0x3c')][_0xbd0d('0x3e')]?_0x1451ca[_0xbd0d('0x3c')]:_0x38b3e4['model'];if(_0x4e7ec4[_0xbd0d('0x39')][_0xbd0d('0x48')]){_0x1451ca[_0xbd0d('0x49')]=[{'all':!![]}];}_0x1451ca=_['merge']({},_0x1451ca,_0x4e7ec4[_0xbd0d('0x47')]);return db[_0xbd0d('0x34')]['find'](_0x1451ca)['then'](handleEntityNotFound(_0x3edc5a,null))['then'](respondWithResult(_0x3edc5a,null))[_0xbd0d('0x4b')](handleError(_0x3edc5a,null));};exports[_0xbd0d('0x4e')]=function(_0x192505,_0x1cbe78){return db[_0xbd0d('0x34')][_0xbd0d('0x4e')](_0x192505[_0xbd0d('0x4f')],{})[_0xbd0d('0x2a')](function(_0x3dba53){var _0x3bdfbd=_0x192505[_0xbd0d('0x50')][_0xbd0d('0x2c')]({'plain':!![]});if(!_0x3bdfbd)throw new Error(_0xbd0d('0x51'));if(_0x3bdfbd[_0xbd0d('0x52')]===_0xbd0d('0x50')){var _0x46a9a6=_0x3dba53[_0xbd0d('0x2c')]({'plain':!![]});var _0x8c1a68=_0xbd0d('0x53');return db['UserProfileSection'][_0xbd0d('0x54')]({'where':{'name':_0x8c1a68,'userProfileId':_0x3bdfbd[_0xbd0d('0x55')]},'raw':!![]})[_0xbd0d('0x2a')](function(_0x537517){if(_0x537517&&_0x537517['autoAssociation']===0x0){return db[_0xbd0d('0x2d')]['create']({'name':_0x46a9a6[_0xbd0d('0x31')],'resourceId':_0x46a9a6['id'],'type':_0x537517[_0xbd0d('0x31')],'sectionId':_0x537517['id']},{})[_0xbd0d('0x2a')](function(){return _0x3dba53;});}else{return _0x3dba53;}})[_0xbd0d('0x4b')](function(_0x467785){logger[_0xbd0d('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x467785);throw _0x467785;});}return _0x3dba53;})[_0xbd0d('0x2a')](respondWithResult(_0x1cbe78,0xc9))['catch'](handleError(_0x1cbe78,null));};exports[_0xbd0d('0x29')]=function(_0x3a0765,_0x219ab7){if(_0x3a0765[_0xbd0d('0x4f')]['id']){delete _0x3a0765['body']['id'];}return db['WhatsappQueue'][_0xbd0d('0x54')]({'where':{'id':_0x3a0765[_0xbd0d('0x56')]['id']}})[_0xbd0d('0x2a')](handleEntityNotFound(_0x219ab7,null))[_0xbd0d('0x2a')](saveUpdates(_0x3a0765[_0xbd0d('0x4f')],null))[_0xbd0d('0x2a')](respondWithResult(_0x219ab7,null))['catch'](handleError(_0x219ab7,null));};exports['destroy']=function(_0x1a792b,_0x1eb3b2){return db[_0xbd0d('0x34')][_0xbd0d('0x54')]({'where':{'id':_0x1a792b[_0xbd0d('0x56')]['id']}})[_0xbd0d('0x2a')](handleEntityNotFound(_0x1eb3b2,null))[_0xbd0d('0x2a')](removeEntity(_0x1eb3b2,null))[_0xbd0d('0x4b')](handleError(_0x1eb3b2,null));};exports[_0xbd0d('0x57')]=function(_0x3c2f3c,_0x41803b){return db[_0xbd0d('0x34')]['describe']()['then'](respondWithResult(_0x41803b,null))[_0xbd0d('0x4b')](handleError(_0x41803b,null));};exports['getMembers']=function(_0x34dd28,_0x25bbae,_0x8645fd){var _0x2e40d0={'raw':!![],'where':{}},_0xdef6cb={},_0x46ca09;return db[_0xbd0d('0x34')][_0xbd0d('0x58')]({'where':{'id':_0x34dd28[_0xbd0d('0x56')]['id']}})[_0xbd0d('0x2a')](handleEntityNotFound(_0x25bbae,null))['then'](function(_0x4d06bf){if(_0x4d06bf){_0x46ca09=_0x4d06bf[_0xbd0d('0x2c')]({'plain':!![]});_0xdef6cb[_0xbd0d('0x38')]=_[_0xbd0d('0x4d')](db['UserWhatsappQueue'][_0xbd0d('0x35')]);_0xdef6cb['query']=_[_0xbd0d('0x4d')](_0x34dd28[_0xbd0d('0x39')]);_0xdef6cb['filters']=_[_0xbd0d('0x3b')](_0xdef6cb[_0xbd0d('0x38')],_0xdef6cb[_0xbd0d('0x39')]);_0x2e40d0[_0xbd0d('0x3c')]=_[_0xbd0d('0x3b')](_0xdef6cb[_0xbd0d('0x38')],qs[_0xbd0d('0x3d')](_0x34dd28[_0xbd0d('0x39')]['fields']));_0x2e40d0['attributes']=_0x2e40d0['attributes']['length']?_0x2e40d0[_0xbd0d('0x3c')]:_0xdef6cb[_0xbd0d('0x38')];if(!_0x34dd28[_0xbd0d('0x39')]['hasOwnProperty'](_0xbd0d('0x59'))){_0x2e40d0[_0xbd0d('0x21')]=qs[_0xbd0d('0x21')](_0x34dd28[_0xbd0d('0x39')][_0xbd0d('0x21')]);_0x2e40d0[_0xbd0d('0x22')]=qs[_0xbd0d('0x22')](_0x34dd28[_0xbd0d('0x39')][_0xbd0d('0x22')]);}_0x2e40d0[_0xbd0d('0x40')]=qs[_0xbd0d('0x41')](_0x34dd28[_0xbd0d('0x39')][_0xbd0d('0x41')]);_0x2e40d0['where']=qs[_0xbd0d('0x3a')](_[_0xbd0d('0x5a')](_0x34dd28[_0xbd0d('0x39')],_0xdef6cb[_0xbd0d('0x3a')]));_0x2e40d0[_0xbd0d('0x42')][_0xbd0d('0x5b')]=_0x4d06bf['id'];if(_0x34dd28[_0xbd0d('0x39')][_0xbd0d('0x43')]){_0x2e40d0[_0xbd0d('0x42')]=_[_0xbd0d('0x44')](_0x2e40d0[_0xbd0d('0x42')],{'$or':_[_0xbd0d('0x33')](_0x2e40d0['attributes'],function(_0x1bf8ba){var _0x4e0fa5={};_0x4e0fa5[_0x1bf8ba]={'$like':'%'+_0x34dd28['query'][_0xbd0d('0x43')]+'%'};return _0x4e0fa5;})});}_0x2e40d0=_[_0xbd0d('0x44')]({},_0x2e40d0,_0x34dd28[_0xbd0d('0x47')]);return db[_0xbd0d('0x5c')][_0xbd0d('0x4a')](_0x2e40d0);}})[_0xbd0d('0x2a')](function(_0x4818a7){if(_0x4818a7){return db[_0xbd0d('0x5d')][_0xbd0d('0x5e')]({'where':{'id':_['map'](_0x4818a7,_0xbd0d('0x5f')),'role':_0xbd0d('0x60')},'attributes':['id',_0xbd0d('0x31'),'whatsappPause','updatedAt',_0xbd0d('0x61')]});}})[_0xbd0d('0x2a')](function(_0x1f05ed){if(_0x1f05ed){return{'count':_0x1f05ed[_0xbd0d('0x23')],'rows':_[_0xbd0d('0x33')](_0x1f05ed[_0xbd0d('0x62')],function(_0x5d0e4f){return{'membername':_0x5d0e4f[_0xbd0d('0x31')],'UserId':_0x5d0e4f['id'],'queue_name':_0x46ca09[_0xbd0d('0x31')],'WhatsappQueueId':_0x46ca09['id'],'interface':util['format'](_0xbd0d('0x63'),_0xbd0d('0x64'),_0x5d0e4f['name']),'penalty':0x0,'paused':_0x5d0e4f[_0xbd0d('0x65')],'createdAt':_0x5d0e4f[_0xbd0d('0x61')],'updatedAt':_0x5d0e4f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd0d('0x2a')](respondWithFilteredResult(_0x25bbae,_0x2e40d0))[_0xbd0d('0x4b')](handleError(_0x25bbae,null));};exports[_0xbd0d('0x66')]=function(_0x4bee2e,_0x30426b,_0x436cf6){var _0x100f97={};var _0x3c0f5f={};var _0x1d92a4;var _0xd1b35c;return db[_0xbd0d('0x34')][_0xbd0d('0x58')]({'where':{'id':_0x4bee2e[_0xbd0d('0x56')]['id']}})[_0xbd0d('0x2a')](handleEntityNotFound(_0x30426b,null))[_0xbd0d('0x2a')](function(_0x584a4e){if(_0x584a4e){_0x1d92a4=_0x584a4e;_0x3c0f5f[_0xbd0d('0x38')]=_[_0xbd0d('0x4d')](db['Team'][_0xbd0d('0x35')]);_0x3c0f5f['query']=_[_0xbd0d('0x4d')](_0x4bee2e[_0xbd0d('0x39')]);_0x3c0f5f[_0xbd0d('0x3a')]=_[_0xbd0d('0x3b')](_0x3c0f5f[_0xbd0d('0x38')],_0x3c0f5f[_0xbd0d('0x39')]);_0x100f97['attributes']=_['intersection'](_0x3c0f5f['model'],qs[_0xbd0d('0x3d')](_0x4bee2e[_0xbd0d('0x39')][_0xbd0d('0x3d')]));_0x100f97[_0xbd0d('0x3c')]=_0x100f97[_0xbd0d('0x3c')][_0xbd0d('0x3e')]?_0x100f97[_0xbd0d('0x3c')]:_0x3c0f5f['model'];_0x100f97['order']=qs[_0xbd0d('0x41')](_0x4bee2e['query']['sort']);_0x100f97[_0xbd0d('0x42')]=qs['filters'](_[_0xbd0d('0x5a')](_0x4bee2e[_0xbd0d('0x39')],_0x3c0f5f[_0xbd0d('0x3a')]));if(_0x4bee2e[_0xbd0d('0x39')][_0xbd0d('0x43')]){_0x100f97[_0xbd0d('0x42')]=_[_0xbd0d('0x44')](_0x100f97[_0xbd0d('0x42')],{'$or':_[_0xbd0d('0x33')](_0x100f97['attributes'],function(_0x55515f){var _0x3efcc5={};_0x3efcc5[_0x55515f]={'$like':'%'+_0x4bee2e[_0xbd0d('0x39')][_0xbd0d('0x43')]+'%'};return _0x3efcc5;})});}_0x100f97=_[_0xbd0d('0x44')]({},_0x100f97,_0x4bee2e['options']);return _0x1d92a4[_0xbd0d('0x66')](_0x100f97);}})[_0xbd0d('0x2a')](function(_0x41e6e7){if(_0x41e6e7){_0xd1b35c=_0x41e6e7[_0xbd0d('0x3e')];if(!_0x4bee2e['query']['hasOwnProperty'](_0xbd0d('0x59'))){_0x100f97[_0xbd0d('0x21')]=qs[_0xbd0d('0x21')](_0x4bee2e[_0xbd0d('0x39')]['limit']);_0x100f97['offset']=qs['offset'](_0x4bee2e[_0xbd0d('0x39')][_0xbd0d('0x22')]);}return _0x1d92a4[_0xbd0d('0x66')](_0x100f97);}})['then'](function(_0x56ea6b){if(_0x56ea6b){return _0x56ea6b?{'count':_0xd1b35c,'rows':_0x56ea6b}:null;}})[_0xbd0d('0x2a')](respondWithResult(_0x30426b,null))[_0xbd0d('0x4b')](handleError(_0x30426b,null));};exports['addTeams']=function(_0x59f56a,_0x5aa864,_0xaebbe8){var _0x42237c=_0x59f56a[_0xbd0d('0x4f')]['ids'];return db[_0xbd0d('0x67')][_0xbd0d('0x4a')]({'where':{'id':_0x42237c},'attributes':['id'],'include':[{'model':db[_0xbd0d('0x5d')],'as':_0xbd0d('0x68'),'attributes':['id','name',_0xbd0d('0x69'),'voicePause',_0xbd0d('0x6a')],'raw':!![]}]})[_0xbd0d('0x2a')](function(_0x151b76){if(_0x151b76){var _0x5307c1=_['flatMap'](_0x151b76,function(_0xa5628e){var _0x112c2d=_0xa5628e[_0xbd0d('0x2c')]({'plain':!![]});return _0x112c2d[_0xbd0d('0x68')];});return db[_0xbd0d('0x34')][_0xbd0d('0x54')]({'where':{'id':_0x59f56a[_0xbd0d('0x56')]['id']}})['then'](function(_0x7f2d6b){return db['sequelize'][_0xbd0d('0x6b')](function(_0x4b4ec0){return _0x7f2d6b['addTeams'](_0x42237c,{'transaction':_0x4b4ec0})[_0xbd0d('0x2a')](function(){return BPromise[_0xbd0d('0x6c')](_0x5307c1,function(_0x3385b7){return db['UserWhatsappQueue'][_0xbd0d('0x6d')]({'where':{'UserId':_0x3385b7['id'],'WhatsappQueueId':_0x59f56a[_0xbd0d('0x56')]['id']},'transaction':_0x4b4ec0});});})['then'](function(){_0x5307c1[_0xbd0d('0x6e')](function(_0x4a8fe5){socket[_0xbd0d('0x6f')]('userWhatsappQueue:save',{'UserId':_0x4a8fe5['id'],'WhatsappQueueId':_0x7f2d6b['id']});});});});});}})['then'](respondWithStatusCode(_0x5aa864,null))[_0xbd0d('0x4b')](handleError(_0x5aa864,null));};exports['removeTeams']=function(_0x324d2f,_0x23d61f,_0x2325a4){return db['Team']['findAll']({'where':{'id':_0x324d2f['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbd0d('0x2a')](handleEntityNotFound(_0x23d61f,null))[_0xbd0d('0x2a')](function(_0x3ed2dd){var _0xeb9314=_['map'](_0x3ed2dd,'id');var _0x2cc34c=[];var _0xca487e=[];var _0xd83531=squel[_0xbd0d('0x70')]();_0xd83531[_0xbd0d('0x71')](_0xbd0d('0x72'))[_0xbd0d('0x73')](_0xbd0d('0x74'),'tq')[_0xbd0d('0x75')](_0xbd0d('0x76'),'ut',_0xbd0d('0x77'))[_0xbd0d('0x42')]('WhatsappQueueId\x20=\x20?',_0x324d2f[_0xbd0d('0x56')]['id']);for(var _0x35c7a8=0x0;_0x35c7a8<_0x3ed2dd[_0xbd0d('0x3e')];_0x35c7a8+=0x1){let _0x4e833a=_0x3ed2dd[_0x35c7a8];for(var _0x3f8d23=0x0;_0x3f8d23<_0x4e833a[_0xbd0d('0x68')][_0xbd0d('0x3e')];_0x3f8d23+=0x1){let _0x213b7a=_0x4e833a['Agents'][_0x3f8d23];var _0x4e7d77=_0xd83531['clone']();_0x4e7d77[_0xbd0d('0x42')](_0xbd0d('0x78'),_0x213b7a['id']);_0xca487e[_0xbd0d('0x79')](db[_0xbd0d('0x7a')][_0xbd0d('0x39')](_0x4e7d77['toString'](),{'type':db[_0xbd0d('0x7a')][_0xbd0d('0x7b')][_0xbd0d('0x7c')]})[_0xbd0d('0x2a')](function(_0x6e741a){if(_0x6e741a[_0xbd0d('0x3e')]===0x1){return _0x213b7a['id'];}else{var _0x1484f1=_[_0xbd0d('0x7d')](_[_0xbd0d('0x33')](_0x6e741a,_0xbd0d('0x7e')),function(_0x2be4a2){return _[_0xbd0d('0x7f')](_0xeb9314,_0x2be4a2);});if(_0x1484f1){return _0x213b7a['id'];}}}));}}return BPromise[_0xbd0d('0x80')](_0xca487e)[_0xbd0d('0x2a')](function(_0x1ff170){_0x2cc34c=_(_0x2cc34c)['union'](_0x1ff170)[_0xbd0d('0x81')]()[_0xbd0d('0x82')]();return db[_0xbd0d('0x34')][_0xbd0d('0x54')]({'where':{'id':_0x324d2f[_0xbd0d('0x56')]['id']}})[_0xbd0d('0x2a')](function(_0x2e48aa){return db[_0xbd0d('0x7a')]['transaction'](function(_0x3b78bb){return _0x2e48aa[_0xbd0d('0x83')](_0x324d2f['query'][_0xbd0d('0x84')],{'transaction':_0x3b78bb})[_0xbd0d('0x2a')](function(){if(!_[_0xbd0d('0x85')](_0x2cc34c)){return _0x2e48aa[_0xbd0d('0x86')](_0x2cc34c,{'transaction':_0x3b78bb});}})[_0xbd0d('0x2a')](function(){_0x2cc34c[_0xbd0d('0x6e')](function(_0x2703fd){socket[_0xbd0d('0x6f')](_0xbd0d('0x87'),{'UserId':_0x2703fd,'WhatsappQueueId':_0x2e48aa['id']});});});});});});})[_0xbd0d('0x2a')](respondWithStatusCode(_0x23d61f,null))[_0xbd0d('0x4b')](handleError(_0x23d61f,null));};exports[_0xbd0d('0x88')]=function(_0x1da697,_0x882738,_0x16a98b){return db[_0xbd0d('0x34')][_0xbd0d('0x54')]({'where':{'id':_0x1da697['params']['id']}})[_0xbd0d('0x2a')](handleEntityNotFound(_0x882738,null))[_0xbd0d('0x2a')](function(_0x15cf33){if(_0x15cf33){return _0x15cf33[_0xbd0d('0x88')](_0x1da697[_0xbd0d('0x4f')]['ids'],_['omit'](_0x1da697['body'],[_0xbd0d('0x84'),'id'])||{})[_0xbd0d('0x89')](function(_0x328f22){for(var _0x523f23=0x0;_0x523f23<_0x1da697[_0xbd0d('0x4f')][_0xbd0d('0x84')][_0xbd0d('0x3e')];_0x523f23+=0x1){socket[_0xbd0d('0x6f')](_0xbd0d('0x8a'),{'UserId':Number(_0x1da697['body']['ids'][_0x523f23]),'WhatsappQueueId':Number(_0x1da697[_0xbd0d('0x56')]['id'])});}return _0x328f22;});}})[_0xbd0d('0x2a')](respondWithResult(_0x882738,null))['catch'](handleError(_0x882738,null));};exports['removeAgents']=function(_0x6360ac,_0x1a9f81,_0x2be012){return db[_0xbd0d('0x34')][_0xbd0d('0x54')]({'where':{'id':_0x6360ac['params']['id']}})[_0xbd0d('0x2a')](handleEntityNotFound(_0x1a9f81,null))[_0xbd0d('0x2a')](function(_0x54cf8b){if(_0x54cf8b){return _0x54cf8b[_0xbd0d('0x86')](_0x6360ac[_0xbd0d('0x39')][_0xbd0d('0x84')])[_0xbd0d('0x2a')](function(){if(_[_0xbd0d('0x8b')](_0x6360ac[_0xbd0d('0x39')][_0xbd0d('0x84')])){for(var _0x341117=0x0;_0x341117<_0x6360ac[_0xbd0d('0x39')][_0xbd0d('0x84')][_0xbd0d('0x3e')];_0x341117+=0x1){socket['emit'](_0xbd0d('0x87'),{'UserId':Number(_0x6360ac[_0xbd0d('0x39')][_0xbd0d('0x84')][_0x341117]),'WhatsappQueueId':Number(_0x6360ac[_0xbd0d('0x56')]['id'])});}}else{socket[_0xbd0d('0x6f')](_0xbd0d('0x87'),{'UserId':Number(_0x6360ac[_0xbd0d('0x39')][_0xbd0d('0x84')]),'WhatsappQueueId':Number(_0x6360ac[_0xbd0d('0x56')]['id'])});}});}})[_0xbd0d('0x2a')](respondWithStatusCode(_0x1a9f81,null))[_0xbd0d('0x4b')](handleError(_0x1a9f81,null));};exports[_0xbd0d('0x8c')]=function(_0x5c6a04,_0x3947c6,_0x136a34){var _0x1804f0={};var _0x4e424e={};var _0x6d07f2;var _0x3041b8;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5c6a04[_0xbd0d('0x56')]['id']}})['then'](handleEntityNotFound(_0x3947c6,null))[_0xbd0d('0x2a')](function(_0x18dc83){if(_0x18dc83){_0x6d07f2=_0x18dc83;_0x4e424e[_0xbd0d('0x38')]=_[_0xbd0d('0x4d')](db[_0xbd0d('0x5d')][_0xbd0d('0x35')]);_0x4e424e['query']=_[_0xbd0d('0x4d')](_0x5c6a04[_0xbd0d('0x39')]);_0x4e424e[_0xbd0d('0x3a')]=_['intersection'](_0x4e424e[_0xbd0d('0x38')],_0x4e424e['query']);_0x1804f0['attributes']=_['intersection'](_0x4e424e['model'],qs[_0xbd0d('0x3d')](_0x5c6a04[_0xbd0d('0x39')][_0xbd0d('0x3d')]));_0x1804f0[_0xbd0d('0x3c')]=_0x1804f0['attributes'][_0xbd0d('0x3e')]?_0x1804f0[_0xbd0d('0x3c')]:_0x4e424e[_0xbd0d('0x38')];_0x1804f0[_0xbd0d('0x40')]=qs[_0xbd0d('0x41')](_0x5c6a04[_0xbd0d('0x39')][_0xbd0d('0x41')]);_0x1804f0[_0xbd0d('0x42')]=qs[_0xbd0d('0x3a')](_['pick'](_0x5c6a04['query'],_0x4e424e[_0xbd0d('0x3a')]));if(_0x5c6a04[_0xbd0d('0x39')]['filter']){_0x1804f0[_0xbd0d('0x42')]=_['merge'](_0x1804f0[_0xbd0d('0x42')],{'$or':_['map'](_0x1804f0[_0xbd0d('0x3c')],function(_0x33597e){var _0x3cc06a={};_0x3cc06a[_0x33597e]={'$like':'%'+_0x5c6a04['query'][_0xbd0d('0x43')]+'%'};return _0x3cc06a;})});}_0x1804f0=_[_0xbd0d('0x44')]({},_0x1804f0,_0x5c6a04['options']);return _0x6d07f2[_0xbd0d('0x8c')](_0x1804f0);}})[_0xbd0d('0x2a')](function(_0xdebd1a){if(_0xdebd1a){_0x3041b8=_0xdebd1a[_0xbd0d('0x3e')];if(!_0x5c6a04[_0xbd0d('0x39')][_0xbd0d('0x3f')](_0xbd0d('0x59'))){_0x1804f0['limit']=qs[_0xbd0d('0x21')](_0x5c6a04['query']['limit']);_0x1804f0[_0xbd0d('0x22')]=qs['offset'](_0x5c6a04[_0xbd0d('0x39')]['offset']);}return _0x6d07f2[_0xbd0d('0x8c')](_0x1804f0);}})[_0xbd0d('0x2a')](function(_0x54e2ae){if(_0x54e2ae){return _0x54e2ae?{'count':_0x3041b8,'rows':_0x54e2ae}:null;}})[_0xbd0d('0x2a')](respondWithResult(_0x3947c6,null))[_0xbd0d('0x4b')](handleError(_0x3947c6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f0eaff3..52a3878 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 _0xf15a=['remove','emit','hasOwnProperty','exports','events','WhatsappQueue','setMaxListeners','save','update'];(function(_0x1267b2,_0x2e5c67){var _0x1dcd4d=function(_0x174daf){while(--_0x174daf){_0x1267b2['push'](_0x1267b2['shift']());}};_0x1dcd4d(++_0x2e5c67);}(_0xf15a,0x15a));var _0xaf15=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf15a[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xaf15('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xaf15('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xaf15('0x2')](0x0);var events={'afterCreate':_0xaf15('0x3'),'afterUpdate':_0xaf15('0x4'),'afterDestroy':_0xaf15('0x5')};function emitEvent(_0x4c78d3){return function(_0x19a3d5,_0x4cae84,_0x5e10df){WhatsappQueueEvents[_0xaf15('0x6')](_0x4c78d3+':'+_0x19a3d5['id'],_0x19a3d5);WhatsappQueueEvents[_0xaf15('0x6')](_0x4c78d3,_0x19a3d5);_0x5e10df(null);};}for(var e in events){if(events[_0xaf15('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xaf15('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb85b=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xb85b,0x1a5));var _0xbb85=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xb85b[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0xbb85('0x0'));var WhatsappQueue=require(_0xbb85('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xbb85('0x2')](0x0);var events={'afterCreate':_0xbb85('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x88fd22){return function(_0x170b5e,_0x4feafb,_0x3cf57c){WhatsappQueueEvents[_0xbb85('0x4')](_0x88fd22+':'+_0x170b5e['id'],_0x170b5e);WhatsappQueueEvents[_0xbb85('0x4')](_0x88fd22,_0x170b5e);_0x3cf57c(null);};}for(var e in events){if(events[_0xbb85('0x5')](e)){var event=events[e];WhatsappQueue[_0xbb85('0x6')](e,emitEvent(event));}}module[_0xbb85('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c800884..e07ab8d 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 _0x5953=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0xee4d22,_0x27f86c){var _0xa77379=function(_0x27dae6){while(--_0x27dae6){_0xee4d22['push'](_0xee4d22['shift']());}};_0xa77379(++_0x27f86c);}(_0x5953,0x121));var _0x3595=function(_0xebbc39,_0x427a35){_0xebbc39=_0xebbc39-0x0;var _0x5892df=_0x5953[_0xebbc39];return _0x5892df;};'use strict';var _=require(_0x3595('0x0'));var util=require(_0x3595('0x1'));var logger=require(_0x3595('0x2'))(_0x3595('0x3'));var moment=require('moment');var BPromise=require(_0x3595('0x4'));var rp=require(_0x3595('0x5'));var fs=require('fs');var path=require(_0x3595('0x6'));var rimraf=require(_0x3595('0x7'));var config=require(_0x3595('0x8'));var attributes=require(_0x3595('0x9'));module[_0x3595('0xa')]=function(_0x46e78a,_0x323dd2){return _0x46e78a[_0x3595('0xb')](_0x3595('0xc'),attributes,{'tableName':_0x3595('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7662=['bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','api','moment'];(function(_0x1277ae,_0x3a49b9){var _0x542755=function(_0x19cd04){while(--_0x19cd04){_0x1277ae['push'](_0x1277ae['shift']());}};_0x542755(++_0x3a49b9);}(_0x7662,0xd4));var _0x2766=function(_0xf1f759,_0x18bf6b){_0xf1f759=_0xf1f759-0x0;var _0x46b77d=_0x7662[_0xf1f759];return _0x46b77d;};'use strict';var _=require(_0x2766('0x0'));var util=require('util');var logger=require(_0x2766('0x1'))(_0x2766('0x2'));var moment=require(_0x2766('0x3'));var BPromise=require(_0x2766('0x4'));var rp=require(_0x2766('0x5'));var fs=require('fs');var path=require(_0x2766('0x6'));var rimraf=require('rimraf');var config=require(_0x2766('0x7'));var attributes=require(_0x2766('0x8'));module[_0x2766('0x9')]=function(_0x15192d,_0x469f93){return _0x15192d[_0x2766('0xa')](_0x2766('0xb'),attributes,{'tableName':'whatsapp_queues','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 0d27045..e8b935c 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 _0x9894=['code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4f76e1,_0x3a18e0){var _0x2f9cf6=function(_0x1b4846){while(--_0x1b4846){_0x4f76e1['push'](_0x4f76e1['shift']());}};_0x2f9cf6(++_0x3a18e0);}(_0x9894,0x68));var _0x4989=function(_0x5ab726,_0x939fca){_0x5ab726=_0x5ab726-0x0;var _0x45b745=_0x9894[_0x5ab726];return _0x45b745;};'use strict';var _=require(_0x4989('0x0'));var util=require(_0x4989('0x1'));var moment=require(_0x4989('0x2'));var BPromise=require(_0x4989('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4989('0x4'))['db'];var utils=require(_0x4989('0x5'));var logger=require(_0x4989('0x6'))(_0x4989('0x7'));var config=require(_0x4989('0x8'));var jayson=require(_0x4989('0x9'));var client=jayson[_0x4989('0xa')][_0x4989('0xb')]({'port':0x232a});config[_0x4989('0xc')]=_[_0x4989('0xd')](config[_0x4989('0xc')],{'host':_0x4989('0xe'),'port':0x18eb});var socket=require(_0x4989('0xf'))(new Redis(config['redis']));require(_0x4989('0x10'))[_0x4989('0x11')](socket);function respondWithRpcPromise(_0x13b5c0,_0x269224,_0xfc3ff6){return new BPromise(function(_0x4055ea,_0x3e9a51){return client[_0x4989('0x12')](_0x13b5c0,_0xfc3ff6)[_0x4989('0x13')](function(_0x44a49d){logger[_0x4989('0x14')](_0x4989('0x15'),_0x269224,_0x4989('0x16'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x269224,'request\x20sent',JSON[_0x4989('0x17')](_0x44a49d));if(_0x44a49d[_0x4989('0x18')]){if(_0x44a49d[_0x4989('0x18')][_0x4989('0x19')]===0x1f4){logger['error'](_0x4989('0x15'),_0x269224,_0x44a49d['error'][_0x4989('0x1a')]);return _0x3e9a51(_0x44a49d['error']['message']);}logger[_0x4989('0x18')](_0x4989('0x15'),_0x269224,_0x44a49d['error'][_0x4989('0x1a')]);return _0x4055ea(_0x44a49d[_0x4989('0x18')][_0x4989('0x1a')]);}else{logger[_0x4989('0x14')](_0x4989('0x15'),_0x269224,_0x4989('0x16'));_0x4055ea(_0x44a49d[_0x4989('0x1b')][_0x4989('0x1a')]);}})[_0x4989('0x1c')](function(_0x32310d){logger[_0x4989('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x269224,_0x32310d);_0x3e9a51(_0x32310d);});});}exports[_0x4989('0x1d')]=function(_0x18526a){var _0x477f44=this;return new Promise(function(_0x133866,_0x321ea6){return db[_0x4989('0x1e')][_0x4989('0x1f')]({'raw':_0x18526a[_0x4989('0x20')]?_0x18526a[_0x4989('0x20')][_0x4989('0x21')]===undefined?!![]:![]:!![],'where':_0x18526a[_0x4989('0x20')]?_0x18526a[_0x4989('0x20')]['where']||null:null,'attributes':_0x18526a[_0x4989('0x20')]?_0x18526a[_0x4989('0x20')][_0x4989('0x22')]||null:null,'limit':_0x18526a[_0x4989('0x20')]?_0x18526a[_0x4989('0x20')][_0x4989('0x23')]||null:null,'include':_0x18526a[_0x4989('0x20')]?_0x18526a[_0x4989('0x20')][_0x4989('0x24')]?_[_0x4989('0x25')](_0x18526a[_0x4989('0x20')][_0x4989('0x24')],function(_0x1a6fb8){return{'model':db[_0x1a6fb8[_0x4989('0x26')]],'as':_0x1a6fb8['as'],'attributes':_0x1a6fb8[_0x4989('0x22')],'include':_0x1a6fb8[_0x4989('0x24')]?_[_0x4989('0x25')](_0x1a6fb8[_0x4989('0x24')],function(_0x58ef93){return{'model':db[_0x58ef93[_0x4989('0x26')]],'as':_0x58ef93['as'],'attributes':_0x58ef93[_0x4989('0x22')],'include':_0x58ef93[_0x4989('0x24')]?_[_0x4989('0x25')](_0x58ef93[_0x4989('0x24')],function(_0x371526){return{'model':db[_0x371526[_0x4989('0x26')]],'as':_0x371526['as'],'attributes':_0x371526['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f06c6){logger[_0x4989('0x14')]('GetWhatsappQueue',_0x18526a);logger[_0x4989('0x27')](_0x4989('0x1d'),_0x18526a,JSON[_0x4989('0x17')](_0x1f06c6));_0x133866(_0x1f06c6);})[_0x4989('0x1c')](function(_0x9e6cfb){logger['error'](_0x4989('0x1d'),_0x9e6cfb[_0x4989('0x1a')],_0x18526a);_0x321ea6(_0x477f44[_0x4989('0x18')](0x1f4,_0x9e6cfb['message']));});});};exports[_0x4989('0x28')]=function(_0x4f4676){var _0xe4dd4a=this;return new Promise(function(_0x428a54,_0x32bdee){return db[_0x4989('0x1e')][_0x4989('0x29')]({'raw':_0x4f4676['options']?_0x4f4676['options'][_0x4989('0x21')]===undefined?!![]:![]:!![],'where':_0x4f4676[_0x4989('0x20')]?_0x4f4676['options'][_0x4989('0x2a')]||null:null,'attributes':_0x4f4676['options']?_0x4f4676['options'][_0x4989('0x22')]||null:null,'include':_0x4f4676[_0x4989('0x20')]?_0x4f4676[_0x4989('0x20')][_0x4989('0x24')]?_[_0x4989('0x25')](_0x4f4676[_0x4989('0x20')][_0x4989('0x24')],function(_0x481394){return{'model':db[_0x481394[_0x4989('0x26')]],'as':_0x481394['as'],'attributes':_0x481394[_0x4989('0x22')],'include':_0x481394[_0x4989('0x24')]?_[_0x4989('0x25')](_0x481394['include'],function(_0x45541b){return{'model':db[_0x45541b[_0x4989('0x26')]],'as':_0x45541b['as'],'attributes':_0x45541b[_0x4989('0x22')],'include':_0x45541b[_0x4989('0x24')]?_[_0x4989('0x25')](_0x45541b[_0x4989('0x24')],function(_0x590555){return{'model':db[_0x590555[_0x4989('0x26')]],'as':_0x590555['as'],'attributes':_0x590555[_0x4989('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4989('0x13')](function(_0x55f1ab){logger['info'](_0x4989('0x28'),_0x4f4676);logger[_0x4989('0x27')]('ShowWhatsappQueue',_0x4f4676,JSON[_0x4989('0x17')](_0x55f1ab));_0x428a54(_0x55f1ab);})['catch'](function(_0x2d583f){logger[_0x4989('0x18')](_0x4989('0x28'),_0x2d583f[_0x4989('0x1a')],_0x4f4676);_0x32bdee(_0xe4dd4a['error'](0x1f4,_0x2d583f[_0x4989('0x1a')]));});});}; \ No newline at end of file +var _0xee60=['model','attributes','ShowWhatsappQueue','find','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','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','limit','include','map'];(function(_0x1dd508,_0x539c1d){var _0x40b7d7=function(_0x3b2b73){while(--_0x3b2b73){_0x1dd508['push'](_0x1dd508['shift']());}};_0x40b7d7(++_0x539c1d);}(_0xee60,0x7d));var _0x0ee6=function(_0x4b17f3,_0x19894b){_0x4b17f3=_0x4b17f3-0x0;var _0x43a5b8=_0xee60[_0x4b17f3];return _0x43a5b8;};'use strict';var _=require(_0x0ee6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ee6('0x1'));var rs=require(_0x0ee6('0x2'));var fs=require('fs');var Redis=require(_0x0ee6('0x3'));var db=require(_0x0ee6('0x4'))['db'];var utils=require(_0x0ee6('0x5'));var logger=require('../../config/logger')(_0x0ee6('0x6'));var config=require(_0x0ee6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ee6('0x8')]({'port':0x232a});config['redis']=_[_0x0ee6('0x9')](config['redis'],{'host':_0x0ee6('0xa'),'port':0x18eb});var socket=require(_0x0ee6('0xb'))(new Redis(config[_0x0ee6('0xc')]));require(_0x0ee6('0xd'))[_0x0ee6('0xe')](socket);function respondWithRpcPromise(_0x35fef4,_0x5414c8,_0x5c5d84){return new BPromise(function(_0x28d5a2,_0x7d709a){return client[_0x0ee6('0xf')](_0x35fef4,_0x5c5d84)[_0x0ee6('0x10')](function(_0x28eeaa){logger[_0x0ee6('0x11')](_0x0ee6('0x12'),_0x5414c8,_0x0ee6('0x13'));logger[_0x0ee6('0x14')](_0x0ee6('0x15'),_0x5414c8,'request\x20sent',JSON[_0x0ee6('0x16')](_0x28eeaa));if(_0x28eeaa['error']){if(_0x28eeaa[_0x0ee6('0x17')][_0x0ee6('0x18')]===0x1f4){logger[_0x0ee6('0x17')](_0x0ee6('0x12'),_0x5414c8,_0x28eeaa['error'][_0x0ee6('0x19')]);return _0x7d709a(_0x28eeaa['error'][_0x0ee6('0x19')]);}logger[_0x0ee6('0x17')](_0x0ee6('0x12'),_0x5414c8,_0x28eeaa['error'][_0x0ee6('0x19')]);return _0x28d5a2(_0x28eeaa[_0x0ee6('0x17')]['message']);}else{logger[_0x0ee6('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x5414c8,_0x0ee6('0x13'));_0x28d5a2(_0x28eeaa[_0x0ee6('0x1a')]['message']);}})['catch'](function(_0x499f1f){logger[_0x0ee6('0x17')](_0x0ee6('0x12'),_0x5414c8,_0x499f1f);_0x7d709a(_0x499f1f);});});}exports[_0x0ee6('0x1b')]=function(_0x3412c7){var _0x3570ed=this;return new Promise(function(_0x3bcf8f,_0x32a75f){return db[_0x0ee6('0x1c')][_0x0ee6('0x1d')]({'raw':_0x3412c7[_0x0ee6('0x1e')]?_0x3412c7['options'][_0x0ee6('0x1f')]===undefined?!![]:![]:!![],'where':_0x3412c7[_0x0ee6('0x1e')]?_0x3412c7[_0x0ee6('0x1e')]['where']||null:null,'attributes':_0x3412c7['options']?_0x3412c7['options']['attributes']||null:null,'limit':_0x3412c7[_0x0ee6('0x1e')]?_0x3412c7['options'][_0x0ee6('0x20')]||null:null,'include':_0x3412c7[_0x0ee6('0x1e')]?_0x3412c7[_0x0ee6('0x1e')][_0x0ee6('0x21')]?_[_0x0ee6('0x22')](_0x3412c7[_0x0ee6('0x1e')][_0x0ee6('0x21')],function(_0x17c1cc){return{'model':db[_0x17c1cc[_0x0ee6('0x23')]],'as':_0x17c1cc['as'],'attributes':_0x17c1cc['attributes'],'include':_0x17c1cc[_0x0ee6('0x21')]?_[_0x0ee6('0x22')](_0x17c1cc[_0x0ee6('0x21')],function(_0x2ccf01){return{'model':db[_0x2ccf01[_0x0ee6('0x23')]],'as':_0x2ccf01['as'],'attributes':_0x2ccf01['attributes'],'include':_0x2ccf01['include']?_[_0x0ee6('0x22')](_0x2ccf01[_0x0ee6('0x21')],function(_0x47f28a){return{'model':db[_0x47f28a[_0x0ee6('0x23')]],'as':_0x47f28a['as'],'attributes':_0x47f28a[_0x0ee6('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0ee6('0x10')](function(_0x1649a8){logger['info'](_0x0ee6('0x1b'),_0x3412c7);logger[_0x0ee6('0x14')](_0x0ee6('0x1b'),_0x3412c7,JSON['stringify'](_0x1649a8));_0x3bcf8f(_0x1649a8);})['catch'](function(_0x5cd37d){logger[_0x0ee6('0x17')]('GetWhatsappQueue',_0x5cd37d[_0x0ee6('0x19')],_0x3412c7);_0x32a75f(_0x3570ed[_0x0ee6('0x17')](0x1f4,_0x5cd37d['message']));});});};exports[_0x0ee6('0x25')]=function(_0xc0be6d){var _0x5a48d1=this;return new Promise(function(_0x4440fe,_0x36e8db){return db[_0x0ee6('0x1c')][_0x0ee6('0x26')]({'raw':_0xc0be6d[_0x0ee6('0x1e')]?_0xc0be6d[_0x0ee6('0x1e')][_0x0ee6('0x1f')]===undefined?!![]:![]:!![],'where':_0xc0be6d[_0x0ee6('0x1e')]?_0xc0be6d[_0x0ee6('0x1e')]['where']||null:null,'attributes':_0xc0be6d[_0x0ee6('0x1e')]?_0xc0be6d['options'][_0x0ee6('0x24')]||null:null,'include':_0xc0be6d[_0x0ee6('0x1e')]?_0xc0be6d[_0x0ee6('0x1e')][_0x0ee6('0x21')]?_[_0x0ee6('0x22')](_0xc0be6d[_0x0ee6('0x1e')][_0x0ee6('0x21')],function(_0x31d5e0){return{'model':db[_0x31d5e0[_0x0ee6('0x23')]],'as':_0x31d5e0['as'],'attributes':_0x31d5e0[_0x0ee6('0x24')],'include':_0x31d5e0[_0x0ee6('0x21')]?_[_0x0ee6('0x22')](_0x31d5e0['include'],function(_0x2dcdec){return{'model':db[_0x2dcdec['model']],'as':_0x2dcdec['as'],'attributes':_0x2dcdec[_0x0ee6('0x24')],'include':_0x2dcdec[_0x0ee6('0x21')]?_[_0x0ee6('0x22')](_0x2dcdec[_0x0ee6('0x21')],function(_0x4a7e47){return{'model':db[_0x4a7e47[_0x0ee6('0x23')]],'as':_0x4a7e47['as'],'attributes':_0x4a7e47['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ee6('0x10')](function(_0x477f80){logger['info']('ShowWhatsappQueue',_0xc0be6d);logger['debug'](_0x0ee6('0x25'),_0xc0be6d,JSON['stringify'](_0x477f80));_0x4440fe(_0x477f80);})[_0x0ee6('0x27')](function(_0x29492e){logger[_0x0ee6('0x17')](_0x0ee6('0x25'),_0x29492e['message'],_0xc0be6d);_0x36e8db(_0x5a48d1[_0x0ee6('0x17')](0x1f4,_0x29492e[_0x0ee6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4a5ec48..6b199ba 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 _0x0c74=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','register'];(function(_0x32bf30,_0x593c48){var _0x100c8f=function(_0x30d91e){while(--_0x30d91e){_0x32bf30['push'](_0x32bf30['shift']());}};_0x100c8f(++_0x593c48);}(_0x0c74,0xa2));var _0x40c7=function(_0x1e486a,_0x10047e){_0x1e486a=_0x1e486a-0x0;var _0x22d8ca=_0x0c74[_0x1e486a];return _0x22d8ca;};'use strict';var WhatsappQueueEvents=require(_0x40c7('0x0'));var events=[_0x40c7('0x1'),_0x40c7('0x2'),_0x40c7('0x3')];function createListener(_0x34462e,_0x262f39){return function(_0x1c91c1){_0x262f39[_0x40c7('0x4')](_0x34462e,_0x1c91c1);};}function removeListener(_0x258df7,_0x92423b){return function(){WhatsappQueueEvents['removeListener'](_0x258df7,_0x92423b);};}exports[_0x40c7('0x5')]=function(_0x1356c9){for(var _0x5966ba=0x0,_0x13f268=events['length'];_0x5966ba<_0x13f268;_0x5966ba++){var _0x1dd82d=events[_0x5966ba];var _0x1e7256=createListener(_0x40c7('0x6')+_0x1dd82d,_0x1356c9);WhatsappQueueEvents['on'](_0x1dd82d,_0x1e7256);}}; \ No newline at end of file +var _0xa32e=['update','emit','./whatsappQueue.events','remove'];(function(_0x4fd774,_0x297860){var _0x20822a=function(_0x9a13ff){while(--_0x9a13ff){_0x4fd774['push'](_0x4fd774['shift']());}};_0x20822a(++_0x297860);}(_0xa32e,0x7e));var _0xea32=function(_0x4ed4f9,_0x48aeca){_0x4ed4f9=_0x4ed4f9-0x0;var _0x3e55bd=_0xa32e[_0x4ed4f9];return _0x3e55bd;};'use strict';var WhatsappQueueEvents=require(_0xea32('0x0'));var events=['save',_0xea32('0x1'),_0xea32('0x2')];function createListener(_0x22ac66,_0x266874){return function(_0x5189f2){_0x266874[_0xea32('0x3')](_0x22ac66,_0x5189f2);};}function removeListener(_0x19eb1b,_0x3fe28e){return function(){WhatsappQueueEvents['removeListener'](_0x19eb1b,_0x3fe28e);};}exports['register']=function(_0x1571cb){for(var _0x5ab0f8=0x0,_0x544e8c=events['length'];_0x5ab0f8<_0x544e8c;_0x5ab0f8++){var _0x1afa86=events[_0x5ab0f8];var _0x52c33b=createListener('whatsappQueue:'+_0x1afa86,_0x1571cb);WhatsappQueueEvents['on'](_0x1afa86,_0x52c33b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 42d1f38..84b06a7 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 _0xf2d7=['exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy'];(function(_0x4c746e,_0x113d7b){var _0x547efd=function(_0x1f2bb3){while(--_0x1f2bb3){_0x4c746e['push'](_0x4c746e['shift']());}};_0x547efd(++_0x113d7b);}(_0xf2d7,0x157));var _0x7f2d=function(_0x30c57f,_0x4e26ca){_0x30c57f=_0x30c57f-0x0;var _0x570756=_0xf2d7[_0x30c57f];return _0x570756;};'use strict';var multer=require(_0x7f2d('0x0'));var util=require(_0x7f2d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7f2d('0x2')]();var fs_extra=require(_0x7f2d('0x3'));var auth=require(_0x7f2d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7f2d('0x5'));var controller=require(_0x7f2d('0x6'));router[_0x7f2d('0x7')]('/',auth[_0x7f2d('0x8')](),controller[_0x7f2d('0x9')]);router['get'](_0x7f2d('0xa'),auth[_0x7f2d('0x8')](),controller['describe']);router[_0x7f2d('0x7')](_0x7f2d('0xb'),auth[_0x7f2d('0x8')](),controller[_0x7f2d('0xc')]);router[_0x7f2d('0xd')]('/',auth[_0x7f2d('0x8')](),controller['create']);router[_0x7f2d('0xe')](_0x7f2d('0xb'),auth[_0x7f2d('0x8')](),controller[_0x7f2d('0xf')]);router[_0x7f2d('0x10')](_0x7f2d('0xb'),auth[_0x7f2d('0x8')](),controller[_0x7f2d('0x11')]);module[_0x7f2d('0x12')]=router; \ No newline at end of file +var _0x5830=['show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','get','/describe','describe','/:id','isAuthenticated'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0x5830,0x84));var _0x0583=function(_0x1c4b47,_0x31d98a){_0x1c4b47=_0x1c4b47-0x0;var _0x496d44=_0x5830[_0x1c4b47];return _0x496d44;};'use strict';var multer=require('multer');var util=require(_0x0583('0x0'));var path=require(_0x0583('0x1'));var timeout=require(_0x0583('0x2'));var express=require(_0x0583('0x3'));var router=express[_0x0583('0x4')]();var fs_extra=require(_0x0583('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0583('0x6'));var config=require(_0x0583('0x7'));var controller=require(_0x0583('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0583('0x9')]);router[_0x0583('0xa')](_0x0583('0xb'),auth['isAuthenticated'](),controller[_0x0583('0xc')]);router[_0x0583('0xa')](_0x0583('0xd'),auth[_0x0583('0xe')](),controller[_0x0583('0xf')]);router['post']('/',auth[_0x0583('0xe')](),controller[_0x0583('0x10')]);router[_0x0583('0x11')](_0x0583('0xd'),auth[_0x0583('0xe')](),controller[_0x0583('0x12')]);router[_0x0583('0x13')](_0x0583('0xd'),auth[_0x0583('0xe')](),controller['destroy']);module[_0x0583('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 39b5eec..6dc19e5 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x26e69e,_0x3c640f){var _0x248bb3=function(_0x374ea){while(--_0x374ea){_0x26e69e['push'](_0x26e69e['shift']());}};_0x248bb3(++_0x3c640f);}(_0x7a54,0x106));var _0x47a5=function(_0x2c7774,_0x3884d9){_0x2c7774=_0x2c7774-0x0;var _0x4dd683=_0x7a54[_0x2c7774];return _0x4dd683;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x182457,_0x5b9318){var _0xead897=function(_0x163f97){while(--_0x163f97){_0x182457['push'](_0x182457['shift']());}};_0xead897(++_0x5b9318);}(_0x7a54,0x106));var _0x47a5=function(_0x208add,_0x29cf30){_0x208add=_0x208add-0x0;var _0x52d88d=_0x7a54[_0x208add];return _0x52d88d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 4ff212e..6edac01 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 _0x1d2d=['options','WhatsappQueueReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x3e6333,_0x1317b0){var _0x3ed97b=function(_0x3029ca){while(--_0x3029ca){_0x3e6333['push'](_0x3e6333['shift']());}};_0x3ed97b(++_0x1317b0);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x79b195,_0x51d04c){_0x79b195=_0x79b195-0x0;var _0x5520b3=_0x1d2d[_0x79b195];return _0x5520b3;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['WhatsappQueueReport'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));};exports[_0xd1d2('0x4b')]=function(_0xfd8024,_0xa013ce){return db[_0xd1d2('0x41')][_0xd1d2('0x4b')]()[_0xd1d2('0x26')](respondWithResult(_0xa013ce,null))[_0xd1d2('0x44')](handleError(_0xa013ce,null));}; \ No newline at end of file +var _0x0565=['length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','find','body','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','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','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x105e3e,_0x4cb667){var _0x5b0125=function(_0x877866){while(--_0x877866){_0x105e3e['push'](_0x105e3e['shift']());}};_0x5b0125(++_0x4cb667);}(_0x0565,0xf2));var _0x5056=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0565[_0x27af45];return _0x18df21;};'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(){_0x5afbfe[_0x5056('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267048,_0x25409f){return function(_0x5d1656){if(!_0x5d1656){_0x267048[_0x5056('0x25')](0x194);}return _0x5d1656;};}function handleError(_0x505ccf,_0x15f03f){_0x15f03f=_0x15f03f||0x1f4;return function(_0x39d539){logger[_0x5056('0x26')](_0x39d539[_0x5056('0x27')]);if(_0x39d539[_0x5056('0x28')]){delete _0x39d539['name'];}_0x505ccf[_0x5056('0x19')](_0x15f03f)[_0x5056('0x29')](_0x39d539);};}exports[_0x5056('0x2a')]=function(_0x2ac79a,_0x53e6db){var _0x24d33e={},_0x5b0270={},_0x70246c={'count':0x0,'rows':[]};var _0x49fe67=_['map'](db['WhatsappQueueReport'][_0x5056('0x2b')],function(_0x252f75){return{'name':_0x252f75['fieldName'],'type':_0x252f75[_0x5056('0x2c')][_0x5056('0x2d')]};});_0x5b0270[_0x5056('0x2e')]=_[_0x5056('0x2f')](_0x49fe67,_0x5056('0x28'));_0x5b0270[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2ac79a[_0x5056('0x30')]);_0x5b0270[_0x5056('0x32')]=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],_0x5b0270['query']);_0x24d33e['attributes']=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],qs['fields'](_0x2ac79a[_0x5056('0x30')][_0x5056('0x34')]));_0x24d33e['attributes']=_0x24d33e[_0x5056('0x35')][_0x5056('0x36')]?_0x24d33e[_0x5056('0x35')]:_0x5b0270[_0x5056('0x2e')];if(!_0x2ac79a[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x24d33e[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1d')]);_0x24d33e[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1c')]);}_0x24d33e['order']=qs[_0x5056('0x39')](_0x2ac79a['query'][_0x5056('0x39')]);_0x24d33e[_0x5056('0x3a')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x2ac79a['query'],_0x5b0270[_0x5056('0x32')]),_0x49fe67);if(_0x2ac79a[_0x5056('0x30')]['filter']){_0x24d33e[_0x5056('0x3a')]=_['merge'](_0x24d33e[_0x5056('0x3a')],{'$or':_[_0x5056('0x2f')](_0x49fe67,function(_0x3d56cf){if(_0x3d56cf['type']!==_0x5056('0x3c')){var _0x16a940={};_0x16a940[_0x3d56cf[_0x5056('0x28')]]={'$like':'%'+_0x2ac79a[_0x5056('0x30')][_0x5056('0x3d')]+'%'};return _0x16a940;}})});}_0x24d33e=_[_0x5056('0x3e')]({},_0x24d33e,_0x2ac79a[_0x5056('0x3f')]);var _0x21aa75={'where':_0x24d33e[_0x5056('0x3a')]};return db[_0x5056('0x40')][_0x5056('0x1f')](_0x21aa75)[_0x5056('0x23')](function(_0xc1024a){_0x70246c[_0x5056('0x1f')]=_0xc1024a;if(_0x2ac79a[_0x5056('0x30')][_0x5056('0x41')]){_0x24d33e['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x5056('0x42')](_0x24d33e);})[_0x5056('0x23')](function(_0x6946b4){_0x70246c[_0x5056('0x43')]=_0x6946b4;return _0x70246c;})[_0x5056('0x23')](respondWithFilteredResult(_0x53e6db,_0x24d33e))[_0x5056('0x44')](handleError(_0x53e6db,null));};exports[_0x5056('0x45')]=function(_0x2bf472,_0x48ab5e){var _0x58f12f={'raw':!![],'where':{'id':_0x2bf472[_0x5056('0x46')]['id']}},_0x68a385={};_0x68a385[_0x5056('0x2e')]=_['keys'](db[_0x5056('0x40')]['rawAttributes']);_0x68a385[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2bf472[_0x5056('0x30')]);_0x68a385[_0x5056('0x32')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],_0x68a385['query']);_0x58f12f[_0x5056('0x35')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],qs['fields'](_0x2bf472['query']['fields']));_0x58f12f['attributes']=_0x58f12f[_0x5056('0x35')][_0x5056('0x36')]?_0x58f12f[_0x5056('0x35')]:_0x68a385[_0x5056('0x2e')];if(_0x2bf472[_0x5056('0x30')]['includeAll']){_0x58f12f['include']=[{'all':!![]}];}_0x58f12f=_[_0x5056('0x3e')]({},_0x58f12f,_0x2bf472[_0x5056('0x3f')]);return db[_0x5056('0x40')][_0x5056('0x47')](_0x58f12f)[_0x5056('0x23')](handleEntityNotFound(_0x48ab5e,null))[_0x5056('0x23')](respondWithResult(_0x48ab5e,null))[_0x5056('0x44')](handleError(_0x48ab5e,null));};exports['create']=function(_0x52d6ea,_0x14e3f5){return db[_0x5056('0x40')]['create'](_0x52d6ea[_0x5056('0x48')],{})[_0x5056('0x23')](respondWithResult(_0x14e3f5,0xc9))['catch'](handleError(_0x14e3f5,null));};exports['update']=function(_0x83d8e4,_0x1ab1a9){if(_0x83d8e4['body']['id']){delete _0x83d8e4['body']['id'];}return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0x83d8e4['params']['id']}})['then'](handleEntityNotFound(_0x1ab1a9,null))[_0x5056('0x23')](saveUpdates(_0x83d8e4[_0x5056('0x48')],null))[_0x5056('0x23')](respondWithResult(_0x1ab1a9,null))[_0x5056('0x44')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x24')]=function(_0xdf427c,_0x97f7d8){return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0xdf427c[_0x5056('0x46')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x97f7d8,null))[_0x5056('0x23')](removeEntity(_0x97f7d8,null))[_0x5056('0x44')](handleError(_0x97f7d8,null));};exports[_0x5056('0x49')]=function(_0x34e86e,_0x4bf758){return db['WhatsappQueueReport'][_0x5056('0x49')]()[_0x5056('0x23')](respondWithResult(_0x4bf758,null))[_0x5056('0x44')](handleError(_0x4bf758,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 462ca8a..9aa81bd 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 _0x9e39=['lodash','api','bluebird','path','rimraf','../../config/environment','WhatsappQueueReport','uniqueid'];(function(_0x579133,_0x256982){var _0x3f7a4f=function(_0x40c498){while(--_0x40c498){_0x579133['push'](_0x579133['shift']());}};_0x3f7a4f(++_0x256982);}(_0x9e39,0xf8));var _0x99e3=function(_0x3a9aa9,_0x395763){_0x3a9aa9=_0x3a9aa9-0x0;var _0x13e0c9=_0x9e39[_0x3a9aa9];return _0x13e0c9;};'use strict';var _=require(_0x99e3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x99e3('0x1'));var moment=require('moment');var BPromise=require(_0x99e3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99e3('0x3'));var rimraf=require(_0x99e3('0x4'));var config=require(_0x99e3('0x5'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x335840,_0x570dd5){return _0x335840['define'](_0x99e3('0x6'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x99e3('0x7'),'fields':[_0x99e3('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ba3=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x470577,_0x28bcf1){var _0x33b183=function(_0x2672d6){while(--_0x2672d6){_0x470577['push'](_0x470577['shift']());}};_0x33b183(++_0x28bcf1);}(_0x3ba3,0x99));var _0x33ba=function(_0x3b93dd,_0x2fcab1){_0x3b93dd=_0x3b93dd-0x0;var _0xe30ec7=_0x3ba3[_0x3b93dd];return _0xe30ec7;};'use strict';var _=require(_0x33ba('0x0'));var util=require(_0x33ba('0x1'));var logger=require(_0x33ba('0x2'))(_0x33ba('0x3'));var moment=require('moment');var BPromise=require(_0x33ba('0x4'));var rp=require(_0x33ba('0x5'));var fs=require('fs');var path=require(_0x33ba('0x6'));var rimraf=require(_0x33ba('0x7'));var config=require(_0x33ba('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x33ba('0x9')]=function(_0x4d94f1,_0x4b17f6){return _0x4d94f1[_0x33ba('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x33ba('0xb'),'paranoid':![],'indexes':[{'name':_0x33ba('0xc'),'fields':[_0x33ba('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 091fa10..22e91f9 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 _0x2528=['jayson/promise','client','http','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','debug','UpdateWhatsappQueueReport','where','attributes','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f888d,_0x597d3c){var _0x40f285=function(_0x225c27){while(--_0x225c27){_0x2f888d['push'](_0x2f888d['shift']());}};_0x40f285(++_0x597d3c);}(_0x2528,0x1ab));var _0x8252=function(_0x111c8b,_0x5a57bf){_0x111c8b=_0x111c8b-0x0;var _0x116b91=_0x2528[_0x111c8b];return _0x116b91;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8252('0x0'));var BPromise=require(_0x8252('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8252('0x2'))['db'];var utils=require(_0x8252('0x3'));var logger=require(_0x8252('0x4'))(_0x8252('0x5'));var config=require(_0x8252('0x6'));var jayson=require(_0x8252('0x7'));var client=jayson[_0x8252('0x8')][_0x8252('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x595b4f,_0x1b4306,_0x49ff2f){return new BPromise(function(_0x40f055,_0x33d60a){return client['request'](_0x595b4f,_0x49ff2f)['then'](function(_0x24ce22){logger[_0x8252('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1b4306,_0x8252('0xb'));logger['debug'](_0x8252('0xc'),_0x1b4306,_0x8252('0xb'),JSON[_0x8252('0xd')](_0x24ce22));if(_0x24ce22[_0x8252('0xe')]){if(_0x24ce22[_0x8252('0xe')][_0x8252('0xf')]===0x1f4){logger['error'](_0x8252('0x10'),_0x1b4306,_0x24ce22['error']['message']);return _0x33d60a(_0x24ce22[_0x8252('0xe')][_0x8252('0x11')]);}logger[_0x8252('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1b4306,_0x24ce22['error'][_0x8252('0x11')]);return _0x40f055(_0x24ce22[_0x8252('0xe')][_0x8252('0x11')]);}else{logger[_0x8252('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1b4306,_0x8252('0xb'));_0x40f055(_0x24ce22[_0x8252('0x12')][_0x8252('0x11')]);}})[_0x8252('0x13')](function(_0x51d3e8){logger['error'](_0x8252('0x10'),_0x1b4306,_0x51d3e8);_0x33d60a(_0x51d3e8);});});}exports[_0x8252('0x14')]=function(_0x91e890){var _0x492a78=this;return new Promise(function(_0x1d1f26,_0x46fe9e){return db[_0x8252('0x15')][_0x8252('0x16')](_0x91e890[_0x8252('0x17')],{'raw':_0x91e890[_0x8252('0x18')]?_0x91e890[_0x8252('0x18')][_0x8252('0x19')]===undefined?!![]:![]:!![]})[_0x8252('0x1a')](function(_0x2e2c06){logger['info'](_0x8252('0x14'),_0x91e890);logger[_0x8252('0x1b')](_0x8252('0x14'),_0x91e890,JSON[_0x8252('0xd')](_0x2e2c06));_0x1d1f26(_0x2e2c06);})[_0x8252('0x13')](function(_0x22f84d){logger[_0x8252('0xe')](_0x8252('0x14'),_0x22f84d[_0x8252('0x11')],_0x91e890);_0x46fe9e(_0x492a78[_0x8252('0xe')](0x1f4,_0x22f84d[_0x8252('0x11')]));});});};exports[_0x8252('0x1c')]=function(_0x358870){var _0x510efc=this;return new Promise(function(_0x162cb3,_0x3b6c04){return db['WhatsappQueueReport']['update'](_0x358870[_0x8252('0x17')],{'raw':_0x358870[_0x8252('0x18')]?_0x358870[_0x8252('0x18')][_0x8252('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358870[_0x8252('0x18')]?_0x358870[_0x8252('0x18')][_0x8252('0x1d')]||null:null,'attributes':_0x358870[_0x8252('0x18')]?_0x358870[_0x8252('0x18')][_0x8252('0x1e')]||null:null,'limit':_0x358870[_0x8252('0x18')]?_0x358870[_0x8252('0x18')]['limit']||null:null})[_0x8252('0x1a')](function(_0x546dbe){logger[_0x8252('0xa')](_0x8252('0x1c'),_0x358870);logger['debug'](_0x8252('0x1c'),_0x358870,JSON[_0x8252('0xd')](_0x546dbe));_0x162cb3(_0x546dbe);})[_0x8252('0x13')](function(_0x15b2fb){logger[_0x8252('0xe')](_0x8252('0x1c'),_0x15b2fb['message'],_0x358870);_0x3b6c04(_0x510efc[_0x8252('0xe')](0x1f4,_0x15b2fb[_0x8252('0x11')]));});});}; \ No newline at end of file +var _0xa3f6=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','where','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa3f6,0x84));var _0x6a3f=function(_0x5b524b,_0x4c44df){_0x5b524b=_0x5b524b-0x0;var _0x40a8e9=_0xa3f6[_0x5b524b];return _0x40a8e9;};'use strict';var _=require(_0x6a3f('0x0'));var util=require('util');var moment=require(_0x6a3f('0x1'));var BPromise=require(_0x6a3f('0x2'));var rs=require(_0x6a3f('0x3'));var fs=require('fs');var Redis=require(_0x6a3f('0x4'));var db=require(_0x6a3f('0x5'))['db'];var utils=require(_0x6a3f('0x6'));var logger=require('../../config/logger')(_0x6a3f('0x7'));var config=require(_0x6a3f('0x8'));var jayson=require(_0x6a3f('0x9'));var client=jayson[_0x6a3f('0xa')][_0x6a3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13683f,_0x509794,_0x30016a){return new BPromise(function(_0x3ae5d0,_0x16dbd3){return client[_0x6a3f('0xc')](_0x13683f,_0x30016a)[_0x6a3f('0xd')](function(_0x30fdb1){logger[_0x6a3f('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x509794,_0x6a3f('0xf'));logger[_0x6a3f('0x10')](_0x6a3f('0x11'),_0x509794,_0x6a3f('0xf'),JSON[_0x6a3f('0x12')](_0x30fdb1));if(_0x30fdb1[_0x6a3f('0x13')]){if(_0x30fdb1[_0x6a3f('0x13')][_0x6a3f('0x14')]===0x1f4){logger[_0x6a3f('0x13')](_0x6a3f('0x15'),_0x509794,_0x30fdb1['error'][_0x6a3f('0x16')]);return _0x16dbd3(_0x30fdb1['error'][_0x6a3f('0x16')]);}logger[_0x6a3f('0x13')](_0x6a3f('0x15'),_0x509794,_0x30fdb1[_0x6a3f('0x13')][_0x6a3f('0x16')]);return _0x3ae5d0(_0x30fdb1[_0x6a3f('0x13')]['message']);}else{logger[_0x6a3f('0xe')](_0x6a3f('0x15'),_0x509794,_0x6a3f('0xf'));_0x3ae5d0(_0x30fdb1[_0x6a3f('0x17')][_0x6a3f('0x16')]);}})[_0x6a3f('0x18')](function(_0x26fc6d){logger['error'](_0x6a3f('0x15'),_0x509794,_0x26fc6d);_0x16dbd3(_0x26fc6d);});});}exports['CreateWhatsappQueueReport']=function(_0x27da53){var _0x1191b7=this;return new Promise(function(_0x5d4f42,_0x2ed495){return db[_0x6a3f('0x19')]['create'](_0x27da53[_0x6a3f('0x1a')],{'raw':_0x27da53[_0x6a3f('0x1b')]?_0x27da53[_0x6a3f('0x1b')][_0x6a3f('0x1c')]===undefined?!![]:![]:!![]})[_0x6a3f('0xd')](function(_0x11100b){logger['info'](_0x6a3f('0x1d'),_0x27da53);logger['debug']('CreateWhatsappQueueReport',_0x27da53,JSON['stringify'](_0x11100b));_0x5d4f42(_0x11100b);})[_0x6a3f('0x18')](function(_0xb115b){logger[_0x6a3f('0x13')](_0x6a3f('0x1d'),_0xb115b[_0x6a3f('0x16')],_0x27da53);_0x2ed495(_0x1191b7[_0x6a3f('0x13')](0x1f4,_0xb115b[_0x6a3f('0x16')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x293bad){var _0x186248=this;return new Promise(function(_0x5d8e5a,_0x4cdfd5){return db[_0x6a3f('0x19')]['update'](_0x293bad[_0x6a3f('0x1a')],{'raw':_0x293bad['options']?_0x293bad[_0x6a3f('0x1b')][_0x6a3f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293bad[_0x6a3f('0x1b')]?_0x293bad['options'][_0x6a3f('0x1e')]||null:null,'attributes':_0x293bad[_0x6a3f('0x1b')]?_0x293bad[_0x6a3f('0x1b')][_0x6a3f('0x1f')]||null:null,'limit':_0x293bad[_0x6a3f('0x1b')]?_0x293bad['options'][_0x6a3f('0x20')]||null:null})[_0x6a3f('0xd')](function(_0x4dc36c){logger[_0x6a3f('0xe')](_0x6a3f('0x21'),_0x293bad);logger[_0x6a3f('0x10')](_0x6a3f('0x21'),_0x293bad,JSON[_0x6a3f('0x12')](_0x4dc36c));_0x5d8e5a(_0x4dc36c);})[_0x6a3f('0x18')](function(_0x226d70){logger['error'](_0x6a3f('0x21'),_0x226d70['message'],_0x293bad);_0x4cdfd5(_0x186248['error'](0x1f4,_0x226d70[_0x6a3f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index aa85a63..84b3a52 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 _0xde2b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x5196b3,_0x5aa592){var _0x48d88d=function(_0x3286e2){while(--_0x3286e2){_0x5196b3['push'](_0x5196b3['shift']());}};_0x48d88d(++_0x5aa592);}(_0xde2b,0x7c));var _0xbde2=function(_0x529d6f,_0x4c93ce){_0x529d6f=_0x529d6f-0x0;var _0x33716a=_0xde2b[_0x529d6f];return _0x33716a;};'use strict';var multer=require(_0xbde2('0x0'));var util=require(_0xbde2('0x1'));var path=require(_0xbde2('0x2'));var timeout=require(_0xbde2('0x3'));var express=require(_0xbde2('0x4'));var router=express[_0xbde2('0x5')]();var fs_extra=require(_0xbde2('0x6'));var auth=require(_0xbde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbde2('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0xbde2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbde2('0x9')](_0xbde2('0xa'),auth[_0xbde2('0xb')](),controller[_0xbde2('0xc')]);router[_0xbde2('0x9')](_0xbde2('0xd'),auth[_0xbde2('0xb')](),controller[_0xbde2('0xe')]);router[_0xbde2('0xf')]('/',auth['isAuthenticated'](),controller[_0xbde2('0x10')]);router['put'](_0xbde2('0xd'),auth[_0xbde2('0xb')](),controller[_0xbde2('0x11')]);router[_0xbde2('0x12')]('/:id',auth[_0xbde2('0xb')](),controller[_0xbde2('0x13')]);module[_0xbde2('0x14')]=router; \ No newline at end of file +var _0xb57a=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xb57a,0x17a));var _0xab57=function(_0x294863,_0x4d3166){_0x294863=_0x294863-0x0;var _0x2153e6=_0xb57a[_0x294863];return _0x2153e6;};'use strict';var multer=require(_0xab57('0x0'));var util=require(_0xab57('0x1'));var path=require(_0xab57('0x2'));var timeout=require(_0xab57('0x3'));var express=require(_0xab57('0x4'));var router=express[_0xab57('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xab57('0x6'));var interaction=require(_0xab57('0x7'));var config=require(_0xab57('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0xab57('0x9')]('/',auth[_0xab57('0xa')](),controller[_0xab57('0xb')]);router[_0xab57('0x9')](_0xab57('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xab57('0x9')](_0xab57('0xd'),auth[_0xab57('0xa')](),controller['show']);router[_0xab57('0xe')]('/',auth[_0xab57('0xa')](),controller[_0xab57('0xf')]);router[_0xab57('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xab57('0x11')]);router[_0xab57('0x12')](_0xab57('0xd'),auth[_0xab57('0xa')](),controller[_0xab57('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 32dbb9f..ae2e8e6 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 _0xb240=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0xb240,0x7e));var _0x0b24=function(_0xb7ce3e,_0x282f49){_0xb7ce3e=_0xb7ce3e-0x0;var _0x5ad9d2=_0xb240[_0xb7ce3e];return _0x5ad9d2;};'use strict';var Sequelize=require(_0x0b24('0x0'));module[_0x0b24('0x1')]={'uniqueid':{'type':Sequelize[_0x0b24('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0b24('0x3')](_0x0b24('0x4'),_0x0b24('0x5'),_0x0b24('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0b24('0x7')]}}; \ No newline at end of file +var _0x8322=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x8322,0x186));var _0x2832=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x8322[_0x61b3ab];return _0x57097f;};'use strict';var Sequelize=require(_0x2832('0x0'));module[_0x2832('0x1')]={'uniqueid':{'type':Sequelize[_0x2832('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2832('0x3')](_0x2832('0x4'),_0x2832('0x5'),_0x2832('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2832('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a04173e..134e746 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 _0x9bc1=['sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','find','destroy','params','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path'];(function(_0x39b04e,_0xcd3c5){var _0xb39132=function(_0x35ed80){while(--_0x35ed80){_0x39b04e['push'](_0x39b04e['shift']());}};_0xb39132(++_0xcd3c5);}(_0x9bc1,0x1c1));var _0x19bc=function(_0x33df84,_0x5825d1){_0x33df84=_0x33df84-0x0;var _0x42e95e=_0x9bc1[_0x33df84];return _0x42e95e;};'use strict';var emlformat=require(_0x19bc('0x0'));var rimraf=require(_0x19bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19bc('0x2'));var moment=require(_0x19bc('0x3'));var BPromise=require(_0x19bc('0x4'));var Mustache=require('mustache');var util=require(_0x19bc('0x5'));var path=require(_0x19bc('0x6'));var sox=require(_0x19bc('0x7'));var csv=require(_0x19bc('0x8'));var ejs=require(_0x19bc('0x9'));var fs=require('fs');var fs_extra=require(_0x19bc('0xa'));var _=require('lodash');var squel=require(_0x19bc('0xb'));var crypto=require(_0x19bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x19bc('0xd'));var toCsv=require(_0x19bc('0x8'));var querystring=require(_0x19bc('0xe'));var Papa=require(_0x19bc('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x19bc('0x10'));var as=require(_0x19bc('0x11'));var hardwareService=require(_0x19bc('0x12'));var logger=require(_0x19bc('0x13'))(_0x19bc('0x14'));var utils=require(_0x19bc('0x15'));var config=require(_0x19bc('0x16'));var licenseUtil=require(_0x19bc('0x17'));var db=require(_0x19bc('0x18'))['db'];function respondWithStatusCode(_0x48f9f1,_0x5b5bc8){_0x5b5bc8=_0x5b5bc8||0xcc;return function(_0x194af1){if(_0x194af1){return _0x48f9f1[_0x19bc('0x19')](_0x5b5bc8);}return _0x48f9f1[_0x19bc('0x1a')](_0x5b5bc8)[_0x19bc('0x1b')]();};}function respondWithResult(_0x466c42,_0xc6c72){_0xc6c72=_0xc6c72||0xc8;return function(_0xdb47db){if(_0xdb47db){return _0x466c42[_0x19bc('0x1a')](_0xc6c72)['json'](_0xdb47db);}};}function respondWithFilteredResult(_0x2934fa,_0x36726f){return function(_0x43d05c){if(_0x43d05c){var _0x298071=typeof _0x36726f[_0x19bc('0x1c')]==='undefined'&&typeof _0x36726f['limit']===_0x19bc('0x1d');var _0x56877a=_0x43d05c[_0x19bc('0x1e')];var _0x4890e8=_0x298071?0x0:_0x36726f[_0x19bc('0x1c')];var _0x2d8d18=_0x298071?_0x43d05c[_0x19bc('0x1e')]:_0x36726f[_0x19bc('0x1c')]+_0x36726f[_0x19bc('0x1f')];var _0x2a1d64;if(_0x2d8d18>=_0x56877a){_0x2d8d18=_0x56877a;_0x2a1d64=0xc8;}else{_0x2a1d64=0xce;}_0x2934fa[_0x19bc('0x1a')](_0x2a1d64);return _0x2934fa[_0x19bc('0x20')](_0x19bc('0x21'),_0x4890e8+'-'+_0x2d8d18+'/'+_0x56877a)['json'](_0x43d05c);}return null;};}function patchUpdates(_0x2c5fc0){return function(_0x42b598){try{jsonpatch[_0x19bc('0x22')](_0x42b598,_0x2c5fc0,!![]);}catch(_0x510652){return BPromise[_0x19bc('0x23')](_0x510652);}return _0x42b598[_0x19bc('0x24')]();};}function saveUpdates(_0xf733f2,_0x331d67){return function(_0x304ae0){if(_0x304ae0){return _0x304ae0[_0x19bc('0x25')](_0xf733f2)[_0x19bc('0x26')](function(_0x418163){return _0x418163;});}return null;};}function removeEntity(_0x486604,_0x590bc2){return function(_0xafa7c8){if(_0xafa7c8){return _0xafa7c8['destroy']()[_0x19bc('0x26')](function(){_0x486604[_0x19bc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1842de,_0x268533){return function(_0x12412e){if(!_0x12412e){_0x1842de[_0x19bc('0x19')](0x194);}return _0x12412e;};}function handleError(_0x4ec718,_0x5b474d){_0x5b474d=_0x5b474d||0x1f4;return function(_0x6f7cd1){logger[_0x19bc('0x27')](_0x6f7cd1[_0x19bc('0x28')]);if(_0x6f7cd1['name']){delete _0x6f7cd1[_0x19bc('0x29')];}_0x4ec718[_0x19bc('0x1a')](_0x5b474d)['send'](_0x6f7cd1);};}exports['index']=function(_0x214783,_0x265a8c){var _0x1ef242={},_0x39bc0a={},_0x5351e5={'count':0x0,'rows':[]};var _0x331ed1=_[_0x19bc('0x2a')](db[_0x19bc('0x2b')][_0x19bc('0x2c')],function(_0x8a3d24){return{'name':_0x8a3d24[_0x19bc('0x2d')],'type':_0x8a3d24[_0x19bc('0x2e')][_0x19bc('0x2f')]};});_0x39bc0a[_0x19bc('0x30')]=_[_0x19bc('0x2a')](_0x331ed1,_0x19bc('0x29'));_0x39bc0a[_0x19bc('0x31')]=_[_0x19bc('0x32')](_0x214783[_0x19bc('0x31')]);_0x39bc0a[_0x19bc('0x33')]=_[_0x19bc('0x34')](_0x39bc0a[_0x19bc('0x30')],_0x39bc0a[_0x19bc('0x31')]);_0x1ef242['attributes']=_['intersection'](_0x39bc0a[_0x19bc('0x30')],qs[_0x19bc('0x35')](_0x214783[_0x19bc('0x31')][_0x19bc('0x35')]));_0x1ef242[_0x19bc('0x36')]=_0x1ef242[_0x19bc('0x36')][_0x19bc('0x37')]?_0x1ef242[_0x19bc('0x36')]:_0x39bc0a[_0x19bc('0x30')];if(!_0x214783[_0x19bc('0x31')][_0x19bc('0x38')]('nolimit')){_0x1ef242['limit']=qs[_0x19bc('0x1f')](_0x214783[_0x19bc('0x31')][_0x19bc('0x1f')]);_0x1ef242[_0x19bc('0x1c')]=qs[_0x19bc('0x1c')](_0x214783[_0x19bc('0x31')][_0x19bc('0x1c')]);}_0x1ef242[_0x19bc('0x39')]=qs[_0x19bc('0x3a')](_0x214783[_0x19bc('0x31')][_0x19bc('0x3a')]);_0x1ef242[_0x19bc('0x3b')]=qs['filters'](_['pick'](_0x214783[_0x19bc('0x31')],_0x39bc0a[_0x19bc('0x33')]),_0x331ed1);if(_0x214783[_0x19bc('0x31')][_0x19bc('0x3c')]){_0x1ef242[_0x19bc('0x3b')]=_[_0x19bc('0x3d')](_0x1ef242[_0x19bc('0x3b')],{'$or':_[_0x19bc('0x2a')](_0x331ed1,function(_0x25862c){if(_0x25862c[_0x19bc('0x2e')]!==_0x19bc('0x3e')){var _0x4e9fe6={};_0x4e9fe6[_0x25862c['name']]={'$like':'%'+_0x214783[_0x19bc('0x31')][_0x19bc('0x3c')]+'%'};return _0x4e9fe6;}})});}_0x1ef242=_[_0x19bc('0x3d')]({},_0x1ef242,_0x214783[_0x19bc('0x3f')]);var _0xaa389={'where':_0x1ef242[_0x19bc('0x3b')]};return db['WhatsappTransferReport'][_0x19bc('0x1e')](_0xaa389)[_0x19bc('0x26')](function(_0x388e15){_0x5351e5[_0x19bc('0x1e')]=_0x388e15;if(_0x214783[_0x19bc('0x31')][_0x19bc('0x40')]){_0x1ef242[_0x19bc('0x41')]=[{'all':!![]}];}return db[_0x19bc('0x2b')][_0x19bc('0x42')](_0x1ef242);})[_0x19bc('0x26')](function(_0x56caa9){_0x5351e5[_0x19bc('0x43')]=_0x56caa9;return _0x5351e5;})[_0x19bc('0x26')](respondWithFilteredResult(_0x265a8c,_0x1ef242))['catch'](handleError(_0x265a8c,null));};exports[_0x19bc('0x44')]=function(_0x153bdb,_0x37677d){var _0x384d46={'raw':!![],'where':{'id':_0x153bdb['params']['id']}},_0x579b97={};_0x579b97[_0x19bc('0x30')]=_['keys'](db[_0x19bc('0x2b')][_0x19bc('0x2c')]);_0x579b97['query']=_[_0x19bc('0x32')](_0x153bdb[_0x19bc('0x31')]);_0x579b97[_0x19bc('0x33')]=_[_0x19bc('0x34')](_0x579b97[_0x19bc('0x30')],_0x579b97['query']);_0x384d46[_0x19bc('0x36')]=_[_0x19bc('0x34')](_0x579b97[_0x19bc('0x30')],qs[_0x19bc('0x35')](_0x153bdb[_0x19bc('0x31')][_0x19bc('0x35')]));_0x384d46[_0x19bc('0x36')]=_0x384d46[_0x19bc('0x36')][_0x19bc('0x37')]?_0x384d46[_0x19bc('0x36')]:_0x579b97[_0x19bc('0x30')];if(_0x153bdb[_0x19bc('0x31')]['includeAll']){_0x384d46[_0x19bc('0x41')]=[{'all':!![]}];}_0x384d46=_[_0x19bc('0x3d')]({},_0x384d46,_0x153bdb[_0x19bc('0x3f')]);return db[_0x19bc('0x2b')]['find'](_0x384d46)['then'](handleEntityNotFound(_0x37677d,null))[_0x19bc('0x26')](respondWithResult(_0x37677d,null))[_0x19bc('0x45')](handleError(_0x37677d,null));};exports[_0x19bc('0x46')]=function(_0x354513,_0x3fea12){return db[_0x19bc('0x2b')][_0x19bc('0x46')](_0x354513[_0x19bc('0x47')],{})['then'](respondWithResult(_0x3fea12,0xc9))[_0x19bc('0x45')](handleError(_0x3fea12,null));};exports['update']=function(_0x21db65,_0x12da2f){if(_0x21db65[_0x19bc('0x47')]['id']){delete _0x21db65[_0x19bc('0x47')]['id'];}return db[_0x19bc('0x2b')][_0x19bc('0x48')]({'where':{'id':_0x21db65['params']['id']}})[_0x19bc('0x26')](handleEntityNotFound(_0x12da2f,null))[_0x19bc('0x26')](saveUpdates(_0x21db65['body'],null))['then'](respondWithResult(_0x12da2f,null))[_0x19bc('0x45')](handleError(_0x12da2f,null));};exports[_0x19bc('0x49')]=function(_0x73be6f,_0x37e5e1){return db[_0x19bc('0x2b')]['find']({'where':{'id':_0x73be6f[_0x19bc('0x4a')]['id']}})[_0x19bc('0x26')](handleEntityNotFound(_0x37e5e1,null))[_0x19bc('0x26')](removeEntity(_0x37e5e1,null))['catch'](handleError(_0x37e5e1,null));};exports[_0x19bc('0x4b')]=function(_0x3aa9cb,_0x5980e8){return db[_0x19bc('0x2b')][_0x19bc('0x4b')]()[_0x19bc('0x26')](respondWithResult(_0x5980e8,null))[_0x19bc('0x45')](handleError(_0x5980e8,null));}; \ No newline at end of file +var _0x4024=['offset','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','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'];(function(_0x4c88d6,_0x49ab68){var _0x16b5b8=function(_0x3b1ede){while(--_0x3b1ede){_0x4c88d6['push'](_0x4c88d6['shift']());}};_0x16b5b8(++_0x49ab68);}(_0x4024,0x152));var _0x4402=function(_0x44624d,_0x45b19c){_0x44624d=_0x44624d-0x0;var _0x5590bc=_0x4024[_0x44624d];return _0x5590bc;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4402('0x4'));var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require(_0x4402('0x7'));var csv=require('to-csv');var ejs=require(_0x4402('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4402('0x9'));var squel=require(_0x4402('0xa'));var crypto=require(_0x4402('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xc'));var querystring=require(_0x4402('0xd'));var Papa=require(_0x4402('0xe'));var Redis=require(_0x4402('0xf'));var authService=require(_0x4402('0x10'));var qs=require(_0x4402('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0x12'));var logger=require(_0x4402('0x13'))(_0x4402('0x14'));var utils=require(_0x4402('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x16'));var db=require(_0x4402('0x17'))['db'];function respondWithStatusCode(_0x5014c4,_0x40b3fb){_0x40b3fb=_0x40b3fb||0xcc;return function(_0x4ed51f){if(_0x4ed51f){return _0x5014c4[_0x4402('0x18')](_0x40b3fb);}return _0x5014c4[_0x4402('0x19')](_0x40b3fb)[_0x4402('0x1a')]();};}function respondWithResult(_0x3ad42b,_0xd20817){_0xd20817=_0xd20817||0xc8;return function(_0x5d05d9){if(_0x5d05d9){return _0x3ad42b[_0x4402('0x19')](_0xd20817)['json'](_0x5d05d9);}};}function respondWithFilteredResult(_0x2cf58e,_0x6087c5){return function(_0x370abc){if(_0x370abc){var _0x581cc0=typeof _0x6087c5[_0x4402('0x1b')]==='undefined'&&typeof _0x6087c5[_0x4402('0x1c')]==='undefined';var _0x86be26=_0x370abc[_0x4402('0x1d')];var _0x1819b2=_0x581cc0?0x0:_0x6087c5[_0x4402('0x1b')];var _0x482ae3=_0x581cc0?_0x370abc[_0x4402('0x1d')]:_0x6087c5[_0x4402('0x1b')]+_0x6087c5[_0x4402('0x1c')];var _0x1eccc9;if(_0x482ae3>=_0x86be26){_0x482ae3=_0x86be26;_0x1eccc9=0xc8;}else{_0x1eccc9=0xce;}_0x2cf58e[_0x4402('0x19')](_0x1eccc9);return _0x2cf58e['set'](_0x4402('0x1e'),_0x1819b2+'-'+_0x482ae3+'/'+_0x86be26)[_0x4402('0x1f')](_0x370abc);}return null;};}function patchUpdates(_0x26bc08){return function(_0x2b0605){try{jsonpatch[_0x4402('0x20')](_0x2b0605,_0x26bc08,!![]);}catch(_0x3f12aa){return BPromise[_0x4402('0x21')](_0x3f12aa);}return _0x2b0605['save']();};}function saveUpdates(_0x151d9b,_0x3a5803){return function(_0x42d65d){if(_0x42d65d){return _0x42d65d[_0x4402('0x22')](_0x151d9b)[_0x4402('0x23')](function(_0x4f4393){return _0x4f4393;});}return null;};}function removeEntity(_0x34b4a9,_0x4f96b4){return function(_0x449a47){if(_0x449a47){return _0x449a47[_0x4402('0x24')]()[_0x4402('0x23')](function(){_0x34b4a9[_0x4402('0x19')](0xcc)[_0x4402('0x1a')]();});}};}function handleEntityNotFound(_0x567fee,_0x3eb847){return function(_0x46aa88){if(!_0x46aa88){_0x567fee['sendStatus'](0x194);}return _0x46aa88;};}function handleError(_0x1fd95a,_0x41f2da){_0x41f2da=_0x41f2da||0x1f4;return function(_0xfd818e){logger[_0x4402('0x25')](_0xfd818e[_0x4402('0x26')]);if(_0xfd818e[_0x4402('0x27')]){delete _0xfd818e['name'];}_0x1fd95a['status'](_0x41f2da)[_0x4402('0x28')](_0xfd818e);};}exports[_0x4402('0x29')]=function(_0x3f1b3c,_0x228626){var _0xa26a8f={},_0x17ae42={},_0xe3794e={'count':0x0,'rows':[]};var _0x2c3099=_[_0x4402('0x2a')](db[_0x4402('0x2b')][_0x4402('0x2c')],function(_0x2817ad){return{'name':_0x2817ad['fieldName'],'type':_0x2817ad[_0x4402('0x2d')][_0x4402('0x2e')]};});_0x17ae42[_0x4402('0x2f')]=_[_0x4402('0x2a')](_0x2c3099,_0x4402('0x27'));_0x17ae42[_0x4402('0x30')]=_['keys'](_0x3f1b3c['query']);_0x17ae42['filters']=_['intersection'](_0x17ae42[_0x4402('0x2f')],_0x17ae42[_0x4402('0x30')]);_0xa26a8f['attributes']=_['intersection'](_0x17ae42[_0x4402('0x2f')],qs[_0x4402('0x31')](_0x3f1b3c[_0x4402('0x30')][_0x4402('0x31')]));_0xa26a8f[_0x4402('0x32')]=_0xa26a8f[_0x4402('0x32')][_0x4402('0x33')]?_0xa26a8f[_0x4402('0x32')]:_0x17ae42['model'];if(!_0x3f1b3c[_0x4402('0x30')][_0x4402('0x34')]('nolimit')){_0xa26a8f[_0x4402('0x1c')]=qs[_0x4402('0x1c')](_0x3f1b3c[_0x4402('0x30')]['limit']);_0xa26a8f[_0x4402('0x1b')]=qs[_0x4402('0x1b')](_0x3f1b3c[_0x4402('0x30')]['offset']);}_0xa26a8f[_0x4402('0x35')]=qs[_0x4402('0x36')](_0x3f1b3c[_0x4402('0x30')][_0x4402('0x36')]);_0xa26a8f['where']=qs[_0x4402('0x37')](_['pick'](_0x3f1b3c[_0x4402('0x30')],_0x17ae42[_0x4402('0x37')]),_0x2c3099);if(_0x3f1b3c[_0x4402('0x30')][_0x4402('0x38')]){_0xa26a8f[_0x4402('0x39')]=_[_0x4402('0x3a')](_0xa26a8f[_0x4402('0x39')],{'$or':_[_0x4402('0x2a')](_0x2c3099,function(_0x170e0d){if(_0x170e0d[_0x4402('0x2d')]!==_0x4402('0x3b')){var _0x2f998d={};_0x2f998d[_0x170e0d[_0x4402('0x27')]]={'$like':'%'+_0x3f1b3c[_0x4402('0x30')]['filter']+'%'};return _0x2f998d;}})});}_0xa26a8f=_[_0x4402('0x3a')]({},_0xa26a8f,_0x3f1b3c[_0x4402('0x3c')]);var _0x3b706c={'where':_0xa26a8f['where']};return db[_0x4402('0x2b')][_0x4402('0x1d')](_0x3b706c)[_0x4402('0x23')](function(_0x286956){_0xe3794e[_0x4402('0x1d')]=_0x286956;if(_0x3f1b3c[_0x4402('0x30')][_0x4402('0x3d')]){_0xa26a8f[_0x4402('0x3e')]=[{'all':!![]}];}return db[_0x4402('0x2b')][_0x4402('0x3f')](_0xa26a8f);})['then'](function(_0x6b8251){_0xe3794e['rows']=_0x6b8251;return _0xe3794e;})[_0x4402('0x23')](respondWithFilteredResult(_0x228626,_0xa26a8f))[_0x4402('0x40')](handleError(_0x228626,null));};exports[_0x4402('0x41')]=function(_0x33e876,_0x3e01ed){var _0x26620d={'raw':!![],'where':{'id':_0x33e876[_0x4402('0x42')]['id']}},_0x5143bb={};_0x5143bb['model']=_[_0x4402('0x43')](db[_0x4402('0x2b')][_0x4402('0x2c')]);_0x5143bb[_0x4402('0x30')]=_[_0x4402('0x43')](_0x33e876[_0x4402('0x30')]);_0x5143bb[_0x4402('0x37')]=_['intersection'](_0x5143bb[_0x4402('0x2f')],_0x5143bb[_0x4402('0x30')]);_0x26620d[_0x4402('0x32')]=_[_0x4402('0x44')](_0x5143bb['model'],qs['fields'](_0x33e876[_0x4402('0x30')][_0x4402('0x31')]));_0x26620d[_0x4402('0x32')]=_0x26620d[_0x4402('0x32')]['length']?_0x26620d[_0x4402('0x32')]:_0x5143bb[_0x4402('0x2f')];if(_0x33e876[_0x4402('0x30')][_0x4402('0x3d')]){_0x26620d[_0x4402('0x3e')]=[{'all':!![]}];}_0x26620d=_['merge']({},_0x26620d,_0x33e876[_0x4402('0x3c')]);return db[_0x4402('0x2b')][_0x4402('0x45')](_0x26620d)[_0x4402('0x23')](handleEntityNotFound(_0x3e01ed,null))[_0x4402('0x23')](respondWithResult(_0x3e01ed,null))[_0x4402('0x40')](handleError(_0x3e01ed,null));};exports['create']=function(_0x104ebe,_0x4a0031){return db[_0x4402('0x2b')][_0x4402('0x46')](_0x104ebe[_0x4402('0x47')],{})[_0x4402('0x23')](respondWithResult(_0x4a0031,0xc9))[_0x4402('0x40')](handleError(_0x4a0031,null));};exports[_0x4402('0x22')]=function(_0xfcaa71,_0x51ca46){if(_0xfcaa71[_0x4402('0x47')]['id']){delete _0xfcaa71[_0x4402('0x47')]['id'];}return db['WhatsappTransferReport'][_0x4402('0x45')]({'where':{'id':_0xfcaa71['params']['id']}})['then'](handleEntityNotFound(_0x51ca46,null))[_0x4402('0x23')](saveUpdates(_0xfcaa71['body'],null))['then'](respondWithResult(_0x51ca46,null))[_0x4402('0x40')](handleError(_0x51ca46,null));};exports[_0x4402('0x24')]=function(_0x4a7c9c,_0x5cb8f8){return db[_0x4402('0x2b')][_0x4402('0x45')]({'where':{'id':_0x4a7c9c[_0x4402('0x42')]['id']}})[_0x4402('0x23')](handleEntityNotFound(_0x5cb8f8,null))[_0x4402('0x23')](removeEntity(_0x5cb8f8,null))[_0x4402('0x40')](handleError(_0x5cb8f8,null));};exports[_0x4402('0x48')]=function(_0x497a12,_0x380924){return db[_0x4402('0x2b')][_0x4402('0x48')]()[_0x4402('0x23')](respondWithResult(_0x380924,null))[_0x4402('0x40')](handleError(_0x380924,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index c22e187..bff72cb 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 _0xaf41=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xaf41,0x1bf));var _0x1af4=function(_0x397220,_0x5f1296){_0x397220=_0x397220-0x0;var _0x59e335=_0xaf41[_0x397220];return _0x59e335;};'use strict';var _=require(_0x1af4('0x0'));var util=require(_0x1af4('0x1'));var logger=require(_0x1af4('0x2'))(_0x1af4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1af4('0x4'));var fs=require('fs');var path=require(_0x1af4('0x5'));var rimraf=require(_0x1af4('0x6'));var config=require(_0x1af4('0x7'));var attributes=require(_0x1af4('0x8'));module[_0x1af4('0x9')]=function(_0x3289d0,_0x17fe59){return _0x3289d0[_0x1af4('0xa')](_0x1af4('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x1af4('0xc'),'fields':[_0x1af4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc850=['uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x320c8c,_0x283f9e){var _0x2dcf9a=function(_0x18717b){while(--_0x18717b){_0x320c8c['push'](_0x320c8c['shift']());}};_0x2dcf9a(++_0x283f9e);}(_0xc850,0x18d));var _0x0c85=function(_0x23c87c,_0x11e413){_0x23c87c=_0x23c87c-0x0;var _0x48603b=_0xc850[_0x23c87c];return _0x48603b;};'use strict';var _=require(_0x0c85('0x0'));var util=require(_0x0c85('0x1'));var logger=require(_0x0c85('0x2'))('api');var moment=require(_0x0c85('0x3'));var BPromise=require(_0x0c85('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0c85('0x5'));var config=require(_0x0c85('0x6'));var attributes=require(_0x0c85('0x7'));module['exports']=function(_0x256a09,_0x84a984){return _0x256a09[_0x0c85('0x8')](_0x0c85('0x9'),attributes,{'tableName':_0x0c85('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0c85('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ffe03b1..2fc4039 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 _0xc532=['../../config/utils','../../config/logger','rpc','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x449000,_0x4bd8e5){var _0x5d08f9=function(_0x291978){while(--_0x291978){_0x449000['push'](_0x449000['shift']());}};_0x5d08f9(++_0x4bd8e5);}(_0xc532,0x160));var _0x2c53=function(_0x27bccd,_0x3bd6c9){_0x27bccd=_0x27bccd-0x0;var _0x590a28=_0xc532[_0x27bccd];return _0x590a28;};'use strict';var _=require(_0x2c53('0x0'));var util=require(_0x2c53('0x1'));var moment=require('moment');var BPromise=require(_0x2c53('0x2'));var rs=require(_0x2c53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c53('0x4'))['db'];var utils=require(_0x2c53('0x5'));var logger=require(_0x2c53('0x6'))(_0x2c53('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c53('0x8'));var client=jayson['client'][_0x2c53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a2edf,_0x55862e,_0x2694b8){return new BPromise(function(_0x22f3d8,_0x283554){return client['request'](_0x3a2edf,_0x2694b8)['then'](function(_0x490e07){logger[_0x2c53('0xa')](_0x2c53('0xb'),_0x55862e,_0x2c53('0xc'));logger[_0x2c53('0xd')](_0x2c53('0xe'),_0x55862e,_0x2c53('0xc'),JSON[_0x2c53('0xf')](_0x490e07));if(_0x490e07[_0x2c53('0x10')]){if(_0x490e07[_0x2c53('0x10')][_0x2c53('0x11')]===0x1f4){logger[_0x2c53('0x10')](_0x2c53('0xb'),_0x55862e,_0x490e07['error']['message']);return _0x283554(_0x490e07[_0x2c53('0x10')]['message']);}logger[_0x2c53('0x10')](_0x2c53('0xb'),_0x55862e,_0x490e07[_0x2c53('0x10')][_0x2c53('0x12')]);return _0x22f3d8(_0x490e07[_0x2c53('0x10')][_0x2c53('0x12')]);}else{logger['info'](_0x2c53('0xb'),_0x55862e,_0x2c53('0xc'));_0x22f3d8(_0x490e07[_0x2c53('0x13')][_0x2c53('0x12')]);}})[_0x2c53('0x14')](function(_0x1beae6){logger[_0x2c53('0x10')](_0x2c53('0xb'),_0x55862e,_0x1beae6);_0x283554(_0x1beae6);});});} \ No newline at end of file +var _0xfb18=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xfb18,0x1cd));var _0x8fb1=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0xfb18[_0x271537];return _0x19dc22;};'use strict';var _=require(_0x8fb1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8fb1('0x1'));var rs=require(_0x8fb1('0x2'));var fs=require('fs');var Redis=require(_0x8fb1('0x3'));var db=require(_0x8fb1('0x4'))['db'];var utils=require(_0x8fb1('0x5'));var logger=require('../../config/logger')(_0x8fb1('0x6'));var config=require(_0x8fb1('0x7'));var jayson=require(_0x8fb1('0x8'));var client=jayson[_0x8fb1('0x9')][_0x8fb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x305b33,_0x4fd0eb,_0x11079a){return new BPromise(function(_0x43d52c,_0x1d7d2c){return client[_0x8fb1('0xb')](_0x305b33,_0x11079a)['then'](function(_0x57c7a5){logger[_0x8fb1('0xc')](_0x8fb1('0xd'),_0x4fd0eb,_0x8fb1('0xe'));logger[_0x8fb1('0xf')](_0x8fb1('0x10'),_0x4fd0eb,_0x8fb1('0xe'),JSON[_0x8fb1('0x11')](_0x57c7a5));if(_0x57c7a5[_0x8fb1('0x12')]){if(_0x57c7a5['error'][_0x8fb1('0x13')]===0x1f4){logger[_0x8fb1('0x12')](_0x8fb1('0xd'),_0x4fd0eb,_0x57c7a5[_0x8fb1('0x12')][_0x8fb1('0x14')]);return _0x1d7d2c(_0x57c7a5[_0x8fb1('0x12')][_0x8fb1('0x14')]);}logger[_0x8fb1('0x12')](_0x8fb1('0xd'),_0x4fd0eb,_0x57c7a5[_0x8fb1('0x12')][_0x8fb1('0x14')]);return _0x43d52c(_0x57c7a5['error'][_0x8fb1('0x14')]);}else{logger[_0x8fb1('0xc')](_0x8fb1('0xd'),_0x4fd0eb,_0x8fb1('0xe'));_0x43d52c(_0x57c7a5['result'][_0x8fb1('0x14')]);}})[_0x8fb1('0x15')](function(_0x3e59c1){logger[_0x8fb1('0x12')](_0x8fb1('0xd'),_0x4fd0eb,_0x3e59c1);_0x1d7d2c(_0x3e59c1);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 33e5880..44d471d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe548=['log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','filter','online','join','Offline\x20apps:','status','App\x20Ready!','catch'];(function(_0x46941b,_0xc3e071){var _0x3308b6=function(_0x2725f8){while(--_0x2725f8){_0x46941b['push'](_0x46941b['shift']());}};_0x3308b6(++_0xc3e071);}(_0xe548,0x184));var _0x8e54=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0xe548[_0x54bac5];return _0xc15971;};'use strict';var _=require(_0x8e54('0x0'));var db=require(_0x8e54('0x1'))['db'];var seedDb=require(_0x8e54('0x2'));var checkLicense=require(_0x8e54('0x3'));var rpc=require(_0x8e54('0x4'));var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x8e54('0x5'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x8e54('0x6'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x8e54('0x7'));function main(){return db[_0x8e54('0x8')][_0x8e54('0x9')]()[_0x8e54('0xa')](function(){if(config[_0x8e54('0xb')]){return seedDb[_0x8e54('0xc')]();}})[_0x8e54('0xa')](function(){return checkLicense['default']();})[_0x8e54('0xa')](function(){return rpc[_0x8e54('0xd')]();})[_0x8e54('0xa')](function(_0x305327){logger[_0x8e54('0xe')](_0x305327);return chat['start']();})[_0x8e54('0xa')](function(){return whatsapp[_0x8e54('0xf')]();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe['start']();})[_0x8e54('0xa')](function(){return provider[_0x8e54('0xf')]();})[_0x8e54('0xa')](function(_0x48d210){logger[_0x8e54('0xe')](_0x48d210);return pm2[_0x8e54('0xf')](pm2Config);})['then'](function(_0x5848e5){var _0x2e48d5=_0x5848e5['filter'](function(_0x4e66f4){return typeof _0x4e66f4['exitCode']==='number'&&_0x4e66f4[_0x8e54('0x10')]>=0x0;});if(_0x2e48d5[_0x8e54('0x11')]>0x0){throw new Error(_0x2e48d5['length']+_0x8e54('0x12')+_[_0x8e54('0x13')](_0x2e48d5,function(_0x20caac){return'\x22'+_0x20caac['pm2_env'][_0x8e54('0x14')]+'\x22';}));}logger[_0x8e54('0xe')]('Online\x20apps:',_[_0x8e54('0x13')](_[_0x8e54('0x15')](_0x5848e5,{'status':_0x8e54('0x16')}),_0x8e54('0x14'))[_0x8e54('0x17')]());logger['info'](_0x8e54('0x18'),_[_0x8e54('0x13')](_[_0x8e54('0x15')](_0x5848e5,function(_0x5d065f){return _0x5d065f[_0x8e54('0x19')]!==_0x8e54('0x16');}),_0x8e54('0x14'))['join']()||'None');console['log'](_0x8e54('0x1a'));})[_0x8e54('0x1b')](function(_0x5d56f1){console[_0x8e54('0x1c')](_0x8e54('0x1d'),_0x5d56f1);logger[_0x8e54('0x1e')](_0x8e54('0x1f'),_0x5d56f1);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x9432=['None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license','./rpc','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','name','Online\x20apps:','map','join','Offline\x20apps:','online'];(function(_0x3ffada,_0x56cf31){var _0x2da4f2=function(_0x462065){while(--_0x462065){_0x3ffada['push'](_0x3ffada['shift']());}};_0x2da4f2(++_0x56cf31);}(_0x9432,0x1e3));var _0x2943=function(_0x5d4477,_0x5b5bc2){_0x5d4477=_0x5d4477-0x0;var _0x3dc648=_0x9432[_0x5d4477];return _0x3dc648;};'use strict';var _=require(_0x2943('0x0'));var db=require(_0x2943('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x2943('0x2'));var rpc=require(_0x2943('0x3'));var config=require('./config/environment');var logger=require(_0x2943('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x2943('0x5'));var schedule=require(_0x2943('0x6'));var chat=require(_0x2943('0x7'));var whatsapp=require(_0x2943('0x8'));var transcribe=require(_0x2943('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x2943('0xa')][_0x2943('0xb')]()[_0x2943('0xc')](function(){if(config[_0x2943('0xd')]){return seedDb['default']();}})[_0x2943('0xc')](function(){return checkLicense[_0x2943('0xe')]();})[_0x2943('0xc')](function(){return rpc['listen']();})[_0x2943('0xc')](function(_0x4f0262){logger[_0x2943('0xf')](_0x4f0262);return chat[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return whatsapp[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return schedule[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return transcribe[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return provider[_0x2943('0x10')]();})[_0x2943('0xc')](function(_0x1a246c){logger[_0x2943('0xf')](_0x1a246c);return pm2['start'](pm2Config);})[_0x2943('0xc')](function(_0x32b897){var _0x19bbfd=_0x32b897[_0x2943('0x11')](function(_0x11a622){return typeof _0x11a622[_0x2943('0x12')]===_0x2943('0x13')&&_0x11a622['exitCode']>=0x0;});if(_0x19bbfd['length']>0x0){throw new Error(_0x19bbfd[_0x2943('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x19bbfd,function(_0x10f6bc){return'\x22'+_0x10f6bc['pm2_env'][_0x2943('0x15')]+'\x22';}));}logger['info'](_0x2943('0x16'),_[_0x2943('0x17')](_[_0x2943('0x11')](_0x32b897,{'status':'online'}),_0x2943('0x15'))[_0x2943('0x18')]());logger['info'](_0x2943('0x19'),_[_0x2943('0x17')](_[_0x2943('0x11')](_0x32b897,function(_0x1a107a){return _0x1a107a['status']!==_0x2943('0x1a');}),_0x2943('0x15'))['join']()||_0x2943('0x1b'));console[_0x2943('0x1c')](_0x2943('0x1d'));})[_0x2943('0x1e')](function(_0x4fcdc3){console[_0x2943('0x1c')](_0x2943('0x1f'),_0x4fcdc3);logger[_0x2943('0x20')](_0x2943('0x21'),_0x4fcdc3);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3e22816..10e7c5a 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x7f848a,_0x4e4549){var _0x345844=function(_0x1af1f4){while(--_0x1af1f4){_0x7f848a['push'](_0x7f848a['shift']());}};_0x345844(++_0x4e4549);}(_0x55ca,0x126));var _0xa55c=function(_0x2f163c,_0x27bd79){_0x2f163c=_0x2f163c-0x0;var _0x3dd996=_0x55ca[_0x2f163c];return _0x3dd996;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0x6aa7=['smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x1afb0d,_0x4dda68){_0x1afb0d=_0x1afb0d-0x0;var _0x1e0507=_0x6aa7[_0x1afb0d];return _0x1e0507;};'use strict';var db=require(_0x76aa('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x76aa('0x1'));var licenseUtil=require(_0x76aa('0x2'));var encryptor=require(_0x76aa('0x3'));var _=require(_0x76aa('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x76aa('0x5'));var compose=require(_0x76aa('0x6'));var basicAuth=require(_0x76aa('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x76aa('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x76aa('0x9')][_0x76aa('0xa')]});var userAttributes=['id',_0x76aa('0xb'),'fullname',_0x76aa('0xc'),_0x76aa('0xd'),_0x76aa('0xe'),'userpic',_0x76aa('0xf'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13'),_0x76aa('0x14'),_0x76aa('0x15'),_0x76aa('0x16'),_0x76aa('0x17'),_0x76aa('0x18'),'lastLoginAt',_0x76aa('0x19'),'crudPermissions',_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d'),_0x76aa('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x76aa('0x1f'),'phoneBarEnableSettings',_0x76aa('0x20'),_0x76aa('0x21'),'phoneBarRemoteControl',_0x76aa('0x22'),'hotdesk',_0x76aa('0x23'),'userProfileId',_0x76aa('0x24'),_0x76aa('0x25'),_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2f'),_0x76aa('0x30'),_0x76aa('0x31'),_0x76aa('0x32'),'faxAutoanswerDelay',_0x76aa('0x33'),_0x76aa('0x34')];exports[_0x76aa('0x35')]=function(){return this['isAuthenticated'](!![])[_0x76aa('0x36')](function(_0x189cb6,_0x31252f,_0x2bd2c6){if(_0x189cb6[_0x76aa('0x37')]){_0x2bd2c6();}else{return db[_0x76aa('0x38')][_0x76aa('0x39')]({'where':{'id':_0x189cb6[_0x76aa('0x3a')]['id']},'attributes':['id',_0x76aa('0x3b'),_0x76aa('0x3c')],'raw':!![]})[_0x76aa('0x3d')](function(_0x26b75e){if(_0x26b75e&&_0x26b75e[_0x76aa('0x3b')]){return _0x31252f['status'](_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?0x195:0x193)[_0x76aa('0x3f')]({'message':_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?_0x76aa('0x40'):_0x76aa('0x41')});}else{_0x2bd2c6();}})[_0x76aa('0x42')](function(_0xd12a99){_0x2bd2c6(_0xd12a99);});}});};exports[_0x76aa('0x43')]=function isAuthenticated(_0x545b06){return compose()[_0x76aa('0x36')](function(_0x5a8030,_0x994550,_0x365ff8){var _0x2dec94;if(_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')]){if(_[_0x76aa('0x46')](_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')],_0x76aa('0x47'))){var _0x3ea05a=basicAuth(_0x5a8030);db['User'][_0x76aa('0x48')]({'where':{'name':_0x3ea05a[_0x76aa('0xc')]}})[_0x76aa('0x3d')](function(_0x928ccf){if(!_0x928ccf||!_0x928ccf[_0x76aa('0x49')](_0x3ea05a[_0x76aa('0x4a')])){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x4c')});}_0x5a8030[_0x76aa('0x37')]={'id':_0x928ccf['id']};_0x365ff8();})['catch'](function(_0x2ee338){_0x365ff8(_0x2ee338);});}else if(_['startsWith'](_0x5a8030[_0x76aa('0x44')]['authorization'],_0x76aa('0x4d'))){validateJwt(_0x5a8030,_0x994550,_0x365ff8);}else{if(_0x545b06){_0x365ff8();}else{return _0x994550['status'](0x193)['json']({'message':_0x76aa('0x4e')});}}}else if(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')]){try{var _0x37dfab={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')],_0x37dfab)[_0x76aa('0x3d')](function(_0x23e2fd){return db[_0x76aa('0x51')]['find']({'where':{'id':_0x23e2fd[_0x76aa('0x52')]}})['then'](function(_0x5086f5){_0x2dec94=_0x5086f5;return db[_0x76aa('0x53')][_0x76aa('0x39')]({'where':{'id':0x1},'attributes':[_0x76aa('0x54'),_0x76aa('0x55')],'raw':!![]});})['then'](function(_0x401c07){if(!_0x2dec94||!_[_0x76aa('0x56')](_0x2dec94[_0x76aa('0x57')],_0x23e2fd['nonce'])){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x58')});}if(_0x2dec94[_0x76aa('0x59')]){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}if(_0x2dec94[_0x76aa('0x5b')]){if(_0x401c07[_0x76aa('0x55')]>0x0){if(moment(_0x2dec94['blockedAt'])[_0x76aa('0x5c')](_0x401c07[_0x76aa('0x55')],_0x76aa('0x5d'))>moment()){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}}else{return _0x994550['status'](0x191)['json']({'message':_0x76aa('0x5a')});}}_0x5a8030[_0x76aa('0x37')]={'id':_0x2dec94['id']};_0x365ff8();});})[_0x76aa('0x42')](function(){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x5a')});});}catch(_0x403084){_0x365ff8(_0x403084);}}else if(_0x545b06){_0x365ff8();}else{return _0x994550[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x4e')});}})['use'](function(_0x13dafe,_0x556f59,_0xbb3136){if(_0x13dafe['user']){db['User']['find']({'where':{'id':_0x13dafe[_0x76aa('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5cf314){if(!_0x5cf314){return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5e')});}_0x13dafe[_0x76aa('0x37')]=_0x5cf314;_0xbb3136();})[_0x76aa('0x42')](function(_0x27a52e){_0xbb3136(_0x27a52e);});}else if(_0x545b06){_0xbb3136();}else{return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5f')});}});};exports[_0x76aa('0x60')]=function canUpdate(){return compose()[_0x76aa('0x36')](function(_0x3800a4,_0x47a308,_0x2f695c){return licenseUtil[_0x76aa('0x61')]()['then'](function(_0x2d3441){if(_0x2d3441['update']){_0x2f695c();}else{return _0x47a308[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})[_0x76aa('0x42')](function(_0x2d0bc4){_0x2f695c(_0x2d0bc4);});});};exports[_0x76aa('0x63')]=function isWebrtcLicence(){return compose()[_0x76aa('0x36')](function(_0x165858,_0xb8d052,_0x3946bd){return licenseUtil['getLicense']()[_0x76aa('0x3d')](function(_0x4b8f12){if(_0x4b8f12[_0x76aa('0x64')]){_0x3946bd();}else{return _0xb8d052[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})['catch'](function(_0x5a3d9c){_0x3946bd(_0x5a3d9c);});});};exports[_0x76aa('0x65')]=function(_0x54b673,_0x8660a4,_0x302a0c){_0x54b673[_0x76aa('0x65')]=!![];return _0x302a0c();};exports[_0x76aa('0x66')]=function signToken(_0x30c577){return signJwt(_0x30c577);};exports[_0x76aa('0x67')]=function(_0x5b567b,_0x564546){if(!_0x5b567b[_0x76aa('0x37')]){return _0x564546[_0x76aa('0x4b')](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x68')});}var _0x18c679={'payload':{'id':_0x5b567b[_0x76aa('0x37')]['id'],'role':_0x5b567b['user'][_0x76aa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18c679)[_0x76aa('0x3d')](function(_0x26db69){_0x564546['cookie'](_0x76aa('0x69'),_0x26db69);_0x564546['redirect'](_0x76aa('0x6a'));})['catch'](function(_0x339b0d){return _0x564546[_0x76aa('0x4b')](0x1f4)[_0x76aa('0x6b')](_0x339b0d);});};exports[_0x76aa('0x6c')]=function(_0x37a4d9){if(_[_0x76aa('0x6d')](_0x37a4d9[_0x76aa('0x57')])||_['isNil'](_0x37a4d9[_0x76aa('0x6e')])){return null;}else{return createJwt(_0x37a4d9);}};exports['generateApiKey']=function(_0x3ee32){_0x3ee32[_0x76aa('0x57')]=generateNonce();_0x3ee32[_0x76aa('0x6e')]=generateIssuedAt();return createJwt(_0x3ee32);};exports[_0x76aa('0x6f')]=function(_0x3fa7ec,_0x28f8aa){var _0x336024=_0x3fa7ec['query'][_0x76aa('0x50')];if(_0x336024){var _0x281f73={'nonce':_0x28f8aa[_0x76aa('0x57')],'iat':_0x28f8aa[_0x76aa('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x76aa('0x70')]()};return verifyJwt(_0x336024,_0x281f73)[_0x76aa('0x3d')](function(){return generateApiKey(_0x28f8aa);});}else{throw{'message':_0x76aa('0x71')};}};exports[_0x76aa('0x72')]=function(_0x2027f8){var _0xf7732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf7732['test'](_0x2027f8))throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x76aa('0x75'));return;};exports[_0x76aa('0x76')]=function(_0x3967f3,_0x2fdc4f,_0x37babe){var _0x51893b=encryptor['decryptString'](_0x2fdc4f)[_0x76aa('0x77')](',');for(var _0x3b0d8a=0x0;_0x3b0d8a<_0x37babe;_0x3b0d8a++){if(!_0x51893b[_0x3b0d8a])break;if(_0x3967f3['toLowerCase']()===_0x51893b[_0x3b0d8a][_0x76aa('0x78')]()){var _0x1e6f3c=util['format'](_0x76aa('0x79'),_0x37babe);if(_0x37babe===0x1){_0x1e6f3c=_0x76aa('0x7a');}throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x1e6f3c);}}return;};exports[_0x76aa('0x7b')]=function(_0x1f5010,_0x3376ec){var _0x30573a=_0x3376ec?encryptor[_0x76aa('0x7c')](_0x3376ec)['split'](','):[];if(_0x30573a[_0x76aa('0x7d')]===0x5){_0x30573a['splice'](-0x1,0x1);}_0x30573a[_0x76aa('0x7e')](_0x1f5010);return encryptor[_0x76aa('0x7f')](_0x30573a[_0x76aa('0x80')](','));};function signJwt(_0x16cc85){var _0x343cf1=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x82')],{'context':jwt});var _0x431d1c=_0x16cc85[_0x76aa('0x83')]||config['secrets'][_0x76aa('0xa')];return new BPromise(function(_0x3d4025,_0x5c542b){_0x343cf1(_0x16cc85[_0x76aa('0x84')],_0x431d1c,_0x16cc85[_0x76aa('0x85')])[_0x76aa('0x3d')](function(_0x3d6d10){_0x3d4025(_0x3d6d10);})[_0x76aa('0x42')](function(_0x5546b6){_0x5c542b(_0x5546b6);});});}function verifyJwt(_0x364d05,_0x4d3ad0,_0x35bd2b){var _0x35881c=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x86')],{'context':jwt});var _0x3a82fe=_0x35bd2b||config[_0x76aa('0x9')][_0x76aa('0xa')];return new BPromise(function(_0x4a37f1,_0x9ea0af){_0x35881c(_0x364d05,_0x3a82fe,_0x4d3ad0)[_0x76aa('0x3d')](function(_0x543c1d){_0x4a37f1(_0x543c1d);})['catch'](function(_0x40429c){_0x9ea0af(_0x40429c);});});}function generateNonce(){return crypto[_0x76aa('0x87')](0x10)['toString'](_0x76aa('0x88'));}function generateIssuedAt(){return Math[_0x76aa('0x89')](Date[_0x76aa('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x446073){var _0x47f733={'payload':{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')]},'options':{'algorithm':_0x76aa('0x8b'),'subject':_0x446073['id'][_0x76aa('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x47f733)[_0x76aa('0x3d')](function(_0x4dfeb3){return{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')],'token':_0x4dfeb3};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 4861c2e..4137483 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 _0x25d4=['parseQueryParameters','default','where','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','fields','clause','getFilteredContacts','catch','CmContact','keys','startsWith','map','CmCustomField','findOne','slice','all','length','cf_','type','lodash','./sql-utils','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter'];(function(_0x1c6bcd,_0xeb4faa){var _0xd68c32=function(_0x1b9950){while(--_0x1b9950){_0x1c6bcd['push'](_0x1c6bcd['shift']());}};_0xd68c32(++_0xeb4faa);}(_0x25d4,0x81));var _0x425d=function(_0x417ce2,_0x5d27ae){_0x417ce2=_0x417ce2-0x0;var _0x4677b8=_0x25d4[_0x417ce2];return _0x4677b8;};'use strict';var _=require(_0x425d('0x0'));var sqlUtils=require(_0x425d('0x1'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x9597ea,_0x3daa95,_0x10d533,_0x3a0e09){var _0x4c1900={'count':0x0,'rows':[]};var _0x7f117c=sqlUtils['skipContactsQuery'](_0x3daa95,_0x9597ea);if(_0x7f117c){return Promise['resolve'](_0x4c1900);}var _0x394775=sqlUtils[_0x425d('0x2')]();var _0x3be8f1={};var _0x4c9dde=![];var _0x55b707=![];return Promise[_0x425d('0x3')]()[_0x425d('0x4')](function(){if(_0x9597ea[_0x425d('0x5')]){return sqlUtils[_0x425d('0x6')](_0x9597ea[_0x425d('0x5')],_0x3a0e09);}else{return sqlUtils[_0x425d('0x7')](_0x9597ea,_0x3a0e09);}})[_0x425d('0x4')](function(_0x3963a4){_0x394775['where'](_0x3963a4[_0x425d('0x8')]);_0x394775[_0x425d('0x9')](_0x3963a4['fields']);_0x394775[_0x425d('0x9')](_0x3963a4['filter']);_0x394775[_0x425d('0x9')](_0x3963a4[_0x425d('0xa')]['clause']);_0x3be8f1=_0x3963a4['tags'];_0x55b707=_0x3963a4[_0x425d('0xa')][_0x425d('0xb')];return sqlUtils[_0x425d('0xc')](_0x3daa95,_0x9597ea,_0x55b707);})['then'](function(_0x1392a3){_0x394775[_0x425d('0x9')](_0x1392a3);var _0x4d82f1=_0x9597ea[_0x425d('0x5')]?_0x3be8f1[_0x425d('0xd')]:_0x9597ea[_0x425d('0xe')];_0x4c9dde=_0x4d82f1?!![]:![];return sqlUtils[_0x425d('0xf')](_0x394775,_0x4d82f1);})[_0x425d('0x4')](function(_0x3e8b0f){_0x4c1900[_0x425d('0x10')]=_0x3e8b0f;if(_0x4c1900[_0x425d('0x10')]===0x0){return;}if(_0x9597ea[_0x425d('0x11')]){_0x55b707=!![];}return sqlUtils[_0x425d('0x12')](_0x394775,_0x9597ea[_0x425d('0x13')],_0x10d533,_0x4c9dde,_0x3be8f1[_0x425d('0x14')],_0x55b707);})[_0x425d('0x4')](function(_0x4488c1){if(!_0x4488c1){return[];}return sqlUtils[_0x425d('0x15')](_0x4488c1,_0x9597ea,_0x10d533);})[_0x425d('0x4')](function(_0x520a45){_0x4c1900['rows']=_0x520a45;return _0x4c1900;})[_0x425d('0x16')](function(_0x2da8aa){throw _0x2da8aa;});};exports['describe']=function(){var _0x43d056={};var _0xfc1a26=[];return db[_0x425d('0x17')]['describe']()['then'](function(_0x49459f){_0x43d056=_0x49459f;var _0x181233=Object[_0x425d('0x18')](_0x43d056)['filter'](function(_0x23317b){return _[_0x425d('0x19')](_0x23317b,'cf_')?_0x23317b:undefined;});var _0x8a4fc=_0x181233[_0x425d('0x1a')](function(_0x56a97c){return db[_0x425d('0x1b')][_0x425d('0x1c')]({'where':{'id':_0x56a97c[_0x425d('0x1d')](0x3)},'raw':!![]});});return Promise[_0x425d('0x1e')](_0x8a4fc);})['then'](function(_0x3be65e){for(var _0x176d16=0x0;_0x176d16<_0x3be65e[_0x425d('0x1f')];_0x176d16++){if(_0x3be65e[_0x176d16]){var _0x209574=_0x425d('0x20')+_0x3be65e[_0x176d16]['id'];_0x43d056[_0x209574]['fieldType']=_0x3be65e[_0x176d16][_0x425d('0x21')];}}_0xfc1a26=_[_0x425d('0x1a')](Object[_0x425d('0x18')](_0x43d056),function(_0x25e94a){return{'name':_0x25e94a,'type':_0x43d056[_0x25e94a]['type']};});return _0xfc1a26;})['catch'](function(_0x4dae43){throw _0x4dae43;});}; \ No newline at end of file +var _0xdcc3=['search','parseAdvancedSearchFilter','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','getFilteredContacts','rows','catch','describe','keys','startsWith','CmCustomField','findOne','slice','length','cf_','fieldType','type','lodash','./sql-utils','findAll','resolve','getContactsSubquery','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcc3,0x12c));var _0x3dcc=function(_0x2735c0,_0xbd73ab){_0x2735c0=_0x2735c0-0x0;var _0x5562df=_0xdcc3[_0x2735c0];return _0x5562df;};'use strict';var _=require(_0x3dcc('0x0'));var sqlUtils=require(_0x3dcc('0x1'));var db=require('../../mysqldb')['db'];exports[_0x3dcc('0x2')]=function(_0x3d3dbb,_0x2274eb,_0x2ce63d,_0x29cde5){var _0x456054={'count':0x0,'rows':[]};var _0x25890f=sqlUtils['skipContactsQuery'](_0x2274eb,_0x3d3dbb);if(_0x25890f){return Promise[_0x3dcc('0x3')](_0x456054);}var _0x4bf253=sqlUtils[_0x3dcc('0x4')]();var _0x4e768e={};var _0xe78b2c=![];var _0xeec0ce=![];return Promise[_0x3dcc('0x3')]()[_0x3dcc('0x5')](function(){if(_0x3d3dbb[_0x3dcc('0x6')]){return sqlUtils[_0x3dcc('0x7')](_0x3d3dbb[_0x3dcc('0x6')],_0x29cde5);}else{return sqlUtils['parseQueryParameters'](_0x3d3dbb,_0x29cde5);}})[_0x3dcc('0x5')](function(_0x4b0fd3){_0x4bf253[_0x3dcc('0x8')](_0x4b0fd3[_0x3dcc('0x9')]);_0x4bf253[_0x3dcc('0x8')](_0x4b0fd3[_0x3dcc('0xa')]);_0x4bf253['where'](_0x4b0fd3[_0x3dcc('0xb')]);_0x4bf253[_0x3dcc('0x8')](_0x4b0fd3[_0x3dcc('0xc')][_0x3dcc('0xd')]);_0x4e768e=_0x4b0fd3[_0x3dcc('0xe')];_0xeec0ce=_0x4b0fd3[_0x3dcc('0xc')][_0x3dcc('0xf')];return sqlUtils[_0x3dcc('0x10')](_0x2274eb,_0x3d3dbb,_0xeec0ce);})['then'](function(_0x3e8b96){_0x4bf253[_0x3dcc('0x8')](_0x3e8b96);var _0x3cc072=_0x3d3dbb[_0x3dcc('0x6')]?_0x4e768e[_0x3dcc('0x11')]:_0x3d3dbb['tag'];_0xe78b2c=_0x3cc072?!![]:![];return sqlUtils[_0x3dcc('0x12')](_0x4bf253,_0x3cc072);})[_0x3dcc('0x5')](function(_0x237d62){_0x456054[_0x3dcc('0x13')]=_0x237d62;if(_0x456054[_0x3dcc('0x13')]===0x0){return;}if(_0x3d3dbb[_0x3dcc('0x14')]){_0xeec0ce=!![];}return sqlUtils['buildContactsQuery'](_0x4bf253,_0x3d3dbb[_0x3dcc('0xa')],_0x2ce63d,_0xe78b2c,_0x4e768e['clause'],_0xeec0ce);})[_0x3dcc('0x5')](function(_0x10a5ee){if(!_0x10a5ee){return[];}return sqlUtils[_0x3dcc('0x15')](_0x10a5ee,_0x3d3dbb,_0x2ce63d);})['then'](function(_0x40d2f6){_0x456054[_0x3dcc('0x16')]=_0x40d2f6;return _0x456054;})[_0x3dcc('0x17')](function(_0x4cbca7){throw _0x4cbca7;});};exports[_0x3dcc('0x18')]=function(){var _0x91c57b={};var _0x51b458=[];return db['CmContact'][_0x3dcc('0x18')]()['then'](function(_0x22be0a){_0x91c57b=_0x22be0a;var _0xc22ccf=Object[_0x3dcc('0x19')](_0x91c57b)[_0x3dcc('0xb')](function(_0x18624f){return _[_0x3dcc('0x1a')](_0x18624f,'cf_')?_0x18624f:undefined;});var _0xd9804c=_0xc22ccf['map'](function(_0x237ba8){return db[_0x3dcc('0x1b')][_0x3dcc('0x1c')]({'where':{'id':_0x237ba8[_0x3dcc('0x1d')](0x3)},'raw':!![]});});return Promise['all'](_0xd9804c);})['then'](function(_0x2f4492){for(var _0x136926=0x0;_0x136926<_0x2f4492[_0x3dcc('0x1e')];_0x136926++){if(_0x2f4492[_0x136926]){var _0x53c616=_0x3dcc('0x1f')+_0x2f4492[_0x136926]['id'];_0x91c57b[_0x53c616][_0x3dcc('0x20')]=_0x2f4492[_0x136926]['type'];}}_0x51b458=_['map'](Object['keys'](_0x91c57b),function(_0x55e1d1){return{'name':_0x55e1d1,'type':_0x91c57b[_0x55e1d1][_0x3dcc('0x21')]};});return _0x51b458;})['catch'](function(_0x3c661d){throw _0x3c661d;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 3788937..8faa018 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 _0x5775=['resolve','then','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','subqry','findAll','color','Sequelize','QueryTypes','SELECT','query','split','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','toString','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','search','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','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','mobile','email','ListId','CompanyId','createdAt','updatedAt','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','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?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','text','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?'];(function(_0x327e57,_0x3342a1){var _0x3279f6=function(_0x70ed4d){while(--_0x70ed4d){_0x327e57['push'](_0x327e57['shift']());}};_0x3279f6(++_0x3342a1);}(_0x5775,0x1d2));var _0x5577=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x5775[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0x5577('0x0'));var squel=require(_0x5577('0x1'));var as=require(_0x5577('0x2'));var qs=require(_0x5577('0x3'));var utils=require('../interaction/utils');var db=require(_0x5577('0x4'))['db'];function skipContactsQuery(_0x2fc7b2,_0x1522c4){var _0xedc404=![];if(_0x2fc7b2[_0x5577('0x5')]===_0x5577('0x6')&&!_0x1522c4[_0x5577('0x7')]&&!_0x1522c4['ListId']&&_0x1522c4['autocomplete']!==_0x5577('0x8')){_0xedc404=!![];}return _0xedc404;}function getContactsSubquery(){return squel[_0x5577('0x9')]()[_0x5577('0xa')](_0x5577('0xb'),'c')[_0x5577('0xc')](_0x5577('0xd'));}function applyJoinClauses(_0x5a419a,_0x3af54a){var _0x109946=_0x3af54a?'c':'subqry';_0x5a419a['left_join'](_0x5577('0xe'),'uc',_0x5577('0xf')+_0x109946+_0x5577('0x10'))[_0x5577('0x11')]('cm_contact_has_tags','ct',_0x5577('0x12')+_0x109946+_0x5577('0x10'))[_0x5577('0x11')](_0x5577('0x13'),'t',_0x5577('0x14'));return _0x5a419a;}function addFieldsToQuery(_0x13d9af,_0x2ea210,_0x2de042,_0x59a887,_0x2373ce){var _0x3db006=_0x2373ce?'c':'subqry';if(!_0x2ea210){_0x2ea210=['id',_0x5577('0x15'),_0x5577('0x16'),_0x5577('0x17'),_0x5577('0x18'),'fax',_0x5577('0x19'),_0x5577('0x1a'),_0x5577('0x1b'),_0x5577('0x1c'),_0x5577('0x1d'),_0x5577('0x1e'),'TagIds'];}else if(!_0x2ea210[_0x5577('0x1f')]('id')){_0x2ea210[_0x5577('0x20')]('id');}var _0x30fd79=_0x2de042&&_0x2373ce||!_0x2de042&&!_0x2373ce;if(_0x59a887){_0x30fd79=_0x59a887&&_0x2373ce||!_0x59a887&&!_0x2373ce;}_0x2ea210[_0x5577('0x21')](function(_0x175995){if(_0x175995===_0x5577('0x22')){if(_0x30fd79){_0x13d9af[_0x5577('0x23')](_0x5577('0x24'),_0x175995);}else if(_0x2de042||_0x59a887){_0x13d9af['field'](_0x3db006+'.'+_0x175995);}}else{_0x13d9af[_0x5577('0x23')](_0x3db006+'.'+_0x175995);}});return _0x13d9af;}function getSqlClauses(){var _0x177d13={'default':squel[_0x5577('0x25')](),'fields':squel[_0x5577('0x25')](),'filter':squel[_0x5577('0x25')](),'tags':{'clause':squel[_0x5577('0x25')](),'ids':null},'user':{'clause':squel[_0x5577('0x25')](),'skip':![]}};return _0x177d13;}function parseTagParameter(_0x421ca6){var _0x33a8cb=squel[_0x5577('0x25')]();if(_0x421ca6){var _0x3503ea=utils[_0x5577('0x26')](_0x421ca6);_0x3503ea['forEach'](function(_0x24d211){_0x33a8cb['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x24d211+',%');});}return _0x33a8cb;}function parseSearchFilter(_0x4e16ff){var _0x5725f8=squel[_0x5577('0x25')]();if(_0x4e16ff){var _0x544b21=_0x4e16ff[_0x5577('0x27')]('\x5c','\x5c\x5c')[_0x5577('0x27')](/'/g,'\x27\x27');if(_0x544b21['split']('\x20')[_0x5577('0x28')]>0x1){_0x5725f8['or'](_0x5577('0x29'),qs[_0x5577('0x2a')](_0x544b21,!![]),null);}else{if(qs[_0x5577('0x2b')](_0x544b21)){_0x5725f8['or'](_0x5577('0x2c'),_0x544b21+'%');_0x5725f8['or'](_0x5577('0x2d'),_0x544b21+'%');_0x5725f8['or'](_0x5577('0x2e'),_0x544b21+'%');_0x5725f8['or'](_0x5577('0x2f'),_0x544b21+'%');}else if(qs['isEmail'](_0x544b21)){_0x5725f8['or'](_0x5577('0x30'),_0x544b21+'%');}else{_0x5725f8['or']('c.firstName\x20LIKE\x20?','%'+_0x544b21+'%');_0x5725f8['or'](_0x5577('0x31'),'%'+_0x544b21+'%');_0x5725f8['or']('c.email\x20LIKE\x20?','%'+_0x544b21+'%');}}}return _0x5725f8;}function parseAdvancedSearchFilter(_0x5bec8f,_0xda96d4){var _0x523591=getSqlClauses();var _0x4818c4=as[_0x5577('0x32')](_0x5bec8f);var _0x127ca7=_0x4818c4['sqlOperator'];for(var _0xd3aabd=0x0;_0xd3aabd<_0x4818c4[_0x5577('0x33')][_0x5577('0x28')];_0xd3aabd++){var _0x5dce53=_0x4818c4[_0x5577('0x33')][_0xd3aabd];var _0x119079='c';var _0x4e9bea=_['find'](_0xda96d4,['name',_0x5dce53[_0x5577('0x23')]]);if(_0x4e9bea){if(_0x5dce53['field']===_0x5577('0x34')||_0x4e9bea[_0x5577('0x35')]===_0x5577('0x36')){_0x5dce53[_0x5577('0x37')]=_0x5577('0x38');}var _0x2fca5f=as[_0x5577('0x39')](_0x119079,_0x4e9bea[_0x5577('0x3a')],_0x5dce53);_0x523591['default'][_0x127ca7](_0x2fca5f[_0x5577('0x3b')],_0x2fca5f[_0x5577('0x3c')][_0x5577('0x3d')],_0x2fca5f[_0x5577('0x3c')][_0x5577('0x3e')]);}else{if(_0x5dce53['field']===_0x5577('0x3f')){var _0x4834b6=_0x5dce53['value']['split'](',')[_0x5577('0x40')](function(_0x313e95){return Number(_0x313e95);});var _0x34fa46=parseTagParameter(_0x4834b6);_0x523591[_0x5577('0x41')][_0x5577('0x42')][_0x5577('0x43')](_0x34fa46);_0x523591[_0x5577('0x41')][_0x5577('0x44')]=_0x4834b6;}else if(_0x5dce53[_0x5577('0x23')]===_0x5577('0x45')){_0x523591['user'][_0x5577('0x42')][_0x5577('0x43')](_0x5577('0x46'),_0x5dce53[_0x5577('0x3c')]);_0x523591[_0x5577('0x47')]['skip']=!![];}}}return _0x523591;}function parseModelFields(_0x48e058,_0x2e1fc8){var _0x5d1e89=squel[_0x5577('0x25')]();var _0x4dc419=_(_0x48e058)['keys']()[_0x5577('0x40')](function(_0xce3366){return _['some'](_0x2e1fc8,[_0x5577('0x48'),_0xce3366])?_0xce3366:undefined;})[_0x5577('0x49')]()[_0x5577('0x3c')]();if(_0x48e058[_0x5577('0x4a')]){_0x4dc419[_0x5577('0x20')]('Contact');}if(_0x48e058[_0x5577('0x45')]){_0x4dc419[_0x5577('0x20')]('User');}if(_0x4dc419[_0x5577('0x28')]>0x0){_0x4dc419[_0x5577('0x21')](function(_0x477790){if(_0x477790===_0x5577('0x1a')){_0x5d1e89['and'](_0x5577('0x4b'),[][_0x5577('0x4c')](_0x48e058[_0x477790]));}else if(_0x477790===_0x5577('0x4a')){var _0x3f65ef='%'+_0x48e058[_0x477790]+'%';_0x5d1e89[_0x5577('0x43')](_0x5577('0x4d'),_0x3f65ef);}else if(_0x477790===_0x5577('0x45')){_0x5d1e89[_0x5577('0x43')](_0x5577('0x46'),_0x48e058[_0x477790]);}else{_0x5d1e89[_0x5577('0x43')]('c.'+_0x477790+_0x5577('0x4e'),_0x48e058[_0x477790]);}});}return _0x5d1e89;}function parseQueryParameters(_0x4baca9,_0x145d76){var _0x32722a=getSqlClauses();return Promise[_0x5577('0x4f')]()[_0x5577('0x50')](function(){return parseModelFields(_0x4baca9,_0x145d76);})['then'](function(_0x2cc4f8){_0x32722a['fields']['and'](_0x2cc4f8);return parseTagParameter(_0x4baca9['tag']);})['then'](function(_0x44aa22){_0x32722a[_0x5577('0x41')][_0x5577('0x42')]['and'](_0x44aa22);return parseSearchFilter(_0x4baca9[_0x5577('0x51')]);})['then'](function(_0x31a73a){_0x32722a['filter']=_0x31a73a;return _0x32722a;});}function checkListsRestrictions(_0x5d6017,_0x36d77f,_0x5c2f88){var _0x3e7223=squel[_0x5577('0x25')]();return Promise[_0x5577('0x4f')]()[_0x5577('0x50')](function(){if(_0x36d77f[_0x5577('0x7')]&&_0x5d6017[_0x5577('0x5')]==='agent'&&!_0x5c2f88){return _0x5d6017[_0x5577('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x5577('0x50')](function(_0x554a14){if(_0x554a14){if(_0x554a14[_0x5577('0x28')]===0x0){_0x3e7223[_0x5577('0x43')](_0x5577('0x53'));}else{_0x3e7223['and']('c.ListId\x20IN\x20?',_[_0x5577('0x40')](_0x554a14,'id'));}}})[_0x5577('0x50')](function(){return _0x3e7223;});}function buildContactsQuery(_0x165660,_0x3dd991,_0x45fa2c,_0xfce125,_0x9acae5,_0x4c1877){if(_0x3dd991){_0x3dd991=_0x45fa2c[_0x5577('0x54')];}_0x165660=addFieldsToQuery(_0x165660,_0x3dd991,_0xfce125,_0x4c1877,!![]);var _0x48b5c3=squel[_0x5577('0x9')]();_0x48b5c3=addFieldsToQuery(_0x48b5c3,_0x3dd991,_0xfce125,_0x4c1877,![]);if(_0xfce125||_0x4c1877){_0x165660=applyJoinClauses(_0x165660,!![]);_0x165660[_0x5577('0x55')](_0x5577('0x56'));if(_0x45fa2c[_0x5577('0x57')]){_0x48b5c3['limit'](_0x45fa2c[_0x5577('0x57')]);}if(_0x45fa2c['offset']){_0x48b5c3[_0x5577('0x58')](_0x45fa2c['offset']);}}else{_0x48b5c3=applyJoinClauses(_0x48b5c3,![]);_0x48b5c3[_0x5577('0x55')](_0x5577('0x59'));if(_0x45fa2c[_0x5577('0x57')]){_0x165660[_0x5577('0x57')](_0x45fa2c[_0x5577('0x57')]);}if(_0x45fa2c[_0x5577('0x58')]){_0x165660[_0x5577('0x58')](_0x45fa2c[_0x5577('0x58')]);}}_0x48b5c3[_0x5577('0x5a')](_0x9acae5);if(_0x45fa2c[_0x5577('0x5b')]){_0x45fa2c[_0x5577('0x5b')]['forEach'](function(_0x7d5d75){_0x165660[_0x5577('0x5b')]('c.'+_0x7d5d75[0x0],_0x7d5d75[0x1]===_0x5577('0x5c')?![]:!![]);_0x48b5c3[_0x5577('0x5b')](_0x5577('0x5d')+_0x7d5d75[0x0],_0x7d5d75[0x1]===_0x5577('0x5c')?![]:!![]);});}_0x48b5c3[_0x5577('0xa')](_0x165660,_0x5577('0x5e'));return _0x48b5c3;}function getFilteredContacts(_0x3c8033){var _0x241a7d=[];return db[_0x5577('0x3f')][_0x5577('0x5f')]({'attributes':['id',_0x5577('0x48'),_0x5577('0x60')],'raw':!![]})[_0x5577('0x50')](function(_0x3c1f2d){_0x241a7d=_['keyBy'](_0x3c1f2d,'id');var _0xb6fc45={'type':db[_0x5577('0x61')][_0x5577('0x62')][_0x5577('0x63')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x5577('0x64')](_0x3c8033['toString'](),_0xb6fc45);})[_0x5577('0x50')](function(_0x3e4f52){_0x3e4f52[_0x5577('0x21')](function(_0x249d69){if(_0x249d69[_0x5577('0x22')]){_0x249d69['Tags']=[];_0x249d69['TagIds'][_0x5577('0x65')](',')['forEach'](function(_0x22cdd3){_0x249d69[_0x5577('0x66')][_0x5577('0x20')](_0x241a7d[_0x22cdd3]);});}delete _0x249d69[_0x5577('0x22')];});return _0x3e4f52;});}function countFilteredContacts(_0xb0c08c,_0x4a91cc){var _0x3b6d4e=_0xb0c08c[_0x5577('0x67')]();_0x3b6d4e[_0x5577('0x23')](_0x5577('0x68'));_0x3b6d4e=applyJoinClauses(_0x3b6d4e,!![]);_0xb0c08c[_0x5577('0x55')](_0x5577('0x56'));var _0xc3db4f=utils[_0x5577('0x26')](_0x4a91cc);if(!_[_0x5577('0x69')](_0xc3db4f)){_0x3b6d4e[_0x5577('0xc')](_0x5577('0x6a'),_0xc3db4f);}var _0x24677a={'type':db[_0x5577('0x61')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x5577('0x6b')]['query'](_0x3b6d4e[_0x5577('0x6c')](),_0x24677a)[_0x5577('0x50')](function(_0x31470a){return _0x31470a[0x0][_0x5577('0x68')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x665f=['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)','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','name','datetime','castTo','DATE','buildExpression','default','text','value','start','end','Tag','map','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','fields','tag','then','filter','getLists','c.ListId\x20IS\x20NULL','group','limit','offset','subqry.id','having','order','DESC','subqry.','from','subqry','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','true','select','where','c.deletedAt\x20IS\x20NULL','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','left_join','phone','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','expr','getSelectedTags'];(function(_0x23be7c,_0x509585){var _0x3d50e7=function(_0x1dca58){while(--_0x1dca58){_0x23be7c['push'](_0x23be7c['shift']());}};_0x3d50e7(++_0x509585);}(_0x665f,0xab));var _0xf665=function(_0x558e3d,_0x48bf76){_0x558e3d=_0x558e3d-0x0;var _0x3004de=_0x665f[_0x558e3d];return _0x3004de;};'use strict';var _=require(_0xf665('0x0'));var squel=require('squel');var as=require(_0xf665('0x1'));var qs=require(_0xf665('0x2'));var utils=require(_0xf665('0x3'));var db=require(_0xf665('0x4'))['db'];function skipContactsQuery(_0x507a31,_0x1a4fa6){var _0x3233fc=![];if(_0x507a31[_0xf665('0x5')]===_0xf665('0x6')&&!_0x1a4fa6[_0xf665('0x7')]&&!_0x1a4fa6[_0xf665('0x8')]&&_0x1a4fa6['autocomplete']!==_0xf665('0x9')){_0x3233fc=!![];}return _0x3233fc;}function getContactsSubquery(){return squel[_0xf665('0xa')]()['from']('cm_contacts','c')[_0xf665('0xb')](_0xf665('0xc'));}function applyJoinClauses(_0xe9c6de,_0xa37460){var _0xa54f1d=_0xa37460?'c':'subqry';_0xe9c6de['left_join']('cm_user_has_contacts','uc',_0xf665('0xd')+_0xa54f1d+_0xf665('0xe'))['left_join'](_0xf665('0xf'),'ct','ct.CmContactId\x20=\x20'+_0xa54f1d+_0xf665('0xe'))[_0xf665('0x10')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0xe9c6de;}function addFieldsToQuery(_0x2ca79a,_0x2a7584,_0x344950,_0x216bc7,_0x57c567){var _0x219eac=_0x57c567?'c':'subqry';if(!_0x2a7584){_0x2a7584=['id','firstName','lastName',_0xf665('0x11'),'mobile',_0xf665('0x12'),'email','ListId',_0xf665('0x13'),_0xf665('0x14'),_0xf665('0x15'),_0xf665('0x16'),_0xf665('0x17')];}else if(!_0x2a7584[_0xf665('0x18')]('id')){_0x2a7584['push']('id');}var _0x264b00=_0x344950&&_0x57c567||!_0x344950&&!_0x57c567;if(_0x216bc7){_0x264b00=_0x216bc7&&_0x57c567||!_0x216bc7&&!_0x57c567;}_0x2a7584[_0xf665('0x19')](function(_0x33d760){if(_0x33d760===_0xf665('0x17')){if(_0x264b00){_0x2ca79a[_0xf665('0x1a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x33d760);}else if(_0x344950||_0x216bc7){_0x2ca79a['field'](_0x219eac+'.'+_0x33d760);}}else{_0x2ca79a[_0xf665('0x1a')](_0x219eac+'.'+_0x33d760);}});return _0x2ca79a;}function getSqlClauses(){var _0x19b8ef={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xf665('0x1b')](),'tags':{'clause':squel[_0xf665('0x1b')](),'ids':null},'user':{'clause':squel[_0xf665('0x1b')](),'skip':![]}};return _0x19b8ef;}function parseTagParameter(_0x4bb542){var _0x171e17=squel[_0xf665('0x1b')]();if(_0x4bb542){var _0x3e8200=utils[_0xf665('0x1c')](_0x4bb542);_0x3e8200[_0xf665('0x19')](function(_0x25ff45){_0x171e17['or'](_0xf665('0x1d'),'%,'+_0x25ff45+',%');});}return _0x171e17;}function parseSearchFilter(_0xc226c9){var _0x3662e0=squel[_0xf665('0x1b')]();if(_0xc226c9){var _0x5dc0ff=_0xc226c9[_0xf665('0x1e')]('\x5c','\x5c\x5c')[_0xf665('0x1e')](/'/g,'\x27\x27');if(_0x5dc0ff[_0xf665('0x1f')]('\x20')[_0xf665('0x20')]>0x1){_0x3662e0['or'](_0xf665('0x21'),qs['getFullTextValue'](_0x5dc0ff,!![]),null);}else{if(qs['isNumeric'](_0x5dc0ff)){_0x3662e0['or']('c.id\x20LIKE\x20?',_0x5dc0ff+'%');_0x3662e0['or']('c.phone\x20LIKE\x20?',_0x5dc0ff+'%');_0x3662e0['or'](_0xf665('0x22'),_0x5dc0ff+'%');_0x3662e0['or']('c.fax\x20LIKE\x20?',_0x5dc0ff+'%');}else if(qs[_0xf665('0x23')](_0x5dc0ff)){_0x3662e0['or']('c.email\x20LIKE\x20?',_0x5dc0ff+'%');}else{_0x3662e0['or'](_0xf665('0x24'),'%'+_0x5dc0ff+'%');_0x3662e0['or'](_0xf665('0x25'),'%'+_0x5dc0ff+'%');_0x3662e0['or'](_0xf665('0x26'),'%'+_0x5dc0ff+'%');}}}return _0x3662e0;}function parseAdvancedSearchFilter(_0x4c5ca3,_0x25db4a){var _0x46ca20=getSqlClauses();var _0xe6c330=as[_0xf665('0x27')](_0x4c5ca3);var _0x45db6f=_0xe6c330['sqlOperator'];for(var _0x37c1e3=0x0;_0x37c1e3<_0xe6c330[_0xf665('0x28')][_0xf665('0x20')];_0x37c1e3++){var _0x229630=_0xe6c330[_0xf665('0x28')][_0x37c1e3];var _0x41d572='c';var _0xd59792=_['find'](_0x25db4a,[_0xf665('0x29'),_0x229630['field']]);if(_0xd59792){if(_0x229630['field']==='dateOfBirth'||_0xd59792['fieldType']===_0xf665('0x2a')){_0x229630[_0xf665('0x2b')]=_0xf665('0x2c');}var _0x382490=as[_0xf665('0x2d')](_0x41d572,_0xd59792['type'],_0x229630);_0x46ca20[_0xf665('0x2e')][_0x45db6f](_0x382490[_0xf665('0x2f')],_0x382490[_0xf665('0x30')][_0xf665('0x31')],_0x382490[_0xf665('0x30')][_0xf665('0x32')]);}else{if(_0x229630[_0xf665('0x1a')]===_0xf665('0x33')){var _0x3a0f32=_0x229630[_0xf665('0x30')][_0xf665('0x1f')](',')[_0xf665('0x34')](function(_0x49ec14){return Number(_0x49ec14);});var _0x432887=parseTagParameter(_0x3a0f32);_0x46ca20['tags'][_0xf665('0x35')][_0xf665('0x36')](_0x432887);_0x46ca20[_0xf665('0x37')][_0xf665('0x38')]=_0x3a0f32;}else if(_0x229630[_0xf665('0x1a')]===_0xf665('0x39')){_0x46ca20[_0xf665('0x3a')][_0xf665('0x35')][_0xf665('0x36')](_0xf665('0x3b'),_0x229630['value']);_0x46ca20[_0xf665('0x3a')][_0xf665('0x3c')]=!![];}}}return _0x46ca20;}function parseModelFields(_0x5cd689,_0x44a79e){var _0x5f5b62=squel[_0xf665('0x1b')]();var _0x5af66c=_(_0x5cd689)[_0xf665('0x3d')]()[_0xf665('0x34')](function(_0x498a08){return _[_0xf665('0x3e')](_0x44a79e,[_0xf665('0x29'),_0x498a08])?_0x498a08:undefined;})[_0xf665('0x3f')]()['value']();if(_0x5cd689[_0xf665('0x40')]){_0x5af66c[_0xf665('0x41')](_0xf665('0x40'));}if(_0x5cd689['User']){_0x5af66c[_0xf665('0x41')](_0xf665('0x39'));}if(_0x5af66c[_0xf665('0x20')]>0x0){_0x5af66c['forEach'](function(_0x4a792b){if(_0x4a792b==='ListId'){_0x5f5b62[_0xf665('0x36')](_0xf665('0x42'),[][_0xf665('0x43')](_0x5cd689[_0x4a792b]));}else if(_0x4a792b===_0xf665('0x40')){var _0x1ebf3f='%'+_0x5cd689[_0x4a792b]+'%';_0x5f5b62[_0xf665('0x36')](_0xf665('0x44'),_0x1ebf3f);}else if(_0x4a792b===_0xf665('0x39')){_0x5f5b62[_0xf665('0x36')](_0xf665('0x3b'),_0x5cd689[_0x4a792b]);}else{_0x5f5b62[_0xf665('0x36')]('c.'+_0x4a792b+_0xf665('0x45'),_0x5cd689[_0x4a792b]);}});}return _0x5f5b62;}function parseQueryParameters(_0x49127f,_0x37d2bd){var _0x5b9ece=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x49127f,_0x37d2bd);})['then'](function(_0x1291d8){_0x5b9ece[_0xf665('0x46')][_0xf665('0x36')](_0x1291d8);return parseTagParameter(_0x49127f[_0xf665('0x47')]);})[_0xf665('0x48')](function(_0x5be7e1){_0x5b9ece[_0xf665('0x37')][_0xf665('0x35')][_0xf665('0x36')](_0x5be7e1);return parseSearchFilter(_0x49127f['filter']);})[_0xf665('0x48')](function(_0x25798c){_0x5b9ece[_0xf665('0x49')]=_0x25798c;return _0x5b9ece;});}function checkListsRestrictions(_0x22be45,_0x4ba291,_0x4db899){var _0x3eacce=squel[_0xf665('0x1b')]();return Promise['resolve']()[_0xf665('0x48')](function(){if(_0x4ba291[_0xf665('0x7')]&&_0x22be45[_0xf665('0x5')]===_0xf665('0x6')&&!_0x4db899){return _0x22be45[_0xf665('0x4a')]({'attributes':['id'],'raw':!![]});}})[_0xf665('0x48')](function(_0x47fc7a){if(_0x47fc7a){if(_0x47fc7a['length']===0x0){_0x3eacce[_0xf665('0x36')](_0xf665('0x4b'));}else{_0x3eacce[_0xf665('0x36')]('c.ListId\x20IN\x20?',_[_0xf665('0x34')](_0x47fc7a,'id'));}}})[_0xf665('0x48')](function(){return _0x3eacce;});}function buildContactsQuery(_0x5d80d9,_0x32ead5,_0x2ebbd8,_0x2d9afb,_0x5bae0c,_0x51c62f){if(_0x32ead5){_0x32ead5=_0x2ebbd8['attributes'];}_0x5d80d9=addFieldsToQuery(_0x5d80d9,_0x32ead5,_0x2d9afb,_0x51c62f,!![]);var _0x2c75f3=squel[_0xf665('0xa')]();_0x2c75f3=addFieldsToQuery(_0x2c75f3,_0x32ead5,_0x2d9afb,_0x51c62f,![]);if(_0x2d9afb||_0x51c62f){_0x5d80d9=applyJoinClauses(_0x5d80d9,!![]);_0x5d80d9[_0xf665('0x4c')]('c.id');if(_0x2ebbd8[_0xf665('0x4d')]){_0x2c75f3['limit'](_0x2ebbd8[_0xf665('0x4d')]);}if(_0x2ebbd8[_0xf665('0x4e')]){_0x2c75f3[_0xf665('0x4e')](_0x2ebbd8[_0xf665('0x4e')]);}}else{_0x2c75f3=applyJoinClauses(_0x2c75f3,![]);_0x2c75f3[_0xf665('0x4c')](_0xf665('0x4f'));if(_0x2ebbd8[_0xf665('0x4d')]){_0x5d80d9[_0xf665('0x4d')](_0x2ebbd8[_0xf665('0x4d')]);}if(_0x2ebbd8[_0xf665('0x4e')]){_0x5d80d9[_0xf665('0x4e')](_0x2ebbd8[_0xf665('0x4e')]);}}_0x2c75f3[_0xf665('0x50')](_0x5bae0c);if(_0x2ebbd8[_0xf665('0x51')]){_0x2ebbd8[_0xf665('0x51')][_0xf665('0x19')](function(_0x19368e){_0x5d80d9['order']('c.'+_0x19368e[0x0],_0x19368e[0x1]===_0xf665('0x52')?![]:!![]);_0x2c75f3[_0xf665('0x51')](_0xf665('0x53')+_0x19368e[0x0],_0x19368e[0x1]===_0xf665('0x52')?![]:!![]);});}_0x2c75f3[_0xf665('0x54')](_0x5d80d9,_0xf665('0x55'));return _0x2c75f3;}function getFilteredContacts(_0x5d0c4e){var _0x2705ae=[];return db['Tag']['findAll']({'attributes':['id',_0xf665('0x29'),_0xf665('0x56')],'raw':!![]})[_0xf665('0x48')](function(_0x45f2bf){_0x2705ae=_[_0xf665('0x57')](_0x45f2bf,'id');var _0x54e88c={'type':db[_0xf665('0x58')][_0xf665('0x59')]['SELECT'],'model':db[_0xf665('0x5a')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xf665('0x5b')][_0xf665('0x5c')](_0x5d0c4e[_0xf665('0x5d')](),_0x54e88c);})['then'](function(_0x5bd44d){_0x5bd44d[_0xf665('0x19')](function(_0xd6604f){if(_0xd6604f[_0xf665('0x17')]){_0xd6604f[_0xf665('0x5e')]=[];_0xd6604f['TagIds']['split'](',')[_0xf665('0x19')](function(_0x15056e){_0xd6604f[_0xf665('0x5e')][_0xf665('0x41')](_0x2705ae[_0x15056e]);});}delete _0xd6604f['TagIds'];});return _0x5bd44d;});}function countFilteredContacts(_0x13922e,_0x5ab22f){var _0x13f194=_0x13922e['clone']();_0x13f194[_0xf665('0x1a')](_0xf665('0x5f'));_0x13f194=applyJoinClauses(_0x13f194,!![]);_0x13922e[_0xf665('0x4c')](_0xf665('0x60'));var _0x4ac7cf=utils['getSelectedTags'](_0x5ab22f);if(!_[_0xf665('0x61')](_0x4ac7cf)){_0x13f194[_0xf665('0xb')](_0xf665('0x62'),_0x4ac7cf);}var _0x1691de={'type':db[_0xf665('0x58')][_0xf665('0x59')]['SELECT'],'raw':!![]};return db[_0xf665('0x5b')][_0xf665('0x5c')](_0x13f194[_0xf665('0x5d')](),_0x1691de)['then'](function(_0xd2334){return _0xd2334[0x0][_0xf665('0x5f')];});}module[_0xf665('0x63')]={'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 6ebe1b0..04c1388 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 _0xffb3=['write','end','encryptString','secret','utf8','base64','decryptString','createDecipher','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','binary','final','close','unlink','decryptFile','update'];(function(_0x58d002,_0x3abdf6){var _0x4ee940=function(_0x3c2070){while(--_0x3c2070){_0x58d002['push'](_0x58d002['shift']());}};_0x4ee940(++_0x3abdf6);}(_0xffb3,0x6b));var _0x3ffb=function(_0x334155,_0x518572){_0x334155=_0x334155-0x0;var _0x393928=_0xffb3[_0x334155];return _0x393928;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x3ffb('0x0'));var config=require(_0x3ffb('0x1'));var logger=require(_0x3ffb('0x2'))(_0x3ffb('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3ffb('0x4')][_0x3ffb('0x5')],'algorithm':_0x3ffb('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x3ffb('0x7')]&&config['encrypt'][_0x3ffb('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x3ffb('0x8')]=config[_0x3ffb('0x7')][_0x3ffb('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x3ffb('0x9')](config[_0x3ffb('0x7')][_0x3ffb('0x8')],_0x3ffb('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x24749c){return AES_SUPPORTED_RX['test'](_0x24749c);}function getSupportedCiphers(){return crypto[_0x3ffb('0xb')]()[_0x3ffb('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x4572e0){return getSupportedCiphers()[_0x3ffb('0xd')](_0x4572e0)>-0x1;}function combineOptions(_0x1784ff){var _0x4ff240={};for(var _0x24331c in fileOptions){if(fileOptions[_0x3ffb('0xe')](_0x24331c)){_0x4ff240[_0x24331c]=fileOptions[_0x24331c];}}if(_0x1784ff){for(var _0x3b0875 in _0x1784ff){if(_0x1784ff['hasOwnProperty'](_0x3b0875)){_0x4ff240[_0x3b0875]=_0x1784ff[_0x3b0875];}}}return _0x4ff240;}exports['encryptFile']=function(_0x69dc37,_0x569b51,_0x54ec2c,_0x3c3396){return new BPromise(function(_0x3405d1,_0x3b30c1){_0x3c3396=combineOptions(_0x3c3396);var _0x155f72=new Buffer(_0x54ec2c);var _0x53b76b=fs[_0x3ffb('0xf')](_0x69dc37);var _0x11f18c=fs[_0x3ffb('0x10')](_0x569b51);var _0x4136f3=crypto[_0x3ffb('0x11')](_0x3c3396[_0x3ffb('0x8')],_0x155f72);_0x53b76b['on'](_0x3ffb('0x12'),function(_0x7adff){var _0x152f48=new Buffer(_0x4136f3['update'](_0x7adff),_0x3ffb('0x13'));_0x11f18c['write'](_0x152f48);});_0x53b76b['on']('end',function(){try{var _0x11a3f0=new Buffer(_0x4136f3[_0x3ffb('0x14')](_0x3ffb('0x13')),_0x3ffb('0x13'));_0x11f18c['write'](_0x11a3f0);_0x11f18c['end']();_0x11f18c['on'](_0x3ffb('0x15'),function(){return _0x3405d1(_0x569b51);});}catch(_0x4f6ab9){fs[_0x3ffb('0x16')](_0x569b51);return _0x3b30c1(_0x4f6ab9);}});});};exports[_0x3ffb('0x17')]=function(_0x5605d0,_0x4aa538,_0x599b34,_0x1b4922){return new BPromise(function(_0x5c1345,_0x2da400){_0x1b4922=combineOptions(_0x1b4922);var _0x257628=new Buffer(_0x599b34);var _0x139cc3=fs[_0x3ffb('0xf')](_0x5605d0);var _0x222d38=fs['createWriteStream'](_0x4aa538);var _0x3ea2c8=crypto['createDecipher'](_0x1b4922[_0x3ffb('0x8')],_0x257628);_0x139cc3['on'](_0x3ffb('0x12'),function(_0x4571f4){var _0x1f8ca3=new Buffer(_0x3ea2c8[_0x3ffb('0x18')](_0x4571f4),_0x3ffb('0x13'));_0x222d38[_0x3ffb('0x19')](_0x1f8ca3);});_0x139cc3['on'](_0x3ffb('0x1a'),function(){try{var _0x46f96b=new Buffer(_0x3ea2c8[_0x3ffb('0x14')](_0x3ffb('0x13')),_0x3ffb('0x13'));_0x222d38[_0x3ffb('0x19')](_0x46f96b);_0x222d38[_0x3ffb('0x1a')]();_0x222d38['on'](_0x3ffb('0x15'),function(){return _0x5c1345(_0x4aa538);});}catch(_0x16116c){fs[_0x3ffb('0x16')](_0x4aa538);return _0x2da400(_0x16116c);}});});};exports[_0x3ffb('0x1b')]=function(_0x56d35e,_0x35c831,_0x56edd7){var _0x411c5d=_0x56edd7||stringOptions[_0x3ffb('0x8')];var _0x119c68=_0x35c831||stringOptions[_0x3ffb('0x1c')];var _0x24cd9a=crypto[_0x3ffb('0x11')](_0x411c5d,_0x119c68);var _0x387deb=_0x24cd9a[_0x3ffb('0x18')](_0x56d35e,_0x3ffb('0x1d'),_0x3ffb('0x1e'));_0x387deb+=_0x24cd9a[_0x3ffb('0x14')](_0x3ffb('0x1e'));return _0x387deb;};exports[_0x3ffb('0x1f')]=function(_0x5141ae,_0x465d30,_0x4b2d92){var _0x19d8d2=_0x4b2d92||stringOptions[_0x3ffb('0x8')];var _0x1771f7=_0x465d30||stringOptions[_0x3ffb('0x1c')];var _0x20e0d0=crypto[_0x3ffb('0x20')](_0x19d8d2,_0x1771f7);var _0x7c0fe9=_0x20e0d0[_0x3ffb('0x18')](_0x5141ae,_0x3ffb('0x1e'),'utf8');_0x7c0fe9+=_0x20e0d0[_0x3ffb('0x14')](_0x3ffb('0x1d'));return _0x7c0fe9;}; \ No newline at end of file +var _0x2261=['createWriteStream','createCipher','update','binary','write','end','close','decryptFile','final','unlink','secret','utf8','base64','decryptString','createDecipher','crypto','bluebird','lodash','app','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','indexOf','hasOwnProperty','createReadStream'];(function(_0x4a2689,_0x314a16){var _0x463450=function(_0x5388b8){while(--_0x5388b8){_0x4a2689['push'](_0x4a2689['shift']());}};_0x463450(++_0x314a16);}(_0x2261,0x83));var _0x1226=function(_0x2ab9cd,_0x14e408){_0x2ab9cd=_0x2ab9cd-0x0;var _0x24636e=_0x2261[_0x2ab9cd];return _0x24636e;};'use strict';var crypto=require(_0x1226('0x0'));var fs=require('fs');var BPromise=require(_0x1226('0x1'));var _=require(_0x1226('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1226('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x1226('0x4')],'algorithm':_0x1226('0x5')};const fileOptions={'algorithm':_0x1226('0x6')};if(config['encrypt']&&config[_0x1226('0x7')][_0x1226('0x8')]){var isSupported=isAlgorithmSupported(config[_0x1226('0x7')]['algorithm']);if(isSupported){fileOptions[_0x1226('0x8')]=config[_0x1226('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x1226('0x9')](config[_0x1226('0x7')][_0x1226('0x8')],_0x1226('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x234d76){return AES_SUPPORTED_RX['test'](_0x234d76);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xc8b0f7){return getSupportedCiphers()[_0x1226('0xb')](_0xc8b0f7)>-0x1;}function combineOptions(_0x427d6f){var _0x489eca={};for(var _0xc30fa7 in fileOptions){if(fileOptions['hasOwnProperty'](_0xc30fa7)){_0x489eca[_0xc30fa7]=fileOptions[_0xc30fa7];}}if(_0x427d6f){for(var _0x1e0650 in _0x427d6f){if(_0x427d6f[_0x1226('0xc')](_0x1e0650)){_0x489eca[_0x1e0650]=_0x427d6f[_0x1e0650];}}}return _0x489eca;}exports['encryptFile']=function(_0x5cb4ec,_0x5e00e3,_0x2195df,_0xff9e5c){return new BPromise(function(_0x123a83,_0x39057b){_0xff9e5c=combineOptions(_0xff9e5c);var _0x5abd41=new Buffer(_0x2195df);var _0x2d12e3=fs[_0x1226('0xd')](_0x5cb4ec);var _0x334442=fs[_0x1226('0xe')](_0x5e00e3);var _0x4aba07=crypto[_0x1226('0xf')](_0xff9e5c[_0x1226('0x8')],_0x5abd41);_0x2d12e3['on']('data',function(_0x54426a){var _0x1f5f3f=new Buffer(_0x4aba07[_0x1226('0x10')](_0x54426a),_0x1226('0x11'));_0x334442[_0x1226('0x12')](_0x1f5f3f);});_0x2d12e3['on'](_0x1226('0x13'),function(){try{var _0x42a98d=new Buffer(_0x4aba07['final']('binary'),'binary');_0x334442[_0x1226('0x12')](_0x42a98d);_0x334442['end']();_0x334442['on'](_0x1226('0x14'),function(){return _0x123a83(_0x5e00e3);});}catch(_0x4b7f0f){fs['unlink'](_0x5e00e3);return _0x39057b(_0x4b7f0f);}});});};exports[_0x1226('0x15')]=function(_0x299d34,_0x3b2d83,_0x3b05ba,_0x2b88fa){return new BPromise(function(_0x206877,_0x1c1765){_0x2b88fa=combineOptions(_0x2b88fa);var _0x5059d5=new Buffer(_0x3b05ba);var _0x3d53df=fs['createReadStream'](_0x299d34);var _0x1cfe7f=fs[_0x1226('0xe')](_0x3b2d83);var _0xb94b20=crypto['createDecipher'](_0x2b88fa['algorithm'],_0x5059d5);_0x3d53df['on']('data',function(_0x4b2623){var _0x2b9838=new Buffer(_0xb94b20[_0x1226('0x10')](_0x4b2623),'binary');_0x1cfe7f[_0x1226('0x12')](_0x2b9838);});_0x3d53df['on']('end',function(){try{var _0x25baa3=new Buffer(_0xb94b20[_0x1226('0x16')]('binary'),_0x1226('0x11'));_0x1cfe7f[_0x1226('0x12')](_0x25baa3);_0x1cfe7f[_0x1226('0x13')]();_0x1cfe7f['on'](_0x1226('0x14'),function(){return _0x206877(_0x3b2d83);});}catch(_0x55b2c7){fs[_0x1226('0x17')](_0x3b2d83);return _0x1c1765(_0x55b2c7);}});});};exports['encryptString']=function(_0x4cdb46,_0x5dc856,_0x278724){var _0x4a5c5a=_0x278724||stringOptions[_0x1226('0x8')];var _0xda9005=_0x5dc856||stringOptions[_0x1226('0x18')];var _0x126d79=crypto['createCipher'](_0x4a5c5a,_0xda9005);var _0xfbdbc3=_0x126d79[_0x1226('0x10')](_0x4cdb46,_0x1226('0x19'),_0x1226('0x1a'));_0xfbdbc3+=_0x126d79[_0x1226('0x16')]('base64');return _0xfbdbc3;};exports[_0x1226('0x1b')]=function(_0x4b1737,_0x2635cb,_0x3e1fff){var _0x3d82ba=_0x3e1fff||stringOptions[_0x1226('0x8')];var _0x7065de=_0x2635cb||stringOptions['secret'];var _0x4fdd83=crypto[_0x1226('0x1c')](_0x3d82ba,_0x7065de);var _0x10123a=_0x4fdd83[_0x1226('0x10')](_0x4b1737,_0x1226('0x1a'),_0x1226('0x19'));_0x10123a+=_0x4fdd83[_0x1226('0x16')](_0x1226('0x19'));return _0x10123a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b16bd70..6bcd878 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 _0xd0bc=['CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','writeFileSync','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x28f881,_0x50fc96){var _0x494140=function(_0xf1f763){while(--_0xf1f763){_0x28f881['push'](_0x28f881['shift']());}};_0x494140(++_0x50fc96);}(_0xd0bc,0x13d));var _0xcd0b=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0xd0bc[_0x15cbce];return _0x257f29;};'use strict';var util=require(_0xcd0b('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xcd0b('0x1'));var fs=require('fs');var BPromise=require(_0xcd0b('0x2'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xcd0b('0x3'))['db'];var dbH=require(_0xcd0b('0x3'))[_0xcd0b('0x4')];var logger=require(_0xcd0b('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcd0b('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xcd0b('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x40f5b1,_0x245a61){var _0x6f347b={'status':_0x40f5b1};var _0x58897e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x245a61){_0x6f347b[_0xcd0b('0x7')]=_0x245a61;}return db[_0xcd0b('0x8')][_0xcd0b('0x9')](_0x6f347b,_0x58897e);}function main(){var _0x3f581d=0x1388;var _0x5aede4;logger['info'](util[_0xcd0b('0xa')](_0xcd0b('0xb'),EXTRACTED_REPORT_ID,_0xcd0b('0xc')));return db[_0xcd0b('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcd0b('0xe'),_0xcd0b('0xf')]})['then'](function(_0x2bb79a){if(_0x2bb79a){_0x5aede4=_0x2bb79a;_0x3f581d=_0x5aede4[_0xcd0b('0xf')]||0x1388;}})[_0xcd0b('0x10')](function(){return dbH[_0xcd0b('0x11')][_0xcd0b('0x12')](util['format'](_0xcd0b('0x13'),QUERY),{'type':dbH[_0xcd0b('0x11')][_0xcd0b('0x14')][_0xcd0b('0x15')]});})[_0xcd0b('0x10')](function(_0x136428){if(!_0x136428[0x0][_0xcd0b('0x16')]){return analyticExtractedReport(_0xcd0b('0x17'));}var _0x3a6de8=[];var _0x3365c3=0x0;if(_0x5aede4['split']){if(_0x136428&&_0x136428[_0xcd0b('0x18')]){var _0x58959b=_[_0xcd0b('0x19')](_0x136428[0x0]['num']/_0x3f581d);var _0x468c92=Number[_0xcd0b('0x1a')](_0x136428[0x0][_0xcd0b('0x16')]/_0x3f581d)?_0x136428[0x0][_0xcd0b('0x16')]%_0x3f581d:0x0;_0x58959b[_0xcd0b('0x1b')](function(_0x5b4b5e){if(_0x5b4b5e>0x0){_0x3365c3+=_0x3f581d;}_0x3a6de8['push'](dbH['sequelize'][_0xcd0b('0x12')](util[_0xcd0b('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f581d,_0x3365c3),{'type':dbH[_0xcd0b('0x11')][_0xcd0b('0x14')][_0xcd0b('0x15')]}));});if(_0x468c92>0x0){_0x3365c3+=_0x3f581d;_0x3a6de8[_0xcd0b('0x1c')](dbH['sequelize'][_0xcd0b('0x12')](util[_0xcd0b('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x468c92,_0x3365c3),{'type':dbH['sequelize'][_0xcd0b('0x14')]['SELECT']}));}}}else{_0x3a6de8['push'](dbH['sequelize'][_0xcd0b('0x12')](QUERY,{'type':dbH[_0xcd0b('0x11')]['QueryTypes']['SELECT']}));}var _0xc5b33a=path[_0xcd0b('0x1d')](PATH);var _0x3af7c8=path[_0xcd0b('0x1e')](PATH,_0xcd0b('0x1f'));var _0x3c3f8d=_0x5aede4[_0xcd0b('0xe')]&&_0x3a6de8[_0xcd0b('0x18')]>0x1;var _0x4eb4ed=[];if(!fs[_0xcd0b('0x20')](path[_0xcd0b('0x21')](_0xc5b33a,_0x3af7c8))&&_0x3c3f8d){fs[_0xcd0b('0x22')](path[_0xcd0b('0x21')](_0xc5b33a,_0x3af7c8));}return BPromise[_0xcd0b('0x23')](_0x3a6de8,function(_0x46e046){_0x4eb4ed[_0xcd0b('0x1c')](_0x46e046);})[_0xcd0b('0x10')](function(){for(var _0x987e56=0x0;_0x987e56<_0x4eb4ed[_0xcd0b('0x18')];_0x987e56+=0x1){var _0x5d7c5d;var _0x2a47bc=_0x4eb4ed[_0x987e56];if(_0x3c3f8d){_0x5d7c5d=path['join'](_0xc5b33a,_0x3af7c8,util['format']('%s%d.%s',_0x3af7c8,_0x987e56,_0xcd0b('0x24')));}else{_0x5d7c5d=path[_0xcd0b('0x21')](_0xc5b33a,util[_0xcd0b('0xa')]('%s.%s',_0x3af7c8,_0xcd0b('0x24')));}fs[_0xcd0b('0x25')](_0x5d7c5d,csv(_0x2a47bc));}})[_0xcd0b('0x10')](function(){if(_0x3c3f8d){return new Promise(function(_0x425ad9){zipdir(path['join'](_0xc5b33a,_0x3af7c8),{'saveTo':path[_0xcd0b('0x21')](_0xc5b33a,util['format'](_0xcd0b('0x26'),_0x3af7c8,'zip'))},function(_0x301257,_0x58500f){rimraf(path['join'](_0xc5b33a,_0x3af7c8),function(){});_0x425ad9(_0xcd0b('0x27'));});});}})[_0xcd0b('0x10')](function(){logger[_0xcd0b('0x28')](util[_0xcd0b('0xa')](_0xcd0b('0x29'),EXTRACTED_REPORT_ID,_0xcd0b('0xc')));return analyticExtractedReport(_0xcd0b('0x2a'),_0x3c3f8d?util['format'](_0xcd0b('0x26'),_0x3af7c8,_0x3c3f8d?'zip':'csv'):null);});})['catch'](function(_0x4ea6e2){logger['info'](util[_0xcd0b('0xa')](_0xcd0b('0x2b'),EXTRACTED_REPORT_ID,_0xcd0b('0xc')),util[_0xcd0b('0x2c')](_0x4ea6e2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcd0b('0x2d'));})['finally'](function(){process[_0xcd0b('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe571=['push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','isInteger','forEach'];(function(_0x17b9d0,_0x3ac188){var _0x40b459=function(_0x160671){while(--_0x160671){_0x17b9d0['push'](_0x17b9d0['shift']());}};_0x40b459(++_0x3ac188);}(_0xe571,0x188));var _0x1e57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe571[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x1e57('0x0'));var path=require(_0x1e57('0x1'));var _=require(_0x1e57('0x2'));var csv=require(_0x1e57('0x3'));var fs=require('fs');var BPromise=require(_0x1e57('0x4'));var zipdir=require(_0x1e57('0x5'));var rimraf=require(_0x1e57('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1e57('0x7'))[_0x1e57('0x8')];var logger=require(_0x1e57('0x9'))(_0x1e57('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x1e57('0xb')][0x2]);var QUERY=process[_0x1e57('0xb')][0x3];var PATH=process[_0x1e57('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc67ec9,_0x4a8e76){var _0x3a0147={'status':_0xc67ec9};var _0x2d4f5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4a8e76){_0x3a0147[_0x1e57('0xc')]=_0x4a8e76;}return db[_0x1e57('0xd')][_0x1e57('0xe')](_0x3a0147,_0x2d4f5c);}function main(){var _0x3bbb6c=0x1388;var _0x3aa933;logger[_0x1e57('0xf')](util['format'](_0x1e57('0x10'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x1e57('0x11')][_0x1e57('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1e57('0x13')]})[_0x1e57('0x14')](function(_0x228ec0){if(_0x228ec0){_0x3aa933=_0x228ec0;_0x3bbb6c=_0x3aa933[_0x1e57('0x13')]||0x1388;}})[_0x1e57('0x14')](function(){return dbH[_0x1e57('0x15')][_0x1e57('0x16')](util['format'](_0x1e57('0x17'),QUERY),{'type':dbH[_0x1e57('0x15')][_0x1e57('0x18')][_0x1e57('0x19')]});})[_0x1e57('0x14')](function(_0x134e84){if(!_0x134e84[0x0][_0x1e57('0x1a')]){return analyticExtractedReport(_0x1e57('0x1b'));}var _0x8464f3=[];var _0x78e59e=0x0;if(_0x3aa933[_0x1e57('0x1c')]){if(_0x134e84&&_0x134e84[_0x1e57('0x1d')]){var _0x5312a9=_['range'](_0x134e84[0x0]['num']/_0x3bbb6c);var _0x19d8d4=Number[_0x1e57('0x1e')](_0x134e84[0x0]['num']/_0x3bbb6c)?_0x134e84[0x0]['num']%_0x3bbb6c:0x0;_0x5312a9[_0x1e57('0x1f')](function(_0x12e0a5){if(_0x12e0a5>0x0){_0x78e59e+=_0x3bbb6c;}_0x8464f3[_0x1e57('0x20')](dbH[_0x1e57('0x15')][_0x1e57('0x16')](util[_0x1e57('0x21')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3bbb6c,_0x78e59e),{'type':dbH[_0x1e57('0x15')][_0x1e57('0x18')][_0x1e57('0x19')]}));});if(_0x19d8d4>0x0){_0x78e59e+=_0x3bbb6c;_0x8464f3['push'](dbH[_0x1e57('0x15')][_0x1e57('0x16')](util[_0x1e57('0x21')](_0x1e57('0x22'),QUERY,_0x19d8d4,_0x78e59e),{'type':dbH[_0x1e57('0x15')][_0x1e57('0x18')][_0x1e57('0x19')]}));}}}else{_0x8464f3[_0x1e57('0x20')](dbH[_0x1e57('0x15')][_0x1e57('0x16')](QUERY,{'type':dbH[_0x1e57('0x15')][_0x1e57('0x18')][_0x1e57('0x19')]}));}var _0x3e09a3=path[_0x1e57('0x23')](PATH);var _0x130d9b=path[_0x1e57('0x24')](PATH,_0x1e57('0x25'));var _0x368b22=_0x3aa933[_0x1e57('0x1c')]&&_0x8464f3['length']>0x1;var _0xc8e1cc=[];if(!fs['existsSync'](path[_0x1e57('0x26')](_0x3e09a3,_0x130d9b))&&_0x368b22){fs[_0x1e57('0x27')](path[_0x1e57('0x26')](_0x3e09a3,_0x130d9b));}return BPromise[_0x1e57('0x28')](_0x8464f3,function(_0x573af9){_0xc8e1cc[_0x1e57('0x20')](_0x573af9);})['then'](function(){for(var _0x1461d2=0x0;_0x1461d2<_0xc8e1cc[_0x1e57('0x1d')];_0x1461d2+=0x1){var _0x4cdaa6;var _0x635cf9=_0xc8e1cc[_0x1461d2];if(_0x368b22){_0x4cdaa6=path[_0x1e57('0x26')](_0x3e09a3,_0x130d9b,util['format'](_0x1e57('0x29'),_0x130d9b,_0x1461d2,'csv'));}else{_0x4cdaa6=path[_0x1e57('0x26')](_0x3e09a3,util[_0x1e57('0x21')](_0x1e57('0x2a'),_0x130d9b,'csv'));}fs[_0x1e57('0x2b')](_0x4cdaa6,csv(_0x635cf9));}})['then'](function(){if(_0x368b22){return new Promise(function(_0x272564){zipdir(path[_0x1e57('0x26')](_0x3e09a3,_0x130d9b),{'saveTo':path[_0x1e57('0x26')](_0x3e09a3,util[_0x1e57('0x21')](_0x1e57('0x2a'),_0x130d9b,_0x1e57('0x2c')))},function(_0x3b09b1,_0x324fae){rimraf(path[_0x1e57('0x26')](_0x3e09a3,_0x130d9b),function(){});_0x272564(_0x1e57('0x2d'));});});}})[_0x1e57('0x14')](function(){logger[_0x1e57('0xf')](util[_0x1e57('0x21')](_0x1e57('0x2e'),EXTRACTED_REPORT_ID,_0x1e57('0x2f')));return analyticExtractedReport('Completed',_0x368b22?util[_0x1e57('0x21')](_0x1e57('0x2a'),_0x130d9b,_0x368b22?_0x1e57('0x2c'):'csv'):null);});})[_0x1e57('0x30')](function(_0x3b10f9){logger[_0x1e57('0xf')](util[_0x1e57('0x21')](_0x1e57('0x31'),EXTRACTED_REPORT_ID,_0x1e57('0x2f')),util[_0x1e57('0x32')](_0x3b10f9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1e57('0x33'));})['finally'](function(){process[_0x1e57('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 2c4b43d..b22979c 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 _0xb30a=['all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','%s.%s','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','createPdfFromHTML','path','lodash','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','endDate','header','pageBreak','before','margin','landscape','toString','\x20/\x20','Arial','black','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf'];(function(_0x3e7871,_0x444efb){var _0x1af655=function(_0x71282f){while(--_0x71282f){_0x3e7871['push'](_0x3e7871['shift']());}};_0x1af655(++_0x444efb);}(_0xb30a,0xd9));var _0xab30=function(_0x583c56,_0x5cc77c){_0x583c56=_0x583c56-0x0;var _0x4794ce=_0xb30a[_0x583c56];return _0x4794ce;};'use strict';var _=require(_0xab30('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0xab30('0x1'));var htmlToPdfmake=require(_0xab30('0x2'));var PdfPrinter=require(_0xab30('0x3'));var zipdir=require(_0xab30('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xab30('0x5'))[_0xab30('0x6')];var window=new JSDOM('')[_0xab30('0x7')];var BPromise=require(_0xab30('0x8'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xab30('0x9')];var logger=require(_0xab30('0xa'))(_0xab30('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xab30('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xab30('0xc')][0x5];var FORMAT=_0xab30('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4dd4cc,_0x1dc8a7){var _0x1a2a91={'status':_0x4dd4cc};var _0x5bdee0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1dc8a7){_0x1a2a91[_0xab30('0xe')]=_0x1dc8a7;}return db['AnalyticExtractedReport'][_0xab30('0xf')](_0x1a2a91,_0x5bdee0);}function getHeaders(_0x2b0f4b){return _[_0xab30('0x10')](_0x2b0f4b,function(_0x260ff5){return{'text':_0x260ff5,'style':_0xab30('0x11')};});}function getRows(_0x5df100,_0x2873c3){return _[_0xab30('0x10')](_0x2873c3,function(_0x15a0c0){return _(_0x15a0c0)[_0xab30('0x12')](_0x5df100)[_0xab30('0x10')](function(_0x5d855c){return _0x5d855c?_['toString'](_0x5d855c):'';})['value']();});}function createTable(_0xd449f9,_0x13fff0){var _0x297231={'widths':_[_0xab30('0x13')](Array(_0xd449f9[_0xab30('0x14')]),0x91),'heights':function(_0x2b2291){return _0x2b2291===0x0?_0xab30('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5df949=getHeaders(_0xd449f9);_0x297231[_0xab30('0x16')][_0xab30('0x17')](_0x5df949);var _0x3f4384=getRows(_0xd449f9,_0x13fff0);_0x297231[_0xab30('0x16')]=_0x297231['body'][_0xab30('0x18')](_0x3f4384);return _0x297231;}function createTables(_0xe0d892){var _0x4bab43=[];var _0x516de5=_[_0xab30('0x19')](Object[_0xab30('0x1a')](_0xe0d892[0x0]),0x5);_0x516de5[_0xab30('0x1b')](function(_0x4722dd){_0x4bab43[_0xab30('0x17')](createTable(_0x4722dd,_0xe0d892));});return _0x4bab43;}function getPDFDocDefinition(_0x2eb9ce){var _0x2c2a45=util[_0xab30('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xab30('0x1d')],moment(EXTRACTED_REPORT[_0xab30('0x1e')])[_0xab30('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xab30('0x1f')])[_0xab30('0x1c')](FORMAT));var _0x3b7a84=[];for(var _0xd41c1c=0x0;_0xd41c1c<_0x2eb9ce[_0xab30('0x14')];_0xd41c1c++){var _0x2dc206=[];if(_0xd41c1c===0x0){_0x2dc206[_0xab30('0x17')]({'text':_0x2c2a45,'style':_0xab30('0x20')});}var _0x295f5={'table':_0x2eb9ce[_0xd41c1c]};if(_0xd41c1c>0x0){_0x295f5[_0xab30('0x21')]=_0xab30('0x22');_0x295f5[_0xab30('0x23')]=[0x0,0x46,0x0,0x0];}_0x2dc206[_0xab30('0x17')](_0x295f5);_0x3b7a84[_0xab30('0x17')](_0x2dc206);}return{'pageSize':'A4','pageOrientation':_0xab30('0x24'),'content':_0x3b7a84,'footer':function(_0x2161c8,_0x17b0ee){return{'text':_0x2161c8[_0xab30('0x25')]()+_0xab30('0x26')+_0x17b0ee,'style':'footer'};},'defaultStyle':{'font':_0xab30('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xab30('0x28')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2ba9c9){var _0x9e7ffa=0x1388;var _0x29742;if(!_0x2ba9c9[0x0][_0xab30('0x29')]){return analyticExtractedReport(_0xab30('0x2a'));}return db[_0xab30('0x2b')][_0xab30('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xab30('0x2d')]})['then'](function(_0x13e5f2){if(_0x13e5f2){_0x29742=_0x13e5f2;_0x9e7ffa=_0x29742['splitSizePdf']||0x3e8;}})[_0xab30('0x2e')](function(){var _0x5a1e93=[];var _0x33f825=0x0;if(_0x29742[_0xab30('0x2f')]){if(_0x2ba9c9&&_0x2ba9c9['length']){var _0x1e9f38=_[_0xab30('0x30')](_0x2ba9c9[0x0][_0xab30('0x29')]/_0x9e7ffa);var _0x1b4532=Number[_0xab30('0x31')](_0x2ba9c9[0x0][_0xab30('0x29')]/_0x9e7ffa)?_0x2ba9c9[0x0][_0xab30('0x29')]%_0x9e7ffa:0x0;_0x1e9f38[_0xab30('0x1b')](function(_0x27264f){if(_0x27264f>0x0){_0x33f825+=_0x9e7ffa;}_0x5a1e93['push'](dbH['sequelize'][_0xab30('0x32')](util[_0xab30('0x1c')](_0xab30('0x33'),QUERY,_0x9e7ffa,_0x33f825),{'type':dbH[_0xab30('0x34')][_0xab30('0x35')][_0xab30('0x36')]}));});if(_0x1b4532>0x0){_0x33f825+=_0x9e7ffa;_0x5a1e93[_0xab30('0x17')](dbH[_0xab30('0x34')]['query'](util[_0xab30('0x1c')](_0xab30('0x33'),QUERY,_0x1b4532,_0x33f825),{'type':dbH['sequelize']['QueryTypes'][_0xab30('0x36')]}));}}}else{_0x5a1e93[_0xab30('0x17')](dbH[_0xab30('0x34')][_0xab30('0x32')](QUERY,{'type':dbH[_0xab30('0x34')][_0xab30('0x35')][_0xab30('0x36')]}));}var _0x28fca0=path[_0xab30('0x37')](PATH);var _0x1f30bc=path[_0xab30('0x38')](PATH,_0xab30('0x39'));var _0x571bf5=_0x29742[_0xab30('0x2f')]&&_0x5a1e93['length']>0x1;var _0xc63f0a=[];if(!fs['existsSync'](path['join'](_0x28fca0,_0x1f30bc))&&_0x571bf5){fs[_0xab30('0x3a')](path[_0xab30('0x3b')](_0x28fca0,_0x1f30bc));}return BPromise[_0xab30('0x3c')](_0x5a1e93,function(_0x583f95){_0xc63f0a[_0xab30('0x17')](_0x583f95);})['then'](function(){var _0xc90569=[];for(var _0x565766=0x0;_0x565766<_0xc63f0a[_0xab30('0x14')];_0x565766+=0x1){var _0x166590=_0xc63f0a[_0x565766];var _0x21a63c=createTables(_[_0xab30('0x3d')](_0x166590));var _0x77314f;var _0x5505ae=getPDFDocDefinition(_0x21a63c);var _0x3a9dd5=getPDFPrinter();var _0x86c72c=_0x3a9dd5[_0xab30('0x3e')](_0x5505ae);if(_0x571bf5){_0x77314f=path[_0xab30('0x3b')](_0x28fca0,_0x1f30bc,util[_0xab30('0x1c')](_0xab30('0x3f'),_0x1f30bc,_0x565766,_0xab30('0x40')));}else{_0x77314f=path['join'](_0x28fca0,util[_0xab30('0x1c')]('%s.%s',_0x1f30bc,_0xab30('0x40')));}_0xc90569[_0xab30('0x17')](writePDFDocument(_0x86c72c,_0x77314f));}return Promise[_0xab30('0x41')](_0xc90569);})[_0xab30('0x2e')](function(){if(_0x571bf5){return new Promise(function(_0x2059ce){zipdir(path[_0xab30('0x3b')](_0x28fca0,_0x1f30bc),{'saveTo':path[_0xab30('0x3b')](_0x28fca0,util[_0xab30('0x1c')]('%s.%s',_0x1f30bc,_0xab30('0x42')))},function(){rimraf(path['join'](_0x28fca0,_0x1f30bc),function(){});_0x2059ce('zip\x20finished');});});}})['then'](function(){if(!_0x571bf5)return;rimraf(path['join'](_0x28fca0,_0x1f30bc),function(){});})[_0xab30('0x2e')](function(){logger[_0xab30('0x43')](util[_0xab30('0x1c')](_0xab30('0x44'),EXTRACTED_REPORT_ID,_0xab30('0x45')));return analyticExtractedReport(_0xab30('0x46'),_0x571bf5?util[_0xab30('0x1c')](_0xab30('0x47'),_0x1f30bc,_0x571bf5?_0xab30('0x42'):_0xab30('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xab30('0x43')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xab30('0x45')));return db[_0xab30('0x48')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x53b6ed){EXTRACTED_REPORT=_0x53b6ed;return dbH[_0xab30('0x34')]['query'](util[_0xab30('0x1c')](_0xab30('0x49'),QUERY),{'type':dbH[_0xab30('0x34')][_0xab30('0x35')][_0xab30('0x36')]});})[_0xab30('0x2e')](extractReport)[_0xab30('0x4a')](function(_0x3453d1){logger[_0xab30('0x43')](util['format'](_0xab30('0x4b'),EXTRACTED_REPORT_ID,'PDF'),util[_0xab30('0x4c')](_0x3453d1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xab30('0x4d'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3b8dc6=new PdfPrinter({'Arial':{'normal':__dirname+_0xab30('0x4e'),'bold':__dirname+_0xab30('0x4f'),'italics':__dirname+_0xab30('0x50'),'bolditalics':__dirname+_0xab30('0x51')}});return _0x3b8dc6;}function getPDFDocDefinitionFromHTML(_0x4ccdd9,_0x40774e){var _0x45129e=util['format'](_0xab30('0x52'),_0x40774e[_0xab30('0x53')],_0x40774e[_0xab30('0x54')]);var _0x4c0bc4=moment()[_0xab30('0x1c')](_0xab30('0x55'))[_0xab30('0x25')]();var _0x4fd63a=htmlToPdfmake(_0x4ccdd9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4fd63a],'defaultStyle':{'font':_0xab30('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xab30('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xab30('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xab30('0x20')}];},'footer':function(_0x34319e,_0x4eed79){return[{'text':util[_0xab30('0x1c')](_0xab30('0x57'),_0x45129e,_0x34319e,_0x4eed79,_0x4c0bc4),'style':_0xab30('0x58')}];}};}function writePDFDocument(_0xc1e61a,_0x365905){return new Promise(function(_0xf01d86,_0x4b9380){var _0x25ccfa=_0xc1e61a[_0xab30('0x59')](fs['createWriteStream'](_0x365905));_0x25ccfa['on']('finish',function(){_0xf01d86(_0xab30('0x5a'));});_0x25ccfa['on'](_0xab30('0x5b'),function(_0x540d04){_0x4b9380(_0x540d04);});_0xc1e61a['end']();});}exports[_0xab30('0x5c')]=function(_0xae5f09,_0x3c50f5){var _0x88001b=getPDFPrinter();var _0x64e582=getPDFDocDefinitionFromHTML(_0xae5f09,_0x3c50f5);var _0x24d31c=_0x88001b[_0xab30('0x3e')](_0x64e582);return writePDFDocument(_0x24d31c,_0x3c50f5[_0xab30('0x5d')])[_0xab30('0x4a')](function(_0xaba5ac){throw _0xaba5ac;});}; \ No newline at end of file +var _0x4726=['Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','error','createPdfFromHTML','createPdfKitDocument','path','lodash','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','length','auto','body','concat','chunk','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','existsSync','join','mkdirSync','flatten','%s%d.%s','%s.%s','pdf','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'];(function(_0x2f8808,_0xee7fcf){var _0x5c725b=function(_0xde1203){while(--_0xde1203){_0x2f8808['push'](_0x2f8808['shift']());}};_0x5c725b(++_0xee7fcf);}(_0x4726,0xce));var _0x6472=function(_0x1c877f,_0x26a0b0){_0x1c877f=_0x1c877f-0x0;var _0x4ab659=_0x4726[_0x1c877f];return _0x4ab659;};'use strict';var _=require(_0x6472('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x6472('0x1'));var PdfPrinter=require(_0x6472('0x2'));var zipdir=require(_0x6472('0x3'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x6472('0x4')];var window=new JSDOM('')[_0x6472('0x5')];var BPromise=require(_0x6472('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6472('0x7'))[_0x6472('0x8')];var logger=require(_0x6472('0x9'))(_0x6472('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x6472('0xb')][0x2]);var QUERY=process[_0x6472('0xb')][0x3];var PATH=process[_0x6472('0xb')][0x4];var NAME=process[_0x6472('0xb')][0x5];var FORMAT=_0x6472('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d508a,_0x1affd1){var _0x360a59={'status':_0x2d508a};var _0x3f9871={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1affd1){_0x360a59['savename']=_0x1affd1;}return db[_0x6472('0xd')][_0x6472('0xe')](_0x360a59,_0x3f9871);}function getHeaders(_0x47985b){return _['map'](_0x47985b,function(_0x4bb2bf){return{'text':_0x4bb2bf,'style':_0x6472('0xf')};});}function getRows(_0x42a09b,_0x4a950a){return _[_0x6472('0x10')](_0x4a950a,function(_0x3f2a3c){return _(_0x3f2a3c)[_0x6472('0x11')](_0x42a09b)[_0x6472('0x10')](function(_0x27dfda){return _0x27dfda?_[_0x6472('0x12')](_0x27dfda):'';})[_0x6472('0x13')]();});}function createTable(_0x3d7729,_0x5c6280){var _0x32c755={'widths':_[_0x6472('0x14')](Array(_0x3d7729[_0x6472('0x15')]),0x91),'heights':function(_0x4e9040){return _0x4e9040===0x0?_0x6472('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3c7eb3=getHeaders(_0x3d7729);_0x32c755['body']['push'](_0x3c7eb3);var _0x384d10=getRows(_0x3d7729,_0x5c6280);_0x32c755[_0x6472('0x17')]=_0x32c755['body'][_0x6472('0x18')](_0x384d10);return _0x32c755;}function createTables(_0x3ee3c2){var _0x21b9e0=[];var _0x136d11=_[_0x6472('0x19')](Object['keys'](_0x3ee3c2[0x0]),0x5);_0x136d11[_0x6472('0x1a')](function(_0x141552){_0x21b9e0[_0x6472('0x1b')](createTable(_0x141552,_0x3ee3c2));});return _0x21b9e0;}function getPDFDocDefinition(_0x544df1){var _0x25bc5e=util[_0x6472('0x1c')](_0x6472('0x1d'),NAME,EXTRACTED_REPORT[_0x6472('0x1e')],moment(EXTRACTED_REPORT[_0x6472('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x6472('0x20')])['format'](FORMAT));var _0x345c76=[];for(var _0x38c395=0x0;_0x38c395<_0x544df1[_0x6472('0x15')];_0x38c395++){var _0x14d86f=[];if(_0x38c395===0x0){_0x14d86f[_0x6472('0x1b')]({'text':_0x25bc5e,'style':_0x6472('0x21')});}var _0x586f27={'table':_0x544df1[_0x38c395]};if(_0x38c395>0x0){_0x586f27[_0x6472('0x22')]=_0x6472('0x23');_0x586f27[_0x6472('0x24')]=[0x0,0x46,0x0,0x0];}_0x14d86f[_0x6472('0x1b')](_0x586f27);_0x345c76[_0x6472('0x1b')](_0x14d86f);}return{'pageSize':'A4','pageOrientation':_0x6472('0x25'),'content':_0x345c76,'footer':function(_0x41282e,_0x47b543){return{'text':_0x41282e[_0x6472('0x12')]()+'\x20/\x20'+_0x47b543,'style':'footer'};},'defaultStyle':{'font':_0x6472('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6472('0x27')},'footer':{'alignment':_0x6472('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3afbf2){var _0x2994c0=0x1388;var _0x24e52d;if(!_0x3afbf2[0x0][_0x6472('0x29')]){return analyticExtractedReport(_0x6472('0x2a'));}return db[_0x6472('0x2b')][_0x6472('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6472('0x2d'),_0x6472('0x2e')]})[_0x6472('0x2f')](function(_0x23ba99){if(_0x23ba99){_0x24e52d=_0x23ba99;_0x2994c0=_0x24e52d['splitSizePdf']||0x3e8;}})['then'](function(){var _0x26bf19=[];var _0x5dc28c=0x0;if(_0x24e52d[_0x6472('0x2d')]){if(_0x3afbf2&&_0x3afbf2[_0x6472('0x15')]){var _0x5547c=_[_0x6472('0x30')](_0x3afbf2[0x0][_0x6472('0x29')]/_0x2994c0);var _0x103c87=Number[_0x6472('0x31')](_0x3afbf2[0x0][_0x6472('0x29')]/_0x2994c0)?_0x3afbf2[0x0]['num']%_0x2994c0:0x0;_0x5547c[_0x6472('0x1a')](function(_0x125a8a){if(_0x125a8a>0x0){_0x5dc28c+=_0x2994c0;}_0x26bf19[_0x6472('0x1b')](dbH[_0x6472('0x32')][_0x6472('0x33')](util[_0x6472('0x1c')](_0x6472('0x34'),QUERY,_0x2994c0,_0x5dc28c),{'type':dbH[_0x6472('0x32')]['QueryTypes'][_0x6472('0x35')]}));});if(_0x103c87>0x0){_0x5dc28c+=_0x2994c0;_0x26bf19[_0x6472('0x1b')](dbH[_0x6472('0x32')][_0x6472('0x33')](util[_0x6472('0x1c')](_0x6472('0x34'),QUERY,_0x103c87,_0x5dc28c),{'type':dbH[_0x6472('0x32')][_0x6472('0x36')]['SELECT']}));}}}else{_0x26bf19[_0x6472('0x1b')](dbH['sequelize'][_0x6472('0x33')](QUERY,{'type':dbH[_0x6472('0x32')][_0x6472('0x36')]['SELECT']}));}var _0x4f19af=path[_0x6472('0x37')](PATH);var _0xa51fc=path[_0x6472('0x38')](PATH,'.pdf');var _0x452f97=_0x24e52d[_0x6472('0x2d')]&&_0x26bf19[_0x6472('0x15')]>0x1;var _0x1b6738=[];if(!fs[_0x6472('0x39')](path[_0x6472('0x3a')](_0x4f19af,_0xa51fc))&&_0x452f97){fs[_0x6472('0x3b')](path[_0x6472('0x3a')](_0x4f19af,_0xa51fc));}return BPromise['each'](_0x26bf19,function(_0x5cede2){_0x1b6738['push'](_0x5cede2);})[_0x6472('0x2f')](function(){var _0x3a2543=[];for(var _0x24aa60=0x0;_0x24aa60<_0x1b6738['length'];_0x24aa60+=0x1){var _0xd47c50=_0x1b6738[_0x24aa60];var _0x3efe32=createTables(_[_0x6472('0x3c')](_0xd47c50));var _0x246c09;var _0x519f6d=getPDFDocDefinition(_0x3efe32);var _0x1bfe12=getPDFPrinter();var _0x4d57e5=_0x1bfe12['createPdfKitDocument'](_0x519f6d);if(_0x452f97){_0x246c09=path['join'](_0x4f19af,_0xa51fc,util[_0x6472('0x1c')](_0x6472('0x3d'),_0xa51fc,_0x24aa60,'pdf'));}else{_0x246c09=path[_0x6472('0x3a')](_0x4f19af,util[_0x6472('0x1c')](_0x6472('0x3e'),_0xa51fc,_0x6472('0x3f')));}_0x3a2543[_0x6472('0x1b')](writePDFDocument(_0x4d57e5,_0x246c09));}return Promise['all'](_0x3a2543);})[_0x6472('0x2f')](function(){if(_0x452f97){return new Promise(function(_0x4f0ca6){zipdir(path[_0x6472('0x3a')](_0x4f19af,_0xa51fc),{'saveTo':path[_0x6472('0x3a')](_0x4f19af,util['format'](_0x6472('0x3e'),_0xa51fc,_0x6472('0x40')))},function(){rimraf(path[_0x6472('0x3a')](_0x4f19af,_0xa51fc),function(){});_0x4f0ca6(_0x6472('0x41'));});});}})[_0x6472('0x2f')](function(){if(!_0x452f97)return;rimraf(path[_0x6472('0x3a')](_0x4f19af,_0xa51fc),function(){});})[_0x6472('0x2f')](function(){logger['info'](util['format'](_0x6472('0x42'),EXTRACTED_REPORT_ID,_0x6472('0x43')));return analyticExtractedReport(_0x6472('0x44'),_0x452f97?util[_0x6472('0x1c')](_0x6472('0x3e'),_0xa51fc,_0x452f97?_0x6472('0x40'):_0x6472('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x6472('0x45')](util[_0x6472('0x1c')](_0x6472('0x46'),EXTRACTED_REPORT_ID,_0x6472('0x43')));return db[_0x6472('0xd')][_0x6472('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6472('0x2f')](function(_0x5b2cc){EXTRACTED_REPORT=_0x5b2cc;return dbH['sequelize']['query'](util[_0x6472('0x1c')](_0x6472('0x48'),QUERY),{'type':dbH[_0x6472('0x32')][_0x6472('0x36')][_0x6472('0x35')]});})[_0x6472('0x2f')](extractReport)[_0x6472('0x49')](function(_0x41ad5c){logger[_0x6472('0x45')](util[_0x6472('0x1c')](_0x6472('0x4a'),EXTRACTED_REPORT_ID,_0x6472('0x43')),util[_0x6472('0x4b')](_0x41ad5c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6472('0x4c'));})[_0x6472('0x4d')](function(){process[_0x6472('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x318a33=new PdfPrinter({'Arial':{'normal':__dirname+_0x6472('0x4f'),'bold':__dirname+_0x6472('0x50'),'italics':__dirname+_0x6472('0x51'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x318a33;}function getPDFDocDefinitionFromHTML(_0xa95002,_0x5d003b){var _0x47924e=util[_0x6472('0x1c')](_0x6472('0x52'),_0x5d003b['channel'],_0x5d003b[_0x6472('0x53')]);var _0x110a07=moment()[_0x6472('0x1c')]('YYYY-MM-DD')[_0x6472('0x12')]();var _0x4f45a1=htmlToPdfmake(_0xa95002,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4f45a1],'defaultStyle':{'font':_0x6472('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x6472('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6472('0x54')}},'header':function(){return[{'text':_0x6472('0x55'),'style':_0x6472('0x21')}];},'footer':function(_0x438659,_0x1ecdd0){return[{'text':util[_0x6472('0x1c')](_0x6472('0x56'),_0x47924e,_0x438659,_0x1ecdd0,_0x110a07),'style':_0x6472('0x57')}];}};}function writePDFDocument(_0x50d2bf,_0x267d04){return new Promise(function(_0x2da62d,_0x3a29bd){var _0x53d55d=_0x50d2bf[_0x6472('0x58')](fs[_0x6472('0x59')](_0x267d04));_0x53d55d['on']('finish',function(){_0x2da62d('finish');});_0x53d55d['on'](_0x6472('0x5a'),function(_0x24a158){_0x3a29bd(_0x24a158);});_0x50d2bf['end']();});}exports[_0x6472('0x5b')]=function(_0x4b223d,_0x5e475d){var _0x543fed=getPDFPrinter();var _0x5b37d6=getPDFDocDefinitionFromHTML(_0x4b223d,_0x5e475d);var _0x123cbf=_0x543fed[_0x6472('0x5c')](_0x5b37d6);return writePDFDocument(_0x123cbf,_0x5e475d[_0x6472('0x5d')])[_0x6472('0x49')](function(_0x4fb446){throw _0x4fb446;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d13e49a..352c38b 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 _0x57cc=['Empty','split','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','binary','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x57cc,0x14b));var _0xc57c=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x57cc[_0x19b84f];return _0x18067b;};'use strict';var util=require(_0xc57c('0x0'));var path=require(_0xc57c('0x1'));var _=require(_0xc57c('0x2'));var fs=require('fs');var json2xls=require(_0xc57c('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xc57c('0x4'));var rimraf=require(_0xc57c('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc57c('0x6'))[_0xc57c('0x7')];var logger=require(_0xc57c('0x8'))(_0xc57c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc57c('0xa')][0x2]);var QUERY=process[_0xc57c('0xa')][0x3];var PATH=process[_0xc57c('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c285d,_0xb5e673){var _0x2b9e57={'status':_0x1c285d};var _0x1f48f5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb5e673){_0x2b9e57[_0xc57c('0xb')]=_0xb5e673;}return db[_0xc57c('0xc')][_0xc57c('0xd')](_0x2b9e57,_0x1f48f5);}function main(){var _0x4eecff=0x1388;var _0x5a1520;logger['info'](util[_0xc57c('0xe')](_0xc57c('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xc57c('0x10')][_0xc57c('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc57c('0x12')]})[_0xc57c('0x13')](function(_0x597c99){if(_0x597c99){_0x5a1520=_0x597c99;_0x4eecff=_0x5a1520[_0xc57c('0x12')]||0x1388;}})[_0xc57c('0x13')](function(){return dbH[_0xc57c('0x14')][_0xc57c('0x15')](util[_0xc57c('0xe')](_0xc57c('0x16'),QUERY),{'type':dbH[_0xc57c('0x14')][_0xc57c('0x17')][_0xc57c('0x18')]});})[_0xc57c('0x13')](function(_0x5c4616){if(!_0x5c4616[0x0][_0xc57c('0x19')]){return analyticExtractedReport(_0xc57c('0x1a'));}var _0x51e152=[];var _0x37614d=0x0;if(_0x5a1520[_0xc57c('0x1b')]){if(_0x5c4616&&_0x5c4616[_0xc57c('0x1c')]){var _0x1b6260=_['range'](_0x5c4616[0x0][_0xc57c('0x19')]/_0x4eecff);var _0x145ab1=Number[_0xc57c('0x1d')](_0x5c4616[0x0]['num']/_0x4eecff)?_0x5c4616[0x0][_0xc57c('0x19')]%_0x4eecff:0x0;_0x1b6260['forEach'](function(_0x169730){if(_0x169730>0x0){_0x37614d+=_0x4eecff;}_0x51e152[_0xc57c('0x1e')](dbH[_0xc57c('0x14')][_0xc57c('0x15')](util[_0xc57c('0xe')](_0xc57c('0x1f'),QUERY,_0x4eecff,_0x37614d),{'type':dbH[_0xc57c('0x14')][_0xc57c('0x17')]['SELECT']}));});if(_0x145ab1>0x0){_0x37614d+=_0x4eecff;_0x51e152[_0xc57c('0x1e')](dbH[_0xc57c('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x145ab1,_0x37614d),{'type':dbH[_0xc57c('0x14')][_0xc57c('0x17')][_0xc57c('0x18')]}));}}}else{_0x51e152[_0xc57c('0x1e')](dbH[_0xc57c('0x14')][_0xc57c('0x15')](QUERY,{'type':dbH[_0xc57c('0x14')][_0xc57c('0x17')]['SELECT']}));}var _0x1e339a=path[_0xc57c('0x20')](PATH);var _0x1a0e13=path['basename'](PATH,_0xc57c('0x21'));var _0x8a338=_0x5a1520['split']&&_0x51e152[_0xc57c('0x1c')]>0x1;var _0x1ab0f4=[];if(!fs[_0xc57c('0x22')](path['join'](_0x1e339a,_0x1a0e13))&&_0x8a338){fs[_0xc57c('0x23')](path[_0xc57c('0x24')](_0x1e339a,_0x1a0e13));}return BPromise[_0xc57c('0x25')](_0x51e152,function(_0x18f14b){_0x1ab0f4[_0xc57c('0x1e')](_0x18f14b);})[_0xc57c('0x13')](function(){for(var _0x35828d=0x0;_0x35828d<_0x1ab0f4[_0xc57c('0x1c')];_0x35828d+=0x1){var _0x31c1a7;var _0x4de09f=_0x1ab0f4[_0x35828d];if(_0x8a338){_0x31c1a7=path[_0xc57c('0x24')](_0x1e339a,_0x1a0e13,util[_0xc57c('0xe')](_0xc57c('0x26'),_0x1a0e13,_0x35828d,_0xc57c('0x27')));}else{_0x31c1a7=path[_0xc57c('0x24')](_0x1e339a,util[_0xc57c('0xe')]('%s.%s',_0x1a0e13,'xlsx'));}fs['writeFileSync'](_0x31c1a7,json2xls(_0x4de09f),_0xc57c('0x28'));}})[_0xc57c('0x13')](function(){if(_0x8a338){return new Promise(function(_0x113bfc){zipdir(path['join'](_0x1e339a,_0x1a0e13),{'saveTo':path[_0xc57c('0x24')](_0x1e339a,util[_0xc57c('0xe')](_0xc57c('0x29'),_0x1a0e13,_0xc57c('0x2a')))},function(_0x2fa741,_0x4c3120){rimraf(path[_0xc57c('0x24')](_0x1e339a,_0x1a0e13),function(){});_0x113bfc(_0xc57c('0x2b'));});});}})[_0xc57c('0x13')](function(){logger[_0xc57c('0x2c')](util[_0xc57c('0xe')](_0xc57c('0x2d'),EXTRACTED_REPORT_ID,_0xc57c('0x2e')));return analyticExtractedReport('Completed',_0x8a338?util[_0xc57c('0xe')](_0xc57c('0x29'),_0x1a0e13,_0x8a338?_0xc57c('0x2a'):_0xc57c('0x27')):null);});})['catch'](function(_0x5d661a){logger[_0xc57c('0x2c')](util[_0xc57c('0xe')](_0xc57c('0x2f'),EXTRACTED_REPORT_ID,_0xc57c('0x2e')),util[_0xc57c('0x30')](_0x5d661a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc57c('0x31'));})[_0xc57c('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x70ba=['%s%d.%s','xlsx','%s.%s','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','Failed','finally','exit','path','lodash','json2xls','zip-dir','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT','num','Empty','length','range','forEach','push','dirname','.xlsx','mkdirSync','join'];(function(_0x19d501,_0x364820){var _0x293e33=function(_0x2b4985){while(--_0x2b4985){_0x19d501['push'](_0x19d501['shift']());}};_0x293e33(++_0x364820);}(_0x70ba,0xc2));var _0xa70b=function(_0x2eecdd,_0x19dcd4){_0x2eecdd=_0x2eecdd-0x0;var _0x51f7f0=_0x70ba[_0x2eecdd];return _0x51f7f0;};'use strict';var util=require('util');var path=require(_0xa70b('0x0'));var _=require(_0xa70b('0x1'));var fs=require('fs');var json2xls=require(_0xa70b('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xa70b('0x3'));var rimraf=require('rimraf');var db=require(_0xa70b('0x4'))['db'];var dbH=require(_0xa70b('0x4'))[_0xa70b('0x5')];var logger=require('../../config/logger')(_0xa70b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xa70b('0x7')][0x2]);var QUERY=process[_0xa70b('0x7')][0x3];var PATH=process[_0xa70b('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x21c7b1,_0x28fa7e){var _0x4e7740={'status':_0x21c7b1};var _0x2d65ea={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x28fa7e){_0x4e7740['savename']=_0x28fa7e;}return db[_0xa70b('0x8')]['update'](_0x4e7740,_0x2d65ea);}function main(){var _0x148dd8=0x1388;var _0x5ed79c;logger[_0xa70b('0x9')](util[_0xa70b('0xa')](_0xa70b('0xb'),EXTRACTED_REPORT_ID,_0xa70b('0xc')));return db['Setting'][_0xa70b('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa70b('0xe'),_0xa70b('0xf')]})['then'](function(_0x37e122){if(_0x37e122){_0x5ed79c=_0x37e122;_0x148dd8=_0x5ed79c[_0xa70b('0xf')]||0x1388;}})[_0xa70b('0x10')](function(){return dbH['sequelize'][_0xa70b('0x11')](util[_0xa70b('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa70b('0x12')][_0xa70b('0x13')][_0xa70b('0x14')]});})[_0xa70b('0x10')](function(_0x4ddfc9){if(!_0x4ddfc9[0x0][_0xa70b('0x15')]){return analyticExtractedReport(_0xa70b('0x16'));}var _0x50f70b=[];var _0x35d78e=0x0;if(_0x5ed79c[_0xa70b('0xe')]){if(_0x4ddfc9&&_0x4ddfc9[_0xa70b('0x17')]){var _0x4a24b0=_[_0xa70b('0x18')](_0x4ddfc9[0x0]['num']/_0x148dd8);var _0x3ea69e=Number['isInteger'](_0x4ddfc9[0x0]['num']/_0x148dd8)?_0x4ddfc9[0x0][_0xa70b('0x15')]%_0x148dd8:0x0;_0x4a24b0[_0xa70b('0x19')](function(_0x4690de){if(_0x4690de>0x0){_0x35d78e+=_0x148dd8;}_0x50f70b[_0xa70b('0x1a')](dbH[_0xa70b('0x12')][_0xa70b('0x11')](util[_0xa70b('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x148dd8,_0x35d78e),{'type':dbH[_0xa70b('0x12')][_0xa70b('0x13')][_0xa70b('0x14')]}));});if(_0x3ea69e>0x0){_0x35d78e+=_0x148dd8;_0x50f70b[_0xa70b('0x1a')](dbH[_0xa70b('0x12')][_0xa70b('0x11')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3ea69e,_0x35d78e),{'type':dbH[_0xa70b('0x12')][_0xa70b('0x13')][_0xa70b('0x14')]}));}}}else{_0x50f70b[_0xa70b('0x1a')](dbH['sequelize'][_0xa70b('0x11')](QUERY,{'type':dbH[_0xa70b('0x12')]['QueryTypes'][_0xa70b('0x14')]}));}var _0x21977a=path[_0xa70b('0x1b')](PATH);var _0x1bfe83=path['basename'](PATH,_0xa70b('0x1c'));var _0x37b3ad=_0x5ed79c['split']&&_0x50f70b[_0xa70b('0x17')]>0x1;var _0x3a2eb5=[];if(!fs['existsSync'](path['join'](_0x21977a,_0x1bfe83))&&_0x37b3ad){fs[_0xa70b('0x1d')](path[_0xa70b('0x1e')](_0x21977a,_0x1bfe83));}return BPromise['each'](_0x50f70b,function(_0x19d5b1){_0x3a2eb5[_0xa70b('0x1a')](_0x19d5b1);})['then'](function(){for(var _0x18c29f=0x0;_0x18c29f<_0x3a2eb5[_0xa70b('0x17')];_0x18c29f+=0x1){var _0x18b910;var _0x4e9e23=_0x3a2eb5[_0x18c29f];if(_0x37b3ad){_0x18b910=path[_0xa70b('0x1e')](_0x21977a,_0x1bfe83,util['format'](_0xa70b('0x1f'),_0x1bfe83,_0x18c29f,_0xa70b('0x20')));}else{_0x18b910=path[_0xa70b('0x1e')](_0x21977a,util['format'](_0xa70b('0x21'),_0x1bfe83,'xlsx'));}fs['writeFileSync'](_0x18b910,json2xls(_0x4e9e23),_0xa70b('0x22'));}})['then'](function(){if(_0x37b3ad){return new Promise(function(_0xacc374){zipdir(path[_0xa70b('0x1e')](_0x21977a,_0x1bfe83),{'saveTo':path['join'](_0x21977a,util[_0xa70b('0xa')](_0xa70b('0x21'),_0x1bfe83,_0xa70b('0x23')))},function(_0x5425f6,_0x504966){rimraf(path['join'](_0x21977a,_0x1bfe83),function(){});_0xacc374(_0xa70b('0x24'));});});}})[_0xa70b('0x10')](function(){logger['info'](util[_0xa70b('0xa')](_0xa70b('0x25'),EXTRACTED_REPORT_ID,_0xa70b('0xc')));return analyticExtractedReport(_0xa70b('0x26'),_0x37b3ad?util[_0xa70b('0xa')](_0xa70b('0x21'),_0x1bfe83,_0x37b3ad?_0xa70b('0x23'):'xlsx'):null);});})[_0xa70b('0x27')](function(_0x3d4bb6){logger[_0xa70b('0x9')](util[_0xa70b('0xa')](_0xa70b('0x28'),EXTRACTED_REPORT_ID,_0xa70b('0xc')),util[_0xa70b('0x29')](_0x3d4bb6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa70b('0x2a'));})[_0xa70b('0x2b')](function(){process[_0xa70b('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c9f059f..47587ba 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 _0xb53a=['find','push','type','format','CDR(type)=%s','context','inbound','Set','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','catch','lodash','util','models','then','VoiceExtension','findAll','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0xb53a,0x18d));var _0xab53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb53a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab53('0x0'));var util=require(_0xab53('0x1'));function rewrite(_0x5a89a0,_0x13f9cf){var _0x588e09=this;return _0x5a89a0[_0xab53('0x2')]['Interval']['findAll']({'raw':!![]})[_0xab53('0x3')](function(_0x5484df){_0x588e09['intervals']=_0x5484df;return _0x5a89a0[_0xab53('0x2')][_0xab53('0x4')][_0xab53('0x5')]({'where':{'IntervalId':_0x13f9cf[_0xab53('0x6')]},'raw':!![]});})['then'](function(_0xd0fa28){return _0x5a89a0[_0xab53('0x2')]['VoiceExtension'][_0xab53('0x5')]({'where':{'exten':{'$in':_['uniq'](_[_0xab53('0x7')](_0xd0fa28,_0xab53('0x8')))}},'order':[{'raw':_0xab53('0x9')}],'raw':!![]});})[_0xab53('0x3')](function(_0x1c89b8){var _0x202c7c=_[_0xab53('0xa')](_0x1c89b8,{'priority':'1'});var _0x2f9e21=_[_0xab53('0xa')](_0x1c89b8,{'isApp':0x1});var _0x37d3c5=_[_0xab53('0xb')](_0x2f9e21,_0xab53('0x8'));var _0x5c2288=['queue',_0xab53('0xc')];var _0x476f1f=[];var _0x5529a9=[];for(var _0x5ee33d in _0x37d3c5){if(_0x37d3c5[_0xab53('0xd')](_0x5ee33d)){_0x588e09[_0xab53('0xe')]=0x2;_0x588e09[_0xab53('0xf')]=[];_0x588e09[_0xab53('0x10')]=_[_0xab53('0x11')](_0x202c7c,{'exten':_0x37d3c5[_0x5ee33d][0x0]['exten']});_0x588e09[_0xab53('0xf')][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':'Set','appdata':util[_0xab53('0x14')](_0xab53('0x15'),_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')]),'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0]['exten'],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0]['VoiceExtensionId']});if(_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')]===_0xab53('0x17')){_0x588e09['extensions'][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x19')+_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')],'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x8')],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});}else if(_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')]===_0xab53('0x1b')){if(_0x588e09['extension']){_0x588e09[_0xab53('0xf')]['push']({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':'CDR(destination)='+(_0x588e09[_0xab53('0x10')][_0xab53('0x1c')]?'${EXTEN:'+_0x588e09[_0xab53('0x10')][_0xab53('0x1c')]+'}':_0xab53('0x1d')),'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0]['exten'],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0]['VoiceExtensionId']});}_0x588e09[_0xab53('0xf')][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x19')+_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')],'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x8')],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0]['VoiceExtensionId']});var _0x4cbd22=_0x588e09[_0xab53('0xe')]++;_0x588e09['extensions'][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':'ExecIf','appdata':_0xab53('0x1e')+(_0x4cbd22+0x2)+_0xab53('0x1f')+(_0x4cbd22+0x1)+')','context':_0x37d3c5[_0x5ee33d][0x0]['context'],'exten':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x8')],'priority':_0x4cbd22,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});if(_0x588e09[_0xab53('0x10')]){_0x588e09[_0xab53('0xf')][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0x588e09['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x588e09['extension'][_0xab53('0x1c')]+'}':_0xab53('0x20'),'context':_0x37d3c5[_0x5ee33d][0x0]['context'],'exten':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x8')],'priority':_0x588e09['priority']++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});}_0x588e09[_0xab53('0xf')][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0]['type'],'app':'Set','appdata':_0xab53('0x21')+_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')],'context':_0x37d3c5[_0x5ee33d][0x0]['context'],'exten':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x8')],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});if(_0x588e09[_0xab53('0x10')]&&_0x588e09[_0xab53('0x10')][_0xab53('0xd')](_0xab53('0x22'))&&_0x588e09[_0xab53('0x10')]['recordingFormat']!==_0xab53('0x23')){_0x588e09[_0xab53('0xf')]['push']({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0]['exten'],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});_0x588e09[_0xab53('0xf')][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x24')+_0x588e09['extension'][_0xab53('0x22')]||'wav','context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x8')],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});}}_0x588e09['extensions'][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x25'),'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0]['exten'],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});_0x588e09[_0xab53('0xf')][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x26'),'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0]['exten'],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0]['VoiceExtensionId']});_0x588e09['extensions'][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':'Set','appdata':_0xab53('0x27'),'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'exten':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x8')],'priority':_0x588e09[_0xab53('0xe')]++,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0]['VoiceExtensionId']});for(var _0x1051ea=0x0,_0x1f2015=0x0;_0x1051ea<_0x37d3c5[_0x5ee33d][_0xab53('0x28')];_0x1051ea+=0x1,_0x1f2015=0x0){var _0x421468=_0x37d3c5[_0x5ee33d][_0x1051ea];if(_0x421468[_0xab53('0x13')]){_0x421468[_0xab53('0x13')]=_0x421468['type'][_0xab53('0x29')]();}var _0xc16139=[];var _0x369d21=[];delete _0x421468['id'];delete _0x421468[_0xab53('0x2a')];delete _0x421468[_0xab53('0x2b')];var _0x8a5958=_0x421468[_0xab53('0x2c')]!==_0xab53('0x2d')?[_0x421468[_0xab53('0x2c')]]:_0x421468['IntervalId']?_[_0xab53('0x7')](_[_0xab53('0xa')](_0x588e09['intervals'],{'IntervalId':_0x421468[_0xab53('0x6')]}),_0xab53('0x2c')):[];if(_0x421468['hasOwnProperty'](_0xab53('0x2e'))){if(_0x421468['tag']&&_0x421468[_0xab53('0x2e')]!=='--'){_0xc16139[_0xab53('0x12')]({'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x2f')+_0x421468[_0xab53('0x2e')],'context':_0x421468[_0xab53('0x16')],'exten':_0x421468[_0xab53('0x8')],'priority':_0x8a5958[_0xab53('0x28')]+_0x588e09[_0xab53('0xe')]+_0x1f2015++,'VoiceExtensionId':_0x421468['VoiceExtensionId']});}}if(_0x421468[_0xab53('0x13')]===_0xab53('0x1b')&&_0x421468[_0xab53('0xd')](_0xab53('0x30'))){if(_0x421468[_0xab53('0x30')]){_0xc16139[_0xab53('0x12')]({'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x31'),'appdata':_0xab53('0x32')+_0x421468[_0xab53('0x30')]+')','context':_0x421468[_0xab53('0x16')],'exten':_0x421468[_0xab53('0x8')],'priority':_0x8a5958[_0xab53('0x28')]+_0x588e09[_0xab53('0xe')]+_0x1f2015++,'VoiceExtensionId':_0x421468[_0xab53('0x1a')]});}else{_0xc16139['push']({'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x31'),'appdata':_0xab53('0x33'),'context':_0x421468['context'],'exten':_0x421468[_0xab53('0x8')],'priority':_0x8a5958['length']+_0x588e09[_0xab53('0xe')]+_0x1f2015++,'VoiceExtensionId':_0x421468[_0xab53('0x1a')]});}}if(_0x421468[_0xab53('0xd')](_0xab53('0x34'))){if(_0x5c2288[_0xab53('0x35')](_0x421468[_0xab53('0x36')]['toLowerCase']())>=0x0&&_0x421468[_0xab53('0x37')]!==_0xab53('0x38')){if(_0x421468['answer']){_0xc16139[_0xab53('0x12')]({'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x31'),'appdata':_0xab53('0x39'),'context':_0x421468[_0xab53('0x16')],'exten':_0x421468['exten'],'priority':_0x8a5958[_0xab53('0x28')]+_0x588e09[_0xab53('0xe')]+_0x1f2015++,'VoiceExtensionId':_0x421468[_0xab53('0x1a')]});_0xc16139[_0xab53('0x12')]({'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x3a'),'context':_0x421468[_0xab53('0x16')],'exten':_0x421468[_0xab53('0x8')],'priority':_0x8a5958[_0xab53('0x28')]+_0x588e09[_0xab53('0xe')]+_0x1f2015++,'VoiceExtensionId':_0x421468[_0xab53('0x1a')]});}else{_0xc16139['push']({'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x31'),'appdata':_0xab53('0x3b'),'context':_0x421468['context'],'exten':_0x421468[_0xab53('0x8')],'priority':_0x8a5958[_0xab53('0x28')]+_0x588e09[_0xab53('0xe')]+_0x1f2015++,'VoiceExtensionId':_0x421468[_0xab53('0x1a')]});_0xc16139[_0xab53('0x12')]({'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x18'),'appdata':_0xab53('0x3c'),'context':_0x421468['context'],'exten':_0x421468['exten'],'priority':_0x8a5958[_0xab53('0x28')]+_0x588e09[_0xab53('0xe')]+_0x1f2015++,'VoiceExtensionId':_0x421468[_0xab53('0x1a')]});}}}for(var _0x6e3e27=0x0;_0x6e3e27<_0x8a5958[_0xab53('0x28')];_0x6e3e27+=0x1){var _0x220b3e=_0x588e09[_0xab53('0xe')]+_0x8a5958[_0xab53('0x28')];var _0x122322=_0x6e3e27===_0x8a5958[_0xab53('0x28')]-0x1?_0x588e09['priority']+_0xc16139[_0xab53('0x28')]+_0x369d21[_0xab53('0x28')]+0x2:_0x588e09[_0xab53('0xe')]+_0x6e3e27+0x1;_0xc16139[_0xab53('0x3d')](_0x6e3e27,0x0,{'type':_0x421468[_0xab53('0x13')],'app':_0xab53('0x3e'),'appdata':_0x8a5958[_0x6e3e27]+'?'+_0x421468[_0xab53('0x16')]+_0xab53('0x3f')+_0x220b3e+':'+_0x421468[_0xab53('0x16')]+_0xab53('0x3f')+_0x122322,'exten':_0x421468['exten'],'context':_0x421468['context'],'priority':_0x588e09[_0xab53('0xe')]+_0x6e3e27,'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});}_0x421468[_0xab53('0xe')]=_0xc16139[_0xab53('0x28')]?_['last'](_0xc16139)['priority']+0x1:_0x588e09[_0xab53('0xe')];_0x588e09['priority']=(_0x369d21[_0xab53('0x28')]?_[_0xab53('0x40')](_0x369d21)[_0xab53('0xe')]:_0x421468[_0xab53('0xe')])+0x1;_0x588e09[_0xab53('0xf')]=_[_0xab53('0x41')](_0x588e09['extensions'],_0xc16139,[_0x421468],_0x369d21);}_0x588e09[_0xab53('0xf')][_0xab53('0x12')]({'type':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x13')],'app':_0xab53('0x42'),'exten':_0x37d3c5[_0x5ee33d][0x0]['exten'],'context':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x16')],'priority':_0x588e09[_0xab53('0xe')],'VoiceExtensionId':_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]});_0x476f1f[_0xab53('0x12')](_0x37d3c5[_0x5ee33d][0x0][_0xab53('0x1a')]);_0x5529a9=_[_0xab53('0x41')](_0x5529a9,_0x588e09[_0xab53('0xf')]);}}return _0x5a89a0[_0xab53('0x43')](function(_0x3f3106){return _0x5a89a0[_0xab53('0x2')][_0xab53('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x476f1f}},'transaction':_0x3f3106})['then'](function(_0x42ca52){return _0x5a89a0['models'][_0xab53('0x4')]['bulkCreate'](_['sortBy'](_0x5529a9,_0xab53('0xe')),{'transaction':_0x3f3106});});});})[_0xab53('0x44')](function(_0x22f2a3){console['error'](_0x22f2a3);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x0dbd=['playback','priority','find','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','extensions','CDR(destination)=','extension','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','models','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','filter'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0dbd,0x1cb));var _0xd0db=function(_0x53cd9f,_0xac8289){_0x53cd9f=_0x53cd9f-0x0;var _0x3cab9e=_0x0dbd[_0x53cd9f];return _0x3cab9e;};'use strict';var _=require(_0xd0db('0x0'));var util=require('util');function rewrite(_0x43a1b6,_0x27266c){var _0xf9f470=this;return _0x43a1b6[_0xd0db('0x1')]['Interval'][_0xd0db('0x2')]({'raw':!![]})[_0xd0db('0x3')](function(_0xcaba30){_0xf9f470['intervals']=_0xcaba30;return _0x43a1b6[_0xd0db('0x1')][_0xd0db('0x4')][_0xd0db('0x2')]({'where':{'IntervalId':_0x27266c[_0xd0db('0x5')]},'raw':!![]});})['then'](function(_0xe7828a){return _0x43a1b6[_0xd0db('0x1')][_0xd0db('0x4')][_0xd0db('0x2')]({'where':{'exten':{'$in':_[_0xd0db('0x6')](_[_0xd0db('0x7')](_0xe7828a,_0xd0db('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xd0db('0x3')](function(_0x1ab2f0){var _0x2118f1=_[_0xd0db('0x9')](_0x1ab2f0,{'priority':'1'});var _0x338a7b=_['filter'](_0x1ab2f0,{'isApp':0x1});var _0x5735d7=_['groupBy'](_0x338a7b,_0xd0db('0x8'));var _0x47386a=['queue',_0xd0db('0xa')];var _0x200005=[];var _0x207a6f=[];for(var _0x1aa3cb in _0x5735d7){if(_0x5735d7['hasOwnProperty'](_0x1aa3cb)){_0xf9f470[_0xd0db('0xb')]=0x2;_0xf9f470['extensions']=[];_0xf9f470['extension']=_[_0xd0db('0xc')](_0x2118f1,{'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')]});_0xf9f470['extensions']['push']({'type':_0x5735d7[_0x1aa3cb][0x0]['type'],'app':_0xd0db('0xd'),'appdata':util[_0xd0db('0xe')](_0xd0db('0xf'),_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')]),'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470['priority']++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});if(_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')]===_0xd0db('0x13')){_0xf9f470['extensions'][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':_0xd0db('0xd'),'appdata':_0xd0db('0x15')+_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')],'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470['priority']++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});}else if(_0x5735d7[_0x1aa3cb][0x0]['type']===_0xd0db('0x16')){if(_0xf9f470['extension']){_0xf9f470[_0xd0db('0x17')][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0]['type'],'app':_0xd0db('0xd'),'appdata':_0xd0db('0x18')+(_0xf9f470[_0xd0db('0x19')][_0xd0db('0x1a')]?_0xd0db('0x1b')+_0xf9f470['extension'][_0xd0db('0x1a')]+'}':'${EXTEN}'),'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0]['exten'],'priority':_0xf9f470[_0xd0db('0xb')]++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0]['VoiceExtensionId']});}_0xf9f470[_0xd0db('0x17')]['push']({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':'Set','appdata':_0xd0db('0x15')+_0x5735d7[_0x1aa3cb][0x0]['VoiceExtensionId'],'context':_0x5735d7[_0x1aa3cb][0x0]['context'],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470[_0xd0db('0xb')]++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0]['VoiceExtensionId']});var _0x2d10d9=_0xf9f470[_0xd0db('0xb')]++;_0xf9f470[_0xd0db('0x17')][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':_0xd0db('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2d10d9+0x2)+_0xd0db('0x1d')+(_0x2d10d9+0x1)+')','context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0x2d10d9,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});if(_0xf9f470[_0xd0db('0x19')]){_0xf9f470['extensions'][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':'Set','appdata':_0xf9f470[_0xd0db('0x19')][_0xd0db('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0xf9f470[_0xd0db('0x19')][_0xd0db('0x1a')]+'}':_0xd0db('0x1e'),'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470[_0xd0db('0xb')]++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0]['VoiceExtensionId']});}_0xf9f470[_0xd0db('0x17')][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')],'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470[_0xd0db('0xb')]++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});if(_0xf9f470[_0xd0db('0x19')]&&_0xf9f470['extension'][_0xd0db('0x1f')](_0xd0db('0x20'))&&_0xf9f470[_0xd0db('0x19')][_0xd0db('0x20')]!==_0xd0db('0x21')){_0xf9f470[_0xd0db('0x17')][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':_0xd0db('0xd'),'appdata':_0xd0db('0x22'),'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470['priority']++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0]['VoiceExtensionId']});_0xf9f470['extensions']['push']({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':_0xd0db('0xd'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xf9f470[_0xd0db('0x19')][_0xd0db('0x20')]||_0xd0db('0x23'),'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470[_0xd0db('0xb')]++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});}}_0xf9f470[_0xd0db('0x17')][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':'Set','appdata':_0xd0db('0x24'),'context':_0x5735d7[_0x1aa3cb][0x0]['context'],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470['priority']++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});_0xf9f470[_0xd0db('0x17')][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0]['type'],'app':_0xd0db('0xd'),'appdata':_0xd0db('0x25'),'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470[_0xd0db('0xb')]++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});_0xf9f470[_0xd0db('0x17')]['push']({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':_0xd0db('0xd'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'priority':_0xf9f470['priority']++,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});for(var _0x5ae0cc=0x0,_0x44e6fd=0x0;_0x5ae0cc<_0x5735d7[_0x1aa3cb][_0xd0db('0x26')];_0x5ae0cc+=0x1,_0x44e6fd=0x0){var _0x268d72=_0x5735d7[_0x1aa3cb][_0x5ae0cc];if(_0x268d72[_0xd0db('0x10')]){_0x268d72[_0xd0db('0x10')]=_0x268d72[_0xd0db('0x10')][_0xd0db('0x27')]();}var _0x412215=[];var _0x282765=[];delete _0x268d72['id'];delete _0x268d72[_0xd0db('0x28')];delete _0x268d72['updatedAt'];var _0x2cfc04=_0x268d72[_0xd0db('0x29')]!==_0xd0db('0x2a')?[_0x268d72[_0xd0db('0x29')]]:_0x268d72['IntervalId']?_[_0xd0db('0x7')](_[_0xd0db('0x9')](_0xf9f470[_0xd0db('0x2b')],{'IntervalId':_0x268d72['IntervalId']}),_0xd0db('0x29')):[];if(_0x268d72[_0xd0db('0x1f')]('tag')){if(_0x268d72['tag']&&_0x268d72[_0xd0db('0x2c')]!=='--'){_0x412215['push']({'type':_0x268d72[_0xd0db('0x10')],'app':'Set','appdata':_0xd0db('0x2d')+_0x268d72[_0xd0db('0x2c')],'context':_0x268d72['context'],'exten':_0x268d72[_0xd0db('0x8')],'priority':_0x2cfc04[_0xd0db('0x26')]+_0xf9f470['priority']+_0x44e6fd++,'VoiceExtensionId':_0x268d72[_0xd0db('0x12')]});}}if(_0x268d72[_0xd0db('0x10')]===_0xd0db('0x16')&&_0x268d72[_0xd0db('0x1f')](_0xd0db('0x2e'))){if(_0x268d72[_0xd0db('0x2e')]){_0x412215[_0xd0db('0x14')]({'type':_0x268d72[_0xd0db('0x10')],'app':_0xd0db('0x1c'),'appdata':_0xd0db('0x2f')+_0x268d72[_0xd0db('0x2e')]+')','context':_0x268d72[_0xd0db('0x11')],'exten':_0x268d72[_0xd0db('0x8')],'priority':_0x2cfc04[_0xd0db('0x26')]+_0xf9f470[_0xd0db('0xb')]+_0x44e6fd++,'VoiceExtensionId':_0x268d72[_0xd0db('0x12')]});}else{_0x412215[_0xd0db('0x14')]({'type':_0x268d72[_0xd0db('0x10')],'app':_0xd0db('0x1c'),'appdata':_0xd0db('0x30'),'context':_0x268d72[_0xd0db('0x11')],'exten':_0x268d72['exten'],'priority':_0x2cfc04[_0xd0db('0x26')]+_0xf9f470['priority']+_0x44e6fd++,'VoiceExtensionId':_0x268d72[_0xd0db('0x12')]});}}if(_0x268d72['hasOwnProperty'](_0xd0db('0x31'))){if(_0x47386a[_0xd0db('0x32')](_0x268d72[_0xd0db('0x33')][_0xd0db('0x27')]())>=0x0&&_0x268d72[_0xd0db('0x34')]!==_0xd0db('0x35')){if(_0x268d72[_0xd0db('0x31')]){_0x412215[_0xd0db('0x14')]({'type':_0x268d72[_0xd0db('0x10')],'app':_0xd0db('0x1c'),'appdata':_0xd0db('0x36'),'context':_0x268d72[_0xd0db('0x11')],'exten':_0x268d72[_0xd0db('0x8')],'priority':_0x2cfc04['length']+_0xf9f470['priority']+_0x44e6fd++,'VoiceExtensionId':_0x268d72[_0xd0db('0x12')]});_0x412215[_0xd0db('0x14')]({'type':_0x268d72[_0xd0db('0x10')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x268d72[_0xd0db('0x11')],'exten':_0x268d72['exten'],'priority':_0x2cfc04['length']+_0xf9f470[_0xd0db('0xb')]+_0x44e6fd++,'VoiceExtensionId':_0x268d72[_0xd0db('0x12')]});}else{_0x412215[_0xd0db('0x14')]({'type':_0x268d72[_0xd0db('0x10')],'app':_0xd0db('0x1c'),'appdata':_0xd0db('0x37'),'context':_0x268d72[_0xd0db('0x11')],'exten':_0x268d72[_0xd0db('0x8')],'priority':_0x2cfc04[_0xd0db('0x26')]+_0xf9f470[_0xd0db('0xb')]+_0x44e6fd++,'VoiceExtensionId':_0x268d72[_0xd0db('0x12')]});_0x412215[_0xd0db('0x14')]({'type':_0x268d72[_0xd0db('0x10')],'app':_0xd0db('0xd'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x268d72['context'],'exten':_0x268d72['exten'],'priority':_0x2cfc04['length']+_0xf9f470['priority']+_0x44e6fd++,'VoiceExtensionId':_0x268d72[_0xd0db('0x12')]});}}}for(var _0x3017e1=0x0;_0x3017e1<_0x2cfc04['length'];_0x3017e1+=0x1){var _0x25370e=_0xf9f470['priority']+_0x2cfc04[_0xd0db('0x26')];var _0x1105f5=_0x3017e1===_0x2cfc04[_0xd0db('0x26')]-0x1?_0xf9f470[_0xd0db('0xb')]+_0x412215[_0xd0db('0x26')]+_0x282765[_0xd0db('0x26')]+0x2:_0xf9f470[_0xd0db('0xb')]+_0x3017e1+0x1;_0x412215[_0xd0db('0x38')](_0x3017e1,0x0,{'type':_0x268d72[_0xd0db('0x10')],'app':'GotoIfTime','appdata':_0x2cfc04[_0x3017e1]+'?'+_0x268d72[_0xd0db('0x11')]+',${EXTEN},'+_0x25370e+':'+_0x268d72[_0xd0db('0x11')]+_0xd0db('0x39')+_0x1105f5,'exten':_0x268d72[_0xd0db('0x8')],'context':_0x268d72[_0xd0db('0x11')],'priority':_0xf9f470[_0xd0db('0xb')]+_0x3017e1,'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});}_0x268d72[_0xd0db('0xb')]=_0x412215[_0xd0db('0x26')]?_[_0xd0db('0x3a')](_0x412215)[_0xd0db('0xb')]+0x1:_0xf9f470[_0xd0db('0xb')];_0xf9f470[_0xd0db('0xb')]=(_0x282765['length']?_['last'](_0x282765)['priority']:_0x268d72[_0xd0db('0xb')])+0x1;_0xf9f470[_0xd0db('0x17')]=_[_0xd0db('0x3b')](_0xf9f470[_0xd0db('0x17')],_0x412215,[_0x268d72],_0x282765);}_0xf9f470[_0xd0db('0x17')][_0xd0db('0x14')]({'type':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x10')],'app':_0xd0db('0x3c'),'exten':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x8')],'context':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x11')],'priority':_0xf9f470[_0xd0db('0xb')],'VoiceExtensionId':_0x5735d7[_0x1aa3cb][0x0][_0xd0db('0x12')]});_0x200005[_0xd0db('0x14')](_0x5735d7[_0x1aa3cb][0x0]['VoiceExtensionId']);_0x207a6f=_[_0xd0db('0x3b')](_0x207a6f,_0xf9f470[_0xd0db('0x17')]);}}return _0x43a1b6[_0xd0db('0x3d')](function(_0x1b8a42){return _0x43a1b6[_0xd0db('0x1')][_0xd0db('0x4')][_0xd0db('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x200005}},'transaction':_0x1b8a42})[_0xd0db('0x3')](function(_0xb0a254){return _0x43a1b6[_0xd0db('0x1')]['VoiceExtension'][_0xd0db('0x3f')](_['sortBy'](_0x207a6f,'priority'),{'transaction':_0x1b8a42});});});})[_0xd0db('0x40')](function(_0x5ba373){console[_0xd0db('0x41')](_0x5ba373);});}exports[_0xd0db('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 2629a04..376d5a0 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 _0x3435=['phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','insert','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','get','always','sequelize','VoiceQueueId','onlyIfOpen','push','query','all','CmList','BlackLists','Lists','CampaignId','generalCheckHopper','emit','contact:csv_','resolve','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL'];(function(_0x3ed8bc,_0x13b967){var _0x3ca73f=function(_0x1167e4){while(--_0x1167e4){_0x3ed8bc['push'](_0x3ed8bc['shift']());}};_0x3ca73f(++_0x13b967);}(_0x3435,0x1c1));var _0x5343=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x3435[_0x580647];return _0x5f0792;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x5343('0x0'));var fs=require('fs');var squel=require(_0x5343('0x1'));var Papa=require(_0x5343('0x2'));var Redis=require(_0x5343('0x3'));var db=require(_0x5343('0x4'))['db'];var config=require(_0x5343('0x5'));var logger=require(_0x5343('0x6'))(_0x5343('0x7'));config[_0x5343('0x8')]=_['defaults'](config[_0x5343('0x8')],{'host':_0x5343('0x9'),'port':0x18eb});var socket=require(_0x5343('0xa'))(new Redis(config[_0x5343('0x8')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x5343('0xb')][0x2]||process['argv'][0x2]===_0x5343('0xc')||process[_0x5343('0xb')][0x2]===_0x5343('0xd')){throw new Error(_0x5343('0xe'));}var FILEPATH=process[_0x5343('0xb')][0x2];if(!process[_0x5343('0xb')][0x3]||process[_0x5343('0xb')][0x3]===_0x5343('0xc')||process[_0x5343('0xb')][0x3]===_0x5343('0xd')||!process[_0x5343('0xb')][0x4]||process[_0x5343('0xb')][0x4]===_0x5343('0xc')||process[_0x5343('0xb')][0x4]===_0x5343('0xd')){throw new Error(_0x5343('0xf'));}var FIELDS=_['zipObject'](process[_0x5343('0xb')][0x3][_0x5343('0x10')](','),process[_0x5343('0xb')][0x4][_0x5343('0x10')](','));if(!process[_0x5343('0xb')][0x5]||process[_0x5343('0xb')][0x5]===_0x5343('0xc')||process[_0x5343('0xb')][0x5]===_0x5343('0xd')){throw new Error(_0x5343('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x5343('0xb')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x5343('0xd')?process[_0x5343('0xb')][0x6]:null;var DUPLICATES=process[_0x5343('0xb')][0x7]&&process[_0x5343('0xb')][0x7]!==_0x5343('0xc')&&process[_0x5343('0xb')][0x7]!=='null'?process[_0x5343('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0x5343('0xb')][0x8]===_0x5343('0xc')||process[_0x5343('0xb')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x5343('0xb')][0x8];}catch(_0x39d856){logger[_0x5343('0x12')](_0x39d856);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(_0x4dce14,_0x30d875,_0x35e386,_0x103d28){var _0x36d0fb={'message':_0x30d875};_0x36d0fb[_0x4dce14]=!![];if(_0x35e386){_0x36d0fb[_0x5343('0x13')]=_0x35e386;}if(_0x103d28){_0x36d0fb[_0x5343('0x14')]=_0x103d28;}return _0x36d0fb;}function isEmail(_0x3d81a0){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'](_0x3d81a0);}function checkRow(_0x139bc8,_0x38b102,_0x2b8fd1){return new BPromise(function(_0x26e58f,_0xf219bd){if(_[_0x5343('0x15')](_0x139bc8)){return _0xf219bd(handleCheckRowError(_0x5343('0x12'),_0x5343('0x16'),null,_0x2b8fd1));}if(_0x139bc8[_0x5343('0x17')]&&_0x139bc8[_0x5343('0x17')][_0x5343('0x18')]){var _0xe689cf=_[_0x5343('0x19')](_0x139bc8[_0x5343('0x17')],_0x5343('0x1a'))['join'](';');return _0xf219bd(handleCheckRowError('error',_0xe689cf,null,_0x2b8fd1));}var _0x1c3189={};for(var _0xfe0cd0 in FIELDS){if(FIELDS[_0x5343('0x1b')](_0xfe0cd0)&&FIELDS[_0xfe0cd0]){_0x1c3189[_0xfe0cd0]=_0x139bc8['data'][0x0][FIELDS[_0xfe0cd0]]||_0x139bc8[_0x5343('0x1c')][0x0]['\ufeff'+FIELDS[_0xfe0cd0]];}}if(!_0x1c3189['firstName']){return _0xf219bd(handleCheckRowError(_0x5343('0x12'),_0x5343('0x1d'),null,_0x2b8fd1));}if(!_0x1c3189[_0x5343('0x1e')]){return _0xf219bd(handleCheckRowError('error',_0x5343('0x1f'),null,_0x2b8fd1));}if(_0x1c3189[_0x5343('0x20')]){var _0x353b6c=moment(_0x1c3189['birthDate'],_0x5343('0x21'));if(!_0x353b6c[_0x5343('0x22')]()){return _0xf219bd(handleCheckRowError(_0x5343('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2b8fd1));}}if(_0x1c3189[_0x5343('0x23')]){if(!isEmail(_0x1c3189['email'])){return _0xf219bd(handleCheckRowError('error',_0x5343('0x24'),null,_0x2b8fd1));}}_0x1c3189[_0x5343('0x25')]=LISTID;_0x1c3189[_0x5343('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5343('0x18')]&&_0x38b102){var _0x32985a={};for(var _0x14437f=0x0,_0x26af79=DUPLICATES[_0x5343('0x18')];_0x14437f<_0x26af79;_0x14437f+=0x1){_0x32985a[DUPLICATES[_0x14437f]]=_0x1c3189[DUPLICATES[_0x14437f]];}var _0xd0713=_['find'](_0x38b102,_0x32985a);if(_0xd0713){return _0xf219bd(handleCheckRowError('duplicate',_0x5343('0x27'),_0xd0713,_0x2b8fd1));}}return db[_0x5343('0x28')][_0x5343('0x29')](_0x1c3189,{'raw':!![],'hooks':![],'fields':_[_0x5343('0x2a')](_0x1c3189)})[_0x5343('0x2b')](function(_0x23259c){if(DUPLICATES&&DUPLICATES[_0x5343('0x18')]&&_0x38b102){_0x38b102['push'](_['pick'](_0x1c3189,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x23259c['id'];return _0x26e58f();})[_0x5343('0x2c')](function(_0x350552){return _0xf219bd(handleCheckRowError(_0x5343('0x12'),_0x5343('0x2d')+(_0x350552[_0x5343('0x1a')]||JSON[_0x5343('0x2e')](_0x350552)),null,_0x2b8fd1));});});}function checkHopper(){function _0x444f02(){return function(_0x4ae464){logger['error'](_0x5343('0x2f'),'checkHopper',util[_0x5343('0x30')](_0x4ae464,{'showHidden':![],'depth':null}));};}var _0x5adf06=function(_0x4a2c14,_0x1adb9a){var _0x3e0728=squel['insert']()[_0x5343('0x31')](_0x5343('0x32'))[_0x5343('0x33')]([_0x5343('0x1e'),_0x5343('0x34'),_0x5343('0x35'),'ListId',_0x1adb9a,_0x5343('0x36'),_0x5343('0x37')],squel[_0x5343('0x38')]()['field']('phone','phone')['field']('NOW()',_0x5343('0x34'))[_0x5343('0x39')]('id',_0x5343('0x35'))[_0x5343('0x39')](LISTID[_0x5343('0x3a')](),'ListId')[_0x5343('0x39')](_0x4a2c14['id']['toString'](),_0x1adb9a)[_0x5343('0x39')](_0x5343('0x3b'),'createdAt')[_0x5343('0x39')]('NOW()','updatedAt')[_0x5343('0x3c')](_0x5343('0x3d'))[_0x5343('0x3e')](_0x5343('0x3f'))[_0x5343('0x3e')](_0x5343('0x40'),LISTID[_0x5343('0x3a')]())[_0x5343('0x3e')](_0x5343('0x41'))[_0x5343('0x3e')](_0x5343('0x42'),squel['select']()[_0x5343('0x39')](_0x5343('0x1e'))[_0x5343('0x3c')](_0x5343('0x32'))[_0x5343('0x3e')](_0x1adb9a+_0x5343('0x43'),_0x4a2c14['id'][_0x5343('0x3a')]())))[_0x5343('0x3a')]();return _0x3e0728;};var _0x3429a3=function(_0x13a453,_0x132fe7){var _0x1a7aac=squel['insert']()[_0x5343('0x31')](_0x5343('0x32'))[_0x5343('0x33')]([_0x5343('0x1e'),'scheduledAt','ContactId',_0x5343('0x25'),_0x132fe7,_0x5343('0x36'),'updatedAt'],squel[_0x5343('0x38')]()[_0x5343('0x39')]('phone',_0x5343('0x1e'))[_0x5343('0x39')](_0x5343('0x3b'),_0x5343('0x34'))['field']('id',_0x5343('0x35'))[_0x5343('0x39')](LISTID[_0x5343('0x3a')](),'ListId')['field'](_0x13a453['id']['toString'](),_0x132fe7)[_0x5343('0x39')](_0x5343('0x3b'),_0x5343('0x36'))[_0x5343('0x39')](_0x5343('0x3b'),_0x5343('0x37'))['from'](_0x5343('0x3d'))[_0x5343('0x3e')](_0x5343('0x3f'))[_0x5343('0x3e')](_0x5343('0x40'),LISTID['toString']())[_0x5343('0x3e')](_0x5343('0x44'),squel[_0x5343('0x45')](hopperContacts))[_0x5343('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x5343('0x42'),squel[_0x5343('0x38')]()[_0x5343('0x39')]('calleridnum')[_0x5343('0x3c')](_0x5343('0x46'))[_0x5343('0x3e')](_0x132fe7+_0x5343('0x43'),_0x13a453['id'][_0x5343('0x3a')]()))[_0x5343('0x3e')](_0x5343('0x42'),squel[_0x5343('0x38')]()[_0x5343('0x39')](_0x5343('0x1e'))[_0x5343('0x3c')](_0x5343('0x32'))[_0x5343('0x3e')](_0x132fe7+_0x5343('0x43'),_0x13a453['id'][_0x5343('0x3a')]())))[_0x5343('0x3a')]();return _0x1a7aac;};function _0x596a07(_0xe86c94,_0x3ae451){var _0x339d4f=squel[_0x5343('0x47')]()[_0x5343('0x31')](_0x5343('0x32'))['fromQuery']([_0x5343('0x1e'),'scheduledAt',_0x5343('0x35'),_0x5343('0x25'),_0x3ae451,'createdAt',_0x5343('0x37')],squel[_0x5343('0x38')]()[_0x5343('0x39')](_0x5343('0x1e'),_0x5343('0x1e'))['field'](_0x5343('0x3b'),_0x5343('0x34'))[_0x5343('0x39')]('id','ContactId')['field'](LISTID['toString'](),'ListId')[_0x5343('0x39')](_0xe86c94['id'][_0x5343('0x3a')](),_0x3ae451)[_0x5343('0x39')](_0x5343('0x3b'),_0x5343('0x36'))[_0x5343('0x39')](_0x5343('0x3b'),_0x5343('0x37'))[_0x5343('0x3c')](_0x5343('0x3d'))[_0x5343('0x3e')]('deletedAt\x20IS\x20NULL')[_0x5343('0x3e')](_0x5343('0x40'),LISTID[_0x5343('0x3a')]())[_0x5343('0x3e')](_0x5343('0x44'),squel[_0x5343('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5343('0x3a')]();return _0x339d4f;}function _0x48794f(_0x4dd2eb,_0x11f44c){var _0x4ffc82=squel[_0x5343('0x47')]()[_0x5343('0x31')](_0x5343('0x48'))['fromQuery']([_0x5343('0x1e'),_0x5343('0x35'),'ListId',_0x11f44c,_0x5343('0x36'),'updatedAt'],squel['select']()['field'](_0x5343('0x1e'),_0x5343('0x1e'))[_0x5343('0x39')]('id','ContactId')['field'](LISTID['toString'](),'ListId')[_0x5343('0x39')](_0x4dd2eb['id'][_0x5343('0x3a')](),_0x11f44c)[_0x5343('0x39')]('NOW()',_0x5343('0x36'))[_0x5343('0x39')](_0x5343('0x3b'),_0x5343('0x37'))[_0x5343('0x3c')](_0x5343('0x3d'))['where'](_0x5343('0x3f'))[_0x5343('0x3e')]('ListId\x20=\x20?',LISTID[_0x5343('0x3a')]())['where'](_0x5343('0x44'),squel[_0x5343('0x45')](hopperContacts))[_0x5343('0x3e')](_0x5343('0x41')))[_0x5343('0x3a')]();return _0x4ffc82;}return db[_0x5343('0x49')][_0x5343('0x4a')]({'where':{'type':_0x5343('0x4b')},'attributes':['id',_0x5343('0x4c')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x5343('0x2b')](function(_0x525665){var _0x19a2f1=[];if(_0x525665){var _0x43b9a1;for(var _0x18fe30=0x0,_0x30a1f7;_0x18fe30<_0x525665[_0x5343('0x18')];_0x18fe30+=0x1){_0x30a1f7=_0x525665[_0x18fe30][_0x5343('0x4d')]({'plain':!![]});switch(_0x30a1f7['dialCheckDuplicateType']){case _0x5343('0x4e'):_0x19a2f1['push'](db[_0x5343('0x4f')]['query'](_0x3429a3(_0x30a1f7,_0x5343('0x50')))[_0x5343('0x2b')](function(){})[_0x5343('0x2c')](_0x444f02()));break;case _0x5343('0x51'):_0x19a2f1[_0x5343('0x52')](db[_0x5343('0x4f')][_0x5343('0x53')](_0x5adf06(_0x30a1f7,'VoiceQueueId'))['then'](function(){})['catch'](_0x444f02()));break;default:_0x19a2f1[_0x5343('0x52')](db['sequelize'][_0x5343('0x53')](_0x596a07(_0x30a1f7,_0x5343('0x50')))[_0x5343('0x2b')](function(){})[_0x5343('0x2c')](_0x444f02()));}}}return _0x19a2f1;})[_0x5343('0x54')]()[_0x5343('0x2b')](function(){return db[_0x5343('0x49')][_0x5343('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x5343('0x55')],'as':_0x5343('0x56'),'where':{'id':LISTID}}]})[_0x5343('0x2b')](function(_0x5ecd84){var _0x41fa0b=[];if(_0x5ecd84){var _0x1496a8;for(var _0x37ef4a=0x0,_0xa1f8b7;_0x37ef4a<_0x5ecd84[_0x5343('0x18')];_0x37ef4a+=0x1){_0xa1f8b7=_0x5ecd84[_0x37ef4a][_0x5343('0x4d')]({'plain':!![]});_0x41fa0b[_0x5343('0x52')](db['sequelize'][_0x5343('0x53')](_0x48794f(_0xa1f8b7,_0x5343('0x50')))[_0x5343('0x2b')](function(){})['catch'](_0x444f02()));}}return _0x41fa0b;})['all']();})['then'](function(){return db['Campaign'][_0x5343('0x4a')]({'attributes':['id',_0x5343('0x4c')],'include':[{'model':db[_0x5343('0x55')],'as':_0x5343('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x264322){var _0x3e47c2=[];if(_0x264322){for(var _0x44fa8d=0x0,_0x4004f7;_0x44fa8d<_0x264322['length'];_0x44fa8d+=0x1){_0x4004f7=_0x264322[_0x44fa8d][_0x5343('0x4d')]({'plain':!![]});switch(_0x4004f7[_0x5343('0x4c')]){case _0x5343('0x4e'):_0x3e47c2[_0x5343('0x52')](db[_0x5343('0x4f')]['query'](_0x3429a3(_0x4004f7,_0x5343('0x58')))[_0x5343('0x2b')](function(){})[_0x5343('0x2c')](_0x444f02()));break;case _0x5343('0x51'):_0x3e47c2[_0x5343('0x52')](db[_0x5343('0x4f')][_0x5343('0x53')](_0x5adf06(_0x4004f7,_0x5343('0x58')))[_0x5343('0x2b')](function(){})[_0x5343('0x2c')](_0x444f02()));break;default:_0x3e47c2[_0x5343('0x52')](db[_0x5343('0x4f')][_0x5343('0x53')](_0x596a07(_0x4004f7,_0x5343('0x58')))['then'](function(){})[_0x5343('0x2c')](_0x444f02()));}}}return _0x3e47c2;})[_0x5343('0x54')]();})[_0x5343('0x2b')](function(){return db['Campaign'][_0x5343('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x5343('0x55')],'as':_0x5343('0x56'),'where':{'id':LISTID}}]})[_0x5343('0x2b')](function(_0x1ea2d0){var _0x21b058=[];if(_0x1ea2d0){for(var _0x20abe5=0x0,_0x52f166;_0x20abe5<_0x1ea2d0[_0x5343('0x18')];_0x20abe5+=0x1){_0x52f166=_0x1ea2d0[_0x20abe5]['get']({'plain':!![]});_0x21b058[_0x5343('0x52')](db[_0x5343('0x4f')][_0x5343('0x53')](_0x48794f(_0x52f166,_0x5343('0x58')))[_0x5343('0x2b')](function(){})[_0x5343('0x2c')](_0x444f02()));}}return _0x21b058;})[_0x5343('0x54')]();})[_0x5343('0x2c')](function(_0x1472e7){logger[_0x5343('0x12')]('cmContact,\x20%s,\x20%s',_0x5343('0x59'),_0x1472e7['message']);});}var processPromises=function(_0x38d9f0){return BPromise[_0x5343('0x54')](promises)[_0x5343('0x2b')](function(_0x31d70b){})[_0x5343('0x2c')](function(_0x419cd1){logger[_0x5343('0x12')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x419cd1));})['finally'](function(){socket[_0x5343('0x5a')](_0x5343('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x38d9f0){return _0x38d9f0['resume']();}});};var endCsv=function(){return BPromise[_0x5343('0x5c')]()[_0x5343('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x5343('0x2b')](function(){socket[_0x5343('0x5a')](_0x5343('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5343('0x5d')](FILEPATH);}catch(_0x24c175){logger[_0x5343('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x5343('0x2e')](_0x24c175));}finally{process[_0x5343('0x5e')](0x0);}});};process['on']('SIGINT',function(){logger[_0x5343('0x5f')](_0x5343('0x60'));endCsv();});function main(){return BPromise[_0x5343('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5343('0x10')](',');return db['CmContact'][_0x5343('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5343('0x2b')](function(_0x4615f3){var _0xad9594=fs[_0x5343('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5343('0x62')](_0xad9594,{'header':!![],'skipEmptyLines':!![],'step':function(_0x42a2a5,_0x43ebc9){total+=0x1;var _0x324ef5=total;promises[_0x5343('0x52')](checkRow(_0x42a2a5,_0x4615f3,_0x324ef5)['then'](function(){success+=0x1;})[_0x5343('0x2c')](function(_0x294e9a){if(_0x294e9a[_0x5343('0x12')]){errors+=0x1;delete _0x294e9a[_0x5343('0x12')];}else if(_0x294e9a['duplicate']){duplicates+=0x1;delete _0x294e9a[_0x5343('0x63')];}rows[_0x5343('0x52')](_0x294e9a);}));if(total%0xc8===0x0){_0x43ebc9[_0x5343('0x64')]();return processPromises(_0x43ebc9);}},'complete':function(){return processPromises()[_0x5343('0x2b')](function(){logger[_0x5343('0x5f')](_0x5343('0x65'));endCsv();});},'error':function(_0x3ba814,_0x25b6c2){logger['info']('CSV\x20parse\x20error',JSON[_0x5343('0x2e')](_0x3ba814));endCsv();}});})[_0x5343('0x2c')](function(_0x38c8ff){logger[_0x5343('0x12')](_0x5343('0x66'),JSON[_0x5343('0x2e')](_0x38c8ff));});}main(); \ No newline at end of file +var _0x2354=['zipObject','split','error','isNil','errors','length','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','create','keys','pick','catch','stringify','cmContact','inspect','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','id\x20IN\x20?','str','calleridnum','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','push','sequelize','query','all','BlackLists','VoiceQueueId','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x2354,0x1ee));var _0x4235=function(_0x1283a1,_0x33679e){_0x1283a1=_0x1283a1-0x0;var _0x586af9=_0x2354[_0x1283a1];return _0x586af9;};'use strict';var BPromise=require(_0x4235('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x4235('0x1'));var Papa=require(_0x4235('0x2'));var Redis=require(_0x4235('0x3'));var db=require(_0x4235('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x4235('0x5'))('api');config[_0x4235('0x6')]=_[_0x4235('0x7')](config[_0x4235('0x6')],{'host':_0x4235('0x8'),'port':0x18eb});var socket=require(_0x4235('0x9'))(new Redis(config[_0x4235('0x6')]));require(_0x4235('0xa'))[_0x4235('0xb')](socket);try{if(!process[_0x4235('0xc')][0x2]||process[_0x4235('0xc')][0x2]===_0x4235('0xd')||process[_0x4235('0xc')][0x2]===_0x4235('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x4235('0xc')][0x3]||process[_0x4235('0xc')][0x3]==='undefined'||process[_0x4235('0xc')][0x3]===_0x4235('0xe')||!process[_0x4235('0xc')][0x4]||process[_0x4235('0xc')][0x4]===_0x4235('0xd')||process[_0x4235('0xc')][0x4]===_0x4235('0xe')){throw new Error(_0x4235('0xf'));}var FIELDS=_[_0x4235('0x10')](process[_0x4235('0xc')][0x3][_0x4235('0x11')](','),process[_0x4235('0xc')][0x4][_0x4235('0x11')](','));if(!process[_0x4235('0xc')][0x5]||process[_0x4235('0xc')][0x5]===_0x4235('0xd')||process[_0x4235('0xc')][0x5]===_0x4235('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x4235('0xc')][0x5];var COMPANYID=process[_0x4235('0xc')][0x6]&&process[_0x4235('0xc')][0x6]!==_0x4235('0xd')&&process['argv'][0x6]!==_0x4235('0xe')?process[_0x4235('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4235('0xc')][0x7]!==_0x4235('0xd')&&process['argv'][0x7]!==_0x4235('0xe')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x4235('0xc')][0x8]===_0x4235('0xd')||process[_0x4235('0xc')][0x8]===_0x4235('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x4235('0xc')][0x8];}catch(_0x51b3ac){logger[_0x4235('0x12')](_0x51b3ac);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(_0x13fc55,_0xb32971,_0xc2037c,_0x1a7c4c){var _0x22c944={'message':_0xb32971};_0x22c944[_0x13fc55]=!![];if(_0xc2037c){_0x22c944['contact']=_0xc2037c;}if(_0x1a7c4c){_0x22c944['index']=_0x1a7c4c;}return _0x22c944;}function isEmail(_0x39d422){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'](_0x39d422);}function checkRow(_0xd131b7,_0x602109,_0x3483ab){return new BPromise(function(_0x2d5be1,_0x38e067){if(_[_0x4235('0x13')](_0xd131b7)){return _0x38e067(handleCheckRowError(_0x4235('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3483ab));}if(_0xd131b7[_0x4235('0x14')]&&_0xd131b7[_0x4235('0x14')][_0x4235('0x15')]){var _0x3839e3=_['map'](_0xd131b7[_0x4235('0x14')],_0x4235('0x16'))['join'](';');return _0x38e067(handleCheckRowError(_0x4235('0x12'),_0x3839e3,null,_0x3483ab));}var _0x129a6f={};for(var _0x5ab8da in FIELDS){if(FIELDS[_0x4235('0x17')](_0x5ab8da)&&FIELDS[_0x5ab8da]){_0x129a6f[_0x5ab8da]=_0xd131b7['data'][0x0][FIELDS[_0x5ab8da]]||_0xd131b7[_0x4235('0x18')][0x0]['\ufeff'+FIELDS[_0x5ab8da]];}}if(!_0x129a6f[_0x4235('0x19')]){return _0x38e067(handleCheckRowError('error',_0x4235('0x1a'),null,_0x3483ab));}if(!_0x129a6f[_0x4235('0x1b')]){return _0x38e067(handleCheckRowError(_0x4235('0x12'),'phone\x20not\x20specified!',null,_0x3483ab));}if(_0x129a6f[_0x4235('0x1c')]){var _0x4e2cd0=moment(_0x129a6f[_0x4235('0x1c')],'YYYY-MM-DD');if(!_0x4e2cd0[_0x4235('0x1d')]()){return _0x38e067(handleCheckRowError('error',_0x4235('0x1e'),null,_0x3483ab));}}if(_0x129a6f[_0x4235('0x1f')]){if(!isEmail(_0x129a6f[_0x4235('0x1f')])){return _0x38e067(handleCheckRowError(_0x4235('0x12'),_0x4235('0x20'),null,_0x3483ab));}}_0x129a6f[_0x4235('0x21')]=LISTID;_0x129a6f[_0x4235('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4235('0x15')]&&_0x602109){var _0x234ce6={};for(var _0x22f4c8=0x0,_0x4373ac=DUPLICATES['length'];_0x22f4c8<_0x4373ac;_0x22f4c8+=0x1){_0x234ce6[DUPLICATES[_0x22f4c8]]=_0x129a6f[DUPLICATES[_0x22f4c8]];}var _0x20271e=_[_0x4235('0x23')](_0x602109,_0x234ce6);if(_0x20271e){return _0x38e067(handleCheckRowError(_0x4235('0x24'),'Duplicate\x20Contact',_0x20271e,_0x3483ab));}}return db['CmContact'][_0x4235('0x25')](_0x129a6f,{'raw':!![],'hooks':![],'fields':_[_0x4235('0x26')](_0x129a6f)})['then'](function(_0x5740ea){if(DUPLICATES&&DUPLICATES[_0x4235('0x15')]&&_0x602109){_0x602109['push'](_[_0x4235('0x27')](_0x129a6f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5740ea['id'];return _0x2d5be1();})[_0x4235('0x28')](function(_0x253848){return _0x38e067(handleCheckRowError(_0x4235('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x253848[_0x4235('0x16')]||JSON[_0x4235('0x29')](_0x253848)),null,_0x3483ab));});});}function checkHopper(){function _0x5aa592(){return function(_0x506d8d){logger[_0x4235('0x12')](_0x4235('0x2a'),'checkHopper',util[_0x4235('0x2b')](_0x506d8d,{'showHidden':![],'depth':null}));};}var _0xf2585d=function(_0x3fb2ac,_0x17ac48){var _0x58564c=squel['insert']()['into'](_0x4235('0x2c'))[_0x4235('0x2d')](['phone',_0x4235('0x2e'),_0x4235('0x2f'),_0x4235('0x21'),_0x17ac48,_0x4235('0x30'),_0x4235('0x31')],squel[_0x4235('0x32')]()[_0x4235('0x33')]('phone',_0x4235('0x1b'))[_0x4235('0x33')](_0x4235('0x34'),_0x4235('0x2e'))[_0x4235('0x33')]('id',_0x4235('0x2f'))['field'](LISTID[_0x4235('0x35')](),_0x4235('0x21'))['field'](_0x3fb2ac['id'][_0x4235('0x35')](),_0x17ac48)[_0x4235('0x33')](_0x4235('0x34'),_0x4235('0x30'))[_0x4235('0x33')](_0x4235('0x34'),_0x4235('0x31'))[_0x4235('0x36')](_0x4235('0x37'))[_0x4235('0x38')](_0x4235('0x39'))['where'](_0x4235('0x3a'),LISTID[_0x4235('0x35')]())['where'](_0x4235('0x3b'))[_0x4235('0x38')](_0x4235('0x3c'),squel[_0x4235('0x32')]()['field'](_0x4235('0x1b'))[_0x4235('0x36')](_0x4235('0x2c'))[_0x4235('0x38')](_0x17ac48+_0x4235('0x3d'),_0x3fb2ac['id'][_0x4235('0x35')]())))[_0x4235('0x35')]();return _0x58564c;};var _0x4026de=function(_0x1c6df7,_0x52e349){var _0x1e83de=squel[_0x4235('0x3e')]()[_0x4235('0x3f')]('cm_hopper')[_0x4235('0x2d')]([_0x4235('0x1b'),'scheduledAt',_0x4235('0x2f'),_0x4235('0x21'),_0x52e349,'createdAt',_0x4235('0x31')],squel[_0x4235('0x32')]()[_0x4235('0x33')](_0x4235('0x1b'),_0x4235('0x1b'))['field'](_0x4235('0x34'),_0x4235('0x2e'))[_0x4235('0x33')]('id',_0x4235('0x2f'))['field'](LISTID[_0x4235('0x35')](),'ListId')[_0x4235('0x33')](_0x1c6df7['id']['toString'](),_0x52e349)[_0x4235('0x33')](_0x4235('0x34'),_0x4235('0x30'))[_0x4235('0x33')]('NOW()',_0x4235('0x31'))[_0x4235('0x36')]('cm_contacts')[_0x4235('0x38')](_0x4235('0x39'))[_0x4235('0x38')]('ListId\x20=\x20?',LISTID[_0x4235('0x35')]())[_0x4235('0x38')](_0x4235('0x40'),squel[_0x4235('0x41')](hopperContacts))['where'](_0x4235('0x3b'))[_0x4235('0x38')](_0x4235('0x3c'),squel['select']()[_0x4235('0x33')](_0x4235('0x42'))[_0x4235('0x36')]('cm_hopper_final')[_0x4235('0x38')](_0x52e349+_0x4235('0x3d'),_0x1c6df7['id'][_0x4235('0x35')]()))[_0x4235('0x38')](_0x4235('0x3c'),squel[_0x4235('0x32')]()['field'](_0x4235('0x1b'))[_0x4235('0x36')](_0x4235('0x2c'))[_0x4235('0x38')](_0x52e349+_0x4235('0x3d'),_0x1c6df7['id'][_0x4235('0x35')]())))[_0x4235('0x35')]();return _0x1e83de;};function _0x11693b(_0xb8dfb1,_0x4d27ba){var _0x11c269=squel['insert']()[_0x4235('0x3f')](_0x4235('0x2c'))[_0x4235('0x2d')]([_0x4235('0x1b'),'scheduledAt',_0x4235('0x2f'),_0x4235('0x21'),_0x4d27ba,'createdAt','updatedAt'],squel[_0x4235('0x32')]()[_0x4235('0x33')](_0x4235('0x1b'),_0x4235('0x1b'))[_0x4235('0x33')](_0x4235('0x34'),'scheduledAt')['field']('id',_0x4235('0x2f'))[_0x4235('0x33')](LISTID[_0x4235('0x35')](),_0x4235('0x21'))[_0x4235('0x33')](_0xb8dfb1['id'][_0x4235('0x35')](),_0x4d27ba)[_0x4235('0x33')]('NOW()','createdAt')[_0x4235('0x33')](_0x4235('0x34'),_0x4235('0x31'))[_0x4235('0x36')]('cm_contacts')[_0x4235('0x38')](_0x4235('0x39'))[_0x4235('0x38')](_0x4235('0x3a'),LISTID[_0x4235('0x35')]())['where'](_0x4235('0x40'),squel[_0x4235('0x41')](hopperContacts))[_0x4235('0x38')](_0x4235('0x3b')))[_0x4235('0x35')]();return _0x11c269;}function _0x1c9075(_0x3424ce,_0x418e72){var _0x17d04e=squel['insert']()['into'](_0x4235('0x43'))[_0x4235('0x2d')]([_0x4235('0x1b'),_0x4235('0x2f'),'ListId',_0x418e72,_0x4235('0x30'),_0x4235('0x31')],squel[_0x4235('0x32')]()[_0x4235('0x33')](_0x4235('0x1b'),_0x4235('0x1b'))[_0x4235('0x33')]('id',_0x4235('0x2f'))[_0x4235('0x33')](LISTID[_0x4235('0x35')](),'ListId')['field'](_0x3424ce['id'][_0x4235('0x35')](),_0x418e72)[_0x4235('0x33')](_0x4235('0x34'),_0x4235('0x30'))[_0x4235('0x33')](_0x4235('0x34'),'updatedAt')[_0x4235('0x36')](_0x4235('0x37'))[_0x4235('0x38')](_0x4235('0x39'))['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x4235('0x40'),squel[_0x4235('0x41')](hopperContacts))[_0x4235('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x4235('0x35')]();return _0x17d04e;}return db[_0x4235('0x44')][_0x4235('0x45')]({'where':{'type':_0x4235('0x46')},'attributes':['id',_0x4235('0x47')],'include':[{'model':db[_0x4235('0x48')],'as':_0x4235('0x49'),'where':{'id':LISTID}}]})[_0x4235('0x4a')](function(_0x1132d9){var _0x470262=[];if(_0x1132d9){var _0x17a3b2;for(var _0x588167=0x0,_0x54bc08;_0x588167<_0x1132d9[_0x4235('0x15')];_0x588167+=0x1){_0x54bc08=_0x1132d9[_0x588167][_0x4235('0x4b')]({'plain':!![]});switch(_0x54bc08[_0x4235('0x47')]){case _0x4235('0x4c'):_0x470262[_0x4235('0x4d')](db[_0x4235('0x4e')][_0x4235('0x4f')](_0x4026de(_0x54bc08,'VoiceQueueId'))[_0x4235('0x4a')](function(){})['catch'](_0x5aa592()));break;case'onlyIfOpen':_0x470262[_0x4235('0x4d')](db[_0x4235('0x4e')][_0x4235('0x4f')](_0xf2585d(_0x54bc08,'VoiceQueueId'))[_0x4235('0x4a')](function(){})['catch'](_0x5aa592()));break;default:_0x470262[_0x4235('0x4d')](db[_0x4235('0x4e')][_0x4235('0x4f')](_0x11693b(_0x54bc08,'VoiceQueueId'))[_0x4235('0x4a')](function(){})[_0x4235('0x28')](_0x5aa592()));}}}return _0x470262;})[_0x4235('0x50')]()[_0x4235('0x4a')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x4235('0x46')},'attributes':['id'],'include':[{'model':db[_0x4235('0x48')],'as':_0x4235('0x51'),'where':{'id':LISTID}}]})[_0x4235('0x4a')](function(_0x1f001d){var _0x19fd91=[];if(_0x1f001d){var _0x4afedb;for(var _0x5f4ecf=0x0,_0x12023f;_0x5f4ecf<_0x1f001d['length'];_0x5f4ecf+=0x1){_0x12023f=_0x1f001d[_0x5f4ecf][_0x4235('0x4b')]({'plain':!![]});_0x19fd91[_0x4235('0x4d')](db[_0x4235('0x4e')][_0x4235('0x4f')](_0x1c9075(_0x12023f,_0x4235('0x52')))[_0x4235('0x4a')](function(){})['catch'](_0x5aa592()));}}return _0x19fd91;})[_0x4235('0x50')]();})['then'](function(){return db[_0x4235('0x53')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x4235('0x48')],'as':_0x4235('0x49'),'where':{'id':LISTID}}]})[_0x4235('0x4a')](function(_0x21272b){var _0x42c542=[];if(_0x21272b){for(var _0x4983d5=0x0,_0x2c0449;_0x4983d5<_0x21272b[_0x4235('0x15')];_0x4983d5+=0x1){_0x2c0449=_0x21272b[_0x4983d5][_0x4235('0x4b')]({'plain':!![]});switch(_0x2c0449[_0x4235('0x47')]){case _0x4235('0x4c'):_0x42c542[_0x4235('0x4d')](db[_0x4235('0x4e')]['query'](_0x4026de(_0x2c0449,_0x4235('0x54')))['then'](function(){})['catch'](_0x5aa592()));break;case _0x4235('0x55'):_0x42c542[_0x4235('0x4d')](db[_0x4235('0x4e')][_0x4235('0x4f')](_0xf2585d(_0x2c0449,_0x4235('0x54')))[_0x4235('0x4a')](function(){})['catch'](_0x5aa592()));break;default:_0x42c542[_0x4235('0x4d')](db[_0x4235('0x4e')]['query'](_0x11693b(_0x2c0449,_0x4235('0x54')))[_0x4235('0x4a')](function(){})[_0x4235('0x28')](_0x5aa592()));}}}return _0x42c542;})[_0x4235('0x50')]();})['then'](function(){return db[_0x4235('0x53')][_0x4235('0x45')]({'attributes':['id'],'include':[{'model':db[_0x4235('0x48')],'as':_0x4235('0x51'),'where':{'id':LISTID}}]})[_0x4235('0x4a')](function(_0xe5d172){var _0x4ff137=[];if(_0xe5d172){for(var _0x1accae=0x0,_0x5893b4;_0x1accae<_0xe5d172[_0x4235('0x15')];_0x1accae+=0x1){_0x5893b4=_0xe5d172[_0x1accae]['get']({'plain':!![]});_0x4ff137['push'](db[_0x4235('0x4e')]['query'](_0x1c9075(_0x5893b4,_0x4235('0x54')))['then'](function(){})[_0x4235('0x28')](_0x5aa592()));}}return _0x4ff137;})[_0x4235('0x50')]();})[_0x4235('0x28')](function(_0x2614ca){logger[_0x4235('0x12')](_0x4235('0x56'),'generalCheckHopper',_0x2614ca[_0x4235('0x16')]);});}var processPromises=function(_0x29adf1){return BPromise['all'](promises)[_0x4235('0x4a')](function(_0x69879b){})['catch'](function(_0x2b59ca){logger[_0x4235('0x12')](_0x4235('0x57'),JSON[_0x4235('0x29')](_0x2b59ca));})[_0x4235('0x58')](function(){socket[_0x4235('0x59')](_0x4235('0x5a')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x29adf1){return _0x29adf1[_0x4235('0x5b')]();}});};var endCsv=function(){return BPromise[_0x4235('0x5c')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x4235('0x4a')](function(){socket[_0x4235('0x59')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4235('0x5d')](FILEPATH);}catch(_0x89afd2){logger[_0x4235('0x12')](_0x4235('0x5e'),JSON[_0x4235('0x29')](_0x89afd2));}finally{process['exit'](0x0);}});};process['on'](_0x4235('0x5f'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x4235('0x5c')]()[_0x4235('0x4a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4235('0x11')](',');return db[_0x4235('0x60')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xee2444){var _0x593046=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x593046,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4dc662,_0x3fd6df){total+=0x1;var _0x10d42e=total;promises[_0x4235('0x4d')](checkRow(_0x4dc662,_0xee2444,_0x10d42e)[_0x4235('0x4a')](function(){success+=0x1;})[_0x4235('0x28')](function(_0x575070){if(_0x575070[_0x4235('0x12')]){errors+=0x1;delete _0x575070[_0x4235('0x12')];}else if(_0x575070[_0x4235('0x24')]){duplicates+=0x1;delete _0x575070[_0x4235('0x24')];}rows[_0x4235('0x4d')](_0x575070);}));if(total%0xc8===0x0){_0x3fd6df[_0x4235('0x61')]();return processPromises(_0x3fd6df);}},'complete':function(){return processPromises()[_0x4235('0x4a')](function(){logger[_0x4235('0x62')](_0x4235('0x63'));endCsv();});},'error':function(_0x3e4a5a,_0x2a7b16){logger['info'](_0x4235('0x64'),JSON[_0x4235('0x29')](_0x3e4a5a));endCsv();}});})[_0x4235('0x28')](function(_0x242aa3){logger[_0x4235('0x12')](_0x4235('0x65'),JSON[_0x4235('0x29')](_0x242aa3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 53cdb27..b5c08aa 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 _0x45e1=['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','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','emit','unlink','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','map','SIGINT','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','split','all','CmContactHasItem','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','UserId','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_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','error','message','exit','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','utcOffset','set','offset','dialTimezone','stringify','start','binding','clone','socket_timestamp','server/files/tmp','.csv','header','ContactItemType','name','writeFileSync','createReadStream','rows','data','errors','find','isNil','hasOwnProperty','replace','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','description','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each'];(function(_0x425c96,_0x5745aa){var _0x3cdfd2=function(_0x483fdb){while(--_0x483fdb){_0x425c96['push'](_0x425c96['shift']());}};_0x3cdfd2(++_0x5745aa);}(_0x45e1,0x170));var _0x145e=function(_0xa9f272,_0x25ddd3){_0xa9f272=_0xa9f272-0x0;var _0x56494f=_0x45e1[_0xa9f272];return _0x56494f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x145e('0x0'));var Papa=require(_0x145e('0x1'));var util=require(_0x145e('0x2'));var BPromise=require(_0x145e('0x3'));var moment=require(_0x145e('0x4'));var squel=require('squel');var Redis=require(_0x145e('0x5'));var db=require(_0x145e('0x6'))['db'];var config=require(_0x145e('0x7'));var shared=require(_0x145e('0x8'));var logger=require(_0x145e('0x9'))(_0x145e('0xa'));config[_0x145e('0xb')]=_[_0x145e('0xc')](config['redis'],{'host':_0x145e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x145e('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x145e('0xe')](_0x145e('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x145e('0xf'));function isEmail(_0x2b83e7){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'](_0x2b83e7);}function selectNotIn(_0x2a0125,_0x1b01a8,_0x30ed0c,_0x45f378,_0x2e1f3a){return squel[_0x145e('0x10')]()[_0x145e('0x11')](_0x145e('0x12'))[_0x145e('0x13')](_0x45f378)[_0x145e('0x14')](_0x1b01a8,null,_0x1b01a8+_0x145e('0x15')+_0x45f378+'.'+_0x30ed0c)['where'](_0x45f378+'.'+_0x30ed0c+_0x145e('0x16')+_0x2a0125+'.'+_0x30ed0c)['where'](_0x1b01a8+_0x145e('0x17')+_0x2e1f3a[_0x145e('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x492547,_0x5f0e00){promisesAdditionalPhones=[];return db[_0x145e('0x18')][_0x145e('0x19')]({'raw':!![],'attributes':['id',_0x145e('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x145e('0x1b')](function(_0x498f3e){if(_0x498f3e!==null){var _0x186349=[];for(var _0x2737ce=0x0;_0x2737ce<_0x498f3e[_0x145e('0x1c')];_0x2737ce++){var _0x317295=_0x498f3e[_0x2737ce];_0x186349[_0x145e('0x1d')](insertAdditionalPhones(_0x317295));}}Promise['all'](_0x186349)[_0x145e('0x1b')](function(){_0x492547({'val':0x1});});});});}function insertAdditionalPhones(_0x39e7bd){return new Promise(function(_0x500335,_0x2b1988){var _0x4590a2=_0x39e7bd['AdditionalPhones'];var _0x1b2b87=_0x4590a2[_0x145e('0x1e')](';');var _0x343041=[];orderBy=0x0;for(var _0x5258e8=0x0;_0x5258e8<_0x1b2b87[_0x145e('0x1c')];_0x5258e8++){_0x343041[_0x145e('0x1d')](splitAdditionalPhone(_0x39e7bd['id'],_0x1b2b87[_0x5258e8]));}Promise[_0x145e('0x1f')](_0x343041)[_0x145e('0x1b')](function(){_0x500335({'val':_0x1b2b87[_0x145e('0x1c')]});});});}function splitAdditionalPhone(_0x3d1136,_0x4580f3){return new Promise(function(_0x26fbe1,_0x4ccac3){var _0x3e3794=_0x4580f3['split'](':');var _0x21d24e=_0x3e3794[0x0];var _0x4a86c0=_0x3e3794[0x1];if(!_['isNil'](_0x4a86c0)){var _0x1f2ea8=_0x4a86c0[_0x145e('0x1e')]('|');var _0x57f67f=[];for(var _0x889c50=0x0;_0x889c50<_0x1f2ea8[_0x145e('0x1c')];_0x889c50++){if(_0x1f2ea8[_0x889c50]!==''){var _0x261d33=_['filter'](promisesAdditionalPhones,{'contactId':_0x3d1136,'phone':_0x1f2ea8[_0x889c50]});if(_0x261d33[_0x145e('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x145e('0x1d')]({'contactId':_0x3d1136,'contactTypeId':_0x21d24e,'phone':_0x1f2ea8[_0x889c50],'orderBy':orderBy});}}}_0x26fbe1({'ok':0x1});}else _0x26fbe1({'res':0x0});});}function createAdditionalPhone(_0x1e5332,_0x30dbfa,_0x599a7c,_0x1f3a15){var _0x3d505f='';var _0x4c84d9='';var _0x2ef2be=_0x599a7c['split']('§');_0x3d505f=_0x2ef2be[0x0];if(_0x2ef2be[_0x145e('0x1c')]==0x2)_0x4c84d9=_0x2ef2be[0x1];return new Promise(function(_0x1d1c4b,_0x92a6e3){return db[_0x145e('0x20')]['findOne']({'where':{'CmContactId':_0x1e5332,'item':_0x3d505f}})[_0x145e('0x1b')](function(_0x34b291){if(_0x34b291){return db['CmContactHasItem']['update']({'ItemTypeId':_0x30dbfa,'description':_0x4c84d9,'OrderBy':_0x1f3a15},{'where':{'CmContactId':_0x1e5332,'item':_0x3d505f}})['then'](function(_0x22a491){_0x1d1c4b({'res':_0x145e('0x21')});});}else{return db[_0x145e('0x20')][_0x145e('0x22')]({'CmContactId':_0x1e5332,'item':_0x3d505f,'description':_0x4c84d9,'ItemTypeId':_0x30dbfa,'OrderBy':_0x1f3a15,'ItemClass':_0x145e('0x23')})[_0x145e('0x1b')](function(_0x3c5313){_0x1d1c4b({'res':'inserted'});});}});});}function insertCmHopper(_0x5bc61d,_0x2d148d,_0x5efecf,_0x4250d1,_0x56db14){var _0x273c4a=[_0x145e('0x24'),_0x145e('0x25'),_0x145e('0x26'),_0x145e('0x27'),_0x2d148d+'.'+_0x4250d1,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x145e('0x28'),_0x145e('0x29'),'\x22'+_0x56db14+'\x22'];return squel[_0x145e('0x2a')]()[_0x145e('0x2b')](_0x145e('0x2c'))[_0x145e('0x2d')]([_0x145e('0x12'),_0x145e('0x2e'),_0x145e('0x2f'),_0x145e('0x30'),_0x4250d1,_0x145e('0x31'),_0x145e('0x32'),_0x145e('0x33'),'UserId',_0x145e('0x34')],squel[_0x145e('0x10')]()[_0x145e('0x35')](_0x273c4a)[_0x145e('0x13')](_0x2d148d)['join'](_0x145e('0x36'),null,_0x145e('0x37')+_0x2d148d+_0x145e('0x38'))[_0x145e('0x14')](_0x5efecf,null,_0x5efecf+_0x145e('0x15')+_0x2d148d+'.'+_0x4250d1)[_0x145e('0x39')](_0x2d148d+_0x145e('0x3a'),_0x5bc61d)['where'](_0x145e('0x3b'),NOW)[_0x145e('0x39')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2d148d,_0x5efecf,_0x4250d1,_0x145e('0x2c'),[_0x145e('0x3c'),'\x22onlyIfOpen\x22']))['where'](_0x145e('0x3d'),selectNotIn(_0x2d148d,_0x5efecf,_0x4250d1,_0x145e('0x2c'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x106d2d,_0x3dd735,_0x6f93a1,_0x266ad5){var _0xb1931c=[_0x145e('0x24'),_0x145e('0x26'),_0x145e('0x27'),_0x3dd735+'.'+_0x266ad5,_0x145e('0x3e'),_0x145e('0x3f')];return squel['insert']()[_0x145e('0x2b')](_0x145e('0x40'))[_0x145e('0x2d')]([_0x145e('0x12'),_0x145e('0x2f'),_0x145e('0x30'),_0x266ad5,'createdAt',_0x145e('0x32')],squel[_0x145e('0x10')]()['fields'](_0xb1931c)['from'](_0x3dd735)[_0x145e('0x14')](_0x145e('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x3dd735+_0x145e('0x38'))[_0x145e('0x14')](_0x6f93a1,null,_0x6f93a1+_0x145e('0x15')+_0x3dd735+'.'+_0x266ad5)[_0x145e('0x39')](_0x3dd735+'.CmListId\x20=\x20?',_0x106d2d)[_0x145e('0x39')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x145e('0x39')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x145e('0x10')]()[_0x145e('0x11')]('phone')[_0x145e('0x13')](_0x145e('0x40'))[_0x145e('0x39')](_0x145e('0x41'),_0x106d2d)[_0x145e('0x39')](_0x266ad5+_0x145e('0x16')+_0x3dd735+'.'+_0x266ad5)))[_0x145e('0x42')]();}function insertTzCmHopper(_0x1bd7ef,_0xc317d5,_0x4f4128,_0x1abe6a,_0x3192af,_0x1422ca){var _0x5b5f78=[_0x145e('0x24'),_0x145e('0x43')+_0x1422ca+'.offset-cm_contacts.utcOffset\x20minute)',_0x145e('0x26'),_0x145e('0x27'),_0xc317d5+'.'+_0x1abe6a,_0x145e('0x3e'),_0x145e('0x3f'),_0x145e('0x28'),_0x145e('0x29'),'\x22'+_0x3192af+'\x22'];var _0x585764=squel[_0x145e('0x2a')]()[_0x145e('0x2b')]('cm_hopper')['fromQuery']([_0x145e('0x12'),'scheduledat',_0x145e('0x2f'),_0x145e('0x30'),_0x1abe6a,_0x145e('0x31'),_0x145e('0x32'),'priority',_0x145e('0x44'),'recallme'],squel[_0x145e('0x10')]()[_0x145e('0x35')](_0x5b5f78)['from'](_0xc317d5)[_0x145e('0x14')](_0x145e('0x36'),null,_0x145e('0x37')+_0xc317d5+'.CmListId')[_0x145e('0x14')](_0x4f4128,null,_0x4f4128+_0x145e('0x15')+_0xc317d5+'.'+_0x1abe6a)[_0x145e('0x14')](_0x1422ca,null,_0x1422ca+_0x145e('0x15')+_0xc317d5+'.'+_0x1abe6a)[_0x145e('0x39')](_0xc317d5+_0x145e('0x3a'),_0x1bd7ef)['where'](_0x145e('0x3b'),NOW)[_0x145e('0x39')](_0x145e('0x3d'),selectNotIn(_0xc317d5,_0x4f4128,_0x1abe6a,_0x145e('0x2c'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x145e('0x39')](_0x145e('0x3d'),selectNotIn(_0xc317d5,_0x4f4128,_0x1abe6a,_0x145e('0x2c'),['\x22always\x22'])))[_0x145e('0x42')]();return _0x585764;}function insertTzCmHopperBlack(_0x177b4a,_0x3e6c88,_0x462e96,_0x3af201){var _0x5e2008=[_0x145e('0x24'),_0x145e('0x26'),_0x145e('0x27'),_0x3e6c88+'.'+_0x3af201,'cm_contacts.createdAt',_0x145e('0x3f')];return squel['insert']()[_0x145e('0x2b')](_0x145e('0x40'))[_0x145e('0x2d')]([_0x145e('0x12'),_0x145e('0x2f'),'ListId',_0x3af201,_0x145e('0x31'),_0x145e('0x32')],squel['select']()[_0x145e('0x35')](_0x5e2008)[_0x145e('0x13')](_0x3e6c88)[_0x145e('0x14')](_0x145e('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x3e6c88+_0x145e('0x38'))['join'](_0x462e96,null,_0x462e96+'.id\x20=\x20'+_0x3e6c88+'.'+_0x3af201)[_0x145e('0x39')](_0x3e6c88+_0x145e('0x3a'),_0x177b4a)[_0x145e('0x39')](_0x145e('0x3b'),NOW)['where'](_0x145e('0x3d'),squel[_0x145e('0x10')]()[_0x145e('0x11')](_0x145e('0x12'))[_0x145e('0x13')](_0x145e('0x40'))[_0x145e('0x39')](_0x145e('0x41'),_0x177b4a)[_0x145e('0x39')](_0x3af201+_0x145e('0x16')+_0x3e6c88+'.'+_0x3af201)))[_0x145e('0x42')]();}function insertCmHopperAdditionalPhones(_0x246e7b){var _0x3ed6c4=['cm_hopper.id','cm_contact_has_items.item',_0x145e('0x45'),_0x145e('0x46'),_0x145e('0x47')];return squel[_0x145e('0x2a')]()[_0x145e('0x2b')](_0x145e('0x48'))[_0x145e('0x2d')]([_0x145e('0x49'),_0x145e('0x12'),_0x145e('0x4a'),'createdAt','updatedAt'],squel[_0x145e('0x10')]()[_0x145e('0x35')](_0x3ed6c4)[_0x145e('0x13')](_0x145e('0x2c'))[_0x145e('0x14')](_0x145e('0x36'),null,_0x145e('0x4b'))[_0x145e('0x14')](_0x145e('0x4c'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x145e('0x39')](_0x145e('0x4d'),_0x246e7b)[_0x145e('0x39')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x145e('0x42')]();}function insertCmContact(_0x15a00c,_0x4a955c,_0x1ab8b9,_0x8f2e81){var _0x44b706=_[_0x145e('0x4e')](_[_0x145e('0x4f')](_0x8f2e81),[_0x145e('0x30'),_0x145e('0x50'),_0x145e('0x31'),'updatedAt',_0x145e('0x51')]);return squel[_0x145e('0x2a')]()[_0x145e('0x2b')](_0x145e('0x36'))[_0x145e('0x2d')](_0x44b706,squel[_0x145e('0x10')]()[_0x145e('0x35')](_0x44b706)[_0x145e('0x13')](_0x4a955c)['where']('('+_0x1ab8b9[_0x145e('0x14')](',')+_0x145e('0x52'),squel[_0x145e('0x10')]()[_0x145e('0x35')](_0x1ab8b9)['from']('cm_contacts')[_0x145e('0x39')](_0x145e('0x41'),_0x15a00c)[_0x145e('0x39')](_0x145e('0x53')))[_0x145e('0x39')]('id\x20IN\x20?',squel[_0x145e('0x10')]()[_0x145e('0x11')](_0x145e('0x54'),_0x145e('0x55'))[_0x145e('0x13')](_0x4a955c)[_0x145e('0x56')](_0x1ab8b9[_0x145e('0x14')](','))))['toString']();}function handleStop(){logger[_0x145e('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x35d1d1){logger[_0x145e('0x58')](_0x35d1d1[_0x145e('0x59')]);process[_0x145e('0x5a')](0x1);}function handleError(_0x54135d,_0x5be221){stats['errors'][_0x145e('0x1d')]({'name':_0x5be221[_0x145e('0x5b')],'message':_0x5be221[_0x145e('0x59')],'row':_0x54135d});}function handleQuery(_0x34ac82){logger[_0x145e('0x57')](_0x34ac82);return db[_0x145e('0x5c')][_0x145e('0x5d')](_0x34ac82)[_0x145e('0x5e')](function(_0x4b4e05){results[_0x145e('0x1d')](_0x4b4e05);})[_0x145e('0x5f')](function(_0x3a98e1){logger[_0x145e('0x58')](_0x3a98e1['message']);});}function updateTzCampaigns(_0x4996f3){return new Promise(function(_0x24c185,_0x43d3d8){var _0x450138=squel['select']()[_0x145e('0x35')]([_0x145e('0x60'),_0x145e('0x61')])[_0x145e('0x13')](_0x145e('0x62'))[_0x145e('0x14')](_0x145e('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x145e('0x64')+_0x4996f3);db[_0x145e('0x5c')][_0x145e('0x5d')](_0x450138['toString']())['spread'](function(_0x14590d){var _0x2143c7=[];for(var _0x98338a=0x0;_0x98338a<_0x14590d[_0x145e('0x1c')];_0x98338a++){_0x2143c7[_0x145e('0x1d')](getTimezoneData(_0x14590d[_0x98338a],tmp_campaigns));}BPromise['all'](_0x2143c7)[_0x145e('0x1b')](function(){_0x24c185({'val':0x1});});})[_0x145e('0x5f')](function(_0x3dd553){logger[_0x145e('0x58')](_0x3dd553['message']);_0x24c185({'val':0x0});});});}function updateTzVoiceQueues(_0x1daed8){return new Promise(function(_0x2a10f5,_0x17c03d){var _0x3c29e5=squel['select']()[_0x145e('0x35')](['voice_queues.id',_0x145e('0x65')])['from'](_0x145e('0x66'))[_0x145e('0x14')](_0x145e('0x67'),null,_0x145e('0x68'))['where']('voice_queues_has_cm_lists.CmListId='+_0x1daed8);db[_0x145e('0x5c')][_0x145e('0x5d')](_0x3c29e5['toString']())[_0x145e('0x5e')](function(_0x5f4ab7){var _0x5b8ffd=[];for(var _0x25156f=0x0;_0x25156f<_0x5f4ab7['length'];_0x25156f++){_0x5b8ffd[_0x145e('0x1d')](getTimezoneData(_0x5f4ab7[_0x25156f],tmp_voice_queues));}BPromise[_0x145e('0x1f')](_0x5b8ffd)[_0x145e('0x1b')](function(){_0x2a10f5({'val':0x1});});})[_0x145e('0x5f')](function(_0x97a587){logger[_0x145e('0x58')](_0x97a587['message']);_0x2a10f5({'val':0x0});});});}function getTimezoneData(_0x9cfe1,_0x4d90ec){return new Promise(function(_0x315589,_0x24dc43){var _0x408286=shared[_0x145e('0x69')];var _0x3e286f=_0x408286[_0x9cfe1['dialTimezone']];if(_['isNil'](_0x3e286f)){_0x315589({'ret':0x1});}else{var _0x4c337a=_0x3e286f[_0x145e('0x6a')];var _0x376319=squel[_0x145e('0x2a')]()['into'](_0x4d90ec)['set']('id',_0x9cfe1['id'])[_0x145e('0x6b')](_0x145e('0x6c'),_0x4c337a)[_0x145e('0x6b')](_0x145e('0x6d'),_0x9cfe1[_0x145e('0x6d')])[_0x145e('0x42')]();return db[_0x145e('0x5c')][_0x145e('0x5d')](_0x376319)[_0x145e('0x5e')](function(_0x90dce9){_0x315589({'ret':0x1});})[_0x145e('0x5f')](function(_0x1eb4a1){logger[_0x145e('0x58')](_0x1eb4a1[_0x145e('0x59')]);_0x24dc43({'ret':0x1});});}});}function handleTZQuery(_0x3b2774){logger[_0x145e('0x57')](_0x3b2774);return db[_0x145e('0x5c')][_0x145e('0x5d')](_0x3b2774)['spread'](function(_0x1c9252){})['catch'](function(_0x469355){logger[_0x145e('0x58')](_0x469355[_0x145e('0x59')]);});}function main(_0x2d3ac4,_0x32b3d4,_0x5f4175,_0xf94755){logger[_0x145e('0x57')]('main',_0x2d3ac4,JSON[_0x145e('0x6e')](_0x32b3d4));process['send'](_0x145e('0x6f'));var _0x54869c=_0x32b3d4[_0x145e('0x70')];var _0x4d3038=_[_0x145e('0x71')](_0x54869c);var _0x3a599c=_0x32b3d4[_0x145e('0x72')];var _0x42f50f=path[_0x145e('0x14')](config['root'],_0x145e('0x73'),_0x3a599c+_0x145e('0x74'));hasTZ=_['keys'](_0x54869c)['includes']('dialTimezone');var _0x2799bf=_['keys'](_0x54869c)['join']();logger[_0x145e('0x57')](_0x145e('0x75'),_0x2799bf);db[_0x145e('0x76')]['findAll']({'raw':!![],'attributes':['id',_0x145e('0x77')]})[_0x145e('0x1b')](function(_0x1a5ecf){for(var _0xb19faa=0x0;_0xb19faa<_0x1a5ecf['length'];_0xb19faa++){if(_0x1a5ecf[_0xb19faa][_0x145e('0x77')]in _0x54869c){contactItemTypes[_0x145e('0x1d')](_0x1a5ecf[_0xb19faa]);delete _0x4d3038[_0x1a5ecf[_0xb19faa][_0x145e('0x77')]];hasAdditionalPhones=!![];}for(var _0x3053aa in _0x54869c){if(_0x1a5ecf[_0xb19faa][_0x145e('0x77')]+'_description'===_0x3053aa){phoneDescriptions['push']({'itemTypeId':_0x1a5ecf[_0xb19faa]['id'],'description':_0x3053aa});delete _0x4d3038[_0x3053aa];}}}if(hasAdditionalPhones)_0x4d3038['AdditionalPhones']='';var _0x555735=_[_0x145e('0x4f')](_0x4d3038)['join']();logger[_0x145e('0x57')](_0x145e('0x75'),_0x555735);fs[_0x145e('0x78')](_0x42f50f,_0x555735+'\x0a');Papa['parse'](fs[_0x145e('0x79')](_0x2d3ac4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ee3c5,_0x40b8e8){try{for(var _0x54b600=0x0,_0x427397=[];_0x54b600<_0x3ee3c5['data']['length'];_0x54b600++){stats[_0x145e('0x7a')]+=0x1;if(_0x3ee3c5['errors'][_0x54b600]){handleError(_0x3ee3c5[_0x145e('0x7b')][_0x54b600],_0x3ee3c5[_0x145e('0x7c')][_0x54b600]);}else{var _0x1ece03=[];var _0x12630f=[];var _0x57ce30={};for(var _0x24cc73 in _0x54869c){let _0x106e7a=contactItemTypes[_0x145e('0x7d')](_0x5d027b=>_0x5d027b[_0x145e('0x77')]===_0x24cc73);let _0x280ee3=contactItemTypes[_0x145e('0x7d')](_0x333d02=>_0x333d02['name']+'_description'===_0x24cc73);if(_[_0x145e('0x7e')](_0x106e7a)&&_['isNil'](_0x280ee3)){if(_0x54869c[_0x145e('0x7f')](_0x24cc73)){if(_0x3ee3c5[_0x145e('0x7b')][_0x54b600][_0x54869c[_0x24cc73]]){var _0x23c649=_['trim'](_0x3ee3c5[_0x145e('0x7b')][_0x54b600][_0x54869c[_0x24cc73]][_0x145e('0x80')](/"/g,'\x27'));switch(_0x24cc73){case _0x145e('0x2e'):var _0x5c8a8d=moment(_0x23c649,_0x145e('0xf'),!![]);if(_0x5c8a8d['isValid']()){_0x427397['push']('\x22'+_0x23c649+'\x22');}else{_0x1ece03[_0x145e('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x145e('0x33'):var _0x133990=parseInt(_0x23c649);_0x23c649=_[_0x145e('0x81')](_0x133990)||_0x133990<0x0||_0x133990>0x4?_0xf94755?0x3:0x2:_0x133990;_0x427397[_0x145e('0x1d')]('\x22'+_0x23c649+'\x22');break;case _0x145e('0x44'):var _0x305f86=parseInt(_0x23c649);if(_[_0x145e('0x82')](_0x305f86)&&_[_0x145e('0x83')](_0x5f4175,_0x305f86)){_0x427397[_0x145e('0x1d')]('\x22'+_0x305f86+'\x22');}else{_0x1ece03[_0x145e('0x1d')](_0x145e('0x84'));}break;case _0x145e('0x85'):if(isEmail(_0x23c649)){_0x427397[_0x145e('0x1d')]('\x22'+_0x23c649+'\x22');}else{_0x1ece03[_0x145e('0x1d')](_0x145e('0x86'));}break;case _0x145e('0x87'):var _0x19034b=moment(_0x23c649,_0x145e('0x88'),!![]);if(_0x19034b[_0x145e('0x89')]()){_0x427397[_0x145e('0x1d')]('\x22'+_0x23c649+'\x22');}else{_0x1ece03[_0x145e('0x1d')](_0x145e('0x8a'));}break;case _0x145e('0x6d'):var _0x5ced12=shared[_0x145e('0x69')];var _0x33fc8e=_0x5ced12[_0x23c649];if(!_[_0x145e('0x7e')](_0x33fc8e)){var _0x18a6ac=_0x33fc8e[_0x145e('0x6a')];_0x427397['push']('\x22'+_0x23c649+'\x22');_0x427397[_0x145e('0x1d')]('\x22'+_0x18a6ac+'\x22');}break;default:_0x427397[_0x145e('0x1d')]('\x22'+_0x23c649+'\x22');}}else{switch(_0x24cc73){case _0x145e('0x8b'):case'phone':_0x1ece03[_0x145e('0x1d')](_0x24cc73+_0x145e('0x8c'));break;default:_0x427397[_0x145e('0x1d')]('\x22\x22');}}}}else{var _0x5a818d='';if(!_[_0x145e('0x7e')](_0x106e7a)){if(!_0x57ce30[_0x145e('0x7f')](_0x106e7a['id'])){if(!_[_0x145e('0x7e')](_0x3ee3c5[_0x145e('0x7b')][_0x54b600][_0x54869c[_0x24cc73]])){var _0x23c649=_[_0x145e('0x8d')](_0x3ee3c5['data'][_0x54b600][_0x54869c[_0x24cc73]][_0x145e('0x80')](/"/g,'\x27'));var _0x3882cb=phoneDescriptions[_0x145e('0x7d')](_0x543697=>_0x543697[_0x145e('0x8e')]===_0x106e7a['id']);if(!_[_0x145e('0x7e')](_0x3882cb)){var _0x4c83ca=_[_0x145e('0x8d')](_0x3ee3c5[_0x145e('0x7b')][_0x54b600][_0x54869c[_0x3882cb[_0x145e('0x8f')]]][_0x145e('0x80')](/"/g,'\x27'));if(!_[_0x145e('0x7e')](_0x4c83ca))_0x23c649=_0x23c649+'§'+_0x4c83ca;}if(_0x5a818d=='')_0x5a818d=_0x23c649;else _0x5a818d+='|'+_0x23c649;}_0x12630f[_0x145e('0x1d')](_0x106e7a['id']+':'+_0x5a818d);_0x57ce30[_0x106e7a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x427397[_0x145e('0x1d')]('\x22'+_0x12630f[_0x145e('0x14')](';')+'\x22');}if(_0x1ece03[_0x145e('0x1c')]){handleError(_0x3ee3c5[_0x145e('0x7b')][_0x54b600],{'code':'SystemRow','message':_0x1ece03[_0x145e('0x14')]()});}else{fs[_0x145e('0x90')](_0x42f50f,_0x427397['join']()+'\x0a');}_0x427397=[];}if(!(stats[_0x145e('0x7a')]%0xc8)){socket['emit'](_0x145e('0x91')+_0x3a599c,stats);stats[_0x145e('0x7c')]=[];}}if(stopped){logger[_0x145e('0x57')](_0x145e('0x92'));_0x40b8e8[_0x145e('0x93')]();}}catch(_0x1dd9c0){handleError(_0x3ee3c5[_0x145e('0x7b')][_0x54b600],{'code':_0x145e('0x94'),'message':_0x1dd9c0[_0x145e('0x59')]});logger[_0x145e('0x58')](_0x145e('0x95'),_0x1dd9c0['message']);}},'complete':function(){try{var _0x6ff610=[];var _0x345cda=[];var _0x158be5='cm_contacts';if(_0x32b3d4['duplicates']&&_0x32b3d4[_0x145e('0x96')][_0x145e('0x1c')]){_0x158be5=_0x145e('0x97')+_0x3a599c;_0x6ff610[_0x145e('0x1d')](_0x145e('0x98')+_0x158be5+_0x145e('0x99'));}tmp_campaigns=_0x145e('0x9a')+_0x3a599c;tmp_voice_queues='voice_queues_'+_0x3a599c;_0x345cda[_0x145e('0x1d')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x345cda[_0x145e('0x1d')](_0x145e('0x98')+tmp_voice_queues+_0x145e('0x9b'));BPromise[_0x145e('0x9c')](_0x345cda,handleTZQuery)[_0x145e('0x1b')](function(_0x436c6e){updateTzCampaigns(_0x32b3d4[_0x145e('0x30')])[_0x145e('0x1b')](function(_0x69d8bd){updateTzVoiceQueues(_0x32b3d4[_0x145e('0x30')])[_0x145e('0x1b')](function(_0x521f76){if(hasTZ)_0x555735=_0x555735['replace'](_0x145e('0x6d'),_0x145e('0x9d'));var _0x46bd1e=util['format'](_0x145e('0x9e'),_0x42f50f,_0x158be5,_0x555735,_0x32b3d4[_0x145e('0x30')],_0x32b3d4['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x54869c[_0x145e('0x2e')])){_0x46bd1e+=',\x20scheduledAt\x20=\x20NOW()';}_0x6ff610[_0x145e('0x1d')](_0x46bd1e);if(_0x32b3d4[_0x145e('0x96')]&&_0x32b3d4[_0x145e('0x96')]['length']){_0x6ff610[_0x145e('0x1d')](insertCmContact(_0x32b3d4[_0x145e('0x30')],_0x158be5,_0x32b3d4['duplicates'],_0x54869c));_0x6ff610[_0x145e('0x1d')](_0x145e('0x9f')+_0x158be5+';');}BPromise['each'](_0x6ff610,handleQuery)['then'](function(_0xd5f216){BPromise[_0x145e('0x1f')]([handleAdditionalPhones()])[_0x145e('0x1b')](function(){_0x6ff610=[];for(var _0x2f86b3=0x0;_0x2f86b3\x20\x20');}var _0x1f2de0=path[_0x145e('0x14')](config['root'],_0x145e('0x73'),process['argv'][0x2]);if(!fs[_0x145e('0xaa')](_0x1f2de0)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x4f64ff={};try{_0x4f64ff=JSON['parse'](process[_0x145e('0xa9')][0x3]);if(!_0x4f64ff['binding']){throw new Error(_0x145e('0xab'));}if(!_0x4f64ff[_0x145e('0x70')][_0x145e('0x12')]){throw new Error(_0x145e('0xac'));}if(!_0x4f64ff['binding'][_0x145e('0x8b')]){throw new Error('firstName\x20is\x20mandatory');}var _0x4242c6=0x0;if(_0x4f64ff[_0x145e('0x70')]['UserId']){_0x4242c6=0x1;}if(!_0x4f64ff[_0x145e('0x30')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x50f33a){throw new Error('body\x20id\x20mandatory');}var _0x5da6fc=[];try{_0x5da6fc=_[_0x145e('0xad')](JSON['parse'](process[_0x145e('0xa9')][0x4]),'id');}catch(_0x545f76){logger['info']('No\x20agent\x20available');}main(_0x1f2de0,_0x4f64ff,_0x5da6fc,_0x4242c6);}validate();process['on'](_0x145e('0xae'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xf132=['start','socket_timestamp','server/files/tmp','keys','includes','header','ContactItemType','name','parse','createReadStream','data','rows','find','_description','isValid','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','hasOwnProperty','trim','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','util','moment','../../../mysqldb','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','CmContactHasItem','updated','PHONE','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.ListId','insert','cm_hopper_black','fromQuery','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','message','exit','errors','code','sequelize','query','error','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','spread','dialTimezone','utcOffset','set','offset','catch','main','send'];(function(_0x1e2a1f,_0x1c874e){var _0x43b949=function(_0x40cc1f){while(--_0x40cc1f){_0x1e2a1f['push'](_0x1e2a1f['shift']());}};_0x43b949(++_0x1c874e);}(_0xf132,0xfc));var _0x2f13=function(_0x4dc166,_0x4063ca){_0x4dc166=_0x4dc166-0x0;var _0x2f4579=_0xf132[_0x4dc166];return _0x2f4579;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x2f13('0x0'));var Papa=require('papaparse');var util=require(_0x2f13('0x1'));var BPromise=require('bluebird');var moment=require(_0x2f13('0x2'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x2f13('0x3'))['db'];var config=require('../../../config/environment');var shared=require(_0x2f13('0x4'));var logger=require('../../../config/logger')(_0x2f13('0x5'));config[_0x2f13('0x6')]=_[_0x2f13('0x7')](config[_0x2f13('0x6')],{'host':_0x2f13('0x8'),'port':0x18eb});var socket=require(_0x2f13('0x9'))(new Redis(config[_0x2f13('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('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()[_0x2f13('0xa')](_0x2f13('0xb'));function isEmail(_0x384930){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'](_0x384930);}function selectNotIn(_0x2e8890,_0x502568,_0x2ec90a,_0x260370,_0x357a5e){return squel[_0x2f13('0xc')]()[_0x2f13('0xd')](_0x2f13('0xe'))[_0x2f13('0xf')](_0x260370)[_0x2f13('0x10')](_0x502568,null,_0x502568+_0x2f13('0x11')+_0x260370+'.'+_0x2ec90a)[_0x2f13('0x12')](_0x260370+'.'+_0x2ec90a+_0x2f13('0x13')+_0x2e8890+'.'+_0x2ec90a)['where'](_0x502568+_0x2f13('0x14')+_0x357a5e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xe8a30e,_0x534553){promisesAdditionalPhones=[];return db[_0x2f13('0x15')][_0x2f13('0x16')]({'raw':!![],'attributes':['id',_0x2f13('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2f13('0x18')](function(_0x4a5101){if(_0x4a5101!==null){var _0x37ca41=[];for(var _0x391430=0x0;_0x391430<_0x4a5101['length'];_0x391430++){var _0x27bb60=_0x4a5101[_0x391430];_0x37ca41[_0x2f13('0x19')](insertAdditionalPhones(_0x27bb60));}}Promise[_0x2f13('0x1a')](_0x37ca41)[_0x2f13('0x18')](function(){_0xe8a30e({'val':0x1});});});});}function insertAdditionalPhones(_0x2f8edf){return new Promise(function(_0x20d6d8,_0x2b811f){var _0x2dc1ce=_0x2f8edf[_0x2f13('0x17')];var _0x4737a5=_0x2dc1ce[_0x2f13('0x1b')](';');var _0x3d1c8c=[];orderBy=0x0;for(var _0x5c1dbf=0x0;_0x5c1dbf<_0x4737a5['length'];_0x5c1dbf++){_0x3d1c8c[_0x2f13('0x19')](splitAdditionalPhone(_0x2f8edf['id'],_0x4737a5[_0x5c1dbf]));}Promise[_0x2f13('0x1a')](_0x3d1c8c)['then'](function(){_0x20d6d8({'val':_0x4737a5[_0x2f13('0x1c')]});});});}function splitAdditionalPhone(_0x54ae4a,_0x287d00){return new Promise(function(_0xa2072f,_0x341668){var _0x2a4c3d=_0x287d00[_0x2f13('0x1b')](':');var _0x2f6d4c=_0x2a4c3d[0x0];var _0x249b1f=_0x2a4c3d[0x1];if(!_[_0x2f13('0x1d')](_0x249b1f)){var _0x4ffdc8=_0x249b1f['split']('|');var _0xd43c20=[];for(var _0x5ea5d2=0x0;_0x5ea5d2<_0x4ffdc8[_0x2f13('0x1c')];_0x5ea5d2++){if(_0x4ffdc8[_0x5ea5d2]!==''){var _0x4b227b=_[_0x2f13('0x1e')](promisesAdditionalPhones,{'contactId':_0x54ae4a,'phone':_0x4ffdc8[_0x5ea5d2]});if(_0x4b227b[_0x2f13('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x2f13('0x19')]({'contactId':_0x54ae4a,'contactTypeId':_0x2f6d4c,'phone':_0x4ffdc8[_0x5ea5d2],'orderBy':orderBy});}}}_0xa2072f({'ok':0x1});}else _0xa2072f({'res':0x0});});}function createAdditionalPhone(_0x7fbe48,_0x615fc9,_0x320a22,_0xf9d9e1){var _0x52ce05='';var _0x5dd021='';var _0x3a73aa=_0x320a22[_0x2f13('0x1b')]('§');_0x52ce05=_0x3a73aa[0x0];if(_0x3a73aa[_0x2f13('0x1c')]==0x2)_0x5dd021=_0x3a73aa[0x1];return new Promise(function(_0x20671c,_0x534d79){return db[_0x2f13('0x1f')]['findOne']({'where':{'CmContactId':_0x7fbe48,'item':_0x52ce05}})[_0x2f13('0x18')](function(_0x16da7c){if(_0x16da7c){return db[_0x2f13('0x1f')]['update']({'ItemTypeId':_0x615fc9,'description':_0x5dd021,'OrderBy':_0xf9d9e1},{'where':{'CmContactId':_0x7fbe48,'item':_0x52ce05}})[_0x2f13('0x18')](function(_0x4dde66){_0x20671c({'res':_0x2f13('0x20')});});}else{return db[_0x2f13('0x1f')]['create']({'CmContactId':_0x7fbe48,'item':_0x52ce05,'description':_0x5dd021,'ItemTypeId':_0x615fc9,'OrderBy':_0xf9d9e1,'ItemClass':_0x2f13('0x21')})[_0x2f13('0x18')](function(_0x165954){_0x20671c({'res':'inserted'});});}});});}function insertCmHopper(_0x419355,_0x1bf68e,_0x72b198,_0x287f0c,_0x528773){var _0x2baa01=['cm_contacts.phone',_0x2f13('0x22'),_0x2f13('0x23'),'cm_contacts.ListId',_0x1bf68e+'.'+_0x287f0c,_0x2f13('0x24'),'cm_contacts.updatedAt','cm_contacts.priority',_0x2f13('0x25'),'\x22'+_0x528773+'\x22'];return squel['insert']()['into'](_0x2f13('0x26'))['fromQuery']([_0x2f13('0xe'),_0x2f13('0x27'),_0x2f13('0x28'),_0x2f13('0x29'),_0x287f0c,_0x2f13('0x2a'),_0x2f13('0x2b'),_0x2f13('0x2c'),_0x2f13('0x2d'),_0x2f13('0x2e')],squel['select']()[_0x2f13('0x2f')](_0x2baa01)[_0x2f13('0xf')](_0x1bf68e)[_0x2f13('0x10')](_0x2f13('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x1bf68e+'.CmListId')['join'](_0x72b198,null,_0x72b198+_0x2f13('0x11')+_0x1bf68e+'.'+_0x287f0c)[_0x2f13('0x12')](_0x1bf68e+_0x2f13('0x31'),_0x419355)[_0x2f13('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2f13('0x12')](_0x2f13('0x32'),selectNotIn(_0x1bf68e,_0x72b198,_0x287f0c,'cm_hopper',[_0x2f13('0x33'),_0x2f13('0x34')]))[_0x2f13('0x12')](_0x2f13('0x32'),selectNotIn(_0x1bf68e,_0x72b198,_0x287f0c,_0x2f13('0x26'),[_0x2f13('0x33')])))[_0x2f13('0x35')]();}function insertCmHopperBlack(_0x44da82,_0x3a9057,_0x41478c,_0x3331d8){var _0x158b78=[_0x2f13('0x36'),_0x2f13('0x23'),_0x2f13('0x37'),_0x3a9057+'.'+_0x3331d8,_0x2f13('0x24'),'cm_contacts.updatedAt'];return squel[_0x2f13('0x38')]()['into'](_0x2f13('0x39'))[_0x2f13('0x3a')](['phone',_0x2f13('0x28'),_0x2f13('0x29'),_0x3331d8,_0x2f13('0x2a'),_0x2f13('0x2b')],squel[_0x2f13('0xc')]()[_0x2f13('0x2f')](_0x158b78)[_0x2f13('0xf')](_0x3a9057)[_0x2f13('0x10')](_0x2f13('0x30'),null,_0x2f13('0x3b')+_0x3a9057+_0x2f13('0x3c'))[_0x2f13('0x10')](_0x41478c,null,_0x41478c+_0x2f13('0x11')+_0x3a9057+'.'+_0x3331d8)[_0x2f13('0x12')](_0x3a9057+_0x2f13('0x31'),_0x44da82)[_0x2f13('0x12')](_0x2f13('0x3d'),NOW)[_0x2f13('0x12')](_0x2f13('0x32'),squel[_0x2f13('0xc')]()[_0x2f13('0xd')]('phone')[_0x2f13('0xf')](_0x2f13('0x39'))['where'](_0x2f13('0x3e'),_0x44da82)[_0x2f13('0x12')](_0x3331d8+_0x2f13('0x13')+_0x3a9057+'.'+_0x3331d8)))[_0x2f13('0x35')]();}function insertTzCmHopper(_0x5caa52,_0x1852b9,_0x65210a,_0x39d881,_0x1da231,_0xcc7d7){var _0x85248d=[_0x2f13('0x36'),_0x2f13('0x3f')+_0xcc7d7+_0x2f13('0x40'),_0x2f13('0x23'),'cm_contacts.ListId',_0x1852b9+'.'+_0x39d881,_0x2f13('0x24'),_0x2f13('0x41'),_0x2f13('0x42'),_0x2f13('0x25'),'\x22'+_0x1da231+'\x22'];var _0x1f072f=squel[_0x2f13('0x38')]()[_0x2f13('0x43')](_0x2f13('0x26'))[_0x2f13('0x3a')]([_0x2f13('0xe'),_0x2f13('0x27'),_0x2f13('0x28'),'ListId',_0x39d881,'createdAt',_0x2f13('0x2b'),_0x2f13('0x2c'),_0x2f13('0x2d'),_0x2f13('0x2e')],squel[_0x2f13('0xc')]()['fields'](_0x85248d)[_0x2f13('0xf')](_0x1852b9)[_0x2f13('0x10')](_0x2f13('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x1852b9+'.CmListId')['join'](_0x65210a,null,_0x65210a+_0x2f13('0x11')+_0x1852b9+'.'+_0x39d881)[_0x2f13('0x10')](_0xcc7d7,null,_0xcc7d7+_0x2f13('0x11')+_0x1852b9+'.'+_0x39d881)[_0x2f13('0x12')](_0x1852b9+_0x2f13('0x31'),_0x5caa52)[_0x2f13('0x12')](_0x2f13('0x3d'),NOW)[_0x2f13('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1852b9,_0x65210a,_0x39d881,_0x2f13('0x26'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x2f13('0x12')](_0x2f13('0x32'),selectNotIn(_0x1852b9,_0x65210a,_0x39d881,_0x2f13('0x26'),['\x22always\x22'])))[_0x2f13('0x35')]();return _0x1f072f;}function insertTzCmHopperBlack(_0x22b649,_0x289303,_0x4e712f,_0x2b87d6){var _0x5e6a8a=[_0x2f13('0x36'),_0x2f13('0x23'),_0x2f13('0x37'),_0x289303+'.'+_0x2b87d6,_0x2f13('0x24'),_0x2f13('0x41')];return squel[_0x2f13('0x38')]()['into'](_0x2f13('0x39'))[_0x2f13('0x3a')]([_0x2f13('0xe'),_0x2f13('0x28'),_0x2f13('0x29'),_0x2b87d6,_0x2f13('0x2a'),_0x2f13('0x2b')],squel[_0x2f13('0xc')]()[_0x2f13('0x2f')](_0x5e6a8a)[_0x2f13('0xf')](_0x289303)[_0x2f13('0x10')](_0x2f13('0x30'),null,_0x2f13('0x3b')+_0x289303+'.CmListId')[_0x2f13('0x10')](_0x4e712f,null,_0x4e712f+_0x2f13('0x11')+_0x289303+'.'+_0x2b87d6)[_0x2f13('0x12')](_0x289303+'.CmListId\x20=\x20?',_0x22b649)[_0x2f13('0x12')](_0x2f13('0x3d'),NOW)[_0x2f13('0x12')](_0x2f13('0x32'),squel[_0x2f13('0xc')]()[_0x2f13('0xd')](_0x2f13('0xe'))['from']('cm_hopper_black')[_0x2f13('0x12')](_0x2f13('0x3e'),_0x22b649)[_0x2f13('0x12')](_0x2b87d6+_0x2f13('0x13')+_0x289303+'.'+_0x2b87d6)))['toString']();}function insertCmHopperAdditionalPhones(_0x2a6576){var _0x2d11d4=[_0x2f13('0x44'),_0x2f13('0x45'),_0x2f13('0x46'),'cm_contact_has_items.createdAt',_0x2f13('0x47')];return squel['insert']()['into']('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x2f13('0xe'),'OrderBy',_0x2f13('0x2a'),_0x2f13('0x2b')],squel[_0x2f13('0xc')]()[_0x2f13('0x2f')](_0x2d11d4)[_0x2f13('0xf')](_0x2f13('0x26'))[_0x2f13('0x10')](_0x2f13('0x30'),null,_0x2f13('0x48'))[_0x2f13('0x10')](_0x2f13('0x49'),null,_0x2f13('0x4a'))[_0x2f13('0x12')]('cm_hopper.ListId\x20=\x20?',_0x2a6576)[_0x2f13('0x12')](_0x2f13('0x3d'),NOW))[_0x2f13('0x35')]();}function insertCmContact(_0x49d425,_0xbedec6,_0x2183c0,_0x1b7e20){var _0x3be372=_[_0x2f13('0x4b')](_['keys'](_0x1b7e20),[_0x2f13('0x29'),_0x2f13('0x4c'),_0x2f13('0x2a'),'updatedAt',_0x2f13('0x4d')]);return squel[_0x2f13('0x38')]()['into']('cm_contacts')[_0x2f13('0x3a')](_0x3be372,squel[_0x2f13('0xc')]()[_0x2f13('0x2f')](_0x3be372)[_0x2f13('0xf')](_0xbedec6)['where']('('+_0x2183c0[_0x2f13('0x10')](',')+_0x2f13('0x4e'),squel['select']()[_0x2f13('0x2f')](_0x2183c0)[_0x2f13('0xf')](_0x2f13('0x30'))[_0x2f13('0x12')]('ListId\x20=\x20?',_0x49d425)[_0x2f13('0x12')](_0x2f13('0x4f')))['where'](_0x2f13('0x50'),squel[_0x2f13('0xc')]()[_0x2f13('0xd')](_0x2f13('0x51'),_0x2f13('0x52'))[_0x2f13('0xf')](_0xbedec6)['group'](_0x2183c0['join'](','))))['toString']();}function handleStop(){logger[_0x2f13('0x53')](_0x2f13('0x54'));stopped=!![];}function handleUncaughtException(_0x5cb4d8){logger['error'](_0x5cb4d8[_0x2f13('0x55')]);process[_0x2f13('0x56')](0x1);}function handleError(_0x2150ad,_0x33bd33){stats[_0x2f13('0x57')][_0x2f13('0x19')]({'name':_0x33bd33[_0x2f13('0x58')],'message':_0x33bd33[_0x2f13('0x55')],'row':_0x2150ad});}function handleQuery(_0x6bf9da){logger[_0x2f13('0x53')](_0x6bf9da);return db[_0x2f13('0x59')][_0x2f13('0x5a')](_0x6bf9da)['spread'](function(_0x39c7e8){results[_0x2f13('0x19')](_0x39c7e8);})['catch'](function(_0x1afc06){logger[_0x2f13('0x5b')](_0x1afc06['message']);});}function updateTzCampaigns(_0x1d3771){return new Promise(function(_0x65bb7a,_0x39bacf){var _0x12cfd3=squel['select']()[_0x2f13('0x2f')]([_0x2f13('0x5c'),'campaigns.dialTimezone'])['from'](_0x2f13('0x5d'))[_0x2f13('0x10')]('campaigns_has_cm_lists',null,_0x2f13('0x5e'))[_0x2f13('0x12')](_0x2f13('0x5f')+_0x1d3771);db[_0x2f13('0x59')][_0x2f13('0x5a')](_0x12cfd3[_0x2f13('0x35')]())['spread'](function(_0xd58ff7){var _0x4c1186=[];for(var _0x5e630e=0x0;_0x5e630e<_0xd58ff7[_0x2f13('0x1c')];_0x5e630e++){_0x4c1186[_0x2f13('0x19')](getTimezoneData(_0xd58ff7[_0x5e630e],tmp_campaigns));}BPromise['all'](_0x4c1186)[_0x2f13('0x18')](function(){_0x65bb7a({'val':0x1});});})['catch'](function(_0x12df94){logger[_0x2f13('0x5b')](_0x12df94[_0x2f13('0x55')]);_0x65bb7a({'val':0x0});});});}function updateTzVoiceQueues(_0x5aae08){return new Promise(function(_0x3f8cfe,_0x35df9c){var _0x3b9381=squel[_0x2f13('0xc')]()['fields']([_0x2f13('0x60'),_0x2f13('0x61')])[_0x2f13('0xf')]('voice_queues')[_0x2f13('0x10')](_0x2f13('0x62'),null,_0x2f13('0x63'))[_0x2f13('0x12')]('voice_queues_has_cm_lists.CmListId='+_0x5aae08);db['sequelize'][_0x2f13('0x5a')](_0x3b9381[_0x2f13('0x35')]())[_0x2f13('0x64')](function(_0x2ec6ae){var _0x114365=[];for(var _0x9900c1=0x0;_0x9900c1<_0x2ec6ae[_0x2f13('0x1c')];_0x9900c1++){_0x114365[_0x2f13('0x19')](getTimezoneData(_0x2ec6ae[_0x9900c1],tmp_voice_queues));}BPromise[_0x2f13('0x1a')](_0x114365)[_0x2f13('0x18')](function(){_0x3f8cfe({'val':0x1});});})['catch'](function(_0x3e0084){logger[_0x2f13('0x5b')](_0x3e0084[_0x2f13('0x55')]);_0x3f8cfe({'val':0x0});});});}function getTimezoneData(_0x429a0c,_0x1a33a3){return new Promise(function(_0x40759b,_0x35381b){var _0x38a272=shared['timezones'];var _0x451364=_0x38a272[_0x429a0c[_0x2f13('0x65')]];if(_[_0x2f13('0x1d')](_0x451364)){_0x40759b({'ret':0x1});}else{var _0x4739c3=_0x451364[_0x2f13('0x66')];var _0x12b848=squel[_0x2f13('0x38')]()[_0x2f13('0x43')](_0x1a33a3)[_0x2f13('0x67')]('id',_0x429a0c['id'])[_0x2f13('0x67')](_0x2f13('0x68'),_0x4739c3)[_0x2f13('0x67')](_0x2f13('0x65'),_0x429a0c['dialTimezone'])['toString']();return db['sequelize']['query'](_0x12b848)['spread'](function(_0xa9b913){_0x40759b({'ret':0x1});})[_0x2f13('0x69')](function(_0x3ad86a){logger[_0x2f13('0x5b')](_0x3ad86a['message']);_0x35381b({'ret':0x1});});}});}function handleTZQuery(_0x23fe12){logger[_0x2f13('0x53')](_0x23fe12);return db[_0x2f13('0x59')][_0x2f13('0x5a')](_0x23fe12)[_0x2f13('0x64')](function(_0x239fc9){})[_0x2f13('0x69')](function(_0x2d4c12){logger[_0x2f13('0x5b')](_0x2d4c12[_0x2f13('0x55')]);});}function main(_0x410ace,_0x7d7e1,_0x597208,_0x24afe2){logger[_0x2f13('0x53')](_0x2f13('0x6a'),_0x410ace,JSON['stringify'](_0x7d7e1));process[_0x2f13('0x6b')](_0x2f13('0x6c'));var _0x39ba2e=_0x7d7e1['binding'];var _0x373bcd=_['clone'](_0x39ba2e);var _0x254323=_0x7d7e1[_0x2f13('0x6d')];var _0x603b64=path[_0x2f13('0x10')](config['root'],_0x2f13('0x6e'),_0x254323+'.csv');hasTZ=_[_0x2f13('0x6f')](_0x39ba2e)[_0x2f13('0x70')](_0x2f13('0x65'));var _0xf38769=_[_0x2f13('0x6f')](_0x39ba2e)['join']();logger[_0x2f13('0x53')](_0x2f13('0x71'),_0xf38769);db[_0x2f13('0x72')]['findAll']({'raw':!![],'attributes':['id',_0x2f13('0x73')]})[_0x2f13('0x18')](function(_0x11ba74){for(var _0xd39172=0x0;_0xd39172<_0x11ba74['length'];_0xd39172++){if(_0x11ba74[_0xd39172][_0x2f13('0x73')]in _0x39ba2e){contactItemTypes['push'](_0x11ba74[_0xd39172]);delete _0x373bcd[_0x11ba74[_0xd39172][_0x2f13('0x73')]];hasAdditionalPhones=!![];}for(var _0x3add48 in _0x39ba2e){if(_0x11ba74[_0xd39172][_0x2f13('0x73')]+'_description'===_0x3add48){phoneDescriptions['push']({'itemTypeId':_0x11ba74[_0xd39172]['id'],'description':_0x3add48});delete _0x373bcd[_0x3add48];}}}if(hasAdditionalPhones)_0x373bcd[_0x2f13('0x17')]='';var _0xe4d05e=_[_0x2f13('0x6f')](_0x373bcd)['join']();logger[_0x2f13('0x53')](_0x2f13('0x71'),_0xe4d05e);fs['writeFileSync'](_0x603b64,_0xe4d05e+'\x0a');Papa[_0x2f13('0x74')](fs[_0x2f13('0x75')](_0x410ace),{'header':!![],'skipEmptyLines':!![],'step':function(_0x16d322,_0x10cce1){try{for(var _0x3fd76f=0x0,_0x3ae251=[];_0x3fd76f<_0x16d322[_0x2f13('0x76')][_0x2f13('0x1c')];_0x3fd76f++){stats[_0x2f13('0x77')]+=0x1;if(_0x16d322['errors'][_0x3fd76f]){handleError(_0x16d322[_0x2f13('0x76')][_0x3fd76f],_0x16d322[_0x2f13('0x57')][_0x3fd76f]);}else{var _0x1dc037=[];var _0x5d31b2=[];var _0x1b1896={};for(var _0xa7976a in _0x39ba2e){let _0x4c75b6=contactItemTypes[_0x2f13('0x78')](_0x530545=>_0x530545[_0x2f13('0x73')]===_0xa7976a);let _0x7d84d8=contactItemTypes[_0x2f13('0x78')](_0x5784e5=>_0x5784e5['name']+_0x2f13('0x79')===_0xa7976a);if(_[_0x2f13('0x1d')](_0x4c75b6)&&_[_0x2f13('0x1d')](_0x7d84d8)){if(_0x39ba2e['hasOwnProperty'](_0xa7976a)){if(_0x16d322[_0x2f13('0x76')][_0x3fd76f][_0x39ba2e[_0xa7976a]]){var _0x23dcac=_['trim'](_0x16d322['data'][_0x3fd76f][_0x39ba2e[_0xa7976a]]['replace'](/"/g,'\x27'));switch(_0xa7976a){case _0x2f13('0x27'):var _0x2504a3=moment(_0x23dcac,_0x2f13('0xb'),!![]);if(_0x2504a3[_0x2f13('0x7a')]()){_0x3ae251[_0x2f13('0x19')]('\x22'+_0x23dcac+'\x22');}else{_0x1dc037[_0x2f13('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2f13('0x2c'):var _0x519180=parseInt(_0x23dcac);_0x23dcac=_[_0x2f13('0x7b')](_0x519180)||_0x519180<0x0||_0x519180>0x4?_0x24afe2?0x3:0x2:_0x519180;_0x3ae251[_0x2f13('0x19')]('\x22'+_0x23dcac+'\x22');break;case'UserId':var _0x3075c0=parseInt(_0x23dcac);if(_[_0x2f13('0x7c')](_0x3075c0)&&_[_0x2f13('0x70')](_0x597208,_0x3075c0)){_0x3ae251[_0x2f13('0x19')]('\x22'+_0x3075c0+'\x22');}else{_0x1dc037[_0x2f13('0x19')](_0x2f13('0x7d'));}break;case _0x2f13('0x7e'):if(isEmail(_0x23dcac)){_0x3ae251[_0x2f13('0x19')]('\x22'+_0x23dcac+'\x22');}else{_0x1dc037[_0x2f13('0x19')]('email\x20wrong\x20format');}break;case _0x2f13('0x7f'):var _0x5531a6=moment(_0x23dcac,'YYYY-MM-DD',!![]);if(_0x5531a6[_0x2f13('0x7a')]()){_0x3ae251[_0x2f13('0x19')]('\x22'+_0x23dcac+'\x22');}else{_0x1dc037[_0x2f13('0x19')](_0x2f13('0x80'));}break;case'dialTimezone':var _0x4260a3=shared[_0x2f13('0x81')];var _0x45255b=_0x4260a3[_0x23dcac];if(!_[_0x2f13('0x1d')](_0x45255b)){var _0x3c5193=_0x45255b[_0x2f13('0x66')];_0x3ae251[_0x2f13('0x19')]('\x22'+_0x23dcac+'\x22');_0x3ae251['push']('\x22'+_0x3c5193+'\x22');}break;default:_0x3ae251[_0x2f13('0x19')]('\x22'+_0x23dcac+'\x22');}}else{switch(_0xa7976a){case _0x2f13('0x82'):case _0x2f13('0xe'):_0x1dc037[_0x2f13('0x19')](_0xa7976a+_0x2f13('0x83'));break;default:_0x3ae251[_0x2f13('0x19')]('\x22\x22');}}}}else{var _0x4c7729='';if(!_['isNil'](_0x4c75b6)){if(!_0x1b1896[_0x2f13('0x84')](_0x4c75b6['id'])){if(!_['isNil'](_0x16d322[_0x2f13('0x76')][_0x3fd76f][_0x39ba2e[_0xa7976a]])){var _0x23dcac=_[_0x2f13('0x85')](_0x16d322['data'][_0x3fd76f][_0x39ba2e[_0xa7976a]][_0x2f13('0x86')](/"/g,'\x27'));var _0x2d0248=phoneDescriptions[_0x2f13('0x78')](_0x9c1fdf=>_0x9c1fdf[_0x2f13('0x87')]===_0x4c75b6['id']);if(!_[_0x2f13('0x1d')](_0x2d0248)){var _0x207b49=_[_0x2f13('0x85')](_0x16d322['data'][_0x3fd76f][_0x39ba2e[_0x2d0248[_0x2f13('0x88')]]][_0x2f13('0x86')](/"/g,'\x27'));if(!_[_0x2f13('0x1d')](_0x207b49))_0x23dcac=_0x23dcac+'§'+_0x207b49;}if(_0x4c7729=='')_0x4c7729=_0x23dcac;else _0x4c7729+='|'+_0x23dcac;}_0x5d31b2[_0x2f13('0x19')](_0x4c75b6['id']+':'+_0x4c7729);_0x1b1896[_0x4c75b6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3ae251[_0x2f13('0x19')]('\x22'+_0x5d31b2[_0x2f13('0x10')](';')+'\x22');}if(_0x1dc037[_0x2f13('0x1c')]){handleError(_0x16d322[_0x2f13('0x76')][_0x3fd76f],{'code':_0x2f13('0x89'),'message':_0x1dc037[_0x2f13('0x10')]()});}else{fs[_0x2f13('0x8a')](_0x603b64,_0x3ae251[_0x2f13('0x10')]()+'\x0a');}_0x3ae251=[];}if(!(stats['rows']%0xc8)){socket[_0x2f13('0x8b')](_0x2f13('0x8c')+_0x254323,stats);stats[_0x2f13('0x57')]=[];}}if(stopped){logger[_0x2f13('0x53')](_0x2f13('0x8d'));_0x10cce1[_0x2f13('0x8e')]();}}catch(_0x27fd6d){handleError(_0x16d322[_0x2f13('0x76')][_0x3fd76f],{'code':_0x2f13('0x8f'),'message':_0x27fd6d[_0x2f13('0x55')]});logger[_0x2f13('0x5b')](_0x2f13('0x90'),_0x27fd6d[_0x2f13('0x55')]);}},'complete':function(){try{var _0x198426=[];var _0x2cf8db=[];var _0x11c577=_0x2f13('0x30');if(_0x7d7e1[_0x2f13('0x91')]&&_0x7d7e1[_0x2f13('0x91')][_0x2f13('0x1c')]){_0x11c577=_0x2f13('0x92')+_0x254323;_0x198426['push'](_0x2f13('0x93')+_0x11c577+_0x2f13('0x94'));}tmp_campaigns=_0x2f13('0x95')+_0x254323;tmp_voice_queues=_0x2f13('0x96')+_0x254323;_0x2cf8db['push'](_0x2f13('0x93')+tmp_campaigns+_0x2f13('0x97'));_0x2cf8db[_0x2f13('0x19')](_0x2f13('0x93')+tmp_voice_queues+_0x2f13('0x97'));BPromise[_0x2f13('0x98')](_0x2cf8db,handleTZQuery)[_0x2f13('0x18')](function(_0x3f5dcc){updateTzCampaigns(_0x7d7e1[_0x2f13('0x29')])['then'](function(_0xa96ae4){updateTzVoiceQueues(_0x7d7e1[_0x2f13('0x29')])[_0x2f13('0x18')](function(_0x2db080){if(hasTZ)_0xe4d05e=_0xe4d05e['replace'](_0x2f13('0x65'),_0x2f13('0x99'));var _0x2620e8=util['format'](_0x2f13('0x9a'),_0x603b64,_0x11c577,_0xe4d05e,_0x7d7e1[_0x2f13('0x29')],_0x7d7e1[_0x2f13('0x4c')]||null,NOW,NOW);if(_[_0x2f13('0x1d')](_0x39ba2e['scheduledat'])){_0x2620e8+=_0x2f13('0x9b');}_0x198426[_0x2f13('0x19')](_0x2620e8);if(_0x7d7e1['duplicates']&&_0x7d7e1['duplicates']['length']){_0x198426[_0x2f13('0x19')](insertCmContact(_0x7d7e1['ListId'],_0x11c577,_0x7d7e1[_0x2f13('0x91')],_0x39ba2e));_0x198426[_0x2f13('0x19')]('DROP\x20TABLE\x20'+_0x11c577+';');}BPromise[_0x2f13('0x98')](_0x198426,handleQuery)[_0x2f13('0x18')](function(_0x4338a0){BPromise[_0x2f13('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x198426=[];for(var _0x5a9fbe=0x0;_0x5a9fbe\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger'];(function(_0x284e85,_0x1bfec9){var _0x59ba3d=function(_0x559559){while(--_0x559559){_0x284e85['push'](_0x284e85['shift']());}};_0x59ba3d(++_0x1bfec9);}(_0x8a5c,0x136));var _0xc8a5=function(_0x363a1e,_0x282481){_0x363a1e=_0x363a1e-0x0;var _0x58fa03=_0x8a5c[_0x363a1e];return _0x58fa03;};'use strict';var fs=require('fs');var path=require(_0xc8a5('0x0'));var _=require(_0xc8a5('0x1'));var Papa=require(_0xc8a5('0x2'));var util=require(_0xc8a5('0x3'));var BPromise=require(_0xc8a5('0x4'));var moment=require(_0xc8a5('0x5'));var squel=require(_0xc8a5('0x6'));var Redis=require(_0xc8a5('0x7'));var db=require(_0xc8a5('0x8'))['db'];var config=require('../../../config/environment');var logger=require(_0xc8a5('0x9'))(_0xc8a5('0xa'));config['redis']=_[_0xc8a5('0xb')](config[_0xc8a5('0xc')],{'host':_0xc8a5('0xd'),'port':0x18eb});var socket=require(_0xc8a5('0xe'))(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()[_0xc8a5('0xf')](_0xc8a5('0x10'));var tempTableName=_0xc8a5('0x11')+moment()[_0xc8a5('0xf')](_0xc8a5('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3b2ba3){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))*$/[_0xc8a5('0x13')](_0x3b2ba3);}function selectNotIn(_0x16fd9a,_0xea6d98,_0x533509,_0x566833,_0x15d9a0){return squel['select']()[_0xc8a5('0x14')](_0xc8a5('0x15'))[_0xc8a5('0x16')](_0x566833)[_0xc8a5('0x17')](_0xea6d98,null,_0xea6d98+_0xc8a5('0x18')+_0x566833+'.'+_0x533509)['where'](_0x566833+'.'+_0x533509+_0xc8a5('0x19')+_0x16fd9a+'.'+_0x533509)[_0xc8a5('0x1a')](_0xea6d98+'.dialCheckDuplicateType\x20IN\x20('+_0x15d9a0[_0xc8a5('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x33062b,_0x197ea9){promisesAdditionalPhones=[];promisesContact=[];return db[_0xc8a5('0x1b')][_0xc8a5('0x1c')](_0xc8a5('0x1d')+tempTableName)['spread'](function(_0xbc4806){if(_0xbc4806!==null){var _0x44d436=[];for(var _0x5cb7ff=0x0;_0x5cb7ff<_0xbc4806[_0xc8a5('0x1e')];_0x5cb7ff++){var _0x44179e=_0xbc4806[_0x5cb7ff];if(!_['isNil'](_0x44179e[_0xc8a5('0x15')])){if(!_[_0xc8a5('0x1f')](_0x44179e[_0xc8a5('0x20')]))_0x44d436[_0xc8a5('0x21')](insertAdditionalPhones(_0x44179e));promisesContact[_0xc8a5('0x21')]({'contact':_0x44179e});}}}Promise['all'](_0x44d436)[_0xc8a5('0x22')](function(){_0x33062b({'val':0x1});});})['catch'](function(_0xb4e8ae){logger[_0xc8a5('0x23')](_0xb4e8ae['message']);});});}function insertAdditionalPhones(_0x4c7c8a){return new Promise(function(_0x866737,_0x388c4e){var _0x1322da=_0x4c7c8a[_0xc8a5('0x20')];if(_[_0xc8a5('0x1f')](_0x1322da))_0x388c4e({'val':0x0});else{var _0x5411a7=_0x1322da['split'](';');var _0x3e2058=[];orderBy=0x0;for(var _0x3c7fe9=0x0;_0x3c7fe9<_0x5411a7[_0xc8a5('0x1e')];_0x3c7fe9++){_0x3e2058[_0xc8a5('0x21')](splitAdditionalPhone(_0x4c7c8a['id'],_0x5411a7[_0x3c7fe9]));}Promise[_0xc8a5('0x24')](_0x3e2058)[_0xc8a5('0x22')](function(){_0x866737({'val':_0x5411a7['length']});});}});}function splitAdditionalPhone(_0x1b3870,_0x3beb20){return new Promise(function(_0x266c59,_0x1e522c){var _0x276e3c=_0x3beb20[_0xc8a5('0x25')](':');var _0x3b325d=_0x276e3c[0x0];var _0x3bbbdc=_0x276e3c[0x1];if(_0x3bbbdc!==''){var _0x1ac715=_0x3bbbdc['split']('|');var _0x11e162=[];for(var _0x58576e=0x0;_0x58576e<_0x1ac715[_0xc8a5('0x1e')];_0x58576e++){if(_0x1ac715[_0x58576e]!==''){var _0x3539fd=_[_0xc8a5('0x26')](promisesAdditionalPhones,{'contactId':_0x1b3870,'phone':_0x1ac715[_0x58576e]});if(_0x3539fd[_0xc8a5('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0xc8a5('0x21')]({'contactId':_0x1b3870,'contactTypeId':_0x3b325d,'phone':_0x1ac715[_0x58576e],'orderBy':orderBy});}}}_0x266c59({'ok':0x1});}else _0x266c59({'res':0x0});});}function createAdditionalPhone(_0x483011,_0x4aa944,_0x9886,_0x4e0a4b){var _0x4ef3d7='';var _0x1d1513='';var _0x10972d=_0x9886[_0xc8a5('0x25')]('§');_0x4ef3d7=_0x10972d[0x0];if(_0x10972d[_0xc8a5('0x1e')]==0x2)_0x1d1513=_0x10972d[0x1];return new Promise(function(_0x16fa00,_0x31c416){return db['CmContactHasItem'][_0xc8a5('0x27')]({'where':{'CmContactId':_0x483011,'item':_0x4ef3d7}})[_0xc8a5('0x22')](function(_0x1c713f){if(_0x1c713f){return db[_0xc8a5('0x28')][_0xc8a5('0x29')]({'ItemTypeId':_0x4aa944,'description':_0x1d1513,'OrderBy':_0x4e0a4b},{'where':{'CmContactId':_0x483011,'item':_0x4ef3d7}})[_0xc8a5('0x22')](function(_0x4b47dc){_0x16fa00({'res':_0xc8a5('0x2a')});});}else{return db[_0xc8a5('0x28')][_0xc8a5('0x2b')]({'CmContactId':_0x483011,'item':_0x4ef3d7,'ItemTypeId':_0x4aa944,'description':_0x1d1513,'OrderBy':_0x4e0a4b,'ItemClass':_0xc8a5('0x2c')})['then'](function(_0x4d159f){_0x16fa00({'res':_0xc8a5('0x2d')});});}});});}function updateContact(_0x141fee){return new Promise(function(_0xe0efee,_0x127ea2){var _0x3824bf=_0x141fee['id'];delete _0x141fee['id'];return db['CmContact'][_0xc8a5('0x29')](_0x141fee,{'where':{'id':_0x3824bf}})['then'](function(_0x1c016c){updatedRows+=0x1;return db[_0xc8a5('0x2e')][_0xc8a5('0x29')]({'phone':_0x141fee['phone']},{'where':{'ContactId':_0x3824bf}})[_0xc8a5('0x22')](function(_0x290a9a){_0xe0efee({'ret':'OK'});});});});}function insertCmHopper(_0x3c4eb7,_0x575e39,_0xe5ec,_0x30f316,_0x5b6a8a){var _0x3424b2=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x575e39+'.'+_0x30f316,'cm_contacts.createdAt',_0xc8a5('0x2f'),'cm_contacts.priority',_0xc8a5('0x30'),'\x22'+_0x5b6a8a+'\x22'];return squel[_0xc8a5('0x31')]()[_0xc8a5('0x32')](_0xc8a5('0x33'))[_0xc8a5('0x34')]([_0xc8a5('0x15'),_0xc8a5('0x35'),'ContactId',_0xc8a5('0x36'),_0x30f316,_0xc8a5('0x37'),'updatedAt',_0xc8a5('0x38'),'UserId','recallme'],squel[_0xc8a5('0x39')]()[_0xc8a5('0x3a')](_0x3424b2)[_0xc8a5('0x16')](_0x575e39)['join']('cm_contacts',null,_0xc8a5('0x3b')+_0x575e39+_0xc8a5('0x3c'))[_0xc8a5('0x17')](_0xe5ec,null,_0xe5ec+_0xc8a5('0x18')+_0x575e39+'.'+_0x30f316)['where'](_0x575e39+_0xc8a5('0x3d'),_0x3c4eb7)[_0xc8a5('0x1a')](_0xc8a5('0x3e'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x575e39,_0xe5ec,_0x30f316,_0xc8a5('0x33'),[_0xc8a5('0x3f'),_0xc8a5('0x40')]))[_0xc8a5('0x1a')](_0xc8a5('0x41'),selectNotIn(_0x575e39,_0xe5ec,_0x30f316,'cm_hopper',[_0xc8a5('0x3f')])))['toString']();}function insertCmHopperBlack(_0x4b57f5,_0x4e5fb2,_0xda7b11,_0x3a5f8f){var _0x21aa6a=[_0xc8a5('0x42'),_0xc8a5('0x43'),_0xc8a5('0x44'),_0x4e5fb2+'.'+_0x3a5f8f,_0xc8a5('0x45'),_0xc8a5('0x2f')];return squel[_0xc8a5('0x31')]()[_0xc8a5('0x32')](_0xc8a5('0x46'))[_0xc8a5('0x34')]([_0xc8a5('0x15'),_0xc8a5('0x47'),'ListId',_0x3a5f8f,_0xc8a5('0x37'),_0xc8a5('0x48')],squel[_0xc8a5('0x39')]()[_0xc8a5('0x3a')](_0x21aa6a)[_0xc8a5('0x16')](_0x4e5fb2)[_0xc8a5('0x17')](_0xc8a5('0x49'),null,_0xc8a5('0x3b')+_0x4e5fb2+'.CmListId')['join'](_0xda7b11,null,_0xda7b11+_0xc8a5('0x18')+_0x4e5fb2+'.'+_0x3a5f8f)[_0xc8a5('0x1a')](_0x4e5fb2+_0xc8a5('0x3d'),_0x4b57f5)['where'](_0xc8a5('0x3e'),NOW)[_0xc8a5('0x1a')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xc8a5('0x39')]()[_0xc8a5('0x14')](_0xc8a5('0x15'))[_0xc8a5('0x16')]('cm_hopper_black')[_0xc8a5('0x1a')](_0xc8a5('0x4a'),_0x4b57f5)[_0xc8a5('0x1a')](_0x3a5f8f+_0xc8a5('0x4b'),_0x4e5fb2+'.'+_0x3a5f8f)))[_0xc8a5('0x4c')]();}function insertCmHopperAdditionalPhones(_0x45dddf){var _0x5d2435=[_0xc8a5('0x4d'),_0xc8a5('0x4e'),_0xc8a5('0x4f'),_0xc8a5('0x50'),_0xc8a5('0x51')];return squel[_0xc8a5('0x31')]()[_0xc8a5('0x32')](_0xc8a5('0x52'))[_0xc8a5('0x34')]([_0xc8a5('0x53'),_0xc8a5('0x15'),_0xc8a5('0x54'),_0xc8a5('0x37'),'updatedAt'],squel[_0xc8a5('0x39')]()['fields'](_0x5d2435)['from']('cm_hopper')[_0xc8a5('0x17')]('cm_contacts',null,_0xc8a5('0x55'))[_0xc8a5('0x17')](_0xc8a5('0x56'),null,_0xc8a5('0x57'))[_0xc8a5('0x1a')](_0xc8a5('0x58'),_0x45dddf)[_0xc8a5('0x1a')](_0xc8a5('0x3e'),NOW))[_0xc8a5('0x4c')]();}function insertCmContact(_0x4f9b24,_0x2c9d39,_0x3bbc46,_0x45d2da){var _0x229972=_[_0xc8a5('0x59')](_['keys'](_0x45d2da),[_0xc8a5('0x36'),_0xc8a5('0x5a'),_0xc8a5('0x37'),_0xc8a5('0x48')]);return squel[_0xc8a5('0x31')]()['into'](_0xc8a5('0x49'))['fromQuery'](_0x229972,squel[_0xc8a5('0x39')]()[_0xc8a5('0x3a')](_0x229972)['from'](_0x2c9d39)[_0xc8a5('0x1a')]('('+_0x3bbc46['join'](',')+_0xc8a5('0x5b'),squel[_0xc8a5('0x39')]()[_0xc8a5('0x3a')](_0x3bbc46)[_0xc8a5('0x16')](_0xc8a5('0x49'))[_0xc8a5('0x1a')](_0xc8a5('0x4a'),_0x4f9b24))[_0xc8a5('0x1a')]('id\x20IN\x20?',squel[_0xc8a5('0x39')]()[_0xc8a5('0x14')](_0xc8a5('0x5c'),_0xc8a5('0x5d'))['from'](_0x2c9d39)[_0xc8a5('0x5e')](_0x3bbc46[_0xc8a5('0x17')](','))))[_0xc8a5('0x4c')]();}function handleStop(){logger[_0xc8a5('0x5f')](_0xc8a5('0x60'));stopped=!![];}function handleUncaughtException(_0x31d636){logger[_0xc8a5('0x23')](_0x31d636[_0xc8a5('0x61')]);process['exit'](0x1);}function handleError(_0x8c7224,_0x4f6ff5){stats[_0xc8a5('0x62')]['push']({'name':_0x4f6ff5[_0xc8a5('0x63')],'message':_0x4f6ff5[_0xc8a5('0x61')],'row':_0x8c7224});}function handleQuery(_0x54ceb4){logger[_0xc8a5('0x5f')](_0x54ceb4);return db[_0xc8a5('0x1b')][_0xc8a5('0x1c')](_0x54ceb4)[_0xc8a5('0x64')](function(_0x199a3e){results[_0xc8a5('0x21')](_0x199a3e);})[_0xc8a5('0x65')](function(_0x1e52c2){logger['error'](_0x1e52c2['message']);});}function main(_0x177878,_0x43460b,_0x41d6e9,_0x515441){logger[_0xc8a5('0x5f')](_0xc8a5('0x66'),_0x177878,JSON['stringify'](_0x43460b));process['send'](_0xc8a5('0x67'));var _0x291cd1=_0x43460b['binding'];var _0x5cdb14=_[_0xc8a5('0x68')](_0x291cd1);var _0x23803c=_0x43460b[_0xc8a5('0x69')];var _0x43ffa5=path[_0xc8a5('0x17')](config[_0xc8a5('0x6a')],'server/files/tmp',_0x23803c+'.csv');logger[_0xc8a5('0x5f')](_0xc8a5('0x6b'),_0x43460b);db[_0xc8a5('0x6c')][_0xc8a5('0x6d')]({'raw':!![],'attributes':['id',_0xc8a5('0x6e')]})[_0xc8a5('0x22')](function(_0x22726e){for(var _0x3a3132=0x0;_0x3a3132<_0x22726e['length'];_0x3a3132++){if(_0x22726e[_0x3a3132][_0xc8a5('0x6e')]in _0x291cd1){contactItemTypes[_0xc8a5('0x21')](_0x22726e[_0x3a3132]);delete _0x5cdb14[_0x22726e[_0x3a3132][_0xc8a5('0x6e')]];hasAdditionalPhones=!![];}for(var _0x4a0fac in _0x291cd1){if(_0x22726e[_0x3a3132][_0xc8a5('0x6e')]+'_description'===_0x4a0fac){phoneDescriptions['push']({'itemTypeId':_0x22726e[_0x3a3132]['id'],'description':_0x4a0fac});delete _0x5cdb14[_0x4a0fac];}}}if(hasAdditionalPhones)_0x5cdb14['AdditionalPhones']='';var _0x15be7e=_['keys'](_0x5cdb14)[_0xc8a5('0x17')]();logger['info'](_0xc8a5('0x6f'),_0x15be7e);fs['writeFileSync'](_0x43ffa5,_0x15be7e+'\x0a');Papa[_0xc8a5('0x70')](fs['createReadStream'](_0x177878),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5aabf5,_0x3a92ea){try{for(var _0x40677c=0x0,_0x2147a7=[];_0x40677c<_0x5aabf5[_0xc8a5('0x71')][_0xc8a5('0x1e')];_0x40677c++){stats[_0xc8a5('0x72')]+=0x1;if(_0x5aabf5[_0xc8a5('0x62')][_0x40677c]){handleError(_0x5aabf5['data'][_0x40677c],_0x5aabf5[_0xc8a5('0x62')][_0x40677c]);}else{var _0x23f2cc=[];var _0x208ae1=[];var _0x24aed1={};for(var _0x3f2cce in _0x291cd1){let _0x5db36f=contactItemTypes[_0xc8a5('0x73')](_0x3bcf19=>_0x3bcf19['name']===_0x3f2cce);let _0x2cf07e=contactItemTypes[_0xc8a5('0x73')](_0x395d1b=>_0x395d1b[_0xc8a5('0x6e')]+_0xc8a5('0x74')===_0x3f2cce);if(_[_0xc8a5('0x1f')](_0x5db36f)&&_['isNil'](_0x2cf07e)){if(_0x291cd1[_0xc8a5('0x75')](_0x3f2cce)){if(_0x5aabf5[_0xc8a5('0x71')][_0x40677c][_0x291cd1[_0x3f2cce]]){var _0x51e069=_['trim'](_0x5aabf5[_0xc8a5('0x71')][_0x40677c][_0x291cd1[_0x3f2cce]]['replace'](/"/g,'\x27'));switch(_0x3f2cce){case _0xc8a5('0x35'):var _0x2ff188=moment(_0x51e069,_0xc8a5('0x10'),!![]);if(_0x2ff188[_0xc8a5('0x76')]()){_0x2147a7['push']('\x22'+_0x51e069+'\x22');}else{_0x23f2cc[_0xc8a5('0x21')](_0xc8a5('0x77'));}break;case _0xc8a5('0x38'):var _0x35f818=parseInt(_0x51e069);_0x51e069=_[_0xc8a5('0x78')](_0x35f818)||_0x35f818<0x0||_0x35f818>0x4?_0x515441?0x3:0x2:_0x35f818;_0x2147a7[_0xc8a5('0x21')]('\x22'+_0x51e069+'\x22');break;case _0xc8a5('0x79'):var _0x340bef=parseInt(_0x51e069);if(_[_0xc8a5('0x7a')](_0x340bef)&&_[_0xc8a5('0x7b')](_0x41d6e9,_0x340bef)){_0x2147a7[_0xc8a5('0x21')]('\x22'+_0x340bef+'\x22');}else{_0x23f2cc[_0xc8a5('0x21')](_0xc8a5('0x7c'));}break;case _0xc8a5('0x7d'):if(isEmail(_0x51e069)){_0x2147a7[_0xc8a5('0x21')]('\x22'+_0x51e069+'\x22');}else{_0x23f2cc['push'](_0xc8a5('0x7e'));}break;case _0xc8a5('0x7f'):var _0x272321=moment(_0x51e069,_0xc8a5('0x80'),!![]);if(_0x272321['isValid']()){_0x2147a7['push']('\x22'+_0x51e069+'\x22');}else{_0x23f2cc[_0xc8a5('0x21')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2147a7['push']('\x22'+_0x51e069+'\x22');}}else{switch(_0x3f2cce){case'firstName':case'phone':_0x23f2cc[_0xc8a5('0x21')](_0x3f2cce+'\x20not\x20specified');break;default:_0x2147a7[_0xc8a5('0x21')]('\x22\x22');}}}}else{var _0x3a69a0='';if(!_[_0xc8a5('0x1f')](_0x5db36f)){if(!_0x24aed1['hasOwnProperty'](_0x5db36f['id'])){for(var _0x295408=0x0;_0x295408<_0x291cd1[_0x3f2cce][_0xc8a5('0x1e')];_0x295408++){var _0x51e069=_[_0xc8a5('0x81')](_0x5aabf5[_0xc8a5('0x71')][_0x40677c][_0x291cd1[_0x3f2cce][_0x295408]][_0xc8a5('0x82')](/"/g,'\x27'));var _0x26ce18=phoneDescriptions[_0xc8a5('0x73')](_0x19331c=>_0x19331c['itemTypeId']===_0x5db36f['id']);if(!_['isNil'](_0x26ce18)){var _0x121cae=_[_0xc8a5('0x81')](_0x5aabf5[_0xc8a5('0x71')][_0x40677c][_0x291cd1[_0x26ce18[_0xc8a5('0x83')]][0x0]][_0xc8a5('0x82')](/"/g,'\x27'));if(!_[_0xc8a5('0x1f')](_0x121cae))_0x51e069=_0x51e069+'§'+_0x121cae;}if(_0x3a69a0=='')_0x3a69a0=_0x51e069;else _0x3a69a0+='|'+_0x51e069;}_0x208ae1[_0xc8a5('0x21')](_0x5db36f['id']+':'+_0x3a69a0);_0x24aed1[_0x5db36f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2147a7['push']('\x22'+_0x208ae1['join'](';')+'\x22');}if(_0x23f2cc[_0xc8a5('0x1e')]){handleError(_0x5aabf5[_0xc8a5('0x71')][_0x40677c],{'code':_0xc8a5('0x84'),'message':_0x23f2cc[_0xc8a5('0x17')]()});}else{fs[_0xc8a5('0x85')](_0x43ffa5,_0x2147a7[_0xc8a5('0x17')]()+'\x0a');}_0x2147a7=[];}if(!(stats['rows']%0xc8)){socket[_0xc8a5('0x86')](_0xc8a5('0x87')+_0x23803c,stats);stats[_0xc8a5('0x62')]=[];}}if(stopped){logger[_0xc8a5('0x5f')](_0xc8a5('0x88'));_0x3a92ea[_0xc8a5('0x89')]();}}catch(_0x325948){handleError(_0x5aabf5['data'][_0x40677c],{'code':'SystemError','message':_0x325948[_0xc8a5('0x61')]});logger['error'](_0xc8a5('0x8a'),_0x325948[_0xc8a5('0x61')]);}},'complete':function(){try{var _0x2c9948=[];var _0x545c95=tempTableName;_0x2c9948['push'](_0xc8a5('0x8b')+_0x545c95+_0xc8a5('0x8c'));logger[_0xc8a5('0x5f')](_0xc8a5('0x8d'),contactItemTypes[_0xc8a5('0x1e')]);var _0x1e4979=util[_0xc8a5('0xf')](_0xc8a5('0x8e'),_0x43ffa5,_0x545c95,_0x15be7e,_0x43460b['ListId'],_0x43460b[_0xc8a5('0x5a')]||null,NOW,NOW);if(_[_0xc8a5('0x1f')](_0x291cd1['scheduledat'])){_0x1e4979+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c9948['push'](_0x1e4979);BPromise['each'](_0x2c9948,handleQuery)[_0xc8a5('0x22')](function(_0x5a480c){BPromise[_0xc8a5('0x24')]([handleAdditionalPhones()])[_0xc8a5('0x22')](function(){_0x2c9948=[];for(var _0x376991=0x0;_0x376991\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','YYYYMMDDHHmmss','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','sequelize','query','spread','isNil','AdditionalPhones','push','all','catch','error','length','then','split','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','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_hopper_black','ListId\x20=\x20?','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','concat','keys','CompanyId','MIN(id)','info','Received\x20SIGINT','message','exit','errors','code','stringify','send','clone','root','server/files/tmp','body','findAll','name','_description','writeFileSync','createReadStream','data','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)'];(function(_0x4f9c64,_0x564953){var _0x19fae7=function(_0x5a80de){while(--_0x5a80de){_0x4f9c64['push'](_0x4f9c64['shift']());}};_0x19fae7(++_0x564953);}(_0xccbf,0x1ef));var _0xfccb=function(_0x99d2ab,_0x4d37ff){_0x99d2ab=_0x99d2ab-0x0;var _0x1ea8cd=_0xccbf[_0x99d2ab];return _0x1ea8cd;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xfccb('0x0'));var util=require(_0xfccb('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0xfccb('0x2'));var db=require(_0xfccb('0x3'))['db'];var config=require(_0xfccb('0x4'));var logger=require(_0xfccb('0x5'))(_0xfccb('0x6'));config[_0xfccb('0x7')]=_[_0xfccb('0x8')](config[_0xfccb('0x7')],{'host':_0xfccb('0x9'),'port':0x18eb});var socket=require(_0xfccb('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xfccb('0xb'));var tempTableName='cm_contacts_temp_'+moment()[_0xfccb('0xc')](_0xfccb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xdd1604){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))*$/[_0xfccb('0xe')](_0xdd1604);}function selectNotIn(_0x264220,_0x12bf65,_0x40d033,_0x596f5e,_0x29aad0){return squel['select']()[_0xfccb('0xf')](_0xfccb('0x10'))[_0xfccb('0x11')](_0x596f5e)[_0xfccb('0x12')](_0x12bf65,null,_0x12bf65+_0xfccb('0x13')+_0x596f5e+'.'+_0x40d033)['where'](_0x596f5e+'.'+_0x40d033+_0xfccb('0x14')+_0x264220+'.'+_0x40d033)[_0xfccb('0x15')](_0x12bf65+'.dialCheckDuplicateType\x20IN\x20('+_0x29aad0[_0xfccb('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1ac34f,_0xb86017){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfccb('0x16')][_0xfccb('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0xfccb('0x18')](function(_0x2c1cdb){if(_0x2c1cdb!==null){var _0x46c1f5=[];for(var _0x372b91=0x0;_0x372b91<_0x2c1cdb['length'];_0x372b91++){var _0xe2305b=_0x2c1cdb[_0x372b91];if(!_[_0xfccb('0x19')](_0xe2305b[_0xfccb('0x10')])){if(!_[_0xfccb('0x19')](_0xe2305b[_0xfccb('0x1a')]))_0x46c1f5[_0xfccb('0x1b')](insertAdditionalPhones(_0xe2305b));promisesContact['push']({'contact':_0xe2305b});}}}Promise[_0xfccb('0x1c')](_0x46c1f5)['then'](function(){_0x1ac34f({'val':0x1});});})[_0xfccb('0x1d')](function(_0x31c0ea){logger[_0xfccb('0x1e')](_0x31c0ea['message']);});});}function insertAdditionalPhones(_0x2b916b){return new Promise(function(_0x385272,_0x46c59a){var _0xb1d0d7=_0x2b916b[_0xfccb('0x1a')];if(_[_0xfccb('0x19')](_0xb1d0d7))_0x46c59a({'val':0x0});else{var _0x29a0e8=_0xb1d0d7['split'](';');var _0x5beeef=[];orderBy=0x0;for(var _0x2baa04=0x0;_0x2baa04<_0x29a0e8[_0xfccb('0x1f')];_0x2baa04++){_0x5beeef['push'](splitAdditionalPhone(_0x2b916b['id'],_0x29a0e8[_0x2baa04]));}Promise[_0xfccb('0x1c')](_0x5beeef)[_0xfccb('0x20')](function(){_0x385272({'val':_0x29a0e8[_0xfccb('0x1f')]});});}});}function splitAdditionalPhone(_0x2087c6,_0x2da9df){return new Promise(function(_0x5c382a,_0x3a86ed){var _0xd086a4=_0x2da9df[_0xfccb('0x21')](':');var _0x30abcc=_0xd086a4[0x0];var _0x34649=_0xd086a4[0x1];if(_0x34649!==''){var _0xc64685=_0x34649['split']('|');var _0x42a51f=[];for(var _0x67343c=0x0;_0x67343c<_0xc64685['length'];_0x67343c++){if(_0xc64685[_0x67343c]!==''){var _0x29e5fa=_['filter'](promisesAdditionalPhones,{'contactId':_0x2087c6,'phone':_0xc64685[_0x67343c]});if(_0x29e5fa[_0xfccb('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xfccb('0x1b')]({'contactId':_0x2087c6,'contactTypeId':_0x30abcc,'phone':_0xc64685[_0x67343c],'orderBy':orderBy});}}}_0x5c382a({'ok':0x1});}else _0x5c382a({'res':0x0});});}function createAdditionalPhone(_0x6ba751,_0x2dc7d1,_0x54834f,_0x1cd3c4){var _0x1b5f4e='';var _0x5da41c='';var _0x1e0cfc=_0x54834f[_0xfccb('0x21')]('§');_0x1b5f4e=_0x1e0cfc[0x0];if(_0x1e0cfc[_0xfccb('0x1f')]==0x2)_0x5da41c=_0x1e0cfc[0x1];return new Promise(function(_0x46b979,_0x5314b8){return db[_0xfccb('0x22')][_0xfccb('0x23')]({'where':{'CmContactId':_0x6ba751,'item':_0x1b5f4e}})[_0xfccb('0x20')](function(_0x3286f1){if(_0x3286f1){return db[_0xfccb('0x22')]['update']({'ItemTypeId':_0x2dc7d1,'description':_0x5da41c,'OrderBy':_0x1cd3c4},{'where':{'CmContactId':_0x6ba751,'item':_0x1b5f4e}})[_0xfccb('0x20')](function(_0x3d3ff3){_0x46b979({'res':_0xfccb('0x24')});});}else{return db[_0xfccb('0x22')][_0xfccb('0x25')]({'CmContactId':_0x6ba751,'item':_0x1b5f4e,'ItemTypeId':_0x2dc7d1,'description':_0x5da41c,'OrderBy':_0x1cd3c4,'ItemClass':_0xfccb('0x26')})[_0xfccb('0x20')](function(_0x18fb74){_0x46b979({'res':_0xfccb('0x27')});});}});});}function updateContact(_0xd210d1){return new Promise(function(_0x5c8131,_0xa530b7){var _0x43f991=_0xd210d1['id'];delete _0xd210d1['id'];return db[_0xfccb('0x28')][_0xfccb('0x29')](_0xd210d1,{'where':{'id':_0x43f991}})[_0xfccb('0x20')](function(_0x556515){updatedRows+=0x1;return db[_0xfccb('0x2a')][_0xfccb('0x29')]({'phone':_0xd210d1[_0xfccb('0x10')]},{'where':{'ContactId':_0x43f991}})[_0xfccb('0x20')](function(_0x1b01d6){_0x5c8131({'ret':'OK'});});});});}function insertCmHopper(_0x48f81d,_0x5330b4,_0x3f186d,_0x3d3465,_0x3f859e){var _0x39814a=[_0xfccb('0x2b'),_0xfccb('0x2c'),_0xfccb('0x2d'),_0xfccb('0x2e'),_0x5330b4+'.'+_0x3d3465,_0xfccb('0x2f'),_0xfccb('0x30'),_0xfccb('0x31'),_0xfccb('0x32'),'\x22'+_0x3f859e+'\x22'];return squel[_0xfccb('0x33')]()[_0xfccb('0x34')]('cm_hopper')[_0xfccb('0x35')]([_0xfccb('0x10'),_0xfccb('0x36'),_0xfccb('0x37'),_0xfccb('0x38'),_0x3d3465,_0xfccb('0x39'),_0xfccb('0x3a'),'priority',_0xfccb('0x3b'),_0xfccb('0x3c')],squel[_0xfccb('0x3d')]()[_0xfccb('0x3e')](_0x39814a)[_0xfccb('0x11')](_0x5330b4)['join'](_0xfccb('0x3f'),null,_0xfccb('0x40')+_0x5330b4+_0xfccb('0x41'))[_0xfccb('0x12')](_0x3f186d,null,_0x3f186d+_0xfccb('0x13')+_0x5330b4+'.'+_0x3d3465)[_0xfccb('0x15')](_0x5330b4+_0xfccb('0x42'),_0x48f81d)[_0xfccb('0x15')](_0xfccb('0x43'),NOW)[_0xfccb('0x15')](_0xfccb('0x44'),selectNotIn(_0x5330b4,_0x3f186d,_0x3d3465,_0xfccb('0x45'),[_0xfccb('0x46'),_0xfccb('0x47')]))[_0xfccb('0x15')](_0xfccb('0x44'),selectNotIn(_0x5330b4,_0x3f186d,_0x3d3465,'cm_hopper',[_0xfccb('0x46')])))[_0xfccb('0x48')]();}function insertCmHopperBlack(_0x2af5b4,_0x13fcce,_0x4b7cd5,_0x16da43){var _0x42bed8=[_0xfccb('0x2b'),'cm_contacts.id',_0xfccb('0x2e'),_0x13fcce+'.'+_0x16da43,'cm_contacts.createdAt',_0xfccb('0x30')];return squel[_0xfccb('0x33')]()['into'](_0xfccb('0x49'))[_0xfccb('0x35')]([_0xfccb('0x10'),_0xfccb('0x37'),_0xfccb('0x38'),_0x16da43,_0xfccb('0x39'),_0xfccb('0x3a')],squel[_0xfccb('0x3d')]()[_0xfccb('0x3e')](_0x42bed8)[_0xfccb('0x11')](_0x13fcce)['join'](_0xfccb('0x3f'),null,_0xfccb('0x40')+_0x13fcce+_0xfccb('0x41'))['join'](_0x4b7cd5,null,_0x4b7cd5+_0xfccb('0x13')+_0x13fcce+'.'+_0x16da43)[_0xfccb('0x15')](_0x13fcce+_0xfccb('0x42'),_0x2af5b4)[_0xfccb('0x15')](_0xfccb('0x43'),NOW)['where'](_0xfccb('0x44'),squel['select']()[_0xfccb('0xf')]('phone')[_0xfccb('0x11')]('cm_hopper_black')[_0xfccb('0x15')](_0xfccb('0x4a'),_0x2af5b4)[_0xfccb('0x15')](_0x16da43+'\x20=\x20?',_0x13fcce+'.'+_0x16da43)))[_0xfccb('0x48')]();}function insertCmHopperAdditionalPhones(_0x5804f6){var _0x55f17a=[_0xfccb('0x4b'),_0xfccb('0x4c'),_0xfccb('0x4d'),'cm_contact_has_items.createdAt',_0xfccb('0x4e')];return squel[_0xfccb('0x33')]()[_0xfccb('0x34')](_0xfccb('0x4f'))[_0xfccb('0x35')](['CmHopperId','phone',_0xfccb('0x50'),_0xfccb('0x39'),'updatedAt'],squel[_0xfccb('0x3d')]()['fields'](_0x55f17a)[_0xfccb('0x11')](_0xfccb('0x45'))[_0xfccb('0x12')](_0xfccb('0x3f'),null,_0xfccb('0x51'))[_0xfccb('0x12')](_0xfccb('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xfccb('0x15')]('cm_hopper.ListId\x20=\x20?',_0x5804f6)['where'](_0xfccb('0x43'),NOW))['toString']();}function insertCmContact(_0x3d86ef,_0x492482,_0x3bf2c0,_0x29090e){var _0x37aced=_[_0xfccb('0x53')](_[_0xfccb('0x54')](_0x29090e),[_0xfccb('0x38'),_0xfccb('0x55'),_0xfccb('0x39'),_0xfccb('0x3a')]);return squel['insert']()[_0xfccb('0x34')](_0xfccb('0x3f'))[_0xfccb('0x35')](_0x37aced,squel['select']()[_0xfccb('0x3e')](_0x37aced)[_0xfccb('0x11')](_0x492482)[_0xfccb('0x15')]('('+_0x3bf2c0[_0xfccb('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0xfccb('0x3d')]()['fields'](_0x3bf2c0)[_0xfccb('0x11')](_0xfccb('0x3f'))['where']('ListId\x20=\x20?',_0x3d86ef))[_0xfccb('0x15')]('id\x20IN\x20?',squel[_0xfccb('0x3d')]()[_0xfccb('0xf')](_0xfccb('0x56'),'min_id')[_0xfccb('0x11')](_0x492482)['group'](_0x3bf2c0[_0xfccb('0x12')](','))))[_0xfccb('0x48')]();}function handleStop(){logger[_0xfccb('0x57')](_0xfccb('0x58'));stopped=!![];}function handleUncaughtException(_0x597a13){logger[_0xfccb('0x1e')](_0x597a13[_0xfccb('0x59')]);process[_0xfccb('0x5a')](0x1);}function handleError(_0xaa228d,_0x364c11){stats[_0xfccb('0x5b')]['push']({'name':_0x364c11[_0xfccb('0x5c')],'message':_0x364c11[_0xfccb('0x59')],'row':_0xaa228d});}function handleQuery(_0x29f6d2){logger[_0xfccb('0x57')](_0x29f6d2);return db['sequelize'][_0xfccb('0x17')](_0x29f6d2)[_0xfccb('0x18')](function(_0x6c1e39){results[_0xfccb('0x1b')](_0x6c1e39);})[_0xfccb('0x1d')](function(_0x9f3ec9){logger['error'](_0x9f3ec9[_0xfccb('0x59')]);});}function main(_0x3db3e4,_0x2014d6,_0x5d19eb,_0x5b4bef){logger['info']('main',_0x3db3e4,JSON[_0xfccb('0x5d')](_0x2014d6));process[_0xfccb('0x5e')]('start');var _0x376276=_0x2014d6['binding'];var _0x18febf=_[_0xfccb('0x5f')](_0x376276);var _0x251e58=_0x2014d6['socket_timestamp'];var _0x452117=path[_0xfccb('0x12')](config[_0xfccb('0x60')],_0xfccb('0x61'),_0x251e58+'.csv');logger['info'](_0xfccb('0x62'),_0x2014d6);db['ContactItemType'][_0xfccb('0x63')]({'raw':!![],'attributes':['id',_0xfccb('0x64')]})[_0xfccb('0x20')](function(_0x1bcbff){for(var _0x46e0cf=0x0;_0x46e0cf<_0x1bcbff['length'];_0x46e0cf++){if(_0x1bcbff[_0x46e0cf][_0xfccb('0x64')]in _0x376276){contactItemTypes[_0xfccb('0x1b')](_0x1bcbff[_0x46e0cf]);delete _0x18febf[_0x1bcbff[_0x46e0cf][_0xfccb('0x64')]];hasAdditionalPhones=!![];}for(var _0x5d3851 in _0x376276){if(_0x1bcbff[_0x46e0cf]['name']+_0xfccb('0x65')===_0x5d3851){phoneDescriptions[_0xfccb('0x1b')]({'itemTypeId':_0x1bcbff[_0x46e0cf]['id'],'description':_0x5d3851});delete _0x18febf[_0x5d3851];}}}if(hasAdditionalPhones)_0x18febf[_0xfccb('0x1a')]='';var _0xbb6cdd=_['keys'](_0x18febf)[_0xfccb('0x12')]();logger[_0xfccb('0x57')]('header',_0xbb6cdd);fs[_0xfccb('0x66')](_0x452117,_0xbb6cdd+'\x0a');Papa['parse'](fs[_0xfccb('0x67')](_0x3db3e4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x45dd06,_0x2749ae){try{for(var _0x4fad84=0x0,_0x1d03e8=[];_0x4fad84<_0x45dd06[_0xfccb('0x68')]['length'];_0x4fad84++){stats['rows']+=0x1;if(_0x45dd06[_0xfccb('0x5b')][_0x4fad84]){handleError(_0x45dd06['data'][_0x4fad84],_0x45dd06[_0xfccb('0x5b')][_0x4fad84]);}else{var _0x153075=[];var _0x4d76c8=[];var _0x163b1f={};for(var _0xe50c31 in _0x376276){let _0x40f1fb=contactItemTypes[_0xfccb('0x69')](_0x5856f7=>_0x5856f7[_0xfccb('0x64')]===_0xe50c31);let _0x5eae46=contactItemTypes[_0xfccb('0x69')](_0x649fef=>_0x649fef[_0xfccb('0x64')]+'_description'===_0xe50c31);if(_[_0xfccb('0x19')](_0x40f1fb)&&_[_0xfccb('0x19')](_0x5eae46)){if(_0x376276[_0xfccb('0x6a')](_0xe50c31)){if(_0x45dd06[_0xfccb('0x68')][_0x4fad84][_0x376276[_0xe50c31]]){var _0x1b72c8=_[_0xfccb('0x6b')](_0x45dd06[_0xfccb('0x68')][_0x4fad84][_0x376276[_0xe50c31]]['replace'](/"/g,'\x27'));switch(_0xe50c31){case _0xfccb('0x36'):var _0x51fe66=moment(_0x1b72c8,_0xfccb('0xb'),!![]);if(_0x51fe66['isValid']()){_0x1d03e8[_0xfccb('0x1b')]('\x22'+_0x1b72c8+'\x22');}else{_0x153075[_0xfccb('0x1b')](_0xfccb('0x6c'));}break;case _0xfccb('0x6d'):var _0x52b24f=parseInt(_0x1b72c8);_0x1b72c8=_['isNaN'](_0x52b24f)||_0x52b24f<0x0||_0x52b24f>0x4?_0x5b4bef?0x3:0x2:_0x52b24f;_0x1d03e8[_0xfccb('0x1b')]('\x22'+_0x1b72c8+'\x22');break;case'UserId':var _0x4a5935=parseInt(_0x1b72c8);if(_['isNumber'](_0x4a5935)&&_[_0xfccb('0x6e')](_0x5d19eb,_0x4a5935)){_0x1d03e8['push']('\x22'+_0x4a5935+'\x22');}else{_0x153075[_0xfccb('0x1b')]('agent\x20not\x20exists');}break;case _0xfccb('0x6f'):if(isEmail(_0x1b72c8)){_0x1d03e8[_0xfccb('0x1b')]('\x22'+_0x1b72c8+'\x22');}else{_0x153075[_0xfccb('0x1b')](_0xfccb('0x70'));}break;case _0xfccb('0x71'):var _0x433d5f=moment(_0x1b72c8,_0xfccb('0x72'),!![]);if(_0x433d5f['isValid']()){_0x1d03e8[_0xfccb('0x1b')]('\x22'+_0x1b72c8+'\x22');}else{_0x153075['push'](_0xfccb('0x73'));}break;default:_0x1d03e8[_0xfccb('0x1b')]('\x22'+_0x1b72c8+'\x22');}}else{switch(_0xe50c31){case _0xfccb('0x74'):case'phone':_0x153075['push'](_0xe50c31+_0xfccb('0x75'));break;default:_0x1d03e8[_0xfccb('0x1b')]('\x22\x22');}}}}else{var _0x215564='';if(!_[_0xfccb('0x19')](_0x40f1fb)){if(!_0x163b1f[_0xfccb('0x6a')](_0x40f1fb['id'])){for(var _0x106595=0x0;_0x106595<_0x376276[_0xe50c31][_0xfccb('0x1f')];_0x106595++){var _0x1b72c8=_[_0xfccb('0x6b')](_0x45dd06[_0xfccb('0x68')][_0x4fad84][_0x376276[_0xe50c31][_0x106595]][_0xfccb('0x76')](/"/g,'\x27'));var _0xa7e78a=phoneDescriptions[_0xfccb('0x69')](_0x5c90de=>_0x5c90de[_0xfccb('0x77')]===_0x40f1fb['id']);if(!_[_0xfccb('0x19')](_0xa7e78a)){var _0x2ab1cc=_[_0xfccb('0x6b')](_0x45dd06[_0xfccb('0x68')][_0x4fad84][_0x376276[_0xa7e78a[_0xfccb('0x78')]][0x0]][_0xfccb('0x76')](/"/g,'\x27'));if(!_[_0xfccb('0x19')](_0x2ab1cc))_0x1b72c8=_0x1b72c8+'§'+_0x2ab1cc;}if(_0x215564=='')_0x215564=_0x1b72c8;else _0x215564+='|'+_0x1b72c8;}_0x4d76c8['push'](_0x40f1fb['id']+':'+_0x215564);_0x163b1f[_0x40f1fb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d03e8['push']('\x22'+_0x4d76c8[_0xfccb('0x12')](';')+'\x22');}if(_0x153075[_0xfccb('0x1f')]){handleError(_0x45dd06[_0xfccb('0x68')][_0x4fad84],{'code':_0xfccb('0x79'),'message':_0x153075[_0xfccb('0x12')]()});}else{fs[_0xfccb('0x7a')](_0x452117,_0x1d03e8[_0xfccb('0x12')]()+'\x0a');}_0x1d03e8=[];}if(!(stats['rows']%0xc8)){socket[_0xfccb('0x7b')](_0xfccb('0x7c')+_0x251e58,stats);stats[_0xfccb('0x5b')]=[];}}if(stopped){logger[_0xfccb('0x57')](_0xfccb('0x7d'));_0x2749ae['abort']();}}catch(_0x37defa){handleError(_0x45dd06[_0xfccb('0x68')][_0x4fad84],{'code':_0xfccb('0x7e'),'message':_0x37defa[_0xfccb('0x59')]});logger['error'](_0xfccb('0x7f'),_0x37defa[_0xfccb('0x59')]);}},'complete':function(){try{var _0x59b919=[];var _0x2370de=tempTableName;_0x59b919['push'](_0xfccb('0x80')+_0x2370de+'\x20LIKE\x20cm_contacts;');logger['info']('CIS\x20len',contactItemTypes['length']);var _0x1f85a3=util[_0xfccb('0xc')](_0xfccb('0x81'),_0x452117,_0x2370de,_0xbb6cdd,_0x2014d6[_0xfccb('0x38')],_0x2014d6[_0xfccb('0x55')]||null,NOW,NOW);if(_['isNil'](_0x376276[_0xfccb('0x36')])){_0x1f85a3+=_0xfccb('0x82');}_0x59b919[_0xfccb('0x1b')](_0x1f85a3);BPromise[_0xfccb('0x83')](_0x59b919,handleQuery)['then'](function(_0xeb2594){BPromise[_0xfccb('0x1c')]([handleAdditionalPhones()])[_0xfccb('0x20')](function(){_0x59b919=[];for(var _0x2eb3f0=0x0;_0x2eb3f0\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','TagIds','limit','offset','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x460e,0x1b5));var _0xe460=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x460e[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xe460('0x0'));var squel=require(_0xe460('0x1'));var as=require(_0xe460('0x2'));var qs=require(_0xe460('0x3'));var updateInteraction=require(_0xe460('0x4'))['updateInteraction'];var utils=require(_0xe460('0x5'));var db=require(_0xe460('0x6'))['db'];function skipInteractionsQuery(_0x20755c,_0x427275,_0x23d94b){var _0x8389a3=![];var _0x47e032=utils[_0xe460('0x7')](_0x20755c);if(_0x427275[_0xe460('0x8')]==='agent'&&!_0x23d94b[_0xe460('0x9')]&&!_0x23d94b[_0x47e032]){_0x8389a3=!![];}return _0x8389a3;}function getTagsQuery(){return squel[_0xe460('0xa')]()[_0xe460('0xb')]('id')[_0xe460('0xb')](_0xe460('0xc'))[_0xe460('0xb')](_0xe460('0xd'))[_0xe460('0xe')](_0xe460('0xf'));}function getUsersQuery(_0x28e014,_0x40d324){var _0x4d4c05=utils[_0xe460('0x10')](_0x28e014);var _0x9545b5=_0xe460('0x11')+_0x28e014+_0xe460('0x12');var _0x5ea829=squel[_0xe460('0xa')]()['field'](_0xe460('0x13'))[_0xe460('0xb')](_0xe460('0x14'))[_0xe460('0xb')](_0xe460('0x15')+_0x4d4c05)[_0xe460('0xe')](_0x9545b5,'ui')[_0xe460('0x16')](_0xe460('0x17'),'u',_0xe460('0x18'));if(_0x40d324[_0xe460('0x19')]>0x0){_0x5ea829[_0xe460('0x1a')](_0xe460('0x15')+_0x4d4c05+_0xe460('0x1b'),_[_0xe460('0x1c')](_0x40d324,'id'));}return _0x5ea829;}function getInteractionsQuery(_0x5eec01){var _0x3598f5=utils[_0xe460('0x1d')](_0x5eec01);var _0x5dcba2=utils[_0xe460('0x7')](_0x5eec01);var _0xeab527=utils[_0xe460('0x10')](_0x5eec01);return squel[_0xe460('0xa')]()['from'](_0x3598f5[_0xe460('0x1e')],'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe460('0x16')]('users','o','o.id\x20=\x20i.UserId')[_0xe460('0x16')](_0x3598f5[_0xe460('0x1f')],'a',_0xe460('0x20')+_0x5dcba2)[_0xe460('0x16')](_0x3598f5[_0xe460('0x21')],'me',_0xe460('0x22')+_0xeab527+_0xe460('0x23'))['left_join'](_0x3598f5[_0xe460('0x24')],'it',_0xe460('0x25')+_0xeab527+_0xe460('0x23'))[_0xe460('0x16')](_0xe460('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x27fc0c={'body':squel[_0xe460('0x26')](),'contact':squel[_0xe460('0x26')](),'default':squel[_0xe460('0x26')](),'fields':squel[_0xe460('0x26')](),'filter':squel[_0xe460('0x26')](),'read':squel[_0xe460('0x26')](),'tags':{'clause':squel[_0xe460('0x26')](),'ids':null},'user':squel[_0xe460('0x26')]()};return _0x27fc0c;}function parseTagParameter(_0x2f1a51){var _0x32858d=squel['expr']();if(_0x2f1a51){var _0x3728c7=utils[_0xe460('0x27')](_0x2f1a51);_0x3728c7['forEach'](function(_0x398cbd){_0x32858d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x398cbd+',%');});}return _0x32858d;}function parseReadParameter(_0x29db36){var _0x21005a='';if(_0x29db36){_0x21005a=_0xe460('0x28');if(_0x29db36==='1'){_0x21005a=_0x21005a[_0xe460('0x29')](_0xe460('0x2a'),'=');}else{_0x21005a=_0x21005a['replace'](_0xe460('0x2a'),'>');}}return _0x21005a;}function parseSearchFilter(_0xb3077f,_0x4b59be){var _0x25275c=squel[_0xe460('0x26')]();if(_0x4b59be){var _0x57d0ee=_0x4b59be[_0xe460('0x29')]('\x5c','\x5c\x5c')[_0xe460('0x29')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x57d0ee)){_0x25275c['or']('i.id\x20LIKE\x20?',_0x57d0ee+'%');if([_0xe460('0x2b'),_0xe460('0x2c')]['includes'](_0xb3077f)){_0x25275c['or'](_0xe460('0x2d'),_0x57d0ee+'%');}else if(_0xb3077f===_0xe460('0x2e')){_0x25275c['or'](_0xe460('0x2f'),_0x57d0ee+'%');}else if(_0xb3077f==='openchannel'){_0x25275c['or'](_0xe460('0x30'),_0x57d0ee+'%');}}else if(_0xb3077f===_0xe460('0x31')&&qs[_0xe460('0x32')](_0x57d0ee)){_0x25275c['or'](_0xe460('0x33'),_0x57d0ee+'%');}else{if(_0xb3077f==='mail'){_0x25275c['or'](_0xe460('0x34'),qs[_0xe460('0x35')](_0x57d0ee,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x57d0ee));}else if(_0xb3077f!==_0xe460('0x2e')){_0x25275c['or'](_0xe460('0x36'),qs['getFullTextValue'](_0x57d0ee));}_0x25275c['or'](_0xe460('0x37'),qs['getFullTextValue'](_0x57d0ee,!![]),null);}}return _0x25275c;}function parseAdvancedSearchFilter(_0x145d77,_0x2b8104){var _0x536bef=getSqlClauses();var _0x2015a7=as['parseSearch'](_0x145d77);var _0x4fe8a6=_0x2015a7[_0xe460('0x38')];for(var _0x5f0ced=0x0;_0x5f0ced<_0x2015a7['conditions'][_0xe460('0x19')];_0x5f0ced++){var _0xbf3484=_0x2015a7[_0xe460('0x39')][_0x5f0ced];var _0x338ed0='i';var _0xe936e0=_['find'](_0x2b8104,[_0xe460('0xc'),_0xbf3484[_0xe460('0xb')]]);if(_0xe936e0){var _0x32926d=as[_0xe460('0x3a')](_0x338ed0,_0xe936e0[_0xe460('0x3b')],_0xbf3484);_0x536bef['default'][_0x4fe8a6](_0x32926d[_0xe460('0x3c')],_0x32926d[_0xe460('0x3d')][_0xe460('0x3e')],_0x32926d['value'][_0xe460('0x3f')]);}else{switch(_0xbf3484[_0xe460('0xb')]){case _0xe460('0x40'):var _0x52976c=parseReadParameter(_0xbf3484['value']);_0x536bef[_0xe460('0x41')][_0xe460('0x42')](_0x52976c);break;case _0xe460('0x43'):if(_0xbf3484['operator']===_0xe460('0x44')){if(_0xbf3484[_0xe460('0x3d')]['split']('\x20')[_0xe460('0x19')]>0x1){_0x536bef[_0xe460('0x45')][_0x4fe8a6](_0xe460('0x37'),qs[_0xe460('0x35')](_0xbf3484[_0xe460('0x3d')],!![]),null);}else{var _0x87cb3d='%'+_0xbf3484[_0xe460('0x3d')]+'%';_0x536bef[_0xe460('0x45')][_0x4fe8a6](_0xe460('0x46'),_0x87cb3d,_0x87cb3d,_0x87cb3d);}}else{_0xe936e0=_[_0xe460('0x47')](_0x2b8104,[_0xe460('0xc'),'ContactId']);_0xbf3484[_0xe460('0xb')]=_0xe460('0x48');_0x32926d=as[_0xe460('0x3a')](_0x338ed0,_0xe936e0[_0xe460('0x3b')],_0xbf3484);_0x536bef['contact'][_0x4fe8a6](_0x32926d[_0xe460('0x3c')],_0x32926d[_0xe460('0x3d')][_0xe460('0x3e')],_0x32926d['value'][_0xe460('0x3f')]);}break;case _0xe460('0x49'):var _0x1731bb=_0xbf3484[_0xe460('0x3d')][_0xe460('0x4a')](',')[_0xe460('0x1c')](function(_0x4ad865){return Number(_0x4ad865);});var _0x8e96b=parseTagParameter(_0x1731bb);_0x536bef[_0xe460('0x4b')][_0xe460('0x4c')]['and'](_0x8e96b);_0x536bef[_0xe460('0x4b')][_0xe460('0x4d')]=_0x1731bb;break;case _0xe460('0x4e'):if(_0xbf3484['operator']==='$substring'){_0x536bef[_0xe460('0x4f')][_0x4fe8a6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xbf3484[_0xe460('0x3d')]+'%',null);}else{_0xe936e0=_[_0xe460('0x47')](_0x2b8104,[_0xe460('0xc'),_0xe460('0x50')]);_0xbf3484[_0xe460('0xb')]=_0xe460('0x50');_0x32926d=as['buildExpression'](_0x338ed0,_0xe936e0[_0xe460('0x3b')],_0xbf3484);_0x536bef[_0xe460('0x4f')][_0x4fe8a6](_0x32926d['text'],_0x32926d[_0xe460('0x3d')][_0xe460('0x3e')],_0x32926d[_0xe460('0x3d')][_0xe460('0x3f')]);}break;case _0xe460('0x51'):case _0xe460('0x52'):_0x32926d=as[_0xe460('0x3a')]('me',null,_0xbf3484);_0x536bef[_0xe460('0x51')][_0x4fe8a6](_0x32926d[_0xe460('0x3c')],_0x32926d[_0xe460('0x3d')]['start'],_0x32926d[_0xe460('0x3d')][_0xe460('0x3f')]);break;}}}return _0x536bef;}function parseModelFields(_0x2f9041,_0x3d1b29,_0x3df416){var _0x338200=utils['getAccountFK'](_0x2f9041);var _0x5e0f46=squel[_0xe460('0x26')]();var _0x2b5449=_(_0x3d1b29)[_0xe460('0x53')]()[_0xe460('0x1c')](function(_0x40fe99){return _[_0xe460('0x54')](_0x3df416,[_0xe460('0xc'),_0x40fe99])?_0x40fe99:undefined;})[_0xe460('0x55')]()[_0xe460('0x3d')]();if(_0x2b5449['length']>0x0){_0x2b5449['forEach'](function(_0xe68297){if(_0xe68297===_0x338200){_0x5e0f46[_0xe460('0x42')]('i.'+_0x338200+_0xe460('0x1b'),[][_0xe460('0x56')](_0x3d1b29[_0xe68297]));}else if(_0xe68297===_0xe460('0x57')){var _0x12a680=JSON[_0xe460('0x58')](_0x3d1b29[_0xe68297])[_0xe460('0x59')];var _0x10a5ef=JSON[_0xe460('0x58')](_0x3d1b29[_0xe68297])[_0xe460('0x5a')];_0x5e0f46[_0xe460('0x42')](_0xe460('0x5b'),_0x12a680,_0x10a5ef);}else{if(_0x3d1b29[_0xe68297]===_0xe460('0x5c')){_0x5e0f46[_0xe460('0x42')]('i.'+_0xe68297+_0xe460('0x5d'));}else{_0x5e0f46['and']('i.'+_0xe68297+'\x20=\x20?',_0x3d1b29[_0xe68297]);}}});}return _0x5e0f46;}function parseQueryParameters(_0x11563c,_0x4757b8,_0x54556e){var _0x1e1f91=getSqlClauses();return Promise[_0xe460('0x5e')]()[_0xe460('0x5f')](function(){return parseModelFields(_0x11563c,_0x4757b8,_0x54556e);})['then'](function(_0x4be11a){_0x1e1f91[_0xe460('0x60')][_0xe460('0x42')](_0x4be11a);return parseReadParameter(_0x4757b8['read']);})[_0xe460('0x5f')](function(_0x5003af){_0x1e1f91[_0xe460('0x41')][_0xe460('0x42')](_0x5003af);return parseTagParameter(_0x4757b8[_0xe460('0x61')]);})['then'](function(_0x50cffb){_0x1e1f91[_0xe460('0x4b')][_0xe460('0x4c')][_0xe460('0x42')](_0x50cffb);return parseSearchFilter(_0x11563c,_0x4757b8['filter']);})[_0xe460('0x5f')](function(_0x471294){_0x1e1f91[_0xe460('0x62')]=_0x471294;return _0x1e1f91;});}function checkAccountsRestrictions(_0x4bcc09,_0x542543,_0x205303){var _0x44483f=utils[_0xe460('0x7')](_0x4bcc09);var _0x585c05=_0xe460('0x63')+_['capitalize'](_0x4bcc09)+(_0x4bcc09==='chat'?_0xe460('0x64'):_0xe460('0x65'));var _0x27625d=squel[_0xe460('0x26')]();return Promise[_0xe460('0x5e')]()['then'](function(){if(_0x205303[_0xe460('0x9')]&&_0x542543[_0xe460('0x8')]===_0xe460('0x66')){return _0x542543[_0x585c05]({'attributes':['id'],'raw':!![]});}})[_0xe460('0x5f')](function(_0x5b2b41){if(_0x5b2b41){if(_0x5b2b41[_0xe460('0x19')]===0x0){_0x27625d[_0xe460('0x42')]('i.'+_0x44483f+_0xe460('0x5d'));}else{_0x27625d[_0xe460('0x42')]('i.'+_0x44483f+'\x20IN\x20?',_[_0xe460('0x1c')](_0x5b2b41,'id'));}}else if(!_0x205303[_0x44483f]){_0x27625d['and']('i.'+_0x44483f+_0xe460('0x67'));}})['then'](function(){return _0x27625d;});}function getClosedOrderClause(_0xad4c1a,_0x4efb37){var _0x493621='';var _0x1d8baf=['i.thirdDisposition',_0xe460('0x68'),_0xe460('0x69')];if(_0xad4c1a===_0xe460('0x31')){_0x1d8baf['unshift']('i.substatus');}if(_0x4efb37['closed']==='0'&&_0xad4c1a==='mail'){_0x493621=_0xe460('0x6a');}else{if(_0x4efb37['closed']==='1'){_0x1d8baf[_0xe460('0x6b')]();}_0x493621=_0xe460('0x6c')+_0x1d8baf[_0xe460('0x6d')](',\x20')+')';}return _0x493621;}function getFilteredInteractions(_0x171920,_0x5cb914,_0x574343,_0x6625ea){var _0x2e3177=utils[_0xe460('0x10')](_0x171920);var _0x1812d4=_[_0xe460('0x6e')](_0x171920)+_0xe460('0x6f');var _0x40538e=[];var _0x536e51=getTagsQuery();var _0x33e564={'type':db[_0xe460('0x70')][_0xe460('0x71')][_0xe460('0x72')],'raw':!![]};var _0x8c11b1=[];var _0x393dcc=[];return db[_0xe460('0x73')][_0xe460('0x74')](_0x536e51[_0xe460('0x75')](),_0x33e564)['then'](function(_0x3d6220){_0x40538e=_['keyBy'](_0x3d6220,'id');_0x33e564=_[_0xe460('0x76')](_0x33e564,{'model':db[_0x1812d4],'mapToModel':!![],'nest':!![]});if(_0x574343[_0xe460('0x60')]){_0x6625ea[_0xe460('0x77')]['forEach'](function(_0x4f5187){_0x5cb914[_0xe460('0xb')]('i.'+_0x4f5187);});}else{_0x5cb914[_0xe460('0xb')](_0xe460('0x78'),'unreadMessages');_0x5cb914['field']('a.key',_0xe460('0x79'));_0x5cb914[_0xe460('0xb')](_0xe460('0x7a'),_0xe460('0x7b'));if(_0x171920===_0xe460('0x31')){_0x5cb914[_0xe460('0xb')]('a.email',_0xe460('0x7c'));_0x5cb914['field']('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',_0xe460('0x7d'));_0x5cb914[_0xe460('0xb')](_0xe460('0x7e'));_0x5cb914[_0xe460('0xb')]('i.createdAt');_0x5cb914['field'](_0xe460('0x7f'));_0x5cb914['field'](_0xe460('0x80'));_0x5cb914[_0xe460('0xb')](_0xe460('0x81'));_0x5cb914['field'](_0xe460('0x82'));_0x5cb914[_0xe460('0xb')](_0xe460('0x83'));_0x5cb914[_0xe460('0xb')](_0xe460('0x84'));_0x5cb914['field']('i.subject');_0x5cb914[_0xe460('0xb')](_0xe460('0x69'));_0x5cb914[_0xe460('0xb')]('i.secondDisposition');_0x5cb914[_0xe460('0xb')]('i.thirdDisposition');_0x5cb914[_0xe460('0xb')](_0xe460('0x6a'));_0x5cb914[_0xe460('0xb')](_0xe460('0x85'));_0x5cb914['field'](_0xe460('0x86'));_0x5cb914[_0xe460('0xb')]('i.MailAccountId');_0x5cb914[_0xe460('0xb')](_0xe460('0x87'));}else if(_0x171920===_0xe460('0x88')){_0x5cb914[_0xe460('0xb')](_0xe460('0x89'),'contactName');}else{_0x5cb914[_0xe460('0xb')](_0xe460('0x8a'),_0xe460('0x7d'));}if(_0x171920!==_0xe460('0x31')){_0x5cb914['field'](_0xe460('0x8b'));}_0x5cb914[_0xe460('0xb')](_0xe460('0x8c'),_0xe460('0x8d'));_0x5cb914['field'](_0xe460('0x8e'),_0xe460('0x8f'));_0x5cb914[_0xe460('0xb')](_0xe460('0x90'),_0xe460('0x91'));_0x5cb914[_0xe460('0xb')](_0xe460('0x92'),_0xe460('0x93'));_0x5cb914[_0xe460('0xb')](_0xe460('0x94'),'Contact.mobile');_0x5cb914[_0xe460('0xb')](_0xe460('0x95'),_0xe460('0x96'));_0x5cb914[_0xe460('0xb')]('o.fullname',_0xe460('0x97'));_0x5cb914[_0xe460('0xb')]('o.internal',_0xe460('0x98'));_0x5cb914[_0xe460('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe460('0x99'));}if(_0x6625ea['limit']){_0x5cb914[_0xe460('0x9a')](_0x6625ea[_0xe460('0x9a')]);}if(_0x6625ea[_0xe460('0x9b')]){_0x5cb914[_0xe460('0x9b')](_0x6625ea[_0xe460('0x9b')]);}return db[_0xe460('0x73')][_0xe460('0x74')](_0x5cb914[_0xe460('0x75')](),_0x33e564);})[_0xe460('0x5f')](function(_0x3a3e79){_0x8c11b1=_0x3a3e79;var _0x10601b=getUsersQuery(_0x171920,_0x8c11b1);return db[_0xe460('0x73')][_0xe460('0x74')](_0x10601b[_0xe460('0x75')](),_0x33e564);})[_0xe460('0x5f')](function(_0xb1264f){_0x393dcc=_[_0xe460('0x9c')](_0xb1264f,_0x2e3177);if(_0x171920==='mail'){return db['Setting'][_0xe460('0x9d')]({'attributes':[_0xe460('0x9e')],'raw':!![]});}})[_0xe460('0x5f')](function(_0x16448f){var _0xab8477=_0x16448f?_0x16448f[_0xe460('0x9e')]:undefined;var _0x32861b=_0x8c11b1[_0xe460('0x1c')](function(_0x1b4b50){return updateInteraction(_0x1b4b50,_0x40538e,_0x393dcc,_0xab8477);});return Promise[_0xe460('0x9f')](_0x32861b);});}function countFilteredInteractions(_0x338e65,_0x4d2e72){var _0x568833=_0x338e65[_0xe460('0xa0')]();_0x568833[_0xe460('0xb')](_0xe460('0xa1'));_0x568833['field'](_0xe460('0x78'),_0xe460('0x40'));var _0x4e0c8d=utils[_0xe460('0x27')](_0x4d2e72);if(!_[_0xe460('0xa2')](_0x4e0c8d)){_0x568833[_0xe460('0x1a')](_0xe460('0xa3'),_0x4e0c8d);}var _0xdb0ae6={'type':db[_0xe460('0x70')][_0xe460('0x71')][_0xe460('0x72')],'raw':!![]};return db[_0xe460('0x73')][_0xe460('0x74')](_0x568833[_0xe460('0x75')](),_0xdb0ae6);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x48f5=['operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','split','clause','User','user','UserId','body','map','some','compact','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','tags','filter','get','capitalize','chat','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','getInteractionFK','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','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','c.lastName','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','findOne','all','COUNT(*)','t.id\x20IN\x20?','exports','lodash','squel','./update-interaction','updateInteraction','./utils','../../mysqldb','role','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','getInteractionsTables','getAccountFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','interactionsTags','\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}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','read','and','Contact'];(function(_0x441813,_0x17dfcf){var _0x42e9b0=function(_0x26e0b1){while(--_0x26e0b1){_0x441813['push'](_0x441813['shift']());}};_0x42e9b0(++_0x17dfcf);}(_0x48f5,0xf7));var _0x548f=function(_0x255907,_0x55844f){_0x255907=_0x255907-0x0;var _0x48b26e=_0x48f5[_0x255907];return _0x48b26e;};'use strict';var _=require(_0x548f('0x0'));var squel=require(_0x548f('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0x548f('0x2'))[_0x548f('0x3')];var utils=require(_0x548f('0x4'));var db=require(_0x548f('0x5'))['db'];function skipInteractionsQuery(_0x3bd8f3,_0x31f254,_0x3d3902){var _0x3baf57=![];var _0x529eca=utils['getAccountFK'](_0x3bd8f3);if(_0x31f254[_0x548f('0x6')]===_0x548f('0x7')&&!_0x3d3902[_0x548f('0x8')]&&!_0x3d3902[_0x529eca]){_0x3baf57=!![];}return _0x3baf57;}function getTagsQuery(){return squel[_0x548f('0x9')]()[_0x548f('0xa')]('id')['field'](_0x548f('0xb'))['field'](_0x548f('0xc'))[_0x548f('0xd')](_0x548f('0xe'));}function getUsersQuery(_0x646e5d,_0x2c3bc4){var _0x5303ff=utils['getInteractionFK'](_0x646e5d);var _0x182947=_0x548f('0xf')+_0x646e5d+_0x548f('0x10');var _0x3bf429=squel['select']()[_0x548f('0xa')]('u.id')[_0x548f('0xa')]('u.fullname')['field'](_0x548f('0x11')+_0x5303ff)[_0x548f('0xd')](_0x182947,'ui')[_0x548f('0x12')](_0x548f('0x13'),'u',_0x548f('0x14'));if(_0x2c3bc4[_0x548f('0x15')]>0x0){_0x3bf429['where'](_0x548f('0x11')+_0x5303ff+_0x548f('0x16'),_['map'](_0x2c3bc4,'id'));}return _0x3bf429;}function getInteractionsQuery(_0x979e00){var _0x1da01f=utils[_0x548f('0x17')](_0x979e00);var _0x1b5452=utils[_0x548f('0x18')](_0x979e00);var _0x2800bb=utils['getInteractionFK'](_0x979e00);return squel['select']()[_0x548f('0xd')](_0x1da01f[_0x548f('0x19')],'i')[_0x548f('0x12')](_0x548f('0x1a'),'c',_0x548f('0x1b'))[_0x548f('0x12')](_0x548f('0x13'),'o','o.id\x20=\x20i.UserId')[_0x548f('0x12')](_0x1da01f[_0x548f('0x1c')],'a',_0x548f('0x1d')+_0x1b5452)[_0x548f('0x12')](_0x1da01f[_0x548f('0x1e')],'me','me.'+_0x2800bb+'\x20=\x20i.id')[_0x548f('0x12')](_0x1da01f[_0x548f('0x1f')],'it','it.'+_0x2800bb+_0x548f('0x20'))[_0x548f('0x12')]('tools_tags','t',_0x548f('0x21'));}function getSqlClauses(){var _0x4894fa={'body':squel[_0x548f('0x22')](),'contact':squel[_0x548f('0x22')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x548f('0x22')](),'read':squel[_0x548f('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x548f('0x22')]()};return _0x4894fa;}function parseTagParameter(_0x4c89f8){var _0x3e4025=squel[_0x548f('0x22')]();if(_0x4c89f8){var _0x330e0f=utils[_0x548f('0x23')](_0x4c89f8);_0x330e0f[_0x548f('0x24')](function(_0x5d6f20){_0x3e4025['or'](_0x548f('0x25'),'%,'+_0x5d6f20+',%');});}return _0x3e4025;}function parseReadParameter(_0x5b7a9){var _0x3106b7='';if(_0x5b7a9){_0x3106b7=_0x548f('0x26');if(_0x5b7a9==='1'){_0x3106b7=_0x3106b7[_0x548f('0x27')](_0x548f('0x28'),'=');}else{_0x3106b7=_0x3106b7[_0x548f('0x27')]('{OPERATOR}','>');}}return _0x3106b7;}function parseSearchFilter(_0x564f0e,_0x490af6){var _0xeaaabb=squel[_0x548f('0x22')]();if(_0x490af6){var _0xfe5c0f=_0x490af6['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x548f('0x29')](_0xfe5c0f)){_0xeaaabb['or'](_0x548f('0x2a'),_0xfe5c0f+'%');if([_0x548f('0x2b'),_0x548f('0x2c')][_0x548f('0x2d')](_0x564f0e)){_0xeaaabb['or'](_0x548f('0x2e'),_0xfe5c0f+'%');}else if(_0x564f0e===_0x548f('0x2f')){_0xeaaabb['or'](_0x548f('0x30'),_0xfe5c0f+'%');}else if(_0x564f0e===_0x548f('0x31')){_0xeaaabb['or']('i.from\x20LIKE\x20?',_0xfe5c0f+'%');}}else if(_0x564f0e===_0x548f('0x32')&&qs[_0x548f('0x33')](_0xfe5c0f)){_0xeaaabb['or'](_0x548f('0x34'),_0xfe5c0f+'%');}else{if(_0x564f0e===_0x548f('0x32')){_0xeaaabb['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xfe5c0f,!![]))['or'](_0x548f('0x35'),qs['getFullTextValue'](_0xfe5c0f));}else if(_0x564f0e!==_0x548f('0x2f')){_0xeaaabb['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xfe5c0f));}_0xeaaabb['or'](_0x548f('0x36'),qs[_0x548f('0x37')](_0xfe5c0f,!![]),null);}}return _0xeaaabb;}function parseAdvancedSearchFilter(_0x54cdc6,_0xd1a2a5){var _0x1f97a2=getSqlClauses();var _0x1ce18b=as['parseSearch'](_0x54cdc6);var _0x36d150=_0x1ce18b['sqlOperator'];for(var _0x5d446c=0x0;_0x5d446c<_0x1ce18b[_0x548f('0x38')]['length'];_0x5d446c++){var _0x58542b=_0x1ce18b[_0x548f('0x38')][_0x5d446c];var _0x105e90='i';var _0x33768f=_[_0x548f('0x39')](_0xd1a2a5,[_0x548f('0xb'),_0x58542b[_0x548f('0xa')]]);if(_0x33768f){var _0x4e6996=as[_0x548f('0x3a')](_0x105e90,_0x33768f[_0x548f('0x3b')],_0x58542b);_0x1f97a2[_0x548f('0x3c')][_0x36d150](_0x4e6996[_0x548f('0x3d')],_0x4e6996[_0x548f('0x3e')][_0x548f('0x3f')],_0x4e6996[_0x548f('0x3e')][_0x548f('0x40')]);}else{switch(_0x58542b[_0x548f('0xa')]){case _0x548f('0x41'):var _0x3fb72a=parseReadParameter(_0x58542b[_0x548f('0x3e')]);_0x1f97a2[_0x548f('0x42')][_0x548f('0x43')](_0x3fb72a);break;case _0x548f('0x44'):if(_0x58542b[_0x548f('0x45')]===_0x548f('0x46')){if(_0x58542b[_0x548f('0x3e')]['split']('\x20')['length']>0x1){_0x1f97a2[_0x548f('0x47')][_0x36d150](_0x548f('0x36'),qs['getFullTextValue'](_0x58542b[_0x548f('0x3e')],!![]),null);}else{var _0xfe4d29='%'+_0x58542b[_0x548f('0x3e')]+'%';_0x1f97a2[_0x548f('0x47')][_0x36d150](_0x548f('0x48'),_0xfe4d29,_0xfe4d29,_0xfe4d29);}}else{_0x33768f=_[_0x548f('0x39')](_0xd1a2a5,[_0x548f('0xb'),_0x548f('0x49')]);_0x58542b[_0x548f('0xa')]='ContactId';_0x4e6996=as[_0x548f('0x3a')](_0x105e90,_0x33768f['type'],_0x58542b);_0x1f97a2[_0x548f('0x47')][_0x36d150](_0x4e6996['text'],_0x4e6996[_0x548f('0x3e')][_0x548f('0x3f')],_0x4e6996[_0x548f('0x3e')][_0x548f('0x40')]);}break;case _0x548f('0x4a'):var _0x105a03=_0x58542b['value'][_0x548f('0x4b')](',')['map'](function(_0x4c3459){return Number(_0x4c3459);});var _0x47b646=parseTagParameter(_0x105a03);_0x1f97a2['tags'][_0x548f('0x4c')]['and'](_0x47b646);_0x1f97a2['tags']['ids']=_0x105a03;break;case _0x548f('0x4d'):if(_0x58542b['operator']===_0x548f('0x46')){_0x1f97a2[_0x548f('0x4e')][_0x36d150]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x58542b[_0x548f('0x3e')]+'%',null);}else{_0x33768f=_[_0x548f('0x39')](_0xd1a2a5,[_0x548f('0xb'),_0x548f('0x4f')]);_0x58542b[_0x548f('0xa')]=_0x548f('0x4f');_0x4e6996=as[_0x548f('0x3a')](_0x105e90,_0x33768f['type'],_0x58542b);_0x1f97a2[_0x548f('0x4e')][_0x36d150](_0x4e6996[_0x548f('0x3d')],_0x4e6996[_0x548f('0x3e')]['start'],_0x4e6996[_0x548f('0x3e')]['end']);}break;case _0x548f('0x50'):case'plainBody':_0x4e6996=as[_0x548f('0x3a')]('me',null,_0x58542b);_0x1f97a2[_0x548f('0x50')][_0x36d150](_0x4e6996[_0x548f('0x3d')],_0x4e6996[_0x548f('0x3e')][_0x548f('0x3f')],_0x4e6996[_0x548f('0x3e')][_0x548f('0x40')]);break;}}}return _0x1f97a2;}function parseModelFields(_0x428a95,_0x253b65,_0x37bec6){var _0x2977b2=utils[_0x548f('0x18')](_0x428a95);var _0x325ebc=squel[_0x548f('0x22')]();var _0x2d1161=_(_0x253b65)['keys']()[_0x548f('0x51')](function(_0x4cd383){return _[_0x548f('0x52')](_0x37bec6,[_0x548f('0xb'),_0x4cd383])?_0x4cd383:undefined;})[_0x548f('0x53')]()[_0x548f('0x3e')]();if(_0x2d1161[_0x548f('0x15')]>0x0){_0x2d1161[_0x548f('0x24')](function(_0x159386){if(_0x159386===_0x2977b2){_0x325ebc[_0x548f('0x43')]('i.'+_0x2977b2+_0x548f('0x16'),[]['concat'](_0x253b65[_0x159386]));}else if(_0x159386===_0x548f('0x54')){var _0x16bc38=JSON[_0x548f('0x55')](_0x253b65[_0x159386])['$gte'];var _0x4cc2e0=JSON[_0x548f('0x55')](_0x253b65[_0x159386])[_0x548f('0x56')];_0x325ebc[_0x548f('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16bc38,_0x4cc2e0);}else{if(_0x253b65[_0x159386]===_0x548f('0x57')){_0x325ebc['and']('i.'+_0x159386+_0x548f('0x58'));}else{_0x325ebc[_0x548f('0x43')]('i.'+_0x159386+_0x548f('0x59'),_0x253b65[_0x159386]);}}});}return _0x325ebc;}function parseQueryParameters(_0x4f77cf,_0x5badd1,_0x5563ff){var _0x1bd487=getSqlClauses();return Promise[_0x548f('0x5a')]()[_0x548f('0x5b')](function(){return parseModelFields(_0x4f77cf,_0x5badd1,_0x5563ff);})['then'](function(_0x4d8458){_0x1bd487[_0x548f('0x5c')][_0x548f('0x43')](_0x4d8458);return parseReadParameter(_0x5badd1[_0x548f('0x42')]);})['then'](function(_0x574009){_0x1bd487[_0x548f('0x42')][_0x548f('0x43')](_0x574009);return parseTagParameter(_0x5badd1[_0x548f('0x5d')]);})[_0x548f('0x5b')](function(_0x216abb){_0x1bd487[_0x548f('0x5e')][_0x548f('0x4c')][_0x548f('0x43')](_0x216abb);return parseSearchFilter(_0x4f77cf,_0x5badd1['filter']);})[_0x548f('0x5b')](function(_0x3be4cf){_0x1bd487[_0x548f('0x5f')]=_0x3be4cf;return _0x1bd487;});}function checkAccountsRestrictions(_0x53a502,_0x2defa7,_0x25cf80){var _0x36884f=utils[_0x548f('0x18')](_0x53a502);var _0x5eadfc=_0x548f('0x60')+_[_0x548f('0x61')](_0x53a502)+(_0x53a502===_0x548f('0x62')?'Websites':_0x548f('0x63'));var _0x3c007d=squel['expr']();return Promise['resolve']()[_0x548f('0x5b')](function(){if(_0x25cf80[_0x548f('0x8')]&&_0x2defa7[_0x548f('0x6')]==='agent'){return _0x2defa7[_0x5eadfc]({'attributes':['id'],'raw':!![]});}})[_0x548f('0x5b')](function(_0x367b76){if(_0x367b76){if(_0x367b76[_0x548f('0x15')]===0x0){_0x3c007d[_0x548f('0x43')]('i.'+_0x36884f+_0x548f('0x58'));}else{_0x3c007d[_0x548f('0x43')]('i.'+_0x36884f+_0x548f('0x16'),_[_0x548f('0x51')](_0x367b76,'id'));}}else if(!_0x25cf80[_0x36884f]){_0x3c007d[_0x548f('0x43')]('i.'+_0x36884f+_0x548f('0x64'));}})[_0x548f('0x5b')](function(){return _0x3c007d;});}function getClosedOrderClause(_0x27f62e,_0x41f78b){var _0x5d2f9f='';var _0x1c748d=[_0x548f('0x65'),'i.secondDisposition',_0x548f('0x66')];if(_0x27f62e==='mail'){_0x1c748d[_0x548f('0x67')]('i.substatus');}if(_0x41f78b['closed']==='0'&&_0x27f62e===_0x548f('0x32')){_0x5d2f9f=_0x548f('0x68');}else{if(_0x41f78b[_0x548f('0x69')]==='1'){_0x1c748d[_0x548f('0x6a')]();}_0x5d2f9f=_0x548f('0x6b')+_0x1c748d[_0x548f('0x6c')](',\x20')+')';}return _0x5d2f9f;}function getFilteredInteractions(_0x418d3b,_0x3cbfe0,_0x59a116,_0x3f89fb){var _0x5df9ac=utils[_0x548f('0x6d')](_0x418d3b);var _0x417550=_[_0x548f('0x61')](_0x418d3b)+_0x548f('0x6e');var _0x815081=[];var _0x384695=getTagsQuery();var _0x243f6a={'type':db[_0x548f('0x6f')][_0x548f('0x70')][_0x548f('0x71')],'raw':!![]};var _0xe814f3=[];var _0x4c6e77=[];return db[_0x548f('0x72')][_0x548f('0x73')](_0x384695[_0x548f('0x74')](),_0x243f6a)[_0x548f('0x5b')](function(_0x227bb5){_0x815081=_[_0x548f('0x75')](_0x227bb5,'id');_0x243f6a=_[_0x548f('0x76')](_0x243f6a,{'model':db[_0x417550],'mapToModel':!![],'nest':!![]});if(_0x59a116[_0x548f('0x5c')]){_0x3f89fb['attributes'][_0x548f('0x24')](function(_0x57cc7f){_0x3cbfe0[_0x548f('0xa')]('i.'+_0x57cc7f);});}else{_0x3cbfe0[_0x548f('0xa')](_0x548f('0x77'),_0x548f('0x41'));_0x3cbfe0['field'](_0x548f('0x78'),_0x548f('0x79'));_0x3cbfe0['field'](_0x548f('0x7a'),'Account.mandatoryDisposition');if(_0x418d3b==='mail'){_0x3cbfe0[_0x548f('0xa')](_0x548f('0x7b'),_0x548f('0x7c'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x7d'),_0x548f('0x7e'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x7f'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x80'));_0x3cbfe0[_0x548f('0xa')]('i.updatedAt');_0x3cbfe0[_0x548f('0xa')](_0x548f('0x81'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x82'));_0x3cbfe0[_0x548f('0xa')]('i.attach');_0x3cbfe0[_0x548f('0xa')]('i.lastMsgAt');_0x3cbfe0[_0x548f('0xa')](_0x548f('0x83'));_0x3cbfe0[_0x548f('0xa')]('i.subject');_0x3cbfe0['field'](_0x548f('0x66'));_0x3cbfe0['field']('i.secondDisposition');_0x3cbfe0[_0x548f('0xa')]('i.thirdDisposition');_0x3cbfe0[_0x548f('0xa')](_0x548f('0x68'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x84'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x85'));_0x3cbfe0['field'](_0x548f('0x86'));_0x3cbfe0[_0x548f('0xa')]('i.UserId');}else if(_0x418d3b===_0x548f('0x31')){_0x3cbfe0['field'](_0x548f('0x87'),'contactName');}else{_0x3cbfe0[_0x548f('0xa')](_0x548f('0x88'),_0x548f('0x7e'));}if(_0x418d3b!==_0x548f('0x32')){_0x3cbfe0[_0x548f('0xa')](_0x548f('0x89'));}_0x3cbfe0[_0x548f('0xa')](_0x548f('0x8a'),'Contact.firstName');_0x3cbfe0['field'](_0x548f('0x8b'),'Contact.lastName');_0x3cbfe0[_0x548f('0xa')]('c.email',_0x548f('0x8c'));_0x3cbfe0[_0x548f('0xa')]('c.phone',_0x548f('0x8d'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x8e'),'Contact.mobile');_0x3cbfe0[_0x548f('0xa')](_0x548f('0x8f'),_0x548f('0x90'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x91'),'Owner.fullname');_0x3cbfe0[_0x548f('0xa')](_0x548f('0x92'),_0x548f('0x93'));_0x3cbfe0[_0x548f('0xa')](_0x548f('0x94'),_0x548f('0x95'));}if(_0x3f89fb[_0x548f('0x96')]){_0x3cbfe0[_0x548f('0x96')](_0x3f89fb['limit']);}if(_0x3f89fb[_0x548f('0x97')]){_0x3cbfe0[_0x548f('0x97')](_0x3f89fb[_0x548f('0x97')]);}return db['sequelize'][_0x548f('0x73')](_0x3cbfe0['toString'](),_0x243f6a);})[_0x548f('0x5b')](function(_0x2103cd){_0xe814f3=_0x2103cd;var _0x59eeaa=getUsersQuery(_0x418d3b,_0xe814f3);return db['sequelize'][_0x548f('0x73')](_0x59eeaa['toString'](),_0x243f6a);})[_0x548f('0x5b')](function(_0x4d98f0){_0x4c6e77=_['groupBy'](_0x4d98f0,_0x5df9ac);if(_0x418d3b===_0x548f('0x32')){return db[_0x548f('0x98')][_0x548f('0x99')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x548f('0x5b')](function(_0x59316c){var _0x5afced=_0x59316c?_0x59316c['enableEmailPreview']:undefined;var _0x4a7dd4=_0xe814f3[_0x548f('0x51')](function(_0x55588e){return updateInteraction(_0x55588e,_0x815081,_0x4c6e77,_0x5afced);});return Promise[_0x548f('0x9a')](_0x4a7dd4);});}function countFilteredInteractions(_0x1b850b,_0x14338a){var _0x190345=_0x1b850b['clone']();_0x190345[_0x548f('0xa')](_0x548f('0x9b'));_0x190345[_0x548f('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x548f('0x41'));var _0x1f5c45=utils['getSelectedTags'](_0x14338a);if(!_['isEmpty'](_0x1f5c45)){_0x190345['where'](_0x548f('0x9c'),_0x1f5c45);}var _0x2b2a8b={'type':db['Sequelize'][_0x548f('0x70')]['SELECT'],'raw':!![]};return db[_0x548f('0x72')][_0x548f('0x73')](_0x190345[_0x548f('0x74')](),_0x2b2a8b);}module[_0x548f('0x9d')]={'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 9a42b88..545c196 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 _0xd057=['answered','talking','total','MailMessage','out','plainBody','-id','then','trimStart','catch','updateInteraction','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','push','waiting','unmanaged','abandoned','disposition','UserId'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xd057,0x12d));var _0x7d05=function(_0x19fe48,_0x3031c7){_0x19fe48=_0x19fe48-0x0;var _0x4358fd=_0xd057[_0x19fe48];return _0x4358fd;};'use strict';var _=require(_0x7d05('0x0'));var db=require(_0x7d05('0x1'))['db'];function getInteractionUsers(_0x127e9f,_0x1316e6){return new Promise(function(_0x226d00,_0x440043){try{var _0x28f968=[];if(_0x1316e6[_0x127e9f]){_0x28f968=_0x1316e6[_0x127e9f][_0x7d05('0x2')](function(_0x4860db){return{'id':_0x4860db['id'],'fullname':_0x4860db[_0x7d05('0x3')]};});}return _0x226d00(_0x28f968);}catch(_0x1fd28d){_0x440043(_0x1fd28d);}});}function getInteractionTags(_0x35a53c,_0x59275e){var _0x15beb4=[];if(_0x35a53c){_0x35a53c[_0x7d05('0x4')](',')['forEach'](function(_0x43bba8){_0x15beb4[_0x7d05('0x5')](_0x59275e[_0x43bba8]);});}return _0x15beb4;}function updateWaitingCounter(_0xc5ef6a){if(_0xc5ef6a[_0x7d05('0x6')]){_0xc5ef6a[_0x7d05('0x6')]-=0x1;}}function updateInteractionCounters(_0x263a66){_0x263a66[_0x7d05('0x6')]=0x0;_0x263a66['talking']=0x0;_0x263a66['answered']=0x0;_0x263a66[_0x7d05('0x7')]=0x0;_0x263a66[_0x7d05('0x8')]=0x0;_0x263a66['total']=0x0;if(_0x263a66['closed']){if(_0x263a66[_0x7d05('0x9')]===_0x7d05('0x8')){_0x263a66[_0x7d05('0x8')]+=0x1;updateWaitingCounter(_0x263a66);}if(_0x263a66[_0x7d05('0xa')]){_0x263a66[_0x7d05('0xb')]+=0x1;if(_0x263a66[_0x7d05('0xc')]){_0x263a66[_0x7d05('0xc')]-=0x1;}}else{if(_0x263a66[_0x7d05('0x9')]){_0x263a66[_0x7d05('0x7')]+=0x1;updateWaitingCounter(_0x263a66);}}}else{if(!_0x263a66[_0x7d05('0xa')]){_0x263a66[_0x7d05('0x6')]+=0x1;}if(_0x263a66[_0x7d05('0xa')]){_0x263a66['talking']+=0x1;updateWaitingCounter(_0x263a66);}}_0x263a66[_0x7d05('0xd')]+=0x1;return _0x263a66;}function getLastMessageText(_0x555b50){return db[_0x7d05('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x555b50['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7d05('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7d05('0x10')],'order':_0x7d05('0x11'),'raw':!![]})[_0x7d05('0x12')](function(_0x3771dd){if(_0x3771dd&&_0x3771dd[_0x7d05('0x10')]){_0x555b50['lastMsgText']=_[_0x7d05('0x13')](_0x3771dd[_0x7d05('0x10')]);}return _0x555b50;})[_0x7d05('0x14')](function(_0x5b85ac){throw _0x5b85ac;});}exports[_0x7d05('0x15')]=function(_0x1b89f8,_0x1d8799,_0x1d0c53,_0x5d7fd5){return new Promise(function(_0x49f2e6,_0x38c46d){return getInteractionUsers(_0x1b89f8['id'],_0x1d0c53)['then'](function(_0x1164f8){_0x1b89f8['Users']=_0x1164f8;return getInteractionTags(_0x1b89f8[_0x7d05('0x16')],_0x1d8799);})[_0x7d05('0x12')](function(_0x46f882){_0x1b89f8[_0x7d05('0x17')]=_0x46f882;delete _0x1b89f8[_0x7d05('0x16')];return updateInteractionCounters(_0x1b89f8);})[_0x7d05('0x12')](function(_0x3f6cf1){if(_0x5d7fd5){return getLastMessageText(_0x3f6cf1);}else{return _0x3f6cf1;}})['then'](function(_0x6d0229){_0x49f2e6(_0x6d0229);})[_0x7d05('0x14')](function(_0x311ec6){_0x38c46d(_0x311ec6);});});}; \ No newline at end of file +var _0x2b62=['plainBody','then','lastMsgText','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','abandoned','disposition','UserId','total','MailMessage','findOne','out'];(function(_0x7642c,_0x2ec4b0){var _0x5412fd=function(_0xffc8e3){while(--_0xffc8e3){_0x7642c['push'](_0x7642c['shift']());}};_0x5412fd(++_0x2ec4b0);}(_0x2b62,0x1d0));var _0x22b6=function(_0x5b6a36,_0x24276e){_0x5b6a36=_0x5b6a36-0x0;var _0x48386f=_0x2b62[_0x5b6a36];return _0x48386f;};'use strict';var _=require('lodash');var db=require(_0x22b6('0x0'))['db'];function getInteractionUsers(_0x5ef240,_0x455601){return new Promise(function(_0x48823f,_0x30dcd9){try{var _0x299cac=[];if(_0x455601[_0x5ef240]){_0x299cac=_0x455601[_0x5ef240][_0x22b6('0x1')](function(_0x2eb215){return{'id':_0x2eb215['id'],'fullname':_0x2eb215[_0x22b6('0x2')]};});}return _0x48823f(_0x299cac);}catch(_0x396cf4){_0x30dcd9(_0x396cf4);}});}function getInteractionTags(_0x1a6a45,_0x2eddde){var _0x526e91=[];if(_0x1a6a45){_0x1a6a45[_0x22b6('0x3')](',')[_0x22b6('0x4')](function(_0x4fd72a){_0x526e91[_0x22b6('0x5')](_0x2eddde[_0x4fd72a]);});}return _0x526e91;}function updateWaitingCounter(_0x402851){if(_0x402851[_0x22b6('0x6')]){_0x402851[_0x22b6('0x6')]-=0x1;}}function updateInteractionCounters(_0x2244ed){_0x2244ed[_0x22b6('0x6')]=0x0;_0x2244ed[_0x22b6('0x7')]=0x0;_0x2244ed[_0x22b6('0x8')]=0x0;_0x2244ed['unmanaged']=0x0;_0x2244ed[_0x22b6('0x9')]=0x0;_0x2244ed['total']=0x0;if(_0x2244ed['closed']){if(_0x2244ed[_0x22b6('0xa')]==='abandoned'){_0x2244ed['abandoned']+=0x1;updateWaitingCounter(_0x2244ed);}if(_0x2244ed['UserId']){_0x2244ed[_0x22b6('0x8')]+=0x1;if(_0x2244ed[_0x22b6('0x7')]){_0x2244ed[_0x22b6('0x7')]-=0x1;}}else{if(_0x2244ed[_0x22b6('0xa')]){_0x2244ed['unmanaged']+=0x1;updateWaitingCounter(_0x2244ed);}}}else{if(!_0x2244ed[_0x22b6('0xb')]){_0x2244ed[_0x22b6('0x6')]+=0x1;}if(_0x2244ed[_0x22b6('0xb')]){_0x2244ed['talking']+=0x1;updateWaitingCounter(_0x2244ed);}}_0x2244ed[_0x22b6('0xc')]+=0x1;return _0x2244ed;}function getLastMessageText(_0x1d5e0c){return db[_0x22b6('0xd')][_0x22b6('0xe')]({'where':{'$and':[{'MailInteractionId':_0x1d5e0c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x22b6('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x22b6('0x10')],'order':'-id','raw':!![]})[_0x22b6('0x11')](function(_0x22a844){if(_0x22a844&&_0x22a844[_0x22b6('0x10')]){_0x1d5e0c[_0x22b6('0x12')]=_['trimStart'](_0x22a844[_0x22b6('0x10')]);}return _0x1d5e0c;})[_0x22b6('0x13')](function(_0x3c2436){throw _0x3c2436;});}exports[_0x22b6('0x14')]=function(_0x3b7e5f,_0x3596bb,_0x5bde95,_0x2bc93e){return new Promise(function(_0x319454,_0x510135){return getInteractionUsers(_0x3b7e5f['id'],_0x5bde95)[_0x22b6('0x11')](function(_0x18106a){_0x3b7e5f[_0x22b6('0x15')]=_0x18106a;return getInteractionTags(_0x3b7e5f[_0x22b6('0x16')],_0x3596bb);})['then'](function(_0x7ba60e){_0x3b7e5f[_0x22b6('0x17')]=_0x7ba60e;delete _0x3b7e5f[_0x22b6('0x16')];return updateInteractionCounters(_0x3b7e5f);})[_0x22b6('0x11')](function(_0x31494a){if(_0x2bc93e){return getLastMessageText(_0x31494a);}else{return _0x31494a;}})[_0x22b6('0x11')](function(_0x144c7b){_0x319454(_0x144c7b);})['catch'](function(_0x391f38){_0x510135(_0x391f38);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index aac6080..223af7c 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 _0xd806=['InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Website','Account'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd806,0x1d5));var _0x6d80=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xd806[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x6d80('0x0'));var db=require(_0x6d80('0x1'))['db'];var loggers={'openchannel':require(_0x6d80('0x2'))(_0x6d80('0x3')),'mail':require(_0x6d80('0x2'))(_0x6d80('0x4')),'fax':require(_0x6d80('0x2'))(_0x6d80('0x5')),'sms':require(_0x6d80('0x2'))('sms-interactions'),'chat':require(_0x6d80('0x2'))('chat-interactions'),'whatsapp':require(_0x6d80('0x2'))(_0x6d80('0x6'))};function getAccountFK(_0x26ed57){return _[_0x6d80('0x7')](_0x26ed57)+(_0x26ed57===_0x6d80('0x8')?_0x6d80('0x9'):_0x6d80('0xa'))+'Id';}function getInteractionFK(_0x1d28df){return _['capitalize'](_0x1d28df)+_0x6d80('0xb');}function getInteractionId(_0x218429,_0x47c2c2,_0x2d0dc2){if(_0x218429&&_0x218429[_['upperFirst'](_0x2d0dc2)+'InteractionId']){return _0x218429[_['upperFirst'](_0x2d0dc2)+'InteractionId'];}else if(_0x218429&&_0x218429['id']){return _0x218429['id'];}else if(_0x47c2c2&&_0x47c2c2['id']){return _0x47c2c2['id'];}else{return _0x6d80('0xc');}}function getInteractionsTables(_0x4b11ae){return{'accounts':_0x4b11ae+'_'+(_0x4b11ae==='chat'?_0x6d80('0xd'):_0x6d80('0xe')),'interactions':_0x4b11ae+_0x6d80('0xf'),'interactionsTags':_0x4b11ae+_0x6d80('0x10'),'messages':_0x4b11ae+_0x6d80('0x11'),'userInteractions':_0x6d80('0x12')+_0x4b11ae+_0x6d80('0xf')};}function getSelectedTags(_0x12d83e){var _0x582ac5=[];if(_0x12d83e){_0x582ac5=Array[_0x6d80('0x13')](_0x12d83e)?_0x12d83e:[_0x12d83e];}return _0x582ac5;}function log(_0x46ecfc,_0x52f598,_0x26d1d4,_0x51a388,_0x3354b7,_0x15c9e3){loggers[_0x3354b7[_0x6d80('0x14')]()][_0x46ecfc](_0x6d80('0x15'),_0x15c9e3['toUpperCase'](),_0x52f598?_0x52f598['id']:null,_0x52f598?_0x52f598['name']:null,_0x52f598?_0x52f598[_0x6d80('0x16')]:null,getInteractionId(_0x26d1d4,_0x51a388,_0x3354b7),_0x26d1d4?JSON[_0x6d80('0x17')](_0x26d1d4):_0x6d80('0x18'));}function updateUser(_0x48a91e,_0x5f1bc6,_0x180fe6,_0x4c3eaf,_0x421823){db[_['upperFirst'](_0x4c3eaf)+'Interaction'][_0x6d80('0x19')]({'where':{'id':getInteractionId(_0x5f1bc6,_0x180fe6,_0x4c3eaf)}})[_0x6d80('0x1a')](function(_0x117420){if(_0x117420){return _0x117420[_0x6d80('0x1b')]({'UserId':_0x48a91e?_0x48a91e['id']:null});}})['then'](function(_0x51e2e5){if(_0x51e2e5){log(_0x6d80('0x1c'),_0x48a91e,_0x5f1bc6,_0x180fe6,_0x4c3eaf,_0x421823);}})[_0x6d80('0x1d')](function(){log(_0x6d80('0x1e'),_0x48a91e,_0x5f1bc6,_0x180fe6,_0x4c3eaf,_0x421823);});}module[_0x6d80('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xc2c3=['findOne','update','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc2c3,0xe7));var _0x3c2c=function(_0xda6737,_0x4b2ad7){_0xda6737=_0xda6737-0x0;var _0x565dd5=_0xc2c3[_0xda6737];return _0x565dd5;};'use strict';var _=require(_0x3c2c('0x0'));var db=require(_0x3c2c('0x1'))['db'];var loggers={'openchannel':require(_0x3c2c('0x2'))('openchannel-interactions'),'mail':require(_0x3c2c('0x2'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x3c2c('0x3')),'chat':require('../../config/logger')(_0x3c2c('0x4')),'whatsapp':require(_0x3c2c('0x2'))(_0x3c2c('0x5'))};function getAccountFK(_0x511d4d){return _[_0x3c2c('0x6')](_0x511d4d)+(_0x511d4d===_0x3c2c('0x7')?_0x3c2c('0x8'):_0x3c2c('0x9'))+'Id';}function getInteractionFK(_0x103f64){return _['capitalize'](_0x103f64)+_0x3c2c('0xa');}function getInteractionId(_0x21b973,_0x2f94c5,_0x4b2075){if(_0x21b973&&_0x21b973[_[_0x3c2c('0xb')](_0x4b2075)+_0x3c2c('0xa')]){return _0x21b973[_[_0x3c2c('0xb')](_0x4b2075)+_0x3c2c('0xa')];}else if(_0x21b973&&_0x21b973['id']){return _0x21b973['id'];}else if(_0x2f94c5&&_0x2f94c5['id']){return _0x2f94c5['id'];}else{return'unknown';}}function getInteractionsTables(_0x1872b7){return{'accounts':_0x1872b7+'_'+(_0x1872b7===_0x3c2c('0x7')?_0x3c2c('0xc'):_0x3c2c('0xd')),'interactions':_0x1872b7+'_interactions','interactionsTags':_0x1872b7+_0x3c2c('0xe'),'messages':_0x1872b7+_0x3c2c('0xf'),'userInteractions':_0x3c2c('0x10')+_0x1872b7+_0x3c2c('0x11')};}function getSelectedTags(_0x4d5124){var _0x5e7118=[];if(_0x4d5124){_0x5e7118=Array['isArray'](_0x4d5124)?_0x4d5124:[_0x4d5124];}return _0x5e7118;}function log(_0xccd9,_0x293f92,_0x251f87,_0x525674,_0x58f30b,_0x9a47b6){loggers[_0x58f30b['toLowerCase']()][_0xccd9](_0x3c2c('0x12'),_0x9a47b6[_0x3c2c('0x13')](),_0x293f92?_0x293f92['id']:null,_0x293f92?_0x293f92[_0x3c2c('0x14')]:null,_0x293f92?_0x293f92[_0x3c2c('0x15')]:null,getInteractionId(_0x251f87,_0x525674,_0x58f30b),_0x251f87?JSON[_0x3c2c('0x16')](_0x251f87):_0x3c2c('0x17'));}function updateUser(_0x5aec37,_0x510bf2,_0x1d68fd,_0x411161,_0x44ec11){db[_[_0x3c2c('0xb')](_0x411161)+_0x3c2c('0x18')][_0x3c2c('0x19')]({'where':{'id':getInteractionId(_0x510bf2,_0x1d68fd,_0x411161)}})['then'](function(_0x4d1b5d){if(_0x4d1b5d){return _0x4d1b5d[_0x3c2c('0x1a')]({'UserId':_0x5aec37?_0x5aec37['id']:null});}})[_0x3c2c('0x1b')](function(_0x484817){if(_0x484817){log(_0x3c2c('0x1c'),_0x5aec37,_0x510bf2,_0x1d68fd,_0x411161,_0x44ec11);}})[_0x3c2c('0x1d')](function(){log(_0x3c2c('0x1e'),_0x5aec37,_0x510bf2,_0x1d68fd,_0x411161,_0x44ec11);});}module[_0x3c2c('0x1f')]={'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 59bb12b..41dcf7c 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 _0xac0f=['base64','utf8','final','parse','use','License','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','util','../../config/environment','data1','split','createDecipher','format','update'];(function(_0x541a78,_0x219591){var _0x3107f3=function(_0x153053){while(--_0x153053){_0x541a78['push'](_0x541a78['shift']());}};_0x3107f3(++_0x219591);}(_0xac0f,0x11f));var _0xfac0=function(_0x39a5a3,_0xc92a9f){_0x39a5a3=_0x39a5a3-0x0;var _0x526aee=_0xac0f[_0x39a5a3];return _0x526aee;};'use strict';var crypto=require('crypto');var util=require(_0xfac0('0x0'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xfac0('0x1'));function getValueFromLicense(_0x31c00a,_0x2a5c2a){if(_0x31c00a&&_0x2a5c2a){if(_0x2a5c2a['data1']&&_0x2a5c2a['license']){var _0x3b130e=_0x2a5c2a[_0xfac0('0x2')];var _0xeaa6f2=_0x2a5c2a['license'];var _0x4736ca=_0x3b130e[_0xfac0('0x3')]('-')[0x4];var _0x2c8ba2=_0x3b130e[_0xfac0('0x3')]('-')[0x0];var _0x5b9c41=crypto[_0xfac0('0x4')]('aes-256-ctr',util[_0xfac0('0x5')]('%s:%s:%s',_0x4736ca,_0x3b130e,_0x2c8ba2));var _0x353d26=_0x5b9c41[_0xfac0('0x6')](_0xeaa6f2,_0xfac0('0x7'),_0xfac0('0x8'));_0x353d26+=_0x5b9c41[_0xfac0('0x9')](_0xfac0('0x8'));var _0xb47f77=JSON[_0xfac0('0xa')](_0x353d26);return _0xb47f77['hasOwnProperty'](_0x31c00a)?_0xb47f77[_0x31c00a]:null;}}return null;}function isLimit(_0xdc03b5,_0x54ced8,_0x63b78a,_0xa6281){var _0x2479c5=_0x54ced8;return compose()[_0xfac0('0xb')](function(_0x3586af,_0x265342,_0x4ff5a5){return db[_0xfac0('0xc')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xfac0('0xd')](function(_0x466bdf){var _0x3f8bbb=getValueFromLicense(_0xdc03b5,_0x466bdf);return _0x3f8bbb?_0x3f8bbb:_0x2479c5;})[_0xfac0('0xd')](function(_0x67cb23){_0x2479c5=_0x67cb23;return _0x63b78a['count'](_0xa6281);})[_0xfac0('0xd')](function(_0x27cb13){if(_0x27cb13>=_0x2479c5){return _0x265342[_0xfac0('0xe')](0x193)['json']({'message':util[_0xfac0('0x5')](_0xfac0('0xf'),_0xdc03b5)});}_0x4ff5a5();})[_0xfac0('0x10')](function(_0x12b514){_0x4ff5a5(_0x12b514);});});}function isUserLimit(){return isLimit(_0xfac0('0x11'),0x1,db['User'],{'where':{'$or':[{'role':_0xfac0('0x12')},{'role':_0xfac0('0x13')}]}});}exports[_0xfac0('0x14')]=isUserLimit; \ No newline at end of file +var _0x5fa3=['findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','final','utf8','parse','License'];(function(_0x11a549,_0x15412c){var _0x502ea8=function(_0x7cae05){while(--_0x7cae05){_0x11a549['push'](_0x11a549['shift']());}};_0x502ea8(++_0x15412c);}(_0x5fa3,0xc1));var _0x35fa=function(_0x47ba65,_0x5d5ada){_0x47ba65=_0x47ba65-0x0;var _0x130c72=_0x5fa3[_0x47ba65];return _0x130c72;};'use strict';var crypto=require(_0x35fa('0x0'));var util=require(_0x35fa('0x1'));var compose=require(_0x35fa('0x2'));var db=require(_0x35fa('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x19fb6a,_0x6053a7){if(_0x19fb6a&&_0x6053a7){if(_0x6053a7[_0x35fa('0x4')]&&_0x6053a7[_0x35fa('0x5')]){var _0xcc15d6=_0x6053a7[_0x35fa('0x4')];var _0x1eb1fa=_0x6053a7[_0x35fa('0x5')];var _0x4be487=_0xcc15d6[_0x35fa('0x6')]('-')[0x4];var _0x7745ec=_0xcc15d6[_0x35fa('0x6')]('-')[0x0];var _0x45f337=crypto[_0x35fa('0x7')](_0x35fa('0x8'),util[_0x35fa('0x9')](_0x35fa('0xa'),_0x4be487,_0xcc15d6,_0x7745ec));var _0x56e552=_0x45f337['update'](_0x1eb1fa,'base64','utf8');_0x56e552+=_0x45f337[_0x35fa('0xb')](_0x35fa('0xc'));var _0x1ae234=JSON[_0x35fa('0xd')](_0x56e552);return _0x1ae234['hasOwnProperty'](_0x19fb6a)?_0x1ae234[_0x19fb6a]:null;}}return null;}function isLimit(_0x40c66b,_0x1f30c6,_0x5b46d7,_0x1977ec){var _0x2a6c52=_0x1f30c6;return compose()['use'](function(_0x4fedb3,_0xf68566,_0x19df6b){return db[_0x35fa('0xe')][_0x35fa('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x41fb55){var _0x5845a1=getValueFromLicense(_0x40c66b,_0x41fb55);return _0x5845a1?_0x5845a1:_0x2a6c52;})[_0x35fa('0x10')](function(_0x1597b0){_0x2a6c52=_0x1597b0;return _0x5b46d7[_0x35fa('0x11')](_0x1977ec);})[_0x35fa('0x10')](function(_0x2cb75b){if(_0x2cb75b>=_0x2a6c52){return _0xf68566[_0x35fa('0x12')](0x193)[_0x35fa('0x13')]({'message':util['format'](_0x35fa('0x14'),_0x40c66b)});}_0x19df6b();})[_0x35fa('0x15')](function(_0x23e7ca){_0x19df6b(_0x23e7ca);});});}function isUserLimit(){return isLimit(_0x35fa('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x35fa('0x17')},{'role':_0x35fa('0x18')}]}});}exports[_0x35fa('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2e021cb..0aa0bca 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 _0xa112=['push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','add','lodash','moment','parseSearch','sqlOperator','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','map','conditions'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa112,0x13a));var _0x2a11=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xa112[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x2a11('0x0'));var moment=require(_0x2a11('0x1'));exports[_0x2a11('0x2')]=function(_0xdfb99d){var _0x70022b={'conditions':[]};_0x70022b[_0x2a11('0x3')]=_['startsWith'](_0xdfb99d,_0x2a11('0x4'))?'or':_0x2a11('0x5');var _0x251644=_0xdfb99d['replace'](_0x2a11('0x6'),'')[_0x2a11('0x7')]('[$or]','')[_0x2a11('0x8')]('||');for(var _0x29ea11=0x0;_0x29ea11<_0x251644[_0x2a11('0x9')];_0x29ea11++){var _0x3a20c5=_0x251644[_0x29ea11]['split'](':=');var _0x365467=_0x3a20c5[0x0];var _0x31827f=_0x3a20c5[_0x2a11('0xa')](0x1);_0x31827f[_0x2a11('0xb')](function(_0x4a83e8){var _0x5a0845=_0x4a83e8[_0x2a11('0x8')]('[')[_0x2a11('0xc')]();var _0x583328=_0x4a83e8[_0x2a11('0xd')](/\[(.*?)\]/g);_0x583328['forEach'](function(_0x2ba52e){var _0x463776=_0x2ba52e[_0x2a11('0x8')]('[')['filter'](function(_0x3c8526){return _0x3c8526['indexOf'](']')>-0x1;})[_0x2a11('0xe')](function(_0x13bf0d){return _0x13bf0d[_0x2a11('0x8')](']')[0x0];})[0x0];_0x70022b[_0x2a11('0xf')][_0x2a11('0x10')]({'field':_0x365467,'operator':_0x5a0845,'value':_0x463776});});});}return _0x70022b;};exports[_0x2a11('0x11')]=function(_0x2f38ec,_0x2b3b97,_0x321e9c){var _0x2174e6={};if(_0x2b3b97===_0x2a11('0x12')){if(_0x321e9c[_0x2a11('0x13')]===_0x2a11('0x14')){_0x321e9c[_0x2a11('0x13')]=_0x2a11('0x15');_0x321e9c[_0x2a11('0x16')]+=','+_0x321e9c[_0x2a11('0x16')];}else if(_[_0x2a11('0x17')]([_0x2a11('0x18'),_0x2a11('0x19')],_0x321e9c[_0x2a11('0x13')])){_0x321e9c[_0x2a11('0x16')]=moment(_0x321e9c['value'])['add'](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x321e9c[_0x2a11('0x1a')]){_0x2b3b97=_0x321e9c[_0x2a11('0x1a')];_0x2174e6[_0x2a11('0x1b')]=_0x2a11('0x1c')+_0x2f38ec+'.'+_0x321e9c['field']+_0x2a11('0x1d')+_0x321e9c['castTo']+')\x20'+parseOperator(_0x321e9c[_0x2a11('0x13')]);}else{_0x2174e6['text']=_0x2f38ec+'.'+_0x321e9c[_0x2a11('0x1e')]+'\x20'+parseOperator(_0x321e9c['operator']);}if(_[_0x2a11('0x17')]([_0x2a11('0x1f'),_0x2a11('0x20')],_0x321e9c['operator']))_0x2174e6[_0x2a11('0x1b')]='('+_0x2174e6[_0x2a11('0x1b')]+_0x2a11('0x21')+_0x2f38ec+'.'+_0x321e9c[_0x2a11('0x1e')]+_0x2a11('0x22');_0x2174e6[_0x2a11('0x16')]=parseValue(_0x2b3b97,_0x321e9c[_0x2a11('0x13')],_0x321e9c['value']);return _0x2174e6;};function parseOperator(_0x2b218a){var _0xca3aba;switch(_0x2b218a){case _0x2a11('0x23'):_0xca3aba=_0x2a11('0x24');break;case _0x2a11('0x20'):_0xca3aba=_0x2a11('0x25');break;case _0x2a11('0x14'):_0xca3aba=_0x2a11('0x26');break;case _0x2a11('0x1f'):_0xca3aba=_0x2a11('0x27');break;case'$substring':case _0x2a11('0x28'):case _0x2a11('0x29'):_0xca3aba=_0x2a11('0x2a');break;case _0x2a11('0x2b'):_0xca3aba=_0x2a11('0x2c');break;case _0x2a11('0x18'):_0xca3aba=_0x2a11('0x2d');break;case'$lte':_0xca3aba='<=\x20?';break;case _0x2a11('0x2e'):_0xca3aba=_0x2a11('0x2f');break;case _0x2a11('0x15'):_0xca3aba=_0x2a11('0x30');break;}return _0xca3aba;}function parseValue(_0x47b51f,_0x2f561a,_0x3872df){var _0x109536={'start':undefined,'end':undefined};switch(_0x2f561a){case _0x2a11('0x23'):case'$notIn':_0x109536[_0x2a11('0x31')]=_0x3872df['split'](',');break;case _0x2a11('0x32'):_0x109536[_0x2a11('0x31')]='%'+_0x3872df+'%';break;case'$startsWith':_0x109536[_0x2a11('0x31')]=_0x3872df+'%';break;case _0x2a11('0x29'):_0x109536[_0x2a11('0x31')]='%'+_0x3872df;break;case _0x2a11('0x15'):var _0x541459=_0x3872df[_0x2a11('0x8')](',');var _0x3872df=_0x541459[_0x2a11('0xc')]();var _0x284e1b=_0x541459[_0x2a11('0x33')]();if(_0x47b51f===_0x2a11('0x12')){_0x3872df=moment(_0x3872df)[_0x2a11('0x34')](0x0,!![])['format']();_0x284e1b=moment(_0x284e1b)[_0x2a11('0x34')](0x0,!![])['add'](0x17,_0x2a11('0x35'))[_0x2a11('0x36')](0x3b,'minutes')['add'](0x3b,'seconds')['format']();}_0x109536={'start':_0x3872df,'end':_0x284e1b};break;default:_0x109536[_0x2a11('0x31')]=_0x3872df;break;}return _0x109536;} \ No newline at end of file +var _0xb594=['BETWEEN\x20?\x20AND\x20?','$notIn','start','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','$lte','add','format','castTo','CAST(','field','\x20AS\x20','text','includes','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','<=\x20?','$gte','>=\x20?'];(function(_0x3fa733,_0x5e44d3){var _0x156b65=function(_0xedabb7){while(--_0xedabb7){_0x3fa733['push'](_0x3fa733['shift']());}};_0x156b65(++_0x5e44d3);}(_0xb594,0x15f));var _0x4b59=function(_0x346645,_0x3e9d9c){_0x346645=_0x346645-0x0;var _0x32f590=_0xb594[_0x346645];return _0x32f590;};'use strict';var _=require(_0x4b59('0x0'));var moment=require(_0x4b59('0x1'));exports[_0x4b59('0x2')]=function(_0x25a1ab){var _0x369628={'conditions':[]};_0x369628[_0x4b59('0x3')]=_[_0x4b59('0x4')](_0x25a1ab,_0x4b59('0x5'))?'or':_0x4b59('0x6');var _0x1f2cf9=_0x25a1ab[_0x4b59('0x7')](_0x4b59('0x8'),'')[_0x4b59('0x7')](_0x4b59('0x5'),'')[_0x4b59('0x9')]('||');for(var _0x12159b=0x0;_0x12159b<_0x1f2cf9[_0x4b59('0xa')];_0x12159b++){var _0x421fb8=_0x1f2cf9[_0x12159b][_0x4b59('0x9')](':=');var _0x4c2797=_0x421fb8[0x0];var _0xa8ad1c=_0x421fb8[_0x4b59('0xb')](0x1);_0xa8ad1c['forEach'](function(_0x2b8f2c){var _0x3847a0=_0x2b8f2c[_0x4b59('0x9')]('[')[_0x4b59('0xc')]();var _0x1595aa=_0x2b8f2c[_0x4b59('0xd')](/\[(.*?)\]/g);_0x1595aa['forEach'](function(_0xb3e33a){var _0x3ab866=_0xb3e33a['split']('[')[_0x4b59('0xe')](function(_0x596b74){return _0x596b74[_0x4b59('0xf')](']')>-0x1;})[_0x4b59('0x10')](function(_0x59b968){return _0x59b968[_0x4b59('0x9')](']')[0x0];})[0x0];_0x369628[_0x4b59('0x11')][_0x4b59('0x12')]({'field':_0x4c2797,'operator':_0x3847a0,'value':_0x3ab866});});});}return _0x369628;};exports[_0x4b59('0x13')]=function(_0x33e8aa,_0x26a532,_0xddd701){var _0x53f297={};if(_0x26a532==='DATE'){if(_0xddd701[_0x4b59('0x14')]===_0x4b59('0x15')){_0xddd701[_0x4b59('0x14')]=_0x4b59('0x16');_0xddd701['value']+=','+_0xddd701[_0x4b59('0x17')];}else if(_['includes'](['$gt',_0x4b59('0x18')],_0xddd701['operator'])){_0xddd701[_0x4b59('0x17')]=moment(_0xddd701[_0x4b59('0x17')])[_0x4b59('0x19')](0x1,'days')[_0x4b59('0x1a')]('YYYY-MM-DD');}}if(_0xddd701[_0x4b59('0x1b')]){_0x26a532=_0xddd701[_0x4b59('0x1b')];_0x53f297['text']=_0x4b59('0x1c')+_0x33e8aa+'.'+_0xddd701[_0x4b59('0x1d')]+_0x4b59('0x1e')+_0xddd701[_0x4b59('0x1b')]+')\x20'+parseOperator(_0xddd701[_0x4b59('0x14')]);}else{_0x53f297[_0x4b59('0x1f')]=_0x33e8aa+'.'+_0xddd701[_0x4b59('0x1d')]+'\x20'+parseOperator(_0xddd701['operator']);}if(_[_0x4b59('0x20')]([_0x4b59('0x21'),'$notIn'],_0xddd701[_0x4b59('0x14')]))_0x53f297['text']='('+_0x53f297[_0x4b59('0x1f')]+_0x4b59('0x22')+_0x33e8aa+'.'+_0xddd701[_0x4b59('0x1d')]+_0x4b59('0x23');_0x53f297[_0x4b59('0x17')]=parseValue(_0x26a532,_0xddd701[_0x4b59('0x14')],_0xddd701[_0x4b59('0x17')]);return _0x53f297;};function parseOperator(_0x3ef64c){var _0x4bf30c;switch(_0x3ef64c){case _0x4b59('0x24'):_0x4bf30c='IN\x20?';break;case'$notIn':_0x4bf30c=_0x4b59('0x25');break;case _0x4b59('0x15'):_0x4bf30c='=\x20?';break;case _0x4b59('0x21'):_0x4bf30c=_0x4b59('0x26');break;case _0x4b59('0x27'):case _0x4b59('0x28'):case _0x4b59('0x29'):_0x4bf30c=_0x4b59('0x2a');break;case _0x4b59('0x2b'):_0x4bf30c='<\x20?';break;case _0x4b59('0x2c'):_0x4bf30c='>\x20?';break;case _0x4b59('0x18'):_0x4bf30c=_0x4b59('0x2d');break;case _0x4b59('0x2e'):_0x4bf30c=_0x4b59('0x2f');break;case _0x4b59('0x16'):_0x4bf30c=_0x4b59('0x30');break;}return _0x4bf30c;}function parseValue(_0x1b3526,_0x43cfda,_0x3eb0d6){var _0x1a7ca4={'start':undefined,'end':undefined};switch(_0x43cfda){case'$in':case _0x4b59('0x31'):_0x1a7ca4[_0x4b59('0x32')]=_0x3eb0d6['split'](',');break;case _0x4b59('0x27'):_0x1a7ca4[_0x4b59('0x32')]='%'+_0x3eb0d6+'%';break;case _0x4b59('0x28'):_0x1a7ca4['start']=_0x3eb0d6+'%';break;case _0x4b59('0x29'):_0x1a7ca4['start']='%'+_0x3eb0d6;break;case _0x4b59('0x16'):var _0x48cf01=_0x3eb0d6[_0x4b59('0x9')](',');var _0x3eb0d6=_0x48cf01[_0x4b59('0xc')]();var _0x3c8377=_0x48cf01[_0x4b59('0x33')]();if(_0x1b3526===_0x4b59('0x34')){_0x3eb0d6=moment(_0x3eb0d6)[_0x4b59('0x35')](0x0,!![])[_0x4b59('0x1a')]();_0x3c8377=moment(_0x3c8377)[_0x4b59('0x35')](0x0,!![])[_0x4b59('0x19')](0x17,_0x4b59('0x36'))[_0x4b59('0x19')](0x3b,_0x4b59('0x37'))[_0x4b59('0x19')](0x3b,_0x4b59('0x38'))[_0x4b59('0x1a')]();}_0x1a7ca4={'start':_0x3eb0d6,'end':_0x3c8377};break;default:_0x1a7ca4[_0x4b59('0x32')]=_0x3eb0d6;break;}return _0x1a7ca4;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 70fbab4..d7c80a7 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 _0xc82a=['fields','filters','isEmpty','forOwn','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','priority','cast','unsigned','substr','DESC','ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','query','$id','map','intersection','model','attributes','nolimit','limit','offset','order','sort','filter','object','value','where','merge','VIRTUAL','lodash','moment','parse','includes','keys'];(function(_0xade2e4,_0x1b7403){var _0x2ef0d1=function(_0x403591){while(--_0x403591){_0xade2e4['push'](_0xade2e4['shift']());}};_0x2ef0d1(++_0x1b7403);}(_0xc82a,0x191));var _0xac82=function(_0x3e32d6,_0x37c0bb){_0x3e32d6=_0x3e32d6-0x0;var _0x52af90=_0xc82a[_0x3e32d6];return _0x52af90;};'use strict';var _=require(_0xac82('0x0'));var sequelize=require('sequelize');var moment=require(_0xac82('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b016c){var _0x16e0b5=['ne'];try{var _0x568c48=JSON[_0xac82('0x2')](_0x1b016c);var _0x5464f7=Object['keys'](_0x568c48)[0x0];return _0x16e0b5[_0xac82('0x3')](_0x5464f7);}catch(_0x3c07f9){return![];}}function getOperatorValue(_0x3e321f){var _0x40e918=JSON[_0xac82('0x2')](_0x3e321f);var _0x57f698=Object[_0xac82('0x4')](_0x40e918)[0x0];var _0x4da8d2=_0x40e918[_0x57f698];return{['$'+_0x57f698]:_0x4da8d2};}exports[_0xac82('0x5')]=function(_0x5e697c){var _0x35bbd6=null;if(_0x5e697c){_0x35bbd6=_0x5e697c['split'](',');}return _0x35bbd6;};exports[_0xac82('0x6')]=function(_0x1c1b90,_0x2cd4d9){var _0x5310d0={};if(!_[_0xac82('0x7')](_0x1c1b90)){_[_0xac82('0x8')](_0x1c1b90,function(_0x44cad8,_0x446b40){try{if(_0x2cd4d9){var _0x5d93f9=_['find'](_0x2cd4d9,{'name':_0x446b40})||{};if(hasSequelizeOperator(_0x44cad8)){_0x5310d0[_0x446b40]=getOperatorValue(_0x44cad8);}else if(_0x5d93f9[_0xac82('0x9')]==='DATE'&&_[_0xac82('0xa')](_0x44cad8)){var _0x15bf81=JSON[_0xac82('0x2')](_0x44cad8);var _0x919371={'$gte':moment(moment(_0x15bf81[_0xac82('0xb')])[_0xac82('0xc')](_0xac82('0xd')))[_0xac82('0xe')]()[_0xac82('0xc')](),'$lte':moment(moment(_0x15bf81[_0xac82('0xf')])[_0xac82('0xc')]('YYYY-MM-DD'))[_0xac82('0xe')]()[_0xac82('0x10')](0x1,'s')[_0xac82('0xc')]()};_0x5310d0[_0x446b40]=_0x919371;}else if(_0x5d93f9[_0xac82('0x11')]==='uniqueid'){_0x5310d0[_0x446b40]=_0x44cad8;}else{_0x5310d0[_0x446b40]=_[_0xac82('0x12')](_0x44cad8)?_0x44cad8:JSON[_0xac82('0x2')](_0x44cad8);}}else{_0x5310d0[_0x446b40]=_['isArray'](_0x44cad8)?_0x44cad8:JSON['parse'](_0x44cad8);}}catch(_0x114928){_0x5310d0[_0x446b40]=_0x44cad8[_0xac82('0x13')](',');}});}return _0x5310d0;};exports['limit']=function(_0x17b26a){_0x17b26a=parseInt(_0x17b26a,0xa);if(!_0x17b26a||_0x17b26a<0x0){_0x17b26a=LIMIT_VALUE;}return _0x17b26a;};exports['offset']=function(_0x4810c6){_0x4810c6=parseInt(_0x4810c6,0xa);if(!_0x4810c6||_0x4810c6<0x0){_0x4810c6=0x0;}return _0x4810c6;};exports['sort']=function(_0x3df93c){var _0x55f590,_0x1b617c=null;if(_0x3df93c){_0x55f590=_0x3df93c[_0xac82('0x13')](',');_0x1b617c=_['map'](_0x55f590,function(_0x403fc9){if(_0x403fc9['indexOf']('-')===0x0){return[_0x403fc9===_0xac82('0x14')?sequelize[_0xac82('0x15')](sequelize['col'](_0xac82('0x14')),_0xac82('0x16')):_0x403fc9[_0xac82('0x17')](0x1),_0xac82('0x18')];}else{return[_0x403fc9===_0xac82('0x14')?sequelize[_0xac82('0x15')](sequelize['col']('priority'),_0xac82('0x16')):_0x403fc9,_0xac82('0x19')];}});}return _0x1b617c;};exports[_0xac82('0x1a')]=function(_0x3b146a,_0x17618a){if(_['isEmpty'](_0x3b146a)){return _0x3b146a;}if(_[_0xac82('0x12')](_0x3b146a)){for(var _0x23db5a=0x0;_0x23db5a<_0x3b146a[_0xac82('0x1b')];_0x23db5a+=0x1){_0x3b146a[_0x23db5a]=this[_0xac82('0x1a')](_0x3b146a[_0x23db5a],_0x17618a);}return _0x3b146a;}if(!_['isObject'](_0x3b146a)){return _0x3b146a;}if(_[_0xac82('0x1c')](_0x17618a)){_0x17618a=[_0x17618a];}if(!_['isArray'](_0x17618a)){return _0x3b146a;}for(var _0x56f7e0=0x0;_0x56f7e0<_0x17618a[_0xac82('0x1b')];_0x56f7e0+=0x1){_[_0xac82('0x1d')](_0x3b146a,_0x17618a[_0x56f7e0]);}for(var _0x229c3b in _0x3b146a){if(_0x3b146a[_0xac82('0x1e')](_0x229c3b)){_0x3b146a[_0x229c3b]=this[_0xac82('0x1a')](_0x3b146a[_0x229c3b],_0x17618a);}}return _0x3b146a;};exports[_0xac82('0x1f')]=function(_0x41d08e){return _0x41d08e[_0xac82('0x20')](RegExp(_0xac82('0x21')))?!![]:![];};exports[_0xac82('0x22')]=function(_0x433021){return _0x433021[_0xac82('0x20')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x5ab7e5,_0x480c42){var _0x5cda4e=[];var _0x435dc2=/[ `!@#$%^&*()_\-?~]/;var _0x56180b=_0x480c42?_0xac82('0x23'):_0xac82('0x24');_0x5ab7e5[_0xac82('0x13')](/[ ,]+/)[_0xac82('0x25')](function(_0x5c4505){_0x5c4505=_0x5c4505[_0xac82('0x26')](/([^:]")"+/g,'$1');_0x5c4505='+'+_0x5c4505+'*';var _0x341396=_0x5c4505['match'](_0x435dc2);if(_0x341396){_0x5c4505='\x22'+_0x5c4505+'\x22';}_0x5cda4e['push'](_0x5c4505);});_0x56180b=_0x56180b[_0xac82('0x26')]('{EXPR}',_0x5cda4e[_0xac82('0x27')]('\x20'));return _0x56180b;};exports[_0xac82('0x28')]=function(_0x68c7b1,_0x18c6e0,_0x1a0afa){var _0x58f5e1={},_0xe444ec={};if(_0x18c6e0[_0xac82('0x29')][_0xac82('0x2a')]){_0x18c6e0[_0xac82('0x29')]['id']=_0x18c6e0[_0xac82('0x29')][_0xac82('0x2a')];delete _0x18c6e0['query']['$id'];}_0x58f5e1['model']=_[_0xac82('0x2b')](_0x68c7b1,_0xac82('0x11'));_0x58f5e1[_0xac82('0x29')]=_[_0xac82('0x4')](_0x18c6e0['query']);_0x58f5e1[_0xac82('0x6')]=_[_0xac82('0x2c')](_0x58f5e1[_0xac82('0x2d')],_0x58f5e1[_0xac82('0x29')]);_0xe444ec[_0xac82('0x2e')]=_[_0xac82('0x2c')](_0x58f5e1['model'],this[_0xac82('0x5')](_0x18c6e0[_0xac82('0x29')][_0xac82('0x5')]));_0xe444ec['attributes']=_0xe444ec[_0xac82('0x2e')][_0xac82('0x1b')]?_0xe444ec[_0xac82('0x2e')]:_0x58f5e1[_0xac82('0x2d')];if(!_0x18c6e0[_0xac82('0x29')][_0xac82('0x1e')](_0xac82('0x2f'))){_0xe444ec[_0xac82('0x30')]=this[_0xac82('0x30')](_0x18c6e0['query'][_0xac82('0x30')]);_0xe444ec[_0xac82('0x31')]=this[_0xac82('0x31')](_0x18c6e0['query'][_0xac82('0x31')]);}_0xe444ec[_0xac82('0x32')]=this[_0xac82('0x33')](_0x18c6e0['query'][_0xac82('0x33')]);_0xe444ec['where']=this[_0xac82('0x6')](_['pick'](_0x18c6e0[_0xac82('0x29')],_0x58f5e1[_0xac82('0x6')]),_0x68c7b1);if(_0x18c6e0[_0xac82('0x29')][_0xac82('0x34')]){var _0x4aea7b=_0x68c7b1;var _0x56ecdd=_0x18c6e0[_0xac82('0x29')][_0xac82('0x34')];if(typeof _0x56ecdd===_0xac82('0x35')){_0x4aea7b=_[_0xac82('0x34')](_0x68c7b1,function(_0x10294c){return _[_0xac82('0x3')](_0x56ecdd['columns'],_0x10294c[_0xac82('0x11')]);});_0x56ecdd=_0x56ecdd[_0xac82('0x36')];}_0xe444ec[_0xac82('0x37')]=_[_0xac82('0x38')](_0xe444ec[_0xac82('0x37')],{'$or':_[_0xac82('0x2b')](_0x4aea7b,function(_0x4c0373){if(_0x4c0373[_0xac82('0x9')]!==_0xac82('0x39')){if(_0x1a0afa){return sequelize[_0xac82('0x37')](sequelize['fn']('lower',sequelize['col'](_0x4c0373['name'])),{'$like':sequelize['fn']('lower','%'+_0x18c6e0[_0xac82('0x29')][_0xac82('0x34')]+'%')});}else{var _0x4040d7={};_0x4040d7[_0x4c0373[_0xac82('0x11')]]={'$like':'%'+_0x18c6e0[_0xac82('0x29')][_0xac82('0x34')]+'%'};return _0x4040d7;}}})});}_0xe444ec=_[_0xac82('0x38')]({},_0xe444ec,_0x18c6e0['options']);return _0xe444ec;}; \ No newline at end of file +var _0xaf67=['priority','cast','col','unsigned','substr','ASC','omit','length','unset','isNumeric','match','getFullTextValue','\x22{EXPR}\x22','replace','push','{EXPR}','join','getOptions','query','$id','model','name','filters','intersection','attributes','nolimit','sort','where','filter','merge','type','VIRTUAL','lower','options','lodash','sequelize','moment','keys','includes','fields','split','isEmpty','forOwn','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','map','indexOf'];(function(_0xa86d00,_0x4f6668){var _0x117fa0=function(_0x402d62){while(--_0x402d62){_0xa86d00['push'](_0xa86d00['shift']());}};_0x117fa0(++_0x4f6668);}(_0xaf67,0x1f2));var _0x7af6=function(_0x233536,_0x22698f){_0x233536=_0x233536-0x0;var _0x4198f6=_0xaf67[_0x233536];return _0x4198f6;};'use strict';var _=require(_0x7af6('0x0'));var sequelize=require(_0x7af6('0x1'));var moment=require(_0x7af6('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x228b69){var _0x7a9ff9=['ne'];try{var _0xe5c148=JSON['parse'](_0x228b69);var _0x275240=Object[_0x7af6('0x3')](_0xe5c148)[0x0];return _0x7a9ff9[_0x7af6('0x4')](_0x275240);}catch(_0x58decd){return![];}}function getOperatorValue(_0x51c826){var _0x43c6c2=JSON['parse'](_0x51c826);var _0x122a70=Object[_0x7af6('0x3')](_0x43c6c2)[0x0];var _0x516a4c=_0x43c6c2[_0x122a70];return{['$'+_0x122a70]:_0x516a4c};}exports[_0x7af6('0x5')]=function(_0x5e8d63){var _0x1d81f8=null;if(_0x5e8d63){_0x1d81f8=_0x5e8d63[_0x7af6('0x6')](',');}return _0x1d81f8;};exports['filters']=function(_0x4445f4,_0x1bbb50){var _0x402604={};if(!_[_0x7af6('0x7')](_0x4445f4)){_[_0x7af6('0x8')](_0x4445f4,function(_0x332a9c,_0x319e03){try{if(_0x1bbb50){var _0xf24797=_['find'](_0x1bbb50,{'name':_0x319e03})||{};if(hasSequelizeOperator(_0x332a9c)){_0x402604[_0x319e03]=getOperatorValue(_0x332a9c);}else if(_0xf24797['type']===_0x7af6('0x9')&&_[_0x7af6('0xa')](_0x332a9c)){var _0x9245ed=JSON[_0x7af6('0xb')](_0x332a9c);var _0x11236b={'$gte':moment(moment(_0x9245ed[_0x7af6('0xc')])[_0x7af6('0xd')](_0x7af6('0xe')))[_0x7af6('0xf')]()[_0x7af6('0xd')](),'$lte':moment(moment(_0x9245ed[_0x7af6('0x10')])['format'](_0x7af6('0xe')))[_0x7af6('0xf')]()[_0x7af6('0x11')](0x1,'s')[_0x7af6('0xd')]()};_0x402604[_0x319e03]=_0x11236b;}else if(_0xf24797['name']===_0x7af6('0x12')){_0x402604[_0x319e03]=_0x332a9c;}else{_0x402604[_0x319e03]=_['isArray'](_0x332a9c)?_0x332a9c:JSON[_0x7af6('0xb')](_0x332a9c);}}else{_0x402604[_0x319e03]=_[_0x7af6('0x13')](_0x332a9c)?_0x332a9c:JSON['parse'](_0x332a9c);}}catch(_0x40db6a){_0x402604[_0x319e03]=_0x332a9c[_0x7af6('0x6')](',');}});}return _0x402604;};exports[_0x7af6('0x14')]=function(_0x459c9f){_0x459c9f=parseInt(_0x459c9f,0xa);if(!_0x459c9f||_0x459c9f<0x0){_0x459c9f=LIMIT_VALUE;}return _0x459c9f;};exports[_0x7af6('0x15')]=function(_0x316258){_0x316258=parseInt(_0x316258,0xa);if(!_0x316258||_0x316258<0x0){_0x316258=0x0;}return _0x316258;};exports['sort']=function(_0x1aefd2){var _0x2c9e6a,_0x4deefb=null;if(_0x1aefd2){_0x2c9e6a=_0x1aefd2[_0x7af6('0x6')](',');_0x4deefb=_[_0x7af6('0x16')](_0x2c9e6a,function(_0x4b0cb0){if(_0x4b0cb0[_0x7af6('0x17')]('-')===0x0){return[_0x4b0cb0===_0x7af6('0x18')?sequelize[_0x7af6('0x19')](sequelize[_0x7af6('0x1a')](_0x7af6('0x18')),_0x7af6('0x1b')):_0x4b0cb0[_0x7af6('0x1c')](0x1),'DESC'];}else{return[_0x4b0cb0===_0x7af6('0x18')?sequelize[_0x7af6('0x19')](sequelize[_0x7af6('0x1a')](_0x7af6('0x18')),_0x7af6('0x1b')):_0x4b0cb0,_0x7af6('0x1d')];}});}return _0x4deefb;};exports[_0x7af6('0x1e')]=function(_0x4527bc,_0x1b59c1){if(_['isEmpty'](_0x4527bc)){return _0x4527bc;}if(_[_0x7af6('0x13')](_0x4527bc)){for(var _0xf2497=0x0;_0xf2497<_0x4527bc[_0x7af6('0x1f')];_0xf2497+=0x1){_0x4527bc[_0xf2497]=this[_0x7af6('0x1e')](_0x4527bc[_0xf2497],_0x1b59c1);}return _0x4527bc;}if(!_['isObject'](_0x4527bc)){return _0x4527bc;}if(_['isString'](_0x1b59c1)){_0x1b59c1=[_0x1b59c1];}if(!_['isArray'](_0x1b59c1)){return _0x4527bc;}for(var _0x76719=0x0;_0x76719<_0x1b59c1[_0x7af6('0x1f')];_0x76719+=0x1){_[_0x7af6('0x20')](_0x4527bc,_0x1b59c1[_0x76719]);}for(var _0x23e023 in _0x4527bc){if(_0x4527bc['hasOwnProperty'](_0x23e023)){_0x4527bc[_0x23e023]=this['omit'](_0x4527bc[_0x23e023],_0x1b59c1);}}return _0x4527bc;};exports[_0x7af6('0x21')]=function(_0x461d3a){return _0x461d3a[_0x7af6('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x259e78){return _0x259e78[_0x7af6('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x7af6('0x23')]=function(_0x5777ff,_0x36cbad){var _0x374f4a=[];var _0x3f59d7=/[ `!@#$%^&*()_\-?~]/;var _0x25d75d=_0x36cbad?_0x7af6('0x24'):'{EXPR}';_0x5777ff['split'](/[ ,]+/)['forEach'](function(_0x503738){_0x503738=_0x503738[_0x7af6('0x25')](/([^:]")"+/g,'$1');_0x503738='+'+_0x503738+'*';var _0x2058f5=_0x503738[_0x7af6('0x22')](_0x3f59d7);if(_0x2058f5){_0x503738='\x22'+_0x503738+'\x22';}_0x374f4a[_0x7af6('0x26')](_0x503738);});_0x25d75d=_0x25d75d[_0x7af6('0x25')](_0x7af6('0x27'),_0x374f4a[_0x7af6('0x28')]('\x20'));return _0x25d75d;};exports[_0x7af6('0x29')]=function(_0x43acad,_0x3f3134,_0x49d56b){var _0x5d3afd={},_0x4eb454={};if(_0x3f3134[_0x7af6('0x2a')]['$id']){_0x3f3134[_0x7af6('0x2a')]['id']=_0x3f3134['query']['$id'];delete _0x3f3134[_0x7af6('0x2a')][_0x7af6('0x2b')];}_0x5d3afd[_0x7af6('0x2c')]=_[_0x7af6('0x16')](_0x43acad,_0x7af6('0x2d'));_0x5d3afd[_0x7af6('0x2a')]=_[_0x7af6('0x3')](_0x3f3134[_0x7af6('0x2a')]);_0x5d3afd[_0x7af6('0x2e')]=_[_0x7af6('0x2f')](_0x5d3afd[_0x7af6('0x2c')],_0x5d3afd['query']);_0x4eb454['attributes']=_[_0x7af6('0x2f')](_0x5d3afd['model'],this[_0x7af6('0x5')](_0x3f3134[_0x7af6('0x2a')][_0x7af6('0x5')]));_0x4eb454['attributes']=_0x4eb454['attributes'][_0x7af6('0x1f')]?_0x4eb454[_0x7af6('0x30')]:_0x5d3afd[_0x7af6('0x2c')];if(!_0x3f3134[_0x7af6('0x2a')]['hasOwnProperty'](_0x7af6('0x31'))){_0x4eb454[_0x7af6('0x14')]=this['limit'](_0x3f3134[_0x7af6('0x2a')][_0x7af6('0x14')]);_0x4eb454['offset']=this['offset'](_0x3f3134[_0x7af6('0x2a')][_0x7af6('0x15')]);}_0x4eb454['order']=this[_0x7af6('0x32')](_0x3f3134[_0x7af6('0x2a')][_0x7af6('0x32')]);_0x4eb454[_0x7af6('0x33')]=this[_0x7af6('0x2e')](_['pick'](_0x3f3134[_0x7af6('0x2a')],_0x5d3afd[_0x7af6('0x2e')]),_0x43acad);if(_0x3f3134[_0x7af6('0x2a')]['filter']){var _0x19ef1e=_0x43acad;var _0x1080e6=_0x3f3134[_0x7af6('0x2a')][_0x7af6('0x34')];if(typeof _0x1080e6==='object'){_0x19ef1e=_[_0x7af6('0x34')](_0x43acad,function(_0x36def9){return _[_0x7af6('0x4')](_0x1080e6['columns'],_0x36def9['name']);});_0x1080e6=_0x1080e6['value'];}_0x4eb454[_0x7af6('0x33')]=_[_0x7af6('0x35')](_0x4eb454[_0x7af6('0x33')],{'$or':_[_0x7af6('0x16')](_0x19ef1e,function(_0x457bda){if(_0x457bda[_0x7af6('0x36')]!==_0x7af6('0x37')){if(_0x49d56b){return sequelize['where'](sequelize['fn'](_0x7af6('0x38'),sequelize[_0x7af6('0x1a')](_0x457bda[_0x7af6('0x2d')])),{'$like':sequelize['fn'](_0x7af6('0x38'),'%'+_0x3f3134[_0x7af6('0x2a')][_0x7af6('0x34')]+'%')});}else{var _0x1b3747={};_0x1b3747[_0x457bda[_0x7af6('0x2d')]]={'$like':'%'+_0x3f3134[_0x7af6('0x2a')]['filter']+'%'};return _0x1b3747;}}})});}_0x4eb454=_[_0x7af6('0x35')]({},_0x4eb454,_0x3f3134[_0x7af6('0x39')]);return _0x4eb454;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 5a7fd80..36d5f4d 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 _0x2071=['voiceStatus','voicePause','pause','every','chatStatus','faxStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','unknown','busy','getAgentStatus','isArray','startCase','Queue','findOne','all','map','uniq','value','getAgentIdsByQueues','length','filter','includes','resolve','User','name','pauseType','find','catch','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','fullname','substring','indexOf','internal','toLowerCase','DESC','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatPause','chatCapacity','openchannelCapacity','mailCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','lodash','jayson/promise','http','client','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','idle','unavailable','isNil'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x2071,0xb0));var _0x1207=function(_0x451d04,_0x999e7d){_0x451d04=_0x451d04-0x0;var _0x32c6fe=_0x2071[_0x451d04];return _0x32c6fe;};'use strict';var _=require(_0x1207('0x0'));var jayson=require(_0x1207('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x1207('0x2')]({'port':0x232a});var routingClient=jayson[_0x1207('0x3')][_0x1207('0x2')]({'port':0x232c});function isAgentPaused(_0x3a8d21,_0x728511){var _0x2dd8a8=[_0x3a8d21['chatPause'],_0x3a8d21[_0x1207('0x4')],_0x3a8d21[_0x1207('0x5')],_0x3a8d21[_0x1207('0x6')],_0x3a8d21[_0x1207('0x7')],_0x3a8d21['voicePause'],_0x3a8d21[_0x1207('0x8')]];if(!_0x728511)return _['every'](_0x2dd8a8);var _0x247b2d=_['filter'](_0x2dd8a8);return _0x247b2d['length']>0x0&&_0x247b2d['length']<_0x2dd8a8['length']?!![]:![];}function isIdle(_0x270767){return _0x270767===_0x1207('0x9')||_0x270767==='unknown'||_0x270767===_0x1207('0xa')||_0x270767==='ringing'||_[_0x1207('0xb')](_0x270767);}function isAgentIdle(_0x5a0eb2){if(_0x5a0eb2[_0x1207('0xc')]!==_0x1207('0x9')&&_0x5a0eb2[_0x1207('0xd')]){_0x5a0eb2['voiceStatus']=_0x1207('0xe');return![];}return _[_0x1207('0xf')]([_0x5a0eb2[_0x1207('0x10')],_0x5a0eb2[_0x1207('0x11')],_0x5a0eb2['mailStatus'],_0x5a0eb2['openchannelStatus'],_0x5a0eb2[_0x1207('0x12')],_0x5a0eb2['voiceStatus'],_0x5a0eb2[_0x1207('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1207('0x14')](_0x1207('0x15'),{})[_0x1207('0x16')](function(_0x5cd133){if(_0x5cd133[_0x1207('0x17')]){throw new Error(_0x1207('0x18'));}var _0x2b5052=_0x5cd133[_0x1207('0x19')];return routingClient[_0x1207('0x14')]('Agents',{})[_0x1207('0x16')](function(_0x209739){if(_0x209739[_0x1207('0x17')]){throw new Error(_0x1207('0x1a'));}var _0x558e26=_0x209739[_0x1207('0x19')];return _[_0x1207('0x1b')]({},_0x2b5052,_0x558e26);});})['catch'](function(_0x1211f7){throw _0x1211f7;});}exports[_0x1207('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x4baa6f){var _0x5ada66=_0x1207('0x1d');if(isAgentPaused(_0x4baa6f))_0x5ada66=_0x1207('0xe');else if(isAgentPaused(_0x4baa6f,!![]))_0x5ada66='*pause';else if(isAgentIdle(_0x4baa6f))_0x5ada66=_0x1207('0x9');else _0x5ada66=_0x1207('0x1e');return _0x5ada66;}exports[_0x1207('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x567816,_0x329e84){var _0x13832d=_[_0x1207('0x20')](_0x567816)?_0x567816:[_0x567816];var _0x116e72=_[_0x1207('0x21')](_0x329e84)+_0x1207('0x22');var _0x140a4c=_['map'](_0x13832d,function(_0x1febb5){return db[_0x116e72][_0x1207('0x23')]({'where':{'id':_0x1febb5}})[_0x1207('0x16')](function(_0x3709d0){if(!_0x3709d0)return[];return _0x3709d0['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x1207('0x24')](_0x140a4c)[_0x1207('0x16')](function(_0x3f6d98){var _0x41bd93=_(_0x3f6d98)['flatten']()[_0x1207('0x25')]('id')[_0x1207('0x26')]()[_0x1207('0x27')]();return _0x41bd93;});}exports[_0x1207('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x442dcf,_0x100389,_0x3d317d){try{if(_0x100389[_0x1207('0x29')]>0x0){_0x442dcf=_0x442dcf[_0x1207('0x2a')](function(_0xc8921b){return _0x100389[_0x1207('0x2b')](_0xc8921b['id']);});}var _0x3eec8f=_0x442dcf[_0x1207('0x2a')](function(_0x158b3e){var _0x550e8b='busy';if(isAgentIdle(_0x158b3e)){_0x550e8b='idle';}return _0x550e8b===_0x3d317d;});return _[_0x1207('0x25')](_0x3eec8f,'id');}catch(_0x38cd71){throw _0x38cd71;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3351c5,_0x2c6ad6,_0x4eb703){return Promise[_0x1207('0x2c')]()[_0x1207('0x16')](function(){if(_0x2c6ad6[_0x1207('0x29')]>0x0){_0x3351c5=_0x3351c5[_0x1207('0x2a')](function(_0x14039){return _0x2c6ad6['includes'](_0x14039['id']);});}return _0x3351c5;})[_0x1207('0x16')](function(){return db[_0x1207('0x2d')]['findAll']({'attributes':['id',_0x1207('0x2e'),'fullname','chatPause',_0x1207('0x4'),_0x1207('0x5'),_0x1207('0x6'),'smsPause',_0x1207('0xd'),'whatsappPause',_0x1207('0x2f')],'where':{'id':{'$in':_[_0x1207('0x25')](_0x3351c5,'id')}},'raw':!![]});})['then'](function(_0x1b422e){return _0x1b422e[_0x1207('0x25')](function(_0x5b9d8e){var _0x213b55=_[_0x1207('0x30')](_0x3351c5,['id',_0x5b9d8e['id']]);var _0x26a726=filterAgentAttributes(_0x213b55);_[_0x1207('0x1b')](_0x5b9d8e,_0x26a726);_0x5b9d8e['globalStatus']=getAgentStatus(_0x5b9d8e);return _0x5b9d8e;});})['then'](function(_0x1c8618){var _0x654021=sortAgentsByStatus(_0x1c8618,_0x4eb703);return _[_0x1207('0x25')](_0x654021,'id');})[_0x1207('0x31')](function(_0x4b03c4){throw _0x4b03c4;});}exports[_0x1207('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x280682){var _0x34d104={'fields':[],'order':null};var _0x474192=_0x280682[_0x1207('0x33')](',');_0x34d104[_0x1207('0x34')]=_[_0x1207('0x2a')](_0x474192,function(_0x5c226e){if(!_0x5c226e[_0x1207('0x2b')](_0x1207('0x35'))){return!![];}_0x34d104[_0x1207('0x36')]=_[_0x1207('0x37')](_0x5c226e,'-')?'DESC':_0x1207('0x38');return![];});return _0x34d104;}exports[_0x1207('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0xaacef2){if(_0xaacef2['includes'](_0x1207('0x3a'))&&!_0xaacef2[_0x1207('0x2b')]('internal')){var _0x31c3ab=_0xaacef2[_0x1207('0x3b')](0x0,_0xaacef2[_0x1207('0x3c')](_0x1207('0x3a')));_0xaacef2+=','+_0x31c3ab+_0x1207('0x3d');}return _0xaacef2;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x3a1d15,_0x19a674){var _0x20ed4d=_0x3a1d15['sort'](function(_0x32064a,_0x3b5756){if(_0x32064a[_0x1207('0x35')]===_0x3b5756[_0x1207('0x35')]){if(_0x32064a[_0x1207('0x35')]===_0x1207('0xe')){if(_0x19a674==='DESC'){return(_0x32064a[_0x1207('0x2f')]||'')<(_0x3b5756[_0x1207('0x2f')]||'')||_0x32064a[_0x1207('0x3a')][_0x1207('0x3e')]()>_0x3b5756[_0x1207('0x3a')][_0x1207('0x3e')]()?0x1:-0x1;}else{return(_0x32064a[_0x1207('0x2f')]||'')<(_0x3b5756[_0x1207('0x2f')]||'')||_0x32064a['fullname'][_0x1207('0x3e')]()>_0x3b5756['fullname'][_0x1207('0x3e')]()?-0x1:0x1;}}else{if(_0x19a674===_0x1207('0x3f')){return _0x32064a[_0x1207('0x3a')][_0x1207('0x3e')]()<_0x3b5756[_0x1207('0x3a')]['toLowerCase']()?0x1:-0x1;}else{return _0x32064a['fullname'][_0x1207('0x3e')]()<_0x3b5756[_0x1207('0x3a')][_0x1207('0x3e')]()?-0x1:0x1;}}}else{if(_0x19a674===_0x1207('0x3f')){return _0x32064a['globalStatus']<_0x3b5756['globalStatus']?0x1:-0x1;}else{return _0x32064a[_0x1207('0x35')]<_0x3b5756[_0x1207('0x35')]?-0x1:0x1;}}});return _0x20ed4d;}exports[_0x1207('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x197e6c){var _0x1d8a47=[_0x1207('0x41'),_0x1207('0x42'),_0x1207('0x43'),_0x1207('0x44'),_0x1207('0x2f'),_0x1207('0x44'),_0x1207('0x3d'),_0x1207('0x45'),_0x1207('0x46'),'openchannelPause',_0x1207('0x5'),'smsPause',_0x1207('0x8'),_0x1207('0x4'),_0x1207('0xd'),_0x1207('0x47'),_0x1207('0x48'),_0x1207('0x49'),'smsCapacity','whatsappCapacity',_0x1207('0x4a'),_0x1207('0x4b'),_0x1207('0x4c'),_0x1207('0x4d'),_0x1207('0x4e'),_0x1207('0x4f'),_0x1207('0x50'),'chatStatus',_0x1207('0x51'),_0x1207('0x52'),_0x1207('0x12'),_0x1207('0x13'),_0x1207('0x11'),'voiceStatus',_0x1207('0x53'),_0x1207('0x54'),_0x1207('0x55'),'smsStatusTime','whatsappStatusTime',_0x1207('0x56'),'voiceStatusTime','queue',_0x1207('0x57'),_0x1207('0x58'),_0x1207('0x59'),_0x1207('0x5a'),'routealias'];var _0x3a4826=['chatPause',_0x1207('0x6'),_0x1207('0x5'),_0x1207('0x7'),_0x1207('0x8'),_0x1207('0x4'),_0x1207('0xd'),'online'];var _0x297ac2=_(_0x197e6c)[_0x1207('0x5b')](_0x3a4826)[_0x1207('0x5c')](_0x1d8a47)['value']();return _0x297ac2;}exports[_0x1207('0x5d')]=filterAgentAttributes; \ No newline at end of file +var _0xf46a=['http','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','*pause','idle','getAgentStatus','isArray','findOne','getAgents','all','map','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','faxPause','pauseType','merge','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','userpic','lastLoginAt','lastPauseAt','address','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','routealias','online','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client'];(function(_0x52986f,_0x137b8c){var _0x13d5db=function(_0x4890c9){while(--_0x4890c9){_0x52986f['push'](_0x52986f['shift']());}};_0x13d5db(++_0x137b8c);}(_0xf46a,0x10d));var _0xaf46=function(_0x44434d,_0x3e1ea0){_0x44434d=_0x44434d-0x0;var _0x4102de=_0xf46a[_0x44434d];return _0x4102de;};'use strict';var _=require(_0xaf46('0x0'));var jayson=require(_0xaf46('0x1'));var db=require(_0xaf46('0x2'))['db'];var amiClient=jayson[_0xaf46('0x3')][_0xaf46('0x4')]({'port':0x232a});var routingClient=jayson[_0xaf46('0x3')][_0xaf46('0x4')]({'port':0x232c});function isAgentPaused(_0x27b61a,_0x4a8da4){var _0x1ecb82=[_0x27b61a[_0xaf46('0x5')],_0x27b61a['faxPause'],_0x27b61a[_0xaf46('0x6')],_0x27b61a[_0xaf46('0x7')],_0x27b61a[_0xaf46('0x8')],_0x27b61a[_0xaf46('0x9')],_0x27b61a[_0xaf46('0xa')]];if(!_0x4a8da4)return _[_0xaf46('0xb')](_0x1ecb82);var _0x1104e1=_[_0xaf46('0xc')](_0x1ecb82);return _0x1104e1[_0xaf46('0xd')]>0x0&&_0x1104e1[_0xaf46('0xd')]<_0x1ecb82[_0xaf46('0xd')]?!![]:![];}function isIdle(_0x44a180){return _0x44a180==='idle'||_0x44a180===_0xaf46('0xe')||_0x44a180===_0xaf46('0xf')||_0x44a180===_0xaf46('0x10')||_[_0xaf46('0x11')](_0x44a180);}function isAgentIdle(_0x1a3d37){if(_0x1a3d37[_0xaf46('0x12')]!=='idle'&&_0x1a3d37[_0xaf46('0x9')]){_0x1a3d37[_0xaf46('0x12')]=_0xaf46('0x13');return![];}return _[_0xaf46('0xb')]([_0x1a3d37[_0xaf46('0x14')],_0x1a3d37[_0xaf46('0x15')],_0x1a3d37[_0xaf46('0x16')],_0x1a3d37[_0xaf46('0x17')],_0x1a3d37[_0xaf46('0x18')],_0x1a3d37['voiceStatus'],_0x1a3d37['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xaf46('0x19')]('Agents',{})[_0xaf46('0x1a')](function(_0x507027){if(_0x507027[_0xaf46('0x1b')]){throw new Error(_0xaf46('0x1c'));}var _0x4fd0e1=_0x507027[_0xaf46('0x1d')];return routingClient[_0xaf46('0x19')]('Agents',{})[_0xaf46('0x1a')](function(_0x5c9525){if(_0x5c9525[_0xaf46('0x1b')]){throw new Error(_0xaf46('0x1e'));}var _0x2b800=_0x5c9525[_0xaf46('0x1d')];return _['merge']({},_0x4fd0e1,_0x2b800);});})[_0xaf46('0x1f')](function(_0x331c1e){throw _0x331c1e;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x15804b){var _0x21beb9='unknown';if(isAgentPaused(_0x15804b))_0x21beb9=_0xaf46('0x13');else if(isAgentPaused(_0x15804b,!![]))_0x21beb9=_0xaf46('0x20');else if(isAgentIdle(_0x15804b))_0x21beb9=_0xaf46('0x21');else _0x21beb9='busy';return _0x21beb9;}exports[_0xaf46('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x2c63d9,_0x13f5e5){var _0x370b74=_[_0xaf46('0x23')](_0x2c63d9)?_0x2c63d9:[_0x2c63d9];var _0x40616a=_['startCase'](_0x13f5e5)+'Queue';var _0x514cf7=_['map'](_0x370b74,function(_0x50702c){return db[_0x40616a][_0xaf46('0x24')]({'where':{'id':_0x50702c}})['then'](function(_0xf11014){if(!_0xf11014)return[];return _0xf11014[_0xaf46('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xaf46('0x26')](_0x514cf7)['then'](function(_0x1676b4){var _0x581123=_(_0x1676b4)['flatten']()[_0xaf46('0x27')]('id')[_0xaf46('0x28')]()[_0xaf46('0x29')]();return _0x581123;});}exports[_0xaf46('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4598a8,_0x3e5edd,_0x54f58d){try{if(_0x3e5edd['length']>0x0){_0x4598a8=_0x4598a8[_0xaf46('0xc')](function(_0x31f726){return _0x3e5edd[_0xaf46('0x2b')](_0x31f726['id']);});}var _0x104936=_0x4598a8[_0xaf46('0xc')](function(_0x154c49){var _0x21bcf7='busy';if(isAgentIdle(_0x154c49)){_0x21bcf7='idle';}return _0x21bcf7===_0x54f58d;});return _[_0xaf46('0x27')](_0x104936,'id');}catch(_0xbc372e){throw _0xbc372e;}}exports[_0xaf46('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1ccf0a,_0x2eec45,_0x3ca55b){return Promise[_0xaf46('0x2d')]()[_0xaf46('0x1a')](function(){if(_0x2eec45[_0xaf46('0xd')]>0x0){_0x1ccf0a=_0x1ccf0a[_0xaf46('0xc')](function(_0x644b64){return _0x2eec45['includes'](_0x644b64['id']);});}return _0x1ccf0a;})[_0xaf46('0x1a')](function(){return db[_0xaf46('0x2e')][_0xaf46('0x2f')]({'attributes':['id',_0xaf46('0x30'),_0xaf46('0x31'),'chatPause',_0xaf46('0x32'),_0xaf46('0x6'),'openchannelPause',_0xaf46('0x8'),_0xaf46('0x9'),'whatsappPause',_0xaf46('0x33')],'where':{'id':{'$in':_[_0xaf46('0x27')](_0x1ccf0a,'id')}},'raw':!![]});})[_0xaf46('0x1a')](function(_0x41ae13){return _0x41ae13['map'](function(_0xb8e96d){var _0x3872ca=_['find'](_0x1ccf0a,['id',_0xb8e96d['id']]);var _0x26d314=filterAgentAttributes(_0x3872ca);_[_0xaf46('0x34')](_0xb8e96d,_0x26d314);_0xb8e96d['globalStatus']=getAgentStatus(_0xb8e96d);return _0xb8e96d;});})[_0xaf46('0x1a')](function(_0x1989d6){var _0x510df0=sortAgentsByStatus(_0x1989d6,_0x3ca55b);return _['map'](_0x510df0,'id');})['catch'](function(_0x511081){throw _0x511081;});}exports[_0xaf46('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x41f7b3){var _0x58a909={'fields':[],'order':null};var _0x2fd453=_0x41f7b3[_0xaf46('0x36')](',');_0x58a909[_0xaf46('0x37')]=_[_0xaf46('0xc')](_0x2fd453,function(_0x16dd00){if(!_0x16dd00[_0xaf46('0x2b')](_0xaf46('0x38'))){return!![];}_0x58a909[_0xaf46('0x39')]=_[_0xaf46('0x3a')](_0x16dd00,'-')?_0xaf46('0x3b'):'ASC';return![];});return _0x58a909;}exports[_0xaf46('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x2cf872){if(_0x2cf872[_0xaf46('0x2b')](_0xaf46('0x31'))&&!_0x2cf872['includes'](_0xaf46('0x3d'))){var _0x2f8d6c=_0x2cf872[_0xaf46('0x3e')](0x0,_0x2cf872[_0xaf46('0x3f')](_0xaf46('0x31')));_0x2cf872+=','+_0x2f8d6c+'internal';}return _0x2cf872;}exports[_0xaf46('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x31f103,_0x1eb295){var _0x150240=_0x31f103[_0xaf46('0x41')](function(_0x401205,_0x16054c){if(_0x401205[_0xaf46('0x38')]===_0x16054c['globalStatus']){if(_0x401205[_0xaf46('0x38')]===_0xaf46('0x13')){if(_0x1eb295===_0xaf46('0x3b')){return(_0x401205[_0xaf46('0x33')]||'')<(_0x16054c[_0xaf46('0x33')]||'')||_0x401205[_0xaf46('0x31')][_0xaf46('0x42')]()>_0x16054c['fullname'][_0xaf46('0x42')]()?0x1:-0x1;}else{return(_0x401205[_0xaf46('0x33')]||'')<(_0x16054c['pauseType']||'')||_0x401205[_0xaf46('0x31')][_0xaf46('0x42')]()>_0x16054c['fullname'][_0xaf46('0x42')]()?-0x1:0x1;}}else{if(_0x1eb295===_0xaf46('0x3b')){return _0x401205[_0xaf46('0x31')][_0xaf46('0x42')]()<_0x16054c['fullname'][_0xaf46('0x42')]()?0x1:-0x1;}else{return _0x401205[_0xaf46('0x31')][_0xaf46('0x42')]()<_0x16054c[_0xaf46('0x31')][_0xaf46('0x42')]()?-0x1:0x1;}}}else{if(_0x1eb295===_0xaf46('0x3b')){return _0x401205[_0xaf46('0x38')]<_0x16054c[_0xaf46('0x38')]?0x1:-0x1;}else{return _0x401205[_0xaf46('0x38')]<_0x16054c[_0xaf46('0x38')]?-0x1:0x1;}}});return _0x150240;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x9b568e){var _0x46ac71=[_0xaf46('0x43'),'online',_0xaf46('0x44'),_0xaf46('0x45'),_0xaf46('0x33'),_0xaf46('0x45'),_0xaf46('0x3d'),_0xaf46('0x46'),_0xaf46('0x5'),_0xaf46('0x7'),_0xaf46('0x6'),_0xaf46('0x8'),_0xaf46('0xa'),_0xaf46('0x32'),_0xaf46('0x9'),'chatCapacity','openchannelCapacity',_0xaf46('0x47'),_0xaf46('0x48'),'whatsappCapacity','faxCapacity',_0xaf46('0x49'),_0xaf46('0x4a'),_0xaf46('0x4b'),_0xaf46('0x4c'),'whatsappCurrentCapacity',_0xaf46('0x4d'),_0xaf46('0x14'),_0xaf46('0x17'),_0xaf46('0x16'),_0xaf46('0x18'),'whatsappStatus',_0xaf46('0x15'),_0xaf46('0x12'),'chatStatusTime',_0xaf46('0x4e'),_0xaf46('0x4f'),_0xaf46('0x50'),'whatsappStatusTime',_0xaf46('0x51'),_0xaf46('0x52'),_0xaf46('0x53'),_0xaf46('0x54'),'screenrecording',_0xaf46('0x55'),'phoneBarEnableAutomaticScreenRecording',_0xaf46('0x56')];var _0x25216f=['chatPause',_0xaf46('0x7'),'mailPause',_0xaf46('0x8'),_0xaf46('0xa'),_0xaf46('0x32'),_0xaf46('0x9'),_0xaf46('0x57')];var _0x557d38=_(_0x9b568e)[_0xaf46('0x58')](_0x25216f)[_0xaf46('0x59')](_0x46ac71)['value']();return _0x557d38;}exports[_0xaf46('0x5a')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index e8dc3b0..4cdcece 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 _0x622a=['initializeQueues','lodash','util','http','client','loggedIn','paused','busy','inUse','invalid','loggedInDb','onHold','ringInUse','unavailable','unknown','originated','message','statusMessage','dialActive','dialMethod','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','concat','map','get','available','waiting','pTalking','merge','pick'];(function(_0x3c6b09,_0x574850){var _0x2ee44b=function(_0x33403e){while(--_0x33403e){_0x3c6b09['push'](_0x3c6b09['shift']());}};_0x2ee44b(++_0x574850);}(_0x622a,0x1d7));var _0xa622=function(_0xb0e43e,_0x403521){_0xb0e43e=_0xb0e43e-0x0;var _0x37c003=_0x622a[_0xb0e43e];return _0x37c003;};'use strict';var _=require(_0xa622('0x0'));var jayson=require('jayson/promise');var util=require(_0xa622('0x1'));var amiClient=jayson['client'][_0xa622('0x2')]({'port':0x232a});var routingClient=jayson[_0xa622('0x3')][_0xa622('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xa622('0x4'),_0xa622('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xa622('0x6'),_0xa622('0x7'),_0xa622('0x8'),_0xa622('0x9'),'notInUse',_0xa622('0xa'),'ringing',_0xa622('0xb'),'talking',_0xa622('0xc'),_0xa622('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xa622('0xe'),_0xa622('0xf'),_0xa622('0x10'),_0xa622('0x11'),_0xa622('0x12'),_0xa622('0x13'),'startPredictive','startProgressive',_0xa622('0x14'),_0xa622('0x15'),_0xa622('0x16'),'erlangBusyFactor','dialPredictiveInterval',_0xa622('0x17'),_0xa622('0x18'),_0xa622('0x19'),_0xa622('0x1a'),_0xa622('0x1b'),_0xa622('0x1c'),_0xa622('0x1d'),_0xa622('0x1e'),_0xa622('0x1f')];function getRealtimeQueues(_0x21d9b1,_0x24f114){var _0x5b6fdf=_0x24f114===_0xa622('0x20')?amiClient:routingClient;return _0x5b6fdf[_0xa622('0x21')](_[_0xa622('0x22')](_0x24f114)+_0xa622('0x23'),_0x21d9b1)['then'](function(_0x1bea61){if(_0x1bea61['error'])throw new Error(util[_0xa622('0x24')](_0xa622('0x25'),_0x24f114));return _0x1bea61['result'];})['catch'](function(_0x1bad49){throw _0x1bad49;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x51f732,_0x427a27,_0x3a58c1,_0x10fcd5){var _0xcfaf6e=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3a58c1===_0xa622('0x20')){if(_0x10fcd5==='inbound'){_0xcfaf6e=_0xcfaf6e[_0xa622('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x10fcd5==='outbound'){_0xcfaf6e=_0xcfaf6e['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x51f732[_0xa622('0x27')](function(_0x534196){var _0x536306=_0x534196[_0xa622('0x28')]({'plain':!![]});_0x536306[_0xa622('0x5')]=0x0;_0x536306['loggedInDb']=0x0;_0x536306['loggedIn']=0x0;_0x536306[_0xa622('0x29')]=0x0;_0x536306[_0xa622('0x2a')]=0x0;if(_0x3a58c1===_0xa622('0x20')){_0x536306['talking']=0x0;_0x536306['busy']=0x0;if(_0x10fcd5==='outbound'){_0x536306[_0xa622('0x2b')]=0x0;_0x536306[_0xa622('0xe')]=0x0;}}var _0x5a03a1=_['find'](_0x427a27,['id',_0x536306['id']]);if(_0x5a03a1){_[_0xa622('0x2c')](_0x536306,_[_0xa622('0x2d')](_0x5a03a1,_0xcfaf6e));}return _0x536306;});}exports[_0xa622('0x2e')]=initializeQueues; \ No newline at end of file +var _0x0ee8=['lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','invalid','notInUse','onHold','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','startPredictive','startProgressive','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedInDb','find','pick'];(function(_0x1255e1,_0x1a736b){var _0x300d36=function(_0x3fde34){while(--_0x3fde34){_0x1255e1['push'](_0x1255e1['shift']());}};_0x300d36(++_0x1a736b);}(_0x0ee8,0xd0));var _0x80ee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0ee8[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x80ee('0x0'));var jayson=require(_0x80ee('0x1'));var util=require(_0x80ee('0x2'));var amiClient=jayson[_0x80ee('0x3')][_0x80ee('0x4')]({'port':0x232a});var routingClient=jayson[_0x80ee('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x80ee('0x5'),_0x80ee('0x6'),_0x80ee('0x7'),_0x80ee('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x80ee('0x9'),'inUse',_0x80ee('0xa'),'loggedInDb',_0x80ee('0xb'),_0x80ee('0xc'),'ringing','ringInUse',_0x80ee('0xd'),_0x80ee('0xe'),_0x80ee('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x80ee('0x10'),_0x80ee('0x11'),_0x80ee('0x12'),_0x80ee('0x13'),'dialActive',_0x80ee('0x14'),'Trunk',_0x80ee('0x15'),_0x80ee('0x16'),'erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0x80ee('0x17'),_0x80ee('0x18'),_0x80ee('0x19'),_0x80ee('0x1a'),_0x80ee('0x1b'),_0x80ee('0x1c'),_0x80ee('0x1d'),_0x80ee('0x1e'),'predictiveIntervalDroppedCallsCallersExit',_0x80ee('0x1f'),_0x80ee('0x20')];function getRealtimeQueues(_0x54ab92,_0x693aa9){var _0x5f4c20=_0x693aa9===_0x80ee('0x21')?amiClient:routingClient;return _0x5f4c20[_0x80ee('0x22')](_[_0x80ee('0x23')](_0x693aa9)+_0x80ee('0x24'),_0x54ab92)[_0x80ee('0x25')](function(_0x59504e){if(_0x59504e[_0x80ee('0x26')])throw new Error(util[_0x80ee('0x27')](_0x80ee('0x28'),_0x693aa9));return _0x59504e[_0x80ee('0x29')];})[_0x80ee('0x2a')](function(_0x3fe626){throw _0x3fe626;});}exports[_0x80ee('0x2b')]=getRealtimeQueues;function initializeQueues(_0x2bb130,_0x453750,_0x383d7a,_0x50f096){var _0x383124=DEFAULT_QUEUE_ATTRIBUTES;if(_0x383d7a==='voice'){if(_0x50f096===_0x80ee('0x2c')){_0x383124=_0x383124[_0x80ee('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x50f096===_0x80ee('0x2e')){_0x383124=_0x383124[_0x80ee('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2bb130[_0x80ee('0x2f')](function(_0x14427c){var _0x1cdef7=_0x14427c[_0x80ee('0x30')]({'plain':!![]});_0x1cdef7[_0x80ee('0x7')]=0x0;_0x1cdef7[_0x80ee('0x31')]=0x0;_0x1cdef7['loggedIn']=0x0;_0x1cdef7['available']=0x0;_0x1cdef7['waiting']=0x0;if(_0x383d7a===_0x80ee('0x21')){_0x1cdef7[_0x80ee('0xd')]=0x0;_0x1cdef7[_0x80ee('0x9')]=0x0;if(_0x50f096===_0x80ee('0x2e')){_0x1cdef7[_0x80ee('0x10')]=0x0;_0x1cdef7[_0x80ee('0x11')]=0x0;}}var _0x192a60=_[_0x80ee('0x32')](_0x453750,['id',_0x1cdef7['id']]);if(_0x192a60){_['merge'](_0x1cdef7,_[_0x80ee('0x33')](_0x192a60,_0x383124));}return _0x1cdef7;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a6658ca..a7c81a6 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(_0x22fe5c,_0x28645c){var _0x17a217=function(_0x1306f0){while(--_0x1306f0){_0x22fe5c['push'](_0x22fe5c['shift']());}};_0x17a217(++_0x28645c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x44feaf,_0x46068f){var _0x19ea54=function(_0x530743){while(--_0x530743){_0x44feaf['push'](_0x44feaf['shift']());}};_0x19ea54(++_0x46068f);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 c629487..45ca32b 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 _0x7f92=['md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','hex','substring','lodash','child_process','execSync','../environment','orderBy','length','filter','family','IPv4','internal','concat','mac','address','getFirstInterface','map','join'];(function(_0x2dad51,_0x1c260a){var _0x308c85=function(_0x15a37c){while(--_0x15a37c){_0x2dad51['push'](_0x2dad51['shift']());}};_0x308c85(++_0x1c260a);}(_0x7f92,0x74));var _0x27f9=function(_0xd6ba7e,_0x353a59){_0xd6ba7e=_0xd6ba7e-0x0;var _0x23d01d=_0x7f92[_0xd6ba7e];return _0x23d01d;};'use strict';var _=require(_0x27f9('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x27f9('0x1'))[_0x27f9('0x2')];var config=require(_0x27f9('0x3'));function getInterfaces(){var _0x540104=[];var _0x427591=os['networkInterfaces']();var _0x9eb72e=_[_0x27f9('0x4')](_['keys'](_0x427591));for(var _0x5ec7eb=0x0;_0x5ec7eb<_0x9eb72e[_0x27f9('0x5')];_0x5ec7eb++){var _0x2843b6=_0x427591[_0x9eb72e[_0x5ec7eb]][_0x27f9('0x6')](function(_0x175307){return _0x175307[_0x27f9('0x7')]===_0x27f9('0x8')&&_0x175307[_0x27f9('0x9')]===![];});_0x540104=_0x540104[_0x27f9('0xa')](_0x2843b6);}return _0x540104;}function getFirstInterface(){var _0x235686=_['head'](getInterfaces());return{'macAddress':_0x235686&&_0x235686[_0x27f9('0xb')]?_0x235686[_0x27f9('0xb')]:'00:00:00:00:00:00','ipAddress':_0x235686&&_0x235686['address']?_0x235686[_0x27f9('0xc')]:'127.0.0.1'};}exports[_0x27f9('0xd')]=getFirstInterface;function getCPUhash(){var _0x171606=_['orderBy'](os['cpus']()[_0x27f9('0xe')](function(_0x3c54d7){return _0x3c54d7['model'];}))[_0x27f9('0xf')](':');return crypto['createHash'](_0x27f9('0x10'))[_0x27f9('0x11')](_0x171606)[_0x27f9('0x12')]('hex');}exports[_0x27f9('0x13')]=function(){var _0x39b06c=os[_0x27f9('0x14')]();var _0x19936d=/[0-9a-f-]{36}/;if(config[_0x27f9('0x15')]&&_0x19936d[_0x27f9('0x16')](config['licenseToken'])){return config[_0x27f9('0x15')];}else if(_0x39b06c===_0x27f9('0x17')){return exec(_0x27f9('0x18'),{'encoding':_0x27f9('0x19')})[_0x27f9('0x1a')]('\x0d\x0a','');}else{var _0x18d148=getFirstInterface();var _0x50950e=getCPUhash();var _0x386cfa=_0x50950e+'|'+os[_0x27f9('0x1b')]()+'|'+_0x18d148[_0x27f9('0x1c')]+'|'+_0x18d148[_0x27f9('0x1d')];var _0x352824=crypto[_0x27f9('0x1e')]('md5')[_0x27f9('0x11')](_0x386cfa)[_0x27f9('0x12')](_0x27f9('0x1f'));return _0x352824[_0x27f9('0x20')](0x0,0x8)+'-'+_0x352824['substring'](0x8,0xc)+'-'+_0x352824[_0x27f9('0x20')](0xc,0x10)+'-'+_0x352824[_0x27f9('0x20')](0x10,0x14)+'-'+_0x352824['substring'](0x14);}}; \ No newline at end of file +var _0xebc3=['test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','substring','lodash','crypto','child_process','../environment','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken'];(function(_0x5be460,_0xd5dd1f){var _0x440359=function(_0x4b2d75){while(--_0x4b2d75){_0x5be460['push'](_0x5be460['shift']());}};_0x440359(++_0xd5dd1f);}(_0xebc3,0x1b7));var _0x3ebc=function(_0x38d7a2,_0xcd8410){_0x38d7a2=_0x38d7a2-0x0;var _0x253b1d=_0xebc3[_0x38d7a2];return _0x253b1d;};'use strict';var _=require(_0x3ebc('0x0'));var os=require('os');var crypto=require(_0x3ebc('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x3ebc('0x2'))['execSync'];var config=require(_0x3ebc('0x3'));function getInterfaces(){var _0x12ee8c=[];var _0x5d0be1=os['networkInterfaces']();var _0x5be505=_[_0x3ebc('0x4')](_[_0x3ebc('0x5')](_0x5d0be1));for(var _0x45ddd8=0x0;_0x45ddd8<_0x5be505[_0x3ebc('0x6')];_0x45ddd8++){var _0x4cfff9=_0x5d0be1[_0x5be505[_0x45ddd8]][_0x3ebc('0x7')](function(_0x48af35){return _0x48af35[_0x3ebc('0x8')]===_0x3ebc('0x9')&&_0x48af35[_0x3ebc('0xa')]===![];});_0x12ee8c=_0x12ee8c[_0x3ebc('0xb')](_0x4cfff9);}return _0x12ee8c;}function getFirstInterface(){var _0x42cb52=_[_0x3ebc('0xc')](getInterfaces());return{'macAddress':_0x42cb52&&_0x42cb52[_0x3ebc('0xd')]?_0x42cb52['mac']:_0x3ebc('0xe'),'ipAddress':_0x42cb52&&_0x42cb52[_0x3ebc('0xf')]?_0x42cb52[_0x3ebc('0xf')]:_0x3ebc('0x10')};}exports[_0x3ebc('0x11')]=getFirstInterface;function getCPUhash(){var _0x2e928d=_[_0x3ebc('0x4')](os['cpus']()[_0x3ebc('0x12')](function(_0x58fea9){return _0x58fea9[_0x3ebc('0x13')];}))[_0x3ebc('0x14')](':');return crypto[_0x3ebc('0x15')](_0x3ebc('0x16'))[_0x3ebc('0x17')](_0x2e928d)[_0x3ebc('0x18')](_0x3ebc('0x19'));}exports[_0x3ebc('0x1a')]=function(){var _0x5a1f72=os[_0x3ebc('0x1b')]();var _0x2d36f2=/[0-9a-f-]{36}/;if(config[_0x3ebc('0x1c')]&&_0x2d36f2[_0x3ebc('0x1d')](config['licenseToken'])){return config[_0x3ebc('0x1c')];}else if(_0x5a1f72===_0x3ebc('0x1e')){return exec(_0x3ebc('0x1f'),{'encoding':'utf8'})[_0x3ebc('0x20')]('\x0d\x0a','');}else{var _0x234a98=getFirstInterface();var _0x2eb723=getCPUhash();var _0xf1998c=_0x2eb723+'|'+os[_0x3ebc('0x21')]()+'|'+_0x234a98[_0x3ebc('0x22')]+'|'+_0x234a98['ipAddress'];var _0x295b9c=crypto[_0x3ebc('0x15')](_0x3ebc('0x16'))['update'](_0xf1998c)[_0x3ebc('0x18')](_0x3ebc('0x19'));return _0x295b9c[_0x3ebc('0x23')](0x0,0x8)+'-'+_0x295b9c[_0x3ebc('0x23')](0x8,0xc)+'-'+_0x295b9c[_0x3ebc('0x23')](0xc,0x10)+'-'+_0x295b9c[_0x3ebc('0x23')](0x10,0x14)+'-'+_0x295b9c['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a0a733c..4d48ca5 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 _0x96c4=['data2','active','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','util','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1'];(function(_0x4dbe4a,_0x4d9156){var _0x17dbd8=function(_0x13d216){while(--_0x13d216){_0x4dbe4a['push'](_0x4dbe4a['shift']());}};_0x17dbd8(++_0x4d9156);}(_0x96c4,0x12e));var _0x496c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x96c4[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x496c('0x0'));var moment=require('moment');var rp=require(_0x496c('0x1'));var BPromise=require(_0x496c('0x2'));var pkginfo=require(_0x496c('0x3'))(module,'version');var db=require(_0x496c('0x4'))['db'];var encryptor=require(_0x496c('0x5'));var hardware=require('./hardware');var logger=require(_0x496c('0x6'))(_0x496c('0x7'));var HOST=_0x496c('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x242c67){return new BPromise(function(_0x14f9dc,_0x531d3f){var _0x2a2706=util[_0x496c('0x9')](_0x496c('0xa'),HOST,_0x242c67,module[_0x496c('0xb')][_0x496c('0xc')]);if(oldToken){_0x2a2706=util[_0x496c('0x9')](_0x496c('0xd'),HOST,_0x242c67,module[_0x496c('0xb')][_0x496c('0xc')],oldToken);}var _0x3fed70={'uri':_0x2a2706,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3fed70)[_0x496c('0xe')](function(_0x3401bd){_0x14f9dc(_0x3401bd);})[_0x496c('0xf')](function(_0x27c662){_0x531d3f(_0x27c662);});});}function manageLicense(_0x972bba,_0x1afd85){var _0x2b36c5=_0x1afd85[_0x496c('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x2b36c5[_0x496c('0x11')]!==_0x972bba&&!_0x2b36c5[_0x496c('0x12')]){oldToken=_0x2b36c5[_0x496c('0x11')];}httpRequest(_0x972bba)[_0x496c('0xe')](function(_0x20c3b0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x20c3b0[_0x496c('0x13')]){isOldTokenSent=![];if(!_0x2b36c5[_0x496c('0x7')]&&_0x2b36c5[_0x496c('0x7')]!=_0x20c3b0[_0x496c('0x7')]||_0x2b36c5[_0x496c('0x7')]&&_0x2b36c5['data2']){logger[_0x496c('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2b36c5[_0x496c('0x7')]&&!_0x2b36c5[_0x496c('0x12')]&&_0x2b36c5[_0x496c('0x7')]!=_0x20c3b0[_0x496c('0x7')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2b36c5['license']&&!_0x2b36c5[_0x496c('0x12')]&&_0x2b36c5['license']==_0x20c3b0['license']){return _0x1afd85;}return _0x1afd85[_0x496c('0x15')]({'data1':_0x972bba,'data2':null,'license':_0x20c3b0[_0x496c('0x7')]});}else{if(_0x20c3b0[_0x496c('0x7')]||_0x2b36c5[_0x496c('0x7')]){if(!_0x2b36c5[_0x496c('0x12')]){if(_0x2b36c5[_0x496c('0x11')]==_0x972bba){GRAY_PERIOD_REASON=_0x496c('0x16');logger[_0x496c('0x14')](_0x496c('0x17'));}else{GRAY_PERIOD_REASON=_0x496c('0x18');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2b36c5[_0x496c('0x11')],_0x972bba);}logger['info'](_0x496c('0x19'),GRAY_PERIOD_REASON[_0x496c('0x1a')](),moment()[_0x496c('0x9')](_0x496c('0x1b')));return _0x1afd85[_0x496c('0x15')]({'data2':encryptor[_0x496c('0x1c')](moment()[_0x496c('0x9')](_0x496c('0x1b')))});}else{if(moment()[_0x496c('0x1d')](encryptor[_0x496c('0x1e')](_0x2b36c5[_0x496c('0x12')]),_0x496c('0x1f'))>DAYS){logger[_0x496c('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0x496c('0x9')](_0x496c('0x1b')));isOldTokenSent=![];return _0x1afd85[_0x496c('0x15')]({'data1':_0x972bba,'data2':null,'license':null});}}}else{if(_0x2b36c5[_0x496c('0x11')]!=_0x972bba){logger[_0x496c('0x14')](_0x496c('0x20'),_0x2b36c5[_0x496c('0x11')],_0x972bba);return _0x1afd85[_0x496c('0x15')]({'data1':_0x972bba,'data2':null,'license':null});}}}return _0x1afd85;})[_0x496c('0xe')](function(_0x36fc26){_0x1afd85=_0x36fc26;})[_0x496c('0xf')](function(_0x27f611){logger[_0x496c('0x21')](_0x27f611[_0x496c('0x22')]);})[_0x496c('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x496c('0x24')](),_0x1afd85);},TIME);});}function defaultLicense(){var _0x5ed304=hardware[_0x496c('0x24')]();if(_0x5ed304){return db[_0x496c('0x25')][_0x496c('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x5ed304}})[_0x496c('0x27')](function(_0x54f7e0,_0x25cb24){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5ed304);manageLicense(_0x5ed304,_0x54f7e0);})['catch'](function(_0x846c72){logger[_0x496c('0x21')](_0x846c72[_0x496c('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x0083=['pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','request-promise'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x0083,0x192));var _0x3008=function(_0x96f0dd,_0x5b7305){_0x96f0dd=_0x96f0dd-0x0;var _0x2b3fd5=_0x0083[_0x96f0dd];return _0x2b3fd5;};'use strict';var util=require(_0x3008('0x0'));var moment=require(_0x3008('0x1'));var rp=require(_0x3008('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x3008('0x3'))(module,_0x3008('0x4'));var db=require(_0x3008('0x5'))['db'];var encryptor=require(_0x3008('0x6'));var hardware=require(_0x3008('0x7'));var logger=require(_0x3008('0x8'))(_0x3008('0x9'));var HOST=_0x3008('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3fef00){return new BPromise(function(_0x427548,_0x31adec){var _0x4b2361=util['format'](_0x3008('0xb'),HOST,_0x3fef00,module[_0x3008('0xc')][_0x3008('0x4')]);if(oldToken){_0x4b2361=util[_0x3008('0xd')](_0x3008('0xe'),HOST,_0x3fef00,module[_0x3008('0xc')]['version'],oldToken);}var _0x23f542={'uri':_0x4b2361,'method':_0x3008('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x23f542)[_0x3008('0x10')](function(_0x3cdf5a){_0x427548(_0x3cdf5a);})[_0x3008('0x11')](function(_0x1b2b08){_0x31adec(_0x1b2b08);});});}function manageLicense(_0x200087,_0x2a549e){var _0x43df43=_0x2a549e[_0x3008('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x43df43[_0x3008('0x13')]!==_0x200087&&!_0x43df43[_0x3008('0x14')]){oldToken=_0x43df43[_0x3008('0x13')];}httpRequest(_0x200087)[_0x3008('0x10')](function(_0xac8710){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xac8710[_0x3008('0x15')]){isOldTokenSent=![];if(!_0x43df43['license']&&_0x43df43['license']!=_0xac8710[_0x3008('0x9')]||_0x43df43['license']&&_0x43df43[_0x3008('0x14')]){logger['info'](_0x3008('0x16'));}if(_0x43df43[_0x3008('0x9')]&&!_0x43df43[_0x3008('0x14')]&&_0x43df43[_0x3008('0x9')]!=_0xac8710[_0x3008('0x9')]){logger[_0x3008('0x17')](_0x3008('0x18'));}if(_0x43df43['license']&&!_0x43df43[_0x3008('0x14')]&&_0x43df43[_0x3008('0x9')]==_0xac8710[_0x3008('0x9')]){return _0x2a549e;}return _0x2a549e[_0x3008('0x19')]({'data1':_0x200087,'data2':null,'license':_0xac8710[_0x3008('0x9')]});}else{if(_0xac8710['license']||_0x43df43['license']){if(!_0x43df43[_0x3008('0x14')]){if(_0x43df43[_0x3008('0x13')]==_0x200087){GRAY_PERIOD_REASON=_0x3008('0x1a');logger[_0x3008('0x17')](_0x3008('0x1b'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x3008('0x17')](_0x3008('0x1c'),_0x43df43[_0x3008('0x13')],_0x200087);}logger[_0x3008('0x17')](_0x3008('0x1d'),GRAY_PERIOD_REASON[_0x3008('0x1e')](),moment()['format'](_0x3008('0x1f')));return _0x2a549e['update']({'data2':encryptor[_0x3008('0x20')](moment()['format'](_0x3008('0x1f')))});}else{if(moment()[_0x3008('0x21')](encryptor[_0x3008('0x22')](_0x43df43['data2']),'days')>DAYS){logger['info'](_0x3008('0x23'),moment()[_0x3008('0xd')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2a549e[_0x3008('0x19')]({'data1':_0x200087,'data2':null,'license':null});}}}else{if(_0x43df43[_0x3008('0x13')]!=_0x200087){logger['info'](_0x3008('0x1c'),_0x43df43[_0x3008('0x13')],_0x200087);return _0x2a549e[_0x3008('0x19')]({'data1':_0x200087,'data2':null,'license':null});}}}return _0x2a549e;})[_0x3008('0x10')](function(_0x75fa25){_0x2a549e=_0x75fa25;})[_0x3008('0x11')](function(_0xbfd06b){logger['error'](_0xbfd06b['message']);})[_0x3008('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2a549e);},TIME);});}function defaultLicense(){var _0x10949a=hardware[_0x3008('0x25')]();if(_0x10949a){return db[_0x3008('0x26')][_0x3008('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x10949a}})[_0x3008('0x28')](function(_0x5b4f2c,_0x5eace3){logger['info'](_0x3008('0x29'),_0x10949a);manageLicense(_0x10949a,_0x5b4f2c);})[_0x3008('0x11')](function(_0x294159){logger[_0x3008('0x2a')](_0x294159[_0x3008('0x2b')]);});}}exports[_0x3008('0x2c')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 627f0c2..4878750 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 _0x896d=['sequelize','count','role','admin','telephone','users','telephones','forEach','user','catch','pick','countBy','exports','util','lodash','moment','bluebird','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','uuid','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','demo','grayReason','machineUuid','disabled','message','User','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x896d,0x88));var _0xd896=function(_0x236c67,_0x319a31){_0x236c67=_0x236c67-0x0;var _0x5b71e8=_0x896d[_0x236c67];return _0x5b71e8;};'use strict';var util=require(_0xd896('0x0'));var _=require(_0xd896('0x1'));var moment=require(_0xd896('0x2'));var BPromise=require(_0xd896('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd896('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd896('0x5'),'machineUuid':hardware[_0xd896('0x6')](),'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':_0xd896('0x7'),'machineUuid':hardware[_0xd896('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1f91d6){return new BPromise(function(_0x24de26,_0x63a4fb){return db[_0xd896('0x8')][_0xd896('0x9')](_['defaults'](_0x1f91d6,{'raw':!![],'where':{'id':0x1}}))[_0xd896('0xa')](function(_0x456715){return checkLicense(_0x456715,null);})[_0xd896('0xa')](function(_0x4a49ae){_0x24de26(_0x4a49ae);return;})['catch'](function(_0x18f005){_0x63a4fb(_0x18f005);});});}function checkLicense(_0x2daea2,_0xaf36d7){if(!_0x2daea2){demoLicense[_0xd896('0xb')]=_0x2daea2[_0xd896('0xc')];return demoLicense;}try{var _0x6b2552=_0xaf36d7||_0x2daea2[_0xd896('0xd')];if(_[_0xd896('0xe')](_0x6b2552)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xc8af75=_0x2daea2['data1'];var _0x2838da=_0x2daea2[_0xd896('0xf')];var _0x4ecc10=_0xc8af75[_0xd896('0x10')]('-')[0x4];var _0x2a6c97=_0xc8af75[_0xd896('0x10')]('-')[0x0];var _0x4f1f13=encryptor[_0xd896('0x11')](_0x6b2552,util[_0xd896('0x12')](_0xd896('0x13'),_0x4ecc10,_0xc8af75,_0x2a6c97));var _0x4562cf=JSON[_0xd896('0x14')](_0x4f1f13);_0x4562cf[_0xd896('0x15')]=![];_0x4562cf['uuid']=_0xc8af75;_0x4562cf['machineUuid']=hardware[_0xd896('0x6')]();if(_0x2838da){var _0xb92406=encryptor[_0xd896('0x11')](_0x2838da);_0x4562cf['gray']=_0xb92406;_0x4562cf['deadline']=moment(_0xb92406)['add'](0x7,'days')['format']();_0x4562cf[_0xd896('0x16')]=_0x4562cf[_0xd896('0xb')]!=_0x4562cf[_0xd896('0x17')]?'changed':_0xd896('0x18');}return _0x4562cf;}catch(_0x26868f){breakingLicense[_0xd896('0xb')]=_0x2daea2[_0xd896('0xc')];breakingLicense[_0xd896('0x19')]=_0x26868f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3fb97f,_0x1b71d2){getLicense()[_0xd896('0xa')](function(_0x45580b){return db[_0xd896('0x1a')][_0xd896('0x1b')]({'attributes':['role',[db['sequelize']['fn']('COUNT',db[_0xd896('0x1c')]['col']('role')),_0xd896('0x1d')]],'group':_0xd896('0x1e'),'where':{'role':{'$or':[_0xd896('0x1f'),'user',_0xd896('0x20')]}},'raw':!![]})['then'](function(_0x3a5882){var _0x142dd5={'user':_0x45580b[_0xd896('0x21')]||0x0,'telephone':_0x45580b[_0xd896('0x22')]||0x0};_0x3a5882[_0xd896('0x23')](function(_0x366f79){var _0x12b1ef=_0x366f79[_0xd896('0x1e')]===_0xd896('0x1f')?_0xd896('0x24'):_0x366f79[_0xd896('0x1e')];_0x142dd5[_0x12b1ef]-=_0x366f79[_0xd896('0x1d')];if(_0x142dd5[_0x12b1ef]<0x0)_0x142dd5[_0x12b1ef]=0x0;});_0x3fb97f(_0x142dd5);return;});})[_0xd896('0x25')](function(_0x5086dc){_0x1b71d2(_0x5086dc);});});}function checkUserLimits(_0x2fa69b){return new BPromise(function(_0x49f6b4,_0x4fd641){getLimits()['then'](function(_0x451ea0){var _0x46940f=_[_0xd896('0x26')](_[_0xd896('0x27')](_0x2fa69b,_0xd896('0x1e')),['admin',_0xd896('0x24'),_0xd896('0x20')]);var _0x3928b7=(_0x46940f[_0xd896('0x1f')]||0x0)+(_0x46940f['user']||0x0);var _0x10b3aa=_0x46940f[_0xd896('0x20')]||0x0;if(_0x3928b7>_0x451ea0[_0xd896('0x24')])return _0x4fd641('License\x20limit\x20reached\x20for\x20users');if(_0x10b3aa>_0x451ea0[_0xd896('0x20')])return _0x4fd641('License\x20limit\x20reached\x20for\x20telephones');return _0x49f6b4();})[_0xd896('0x25')](function(_0x4af9df){_0x4fd641(_0x4af9df);});});}module[_0xd896('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x05cb=['users','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','data1','license','data2','split','decryptString','%s:%s:%s','parse','uuid','gray','deadline','add','days','format','disabled','message','User','role','sequelize','COUNT','count','admin','user','telephone'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x05cb,0x116));var _0xb05c=function(_0x331e41,_0x58e7b6){_0x331e41=_0x331e41-0x0;var _0x1a0331=_0x05cb[_0x331e41];return _0x1a0331;};'use strict';var util=require('util');var _=require(_0xb05c('0x0'));var moment=require(_0xb05c('0x1'));var BPromise=require(_0xb05c('0x2'));var hardware=require(_0xb05c('0x3'));var encryptor=require(_0xb05c('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb05c('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xb05c('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb05c('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb05c('0x7'),'machineUuid':hardware[_0xb05c('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x15acc6){return new BPromise(function(_0x4f7c35,_0x1b27c1){return db['License'][_0xb05c('0x8')](_['defaults'](_0x15acc6,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x17851d){return checkLicense(_0x17851d,null);})[_0xb05c('0x9')](function(_0x28c606){_0x4f7c35(_0x28c606);return;})[_0xb05c('0xa')](function(_0x35184b){_0x1b27c1(_0x35184b);});});}function checkLicense(_0x4b3ec2,_0x5c533b){if(!_0x4b3ec2){demoLicense['uuid']=_0x4b3ec2[_0xb05c('0xb')];return demoLicense;}try{var _0x313c94=_0x5c533b||_0x4b3ec2[_0xb05c('0xc')];if(_['isEmpty'](_0x313c94)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5d786b=_0x4b3ec2[_0xb05c('0xb')];var _0x4f34ae=_0x4b3ec2[_0xb05c('0xd')];var _0x4c7963=_0x5d786b[_0xb05c('0xe')]('-')[0x4];var _0x5ab47e=_0x5d786b[_0xb05c('0xe')]('-')[0x0];var _0x28e627=encryptor[_0xb05c('0xf')](_0x313c94,util['format'](_0xb05c('0x10'),_0x4c7963,_0x5d786b,_0x5ab47e));var _0xcce3d7=JSON[_0xb05c('0x11')](_0x28e627);_0xcce3d7['demo']=![];_0xcce3d7[_0xb05c('0x12')]=_0x5d786b;_0xcce3d7['machineUuid']=hardware[_0xb05c('0x6')]();if(_0x4f34ae){var _0x4ba3fc=encryptor['decryptString'](_0x4f34ae);_0xcce3d7[_0xb05c('0x13')]=_0x4ba3fc;_0xcce3d7[_0xb05c('0x14')]=moment(_0x4ba3fc)[_0xb05c('0x15')](0x7,_0xb05c('0x16'))[_0xb05c('0x17')]();_0xcce3d7['grayReason']=_0xcce3d7['uuid']!=_0xcce3d7['machineUuid']?'changed':_0xb05c('0x18');}return _0xcce3d7;}catch(_0xf86e85){breakingLicense[_0xb05c('0x12')]=_0x4b3ec2[_0xb05c('0xb')];breakingLicense['message']=_0xf86e85[_0xb05c('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1dc4f7,_0x52f273){getLicense()['then'](function(_0x3da143){return db[_0xb05c('0x1a')]['findAll']({'attributes':[_0xb05c('0x1b'),[db[_0xb05c('0x1c')]['fn'](_0xb05c('0x1d'),db['sequelize']['col'](_0xb05c('0x1b'))),_0xb05c('0x1e')]],'group':'role','where':{'role':{'$or':[_0xb05c('0x1f'),_0xb05c('0x20'),_0xb05c('0x21')]}},'raw':!![]})[_0xb05c('0x9')](function(_0x131f4b){var _0x26c971={'user':_0x3da143[_0xb05c('0x22')]||0x0,'telephone':_0x3da143['telephones']||0x0};_0x131f4b['forEach'](function(_0x258d33){var _0x21e8a5=_0x258d33[_0xb05c('0x1b')]===_0xb05c('0x1f')?_0xb05c('0x20'):_0x258d33['role'];_0x26c971[_0x21e8a5]-=_0x258d33[_0xb05c('0x1e')];if(_0x26c971[_0x21e8a5]<0x0)_0x26c971[_0x21e8a5]=0x0;});_0x1dc4f7(_0x26c971);return;});})['catch'](function(_0x1a2837){_0x52f273(_0x1a2837);});});}function checkUserLimits(_0x52d57c){return new BPromise(function(_0x3fd056,_0x2835e5){getLimits()[_0xb05c('0x9')](function(_0x1f10a1){var _0x41200b=_['pick'](_[_0xb05c('0x23')](_0x52d57c,_0xb05c('0x1b')),['admin',_0xb05c('0x20'),_0xb05c('0x21')]);var _0x423415=(_0x41200b['admin']||0x0)+(_0x41200b[_0xb05c('0x20')]||0x0);var _0x482dab=_0x41200b['telephone']||0x0;if(_0x423415>_0x1f10a1[_0xb05c('0x20')])return _0x2835e5(_0xb05c('0x24'));if(_0x482dab>_0x1f10a1['telephone'])return _0x2835e5(_0xb05c('0x25'));return _0x3fd056();})['catch'](function(_0x525670){_0x2835e5(_0x525670);});});}module[_0xb05c('0x26')]={'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 1a79cb5..0c247dd 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 _0x4991=['secret','exports','myappanuglar-secret'];(function(_0x5149da,_0x17be74){var _0x560b50=function(_0x210270){while(--_0x210270){_0x5149da['push'](_0x5149da['shift']());}};_0x560b50(++_0x17be74);}(_0x4991,0xf7));var _0x1499=function(_0x58692f,_0x2cc27a){_0x58692f=_0x58692f-0x0;var _0x3718c5=_0x4991[_0x58692f];return _0x3718c5;};'use strict';module[_0x1499('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1499('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x1499('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x9582=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x4d6b17,_0xd5419f){var _0x16eb21=function(_0x20e9b2){while(--_0x20e9b2){_0x4d6b17['push'](_0x4d6b17['shift']());}};_0x16eb21(++_0xd5419f);}(_0x9582,0x95));var _0x2958=function(_0x239d2c,_0x397825){_0x239d2c=_0x239d2c-0x0;var _0x2a9730=_0x9582[_0x239d2c];return _0x2a9730;};'use strict';module[_0x2958('0x0')]={'DOMAIN':_0x2958('0x1'),'SESSION_SECRET':_0x2958('0x2'),'GOOGLE_ID':_0x2958('0x3'),'GOOGLE_SECRET':_0x2958('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 865f43b..b7376ce 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0bd=['exports','../utils/loggers','fileLogger'];(function(_0x201a9f,_0x53160a){var _0x504b82=function(_0x6a4637){while(--_0x6a4637){_0x201a9f['push'](_0x201a9f['shift']());}};_0x504b82(++_0x53160a);}(_0xa0bd,0x15a));var _0xda0b=function(_0x451439,_0x1186fe){_0x451439=_0x451439-0x0;var _0x488e51=_0xa0bd[_0x451439];return _0x488e51;};'use strict';var fileLogger=require(_0xda0b('0x0'))[_0xda0b('0x1')];module[_0xda0b('0x2')]=fileLogger; \ No newline at end of file +var _0xccd8=['../utils/loggers'];(function(_0x237ba6,_0x1fadfd){var _0x3a7d4c=function(_0x2dcf56){while(--_0x2dcf56){_0x237ba6['push'](_0x237ba6['shift']());}};_0x3a7d4c(++_0x1fadfd);}(_0xccd8,0xea));var _0x8ccd=function(_0x449320,_0x197887){_0x449320=_0x449320-0x0;var _0x4867e7=_0xccd8[_0x449320];return _0x4867e7;};'use strict';var fileLogger=require(_0x8ccd('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d86a313..778d0c8 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 _0x7b0c=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','join','legacy-libs','express','../../services/express/index.js','ami'];(function(_0x3ab741,_0x26b9f5){var _0x2f6774=function(_0x2abe2a){while(--_0x2abe2a){_0x3ab741['push'](_0x3ab741['shift']());}};_0x2f6774(++_0x26b9f5);}(_0x7b0c,0x117));var _0xc7b0=function(_0xeae77d,_0x1ad801){_0xeae77d=_0xeae77d-0x0;var _0x27cc0a=_0x7b0c[_0xeae77d];return _0x27cc0a;};'use strict';var path=require(_0xc7b0('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0xc7b0('0x1')](cfg['root'],_0xc7b0('0x2')))};var pm2config={'apps':[{'name':_0xc7b0('0x3'),'script':path['join'](__dirname,_0xc7b0('0x4')),'env':env},{'name':_0xc7b0('0x5'),'script':path[_0xc7b0('0x1')](__dirname,_0xc7b0('0x6')),'env':env},{'name':_0xc7b0('0x7'),'script':path[_0xc7b0('0x1')](__dirname,_0xc7b0('0x8')),'env':env},{'name':_0xc7b0('0x9'),'script':path['join'](__dirname,_0xc7b0('0xa')),'env':env},{'name':_0xc7b0('0xb'),'script':path[_0xc7b0('0x1')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xc7b0('0xc'),'script':path['join'](__dirname,_0xc7b0('0xd')),'env':env}]};module[_0xc7b0('0xe')]=pm2config; \ No newline at end of file +var _0x58c6=['../../services/agi/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','resolve','join','root','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x49bb91,_0x86ecf3){var _0x2b4339=function(_0x4fb062){while(--_0x4fb062){_0x49bb91['push'](_0x49bb91['shift']());}};_0x2b4339(++_0x86ecf3);}(_0x58c6,0xa9));var _0x658c=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x58c6[_0x506172];return _0x2723c0;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x658c('0x0')](path[_0x658c('0x1')](cfg[_0x658c('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path[_0x658c('0x1')](__dirname,_0x658c('0x3')),'env':env},{'name':_0x658c('0x4'),'script':path[_0x658c('0x1')](__dirname,_0x658c('0x5')),'env':env},{'name':_0x658c('0x6'),'script':path[_0x658c('0x1')](__dirname,_0x658c('0x7')),'env':env},{'name':'email','script':path[_0x658c('0x1')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x658c('0x1')](__dirname,_0x658c('0x8')),'env':env},{'name':'xdr','script':path['join'](__dirname,_0x658c('0x9')),'env':env}]};module[_0x658c('0xa')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0d20463..200e019 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 _0x4dae=['dump','saved','pm2','connected','then','start','stop','disconnect','restart','list','describe','delete'];(function(_0x113fec,_0x382076){var _0x17b19b=function(_0x53de70){while(--_0x53de70){_0x113fec['push'](_0x113fec['shift']());}};_0x17b19b(++_0x382076);}(_0x4dae,0x1d6));var _0xe4da=function(_0x12fe5c,_0x5d54a1){_0x12fe5c=_0x12fe5c-0x0;var _0x118323=_0x4dae[_0x12fe5c];return _0x118323;};'use strict';var pm2=require(_0xe4da('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x1ad756,_0x1e8c88){return pm2['connect'](function(_0x29445e){if(_0x29445e){return _0x1e8c88(_0x29445e);}return _0x1ad756(_0xe4da('0x1'));});});};exports['start']=function(_0x4d4209){return connect()[_0xe4da('0x2')](function(){return new BPromise(function(_0x3e2040,_0x39a6e6){return pm2[_0xe4da('0x3')](_0x4d4209,function(_0x50d4bf,_0x26807b){if(_0x50d4bf){return _0x39a6e6(_0x50d4bf);}pm2['disconnect']();return _0x3e2040(_0x26807b);});});});};exports['stop']=function(_0x48acc0){return connect()['then'](function(){return new BPromise(function(_0x5d6978,_0x109a08){return pm2[_0xe4da('0x4')](_0x48acc0,function(_0x51d175,_0xada038){if(_0x51d175){return _0x109a08(_0x51d175);}pm2[_0xe4da('0x5')]();return _0x5d6978(_0xada038);});});});};exports[_0xe4da('0x6')]=function(_0x1b824e){return connect()[_0xe4da('0x2')](function(){return new BPromise(function(_0x33f4b8,_0x3415d4){return pm2[_0xe4da('0x6')](_0x1b824e,function(_0x219d61,_0x408e89){if(_0x219d61){return _0x3415d4(_0x219d61);}pm2[_0xe4da('0x5')]();return _0x33f4b8(_0x408e89);});});});};exports[_0xe4da('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3efefc,_0x492402){return pm2['list'](function(_0x49c4de,_0x493115){if(_0x49c4de){return _0x492402(_0x49c4de);}pm2[_0xe4da('0x5')]();return _0x3efefc(_0x493115);});});});};exports[_0xe4da('0x8')]=function(_0x46615d){return connect()[_0xe4da('0x2')](function(){return new BPromise(function(_0x21479c,_0x3031c2){return pm2[_0xe4da('0x8')](_0x46615d,function(_0x53edf9,_0x200dc1){if(_0x53edf9){return _0x3031c2(_0x53edf9);}pm2[_0xe4da('0x5')]();return _0x21479c(_0x200dc1);});});});};exports[_0xe4da('0x9')]=function(_0x2ce812){return connect()['then'](function(){return new BPromise(function(_0x12635e,_0x42142a){return pm2[_0xe4da('0x9')](_0x2ce812,function(_0x53123f,_0x2d1e32){if(_0x53123f){return _0x42142a(_0x53123f);}pm2['disconnect']();return _0x12635e(_0x2d1e32);});});});};exports[_0xe4da('0xa')]=function(){return connect()[_0xe4da('0x2')](function(){return new BPromise(function(_0x3247e8,_0x4abe85){return pm2[_0xe4da('0xa')](function(_0x215e5d){if(_0x215e5d){return _0x4abe85(_0x215e5d);}return _0x3247e8(_0xe4da('0xb'));});});});}; \ No newline at end of file +var _0x244a=['start','then','disconnect','stop','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x20315a,_0x4604ee){var _0x1d0300=function(_0x291565){while(--_0x291565){_0x20315a['push'](_0x20315a['shift']());}};_0x1d0300(++_0x4604ee);}(_0x244a,0x14b));var _0xa244=function(_0x2512fd,_0x5f5bfd){_0x2512fd=_0x2512fd-0x0;var _0x576639=_0x244a[_0x2512fd];return _0x576639;};'use strict';var pm2=require(_0xa244('0x0'));var BPromise=require(_0xa244('0x1'));var config=require(_0xa244('0x2'));function connect(){return new BPromise(function(_0x43bd0b,_0x5f3fd3){return pm2[_0xa244('0x3')](function(_0x8d02f8){if(_0x8d02f8){return _0x5f3fd3(_0x8d02f8);}return _0x43bd0b(_0xa244('0x4'));});});};exports[_0xa244('0x5')]=function(_0x1e7e01){return connect()[_0xa244('0x6')](function(){return new BPromise(function(_0x5ee0ff,_0x3769e5){return pm2['start'](_0x1e7e01,function(_0x53603a,_0x5c2be0){if(_0x53603a){return _0x3769e5(_0x53603a);}pm2[_0xa244('0x7')]();return _0x5ee0ff(_0x5c2be0);});});});};exports[_0xa244('0x8')]=function(_0x391626){return connect()[_0xa244('0x6')](function(){return new BPromise(function(_0x270bb8,_0x5039c4){return pm2['stop'](_0x391626,function(_0x274ca3,_0xc56e6){if(_0x274ca3){return _0x5039c4(_0x274ca3);}pm2[_0xa244('0x7')]();return _0x270bb8(_0xc56e6);});});});};exports['restart']=function(_0x1b2e0f){return connect()[_0xa244('0x6')](function(){return new BPromise(function(_0x45c35b,_0x239728){return pm2['restart'](_0x1b2e0f,function(_0x28638a,_0x4a4cfd){if(_0x28638a){return _0x239728(_0x28638a);}pm2[_0xa244('0x7')]();return _0x45c35b(_0x4a4cfd);});});});};exports['list']=function(){return connect()[_0xa244('0x6')](function(){return new BPromise(function(_0x469b31,_0x44e085){return pm2[_0xa244('0x9')](function(_0x44de3e,_0x43b3c5){if(_0x44de3e){return _0x44e085(_0x44de3e);}pm2[_0xa244('0x7')]();return _0x469b31(_0x43b3c5);});});});};exports[_0xa244('0xa')]=function(_0x120f40){return connect()[_0xa244('0x6')](function(){return new BPromise(function(_0x103791,_0x4f2dce){return pm2[_0xa244('0xa')](_0x120f40,function(_0x148faa,_0x6d6533){if(_0x148faa){return _0x4f2dce(_0x148faa);}pm2[_0xa244('0x7')]();return _0x103791(_0x6d6533);});});});};exports[_0xa244('0xb')]=function(_0x14f524){return connect()[_0xa244('0x6')](function(){return new BPromise(function(_0x2094a6,_0x2c5952){return pm2['delete'](_0x14f524,function(_0x351e46,_0x4ec324){if(_0x351e46){return _0x2c5952(_0x351e46);}pm2[_0xa244('0x7')]();return _0x2094a6(_0x4ec324);});});});};exports[_0xa244('0xc')]=function(){return connect()[_0xa244('0x6')](function(){return new BPromise(function(_0x297ecc,_0x32f25a){return pm2[_0xa244('0xc')](function(_0x452bb2){if(_0x452bb2){return _0x32f25a(_0x452bb2);}return _0x297ecc(_0xa244('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b3067f2..37293f9 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 _0xd56f=['then','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','chatTimeout'];(function(_0x1a00b8,_0x5363fb){var _0x664a54=function(_0xaadc0c){while(--_0xaadc0c){_0x1a00b8['push'](_0x1a00b8['shift']());}};_0x664a54(++_0x5363fb);}(_0xd56f,0x7f));var _0xfd56=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0xd56f[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xfd56('0x0'));var moment=require(_0xfd56('0x1'));var Redis=require(_0xfd56('0x2'));var util=require(_0xfd56('0x3'));var config=require(_0xfd56('0x4'));var db=require(_0xfd56('0x5'))['db'];var logger=require(_0xfd56('0x6'))(_0xfd56('0x7'));config['redis']=_['defaults'](config[_0xfd56('0x8')],{'host':_0xfd56('0x9'),'port':0x18eb});var io=require(_0xfd56('0xa'))(new Redis(config[_0xfd56('0x8')]));function closeInteractions(){var _0x12b560=0x0;var _0x15408e=[];return db[_0xfd56('0xb')]['find']({'raw':!![],'attributes':['id',_0xfd56('0xc')],'where':{'id':0x1}})[_0xfd56('0xd')](function(_0x32b9e0){_0x12b560=_0x32b9e0['chatTimeout'];if(_0x12b560){return db['ChatInteraction'][_0xfd56('0xe')]({'raw':!![],'attributes':['id',_0xfd56('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfd56('0x10')](_0x32b9e0[_0xfd56('0xc')],_0xfd56('0x11'))}}});}else{return[];}})[_0xfd56('0xd')](function(_0x4e6d63){if(_0x4e6d63&&_0x4e6d63[_0xfd56('0x12')]){_0x15408e=_[_0xfd56('0x13')](_0x4e6d63||[],'id');logger[_0xfd56('0x14')](_0xfd56('0x15'),_0x15408e[_0xfd56('0x16')]());return db['ChatInteraction'][_0xfd56('0x17')]({'closeReason':_0xfd56('0x18'),'disposition':_0xfd56('0x19'),'closed':!![],'closedAt':moment()[_0xfd56('0x1a')](_0xfd56('0x1b'))},{'where':{'id':_0x15408e}});}})[_0xfd56('0xd')](function(){if(_0x15408e&&_0x15408e[_0xfd56('0x12')]){logger[_0xfd56('0x14')](_0xfd56('0x1c'),_0x15408e[_0xfd56('0x16')]());for(var _0x4734d0=0x0;_0x4734d0<_0x15408e[_0xfd56('0x12')];_0x4734d0++){io['emit'](_0xfd56('0x1d'),{'id':_0x15408e[_0x4734d0],'closed':!![]});}}})[_0xfd56('0x1e')](function(_0x36ffd4){logger[_0xfd56('0x1f')](_0xfd56('0x20'),_0x36ffd4?util[_0xfd56('0x21')](_0x36ffd4,{'showHidden':![],'depth':null}):'');});}exports[_0xfd56('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5a4e=['Setting','chatTimeout','then','lastMsgAt','subtract','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','timeout','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost'];(function(_0x16f380,_0x415732){var _0xa1507c=function(_0x4bfc29){while(--_0x4bfc29){_0x16f380['push'](_0x16f380['shift']());}};_0xa1507c(++_0x415732);}(_0x5a4e,0x1e5));var _0xe5a4=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x5a4e[_0x162780];return _0x1ea2dc;};'use strict';var _=require(_0xe5a4('0x0'));var moment=require(_0xe5a4('0x1'));var Redis=require(_0xe5a4('0x2'));var util=require(_0xe5a4('0x3'));var config=require(_0xe5a4('0x4'));var db=require(_0xe5a4('0x5'))['db'];var logger=require(_0xe5a4('0x6'))(_0xe5a4('0x7'));config['redis']=_[_0xe5a4('0x8')](config[_0xe5a4('0x9')],{'host':_0xe5a4('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5a4('0x9')]));function closeInteractions(){var _0x3f4d62=0x0;var _0x6f76ab=[];return db[_0xe5a4('0xb')]['find']({'raw':!![],'attributes':['id',_0xe5a4('0xc')],'where':{'id':0x1}})[_0xe5a4('0xd')](function(_0x10d5f5){_0x3f4d62=_0x10d5f5[_0xe5a4('0xc')];if(_0x3f4d62){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0xe5a4('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe5a4('0xf')](_0x10d5f5[_0xe5a4('0xc')],_0xe5a4('0x10'))}}});}else{return[];}})[_0xe5a4('0xd')](function(_0x204888){if(_0x204888&&_0x204888['length']){_0x6f76ab=_[_0xe5a4('0x11')](_0x204888||[],'id');logger['info'](_0xe5a4('0x12'),_0x6f76ab[_0xe5a4('0x13')]());return db[_0xe5a4('0x14')][_0xe5a4('0x15')]({'closeReason':'system','disposition':_0xe5a4('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x6f76ab}});}})['then'](function(){if(_0x6f76ab&&_0x6f76ab[_0xe5a4('0x17')]){logger['info'](_0xe5a4('0x18'),_0x6f76ab[_0xe5a4('0x13')]());for(var _0xbe3c35=0x0;_0xbe3c35<_0x6f76ab[_0xe5a4('0x17')];_0xbe3c35++){io[_0xe5a4('0x19')](_0xe5a4('0x1a'),{'id':_0x6f76ab[_0xbe3c35],'closed':!![]});}}})[_0xe5a4('0x1b')](function(_0x4d7562){logger[_0xe5a4('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4d7562?util[_0xe5a4('0x1d')](_0x4d7562,{'showHidden':![],'depth':null}):'');});}exports[_0xe5a4('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 8ffa037..0ec8f33 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 _0x5560=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x4e96c7,_0x1887e9){var _0x3ee359=function(_0x303d5e){while(--_0x303d5e){_0x4e96c7['push'](_0x4e96c7['shift']());}};_0x3ee359(++_0x1887e9);}(_0x5560,0xf2));var _0x0556=function(_0x1273d4,_0x3e97cc){_0x1273d4=_0x1273d4-0x0;var _0xef9f55=_0x5560[_0x1273d4];return _0xef9f55;};'use strict';function start(){var _0x4506b8=require(_0x0556('0x0'));return _0x4506b8[_0x0556('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xfcd8=['startAllRefreshIntervals'];(function(_0x2ba94a,_0x20634f){var _0x55f423=function(_0x3174a0){while(--_0x3174a0){_0x2ba94a['push'](_0x2ba94a['shift']());}};_0x55f423(++_0x20634f);}(_0xfcd8,0x1a6));var _0x8fcd=function(_0xeb03c0,_0xe4065f){_0xeb03c0=_0xeb03c0-0x0;var _0x40c879=_0xfcd8[_0xeb03c0];return _0x40c879;};'use strict';function start(){var _0xf0b94=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0xf0b94[_0x8fcd('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index cd410c6..edb000f 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 _0xe4f3=['client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','../../files/reports','%s.%s','savename','extname','existsSync','status','Sent','message','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtract','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','then','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','intersection','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','cron','isBetween','endAt','start','add\x20cron','stop\x20cron','active','startAt','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller'];(function(_0x1c5630,_0x3094b5){var _0x153d50=function(_0x3070fc){while(--_0x3070fc){_0x1c5630['push'](_0x1c5630['shift']());}};_0x153d50(++_0x3094b5);}(_0xe4f3,0xf3));var _0x3e4f=function(_0x375c7e,_0x399947){_0x375c7e=_0x375c7e-0x0;var _0x337e78=_0xe4f3[_0x375c7e];return _0x337e78;};'use strict';var fs=require('fs');var util=require(_0x3e4f('0x0'));var path=require(_0x3e4f('0x1'));var _=require(_0x3e4f('0x2'));var moment=require(_0x3e4f('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x3e4f('0x4'));var BPromise=require(_0x3e4f('0x5'));var logger=require(_0x3e4f('0x6'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x3e4f('0x7'));var analyticDefaultReportController=require(_0x3e4f('0x8'));var client=jayson[_0x3e4f('0x9')][_0x3e4f('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3d3d12,_0x2b640d){return function(){logger[_0x3e4f('0xb')](_0x3e4f('0xc'),_0x3d3d12[_0x3e4f('0xd')]);var _0x2dd633=!![];var _0x30cbae=_0x3d3d12[_0x3e4f('0xe')][_0x3e4f('0xf')]();var _0xcb764e={'account':_0x30cbae,'message':{'from':util['format'](_0x3e4f('0x10'),_0x3d3d12[_0x3e4f('0xe')]['name'],_0x3d3d12[_0x3e4f('0xe')]['email']||_0x3d3d12[_0x3e4f('0xe')][_0x3e4f('0x11')][_0x3e4f('0x12')]),'to':_0x3d3d12[_0x3e4f('0xd')],'cc':_0x3d3d12['cc'],'bcc':_0x3d3d12[_0x3e4f('0x13')],'subject':util[_0x3e4f('0x14')](_0x3e4f('0x15'),_0x2b640d[_0x3e4f('0x16')],_0x3d3d12['subtractNumber'],_0x3d3d12[_0x3e4f('0x17')])}};var _0x49e8b0=path[_0x3e4f('0x18')](__dirname,_0x3e4f('0x19'));var _0x419698=_0x2b640d['savename'];var _0x18549e=util['format'](_0x3e4f('0x1a'),path['basename'](_0x2b640d[_0x3e4f('0x1b')],path[_0x3e4f('0x1c')](_0x2b640d[_0x3e4f('0x1b')])),'zip');var _0x644054=path[_0x3e4f('0x18')](_0x49e8b0,_0x419698);var _0x5f2b84=path[_0x3e4f('0x18')](_0x49e8b0,_0x18549e);if(fs[_0x3e4f('0x1d')](_0x644054)){_0x2b640d[_0x3e4f('0x1e')]=_0x3e4f('0x1f');_0xcb764e[_0x3e4f('0x20')]['attachments']=[{'filename':_0x419698,'path':_0x644054}];_0xcb764e[_0x3e4f('0x20')]['text']=util[_0x3e4f('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x3e4f('0x21')](_0x2b640d,null,0x2));}else if(fs[_0x3e4f('0x1d')](_0x5f2b84)){_0x2b640d[_0x3e4f('0x1e')]=_0x3e4f('0x1f');_0xcb764e[_0x3e4f('0x20')]['attachments']=[{'filename':_0x18549e,'path':_0x5f2b84}];}else{_0xcb764e[_0x3e4f('0x20')][_0x3e4f('0x22')]=_0x3e4f('0x23');if(!_0x3d3d12['sendIfEmpty']){_0x2dd633=![];logger[_0x3e4f('0xb')](_0x3e4f('0x24'));}}if(_0x2dd633){return client[_0x3e4f('0x25')](_0x3e4f('0x26'),_0xcb764e)['then'](function(_0x525999){if(_0x525999[_0x3e4f('0x27')]){return logger[_0x3e4f('0x27')](_0x3e4f('0x28'),JSON['stringify'](_0x525999));}return logger['info'](_0x3e4f('0x29'));})[_0x3e4f('0x2a')](function(_0x55d3f3){return logger['error'](_0x3e4f('0x28'),JSON[_0x3e4f('0x21')](_0x55d3f3));});}};}function handleError(){return function(_0x3cfc4f){return logger[_0x3e4f('0x27')](JSON['stringify'](_0x3cfc4f));};}function handleResult(_0x3a465a){return function(_0x38d412){logger[_0x3e4f('0xb')]('data',JSON[_0x3e4f('0x21')](_0x38d412));if(_0x3a465a[_0x3e4f('0xe')]&&_0x3a465a[_0x3e4f('0xe')][_0x3e4f('0x11')]&&!_['isNil'](_0x3a465a[_0x3e4f('0xd')])){setTimeout(handleSendEmail(_0x3a465a,_0x38d412),0x3c*0x3e8);}};}function handleJob(_0x3b5947){return function(){try{if(_[_0x3e4f('0x2b')](_0x3b5947[_0x3e4f('0x2c')])){return logger[_0x3e4f('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x3b5947['subtractUnit'])){return logger[_0x3e4f('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3e4742={'startDate':moment()[_0x3e4f('0x2d')](_0x3b5947[_0x3e4f('0x2c')],_0x3b5947['subtractUnit'])[_0x3e4f('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x3e4f('0x2e'),'output':_0x3b5947[_0x3e4f('0x2f')],'name':_0x3b5947[_0x3e4f('0x16')]};if(!_['isNil'](_0x3b5947['DefaultReportId'])){logger[_0x3e4f('0xb')](_0x3e4f('0x30'),_0x3b5947[_0x3e4f('0x31')]);return analyticDefaultReportController[_0x3e4f('0x32')]({'id':_0x3b5947[_0x3e4f('0x31')]},_0x3e4742)['then'](handleResult(_0x3b5947))[_0x3e4f('0x2a')](handleError());}if(!_[_0x3e4f('0x2b')](_0x3b5947[_0x3e4f('0x33')])){logger[_0x3e4f('0xb')]('exec\x20custom\x20report\x20id:%s',_0x3b5947[_0x3e4f('0x33')]);return analyticCustomReportController[_0x3e4f('0x32')]({'id':_0x3b5947['CustomReportId']},_0x3e4742)[_0x3e4f('0x34')](handleResult(_0x3b5947))[_0x3e4f('0x2a')](handleError());}}catch(_0x27ebc7){logger['error'](JSON['stringify'](_0x27ebc7));}return logger[_0x3e4f('0xb')](_0x3e4f('0x35'));};}function getJobs(_0x27e78d){var _0x155c47={};if(_0x27e78d){_0x155c47['id']=_0x27e78d;}return db[_0x3e4f('0x36')][_0x3e4f('0x37')]({'where':_0x155c47,'include':[{'model':db[_0x3e4f('0xe')],'attributes':['id',_0x3e4f('0x16'),'email'],'include':[{'model':db[_0x3e4f('0x38')],'as':_0x3e4f('0x11'),'include':[{'model':db['CloudProvider'],'as':_0x3e4f('0x39')}]}]}]})['then'](function(_0x4f604a){var _0x4b1de7=_[_0x3e4f('0x3a')](manager['jobs']);var _0x1c5cd0=_[_0x3e4f('0x3b')](_0x4f604a,function(_0x23233f){return _0x23233f['id'][_0x3e4f('0x3c')]();});var _0x8a58e5=_[_0x3e4f('0x3d')](_0x4f604a,function(_0xe91140){return _0xe91140['id']['toString']();});var _0x4eba56=_0x27e78d?_0x1c5cd0:_['difference'](_0x1c5cd0,_0x4b1de7);var _0x3567f5=_[_0x3e4f('0x3e')](_0x1c5cd0,_0x4b1de7);var _0x49facd=_[_0x3e4f('0x3f')](_0x4b1de7,_0x1c5cd0);var _0x41e883;var _0x5ccb70;for(_0x41e883=0x0;_0x41e883<_0x49facd['length']&&!_0x27e78d;_0x41e883+=0x1){_0x5ccb70=_0x49facd[_0x41e883][_0x3e4f('0x3c')]();if(manager[_0x3e4f('0x40')](_0x5ccb70)){manager[_0x3e4f('0x41')](_0x5ccb70);manager[_0x3e4f('0x42')](_0x5ccb70);logger[_0x3e4f('0xb')](_0x3e4f('0x43'),_0x5ccb70);}}logger[_0x3e4f('0xb')](_0x3e4f('0x44'),JSON[_0x3e4f('0x21')](_0x4eba56));for(_0x41e883=0x0;_0x41e883<_0x4eba56[_0x3e4f('0x45')];_0x41e883+=0x1){_0x5ccb70=_0x4eba56[_0x41e883][_0x3e4f('0x3c')]();logger['info'](_0x3e4f('0x46'),_0x5ccb70);if(_0x27e78d){logger[_0x3e4f('0xb')](_0x3e4f('0x47'),_0x27e78d);logger['info'](JSON['stringify'](_0x8a58e5[_0x5ccb70]));BPromise[_0x3e4f('0x48')]()[_0x3e4f('0x34')](handleJob(_0x8a58e5[_0x5ccb70]));logger[_0x3e4f('0xb')]('run\x20job',_0x8a58e5[_0x5ccb70]['name'],_0x8a58e5[_0x5ccb70]['cron']);}else if(_0x8a58e5[_0x5ccb70][_0x3e4f('0x49')]&&_0x8a58e5[_0x5ccb70]['active']&&moment()[_0x3e4f('0x4a')](_0x8a58e5[_0x5ccb70]['startAt'],_0x8a58e5[_0x5ccb70][_0x3e4f('0x4b')])){manager['add'](_0x5ccb70,_0x8a58e5[_0x5ccb70][_0x3e4f('0x49')],handleJob(_0x8a58e5[_0x5ccb70]));manager[_0x3e4f('0x4c')](_0x5ccb70);logger[_0x3e4f('0xb')](_0x3e4f('0x4d'),_0x8a58e5[_0x5ccb70][_0x3e4f('0x16')],_0x8a58e5[_0x5ccb70][_0x3e4f('0x49')]);}else if(manager[_0x3e4f('0x40')](_0x5ccb70)){manager['stop'](_0x5ccb70);manager['deleteJob'](_0x5ccb70);logger[_0x3e4f('0xb')](_0x3e4f('0x4e'),_0x8a58e5[_0x5ccb70][_0x3e4f('0x16')],_0x8a58e5[_0x5ccb70][_0x3e4f('0x49')]);}}for(_0x41e883=0x0,_0x5ccb70;_0x41e883<_0x3567f5['length']&&!_0x27e78d;_0x41e883+=0x1){_0x5ccb70=_0x3567f5[_0x41e883]['toString']();if(manager[_0x3e4f('0x40')](_0x5ccb70)){if(_0x8a58e5[_0x5ccb70]['cron']&&_0x8a58e5[_0x5ccb70][_0x3e4f('0x4f')]&&moment()[_0x3e4f('0x4a')](_0x8a58e5[_0x5ccb70][_0x3e4f('0x50')],_0x8a58e5[_0x5ccb70][_0x3e4f('0x4b')])){manager[_0x3e4f('0x51')](_0x5ccb70,_0x8a58e5[_0x5ccb70][_0x3e4f('0x49')],handleJob(_0x8a58e5[_0x5ccb70]));logger['info'](_0x3e4f('0x52'),_0x8a58e5[_0x5ccb70]['name'],_0x8a58e5[_0x5ccb70]['cron']);}else{manager[_0x3e4f('0x41')](_0x5ccb70);manager[_0x3e4f('0x42')](_0x5ccb70);logger[_0x3e4f('0xb')](_0x3e4f('0x4e'),_0x8a58e5[_0x5ccb70][_0x3e4f('0x16')],_0x8a58e5[_0x5ccb70][_0x3e4f('0x49')]);}}}})[_0x3e4f('0x2a')](function(_0x26c815){logger[_0x3e4f('0x27')](JSON[_0x3e4f('0x21')](_0x26c815));});}exports[_0x3e4f('0x53')]=function(_0x54cb75){return getJobs(_0x54cb75);};exports[_0x3e4f('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x83b4=['bcc','name','subtractNumber','subtractUnit','../../files/reports','savename','extname','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','isBetween','startAt','start','add\x20cron','exists','stop\x20cron','active','endAt','update','util','path','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','Smtp','user'];(function(_0x5b7ccc,_0x27e15f){var _0x41d056=function(_0x13f2ca){while(--_0x13f2ca){_0x5b7ccc['push'](_0x5b7ccc['shift']());}};_0x41d056(++_0x27e15f);}(_0x83b4,0x94));var _0x483b=function(_0x1c0ae5,_0x51c11a){_0x1c0ae5=_0x1c0ae5-0x0;var _0x56f42c=_0x83b4[_0x1c0ae5];return _0x56f42c;};'use strict';var fs=require('fs');var util=require(_0x483b('0x0'));var path=require(_0x483b('0x1'));var _=require(_0x483b('0x2'));var moment=require(_0x483b('0x3'));var CronJobManager=require(_0x483b('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x483b('0x5'));var logger=require(_0x483b('0x6'))('schedule');var db=require(_0x483b('0x7'))['db'];var analyticCustomReportController=require(_0x483b('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x483b('0x9')][_0x483b('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x54fe36,_0x1c9faa){return function(){logger[_0x483b('0xb')](_0x483b('0xc'),_0x54fe36['email']);var _0x45dc89=!![];var _0x2d4009=_0x54fe36[_0x483b('0xd')][_0x483b('0xe')]();var _0x25436b={'account':_0x2d4009,'message':{'from':util[_0x483b('0xf')](_0x483b('0x10'),_0x54fe36[_0x483b('0xd')]['name'],_0x54fe36['MailAccount'][_0x483b('0x11')]||_0x54fe36[_0x483b('0xd')][_0x483b('0x12')][_0x483b('0x13')]),'to':_0x54fe36[_0x483b('0x11')],'cc':_0x54fe36['cc'],'bcc':_0x54fe36[_0x483b('0x14')],'subject':util[_0x483b('0xf')]('Report\x20%s\x20last\x20%s\x20%s',_0x1c9faa[_0x483b('0x15')],_0x54fe36[_0x483b('0x16')],_0x54fe36[_0x483b('0x17')])}};var _0x4bc740=path['join'](__dirname,_0x483b('0x18'));var _0x5a9d4d=_0x1c9faa[_0x483b('0x19')];var _0x2199d8=util['format']('%s.%s',path['basename'](_0x1c9faa[_0x483b('0x19')],path[_0x483b('0x1a')](_0x1c9faa[_0x483b('0x19')])),'zip');var _0x73cd51=path[_0x483b('0x1b')](_0x4bc740,_0x5a9d4d);var _0x554584=path[_0x483b('0x1b')](_0x4bc740,_0x2199d8);if(fs[_0x483b('0x1c')](_0x73cd51)){_0x1c9faa[_0x483b('0x1d')]=_0x483b('0x1e');_0x25436b[_0x483b('0x1f')][_0x483b('0x20')]=[{'filename':_0x5a9d4d,'path':_0x73cd51}];_0x25436b[_0x483b('0x1f')]['text']=util['format'](_0x483b('0x21'),JSON[_0x483b('0x22')](_0x1c9faa,null,0x2));}else if(fs[_0x483b('0x1c')](_0x554584)){_0x1c9faa[_0x483b('0x1d')]=_0x483b('0x1e');_0x25436b[_0x483b('0x1f')][_0x483b('0x20')]=[{'filename':_0x2199d8,'path':_0x554584}];}else{_0x25436b[_0x483b('0x1f')][_0x483b('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x54fe36[_0x483b('0x24')]){_0x45dc89=![];logger[_0x483b('0xb')](_0x483b('0x25'));}}if(_0x45dc89){return client[_0x483b('0x26')](_0x483b('0x27'),_0x25436b)[_0x483b('0x28')](function(_0x17944d){if(_0x17944d[_0x483b('0x29')]){return logger['error'](_0x483b('0x2a'),JSON[_0x483b('0x22')](_0x17944d));}return logger[_0x483b('0xb')](_0x483b('0x2b'));})[_0x483b('0x2c')](function(_0x103231){return logger[_0x483b('0x29')]('error\x20mail',JSON[_0x483b('0x22')](_0x103231));});}};}function handleError(){return function(_0x2afc8f){return logger['error'](JSON[_0x483b('0x22')](_0x2afc8f));};}function handleResult(_0x341456){return function(_0x1c7a56){logger[_0x483b('0xb')](_0x483b('0x2d'),JSON['stringify'](_0x1c7a56));if(_0x341456['MailAccount']&&_0x341456[_0x483b('0xd')]['Smtp']&&!_['isNil'](_0x341456['email'])){setTimeout(handleSendEmail(_0x341456,_0x1c7a56),0x3c*0x3e8);}};}function handleJob(_0x1e202d){return function(){try{if(_['isNil'](_0x1e202d[_0x483b('0x16')])){return logger[_0x483b('0xb')](_0x483b('0x2e'));}if(_['isNil'](_0x1e202d[_0x483b('0x17')])){return logger[_0x483b('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x441acd={'startDate':moment()[_0x483b('0x2f')](_0x1e202d[_0x483b('0x16')],_0x1e202d[_0x483b('0x17')])[_0x483b('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x483b('0xf')](_0x483b('0x30')),'type':_0x483b('0x31'),'output':_0x1e202d[_0x483b('0x32')],'name':_0x1e202d[_0x483b('0x15')]};if(!_[_0x483b('0x33')](_0x1e202d['DefaultReportId'])){logger[_0x483b('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x1e202d[_0x483b('0x34')]);return analyticDefaultReportController[_0x483b('0x35')]({'id':_0x1e202d['DefaultReportId']},_0x441acd)[_0x483b('0x28')](handleResult(_0x1e202d))['catch'](handleError());}if(!_[_0x483b('0x33')](_0x1e202d[_0x483b('0x36')])){logger[_0x483b('0xb')](_0x483b('0x37'),_0x1e202d[_0x483b('0x36')]);return analyticCustomReportController['runReport']({'id':_0x1e202d[_0x483b('0x36')]},_0x441acd)[_0x483b('0x28')](handleResult(_0x1e202d))[_0x483b('0x2c')](handleError());}}catch(_0x2d5406){logger[_0x483b('0x29')](JSON[_0x483b('0x22')](_0x2d5406));}return logger[_0x483b('0xb')](_0x483b('0x38'));};}function getJobs(_0x1eb964){var _0xf349f0={};if(_0x1eb964){_0xf349f0['id']=_0x1eb964;}return db['Schedule'][_0x483b('0x39')]({'where':_0xf349f0,'include':[{'model':db[_0x483b('0xd')],'attributes':['id',_0x483b('0x15'),'email'],'include':[{'model':db[_0x483b('0x3a')],'as':_0x483b('0x12'),'include':[{'model':db[_0x483b('0x3b')],'as':_0x483b('0x3b')}]}]}]})[_0x483b('0x28')](function(_0x4eebe9){var _0x4a1e1b=_[_0x483b('0x3c')](manager[_0x483b('0x3d')]);var _0x4b35d5=_[_0x483b('0x3e')](_0x4eebe9,function(_0x4c23f8){return _0x4c23f8['id'][_0x483b('0x3f')]();});var _0x53c35e=_[_0x483b('0x40')](_0x4eebe9,function(_0x1bfa58){return _0x1bfa58['id'][_0x483b('0x3f')]();});var _0x4c2d71=_0x1eb964?_0x4b35d5:_[_0x483b('0x41')](_0x4b35d5,_0x4a1e1b);var _0x1fd5f2=_['intersection'](_0x4b35d5,_0x4a1e1b);var _0x478a7b=_[_0x483b('0x41')](_0x4a1e1b,_0x4b35d5);var _0x20ebea;var _0x4ddf63;for(_0x20ebea=0x0;_0x20ebea<_0x478a7b[_0x483b('0x42')]&&!_0x1eb964;_0x20ebea+=0x1){_0x4ddf63=_0x478a7b[_0x20ebea][_0x483b('0x3f')]();if(manager['exists'](_0x4ddf63)){manager[_0x483b('0x43')](_0x4ddf63);manager[_0x483b('0x44')](_0x4ddf63);logger[_0x483b('0xb')](_0x483b('0x45'),_0x4ddf63);}}logger[_0x483b('0xb')](_0x483b('0x46'),JSON[_0x483b('0x22')](_0x4c2d71));for(_0x20ebea=0x0;_0x20ebea<_0x4c2d71['length'];_0x20ebea+=0x1){_0x4ddf63=_0x4c2d71[_0x20ebea]['toString']();logger[_0x483b('0xb')](_0x483b('0x47'),_0x4ddf63);if(_0x1eb964){logger[_0x483b('0xb')](_0x483b('0x48'),_0x1eb964);logger['info'](JSON['stringify'](_0x53c35e[_0x4ddf63]));BPromise['resolve']()[_0x483b('0x28')](handleJob(_0x53c35e[_0x4ddf63]));logger[_0x483b('0xb')](_0x483b('0x49'),_0x53c35e[_0x4ddf63]['name'],_0x53c35e[_0x4ddf63][_0x483b('0x4a')]);}else if(_0x53c35e[_0x4ddf63][_0x483b('0x4a')]&&_0x53c35e[_0x4ddf63]['active']&&moment()[_0x483b('0x4b')](_0x53c35e[_0x4ddf63][_0x483b('0x4c')],_0x53c35e[_0x4ddf63]['endAt'])){manager['add'](_0x4ddf63,_0x53c35e[_0x4ddf63][_0x483b('0x4a')],handleJob(_0x53c35e[_0x4ddf63]));manager[_0x483b('0x4d')](_0x4ddf63);logger[_0x483b('0xb')](_0x483b('0x4e'),_0x53c35e[_0x4ddf63][_0x483b('0x15')],_0x53c35e[_0x4ddf63][_0x483b('0x4a')]);}else if(manager[_0x483b('0x4f')](_0x4ddf63)){manager[_0x483b('0x43')](_0x4ddf63);manager[_0x483b('0x44')](_0x4ddf63);logger[_0x483b('0xb')](_0x483b('0x50'),_0x53c35e[_0x4ddf63][_0x483b('0x15')],_0x53c35e[_0x4ddf63][_0x483b('0x4a')]);}}for(_0x20ebea=0x0,_0x4ddf63;_0x20ebea<_0x1fd5f2[_0x483b('0x42')]&&!_0x1eb964;_0x20ebea+=0x1){_0x4ddf63=_0x1fd5f2[_0x20ebea][_0x483b('0x3f')]();if(manager['exists'](_0x4ddf63)){if(_0x53c35e[_0x4ddf63][_0x483b('0x4a')]&&_0x53c35e[_0x4ddf63][_0x483b('0x51')]&&moment()[_0x483b('0x4b')](_0x53c35e[_0x4ddf63][_0x483b('0x4c')],_0x53c35e[_0x4ddf63][_0x483b('0x52')])){manager[_0x483b('0x53')](_0x4ddf63,_0x53c35e[_0x4ddf63][_0x483b('0x4a')],handleJob(_0x53c35e[_0x4ddf63]));logger[_0x483b('0xb')]('update\x20cron',_0x53c35e[_0x4ddf63]['name'],_0x53c35e[_0x4ddf63][_0x483b('0x4a')]);}else{manager[_0x483b('0x43')](_0x4ddf63);manager[_0x483b('0x44')](_0x4ddf63);logger[_0x483b('0xb')](_0x483b('0x50'),_0x53c35e[_0x4ddf63]['name'],_0x53c35e[_0x4ddf63][_0x483b('0x4a')]);}}}})[_0x483b('0x2c')](function(_0x260def){logger['error'](JSON['stringify'](_0x260def));});}exports['run']=function(_0x34cec2){return getJobs(_0x34cec2);};exports[_0x483b('0x4d')]=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 30ea5ab..58e469e 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 _0x5825=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','then'];(function(_0x1efaac,_0x9d7996){var _0x114379=function(_0x31464d){while(--_0x31464d){_0x1efaac['push'](_0x1efaac['shift']());}};_0x114379(++_0x9d7996);}(_0x5825,0x78));var _0x5582=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5825[_0x40a045];return _0x1a687c;};var _=require(_0x5582('0x0'));var AWS=require(_0x5582('0x1'));var rp=require(_0x5582('0x2'));var util=require(_0x5582('0x3'));var BPromise=require('bluebird');var db=require(_0x5582('0x4'))['db'];var logger=require('../../config/logger')(_0x5582('0x5'));function getTranscriptionJob(_0x2dbcea,_0x3713d6,_0x2d2e03,_0xeba364){return new Promise(function(_0x11eb87,_0x17a897){var _0x5d618a=new AWS[(_0x5582('0x6'))]({'accessKeyId':_0x3713d6,'secretAccessKey':_0x2dbcea,'region':_0x2d2e03});_0x5d618a[_0x5582('0x7')]({'TranscriptionJobName':_0xeba364},function(_0x39b66,_0x5fa603){if(_0x39b66){return _0x17a897(_0x39b66);}else{return _0x11eb87(_0x5fa603);}});});}function sentiment(_0x5e8681,_0x2904ad,_0x3aa455,_0x24413f,_0x4eacaa){return new Promise(function(_0x40215a,_0xd1cc57){var _0x1fb98c=new AWS['Comprehend']({'accessKeyId':_0x2904ad,'secretAccessKey':_0x5e8681,'region':_0x3aa455});_0x1fb98c[_0x5582('0x8')]({'Text':_0x24413f,'LanguageCode':_0x4eacaa[_0x5582('0x9')](0x0,0x2)},function(_0x542179,_0x421f72){if(_0x542179){return _0xd1cc57(_0x542179);}else{return _0x40215a(_0x421f72);}});});}function checkTranscribeJob(_0xac1c6b,_0x4798d6,_0x5a9a4e){var _0x132be7;return new BPromise(function(_0x4fb9a5,_0x583fb7){logger[_0x5582('0xa')](util[_0x5582('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xac1c6b['id'],_0xac1c6b[_0x5582('0xc')]));return getTranscriptionJob(_0x5a9a4e[_0x5582('0xd')],_0x5a9a4e['data2'],_0x4798d6[_0x5582('0xe')],_0xac1c6b[_0x5582('0xc')])['then'](function(_0x511268){logger[_0x5582('0xa')](util['format'](_0x5582('0xf'),_0xac1c6b['id'],_0xac1c6b[_0x5582('0xc')],_0x511268[_0x5582('0x10')][_0x5582('0x11')]));if(!_0xac1c6b[_0x5582('0x12')]){switch(_0x511268[_0x5582('0x10')][_0x5582('0x11')]){case _0x5582('0x13'):var _0x563ac0={'transcribeStatus':_0x511268[_0x5582('0x10')][_0x5582('0x11')],'fileUri':_0x511268[_0x5582('0x10')][_0x5582('0x14')]['TranscriptFileUri']};logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x15'),_0xac1c6b['id']));return rp({'uri':_0x511268[_0x5582('0x10')][_0x5582('0x14')][_0x5582('0x16')],'json':!![]})[_0x5582('0x17')](function(_0x3efcfb){logger[_0x5582('0xa')](util['format'](_0x5582('0x18'),_0xac1c6b['id']));if(_0x3efcfb&&_0x3efcfb['results']&&_0x3efcfb[_0x5582('0x19')]['transcripts']&&_0x3efcfb[_0x5582('0x19')]['transcripts']['length']){_0x563ac0[_0x5582('0x12')]='';for(var _0xbd8cb4=0x0;_0xbd8cb4<_0x3efcfb[_0x5582('0x19')][_0x5582('0x1a')][_0x5582('0x1b')];_0xbd8cb4++){_0x563ac0[_0x5582('0x12')]+=_0x3efcfb['results'][_0x5582('0x1a')][_0xbd8cb4]['transcript']+'';}}return _0xac1c6b[_0x5582('0x1c')](_0x563ac0);})[_0x5582('0x17')](function(){logger['info'](util[_0x5582('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xac1c6b['id']));if(!_0xac1c6b[_0x5582('0x1d')]){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))](_0x5582('0x20'));}if(!_0x4798d6[_0x5582('0x21')]||!_0x4798d6[_0x5582('0x22')]||!_0x4798d6[_0x5582('0x23')]||!_0x4798d6[_0x5582('0x24')]||!_0x4798d6[_0x5582('0x25')]){throw new db['Sequelize'][(_0x5582('0x1f'))](_0x5582('0x26'));}if(!_0x563ac0[_0x5582('0x12')]){throw new Error(_0x5582('0x27'));}if(_0x4798d6[_0x5582('0x22')]===_0x5a9a4e['id']){return _0x5a9a4e;}else{return db[_0x5582('0x28')][_0x5582('0x29')]({'where':{'id':_settings[_0x5582('0x22')]}});}})['then'](function(_0xa4b2ca){if(!_0xa4b2ca){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))](_0x5582('0x2a'));}if(!_0xa4b2ca['data1']||!_0xa4b2ca[_0x5582('0x2b')]){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x2c'));}_0x132be7=_0xa4b2ca;logger['info'](util[_0x5582('0xb')](_0x5582('0x2d'),_0xac1c6b['id']));return sentiment(_0x132be7['data1'],_0x132be7[_0x5582('0x2b')],_0x4798d6[_0x5582('0x23')],_0x563ac0[_0x5582('0x12')],_0x4798d6[_0x5582('0x24')]);})[_0x5582('0x17')](function(_0x8fec59){logger[_0x5582('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xac1c6b['id']));return _0xac1c6b[_0x5582('0x1c')]({'sentiment':_0x8fec59[_0x5582('0x2e')],'sPositive':_0x8fec59[_0x5582('0x2f')]['Positive'],'sNegative':_0x8fec59['SentimentScore']['Negative'],'sMixed':_0x8fec59['SentimentScore'][_0x5582('0x30')],'sNeutral':_0x8fec59[_0x5582('0x2f')][_0x5582('0x31')]});})[_0x5582('0x17')](function(){logger[_0x5582('0xa')](util[_0x5582('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xac1c6b['id']));_0x4fb9a5();});case'FAILED':return _0xac1c6b[_0x5582('0x1c')]({'transcribeStatus':_0x5582('0x32'),'failureReason':_0x511268[_0x5582('0x10')][_0x5582('0x33')]})[_0x5582('0x17')](function(){logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x34'),_0xac1c6b['id']));_0x4fb9a5();});default:logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x35'),_0xac1c6b['id']));break;}}else{return BPromise[_0x5582('0x36')]()['then'](function(){if(!_0xac1c6b[_0x5582('0x1d')]){throw new db['Sequelize']['ValidationError'](_0x5582('0x20'));}if(!_0x4798d6['sentiment']||!_0x4798d6[_0x5582('0x22')]||!_0x4798d6[_0x5582('0x23')]||!_0x4798d6[_0x5582('0x24')]||!_0x4798d6[_0x5582('0x25')]){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x26'));}if(!_0xac1c6b[_0x5582('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x4798d6[_0x5582('0x22')]===_0x5a9a4e['id']){return _0x5a9a4e;}else{return db[_0x5582('0x28')][_0x5582('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x5582('0x17')](function(_0x2f394f){if(!_0x2f394f){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))](_0x5582('0x2a'));}if(!_0x2f394f[_0x5582('0xd')]||!_0x2f394f[_0x5582('0x2b')]){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x132be7=_0x2f394f;logger['info'](util['format'](_0x5582('0x2d'),_0xac1c6b['id']));return sentiment(_0x132be7['data1'],_0x132be7['data2'],_0x4798d6['sentimentRegion'],_0xac1c6b[_0x5582('0x12')],_0x4798d6[_0x5582('0x24')]);})[_0x5582('0x17')](function(_0x323cb6){logger[_0x5582('0xa')](util['format'](_0x5582('0x37'),_0xac1c6b['id']));return _0xac1c6b[_0x5582('0x1c')]({'sentiment':_0x323cb6[_0x5582('0x2e')],'sPositive':_0x323cb6[_0x5582('0x2f')][_0x5582('0x38')],'sNegative':_0x323cb6[_0x5582('0x2f')]['Negative'],'sMixed':_0x323cb6[_0x5582('0x2f')][_0x5582('0x30')],'sNeutral':_0x323cb6[_0x5582('0x2f')][_0x5582('0x31')],'transcribeStatus':_0x5582('0x13')});})[_0x5582('0x17')](function(){logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x34'),_0xac1c6b['id']));_0x4fb9a5();});}})[_0x5582('0x39')](function(_0x154a12){if(_0x154a12){if(!_0x154a12[_0x5582('0x3a')]||_0x154a12['name']!==_0x5582('0x3b')){logger[_0x5582('0x3c')](util[_0x5582('0xb')](_0x5582('0x3d'),_0xac1c6b['id']),util[_0x5582('0x3e')](_0x154a12,{'showHidden':![],'depth':null}));}}_0x4fb9a5();});});}function checkTranscribe(){var _0x2ac99a;var _0x3eb692;var _0x5632ed;return db['VoiceRecording'][_0x5582('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x5582('0x17')](function(_0xdff3a0){if(!_0xdff3a0||!_0xdff3a0[_0x5582('0x1b')]){throw new db['Sequelize'][(_0x5582('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2ac99a=_0xdff3a0;return db[_0x5582('0x40')]['findOne']({'where':{'id':0x1}});})[_0x5582('0x17')](function(_0x201bd7){if(!_0x201bd7){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x41'));}_0x3eb692=_0x201bd7;if(!_0x3eb692[_0x5582('0x5')]||!_0x3eb692['transcribeAccountId']||!_0x3eb692[_0x5582('0xe')]||!_0x3eb692[_0x5582('0x24')]||!_0x3eb692[_0x5582('0x25')]){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x42'));}return db[_0x5582('0x28')][_0x5582('0x29')]({'where':{'id':_0x3eb692[_0x5582('0x43')]}});})[_0x5582('0x17')](function(_0x4c23cb){if(!_0x4c23cb){throw new db['Sequelize']['ValidationError'](_0x5582('0x2a'));}if(!_0x4c23cb['data1']||!_0x4c23cb[_0x5582('0x2b')]){throw new db['Sequelize'][(_0x5582('0x1f'))](_0x5582('0x2c'));}_0x5632ed=_0x4c23cb;var _0x178575=[];_0x2ac99a[_0x5582('0x44')](function(_0x3d12b4){_0x178575[_0x5582('0x45')](checkTranscribeJob(_0x3d12b4,_0x3eb692,_0x5632ed));});return BPromise[_0x5582('0x46')](_0x178575);})[_0x5582('0x39')](function(_0x1cc436){if(_0x1cc436){if(!_0x1cc436[_0x5582('0x3a')]||_0x1cc436[_0x5582('0x3a')]!=='SequelizeValidationError'){logger[_0x5582('0x3c')](util['inspect'](_0x1cc436,{'showHidden':![],'depth':null}));}}});}exports[_0x5582('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x69e6=['results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','catch','inspect','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','transcribeName','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0x517ece,_0x1b243c){var _0x8ce8e3=function(_0x59560c){while(--_0x59560c){_0x517ece['push'](_0x517ece['shift']());}};_0x8ce8e3(++_0x1b243c);}(_0x69e6,0x1e0));var _0x669e=function(_0x325363,_0x5707dd){_0x325363=_0x325363-0x0;var _0x36efbf=_0x69e6[_0x325363];return _0x36efbf;};var _=require('lodash');var AWS=require(_0x669e('0x0'));var rp=require(_0x669e('0x1'));var util=require(_0x669e('0x2'));var BPromise=require(_0x669e('0x3'));var db=require(_0x669e('0x4'))['db'];var logger=require('../../config/logger')(_0x669e('0x5'));function getTranscriptionJob(_0x315a24,_0x426446,_0x121775,_0x3258f7){return new Promise(function(_0x1be88f,_0x28f1d9){var _0x132e5e=new AWS[(_0x669e('0x6'))]({'accessKeyId':_0x426446,'secretAccessKey':_0x315a24,'region':_0x121775});_0x132e5e[_0x669e('0x7')]({'TranscriptionJobName':_0x3258f7},function(_0x17323c,_0x2b3163){if(_0x17323c){return _0x28f1d9(_0x17323c);}else{return _0x1be88f(_0x2b3163);}});});}function sentiment(_0x4b2aac,_0x2f7bac,_0x1f78bd,_0x23b057,_0x50cbb6){return new Promise(function(_0x47d875,_0x50ba7d){var _0x2bbcbe=new AWS[(_0x669e('0x8'))]({'accessKeyId':_0x2f7bac,'secretAccessKey':_0x4b2aac,'region':_0x1f78bd});_0x2bbcbe[_0x669e('0x9')]({'Text':_0x23b057,'LanguageCode':_0x50cbb6[_0x669e('0xa')](0x0,0x2)},function(_0x469399,_0x53f4ad){if(_0x469399){return _0x50ba7d(_0x469399);}else{return _0x47d875(_0x53f4ad);}});});}function checkTranscribeJob(_0x4ed2ec,_0xea3441,_0x1a7ea7){var _0x344b70;return new BPromise(function(_0x12e4aa,_0x4c3fe5){logger['info'](util[_0x669e('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4ed2ec['id'],_0x4ed2ec[_0x669e('0xc')]));return getTranscriptionJob(_0x1a7ea7[_0x669e('0xd')],_0x1a7ea7[_0x669e('0xe')],_0xea3441['transcribeRegion'],_0x4ed2ec[_0x669e('0xc')])[_0x669e('0xf')](function(_0x150993){logger[_0x669e('0x10')](util['format'](_0x669e('0x11'),_0x4ed2ec['id'],_0x4ed2ec['transcribeName'],_0x150993[_0x669e('0x12')][_0x669e('0x13')]));if(!_0x4ed2ec[_0x669e('0x14')]){switch(_0x150993[_0x669e('0x12')][_0x669e('0x13')]){case'COMPLETED':var _0x48c385={'transcribeStatus':_0x150993[_0x669e('0x12')][_0x669e('0x13')],'fileUri':_0x150993['TranscriptionJob'][_0x669e('0x15')][_0x669e('0x16')]};logger[_0x669e('0x10')](util[_0x669e('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x4ed2ec['id']));return rp({'uri':_0x150993[_0x669e('0x12')][_0x669e('0x15')]['TranscriptFileUri'],'json':!![]})[_0x669e('0xf')](function(_0xdd733d){logger[_0x669e('0x10')](util['format'](_0x669e('0x17'),_0x4ed2ec['id']));if(_0xdd733d&&_0xdd733d[_0x669e('0x18')]&&_0xdd733d[_0x669e('0x18')][_0x669e('0x19')]&&_0xdd733d[_0x669e('0x18')][_0x669e('0x19')][_0x669e('0x1a')]){_0x48c385[_0x669e('0x14')]='';for(var _0x4f0762=0x0;_0x4f0762<_0xdd733d['results'][_0x669e('0x19')]['length'];_0x4f0762++){_0x48c385[_0x669e('0x14')]+=_0xdd733d['results'][_0x669e('0x19')][_0x4f0762][_0x669e('0x1b')]+'';}}return _0x4ed2ec[_0x669e('0x1c')](_0x48c385);})[_0x669e('0xf')](function(){logger[_0x669e('0x10')](util[_0x669e('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4ed2ec['id']));if(!_0x4ed2ec[_0x669e('0x1d')]){throw new db[(_0x669e('0x1e'))][(_0x669e('0x1f'))](_0x669e('0x20'));}if(!_0xea3441['sentiment']||!_0xea3441[_0x669e('0x21')]||!_0xea3441[_0x669e('0x22')]||!_0xea3441[_0x669e('0x23')]||!_0xea3441[_0x669e('0x24')]){throw new db['Sequelize'][(_0x669e('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x48c385[_0x669e('0x14')]){throw new Error(_0x669e('0x25'));}if(_0xea3441[_0x669e('0x21')]===_0x1a7ea7['id']){return _0x1a7ea7;}else{return db[_0x669e('0x26')][_0x669e('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x669e('0xf')](function(_0x17826a){if(!_0x17826a){throw new db[(_0x669e('0x1e'))]['ValidationError'](_0x669e('0x28'));}if(!_0x17826a[_0x669e('0xd')]||!_0x17826a[_0x669e('0xe')]){throw new db[(_0x669e('0x1e'))]['ValidationError'](_0x669e('0x29'));}_0x344b70=_0x17826a;logger['info'](util['format'](_0x669e('0x2a'),_0x4ed2ec['id']));return sentiment(_0x344b70[_0x669e('0xd')],_0x344b70[_0x669e('0xe')],_0xea3441[_0x669e('0x22')],_0x48c385[_0x669e('0x14')],_0xea3441[_0x669e('0x23')]);})[_0x669e('0xf')](function(_0x1acc01){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4ed2ec['id']));return _0x4ed2ec['update']({'sentiment':_0x1acc01[_0x669e('0x2b')],'sPositive':_0x1acc01[_0x669e('0x2c')][_0x669e('0x2d')],'sNegative':_0x1acc01[_0x669e('0x2c')][_0x669e('0x2e')],'sMixed':_0x1acc01[_0x669e('0x2c')][_0x669e('0x2f')],'sNeutral':_0x1acc01[_0x669e('0x2c')][_0x669e('0x30')]});})['then'](function(){logger['info'](util['format'](_0x669e('0x31'),_0x4ed2ec['id']));_0x12e4aa();});case _0x669e('0x32'):return _0x4ed2ec[_0x669e('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x150993[_0x669e('0x12')][_0x669e('0x33')]})[_0x669e('0xf')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4ed2ec['id']));_0x12e4aa();});default:logger['info'](util[_0x669e('0xb')](_0x669e('0x34'),_0x4ed2ec['id']));break;}}else{return BPromise['resolve']()[_0x669e('0xf')](function(){if(!_0x4ed2ec[_0x669e('0x1d')]){throw new db['Sequelize'][(_0x669e('0x1f'))](_0x669e('0x20'));}if(!_0xea3441[_0x669e('0x35')]||!_0xea3441[_0x669e('0x21')]||!_0xea3441['sentimentRegion']||!_0xea3441[_0x669e('0x23')]||!_0xea3441['bucket']){throw new db[(_0x669e('0x1e'))][(_0x669e('0x1f'))](_0x669e('0x36'));}if(!_0x4ed2ec[_0x669e('0x14')]){throw new Error(_0x669e('0x25'));}if(_0xea3441[_0x669e('0x21')]===_0x1a7ea7['id']){return _0x1a7ea7;}else{return db['CloudProvider'][_0x669e('0x27')]({'where':{'id':_settings[_0x669e('0x21')]}});}})[_0x669e('0xf')](function(_0x378931){if(!_0x378931){throw new db[(_0x669e('0x1e'))]['ValidationError'](_0x669e('0x28'));}if(!_0x378931['data1']||!_0x378931['data2']){throw new db['Sequelize']['ValidationError'](_0x669e('0x29'));}_0x344b70=_0x378931;logger['info'](util[_0x669e('0xb')](_0x669e('0x2a'),_0x4ed2ec['id']));return sentiment(_0x344b70['data1'],_0x344b70[_0x669e('0xe')],_0xea3441['sentimentRegion'],_0x4ed2ec[_0x669e('0x14')],_0xea3441[_0x669e('0x23')]);})['then'](function(_0x58caac){logger[_0x669e('0x10')](util[_0x669e('0xb')](_0x669e('0x37'),_0x4ed2ec['id']));return _0x4ed2ec[_0x669e('0x1c')]({'sentiment':_0x58caac['Sentiment'],'sPositive':_0x58caac[_0x669e('0x2c')][_0x669e('0x2d')],'sNegative':_0x58caac[_0x669e('0x2c')][_0x669e('0x2e')],'sMixed':_0x58caac[_0x669e('0x2c')][_0x669e('0x2f')],'sNeutral':_0x58caac['SentimentScore']['Neutral'],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x669e('0x10')](util[_0x669e('0xb')](_0x669e('0x31'),_0x4ed2ec['id']));_0x12e4aa();});}})['catch'](function(_0x4f3a66){if(_0x4f3a66){if(!_0x4f3a66[_0x669e('0x38')]||_0x4f3a66[_0x669e('0x38')]!==_0x669e('0x39')){logger[_0x669e('0x3a')](util[_0x669e('0xb')](_0x669e('0x3b'),_0x4ed2ec['id']),util['inspect'](_0x4f3a66,{'showHidden':![],'depth':null}));}}_0x12e4aa();});});}function checkTranscribe(){var _0x121fa3;var _0x282b34;var _0x517c68;return db[_0x669e('0x3c')][_0x669e('0x3d')]({'where':{'transcribeStatus':_0x669e('0x3e')}})['then'](function(_0xdc0f05){if(!_0xdc0f05||!_0xdc0f05[_0x669e('0x1a')]){throw new db[(_0x669e('0x1e'))]['ValidationError'](_0x669e('0x3f'));}_0x121fa3=_0xdc0f05;return db[_0x669e('0x40')][_0x669e('0x27')]({'where':{'id':0x1}});})[_0x669e('0xf')](function(_0x53bc69){if(!_0x53bc69){throw new db['Sequelize'][(_0x669e('0x1f'))]('Settings\x20not\x20available');}_0x282b34=_0x53bc69;if(!_0x282b34['transcribe']||!_0x282b34[_0x669e('0x41')]||!_0x282b34[_0x669e('0x42')]||!_0x282b34[_0x669e('0x23')]||!_0x282b34[_0x669e('0x24')]){throw new db[(_0x669e('0x1e'))][(_0x669e('0x1f'))](_0x669e('0x43'));}return db[_0x669e('0x26')][_0x669e('0x27')]({'where':{'id':_0x282b34[_0x669e('0x41')]}});})['then'](function(_0x3169e7){if(!_0x3169e7){throw new db[(_0x669e('0x1e'))][(_0x669e('0x1f'))](_0x669e('0x28'));}if(!_0x3169e7[_0x669e('0xd')]||!_0x3169e7[_0x669e('0xe')]){throw new db[(_0x669e('0x1e'))][(_0x669e('0x1f'))](_0x669e('0x29'));}_0x517c68=_0x3169e7;var _0x2f9aad=[];_0x121fa3[_0x669e('0x44')](function(_0x45496c){_0x2f9aad[_0x669e('0x45')](checkTranscribeJob(_0x45496c,_0x282b34,_0x517c68));});return BPromise['all'](_0x2f9aad);})[_0x669e('0x46')](function(_0x56ec10){if(_0x56ec10){if(!_0x56ec10['name']||_0x56ec10[_0x669e('0x38')]!==_0x669e('0x39')){logger[_0x669e('0x3a')](util[_0x669e('0x47')](_0x56ec10,{'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 f83ed01..ae11cf4 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 _0xb584=['../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb'];(function(_0x4981b2,_0x2575e4){var _0x47f437=function(_0x445de1){while(--_0x445de1){_0x4981b2['push'](_0x4981b2['shift']());}};_0x47f437(++_0x2575e4);}(_0xb584,0x8c));var _0x4b58=function(_0x24faaa,_0x18420e){_0x24faaa=_0x24faaa-0x0;var _0x24fbf0=_0xb584[_0x24faaa];return _0x24fbf0;};'use strict';var _=require(_0x4b58('0x0'));var moment=require(_0x4b58('0x1'));var Redis=require(_0x4b58('0x2'));var util=require(_0x4b58('0x3'));var config=require('../../config/environment');var db=require(_0x4b58('0x4'))['db'];var logger=require(_0x4b58('0x5'))(_0x4b58('0x6'));config[_0x4b58('0x7')]=_[_0x4b58('0x8')](config[_0x4b58('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x4b58('0x9'))(new Redis(config[_0x4b58('0x7')]));function closeInteractions(){var _0x4138e3=[];return db[_0x4b58('0xa')][_0x4b58('0xb')]({'raw':!![],'attributes':['id',_0x4b58('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4b58('0xd')](0x18,'hours')}}})[_0x4b58('0xe')](function(_0xeacc9b){if(_0xeacc9b&&_0xeacc9b['length']){_0x4138e3=_[_0x4b58('0xf')](_0xeacc9b||[],'id');logger['info'](_0x4b58('0x10'),_0x4138e3[_0x4b58('0x11')]());return db['WhatsappInteraction'][_0x4b58('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x4b58('0x13')](_0x4b58('0x14'))},{'where':{'id':_0x4138e3}});}})[_0x4b58('0xe')](function(){if(_0x4138e3&&_0x4138e3['length']){logger[_0x4b58('0x15')](_0x4b58('0x16'),_0x4138e3[_0x4b58('0x11')]());for(var _0x299a2f=0x0;_0x299a2f<_0x4138e3[_0x4b58('0x17')];_0x299a2f++){io['emit'](_0x4b58('0x18'),{'id':_0x4138e3[_0x299a2f],'closed':!![]});}}})[_0x4b58('0x19')](function(_0x5452b3){logger['error'](_0x4b58('0x1a'),_0x5452b3?util[_0x4b58('0x1b')](_0x5452b3,{'showHidden':![],'depth':null}):'');});}exports[_0x4b58('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x81c9=['lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0x10dca6,_0x45e1e2){var _0x6e9199=function(_0x141204){while(--_0x141204){_0x10dca6['push'](_0x10dca6['shift']());}};_0x6e9199(++_0x45e1e2);}(_0x81c9,0x65));var _0x981c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x81c9[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x981c('0x0'));var moment=require(_0x981c('0x1'));var Redis=require('ioredis');var util=require(_0x981c('0x2'));var config=require('../../config/environment');var db=require(_0x981c('0x3'))['db'];var logger=require('../logger')(_0x981c('0x4'));config[_0x981c('0x5')]=_[_0x981c('0x6')](config[_0x981c('0x5')],{'host':_0x981c('0x7'),'port':0x18eb});var io=require(_0x981c('0x8'))(new Redis(config[_0x981c('0x5')]));function closeInteractions(){var _0x2d4c99=[];return db[_0x981c('0x9')][_0x981c('0xa')]({'raw':!![],'attributes':['id',_0x981c('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x981c('0xc')](0x18,_0x981c('0xd'))}}})[_0x981c('0xe')](function(_0xda58a5){if(_0xda58a5&&_0xda58a5[_0x981c('0xf')]){_0x2d4c99=_[_0x981c('0x10')](_0xda58a5||[],'id');logger[_0x981c('0x11')](_0x981c('0x12'),_0x2d4c99['join']());return db[_0x981c('0x9')]['update']({'closeReason':_0x981c('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x981c('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2d4c99}});}})[_0x981c('0xe')](function(){if(_0x2d4c99&&_0x2d4c99['length']){logger['info'](_0x981c('0x15'),_0x2d4c99['join']());for(var _0xe94e9f=0x0;_0xe94e9f<_0x2d4c99['length'];_0xe94e9f++){io['emit'](_0x981c('0x16'),{'id':_0x2d4c99[_0xe94e9f],'closed':!![]});}}})[_0x981c('0x17')](function(_0x4a0d0a){logger[_0x981c('0x18')](_0x981c('0x19'),_0x4a0d0a?util[_0x981c('0x1a')](_0x4a0d0a,{'showHidden':![],'depth':null}):'');});}exports[_0x981c('0x1b')]=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 4cc18eb..f87605d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x273c=['destroy','bulkCreate','log','finished\x20populating','contacts1','CmHopper','then','hopper1','CmContact','contacts2','catch','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo'];(function(_0x362284,_0x2b2eb0){var _0x1a15c0=function(_0x2c882b){while(--_0x2c882b){_0x362284['push'](_0x362284['shift']());}};_0x1a15c0(++_0x2b2eb0);}(_0x273c,0xef));var _0xc273=function(_0x4257b6,_0x2348c7){_0x4257b6=_0x4257b6-0x0;var _0x4ad68c=_0x273c[_0x4257b6];return _0x4ad68c;};'use strict';var util=require(_0xc273('0x0'));var db=require(_0xc273('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc273('0x2')]({'id':i,'firstName':_0xc273('0x3')+i,'lastName':_0xc273('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc273('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc273('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc273('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc273('0x6')](),'updatedAt':Date[_0xc273('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc273('0x2')]({'id':i,'firstName':_0xc273('0x3')+i,'lastName':_0xc273('0x4')+i,'phone':0xf879fb460+i,'email':_0xc273('0x7')+i+_0xc273('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc273('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc273('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc273('0x6')]()});}db['CmContact'][_0xc273('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0xc273('0x9')](contacts);})['then'](function(){console[_0xc273('0xa')](_0xc273('0xb'),_0xc273('0xc'));return db[_0xc273('0xd')][_0xc273('0x8')]({'where':{}});})[_0xc273('0xe')](function(){return db['CmHopper'][_0xc273('0x9')](hopper);})['then'](function(){console[_0xc273('0xa')](_0xc273('0xb'),_0xc273('0xf'));return db[_0xc273('0x10')][_0xc273('0x9')](contacts2);})['then'](function(){console[_0xc273('0xa')](_0xc273('0xb'),_0xc273('0x11'));return db['CmHopper'][_0xc273('0x9')](hopper2);})[_0xc273('0xe')](function(){console[_0xc273('0xa')](_0xc273('0xb'),'hopper2');})[_0xc273('0x12')](function(_0x53c39a){console[_0xc273('0xa')](_0x53c39a);}); \ No newline at end of file +var _0x8657=['Innocenzo','then','CmContact','finished\x20populating','contacts1','bulkCreate','log','contacts2','CmHopper','hopper2','util','../mysqldb','innocenzo.biondo','@xcally.com','now','push'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8657,0x10a));var _0x7865=function(_0x49dffe,_0x19845e){_0x49dffe=_0x49dffe-0x0;var _0x4d8fe7=_0x8657[_0x49dffe];return _0x4d8fe7;};'use strict';var util=require(_0x7865('0x0'));var db=require(_0x7865('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7865('0x2')+i+_0x7865('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x7865('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7865('0x4')](),'updatedAt':Date[_0x7865('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7865('0x5')]({'id':i,'firstName':_0x7865('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7865('0x2')+i+_0x7865('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7865('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x7865('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7865('0x4')](),'updatedAt':Date[_0x7865('0x4')]()});}db['CmContact']['destroy']({'where':{}})[_0x7865('0x7')](function(){return db[_0x7865('0x8')]['bulkCreate'](contacts);})['then'](function(){console['log'](_0x7865('0x9'),_0x7865('0xa'));return db['CmHopper']['destroy']({'where':{}});})[_0x7865('0x7')](function(){return db['CmHopper'][_0x7865('0xb')](hopper);})['then'](function(){console[_0x7865('0xc')](_0x7865('0x9'),'hopper1');return db[_0x7865('0x8')][_0x7865('0xb')](contacts2);})[_0x7865('0x7')](function(){console[_0x7865('0xc')](_0x7865('0x9'),_0x7865('0xd'));return db[_0x7865('0xe')][_0x7865('0xb')](hopper2);})[_0x7865('0x7')](function(){console[_0x7865('0xc')](_0x7865('0x9'),_0x7865('0xf'));})['catch'](function(_0x2af803){console[_0x7865('0xc')](_0x2af803);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d427ab5..dd38b1f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd9e=['bulkCreate','log','add\x20user','util','../mysqldb','push','agent','%s%s','format','password','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0xbd9e,0x1f1));var _0xebd9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbd9e[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0xebd9('0x0'));var db=require(_0xebd9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xebd9('0x2')]({'name':util['format']('%s%s',_0xebd9('0x3'),i),'fullname':util['format'](_0xebd9('0x4'),_0xebd9('0x3'),i),'email':util[_0xebd9('0x5')]('%s%s@xcally.com',_0xebd9('0x3'),i),'role':_0xebd9('0x3'),'password':_0xebd9('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xebd9('0x7'),'ws',_0xebd9('0x8')],'disallow':['all'],'allow':[_0xebd9('0x9')],'defaultuser':util[_0xebd9('0x5')](_0xebd9('0x4'),_0xebd9('0x3'),i),'encryption':'yes','avpf':_0xebd9('0xa'),'force_avp':_0xebd9('0xa'),'icesupport':_0xebd9('0xa'),'dtlsenable':_0xebd9('0xa'),'dtlsverify':'no','dtlscertfile':_0xebd9('0xb'),'dtlsprivatekey':_0xebd9('0xc'),'dtlssetup':_0xebd9('0xd'),'callerid':util['format'](_0xebd9('0xe'),util['format'](_0xebd9('0x4'),'agent',i),0xfa0+i)});}db[_0xebd9('0xf')][_0xebd9('0x10')](users)['then'](function(){console[_0xebd9('0x11')](_0xebd9('0x12'));})['catch'](function(_0x809fbe){console[_0xebd9('0x11')](_0x809fbe);}); \ No newline at end of file +var _0x3f71=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','%s%s','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','friend','wss','all'];(function(_0x41ef21,_0xde91a1){var _0x6694d5=function(_0x593c2f){while(--_0x593c2f){_0x41ef21['push'](_0x41ef21['shift']());}};_0x6694d5(++_0xde91a1);}(_0x3f71,0x160));var _0x13f7=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x3f71[_0x25662e];return _0x59b7bc;};'use strict';var util=require(_0x13f7('0x0'));var db=require(_0x13f7('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x13f7('0x2')]({'name':util[_0x13f7('0x3')]('%s%s',_0x13f7('0x4'),i),'fullname':util['format']('%s%s',_0x13f7('0x4'),i),'email':util[_0x13f7('0x3')]('%s%s@xcally.com',_0x13f7('0x4'),i),'role':_0x13f7('0x4'),'password':'password','internal':0xfa0+i,'type':_0x13f7('0x5'),'transport':['udp','ws',_0x13f7('0x6')],'disallow':[_0x13f7('0x7')],'allow':[_0x13f7('0x8')],'defaultuser':util['format']('%s%s',_0x13f7('0x4'),i),'encryption':'yes','avpf':_0x13f7('0x9'),'force_avp':_0x13f7('0x9'),'icesupport':_0x13f7('0x9'),'dtlsenable':_0x13f7('0x9'),'dtlsverify':'no','dtlscertfile':_0x13f7('0xa'),'dtlsprivatekey':_0x13f7('0xb'),'dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x13f7('0x3')](_0x13f7('0xc'),_0x13f7('0x4'),i),0xfa0+i)});}db['User'][_0x13f7('0xd')](users)[_0x13f7('0xe')](function(){console[_0x13f7('0xf')](_0x13f7('0x10'));})[_0x13f7('0x11')](function(_0x3b6d98){console[_0x13f7('0xf')](_0x3b6d98);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 059ec83..aa11ed9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbc5=['WhatsappInteractions','user:%s','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:outbound','VoiceQueue','MailQueues','Trunk','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','mail','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeFaxInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','nsp','disconnect','bluebird','../mysqldb','./environment','name','User','role','telephone','agent','type','ivr','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','Telephones','Trunks','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','Agents','length','find','userProfileId','handshake','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction'];(function(_0x1caef6,_0x3664e9){var _0x392cf3=function(_0x183cd4){while(--_0x183cd4){_0x1caef6['push'](_0x1caef6['shift']());}};_0x392cf3(++_0x3664e9);}(_0xfbc5,0x1ab));var _0x5fbc=function(_0x14edda,_0x10009e){_0x14edda=_0x14edda-0x0;var _0x3816b7=_0xfbc5[_0x14edda];return _0x3816b7;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x5fbc('0x0'));var db=require(_0x5fbc('0x1'))['db'];var config=require(_0x5fbc('0x2'));var queryQueues={'attributes':['id',_0x5fbc('0x3')],'include':[{'as':'Agents','model':db[_0x5fbc('0x4')],'attributes':['id',_0x5fbc('0x3'),_0x5fbc('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5fbc('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5fbc('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5fbc('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x5fbc('0x8')],'where':{'type':_0x5fbc('0x9')}};function getAssociatedResources(_0x208c4c,_0x49b4ae,_0x2c3a9a){return db['UserProfileSection']['findOne']({'where':{'name':_0x208c4c,'userProfileId':_0x49b4ae},'raw':!![]})[_0x5fbc('0xa')](function(_0x269d6f){if(_0x269d6f){if(_0x269d6f[_0x5fbc('0xb')]){switch(_0x208c4c){case _0x5fbc('0xc'):case _0x5fbc('0xd'):case _0x5fbc('0xe'):case _0x5fbc('0xf'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2c3a9a]['findAll'](queryQueues);case _0x5fbc('0x10'):return db[_0x2c3a9a]['findAll'](queryTelephones);case _0x5fbc('0x11'):return db[_0x2c3a9a][_0x5fbc('0x12')](queryTrunks);case _0x5fbc('0x13'):return db[_0x2c3a9a]['findAll'](queryCampaigns);}}else{return db[_0x5fbc('0x14')][_0x5fbc('0x12')]({'attributes':[_0x5fbc('0x15')],'where':{'sectionId':_0x269d6f['id']},'raw':!![]})[_0x5fbc('0xa')](function(_0x8aa7a2){if(_0x8aa7a2){var _0x1dc455={'where':{'id':_[_0x5fbc('0x16')](_0x8aa7a2,'resourceId')},'raw':!![]};switch(_0x2c3a9a){case _0x5fbc('0x4'):_0x1dc455[_0x5fbc('0x17')][_0x5fbc('0x5')]=_0x5fbc('0x6');break;case _0x5fbc('0x18'):_0x1dc455['where'][_0x5fbc('0x8')]=_0x5fbc('0x9');break;}return db[_0x2c3a9a][_0x5fbc('0x12')](_0x1dc455);}else{return[];}});}}else{return[];}})['then'](function(_0x37cb11){return _0x37cb11;});}function joinOrLeaveQueues(_0x1fc5e4,_0x3e7514,_0x47367a,_0x24404b){_0x1fc5e4[_0x3e7514](util[_0x5fbc('0x19')](_0x5fbc('0x1a'),_0x47367a,_0x24404b[_0x5fbc('0x3')]));if(_0x24404b[_0x5fbc('0x1b')]){for(var _0x1653e5=0x0;_0x1653e5<_0x24404b[_0x5fbc('0x1b')][_0x5fbc('0x1c')];_0x1653e5+=0x1){_0x1fc5e4[_0x3e7514](util[_0x5fbc('0x19')]('user:%s',_0x24404b[_0x5fbc('0x1b')][_0x1653e5][_0x5fbc('0x3')]));}}}function joinOrLeave(_0x5d48ca,_0x44bdc3,_0x5a1c71){var _0x49b0ba;if(_0x5d48ca['handshake']['query']['id']){db['User'][_0x5fbc('0x1d')]({'attributes':['id',_0x5fbc('0x3'),_0x5fbc('0x5'),_0x5fbc('0x1e')],'where':{'id':_0x5d48ca[_0x5fbc('0x1f')][_0x5fbc('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x5fbc('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fbc('0x22')],'as':_0x5fbc('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fbc('0x24')],'as':_0x5fbc('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fbc('0x26')],'as':_0x5fbc('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fbc('0x28')],'as':_0x5fbc('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fbc('0x2a')],'as':_0x5fbc('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x5fbc('0xa')](function(_0x2344b9){if(_0x2344b9){_0x49b0ba=_0x2344b9;_0x5d48ca[_0x44bdc3](util[_0x5fbc('0x19')](_0x5fbc('0x2c'),_0x2344b9[_0x5fbc('0x3')]));var _0x28b829=[];switch(_0x2344b9[_0x5fbc('0x5')]){case _0x5fbc('0x2d'):_0x5d48ca[_0x44bdc3](_0x5fbc('0x2e'));_0x5d48ca[_0x44bdc3]('voice:outbound');if(queryQueues[_0x5fbc('0x2f')](_0x5fbc('0x30'))){delete queryQueues['include'];}_0x28b829[_0x5fbc('0x31')](db['VoiceQueue']['findAll'](queryQueues));_0x28b829['push'](db[_0x5fbc('0x32')][_0x5fbc('0x12')](queryQueues));_0x28b829['push'](db[_0x5fbc('0x33')][_0x5fbc('0x12')](queryQueues));_0x28b829[_0x5fbc('0x31')](db[_0x5fbc('0x34')][_0x5fbc('0x12')](queryQueues));_0x28b829[_0x5fbc('0x31')](db[_0x5fbc('0x35')][_0x5fbc('0x12')](queryQueues));_0x28b829[_0x5fbc('0x31')](db[_0x5fbc('0x36')][_0x5fbc('0x12')](queryQueues));_0x28b829['push'](db[_0x5fbc('0x37')][_0x5fbc('0x12')](queryQueues));_0x28b829['push'](db[_0x5fbc('0x4')][_0x5fbc('0x12')](queryTelephones));_0x28b829[_0x5fbc('0x31')](db['Trunk'][_0x5fbc('0x12')](queryTrunks));_0x28b829[_0x5fbc('0x31')](db[_0x5fbc('0x18')][_0x5fbc('0x12')](queryCampaigns));_0x28b829[_0x5fbc('0x31')](db[_0x5fbc('0x4')][_0x5fbc('0x12')](queryAgents));break;case _0x5fbc('0x38'):_0x5d48ca[_0x44bdc3](_0x5fbc('0x2e'));_0x5d48ca[_0x44bdc3](_0x5fbc('0x39'));_0x28b829[_0x5fbc('0x31')](getAssociatedResources(_0x5fbc('0xc'),_0x2344b9[_0x5fbc('0x1e')],_0x5fbc('0x3a')));_0x28b829[_0x5fbc('0x31')](getAssociatedResources(_0x5fbc('0xd'),_0x2344b9[_0x5fbc('0x1e')],'ChatQueue'));_0x28b829[_0x5fbc('0x31')](getAssociatedResources(_0x5fbc('0xe'),_0x2344b9[_0x5fbc('0x1e')],'FaxQueue'));_0x28b829[_0x5fbc('0x31')](getAssociatedResources(_0x5fbc('0xf'),_0x2344b9[_0x5fbc('0x1e')],_0x5fbc('0x34')));_0x28b829[_0x5fbc('0x31')](getAssociatedResources(_0x5fbc('0x3b'),_0x2344b9['userProfileId'],_0x5fbc('0x35')));_0x28b829[_0x5fbc('0x31')](getAssociatedResources('OpenchannelQueues',_0x2344b9[_0x5fbc('0x1e')],_0x5fbc('0x36')));_0x28b829[_0x5fbc('0x31')](getAssociatedResources('WhatsappQueues',_0x2344b9['userProfileId'],_0x5fbc('0x37')));_0x28b829[_0x5fbc('0x31')](getAssociatedResources(_0x5fbc('0x10'),_0x2344b9[_0x5fbc('0x1e')],_0x5fbc('0x4')));_0x28b829['push'](getAssociatedResources(_0x5fbc('0x11'),_0x2344b9[_0x5fbc('0x1e')],_0x5fbc('0x3c')));_0x28b829[_0x5fbc('0x31')](getAssociatedResources('IvrCampaigns',_0x2344b9[_0x5fbc('0x1e')],'Campaign'));_0x28b829[_0x5fbc('0x31')](db[_0x5fbc('0x4')]['findAll'](queryAgents));break;case'agent':_0x5d48ca[_0x44bdc3](_0x5fbc('0x2e'));_0x5d48ca[_0x44bdc3](_0x5fbc('0x39'));_0x28b829['push'](_0x2344b9[_0x5fbc('0x3d')]({'attributes':['id','name']}));_0x28b829[_0x5fbc('0x31')](_0x2344b9['getChatQueues']({'attributes':['id',_0x5fbc('0x3')]}));_0x28b829[_0x5fbc('0x31')](_0x2344b9[_0x5fbc('0x3e')]({'attributes':['id','name']}));_0x28b829[_0x5fbc('0x31')](_0x2344b9[_0x5fbc('0x3f')]({'attributes':['id',_0x5fbc('0x3')]}));_0x28b829['push'](_0x2344b9[_0x5fbc('0x40')]({'attributes':['id','name']}));_0x28b829['push'](_0x2344b9[_0x5fbc('0x41')]({'attributes':['id',_0x5fbc('0x3')]}));_0x28b829[_0x5fbc('0x31')](_0x2344b9['getWhatsappQueues']({'attributes':['id',_0x5fbc('0x3')]}));break;}return BPromise[_0x5fbc('0x42')](_0x28b829);}})[_0x5fbc('0xa')](function(_0x267ec5){if(_0x267ec5&&_0x267ec5[_0x5fbc('0x1c')]){for(var _0x3abbda=0x0;_0x3abbda<_0x267ec5[_0x5fbc('0x1c')];_0x3abbda+=0x1){for(var _0x4ae82b=0x0;_0x4ae82b<_0x267ec5[_0x3abbda]['length'];_0x4ae82b+=0x1){switch(_0x3abbda){case 0x0:joinOrLeaveQueues(_0x5d48ca,_0x44bdc3,_0x5fbc('0x43'),_0x267ec5[_0x3abbda][_0x4ae82b]);break;case 0x1:joinOrLeaveQueues(_0x5d48ca,_0x44bdc3,_0x5fbc('0x44'),_0x267ec5[_0x3abbda][_0x4ae82b]);break;case 0x2:joinOrLeaveQueues(_0x5d48ca,_0x44bdc3,_0x5fbc('0x45'),_0x267ec5[_0x3abbda][_0x4ae82b]);break;case 0x3:joinOrLeaveQueues(_0x5d48ca,_0x44bdc3,'sms',_0x267ec5[_0x3abbda][_0x4ae82b]);break;case 0x4:joinOrLeaveQueues(_0x5d48ca,_0x44bdc3,_0x5fbc('0x46'),_0x267ec5[_0x3abbda][_0x4ae82b]);break;case 0x5:joinOrLeaveQueues(_0x5d48ca,_0x44bdc3,'openchannel',_0x267ec5[_0x3abbda][_0x4ae82b]);break;case 0x6:joinOrLeaveQueues(_0x5d48ca,_0x44bdc3,'whatsapp',_0x267ec5[_0x3abbda][_0x4ae82b]);break;case 0x7:if(_0x49b0ba[_0x5fbc('0x5')]!==_0x5fbc('0x7'))_0x5d48ca[_0x44bdc3](util[_0x5fbc('0x19')](_0x5fbc('0x47'),_0x267ec5[_0x3abbda][_0x4ae82b][_0x5fbc('0x3')]));break;case 0x8:if(_0x49b0ba['role']!=='agent')_0x5d48ca[_0x44bdc3](util[_0x5fbc('0x19')]('trunk:%s',_0x267ec5[_0x3abbda][_0x4ae82b][_0x5fbc('0x3')]));break;case 0x9:if(_0x49b0ba[_0x5fbc('0x5')]!=='agent')_0x5d48ca[_0x44bdc3](util[_0x5fbc('0x19')](_0x5fbc('0x48'),_0x267ec5[_0x3abbda][_0x4ae82b]['type'],_0x267ec5[_0x3abbda][_0x4ae82b][_0x5fbc('0x3')]));break;case 0xa:_0x5d48ca[_0x44bdc3](util[_0x5fbc('0x19')](_0x5fbc('0x2c'),_0x267ec5[_0x3abbda][_0x4ae82b][_0x5fbc('0x3')]));break;}}}}})[_0x5fbc('0xa')](function(){if(_0x44bdc3===_0x5fbc('0x49')){var _0xad31a2=_[_0x5fbc('0x16')](_0x49b0ba[_0x5fbc('0x21')],'id');return _0x49b0ba[_0x5fbc('0x4a')](_0xad31a2)[_0x5fbc('0xa')](function(){for(var _0x171552=0x0;_0x171552<_0xad31a2[_0x5fbc('0x1c')];_0x171552+=0x1){_0x5a1c71[_0x5fbc('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0xad31a2[_0x171552]),'UserId':Number(_0x49b0ba['id'])});}});}})[_0x5fbc('0xa')](function(){if(_0x44bdc3===_0x5fbc('0x49')){var _0x8993e0=_[_0x5fbc('0x16')](_0x49b0ba['MailInteractions'],'id');return _0x49b0ba['removeMailInteractions'](_0x8993e0)[_0x5fbc('0xa')](function(){for(var _0x3f4b7b=0x0;_0x3f4b7b<_0x8993e0[_0x5fbc('0x1c')];_0x3f4b7b+=0x1){_0x5a1c71[_0x5fbc('0x4b')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x8993e0[_0x3f4b7b]),'UserId':Number(_0x49b0ba['id'])});}});}})[_0x5fbc('0xa')](function(){if(_0x44bdc3===_0x5fbc('0x49')){var _0x3ac2c1=_['map'](_0x49b0ba[_0x5fbc('0x25')],'id');return _0x49b0ba[_0x5fbc('0x4c')](_0x3ac2c1)[_0x5fbc('0xa')](function(){for(var _0x5bf16e=0x0;_0x5bf16e<_0x3ac2c1[_0x5fbc('0x1c')];_0x5bf16e+=0x1){_0x5a1c71['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3ac2c1[_0x5bf16e]),'UserId':Number(_0x49b0ba['id'])});}});}})[_0x5fbc('0xa')](function(){if(_0x44bdc3===_0x5fbc('0x49')){var _0x4044ab=_[_0x5fbc('0x16')](_0x49b0ba['SmsInteractions'],'id');return _0x49b0ba['removeSmsInteractions'](_0x4044ab)[_0x5fbc('0xa')](function(){for(var _0x1dbaa7=0x0;_0x1dbaa7<_0x4044ab[_0x5fbc('0x1c')];_0x1dbaa7+=0x1){_0x5a1c71[_0x5fbc('0x4b')](_0x5fbc('0x4d'),{'SmsInteractionId':Number(_0x4044ab[_0x1dbaa7]),'UserId':Number(_0x49b0ba['id'])});}});}})['then'](function(){if(_0x44bdc3===_0x5fbc('0x49')){var _0x5384e3=_[_0x5fbc('0x16')](_0x49b0ba[_0x5fbc('0x29')],'id');return _0x49b0ba[_0x5fbc('0x4e')](_0x5384e3)[_0x5fbc('0xa')](function(){for(var _0x26eed3=0x0;_0x26eed3<_0x5384e3[_0x5fbc('0x1c')];_0x26eed3+=0x1){_0x5a1c71[_0x5fbc('0x4b')](_0x5fbc('0x4f'),{'OpenchannelInteractionId':Number(_0x5384e3[_0x26eed3]),'UserId':Number(_0x49b0ba['id'])});}});}})['then'](function(){if(_0x44bdc3===_0x5fbc('0x49')){var _0x4a0cf2=_['map'](_0x49b0ba[_0x5fbc('0x2b')],'id');return _0x49b0ba[_0x5fbc('0x50')](_0x4a0cf2)['then'](function(){for(var _0xf57d4=0x0;_0xf57d4<_0x4a0cf2['length'];_0xf57d4+=0x1){_0x5a1c71[_0x5fbc('0x4b')](_0x5fbc('0x51'),{'WhatsappInteractionId':Number(_0x4a0cf2[_0xf57d4]),'UserId':Number(_0x49b0ba['id'])});}});}})[_0x5fbc('0x52')](function(_0x167c43){_0x5d48ca[_0x5fbc('0x53')](_0x167c43);});}}function onDisconnect(_0x193b73,_0x248d75){joinOrLeave(_0x193b73,_0x5fbc('0x49'),_0x248d75);}function onConnect(_0x14d174){joinOrLeave(_0x14d174,_0x5fbc('0x54'));}exports['default']=function(_0x19a54e){_0x19a54e['on']('connection',function(_0x4868a6){_0x4868a6[_0x5fbc('0x55')](0x0);_0x4868a6[_0x5fbc('0x56')]=_0x4868a6['request'][_0x5fbc('0x57')][_0x5fbc('0x58')]+':'+_0x4868a6[_0x5fbc('0x59')]['connection'][_0x5fbc('0x5a')];_0x4868a6[_0x5fbc('0x5b')]=new Date();_0x4868a6[_0x5fbc('0x53')]=function(_0x489a50){console[_0x5fbc('0x53')]('SocketIO\x20'+_0x4868a6[_0x5fbc('0x5c')][_0x5fbc('0x3')]+'['+_0x4868a6[_0x5fbc('0x56')]+']',_0x489a50);};_0x4868a6['on'](_0x5fbc('0x5d'),function(){onDisconnect(_0x4868a6,_0x19a54e);_0x4868a6[_0x5fbc('0x53')]('DISCONNECTED');});onConnect(_0x4868a6);_0x4868a6['log']('CONNECTED');});}; \ No newline at end of file +var _0x6c45=['ivr','UserProfileSection','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','FaxQueue','Telephones','Campaign','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type'];(function(_0x3a31c3,_0x4b2e4d){var _0x1ec91b=function(_0x2b1817){while(--_0x2b1817){_0x3a31c3['push'](_0x3a31c3['shift']());}};_0x1ec91b(++_0x4b2e4d);}(_0x6c45,0xb1));var _0x56c4=function(_0x44eabf,_0x54e76d){_0x44eabf=_0x44eabf-0x0;var _0x347810=_0x6c45[_0x44eabf];return _0x347810;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var BPromise=require('bluebird');var db=require(_0x56c4('0x2'))['db'];var config=require(_0x56c4('0x3'));var queryQueues={'attributes':['id',_0x56c4('0x4')],'include':[{'as':_0x56c4('0x5'),'model':db[_0x56c4('0x6')],'attributes':['id',_0x56c4('0x4'),_0x56c4('0x7')],'raw':!![],'where':{'role':_0x56c4('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x56c4('0x4')],'where':{'role':_0x56c4('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x56c4('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x56c4('0x4')],'where':{'role':_0x56c4('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x56c4('0x4'),_0x56c4('0xa')],'where':{'type':_0x56c4('0xb')}};function getAssociatedResources(_0x13b767,_0x1f1f27,_0x2052f5){return db[_0x56c4('0xc')]['findOne']({'where':{'name':_0x13b767,'userProfileId':_0x1f1f27},'raw':!![]})[_0x56c4('0xd')](function(_0x10feed){if(_0x10feed){if(_0x10feed[_0x56c4('0xe')]){switch(_0x13b767){case _0x56c4('0xf'):case'ChatQueues':case _0x56c4('0x10'):case _0x56c4('0x11'):case _0x56c4('0x12'):case _0x56c4('0x13'):case'WhatsappQueues':return db[_0x2052f5][_0x56c4('0x14')](queryQueues);case'Telephones':return db[_0x2052f5]['findAll'](queryTelephones);case _0x56c4('0x15'):return db[_0x2052f5][_0x56c4('0x14')](queryTrunks);case _0x56c4('0x16'):return db[_0x2052f5][_0x56c4('0x14')](queryCampaigns);}}else{return db[_0x56c4('0x17')]['findAll']({'attributes':[_0x56c4('0x18')],'where':{'sectionId':_0x10feed['id']},'raw':!![]})[_0x56c4('0xd')](function(_0x533968){if(_0x533968){var _0x9b7664={'where':{'id':_[_0x56c4('0x19')](_0x533968,_0x56c4('0x18'))},'raw':!![]};switch(_0x2052f5){case _0x56c4('0x6'):_0x9b7664['where'][_0x56c4('0x7')]=_0x56c4('0x9');break;case'Campaign':_0x9b7664[_0x56c4('0x1a')][_0x56c4('0xa')]=_0x56c4('0xb');break;}return db[_0x2052f5][_0x56c4('0x14')](_0x9b7664);}else{return[];}});}}else{return[];}})['then'](function(_0x100a6e){return _0x100a6e;});}function joinOrLeaveQueues(_0xd696d7,_0x279a1e,_0x7a7612,_0x35108){_0xd696d7[_0x279a1e](util[_0x56c4('0x1b')]('%s:queue:%s',_0x7a7612,_0x35108['name']));if(_0x35108[_0x56c4('0x5')]){for(var _0x42f996=0x0;_0x42f996<_0x35108['Agents'][_0x56c4('0x1c')];_0x42f996+=0x1){_0xd696d7[_0x279a1e](util[_0x56c4('0x1b')](_0x56c4('0x1d'),_0x35108[_0x56c4('0x5')][_0x42f996][_0x56c4('0x4')]));}}}function joinOrLeave(_0x2e51e2,_0xc130d6,_0x47e8d8){var _0x1313a4;if(_0x2e51e2[_0x56c4('0x1e')][_0x56c4('0x1f')]['id']){db['User'][_0x56c4('0x20')]({'attributes':['id','name',_0x56c4('0x7'),_0x56c4('0x21')],'where':{'id':_0x2e51e2['handshake'][_0x56c4('0x1f')]['id']},'include':[{'model':db[_0x56c4('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x56c4('0x23')],'as':_0x56c4('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x56c4('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x56c4('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x56c4('0x27'),'attributes':['id'],'raw':!![]}]})[_0x56c4('0xd')](function(_0x45f4ee){if(_0x45f4ee){_0x1313a4=_0x45f4ee;_0x2e51e2[_0xc130d6](util[_0x56c4('0x1b')](_0x56c4('0x1d'),_0x45f4ee[_0x56c4('0x4')]));var _0x49f0c2=[];switch(_0x45f4ee[_0x56c4('0x7')]){case'admin':_0x2e51e2[_0xc130d6](_0x56c4('0x28'));_0x2e51e2[_0xc130d6](_0x56c4('0x29'));if(queryQueues[_0x56c4('0x2a')]('include')){delete queryQueues[_0x56c4('0x2b')];}_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x2d')]['findAll'](queryQueues));_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x2e')]['findAll'](queryQueues));_0x49f0c2[_0x56c4('0x2c')](db['FaxQueue'][_0x56c4('0x14')](queryQueues));_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x2f')][_0x56c4('0x14')](queryQueues));_0x49f0c2[_0x56c4('0x2c')](db['MailQueue']['findAll'](queryQueues));_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x30')][_0x56c4('0x14')](queryQueues));_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x31')]['findAll'](queryQueues));_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x6')][_0x56c4('0x14')](queryTelephones));_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x32')][_0x56c4('0x14')](queryTrunks));_0x49f0c2[_0x56c4('0x2c')](db['Campaign']['findAll'](queryCampaigns));_0x49f0c2[_0x56c4('0x2c')](db[_0x56c4('0x6')][_0x56c4('0x14')](queryAgents));break;case _0x56c4('0x33'):_0x2e51e2[_0xc130d6](_0x56c4('0x28'));_0x2e51e2[_0xc130d6]('voice:outbound');_0x49f0c2['push'](getAssociatedResources(_0x56c4('0xf'),_0x45f4ee['userProfileId'],_0x56c4('0x2d')));_0x49f0c2[_0x56c4('0x2c')](getAssociatedResources(_0x56c4('0x34'),_0x45f4ee[_0x56c4('0x21')],'ChatQueue'));_0x49f0c2[_0x56c4('0x2c')](getAssociatedResources(_0x56c4('0x10'),_0x45f4ee[_0x56c4('0x21')],_0x56c4('0x35')));_0x49f0c2[_0x56c4('0x2c')](getAssociatedResources(_0x56c4('0x11'),_0x45f4ee[_0x56c4('0x21')],'SmsQueue'));_0x49f0c2['push'](getAssociatedResources(_0x56c4('0x12'),_0x45f4ee[_0x56c4('0x21')],'MailQueue'));_0x49f0c2[_0x56c4('0x2c')](getAssociatedResources(_0x56c4('0x13'),_0x45f4ee['userProfileId'],_0x56c4('0x30')));_0x49f0c2[_0x56c4('0x2c')](getAssociatedResources('WhatsappQueues',_0x45f4ee['userProfileId'],_0x56c4('0x31')));_0x49f0c2[_0x56c4('0x2c')](getAssociatedResources(_0x56c4('0x36'),_0x45f4ee[_0x56c4('0x21')],'User'));_0x49f0c2['push'](getAssociatedResources('Trunks',_0x45f4ee[_0x56c4('0x21')],_0x56c4('0x32')));_0x49f0c2[_0x56c4('0x2c')](getAssociatedResources('IvrCampaigns',_0x45f4ee[_0x56c4('0x21')],_0x56c4('0x37')));_0x49f0c2['push'](db[_0x56c4('0x6')][_0x56c4('0x14')](queryAgents));break;case _0x56c4('0x8'):_0x2e51e2[_0xc130d6](_0x56c4('0x28'));_0x2e51e2[_0xc130d6](_0x56c4('0x29'));_0x49f0c2[_0x56c4('0x2c')](_0x45f4ee[_0x56c4('0x38')]({'attributes':['id','name']}));_0x49f0c2['push'](_0x45f4ee[_0x56c4('0x39')]({'attributes':['id','name']}));_0x49f0c2['push'](_0x45f4ee[_0x56c4('0x3a')]({'attributes':['id','name']}));_0x49f0c2[_0x56c4('0x2c')](_0x45f4ee[_0x56c4('0x3b')]({'attributes':['id',_0x56c4('0x4')]}));_0x49f0c2[_0x56c4('0x2c')](_0x45f4ee['getMailQueues']({'attributes':['id',_0x56c4('0x4')]}));_0x49f0c2[_0x56c4('0x2c')](_0x45f4ee['getOpenchannelQueues']({'attributes':['id','name']}));_0x49f0c2['push'](_0x45f4ee['getWhatsappQueues']({'attributes':['id',_0x56c4('0x4')]}));break;}return BPromise['all'](_0x49f0c2);}})[_0x56c4('0xd')](function(_0x49b0af){if(_0x49b0af&&_0x49b0af[_0x56c4('0x1c')]){for(var _0x5f4c90=0x0;_0x5f4c90<_0x49b0af[_0x56c4('0x1c')];_0x5f4c90+=0x1){for(var _0x593a2d=0x0;_0x593a2d<_0x49b0af[_0x5f4c90][_0x56c4('0x1c')];_0x593a2d+=0x1){switch(_0x5f4c90){case 0x0:joinOrLeaveQueues(_0x2e51e2,_0xc130d6,'voice',_0x49b0af[_0x5f4c90][_0x593a2d]);break;case 0x1:joinOrLeaveQueues(_0x2e51e2,_0xc130d6,'chat',_0x49b0af[_0x5f4c90][_0x593a2d]);break;case 0x2:joinOrLeaveQueues(_0x2e51e2,_0xc130d6,_0x56c4('0x3c'),_0x49b0af[_0x5f4c90][_0x593a2d]);break;case 0x3:joinOrLeaveQueues(_0x2e51e2,_0xc130d6,_0x56c4('0x3d'),_0x49b0af[_0x5f4c90][_0x593a2d]);break;case 0x4:joinOrLeaveQueues(_0x2e51e2,_0xc130d6,_0x56c4('0x3e'),_0x49b0af[_0x5f4c90][_0x593a2d]);break;case 0x5:joinOrLeaveQueues(_0x2e51e2,_0xc130d6,_0x56c4('0x3f'),_0x49b0af[_0x5f4c90][_0x593a2d]);break;case 0x6:joinOrLeaveQueues(_0x2e51e2,_0xc130d6,_0x56c4('0x40'),_0x49b0af[_0x5f4c90][_0x593a2d]);break;case 0x7:if(_0x1313a4[_0x56c4('0x7')]!=='agent')_0x2e51e2[_0xc130d6](util[_0x56c4('0x1b')](_0x56c4('0x41'),_0x49b0af[_0x5f4c90][_0x593a2d][_0x56c4('0x4')]));break;case 0x8:if(_0x1313a4[_0x56c4('0x7')]!==_0x56c4('0x8'))_0x2e51e2[_0xc130d6](util[_0x56c4('0x1b')](_0x56c4('0x42'),_0x49b0af[_0x5f4c90][_0x593a2d][_0x56c4('0x4')]));break;case 0x9:if(_0x1313a4['role']!==_0x56c4('0x8'))_0x2e51e2[_0xc130d6](util[_0x56c4('0x1b')]('campaign:%s:%s',_0x49b0af[_0x5f4c90][_0x593a2d][_0x56c4('0xa')],_0x49b0af[_0x5f4c90][_0x593a2d][_0x56c4('0x4')]));break;case 0xa:_0x2e51e2[_0xc130d6](util['format'](_0x56c4('0x1d'),_0x49b0af[_0x5f4c90][_0x593a2d][_0x56c4('0x4')]));break;}}}}})[_0x56c4('0xd')](function(){if(_0xc130d6===_0x56c4('0x43')){var _0x68dbe=_['map'](_0x1313a4[_0x56c4('0x44')],'id');return _0x1313a4['removeChatInteractions'](_0x68dbe)[_0x56c4('0xd')](function(){for(var _0x148028=0x0;_0x148028<_0x68dbe['length'];_0x148028+=0x1){_0x47e8d8[_0x56c4('0x45')](_0x56c4('0x46'),{'ChatInteractionId':Number(_0x68dbe[_0x148028]),'UserId':Number(_0x1313a4['id'])});}});}})[_0x56c4('0xd')](function(){if(_0xc130d6==='leave'){var _0x3578f5=_[_0x56c4('0x19')](_0x1313a4[_0x56c4('0x47')],'id');return _0x1313a4['removeMailInteractions'](_0x3578f5)['then'](function(){for(var _0x42545d=0x0;_0x42545d<_0x3578f5[_0x56c4('0x1c')];_0x42545d+=0x1){_0x47e8d8['emit'](_0x56c4('0x48'),{'MailInteractionId':Number(_0x3578f5[_0x42545d]),'UserId':Number(_0x1313a4['id'])});}});}})[_0x56c4('0xd')](function(){if(_0xc130d6===_0x56c4('0x43')){var _0x1d320a=_['map'](_0x1313a4[_0x56c4('0x24')],'id');return _0x1313a4[_0x56c4('0x49')](_0x1d320a)[_0x56c4('0xd')](function(){for(var _0x15981c=0x0;_0x15981c<_0x1d320a['length'];_0x15981c+=0x1){_0x47e8d8[_0x56c4('0x45')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1d320a[_0x15981c]),'UserId':Number(_0x1313a4['id'])});}});}})[_0x56c4('0xd')](function(){if(_0xc130d6===_0x56c4('0x43')){var _0x57c0b3=_[_0x56c4('0x19')](_0x1313a4[_0x56c4('0x4a')],'id');return _0x1313a4['removeSmsInteractions'](_0x57c0b3)['then'](function(){for(var _0x16fc48=0x0;_0x16fc48<_0x57c0b3[_0x56c4('0x1c')];_0x16fc48+=0x1){_0x47e8d8['emit'](_0x56c4('0x4b'),{'SmsInteractionId':Number(_0x57c0b3[_0x16fc48]),'UserId':Number(_0x1313a4['id'])});}});}})[_0x56c4('0xd')](function(){if(_0xc130d6===_0x56c4('0x43')){var _0x31bcb3=_[_0x56c4('0x19')](_0x1313a4[_0x56c4('0x4c')],'id');return _0x1313a4[_0x56c4('0x4d')](_0x31bcb3)[_0x56c4('0xd')](function(){for(var _0x2d1f86=0x0;_0x2d1f86<_0x31bcb3[_0x56c4('0x1c')];_0x2d1f86+=0x1){_0x47e8d8['emit'](_0x56c4('0x4e'),{'OpenchannelInteractionId':Number(_0x31bcb3[_0x2d1f86]),'UserId':Number(_0x1313a4['id'])});}});}})[_0x56c4('0xd')](function(){if(_0xc130d6===_0x56c4('0x43')){var _0x1942fe=_[_0x56c4('0x19')](_0x1313a4[_0x56c4('0x27')],'id');return _0x1313a4[_0x56c4('0x4f')](_0x1942fe)[_0x56c4('0xd')](function(){for(var _0x3b6170=0x0;_0x3b6170<_0x1942fe[_0x56c4('0x1c')];_0x3b6170+=0x1){_0x47e8d8['emit'](_0x56c4('0x50'),{'WhatsappInteractionId':Number(_0x1942fe[_0x3b6170]),'UserId':Number(_0x1313a4['id'])});}});}})[_0x56c4('0x51')](function(_0x39e86f){_0x2e51e2['log'](_0x39e86f);});}}function onDisconnect(_0x456ff6,_0x513b16){joinOrLeave(_0x456ff6,_0x56c4('0x43'),_0x513b16);}function onConnect(_0x25e870){joinOrLeave(_0x25e870,_0x56c4('0x52'));}exports[_0x56c4('0x53')]=function(_0x1d3760){_0x1d3760['on'](_0x56c4('0x54'),function(_0x2ac7f2){_0x2ac7f2[_0x56c4('0x55')](0x0);_0x2ac7f2[_0x56c4('0x56')]=_0x2ac7f2['request'][_0x56c4('0x54')]['remoteAddress']+':'+_0x2ac7f2['request'][_0x56c4('0x54')][_0x56c4('0x57')];_0x2ac7f2['connectedAt']=new Date();_0x2ac7f2[_0x56c4('0x58')]=function(_0x4a2cae){console['log'](_0x56c4('0x59')+_0x2ac7f2[_0x56c4('0x5a')]['name']+'['+_0x2ac7f2[_0x56c4('0x56')]+']',_0x4a2cae);};_0x2ac7f2['on'](_0x56c4('0x5b'),function(){onDisconnect(_0x2ac7f2,_0x1d3760);_0x2ac7f2[_0x56c4('0x58')](_0x56c4('0x5c'));});onConnect(_0x2ac7f2);_0x2ac7f2[_0x56c4('0x58')](_0x56c4('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 182c761..8aa160c 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 _0x65d9=['OpenchannelInteraction','request','then','Trigger,\x20%s','EventManager','error','code','catch','channel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','interface','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','motionChannel','offlineMessage','opened','resolve','QueryTypes','SELECT','contact','UserId','format','changed','closed','substatus','AfterUpdate','User','find','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','triggers','client','http','Chat','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel'];(function(_0x2caf8c,_0x269288){var _0x3ca0cd=function(_0x320cdb){while(--_0x320cdb){_0x2caf8c['push'](_0x2caf8c['shift']());}};_0x3ca0cd(++_0x269288);}(_0x65d9,0x1a3));var _0x965d=function(_0x5b2cd0,_0x5cf73a){_0x5b2cd0=_0x5b2cd0-0x0;var _0x59e6f1=_0x65d9[_0x5b2cd0];return _0x59e6f1;};'use strict';var util=require(_0x965d('0x0'));var db=require(_0x965d('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x965d('0x2'));var client=jayson[_0x965d('0x3')][_0x965d('0x4')]({'port':0x232a});var triggers=[{'channel':_0x965d('0x5'),'model':'ChatInteraction','event':_0x965d('0x6'),'condition':_0x965d('0x7'),'callback':afterCreate},{'channel':_0x965d('0x5'),'model':'ChatInteraction','event':_0x965d('0x8'),'condition':_0x965d('0x9'),'callback':afterUpdate},{'channel':_0x965d('0x5'),'model':_0x965d('0xa'),'event':_0x965d('0x6'),'condition':_0x965d('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x965d('0xc'),'event':_0x965d('0x6'),'condition':_0x965d('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x965d('0xd'),'model':'SmsInteraction','event':_0x965d('0x6'),'condition':_0x965d('0x7'),'callback':afterCreate},{'channel':_0x965d('0xd'),'model':_0x965d('0xe'),'event':_0x965d('0x8'),'condition':_0x965d('0x9'),'callback':afterUpdate},{'channel':_0x965d('0xd'),'model':_0x965d('0xf'),'event':_0x965d('0x6'),'condition':_0x965d('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x965d('0x10'),'event':_0x965d('0x6'),'condition':_0x965d('0x7'),'callback':afterCreate},{'channel':_0x965d('0x11'),'model':_0x965d('0x10'),'event':'afterUpdate','condition':_0x965d('0x9'),'callback':afterUpdate},{'channel':_0x965d('0x11'),'model':_0x965d('0x12'),'event':_0x965d('0x6'),'condition':_0x965d('0xb'),'callback':afterCreateMessage},{'channel':_0x965d('0x13'),'model':'FaxInteraction','event':_0x965d('0x6'),'condition':_0x965d('0x7'),'callback':afterCreate},{'channel':_0x965d('0x13'),'model':_0x965d('0x14'),'event':_0x965d('0x8'),'condition':_0x965d('0x9'),'callback':afterUpdate},{'channel':_0x965d('0x13'),'model':_0x965d('0x15'),'event':_0x965d('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x965d('0x16'),'event':'afterCreate','condition':_0x965d('0x7'),'callback':afterCreate},{'channel':_0x965d('0x17'),'model':_0x965d('0x16'),'event':_0x965d('0x8'),'condition':_0x965d('0x9'),'callback':afterUpdate},{'channel':_0x965d('0x17'),'model':'MailMessage','event':_0x965d('0x6'),'condition':_0x965d('0xb'),'callback':afterCreateMessage},{'channel':_0x965d('0x18'),'model':_0x965d('0x19'),'event':_0x965d('0x6'),'condition':_0x965d('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0x965d('0x19'),'event':_0x965d('0x8'),'condition':_0x965d('0x9'),'callback':afterUpdate},{'channel':_0x965d('0x18'),'model':'OpenchannelMessage','event':_0x965d('0x6'),'condition':_0x965d('0xb'),'callback':afterCreateMessage}];function request(_0x3c917b){return client[_0x965d('0x1a')]('EventManager',_0x3c917b)[_0x965d('0x1b')](function(_0x127e9a){logger['info'](_0x965d('0x1c'),_0x965d('0x1d'),_0x127e9a);if(_0x127e9a['error']){if(_0x127e9a[_0x965d('0x1e')][_0x965d('0x1f')]===0x1f4){logger[_0x965d('0x1e')](_0x965d('0x1c'),'EventManager',_0x127e9a[_0x965d('0x1e')]);}}})[_0x965d('0x20')](function(_0xdc38a5){logger[_0x965d('0x1e')](_0x965d('0x1c'),_0x965d('0x1d'),_0xdc38a5);});}function afterCreateMessage(_0x37dc24){return function(_0x43cf21){_0x43cf21=_0x43cf21['get']({'plain':!![]});_0x43cf21[_0x965d('0x21')]=_0x37dc24;_0x43cf21['motionChannel']=_0x37dc24;_0x43cf21[_0x965d('0x22')]=_0x43cf21[_0x965d('0x23')];Promise['resolve']()[_0x965d('0x1b')](function(){if(typeof _0x43cf21[_0x965d('0x24')]===_0x965d('0x25'))return null;var _0x17c70b=_0x965d('0x26')+_0x43cf21[_0x965d('0x24')];return db[_0x965d('0x27')][_0x965d('0x28')](_0x17c70b,{'type':db[_0x965d('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x965d('0x1b')](function(_0x21ebca){if(_0x21ebca){_0x43cf21['contact']=_0x21ebca[0x0];}if(typeof _0x43cf21['UserId']===_0x965d('0x25'))return;return getAgent(_0x43cf21['UserId']);})['then'](function(_0x13a1e3){if(_0x13a1e3){_0x43cf21[_0x965d('0x2a')]=util['format'](_0x965d('0x2b'),_0x13a1e3[_0x965d('0x2c')]);_0x43cf21[_0x965d('0x2d')]=_0x13a1e3;_0x43cf21['channel']=_0x37dc24;return request({'event':_0x965d('0x2e'),'message':_0x43cf21});}else{return request({'event':_0x965d('0x2f'),'message':_0x43cf21});}})[_0x965d('0x20')](function(_0x6453e6){logger[_0x965d('0x1e')](_0x965d('0x1c'),_0x965d('0x30'),_0x6453e6);});};}function afterCreateOfflineMessage(_0x5ba291){return function(_0x4fa08d){_0x4fa08d=_0x4fa08d[_0x965d('0x31')]({'plain':!![]});_0x4fa08d[_0x965d('0x21')]=_0x5ba291;_0x4fa08d[_0x965d('0x32')]=_0x5ba291;_0x4fa08d[_0x965d('0x22')]=_0x965d('0x33');return request({'event':_0x4fa08d[_0x965d('0x22')],'message':_0x4fa08d});};}function afterCreate(_0x15facd,_0x552430){return function(_0xe9fbf6){_0xe9fbf6=_0xe9fbf6['get']({'plain':!![]});_0xe9fbf6[_0x965d('0x21')]=_0x15facd;_0xe9fbf6['motionChannel']=_0x15facd;_0xe9fbf6[_0x965d('0x22')]=_0x965d('0x34');Promise[_0x965d('0x35')]()['then'](function(){var _0x5978db=_0x965d('0x26')+_0xe9fbf6[_0x965d('0x24')];return db['sequelize']['query'](_0x5978db,{'type':db[_0x965d('0x29')][_0x965d('0x36')][_0x965d('0x37')],'raw':!![]});})[_0x965d('0x1b')](function(_0x25738c){if(_0x25738c){_0xe9fbf6[_0x965d('0x38')]=_0x25738c[0x0];}if(typeof _0xe9fbf6[_0x965d('0x39')]===_0x965d('0x25'))return;return getAgent(_0xe9fbf6[_0x965d('0x39')]);})[_0x965d('0x1b')](function(_0x506622){if(_0x506622){_0xe9fbf6[_0x965d('0x2a')]=util[_0x965d('0x3a')](_0x965d('0x2b'),_0x506622[_0x965d('0x2c')]);_0xe9fbf6[_0x965d('0x2d')]=_0x506622;}return request({'event':_0x552430,'message':_0xe9fbf6});})[_0x965d('0x20')](function(_0x373c6d){logger[_0x965d('0x1e')](_0x965d('0x1c'),'AfterCreate',_0x373c6d);});};}function afterUpdate(_0x9d18f5){return function(_0x20752a){var _0x5c9bb9=_0x20752a[_0x965d('0x3b')]('closed')&&_0x20752a[_0x965d('0x3c')];var _0x4df776=_0x20752a[_0x965d('0x3b')]('substatus');if(_0x5c9bb9||_0x4df776){var _0x1d960a=_0x5c9bb9?_0x965d('0x9'):_0x965d('0x3d');var _0x11f4f4=_0x20752a['get']({'plain':!![]});_0x11f4f4[_0x965d('0x21')]=_0x9d18f5;_0x11f4f4[_0x965d('0x32')]=_0x9d18f5;_0x11f4f4[_0x965d('0x22')]=_0x5c9bb9?'closed':_0x965d('0x3d');var _0x5d8750='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x11f4f4[_0x965d('0x24')];return db[_0x965d('0x27')]['query'](_0x5d8750,{'type':db['Sequelize'][_0x965d('0x36')][_0x965d('0x37')],'raw':!![]})[_0x965d('0x1b')](function(_0x3f583f){if(_0x3f583f){_0x11f4f4[_0x965d('0x38')]=_0x3f583f[0x0];}if(typeof _0x11f4f4['UserId']===_0x965d('0x25'))return;return getAgent(_0x11f4f4[_0x965d('0x39')]);})[_0x965d('0x1b')](function(_0x5e5d81){if(_0x5e5d81){_0x11f4f4['interface']=util['format'](_0x965d('0x2b'),_0x5e5d81[_0x965d('0x2c')]);_0x11f4f4[_0x965d('0x2d')]=_0x5e5d81;}return request({'event':_0x1d960a,'message':_0x11f4f4});})[_0x965d('0x20')](function(_0x130987){logger['error'](_0x965d('0x1c'),_0x965d('0x3e'),_0x130987);});}};}function getAgent(_0x7dd3e9){return db[_0x965d('0x3f')][_0x965d('0x40')]({'where':{'id':_0x7dd3e9},'attributes':['id','name','fullname','email',_0x965d('0x41')],'raw':!![]})[_0x965d('0x1b')](function(_0x1614bd){return _0x1614bd;});}exports[_0x965d('0x42')]=function(){for(var _0x150f05=0x0;_0x150f05=_0x4609cd[_0x2e1d('0x12')]){throw Error(_0x2e1d('0x13'));}_0x42620e(_0x2b45e0);})[_0x2e1d('0x14')](function(_0x31f455){_0x2f1d22(_0x31f455);});});}; \ No newline at end of file +var _0xd7ba=['toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','agents','catch','lodash','bluebird','./license/util','voice','mail','chat','sms','whatsapp','openchannel'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0xd7ba,0xe9));var _0xad7b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd7ba[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xad7b('0x0'));var BPromise=require(_0xad7b('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xad7b('0x2'));var channels=[_0xad7b('0x3'),_0xad7b('0x4'),_0xad7b('0x5'),'fax',_0xad7b('0x6'),_0xad7b('0x7'),_0xad7b('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x26d45f){_0x26d45f=_0x26d45f[_0xad7b('0x9')]();return _[_0xad7b('0xa')](channels,_0x26d45f);};exports[_0xad7b('0xb')]=function(_0x174536,_0x3c36b6,_0x3c3222,_0x3d0361){var _0xec1139={'loginAttempts':_0x3c36b6,'blocked':_0x3c3222};if(!_[_0xad7b('0xc')](_0x3d0361)){_0xec1139[_0xad7b('0xd')]=_0x3d0361;}return _0x174536[_0xad7b('0xe')](_0xec1139);};exports[_0xad7b('0xf')]=function(_0x433427){return new BPromise(function(_0x47c238,_0x3b0550){var _0x388c0d=0x0;if(_0x433427[_0xad7b('0x10')]!==_0xad7b('0x11')){_0x47c238(_0x433427);}db[_0xad7b('0x12')]['count']({'where':{'role':_0xad7b('0x11'),'online':!![],'id':{'$ne':_0x433427['id']}}})['then'](function(_0x508a53){_0x388c0d=_0x508a53;return util[_0xad7b('0xf')]();})[_0xad7b('0x13')](function(_0x226f9c){if(_0x226f9c&&_0x226f9c[_0xad7b('0x14')]&&_0x388c0d>=_0x226f9c['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x47c238(_0x433427);})[_0xad7b('0x15')](function(_0x10c3ba){_0x3b0550(_0x10c3ba);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index df0c158..93d7c8d 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(_0x2d5243,_0x5ee6ee){var _0xb10a4c=function(_0x10bb8d){while(--_0x10bb8d){_0x2d5243['push'](_0x2d5243['shift']());}};_0xb10a4c(++_0x5ee6ee);}(_0xaa88,0x137));var _0x8aa8=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0xaa88[_0x60df74];return _0x5ee872;};'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 _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x14f99b,_0x488ed9){var _0x2d531f=function(_0x272864){while(--_0x272864){_0x14f99b['push'](_0x14f99b['shift']());}};_0x2d531f(++_0x488ed9);}(_0x91a7,0xe7));var _0x791a=function(_0x2f33aa,_0x3cfb56){_0x2f33aa=_0x2f33aa-0x0;var _0xe80bf9=_0x91a7[_0x2f33aa];return _0xe80bf9;};'use strict';var util=require('util');var logger=require(_0x791a('0x0'))(_0x791a('0x1'));var APIError=function(_0x268862,_0x5d2796){this[_0x791a('0x2')]=_0x268862||'Internal\x20Server\x20Error';this[_0x791a('0x3')]=_0x5d2796||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x32fe2b){this[_0x791a('0x2')]=_0x32fe2b||'Bad\x20Request';this[_0x791a('0x3')]='Bad\x20Request';util[_0x791a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x159e24){this['message']=_0x159e24||_0x791a('0x5');this[_0x791a('0x3')]=_0x791a('0x6');util[_0x791a('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x266e4b){switch(_0x266e4b){case'Bad\x20Request':return 0x190;case _0x791a('0x7'),_0x791a('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2bd26a){return function(_0x206eea){logger[_0x791a('0x9')](_0x206eea[_0x791a('0xa')]);var _0x2805c9=getStatusCode(_0x206eea[_0x791a('0x3')]);if(_0x206eea['name'])delete _0x206eea['name'];return _0x2bd26a[_0x791a('0xb')](_0x2805c9)[_0x791a('0xc')](_0x206eea);};}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 1466e90..c9a9032 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57f5=['render','404','status'];(function(_0x49cff3,_0xf315b7){var _0x3fb1b2=function(_0x377d0c){while(--_0x377d0c){_0x49cff3['push'](_0x49cff3['shift']());}};_0x3fb1b2(++_0xf315b7);}(_0x57f5,0x1e7));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';module['exports'][0x194]=function pageNotFound(_0x189d9d,_0x2ba223){var _0x39f042=_0x557f('0x0');var _0x55b1d3=0x194;var _0x13eca3={'status':_0x55b1d3};_0x2ba223['status'](_0x13eca3[_0x557f('0x1')]);_0x2ba223[_0x557f('0x2')](_0x39f042,{},function(_0x2e75b7,_0x5639f5){if(_0x2e75b7){return _0x2ba223[_0x557f('0x1')](_0x13eca3[_0x557f('0x1')])['json'](_0x13eca3);}_0x2ba223['send'](_0x5639f5);});}; \ No newline at end of file +var _0x7072=['send','status','render'];(function(_0x82057d,_0x3a85f4){var _0x5e9837=function(_0x222a1e){while(--_0x222a1e){_0x82057d['push'](_0x82057d['shift']());}};_0x5e9837(++_0x3a85f4);}(_0x7072,0x8e));var _0x2707=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x7072[_0x22f8ab];return _0x2a70e5;};'use strict';module['exports'][0x194]=function pageNotFound(_0xf8d8e7,_0x29597b){var _0x19691e='404';var _0x3ffb84=0x194;var _0x2efe6b={'status':_0x3ffb84};_0x29597b[_0x2707('0x0')](_0x2efe6b['status']);_0x29597b[_0x2707('0x1')](_0x19691e,{},function(_0x43b8b1,_0x5170a2){if(_0x43b8b1){return _0x29597b[_0x2707('0x0')](_0x2efe6b['status'])['json'](_0x2efe6b);}_0x29597b[_0x2707('0x2')](_0x5170a2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 4e08148..c4a9c92 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(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 a17ecf9..5a9755e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7ef=['./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/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/rpc','./api/rpc','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','get','sendFile','resolve','appPath','/index.html','path','express','./errors','setupLoggers','./api/client-side-logs','default','/api/users','./api/user','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./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/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources'];(function(_0x20a086,_0x15cef2){var _0x379cc3=function(_0xe4c176){while(--_0xe4c176){_0x20a086['push'](_0x20a086['shift']());}};_0x379cc3(++_0x15cef2);}(_0xd7ef,0x13b));var _0xfd7e=function(_0x58dcd4,_0x578309){_0x58dcd4=_0x58dcd4-0x0;var _0xf9c742=_0xd7ef[_0x58dcd4];return _0xf9c742;};'use strict';var path=require(_0xfd7e('0x0'));var express=require(_0xfd7e('0x1'));var errors=require(_0xfd7e('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0xfd7e('0x3')];var clientSideLogs=require(_0xfd7e('0x4'));exports[_0xfd7e('0x5')]=function(_0x219546){return setupLoggers(_0x219546)['then'](function(){_0x219546['use'](_0xfd7e('0x6'),require(_0xfd7e('0x7')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x9'),require('./api/voiceChanSpy'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xa'),require(_0xfd7e('0xb')));_0x219546['use'](_0xfd7e('0xc'),require(_0xfd7e('0xd')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xe'),require('./api/voiceMusicOnHold'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xf'),require('./api/voiceQueue'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x10'),require('./api/voiceRecording'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x11'),require('./api/screenRecording'));_0x219546[_0xfd7e('0x8')]('/api/voice/mails',require(_0xfd7e('0x12')));_0x219546[_0xfd7e('0x8')]('/api/voice/mails/messages',require(_0xfd7e('0x13')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x14'),require(_0xfd7e('0x15')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x16'),require('./api/voiceDialReport'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x17'),require(_0xfd7e('0x18')));_0x219546['use']('/api/voice/queues/reports',require(_0xfd7e('0x19')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x1a'),require(_0xfd7e('0x1b')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x1c'),require(_0xfd7e('0x1d')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x1e'),require(_0xfd7e('0x1f')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x20'),require(_0xfd7e('0x21')));_0x219546['use']('/api/mail/accounts',require(_0xfd7e('0x22')));_0x219546['use'](_0xfd7e('0x23'),require(_0xfd7e('0x24')));_0x219546[_0xfd7e('0x8')]('/api/mail/substatuses',require(_0xfd7e('0x25')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x26'),require('./api/mailInteraction'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x27'),require(_0xfd7e('0x28')));_0x219546['use'](_0xfd7e('0x29'),require(_0xfd7e('0x2a')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x2b'),require('./api/mailQueueReport'));_0x219546['use'](_0xfd7e('0x2c'),require('./api/dashboard'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x2d'),require('./api/dashboardItem'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x2e'),require(_0xfd7e('0x2f')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x30'),require(_0xfd7e('0x31')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x32'),require(_0xfd7e('0x33')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x34'),require(_0xfd7e('0x35')));_0x219546['use'](_0xfd7e('0x36'),require(_0xfd7e('0x37')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x38'),require('./api/faxQueueReport'));_0x219546[_0xfd7e('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x219546['use']('/api/sms/applications',require(_0xfd7e('0x39')));_0x219546['use'](_0xfd7e('0x3a'),require(_0xfd7e('0x3b')));_0x219546['use'](_0xfd7e('0x3c'),require(_0xfd7e('0x3d')));_0x219546['use']('/api/sms/queues',require(_0xfd7e('0x3e')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x3f'),require(_0xfd7e('0x40')));_0x219546[_0xfd7e('0x8')]('/api/openchannel/applications',require(_0xfd7e('0x41')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x42'),require(_0xfd7e('0x43')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x44'),require(_0xfd7e('0x45')));_0x219546['use']('/api/openchannel/queues',require(_0xfd7e('0x46')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x47'),require(_0xfd7e('0x48')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x49'),require(_0xfd7e('0x4a')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x4b'),require(_0xfd7e('0x4c')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x4d'),require(_0xfd7e('0x4e')));_0x219546[_0xfd7e('0x8')]('/api/chat/messages',require(_0xfd7e('0x4f')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x50'),require('./api/chatOfflineMessage'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x51'),require(_0xfd7e('0x52')));_0x219546['use']('/api/chat/groups',require('./api/chatGroup'));_0x219546[_0xfd7e('0x8')]('/api/chat/proactive_actions',require(_0xfd7e('0x53')));_0x219546['use'](_0xfd7e('0x54'),require(_0xfd7e('0x55')));_0x219546['use'](_0xfd7e('0x56'),require(_0xfd7e('0x57')));_0x219546[_0xfd7e('0x8')]('/api/cm/hopper',require('./api/cmHopper'));_0x219546['use'](_0xfd7e('0x58'),require(_0xfd7e('0x59')));_0x219546[_0xfd7e('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x219546['use'](_0xfd7e('0x5a'),require(_0xfd7e('0x5b')));_0x219546[_0xfd7e('0x8')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x5c'),require(_0xfd7e('0x5d')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x5e'),require(_0xfd7e('0x5f')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x60'),require('./api/cannedAnswer'));_0x219546['use'](_0xfd7e('0x61'),require(_0xfd7e('0x62')));_0x219546['use'](_0xfd7e('0x63'),require(_0xfd7e('0x64')));_0x219546['use'](_0xfd7e('0x65'),require('./api/interval'));_0x219546['use'](_0xfd7e('0x66'),require(_0xfd7e('0x67')));_0x219546['use'](_0xfd7e('0x68'),require(_0xfd7e('0x69')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x6a'),require(_0xfd7e('0x6b')));_0x219546[_0xfd7e('0x8')]('/api/schedules',require(_0xfd7e('0x6c')));_0x219546['use']('/api/sounds',require(_0xfd7e('0x6d')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x6e'),require(_0xfd7e('0x6f')));_0x219546[_0xfd7e('0x8')]('/api/contact_item_types',require('./api/contactItemType'));_0x219546[_0xfd7e('0x8')]('/api/cm_contact_has_items',require(_0xfd7e('0x70')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x71'),require('./api/cmHopperAdditionalPhone'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x72'),require(_0xfd7e('0x73')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x74'),require(_0xfd7e('0x75')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x76'),require(_0xfd7e('0x77')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x78'),require(_0xfd7e('0x79')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x7a'),require('./api/integrationReport'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x7b'),require('./api/analyticCustomReport'));_0x219546['use'](_0xfd7e('0x7c'),require(_0xfd7e('0x7d')));_0x219546['use'](_0xfd7e('0x7e'),require('./api/analyticExtractedReport'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x7f'),require('./api/analyticMetric'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x80'),require(_0xfd7e('0x81')));_0x219546['use'](_0xfd7e('0x82'),require(_0xfd7e('0x83')));_0x219546['use'](_0xfd7e('0x84'),require('./api/intSalesforceAccount'));_0x219546[_0xfd7e('0x8')]('/api/integrations/salesforce/configurations',require(_0xfd7e('0x85')));_0x219546['use']('/api/integrations/salesforce/fields',require(_0xfd7e('0x86')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x87'),require('./api/intSugarcrmAccount'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x88'),require(_0xfd7e('0x89')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x8a'),require(_0xfd7e('0x8b')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x8c'),require(_0xfd7e('0x8d')));_0x219546[_0xfd7e('0x8')]('/api/integrations/desk/configurations',require(_0xfd7e('0x8e')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x8f'),require(_0xfd7e('0x90')));_0x219546['use'](_0xfd7e('0x91'),require(_0xfd7e('0x92')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x93'),require(_0xfd7e('0x94')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x95'),require(_0xfd7e('0x96')));_0x219546['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x97'),require(_0xfd7e('0x98')));_0x219546[_0xfd7e('0x8')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x99'),require(_0xfd7e('0x9a')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x9b'),require(_0xfd7e('0x9c')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x9d'),require(_0xfd7e('0x9e')));_0x219546[_0xfd7e('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x219546['use'](_0xfd7e('0x9f'),require(_0xfd7e('0xa0')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xa1'),require('./api/intVtigerField'));_0x219546[_0xfd7e('0x8')]('/api/integrations/servicenow/accounts',require(_0xfd7e('0xa2')));_0x219546[_0xfd7e('0x8')]('/api/integrations/servicenow/configurations',require(_0xfd7e('0xa3')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xa4'),require('./api/intServicenowField'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xa5'),require(_0xfd7e('0xa6')));_0x219546[_0xfd7e('0x8')]('/api/integrations/dynamics365/configurations',require(_0xfd7e('0xa7')));_0x219546['use'](_0xfd7e('0xa8'),require(_0xfd7e('0xa9')));_0x219546[_0xfd7e('0x8')]('/api/integrations/freshsales/accounts',require(_0xfd7e('0xaa')));_0x219546[_0xfd7e('0x8')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xab'),require(_0xfd7e('0xac')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xad'),require('./api/network'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xae'),require(_0xfd7e('0xaf')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xb0'),require(_0xfd7e('0xb1')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xb2'),require(_0xfd7e('0xb3')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xb4'),require('./api/jscriptyQuestionReport'));_0x219546['use'](_0xfd7e('0xb5'),require(_0xfd7e('0xb6')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xb7'),require(_0xfd7e('0xb8')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xb9'),require(_0xfd7e('0xba')));_0x219546[_0xfd7e('0x8')]('/api/square/details/reports',require(_0xfd7e('0xbb')));_0x219546['use'](_0xfd7e('0xbc'),require('./api/jscriptyProject'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xbd'),require(_0xfd7e('0xbe')));_0x219546['use'](_0xfd7e('0xbf'),require(_0xfd7e('0xc0')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xc1'),require(_0xfd7e('0xc2')));_0x219546['use']('/api/square/recordings',require(_0xfd7e('0xc3')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xc4'),require(_0xfd7e('0xc5')));_0x219546[_0xfd7e('0x8')]('/api/teams',require('./api/team'));_0x219546[_0xfd7e('0x8')]('/api/license',require(_0xfd7e('0xc6')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xc7'),require('./api/campaign'));_0x219546[_0xfd7e('0x8')]('/api/migrations',require(_0xfd7e('0xc8')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xc9'),require(_0xfd7e('0xca')));_0x219546[_0xfd7e('0x8')]('/api/plugins',require(_0xfd7e('0xcb')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xcc'),require(_0xfd7e('0xcd')));_0x219546[_0xfd7e('0x8')]('/api/chat/reports/transfer',require(_0xfd7e('0xce')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xcf'),require(_0xfd7e('0xd0')));_0x219546['use'](_0xfd7e('0xd1'),require(_0xfd7e('0xd2')));_0x219546[_0xfd7e('0x8')]('/api/sms/reports/transfer',require(_0xfd7e('0xd3')));_0x219546[_0xfd7e('0x8')]('/api/cm/lists',require(_0xfd7e('0xd4')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xd5'),require(_0xfd7e('0xd6')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xd7'),require('./api/userProfile'));_0x219546['use'](_0xfd7e('0xd8'),require(_0xfd7e('0xd9')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xda'),require(_0xfd7e('0xdb')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xdc'),require('./api/userNotification'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xdd'),require(_0xfd7e('0xde')));_0x219546['use'](_0xfd7e('0xdf'),require(_0xfd7e('0xe0')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xe1'),require('./api/whatsappInteraction'));_0x219546['use'](_0xfd7e('0xe2'),require(_0xfd7e('0xe3')));_0x219546['use'](_0xfd7e('0xe4'),require('./api/whatsappQueueReport'));_0x219546[_0xfd7e('0x8')]('/api/whatsapp/reports/transfer',require(_0xfd7e('0xe5')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xe6'),require(_0xfd7e('0xe7')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xe8'),require('./api/cloudProvider'));_0x219546['use'](_0xfd7e('0xe9'),require('./api/realtime'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xea'),require(_0xfd7e('0xeb')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xec'),require(_0xfd7e('0xed')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xee'),require(_0xfd7e('0xef')));_0x219546[_0xfd7e('0x8')]('/api/auth/activedirectory',require(_0xfd7e('0xf0')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xf1'),require(_0xfd7e('0xf2')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xf3'),require(_0xfd7e('0xf4')));_0x219546['use']('/api/version',require('./api/version'));_0x219546['use'](_0xfd7e('0xf5'),require('./api/system'));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xf6'),require(_0xfd7e('0xf7')));_0x219546['use'](_0xfd7e('0xf8'),require(_0xfd7e('0xf9')));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xfa'),clientSideLogs);_0x219546[_0xfd7e('0x8')](_0xfd7e('0xfb'),express[_0xfd7e('0xfc')](path[_0xfd7e('0xfd')](config[_0xfd7e('0xfe')],_0xfd7e('0xfb'))));_0x219546[_0xfd7e('0x8')](_0xfd7e('0xff'),express[_0xfd7e('0xfc')](path[_0xfd7e('0xfd')](config[_0xfd7e('0xfe')],_0xfd7e('0xff'))));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x100'),express[_0xfd7e('0xfc')](path[_0xfd7e('0xfd')](config[_0xfd7e('0xfe')],_0xfd7e('0x100'))));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x101'),express[_0xfd7e('0xfc')](path[_0xfd7e('0xfd')](config[_0xfd7e('0xfe')],_0xfd7e('0x102'),_0xfd7e('0x103'))));_0x219546[_0xfd7e('0x8')](_0xfd7e('0x104'),express['static'](path['join'](config[_0xfd7e('0xfe')],_0xfd7e('0x105'))));_0x219546['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0xfd7e('0x106')](errors[0x194]);_0x219546['route']('/*')[_0xfd7e('0x106')](function(_0x2ef86f,_0x82776b){_0x82776b[_0xfd7e('0x107')](path[_0xfd7e('0x108')](_0x219546['get'](_0xfd7e('0x109'))+_0xfd7e('0x10a')));});return _0x219546;});}; \ No newline at end of file +var _0xe953=['/api/sms/accounts','./api/smsAccount','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','appPath','/index.html','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe953,0xd4));var _0x3e95=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xe953[_0x1d50f2];return _0x3769b8;};'use strict';var path=require(_0x3e95('0x0'));var express=require(_0x3e95('0x1'));var errors=require(_0x3e95('0x2'));var config=require(_0x3e95('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x3e95('0x4')];var clientSideLogs=require(_0x3e95('0x5'));exports[_0x3e95('0x6')]=function(_0x2dfe21){return setupLoggers(_0x2dfe21)['then'](function(){_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x8'),require(_0x3e95('0x9')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xa'),require('./api/voiceChanSpy'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xb'),require('./api/voiceContext'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xc'),require('./api/voiceExtension'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xd'),require(_0x3e95('0xe')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xf'),require(_0x3e95('0x10')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x11'),require(_0x3e95('0x12')));_0x2dfe21[_0x3e95('0x7')]('/api/screen/recordings',require(_0x3e95('0x13')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x14'),require(_0x3e95('0x15')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x16'),require(_0x3e95('0x17')));_0x2dfe21['use'](_0x3e95('0x18'),require(_0x3e95('0x19')));_0x2dfe21['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x2dfe21['use'](_0x3e95('0x1a'),require('./api/voiceAgentReport'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x1b'),require(_0x3e95('0x1c')));_0x2dfe21[_0x3e95('0x7')]('/api/members/reports',require(_0x3e95('0x1d')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x1e'),require(_0x3e95('0x1f')));_0x2dfe21['use'](_0x3e95('0x20'),require(_0x3e95('0x21')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x22'),require(_0x3e95('0x23')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x24'),require(_0x3e95('0x25')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x26'),require(_0x3e95('0x27')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x28'),require(_0x3e95('0x29')));_0x2dfe21['use'](_0x3e95('0x2a'),require(_0x3e95('0x2b')));_0x2dfe21['use']('/api/mail/messages',require(_0x3e95('0x2c')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x2d'),require('./api/mailApplication'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x2e'),require(_0x3e95('0x2f')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x30'),require(_0x3e95('0x31')));_0x2dfe21['use'](_0x3e95('0x32'),require('./api/dashboardItem'));_0x2dfe21[_0x3e95('0x7')]('/api/fax/accounts',require(_0x3e95('0x33')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x34'),require('./api/faxApplication'));_0x2dfe21['use']('/api/fax/interactions',require('./api/faxInteraction'));_0x2dfe21['use'](_0x3e95('0x35'),require(_0x3e95('0x36')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x37'),require(_0x3e95('0x38')));_0x2dfe21['use'](_0x3e95('0x39'),require(_0x3e95('0x3a')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x3b'),require(_0x3e95('0x3c')));_0x2dfe21[_0x3e95('0x7')]('/api/sms/applications',require('./api/smsApplication'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x3d'),require('./api/smsInteraction'));_0x2dfe21[_0x3e95('0x7')]('/api/sms/messages',require(_0x3e95('0x3e')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x3f'),require(_0x3e95('0x40')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x41'),require(_0x3e95('0x42')));_0x2dfe21['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x43'),require('./api/openchannelInteraction'));_0x2dfe21['use'](_0x3e95('0x44'),require(_0x3e95('0x45')));_0x2dfe21['use'](_0x3e95('0x46'),require(_0x3e95('0x47')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x48'),require(_0x3e95('0x49')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x4a'),require('./api/openchannelQueueReport'));_0x2dfe21['use']('/api/chat/applications',require('./api/chatApplication'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x4b'),require('./api/chatInteraction'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x4c'),require(_0x3e95('0x4d')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x4e'),require(_0x3e95('0x4f')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x50'),require(_0x3e95('0x51')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x52'),require('./api/chatGroup'));_0x2dfe21[_0x3e95('0x7')]('/api/chat/proactive_actions',require(_0x3e95('0x53')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x54'),require(_0x3e95('0x55')));_0x2dfe21['use'](_0x3e95('0x56'),require(_0x3e95('0x57')));_0x2dfe21[_0x3e95('0x7')]('/api/cm/hopper',require('./api/cmHopper'));_0x2dfe21[_0x3e95('0x7')]('/api/cm/hopper_black',require(_0x3e95('0x58')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x59'),require(_0x3e95('0x5a')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x5b'),require('./api/cmHopperHistory'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x5c'),require(_0x3e95('0x5d')));_0x2dfe21['use']('/api/actions',require(_0x3e95('0x5e')));_0x2dfe21['use']('/api/automations',require('./api/automation'));_0x2dfe21['use'](_0x3e95('0x5f'),require(_0x3e95('0x60')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x61'),require(_0x3e95('0x62')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x63'),require(_0x3e95('0x64')));_0x2dfe21[_0x3e95('0x7')]('/api/intervals',require(_0x3e95('0x65')));_0x2dfe21[_0x3e95('0x7')]('/api/pauses',require(_0x3e95('0x66')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x67'),require(_0x3e95('0x68')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x69'),require('./api/voiceQueuesLog'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x6a'),require(_0x3e95('0x6b')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x6c'),require('./api/sound'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x6d'),require(_0x3e95('0x6e')));_0x2dfe21[_0x3e95('0x7')]('/api/contact_item_types',require(_0x3e95('0x6f')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x70'),require(_0x3e95('0x71')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x72'),require(_0x3e95('0x73')));_0x2dfe21['use']('/api/templates',require(_0x3e95('0x74')));_0x2dfe21[_0x3e95('0x7')]('/api/triggers',require('./api/trigger'));_0x2dfe21['use'](_0x3e95('0x75'),require(_0x3e95('0x76')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x77'),require(_0x3e95('0x78')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x79'),require('./api/integrationReport'));_0x2dfe21['use'](_0x3e95('0x7a'),require(_0x3e95('0x7b')));_0x2dfe21[_0x3e95('0x7')]('/api/analytics/default_reports',require(_0x3e95('0x7c')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x7d'),require('./api/analyticExtractedReport'));_0x2dfe21['use'](_0x3e95('0x7e'),require(_0x3e95('0x7f')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x80'),require(_0x3e95('0x81')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x82'),require('./api/analyticTreeReport'));_0x2dfe21[_0x3e95('0x7')]('/api/integrations/salesforce/accounts',require(_0x3e95('0x83')));_0x2dfe21['use'](_0x3e95('0x84'),require('./api/intSalesforceConfiguration'));_0x2dfe21['use'](_0x3e95('0x85'),require('./api/intSalesforceField'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x86'),require(_0x3e95('0x87')));_0x2dfe21[_0x3e95('0x7')]('/api/integrations/sugarcrm/configurations',require(_0x3e95('0x88')));_0x2dfe21['use'](_0x3e95('0x89'),require('./api/intSugarcrmField'));_0x2dfe21[_0x3e95('0x7')]('/api/integrations/desk/accounts',require(_0x3e95('0x8a')));_0x2dfe21['use'](_0x3e95('0x8b'),require('./api/intDeskConfiguration'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x8c'),require(_0x3e95('0x8d')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x8e'),require('./api/intZohoAccount'));_0x2dfe21[_0x3e95('0x7')]('/api/integrations/zoho/configurations',require(_0x3e95('0x8f')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x90'),require(_0x3e95('0x91')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x92'),require(_0x3e95('0x93')));_0x2dfe21['use'](_0x3e95('0x94'),require(_0x3e95('0x95')));_0x2dfe21[_0x3e95('0x7')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x2dfe21['use'](_0x3e95('0x96'),require(_0x3e95('0x97')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x98'),require(_0x3e95('0x99')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x9a'),require('./api/intFreshdeskField'));_0x2dfe21['use'](_0x3e95('0x9b'),require('./api/intVtigerAccount'));_0x2dfe21[_0x3e95('0x7')]('/api/integrations/vtiger/configurations',require(_0x3e95('0x9c')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x9d'),require(_0x3e95('0x9e')));_0x2dfe21['use'](_0x3e95('0x9f'),require('./api/intServicenowAccount'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xa0'),require(_0x3e95('0xa1')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xa2'),require(_0x3e95('0xa3')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xa4'),require(_0x3e95('0xa5')));_0x2dfe21[_0x3e95('0x7')]('/api/integrations/dynamics365/configurations',require(_0x3e95('0xa6')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xa7'),require(_0x3e95('0xa8')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xa9'),require(_0x3e95('0xaa')));_0x2dfe21['use'](_0x3e95('0xab'),require('./api/intFreshsalesConfiguration'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xac'),require(_0x3e95('0xad')));_0x2dfe21[_0x3e95('0x7')]('/api/networks',require(_0x3e95('0xae')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xaf'),require(_0x3e95('0xb0')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xb1'),require(_0x3e95('0xb2')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xb3'),require(_0x3e95('0xb4')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xb5'),require(_0x3e95('0xb6')));_0x2dfe21[_0x3e95('0x7')]('/api/jscripty/sessions/reports',require(_0x3e95('0xb7')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xb8'),require(_0x3e95('0xb9')));_0x2dfe21['use'](_0x3e95('0xba'),require(_0x3e95('0xbb')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xbc'),require(_0x3e95('0xbd')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xbe'),require(_0x3e95('0xbf')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xc0'),require(_0x3e95('0xc1')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xc2'),require(_0x3e95('0xc3')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xc4'),require(_0x3e95('0xc5')));_0x2dfe21[_0x3e95('0x7')]('/api/square/recordings',require(_0x3e95('0xc6')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xc7'),require(_0x3e95('0xc8')));_0x2dfe21['use']('/api/teams',require(_0x3e95('0xc9')));_0x2dfe21['use'](_0x3e95('0xca'),require(_0x3e95('0xcb')));_0x2dfe21['use'](_0x3e95('0xcc'),require(_0x3e95('0xcd')));_0x2dfe21[_0x3e95('0x7')]('/api/migrations',require(_0x3e95('0xce')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xcf'),require(_0x3e95('0xd0')));_0x2dfe21[_0x3e95('0x7')]('/api/plugins',require(_0x3e95('0xd1')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xd2'),require('./api/mailTransferReport'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xd3'),require(_0x3e95('0xd4')));_0x2dfe21[_0x3e95('0x7')]('/api/fax/reports/transfer',require(_0x3e95('0xd5')));_0x2dfe21['use']('/api/openchannel/reports/transfer',require(_0x3e95('0xd6')));_0x2dfe21['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xd7'),require('./api/cmList'));_0x2dfe21['use'](_0x3e95('0xd8'),require(_0x3e95('0xd9')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xda'),require(_0x3e95('0xdb')));_0x2dfe21[_0x3e95('0x7')]('/api/userProfile/sections',require(_0x3e95('0xdc')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xdd'),require('./api/userProfileResource'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xde'),require(_0x3e95('0xdf')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xe0'),require(_0x3e95('0xe1')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xe2'),require(_0x3e95('0xe3')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xe4'),require(_0x3e95('0xe5')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xe6'),require(_0x3e95('0xe7')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xe8'),require('./api/whatsappQueueReport'));_0x2dfe21[_0x3e95('0x7')]('/api/whatsapp/reports/transfer',require(_0x3e95('0xe9')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xea'),require(_0x3e95('0xeb')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xec'),require('./api/cloudProvider'));_0x2dfe21['use'](_0x3e95('0xed'),require('./api/realtime'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xee'),require(_0x3e95('0xef')));_0x2dfe21['use'](_0x3e95('0xf0'),require(_0x3e95('0xf1')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xf2'),require('./api/authGoogle'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xf3'),require(_0x3e95('0xf4')));_0x2dfe21[_0x3e95('0x7')]('/api/jira',require('./api/jira'));_0x2dfe21['use'](_0x3e95('0xf5'),require(_0x3e95('0xf6')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xf7'),require('./api/version'));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xf8'),require(_0x3e95('0xf9')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xfa'),require(_0x3e95('0xfb')));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xfc'),require(_0x3e95('0xfd')));_0x2dfe21[_0x3e95('0x7')]('/api/logs',clientSideLogs);_0x2dfe21[_0x3e95('0x7')](_0x3e95('0xfe'),express[_0x3e95('0xff')](path[_0x3e95('0x100')](config[_0x3e95('0x101')],_0x3e95('0xfe'))));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x102'),express['static'](path['join'](config[_0x3e95('0x101')],_0x3e95('0x102'))));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x103'),express[_0x3e95('0xff')](path[_0x3e95('0x100')](config[_0x3e95('0x101')],_0x3e95('0x103'))));_0x2dfe21[_0x3e95('0x7')](_0x3e95('0x104'),express[_0x3e95('0xff')](path[_0x3e95('0x100')](config[_0x3e95('0x101')],'snippet',_0x3e95('0x105'))));_0x2dfe21['use'](_0x3e95('0x106'),express[_0x3e95('0xff')](path[_0x3e95('0x100')](config[_0x3e95('0x101')],_0x3e95('0x107'))));_0x2dfe21[_0x3e95('0x108')](_0x3e95('0x109'))['get'](errors[0x194]);_0x2dfe21[_0x3e95('0x108')]('/*')['get'](function(_0x64e69d,_0x2e3e6){_0x2e3e6[_0x3e95('0x10a')](path[_0x3e95('0x10b')](_0x2dfe21[_0x3e95('0x10c')](_0x3e95('0x10d'))+_0x3e95('0x10e')));});return _0x2dfe21;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 31549bf..89fbec5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x914a=['../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.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/smsAccount/smsAccount.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x914a,0x18e));var _0xa914=function(_0xd4ec0c,_0x2afcd2){_0xd4ec0c=_0xd4ec0c-0x0;var _0x580218=_0x914a[_0xd4ec0c];return _0x580218;};'use strict';var jayson=require('jayson/promise');var _=require(_0xa914('0x0'));var config=require(_0xa914('0x1'));exports[_0xa914('0x2')]=function(){return new Promise(function(_0xa25f2f,_0xd37794){var _0x475c3a={};_0x475c3a=_['merge'](_0x475c3a,require('../api/user/user.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/voiceExtension/voiceExtension.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/voiceQueue/voiceQueue.rpc'));_0x475c3a=_['merge'](_0x475c3a,require('../api/voiceRecording/voiceRecording.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x4')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x5')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x6')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x7')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x8')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x9')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0xa')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/mailServerIn/mailServerIn.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0xb')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0xc')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0xd')));_0x475c3a=_['merge'](_0x475c3a,require('../api/mailMessage/mailMessage.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/mailApplication/mailApplication.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0xe')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0xf')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x10')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x11')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x12')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x13')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x14')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/smsInteraction/smsInteraction.rpc'));_0x475c3a=_['merge'](_0x475c3a,require('../api/smsMessage/smsMessage.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/smsQueue/smsQueue.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x15')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x16')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x17')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x18')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x19')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x1a')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x1b')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x1c')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/cmHopper/cmHopper.rpc'));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x1d')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x1e')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x1f')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x20')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x21')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x22')));_0x475c3a=_['merge'](_0x475c3a,require('../api/sound/sound.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x23')));_0x475c3a=_['merge'](_0x475c3a,require('../api/template/template.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x24')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x25')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x26')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x27')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x28')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x29')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x2a')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x2b')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x2c')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x2d')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x2e')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x2f')));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x30')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x31')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x32')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x33')));_0x475c3a=_['merge'](_0x475c3a,require('../api/squareProject/squareProject.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x34')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x35')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x36')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/attachment/attachment.rpc'));_0x475c3a=_['merge'](_0x475c3a,require('../api/plugin/plugin.rpc'));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x475c3a=_['merge'](_0x475c3a,require(_0xa914('0x37')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x38')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x39')));_0x475c3a=_[_0xa914('0x3')](_0x475c3a,require(_0xa914('0x3a')));var _0x162962=jayson[_0xa914('0x3b')](_0x475c3a)[_0xa914('0x3c')]();var _0xd314c2=config['rpc']['port']||config[_0xa914('0x3d')]+0x1;var _0x90ec88=config[_0xa914('0x3e')]['ip']||_0xa914('0x3f');_0x162962['on']('error',function(_0x49130e){return _0xd37794(_0x49130e);});_0x162962[_0xa914('0x2')](_0xd314c2,_0x90ec88,function(){console[_0xa914('0x40')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x90ec88,_0xd314c2);require(_0xa914('0x41'))[_0xa914('0x42')]();return _0xa25f2f(_0xa914('0x43')+_0x90ec88+':'+_0xd314c2);});});}; \ No newline at end of file +var _0x6a84=['../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.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/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.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/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc'];(function(_0x6b2f02,_0x150762){var _0x26d2c5=function(_0x48dc01){while(--_0x48dc01){_0x6b2f02['push'](_0x6b2f02['shift']());}};_0x26d2c5(++_0x150762);}(_0x6a84,0x158));var _0x46a8=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x6a84[_0x50a0c2];return _0x5ebadd;};'use strict';var jayson=require('jayson/promise');var _=require(_0x46a8('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x3b770e,_0x214939){var _0x5abca4={};_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x1')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/voiceExtension/voiceExtension.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x3')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/voiceRecording/voiceRecording.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x4')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x5')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x6')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x7')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x8')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x9')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0xa')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0xb')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/mailAccount/mailAccount.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0xc')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0xd')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0xe')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0xf')));_0x5abca4=_['merge'](_0x5abca4,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/faxAccount/faxAccount.rpc'));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x10')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/faxInteraction/faxInteraction.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/faxMessage/faxMessage.rpc'));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x11')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x12')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x13')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x14')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/smsQueue/smsQueue.rpc'));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x15')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x16')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x17')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x18')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x19')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x1a')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x1b')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x1c')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x1d')));_0x5abca4=_['merge'](_0x5abca4,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x1e')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x1f')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x20')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x21')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x22')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x23')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x24')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x25')));_0x5abca4=_['merge'](_0x5abca4,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x26')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x27')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x28')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x29')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x2a')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x2b')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x2c')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x2d')));_0x5abca4=_['merge'](_0x5abca4,require('../api/squareOdbc/squareOdbc.rpc'));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x2e')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require('../api/squareRecording/squareRecording.rpc'));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x2f')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x30')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x31')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x32')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x33')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x34')));_0x5abca4=_[_0x46a8('0x2')](_0x5abca4,require(_0x46a8('0x35')));_0x5abca4=_['merge'](_0x5abca4,require(_0x46a8('0x36')));_0x5abca4=_['merge'](_0x5abca4,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1bbefd=jayson[_0x46a8('0x37')](_0x5abca4)[_0x46a8('0x38')]();var _0x4b345d=config[_0x46a8('0x39')][_0x46a8('0x3a')]||config['port']+0x1;var _0xaf81c2=config[_0x46a8('0x39')]['ip']||_0x46a8('0x3b');_0x1bbefd['on']('error',function(_0x45412e){return _0x214939(_0x45412e);});_0x1bbefd[_0x46a8('0x3c')](_0x4b345d,_0xaf81c2,function(){console['log'](_0x46a8('0x3d'),_0xaf81c2,_0x4b345d);require(_0x46a8('0x3e'))[_0x46a8('0x3f')]();return _0x3b770e(_0x46a8('0x40')+_0xaf81c2+':'+_0x4b345d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4f83a7d..e7ea6ee 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 _0x03fc=['wait','WAIT','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','inherits','sendRequest','command','prototype','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','setPriority','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22'];(function(_0x56ef2b,_0x426c0a){var _0xd840d7=function(_0x27f92e){while(--_0x27f92e){_0x56ef2b['push'](_0x56ef2b['shift']());}};_0xd840d7(++_0x426c0a);}(_0x03fc,0x128));var _0xc03f=function(_0x22ae56,_0x16955c){_0x22ae56=_0x22ae56-0x0;var _0x1544f5=_0x03fc[_0x22ae56];return _0x1544f5;};'use strict';var util=require('util');var _=require(_0xc03f('0x0'));var EventEmitter=require(_0xc03f('0x1'))[_0xc03f('0x2')];var AGIReply=require(_0xc03f('0x3'));var AGIError=require(_0xc03f('0x4'));function AGIChannel(_0x3585ee){var _0x251999=this,_0x3d234e=new AGIReply(),_0x14d692=![],_0x3e3198={};EventEmitter[_0xc03f('0x5')](_0x251999);_0x3585ee['setEncoding']('utf8');_0x3585ee['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x3d234e[_0xc03f('0x6')]('utf8');_0x3d234e['on']('headers',function(_0x26ff74){for(var _0x4f1801 in _0x26ff74){_0x251999[_0x4f1801]=_0x26ff74[_0x4f1801];}_0x251999[_0xc03f('0x7')](_0xc03f('0x8'));});_0x3d234e['on'](_0xc03f('0x9'),function(_0x22447b){if(_0x22447b[_0xc03f('0xa')]()==_0xc03f('0xb')){_0x251999[_0xc03f('0x7')](_0xc03f('0xb'));return;}if(_0x22447b['substring'](0x0,0xb)==_0xc03f('0xc')){_0x14d692=!![];}if(_0x14d692){_0x3e3198['rx']+=_0x22447b+'\x0a';if(_0x22447b[_0xc03f('0xd')](_0xc03f('0xe'))!=-0x1){_0x14d692=![];}}else{_0x3e3198['rx']=_0x22447b;}if(_0x14d692){return;}if(typeof _0x3e3198['cb']==_0xc03f('0xf')){var _0x57ecc=_0x3e3198['rx']['substring'](0x0,0x3),_0x186948=null,_0x1870c6=null;_0x57ecc=parseInt(_0x57ecc);if(isNaN(_0x57ecc)){_0x3e3198['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc03f('0x10')});return;}if(_0x57ecc!=0xc8){_0x3e3198['cb'](null,{'code':_0x57ecc,'result':-0x1,'extra':'KO'});return;}_0x186948=_0x3e3198['rx'][_0xc03f('0x11')](0x4)[_0xc03f('0x12')](_0xc03f('0x13'),'');if(_0x186948[_0xc03f('0x14')]('\x20')!=-0x1){_0x186948=_0x186948['substr'](0x0,_0x186948['indexOf']('\x20'));}if(_[_0xc03f('0x15')](_0x186948,'-1')){_0x186948=parseInt(_0x186948);}_0x1870c6=_0x3e3198['rx'][_0xc03f('0x16')]('\x20');if(_0x1870c6[_0xc03f('0x17')]==0x3){_0x1870c6=_0x1870c6[0x2]['substring'](0x1,_0x1870c6[0x2]['length']-0x1);}else if(_0x1870c6['length']>0x3){var _0x160efd=/\((.+)\)/;var _0x226a9a=_0x3e3198['rx'][_0xc03f('0x18')](_0x160efd);if(_0x226a9a){_0x1870c6=_0x226a9a[0x1];}else{_0x1870c6=null;}}else{_0x1870c6=null;}_0x3e3198['cb'](null,{'code':_0x57ecc,'result':_0x186948,'extra':_0x1870c6});}});_0x3585ee['on'](_0xc03f('0x19'),function(_0x4ec892){_0x251999[_0xc03f('0x7')](_0xc03f('0x19'),new AGIError(_0xc03f('0x1a'),_0x4ec892[_0xc03f('0x1b')]));});_0x3585ee['on'](_0xc03f('0x1c'),function(){_0x251999[_0xc03f('0x7')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3585ee['on'](_0xc03f('0x1d'),function(){_0x251999['emit']('timeout',new AGIError(_0xc03f('0x1e')));_0x3585ee[_0xc03f('0x1f')]();});_0x3585ee[_0xc03f('0x20')](_0x3d234e);this['command']=function(_0x56f25d,_0x3089b9){var _0x56f25d=_0x56f25d||'',_0x3089b9=typeof _0x3089b9=='function'?_0x3089b9:new Function();_0x3e3198={'tx':_0x56f25d,'rx':'','cb':_0x3089b9};_0x3585ee['write'](_0x56f25d+'\x0a');},this[_0xc03f('0x1c')]=function(){_0x3585ee[_0xc03f('0x1f')]();};}util[_0xc03f('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xc03f('0x22')]=function(_0x163b2c){return this[_0xc03f('0x23')]['sync'](this,_0x163b2c);};AGIChannel[_0xc03f('0x24')][_0xc03f('0x25')]=function(){return this[_0xc03f('0x22')](_0xc03f('0x26'));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x27')]=function(_0x12e15f,_0x5ddabb,_0x14692e){_0x12e15f=_0x12e15f===undefined?_0xc03f('0x28'):_0x12e15f;_0x5ddabb=_0x5ddabb===undefined?'5':_0x5ddabb;_0x14692e=_0x14692e===undefined?'1':_0x14692e;return this[_0xc03f('0x22')](util[_0xc03f('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x12e15f,_0x5ddabb*0x3e8,_0x14692e));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x2a')]=function(_0x2a7b27){_0x2a7b27=_0x2a7b27||_0xc03f('0x2b');return this[_0xc03f('0x22')](util[_0xc03f('0x29')](_0xc03f('0x2c'),_0x2a7b27));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x2d')]=function(_0x1276c3,_0xdd6a5d){if(_['isArray'](_0xdd6a5d)){return this['sendRequest'](util[_0xc03f('0x29')](_0xc03f('0x2e'),_0x1276c3,_0xdd6a5d['join'](',')));}return this[_0xc03f('0x22')](util[_0xc03f('0x29')](_0xc03f('0x2e'),_0x1276c3,_0xdd6a5d));};AGIChannel[_0xc03f('0x24')]['setContext']=function(_0x216d4f){return this['sendRequest'](util['format'](_0xc03f('0x2f'),_0x216d4f));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x30')]=function(_0x2076a1){return this[_0xc03f('0x22')](util[_0xc03f('0x29')]('SET\x20EXTENSION\x20%s',_0x2076a1));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x31')]=function(_0x471e3c){return this['sendRequest'](util['format']('SET\x20PRIORITY\x20%s',_0x471e3c));};AGIChannel[_0xc03f('0x24')]['hangup']=function(){return this[_0xc03f('0x22')]('HANGUP');};AGIChannel[_0xc03f('0x24')][_0xc03f('0x32')]=function(_0x4f6db8,_0x363d68){var _0x2146b0=_[_0xc03f('0x33')](_0x363d68)||_[_0xc03f('0x34')](_0x363d68)?_0x363d68[_0xc03f('0x35')]():_0x363d68;return this[_0xc03f('0x22')](util['format'](_0xc03f('0x36'),_0x4f6db8,_0x2146b0?_0x2146b0['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x2f6087,_0x56b13e){return this[_0xc03f('0x22')](util[_0xc03f('0x29')](_0xc03f('0x37'),_0x2f6087,_0x56b13e));};AGIChannel['prototype'][_0xc03f('0x38')]=function(_0x344222,_0x9ea941){return this[_0xc03f('0x22')](util[_0xc03f('0x29')](_0xc03f('0x39'),_0x344222,_0x9ea941));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x3a')]=function(_0x31b50e,_0x4068a5){return this['sendRequest'](util[_0xc03f('0x29')](_0xc03f('0x3b'),_0x31b50e,_0x4068a5));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x3c')]=function(_0x25c69c,_0x519433,_0x36d686){_0x519433=_0x519433||this[_0xc03f('0x3d')];_0x36d686=_0x36d686||0x1;this['setContext'](_0x25c69c);this[_0xc03f('0x30')](_0x519433);this[_0xc03f('0x31')](_0x36d686);return this['noop'](util['format']('GOTO\x20%s\x20%s\x20%s',_0x25c69c,_0x519433,_0x36d686));};AGIChannel[_0xc03f('0x24')]['getVariable']=function(_0x21ee60){return this[_0xc03f('0x22')](util[_0xc03f('0x29')](_0xc03f('0x3e'),_0x21ee60));};AGIChannel[_0xc03f('0x24')][_0xc03f('0x3f')]=function(_0x432229,_0x423d0a,_0x57b12a,_0x17b2ad,_0x246085,_0x1caaf1){_0x423d0a=_0x423d0a||_0xc03f('0x40');_0x57b12a=_0x57b12a||'';_0x17b2ad=_0x17b2ad===undefined?-0x1:_0x17b2ad==='-1'?-0x1:_0x17b2ad*0x3e8;_0x246085=_0x246085===undefined?'':'s='+_0x246085;_0x1caaf1=_0x1caaf1?_0xc03f('0x41'):'';return this[_0xc03f('0x22')](util[_0xc03f('0x29')](_0xc03f('0x42'),_0x432229,_0x423d0a,_0x57b12a,_0x17b2ad,_0x1caaf1,_0x246085));};AGIChannel['prototype'][_0xc03f('0x43')]=function(_0x1efc3b,_0x52b3f9){_0x52b3f9=_0x52b3f9||'';return this[_0xc03f('0x22')](util[_0xc03f('0x29')](_0xc03f('0x44'),_0x1efc3b,_0x52b3f9));};AGIChannel[_0xc03f('0x24')]['agi']=function(_0x44abe1){return this['exec']('AGI',_0x44abe1);};AGIChannel['prototype'][_0xc03f('0x45')]=function(_0x2378d7){return this['exec'](_0xc03f('0x46'),_0x2378d7);};AGIChannel['prototype'][_0xc03f('0x19')]=function(_0x199370,_0x2536c9){this[_0xc03f('0x2a')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x199370['id'],_0x199370[_0xc03f('0x47')],_0x2536c9));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc03f('0x48')]=AGIChannel; \ No newline at end of file +var _0x97ce=['prototype','sendRequest','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','startsWith','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits'];(function(_0x1ac0dd,_0x5a1e5f){var _0x31fc81=function(_0x5a6f8f){while(--_0x5a6f8f){_0x1ac0dd['push'](_0x1ac0dd['shift']());}};_0x31fc81(++_0x5a1e5f);}(_0x97ce,0x151));var _0xe97c=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x97ce[_0xb24a3e];return _0x4038d7;};'use strict';var util=require(_0xe97c('0x0'));var _=require(_0xe97c('0x1'));var EventEmitter=require(_0xe97c('0x2'))[_0xe97c('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xe97c('0x4'));function AGIChannel(_0x4ff29b){var _0x3001eb=this,_0x49df42=new AGIReply(),_0x443ea2=![],_0x259e69={};EventEmitter[_0xe97c('0x5')](_0x3001eb);_0x4ff29b[_0xe97c('0x6')](_0xe97c('0x7'));_0x4ff29b[_0xe97c('0x8')](0x8*0x3c*0x3c*0x3e8);_0x49df42['setEncoding'](_0xe97c('0x7'));_0x49df42['on'](_0xe97c('0x9'),function(_0x9ce6d){for(var _0x48a21e in _0x9ce6d){_0x3001eb[_0x48a21e]=_0x9ce6d[_0x48a21e];}_0x3001eb[_0xe97c('0xa')]('ready');});_0x49df42['on'](_0xe97c('0xb'),function(_0x2e732d){if(_0x2e732d[_0xe97c('0xc')]()==_0xe97c('0xd')){_0x3001eb[_0xe97c('0xa')](_0xe97c('0xd'));return;}if(_0x2e732d[_0xe97c('0xe')](0x0,0xb)=='520-Invalid'){_0x443ea2=!![];}if(_0x443ea2){_0x259e69['rx']+=_0x2e732d+'\x0a';if(_0x2e732d[_0xe97c('0xf')](_0xe97c('0x10'))!=-0x1){_0x443ea2=![];}}else{_0x259e69['rx']=_0x2e732d;}if(_0x443ea2){return;}if(typeof _0x259e69['cb']==_0xe97c('0x11')){var _0x15ab00=_0x259e69['rx'][_0xe97c('0xe')](0x0,0x3),_0x72d55a=null,_0x3df200=null;_0x15ab00=parseInt(_0x15ab00);if(isNaN(_0x15ab00)){_0x259e69['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe97c('0x12')});return;}if(_0x15ab00!=0xc8){_0x259e69['cb'](null,{'code':_0x15ab00,'result':-0x1,'extra':'KO'});return;}_0x72d55a=_0x259e69['rx'][_0xe97c('0xe')](0x4)['replace']('result=','');if(_0x72d55a[_0xe97c('0x13')]('\x20')!=-0x1){_0x72d55a=_0x72d55a['substr'](0x0,_0x72d55a[_0xe97c('0x13')]('\x20'));}if(_[_0xe97c('0x14')](_0x72d55a,'-1')){_0x72d55a=parseInt(_0x72d55a);}_0x3df200=_0x259e69['rx']['split']('\x20');if(_0x3df200['length']==0x3){_0x3df200=_0x3df200[0x2][_0xe97c('0xe')](0x1,_0x3df200[0x2][_0xe97c('0x15')]-0x1);}else if(_0x3df200[_0xe97c('0x15')]>0x3){var _0x2e026d=/\((.+)\)/;var _0x4e73ab=_0x259e69['rx']['match'](_0x2e026d);if(_0x4e73ab){_0x3df200=_0x4e73ab[0x1];}else{_0x3df200=null;}}else{_0x3df200=null;}_0x259e69['cb'](null,{'code':_0x15ab00,'result':_0x72d55a,'extra':_0x3df200});}});_0x4ff29b['on']('error',function(_0x42d95c){_0x3001eb[_0xe97c('0xa')](_0xe97c('0x16'),new AGIError('E_AGI_SOCKET_ERROR',_0x42d95c[_0xe97c('0x17')]));});_0x4ff29b['on'](_0xe97c('0x18'),function(){_0x3001eb[_0xe97c('0xa')](_0xe97c('0x18'),new AGIError(_0xe97c('0x19')));});_0x4ff29b['on']('timeout',function(){_0x3001eb[_0xe97c('0xa')](_0xe97c('0x1a'),new AGIError(_0xe97c('0x1b')));_0x4ff29b[_0xe97c('0x1c')]();});_0x4ff29b[_0xe97c('0x1d')](_0x49df42);this[_0xe97c('0x1e')]=function(_0x1585fc,_0x1061e1){var _0x1585fc=_0x1585fc||'',_0x1061e1=typeof _0x1061e1==_0xe97c('0x11')?_0x1061e1:new Function();_0x259e69={'tx':_0x1585fc,'rx':'','cb':_0x1061e1};_0x4ff29b[_0xe97c('0x1f')](_0x1585fc+'\x0a');},this[_0xe97c('0x18')]=function(){_0x4ff29b[_0xe97c('0x1c')]();};}util[_0xe97c('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xe97c('0x21')][_0xe97c('0x22')]=function(_0x19741f){return this[_0xe97c('0x1e')]['sync'](this,_0x19741f);};AGIChannel[_0xe97c('0x21')][_0xe97c('0x23')]=function(){return this[_0xe97c('0x22')](_0xe97c('0x24'));};AGIChannel[_0xe97c('0x21')][_0xe97c('0x25')]=function(_0x42729e,_0x1d22a3,_0x338149){_0x42729e=_0x42729e===undefined?_0xe97c('0x26'):_0x42729e;_0x1d22a3=_0x1d22a3===undefined?'5':_0x1d22a3;_0x338149=_0x338149===undefined?'1':_0x338149;return this[_0xe97c('0x22')](util[_0xe97c('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x42729e,_0x1d22a3*0x3e8,_0x338149));};AGIChannel['prototype'][_0xe97c('0x28')]=function(_0x1a3f69){_0x1a3f69=_0x1a3f69||_0xe97c('0x29');return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x2a'),_0x1a3f69));};AGIChannel[_0xe97c('0x21')]['exec']=function(_0x544889,_0x35938e){if(_[_0xe97c('0x2b')](_0x35938e)){return this[_0xe97c('0x22')](util[_0xe97c('0x27')]('EXEC\x20%s\x20%s',_0x544889,_0x35938e['join'](',')));}return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x2c'),_0x544889,_0x35938e));};AGIChannel['prototype']['setContext']=function(_0x46a838){return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x2d'),_0x46a838));};AGIChannel[_0xe97c('0x21')][_0xe97c('0x2e')]=function(_0x36e0dc){return this['sendRequest'](util[_0xe97c('0x27')](_0xe97c('0x2f'),_0x36e0dc));};AGIChannel['prototype'][_0xe97c('0x30')]=function(_0x1a69c){return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x31'),_0x1a69c));};AGIChannel[_0xe97c('0x21')][_0xe97c('0xd')]=function(){return this[_0xe97c('0x22')]('HANGUP');};AGIChannel['prototype'][_0xe97c('0x32')]=function(_0x8099a9,_0x437755){var _0x34e6f7=_['isBoolean'](_0x437755)||_[_0xe97c('0x33')](_0x437755)?_0x437755['toString']():_0x437755;return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x34'),_0x8099a9,_0x34e6f7?_0x34e6f7['toString']()[_0xe97c('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe97c('0x21')][_0xe97c('0x36')]=function(_0xc206e,_0x2c287c){return this['sendRequest'](util[_0xe97c('0x27')](_0xe97c('0x37'),_0xc206e,_0x2c287c));};AGIChannel[_0xe97c('0x21')]['sayDigits']=function(_0x518a96,_0x371830){return this['sendRequest'](util[_0xe97c('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x518a96,_0x371830));};AGIChannel['prototype']['sayPhonetic']=function(_0x112ae7,_0x463d32){return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x38'),_0x112ae7,_0x463d32));};AGIChannel['prototype'][_0xe97c('0x39')]=function(_0x5eb5cf,_0x341fb8,_0x1f4f48){_0x341fb8=_0x341fb8||this[_0xe97c('0x3a')];_0x1f4f48=_0x1f4f48||0x1;this[_0xe97c('0x3b')](_0x5eb5cf);this[_0xe97c('0x2e')](_0x341fb8);this[_0xe97c('0x30')](_0x1f4f48);return this[_0xe97c('0x28')](util[_0xe97c('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x5eb5cf,_0x341fb8,_0x1f4f48));};AGIChannel[_0xe97c('0x21')][_0xe97c('0x3c')]=function(_0x20ee1b){return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x3d'),_0x20ee1b));};AGIChannel[_0xe97c('0x21')][_0xe97c('0x3e')]=function(_0x1bf349,_0x419429,_0x516605,_0x2cc38d,_0xe8be13,_0x4b04b0){_0x419429=_0x419429||_0xe97c('0x3f');_0x516605=_0x516605||'';_0x2cc38d=_0x2cc38d===undefined?-0x1:_0x2cc38d==='-1'?-0x1:_0x2cc38d*0x3e8;_0xe8be13=_0xe8be13===undefined?'':'s='+_0xe8be13;_0x4b04b0=_0x4b04b0?_0xe97c('0x40'):'';return this[_0xe97c('0x22')](util[_0xe97c('0x27')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1bf349,_0x419429,_0x516605,_0x2cc38d,_0x4b04b0,_0xe8be13));};AGIChannel[_0xe97c('0x21')]['streamFile']=function(_0x419655,_0x373cb2){_0x373cb2=_0x373cb2||'';return this[_0xe97c('0x22')](util[_0xe97c('0x27')](_0xe97c('0x41'),_0x419655,_0x373cb2));};AGIChannel['prototype'][_0xe97c('0x42')]=function(_0x197f35){return this[_0xe97c('0x43')](_0xe97c('0x44'),_0x197f35);};AGIChannel['prototype'][_0xe97c('0x45')]=function(_0x3299d2){return this['exec'](_0xe97c('0x46'),_0x3299d2);};AGIChannel[_0xe97c('0x21')]['error']=function(_0x47c0f3,_0x1fd875){this[_0xe97c('0x28')](util[_0xe97c('0x27')](_0xe97c('0x47'),_0x47c0f3['id'],_0x47c0f3[_0xe97c('0x48')],_0x1fd875));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe97c('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index cfbcbe4..5e45bde 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 _0xbd70=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0xbd70,0x1c1));var _0x0bd7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbd70[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x0bd7('0x0'));var error={'E_AGI_UNDEFINED':_0x0bd7('0x1'),'E_AGI_ARGUMENT_PORT':_0x0bd7('0x2'),'E_AGI_SERVER_ERROR':_0x0bd7('0x3'),'E_AGI_SERVER_CLOSE':_0x0bd7('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x0bd7('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x0bd7('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x0bd7('0x7'),'E_AGI_COMMAND_EMPTY':_0x0bd7('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0bd7('0x9'),'E_AGI_IVR_ENTRY':_0x0bd7('0xa')};function AGIError(_0x514484){var _0x514484=_0x514484||null,_0x3c2317=_0x3c2317||[],_0x15d42f=0x1,_0x2417a9='';if(!error[_0x514484]){_0x514484=_0x0bd7('0xb');}_0x3c2317[_0x0bd7('0xc')](error[_0x514484]);while(arguments[_0x15d42f]){_0x3c2317[_0x0bd7('0xc')](arguments[_0x15d42f]);_0x15d42f++;}_0x2417a9=util[_0x0bd7('0xd')][_0x0bd7('0xe')](util,_0x3c2317);this[_0x0bd7('0xf')]=_0x2417a9;this[_0x0bd7('0x10')]=_0x514484;}module[_0x0bd7('0x11')]=AGIError; \ No newline at end of file +var _0xc4a0=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0xc4a0,0x16a));var _0x0c4a=function(_0xb54a40,_0x4a667b){_0xb54a40=_0xb54a40-0x0;var _0x446e3d=_0xc4a0[_0xb54a40];return _0x446e3d;};'use strict';var util=require(_0x0c4a('0x0'));var error={'E_AGI_UNDEFINED':_0x0c4a('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x0c4a('0x2'),'E_AGI_SERVER_CLOSE':_0x0c4a('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x0c4a('0x4'),'E_AGI_SOCKET_ERROR':_0x0c4a('0x5'),'E_AGI_SOCKET_CLOSE':_0x0c4a('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x0c4a('0x7'),'E_AGI_COMMAND_EMPTY':_0x0c4a('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0c4a('0x9'),'E_AGI_IVR_ENTRY':_0x0c4a('0xa')};function AGIError(_0x1c4804){var _0x1c4804=_0x1c4804||null,_0x413e1e=_0x413e1e||[],_0x3c6681=0x1,_0x2931a5='';if(!error[_0x1c4804]){_0x1c4804='E_AGI_UNDEFINED';}_0x413e1e[_0x0c4a('0xb')](error[_0x1c4804]);while(arguments[_0x3c6681]){_0x413e1e[_0x0c4a('0xb')](arguments[_0x3c6681]);_0x3c6681++;}_0x2931a5=util[_0x0c4a('0xc')][_0x0c4a('0xd')](util,_0x413e1e);this[_0x0c4a('0xe')]=_0x2931a5;this['name']=_0x1c4804;}module[_0x0c4a('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index d67eb99..91fb719 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 _0x06c3=['error','E_AGI_SERVER_ERROR','message','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','subscribe','agi','emit'];(function(_0x578d34,_0x42b092){var _0x10e534=function(_0x1735b6){while(--_0x1735b6){_0x578d34['push'](_0x578d34['shift']());}};_0x10e534(++_0x42b092);}(_0x06c3,0xac));var _0x306c=function(_0x2c3a55,_0x4dc4d6){_0x2c3a55=_0x2c3a55-0x0;var _0x41df3e=_0x06c3[_0x2c3a55];return _0x41df3e;};'use strict';var _=require(_0x306c('0x0'));var EventEmitter=require('events')[_0x306c('0x1')];var Redis=require(_0x306c('0x2'));var AGIError=require(_0x306c('0x3'));var config=require(_0x306c('0x4'));config[_0x306c('0x5')]=_[_0x306c('0x6')](config[_0x306c('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x306c('0x7')](_0x306c('0x8'),function(_0x4d5245){if(_0x4d5245)return eventEmitter[_0x306c('0x9')](_0x306c('0xa'),new AGIError(_0x306c('0xb'),_0x4d5245));});sub['on'](_0x306c('0xc'),function(_0x16a144,_0x4b67ab){if(_0x16a144!==_0x306c('0x8'))return;try{var _0x2c6633=JSON['parse'](_0x4b67ab);eventEmitter[_0x306c('0x9')]('projectUpdate',_0x2c6633);}catch(_0xfc2d30){eventEmitter[_0x306c('0x9')](_0x306c('0xa'),new AGIError(_0x306c('0xb'),_0xfc2d30));}});module[_0x306c('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xa833=['events','EventEmitter','ioredis','./error','redis','localhost','agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash'];(function(_0x2d0817,_0x46d540){var _0x392bf3=function(_0x433ff5){while(--_0x433ff5){_0x2d0817['push'](_0x2d0817['shift']());}};_0x392bf3(++_0x46d540);}(_0xa833,0x117));var _0x3a83=function(_0xa59846,_0x331173){_0xa59846=_0xa59846-0x0;var _0x212071=_0xa833[_0xa59846];return _0x212071;};'use strict';var _=require(_0x3a83('0x0'));var EventEmitter=require(_0x3a83('0x1'))[_0x3a83('0x2')];var Redis=require(_0x3a83('0x3'));var AGIError=require(_0x3a83('0x4'));var config=require('../../config/environment');config[_0x3a83('0x5')]=_['defaults'](config[_0x3a83('0x5')],{'host':_0x3a83('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0x3a83('0x7'),function(_0x2e7b26){if(_0x2e7b26)return eventEmitter[_0x3a83('0x8')]('error',new AGIError(_0x3a83('0x9'),_0x2e7b26));});sub['on'](_0x3a83('0xa'),function(_0x4cfbf4,_0x13e38f){if(_0x4cfbf4!==_0x3a83('0x7'))return;try{var _0x186923=JSON[_0x3a83('0xb')](_0x13e38f);eventEmitter[_0x3a83('0x8')](_0x3a83('0xc'),_0x186923);}catch(_0x41b09e){eventEmitter['emit']('error',new AGIError(_0x3a83('0x9'),_0x41b09e));}});module[_0x3a83('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 f069761..ed6aec5 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 _0xe25f=['getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','../../../config/logger','menu'];(function(_0x4b3b5c,_0x3d17cb){var _0x4c0c65=function(_0x5569ab){while(--_0x5569ab){_0x4b3b5c['push'](_0x4b3b5c['shift']());}};_0x4c0c65(++_0x3d17cb);}(_0xe25f,0x185));var _0xfe25=function(_0x451a1b,_0x4454c2){_0x451a1b=_0x451a1b-0x0;var _0xd6b180=_0xe25f[_0x451a1b];return _0xd6b180;};'use strict';var _=require(_0xfe25('0x0'));var logger=require(_0xfe25('0x1'))('agi');var verticesWithRetry=[_0xfe25('0x2'),_0xfe25('0x3'),_0xfe25('0x4')];var Graph=function(){this[_0xfe25('0x5')]={};this[_0xfe25('0x6')]={};this[_0xfe25('0x7')]=0x0;};Graph[_0xfe25('0x8')]['addVertex']=function(_0x11cd8a){this[_0xfe25('0x5')][_0x11cd8a['id']]=_0x11cd8a;this['edges'][_0x11cd8a['id']]=[];};Graph[_0xfe25('0x8')][_0xfe25('0x9')]=function(_0x32f794,_0x3d4c54,_0xc4d5f){this[_0xfe25('0x6')][_0x32f794][_0xfe25('0xa')]({'target':_0x3d4c54,'condition':_0xc4d5f});this[_0xfe25('0x7')]+=0x1;};Graph[_0xfe25('0x8')][_0xfe25('0xb')]=function(){return _[_0xfe25('0xb')](this['vertices']);};Graph[_0xfe25('0x8')][_0xfe25('0xc')]=function(){return this[_0xfe25('0x7')];};Graph[_0xfe25('0x8')]['getVertex']=function(_0x1d80d6){return this[_0xfe25('0x5')][_0x1d80d6];};Graph[_0xfe25('0x8')]['traverseBFS']=function(_0x4c1ca3,_0x5c0ff9){if(!this[_0xfe25('0x5')][_0x4c1ca3]){return logger[_0xfe25('0xd')](_0xfe25('0xe'));}var _0x43565d=_0x5c0ff9(this[_0xfe25('0x5')][_0x4c1ca3]);if(!_0x43565d){return logger['info'](_0xfe25('0xf'));}if(this[_0xfe25('0x6')][_0x4c1ca3][_0xfe25('0x10')]===0x0){return logger[_0xfe25('0xd')](_0xfe25('0x11'));}for(var _0xc73950=0x0,_0x399995=[],_0x4fe517=![];_0xc73950\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','catch','agi_','substring','debug','variables','stringify','close','timeout','handleNotFound','handleUnpublished','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server'];(function(_0x38b7a6,_0x29d10c){var _0x3ea610=function(_0x390639){while(--_0x390639){_0x38b7a6['push'](_0x38b7a6['shift']());}};_0x3ea610(++_0x29d10c);}(_0xd64c,0xa7));var _0xcd64=function(_0x1efb79,_0x32fb44){_0x1efb79=_0x1efb79-0x0;var _0x117ac4=_0xd64c[_0x1efb79];return _0x117ac4;};'use strict';var _=require(_0xcd64('0x0'));var syncho=require(_0xcd64('0x1'));var util=require('util');var config=require(_0xcd64('0x2'));var logger=require(_0xcd64('0x3'))(_0xcd64('0x4'));var utilLicense=require(_0xcd64('0x5'));var rpc=require(_0xcd64('0x6'));var Project=require('./project');var AGIEmitter=require(_0xcd64('0x7'))[_0xcd64('0x8')];var projects=[];config[_0xcd64('0x4')]=_[_0xcd64('0x9')](config[_0xcd64('0x4')],{'ip':_0xcd64('0xa'),'port':0x11dd});AGIEmitter['on'](_0xcd64('0xb'),projectUpdateHandler);function connectionHandler(_0x4b9019){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4b9019);agiHandler(_0x4b9019);}catch(_0x26db9a){logger[_0xcd64('0xc')](_0x26db9a[_0xcd64('0xd')]);}});});}function projectUpdateHandler(_0x45d303){try{var _0x1c9507=_[_0xcd64('0xe')](projects,['id',_0x45d303['id']]);if(_0x1c9507>-0x1){if(_0x45d303[_0xcd64('0xf')]===!![]){projects[_0xcd64('0x10')](_0x1c9507,0x1);}else{projects[_0x1c9507]=_0x45d303;}}else{projects['push'](_0x45d303);}}catch(_0x246469){logger[_0xcd64('0xc')](_0x246469[_0xcd64('0xd')]);}}function listeningHandler(){console[_0xcd64('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xcd64('0x4')]['port']);logger[_0xcd64('0x12')](util[_0xcd64('0x13')](_0xcd64('0x14'),config[_0xcd64('0x4')]['ip'],config['agi']['port']));}function errorHandler(_0x1294fc){if(_0x1294fc&&_0x1294fc[_0xcd64('0x15')]&&_0x1294fc[_0xcd64('0x16')]){logger[_0xcd64('0xc')](util[_0xcd64('0x13')](_0xcd64('0x17'),_0x1294fc[_0xcd64('0x15')],_0x1294fc['message']));}else{logger[_0xcd64('0xc')](util[_0xcd64('0x13')](_0xcd64('0x18'),_0x1294fc['stack']));}}function closeHandler(){logger[_0xcd64('0x12')](util[_0xcd64('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xcd64('0x19')],this[_0xcd64('0x1a')],this['callerid'],this[_0xcd64('0x1b')],this[_0xcd64('0x1c')]));try{createSquareReport(this);}catch(_0x46c338){logger[_0xcd64('0xc')](_0x46c338[_0xcd64('0xd')]);}}function timeoutHandler(){logger[_0xcd64('0x12')](util[_0xcd64('0x13')](_0xcd64('0x1d'),this['arg_1'],this[_0xcd64('0x1a')],this[_0xcd64('0x1e')],this['dnid'],this[_0xcd64('0x1c')]));}function hangupHandler(){logger[_0xcd64('0x12')](util['format'](_0xcd64('0x1f'),this[_0xcd64('0x19')],this[_0xcd64('0x1a')],this[_0xcd64('0x1e')],this[_0xcd64('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x3647fc,_0x3b33aa){rpc[_0xcd64('0x20')](_0x3647fc)['then'](function(_0x21561b){if(_0x3b33aa){_0x3b33aa(null,_0x21561b);}})[_0xcd64('0x21')](function(_0x4063b8){if(_0x3b33aa){_0x3b33aa(null,_0x4063b8);}});}function setChannelVariables(_0x52a730){for(var _0x39ba71 in _0x52a730){if(_0x52a730['hasOwnProperty'](_0x39ba71)){if(_0x39ba71['indexOf'](_0xcd64('0x22'))===0x0){_0x52a730[_0x39ba71[_0xcd64('0x23')](0x4)]=_0x52a730[_0x39ba71];delete _0x52a730[_0x39ba71];}}}}function agiHandler(_0xdbac6b){logger[_0xcd64('0x24')](_0xcd64('0x25'),JSON[_0xcd64('0x26')](_0xdbac6b,null,0x2));logger[_0xcd64('0x12')](util[_0xcd64('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xdbac6b[_0xcd64('0x19')],_0xdbac6b[_0xcd64('0x1a')],_0xdbac6b[_0xcd64('0x1e')],_0xdbac6b[_0xcd64('0x1b')],_0xdbac6b['uniqueid']));_0xdbac6b['on'](_0xcd64('0xc'),errorHandler);_0xdbac6b['on'](_0xcd64('0x27'),closeHandler);_0xdbac6b['on'](_0xcd64('0x28'),timeoutHandler);_0xdbac6b['evtHangup']=![];_0xdbac6b['on']('hangup',hangupHandler);var _0x46e45d=_['find'](projects,[_0xcd64('0x15'),_0xdbac6b[_0xcd64('0x19')]]);if(!_0x46e45d)return Project[_0xcd64('0x29')](_0xdbac6b);if(!_0x46e45d['production'])return Project[_0xcd64('0x2a')](_0xdbac6b);return Project['initialize'](_0x46e45d,_0xdbac6b);}function main(){var _0x1fc4e2;return utilLicense[_0xcd64('0x2b')]()[_0xcd64('0x2c')](function(_0x4f3da2){if(!_0x4f3da2)return;if(_0x4f3da2[_0xcd64('0x2d')]){if(_0x4f3da2[_0xcd64('0x2e')]&&_0x4f3da2[_0xcd64('0x2e')]>0x0){logger['info'](util[_0xcd64('0x13')](_0xcd64('0x2f'),_0x4f3da2['callysquare']));_0x1fc4e2=_0x4f3da2['callysquare'];}else{logger[_0xcd64('0x12')](_0xcd64('0x30'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1fc4e2=-0x1;}})['then'](function(){return Project[_0xcd64('0x31')]();})[_0xcd64('0x2c')](function(_0x183d5e){projects=_0x183d5e;return;})[_0xcd64('0x21')](function(_0x493834){logger['error'](_0xcd64('0x32'),_0x493834[_0xcd64('0xd')]);})[_0xcd64('0x33')](function(){var _0x445fdc=require(_0xcd64('0x34'))(config[_0xcd64('0x4')][_0xcd64('0x35')],config[_0xcd64('0x4')]['ip'],_0x1fc4e2);_0x445fdc['on']('error',errorHandler);_0x445fdc['on']('listening',listeningHandler);_0x445fdc['on'](_0xcd64('0x36'),connectionHandler);_0x445fdc['on'](_0xcd64('0x27'),closeHandler);});}main(); \ No newline at end of file +var _0x2a84=['callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','catch','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','127.0.0.1','projectUpdate','nextTick','stack','deleted','splice','push','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','info','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','substring','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','getLicense'];(function(_0x205951,_0x4ff892){var _0x1c2383=function(_0x30c01f){while(--_0x30c01f){_0x205951['push'](_0x205951['shift']());}};_0x1c2383(++_0x4ff892);}(_0x2a84,0xbd));var _0x42a8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2a84[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x42a8('0x0'));var syncho=require(_0x42a8('0x1'));var util=require(_0x42a8('0x2'));var config=require('../../config/environment');var logger=require(_0x42a8('0x3'))(_0x42a8('0x4'));var utilLicense=require(_0x42a8('0x5'));var rpc=require(_0x42a8('0x6'));var Project=require(_0x42a8('0x7'));var AGIEmitter=require(_0x42a8('0x8'))[_0x42a8('0x9')];var projects=[];config[_0x42a8('0x4')]=_['defaults'](config[_0x42a8('0x4')],{'ip':_0x42a8('0xa'),'port':0x11dd});AGIEmitter['on'](_0x42a8('0xb'),projectUpdateHandler);function connectionHandler(_0x48c4e8){process[_0x42a8('0xc')](function(){syncho(function(){try{setChannelVariables(_0x48c4e8);agiHandler(_0x48c4e8);}catch(_0x5dd761){logger['error'](_0x5dd761[_0x42a8('0xd')]);}});});}function projectUpdateHandler(_0x40f236){try{var _0x1802ae=_['findIndex'](projects,['id',_0x40f236['id']]);if(_0x1802ae>-0x1){if(_0x40f236[_0x42a8('0xe')]===!![]){projects[_0x42a8('0xf')](_0x1802ae,0x1);}else{projects[_0x1802ae]=_0x40f236;}}else{projects[_0x42a8('0x10')](_0x40f236);}}catch(_0x152f69){logger[_0x42a8('0x11')](_0x152f69['stack']);}}function listeningHandler(){console[_0x42a8('0x12')](_0x42a8('0x13'),config[_0x42a8('0x4')][_0x42a8('0x14')]);logger['info'](util[_0x42a8('0x15')](_0x42a8('0x16'),config[_0x42a8('0x4')]['ip'],config[_0x42a8('0x4')]['port']));}function errorHandler(_0x15f86b){if(_0x15f86b&&_0x15f86b[_0x42a8('0x17')]&&_0x15f86b[_0x42a8('0x18')]){logger[_0x42a8('0x11')](util[_0x42a8('0x15')](_0x42a8('0x19'),_0x15f86b['name'],_0x15f86b[_0x42a8('0x18')]));}else{logger['error'](util[_0x42a8('0x15')](_0x42a8('0x1a'),_0x15f86b[_0x42a8('0xd')]));}}function closeHandler(){logger[_0x42a8('0x1b')](util[_0x42a8('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x42a8('0x1c')],this['calleridname'],this[_0x42a8('0x1d')],this[_0x42a8('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x10ce66){logger[_0x42a8('0x11')](_0x10ce66[_0x42a8('0xd')]);}}function timeoutHandler(){logger[_0x42a8('0x1b')](util[_0x42a8('0x15')](_0x42a8('0x1f'),this['arg_1'],this[_0x42a8('0x20')],this[_0x42a8('0x1d')],this[_0x42a8('0x1e')],this[_0x42a8('0x21')]));}function hangupHandler(){logger[_0x42a8('0x1b')](util[_0x42a8('0x15')](_0x42a8('0x22'),this['arg_1'],this[_0x42a8('0x20')],this['callerid'],this[_0x42a8('0x1e')],this['uniqueid']));this[_0x42a8('0x23')]=!![];}function createSquareReport(_0x1d8084,_0x1c1ca2){rpc[_0x42a8('0x24')](_0x1d8084)[_0x42a8('0x25')](function(_0x233948){if(_0x1c1ca2){_0x1c1ca2(null,_0x233948);}})['catch'](function(_0x40d544){if(_0x1c1ca2){_0x1c1ca2(null,_0x40d544);}});}function setChannelVariables(_0x892cb5){for(var _0x2b7ba4 in _0x892cb5){if(_0x892cb5[_0x42a8('0x26')](_0x2b7ba4)){if(_0x2b7ba4[_0x42a8('0x27')]('agi_')===0x0){_0x892cb5[_0x2b7ba4[_0x42a8('0x28')](0x4)]=_0x892cb5[_0x2b7ba4];delete _0x892cb5[_0x2b7ba4];}}}}function agiHandler(_0xcac0ef){logger[_0x42a8('0x29')]('variables',JSON['stringify'](_0xcac0ef,null,0x2));logger[_0x42a8('0x1b')](util[_0x42a8('0x15')](_0x42a8('0x2a'),_0xcac0ef['arg_1'],_0xcac0ef[_0x42a8('0x20')],_0xcac0ef[_0x42a8('0x1d')],_0xcac0ef['dnid'],_0xcac0ef[_0x42a8('0x21')]));_0xcac0ef['on'](_0x42a8('0x11'),errorHandler);_0xcac0ef['on'](_0x42a8('0x2b'),closeHandler);_0xcac0ef['on'](_0x42a8('0x2c'),timeoutHandler);_0xcac0ef[_0x42a8('0x23')]=![];_0xcac0ef['on'](_0x42a8('0x2d'),hangupHandler);var _0x5de793=_[_0x42a8('0x2e')](projects,[_0x42a8('0x17'),_0xcac0ef[_0x42a8('0x1c')]]);if(!_0x5de793)return Project[_0x42a8('0x2f')](_0xcac0ef);if(!_0x5de793[_0x42a8('0x30')])return Project[_0x42a8('0x31')](_0xcac0ef);return Project['initialize'](_0x5de793,_0xcac0ef);}function main(){var _0x531a53;return utilLicense[_0x42a8('0x32')]()[_0x42a8('0x25')](function(_0x51eb97){if(!_0x51eb97)return;if(_0x51eb97['voice']){if(_0x51eb97['callysquare']&&_0x51eb97[_0x42a8('0x33')]>0x0){logger[_0x42a8('0x1b')](util['format'](_0x42a8('0x34'),_0x51eb97[_0x42a8('0x33')]));_0x531a53=_0x51eb97[_0x42a8('0x33')];}else{logger[_0x42a8('0x1b')](_0x42a8('0x35'));}}else{logger[_0x42a8('0x1b')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x531a53=-0x1;}})[_0x42a8('0x25')](function(){return Project['getAll']();})[_0x42a8('0x25')](function(_0xcbf4c7){projects=_0xcbf4c7;return;})[_0x42a8('0x36')](function(_0x1bf7e8){logger['error'](_0x42a8('0x37'),_0x1bf7e8[_0x42a8('0xd')]);})[_0x42a8('0x38')](function(){var _0x2e0694=require(_0x42a8('0x39'))(config[_0x42a8('0x4')][_0x42a8('0x14')],config[_0x42a8('0x4')]['ip'],_0x531a53);_0x2e0694['on'](_0x42a8('0x11'),errorHandler);_0x2e0694['on'](_0x42a8('0x3a'),listeningHandler);_0x2e0694['on'](_0x42a8('0x3b'),connectionHandler);_0x2e0694['on'](_0x42a8('0x2b'),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 f9b95a4..20695e6 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 _0x0d03=['catch','bluebird','jayson/promise','client','http','then','error','result'];(function(_0x3f7372,_0x3f410){var _0x469320=function(_0x1b5ea7){while(--_0x1b5ea7){_0x3f7372['push'](_0x3f7372['shift']());}};_0x469320(++_0x3f410);}(_0x0d03,0x1a1));var _0x30d0=function(_0xe01ce,_0x3da228){_0xe01ce=_0xe01ce-0x0;var _0x3508d0=_0x0d03[_0xe01ce];return _0x3508d0;};'use strict';var BPromise=require(_0x30d0('0x0'));var jayson=require(_0x30d0('0x1'));var client=jayson[_0x30d0('0x2')][_0x30d0('0x3')]({'port':0x232b});function request(_0x334545,_0x205f0b){return new BPromise(function(_0x5cbc97,_0xacba2){return client['request'](_0x334545,_0x205f0b)[_0x30d0('0x4')](function(_0x359910){if(_0x359910[_0x30d0('0x5')]){return _0xacba2(_0x359910[_0x30d0('0x5')]['message']);}else{return _0x5cbc97(_0x359910[_0x30d0('0x6')]);}})[_0x30d0('0x7')](function(_0x253ab7){return _0xacba2(_0x253ab7);});});}exports['sendMailMessage']=function(_0x583fef,_0x37287e){return request('SendMail',{'account':_0x583fef,'message':_0x37287e});}; \ No newline at end of file +var _0x24a7=['sendMailMessage','SendMail','bluebird','request','then','error','result','catch'];(function(_0x34dc5e,_0x2d2e31){var _0x3665bc=function(_0x1b3a09){while(--_0x1b3a09){_0x34dc5e['push'](_0x34dc5e['shift']());}};_0x3665bc(++_0x2d2e31);}(_0x24a7,0x16a));var _0x724a=function(_0x160705,_0x574d74){_0x160705=_0x160705-0x0;var _0x3feb66=_0x24a7[_0x160705];return _0x3feb66;};'use strict';var BPromise=require(_0x724a('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x2d6ccf,_0x50a095){return new BPromise(function(_0x2ef970,_0x112a40){return client[_0x724a('0x1')](_0x2d6ccf,_0x50a095)[_0x724a('0x2')](function(_0xc2095){if(_0xc2095[_0x724a('0x3')]){return _0x112a40(_0xc2095[_0x724a('0x3')]['message']);}else{return _0x2ef970(_0xc2095[_0x724a('0x4')]);}})[_0x724a('0x5')](function(_0x4273ee){return _0x112a40(_0x4273ee);});});}exports[_0x724a('0x6')]=function(_0x545509,_0x505f21){return request(_0x724a('0x7'),{'account':_0x545509,'message':_0x505f21});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 6de5655..cba820f 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 _0x2f5d=['toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','isArray','length','source','addEdge','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined'];(function(_0x2b1b6d,_0x517c89){var _0x422682=function(_0x215ce4){while(--_0x215ce4){_0x2b1b6d['push'](_0x2b1b6d['shift']());}};_0x422682(++_0x517c89);}(_0x2f5d,0x10c));var _0xd2f5=function(_0x15f0eb,_0x3f85bc){_0x15f0eb=_0x15f0eb-0x0;var _0x42adbc=_0x2f5d[_0x15f0eb];return _0x42adbc;};'use strict';var _=require(_0xd2f5('0x0'));var moment=require(_0xd2f5('0x1'));var parser=require(_0xd2f5('0x2'));var util=require('util');var logger=require(_0xd2f5('0x3'))('agi');var rpc=require(_0xd2f5('0x4'));var mailRpc=require(_0xd2f5('0x5'));var Graph=require('./graph');var Vertices=require(_0xd2f5('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xd2f5('0x7')]()[_0xd2f5('0x8')](function(_0x12935f){logger[_0xd2f5('0x9')](_0xd2f5('0xa'),_0x12935f[_0xd2f5('0xb')]);return[];});}function addVertex(_0xbe494b,_0x5cc40a,_0x3c7c55){_0x5cc40a[_0xd2f5('0xc')]=_0x3c7c55;if(_0x5cc40a[_0xd2f5('0xd')](_0xd2f5('0xe'))){_0x5cc40a[_0xd2f5('0xf')]=parseInt(_0x5cc40a['retry'],0xa);}_0xbe494b['addVertex'](_[_0xd2f5('0x10')](_0x5cc40a,'mxCell'));}function initGraph(_0x1f9ecf,_0x1bbcbe){var _0x17ab10=new Graph();for(var _0x8c805e in _0x1f9ecf){if(_0x1f9ecf['hasOwnProperty'](_0x8c805e)){if(_[_0xd2f5('0x11')](_0x1f9ecf[_0x8c805e])){for(var _0x1fc100=0x0;_0x1fc100<_0x1f9ecf[_0x8c805e]['length'];_0x1fc100+=0x1){addVertex(_0x17ab10,_0x1f9ecf[_0x8c805e][_0x1fc100],_0x8c805e);}}else{addVertex(_0x17ab10,_0x1f9ecf[_0x8c805e],_0x8c805e);}}}for(var _0x50451f=0x0;_0x50451f<_0x1bbcbe[_0xd2f5('0x12')];_0x50451f+=0x1){if(_0x1bbcbe[_0x50451f][_0xd2f5('0x13')]&&_0x1bbcbe[_0x50451f]['target']){_0x17ab10[_0xd2f5('0x14')](_0x1bbcbe[_0x50451f]['source'],_0x1bbcbe[_0x50451f][_0xd2f5('0x15')],_0x1bbcbe[_0x50451f][_0xd2f5('0x16')]);}}return _0x17ab10;}function getRoot(_0xef2309){return parser[_0xd2f5('0x17')](_0xef2309,{'object':!![]})[_0xd2f5('0x18')][_0xd2f5('0x19')];}function inspect(_0x1b7e79){return util[_0xd2f5('0x1a')](_0x1b7e79,{'showHidden':![],'depth':null});}function initialize(_0x16fd34,_0x1313a2){var _0x1e1466=getRoot(_0x16fd34[_0xd2f5('0x1b')]);if(!_0x1e1466||!_0x1e1466[_0xd2f5('0x1c')])return;var _0x479fde,_0x2888ea,_0x28cb65;logger[_0xd2f5('0x1d')](_0xd2f5('0x19'),JSON[_0xd2f5('0x1e')](_0x1e1466,null,0x2));_0x1313a2[_0xd2f5('0x1f')]=moment()['format'](_0xd2f5('0x20'));_0x479fde=initGraph(_[_0xd2f5('0x10')](_0x1e1466,_0xd2f5('0x21')),_0x1e1466[_0xd2f5('0x21')]);_0x2888ea=new Vertices(_0x1313a2,rpc,mailRpc);logger[_0xd2f5('0x22')](util[_0xd2f5('0x23')](_0xd2f5('0x24'),_0x1313a2['arg_1'],_0x1313a2['calleridname'],_0x1313a2[_0xd2f5('0x25')],_0x1313a2['dnid'],_0x1313a2[_0xd2f5('0x26')]));_0x479fde[_0xd2f5('0x27')](_0x1e1466[_0xd2f5('0x1c')]['id'],function(_0x492258){try{_0x492258=_0x2888ea[_0xd2f5('0x28')](_0x492258);logger[_0xd2f5('0x1d')](_0xd2f5('0x29'),JSON[_0xd2f5('0x1e')](_0x492258,null,0x2));if(_0x492258[_0xd2f5('0xc')]===_0xd2f5('0x2a')){logger[_0xd2f5('0x22')](_0xd2f5('0x2b'));_0x1313a2[_0xd2f5('0x2c')]=_0x492258['context']||_0x1313a2[_0xd2f5('0x2c')];_0x1313a2[_0xd2f5('0x2d')]=_0x492258[_0xd2f5('0x2d')];_0x1313a2[_0xd2f5('0x2e')]=_0x492258[_0xd2f5('0x2e')]?_0x492258[_0xd2f5('0x2e')]-0x1:0x1;return null;}else if(_0x492258&&_0x2888ea[_0x492258['agicommand']]){_0x28cb65=_0x2888ea[_0x492258[_0xd2f5('0xc')]](_0x492258);logger[_0xd2f5('0x22')](_0xd2f5('0x2f'),JSON[_0xd2f5('0x1e')](_0x28cb65,null,0x2));if(_0x28cb65&&_0x28cb65[_0xd2f5('0x30')]===AGI_CODE_SUCCESS&&_0x28cb65[_0xd2f5('0x31')]!==AGI_RESULT_ERROR&&!_0x1313a2[_0xd2f5('0x32')]){logger[_0xd2f5('0x1d')](_0xd2f5('0x2f'),inspect(_0x28cb65));return _[_0xd2f5('0x33')](_0x28cb65['result'])?null:_0x28cb65[_0xd2f5('0x31')][_0xd2f5('0x34')]();}else{logger[_0xd2f5('0x9')](_0xd2f5('0x2f'),inspect(_0x28cb65));return null;}}else{logger[_0xd2f5('0x9')](_0xd2f5('0x35'));return null;}}catch(_0xed9469){logger['error'](_0xed9469[_0xd2f5('0xb')]);return null;}});if(_0x1e1466['finally']){logger[_0xd2f5('0x22')](util[_0xd2f5('0x23')](_0xd2f5('0x36'),_0x1313a2[_0xd2f5('0x37')],_0x1313a2[_0xd2f5('0x38')],_0x1313a2[_0xd2f5('0x25')],_0x1313a2[_0xd2f5('0x39')],_0x1313a2['uniqueid']));_0x479fde[_0xd2f5('0x27')](_0x1e1466['finally']['id'],function(_0x24bbb6){try{_0x24bbb6=_0x2888ea['clear'](_0x24bbb6);logger['debug'](_0xd2f5('0x29'),JSON[_0xd2f5('0x1e')](_0x24bbb6,null,0x2));if(_0x24bbb6&&_0x2888ea[_0x24bbb6[_0xd2f5('0xc')]]){_0x28cb65=_0x2888ea[_0x24bbb6[_0xd2f5('0xc')]](_0x24bbb6);if(_0x28cb65){logger[_0xd2f5('0x1d')](_0xd2f5('0x2f'),inspect(_0x28cb65));return _[_0xd2f5('0x33')](_0x28cb65['result'])?null:_0x28cb65[_0xd2f5('0x31')][_0xd2f5('0x34')]();}else{logger[_0xd2f5('0x9')](_0xd2f5('0x2f'),inspect(_0x28cb65));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x3b9a1c){logger[_0xd2f5('0x9')](_0x3b9a1c[_0xd2f5('0xb')]);return null;}});}logger[_0xd2f5('0x22')](util[_0xd2f5('0x23')](_0xd2f5('0x3a'),_0x1313a2['arg_1'],_0x1313a2[_0xd2f5('0x38')],_0x1313a2[_0xd2f5('0x25')],_0x1313a2[_0xd2f5('0x39')],_0x1313a2[_0xd2f5('0x26')]));logger[_0xd2f5('0x22')](util[_0xd2f5('0x23')](_0xd2f5('0x3b'),_0x1313a2[_0xd2f5('0x2c')],_0x1313a2['extension'],parseInt(_0x1313a2['priority'],0xa)+0x1));_0x1313a2['continueAt'](_0x1313a2[_0xd2f5('0x2c')],_0x1313a2[_0xd2f5('0x2d')],parseInt(_0x1313a2[_0xd2f5('0x2e')],0xa)+0x1);_0x1313a2['close']();}function handleNotFound(_0x421126){logger[_0xd2f5('0x9')](util[_0xd2f5('0x23')](_0xd2f5('0x3c'),_0x421126['arg_1']));_0x421126[_0xd2f5('0x3d')](_0x421126[_0xd2f5('0x2c')],_0x421126['extension'],parseInt(_0x421126[_0xd2f5('0x2e')],0xa)+0x1);_0x421126['close']();}function handleUnpublished(_0xf1fa){logger[_0xd2f5('0x9')](util[_0xd2f5('0x23')](_0xd2f5('0x3e'),_0xf1fa[_0xd2f5('0x37')]));_0xf1fa[_0xd2f5('0x3d')](_0xf1fa[_0xd2f5('0x2c')],_0xf1fa['extension'],parseInt(_0xf1fa[_0xd2f5('0x2e')],0xa)+0x1);_0xf1fa['close']();}module[_0xd2f5('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6137=['isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','clear','vertex','stringify','gotoc','context','extension','priority','response','code','result','evtHangup','finally','format','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','traverseBFS','isUndefined','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','exports','lodash','moment','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell'];(function(_0x5a125c,_0x155fa2){var _0x4c70af=function(_0x5dccb6){while(--_0x5dccb6){_0x5a125c['push'](_0x5a125c['shift']());}};_0x4c70af(++_0x155fa2);}(_0x6137,0x124));var _0x7613=function(_0x36a675,_0xf71343){_0x36a675=_0x36a675-0x0;var _0x41742c=_0x6137[_0x36a675];return _0x41742c;};'use strict';var _=require(_0x7613('0x0'));var moment=require(_0x7613('0x1'));var parser=require('xml2json');var util=require('util');var logger=require('../../config/logger')(_0x7613('0x2'));var rpc=require(_0x7613('0x3'));var mailRpc=require('./mailRpc');var Graph=require(_0x7613('0x4'));var Vertices=require(_0x7613('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7613('0x6')]()[_0x7613('0x7')](function(_0x59779f){logger[_0x7613('0x8')](_0x7613('0x9'),_0x59779f[_0x7613('0xa')]);return[];});}function addVertex(_0x55003,_0x384f6f,_0x595f9e){_0x384f6f[_0x7613('0xb')]=_0x595f9e;if(_0x384f6f[_0x7613('0xc')](_0x7613('0xd'))){_0x384f6f[_0x7613('0xe')]=parseInt(_0x384f6f[_0x7613('0xd')],0xa);}_0x55003[_0x7613('0xf')](_[_0x7613('0x10')](_0x384f6f,_0x7613('0x11')));}function initGraph(_0x4e21d3,_0x17b68d){var _0x29212e=new Graph();for(var _0x800778 in _0x4e21d3){if(_0x4e21d3[_0x7613('0xc')](_0x800778)){if(_[_0x7613('0x12')](_0x4e21d3[_0x800778])){for(var _0x520401=0x0;_0x520401<_0x4e21d3[_0x800778][_0x7613('0x13')];_0x520401+=0x1){addVertex(_0x29212e,_0x4e21d3[_0x800778][_0x520401],_0x800778);}}else{addVertex(_0x29212e,_0x4e21d3[_0x800778],_0x800778);}}}for(var _0x647c12=0x0;_0x647c12<_0x17b68d['length'];_0x647c12+=0x1){if(_0x17b68d[_0x647c12][_0x7613('0x14')]&&_0x17b68d[_0x647c12][_0x7613('0x15')]){_0x29212e[_0x7613('0x16')](_0x17b68d[_0x647c12]['source'],_0x17b68d[_0x647c12][_0x7613('0x15')],_0x17b68d[_0x647c12][_0x7613('0x17')]);}}return _0x29212e;}function getRoot(_0x4337f){return parser[_0x7613('0x18')](_0x4337f,{'object':!![]})[_0x7613('0x19')][_0x7613('0x1a')];}function inspect(_0x3540c2){return util[_0x7613('0x1b')](_0x3540c2,{'showHidden':![],'depth':null});}function initialize(_0x6e2a33,_0x5d7925){var _0x5d5e91=getRoot(_0x6e2a33[_0x7613('0x1c')]);if(!_0x5d5e91||!_0x5d5e91[_0x7613('0x1d')])return;var _0x963d9e,_0x2e18cd,_0x9e7910;logger[_0x7613('0x1e')](_0x7613('0x1a'),JSON['stringify'](_0x5d5e91,null,0x2));_0x5d7925[_0x7613('0x1f')]=moment()['format'](_0x7613('0x20'));_0x963d9e=initGraph(_['omit'](_0x5d5e91,_0x7613('0x11')),_0x5d5e91[_0x7613('0x11')]);_0x2e18cd=new Vertices(_0x5d7925,rpc,mailRpc);logger[_0x7613('0x21')](util['format'](_0x7613('0x22'),_0x5d7925[_0x7613('0x23')],_0x5d7925['calleridname'],_0x5d7925[_0x7613('0x24')],_0x5d7925[_0x7613('0x25')],_0x5d7925[_0x7613('0x26')]));_0x963d9e['traverseBFS'](_0x5d5e91[_0x7613('0x1d')]['id'],function(_0x36dd3e){try{_0x36dd3e=_0x2e18cd[_0x7613('0x27')](_0x36dd3e);logger[_0x7613('0x1e')](_0x7613('0x28'),JSON[_0x7613('0x29')](_0x36dd3e,null,0x2));if(_0x36dd3e[_0x7613('0xb')]===_0x7613('0x2a')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5d7925[_0x7613('0x2b')]=_0x36dd3e[_0x7613('0x2b')]||_0x5d7925[_0x7613('0x2b')];_0x5d7925[_0x7613('0x2c')]=_0x36dd3e[_0x7613('0x2c')];_0x5d7925['priority']=_0x36dd3e[_0x7613('0x2d')]?_0x36dd3e[_0x7613('0x2d')]-0x1:0x1;return null;}else if(_0x36dd3e&&_0x2e18cd[_0x36dd3e[_0x7613('0xb')]]){_0x9e7910=_0x2e18cd[_0x36dd3e[_0x7613('0xb')]](_0x36dd3e);logger[_0x7613('0x21')](_0x7613('0x2e'),JSON[_0x7613('0x29')](_0x9e7910,null,0x2));if(_0x9e7910&&_0x9e7910[_0x7613('0x2f')]===AGI_CODE_SUCCESS&&_0x9e7910[_0x7613('0x30')]!==AGI_RESULT_ERROR&&!_0x5d7925[_0x7613('0x31')]){logger['debug'](_0x7613('0x2e'),inspect(_0x9e7910));return _['isUndefined'](_0x9e7910['result'])?null:_0x9e7910['result']['toString']();}else{logger[_0x7613('0x8')](_0x7613('0x2e'),inspect(_0x9e7910));return null;}}else{logger[_0x7613('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x517c3b){logger[_0x7613('0x8')](_0x517c3b['stack']);return null;}});if(_0x5d5e91[_0x7613('0x32')]){logger[_0x7613('0x21')](util[_0x7613('0x33')](_0x7613('0x34'),_0x5d7925['arg_1'],_0x5d7925[_0x7613('0x35')],_0x5d7925[_0x7613('0x24')],_0x5d7925[_0x7613('0x25')],_0x5d7925[_0x7613('0x26')]));_0x963d9e[_0x7613('0x36')](_0x5d5e91[_0x7613('0x32')]['id'],function(_0x4b6c8d){try{_0x4b6c8d=_0x2e18cd['clear'](_0x4b6c8d);logger[_0x7613('0x1e')](_0x7613('0x28'),JSON[_0x7613('0x29')](_0x4b6c8d,null,0x2));if(_0x4b6c8d&&_0x2e18cd[_0x4b6c8d['agicommand']]){_0x9e7910=_0x2e18cd[_0x4b6c8d[_0x7613('0xb')]](_0x4b6c8d);if(_0x9e7910){logger['debug'](_0x7613('0x2e'),inspect(_0x9e7910));return _[_0x7613('0x37')](_0x9e7910[_0x7613('0x30')])?null:_0x9e7910['result']['toString']();}else{logger[_0x7613('0x8')](_0x7613('0x2e'),inspect(_0x9e7910));return null;}}else{logger[_0x7613('0x8')](_0x7613('0x38'));return null;}}catch(_0xe79bd8){logger[_0x7613('0x8')](_0xe79bd8[_0x7613('0xa')]);return null;}});}logger['info'](util['format'](_0x7613('0x39'),_0x5d7925[_0x7613('0x23')],_0x5d7925['calleridname'],_0x5d7925[_0x7613('0x24')],_0x5d7925['dnid'],_0x5d7925[_0x7613('0x26')]));logger[_0x7613('0x21')](util[_0x7613('0x33')](_0x7613('0x3a'),_0x5d7925['context'],_0x5d7925[_0x7613('0x2c')],parseInt(_0x5d7925[_0x7613('0x2d')],0xa)+0x1));_0x5d7925[_0x7613('0x3b')](_0x5d7925[_0x7613('0x2b')],_0x5d7925[_0x7613('0x2c')],parseInt(_0x5d7925[_0x7613('0x2d')],0xa)+0x1);_0x5d7925['close']();}function handleNotFound(_0x333470){logger[_0x7613('0x8')](util[_0x7613('0x33')]('Project\x20%s\x20not\x20found',_0x333470[_0x7613('0x23')]));_0x333470[_0x7613('0x3b')](_0x333470[_0x7613('0x2b')],_0x333470[_0x7613('0x2c')],parseInt(_0x333470[_0x7613('0x2d')],0xa)+0x1);_0x333470[_0x7613('0x3c')]();}function handleUnpublished(_0x2b08b7){logger['error'](util[_0x7613('0x33')]('Project\x20%s\x20not\x20published',_0x2b08b7['arg_1']));_0x2b08b7[_0x7613('0x3b')](_0x2b08b7[_0x7613('0x2b')],_0x2b08b7['extension'],parseInt(_0x2b08b7[_0x7613('0x2d')],0xa)+0x1);_0x2b08b7[_0x7613('0x3c')]();}module[_0x7613('0x3d')]={'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 1ea490b..c9f32ca 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 _0x8a01=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','slice','trim','length','emit','headers','line','exports','stream','Transform','call','_localBuffer'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x8a01,0x13c));var _0x18a0=function(_0x151ed4,_0x23cfb8){_0x151ed4=_0x151ed4-0x0;var _0x1c6f7e=_0x8a01[_0x151ed4];return _0x1c6f7e;};'use strict';var util=require('util');var Transform=require(_0x18a0('0x0'))[_0x18a0('0x1')];function AGIReply(_0x3f9dd4){Transform[_0x18a0('0x2')](this,_0x3f9dd4);this[_0x18a0('0x3')]='';this[_0x18a0('0x4')]=![];}util[_0x18a0('0x5')](AGIReply,Transform);AGIReply[_0x18a0('0x6')][_0x18a0('0x7')]=function(_0x124108,_0x17ee6f,_0x49198e){var _0x343996='\x0a',_0x297f53=['\x0a\x0a',_0x18a0('0x8')],_0x11a8dc=-0x1,_0x494331=-0x1,_0x14c039='',_0x2c7596=0x0,_0x42dcf6='',_0x412989='';this[_0x18a0('0x3')]+=_0x124108[_0x18a0('0x9')]();_0x42dcf6=this['_localBuffer'];if(!this['_inBody']){_0x2c7596=0x0;while(_0x297f53[_0x2c7596]){while((_0x494331=_0x42dcf6['indexOf'](_0x297f53[_0x2c7596]))!=-0x1){_0x14c039=_0x297f53[_0x2c7596];_0x412989=_0x42dcf6[_0x18a0('0xa')](0x0,_0x494331);_0x42dcf6=_0x42dcf6['substring'](_0x494331+_0x14c039['length']);var _0x227a7c=_0x412989[_0x18a0('0xb')](_0x343996),_0x55befe=0x0,_0x1552cd={},_0x1ef43e='',_0x594576='',_0x4ec803=-0x1;while(_0x227a7c[_0x55befe]){_0x4ec803=_0x227a7c[_0x55befe][_0x18a0('0xc')](':');if(_0x4ec803!=-0x1){_0x1ef43e=_0x227a7c[_0x55befe][_0x18a0('0xd')](0x0,_0x4ec803)[_0x18a0('0xe')]();_0x594576=_0x227a7c[_0x55befe][_0x18a0('0xd')](_0x4ec803+0x1)[_0x18a0('0xe')]();if(_0x1ef43e[_0x18a0('0xf')]>0x0){_0x1552cd[_0x1ef43e]=_0x594576;}}else{}_0x55befe++;}this[_0x18a0('0x10')](_0x18a0('0x11'),_0x1552cd);this[_0x18a0('0x4')]=!![];}_0x2c7596++;}this[_0x18a0('0x3')]=_0x42dcf6;}else{while((_0x11a8dc=_0x42dcf6[_0x18a0('0xc')](_0x343996))!=-0x1){_0x412989=_0x42dcf6[_0x18a0('0xa')](0x0,_0x11a8dc);this['emit'](_0x18a0('0x12'),_0x412989);_0x42dcf6=_0x42dcf6[_0x18a0('0xa')](_0x11a8dc+_0x343996[_0x18a0('0xf')]);}this[_0x18a0('0x3')]=_0x42dcf6;}_0x49198e();};module[_0x18a0('0x13')]=AGIReply; \ No newline at end of file +var _0x92a2=['length','split','slice','trim','emit','_inBody','line','exports','util','stream','Transform','_localBuffer','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring'];(function(_0x2a6022,_0x5a6970){var _0x1b778c=function(_0x1436f1){while(--_0x1436f1){_0x2a6022['push'](_0x2a6022['shift']());}};_0x1b778c(++_0x5a6970);}(_0x92a2,0x1ee));var _0x292a=function(_0x5da8a2,_0x210247){_0x5da8a2=_0x5da8a2-0x0;var _0x11e320=_0x92a2[_0x5da8a2];return _0x11e320;};'use strict';var util=require(_0x292a('0x0'));var Transform=require(_0x292a('0x1'))[_0x292a('0x2')];function AGIReply(_0x1ce05b){Transform['call'](this,_0x1ce05b);this[_0x292a('0x3')]='';this['_inBody']=![];}util[_0x292a('0x4')](AGIReply,Transform);AGIReply[_0x292a('0x5')]['_transform']=function(_0x4fefb9,_0x310511,_0x3a8650){var _0x5b0591='\x0a',_0x3b7ec3=['\x0a\x0a',_0x292a('0x6')],_0xde082c=-0x1,_0x41f1f0=-0x1,_0x3e5c02='',_0x419de4=0x0,_0x47e3b8='',_0xebcd7c='';this['_localBuffer']+=_0x4fefb9[_0x292a('0x7')]();_0x47e3b8=this[_0x292a('0x3')];if(!this['_inBody']){_0x419de4=0x0;while(_0x3b7ec3[_0x419de4]){while((_0x41f1f0=_0x47e3b8[_0x292a('0x8')](_0x3b7ec3[_0x419de4]))!=-0x1){_0x3e5c02=_0x3b7ec3[_0x419de4];_0xebcd7c=_0x47e3b8['substring'](0x0,_0x41f1f0);_0x47e3b8=_0x47e3b8[_0x292a('0x9')](_0x41f1f0+_0x3e5c02[_0x292a('0xa')]);var _0x1af2da=_0xebcd7c[_0x292a('0xb')](_0x5b0591),_0x442cfa=0x0,_0x5d283f={},_0x466e2f='',_0x3b659e='',_0x54260f=-0x1;while(_0x1af2da[_0x442cfa]){_0x54260f=_0x1af2da[_0x442cfa][_0x292a('0x8')](':');if(_0x54260f!=-0x1){_0x466e2f=_0x1af2da[_0x442cfa][_0x292a('0xc')](0x0,_0x54260f)[_0x292a('0xd')]();_0x3b659e=_0x1af2da[_0x442cfa][_0x292a('0xc')](_0x54260f+0x1)[_0x292a('0xd')]();if(_0x466e2f['length']>0x0){_0x5d283f[_0x466e2f]=_0x3b659e;}}else{}_0x442cfa++;}this[_0x292a('0xe')]('headers',_0x5d283f);this[_0x292a('0xf')]=!![];}_0x419de4++;}this['_localBuffer']=_0x47e3b8;}else{while((_0xde082c=_0x47e3b8[_0x292a('0x8')](_0x5b0591))!=-0x1){_0xebcd7c=_0x47e3b8['substring'](0x0,_0xde082c);this['emit'](_0x292a('0x10'),_0xebcd7c);_0x47e3b8=_0x47e3b8[_0x292a('0x9')](_0xde082c+_0x5b0591[_0x292a('0xa')]);}this[_0x292a('0x3')]=_0x47e3b8;}_0x3a8650();};module[_0x292a('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index fe8d86a..1de51f5 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 _0xac95=['client','request','then','error','message','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','MailServerOut','CloudProvider','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','lodash','moment','jayson/promise'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xac95,0xa8));var _0x5ac9=function(_0x99fabc,_0x44ab39){_0x99fabc=_0x99fabc-0x0;var _0x6b4d5f=_0xac95[_0x99fabc];return _0x6b4d5f;};'use strict';var _=require(_0x5ac9('0x0'));var moment=require(_0x5ac9('0x1'));var jayson=require(_0x5ac9('0x2'));var client=jayson[_0x5ac9('0x3')]['http']({'port':0x2329});function request(_0x57ca1c,_0x4562f2){return new Promise(function(_0x1ebdea,_0x550511){return client[_0x5ac9('0x4')](_0x57ca1c,_0x4562f2)[_0x5ac9('0x5')](function(_0x5b445a){if(_0x5b445a[_0x5ac9('0x6')]){return _0x550511(_0x5b445a[_0x5ac9('0x6')][_0x5ac9('0x7')]);}else{return _0x1ebdea(_0x5b445a['result']);}})['catch'](function(_0x32afbc){return _0x550511(_0x32afbc);});});}exports[_0x5ac9('0x8')]=function(){return request(_0x5ac9('0x9'),{'options':{'raw':![],'attributes':['id',_0x5ac9('0xa'),_0x5ac9('0xb')]}});};exports[_0x5ac9('0xc')]=function(_0x5ad3b7){return request(_0x5ac9('0xd'),{'options':{'raw':![],'where':{'name':_0x5ad3b7},'attributes':[_0x5ac9('0xb')]}});};exports['getMailAccountById']=function(_0x28b5b9){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x28b5b9},'include':[{'model':_0x5ac9('0xe'),'as':'Smtp','include':[{'model':_0x5ac9('0xf'),'as':_0x5ac9('0xf')}]}],'attributes':['id',_0x5ac9('0xa'),_0x5ac9('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x517409){return request(_0x5ac9('0xd'),{'options':{'where':{'id':_0x517409},'attributes':['name']}});};exports[_0x5ac9('0x11')]=function(_0x364007){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x364007},'attributes':[_0x5ac9('0xa')]}});};exports[_0x5ac9('0x12')]=function(_0x3f8fac){return request(_0x5ac9('0x13'),{'options':{'where':{'id':_0x3f8fac},'attributes':[_0x5ac9('0xa')]}});};exports[_0x5ac9('0x14')]=function(_0x44a5b1){return request(_0x5ac9('0x15'),{'options':{'where':{'id':_0x44a5b1},'attributes':[_0x5ac9('0x16')]}});};exports['getUserById']=function(_0x53a8db){return request(_0x5ac9('0x17'),{'options':{'where':{'id':_0x53a8db},'attributes':[_0x5ac9('0xa')]}});};exports[_0x5ac9('0x18')]=function(_0x4463ff){return request(_0x5ac9('0x19'),{'options':{'where':{'phone':_0x4463ff[_0x5ac9('0x1a')]},'attributes':['id']}});};exports[_0x5ac9('0x1b')]=function(_0x429bf3){return request(_0x5ac9('0x1c'),{'options':{'where':{'id':_0x429bf3},'attributes':[_0x5ac9('0xa')]}});};exports[_0x5ac9('0x1d')]=function(_0x2b144e){return request(_0x5ac9('0x1e'),{'options':{'where':{'id':_0x2b144e},'attributes':['save_name']}});};exports[_0x5ac9('0x1f')]=function(_0x1f5546){return request(_0x5ac9('0x20'),{'options':{'raw':![],'where':{'id':_0x1f5546},'include':[{'model':_0x5ac9('0x21'),'as':_0x5ac9('0x22')}]}});};exports['getSmsAccountById']=function(_0x45417d){return request(_0x5ac9('0x23'),{'options':{'where':{'id':_0x45417d},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x5a4664){return request(_0x5ac9('0x24'),{'body':_0x5a4664});};exports[_0x5ac9('0x25')]=function(_0x4e3b64){return request('CreateSquareDetailsReport',{'body':_0x4e3b64});};exports[_0x5ac9('0x26')]=function(_0x59c3fd){return request('CreateSquareReport',{'body':_[_0x5ac9('0x27')](_0x59c3fd,{'project_name':_0x59c3fd['arg_1'],'prev_project_name':_0x59c3fd[_0x5ac9('0x28')]||'','is_subproject':_0x59c3fd[_0x5ac9('0x28')]?!![]:![],'leaveAt':moment()[_0x5ac9('0x29')](_0x5ac9('0x2a'))})});};exports[_0x5ac9('0x2b')]=function(_0x174cfe){return request(_0x5ac9('0x2c'),{'body':_0x174cfe});};exports[_0x5ac9('0x2d')]=function(_0x203d19){return request('CreateSquareMessage',{'body':_0x203d19});};exports[_0x5ac9('0x2e')]=function(_0x14a7fe){return request(_0x5ac9('0x2f'),{'options':{'raw':![],'where':{'phone':_0x14a7fe[_0x5ac9('0x1a')],'ListId':_0x14a7fe[_0x5ac9('0x30')]}}})['then'](function(_0x47f6ad){if(_0x47f6ad){return _0x47f6ad;}return request(_0x5ac9('0x31'),{'body':_0x14a7fe});});};exports[_0x5ac9('0x32')]=function(_0x4a784e){return request(_0x5ac9('0x33'),{'options':{'where':{'id':_0x4a784e},'attributes':['name']}});};exports[_0x5ac9('0x34')]=function(_0x2c85dc,_0x1d0d5a){return request('LoginUser',{'body':{'interface':_0x1d0d5a},'options':{'where':_0x2c85dc}});};exports[_0x5ac9('0x35')]=function(_0x128866,_0x446050,_0x30fb2b){return request(_0x5ac9('0x36'),{'body':{'type':_0x446050,'uniqueid':_0x30fb2b},'options':{'where':_0x128866}});};exports[_0x5ac9('0x37')]=function(_0x4e7aee){return request('UnpauseUser',{'body':{},'options':{'where':_0x4e7aee}});};exports[_0x5ac9('0x38')]=function(_0x53ef31){return request('LogoutUser',{'body':{},'options':{'where':_0x53ef31}});}; \ No newline at end of file +var _0xca9e=['getVariableById','ShowVariable','ShowSquareOdbc','getUserById','GetContactByPhone','phone','getSoundById','ShowSound','save_name','ShowInterval','Intervals','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','result','catch','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById'];(function(_0xf80e54,_0x46395e){var _0x1dca27=function(_0xb31b34){while(--_0xb31b34){_0xf80e54['push'](_0xf80e54['shift']());}};_0x1dca27(++_0x46395e);}(_0xca9e,0x136));var _0xeca9=function(_0x133f3f,_0x2fd541){_0x133f3f=_0x133f3f-0x0;var _0x119b8a=_0xca9e[_0x133f3f];return _0x119b8a;};'use strict';var _=require(_0xeca9('0x0'));var moment=require(_0xeca9('0x1'));var jayson=require(_0xeca9('0x2'));var client=jayson[_0xeca9('0x3')][_0xeca9('0x4')]({'port':0x2329});function request(_0x1443e3,_0x8dbabb){return new Promise(function(_0x2c6185,_0x1b2864){return client[_0xeca9('0x5')](_0x1443e3,_0x8dbabb)[_0xeca9('0x6')](function(_0x1c4ce6){if(_0x1c4ce6[_0xeca9('0x7')]){return _0x1b2864(_0x1c4ce6[_0xeca9('0x7')]['message']);}else{return _0x2c6185(_0x1c4ce6[_0xeca9('0x8')]);}})[_0xeca9('0x9')](function(_0x4d57ee){return _0x1b2864(_0x4d57ee);});});}exports['getSquareProjects']=function(){return request(_0xeca9('0xa'),{'options':{'raw':![],'attributes':['id',_0xeca9('0xb'),_0xeca9('0xc')]}});};exports['getSquareProject']=function(_0x2dba50){return request(_0xeca9('0xd'),{'options':{'raw':![],'where':{'name':_0x2dba50},'attributes':[_0xeca9('0xc')]}});};exports[_0xeca9('0xe')]=function(_0x19584d){return request(_0xeca9('0xf'),{'options':{'raw':![],'where':{'id':_0x19584d},'include':[{'model':'MailServerOut','as':_0xeca9('0x10'),'include':[{'model':_0xeca9('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0xeca9('0xb'),'email'],'smtp':!![]}});};exports[_0xeca9('0x12')]=function(_0x5e7e73){return request('ShowSquareProject',{'options':{'where':{'id':_0x5e7e73},'attributes':[_0xeca9('0xb')]}});};exports[_0xeca9('0x13')]=function(_0x1ba9e9){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1ba9e9},'attributes':[_0xeca9('0xb')]}});};exports[_0xeca9('0x14')]=function(_0x910814){return request(_0xeca9('0x15'),{'options':{'where':{'id':_0x910814},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x964e05){return request(_0xeca9('0x16'),{'options':{'where':{'id':_0x964e05},'attributes':['dsn']}});};exports[_0xeca9('0x17')]=function(_0x11bf78){return request('ShowUser',{'options':{'where':{'id':_0x11bf78},'attributes':['name']}});};exports['getContactByPhone']=function(_0x132008){return request(_0xeca9('0x18'),{'options':{'where':{'phone':_0x132008[_0xeca9('0x19')]},'attributes':['id']}});};exports['getTrunkById']=function(_0xf1ef9f){return request('ShowTrunk',{'options':{'where':{'id':_0xf1ef9f},'attributes':['name']}});};exports[_0xeca9('0x1a')]=function(_0x5df8e9){return request(_0xeca9('0x1b'),{'options':{'where':{'id':_0x5df8e9},'attributes':[_0xeca9('0x1c')]}});};exports['getIntervalById']=function(_0x5a2cca){return request(_0xeca9('0x1d'),{'options':{'raw':![],'where':{'id':_0x5a2cca},'include':[{'model':'Interval','as':_0xeca9('0x1e')}]}});};exports['getSmsAccountById']=function(_0x3a3608){return request(_0xeca9('0x1f'),{'options':{'where':{'id':_0x3a3608},'attributes':['id',_0xeca9('0xb')]}});};exports['createSmsMessage']=function(_0x3fcfb8){return request(_0xeca9('0x20'),{'body':_0x3fcfb8});};exports['createSquareDetailsReport']=function(_0x4593b5){return request(_0xeca9('0x21'),{'body':_0x4593b5});};exports[_0xeca9('0x22')]=function(_0x26bb0c){return request('CreateSquareReport',{'body':_[_0xeca9('0x23')](_0x26bb0c,{'project_name':_0x26bb0c['arg_1'],'prev_project_name':_0x26bb0c[_0xeca9('0x24')]||'','is_subproject':_0x26bb0c[_0xeca9('0x24')]?!![]:![],'leaveAt':moment()[_0xeca9('0x25')](_0xeca9('0x26'))})});};exports[_0xeca9('0x27')]=function(_0x2f63dc){return request(_0xeca9('0x28'),{'body':_0x2f63dc});};exports[_0xeca9('0x29')]=function(_0x467979){return request(_0xeca9('0x2a'),{'body':_0x467979});};exports[_0xeca9('0x2b')]=function(_0x3b0aab){return request(_0xeca9('0x2c'),{'options':{'raw':![],'where':{'phone':_0x3b0aab[_0xeca9('0x19')],'ListId':_0x3b0aab[_0xeca9('0x2d')]}}})['then'](function(_0x4db3e2){if(_0x4db3e2){return _0x4db3e2;}return request('CreateCmContact',{'body':_0x3b0aab});});};exports[_0xeca9('0x2e')]=function(_0x4ffb8a){return request(_0xeca9('0x2f'),{'options':{'where':{'id':_0x4ffb8a},'attributes':[_0xeca9('0xb')]}});};exports[_0xeca9('0x30')]=function(_0x36e75e,_0x24e96e){return request(_0xeca9('0x31'),{'body':{'interface':_0x24e96e},'options':{'where':_0x36e75e}});};exports['agentPause']=function(_0x3b60c3,_0x5d2451,_0x43fbff){return request(_0xeca9('0x32'),{'body':{'type':_0x5d2451,'uniqueid':_0x43fbff},'options':{'where':_0x3b60c3}});};exports[_0xeca9('0x33')]=function(_0x5ee4a6){return request(_0xeca9('0x34'),{'body':{},'options':{'where':_0x5ee4a6}});};exports[_0xeca9('0x35')]=function(_0x20cd78){return request(_0xeca9('0x36'),{'body':{},'options':{'where':_0x20cd78}});}; \ 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 957ce98..4d1a084 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 _0xd5da=['./lex','./polly'];(function(_0x5c2d8a,_0x5b9a66){var _0x5e6810=function(_0x20afb6){while(--_0x20afb6){_0x5c2d8a['push'](_0x5c2d8a['shift']());}};_0x5e6810(++_0x5b9a66);}(_0xd5da,0x9f));var _0xad5d=function(_0x1cfd3b,_0xf63d70){_0x1cfd3b=_0x1cfd3b-0x0;var _0x274311=_0xd5da[_0x1cfd3b];return _0x274311;};var polly=require(_0xad5d('0x0'));var lex=require(_0xad5d('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1354=['./lex','exports','./polly'];(function(_0x238947,_0x31bf0b){var _0x55f7df=function(_0x250e2e){while(--_0x250e2e){_0x238947['push'](_0x238947['shift']());}};_0x55f7df(++_0x31bf0b);}(_0x1354,0x95));var _0x4135=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x1354[_0x32d457];return _0x338386;};var polly=require(_0x4135('0x0'));var lex=require(_0x4135('0x1'));module[_0x4135('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 69834e6..42aa3d6 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 _0xe706=['exports','./lib/api'];(function(_0x1cc4c1,_0x41ec38){var _0x4e840d=function(_0x4bb5da){while(--_0x4bb5da){_0x1cc4c1['push'](_0x1cc4c1['shift']());}};_0x4e840d(++_0x41ec38);}(_0xe706,0xa3));var _0x6e70=function(_0x2ac8f0,_0x21d3df){_0x2ac8f0=_0x2ac8f0-0x0;var _0x4e9e93=_0xe706[_0x2ac8f0];return _0x4e9e93;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ No newline at end of file +var _0xb688=['exports'];(function(_0x57949b,_0x567b1d){var _0x181dc7=function(_0x71e3f2){while(--_0x71e3f2){_0x57949b['push'](_0x57949b['shift']());}};_0x181dc7(++_0x567b1d);}(_0xb688,0xcf));var _0x8b68=function(_0x2a5065,_0x3e8440){_0x2a5065=_0x2a5065-0x0;var _0x30045d=_0xb688[_0x2a5065];return _0x30045d;};'use strict';var lex=require('./lib/api');module[_0x8b68('0x0')]=function(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c){return lex(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c);}; \ 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 08756c5..223d251 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(_0x34f381,_0x3cf900){var _0x10279b=function(_0x4f55fa){while(--_0x4f55fa){_0x34f381['push'](_0x34f381['shift']());}};_0x10279b(++_0x3cf900);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x2f5bb0,_0x458bb0){var _0x9cd649=function(_0x5b5e0d){while(--_0x5b5e0d){_0x2f5bb0['push'](_0x2f5bb0['shift']());}};_0x9cd649(++_0x458bb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 db606e1..9c755d2 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 _0x17e8=['exports','./lib/api'];(function(_0x378472,_0x4d8511){var _0x503cdf=function(_0x5aa734){while(--_0x5aa734){_0x378472['push'](_0x378472['shift']());}};_0x503cdf(++_0x4d8511);}(_0x17e8,0x139));var _0x817e=function(_0x3fb689,_0x33597d){_0x3fb689=_0x3fb689-0x0;var _0x394698=_0x17e8[_0x3fb689];return _0x394698;};'use strict';var polly=require(_0x817e('0x0'));module[_0x817e('0x1')]=function(_0x1a5d24,_0x4cc426,_0x238427,_0x3e1f28,_0x8b5e34,_0x1f05f3,_0x3ab6be){return polly(_0x1a5d24,_0x4cc426,_0x238427,_0x3e1f28,_0x8b5e34,_0x1f05f3,_0x3ab6be);}; \ No newline at end of file +var _0x2244=['exports'];(function(_0x367c53,_0x52cfb0){var _0x37c330=function(_0x41dfb3){while(--_0x41dfb3){_0x367c53['push'](_0x367c53['shift']());}};_0x37c330(++_0x52cfb0);}(_0x2244,0x19b));var _0x4224=function(_0x13458f,_0x43a366){_0x13458f=_0x13458f-0x0;var _0x4d1c0e=_0x2244[_0x13458f];return _0x4d1c0e;};'use strict';var polly=require('./lib/api');module[_0x4224('0x0')]=function(_0x34be2f,_0xd8f7c5,_0x10b664,_0x57222a,_0x4e1b13,_0x2d6db8,_0x5a23e8){return polly(_0x34be2f,_0xd8f7c5,_0x10b664,_0x57222a,_0x4e1b13,_0x2d6db8,_0x5a23e8);}; \ 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 dab21ca..2d0a5fc 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 _0xe85c=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream'];(function(_0x5639a9,_0x35960b){var _0x624d20=function(_0x59f6ce){while(--_0x59f6ce){_0x5639a9['push'](_0x5639a9['shift']());}};_0x624d20(++_0x35960b);}(_0xe85c,0x1bc));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xce85('0x0'));var BPromise=require(_0xce85('0x1'));var rs=require(_0xce85('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x21af5f,_0x9e8b33,_0x5118ad){return new BPromise(function(_0x2acc58,_0x589ba1){_0x21af5f[_0xce85('0x3')](_0x9e8b33,function(_0x42d8bb,_0x3c4ea4){if(_0x42d8bb){_0x589ba1(_0x42d8bb);}else if(_0x3c4ea4){if(_0x3c4ea4['AudioStream']instanceof Buffer){fs[_0xce85('0x4')](_0x5118ad,_0x3c4ea4[_0xce85('0x5')],function(_0x1626d0){if(_0x1626d0){_0x589ba1(_0x1626d0);}else{_0x2acc58();}});}else{_0x589ba1(new Error(_0xce85('0x6')));}}else{_0x589ba1(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xce85('0x7')]=function(_0x14365d,_0x393298,_0x1f9b5b,_0x303b1a,_0x29abcf,_0xfa0368,_0x1c569a){var _0x5f303c=new AWS[(_0xce85('0x8'))]({'accessKeyId':_0x14365d,'secretAccessKey':_0x393298,'region':_0x1f9b5b});var _0x199c22={'Text':_0x29abcf,'TextType':_0xfa0368||'text','OutputFormat':_0xce85('0x9'),'VoiceId':_0x303b1a};return pollyResult(_0x5f303c,_0x199c22,_0x1c569a);}; \ No newline at end of file +var _0xe278=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x38606d,_0x2e525f){var _0x15aea2=function(_0x12a5a8){while(--_0x12a5a8){_0x38606d['push'](_0x38606d['shift']());}};_0x15aea2(++_0x2e525f);}(_0xe278,0x1f3));var _0x8e27=function(_0x23c5e1,_0x162acb){_0x23c5e1=_0x23c5e1-0x0;var _0x1df3b9=_0xe278[_0x23c5e1];return _0x1df3b9;};'use strict';var fs=require('fs');var path=require(_0x8e27('0x0'));var BPromise=require(_0x8e27('0x1'));var rs=require(_0x8e27('0x2'));var AWS=require(_0x8e27('0x3'));function pollyResult(_0xa418cd,_0x341745,_0xc3b088){return new BPromise(function(_0x137995,_0x359142){_0xa418cd[_0x8e27('0x4')](_0x341745,function(_0x4bf155,_0x463f68){if(_0x4bf155){_0x359142(_0x4bf155);}else if(_0x463f68){if(_0x463f68['AudioStream']instanceof Buffer){fs['writeFile'](_0xc3b088,_0x463f68[_0x8e27('0x5')],function(_0x46599c){if(_0x46599c){_0x359142(_0x46599c);}else{_0x137995();}});}else{_0x359142(new Error(_0x8e27('0x6')));}}else{_0x359142(new Error(_0x8e27('0x7')));}});});}module[_0x8e27('0x8')]=function(_0x34840e,_0x22afc0,_0x50344d,_0x122ae4,_0x47d16e,_0x3e0109,_0x2d5b1e){var _0x3c5452=new AWS[(_0x8e27('0x9'))]({'accessKeyId':_0x34840e,'secretAccessKey':_0x22afc0,'region':_0x50344d});var _0x21a9f3={'Text':_0x47d16e,'TextType':_0x3e0109||_0x8e27('0xa'),'OutputFormat':'mp3','VoiceId':_0x122ae4};return pollyResult(_0x3c5452,_0x21a9f3,_0x2d5b1e);}; \ 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 a9eb696..7ffeb55 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 _0xc365=['exports','./lib/api'];(function(_0x29b2a2,_0x4b7224){var _0x836e8c=function(_0xbea41e){while(--_0xbea41e){_0x29b2a2['push'](_0x29b2a2['shift']());}};_0x836e8c(++_0x4b7224);}(_0xc365,0x19d));var _0x5c36=function(_0x455eb6,_0x3d3dfb){_0x455eb6=_0x455eb6-0x0;var _0x15fa87=_0xc365[_0x455eb6];return _0x15fa87;};'use strict';var asr=require(_0x5c36('0x0'));module[_0x5c36('0x1')]=function(_0x50354a,_0x2e03ca,_0x24671a,_0x425835){return asr(_0x50354a,_0x2e03ca,_0x24671a);}; \ No newline at end of file +var _0xa0a1=['./lib/api','exports'];(function(_0x37192c,_0x168c6f){var _0x1b05ce=function(_0x3df572){while(--_0x3df572){_0x37192c['push'](_0x37192c['shift']());}};_0x1b05ce(++_0x168c6f);}(_0xa0a1,0xa6));var _0x1a0a=function(_0x38d396,_0x5d86d7){_0x38d396=_0x38d396-0x0;var _0x3a3ba8=_0xa0a1[_0x38d396];return _0x3a3ba8;};'use strict';var asr=require(_0x1a0a('0x0'));module[_0x1a0a('0x1')]=function(_0x21efdb,_0x231c63,_0x26e515,_0x4fa7e4){return asr(_0x21efdb,_0x231c63,_0x26e515);}; \ 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 6f35cb7..c39fdcd 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 _0x49e9=['readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var url=require(_0x949e('0x0'));var BPromise=require(_0x949e('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x949e('0x2')]=function(_0x1db1b8,_0x259795,_0x5c303a){return new BPromise(function(_0x4f1295,_0x114f65){var _0x4c284b;if(typeof _0x1db1b8!==_0x949e('0x3')||_0x1db1b8[_0x949e('0x4')]===0x0){return _0x114f65(_0x949e('0x5'));}if(typeof _0x259795!=='string'||_0x259795[_0x949e('0x4')]===0x0){return _0x114f65(_0x949e('0x6'));}if(typeof _0x5c303a!==_0x949e('0x7')&&(typeof _0x5c303a!==_0x949e('0x3')||_0x5c303a[_0x949e('0x4')]===0x0)){return _0x114f65(_0x949e('0x8'));}try{_0x4c284b=fs[_0x949e('0x9')](_0x1db1b8)['toString'](_0x949e('0xa'));}catch(_0x50ca96){return _0x114f65(_0x50ca96);}return _0x4f1295({'method':_0x949e('0xb'),'uri':host+_0x949e('0xc')+_0x259795,'body':{'config':{'encoding':_0x949e('0xd'),'sampleRateHertz':'8000','languageCode':_0x5c303a},'audio':{'content':_0x4c284b}},'json':!![]});});}; \ No newline at end of file +var _0x34e8=['string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x168ddc,_0x476d41){var _0x43b3ba=function(_0xdebc79){while(--_0xdebc79){_0x168ddc['push'](_0x168ddc['shift']());}};_0x43b3ba(++_0x476d41);}(_0x34e8,0x12c));var _0x834e=function(_0x37325d,_0x5ebb6e){_0x37325d=_0x37325d-0x0;var _0x333f9b=_0x34e8[_0x37325d];return _0x333f9b;};'use strict';var url=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var fs=require('fs');var host=_0x834e('0x2');module[_0x834e('0x3')]=function(_0x530939,_0x832422,_0x21e2e0){return new BPromise(function(_0x472111,_0x31bf20){var _0x289ef2;if(typeof _0x530939!==_0x834e('0x4')||_0x530939[_0x834e('0x5')]===0x0){return _0x31bf20('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x832422!==_0x834e('0x4')||_0x832422['length']===0x0){return _0x31bf20(_0x834e('0x6'));}if(typeof _0x21e2e0!==_0x834e('0x7')&&(typeof _0x21e2e0!==_0x834e('0x4')||_0x21e2e0[_0x834e('0x5')]===0x0)){return _0x31bf20(_0x834e('0x8'));}try{_0x289ef2=fs[_0x834e('0x9')](_0x530939)[_0x834e('0xa')](_0x834e('0xb'));}catch(_0x3bdda9){return _0x31bf20(_0x3bdda9);}return _0x472111({'method':_0x834e('0xc'),'uri':host+_0x834e('0xd')+_0x832422,'body':{'config':{'encoding':_0x834e('0xe'),'sampleRateHertz':_0x834e('0xf'),'languageCode':_0x21e2e0},'audio':{'content':_0x289ef2}},'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 66489fc..73d4cf8 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 _0x8812=['./asr'];(function(_0x296cbc,_0x27b779){var _0x21737e=function(_0x1c1a46){while(--_0x1c1a46){_0x296cbc['push'](_0x296cbc['shift']());}};_0x21737e(++_0x27b779);}(_0x8812,0x90));var _0x2881=function(_0x118463,_0x302ea5){_0x118463=_0x118463-0x0;var _0x4e3d2d=_0x8812[_0x118463];return _0x4e3d2d;};var asr=require(_0x2881('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x2c45=['./asr'];(function(_0x86b9c9,_0x35b24f){var _0x33249c=function(_0x2910f7){while(--_0x2910f7){_0x86b9c9['push'](_0x86b9c9['shift']());}};_0x33249c(++_0x35b24f);}(_0x2c45,0x1da));var _0x52c4=function(_0x286b06,_0xac53cd){_0x286b06=_0x286b06-0x0;var _0xd1c398=_0x2c45[_0x286b06];return _0xd1c398;};var asr=require(_0x52c4('0x0'));module['exports']={'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 225c540..6e0ffbe 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 _0xa71c=['googleTTS','utf8','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','generate','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','message','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','allRequiredParamsPresent','queryResult','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','sestekNDA','nda','text','CustomAction','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','get','statusCode','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','data','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','base64','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','then','tmp','.mp3','from','audioContent','writeFile','777'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xa71c,0x1d6));var _0xca71=function(_0x5cc06e,_0x38e805){_0x5cc06e=_0x5cc06e-0x0;var _0x1e569f=_0xa71c[_0x5cc06e];return _0x1e569f;};'use strict';var apiai=require(_0xca71('0x0'));var BPromise=require(_0xca71('0x1'));var dialogflow=require(_0xca71('0x2'));var fs=require('fs');var http=require(_0xca71('0x3'));var https=require(_0xca71('0x4'));var md5=require('md5');var path=require(_0xca71('0x5'));var querystring=require('querystring');var rp=require(_0xca71('0x6'));var rs=require(_0xca71('0x7'));var sox=require(_0xca71('0x8'));var tts=require(_0xca71('0x9'));var urlParse=require(_0xca71('0xa'))[_0xca71('0xb')];var util=require(_0xca71('0xc'));var aws=require('./aws');var google=require(_0xca71('0xd'));var sestek=require(_0xca71('0xe'));var tilde=require('./tilde');var logger=require(_0xca71('0xf'))('agi');var ISPEECH_API=_0xca71('0x10');function downloadFile(_0x1263d7,_0x3e6914){return new BPromise(function(_0x34dc53,_0x2fa806){var _0x1a66b8=urlParse(_0x1263d7);var _0x10bdf1=_0x1a66b8[_0xca71('0x11')]==='https:'?https:http;var _0x4f7a33={'host':_0x1a66b8[_0xca71('0x12')],'path':_0x1a66b8['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x10bdf1[_0xca71('0x13')](_0x4f7a33,function(_0xb65504){if(_0xb65504[_0xca71('0x14')]!==0xc8){logger['error'](_0xca71('0x15')+_0x1263d7+'\x20failed,\x20status\x20code\x20=\x20'+_0xb65504[_0xca71('0x14')]+'\x20('+_0xb65504[_0xca71('0x16')]+')');_0x2fa806(new Error(_0xca71('0x15')+_0x1263d7+_0xca71('0x17')+_0xb65504['statusCode']+'\x20('+_0xb65504[_0xca71('0x16')]+')'));return;}var _0x3be898=fs[_0xca71('0x18')](_0x3e6914);_0x3be898['on'](_0xca71('0x19'),function(){logger[_0xca71('0x1a')](_0xca71('0x1b'));_0x3be898[_0xca71('0x1c')](_0x34dc53);});_0x3be898['on'](_0xca71('0x1d'),function(_0x2a2894){fs[_0xca71('0x1e')](_0x3e6914);logger['error'](_0xca71('0x1f'),_0x2a2894);_0x2fa806(_0x2a2894);});_0xb65504[_0xca71('0x20')](_0x3be898);})['on'](_0xca71('0x1d'),function(_0x2525a1){logger['error'](_0x2525a1);_0x2fa806(_0x2525a1);})['end']();});}function uploadFile(_0x1e1d56){return new BPromise(function(_0x243f27,_0x2d4d28){var _0x168e0=urlParse(_0x1e1d56);var _0x1e5979=_0x168e0['protocol']==='https:'?https:http;var _0x56c7d3={'host':_0x168e0[_0xca71('0x12')],'path':_0x168e0['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x1e5979[_0xca71('0x13')](_0x56c7d3,function(_0x49631e){if(_0x49631e[_0xca71('0x14')]!==0xc8){_0x2d4d28(new Error(_0xca71('0x15')+_0x1e1d56+_0xca71('0x17')+_0x49631e[_0xca71('0x14')]+'\x20('+_0x49631e['statusMessage']+')'));return;}var _0x24ada3='';_0x49631e['on'](_0xca71('0x21'),function(_0x57fcfd){_0x24ada3+=_0x57fcfd;});_0x49631e['on'](_0xca71('0x22'),function(){_0x243f27(_0x24ada3);});})['on']('error',function(_0x442a9b){_0x2d4d28(_0x442a9b);})[_0xca71('0x22')]();});}function convertFile(_0x5d09b5,_0x47b713){return new BPromise(function(_0x28225c,_0x38a15f){var _0x4a4daa=sox[_0xca71('0x23')](_0x5d09b5,_0x47b713,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a4daa['on'](_0xca71('0x1d'),function(_0x138505){logger[_0xca71('0x1d')](_0xca71('0x24'),_0x138505);_0x38a15f(_0x138505);});_0x4a4daa['on'](_0xca71('0x22'),function(){logger[_0xca71('0x1a')](_0xca71('0x25'));_0x28225c();});_0x4a4daa[_0xca71('0x26')]();});}function base64Decode(_0x23fd4f,_0x513a24){var _0x2aac56=path[_0xca71('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xca71('0x28'));fs[_0xca71('0x29')](_0x2aac56,_0x23fd4f,_0xca71('0x2a'));return convertFile(_0x2aac56,_0x513a24)['then'](function(){try{fs['unlink'](_0x2aac56);fs[_0xca71('0x2b')](_0x513a24,'777');}catch(_0x2ff11d){logger['error'](_0x2ff11d);}return _0x513a24[_0xca71('0x2c')]('.')[0x0];});}function base64Encode(_0x22e7b5){var _0x4b2934=fs[_0xca71('0x2d')](_0x22e7b5);return new Buffer(_0x4b2934)[_0xca71('0x2e')](_0xca71('0x2a'));}exports['googleCloudTTS']=function(_0x3a53b3,_0x262380,_0x2b72f3,_0x29a982,_0x2a8b8a,_0x243cf1){var _0x58937e,_0x22f5c7;var _0x231f8b=_0xca71('0x2f');var _0x4f3a53=_0xca71('0x30')+_0x3a53b3;var _0x56b7cd={};if(_0x262380==='ssml'){_0x56b7cd['input']={'ssml':_0x2b72f3};}else{_0x56b7cd[_0xca71('0x31')]={'text':_0x2b72f3};};_0x56b7cd[_0xca71('0x32')]={'languageCode':_0x29a982,'ssmlGender':_0x2a8b8a};_0x56b7cd[_0xca71('0x33')]={'audioEncoding':_0xca71('0x34'),'sampleRateHertz':0x1f40};var _0x1426bf={'url':_0x231f8b+_0xca71('0x35')+_0x4f3a53,'method':_0xca71('0x36'),'json':!![],'body':_0x56b7cd};return rp(_0x1426bf)[_0xca71('0x37')](function(_0x577d13){return new BPromise(function(_0x2f384b,_0xfabeb1){_0x58937e=path['resolve'](__dirname,_0xca71('0x38'),rs['generate'](0x4)+_0xca71('0x39'));var _0x3cc5e8=Buffer[_0xca71('0x3a')](_0x577d13[_0xca71('0x3b')],_0xca71('0x2a'));return fs[_0xca71('0x3c')](_0x58937e,_0x3cc5e8,function(_0x29ee09){_0xfabeb1(_0x29ee09);},function(_0xa138c4){fs[_0xca71('0x2b')](_0x58937e,_0xca71('0x3d'));_0x2f384b(_0xa138c4);});});})[_0xca71('0x37')](function(_0x5de7a2){_0x22f5c7=path[_0xca71('0x27')](__dirname,_0xca71('0x38'),rs['generate'](0x4)+_0xca71('0x28'));return convertFile(_0x58937e,_0x22f5c7);})[_0xca71('0x37')](function(){try{fs[_0xca71('0x1e')](_0x58937e);fs['chmodSync'](_0x22f5c7,_0xca71('0x3d'));}catch(_0x3e78f7){logger['error'](_0x3e78f7);}logger[_0xca71('0x1a')]('googleCloudTTS\x20path',_0x22f5c7['split']('.')[0x0]);return _0x22f5c7[_0xca71('0x2c')]('.')[0x0];});};exports[_0xca71('0x3e')]=function(_0x1539c8,_0x541c64){var _0x3d5f96='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xd4f1d9,_0x222df7;var _0x5b3836;var _0x22823d={'encoding':_0xca71('0x3f'),'method':_0xca71('0x36'),'timeout':0x2710,'url':_0x3d5f96,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xca71('0x40')+encodeURIComponent(JSON[_0xca71('0x41')]([[['jQ1olc',JSON[_0xca71('0x41')]([_0x1539c8,_0x541c64||'en',![],'null']),null,_0xca71('0x42')]]]))};return rp(_0x22823d)[_0xca71('0x37')](function(_0x2aa9e9){try{_0x5b3836=eval(_0x2aa9e9[_0xca71('0x43')](0x5))[0x0][0x2];}catch(_0xef660e){throw new Error(_0xca71('0x44')+_0x2aa9e9[_0xca71('0x21')]);}if(!_0x5b3836){if(_0x1539c8[_0xca71('0x45')]>0xc8){throw new Error(_0xca71('0x46'));}else{throw new Error(_0xca71('0x47')+_0x541c64+_0xca71('0x48'));}}try{_0x5b3836=eval(_0x5b3836)[0x0];}catch(_0x20b83c){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0xabde09=_0x5b3836;_0xd4f1d9=path[_0xca71('0x27')](__dirname,_0xca71('0x38'),rs[_0xca71('0x49')](0x4)+_0xca71('0x39'));fs[_0xca71('0x29')](_0xd4f1d9,_0x5b3836,{'encoding':_0xca71('0x2a')});_0x222df7=path[_0xca71('0x27')](__dirname,'tmp',rs[_0xca71('0x49')](0x4)+'.wav');return convertFile(_0xd4f1d9,_0x222df7);})['then'](function(){try{fs[_0xca71('0x1e')](_0xd4f1d9);fs[_0xca71('0x2b')](_0x222df7,_0xca71('0x3d'));}catch(_0x2db491){logger[_0xca71('0x1d')](_0x2db491);}logger['info'](_0xca71('0x4a'),_0x222df7[_0xca71('0x2c')]('.')[0x0]);return _0x222df7[_0xca71('0x2c')]('.')[0x0];});};exports[_0xca71('0x4b')]=function(_0x21ca6e,_0x783e9c,_0x256898){return google[_0xca71('0x4c')](_0x21ca6e,_0x783e9c,_0x256898)[_0xca71('0x37')](function(_0xdc673a){logger[_0xca71('0x1a')](_0xdc673a['uri']);return rp(_0xdc673a);})[_0xca71('0x37')](function(_0x4dfeef){var _0x3802ce='';var _0x20aded=0x0;try{fs['unlink'](_0x21ca6e);}catch(_0x256805){logger[_0xca71('0x1d')](_0x256805);}if(_0x4dfeef&&_0x4dfeef[_0xca71('0x4d')]){_0x3802ce=_0x4dfeef[_0xca71('0x4d')][_0xca71('0x4e')](function(_0x4cf89c){return _0x4cf89c&&_0x4cf89c[_0xca71('0x4f')][0x0]&&_0x4cf89c['alternatives'][0x0][_0xca71('0x50')]?_0x4cf89c[_0xca71('0x4f')][0x0][_0xca71('0x50')]:'';})[_0xca71('0x51')]('\x0a');_0x20aded=_0x4dfeef[_0xca71('0x4d')][_0xca71('0x4e')](function(_0x283ced){return _0x283ced&&_0x283ced[_0xca71('0x4f')][0x0]&&_0x283ced[_0xca71('0x4f')][0x0][_0xca71('0x52')]?_0x283ced['alternatives'][0x0]['confidence']:0x0;})[_0xca71('0x51')]('\x0a');}logger[_0xca71('0x1a')]('googleASR\x20transcription',_0x3802ce);logger[_0xca71('0x1a')](_0xca71('0x53'),_0x20aded);return{'transcript':_0x3802ce,'confidence':_0x20aded};})[_0xca71('0x54')](function(_0x4ed78d){logger[_0xca71('0x1d')]('[%s]\x20%s:%s',_0x4ed78d[_0xca71('0x14')],_0x4ed78d['name'],_0x4ed78d[_0xca71('0x55')]);});};exports['googleDialogflow']=function(_0x5894e6,_0x29b902,_0x59d017,_0x8a88de){var _0x3e2d2=apiai(_0x29b902,{'language':_0x8a88de||'en'});return _0x3e2d2['textRequest'](_0x59d017,{'sessionId':md5(_0x5894e6)})[_0xca71('0x37')](function(_0x588771){logger[_0xca71('0x1a')](JSON['stringify'](_0x588771));return{'source':_0x588771['result'][_0xca71('0x56')],'resolvedQuery':_0x588771['result'][_0xca71('0x57')],'action':_0x588771[_0xca71('0x58')][_0xca71('0x59')],'actionIncomplete':_0x588771[_0xca71('0x58')][_0xca71('0x5a')],'speech':_0x588771[_0xca71('0x58')][_0xca71('0x5b')][_0xca71('0x5c')],'score':_0x588771[_0xca71('0x58')][_0xca71('0x5d')],'statusCode':_0x588771['status'][_0xca71('0x5e')],'endConversation':_0x588771['result'][_0xca71('0x5f')][_0xca71('0x60')]||![],'isFallbackIntent':_0x588771[_0xca71('0x58')][_0xca71('0x5f')][_0xca71('0x61')]};});};exports[_0xca71('0x62')]=function(_0x1296e8,_0xfae38e,_0x30c700,_0x2a32b2,_0x1eb157,_0x47c4c8){var _0x1933a8=_0x2a32b2[_0xca71('0x63')](/\\n/g,'\x0a');var _0x166f36={'credentials':{'private_key':_0x1933a8,'client_email':_0x30c700}};var _0x375f5c=new dialogflow[(_0xca71('0x64'))](_0x166f36);var _0x6d7f51=_0x375f5c[_0xca71('0x65')](_0xfae38e,md5(_0x1296e8));var _0x510214={'session':_0x6d7f51,'queryInput':{'text':{'text':_0x1eb157,'languageCode':_0x47c4c8}}};return _0x375f5c[_0xca71('0x66')](_0x510214)['then'](function(_0x29ccc3){if(_0x29ccc3&&_0x29ccc3[_0xca71('0x45')]){logger[_0xca71('0x1a')]('Dialogflow\x20V2\x20response:',JSON[_0xca71('0x41')](_0x29ccc3));var _0x1cf2f3=_0x29ccc3[0x0];if(_0x1cf2f3){var _0x584898={'action':_0x1cf2f3['queryResult'][_0xca71('0x59')],'allRequiredParamsPresent':_0x1cf2f3['queryResult'][_0xca71('0x67')],'endConversation':_0x1cf2f3[_0xca71('0x68')]['diagnosticInfo']&&_0x1cf2f3['queryResult']['diagnosticInfo'][_0xca71('0x69')]?_0x1cf2f3[_0xca71('0x68')]['diagnosticInfo']['fields'][_0xca71('0x6a')][_0xca71('0x6b')]:![],'fulfillmentText':_0x1cf2f3[_0xca71('0x68')][_0xca71('0x6c')],'intentName':_0x1cf2f3[_0xca71('0x68')][_0xca71('0x6d')][_0xca71('0x6e')],'intentDisplayName':_0x1cf2f3[_0xca71('0x68')][_0xca71('0x6d')][_0xca71('0x6f')],'isFallbackIntent':_0x1cf2f3[_0xca71('0x68')][_0xca71('0x6d')]['isFallback'],'languageCode':_0x1cf2f3[_0xca71('0x68')][_0xca71('0x70')],'queryText':_0x1cf2f3['queryResult'][_0xca71('0x71')],'responseId':_0x1cf2f3[_0xca71('0x72')],'score':_0x1cf2f3[_0xca71('0x68')][_0xca71('0x73')],'speech':_0x1cf2f3[_0xca71('0x68')][_0xca71('0x6c')],'providerResponse':JSON[_0xca71('0x41')](_0x29ccc3)};return _0x584898;}}});};exports['tildeASR']=function(_0x48d534,_0x3d44b9,_0x2eaae3,_0x103178){return tilde[_0xca71('0x4c')](_0x48d534,_0x3d44b9,_0x2eaae3,_0x103178)['then'](function(_0x186b68){try{fs[_0xca71('0x1e')](_0x48d534);}catch(_0x839798){logger[_0xca71('0x1d')](_0x839798);}logger[_0xca71('0x1a')](_0xca71('0x74'),_0x186b68[_0xca71('0x50')]);logger[_0xca71('0x1a')](_0xca71('0x75'),_0x186b68[_0xca71('0x52')]);return _0x186b68;});};exports[_0xca71('0x76')]=function(_0x477cf8,_0x269d45,_0x1d55a1,_0x16480a,_0x1878cf,_0x3b2d9d){var _0xe505d4=path['resolve'](__dirname,_0xca71('0x38'),rs[_0xca71('0x49')](0x4)+_0xca71('0x39'));var _0x182d4c;return aws[_0xca71('0x77')](_0x477cf8,_0x269d45,_0x1d55a1,_0x16480a,_0x1878cf,_0x3b2d9d,_0xe505d4)[_0xca71('0x37')](function(){_0x182d4c=path[_0xca71('0x27')](__dirname,_0xca71('0x38'),rs[_0xca71('0x49')](0x4)+_0xca71('0x28'));return convertFile(_0xe505d4,_0x182d4c);})[_0xca71('0x37')](function(){try{fs[_0xca71('0x1e')](_0xe505d4);fs['chmodSync'](_0x182d4c,_0xca71('0x3d'));}catch(_0x41185c){logger[_0xca71('0x1d')](_0x41185c);}return _0x182d4c[_0xca71('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0x54e526,_0x254a71,_0x160e28,_0x12170d,_0x5a858a,_0xa5a812){return aws['lex'](_0x54e526,_0x254a71,_0x160e28,_0x12170d,_0x5a858a,_0xa5a812)[_0xca71('0x37')](function(_0x2f0081){logger[_0xca71('0x1a')](JSON[_0xca71('0x41')](_0x2f0081));return _0x2f0081;});};exports['ispeechTTS']=function(_0x2fc972,_0x462686,_0x979e5e,_0x3d3c7a){var _0x27b22d=util[_0xca71('0x78')](_0xca71('0x79'),ISPEECH_API,_0x2fc972,encodeURIComponent(_0x462686),_0x979e5e,_0x3d3c7a);var _0x761bc9=path['resolve'](__dirname,_0xca71('0x38'),rs[_0xca71('0x49')](0x4)+_0xca71('0x39'));var _0x5542a2;return downloadFile(_0x27b22d,_0x761bc9)[_0xca71('0x37')](function(){_0x5542a2=path[_0xca71('0x27')](__dirname,'tmp',rs[_0xca71('0x49')](0x4)+_0xca71('0x28'));return convertFile(_0x761bc9,_0x5542a2);})['then'](function(){try{fs[_0xca71('0x1e')](_0x761bc9);fs[_0xca71('0x2b')](_0x5542a2,_0xca71('0x3d'));}catch(_0x482764){logger['error'](_0x482764);}return _0x5542a2[_0xca71('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x253289,_0x13912f,_0x32dd58,_0x41d798){var _0x736b22=util[_0xca71('0x78')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x13912f,_0x32dd58,base64Encode(_0x253289),_0x41d798?util[_0xca71('0x78')](_0xca71('0x7a'),encodeURIComponent(_0x41d798)):'freeform=3');return uploadFile(_0x736b22)['then'](function(_0x5a927f){return querystring['parse'](_0x5a927f);});};exports[_0xca71('0x7b')]=function(_0x9417cb,_0x577f4b){return sestek[_0xca71('0x7c')](_0x9417cb,_0x577f4b)[_0xca71('0x37')](function(_0x4bce21){logger['info'](JSON['stringify'](_0x4bce21));var _0x5779db={'speech':_0x4bce21[_0xca71('0x7d')],'action':_0x4bce21['channelData']?_0x4bce21['channelData'][_0xca71('0x7e')]:undefined,'actiondata':_0x4bce21[_0xca71('0x7f')]?_0x4bce21['channelData'][_0xca71('0x80')]:undefined};if(_0x4bce21[_0xca71('0x7f')]&&_0x4bce21[_0xca71('0x7f')]['AudioFromTts']){return base64Decode(_0x4bce21['channelData'][_0xca71('0x81')][_0xca71('0x82')],path[_0xca71('0x27')](__dirname,'tmp',rs[_0xca71('0x49')](0x4)+_0xca71('0x28')))[_0xca71('0x37')](function(_0x2b012a){_0x5779db[_0xca71('0x83')]=_0x2b012a;return _0x5779db;});}return _0x5779db;});};exports[_0xca71('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x5178=['error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','chmodSync','tmp','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','score','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','agi','protocol','https:','host','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','data','transcode','wav'];(function(_0x5cb236,_0x1cdfe7){var _0x562dec=function(_0x17c7e3){while(--_0x17c7e3){_0x5cb236['push'](_0x5cb236['shift']());}};_0x562dec(++_0x1cdfe7);}(_0x5178,0xf1));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var apiai=require(_0x8517('0x0'));var BPromise=require(_0x8517('0x1'));var dialogflow=require(_0x8517('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x8517('0x3'));var md5=require(_0x8517('0x4'));var path=require(_0x8517('0x5'));var querystring=require(_0x8517('0x6'));var rp=require(_0x8517('0x7'));var rs=require(_0x8517('0x8'));var sox=require(_0x8517('0x9'));var tts=require(_0x8517('0xa'));var urlParse=require(_0x8517('0xb'))[_0x8517('0xc')];var util=require(_0x8517('0xd'));var aws=require(_0x8517('0xe'));var google=require(_0x8517('0xf'));var sestek=require(_0x8517('0x10'));var tilde=require(_0x8517('0x11'));var logger=require('../../../config/logger')(_0x8517('0x12'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x3415c6,_0x472cdd){return new BPromise(function(_0x4720e3,_0x1e1529){var _0x44625e=urlParse(_0x3415c6);var _0x3e3a9c=_0x44625e[_0x8517('0x13')]===_0x8517('0x14')?https:http;var _0x4c7e0c={'host':_0x44625e[_0x8517('0x15')],'path':_0x44625e[_0x8517('0x5')],'headers':{'user-agent':_0x8517('0x16')}};_0x3e3a9c[_0x8517('0x17')](_0x4c7e0c,function(_0x4b80ea){if(_0x4b80ea[_0x8517('0x18')]!==0xc8){logger['error']('request\x20to\x20'+_0x3415c6+_0x8517('0x19')+_0x4b80ea[_0x8517('0x18')]+'\x20('+_0x4b80ea['statusMessage']+')');_0x1e1529(new Error(_0x8517('0x1a')+_0x3415c6+_0x8517('0x19')+_0x4b80ea[_0x8517('0x18')]+'\x20('+_0x4b80ea['statusMessage']+')'));return;}var _0x542b0c=fs[_0x8517('0x1b')](_0x472cdd);_0x542b0c['on']('finish',function(){logger[_0x8517('0x1c')](_0x8517('0x1d'));_0x542b0c[_0x8517('0x1e')](_0x4720e3);});_0x542b0c['on'](_0x8517('0x1f'),function(_0x447caa){fs[_0x8517('0x20')](_0x472cdd);logger[_0x8517('0x1f')](_0x8517('0x21'),_0x447caa);_0x1e1529(_0x447caa);});_0x4b80ea[_0x8517('0x22')](_0x542b0c);})['on'](_0x8517('0x1f'),function(_0x22f189){logger[_0x8517('0x1f')](_0x22f189);_0x1e1529(_0x22f189);})[_0x8517('0x23')]();});}function uploadFile(_0x1fc98c){return new BPromise(function(_0x4d6b3a,_0x5ad9ed){var _0x3d4a57=urlParse(_0x1fc98c);var _0x14c553=_0x3d4a57[_0x8517('0x13')]==='https:'?https:http;var _0x2798ca={'host':_0x3d4a57['host'],'path':_0x3d4a57['path'],'headers':{'user-agent':_0x8517('0x16')}};_0x14c553['get'](_0x2798ca,function(_0x421294){if(_0x421294[_0x8517('0x18')]!==0xc8){_0x5ad9ed(new Error('request\x20to\x20'+_0x1fc98c+_0x8517('0x19')+_0x421294['statusCode']+'\x20('+_0x421294['statusMessage']+')'));return;}var _0x368fc4='';_0x421294['on'](_0x8517('0x24'),function(_0x1ae717){_0x368fc4+=_0x1ae717;});_0x421294['on']('end',function(){_0x4d6b3a(_0x368fc4);});})['on'](_0x8517('0x1f'),function(_0x4bbc0b){_0x5ad9ed(_0x4bbc0b);})[_0x8517('0x23')]();});}function convertFile(_0x1def30,_0x54c325){return new BPromise(function(_0x22f909,_0x47877c){var _0x589eb6=sox[_0x8517('0x25')](_0x1def30,_0x54c325,{'sampleRate':0x1f40,'format':_0x8517('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x589eb6['on'](_0x8517('0x1f'),function(_0x5313c4){logger['error'](_0x8517('0x27'),_0x5313c4);_0x47877c(_0x5313c4);});_0x589eb6['on'](_0x8517('0x23'),function(){logger[_0x8517('0x1c')](_0x8517('0x28'));_0x22f909();});_0x589eb6[_0x8517('0x29')]();});}function base64Decode(_0x3051f1,_0x45702f){var _0x38889d=path[_0x8517('0x2a')](__dirname,'tmp',rs[_0x8517('0x2b')](0x4)+_0x8517('0x2c'));fs[_0x8517('0x2d')](_0x38889d,_0x3051f1,_0x8517('0x2e'));return convertFile(_0x38889d,_0x45702f)[_0x8517('0x2f')](function(){try{fs[_0x8517('0x20')](_0x38889d);fs['chmodSync'](_0x45702f,_0x8517('0x30'));}catch(_0x260c3b){logger[_0x8517('0x1f')](_0x260c3b);}return _0x45702f[_0x8517('0x31')]('.')[0x0];});}function base64Encode(_0x13195e){var _0x5f4fd5=fs[_0x8517('0x32')](_0x13195e);return new Buffer(_0x5f4fd5)['toString'](_0x8517('0x2e'));}exports['googleCloudTTS']=function(_0x41211f,_0x2c54d5,_0x3539b5,_0x324ef1,_0x41e047,_0x32b0fa){var _0xbe13c4,_0xadf294;var _0x4b5cca=_0x8517('0x33');var _0x3022aa=_0x8517('0x34')+_0x41211f;var _0x205643={};if(_0x2c54d5==='ssml'){_0x205643['input']={'ssml':_0x3539b5};}else{_0x205643[_0x8517('0x35')]={'text':_0x3539b5};};_0x205643[_0x8517('0x36')]={'languageCode':_0x324ef1,'ssmlGender':_0x41e047};_0x205643[_0x8517('0x37')]={'audioEncoding':_0x8517('0x38'),'sampleRateHertz':0x1f40};var _0x3b05f9={'url':_0x4b5cca+_0x8517('0x39')+_0x3022aa,'method':_0x8517('0x3a'),'json':!![],'body':_0x205643};return rp(_0x3b05f9)[_0x8517('0x2f')](function(_0x55554e){return new BPromise(function(_0xaa56a4,_0x16c7d6){_0xbe13c4=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x8517('0x3b'));var _0xd033d2=Buffer[_0x8517('0x3c')](_0x55554e[_0x8517('0x3d')],_0x8517('0x2e'));return fs[_0x8517('0x3e')](_0xbe13c4,_0xd033d2,function(_0x3e536d){_0x16c7d6(_0x3e536d);},function(_0x853bcd){fs[_0x8517('0x3f')](_0xbe13c4,'777');_0xaa56a4(_0x853bcd);});});})[_0x8517('0x2f')](function(_0x1db2ee){_0xadf294=path['resolve'](__dirname,_0x8517('0x40'),rs[_0x8517('0x2b')](0x4)+_0x8517('0x2c'));return convertFile(_0xbe13c4,_0xadf294);})[_0x8517('0x2f')](function(){try{fs[_0x8517('0x20')](_0xbe13c4);fs[_0x8517('0x3f')](_0xadf294,_0x8517('0x30'));}catch(_0x4dcce4){logger['error'](_0x4dcce4);}logger[_0x8517('0x1c')]('googleCloudTTS\x20path',_0xadf294['split']('.')[0x0]);return _0xadf294['split']('.')[0x0];});};exports[_0x8517('0x41')]=function(_0x4c8025,_0x49360c){var _0x2858a5=_0x8517('0x42');var _0x148dac,_0xa2114c;var _0x49c5da;var _0xec36a7={'encoding':_0x8517('0x43'),'method':_0x8517('0x3a'),'timeout':0x2710,'url':_0x2858a5,'headers':{'Content-Type':_0x8517('0x44')},'body':'f.req='+encodeURIComponent(JSON[_0x8517('0x45')]([[[_0x8517('0x46'),JSON['stringify']([_0x4c8025,_0x49360c||'en',![],_0x8517('0x47')]),null,'generic']]]))};return rp(_0xec36a7)[_0x8517('0x2f')](function(_0x200c28){try{_0x49c5da=eval(_0x200c28['slice'](0x5))[0x0][0x2];}catch(_0x38408c){throw new Error(_0x8517('0x48')+_0x200c28[_0x8517('0x24')]);}if(!_0x49c5da){if(_0x4c8025[_0x8517('0x49')]>0xc8){throw new Error(_0x8517('0x4a'));}else{throw new Error(_0x8517('0x4b')+_0x49360c+'\x22\x20might\x20not\x20exist');}}try{_0x49c5da=eval(_0x49c5da)[0x0];}catch(_0x157bfd){throw new Error(_0x8517('0x48')+res[_0x8517('0x24')]);}const _0x1442b9=_0x49c5da;_0x148dac=path[_0x8517('0x2a')](__dirname,_0x8517('0x40'),rs['generate'](0x4)+_0x8517('0x3b'));fs[_0x8517('0x2d')](_0x148dac,_0x49c5da,{'encoding':_0x8517('0x2e')});_0xa2114c=path[_0x8517('0x2a')](__dirname,_0x8517('0x40'),rs[_0x8517('0x2b')](0x4)+_0x8517('0x2c'));return convertFile(_0x148dac,_0xa2114c);})['then'](function(){try{fs[_0x8517('0x20')](_0x148dac);fs['chmodSync'](_0xa2114c,_0x8517('0x30'));}catch(_0x3286f0){logger[_0x8517('0x1f')](_0x3286f0);}logger['info'](_0x8517('0x4c'),_0xa2114c[_0x8517('0x31')]('.')[0x0]);return _0xa2114c[_0x8517('0x31')]('.')[0x0];});};exports[_0x8517('0x4d')]=function(_0x1300cf,_0x5b86c7,_0x54ff99){return google[_0x8517('0x4e')](_0x1300cf,_0x5b86c7,_0x54ff99)[_0x8517('0x2f')](function(_0x552577){logger[_0x8517('0x1c')](_0x552577[_0x8517('0x4f')]);return rp(_0x552577);})[_0x8517('0x2f')](function(_0x1615bd){var _0x2f5963='';var _0x16454b=0x0;try{fs[_0x8517('0x20')](_0x1300cf);}catch(_0x5ef017){logger[_0x8517('0x1f')](_0x5ef017);}if(_0x1615bd&&_0x1615bd[_0x8517('0x50')]){_0x2f5963=_0x1615bd[_0x8517('0x50')][_0x8517('0x51')](function(_0xcb3b9e){return _0xcb3b9e&&_0xcb3b9e[_0x8517('0x52')][0x0]&&_0xcb3b9e['alternatives'][0x0][_0x8517('0x53')]?_0xcb3b9e[_0x8517('0x52')][0x0][_0x8517('0x53')]:'';})['join']('\x0a');_0x16454b=_0x1615bd[_0x8517('0x50')][_0x8517('0x51')](function(_0x261e90){return _0x261e90&&_0x261e90['alternatives'][0x0]&&_0x261e90[_0x8517('0x52')][0x0][_0x8517('0x54')]?_0x261e90[_0x8517('0x52')][0x0][_0x8517('0x54')]:0x0;})['join']('\x0a');}logger[_0x8517('0x1c')](_0x8517('0x55'),_0x2f5963);logger[_0x8517('0x1c')](_0x8517('0x56'),_0x16454b);return{'transcript':_0x2f5963,'confidence':_0x16454b};})[_0x8517('0x57')](function(_0x1d5928){logger[_0x8517('0x1f')](_0x8517('0x58'),_0x1d5928[_0x8517('0x18')],_0x1d5928['name'],_0x1d5928[_0x8517('0x59')]);});};exports[_0x8517('0x5a')]=function(_0x5d6991,_0x377c52,_0x1830fa,_0x5acb5f){var _0x5b03c9=apiai(_0x377c52,{'language':_0x5acb5f||'en'});return _0x5b03c9[_0x8517('0x5b')](_0x1830fa,{'sessionId':md5(_0x5d6991)})[_0x8517('0x2f')](function(_0x4ee90e){logger['info'](JSON[_0x8517('0x45')](_0x4ee90e));return{'source':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x5d')],'resolvedQuery':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x5e')],'action':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x5f')],'actionIncomplete':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x60')],'speech':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x61')]['speech'],'score':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x62')],'statusCode':_0x4ee90e['status']['code'],'endConversation':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x63')]['endConversation']||![],'isFallbackIntent':_0x4ee90e[_0x8517('0x5c')][_0x8517('0x63')][_0x8517('0x64')]};});};exports[_0x8517('0x65')]=function(_0x3ac4c5,_0x258a7f,_0x1578a7,_0x460c83,_0x4832a0,_0x10c1ee){var _0xc3d474=_0x460c83[_0x8517('0x66')](/\\n/g,'\x0a');var _0x38519a={'credentials':{'private_key':_0xc3d474,'client_email':_0x1578a7}};var _0x3a0bb8=new dialogflow[(_0x8517('0x67'))](_0x38519a);var _0x3cafd3=_0x3a0bb8[_0x8517('0x68')](_0x258a7f,md5(_0x3ac4c5));var _0x3bf28a={'session':_0x3cafd3,'queryInput':{'text':{'text':_0x4832a0,'languageCode':_0x10c1ee}}};return _0x3a0bb8[_0x8517('0x69')](_0x3bf28a)['then'](function(_0x1c5c21){if(_0x1c5c21&&_0x1c5c21[_0x8517('0x49')]){logger[_0x8517('0x1c')](_0x8517('0x6a'),JSON[_0x8517('0x45')](_0x1c5c21));var _0x135bee=_0x1c5c21[0x0];if(_0x135bee){var _0x216190={'action':_0x135bee[_0x8517('0x6b')][_0x8517('0x5f')],'allRequiredParamsPresent':_0x135bee['queryResult'][_0x8517('0x6c')],'endConversation':_0x135bee[_0x8517('0x6b')]['diagnosticInfo']&&_0x135bee[_0x8517('0x6b')][_0x8517('0x6d')][_0x8517('0x6e')]?_0x135bee[_0x8517('0x6b')]['diagnosticInfo'][_0x8517('0x6e')]['end_conversation'][_0x8517('0x6f')]:![],'fulfillmentText':_0x135bee[_0x8517('0x6b')][_0x8517('0x70')],'intentName':_0x135bee['queryResult']['intent'][_0x8517('0x71')],'intentDisplayName':_0x135bee[_0x8517('0x6b')][_0x8517('0x72')]['displayName'],'isFallbackIntent':_0x135bee['queryResult']['intent'][_0x8517('0x73')],'languageCode':_0x135bee[_0x8517('0x6b')][_0x8517('0x74')],'queryText':_0x135bee[_0x8517('0x6b')][_0x8517('0x75')],'responseId':_0x135bee[_0x8517('0x76')],'score':_0x135bee[_0x8517('0x6b')][_0x8517('0x77')],'speech':_0x135bee[_0x8517('0x6b')]['fulfillmentText'],'providerResponse':JSON[_0x8517('0x45')](_0x1c5c21)};return _0x216190;}}});};exports[_0x8517('0x78')]=function(_0x77c75e,_0x3fede2,_0x16e33b,_0x1b8d4b){return tilde[_0x8517('0x4e')](_0x77c75e,_0x3fede2,_0x16e33b,_0x1b8d4b)[_0x8517('0x2f')](function(_0x828b82){try{fs[_0x8517('0x20')](_0x77c75e);}catch(_0x3edf9c){logger[_0x8517('0x1f')](_0x3edf9c);}logger[_0x8517('0x1c')](_0x8517('0x79'),_0x828b82[_0x8517('0x53')]);logger[_0x8517('0x1c')](_0x8517('0x7a'),_0x828b82[_0x8517('0x54')]);return _0x828b82;});};exports['awsPolly']=function(_0x10e46b,_0x37657a,_0xaef0d9,_0x466db4,_0x369491,_0x2baa92){var _0x5aab08=path[_0x8517('0x2a')](__dirname,'tmp',rs[_0x8517('0x2b')](0x4)+_0x8517('0x3b'));var _0x51a91b;return aws[_0x8517('0x7b')](_0x10e46b,_0x37657a,_0xaef0d9,_0x466db4,_0x369491,_0x2baa92,_0x5aab08)[_0x8517('0x2f')](function(){_0x51a91b=path[_0x8517('0x2a')](__dirname,'tmp',rs[_0x8517('0x2b')](0x4)+_0x8517('0x2c'));return convertFile(_0x5aab08,_0x51a91b);})[_0x8517('0x2f')](function(){try{fs[_0x8517('0x20')](_0x5aab08);fs['chmodSync'](_0x51a91b,_0x8517('0x30'));}catch(_0x10ca53){logger[_0x8517('0x1f')](_0x10ca53);}return _0x51a91b[_0x8517('0x31')]('.')[0x0];});};exports[_0x8517('0x7c')]=function(_0x55a7a0,_0x244053,_0x5da26b,_0x17b976,_0x5e671d,_0x5c59ea){return aws[_0x8517('0x7d')](_0x55a7a0,_0x244053,_0x5da26b,_0x17b976,_0x5e671d,_0x5c59ea)[_0x8517('0x2f')](function(_0x40cc32){logger[_0x8517('0x1c')](JSON[_0x8517('0x45')](_0x40cc32));return _0x40cc32;});};exports[_0x8517('0x7e')]=function(_0x5eb800,_0x518cf7,_0x506107,_0x3f4940){var _0x215646=util[_0x8517('0x7f')](_0x8517('0x80'),ISPEECH_API,_0x5eb800,encodeURIComponent(_0x518cf7),_0x506107,_0x3f4940);var _0x205739=path['resolve'](__dirname,_0x8517('0x40'),rs[_0x8517('0x2b')](0x4)+_0x8517('0x3b'));var _0x2c7e84;return downloadFile(_0x215646,_0x205739)['then'](function(){_0x2c7e84=path[_0x8517('0x2a')](__dirname,_0x8517('0x40'),rs[_0x8517('0x2b')](0x4)+_0x8517('0x2c'));return convertFile(_0x205739,_0x2c7e84);})[_0x8517('0x2f')](function(){try{fs[_0x8517('0x20')](_0x205739);fs['chmodSync'](_0x2c7e84,_0x8517('0x30'));}catch(_0x1ec4c1){logger[_0x8517('0x1f')](_0x1ec4c1);}return _0x2c7e84[_0x8517('0x31')]('.')[0x0];});};exports[_0x8517('0x81')]=function(_0x4129e8,_0x498a4f,_0x33a762,_0x14f763){var _0x66d69=util[_0x8517('0x7f')](_0x8517('0x82'),ISPEECH_API,_0x498a4f,_0x33a762,base64Encode(_0x4129e8),_0x14f763?util[_0x8517('0x7f')](_0x8517('0x83'),encodeURIComponent(_0x14f763)):_0x8517('0x84'));return uploadFile(_0x66d69)['then'](function(_0x19a64e){return querystring['parse'](_0x19a64e);});};exports['sestekNDA']=function(_0x3c1d42,_0x5627eb){return sestek[_0x8517('0x85')](_0x3c1d42,_0x5627eb)[_0x8517('0x2f')](function(_0x5dc70a){logger[_0x8517('0x1c')](JSON[_0x8517('0x45')](_0x5dc70a));var _0x34e8bd={'speech':_0x5dc70a[_0x8517('0x86')],'action':_0x5dc70a[_0x8517('0x87')]?_0x5dc70a[_0x8517('0x87')]['CustomAction']:undefined,'actiondata':_0x5dc70a[_0x8517('0x87')]?_0x5dc70a['channelData']['CustomActionData']:undefined};if(_0x5dc70a[_0x8517('0x87')]&&_0x5dc70a[_0x8517('0x87')][_0x8517('0x88')]){return base64Decode(_0x5dc70a[_0x8517('0x87')]['AudioFromTts'][_0x8517('0x89')],path[_0x8517('0x2a')](__dirname,_0x8517('0x40'),rs[_0x8517('0x2b')](0x4)+_0x8517('0x2c')))['then'](function(_0x4f753f){_0x34e8bd[_0x8517('0x8a')]=_0x4f753f;return _0x34e8bd;});}return _0x34e8bd;});};exports[_0x8517('0x8b')]=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 7f45a99..072c0a3 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 _0xd16e=['exports'];(function(_0x3c4177,_0x4bb568){var _0x357fd2=function(_0x1ac79d){while(--_0x1ac79d){_0x3c4177['push'](_0x3c4177['shift']());}};_0x357fd2(++_0x4bb568);}(_0xd16e,0x1b3));var _0xed16=function(_0x4bdf0c,_0xab8401){_0x4bdf0c=_0x4bdf0c-0x0;var _0x7316a5=_0xd16e[_0x4bdf0c];return _0x7316a5;};var nda=require('./nda');module[_0xed16('0x0')]={'nda':nda}; \ No newline at end of file +var _0x6aca=['exports','./nda'];(function(_0xe8ce52,_0x1c422a){var _0x2c40f2=function(_0x76d223){while(--_0x76d223){_0xe8ce52['push'](_0xe8ce52['shift']());}};_0x2c40f2(++_0x1c422a);}(_0x6aca,0x99));var _0xa6ac=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x6aca[_0x479650];return _0x26b288;};var nda=require(_0xa6ac('0x0'));module[_0xa6ac('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index aa12167..873410f 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 _0xc2e8=['request-promise','url','exports','POST','ndauth_url','/token','password','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify'];(function(_0x33b295,_0x32fa89){var _0x225279=function(_0x41609c){while(--_0x41609c){_0x33b295['push'](_0x33b295['shift']());}};_0x225279(++_0x32fa89);}(_0xc2e8,0x70));var _0x8c2e=function(_0x2a6420,_0x2fe8fa){_0x2a6420=_0x2a6420-0x0;var _0x390ec4=_0xc2e8[_0x2a6420];return _0x390ec4;};'use strict';var rp=require(_0x8c2e('0x0'));var url=require(_0x8c2e('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x8c2e('0x2')]=function(_0x4df201,_0x8e4f3e){var _0x3c074b={'method':_0x8c2e('0x3'),'uri':url['resolve'](_0x8e4f3e[_0x8c2e('0x4')],_0x8c2e('0x5')),'form':{'grant_type':_0x8c2e('0x6'),'username':_0x8e4f3e['username'],'password':_0x8e4f3e['password']},'json':!![]};return rp(_0x3c074b)['then'](function(_0x487731){var _0x4abd39={'method':_0x8c2e('0x3'),'uri':url[_0x8c2e('0x7')](_0x8e4f3e[_0x8c2e('0x8')],_0x8c2e('0x9')),'body':{'type':_0x8e4f3e[_0x8c2e('0xa')]||_0x8c2e('0xb'),'channelId':_0x8c2e('0xc'),'conversation':{'id':_0x4df201[_0x8c2e('0xd')]},'from':{'id':_0x4df201['callerid'],'name':_0x4df201[_0x8c2e('0xe')]},'recipient':{'id':_0x4df201[_0x8c2e('0xf')],'name':_0x4df201[_0x8c2e('0x10')]},'text':_0x8e4f3e['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x487731['access_token']},'json':!![]};if(_0x8e4f3e[_0x8c2e('0x11')]){_0x4abd39[_0x8c2e('0x12')][_0x8c2e('0x13')][_0x8c2e('0x14')]=_0x8e4f3e[_0x8c2e('0x11')];}if(_0x8e4f3e[_0x8c2e('0x15')]=='1'){_0x4abd39[_0x8c2e('0x12')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8c2e('0x16')};}if(_0x8e4f3e[_0x8c2e('0x17')]){_0x4abd39[_0x8c2e('0x12')][_0x8c2e('0x13')][_0x8c2e('0x18')]=_0x8e4f3e[_0x8c2e('0x17')];if(_0x8e4f3e['custom_action_data']){_0x4abd39[_0x8c2e('0x12')][_0x8c2e('0x13')][_0x8c2e('0x19')]=_0x8e4f3e[_0x8c2e('0x1a')];}}logger['info'](JSON[_0x8c2e('0x1b')](_0x4abd39));return rp(_0x4abd39);});}; \ No newline at end of file +var _0xe28e=['resolve','ndauth_url','/token','password','then','ndassistant_url','Nda','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x53ec2d,_0x3215c7){var _0x5e0bdd=function(_0x2e4dbc){while(--_0x2e4dbc){_0x53ec2d['push'](_0x53ec2d['shift']());}};_0x5e0bdd(++_0x3215c7);}(_0xe28e,0x1ba));var _0xee28=function(_0x49c10b,_0x25f17b){_0x49c10b=_0x49c10b-0x0;var _0x53c597=_0xe28e[_0x49c10b];return _0x53c597;};'use strict';var rp=require(_0xee28('0x0'));var url=require(_0xee28('0x1'));var logger=require(_0xee28('0x2'))(_0xee28('0x3'));module[_0xee28('0x4')]=function(_0x117a12,_0x3e541a){var _0x9f2216={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0x7')],_0xee28('0x8')),'form':{'grant_type':_0xee28('0x9'),'username':_0x3e541a['username'],'password':_0x3e541a[_0xee28('0x9')]},'json':!![]};return rp(_0x9f2216)[_0xee28('0xa')](function(_0x3f9bd9){var _0x66d0b6={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3e541a['ndaactivity_type']||'message','channelId':_0xee28('0xc'),'conversation':{'id':_0x117a12[_0xee28('0xd')]},'from':{'id':_0x117a12['callerid'],'name':_0x117a12[_0xee28('0xe')]},'recipient':{'id':_0x117a12[_0xee28('0xf')],'name':_0x117a12['extension']},'text':_0x3e541a[_0xee28('0x10')],'channelData':{}},'headers':{'Authorization':_0xee28('0x11')+_0x3f9bd9[_0xee28('0x12')]},'json':!![]};if(_0x3e541a[_0xee28('0x13')]){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x16')]=_0x3e541a['project'];}if(_0x3e541a[_0xee28('0x17')]=='1'){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xee28('0x19')};}if(_0x3e541a['custom_action']){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x1a')]=_0x3e541a[_0xee28('0x1b')];if(_0x3e541a[_0xee28('0x1c')]){_0x66d0b6[_0xee28('0x14')]['channelData'][_0xee28('0x1d')]=_0x3e541a['custom_action_data'];}}logger[_0xee28('0x1e')](JSON[_0xee28('0x1f')](_0x66d0b6));return rp(_0x66d0b6);});}; \ 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 75f0aed..0445b4e 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 _0x040d=['exports'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x040d,0x7c));var _0xd040=function(_0x53c2a9,_0x591554){_0x53c2a9=_0x53c2a9-0x0;var _0x3030a3=_0x040d[_0x53c2a9];return _0x3030a3;};'use strict';var asr=require('./lib/api');module[_0xd040('0x0')]=function(_0x1459f7,_0x53a33d,_0x14a6aa,_0x54be2f){return asr(_0x1459f7,_0x53a33d,_0x14a6aa,_0x54be2f);}; \ No newline at end of file +var _0x5a2f=['exports','./lib/api'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x5a2f,0x9b));var _0xf5a2=function(_0x1566a1,_0xc43020){_0x1566a1=_0x1566a1-0x0;var _0x2a44f3=_0x5a2f[_0x1566a1];return _0x2a44f3;};'use strict';var asr=require(_0xf5a2('0x0'));module[_0xf5a2('0x1')]=function(_0x5d4a02,_0x2bc50b,_0x14e987,_0x48e114){return asr(_0x5d4a02,_0x2bc50b,_0x14e987,_0x48e114);}; \ 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 7f5580c..86a9122 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 _0xe4fc=['sha1','hex','info','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe4fc,0x18f));var _0xce4f=function(_0x1ddc7d,_0x10674b){_0x1ddc7d=_0x1ddc7d-0x0;var _0x593fff=_0xe4fc[_0x1ddc7d];return _0x593fff;};'use strict';var BPromise=require(_0xce4f('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xce4f('0x1'));var logger=require(_0xce4f('0x2'))(_0xce4f('0x3'));module[_0xce4f('0x4')]=function(_0x3ea18c,_0x538ba5,_0xcee6b4,_0x330de1){return new BPromise(function(_0x1d3b38,_0x187c69){logger['info'](_0xce4f('0x5'),_0x330de1||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2c1778=new WebSocket(_0x330de1||_0xce4f('0x6'),{'perMessageDeflate':![]});var _0x559826='';var _0x48fd4e='0';var _0x476aff='1';var _0x49d8f5=_0xce4f('0x7');function _0x41b4c7(_0x4ce53d){var _0x5959ce=crypto[_0xce4f('0x8')](_0xce4f('0x9'));_0x5959ce['update'](_0x4ce53d);return _0x5959ce['digest'](_0xce4f('0xa'));}function _0x22683f(){try{logger[_0xce4f('0xb')]('Open\x20Tilde\x20ASR\x20socket');var _0x1511b7=moment()['unix']();var _0x1fed31=_0x41b4c7(_0x1511b7+_0x538ba5+_0xcee6b4);_0x2c1778[_0xce4f('0xc')](JSON[_0xce4f('0xd')]({'appID':_0x538ba5,'timestamp':_0x1511b7,'appKey':_0x1fed31}));var _0x2e5c8a=fs[_0xce4f('0xe')](_0x3ea18c);_0x2e5c8a['on'](_0xce4f('0xf'),function(_0x3e8818){_0x2c1778[_0xce4f('0xc')](_0x3e8818);});_0x2e5c8a['on'](_0xce4f('0x10'),function(){_0x2c1778[_0xce4f('0xc')]('EOS');});}catch(_0x372ce4){logger[_0xce4f('0x11')](_0xce4f('0x12'),JSON[_0xce4f('0xd')](_0x372ce4));_0x2c1778[_0xce4f('0x13')]();}}function _0x30c367(_0x171ff0){try{if(_0x171ff0){var _0x5360cb=JSON[_0xce4f('0x14')](_0x171ff0);switch(_0x5360cb[_0xce4f('0x15')]){case 0x0:if(_0x5360cb[_0xce4f('0x16')]){if(_0x5360cb[_0xce4f('0x16')][_0xce4f('0x17')]){logger['info'](_0xce4f('0x18'),JSON[_0xce4f('0xd')](_0x5360cb['result'][_0xce4f('0x19')]));_0x559826=_0x5360cb[_0xce4f('0x16')][_0xce4f('0x19')][0x0]['transcript'];_0x48fd4e=_0x5360cb[_0xce4f('0x16')]['hypotheses'][0x0][_0xce4f('0x1a')];_0x476aff='0';_0x49d8f5='Success.';_0x2c1778['terminate']();}}break;case 0x1:logger[_0xce4f('0xb')](_0xce4f('0x7'));_0x476aff='1';_0x49d8f5=_0xce4f('0x7');break;case 0x2:logger[_0xce4f('0xb')](_0xce4f('0x1b'));_0x476aff='2';_0x49d8f5='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x476aff='9';_0x49d8f5=_0xce4f('0x1c');break;case 0xa:logger[_0xce4f('0xb')]('Authentication\x20failed.');_0x476aff='10';_0x49d8f5='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x476aff='11';_0x49d8f5=_0xce4f('0x1d');}}}catch(_0x567adc){logger[_0xce4f('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xce4f('0xd')](_0x567adc));_0x2c1778[_0xce4f('0x13')]();}}function _0x2e9b3e(){logger[_0xce4f('0xb')](_0xce4f('0x1e'));_0x1d3b38({'transcript':_0x559826,'confidence':_0x48fd4e,'status':_0x476aff,'status_message':_0x49d8f5});}function _0x3050f2(_0x50d7ff){logger[_0xce4f('0x11')](_0xce4f('0x1f'));if(!_['isNil'](_0x50d7ff)){logger[_0xce4f('0x11')](_[_0xce4f('0x20')](_0x50d7ff)?JSON['stringify'](_0x50d7ff):_0x50d7ff);}}_0x2c1778['on']('open',_0x22683f);_0x2c1778['on'](_0xce4f('0x21'),_0x30c367);_0x2c1778['on'](_0xce4f('0x10'),_0x2e9b3e);_0x2c1778['on'](_0xce4f('0x11'),_0x3050f2);});}; \ No newline at end of file +var _0x5247=['data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream'];(function(_0x5f1f4a,_0x1da06f){var _0x28e71d=function(_0x326df1){while(--_0x326df1){_0x5f1f4a['push'](_0x5f1f4a['shift']());}};_0x28e71d(++_0x1da06f);}(_0x5247,0x1c4));var _0x7524=function(_0x503ad6,_0x500aed){_0x503ad6=_0x503ad6-0x0;var _0x3beb37=_0x5247[_0x503ad6];return _0x3beb37;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x7524('0x0'))(_0x7524('0x1'));module[_0x7524('0x2')]=function(_0x5dfe09,_0x58c750,_0x4fd326,_0x71a62e){return new BPromise(function(_0x98b61b,_0x1d39c4){logger[_0x7524('0x3')](_0x7524('0x4'),_0x71a62e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xa565a9=new WebSocket(_0x71a62e||_0x7524('0x5'),{'perMessageDeflate':![]});var _0x3cf7bb='';var _0x4316dd='0';var _0x30d175='1';var _0x3a2278=_0x7524('0x6');function _0x335659(_0x2fd497){var _0x2221a5=crypto[_0x7524('0x7')](_0x7524('0x8'));_0x2221a5[_0x7524('0x9')](_0x2fd497);return _0x2221a5[_0x7524('0xa')](_0x7524('0xb'));}function _0xc12abc(){try{logger[_0x7524('0x3')](_0x7524('0xc'));var _0x42c3df=moment()['unix']();var _0x656f00=_0x335659(_0x42c3df+_0x58c750+_0x4fd326);_0xa565a9[_0x7524('0xd')](JSON[_0x7524('0xe')]({'appID':_0x58c750,'timestamp':_0x42c3df,'appKey':_0x656f00}));var _0x34d1aa=fs[_0x7524('0xf')](_0x5dfe09);_0x34d1aa['on'](_0x7524('0x10'),function(_0x2a7ad8){_0xa565a9['send'](_0x2a7ad8);});_0x34d1aa['on'](_0x7524('0x11'),function(){_0xa565a9[_0x7524('0xd')](_0x7524('0x12'));});}catch(_0x178d7f){logger['error'](_0x7524('0x13'),JSON[_0x7524('0xe')](_0x178d7f));_0xa565a9[_0x7524('0x14')]();}}function _0x4f4392(_0x590075){try{if(_0x590075){var _0x3030ae=JSON[_0x7524('0x15')](_0x590075);switch(_0x3030ae['status']){case 0x0:if(_0x3030ae[_0x7524('0x16')]){if(_0x3030ae[_0x7524('0x16')][_0x7524('0x17')]){logger[_0x7524('0x3')](_0x7524('0x18'),JSON[_0x7524('0xe')](_0x3030ae['result'][_0x7524('0x19')]));_0x3cf7bb=_0x3030ae['result'][_0x7524('0x19')][0x0][_0x7524('0x1a')];_0x4316dd=_0x3030ae[_0x7524('0x16')][_0x7524('0x19')][0x0][_0x7524('0x1b')];_0x30d175='0';_0x3a2278=_0x7524('0x1c');_0xa565a9[_0x7524('0x14')]();}}break;case 0x1:logger[_0x7524('0x3')](_0x7524('0x6'));_0x30d175='1';_0x3a2278=_0x7524('0x6');break;case 0x2:logger[_0x7524('0x3')](_0x7524('0x1d'));_0x30d175='2';_0x3a2278=_0x7524('0x1d');break;case 0x9:logger[_0x7524('0x3')](_0x7524('0x1e'));_0x30d175='9';_0x3a2278=_0x7524('0x1e');break;case 0xa:logger[_0x7524('0x3')](_0x7524('0x1f'));_0x30d175='10';_0x3a2278='Authentication\x20failed.';break;case 0xb:logger[_0x7524('0x3')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x30d175='11';_0x3a2278=_0x7524('0x20');}}}catch(_0x14a7af){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x7524('0xe')](_0x14a7af));_0xa565a9[_0x7524('0x14')]();}}function _0x318604(){logger[_0x7524('0x3')](_0x7524('0x21'));_0x98b61b({'transcript':_0x3cf7bb,'confidence':_0x4316dd,'status':_0x30d175,'status_message':_0x3a2278});}function _0x1e6b0b(_0x4bface){logger[_0x7524('0x22')](_0x7524('0x23'));if(!_[_0x7524('0x24')](_0x4bface)){logger[_0x7524('0x22')](_[_0x7524('0x25')](_0x4bface)?JSON[_0x7524('0xe')](_0x4bface):_0x4bface);}}_0xa565a9['on']('open',_0xc12abc);_0xa565a9['on'](_0x7524('0x26'),_0x4f4392);_0xa565a9['on'](_0x7524('0x11'),_0x318604);_0xa565a9['on'](_0x7524('0x22'),_0x1e6b0b);});}; \ 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 54b94f5..10cb4be 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 _0x1b37=['exports','./asr'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1b37,0x1eb));var _0x71b3=function(_0x271aa7,_0x309496){_0x271aa7=_0x271aa7-0x0;var _0xbb50e0=_0x1b37[_0x271aa7];return _0xbb50e0;};var asr=require(_0x71b3('0x0'));module[_0x71b3('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index df98063..f3d1905 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0xe706,0xa3));var _0x6e70=function(_0x46aaaa,_0x3af897){_0x46aaaa=_0x46aaaa-0x0;var _0x26d04e=_0xe706[_0x46aaaa];return _0x26d04e;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x16b992,_0x43d74c){var _0x385c78=function(_0x5c904){while(--_0x5c904){_0x16b992['push'](_0x16b992['shift']());}};_0x385c78(++_0x43d74c);}(_0xe706,0xa3));var _0x6e70=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0xe706[_0x2b0875];return _0xedb8d7;};'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 3050c65..188165f 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 _0x7834=['aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','saveRestApiResult','%s.%s','length','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','setVariable','createSquareDetailsReport','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','no\x20list\x20selected','add','delay','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','createSquareMessage','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','isArray','%s[%s]','variable\x20%s[key]\x20set','maxRetry','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','save_name','getMailAccount','sendMailMessage','getIntervals','interval','map','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','dnid','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','PUT','toUpperCase','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','parse','stringify','render','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','Amy','aws_text_type','awsLex'];(function(_0x2513ea,_0x3d9cb8){var _0x49f511=function(_0x357ae6){while(--_0x357ae6){_0x2513ea['push'](_0x2513ea['shift']());}};_0x49f511(++_0x3d9cb8);}(_0x7834,0x13f));var _0x4783=function(_0x2f3ca5,_0x3ba4ac){_0x2f3ca5=_0x2f3ca5-0x0;var _0x11cc85=_0x7834[_0x2f3ca5];return _0x11cc85;};'use strict';var fs=require('fs');var util=require(_0x4783('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x4783('0x1'))();var rs=require('randomstring');var moment=require(_0x4783('0x2'));var Mustache=require(_0x4783('0x3'));var rp=require(_0x4783('0x4'));var logger=require(_0x4783('0x5'))(_0x4783('0x6'));var config=require(_0x4783('0x7'));var shared=require(_0x4783('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x4783('0x9');var recursiveMapAttributes=[_0x4783('0xa'),'rawBody'];var verticesWithRetry=[_0x4783('0xb'),_0x4783('0xc'),_0x4783('0xd')];var AGIVertices=function(_0x112a19,_0xc8b2d7,_0x1f8b29){this['channel']=_0x112a19;this[_0x4783('0xe')]=_0xc8b2d7;this[_0x4783('0xf')]=_0x1f8b29;};AGIVertices[_0x4783('0x10')][_0x4783('0x11')]=function(_0x6cfdfb,_0x1eaeea){this[_0x4783('0xe')]['getVariableById'](_0x6cfdfb)['then'](function(_0x1a40c0){_0x1eaeea(null,_0x1a40c0?_0x1a40c0[_0x4783('0x12')]:![]);})['catch'](function(_0x2afbdc){_0x1eaeea(_0x2afbdc);});};AGIVertices['prototype'][_0x4783('0x13')]=function(_0x2fbc53,_0x41d853){this[_0x4783('0xe')][_0x4783('0x14')](_0x2fbc53)['then'](function(_0x3dcc1f){_0x41d853(null,_0x3dcc1f?_0x3dcc1f[_0x4783('0x12')]:![]);})[_0x4783('0x15')](function(_0x20788f){_0x41d853(_0x20788f);});};AGIVertices[_0x4783('0x10')][_0x4783('0x16')]=function(_0x3d4e04,_0x40dbcf){this[_0x4783('0xe')][_0x4783('0x17')](_0x3d4e04)[_0x4783('0x18')](function(_0x323a90){_0x40dbcf(null,_0x323a90?_0x323a90['name']:![]);})[_0x4783('0x15')](function(_0xcda581){_0x40dbcf(_0xcda581);});};AGIVertices['prototype'][_0x4783('0x19')]=function(_0x4a9dc8,_0x3064a){this[_0x4783('0xe')][_0x4783('0x1a')](_0x4a9dc8)[_0x4783('0x18')](function(_0x1b5e90){_0x3064a(null,_0x1b5e90?_0x1b5e90[_0x4783('0x1b')]:![]);})[_0x4783('0x15')](function(_0x4e15d7){_0x3064a(_0x4e15d7);});};AGIVertices[_0x4783('0x10')]['getUser']=function(_0x429801,_0x2d592f){this[_0x4783('0xe')][_0x4783('0x1c')](_0x429801)[_0x4783('0x18')](function(_0x54529d){_0x2d592f(null,_0x54529d?_0x54529d[_0x4783('0x12')]:![]);})[_0x4783('0x15')](function(_0xba686e){_0x2d592f(_0xba686e);});};AGIVertices[_0x4783('0x10')][_0x4783('0x1d')]=function(_0x1c7ebf,_0x2afc09){this['rpc'][_0x4783('0x1e')](_0x1c7ebf)[_0x4783('0x18')](function(_0x5d33f5){_0x2afc09(null,_0x5d33f5?_0x5d33f5['name']:![]);})[_0x4783('0x15')](function(_0xb5f71c){_0x2afc09(_0xb5f71c);});};AGIVertices['prototype'][_0x4783('0x1f')]=function(_0x532961,_0x5c5a6a){var _0x5368d3=this;this['rpc']['getSoundById'](_0x532961)['then'](function(_0x250b9d){_0x5c5a6a(null,_0x250b9d?_0x5368d3['getSoundPath'](_0x250b9d[_0x4783('0x20')]):![]);})[_0x4783('0x15')](function(_0x424806){_0x5c5a6a(_0x424806);});};AGIVertices[_0x4783('0x10')][_0x4783('0x21')]=function(_0x52b18f,_0x1e23f4){this[_0x4783('0xe')]['getMailAccountById'](_0x52b18f)[_0x4783('0x18')](function(_0x54ed15){_0x1e23f4(null,_0x54ed15?_0x54ed15:![]);})['catch'](function(_0x24d208){_0x1e23f4(_0x24d208);});};AGIVertices['prototype'][_0x4783('0x22')]=function(_0x4e999c,_0x3dc9fd,_0x3e519e){this['mailRpc'][_0x4783('0x22')](_0x4e999c,_0x3dc9fd)[_0x4783('0x18')](function(){_0x3e519e(null);})[_0x4783('0x15')](function(_0x1efca5){_0x3e519e(_0x1efca5);});};AGIVertices['prototype'][_0x4783('0x23')]=function(_0x40a06c,_0x36b94d){this[_0x4783('0xe')]['getIntervalById'](_0x40a06c)[_0x4783('0x18')](function(_0x16539){if(_0x16539){if(_0x16539['IntervalId']){_0x36b94d(null,[_0x16539[_0x4783('0x24')]]);}else{_0x36b94d(null,_[_0x4783('0x25')](_0x16539[_0x4783('0x26')],_0x4783('0x24')));}}else{_0x36b94d(null,![]);}})[_0x4783('0x15')](function(_0x4e6902){_0x36b94d(_0x4e6902);});};AGIVertices[_0x4783('0x10')]['getSoundPath']=function(_0x4b4441){return util[_0x4783('0x27')](_0x4783('0x28'),FILES_PATH,_0x4b4441);};AGIVertices[_0x4783('0x10')]['getQueryOdbc']=function(_0x12f078,_0x521a3b,_0x321184){odbc['open'](_0x12f078,function(_0x2f476e){if(_0x2f476e){logger[_0x4783('0x29')](_0x4783('0x2a'),_0x2f476e);_0x321184(_0x2f476e);}else{logger['info'](_0x4783('0x2b'));odbc['query'](_0x521a3b,function(_0x372cea,_0x2da1d6){if(_0x372cea){logger[_0x4783('0x2c')](_0x4783('0x2d'),_0x521a3b);_0x321184(_0x372cea);}else{logger['info'](_0x4783('0x2e'),_0x521a3b);odbc[_0x4783('0x2f')](function(_0x34bf03){if(_0x34bf03){logger['error'](_0x4783('0x30'),_0x34bf03);}_0x321184(null,_0x2da1d6);});}});}});};AGIVertices[_0x4783('0x10')][_0x4783('0x31')]=function(_0x50c1c3,_0x49adfd){this[_0x4783('0xe')][_0x4783('0x32')](_0x50c1c3)[_0x4783('0x18')](function(_0xbb6755){_0x49adfd(null,_0xbb6755?_0xbb6755:![]);})[_0x4783('0x15')](function(_0x158fc8){_0x49adfd(_0x158fc8);});};AGIVertices[_0x4783('0x10')][_0x4783('0x33')]=function(_0x135dd7,_0x5d34b8){this['rpc'][_0x4783('0x33')](_0x135dd7)['then'](function(_0xc577a9){_0x5d34b8(null,_0xc577a9);})[_0x4783('0x15')](function(_0x4708be){_0x5d34b8(_0x4708be);});};AGIVertices[_0x4783('0x10')]['createSquareDetailsReport']=function(_0x409ac6,_0xa29d9c,_0x3db344){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x4783('0x34')][_0x4783('0x35')],'node':_0x409ac6['label'],'application':_0x409ac6[_0x4783('0x36')],'data':_0xa29d9c||null,'project_name':this['channel'][_0x4783('0x37')],'callerid':this[_0x4783('0x34')][_0x4783('0x38')]})[_0x4783('0x18')](function(_0x2975fa){if(_0x3db344){_0x3db344(null,_0x2975fa);}})[_0x4783('0x15')](function(_0x2ab285){if(_0x3db344){_0x3db344(_0x2ab285);}});};AGIVertices[_0x4783('0x10')]['createSquareRecording']=function(_0x5dcf8c,_0x3523a4,_0x537a96,_0x1708c2){this[_0x4783('0xe')][_0x4783('0x39')]({'uniqueid':this[_0x4783('0x34')][_0x4783('0x35')],'callerid':this[_0x4783('0x34')][_0x4783('0x38')],'calleridname':this[_0x4783('0x34')][_0x4783('0x3a')],'context':this[_0x4783('0x34')][_0x4783('0x3b')],'extension':this[_0x4783('0x34')]['extension'],'priority':this['channel'][_0x4783('0x3c')],'accountcode':this[_0x4783('0x34')]['accountcode'],'dnid':this['channel'][_0x4783('0x3d')],'projectName':this[_0x4783('0x34')][_0x4783('0x37')],'saveName':_0x3523a4,'filename':_0x5dcf8c['file']||_0x3523a4,'savePath':_0x537a96})[_0x4783('0x18')](function(_0x56d50c){_0x1708c2(null,_0x56d50c);})[_0x4783('0x15')](function(_0x2e481c){_0x1708c2(_0x2e481c);});};AGIVertices['prototype']['createSquareMessage']=function(_0x58c570,_0x62fc1d,_0x419333,_0x47a0c5,_0x1fee84){this[_0x4783('0xe')]['createSquareMessage']({'uniqueid':this[_0x4783('0x34')]['uniqueid'],'body':_0x58c570,'direction':_0x62fc1d,'providerName':_0x419333,'providerResponse':_0x47a0c5})[_0x4783('0x18')](function(_0x591f91){if(_0x1fee84){_0x1fee84(null,_0x591f91);}})[_0x4783('0x15')](function(_0x54406b){if(_0x1fee84){_0x1fee84(_0x54406b);}});};AGIVertices[_0x4783('0x10')]['createCmContact']=function(_0x5f0f9a,_0x525b5a){this[_0x4783('0xe')]['createCmContact']({'firstName':_[_0x4783('0x3e')](_0x5f0f9a[_0x4783('0x12')])||_[_0x4783('0x3f')](_0x5f0f9a[_0x4783('0x12')])?_0x4783('0x40')+Math[_0x4783('0x41')]():_0x5f0f9a['name'],'lastName':_['isEmpty'](_0x5f0f9a[_0x4783('0x42')])||_[_0x4783('0x3f')](_0x5f0f9a[_0x4783('0x42')])?null:_0x5f0f9a[_0x4783('0x42')],'phone':_0x5f0f9a['phone'],'ListId':_0x5f0f9a[_0x4783('0x43')],'scheduledat':_0x5f0f9a[_0x4783('0x44')],'callbackUniqueid':this[_0x4783('0x34')][_0x4783('0x35')],'tags':_0x4783('0x45'),'description':_0x4783('0x46')+_0x5f0f9a[_0x4783('0x44')]['toString'](),'priority':_0x5f0f9a['callback_priority']})[_0x4783('0x18')](function(_0x74b4ce){_0x525b5a(null,_0x74b4ce);})[_0x4783('0x15')](function(_0xb0502d){_0x525b5a(_0xb0502d);});};AGIVertices[_0x4783('0x10')][_0x4783('0x47')]=function(_0x349e5b,_0x383294){this[_0x4783('0xe')][_0x4783('0x48')](_0x349e5b)[_0x4783('0x18')](function(_0x4bbb9e){_0x383294(null,_0x4bbb9e?_0x4bbb9e[_0x4783('0x12')]:![]);})[_0x4783('0x15')](function(_0x3a7305){_0x383294(_0x3a7305);});};AGIVertices[_0x4783('0x10')][_0x4783('0x49')]=function(_0x2be320,_0x289efc,_0x59abc1){var _0x2b23bc={'role':_0x4783('0x4a')};_0x2b23bc[_0x2be320]=this[_0x4783('0x34')][_0x4783('0x38')];this[_0x4783('0xe')][_0x4783('0x49')](_0x2b23bc,_0x289efc,this['channel']['uniqueid'])[_0x4783('0x18')](function(_0x2d1416){_0x59abc1(null,_[_0x4783('0x3f')](_0x2d1416)?![]:!![]);})[_0x4783('0x15')](function(_0x5d9e16){logger[_0x4783('0x29')](_0x5d9e16);_0x59abc1(null,![]);});};AGIVertices[_0x4783('0x10')][_0x4783('0x4b')]=function(_0x4822a6,_0x23351f){var _0x15da2b={'role':_0x4783('0x4a')};_0x15da2b[_0x4822a6]=this['channel'][_0x4783('0x38')];this[_0x4783('0xe')]['agentUnpause'](_0x15da2b)['then'](function(_0x390d0a){_0x23351f(null,_[_0x4783('0x3f')](_0x390d0a)?![]:!![]);})[_0x4783('0x15')](function(_0xf7a1de){logger[_0x4783('0x29')](_0xf7a1de);_0x23351f(null,![]);});};AGIVertices[_0x4783('0x10')][_0x4783('0x4c')]=function(_0x4b0667,_0x527909){var _0x2a7296={'role':_0x4783('0x4a')};_0x2a7296[_0x4b0667]=this[_0x4783('0x34')]['callerid'];this[_0x4783('0xe')][_0x4783('0x4c')](_0x2a7296)[_0x4783('0x18')](function(_0x200d05){_0x527909(null,_['isNil'](_0x200d05)?![]:!![]);})[_0x4783('0x15')](function(_0x44ec0d){logger['error'](_0x44ec0d);_0x527909(null,![]);});};AGIVertices[_0x4783('0x10')][_0x4783('0x4d')]=function(_0x5edbc1,_0x5700a3){var _0x1ec871={'role':_0x4783('0x4a')};_0x1ec871[_0x5edbc1]=this[_0x4783('0x34')][_0x4783('0x38')];var _0x4decca=_0x5edbc1!='internal'?util[_0x4783('0x27')]('%s/%s@from-sip/n',_0x4783('0x4e'),this[_0x4783('0x34')][_0x4783('0x38')]):undefined;this[_0x4783('0xe')][_0x4783('0x4d')](_0x1ec871,_0x4decca)[_0x4783('0x18')](function(_0x14f903){_0x5700a3(null,_[_0x4783('0x3f')](_0x14f903)?![]:!![]);})[_0x4783('0x15')](function(_0x4fe4ae){logger[_0x4783('0x29')](_0x4fe4ae);_0x5700a3(null,![]);});};AGIVertices[_0x4783('0x10')][_0x4783('0x4f')]=function(_0xf39703,_0x4985cd){sh['exec'](_['trim'](_0xf39703),function(_0x1be0e3,_0x34cfc1){var _0x8a6349=_0x34cfc1['replace'](/(\r\n|\n|\r)/gm,'');_0x4985cd(null,_0x8a6349);});};AGIVertices['prototype'][_0x4783('0x50')]=function(_0x45fb65,_0x540f7f){scripts[_0x4783('0x50')](_0x45fb65[_0x4783('0x51')],_0x45fb65['google_cloud_tts_text_type']||_0x4783('0x52'),_0x45fb65['text'],_0x45fb65[_0x4783('0x53')]||'en-US',_0x45fb65[_0x4783('0x54')]||_0x4783('0x55'),_0x45fb65[_0x4783('0x56')]||_0x4783('0x57'))[_0x4783('0x18')](function(_0x239259){_0x540f7f(null,_0x239259);})['catch'](function(_0x3b6826){_0x540f7f(_0x3b6826);});};AGIVertices['prototype'][_0x4783('0x58')]=function(_0xcb232c,_0x4633aa){scripts[_0x4783('0x58')](_0xcb232c[_0x4783('0x52')],_0xcb232c[_0x4783('0x59')]||'en',0x1)[_0x4783('0x18')](function(_0x45e6bd){_0x4633aa(null,_0x45e6bd);})['catch'](function(_0x1f10c2){_0x4633aa(_0x1f10c2);});};AGIVertices[_0x4783('0x10')][_0x4783('0x5a')]=function(_0x27f10c,_0x3c2959){var _0x48b388={'uri':_0x27f10c['url'],'method':_0x27f10c[_0x4783('0x5b')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x27f10c['timeout'])==='number'&&parseInt(_0x27f10c[_0x4783('0x5c')])>=0x1?parseInt(_0x27f10c[_0x4783('0x5c')])*0x3e8:0x5*0x3e8};if(_[_0x4783('0x5d')](['POST',_0x4783('0x5e')],_0x48b388[_0x4783('0x5b')][_0x4783('0x5f')]())){try{_0x48b388['body']=_0x27f10c['rawBody']?JSON['parse'](_0x27f10c[_0x4783('0x60')]):{};}catch(_0xb77d54){logger[_0x4783('0x29')](_0x4783('0x61'),_0xb77d54);}}try{_0x48b388[_0x4783('0x62')]=_0x27f10c[_0x4783('0xa')]?JSON['parse'](_0x27f10c[_0x4783('0xa')]):{};}catch(_0x4cba4d){logger[_0x4783('0x29')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4cba4d);}if(_0x27f10c[_0x4783('0x63')]){try{var _0xdaa9f2=require(_0x27f10c[_0x4783('0x63')])[_0x4783('0x64')](this,_0x48b388);_0x48b388[_0x4783('0x65')]=Mustache['render'](_0x27f10c['url'],_0xdaa9f2,{},['$$','$$']);if(_0x48b388['headers']){_0x48b388['headers']=JSON[_0x4783('0x66')](Mustache['render'](JSON[_0x4783('0x67')](_0x48b388[_0x4783('0x62')]),_0xdaa9f2,{},['$$','$$']));}if(_0x48b388['body']){_0x48b388['body']=JSON[_0x4783('0x66')](Mustache[_0x4783('0x68')](JSON[_0x4783('0x67')](_0x48b388[_0x4783('0x69')]),_0xdaa9f2,{},['$$','$$']));}}catch(_0x96136b){logger[_0x4783('0x29')](_0x4783('0x6a'),_0x96136b);}}rp(_0x48b388)[_0x4783('0x18')](function(_0x36f5a5){var _0x3a9630={'statusCode':_0x36f5a5[_0x4783('0x6b')]||0xc8,'statusMessage':_0x36f5a5[_0x4783('0x6c')]||'OK','headers':_0x36f5a5[_0x4783('0x62')]||{},'body':_0x36f5a5['body']||{}};_0x3c2959(null,_0x3a9630);})[_0x4783('0x15')](function(_0x121929){var _0x395f9e={'statusCode':_0x121929[_0x4783('0x6b')]||0x1f4,'statusMessage':_0x121929[_0x4783('0x6d')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x121929['options'][_0x4783('0x62')]||{},'body':_0x121929[_0x4783('0x6e')][_0x4783('0x69')]||{}};_0x3c2959(null,_0x395f9e);});};AGIVertices[_0x4783('0x10')]['googleDialogflow']=function(_0x2eda31,_0x191d3a){scripts[_0x4783('0x6f')](this[_0x4783('0x34')][_0x4783('0x35')],_0x2eda31[_0x4783('0x70')],_0x2eda31[_0x4783('0x52')],_0x2eda31['dialogflow_language']||'en')[_0x4783('0x18')](function(_0x41121e){_0x191d3a(null,_0x41121e);})[_0x4783('0x15')](function(_0x46c608){_0x191d3a(_0x46c608);});};AGIVertices[_0x4783('0x10')][_0x4783('0x71')]=function(_0x32a665,_0x45aff6){scripts['googleDialogflowV2'](this[_0x4783('0x34')]['uniqueid'],_0x32a665['dialogflowV2_project_id'],_0x32a665[_0x4783('0x72')],_0x32a665[_0x4783('0x73')],_0x32a665[_0x4783('0x52')],_0x32a665[_0x4783('0x74')]||'en')['then'](function(_0x2e7350){_0x45aff6(null,_0x2e7350);})[_0x4783('0x15')](function(_0x527478){_0x45aff6(_0x527478);});};AGIVertices[_0x4783('0x10')][_0x4783('0x75')]=function(_0x4cbdfd,_0x57658b){scripts[_0x4783('0x75')](this[_0x4783('0x34')],_0x4cbdfd)[_0x4783('0x18')](function(_0x2072e5){_0x57658b(null,_0x2072e5);})[_0x4783('0x15')](function(_0x4f773d){_0x57658b(_0x4f773d);});};AGIVertices[_0x4783('0x10')]['ispeechTTS']=function(_0x1d3ebe,_0x4437b2){scripts['ispeechTTS'](_0x1d3ebe['key'],_0x1d3ebe[_0x4783('0x52')],_0x1d3ebe[_0x4783('0x76')]||_0x4783('0x77'),_0x1d3ebe[_0x4783('0x78')])[_0x4783('0x18')](function(_0x1a715d){_0x4437b2(null,_0x1a715d);})[_0x4783('0x15')](function(_0x4224c9){_0x4437b2(_0x4224c9);});};AGIVertices[_0x4783('0x10')]['ispeechASR']=function(_0x2abcc6,_0x44456b,_0x4bced1){scripts[_0x4783('0x79')](_0x44456b,_0x2abcc6[_0x4783('0x70')],_0x2abcc6[_0x4783('0x7a')]||'en-US',this[_0x4783('0x7b')](_0x2abcc6[_0x4783('0x7c')])?_0x2abcc6[_0x4783('0x7c')]:undefined)[_0x4783('0x18')](function(_0xfd822b){_0x4bced1(null,_0xfd822b);})[_0x4783('0x15')](function(_0x5b353b){_0x4bced1(_0x5b353b);});};AGIVertices['prototype'][_0x4783('0x7d')]=function(_0x3f6353,_0x3f705d){scripts[_0x4783('0x7d')](_0x3f6353['aws_access_key_id'],_0x3f6353[_0x4783('0x7e')],_0x3f6353['aws_polly_region'],_0x3f6353['aws_polly_voice']||_0x4783('0x7f'),_0x3f6353[_0x4783('0x52')],_0x3f6353[_0x4783('0x80')]||_0x4783('0x52'))[_0x4783('0x18')](function(_0x2b0164){_0x3f705d(null,_0x2b0164);})[_0x4783('0x15')](function(_0x6ef7a8){_0x3f705d(_0x6ef7a8);});};AGIVertices[_0x4783('0x10')][_0x4783('0x81')]=function(_0x4abe31,_0x4b3d91){scripts['awsLex'](this[_0x4783('0x34')][_0x4783('0x35')],_0x4abe31['aws_access_key_id'],_0x4abe31[_0x4783('0x7e')],_0x4abe31['aws_lex_region'],_0x4abe31[_0x4783('0x52')],_0x4abe31[_0x4783('0x82')])['then'](function(_0x596246){_0x4b3d91(null,_0x596246);})[_0x4783('0x15')](function(_0x10d089){_0x4b3d91(_0x10d089);});};AGIVertices[_0x4783('0x10')][_0x4783('0x83')]=function(_0xe8cbb4,_0x573dc2,_0x45cd0e){scripts[_0x4783('0x83')](_0x573dc2,_0xe8cbb4[_0x4783('0x70')],_0xe8cbb4[_0x4783('0x84')]||_0x4783('0x77'))['then'](function(_0x11360b){_0x45cd0e(null,_0x11360b);})[_0x4783('0x15')](function(_0x3c4e55){_0x45cd0e(_0x3c4e55);});};AGIVertices[_0x4783('0x10')][_0x4783('0x85')]=function(_0x54e485,_0x4b31a3,_0x8ed524){scripts[_0x4783('0x85')](_0x4b31a3,_0x54e485[_0x4783('0x86')],_0x54e485['appsecret'],_0x54e485['uri'])[_0x4783('0x18')](function(_0x1962a9){_0x8ed524(null,_0x1962a9);})['catch'](function(_0x3724fc){_0x8ed524(_0x3724fc);});};AGIVertices['prototype'][_0x4783('0x87')]=function(_0x965f01){var _0x181c68=_['includes'](verticesWithRetry,_0x965f01['agicommand'])?_0x965f01:_[_0x4783('0x88')](_0x965f01);for(var _0x47c136 in _0x181c68){if(_0x181c68[_0x4783('0x89')](_0x47c136)){if(_0x181c68[_0x47c136]&&_[_0x4783('0x8a')](_0x181c68[_0x47c136])){if(_[_0x4783('0x5d')](recursiveMapAttributes,_0x47c136)){_0x181c68[_0x47c136]=this['replaceObjectAllVariables'](_0x181c68[_0x47c136]);}else{_0x181c68[_0x47c136]=this[_0x4783('0x8b')](_0x181c68[_0x47c136]);}}}}return _0x181c68;};AGIVertices[_0x4783('0x10')][_0x4783('0x8c')]=function(_0x53edea){for(var _0x341dd3 in _0x53edea){if(_0x53edea[_0x4783('0x89')](_0x341dd3)){if(_['isPlainObject'](_0x53edea[_0x341dd3])){this[_0x4783('0x8c')](_0x53edea[_0x341dd3]);}else if(_['isArray'](_0x53edea[_0x341dd3])){for(var _0x41ab80=0x0;_0x41ab80<_0x53edea[_0x341dd3]['length'];_0x41ab80++){this[_0x4783('0x8c')](_0x53edea[_0x341dd3][_0x41ab80]);}}else if(_[_0x4783('0x8a')](_0x53edea[_0x341dd3])){_0x53edea[_0x341dd3]=this[_0x4783('0x8b')](_0x53edea[_0x341dd3]);}}}};AGIVertices[_0x4783('0x10')][_0x4783('0x8d')]=function(_0x15879f,_0x1ef27c){for(var _0x1087ca in _0x15879f){if(_0x15879f[_0x4783('0x89')](_0x1087ca)){if(_['isPlainObject'](_0x15879f[_0x1087ca])){if(!_['isEmpty'](_0x15879f[_0x1087ca])){this[_0x4783('0x8d')](_0x15879f[_0x1087ca],util[_0x4783('0x27')](_0x4783('0x8e'),_0x1ef27c,_0x1087ca));}}else if(_['isArray'](_0x15879f[_0x1087ca])){for(var _0x2ce8bb=0x0;_0x2ce8bb<_0x15879f[_0x1087ca][_0x4783('0x8f')];_0x2ce8bb++){this[_0x4783('0x8d')](_0x15879f[_0x1087ca][_0x2ce8bb],util[_0x4783('0x27')](_0x4783('0x8e'),_0x1ef27c,_0x1087ca+'['+_0x2ce8bb+']'));}}else{if(!_[_0x4783('0x3f')](_0x15879f[_0x1087ca])){this['channel']['setVariable'](util[_0x4783('0x27')](_0x4783('0x8e'),_0x1ef27c,_0x1087ca),_0x15879f[_0x1087ca]);}}}}};AGIVertices[_0x4783('0x10')][_0x4783('0x90')]=function(_0x3935ae){try{var _0x3eb63a=JSON[_0x4783('0x66')](_0x3935ae);this[_0x4783('0x8c')](_0x3eb63a);return JSON[_0x4783('0x67')](_0x3eb63a);}catch(_0x118baa){return this[_0x4783('0x8b')](_0x3935ae);}};AGIVertices[_0x4783('0x10')][_0x4783('0x8b')]=function(_0x7867af){var _0x2b1a34=_0x7867af[_0x4783('0x91')]('{');for(var _0x2eeb50=0x1;_0x2eeb50<_0x2b1a34[_0x4783('0x8f')];_0x2eeb50+=0x1){var _0x323a40=_0x2b1a34[_0x2eeb50][_0x4783('0x91')]('}');if(_0x323a40[_0x4783('0x8f')]>0x1){_0x7867af=_0x7867af[_0x4783('0x92')]('{'+_0x323a40[0x0]+'}',this[_0x4783('0x34')][_0x4783('0x11')](_0x323a40[0x0])[_0x4783('0x93')]||_0x323a40[0x0]);}}if(_0x2b1a34[_0x4783('0x8f')]===0x1){return _0x7867af['toString']();}return this['replaceAllVariables'](_0x7867af);};AGIVertices[_0x4783('0x10')][_0x4783('0x94')]=function(_0x144cd0,_0x1d05ef){var _0x3149fa=this[_0x4783('0x34')][_0x4783('0x11')](_0x144cd0);if(_0x3149fa['result']===-0x1){return _0x3149fa;}logger[_0x4783('0x2c')](util[_0x4783('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1d05ef,_0x3149fa[_0x4783('0x93')]));return this['channel'][_0x4783('0x95')](_0x1d05ef,_0x3149fa[_0x4783('0x93')]);};AGIVertices['prototype']['isConfigured']=function(_0x536870){return _0x536870&&_0x536870!=='0'&&_0x536870!=='-1'&&_0x536870!=='';};AGIVertices[_0x4783('0x10')]['maxRetry']=function(_0x39ee9b){this[_0x4783('0x96')][_0x4783('0x64')](this,_0x39ee9b,'-');_0x39ee9b[_0x4783('0x97')]=_0x39ee9b['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4783('0x10')]['mrcpsynth']=function(_0x7356fc){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x98'),_0x7356fc[_0x4783('0x99')]));if(!this['isConfigured'](_0x7356fc[_0x4783('0x52')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x9b'));}var _0x572482='\x22'+_0x7356fc[_0x4783('0x52')]+'\x22';if(this[_0x4783('0x7b')](_0x7356fc['options'])){_0x572482+=','+_0x7356fc[_0x4783('0x6e')];}var _0x42eff7=this['channel'][_0x4783('0x9c')](_0x4783('0x9d'),_0x572482);if(_0x42eff7[_0x4783('0x9e')]===-0x1){return _0x42eff7;}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x572482));};AGIVertices[_0x4783('0x10')][_0x4783('0x9f')]=function(_0x25bad8){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0xa0'),_0x25bad8[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x25bad8[_0x4783('0xa1')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xa2'));}var _0x2ea8c1=_0x25bad8[_0x4783('0xa1')];if(this['isConfigured'](_0x25bad8[_0x4783('0x6e')])){_0x2ea8c1+=','+_0x25bad8[_0x4783('0x6e')];}var _0x5385bf=this[_0x4783('0x34')][_0x4783('0x9c')]('MRCPRecog',_0x2ea8c1);if(_0x5385bf[_0x4783('0x9e')]===-0x1){return _0x5385bf;}var _0x1c3551=this['getAndSetVariable'](_0x4783('0xa3'),'MRCP_RECOG_CONFIDENCE');if(_0x1c3551['result']===-0x1){return _0x1c3551;}var _0x4a8ac9=this[_0x4783('0x94')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x4a8ac9[_0x4783('0x9e')]===-0x1){return _0x4a8ac9;}var _0x3a6f13=this['getAndSetVariable'](_0x4783('0xa4'),_0x4783('0xa5'));if(_0x3a6f13['result']===-0x1){return _0x3a6f13;}return this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0xa6'),_0x2ea8c1));};AGIVertices[_0x4783('0x10')][_0x4783('0x6')]=function(_0x3b562c){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0xa7'),_0x3b562c[_0x4783('0x99')]));return this[_0x4783('0x34')][_0x4783('0x6')]([_0x3b562c[_0x4783('0xa8')],_0x3b562c['args']]);};AGIVertices[_0x4783('0x10')][_0x4783('0xa9')]=function(_0x476a62){logger['info'](util['format'](_0x4783('0xaa'),_0x476a62[_0x4783('0x99')]));if(this['isConfigured'](_0x476a62['timeout'])){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x476a62[_0x4783('0x5c')]));var _0x3d558d=this['channel'][_0x4783('0xab')](_0x476a62[_0x4783('0x5c')]);if(_0x3d558d[_0x4783('0x9e')]===-0x1){return _0x3d558d;}}return this['channel']['answer']();};AGIVertices['prototype'][_0x4783('0x45')]=function(_0x672261){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x672261[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x672261[_0x4783('0x43')])){return this['channel'][_0x4783('0x29')](_0x672261,_0x4783('0xac'));}_0x672261[_0x4783('0x44')]=moment();if(this[_0x4783('0x7b')](_0x672261['delay'])){_0x672261[_0x4783('0x44')]=moment()[_0x4783('0xad')](_0x672261[_0x4783('0xae')],'minutes');}if(!this[_0x4783('0x7b')](_0x672261['callback_priority'])){_0x672261['callback_priority']=0x2;}this[_0x4783('0xaf')][_0x4783('0x64')](this,_0x672261);return this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0xb0'),_0x672261[_0x4783('0xb1')],_0x672261[_0x4783('0x43')],_0x672261[_0x4783('0x44')]));};AGIVertices[_0x4783('0x10')][_0x4783('0xb2')]=function(_0x5b1c29){logger[_0x4783('0x2c')](util['format'](_0x4783('0xb3'),_0x5b1c29[_0x4783('0x99')]));var _0x378ae9=this[_0x4783('0x34')][_0x4783('0x9c')](_0x5b1c29[_0x4783('0xb4')],_0x5b1c29['options']);if(_0x378ae9[_0x4783('0x9e')]===-0x1){return _0x378ae9;}return this[_0x4783('0x34')]['noop'](util[_0x4783('0x27')](_0x4783('0xb5'),_0x5b1c29['application'],_0x5b1c29[_0x4783('0x6e')]));};AGIVertices[_0x4783('0x10')]['lumenvoxtts']=function(_0x2ab86e){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0xb6'),_0x2ab86e[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x2ab86e[_0x4783('0x52')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x9b'));}var _0x18b8c9='\x22'+_0x2ab86e[_0x4783('0x52')]+'\x22';if(this[_0x4783('0x7b')](_0x2ab86e['options'])){_0x18b8c9+=','+_0x2ab86e[_0x4783('0x6e')];}var _0x16cd85=this[_0x4783('0x34')]['exec'](_0x4783('0x9d'),_0x18b8c9);if(_0x16cd85[_0x4783('0x9e')]===-0x1){return _0x16cd85;}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xb7'),_0x18b8c9));};AGIVertices['prototype'][_0x4783('0xb8')]=function(_0x208617){logger[_0x4783('0x2c')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x208617[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x208617[_0x4783('0x52')])){return this[_0x4783('0x34')][_0x4783('0x9a')]('no\x20text\x20configured');}var _0xd1d58e='\x22'+_0x208617[_0x4783('0x52')]+'\x22';if(this[_0x4783('0x7b')](_0x208617['options'])){_0xd1d58e+=','+_0x208617[_0x4783('0x6e')];}var _0x3a6dd0=this[_0x4783('0x34')][_0x4783('0x9c')](_0x4783('0x9d'),_0xd1d58e);if(_0x3a6dd0[_0x4783('0x9e')]===-0x1){return _0x3a6dd0;}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xb7'),_0xd1d58e));};AGIVertices[_0x4783('0x10')]['lumenvoxasr']=function(_0x3b925a){logger[_0x4783('0x2c')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3b925a['label']));if(!this[_0x4783('0x7b')](_0x3b925a['grammar'])){return this['channel'][_0x4783('0x9a')](_0x4783('0xa2'));}var _0x58da52=_0x3b925a[_0x4783('0xa1')];if(this['isConfigured'](_0x3b925a[_0x4783('0x6e')])){_0x58da52+=','+_0x3b925a[_0x4783('0x6e')];}var _0x250f0f=this[_0x4783('0x34')][_0x4783('0x9c')](_0x4783('0xb9'),_0x58da52);if(_0x250f0f['result']===-0x1){return _0x250f0f;}var _0x1e089e=this[_0x4783('0x94')](_0x4783('0xa3'),_0x4783('0xba'));if(_0x1e089e['result']===-0x1){return _0x1e089e;}var _0xcd1c17=this[_0x4783('0x94')](_0x4783('0xbb'),_0x4783('0xbc'));if(_0xcd1c17['result']===-0x1){return _0xcd1c17;}var _0x54775e=this[_0x4783('0x94')](_0x4783('0xa4'),_0x4783('0xbd'));if(_0x54775e['result']===-0x1){return _0x54775e;}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xa6'),_0x58da52));};AGIVertices[_0x4783('0x10')][_0x4783('0xbe')]=function(_0x50d208){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0xbf'),_0x50d208[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x50d208['grammar'])){return this[_0x4783('0x34')]['noop'](_0x4783('0xa2'));}var _0x616b05=_0x50d208[_0x4783('0xa1')];if(this[_0x4783('0x7b')](_0x50d208['options'])){_0x616b05+=','+_0x50d208[_0x4783('0x6e')];}var _0x13e5f7=this[_0x4783('0x34')][_0x4783('0x9c')]('MRCPRecog',_0x616b05);if(_0x13e5f7[_0x4783('0x9e')]===-0x1){return _0x13e5f7;}var _0x171194=this['getAndSetVariable'](_0x4783('0xa3'),_0x4783('0xc0'));if(_0x171194[_0x4783('0x9e')]===-0x1){return _0x171194;}var _0x112ff7=this[_0x4783('0x94')]('RECOG_INPUT()',_0x4783('0xc1'));if(_0x112ff7['result']===-0x1){return _0x112ff7;}var _0x8d030b=this['getAndSetVariable'](_0x4783('0xa4'),_0x4783('0xc2'));if(_0x8d030b[_0x4783('0x9e')]===-0x1){return _0x8d030b;}return this['channel']['noop'](util[_0x4783('0x27')](_0x4783('0xa6'),_0x616b05));};AGIVertices['prototype'][_0x4783('0xc3')]=function(_0x323b25){logger[_0x4783('0x2c')](util['format'](_0x4783('0xc4'),_0x323b25['label']));if(!this['isConfigured'](_0x323b25[_0x4783('0xc5')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x323b25,_0x4783('0xc6'));}var _0xab300f=this[_0x4783('0x19')][_0x4783('0x64')](this,_0x323b25[_0x4783('0xc5')]);if(!_0xab300f){return this[_0x4783('0x34')]['error'](_0x323b25,_0x4783('0xc7'));}if(!this['isConfigured'](_0x323b25[_0x4783('0xc8')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x323b25,_0x4783('0xc9'));}var _0x5bf796=_0x323b25[_0x4783('0xc8')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0xca'),_0x5bf796));var _0x187a92=this[_0x4783('0xcb')][_0x4783('0x64')](this,_0xab300f,_0x5bf796);this[_0x4783('0x96')][_0x4783('0x64')](this,_0x323b25,_0x5bf796);if(!this[_0x4783('0x7b')](_0x323b25['variable_id'])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xcc'));}var _0x275bd1=this['getVariable'][_0x4783('0x64')](this,_0x323b25[_0x4783('0xcd')]);if(!_0x275bd1){return this['channel']['error'](_0x323b25,'no\x20variable\x20found');}var _0x5131a0=this;_0x187a92[_0x4783('0xce')](function(_0x13f85a,_0x3d641b){Object[_0x4783('0xcf')](_0x13f85a)[_0x4783('0xce')](function(_0x232600){_0x5131a0[_0x4783('0x34')][_0x4783('0x95')](util[_0x4783('0x27')]('%s[%s][%s]',_0x275bd1,_0x3d641b,_0x232600),_0x13f85a[_0x232600]);});});this[_0x4783('0x34')][_0x4783('0x95')](util[_0x4783('0x27')](_0x4783('0xd0'),_0x275bd1),_0x187a92[_0x4783('0x8f')]);return this['channel'][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xd1'),_0x275bd1));};AGIVertices[_0x4783('0x10')][_0x4783('0xd2')]=function(_0x55259d){logger[_0x4783('0xd3')](util[_0x4783('0x27')](_0x4783('0xd4'),_0x55259d[_0x4783('0x99')]));if(!this['isConfigured'](_0x55259d[_0x4783('0xd5')])){return this[_0x4783('0x34')]['error'](_0x55259d,_0x4783('0xd6'));}var _0x132165=this['getUser'][_0x4783('0x64')](this,_0x55259d[_0x4783('0xd5')]);if(!_0x132165){return this[_0x4783('0x34')]['error'](_0x55259d,'no\x20user\x20found');}var _0x2762c1=this['channel'][_0x4783('0x9c')](_0x4783('0xd7'),[util[_0x4783('0x27')](_0x4783('0xd8'),_0x132165),_0x55259d[_0x4783('0x5c')],_0x55259d[_0x4783('0xd9')],_0x55259d[_0x4783('0xda')]]);if(_0x2762c1[_0x4783('0x9e')]===-0x1){return _0x2762c1;}return this['channel']['noop'](util['format'](_0x4783('0xdb'),'DIAL'));};AGIVertices['prototype'][_0x4783('0xdc')]=function(_0x5a6f67){logger['info'](util[_0x4783('0x27')](_0x4783('0xdd'),_0x5a6f67[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x5a6f67[_0x4783('0x70')])){return this[_0x4783('0x34')][_0x4783('0x9a')]('no\x20key\x20configured');}if(!this[_0x4783('0x7b')](_0x5a6f67[_0x4783('0x52')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x9b'));}this[_0x4783('0x34')]['bot']=!![];this[_0x4783('0x96')](_0x5a6f67);this[_0x4783('0xde')](_0x5a6f67[_0x4783('0x52')],'in','','');this['channel'][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xdf'),_0x5a6f67[_0x4783('0x52')]));var _0x17802e=this[_0x4783('0x6f')][_0x4783('0x64')](this,_0x5a6f67);if(_0x17802e){for(var _0x4af66a in _0x17802e){if(_0x17802e['hasOwnProperty'](_0x4af66a)){this[_0x4783('0x34')][_0x4783('0x95')](util[_0x4783('0x27')]('DIALOGFLOW_%s',_0x4af66a[_0x4783('0x5f')]()),_0x17802e[_0x4af66a]);}}this[_0x4783('0xde')](_0x17802e[_0x4783('0xe0')],_0x4783('0xe1'),_0x4783('0xdc'),'');return this[_0x4783('0x34')]['noop'](util['format'](_0x4783('0xe2'),_0x17802e[_0x4783('0xe0')]));}return this[_0x4783('0x34')][_0x4783('0x29')](_0x5a6f67,_0x4783('0xe3'));};AGIVertices['prototype']['dialogflowV2']=function(_0x58c960){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0xe4'),_0x58c960[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x58c960[_0x4783('0xe5')])){return this['channel']['noop'](_0x4783('0xe6'));}if(!this[_0x4783('0x7b')](_0x58c960[_0x4783('0x72')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xe7'));}if(!this[_0x4783('0x7b')](_0x58c960[_0x4783('0x73')])){return this['channel'][_0x4783('0x9a')](_0x4783('0xe8'));}if(!this['isConfigured'](_0x58c960[_0x4783('0x74')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xe9'));}if(!this['isConfigured'](_0x58c960['text'])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x9b'));}this[_0x4783('0x34')][_0x4783('0xea')]=!![];this[_0x4783('0x96')](_0x58c960);this[_0x4783('0xde')](_0x58c960[_0x4783('0x52')],'in','','');this[_0x4783('0x34')]['noop'](util[_0x4783('0x27')](_0x4783('0xeb'),_0x58c960['text']));var _0x4da4d0=this[_0x4783('0x71')][_0x4783('0x64')](this,_0x58c960);if(_0x4da4d0){for(var _0x57ec46 in _0x4da4d0){if(_0x4da4d0['hasOwnProperty'](_0x57ec46)){if(_0x57ec46!=='providerResponse'){this[_0x4783('0x34')][_0x4783('0x95')](util[_0x4783('0x27')](_0x4783('0xec'),_0x57ec46[_0x4783('0x5f')]()),_0x4da4d0[_0x57ec46]);}}}this[_0x4783('0xde')](_0x4da4d0[_0x4783('0xe0')],_0x4783('0xe1'),_0x4783('0xed'),_0x4da4d0[_0x4783('0xee')]);return this[_0x4783('0x34')]['noop'](util[_0x4783('0x27')](_0x4783('0xef'),_0x4da4d0[_0x4783('0xe0')]));}return this[_0x4783('0x34')]['error'](_0x58c960,_0x4783('0xf0'));};AGIVertices[_0x4783('0x10')][_0x4783('0xf1')]=function(_0x2f7719){logger['info'](util[_0x4783('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2f7719[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x2f7719['ndauth_url'])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xf2'));}if(!this['isConfigured'](_0x2f7719[_0x4783('0xf3')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xf4'));}if(!this[_0x4783('0x7b')](_0x2f7719[_0x4783('0xf5')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xf6'));}if(!this[_0x4783('0x7b')](_0x2f7719[_0x4783('0xf7')])){return this['channel']['noop'](_0x4783('0x9b'));}this[_0x4783('0x34')][_0x4783('0xea')]=!![];this[_0x4783('0x96')](_0x2f7719);this[_0x4783('0xde')](_0x2f7719['text'],'in','','');this[_0x4783('0x34')]['noop'](util[_0x4783('0x27')](_0x4783('0xf8'),_0x2f7719[_0x4783('0x52')]));var _0x26087c=this['sestekNDA'][_0x4783('0x64')](this,_0x2f7719);if(_0x26087c){for(var _0x3c2ece in _0x26087c){if(_0x26087c[_0x4783('0x89')](_0x3c2ece)){this['channel'][_0x4783('0x95')](util[_0x4783('0x27')](_0x4783('0xf9'),_0x3c2ece[_0x4783('0x5f')]()),_0x26087c[_0x3c2ece]);}}this[_0x4783('0xde')](_0x26087c['speech'],'out','sesteknda','');if(_0x26087c['audiofile']){this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xfa'),_0x26087c[_0x4783('0xfb')]));var _0x286b42=this[_0x4783('0x34')]['streamFile'](_0x26087c['audiofile']);try{fs[_0x4783('0xfc')](_0x26087c[_0x4783('0xfb')]+'.wav');}catch(_0x2035df){logger[_0x4783('0x29')](_0x2035df);}return _0x286b42;}else{return this[_0x4783('0x34')][_0x4783('0x9a')](util['format']('SestekNDA\x20Result\x20%s',_0x26087c[_0x4783('0xe0')]));}}return this['channel'][_0x4783('0x29')](_0x2f7719,_0x4783('0xfd'));};AGIVertices['prototype'][_0x4783('0xfe')]=function(_0x27e26a){logger[_0x4783('0x2c')](util['format'](_0x4783('0xff'),_0x27e26a['label']));return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xfe'));};AGIVertices[_0x4783('0x10')]['ext_dial']=function(_0x26f22c){logger[_0x4783('0x2c')](util['format'](_0x4783('0x100'),_0x26f22c[_0x4783('0x99')]));var _0x10a985='';if(_0x26f22c[_0x4783('0x101')]){if(!this[_0x4783('0x7b')](_0x26f22c[_0x4783('0x101')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x26f22c,_0x4783('0x102'));}else{var _0x58ada5=parseInt(_0x26f22c[_0x4783('0x101')],0xa);if(isNaN(_0x58ada5)){_0x10a985=_0x26f22c['trunk_id'];}else{_0x10a985=this['getTrunk'][_0x4783('0x64')](this,_0x26f22c['trunk_id']);if(!_0x10a985){return this['channel']['error'](_0x26f22c,_0x4783('0x103'));}}}}else if(_0x26f22c[_0x4783('0x104')]){_0x10a985=_0x26f22c[_0x4783('0x104')];}else{return this[_0x4783('0x34')][_0x4783('0x29')](_0x26f22c,_0x4783('0x102'));}var _0xd46e44=this['channel'][_0x4783('0x9c')]('DIAL',[util[_0x4783('0x27')]('SIP/%s/%s',_0x10a985,_0x26f22c['phone']),_0x26f22c[_0x4783('0x5c')],_0x26f22c[_0x4783('0xd9')],_0x26f22c[_0x4783('0xda')]]);if(_0xd46e44[_0x4783('0x9e')]===-0x1){return _0xd46e44;}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xdb'),_0x4783('0xd7')));};AGIVertices[_0x4783('0x10')][_0x4783('0x105')]=function(_0x4bf4c5){logger['info'](util[_0x4783('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4bf4c5[_0x4783('0x99')]));return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x105'));};AGIVertices['prototype'][_0x4783('0xc')]=function(_0x3f481a){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x106'),_0x3f481a[_0x4783('0x99')]));if(_0x3f481a[_0x4783('0x97')]===0x0){return this['maxRetry'](_0x3f481a);}_0x3f481a[_0x4783('0x97')]-=0x1;if(!this['isConfigured'](_0x3f481a[_0x4783('0x107')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x3f481a,_0x4783('0x108'));}var _0x156b25=this[_0x4783('0x1f')][_0x4783('0x64')](this,_0x3f481a['file_id']);if(!_0x156b25){return this[_0x4783('0x34')][_0x4783('0x29')](_0x3f481a,'no\x20file\x20audio\x20found');}if(!this[_0x4783('0x7b')](_0x3f481a[_0x4783('0xcd')])){return this['channel']['error'](_0x4783('0xcc'));}var _0x1b42a4=this[_0x4783('0x34')][_0x4783('0x109')](_0x156b25,_0x3f481a[_0x4783('0x10a')],_0x3f481a[_0x4783('0x10b')]);var _0x212aa8=_0x1b42a4[_0x4783('0x9e')]?_0x1b42a4[_0x4783('0x9e')]['toString']():'';logger[_0x4783('0x2c')]('test',JSON[_0x4783('0x67')](_0x1b42a4));if(_0x1b42a4[_0x4783('0x9e')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x3f481a,_0x212aa8);return _0x1b42a4;}else if(_0x1b42a4['extra']==='timeout'){_0x1b42a4['result']=_0x212aa8[_0x4783('0x8f')]>=parseInt(_0x3f481a[_0x4783('0x10c')])?'x':'i';}else{_0x1b42a4[_0x4783('0x9e')]=_0x212aa8[_0x4783('0x8f')]>=parseInt(_0x3f481a['mindigit'])&&_0x212aa8[_0x4783('0x8f')]<=parseInt(_0x3f481a[_0x4783('0x10b')])?'x':'i';}var _0x267e20=this[_0x4783('0x11')]['sync'](this,_0x3f481a['variable_id']);if(!_0x267e20){return this[_0x4783('0x34')][_0x4783('0x29')](_0x3f481a,_0x4783('0x10d'));}this['channel'][_0x4783('0x95')](_0x267e20,_0x212aa8);if(this[_0x4783('0x7b')](_0x3f481a[_0x4783('0x10e')])){var _0x407658=parseInt(_0x3f481a['hiddendigitsnum'],0xa);var _0x52def4=rs[_0x4783('0x10f')]({'charset':'*','length':_0x407658});var _0x11a594=_0x212aa8['length'];if(_0x11a594>0x0){if(_0x11a594>_0x407658){this['createSquareDetailsReport'][_0x4783('0x64')](this,_0x3f481a,_0x3f481a['hiddendigitspos']===_0x4783('0x110')?_0x52def4+_0x212aa8['substr'](_0x407658):_0x212aa8[_0x4783('0x111')](0x0,_0x11a594-_0x407658)+_0x52def4);}else{this[_0x4783('0x96')][_0x4783('0x64')](this,_0x3f481a,rs['generate']({'charset':'*','length':_0x11a594}));}}else{this[_0x4783('0x96')]['sync'](this,_0x3f481a,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x3f481a,_0x212aa8);}return _0x1b42a4;};AGIVertices[_0x4783('0x10')]['getsecretdigits']=function(_0x305c23){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x112'),_0x305c23['label']));return this[_0x4783('0xc')](_0x305c23);};AGIVertices[_0x4783('0x10')]['goal']=function(_0x45998c){logger[_0x4783('0x2c')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x45998c[_0x4783('0x99')]));this[_0x4783('0x96')]['sync'](this,_0x45998c,_0x45998c[_0x4783('0x113')]);return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x114'),_0x45998c[_0x4783('0x113')]));};AGIVertices[_0x4783('0x10')][_0x4783('0x115')]=function(_0x378910){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x116'),_0x378910[_0x4783('0x99')]));if(!this['isConfigured'](_0x378910[_0x4783('0x117')])||!this[_0x4783('0x7b')](_0x378910[_0x4783('0x7e')])){return this[_0x4783('0x34')]['noop'](_0x4783('0x118'));}if(!this[_0x4783('0x7b')](_0x378910['text'])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x9b'));}this['channel'][_0x4783('0x9a')](util['format'](_0x4783('0x119'),_0x378910[_0x4783('0x52')]));var _0xf9a4e1=this['awsPolly'][_0x4783('0x64')](this,_0x378910);if(_0xf9a4e1){this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x11a'),_0xf9a4e1));var _0x574cc6=this[_0x4783('0x34')]['streamFile'](_0xf9a4e1);try{fs['unlink'](_0xf9a4e1+_0x4783('0x11b'));}catch(_0x2cdb05){logger[_0x4783('0x29')](_0x2cdb05);}return _0x574cc6;}return this[_0x4783('0x34')][_0x4783('0x29')](_0x378910,_0x4783('0x11c'));};AGIVertices['prototype']['awslex']=function(_0x5b06ea){logger['info'](util[_0x4783('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5b06ea[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x5b06ea[_0x4783('0x117')])||!this['isConfigured'](_0x5b06ea[_0x4783('0x7e')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x118'));}if(!this['isConfigured'](_0x5b06ea[_0x4783('0x82')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x11d'));}if(!this[_0x4783('0x7b')](_0x5b06ea[_0x4783('0x52')])){return this['channel'][_0x4783('0x9a')]('no\x20text\x20configured');}this[_0x4783('0x34')][_0x4783('0xea')]=!![];this['createSquareDetailsReport'](_0x5b06ea);this[_0x4783('0xde')](_0x5b06ea[_0x4783('0x52')],'in','','');this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x11e'),_0x5b06ea[_0x4783('0x52')]));var _0x5a6e84=this[_0x4783('0x81')][_0x4783('0x64')](this,_0x5b06ea);if(_0x5a6e84){for(var _0x50a6c6 in _0x5a6e84){if(_0x5a6e84[_0x4783('0x89')](_0x50a6c6)&&_[_0x4783('0x8a')](_0x5a6e84[_0x50a6c6])){this[_0x4783('0x34')][_0x4783('0x95')](util['format']('AWS_LEX_%s',_0x50a6c6[_0x4783('0x5f')]()),_0x5a6e84[_0x50a6c6]);}}if(_[_0x4783('0x3f')](_0x5a6e84[_0x4783('0x6d')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x11f'));}else{this[_0x4783('0xde')](_0x5a6e84[_0x4783('0x6d')],_0x4783('0xe1'),_0x4783('0x120'),'');return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x121'),_0x5a6e84[_0x4783('0x6d')]));}}return this[_0x4783('0x34')][_0x4783('0x29')](_0x5b06ea,_0x4783('0x122'));};AGIVertices[_0x4783('0x10')]['googleasr']=function(_0x3ee90a){logger['info'](util[_0x4783('0x27')](_0x4783('0x123'),_0x3ee90a[_0x4783('0x99')],_0x3ee90a[_0x4783('0x5c')]));if(!this[_0x4783('0x7b')](_0x3ee90a[_0x4783('0x70')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x124'));}var _0x4fad49=_0x4783('0x125');var _0x4d38db=util[_0x4783('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x4783('0x10f')](0x4));var _0x5e2b88=util[_0x4783('0x27')]('%s.%s',_0x4d38db,_0x4fad49);var _0x2da75a=!![];if(_0x3ee90a[_0x4783('0x126')]===_0x4783('0x127')){_0x2da75a=![];}var _0x1cd1f1=this[_0x4783('0x34')]['recordFile'](_0x4d38db,_0x4fad49,_0x3ee90a[_0x4783('0x128')],_0x3ee90a[_0x4783('0x5c')],undefined,_0x2da75a);if(_0x1cd1f1[_0x4783('0x9e')]!==-0x1){this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x129'),_0x5e2b88));var _0x1df898=this['googleASR'][_0x4783('0x64')](this,_0x3ee90a,_0x5e2b88);if(_0x1df898){for(var _0x1c13d0 in _0x1df898){if(_0x1df898['hasOwnProperty'](_0x1c13d0)){this[_0x4783('0x34')][_0x4783('0x95')](util[_0x4783('0x27')](_0x4783('0x12a'),_0x1c13d0['toUpperCase']()),_0x1df898[_0x1c13d0]);}}return this['channel'][_0x4783('0x9a')](util['format'](_0x4783('0x12b'),JSON[_0x4783('0x67')](_0x1df898)));}}return _0x1cd1f1;};AGIVertices[_0x4783('0x10')][_0x4783('0x12c')]=function(_0x40eb49){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x40eb49[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x40eb49['appid'])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x12d'));}if(!this[_0x4783('0x7b')](_0x40eb49['appsecret'])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x12e'));}var _0x30dd12=_0x4783('0x125');var _0x2ebb51=util['format'](_0x4783('0x12f'),FILES_PATH,rs[_0x4783('0x10f')](0x4));var _0x2a5ab5=util['format']('%s.%s',_0x2ebb51,_0x30dd12);var _0x4805bf=!![];if(_0x40eb49[_0x4783('0x126')]===_0x4783('0x127')){_0x4805bf=![];}var _0x265af8=this['channel'][_0x4783('0x130')](_0x2ebb51,_0x30dd12,_0x40eb49['intKey'],_0x40eb49[_0x4783('0x5c')],undefined,_0x4805bf);if(_0x265af8[_0x4783('0x9e')]!==-0x1){this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x131'),_0x2a5ab5));var _0x53be3a=this[_0x4783('0x85')][_0x4783('0x64')](this,_0x40eb49,_0x2a5ab5);if(_0x53be3a){for(var _0x72023d in _0x53be3a){if(_0x53be3a[_0x4783('0x89')](_0x72023d)){this[_0x4783('0x34')][_0x4783('0x95')](util['format'](_0x4783('0x132'),_0x72023d['toUpperCase']()),_0x53be3a[_0x72023d]);}}return this[_0x4783('0x34')]['noop'](util['format']('TildeASR\x20Result\x20%s',JSON[_0x4783('0x67')](_0x53be3a)));}}return _0x265af8;};AGIVertices[_0x4783('0x10')][_0x4783('0x133')]=function(_0x100a26){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x100a26[_0x4783('0x99')]));return this[_0x4783('0x34')][_0x4783('0x134')](_0x100a26['context'],_0x100a26[_0x4783('0x135')],_0x100a26[_0x4783('0x3c')]);};AGIVertices[_0x4783('0x10')][_0x4783('0x136')]=function(_0x2959ab){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x137'),_0x2959ab[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x2959ab[_0x4783('0x138')])){return this[_0x4783('0x34')]['error'](_0x2959ab,_0x4783('0x139'));}try{var _0x470f28=eval(_0x2959ab[_0x4783('0x138')])?_0x4783('0x13a'):_0x4783('0x13b');this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x13c'),_0x2959ab[_0x4783('0x138')],_0x470f28));return{'code':0xc8,'result':_0x470f28};}catch(_0x13edfb){return{'code':0xc8,'result':_0x4783('0x13b')};}};AGIVertices['prototype']['gotoiftime']=function(_0x88d6f3){logger[_0x4783('0x2c')](util['format'](_0x4783('0x13d'),_0x88d6f3[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x88d6f3[_0x4783('0x13e')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x88d6f3,_0x4783('0x13f'));}var _0x39a47a=this['getIntervals'][_0x4783('0x64')](this,_0x88d6f3[_0x4783('0x13e')]);if(!_0x39a47a){return this[_0x4783('0x34')][_0x4783('0x29')](_0x88d6f3,_0x4783('0x140'));}for(var _0x1b9173=0x0;_0x1b9173<_0x39a47a[_0x4783('0x8f')];_0x1b9173+=0x1){var _0x4b3072=this['channel'][_0x4783('0x11')](util[_0x4783('0x27')](_0x4783('0x141'),_0x39a47a[_0x1b9173]));if(_0x4b3072['result']===-0x1){return _0x4b3072;}logger[_0x4783('0x2c')](util[_0x4783('0x27')]('IFTIME\x20%s\x20%s',_0x39a47a[_0x1b9173],_0x4b3072[_0x4783('0x93')]));if(_0x4b3072[_0x4783('0x93')]===_0x4783('0x13a')){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x142'),_0x39a47a[_0x1b9173],'true'));this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')]('IFTIME\x20%s\x20%s',_0x39a47a[_0x1b9173],'true'));return{'code':0xc8,'result':_0x4783('0x13a')};}else{logger[_0x4783('0x2c')](util[_0x4783('0x27')]('IFTIME\x20%s\x20%s',_0x39a47a[_0x1b9173],_0x4783('0x13b')));this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0x142'),_0x39a47a[_0x1b9173],_0x4783('0x13b')));}}return{'code':0xc8,'result':_0x4783('0x13b')};};AGIVertices['prototype'][_0x4783('0x143')]=function(_0x5ce25b){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x144'),_0x5ce25b[_0x4783('0x99')]));return this[_0x4783('0x34')]['hangup']();};AGIVertices['prototype'][_0x4783('0x145')]=function(_0x153167){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x153167[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x153167[_0x4783('0x70')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x124'));}var _0x4e2272=_0x4783('0x125');var _0x299b77=util[_0x4783('0x27')](_0x4783('0x12f'),FILES_PATH,rs[_0x4783('0x10f')](0x4));var _0x45bf74=util[_0x4783('0x27')](_0x4783('0x8e'),_0x299b77,_0x4e2272);var _0x2953c4=!![];if(_0x153167[_0x4783('0x126')]===_0x4783('0x127')){_0x2953c4=![];}var _0x4a8284=this[_0x4783('0x34')][_0x4783('0x130')](_0x299b77,_0x4e2272,_0x153167[_0x4783('0x128')],_0x153167[_0x4783('0x5c')],undefined,_0x2953c4);if(_0x4a8284[_0x4783('0x9e')]!==-0x1){this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x146'),_0x45bf74));var _0x20db0d=this['ispeechASR'][_0x4783('0x64')](this,_0x153167,_0x45bf74);if(_0x20db0d){for(var _0x346b73 in _0x20db0d){if(_0x20db0d[_0x4783('0x89')](_0x346b73)){this['channel'][_0x4783('0x95')](util[_0x4783('0x27')]('ISPEECH_ASR_%s',_0x346b73[_0x4783('0x5f')]()),_0x20db0d[_0x346b73]);}}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x147'),JSON[_0x4783('0x67')](_0x20db0d)));}}return _0x4a8284;};AGIVertices[_0x4783('0x10')][_0x4783('0x148')]=function(_0x4681d1){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x149'),_0x4681d1[_0x4783('0x99')]));if(!this['isConfigured'](_0x4681d1[_0x4783('0x70')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x124'));}if(!this['isConfigured'](_0x4681d1[_0x4783('0x52')])){return this[_0x4783('0x34')][_0x4783('0x9a')]('no\x20text\x20configured');}this[_0x4783('0x34')]['noop'](util[_0x4783('0x27')](_0x4783('0x14a'),_0x4681d1[_0x4783('0x52')]));var _0xa39cc1=this[_0x4783('0x14b')]['sync'](this,_0x4681d1);if(_0xa39cc1){this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x146'),_0xa39cc1));var _0x1cabdd=this[_0x4783('0x34')]['streamFile'](_0xa39cc1,_0x4681d1['intKey']);try{fs[_0x4783('0xfc')](_0xa39cc1+_0x4783('0x11b'));}catch(_0x231fc9){logger[_0x4783('0x29')](_0x231fc9);}return _0x1cabdd;}return this['channel'][_0x4783('0x29')](_0x4681d1,_0x4783('0x14c'));};AGIVertices[_0x4783('0x10')][_0x4783('0x14d')]=function(_0x193e88){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x193e88[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x193e88['findBy'])){return this[_0x4783('0x34')]['error'](_0x193e88,_0x4783('0x14e'));}logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x14f'),this['channel']['callerid'],_0x193e88['findBy']));var _0x57d4c6=this[_0x4783('0x4d')][_0x4783('0x64')](this,_0x193e88[_0x4783('0x150')]);if(_0x57d4c6){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x151'),this[_0x4783('0x34')][_0x4783('0x38')],_0x193e88[_0x4783('0x150')]));this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0x151'),this[_0x4783('0x34')]['callerid'],_0x193e88[_0x4783('0x150')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4783('0x27')](_0x4783('0x152'),this[_0x4783('0x34')][_0x4783('0x38')],_0x193e88['findBy']));this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x152'),this[_0x4783('0x34')]['callerid'],_0x193e88[_0x4783('0x150')]));return{'code':0xc8,'result':_0x4783('0x153')};}};AGIVertices['prototype'][_0x4783('0x154')]=function(_0x4d62b7){logger['info'](util[_0x4783('0x27')](_0x4783('0x155'),_0x4d62b7[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x4d62b7[_0x4783('0x150')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x4d62b7,_0x4783('0x14e'));}logger[_0x4783('0x2c')](util['format'](_0x4783('0x14f'),this[_0x4783('0x34')][_0x4783('0x38')],_0x4d62b7[_0x4783('0x150')]));var _0x2fe207=this[_0x4783('0x4c')]['sync'](this,_0x4d62b7[_0x4783('0x150')]);if(_0x2fe207){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x151'),this['channel'][_0x4783('0x38')],_0x4d62b7[_0x4783('0x150')]));this[_0x4783('0x34')]['noop'](util[_0x4783('0x27')](_0x4783('0x151'),this['channel'][_0x4783('0x38')],_0x4d62b7['findBy']));return{'code':0xc8,'result':_0x4783('0x156')};}else{logger[_0x4783('0x2c')](util[_0x4783('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4783('0x38')],_0x4d62b7[_0x4783('0x150')]));this[_0x4783('0x34')]['noop'](util['format'](_0x4783('0x152'),this['channel'][_0x4783('0x38')],_0x4d62b7[_0x4783('0x150')]));return{'code':0xc8,'result':_0x4783('0x153')};}};AGIVertices[_0x4783('0x10')][_0x4783('0x157')]=function(_0x414b12){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x158'),_0x414b12['label']));if(!this[_0x4783('0x7b')](_0x414b12['operation'])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x414b12,_0x4783('0x159'));}this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x15a'),_0x414b12[_0x4783('0x15b')]));var _0x458c29=eval(_0x414b12['operation']);if(!this['isConfigured'](_0x414b12['variable_id'])){return this['channel'][_0x4783('0x9a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x31e2a8=this[_0x4783('0x11')][_0x4783('0x64')](this,_0x414b12[_0x4783('0xcd')]);if(!_0x31e2a8){return this[_0x4783('0x34')]['error'](_0x414b12,_0x4783('0x10d'));}if(_[_0x4783('0x15c')](_0x458c29)){var _0x4945ff=this;_0x458c29[_0x4783('0xce')](function(_0xd51231,_0xccb582){_0x4945ff['channel'][_0x4783('0x95')](util[_0x4783('0x27')](_0x4783('0x15d'),_0x31e2a8,_0xccb582),_0xd51231);});return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x15e'),_0x31e2a8));}else{return this[_0x4783('0x34')][_0x4783('0x95')](_0x31e2a8,_0x458c29);}};AGIVertices[_0x4783('0x10')]['menu']=function(_0x6a215d){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x6a215d['label']));if(_0x6a215d[_0x4783('0x97')]===0x0){return this[_0x4783('0x15f')](_0x6a215d);}_0x6a215d[_0x4783('0x97')]-=0x1;if(!this['isConfigured'](_0x6a215d['file_id'])){return this['channel'][_0x4783('0x29')](_0x6a215d,_0x4783('0x108'));}var _0x19b09c=this[_0x4783('0x1f')][_0x4783('0x64')](this,_0x6a215d[_0x4783('0x107')]);if(!_0x19b09c){return this[_0x4783('0x34')]['error'](_0x6a215d,'no\x20file\x20audio\x20found');}var _0xe8adf3=this[_0x4783('0x34')]['getData'](_0x19b09c,_0x6a215d[_0x4783('0x10a')],_0x6a215d[_0x4783('0x160')]);var _0x566747=_0xe8adf3[_0x4783('0x9e')];if(_0xe8adf3[_0x4783('0x9e')]===-0x1){this['createSquareDetailsReport'][_0x4783('0x64')](this,_0x6a215d,'-1');return _0xe8adf3;}else if(_0xe8adf3['extra']===_0x4783('0x5c')){_0xe8adf3[_0x4783('0x9e')]=_0xe8adf3[_0x4783('0x9e')][_0x4783('0x8f')]>0x0?_0xe8adf3[_0x4783('0x9e')]:'t';}else if(_[_0x4783('0x3e')](_0xe8adf3[_0x4783('0x9e')])){_0xe8adf3['result']='#';_0x566747='#';}if(!this[_0x4783('0x7b')](_0x6a215d[_0x4783('0xcd')])){this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0xcc'));}else{var _0x5c86df=this['getVariable'][_0x4783('0x64')](this,_0x6a215d['variable_id']);if(!_0x5c86df){return this['channel'][_0x4783('0x29')](_0x6a215d,'no\x20variable\x20found');}this[_0x4783('0x34')][_0x4783('0x95')](_0x5c86df,_0x566747);}this[_0x4783('0x96')][_0x4783('0x64')](this,_0x6a215d,_0x566747);return _0xe8adf3;};AGIVertices[_0x4783('0x10')]['noop']=function(_0x53a6ec){logger['info'](util['format'](_0x4783('0x161'),_0x53a6ec['label']));return this['channel'][_0x4783('0x9a')](_0x53a6ec[_0x4783('0x162')]||_0x53a6ec[_0x4783('0x99')]);};AGIVertices['prototype'][_0x4783('0x163')]=function(_0x578841){logger['info'](util[_0x4783('0x27')](_0x4783('0x164'),_0x578841[_0x4783('0x99')]));if(!this['isConfigured'](_0x578841['findBy'])){return this[_0x4783('0x34')]['error'](_0x578841,_0x4783('0x14e'));}logger['info'](util[_0x4783('0x27')](_0x4783('0x14f'),this[_0x4783('0x34')][_0x4783('0x38')],_0x578841[_0x4783('0x150')]));var _0x1d5fb3=this['getPause'][_0x4783('0x64')](this,_0x578841['pause_id']);var _0x5edcc0=this['agentPause'][_0x4783('0x64')](this,_0x578841[_0x4783('0x150')],_0x1d5fb3);if(_0x5edcc0){logger[_0x4783('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x4783('0x38')],_0x578841[_0x4783('0x150')]));this['channel'][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x151'),this[_0x4783('0x34')][_0x4783('0x38')],_0x578841[_0x4783('0x150')]));return{'code':0xc8,'result':_0x4783('0x156')};}else{logger[_0x4783('0x2c')](util[_0x4783('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4783('0x38')],_0x578841['findBy']));this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x151'),this[_0x4783('0x34')][_0x4783('0x38')],_0x578841[_0x4783('0x150')]));return{'code':0xc8,'result':_0x4783('0x153')};}};AGIVertices[_0x4783('0x10')]['playback']=function(_0x7a46a9){logger['info'](util[_0x4783('0x27')](_0x4783('0x165'),_0x7a46a9[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x7a46a9[_0x4783('0x107')])){return this['channel'][_0x4783('0x29')](_0x7a46a9,_0x4783('0x108'));}var _0x25f06f=this[_0x4783('0x1f')][_0x4783('0x64')](this,_0x7a46a9[_0x4783('0x107')]);if(!_0x25f06f){return this[_0x4783('0x34')][_0x4783('0x29')](_0x7a46a9,_0x4783('0x166'));}var _0x53fe3=this[_0x4783('0x34')]['exec']('PLAYBACK',[_0x25f06f,_0x7a46a9['opts']]);if(_0x53fe3['result']===-0x1){return _0x53fe3;}return this['channel'][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xb5'),_0x4783('0x167'),_0x25f06f));};AGIVertices[_0x4783('0x10')][_0x4783('0x168')]=function(_0x1ae7ca){logger[_0x4783('0x2c')](util['format'](_0x4783('0x169'),_0x1ae7ca['label']));if(!this[_0x4783('0x7b')](_0x1ae7ca[_0x4783('0x16a')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x1ae7ca,_0x4783('0x16b'));}var _0x760bdd='';var _0x1a0b2d=parseInt(_0x1ae7ca[_0x4783('0x16a')],0xa);if(isNaN(_0x1a0b2d)){_0x760bdd=_0x1ae7ca[_0x4783('0x16a')];}else{_0x760bdd=this[_0x4783('0x13')]['sync'](this,_0x1ae7ca[_0x4783('0x16a')]);if(!_0x760bdd){return this[_0x4783('0x34')]['error'](_0x1ae7ca,_0x4783('0x16c'));}}var _0x5c402b='';if(this[_0x4783('0x7b')](_0x1ae7ca['file_id'])){var _0x50e3d5=this[_0x4783('0x1f')][_0x4783('0x64')](this,_0x1ae7ca[_0x4783('0x107')]);if(_0x50e3d5){_0x5c402b=_0x50e3d5;}}this[_0x4783('0x96')][_0x4783('0x64')](this,_0x1ae7ca,_0x760bdd);if(_0x1ae7ca[_0x4783('0xd9')][_0x4783('0x16d')]('x')<0x0){_0x1ae7ca[_0x4783('0xd9')]+='x';}if(_0x1ae7ca[_0x4783('0xd9')][_0x4783('0x16d')]('X')<0x0){_0x1ae7ca['opts']+='X';}this['channel'][_0x4783('0x95')](_0x4783('0x16e'),_0x760bdd?_0x760bdd['toLowerCase']():'');var _0x47d40e=this['channel'][_0x4783('0x9c')](_0x4783('0x16f'),[_0x760bdd,_0x1ae7ca[_0x4783('0xd9')],_0x1ae7ca[_0x4783('0xda')],_0x5c402b,_0x1ae7ca[_0x4783('0x5c')],_0x1ae7ca[_0x4783('0x6')],_0x1ae7ca['macro'],_0x1ae7ca[_0x4783('0x170')],'',_0x1ae7ca['position']]);if(_0x47d40e['result']===-0x1){return _0x47d40e;}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xb5'),_0x4783('0x16f'),_0x760bdd));};AGIVertices[_0x4783('0x10')]['record']=function(_0x4da506){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x171'),_0x4da506['label']));var _0x3b8aa9=_0x4da506[_0x4783('0x172')]||_0x4783('0x125');var _0x591c91=util[_0x4783('0x27')]('%s_%s',this['channel'][_0x4783('0x35')],rs[_0x4783('0x10f')](0x5));var _0x1bb646=util[_0x4783('0x27')]('%s/recordings/%s.%s',FILES_PATH,_0x591c91,_0x3b8aa9);var _0x2aad4d=util['format'](_0x4783('0x12f'),FILES_PATH,_0x591c91);this['createSquareRecording'][_0x4783('0x64')](this,_0x4da506,_0x591c91,_0x1bb646);this[_0x4783('0x34')][_0x4783('0x95')]('RECORDING_SAVENAME',_0x591c91);logger[_0x4783('0x2c')](_0x4783('0x173'),_0x2aad4d,_0x3b8aa9,_0x4da506[_0x4783('0x174')],_0x4da506[_0x4783('0x5c')]);return this[_0x4783('0x34')][_0x4783('0x130')](_0x2aad4d,_0x3b8aa9,_0x4da506[_0x4783('0x174')],_0x4da506[_0x4783('0x5c')],undefined,!![]);};AGIVertices['prototype'][_0x4783('0x175')]=function(_0x41b45e){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x176'),_0x41b45e[_0x4783('0x99')]));if(!this['isConfigured'](_0x41b45e[_0x4783('0xda')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x177'));}var _0xcd3f9b=this[_0x4783('0x5a')][_0x4783('0x64')](this,_0x41b45e);logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Response:',util[_0x4783('0x178')](_0xcd3f9b,{'showHidden':![],'depth':null})));if(!this[_0x4783('0x7b')](_0x41b45e['variable_id'])){return this[_0x4783('0x34')]['noop'](_0x4783('0x179'));}var _0x52e18b=this[_0x4783('0x11')][_0x4783('0x64')](this,_0x41b45e[_0x4783('0xcd')]);if(!_0x52e18b){return this[_0x4783('0x34')][_0x4783('0x29')](_0x41b45e,'no\x20variable\x20found');}this[_0x4783('0x34')][_0x4783('0x95')](util[_0x4783('0x27')](_0x4783('0x17a'),_0x52e18b),_0xcd3f9b[_0x4783('0x6b')]?_0xcd3f9b['statusCode']:_0x4783('0x17b'));this[_0x4783('0x34')][_0x4783('0x95')](util[_0x4783('0x27')](_0x4783('0x17c'),_0x52e18b),_0xcd3f9b[_0x4783('0x6c')]?_0xcd3f9b[_0x4783('0x6c')]:'OK');if(_0xcd3f9b['body']){try{this[_0x4783('0x8d')](_0xcd3f9b['body'],_0x52e18b);}catch(_0x16a044){logger['error'](util[_0x4783('0x27')](_0x4783('0x17d'),_0x52e18b));}}return this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0xd1'),_0x52e18b));};AGIVertices[_0x4783('0x10')][_0x4783('0x17e')]=function(_0x14f578){logger['info'](util[_0x4783('0x27')](_0x4783('0x17f'),_0x14f578[_0x4783('0x99')]));return this['channel'][_0x4783('0x180')](_0x14f578[_0x4783('0x181')][_0x4783('0x182')](/\s+/g,''),_0x14f578[_0x4783('0x174')]);};AGIVertices['prototype']['saynumber']=function(_0x45a16a){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x45a16a[_0x4783('0x99')]));return this['channel'][_0x4783('0x183')](_0x45a16a['number'][_0x4783('0x182')](/\s+/g,''),_0x45a16a[_0x4783('0x174')]);};AGIVertices[_0x4783('0x10')][_0x4783('0x184')]=function(_0x5896c2){logger['info'](util['format'](_0x4783('0x185'),_0x5896c2[_0x4783('0x99')]));return this[_0x4783('0x34')][_0x4783('0x186')](_0x5896c2['text'],_0x5896c2[_0x4783('0x174')]);};AGIVertices[_0x4783('0x10')]['sendMail']=function(_0x20b1c6){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x187'),_0x20b1c6[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x20b1c6[_0x4783('0x188')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x189'));}var _0x357813=this[_0x4783('0x21')][_0x4783('0x64')](this,_0x20b1c6[_0x4783('0x188')]);if(!_0x357813||!_0x357813[_0x4783('0x18a')]){return this[_0x4783('0x34')]['error'](_0x20b1c6,_0x4783('0x18b'));}var _0x59de0e={'from':util[_0x4783('0x27')](_0x4783('0x18c'),_0x357813[_0x4783('0x12')],_0x357813[_0x4783('0x18d')]||_0x357813[_0x4783('0x18a')][_0x4783('0x18e')]),'to':_0x20b1c6['to']||'','cc':_0x20b1c6['cc']||'','bcc':_0x20b1c6[_0x4783('0x18f')]||'','subject':_0x20b1c6[_0x4783('0x190')],'html':_0x20b1c6['text'],'text':_0x20b1c6[_0x4783('0x52')]};if(this[_0x4783('0x7b')](_0x20b1c6['template_id'])){}logger[_0x4783('0xd3')](_0x4783('0x191'),JSON[_0x4783('0x67')](_0x59de0e));this[_0x4783('0x96')][_0x4783('0x64')](this,_0x20b1c6,_0x20b1c6[_0x4783('0x188')]);this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0x192'),_0x357813[_0x4783('0x12')]));this[_0x4783('0x22')][_0x4783('0x64')](this,_0x357813[_0x4783('0x193')],_0x59de0e);return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x194'));};AGIVertices[_0x4783('0x10')][_0x4783('0x195')]=function(_0x17712e){logger[_0x4783('0x2c')](util['format'](_0x4783('0x196'),_0x17712e['label']));return this[_0x4783('0x34')]['noop'](_0x4783('0x197'));};AGIVertices[_0x4783('0x10')][_0x4783('0x198')]=function(_0x179a9f){logger[_0x4783('0x2c')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x179a9f[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x179a9f[_0x4783('0x199')])){return this['channel'][_0x4783('0x9a')](_0x4783('0x19a'));}var _0x4b83ad=this[_0x4783('0x31')]['sync'](this,_0x179a9f['sms_account_id']);if(!_0x4b83ad){return this[_0x4783('0x34')][_0x4783('0x29')](_0x179a9f,'no\x20sms\x20account\x20found');}var _0xf8715e={'body':_0x179a9f['sms_text'],'phone':_0x179a9f['to']||'','SmsAccountId':_0x4b83ad['id']};logger[_0x4783('0xd3')](_0x4783('0x19b'),JSON[_0x4783('0x67')](_0xf8715e));this[_0x4783('0x96')]['sync'](this,_0x179a9f,_0x179a9f[_0x4783('0x199')]);this[_0x4783('0x34')]['noop'](util['format'](_0x4783('0x19c'),_0x4b83ad[_0x4783('0x12')]));this[_0x4783('0x33')][_0x4783('0x64')](this,_0xf8715e);return this['channel'][_0x4783('0x9a')](_0x4783('0x19d'));};AGIVertices[_0x4783('0x10')]['set']=function(_0x224ba7){logger[_0x4783('0x2c')](util['format'](_0x4783('0x19e'),_0x224ba7[_0x4783('0x99')]));if(!this['isConfigured'](_0x224ba7[_0x4783('0xcd')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x224ba7,_0x4783('0x19f'));}var _0x1c52be=this['getVariable'][_0x4783('0x64')](this,_0x224ba7[_0x4783('0xcd')]);if(!_0x1c52be){return this[_0x4783('0x34')][_0x4783('0x29')](_0x224ba7,'no\x20variable\x20found');}return this['channel'][_0x4783('0x95')](_0x1c52be,_0x224ba7['variable_value']);};AGIVertices['prototype'][_0x4783('0x1a0')]=function(_0x55d5ad){logger[_0x4783('0x2c')](util['format'](_0x4783('0x1a1'),_0x55d5ad[_0x4783('0x99')]));this[_0x4783('0x34')]['noop'](_0x4783('0x1a2'));if(_0x55d5ad[_0x4783('0xa9')]===_0x4783('0x1a3')){this['channel'][_0x4783('0x9a')](_0x4783('0x1a4'));return this['channel']['answer']();}return this['channel'][_0x4783('0x9a')](_0x4783('0x1a5'));};AGIVertices[_0x4783('0x10')][_0x4783('0x1a6')]=function(_0x53214b){logger['info'](util[_0x4783('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x53214b[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x53214b[_0x4783('0x1a7')])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x53214b,_0x4783('0x1a8'));}var _0x4f1be2=this[_0x4783('0x16')]['sync'](this,_0x53214b[_0x4783('0x1a7')]);if(!this[_0x4783('0x7b')](_0x4f1be2)){return this[_0x4783('0x34')]['error'](_0x53214b,util[_0x4783('0x27')](_0x4783('0x1a9'),_0x53214b[_0x4783('0x1a7')]));}if(_0x4f1be2===this[_0x4783('0x34')]['arg_1']){return this['channel'][_0x4783('0x29')](_0x53214b,_0x4783('0x1aa'));}this[_0x4783('0x96')][_0x4783('0x64')](this,_0x53214b,_0x4f1be2);var _0x5a6eb1=this[_0x4783('0x34')][_0x4783('0x9c')](_0x4783('0x1ab'),util[_0x4783('0x27')](_0x4783('0x1ac'),config[_0x4783('0x6')][_0x4783('0x1ad')]||'127.0.0.1',_0x4f1be2,this[_0x4783('0x34')]['arg_1']));if(_0x5a6eb1[_0x4783('0x9e')]===-0x1){return _0x5a6eb1;}return this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0xb5'),_0x4783('0x1ab'),_0x4f1be2));};AGIVertices['prototype'][_0x4783('0x1ae')]=function(_0x27e77b){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x1af'),_0x27e77b[_0x4783('0x99')]));var _0x5cb8fe=this[_0x4783('0x4f')][_0x4783('0x64')](this,_0x27e77b['command']);this[_0x4783('0x96')][_0x4783('0x64')](this,_0x27e77b,_0x27e77b[_0x4783('0xa8')]);if(this[_0x4783('0x7b')](_0x27e77b[_0x4783('0xcd')])){var _0x4efa85=this['getVariable'][_0x4783('0x64')](this,_0x27e77b[_0x4783('0xcd')]);if(_0x4efa85){this[_0x4783('0x34')][_0x4783('0x95')](_0x4efa85,_0x5cb8fe);return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x27e77b[_0x4783('0xa8')],_0x4efa85));}}return this['channel']['noop'](util[_0x4783('0x27')](_0x4783('0x1b0'),_0x27e77b[_0x4783('0xa8')]));};AGIVertices[_0x4783('0x10')][_0x4783('0x1b1')]=function(_0x5de46a){logger[_0x4783('0x2c')](util[_0x4783('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5de46a[_0x4783('0x99')]));_0x5de46a['text']=_0x5de46a[_0x4783('0x52')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4783('0x7b')](_0x5de46a[_0x4783('0x51')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x1b2'));}if(!this[_0x4783('0x7b')](_0x5de46a[_0x4783('0x52')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x9b'));}this['channel'][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x1b3'),_0x5de46a['text']));var _0x50374c=this[_0x4783('0x50')]['sync'](this,_0x5de46a);if(_0x50374c){this[_0x4783('0x34')][_0x4783('0x9a')](util['format'](_0x4783('0x1b4'),_0x50374c));var _0x3b8ce1=this[_0x4783('0x34')]['streamFile'](_0x50374c);try{fs[_0x4783('0xfc')](_0x50374c+_0x4783('0x11b'));}catch(_0x36aff0){logger[_0x4783('0x29')](_0x36aff0);}return _0x3b8ce1;}return this[_0x4783('0x34')][_0x4783('0x29')](_0x5de46a,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4783('0x10')][_0x4783('0x1b5')]=function(_0x5a5268){logger['info'](util[_0x4783('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5a5268[_0x4783('0x99')]));_0x5a5268[_0x4783('0x52')]=_0x5a5268[_0x4783('0x52')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5a5268[_0x4783('0x52')])){return this[_0x4783('0x34')][_0x4783('0x9a')](_0x4783('0x9b'));}this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')]('Trying\x20Google\x20TTS\x20%s',_0x5a5268[_0x4783('0x52')]));var _0x5e9e6b=this[_0x4783('0x58')]['sync'](this,_0x5a5268);if(_0x5e9e6b){this['channel']['noop'](util[_0x4783('0x27')](_0x4783('0x1b6'),_0x5e9e6b));var _0x43f846=this[_0x4783('0x34')]['streamFile'](_0x5e9e6b);try{fs[_0x4783('0xfc')](_0x5e9e6b+'.wav');}catch(_0x10831a){logger['error'](_0x10831a);}return _0x43f846;}return this[_0x4783('0x34')][_0x4783('0x29')](_0x5a5268,_0x4783('0x1b7'));};AGIVertices[_0x4783('0x10')][_0x4783('0x1b8')]=function(_0x2270c1){logger['info'](util[_0x4783('0x27')](_0x4783('0x1b9'),_0x2270c1[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x2270c1[_0x4783('0x150')])){return this['channel']['error'](_0x2270c1,'no\x20find\x20by\x20configured');}logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x14f'),this[_0x4783('0x34')][_0x4783('0x38')],_0x2270c1[_0x4783('0x150')]));var _0x5d3d11=this[_0x4783('0x4b')][_0x4783('0x64')](this,_0x2270c1[_0x4783('0x150')]);if(_0x5d3d11){logger[_0x4783('0x2c')](util['format'](_0x4783('0x151'),this[_0x4783('0x34')][_0x4783('0x38')],_0x2270c1[_0x4783('0x150')]));this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0x151'),this['channel'][_0x4783('0x38')],_0x2270c1['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x152'),this[_0x4783('0x34')][_0x4783('0x38')],_0x2270c1[_0x4783('0x150')]));this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4783('0x34')][_0x4783('0x38')],_0x2270c1[_0x4783('0x150')]));return{'code':0xc8,'result':_0x4783('0x153')};}};AGIVertices[_0x4783('0x10')]['voicemail']=function(_0x34a766){logger[_0x4783('0x2c')](util[_0x4783('0x27')](_0x4783('0x1ba'),_0x34a766[_0x4783('0x99')]));var _0x404792=this['channel'][_0x4783('0x9c')](_0x4783('0x1bb'),[_0x34a766[_0x4783('0x1bc')],_0x34a766[_0x4783('0x6e')]]);if(_0x404792[_0x4783('0x9e')]===-0x1){return _0x404792;}return this[_0x4783('0x34')][_0x4783('0x9a')](util[_0x4783('0x27')](_0x4783('0xb5'),'VOICEMAIL',_0x34a766[_0x4783('0x1bc')]));};AGIVertices[_0x4783('0x10')][_0x4783('0x1bd')]=function(_0x49d534){logger['info'](util[_0x4783('0x27')](_0x4783('0x1be'),_0x49d534[_0x4783('0x99')]));if(!this[_0x4783('0x7b')](_0x49d534['variable_id'])){return this[_0x4783('0x34')][_0x4783('0x29')](_0x49d534,'no\x20variable\x20selected');}var _0x380ee9=this[_0x4783('0x11')][_0x4783('0x64')](this,_0x49d534[_0x4783('0xcd')]);if(!_0x380ee9){return this[_0x4783('0x34')]['error'](_0x49d534,_0x4783('0x10d'));}var _0x27547e=this[_0x4783('0x34')][_0x4783('0x11')](_0x380ee9);return{'code':0xc8,'result':_0x27547e[_0x4783('0x93')]?_0x27547e[_0x4783('0x93')]:'-'};};String[_0x4783('0x10')]['replaceAll']=function(_0x32d1b3,_0x41ecde){return this[_0x4783('0x91')](_0x32d1b3)[_0x4783('0x1bf')](_0x41ecde);};module[_0x4783('0x1c0')]=AGIVertices; \ No newline at end of file +var _0x8ce1=['getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isArray','length','isString','isPlainObject','%s.%s','saveRestApiResult','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_INPUT()','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','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','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','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','first','substr','generate','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','false','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','escape_digits','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','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','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProjectById','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x8ce1,0x183));var _0x18ce=function(_0x149823,_0x45e796){_0x149823=_0x149823-0x0;var _0x24993c=_0x8ce1[_0x149823];return _0x24993c;};'use strict';var fs=require('fs');var util=require(_0x18ce('0x0'));var _=require(_0x18ce('0x1'));var sh=require(_0x18ce('0x2'));var odbc=require(_0x18ce('0x3'))();var rs=require(_0x18ce('0x4'));var moment=require(_0x18ce('0x5'));var Mustache=require(_0x18ce('0x6'));var rp=require(_0x18ce('0x7'));var logger=require(_0x18ce('0x8'))(_0x18ce('0x9'));var config=require(_0x18ce('0xa'));var scripts=require(_0x18ce('0xb'));var FILES_PATH=_0x18ce('0xc');var recursiveMapAttributes=[_0x18ce('0xd'),_0x18ce('0xe')];var verticesWithRetry=[_0x18ce('0xf'),'getdigits',_0x18ce('0x10')];var AGIVertices=function(_0x197a64,_0x29f1ea,_0x1daeac){this['channel']=_0x197a64;this[_0x18ce('0x11')]=_0x29f1ea;this[_0x18ce('0x12')]=_0x1daeac;};AGIVertices[_0x18ce('0x13')][_0x18ce('0x14')]=function(_0x53959e,_0x4a4dd6){this[_0x18ce('0x11')][_0x18ce('0x15')](_0x53959e)[_0x18ce('0x16')](function(_0x28a191){_0x4a4dd6(null,_0x28a191?_0x28a191[_0x18ce('0x17')]:![]);})['catch'](function(_0xbd514b){_0x4a4dd6(_0xbd514b);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x18')]=function(_0x2b4caa,_0x2158aa){this['rpc'][_0x18ce('0x19')](_0x2b4caa)[_0x18ce('0x16')](function(_0x3ac890){_0x2158aa(null,_0x3ac890?_0x3ac890[_0x18ce('0x17')]:![]);})[_0x18ce('0x1a')](function(_0x36b5da){_0x2158aa(_0x36b5da);});};AGIVertices[_0x18ce('0x13')]['getSquareProject']=function(_0x959ce,_0x1357ef){this[_0x18ce('0x11')][_0x18ce('0x1b')](_0x959ce)[_0x18ce('0x16')](function(_0x287880){_0x1357ef(null,_0x287880?_0x287880['name']:![]);})[_0x18ce('0x1a')](function(_0x29c691){_0x1357ef(_0x29c691);});};AGIVertices[_0x18ce('0x13')]['getSquareOdbc']=function(_0x35e446,_0x2fa3d4){this[_0x18ce('0x11')]['getSquareOdbcById'](_0x35e446)[_0x18ce('0x16')](function(_0x19084e){_0x2fa3d4(null,_0x19084e?_0x19084e['dsn']:![]);})[_0x18ce('0x1a')](function(_0x1099c9){_0x2fa3d4(_0x1099c9);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1c')]=function(_0x31b789,_0xd41f29){this[_0x18ce('0x11')][_0x18ce('0x1d')](_0x31b789)[_0x18ce('0x16')](function(_0x5cde25){_0xd41f29(null,_0x5cde25?_0x5cde25['name']:![]);})['catch'](function(_0x32e910){_0xd41f29(_0x32e910);});};AGIVertices['prototype'][_0x18ce('0x1e')]=function(_0x1b7e0b,_0x3fe231){this['rpc']['getTrunkById'](_0x1b7e0b)['then'](function(_0x317812){_0x3fe231(null,_0x317812?_0x317812[_0x18ce('0x17')]:![]);})[_0x18ce('0x1a')](function(_0x461113){_0x3fe231(_0x461113);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1f')]=function(_0x5583c6,_0x5279f8){var _0x573e41=this;this[_0x18ce('0x11')][_0x18ce('0x20')](_0x5583c6)[_0x18ce('0x16')](function(_0x5f3ec2){_0x5279f8(null,_0x5f3ec2?_0x573e41[_0x18ce('0x21')](_0x5f3ec2[_0x18ce('0x22')]):![]);})[_0x18ce('0x1a')](function(_0x5ef96c){_0x5279f8(_0x5ef96c);});};AGIVertices['prototype']['getMailAccount']=function(_0x3e6d7c,_0x372010){this['rpc']['getMailAccountById'](_0x3e6d7c)[_0x18ce('0x16')](function(_0x3693e5){_0x372010(null,_0x3693e5?_0x3693e5:![]);})[_0x18ce('0x1a')](function(_0x57e11e){_0x372010(_0x57e11e);});};AGIVertices['prototype'][_0x18ce('0x23')]=function(_0x1be9d9,_0x14b2a8,_0xe81dd){this[_0x18ce('0x12')][_0x18ce('0x23')](_0x1be9d9,_0x14b2a8)[_0x18ce('0x16')](function(){_0xe81dd(null);})[_0x18ce('0x1a')](function(_0x4dfe2f){_0xe81dd(_0x4dfe2f);});};AGIVertices['prototype'][_0x18ce('0x24')]=function(_0x3e05d4,_0x4ae29d){this[_0x18ce('0x11')]['getIntervalById'](_0x3e05d4)[_0x18ce('0x16')](function(_0x4e340b){if(_0x4e340b){if(_0x4e340b[_0x18ce('0x25')]){_0x4ae29d(null,[_0x4e340b[_0x18ce('0x26')]]);}else{_0x4ae29d(null,_[_0x18ce('0x27')](_0x4e340b['Intervals'],'interval'));}}else{_0x4ae29d(null,![]);}})[_0x18ce('0x1a')](function(_0x34dfab){_0x4ae29d(_0x34dfab);});};AGIVertices['prototype']['getSoundPath']=function(_0x22b0dc){return util[_0x18ce('0x28')](_0x18ce('0x29'),FILES_PATH,_0x22b0dc);};AGIVertices[_0x18ce('0x13')][_0x18ce('0x2a')]=function(_0x461ef0,_0x3ca677,_0x34cec3){odbc[_0x18ce('0x2b')](_0x461ef0,function(_0x230a54){if(_0x230a54){logger[_0x18ce('0x2c')](_0x18ce('0x2d'),_0x230a54);_0x34cec3(_0x230a54);}else{logger[_0x18ce('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x18ce('0x2f')](_0x3ca677,function(_0x277009,_0x2d5d4e){if(_0x277009){logger[_0x18ce('0x2e')](_0x18ce('0x30'),_0x3ca677);_0x34cec3(_0x277009);}else{logger[_0x18ce('0x2e')](_0x18ce('0x31'),_0x3ca677);odbc[_0x18ce('0x32')](function(_0xe3f7c9){if(_0xe3f7c9){logger[_0x18ce('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xe3f7c9);}_0x34cec3(null,_0x2d5d4e);});}});}});};AGIVertices['prototype'][_0x18ce('0x33')]=function(_0x23486c,_0x3a4c71){this[_0x18ce('0x11')][_0x18ce('0x34')](_0x23486c)[_0x18ce('0x16')](function(_0x2eba88){_0x3a4c71(null,_0x2eba88?_0x2eba88:![]);})['catch'](function(_0x584985){_0x3a4c71(_0x584985);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x35')]=function(_0x52fc03,_0x34a3d9){this[_0x18ce('0x11')][_0x18ce('0x35')](_0x52fc03)[_0x18ce('0x16')](function(_0xcd9536){_0x34a3d9(null,_0xcd9536);})[_0x18ce('0x1a')](function(_0x230311){_0x34a3d9(_0x230311);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x36')]=function(_0x1d6d5f,_0x3885e6,_0x20d107){this['rpc'][_0x18ce('0x36')]({'uniqueid':this[_0x18ce('0x37')][_0x18ce('0x38')],'node':_0x1d6d5f[_0x18ce('0x39')],'application':_0x1d6d5f[_0x18ce('0x3a')],'data':_0x3885e6||null,'project_name':this[_0x18ce('0x37')][_0x18ce('0x3b')],'callerid':this['channel']['callerid']})[_0x18ce('0x16')](function(_0x41002b){if(_0x20d107){_0x20d107(null,_0x41002b);}})[_0x18ce('0x1a')](function(_0x27aaa1){if(_0x20d107){_0x20d107(_0x27aaa1);}});};AGIVertices['prototype'][_0x18ce('0x3c')]=function(_0x29fcd5,_0x2a26eb,_0x55f673,_0x529f82){this[_0x18ce('0x11')][_0x18ce('0x3c')]({'uniqueid':this['channel'][_0x18ce('0x38')],'callerid':this[_0x18ce('0x37')][_0x18ce('0x3d')],'calleridname':this[_0x18ce('0x37')][_0x18ce('0x3e')],'context':this[_0x18ce('0x37')][_0x18ce('0x3f')],'extension':this['channel'][_0x18ce('0x40')],'priority':this[_0x18ce('0x37')][_0x18ce('0x41')],'accountcode':this[_0x18ce('0x37')][_0x18ce('0x42')],'dnid':this[_0x18ce('0x37')][_0x18ce('0x43')],'projectName':this[_0x18ce('0x37')][_0x18ce('0x3b')],'saveName':_0x2a26eb,'filename':_0x29fcd5[_0x18ce('0x44')]||_0x2a26eb,'savePath':_0x55f673})[_0x18ce('0x16')](function(_0x3f9960){_0x529f82(null,_0x3f9960);})[_0x18ce('0x1a')](function(_0x2ba2c1){_0x529f82(_0x2ba2c1);});};AGIVertices['prototype'][_0x18ce('0x45')]=function(_0x13e57b,_0x530314,_0x8f182,_0x59e301,_0x133628){this['rpc'][_0x18ce('0x45')]({'uniqueid':this[_0x18ce('0x37')][_0x18ce('0x38')],'body':_0x13e57b,'direction':_0x530314,'providerName':_0x8f182,'providerResponse':_0x59e301})[_0x18ce('0x16')](function(_0x4f8c0e){if(_0x133628){_0x133628(null,_0x4f8c0e);}})[_0x18ce('0x1a')](function(_0x501328){if(_0x133628){_0x133628(_0x501328);}});};AGIVertices['prototype'][_0x18ce('0x46')]=function(_0x216a90,_0x8aa4a7){this['rpc']['createCmContact']({'firstName':_[_0x18ce('0x47')](_0x216a90[_0x18ce('0x17')])||_[_0x18ce('0x48')](_0x216a90[_0x18ce('0x17')])?'callback_'+Math['random']():_0x216a90[_0x18ce('0x17')],'lastName':_['isEmpty'](_0x216a90[_0x18ce('0x49')])||_[_0x18ce('0x48')](_0x216a90[_0x18ce('0x49')])?null:_0x216a90['lastName'],'phone':_0x216a90[_0x18ce('0x4a')],'ListId':_0x216a90[_0x18ce('0x4b')],'scheduledat':_0x216a90[_0x18ce('0x4c')],'callbackUniqueid':this['channel'][_0x18ce('0x38')],'tags':_0x18ce('0x4d'),'description':_0x18ce('0x4e')+_0x216a90['scheduledAt'][_0x18ce('0x4f')](),'priority':_0x216a90[_0x18ce('0x50')]})[_0x18ce('0x16')](function(_0x9fce1a){_0x8aa4a7(null,_0x9fce1a);})['catch'](function(_0x4bf79f){_0x8aa4a7(_0x4bf79f);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x51')]=function(_0xee0598,_0x1820b3){this[_0x18ce('0x11')][_0x18ce('0x52')](_0xee0598)[_0x18ce('0x16')](function(_0x4f3ba4){_0x1820b3(null,_0x4f3ba4?_0x4f3ba4[_0x18ce('0x17')]:![]);})[_0x18ce('0x1a')](function(_0x56d0bb){_0x1820b3(_0x56d0bb);});};AGIVertices[_0x18ce('0x13')]['agentPause']=function(_0x4e4f19,_0x21be53,_0xb7eec9){var _0x106c7f={'role':_0x18ce('0x53')};_0x106c7f[_0x4e4f19]=this[_0x18ce('0x37')][_0x18ce('0x3d')];this['rpc'][_0x18ce('0x54')](_0x106c7f,_0x21be53,this[_0x18ce('0x37')][_0x18ce('0x38')])['then'](function(_0xeb4215){_0xb7eec9(null,_['isNil'](_0xeb4215)?![]:!![]);})[_0x18ce('0x1a')](function(_0x2f98cc){logger['error'](_0x2f98cc);_0xb7eec9(null,![]);});};AGIVertices['prototype'][_0x18ce('0x55')]=function(_0x28beeb,_0x5ad549){var _0x1d8734={'role':_0x18ce('0x53')};_0x1d8734[_0x28beeb]=this[_0x18ce('0x37')][_0x18ce('0x3d')];this[_0x18ce('0x11')]['agentUnpause'](_0x1d8734)[_0x18ce('0x16')](function(_0x458190){_0x5ad549(null,_['isNil'](_0x458190)?![]:!![]);})['catch'](function(_0x43f9f0){logger[_0x18ce('0x2c')](_0x43f9f0);_0x5ad549(null,![]);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x56')]=function(_0x2ff5c7,_0x1cd267){var _0x5a7875={'role':'agent'};_0x5a7875[_0x2ff5c7]=this[_0x18ce('0x37')][_0x18ce('0x3d')];this[_0x18ce('0x11')]['agentLogout'](_0x5a7875)[_0x18ce('0x16')](function(_0x1f78e7){_0x1cd267(null,_['isNil'](_0x1f78e7)?![]:!![]);})[_0x18ce('0x1a')](function(_0xd104a4){logger['error'](_0xd104a4);_0x1cd267(null,![]);});};AGIVertices[_0x18ce('0x13')]['agentLogin']=function(_0x5b0fa5,_0x2d1248){var _0xde2b83={'role':_0x18ce('0x53')};_0xde2b83[_0x5b0fa5]=this[_0x18ce('0x37')][_0x18ce('0x3d')];var _0x4e4836=_0x5b0fa5!=_0x18ce('0x57')?util['format'](_0x18ce('0x58'),'LOCAL',this['channel'][_0x18ce('0x3d')]):undefined;this['rpc'][_0x18ce('0x59')](_0xde2b83,_0x4e4836)[_0x18ce('0x16')](function(_0x583afc){_0x2d1248(null,_[_0x18ce('0x48')](_0x583afc)?![]:!![]);})[_0x18ce('0x1a')](function(_0x2a5221){logger[_0x18ce('0x2c')](_0x2a5221);_0x2d1248(null,![]);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x5a')]=function(_0xdff27,_0x28017e){sh[_0x18ce('0x5b')](_[_0x18ce('0x5c')](_0xdff27),function(_0x58d4d6,_0x454ec9){var _0x1eedc8=_0x454ec9[_0x18ce('0x5d')](/(\r\n|\n|\r)/gm,'');_0x28017e(null,_0x1eedc8);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x5e')]=function(_0x161dbd,_0x4396f7){scripts['googleCloudTTS'](_0x161dbd['apiKey'],_0x161dbd[_0x18ce('0x5f')]||_0x18ce('0x60'),_0x161dbd[_0x18ce('0x60')],_0x161dbd[_0x18ce('0x61')]||'en-US',_0x161dbd[_0x18ce('0x62')]||_0x18ce('0x63'),_0x161dbd[_0x18ce('0x64')]||_0x18ce('0x65'))[_0x18ce('0x16')](function(_0x3d0ce5){_0x4396f7(null,_0x3d0ce5);})[_0x18ce('0x1a')](function(_0x46c76a){_0x4396f7(_0x46c76a);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x66')]=function(_0x182dd1,_0x1b97ea){scripts[_0x18ce('0x66')](_0x182dd1['text'],_0x182dd1['google_tts_language']||'en',0x1)[_0x18ce('0x16')](function(_0x256212){_0x1b97ea(null,_0x256212);})['catch'](function(_0x1e966e){_0x1b97ea(_0x1e966e);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x67')]=function(_0x227dde,_0x29b8da){var _0x566d36={'uri':_0x227dde[_0x18ce('0x68')],'method':_0x227dde[_0x18ce('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x227dde['timeout'])==='number'&&parseInt(_0x227dde[_0x18ce('0x6a')])>=0x1?parseInt(_0x227dde[_0x18ce('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x18ce('0x6b')]([_0x18ce('0x6c'),_0x18ce('0x6d')],_0x566d36[_0x18ce('0x69')][_0x18ce('0x6e')]())){try{_0x566d36[_0x18ce('0x6f')]=_0x227dde['rawBody']?JSON[_0x18ce('0x70')](_0x227dde[_0x18ce('0xe')]):{};}catch(_0x4aa31f){logger[_0x18ce('0x2c')](_0x18ce('0x71'),_0x4aa31f);}}try{_0x566d36['headers']=_0x227dde[_0x18ce('0xd')]?JSON[_0x18ce('0x70')](_0x227dde[_0x18ce('0xd')]):{};}catch(_0x55e3ad){logger[_0x18ce('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x55e3ad);}if(_0x227dde[_0x18ce('0x72')]){try{var _0x5badb3=require(_0x227dde[_0x18ce('0x72')])[_0x18ce('0x73')](this,_0x566d36);_0x566d36[_0x18ce('0x74')]=Mustache[_0x18ce('0x75')](_0x227dde[_0x18ce('0x68')],_0x5badb3,{},['$$','$$']);if(_0x566d36[_0x18ce('0x76')]){_0x566d36[_0x18ce('0x76')]=JSON[_0x18ce('0x70')](Mustache[_0x18ce('0x75')](JSON[_0x18ce('0x77')](_0x566d36[_0x18ce('0x76')]),_0x5badb3,{},['$$','$$']));}if(_0x566d36[_0x18ce('0x6f')]){_0x566d36['body']=JSON[_0x18ce('0x70')](Mustache[_0x18ce('0x75')](JSON[_0x18ce('0x77')](_0x566d36[_0x18ce('0x6f')]),_0x5badb3,{},['$$','$$']));}}catch(_0x2eae3a){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2eae3a);}}rp(_0x566d36)[_0x18ce('0x16')](function(_0x24fd70){var _0x2ee0a5={'statusCode':_0x24fd70[_0x18ce('0x78')]||0xc8,'statusMessage':_0x24fd70[_0x18ce('0x79')]||'OK','headers':_0x24fd70[_0x18ce('0x76')]||{},'body':_0x24fd70['body']||{}};_0x29b8da(null,_0x2ee0a5);})['catch'](function(_0x2fa3e3){var _0x4ba062={'statusCode':_0x2fa3e3[_0x18ce('0x78')]||0x1f4,'statusMessage':_0x2fa3e3[_0x18ce('0x7a')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2fa3e3[_0x18ce('0x7b')][_0x18ce('0x76')]||{},'body':_0x2fa3e3[_0x18ce('0x7b')][_0x18ce('0x6f')]||{}};_0x29b8da(null,_0x4ba062);});};AGIVertices[_0x18ce('0x13')]['googleDialogflow']=function(_0x383696,_0x9c03e9){scripts[_0x18ce('0x7c')](this[_0x18ce('0x37')][_0x18ce('0x38')],_0x383696[_0x18ce('0x7d')],_0x383696[_0x18ce('0x60')],_0x383696['dialogflow_language']||'en')[_0x18ce('0x16')](function(_0x504a74){_0x9c03e9(null,_0x504a74);})['catch'](function(_0x321f58){_0x9c03e9(_0x321f58);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x7e')]=function(_0x10be5c,_0x45267f){scripts[_0x18ce('0x7e')](this[_0x18ce('0x37')][_0x18ce('0x38')],_0x10be5c[_0x18ce('0x7f')],_0x10be5c[_0x18ce('0x80')],_0x10be5c['private_key'],_0x10be5c[_0x18ce('0x60')],_0x10be5c['dialogflowV2_language']||'en')['then'](function(_0x10a54f){_0x45267f(null,_0x10a54f);})[_0x18ce('0x1a')](function(_0x5330dc){_0x45267f(_0x5330dc);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x81')]=function(_0x37bbec,_0x165273){scripts['sestekNDA'](this[_0x18ce('0x37')],_0x37bbec)[_0x18ce('0x16')](function(_0x4a8730){_0x165273(null,_0x4a8730);})[_0x18ce('0x1a')](function(_0x355829){_0x165273(_0x355829);});};AGIVertices['prototype'][_0x18ce('0x82')]=function(_0x37f7a3,_0x6bbf3e){scripts[_0x18ce('0x82')](_0x37f7a3[_0x18ce('0x7d')],_0x37f7a3['text'],_0x37f7a3[_0x18ce('0x83')]||_0x18ce('0x84'),_0x37f7a3[_0x18ce('0x85')])['then'](function(_0x20833d){_0x6bbf3e(null,_0x20833d);})[_0x18ce('0x1a')](function(_0x115100){_0x6bbf3e(_0x115100);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x86')]=function(_0x10b9fd,_0x2297ea,_0x3c1701){scripts[_0x18ce('0x86')](_0x2297ea,_0x10b9fd['key'],_0x10b9fd[_0x18ce('0x87')]||_0x18ce('0x84'),this[_0x18ce('0x88')](_0x10b9fd[_0x18ce('0x89')])?_0x10b9fd[_0x18ce('0x89')]:undefined)[_0x18ce('0x16')](function(_0x2f9cc0){_0x3c1701(null,_0x2f9cc0);})[_0x18ce('0x1a')](function(_0x717d85){_0x3c1701(_0x717d85);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x8a')]=function(_0xf68de1,_0x5b251c){scripts[_0x18ce('0x8a')](_0xf68de1[_0x18ce('0x8b')],_0xf68de1[_0x18ce('0x8c')],_0xf68de1[_0x18ce('0x8d')],_0xf68de1[_0x18ce('0x8e')]||'Amy',_0xf68de1[_0x18ce('0x60')],_0xf68de1[_0x18ce('0x8f')]||_0x18ce('0x60'))[_0x18ce('0x16')](function(_0xea5021){_0x5b251c(null,_0xea5021);})[_0x18ce('0x1a')](function(_0x3873d2){_0x5b251c(_0x3873d2);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x90')]=function(_0x12f9a8,_0xbc0e3a){scripts[_0x18ce('0x90')](this[_0x18ce('0x37')][_0x18ce('0x38')],_0x12f9a8[_0x18ce('0x8b')],_0x12f9a8[_0x18ce('0x8c')],_0x12f9a8[_0x18ce('0x91')],_0x12f9a8[_0x18ce('0x60')],_0x12f9a8['aws_bot_name'])[_0x18ce('0x16')](function(_0x33ffce){_0xbc0e3a(null,_0x33ffce);})[_0x18ce('0x1a')](function(_0x3cebbe){_0xbc0e3a(_0x3cebbe);});};AGIVertices['prototype'][_0x18ce('0x92')]=function(_0x17a1e9,_0x3bcbd1,_0x3dab12){scripts[_0x18ce('0x92')](_0x3bcbd1,_0x17a1e9[_0x18ce('0x7d')],_0x17a1e9[_0x18ce('0x93')]||_0x18ce('0x84'))[_0x18ce('0x16')](function(_0x53b9b9){_0x3dab12(null,_0x53b9b9);})['catch'](function(_0x3365b0){_0x3dab12(_0x3365b0);});};AGIVertices['prototype'][_0x18ce('0x94')]=function(_0x3eb07b,_0x5e8095,_0xb09f2e){scripts[_0x18ce('0x94')](_0x5e8095,_0x3eb07b[_0x18ce('0x95')],_0x3eb07b[_0x18ce('0x96')],_0x3eb07b['uri'])[_0x18ce('0x16')](function(_0x488090){_0xb09f2e(null,_0x488090);})[_0x18ce('0x1a')](function(_0x1538fc){_0xb09f2e(_0x1538fc);});};AGIVertices[_0x18ce('0x13')][_0x18ce('0x97')]=function(_0x31c2e4){var _0x46c605=_[_0x18ce('0x6b')](verticesWithRetry,_0x31c2e4[_0x18ce('0x3a')])?_0x31c2e4:_[_0x18ce('0x98')](_0x31c2e4);for(var _0xcc049f in _0x46c605){if(_0x46c605[_0x18ce('0x99')](_0xcc049f)){if(_0x46c605[_0xcc049f]&&_['isString'](_0x46c605[_0xcc049f])){if(_['includes'](recursiveMapAttributes,_0xcc049f)){_0x46c605[_0xcc049f]=this[_0x18ce('0x9a')](_0x46c605[_0xcc049f]);}else{_0x46c605[_0xcc049f]=this['replaceAllVariables'](_0x46c605[_0xcc049f]);}}}}return _0x46c605;};AGIVertices[_0x18ce('0x13')][_0x18ce('0x9b')]=function(_0x4042db){for(var _0x502a34 in _0x4042db){if(_0x4042db[_0x18ce('0x99')](_0x502a34)){if(_['isPlainObject'](_0x4042db[_0x502a34])){this['recursiveNodeIndex'](_0x4042db[_0x502a34]);}else if(_[_0x18ce('0x9c')](_0x4042db[_0x502a34])){for(var _0x3a0571=0x0;_0x3a0571<_0x4042db[_0x502a34][_0x18ce('0x9d')];_0x3a0571++){this[_0x18ce('0x9b')](_0x4042db[_0x502a34][_0x3a0571]);}}else if(_[_0x18ce('0x9e')](_0x4042db[_0x502a34])){_0x4042db[_0x502a34]=this['replaceAllVariables'](_0x4042db[_0x502a34]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x35add2,_0x503a44){for(var _0x5ae5da in _0x35add2){if(_0x35add2[_0x18ce('0x99')](_0x5ae5da)){if(_[_0x18ce('0x9f')](_0x35add2[_0x5ae5da])){if(!_[_0x18ce('0x47')](_0x35add2[_0x5ae5da])){this['saveRestApiResult'](_0x35add2[_0x5ae5da],util[_0x18ce('0x28')](_0x18ce('0xa0'),_0x503a44,_0x5ae5da));}}else if(_['isArray'](_0x35add2[_0x5ae5da])){for(var _0x3e838d=0x0;_0x3e838d<_0x35add2[_0x5ae5da]['length'];_0x3e838d++){this[_0x18ce('0xa1')](_0x35add2[_0x5ae5da][_0x3e838d],util[_0x18ce('0x28')](_0x18ce('0xa0'),_0x503a44,_0x5ae5da+'['+_0x3e838d+']'));}}else{if(!_[_0x18ce('0x48')](_0x35add2[_0x5ae5da])){this[_0x18ce('0x37')][_0x18ce('0xa2')](util[_0x18ce('0x28')](_0x18ce('0xa0'),_0x503a44,_0x5ae5da),_0x35add2[_0x5ae5da]);}}}}};AGIVertices['prototype'][_0x18ce('0x9a')]=function(_0x2d8f32){try{var _0x7e9dde=JSON[_0x18ce('0x70')](_0x2d8f32);this[_0x18ce('0x9b')](_0x7e9dde);return JSON[_0x18ce('0x77')](_0x7e9dde);}catch(_0x8fbbaa){return this['replaceAllVariables'](_0x2d8f32);}};AGIVertices[_0x18ce('0x13')][_0x18ce('0xa3')]=function(_0x1bd05e){var _0x1e8611=_0x1bd05e['split']('{');for(var _0x25d670=0x1;_0x25d670<_0x1e8611['length'];_0x25d670+=0x1){var _0x3d7811=_0x1e8611[_0x25d670][_0x18ce('0xa4')]('}');if(_0x3d7811[_0x18ce('0x9d')]>0x1){_0x1bd05e=_0x1bd05e[_0x18ce('0xa5')]('{'+_0x3d7811[0x0]+'}',this[_0x18ce('0x37')][_0x18ce('0x14')](_0x3d7811[0x0])[_0x18ce('0xa6')]||_0x3d7811[0x0]);}}if(_0x1e8611[_0x18ce('0x9d')]===0x1){return _0x1bd05e['toString']();}return this[_0x18ce('0xa3')](_0x1bd05e);};AGIVertices[_0x18ce('0x13')][_0x18ce('0xa7')]=function(_0x22a733,_0x25c148){var _0x2e9786=this[_0x18ce('0x37')][_0x18ce('0x14')](_0x22a733);if(_0x2e9786[_0x18ce('0xa8')]===-0x1){return _0x2e9786;}logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xa9'),_0x25c148,_0x2e9786[_0x18ce('0xa6')]));return this[_0x18ce('0x37')][_0x18ce('0xa2')](_0x25c148,_0x2e9786[_0x18ce('0xa6')]);};AGIVertices[_0x18ce('0x13')][_0x18ce('0x88')]=function(_0xcc8c2a){return _0xcc8c2a&&_0xcc8c2a!=='0'&&_0xcc8c2a!=='-1'&&_0xcc8c2a!=='';};AGIVertices[_0x18ce('0x13')][_0x18ce('0xaa')]=function(_0x333ba4){this[_0x18ce('0x36')][_0x18ce('0x73')](this,_0x333ba4,'-');_0x333ba4[_0x18ce('0xab')]=_0x333ba4[_0x18ce('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x18ce('0x13')]['mrcpsynth']=function(_0x2f4a64){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xac'),_0x2f4a64[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x2f4a64['text'])){return this[_0x18ce('0x37')]['noop'](_0x18ce('0xad'));}var _0x813401='\x22'+_0x2f4a64[_0x18ce('0x60')]+'\x22';if(this[_0x18ce('0x88')](_0x2f4a64[_0x18ce('0x7b')])){_0x813401+=','+_0x2f4a64[_0x18ce('0x7b')];}var _0x5ef6ce=this[_0x18ce('0x37')][_0x18ce('0x5b')](_0x18ce('0xae'),_0x813401);if(_0x5ef6ce[_0x18ce('0xa8')]===-0x1){return _0x5ef6ce;}return this['channel'][_0x18ce('0xaf')](util['format'](_0x18ce('0xb0'),_0x813401));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xb1')]=function(_0x1a1b4a){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xb2'),_0x1a1b4a['label']));if(!this[_0x18ce('0x88')](_0x1a1b4a[_0x18ce('0xb3')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xb4'));}var _0x4cc4df=_0x1a1b4a[_0x18ce('0xb3')];if(this[_0x18ce('0x88')](_0x1a1b4a[_0x18ce('0x7b')])){_0x4cc4df+=','+_0x1a1b4a[_0x18ce('0x7b')];}var _0x2303bb=this[_0x18ce('0x37')][_0x18ce('0x5b')](_0x18ce('0xb5'),_0x4cc4df);if(_0x2303bb[_0x18ce('0xa8')]===-0x1){return _0x2303bb;}var _0x52ef5e=this[_0x18ce('0xa7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x52ef5e[_0x18ce('0xa8')]===-0x1){return _0x52ef5e;}var _0x5bcf44=this[_0x18ce('0xa7')](_0x18ce('0xb6'),'MRCP_RECOG_TRANSCRIPT');if(_0x5bcf44[_0x18ce('0xa8')]===-0x1){return _0x5bcf44;}var _0x151633=this[_0x18ce('0xa7')](_0x18ce('0xb7'),_0x18ce('0xb8'));if(_0x151633[_0x18ce('0xa8')]===-0x1){return _0x151633;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util['format'](_0x18ce('0xb9'),_0x4cc4df));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x9')]=function(_0x699e7b){logger['info'](util[_0x18ce('0x28')](_0x18ce('0xba'),_0x699e7b[_0x18ce('0x39')]));return this[_0x18ce('0x37')][_0x18ce('0x9')]([_0x699e7b[_0x18ce('0xbb')],_0x699e7b[_0x18ce('0xbc')]]);};AGIVertices['prototype'][_0x18ce('0xbd')]=function(_0x1ecf8b){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xbe'),_0x1ecf8b[_0x18ce('0x39')]));if(this[_0x18ce('0x88')](_0x1ecf8b[_0x18ce('0x6a')])){logger['info'](util[_0x18ce('0x28')](_0x18ce('0xbf'),_0x1ecf8b[_0x18ce('0x6a')]));var _0x35983c=this[_0x18ce('0x37')][_0x18ce('0xc0')](_0x1ecf8b[_0x18ce('0x6a')]);if(_0x35983c[_0x18ce('0xa8')]===-0x1){return _0x35983c;}}return this['channel'][_0x18ce('0xbd')]();};AGIVertices['prototype']['callback']=function(_0x413aae){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xc1'),_0x413aae[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x413aae['list_id'])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x413aae,_0x18ce('0xc2'));}_0x413aae[_0x18ce('0x4c')]=moment();if(this[_0x18ce('0x88')](_0x413aae[_0x18ce('0xc3')])){_0x413aae[_0x18ce('0x4c')]=moment()['add'](_0x413aae[_0x18ce('0xc3')],_0x18ce('0xc4'));}if(!this['isConfigured'](_0x413aae[_0x18ce('0x50')])){_0x413aae['callback_priority']=0x2;}this['createCmContact'][_0x18ce('0x73')](this,_0x413aae);return this[_0x18ce('0x37')]['noop'](util[_0x18ce('0x28')](_0x18ce('0xc5'),_0x413aae['phone'],_0x413aae[_0x18ce('0x4b')],_0x413aae[_0x18ce('0x4c')]));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xc6')]=function(_0x25ff75){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xc7'),_0x25ff75[_0x18ce('0x39')]));var _0x54352e=this['channel']['exec'](_0x25ff75['application'],_0x25ff75['options']);if(_0x54352e[_0x18ce('0xa8')]===-0x1){return _0x54352e;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xc8'),_0x25ff75[_0x18ce('0xc9')],_0x25ff75[_0x18ce('0x7b')]));};AGIVertices['prototype'][_0x18ce('0xca')]=function(_0x437f28){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x437f28[_0x18ce('0x39')]));if(!this['isConfigured'](_0x437f28[_0x18ce('0x60')])){return this[_0x18ce('0x37')]['noop']('no\x20text\x20configured');}var _0x118006='\x22'+_0x437f28[_0x18ce('0x60')]+'\x22';if(this[_0x18ce('0x88')](_0x437f28['options'])){_0x118006+=','+_0x437f28[_0x18ce('0x7b')];}var _0x344991=this[_0x18ce('0x37')][_0x18ce('0x5b')](_0x18ce('0xae'),_0x118006);if(_0x344991[_0x18ce('0xa8')]===-0x1){return _0x344991;}return this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xb0'),_0x118006));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xcb')]=function(_0x34e0b8){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xcc'),_0x34e0b8['label']));if(!this['isConfigured'](_0x34e0b8[_0x18ce('0x60')])){return this['channel'][_0x18ce('0xaf')]('no\x20text\x20configured');}var _0xedf899='\x22'+_0x34e0b8[_0x18ce('0x60')]+'\x22';if(this[_0x18ce('0x88')](_0x34e0b8[_0x18ce('0x7b')])){_0xedf899+=','+_0x34e0b8[_0x18ce('0x7b')];}var _0x417470=this[_0x18ce('0x37')][_0x18ce('0x5b')](_0x18ce('0xae'),_0xedf899);if(_0x417470[_0x18ce('0xa8')]===-0x1){return _0x417470;}return this[_0x18ce('0x37')]['noop'](util[_0x18ce('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0xedf899));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xcd')]=function(_0x5e5da0){logger['info'](util[_0x18ce('0x28')](_0x18ce('0xce'),_0x5e5da0[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x5e5da0[_0x18ce('0xb3')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xb4'));}var _0x3d62d2=_0x5e5da0[_0x18ce('0xb3')];if(this[_0x18ce('0x88')](_0x5e5da0[_0x18ce('0x7b')])){_0x3d62d2+=','+_0x5e5da0[_0x18ce('0x7b')];}var _0x15f35b=this[_0x18ce('0x37')]['exec']('MRCPRecog',_0x3d62d2);if(_0x15f35b[_0x18ce('0xa8')]===-0x1){return _0x15f35b;}var _0x579c80=this['getAndSetVariable'](_0x18ce('0xcf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x579c80[_0x18ce('0xa8')]===-0x1){return _0x579c80;}var _0x2606dd=this[_0x18ce('0xa7')](_0x18ce('0xb6'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2606dd[_0x18ce('0xa8')]===-0x1){return _0x2606dd;}var _0x27318e=this[_0x18ce('0xa7')](_0x18ce('0xb7'),'LUMENVOX_ASR_INSTANCE');if(_0x27318e['result']===-0x1){return _0x27318e;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xb9'),_0x3d62d2));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xd0')]=function(_0x410580){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x410580['label']));if(!this[_0x18ce('0x88')](_0x410580[_0x18ce('0xb3')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')]('no\x20grammar\x20configured');}var _0x5374ec=_0x410580[_0x18ce('0xb3')];if(this[_0x18ce('0x88')](_0x410580[_0x18ce('0x7b')])){_0x5374ec+=','+_0x410580[_0x18ce('0x7b')];}var _0x5301ca=this['channel'][_0x18ce('0x5b')](_0x18ce('0xb5'),_0x5374ec);if(_0x5301ca['result']===-0x1){return _0x5301ca;}var _0x2aa35e=this[_0x18ce('0xa7')](_0x18ce('0xcf'),_0x18ce('0xd1'));if(_0x2aa35e[_0x18ce('0xa8')]===-0x1){return _0x2aa35e;}var _0x5387b2=this[_0x18ce('0xa7')](_0x18ce('0xb6'),'SESTEK_ASR_TRANSCRIPT');if(_0x5387b2[_0x18ce('0xa8')]===-0x1){return _0x5387b2;}var _0x5aa71c=this['getAndSetVariable']('RECOG_INSTANCE()',_0x18ce('0xd2'));if(_0x5aa71c[_0x18ce('0xa8')]===-0x1){return _0x5aa71c;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xb9'),_0x5374ec));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xd3')]=function(_0x2c2d6a){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xd4'),_0x2c2d6a[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x2c2d6a[_0x18ce('0xd5')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x2c2d6a,_0x18ce('0xd6'));}var _0x5bffe9=this[_0x18ce('0xd7')][_0x18ce('0x73')](this,_0x2c2d6a['odbc_id']);if(!_0x5bffe9){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x2c2d6a,'no\x20odbc\x20database\x20found');}if(!this[_0x18ce('0x88')](_0x2c2d6a[_0x18ce('0x2f')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x2c2d6a,_0x18ce('0xd8'));}var _0x594cf0=_0x2c2d6a[_0x18ce('0x2f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xd9'),_0x594cf0));var _0x3c9f92=this[_0x18ce('0x2a')][_0x18ce('0x73')](this,_0x5bffe9,_0x594cf0);this[_0x18ce('0x36')][_0x18ce('0x73')](this,_0x2c2d6a,_0x594cf0);if(!this['isConfigured'](_0x2c2d6a[_0x18ce('0xda')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xdb'));}var _0xfd752e=this[_0x18ce('0x14')][_0x18ce('0x73')](this,_0x2c2d6a[_0x18ce('0xda')]);if(!_0xfd752e){return this[_0x18ce('0x37')]['error'](_0x2c2d6a,'no\x20variable\x20found');}var _0x26ca63=this;_0x3c9f92[_0x18ce('0xdc')](function(_0x3a648f,_0x18c6f1){Object[_0x18ce('0xdd')](_0x3a648f)[_0x18ce('0xdc')](function(_0x1a1437){_0x26ca63[_0x18ce('0x37')][_0x18ce('0xa2')](util[_0x18ce('0x28')](_0x18ce('0xde'),_0xfd752e,_0x18c6f1,_0x1a1437),_0x3a648f[_0x1a1437]);});});this[_0x18ce('0x37')]['setVariable'](util['format'](_0x18ce('0xdf'),_0xfd752e),_0x3c9f92[_0x18ce('0x9d')]);return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xe0'),_0xfd752e));};AGIVertices['prototype'][_0x18ce('0xe1')]=function(_0x43604c){logger['debug'](util[_0x18ce('0x28')](_0x18ce('0xe2'),_0x43604c['label']));if(!this['isConfigured'](_0x43604c[_0x18ce('0xe3')])){return this[_0x18ce('0x37')]['error'](_0x43604c,_0x18ce('0xe4'));}var _0x2f83c3=this[_0x18ce('0x1c')][_0x18ce('0x73')](this,_0x43604c['sip_id']);if(!_0x2f83c3){return this[_0x18ce('0x37')]['error'](_0x43604c,_0x18ce('0xe5'));}var _0x146916=this['channel']['exec'](_0x18ce('0xe6'),[util[_0x18ce('0x28')]('SIP/%s',_0x2f83c3),_0x43604c[_0x18ce('0x6a')],_0x43604c[_0x18ce('0xe7')],_0x43604c[_0x18ce('0x68')]]);if(_0x146916[_0x18ce('0xa8')]===-0x1){return _0x146916;}return this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xe8')]=function(_0x4c49b2){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4c49b2[_0x18ce('0x39')]));if(!this['isConfigured'](_0x4c49b2[_0x18ce('0x7d')])){return this[_0x18ce('0x37')]['noop'](_0x18ce('0xe9'));}if(!this[_0x18ce('0x88')](_0x4c49b2[_0x18ce('0x60')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xad'));}this[_0x18ce('0x37')][_0x18ce('0xea')]=!![];this[_0x18ce('0x36')](_0x4c49b2);this['createSquareMessage'](_0x4c49b2['text'],'in','','');this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xeb'),_0x4c49b2[_0x18ce('0x60')]));var _0x24f7c7=this[_0x18ce('0x7c')][_0x18ce('0x73')](this,_0x4c49b2);if(_0x24f7c7){for(var _0x2bf9b7 in _0x24f7c7){if(_0x24f7c7[_0x18ce('0x99')](_0x2bf9b7)){this[_0x18ce('0x37')]['setVariable'](util['format'](_0x18ce('0xec'),_0x2bf9b7['toUpperCase']()),_0x24f7c7[_0x2bf9b7]);}}this['createSquareMessage'](_0x24f7c7[_0x18ce('0xed')],'out',_0x18ce('0xe8'),'');return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xee'),_0x24f7c7['speech']));}return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x4c49b2,_0x18ce('0xef'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0xf0')]=function(_0x5b6390){logger['info'](util[_0x18ce('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5b6390[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x5b6390[_0x18ce('0x7f')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xf1'));}if(!this[_0x18ce('0x88')](_0x5b6390['client_email'])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xf2'));}if(!this[_0x18ce('0x88')](_0x5b6390[_0x18ce('0xf3')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xf4'));}if(!this['isConfigured'](_0x5b6390['dialogflowV2_language'])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xf5'));}if(!this[_0x18ce('0x88')](_0x5b6390[_0x18ce('0x60')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xad'));}this['channel']['bot']=!![];this[_0x18ce('0x36')](_0x5b6390);this['createSquareMessage'](_0x5b6390[_0x18ce('0x60')],'in','','');this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x5b6390['text']));var _0x4b1c3b=this['googleDialogflowV2'][_0x18ce('0x73')](this,_0x5b6390);if(_0x4b1c3b){for(var _0x5dfc27 in _0x4b1c3b){if(_0x4b1c3b['hasOwnProperty'](_0x5dfc27)){if(_0x5dfc27!==_0x18ce('0xf6')){this[_0x18ce('0x37')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x5dfc27['toUpperCase']()),_0x4b1c3b[_0x5dfc27]);}}}this[_0x18ce('0x45')](_0x4b1c3b[_0x18ce('0xed')],_0x18ce('0xf7'),_0x18ce('0xf0'),_0x4b1c3b[_0x18ce('0xf6')]);return this[_0x18ce('0x37')]['noop'](util[_0x18ce('0x28')](_0x18ce('0xf8'),_0x4b1c3b[_0x18ce('0xed')]));}return this[_0x18ce('0x37')]['error'](_0x5b6390,_0x18ce('0xf9'));};AGIVertices['prototype']['sesteknda']=function(_0x83fa24){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0xfa'),_0x83fa24[_0x18ce('0x39')]));if(!this['isConfigured'](_0x83fa24[_0x18ce('0xfb')])){return this['channel'][_0x18ce('0xaf')](_0x18ce('0xfc'));}if(!this[_0x18ce('0x88')](_0x83fa24[_0x18ce('0xfd')])){return this['channel'][_0x18ce('0xaf')](_0x18ce('0xfe'));}if(!this[_0x18ce('0x88')](_0x83fa24[_0x18ce('0xff')])){return this['channel'][_0x18ce('0xaf')](_0x18ce('0x100'));}if(!this['isConfigured'](_0x83fa24[_0x18ce('0x101')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xad'));}this[_0x18ce('0x37')][_0x18ce('0xea')]=!![];this['createSquareDetailsReport'](_0x83fa24);this['createSquareMessage'](_0x83fa24[_0x18ce('0x60')],'in','','');this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x102'),_0x83fa24[_0x18ce('0x60')]));var _0x3afb23=this[_0x18ce('0x81')][_0x18ce('0x73')](this,_0x83fa24);if(_0x3afb23){for(var _0x3620cc in _0x3afb23){if(_0x3afb23[_0x18ce('0x99')](_0x3620cc)){this[_0x18ce('0x37')]['setVariable'](util['format'](_0x18ce('0x103'),_0x3620cc['toUpperCase']()),_0x3afb23[_0x3620cc]);}}this[_0x18ce('0x45')](_0x3afb23[_0x18ce('0xed')],'out',_0x18ce('0x104'),'');if(_0x3afb23[_0x18ce('0x105')]){this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x3afb23[_0x18ce('0x105')]));var _0x25c402=this[_0x18ce('0x37')]['streamFile'](_0x3afb23['audiofile']);try{fs[_0x18ce('0x106')](_0x3afb23['audiofile']+'.wav');}catch(_0x1ad62d){logger[_0x18ce('0x2c')](_0x1ad62d);}return _0x25c402;}else{return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x107'),_0x3afb23['speech']));}}return this['channel'][_0x18ce('0x2c')](_0x83fa24,_0x18ce('0x108'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x109')]=function(_0x5099bf){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x10a'),_0x5099bf[_0x18ce('0x39')]));return this['channel'][_0x18ce('0xaf')](_0x18ce('0x109'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x10b')]=function(_0x3c9b03){logger['info'](util[_0x18ce('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x3c9b03[_0x18ce('0x39')]));var _0x48ed18='';if(_0x3c9b03[_0x18ce('0x10c')]){if(!this[_0x18ce('0x88')](_0x3c9b03[_0x18ce('0x10c')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x3c9b03,'no\x20trunk\x20selected');}else{var _0x516263=parseInt(_0x3c9b03['trunk_id'],0xa);if(isNaN(_0x516263)){_0x48ed18=_0x3c9b03[_0x18ce('0x10c')];}else{_0x48ed18=this[_0x18ce('0x1e')][_0x18ce('0x73')](this,_0x3c9b03['trunk_id']);if(!_0x48ed18){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x3c9b03,'no\x20trunk\x20found');}}}}else if(_0x3c9b03['trunk_name']){_0x48ed18=_0x3c9b03[_0x18ce('0x10d')];}else{return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x3c9b03,_0x18ce('0x10e'));}var _0x24d53d=this[_0x18ce('0x37')][_0x18ce('0x5b')](_0x18ce('0xe6'),[util[_0x18ce('0x28')](_0x18ce('0x10f'),_0x48ed18,_0x3c9b03['phone']),_0x3c9b03[_0x18ce('0x6a')],_0x3c9b03[_0x18ce('0xe7')],_0x3c9b03[_0x18ce('0x68')]]);if(_0x24d53d['result']===-0x1){return _0x24d53d;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x110'),_0x18ce('0xe6')));};AGIVertices['prototype'][_0x18ce('0x111')]=function(_0x24d670){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x112'),_0x24d670[_0x18ce('0x39')]));return this[_0x18ce('0x37')][_0x18ce('0xaf')]('finally');};AGIVertices['prototype'][_0x18ce('0x113')]=function(_0x56105a){logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x114'),_0x56105a['label']));if(_0x56105a[_0x18ce('0xab')]===0x0){return this[_0x18ce('0xaa')](_0x56105a);}_0x56105a['retry']-=0x1;if(!this[_0x18ce('0x88')](_0x56105a['file_id'])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x56105a,_0x18ce('0x115'));}var _0x3cedfd=this[_0x18ce('0x1f')][_0x18ce('0x73')](this,_0x56105a[_0x18ce('0x116')]);if(!_0x3cedfd){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x56105a,_0x18ce('0x117'));}if(!this[_0x18ce('0x88')](_0x56105a['variable_id'])){return this[_0x18ce('0x37')][_0x18ce('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x22cdc4=this['channel'][_0x18ce('0x118')](_0x3cedfd,_0x56105a[_0x18ce('0x119')],_0x56105a[_0x18ce('0x11a')]);var _0x3cf7e8=_0x22cdc4[_0x18ce('0xa8')]?_0x22cdc4[_0x18ce('0xa8')][_0x18ce('0x4f')]():'';logger['info'](_0x18ce('0x11b'),JSON['stringify'](_0x22cdc4));if(_0x22cdc4[_0x18ce('0xa8')]===-0x1){this[_0x18ce('0x36')][_0x18ce('0x73')](this,_0x56105a,_0x3cf7e8);return _0x22cdc4;}else if(_0x22cdc4[_0x18ce('0xa6')]===_0x18ce('0x6a')){_0x22cdc4[_0x18ce('0xa8')]=_0x3cf7e8[_0x18ce('0x9d')]>=parseInt(_0x56105a[_0x18ce('0x11c')])?'x':'i';}else{_0x22cdc4[_0x18ce('0xa8')]=_0x3cf7e8[_0x18ce('0x9d')]>=parseInt(_0x56105a['mindigit'])&&_0x3cf7e8[_0x18ce('0x9d')]<=parseInt(_0x56105a[_0x18ce('0x11a')])?'x':'i';}var _0x48429b=this['getVariable'][_0x18ce('0x73')](this,_0x56105a[_0x18ce('0xda')]);if(!_0x48429b){return this[_0x18ce('0x37')]['error'](_0x56105a,_0x18ce('0x11d'));}this['channel'][_0x18ce('0xa2')](_0x48429b,_0x3cf7e8);if(this[_0x18ce('0x88')](_0x56105a[_0x18ce('0x11e')])){var _0x348a61=parseInt(_0x56105a[_0x18ce('0x11e')],0xa);var _0x253916=rs['generate']({'charset':'*','length':_0x348a61});var _0x56df48=_0x3cf7e8[_0x18ce('0x9d')];if(_0x56df48>0x0){if(_0x56df48>_0x348a61){this[_0x18ce('0x36')][_0x18ce('0x73')](this,_0x56105a,_0x56105a['hiddendigitspos']===_0x18ce('0x11f')?_0x253916+_0x3cf7e8[_0x18ce('0x120')](_0x348a61):_0x3cf7e8['substr'](0x0,_0x56df48-_0x348a61)+_0x253916);}else{this[_0x18ce('0x36')][_0x18ce('0x73')](this,_0x56105a,rs[_0x18ce('0x121')]({'charset':'*','length':_0x56df48}));}}else{this[_0x18ce('0x36')]['sync'](this,_0x56105a,'');}}else{this[_0x18ce('0x36')]['sync'](this,_0x56105a,_0x3cf7e8);}return _0x22cdc4;};AGIVertices['prototype'][_0x18ce('0x10')]=function(_0x305a68){logger[_0x18ce('0x2e')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x305a68[_0x18ce('0x39')]));return this[_0x18ce('0x113')](_0x305a68);};AGIVertices['prototype'][_0x18ce('0x122')]=function(_0x30f96f){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x123'),_0x30f96f[_0x18ce('0x39')]));this['createSquareDetailsReport'][_0x18ce('0x73')](this,_0x30f96f,_0x30f96f[_0x18ce('0x124')]);return this[_0x18ce('0x37')]['noop'](util[_0x18ce('0x28')]('GOAL\x20%s',_0x30f96f['goalname']));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x125')]=function(_0x334702){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x126'),_0x334702[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x334702['aws_access_key_id'])||!this[_0x18ce('0x88')](_0x334702[_0x18ce('0x8c')])){return this[_0x18ce('0x37')]['noop'](_0x18ce('0x127'));}if(!this['isConfigured'](_0x334702[_0x18ce('0x60')])){return this[_0x18ce('0x37')]['noop']('no\x20text\x20configured');}this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x128'),_0x334702[_0x18ce('0x60')]));var _0x100343=this[_0x18ce('0x8a')][_0x18ce('0x73')](this,_0x334702);if(_0x100343){this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x129'),_0x100343));var _0x59788c=this[_0x18ce('0x37')][_0x18ce('0x12a')](_0x100343);try{fs[_0x18ce('0x106')](_0x100343+_0x18ce('0x12b'));}catch(_0x34ae76){logger['error'](_0x34ae76);}return _0x59788c;}return this[_0x18ce('0x37')]['error'](_0x334702,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x18ce('0x13')]['awslex']=function(_0x137781){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x12c'),_0x137781[_0x18ce('0x39')]));if(!this['isConfigured'](_0x137781[_0x18ce('0x8b')])||!this['isConfigured'](_0x137781[_0x18ce('0x8c')])){return this['channel'][_0x18ce('0xaf')](_0x18ce('0x127'));}if(!this['isConfigured'](_0x137781[_0x18ce('0x12d')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0x12e'));}if(!this[_0x18ce('0x88')](_0x137781[_0x18ce('0x60')])){return this[_0x18ce('0x37')]['noop'](_0x18ce('0xad'));}this[_0x18ce('0x37')][_0x18ce('0xea')]=!![];this[_0x18ce('0x36')](_0x137781);this[_0x18ce('0x45')](_0x137781[_0x18ce('0x60')],'in','','');this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x12f'),_0x137781[_0x18ce('0x60')]));var _0x3e38b0=this[_0x18ce('0x90')][_0x18ce('0x73')](this,_0x137781);if(_0x3e38b0){for(var _0x2ed117 in _0x3e38b0){if(_0x3e38b0[_0x18ce('0x99')](_0x2ed117)&&_[_0x18ce('0x9e')](_0x3e38b0[_0x2ed117])){this['channel'][_0x18ce('0xa2')](util[_0x18ce('0x28')](_0x18ce('0x130'),_0x2ed117[_0x18ce('0x6e')]()),_0x3e38b0[_0x2ed117]);}}if(_[_0x18ce('0x48')](_0x3e38b0[_0x18ce('0x7a')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x18ce('0x45')](_0x3e38b0[_0x18ce('0x7a')],_0x18ce('0xf7'),_0x18ce('0x131'),'');return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x132'),_0x3e38b0[_0x18ce('0x7a')]));}}return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x137781,_0x18ce('0x133'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x134')]=function(_0x4ce219){logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x135'),_0x4ce219['label'],_0x4ce219[_0x18ce('0x6a')]));if(!this[_0x18ce('0x88')](_0x4ce219[_0x18ce('0x7d')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xe9'));}var _0x1c54d5=_0x18ce('0x136');var _0x30ea94=util[_0x18ce('0x28')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x175284=util[_0x18ce('0x28')]('%s.%s',_0x30ea94,_0x1c54d5);var _0x434296=!![];if(_0x4ce219[_0x18ce('0x137')]===_0x18ce('0x138')){_0x434296=![];}var _0xa0e10e=this[_0x18ce('0x37')][_0x18ce('0x139')](_0x30ea94,_0x1c54d5,_0x4ce219[_0x18ce('0x13a')],_0x4ce219['timeout'],undefined,_0x434296);if(_0xa0e10e[_0x18ce('0xa8')]!==-0x1){this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x13b'),_0x175284));var _0x238bbb=this['googleASR'][_0x18ce('0x73')](this,_0x4ce219,_0x175284);if(_0x238bbb){for(var _0xe8266d in _0x238bbb){if(_0x238bbb[_0x18ce('0x99')](_0xe8266d)){this['channel']['setVariable'](util[_0x18ce('0x28')]('GOOGLE_ASR_%s',_0xe8266d['toUpperCase']()),_0x238bbb[_0xe8266d]);}}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util['format'](_0x18ce('0x13c'),JSON['stringify'](_0x238bbb)));}}return _0xa0e10e;};AGIVertices['prototype']['tildeasr']=function(_0x400171){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x13d'),_0x400171[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x400171['appid'])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0x13e'));}if(!this['isConfigured'](_0x400171[_0x18ce('0x96')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0x13f'));}var _0xed4f1d='wav';var _0xac199f=util['format'](_0x18ce('0x140'),FILES_PATH,rs[_0x18ce('0x121')](0x4));var _0xf45af8=util[_0x18ce('0x28')](_0x18ce('0xa0'),_0xac199f,_0xed4f1d);var _0x1d94a6=!![];if(_0x400171[_0x18ce('0x137')]==='NOBEEP'){_0x1d94a6=![];}var _0x4b44d3=this[_0x18ce('0x37')][_0x18ce('0x139')](_0xac199f,_0xed4f1d,_0x400171[_0x18ce('0x13a')],_0x400171[_0x18ce('0x6a')],undefined,_0x1d94a6);if(_0x4b44d3['result']!==-0x1){this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x141'),_0xf45af8));var _0x1047e4=this['tildeASR'][_0x18ce('0x73')](this,_0x400171,_0xf45af8);if(_0x1047e4){for(var _0x48d3b1 in _0x1047e4){if(_0x1047e4[_0x18ce('0x99')](_0x48d3b1)){this[_0x18ce('0x37')][_0x18ce('0xa2')](util[_0x18ce('0x28')](_0x18ce('0x142'),_0x48d3b1[_0x18ce('0x6e')]()),_0x1047e4[_0x48d3b1]);}}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util['format'](_0x18ce('0x143'),JSON[_0x18ce('0x77')](_0x1047e4)));}}return _0x4b44d3;};AGIVertices[_0x18ce('0x13')][_0x18ce('0x144')]=function(_0x2411fb){logger['info'](util[_0x18ce('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2411fb[_0x18ce('0x39')]));return this[_0x18ce('0x37')][_0x18ce('0x145')](_0x2411fb[_0x18ce('0x3f')],_0x2411fb[_0x18ce('0x40')],_0x2411fb['priority']);};AGIVertices[_0x18ce('0x13')][_0x18ce('0x146')]=function(_0x201aa1){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x147'),_0x201aa1[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x201aa1[_0x18ce('0x148')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x201aa1,_0x18ce('0x149'));}try{var _0x120477=eval(_0x201aa1['condition'])?'true':'false';this[_0x18ce('0x37')]['noop'](util['format'](_0x18ce('0x14a'),_0x201aa1['condition'],_0x120477));return{'code':0xc8,'result':_0x120477};}catch(_0x1f4b15){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x18ce('0x13')]['gotoiftime']=function(_0x3851b8){logger['info'](util[_0x18ce('0x28')](_0x18ce('0x14b'),_0x3851b8[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x3851b8['interval_id'])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x3851b8,_0x18ce('0x14c'));}var _0x456e18=this[_0x18ce('0x24')][_0x18ce('0x73')](this,_0x3851b8[_0x18ce('0x14d')]);if(!_0x456e18){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x3851b8,_0x18ce('0x14e'));}for(var _0x56efe3=0x0;_0x56efe3<_0x456e18[_0x18ce('0x9d')];_0x56efe3+=0x1){var _0x31941a=this[_0x18ce('0x37')]['getVariable'](util[_0x18ce('0x28')](_0x18ce('0x14f'),_0x456e18[_0x56efe3]));if(_0x31941a['result']===-0x1){return _0x31941a;}logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('IFTIME\x20%s\x20%s',_0x456e18[_0x56efe3],_0x31941a['extra']));if(_0x31941a[_0x18ce('0xa6')]===_0x18ce('0x150')){logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x151'),_0x456e18[_0x56efe3],'true'));this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x151'),_0x456e18[_0x56efe3],'true'));return{'code':0xc8,'result':_0x18ce('0x150')};}else{logger['info'](util['format'](_0x18ce('0x151'),_0x456e18[_0x56efe3],_0x18ce('0x152')));this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x151'),_0x456e18[_0x56efe3],_0x18ce('0x152')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x18ce('0x13')][_0x18ce('0x153')]=function(_0x4473e){logger[_0x18ce('0x2e')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x4473e[_0x18ce('0x39')]));return this[_0x18ce('0x37')][_0x18ce('0x153')]();};AGIVertices[_0x18ce('0x13')][_0x18ce('0x154')]=function(_0x13219f){logger['info'](util['format'](_0x18ce('0x155'),_0x13219f['label']));if(!this[_0x18ce('0x88')](_0x13219f['key'])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xe9'));}var _0x437af1=_0x18ce('0x136');var _0xa5eca1=util[_0x18ce('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x18ce('0x121')](0x4));var _0x1cf85c=util[_0x18ce('0x28')](_0x18ce('0xa0'),_0xa5eca1,_0x437af1);var _0x5b40d6=!![];if(_0x13219f[_0x18ce('0x137')]==='NOBEEP'){_0x5b40d6=![];}var _0x5ce7d2=this[_0x18ce('0x37')][_0x18ce('0x139')](_0xa5eca1,_0x437af1,_0x13219f['intKey'],_0x13219f['timeout'],undefined,_0x5b40d6);if(_0x5ce7d2[_0x18ce('0xa8')]!==-0x1){this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x156'),_0x1cf85c));var _0x427422=this[_0x18ce('0x86')][_0x18ce('0x73')](this,_0x13219f,_0x1cf85c);if(_0x427422){for(var _0x478c9b in _0x427422){if(_0x427422['hasOwnProperty'](_0x478c9b)){this[_0x18ce('0x37')][_0x18ce('0xa2')](util[_0x18ce('0x28')](_0x18ce('0x157'),_0x478c9b[_0x18ce('0x6e')]()),_0x427422[_0x478c9b]);}}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x158'),JSON[_0x18ce('0x77')](_0x427422)));}}return _0x5ce7d2;};AGIVertices[_0x18ce('0x13')][_0x18ce('0x159')]=function(_0x178bf6){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x15a'),_0x178bf6['label']));if(!this[_0x18ce('0x88')](_0x178bf6[_0x18ce('0x7d')])){return this[_0x18ce('0x37')]['noop']('no\x20key\x20configured');}if(!this[_0x18ce('0x88')](_0x178bf6[_0x18ce('0x60')])){return this[_0x18ce('0x37')]['noop']('no\x20text\x20configured');}this[_0x18ce('0x37')]['noop'](util[_0x18ce('0x28')](_0x18ce('0x15b'),_0x178bf6['text']));var _0x528389=this[_0x18ce('0x82')][_0x18ce('0x73')](this,_0x178bf6);if(_0x528389){this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')]('ispeech\x20%s\x20file\x20created',_0x528389));var _0xf99e83=this[_0x18ce('0x37')][_0x18ce('0x12a')](_0x528389,_0x178bf6[_0x18ce('0x13a')]);try{fs['unlink'](_0x528389+_0x18ce('0x12b'));}catch(_0x5b5e7c){logger[_0x18ce('0x2c')](_0x5b5e7c);}return _0xf99e83;}return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x178bf6,_0x18ce('0x15c'));};AGIVertices['prototype'][_0x18ce('0x15d')]=function(_0x530a5b){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x15e'),_0x530a5b[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x530a5b[_0x18ce('0x15f')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x530a5b,_0x18ce('0x160'));}logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x161'),this['channel'][_0x18ce('0x3d')],_0x530a5b[_0x18ce('0x15f')]));var _0x47dc1d=this[_0x18ce('0x59')][_0x18ce('0x73')](this,_0x530a5b[_0x18ce('0x15f')]);if(_0x47dc1d){logger['info'](util[_0x18ce('0x28')](_0x18ce('0x162'),this[_0x18ce('0x37')]['callerid'],_0x530a5b['findBy']));this[_0x18ce('0x37')][_0x18ce('0xaf')](util['format'](_0x18ce('0x162'),this[_0x18ce('0x37')]['callerid'],_0x530a5b[_0x18ce('0x15f')]));return{'code':0xc8,'result':_0x18ce('0x163')};}else{logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x164'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x530a5b['findBy']));this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x164'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x530a5b['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x18ce('0x13')][_0x18ce('0x165')]=function(_0x5e3367){logger['info'](util[_0x18ce('0x28')](_0x18ce('0x166'),_0x5e3367[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x5e3367[_0x18ce('0x15f')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x5e3367,_0x18ce('0x160'));}logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x161'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x5e3367[_0x18ce('0x15f')]));var _0x4ebc6b=this[_0x18ce('0x56')]['sync'](this,_0x5e3367[_0x18ce('0x15f')]);if(_0x4ebc6b){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x162'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x5e3367[_0x18ce('0x15f')]));this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x162'),this['channel'][_0x18ce('0x3d')],_0x5e3367[_0x18ce('0x15f')]));return{'code':0xc8,'result':_0x18ce('0x163')};}else{logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x164'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x5e3367['findBy']));this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x5e3367[_0x18ce('0x15f')]));return{'code':0xc8,'result':_0x18ce('0x167')};}};AGIVertices[_0x18ce('0x13')][_0x18ce('0x168')]=function(_0x2f131c){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2f131c['label']));if(!this[_0x18ce('0x88')](_0x2f131c[_0x18ce('0x169')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x2f131c,_0x18ce('0x16a'));}this['channel']['noop'](util['format']('math\x20%s',_0x2f131c[_0x18ce('0x169')]));var _0x560607=eval(_0x2f131c['operation']);if(!this[_0x18ce('0x88')](_0x2f131c['variable_id'])){return this[_0x18ce('0x37')][_0x18ce('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x244149=this[_0x18ce('0x14')]['sync'](this,_0x2f131c[_0x18ce('0xda')]);if(!_0x244149){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x2f131c,'no\x20variable\x20found');}if(_['isArray'](_0x560607)){var _0x32f3a4=this;_0x560607['forEach'](function(_0x1b5e93,_0x4be1b9){_0x32f3a4[_0x18ce('0x37')][_0x18ce('0xa2')](util[_0x18ce('0x28')](_0x18ce('0x16b'),_0x244149,_0x4be1b9),_0x1b5e93);});return this[_0x18ce('0x37')][_0x18ce('0xaf')](util['format'](_0x18ce('0x16c'),_0x244149));}else{return this[_0x18ce('0x37')]['setVariable'](_0x244149,_0x560607);}};AGIVertices[_0x18ce('0x13')][_0x18ce('0xf')]=function(_0x5ac664){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5ac664['label']));if(_0x5ac664[_0x18ce('0xab')]===0x0){return this[_0x18ce('0xaa')](_0x5ac664);}_0x5ac664['retry']-=0x1;if(!this[_0x18ce('0x88')](_0x5ac664[_0x18ce('0x116')])){return this[_0x18ce('0x37')]['error'](_0x5ac664,_0x18ce('0x115'));}var _0x52d174=this[_0x18ce('0x1f')][_0x18ce('0x73')](this,_0x5ac664['file_id']);if(!_0x52d174){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x5ac664,_0x18ce('0x117'));}var _0x407209=this['channel']['getData'](_0x52d174,_0x5ac664[_0x18ce('0x119')],_0x5ac664['digit']);var _0x3a278f=_0x407209[_0x18ce('0xa8')];if(_0x407209[_0x18ce('0xa8')]===-0x1){this[_0x18ce('0x36')][_0x18ce('0x73')](this,_0x5ac664,'-1');return _0x407209;}else if(_0x407209[_0x18ce('0xa6')]===_0x18ce('0x6a')){_0x407209[_0x18ce('0xa8')]=_0x407209['result'][_0x18ce('0x9d')]>0x0?_0x407209[_0x18ce('0xa8')]:'t';}else if(_[_0x18ce('0x47')](_0x407209[_0x18ce('0xa8')])){_0x407209['result']='#';_0x3a278f='#';}if(!this[_0x18ce('0x88')](_0x5ac664[_0x18ce('0xda')])){this['channel'][_0x18ce('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x377611=this[_0x18ce('0x14')][_0x18ce('0x73')](this,_0x5ac664['variable_id']);if(!_0x377611){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x5ac664,_0x18ce('0x11d'));}this[_0x18ce('0x37')]['setVariable'](_0x377611,_0x3a278f);}this[_0x18ce('0x36')][_0x18ce('0x73')](this,_0x5ac664,_0x3a278f);return _0x407209;};AGIVertices[_0x18ce('0x13')][_0x18ce('0xaf')]=function(_0x30e7f2){logger[_0x18ce('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x30e7f2['label']));return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x30e7f2[_0x18ce('0x16d')]||_0x30e7f2[_0x18ce('0x39')]);};AGIVertices['prototype']['pause']=function(_0x28b9e5){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x16e'),_0x28b9e5['label']));if(!this['isConfigured'](_0x28b9e5['findBy'])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x28b9e5,_0x18ce('0x160'));}logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x18ce('0x3d')],_0x28b9e5[_0x18ce('0x15f')]));var _0x30d52b=this[_0x18ce('0x51')]['sync'](this,_0x28b9e5[_0x18ce('0x16f')]);var _0x6961d1=this[_0x18ce('0x54')][_0x18ce('0x73')](this,_0x28b9e5['findBy'],_0x30d52b);if(_0x6961d1){logger['info'](util['format'](_0x18ce('0x162'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x28b9e5['findBy']));this[_0x18ce('0x37')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x18ce('0x37')]['callerid'],_0x28b9e5[_0x18ce('0x15f')]));return{'code':0xc8,'result':_0x18ce('0x163')};}else{logger['info'](util[_0x18ce('0x28')](_0x18ce('0x164'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x28b9e5[_0x18ce('0x15f')]));this['channel'][_0x18ce('0xaf')](util['format'](_0x18ce('0x162'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x28b9e5[_0x18ce('0x15f')]));return{'code':0xc8,'result':_0x18ce('0x167')};}};AGIVertices[_0x18ce('0x13')][_0x18ce('0x170')]=function(_0x7316f){logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x171'),_0x7316f[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x7316f[_0x18ce('0x116')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x7316f,_0x18ce('0x115'));}var _0x1d6ebc=this[_0x18ce('0x1f')]['sync'](this,_0x7316f[_0x18ce('0x116')]);if(!_0x1d6ebc){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x7316f,'no\x20file\x20audio\x20found');}var _0x239bcd=this[_0x18ce('0x37')]['exec'](_0x18ce('0x172'),[_0x1d6ebc,_0x7316f[_0x18ce('0xe7')]]);if(_0x239bcd['result']===-0x1){return _0x239bcd;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xc8'),_0x18ce('0x172'),_0x1d6ebc));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x173')]=function(_0x28b476){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x28b476[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x28b476[_0x18ce('0x174')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x28b476,_0x18ce('0x175'));}var _0x234052='';var _0xe88ae1=parseInt(_0x28b476[_0x18ce('0x174')],0xa);if(isNaN(_0xe88ae1)){_0x234052=_0x28b476['queue_id'];}else{_0x234052=this[_0x18ce('0x18')][_0x18ce('0x73')](this,_0x28b476['queue_id']);if(!_0x234052){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x28b476,'no\x20queue\x20found');}}var _0x3b36a1='';if(this['isConfigured'](_0x28b476[_0x18ce('0x116')])){var _0x1e049b=this[_0x18ce('0x1f')][_0x18ce('0x73')](this,_0x28b476['file_id']);if(_0x1e049b){_0x3b36a1=_0x1e049b;}}this[_0x18ce('0x36')]['sync'](this,_0x28b476,_0x234052);if(_0x28b476['opts'][_0x18ce('0x176')]('x')<0x0){_0x28b476[_0x18ce('0xe7')]+='x';}if(_0x28b476[_0x18ce('0xe7')][_0x18ce('0x176')]('X')<0x0){_0x28b476[_0x18ce('0xe7')]+='X';}this[_0x18ce('0x37')][_0x18ce('0xa2')](_0x18ce('0x177'),_0x234052?_0x234052[_0x18ce('0x178')]():'');var _0x4b7d51=this[_0x18ce('0x37')][_0x18ce('0x5b')](_0x18ce('0x179'),[_0x234052,_0x28b476[_0x18ce('0xe7')],_0x28b476['url'],_0x3b36a1,_0x28b476[_0x18ce('0x6a')],_0x28b476[_0x18ce('0x9')],_0x28b476['macro'],_0x28b476['gosub'],'',_0x28b476[_0x18ce('0x17a')]]);if(_0x4b7d51[_0x18ce('0xa8')]===-0x1){return _0x4b7d51;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xc8'),_0x18ce('0x179'),_0x234052));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x17b')]=function(_0x40dcdc){logger[_0x18ce('0x2e')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x40dcdc[_0x18ce('0x39')]));var _0x48cd7d=_0x40dcdc[_0x18ce('0x17c')]||'wav';var _0x13a139=util[_0x18ce('0x28')]('%s_%s',this[_0x18ce('0x37')][_0x18ce('0x38')],rs[_0x18ce('0x121')](0x5));var _0x5018a0=util[_0x18ce('0x28')](_0x18ce('0x17d'),FILES_PATH,_0x13a139,_0x48cd7d);var _0x621a7f=util[_0x18ce('0x28')](_0x18ce('0x140'),FILES_PATH,_0x13a139);this['createSquareRecording']['sync'](this,_0x40dcdc,_0x13a139,_0x5018a0);this[_0x18ce('0x37')][_0x18ce('0xa2')](_0x18ce('0x17e'),_0x13a139);logger['info'](_0x18ce('0x17f'),_0x621a7f,_0x48cd7d,_0x40dcdc['escape_digits'],_0x40dcdc[_0x18ce('0x6a')]);return this[_0x18ce('0x37')][_0x18ce('0x139')](_0x621a7f,_0x48cd7d,_0x40dcdc['escape_digits'],_0x40dcdc[_0x18ce('0x6a')],undefined,!![]);};AGIVertices[_0x18ce('0x13')][_0x18ce('0x180')]=function(_0x1942f2){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x181'),_0x1942f2[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x1942f2['url'])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0x182'));}var _0x5603a7=this['restAPI'][_0x18ce('0x73')](this,_0x1942f2);logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x183'),util[_0x18ce('0x184')](_0x5603a7,{'showHidden':![],'depth':null})));if(!this[_0x18ce('0x88')](_0x1942f2[_0x18ce('0xda')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0x185'));}var _0x33d52b=this[_0x18ce('0x14')][_0x18ce('0x73')](this,_0x1942f2[_0x18ce('0xda')]);if(!_0x33d52b){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x1942f2,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0x18ce('0x28')](_0x18ce('0x186'),_0x33d52b),_0x5603a7['statusCode']?_0x5603a7['statusCode']:_0x18ce('0x187'));this['channel'][_0x18ce('0xa2')](util[_0x18ce('0x28')](_0x18ce('0x188'),_0x33d52b),_0x5603a7[_0x18ce('0x79')]?_0x5603a7['statusMessage']:'OK');if(_0x5603a7[_0x18ce('0x6f')]){try{this[_0x18ce('0xa1')](_0x5603a7[_0x18ce('0x6f')],_0x33d52b);}catch(_0x1cb1cb){logger[_0x18ce('0x2c')](util['format'](_0x18ce('0x189'),_0x33d52b));}}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')]('variable\x20%s\x20set',_0x33d52b));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x18a')]=function(_0x275756){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x18b'),_0x275756['label']));return this[_0x18ce('0x37')]['sayDigits'](_0x275756[_0x18ce('0x18c')][_0x18ce('0x5d')](/\s+/g,''),_0x275756['escape_digits']);};AGIVertices['prototype'][_0x18ce('0x18d')]=function(_0x44c2eb){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x18e'),_0x44c2eb['label']));return this['channel'][_0x18ce('0x18f')](_0x44c2eb[_0x18ce('0x190')][_0x18ce('0x5d')](/\s+/g,''),_0x44c2eb[_0x18ce('0x191')]);};AGIVertices[_0x18ce('0x13')]['sayphonetic']=function(_0x383250){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x192'),_0x383250['label']));return this[_0x18ce('0x37')][_0x18ce('0x193')](_0x383250['text'],_0x383250['escape_digits']);};AGIVertices['prototype'][_0x18ce('0x194')]=function(_0x348cdd){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x348cdd['label']));if(!this[_0x18ce('0x88')](_0x348cdd[_0x18ce('0x195')])){return this[_0x18ce('0x37')]['noop'](_0x18ce('0x196'));}var _0x454af4=this['getMailAccount'][_0x18ce('0x73')](this,_0x348cdd['account_id']);if(!_0x454af4||!_0x454af4[_0x18ce('0x197')]){return this['channel'][_0x18ce('0x2c')](_0x348cdd,_0x18ce('0x198'));}var _0x9e34ed={'from':util['format'](_0x18ce('0x199'),_0x454af4[_0x18ce('0x17')],_0x454af4['email']||_0x454af4['Smtp'][_0x18ce('0x19a')]),'to':_0x348cdd['to']||'','cc':_0x348cdd['cc']||'','bcc':_0x348cdd[_0x18ce('0x19b')]||'','subject':_0x348cdd[_0x18ce('0x19c')],'html':_0x348cdd[_0x18ce('0x60')],'text':_0x348cdd[_0x18ce('0x60')]};if(this[_0x18ce('0x88')](_0x348cdd['template_id'])){}logger['debug'](_0x18ce('0x19d'),JSON[_0x18ce('0x77')](_0x9e34ed));this[_0x18ce('0x36')]['sync'](this,_0x348cdd,_0x348cdd['account_id']);this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x19e'),_0x454af4[_0x18ce('0x17')]));this[_0x18ce('0x23')]['sync'](this,_0x454af4[_0x18ce('0x19f')],_0x9e34ed);return this[_0x18ce('0x37')]['noop'](_0x18ce('0x1a0'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1a1')]=function(_0x31964c){logger['info'](util['format'](_0x18ce('0x1a2'),_0x31964c[_0x18ce('0x39')]));return this[_0x18ce('0x37')]['noop'](_0x18ce('0x1a3'));};AGIVertices['prototype'][_0x18ce('0x1a4')]=function(_0x39d036){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x1a5'),_0x39d036['label']));if(!this[_0x18ce('0x88')](_0x39d036[_0x18ce('0x1a6')])){return this[_0x18ce('0x37')]['noop'](_0x18ce('0x1a7'));}var _0x5305cb=this[_0x18ce('0x33')]['sync'](this,_0x39d036['sms_account_id']);if(!_0x5305cb){return this[_0x18ce('0x37')]['error'](_0x39d036,_0x18ce('0x1a8'));}var _0x362b2d={'body':_0x39d036['sms_text'],'phone':_0x39d036['to']||'','SmsAccountId':_0x5305cb['id']};logger[_0x18ce('0x1a9')](_0x18ce('0x1aa'),JSON[_0x18ce('0x77')](_0x362b2d));this['createSquareDetailsReport'][_0x18ce('0x73')](this,_0x39d036,_0x39d036[_0x18ce('0x1a6')]);this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x1ab'),_0x5305cb[_0x18ce('0x17')]));this[_0x18ce('0x35')][_0x18ce('0x73')](this,_0x362b2d);return this['channel']['noop'](_0x18ce('0x1ac'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1ad')]=function(_0x4f93ae){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4f93ae['label']));if(!this[_0x18ce('0x88')](_0x4f93ae[_0x18ce('0xda')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x4f93ae,_0x18ce('0x1ae'));}var _0x516196=this[_0x18ce('0x14')][_0x18ce('0x73')](this,_0x4f93ae[_0x18ce('0xda')]);if(!_0x516196){return this[_0x18ce('0x37')]['error'](_0x4f93ae,'no\x20variable\x20found');}return this[_0x18ce('0x37')][_0x18ce('0xa2')](_0x516196,_0x4f93ae[_0x18ce('0x1af')]);};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1b0')]=function(_0x39c538){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x1b1'),_0x39c538[_0x18ce('0x39')]));this[_0x18ce('0x37')]['noop'](_0x18ce('0x1b2'));var _0x14a641=this[_0x18ce('0x37')][_0x18ce('0x14')](_0x18ce('0x1b3'));if(!_[_0x18ce('0x47')](_0x14a641['extra'])){this[_0x18ce('0x37')][_0x18ce('0x38')]=_0x14a641[_0x18ce('0xa6')];}if(_0x39c538['answer']===_0x18ce('0x1b4')){this[_0x18ce('0x37')]['noop'](_0x18ce('0x1b5'));return this[_0x18ce('0x37')][_0x18ce('0xbd')]();}return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0x1b6'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1b7')]=function(_0x544d5e){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x1b8'),_0x544d5e[_0x18ce('0x39')]));if(!this[_0x18ce('0x88')](_0x544d5e[_0x18ce('0x1b9')])){return this['channel'][_0x18ce('0x2c')](_0x544d5e,_0x18ce('0x1ba'));}var _0x85e6a0=this[_0x18ce('0x1bb')]['sync'](this,_0x544d5e[_0x18ce('0x1b9')]);if(!this[_0x18ce('0x88')](_0x85e6a0)){return this[_0x18ce('0x37')]['error'](_0x544d5e,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x544d5e[_0x18ce('0x1b9')]));}if(_0x85e6a0===this[_0x18ce('0x37')]['arg_1']){return this[_0x18ce('0x37')]['error'](_0x544d5e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x18ce('0x73')](this,_0x544d5e,_0x85e6a0);var _0x200182=this['channel'][_0x18ce('0x5b')]('AGI',util[_0x18ce('0x28')](_0x18ce('0x1bc'),config[_0x18ce('0x9')]['host']||_0x18ce('0x1bd'),_0x85e6a0,this[_0x18ce('0x37')][_0x18ce('0x3b')]));if(_0x200182['result']===-0x1){return _0x200182;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xc8'),_0x18ce('0x1be'),_0x85e6a0));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1bf')]=function(_0x15463e){logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x1c0'),_0x15463e[_0x18ce('0x39')]));var _0x130e5e=this[_0x18ce('0x5a')]['sync'](this,_0x15463e[_0x18ce('0xbb')]);this[_0x18ce('0x36')]['sync'](this,_0x15463e,_0x15463e[_0x18ce('0xbb')]);if(this['isConfigured'](_0x15463e['variable_id'])){var _0x2bbe76=this['getVariable']['sync'](this,_0x15463e[_0x18ce('0xda')]);if(_0x2bbe76){this['channel'][_0x18ce('0xa2')](_0x2bbe76,_0x130e5e);return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x1c1'),_0x15463e[_0x18ce('0xbb')],_0x2bbe76));}}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x1c2'),_0x15463e[_0x18ce('0xbb')]));};AGIVertices[_0x18ce('0x13')]['google_cloud_tts']=function(_0x5827e3){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x1c3'),_0x5827e3[_0x18ce('0x39')]));_0x5827e3['text']=_0x5827e3[_0x18ce('0x60')][_0x18ce('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x18ce('0x88')](_0x5827e3['apiKey'])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0x1c4'));}if(!this[_0x18ce('0x88')](_0x5827e3[_0x18ce('0x60')])){return this[_0x18ce('0x37')]['noop'](_0x18ce('0xad'));}this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x1c5'),_0x5827e3[_0x18ce('0x60')]));var _0x675ad7=this[_0x18ce('0x5e')]['sync'](this,_0x5827e3);if(_0x675ad7){this[_0x18ce('0x37')][_0x18ce('0xaf')](util['format'](_0x18ce('0x1c6'),_0x675ad7));var _0x28c92e=this[_0x18ce('0x37')]['streamFile'](_0x675ad7);try{fs['unlink'](_0x675ad7+'.wav');}catch(_0xb1a04c){logger[_0x18ce('0x2c')](_0xb1a04c);}return _0x28c92e;}return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x5827e3,_0x18ce('0x1c7'));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1c8')]=function(_0x5db6ab){logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x1c9'),_0x5db6ab['label']));_0x5db6ab[_0x18ce('0x60')]=_0x5db6ab[_0x18ce('0x60')][_0x18ce('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x18ce('0x88')](_0x5db6ab[_0x18ce('0x60')])){return this[_0x18ce('0x37')][_0x18ce('0xaf')](_0x18ce('0xad'));}this['channel']['noop'](util[_0x18ce('0x28')](_0x18ce('0x1ca'),_0x5db6ab[_0x18ce('0x60')]));var _0x4728cc=this[_0x18ce('0x66')][_0x18ce('0x73')](this,_0x5db6ab);if(_0x4728cc){this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x1cb'),_0x4728cc));var _0x20583a=this[_0x18ce('0x37')][_0x18ce('0x12a')](_0x4728cc);try{fs[_0x18ce('0x106')](_0x4728cc+_0x18ce('0x12b'));}catch(_0x2cda53){logger[_0x18ce('0x2c')](_0x2cda53);}return _0x20583a;}return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x5db6ab,_0x18ce('0x1cc'));};AGIVertices[_0x18ce('0x13')]['unpause']=function(_0x2f4edf){logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x1cd'),_0x2f4edf['label']));if(!this[_0x18ce('0x88')](_0x2f4edf[_0x18ce('0x15f')])){return this['channel'][_0x18ce('0x2c')](_0x2f4edf,'no\x20find\x20by\x20configured');}logger[_0x18ce('0x2e')](util['format'](_0x18ce('0x161'),this['channel'][_0x18ce('0x3d')],_0x2f4edf['findBy']));var _0xef74cc=this[_0x18ce('0x55')][_0x18ce('0x73')](this,_0x2f4edf['findBy']);if(_0xef74cc){logger[_0x18ce('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x2f4edf[_0x18ce('0x15f')]));this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x162'),this['channel']['callerid'],_0x2f4edf['findBy']));return{'code':0xc8,'result':_0x18ce('0x163')};}else{logger[_0x18ce('0x2e')](util[_0x18ce('0x28')](_0x18ce('0x164'),this['channel'][_0x18ce('0x3d')],_0x2f4edf[_0x18ce('0x15f')]));this['channel'][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0x164'),this[_0x18ce('0x37')][_0x18ce('0x3d')],_0x2f4edf[_0x18ce('0x15f')]));return{'code':0xc8,'result':_0x18ce('0x167')};}};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1ce')]=function(_0x210ce5){logger['info'](util['format'](_0x18ce('0x1cf'),_0x210ce5[_0x18ce('0x39')]));var _0x585f66=this[_0x18ce('0x37')][_0x18ce('0x5b')](_0x18ce('0x1d0'),[_0x210ce5[_0x18ce('0x1d1')],_0x210ce5[_0x18ce('0x7b')]]);if(_0x585f66['result']===-0x1){return _0x585f66;}return this[_0x18ce('0x37')][_0x18ce('0xaf')](util[_0x18ce('0x28')](_0x18ce('0xc8'),_0x18ce('0x1d0'),_0x210ce5[_0x18ce('0x1d1')]));};AGIVertices[_0x18ce('0x13')][_0x18ce('0x1d2')]=function(_0x153280){logger['info'](util[_0x18ce('0x28')](_0x18ce('0x1d3'),_0x153280[_0x18ce('0x39')]));if(!this['isConfigured'](_0x153280[_0x18ce('0xda')])){return this[_0x18ce('0x37')][_0x18ce('0x2c')](_0x153280,'no\x20variable\x20selected');}var _0x159a6e=this[_0x18ce('0x14')][_0x18ce('0x73')](this,_0x153280[_0x18ce('0xda')]);if(!_0x159a6e){return this['channel']['error'](_0x153280,'no\x20variable\x20found');}var _0x23d772=this[_0x18ce('0x37')][_0x18ce('0x14')](_0x159a6e);return{'code':0xc8,'result':_0x23d772[_0x18ce('0xa6')]?_0x23d772[_0x18ce('0xa6')]:'-'};};String[_0x18ce('0x13')][_0x18ce('0xa5')]=function(_0x2e61fc,_0x45a25a){return this[_0x18ce('0xa4')](_0x2e61fc)['join'](_0x45a25a);};module[_0x18ce('0x1d4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 498e3b5..3924c91 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 _0xa215=['prototype','interface','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds'];(function(_0x5aaa83,_0x199263){var _0x393d10=function(_0x1a59cc){while(--_0x1a59cc){_0x5aaa83['push'](_0x5aaa83['shift']());}};_0x393d10(++_0x199263);}(_0xa215,0x1ec));var _0x5a21=function(_0x1bb11e,_0x58fd78){_0x1bb11e=_0x1bb11e-0x0;var _0x422492=_0xa215[_0x1bb11e];return _0x422492;};'use strict';var _=require(_0x5a21('0x0'));var moment=require('moment');var ami=require(_0x5a21('0x1'));var logger=require(_0x5a21('0x2'))('acw');var RpcUser=require(_0x5a21('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x55adfb){this[_0x5a21('0x4')]=_0x55adfb['voiceQueues'];this[_0x5a21('0x5')]=_0x55adfb[_0x5a21('0x5')];this[_0x5a21('0x6')]=_0x55adfb['timers'];this[_0x5a21('0x7')]={};ami['on'](_0x5a21('0x8'),this[_0x5a21('0x9')][_0x5a21('0xa')](this));ami['on'](_0x5a21('0xb'),this[_0x5a21('0xc')][_0x5a21('0xa')](this));ami['on'](_0x5a21('0xd'),this[_0x5a21('0xe')][_0x5a21('0xa')](this));ami['on'](_0x5a21('0xf'),this['syncAgentRingNoAnswer'][_0x5a21('0xa')](this));ami['on'](_0x5a21('0x10'),this[_0x5a21('0x11')][_0x5a21('0xa')](this));ami['on'](_0x5a21('0x12'),this[_0x5a21('0x13')]['bind'](this));ami['on'](_0x5a21('0x14'),this[_0x5a21('0x15')][_0x5a21('0xa')](this));}function getDiff(_0x20aba4){var _0x181c76=moment()[_0x5a21('0x16')](0x0);var _0x167abf=moment(_0x20aba4)[_0x5a21('0x16')](0x0);return _0x181c76['diff'](_0x167abf,_0x5a21('0x17'));}Acw[_0x5a21('0x18')]['startAcw']=function(_0x146c03){try{var _0x269036=this;var _0x3cb4fc=this[_0x5a21('0x7')][_0x146c03][_0x5a21('0x19')];var _0x37bbce=this[_0x5a21('0x7')][_0x146c03]['queue'];var _0x2d06da=this[_0x5a21('0x4')][_0x37bbce];var _0x16d432=![];var _0xab85d7='ACW';if(_0x2d06da[_0x5a21('0x1a')]){if(_0x2d06da['mandatoryDispositionPause'][_0x5a21('0x1b')]){_0x16d432=!![];_0xab85d7=_0x2d06da[_0x5a21('0x1c')]['name'];}}return ami[_0x5a21('0x1d')]({'action':_0x5a21('0x1e'),'interface':_0x3cb4fc,'paused':!![],'reason':_0xab85d7})[_0x5a21('0x1f')](function(){if(_0x269036[_0x5a21('0x5')][_0x3cb4fc]){return RpcUser[_0x5a21('0x20')](_0x269036[_0x5a21('0x5')][_0x3cb4fc]['id'])[_0x5a21('0x1f')](function(_0x3b8cd3){if(_0x3b8cd3&&!_0x3b8cd3[_0x5a21('0x21')]){logger[_0x5a21('0x22')](_0x5a21('0x23'),_0x146c03,_0x3cb4fc,_0x37bbce);var _0xa3fdb4=_0x269036[_0x5a21('0x7')][_0x146c03]['attended']&&_0x269036[_0x5a21('0x7')][_0x146c03][_0x5a21('0x24')]?_0x269036[_0x5a21('0x7')][_0x146c03][_0x5a21('0x24')]:_0x146c03;return RpcUser[_0x5a21('0x25')](_0x269036['agents'][_0x3cb4fc],_0xab85d7,_0xa3fdb4)[_0x5a21('0x1f')](function(){if(!_0x16d432){_0x269036[_0x5a21('0x6')][_0x3cb4fc]={};logger[_0x5a21('0x22')](_0x5a21('0x26'),_0x146c03,_0x269036[_0x5a21('0x4')][_0x37bbce][_0x5a21('0x27')],_0x3cb4fc,_0x37bbce);_0x269036[_0x5a21('0x6')][_0x3cb4fc][_0x5a21('0x28')]=setTimeout(_0x269036['stopAcw']['bind'](_0x269036,_0x3cb4fc),_0x269036[_0x5a21('0x4')][_0x37bbce][_0x5a21('0x27')]*0x3e8);_0x269036[_0x5a21('0x6')][_0x3cb4fc][_0x5a21('0x29')]=moment()[_0x5a21('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x269036[_0x5a21('0x6')][_0x3cb4fc][_0x5a21('0x2b')]=_0x146c03;_0x269036[_0x5a21('0x6')][_0x3cb4fc][_0x5a21('0x2c')]=_0x37bbce;_0x269036['timers'][_0x3cb4fc][_0x5a21('0x2d')]=function(){var _0x17d364=getDiff(_0x269036[_0x5a21('0x6')][_0x3cb4fc][_0x5a21('0x29')]);clearTimeout(_0x269036['timers'][_0x3cb4fc][_0x5a21('0x28')]);_0x269036[_0x5a21('0x6')][_0x3cb4fc][_0x5a21('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x17d364},_0x269036['timers'][_0x3cb4fc]['uniqueid'],_0x3cb4fc)[_0x5a21('0x1f')](function(_0x58525c){logger[_0x5a21('0x22')](_0x5a21('0x2e'),_0x146c03,_0x17d364,_0x58525c);})[_0x5a21('0x2f')](function(_0x399bce){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x146c03,_0x399bce);});delete _0x269036[_0x5a21('0x6')][_0x3cb4fc];};}});}else{logger[_0x5a21('0x22')](_0x5a21('0x30'),_0x146c03,_0x3cb4fc,_0x37bbce);}});}})[_0x5a21('0x2f')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x146c03,_0x269036['voiceQueues'][_0x37bbce]['acwTimeout'],_0x3cb4fc,_0x37bbce);})[_0x5a21('0x31')](function(){delete _0x269036[_0x5a21('0x7')][_0x146c03];});}catch(_0x258895){logger[_0x5a21('0x32')](_0x5a21('0x33'),_0x258895[_0x5a21('0x34')]);}};Acw[_0x5a21('0x18')][_0x5a21('0x35')]=function(_0x33b094){try{var _0x1c1af8=this;if(_0x1c1af8['timers'][_0x33b094]){_0x1c1af8[_0x5a21('0x6')][_0x33b094][_0x5a21('0x28')]=![];var _0x267e16=_0x1c1af8['timers'][_0x33b094]['uniqueid'];var _0x254b47=_0x1c1af8[_0x5a21('0x6')][_0x33b094]['queue'];var _0x33865b=_0x1c1af8[_0x5a21('0x4')][_0x254b47][_0x5a21('0x27')];logger['info'](_0x5a21('0x36'),_0x267e16,_0x33b094);RpcUser[_0x5a21('0x37')](this['agents'][_0x33b094]);RpcVoiceAgentReport['update']({'acwtime':_0x33865b,'agentacw':!![]},_0x267e16,_0x33b094)[_0x5a21('0x1f')](function(_0x4073e4){logger[_0x5a21('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x267e16,_0x33865b,_0x4073e4);})[_0x5a21('0x2f')](function(_0x17735d){logger[_0x5a21('0x32')](_0x5a21('0x38'),_0x267e16,_0x17735d);});}else{logger[_0x5a21('0x32')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x33b094);if(_0x1c1af8[_0x5a21('0x6')]){logger[_0x5a21('0x22')](_0x5a21('0x39'),JSON[_0x5a21('0x3a')](_0x1c1af8[_0x5a21('0x6')]));}}}catch(_0x3daee1){logger['error'](_0x5a21('0x3b'),_0x3daee1[_0x5a21('0x34')]);}};Acw['prototype'][_0x5a21('0x9')]=function(_0x30f4b6){try{if(this[_0x5a21('0x4')][_0x30f4b6[_0x5a21('0x2c')]]&&(this['voiceQueues'][_0x30f4b6[_0x5a21('0x2c')]]['acw']||this['voiceQueues'][_0x30f4b6['queue']]['mandatoryDisposition'])){if(this[_0x5a21('0x5')][_0x30f4b6[_0x5a21('0x19')]]){this['channels'][_0x30f4b6[_0x5a21('0x2b')]]={'queue':_0x30f4b6[_0x5a21('0x2c')],'interface':_0x30f4b6[_0x5a21('0x19')],'destlinkedid':_0x30f4b6[_0x5a21('0x24')]};}}}catch(_0x16effc){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x16effc[_0x5a21('0x34')]);}};Acw[_0x5a21('0x18')][_0x5a21('0x15')]=function(_0x4dc458){try{if(this[_0x5a21('0x4')][_0x4dc458[_0x5a21('0x2c')]]&&(this['voiceQueues'][_0x4dc458[_0x5a21('0x2c')]][_0x5a21('0x3c')]||this[_0x5a21('0x4')][_0x4dc458[_0x5a21('0x2c')]][_0x5a21('0x1a')])){if(this[_0x5a21('0x5')][_0x4dc458['interface']]){this[_0x5a21('0x7')][_0x4dc458['uniqueid']]={'queue':_0x4dc458[_0x5a21('0x2c')],'interface':_0x4dc458[_0x5a21('0x19')]};}}}catch(_0x3d14f4){logger[_0x5a21('0x32')](_0x5a21('0x3d'),_0x3d14f4['message']);}};Acw[_0x5a21('0x18')][_0x5a21('0xc')]=function(_0x3f4bc1){try{if(this[_0x5a21('0x7')][_0x3f4bc1[_0x5a21('0x2b')]]&&_[_0x5a21('0x3e')](this[_0x5a21('0x7')][_0x3f4bc1[_0x5a21('0x2b')]][_0x5a21('0x3f')])){logger[_0x5a21('0x22')](_0x5a21('0x40'),_0x3f4bc1[_0x5a21('0x2b')]);this['startAcw'](_0x3f4bc1['uniqueid']);}else if(this['channels'][_0x3f4bc1[_0x5a21('0x41')]]&&_[_0x5a21('0x3e')](this[_0x5a21('0x7')][_0x3f4bc1['linkedid']][_0x5a21('0x3f')])){logger[_0x5a21('0x22')](_0x5a21('0x42'),_0x3f4bc1[_0x5a21('0x41')]);this[_0x5a21('0x43')](_0x3f4bc1[_0x5a21('0x41')]);}}catch(_0x569f02){logger[_0x5a21('0x32')](_0x5a21('0x44'),_0x569f02['message']);}};Acw[_0x5a21('0x18')]['syncHangup']=function(_0x464aaf){try{if(this[_0x5a21('0x7')][_0x464aaf[_0x5a21('0x2b')]]&&this[_0x5a21('0x7')][_0x464aaf['uniqueid']]['attended']){logger[_0x5a21('0x22')](_0x5a21('0x45'),_0x464aaf[_0x5a21('0x2b')]);this[_0x5a21('0x43')](_0x464aaf[_0x5a21('0x2b')]);}else if(this[_0x5a21('0x7')][_0x464aaf[_0x5a21('0x41')]]&&this[_0x5a21('0x7')][_0x464aaf['linkedid']][_0x5a21('0x3f')]){logger[_0x5a21('0x22')](_0x5a21('0x46'),_0x464aaf[_0x5a21('0x41')]);this[_0x5a21('0x43')](_0x464aaf['linkedid']);}}catch(_0x42e7f2){logger[_0x5a21('0x32')](_0x5a21('0x47'),_0x42e7f2[_0x5a21('0x34')]);}};Acw[_0x5a21('0x18')][_0x5a21('0x11')]=function(_0x2dca30){try{if(!_['isNil'](this[_0x5a21('0x7')][_0x2dca30['transfereeuniqueid']])){this[_0x5a21('0x43')](_0x2dca30[_0x5a21('0x48')]);if(this[_0x5a21('0x7')][_0x2dca30['secondtransfereruniqueid']]){this[_0x5a21('0x7')][_0x2dca30[_0x5a21('0x49')]][_0x5a21('0x3f')]=!![];this[_0x5a21('0x7')][_0x2dca30[_0x5a21('0x4a')]]=this['channels'][_0x2dca30[_0x5a21('0x49')]];delete this['channels'][_0x2dca30[_0x5a21('0x49')]];}}else if(!_[_0x5a21('0x4b')](this[_0x5a21('0x7')][_0x2dca30[_0x5a21('0x4a')]])){this[_0x5a21('0x43')](_0x2dca30[_0x5a21('0x4a')]);if(this[_0x5a21('0x7')][_0x2dca30[_0x5a21('0x4c')]]){this['channels'][_0x2dca30[_0x5a21('0x4c')]][_0x5a21('0x3f')]=!![];this[_0x5a21('0x7')][_0x2dca30['transfereeuniqueid']]=this[_0x5a21('0x7')][_0x2dca30['origtransfereruniqueid']];delete this[_0x5a21('0x7')][_0x2dca30[_0x5a21('0x4c')]];}}}catch(_0x41830e){logger[_0x5a21('0x32')](_0x5a21('0x4d'),_0x41830e[_0x5a21('0x34')]);}};Acw['prototype'][_0x5a21('0x13')]=function(_0x1a3f21){try{if(this['channels'][_0x1a3f21[_0x5a21('0x4e')]]){logger[_0x5a21('0x22')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x5a21('0x3a')](_0x1a3f21[_0x5a21('0x4e')]));this[_0x5a21('0x43')](_0x1a3f21[_0x5a21('0x4e')]);}else if(this[_0x5a21('0x7')][_0x1a3f21[_0x5a21('0x4f')]]){logger[_0x5a21('0x22')](_0x5a21('0x50'),JSON['stringify'](_0x1a3f21[_0x5a21('0x4f')]));this[_0x5a21('0x43')](_0x1a3f21[_0x5a21('0x4f')]);}}catch(_0x267e51){logger[_0x5a21('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x267e51[_0x5a21('0x34')]);}};Acw[_0x5a21('0x18')][_0x5a21('0x51')]=function(_0x59d2f7){try{if(this[_0x5a21('0x4')][_0x59d2f7[_0x5a21('0x2c')]]&&this['voiceQueues'][_0x59d2f7[_0x5a21('0x2c')]]['autopause']===_0x5a21('0x52')){if(this[_0x5a21('0x5')][_0x59d2f7[_0x5a21('0x19')]]){logger[_0x5a21('0x22')](_0x5a21('0x53'),_0x59d2f7['uniqueid'],_0x59d2f7['interface'],_0x59d2f7[_0x5a21('0x2c')]);return RpcUser['savePause'](this[_0x5a21('0x5')][_0x59d2f7[_0x5a21('0x19')]],_0x5a21('0x54'),_0x59d2f7['uniqueid']);}}}catch(_0x4b1373){logger['error'](_0x5a21('0x55'),_0x4b1373[_0x5a21('0x34')]);}};module['exports']=Acw; \ No newline at end of file +var _0xfd99=['format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','interface','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','../ami','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','queue','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt'];(function(_0x53b583,_0x46da71){var _0x1fad0e=function(_0x23ae2c){while(--_0x23ae2c){_0x53b583['push'](_0x53b583['shift']());}};_0x1fad0e(++_0x46da71);}(_0xfd99,0x173));var _0x9fd9=function(_0x3b6f8e,_0x2f26b2){_0x3b6f8e=_0x3b6f8e-0x0;var _0x1b5a90=_0xfd99[_0x3b6f8e];return _0x1b5a90;};'use strict';var _=require(_0x9fd9('0x0'));var moment=require('moment');var ami=require(_0x9fd9('0x1'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x9fd9('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x23e280){this[_0x9fd9('0x3')]=_0x23e280[_0x9fd9('0x3')];this[_0x9fd9('0x4')]=_0x23e280[_0x9fd9('0x4')];this[_0x9fd9('0x5')]=_0x23e280[_0x9fd9('0x5')];this[_0x9fd9('0x6')]={};ami['on'](_0x9fd9('0x7'),this[_0x9fd9('0x8')][_0x9fd9('0x9')](this));ami['on'](_0x9fd9('0xa'),this[_0x9fd9('0xb')][_0x9fd9('0x9')](this));ami['on'](_0x9fd9('0xc'),this[_0x9fd9('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x9fd9('0xe')][_0x9fd9('0x9')](this));ami['on'](_0x9fd9('0xf'),this[_0x9fd9('0x10')][_0x9fd9('0x9')](this));ami['on'](_0x9fd9('0x11'),this[_0x9fd9('0x12')][_0x9fd9('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0x9fd9('0x13')][_0x9fd9('0x9')](this));}function getDiff(_0x52a8fe){var _0x3ceb35=moment()['milliseconds'](0x0);var _0x1432d3=moment(_0x52a8fe)[_0x9fd9('0x14')](0x0);return _0x3ceb35[_0x9fd9('0x15')](_0x1432d3,'seconds');}Acw[_0x9fd9('0x16')][_0x9fd9('0x17')]=function(_0x1e8668){try{var _0x14aae4=this;var _0x1393c=this[_0x9fd9('0x6')][_0x1e8668]['interface'];var _0x69cc99=this[_0x9fd9('0x6')][_0x1e8668][_0x9fd9('0x18')];var _0x1b3f5b=this[_0x9fd9('0x3')][_0x69cc99];var _0x350200=![];var _0x128a8a='ACW';if(_0x1b3f5b['mandatoryDisposition']){if(_0x1b3f5b[_0x9fd9('0x19')][_0x9fd9('0x1a')]){_0x350200=!![];_0x128a8a=_0x1b3f5b[_0x9fd9('0x19')][_0x9fd9('0x1a')];}}return ami[_0x9fd9('0x1b')]({'action':_0x9fd9('0x1c'),'interface':_0x1393c,'paused':!![],'reason':_0x128a8a})[_0x9fd9('0x1d')](function(){if(_0x14aae4['agents'][_0x1393c]){return RpcUser['getAgent'](_0x14aae4[_0x9fd9('0x4')][_0x1393c]['id'])[_0x9fd9('0x1d')](function(_0x55ee10){if(_0x55ee10&&!_0x55ee10[_0x9fd9('0x1e')]){logger[_0x9fd9('0x1f')](_0x9fd9('0x20'),_0x1e8668,_0x1393c,_0x69cc99);var _0x2608dd=_0x14aae4['channels'][_0x1e8668]['attended']&&_0x14aae4['channels'][_0x1e8668]['destlinkedid']?_0x14aae4[_0x9fd9('0x6')][_0x1e8668][_0x9fd9('0x21')]:_0x1e8668;return RpcUser['savePause'](_0x14aae4[_0x9fd9('0x4')][_0x1393c],_0x128a8a,_0x2608dd)[_0x9fd9('0x1d')](function(){if(!_0x350200){_0x14aae4['timers'][_0x1393c]={};logger[_0x9fd9('0x1f')](_0x9fd9('0x22'),_0x1e8668,_0x14aae4[_0x9fd9('0x3')][_0x69cc99]['acwTimeout'],_0x1393c,_0x69cc99);_0x14aae4[_0x9fd9('0x5')][_0x1393c][_0x9fd9('0x23')]=setTimeout(_0x14aae4[_0x9fd9('0x24')]['bind'](_0x14aae4,_0x1393c),_0x14aae4['voiceQueues'][_0x69cc99][_0x9fd9('0x25')]*0x3e8);_0x14aae4[_0x9fd9('0x5')][_0x1393c][_0x9fd9('0x26')]=moment()[_0x9fd9('0x27')](_0x9fd9('0x28'));_0x14aae4[_0x9fd9('0x5')][_0x1393c][_0x9fd9('0x29')]=_0x1e8668;_0x14aae4['timers'][_0x1393c][_0x9fd9('0x18')]=_0x69cc99;_0x14aae4[_0x9fd9('0x5')][_0x1393c][_0x9fd9('0x2a')]=function(){var _0x298627=getDiff(_0x14aae4[_0x9fd9('0x5')][_0x1393c][_0x9fd9('0x26')]);clearTimeout(_0x14aae4[_0x9fd9('0x5')][_0x1393c]['timer']);_0x14aae4[_0x9fd9('0x5')][_0x1393c]['timer']=![];RpcVoiceAgentReport[_0x9fd9('0x2b')]({'acwtime':_0x298627},_0x14aae4[_0x9fd9('0x5')][_0x1393c][_0x9fd9('0x29')],_0x1393c)[_0x9fd9('0x1d')](function(_0x295ed4){logger[_0x9fd9('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x1e8668,_0x298627,_0x295ed4);})['catch'](function(_0x584865){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1e8668,_0x584865);});delete _0x14aae4['timers'][_0x1393c];};}});}else{logger['info'](_0x9fd9('0x2c'),_0x1e8668,_0x1393c,_0x69cc99);}});}})['catch'](function(){logger[_0x9fd9('0x2d')](_0x9fd9('0x22'),_0x1e8668,_0x14aae4[_0x9fd9('0x3')][_0x69cc99][_0x9fd9('0x25')],_0x1393c,_0x69cc99);})[_0x9fd9('0x2e')](function(){delete _0x14aae4[_0x9fd9('0x6')][_0x1e8668];});}catch(_0x3deea0){logger[_0x9fd9('0x2d')]('[ACW][START]\x20%s',_0x3deea0[_0x9fd9('0x2f')]);}};Acw['prototype']['stopAcw']=function(_0x634ce6){try{var _0x3149d3=this;if(_0x3149d3[_0x9fd9('0x5')][_0x634ce6]){_0x3149d3[_0x9fd9('0x5')][_0x634ce6][_0x9fd9('0x23')]=![];var _0x6c3a16=_0x3149d3[_0x9fd9('0x5')][_0x634ce6][_0x9fd9('0x29')];var _0x53382e=_0x3149d3[_0x9fd9('0x5')][_0x634ce6][_0x9fd9('0x18')];var _0x428a6d=_0x3149d3['voiceQueues'][_0x53382e][_0x9fd9('0x25')];logger['info'](_0x9fd9('0x30'),_0x6c3a16,_0x634ce6);RpcUser[_0x9fd9('0x31')](this['agents'][_0x634ce6]);RpcVoiceAgentReport[_0x9fd9('0x2b')]({'acwtime':_0x428a6d,'agentacw':!![]},_0x6c3a16,_0x634ce6)['then'](function(_0x11580f){logger[_0x9fd9('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x6c3a16,_0x428a6d,_0x11580f);})[_0x9fd9('0x32')](function(_0x19b4e2){logger[_0x9fd9('0x2d')](_0x9fd9('0x33'),_0x6c3a16,_0x19b4e2);});}else{logger['error'](_0x9fd9('0x34'),_0x634ce6);if(_0x3149d3[_0x9fd9('0x5')]){logger['info'](_0x9fd9('0x35'),JSON[_0x9fd9('0x36')](_0x3149d3[_0x9fd9('0x5')]));}}}catch(_0x521c36){logger[_0x9fd9('0x2d')](_0x9fd9('0x37'),_0x521c36[_0x9fd9('0x2f')]);}};Acw['prototype']['syncAgentConnect']=function(_0x4b743a){try{if(this[_0x9fd9('0x3')][_0x4b743a[_0x9fd9('0x18')]]&&(this[_0x9fd9('0x3')][_0x4b743a['queue']][_0x9fd9('0x38')]||this['voiceQueues'][_0x4b743a[_0x9fd9('0x18')]]['mandatoryDisposition'])){if(this[_0x9fd9('0x4')][_0x4b743a[_0x9fd9('0x39')]]){this['channels'][_0x4b743a['uniqueid']]={'queue':_0x4b743a[_0x9fd9('0x18')],'interface':_0x4b743a[_0x9fd9('0x39')],'destlinkedid':_0x4b743a['destlinkedid']};}}}catch(_0x31d693){logger[_0x9fd9('0x2d')](_0x9fd9('0x3a'),_0x31d693[_0x9fd9('0x2f')]);}};Acw[_0x9fd9('0x16')][_0x9fd9('0x13')]=function(_0x57c444){try{if(this[_0x9fd9('0x3')][_0x57c444[_0x9fd9('0x18')]]&&(this[_0x9fd9('0x3')][_0x57c444[_0x9fd9('0x18')]][_0x9fd9('0x38')]||this[_0x9fd9('0x3')][_0x57c444[_0x9fd9('0x18')]][_0x9fd9('0x3b')])){if(this[_0x9fd9('0x4')][_0x57c444[_0x9fd9('0x39')]]){this[_0x9fd9('0x6')][_0x57c444[_0x9fd9('0x29')]]={'queue':_0x57c444['queue'],'interface':_0x57c444[_0x9fd9('0x39')]};}}}catch(_0xa81500){logger[_0x9fd9('0x2d')]('[ACW][syncAgentConnectPreview]\x20%s',_0xa81500[_0x9fd9('0x2f')]);}};Acw[_0x9fd9('0x16')][_0x9fd9('0xb')]=function(_0x172118){try{if(this[_0x9fd9('0x6')][_0x172118['uniqueid']]&&_[_0x9fd9('0x3c')](this[_0x9fd9('0x6')][_0x172118[_0x9fd9('0x29')]][_0x9fd9('0x3d')])){logger[_0x9fd9('0x1f')](_0x9fd9('0x3e'),_0x172118['uniqueid']);this[_0x9fd9('0x17')](_0x172118[_0x9fd9('0x29')]);}else if(this[_0x9fd9('0x6')][_0x172118['linkedid']]&&_[_0x9fd9('0x3c')](this[_0x9fd9('0x6')][_0x172118[_0x9fd9('0x3f')]][_0x9fd9('0x3d')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x172118['linkedid']);this[_0x9fd9('0x17')](_0x172118[_0x9fd9('0x3f')]);}}catch(_0x4a8a74){logger[_0x9fd9('0x2d')](_0x9fd9('0x40'),_0x4a8a74[_0x9fd9('0x2f')]);}};Acw[_0x9fd9('0x16')][_0x9fd9('0xd')]=function(_0x59559c){try{if(this[_0x9fd9('0x6')][_0x59559c[_0x9fd9('0x29')]]&&this[_0x9fd9('0x6')][_0x59559c[_0x9fd9('0x29')]]['attended']){logger['info'](_0x9fd9('0x41'),_0x59559c[_0x9fd9('0x29')]);this[_0x9fd9('0x17')](_0x59559c[_0x9fd9('0x29')]);}else if(this[_0x9fd9('0x6')][_0x59559c['linkedid']]&&this[_0x9fd9('0x6')][_0x59559c[_0x9fd9('0x3f')]][_0x9fd9('0x3d')]){logger[_0x9fd9('0x1f')](_0x9fd9('0x42'),_0x59559c['linkedid']);this[_0x9fd9('0x17')](_0x59559c[_0x9fd9('0x3f')]);}}catch(_0x47af52){logger[_0x9fd9('0x2d')]('[ACW][syncHangup]\x20%s',_0x47af52[_0x9fd9('0x2f')]);}};Acw[_0x9fd9('0x16')][_0x9fd9('0x10')]=function(_0x3b737d){try{if(!_['isNil'](this[_0x9fd9('0x6')][_0x3b737d['transfereeuniqueid']])){this[_0x9fd9('0x17')](_0x3b737d[_0x9fd9('0x43')]);if(this[_0x9fd9('0x6')][_0x3b737d['secondtransfereruniqueid']]){this['channels'][_0x3b737d[_0x9fd9('0x44')]][_0x9fd9('0x3d')]=!![];this[_0x9fd9('0x6')][_0x3b737d['transfertargetuniqueid']]=this[_0x9fd9('0x6')][_0x3b737d[_0x9fd9('0x44')]];delete this[_0x9fd9('0x6')][_0x3b737d[_0x9fd9('0x44')]];}}else if(!_[_0x9fd9('0x45')](this['channels'][_0x3b737d[_0x9fd9('0x46')]])){this[_0x9fd9('0x17')](_0x3b737d['transfertargetuniqueid']);if(this[_0x9fd9('0x6')][_0x3b737d[_0x9fd9('0x47')]]){this[_0x9fd9('0x6')][_0x3b737d[_0x9fd9('0x47')]][_0x9fd9('0x3d')]=!![];this[_0x9fd9('0x6')][_0x3b737d[_0x9fd9('0x43')]]=this[_0x9fd9('0x6')][_0x3b737d['origtransfereruniqueid']];delete this[_0x9fd9('0x6')][_0x3b737d[_0x9fd9('0x47')]];}}}catch(_0x3d213b){logger[_0x9fd9('0x2d')](_0x9fd9('0x48'),_0x3d213b[_0x9fd9('0x2f')]);}};Acw[_0x9fd9('0x16')][_0x9fd9('0x12')]=function(_0x1d1e9f){try{if(this['channels'][_0x1d1e9f['transfereruniqueid']]){logger[_0x9fd9('0x1f')](_0x9fd9('0x49'),JSON[_0x9fd9('0x36')](_0x1d1e9f['transfereruniqueid']));this['startAcw'](_0x1d1e9f[_0x9fd9('0x4a')]);}else if(this[_0x9fd9('0x6')][_0x1d1e9f['transfererlinkedid']]){logger[_0x9fd9('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x1d1e9f[_0x9fd9('0x4b')]));this[_0x9fd9('0x17')](_0x1d1e9f[_0x9fd9('0x4b')]);}}catch(_0x5ea7c3){logger['error'](_0x9fd9('0x4c'),_0x5ea7c3[_0x9fd9('0x2f')]);}};Acw[_0x9fd9('0x16')][_0x9fd9('0xe')]=function(_0xcd9919){try{if(this[_0x9fd9('0x3')][_0xcd9919[_0x9fd9('0x18')]]&&this[_0x9fd9('0x3')][_0xcd9919[_0x9fd9('0x18')]][_0x9fd9('0x4d')]===_0x9fd9('0x4e')){if(this[_0x9fd9('0x4')][_0xcd9919['interface']]){logger[_0x9fd9('0x1f')](_0x9fd9('0x4f'),_0xcd9919[_0x9fd9('0x29')],_0xcd9919[_0x9fd9('0x39')],_0xcd9919[_0x9fd9('0x18')]);return RpcUser['savePause'](this[_0x9fd9('0x4')][_0xcd9919[_0x9fd9('0x39')]],_0x9fd9('0x50'),_0xcd9919['uniqueid']);}}}catch(_0x1e6cc5){logger[_0x9fd9('0x2d')](_0x9fd9('0x51'),_0x1e6cc5[_0x9fd9('0x2f')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 2aa4ed8..cc49b48 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 _0x1ce8=['coreshowchannels','once','close','connect','shutdown','info','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','catch','[ami.js][fullybooted]','exports','bluebird','util','ami','asterisk','port','username','password','Action','error','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x2ac5ac,_0x3f105e){var _0x55949c=function(_0x58c2c7){while(--_0x58c2c7){_0x2ac5ac['push'](_0x2ac5ac['shift']());}};_0x55949c(++_0x3f105e);}(_0x1ce8,0xae));var _0x81ce=function(_0x1231be,_0x6563a2){_0x1231be=_0x1231be-0x0;var _0x55a107=_0x1ce8[_0x1231be];return _0x55a107;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x81ce('0x0'));var util=require(_0x81ce('0x1'));var logger=require('../../config/logger')(_0x81ce('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x81ce('0x3')][_0x81ce('0x4')],config[_0x81ce('0x3')]['ip'],config[_0x81ce('0x3')][_0x81ce('0x5')],config[_0x81ce('0x3')][_0x81ce('0x6')],!![]);ami['keepConnected']();ami[_0x81ce('0x7')]=BPromise['promisify'](ami['action']);function error(_0xa3b8e3){logger[_0x81ce('0x8')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x81ce('0x3')][_0x81ce('0x5')],config[_0x81ce('0x3')]['ip'],config[_0x81ce('0x3')]['port'],util[_0x81ce('0x9')](_0xa3b8e3,![],null)));}function close(){logger['error'](util[_0x81ce('0xa')](_0x81ce('0xb'),config['asterisk'][_0x81ce('0x5')],config[_0x81ce('0x3')]['ip'],config[_0x81ce('0x3')]['port']));}ami[_0x81ce('0xc')]=function(){return function(){return ami['Action']({'action':_0x81ce('0xd')});};};ami[_0x81ce('0xe')]=function(){return function(){return ami[_0x81ce('0x7')]({'action':_0x81ce('0xf')});};};ami[_0x81ce('0x10')]=function(){return function(){return ami[_0x81ce('0x7')]({'action':_0x81ce('0x11')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x81ce('0x7')]({'action':_0x81ce('0x12')});};};function connect(){logger['info'](util[_0x81ce('0xa')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x81ce('0x5')],config[_0x81ce('0x3')]['ip'],config[_0x81ce('0x3')][_0x81ce('0x4')]));ami[_0x81ce('0x13')](_0x81ce('0x8'),error);ami[_0x81ce('0x13')](_0x81ce('0x14'),close);}ami['on'](_0x81ce('0x15'),connect);ami['on'](_0x81ce('0x16'),function(_0xf7b6b9){logger[_0x81ce('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x81ce('0x3')][_0x81ce('0x5')],config[_0x81ce('0x3')]['ip'],config[_0x81ce('0x3')]['port'],util[_0x81ce('0x9')](_0xf7b6b9,![],null)));});ami['on'](_0x81ce('0x18'),function(){logger[_0x81ce('0x17')](util[_0x81ce('0xa')](_0x81ce('0x19'),config[_0x81ce('0x3')][_0x81ce('0x5')],config[_0x81ce('0x3')]['ip'],config[_0x81ce('0x3')][_0x81ce('0x4')]));return Promise[_0x81ce('0x1a')]()[_0x81ce('0x1b')](ami[_0x81ce('0xc')]())['then'](ami['actionDeviceStateList']())['then'](ami[_0x81ce('0x10')]())[_0x81ce('0x1b')](ami[_0x81ce('0x1c')]())['then'](ami['actionCoreShowChannels']())[_0x81ce('0x1d')](function(_0x18f90b){logger[_0x81ce('0x8')](_0x81ce('0x1e'),util[_0x81ce('0x9')](_0x18f90b,{'showHidden':![],'depth':null}));});});ami[_0x81ce('0x13')](_0x81ce('0x8'),error);ami[_0x81ce('0x13')]('close',close);module[_0x81ce('0x1f')]=ami; \ No newline at end of file +var _0x0c00=['fullybooted','then','actionSipShowRegistry','actionDeviceStateList','[ami.js][fullybooted]','exports','bluebird','util','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','coreshowchannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x549d43,_0x1eac35){var _0x1d714b=function(_0x234a7a){while(--_0x234a7a){_0x549d43['push'](_0x549d43['shift']());}};_0x1d714b(++_0x1eac35);}(_0x0c00,0xed));var _0x00c0=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0c00[_0x3e44fa];return _0x2a0aba;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x00c0('0x0'));var util=require(_0x00c0('0x1'));var logger=require('../../config/logger')(_0x00c0('0x2'));var config=require(_0x00c0('0x3'));var ami=new Manager(config[_0x00c0('0x4')][_0x00c0('0x5')],config[_0x00c0('0x4')]['ip'],config[_0x00c0('0x4')][_0x00c0('0x6')],config[_0x00c0('0x4')]['password'],!![]);ami[_0x00c0('0x7')]();ami[_0x00c0('0x8')]=BPromise[_0x00c0('0x9')](ami['action']);function error(_0x20072d){logger[_0x00c0('0xa')](util[_0x00c0('0xb')](_0x00c0('0xc'),config[_0x00c0('0x4')][_0x00c0('0x6')],config[_0x00c0('0x4')]['ip'],config[_0x00c0('0x4')]['port'],util[_0x00c0('0xd')](_0x20072d,![],null)));}function close(){logger['error'](util[_0x00c0('0xb')](_0x00c0('0xe'),config[_0x00c0('0x4')][_0x00c0('0x6')],config[_0x00c0('0x4')]['ip'],config['asterisk'][_0x00c0('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x00c0('0x8')]({'action':_0x00c0('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x00c0('0x10')});};};ami[_0x00c0('0x11')]=function(){return function(){return ami[_0x00c0('0x8')]({'action':_0x00c0('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x00c0('0x8')]({'action':_0x00c0('0x13')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0x00c0('0x14')});};};function connect(){logger[_0x00c0('0x15')](util[_0x00c0('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x00c0('0x4')][_0x00c0('0x6')],config['asterisk']['ip'],config['asterisk'][_0x00c0('0x5')]));ami['once'](_0x00c0('0xa'),error);ami[_0x00c0('0x16')](_0x00c0('0x17'),close);}ami['on'](_0x00c0('0x18'),connect);ami['on'](_0x00c0('0x19'),function(_0x4d5ee5){logger[_0x00c0('0x15')](util[_0x00c0('0xb')](_0x00c0('0x1a'),config['asterisk'][_0x00c0('0x6')],config['asterisk']['ip'],config[_0x00c0('0x4')][_0x00c0('0x5')],util[_0x00c0('0xd')](_0x4d5ee5,![],null)));});ami['on'](_0x00c0('0x1b'),function(){logger[_0x00c0('0x15')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x00c0('0x4')][_0x00c0('0x6')],config[_0x00c0('0x4')]['ip'],config[_0x00c0('0x4')]['port']));return Promise['resolve']()[_0x00c0('0x1c')](ami[_0x00c0('0x1d')]())[_0x00c0('0x1c')](ami[_0x00c0('0x1e')]())[_0x00c0('0x1c')](ami[_0x00c0('0x11')]())[_0x00c0('0x1c')](ami['actionQueueSummary']())[_0x00c0('0x1c')](ami['actionCoreShowChannels']())['catch'](function(_0xeee06a){logger['error'](_0x00c0('0x1f'),util[_0x00c0('0xd')](_0xeee06a,{'showHidden':![],'depth':null}));});});ami[_0x00c0('0x16')](_0x00c0('0xa'),error);ami[_0x00c0('0x16')](_0x00c0('0x17'),close);module[_0x00c0('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 40772d2..8b07b43 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5c4d71,_0x627b4f){_0x5c4d71=_0x5c4d71-0x0;var _0xe11ec9=_0x9bde[_0x5c4d71];return _0xe11ec9;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c3b1b8f..2756ae7 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 _0xe174=['countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedRetryFrequency','verifyAdditionalPhones','countabandonedretry','add','Abandoned','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','rrmemory','locked','paused','stateinterface','isNil','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','countglobal','dialMachineMaxRetry','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','running','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','UserId','[emptyContact][createHistory]','[emptyContact]','checkPreviewRecallReminder','handlePreviewRecallNotifications','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','isOutboundQueue','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','updatedAt','%s%s','XMD-','toUpper','getCallerId','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','startMethodPredictive','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncQueueMember','then','previewRecallmeReminderInterval','type','outbound','debug','inspect','format','voice:queue:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','catch','all','some','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','undefined','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','booked','Queue','silly','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','isGlobal','queue','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2'];(function(_0x179b99,_0x3f150b){var _0x10977b=function(_0x4a1f8d){while(--_0x4a1f8d){_0x179b99['push'](_0x179b99['shift']());}};_0x10977b(++_0x3f150b);}(_0xe174,0x14a));var _0x4e17=function(_0x3d2f31,_0x475cff){_0x3d2f31=_0x3d2f31-0x0;var _0x105e92=_0xe174[_0x3d2f31];return _0x105e92;};'use strict';var util=require(_0x4e17('0x0'));var _=require(_0x4e17('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x4e17('0x2'));var utils=require('./utils');var hopperUtils=require(_0x4e17('0x3'));var ut=require(_0x4e17('0x4'));var config=require(_0x4e17('0x5'));var logger=require(_0x4e17('0x6'))(_0x4e17('0x7'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x4e17('0x6'))(_0x4e17('0x8'));var loggerPredictiveCalls=require(_0x4e17('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x4e17('0x6'))(_0x4e17('0x9'));var ami=require('../ami');config[_0x4e17('0xa')]=_[_0x4e17('0xb')](config[_0x4e17('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x4e17('0xc'))(new Redis(config[_0x4e17('0xa')]));var cmHopper=require(_0x4e17('0xd'));var voiceQueueRt=require(_0x4e17('0xe'));var RpcSetting=require(_0x4e17('0xf'));var Interval=require(_0x4e17('0x10'));var Action=require(_0x4e17('0x11'));var History=require(_0x4e17('0x12'));var Final=require(_0x4e17('0x13'));var AgentComplete=require(_0x4e17('0x14'));var QueueCallerAbandon=require(_0x4e17('0x15'));var Hangup=require(_0x4e17('0x16'));var ipAgi=process[_0x4e17('0x17')][_0x4e17('0x18')]||_0x4e17('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4e17('0x1a')]['enqueue']=function(_0x355b44){this[_0x4e17('0x1b')]=this['tail']?this[_0x4e17('0x1b')][_0x4e17('0x1c')](_0x355b44):_0x355b44();};function Dialer(_0x2b6fec,_0x34c7d4){this['sequence']=new Sequence();this[_0x4e17('0x1d')]=_0x34c7d4;this[_0x4e17('0x1e')]=_0x2b6fec[_0x4e17('0x1e')];this[_0x4e17('0x1f')]=_0x2b6fec[_0x4e17('0x1f')];this[_0x4e17('0x20')]=_0x2b6fec[_0x4e17('0x20')];this[_0x4e17('0x21')]=_0x2b6fec[_0x4e17('0x21')];this['maxNumberOriginate']=config[_0x4e17('0x22')]||0x2;this[_0x4e17('0x23')]={};this['actions']={};this[_0x4e17('0x24')]={};this[_0x4e17('0x25')]={};this[_0x4e17('0x26')]={};this['startPredictive']={};this[_0x4e17('0x27')]={};this['ivrOriginated']={};this[_0x4e17('0x28')]={};this[_0x4e17('0x29')]={};this[_0x4e17('0x2a')]={};ami['on']('agentconnect',this[_0x4e17('0x2b')][_0x4e17('0x2c')](this));ami['on']('queuecallerabandon',this[_0x4e17('0x2d')]['bind'](this));ami['on'](_0x4e17('0x2e'),this[_0x4e17('0x2f')][_0x4e17('0x2c')](this));ami['on'](_0x4e17('0x30'),this[_0x4e17('0x31')][_0x4e17('0x2c')](this));ami['on'](_0x4e17('0x32'),this[_0x4e17('0x9')][_0x4e17('0x2c')](this));ami['on'](_0x4e17('0x33'),this[_0x4e17('0x34')]['bind'](this));ami['on'](_0x4e17('0x35'),this[_0x4e17('0x36')][_0x4e17('0x2c')](this));ami['on'](_0x4e17('0x37'),this[_0x4e17('0x38')][_0x4e17('0x2c')](this));ami['on'](_0x4e17('0x39'),this['syncVarSet'][_0x4e17('0x2c')](this));ami['on']('queuemember',this[_0x4e17('0x3a')][_0x4e17('0x2c')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x4e17('0x2c')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x4e17('0x3b')](function(_0x5a475f){previewRecallmeReminderInterval=_0x5a475f[_0x4e17('0x3c')];});}function isNotNull(_0x18359c){return _0x18359c!==null&&!_['isUndefined'](_0x18359c);}function msgResponse(_0x2b87b7,_0x3597f6,_0x3be34c){return{'action':_0x2b87b7,'response':_0x3597f6,'message':_0x3be34c,'stack':_0x3be34c};}function emit(_0x5cad9f,_0x53840d,_0x2d0db4){io['to'](_0x5cad9f)['emit'](_0x53840d,_0x2d0db4);}function emitOutboundVoiceQueueSummary(_0x548cdf){if(_0x548cdf[_0x4e17('0x3d')]===_0x4e17('0x3e')){logger[_0x4e17('0x3f')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x4e17('0x40')](_0x548cdf,{'showHidden':![],'depth':null}));emit(util[_0x4e17('0x41')](_0x4e17('0x42'),_0x548cdf['name']),'voice_queue:save',_0x548cdf);}}function checkGetDataPredictive(_0x167941){if(isNotNull(_0x167941)&&!_[_0x4e17('0x43')](_0x167941)){loggerPredictive[_0x4e17('0x44')](_0x4e17('0x45'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x167941[_0x4e17('0x46')]);loggerPredictive['info'](_0x4e17('0x47'),_0x167941[_0x4e17('0x48')]);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x49'),_0x167941[_0x4e17('0x4a')]);loggerPredictive['info'](_0x4e17('0x4b'),_0x167941[_0x4e17('0x4c')]);loggerPredictive['info'](_0x4e17('0x4d'),_0x167941[_0x4e17('0x4e')]);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x4f'),_0x167941[_0x4e17('0x50')]);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x51'));if(_0x167941['predictiveIntervalTotalCalls']>0x0){if(!_[_0x4e17('0x52')](_0x167941[_0x4e17('0x50')])&&_0x167941['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x4e17('0x53'));if(!_['isUndefined'](_0x167941[_0x4e17('0x4e')])&&_0x167941[_0x4e17('0x4e')]>0x0){return!![];}loggerPredictive[_0x4e17('0x44')](_0x4e17('0x54'));}else{loggerPredictive[_0x4e17('0x44')](_0x4e17('0x55'));}}else{loggerPredictive[_0x4e17('0x44')](_0x4e17('0x56'));}return![];}function mergeDataErlangB(_0x1177cc){return function(_0x93a739){loggerPredictive[_0x4e17('0x44')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x4e17('0x57'),_0x93a739['erlangCalls']);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x58'),_0x93a739[_0x4e17('0x59')]);loggerPredictive[_0x4e17('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x93a739[_0x4e17('0x5a')]);loggerPredictive['info'](_0x4e17('0x5b'),_0x93a739[_0x4e17('0x5c')]);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x5d'),_0x93a739['erlangAbandonmentRate']);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x51'));_[_0x4e17('0x5e')](_0x1177cc,_0x93a739);};}function ifInterval(_0x4b548c,_0x4c656b){if(_[_0x4e17('0x52')](_0x4c656b)){return![];}return utils[_0x4e17('0x5f')](undefined,_0x4c656b)<_0x4b548c*0x3c;}function clearPredictiveAttributes(_0x1c0d56){if(_0x1c0d56[_0x4e17('0x27')]){_0x1c0d56['startProgressive']=undefined;loggerPredictive[_0x4e17('0x3f')](_0x1c0d56[_0x4e17('0x60')],_0x4e17('0x61'));}if(_0x1c0d56['startPredictive']){_0x1c0d56[_0x4e17('0x62')]=undefined;loggerPredictive[_0x4e17('0x3f')](_0x1c0d56[_0x4e17('0x60')],_0x4e17('0x63'));}if(_0x1c0d56[_0x4e17('0x64')]){clearInterval(_0x1c0d56['handlePredictive']);_0x1c0d56['handlePredictive']=undefined;loggerPredictive[_0x4e17('0x3f')](_0x1c0d56[_0x4e17('0x60')],_0x4e17('0x65'));}}function loggerCatchPredictive(_0x440f99,_0x5e1883){return function(_0x51ca1d){loggerPredictive[_0x4e17('0x66')](_0x5e1883[_0x4e17('0x60')],_0x440f99);loggerPredictive[_0x4e17('0x66')](_0x51ca1d[_0x4e17('0x67')]);clearPredictiveAttributes(_0x5e1883);};}function loggerCatch(_0x2a2081){return function(_0xd2608a){logger[_0x4e17('0x66')](_0x2a2081,util[_0x4e17('0x40')](_0xd2608a,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x37f67a,_0x2070e2,_0xe919c1){return function(_0x28b1a7){utils[_0x4e17('0x68')](_0x2070e2,_0xe919c1,0x0);logger['error'](_0x37f67a,util[_0x4e17('0x40')](_0x28b1a7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5e112f){return function(_0x49ca15){if(isNotNull(_0x49ca15)&&isNotNull(_0x49ca15[0x0])){if(_0x49ca15[0x0][_0x4e17('0x69')]>0x0){_0x5e112f[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x6c')];logger[_0x4e17('0x44')](_0x4e17('0x6d')+_0x5e112f[_0x4e17('0x60')],_0x49ca15[0x0][_0x4e17('0x69')],_0x4e17('0x6e'));}else{_0x5e112f[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x6f')];logger[_0x4e17('0x44')]('[getContactDialer2][Empty]'+_0x5e112f[_0x4e17('0x60')]);}}};}function createObjHistory(_0x354de4,_0x58d2ff,_0x2a6925,_0x1b6926,_0x3af14b){_0x354de4['message']=_0x2a6925;var _0x1e7b59=new Action(_0x354de4,_0x58d2ff);var _0xa165af=new History(_0x1e7b59);_0xa165af[_0x4e17('0x70')]=_0x1b6926;_0xa165af[_0x4e17('0x71')]=_0x3af14b;_0xa165af[_0x4e17('0x72')]=_0x1e7b59[_0x4e17('0x73')];return _0xa165af;}function unlockQueueStatus(_0x2ae3c7,_0x13c692){setTimeout(function(){if(_['isUndefined'](_0x2ae3c7[_0x4e17('0x74')])){loggerBooked[_0x4e17('0x66')]('[unlockQueueStatus][undefined]',_0x13c692);}_0x2ae3c7[_0x4e17('0x74')]=!![];loggerBooked[_0x4e17('0x44')](_0x4e17('0x75'),_0x13c692,JSON[_0x4e17('0x76')](_[_0x4e17('0x77')](_0x2ae3c7,[_0x4e17('0x60'),_0x4e17('0x74')])));},0x1f3);}function checkInterval(_0x3b3719){return function(){if(!isNotNull(_0x3b3719[_0x4e17('0x78')])){_0x3b3719[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x79')];throw _0x3b3719[_0x4e17('0x60')]+_0x4e17('0x7a');}if(!isNotNull(_0x3b3719['Interval'][_0x4e17('0x7b')])){_0x3b3719[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')]['NULL_INTERVAL'];throw _0x3b3719[_0x4e17('0x60')]+_0x4e17('0x7a');}if(!isNotNull(_[_0x4e17('0x43')](_0x3b3719[_0x4e17('0x78')][_0x4e17('0x7b')]))){_0x3b3719[_0x4e17('0x6a')]=utils['CAMPAIGN_STATUS'][_0x4e17('0x79')];throw _0x3b3719[_0x4e17('0x60')]+_0x4e17('0x7a');}};}function checkIsIVRCampaignActive(_0x167c52){return function(){if(!utils[_0x4e17('0x7c')](_0x167c52)){_0x167c52[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x7d')];throw _0x167c52[_0x4e17('0x60')]+_0x4e17('0x7e');}};}function emitCampaignSummary(_0x15ed19){if(utils[_0x4e17('0x7f')](_0x15ed19)){emit(util[_0x4e17('0x41')](_0x4e17('0x80'),_0x15ed19[_0x4e17('0x60')]),'campaign:save',_0x15ed19);}}function loggerCatchQueueSummary(_0x1c7a1f,_0x16740){return function(_0x18d0a2){clearPredictiveAttributes(_0x16740);emitCampaignSummary(_0x16740);loggerSyncQueueSummary[_0x4e17('0x3f')](_0x1c7a1f,util[_0x4e17('0x40')](_0x18d0a2,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x312a89){if(_0x312a89[_0x4e17('0x81')]){if(_0x312a89[_0x4e17('0x82')]===0x0){_0x312a89[_0x4e17('0x81')]=![];_0x312a89[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x7d')];loggerSyncQueueSummary[_0x4e17('0x3f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x312a89[_0x4e17('0x60')],_0x4e17('0x83'));}else{_0x312a89[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x84')];loggerSyncQueueSummary[_0x4e17('0x3f')](_0x4e17('0x85'),_0x312a89[_0x4e17('0x60')],_0x4e17('0x86'));}emitCampaignSummary(_0x312a89);}}function myreject(_0x324de6){return function(_0xb07557){return _0x324de6(msgResponse(_0x4e17('0x87'),_0x4e17('0x88'),JSON[_0x4e17('0x76')](_0xb07557)));};}Dialer['prototype'][_0x4e17('0x89')]=function(_0x5cd567){return!_[_0x4e17('0x52')](_0x5cd567)&&_0x5cd567&&!_[_0x4e17('0x52')](_0x5cd567[_0x4e17('0x60')])&&!_[_0x4e17('0x52')](_0x5cd567[_0x4e17('0x8a')])&&_0x5cd567[_0x4e17('0x8a')]&&(this[_0x4e17('0x21')][util[_0x4e17('0x41')](_0x4e17('0x8b'),_0x5cd567[_0x4e17('0x60')])]['status']===_0x4e17('0x8c')||this[_0x4e17('0x21')][util[_0x4e17('0x41')](_0x4e17('0x8b'),_0x5cd567[_0x4e17('0x60')])][_0x4e17('0x8d')]===_0x4e17('0x8e'));};Dialer[_0x4e17('0x1a')][_0x4e17('0x8f')]=function(_0x1ad7f8){var _0x58122f=this;return function(){if(!_0x58122f['isTrunkReachable'](_0x1ad7f8['Trunk'])){if(!_0x58122f[_0x4e17('0x89')](_0x1ad7f8[_0x4e17('0x90')])){_0x1ad7f8['message']=utils[_0x4e17('0x6b')][_0x4e17('0x91')];throw _0x1ad7f8['name']+_0x4e17('0x92');}}};};Dialer[_0x4e17('0x1a')][_0x4e17('0x93')]=function(_0xb894b8,_0x46ad91,_0x1e06ab,_0x1407d7){var _0x13b7d1=this;return function(){var _0x2503fb=!![];return _0x13b7d1[_0x4e17('0x94')](_0xb894b8,_0x46ad91,_0x1e06ab,_0x1407d7,_0x2503fb);};};Dialer[_0x4e17('0x1a')]['checkIfTimeIntervals']=function(_0x4a4185,_0x2294ee,_0x1f2436,_0x24ccc7){var _0x27a07a=this;return function(){var _0x30345e=![];return _0x27a07a[_0x4e17('0x94')](_0x4a4185[_0x4e17('0x7b')],_0x2294ee,_0x1f2436,_0x24ccc7,_0x30345e);};};Dialer[_0x4e17('0x1a')][_0x4e17('0x94')]=function(_0x33a191,_0xd6cde5,_0x2012d8,_0x3a739c,_0x496b27){var _0x4e27cb=[];return new Promise(function(_0xb2a985,_0x179f61){if(!isNotNull(_0x33a191)){_0x3a739c[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x79')];return _0x179f61(msgResponse(_0x4e17('0x95'),'Failure',_0x2012d8+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x4e17('0x43')](_0x33a191)){_0x3a739c[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x96')];return _0x179f61(msgResponse(_0x4e17('0x95'),'Failure',_0x2012d8+'\x20Intervals\x20is\x20empty\x20'));}if(_0xd6cde5&&_[_0x4e17('0x52')](config[_0x4e17('0x97')][_0xd6cde5])){_0x3a739c[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x98')];return _0x179f61(msgResponse('ifTime',_0x4e17('0x99'),_0x2012d8+_0x4e17('0x9a')+_0xd6cde5));}if(_[_0x4e17('0x9b')](_0x33a191)){for(var _0x33369d=0x0;_0x33369d<_0x33a191[_0x4e17('0x9c')];_0x33369d+=0x1){_0x4e27cb[_0x4e17('0x9d')](ami[_0x4e17('0x9e')]({'action':'command','command':util['format'](_0x4e17('0x9f'),_0x33a191[_0x33369d][_0x4e17('0xa0')],!_[_0x4e17('0x52')](config[_0x4e17('0x97')][_0xd6cde5])?_0xd6cde5:'')})[_0x4e17('0x3b')](function(_0x3f4964){return _0x3f4964[_0x4e17('0xa1')][_0x4e17('0xa2')](_0x4e17('0xa3'))>=0x0;})['catch'](myreject(_0x179f61)));}}else{_0x4e27cb[_0x4e17('0x9d')](ami[_0x4e17('0x9e')]({'action':_0x4e17('0xa4'),'command':util[_0x4e17('0x41')]('iftime\x20%s,%s',_0x33a191,!_['isUndefined'](config[_0x4e17('0x97')][_0xd6cde5])?_0xd6cde5:'')})['then'](function(_0x9c55e){return _0x9c55e['content'][_0x4e17('0xa2')](_0x4e17('0xa3'))>=0x0;})[_0x4e17('0xa5')](myreject(_0x179f61)));}Promise[_0x4e17('0xa6')](_0x4e27cb)[_0x4e17('0x3b')](function(_0x2b781b){var _0x4448bf=_[_0x4e17('0xa7')](_0x2b781b);if(_0x4448bf){return _0xb2a985(_0x4448bf);}else{_0x3a739c[_0x4e17('0x6a')]=_0x496b27?utils[_0x4e17('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x4e17('0x6b')][_0x4e17('0xa8')];return _0x179f61(msgResponse('[ifTime][promiseAll]',_0x4e17('0x99'),_0x4e17('0xa9')+_0x496b27+'\x20'+_0x2012d8+_0x4e17('0xaa')+util[_0x4e17('0x40')](_0x33a191,{'showHidden':![],'depth':null})+_0x4e17('0xab')+_0xd6cde5));}})[_0x4e17('0xa5')](function(_0x105c45){return _0x179f61(msgResponse(_0x4e17('0x95'),'Failure',JSON['stringify'](_0x105c45)));});});};Dialer[_0x4e17('0x1a')][_0x4e17('0xac')]=function(){var _0x49496c=this;return cmHopper[_0x4e17('0xad')]({'active':![]},{'where':{'active':!![]}})[_0x4e17('0x3b')](function(){setInterval(function(){_0x49496c['syncCampaigns']();},0x3e8);});};Dialer[_0x4e17('0x1a')]['syncCampaigns']=function(){var _0x33de51=this;var _0x162066;for(var _0x4c42b6 in this[_0x4e17('0x1f')]){if(typeof this[_0x4e17('0x1f')][_0x4c42b6]!==_0x4e17('0xae')){_0x162066=this[_0x4e17('0x1f')][_0x4c42b6];if(utils[_0x4e17('0x7f')](_0x162066)&&utils[_0x4e17('0x7c')](_0x162066)){_0x162066[_0x4e17('0x81')]=!![];Promise[_0x4e17('0xaf')]()[_0x4e17('0x3b')](checkIsIVRCampaignActive(_0x162066))[_0x4e17('0x3b')](checkInterval(_0x162066))['then'](_0x33de51[_0x4e17('0x8f')](_0x162066))[_0x4e17('0x3b')](_0x33de51[_0x4e17('0x93')](_0x162066[_0x4e17('0xb0')],_0x162066[_0x4e17('0xb1')],_0x162066[_0x4e17('0x60')],_0x162066))['then'](_0x33de51[_0x4e17('0xb2')](_0x162066[_0x4e17('0x78')],_0x162066[_0x4e17('0xb1')],_0x162066[_0x4e17('0x60')],_0x162066))[_0x4e17('0x3b')](_0x33de51[_0x4e17('0xb3')](_0x162066))['catch'](loggerCatchQueueSummary(_0x4e17('0xb4'),_0x162066));}else{notSendMessagesCampaign(_0x162066);}}}};Dialer['prototype'][_0x4e17('0xb5')]=function(_0x234401){if(_0x234401[_0x4e17('0xb6')]!==_0x4e17('0x8')){clearPredictiveAttributes(_0x234401);}switch(_0x234401['dialMethod']){case _0x4e17('0xb7'):this[_0x4e17('0xb8')](_0x234401,0x1);break;case _0x4e17('0xb9'):this[_0x4e17('0xb8')](_0x234401,_0x234401['dialPowerLevel']);break;case _0x4e17('0x8'):this[_0x4e17('0x8')](_0x234401);break;case _0x4e17('0xba'):this[_0x4e17('0xb8')](_0x234401,0x1);break;default:logger['error'](_0x4e17('0xbb'),_0x234401['name'],'method\x20not\x20recognized');}};Dialer[_0x4e17('0x1a')][_0x4e17('0x95')]=function(_0x254f66,_0x7a960e){var _0xeb3594=_0x254f66[_0x4e17('0xb1')];var _0x1adc94=_0x7a960e?_0x254f66['dialGlobalInterval']:_0x254f66[_0x4e17('0x78')]['Intervals'];logger[_0x4e17('0xbc')]('Dialer::ifTime()',_0x1adc94,_0xeb3594,_0x254f66[_0x4e17('0x60')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x254f66[_0x4e17('0x60')],_0x254f66['id']));var _0x345c7c=null;return Interval['intervalIftime'](_0x1adc94,_0xeb3594)[_0x4e17('0x3b')](function(_0x7fe530){if(_0x7fe530===!![]){return _0x7fe530;}else{_0x254f66[_0x4e17('0x6a')]=_0x7a960e?utils[_0x4e17('0x6b')][_0x4e17('0xbd')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x345c7c=msgResponse(_0x4e17('0xbe'),'Failure','Global:\x20'+_0x7a960e+'\x20'+_0x254f66[_0x4e17('0x60')]+_0x4e17('0xaa')+util[_0x4e17('0x40')](_0x1adc94,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xeb3594);}if(_0x345c7c!==null){logger[_0x4e17('0xbc')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x345c7c);_0x345c7c[_0x4e17('0xbf')]=_0x7a960e;throw _0x345c7c;}})[_0x4e17('0xa5')](function(_0x45c310){logger['error']('AMI\x20IfTime',_0x45c310);throw msgResponse(_0x4e17('0x87'),_0x4e17('0x88'),util[_0x4e17('0x40')](_0x45c310,{'showHidden':![],'depth':null}));});};Dialer[_0x4e17('0x1a')]['syncAgentConnect']=function(_0x44f5cd){if(this['voiceQueues'][_0x44f5cd[_0x4e17('0xc0')]]){if(this[_0x4e17('0x25')][_0x44f5cd[_0x4e17('0xc1')]]&&this[_0x4e17('0x25')][_0x44f5cd['uniqueid']][_0x4e17('0x3d')]!==_0x4e17('0xc2')){this['updateOriginated'](this['voiceQueues'][_0x44f5cd[_0x4e17('0xc0')]]);this['uniqueId'][_0x44f5cd[_0x4e17('0xc1')]][_0x4e17('0xc3')]=moment()['format'](_0x4e17('0xc4'));}}};Dialer[_0x4e17('0x1a')][_0x4e17('0x31')]=function(_0x770f88){var _0x5adf75=this[_0x4e17('0x25')][_0x770f88[_0x4e17('0xc1')]];if(this[_0x4e17('0x1e')][_0x770f88[_0x4e17('0xc0')]]){if(_0x5adf75&&_0x5adf75['type']!==_0x4e17('0xc2')){delete this['uniqueId'][_0x770f88[_0x4e17('0xc1')]];this[_0x4e17('0x1e')][_0x770f88[_0x4e17('0xc0')]][_0x4e17('0xc5')]+=0x1;var _0x4223a2=new AgentComplete(_0x5adf75,_0x770f88);if(_0x770f88[_0x4e17('0xc6')]===_0x4e17('0xc7')){_0x4223a2[_0x4e17('0xc8')]=this[_0x4e17('0x1e')][_0x770f88['queue']]['dialQueueProject2']&&this[_0x4e17('0x1e')][_0x770f88[_0x4e17('0xc0')]]['dialAgiAfterHangupAgent']?moment()[_0x4e17('0x41')](_0x4e17('0xc4')):undefined;}hopperUtils['createHistory'](_0x4223a2)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0xc9')));hopperUtils[_0x4e17('0xca')](_0x4223a2)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x4e17('0x1a')][_0x4e17('0x2d')]=function(_0x31c8d1){var _0xaf325a=this['uniqueId'][_0x31c8d1[_0x4e17('0xc1')]];var _0x419eeb=this;var _0x1a0ef7=![];var _0x44cdd9;var _0x4e4818;if(this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]]){if(_0xaf325a&&_0xaf325a[_0x4e17('0x3d')]!==_0x4e17('0xc2')){delete this[_0x4e17('0x25')][_0x31c8d1[_0x4e17('0xc1')]];this['updateOriginated'](this[_0x4e17('0x1e')][_0x31c8d1['queue']]);_0xaf325a[_0x4e17('0xcb')]=moment()[_0x4e17('0x41')](_0x4e17('0xc4'));var _0x4a510d=new QueueCallerAbandon(_0xaf325a,_0x31c8d1);if(utils[_0x4e17('0x5f')](_0xaf325a[_0x4e17('0xcb')],_0xaf325a['responsetime'])>=_0xaf325a[_0x4e17('0xcc')]){this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0x4a')]+=0x1;this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xcd')]+=0x1;this[_0x4e17('0x1e')][_0x31c8d1['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4a510d[_0x4e17('0x70')]=0xa;_0x4a510d[_0x4e17('0x71')]=_0x4e17('0xce');_0x4a510d[_0x4e17('0xcf')]=_0x4e17('0xd0');_0x4a510d['agiafterat']=this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xd1')]?moment()[_0x4e17('0x41')](_0x4e17('0xc4')):undefined;_0x4a510d[_0x4e17('0xd2')]+=0x1;_0x4a510d['countglobal']+=0x1;_0x44cdd9=this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xd3')];_0x4e4818=this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xd4')];hopperUtils['verifyAdditionalPhones'](_0x4a510d,_0x4a510d[_0x4e17('0x70')],_0xaf325a[_0x4e17('0xd5')])['then'](function(_0x17e53c){_0x1a0ef7=_0x17e53c[_0x4e17('0xd6')]==0x1;if(_0x4a510d[_0x4e17('0xd2')]>=_0x419eeb[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xd7')]){_0x419eeb[_0x4e17('0xd8')](_0x4a510d,_0x17e53c[_0x4e17('0xd6')]);}else{hopperUtils[_0x4e17('0xd9')]({'active':![],'countdropretry':_0x4a510d[_0x4e17('0xd2')],'scheduledat':moment()['add'](_0x419eeb['voiceQueues'][_0x31c8d1[_0x4e17('0xc0')]]['dialDropRetryFrequency'],_0x4e17('0xda'))[_0x4e17('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xaf325a[_0x4e17('0xdb')],'ListId':_0xaf325a[_0x4e17('0xdc')],'VoiceQueueId':_0xaf325a[_0x4e17('0xdd')]||undefined,'CampaignId':_0xaf325a[_0x4e17('0xde')]||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0xdf')));var _0x1be76b=new History(_0x4a510d);_0x1be76b[_0x4e17('0x70')]=0xa;_0x1be76b['statedesc']=_0x4e17('0xce');_0x1be76b['starttime']=moment()[_0x4e17('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be76b['endtime']=_0x1be76b['starttime'];_0x1be76b[_0x4e17('0xe0')]=_0x4a510d[_0x4e17('0xe0')];_0x1be76b[_0x4e17('0xe1')]=_0x4a510d[_0x4e17('0xe1')];hopperUtils[_0x4e17('0xe2')](_0x1be76b)[_0x4e17('0xa5')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x4e17('0x3b')](function(){if(_0x1a0ef7)hopperUtils[_0x4e17('0xe3')](_0x4a510d,_0x44cdd9,_0x4e4818)[_0x4e17('0x3b')](function(){return 0x1;});});}else{this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0x4c')]+=0x1;this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xe4')]+=0x1;_0x4a510d['state']=0xb;_0x4a510d[_0x4e17('0x71')]='Abandoned';_0x4a510d[_0x4e17('0xcf')]=_0x4e17('0xe5');_0x4a510d['countabandonedretry']+=0x1;_0x4a510d['countglobal']+=0x1;_0x44cdd9=this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xe6')];_0x4e4818=this[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xd4')];hopperUtils[_0x4e17('0xe7')](_0x4a510d,_0x4a510d[_0x4e17('0x70')],_0xaf325a['voiceQueue'])[_0x4e17('0x3b')](function(_0x12fe9b){if(_0x4a510d['countabandonedretry']>=_0x419eeb[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]]['dialAbandonedMaxRetry']){_0x419eeb[_0x4e17('0xd8')](_0x4a510d,_0x12fe9b[_0x4e17('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4a510d[_0x4e17('0xe8')],'scheduledat':moment()[_0x4e17('0xe9')](_0x419eeb[_0x4e17('0x1e')][_0x31c8d1[_0x4e17('0xc0')]][_0x4e17('0xe6')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xaf325a[_0x4e17('0xdb')],'ListId':_0xaf325a[_0x4e17('0xdc')],'VoiceQueueId':_0xaf325a[_0x4e17('0xdd')]||undefined,'CampaignId':_0xaf325a[_0x4e17('0xde')]||undefined})[_0x4e17('0xa5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x7b8033=new History(_0x4a510d);_0x7b8033['state']=0xb;_0x7b8033[_0x4e17('0x71')]=_0x4e17('0xea');_0x7b8033[_0x4e17('0x73')]=moment()['format'](_0x4e17('0xc4'));_0x7b8033[_0x4e17('0x72')]=_0x7b8033[_0x4e17('0x73')];_0x7b8033['calleridname']=_0x4a510d[_0x4e17('0xe0')];_0x7b8033[_0x4e17('0xe1')]=_0x4a510d[_0x4e17('0xe1')];hopperUtils[_0x4e17('0xe2')](_0x7b8033)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0xeb')));}})[_0x4e17('0x3b')](function(){if(_0x1a0ef7)hopperUtils['swapAdditionalPhones'](_0x4a510d,_0x44cdd9,_0x4e4818)['then'](function(){return 0x1;});});}}}};Dialer[_0x4e17('0x1a')]['syncNewExten']=function(_0x323834){if(this[_0x4e17('0xec')][_0x323834['uniqueid']]){this['actions'][_0x323834[_0x4e17('0xc1')]][_0x4e17('0xed')]=_0x323834[_0x4e17('0xed')];}if(this['uniqueId'][_0x323834['uniqueid']]){this[_0x4e17('0x25')][_0x323834[_0x4e17('0xc1')]][_0x4e17('0xed')]=_0x323834['channel'];}};Dialer['prototype']['syncQueueMember']=function(_0x9c1a4c){if(!this[_0x4e17('0xec')][_0x9c1a4c[_0x4e17('0xee')]]){return;}var _0x5c3bc8=this[_0x4e17('0x1e')][this['actions'][_0x9c1a4c[_0x4e17('0xee')]][_0x4e17('0xc0')]][_0x4e17('0xef')]||_0x4e17('0xf0');if(_0x5c3bc8==='roundrobin'){if(this[_0x4e17('0xec')][_0x9c1a4c[_0x4e17('0xee')]]&&_['isNil'](this[_0x4e17('0xec')][_0x9c1a4c['actionid']][_0x4e17('0xf1')])&&_0x9c1a4c[_0x4e17('0x8d')]==='1'&&_0x9c1a4c[_0x4e17('0xf2')]==='0'){if(this[_0x4e17('0x20')][_0x9c1a4c['stateinterface']]){if(!this[_0x4e17('0x20')][_0x9c1a4c[_0x4e17('0xf3')]][_0x4e17('0xf1')]){this['agents'][_0x9c1a4c[_0x4e17('0xf3')]]['locked']=!![];this[_0x4e17('0xec')][_0x9c1a4c[_0x4e17('0xee')]]['locked']=!![];this['actions'][_0x9c1a4c['actionid']][_0x4e17('0xf3')]=_0x9c1a4c[_0x4e17('0xf3')];}}}}else if(_0x5c3bc8===_0x4e17('0xf0')){if(this[_0x4e17('0xec')][_0x9c1a4c[_0x4e17('0xee')]]){if(this[_0x4e17('0x20')][_0x9c1a4c[_0x4e17('0xf3')]]){this[_0x4e17('0xec')][_0x9c1a4c[_0x4e17('0xee')]][_0x4e17('0xf3')]=_0x9c1a4c['stateinterface'];if(_[_0x4e17('0xf4')](this[_0x4e17('0x28')][this[_0x4e17('0xec')][_0x9c1a4c['actionid']][_0x4e17('0xc0')]])){this[_0x4e17('0x28')][this[_0x4e17('0xec')][_0x9c1a4c['actionid']][_0x4e17('0xc0')]]=[];}this[_0x4e17('0x28')][this[_0x4e17('0xec')][_0x9c1a4c[_0x4e17('0xee')]][_0x4e17('0xc0')]]['push'](_['merge'](_[_0x4e17('0x77')](this[_0x4e17('0xec')][_0x9c1a4c[_0x4e17('0xee')]],[_0x4e17('0xf5'),'stateinterface']),{'status':_0x9c1a4c[_0x4e17('0x8d')],'paused':_0x9c1a4c[_0x4e17('0xf2')]}));}}}};Dialer[_0x4e17('0x1a')]['syncQueueStatusComplete']=function(_0x44cdba){if(!this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]]){return;}var _0x57aaba=this;var _0x32a737=this[_0x4e17('0x1e')][this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xc0')]];var _0x1a57cb=_0x32a737['strategy']||_0x4e17('0xf0');if(_0x1a57cb==='roundrobin'){if(this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]]&&this['actions'][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xf3')]){this[_0x4e17('0x1d')][_0x4e17('0xf6')](this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xf5')],this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xf3')])[_0x4e17('0xa5')](function(_0x2bf623){logger[_0x4e17('0x66')](_0x4e17('0xf7'),util[_0x4e17('0x40')](_0x2bf623,{'showHidden':![],'depth':null}));})[_0x4e17('0x1c')](function(){_0x57aaba[_0x4e17('0xf8')](_0x57aaba[_0x4e17('0x1e')][_0x57aaba['actions'][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xc0')]]);_0x57aaba[_0x4e17('0x20')][_0x57aaba[_0x4e17('0xec')][_0x44cdba['actionid']][_0x4e17('0xf3')]][_0x4e17('0xf1')]=![];delete _0x57aaba[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]];unlockQueueStatus(_0x32a737);});}else{this['updateOriginated'](this[_0x4e17('0x1e')][this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xc0')]]);hopperUtils[_0x4e17('0xd9')]({'active':![],'ContactId':this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]]['ContactId'],'ListId':this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]]['ListId'],'VoiceQueueId':this['actions'][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xdd')]||undefined,'CampaignId':this['actions'][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xde')]||undefined})['catch'](loggerCatch(_0x4e17('0xf9')));delete this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]];unlockQueueStatus(_0x32a737);}}else if(_0x1a57cb===_0x4e17('0xf0')){var _0x2b4bb8;if(this['actions'][_0x44cdba[_0x4e17('0xee')]]&&!_[_0x4e17('0x43')](this['queueBooked'][this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xc0')]])){if(this[_0x4e17('0x29')][_0x57aaba['actions'][_0x44cdba[_0x4e17('0xee')]]['queue']]){this[_0x4e17('0x29')][_0x57aaba['actions'][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xc0')]]=this['queueBookedRR'][this[_0x4e17('0xec')][_0x44cdba['actionid']][_0x4e17('0xc0')]]?this[_0x4e17('0x29')][this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]]['queue']]:this[_0x4e17('0x28')][this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]]['queue']]?this[_0x4e17('0x28')][this[_0x4e17('0xec')][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xc0')]][_0x4e17('0xfa')]||0x0:0x0;}this[_0x4e17('0x28')][this['actions'][_0x44cdba['actionid']][_0x4e17('0xc0')]][_0x4e17('0xfa')]=this[_0x4e17('0x29')][this['actions'][_0x44cdba[_0x4e17('0xee')]][_0x4e17('0xc0')]];for(var _0x18691b=0x0;_0x18691b=_0xdc0b06[_0x4e17('0x11f')]){_0x3e67fc[_0x4e17('0x120')](_0x3afead,_0x275a4b,_0x21c204,_0x4e17('0x121'));}else{if(_0x3afead['countmachineretry']>=_0xdc0b06['dialMachineMaxRetry']){_0x3e67fc[_0x4e17('0x122')](_0x3afead,_0x275a4b,_0x21c204,'reason\x2019\x20machine....');}else{hopperUtils[_0x4e17('0xd9')]({'active':![],'countmachineretry':_0x3afead[_0x4e17('0x118')],'scheduledat':moment()[_0x4e17('0xe9')](_0xdc0b06[_0x4e17('0x123')],_0x4e17('0xda'))[_0x4e17('0x41')](_0x4e17('0xc4')),'ContactId':_0x3afead[_0x4e17('0xdb')],'ListId':_0x3afead[_0x4e17('0xdc')],'VoiceQueueId':_0x3afead[_0x4e17('0xdd')]||undefined,'CampaignId':_0x3afead['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x275a4b({'reschedule':0x1});}}});}if(_0x4cd5e9[_0x4e17('0x3d')]===_0x4e17('0xc2')&&this[_0x4e17('0x1f')][_0x4cd5e9[_0x4e17('0xc0')]][_0x4e17('0x109')]&&_0x50633b[_0x4e17('0x10a')]===_0x4e17('0x10b')){delete this[_0x4e17('0x25')][_0x50633b[_0x4e17('0xc1')]];this[_0x4e17('0xf8')](this[_0x4e17('0x1f')][_0x4cd5e9['queue']]);_0x41e09d=new Hangup(_0x4cd5e9,_0x50633b);_0x41e09d[_0x4e17('0x70')]=0x12;_0x41e09d[_0x4e17('0x71')]='HangupInAMD';_0x41e09d[_0x4e17('0x10e')]=_0x4e17('0x10f');ami[_0x4e17('0x110')](_0x4e17('0x111'),ut['buildObj'](_0x41e09d,_0x4e17('0x113')));this['saveInDb'](_0x41e09d,_0x4e17('0x124'),'[syncHangupInAMDIvr]');}if(_0x4cd5e9[_0x4e17('0x3d')]===_0x4e17('0xc2')&&this[_0x4e17('0x1f')][_0x4cd5e9[_0x4e17('0xc0')]]['dialAMDActive']&&_0x50633b['value']===_0x4e17('0x116')){return new Promise(function(_0x1ad78d,_0x5ecd3a){delete _0x3e67fc[_0x4e17('0x25')][_0x50633b[_0x4e17('0xc1')]];_0x3e67fc['updateOriginated'](_0x3e67fc[_0x4e17('0x1f')][_0x4cd5e9[_0x4e17('0xc0')]]);_0x3e67fc['campaigns'][_0x4cd5e9[_0x4e17('0xc0')]]['outboundAnswerCallsDay']+=0x1;_0x3e67fc[_0x4e17('0x1f')][_0x4cd5e9['queue']][_0x4e17('0x10c')]+=0x1;var _0x65fe79=_0x3e67fc['campaigns'][_0x4cd5e9[_0x4e17('0xc0')]];var _0x34a56e=new Hangup(_0x4cd5e9,_0x50633b);_0x34a56e[_0x4e17('0x70')]=0x13;_0x34a56e[_0x4e17('0x71')]=_0x4e17('0x117');_0x34a56e['membername']=_0x4e17('0x10f');_0x34a56e[_0x4e17('0x118')]+=0x1;_0x34a56e[_0x4e17('0x125')]+=0x1;_0x34a56e[_0x4e17('0x113')]=!![];ami['emit'](_0x4e17('0x111'),ut[_0x4e17('0x112')](_0x34a56e,_0x4e17('0x113')));hopperUtils[_0x4e17('0xe2')](_0x34a56e)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x119')));if(_0x34a56e[_0x4e17('0x11a')]+_0x34a56e[_0x4e17('0x11b')]+_0x34a56e['countnoanswerretry']+_0x34a56e['countnosuchnumberretry']+_0x34a56e[_0x4e17('0xd2')]+_0x34a56e[_0x4e17('0xe8')]+_0x34a56e['countmachineretry']+_0x34a56e[_0x4e17('0x11e')]>=_0x65fe79[_0x4e17('0x11f')]){_0x3e67fc[_0x4e17('0x120')](_0x34a56e,_0x1ad78d,_0x5ecd3a,_0x4e17('0x121'));}else{if(_0x34a56e[_0x4e17('0x118')]>=_0x65fe79[_0x4e17('0x126')]){_0x3e67fc[_0x4e17('0x122')](_0x34a56e,_0x1ad78d,_0x5ecd3a,'reason\x2019\x20machine....');}else{hopperUtils[_0x4e17('0xd9')]({'active':![],'countmachineretry':_0x34a56e[_0x4e17('0x118')],'scheduledat':moment()['add'](_0x65fe79[_0x4e17('0x123')],_0x4e17('0xda'))[_0x4e17('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34a56e[_0x4e17('0xdb')],'ListId':_0x34a56e[_0x4e17('0xdc')],'VoiceQueueId':_0x34a56e[_0x4e17('0xdd')]||undefined,'CampaignId':_0x34a56e['CampaignId']||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x127')));_0x1ad78d({'reschedule':0x1});}}});}}};Dialer[_0x4e17('0x1a')][_0x4e17('0x36')]=function(_0x63dc5e){var _0x6f49a6=this[_0x4e17('0x25')][_0x63dc5e['uniqueid']];var _0x534774;if(_0x6f49a6&&_0x6f49a6[_0x4e17('0x3d')]===_0x4e17('0xc2')){delete this[_0x4e17('0x25')][_0x63dc5e[_0x4e17('0xc1')]];this['updateOriginated'](this[_0x4e17('0x1f')][_0x6f49a6['queue']]);this[_0x4e17('0x1f')][_0x6f49a6['queue']]['ivrAnswerCallsDay']+=0x1;_0x534774=new Hangup(_0x6f49a6,_0x63dc5e);hopperUtils[_0x4e17('0xe2')](_0x534774)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x128')));hopperUtils[_0x4e17('0xca')](_0x534774)[_0x4e17('0xa5')](loggerCatch('[syncHangupIvr]'));}if(_0x6f49a6&&_0x6f49a6[_0x4e17('0x3d')]!=='ivr'&&isNotNull(this[_0x4e17('0x1e')][_0x6f49a6[_0x4e17('0xc0')]][_0x4e17('0x129')])){delete this['uniqueId'][_0x63dc5e['uniqueid']];this[_0x4e17('0xf8')](this[_0x4e17('0x1e')][_0x6f49a6['queue']]);this['voiceQueues'][_0x6f49a6[_0x4e17('0xc0')]][_0x4e17('0xc5')]+=0x1;this[_0x4e17('0x1e')][_0x6f49a6['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x534774=new Hangup(_0x6f49a6,_0x63dc5e);_0x534774['state']=0x10;_0x534774[_0x4e17('0x71')]=_0x4e17('0x12a');_0x534774[_0x4e17('0x10e')]=_0x4e17('0x12b');hopperUtils[_0x4e17('0xe2')](_0x534774)[_0x4e17('0xa5')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x534774)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x12c')));}if(_0x6f49a6&&_0x6f49a6[_0x4e17('0x3d')]!==_0x4e17('0xc2')&&!isNotNull(this[_0x4e17('0x1e')][_0x6f49a6[_0x4e17('0xc0')]][_0x4e17('0x129')])){delete this[_0x4e17('0x25')][_0x63dc5e[_0x4e17('0xc1')]];this[_0x4e17('0xf8')](this[_0x4e17('0x1e')][_0x6f49a6[_0x4e17('0xc0')]]);this[_0x4e17('0x1e')][_0x6f49a6[_0x4e17('0xc0')]]['outboundUnknownCallsDay']+=0x1;_0x534774=new Hangup(_0x6f49a6,_0x63dc5e);_0x534774[_0x4e17('0x70')]=0xc;_0x534774[_0x4e17('0x71')]=_0x63dc5e[_0x4e17('0x12d')];_0x534774[_0x4e17('0x10e')]='Unknow';hopperUtils[_0x4e17('0xe2')](_0x534774)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x128')));hopperUtils[_0x4e17('0xca')](_0x534774)['catch'](loggerCatch(_0x4e17('0x12c')));}};Dialer[_0x4e17('0x1a')]['syncQueueSummary']=function(_0x2d941b){var _0x205e42=this;if(!_0x205e42[_0x4e17('0x2a')][_0x2d941b['name']]){_0x205e42[_0x4e17('0x2a')][_0x2d941b[_0x4e17('0x60')]]={'running':![]};}else if(_0x205e42[_0x4e17('0x2a')][_0x2d941b[_0x4e17('0x60')]][_0x4e17('0x12e')]===!![]){return;}else if(_0x205e42['queuesSummary'][_0x2d941b[_0x4e17('0x60')]][_0x4e17('0x12e')]===![]){_0x205e42['queuesSummary'][_0x2d941b[_0x4e17('0x60')]][_0x4e17('0x12e')]=!![];}var _0x3546dc=_0x205e42['voiceQueues'][_0x2d941b[_0x4e17('0x60')]];var _0x4e7655=_0x3546dc[_0x4e17('0x6a')]!==utils[_0x4e17('0x6b')][_0x4e17('0x7d')];var _0xe6e15e=utils['isPreviewCampaign'](_0x3546dc);_0x3546dc[_0x4e17('0x12f')]=utils[_0x4e17('0x130')](_0x3546dc,_0x205e42[_0x4e17('0x21')]);Promise[_0x4e17('0xaf')]()['then'](function(){if(_0x3546dc[_0x4e17('0x12f')]===utils[_0x4e17('0x6b')][_0x4e17('0x7d')]){if(_0x4e7655){clearPredictiveAttributes(_0x3546dc);_0x2d941b[_0x4e17('0x62')]=undefined;_0x2d941b[_0x4e17('0x27')]=undefined;}if(_0x3546dc['statusMessage']===utils[_0x4e17('0x6b')][_0x4e17('0x7d')]){_0x2d941b[_0x4e17('0x131')]=0x0;_0x2d941b['paused']=0x0;_0x2d941b[_0x4e17('0x132')]=0x0;_0x2d941b[_0x4e17('0x133')]=0x0;_0x2d941b[_0x4e17('0x134')]=0x0;}}else if(_0x3546dc[_0x4e17('0x12f')]===utils[_0x4e17('0x6b')][_0x4e17('0x135')]&&!_0xe6e15e){return _0x205e42[_0x4e17('0x95')](_0x3546dc,!![])['then'](function(){return _0x205e42['ifTime'](_0x3546dc,![]);})[_0x4e17('0x3b')](function(){return _0x205e42[_0x4e17('0xb5')](_0x3546dc);})[_0x4e17('0xa5')](function(_0xa3a2f1){loggerSyncQueueSummary[_0x4e17('0x3f')](_0x4e17('0x136'),util[_0x4e17('0x40')](_0xa3a2f1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3546dc);});}else{clearPredictiveAttributes(_0x3546dc);}})['then'](function(){var _0x5c5689=_0x2d941b[_0x4e17('0x137')](_0x3546dc);if(_0x5c5689||_0x3546dc['queueSummaryCountersUpdated']){_0x3546dc[_0x4e17('0x138')]=![];_0x2d941b[_0x4e17('0x139')](_0x3546dc);Object[_0x4e17('0x13a')](_0x3546dc,_0x2d941b);emitOutboundVoiceQueueSummary(_0x2d941b);}_0x205e42[_0x4e17('0x2a')][_0x3546dc[_0x4e17('0x60')]][_0x4e17('0x12e')]=![];})[_0x4e17('0xa5')](function(_0x4abace){logger[_0x4e17('0x66')](_0x4e17('0x136'),util[_0x4e17('0x40')](_0x4abace,{'showHidden':![],'depth':null}));_0x205e42[_0x4e17('0x2a')][_0x3546dc['name']][_0x4e17('0x12e')]=![];});};Dialer[_0x4e17('0x1a')]['syncQueueSummaryComplete']=_[_0x4e17('0x13b')](function(){var _0x380d53=_[_0x4e17('0x13c')](this[_0x4e17('0x1e')],function(_0x3aa22c){return _0x3aa22c[_0x4e17('0x13d')];});var _0x57cbc8=_['filter'](this[_0x4e17('0x20')],function(_0x26954b){return _0x26954b[_0x4e17('0x13e')]&&_0x26954b[_0x4e17('0x8d')]===_0x4e17('0x8c');});if(_0x380d53[_0x4e17('0x9c')]>0x0&&_0x57cbc8[_0x4e17('0x9c')]>0x0){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0x4e17('0x13f')](_0x380d53,'id'),previewRecallmeReminderInterval,_[_0x4e17('0x13f')](_0x57cbc8,'id')))['then'](function(_0x7bda05){for(var _0x190a05=0x0;_0x190a05<_0x7bda05[_0x4e17('0x9c')];_0x190a05++){var _0x559679=_0x7bda05[_0x190a05][_0x4e17('0x140')][_0x4e17('0x60')];if(_0x559679)io['to'](util[_0x4e17('0x41')](_0x4e17('0x141'),_0x559679))[_0x4e17('0x110')](_0x4e17('0x142'),{'hopper':_0x7bda05[_0x190a05]});}})[_0x4e17('0xa5')](function(_0x18b4a0){logger['error']('checkPreviewRecallReminder',_0x18b4a0);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4e17('0x1a')]['loopClearZombieChannels']=function(){var _0x1b1892=this;setInterval(function(){_0x1b1892[_0x4e17('0x143')](_0x1b1892[_0x4e17('0x25')],_0x4e17('0x144'));_0x1b1892[_0x4e17('0x143')](_0x1b1892['actions'],_0x4e17('0x145'));},0x32c8);};Dialer[_0x4e17('0x1a')][_0x4e17('0x143')]=function(_0x51592b,_0x409607){var _0x1be33c=this;for(var _0x2162cd in _0x51592b){if(typeof _0x51592b[_0x2162cd]!==_0x4e17('0xae')){this[_0x4e17('0x146')]['enqueue'](function(){if(!_[_0x4e17('0xf4')](_0x51592b[_0x2162cd])){return ami[_0x4e17('0x9e')]({'action':'status','channel':_0x51592b[_0x2162cd][_0x4e17('0xed')]})[_0x4e17('0xa5')](function(_0x3f028a){if(_0x3f028a[_0x4e17('0x6a')]===_0x4e17('0x147')){setTimeout(function(){if(_0x51592b[_0x2162cd]&&_0x51592b[_0x2162cd][_0x4e17('0x3d')]!==_0x4e17('0xc2')){_0x1be33c[_0x4e17('0xf8')](_0x1be33c['voiceQueues'][_0x51592b[_0x2162cd][_0x4e17('0xc0')]]);logger['error'](_0x4e17('0x148'),_0x409607,_0x2162cd,_0x51592b[_0x2162cd]['queue']);delete _0x51592b[_0x2162cd];}if(_0x51592b[_0x2162cd]&&_0x51592b[_0x2162cd][_0x4e17('0x3d')]==='ivr'){_0x1be33c[_0x4e17('0xf8')](_0x1be33c[_0x4e17('0x1f')][_0x51592b[_0x2162cd][_0x4e17('0xc0')]]);logger[_0x4e17('0x66')](_0x4e17('0x149'),_0x409607,_0x2162cd,_0x51592b[_0x2162cd][_0x4e17('0xc0')]);delete _0x51592b[_0x2162cd];}},0x2328);}});}});}}};Dialer[_0x4e17('0x1a')][_0x4e17('0x14a')]=function(_0x3a28e9){return Promise[_0x4e17('0xaf')]()[_0x4e17('0x3b')](voiceQueueRt[_0x4e17('0x14a')](_0x3a28e9))[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x14b')));};Dialer[_0x4e17('0x1a')][_0x4e17('0xf8')]=function(_0x4db724){if(!_['isUndefined'](_0x4db724)&&_0x4db724!==null){if(typeof _0x4db724[_0x4e17('0x82')]!==_0x4e17('0xae')){if(_0x4db724[_0x4e17('0x82')]>0x0){_0x4db724[_0x4e17('0x82')]-=0x1;}else{logger[_0x4e17('0x66')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4e17('0x66')](_0x4e17('0x14c'));}};Dialer[_0x4e17('0x1a')]['loggerHandler']=function(_0x568bbe,_0x5dded1){var _0x4ebed0=this;return function(_0x257c73){_0x4ebed0[_0x4e17('0xf8')](_0x5dded1);logger['error'](_0x568bbe,util[_0x4e17('0x40')](_0x257c73,{'showHidden':![],'depth':null}));};};Dialer[_0x4e17('0x1a')][_0x4e17('0x14d')]=function(_0x1dbb5c,_0x80b07b,_0x1f11d3){var _0x4f5ae8={'state':0x19,'statedesc':_0x4e17('0x14e')};this[_0x4e17('0xf8')](_0x80b07b);this[_0x4e17('0x14f')](_[_0x4e17('0x5e')](_0x4f5ae8,_[_0x4e17('0x77')](_0x1f11d3,[_0x4e17('0xdb'),'ListId',_0x4e17('0x150'),_0x4e17('0xdd'),_0x4e17('0xde')])),_0x4e17('0x151'),_0x4e17('0x152'));logger[_0x4e17('0x66')](_0x1dbb5c);};Dialer['prototype'][_0x4e17('0x14f')]=function(_0x1d14a4,_0x4191a0,_0xc5a5a1){hopperUtils['createHistory'](_0x1d14a4)[_0x4e17('0xa5')](loggerCatch(_0x4191a0));hopperUtils['moveContactManagedDialer'](_0x1d14a4)[_0x4e17('0xa5')](loggerCatch(_0xc5a5a1));};Dialer[_0x4e17('0x1a')][_0x4e17('0xd8')]=function(_0x480403,_0x66a105){hopperUtils[_0x4e17('0xe2')](_0x480403)['catch'](loggerCatch(_0x4e17('0xc9')));if(_0x66a105==0x0){hopperUtils[_0x4e17('0xca')](_0x480403)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x4e17('0x1a')][_0x4e17('0x153')]=function(_0x4ef69f){return Promise[_0x4e17('0xaf')]()['then'](cmHopper[_0x4e17('0x154')](_0x4ef69f['id'],previewRecallmeReminderInterval))['then'](function(_0x38d022){for(var _0x5a27a7=0x0;_0x5a27a7<_0x38d022['length'];_0x5a27a7++){var _0x27257e=_0x38d022[_0x5a27a7][_0x4e17('0x140')]['name'];if(_0x27257e)io['to'](util[_0x4e17('0x41')]('user:%s',_0x27257e))[_0x4e17('0x110')]('user:dialPreviewRecallReminder',{'hopper':_0x38d022[_0x5a27a7]});}})[_0x4e17('0xa5')](function(){});};Dialer[_0x4e17('0x1a')][_0x4e17('0xb3')]=function(_0x2a9525){var _0x4a575f=this;return function(){_0x4a575f['handleIvr'](_0x2a9525);};};Dialer[_0x4e17('0x1a')][_0x4e17('0x155')]=function(_0x25cd1a,_0x38d594){var _0x5c4bdc=this;var _0x14befc=uuid['v4']();this[_0x4e17('0xec')][_0x14befc]=new Action(_0x25cd1a,_0x38d594,_0x14befc);return new Promise(function(_0x2c0c92,_0x1d2e03){if(_['isUndefined'](_0x25cd1a)&&typeof _0x25cd1a!=='object'){return _0x1d2e03(msgResponse(_0x4e17('0x156'),_0x4e17('0x99'),_0x4e17('0x157')));}if(_[_0x4e17('0x52')](_0x38d594[_0x4e17('0x158')])||_0x38d594[_0x4e17('0x158')]===null){return _0x1d2e03(msgResponse(_0x4e17('0x156'),_0x4e17('0x99'),_0x4e17('0x159')));}var _0xd37bd4={'XMD-CALLERID':_0x5c4bdc[_0x4e17('0xec')][_0x14befc][_0x4e17('0x15a')](),'XMD-AGI':_0x25cd1a['dialQueueProject']?util[_0x4e17('0x41')]('\x22agi://%s/square,%s\x22',ipAgi,_0x25cd1a[_0x4e17('0x129')]):_0x4e17('0x15b'),'XMD-AGIAFTER':_0x25cd1a[_0x4e17('0xd1')]?util[_0x4e17('0x41')]('\x22agi://%s/square,%s\x22',ipAgi,_0x25cd1a[_0x4e17('0xd1')]):_0x4e17('0x15b'),'XMD-QUEUE':utils[_0x4e17('0x15c')](_0x25cd1a)?util[_0x4e17('0x41')]('\x22%s,%s%s,,,%s\x22',_0x25cd1a[_0x4e17('0x60')],_0x25cd1a[_0x4e17('0x15d')]||'',_0x25cd1a[_0x4e17('0x15e')]?'c':'',_0x25cd1a['dialQueueTimeout']||0x3):_0x4e17('0x15b'),'XMD-CONTACTID':_0x38d594[_0x4e17('0xdb')],'XMD-CDRTYPE':_0x4e17('0x7'),'CALLERID(all)':_0x5c4bdc[_0x4e17('0xec')][_0x14befc][_0x4e17('0x15a')](),'XMD-AMD':_0x25cd1a[_0x4e17('0x109')]?'ACTIVE':_0x4e17('0x15b'),'XMD-DESTINATION':_0x4e17('0x108')};if(_0x25cd1a[_0x4e17('0x109')]){_0xd37bd4[_0x4e17('0x15f')]=_0x25cd1a[_0x4e17('0x160')]||0x9c4;_0xd37bd4['XMD-AMDGREETING']=_0x25cd1a['dialAMDGreeting']||0x5dc;_0xd37bd4[_0x4e17('0x161')]=_0x25cd1a[_0x4e17('0x162')]||0x320;_0xd37bd4[_0x4e17('0x163')]=_0x25cd1a[_0x4e17('0x164')]||0x1388;_0xd37bd4[_0x4e17('0x165')]=_0x25cd1a[_0x4e17('0x166')]||0x64;_0xd37bd4[_0x4e17('0x167')]=_0x25cd1a[_0x4e17('0x168')]||0x32;_0xd37bd4[_0x4e17('0x169')]=_0x25cd1a[_0x4e17('0x16a')]||0x3;_0xd37bd4['XMD-AMDSILENCETHRESHOLD']=_0x25cd1a['dialAMDSilenceThreshold']||0x100;_0xd37bd4['XMD-AMDMAXIMUMWORDLENGTH']=_0x25cd1a[_0x4e17('0x16b')]||0x1388;}if(utils[_0x4e17('0x15c')](_0x25cd1a)){_0xd37bd4[_0x4e17('0x16c')]=_0x38d594['VoiceQueueId'];}else{_0xd37bd4[_0x4e17('0x16d')]=_0x38d594[_0x4e17('0xde')];}for(var _0x33a52e in _0x38d594[_0x4e17('0x16e')]){if(typeof _0x38d594[_0x4e17('0x16e')][_0x33a52e]!==_0x4e17('0xae')){if(isNotNull(_0x38d594[_0x4e17('0x16e')][_0x33a52e])&&_0x33a52e!=='id'&&_0x33a52e!=='tags'&&_0x33a52e!=='createdAt'&&_0x33a52e!==_0x4e17('0x16f')){_0xd37bd4[util[_0x4e17('0x41')](_0x4e17('0x170'),_0x4e17('0x171'),_[_0x4e17('0x172')](_0x33a52e))]=_0x38d594['Contact'][_0x33a52e];}}}var _0x4d71bb=_0x5c4bdc['isTrunkReachable'](_0x25cd1a['Trunk'])?utils[_0x4e17('0x173')](_0x25cd1a[_0x4e17('0x174')][_0x4e17('0x175')],_0x25cd1a[_0x4e17('0x176')],_0x25cd1a[_0x4e17('0x177')]>0x0?utils['getCallerIdRandom'](_0x25cd1a[_0x4e17('0x178')],_0x25cd1a[_0x4e17('0x177')]):_0x25cd1a[_0x4e17('0x178')]):utils[_0x4e17('0x173')](_[_0x4e17('0xf4')](_0x25cd1a[_0x4e17('0x90')])?_0x25cd1a['Trunk'][_0x4e17('0x175')]:_0x25cd1a['TrunkBackup'][_0x4e17('0x175')],_0x25cd1a[_0x4e17('0x176')],_0x25cd1a['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x4e17('0x179')](_0x25cd1a[_0x4e17('0x178')],_0x25cd1a[_0x4e17('0x177')]):_0x25cd1a[_0x4e17('0x178')]);if(_0x4d71bb){_0xd37bd4[_0x4e17('0x17a')]=_0x5c4bdc['actions'][_0x14befc]['originatecalleridname']=utils['extractCalleridName'](_0x4d71bb);_0xd37bd4[_0x4e17('0x17b')]=_0x38d594[_0x4e17('0x158')];}_0x25cd1a[_0x4e17('0x17c')]=_0xd37bd4;return ami['Action']({'actionid':_0x14befc,'action':_0x4e17('0x156'),'channel':_0x5c4bdc[_0x4e17('0x89')](_0x25cd1a['Trunk'])?util[_0x4e17('0x41')](_0x4e17('0x17d'),_0x25cd1a[_0x4e17('0x174')][_0x4e17('0x60')],isNotNull(_0x25cd1a[_0x4e17('0x17e')])?_0x25cd1a[_0x4e17('0x17e')][_0x4e17('0x17f')]()||'':'',_0x25cd1a[_0x4e17('0x180')]>0x0?_0x38d594['phone'][_0x4e17('0x181')](_0x25cd1a['dialCutDigit']):_0x38d594[_0x4e17('0x158')]):util[_0x4e17('0x41')]('SIP/%s/%s%s',_[_0x4e17('0xf4')](_0x25cd1a[_0x4e17('0x90')])?_0x25cd1a[_0x4e17('0x174')]['name']:_0x25cd1a[_0x4e17('0x90')][_0x4e17('0x60')],isNotNull(_0x25cd1a[_0x4e17('0x17e')])?_0x25cd1a[_0x4e17('0x17e')][_0x4e17('0x17f')]()||'':'',_0x25cd1a[_0x4e17('0x180')]>0x0?_0x38d594[_0x4e17('0x158')][_0x4e17('0x181')](_0x25cd1a[_0x4e17('0x180')]):_0x38d594[_0x4e17('0x158')]),'callerid':_0x4d71bb,'Exten':_0x4e17('0x108'),'Context':'from-sip','Priority':'1','variable':_0xd37bd4,'timeout':(_0x25cd1a['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x14befc})['then'](function(_0x5e8dcd){return _0x2c0c92(_0x5e8dcd);})[_0x4e17('0xa5')](function(_0x57f69b){_0x25cd1a[_0x4e17('0x182')]+=0x1;var _0x58659e=new History(_0x5c4bdc[_0x4e17('0xec')][_0x14befc]);logger[_0x4e17('0x66')](util[_0x4e17('0x41')](_0x4e17('0x183'),JSON[_0x4e17('0x76')](_0x57f69b)));_0x58659e['state']=0xe;_0x58659e[_0x4e17('0x71')]=_0x4e17('0x184');_0x58659e[_0x4e17('0x73')]=moment()[_0x4e17('0x41')](_0x4e17('0xc4'));_0x58659e[_0x4e17('0x72')]=_0x58659e[_0x4e17('0x73')];hopperUtils[_0x4e17('0xe2')](_0x58659e)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x185')));_0x5c4bdc[_0x4e17('0xca')](_0x58659e)['catch'](loggerCatch(_0x4e17('0x185')))[_0x4e17('0x1c')](function(){delete _0x5c4bdc[_0x4e17('0xec')][_0x14befc];return _0x1d2e03(msgResponse(_0x4e17('0x156'),_0x4e17('0x88'),'originate\x20action\x20Error'));});});});};Dialer[_0x4e17('0x1a')]['checkRetriveMax']=function(_0x1a99fb,_0x328f69,_0x212580){var _0x39174c=new History(_0x328f69);if(_0x39174c[_0x4e17('0x11a')]+_0x39174c[_0x4e17('0x11b')]+_0x39174c[_0x4e17('0x11c')]+_0x39174c['countnosuchnumberretry']+_0x39174c[_0x4e17('0xd2')]+_0x39174c[_0x4e17('0xe8')]+_0x39174c['countmachineretry']+_0x39174c[_0x4e17('0x11e')]>=_0x212580['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1a99fb){case 0x3:if(_0x39174c[_0x4e17('0x11c')]>=_0x212580[_0x4e17('0x186')]-0x1){return!![];}hopperUtils[_0x4e17('0xd9')]({'active':![],'countnoanswerretry':_0x39174c[_0x4e17('0x11c')]+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580['dialNoAnswerRetryFrequency'],_0x4e17('0xda'))[_0x4e17('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x39174c['ContactId'],'ListId':_0x39174c['ListId'],'VoiceQueueId':_0x39174c[_0x4e17('0xdd')]||undefined,'CampaignId':_0x39174c['CampaignId']||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x187')));break;case 0x5:if(_0x39174c[_0x4e17('0x11a')]>=_0x212580[_0x4e17('0x188')]-0x1){return!![];}hopperUtils[_0x4e17('0xd9')]({'active':![],'countbusyretry':_0x39174c['countbusyretry']+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580[_0x4e17('0x189')],_0x4e17('0xda'))[_0x4e17('0x41')](_0x4e17('0xc4')),'ContactId':_0x39174c['ContactId'],'ListId':_0x39174c[_0x4e17('0xdc')],'VoiceQueueId':_0x39174c[_0x4e17('0xdd')]||undefined,'CampaignId':_0x39174c['CampaignId']||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x18a')));break;case 0x8:if(_0x39174c[_0x4e17('0x11b')]>=_0x212580[_0x4e17('0x18b')]-0x1){return!![];}hopperUtils[_0x4e17('0xd9')]({'active':![],'countcongestionretry':_0x39174c['countcongestionretry']+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580['dialCongestionRetryFrequency'],'minutes')[_0x4e17('0x41')](_0x4e17('0xc4')),'ContactId':_0x39174c[_0x4e17('0xdb')],'ListId':_0x39174c[_0x4e17('0xdc')],'VoiceQueueId':_0x39174c[_0x4e17('0xdd')]||undefined,'CampaignId':_0x39174c[_0x4e17('0xde')]||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x18c')));break;case 0x0:if(_0x39174c[_0x4e17('0x11d')]>=_0x212580['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x4e17('0xd9')]({'active':![],'countnosuchnumberretry':_0x39174c['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580['dialNoSuchNumberRetryFrequency'],_0x4e17('0xda'))[_0x4e17('0x41')](_0x4e17('0xc4')),'ContactId':_0x39174c[_0x4e17('0xdb')],'ListId':_0x39174c[_0x4e17('0xdc')],'VoiceQueueId':_0x39174c[_0x4e17('0xdd')]||undefined,'CampaignId':_0x39174c[_0x4e17('0xde')]||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x18d')));}break;case 0xa:if(_0x39174c[_0x4e17('0xd2')]>=_0x212580[_0x4e17('0xd7')]-0x1){return!![];}hopperUtils[_0x4e17('0xd9')]({'active':![],'countdropretry':_0x39174c[_0x4e17('0xd2')]+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580[_0x4e17('0xd3')],'minutes')[_0x4e17('0x41')](_0x4e17('0xc4')),'ContactId':_0x39174c['ContactId'],'ListId':_0x39174c[_0x4e17('0xdc')],'VoiceQueueId':_0x39174c['VoiceQueueId']||undefined,'CampaignId':_0x39174c[_0x4e17('0xde')]||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0xdf')));break;case 0xb:if(_0x39174c[_0x4e17('0xe8')]>=_0x212580[_0x4e17('0x18e')]-0x1){return!![];}hopperUtils[_0x4e17('0xd9')]({'active':![],'countabandonedretry':_0x39174c['countabandonedretry']+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580['dialAbandonedRetryFrequency'],_0x4e17('0xda'))[_0x4e17('0x41')](_0x4e17('0xc4')),'ContactId':_0x39174c['ContactId'],'ListId':_0x39174c[_0x4e17('0xdc')],'VoiceQueueId':_0x39174c[_0x4e17('0xdd')]||undefined,'CampaignId':_0x39174c[_0x4e17('0xde')]||undefined})['catch'](loggerCatch(_0x4e17('0x18f')));break;case 0x13:if(_0x39174c[_0x4e17('0x118')]>=_0x212580[_0x4e17('0x126')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x39174c[_0x4e17('0x118')]+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580[_0x4e17('0x123')],_0x4e17('0xda'))['format'](_0x4e17('0xc4')),'ContactId':_0x39174c['ContactId'],'ListId':_0x39174c[_0x4e17('0xdc')],'VoiceQueueId':_0x39174c[_0x4e17('0xdd')]||undefined,'CampaignId':_0x39174c[_0x4e17('0xde')]||undefined})[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x127')));break;case 0x14:if(_0x39174c[_0x4e17('0x11e')]>=_0x212580[_0x4e17('0x190')]-0x1){return!![];}hopperUtils[_0x4e17('0xd9')]({'active':![],'countagentrejectretry':_0x39174c[_0x4e17('0x11e')]+=0x1,'scheduledat':moment()[_0x4e17('0xe9')](_0x212580['dialAgentRejectRetryFrequency'],_0x4e17('0xda'))[_0x4e17('0x41')](_0x4e17('0xc4')),'ContactId':_0x39174c[_0x4e17('0xdb')],'ListId':_0x39174c[_0x4e17('0xdc')],'VoiceQueueId':_0x39174c['VoiceQueueId']||undefined,'CampaignId':_0x39174c['CampaignId']||undefined})[_0x4e17('0xa5')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x4e17('0x1a')][_0x4e17('0x102')]=function(_0x2b6c2c,_0x2167a9,_0x1beac0){var _0x37a96d=this;var _0x262df4=new History(_0x2b6c2c);var _0x90b034=![];var _0x209177;var _0x517db6;return new Promise(function(_0x3bdb8,_0x193d8b){if(_[_0x4e17('0x52')](_0x2167a9)&&typeof _0x2167a9!==_0x4e17('0x191')){return _0x193d8b(msgResponse(_0x4e17('0x192'),'Failure',_0x4e17('0x193')));}if(_['isUndefined'](_0x1beac0)&&typeof _0x1beac0!==_0x4e17('0x191')){return _0x193d8b(msgResponse(_0x4e17('0x192'),_0x4e17('0x99'),_0x4e17('0x194')));}hopperUtils['verifyAdditionalPhones'](_0x262df4,_0x1beac0[_0x4e17('0xc6')],_0x2167a9)['then'](function(_0x1f075c){if(_0x1f075c[_0x4e17('0xd6')]==0x1)_0x90b034=!![];switch(_0x1beac0[_0x4e17('0xc6')]){case'0':_0x2167a9['outboundNoSuchCallsDay']+=0x1;_0x262df4[_0x4e17('0x70')]=0x0;_0x262df4[_0x4e17('0x71')]=_0x4e17('0x195');_0x262df4[_0x4e17('0x11d')]+=0x1;_0x262df4[_0x4e17('0x125')]+=0x1;ami[_0x4e17('0x110')](_0x4e17('0x196'),ut[_0x4e17('0x112')](_0x2b6c2c,_0x4e17('0x197')));_0x209177=_0x2167a9['dialNoSuchNumberRetryFrequency'];_0x517db6=_0x2167a9[_0x4e17('0xd4')];hopperUtils['createHistory'](_0x262df4)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x119')));if(_0x37a96d['checkRetriveMax'](0x0,_0x2b6c2c,_0x2167a9)&&!_0x90b034){if(_0x262df4['countnosuchnumberretry']>=_0x2167a9[_0x4e17('0x198')]){_0x37a96d[_0x4e17('0x122')](_0x262df4,_0x3bdb8,_0x193d8b,'reason\x200\x20no\x20such\x20number....');}else{_0x37a96d[_0x4e17('0x120')](_0x262df4,_0x3bdb8,_0x193d8b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2167a9[_0x4e17('0x199')]+=0x1;_0x262df4[_0x4e17('0x70')]=0x3;_0x262df4['statedesc']=_0x4e17('0x19a');_0x262df4[_0x4e17('0x11c')]+=0x1;_0x262df4[_0x4e17('0x125')]+=0x1;var _0x5c0648=ut[_0x4e17('0x19b')](_0x2b6c2c,_0x2167a9);ami[_0x4e17('0x110')]('custom:agentnoanswer',_0x5c0648);_0x209177=_0x2167a9[_0x4e17('0x19c')];_0x517db6=_0x2167a9[_0x4e17('0xd4')];hopperUtils[_0x4e17('0xe2')](_0x262df4)['catch'](loggerCatch(_0x4e17('0x19d')));if(_0x37a96d[_0x4e17('0x19e')](0x3,_0x2b6c2c,_0x2167a9)&&!_0x90b034){if(_0x262df4[_0x4e17('0x11c')]>=_0x2167a9[_0x4e17('0x186')]){_0x37a96d[_0x4e17('0x122')](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x19f'));}else{_0x37a96d[_0x4e17('0x120')](_0x262df4,_0x3bdb8,_0x193d8b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2167a9[_0x4e17('0x1a0')]+=0x1;_0x262df4['state']=0x5;_0x262df4[_0x4e17('0x71')]=_0x4e17('0x1a1');_0x262df4[_0x4e17('0x11a')]+=0x1;_0x262df4[_0x4e17('0x125')]+=0x1;ami[_0x4e17('0x110')]('custom:agentbusy',ut[_0x4e17('0x112')](_0x2b6c2c,_0x4e17('0x1a2')));_0x209177=_0x2167a9[_0x4e17('0x189')];_0x517db6=_0x2167a9[_0x4e17('0xd4')];hopperUtils[_0x4e17('0xe2')](_0x262df4)['catch'](loggerCatch(_0x4e17('0x1a3')));if(_0x37a96d[_0x4e17('0x19e')](0x5,_0x2b6c2c,_0x2167a9)&&!_0x90b034){if(_0x262df4[_0x4e17('0x11a')]>=_0x2167a9[_0x4e17('0x188')]){_0x37a96d[_0x4e17('0x122')](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x1a4'));}else{_0x37a96d[_0x4e17('0x120')](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x1a4'));}}break;case'8':_0x2167a9[_0x4e17('0x1a5')]+=0x1;_0x262df4[_0x4e17('0x70')]=0x8;_0x262df4[_0x4e17('0x71')]=_0x4e17('0x1a6');_0x262df4[_0x4e17('0x11b')]+=0x1;_0x262df4[_0x4e17('0x125')]+=0x1;_0x209177=_0x2167a9[_0x4e17('0x1a7')];_0x517db6=_0x2167a9[_0x4e17('0xd4')];ami['emit'](_0x4e17('0x1a8'),ut['buildObj'](_0x2b6c2c,_0x4e17('0x1a9')));hopperUtils[_0x4e17('0xe2')](_0x262df4)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x1aa')));if(_0x37a96d[_0x4e17('0x19e')](0x8,_0x2b6c2c,_0x2167a9)&&!_0x90b034){if(_0x262df4[_0x4e17('0x11b')]>=_0x2167a9[_0x4e17('0x18b')]){_0x37a96d['createStateFinal'](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x1ab'));}else{_0x37a96d[_0x4e17('0x120')](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x1ab'));}}break;case'11':_0x2167a9[_0x4e17('0x1ac')]+=0x1;_0x262df4[_0x4e17('0x70')]=0xb;_0x262df4[_0x4e17('0x71')]=_0x4e17('0xea');_0x262df4[_0x4e17('0xe8')]+=0x1;_0x262df4[_0x4e17('0x125')]+=0x1;_0x209177=_0x2167a9[_0x4e17('0xe6')];_0x517db6=_0x2167a9[_0x4e17('0xd4')];hopperUtils[_0x4e17('0xe2')](_0x262df4)['catch'](loggerCatch(_0x4e17('0xeb')));if(_0x37a96d[_0x4e17('0x19e')](0xb,_0x2b6c2c,_0x2167a9)&&!_0x90b034){if(_0x262df4[_0x4e17('0xe8')]>=_0x2167a9[_0x4e17('0x18e')]){_0x37a96d[_0x4e17('0x122')](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x1ad'));}else{_0x37a96d[_0x4e17('0x120')](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x1ad'));}}break;case'20':_0x2167a9[_0x4e17('0x1ae')]+=0x1;_0x262df4[_0x4e17('0x70')]=0x14;_0x262df4['statedesc']='AgentReject';_0x262df4[_0x4e17('0x11e')]+=0x1;_0x262df4[_0x4e17('0x125')]+=0x1;_0x209177=_0x2167a9[_0x4e17('0x1af')];_0x517db6=_0x2167a9[_0x4e17('0xd4')];ami[_0x4e17('0x110')](_0x4e17('0x1b0'),ut['buildObj'](_0x2b6c2c,_0x4e17('0x1b1')));hopperUtils[_0x4e17('0xe2')](_0x262df4)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x1b2')));if(_0x37a96d[_0x4e17('0x19e')](0x14,_0x2b6c2c,_0x2167a9)&&!_0x90b034){if(_0x262df4['countagentrejectretry']>=_0x2167a9[_0x4e17('0x190')]){_0x37a96d[_0x4e17('0x122')](_0x262df4,_0x3bdb8,_0x193d8b,'reason\x2020\x20agentreject');}else{_0x37a96d[_0x4e17('0x120')](_0x262df4,_0x3bdb8,_0x193d8b,_0x4e17('0x1b3'));}}break;default:_0x2167a9['outboundUnknownCallsDay']+=0x1;_0x262df4[_0x4e17('0x70')]=0xc;_0x262df4[_0x4e17('0x71')]=_0x1beac0[_0x4e17('0xc6')];_0x209177=_0x2167a9[_0x4e17('0x1af')];_0x517db6=_0x2167a9[_0x4e17('0xd4')];hopperUtils[_0x4e17('0xe2')](_0x262df4)[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x1b4')));if(_0x37a96d[_0x4e17('0x19e')](_0x1beac0[_0x4e17('0xc6')],_0x2b6c2c,_0x2167a9)&&!_0x90b034){if(_0x262df4[_0x4e17('0x11a')]+_0x262df4['countcongestionretry']+_0x262df4['countnoanswerretry']+_0x262df4[_0x4e17('0x11d')]+_0x262df4[_0x4e17('0xd2')]+_0x262df4[_0x4e17('0xe8')]+_0x262df4['countmachineretry']+_0x262df4['countagentrejectretry']>=_0x2167a9['dialGlobalMaxRetry']){_0x37a96d[_0x4e17('0x120')](_0x262df4,_0x3bdb8,_0x193d8b,_0x1beac0[_0x4e17('0xc6')]);}else{_0x37a96d[_0x4e17('0x122')](_0x262df4,_0x3bdb8,_0x193d8b,_0x1beac0['reason']);}}}})['then'](function(){if(_0x90b034){hopperUtils[_0x4e17('0xe3')](_0x262df4,_0x209177,_0x517db6)['then'](function(){return _0x3bdb8(0x1);});}});});};Dialer[_0x4e17('0x1a')][_0x4e17('0x120')]=function(_0x979b69,_0x231721,_0x117618,_0x5241b4){var _0x4395b5=new Final(_0x979b69);_0x4395b5[_0x4e17('0x70')]=0xf;_0x4395b5[_0x4e17('0x71')]=_0x4e17('0x1b5');this[_0x4e17('0x122')](_0x4395b5,_0x231721,_0x117618,_0x5241b4);};Dialer[_0x4e17('0x1a')]['createStateFinal']=function(_0x4081d4,_0x181ae1,_0xb45fb5,_0x5989b4){hopperUtils[_0x4e17('0xca')](_0x4081d4)['then'](function(){return _0x181ae1(msgResponse('[callProgressDetecting]',_0x4e17('0x1b6'),_0x5989b4));})['catch'](function(){return _0xb45fb5(msgResponse('[moveContactManagedDialer][0]',_0x4e17('0x99'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x4e17('0x8')]=function(_0x2b3915){var _0x4d43e4=_0x2b3915[_0x4e17('0x1b7')]/0x64;var _0x95197a=_0x2b3915[_0x4e17('0xcd')]/(_0x2b3915[_0x4e17('0xcd')]+_0x2b3915[_0x4e17('0xc5')]);var _0x1f36bd=Math[_0x4e17('0x1b8')](_0x2b3915[_0x4e17('0x1b9')]*(_0x2b3915['predictiveIntervalMaxThreshold']/0x64));var _0x17f9c3=Math[_0x4e17('0x1b8')](_0x2b3915[_0x4e17('0x1b9')]*(_0x2b3915[_0x4e17('0x1ba')]/0x64));var _0x1cc1fd=_0x2b3915[_0x4e17('0x131')]+_0x2b3915[_0x4e17('0x133')];var _0x44eade=Math[_0x4e17('0x1bb')](_0x2b3915[_0x4e17('0x1bc')]*_0x2b3915[_0x4e17('0x5a')]*_0x2b3915[_0x4e17('0x1bd')]*_0x2b3915[_0x4e17('0x1be')]);if(_[_0x4e17('0x52')](_0x2b3915[_0x4e17('0x27')])){if(!_[_0x4e17('0x52')](_0x2b3915[_0x4e17('0x62')])){_0x2b3915[_0x4e17('0x62')]=undefined;loggerPredictive[_0x4e17('0x66')](_0x4e17('0x1bf'),_0x4e17('0x1c0'));}if(!_[_0x4e17('0x52')](_0x2b3915[_0x4e17('0x64')])){loggerPredictive[_0x4e17('0x66')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2b3915['handlePredictive']);_0x2b3915['handlePredictive']=undefined;}_0x2b3915[_0x4e17('0x27')]=moment()[_0x4e17('0x41')](_0x4e17('0xc4'));loggerPredictive[_0x4e17('0x44')](_0x2b3915[_0x4e17('0x60')],'collection\x20data\x20in\x20progressive\x20at',_0x2b3915['startProgressive']);this[_0x4e17('0xb8')](_0x2b3915,0x1);}else if(ifInterval(_0x2b3915['dialPredictiveInterval'],_0x2b3915[_0x4e17('0x27')])){this['handlePower'](_0x2b3915,0x1);loggerPredictiveCalls[_0x4e17('0x44')](_0x4e17('0x1c1'),_0x2b3915[_0x4e17('0x27')],_0x2b3915['name']);_0x2b3915[_0x4e17('0x1bc')]=0x0;_0x2b3915[_0x4e17('0x1c2')]=0x0;}else if(_0x4d43e4<_0x95197a&&_0x2b3915['dialPredictiveOptimization']===_0x4e17('0x1c3')){clearPredictiveAttributes(_0x2b3915);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x1c4'),'Dropped\x20calls\x20day',_0x95197a,'startProgressive',_0x2b3915[_0x4e17('0x60')]);}else if(_0x44eade<_0x2b3915[_0x4e17('0x1c2')]&&_0x2b3915['dialPredictiveOptimization']===_0x4e17('0x1c3')){clearPredictiveAttributes(_0x2b3915);loggerPredictive['info'](_0x4e17('0x1c5'),'Max\x20Drop\x20',_0x44eade,_0x4e17('0x1c6'),_0x2b3915['predictiveIntervalErlangCallsDroppedCalls'],_0x4e17('0x27'),_0x2b3915[_0x4e17('0x60')]);}else if(!ifInterval(_0x2b3915[_0x4e17('0x1c7')],_0x2b3915[_0x4e17('0x27')])&&_[_0x4e17('0x52')](_0x2b3915[_0x4e17('0x62')])&&!_[_0x4e17('0x52')](_0x2b3915['startProgressive'])){_0x2b3915[_0x4e17('0x62')]=moment()[_0x4e17('0x41')](_0x4e17('0xc4'));loggerPredictive[_0x4e17('0x44')](_0x2b3915[_0x4e17('0x60')],'started\x20in\x20predictive\x20at',_0x2b3915[_0x4e17('0x62')]);hopperUtils[_0x4e17('0x1c8')](_0x2b3915[_0x4e17('0x1c7')])[_0x4e17('0x3b')](this[_0x4e17('0x1c9')](_0x2b3915))[_0x4e17('0x3b')](mergeDataErlangB(_0x2b3915))[_0x4e17('0x3b')](this['startMethodPredictive'](_0x2b3915))[_0x4e17('0xa5')](loggerCatchPredictive(_0x4e17('0x1ca'),_0x2b3915));}else if(!ifInterval(_0x2b3915['dialPredictiveInterval'],_0x2b3915[_0x4e17('0x62')])){_0x2b3915['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2b3915[_0x4e17('0x62')]=moment()[_0x4e17('0x41')](_0x4e17('0xc4'));loggerPredictive[_0x4e17('0x44')](_0x2b3915[_0x4e17('0x60')],'recalculate\x20predictive\x20at',_0x2b3915[_0x4e17('0x62')]);clearInterval(_0x2b3915[_0x4e17('0x64')]);_0x2b3915[_0x4e17('0x64')]=undefined;hopperUtils[_0x4e17('0x1c8')](_0x2b3915[_0x4e17('0x1c7')])[_0x4e17('0x3b')](this[_0x4e17('0x1c9')](_0x2b3915))['then'](mergeDataErlangB(_0x2b3915))[_0x4e17('0x3b')](this['startMethodPredictive'](_0x2b3915))[_0x4e17('0xa5')](loggerCatchPredictive(_0x4e17('0x1cb'),_0x2b3915));}else if(_0x2b3915[_0x4e17('0x1b9')]&&_0x1cc1fd<_0x2b3915[_0x4e17('0x1b9')]-_0x17f9c3){clearPredictiveAttributes(_0x2b3915);loggerPredictive[_0x4e17('0x44')](_0x2b3915[_0x4e17('0x60')],_0x4e17('0x1cc'),_0x1cc1fd,')\x20are\x20less\x20than\x20threshold\x20(',_0x2b3915['predictiveIntervalAvailable'],'-',_0x17f9c3,'=',_0x2b3915[_0x4e17('0x1b9')]-_0x17f9c3,')');}else if(_0x2b3915[_0x4e17('0x1b9')]&&_0x1cc1fd>_0x2b3915['predictiveIntervalAvailable']+_0x1f36bd){clearPredictiveAttributes(_0x2b3915);loggerPredictive[_0x4e17('0x44')](_0x2b3915[_0x4e17('0x60')],_0x4e17('0x1cc'),_0x1cc1fd,_0x4e17('0x1cd'),_0x2b3915[_0x4e17('0x1b9')],'+',_0x1f36bd,'=',_0x2b3915[_0x4e17('0x1b9')]+_0x1f36bd,')');}};Dialer[_0x4e17('0x1a')][_0x4e17('0x1c9')]=function(_0x42e249){var _0x263f96=this;return function(_0x5a4dd9){return new Promise(function(_0x4f2d61,_0x24c40f){_[_0x4e17('0x5e')](_0x42e249,_0x5a4dd9[0x0]);if(checkGetDataPredictive(_0x5a4dd9[0x0])){var _0x3e5868=_0x42e249[_0x4e17('0x1b9')]=_0x42e249[_0x4e17('0x133')]+_0x42e249[_0x4e17('0x131')];var _0x24dfbc=_0x42e249[_0x4e17('0x1c7')]*0x3c;var _0x1872be=_0x5a4dd9[0x0][_0x4e17('0x50')]+_0x5a4dd9[0x0]['predictiveIntervalAvgHoldtime'];var _0x3f577c=(_0x5a4dd9[0x0][_0x4e17('0x48')]+_0x5a4dd9[0x0][_0x4e17('0x4a')]+_0x5a4dd9[0x0][_0x4e17('0x4c')])/_0x5a4dd9[0x0][_0x4e17('0x46')];_0x42e249[_0x4e17('0x1bd')]=_0x3f577c>0x0?_0x3f577c:0x1;switch(_0x42e249['dialPredictiveOptimization']){case _0x4e17('0x1c3'):var _0x525f53=_0x42e249['dialPredictiveOptimizationPercentage']/0x64;return _0x263f96['abandonmentRate'](_0x3e5868,_0x24dfbc,_0x1872be,_0x3f577c,_0x525f53)[_0x4e17('0x3b')](function(_0x140c25){return _0x4f2d61(_0x140c25);});case _0x4e17('0x1ce'):var _0x3cc3c6=_0x42e249[_0x4e17('0x1b7')]/0x64;return _0x263f96[_0x4e17('0x1cf')](_0x3e5868,_0x24dfbc,_0x1872be,_0x3f577c,_0x3cc3c6)[_0x4e17('0x3b')](function(_0x254439){return _0x4f2d61(_0x254439);});default:return _0x24c40f(msgResponse(_0x4e17('0x1d0'),_0x4e17('0x99'),_0x4e17('0x1d1')));}}else{return _0x24c40f(msgResponse(_0x4e17('0x1d0'),_0x4e17('0x99'),_0x4e17('0x1d2')));}});};};Dialer['prototype'][_0x4e17('0x1d3')]=function(_0x291c5e){var _0x4e3583=this;return function(_0x20cd2a){return new Promise(function(_0x5cbd83,_0x155024){_[_0x4e17('0x5e')](_0x291c5e,_0x20cd2a[0x0]);if(checkGetDataPredictive(_0x20cd2a[0x0])){loggerPredictive[_0x4e17('0x44')](JSON['stringify'](_0x20cd2a[0x0]));if(_0x291c5e[_0x4e17('0x1d4')]==='dropRate'){return _0x4e3583[_0x4e17('0x14a')](_0x291c5e['id'])[_0x4e17('0x3b')](function(_0x5d10d9){var _0x5a34bb=_0x291c5e[_0x4e17('0x1d5')]-_0x5d10d9[0x0][_0x4e17('0x1d6')];var _0x149d8d=_0x291c5e['dialPredictiveInterval']*0x3c;var _0x6a2f9f=_0x20cd2a[0x0][_0x4e17('0x50')]+_0x20cd2a[0x0]['predictiveIntervalAvgHoldtime'];var _0xf9793d=(_0x20cd2a[0x0]['predictiveIntervalAnsweredCalls']+_0x20cd2a[0x0][_0x4e17('0x4a')]+_0x20cd2a[0x0][_0x4e17('0x4c')])/_0x20cd2a[0x0][_0x4e17('0x46')];var _0x338372=_0x291c5e[_0x4e17('0x1b7')]/0x64;_0x291c5e[_0x4e17('0x1d7')]=_0x5d10d9[0x0][_0x4e17('0x1d6')]||0x0;_0x291c5e[_0x4e17('0x1bd')]=_0xf9793d>0x0?_0xf9793d:0x1;return _0x4e3583['abandonmentRate'](_0x5a34bb,_0x149d8d,_0x6a2f9f,_0xf9793d,_0x338372);})[_0x4e17('0x3b')](function(_0x36ce3a){return _0x5cbd83(_0x36ce3a);})['catch'](function(_0x58f144){return _0x155024(msgResponse(_0x4e17('0x1d8'),_0x4e17('0x99'),JSON[_0x4e17('0x76')](_0x58f144)));});}if(_0x291c5e['dialPredictiveOptimization']===_0x4e17('0x1ce')){return _0x4e3583[_0x4e17('0x14a')](_0x291c5e['id'])[_0x4e17('0x3b')](function(_0x4ae103){var _0x28275a=_0x291c5e[_0x4e17('0x1d5')]-_0x4ae103[0x0][_0x4e17('0x1d6')];var _0x765957=_0x291c5e['dialPredictiveInterval']*0x3c;var _0x5bcb83=_0x20cd2a[0x0][_0x4e17('0x50')]+_0x20cd2a[0x0]['predictiveIntervalAvgHoldtime'];var _0x301a9f=(_0x20cd2a[0x0][_0x4e17('0x48')]+_0x20cd2a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x20cd2a[0x0][_0x4e17('0x4c')])/_0x20cd2a[0x0][_0x4e17('0x46')];var _0x586355=_0x291c5e[_0x4e17('0x1b7')]/0x64;_0x291c5e[_0x4e17('0x1d7')]=_0x4ae103[0x0]['outboundQueuePauses']||0x0;_0x291c5e[_0x4e17('0x1bd')]=_0x301a9f>0x0?_0x301a9f:0x1;return _0x4e3583[_0x4e17('0x1cf')](_0x28275a,_0x765957,_0x5bcb83,_0x301a9f,_0x586355);})[_0x4e17('0x3b')](function(_0x67890){return _0x5cbd83(_0x67890);})[_0x4e17('0xa5')](function(_0x3cfa74){return _0x155024(msgResponse(_0x4e17('0x1d8'),'Failure',JSON[_0x4e17('0x76')](_0x3cfa74)));});}}else{return _0x155024(msgResponse(_0x4e17('0x1d0'),_0x4e17('0x99'),'check\x20failure'));}});};};Dialer[_0x4e17('0x1a')][_0x4e17('0x1d9')]=function(_0x1631c0){var _0x29f24b=this;return function(){var _0x219f33=0x0;var _0x5dd2cb=Math[_0x4e17('0x1bb')](_0x1631c0[_0x4e17('0x59')]*0x3e8);if(_0x5dd2cb>0x0){_0x5dd2cb=_0x5dd2cb<0x64?0x64:_0x5dd2cb;loggerPredictive[_0x4e17('0x44')](_0x1631c0[_0x4e17('0x60')],'one\x20call\x20every:',_0x5dd2cb,'milliseconds');_0x1631c0[_0x4e17('0x64')]=setInterval(function(){_0x29f24b[_0x4e17('0x64')](_0x1631c0);loggerPredictiveCalls[_0x4e17('0x44')](_0x4e17('0x1da'),_0x219f33+=0x1);},_0x5dd2cb);}else{loggerPredictive[_0x4e17('0x44')](_0x1631c0[_0x4e17('0x60')],_0x4e17('0x1db'));}};};Dialer[_0x4e17('0x1a')][_0x4e17('0x1dc')]=function(_0x99d0bd,_0x18e65b){var _0xa73c47=this;return function(_0x17239a){if(_[_0x4e17('0x43')](_0x17239a)){if(_[_0x4e17('0xf4')](_0x18e65b[_0x4e17('0x150')])||!_0x18e65b['recallme']){if(_0x99d0bd[_0x4e17('0xb6')]==='booked'){_0x99d0bd['queueStatusComplete']=_['isUndefined'](_0x99d0bd[_0x4e17('0x74')])?!![]:_0x99d0bd[_0x4e17('0x74')];var _0x39c2b0=uuid['v4']();_0xa73c47[_0x4e17('0xec')][_0x39c2b0]=new Action(_0x99d0bd,_0x18e65b,_0x39c2b0);loggerBooked[_0x4e17('0x44')](_0x4e17('0x1dd'),_0x39c2b0,_0x4e17('0x1de'),JSON['stringify'](_0x99d0bd[_0x4e17('0x74')]),_0x4e17('0x1df'),_0x99d0bd[_0x4e17('0x60')]);if(_0x99d0bd[_0x4e17('0x74')]){_0x99d0bd[_0x4e17('0x74')]=![];_0xa73c47[_0x4e17('0x28')][_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xc0')]]=[];ami[_0x4e17('0x9e')]({'actionid':_0x39c2b0,'action':_0x4e17('0x1e0'),'queue':_0x99d0bd[_0x4e17('0x60')]})['catch'](function(){_0xa73c47['updateOriginated'](_0x99d0bd);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xdb')],'ListId':_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xdc')],'VoiceQueueId':_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xdd')]||undefined,'CampaignId':_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xde')]||undefined})['catch'](loggerCatch(_0x4e17('0x1e1')));delete _0xa73c47['actions'][_0x39c2b0];});}else{loggerBooked['info'](_0x4e17('0x1e2'),JSON[_0x4e17('0x76')](_0x99d0bd[_0x4e17('0x74')]),_0x4e17('0x1df'),_0x99d0bd[_0x4e17('0x60')]);_0xa73c47[_0x4e17('0xf8')](_0x99d0bd);hopperUtils[_0x4e17('0xd9')]({'active':![],'ContactId':_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xdb')],'ListId':_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xdc')],'VoiceQueueId':_0xa73c47[_0x4e17('0xec')][_0x39c2b0][_0x4e17('0xdd')]||undefined,'CampaignId':_0xa73c47['actions'][_0x39c2b0][_0x4e17('0xde')]||undefined})['catch'](loggerCatch(_0x4e17('0x1e1')));delete _0xa73c47[_0x4e17('0xec')][_0x39c2b0];}}else{return _0xa73c47[_0x4e17('0x155')](_0x99d0bd,_0x18e65b);}}else{if(utils[_0x4e17('0x5f')](undefined,_0x18e65b[_0x4e17('0x1e3')])<_0x99d0bd['dialRecallMeTimeout']*0x3c){if(_0x18e65b[_0x4e17('0x140')]&&!_0x18e65b[_0x4e17('0x140')][_0x4e17('0x1e4')]){_0xa73c47['preview'][_0x4e17('0xf6')](_0x18e65b['id'])[_0x4e17('0x1c')](function(){_0xa73c47[_0x4e17('0xf8')](_0x99d0bd);});}else{hopperUtils[_0x4e17('0x1e5')]({'active':![]},_0x18e65b['id'],0x1)[_0x4e17('0x1c')](function(){_0xa73c47[_0x4e17('0xf8')](_0x99d0bd);});}}else{_0x99d0bd[_0x4e17('0x1e6')]+=0x1;_0xa73c47[_0x4e17('0xf8')](_0x99d0bd);if(_0x99d0bd[_0x4e17('0x1e7')]){hopperUtils[_0x4e17('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x18e65b['ContactId'],'ListId':_0x18e65b['ListId'],'VoiceQueueId':_0x18e65b[_0x4e17('0xdd')]||undefined,'CampaignId':_0x18e65b[_0x4e17('0xde')]||undefined})['catch'](loggerCatch(_0x4e17('0x1e8')));hopperUtils['createHistory'](createObjHistory(_0x99d0bd,_0x18e65b,utils[_0x4e17('0x6b')][_0x4e17('0x1e9')],0x17,_0x4e17('0x1ea')))[_0x4e17('0xa5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xa73c47[_0x4e17('0x14f')](createObjHistory(_0x99d0bd,_0x18e65b,utils[_0x4e17('0x6b')][_0x4e17('0x1eb')],0x16,_0x4e17('0x1ec')),_0x4e17('0x1ed'),'[Originate][HistoryRecallClose]');}}}}else{_0x99d0bd[_0x4e17('0x1ee')]+=0x1;_0xa73c47[_0x4e17('0x14f')](createObjHistory(_0x99d0bd,_0x18e65b,utils[_0x4e17('0x6b')][_0x4e17('0x1ef')],0xd,_0x4e17('0x1f0')),_0x4e17('0x1f1'),_0x4e17('0x1f2'));throw _0x4e17('0x1f3');}};};Dialer['prototype'][_0x4e17('0x1f4')]=function(_0x8418d4){var _0x52ab58=this;var _0x4bc5d3=_0x8418d4[_0x4e17('0x1f5')]-_0x8418d4[_0x4e17('0x82')]-_0x8418d4[_0x4e17('0x1f6')];emitCampaignSummary(_0x8418d4);if(_0x4bc5d3>0x0){if(_0x4bc5d3>this[_0x4e17('0x22')]){_0x4bc5d3=this['maxNumberOriginate'];}_0x8418d4['temp']+=_0x4bc5d3;hopperUtils[_0x4e17('0x1f7')](_0x8418d4,_0x4bc5d3)[_0x4e17('0x3b')](function(_0x4529b4){_0x8418d4[_0x4e17('0x1f6')]-=_0x4bc5d3;_0x8418d4[_0x4e17('0x1f6')]=_0x8418d4[_0x4e17('0x1f6')]>0x0?_0x8418d4[_0x4e17('0x1f6')]:0x0;if(!utils[_0x4e17('0x1f8')](_0x4529b4)){_0x8418d4[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x6f')];logger[_0x4e17('0x44')](_0x4e17('0x1f9')+_0x8418d4[_0x4e17('0x60')]);}else{_0x8418d4['originated']+=_0x4529b4[_0x4e17('0x9c')];_0x8418d4['message']=utils['CAMPAIGN_STATUS'][_0x4e17('0x1fa')];for(var _0x45ae6e=0x0;_0x45ae6e<_0x4529b4[_0x4e17('0x9c')];_0x45ae6e+=0x1){_0x8418d4['ivrTotalCallsDays']+=0x1;if(_[_0x4e17('0xf4')](_0x4529b4[_0x45ae6e])||_[_0x4e17('0xf4')](_0x4529b4[_0x45ae6e][_0x4e17('0x16e')])||_[_0x4e17('0xf4')](_0x4529b4[_0x45ae6e][_0x4e17('0x158')])){_0x52ab58[_0x4e17('0x14d')](_0x4e17('0x1fb'),_0x8418d4,_0x4529b4[_0x45ae6e]);}else{hopperUtils[_0x4e17('0x1fc')](_[_0x4e17('0x77')](_0x4529b4[_0x45ae6e],[_0x4e17('0xde'),'phone']))[_0x4e17('0x3b')](_0x52ab58[_0x4e17('0x1dc')](_0x8418d4,_0x4529b4[_0x45ae6e]))[_0x4e17('0xa5')](_0x52ab58[_0x4e17('0x1fd')](_0x4e17('0x1fe'),_0x8418d4));}}}})[_0x4e17('0xa5')](loggerGetContactDialer(_0x4e17('0x1ff'),_0x8418d4,_0x4bc5d3));}};Dialer[_0x4e17('0x1a')][_0x4e17('0xb8')]=function(_0x36f03a,_0x4fc151){var _0x44133b=this;var _0x554af1=[];if(_0x4fc151<0x1||_0x36f03a['dialMethod']===_0x4e17('0xba')){_0x4fc151=0x1;}var _0x119009=Math[_0x4e17('0x1bb')](_0x36f03a['available']*_0x4fc151)-_0x36f03a[_0x4e17('0x82')]-_0x36f03a['temp'];if(_0x36f03a[_0x4e17('0x200')]>0x0){var _0x4eb232=_0x36f03a[_0x4e17('0x200')]-_0x36f03a[_0x4e17('0x82')]-_0x36f03a['talking']-_0x36f03a['temp']-_0x36f03a[_0x4e17('0x134')];if(_0x119009>_0x4eb232){_0x119009=_0x4eb232;}}if(_0x119009>0x0){if(_0x36f03a['dialMethod']===_0x4e17('0xba')){_0x119009=0x1;}if(_0x119009>this[_0x4e17('0x22')]){_0x119009=this[_0x4e17('0x22')];}_0x36f03a[_0x4e17('0x1f6')]+=_0x119009;for(var _0x45b1b2 in this[_0x4e17('0x20')]){if(typeof this[_0x4e17('0x20')][_0x45b1b2]!==_0x4e17('0xae')){if(this[_0x4e17('0x20')][_0x45b1b2][_0x4e17('0x70')]===_0x4e17('0x201')&&this[_0x4e17('0x20')][_0x45b1b2][_0x4e17('0x8d')]===_0x4e17('0x8c')){_0x554af1['push'](this['agents'][_0x45b1b2]['id']);}}}hopperUtils[_0x4e17('0x202')](_0x36f03a,_0x554af1,_0x119009)[_0x4e17('0x3b')](function(_0x2c81ed){_0x36f03a['temp']-=_0x119009;_0x36f03a['temp']=_0x36f03a[_0x4e17('0x1f6')]>0x0?_0x36f03a[_0x4e17('0x1f6')]:0x0;if(!utils[_0x4e17('0x1f8')](_0x2c81ed)){hopperUtils[_0x4e17('0x203')](_0x36f03a)['then'](sendMessageReschedule(_0x36f03a))[_0x4e17('0xa5')](loggerCatch('[countReScheduled]\x20'));}else{_0x36f03a['originated']+=_0x2c81ed['length'];_0x36f03a[_0x4e17('0x6a')]=_0x36f03a[_0x4e17('0xb6')]===_0x4e17('0xba')?utils[_0x4e17('0x6b')][_0x4e17('0x135')]:utils[_0x4e17('0x6b')][_0x4e17('0x1fa')];for(var _0x2a8236=0x0;_0x2a8236<_0x2c81ed['length'];_0x2a8236+=0x1){if(_['isNil'](_0x2c81ed[_0x2a8236])||_[_0x4e17('0xf4')](_0x2c81ed[_0x2a8236][_0x4e17('0x16e')])||_['isNil'](_0x2c81ed[_0x2a8236][_0x4e17('0x158')])){_0x44133b[_0x4e17('0x14d')](_0x4e17('0x1fb'),_0x36f03a,_0x2c81ed[_0x2a8236]);}else{hopperUtils['checkIsBlackList'](_[_0x4e17('0x77')](_0x2c81ed[_0x2a8236],[_0x4e17('0xdd'),_0x4e17('0x158')]))[_0x4e17('0x3b')](_0x44133b['checkContactBlack'](_0x36f03a,_0x2c81ed[_0x2a8236]))[_0x4e17('0xa5')](_0x44133b[_0x4e17('0x1fd')](_0x4e17('0x1fb'),_0x36f03a));}}}})[_0x4e17('0xa5')](loggerGetContactDialer(_0x4e17('0x204'),_0x36f03a,_0x119009));}};Dialer['prototype'][_0x4e17('0x64')]=function(_0x183a5f){if(_0x183a5f[_0x4e17('0x200')]>0x0){var _0x513fbf=_0x183a5f['dialLimitQueue']-_0x183a5f['originated']-_0x183a5f[_0x4e17('0x133')];if(_0x513fbf>0x0){this[_0x4e17('0x205')](_0x183a5f);}else{loggerPredictiveCalls['info'](_0x4e17('0x206'));}}else{this[_0x4e17('0x205')](_0x183a5f);}};Dialer[_0x4e17('0x1a')][_0x4e17('0x205')]=function(_0x3f0e53){var _0x6e1e10=this;var _0x188be0=[];_0x3f0e53[_0x4e17('0x82')]+=0x1;for(var _0x54eff6 in this[_0x4e17('0x20')]){if(typeof this['agents'][_0x54eff6]!==_0x4e17('0xae')){if(this[_0x4e17('0x20')][_0x54eff6][_0x4e17('0x70')]==='not_inuse'&&this[_0x4e17('0x20')][_0x54eff6][_0x4e17('0x8d')]===_0x4e17('0x8c')){_0x188be0[_0x4e17('0x9d')](this[_0x4e17('0x20')][_0x54eff6]['id']);}}}return this[_0x4e17('0x202')](_0x3f0e53['id'],_0x188be0,0x1,_0x3f0e53[_0x4e17('0x207')],_0x3f0e53)[_0x4e17('0x3b')](function(_0x8eea55){if(!utils['checkContactEmpty'](_0x8eea55)){utils['checkContactLowerLimitOriginate'](_0x3f0e53,0x1,0x0);return hopperUtils[_0x4e17('0x203')](_0x3f0e53)[_0x4e17('0x3b')](sendMessageReschedule(_0x3f0e53))[_0x4e17('0xa5')](loggerCatch(_0x4e17('0x208')));}else{_0x3f0e53[_0x4e17('0x6a')]=utils[_0x4e17('0x6b')][_0x4e17('0x1fa')];if(_[_0x4e17('0xf4')](_0x8eea55[0x0])||_['isNil'](_0x8eea55[0x0][_0x4e17('0x16e')])||_[_0x4e17('0xf4')](_0x8eea55[0x0][_0x4e17('0x158')])){_0x6e1e10['emptyContact'](_0x4e17('0x1fb'),_0x3f0e53,_0x8eea55[0x0]);}else{return hopperUtils[_0x4e17('0x209')](_[_0x4e17('0x77')](_0x8eea55[0x0],['VoiceQueueId',_0x4e17('0x158')]))[_0x4e17('0x3b')](_0x6e1e10['checkContactBlack'](_0x3f0e53,_0x8eea55[0x0]))[_0x4e17('0xa5')](_0x6e1e10['loggerHandler'](_0x4e17('0x20a'),_0x3f0e53));}}})[_0x4e17('0xa5')](loggerGetContactDialer(_0x4e17('0x20b'),_0x3f0e53,0x1));};Dialer[_0x4e17('0x1a')][_0x4e17('0x20c')]=function(_0x262f65,_0x115b5f,_0x113daf,_0x13510b,_0x3e8e2c,_0x24781c){loggerPredictive[_0x4e17('0x44')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x4e17('0x44')](_0x4e17('0x20d'),_0x262f65);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x20e'),_0x115b5f);loggerPredictive['info']('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',_0x113daf);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x20f'),_0x13510b);loggerPredictive[_0x4e17('0x44')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e8e2c);loggerPredictive['info']('---------------------------');return new Promise(function(_0x1246d6,_0x3e5719){if(_0x262f65<=0x0||isNaN(_0x262f65)){return _0x3e5719(msgResponse(_0x4e17('0x210'),_0x4e17('0x88'),_0x4e17('0x211')+_0x262f65));}if(_0x113daf<=0x0||isNaN(_0x113daf)){return _0x3e5719(msgResponse(_0x4e17('0x210'),_0x4e17('0x88'),'Ts\x20=\x20'+_0x113daf));}if(_0x13510b<=0x0||isNaN(_0x13510b)){return _0x3e5719(msgResponse('[abandonmentRate]',_0x4e17('0x88'),_0x4e17('0x212')+_0x13510b));}if(_0x115b5f<=0x0||isNaN(_0x115b5f)){return _0x3e5719(msgResponse('[abandonmentRate]',_0x4e17('0x88'),_0x4e17('0x213')+_0x115b5f));}if(_0x3e8e2c<=0x0||isNaN(_0x3e8e2c)){return _0x3e5719(msgResponse(_0x4e17('0x210'),'Error',_0x4e17('0x214')+_0x3e8e2c));}_0x24781c=_0x24781c||0x0;var _0xcc6787=0x1/_0x113daf;var _0x4ca7d8=0x0;var _0x222fc7=0x0;var _0x5a1922=0x0;var _0x758f6c=0x0;for(var _0x33242a=0x0;_0x5a1922<_0x3e8e2c;_0x33242a+=0x1){_0x222fc7=_0x33242a/_0x115b5f;_0x4ca7d8=(_0x13510b*_0x222fc7+_0x24781c)/_0xcc6787;_0x5a1922=utils['erlangb'](_0x4ca7d8,_0x262f65);_0x758f6c=_0x4ca7d8/_0x262f65*(0x1-utils[_0x4e17('0x215')](_0x4ca7d8,_0x262f65));}return _0x1246d6({'erlangCalls':_0x33242a,'erlangCallToSecond':_0x115b5f/_0x33242a,'erlangAbandonmentRate':_0x5a1922,'erlangBusyFactor':_0x758f6c});});};Dialer[_0x4e17('0x1a')][_0x4e17('0x1cf')]=function(_0x5d0c71,_0x109d2c,_0x38fcc3,_0x190dfa,_0x3f10b2,_0x40e3e5){loggerPredictive[_0x4e17('0x44')](_0x4e17('0x216'));loggerPredictive[_0x4e17('0x44')](_0x4e17('0x20d'),_0x5d0c71);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x20e'),_0x109d2c);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x217'),_0x38fcc3);loggerPredictive['info'](_0x4e17('0x20f'),_0x190dfa);loggerPredictive[_0x4e17('0x44')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f10b2);loggerPredictive[_0x4e17('0x44')](_0x4e17('0x51'));return new Promise(function(_0x3c9244,_0x1f5e1d){if(_0x5d0c71<=0x0||isNaN(_0x5d0c71)){return _0x1f5e1d(msgResponse(_0x4e17('0x218'),'Error',_0x4e17('0x211')+_0x5d0c71));}if(_0x38fcc3<=0x0||isNaN(_0x38fcc3)){return _0x1f5e1d(msgResponse(_0x4e17('0x218'),_0x4e17('0x88'),_0x4e17('0x219')+_0x38fcc3));}if(_0x190dfa<=0x0||isNaN(_0x190dfa)){return _0x1f5e1d(msgResponse(_0x4e17('0x218'),_0x4e17('0x88'),_0x4e17('0x212')+_0x190dfa));}if(_0x109d2c<=0x0||isNaN(_0x109d2c)){return _0x1f5e1d(msgResponse(_0x4e17('0x218'),'Error',_0x4e17('0x213')+_0x109d2c));}if(_0x3f10b2<=0x0||isNaN(_0x3f10b2)){return _0x1f5e1d(msgResponse(_0x4e17('0x218'),'Error',_0x4e17('0x21a')+_0x3f10b2));}_0x40e3e5=_0x40e3e5||0x0;var _0x15db55=0x1/_0x38fcc3;var _0x1445fb=0x0;var _0x4cdba3=0x0;var _0x49ebdc=0x0;var _0x58953b=0x0;for(var _0x5ccba9=0x0;_0x58953b<_0x3f10b2;_0x5ccba9+=0x1){_0x4cdba3=_0x5ccba9/_0x109d2c;_0x1445fb=(_0x190dfa*_0x4cdba3+_0x40e3e5)/_0x15db55;_0x49ebdc=utils['erlangb'](_0x1445fb,_0x5d0c71);_0x58953b=_0x1445fb/_0x5d0c71*(0x1-utils[_0x4e17('0x215')](_0x1445fb,_0x5d0c71));}return _0x3c9244({'erlangCalls':_0x5ccba9,'erlangCallToSecond':_0x109d2c/_0x5ccba9,'erlangAbandonmentRate':_0x49ebdc,'erlangBusyFactor':_0x58953b});});};module[_0x4e17('0x21b')]=Dialer; \ No newline at end of file +var _0x4df3=['\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','length','push','Action','interval','timezones','content','indexOf','catch','command','true','OVERTIME_GLOBAL_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','handlePower','power','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','[ifTime][promiseAll]','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueId','uniqueid','ivr','updateOriginated','answertime','queue','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','getSeconds','responsetime','outboundDropCallsDayTimeout','state','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','minutes','ContactId','VoiceQueueId','[rescheduleContact][Drop]','statedesc','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','merge','idHopper','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','rescheduleContact','ListId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','syncVarSet','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','add','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','running','isPreviewCampaign','statusMessage','resolve','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','checkPreviewRecallReminder','clearZombieChannels','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','Agent','user:dialPreviewRecallReminder','handleIvr','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','reason\x205\x20busy','Congestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','outboundUnknownCallsDay','swapAdditionalPhones','Global','[moveContactManagedDialer][0]','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','available','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','predictiveIntervalErlangCallsDroppedCalls','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','loggedIn','erlangCallToSecond','milliseconds','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','floor','dialLimitQueue','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','moment','ioredis','./utils','./utils/hopper','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','NULL_INTERVAL'];(function(_0x168b2b,_0x36f554){var _0x4dab49=function(_0x2fbd34){while(--_0x2fbd34){_0x168b2b['push'](_0x168b2b['shift']());}};_0x4dab49(++_0x36f554);}(_0x4df3,0x1b5));var _0x34df=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x4df3[_0x1a595a];return _0x33f008;};'use strict';var util=require(_0x34df('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x34df('0x1'));var rr=require('rr');var Redis=require(_0x34df('0x2'));var utils=require(_0x34df('0x3'));var hopperUtils=require(_0x34df('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x34df('0x5'))(_0x34df('0x6'));var loggerBooked=require('../../../config/logger')(_0x34df('0x7'));var loggerPredictive=require(_0x34df('0x5'))(_0x34df('0x8'));var loggerPredictiveCalls=require(_0x34df('0x5'))(_0x34df('0x9'));var loggerSyncQueueSummary=require(_0x34df('0x5'))(_0x34df('0xa'));var ami=require(_0x34df('0xb'));config[_0x34df('0xc')]=_['defaults'](config[_0x34df('0xc')],{'host':_0x34df('0xd'),'port':0x18eb});var io=require(_0x34df('0xe'))(new Redis(config[_0x34df('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x34df('0xf'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x34df('0x10'));var Action=require(_0x34df('0x11'));var History=require(_0x34df('0x12'));var Final=require(_0x34df('0x13'));var AgentComplete=require(_0x34df('0x14'));var QueueCallerAbandon=require(_0x34df('0x15'));var Hangup=require('./models/hangup');var ipAgi=process[_0x34df('0x16')][_0x34df('0x17')]||_0x34df('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x34df('0x19')]['enqueue']=function(_0x4f481f){this[_0x34df('0x1a')]=this[_0x34df('0x1a')]?this[_0x34df('0x1a')][_0x34df('0x1b')](_0x4f481f):_0x4f481f();};function Dialer(_0x244789,_0x176efe){this[_0x34df('0x1c')]=new Sequence();this[_0x34df('0x1d')]=_0x176efe;this[_0x34df('0x1e')]=_0x244789[_0x34df('0x1e')];this[_0x34df('0x1f')]=_0x244789['campaigns'];this[_0x34df('0x20')]=_0x244789[_0x34df('0x20')];this[_0x34df('0x21')]=_0x244789['trunks'];this['maxNumberOriginate']=config[_0x34df('0x22')]||0x2;this['channels']={};this[_0x34df('0x23')]={};this[_0x34df('0x24')]={};this['uniqueId']={};this[_0x34df('0x25')]={};this[_0x34df('0x26')]={};this[_0x34df('0x27')]={};this[_0x34df('0x28')]={};this[_0x34df('0x29')]={};this[_0x34df('0x2a')]={};this[_0x34df('0x2b')]={};ami['on'](_0x34df('0x2c'),this[_0x34df('0x2d')]['bind'](this));ami['on'](_0x34df('0x2e'),this['syncQueueCallerAbandon'][_0x34df('0x2f')](this));ami['on']('originateresponse',this[_0x34df('0x30')][_0x34df('0x2f')](this));ami['on'](_0x34df('0x31'),this[_0x34df('0x32')][_0x34df('0x2f')](this));ami['on']('custom:queuesummary',this[_0x34df('0xa')][_0x34df('0x2f')](this));ami['on'](_0x34df('0x33'),this['syncQueueSummaryComplete'][_0x34df('0x2f')](this));ami['on'](_0x34df('0x34'),this[_0x34df('0x35')]['bind'](this));ami['on'](_0x34df('0x36'),this[_0x34df('0x37')][_0x34df('0x2f')](this));ami['on']('varset',this['syncVarSet'][_0x34df('0x2f')](this));ami['on'](_0x34df('0x38'),this[_0x34df('0x39')][_0x34df('0x2f')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this[_0x34df('0x3a')]();this[_0x34df('0x3b')]();RpcSetting[_0x34df('0x3c')]()[_0x34df('0x3d')](function(_0x1358d6){previewRecallmeReminderInterval=_0x1358d6[_0x34df('0x3e')];});}function isNotNull(_0x3e709c){return _0x3e709c!==null&&!_[_0x34df('0x3f')](_0x3e709c);}function msgResponse(_0x30d771,_0x2c0b6b,_0x1aee18){return{'action':_0x30d771,'response':_0x2c0b6b,'message':_0x1aee18,'stack':_0x1aee18};}function emit(_0x560b58,_0x303e56,_0xc4614b){io['to'](_0x560b58)['emit'](_0x303e56,_0xc4614b);}function emitOutboundVoiceQueueSummary(_0x342f8c){if(_0x342f8c[_0x34df('0x40')]==='outbound'){logger[_0x34df('0x41')](_0x34df('0x42'),util[_0x34df('0x43')](_0x342f8c,{'showHidden':![],'depth':null}));emit(util[_0x34df('0x44')](_0x34df('0x45'),_0x342f8c[_0x34df('0x46')]),_0x34df('0x47'),_0x342f8c);}}function checkGetDataPredictive(_0x54d66b){if(isNotNull(_0x54d66b)&&!_[_0x34df('0x48')](_0x54d66b)){loggerPredictive[_0x34df('0x49')](_0x34df('0x4a'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54d66b[_0x34df('0x4b')]);loggerPredictive['info'](_0x34df('0x4c'),_0x54d66b[_0x34df('0x4d')]);loggerPredictive[_0x34df('0x49')](_0x34df('0x4e'),_0x54d66b[_0x34df('0x4f')]);loggerPredictive[_0x34df('0x49')](_0x34df('0x50'),_0x54d66b[_0x34df('0x51')]);loggerPredictive[_0x34df('0x49')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54d66b['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x34df('0x49')](_0x34df('0x52'),_0x54d66b[_0x34df('0x53')]);loggerPredictive[_0x34df('0x49')]('---------------------------');if(_0x54d66b[_0x34df('0x4b')]>0x0){if(!_[_0x34df('0x3f')](_0x54d66b[_0x34df('0x53')])&&_0x54d66b[_0x34df('0x53')]>0x0){return!![];}loggerPredictive[_0x34df('0x49')](_0x34df('0x54'));if(!_[_0x34df('0x3f')](_0x54d66b[_0x34df('0x55')])&&_0x54d66b[_0x34df('0x55')]>0x0){return!![];}loggerPredictive[_0x34df('0x49')](_0x34df('0x56'));}else{loggerPredictive[_0x34df('0x49')](_0x34df('0x57'));}}else{loggerPredictive[_0x34df('0x49')](_0x34df('0x58'));}return![];}function mergeDataErlangB(_0x2bb624){return function(_0x98de1b){loggerPredictive['info'](_0x34df('0x59'));loggerPredictive[_0x34df('0x49')](_0x34df('0x5a'),_0x98de1b['erlangCalls']);loggerPredictive[_0x34df('0x49')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x98de1b['erlangCallToSecond']);loggerPredictive[_0x34df('0x49')](_0x34df('0x5b'),_0x98de1b[_0x34df('0x5c')]);loggerPredictive[_0x34df('0x49')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x98de1b[_0x34df('0x5d')]);loggerPredictive[_0x34df('0x49')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x98de1b[_0x34df('0x5c')]);loggerPredictive[_0x34df('0x49')]('---------------------------');_['merge'](_0x2bb624,_0x98de1b);};}function ifInterval(_0x552fed,_0x218b3d){if(_[_0x34df('0x3f')](_0x218b3d)){return![];}return utils['getSeconds'](undefined,_0x218b3d)<_0x552fed*0x3c;}function clearPredictiveAttributes(_0x50ec47){if(_0x50ec47[_0x34df('0x27')]){_0x50ec47[_0x34df('0x27')]=undefined;loggerPredictive[_0x34df('0x41')](_0x50ec47['name'],_0x34df('0x5e'));}if(_0x50ec47[_0x34df('0x26')]){_0x50ec47[_0x34df('0x26')]=undefined;loggerPredictive['debug'](_0x50ec47[_0x34df('0x46')],'startPredictive\x20value\x20cleared');}if(_0x50ec47[_0x34df('0x5f')]){clearInterval(_0x50ec47[_0x34df('0x5f')]);_0x50ec47[_0x34df('0x5f')]=undefined;loggerPredictive[_0x34df('0x41')](_0x50ec47[_0x34df('0x46')],_0x34df('0x60'));}}function loggerCatchPredictive(_0xf4cc1a,_0x24e6ec){return function(_0x1429e0){loggerPredictive['error'](_0x24e6ec[_0x34df('0x46')],_0xf4cc1a);loggerPredictive[_0x34df('0x61')](_0x1429e0[_0x34df('0x62')]);clearPredictiveAttributes(_0x24e6ec);};}function loggerCatch(_0x2f7814){return function(_0x4cc8aa){logger['error'](_0x2f7814,util[_0x34df('0x43')](_0x4cc8aa,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x14662b,_0x142c65,_0x32c2b8){return function(_0x595bbc){utils['checkContactLowerLimitOriginate'](_0x142c65,_0x32c2b8,0x0);logger[_0x34df('0x61')](_0x14662b,util['inspect'](_0x595bbc,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x496896){return function(_0x9ecfeb){if(isNotNull(_0x9ecfeb)&&isNotNull(_0x9ecfeb[0x0])){if(_0x9ecfeb[0x0][_0x34df('0x63')]>0x0){_0x496896[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x66')];logger[_0x34df('0x49')](_0x34df('0x67')+_0x496896[_0x34df('0x46')],_0x9ecfeb[0x0]['contactsRescheduled'],'contacts');}else{_0x496896[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x68')];logger[_0x34df('0x49')](_0x34df('0x69')+_0x496896[_0x34df('0x46')]);}}};}function createObjHistory(_0x2f1adb,_0x5859dd,_0x4f3e52,_0x2e1489,_0x5e7212){_0x2f1adb[_0x34df('0x64')]=_0x4f3e52;var _0x215d93=new Action(_0x2f1adb,_0x5859dd);var _0x16df66=new History(_0x215d93);_0x16df66['state']=_0x2e1489;_0x16df66['statedesc']=_0x5e7212;_0x16df66[_0x34df('0x6a')]=_0x215d93[_0x34df('0x6b')];return _0x16df66;}function unlockQueueStatus(_0x261ec1,_0x33ad92){setTimeout(function(){if(_[_0x34df('0x3f')](_0x261ec1[_0x34df('0x6c')])){loggerBooked[_0x34df('0x61')](_0x34df('0x6d'),_0x33ad92);}_0x261ec1[_0x34df('0x6c')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x33ad92,JSON[_0x34df('0x6e')](_[_0x34df('0x6f')](_0x261ec1,[_0x34df('0x46'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x5c01c0){return function(){if(!isNotNull(_0x5c01c0['Interval'])){_0x5c01c0[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x70')];throw _0x5c01c0[_0x34df('0x46')]+_0x34df('0x71');}if(!isNotNull(_0x5c01c0[_0x34df('0x72')][_0x34df('0x73')])){_0x5c01c0[_0x34df('0x64')]=utils[_0x34df('0x65')]['NULL_INTERVAL'];throw _0x5c01c0[_0x34df('0x46')]+_0x34df('0x71');}if(!isNotNull(_[_0x34df('0x48')](_0x5c01c0[_0x34df('0x72')]['Intervals']))){_0x5c01c0[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x70')];throw _0x5c01c0[_0x34df('0x46')]+_0x34df('0x71');}};}function checkIsIVRCampaignActive(_0x8818da){return function(){if(!utils[_0x34df('0x74')](_0x8818da)){_0x8818da[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x75')];throw _0x8818da[_0x34df('0x46')]+_0x34df('0x76');}};}function emitCampaignSummary(_0x46008e){if(utils[_0x34df('0x77')](_0x46008e)){emit(util[_0x34df('0x44')](_0x34df('0x78'),_0x46008e[_0x34df('0x46')]),_0x34df('0x79'),_0x46008e);}}function loggerCatchQueueSummary(_0x539c87,_0x4a8e72){return function(_0x5d01d1){clearPredictiveAttributes(_0x4a8e72);emitCampaignSummary(_0x4a8e72);loggerSyncQueueSummary[_0x34df('0x41')](_0x539c87,util[_0x34df('0x43')](_0x5d01d1,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x354512){if(_0x354512[_0x34df('0x7a')]){if(_0x354512[_0x34df('0x7b')]===0x0){_0x354512[_0x34df('0x7a')]=![];_0x354512['message']=utils[_0x34df('0x65')][_0x34df('0x75')];loggerSyncQueueSummary['debug'](_0x34df('0x7c'),_0x354512['name'],_0x34df('0x7d'));}else{_0x354512[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x7e')];loggerSyncQueueSummary[_0x34df('0x41')](_0x34df('0x7c'),_0x354512['name'],_0x34df('0x7f'));}emitCampaignSummary(_0x354512);}}function myreject(_0x29f60e){return function(_0x5e9d41){return _0x29f60e(msgResponse(_0x34df('0x80'),_0x34df('0x81'),JSON[_0x34df('0x6e')](_0x5e9d41)));};}Dialer[_0x34df('0x19')][_0x34df('0x82')]=function(_0x58a33b){return!_[_0x34df('0x3f')](_0x58a33b)&&_0x58a33b&&!_['isUndefined'](_0x58a33b[_0x34df('0x46')])&&!_[_0x34df('0x3f')](_0x58a33b['active'])&&_0x58a33b[_0x34df('0x83')]&&(this[_0x34df('0x21')][util['format'](_0x34df('0x84'),_0x58a33b[_0x34df('0x46')])][_0x34df('0x85')]===_0x34df('0x86')||this['trunks'][util[_0x34df('0x44')](_0x34df('0x84'),_0x58a33b[_0x34df('0x46')])][_0x34df('0x85')]===_0x34df('0x87'));};Dialer[_0x34df('0x19')][_0x34df('0x88')]=function(_0x151cfe){var _0x50ecdd=this;return function(){if(!_0x50ecdd[_0x34df('0x82')](_0x151cfe[_0x34df('0x89')])){if(!_0x50ecdd[_0x34df('0x82')](_0x151cfe[_0x34df('0x8a')])){_0x151cfe[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x8b')];throw _0x151cfe[_0x34df('0x46')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x34df('0x19')][_0x34df('0x8c')]=function(_0x3b2d4f,_0x2276c9,_0x50acb1,_0xc9904f){var _0x3a2224=this;return function(){var _0x2a628c=!![];return _0x3a2224['ifTimeIvr'](_0x3b2d4f,_0x2276c9,_0x50acb1,_0xc9904f,_0x2a628c);};};Dialer[_0x34df('0x19')][_0x34df('0x8d')]=function(_0x3d4d5b,_0x202cde,_0x233369,_0x1e9665){var _0x4930d3=this;return function(){var _0x41f4dc=![];return _0x4930d3[_0x34df('0x8e')](_0x3d4d5b[_0x34df('0x73')],_0x202cde,_0x233369,_0x1e9665,_0x41f4dc);};};Dialer[_0x34df('0x19')]['ifTimeIvr']=function(_0x2c9b09,_0x5ee3be,_0x17e27c,_0x2fb9a1,_0x590cba){var _0x404b17=[];return new Promise(function(_0x169a18,_0x23c485){if(!isNotNull(_0x2c9b09)){_0x2fb9a1[_0x34df('0x64')]=utils[_0x34df('0x65')]['NULL_INTERVAL'];return _0x23c485(msgResponse(_0x34df('0x8f'),_0x34df('0x90'),_0x17e27c+_0x34df('0x91')));}if(_[_0x34df('0x48')](_0x2c9b09)){_0x2fb9a1[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x92')];return _0x23c485(msgResponse(_0x34df('0x8f'),_0x34df('0x90'),_0x17e27c+_0x34df('0x93')));}if(_0x5ee3be&&_[_0x34df('0x3f')](config['timezones'][_0x5ee3be])){_0x2fb9a1[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x94')];return _0x23c485(msgResponse('ifTime',_0x34df('0x90'),_0x17e27c+'\x20Timezone\x20unknow\x20'+_0x5ee3be));}if(_[_0x34df('0x95')](_0x2c9b09)){for(var _0x179ba5=0x0;_0x179ba5<_0x2c9b09[_0x34df('0x96')];_0x179ba5+=0x1){_0x404b17[_0x34df('0x97')](ami[_0x34df('0x98')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x2c9b09[_0x179ba5][_0x34df('0x99')],!_[_0x34df('0x3f')](config[_0x34df('0x9a')][_0x5ee3be])?_0x5ee3be:'')})['then'](function(_0xf60df7){return _0xf60df7[_0x34df('0x9b')][_0x34df('0x9c')]('true')>=0x0;})[_0x34df('0x9d')](myreject(_0x23c485)));}}else{_0x404b17[_0x34df('0x97')](ami[_0x34df('0x98')]({'action':_0x34df('0x9e'),'command':util[_0x34df('0x44')]('iftime\x20%s,%s',_0x2c9b09,!_[_0x34df('0x3f')](config['timezones'][_0x5ee3be])?_0x5ee3be:'')})[_0x34df('0x3d')](function(_0x59483b){return _0x59483b[_0x34df('0x9b')]['indexOf'](_0x34df('0x9f'))>=0x0;})['catch'](myreject(_0x23c485)));}Promise['all'](_0x404b17)[_0x34df('0x3d')](function(_0x1bb197){var _0x521f41=_['some'](_0x1bb197);if(_0x521f41){return _0x169a18(_0x521f41);}else{_0x2fb9a1[_0x34df('0x64')]=_0x590cba?utils[_0x34df('0x65')][_0x34df('0xa0')]:utils[_0x34df('0x65')]['OVERTIME_INTERVAL'];return _0x23c485(msgResponse('[ifTime][promiseAll]',_0x34df('0x90'),_0x34df('0xa1')+_0x590cba+'\x20'+_0x17e27c+_0x34df('0xa2')+util[_0x34df('0x43')](_0x2c9b09,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5ee3be));}})[_0x34df('0x9d')](function(_0x2059ec){return _0x23c485(msgResponse(_0x34df('0x8f'),_0x34df('0x90'),JSON[_0x34df('0x6e')](_0x2059ec)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x249512=this;return cmHopper[_0x34df('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0x34df('0x3d')](function(){setInterval(function(){_0x249512[_0x34df('0xa4')]();},0x3e8);});};Dialer[_0x34df('0x19')][_0x34df('0xa4')]=function(){var _0x3a2241=this;var _0x548663;for(var _0x2d5e3f in this['campaigns']){if(typeof this[_0x34df('0x1f')][_0x2d5e3f]!==_0x34df('0xa5')){_0x548663=this[_0x34df('0x1f')][_0x2d5e3f];if(utils[_0x34df('0x77')](_0x548663)&&utils[_0x34df('0x74')](_0x548663)){_0x548663[_0x34df('0x7a')]=!![];Promise['resolve']()[_0x34df('0x3d')](checkIsIVRCampaignActive(_0x548663))[_0x34df('0x3d')](checkInterval(_0x548663))[_0x34df('0x3d')](_0x3a2241[_0x34df('0x88')](_0x548663))[_0x34df('0x3d')](_0x3a2241['checkIfTime'](_0x548663[_0x34df('0xa6')],_0x548663[_0x34df('0xa7')],_0x548663[_0x34df('0x46')],_0x548663))[_0x34df('0x3d')](_0x3a2241[_0x34df('0x8d')](_0x548663[_0x34df('0x72')],_0x548663[_0x34df('0xa7')],_0x548663[_0x34df('0x46')],_0x548663))['then'](_0x3a2241[_0x34df('0xa8')](_0x548663))[_0x34df('0x9d')](loggerCatchQueueSummary(_0x34df('0xa9'),_0x548663));}else{notSendMessagesCampaign(_0x548663);}}}};Dialer['prototype']['checkDialMethod']=function(_0x4cfbe3){if(_0x4cfbe3[_0x34df('0xaa')]!=='predictive'){clearPredictiveAttributes(_0x4cfbe3);}switch(_0x4cfbe3[_0x34df('0xaa')]){case'progressive':this[_0x34df('0xab')](_0x4cfbe3,0x1);break;case _0x34df('0xac'):this[_0x34df('0xab')](_0x4cfbe3,_0x4cfbe3['dialPowerLevel']);break;case'predictive':this[_0x34df('0x8')](_0x4cfbe3);break;case'booked':this[_0x34df('0xab')](_0x4cfbe3,0x1);break;default:logger[_0x34df('0x61')](_0x34df('0xad'),_0x4cfbe3['name'],_0x34df('0xae'));}};Dialer['prototype'][_0x34df('0x8f')]=function(_0x3fd411,_0x2906b6){var _0x46becc=_0x3fd411['dialTimezone'];var _0x14560f=_0x2906b6?_0x3fd411['dialGlobalInterval']:_0x3fd411[_0x34df('0x72')]['Intervals'];logger[_0x34df('0xaf')]('Dialer::ifTime()',_0x14560f,_0x46becc,_0x3fd411['name'],util[_0x34df('0x44')](_0x34df('0xb0'),_0x3fd411[_0x34df('0x46')],_0x3fd411['id']));var _0x58d24=null;return Interval['intervalIftime'](_0x14560f,_0x46becc)[_0x34df('0x3d')](function(_0x5e82d2){if(_0x5e82d2===!![]){return _0x5e82d2;}else{_0x3fd411['message']=_0x2906b6?utils[_0x34df('0x65')][_0x34df('0xa0')]:utils[_0x34df('0x65')]['OVERTIME_INTERVAL'];_0x58d24=msgResponse(_0x34df('0xb1'),_0x34df('0x90'),_0x34df('0xa1')+_0x2906b6+'\x20'+_0x3fd411[_0x34df('0x46')]+_0x34df('0xa2')+util['inspect'](_0x14560f,{'showHidden':![],'depth':null})+_0x34df('0xb2')+_0x46becc);}if(_0x58d24!==null){logger['silly'](_0x34df('0xb3'),_0x58d24);_0x58d24[_0x34df('0xb4')]=_0x2906b6;throw _0x58d24;}})[_0x34df('0x9d')](function(_0x2d6a52){logger['error'](_0x34df('0xb5'),_0x2d6a52);throw msgResponse('[ifTime][Action]',_0x34df('0x81'),util[_0x34df('0x43')](_0x2d6a52,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x34df('0x2d')]=function(_0x297457){if(this[_0x34df('0x1e')][_0x297457['queue']]){if(this[_0x34df('0xb6')][_0x297457[_0x34df('0xb7')]]&&this[_0x34df('0xb6')][_0x297457[_0x34df('0xb7')]]['type']!==_0x34df('0xb8')){this[_0x34df('0xb9')](this[_0x34df('0x1e')][_0x297457['queue']]);this[_0x34df('0xb6')][_0x297457[_0x34df('0xb7')]][_0x34df('0xba')]=moment()[_0x34df('0x44')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x34df('0x19')][_0x34df('0x32')]=function(_0x43e590){var _0x2c8be3=this[_0x34df('0xb6')][_0x43e590[_0x34df('0xb7')]];if(this[_0x34df('0x1e')][_0x43e590[_0x34df('0xbb')]]){if(_0x2c8be3&&_0x2c8be3['type']!==_0x34df('0xb8')){delete this[_0x34df('0xb6')][_0x43e590[_0x34df('0xb7')]];this[_0x34df('0x1e')][_0x43e590['queue']][_0x34df('0xbc')]+=0x1;var _0x434a3c=new AgentComplete(_0x2c8be3,_0x43e590);if(_0x43e590['reason']===_0x34df('0xbd')){_0x434a3c[_0x34df('0xbe')]=this[_0x34df('0x1e')][_0x43e590[_0x34df('0xbb')]][_0x34df('0xbf')]&&this['voiceQueues'][_0x43e590[_0x34df('0xbb')]]['dialAgiAfterHangupAgent']?moment()[_0x34df('0x44')](_0x34df('0xc0')):undefined;}hopperUtils[_0x34df('0xc1')](_0x434a3c)['catch'](loggerCatch(_0x34df('0xc2')));hopperUtils[_0x34df('0xc3')](_0x434a3c)[_0x34df('0x9d')](loggerCatch(_0x34df('0xc4')));}}};Dialer[_0x34df('0x19')][_0x34df('0xc5')]=function(_0x223b00){var _0x252474=this[_0x34df('0xb6')][_0x223b00[_0x34df('0xb7')]];var _0x1851c6=this;var _0x2c8c0b=![];var _0x5967e5;var _0x4f79a9;if(this[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]]){if(_0x252474&&_0x252474[_0x34df('0x40')]!==_0x34df('0xb8')){delete this['uniqueId'][_0x223b00[_0x34df('0xb7')]];this[_0x34df('0xb9')](this['voiceQueues'][_0x223b00['queue']]);_0x252474[_0x34df('0xc6')]=moment()['format'](_0x34df('0xc0'));var _0x5dc584=new QueueCallerAbandon(_0x252474,_0x223b00);if(utils[_0x34df('0xc7')](_0x252474[_0x34df('0xc6')],_0x252474[_0x34df('0xc8')])>=_0x252474['dialQueueTimeout']){this[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]][_0x34df('0x4f')]+=0x1;this[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]][_0x34df('0xc9')]+=0x1;this[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5dc584[_0x34df('0xca')]=0xa;_0x5dc584['statedesc']='Drop';_0x5dc584[_0x34df('0xcb')]=_0x34df('0xcc');_0x5dc584[_0x34df('0xbe')]=this[_0x34df('0x1e')][_0x223b00['queue']][_0x34df('0xbf')]?moment()[_0x34df('0x44')](_0x34df('0xc0')):undefined;_0x5dc584[_0x34df('0xcd')]+=0x1;_0x5dc584[_0x34df('0xce')]+=0x1;_0x5967e5=this['voiceQueues'][_0x223b00[_0x34df('0xbb')]][_0x34df('0xcf')];_0x4f79a9=this[_0x34df('0x1e')][_0x223b00['queue']][_0x34df('0xd0')];hopperUtils[_0x34df('0xd1')](_0x5dc584,_0x5dc584[_0x34df('0xca')],_0x252474[_0x34df('0xd2')])['then'](function(_0x25947a){_0x2c8c0b=_0x25947a[_0x34df('0xd3')]==0x1;if(_0x5dc584[_0x34df('0xcd')]>=_0x1851c6[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]][_0x34df('0xd4')]){_0x1851c6[_0x34df('0xd5')](_0x5dc584,_0x25947a['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x5dc584[_0x34df('0xcd')],'scheduledat':moment()['add'](_0x1851c6[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]][_0x34df('0xcf')],_0x34df('0xd6'))['format'](_0x34df('0xc0')),'ContactId':_0x252474[_0x34df('0xd7')],'ListId':_0x252474['ListId'],'VoiceQueueId':_0x252474[_0x34df('0xd8')]||undefined,'CampaignId':_0x252474['CampaignId']||undefined})['catch'](loggerCatch(_0x34df('0xd9')));var _0x2f15c6=new History(_0x5dc584);_0x2f15c6[_0x34df('0xca')]=0xa;_0x2f15c6[_0x34df('0xda')]=_0x34df('0xdb');_0x2f15c6[_0x34df('0x6b')]=moment()[_0x34df('0x44')](_0x34df('0xc0'));_0x2f15c6['endtime']=_0x2f15c6['starttime'];_0x2f15c6[_0x34df('0xdc')]=_0x5dc584[_0x34df('0xdc')];_0x2f15c6[_0x34df('0xdd')]=_0x5dc584['calleridnum'];hopperUtils[_0x34df('0xc1')](_0x2f15c6)[_0x34df('0x9d')](loggerCatch(_0x34df('0xde')));}})[_0x34df('0x3d')](function(){if(_0x2c8c0b)hopperUtils['swapAdditionalPhones'](_0x5dc584,_0x5967e5,_0x4f79a9)[_0x34df('0x3d')](function(){return 0x1;});});}else{this[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x34df('0x1e')][_0x223b00['queue']][_0x34df('0xdf')]+=0x1;_0x5dc584[_0x34df('0xca')]=0xb;_0x5dc584[_0x34df('0xda')]=_0x34df('0xe0');_0x5dc584[_0x34df('0xcb')]=_0x34df('0xe1');_0x5dc584[_0x34df('0xe2')]+=0x1;_0x5dc584[_0x34df('0xce')]+=0x1;_0x5967e5=this['voiceQueues'][_0x223b00['queue']][_0x34df('0xe3')];_0x4f79a9=this[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]][_0x34df('0xd0')];hopperUtils[_0x34df('0xd1')](_0x5dc584,_0x5dc584[_0x34df('0xca')],_0x252474['voiceQueue'])['then'](function(_0x369525){if(_0x5dc584[_0x34df('0xe2')]>=_0x1851c6[_0x34df('0x1e')][_0x223b00[_0x34df('0xbb')]][_0x34df('0xe4')]){_0x1851c6['queueCallerAbandonCreateState'](_0x5dc584,_0x369525[_0x34df('0xd3')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5dc584[_0x34df('0xe2')],'scheduledat':moment()['add'](_0x1851c6[_0x34df('0x1e')][_0x223b00['queue']]['dialAbandonedRetryFrequency'],_0x34df('0xd6'))[_0x34df('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x252474[_0x34df('0xd7')],'ListId':_0x252474['ListId'],'VoiceQueueId':_0x252474[_0x34df('0xd8')]||undefined,'CampaignId':_0x252474[_0x34df('0xe5')]||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0xe6')));var _0x1f22a7=new History(_0x5dc584);_0x1f22a7[_0x34df('0xca')]=0xb;_0x1f22a7[_0x34df('0xda')]='Abandoned';_0x1f22a7[_0x34df('0x6b')]=moment()[_0x34df('0x44')](_0x34df('0xc0'));_0x1f22a7[_0x34df('0x6a')]=_0x1f22a7['starttime'];_0x1f22a7[_0x34df('0xdc')]=_0x5dc584['calleridname'];_0x1f22a7[_0x34df('0xdd')]=_0x5dc584[_0x34df('0xdd')];hopperUtils[_0x34df('0xc1')](_0x1f22a7)[_0x34df('0x9d')](loggerCatch(_0x34df('0xe7')));}})['then'](function(){if(_0x2c8c0b)hopperUtils['swapAdditionalPhones'](_0x5dc584,_0x5967e5,_0x4f79a9)['then'](function(){return 0x1;});});}}}};Dialer[_0x34df('0x19')][_0x34df('0x37')]=function(_0x1099e1){if(this[_0x34df('0x23')][_0x1099e1['uniqueid']]){this[_0x34df('0x23')][_0x1099e1[_0x34df('0xb7')]][_0x34df('0xe8')]=_0x1099e1['channel'];}if(this['uniqueId'][_0x1099e1[_0x34df('0xb7')]]){this['uniqueId'][_0x1099e1['uniqueid']]['channel']=_0x1099e1['channel'];}};Dialer[_0x34df('0x19')][_0x34df('0x39')]=function(_0x5a4cd3){if(!this[_0x34df('0x23')][_0x5a4cd3[_0x34df('0xe9')]]){return;}var _0x4bb598=this[_0x34df('0x1e')][this[_0x34df('0x23')][_0x5a4cd3[_0x34df('0xe9')]][_0x34df('0xbb')]][_0x34df('0xea')]||_0x34df('0xeb');if(_0x4bb598===_0x34df('0xec')){if(this['actions'][_0x5a4cd3[_0x34df('0xe9')]]&&_[_0x34df('0xed')](this[_0x34df('0x23')][_0x5a4cd3['actionid']][_0x34df('0xee')])&&_0x5a4cd3[_0x34df('0x85')]==='1'&&_0x5a4cd3[_0x34df('0xef')]==='0'){if(this[_0x34df('0x20')][_0x5a4cd3[_0x34df('0xf0')]]){if(!this[_0x34df('0x20')][_0x5a4cd3[_0x34df('0xf0')]][_0x34df('0xee')]){this[_0x34df('0x20')][_0x5a4cd3[_0x34df('0xf0')]]['locked']=!![];this[_0x34df('0x23')][_0x5a4cd3['actionid']][_0x34df('0xee')]=!![];this[_0x34df('0x23')][_0x5a4cd3[_0x34df('0xe9')]][_0x34df('0xf0')]=_0x5a4cd3['stateinterface'];}}}}else if(_0x4bb598===_0x34df('0xeb')){if(this['actions'][_0x5a4cd3[_0x34df('0xe9')]]){if(this[_0x34df('0x20')][_0x5a4cd3[_0x34df('0xf0')]]){this['actions'][_0x5a4cd3[_0x34df('0xe9')]][_0x34df('0xf0')]=_0x5a4cd3[_0x34df('0xf0')];if(_[_0x34df('0xed')](this[_0x34df('0x29')][this[_0x34df('0x23')][_0x5a4cd3[_0x34df('0xe9')]][_0x34df('0xbb')]])){this[_0x34df('0x29')][this[_0x34df('0x23')][_0x5a4cd3[_0x34df('0xe9')]][_0x34df('0xbb')]]=[];}this[_0x34df('0x29')][this[_0x34df('0x23')][_0x5a4cd3[_0x34df('0xe9')]][_0x34df('0xbb')]]['push'](_[_0x34df('0xf1')](_[_0x34df('0x6f')](this[_0x34df('0x23')][_0x5a4cd3['actionid']],[_0x34df('0xf2'),_0x34df('0xf0')]),{'status':_0x5a4cd3[_0x34df('0x85')],'paused':_0x5a4cd3['paused']}));}}}};Dialer[_0x34df('0x19')][_0x34df('0xf3')]=function(_0x58056f){if(!this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]]){return;}var _0x333bfe=this;var _0x1c1b4a=this[_0x34df('0x1e')][this['actions'][_0x58056f[_0x34df('0xe9')]][_0x34df('0xbb')]];var _0x110c3f=_0x1c1b4a['strategy']||_0x34df('0xeb');if(_0x110c3f===_0x34df('0xec')){if(this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]]&&this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xf0')]){this[_0x34df('0x1d')][_0x34df('0xf4')](this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xf2')],this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xf0')])[_0x34df('0x9d')](function(_0x73ce14){logger[_0x34df('0x61')](_0x34df('0xf5'),util['inspect'](_0x73ce14,{'showHidden':![],'depth':null}));})[_0x34df('0x1b')](function(){_0x333bfe[_0x34df('0xb9')](_0x333bfe[_0x34df('0x1e')][_0x333bfe[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xbb')]]);_0x333bfe[_0x34df('0x20')][_0x333bfe[_0x34df('0x23')][_0x58056f['actionid']][_0x34df('0xf0')]][_0x34df('0xee')]=![];delete _0x333bfe['actions'][_0x58056f['actionid']];unlockQueueStatus(_0x1c1b4a);});}else{this[_0x34df('0xb9')](this[_0x34df('0x1e')][this['actions'][_0x58056f['actionid']][_0x34df('0xbb')]]);hopperUtils[_0x34df('0xf6')]({'active':![],'ContactId':this['actions'][_0x58056f[_0x34df('0xe9')]]['ContactId'],'ListId':this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xf7')],'VoiceQueueId':this['actions'][_0x58056f[_0x34df('0xe9')]][_0x34df('0xd8')]||undefined,'CampaignId':this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xe5')]||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0xf8')));delete this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]];unlockQueueStatus(_0x1c1b4a);}}else if(_0x110c3f==='rrmemory'){var _0x4f0924;if(this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]]&&!_[_0x34df('0x48')](this['queueBooked'][this['actions'][_0x58056f[_0x34df('0xe9')]][_0x34df('0xbb')]])){if(this[_0x34df('0x2a')][_0x333bfe['actions'][_0x58056f[_0x34df('0xe9')]][_0x34df('0xbb')]]){this['queueBookedRR'][_0x333bfe['actions'][_0x58056f[_0x34df('0xe9')]][_0x34df('0xbb')]]=this[_0x34df('0x2a')][this['actions'][_0x58056f['actionid']][_0x34df('0xbb')]]?this[_0x34df('0x2a')][this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]]['queue']]:this['queueBooked'][this['actions'][_0x58056f[_0x34df('0xe9')]]['queue']]?this[_0x34df('0x29')][this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xbb')]][_0x34df('0xf9')]||0x0:0x0;}this[_0x34df('0x29')][this[_0x34df('0x23')][_0x58056f[_0x34df('0xe9')]][_0x34df('0xbb')]]['_rr']=this[_0x34df('0x2a')][this['actions'][_0x58056f['actionid']]['queue']];for(var _0x51feea=0x0;_0x51feea=_0x522744['dialGlobalMaxRetry']){_0xb545bb[_0x34df('0x11e')](_0x9f7ed9,_0x355906,_0x1e655b,_0x34df('0x11f'));}else{if(_0x9f7ed9[_0x34df('0x117')]>=_0x522744['dialMachineMaxRetry']){_0xb545bb[_0x34df('0x120')](_0x9f7ed9,_0x355906,_0x1e655b,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x9f7ed9[_0x34df('0x117')],'scheduledat':moment()[_0x34df('0x121')](_0x522744['dialMachineRetryFrequency'],_0x34df('0xd6'))['format'](_0x34df('0xc0')),'ContactId':_0x9f7ed9[_0x34df('0xd7')],'ListId':_0x9f7ed9[_0x34df('0xf7')],'VoiceQueueId':_0x9f7ed9[_0x34df('0xd8')]||undefined,'CampaignId':_0x9f7ed9[_0x34df('0xe5')]||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x122')));_0x355906({'reschedule':0x1});}}});}if(_0x91a685[_0x34df('0x40')]===_0x34df('0xb8')&&this['campaigns'][_0x91a685[_0x34df('0xbb')]][_0x34df('0x109')]&&_0x7f22e5[_0x34df('0x10a')]==='HANGUP'){delete this[_0x34df('0xb6')][_0x7f22e5[_0x34df('0xb7')]];this[_0x34df('0xb9')](this[_0x34df('0x1f')][_0x91a685[_0x34df('0xbb')]]);_0x4d2785=new Hangup(_0x91a685,_0x7f22e5);_0x4d2785[_0x34df('0xca')]=0x12;_0x4d2785['statedesc']='HangupInAMD';_0x4d2785[_0x34df('0x10d')]='AMD';ami['emit'](_0x34df('0x110'),ut[_0x34df('0x111')](_0x4d2785,_0x34df('0x112')));this[_0x34df('0x123')](_0x4d2785,_0x34df('0x124'),_0x34df('0x125'));}if(_0x91a685['type']===_0x34df('0xb8')&&this[_0x34df('0x1f')][_0x91a685[_0x34df('0xbb')]][_0x34df('0x109')]&&_0x7f22e5['value']==='MACHINE'){return new Promise(function(_0x52527b,_0x274a6d){delete _0xb545bb['uniqueId'][_0x7f22e5[_0x34df('0xb7')]];_0xb545bb['updateOriginated'](_0xb545bb[_0x34df('0x1f')][_0x91a685[_0x34df('0xbb')]]);_0xb545bb[_0x34df('0x1f')][_0x91a685[_0x34df('0xbb')]]['outboundAnswerCallsDay']+=0x1;_0xb545bb[_0x34df('0x1f')][_0x91a685[_0x34df('0xbb')]][_0x34df('0x10c')]+=0x1;var _0x575983=_0xb545bb[_0x34df('0x1f')][_0x91a685[_0x34df('0xbb')]];var _0x15df26=new Hangup(_0x91a685,_0x7f22e5);_0x15df26[_0x34df('0xca')]=0x13;_0x15df26[_0x34df('0xda')]=_0x34df('0x116');_0x15df26[_0x34df('0x10d')]=_0x34df('0x10e');_0x15df26[_0x34df('0x117')]+=0x1;_0x15df26[_0x34df('0xce')]+=0x1;_0x15df26[_0x34df('0x112')]=!![];ami['emit']('custom:amd',ut[_0x34df('0x111')](_0x15df26,_0x34df('0x112')));hopperUtils[_0x34df('0xc1')](_0x15df26)[_0x34df('0x9d')](loggerCatch(_0x34df('0x118')));if(_0x15df26[_0x34df('0x119')]+_0x15df26[_0x34df('0x11a')]+_0x15df26[_0x34df('0x11b')]+_0x15df26['countnosuchnumberretry']+_0x15df26['countdropretry']+_0x15df26[_0x34df('0xe2')]+_0x15df26[_0x34df('0x117')]+_0x15df26['countagentrejectretry']>=_0x575983[_0x34df('0x126')]){_0xb545bb[_0x34df('0x11e')](_0x15df26,_0x52527b,_0x274a6d,_0x34df('0x11f'));}else{if(_0x15df26[_0x34df('0x117')]>=_0x575983[_0x34df('0x127')]){_0xb545bb[_0x34df('0x120')](_0x15df26,_0x52527b,_0x274a6d,_0x34df('0x128'));}else{hopperUtils[_0x34df('0xf6')]({'active':![],'countmachineretry':_0x15df26['countmachineretry'],'scheduledat':moment()[_0x34df('0x121')](_0x575983[_0x34df('0x129')],_0x34df('0xd6'))[_0x34df('0x44')](_0x34df('0xc0')),'ContactId':_0x15df26[_0x34df('0xd7')],'ListId':_0x15df26['ListId'],'VoiceQueueId':_0x15df26['VoiceQueueId']||undefined,'CampaignId':_0x15df26[_0x34df('0xe5')]||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x122')));_0x52527b({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x34df('0x35')]=function(_0x1a918b){var _0x299b5f=this[_0x34df('0xb6')][_0x1a918b[_0x34df('0xb7')]];var _0x472652;if(_0x299b5f&&_0x299b5f[_0x34df('0x40')]===_0x34df('0xb8')){delete this[_0x34df('0xb6')][_0x1a918b['uniqueid']];this[_0x34df('0xb9')](this[_0x34df('0x1f')][_0x299b5f[_0x34df('0xbb')]]);this[_0x34df('0x1f')][_0x299b5f[_0x34df('0xbb')]][_0x34df('0x12a')]+=0x1;_0x472652=new Hangup(_0x299b5f,_0x1a918b);hopperUtils[_0x34df('0xc1')](_0x472652)['catch'](loggerCatch(_0x34df('0x12b')));hopperUtils[_0x34df('0xc3')](_0x472652)[_0x34df('0x9d')](loggerCatch(_0x34df('0x12c')));}if(_0x299b5f&&_0x299b5f[_0x34df('0x40')]!=='ivr'&&isNotNull(this[_0x34df('0x1e')][_0x299b5f[_0x34df('0xbb')]][_0x34df('0x12d')])){delete this['uniqueId'][_0x1a918b['uniqueid']];this[_0x34df('0xb9')](this[_0x34df('0x1e')][_0x299b5f['queue']]);this['voiceQueues'][_0x299b5f[_0x34df('0xbb')]]['outboundAnswerCallsDay']+=0x1;this[_0x34df('0x1e')][_0x299b5f[_0x34df('0xbb')]][_0x34df('0x10c')]+=0x1;_0x472652=new Hangup(_0x299b5f,_0x1a918b);_0x472652['state']=0x10;_0x472652['statedesc']='AnswerAGI';_0x472652['membername']=_0x34df('0x12e');hopperUtils[_0x34df('0xc1')](_0x472652)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x34df('0xc3')](_0x472652)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x299b5f&&_0x299b5f[_0x34df('0x40')]!==_0x34df('0xb8')&&!isNotNull(this[_0x34df('0x1e')][_0x299b5f[_0x34df('0xbb')]][_0x34df('0x12d')])){delete this[_0x34df('0xb6')][_0x1a918b[_0x34df('0xb7')]];this[_0x34df('0xb9')](this[_0x34df('0x1e')][_0x299b5f['queue']]);this[_0x34df('0x1e')][_0x299b5f[_0x34df('0xbb')]]['outboundUnknownCallsDay']+=0x1;_0x472652=new Hangup(_0x299b5f,_0x1a918b);_0x472652[_0x34df('0xca')]=0xc;_0x472652['statedesc']=_0x1a918b[_0x34df('0x12f')];_0x472652['membername']='Unknow';hopperUtils[_0x34df('0xc1')](_0x472652)[_0x34df('0x9d')](loggerCatch(_0x34df('0x12b')));hopperUtils['moveContactManagedDialer'](_0x472652)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x34df('0x19')]['syncQueueSummary']=function(_0x3f5fcf){var _0x460ee6=this;if(!_0x460ee6[_0x34df('0x2b')][_0x3f5fcf[_0x34df('0x46')]]){_0x460ee6[_0x34df('0x2b')][_0x3f5fcf[_0x34df('0x46')]]={'running':![]};}else if(_0x460ee6[_0x34df('0x2b')][_0x3f5fcf[_0x34df('0x46')]]['running']===!![]){return;}else if(_0x460ee6[_0x34df('0x2b')][_0x3f5fcf[_0x34df('0x46')]][_0x34df('0x130')]===![]){_0x460ee6[_0x34df('0x2b')][_0x3f5fcf[_0x34df('0x46')]]['running']=!![];}var _0x496d50=_0x460ee6['voiceQueues'][_0x3f5fcf['name']];var _0x5eb4d4=_0x496d50[_0x34df('0x64')]!==utils['CAMPAIGN_STATUS'][_0x34df('0x75')];var _0x4f1cc0=utils[_0x34df('0x131')](_0x496d50);_0x496d50[_0x34df('0x132')]=utils['getQueueCampaignStatusMessage'](_0x496d50,_0x460ee6[_0x34df('0x21')]);Promise[_0x34df('0x133')]()[_0x34df('0x3d')](function(){if(_0x496d50[_0x34df('0x132')]===utils[_0x34df('0x65')][_0x34df('0x75')]){if(_0x5eb4d4){clearPredictiveAttributes(_0x496d50);_0x3f5fcf[_0x34df('0x26')]=undefined;_0x3f5fcf[_0x34df('0x27')]=undefined;}if(_0x496d50[_0x34df('0x132')]===utils[_0x34df('0x65')][_0x34df('0x75')]){_0x3f5fcf['available']=0x0;_0x3f5fcf[_0x34df('0xef')]=0x0;_0x3f5fcf[_0x34df('0x134')]=0x0;_0x3f5fcf[_0x34df('0x135')]=0x0;_0x3f5fcf[_0x34df('0x136')]=0x0;}}else if(_0x496d50[_0x34df('0x132')]===utils['CAMPAIGN_STATUS'][_0x34df('0x137')]&&!_0x4f1cc0){return _0x460ee6[_0x34df('0x8f')](_0x496d50,!![])['then'](function(){return _0x460ee6[_0x34df('0x8f')](_0x496d50,![]);})['then'](function(){return _0x460ee6[_0x34df('0x138')](_0x496d50);})['catch'](function(_0x12bae1){loggerSyncQueueSummary['debug'](_0x34df('0x139'),util[_0x34df('0x43')](_0x12bae1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x496d50);});}else{clearPredictiveAttributes(_0x496d50);}})[_0x34df('0x3d')](function(){var _0x4ff6f2=_0x3f5fcf[_0x34df('0x13a')](_0x496d50);if(_0x4ff6f2||_0x496d50['queueSummaryCountersUpdated']){_0x496d50[_0x34df('0x13b')]=![];_0x3f5fcf[_0x34df('0x13c')](_0x496d50);Object[_0x34df('0x13d')](_0x496d50,_0x3f5fcf);emitOutboundVoiceQueueSummary(_0x3f5fcf);}_0x460ee6[_0x34df('0x2b')][_0x496d50[_0x34df('0x46')]]['running']=![];})[_0x34df('0x9d')](function(_0xb93c23){logger['error'](_0x34df('0x139'),util[_0x34df('0x43')](_0xb93c23,{'showHidden':![],'depth':null}));_0x460ee6['queuesSummary'][_0x496d50[_0x34df('0x46')]][_0x34df('0x130')]=![];});};Dialer[_0x34df('0x19')][_0x34df('0x13e')]=_[_0x34df('0x13f')](function(){var _0x47663a=_[_0x34df('0x140')](this[_0x34df('0x1e')],function(_0xcd692){return _0xcd692[_0x34df('0x141')];});var _0x6cbdb9=_['filter'](this[_0x34df('0x20')],function(_0x1bc39c){return _0x1bc39c['online']&&_0x1bc39c['status']===_0x34df('0x86');});if(_0x47663a[_0x34df('0x96')]>0x0&&_0x6cbdb9[_0x34df('0x96')]>0x0){return Promise['resolve']()[_0x34df('0x3d')](cmHopper[_0x34df('0x142')](_[_0x34df('0x143')](_0x47663a,'id'),previewRecallmeReminderInterval,_[_0x34df('0x143')](_0x6cbdb9,'id')))[_0x34df('0x3d')](function(_0x171416){for(var _0x184c34=0x0;_0x184c34<_0x171416[_0x34df('0x96')];_0x184c34++){var _0x63a9e2=_0x171416[_0x184c34]['Agent'][_0x34df('0x46')];if(_0x63a9e2)io['to'](util[_0x34df('0x44')](_0x34df('0x144'),_0x63a9e2))[_0x34df('0x10f')]('user:dialPreviewRecallReminder',{'hopper':_0x171416[_0x184c34]});}})['catch'](function(_0x147a3e){logger[_0x34df('0x61')](_0x34df('0x145'),_0x147a3e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x34df('0x19')][_0x34df('0x3b')]=function(){var _0x19faa7=this;setInterval(function(){_0x19faa7[_0x34df('0x146')](_0x19faa7[_0x34df('0xb6')],'[uniqueid]');_0x19faa7['clearZombieChannels'](_0x19faa7[_0x34df('0x23')],_0x34df('0x147'));},0x32c8);};Dialer[_0x34df('0x19')]['clearZombieChannels']=function(_0x52c5cc,_0xfc82f){var _0x4d5212=this;for(var _0xaa0118 in _0x52c5cc){if(typeof _0x52c5cc[_0xaa0118]!==_0x34df('0xa5')){this['sequence'][_0x34df('0x148')](function(){if(!_[_0x34df('0xed')](_0x52c5cc[_0xaa0118])){return ami['Action']({'action':_0x34df('0x85'),'channel':_0x52c5cc[_0xaa0118][_0x34df('0xe8')]})[_0x34df('0x9d')](function(_0x45b56c){if(_0x45b56c['message']===_0x34df('0x149')){setTimeout(function(){if(_0x52c5cc[_0xaa0118]&&_0x52c5cc[_0xaa0118][_0x34df('0x40')]!==_0x34df('0xb8')){_0x4d5212['updateOriginated'](_0x4d5212[_0x34df('0x1e')][_0x52c5cc[_0xaa0118][_0x34df('0xbb')]]);logger[_0x34df('0x61')](_0x34df('0x14a'),_0xfc82f,_0xaa0118,_0x52c5cc[_0xaa0118][_0x34df('0xbb')]);delete _0x52c5cc[_0xaa0118];}if(_0x52c5cc[_0xaa0118]&&_0x52c5cc[_0xaa0118][_0x34df('0x40')]===_0x34df('0xb8')){_0x4d5212[_0x34df('0xb9')](_0x4d5212[_0x34df('0x1f')][_0x52c5cc[_0xaa0118][_0x34df('0xbb')]]);logger[_0x34df('0x61')]('[Dialer][checkChannel][ivr]',_0xfc82f,_0xaa0118,_0x52c5cc[_0xaa0118][_0x34df('0xbb')]);delete _0x52c5cc[_0xaa0118];}},0x2328);}});}});}}};Dialer['prototype'][_0x34df('0x14b')]=function(_0x1f5c59){return Promise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x1f5c59))[_0x34df('0x9d')](loggerCatch(_0x34df('0x14c')));};Dialer[_0x34df('0x19')][_0x34df('0xb9')]=function(_0x16b98a){if(!_[_0x34df('0x3f')](_0x16b98a)&&_0x16b98a!==null){if(typeof _0x16b98a['originated']!==_0x34df('0xa5')){if(_0x16b98a[_0x34df('0x7b')]>0x0){_0x16b98a['originated']-=0x1;}else{logger['error'](_0x34df('0x14d'));}}}else{logger['error'](_0x34df('0x14e'));}};Dialer[_0x34df('0x19')][_0x34df('0x14f')]=function(_0x45be09,_0xfc89f4){var _0x53bf50=this;return function(_0x382868){_0x53bf50['updateOriginated'](_0xfc89f4);logger[_0x34df('0x61')](_0x45be09,util[_0x34df('0x43')](_0x382868,{'showHidden':![],'depth':null}));};};Dialer[_0x34df('0x19')]['emptyContact']=function(_0x23309d,_0x54b2a8,_0x5b7ffa){var _0xb6b6d2={'state':0x19,'statedesc':_0x34df('0x150')};this[_0x34df('0xb9')](_0x54b2a8);this['saveInDb'](_['merge'](_0xb6b6d2,_[_0x34df('0x6f')](_0x5b7ffa,['ContactId',_0x34df('0xf7'),_0x34df('0x151'),_0x34df('0xd8'),_0x34df('0xe5')])),_0x34df('0x152'),_0x34df('0x153'));logger[_0x34df('0x61')](_0x23309d);};Dialer[_0x34df('0x19')][_0x34df('0x123')]=function(_0x3e057f,_0x2700a8,_0x337e8e){hopperUtils['createHistory'](_0x3e057f)[_0x34df('0x9d')](loggerCatch(_0x2700a8));hopperUtils[_0x34df('0xc3')](_0x3e057f)['catch'](loggerCatch(_0x337e8e));};Dialer[_0x34df('0x19')][_0x34df('0xd5')]=function(_0xc081db,_0x322ded){hopperUtils[_0x34df('0xc1')](_0xc081db)[_0x34df('0x9d')](loggerCatch(_0x34df('0xc2')));if(_0x322ded==0x0){hopperUtils[_0x34df('0xc3')](_0xc081db)['catch'](loggerCatch(_0x34df('0x154')));}};Dialer[_0x34df('0x19')][_0x34df('0x145')]=function(_0x3d3024){return Promise['resolve']()['then'](cmHopper[_0x34df('0x142')](_0x3d3024['id'],previewRecallmeReminderInterval))[_0x34df('0x3d')](function(_0x1b117f){for(var _0x58ddf0=0x0;_0x58ddf0<_0x1b117f[_0x34df('0x96')];_0x58ddf0++){var _0x154498=_0x1b117f[_0x58ddf0][_0x34df('0x155')]['name'];if(_0x154498)io['to'](util['format']('user:%s',_0x154498))[_0x34df('0x10f')](_0x34df('0x156'),{'hopper':_0x1b117f[_0x58ddf0]});}})[_0x34df('0x9d')](function(){});};Dialer[_0x34df('0x19')][_0x34df('0xa8')]=function(_0x2ef72b){var _0x1c41ab=this;return function(){_0x1c41ab[_0x34df('0x157')](_0x2ef72b);};};Dialer[_0x34df('0x19')]['actionOriginate']=function(_0x5768e2,_0xe3165b){var _0x42c65d=this;var _0x315299=uuid['v4']();this[_0x34df('0x23')][_0x315299]=new Action(_0x5768e2,_0xe3165b,_0x315299);return new Promise(function(_0x458d89,_0x4e38ea){if(_[_0x34df('0x3f')](_0x5768e2)&&typeof _0x5768e2!=='object'){return _0x4e38ea(msgResponse(_0x34df('0x158'),_0x34df('0x90'),_0x34df('0x159')));}if(_['isUndefined'](_0xe3165b[_0x34df('0x15a')])||_0xe3165b[_0x34df('0x15a')]===null){return _0x4e38ea(msgResponse(_0x34df('0x158'),_0x34df('0x90'),_0x34df('0x15b')));}var _0x4a8699={'XMD-CALLERID':_0x42c65d[_0x34df('0x23')][_0x315299][_0x34df('0x15c')](),'XMD-AGI':_0x5768e2[_0x34df('0x12d')]?util[_0x34df('0x44')](_0x34df('0x15d'),ipAgi,_0x5768e2[_0x34df('0x12d')]):_0x34df('0x15e'),'XMD-AGIAFTER':_0x5768e2[_0x34df('0xbf')]?util['format'](_0x34df('0x15d'),ipAgi,_0x5768e2['dialQueueProject2']):_0x34df('0x15e'),'XMD-QUEUE':utils[_0x34df('0x15f')](_0x5768e2)?util['format'](_0x34df('0x160'),_0x5768e2[_0x34df('0x46')],_0x5768e2['dialQueueOptions']||'',_0x5768e2[_0x34df('0x161')]?'c':'',_0x5768e2[_0x34df('0x162')]||0x3):'NONE','XMD-CONTACTID':_0xe3165b['ContactId'],'XMD-CDRTYPE':_0x34df('0x6'),'CALLERID(all)':_0x42c65d['actions'][_0x315299][_0x34df('0x15c')](),'XMD-AMD':_0x5768e2['dialAMDActive']?_0x34df('0x137'):_0x34df('0x15e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5768e2['dialAMDActive']){_0x4a8699[_0x34df('0x163')]=_0x5768e2[_0x34df('0x164')]||0x9c4;_0x4a8699[_0x34df('0x165')]=_0x5768e2[_0x34df('0x166')]||0x5dc;_0x4a8699['XMD-AMDAFTERGREETINGSILENCE']=_0x5768e2[_0x34df('0x167')]||0x320;_0x4a8699[_0x34df('0x168')]=_0x5768e2[_0x34df('0x169')]||0x1388;_0x4a8699[_0x34df('0x16a')]=_0x5768e2['dialAMDMinWordLength']||0x64;_0x4a8699[_0x34df('0x16b')]=_0x5768e2['dialAMDBetweenWordsSilence']||0x32;_0x4a8699[_0x34df('0x16c')]=_0x5768e2[_0x34df('0x16d')]||0x3;_0x4a8699[_0x34df('0x16e')]=_0x5768e2[_0x34df('0x16f')]||0x100;_0x4a8699[_0x34df('0x170')]=_0x5768e2[_0x34df('0x171')]||0x1388;}if(utils['isOutboundQueue'](_0x5768e2)){_0x4a8699['XMD-VOICEQUEUEID']=_0xe3165b[_0x34df('0xd8')];}else{_0x4a8699['XMD-CAMPAIGNID']=_0xe3165b[_0x34df('0xe5')];}for(var _0x56458f in _0xe3165b[_0x34df('0x172')]){if(typeof _0xe3165b[_0x34df('0x172')][_0x56458f]!==_0x34df('0xa5')){if(isNotNull(_0xe3165b[_0x34df('0x172')][_0x56458f])&&_0x56458f!=='id'&&_0x56458f!==_0x34df('0x173')&&_0x56458f!==_0x34df('0x174')&&_0x56458f!==_0x34df('0x175')){_0x4a8699[util['format'](_0x34df('0x176'),_0x34df('0x177'),_[_0x34df('0x178')](_0x56458f))]=_0xe3165b[_0x34df('0x172')][_0x56458f];}}}var _0x4cadb8=_0x42c65d[_0x34df('0x82')](_0x5768e2['Trunk'])?utils[_0x34df('0x179')](_0x5768e2['Trunk'][_0x34df('0x17a')],_0x5768e2[_0x34df('0x17b')],_0x5768e2[_0x34df('0x17c')]>0x0?utils['getCallerIdRandom'](_0x5768e2['dialOriginateCallerIdNumber'],_0x5768e2[_0x34df('0x17c')]):_0x5768e2[_0x34df('0x17d')]):utils[_0x34df('0x179')](_[_0x34df('0xed')](_0x5768e2[_0x34df('0x8a')])?_0x5768e2[_0x34df('0x89')][_0x34df('0x17a')]:_0x5768e2[_0x34df('0x8a')]['callerid'],_0x5768e2[_0x34df('0x17b')],_0x5768e2[_0x34df('0x17c')]>0x0?utils[_0x34df('0x17e')](_0x5768e2['dialOriginateCallerIdNumber'],_0x5768e2['dialRandomLastDigitCallerIdNumber']):_0x5768e2['dialOriginateCallerIdNumber']);if(_0x4cadb8){_0x4a8699[_0x34df('0x17f')]=_0x42c65d[_0x34df('0x23')][_0x315299][_0x34df('0x180')]=utils[_0x34df('0x181')](_0x4cadb8);_0x4a8699[_0x34df('0x182')]=_0xe3165b[_0x34df('0x15a')];}_0x5768e2[_0x34df('0x183')]=_0x4a8699;return ami[_0x34df('0x98')]({'actionid':_0x315299,'action':_0x34df('0x158'),'channel':_0x42c65d[_0x34df('0x82')](_0x5768e2[_0x34df('0x89')])?util[_0x34df('0x44')](_0x34df('0x184'),_0x5768e2[_0x34df('0x89')][_0x34df('0x46')],isNotNull(_0x5768e2['dialPrefix'])?_0x5768e2['dialPrefix'][_0x34df('0x185')]()||'':'',_0x5768e2[_0x34df('0x186')]>0x0?_0xe3165b[_0x34df('0x15a')][_0x34df('0x187')](_0x5768e2['dialCutDigit']):_0xe3165b[_0x34df('0x15a')]):util[_0x34df('0x44')](_0x34df('0x184'),_[_0x34df('0xed')](_0x5768e2[_0x34df('0x8a')])?_0x5768e2[_0x34df('0x89')]['name']:_0x5768e2['TrunkBackup'][_0x34df('0x46')],isNotNull(_0x5768e2[_0x34df('0x188')])?_0x5768e2['dialPrefix']['trim']()||'':'',_0x5768e2['dialCutDigit']>0x0?_0xe3165b['phone']['substring'](_0x5768e2[_0x34df('0x186')]):_0xe3165b['phone']),'callerid':_0x4cadb8,'Exten':_0x34df('0x108'),'Context':_0x34df('0x189'),'Priority':'1','variable':_0x4a8699,'timeout':(_0x5768e2[_0x34df('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x315299})[_0x34df('0x3d')](function(_0x1a46b8){return _0x458d89(_0x1a46b8);})[_0x34df('0x9d')](function(_0x59f93d){_0x5768e2[_0x34df('0x18b')]+=0x1;var _0x5585f5=new History(_0x42c65d['actions'][_0x315299]);logger['error'](util[_0x34df('0x44')]('[originateError]:\x20%s',JSON[_0x34df('0x6e')](_0x59f93d)));_0x5585f5['state']=0xe;_0x5585f5[_0x34df('0xda')]=_0x34df('0x18c');_0x5585f5['starttime']=moment()[_0x34df('0x44')](_0x34df('0xc0'));_0x5585f5[_0x34df('0x6a')]=_0x5585f5[_0x34df('0x6b')];hopperUtils[_0x34df('0xc1')](_0x5585f5)['catch'](loggerCatch(_0x34df('0x18d')));_0x42c65d[_0x34df('0xc3')](_0x5585f5)['catch'](loggerCatch(_0x34df('0x18d')))[_0x34df('0x1b')](function(){delete _0x42c65d[_0x34df('0x23')][_0x315299];return _0x4e38ea(msgResponse(_0x34df('0x158'),_0x34df('0x81'),_0x34df('0x18e')));});});});};Dialer[_0x34df('0x19')][_0x34df('0x18f')]=function(_0x167ad9,_0x22b184,_0x594dd6){var _0x20f9bb=new History(_0x22b184);if(_0x20f9bb[_0x34df('0x119')]+_0x20f9bb['countcongestionretry']+_0x20f9bb[_0x34df('0x11b')]+_0x20f9bb['countnosuchnumberretry']+_0x20f9bb[_0x34df('0xcd')]+_0x20f9bb['countabandonedretry']+_0x20f9bb[_0x34df('0x117')]+_0x20f9bb[_0x34df('0x11d')]>=_0x594dd6[_0x34df('0x126')]-0x1){return!![];}switch(_0x167ad9){case 0x3:if(_0x20f9bb['countnoanswerretry']>=_0x594dd6[_0x34df('0x190')]-0x1){return!![];}hopperUtils[_0x34df('0xf6')]({'active':![],'countnoanswerretry':_0x20f9bb['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x594dd6[_0x34df('0x191')],_0x34df('0xd6'))[_0x34df('0x44')](_0x34df('0xc0')),'ContactId':_0x20f9bb['ContactId'],'ListId':_0x20f9bb[_0x34df('0xf7')],'VoiceQueueId':_0x20f9bb[_0x34df('0xd8')]||undefined,'CampaignId':_0x20f9bb[_0x34df('0xe5')]||undefined})['catch'](loggerCatch(_0x34df('0x192')));break;case 0x5:if(_0x20f9bb[_0x34df('0x119')]>=_0x594dd6[_0x34df('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x20f9bb[_0x34df('0x119')]+=0x1,'scheduledat':moment()[_0x34df('0x121')](_0x594dd6[_0x34df('0x194')],_0x34df('0xd6'))['format'](_0x34df('0xc0')),'ContactId':_0x20f9bb[_0x34df('0xd7')],'ListId':_0x20f9bb[_0x34df('0xf7')],'VoiceQueueId':_0x20f9bb[_0x34df('0xd8')]||undefined,'CampaignId':_0x20f9bb['CampaignId']||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x195')));break;case 0x8:if(_0x20f9bb[_0x34df('0x11a')]>=_0x594dd6['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x34df('0xf6')]({'active':![],'countcongestionretry':_0x20f9bb['countcongestionretry']+=0x1,'scheduledat':moment()[_0x34df('0x121')](_0x594dd6[_0x34df('0x196')],_0x34df('0xd6'))[_0x34df('0x44')](_0x34df('0xc0')),'ContactId':_0x20f9bb[_0x34df('0xd7')],'ListId':_0x20f9bb[_0x34df('0xf7')],'VoiceQueueId':_0x20f9bb['VoiceQueueId']||undefined,'CampaignId':_0x20f9bb['CampaignId']||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x197')));break;case 0x0:if(_0x20f9bb['countnosuchnumberretry']>=_0x594dd6[_0x34df('0x198')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x20f9bb['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x34df('0x121')](_0x594dd6[_0x34df('0x199')],_0x34df('0xd6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20f9bb[_0x34df('0xd7')],'ListId':_0x20f9bb[_0x34df('0xf7')],'VoiceQueueId':_0x20f9bb[_0x34df('0xd8')]||undefined,'CampaignId':_0x20f9bb[_0x34df('0xe5')]||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x19a')));}break;case 0xa:if(_0x20f9bb[_0x34df('0xcd')]>=_0x594dd6[_0x34df('0xd4')]-0x1){return!![];}hopperUtils[_0x34df('0xf6')]({'active':![],'countdropretry':_0x20f9bb[_0x34df('0xcd')]+=0x1,'scheduledat':moment()[_0x34df('0x121')](_0x594dd6['dialDropRetryFrequency'],_0x34df('0xd6'))[_0x34df('0x44')](_0x34df('0xc0')),'ContactId':_0x20f9bb['ContactId'],'ListId':_0x20f9bb[_0x34df('0xf7')],'VoiceQueueId':_0x20f9bb['VoiceQueueId']||undefined,'CampaignId':_0x20f9bb[_0x34df('0xe5')]||undefined})['catch'](loggerCatch(_0x34df('0xd9')));break;case 0xb:if(_0x20f9bb[_0x34df('0xe2')]>=_0x594dd6[_0x34df('0xe4')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x20f9bb[_0x34df('0xe2')]+=0x1,'scheduledat':moment()[_0x34df('0x121')](_0x594dd6[_0x34df('0xe3')],_0x34df('0xd6'))[_0x34df('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20f9bb[_0x34df('0xd7')],'ListId':_0x20f9bb['ListId'],'VoiceQueueId':_0x20f9bb[_0x34df('0xd8')]||undefined,'CampaignId':_0x20f9bb['CampaignId']||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0xe6')));break;case 0x13:if(_0x20f9bb[_0x34df('0x117')]>=_0x594dd6[_0x34df('0x127')]-0x1){return!![];}hopperUtils[_0x34df('0xf6')]({'active':![],'countmachineretry':_0x20f9bb['countmachineretry']+=0x1,'scheduledat':moment()[_0x34df('0x121')](_0x594dd6[_0x34df('0x129')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20f9bb[_0x34df('0xd7')],'ListId':_0x20f9bb['ListId'],'VoiceQueueId':_0x20f9bb['VoiceQueueId']||undefined,'CampaignId':_0x20f9bb['CampaignId']||undefined})['catch'](loggerCatch(_0x34df('0x122')));break;case 0x14:if(_0x20f9bb[_0x34df('0x11d')]>=_0x594dd6[_0x34df('0x19b')]-0x1){return!![];}hopperUtils[_0x34df('0xf6')]({'active':![],'countagentrejectretry':_0x20f9bb[_0x34df('0x11d')]+=0x1,'scheduledat':moment()[_0x34df('0x121')](_0x594dd6[_0x34df('0x19c')],_0x34df('0xd6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20f9bb[_0x34df('0xd7')],'ListId':_0x20f9bb[_0x34df('0xf7')],'VoiceQueueId':_0x20f9bb[_0x34df('0xd8')]||undefined,'CampaignId':_0x20f9bb['CampaignId']||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x19d')));break;default:return!![];}};Dialer[_0x34df('0x19')][_0x34df('0x19e')]=function(_0x3cecbc,_0x18ff70,_0x3f9c9a){var _0x5a2725=this;var _0x58c9e4=new History(_0x3cecbc);var _0x11db28=![];var _0x937069;var _0x449fcc;return new Promise(function(_0x134d53,_0x4f08c8){if(_[_0x34df('0x3f')](_0x18ff70)&&typeof _0x18ff70!==_0x34df('0x19f')){return _0x4f08c8(msgResponse('[callProgressDetecting]',_0x34df('0x90'),_0x34df('0x1a0')));}if(_[_0x34df('0x3f')](_0x3f9c9a)&&typeof _0x3f9c9a!==_0x34df('0x19f')){return _0x4f08c8(msgResponse(_0x34df('0x1a1'),_0x34df('0x90'),_0x34df('0x1a2')));}hopperUtils['verifyAdditionalPhones'](_0x58c9e4,_0x3f9c9a[_0x34df('0x1a3')],_0x18ff70)['then'](function(_0x3cdc99){if(_0x3cdc99['additional']==0x1)_0x11db28=!![];switch(_0x3f9c9a[_0x34df('0x1a3')]){case'0':_0x18ff70[_0x34df('0x1a4')]+=0x1;_0x58c9e4[_0x34df('0xca')]=0x0;_0x58c9e4[_0x34df('0xda')]=_0x34df('0x1a5');_0x58c9e4[_0x34df('0x11c')]+=0x1;_0x58c9e4[_0x34df('0xce')]+=0x1;ami[_0x34df('0x10f')](_0x34df('0x1a6'),ut['buildObj'](_0x3cecbc,'nosuchnumber'));_0x937069=_0x18ff70[_0x34df('0x199')];_0x449fcc=_0x18ff70['callAdditionalPhoneAfterMin'];hopperUtils[_0x34df('0xc1')](_0x58c9e4)['catch'](loggerCatch(_0x34df('0x118')));if(_0x5a2725[_0x34df('0x18f')](0x0,_0x3cecbc,_0x18ff70)&&!_0x11db28){if(_0x58c9e4['countnosuchnumberretry']>=_0x18ff70[_0x34df('0x198')]){_0x5a2725[_0x34df('0x120')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1a7'));}else{_0x5a2725[_0x34df('0x11e')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1a7'));}}break;case'3':_0x18ff70[_0x34df('0x1a8')]+=0x1;_0x58c9e4[_0x34df('0xca')]=0x3;_0x58c9e4[_0x34df('0xda')]='NoAnswer';_0x58c9e4[_0x34df('0x11b')]+=0x1;_0x58c9e4[_0x34df('0xce')]+=0x1;var _0x2846c0=ut['buildNoAnswerEventPayload'](_0x3cecbc,_0x18ff70);ami[_0x34df('0x10f')](_0x34df('0x1a9'),_0x2846c0);_0x937069=_0x18ff70[_0x34df('0x191')];_0x449fcc=_0x18ff70[_0x34df('0xd0')];hopperUtils[_0x34df('0xc1')](_0x58c9e4)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x5a2725['checkRetriveMax'](0x3,_0x3cecbc,_0x18ff70)&&!_0x11db28){if(_0x58c9e4[_0x34df('0x11b')]>=_0x18ff70[_0x34df('0x190')]){_0x5a2725[_0x34df('0x120')](_0x58c9e4,_0x134d53,_0x4f08c8,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5a2725[_0x34df('0x11e')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1aa'));}}break;case'5':_0x18ff70[_0x34df('0x1ab')]+=0x1;_0x58c9e4['state']=0x5;_0x58c9e4[_0x34df('0xda')]='Busy';_0x58c9e4[_0x34df('0x119')]+=0x1;_0x58c9e4[_0x34df('0xce')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x34df('0x111')](_0x3cecbc,_0x34df('0x1ac')));_0x937069=_0x18ff70[_0x34df('0x194')];_0x449fcc=_0x18ff70[_0x34df('0xd0')];hopperUtils['createHistory'](_0x58c9e4)[_0x34df('0x9d')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x5a2725['checkRetriveMax'](0x5,_0x3cecbc,_0x18ff70)&&!_0x11db28){if(_0x58c9e4['countbusyretry']>=_0x18ff70[_0x34df('0x193')]){_0x5a2725[_0x34df('0x120')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1ad'));}else{_0x5a2725[_0x34df('0x11e')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1ad'));}}break;case'8':_0x18ff70['outboundCongestionCallsDay']+=0x1;_0x58c9e4[_0x34df('0xca')]=0x8;_0x58c9e4[_0x34df('0xda')]=_0x34df('0x1ae');_0x58c9e4[_0x34df('0x11a')]+=0x1;_0x58c9e4[_0x34df('0xce')]+=0x1;_0x937069=_0x18ff70[_0x34df('0x196')];_0x449fcc=_0x18ff70[_0x34df('0xd0')];ami['emit']('custom:agentcongestion',ut[_0x34df('0x111')](_0x3cecbc,_0x34df('0x1af')));hopperUtils[_0x34df('0xc1')](_0x58c9e4)[_0x34df('0x9d')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5a2725[_0x34df('0x18f')](0x8,_0x3cecbc,_0x18ff70)&&!_0x11db28){if(_0x58c9e4[_0x34df('0x11a')]>=_0x18ff70[_0x34df('0x1b0')]){_0x5a2725[_0x34df('0x120')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1b1'));}else{_0x5a2725['stateGlobal'](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1b1'));}}break;case'11':_0x18ff70[_0x34df('0x1b2')]+=0x1;_0x58c9e4[_0x34df('0xca')]=0xb;_0x58c9e4['statedesc']=_0x34df('0xe0');_0x58c9e4['countabandonedretry']+=0x1;_0x58c9e4[_0x34df('0xce')]+=0x1;_0x937069=_0x18ff70['dialAbandonedRetryFrequency'];_0x449fcc=_0x18ff70[_0x34df('0xd0')];hopperUtils[_0x34df('0xc1')](_0x58c9e4)[_0x34df('0x9d')](loggerCatch(_0x34df('0xe7')));if(_0x5a2725['checkRetriveMax'](0xb,_0x3cecbc,_0x18ff70)&&!_0x11db28){if(_0x58c9e4['countabandonedretry']>=_0x18ff70[_0x34df('0xe4')]){_0x5a2725[_0x34df('0x120')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1b3'));}else{_0x5a2725['stateGlobal'](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1b3'));}}break;case'20':_0x18ff70['outboundRejectCallsDay']+=0x1;_0x58c9e4[_0x34df('0xca')]=0x14;_0x58c9e4[_0x34df('0xda')]=_0x34df('0x1b4');_0x58c9e4['countagentrejectretry']+=0x1;_0x58c9e4[_0x34df('0xce')]+=0x1;_0x937069=_0x18ff70['dialAgentRejectRetryFrequency'];_0x449fcc=_0x18ff70['callAdditionalPhoneAfterMin'];ami[_0x34df('0x10f')](_0x34df('0x1b5'),ut[_0x34df('0x111')](_0x3cecbc,_0x34df('0x1b6')));hopperUtils[_0x34df('0xc1')](_0x58c9e4)[_0x34df('0x9d')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5a2725['checkRetriveMax'](0x14,_0x3cecbc,_0x18ff70)&&!_0x11db28){if(_0x58c9e4[_0x34df('0x11d')]>=_0x18ff70[_0x34df('0x19b')]){_0x5a2725[_0x34df('0x120')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1b7'));}else{_0x5a2725[_0x34df('0x11e')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x34df('0x1b7'));}}break;default:_0x18ff70[_0x34df('0x1b8')]+=0x1;_0x58c9e4[_0x34df('0xca')]=0xc;_0x58c9e4[_0x34df('0xda')]=_0x3f9c9a[_0x34df('0x1a3')];_0x937069=_0x18ff70['dialAgentRejectRetryFrequency'];_0x449fcc=_0x18ff70[_0x34df('0xd0')];hopperUtils['createHistory'](_0x58c9e4)[_0x34df('0x9d')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5a2725[_0x34df('0x18f')](_0x3f9c9a[_0x34df('0x1a3')],_0x3cecbc,_0x18ff70)&&!_0x11db28){if(_0x58c9e4[_0x34df('0x119')]+_0x58c9e4[_0x34df('0x11a')]+_0x58c9e4[_0x34df('0x11b')]+_0x58c9e4[_0x34df('0x11c')]+_0x58c9e4[_0x34df('0xcd')]+_0x58c9e4[_0x34df('0xe2')]+_0x58c9e4[_0x34df('0x117')]+_0x58c9e4[_0x34df('0x11d')]>=_0x18ff70['dialGlobalMaxRetry']){_0x5a2725[_0x34df('0x11e')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x3f9c9a['reason']);}else{_0x5a2725[_0x34df('0x120')](_0x58c9e4,_0x134d53,_0x4f08c8,_0x3f9c9a[_0x34df('0x1a3')]);}}}})[_0x34df('0x3d')](function(){if(_0x11db28){hopperUtils[_0x34df('0x1b9')](_0x58c9e4,_0x937069,_0x449fcc)[_0x34df('0x3d')](function(){return _0x134d53(0x1);});}});});};Dialer[_0x34df('0x19')][_0x34df('0x11e')]=function(_0x2f8a4b,_0xa9df88,_0x3777f4,_0x47d140){var _0xcba266=new Final(_0x2f8a4b);_0xcba266[_0x34df('0xca')]=0xf;_0xcba266[_0x34df('0xda')]=_0x34df('0x1ba');this[_0x34df('0x120')](_0xcba266,_0xa9df88,_0x3777f4,_0x47d140);};Dialer[_0x34df('0x19')][_0x34df('0x120')]=function(_0x4a44fb,_0x18ff4e,_0x54cd8c,_0x53c406){hopperUtils[_0x34df('0xc3')](_0x4a44fb)['then'](function(){return _0x18ff4e(msgResponse('[callProgressDetecting]','Success',_0x53c406));})[_0x34df('0x9d')](function(){return _0x54cd8c(msgResponse(_0x34df('0x1bb'),_0x34df('0x90'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x34df('0x8')]=function(_0x1dfd97){var _0x34c5b2=_0x1dfd97['dialPredictiveOptimizationPercentage']/0x64;var _0x24c9a6=_0x1dfd97['outboundDropCallsDayTimeout']/(_0x1dfd97[_0x34df('0xc9')]+_0x1dfd97[_0x34df('0xbc')]);var _0x74efe8=Math['round'](_0x1dfd97[_0x34df('0x1bc')]*(_0x1dfd97[_0x34df('0x1bd')]/0x64));var _0x19fb0f=Math[_0x34df('0x1be')](_0x1dfd97[_0x34df('0x1bc')]*(_0x1dfd97[_0x34df('0x1bf')]/0x64));var _0x1ffd30=_0x1dfd97[_0x34df('0x1c0')]+_0x1dfd97[_0x34df('0x135')];var _0x125ef3=Math['floor'](_0x1dfd97[_0x34df('0x1c1')]*_0x1dfd97[_0x34df('0x5c')]*_0x1dfd97[_0x34df('0x1c2')]*_0x1dfd97[_0x34df('0x1c3')]);if(_[_0x34df('0x3f')](_0x1dfd97[_0x34df('0x27')])){if(!_[_0x34df('0x3f')](_0x1dfd97['startPredictive'])){_0x1dfd97['startPredictive']=undefined;loggerPredictive[_0x34df('0x61')]('[startMethodPredictive][StartProgressive]',_0x34df('0x1c4'));}if(!_[_0x34df('0x3f')](_0x1dfd97[_0x34df('0x5f')])){loggerPredictive[_0x34df('0x61')](_0x34df('0x1c5'),_0x34df('0x1c6'));clearInterval(_0x1dfd97['handlePredictive']);_0x1dfd97['handlePredictive']=undefined;}_0x1dfd97['startProgressive']=moment()[_0x34df('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x34df('0x49')](_0x1dfd97[_0x34df('0x46')],_0x34df('0x1c7'),_0x1dfd97['startProgressive']);this['handlePower'](_0x1dfd97,0x1);}else if(ifInterval(_0x1dfd97[_0x34df('0x1c8')],_0x1dfd97[_0x34df('0x27')])){this[_0x34df('0xab')](_0x1dfd97,0x1);loggerPredictiveCalls[_0x34df('0x49')](_0x34df('0x1c9'),_0x1dfd97[_0x34df('0x27')],_0x1dfd97[_0x34df('0x46')]);_0x1dfd97[_0x34df('0x1c1')]=0x0;_0x1dfd97['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x34c5b2<_0x24c9a6&&_0x1dfd97[_0x34df('0x1ca')]===_0x34df('0x1cb')){clearPredictiveAttributes(_0x1dfd97);loggerPredictive[_0x34df('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x34df('0x1cc'),_0x24c9a6,_0x34df('0x27'),_0x1dfd97[_0x34df('0x46')]);}else if(_0x125ef3<_0x1dfd97['predictiveIntervalErlangCallsDroppedCalls']&&_0x1dfd97[_0x34df('0x1ca')]===_0x34df('0x1cb')){clearPredictiveAttributes(_0x1dfd97);loggerPredictive[_0x34df('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x34df('0x1cd'),_0x125ef3,'Drop\x20in\x20this\x20interval',_0x1dfd97[_0x34df('0x1ce')],'startProgressive',_0x1dfd97[_0x34df('0x46')]);}else if(!ifInterval(_0x1dfd97[_0x34df('0x1c8')],_0x1dfd97[_0x34df('0x27')])&&_[_0x34df('0x3f')](_0x1dfd97['startPredictive'])&&!_[_0x34df('0x3f')](_0x1dfd97[_0x34df('0x27')])){_0x1dfd97[_0x34df('0x26')]=moment()[_0x34df('0x44')](_0x34df('0xc0'));loggerPredictive['info'](_0x1dfd97[_0x34df('0x46')],_0x34df('0x1cf'),_0x1dfd97['startPredictive']);hopperUtils[_0x34df('0x1d0')](_0x1dfd97[_0x34df('0x1c8')])[_0x34df('0x3d')](this[_0x34df('0x1d1')](_0x1dfd97))['then'](mergeDataErlangB(_0x1dfd97))[_0x34df('0x3d')](this['startMethodPredictive'](_0x1dfd97))[_0x34df('0x9d')](loggerCatchPredictive(_0x34df('0x1d2'),_0x1dfd97));}else if(!ifInterval(_0x1dfd97['dialPredictiveInterval'],_0x1dfd97[_0x34df('0x26')])){_0x1dfd97[_0x34df('0x1ce')]=0x0;_0x1dfd97[_0x34df('0x26')]=moment()[_0x34df('0x44')](_0x34df('0xc0'));loggerPredictive[_0x34df('0x49')](_0x1dfd97[_0x34df('0x46')],'recalculate\x20predictive\x20at',_0x1dfd97[_0x34df('0x26')]);clearInterval(_0x1dfd97[_0x34df('0x5f')]);_0x1dfd97[_0x34df('0x5f')]=undefined;hopperUtils[_0x34df('0x1d0')](_0x1dfd97['dialPredictiveInterval'])[_0x34df('0x3d')](this['getDataPredictive'](_0x1dfd97))[_0x34df('0x3d')](mergeDataErlangB(_0x1dfd97))[_0x34df('0x3d')](this['startMethodPredictive'](_0x1dfd97))[_0x34df('0x9d')](loggerCatchPredictive(_0x34df('0x1d3'),_0x1dfd97));}else if(_0x1dfd97['predictiveIntervalAvailable']&&_0x1ffd30<_0x1dfd97['predictiveIntervalAvailable']-_0x19fb0f){clearPredictiveAttributes(_0x1dfd97);loggerPredictive[_0x34df('0x49')](_0x1dfd97['name'],_0x34df('0x1d4'),_0x1ffd30,_0x34df('0x1d5'),_0x1dfd97['predictiveIntervalAvailable'],'-',_0x19fb0f,'=',_0x1dfd97[_0x34df('0x1bc')]-_0x19fb0f,')');}else if(_0x1dfd97[_0x34df('0x1bc')]&&_0x1ffd30>_0x1dfd97['predictiveIntervalAvailable']+_0x74efe8){clearPredictiveAttributes(_0x1dfd97);loggerPredictive[_0x34df('0x49')](_0x1dfd97[_0x34df('0x46')],_0x34df('0x1d4'),_0x1ffd30,_0x34df('0x1d6'),_0x1dfd97[_0x34df('0x1bc')],'+',_0x74efe8,'=',_0x1dfd97[_0x34df('0x1bc')]+_0x74efe8,')');}};Dialer[_0x34df('0x19')][_0x34df('0x1d1')]=function(_0x21f6ad){var _0x290612=this;return function(_0xf559ba){return new Promise(function(_0x7a88f,_0x344172){_['merge'](_0x21f6ad,_0xf559ba[0x0]);if(checkGetDataPredictive(_0xf559ba[0x0])){var _0x18c472=_0x21f6ad[_0x34df('0x1bc')]=_0x21f6ad[_0x34df('0x135')]+_0x21f6ad[_0x34df('0x1c0')];var _0x798553=_0x21f6ad[_0x34df('0x1c8')]*0x3c;var _0x2e63f9=_0xf559ba[0x0]['predictiveIntervalAvgTalktime']+_0xf559ba[0x0][_0x34df('0x55')];var _0x2c8aaa=(_0xf559ba[0x0][_0x34df('0x4d')]+_0xf559ba[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xf559ba[0x0][_0x34df('0x51')])/_0xf559ba[0x0][_0x34df('0x4b')];_0x21f6ad[_0x34df('0x1c2')]=_0x2c8aaa>0x0?_0x2c8aaa:0x1;switch(_0x21f6ad['dialPredictiveOptimization']){case _0x34df('0x1cb'):var _0x8d154b=_0x21f6ad['dialPredictiveOptimizationPercentage']/0x64;return _0x290612[_0x34df('0x1d7')](_0x18c472,_0x798553,_0x2e63f9,_0x2c8aaa,_0x8d154b)[_0x34df('0x3d')](function(_0x20ebd6){return _0x7a88f(_0x20ebd6);});case'agentBusyFactor':var _0x12b89c=_0x21f6ad[_0x34df('0x1d8')]/0x64;return _0x290612[_0x34df('0x1d9')](_0x18c472,_0x798553,_0x2e63f9,_0x2c8aaa,_0x12b89c)['then'](function(_0x5df890){return _0x7a88f(_0x5df890);});default:return _0x344172(msgResponse(_0x34df('0x1da'),_0x34df('0x90'),_0x34df('0x1db')));}}else{return _0x344172(msgResponse(_0x34df('0x1da'),_0x34df('0x90'),_0x34df('0x1dc')));}});};};Dialer[_0x34df('0x19')][_0x34df('0x1dd')]=function(_0x53a21c){var _0x3c33d4=this;return function(_0x5c2c32){return new Promise(function(_0x37a937,_0x2ed084){_['merge'](_0x53a21c,_0x5c2c32[0x0]);if(checkGetDataPredictive(_0x5c2c32[0x0])){loggerPredictive[_0x34df('0x49')](JSON[_0x34df('0x6e')](_0x5c2c32[0x0]));if(_0x53a21c[_0x34df('0x1ca')]==='dropRate'){return _0x3c33d4['getVoiceQueueRtPauses'](_0x53a21c['id'])[_0x34df('0x3d')](function(_0x475980){var _0x5ecb44=_0x53a21c['loggedIn']-_0x475980[0x0][_0x34df('0x1de')];var _0x2670e0=_0x53a21c[_0x34df('0x1c8')]*0x3c;var _0x460513=_0x5c2c32[0x0][_0x34df('0x53')]+_0x5c2c32[0x0][_0x34df('0x55')];var _0xf3cfb5=(_0x5c2c32[0x0][_0x34df('0x4d')]+_0x5c2c32[0x0][_0x34df('0x4f')]+_0x5c2c32[0x0][_0x34df('0x51')])/_0x5c2c32[0x0][_0x34df('0x4b')];var _0x1ec6a9=_0x53a21c['dialPredictiveOptimizationPercentage']/0x64;_0x53a21c['predictiveIntervalPauses']=_0x475980[0x0][_0x34df('0x1de')]||0x0;_0x53a21c[_0x34df('0x1c2')]=_0xf3cfb5>0x0?_0xf3cfb5:0x1;return _0x3c33d4[_0x34df('0x1d7')](_0x5ecb44,_0x2670e0,_0x460513,_0xf3cfb5,_0x1ec6a9);})['then'](function(_0x312d46){return _0x37a937(_0x312d46);})['catch'](function(_0x2a5773){return _0x2ed084(msgResponse(_0x34df('0x1df'),_0x34df('0x90'),JSON[_0x34df('0x6e')](_0x2a5773)));});}if(_0x53a21c[_0x34df('0x1ca')]===_0x34df('0x1e0')){return _0x3c33d4[_0x34df('0x14b')](_0x53a21c['id'])['then'](function(_0x21ce4f){var _0x37f347=_0x53a21c[_0x34df('0x1e1')]-_0x21ce4f[0x0][_0x34df('0x1de')];var _0x32f0cf=_0x53a21c['dialPredictiveInterval']*0x3c;var _0x71c8cf=_0x5c2c32[0x0][_0x34df('0x53')]+_0x5c2c32[0x0][_0x34df('0x55')];var _0x441d1b=(_0x5c2c32[0x0][_0x34df('0x4d')]+_0x5c2c32[0x0][_0x34df('0x4f')]+_0x5c2c32[0x0][_0x34df('0x51')])/_0x5c2c32[0x0][_0x34df('0x4b')];var _0x23d8a5=_0x53a21c[_0x34df('0x1d8')]/0x64;_0x53a21c['predictiveIntervalPauses']=_0x21ce4f[0x0]['outboundQueuePauses']||0x0;_0x53a21c[_0x34df('0x1c2')]=_0x441d1b>0x0?_0x441d1b:0x1;return _0x3c33d4[_0x34df('0x1d9')](_0x37f347,_0x32f0cf,_0x71c8cf,_0x441d1b,_0x23d8a5);})[_0x34df('0x3d')](function(_0x2d912d){return _0x37a937(_0x2d912d);})[_0x34df('0x9d')](function(_0x519a6d){return _0x2ed084(msgResponse(_0x34df('0x1df'),'Failure',JSON[_0x34df('0x6e')](_0x519a6d)));});}}else{return _0x2ed084(msgResponse(_0x34df('0x1da'),_0x34df('0x90'),_0x34df('0x1dc')));}});};};Dialer[_0x34df('0x19')]['startMethodPredictive']=function(_0x4685f1){var _0x30e999=this;return function(){var _0x36d578=0x0;var _0x105a5d=Math['floor'](_0x4685f1[_0x34df('0x1e2')]*0x3e8);if(_0x105a5d>0x0){_0x105a5d=_0x105a5d<0x64?0x64:_0x105a5d;loggerPredictive[_0x34df('0x49')](_0x4685f1['name'],'one\x20call\x20every:',_0x105a5d,_0x34df('0x1e3'));_0x4685f1['handlePredictive']=setInterval(function(){_0x30e999[_0x34df('0x5f')](_0x4685f1);loggerPredictiveCalls[_0x34df('0x49')](_0x34df('0x1e4'),_0x36d578+=0x1);},_0x105a5d);}else{loggerPredictive[_0x34df('0x49')](_0x4685f1[_0x34df('0x46')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x34df('0x19')][_0x34df('0x1e5')]=function(_0x30d118,_0x1b25c4){var _0x3816b3=this;return function(_0x53fbbd){if(_['isEmpty'](_0x53fbbd)){if(_[_0x34df('0xed')](_0x1b25c4[_0x34df('0x151')])||!_0x1b25c4[_0x34df('0x1e6')]){if(_0x30d118[_0x34df('0xaa')]==='booked'){_0x30d118[_0x34df('0x6c')]=_['isUndefined'](_0x30d118[_0x34df('0x6c')])?!![]:_0x30d118['queueStatusComplete'];var _0x34c584=uuid['v4']();_0x3816b3[_0x34df('0x23')][_0x34c584]=new Action(_0x30d118,_0x1b25c4,_0x34c584);loggerBooked[_0x34df('0x49')]('[booked][checkContactBlack]',_0x34c584,_0x34df('0x1e7'),JSON[_0x34df('0x6e')](_0x30d118[_0x34df('0x6c')]),'Queue:\x20',_0x30d118[_0x34df('0x46')]);if(_0x30d118[_0x34df('0x6c')]){_0x30d118[_0x34df('0x6c')]=![];_0x3816b3['queueBooked'][_0x3816b3[_0x34df('0x23')][_0x34c584][_0x34df('0xbb')]]=[];ami[_0x34df('0x98')]({'actionid':_0x34c584,'action':'queuestatus','queue':_0x30d118['name']})[_0x34df('0x9d')](function(){_0x3816b3[_0x34df('0xb9')](_0x30d118);hopperUtils[_0x34df('0xf6')]({'active':![],'ContactId':_0x3816b3[_0x34df('0x23')][_0x34c584][_0x34df('0xd7')],'ListId':_0x3816b3[_0x34df('0x23')][_0x34c584][_0x34df('0xf7')],'VoiceQueueId':_0x3816b3[_0x34df('0x23')][_0x34c584]['VoiceQueueId']||undefined,'CampaignId':_0x3816b3[_0x34df('0x23')][_0x34c584]['CampaignId']||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x1e8')));delete _0x3816b3[_0x34df('0x23')][_0x34c584];});}else{loggerBooked[_0x34df('0x49')](_0x34df('0x1e9'),JSON[_0x34df('0x6e')](_0x30d118[_0x34df('0x6c')]),_0x34df('0x1ea'),_0x30d118['name']);_0x3816b3[_0x34df('0xb9')](_0x30d118);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3816b3[_0x34df('0x23')][_0x34c584][_0x34df('0xd7')],'ListId':_0x3816b3[_0x34df('0x23')][_0x34c584]['ListId'],'VoiceQueueId':_0x3816b3['actions'][_0x34c584][_0x34df('0xd8')]||undefined,'CampaignId':_0x3816b3['actions'][_0x34c584][_0x34df('0xe5')]||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x1e8')));delete _0x3816b3[_0x34df('0x23')][_0x34c584];}}else{return _0x3816b3[_0x34df('0x1eb')](_0x30d118,_0x1b25c4);}}else{if(utils[_0x34df('0xc7')](undefined,_0x1b25c4['scheduledat'])<_0x30d118[_0x34df('0x1ec')]*0x3c){if(_0x1b25c4[_0x34df('0x155')]&&!_0x1b25c4[_0x34df('0x155')][_0x34df('0x1ed')]){_0x3816b3[_0x34df('0x1d')]['run'](_0x1b25c4['id'])[_0x34df('0x1b')](function(){_0x3816b3[_0x34df('0xb9')](_0x30d118);});}else{hopperUtils['unlockContact']({'active':![]},_0x1b25c4['id'],0x1)[_0x34df('0x1b')](function(){_0x3816b3[_0x34df('0xb9')](_0x30d118);});}}else{_0x30d118[_0x34df('0x1ee')]+=0x1;_0x3816b3[_0x34df('0xb9')](_0x30d118);if(_0x30d118[_0x34df('0x1ef')]){hopperUtils[_0x34df('0xf6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b25c4['ContactId'],'ListId':_0x1b25c4[_0x34df('0xf7')],'VoiceQueueId':_0x1b25c4[_0x34df('0xd8')]||undefined,'CampaignId':_0x1b25c4[_0x34df('0xe5')]||undefined})[_0x34df('0x9d')](loggerCatch(_0x34df('0x1f0')));hopperUtils[_0x34df('0xc1')](createObjHistory(_0x30d118,_0x1b25c4,utils[_0x34df('0x65')][_0x34df('0x1f1')],0x17,_0x34df('0x1f2')))[_0x34df('0x9d')](loggerCatch(_0x34df('0x1f3')));}else{_0x3816b3[_0x34df('0x123')](createObjHistory(_0x30d118,_0x1b25c4,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x34df('0x1f4')),'[Originate][HistoryRecallClose][historyCatch]',_0x34df('0x1f5'));}}}}else{_0x30d118[_0x34df('0x1f6')]+=0x1;_0x3816b3['saveInDb'](createObjHistory(_0x30d118,_0x1b25c4,utils[_0x34df('0x65')][_0x34df('0x1f7')],0xd,_0x34df('0x1f8')),_0x34df('0x1f9'),_0x34df('0x1fa'));throw _0x34df('0x1fb');}};};Dialer['prototype'][_0x34df('0x157')]=function(_0x4aa016){var _0x2a13a6=this;var _0x149223=_0x4aa016[_0x34df('0x1fc')]-_0x4aa016[_0x34df('0x7b')]-_0x4aa016[_0x34df('0x1fd')];emitCampaignSummary(_0x4aa016);if(_0x149223>0x0){if(_0x149223>this[_0x34df('0x22')]){_0x149223=this[_0x34df('0x22')];}_0x4aa016['temp']+=_0x149223;hopperUtils[_0x34df('0x1fe')](_0x4aa016,_0x149223)[_0x34df('0x3d')](function(_0x345b8f){_0x4aa016[_0x34df('0x1fd')]-=_0x149223;_0x4aa016[_0x34df('0x1fd')]=_0x4aa016['temp']>0x0?_0x4aa016['temp']:0x0;if(!utils['checkContactEmpty'](_0x345b8f)){_0x4aa016['message']=utils['CAMPAIGN_STATUS'][_0x34df('0x68')];logger[_0x34df('0x49')](_0x34df('0x1ff')+_0x4aa016[_0x34df('0x46')]);}else{_0x4aa016[_0x34df('0x7b')]+=_0x345b8f['length'];_0x4aa016[_0x34df('0x64')]=utils[_0x34df('0x65')][_0x34df('0x200')];for(var _0x238787=0x0;_0x238787<_0x345b8f[_0x34df('0x96')];_0x238787+=0x1){_0x4aa016['ivrTotalCallsDays']+=0x1;if(_[_0x34df('0xed')](_0x345b8f[_0x238787])||_['isNil'](_0x345b8f[_0x238787]['Contact'])||_[_0x34df('0xed')](_0x345b8f[_0x238787]['phone'])){_0x2a13a6[_0x34df('0x201')](_0x34df('0x202'),_0x4aa016,_0x345b8f[_0x238787]);}else{hopperUtils[_0x34df('0x203')](_[_0x34df('0x6f')](_0x345b8f[_0x238787],[_0x34df('0xe5'),_0x34df('0x15a')]))[_0x34df('0x3d')](_0x2a13a6[_0x34df('0x1e5')](_0x4aa016,_0x345b8f[_0x238787]))[_0x34df('0x9d')](_0x2a13a6[_0x34df('0x14f')](_0x34df('0x204'),_0x4aa016));}}}})[_0x34df('0x9d')](loggerGetContactDialer('[getContactCampaign2]',_0x4aa016,_0x149223));}};Dialer[_0x34df('0x19')][_0x34df('0xab')]=function(_0x4764f0,_0x4ee671){var _0x190fca=this;var _0x19919b=[];if(_0x4ee671<0x1||_0x4764f0[_0x34df('0xaa')]===_0x34df('0x7')){_0x4ee671=0x1;}var _0x189f02=Math[_0x34df('0x205')](_0x4764f0[_0x34df('0x1c0')]*_0x4ee671)-_0x4764f0['originated']-_0x4764f0['temp'];if(_0x4764f0[_0x34df('0x206')]>0x0){var _0x3c449c=_0x4764f0[_0x34df('0x206')]-_0x4764f0[_0x34df('0x7b')]-_0x4764f0['talking']-_0x4764f0[_0x34df('0x1fd')]-_0x4764f0['pTalking'];if(_0x189f02>_0x3c449c){_0x189f02=_0x3c449c;}}if(_0x189f02>0x0){if(_0x4764f0[_0x34df('0xaa')]===_0x34df('0x7')){_0x189f02=0x1;}if(_0x189f02>this[_0x34df('0x22')]){_0x189f02=this[_0x34df('0x22')];}_0x4764f0[_0x34df('0x1fd')]+=_0x189f02;for(var _0x175470 in this[_0x34df('0x20')]){if(typeof this[_0x34df('0x20')][_0x175470]!==_0x34df('0xa5')){if(this['agents'][_0x175470][_0x34df('0xca')]===_0x34df('0x207')&&this[_0x34df('0x20')][_0x175470][_0x34df('0x85')]==='reachable'){_0x19919b[_0x34df('0x97')](this[_0x34df('0x20')][_0x175470]['id']);}}}hopperUtils[_0x34df('0x208')](_0x4764f0,_0x19919b,_0x189f02)[_0x34df('0x3d')](function(_0x2cd55a){_0x4764f0[_0x34df('0x1fd')]-=_0x189f02;_0x4764f0[_0x34df('0x1fd')]=_0x4764f0[_0x34df('0x1fd')]>0x0?_0x4764f0[_0x34df('0x1fd')]:0x0;if(!utils[_0x34df('0x209')](_0x2cd55a)){hopperUtils[_0x34df('0x20a')](_0x4764f0)['then'](sendMessageReschedule(_0x4764f0))['catch'](loggerCatch(_0x34df('0x20b')));}else{_0x4764f0[_0x34df('0x7b')]+=_0x2cd55a['length'];_0x4764f0[_0x34df('0x64')]=_0x4764f0['dialMethod']===_0x34df('0x7')?utils[_0x34df('0x65')]['ACTIVE']:utils[_0x34df('0x65')]['RUNNING'];for(var _0x5f2fed=0x0;_0x5f2fed<_0x2cd55a[_0x34df('0x96')];_0x5f2fed+=0x1){if(_[_0x34df('0xed')](_0x2cd55a[_0x5f2fed])||_['isNil'](_0x2cd55a[_0x5f2fed]['Contact'])||_['isNil'](_0x2cd55a[_0x5f2fed][_0x34df('0x15a')])){_0x190fca['emptyContact'](_0x34df('0x202'),_0x4764f0,_0x2cd55a[_0x5f2fed]);}else{hopperUtils[_0x34df('0x20c')](_[_0x34df('0x6f')](_0x2cd55a[_0x5f2fed],[_0x34df('0xd8'),_0x34df('0x15a')]))[_0x34df('0x3d')](_0x190fca[_0x34df('0x1e5')](_0x4764f0,_0x2cd55a[_0x5f2fed]))[_0x34df('0x9d')](_0x190fca[_0x34df('0x14f')](_0x34df('0x202'),_0x4764f0));}}}})[_0x34df('0x9d')](loggerGetContactDialer(_0x34df('0x20d'),_0x4764f0,_0x189f02));}};Dialer['prototype'][_0x34df('0x5f')]=function(_0x31f1a0){if(_0x31f1a0['dialLimitQueue']>0x0){var _0x16db57=_0x31f1a0['dialLimitQueue']-_0x31f1a0[_0x34df('0x7b')]-_0x31f1a0[_0x34df('0x135')];if(_0x16db57>0x0){this[_0x34df('0x20e')](_0x31f1a0);}else{loggerPredictiveCalls[_0x34df('0x49')](_0x34df('0x20f'));}}else{this[_0x34df('0x20e')](_0x31f1a0);}};Dialer['prototype'][_0x34df('0x20e')]=function(_0x28319d){var _0x404e8e=this;var _0xe69983=[];_0x28319d[_0x34df('0x7b')]+=0x1;for(var _0x3dbc25 in this[_0x34df('0x20')]){if(typeof this[_0x34df('0x20')][_0x3dbc25]!=='undefined'){if(this[_0x34df('0x20')][_0x3dbc25][_0x34df('0xca')]==='not_inuse'&&this['agents'][_0x3dbc25]['status']===_0x34df('0x86')){_0xe69983[_0x34df('0x97')](this['agents'][_0x3dbc25]['id']);}}}return this[_0x34df('0x208')](_0x28319d['id'],_0xe69983,0x1,_0x28319d['dialOrderByScheduledAt'],_0x28319d)[_0x34df('0x3d')](function(_0x19a41c){if(!utils[_0x34df('0x209')](_0x19a41c)){utils[_0x34df('0x210')](_0x28319d,0x1,0x0);return hopperUtils[_0x34df('0x20a')](_0x28319d)[_0x34df('0x3d')](sendMessageReschedule(_0x28319d))[_0x34df('0x9d')](loggerCatch(_0x34df('0x20b')));}else{_0x28319d['message']=utils['CAMPAIGN_STATUS'][_0x34df('0x200')];if(_['isNil'](_0x19a41c[0x0])||_['isNil'](_0x19a41c[0x0][_0x34df('0x172')])||_[_0x34df('0xed')](_0x19a41c[0x0][_0x34df('0x15a')])){_0x404e8e[_0x34df('0x201')](_0x34df('0x202'),_0x28319d,_0x19a41c[0x0]);}else{return hopperUtils[_0x34df('0x20c')](_[_0x34df('0x6f')](_0x19a41c[0x0],[_0x34df('0xd8'),_0x34df('0x15a')]))[_0x34df('0x3d')](_0x404e8e['checkContactBlack'](_0x28319d,_0x19a41c[0x0]))['catch'](_0x404e8e[_0x34df('0x14f')](_0x34df('0x211'),_0x28319d));}}})[_0x34df('0x9d')](loggerGetContactDialer(_0x34df('0x212'),_0x28319d,0x1));};Dialer[_0x34df('0x19')][_0x34df('0x1d7')]=function(_0x485076,_0x45c3f1,_0x5b36d6,_0x296bd7,_0x318c89,_0xcbf50e){loggerPredictive[_0x34df('0x49')](_0x34df('0x213'));loggerPredictive[_0x34df('0x49')](_0x34df('0x214'),_0x485076);loggerPredictive[_0x34df('0x49')](_0x34df('0x215'),_0x45c3f1);loggerPredictive[_0x34df('0x49')](_0x34df('0x216'),_0x5b36d6);loggerPredictive[_0x34df('0x49')](_0x34df('0x217'),_0x296bd7);loggerPredictive[_0x34df('0x49')](_0x34df('0x218'),_0x318c89);loggerPredictive[_0x34df('0x49')](_0x34df('0x219'));return new Promise(function(_0x2bf796,_0x452cab){if(_0x485076<=0x0||isNaN(_0x485076)){return _0x452cab(msgResponse(_0x34df('0x21a'),_0x34df('0x81'),_0x34df('0x21b')+_0x485076));}if(_0x5b36d6<=0x0||isNaN(_0x5b36d6)){return _0x452cab(msgResponse(_0x34df('0x21a'),_0x34df('0x81'),_0x34df('0x21c')+_0x5b36d6));}if(_0x296bd7<=0x0||isNaN(_0x296bd7)){return _0x452cab(msgResponse(_0x34df('0x21a'),_0x34df('0x81'),_0x34df('0x21d')+_0x296bd7));}if(_0x45c3f1<=0x0||isNaN(_0x45c3f1)){return _0x452cab(msgResponse(_0x34df('0x21a'),_0x34df('0x81'),_0x34df('0x21e')+_0x45c3f1));}if(_0x318c89<=0x0||isNaN(_0x318c89)){return _0x452cab(msgResponse(_0x34df('0x21a'),_0x34df('0x81'),_0x34df('0x21f')+_0x318c89));}_0xcbf50e=_0xcbf50e||0x0;var _0xf72e09=0x1/_0x5b36d6;var _0x330716=0x0;var _0x2c7367=0x0;var _0x55ba1b=0x0;var _0x1371f6=0x0;for(var _0x290d48=0x0;_0x55ba1b<_0x318c89;_0x290d48+=0x1){_0x2c7367=_0x290d48/_0x45c3f1;_0x330716=(_0x296bd7*_0x2c7367+_0xcbf50e)/_0xf72e09;_0x55ba1b=utils[_0x34df('0x220')](_0x330716,_0x485076);_0x1371f6=_0x330716/_0x485076*(0x1-utils[_0x34df('0x220')](_0x330716,_0x485076));}return _0x2bf796({'erlangCalls':_0x290d48,'erlangCallToSecond':_0x45c3f1/_0x290d48,'erlangAbandonmentRate':_0x55ba1b,'erlangBusyFactor':_0x1371f6});});};Dialer[_0x34df('0x19')]['busyFactor']=function(_0x55e553,_0x527094,_0x3da647,_0x515dee,_0x195bfa,_0x3d818a){loggerPredictive[_0x34df('0x49')](_0x34df('0x221'));loggerPredictive[_0x34df('0x49')](_0x34df('0x214'),_0x55e553);loggerPredictive[_0x34df('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x527094);loggerPredictive[_0x34df('0x49')](_0x34df('0x216'),_0x3da647);loggerPredictive[_0x34df('0x49')](_0x34df('0x217'),_0x515dee);loggerPredictive[_0x34df('0x49')](_0x34df('0x222'),_0x195bfa);loggerPredictive[_0x34df('0x49')](_0x34df('0x219'));return new Promise(function(_0x2ff946,_0xf46b16){if(_0x55e553<=0x0||isNaN(_0x55e553)){return _0xf46b16(msgResponse(_0x34df('0x223'),_0x34df('0x81'),_0x34df('0x21b')+_0x55e553));}if(_0x3da647<=0x0||isNaN(_0x3da647)){return _0xf46b16(msgResponse('[busyFactor]',_0x34df('0x81'),'Ts\x20=\x20'+_0x3da647));}if(_0x515dee<=0x0||isNaN(_0x515dee)){return _0xf46b16(msgResponse(_0x34df('0x223'),_0x34df('0x81'),_0x34df('0x21d')+_0x515dee));}if(_0x527094<=0x0||isNaN(_0x527094)){return _0xf46b16(msgResponse(_0x34df('0x223'),'Error',_0x34df('0x21e')+_0x527094));}if(_0x195bfa<=0x0||isNaN(_0x195bfa)){return _0xf46b16(msgResponse('[busyFactor]',_0x34df('0x81'),_0x34df('0x224')+_0x195bfa));}_0x3d818a=_0x3d818a||0x0;var _0x205f47=0x1/_0x3da647;var _0x28f15f=0x0;var _0xe92ad6=0x0;var _0x2aa529=0x0;var _0xbdb4d=0x0;for(var _0x49c941=0x0;_0xbdb4d<_0x195bfa;_0x49c941+=0x1){_0xe92ad6=_0x49c941/_0x527094;_0x28f15f=(_0x515dee*_0xe92ad6+_0x3d818a)/_0x205f47;_0x2aa529=utils[_0x34df('0x220')](_0x28f15f,_0x55e553);_0xbdb4d=_0x28f15f/_0x55e553*(0x1-utils['erlangb'](_0x28f15f,_0x55e553));}return _0x2ff946({'erlangCalls':_0x49c941,'erlangCallToSecond':_0x527094/_0x49c941,'erlangAbandonmentRate':_0x2aa529,'erlangBusyFactor':_0xbdb4d});});};module[_0x34df('0x225')]=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 0ab3cf2..0073094 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 _0x2d81=['voiceQueue','uniqueid','name','firstName','Contact','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','number','substring','getQueue','moment','isNil','string'];(function(_0x1c9fc4,_0x1654cb){var _0x5b9763=function(_0x48e36d){while(--_0x48e36d){_0x1c9fc4['push'](_0x1c9fc4['shift']());}};_0x5b9763(++_0x1654cb);}(_0x2d81,0x1ab));var _0x12d8=function(_0x338e51,_0x26291c){_0x338e51=_0x338e51-0x0;var _0x552ad5=_0x2d81[_0x338e51];return _0x552ad5;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x12d8('0x0'));function checkNameSurname(_0x5d3314,_0x40feb2,_0x4121c0){var _0x4cc149='';if(!_[_0x12d8('0x1')](_0x40feb2)&&_0x12d8('0x2')===typeof _0x40feb2){_0x4cc149+=_0x40feb2;}if(!_['isNil'](_0x4121c0)&&'string'===typeof _0x4121c0){_0x4cc149+='\x20'+_0x4121c0;}if(_0x4cc149!==''){return _0x4cc149;}return _0x5d3314;}function Action(_0x5451b0,_0x8a9711,_0x32a48b){this[_0x12d8('0x3')]=_0x5451b0;this[_0x12d8('0x4')]=_0x32a48b||undefined;this[_0x12d8('0x5')]=checkNameSurname(_0x8a9711['Contact']['phone'],_0x8a9711['Contact'][_0x12d8('0x6')],_0x8a9711[_0x12d8('0x7')][_0x12d8('0x8')]);this['number']=_0x8a9711[_0x12d8('0x9')];this[_0x12d8('0xa')]=_0x5451b0[_0x12d8('0x5')];this[_0x12d8('0xb')]=_0x8a9711[_0x12d8('0xb')]||![];this[_0x12d8('0xc')]=_0x5451b0[_0x12d8('0xc')];this[_0x12d8('0xd')]=_0x5451b0['dialQueueTimeout']||0x3;this['scheduledat']=_0x8a9711[_0x12d8('0xe')];this[_0x12d8('0xf')]=_0x8a9711[_0x12d8('0xf')];this[_0x12d8('0x10')]=_0x8a9711[_0x12d8('0x10')];this[_0x12d8('0x11')]=_0x8a9711['countnoanswerretry'];this[_0x12d8('0x12')]=_0x8a9711['countnosuchnumberretry'];this[_0x12d8('0x13')]=_0x8a9711[_0x12d8('0x13')];this[_0x12d8('0x14')]=_0x8a9711[_0x12d8('0x14')];this['countmachineretry']=_0x8a9711[_0x12d8('0x15')];this['countagentrejectretry']=_0x8a9711['countagentrejectretry'];this[_0x12d8('0x16')]=_0x8a9711[_0x12d8('0x16')];this[_0x12d8('0x17')]=_0x8a9711[_0x12d8('0x17')];this[_0x12d8('0x18')]=_0x8a9711[_0x12d8('0x18')];this[_0x12d8('0x19')]=_0x8a9711[_0x12d8('0x19')];this['CampaignId']=_0x8a9711[_0x12d8('0x1a')];this[_0x12d8('0x1b')]=_0x8a9711['id'];this['ContactFirstName']=_0x8a9711['Contact'][_0x12d8('0x6')]||'';this[_0x12d8('0x1c')]=moment()[_0x12d8('0x1d')](_0x12d8('0x1e'));this[_0x12d8('0x1f')]=_0x8a9711[_0x12d8('0x1f')];this[_0x12d8('0x20')]=_0x8a9711[_0x12d8('0x20')];this[_0x12d8('0x21')]=_0x8a9711[_0x12d8('0x21')];this[_0x12d8('0x22')]=_0x8a9711[_0x12d8('0x22')];this[_0x12d8('0x23')]='';this[_0x12d8('0x24')]='';}Action[_0x12d8('0x25')][_0x12d8('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue'][_0x12d8('0x27')]>0x0?this[_0x12d8('0x28')][_0x12d8('0x29')](this['voiceQueue']['dialCutDigit']):this[_0x12d8('0x28')]);};Action['prototype'][_0x12d8('0x2a')]=function(){return this[_0x12d8('0xa')];};module['exports']=Action; \ No newline at end of file +var _0x6acf=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','format','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active'];(function(_0x24fd53,_0x419ae5){var _0x4a21bc=function(_0x7cf5d9){while(--_0x7cf5d9){_0x24fd53['push'](_0x24fd53['shift']());}};_0x4a21bc(++_0x419ae5);}(_0x6acf,0xa9));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf6ac('0x0'));var _=require(_0xf6ac('0x1'));var moment=require(_0xf6ac('0x2'));function checkNameSurname(_0x22335d,_0x4162d7,_0x3df561){var _0x3c78b0='';if(!_[_0xf6ac('0x3')](_0x4162d7)&&_0xf6ac('0x4')===typeof _0x4162d7){_0x3c78b0+=_0x4162d7;}if(!_['isNil'](_0x3df561)&&_0xf6ac('0x4')===typeof _0x3df561){_0x3c78b0+='\x20'+_0x3df561;}if(_0x3c78b0!==''){return _0x3c78b0;}return _0x22335d;}function Action(_0x47baa8,_0x10a263,_0x1d0bf0){this[_0xf6ac('0x5')]=_0x47baa8;this[_0xf6ac('0x6')]=_0x1d0bf0||undefined;this[_0xf6ac('0x7')]=checkNameSurname(_0x10a263['Contact'][_0xf6ac('0x8')],_0x10a263[_0xf6ac('0x9')][_0xf6ac('0xa')],_0x10a263['Contact'][_0xf6ac('0xb')]);this[_0xf6ac('0xc')]=_0x10a263[_0xf6ac('0x8')];this[_0xf6ac('0xd')]=_0x47baa8[_0xf6ac('0x7')];this['active']=_0x10a263[_0xf6ac('0xe')]||![];this[_0xf6ac('0xf')]=_0x47baa8[_0xf6ac('0xf')];this[_0xf6ac('0x10')]=_0x47baa8[_0xf6ac('0x10')]||0x3;this[_0xf6ac('0x11')]=_0x10a263['scheduledat'];this[_0xf6ac('0x12')]=_0x10a263[_0xf6ac('0x12')];this[_0xf6ac('0x13')]=_0x10a263[_0xf6ac('0x13')];this['countnoanswerretry']=_0x10a263[_0xf6ac('0x14')];this[_0xf6ac('0x15')]=_0x10a263[_0xf6ac('0x15')];this[_0xf6ac('0x16')]=_0x10a263[_0xf6ac('0x16')];this[_0xf6ac('0x17')]=_0x10a263['countabandonedretry'];this[_0xf6ac('0x18')]=_0x10a263['countmachineretry'];this['countagentrejectretry']=_0x10a263[_0xf6ac('0x19')];this[_0xf6ac('0x1a')]=_0x10a263['ContactId'];this[_0xf6ac('0x1b')]=_0x10a263[_0xf6ac('0x1b')];this['UserId']=_0x10a263['UserId'];this[_0xf6ac('0x1c')]=_0x10a263[_0xf6ac('0x1c')];this[_0xf6ac('0x1d')]=_0x10a263[_0xf6ac('0x1d')];this[_0xf6ac('0x1e')]=_0x10a263['id'];this[_0xf6ac('0x1f')]=_0x10a263[_0xf6ac('0x9')][_0xf6ac('0xa')]||'';this[_0xf6ac('0x20')]=moment()['format'](_0xf6ac('0x21'));this[_0xf6ac('0x22')]=_0x10a263[_0xf6ac('0x22')];this[_0xf6ac('0x23')]=_0x10a263[_0xf6ac('0x23')];this[_0xf6ac('0x24')]=_0x10a263[_0xf6ac('0x24')];this['recallme']=_0x10a263[_0xf6ac('0x25')];this[_0xf6ac('0x26')]='';this['originatecalleridname']='';}Action['prototype'][_0xf6ac('0x27')]=function(){return util[_0xf6ac('0x28')]('\x22%s\x22\x20<%s>',this[_0xf6ac('0x7')],this[_0xf6ac('0x5')][_0xf6ac('0x29')]>0x0?this[_0xf6ac('0xc')][_0xf6ac('0x2a')](this['voiceQueue'][_0xf6ac('0x29')]):this[_0xf6ac('0xc')]);};Action[_0xf6ac('0x2b')][_0xf6ac('0x2c')]=function(){return this[_0xf6ac('0xd')];};module[_0xf6ac('0x2d')]=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 8790d45..8874bbc 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 _0x7a9c=['callback','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','reason'];(function(_0x40cf20,_0x3b5733){var _0x58dbd3=function(_0x1b5b15){while(--_0x1b5b15){_0x40cf20['push'](_0x40cf20['shift']());}};_0x58dbd3(++_0x3b5733);}(_0x7a9c,0x197));var _0xc7a9=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x7a9c[_0x1c208e];return _0x5104ff;};'use strict';var moment=require('moment');var utils=require(_0xc7a9('0x0'));function AgentComplete(_0x714b3,_0xf76a96){this[_0xc7a9('0x1')]=0x4;this[_0xc7a9('0x2')]='Answer';this[_0xc7a9('0x3')]=_0x714b3[_0xc7a9('0x3')];this[_0xc7a9('0x4')]=_0x714b3[_0xc7a9('0x4')];this[_0xc7a9('0x5')]=_0x714b3[_0xc7a9('0x4')]===_0xc7a9('0x6')?_0xc7a9('0x7'):_0x714b3['type'];this[_0xc7a9('0x8')]=_0x714b3[_0xc7a9('0x8')];this['countcongestionretry']=_0x714b3[_0xc7a9('0x9')];this[_0xc7a9('0xa')]=_0x714b3['countnoanswerretry'];this[_0xc7a9('0xb')]=_0x714b3[_0xc7a9('0x8')]+_0x714b3['countcongestionretry']+_0x714b3['countnoanswerretry']+_0x714b3[_0xc7a9('0xc')]+_0x714b3[_0xc7a9('0xd')]+_0x714b3['countabandonedretry']+_0x714b3[_0xc7a9('0xe')]+_0x714b3[_0xc7a9('0xf')];this[_0xc7a9('0xc')]=_0x714b3[_0xc7a9('0xc')];this[_0xc7a9('0xd')]=_0x714b3[_0xc7a9('0xd')];this[_0xc7a9('0x10')]=_0x714b3['countabandonedretry'];this['countmachineretry']=_0x714b3[_0xc7a9('0xe')];this[_0xc7a9('0xf')]=_0x714b3[_0xc7a9('0xf')];this['uniqueid']=_0xf76a96[_0xc7a9('0x11')];this[_0xc7a9('0x12')]=_0x714b3['name'];this[_0xc7a9('0x13')]=_0x714b3[_0xc7a9('0x14')];this[_0xc7a9('0x15')]=_0x714b3[_0xc7a9('0x15')];this[_0xc7a9('0x16')]=_0x714b3['responsetime'];this[_0xc7a9('0x17')]=_0x714b3[_0xc7a9('0x17')];this[_0xc7a9('0x18')]=moment()[_0xc7a9('0x19')](_0xc7a9('0x1a'));this[_0xc7a9('0x1b')]=utils['getSeconds'](_0x714b3[_0xc7a9('0x16')],_0x714b3[_0xc7a9('0x15')]);this[_0xc7a9('0x1c')]=utils[_0xc7a9('0x1d')](_0x714b3[_0xc7a9('0x17')],_0x714b3[_0xc7a9('0x16')]);this[_0xc7a9('0x1e')]=utils[_0xc7a9('0x1d')](this[_0xc7a9('0x18')],_0x714b3['answertime']);this[_0xc7a9('0x7')]=_0xf76a96[_0xc7a9('0x7')];this[_0xc7a9('0x1f')]=_0xf76a96[_0xc7a9('0x1f')];this[_0xc7a9('0x20')]=_0xf76a96[_0xc7a9('0x20')];this[_0xc7a9('0x21')]=_0x714b3[_0xc7a9('0x21')];this['callbackuniqueid']=_0x714b3['callbackuniqueid'];this['callbackat']=_0x714b3[_0xc7a9('0x22')];this['recallme']=_0x714b3[_0xc7a9('0x23')];this['ContactId']=_0x714b3['ContactId'];this[_0xc7a9('0x24')]=_0x714b3[_0xc7a9('0x24')];this[_0xc7a9('0x25')]=_0x714b3[_0xc7a9('0x25')];this['VoiceQueueId']=_0x714b3[_0xc7a9('0x26')];this[_0xc7a9('0x27')]=_0x714b3['CampaignId'];this[_0xc7a9('0x28')]=_0x714b3[_0xc7a9('0x28')]||'';this[_0xc7a9('0x29')]=_0x714b3[_0xc7a9('0x29')]||'';this[_0xc7a9('0x2a')]=_0x714b3[_0xc7a9('0x2a')];}module[_0xc7a9('0x2b')]=AgentComplete; \ No newline at end of file +var _0x90ec=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry'];(function(_0x41a583,_0x2a7ca3){var _0xfe45f8=function(_0x181449){while(--_0x181449){_0x41a583['push'](_0x41a583['shift']());}};_0xfe45f8(++_0x2a7ca3);}(_0x90ec,0x139));var _0xc90e=function(_0x5dffd8,_0xcc807c){_0x5dffd8=_0x5dffd8-0x0;var _0x567a85=_0x90ec[_0x5dffd8];return _0x567a85;};'use strict';var moment=require(_0xc90e('0x0'));var utils=require(_0xc90e('0x1'));function AgentComplete(_0x1a658e,_0x560d35){this['state']=0x4;this[_0xc90e('0x2')]='Answer';this[_0xc90e('0x3')]=_0x1a658e[_0xc90e('0x3')];this[_0xc90e('0x4')]=_0x1a658e[_0xc90e('0x4')];this[_0xc90e('0x5')]=_0x1a658e[_0xc90e('0x4')]===_0xc90e('0x6')?'queue':_0x1a658e[_0xc90e('0x4')];this[_0xc90e('0x7')]=_0x1a658e[_0xc90e('0x7')];this['countcongestionretry']=_0x1a658e[_0xc90e('0x8')];this[_0xc90e('0x9')]=_0x1a658e['countnoanswerretry'];this[_0xc90e('0xa')]=_0x1a658e['countbusyretry']+_0x1a658e[_0xc90e('0x8')]+_0x1a658e[_0xc90e('0x9')]+_0x1a658e['countnosuchnumberretry']+_0x1a658e[_0xc90e('0xb')]+_0x1a658e[_0xc90e('0xc')]+_0x1a658e[_0xc90e('0xd')]+_0x1a658e['countagentrejectretry'];this[_0xc90e('0xe')]=_0x1a658e[_0xc90e('0xe')];this[_0xc90e('0xb')]=_0x1a658e[_0xc90e('0xb')];this[_0xc90e('0xc')]=_0x1a658e[_0xc90e('0xc')];this[_0xc90e('0xd')]=_0x1a658e[_0xc90e('0xd')];this[_0xc90e('0xf')]=_0x1a658e[_0xc90e('0xf')];this[_0xc90e('0x10')]=_0x560d35[_0xc90e('0x10')];this[_0xc90e('0x11')]=_0x1a658e[_0xc90e('0x12')];this[_0xc90e('0x13')]=_0x1a658e['number'];this[_0xc90e('0x14')]=_0x1a658e[_0xc90e('0x14')];this[_0xc90e('0x15')]=_0x1a658e[_0xc90e('0x15')];this['answertime']=_0x1a658e['answertime'];this[_0xc90e('0x16')]=moment()['format'](_0xc90e('0x17'));this[_0xc90e('0x18')]=utils[_0xc90e('0x19')](_0x1a658e[_0xc90e('0x15')],_0x1a658e[_0xc90e('0x14')]);this['holdtime']=utils[_0xc90e('0x19')](_0x1a658e['answertime'],_0x1a658e['responsetime']);this['talktime']=utils[_0xc90e('0x19')](this[_0xc90e('0x16')],_0x1a658e['answertime']);this['queue']=_0x560d35['queue'];this['membername']=_0x560d35[_0xc90e('0x1a')];this[_0xc90e('0x1b')]=_0x560d35[_0xc90e('0x1b')];this[_0xc90e('0x1c')]=_0x1a658e[_0xc90e('0x1c')];this[_0xc90e('0x1d')]=_0x1a658e[_0xc90e('0x1d')];this[_0xc90e('0x1e')]=_0x1a658e[_0xc90e('0x1e')];this[_0xc90e('0x1f')]=_0x1a658e['recallme'];this[_0xc90e('0x20')]=_0x1a658e[_0xc90e('0x20')];this[_0xc90e('0x21')]=_0x1a658e[_0xc90e('0x21')];this['UserId']=_0x1a658e[_0xc90e('0x22')];this[_0xc90e('0x23')]=_0x1a658e[_0xc90e('0x23')];this[_0xc90e('0x24')]=_0x1a658e['CampaignId'];this[_0xc90e('0x25')]=_0x1a658e[_0xc90e('0x25')]||'';this[_0xc90e('0x26')]=_0x1a658e[_0xc90e('0x26')]||'';this[_0xc90e('0x27')]=_0x1a658e[_0xc90e('0x27')];}module[_0xc90e('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 7c78d5a..877c619 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 _0xddc2=['countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5beb3b,_0x493142){var _0x44aa86=function(_0x822a50){while(--_0x822a50){_0x5beb3b['push'](_0x5beb3b['shift']());}};_0x44aa86(++_0x493142);}(_0xddc2,0xa2));var _0x2ddc=function(_0x2b92f9,_0x5889c0){_0x2b92f9=_0x2b92f9-0x0;var _0x2937fb=_0xddc2[_0x2b92f9];return _0x2937fb;};'use strict';function Final(_0x51b90a){this[_0x2ddc('0x0')]=_0x51b90a[_0x2ddc('0x0')];this[_0x2ddc('0x1')]=_0x51b90a[_0x2ddc('0x1')];this[_0x2ddc('0x2')]=_0x51b90a[_0x2ddc('0x2')];this[_0x2ddc('0x3')]=_0x51b90a[_0x2ddc('0x2')]===_0x2ddc('0x4')?'queue':_0x51b90a['type'];this['countbusyretry']=_0x51b90a['countbusyretry'];this['countcongestionretry']=_0x51b90a[_0x2ddc('0x5')];this[_0x2ddc('0x6')]=_0x51b90a[_0x2ddc('0x6')];this[_0x2ddc('0x7')]=_0x51b90a[_0x2ddc('0x8')]+_0x51b90a[_0x2ddc('0x5')]+_0x51b90a[_0x2ddc('0x6')]+_0x51b90a[_0x2ddc('0x9')]+_0x51b90a[_0x2ddc('0xa')]+_0x51b90a[_0x2ddc('0xb')]+_0x51b90a['countmachineretry']+_0x51b90a[_0x2ddc('0xc')];this[_0x2ddc('0x9')]=_0x51b90a[_0x2ddc('0x9')];this[_0x2ddc('0xa')]=_0x51b90a[_0x2ddc('0xa')];this[_0x2ddc('0xb')]=_0x51b90a[_0x2ddc('0xb')];this[_0x2ddc('0xd')]=_0x51b90a[_0x2ddc('0xd')];this['countagentrejectretry']=_0x51b90a[_0x2ddc('0xc')];this['queue']=_0x51b90a[_0x2ddc('0xe')];this[_0x2ddc('0xf')]=_0x51b90a[_0x2ddc('0xf')];this[_0x2ddc('0x10')]=_0x51b90a['calleridnum'];this[_0x2ddc('0x11')]=_0x51b90a['starttime'];this[_0x2ddc('0x12')]=_0x51b90a[_0x2ddc('0x12')];this['endtime']=_0x51b90a['responsetime'];this[_0x2ddc('0x13')]=_0x51b90a[_0x2ddc('0x13')]||0x0;this['holdtime']=_0x51b90a['holdtime']||0x0;this['talktime']=_0x51b90a['talktime']||0x0;this[_0x2ddc('0x14')]=_0x51b90a['callback'];this['callbackuniqueid']=_0x51b90a[_0x2ddc('0x15')];this[_0x2ddc('0x16')]=_0x51b90a[_0x2ddc('0x16')];this['recallme']=_0x51b90a[_0x2ddc('0x17')];this[_0x2ddc('0x18')]=_0x51b90a[_0x2ddc('0x18')];this[_0x2ddc('0x19')]=_0x51b90a['ListId'];this['UserId']=_0x51b90a[_0x2ddc('0x1a')];this[_0x2ddc('0x1b')]=_0x51b90a['VoiceQueueId'];this[_0x2ddc('0x1c')]=_0x51b90a[_0x2ddc('0x1c')];this[_0x2ddc('0x1d')]=_0x51b90a['originatecalleridnum']||'';this[_0x2ddc('0x1e')]=_0x51b90a[_0x2ddc('0x1e')]||'';this[_0x2ddc('0x1f')]=_0x51b90a[_0x2ddc('0x1f')];this[_0x2ddc('0x20')]=_0x51b90a[_0x2ddc('0x20')];}module[_0x2ddc('0x21')]=Final; \ No newline at end of file +var _0x2e72=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x20181d,_0x485385){var _0x1e72f9=function(_0x177fec){while(--_0x177fec){_0x20181d['push'](_0x20181d['shift']());}};_0x1e72f9(++_0x485385);}(_0x2e72,0x115));var _0x22e7=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x2e72[_0x3cba93];return _0x4a2991;};'use strict';function Final(_0x105235){this['uniqueid']=_0x105235[_0x22e7('0x0')];this[_0x22e7('0x1')]=_0x105235[_0x22e7('0x1')];this['type']=_0x105235[_0x22e7('0x2')];this[_0x22e7('0x3')]=_0x105235['type']==='outbound'?_0x22e7('0x4'):_0x105235[_0x22e7('0x2')];this[_0x22e7('0x5')]=_0x105235[_0x22e7('0x5')];this[_0x22e7('0x6')]=_0x105235[_0x22e7('0x6')];this['countnoanswerretry']=_0x105235['countnoanswerretry'];this[_0x22e7('0x7')]=_0x105235['countbusyretry']+_0x105235['countcongestionretry']+_0x105235['countnoanswerretry']+_0x105235[_0x22e7('0x8')]+_0x105235[_0x22e7('0x9')]+_0x105235[_0x22e7('0xa')]+_0x105235[_0x22e7('0xb')]+_0x105235[_0x22e7('0xc')];this['countnosuchnumberretry']=_0x105235[_0x22e7('0x8')];this['countdropretry']=_0x105235[_0x22e7('0x9')];this['countabandonedretry']=_0x105235[_0x22e7('0xa')];this['countmachineretry']=_0x105235[_0x22e7('0xb')];this[_0x22e7('0xc')]=_0x105235['countagentrejectretry'];this[_0x22e7('0x4')]=_0x105235[_0x22e7('0x4')];this['calleridname']=_0x105235[_0x22e7('0xd')];this['calleridnum']=_0x105235['calleridnum'];this[_0x22e7('0xe')]=_0x105235['starttime'];this['responsetime']=_0x105235[_0x22e7('0xf')];this[_0x22e7('0x10')]=_0x105235[_0x22e7('0xf')];this[_0x22e7('0x11')]=_0x105235[_0x22e7('0x11')]||0x0;this[_0x22e7('0x12')]=_0x105235[_0x22e7('0x12')]||0x0;this[_0x22e7('0x13')]=_0x105235['talktime']||0x0;this[_0x22e7('0x14')]=_0x105235[_0x22e7('0x14')];this[_0x22e7('0x15')]=_0x105235['callbackuniqueid'];this[_0x22e7('0x16')]=_0x105235[_0x22e7('0x16')];this[_0x22e7('0x17')]=_0x105235[_0x22e7('0x17')];this[_0x22e7('0x18')]=_0x105235[_0x22e7('0x18')];this[_0x22e7('0x19')]=_0x105235['ListId'];this['UserId']=_0x105235[_0x22e7('0x1a')];this[_0x22e7('0x1b')]=_0x105235[_0x22e7('0x1b')];this[_0x22e7('0x1c')]=_0x105235[_0x22e7('0x1c')];this[_0x22e7('0x1d')]=_0x105235[_0x22e7('0x1d')]||'';this[_0x22e7('0x1e')]=_0x105235[_0x22e7('0x1e')]||'';this[_0x22e7('0x1f')]=_0x105235['state'];this[_0x22e7('0x20')]=_0x105235[_0x22e7('0x20')];}module['exports']=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 3b01488..bc0fa43 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 _0xe951=['endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x5c67a9,_0x14f104){var _0x5a1979=function(_0x3c6116){while(--_0x3c6116){_0x5c67a9['push'](_0x5c67a9['shift']());}};_0x5a1979(++_0x14f104);}(_0xe951,0x10d));var _0x1e95=function(_0x12f59c,_0x13d956){_0x12f59c=_0x12f59c-0x0;var _0x2db43e=_0xe951[_0x12f59c];return _0x2db43e;};'use strict';var moment=require('moment');var utils=require(_0x1e95('0x0'));function Hangup(_0x139557,_0x59e466){this[_0x1e95('0x1')]=0x4;this[_0x1e95('0x2')]=_0x1e95('0x3');this[_0x1e95('0x4')]=_0x139557[_0x1e95('0x4')];this['type']=_0x139557['type'];this['campaigntype']=_0x139557[_0x1e95('0x5')]===_0x1e95('0x6')?_0x1e95('0x7'):_0x139557[_0x1e95('0x5')];this[_0x1e95('0x8')]=_0x139557[_0x1e95('0x8')]||![];this[_0x1e95('0x9')]=_0x139557['countbusyretry'];this[_0x1e95('0xa')]=_0x139557[_0x1e95('0xa')];this[_0x1e95('0xb')]=_0x139557[_0x1e95('0xb')];this[_0x1e95('0xc')]=_0x139557[_0x1e95('0x9')]+_0x139557['countcongestionretry']+_0x139557[_0x1e95('0xb')]+_0x139557[_0x1e95('0xd')]+_0x139557[_0x1e95('0xe')]+_0x139557['countabandonedretry']+_0x139557[_0x1e95('0xf')]+_0x139557[_0x1e95('0x10')];this[_0x1e95('0xd')]=_0x139557['countnosuchnumberretry'];this['countdropretry']=_0x139557['countdropretry'];this[_0x1e95('0x11')]=_0x139557[_0x1e95('0x11')];this[_0x1e95('0xf')]=_0x139557[_0x1e95('0xf')];this[_0x1e95('0x10')]=_0x139557[_0x1e95('0x10')];this[_0x1e95('0x12')]=_0x59e466['uniqueid'];this[_0x1e95('0x13')]=_0x139557[_0x1e95('0x14')];this[_0x1e95('0x15')]=_0x139557[_0x1e95('0x16')];this[_0x1e95('0x17')]=_0x139557['starttime'];this[_0x1e95('0x18')]=_0x139557[_0x1e95('0x18')];this[_0x1e95('0x19')]=moment()['format'](_0x1e95('0x1a'));this[_0x1e95('0x1b')]=utils[_0x1e95('0x1c')](_0x139557['responsetime'],_0x139557[_0x1e95('0x17')]);this[_0x1e95('0x1d')]=0x0;this[_0x1e95('0x1e')]=utils[_0x1e95('0x1c')](this[_0x1e95('0x19')],_0x139557[_0x1e95('0x18')]);this[_0x1e95('0x7')]=_0x139557[_0x1e95('0x7')];this['membername']=_0x1e95('0x1f');this['reason']=_0x59e466[_0x1e95('0x20')];this[_0x1e95('0x21')]=_0x139557[_0x1e95('0x21')];this[_0x1e95('0x22')]=_0x139557['callbackuniqueid'];this['callbackat']=_0x139557[_0x1e95('0x23')];this['recallme']=_0x139557[_0x1e95('0x24')];this[_0x1e95('0x25')]=_0x139557[_0x1e95('0x25')];this[_0x1e95('0x26')]=_0x139557['ListId'];this[_0x1e95('0x27')]=_0x139557[_0x1e95('0x27')];this['VoiceQueueId']=_0x139557['VoiceQueueId'];this['CampaignId']=_0x139557[_0x1e95('0x28')];}module[_0x1e95('0x29')]=Hangup; \ No newline at end of file +var _0x1943=['queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound'];(function(_0xba6fd3,_0x142360){var _0x231d31=function(_0x4e94ba){while(--_0x4e94ba){_0xba6fd3['push'](_0xba6fd3['shift']());}};_0x231d31(++_0x142360);}(_0x1943,0x117));var _0x3194=function(_0x5c6c07,_0xb6aaf1){_0x5c6c07=_0x5c6c07-0x0;var _0xebb82e=_0x1943[_0x5c6c07];return _0xebb82e;};'use strict';var moment=require(_0x3194('0x0'));var utils=require(_0x3194('0x1'));function Hangup(_0xf539df,_0x50b91c){this[_0x3194('0x2')]=0x4;this[_0x3194('0x3')]='Answer';this[_0x3194('0x4')]=_0xf539df[_0x3194('0x4')];this[_0x3194('0x5')]=_0xf539df[_0x3194('0x5')];this[_0x3194('0x6')]=_0xf539df[_0x3194('0x5')]===_0x3194('0x7')?_0x3194('0x8'):_0xf539df[_0x3194('0x5')];this[_0x3194('0x9')]=_0xf539df[_0x3194('0x9')]||![];this['countbusyretry']=_0xf539df[_0x3194('0xa')];this['countcongestionretry']=_0xf539df[_0x3194('0xb')];this[_0x3194('0xc')]=_0xf539df[_0x3194('0xc')];this[_0x3194('0xd')]=_0xf539df[_0x3194('0xa')]+_0xf539df['countcongestionretry']+_0xf539df[_0x3194('0xc')]+_0xf539df[_0x3194('0xe')]+_0xf539df[_0x3194('0xf')]+_0xf539df[_0x3194('0x10')]+_0xf539df['countmachineretry']+_0xf539df[_0x3194('0x11')];this[_0x3194('0xe')]=_0xf539df[_0x3194('0xe')];this['countdropretry']=_0xf539df[_0x3194('0xf')];this[_0x3194('0x10')]=_0xf539df[_0x3194('0x10')];this[_0x3194('0x12')]=_0xf539df['countmachineretry'];this[_0x3194('0x11')]=_0xf539df['countagentrejectretry'];this['uniqueid']=_0x50b91c[_0x3194('0x13')];this[_0x3194('0x14')]=_0xf539df[_0x3194('0x15')];this['calleridnum']=_0xf539df['number'];this[_0x3194('0x16')]=_0xf539df[_0x3194('0x16')];this[_0x3194('0x17')]=_0xf539df['responsetime'];this[_0x3194('0x18')]=moment()[_0x3194('0x19')](_0x3194('0x1a'));this[_0x3194('0x1b')]=utils[_0x3194('0x1c')](_0xf539df['responsetime'],_0xf539df[_0x3194('0x16')]);this['holdtime']=0x0;this[_0x3194('0x1d')]=utils[_0x3194('0x1c')](this['endtime'],_0xf539df[_0x3194('0x17')]);this[_0x3194('0x8')]=_0xf539df[_0x3194('0x8')];this['membername']=_0x3194('0x1e');this['reason']=_0x50b91c[_0x3194('0x1f')];this[_0x3194('0x20')]=_0xf539df[_0x3194('0x20')];this['callbackuniqueid']=_0xf539df[_0x3194('0x21')];this[_0x3194('0x22')]=_0xf539df['callbackat'];this[_0x3194('0x23')]=_0xf539df[_0x3194('0x23')];this[_0x3194('0x24')]=_0xf539df[_0x3194('0x24')];this[_0x3194('0x25')]=_0xf539df[_0x3194('0x25')];this[_0x3194('0x26')]=_0xf539df['UserId'];this[_0x3194('0x27')]=_0xf539df[_0x3194('0x27')];this[_0x3194('0x28')]=_0xf539df[_0x3194('0x28')];}module['exports']=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 32d30a7..88f65e5 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 _0xfae2=['originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','starttime','responsetime','endtime','getSeconds','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x5a38eb,_0x2206d9){var _0x20be81=function(_0x2b8647){while(--_0x2b8647){_0x5a38eb['push'](_0x5a38eb['shift']());}};_0x20be81(++_0x2206d9);}(_0xfae2,0x1e0));var _0x2fae=function(_0x561975,_0x1d64fc){_0x561975=_0x561975-0x0;var _0x15b7f5=_0xfae2[_0x561975];return _0x15b7f5;};'use strict';var utils=require(_0x2fae('0x0'));function History(_0x18f423){this[_0x2fae('0x1')]=_0x18f423[_0x2fae('0x1')];this[_0x2fae('0x2')]=_0x18f423[_0x2fae('0x2')]||undefined;this[_0x2fae('0x3')]=_0x18f423[_0x2fae('0x3')];this[_0x2fae('0x4')]=_0x18f423['type']==='outbound'?_0x2fae('0x5'):_0x18f423[_0x2fae('0x3')];this[_0x2fae('0x6')]=_0x18f423[_0x2fae('0x6')];this[_0x2fae('0x7')]=_0x18f423[_0x2fae('0x7')];this[_0x2fae('0x8')]=_0x18f423['countnoanswerretry'];this[_0x2fae('0x9')]=_0x18f423['countbusyretry']+_0x18f423['countcongestionretry']+_0x18f423['countnoanswerretry']+_0x18f423[_0x2fae('0xa')]+_0x18f423[_0x2fae('0xb')]+_0x18f423[_0x2fae('0xc')]+_0x18f423[_0x2fae('0xd')]+_0x18f423[_0x2fae('0xe')];this[_0x2fae('0xa')]=_0x18f423[_0x2fae('0xa')];this['countdropretry']=_0x18f423['countdropretry'];this['countabandonedretry']=_0x18f423[_0x2fae('0xc')];this[_0x2fae('0xd')]=_0x18f423[_0x2fae('0xd')];this[_0x2fae('0xe')]=_0x18f423[_0x2fae('0xe')];this[_0x2fae('0x5')]=_0x18f423[_0x2fae('0x5')];this['calleridname']=_0x18f423[_0x2fae('0xf')];this[_0x2fae('0x10')]=_0x18f423['number'];this[_0x2fae('0x11')]=_0x18f423[_0x2fae('0x11')];this[_0x2fae('0x12')]=_0x18f423[_0x2fae('0x12')];this[_0x2fae('0x13')]=_0x18f423[_0x2fae('0x12')];this['ringtime']=utils[_0x2fae('0x14')](_0x18f423['responsetime'],_0x18f423[_0x2fae('0x11')]);this['holdtime']=0x0;this[_0x2fae('0x15')]=0x0;this[_0x2fae('0x16')]=_0x18f423[_0x2fae('0x16')];this['callbackuniqueid']=_0x18f423['callbackuniqueid'];this[_0x2fae('0x17')]=_0x18f423[_0x2fae('0x17')];this[_0x2fae('0x18')]=_0x18f423[_0x2fae('0x18')];this[_0x2fae('0x19')]=_0x18f423[_0x2fae('0x19')];this['ListId']=_0x18f423[_0x2fae('0x1a')];this['UserId']=_0x18f423[_0x2fae('0x1b')];this[_0x2fae('0x1c')]=_0x18f423[_0x2fae('0x1c')];this[_0x2fae('0x1d')]=_0x18f423[_0x2fae('0x1d')];this['originatecalleridnum']=_0x18f423[_0x2fae('0x1e')]||'';this[_0x2fae('0x1f')]=_0x18f423[_0x2fae('0x1f')]||'';this['state']=_0x18f423[_0x2fae('0x20')];this[_0x2fae('0x21')]=_0x18f423[_0x2fae('0x21')];}module['exports']=History; \ No newline at end of file +var _0xbe1c=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe1c,0x1de));var _0xcbe1=function(_0x3f8d23,_0x16f5ee){_0x3f8d23=_0x3f8d23-0x0;var _0x1ffe51=_0xbe1c[_0x3f8d23];return _0x1ffe51;};'use strict';var utils=require('../utils');function History(_0x234c41){this[_0xcbe1('0x0')]=_0x234c41[_0xcbe1('0x0')];this[_0xcbe1('0x1')]=_0x234c41[_0xcbe1('0x1')]||undefined;this[_0xcbe1('0x2')]=_0x234c41[_0xcbe1('0x2')];this['campaigntype']=_0x234c41[_0xcbe1('0x2')]===_0xcbe1('0x3')?_0xcbe1('0x4'):_0x234c41['type'];this[_0xcbe1('0x5')]=_0x234c41[_0xcbe1('0x5')];this[_0xcbe1('0x6')]=_0x234c41[_0xcbe1('0x6')];this[_0xcbe1('0x7')]=_0x234c41[_0xcbe1('0x7')];this[_0xcbe1('0x8')]=_0x234c41['countbusyretry']+_0x234c41[_0xcbe1('0x6')]+_0x234c41[_0xcbe1('0x7')]+_0x234c41[_0xcbe1('0x9')]+_0x234c41[_0xcbe1('0xa')]+_0x234c41[_0xcbe1('0xb')]+_0x234c41[_0xcbe1('0xc')]+_0x234c41['countagentrejectretry'];this[_0xcbe1('0x9')]=_0x234c41[_0xcbe1('0x9')];this['countdropretry']=_0x234c41[_0xcbe1('0xa')];this['countabandonedretry']=_0x234c41[_0xcbe1('0xb')];this['countmachineretry']=_0x234c41[_0xcbe1('0xc')];this[_0xcbe1('0xd')]=_0x234c41[_0xcbe1('0xd')];this[_0xcbe1('0x4')]=_0x234c41[_0xcbe1('0x4')];this[_0xcbe1('0xe')]=_0x234c41[_0xcbe1('0xf')];this[_0xcbe1('0x10')]=_0x234c41[_0xcbe1('0x11')];this[_0xcbe1('0x12')]=_0x234c41[_0xcbe1('0x12')];this['responsetime']=_0x234c41['responsetime'];this[_0xcbe1('0x13')]=_0x234c41[_0xcbe1('0x14')];this[_0xcbe1('0x15')]=utils['getSeconds'](_0x234c41[_0xcbe1('0x14')],_0x234c41[_0xcbe1('0x12')]);this[_0xcbe1('0x16')]=0x0;this[_0xcbe1('0x17')]=0x0;this['callback']=_0x234c41[_0xcbe1('0x18')];this[_0xcbe1('0x19')]=_0x234c41[_0xcbe1('0x19')];this[_0xcbe1('0x1a')]=_0x234c41[_0xcbe1('0x1a')];this[_0xcbe1('0x1b')]=_0x234c41[_0xcbe1('0x1b')];this[_0xcbe1('0x1c')]=_0x234c41[_0xcbe1('0x1c')];this[_0xcbe1('0x1d')]=_0x234c41[_0xcbe1('0x1d')];this[_0xcbe1('0x1e')]=_0x234c41['UserId'];this['VoiceQueueId']=_0x234c41[_0xcbe1('0x1f')];this['CampaignId']=_0x234c41['CampaignId'];this[_0xcbe1('0x20')]=_0x234c41['originatecalleridnum']||'';this[_0xcbe1('0x21')]=_0x234c41[_0xcbe1('0x21')]||'';this[_0xcbe1('0x22')]=_0x234c41['state'];this[_0xcbe1('0x23')]=_0x234c41['statedesc'];}module['exports']=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 b81172c..f2f9ad4 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 _0xa1f7=['countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','../utils','scheduledat','campaigntype','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x3b9623,_0x5589a5){var _0x17d360=function(_0xe9006a){while(--_0xe9006a){_0x3b9623['push'](_0x3b9623['shift']());}};_0x17d360(++_0x5589a5);}(_0xa1f7,0x167));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x7a1f('0x0'));function QueueCallerAbandon(_0xd892c3,_0x5d1325){this['scheduledat']=_0xd892c3[_0x7a1f('0x1')];this['type']=_0xd892c3['type'];this[_0x7a1f('0x2')]=_0xd892c3[_0x7a1f('0x3')]===_0x7a1f('0x4')?'queue':_0xd892c3[_0x7a1f('0x3')];this[_0x7a1f('0x5')]=_0xd892c3[_0x7a1f('0x5')];this[_0x7a1f('0x6')]=_0xd892c3[_0x7a1f('0x6')];this[_0x7a1f('0x7')]=_0xd892c3[_0x7a1f('0x7')];this[_0x7a1f('0x8')]=_0xd892c3[_0x7a1f('0x5')]+_0xd892c3[_0x7a1f('0x6')]+_0xd892c3[_0x7a1f('0x7')]+_0xd892c3['countnosuchnumberretry']+_0xd892c3[_0x7a1f('0x9')]+_0xd892c3['countabandonedretry']+_0xd892c3[_0x7a1f('0xa')]+_0xd892c3[_0x7a1f('0xb')];this[_0x7a1f('0xc')]=_0xd892c3['countnosuchnumberretry'];this[_0x7a1f('0x9')]=_0xd892c3[_0x7a1f('0x9')];this['countabandonedretry']=_0xd892c3['countabandonedretry'];this[_0x7a1f('0xa')]=_0xd892c3['countmachineretry'];this[_0x7a1f('0xb')]=_0xd892c3[_0x7a1f('0xb')];this[_0x7a1f('0xd')]=_0x5d1325[_0x7a1f('0xd')];this[_0x7a1f('0xe')]=_0xd892c3[_0x7a1f('0xf')];this[_0x7a1f('0x10')]=_0xd892c3[_0x7a1f('0x11')];this[_0x7a1f('0x12')]=_0xd892c3[_0x7a1f('0x12')];this[_0x7a1f('0x13')]=_0xd892c3['responsetime'];this['droptime']=_0xd892c3[_0x7a1f('0x14')];this[_0x7a1f('0x15')]=_0xd892c3[_0x7a1f('0x15')];this[_0x7a1f('0x16')]=this[_0x7a1f('0x14')];this['ringtime']=utils[_0x7a1f('0x17')](_0xd892c3['responsetime'],_0xd892c3[_0x7a1f('0x12')]);this[_0x7a1f('0x18')]=utils[_0x7a1f('0x17')](this[_0x7a1f('0x14')],_0xd892c3['responsetime']);this[_0x7a1f('0x19')]=0x0;this[_0x7a1f('0x1a')]=_0x5d1325['queue'];this['membername']=_0x5d1325[_0x7a1f('0x1b')];this['reason']=_0x5d1325[_0x7a1f('0x1c')];this[_0x7a1f('0x1d')]=_0xd892c3['callback'];this[_0x7a1f('0x1e')]=_0xd892c3[_0x7a1f('0x1e')];this['callbackat']=_0xd892c3['callbackat'];this[_0x7a1f('0x1f')]=_0xd892c3[_0x7a1f('0x1f')];this['ContactId']=_0xd892c3[_0x7a1f('0x20')];this[_0x7a1f('0x21')]=_0xd892c3[_0x7a1f('0x21')];this[_0x7a1f('0x22')]=_0xd892c3[_0x7a1f('0x22')];this[_0x7a1f('0x23')]=_0xd892c3[_0x7a1f('0x23')];this[_0x7a1f('0x24')]=_0xd892c3[_0x7a1f('0x24')];this[_0x7a1f('0x25')]=_0xd892c3['originatecalleridnum']||'';this[_0x7a1f('0x26')]=_0xd892c3[_0x7a1f('0x26')]||'';this['agiafterat']=_0xd892c3['agiafterat'];this['state']=_0xd892c3['state'];this['statedesc']=_0xd892c3[_0x7a1f('0x27')];}module[_0x7a1f('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x94db=['ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','dropreason','endtime'];(function(_0x21c0de,_0x4a9720){var _0x32229e=function(_0x275c29){while(--_0x275c29){_0x21c0de['push'](_0x21c0de['shift']());}};_0x32229e(++_0x4a9720);}(_0x94db,0x1b8));var _0xb94d=function(_0x130720,_0x48ba32){_0x130720=_0x130720-0x0;var _0x18755c=_0x94db[_0x130720];return _0x18755c;};'use strict';var utils=require(_0xb94d('0x0'));function QueueCallerAbandon(_0x259efa,_0x267641){this[_0xb94d('0x1')]=_0x259efa[_0xb94d('0x1')];this[_0xb94d('0x2')]=_0x259efa[_0xb94d('0x2')];this['campaigntype']=_0x259efa[_0xb94d('0x2')]===_0xb94d('0x3')?_0xb94d('0x4'):_0x259efa[_0xb94d('0x2')];this[_0xb94d('0x5')]=_0x259efa[_0xb94d('0x5')];this['countcongestionretry']=_0x259efa[_0xb94d('0x6')];this[_0xb94d('0x7')]=_0x259efa[_0xb94d('0x7')];this[_0xb94d('0x8')]=_0x259efa[_0xb94d('0x5')]+_0x259efa[_0xb94d('0x6')]+_0x259efa['countnoanswerretry']+_0x259efa[_0xb94d('0x9')]+_0x259efa[_0xb94d('0xa')]+_0x259efa[_0xb94d('0xb')]+_0x259efa[_0xb94d('0xc')]+_0x259efa[_0xb94d('0xd')];this[_0xb94d('0x9')]=_0x259efa[_0xb94d('0x9')];this[_0xb94d('0xa')]=_0x259efa[_0xb94d('0xa')];this['countabandonedretry']=_0x259efa[_0xb94d('0xb')];this[_0xb94d('0xc')]=_0x259efa[_0xb94d('0xc')];this[_0xb94d('0xd')]=_0x259efa[_0xb94d('0xd')];this[_0xb94d('0xe')]=_0x267641[_0xb94d('0xe')];this[_0xb94d('0xf')]=_0x259efa['name'];this[_0xb94d('0x10')]=_0x259efa['number'];this[_0xb94d('0x11')]=_0x259efa['starttime'];this[_0xb94d('0x12')]=_0x259efa['responsetime'];this[_0xb94d('0x13')]=_0x259efa[_0xb94d('0x13')];this['dropreason']=_0x259efa[_0xb94d('0x14')];this[_0xb94d('0x15')]=this['droptime'];this[_0xb94d('0x16')]=utils[_0xb94d('0x17')](_0x259efa[_0xb94d('0x12')],_0x259efa[_0xb94d('0x11')]);this['holdtime']=utils['getSeconds'](this[_0xb94d('0x13')],_0x259efa[_0xb94d('0x12')]);this[_0xb94d('0x18')]=0x0;this[_0xb94d('0x4')]=_0x267641[_0xb94d('0x4')];this[_0xb94d('0x19')]=_0x267641[_0xb94d('0x1a')];this[_0xb94d('0x1b')]=_0x267641[_0xb94d('0x1b')];this[_0xb94d('0x1c')]=_0x259efa[_0xb94d('0x1c')];this['callbackuniqueid']=_0x259efa[_0xb94d('0x1d')];this[_0xb94d('0x1e')]=_0x259efa['callbackat'];this[_0xb94d('0x1f')]=_0x259efa[_0xb94d('0x1f')];this[_0xb94d('0x20')]=_0x259efa[_0xb94d('0x20')];this[_0xb94d('0x21')]=_0x259efa['ListId'];this['UserId']=_0x259efa['UserId'];this[_0xb94d('0x22')]=_0x259efa[_0xb94d('0x22')];this[_0xb94d('0x23')]=_0x259efa[_0xb94d('0x23')];this[_0xb94d('0x24')]=_0x259efa['originatecalleridnum']||'';this[_0xb94d('0x25')]=_0x259efa[_0xb94d('0x25')]||'';this[_0xb94d('0x26')]=_0x259efa['agiafterat'];this[_0xb94d('0x27')]=_0x259efa[_0xb94d('0x27')];this['statedesc']=_0x259efa[_0xb94d('0x28')];}module[_0xb94d('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 517accd..3b51e8d 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x50acc9,_0x5c3b86){var _0x1abb24=function(_0x24c8ca){while(--_0x24c8ca){_0x50acc9['push'](_0x50acc9['shift']());}};_0x1abb24(++_0x5c3b86);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x509887,_0xc7ba5a){var _0xdbc2a9=function(_0x5cf832){while(--_0x5cf832){_0x509887['push'](_0x509887['shift']());}};_0xdbc2a9(++_0xc7ba5a);}(_0xb10b,0x12a));var _0xbb10=function(_0xbfbef0,_0x218b21){_0xbfbef0=_0xbfbef0-0x0;var _0x3fdf6f=_0xb10b[_0xbfbef0];return _0x3fdf6f;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 76db3c6..fa71ab4 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 _0x672d=['diff','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','error','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','timezones','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds'];(function(_0x4be610,_0x131b7a){var _0x3c80af=function(_0x35386a){while(--_0x35386a){_0x4be610['push'](_0x4be610['shift']());}};_0x3c80af(++_0x131b7a);}(_0x672d,0x1c8));var _0xd672=function(_0x4ee336,_0x4583f7){_0x4ee336=_0x4ee336-0x0;var _0x54c0f9=_0x672d[_0x4ee336];return _0x54c0f9;};'use strict';var _=require(_0xd672('0x0'));var moment=require(_0xd672('0x1'));var util=require(_0xd672('0x2'));var logger=require(_0xd672('0x3'))(_0xd672('0x4'));var timezones=require('../../../../config/environment/shared')[_0xd672('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xd672('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xd672('0x7'),'DISACTIVED':_0xd672('0x8'),'EMPTY_INTERVAL':_0xd672('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xd672('0xa'),'NO_AVAILABLE_CONTACTS':_0xd672('0xb'),'NULL_INTERVAL':_0xd672('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xd672('0xd'),'RECALL_TIMEOUT':_0xd672('0xe'),'RUNNING':_0xd672('0xf'),'UNKNOWN_TIMEZONE':_0xd672('0x10'),'UNREACHABLE_TRUNK':_0xd672('0x11')};exports[_0xd672('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x36afa2){return _0x36afa2[_0xd672('0x13')]===_0xd672('0x14');}exports[_0xd672('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x48054d){return _0x48054d[_0xd672('0x16')]===_0xd672('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x35f3dd){return _0x35f3dd[_0xd672('0x16')]===_0xd672('0x18');}exports[_0xd672('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0xe0aa6){return _0xe0aa6[_0xd672('0x1a')];}exports[_0xd672('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3ce562){return _0x3ce562['active'];}exports[_0xd672('0x1c')]=isIVRCampaignActive;function getSeconds(_0x497abc,_0xebe25b){var _0x552f94=moment(_0x497abc)[_0xd672('0x1d')](0x0);var _0x3c6b1b=moment(_0xebe25b)['milliseconds'](0x0);return _0x552f94[_0xd672('0x1e')](_0x3c6b1b,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0xea2ec0,_0x55ae9d){var _0x16af22=![];var _0x36bd67=_0xea2ec0[_0xd672('0x13')]!==_0x55ae9d[_0xd672('0x13')]||_0xea2ec0['dialActive']!==_0x55ae9d['dialActive']||_0xea2ec0[_0xd672('0x1f')]!==_0x55ae9d[_0xd672('0x1f')];var _0x513f93=_0xea2ec0[_0xd672('0x20')]!==_0x55ae9d[_0xd672('0x20')]||_0xea2ec0[_0xd672('0x21')]!==_0x55ae9d['loggedIn']||_0xea2ec0[_0xd672('0x22')]!==_0x55ae9d['loggedInDb']||_0xea2ec0['paused']!==_0x55ae9d[_0xd672('0x23')]||_0xea2ec0['talking']!==_0x55ae9d['talking']||_0xea2ec0['pTalking']!==_0x55ae9d[_0xd672('0x24')]||_0xea2ec0[_0xd672('0x25')]!==_0x55ae9d[_0xd672('0x25')]||_0xea2ec0[_0xd672('0x26')]!==_0x55ae9d[_0xd672('0x26')]||_0xea2ec0[_0xd672('0x27')]!==_0x55ae9d[_0xd672('0x27')];if(_0xea2ec0[_0xd672('0x28')]&&_0x55ae9d['Trunk']){_0x16af22=_0xea2ec0[_0xd672('0x28')][_0xd672('0x29')]!==_0x55ae9d[_0xd672('0x28')][_0xd672('0x29')]||_0xea2ec0[_0xd672('0x28')][_0xd672('0x2a')]!==_0x55ae9d[_0xd672('0x28')]['active'];}return _0x36bd67||_0x513f93||_0x16af22;}exports[_0xd672('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1132a2){var _0x300f72=null;var _0x128607=_0x1132a2[_0xd672('0x2c')];if(_[_0xd672('0x2d')](_0x1132a2[_0xd672('0x2e')])||_[_0xd672('0x2d')](_0x1132a2[_0xd672('0x2f')])||_[_0xd672('0x2d')](_0x1132a2[_0xd672('0x2f')][_0xd672('0x30')])){_0x300f72=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xd672('0x31')](_0x1132a2[_0xd672('0x2e')])||_[_0xd672('0x31')](_0x1132a2['Interval'][_0xd672('0x30')])){_0x300f72=CAMPAIGN_STATUS[_0xd672('0x32')];}else if(_0x128607&&!timezones[_0x128607]){_0x300f72=CAMPAIGN_STATUS[_0xd672('0x33')];}return _0x300f72;}function checkAnyValidTrunk(_0x442b87,_0x202596){var _0x1fe822=null;var _0x4d9dbf=_0xd672('0x34');var _0x3bc0cf=[_0xd672('0x35'),'unmonitored'];var _0x2bd1a7=!![];if(_0x442b87[_0xd672('0x28')]&&_0x442b87[_0xd672('0x28')][_0xd672('0x2a')]){_0x4d9dbf+=_0x442b87[_0xd672('0x28')]['name'];_0x1fe822=_0x202596[_0x4d9dbf];_0x2bd1a7=_0x3bc0cf[_0xd672('0x36')](_0x1fe822[_0xd672('0x37')]);}else if(_0x442b87[_0xd672('0x38')]&&_0x442b87[_0xd672('0x38')][_0xd672('0x2a')]){_0x4d9dbf+=_0x442b87[_0xd672('0x38')][_0xd672('0x29')];_0x1fe822=_0x202596[_0x4d9dbf];_0x2bd1a7=_0x3bc0cf[_0xd672('0x36')](_0x1fe822[_0xd672('0x37')]);}return _0x2bd1a7;}function getQueueCampaignStatusMessage(_0x3bb7e1,_0x5ca169){var _0x38242b=CAMPAIGN_STATUS[_0xd672('0x39')];var _0x3f498d=isPreviewCampaign(_0x3bb7e1);if(!isQueueCampaignActive(_0x3bb7e1)){if(_0x3f498d){_0x38242b=CAMPAIGN_STATUS[_0xd672('0x3a')];}else{if(_0x3bb7e1['originated']===0x0&&_0x3bb7e1['talking']===0x0&&_0x3bb7e1[_0xd672('0x25')]===0x0&&(_0x3bb7e1[_0xd672('0x24')]||0x0)===0x0){_0x38242b=CAMPAIGN_STATUS[_0xd672('0x3a')];}else{_0x38242b=CAMPAIGN_STATUS[_0xd672('0x3b')];}}}else if(_0x3bb7e1[_0xd672('0x21')]===0x0){_0x38242b=CAMPAIGN_STATUS[_0xd672('0x3c')];}else if(!checkAnyValidTrunk(_0x3bb7e1,_0x5ca169)){_0x38242b=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x3bb7e1)){var _0x553c8a=checkAnyValidQueueCampaignInterval(_0x3bb7e1);if(_0x553c8a){_0x38242b=_0x553c8a;}}return _0x38242b;}exports[_0xd672('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x12794c){var _0x395427=CAMPAIGN_STATUS[_0xd672('0x3b')];if(_0x12794c[_0xd672('0x27')]===0x0&&_0x12794c['talking']===0x0&&_0x12794c[_0xd672('0x25')]===0x0&&(_0x12794c[_0xd672('0x24')]||0x0)===0x0){_0x395427=CAMPAIGN_STATUS[_0xd672('0x3a')];}return _0x395427;}exports[_0xd672('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4dbdea){var _0x37f612=_0x4dbdea[_0xd672('0x3f')](/"(.*?)"/);return _0x37f612?_0x37f612[0x1]:_0x4dbdea;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x2764ef,_0x19a27e,_0x535e9b){if(!_[_0xd672('0x40')](_0x535e9b)&&typeof _0x535e9b==='string'&&!_['isEmpty'](_0x535e9b)){if(!_[_0xd672('0x40')](_0x19a27e)&&typeof _0x19a27e===_0xd672('0x41')&&!_[_0xd672('0x31')](_0x19a27e)){return util[_0xd672('0x42')](_0xd672('0x43'),_0x19a27e,_0x535e9b);}return util[_0xd672('0x42')](_0xd672('0x43'),_0x535e9b,_0x535e9b);}if(!_['isUndefined'](_0x2764ef)&&typeof _0x2764ef===_0xd672('0x41')&&!_['isEmpty'](_0x2764ef)){return _0x2764ef;}return _0xd672('0x44');}exports[_0xd672('0x45')]=getCallerId;function getCallerIdRandom(_0x39f970,_0x251c37){var _0x389106;var _0x5e0c99;var _0x527a0a;if(_0x251c37<=0x0){_0x251c37=0x1;}_0x389106=new RegExp(_0xd672('0x46')+_0x251c37+'}$');_0x5e0c99=Math['pow'](0xa,_0x251c37-0x1);_0x527a0a=Math[_0xd672('0x47')](0xa,_0x251c37)-0x1;return util['format']('%s',_[_0xd672('0x48')](_0x39f970,_0x389106,_[_0xd672('0x49')](_0x5e0c99,_0x527a0a)[_0xd672('0x4a')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x213303){if(_0x213303['originated']&&_0x213303[_0xd672('0x27')]>0x0){_0x213303[_0xd672('0x27')]-=0x1;}else{logger[_0xd672('0x4b')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xd672('0x4c')]=decrementOriginate;function checkContactEmpty(_0x31ac81){return _0x31ac81&&_0x31ac81[_0xd672('0x4d')]>0x0;}exports[_0xd672('0x4e')]=checkContactEmpty;function erlangb(_0x1ef443,_0xbfcf2f){if(_0xbfcf2f===0x0){return 0x0;}var _0xf13109=0x1;for(var _0x33193a=0x1;_0x33193a<=_0xbfcf2f;_0x33193a+=0x1){_0xf13109=0x1+_0xf13109*_0x33193a/_0x1ef443;}return 0x1/_0xf13109;}exports[_0xd672('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x251ad9,_0x59df37,_0x596023){if(_0x59df37>_0x596023){for(var _0x330ee0=0x0;_0x330ee0<_0x59df37-_0x596023;_0x330ee0+=0x1){decrementOriginate(_0x251ad9);}}}exports[_0xd672('0x50')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0xf242=['INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','isIVRCampaign','type','outbound','isOutboundQueue','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED'];(function(_0x2cc7b3,_0x33060e){var _0x4e8cb9=function(_0x497b49){while(--_0x497b49){_0x2cc7b3['push'](_0x2cc7b3['shift']());}};_0x4e8cb9(++_0x33060e);}(_0xf242,0x9f));var _0x2f24=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xf242[_0x3b19ea];return _0x40ece9;};'use strict';var _=require(_0x2f24('0x0'));var moment=require(_0x2f24('0x1'));var util=require(_0x2f24('0x2'));var logger=require(_0x2f24('0x3'))(_0x2f24('0x4'));var timezones=require(_0x2f24('0x5'))[_0x2f24('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x2f24('0x7'),'BLACKLIST':_0x2f24('0x8'),'CONTACTS_RESCHEDULED':_0x2f24('0x9'),'DEACTIVATED':_0x2f24('0xa'),'DISACTIVED':_0x2f24('0xb'),'EMPTY_INTERVAL':_0x2f24('0xc'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x2f24('0xd'),'NO_AVAILABLE_CONTACTS':_0x2f24('0xe'),'NULL_INTERVAL':_0x2f24('0xf'),'OVERTIME_INTERVAL':_0x2f24('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0x2f24('0x11'),'QUEUE_RECALL':_0x2f24('0x12'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x2f24('0x13'),'UNREACHABLE_TRUNK':_0x2f24('0x14')};exports[_0x2f24('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x48d4d6){return _0x48d4d6[_0x2f24('0x16')]===_0x2f24('0x17');}exports[_0x2f24('0x18')]=isPreviewCampaign;function isIVRCampaign(_0x43d560){return _0x43d560['type']==='ivr';}exports[_0x2f24('0x19')]=isIVRCampaign;function isOutboundQueue(_0xb4fdac){return _0xb4fdac[_0x2f24('0x1a')]===_0x2f24('0x1b');}exports[_0x2f24('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x2276a0){return _0x2276a0['dialActive'];}exports[_0x2f24('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x252b19){return _0x252b19[_0x2f24('0x1e')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x3ddf74,_0x1af8e5){var _0x78bd84=moment(_0x3ddf74)[_0x2f24('0x1f')](0x0);var _0x227a9f=moment(_0x1af8e5)['milliseconds'](0x0);return _0x78bd84[_0x2f24('0x20')](_0x227a9f,_0x2f24('0x21'));}exports[_0x2f24('0x22')]=getSeconds;function hasQueueCampaignDataChanged(_0x24464d,_0x568bab){var _0x12f17f=![];var _0x180369=_0x24464d[_0x2f24('0x16')]!==_0x568bab['dialMethod']||_0x24464d[_0x2f24('0x23')]!==_0x568bab[_0x2f24('0x23')]||_0x24464d['message']!==_0x568bab[_0x2f24('0x24')];var _0x42d70e=_0x24464d[_0x2f24('0x25')]!==_0x568bab[_0x2f24('0x25')]||_0x24464d[_0x2f24('0x26')]!==_0x568bab['loggedIn']||_0x24464d[_0x2f24('0x27')]!==_0x568bab[_0x2f24('0x27')]||_0x24464d[_0x2f24('0x28')]!==_0x568bab[_0x2f24('0x28')]||_0x24464d['talking']!==_0x568bab[_0x2f24('0x29')]||_0x24464d[_0x2f24('0x2a')]!==_0x568bab[_0x2f24('0x2a')]||_0x24464d['waiting']!==_0x568bab[_0x2f24('0x2b')]||_0x24464d[_0x2f24('0x2c')]!==_0x568bab[_0x2f24('0x2c')]||_0x24464d[_0x2f24('0x2d')]!==_0x568bab[_0x2f24('0x2d')];if(_0x24464d[_0x2f24('0x2e')]&&_0x568bab['Trunk']){_0x12f17f=_0x24464d[_0x2f24('0x2e')][_0x2f24('0x2f')]!==_0x568bab[_0x2f24('0x2e')][_0x2f24('0x2f')]||_0x24464d['Trunk'][_0x2f24('0x1e')]!==_0x568bab['Trunk']['active'];}return _0x180369||_0x42d70e||_0x12f17f;}exports[_0x2f24('0x30')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xcea1ac){var _0x5ba142=null;var _0x22b5e9=_0xcea1ac[_0x2f24('0x31')];if(_[_0x2f24('0x32')](_0xcea1ac[_0x2f24('0x33')])||_['isNil'](_0xcea1ac['Interval'])||_[_0x2f24('0x32')](_0xcea1ac[_0x2f24('0x34')][_0x2f24('0x35')])){_0x5ba142=CAMPAIGN_STATUS[_0x2f24('0x36')];}else if(_['isEmpty'](_0xcea1ac[_0x2f24('0x33')])||_[_0x2f24('0x37')](_0xcea1ac['Interval']['Intervals'])){_0x5ba142=CAMPAIGN_STATUS[_0x2f24('0x38')];}else if(_0x22b5e9&&!timezones[_0x22b5e9]){_0x5ba142=CAMPAIGN_STATUS[_0x2f24('0x39')];}return _0x5ba142;}function checkAnyValidTrunk(_0x4ee7e7,_0x521375){var _0x4409e1=null;var _0x573641='SIP/';var _0x3de3c6=[_0x2f24('0x3a'),_0x2f24('0x3b')];var _0xb02e09=!![];if(_0x4ee7e7[_0x2f24('0x2e')]&&_0x4ee7e7[_0x2f24('0x2e')][_0x2f24('0x1e')]){_0x573641+=_0x4ee7e7['Trunk'][_0x2f24('0x2f')];_0x4409e1=_0x521375[_0x573641];_0xb02e09=_0x3de3c6[_0x2f24('0x3c')](_0x4409e1['status']);}else if(_0x4ee7e7[_0x2f24('0x3d')]&&_0x4ee7e7[_0x2f24('0x3d')][_0x2f24('0x1e')]){_0x573641+=_0x4ee7e7['TrunkBackup']['name'];_0x4409e1=_0x521375[_0x573641];_0xb02e09=_0x3de3c6[_0x2f24('0x3c')](_0x4409e1[_0x2f24('0x3e')]);}return _0xb02e09;}function getQueueCampaignStatusMessage(_0x396176,_0x4a9de0){var _0x1fb0db=CAMPAIGN_STATUS[_0x2f24('0x7')];var _0x4f891d=isPreviewCampaign(_0x396176);if(!isQueueCampaignActive(_0x396176)){if(_0x4f891d){_0x1fb0db=CAMPAIGN_STATUS[_0x2f24('0x3f')];}else{if(_0x396176['originated']===0x0&&_0x396176[_0x2f24('0x29')]===0x0&&_0x396176[_0x2f24('0x2b')]===0x0&&(_0x396176[_0x2f24('0x2a')]||0x0)===0x0){_0x1fb0db=CAMPAIGN_STATUS[_0x2f24('0x3f')];}else{_0x1fb0db=CAMPAIGN_STATUS[_0x2f24('0x40')];}}}else if(_0x396176[_0x2f24('0x26')]===0x0){_0x1fb0db=CAMPAIGN_STATUS[_0x2f24('0x41')];}else if(!checkAnyValidTrunk(_0x396176,_0x4a9de0)){_0x1fb0db=CAMPAIGN_STATUS[_0x2f24('0x42')];}else if(!isPreviewCampaign(_0x396176)){var _0x3c1cc2=checkAnyValidQueueCampaignInterval(_0x396176);if(_0x3c1cc2){_0x1fb0db=_0x3c1cc2;}}return _0x1fb0db;}exports[_0x2f24('0x43')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5deef6){var _0x15b183=CAMPAIGN_STATUS[_0x2f24('0x40')];if(_0x5deef6[_0x2f24('0x2d')]===0x0&&_0x5deef6[_0x2f24('0x29')]===0x0&&_0x5deef6[_0x2f24('0x2b')]===0x0&&(_0x5deef6[_0x2f24('0x2a')]||0x0)===0x0){_0x15b183=CAMPAIGN_STATUS[_0x2f24('0x3f')];}return _0x15b183;}exports[_0x2f24('0x44')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x40c713){var _0x46ff0b=_0x40c713[_0x2f24('0x45')](/"(.*?)"/);return _0x46ff0b?_0x46ff0b[0x1]:_0x40c713;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0xe9b4c1,_0xdd4715,_0x3a474b){if(!_[_0x2f24('0x46')](_0x3a474b)&&typeof _0x3a474b===_0x2f24('0x47')&&!_[_0x2f24('0x37')](_0x3a474b)){if(!_[_0x2f24('0x46')](_0xdd4715)&&typeof _0xdd4715===_0x2f24('0x47')&&!_[_0x2f24('0x37')](_0xdd4715)){return util[_0x2f24('0x48')](_0x2f24('0x49'),_0xdd4715,_0x3a474b);}return util[_0x2f24('0x48')](_0x2f24('0x49'),_0x3a474b,_0x3a474b);}if(!_['isUndefined'](_0xe9b4c1)&&typeof _0xe9b4c1===_0x2f24('0x47')&&!_[_0x2f24('0x37')](_0xe9b4c1)){return _0xe9b4c1;}return'\x22\x22\x20<>';}exports[_0x2f24('0x4a')]=getCallerId;function getCallerIdRandom(_0x204cac,_0x549c2c){var _0x5f4769;var _0x843a27;var _0x3d153e;if(_0x549c2c<=0x0){_0x549c2c=0x1;}_0x5f4769=new RegExp('\x5cw{0,'+_0x549c2c+'}$');_0x843a27=Math[_0x2f24('0x4b')](0xa,_0x549c2c-0x1);_0x3d153e=Math[_0x2f24('0x4b')](0xa,_0x549c2c)-0x1;return util[_0x2f24('0x48')]('%s',_[_0x2f24('0x4c')](_0x204cac,_0x5f4769,_[_0x2f24('0x4d')](_0x843a27,_0x3d153e)[_0x2f24('0x4e')]()));}exports[_0x2f24('0x4f')]=getCallerIdRandom;function decrementOriginate(_0x449c53){if(_0x449c53[_0x2f24('0x2d')]&&_0x449c53[_0x2f24('0x2d')]>0x0){_0x449c53[_0x2f24('0x2d')]-=0x1;}else{logger[_0x2f24('0x50')](_0x2f24('0x51'));}}exports[_0x2f24('0x52')]=decrementOriginate;function checkContactEmpty(_0xdd149e){return _0xdd149e&&_0xdd149e[_0x2f24('0x53')]>0x0;}exports[_0x2f24('0x54')]=checkContactEmpty;function erlangb(_0x3ca7c7,_0x5d0af1){if(_0x5d0af1===0x0){return 0x0;}var _0x985f77=0x1;for(var _0x4139f2=0x1;_0x4139f2<=_0x5d0af1;_0x4139f2+=0x1){_0x985f77=0x1+_0x985f77*_0x4139f2/_0x3ca7c7;}return 0x1/_0x985f77;}exports[_0x2f24('0x55')]=erlangb;function checkContactLowerLimitOriginate(_0x1b733e,_0x14f069,_0x4c304f){if(_0x14f069>_0x4c304f){for(var _0xc8f1e6=0x0;_0xc8f1e6<_0x14f069-_0x4c304f;_0xc8f1e6+=0x1){decrementOriginate(_0x1b733e);}}}exports[_0x2f24('0x56')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 753f174..bf1e00e 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(_0x511a35,_0x2f8f83){var _0x19d677=function(_0x1c3784){while(--_0x1c3784){_0x511a35['push'](_0x511a35['shift']());}};_0x19d677(++_0x2f8f83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x9f1fbb,_0x17ce2a){var _0x5cc597=function(_0xebb186){while(--_0xebb186){_0x9f1fbb['push'](_0x9f1fbb['shift']());}};_0x5cc597(++_0x17ce2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 b505450..3228814 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 _0xba44=['SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','Fax\x20received','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','parse','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','moment','path','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','prototype','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','.pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages'];(function(_0x52991d,_0x429d72){var _0x5b9004=function(_0x4bfe0d){while(--_0x4bfe0d){_0x52991d['push'](_0x52991d['shift']());}};_0x5b9004(++_0x429d72);}(_0xba44,0x189));var _0x4ba4=function(_0x205066,_0x7241c9){_0x205066=_0x205066-0x0;var _0x11f663=_0xba44[_0x205066];return _0x11f663;};'use strict';var util=require('util');var _=require(_0x4ba4('0x0'));var BPromise=require(_0x4ba4('0x1'));var uuid=require(_0x4ba4('0x2'));var moment=require(_0x4ba4('0x3'));var path=require(_0x4ba4('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x4ba4('0x5'))(_0x4ba4('0x6'));var ami=require(_0x4ba4('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x4ba4('0x8'));var ut=require(_0x4ba4('0x9'));var Action=require(_0x4ba4('0xa'));var faxAccount=require(_0x4ba4('0xb'));var attachment=require(_0x4ba4('0xc'));var faxMessage=require(_0x4ba4('0xd'));function Fax(_0x2a54b7){this[_0x4ba4('0xe')]={};this[_0x4ba4('0xf')]=_0x2a54b7[_0x4ba4('0xf')];this[_0x4ba4('0x10')]=_0x2a54b7[_0x4ba4('0x10')];this[_0x4ba4('0x11')]={};ami['on'](_0x4ba4('0x12'),this['syncNewchannel'][_0x4ba4('0x13')](this));ami['on'](_0x4ba4('0x14'),this[_0x4ba4('0x15')][_0x4ba4('0x13')](this));ami['on'](_0x4ba4('0x16'),this['syncNewState'][_0x4ba4('0x13')](this));ami['on'](_0x4ba4('0x17'),this['syncNewExten'][_0x4ba4('0x13')](this));ami['on'](_0x4ba4('0x18'),this[_0x4ba4('0x19')][_0x4ba4('0x13')](this));ami['on'](_0x4ba4('0x1a'),this[_0x4ba4('0x1b')]['bind'](this));ami['on']('hangup',this[_0x4ba4('0x1c')]['bind'](this));ami['on']('originateresponse',this[_0x4ba4('0x1d')][_0x4ba4('0x13')](this));}Fax['prototype'][_0x4ba4('0x1e')]=function(_0x264bb5){if(_0x264bb5[_0x4ba4('0x1f')]===_0x4ba4('0x20')){for(var _0x262e1e in this[_0x4ba4('0xf')]){if(this[_0x4ba4('0xf')][_0x4ba4('0x21')](_0x262e1e)){if(_0x264bb5[_0x4ba4('0x22')]===this[_0x4ba4('0xf')][_0x262e1e][_0x4ba4('0x23')]){this[_0x4ba4('0xe')][_0x264bb5[_0x4ba4('0x24')]]={};this['channels'][_0x264bb5[_0x4ba4('0x24')]]['channel']=_0x264bb5[_0x4ba4('0x25')];this[_0x4ba4('0xe')][_0x264bb5[_0x4ba4('0x24')]]['id']=this['faxAccounts'][_0x262e1e]['id'];this[_0x4ba4('0xe')][_0x264bb5['uniqueid']][_0x4ba4('0x26')]=this[_0x4ba4('0xf')][_0x262e1e][_0x4ba4('0x26')];logger[_0x4ba4('0x27')](_0x264bb5[_0x4ba4('0x24')],_0x4ba4('0x28'));}}}}if(this[_0x4ba4('0x11')][_0x264bb5[_0x4ba4('0x24')]]){this[_0x4ba4('0xe')][_0x264bb5[_0x4ba4('0x24')]]={};this['channels'][_0x264bb5['uniqueid']][_0x4ba4('0x25')]=_0x264bb5[_0x4ba4('0x25')];logger['info'](_0x264bb5['uniqueid'],_0x4ba4('0x28'));}};Fax['prototype'][_0x4ba4('0x15')]=function(_0x29c434){if(this[_0x4ba4('0xe')][_0x29c434[_0x4ba4('0x24')]]){for(var _0x327747 in _0x29c434[_0x4ba4('0x29')]){if(_0x29c434['variable'][_0x4ba4('0x21')](_0x327747)){this[_0x4ba4('0xe')][_0x29c434[_0x4ba4('0x24')]][_0x327747]=_0x29c434[_0x4ba4('0x2a')];}}}};Fax[_0x4ba4('0x2b')][_0x4ba4('0x2c')]=function(_0x34856d){if(this[_0x4ba4('0xe')][_0x34856d[_0x4ba4('0x24')]]){this[_0x4ba4('0xe')][_0x34856d[_0x4ba4('0x24')]][_0x4ba4('0x2d')]=_0x34856d[_0x4ba4('0x2d')];this[_0x4ba4('0xe')][_0x34856d[_0x4ba4('0x24')]]['channelstatedesc']=_0x34856d[_0x4ba4('0x2e')];}};Fax[_0x4ba4('0x2b')]['syncNewExten']=function(_0x2a0c53){if(this[_0x4ba4('0xe')][_0x2a0c53[_0x4ba4('0x24')]]){for(var _0x5c36c2 in _0x2a0c53['variable']){if(_0x2a0c53['variable']['hasOwnProperty'](_0x5c36c2)){this['channels'][_0x2a0c53['uniqueid']][_0x5c36c2]=_0x2a0c53[_0x4ba4('0x2a')];}}}};Fax[_0x4ba4('0x2b')][_0x4ba4('0x19')]=function(_0x511dfa){if(this[_0x4ba4('0xe')][_0x511dfa[_0x4ba4('0x24')]]){this[_0x4ba4('0xe')][_0x511dfa[_0x4ba4('0x24')]]['operation']=_0x511dfa[_0x4ba4('0x2f')];this[_0x4ba4('0xe')][_0x511dfa[_0x4ba4('0x24')]][_0x4ba4('0x30')]=_0x511dfa[_0x4ba4('0x30')];this['channels'][_0x511dfa[_0x4ba4('0x24')]][_0x4ba4('0x23')]=_0x511dfa[_0x4ba4('0x23')];this[_0x4ba4('0xe')][_0x511dfa[_0x4ba4('0x24')]]['filename']=_0x511dfa[_0x4ba4('0x31')];logger[_0x4ba4('0x27')](_0x511dfa[_0x4ba4('0x24')],_0x4ba4('0x32'));}};Fax[_0x4ba4('0x2b')][_0x4ba4('0x1b')]=function(_0xd1effd){var _0x166fd8=this;if(this[_0x4ba4('0xe')][_0xd1effd[_0x4ba4('0x24')]]){var _0x120646=this[_0x4ba4('0xe')][_0xd1effd['uniqueid']]['id'];this[_0x4ba4('0xe')][_0xd1effd['uniqueid']][_0x4ba4('0x33')]=_0xd1effd[_0x4ba4('0x33')];this[_0x4ba4('0xe')][_0xd1effd[_0x4ba4('0x24')]]['pagestransferred']=_0xd1effd[_0x4ba4('0x34')];this['channels'][_0xd1effd[_0x4ba4('0x24')]][_0x4ba4('0x23')]=_0xd1effd[_0x4ba4('0x23')];this[_0x4ba4('0xe')][_0xd1effd[_0x4ba4('0x24')]]['resolution']=_0xd1effd['resolution'];this[_0x4ba4('0xe')][_0xd1effd[_0x4ba4('0x24')]]['transferrate']=_0xd1effd[_0x4ba4('0x35')];this[_0x4ba4('0xe')][_0xd1effd[_0x4ba4('0x24')]][_0x4ba4('0x31')]=_0xd1effd[_0x4ba4('0x31')];this[_0x4ba4('0xe')][_0xd1effd[_0x4ba4('0x24')]][_0x4ba4('0x36')]=_0xd1effd[_0x4ba4('0x36')];if(this['channels'][_0xd1effd[_0x4ba4('0x24')]][_0x4ba4('0x34')]>0x0){tiff2pdf(_0xd1effd[_0x4ba4('0x31')],_0x4ba4('0x37'),function(_0x35a72b){logger['info'](_0xd1effd[_0x4ba4('0x24')],_0x4ba4('0x38'),_0x35a72b[_0x4ba4('0x39')]);attachment['create']({'name':path['parse'](_0xd1effd['filename'])[_0x4ba4('0x26')],'basename':path['parse'](_0xd1effd[_0x4ba4('0x31')])['name']+_0x4ba4('0x3a'),'type':'application/pdf'})[_0x4ba4('0x3b')](function(_0xe5444f){faxAccount[_0x4ba4('0x3c')](_0x120646,{'from':_0xd1effd[_0x4ba4('0x36')],'mapKey':'fax','body':path['parse'](_0xd1effd[_0x4ba4('0x31')])[_0x4ba4('0x26')]+_0x4ba4('0x3a'),'AttachmentId':_0xe5444f['id']})[_0x4ba4('0x3d')](function(_0x1002f4){logger['error'](_0xd1effd[_0x4ba4('0x24')],_0x4ba4('0x3e'),JSON['stringify'](_0x1002f4));});})[_0x4ba4('0x3d')](function(_0x58a07a){logger[_0x4ba4('0x3f')](_0xd1effd['uniqueid'],_0x4ba4('0x40'),JSON[_0x4ba4('0x41')](_0x58a07a));});});}logger[_0x4ba4('0x27')](_0xd1effd['uniqueid'],_0x4ba4('0x40'));}};Fax[_0x4ba4('0x2b')][_0x4ba4('0x1d')]=function(_0x4902af){if(this['actions'][_0x4902af[_0x4ba4('0x24')]]){_[_0x4ba4('0x42')](this['channels'][_0x4902af[_0x4ba4('0x24')]],_[_0x4ba4('0x43')](_0x4902af,[_0x4ba4('0x44'),_0x4ba4('0x45')]));}};function updateStatus(_0x19df6b){if(_0x19df6b['AttachmentId']){faxMessage['update'](_0x19df6b[_0x4ba4('0x46')],{'failMessage':_0x4ba4('0x47')})[_0x4ba4('0x3b')](function(_0x4f5e0f){ut[_0x4ba4('0x48')]('[Fax][Message][Error][Updated]',_0x4f5e0f);})['catch'](function(_0x1847cf){ut[_0x4ba4('0x48')](_0x4ba4('0x49'),_0x1847cf);});}else{ut[_0x4ba4('0x48')](_0x4ba4('0x4a'));}}Fax[_0x4ba4('0x2b')][_0x4ba4('0x4b')]=function(_0x17e952,_0x202833,_0x5aefe5){var _0x56dba6=this;var _0x2a4ca7={};if(_0x202833){_0x2a4ca7={'read':_0x202833};}else{_0x2a4ca7={'failMessage':_0x5aefe5};}if(this[_0x4ba4('0x11')][_0x17e952][_0x4ba4('0x46')]){faxMessage[_0x4ba4('0x4c')](this['actions'][_0x17e952][_0x4ba4('0x46')],_0x2a4ca7)['then'](function(_0xd81b7d){ut['logger'](_0x4ba4('0x4d'),_0xd81b7d);})['catch'](function(_0x4c2249){ut[_0x4ba4('0x48')](_0x4ba4('0x4e'),_0x4c2249);})[_0x4ba4('0x4f')](function(){delete _0x56dba6[_0x4ba4('0xe')][_0x17e952];delete _0x56dba6[_0x4ba4('0x11')][_0x17e952];});}else{ut[_0x4ba4('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0x4ba4('0xe')][_0x17e952];delete this[_0x4ba4('0x11')][_0x17e952];}};Fax[_0x4ba4('0x2b')][_0x4ba4('0x1c')]=function(_0x3b33cb){var _0x4da99d=this;if(this[_0x4ba4('0xe')][_0x3b33cb['uniqueid']]){if(this[_0x4ba4('0x11')][_0x3b33cb[_0x4ba4('0x24')]]){this[_0x4ba4('0xe')][_0x3b33cb[_0x4ba4('0x24')]]['id']=this[_0x4ba4('0x11')][_0x3b33cb[_0x4ba4('0x24')]]['id'];this['channels'][_0x3b33cb[_0x4ba4('0x24')]]['name']=this[_0x4ba4('0x11')][_0x3b33cb[_0x4ba4('0x24')]][_0x4ba4('0x26')];}logger[_0x4ba4('0x27')](_0x3b33cb['uniqueid'],this[_0x4ba4('0x11')][_0x3b33cb[_0x4ba4('0x24')]]?_0x4ba4('0x50'):_0x4ba4('0x51'),JSON['stringify'](this[_0x4ba4('0xe')][_0x3b33cb[_0x4ba4('0x24')]]));if(this['actions'][_0x3b33cb[_0x4ba4('0x24')]]){if(this[_0x4ba4('0xe')][_0x3b33cb[_0x4ba4('0x24')]][_0x4ba4('0x52')]>0x0&&this[_0x4ba4('0xe')][_0x3b33cb[_0x4ba4('0x24')]]['faxstatus']===_0x4ba4('0x53')){this[_0x4ba4('0x4b')](_0x3b33cb[_0x4ba4('0x24')],!![]);}else{this[_0x4ba4('0x4b')](_0x3b33cb[_0x4ba4('0x24')],![],this[_0x4ba4('0xe')][_0x3b33cb[_0x4ba4('0x24')]]['faxstatusstring']?_0x4ba4('0x54')+this['channels'][_0x3b33cb['uniqueid']][_0x4ba4('0x55')]:_0x4ba4('0x56'));}}}};Fax[_0x4ba4('0x2b')][_0x4ba4('0x57')]=function(_0x5eb4cf){var _0x43a90d=this;return new BPromise(function(_0x3c9eab,_0x32e40){_0x43a90d[_0x4ba4('0x58')](_0x5eb4cf,_0x43a90d[_0x4ba4('0xf')][_0x5eb4cf['FaxAccountId']])[_0x4ba4('0x3b')](function(_0x375ddf){ut[_0x4ba4('0x48')]('[Fax][execOriginate][success]',_0x375ddf);_0x3c9eab(ut[_0x4ba4('0x39')](_0x4ba4('0x59')));})[_0x4ba4('0x3d')](function(_0x55352d){ut[_0x4ba4('0x48')]('[Fax][execOriginate][failure]',_0x55352d);updateStatus(_0x5eb4cf);_0x32e40(ut[_0x4ba4('0x39')]('Fax\x20failed'));});});};Fax[_0x4ba4('0x2b')]['checkAfterSend']=function(_0xc181cc){var _0x2711aa=this;return new BPromise(function(_0x15f3d6,_0x429cb6){var _0x1b6b28=_0x2711aa[_0x4ba4('0x5a')](_0x2711aa[_0x4ba4('0xf')][_0xc181cc[_0x4ba4('0x5b')]][_0x4ba4('0x5c')],_0xc181cc);if(_0x1b6b28[_0x4ba4('0x5d')]){_0x15f3d6(ut[_0x4ba4('0x39')](_0x4ba4('0x5e')));}else{_0x429cb6(ut[_0x4ba4('0x39')](_0x1b6b28[_0x4ba4('0x39')]));}});};function originate(_0x13dbf5,_0x185881,_0x5eb749){return new BPromise(function(_0x4fc3ab,_0xeb63cf){if(_0x5eb749){var _0x105873=util[_0x4ba4('0x5f')](_0x4ba4('0x60'),path[_0x4ba4('0x61')](_0x13dbf5[_0x4ba4('0x4')])[_0x4ba4('0x26')],_0x13dbf5[_0x4ba4('0x4')]);gs[_0x4ba4('0x62')](_0x105873)[_0x4ba4('0x3b')](function(){_0x13dbf5[_0x4ba4('0x4')]=util['format'](_0x4ba4('0x63'),path[_0x4ba4('0x61')](_0x13dbf5[_0x4ba4('0x4')])[_0x4ba4('0x64')],path['parse'](_0x13dbf5[_0x4ba4('0x4')])[_0x4ba4('0x26')]);_0x185881['XMF-PATH']=_0x13dbf5['path'];ut[_0x4ba4('0x48')](_0x4ba4('0x65'),'');ami[_0x4ba4('0x66')](ut[_0x4ba4('0x67')](_0x13dbf5,_0x185881))[_0x4ba4('0x3b')](function(_0x5450a8){_0x4fc3ab(_0x5450a8);})[_0x4ba4('0x3d')](function(_0x2e3acd){_0xeb63cf(_0x2e3acd);});})[_0x4ba4('0x3d')](function(_0x1eca42){_0xeb63cf(_0x1eca42);});}else{ami[_0x4ba4('0x66')](ut[_0x4ba4('0x67')](_0x13dbf5,_0x185881))['then'](function(_0x1f1da0){_0x4fc3ab(_0x1f1da0);})[_0x4ba4('0x3d')](function(_0x5c1510){_0xeb63cf(_0x5c1510);});}});}Fax['prototype'][_0x4ba4('0x58')]=function(_0x3844c1,_0x52166c){var _0x3a4406=this;return new BPromise(function(_0x162467,_0x777b53){var _0x5a834a=uuid['v4']();var _0x27aae8=ut[_0x4ba4('0x68')](_0x3844c1,_0x52166c);_0x3a4406[_0x4ba4('0x11')][_0x5a834a]=new Action(_0x5a834a,_0x52166c,_0x3844c1);var _0x28f0a9=_0x3a4406[_0x4ba4('0x11')][_0x5a834a];if(path[_0x4ba4('0x61')](_0x3844c1['path'])[_0x4ba4('0x69')]===_0x4ba4('0x3a')){originate(_0x28f0a9,_0x27aae8,!![])['then'](function(_0x21712d){_0x162467(_0x21712d);})[_0x4ba4('0x3d')](function(_0x42de2c){_0x777b53(_0x42de2c);});}else{originate(_0x28f0a9,_0x27aae8,![])[_0x4ba4('0x3b')](function(_0x12b015){_0x162467(_0x12b015);})[_0x4ba4('0x3d')](function(_0x2ad44d){_0x777b53(_0x2ad44d);});}});};Fax[_0x4ba4('0x2b')][_0x4ba4('0x6a')]=function(_0x377fa5){return!_[_0x4ba4('0x6b')](_0x377fa5)&&!_['isNil'](_0x377fa5['name'])&&!_[_0x4ba4('0x6b')](_0x377fa5[_0x4ba4('0x6c')])&&_0x377fa5[_0x4ba4('0x6c')]&&!_[_0x4ba4('0x6b')](this['trunks'][util[_0x4ba4('0x5f')](_0x4ba4('0x6d'),_0x377fa5[_0x4ba4('0x26')])])&&!_[_0x4ba4('0x6b')](this['trunks'][util[_0x4ba4('0x5f')](_0x4ba4('0x6d'),_0x377fa5[_0x4ba4('0x26')])][_0x4ba4('0x30')])&&(this['trunks'][util[_0x4ba4('0x5f')](_0x4ba4('0x6d'),_0x377fa5[_0x4ba4('0x26')])][_0x4ba4('0x30')]===_0x4ba4('0x6e')||this[_0x4ba4('0x10')][util[_0x4ba4('0x5f')](_0x4ba4('0x6d'),_0x377fa5[_0x4ba4('0x26')])][_0x4ba4('0x30')]===_0x4ba4('0x6f'));};Fax[_0x4ba4('0x2b')][_0x4ba4('0x5a')]=function(_0x3a88bb,_0x3252b0){if(!this[_0x4ba4('0x6a')](_0x3a88bb)){ut['logger'](_0x4ba4('0x70'),_[_0x4ba4('0x6b')](_0x3a88bb)?'':_0x3a88bb[_0x4ba4('0x26')]+_0x4ba4('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x4ba4('0x6b')](_0x3252b0[_0x4ba4('0x6')])){ut[_0x4ba4('0x48')](_0x4ba4('0x72'),JSON['stringify'](_0x3252b0));return{'isValid':![],'message':_0x4ba4('0x73')};}if(_['isNil'](_0x3252b0[_0x4ba4('0x4')])){ut['logger'](_0x4ba4('0x74'),JSON[_0x4ba4('0x41')](_0x3252b0));return{'isValid':![],'message':_0x4ba4('0x75')};}return{'isValid':!![],'message':_0x4ba4('0x76')};};module['exports']=Fax; \ No newline at end of file +var _0x361a=['[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x361a,0x102));var _0xa361=function(_0xd3520c,_0x464e7e){_0xd3520c=_0xd3520c-0x0;var _0x57b0dd=_0x361a[_0xd3520c];return _0x57b0dd;};'use strict';var util=require(_0xa361('0x0'));var _=require(_0xa361('0x1'));var BPromise=require(_0xa361('0x2'));var uuid=require(_0xa361('0x3'));var moment=require('moment');var path=require(_0xa361('0x4'));var tiff2pdf=require(_0xa361('0x5'));var gs=require(_0xa361('0x6'));var logger=require(_0xa361('0x7'))(_0xa361('0x8'));var ami=require(_0xa361('0x9'));var rpcDb=require(_0xa361('0xa'));var Channel=require(_0xa361('0xb'));var ut=require(_0xa361('0xc'));var Action=require('./action');var faxAccount=require(_0xa361('0xd'));var attachment=require(_0xa361('0xe'));var faxMessage=require(_0xa361('0xf'));function Fax(_0x48d2a9){this[_0xa361('0x10')]={};this[_0xa361('0x11')]=_0x48d2a9[_0xa361('0x11')];this[_0xa361('0x12')]=_0x48d2a9[_0xa361('0x12')];this[_0xa361('0x13')]={};ami['on'](_0xa361('0x14'),this[_0xa361('0x15')]['bind'](this));ami['on'](_0xa361('0x16'),this[_0xa361('0x17')][_0xa361('0x18')](this));ami['on']('newstate',this[_0xa361('0x19')][_0xa361('0x18')](this));ami['on'](_0xa361('0x1a'),this[_0xa361('0x1b')][_0xa361('0x18')](this));ami['on'](_0xa361('0x1c'),this[_0xa361('0x1d')][_0xa361('0x18')](this));ami['on'](_0xa361('0x1e'),this[_0xa361('0x1f')]['bind'](this));ami['on'](_0xa361('0x20'),this['syncHangup'][_0xa361('0x18')](this));ami['on'](_0xa361('0x21'),this[_0xa361('0x22')][_0xa361('0x18')](this));}Fax['prototype'][_0xa361('0x15')]=function(_0x38211e){if(_0x38211e['context']===_0xa361('0x23')){for(var _0x432faa in this[_0xa361('0x11')]){if(this[_0xa361('0x11')][_0xa361('0x24')](_0x432faa)){if(_0x38211e[_0xa361('0x25')]===this[_0xa361('0x11')][_0x432faa][_0xa361('0x26')]){this[_0xa361('0x10')][_0x38211e[_0xa361('0x27')]]={};this['channels'][_0x38211e['uniqueid']]['channel']=_0x38211e[_0xa361('0x28')];this[_0xa361('0x10')][_0x38211e[_0xa361('0x27')]]['id']=this[_0xa361('0x11')][_0x432faa]['id'];this[_0xa361('0x10')][_0x38211e[_0xa361('0x27')]][_0xa361('0x29')]=this[_0xa361('0x11')][_0x432faa]['name'];logger['info'](_0x38211e[_0xa361('0x27')],_0xa361('0x2a'));}}}}if(this[_0xa361('0x13')][_0x38211e[_0xa361('0x27')]]){this[_0xa361('0x10')][_0x38211e[_0xa361('0x27')]]={};this['channels'][_0x38211e[_0xa361('0x27')]][_0xa361('0x28')]=_0x38211e['channel'];logger[_0xa361('0x2b')](_0x38211e[_0xa361('0x27')],_0xa361('0x2a'));}};Fax[_0xa361('0x2c')][_0xa361('0x17')]=function(_0x84c184){if(this[_0xa361('0x10')][_0x84c184['uniqueid']]){for(var _0x4d8411 in _0x84c184[_0xa361('0x2d')]){if(_0x84c184[_0xa361('0x2d')]['hasOwnProperty'](_0x4d8411)){this[_0xa361('0x10')][_0x84c184[_0xa361('0x27')]][_0x4d8411]=_0x84c184[_0xa361('0x2e')];}}}};Fax[_0xa361('0x2c')][_0xa361('0x19')]=function(_0x47ca65){if(this[_0xa361('0x10')][_0x47ca65[_0xa361('0x27')]]){this['channels'][_0x47ca65[_0xa361('0x27')]][_0xa361('0x2f')]=_0x47ca65[_0xa361('0x2f')];this[_0xa361('0x10')][_0x47ca65[_0xa361('0x27')]][_0xa361('0x30')]=_0x47ca65['channelstatedesc'];}};Fax[_0xa361('0x2c')][_0xa361('0x1b')]=function(_0x576993){if(this[_0xa361('0x10')][_0x576993[_0xa361('0x27')]]){for(var _0x4635cf in _0x576993[_0xa361('0x2d')]){if(_0x576993[_0xa361('0x2d')][_0xa361('0x24')](_0x4635cf)){this['channels'][_0x576993[_0xa361('0x27')]][_0x4635cf]=_0x576993['value'];}}}};Fax[_0xa361('0x2c')][_0xa361('0x1d')]=function(_0x4a564e){if(this[_0xa361('0x10')][_0x4a564e[_0xa361('0x27')]]){this[_0xa361('0x10')][_0x4a564e[_0xa361('0x27')]][_0xa361('0x31')]=_0x4a564e[_0xa361('0x31')];this[_0xa361('0x10')][_0x4a564e[_0xa361('0x27')]][_0xa361('0x32')]=_0x4a564e[_0xa361('0x32')];this[_0xa361('0x10')][_0x4a564e[_0xa361('0x27')]][_0xa361('0x26')]=_0x4a564e[_0xa361('0x26')];this[_0xa361('0x10')][_0x4a564e[_0xa361('0x27')]][_0xa361('0x33')]=_0x4a564e[_0xa361('0x33')];logger[_0xa361('0x2b')](_0x4a564e['uniqueid'],_0xa361('0x34'));}};Fax[_0xa361('0x2c')]['syncReceiveFax']=function(_0x3106a2){var _0x3012c6=this;if(this[_0xa361('0x10')][_0x3106a2[_0xa361('0x27')]]){var _0x583075=this[_0xa361('0x10')][_0x3106a2[_0xa361('0x27')]]['id'];this[_0xa361('0x10')][_0x3106a2[_0xa361('0x27')]][_0xa361('0x35')]=_0x3106a2['remotestationid'];this['channels'][_0x3106a2[_0xa361('0x27')]][_0xa361('0x36')]=_0x3106a2[_0xa361('0x36')];this[_0xa361('0x10')][_0x3106a2[_0xa361('0x27')]][_0xa361('0x26')]=_0x3106a2[_0xa361('0x26')];this[_0xa361('0x10')][_0x3106a2[_0xa361('0x27')]][_0xa361('0x37')]=_0x3106a2['resolution'];this['channels'][_0x3106a2['uniqueid']][_0xa361('0x38')]=_0x3106a2[_0xa361('0x38')];this['channels'][_0x3106a2[_0xa361('0x27')]]['filename']=_0x3106a2[_0xa361('0x33')];this['channels'][_0x3106a2['uniqueid']][_0xa361('0x39')]=_0x3106a2[_0xa361('0x39')];if(this['channels'][_0x3106a2[_0xa361('0x27')]]['pagestransferred']>0x0){tiff2pdf(_0x3106a2[_0xa361('0x33')],_0xa361('0x3a'),function(_0x53abf6){logger[_0xa361('0x2b')](_0x3106a2[_0xa361('0x27')],_0xa361('0x3b'),_0x53abf6[_0xa361('0x3c')]);attachment[_0xa361('0x3d')]({'name':path[_0xa361('0x3e')](_0x3106a2[_0xa361('0x33')])[_0xa361('0x29')],'basename':path[_0xa361('0x3e')](_0x3106a2[_0xa361('0x33')])[_0xa361('0x29')]+_0xa361('0x3f'),'type':_0xa361('0x40')})['then'](function(_0x6cee7d){faxAccount[_0xa361('0x41')](_0x583075,{'from':_0x3106a2['calleridnum'],'mapKey':_0xa361('0x8'),'body':path[_0xa361('0x3e')](_0x3106a2[_0xa361('0x33')])['name']+'.pdf','AttachmentId':_0x6cee7d['id']})[_0xa361('0x42')](function(_0x3ce27e){logger[_0xa361('0x43')](_0x3106a2[_0xa361('0x27')],_0xa361('0x44'),JSON[_0xa361('0x45')](_0x3ce27e));});})['catch'](function(_0x351384){logger[_0xa361('0x43')](_0x3106a2['uniqueid'],_0xa361('0x46'),JSON[_0xa361('0x45')](_0x351384));});});}logger[_0xa361('0x2b')](_0x3106a2[_0xa361('0x27')],_0xa361('0x46'));}};Fax[_0xa361('0x2c')][_0xa361('0x22')]=function(_0x2ad022){if(this[_0xa361('0x13')][_0x2ad022[_0xa361('0x27')]]){_['merge'](this[_0xa361('0x10')][_0x2ad022[_0xa361('0x27')]],_[_0xa361('0x47')](_0x2ad022,[_0xa361('0x48'),_0xa361('0x49')]));}};function updateStatus(_0x139c1d){if(_0x139c1d[_0xa361('0x4a')]){faxMessage[_0xa361('0x4b')](_0x139c1d[_0xa361('0x4a')],{'failMessage':_0xa361('0x4c')})[_0xa361('0x4d')](function(_0x1e3a31){ut[_0xa361('0x4e')](_0xa361('0x4f'),_0x1e3a31);})[_0xa361('0x42')](function(_0x1ad87e){ut['logger'](_0xa361('0x50'),_0x1ad87e);});}else{ut[_0xa361('0x4e')](_0xa361('0x51'));}}Fax[_0xa361('0x2c')][_0xa361('0x52')]=function(_0xa86724,_0x220bde,_0x1a7922){var _0x12ed35=this;var _0x46e2bc={};if(_0x220bde){_0x46e2bc={'read':_0x220bde};}else{_0x46e2bc={'failMessage':_0x1a7922};}if(this['actions'][_0xa86724]['AttachmentId']){faxMessage[_0xa361('0x4b')](this[_0xa361('0x13')][_0xa86724][_0xa361('0x4a')],_0x46e2bc)[_0xa361('0x4d')](function(_0x1279f4){ut[_0xa361('0x4e')](_0xa361('0x53'),_0x1279f4);})['catch'](function(_0x590f2c){ut[_0xa361('0x4e')](_0xa361('0x54'),_0x590f2c);})[_0xa361('0x55')](function(){delete _0x12ed35[_0xa361('0x10')][_0xa86724];delete _0x12ed35[_0xa361('0x13')][_0xa86724];});}else{ut[_0xa361('0x4e')]('[Fax][Message][NoUpdate2]');delete this[_0xa361('0x10')][_0xa86724];delete this[_0xa361('0x13')][_0xa86724];}};Fax['prototype'][_0xa361('0x56')]=function(_0x4a76ab){var _0xf37e3b=this;if(this[_0xa361('0x10')][_0x4a76ab[_0xa361('0x27')]]){if(this[_0xa361('0x13')][_0x4a76ab[_0xa361('0x27')]]){this['channels'][_0x4a76ab[_0xa361('0x27')]]['id']=this[_0xa361('0x13')][_0x4a76ab[_0xa361('0x27')]]['id'];this[_0xa361('0x10')][_0x4a76ab[_0xa361('0x27')]][_0xa361('0x29')]=this[_0xa361('0x13')][_0x4a76ab[_0xa361('0x27')]][_0xa361('0x29')];}logger[_0xa361('0x2b')](_0x4a76ab[_0xa361('0x27')],this[_0xa361('0x13')][_0x4a76ab[_0xa361('0x27')]]?_0xa361('0x57'):_0xa361('0x58'),JSON['stringify'](this[_0xa361('0x10')][_0x4a76ab[_0xa361('0x27')]]));if(this[_0xa361('0x13')][_0x4a76ab['uniqueid']]){if(this['channels'][_0x4a76ab[_0xa361('0x27')]][_0xa361('0x59')]>0x0&&this[_0xa361('0x10')][_0x4a76ab['uniqueid']][_0xa361('0x1c')]===_0xa361('0x5a')){this[_0xa361('0x52')](_0x4a76ab[_0xa361('0x27')],!![]);}else{this[_0xa361('0x52')](_0x4a76ab[_0xa361('0x27')],![],this[_0xa361('0x10')][_0x4a76ab[_0xa361('0x27')]][_0xa361('0x5b')]?_0xa361('0x5c')+this['channels'][_0x4a76ab['uniqueid']]['faxstatusstring']:_0xa361('0x5d'));}}}};Fax[_0xa361('0x2c')][_0xa361('0x5e')]=function(_0x2a6b6a){var _0x363633=this;return new BPromise(function(_0x121058,_0x2bd2b4){_0x363633[_0xa361('0x5f')](_0x2a6b6a,_0x363633[_0xa361('0x11')][_0x2a6b6a['FaxAccountId']])[_0xa361('0x4d')](function(_0xa2dd98){ut[_0xa361('0x4e')](_0xa361('0x60'),_0xa2dd98);_0x121058(ut[_0xa361('0x3c')]('Fax\x20received'));})[_0xa361('0x42')](function(_0x1885de){ut['logger'](_0xa361('0x61'),_0x1885de);updateStatus(_0x2a6b6a);_0x2bd2b4(ut['message'](_0xa361('0x62')));});});};Fax[_0xa361('0x2c')][_0xa361('0x63')]=function(_0x207e7f){var _0x2af1e9=this;return new BPromise(function(_0x1ee002,_0x1509ec){var _0x2c6067=_0x2af1e9[_0xa361('0x64')](_0x2af1e9['faxAccounts'][_0x207e7f['FaxAccountId']][_0xa361('0x65')],_0x207e7f);if(_0x2c6067[_0xa361('0x66')]){_0x1ee002(ut['message'](_0xa361('0x67')));}else{_0x1509ec(ut['message'](_0x2c6067['message']));}});};function originate(_0x5364c7,_0x4d63f1,_0x521d60){return new BPromise(function(_0x2f1fd4,_0x29a6d0){if(_0x521d60){var _0x5438ea=util[_0xa361('0x68')](_0xa361('0x69'),path[_0xa361('0x3e')](_0x5364c7['path'])[_0xa361('0x29')],_0x5364c7['path']);gs[_0xa361('0x6a')](_0x5438ea)[_0xa361('0x4d')](function(){_0x5364c7[_0xa361('0x4')]=util['format'](_0xa361('0x6b'),path['parse'](_0x5364c7[_0xa361('0x4')])[_0xa361('0x6c')],path[_0xa361('0x3e')](_0x5364c7[_0xa361('0x4')])['name']);_0x4d63f1['XMF-PATH']=_0x5364c7['path'];ut[_0xa361('0x4e')](_0xa361('0x6d'),'');ami[_0xa361('0x6e')](ut[_0xa361('0x6f')](_0x5364c7,_0x4d63f1))[_0xa361('0x4d')](function(_0x4a976e){_0x2f1fd4(_0x4a976e);})[_0xa361('0x42')](function(_0x5ced4b){_0x29a6d0(_0x5ced4b);});})[_0xa361('0x42')](function(_0x42d016){_0x29a6d0(_0x42d016);});}else{ami[_0xa361('0x6e')](ut['variablesAction'](_0x5364c7,_0x4d63f1))[_0xa361('0x4d')](function(_0x5aa9ab){_0x2f1fd4(_0x5aa9ab);})[_0xa361('0x42')](function(_0x124e75){_0x29a6d0(_0x124e75);});}});}Fax[_0xa361('0x2c')]['execOriginate']=function(_0x2a43cf,_0xf5f3c8){var _0x403c04=this;return new BPromise(function(_0x182964,_0xa3f5f8){var _0x12acb4=uuid['v4']();var _0x3c5808=ut[_0xa361('0x70')](_0x2a43cf,_0xf5f3c8);_0x403c04['actions'][_0x12acb4]=new Action(_0x12acb4,_0xf5f3c8,_0x2a43cf);var _0x9a62f=_0x403c04[_0xa361('0x13')][_0x12acb4];if(path[_0xa361('0x3e')](_0x2a43cf['path'])[_0xa361('0x71')]===_0xa361('0x3f')){originate(_0x9a62f,_0x3c5808,!![])[_0xa361('0x4d')](function(_0x12dcb1){_0x182964(_0x12dcb1);})[_0xa361('0x42')](function(_0x5d50eb){_0xa3f5f8(_0x5d50eb);});}else{originate(_0x9a62f,_0x3c5808,![])['then'](function(_0x32e3f4){_0x182964(_0x32e3f4);})['catch'](function(_0x531aaa){_0xa3f5f8(_0x531aaa);});}});};Fax[_0xa361('0x2c')][_0xa361('0x72')]=function(_0x24ee0e){return!_[_0xa361('0x73')](_0x24ee0e)&&!_[_0xa361('0x73')](_0x24ee0e[_0xa361('0x29')])&&!_[_0xa361('0x73')](_0x24ee0e['active'])&&_0x24ee0e[_0xa361('0x74')]&&!_[_0xa361('0x73')](this[_0xa361('0x12')][util[_0xa361('0x68')](_0xa361('0x75'),_0x24ee0e[_0xa361('0x29')])])&&!_[_0xa361('0x73')](this[_0xa361('0x12')][util[_0xa361('0x68')](_0xa361('0x75'),_0x24ee0e['name'])]['status'])&&(this[_0xa361('0x12')][util[_0xa361('0x68')](_0xa361('0x75'),_0x24ee0e[_0xa361('0x29')])][_0xa361('0x32')]===_0xa361('0x76')||this[_0xa361('0x12')][util['format'](_0xa361('0x75'),_0x24ee0e[_0xa361('0x29')])]['status']===_0xa361('0x77'));};Fax[_0xa361('0x2c')][_0xa361('0x64')]=function(_0x4b68b7,_0x354e32){if(!this[_0xa361('0x72')](_0x4b68b7)){ut[_0xa361('0x4e')](_0xa361('0x78'),_[_0xa361('0x73')](_0x4b68b7)?'':_0x4b68b7['name']+_0xa361('0x79'));return{'isValid':![],'message':_0xa361('0x7a')};}if(_[_0xa361('0x73')](_0x354e32[_0xa361('0x8')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xa361('0x45')](_0x354e32));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xa361('0x73')](_0x354e32['path'])){ut[_0xa361('0x4e')](_0xa361('0x7b'),JSON[_0xa361('0x45')](_0x354e32));return{'isValid':![],'message':_0xa361('0x7c')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xa361('0x7d')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 7613a6a..3ae9199 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 _0xb4c1=['notify','resolve','then','catch','[Notify]\x20','util','bluebird','preview','error','inspect'];(function(_0x1e397a,_0x345f5b){var _0x2efb4d=function(_0x552c32){while(--_0x552c32){_0x1e397a['push'](_0x1e397a['shift']());}};_0x2efb4d(++_0x345f5b);}(_0xb4c1,0x9b));var _0x1b4c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb4c1[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x1b4c('0x0'));var BPromise=require(_0x1b4c('0x1'));var logger=require('../../../config/logger')(_0x1b4c('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1495f9){return function(_0x388715){logger[_0x1b4c('0x3')](_0x1495f9,util[_0x1b4c('0x4')](_0x388715,{'showHidden':![],'depth':null}));};}exports[_0x1b4c('0x5')]=function(_0x5dcfc7,_0x3066af){return BPromise[_0x1b4c('0x6')]()[_0x1b4c('0x7')](faxAccount[_0x1b4c('0x5')](_0x5dcfc7,_0x3066af))[_0x1b4c('0x8')](loggerCatch(_0x1b4c('0x9')));}; \ No newline at end of file +var _0x4fd0=['[Notify]\x20','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x4fd0,0x65));var _0x04fd=function(_0x52e251,_0x3b6303){_0x52e251=_0x52e251-0x0;var _0x5eee63=_0x4fd0[_0x52e251];return _0x5eee63;};'use strict';var util=require('util');var BPromise=require(_0x04fd('0x0'));var logger=require(_0x04fd('0x1'))('preview');var _=require(_0x04fd('0x2'));var faxAccount=require(_0x04fd('0x3'));function loggerCatch(_0x5988ac){return function(_0x5a5c39){logger[_0x04fd('0x4')](_0x5988ac,util[_0x04fd('0x5')](_0x5a5c39,{'showHidden':![],'depth':null}));};}exports[_0x04fd('0x6')]=function(_0x2e7c1f,_0x53f41f){return BPromise[_0x04fd('0x7')]()['then'](faxAccount[_0x04fd('0x6')](_0x2e7c1f,_0x53f41f))[_0x04fd('0x8')](loggerCatch(_0x04fd('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 8bbcceb..e63d512 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 _0xadc4=['execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process','exec'];(function(_0x1c2607,_0xb7333b){var _0xc38a62=function(_0x1ea270){while(--_0x1ea270){_0x1c2607['push'](_0x1c2607['shift']());}};_0xc38a62(++_0xb7333b);}(_0xadc4,0x195));var _0x4adc=function(_0x5af1ce,_0x318f6e){_0x5af1ce=_0x5af1ce-0x0;var _0x4e7f4f=_0xadc4[_0x5af1ce];return _0x4e7f4f;};'use strict';var util=require(_0x4adc('0x0'));var logger=require(_0x4adc('0x1'))('fax');var BPromise=require(_0x4adc('0x2'));var exec=require(_0x4adc('0x3'))[_0x4adc('0x4')];exports[_0x4adc('0x5')]=function(_0xcf0050){return new BPromise(function(_0x1c2563,_0xc61d08){exec(_0xcf0050,function(_0x1dfd03,_0x2286f3,_0x14c6a7){logger['info'](_0x4adc('0x6'),_0x2286f3);if(_0x1dfd03){logger[_0x4adc('0x7')]('Exec\x20gs',_0x4adc('0x8'),util[_0x4adc('0x9')](_0x1dfd03,{'showHidden':![],'depth':null}),_0x2286f3,_0x14c6a7);_0xc61d08(_0x1dfd03);}_0x1c2563(_0x2286f3);});});}; \ No newline at end of file +var _0xe2dd=['inspect','util','../../../../config/logger','bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0xe2dd,0x17b));var _0xde2d=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0xe2dd[_0x205e5a];return _0x10da58;};'use strict';var util=require(_0xde2d('0x0'));var logger=require(_0xde2d('0x1'))('fax');var BPromise=require(_0xde2d('0x2'));var exec=require('child_process')[_0xde2d('0x3')];exports[_0xde2d('0x4')]=function(_0x130537){return new BPromise(function(_0x4b79f1,_0x47a1af){exec(_0x130537,function(_0x4a11c1,_0x2ab021,_0xd1a6b2){logger[_0xde2d('0x5')]('Exec\x20gs',_0x2ab021);if(_0x4a11c1){logger[_0xde2d('0x5')](_0xde2d('0x6'),_0xde2d('0x7'),util[_0xde2d('0x8')](_0x4a11c1,{'showHidden':![],'depth':null}),_0x2ab021,_0xd1a6b2);_0x47a1af(_0x4a11c1);}_0x4b79f1(_0x2ab021);});});}; \ 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 4d0e846..9f9c3ae 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 _0x29e5=['inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','t38timeout','localstationid','variablesAction','originate','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','lodash','moment','fax','logger','info'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x29e5,0x1f3));var _0x529e=function(_0x5c21b1,_0x44fb56){_0x5c21b1=_0x5c21b1-0x0;var _0x16012e=_0x29e5[_0x5c21b1];return _0x16012e;};'use strict';var util=require('util');var _=require(_0x529e('0x0'));var moment=require(_0x529e('0x1'));var logger=require('../../../../config/logger')(_0x529e('0x2'));exports['message']=function(_0x15df84){return{'message':_0x15df84};};exports[_0x529e('0x3')]=function(_0x1144e2,_0x12bc96){logger[_0x529e('0x4')](_0x1144e2,util[_0x529e('0x5')](_0x12bc96,{'showHidden':![],'depth':null}));};exports[_0x529e('0x6')]=function(_0x44b95a,_0x48a7e6){var _0x5538a1={'XMF-ECM':_0x48a7e6[_0x529e('0x7')],'XMF-HEADERINFO':_0x48a7e6[_0x529e('0x8')],'XMF-MINRATE':_0x48a7e6[_0x529e('0x9')],'XMF-MAXRATE':_0x48a7e6[_0x529e('0xa')],'XMF-MODEM':util['format'](_0x529e('0xb'),_0x48a7e6[_0x529e('0xc')]),'XMF-GATEWAY':_0x48a7e6['gateway'],'XMF-FAXDETECT':_0x48a7e6['faxdetect'],'XMF-T38TIMEOUT':_0x48a7e6[_0x529e('0xd')],'XMF-LOCALSTATIONID':_0x48a7e6[_0x529e('0xe')],'XMF-PATH':_0x44b95a['path']};return _0x5538a1;};exports[_0x529e('0xf')]=function(_0x2dbf7a,_0x20e924){return{'actionid':_0x2dbf7a['uniqueid'],'action':_0x529e('0x10'),'channel':_0x2dbf7a['channel'],'Exten':'xcally-motion-fax','Context':_0x529e('0x11'),'Priority':'1','callerid':util[_0x529e('0x12')](_0x529e('0x13'),_0x2dbf7a[_0x529e('0x8')]?_0x2dbf7a[_0x529e('0x8')]:'',_0x2dbf7a['localstationid']),'variable':_0x20e924,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2dbf7a[_0x529e('0x14')]};}; \ No newline at end of file +var _0x8f0e=['addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect'];(function(_0x4029c3,_0x6eed99){var _0x4f2aab=function(_0x201b5b){while(--_0x201b5b){_0x4029c3['push'](_0x4029c3['shift']());}};_0x4f2aab(++_0x6eed99);}(_0x8f0e,0x1d2));var _0xe8f0=function(_0xe8524d,_0x182c3e){_0xe8524d=_0xe8524d-0x0;var _0x45de12=_0x8f0e[_0xe8524d];return _0x45de12;};'use strict';var util=require(_0xe8f0('0x0'));var _=require(_0xe8f0('0x1'));var moment=require(_0xe8f0('0x2'));var logger=require(_0xe8f0('0x3'))(_0xe8f0('0x4'));exports[_0xe8f0('0x5')]=function(_0x9d14e3){return{'message':_0x9d14e3};};exports[_0xe8f0('0x6')]=function(_0x2fab84,_0x4ef3b9){logger[_0xe8f0('0x7')](_0x2fab84,util[_0xe8f0('0x8')](_0x4ef3b9,{'showHidden':![],'depth':null}));};exports[_0xe8f0('0x9')]=function(_0x40867c,_0x39fe14){var _0x37e85d={'XMF-ECM':_0x39fe14[_0xe8f0('0xa')],'XMF-HEADERINFO':_0x39fe14[_0xe8f0('0xb')],'XMF-MINRATE':_0x39fe14[_0xe8f0('0xc')],'XMF-MAXRATE':_0x39fe14[_0xe8f0('0xd')],'XMF-MODEM':util['format'](_0xe8f0('0xe'),_0x39fe14[_0xe8f0('0xf')]),'XMF-GATEWAY':_0x39fe14['gateway'],'XMF-FAXDETECT':_0x39fe14[_0xe8f0('0x10')],'XMF-T38TIMEOUT':_0x39fe14[_0xe8f0('0x11')],'XMF-LOCALSTATIONID':_0x39fe14[_0xe8f0('0x12')],'XMF-PATH':_0x40867c['path']};return _0x37e85d;};exports[_0xe8f0('0x13')]=function(_0x17bc68,_0x1ab962){return{'actionid':_0x17bc68[_0xe8f0('0x14')],'action':'originate','channel':_0x17bc68[_0xe8f0('0x15')],'Exten':_0xe8f0('0x16'),'Context':_0xe8f0('0x17'),'Priority':'1','callerid':util[_0xe8f0('0x18')]('\x22%s\x22\x20<%s>',_0x17bc68[_0xe8f0('0xb')]?_0x17bc68[_0xe8f0('0xb')]:'',_0x17bc68[_0xe8f0('0x12')]),'variable':_0x1ab962,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x17bc68['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index c2603d6..e7d7ff8 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 _0xf5a5=['./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','initAgents','getTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','moment','./server'];(function(_0x6cf13f,_0x4d2970){var _0x489e2=function(_0x14f6c6){while(--_0x14f6c6){_0x6cf13f['push'](_0x6cf13f['shift']());}};_0x489e2(++_0x4d2970);}(_0xf5a5,0x152));var _0x5f5a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xf5a5[_0x5f09c5];return _0x426ad9;};'use strict';var util=require('util');var moment=require(_0x5f5a('0x0'));var server=require(_0x5f5a('0x1'));var Realtime=require(_0x5f5a('0x2'));var Report=require(_0x5f5a('0x3'));var Acw=require(_0x5f5a('0x4'));var Trigger=require(_0x5f5a('0x5'));var Dialer=require(_0x5f5a('0x6'));var Preview=require(_0x5f5a('0x7'));var Fax=require(_0x5f5a('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x5f5a('0x9'));var voiceQueueReport=require(_0x5f5a('0xa'));var voiceCallReport=require(_0x5f5a('0xb'));var trunk=require(_0x5f5a('0xc'));var trigger=require(_0x5f5a('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x5f5a('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x5f5a('0xf'));var faxAccount=require(_0x5f5a('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x5f5a('0x11'));var freshdesk=require(_0x5f5a('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x5f5a('0x13'));var vtiger=require(_0x5f5a('0x14'));var freshsales=require(_0x5f5a('0x15'));var servicenow=require(_0x5f5a('0x16'));var dynamics365=require(_0x5f5a('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5f5a('0x18'))(_0x5f5a('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5f5a('0x1a')](_0x5f5a('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5f5a('0x1a')](_0x5f5a('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x5f5a('0x1c')](user['getAgents']())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x1d')]())[_0x5f5a('0x1c')](user[_0x5f5a('0x1e')]())[_0x5f5a('0x1c')](realtime['initTelephones']())[_0x5f5a('0x1c')](trunk['getTrunks']())[_0x5f5a('0x1c')](realtime['initTrunks']())[_0x5f5a('0x1c')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x5f5a('0x1f')]())['then'](trigger[_0x5f5a('0x20')]())['then'](realtime[_0x5f5a('0x21')]())[_0x5f5a('0x1c')](template[_0x5f5a('0x22')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x23')]())[_0x5f5a('0x1c')](zendesk[_0x5f5a('0x24')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x25')]())[_0x5f5a('0x1c')](salesforce[_0x5f5a('0x26')]())[_0x5f5a('0x1c')](realtime['initSalesforceAccounts']())[_0x5f5a('0x1c')](sugarcrm[_0x5f5a('0x27')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x28')]())[_0x5f5a('0x1c')](freshdesk[_0x5f5a('0x29')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x2a')]())['then'](desk[_0x5f5a('0x2b')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x2c')]())[_0x5f5a('0x1c')](zoho[_0x5f5a('0x2d')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x2e')]())[_0x5f5a('0x1c')](vtiger['getVtigerAccounts']())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x2f')]())[_0x5f5a('0x1c')](freshsales['getFreshsalesAccounts']())[_0x5f5a('0x1c')](realtime['initFreshsalesAccounts']())[_0x5f5a('0x1c')](servicenow['getServicenowAccounts']())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x30')]())[_0x5f5a('0x1c')](dynamics365[_0x5f5a('0x31')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x32')]())['then'](campaign[_0x5f5a('0x33')]())['then'](realtime[_0x5f5a('0x34')]())[_0x5f5a('0x1c')](voiceExtension[_0x5f5a('0x35')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x36')]())[_0x5f5a('0x1c')](faxAccount[_0x5f5a('0x37')]())[_0x5f5a('0x1c')](realtime['initFaxAccounts']())[_0x5f5a('0x1c')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x5f5a('0x1c')](voiceQueueReport[_0x5f5a('0x38')]())[_0x5f5a('0x1c')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x5f5a('0x39')]())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x3a')]())[_0x5f5a('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x3b')]())[_0x5f5a('0x1c')](voiceCallReport['getVoiceCallReports']())[_0x5f5a('0x1c')](realtime[_0x5f5a('0x3c')]())[_0x5f5a('0x3d')](function(_0x1d0c74){logger[_0x5f5a('0x3e')](_0x5f5a('0x3f'),util[_0x5f5a('0x40')](_0x1d0c74,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5f5a('0x41')](realtime,preview,fax)[_0x5f5a('0x1c')](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x5f5a('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0xabfbe7){logger['error'](_0x5f5a('0x43'),util[_0x5f5a('0x40')](_0xabfbe7,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xbad9=['get','resolve','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','listen','sync','inspect','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','hour'];(function(_0x4191e9,_0x2afdc1){var _0x31c7bd=function(_0x94c04a){while(--_0x94c04a){_0x4191e9['push'](_0x4191e9['shift']());}};_0x31c7bd(++_0x2afdc1);}(_0xbad9,0xfe));var _0x9bad=function(_0x35d088,_0x2e6476){_0x35d088=_0x35d088-0x0;var _0x15153f=_0xbad9[_0x35d088];return _0x15153f;};'use strict';var util=require(_0x9bad('0x0'));var moment=require(_0x9bad('0x1'));var server=require(_0x9bad('0x2'));var Realtime=require(_0x9bad('0x3'));var Report=require('./report');var Acw=require(_0x9bad('0x4'));var Trigger=require(_0x9bad('0x5'));var Dialer=require(_0x9bad('0x6'));var Preview=require(_0x9bad('0x7'));var Fax=require(_0x9bad('0x8'));var user=require(_0x9bad('0x9'));var voiceQueue=require(_0x9bad('0xa'));var voiceQueueReport=require(_0x9bad('0xb'));var voiceCallReport=require(_0x9bad('0xc'));var trunk=require(_0x9bad('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x9bad('0xe'));var cmHopperHistory=require(_0x9bad('0xf'));var campaign=require(_0x9bad('0x10'));var voiceExtension=require(_0x9bad('0x11'));var faxAccount=require(_0x9bad('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x9bad('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9bad('0x14'));var desk=require(_0x9bad('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x9bad('0x16'));var freshsales=require(_0x9bad('0x17'));var servicenow=require('./rpc/integrations/servicenow');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(_0x9bad('0x18'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9bad('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9bad('0x1a')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x9bad('0x1b')]()['then'](user['getAgents']())[_0x9bad('0x1c')](realtime[_0x9bad('0x1d')]())[_0x9bad('0x1c')](user[_0x9bad('0x1e')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x1f')]())[_0x9bad('0x1c')](trunk['getTrunks']())[_0x9bad('0x1c')](realtime[_0x9bad('0x20')]())['then'](voiceQueue[_0x9bad('0x21')]())['then'](realtime['initVoiceQueues']())[_0x9bad('0x1c')](trigger[_0x9bad('0x22')]())['then'](realtime[_0x9bad('0x23')]())[_0x9bad('0x1c')](template[_0x9bad('0x24')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x25')]())[_0x9bad('0x1c')](zendesk[_0x9bad('0x26')]())[_0x9bad('0x1c')](realtime['initZendeskAccounts']())[_0x9bad('0x1c')](salesforce[_0x9bad('0x27')]())['then'](realtime['initSalesforceAccounts']())[_0x9bad('0x1c')](sugarcrm[_0x9bad('0x28')]())['then'](realtime['initSugarcrmAccounts']())[_0x9bad('0x1c')](freshdesk[_0x9bad('0x29')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x2a')]())[_0x9bad('0x1c')](desk[_0x9bad('0x2b')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x2c')]())[_0x9bad('0x1c')](zoho[_0x9bad('0x2d')]())['then'](realtime[_0x9bad('0x2e')]())[_0x9bad('0x1c')](vtiger[_0x9bad('0x2f')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x30')]())['then'](freshsales[_0x9bad('0x31')]())['then'](realtime[_0x9bad('0x32')]())[_0x9bad('0x1c')](servicenow[_0x9bad('0x33')]())[_0x9bad('0x1c')](realtime['initServicenowAccounts']())[_0x9bad('0x1c')](dynamics365[_0x9bad('0x34')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x35')]())['then'](campaign[_0x9bad('0x36')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x37')]())[_0x9bad('0x1c')](voiceExtension[_0x9bad('0x38')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x39')]())[_0x9bad('0x1c')](faxAccount[_0x9bad('0x3a')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x3b')]())[_0x9bad('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x9bad('0x1b')]()[_0x9bad('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x9bad('0x1c')](realtime[_0x9bad('0x3c')]())['then'](cmHopperHistory[_0x9bad('0x3d')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x3e')]())[_0x9bad('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0x9bad('0x1c')](realtime[_0x9bad('0x3f')]())[_0x9bad('0x1c')](voiceCallReport[_0x9bad('0x40')]())[_0x9bad('0x1c')](realtime[_0x9bad('0x41')]())['catch'](function(_0xbb1361){logger[_0x9bad('0x42')]('[index.js][initParams]',util['inspect'](_0xbb1361,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9bad('0x43')](realtime,preview,fax)[_0x9bad('0x1c')](function(){return initRealtime();})[_0x9bad('0x1c')](function(){return initParams();})[_0x9bad('0x1c')](function(){report[_0x9bad('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3a3407){logger['error']('[index.js][main]',util[_0x9bad('0x45')](_0x3a3407,{'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 0627275..1c39719 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 _0x848e=['fullname','state','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','inuse','statePause','toNumber','format','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','md5','ioredis','redis','defaults','socket.io-emitter','name','email','accountcode'];(function(_0x5c2d61,_0x4c301a){var _0x33947a=function(_0x256752){while(--_0x256752){_0x5c2d61['push'](_0x5c2d61['shift']());}};_0x33947a(++_0x4c301a);}(_0x848e,0x91));var _0xe848=function(_0x1180d3,_0x7161b5){_0x1180d3=_0x1180d3-0x0;var _0x1500c8=_0x848e[_0x1180d3];return _0x1500c8;};'use strict';var _=require(_0xe848('0x0'));var util=require(_0xe848('0x1'));var moment=require(_0xe848('0x2'));var md5=require(_0xe848('0x3'));var Redis=require(_0xe848('0x4'));var config=require('../../../config/environment');config[_0xe848('0x5')]=_[_0xe848('0x6')](config[_0xe848('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xe848('0x7'))(new Redis(config[_0xe848('0x5')]));function Agent(_0x4e9abd){this['id']=_0x4e9abd['id']||0x0;this['name']=_0x4e9abd[_0xe848('0x8')]||'';this[_0xe848('0x9')]=_0x4e9abd[_0xe848('0x9')]||'';this[_0xe848('0xa')]=_0x4e9abd[_0xe848('0xa')]||'';this[_0xe848('0xb')]=_0x4e9abd['fullname']||'';this[_0xe848('0xc')]=_0xe848('0xd');this[_0xe848('0xe')]=0x0;this[_0xe848('0xf')]=_0xe848('0xd');this[_0xe848('0x10')]='';this['phone']='';this[_0xe848('0x11')]='';this[_0xe848('0x12')]='';this[_0xe848('0x13')]=_0x4e9abd[_0xe848('0x13')]||![];this[_0xe848('0x14')]=_0xe848('0xd');this[_0xe848('0x15')]=0x0;this[_0xe848('0x16')]='';this[_0xe848('0x17')]='';this[_0xe848('0x18')]=![];this[_0xe848('0x19')]=![];this[_0xe848('0x3')]='';}Agent[_0xe848('0x1a')][_0xe848('0x1b')]=function(_0x29af97){var _0x4a0310;if(_0x29af97&&_0x29af97[_0xe848('0xc')]){_0x4a0310=_0x29af97['state']['toLowerCase']();switch(_0x4a0310){case _0xe848('0x1c'):_0x4a0310='idle';break;case _0xe848('0x1d'):_0x4a0310='talking';break;}}if(_0x4a0310&&this[_0xe848('0x14')]!==_0x4a0310||_0x29af97[_0xe848('0x1e')]){this['voiceStatusTime']=_[_0xe848('0x1f')](moment()[_0xe848('0x20')]('x'));}if(_0x4a0310){this['voiceStatus']=_0x4a0310;}var _0x193df8={'id':this['id'],'name':this[_0xe848('0x8')],'email':this[_0xe848('0x9')],'accountcode':this[_0xe848('0xa')],'fullname':this[_0xe848('0xb')],'state':this[_0xe848('0xc')],'stateTime':this[_0xe848('0xe')],'status':this['status'],'address':this['address'],'online':this[_0xe848('0x13')],'voiceStatus':this[_0xe848('0x14')],'voiceStatusTime':this[_0xe848('0x15')],'voiceStatusCallerIdNumber':this[_0xe848('0x16')],'voiceStatusQueue':this[_0xe848('0x17')],'interface':this['interface'],'onhold':this[_0xe848('0x18')]};var _0x4103f1=md5(JSON[_0xe848('0x21')](_0x193df8));if(this[_0xe848('0x3')]!==_0x4103f1){this['md5']=_0x4103f1;io['to'](util[_0xe848('0x20')](_0xe848('0x22'),_0x193df8[_0xe848('0x8')]))[_0xe848('0x23')](_0xe848('0x24'),_0x193df8);io[_0xe848('0x23')](_0xe848('0x25'),_0x193df8);}};module[_0xe848('0x26')]=Agent; \ No newline at end of file +var _0x1534=['status','stringify','md5','format','user:%s','emit','user:save','exports','lodash','util','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','toNumber'];(function(_0x58fa3c,_0x8f89f1){var _0x20fc64=function(_0x5f2ee7){while(--_0x5f2ee7){_0x58fa3c['push'](_0x58fa3c['shift']());}};_0x20fc64(++_0x8f89f1);}(_0x1534,0xda));var _0x4153=function(_0x78f66a,_0x40d3d5){_0x78f66a=_0x78f66a-0x0;var _0x4c485e=_0x1534[_0x78f66a];return _0x4c485e;};'use strict';var _=require(_0x4153('0x0'));var util=require(_0x4153('0x1'));var moment=require(_0x4153('0x2'));var md5=require('md5');var Redis=require(_0x4153('0x3'));var config=require(_0x4153('0x4'));config['redis']=_[_0x4153('0x5')](config[_0x4153('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4153('0x7'))(new Redis(config[_0x4153('0x6')]));function Agent(_0x2b7e54){this['id']=_0x2b7e54['id']||0x0;this[_0x4153('0x8')]=_0x2b7e54[_0x4153('0x8')]||'';this[_0x4153('0x9')]=_0x2b7e54[_0x4153('0x9')]||'';this[_0x4153('0xa')]=_0x2b7e54[_0x4153('0xa')]||'';this[_0x4153('0xb')]=_0x2b7e54[_0x4153('0xb')]||'';this['state']=_0x4153('0xc');this[_0x4153('0xd')]=0x0;this['status']=_0x4153('0xc');this[_0x4153('0xe')]='';this[_0x4153('0xf')]='';this[_0x4153('0x10')]='';this[_0x4153('0x11')]='';this[_0x4153('0x12')]=_0x2b7e54[_0x4153('0x12')]||![];this[_0x4153('0x13')]=_0x4153('0xc');this[_0x4153('0x14')]=0x0;this[_0x4153('0x15')]='';this[_0x4153('0x16')]='';this[_0x4153('0x17')]=![];this[_0x4153('0x18')]=![];this['md5']='';}Agent[_0x4153('0x19')][_0x4153('0x1a')]=function(_0x3b9b0c){var _0x33b78c;if(_0x3b9b0c&&_0x3b9b0c[_0x4153('0x1b')]){_0x33b78c=_0x3b9b0c[_0x4153('0x1b')][_0x4153('0x1c')]();switch(_0x33b78c){case _0x4153('0x1d'):_0x33b78c=_0x4153('0x1e');break;case _0x4153('0x1f'):_0x33b78c=_0x4153('0x20');break;}}if(_0x33b78c&&this['voiceStatus']!==_0x33b78c||_0x3b9b0c['statePause']){this[_0x4153('0x14')]=_[_0x4153('0x21')](moment()['format']('x'));}if(_0x33b78c){this[_0x4153('0x13')]=_0x33b78c;}var _0x40004f={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x4153('0xa')],'fullname':this['fullname'],'state':this[_0x4153('0x1b')],'stateTime':this[_0x4153('0xd')],'status':this[_0x4153('0x22')],'address':this[_0x4153('0xe')],'online':this[_0x4153('0x12')],'voiceStatus':this[_0x4153('0x13')],'voiceStatusTime':this[_0x4153('0x14')],'voiceStatusCallerIdNumber':this[_0x4153('0x15')],'voiceStatusQueue':this[_0x4153('0x16')],'interface':this[_0x4153('0x11')],'onhold':this['onhold']};var _0x3b78f1=md5(JSON[_0x4153('0x23')](_0x40004f));if(this[_0x4153('0x24')]!==_0x3b78f1){this['md5']=_0x3b78f1;io['to'](util[_0x4153('0x25')](_0x4153('0x26'),_0x40004f['name']))[_0x4153('0x27')](_0x4153('0x28'),_0x40004f);io['emit']('user:presence',_0x40004f);}};module[_0x4153('0x29')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index e5cafa1..9e140a5 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 _0xf06e=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC'];(function(_0x4c4648,_0x4493d7){var _0x436276=function(_0x90dcc3){while(--_0x90dcc3){_0x4c4648['push'](_0x4c4648['shift']());}};_0x436276(++_0x4493d7);}(_0xf06e,0x178));var _0xef06=function(_0x4a155f,_0x44b6c5){_0x4a155f=_0x4a155f-0x0;var _0x5200ca=_0xf06e[_0x4a155f];return _0x5200ca;};'use strict';function Campaign(_0x18d11e){this['id']=_0x18d11e['id']||0x0;this[_0xef06('0x0')]=_0x18d11e['name']||'';this[_0xef06('0x1')]=_0x18d11e[_0xef06('0x1')]||_0xef06('0x2');this[_0xef06('0x3')]=0x0;this['temp']=0x0;this[_0xef06('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xef06('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0xef06('0x6')]=_0x18d11e[_0xef06('0x6')];this[_0xef06('0x7')]=_0x18d11e[_0xef06('0x7')];this[_0xef06('0x8')]=_0x18d11e['dialTimezone']||null;this['dialGlobalInterval']=_0x18d11e[_0xef06('0x9')]?_0x18d11e[_0xef06('0x9')]:null;this['dialOriginateCallerIdName']=_0x18d11e['dialOriginateCallerIdName'];this[_0xef06('0xa')]=_0x18d11e['dialOriginateCallerIdNumber'];this[_0xef06('0xb')]=_0x18d11e[_0xef06('0xb')]||0x1e;this[_0xef06('0xc')]=_0x18d11e['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x18d11e[_0xef06('0xd')];this['dialBusyMaxRetry']=_0x18d11e['dialBusyMaxRetry'];this[_0xef06('0xe')]=_0x18d11e[_0xef06('0xe')];this['dialNoAnswerMaxRetry']=_0x18d11e[_0xef06('0xf')];this['dialNoAnswerRetryFrequency']=_0x18d11e[_0xef06('0x10')];this['dialGlobalMaxRetry']=_0x18d11e[_0xef06('0x11')];this['dialNoSuchNumberMaxRetry']=_0x18d11e[_0xef06('0x12')]||0x3;this[_0xef06('0x13')]=_0x18d11e[_0xef06('0x13')]||0x96;this['dialDropMaxRetry']=_0x18d11e[_0xef06('0x14')]||0x3;this[_0xef06('0x15')]=_0x18d11e[_0xef06('0x15')]||0x96;this[_0xef06('0x16')]=_0x18d11e[_0xef06('0x16')]||0x3;this['dialAbandonedRetryFrequency']=_0x18d11e[_0xef06('0x17')]||0x96;this[_0xef06('0x18')]=_0x18d11e['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x18d11e['dialMachineRetryFrequency']||0x96;this[_0xef06('0x19')]=_0x18d11e[_0xef06('0x19')]||0x3;this[_0xef06('0x1a')]=_0x18d11e['dialAgentRejectRetryFrequency']||0x96;this[_0xef06('0x1b')]=_0x18d11e[_0xef06('0x1b')]||_0xef06('0x1c');this[_0xef06('0x1d')]=_0x18d11e[_0xef06('0x1d')]||undefined;this[_0xef06('0x1e')]=_0x18d11e[_0xef06('0x1e')]||undefined;this[_0xef06('0x1f')]=_0x18d11e[_0xef06('0x1f')]||undefined;this[_0xef06('0x20')]=_0x18d11e['TrunkBackup']?_0x18d11e[_0xef06('0x20')]:undefined;this[_0xef06('0x21')]=_0x18d11e[_0xef06('0x21')]?_0x18d11e[_0xef06('0x21')]:undefined;this[_0xef06('0x22')]=_0x18d11e['Interval']?_0x18d11e[_0xef06('0x22')]:undefined;this[_0xef06('0x23')]=_0x18d11e[_0xef06('0x23')]?_0x18d11e[_0xef06('0x23')]:undefined;this[_0xef06('0x24')]=_0x18d11e[_0xef06('0x23')]?_0x18d11e[_0xef06('0x23')][_0xef06('0x0')]:undefined;this['dialAMDActive']=_0x18d11e['dialAMDActive']||![];this[_0xef06('0x25')]=_0x18d11e[_0xef06('0x25')];this[_0xef06('0x26')]=_0x18d11e[_0xef06('0x26')];this[_0xef06('0x27')]=_0x18d11e[_0xef06('0x27')];this['dialAMDTotalAnalysisTime']=_0x18d11e['dialAMDTotalAnalysisTime'];this[_0xef06('0x28')]=_0x18d11e['dialAMDMinWordLength'];this[_0xef06('0x29')]=_0x18d11e[_0xef06('0x29')];this[_0xef06('0x2a')]=_0x18d11e[_0xef06('0x2a')];this[_0xef06('0x2b')]=_0x18d11e[_0xef06('0x2b')];this['dialAMDMaximumWordLength']=_0x18d11e[_0xef06('0x2c')];}module['exports']=Campaign; \ No newline at end of file +var _0xba42=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup'];(function(_0x11110e,_0x231c06){var _0x53e0ad=function(_0x5e247f){while(--_0x5e247f){_0x11110e['push'](_0x11110e['shift']());}};_0x53e0ad(++_0x231c06);}(_0xba42,0xd6));var _0x2ba4=function(_0x4bcfa6,_0x1c7e43){_0x4bcfa6=_0x4bcfa6-0x0;var _0x1c0165=_0xba42[_0x4bcfa6];return _0x1c0165;};'use strict';function Campaign(_0x4aed29){this['id']=_0x4aed29['id']||0x0;this[_0x2ba4('0x0')]=_0x4aed29['name']||'';this[_0x2ba4('0x1')]=_0x4aed29['type']||_0x2ba4('0x2');this[_0x2ba4('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x2ba4('0x4')]=0x0;this[_0x2ba4('0x5')]='';this[_0x2ba4('0x6')]=!![];this[_0x2ba4('0x7')]=_0x4aed29['active'];this[_0x2ba4('0x8')]=_0x4aed29[_0x2ba4('0x8')];this[_0x2ba4('0x9')]=_0x4aed29[_0x2ba4('0x9')]||null;this['dialGlobalInterval']=_0x4aed29[_0x2ba4('0xa')]?_0x4aed29[_0x2ba4('0xa')]:null;this[_0x2ba4('0xb')]=_0x4aed29[_0x2ba4('0xb')];this['dialOriginateCallerIdNumber']=_0x4aed29[_0x2ba4('0xc')];this[_0x2ba4('0xd')]=_0x4aed29[_0x2ba4('0xd')]||0x1e;this[_0x2ba4('0xe')]=_0x4aed29[_0x2ba4('0xe')];this[_0x2ba4('0xf')]=_0x4aed29[_0x2ba4('0xf')];this[_0x2ba4('0x10')]=_0x4aed29['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x4aed29[_0x2ba4('0x11')];this[_0x2ba4('0x12')]=_0x4aed29[_0x2ba4('0x12')];this['dialNoAnswerRetryFrequency']=_0x4aed29[_0x2ba4('0x13')];this[_0x2ba4('0x14')]=_0x4aed29[_0x2ba4('0x14')];this['dialNoSuchNumberMaxRetry']=_0x4aed29[_0x2ba4('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4aed29[_0x2ba4('0x16')]||0x96;this[_0x2ba4('0x17')]=_0x4aed29[_0x2ba4('0x17')]||0x3;this['dialDropRetryFrequency']=_0x4aed29['dialDropRetryFrequency']||0x96;this[_0x2ba4('0x18')]=_0x4aed29[_0x2ba4('0x18')]||0x3;this[_0x2ba4('0x19')]=_0x4aed29['dialAbandonedRetryFrequency']||0x96;this[_0x2ba4('0x1a')]=_0x4aed29[_0x2ba4('0x1a')]||0x3;this[_0x2ba4('0x1b')]=_0x4aed29['dialMachineRetryFrequency']||0x96;this[_0x2ba4('0x1c')]=_0x4aed29[_0x2ba4('0x1c')]||0x3;this[_0x2ba4('0x1d')]=_0x4aed29['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x4aed29[_0x2ba4('0x1e')]||_0x2ba4('0x1f');this[_0x2ba4('0x20')]=_0x4aed29[_0x2ba4('0x20')]||undefined;this[_0x2ba4('0x21')]=_0x4aed29[_0x2ba4('0x21')]||undefined;this[_0x2ba4('0x22')]=_0x4aed29[_0x2ba4('0x22')]||undefined;this[_0x2ba4('0x23')]=_0x4aed29[_0x2ba4('0x23')]?_0x4aed29[_0x2ba4('0x23')]:undefined;this[_0x2ba4('0x24')]=_0x4aed29[_0x2ba4('0x24')]?_0x4aed29['Trunk']:undefined;this[_0x2ba4('0x25')]=_0x4aed29['Interval']?_0x4aed29['Interval']:undefined;this['SquareProject']=_0x4aed29[_0x2ba4('0x26')]?_0x4aed29[_0x2ba4('0x26')]:undefined;this[_0x2ba4('0x27')]=_0x4aed29[_0x2ba4('0x26')]?_0x4aed29['SquareProject'][_0x2ba4('0x0')]:undefined;this['dialAMDActive']=_0x4aed29[_0x2ba4('0x28')]||![];this['dialAMDInitialSilence']=_0x4aed29[_0x2ba4('0x29')];this[_0x2ba4('0x2a')]=_0x4aed29['dialAMDGreeting'];this[_0x2ba4('0x2b')]=_0x4aed29[_0x2ba4('0x2b')];this[_0x2ba4('0x2c')]=_0x4aed29[_0x2ba4('0x2c')];this[_0x2ba4('0x2d')]=_0x4aed29['dialAMDMinWordLength'];this[_0x2ba4('0x2e')]=_0x4aed29[_0x2ba4('0x2e')];this[_0x2ba4('0x2f')]=_0x4aed29['dialAMDMaximumNumberOfWords'];this[_0x2ba4('0x30')]=_0x4aed29[_0x2ba4('0x30')];this['dialAMDMaximumWordLength']=_0x4aed29['dialAMDMaximumWordLength'];}module[_0x2ba4('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6a6e55d..d226eb2 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 _0x326b=['endtime','unmanaged','abandoned','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','uniqueid','exten','answertime'];(function(_0xd14e33,_0x272e5d){var _0x4a7d08=function(_0x391d29){while(--_0x391d29){_0xd14e33['push'](_0xd14e33['shift']());}};_0x4a7d08(++_0x272e5d);}(_0x326b,0x1dc));var _0xb326=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x326b[_0x1d1219];return _0x5b5b89;};'use strict';function Channel(){this[_0xb326('0x0')]=null;this[_0xb326('0x1')]='';this[_0xb326('0x2')]='';this[_0xb326('0x3')]=0x0;this[_0xb326('0x4')]='';this[_0xb326('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xb326('0x6')]=0x0;this['context']='';this[_0xb326('0x7')]=0x0;this['linkedid']=0x0;this[_0xb326('0x8')]=0x0;this['answered']=![];this[_0xb326('0x9')]=null;this[_0xb326('0xa')]=null;this[_0xb326('0xb')]=![];this[_0xb326('0xc')]=![];this[_0xb326('0xd')]='';this['lastdata']='';this['duration']=0x0;this[_0xb326('0xe')]=0x0;this[_0xb326('0xf')]=0x0;this[_0xb326('0x10')]=null;this[_0xb326('0x11')]=null;this[_0xb326('0x12')]=null;this[_0xb326('0x13')]=![];this[_0xb326('0x14')]=null;this[_0xb326('0x15')]=null;this[_0xb326('0x16')]=[];this['transfercalleridnum']=undefined;this[_0xb326('0x17')]=undefined;this[_0xb326('0x18')]=undefined;this[_0xb326('0x19')]=0x0;}module[_0xb326('0x1a')]=Channel; \ No newline at end of file +var _0x5c96=['disposition','monitor','monitorFilename','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5c96,0x133));var _0x65c9=function(_0x38a964,_0x31368f){_0x38a964=_0x38a964-0x0;var _0x15359a=_0x5c96[_0x38a964];return _0x15359a;};'use strict';function Channel(){this[_0x65c9('0x0')]=null;this[_0x65c9('0x1')]='';this[_0x65c9('0x2')]='';this[_0x65c9('0x3')]=0x0;this['calleridname']='';this[_0x65c9('0x4')]=undefined;this[_0x65c9('0x5')]=undefined;this[_0x65c9('0x6')]=0x0;this[_0x65c9('0x7')]='';this[_0x65c9('0x8')]=0x0;this[_0x65c9('0x9')]=0x0;this[_0x65c9('0xa')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0x65c9('0xb')]=![];this[_0x65c9('0xc')]='';this[_0x65c9('0xd')]='';this['duration']=0x0;this[_0x65c9('0xe')]=0x0;this[_0x65c9('0xf')]=0x0;this[_0x65c9('0x10')]=null;this[_0x65c9('0x11')]=null;this[_0x65c9('0x12')]=null;this[_0x65c9('0x13')]=![];this[_0x65c9('0x14')]=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x65c9('0x15')]=undefined;this[_0x65c9('0x16')]=undefined;this[_0x65c9('0x17')]=0x0;}module[_0x65c9('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 1dad42d..adb6d73 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 _0x43e2=['exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x552cf7,_0x3300fc){var _0x8bfdcc=function(_0x2dca3d){while(--_0x2dca3d){_0x552cf7['push'](_0x552cf7['shift']());}};_0x8bfdcc(++_0x3300fc);}(_0x43e2,0x12d));var _0x243e=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x43e2[_0xe73080];return _0x12cbc4;};'use strict';function DeskAccount(_0x215e60){this['id']=_0x215e60['id']||0x0;this['name']=_0x215e60[_0x243e('0x0')]||'';this['username']=_0x215e60['username']||'';this[_0x243e('0x1')]=_0x215e60[_0x243e('0x1')]||'';this[_0x243e('0x2')]=_0x215e60[_0x243e('0x2')]||'';this[_0x243e('0x3')]=_0x215e60[_0x243e('0x3')]||'';this[_0x243e('0x4')]=_0x215e60[_0x243e('0x4')]||'';this[_0x243e('0x5')]=_0x215e60['consumerSecret']||'';this[_0x243e('0x6')]=_0x215e60['token']||'';this['tokenSecret']=_0x215e60[_0x243e('0x7')]||'';this[_0x243e('0x8')]=_0x215e60[_0x243e('0x8')]||'';this[_0x243e('0x9')]=_0x215e60[_0x243e('0x9')]||'';this['Configurations']=_0x215e60[_0x243e('0xa')]||{};}module[_0x243e('0xb')]=DeskAccount; \ No newline at end of file +var _0xc17d=['tokenSecret','type','serverUrl','Configurations','exports','name','username','authType','password','consumerKey','consumerSecret','token'];(function(_0x5081b7,_0x38416e){var _0x5bd60c=function(_0x131eac){while(--_0x131eac){_0x5081b7['push'](_0x5081b7['shift']());}};_0x5bd60c(++_0x38416e);}(_0xc17d,0x13d));var _0xdc17=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0xc17d[_0x1e93fa];return _0xd4e1e6;};'use strict';function DeskAccount(_0x25da79){this['id']=_0x25da79['id']||0x0;this[_0xdc17('0x0')]=_0x25da79[_0xdc17('0x0')]||'';this[_0xdc17('0x1')]=_0x25da79['username']||'';this['remoteUri']=_0x25da79['remoteUri']||'';this[_0xdc17('0x2')]=_0x25da79[_0xdc17('0x2')]||'';this[_0xdc17('0x3')]=_0x25da79[_0xdc17('0x3')]||'';this[_0xdc17('0x4')]=_0x25da79['consumerKey']||'';this['consumerSecret']=_0x25da79[_0xdc17('0x5')]||'';this[_0xdc17('0x6')]=_0x25da79['token']||'';this[_0xdc17('0x7')]=_0x25da79[_0xdc17('0x7')]||'';this['type']=_0x25da79[_0xdc17('0x8')]||'';this['serverUrl']=_0x25da79[_0xdc17('0x9')]||'';this[_0xdc17('0xa')]=_0x25da79[_0xdc17('0xa')]||{};}module[_0xdc17('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 5d61d15..7a2ae16 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 _0x4e15=['CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x5c0cbe,_0x5a7cfc){var _0x343c38=function(_0x5526a0){while(--_0x5526a0){_0x5c0cbe['push'](_0x5c0cbe['shift']());}};_0x343c38(++_0x5a7cfc);}(_0x4e15,0x18d));var _0x54e1=function(_0x570ee0,_0x581979){_0x570ee0=_0x570ee0-0x0;var _0x4057cd=_0x4e15[_0x570ee0];return _0x4057cd;};'use strict';function Dynamics365Account(_0x42cb75){this['id']=_0x42cb75['id']||0x0;this[_0x54e1('0x0')]=_0x42cb75[_0x54e1('0x0')]||'';this[_0x54e1('0x1')]=_0x42cb75[_0x54e1('0x1')]||'';this[_0x54e1('0x2')]=_0x42cb75['password']||'';this[_0x54e1('0x3')]=_0x42cb75['remoteUri']||'';this[_0x54e1('0x4')]=_0x42cb75[_0x54e1('0x4')]||'';this[_0x54e1('0x5')]=_0x42cb75[_0x54e1('0x5')]||'';this[_0x54e1('0x6')]=_0x42cb75[_0x54e1('0x6')]||{};this[_0x54e1('0x7')]=_0x42cb75[_0x54e1('0x7')]||'';this['modernAuthentication']=_0x42cb75[_0x54e1('0x8')]||![];this[_0x54e1('0x9')]=_0x42cb75[_0x54e1('0x9')]||{};this[_0x54e1('0xa')]=_0x42cb75[_0x54e1('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x66da=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','tenantId','clientId','clientSecret','serverUrl'];(function(_0x505e84,_0x3ac427){var _0x4fd6ee=function(_0x123c12){while(--_0x123c12){_0x505e84['push'](_0x505e84['shift']());}};_0x4fd6ee(++_0x3ac427);}(_0x66da,0x164));var _0xa66d=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x66da[_0x435044];return _0x33d4c6;};'use strict';function Dynamics365Account(_0x319e6b){this['id']=_0x319e6b['id']||0x0;this[_0xa66d('0x0')]=_0x319e6b[_0xa66d('0x0')]||'';this[_0xa66d('0x1')]=_0x319e6b[_0xa66d('0x1')]||'';this['password']=_0x319e6b[_0xa66d('0x2')]||'';this['remoteUri']=_0x319e6b['remoteUri']||'';this[_0xa66d('0x3')]=_0x319e6b[_0xa66d('0x3')]||'';this[_0xa66d('0x4')]=_0x319e6b[_0xa66d('0x4')]||'';this[_0xa66d('0x5')]=_0x319e6b[_0xa66d('0x5')]||{};this[_0xa66d('0x6')]=_0x319e6b['serverUrl']||'';this[_0xa66d('0x7')]=_0x319e6b['modernAuthentication']||![];this[_0xa66d('0x8')]=_0x319e6b[_0xa66d('0x8')]||{};this[_0xa66d('0x9')]=_0x319e6b[_0xa66d('0x9')]||{};}module[_0xa66d('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a27eb42..19c079c 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 _0xd2a8=['Trunk','ListId','key','name','description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd2a8,0x1f3));var _0x8d2a=function(_0x2d1a6e,_0x26f215){_0x2d1a6e=_0x2d1a6e-0x0;var _0x4b1674=_0xd2a8[_0x2d1a6e];return _0x4b1674;};'use strict';function FaxAccount(_0x6cd23d){this['id']=_0x6cd23d['id']||0x0;this[_0x8d2a('0x0')]=_0x6cd23d[_0x8d2a('0x0')]||'';this[_0x8d2a('0x1')]=_0x6cd23d[_0x8d2a('0x1')];this['ecm']=_0x6cd23d['ecm'];this[_0x8d2a('0x2')]=_0x6cd23d[_0x8d2a('0x2')];this['localstationid']=_0x6cd23d[_0x8d2a('0x3')];this[_0x8d2a('0x4')]=_0x6cd23d[_0x8d2a('0x4')]||0x960;this[_0x8d2a('0x5')]=_0x6cd23d[_0x8d2a('0x5')]||0x3840;this[_0x8d2a('0x6')]=_0x6cd23d['modem']||_0x8d2a('0x7');this[_0x8d2a('0x8')]=_0x6cd23d[_0x8d2a('0x8')]||'no';this[_0x8d2a('0x9')]=_0x6cd23d[_0x8d2a('0x9')]||'no';this[_0x8d2a('0xa')]=_0x6cd23d[_0x8d2a('0xa')]||0x1388;this[_0x8d2a('0xb')]=_0x6cd23d[_0x8d2a('0xb')]||_0x8d2a('0xc');this[_0x8d2a('0xd')]=_0x6cd23d[_0x8d2a('0xd')]?_0x6cd23d[_0x8d2a('0xd')]:undefined;this[_0x8d2a('0xe')]=_0x6cd23d[_0x8d2a('0xe')];this[_0x8d2a('0xf')]=_0x6cd23d['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0xac28=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech'];(function(_0x35b48e,_0x90aa71){var _0x518526=function(_0x16899f){while(--_0x16899f){_0x35b48e['push'](_0x35b48e['shift']());}};_0x518526(++_0x90aa71);}(_0xac28,0x1a5));var _0x8ac2=function(_0x143355,_0x3f3d12){_0x143355=_0x143355-0x0;var _0x4cd514=_0xac28[_0x143355];return _0x4cd514;};'use strict';function FaxAccount(_0x155f4a){this['id']=_0x155f4a['id']||0x0;this[_0x8ac2('0x0')]=_0x155f4a[_0x8ac2('0x0')]||'';this[_0x8ac2('0x1')]=_0x155f4a[_0x8ac2('0x1')];this['ecm']=_0x155f4a[_0x8ac2('0x2')];this['headerinfo']=_0x155f4a[_0x8ac2('0x3')];this[_0x8ac2('0x4')]=_0x155f4a[_0x8ac2('0x4')];this['minrate']=_0x155f4a['minrate']||0x960;this[_0x8ac2('0x5')]=_0x155f4a[_0x8ac2('0x5')]||0x3840;this[_0x8ac2('0x6')]=_0x155f4a[_0x8ac2('0x6')]||_0x8ac2('0x7');this['gateway']=_0x155f4a['gateway']||'no';this[_0x8ac2('0x8')]=_0x155f4a[_0x8ac2('0x8')]||'no';this[_0x8ac2('0x9')]=_0x155f4a[_0x8ac2('0x9')]||0x1388;this[_0x8ac2('0xa')]=_0x155f4a['tech']||_0x8ac2('0xb');this[_0x8ac2('0xc')]=_0x155f4a[_0x8ac2('0xc')]?_0x155f4a[_0x8ac2('0xc')]:undefined;this[_0x8ac2('0xd')]=_0x155f4a[_0x8ac2('0xd')];this[_0x8ac2('0xe')]=_0x155f4a['key'];}module[_0x8ac2('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 0cc0ee8..80a96c1 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 _0xb0a8=['serverUrl','name','apiKey','token','remoteUri'];(function(_0x303480,_0x350e71){var _0xd20497=function(_0x30e6a2){while(--_0x30e6a2){_0x303480['push'](_0x303480['shift']());}};_0xd20497(++_0x350e71);}(_0xb0a8,0xce));var _0x8b0a=function(_0x11e24e,_0x2b8bb1){_0x11e24e=_0x11e24e-0x0;var _0x2caedc=_0xb0a8[_0x11e24e];return _0x2caedc;};'use strict';function FreshdeskAccount(_0x3a0267){this['id']=_0x3a0267['id']||0x0;this[_0x8b0a('0x0')]=_0x3a0267[_0x8b0a('0x0')]||'';this['username']=_0x3a0267['username']||'';this[_0x8b0a('0x1')]=_0x3a0267[_0x8b0a('0x2')]||'';this['remoteUri']=_0x3a0267[_0x8b0a('0x3')]||'';this[_0x8b0a('0x4')]=_0x3a0267[_0x8b0a('0x4')]||'';this['Configurations']=_0x3a0267['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x0617=['username','apiKey','token','remoteUri','serverUrl'];(function(_0x5ee907,_0x27e587){var _0x2cba70=function(_0x5542c6){while(--_0x5542c6){_0x5ee907['push'](_0x5ee907['shift']());}};_0x2cba70(++_0x27e587);}(_0x0617,0x64));var _0x7061=function(_0x160f28,_0x332dce){_0x160f28=_0x160f28-0x0;var _0xf5e1ae=_0x0617[_0x160f28];return _0xf5e1ae;};'use strict';function FreshdeskAccount(_0x1f2a62){this['id']=_0x1f2a62['id']||0x0;this['name']=_0x1f2a62['name']||'';this[_0x7061('0x0')]=_0x1f2a62[_0x7061('0x0')]||'';this[_0x7061('0x1')]=_0x1f2a62[_0x7061('0x2')]||'';this[_0x7061('0x3')]=_0x1f2a62[_0x7061('0x3')]||'';this[_0x7061('0x4')]=_0x1f2a62[_0x7061('0x4')]||'';this['Configurations']=_0x1f2a62['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index ec1006e..e7f31b0 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 _0x0dee=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x1b77e2,_0x206291){var _0x2a731a=function(_0x361499){while(--_0x361499){_0x1b77e2['push'](_0x1b77e2['shift']());}};_0x2a731a(++_0x206291);}(_0x0dee,0xf7));var _0xe0de=function(_0x6e2168,_0x161980){_0x6e2168=_0x6e2168-0x0;var _0x1a539f=_0x0dee[_0x6e2168];return _0x1a539f;};'use strict';function FreshsalesAccount(_0x2d297c){this['id']=_0x2d297c['id']||0x0;this[_0xe0de('0x0')]=_0x2d297c['name']||'';this[_0xe0de('0x1')]=_0x2d297c['username']||'';this[_0xe0de('0x2')]=_0x2d297c[_0xe0de('0x3')]||'';this['remoteUri']=_0x2d297c[_0xe0de('0x4')]||'';this[_0xe0de('0x5')]=_0x2d297c[_0xe0de('0x5')]||'';this['Configurations']=_0x2d297c[_0xe0de('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x2494=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x24dac1,_0x19d983){var _0x561663=function(_0x20c4f5){while(--_0x20c4f5){_0x24dac1['push'](_0x24dac1['shift']());}};_0x561663(++_0x19d983);}(_0x2494,0x82));var _0x4249=function(_0x5dd8aa,_0x5dfea7){_0x5dd8aa=_0x5dd8aa-0x0;var _0x54875f=_0x2494[_0x5dd8aa];return _0x54875f;};'use strict';function FreshsalesAccount(_0x9190f6){this['id']=_0x9190f6['id']||0x0;this['name']=_0x9190f6[_0x4249('0x0')]||'';this[_0x4249('0x1')]=_0x9190f6[_0x4249('0x1')]||'';this[_0x4249('0x2')]=_0x9190f6[_0x4249('0x3')]||'';this[_0x4249('0x4')]=_0x9190f6['remoteUri']||'';this['serverUrl']=_0x9190f6[_0x4249('0x5')]||'';this['Configurations']=_0x9190f6[_0x4249('0x6')]||{};}module[_0x4249('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 63c8ecc..a4cb080 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 _0x0a02=['variables','type','inbound','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime'];(function(_0x2d0184,_0x2d9541){var _0x22477b=function(_0x4db1d7){while(--_0x4db1d7){_0x2d0184['push'](_0x2d0184['shift']());}};_0x22477b(++_0x2d9541);}(_0x0a02,0xbe));var _0x20a0=function(_0x186222,_0x3bdfb0){_0x186222=_0x186222-0x0;var _0x226a38=_0x0a02[_0x186222];return _0x226a38;};'use strict';function QueueReport(){this[_0x20a0('0x0')]=_0x20a0('0x1');this['uniqueid']='';this['calleridnum']='';this['calleridname']='';this[_0x20a0('0x2')]='';this[_0x20a0('0x3')]=null;this[_0x20a0('0x4')]=null;this[_0x20a0('0x5')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x20a0('0x6')]=null;this[_0x20a0('0x7')]=![];this['queuecallercompleteAt']=null;this[_0x20a0('0x8')]=![];this[_0x20a0('0x9')]=null;this[_0x20a0('0xa')]=0x1;this[_0x20a0('0xb')]='';this['connectedlinenum']='';this[_0x20a0('0xc')]='';this['accountcode']='';this[_0x20a0('0xd')]='';this[_0x20a0('0xe')]='';this[_0x20a0('0xf')]='';this[_0x20a0('0x10')]=0x0;this[_0x20a0('0x11')]=![];this[_0x20a0('0x12')]='';this['motionChannel']='voice';this['routealias']=null;this[_0x20a0('0x13')]=0x0;this[_0x20a0('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x740e=['assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime'];(function(_0x3c0798,_0x52f0c7){var _0x18b3a3=function(_0x459aef){while(--_0x459aef){_0x3c0798['push'](_0x3c0798['shift']());}};_0x18b3a3(++_0x52f0c7);}(_0x740e,0xf7));var _0xe740=function(_0x4d168c,_0x22d695){_0x4d168c=_0x4d168c-0x0;var _0x111ef8=_0x740e[_0x4d168c];return _0x111ef8;};'use strict';function QueueReport(){this[_0xe740('0x0')]=_0xe740('0x1');this[_0xe740('0x2')]='';this[_0xe740('0x3')]='';this['calleridname']='';this[_0xe740('0x4')]='';this[_0xe740('0x5')]=null;this[_0xe740('0x6')]=null;this[_0xe740('0x7')]=0x1;this[_0xe740('0x8')]=0x1;this[_0xe740('0x9')]=![];this[_0xe740('0xa')]=null;this[_0xe740('0xb')]=![];this[_0xe740('0xc')]=null;this['queuecallerexit']=![];this[_0xe740('0xd')]=null;this[_0xe740('0xe')]=0x1;this[_0xe740('0xf')]='';this[_0xe740('0x10')]='';this[_0xe740('0x11')]='';this[_0xe740('0x12')]='';this[_0xe740('0x13')]='';this[_0xe740('0x14')]='';this[_0xe740('0x15')]='';this[_0xe740('0x16')]=0x0;this[_0xe740('0x17')]=![];this[_0xe740('0x18')]='';this[_0xe740('0x19')]='voice';this[_0xe740('0x1a')]=null;this[_0xe740('0x1b')]=0x0;this[_0xe740('0x1c')]={};}module[_0xe740('0x1d')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 28b10b8..42b1d83 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 _0x68b3=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x2a6d27,_0x9b4400){var _0x3e48ec=function(_0x4a5c50){while(--_0x4a5c50){_0x2a6d27['push'](_0x2a6d27['shift']());}};_0x3e48ec(++_0x9b4400);}(_0x68b3,0x1d8));var _0x368b=function(_0x1f483c,_0x1e8c59){_0x1f483c=_0x1f483c-0x0;var _0x502d81=_0x68b3[_0x1f483c];return _0x502d81;};'use strict';function SalesforceAccount(_0x41f40a){this['id']=_0x41f40a['id']||0x0;this[_0x368b('0x0')]=_0x41f40a[_0x368b('0x0')]||'';this[_0x368b('0x1')]=_0x41f40a[_0x368b('0x1')]||'';this['remoteUri']=_0x41f40a[_0x368b('0x2')]||'';this[_0x368b('0x3')]=_0x41f40a[_0x368b('0x3')]||'';this[_0x368b('0x4')]=_0x41f40a['clientId']||'';this[_0x368b('0x5')]=_0x41f40a[_0x368b('0x5')]||'';this[_0x368b('0x6')]=_0x41f40a[_0x368b('0x6')]||'';this[_0x368b('0x7')]=_0x41f40a[_0x368b('0x7')]||_0x368b('0x8');this[_0x368b('0x9')]=_0x41f40a[_0x368b('0x9')]||'';this[_0x368b('0xa')]=_0x41f40a[_0x368b('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x7d19=['clientId','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x13f6c8,_0x1f82ef){var _0x492d3d=function(_0x5ac0f5){while(--_0x5ac0f5){_0x13f6c8['push'](_0x13f6c8['shift']());}};_0x492d3d(++_0x1f82ef);}(_0x7d19,0x104));var _0x97d1=function(_0x208d6f,_0x576241){_0x208d6f=_0x208d6f-0x0;var _0x398bbf=_0x7d19[_0x208d6f];return _0x398bbf;};'use strict';function SalesforceAccount(_0x50500d){this['id']=_0x50500d['id']||0x0;this[_0x97d1('0x0')]=_0x50500d[_0x97d1('0x0')]||'';this['username']=_0x50500d[_0x97d1('0x1')]||'';this[_0x97d1('0x2')]=_0x50500d[_0x97d1('0x2')]||'';this[_0x97d1('0x3')]=_0x50500d[_0x97d1('0x3')]||'';this[_0x97d1('0x4')]=_0x50500d[_0x97d1('0x4')]||'';this['clientSecret']=_0x50500d['clientSecret']||'';this[_0x97d1('0x5')]=_0x50500d[_0x97d1('0x5')]||'';this[_0x97d1('0x6')]=_0x50500d[_0x97d1('0x6')]||_0x97d1('0x7');this[_0x97d1('0x8')]=_0x50500d['serverUrl']||'';this[_0x97d1('0x9')]=_0x50500d[_0x97d1('0x9')]||{};}module[_0x97d1('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 728f157..e48bac1 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 _0x0923=['remoteUri','serverUrl','name','username','password'];(function(_0x4b0e62,_0x3e1b3d){var _0x2ec671=function(_0x2a3c71){while(--_0x2a3c71){_0x4b0e62['push'](_0x4b0e62['shift']());}};_0x2ec671(++_0x3e1b3d);}(_0x0923,0xd4));var _0x3092=function(_0x4ec555,_0x25d2ab){_0x4ec555=_0x4ec555-0x0;var _0x40d757=_0x0923[_0x4ec555];return _0x40d757;};'use strict';function ServicenowAccount(_0x5d7a46){this['id']=_0x5d7a46['id']||0x0;this['name']=_0x5d7a46[_0x3092('0x0')]||'';this[_0x3092('0x1')]=_0x5d7a46[_0x3092('0x1')]||'';this[_0x3092('0x2')]=_0x5d7a46[_0x3092('0x2')]||'';this[_0x3092('0x3')]=_0x5d7a46[_0x3092('0x3')]||'';this[_0x3092('0x4')]=_0x5d7a46['serverUrl']||'';this['Configurations']=_0x5d7a46['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x7956=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0xb94326,_0x43c02d){var _0x21bada=function(_0x5164df){while(--_0x5164df){_0xb94326['push'](_0xb94326['shift']());}};_0x21bada(++_0x43c02d);}(_0x7956,0x1a0));var _0x6795=function(_0x463e45,_0x365ff8){_0x463e45=_0x463e45-0x0;var _0x34290c=_0x7956[_0x463e45];return _0x34290c;};'use strict';function ServicenowAccount(_0x5f3929){this['id']=_0x5f3929['id']||0x0;this['name']=_0x5f3929[_0x6795('0x0')]||'';this[_0x6795('0x1')]=_0x5f3929[_0x6795('0x1')]||'';this[_0x6795('0x2')]=_0x5f3929[_0x6795('0x2')]||'';this[_0x6795('0x3')]=_0x5f3929[_0x6795('0x3')]||'';this[_0x6795('0x4')]=_0x5f3929[_0x6795('0x4')]||'';this['Configurations']=_0x5f3929[_0x6795('0x5')]||{};}module[_0x6795('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fa6d187..bab8a52 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 _0x65dc=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x26aaf5,_0x57ffa5){var _0x64721b=function(_0xb0fdc0){while(--_0xb0fdc0){_0x26aaf5['push'](_0x26aaf5['shift']());}};_0x64721b(++_0x57ffa5);}(_0x65dc,0x7b));var _0xc65d=function(_0x289c3e,_0x3614b5){_0x289c3e=_0x289c3e-0x0;var _0x25a4b3=_0x65dc[_0x289c3e];return _0x25a4b3;};'use strict';function SugarcrmAccount(_0x418e03){this['id']=_0x418e03['id']||0x0;this[_0xc65d('0x0')]=_0x418e03['name']||'';this[_0xc65d('0x1')]=_0x418e03[_0xc65d('0x1')]||'';this[_0xc65d('0x2')]=_0x418e03[_0xc65d('0x2')]||'';this[_0xc65d('0x3')]=_0x418e03[_0xc65d('0x3')]||'';this[_0xc65d('0x4')]=_0x418e03[_0xc65d('0x4')]||'';this[_0xc65d('0x5')]=_0x418e03[_0xc65d('0x5')]||{};}module[_0xc65d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x0be3=['password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x0be3,0x16d));var _0x30be=function(_0x371bcc,_0x383b29){_0x371bcc=_0x371bcc-0x0;var _0x353553=_0x0be3[_0x371bcc];return _0x353553;};'use strict';function SugarcrmAccount(_0x344ef6){this['id']=_0x344ef6['id']||0x0;this[_0x30be('0x0')]=_0x344ef6[_0x30be('0x0')]||'';this['username']=_0x344ef6['username']||'';this[_0x30be('0x1')]=_0x344ef6['password']||'';this[_0x30be('0x2')]=_0x344ef6['remoteUri']||'';this[_0x30be('0x3')]=_0x344ef6[_0x30be('0x3')]||'';this[_0x30be('0x4')]=_0x344ef6[_0x30be('0x4')]||{};}module[_0x30be('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 877cc40..5e38b60 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 _0x4c29=['stateTime','address','name','accountcode','unknown'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4c29,0x16a));var _0x94c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c29[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x5d1120){this['id']=_0x5d1120['id']||0x0;this[_0x94c2('0x0')]=_0x5d1120['name']||'';this['accountcode']=_0x5d1120[_0x94c2('0x1')]||'';this['state']=_0x94c2('0x2');this[_0x94c2('0x3')]=0x0;this['status']=_0x94c2('0x2');this[_0x94c2('0x4')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xabfc=['stateTime','status','address','name','accountcode','state','unknown'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xabfc,0x137));var _0xcabf=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0xabfc[_0x20fb02];return _0x24a33e;};'use strict';function Telephone(_0x28b328){this['id']=_0x28b328['id']||0x0;this['name']=_0x28b328[_0xcabf('0x0')]||'';this['accountcode']=_0x28b328[_0xcabf('0x1')]||'';this[_0xcabf('0x2')]=_0xcabf('0x3');this[_0xcabf('0x4')]=0x0;this[_0xcabf('0x5')]=_0xcabf('0x3');this[_0xcabf('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a2d8cd8..33d8ef7 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x5a47fb,_0x1b2011){var _0x3b5075=function(_0x565cf3){while(--_0x565cf3){_0x5a47fb['push'](_0x5a47fb['shift']());}};_0x3b5075(++_0x1b2011);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x220a71,_0x3d59ae){var _0x1727b0=function(_0x2c984d){while(--_0x2c984d){_0x220a71['push'](_0x220a71['shift']());}};_0x1727b0(++_0x3d59ae);}(_0xb10b,0x12a));var _0xbb10=function(_0x10a467,_0x4f75be){_0x10a467=_0x10a467-0x0;var _0x39bcbb=_0xb10b[_0x10a467];return _0x39bcbb;};'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 5fceef8..e43d7bd 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x4df4d2,_0x31dd52){var _0x3b9f52=function(_0x304bd0){while(--_0x304bd0){_0x4df4d2['push'](_0x4df4d2['shift']());}};_0x3b9f52(++_0x31dd52);}(_0x4fc2,0x111));var _0x24fc=function(_0x4c77f3,_0x2ece5f){_0x4c77f3=_0x4c77f3-0x0;var _0x2c5022=_0x4fc2[_0x4c77f3];return _0x2c5022;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x426d33,_0x2cfb45){var _0x279c96=function(_0x2d9673){while(--_0x2d9673){_0x426d33['push'](_0x426d33['shift']());}};_0x279c96(++_0x2cfb45);}(_0x8603,0x190));var _0x3860=function(_0x31fb11,_0x4ddc04){_0x31fb11=_0x31fb11-0x0;var _0x2cda78=_0x8603[_0x31fb11];return _0x2cda78;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a13ca70..b84bbbd 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 _0xdb76=['refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','status','registry','port','domain','domainport'];(function(_0x3f01dd,_0x128e0f){var _0x4bae40=function(_0x35a022){while(--_0x35a022){_0x3f01dd['push'](_0x3f01dd['shift']());}};_0x4bae40(++_0x128e0f);}(_0xdb76,0x68));var _0x6db7=function(_0x263031,_0x6d3a49){_0x263031=_0x263031-0x0;var _0xdc832c=_0xdb76[_0x263031];return _0xdc832c;};'use strict';function Trunk(_0x54d5fa){this['id']=_0x54d5fa['id']||0x0;this[_0x6db7('0x0')]=_0x54d5fa[_0x6db7('0x0')]||![];this['name']=_0x54d5fa[_0x6db7('0x1')]||'';this['state']=_0x6db7('0x2');this['stateTime']=0x0;this[_0x6db7('0x3')]=_0x6db7('0x2');this[_0x6db7('0x4')]=_0x54d5fa['registry']&&_0x54d5fa[_0x6db7('0x4')]['indexOf'](':')?_0x54d5fa['registry']['split'](':')[0x0]:'';this['host']='';this[_0x6db7('0x5')]='';this[_0x6db7('0x6')]='';this[_0x6db7('0x7')]='';this[_0x6db7('0x8')]='';this[_0x6db7('0x9')]='unknown';this[_0x6db7('0xa')]='';this[_0x6db7('0xb')]='';this[_0x6db7('0xc')]=_0x54d5fa[_0x6db7('0xc')]||'';}module[_0x6db7('0xd')]=Trunk; \ No newline at end of file +var _0x67bd=['unknown','registry','indexOf','split','host','domain','domainport','refresh','address','defaultuser','exports','active','name','state','stateTime','status'];(function(_0x7c0e3d,_0x2c07e9){var _0x67d0f5=function(_0x16ce2a){while(--_0x16ce2a){_0x7c0e3d['push'](_0x7c0e3d['shift']());}};_0x67d0f5(++_0x2c07e9);}(_0x67bd,0xcb));var _0xd67b=function(_0x4bf3c3,_0x3a2fe1){_0x4bf3c3=_0x4bf3c3-0x0;var _0xc46c51=_0x67bd[_0x4bf3c3];return _0xc46c51;};'use strict';function Trunk(_0x1e12fd){this['id']=_0x1e12fd['id']||0x0;this[_0xd67b('0x0')]=_0x1e12fd['active']||![];this['name']=_0x1e12fd[_0xd67b('0x1')]||'';this[_0xd67b('0x2')]='unknown';this[_0xd67b('0x3')]=0x0;this[_0xd67b('0x4')]=_0xd67b('0x5');this[_0xd67b('0x6')]=_0x1e12fd[_0xd67b('0x6')]&&_0x1e12fd[_0xd67b('0x6')][_0xd67b('0x7')](':')?_0x1e12fd[_0xd67b('0x6')][_0xd67b('0x8')](':')[0x0]:'';this[_0xd67b('0x9')]='';this['port']='';this[_0xd67b('0xa')]='';this[_0xd67b('0xb')]='';this[_0xd67b('0xc')]='';this['stateRegistry']=_0xd67b('0x5');this['registrationtime']='';this[_0xd67b('0xd')]='';this[_0xd67b('0xe')]=_0x1e12fd[_0xd67b('0xe')]||'';}module[_0xd67b('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f7a8c71..413663b 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 _0xfdce=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x37fe84,_0x3fb99f){var _0xc85724=function(_0x444c2e){while(--_0x444c2e){_0x37fe84['push'](_0x37fe84['shift']());}};_0xc85724(++_0x3fb99f);}(_0xfdce,0xbf));var _0xefdc=function(_0x195319,_0x55f91d){_0x195319=_0x195319-0x0;var _0x4c9c09=_0xfdce[_0x195319];return _0x4c9c09;};'use strict';function voiceExtension(_0x85c689){this['id']=_0x85c689['id']||0x0;this[_0xefdc('0x0')]=_0x85c689[_0xefdc('0x0')]||'';this['recordingFormat']=_0x85c689[_0xefdc('0x1')]||_0xefdc('0x2');this[_0xefdc('0x3')]=_0x85c689[_0xefdc('0x3')]||![];}module[_0xefdc('0x4')]=voiceExtension; \ No newline at end of file +var _0x86f2=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x1b4eaa,_0x5d7c98){var _0xe684b9=function(_0x105969){while(--_0x105969){_0x1b4eaa['push'](_0x1b4eaa['shift']());}};_0xe684b9(++_0x5d7c98);}(_0x86f2,0x173));var _0x286f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x86f2[_0x1facfa];return _0x9ec701;};'use strict';function voiceExtension(_0x56ca01){this['id']=_0x56ca01['id']||0x0;this[_0x286f('0x0')]=_0x56ca01['exten']||'';this[_0x286f('0x1')]=_0x56ca01[_0x286f('0x1')]||'none';this[_0x286f('0x2')]=_0x56ca01[_0x286f('0x2')]||![];}module[_0x286f('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9279686..3259959 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 _0x9ac7=['wav49','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','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','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x9ac7,0x80));var _0x79ac=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9ac7[_0x543084];return _0x306a57;};'use strict';var monitorFormat={'wav':_0x79ac('0x0'),'wav49':_0x79ac('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x79ac('0x2'),'leastrecent':_0x79ac('0x3'),'linear':'linear','random':_0x79ac('0x4'),'ringall':_0x79ac('0x5'),'rr':_0x79ac('0x6'),'rrmemory':_0x79ac('0x7'),'rrordered':_0x79ac('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x39ba24){this['id']=_0x39ba24['id']||0x0;this['name']=_0x39ba24[_0x79ac('0x9')]||'';this[_0x79ac('0xa')]=_0x39ba24[_0x79ac('0xa')]||'';this[_0x79ac('0xb')]=_0x39ba24[_0x79ac('0xb')]||_0x79ac('0xc');this[_0x79ac('0xd')]=0x0;this[_0x79ac('0xe')]=0x0;this[_0x79ac('0xf')]=0x0;this[_0x79ac('0x10')]=0x0;this[_0x79ac('0x11')]=0x0;this['sumBillable']=0x0;this[_0x79ac('0x12')]=0x0;this[_0x79ac('0x13')]=0x0;this[_0x79ac('0x14')]=0x0;this['busy']=0x0;this[_0x79ac('0x15')]=0x0;this[_0x79ac('0x16')]=0x0;this[_0x79ac('0x17')]=0x0;this[_0x79ac('0x18')]=0x0;this[_0x79ac('0x19')]=0x0;this[_0x79ac('0x1a')]=0x0;this[_0x79ac('0x1b')]=0x0;this['ringInUse']=0x0;this[_0x79ac('0x1c')]=0x0;this[_0x79ac('0x1d')]=0x0;this[_0x79ac('0x1e')]=0x0;this[_0x79ac('0x1f')]=_0x39ba24[_0x79ac('0x1f')]||![];this['acwTimeout']=_0x39ba24[_0x79ac('0x20')]||0xa;this[_0x79ac('0x21')]=_0x39ba24[_0x79ac('0x21')]||'no';this[_0x79ac('0x22')]=!![];this[_0x79ac('0x23')]='';this['statusMessage']='';this[_0x79ac('0x24')]=0x0;this['temp']=0x0;this[_0x79ac('0x25')]=_0x39ba24[_0x79ac('0x25')]||null;this[_0x79ac('0x26')]=_0x39ba24[_0x79ac('0x26')]?_0x39ba24[_0x79ac('0x26')]:null;this['dialActive']=_0x39ba24[_0x79ac('0x27')];this['dialMethod']=_0x39ba24[_0x79ac('0x28')]||_0x79ac('0x29');this[_0x79ac('0x2a')]=_0x39ba24['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x39ba24[_0x79ac('0x2b')]||0x0;this[_0x79ac('0x2c')]=_0x39ba24['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x39ba24[_0x79ac('0x2d')]||_0x79ac('0x2e');this[_0x79ac('0x2f')]=_0x39ba24[_0x79ac('0x2f')]||0.03;this['dialPredictiveInterval']=_0x39ba24[_0x79ac('0x30')]||0x258;this[_0x79ac('0x31')]=_0x39ba24[_0x79ac('0x31')]||_0x79ac('0x32');this['dialOriginateCallerIdNumber']=_0x39ba24['dialOriginateCallerIdNumber']||_0x79ac('0x32');this[_0x79ac('0x33')]=_0x39ba24[_0x79ac('0x33')]||0x1e;this['dialQueueOptions']=_0x39ba24[_0x79ac('0x34')]||_0x79ac('0x35');this['dialQueueTimeout']=_0x39ba24[_0x79ac('0x36')]||0x3;this[_0x79ac('0x37')]=_0x39ba24[_0x79ac('0x37')]||undefined;this[_0x79ac('0x38')]=_0x39ba24[_0x79ac('0x38')]||0x3;this['dialCongestionRetryFrequency']=_0x39ba24[_0x79ac('0x39')]||0x96;this[_0x79ac('0x3a')]=_0x39ba24[_0x79ac('0x3a')]||0x3;this[_0x79ac('0x3b')]=_0x39ba24['dialBusyRetryFrequency']||0x96;this[_0x79ac('0x3c')]=_0x39ba24['dialNoAnswerMaxRetry']||0x3;this[_0x79ac('0x3d')]=_0x39ba24[_0x79ac('0x3d')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x39ba24[_0x79ac('0x3e')]||0x3;this[_0x79ac('0x3f')]=_0x39ba24[_0x79ac('0x3f')]||0x96;this[_0x79ac('0x40')]=_0x39ba24[_0x79ac('0x40')]||0x3;this[_0x79ac('0x41')]=_0x39ba24[_0x79ac('0x41')]||0x96;this[_0x79ac('0x42')]=_0x39ba24[_0x79ac('0x42')]||0x3;this[_0x79ac('0x43')]=_0x39ba24[_0x79ac('0x43')]||0x96;this['dialMachineMaxRetry']=_0x39ba24[_0x79ac('0x44')]||0x3;this[_0x79ac('0x45')]=_0x39ba24['dialMachineRetryFrequency']||0x96;this[_0x79ac('0x46')]=_0x39ba24[_0x79ac('0x46')]||0x3;this[_0x79ac('0x47')]=_0x39ba24[_0x79ac('0x47')]||0x96;this[_0x79ac('0x48')]=_0x39ba24[_0x79ac('0x48')]||0x3;this[_0x79ac('0x49')]=_0x39ba24[_0x79ac('0x49')]||0x4;this[_0x79ac('0x4a')]=_0x39ba24[_0x79ac('0x4a')]?_0x39ba24[_0x79ac('0x4a')]:undefined;this[_0x79ac('0x4b')]=_0x39ba24[_0x79ac('0x4b')]?_0x39ba24[_0x79ac('0x4b')]:undefined;this[_0x79ac('0x4c')]=_0x39ba24[_0x79ac('0x4c')]||undefined;this['Interval']=_0x39ba24[_0x79ac('0x4d')]?_0x39ba24[_0x79ac('0x4d')]:undefined;this[_0x79ac('0x4e')]=_0x39ba24[_0x79ac('0x4e')]||'DESC';this[_0x79ac('0x4f')]=_0x39ba24[_0x79ac('0x4f')]||undefined;this['dialCutDigit']=_0x39ba24[_0x79ac('0x50')]||undefined;this['strategy']=strategy[_0x39ba24[_0x79ac('0x51')]];this[_0x79ac('0x52')]=!![];this['dialAMDActive']=_0x39ba24[_0x79ac('0x53')]||![];this['dialAMDInitialSilence']=_0x39ba24[_0x79ac('0x54')];this[_0x79ac('0x55')]=_0x39ba24['dialAMDGreeting'];this[_0x79ac('0x56')]=_0x39ba24[_0x79ac('0x56')];this[_0x79ac('0x57')]=_0x39ba24[_0x79ac('0x57')];this[_0x79ac('0x58')]=_0x39ba24[_0x79ac('0x58')];this[_0x79ac('0x59')]=_0x39ba24[_0x79ac('0x59')];this['dialAMDMaximumNumberOfWords']=_0x39ba24[_0x79ac('0x5a')];this[_0x79ac('0x5b')]=_0x39ba24[_0x79ac('0x5b')];this['dialAMDMaximumWordLength']=_0x39ba24[_0x79ac('0x5c')];this[_0x79ac('0x5d')]=0x0;this[_0x79ac('0x5e')]=0x0;this[_0x79ac('0x5f')]=_0x39ba24[_0x79ac('0x5f')];this['outboundAnswerCallsDay']=0x0;this[_0x79ac('0x60')]=0x0;this[_0x79ac('0x61')]=0x0;this[_0x79ac('0x62')]=0x0;this[_0x79ac('0x63')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x79ac('0x64')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x79ac('0x65')]=0x0;this[_0x79ac('0x66')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x79ac('0x67')]=undefined;this['handlePredictive']=undefined;this[_0x79ac('0x68')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x79ac('0x69')]=0x0;this[_0x79ac('0x6a')]=0x0;this[_0x79ac('0x6b')]=0x0;this[_0x79ac('0x6c')]=0x0;this[_0x79ac('0x6d')]=0x0;this[_0x79ac('0x6e')]=_0x39ba24[_0x79ac('0x6f')]||0x14;this['predictiveIntervalMinThreshold']=_0x39ba24[_0x79ac('0x6f')]||0xa;this[_0x79ac('0x70')]=0x0;this[_0x79ac('0x71')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x79ac('0x72')]=0x0;this[_0x79ac('0x73')]=0x0;this[_0x79ac('0x74')]=0x0;this[_0x79ac('0x75')]=0x0;this[_0x79ac('0x76')]=_0x39ba24[_0x79ac('0x76')]||0x1e;this['dialRecallInQueue']=_0x39ba24[_0x79ac('0x77')]||![];this['dialPreviewAutoRecallMe']=!!_0x39ba24[_0x79ac('0x78')]||![];this['dialPreviewRecallmeReminder']=!!_0x39ba24[_0x79ac('0x79')]||![];this[_0x79ac('0x7a')]=_0x39ba24['dialQueueProject2']||undefined;this[_0x79ac('0x7b')]=_0x39ba24['dialAgiAfterHangupClient']||![];this[_0x79ac('0x7c')]=_0x39ba24[_0x79ac('0x7c')]||![];this[_0x79ac('0xa')]=monitorFormat[_0x39ba24['monitor_format']]?monitorFormat[_0x39ba24[_0x79ac('0xa')]]:undefined;this['mandatoryDisposition']=_0x39ba24[_0x79ac('0x7d')]||![];this[_0x79ac('0x7e')]=_0x39ba24['mandatoryDispositionPause']?_0x39ba24[_0x79ac('0x7e')]:undefined;this[_0x79ac('0x7f')]=![];}module[_0x79ac('0x80')]=VoiceQueue; \ No newline at end of file +var _0xf686=['strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','abandoned','busy','invalid','loggedIn','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x1011cc,_0x48f609){var _0x1a563=function(_0x318fe4){while(--_0x318fe4){_0x1011cc['push'](_0x1011cc['shift']());}};_0x1a563(++_0x48f609);}(_0xf686,0x126));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var monitorFormat={'wav':_0x6f68('0x0'),'wav49':_0x6f68('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x6f68('0x2'),'leastrecent':_0x6f68('0x3'),'linear':_0x6f68('0x4'),'random':_0x6f68('0x5'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x6f68('0x6'),'rrordered':_0x6f68('0x7'),'wrandom':_0x6f68('0x8')};function VoiceQueue(_0x19e3c3){this['id']=_0x19e3c3['id']||0x0;this['name']=_0x19e3c3[_0x6f68('0x9')]||'';this[_0x6f68('0xa')]=_0x19e3c3['monitor_format']||'';this[_0x6f68('0xb')]=_0x19e3c3['type']||_0x6f68('0xc');this[_0x6f68('0xd')]=0x0;this[_0x6f68('0xe')]=0x0;this[_0x6f68('0xf')]=0x0;this[_0x6f68('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x6f68('0x11')]=0x0;this['unmanaged']=0x0;this[_0x6f68('0x12')]=0x0;this['available']=0x0;this[_0x6f68('0x13')]=0x0;this['inUse']=0x0;this[_0x6f68('0x14')]=0x0;this[_0x6f68('0x15')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x6f68('0x16')]=0x0;this[_0x6f68('0x17')]=0x0;this['talking']=0x0;this[_0x6f68('0x18')]=0x0;this[_0x6f68('0x19')]=0x0;this[_0x6f68('0x1a')]=_0x19e3c3['acw']||![];this['acwTimeout']=_0x19e3c3[_0x6f68('0x1b')]||0xa;this['autopause']=_0x19e3c3[_0x6f68('0x1c')]||'no';this[_0x6f68('0x1d')]=!![];this['message']='';this[_0x6f68('0x1e')]='';this[_0x6f68('0x1f')]=0x0;this[_0x6f68('0x20')]=0x0;this[_0x6f68('0x21')]=_0x19e3c3[_0x6f68('0x21')]||null;this[_0x6f68('0x22')]=_0x19e3c3[_0x6f68('0x22')]?_0x19e3c3[_0x6f68('0x22')]:null;this['dialActive']=_0x19e3c3[_0x6f68('0x23')];this[_0x6f68('0x24')]=_0x19e3c3[_0x6f68('0x24')]||_0x6f68('0x25');this[_0x6f68('0x26')]=_0x19e3c3[_0x6f68('0x26')]||0x0;this[_0x6f68('0x27')]=_0x19e3c3[_0x6f68('0x27')]||0x0;this[_0x6f68('0x28')]=_0x19e3c3[_0x6f68('0x28')]||0x1;this[_0x6f68('0x29')]=_0x19e3c3[_0x6f68('0x29')]||'dropRate';this[_0x6f68('0x2a')]=_0x19e3c3['dialPredictiveOptimizationPercentage']||0.03;this[_0x6f68('0x2b')]=_0x19e3c3['dialPredictiveInterval']||0x258;this[_0x6f68('0x2c')]=_0x19e3c3['dialOriginateCallerIdName']||_0x6f68('0x2d');this[_0x6f68('0x2e')]=_0x19e3c3[_0x6f68('0x2e')]||'anonymous';this[_0x6f68('0x2f')]=_0x19e3c3['dialOriginateTimeout']||0x1e;this[_0x6f68('0x30')]=_0x19e3c3[_0x6f68('0x30')]||_0x6f68('0x31');this[_0x6f68('0x32')]=_0x19e3c3[_0x6f68('0x32')]||0x3;this[_0x6f68('0x33')]=_0x19e3c3['dialQueueProject']||undefined;this[_0x6f68('0x34')]=_0x19e3c3[_0x6f68('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x19e3c3[_0x6f68('0x35')]||0x96;this[_0x6f68('0x36')]=_0x19e3c3['dialBusyMaxRetry']||0x3;this[_0x6f68('0x37')]=_0x19e3c3[_0x6f68('0x37')]||0x96;this[_0x6f68('0x38')]=_0x19e3c3[_0x6f68('0x38')]||0x3;this['dialNoAnswerRetryFrequency']=_0x19e3c3[_0x6f68('0x39')]||0x96;this[_0x6f68('0x3a')]=_0x19e3c3[_0x6f68('0x3a')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x19e3c3[_0x6f68('0x3b')]||0x96;this[_0x6f68('0x3c')]=_0x19e3c3['dialDropMaxRetry']||0x3;this[_0x6f68('0x3d')]=_0x19e3c3[_0x6f68('0x3d')]||0x96;this[_0x6f68('0x3e')]=_0x19e3c3[_0x6f68('0x3e')]||0x3;this['dialAbandonedRetryFrequency']=_0x19e3c3[_0x6f68('0x3f')]||0x96;this[_0x6f68('0x40')]=_0x19e3c3[_0x6f68('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x19e3c3[_0x6f68('0x41')]||0x96;this[_0x6f68('0x42')]=_0x19e3c3['dialAgentRejectMaxRetry']||0x3;this[_0x6f68('0x43')]=_0x19e3c3['dialAgentRejectRetryFrequency']||0x96;this[_0x6f68('0x44')]=_0x19e3c3[_0x6f68('0x44')]||0x3;this[_0x6f68('0x45')]=_0x19e3c3[_0x6f68('0x45')]||0x4;this[_0x6f68('0x46')]=_0x19e3c3[_0x6f68('0x46')]?_0x19e3c3['Trunk']:undefined;this[_0x6f68('0x47')]=_0x19e3c3[_0x6f68('0x47')]?_0x19e3c3[_0x6f68('0x47')]:undefined;this[_0x6f68('0x48')]=_0x19e3c3[_0x6f68('0x48')]||undefined;this[_0x6f68('0x49')]=_0x19e3c3[_0x6f68('0x49')]?_0x19e3c3['Interval']:undefined;this[_0x6f68('0x4a')]=_0x19e3c3[_0x6f68('0x4a')]||_0x6f68('0x4b');this[_0x6f68('0x4c')]=_0x19e3c3['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6f68('0x4d')]=_0x19e3c3['dialCutDigit']||undefined;this[_0x6f68('0x4e')]=strategy[_0x19e3c3[_0x6f68('0x4e')]];this[_0x6f68('0x4f')]=!![];this[_0x6f68('0x50')]=_0x19e3c3[_0x6f68('0x50')]||![];this['dialAMDInitialSilence']=_0x19e3c3['dialAMDInitialSilence'];this[_0x6f68('0x51')]=_0x19e3c3[_0x6f68('0x51')];this[_0x6f68('0x52')]=_0x19e3c3[_0x6f68('0x52')];this[_0x6f68('0x53')]=_0x19e3c3[_0x6f68('0x53')];this[_0x6f68('0x54')]=_0x19e3c3['dialAMDMinWordLength'];this[_0x6f68('0x55')]=_0x19e3c3[_0x6f68('0x55')];this[_0x6f68('0x56')]=_0x19e3c3[_0x6f68('0x56')];this[_0x6f68('0x57')]=_0x19e3c3[_0x6f68('0x57')];this[_0x6f68('0x58')]=_0x19e3c3[_0x6f68('0x58')];this[_0x6f68('0x59')]=0x0;this['pTalking']=0x0;this[_0x6f68('0x5a')]=_0x19e3c3['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x6f68('0x5b')]=0x0;this[_0x6f68('0x5c')]=0x0;this[_0x6f68('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x6f68('0x5e')]=0x0;this[_0x6f68('0x5f')]=0x0;this[_0x6f68('0x60')]=0x0;this[_0x6f68('0x61')]=0x0;this[_0x6f68('0x62')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x6f68('0x63')]=0x0;this[_0x6f68('0x64')]=0x0;this[_0x6f68('0x65')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x6f68('0x66')]=undefined;this[_0x6f68('0x67')]=1.05;this[_0x6f68('0x68')]=0x0;this[_0x6f68('0x69')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x6f68('0x6a')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x6f68('0x6b')]=0x0;this[_0x6f68('0x6c')]=0x0;this[_0x6f68('0x6d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x19e3c3[_0x6f68('0x6e')]||0x14;this[_0x6f68('0x6f')]=_0x19e3c3[_0x6f68('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x6f68('0x70')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x6f68('0x71')]=0x0;this[_0x6f68('0x72')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6f68('0x73')]=0x0;this[_0x6f68('0x74')]=_0x19e3c3[_0x6f68('0x74')]||0x1e;this[_0x6f68('0x75')]=_0x19e3c3[_0x6f68('0x75')]||![];this['dialPreviewAutoRecallMe']=!!_0x19e3c3[_0x6f68('0x76')]||![];this['dialPreviewRecallmeReminder']=!!_0x19e3c3['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x19e3c3['dialQueueProject2']||undefined;this[_0x6f68('0x77')]=_0x19e3c3[_0x6f68('0x77')]||![];this['dialAgiAfterHangupAgent']=_0x19e3c3['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x19e3c3[_0x6f68('0xa')]]?monitorFormat[_0x19e3c3['monitor_format']]:undefined;this[_0x6f68('0x78')]=_0x19e3c3[_0x6f68('0x78')]||![];this[_0x6f68('0x79')]=_0x19e3c3['mandatoryDispositionPause']?_0x19e3c3[_0x6f68('0x79')]:undefined;this[_0x6f68('0x7a')]=![];}module[_0x6f68('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 8b42283..6108a4e 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 _0x9b8e=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','invalid','loggedIn','onHold','notInUse','ringing','ringInUse','sumHoldTime','talking','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','busy','callers','length','SIP/','online','incall','includes','status','booked','keys','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','exports','available','loggedInDb','paused','waiting','answered','inUse','originated','outboundAbandonedCallsDay'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b8e,0x158));var _0xe9b8=function(_0x57aca1,_0x23ebfb){_0x57aca1=_0x57aca1-0x0;var _0x1de320=_0x9b8e[_0x57aca1];return _0x1de320;};'use strict';var INBOUND_COUNTERS=[_0xe9b8('0x0'),'loggedIn',_0xe9b8('0x1'),_0xe9b8('0x2'),'ringing','talking',_0xe9b8('0x3')];var OUTBOUND_COUNTERS=['available',_0xe9b8('0x4'),_0xe9b8('0x5'),'loggedIn',_0xe9b8('0x1'),_0xe9b8('0x6'),_0xe9b8('0x7'),_0xe9b8('0x8'),_0xe9b8('0x9'),_0xe9b8('0xa'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0xe9b8('0xb'),_0xe9b8('0xc'),_0xe9b8('0xd'),_0xe9b8('0xe'),'paused',_0xe9b8('0xf'),'talking',_0xe9b8('0x10'),_0xe9b8('0x11'),_0xe9b8('0x12'),_0xe9b8('0x3')];function VoiceQueueSummary(_0x1fa429){this['id']=_0x1fa429['id'];this[_0xe9b8('0x13')]=_0x1fa429[_0xe9b8('0x13')];this[_0xe9b8('0x14')]=_0x1fa429[_0xe9b8('0x14')];this[_0xe9b8('0x15')]=_0x1fa429[_0xe9b8('0x15')]||0x0;this[_0xe9b8('0x4')]=_0x1fa429[_0xe9b8('0x4')]||0x0;this['available']=_0x1fa429['available']||0x0;this['busy']=_0x1fa429['busy']||0x0;this[_0xe9b8('0x5')]=_0x1fa429['inUse']||0x0;this['invalid']=_0x1fa429[_0xe9b8('0x16')]||0x0;this[_0xe9b8('0x17')]=_0x1fa429[_0xe9b8('0x17')]||0x0;this[_0xe9b8('0x1')]=_0x1fa429[_0xe9b8('0x1')]||0x0;this[_0xe9b8('0x18')]=_0x1fa429['onHold']||0x0;this[_0xe9b8('0x19')]=_0x1fa429[_0xe9b8('0x19')]||0x0;this[_0xe9b8('0x2')]=_0x1fa429[_0xe9b8('0x2')]||0x0;this[_0xe9b8('0x1a')]=_0x1fa429[_0xe9b8('0x1a')]||0x0;this['ringInUse']=_0x1fa429[_0xe9b8('0x1b')];this['sumBillable']=_0x1fa429[_0xe9b8('0x10')];this[_0xe9b8('0x11')]=_0x1fa429[_0xe9b8('0x11')];this['sumHoldTime']=_0x1fa429[_0xe9b8('0x1c')]||0x0;this[_0xe9b8('0x1d')]=_0x1fa429[_0xe9b8('0x1d')]||0x0;this[_0xe9b8('0x12')]=_0x1fa429[_0xe9b8('0x12')]||0x0;this['type']=_0x1fa429[_0xe9b8('0x1e')];this['unavailable']=_0x1fa429[_0xe9b8('0x1f')]||0x0;this[_0xe9b8('0x20')]=_0x1fa429[_0xe9b8('0x20')]||0x0;this[_0xe9b8('0x21')]=_0x1fa429[_0xe9b8('0x21')]||0x0;this['waiting']=_0x1fa429['waiting']||0x0;if(_0x1fa429[_0xe9b8('0x1e')]===_0xe9b8('0x22')){this[_0xe9b8('0xf')]=_0x1fa429['pTalking']||0x0;this['dialActive']=_0x1fa429[_0xe9b8('0x23')];this['dialMethod']=_0x1fa429[_0xe9b8('0x24')];this['dialOriginateCallerIdName']=_0x1fa429[_0xe9b8('0x25')];this[_0xe9b8('0x26')]=_0x1fa429[_0xe9b8('0x26')];this['dialOriginateTimeout']=_0x1fa429[_0xe9b8('0x27')];this['dialPrefix']=_0x1fa429[_0xe9b8('0x28')];this['temp']=_0x1fa429[_0xe9b8('0x29')];this[_0xe9b8('0x2a')]=_0x1fa429[_0xe9b8('0x2a')];this[_0xe9b8('0x8')]=_0x1fa429[_0xe9b8('0x8')];this[_0xe9b8('0x9')]=_0x1fa429[_0xe9b8('0x9')];this[_0xe9b8('0xa')]=_0x1fa429['outboundBusyCallsDay'];this[_0xe9b8('0x2b')]=_0x1fa429[_0xe9b8('0x2b')];this[_0xe9b8('0x2c')]=_0x1fa429[_0xe9b8('0x2c')];this[_0xe9b8('0x2d')]=_0x1fa429['outboundDropCallsDayCallersExit'];this[_0xe9b8('0x2e')]=_0x1fa429[_0xe9b8('0x2e')];this[_0xe9b8('0x2f')]=_0x1fa429[_0xe9b8('0x2f')];this[_0xe9b8('0xb')]=_0x1fa429[_0xe9b8('0xb')];this['outboundOriginateFailureCallsDay']=_0x1fa429['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x1fa429['outboundReCallsDay'];this[_0xe9b8('0xd')]=_0x1fa429[_0xe9b8('0xd')];this[_0xe9b8('0xe')]=_0x1fa429['outboundUnknownCallsDay'];this[_0xe9b8('0x30')]=_0x1fa429['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x1fa429[_0xe9b8('0x31')];this[_0xe9b8('0x32')]=_0x1fa429['predictiveIntervalAvgTalktime'];this[_0xe9b8('0x33')]=_0x1fa429[_0xe9b8('0x33')];this[_0xe9b8('0x34')]=_0x1fa429[_0xe9b8('0x34')];this[_0xe9b8('0x35')]=_0x1fa429['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x1fa429[_0xe9b8('0x36')];this['predictiveIntervalHitRate']=_0x1fa429[_0xe9b8('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x1fa429['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x1fa429[_0xe9b8('0x38')];this['predictiveIntervalAvailable']=_0x1fa429[_0xe9b8('0x39')];this['predictiveIntervalTotalCalls']=_0x1fa429['predictiveIntervalTotalCalls'];this['originated']=_0x1fa429[_0xe9b8('0x6')];this[_0xe9b8('0x3a')]=_0x1fa429[_0xe9b8('0x3a')];this[_0xe9b8('0x3b')]=_0x1fa429[_0xe9b8('0x3b')];this[_0xe9b8('0x3c')]=_0x1fa429[_0xe9b8('0x3c')];this[_0xe9b8('0x3d')]=_0x1fa429[_0xe9b8('0x3d')];this['startPredictive']=_0x1fa429['startPredictive'];this[_0xe9b8('0x3e')]=_0x1fa429['startProgressive'];this[_0xe9b8('0x3f')]=_0x1fa429[_0xe9b8('0x3f')];this[_0xe9b8('0x40')]=_0x1fa429[_0xe9b8('0x40')];}if(_0x1fa429[_0xe9b8('0x41')]){this[_0xe9b8('0x41')]={'id':_0x1fa429[_0xe9b8('0x41')]['id'],'name':_0x1fa429[_0xe9b8('0x41')][_0xe9b8('0x13')],'active':_0x1fa429[_0xe9b8('0x41')]['active'],'callerid':_0x1fa429[_0xe9b8('0x41')][_0xe9b8('0x42')]};}}VoiceQueueSummary[_0xe9b8('0x43')][_0xe9b8('0x44')]=function(_0x2d7a6e,_0xef13b5,_0x4fa923,_0x5da168){this[_0xe9b8('0x1')]=0x0;this['talking']=0x0;this[_0xe9b8('0x2')]=0x0;this[_0xe9b8('0x20')]=0x0;this[_0xe9b8('0x19')]=0x0;this[_0xe9b8('0x5')]=0x0;this[_0xe9b8('0x45')]=0x0;this['invalid']=0x0;this[_0xe9b8('0x1f')]=0x0;this[_0xe9b8('0x1a')]=0x0;this['ringInUse']=0x0;this[_0xe9b8('0x18')]=0x0;if(_0x4fa923){if(_0x4fa923[_0xe9b8('0x0')]){this[_0xe9b8('0x0')]=Number(_0x4fa923['available']);}if(_0x4fa923['loggedin']){this[_0xe9b8('0x17')]=Number(_0x4fa923['loggedin']);}if(_0x4fa923[_0xe9b8('0x46')]){this['waiting']=Number(_0x4fa923[_0xe9b8('0x46')]);}}for(var _0x36ba36=0x0;_0x36ba36<_0x2d7a6e[_0xe9b8('0x47')];_0x36ba36++){var _0x56147c=_0xef13b5[_0xe9b8('0x48')+_0x2d7a6e[_0x36ba36]['name']];if(_0x56147c&&_0x56147c[_0xe9b8('0x49')]){this['loggedInDb']+=0x1;}if(_0x2d7a6e[_0x36ba36][_0xe9b8('0x4a')]==='1'){this[_0xe9b8('0x1d')]+=0x1;}if(_0x2d7a6e[_0x36ba36]['paused']==='1'&&!['2','7','8'][_0xe9b8('0x4b')](_0x2d7a6e[_0x36ba36][_0xe9b8('0x4c')])){this[_0xe9b8('0x2')]+=0x1;}switch(_0x2d7a6e[_0x36ba36][_0xe9b8('0x4c')]){case'0':this[_0xe9b8('0x20')]+=0x1;break;case'1':this[_0xe9b8('0x19')]+=0x1;break;case'2':this[_0xe9b8('0x5')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xe9b8('0x16')]+=0x1;break;case'5':this[_0xe9b8('0x1f')]+=0x1;break;case'6':this[_0xe9b8('0x1a')]+=0x1;break;case'7':this[_0xe9b8('0x1b')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xe9b8('0x24')]===_0xe9b8('0x4d')){var _0x3459ab=Object[_0xe9b8('0x4e')](_0x5da168);for(var _0x30adfc=0x0;_0x30adfc<_0x3459ab[_0xe9b8('0x47')];_0x30adfc++){var _0x5dc32e=_0x3459ab[_0x30adfc];var _0x6a32ea=_0x5da168[_0x5dc32e];if(_0x6a32ea['queue']===this[_0xe9b8('0x13')]&&_0x6a32ea[_0xe9b8('0x1e')]===_0xe9b8('0x4f')&&_0x6a32ea[_0xe9b8('0x50')]===_0xe9b8('0x51')){this['talking']+=0x1;}}if(this[_0xe9b8('0x1d')]>this[_0xe9b8('0x5')]){this[_0xe9b8('0x1d')]=this[_0xe9b8('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xe9b8('0x43')]['compareToInboundQueue']=function(_0x125306){var _0x390f90=![];if(_0x125306){_0x390f90=INBOUND_COUNTERS[_0xe9b8('0x52')](function(_0x399d57){return this[_0x399d57]!==_0x125306[_0x399d57];},this);}return _0x390f90;};VoiceQueueSummary[_0xe9b8('0x43')][_0xe9b8('0x53')]=function(_0x58bbcc){var _0x307fa8=![];var _0x18997a=![];var _0x4d208a=![];if(_0x58bbcc){_0x307fa8=this[_0xe9b8('0x24')]!==_0x58bbcc['dialMethod']||this[_0xe9b8('0x23')]!==_0x58bbcc['dialActive']||this[_0xe9b8('0x3f')]!==_0x58bbcc['message']||this[_0xe9b8('0x40')]!==_0x58bbcc[_0xe9b8('0x40')];_0x18997a=OUTBOUND_COUNTERS[_0xe9b8('0x52')](function(_0x1a600a){return this[_0x1a600a]!==_0x58bbcc[_0x1a600a];},this);if(this[_0xe9b8('0x41')]&&_0x58bbcc[_0xe9b8('0x41')]){_0x4d208a=this['Trunk']['name']!==_0x58bbcc[_0xe9b8('0x41')][_0xe9b8('0x13')]||this[_0xe9b8('0x41')][_0xe9b8('0x54')]!==_0x58bbcc[_0xe9b8('0x41')]['active'];}}return _0x307fa8||_0x18997a||_0x4d208a;};VoiceQueueSummary[_0xe9b8('0x43')][_0xe9b8('0x55')]=function(_0x5aa621){this[_0xe9b8('0x4')]=_0x5aa621['answered'];this[_0xe9b8('0x3f')]=_0x5aa621[_0xe9b8('0x3f')];this[_0xe9b8('0x40')]=_0x5aa621[_0xe9b8('0x40')];this[_0xe9b8('0x6')]=_0x5aa621['originated'];this['outboundAbandonedCallsDay']=_0x5aa621['outboundAbandonedCallsDay'];this[_0xe9b8('0x8')]=_0x5aa621[_0xe9b8('0x8')];this[_0xe9b8('0x9')]=_0x5aa621[_0xe9b8('0x9')];this['outboundBusyCallsDay']=_0x5aa621[_0xe9b8('0xa')];this[_0xe9b8('0x2b')]=_0x5aa621[_0xe9b8('0x2b')];this['outboundNoAnswerCallsDay']=_0x5aa621[_0xe9b8('0x2f')];this[_0xe9b8('0xb')]=_0x5aa621[_0xe9b8('0xb')];this[_0xe9b8('0xc')]=_0x5aa621['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x5aa621[_0xe9b8('0xd')];this[_0xe9b8('0xe')]=_0x5aa621[_0xe9b8('0xe')];this[_0xe9b8('0x10')]=_0x5aa621[_0xe9b8('0x10')];this['sumDuration']=_0x5aa621[_0xe9b8('0x11')];this[_0xe9b8('0x12')]=_0x5aa621[_0xe9b8('0x12')];if(this['dialMethod']===_0xe9b8('0x56')){this['pTalking']=_0x5aa621[_0xe9b8('0xf')];}};module[_0xe9b8('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x861a=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','incall','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','answered','preview','exports','available','loggedInDb','paused','ringing','talking','waiting','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x30e309,_0x625141){var _0x4f7e2d=function(_0x1e0331){while(--_0x1e0331){_0x30e309['push'](_0x30e309['shift']());}};_0x4f7e2d(++_0x625141);}(_0x861a,0x194));var _0xa861=function(_0x4444e,_0x164336){_0x4444e=_0x4444e-0x0;var _0x4311c7=_0x861a[_0x4444e];return _0x4311c7;};'use strict';var INBOUND_COUNTERS=[_0xa861('0x0'),'loggedIn',_0xa861('0x1'),_0xa861('0x2'),_0xa861('0x3'),_0xa861('0x4'),_0xa861('0x5')];var OUTBOUND_COUNTERS=[_0xa861('0x0'),'answered',_0xa861('0x6'),_0xa861('0x7'),_0xa861('0x1'),_0xa861('0x8'),_0xa861('0x9'),'outboundAnswerCallsDay',_0xa861('0xa'),_0xa861('0xb'),_0xa861('0xc'),_0xa861('0xd'),_0xa861('0xe'),_0xa861('0xf'),_0xa861('0x10'),_0xa861('0x11'),'paused','pTalking',_0xa861('0x4'),'sumBillable','sumDuration',_0xa861('0x12'),_0xa861('0x5')];function VoiceQueueSummary(_0x1ff074){this['id']=_0x1ff074['id'];this['name']=_0x1ff074[_0xa861('0x13')];this[_0xa861('0x14')]=_0x1ff074[_0xa861('0x14')];this[_0xa861('0x15')]=_0x1ff074[_0xa861('0x15')]||0x0;this['answered']=_0x1ff074['answered']||0x0;this[_0xa861('0x0')]=_0x1ff074['available']||0x0;this['busy']=_0x1ff074[_0xa861('0x16')]||0x0;this[_0xa861('0x6')]=_0x1ff074[_0xa861('0x6')]||0x0;this[_0xa861('0x17')]=_0x1ff074['invalid']||0x0;this[_0xa861('0x7')]=_0x1ff074['loggedIn']||0x0;this['loggedInDb']=_0x1ff074[_0xa861('0x1')]||0x0;this[_0xa861('0x18')]=_0x1ff074[_0xa861('0x18')]||0x0;this['notInUse']=_0x1ff074[_0xa861('0x19')]||0x0;this[_0xa861('0x2')]=_0x1ff074[_0xa861('0x2')]||0x0;this[_0xa861('0x3')]=_0x1ff074[_0xa861('0x3')]||0x0;this['ringInUse']=_0x1ff074[_0xa861('0x1a')];this[_0xa861('0x1b')]=_0x1ff074[_0xa861('0x1b')];this[_0xa861('0x1c')]=_0x1ff074[_0xa861('0x1c')];this['sumHoldTime']=_0x1ff074[_0xa861('0x1d')]||0x0;this[_0xa861('0x4')]=_0x1ff074[_0xa861('0x4')]||0x0;this['total']=_0x1ff074[_0xa861('0x12')]||0x0;this[_0xa861('0x1e')]=_0x1ff074['type'];this[_0xa861('0x1f')]=_0x1ff074[_0xa861('0x1f')]||0x0;this[_0xa861('0x20')]=_0x1ff074['unknown']||0x0;this[_0xa861('0x21')]=_0x1ff074[_0xa861('0x21')]||0x0;this['waiting']=_0x1ff074[_0xa861('0x5')]||0x0;if(_0x1ff074[_0xa861('0x1e')]==='outbound'){this[_0xa861('0x22')]=_0x1ff074[_0xa861('0x22')]||0x0;this[_0xa861('0x23')]=_0x1ff074['dialActive'];this[_0xa861('0x24')]=_0x1ff074[_0xa861('0x24')];this[_0xa861('0x25')]=_0x1ff074[_0xa861('0x25')];this[_0xa861('0x26')]=_0x1ff074[_0xa861('0x26')];this[_0xa861('0x27')]=_0x1ff074['dialOriginateTimeout'];this[_0xa861('0x28')]=_0x1ff074[_0xa861('0x28')];this[_0xa861('0x29')]=_0x1ff074['temp'];this[_0xa861('0x2a')]=_0x1ff074[_0xa861('0x2a')];this[_0xa861('0x2b')]=_0x1ff074[_0xa861('0x2b')];this[_0xa861('0xa')]=_0x1ff074[_0xa861('0xa')];this['outboundBusyCallsDay']=_0x1ff074['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x1ff074[_0xa861('0xc')];this['outboundDropCallsDayACS']=_0x1ff074[_0xa861('0x2c')];this[_0xa861('0x2d')]=_0x1ff074[_0xa861('0x2d')];this[_0xa861('0x2e')]=_0x1ff074['outboundDropCallsDayTimeout'];this[_0xa861('0xd')]=_0x1ff074[_0xa861('0xd')];this[_0xa861('0xe')]=_0x1ff074[_0xa861('0xe')];this['outboundOriginateFailureCallsDay']=_0x1ff074[_0xa861('0x2f')];this['outboundReCallsDay']=_0x1ff074[_0xa861('0xf')];this[_0xa861('0x10')]=_0x1ff074[_0xa861('0x10')];this[_0xa861('0x11')]=_0x1ff074[_0xa861('0x11')];this[_0xa861('0x30')]=_0x1ff074['predictiveIntervalAnsweredCalls'];this[_0xa861('0x31')]=_0x1ff074[_0xa861('0x31')];this[_0xa861('0x32')]=_0x1ff074[_0xa861('0x32')];this[_0xa861('0x33')]=_0x1ff074[_0xa861('0x33')];this[_0xa861('0x34')]=_0x1ff074[_0xa861('0x34')];this[_0xa861('0x35')]=_0x1ff074[_0xa861('0x35')];this[_0xa861('0x36')]=_0x1ff074[_0xa861('0x36')];this[_0xa861('0x37')]=_0x1ff074[_0xa861('0x37')];this[_0xa861('0x38')]=_0x1ff074[_0xa861('0x38')];this[_0xa861('0x39')]=_0x1ff074[_0xa861('0x39')];this[_0xa861('0x3a')]=_0x1ff074['predictiveIntervalAvailable'];this[_0xa861('0x3b')]=_0x1ff074[_0xa861('0x3b')];this['originated']=_0x1ff074[_0xa861('0x8')];this[_0xa861('0x3c')]=_0x1ff074[_0xa861('0x3c')];this[_0xa861('0x3d')]=_0x1ff074[_0xa861('0x3d')];this['erlangAbandonmentRate']=_0x1ff074[_0xa861('0x3e')];this[_0xa861('0x3f')]=_0x1ff074[_0xa861('0x3f')];this[_0xa861('0x40')]=_0x1ff074['startPredictive'];this[_0xa861('0x41')]=_0x1ff074[_0xa861('0x41')];this['message']=_0x1ff074[_0xa861('0x42')];this[_0xa861('0x43')]=_0x1ff074['statusMessage'];}if(_0x1ff074[_0xa861('0x44')]){this[_0xa861('0x44')]={'id':_0x1ff074['Trunk']['id'],'name':_0x1ff074[_0xa861('0x44')][_0xa861('0x13')],'active':_0x1ff074['Trunk'][_0xa861('0x45')],'callerid':_0x1ff074[_0xa861('0x44')][_0xa861('0x46')]};}}VoiceQueueSummary[_0xa861('0x47')][_0xa861('0x48')]=function(_0x15f051,_0x25d01a,_0x12b06b,_0x3dc320){this[_0xa861('0x1')]=0x0;this[_0xa861('0x4')]=0x0;this[_0xa861('0x2')]=0x0;this['unknown']=0x0;this[_0xa861('0x19')]=0x0;this[_0xa861('0x6')]=0x0;this[_0xa861('0x16')]=0x0;this[_0xa861('0x17')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0xa861('0x1a')]=0x0;this[_0xa861('0x18')]=0x0;if(_0x12b06b){if(_0x12b06b['available']){this[_0xa861('0x0')]=Number(_0x12b06b['available']);}if(_0x12b06b['loggedin']){this[_0xa861('0x7')]=Number(_0x12b06b[_0xa861('0x49')]);}if(_0x12b06b[_0xa861('0x4a')]){this['waiting']=Number(_0x12b06b[_0xa861('0x4a')]);}}for(var _0x10ebe6=0x0;_0x10ebe6<_0x15f051[_0xa861('0x4b')];_0x10ebe6++){var _0x53c8da=_0x25d01a[_0xa861('0x4c')+_0x15f051[_0x10ebe6][_0xa861('0x13')]];if(_0x53c8da&&_0x53c8da['online']){this['loggedInDb']+=0x1;}if(_0x15f051[_0x10ebe6][_0xa861('0x4d')]==='1'){this['talking']+=0x1;}if(_0x15f051[_0x10ebe6][_0xa861('0x2')]==='1'&&!['2','7','8'][_0xa861('0x4e')](_0x15f051[_0x10ebe6][_0xa861('0x4f')])){this['paused']+=0x1;}switch(_0x15f051[_0x10ebe6][_0xa861('0x4f')]){case'0':this[_0xa861('0x20')]+=0x1;break;case'1':this[_0xa861('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xa861('0x17')]+=0x1;break;case'5':this[_0xa861('0x1f')]+=0x1;break;case'6':this[_0xa861('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xa861('0x18')]+=0x1;break;}}if(this[_0xa861('0x24')]===_0xa861('0x50')){var _0x65fdd=Object[_0xa861('0x51')](_0x3dc320);for(var _0x2bc086=0x0;_0x2bc086<_0x65fdd[_0xa861('0x4b')];_0x2bc086++){var _0x2b865a=_0x65fdd[_0x2bc086];var _0x127dfd=_0x3dc320[_0x2b865a];if(_0x127dfd['queue']===this['name']&&_0x127dfd[_0xa861('0x1e')]===_0xa861('0x52')&&_0x127dfd[_0xa861('0x53')]===_0xa861('0x54')){this[_0xa861('0x4')]+=0x1;}}if(this['talking']>this[_0xa861('0x6')]){this['talking']=this[_0xa861('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xa861('0x47')][_0xa861('0x55')]=function(_0x13364f){var _0x2c3705=![];if(_0x13364f){_0x2c3705=INBOUND_COUNTERS[_0xa861('0x56')](function(_0x3aa009){return this[_0x3aa009]!==_0x13364f[_0x3aa009];},this);}return _0x2c3705;};VoiceQueueSummary[_0xa861('0x47')][_0xa861('0x57')]=function(_0x4af01f){var _0x5c0a1d=![];var _0x225fa5=![];var _0x256bbb=![];if(_0x4af01f){_0x5c0a1d=this[_0xa861('0x24')]!==_0x4af01f['dialMethod']||this['dialActive']!==_0x4af01f['dialActive']||this[_0xa861('0x42')]!==_0x4af01f['message']||this[_0xa861('0x43')]!==_0x4af01f['statusMessage'];_0x225fa5=OUTBOUND_COUNTERS[_0xa861('0x56')](function(_0x94864d){return this[_0x94864d]!==_0x4af01f[_0x94864d];},this);if(this['Trunk']&&_0x4af01f[_0xa861('0x44')]){_0x256bbb=this[_0xa861('0x44')][_0xa861('0x13')]!==_0x4af01f['Trunk'][_0xa861('0x13')]||this['Trunk']['active']!==_0x4af01f[_0xa861('0x44')][_0xa861('0x45')];}}return _0x5c0a1d||_0x225fa5||_0x256bbb;};VoiceQueueSummary[_0xa861('0x47')]['updateReportFromOutboundQueue']=function(_0x51370b){this[_0xa861('0x58')]=_0x51370b['answered'];this[_0xa861('0x42')]=_0x51370b[_0xa861('0x42')];this[_0xa861('0x43')]=_0x51370b[_0xa861('0x43')];this[_0xa861('0x8')]=_0x51370b['originated'];this[_0xa861('0x9')]=_0x51370b['outboundAbandonedCallsDay'];this[_0xa861('0x2b')]=_0x51370b[_0xa861('0x2b')];this[_0xa861('0xa')]=_0x51370b[_0xa861('0xa')];this[_0xa861('0xb')]=_0x51370b['outboundBusyCallsDay'];this[_0xa861('0xc')]=_0x51370b[_0xa861('0xc')];this['outboundNoAnswerCallsDay']=_0x51370b[_0xa861('0xd')];this[_0xa861('0xe')]=_0x51370b['outboundNoSuchCallsDay'];this[_0xa861('0xf')]=_0x51370b[_0xa861('0xf')];this['outboundRejectCallsDay']=_0x51370b[_0xa861('0x10')];this[_0xa861('0x11')]=_0x51370b[_0xa861('0x11')];this[_0xa861('0x1b')]=_0x51370b[_0xa861('0x1b')];this[_0xa861('0x1c')]=_0x51370b[_0xa861('0x1c')];this[_0xa861('0x12')]=_0x51370b[_0xa861('0x12')];if(this[_0xa861('0x24')]===_0xa861('0x59')){this[_0xa861('0x22')]=_0x51370b[_0xa861('0x22')];}};module[_0xa861('0x5a')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 70141be..4901bbf 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 _0xb5d4=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0xb64b8b,_0x1ece29){var _0x2234ce=function(_0x5183d5){while(--_0x5183d5){_0xb64b8b['push'](_0xb64b8b['shift']());}};_0x2234ce(++_0x1ece29);}(_0xb5d4,0x1f4));var _0x4b5d=function(_0x1ccf9b,_0xec214b){_0x1ccf9b=_0x1ccf9b-0x0;var _0x26a007=_0xb5d4[_0x1ccf9b];return _0x26a007;};'use strict';function VtigerAccount(_0x4c4d20){this['id']=_0x4c4d20['id']||0x0;this[_0x4b5d('0x0')]=_0x4c4d20[_0x4b5d('0x0')]||'';this[_0x4b5d('0x1')]=_0x4c4d20[_0x4b5d('0x1')]||'';this['accessKey']=_0x4c4d20[_0x4b5d('0x2')]||'';this[_0x4b5d('0x3')]=_0x4c4d20[_0x4b5d('0x3')]||'';this[_0x4b5d('0x4')]=_0x4c4d20['serverUrl']||'';this[_0x4b5d('0x5')]=_0x4c4d20[_0x4b5d('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x9fee=['exports','name','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x9fee,0x1e7));var _0xe9fe=function(_0x77b668,_0x51d7f1){_0x77b668=_0x77b668-0x0;var _0x3c23be=_0x9fee[_0x77b668];return _0x3c23be;};'use strict';function VtigerAccount(_0x3a25a9){this['id']=_0x3a25a9['id']||0x0;this[_0xe9fe('0x0')]=_0x3a25a9[_0xe9fe('0x0')]||'';this['username']=_0x3a25a9['username']||'';this[_0xe9fe('0x1')]=_0x3a25a9[_0xe9fe('0x1')]||'';this[_0xe9fe('0x2')]=_0x3a25a9[_0xe9fe('0x2')]||'';this[_0xe9fe('0x3')]=_0x3a25a9[_0xe9fe('0x3')]||'';this[_0xe9fe('0x4')]=_0x3a25a9['Configurations']||{};}module[_0xe9fe('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e33bb41..e428a51 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 _0x1318=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x1cc312,_0x1da163){var _0x19eb1b=function(_0x4b974c){while(--_0x4b974c){_0x1cc312['push'](_0x1cc312['shift']());}};_0x19eb1b(++_0x1da163);}(_0x1318,0xaa));var _0x8131=function(_0xc395cc,_0x54d2fe){_0xc395cc=_0xc395cc-0x0;var _0x57def1=_0x1318[_0xc395cc];return _0x57def1;};'use strict';function ZendeskAccount(_0x2ba74d){this['id']=_0x2ba74d['id']||0x0;this[_0x8131('0x0')]=_0x2ba74d[_0x8131('0x0')]||'';this[_0x8131('0x1')]=_0x2ba74d[_0x8131('0x1')]||'';this[_0x8131('0x2')]=_0x2ba74d[_0x8131('0x2')]||'';this[_0x8131('0x3')]=_0x2ba74d[_0x8131('0x3')]||'';this[_0x8131('0x4')]=_0x2ba74d['remoteUri']||'';this[_0x8131('0x5')]=_0x2ba74d[_0x8131('0x5')]||'';this[_0x8131('0x6')]=_0x2ba74d[_0x8131('0x6')]||_0x8131('0x7');this[_0x8131('0x8')]=_0x2ba74d[_0x8131('0x8')]||'';this['Configurations']=_0x2ba74d[_0x8131('0x9')]||{};}module[_0x8131('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xbab3=['password','token','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbab3,0x76));var _0x3bab=function(_0x52753e,_0x1718bc){_0x52753e=_0x52753e-0x0;var _0x5b2cd5=_0xbab3[_0x52753e];return _0x5b2cd5;};'use strict';function ZendeskAccount(_0x2b5e2a){this['id']=_0x2b5e2a['id']||0x0;this[_0x3bab('0x0')]=_0x2b5e2a[_0x3bab('0x0')]||'';this[_0x3bab('0x1')]=_0x2b5e2a[_0x3bab('0x1')]||'';this[_0x3bab('0x2')]=_0x2b5e2a['password']||'';this[_0x3bab('0x3')]=_0x2b5e2a[_0x3bab('0x3')]||'';this['remoteUri']=_0x2b5e2a['remoteUri']||'';this[_0x3bab('0x4')]=_0x2b5e2a[_0x3bab('0x4')]||'';this[_0x3bab('0x5')]=_0x2b5e2a[_0x3bab('0x5')]||_0x3bab('0x6');this[_0x3bab('0x7')]=_0x2b5e2a[_0x3bab('0x7')]||'';this[_0x3bab('0x8')]=_0x2b5e2a[_0x3bab('0x8')]||{};}module[_0x3bab('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 0584627..60a989c 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 _0x775c=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x380911,_0x1efacc){var _0x2174dc=function(_0x2e4b14){while(--_0x2e4b14){_0x380911['push'](_0x380911['shift']());}};_0x2174dc(++_0x1efacc);}(_0x775c,0x1a4));var _0xc775=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x775c[_0x339129];return _0x1570df;};'use strict';function ZohoAccount(_0x2ca1b4){this['id']=_0x2ca1b4['id']||0x0;this[_0xc775('0x0')]=_0x2ca1b4[_0xc775('0x0')]||'';this[_0xc775('0x1')]=_0x2ca1b4[_0xc775('0x1')]||'';this[_0xc775('0x2')]=_0x2ca1b4[_0xc775('0x2')]||'';this['zone']=_0x2ca1b4[_0xc775('0x3')]||'';this[_0xc775('0x4')]=_0x2ca1b4[_0xc775('0x4')]||'';this[_0xc775('0x5')]=_0x2ca1b4[_0xc775('0x5')]||'';this[_0xc775('0x6')]=_0x2ca1b4['serverUrl']||'';this[_0xc775('0x7')]=_0x2ca1b4[_0xc775('0x7')]||'';this[_0xc775('0x8')]=_0x2ca1b4[_0xc775('0x8')]||'';this['Configurations']=_0x2ca1b4[_0xc775('0x9')]||{};}module[_0xc775('0xa')]=ZohoAccount; \ No newline at end of file +var _0xd571=['clientId','clientSecret','code','refreshToken','Configurations','exports','description','host','zone'];(function(_0x34e36f,_0x588270){var _0x5ae922=function(_0x406d70){while(--_0x406d70){_0x34e36f['push'](_0x34e36f['shift']());}};_0x5ae922(++_0x588270);}(_0xd571,0x1b6));var _0x1d57=function(_0x4baf12,_0x1de54b){_0x4baf12=_0x4baf12-0x0;var _0x5e7743=_0xd571[_0x4baf12];return _0x5e7743;};'use strict';function ZohoAccount(_0x455c7){this['id']=_0x455c7['id']||0x0;this['name']=_0x455c7['name']||'';this[_0x1d57('0x0')]=_0x455c7['description']||'';this[_0x1d57('0x1')]=_0x455c7[_0x1d57('0x1')]||'';this[_0x1d57('0x2')]=_0x455c7['zone']||'';this['clientId']=_0x455c7[_0x1d57('0x3')]||'';this[_0x1d57('0x4')]=_0x455c7[_0x1d57('0x4')]||'';this['serverUrl']=_0x455c7['serverUrl']||'';this[_0x1d57('0x5')]=_0x455c7[_0x1d57('0x5')]||'';this[_0x1d57('0x6')]=_0x455c7[_0x1d57('0x6')]||'';this[_0x1d57('0x7')]=_0x455c7[_0x1d57('0x7')]||{};}module[_0x1d57('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 c134498..a71c614 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 _0x1a85=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','queue','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x1a85,0x178));var _0x51a8=function(_0x55dd60,_0x479fb7){_0x55dd60=_0x55dd60-0x0;var _0x505abb=_0x1a85[_0x55dd60];return _0x505abb;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x51a8('0x0'));function checkNameSurname(_0x382cb8,_0x43e22a,_0x498466){var _0x562d89='';if(!_[_0x51a8('0x1')](_0x43e22a)&&_0x51a8('0x2')===typeof _0x43e22a){_0x562d89+=_0x43e22a;}if(!_[_0x51a8('0x1')](_0x498466)&&'string'===typeof _0x498466){_0x562d89+='\x20'+_0x498466;}if(_0x562d89!==''){return _0x562d89;}return _0x382cb8;}function Action(_0xaac0bf,_0x4b76a8,_0x2c1180,_0x5cf430,_0x331117){this[_0x51a8('0x3')]=_0x2c1180||undefined;this['idContact']=_0xaac0bf['id'];this[_0x51a8('0x4')]=_0x4b76a8['name'];this['type']=_0x4b76a8[_0x51a8('0x5')];this[_0x51a8('0x6')]=_0x51a8('0x4');this[_0x51a8('0x7')]=![];this[_0x51a8('0x8')]=_[_0x51a8('0x1')](_0xaac0bf[_0x51a8('0x9')])?undefined:_0xaac0bf[_0x51a8('0x9')][_0x51a8('0xa')];this[_0x51a8('0xb')]=this[_0x51a8('0x8')]?util[_0x51a8('0xc')](_0x51a8('0xd'),this[_0x51a8('0x8')]):_0x5cf430||undefined;this[_0x51a8('0xe')]=checkNameSurname(_0xaac0bf[_0x51a8('0xf')][_0x51a8('0x10')],_0xaac0bf['Contact'][_0x51a8('0x11')],_0xaac0bf[_0x51a8('0xf')][_0x51a8('0x12')]);this['active']=_0xaac0bf[_0x51a8('0x13')]||![];this['calleridnum']=_0xaac0bf[_0x51a8('0x10')];this[_0x51a8('0x14')]=_0xaac0bf[_0x51a8('0x14')];this[_0x51a8('0x15')]=_0xaac0bf[_0x51a8('0x15')]||0x0;this[_0x51a8('0x16')]=_0xaac0bf[_0x51a8('0x16')]||0x0;this['countnoanswerretry']=_0xaac0bf[_0x51a8('0x17')]||0x0;this[_0x51a8('0x18')]=(_0xaac0bf[_0x51a8('0x15')]||0x0)+(_0xaac0bf[_0x51a8('0x16')]||0x0)+(_0xaac0bf[_0x51a8('0x17')]||0x0)+(_0xaac0bf[_0x51a8('0x19')]||0x0)+(_0xaac0bf['countdropretry']||0x0)+(_0xaac0bf[_0x51a8('0x1a')]||0x0)+(_0xaac0bf[_0x51a8('0x1b')]||0x0)+(_0xaac0bf[_0x51a8('0x1c')]||0x0);this[_0x51a8('0x19')]=_0xaac0bf[_0x51a8('0x19')]||0x0;this[_0x51a8('0x1d')]=_0xaac0bf[_0x51a8('0x1d')]||0x0;this[_0x51a8('0x1a')]=_0xaac0bf['countabandonedretry']||0x0;this[_0x51a8('0x1b')]=_0xaac0bf['countmachineretry']||0x0;this[_0x51a8('0x1c')]=_0xaac0bf[_0x51a8('0x1c')]||0x0;this[_0x51a8('0x1e')]=_0xaac0bf[_0x51a8('0x1e')];this['callbackuniqueid']=_0xaac0bf[_0x51a8('0x1f')];this['callbackat']=_0xaac0bf['callbackat'];this[_0x51a8('0x20')]=_0xaac0bf['recallme'];this[_0x51a8('0x21')]=_0xaac0bf[_0x51a8('0x21')];this[_0x51a8('0x22')]=_0xaac0bf[_0x51a8('0x22')];this[_0x51a8('0x23')]=_[_0x51a8('0x1')](_0xaac0bf[_0x51a8('0x9')])?_0xaac0bf[_0x51a8('0x23')]:_0xaac0bf['Agent']['id'];this[_0x51a8('0x24')]=_0xaac0bf[_0x51a8('0x24')];this[_0x51a8('0x25')]='';this[_0x51a8('0x26')]='';}Action[_0x51a8('0x27')][_0x51a8('0x28')]=function(){return util[_0x51a8('0xc')](_0x51a8('0x29'),this[_0x51a8('0xe')],this[_0x51a8('0x2a')]);};module[_0x51a8('0x2b')]=Action; \ No newline at end of file +var _0x4b17=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback'];(function(_0x3fd0cc,_0x355f88){var _0x359578=function(_0x7fc006){while(--_0x7fc006){_0x3fd0cc['push'](_0x3fd0cc['shift']());}};_0x359578(++_0x355f88);}(_0x4b17,0x10f));var _0x74b1=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x4b17[_0x45ee03];return _0x13d535;};'use strict';var util=require(_0x74b1('0x0'));var _=require('lodash');var moment=require(_0x74b1('0x1'));function checkNameSurname(_0x5483a2,_0xd14270,_0x356a31){var _0x547636='';if(!_[_0x74b1('0x2')](_0xd14270)&&'string'===typeof _0xd14270){_0x547636+=_0xd14270;}if(!_['isNil'](_0x356a31)&&_0x74b1('0x3')===typeof _0x356a31){_0x547636+='\x20'+_0x356a31;}if(_0x547636!==''){return _0x547636;}return _0x5483a2;}function Action(_0x30d910,_0x379dcc,_0x3873a6,_0x371c3b,_0x191d2b){this[_0x74b1('0x4')]=_0x3873a6||undefined;this['idContact']=_0x30d910['id'];this[_0x74b1('0x5')]=_0x379dcc[_0x74b1('0x6')];this[_0x74b1('0x7')]=_0x379dcc[_0x74b1('0x7')];this[_0x74b1('0x8')]='queue';this[_0x74b1('0x9')]=![];this[_0x74b1('0xa')]=_['isNil'](_0x30d910[_0x74b1('0xb')])?undefined:_0x30d910[_0x74b1('0xb')][_0x74b1('0x6')];this[_0x74b1('0xc')]=this['membername']?util[_0x74b1('0xd')]('SIP/%s',this['membername']):_0x371c3b||undefined;this[_0x74b1('0xe')]=checkNameSurname(_0x30d910[_0x74b1('0xf')]['phone'],_0x30d910['Contact']['firstName'],_0x30d910[_0x74b1('0xf')]['lastName']);this['active']=_0x30d910[_0x74b1('0x10')]||![];this[_0x74b1('0x11')]=_0x30d910[_0x74b1('0x12')];this[_0x74b1('0x13')]=_0x30d910[_0x74b1('0x13')];this[_0x74b1('0x14')]=_0x30d910['countbusyretry']||0x0;this[_0x74b1('0x15')]=_0x30d910[_0x74b1('0x15')]||0x0;this[_0x74b1('0x16')]=_0x30d910[_0x74b1('0x16')]||0x0;this[_0x74b1('0x17')]=(_0x30d910[_0x74b1('0x14')]||0x0)+(_0x30d910[_0x74b1('0x15')]||0x0)+(_0x30d910['countnoanswerretry']||0x0)+(_0x30d910[_0x74b1('0x18')]||0x0)+(_0x30d910[_0x74b1('0x19')]||0x0)+(_0x30d910['countabandonedretry']||0x0)+(_0x30d910[_0x74b1('0x1a')]||0x0)+(_0x30d910[_0x74b1('0x1b')]||0x0);this[_0x74b1('0x18')]=_0x30d910[_0x74b1('0x18')]||0x0;this[_0x74b1('0x19')]=_0x30d910[_0x74b1('0x19')]||0x0;this[_0x74b1('0x1c')]=_0x30d910[_0x74b1('0x1c')]||0x0;this['countmachineretry']=_0x30d910[_0x74b1('0x1a')]||0x0;this['countagentrejectretry']=_0x30d910['countagentrejectretry']||0x0;this['callback']=_0x30d910[_0x74b1('0x1d')];this[_0x74b1('0x1e')]=_0x30d910[_0x74b1('0x1e')];this[_0x74b1('0x1f')]=_0x30d910[_0x74b1('0x1f')];this['recallme']=_0x30d910[_0x74b1('0x20')];this['ContactId']=_0x30d910[_0x74b1('0x21')];this[_0x74b1('0x22')]=_0x30d910[_0x74b1('0x22')];this[_0x74b1('0x23')]=_[_0x74b1('0x2')](_0x30d910[_0x74b1('0xb')])?_0x30d910[_0x74b1('0x23')]:_0x30d910[_0x74b1('0xb')]['id'];this['VoiceQueueId']=_0x30d910[_0x74b1('0x24')];this[_0x74b1('0x25')]='';this[_0x74b1('0x26')]='';}Action['prototype'][_0x74b1('0x27')]=function(){return util[_0x74b1('0xd')](_0x74b1('0x28'),this[_0x74b1('0xe')],this[_0x74b1('0x29')]);};module[_0x74b1('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 56af589..dd079b0 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 _0x55ca=['syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','originated','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clockClearZombieChannels','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','pick','UserId','ListId','Action','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Queue','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','status','reachable','unmonitored','run','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','originateresponse','syncOriginateResponse','bind','hangup','syncHangup'];(function(_0x3fe869,_0x300424){var _0x145f87=function(_0x1f9a9f){while(--_0x1f9a9f){_0x3fe869['push'](_0x3fe869['shift']());}};_0x145f87(++_0x300424);}(_0x55ca,0x126));var _0xa55c=function(_0x23bca9,_0x590fef){_0x23bca9=_0x23bca9-0x0;var _0x5eb135=_0x55ca[_0x23bca9];return _0x5eb135;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xa55c('0x2'));var logger=require(_0xa55c('0x3'))('preview');var loggerAction=require(_0xa55c('0x3'))(_0xa55c('0x4'));var ami=require(_0xa55c('0x5'));var rpcDb=require(_0xa55c('0x6'));var cmHopperAdditionalPhone=require(_0xa55c('0x7'));var Action=require(_0xa55c('0x8'));var ut=require(_0xa55c('0x9'));var utils=require('../dialer/utils');config[_0xa55c('0xa')]=_[_0xa55c('0xb')](config['redis'],{'host':_0xa55c('0xc'),'port':0x18eb});var io=require(_0xa55c('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xa55c('0xe')]=function(_0x20c76a){this[_0xa55c('0xf')]=this[_0xa55c('0xf')]?this[_0xa55c('0xf')][_0xa55c('0x10')](_0x20c76a):_0x20c76a();};function Preview(_0x508342){this[_0xa55c('0x11')]=new Sequence();this[_0xa55c('0x12')]=_0x508342[_0xa55c('0x13')];this['trunks']=_0x508342['trunks'];this[_0xa55c('0x14')]={};this['agents']=_0x508342['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xa55c('0x15'),this[_0xa55c('0x16')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x18'),this[_0xa55c('0x19')][_0xa55c('0x17')](this));ami['on']('hanguprequest',this[_0xa55c('0x1a')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1b'),this[_0xa55c('0x1c')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1d'),this[_0xa55c('0x1e')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1f'),this['syncVarSet'][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x20'),this[_0xa55c('0x21')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x22'),this[_0xa55c('0x23')]['bind'](this));this['loopCampaigns'](this[_0xa55c('0x12')]);}function emit(_0x3776ac,_0xade4c4,_0x4cfe10){io['to'](_0x3776ac)[_0xa55c('0x24')](_0xade4c4,_0x4cfe10);}function emitVoiceQueueChannelRemove(_0x2fcb90){logger['info'](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x2fcb90));emit(util[_0xa55c('0x27')](_0xa55c('0x28'),_0x2fcb90[_0xa55c('0x29')]),'voice_queue_channel:remove',_0x2fcb90);io[_0xa55c('0x24')]('voice_queue_presence:remove',_0x2fcb90);}function notSendMessagesQueue(_0x5ba836){if(_0x5ba836['sendMessageOneNotActive']){if(_0x5ba836[_0xa55c('0x2a')]===0x0&&_0x5ba836['pTalking']===0x0){_0x5ba836[_0xa55c('0x2b')]=![];_0x5ba836[_0xa55c('0x2c')]=0x0;_0x5ba836[_0xa55c('0x2d')]=0x0;_0x5ba836[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x30')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+_0xa55c('0x33'));}else{_0x5ba836[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x34')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+'\x20is\x20deactivated');}}}Preview[_0xa55c('0x35')][_0xa55c('0x36')]=function(){var _0x1b8388=this;setInterval(function(){_0x1b8388[_0xa55c('0x37')]();},0x7cf);};Preview[_0xa55c('0x35')][_0xa55c('0x37')]=function(){var _0x52d37f=this[_0xa55c('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x35c9c2 in _0x52d37f){if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&(_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')||_0x52d37f[_0x35c9c2]['dialMethod']===_0xa55c('0x3b'))&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(this[_0xa55c('0x3e')]>0x7){this[_0xa55c('0x3e')]=0x0;this[_0xa55c('0x3f')]();}}if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(_0x52d37f[_0x35c9c2]['dialActive']){this['setMessage'](_0x52d37f[_0x35c9c2]);if(_0x52d37f[_0x35c9c2][_0xa55c('0x40')])this[_0xa55c('0x41')](_0x52d37f[_0x35c9c2]);}else{notSendMessagesQueue(_0x52d37f[_0x35c9c2]);}}}};Preview['prototype'][_0xa55c('0x42')]=function(_0x2f0110){var _0x2e9623=this;this[_0xa55c('0x11')][_0xa55c('0xe')](function(){if(!_[_0xa55c('0x43')](_0x2e9623[_0xa55c('0x14')][_0x2f0110])){loggerAction[_0xa55c('0x44')](_0xa55c('0x45'),_0x2f0110,'Queue',_0x2e9623['actions'][_0x2f0110]['queue'],_0xa55c('0x46'),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x12')][_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]]['originated']),_0xa55c('0x48'),JSON['stringify'](_0x2e9623[_0xa55c('0x12')][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]]['pTalking']),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x14')][_0x2f0110]['dialAnswer']),JSON[_0xa55c('0x26')](_[_0xa55c('0x49')](_0x2e9623['actions'][_0x2f0110],['contactId',_0xa55c('0x4a'),'VoiceQueueId',_0xa55c('0x4b')])));return ami[_0xa55c('0x4c')]({'action':'status','channel':_0x2e9623['actions'][_0x2f0110]['channel']})['catch'](function(_0x3b3308){if(_0x3b3308[_0xa55c('0x2e')]===_0xa55c('0x4d')){setTimeout(function(){if(_0x2e9623[_0xa55c('0x14')][_0x2f0110]){ut[_0xa55c('0x4e')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]],_0xa55c('0x4f'));if(_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x50')]===!![]){ut[_0xa55c('0x51')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110]['queue']],'[clearZombieChannel]');ut[_0xa55c('0x52')](_0xa55c('0x53')+_0x2f0110,_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2f0110,_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]);delete _0x2e9623[_0xa55c('0x14')][_0x2f0110];}},0x2328);}});}});};Preview['prototype'][_0xa55c('0x3f')]=function(){var _0xd5a006=this;loggerAction['info'](_0xa55c('0x54'),_['size'](this[_0xa55c('0x14')]));for(var _0x43a42d in this['actions']){if(_0xd5a006[_0xa55c('0x14')][_0xa55c('0x38')](_0x43a42d)){_0xd5a006['clearZombieChannel'](_0x43a42d);}}};Preview[_0xa55c('0x35')][_0xa55c('0x41')]=function(_0x204767){var _0x59a6c8=this;rpcDb[_0xa55c('0x55')](_0x204767['id'],ut['agentReadyId'](this[_0xa55c('0x56')]))[_0xa55c('0x57')](function(_0x451269){if(!_['isNil'](_0x451269)){for(var _0x41eab1=0x0;_0x41eab1<_0x451269[_0xa55c('0x58')];_0x41eab1+=0x1){if(ut['getDiff'](_0x451269[_0x41eab1][_0xa55c('0x59')])<_0x204767[_0xa55c('0x5a')]*0x3c){if(_0x451269[_0x41eab1]['Agent']&&!_0x451269[_0x41eab1][_0xa55c('0x5b')][_0xa55c('0x5c')]){_0x59a6c8['run'](_0x451269[_0x41eab1]['id'])[_0xa55c('0x57')](ut[_0xa55c('0x5d')](_0xa55c('0x5e')))[_0xa55c('0x5f')](ut['logger2'](_0xa55c('0x5e')));}else{rpcDb['disableContact'](_0x451269[_0x41eab1]['id']);}}else{var _0x2157d6=new Action(_0x451269[_0x41eab1],_0x204767);_0x2157d6[_0xa55c('0x60')]=moment()[_0xa55c('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x204767[_0xa55c('0x61')]+=0x1;ut[_0xa55c('0x62')](_0x2157d6,0x17,'RecallInQueue');if(_0x204767[_0xa55c('0x63')]){rpcDb[_0xa55c('0x64')](ut[_0xa55c('0x65')](_0x451269[_0x41eab1]));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x67'));}else{ut[_0xa55c('0x62')](_0x2157d6,0x16,_0xa55c('0x68'));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x69'));rpcDb[_0xa55c('0x6a')](_0x2157d6,'[HistoryRecallClose]');}}}}})[_0xa55c('0x5f')](ut[_0xa55c('0x5d')](_0xa55c('0x6b')));};Preview['prototype'][_0xa55c('0x6c')]=function(_0x35bf0a){_0x35bf0a['sendMessageOneNotActive']=!![];if(ut[_0xa55c('0x6d')](_0x35bf0a['loggedIn'])){_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x6e')];}else if(!ut[_0xa55c('0x6f')](_0x35bf0a[_0xa55c('0x70')])){_0x35bf0a['message']=utils[_0xa55c('0x2f')][_0xa55c('0x30')];}else if(!this['isTrunkReachable'](_0x35bf0a[_0xa55c('0x71')])){if(!this[_0xa55c('0x72')](_0x35bf0a[_0xa55c('0x73')])){_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x74')];}}else{_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x74')];}};Preview['prototype'][_0xa55c('0x75')]=function(_0x437ced,_0x20593d,_0x2ccfb1){var _0xec640=this;var _0x53b2f7=this[_0xa55c('0x14')][_0x20593d];var _0x54f776=this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]];var _0x2cfe08;var _0x1e1c5b=![];var _0x19aaf5=0x2;var _0x138c9e=0x3;if(_0x54f776){switch(_0x2ccfb1){case'1':_0x54f776[_0xa55c('0x76')]+=0x1;_0x53b2f7['countnosuchnumberretry']+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x0,_0xa55c('0x79'));ami[_0xa55c('0x24')]('custom:agentnosuchnumber',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x7b')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x7c'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'0',_0x54f776)['then'](function(_0xdd92c1){_0x1e1c5b=_0xdd92c1[_0xa55c('0x7e')]==0x1;_0x19aaf5=_0x54f776[_0xa55c('0x7f')];_0x138c9e=_0x54f776[_0xa55c('0x80')];if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x53b2f7[_0xa55c('0x82')]>=_0x54f776['dialNoSuchNumberMaxRetry']){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x83'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0x82'),_0x54f776[_0xa55c('0x7f')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0x53b2f7['countnosuchnumberretry']++;logger[_0xa55c('0x44')](_0xa55c('0x89'),_0x53b2f7['countnosuchnumberretry']);logger[_0xa55c('0x44')]('id',_0x53b2f7[_0xa55c('0x8a')]);_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnosuchnumberretry':_0x53b2f7[_0xa55c('0x82')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'ANSWER':var _0x1dfaf7=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x53b2f7[_0xa55c('0x8e')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x8f')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x50')]=!![];_0x54f776[_0xa55c('0x90')]+=0x1;logger[_0xa55c('0x44')](_0xa55c('0x91'),_0x53b2f7['uniqueid'],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);ami[_0xa55c('0x24')](_0xa55c('0x93'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x94'),this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]]));if(_0x54f776[_0xa55c('0x95')]){ami['emit'](_0xa55c('0x96'),ut['buildAcw'](_0x53b2f7));}break;case'16':ami[_0xa55c('0x24')](_0xa55c('0x97'),ut[_0xa55c('0x7a')](_0x53b2f7,'complete',this['campaignsPreview'][_0x53b2f7[_0xa55c('0x47')]]));emitVoiceQueueChannelRemove(ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x98')));_0x54f776[_0xa55c('0x99')]+=0x1;_0x54f776['total']+=0x1;_0x54f776[_0xa55c('0x9a')]+=0x1;ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0x9b'));_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x4,'Answer');rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x9c'));rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x9d'));rpcDb[_0xa55c('0x9e')](_0x53b2f7);_0x54f776['sumDuration']+=_0x53b2f7[_0xa55c('0x9f')];_0x54f776[_0xa55c('0xa0')]+=_0x53b2f7['talktime'];logger[_0xa55c('0x44')](_0xa55c('0xa1'),_0x53b2f7[_0xa55c('0xa2')],'\x20Queue',_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];break;case'BUSY':_0x54f776[_0xa55c('0xa3')]+=0x1;_0x53b2f7[_0xa55c('0xa4')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x5,'Busy');_0x19aaf5=_0x54f776[_0xa55c('0xa5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xa6'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xa7')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xa8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'5',_0x54f776)['then'](function(_0x463195){_0x1e1c5b=_0x463195[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xab'));}else{if(_0x53b2f7[_0xa55c('0xa4')]>=_0x54f776['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x53b2f7,_0xa55c('0xa8'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xa4'),_0x54f776['dialBusyRetryFrequency']),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xa4')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countbusyretry':_0x53b2f7[_0xa55c('0xa4')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case _0xa55c('0xac'):_0x54f776['outboundNoAnswerCallsDay']+=0x1;_0x53b2f7[_0xa55c('0xad')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x3,_0xa55c('0xae'));_0x19aaf5=_0x54f776[_0xa55c('0xaf')];_0x138c9e=_0x54f776[_0xa55c('0x80')];var _0x402f02=ut[_0xa55c('0xb0')](_0x53b2f7,_0x54f776);ami[_0xa55c('0x24')]('custom:agentnoanswer',_0x402f02);rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xb1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'3',_0x54f776)[_0xa55c('0x57')](function(_0x256db0){_0x1e1c5b=_0x256db0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb2'));}else{if(_0x53b2f7[_0xa55c('0xad')]>=_0x54f776[_0xa55c('0xb3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xad'),_0x54f776[_0xa55c('0xaf')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})['then'](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CONGESTION':_0x54f776['outboundCongestionCallsDay']+=0x1;_0x53b2f7['countcongestionretry']+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x8,_0xa55c('0xb4'));_0x19aaf5=_0x54f776[_0xa55c('0xb5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')]('custom:agentcongestion',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xb6')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xb7'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'8',_0x54f776)[_0xa55c('0x57')](function(_0x25e4e0){_0x1e1c5b=_0x25e4e0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb8'));}else{if(_0x53b2f7[_0xa55c('0xb9')]>=_0x54f776[_0xa55c('0xba')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb7'));}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,'countcongestionretry',_0x54f776[_0xa55c('0xa5')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xb9')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countcongestionretry':_0x53b2f7[_0xa55c('0xb9')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CANCEL':_0x54f776[_0xa55c('0xbb')]+=0x1;_0x53b2f7[_0xa55c('0xbc')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x14,_0xa55c('0xbd'));_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xbf'),ut['buildObj'](_0x53b2f7,_0xa55c('0xc0')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)[_0xa55c('0x57')](function(_0x31287c){_0x1e1c5b=_0x31287c[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x14,_0xa55c('0xbd'));rpcDb['createCustomerFinal'](_0x2cfe08,_0xa55c('0xc2'));}else{if(_0x53b2f7[_0xa55c('0xbc')]>=_0x54f776[_0xa55c('0xc3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,'countagentrejectretry',_0x54f776[_0xa55c('0xbe')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640['incrementPreviewCounters']({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case _0xa55c('0xc4'):_0x54f776[_0xa55c('0xc5')]+=0x1;_0x53b2f7[_0xa55c('0xc6')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0xb,_0xa55c('0xc7'));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'11',_0x54f776)['then'](function(_0x46124b){_0x1e1c5b=_0x46124b['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x53b2f7[_0xa55c('0xc9')]>=_0x54f776[_0xa55c('0xca')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,_0xa55c('0xc6'),_0x54f776[_0xa55c('0xcb')]),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case'18':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0xcd')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x12,_0x437ced['cause-txt']||_0x437ced[_0xa55c('0xce')]);ami[_0xa55c('0x24')](_0xa55c('0xcf'),ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb[_0xa55c('0x66')](_0x53b2f7,'[callProgressDetectingCustomer][hangupInAMD]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'18',_0x54f776)['then'](function(_0x4ab9f1){_0x1e1c5b=_0x4ab9f1['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x12,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd0'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd0'));}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;case'19':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x13,_0x437ced[_0xa55c('0xd1')]||_0x437ced['dialstatus']);ami[_0xa55c('0x24')]('custom:amd',ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xd2'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'18',_0x54f776)['then'](function(_0x2961b6){_0x1e1c5b=_0x2961b6[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd2'));}else{rpcDb['createCustomerFinal'](_0x53b2f7,'[callProgressDetectingCustomer][machine]');}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;default:if(_0x53b2f7[_0xa55c('0x50')]){ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0xd3'));ut[_0xa55c('0x52')](_0xa55c('0xd4')+_0x54f776[_0xa55c('0x29')],_0x437ced);}_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0xc,_0x437ced[_0xa55c('0xd1')]||_0x437ced[_0xa55c('0xce')]);_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x53b2f7,'[callProgressDetectingCustomer][logUnknown]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)['then'](function(_0x1ba04f){_0x1e1c5b=_0x1ba04f[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd5'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd5'));}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});}});}if(!(_0x53b2f7[_0xa55c('0x50')]&&_0x2ccfb1==='16')){ut[_0xa55c('0x4e')](_0x54f776,_0xa55c('0xd6'));logger[_0xa55c('0x44')](_0xa55c('0xd7'),_0x53b2f7[_0xa55c('0xa2')],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x46'),_0x54f776[_0xa55c('0x2a')]);}if(_0x2ccfb1!=='ANSWER'){delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];delete this['actions'][_0x437ced[_0xa55c('0xd8')]];}_0x54f776[_0xa55c('0xd9')]=!![];}};Preview[_0xa55c('0x35')][_0xa55c('0xda')]=function(_0x31767b,_0x4d9b66,_0x456dd4){if(_['isUndefined'](_0x4d9b66)&&'object'!==typeof _0x4d9b66){return;}if(_[_0xa55c('0xdb')](_0x456dd4)&&_0xa55c('0xdc')!==typeof _0x456dd4){return;}switch(_0x456dd4[_0xa55c('0xdd')]){case'0':ut[_0xa55c('0xde')](_0x31767b,0x0,_0xa55c('0x79'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe0'));break;case'3':ut[_0xa55c('0xde')](_0x31767b,0x3,_0xa55c('0xae'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe1'));break;case'5':ut[_0xa55c('0xde')](_0x31767b,0x5,_0xa55c('0xe2'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe3'));break;case'8':ut[_0xa55c('0xde')](_0x31767b,0x8,_0xa55c('0xb4'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe4'));break;case'22':ut['logAgent'](_0x31767b,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x31767b,_0xa55c('0xe5'));break;default:ut[_0xa55c('0xde')](_0x31767b,0xc,_0x456dd4['reason']);rpcDb[_0xa55c('0xdf')](_0x31767b,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa55c('0x4e')](_0x4d9b66,'[callProgressDetectingAgent]');logger[_0xa55c('0x44')](_0xa55c('0xe6'),_0x31767b[_0xa55c('0xa2')],_0xa55c('0x92'),_0x4d9b66[_0xa55c('0x29')],_0xa55c('0x46'),_0x4d9b66[_0xa55c('0x2a')]);delete this[_0xa55c('0x14')][_0x31767b[_0xa55c('0xa2')]];};Preview[_0xa55c('0x35')][_0xa55c('0x7d')]=function(_0x53f209,_0x59f3a4,_0xde7bd){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x53f209,_0x59f3a4,_0xde7bd)[_0xa55c('0x5f')](logger['info'](_0xa55c('0xe7')));};Preview[_0xa55c('0x35')][_0xa55c('0x8c')]=function(_0x5b20c5,_0x3b8f15,_0x18584c){return cmHopperAdditionalPhone[_0xa55c('0x8c')](_0x5b20c5,_0x3b8f15,_0x18584c)['catch'](logger[_0xa55c('0x44')]('[swapAdditionalPhone]\x20'));};Preview[_0xa55c('0x35')]['incrementPreviewCounters']=function(_0x4e8433){return Promise[_0xa55c('0xe8')]()[_0xa55c('0x57')](cmHopperAdditionalPhone[_0xa55c('0x8b')](_0x4e8433))['catch'](logger[_0xa55c('0x44')](_0xa55c('0xe9')));};Preview[_0xa55c('0x35')][_0xa55c('0xea')]=function(_0x4399bd,_0x3e9384,_0x2e76ad,_0x24db74,_0x4b1762){var _0x402298=this;return new Promise(function(_0x1b8b05,_0x80befe){if(_[_0xa55c('0x43')](_0x3e9384)||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xeb')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xec')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xed')])){_0x80befe(ut[_0xa55c('0x2e')]('Contact\x20is\x20undefined',_0x24db74,_0x4b1762));return;}var _0x263d16=uuid['v4']();var _0x48127c=_0x402298['campaignsPreview'][_0x3e9384[_0xa55c('0xee')]['name']];var _0x427e3b=_0x2e76ad?_0x402298['agents'][_0x2e76ad]['id']:undefined;_0x402298[_0xa55c('0x14')][_0x263d16]=new Action(_0x3e9384,_0x48127c,_0x263d16,_0x2e76ad,_0x427e3b);var _0x231499=_0x402298[_0xa55c('0x14')][_0x263d16];_0x231499[_0xa55c('0x86')]=_0x24db74;_0x231499[_0xa55c('0x87')]=_0x4b1762;_0x231499[_0xa55c('0xef')]=_0x2e76ad;if(_[_0xa55c('0xf0')](_0x4399bd)){_0x402298['execCall'](_0x231499,_0x48127c,_0x3e9384,_0x2e76ad)[_0xa55c('0x57')](function(_0x590c0c){logger['info'](_0xa55c('0xf1'),_0xa55c('0xf2')+_0x231499['queue']+_0xa55c('0xf3')+_0x231499[_0xa55c('0x8a')],JSON[_0xa55c('0x26')](_0x590c0c));ami['emit']('custom:agentcalled',ut['buildObj'](_0x231499,'called',_0x402298[_0xa55c('0x12')][_0x231499[_0xa55c('0x47')]]));_0x1b8b05(ut['message'](_0xa55c('0xf4')));})[_0xa55c('0x5f')](function(_0x3b3be0){ut['logger'](_0xa55c('0xf5'),_0x3b3be0);_0x80befe(ut['message']('Call\x20failed',_0x24db74,_0x4b1762));});}else{_0x48127c['outboundBlacklistCallsDay']+=0x1;ut[_0xa55c('0xf6')](_0x231499);rpcDb['createHistory'](_0x231499,_0xa55c('0xf7'));delete _0x402298['actions'][_0x263d16];_0x80befe(ut[_0xa55c('0x2e')](_0xa55c('0xf8'),_0x24db74,_0x4b1762));}});};Preview[_0xa55c('0x35')]['isTrunkReachable']=function(_0x1c016d){return!_[_0xa55c('0x43')](_0x1c016d)&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0x29')])&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0xf9')])&&_0x1c016d[_0xa55c('0xf9')]&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])])&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')])&&(this['trunks'][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')]===_0xa55c('0xfd')||this['trunks'][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])][_0xa55c('0xfc')]===_0xa55c('0xfe'));};Preview[_0xa55c('0x35')][_0xa55c('0xff')]=function(_0x31b866,_0x37ed47){return this['execRun'](_0x31b866,_0x37ed47)[_0xa55c('0x57')](function(_0x331595){return _[_0xa55c('0x49')](_0x331595,[_0xa55c('0x2e')]);})[_0xa55c('0x5f')](function(_0x59a69d){if(_0x59a69d[_0xa55c('0x100')]){rpcDb['unlockContact'](_0x31b866);}if(_0x59a69d['active']){rpcDb[_0xa55c('0x101')](_0x31b866);}throw _[_0xa55c('0x49')](_0x59a69d,[_0xa55c('0x2e')]);});};Preview[_0xa55c('0x35')]['execRun']=function(_0x125812,_0x155c6e){var _0xa22273=this;var _0x1c7506,_0x3b76df;return rpcDb[_0xa55c('0x102')](_0x125812)[_0xa55c('0x57')](function(_0x239b2e){if(!_['isNil'](_0x239b2e[0x0])){_0x3b76df=_0x239b2e[0x0][_0xa55c('0x103')]?![]:!![];_0x1c7506=_0x239b2e[0x0][_0xa55c('0x103')]?!![]:![];_0x1c7506=_0x155c6e?!![]:_0x1c7506;}var _0x2639cc=_0xa22273[_0xa55c('0x104')](_0x239b2e);if(_0x2639cc['isValid']){rpcDb[_0xa55c('0x105')](_[_0xa55c('0x49')](_0x239b2e[0x0],[_0xa55c('0xed'),'phone']))[_0xa55c('0x57')](function(_0x3a67fb){_0xa22273[_0xa55c('0xea')](_0x3a67fb,_0x239b2e[0x0],_0x155c6e,_0x3b76df,_0x1c7506)[_0xa55c('0x57')](function(_0x19e506){return _0x19e506;})[_0xa55c('0x5f')](function(_0x127c2f){throw _0x127c2f;});})['catch'](function(_0xcd4f3a){ut[_0xa55c('0x31')]('[Preview][checkIsBlackList]',_0xcd4f3a);throw ut[_0xa55c('0x2e')](_0xa55c('0x106'),_0x3b76df,_0x1c7506);});}else{throw ut[_0xa55c('0x2e')](_0x2639cc['message'],_0x3b76df,_0x1c7506);}})['catch'](function(_0x4dba17){ut[_0xa55c('0x31')](_0xa55c('0x107'),_0x4dba17);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xa55c('0x35')][_0xa55c('0x104')]=function(_0x591ee3){if(_['isNil'](_0x591ee3)||_[_0xa55c('0xf0')](_0x591ee3)||!_[_0xa55c('0x43')](_0x591ee3[0x0][_0xa55c('0x5b')])&&_['isNil'](_0x591ee3[0x0]['Agent'][_0xa55c('0x29')])){ut['logger'](_0xa55c('0x108'),_0x591ee3);return{'isValid':![],'message':_0xa55c('0x109')};}var _0x5a4e69=this[_0xa55c('0x12')][_0x591ee3[0x0]['Queue']['name']];_0x5a4e69['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xa55c('0x43')](_0x5a4e69)){ut['logger'](_0xa55c('0x10a'),_0x5a4e69);return{'isValid':![],'message':_0xa55c('0x10b')};}if(!this[_0xa55c('0x72')](_0x5a4e69['Trunk'])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x10e'));if(!this[_0xa55c('0x72')](_0x5a4e69[_0xa55c('0x73')])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0x5a4e69[_0xa55c('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa55c('0x10f')};}}if(!ut[_0xa55c('0x6f')](_0x5a4e69['dialActive'])){ut[_0xa55c('0x31')](_0xa55c('0x110'),_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111'));return{'isValid':![],'message':_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111')};}return{'isValid':!![],'message':_0xa55c('0x112')};};Preview[_0xa55c('0x35')][_0xa55c('0x113')]=function(_0x131288,_0x197953,_0x262d72,_0x228d12){var _0x16e229=this;return new Promise(function(_0x5c8713,_0x2d03b2){var _0x4b2e75=_0x131288[_0xa55c('0xa2')];var _0x3d0c6d=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?util['format'](_0xa55c('0x114'),_0x197953[_0xa55c('0x71')][_0xa55c('0x29')],_['isNil'](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')][_0xa55c('0x116')]()||'',_0x197953['dialCutDigit']>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953[_0xa55c('0x118')]):_0x262d72['phone']):util[_0xa55c('0x27')]('SIP/%s/%s%s',_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x29')]:_0x197953[_0xa55c('0x73')]['name'],_[_0xa55c('0x43')](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')]['trim']()||'',_0x197953[_0xa55c('0x118')]>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953['dialCutDigit']):_0x262d72[_0xa55c('0xec')]);var _0x2becbd=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?ut[_0xa55c('0x119')](_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953['dialOriginateCallerIdNumber']):ut[_0xa55c('0x119')](_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')]:_0x197953[_0xa55c('0x73')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953[_0xa55c('0x11d')]);if(_0x2becbd){_0x131288['originatecalleridname']=ut['extractCalleridName'](_0x2becbd);_0x131288['originatecalleridnum']=ut[_0xa55c('0x11e')](_0x2becbd);}var _0x124873=ut[_0xa55c('0x11f')](_0x197953,_0x262d72,_0x3d0c6d,_0x2becbd,_0x4b2e75,_0x131288);_[_0xa55c('0x120')](_0x131288,ut[_0xa55c('0x121')](_0x124873));_0x131288[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x197953['variables']=_0x124873;var _0x35c42c=ut[_0xa55c('0x122')](_0x131288,_0x197953,_0x124873,_0x131288[_0xa55c('0x87')],_0x228d12);return ami[_0xa55c('0x4c')](_0x35c42c)[_0xa55c('0x57')](function(_0xd511c0){_0x197953['originated']+=0x1;logger[_0xa55c('0x44')]('[originated][increment]',_0x4b2e75,'\x20Queue',_0x197953['name'],'originated:\x20',_0x197953[_0xa55c('0x2a')]);_0x5c8713(_0xd511c0);})[_0xa55c('0x5f')](function(_0x4732b4){ut[_0xa55c('0xde')](_0x131288,0xe,_0xa55c('0x123'));rpcDb[_0xa55c('0xdf')](_0x131288,_0xa55c('0x124'));_0x2d03b2(_0x4732b4);});});};Preview[_0xa55c('0x35')][_0xa55c('0x1e')]=function(_0x9c98af){if(this[_0xa55c('0x14')][_0x9c98af['linkedid']]){this['actions'][_0x9c98af[_0xa55c('0x88')]]['channel']=_0x9c98af[_0xa55c('0x125')];}};Preview[_0xa55c('0x35')][_0xa55c('0x16')]=function(_0x340570){var _0x2ef96f=this;var _0x582b22=this[_0xa55c('0x14')][_0x340570[_0xa55c('0x126')]];if(_0x582b22){if(_0x582b22[_0xa55c('0xef')]&&this['agents'][_0x582b22[_0xa55c('0xef')]]){ut[_0xa55c('0x127')](_0x582b22,this['agents'][_0x582b22['lookAgent']][_0xa55c('0x29')],this[_0xa55c('0x56')][_0x582b22[_0xa55c('0xef')]]['id']);}var _0x4f2883=_[_0xa55c('0x128')](_0x582b22);_0x4f2883[_0xa55c('0x8e')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));var _0x5a37d6=_0x2ef96f['campaignsPreview'][_0x582b22[_0xa55c('0x47')]];if(ut['isFailure'](_0x340570['response'])){if(_0x582b22[_0xa55c('0x86')]){rpcDb[_0xa55c('0x129')](_0x582b22[_0xa55c('0x8a')]);}if(_0x582b22[_0xa55c('0x87')]){rpcDb['disableContact'](_0x582b22[_0xa55c('0x8a')]);}ami[_0xa55c('0x24')](_0xa55c('0x12a'),ut[_0xa55c('0x7a')](_0x582b22,_0xa55c('0x12b'),this['campaignsPreview'][_0x582b22[_0xa55c('0x47')]]));this[_0xa55c('0xda')](_0x4f2883,_0x5a37d6,_0x340570);}else{_0x582b22[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));ut[_0xa55c('0xde')](_0x4f2883,0x4,_0xa55c('0x12c'));rpcDb['createAgentHistory'](_0x4f2883,_0xa55c('0x12d'));}}};Preview['prototype'][_0xa55c('0x19')]=function(_0x26946f){var _0x3755a7=this['actions'][_0x26946f['linkedid']];var _0x307b39;if(_0x3755a7){_0x307b39=this[_0xa55c('0x12')][_0x3755a7['queue']];logger['info'](_0xa55c('0x12e'),_0x26946f[_0xa55c('0x88')],'\x20Queue',_0x307b39[_0xa55c('0x29')],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);}if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]&&_0x26946f[_0xa55c('0x88')]!==_0x26946f['uniqueid']){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f['cause']);}else if(this['actions'][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')](_0xa55c('0x130'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39[_0xa55c('0x29')],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}else if(_0x3755a7&&_[_0xa55c('0x43')](_0x3755a7[_0xa55c('0x131')])&&_0x307b39[_0xa55c('0x132')]&&_0x26946f['linkedid']===_0x26946f[_0xa55c('0xa2')]&&_[_0xa55c('0x43')](_0x26946f[_0xa55c('0xdd')])&&_0x26946f[_0xa55c('0x12f')]==='16'&&_0x26946f['channelstate']==='6'&&_[_0xa55c('0xdb')](_0x3755a7['transfer'])){if(_0x3755a7['unlockAgent']){rpcDb['unlockContact'](_0x3755a7['idContact']);}if(_0x3755a7[_0xa55c('0x87')]){rpcDb[_0xa55c('0x101')](_0x3755a7['idContact']);}_0x26946f[_0xa55c('0xdd')]='22';this[_0xa55c('0xda')](_0x3755a7,_0x307b39,_0x26946f);}else if(_0x3755a7&&_0x3755a7[_0xa55c('0x133')]){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){logger[_0xa55c('0x44')](_0xa55c('0x134'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],'\x20Queue',_0x307b39['name'],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);this[_0xa55c('0x75')](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')]);}else if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')]('[syncHangup][talking][cause]',_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39['name'],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x1c')]=function(_0x236015){if(this['actions'][_0x236015['destlinkedid']]&&_0x236015[_0xa55c('0xd8')]!==_0x236015[_0xa55c('0x135')]){this[_0xa55c('0x75')](_0x236015,_0x236015[_0xa55c('0xd8')],_0x236015[_0xa55c('0xce')]);}};Preview[_0xa55c('0x35')][_0xa55c('0x1a')]=function(_0x2511fe){if(this[_0xa55c('0x14')][_0x2511fe[_0xa55c('0x88')]]&&_0x2511fe['linkedid']!==_0x2511fe[_0xa55c('0xa2')]&&!this['actions'][_0x2511fe[_0xa55c('0x88')]][_0xa55c('0x50')]){if(_0x2511fe[_0xa55c('0x12f')]==='1'){this[_0xa55c('0x75')](_0x2511fe,_0x2511fe[_0xa55c('0x88')],_0x2511fe[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x136')]=function(_0x1e8760,_0x329808,_0x35ad66){if(this[_0xa55c('0x14')][_0x1e8760]){if(_[_0xa55c('0x43')](this['actions'][_0x1e8760][_0xa55c('0x137')])){this[_0xa55c('0x14')][_0x1e8760]['variables']={};}this[_0xa55c('0x14')][_0x1e8760][_0xa55c('0x137')][_0x329808]=_0x35ad66;}};Preview[_0xa55c('0x35')]['syncVarSet']=function(_0x238a43){try{if(!_[_0xa55c('0x43')](_0x238a43)){if(ut['filterKey'](_[_0xa55c('0x138')](_0x238a43[_0xa55c('0x139')])[0x0])){this['addVariable'](_0x238a43[_0xa55c('0xa2')],_['keys'](_0x238a43[_0xa55c('0x139')])[0x0],_0x238a43[_0xa55c('0x13a')]);}}}catch(_0x2a6c2d){logger[_0xa55c('0x13b')](_0xa55c('0x13c'),util[_0xa55c('0x13d')](_0x2a6c2d,{'showHidden':![],'depth':null}));}};Preview[_0xa55c('0x35')][_0xa55c('0x21')]=function(_0x9b5e3a){if(_0x9b5e3a){if(this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]]){this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]][_0xa55c('0x133')]=!![];}}};Preview[_0xa55c('0x35')][_0xa55c('0x23')]=function(_0x5ac4fa){if(_0x5ac4fa){if(this[_0xa55c('0x14')][_0x5ac4fa['transfererlinkedid']]){this[_0xa55c('0x14')][_0x5ac4fa[_0xa55c('0x13f')]][_0xa55c('0x133')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x54ef=['DEACTIVATED','\x20is\x20deactivated','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','outbound','recallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','dialActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','custom:agentConnectPreview','custom:agentcomplete','complete','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','additional','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','isNil','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','variablesAction','[originateFailure][logOriginateFailure]','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','variable','error','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','../dialer/utils','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20'];(function(_0x3c2464,_0x2fe4b1){var _0x346de8=function(_0x42f36b){while(--_0x42f36b){_0x3c2464['push'](_0x3c2464['shift']());}};_0x346de8(++_0x2fe4b1);}(_0x54ef,0x112));var _0xf54e=function(_0x22afc9,_0xba48fb){_0x22afc9=_0x22afc9-0x0;var _0x44a57e=_0x54ef[_0x22afc9];return _0x44a57e;};'use strict';var util=require(_0xf54e('0x0'));var _=require(_0xf54e('0x1'));var uuid=require(_0xf54e('0x2'));var moment=require('moment');var Redis=require(_0xf54e('0x3'));var config=require(_0xf54e('0x4'));var logger=require(_0xf54e('0x5'))(_0xf54e('0x6'));var loggerAction=require(_0xf54e('0x5'))(_0xf54e('0x7'));var ami=require(_0xf54e('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xf54e('0x9'));var ut=require(_0xf54e('0xa'));var utils=require(_0xf54e('0xb'));config['redis']=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var io=require(_0xf54e('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xf54e('0xf')][_0xf54e('0x10')]=function(_0x6b9e61){this[_0xf54e('0x11')]=this['tail']?this[_0xf54e('0x11')][_0xf54e('0x12')](_0x6b9e61):_0x6b9e61();};function Preview(_0x143d66){this[_0xf54e('0x13')]=new Sequence();this['campaignsPreview']=_0x143d66[_0xf54e('0x14')];this['trunks']=_0x143d66['trunks'];this[_0xf54e('0x15')]={};this[_0xf54e('0x16')]=_0x143d66[_0xf54e('0x16')];this[_0xf54e('0x17')]=0x0;ami['on']('originateresponse',this[_0xf54e('0x18')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x1a'),this[_0xf54e('0x1b')]['bind'](this));ami['on'](_0xf54e('0x1c'),this[_0xf54e('0x1d')][_0xf54e('0x19')](this));ami['on']('dialend',this['syncDialEnd'][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x1e'),this[_0xf54e('0x1f')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x20'),this[_0xf54e('0x21')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x22'),this[_0xf54e('0x23')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x24'),this['syncBlindTransfer']['bind'](this));this[_0xf54e('0x25')](this['campaignsPreview']);}function emit(_0x3e1556,_0x1bfe99,_0x106362){io['to'](_0x3e1556)[_0xf54e('0x26')](_0x1bfe99,_0x106362);}function emitVoiceQueueChannelRemove(_0xf64f12){logger[_0xf54e('0x27')](_0xf54e('0x28'),JSON[_0xf54e('0x29')](_0xf64f12));emit(util[_0xf54e('0x2a')](_0xf54e('0x2b'),_0xf64f12[_0xf54e('0x2c')]),'voice_queue_channel:remove',_0xf64f12);io[_0xf54e('0x26')]('voice_queue_presence:remove',_0xf64f12);}function notSendMessagesQueue(_0x264a8f){if(_0x264a8f[_0xf54e('0x2d')]){if(_0x264a8f[_0xf54e('0x2e')]===0x0&&_0x264a8f[_0xf54e('0x2f')]===0x0){_0x264a8f[_0xf54e('0x2d')]=![];_0x264a8f[_0xf54e('0x30')]=0x0;_0x264a8f[_0xf54e('0x31')]=0x0;_0x264a8f[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x34')];ut[_0xf54e('0x35')](_0xf54e('0x36'),_0x264a8f[_0xf54e('0x2c')]+'\x20is\x20not\x20active');}else{_0x264a8f[_0xf54e('0x32')]=utils['CAMPAIGN_STATUS'][_0xf54e('0x37')];ut['logger'](_0xf54e('0x36'),_0x264a8f[_0xf54e('0x2c')]+_0xf54e('0x38'));}}}Preview[_0xf54e('0xf')][_0xf54e('0x25')]=function(){var _0x3993e4=this;setInterval(function(){_0x3993e4[_0xf54e('0x39')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x2f96b1=this[_0xf54e('0x3a')];this[_0xf54e('0x17')]+=0x1;for(var _0x16d00f in _0x2f96b1){if(_0x2f96b1[_0xf54e('0x3b')](_0x16d00f)&&(_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x6')||_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x3d'))&&_0x2f96b1[_0x16d00f][_0xf54e('0x3e')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xf54e('0x17')]=0x0;this[_0xf54e('0x3f')]();}}if(_0x2f96b1['hasOwnProperty'](_0x16d00f)&&_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x6')&&_0x2f96b1[_0x16d00f][_0xf54e('0x3e')]===_0xf54e('0x40')){if(_0x2f96b1[_0x16d00f]['dialActive']){this['setMessage'](_0x2f96b1[_0x16d00f]);if(_0x2f96b1[_0x16d00f]['dialPreviewAutoRecallMe'])this[_0xf54e('0x41')](_0x2f96b1[_0x16d00f]);}else{notSendMessagesQueue(_0x2f96b1[_0x16d00f]);}}}};Preview[_0xf54e('0xf')][_0xf54e('0x42')]=function(_0x399e68){var _0x29dc39=this;this[_0xf54e('0x13')]['enqueue'](function(){if(!_['isNil'](_0x29dc39['actions'][_0x399e68])){loggerAction[_0xf54e('0x27')](_0xf54e('0x43'),_0x399e68,'Queue',_0x29dc39['actions'][_0x399e68][_0xf54e('0x44')],_0xf54e('0x45'),JSON[_0xf54e('0x29')](_0x29dc39['campaignsPreview'][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]]['originated']),_0xf54e('0x46'),JSON[_0xf54e('0x29')](_0x29dc39[_0xf54e('0x3a')][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]][_0xf54e('0x2f')]),JSON['stringify'](_0x29dc39['actions'][_0x399e68][_0xf54e('0x47')]),JSON[_0xf54e('0x29')](_[_0xf54e('0x48')](_0x29dc39['actions'][_0x399e68],[_0xf54e('0x49'),_0xf54e('0x4a'),_0xf54e('0x4b'),_0xf54e('0x4c')])));return ami[_0xf54e('0x4d')]({'action':_0xf54e('0x4e'),'channel':_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x4f')]})[_0xf54e('0x50')](function(_0x2087b3){if(_0x2087b3[_0xf54e('0x32')]===_0xf54e('0x51')){setTimeout(function(){if(_0x29dc39[_0xf54e('0x15')][_0x399e68]){ut[_0xf54e('0x52')](_0x29dc39[_0xf54e('0x3a')][_0x29dc39['actions'][_0x399e68]['queue']],'[clearZombieChannel]');if(_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x47')]===!![]){ut['decrementTalkink'](_0x29dc39[_0xf54e('0x3a')][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]],'[clearZombieChannel]');ut[_0xf54e('0x53')](_0xf54e('0x54')+_0x399e68,_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]);}ut[_0xf54e('0x53')](_0xf54e('0x55')+_0x399e68,_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]);delete _0x29dc39[_0xf54e('0x15')][_0x399e68];}},0x2328);}});}});};Preview['prototype'][_0xf54e('0x3f')]=function(){var _0x3447fd=this;loggerAction[_0xf54e('0x27')](_0xf54e('0x56'),_[_0xf54e('0x57')](this[_0xf54e('0x15')]));for(var _0x52c47d in this[_0xf54e('0x15')]){if(_0x3447fd['actions'][_0xf54e('0x3b')](_0x52c47d)){_0x3447fd['clearZombieChannel'](_0x52c47d);}}};Preview[_0xf54e('0xf')][_0xf54e('0x41')]=function(_0x2e08b4){var _0x57371d=this;rpcDb[_0xf54e('0x58')](_0x2e08b4['id'],ut[_0xf54e('0x59')](this[_0xf54e('0x16')]))[_0xf54e('0x5a')](function(_0x3a5a87){if(!_['isNil'](_0x3a5a87)){for(var _0x427799=0x0;_0x427799<_0x3a5a87[_0xf54e('0x5b')];_0x427799+=0x1){if(ut[_0xf54e('0x5c')](_0x3a5a87[_0x427799][_0xf54e('0x5d')])<_0x2e08b4['dialRecallMeTimeout']*0x3c){if(_0x3a5a87[_0x427799][_0xf54e('0x5e')]&&!_0x3a5a87[_0x427799][_0xf54e('0x5e')]['voicePause']){_0x57371d[_0xf54e('0x5f')](_0x3a5a87[_0x427799]['id'])[_0xf54e('0x5a')](ut[_0xf54e('0x60')](_0xf54e('0x61')))['catch'](ut[_0xf54e('0x60')](_0xf54e('0x61')));}else{rpcDb[_0xf54e('0x62')](_0x3a5a87[_0x427799]['id']);}}else{var _0xb4654f=new Action(_0x3a5a87[_0x427799],_0x2e08b4);_0xb4654f[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0x2e08b4[_0xf54e('0x65')]+=0x1;ut[_0xf54e('0x66')](_0xb4654f,0x17,_0xf54e('0x67'));if(_0x2e08b4[_0xf54e('0x68')]){rpcDb[_0xf54e('0x69')](ut[_0xf54e('0x6a')](_0x3a5a87[_0x427799]));rpcDb[_0xf54e('0x6b')](_0xb4654f,_0xf54e('0x6c'));}else{ut[_0xf54e('0x66')](_0xb4654f,0x16,_0xf54e('0x6d'));rpcDb[_0xf54e('0x6b')](_0xb4654f,_0xf54e('0x6e'));rpcDb[_0xf54e('0x6f')](_0xb4654f,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xf54e('0x60')](_0xf54e('0x70')));};Preview[_0xf54e('0xf')][_0xf54e('0x71')]=function(_0xba297c){_0xba297c[_0xf54e('0x2d')]=!![];if(ut[_0xf54e('0x72')](_0xba297c[_0xf54e('0x73')])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x74')];}else if(!ut['isActive'](_0xba297c[_0xf54e('0x75')])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x34')];}else if(!this[_0xf54e('0x76')](_0xba297c[_0xf54e('0x77')])){if(!this[_0xf54e('0x76')](_0xba297c['TrunkBackup'])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x78')];}else{_0xba297c['message']=utils[_0xf54e('0x33')]['ACTIVE'];}}else{_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x79')];}};Preview['prototype'][_0xf54e('0x7a')]=function(_0x30d10d,_0x2096e5,_0x4e5059){var _0x3744a4=this;var _0x2ec72a=this[_0xf54e('0x15')][_0x2096e5];var _0x55d57f=this['campaignsPreview'][_0x2ec72a[_0xf54e('0x44')]];var _0x9ab4c4;var _0x4f17dd=![];var _0x29743e=0x2;var _0x49fd97=0x3;if(_0x55d57f){switch(_0x4e5059){case'1':_0x55d57f[_0xf54e('0x7b')]+=0x1;_0x2ec72a['countnosuchnumberretry']+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x0,_0xf54e('0x7e'));ami[_0xf54e('0x26')](_0xf54e('0x7f'),ut['buildObj'](_0x2ec72a,'nosuchnumber'));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0x80'));_0x3744a4['verifyAdditionalPhones'](_0x2ec72a,'0',_0x55d57f)['then'](function(_0x2a5e54){_0x4f17dd=_0x2a5e54['additional']==0x1;_0x29743e=_0x55d57f[_0xf54e('0x81')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0x86'));}else{if(_0x2ec72a[_0xf54e('0x87')]>=_0x55d57f[_0xf54e('0x88')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0x86'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,'countnosuchnumberretry',_0x55d57f[_0xf54e('0x81')]),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a[_0xf54e('0x8c')]);}}delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];}else{_0x2ec72a['countnosuchnumberretry']++;logger[_0xf54e('0x27')](_0xf54e('0x8e'),_0x2ec72a['countnosuchnumberretry']);logger['info']('id',_0x2ec72a[_0xf54e('0x8f')]);_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnosuchnumberretry':_0x2ec72a[_0xf54e('0x87')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)['then'](function(){});});}});break;case _0xf54e('0x91'):var _0x5cdb8c=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0x2ec72a[_0xf54e('0x92')]=_0x5cdb8c;_0x2ec72a['answertime']=_0x5cdb8c;_0x2ec72a[_0xf54e('0x47')]=!![];_0x55d57f['pTalking']+=0x1;logger[_0xf54e('0x27')](_0xf54e('0x93'),_0x2ec72a['uniqueid'],_0xf54e('0x94'),_0x55d57f['name'],_0xf54e('0x46'),_0x55d57f[_0xf54e('0x2f')]);ami[_0xf54e('0x26')](_0xf54e('0x95'),ut[_0xf54e('0x96')](_0x2ec72a,'connect',this[_0xf54e('0x3a')][_0x2ec72a[_0xf54e('0x44')]]));if(_0x55d57f['acw']){ami[_0xf54e('0x26')](_0xf54e('0x97'),ut['buildAcw'](_0x2ec72a));}break;case'16':ami[_0xf54e('0x26')](_0xf54e('0x98'),ut[_0xf54e('0x96')](_0x2ec72a,'complete',this[_0xf54e('0x3a')][_0x2ec72a['queue']]));emitVoiceQueueChannelRemove(ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0x99')));_0x55d57f['outboundAnswerCallsDay']+=0x1;_0x55d57f[_0xf54e('0x9a')]+=0x1;_0x55d57f[_0xf54e('0x9b')]+=0x1;ut[_0xf54e('0x9c')](_0x55d57f,_0xf54e('0x9d'));_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x4,_0xf54e('0x9e'));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0x9f'));rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xf54e('0xa0')](_0x2ec72a);_0x55d57f[_0xf54e('0xa1')]+=_0x2ec72a[_0xf54e('0xa2')];_0x55d57f['sumBillable']+=_0x2ec72a[_0xf54e('0xa2')];logger[_0xf54e('0x27')](_0xf54e('0xa3'),_0x2ec72a[_0xf54e('0xa4')],_0xf54e('0x94'),_0x55d57f[_0xf54e('0x2c')],_0xf54e('0x46'),_0x55d57f['pTalking']);delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];break;case _0xf54e('0xa5'):_0x55d57f['outboundBusyCallsDay']+=0x1;_0x2ec72a[_0xf54e('0xa6')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x5,'Busy');_0x29743e=_0x55d57f['dialBusyRetryFrequency'];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xa7'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xa8')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xa9'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'5',_0x55d57f)[_0xf54e('0x5a')](function(_0x205b47){_0x4f17dd=_0x205b47['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb['createCustomerFinal'](_0x9ab4c4,_0xf54e('0xab'));}else{if(_0x2ec72a[_0xf54e('0xa6')]>=_0x55d57f[_0xf54e('0xac')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xa6'),_0x55d57f['dialBusyRetryFrequency']),_0x2ec72a['unlockAgent'],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xa6')]++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countbusyretry':_0x2ec72a[_0xf54e('0xa6')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xae'):_0x55d57f['outboundNoAnswerCallsDay']+=0x1;_0x2ec72a[_0xf54e('0xaf')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x3,_0xf54e('0xb0'));_0x29743e=_0x55d57f[_0xf54e('0xb1')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];var _0x9a8f4f=ut[_0xf54e('0xb2')](_0x2ec72a,_0x55d57f);ami[_0xf54e('0x26')](_0xf54e('0xb3'),_0x9a8f4f);rpcDb[_0xf54e('0x6b')](_0x2ec72a,'[callProgressDetectingCustomer][logNoAnswer]');_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'3',_0x55d57f)[_0xf54e('0x5a')](function(_0x59acbc){_0x4f17dd=_0x59acbc['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xb4'));}else{if(_0x2ec72a[_0xf54e('0xaf')]>=_0x55d57f[_0xf54e('0xb5')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xaf'),_0x55d57f['dialNoAnswerRetryFrequency']),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a['activeContact']);}}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})['then'](function(){_0x3744a4['swapAdditionalPhones'](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xb6'):_0x55d57f[_0xf54e('0xb7')]+=0x1;_0x2ec72a[_0xf54e('0xb8')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut['totalGlobal'](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0x8,_0xf54e('0xb9'));_0x29743e=_0x55d57f[_0xf54e('0xba')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xbb'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xbc')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xbd'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'8',_0x55d57f)['then'](function(_0x31e699){_0x4f17dd=_0x31e699[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut['totalGlobal'](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xbf'));}else{if(_0x2ec72a[_0xf54e('0xb8')]>=_0x55d57f['dialCongestionMaxRetry']){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xbd'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,'countcongestionretry',_0x55d57f[_0xf54e('0xc0')]),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xb8')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countcongestionretry':_0x2ec72a[_0xf54e('0xb8')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case'CANCEL':_0x55d57f[_0xf54e('0xc1')]+=0x1;_0x2ec72a['countagentrejectretry']+=0x1;_0x2ec72a['countglobal']=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x14,_0xf54e('0xc2'));_0x29743e=_0x55d57f[_0xf54e('0xc3')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xc4'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xc5')));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xc6'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'20',_0x55d57f)[_0xf54e('0x5a')](function(_0x971a3e){_0x4f17dd=_0x971a3e[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0x14,_0xf54e('0xc2'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xc7'));}else{if(_0x2ec72a[_0xf54e('0xc8')]>=_0x55d57f[_0xf54e('0xc9')]){rpcDb['createCustomerFinal'](_0x2ec72a,_0xf54e('0xc7'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xc8'),_0x55d57f['dialAgentRejectRetryFrequency']),_0x2ec72a['unlockAgent'],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4['swapAdditionalPhones'](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xca'):_0x55d57f[_0xf54e('0xcb')]+=0x1;_0x2ec72a[_0xf54e('0xcc')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0xb,_0xf54e('0xcd'));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xce'));_0x3744a4['verifyAdditionalPhones'](_0x2ec72a,'11',_0x55d57f)[_0xf54e('0x5a')](function(_0x27c584){_0x4f17dd=_0x27c584[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut['cloneAction'](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2ec72a[_0xf54e('0xcf')]>=_0x55d57f[_0xf54e('0xd0')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xce'));}else{rpcDb['rescheduleContact'](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xcc'),_0x55d57f['dialAbandonedRetryFrequency']),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a['activeContact']);}}}else{_0x2ec72a['countnoanswerretry']++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a['idContact'],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case'18':_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a['countmachineretry']+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x12,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d['dialstatus']);ami[_0xf54e('0x26')]('custom:amd',ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xd3')));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xd4'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'18',_0x55d57f)[_0xf54e('0x5a')](function(_0x23a151){_0x4f17dd=_0x23a151['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0x12,'Global');rpcDb['createCustomerFinal'](_0x9ab4c4,_0xf54e('0xd4'));}else{rpcDb['createCustomerFinal'](_0x2ec72a,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2ec72a['countnoanswerretry']++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];break;case'19':_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a['countglobal']=ut[_0xf54e('0x7d')](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0x13,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d[_0xf54e('0xd5')]);ami['emit'](_0xf54e('0xd6'),ut['buildObj'](_0x2ec72a,_0xf54e('0xd3')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xd7'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'18',_0x55d57f)[_0xf54e('0x5a')](function(_0x3c499e){_0x4f17dd=_0x3c499e['additional']==0x1;if(!_0x4f17dd){if(ut['totalGlobal'](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,'Global');rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xd7'));}else{rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xd7'));}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});delete this[_0xf54e('0x15')][_0x30d10d['linkedid']];break;default:if(_0x2ec72a[_0xf54e('0x47')]){ut[_0xf54e('0x9c')](_0x55d57f,_0xf54e('0xd8'));ut[_0xf54e('0x53')](_0xf54e('0xd9')+_0x55d57f['name'],_0x30d10d);}_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0xc,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d[_0xf54e('0xd5')]);_0x29743e=_0x55d57f[_0xf54e('0xc3')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];rpcDb[_0xf54e('0x6b')](_0x2ec72a,'[callProgressDetectingCustomer][logUnknown]');_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'20',_0x55d57f)[_0xf54e('0x5a')](function(_0x47d309){_0x4f17dd=_0x47d309['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xda'));}else{rpcDb['createCustomerFinal'](_0x2ec72a,_0xf54e('0xda'));}delete this[_0xf54e('0x15')][_0x30d10d['linkedid']];}else{_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});}});}if(!(_0x2ec72a[_0xf54e('0x47')]&&_0x4e5059==='16')){ut[_0xf54e('0x52')](_0x55d57f,_0xf54e('0xdb'));logger[_0xf54e('0x27')](_0xf54e('0xdc'),_0x2ec72a[_0xf54e('0xa4')],_0xf54e('0x94'),_0x55d57f[_0xf54e('0x2c')],_0xf54e('0x45'),_0x55d57f['originated']);}if(_0x4e5059!=='ANSWER'){delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0xdd')]];}_0x55d57f[_0xf54e('0xde')]=!![];}};Preview['prototype'][_0xf54e('0xdf')]=function(_0x24b324,_0x3a9def,_0x213dc5){if(_['isUndefined'](_0x3a9def)&&_0xf54e('0xe0')!==typeof _0x3a9def){return;}if(_[_0xf54e('0xe1')](_0x213dc5)&&_0xf54e('0xe0')!==typeof _0x213dc5){return;}switch(_0x213dc5[_0xf54e('0xe2')]){case'0':ut[_0xf54e('0xe3')](_0x24b324,0x0,_0xf54e('0x7e'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe5'));break;case'3':ut[_0xf54e('0xe3')](_0x24b324,0x3,_0xf54e('0xb0'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe6'));break;case'5':ut[_0xf54e('0xe3')](_0x24b324,0x5,_0xf54e('0xe7'));rpcDb['createAgentHistory'](_0x24b324,_0xf54e('0xe8'));break;case'8':ut['logAgent'](_0x24b324,0x8,'Congestion');rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe9'));break;case'22':ut[_0xf54e('0xe3')](_0x24b324,0x16,_0xf54e('0xea'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xeb'));break;default:ut[_0xf54e('0xe3')](_0x24b324,0xc,_0x213dc5[_0xf54e('0xe2')]);rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe9'));}ut[_0xf54e('0x52')](_0x3a9def,_0xf54e('0xec'));logger[_0xf54e('0x27')]('[originated][decrement][callProgressDetectingAgent]',_0x24b324[_0xf54e('0xa4')],_0xf54e('0x94'),_0x3a9def[_0xf54e('0x2c')],_0xf54e('0x45'),_0x3a9def[_0xf54e('0x2e')]);delete this['actions'][_0x24b324['uniqueid']];};Preview[_0xf54e('0xf')][_0xf54e('0xaa')]=function(_0x4b6f61,_0x5f0853,_0x3250d0){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4b6f61,_0x5f0853,_0x3250d0)[_0xf54e('0x50')](logger[_0xf54e('0x27')](_0xf54e('0xed')));};Preview[_0xf54e('0xf')][_0xf54e('0x90')]=function(_0x1f9d18,_0x50bff9,_0x39fc7d){return cmHopperAdditionalPhone[_0xf54e('0x90')](_0x1f9d18,_0x50bff9,_0x39fc7d)['catch'](logger[_0xf54e('0x27')](_0xf54e('0xee')));};Preview['prototype'][_0xf54e('0xad')]=function(_0x44b7bd){return Promise[_0xf54e('0xef')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x44b7bd))[_0xf54e('0x50')](logger[_0xf54e('0x27')]('[incrementPreviewCounters]\x20'));};Preview['prototype']['checkInBlack']=function(_0x39027b,_0x32b55f,_0x11fb0c,_0x5072aa,_0x187b1c){var _0x459172=this;return new Promise(function(_0x28d019,_0x3da354){if(_[_0xf54e('0xf0')](_0x32b55f)||_['isNil'](_0x32b55f['Contact'])||_['isNil'](_0x32b55f['phone'])||_['isNil'](_0x32b55f[_0xf54e('0x4b')])){_0x3da354(ut['message'](_0xf54e('0xf1'),_0x5072aa,_0x187b1c));return;}var _0x3e0b67=uuid['v4']();var _0x484691=_0x459172[_0xf54e('0x3a')][_0x32b55f['Queue'][_0xf54e('0x2c')]];var _0x400dc6=_0x11fb0c?_0x459172[_0xf54e('0x16')][_0x11fb0c]['id']:undefined;_0x459172[_0xf54e('0x15')][_0x3e0b67]=new Action(_0x32b55f,_0x484691,_0x3e0b67,_0x11fb0c,_0x400dc6);var _0x3c0755=_0x459172[_0xf54e('0x15')][_0x3e0b67];_0x3c0755[_0xf54e('0x8b')]=_0x5072aa;_0x3c0755['activeContact']=_0x187b1c;_0x3c0755[_0xf54e('0xf2')]=_0x11fb0c;if(_[_0xf54e('0xf3')](_0x39027b)){_0x459172[_0xf54e('0xf4')](_0x3c0755,_0x484691,_0x32b55f,_0x11fb0c)[_0xf54e('0x5a')](function(_0x3733f5){logger['info'](_0xf54e('0xf5'),_0xf54e('0xf6')+_0x3c0755[_0xf54e('0x44')]+_0xf54e('0xf7')+_0x3c0755[_0xf54e('0x8f')],JSON[_0xf54e('0x29')](_0x3733f5));ami['emit']('custom:agentcalled',ut['buildObj'](_0x3c0755,_0xf54e('0xf8'),_0x459172[_0xf54e('0x3a')][_0x3c0755[_0xf54e('0x44')]]));_0x28d019(ut[_0xf54e('0x32')](_0xf54e('0xf9')));})['catch'](function(_0x31b2d6){ut[_0xf54e('0x35')]('[Preview][execCall][failure]',_0x31b2d6);_0x3da354(ut[_0xf54e('0x32')](_0xf54e('0xfa'),_0x5072aa,_0x187b1c));});}else{_0x484691[_0xf54e('0xfb')]+=0x1;ut['logBlacklist'](_0x3c0755);rpcDb[_0xf54e('0xfc')](_0x3c0755,_0xf54e('0xfd'));delete _0x459172[_0xf54e('0x15')][_0x3e0b67];_0x3da354(ut[_0xf54e('0x32')](_0xf54e('0xfe'),_0x5072aa,_0x187b1c));}});};Preview[_0xf54e('0xf')][_0xf54e('0x76')]=function(_0x370e59){return!_['isNil'](_0x370e59)&&!_[_0xf54e('0xf0')](_0x370e59['name'])&&!_[_0xf54e('0xf0')](_0x370e59[_0xf54e('0xff')])&&_0x370e59[_0xf54e('0xff')]&&!_[_0xf54e('0xf0')](this[_0xf54e('0x100')][util[_0xf54e('0x2a')](_0xf54e('0x101'),_0x370e59['name'])])&&!_['isNil'](this['trunks'][util[_0xf54e('0x2a')]('SIP/%s',_0x370e59[_0xf54e('0x2c')])]['status'])&&(this[_0xf54e('0x100')][util[_0xf54e('0x2a')]('SIP/%s',_0x370e59[_0xf54e('0x2c')])][_0xf54e('0x4e')]===_0xf54e('0x102')||this[_0xf54e('0x100')][util[_0xf54e('0x2a')](_0xf54e('0x101'),_0x370e59[_0xf54e('0x2c')])][_0xf54e('0x4e')]===_0xf54e('0x103'));};Preview[_0xf54e('0xf')][_0xf54e('0x5f')]=function(_0x5bc7ed,_0x26e18f){return this[_0xf54e('0x104')](_0x5bc7ed,_0x26e18f)[_0xf54e('0x5a')](function(_0x52226a){return _[_0xf54e('0x48')](_0x52226a,['message']);})[_0xf54e('0x50')](function(_0xc0d72a){if(_0xc0d72a[_0xf54e('0x105')]){rpcDb[_0xf54e('0x106')](_0x5bc7ed);}if(_0xc0d72a[_0xf54e('0xff')]){rpcDb[_0xf54e('0x62')](_0x5bc7ed);}throw _[_0xf54e('0x48')](_0xc0d72a,[_0xf54e('0x32')]);});};Preview[_0xf54e('0xf')][_0xf54e('0x104')]=function(_0x215277,_0x4a2222){var _0x50c424=this;var _0x47e3ae,_0x2bee3e;return rpcDb[_0xf54e('0x107')](_0x215277)[_0xf54e('0x5a')](function(_0x4c249a){if(!_[_0xf54e('0xf0')](_0x4c249a[0x0])){_0x2bee3e=_0x4c249a[0x0][_0xf54e('0x108')]?![]:!![];_0x47e3ae=_0x4c249a[0x0]['recallme']?!![]:![];_0x47e3ae=_0x4a2222?!![]:_0x47e3ae;}var _0x405254=_0x50c424[_0xf54e('0x109')](_0x4c249a);if(_0x405254[_0xf54e('0x10a')]){rpcDb[_0xf54e('0x10b')](_[_0xf54e('0x48')](_0x4c249a[0x0],[_0xf54e('0x4b'),_0xf54e('0x10c')]))['then'](function(_0x5369cd){_0x50c424[_0xf54e('0x10d')](_0x5369cd,_0x4c249a[0x0],_0x4a2222,_0x2bee3e,_0x47e3ae)[_0xf54e('0x5a')](function(_0x2ac04e){return _0x2ac04e;})[_0xf54e('0x50')](function(_0x53ae5c){throw _0x53ae5c;});})[_0xf54e('0x50')](function(_0x37c370){ut['logger'](_0xf54e('0x10e'),_0x37c370);throw ut['message'](_0xf54e('0x10f'),_0x2bee3e,_0x47e3ae);});}else{throw ut[_0xf54e('0x32')](_0x405254[_0xf54e('0x32')],_0x2bee3e,_0x47e3ae);}})[_0xf54e('0x50')](function(_0x4fb1ab){ut[_0xf54e('0x35')]('[Preview][getContactPreview]',_0x4fb1ab);throw ut[_0xf54e('0x32')](_0xf54e('0x10f'),![],!![]);});};Preview[_0xf54e('0xf')][_0xf54e('0x109')]=function(_0x5221d0){if(_['isNil'](_0x5221d0)||_[_0xf54e('0xf3')](_0x5221d0)||!_[_0xf54e('0xf0')](_0x5221d0[0x0][_0xf54e('0x5e')])&&_['isNil'](_0x5221d0[0x0][_0xf54e('0x5e')][_0xf54e('0x2c')])){ut['logger'](_0xf54e('0x110'),_0x5221d0);return{'isValid':![],'message':_0xf54e('0x111')};}var _0x3ea69c=this[_0xf54e('0x3a')][_0x5221d0[0x0][_0xf54e('0x112')][_0xf54e('0x2c')]];_0x3ea69c['message']=utils[_0xf54e('0x33')][_0xf54e('0x79')];if(_[_0xf54e('0xf0')](_0x3ea69c)){ut[_0xf54e('0x35')](_0xf54e('0x113'),_0x3ea69c);return{'isValid':![],'message':_0xf54e('0x114')};}if(!this[_0xf54e('0x76')](_0x3ea69c[_0xf54e('0x77')])){ut[_0xf54e('0x35')](_0xf54e('0x115'),_0xf54e('0x116')+_0x3ea69c[_0xf54e('0x2c')]+_0xf54e('0x117'));if(!this[_0xf54e('0x76')](_0x3ea69c[_0xf54e('0x118')])){ut[_0xf54e('0x35')](_0xf54e('0x115'),_0x3ea69c['name']+_0xf54e('0x119'));return{'isValid':![],'message':_0xf54e('0x11a')};}}if(!ut[_0xf54e('0x11b')](_0x3ea69c['dialActive'])){ut[_0xf54e('0x35')](_0xf54e('0x11c'),_0x3ea69c[_0xf54e('0x2c')]+_0xf54e('0x11d'));return{'isValid':![],'message':_0xf54e('0x116')+_0x3ea69c['name']+_0xf54e('0x11d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xf54e('0xf')][_0xf54e('0xf4')]=function(_0x505c0f,_0xcdc5ec,_0x171516,_0x2df876){var _0x4026ea=this;return new Promise(function(_0x1a0fc0,_0x459bbb){var _0x3770f3=_0x505c0f[_0xf54e('0xa4')];var _0x1ad56e=_0x4026ea['isTrunkReachable'](_0xcdc5ec[_0xf54e('0x77')])?util['format'](_0xf54e('0x11e'),_0xcdc5ec[_0xf54e('0x77')]['name'],_[_0xf54e('0xf0')](_0xcdc5ec['dialPrefix'])?'':_0xcdc5ec[_0xf54e('0x11f')][_0xf54e('0x120')]()||'',_0xcdc5ec['dialCutDigit']>0x0?_0x171516[_0xf54e('0x10c')][_0xf54e('0x121')](_0xcdc5ec['dialCutDigit']):_0x171516['phone']):util['format'](_0xf54e('0x11e'),_[_0xf54e('0xf0')](_0xcdc5ec[_0xf54e('0x118')])?_0xcdc5ec[_0xf54e('0x77')][_0xf54e('0x2c')]:_0xcdc5ec[_0xf54e('0x118')][_0xf54e('0x2c')],_[_0xf54e('0xf0')](_0xcdc5ec['dialPrefix'])?'':_0xcdc5ec['dialPrefix'][_0xf54e('0x120')]()||'',_0xcdc5ec[_0xf54e('0x122')]>0x0?_0x171516[_0xf54e('0x10c')][_0xf54e('0x121')](_0xcdc5ec[_0xf54e('0x122')]):_0x171516['phone']);var _0x3aa45f=_0x4026ea['isTrunkReachable'](_0xcdc5ec['Trunk'])?ut[_0xf54e('0x123')](_0xcdc5ec[_0xf54e('0x77')][_0xf54e('0x124')],_0xcdc5ec[_0xf54e('0x125')],_0xcdc5ec[_0xf54e('0x126')]>0x0?ut[_0xf54e('0x127')](_0xcdc5ec[_0xf54e('0x128')],_0xcdc5ec['dialRandomLastDigitCallerIdNumber']):_0xcdc5ec[_0xf54e('0x128')]):ut[_0xf54e('0x123')](_[_0xf54e('0xf0')](_0xcdc5ec[_0xf54e('0x118')])?_0xcdc5ec[_0xf54e('0x77')]['callerid']:_0xcdc5ec[_0xf54e('0x118')][_0xf54e('0x124')],_0xcdc5ec[_0xf54e('0x125')],_0xcdc5ec[_0xf54e('0x126')]>0x0?ut[_0xf54e('0x127')](_0xcdc5ec['dialOriginateCallerIdNumber'],_0xcdc5ec['dialRandomLastDigitCallerIdNumber']):_0xcdc5ec[_0xf54e('0x128')]);if(_0x3aa45f){_0x505c0f[_0xf54e('0x129')]=ut[_0xf54e('0x12a')](_0x3aa45f);_0x505c0f['originatecalleridnum']=ut[_0xf54e('0x12b')](_0x3aa45f);}var _0x2c2833=ut[_0xf54e('0x12c')](_0xcdc5ec,_0x171516,_0x1ad56e,_0x3aa45f,_0x3770f3,_0x505c0f);_[_0xf54e('0x12d')](_0x505c0f,ut['toLowerVariables'](_0x2c2833));_0x505c0f[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0xcdc5ec['variables']=_0x2c2833;var _0x34db40=ut[_0xf54e('0x12e')](_0x505c0f,_0xcdc5ec,_0x2c2833,_0x505c0f[_0xf54e('0x8c')],_0x2df876);return ami[_0xf54e('0x4d')](_0x34db40)[_0xf54e('0x5a')](function(_0x123f93){_0xcdc5ec[_0xf54e('0x2e')]+=0x1;logger[_0xf54e('0x27')]('[originated][increment]',_0x3770f3,_0xf54e('0x94'),_0xcdc5ec[_0xf54e('0x2c')],_0xf54e('0x45'),_0xcdc5ec[_0xf54e('0x2e')]);_0x1a0fc0(_0x123f93);})['catch'](function(_0x47b07a){ut['logAgent'](_0x505c0f,0xe,'OriginateError');rpcDb[_0xf54e('0xe4')](_0x505c0f,_0xf54e('0x12f'));_0x459bbb(_0x47b07a);});});};Preview[_0xf54e('0xf')]['syncNewExten']=function(_0x5a84b8){if(this[_0xf54e('0x15')][_0x5a84b8['linkedid']]){this[_0xf54e('0x15')][_0x5a84b8['linkedid']][_0xf54e('0x4f')]=_0x5a84b8[_0xf54e('0x4f')];}};Preview[_0xf54e('0xf')]['syncOriginateResponse']=function(_0x14ead8){var _0x260b7a=this;var _0x1487be=this[_0xf54e('0x15')][_0x14ead8['actionid']];if(_0x1487be){if(_0x1487be[_0xf54e('0xf2')]&&this[_0xf54e('0x16')][_0x1487be[_0xf54e('0xf2')]]){ut[_0xf54e('0x130')](_0x1487be,this[_0xf54e('0x16')][_0x1487be[_0xf54e('0xf2')]]['name'],this[_0xf54e('0x16')][_0x1487be['lookAgent']]['id']);}var _0x4d406a=_[_0xf54e('0x131')](_0x1487be);_0x4d406a['responsetime']=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));var _0x56411c=_0x260b7a['campaignsPreview'][_0x1487be[_0xf54e('0x44')]];if(ut['isFailure'](_0x14ead8[_0xf54e('0x132')])){if(_0x1487be[_0xf54e('0x8b')]){rpcDb['unlockContact'](_0x1487be[_0xf54e('0x8f')]);}if(_0x1487be['activeContact']){rpcDb[_0xf54e('0x62')](_0x1487be[_0xf54e('0x8f')]);}ami['emit'](_0xf54e('0x133'),ut[_0xf54e('0x96')](_0x1487be,_0xf54e('0x134'),this[_0xf54e('0x3a')][_0x1487be[_0xf54e('0x44')]]));this[_0xf54e('0xdf')](_0x4d406a,_0x56411c,_0x14ead8);}else{_0x1487be[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));ut['logAgent'](_0x4d406a,0x4,'Answer');rpcDb[_0xf54e('0xe4')](_0x4d406a,_0xf54e('0x135'));}}};Preview[_0xf54e('0xf')][_0xf54e('0x1b')]=function(_0x53d6cb){var _0x143b50=this[_0xf54e('0x15')][_0x53d6cb['linkedid']];var _0x3b25f4;if(_0x143b50){_0x3b25f4=this[_0xf54e('0x3a')][_0x143b50[_0xf54e('0x44')]];logger[_0xf54e('0x27')](_0xf54e('0x136'),_0x53d6cb[_0xf54e('0x8d')],_0xf54e('0x94'),_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);}if(this[_0xf54e('0x15')][_0x53d6cb['linkedid']]&&_0x53d6cb['linkedid']!==_0x53d6cb[_0xf54e('0xa4')]){if(_0x53d6cb[_0xf54e('0x137')]==='16'&&this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]][_0xf54e('0x47')]){this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb['linkedid'],_0x53d6cb[_0xf54e('0x137')]);}else if(this[_0xf54e('0x15')][_0x53d6cb['linkedid']][_0xf54e('0x47')]){logger[_0xf54e('0x27')](_0xf54e('0x138'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb['cause'],'\x20Queue',_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb['linkedid'],_0x53d6cb['cause']);}}else if(_0x143b50&&_[_0xf54e('0xf0')](_0x143b50[_0xf54e('0x139')])&&_0x3b25f4[_0xf54e('0x13a')]&&_0x53d6cb['linkedid']===_0x53d6cb[_0xf54e('0xa4')]&&_[_0xf54e('0xf0')](_0x53d6cb[_0xf54e('0xe2')])&&_0x53d6cb[_0xf54e('0x137')]==='16'&&_0x53d6cb['channelstate']==='6'&&_[_0xf54e('0xe1')](_0x143b50['transfer'])){if(_0x143b50[_0xf54e('0x8b')]){rpcDb[_0xf54e('0x106')](_0x143b50[_0xf54e('0x8f')]);}if(_0x143b50[_0xf54e('0x8c')]){rpcDb['disableContact'](_0x143b50[_0xf54e('0x8f')]);}_0x53d6cb[_0xf54e('0xe2')]='22';this[_0xf54e('0xdf')](_0x143b50,_0x3b25f4,_0x53d6cb);}else if(_0x143b50&&_0x143b50['transfer']){if(_0x53d6cb[_0xf54e('0x137')]==='16'&&this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]]['dialAnswer']){logger[_0xf54e('0x27')](_0xf54e('0x13b'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')],_0xf54e('0x94'),_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')]);}else if(this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]][_0xf54e('0x47')]){logger[_0xf54e('0x27')](_0xf54e('0x138'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')],'\x20Queue',_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')]);}}};Preview[_0xf54e('0xf')][_0xf54e('0x13c')]=function(_0x429793){if(this[_0xf54e('0x15')][_0x429793[_0xf54e('0xdd')]]&&_0x429793[_0xf54e('0xdd')]!==_0x429793[_0xf54e('0x13d')]){this[_0xf54e('0x7a')](_0x429793,_0x429793[_0xf54e('0xdd')],_0x429793[_0xf54e('0xd5')]);}};Preview['prototype'][_0xf54e('0x1d')]=function(_0x28a3f8){if(this[_0xf54e('0x15')][_0x28a3f8[_0xf54e('0x8d')]]&&_0x28a3f8['linkedid']!==_0x28a3f8[_0xf54e('0xa4')]&&!this[_0xf54e('0x15')][_0x28a3f8['linkedid']][_0xf54e('0x47')]){if(_0x28a3f8[_0xf54e('0x137')]==='1'){this[_0xf54e('0x7a')](_0x28a3f8,_0x28a3f8[_0xf54e('0x8d')],_0x28a3f8[_0xf54e('0x137')]);}}};Preview[_0xf54e('0xf')][_0xf54e('0x13e')]=function(_0x22f8ad,_0x269670,_0x17801c){if(this['actions'][_0x22f8ad]){if(_[_0xf54e('0xf0')](this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')])){this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')]={};}this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')][_0x269670]=_0x17801c;}};Preview['prototype'][_0xf54e('0x21')]=function(_0x397e6c){try{if(!_[_0xf54e('0xf0')](_0x397e6c)){if(ut[_0xf54e('0x140')](_[_0xf54e('0x141')](_0x397e6c[_0xf54e('0x142')])[0x0])){this[_0xf54e('0x13e')](_0x397e6c[_0xf54e('0xa4')],_[_0xf54e('0x141')](_0x397e6c[_0xf54e('0x142')])[0x0],_0x397e6c['value']);}}}catch(_0xb1e536){logger[_0xf54e('0x143')]('[syncVarSet][Preview]',util['inspect'](_0xb1e536,{'showHidden':![],'depth':null}));}};Preview[_0xf54e('0xf')][_0xf54e('0x23')]=function(_0x232195){if(_0x232195){if(this[_0xf54e('0x15')][_0x232195[_0xf54e('0x144')]]){this[_0xf54e('0x15')][_0x232195[_0xf54e('0x144')]][_0xf54e('0x145')]=!![];}}};Preview[_0xf54e('0xf')][_0xf54e('0x146')]=function(_0x56b18a){if(_0x56b18a){if(this[_0xf54e('0x15')][_0x56b18a[_0xf54e('0x147')]]){this['actions'][_0x56b18a['transfererlinkedid']][_0xf54e('0x145')]=!![];}}};module[_0xf54e('0x148')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ddac04a..5f1b384 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 _0xf78a=['[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','UserId','active','[rescheduleContact]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList'];(function(_0x3611ca,_0x4620b0){var _0x36912b=function(_0x50fb92){while(--_0x50fb92){_0x3611ca['push'](_0x3611ca['shift']());}};_0x36912b(++_0x4620b0);}(_0xf78a,0x136));var _0xaf78=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0xf78a[_0x509c83];return _0x534626;};'use strict';var util=require(_0xaf78('0x0'));var BPromise=require('bluebird');var logger=require(_0xaf78('0x1'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xaf78('0x2'));var voiceQueueReport=require(_0xaf78('0x3'));function loggerCatch(_0x2bc380){return function(_0x5cb29d){logger[_0xaf78('0x4')](_0x2bc380,util['inspect'](_0x5cb29d,{'showHidden':![],'depth':null}));};}function create(_0x1fa34e){return cmHopperHistory[_0xaf78('0x5')](_0x1fa34e)[_0xaf78('0x6')](loggerCatch(_0xaf78('0x7')));}function createAgent(_0x2d3f0e){return BPromise[_0xaf78('0x8')]()[_0xaf78('0x9')](agentReportPreview['createHistory'](_0x2d3f0e))[_0xaf78('0x6')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x545aca){return cmHopper[_0xaf78('0xa')](_0x545aca,!![])[_0xaf78('0x6')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xaf78('0xb')]=function(_0x213307){return cmHopperBlack[_0xaf78('0xb')](_0x213307)[_0xaf78('0x6')](loggerCatch(_0xaf78('0xc')));};exports[_0xaf78('0xd')]=function(_0x7e8d79){return BPromise[_0xaf78('0x8')]()[_0xaf78('0x9')](cmHopper[_0xaf78('0xd')](_0x7e8d79))['catch'](loggerCatch(_0xaf78('0xe')));};exports[_0xaf78('0x5')]=function(_0x7d769b,_0x542160){create(_0x7d769b)[_0xaf78('0x6')](loggerCatch(_0x542160));moveContact(_0x7d769b)[_0xaf78('0x6')](loggerCatch(_0x542160));};exports['createAgentHistory']=function(_0x55459a,_0x3d4507){createAgent(_0x55459a)['catch'](loggerCatch(_0x3d4507));};exports['createCustomerHistory']=function(_0x12aa49,_0x325ec9){create(_0x12aa49)[_0xaf78('0x6')](loggerCatch(_0x325ec9));};exports['createCustomerFinal']=function(_0x543301,_0x1f412b){moveContact(_0x543301)['catch'](loggerCatch(_0x1f412b));};exports[_0xaf78('0xf')]=function(_0x37100e,_0x1acecb,_0x35dea6){if(_0x1acecb){_0x37100e[_0xaf78('0x10')]=null;}if(_0x35dea6){_0x37100e[_0xaf78('0x11')]=![];}return cmHopper[_0xaf78('0xf')](_0x37100e)['catch'](loggerCatch(_0xaf78('0x12')));};exports['countReScheduled']=function(_0x429926){return cmHopper['countReScheduled'](_0x429926)[_0xaf78('0x6')](loggerCatch('[countReScheduled]\x20'));};exports[_0xaf78('0x13')]=function(_0x846f98){return cmHopper[_0xaf78('0x13')]({'UserId':null},_0x846f98,0x1)[_0xaf78('0x6')](loggerCatch('[unlockContact]\x20'));};exports[_0xaf78('0x14')]=function(_0x5dc0b8){return cmHopper[_0xaf78('0x13')]({'active':![]},_0x5dc0b8,0x1)[_0xaf78('0x6')](loggerCatch(_0xaf78('0x15')));};exports[_0xaf78('0x16')]=function(_0x4e2587){var _0x4a5a4d={};_0x4a5a4d['type']=_0x4e2587[_0xaf78('0x17')];_0x4a5a4d[_0xaf78('0x18')]=_0x4e2587['uniqueid'];_0x4a5a4d[_0xaf78('0x19')]=_0x4e2587[_0xaf78('0x19')];_0x4a5a4d[_0xaf78('0x1a')]=_0x4e2587[_0xaf78('0x1a')];_0x4a5a4d['queue']=_0x4e2587['queue'];_0x4a5a4d[_0xaf78('0x1b')]=_0x4e2587[_0xaf78('0x1c')];_0x4a5a4d['queuecallerleaveAt']=_0x4e2587[_0xaf78('0x1c')];_0x4a5a4d[_0xaf78('0x1d')]=0x1;_0x4a5a4d[_0xaf78('0x1e')]=_0x4e2587[_0xaf78('0x1f')];_0x4a5a4d[_0xaf78('0x20')]=_0x4e2587[_0xaf78('0x21')];_0x4a5a4d[_0xaf78('0x22')]=_0xaf78('0x23');_0x4a5a4d['exten']=_0xaf78('0x24');_0x4a5a4d[_0xaf78('0x25')]=0x0;_0x4a5a4d[_0xaf78('0x26')]=0x1;_0x4a5a4d['lastAssignedTo']=_0x4e2587[_0xaf78('0x21')];_0x4a5a4d[_0xaf78('0x27')]=_0xaf78('0x28');return BPromise['resolve']()[_0xaf78('0x9')](voiceQueueReport[_0xaf78('0x29')](_0x4a5a4d))[_0xaf78('0x6')](loggerCatch(_0xaf78('0x2a')));};exports[_0xaf78('0x2b')]=function(_0xd5dfa0,_0x26717b){return BPromise[_0xaf78('0x8')]()[_0xaf78('0x9')](cmHopper[_0xaf78('0x2b')](_0xd5dfa0,_0x26717b))[_0xaf78('0x6')](loggerCatch(_0xaf78('0x2c')));};exports['rescheduleContactInQueue']=function(_0x5ac4d1){return cmHopper[_0xaf78('0xf')](_0x5ac4d1,!![],!![])[_0xaf78('0x6')](loggerCatch(_0xaf78('0x2d')));}; \ No newline at end of file +var _0xca83=['connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','resolve','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','createHistory','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime'];(function(_0x50e316,_0x36d6aa){var _0x261299=function(_0xafc1ee){while(--_0xafc1ee){_0x50e316['push'](_0x50e316['shift']());}};_0x261299(++_0x36d6aa);}(_0xca83,0x79));var _0x3ca8=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xca83[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0x3ca8('0x0'));var BPromise=require('bluebird');var logger=require(_0x3ca8('0x1'))(_0x3ca8('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x3ca8('0x3'));var cmHopperBlack=require(_0x3ca8('0x4'));var agentReportPreview=require(_0x3ca8('0x5'));var voiceQueueReport=require(_0x3ca8('0x6'));function loggerCatch(_0x4a3ca0){return function(_0x18512d){logger[_0x3ca8('0x7')](_0x4a3ca0,util[_0x3ca8('0x8')](_0x18512d,{'showHidden':![],'depth':null}));};}function create(_0xcc34a1){return cmHopperHistory['createHistory'](_0xcc34a1)[_0x3ca8('0x9')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x58028c){return BPromise['resolve']()['then'](agentReportPreview[_0x3ca8('0xa')](_0x58028c))[_0x3ca8('0x9')](loggerCatch(_0x3ca8('0xb')));}function moveContact(_0x3e1a21){return cmHopper['moveContactManagedDialer'](_0x3e1a21,!![])['catch'](loggerCatch(_0x3ca8('0xc')));}exports['checkIsBlackList']=function(_0x161441){return cmHopperBlack[_0x3ca8('0xd')](_0x161441)[_0x3ca8('0x9')](loggerCatch(_0x3ca8('0xe')));};exports[_0x3ca8('0xf')]=function(_0x50ac63){return BPromise['resolve']()[_0x3ca8('0x10')](cmHopper[_0x3ca8('0xf')](_0x50ac63))['catch'](loggerCatch(_0x3ca8('0x11')));};exports[_0x3ca8('0xa')]=function(_0x44073d,_0x337bef){create(_0x44073d)[_0x3ca8('0x9')](loggerCatch(_0x337bef));moveContact(_0x44073d)['catch'](loggerCatch(_0x337bef));};exports[_0x3ca8('0x12')]=function(_0x43a8db,_0x2bb378){createAgent(_0x43a8db)['catch'](loggerCatch(_0x2bb378));};exports['createCustomerHistory']=function(_0x5f0c63,_0x1f973e){create(_0x5f0c63)[_0x3ca8('0x9')](loggerCatch(_0x1f973e));};exports[_0x3ca8('0x13')]=function(_0x40783f,_0x408109){moveContact(_0x40783f)[_0x3ca8('0x9')](loggerCatch(_0x408109));};exports[_0x3ca8('0x14')]=function(_0x1d2930,_0x5acc86,_0x54003b){if(_0x5acc86){_0x1d2930[_0x3ca8('0x15')]=null;}if(_0x54003b){_0x1d2930['active']=![];}return cmHopper[_0x3ca8('0x14')](_0x1d2930)[_0x3ca8('0x9')](loggerCatch(_0x3ca8('0x16')));};exports[_0x3ca8('0x17')]=function(_0x53fc1a){return cmHopper[_0x3ca8('0x17')](_0x53fc1a)[_0x3ca8('0x9')](loggerCatch(_0x3ca8('0x18')));};exports[_0x3ca8('0x19')]=function(_0x17847b){return cmHopper[_0x3ca8('0x19')]({'UserId':null},_0x17847b,0x1)[_0x3ca8('0x9')](loggerCatch(_0x3ca8('0x1a')));};exports['disableContact']=function(_0xb8f636){return cmHopper[_0x3ca8('0x19')]({'active':![]},_0xb8f636,0x1)[_0x3ca8('0x9')](loggerCatch(_0x3ca8('0x1b')));};exports[_0x3ca8('0x1c')]=function(_0x164653){var _0x5c17a0={};_0x5c17a0[_0x3ca8('0x1d')]=_0x164653['type'];_0x5c17a0['uniqueid']=_0x164653[_0x3ca8('0x1e')];_0x5c17a0[_0x3ca8('0x1f')]=_0x164653['calleridnum'];_0x5c17a0[_0x3ca8('0x20')]=_0x164653['calleridname'];_0x5c17a0[_0x3ca8('0x21')]=_0x164653[_0x3ca8('0x21')];_0x5c17a0['queuecallerjoinAt']=_0x164653[_0x3ca8('0x22')];_0x5c17a0[_0x3ca8('0x23')]=_0x164653[_0x3ca8('0x22')];_0x5c17a0[_0x3ca8('0x24')]=0x1;_0x5c17a0['queuecallercompleteAt']=_0x164653[_0x3ca8('0x25')];_0x5c17a0[_0x3ca8('0x26')]=_0x164653[_0x3ca8('0x27')];_0x5c17a0[_0x3ca8('0x28')]=_0x3ca8('0x29');_0x5c17a0[_0x3ca8('0x2a')]='xcally-motion-preview';_0x5c17a0[_0x3ca8('0x2b')]=0x0;_0x5c17a0[_0x3ca8('0x2c')]=0x1;_0x5c17a0[_0x3ca8('0x2d')]=_0x164653[_0x3ca8('0x27')];_0x5c17a0[_0x3ca8('0x2e')]=_0x3ca8('0x2f');return BPromise['resolve']()[_0x3ca8('0x10')](voiceQueueReport[_0x3ca8('0x30')](_0x5c17a0))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x3ca8('0x31')]=function(_0x55a82d,_0x43ffda){return BPromise[_0x3ca8('0x32')]()[_0x3ca8('0x10')](cmHopper[_0x3ca8('0x31')](_0x55a82d,_0x43ffda))[_0x3ca8('0x9')](loggerCatch(_0x3ca8('0x33')));};exports[_0x3ca8('0x34')]=function(_0x1ddd75){return cmHopper[_0x3ca8('0x14')](_0x1ddd75,!![],!![])[_0x3ca8('0x9')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 54b0b9a..6a41b27 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 _0x5e70=['originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','voice','mandatoryDisposition','buildObj','buildAcw','not_inuse','status','reachable','milliseconds','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countcongestionretry','countnoanswerretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','extractCalleridNumber','match','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','info','inspect','loggerError','message','isEmpty','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','name','format','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','endtime','logAgent','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','responsetime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x5e70,0xda));var _0x05e7=function(_0x14cc9d,_0x138641){_0x14cc9d=_0x14cc9d-0x0;var _0x28fee3=_0x5e70[_0x14cc9d];return _0x28fee3;};'use strict';var util=require('util');var _=require(_0x05e7('0x0'));var moment=require(_0x05e7('0x1'));var logger=require(_0x05e7('0x2'))(_0x05e7('0x3'));var ipAgi=process[_0x05e7('0x4')][_0x05e7('0x5')]||_0x05e7('0x6');var utils=require(_0x05e7('0x7'));exports['loggerCatch']=function(_0x560099){return function(_0x4e5f54){logger['error'](_0x560099,util['inspect'](_0x4e5f54,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4772d8,_0x36b57d){logger[_0x05e7('0x8')](_0x4772d8,util[_0x05e7('0x9')](_0x36b57d,{'showHidden':![],'depth':null}));};exports[_0x05e7('0xa')]=function(_0x110fc0,_0x2c1333){logger['error'](_0x110fc0,util[_0x05e7('0x9')](_0x2c1333,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x35c0da){return function(_0x116128){logger[_0x05e7('0x8')](_0x35c0da,util[_0x05e7('0x9')](_0x116128,{'showHidden':![],'depth':null}));};};exports[_0x05e7('0xb')]=function(_0x52e884,_0x50a968,_0x56a12c){return{'message':_0x52e884,'unlock':_0x50a968,'active':_0x56a12c};};exports['getCallerId']=function(_0x1bcabb,_0x1f3fd6,_0x2b08ba){if(!_['isUndefined'](_0x2b08ba)&&'string'===typeof _0x2b08ba&&!_[_0x05e7('0xc')](_0x2b08ba)){if(!_['isUndefined'](_0x1f3fd6)&&_0x05e7('0xd')===typeof _0x1f3fd6&&!_['isEmpty'](_0x1f3fd6)){return util['format']('\x22%s\x22\x20<%s>',_0x1f3fd6,_0x2b08ba);}return util['format'](_0x05e7('0xe'),_0x2b08ba,_0x2b08ba);}if(!_['isUndefined'](_0x1bcabb)&&'string'===typeof _0x1bcabb&&!_[_0x05e7('0xc')](_0x1bcabb)){return _0x1bcabb;}return _0x05e7('0xf');};exports['isActive']=function(_0x52783d){if(_[_0x05e7('0x10')](_0x52783d)){return![];}return _0x52783d;};exports[_0x05e7('0x11')]=function(_0x8c924,_0x35877d,_0x15c632,_0x53a3b9,_0x35b788,_0x3879dd){var _0x31d6d4={'XMD-QUEUE':_0x35877d['Queue']?_0x35877d['Queue'][_0x05e7('0x12')]:'','XMD-CALLERID':_0x53a3b9,'XMD-CALLERID-PREVIEW':_0x3879dd?util[_0x05e7('0x13')](_0x05e7('0xe'),_0x3879dd[_0x05e7('0x14')],_0x3879dd[_0x05e7('0x15')]):_0x53a3b9,'XMD-DIALID':_0x35b788,'XMD-CONTACTID':_0x35877d[_0x05e7('0x16')],'XMD-CDRTYPE':_0x05e7('0x17'),'CALLERID(all)':_0x53a3b9,'XMD-VOICEQUEUEID':_0x35877d['VoiceQueueId'],'XMD-DIALCHANNEL':_0x15c632,'XMD-DIALTIMEOUT':_0x8c924[_0x05e7('0x18')]||0x1e,'XMD-DIALOPTIONS':util[_0x05e7('0x13')](_0x05e7('0x19'),_0x8c924[_0x05e7('0x1a')]?'g':'',_[_0x05e7('0xc')](_0x8c924[_0x05e7('0x1b')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x8c924['dialPreviewUrl']||'','XMD-AGI':_0x8c924[_0x05e7('0x1c')]?util[_0x05e7('0x13')](_0x05e7('0x1d'),ipAgi,_0x8c924[_0x05e7('0x1c')]):_0x05e7('0x1e'),'XMD-AGIAFTER':_0x8c924['dialQueueProject2']?util[_0x05e7('0x13')](_0x05e7('0x1d'),ipAgi,_0x8c924[_0x05e7('0x1a')]):_0x05e7('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x3879dd?_0x3879dd[_0x05e7('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x3879dd?_0x3879dd[_0x05e7('0x20')]:'','XMD-DESTINATION':_0x05e7('0x21'),'SIPADDHEADER':_0x05e7('0x22')};if(!_[_0x05e7('0xc')](_0x8c924[_0x05e7('0x1b')])){_0x31d6d4[util['format']('%s',_0x05e7('0x23'))]=_0x8c924[_0x05e7('0x1b')];_0x31d6d4[util[_0x05e7('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x35b788;}if(_0x35877d&&_0x35877d[_0x05e7('0x24')]){for(var _0x4b87f0 in _0x35877d['Contact']){if(_0x35877d[_0x05e7('0x24')]['hasOwnProperty'](_0x4b87f0)){if(!_[_0x05e7('0x10')](_0x35877d[_0x05e7('0x24')][_0x4b87f0])&&_0x4b87f0!=='id'&&_0x4b87f0!==_0x05e7('0x25')&&_0x4b87f0!=='createdAt'&&_0x4b87f0!=='updatedAt'){_0x31d6d4[util[_0x05e7('0x13')](_0x05e7('0x26'),_0x05e7('0x27'),_[_0x05e7('0x28')](_0x4b87f0))]=_0x35877d['Contact'][_0x4b87f0];}}}}return _0x31d6d4;};exports[_0x05e7('0x29')]=function(_0x5bc907){var _0x1b6792={};for(var _0x409b12 in _0x5bc907){if(_0x5bc907['hasOwnProperty'](_0x409b12)){_0x1b6792[util[_0x05e7('0x13')]('%s',_[_0x05e7('0x2a')](_0x409b12))]=_0x5bc907[_0x409b12];}}return{'variables':_0x1b6792};};exports[_0x05e7('0x2b')]=function(_0x444512,_0x20cfa6){if(!_[_0x05e7('0x10')](_0x444512)){if(_0x444512[_0x05e7('0x2c')](_0x05e7('0x2d'))){if(_0x444512[_0x05e7('0x2d')]>0x0){_0x444512['originated']-=0x1;}else{logger[_0x05e7('0x2e')](_0x05e7('0x2f'),_0x20cfa6);}}}else{logger[_0x05e7('0x2e')](_0x05e7('0x30'),_0x20cfa6);}};exports['logBlacklist']=function(_0x241c90){var _0x41d2d3=moment()[_0x05e7('0x13')](_0x05e7('0x31'));_0x241c90[_0x05e7('0x32')]=0xd;_0x241c90[_0x05e7('0x33')]=_0x05e7('0x34');_0x241c90['starttime']=_0x41d2d3;_0x241c90['responsetime']=_0x41d2d3;_0x241c90[_0x05e7('0x35')]=_0x41d2d3;};exports[_0x05e7('0x36')]=function(_0x6c7d53,_0x33fda0,_0x11d3f4){var _0x128378=moment()[_0x05e7('0x13')](_0x05e7('0x31'));_0x6c7d53['state']=_0x33fda0;_0x6c7d53[_0x05e7('0x33')]=_0x11d3f4;_0x6c7d53['responsetime']=_0x128378;_0x6c7d53[_0x05e7('0x37')]=utils[_0x05e7('0x38')](_0x6c7d53['responsetime'],_0x6c7d53[_0x05e7('0x39')]);};exports[_0x05e7('0x3a')]=function(_0x9104fd,_0x4e6f1d,_0x298e8d){_0x9104fd[_0x05e7('0x3b')]=_0x4e6f1d;_0x9104fd[_0x05e7('0x3c')]=_0x298e8d;};exports[_0x05e7('0x3d')]=function(_0x4c3732,_0x265668,_0x382b47){var _0x4ec01b=moment()[_0x05e7('0x13')](_0x05e7('0x31'));_0x4c3732[_0x05e7('0x32')]=_0x265668;_0x4c3732[_0x05e7('0x33')]=_0x382b47;_0x4c3732[_0x05e7('0x3e')]=_0x4c3732[_0x05e7('0x3e')]?_0x4c3732[_0x05e7('0x3e')]:_0x4ec01b;_0x4c3732[_0x05e7('0x35')]=_0x4c3732[_0x05e7('0x35')]?_0x4c3732['endtime']:_0x4ec01b;_0x4c3732[_0x05e7('0x37')]=utils['getSeconds'](_0x4c3732[_0x05e7('0x3e')]||0x0,_0x4c3732[_0x05e7('0x39')]||0x0);_0x4c3732[_0x05e7('0x3f')]=_0x4c3732[_0x05e7('0x40')]?utils['getSeconds'](_0x4c3732[_0x05e7('0x35')],_0x4c3732[_0x05e7('0x40')]):0x0;};exports[_0x05e7('0x41')]=function(_0x56e30e){return _0x56e30e==='Failure';};exports[_0x05e7('0x42')]=function(_0x16aa34,_0x41b1dd,_0x189709,_0x26245f,_0x5cb4f2){var _0x43ed14=_0x26245f?_0x05e7('0x43'):_0x16aa34[_0x05e7('0x14')];_0x43ed14=_0x5cb4f2?_0x05e7('0x44'):_0x43ed14;return{'actionid':_0x16aa34[_0x05e7('0x45')],'action':_0x05e7('0x46'),'channel':_0x16aa34[_0x05e7('0x47')],'callerid':util[_0x05e7('0x13')](_0x05e7('0xe'),_0x43ed14,_0x16aa34['calleridnum']),'Exten':_0x05e7('0x21'),'Context':_0x05e7('0x48'),'Priority':'1','variable':_0x189709,'timeout':(_0x41b1dd[_0x05e7('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x16aa34['uniqueid']};};exports[_0x05e7('0x4a')]=function(_0x5bf278){return _0x5bf278[_0x05e7('0x4b')]+_0x5bf278['countcongestionretry']+_0x5bf278['countnoanswerretry']+_0x5bf278[_0x05e7('0x4c')]+_0x5bf278[_0x05e7('0x4d')];};exports[_0x05e7('0x4e')]=function(_0x2779aa){var _0x6bd78f=_['clone'](_0x2779aa);_0x6bd78f[_0x05e7('0x32')]=0xf;_0x6bd78f['statedesc']=_0x05e7('0x4f');return _0x6bd78f;};exports[_0x05e7('0x50')]=function(_0xce5fa7,_0x280f45,_0x3da4ec){var _0x4bf302={};_0x4bf302[_0x280f45]=_0xce5fa7[_0x280f45];_0x4bf302[_0x05e7('0x51')]=![];_0x4bf302[_0x05e7('0x52')]=moment()[_0x05e7('0x53')](_0x3da4ec,_0x05e7('0x54'))[_0x05e7('0x13')](_0x05e7('0x31'));_0x4bf302[_0x05e7('0x16')]=_0xce5fa7[_0x05e7('0x16')];_0x4bf302[_0x05e7('0x55')]=_0xce5fa7[_0x05e7('0x55')];_0x4bf302[_0x05e7('0x56')]=_0xce5fa7[_0x05e7('0x56')]||undefined;return _0x4bf302;};exports[_0x05e7('0x57')]=function(_0x5d3736,_0x43bdd3){if(!_['isNil'](_0x5d3736)){if(_0x5d3736[_0x05e7('0x58')]>0x0){_0x5d3736['pTalking']-=0x1;}else{logger[_0x05e7('0x2e')](_0x43bdd3,_0x05e7('0x59'));}}else{logger['error'](_0x43bdd3,_0x05e7('0x5a'));}};exports[_0x05e7('0x5b')]=function(_0xdeb392){if(_0xdeb392<=0x0){return!![];}return![];};function buildObj(_0x13a420,_0x2f9a63,_0x22c43b){_0x13a420[_0x05e7('0x5c')]=_0x2f9a63;_0x13a420[_0x05e7('0x12')]=_0x13a420[_0x05e7('0x5d')];_0x13a420[_0x05e7('0x5e')]=_0x13a420[_0x05e7('0x47')];_0x13a420['motionChannel']=_0x05e7('0x5f');if(_0x22c43b){_0x13a420[_0x05e7('0x60')]=_0x22c43b[_0x05e7('0x60')];}return _0x13a420;}exports[_0x05e7('0x61')]=buildObj;exports[_0x05e7('0x62')]=function(_0x1eb0d7){var _0x4efddb={};_0x4efddb[_0x05e7('0x5d')]=_0x1eb0d7[_0x05e7('0x5d')];_0x4efddb[_0x05e7('0x5e')]=_0x1eb0d7[_0x05e7('0x47')];_0x4efddb[_0x05e7('0x45')]=_0x1eb0d7[_0x05e7('0x45')];return _0x4efddb;};exports['agentReadyId']=function(_0x586353){var _0xd90bde=[];for(var _0x17a067 in _0x586353){if(_0x586353[_0x05e7('0x2c')](_0x17a067)){if(!_[_0x05e7('0x10')](_0x586353[_0x17a067])&&_0x586353[_0x17a067][_0x05e7('0x32')]===_0x05e7('0x63')&&_0x586353[_0x17a067][_0x05e7('0x64')]===_0x05e7('0x65')){_0xd90bde['push'](_0x586353[_0x17a067]['id']);}}}return _0xd90bde;};exports['getDiff']=function(_0x3d4b9e){var _0x1cdede=moment()['milliseconds'](0x0);var _0x41425c=moment(_0x3d4b9e)[_0x05e7('0x66')](0x0);return _0x1cdede['diff'](_0x41425c,_0x05e7('0x67'));};exports[_0x05e7('0x68')]=function(_0x2da27b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2da27b[_0x05e7('0x16')],'ListId':_0x2da27b[_0x05e7('0x55')],'VoiceQueueId':_0x2da27b['VoiceQueueId']||undefined,'CampaignId':_0x2da27b['CampaignId']||undefined};};exports[_0x05e7('0x69')]=function(_0x3b0ef7){if(_0x3b0ef7===_0x05e7('0x45')||_0x3b0ef7===_0x05e7('0x6a')||_0x3b0ef7===_0x05e7('0x5d')||_0x3b0ef7===_0x05e7('0x6b')||_0x3b0ef7===_0x05e7('0x6c')||_0x3b0ef7===_0x05e7('0x6d')||_0x3b0ef7===_0x05e7('0x3b')||_0x3b0ef7===_0x05e7('0x47')||_0x3b0ef7===_0x05e7('0x14')||_0x3b0ef7==='active'||_0x3b0ef7===_0x05e7('0x15')||_0x3b0ef7===_0x05e7('0x52')||_0x3b0ef7==='countbusyretry'||_0x3b0ef7===_0x05e7('0x6e')||_0x3b0ef7===_0x05e7('0x6f')||_0x3b0ef7===_0x05e7('0x70')||_0x3b0ef7===_0x05e7('0x71')||_0x3b0ef7==='callbackuniqueid'||_0x3b0ef7===_0x05e7('0x72')||_0x3b0ef7===_0x05e7('0x73')||_0x3b0ef7==='ContactId'||_0x3b0ef7===_0x05e7('0x55')||_0x3b0ef7===_0x05e7('0x3c')||_0x3b0ef7===_0x05e7('0x56')||_0x3b0ef7===_0x05e7('0x74')||_0x3b0ef7==='xmd-voicequeueid'||_0x3b0ef7==='xmd-queue'||_0x3b0ef7==='xmd-phone'||_0x3b0ef7==='xmd-listid'||_0x3b0ef7===_0x05e7('0x75')||_0x3b0ef7===_0x05e7('0x76')||_0x3b0ef7===_0x05e7('0x77')||_0x3b0ef7==='xmd-dialid'||_0x3b0ef7==='xmd-dialchannel'||_0x3b0ef7==='xmd-contactid'||_0x3b0ef7===_0x05e7('0x78')||_0x3b0ef7==='xmd-callerid'||_0x3b0ef7===_0x05e7('0x79')||_0x3b0ef7===_0x05e7('0x7a')||_0x3b0ef7===_0x05e7('0x7b')||_0x3b0ef7===_0x05e7('0x7c')||_0x3b0ef7===_0x05e7('0x7d')||_0x3b0ef7==='rtpaudioqosjitterbridged'||_0x3b0ef7===_0x05e7('0x7e')||_0x3b0ef7===_0x05e7('0x7f')||_0x3b0ef7===_0x05e7('0x80')||_0x3b0ef7===_0x05e7('0x81')||_0x3b0ef7==='rtpaudioqos'||_0x3b0ef7===_0x05e7('0x7c')||_0x3b0ef7==='rtpaudioqosjitter'||_0x3b0ef7===_0x05e7('0x82')||_0x3b0ef7===_0x05e7('0x7e')||_0x3b0ef7===_0x05e7('0x7f')||_0x3b0ef7==='rtpaudioqosrtt'||_0x3b0ef7===_0x05e7('0x81')||_0x3b0ef7===_0x05e7('0x83')||_0x3b0ef7===_0x05e7('0x84')||_0x3b0ef7===_0x05e7('0x32')||_0x3b0ef7===_0x05e7('0x33')){return![];}return!![];};exports[_0x05e7('0x85')]=function(_0x84e422,_0x1f0cd8){var _0x46ba3a,_0x750c5e,_0x4aebaa;if(_0x1f0cd8<=0x0){_0x1f0cd8=0x1;}_0x46ba3a=new RegExp(_0x05e7('0x86')+_0x1f0cd8+'}$');_0x750c5e=Math[_0x05e7('0x87')](0xa,_0x1f0cd8-0x1);_0x4aebaa=Math[_0x05e7('0x87')](0xa,_0x1f0cd8)-0x1;return util[_0x05e7('0x13')]('%s',_['replace'](_0x84e422,_0x46ba3a,_['random'](_0x750c5e,_0x4aebaa)));};exports[_0x05e7('0x88')]=function(_0x41e013){var _0x1064ea=_0x41e013['match'](/"(.*?)"/);return _0x1064ea?_0x1064ea[0x1]:_0x41e013;};exports[_0x05e7('0x89')]=function(_0x1d79a0){var _0x196765=_0x1d79a0[_0x05e7('0x8a')](/<(.*?)>/);return _0x196765?_0x196765[0x1]:_0x1d79a0;};function buildNoAnswerEventPayload(_0x29b682,_0x3478b9){var _0x217c25=buildObj(_0x29b682,'noanswer');if(!_['isEmpty'](_0x3478b9[_0x05e7('0x8b')])){Object[_0x05e7('0x8c')](_0x3478b9[_0x05e7('0x8b')])[_0x05e7('0x8d')](function(_0x8ea397){_0x217c25[_0x8ea397[_0x05e7('0x8e')]()]=_0x3478b9[_0x05e7('0x8b')][_0x8ea397];});}return _0x217c25;}exports[_0x05e7('0x8f')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x0f02=['mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','push','getDiff','milliseconds','diff','seconds','ListId','CampaignId','idContact','type','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','preview','XCALLY_IP_AGI','127.0.0.1','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','dialQueueProject2','\x22agi://%s/square,%s\x22','NONE','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','getSeconds','membername','UserId','logCustomer','isFailure','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','channelAgent','motionChannel','voice'];(function(_0x29e539,_0x37e2fe){var _0x5e8e83=function(_0x571ca1){while(--_0x571ca1){_0x29e539['push'](_0x29e539['shift']());}};_0x5e8e83(++_0x37e2fe);}(_0x0f02,0x158));var _0x20f0=function(_0x1bf5da,_0x389e1b){_0x1bf5da=_0x1bf5da-0x0;var _0x4a67f7=_0x0f02[_0x1bf5da];return _0x4a67f7;};'use strict';var util=require(_0x20f0('0x0'));var _=require('lodash');var moment=require(_0x20f0('0x1'));var logger=require('../../../../config/logger')(_0x20f0('0x2'));var ipAgi=process['env'][_0x20f0('0x3')]||_0x20f0('0x4');var utils=require('../../dialer/utils');exports[_0x20f0('0x5')]=function(_0x69a527){return function(_0x3b65ab){logger['error'](_0x69a527,util[_0x20f0('0x6')](_0x3b65ab,{'showHidden':![],'depth':null}));};};exports[_0x20f0('0x7')]=function(_0x3be202,_0x388215){logger[_0x20f0('0x8')](_0x3be202,util[_0x20f0('0x6')](_0x388215,{'showHidden':![],'depth':null}));};exports[_0x20f0('0x9')]=function(_0x53080c,_0x28d6ac){logger[_0x20f0('0xa')](_0x53080c,util[_0x20f0('0x6')](_0x28d6ac,{'showHidden':![],'depth':null}));};exports[_0x20f0('0xb')]=function(_0x1325de){return function(_0x19f9da){logger['info'](_0x1325de,util[_0x20f0('0x6')](_0x19f9da,{'showHidden':![],'depth':null}));};};exports[_0x20f0('0xc')]=function(_0x479c7a,_0x196808,_0x5336b5){return{'message':_0x479c7a,'unlock':_0x196808,'active':_0x5336b5};};exports['getCallerId']=function(_0x1a67b7,_0x25fce7,_0xd9ec9){if(!_[_0x20f0('0xd')](_0xd9ec9)&&'string'===typeof _0xd9ec9&&!_[_0x20f0('0xe')](_0xd9ec9)){if(!_[_0x20f0('0xd')](_0x25fce7)&&_0x20f0('0xf')===typeof _0x25fce7&&!_['isEmpty'](_0x25fce7)){return util[_0x20f0('0x10')](_0x20f0('0x11'),_0x25fce7,_0xd9ec9);}return util[_0x20f0('0x10')](_0x20f0('0x11'),_0xd9ec9,_0xd9ec9);}if(!_[_0x20f0('0xd')](_0x1a67b7)&&_0x20f0('0xf')===typeof _0x1a67b7&&!_[_0x20f0('0xe')](_0x1a67b7)){return _0x1a67b7;}return _0x20f0('0x12');};exports['isActive']=function(_0xb42cc7){if(_['isNil'](_0xb42cc7)){return![];}return _0xb42cc7;};exports[_0x20f0('0x13')]=function(_0x54590c,_0x385f73,_0x4192f2,_0x3db04b,_0x5b3383,_0x3143ee){var _0x597359={'XMD-QUEUE':_0x385f73['Queue']?_0x385f73[_0x20f0('0x14')][_0x20f0('0x15')]:'','XMD-CALLERID':_0x3db04b,'XMD-CALLERID-PREVIEW':_0x3143ee?util[_0x20f0('0x10')]('\x22%s\x22\x20<%s>',_0x3143ee[_0x20f0('0x16')],_0x3143ee[_0x20f0('0x17')]):_0x3db04b,'XMD-DIALID':_0x5b3383,'XMD-CONTACTID':_0x385f73[_0x20f0('0x18')],'XMD-CDRTYPE':_0x20f0('0x19'),'CALLERID(all)':_0x3db04b,'XMD-VOICEQUEUEID':_0x385f73[_0x20f0('0x1a')],'XMD-DIALCHANNEL':_0x4192f2,'XMD-DIALTIMEOUT':_0x54590c[_0x20f0('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x20f0('0x10')](_0x20f0('0x1c'),_0x54590c['dialQueueProject2']?'g':'',_['isEmpty'](_0x54590c[_0x20f0('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x54590c[_0x20f0('0x1e')]||'','XMD-AGI':_0x54590c[_0x20f0('0x1f')]?util[_0x20f0('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x54590c[_0x20f0('0x1f')]):'NONE','XMD-AGIAFTER':_0x54590c[_0x20f0('0x20')]?util[_0x20f0('0x10')](_0x20f0('0x21'),ipAgi,_0x54590c[_0x20f0('0x20')]):_0x20f0('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3143ee?_0x3143ee['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3143ee?_0x3143ee['originatecalleridname']:'','XMD-DESTINATION':_0x20f0('0x23'),'SIPADDHEADER':_0x20f0('0x24')};if(!_[_0x20f0('0xe')](_0x54590c[_0x20f0('0x1d')])){_0x597359[util[_0x20f0('0x10')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x54590c['monitor_format'];_0x597359[util[_0x20f0('0x10')]('%s',_0x20f0('0x25'))]=_0x5b3383;}if(_0x385f73&&_0x385f73[_0x20f0('0x26')]){for(var _0x3d1567 in _0x385f73['Contact']){if(_0x385f73[_0x20f0('0x26')][_0x20f0('0x27')](_0x3d1567)){if(!_[_0x20f0('0x28')](_0x385f73['Contact'][_0x3d1567])&&_0x3d1567!=='id'&&_0x3d1567!==_0x20f0('0x29')&&_0x3d1567!==_0x20f0('0x2a')&&_0x3d1567!==_0x20f0('0x2b')){_0x597359[util[_0x20f0('0x10')]('%s%s',_0x20f0('0x2c'),_['toUpper'](_0x3d1567))]=_0x385f73[_0x20f0('0x26')][_0x3d1567];}}}}return _0x597359;};exports[_0x20f0('0x2d')]=function(_0x554bc9){var _0xc7e7b5={};for(var _0xb93ac1 in _0x554bc9){if(_0x554bc9['hasOwnProperty'](_0xb93ac1)){_0xc7e7b5[util['format']('%s',_[_0x20f0('0x2e')](_0xb93ac1))]=_0x554bc9[_0xb93ac1];}}return{'variables':_0xc7e7b5};};exports[_0x20f0('0x2f')]=function(_0x533a5d,_0x16bd62){if(!_[_0x20f0('0x28')](_0x533a5d)){if(_0x533a5d['hasOwnProperty'](_0x20f0('0x30'))){if(_0x533a5d['originated']>0x0){_0x533a5d[_0x20f0('0x30')]-=0x1;}else{logger[_0x20f0('0xa')](_0x20f0('0x31'),_0x16bd62);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x16bd62);}};exports[_0x20f0('0x32')]=function(_0x30b446){var _0x563fca=moment()[_0x20f0('0x10')](_0x20f0('0x33'));_0x30b446[_0x20f0('0x34')]=0xd;_0x30b446[_0x20f0('0x35')]=_0x20f0('0x36');_0x30b446[_0x20f0('0x37')]=_0x563fca;_0x30b446[_0x20f0('0x38')]=_0x563fca;_0x30b446[_0x20f0('0x39')]=_0x563fca;};exports['logAgent']=function(_0x341a8c,_0x3e37d5,_0x42c10b){var _0x3520bf=moment()[_0x20f0('0x10')](_0x20f0('0x33'));_0x341a8c['state']=_0x3e37d5;_0x341a8c[_0x20f0('0x35')]=_0x42c10b;_0x341a8c[_0x20f0('0x38')]=_0x3520bf;_0x341a8c[_0x20f0('0x3a')]=utils[_0x20f0('0x3b')](_0x341a8c[_0x20f0('0x38')],_0x341a8c[_0x20f0('0x37')]);};exports['logLookAgent']=function(_0x317baa,_0x462242,_0x482f3b){_0x317baa[_0x20f0('0x3c')]=_0x462242;_0x317baa[_0x20f0('0x3d')]=_0x482f3b;};exports[_0x20f0('0x3e')]=function(_0x39a8ca,_0x1e2530,_0x23af56){var _0x44588c=moment()[_0x20f0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x39a8ca[_0x20f0('0x34')]=_0x1e2530;_0x39a8ca[_0x20f0('0x35')]=_0x23af56;_0x39a8ca[_0x20f0('0x38')]=_0x39a8ca[_0x20f0('0x38')]?_0x39a8ca[_0x20f0('0x38')]:_0x44588c;_0x39a8ca[_0x20f0('0x39')]=_0x39a8ca[_0x20f0('0x39')]?_0x39a8ca[_0x20f0('0x39')]:_0x44588c;_0x39a8ca[_0x20f0('0x3a')]=utils['getSeconds'](_0x39a8ca[_0x20f0('0x38')]||0x0,_0x39a8ca['starttime']||0x0);_0x39a8ca['talktime']=_0x39a8ca['answertime']?utils[_0x20f0('0x3b')](_0x39a8ca[_0x20f0('0x39')],_0x39a8ca['answertime']):0x0;};exports[_0x20f0('0x3f')]=function(_0x478159){return _0x478159==='Failure';};exports['variablesAction']=function(_0x22ae97,_0xee27e9,_0x1f822e,_0x1d3c37,_0xb237d9){var _0x23a305=_0x1d3c37?'RECALL':_0x22ae97[_0x20f0('0x16')];_0x23a305=_0xb237d9?_0x20f0('0x40'):_0x23a305;return{'actionid':_0x22ae97[_0x20f0('0x41')],'action':_0x20f0('0x42'),'channel':_0x22ae97['channelAgent'],'callerid':util[_0x20f0('0x10')](_0x20f0('0x11'),_0x23a305,_0x22ae97['calleridnum']),'Exten':_0x20f0('0x23'),'Context':_0x20f0('0x43'),'Priority':'1','variable':_0x1f822e,'timeout':(_0xee27e9[_0x20f0('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22ae97['uniqueid']};};exports[_0x20f0('0x45')]=function(_0x2f1dea){return _0x2f1dea[_0x20f0('0x46')]+_0x2f1dea[_0x20f0('0x47')]+_0x2f1dea[_0x20f0('0x48')]+_0x2f1dea[_0x20f0('0x49')]+_0x2f1dea[_0x20f0('0x4a')];};exports[_0x20f0('0x4b')]=function(_0x4e0a08){var _0x47037b=_['clone'](_0x4e0a08);_0x47037b[_0x20f0('0x34')]=0xf;_0x47037b[_0x20f0('0x35')]=_0x20f0('0x4c');return _0x47037b;};exports[_0x20f0('0x4d')]=function(_0x795da6,_0x4db540,_0x4ff0cb){var _0x1f85be={};_0x1f85be[_0x4db540]=_0x795da6[_0x4db540];_0x1f85be[_0x20f0('0x4e')]=![];_0x1f85be[_0x20f0('0x4f')]=moment()[_0x20f0('0x50')](_0x4ff0cb,'minutes')[_0x20f0('0x10')](_0x20f0('0x33'));_0x1f85be[_0x20f0('0x18')]=_0x795da6[_0x20f0('0x18')];_0x1f85be['ListId']=_0x795da6['ListId'];_0x1f85be[_0x20f0('0x1a')]=_0x795da6[_0x20f0('0x1a')]||undefined;return _0x1f85be;};exports[_0x20f0('0x51')]=function(_0x3b5cb5,_0x3f030c){if(!_[_0x20f0('0x28')](_0x3b5cb5)){if(_0x3b5cb5[_0x20f0('0x52')]>0x0){_0x3b5cb5[_0x20f0('0x52')]-=0x1;}else{logger[_0x20f0('0xa')](_0x3f030c,_0x20f0('0x53'));}}else{logger['error'](_0x3f030c,_0x20f0('0x54'));}};exports['IsNotLoggedIn']=function(_0x24659c){if(_0x24659c<=0x0){return!![];}return![];};function buildObj(_0x472722,_0x44f09c,_0x55d728){_0x472722[_0x20f0('0x55')]=_0x44f09c;_0x472722[_0x20f0('0x15')]=_0x472722[_0x20f0('0x56')];_0x472722[_0x20f0('0x57')]=_0x472722[_0x20f0('0x58')];_0x472722[_0x20f0('0x59')]=_0x20f0('0x5a');if(_0x55d728){_0x472722[_0x20f0('0x5b')]=_0x55d728[_0x20f0('0x5b')];}return _0x472722;}exports[_0x20f0('0x5c')]=buildObj;exports[_0x20f0('0x5d')]=function(_0x5b8ef9){var _0x2fe4ea={};_0x2fe4ea['queue']=_0x5b8ef9['queue'];_0x2fe4ea['interface']=_0x5b8ef9['channelAgent'];_0x2fe4ea[_0x20f0('0x41')]=_0x5b8ef9[_0x20f0('0x41')];return _0x2fe4ea;};exports[_0x20f0('0x5e')]=function(_0x49028e){var _0x5c3f55=[];for(var _0x24ec41 in _0x49028e){if(_0x49028e[_0x20f0('0x27')](_0x24ec41)){if(!_[_0x20f0('0x28')](_0x49028e[_0x24ec41])&&_0x49028e[_0x24ec41]['state']===_0x20f0('0x5f')&&_0x49028e[_0x24ec41][_0x20f0('0x60')]==='reachable'){_0x5c3f55[_0x20f0('0x61')](_0x49028e[_0x24ec41]['id']);}}}return _0x5c3f55;};exports[_0x20f0('0x62')]=function(_0x1c435f){var _0x545683=moment()[_0x20f0('0x63')](0x0);var _0x3f8cc1=moment(_0x1c435f)[_0x20f0('0x63')](0x0);return _0x545683[_0x20f0('0x64')](_0x3f8cc1,_0x20f0('0x65'));};exports['createBody']=function(_0x2ebae9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2ebae9[_0x20f0('0x18')],'ListId':_0x2ebae9[_0x20f0('0x66')],'VoiceQueueId':_0x2ebae9['VoiceQueueId']||undefined,'CampaignId':_0x2ebae9[_0x20f0('0x67')]||undefined};};exports['filterKey']=function(_0x333887){if(_0x333887==='uniqueid'||_0x333887===_0x20f0('0x68')||_0x333887===_0x20f0('0x56')||_0x333887===_0x20f0('0x69')||_0x333887===_0x20f0('0x6a')||_0x333887===_0x20f0('0x6b')||_0x333887==='membername'||_0x333887===_0x20f0('0x58')||_0x333887===_0x20f0('0x16')||_0x333887===_0x20f0('0x4e')||_0x333887===_0x20f0('0x17')||_0x333887===_0x20f0('0x4f')||_0x333887===_0x20f0('0x46')||_0x333887===_0x20f0('0x47')||_0x333887===_0x20f0('0x48')||_0x333887===_0x20f0('0x6c')||_0x333887==='callback'||_0x333887===_0x20f0('0x6d')||_0x333887===_0x20f0('0x6e')||_0x333887===_0x20f0('0x6f')||_0x333887===_0x20f0('0x18')||_0x333887===_0x20f0('0x66')||_0x333887==='UserId'||_0x333887==='VoiceQueueId'||_0x333887===_0x20f0('0x70')||_0x333887===_0x20f0('0x71')||_0x333887===_0x20f0('0x72')||_0x333887===_0x20f0('0x73')||_0x333887==='xmd-listid'||_0x333887===_0x20f0('0x74')||_0x333887==='xmd-dialtimeout'||_0x333887===_0x20f0('0x75')||_0x333887===_0x20f0('0x76')||_0x333887==='xmd-dialchannel'||_0x333887===_0x20f0('0x77')||_0x333887==='xmd-cdrtype'||_0x333887===_0x20f0('0x78')||_0x333887==='xmd-agiafter'||_0x333887===_0x20f0('0x79')||_0x333887===_0x20f0('0x7a')||_0x333887===_0x20f0('0x7b')||_0x333887===_0x20f0('0x7c')||_0x333887===_0x20f0('0x7d')||_0x333887==='rtpaudioqosloss'||_0x333887===_0x20f0('0x7e')||_0x333887===_0x20f0('0x7f')||_0x333887===_0x20f0('0x80')||_0x333887===_0x20f0('0x7a')||_0x333887===_0x20f0('0x7b')||_0x333887==='rtpaudioqosjitter'||_0x333887===_0x20f0('0x7d')||_0x333887===_0x20f0('0x81')||_0x333887===_0x20f0('0x7e')||_0x333887===_0x20f0('0x7f')||_0x333887===_0x20f0('0x80')||_0x333887==='bridgepeer'||_0x333887===_0x20f0('0x82')||_0x333887==='state'||_0x333887===_0x20f0('0x35')){return![];}return!![];};exports[_0x20f0('0x83')]=function(_0x3cf780,_0xfd669d){var _0x4eab80,_0x439797,_0x43014f;if(_0xfd669d<=0x0){_0xfd669d=0x1;}_0x4eab80=new RegExp(_0x20f0('0x84')+_0xfd669d+'}$');_0x439797=Math[_0x20f0('0x85')](0xa,_0xfd669d-0x1);_0x43014f=Math[_0x20f0('0x85')](0xa,_0xfd669d)-0x1;return util[_0x20f0('0x10')]('%s',_[_0x20f0('0x86')](_0x3cf780,_0x4eab80,_[_0x20f0('0x87')](_0x439797,_0x43014f)));};exports[_0x20f0('0x88')]=function(_0x5bdd65){var _0xf1440f=_0x5bdd65[_0x20f0('0x89')](/"(.*?)"/);return _0xf1440f?_0xf1440f[0x1]:_0x5bdd65;};exports[_0x20f0('0x8a')]=function(_0x1ce606){var _0x3e4838=_0x1ce606['match'](/<(.*?)>/);return _0x3e4838?_0x3e4838[0x1]:_0x1ce606;};function buildNoAnswerEventPayload(_0x58a486,_0x2987e0){var _0x5be681=buildObj(_0x58a486,_0x20f0('0x8b'));if(!_[_0x20f0('0xe')](_0x2987e0[_0x20f0('0x8c')])){Object[_0x20f0('0x8d')](_0x2987e0[_0x20f0('0x8c')])[_0x20f0('0x8e')](function(_0xd9992b){_0x5be681[_0xd9992b[_0x20f0('0x8f')]()]=_0x2987e0[_0x20f0('0x8c')][_0xd9992b];});}return _0x5be681;}exports[_0x20f0('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c08f4f8..b497ed1 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 _0xeed9=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x1dff5d,_0x57c1d5){var _0x3ac2e8=function(_0xdbfdf0){while(--_0xdbfdf0){_0x1dff5d['push'](_0x1dff5d['shift']());}};_0x3ac2e8(++_0x57c1d5);}(_0xeed9,0x155));var _0x9eed=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xeed9[_0x2f1762];return _0x8ab21;};'use strict';exports[_0x9eed('0x0')]={'queue':{'type':_0x9eed('0x1'),'required':!![]},'interface':{'type':_0x9eed('0x1'),'required':!![]},'membername':{'type':_0x9eed('0x1'),'required':!![]},'penalty':{'type':_0x9eed('0x2'),'required':![]},'paused':{'type':_0x9eed('0x3'),'required':![]}};exports[_0x9eed('0x4')]={'queue':{'type':_0x9eed('0x1'),'required':!![]},'interface':{'type':_0x9eed('0x1'),'required':!![]}};exports[_0x9eed('0x5')]={'interface':{'type':_0x9eed('0x1'),'required':!![]},'paused':{'type':_0x9eed('0x3')},'reason':{'type':_0x9eed('0x1'),'required':![]}};exports[_0x9eed('0x6')]={'module':{'type':_0x9eed('0x1'),'required':![]}};exports[_0x9eed('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x9eed('0x8')]={'uniqueid':{'type':_0x9eed('0x1'),'required':!![]},'filename':{'type':_0x9eed('0x1')},'format':{'type':_0x9eed('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x9eed('0x9')]={'uniqueid':{'type':_0x9eed('0x1'),'required':!![]}};exports[_0x9eed('0xa')]={'uniqueid':{'type':_0x9eed('0x1'),'required':!![]},'exten':{'type':_0x9eed('0x1'),'required':!![]},'context':{'type':_0x9eed('0x1')}}; \ No newline at end of file +var _0x969b=['queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x128cea,_0x568551){var _0x3db25e=function(_0xffc9d8){while(--_0xffc9d8){_0x128cea['push'](_0x128cea['shift']());}};_0x3db25e(++_0x568551);}(_0x969b,0x19a));var _0xb969=function(_0x2225d6,_0x1c605f){_0x2225d6=_0x2225d6-0x0;var _0x2c22f1=_0x969b[_0x2225d6];return _0x2c22f1;};'use strict';exports[_0xb969('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xb969('0x1'),'required':!![]},'membername':{'type':_0xb969('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xb969('0x2'),'required':![]}};exports[_0xb969('0x3')]={'queue':{'type':_0xb969('0x1'),'required':!![]},'interface':{'type':_0xb969('0x1'),'required':!![]}};exports[_0xb969('0x4')]={'interface':{'type':_0xb969('0x1'),'required':!![]},'paused':{'type':_0xb969('0x2')},'reason':{'type':_0xb969('0x1'),'required':![]}};exports[_0xb969('0x5')]={'module':{'type':_0xb969('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xb969('0x1'),'required':!![]}};exports[_0xb969('0x6')]={'uniqueid':{'type':_0xb969('0x1'),'required':!![]},'filename':{'type':_0xb969('0x1')},'format':{'type':_0xb969('0x1')},'mixmonitorid':{'type':_0xb969('0x1')}};exports[_0xb969('0x7')]={'uniqueid':{'type':_0xb969('0x1'),'required':!![]}};exports[_0xb969('0x8')]={'uniqueid':{'type':_0xb969('0x1'),'required':!![]},'exten':{'type':_0xb969('0x1'),'required':!![]},'context':{'type':_0xb969('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6b220cc..a57f437 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0xc11eb7,_0x14c399){var _0x442a61=function(_0x2b9d70){while(--_0x2b9d70){_0xc11eb7['push'](_0xc11eb7['shift']());}};_0x442a61(++_0x14c399);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3cf7df,_0x43b053){_0x3cf7df=_0x3cf7df-0x0;var _0x52ca51=_0x5f2f[_0x3cf7df];return _0x52ca51;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x2d16d5,_0x36b981){var _0x16bc44=function(_0x337409){while(--_0x337409){_0x2d16d5['push'](_0x2d16d5['shift']());}};_0x16bc44(++_0x36b981);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7069e5,_0x279f40){_0x7069e5=_0x7069e5-0x0;var _0x25233a=_0x5f2f[_0x7069e5];return _0x25233a;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 78b4635..53f9dbf 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 _0xa6ff=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x53bf2d,_0x7eccdf){var _0x463bc9=function(_0x58dec6){while(--_0x58dec6){_0x53bf2d['push'](_0x53bf2d['shift']());}};_0x463bc9(++_0x7eccdf);}(_0xa6ff,0x1cd));var _0xfa6f=function(_0x26e123,_0x276a42){_0x26e123=_0x26e123-0x0;var _0x24b5de=_0xa6ff[_0x26e123];return _0x24b5de;};'use strict';function mergeDBDataToRealtime(_0x3649ed,_0x160aa5){var _0x3214ab=Object[_0xfa6f('0x0')]({},_0x3649ed);for(var _0x3fa184 in _0x160aa5){if(_0x3214ab[_0xfa6f('0x1')](_0x3fa184)){_0x3214ab[_0x3fa184]=_0x160aa5[_0x3fa184];}}return _0x3214ab;}exports[_0xfa6f('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x48ec=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x48ec,0xbc));var _0xc48e=function(_0x2c4ba3,_0x2d24ba){_0x2c4ba3=_0x2c4ba3-0x0;var _0x150a93=_0x48ec[_0x2c4ba3];return _0x150a93;};'use strict';function mergeDBDataToRealtime(_0x3ff77c,_0x3dd5cc){var _0x436510=Object[_0xc48e('0x0')]({},_0x3ff77c);for(var _0xafda6d in _0x3dd5cc){if(_0x436510[_0xc48e('0x1')](_0xafda6d)){_0x436510[_0xafda6d]=_0x3dd5cc[_0xafda6d];}}return _0x436510;}exports[_0xc48e('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0bb10a5..40cb928 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 _0x56c1=['custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','split','outbound','destination','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','type','UserId','membername','monitor','monitors','createdAt','exten','xcally-motion-preview','connectedlinename','xcally-motion-dialer','indexOf','mobile','phone','substring','lodash','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind'];(function(_0x982244,_0x4aca5f){var _0x550589=function(_0x523876){while(--_0x523876){_0x982244['push'](_0x982244['shift']());}};_0x550589(++_0x4aca5f);}(_0x56c1,0xe8));var _0x156c=function(_0x571ec1,_0x45684b){_0x571ec1=_0x571ec1-0x0;var _0xb02e0=_0x56c1[_0x571ec1];return _0xb02e0;};'use strict';var _=require(_0x156c('0x0'));var moment=require('moment');var util=require(_0x156c('0x1'));var config=require(_0x156c('0x2'));var ami=require(_0x156c('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x156c('0x4'));var RpcVoiceDialReport=require(_0x156c('0x5'));var RpcMemberReport=require(_0x156c('0x6'));var RpcVoiceQueueReport=require(_0x156c('0x7'));var RpcVoiceRecording=require(_0x156c('0x8'));var RpcVoiceTransferReport=require(_0x156c('0x9'));var VoiceQueueReport=require(_0x156c('0xa'));var VoiceCallReport=require(_0x156c('0xb'));var VoiceAgentReport=require(_0x156c('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x6eb8bf){this[_0x156c('0xd')]=_0x6eb8bf;this[_0x156c('0xe')]=_0x6eb8bf[_0x156c('0xe')];this[_0x156c('0xf')]=_0x6eb8bf[_0x156c('0xf')];}Report[_0x156c('0x10')][_0x156c('0x11')]=function(_0x3695b8){var _0xdd3edb=new VoiceQueueReport(this[_0x156c('0xd')]);var _0x470d68=new VoiceAgentReport(this[_0x156c('0xd')]);var _0x210f68=new VoiceDialReport(this['realtime']);var _0x10d670=new VoiceCallReport(this[_0x156c('0xd')]);var _0x49758c=new UserReport(this[_0x156c('0xd')]);if(config[_0x156c('0x12')]&&config[_0x156c('0x12')][_0x156c('0x13')]){ami['on'](_0x156c('0x14'),this[_0x156c('0x15')][_0x156c('0x16')](this));ami['on'](_0x156c('0x17'),this[_0x156c('0x18')][_0x156c('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0x156c('0x19')][_0x156c('0x16')](this));ami['on']('custom:voiceDialReport',this[_0x156c('0x1a')][_0x156c('0x16')](this));ami['on'](_0x156c('0x1b'),this[_0x156c('0x1c')]['bind'](this));ami['on'](_0x156c('0x1d'),this[_0x156c('0x1e')][_0x156c('0x16')](this));}};Report[_0x156c('0x10')][_0x156c('0x1f')]=function(_0x2e7435){var _0x23750f;_0x23750f=_[_0x156c('0x20')](this[_0x156c('0xe')],function(_0x46653d){return _0x46653d[_0x156c('0x21')]==_0x2e7435||_0x46653d[_0x156c('0x22')]==_0x2e7435;});if(_[_0x156c('0x23')](_0x23750f)){var _0x4cea32=_['find'](this[_0x156c('0xf')],function(_0xc8d201){return _0xc8d201['accountcode']==_0x2e7435||_0xc8d201[_0x156c('0x22')]==_0x2e7435;});if(_0x4cea32){_0x23750f=_['find'](this[_0x156c('0xe')],function(_0x409b72){return _0x409b72['interface']==util[_0x156c('0x24')](_0x156c('0x25'),_0x4cea32[_0x156c('0x22')]);});}}return _0x23750f;};Report[_0x156c('0x10')][_0x156c('0x15')]=function(_0x2fb896){for(var _0x2f5731=0x0;_0x2f5731<_0x2fb896[_0x156c('0x26')];_0x2f5731+=0x1){var _0x2348ec=this[_0x156c('0x1f')](_0x2fb896[_0x2f5731]['connectedlinenum']);if(_0x2348ec){_0x2fb896[_0x2f5731]['accountcode']=_0x2348ec[_0x156c('0x21')];_0x2fb896[_0x2f5731]['assigned']=!![];_0x2fb896[_0x2f5731]['lastAssignedTo']=_0x2348ec[_0x156c('0x22')];_0x2fb896[_0x2f5731][_0x156c('0x27')]=_[_0x156c('0x23')](_0x2348ec[_0x156c('0x27')])?util[_0x156c('0x24')]('SIP/%s',_0x2348ec[_0x156c('0x22')]):_0x2348ec['interface'];if(_0x2fb896[_0x2f5731][_0x156c('0x28')]){_0x2fb896[_0x2f5731][_0x156c('0x29')]=moment()[_0x156c('0x24')](_0x156c('0x2a'));}if(_0x2fb896[_0x2f5731]['queuecallerexit']){_0x2fb896[_0x2f5731][_0x156c('0x2b')]=moment()[_0x156c('0x24')](_0x156c('0x2a'));}RpcMemberReport[_0x156c('0x15')](_0x2fb896[_0x2f5731]);}RpcVoiceQueueReport[_0x156c('0x2c')](_0x2fb896[_0x2f5731]);}};function extractCalleridNumber(_0x391686){var _0x333304=_0x391686[_0x156c('0x2d')](/<(.*?)>/);return _0x333304?_0x333304[0x1]:_0x391686;}Report[_0x156c('0x10')][_0x156c('0x2e')]=function(_0x18108c){for(var _0xa8243b=0x0;_0xa8243b','transfers','uniqueid','linkedid','UserId','membername','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','startsWith','Local','indexOf','substring','blindTransfer','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind'];(function(_0x30976c,_0x2e2ec0){var _0x4645aa=function(_0x5983db){while(--_0x5983db){_0x30976c['push'](_0x30976c['shift']());}};_0x4645aa(++_0x2e2ec0);}(_0xdebd,0x1a1));var _0xddeb=function(_0x512067,_0x1e98cd){_0x512067=_0x512067-0x0;var _0x55714b=_0xdebd[_0x512067];return _0x55714b;};'use strict';var _=require(_0xddeb('0x0'));var moment=require(_0xddeb('0x1'));var util=require(_0xddeb('0x2'));var config=require(_0xddeb('0x3'));var ami=require(_0xddeb('0x4'));var RpcVoiceAgentReport=require(_0xddeb('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xddeb('0x6'));var RpcVoiceQueueReport=require(_0xddeb('0x7'));var RpcVoiceRecording=require(_0xddeb('0x8'));var RpcVoiceTransferReport=require(_0xddeb('0x9'));var VoiceQueueReport=require(_0xddeb('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xddeb('0xb'));var UserReport=require(_0xddeb('0xc'));function Report(_0x3729b4){this[_0xddeb('0xd')]=_0x3729b4;this[_0xddeb('0xe')]=_0x3729b4[_0xddeb('0xe')];this[_0xddeb('0xf')]=_0x3729b4[_0xddeb('0xf')];}Report[_0xddeb('0x10')][_0xddeb('0x11')]=function(_0x370bcd){var _0x1e03d2=new VoiceQueueReport(this[_0xddeb('0xd')]);var _0x40780a=new VoiceAgentReport(this['realtime']);var _0x441020=new VoiceDialReport(this['realtime']);var _0xc9ee2d=new VoiceCallReport(this['realtime']);var _0x42626c=new UserReport(this[_0xddeb('0xd')]);if(config[_0xddeb('0x12')]&&config[_0xddeb('0x12')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0xddeb('0x13')]['bind'](this));ami['on'](_0xddeb('0x14'),this[_0xddeb('0x15')][_0xddeb('0x16')](this));ami['on'](_0xddeb('0x17'),this[_0xddeb('0x18')][_0xddeb('0x16')](this));ami['on'](_0xddeb('0x19'),this[_0xddeb('0x1a')][_0xddeb('0x16')](this));ami['on'](_0xddeb('0x1b'),this['blindTransfer'][_0xddeb('0x16')](this));ami['on'](_0xddeb('0x1c'),this[_0xddeb('0x1d')][_0xddeb('0x16')](this));}};Report[_0xddeb('0x10')][_0xddeb('0x1e')]=function(_0xa1950a){var _0x304a6a;_0x304a6a=_[_0xddeb('0x1f')](this['agents'],function(_0x3788f1){return _0x3788f1['accountcode']==_0xa1950a||_0x3788f1[_0xddeb('0x20')]==_0xa1950a;});if(_[_0xddeb('0x21')](_0x304a6a)){var _0x3aa525=_['find'](this['telephones'],function(_0x5cbc09){return _0x5cbc09['accountcode']==_0xa1950a||_0x5cbc09[_0xddeb('0x20')]==_0xa1950a;});if(_0x3aa525){_0x304a6a=_['find'](this[_0xddeb('0xe')],function(_0x3ed3f0){return _0x3ed3f0[_0xddeb('0x22')]==util[_0xddeb('0x23')]('SIP/%s',_0x3aa525[_0xddeb('0x20')]);});}}return _0x304a6a;};Report[_0xddeb('0x10')]['voiceQueueReport']=function(_0x3a187e){for(var _0x110b23=0x0;_0x110b23<_0x3a187e['length'];_0x110b23+=0x1){var _0x202dc5=this[_0xddeb('0x1e')](_0x3a187e[_0x110b23]['connectedlinenum']);if(_0x202dc5){_0x3a187e[_0x110b23][_0xddeb('0x24')]=_0x202dc5[_0xddeb('0x24')];_0x3a187e[_0x110b23][_0xddeb('0x25')]=!![];_0x3a187e[_0x110b23][_0xddeb('0x26')]=_0x202dc5[_0xddeb('0x20')];_0x3a187e[_0x110b23][_0xddeb('0x22')]=_['isNil'](_0x202dc5[_0xddeb('0x22')])?util['format'](_0xddeb('0x27'),_0x202dc5[_0xddeb('0x20')]):_0x202dc5['interface'];if(_0x3a187e[_0x110b23][_0xddeb('0x28')]){_0x3a187e[_0x110b23][_0xddeb('0x29')]=moment()[_0xddeb('0x23')](_0xddeb('0x2a'));}if(_0x3a187e[_0x110b23][_0xddeb('0x2b')]){_0x3a187e[_0x110b23][_0xddeb('0x2c')]=moment()['format'](_0xddeb('0x2a'));}RpcMemberReport[_0xddeb('0x13')](_0x3a187e[_0x110b23]);}RpcVoiceQueueReport[_0xddeb('0x2d')](_0x3a187e[_0x110b23]);}};function extractCalleridNumber(_0x4effe1){var _0x4f0b87=_0x4effe1['match'](/<(.*?)>/);return _0x4f0b87?_0x4f0b87[0x1]:_0x4effe1;}Report[_0xddeb('0x10')][_0xddeb('0x2e')]=function(_0x3dd765){for(var _0x1759c8=0x0;_0x1759c80x0?!![]:![];if(!_0x227225){return this[_0x5c04('0x17')](this[_0x5c04('0x46')]['completeEvent']);}};VoiceQueueReport['prototype'][_0x5c04('0x1a')]=function(_0xa210b8){var _0x51f34e=this['summary']['id'];if(this['summary'][_0x5c04('0x5d')][_0x51f34e]&&this['summary'][_0x5c04('0x5d')][_0x51f34e][_0xa210b8[_0x5c04('0x5e')]]){this[_0x5c04('0x46')][_0x5c04('0x5d')][_0x51f34e][_0xa210b8[_0x5c04('0x5e')]][_0x5c04('0xf')][_0x5c04('0x6c')](_0xa210b8);}};VoiceQueueReport[_0x5c04('0xa')][_0x5c04('0x6d')]=function(_0xe5c2b6){var _0x565693=this;try{if(this[_0x5c04('0x5a')](_0xe5c2b6)&&this[_0x5c04('0x5a')](_0xe5c2b6[_0x5c04('0x54')])){logger[_0x5c04('0x4a')](_0x5c04('0x6e'),util[_0x5c04('0x42')](_0xe5c2b6,{'showHidden':![],'depth':null}));var _0x588a8c=this['voiceQueues'][_0xe5c2b6['queue']];if(_0x588a8c){logger[_0x5c04('0x4a')](_0x5c04('0x6f'),_0x588a8c[_0x5c04('0x61')]);this[_0x5c04('0x46')]['queues'][_0x588a8c[_0x5c04('0x61')]]={'summaryEvent':_0xe5c2b6};this[_0x5c04('0x46')][_0x5c04('0x6b')]+=0x1;return ami['Action']({'action':_0x5c04('0x5d'),'queue':_0x588a8c[_0x5c04('0x61')]})['then'](function(_0x2aa724){if(!_0x565693[_0x5c04('0x46')]['queuestatus'][_0xe5c2b6[_0x5c04('0x5e')]]){_0x565693[_0x5c04('0x46')][_0x5c04('0x5d')][_0xe5c2b6[_0x5c04('0x5e')]]={};}_0x565693[_0x5c04('0x46')]['queuestatus'][_0xe5c2b6[_0x5c04('0x5e')]][_0x2aa724[_0x5c04('0x5e')]]={'queue':_0x588a8c[_0x5c04('0x61')],'agents':[]};})[_0x5c04('0x70')](function(_0x306b19){throw _0x306b19;});}}}catch(_0x5b92a7){logger[_0x5c04('0x3f')](_0x5c04('0x5f'),util[_0x5c04('0x42')](_0x5b92a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5c04('0x17')]=function(_0x397d8b){if(this[_0x5c04('0x46')][_0x5c04('0x6b')]>0x0){this[_0x5c04('0x46')]['completeEvent']=_0x397d8b;return;}logger[_0x5c04('0x4a')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x397d8b,{'showHidden':![],'depth':null}));this[_0x5c04('0x46')]=initializeSummary();ami['emit'](_0x5c04('0x71'),{});};VoiceQueueReport['prototype'][_0x5c04('0x1e')]=function(_0x339cc8){try{if(this[_0x5c04('0x5a')](_0x339cc8)){logger[_0x5c04('0x4a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x339cc8[_0x5c04('0x4c')],util[_0x5c04('0x42')](_0x339cc8,{'showHidden':![],'depth':null}));if(_[_0x5c04('0x72')](this[_0x5c04('0xe')][_0x339cc8[_0x5c04('0x4c')]])){this[_0x5c04('0xe')][_0x339cc8[_0x5c04('0x4c')]]=[];}if(_['isUndefined'](this[_0x5c04('0x10')][_0x339cc8[_0x5c04('0x4c')]])){this[_0x5c04('0x10')][_0x339cc8[_0x5c04('0x4c')]]={};}var _0x2ba8ef=new QueueReport();_0x2ba8ef[_0x5c04('0x54')]=_0x339cc8[_0x5c04('0x54')];_0x2ba8ef[_0x5c04('0x57')]=this[_0x5c04('0x12')][_0x2ba8ef[_0x5c04('0x54')]]&&this['voiceQueues'][_0x2ba8ef[_0x5c04('0x54')]][_0x5c04('0x57')]?this[_0x5c04('0x12')][_0x2ba8ef[_0x5c04('0x54')]][_0x5c04('0x57')]||_0x5c04('0x58'):_0x5c04('0x58');_0x2ba8ef[_0x5c04('0x73')]=moment()[_0x5c04('0x52')](_0x5c04('0x74'));_0x2ba8ef[_0x5c04('0x75')]=_0x339cc8['position'];_0x2ba8ef[_0x5c04('0x76')]=_0x339cc8[_0x5c04('0x76')];_0x2ba8ef['uniqueid']=_0x339cc8[_0x5c04('0x4c')];_0x2ba8ef['routealias']=this[_0x5c04('0x10')][_0x339cc8[_0x5c04('0x4c')]]['routealias'];logger[_0x5c04('0x77')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2ba8ef[_0x5c04('0x54')],_0x2ba8ef[_0x5c04('0x57')]);Object['assign'](_0x2ba8ef,_[_0x5c04('0x78')](_0x339cc8,_[_0x5c04('0x79')](_0x2ba8ef)));this['queueReports'][_0x339cc8['uniqueid']][_0x5c04('0x6c')](_0x2ba8ef);this[_0x5c04('0x10')][_0x339cc8['uniqueid']]=_0x2ba8ef;this[_0x5c04('0x49')](_0x2ba8ef,_0x5c04('0x1d'));}}catch(_0x34197e){logger[_0x5c04('0x3f')](_0x5c04('0x7a'),_0x339cc8[_0x5c04('0x4c')],util[_0x5c04('0x42')](_0x34197e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c04('0xa')][_0x5c04('0x20')]=function(_0x2b32b5){try{if(this['isNotNull'](_0x2b32b5)){logger[_0x5c04('0x4a')](_0x5c04('0x7b'),_0x2b32b5[_0x5c04('0x4c')],util['inspect'](_0x2b32b5,{'showHidden':![],'depth':null}));if(this[_0x5c04('0xe')][_0x2b32b5[_0x5c04('0x4c')]]){var _0x4735d0=_[_0x5c04('0x7c')](this['queueReports'][_0x2b32b5[_0x5c04('0x4c')]]);_0x4735d0['queuecallercomplete']=![];_0x4735d0[_0x5c04('0x7d')]=null;_0x4735d0[_0x5c04('0x7e')]=_0x2b32b5[_0x5c04('0x7e')];_0x4735d0[_0x5c04('0x7f')]=_0x2b32b5[_0x5c04('0x7f')];_0x4735d0[_0x5c04('0x1f')]=!![];_0x4735d0[_0x5c04('0x80')]=moment()[_0x5c04('0x52')](_0x5c04('0x74'));_0x4735d0[_0x5c04('0x50')]='ABANDONED';_0x4735d0[_0x5c04('0x81')]=null;logger[_0x5c04('0x77')](_0x5c04('0x82'),_0x4735d0[_0x5c04('0x54')],_0x4735d0[_0x5c04('0x57')]);this['channels'][_0x2b32b5[_0x5c04('0x4c')]]=_0x4735d0;this[_0x5c04('0x83')](_0x4735d0,_0x5c04('0x1f'));}}}catch(_0x7704b7){logger[_0x5c04('0x3f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2b32b5[_0x5c04('0x4c')],util[_0x5c04('0x42')](_0x7704b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x7efb70){try{if(this[_0x5c04('0x5a')](_0x7efb70)){logger[_0x5c04('0x4a')](_0x5c04('0x84'),_0x7efb70[_0x5c04('0x4c')],util['inspect'](_0x7efb70,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x7efb70[_0x5c04('0x4c')]]){var _0x190a2f=_[_0x5c04('0x7c')](this[_0x5c04('0xe')][_0x7efb70['uniqueid']]);_0x190a2f[_0x5c04('0x85')]=moment()['format'](_0x5c04('0x74'));_0x190a2f['connectedlinenum']=_0x7efb70[_0x5c04('0x86')];_0x190a2f[_0x5c04('0x87')]=_0x7efb70[_0x5c04('0x87')];logger[_0x5c04('0x77')](_0x5c04('0x88'),_0x190a2f['queue'],_0x190a2f[_0x5c04('0x57')],_0x7efb70[_0x5c04('0x86')],_0x7efb70[_0x5c04('0x87')]);this[_0x5c04('0x10')][_0x7efb70[_0x5c04('0x4c')]]=_0x190a2f;this[_0x5c04('0x49')](_0x190a2f,_0x5c04('0x21'));}}}catch(_0x497f82){logger[_0x5c04('0x3f')](_0x5c04('0x84'),_0x7efb70[_0x5c04('0x4c')],util[_0x5c04('0x42')](_0x497f82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c04('0xa')]['syncAgentConnect']=function(_0x113db6){try{if(this['isNotNull'](_0x113db6)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x113db6['uniqueid'],util[_0x5c04('0x42')](_0x113db6,{'showHidden':![],'depth':null}));if(this[_0x5c04('0xe')][_0x113db6[_0x5c04('0x4c')]]){var _0x4b57c9=_[_0x5c04('0x7c')](this[_0x5c04('0xe')][_0x113db6['uniqueid']]);_0x4b57c9['queuecallercomplete']=!![];_0x4b57c9[_0x5c04('0x50')]=_0x5c04('0x89');logger[_0x5c04('0x77')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4b57c9['queue'],_0x4b57c9[_0x5c04('0x57')]);}}}catch(_0x213696){logger[_0x5c04('0x3f')](_0x5c04('0x8a'),_0x113db6['uniqueid'],util['inspect'](_0x213696,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c04('0xa')][_0x5c04('0x23')]=function(_0x10475e){try{if(this[_0x5c04('0x5a')](_0x10475e)){logger[_0x5c04('0x4a')]('[%s][voiceQueueReport][agentcomplete]',_0x10475e[_0x5c04('0x4c')],util[_0x5c04('0x42')](_0x10475e,{'showHidden':![],'depth':null}));if(this[_0x5c04('0xe')][_0x10475e['uniqueid']]){var _0x4f9793=_[_0x5c04('0x7c')](this[_0x5c04('0xe')][_0x10475e[_0x5c04('0x4c')]]);_0x4f9793[_0x5c04('0x1f')]=![];_0x4f9793['queuecallerabandonAt']=null;_0x4f9793[_0x5c04('0x8b')]=!![];_0x4f9793[_0x5c04('0x81')]=_0x10475e['membername'];_0x4f9793['holdtime']=_0x10475e[_0x5c04('0x7e')];_0x4f9793[_0x5c04('0x37')]=!![];_0x4f9793['queuecallerexit']=![];_0x4f9793[_0x5c04('0x8c')]=null;if(!_0x4f9793[_0x5c04('0x8d')]){if(_0x10475e[_0x5c04('0x8e')]==_0x5c04('0x8d')){_0x4f9793['queuecallerexitreason']='COMPLETED';logger[_0x5c04('0x77')](_0x5c04('0x8f'),_0x4f9793[_0x5c04('0x54')],_0x4f9793['type']);}else{if(_[_0x5c04('0x90')](_0x10475e[_0x5c04('0x3c')]['toLowerCase'](),_0x5c04('0x91'))){if(this[_0x5c04('0xe')][_0x10475e['linkedid']]){var _0x563d63=_[_0x5c04('0x7c')](this[_0x5c04('0xe')][_0x10475e[_0x5c04('0x92')]]);_0x563d63[_0x5c04('0x37')]=![];_0x563d63['queuecallerexit']=!![];_0x563d63[_0x5c04('0x8c')]=moment(_0x4f9793['queuecallerjoinAt'])[_0x5c04('0x93')](_0x10475e[_0x5c04('0x7e')],_0x5c04('0x94'))['format'](_0x5c04('0x74'));_0x563d63[_0x5c04('0x50')]=_0x5c04('0x95');_0x563d63[_0x5c04('0x8d')]=!![];_0x563d63['transfertype']=_0x5c04('0x96');_0x563d63[_0x5c04('0x97')]=_0x10475e[_0x5c04('0x98')];_0x563d63[_0x5c04('0x99')]=_0x10475e[_0x5c04('0x4c')];logger[_0x5c04('0x77')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x563d63[_0x5c04('0x54')],_0x563d63[_0x5c04('0x57')]);var _0x49cb32=this['queueReports'][_0x10475e[_0x5c04('0x92')]];this['queueReports'][_0x10475e[_0x5c04('0x92')]]=this[_0x5c04('0xe')][_0x10475e[_0x5c04('0x4c')]];this[_0x5c04('0xe')][_0x10475e[_0x5c04('0x4c')]]=_0x49cb32;}}else{_0x4f9793[_0x5c04('0x50')]=_0x5c04('0x9a')+_0x10475e[_0x5c04('0x8e')][_0x5c04('0x9b')]();logger[_0x5c04('0x77')](_0x5c04('0x9c'),_0x4f9793['queue'],_0x4f9793[_0x5c04('0x57')],_0x4f9793[_0x5c04('0x50')]);}}}this['channels'][_0x10475e[_0x5c04('0x4c')]]=_0x4f9793;}}}catch(_0x481270){logger[_0x5c04('0x3f')](_0x5c04('0x9d'),_0x10475e[_0x5c04('0x4c')],util[_0x5c04('0x42')](_0x481270,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c04('0xa')][_0x5c04('0x26')]=function(_0x18eafc){try{if(this['isNotNull'](_0x18eafc)){logger[_0x5c04('0x4a')](_0x5c04('0x9e'),_0x18eafc[_0x5c04('0x4c')],util[_0x5c04('0x42')](_0x18eafc,{'showHidden':![],'depth':null}));this[_0x5c04('0x9f')](_0x18eafc[_0x5c04('0x4c')],_[_0x5c04('0x79')](_0x18eafc['variable'])[0x0],_0x18eafc['value']);if(this['queueReports'][_0x18eafc['uniqueid']]){var _0x5e6987=_[_0x5c04('0x7c')](this[_0x5c04('0xe')][_0x18eafc[_0x5c04('0x4c')]]);if(_0x5e6987){if(this[_0x5c04('0x5a')](_0x18eafc[_0x5c04('0xa0')])&&this[_0x5c04('0x5a')](_0x18eafc[_0x5c04('0xa0')]['queuestatus'])){switch(_0x18eafc[_0x5c04('0xa1')]){case'CONTINUE':_0x5e6987[_0x5c04('0xa2')]=![];_0x5e6987[_0x5c04('0x8c')]=null;break;case _0x5c04('0xa3'):_0x5e6987['lastevent']=_0x5c04('0xa4');_0x5e6987[_0x5c04('0xa2')]=!![];_0x5e6987[_0x5c04('0x8c')]=moment()['format'](_0x5c04('0x74'));_0x5e6987[_0x5c04('0x85')]=moment()[_0x5c04('0x52')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x5c04('0x4a')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x18eafc['uniqueid'],util['inspect'](_0x5e6987,{'showHidden':![],'depth':null}));ami[_0x5c04('0x48')](_0x5c04('0xa5'),_0x5e6987);break;default:_0x5e6987[_0x5c04('0xa2')]=!![];_0x5e6987['queuecallerexitAt']=moment()['format'](_0x5c04('0x74'));_0x5e6987[_0x5c04('0x85')]=moment()[_0x5c04('0x52')](_0x5c04('0x74'));}_0x5e6987[_0x5c04('0x1f')]=![];_0x5e6987[_0x5c04('0x80')]=null;_0x5e6987[_0x5c04('0x50')]=_0x18eafc[_0x5c04('0xa1')];this['channels'][_0x18eafc[_0x5c04('0x4c')]]=_0x5e6987;this['emitVoiceQueueChannelRemove'](_0x5e6987,_0x5c04('0xa6'));}else if(this[_0x5c04('0x5a')](_0x18eafc[_0x5c04('0xa0')])&&this[_0x5c04('0x5a')](_0x18eafc[_0x5c04('0xa0')][_0x5c04('0xa7')])){if(!_0x5e6987[_0x5c04('0x1f')]){_0x5e6987[_0x5c04('0xa2')]=!![];_0x5e6987['queuecallerexitAt']=moment()[_0x5c04('0x52')](_0x5c04('0x74'));_0x5e6987[_0x5c04('0x50')]=_0x5c04('0xa8');_0x5e6987[_0x5c04('0x85')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5c04('0x10')][_0x18eafc['uniqueid']]=_0x5e6987;}}logger['info'](_0x5c04('0xa9'),_0x18eafc[_0x5c04('0x4c')],_0x5e6987[_0x5c04('0x54')],_0x5e6987[_0x5c04('0x57')],_['keys'](_0x18eafc[_0x5c04('0xa0')])[0x0],_0x18eafc[_0x5c04('0xa1')]);_0x5e6987[_0x5c04('0x14')]=this['variables'][_0x18eafc['uniqueid']];}}}}catch(_0x58616){logger[_0x5c04('0x3f')](_0x5c04('0x9e'),_0x18eafc['uniqueid'],util[_0x5c04('0x42')](_0x58616,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c04('0xa')][_0x5c04('0x9f')]=function(_0x29ca59,_0x5dae9e,_0x1e5ed7){var _0x2e4529=[_0x5c04('0xaa'),_0x5c04('0xab'),'rtpaudioqosjitter',_0x5c04('0xac'),_0x5c04('0xad'),_0x5c04('0xae'),_0x5c04('0xaf'),_0x5c04('0xb0'),_0x5c04('0xb1'),_0x5c04('0xb2'),_0x5c04('0xb3'),_0x5c04('0xb4'),_0x5c04('0xb5'),_0x5c04('0xb6'),_0x5c04('0xb7'),'memberlastcall','membername',_0x5c04('0xb8'),'memberrealtime'];if(!_['isNil'](_0x5dae9e)&&!_[_0x5c04('0xb9')](_0x2e4529,_0x5dae9e)){if(_['isUndefined'](this[_0x5c04('0x14')][_0x29ca59])){this['variables'][_0x29ca59]={};}this[_0x5c04('0x14')][_0x29ca59][_0x5dae9e]=_0x1e5ed7;}};VoiceQueueReport[_0x5c04('0xa')][_0x5c04('0xba')]=function(_0x17f2ed,_0x4083ef,_0x331241){var _0x5cf58f={};for(var _0x3f1189=0x0;_0x3f11890x0?!![]:![];if(!_0x26fa11){return this[_0x3e70('0x6f')](this[_0x3e70('0x13')][_0x3e70('0x70')]);}};VoiceQueueReport[_0x3e70('0x9')][_0x3e70('0x19')]=function(_0x20108e){var _0x10dd06=this['summary']['id'];if(this[_0x3e70('0x13')][_0x3e70('0x61')][_0x10dd06]&&this[_0x3e70('0x13')]['queuestatus'][_0x10dd06][_0x20108e[_0x3e70('0x62')]]){this[_0x3e70('0x13')][_0x3e70('0x61')][_0x10dd06][_0x20108e[_0x3e70('0x62')]][_0x3e70('0xf')][_0x3e70('0x71')](_0x20108e);}};VoiceQueueReport[_0x3e70('0x9')][_0x3e70('0x15')]=function(_0x4833cb){var _0x40c3af=this;try{if(this['isNotNull'](_0x4833cb)&&this['isNotNull'](_0x4833cb[_0x3e70('0x52')])){logger[_0x3e70('0x4c')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x4833cb,{'showHidden':![],'depth':null}));var _0x42de0b=this[_0x3e70('0x11')][_0x4833cb[_0x3e70('0x52')]];if(_0x42de0b){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x42de0b[_0x3e70('0x5a')]);this[_0x3e70('0x13')]['queues'][_0x42de0b[_0x3e70('0x5a')]]={'summaryEvent':_0x4833cb};this[_0x3e70('0x13')]['statusRequests']+=0x1;return ami[_0x3e70('0x3d')]({'action':_0x3e70('0x61'),'queue':_0x42de0b[_0x3e70('0x5a')]})[_0x3e70('0x60')](function(_0x43998a){if(!_0x40c3af[_0x3e70('0x13')][_0x3e70('0x61')][_0x4833cb[_0x3e70('0x62')]]){_0x40c3af[_0x3e70('0x13')][_0x3e70('0x61')][_0x4833cb[_0x3e70('0x62')]]={};}_0x40c3af['summary'][_0x3e70('0x61')][_0x4833cb['actionid']][_0x43998a[_0x3e70('0x62')]]={'queue':_0x42de0b[_0x3e70('0x5a')],'agents':[]};})[_0x3e70('0x5d')](function(_0x28178d){throw _0x28178d;});}}}catch(_0x2908f4){logger[_0x3e70('0x42')](_0x3e70('0x72'),util[_0x3e70('0x44')](_0x2908f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3e70('0x9')]['syncQueueSummaryComplete']=function(_0x43f3a3){if(this[_0x3e70('0x13')][_0x3e70('0x6e')]>0x0){this[_0x3e70('0x13')]['completeEvent']=_0x43f3a3;return;}logger[_0x3e70('0x4c')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x43f3a3,{'showHidden':![],'depth':null}));this[_0x3e70('0x13')]=initializeSummary();ami[_0x3e70('0x4b')](_0x3e70('0x73'),{});};VoiceQueueReport[_0x3e70('0x9')][_0x3e70('0x1d')]=function(_0x1cf2c0){try{if(this[_0x3e70('0x74')](_0x1cf2c0)){logger[_0x3e70('0x4c')](_0x3e70('0x75'),_0x1cf2c0[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x1cf2c0,{'showHidden':![],'depth':null}));if(_[_0x3e70('0x76')](this[_0x3e70('0xe')][_0x1cf2c0[_0x3e70('0x4f')]])){this[_0x3e70('0xe')][_0x1cf2c0['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x1cf2c0[_0x3e70('0x4f')]])){this['channels'][_0x1cf2c0[_0x3e70('0x4f')]]={};}var _0xa20f59=new QueueReport();_0xa20f59['queue']=_0x1cf2c0[_0x3e70('0x52')];_0xa20f59[_0x3e70('0x58')]=this[_0x3e70('0x11')][_0xa20f59[_0x3e70('0x52')]]&&this[_0x3e70('0x11')][_0xa20f59[_0x3e70('0x52')]][_0x3e70('0x58')]?this[_0x3e70('0x11')][_0xa20f59[_0x3e70('0x52')]]['type']||'inbound':_0x3e70('0x6b');_0xa20f59[_0x3e70('0x77')]=moment()[_0x3e70('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0xa20f59[_0x3e70('0x78')]=_0x1cf2c0[_0x3e70('0x78')];_0xa20f59[_0x3e70('0x79')]=_0x1cf2c0['count'];_0xa20f59['uniqueid']=_0x1cf2c0[_0x3e70('0x4f')];_0xa20f59[_0x3e70('0x7a')]=this[_0x3e70('0x10')][_0x1cf2c0['uniqueid']][_0x3e70('0x7a')];logger[_0x3e70('0x7b')](_0x3e70('0x7c'),_0xa20f59[_0x3e70('0x52')],_0xa20f59[_0x3e70('0x58')]);Object[_0x3e70('0x68')](_0xa20f59,_[_0x3e70('0x7d')](_0x1cf2c0,_[_0x3e70('0x7e')](_0xa20f59)));this['queueReports'][_0x1cf2c0[_0x3e70('0x4f')]]['push'](_0xa20f59);this[_0x3e70('0x10')][_0x1cf2c0[_0x3e70('0x4f')]]=_0xa20f59;this[_0x3e70('0x7f')](_0xa20f59,'queuecallerjoin');}}catch(_0x35e1bf){logger[_0x3e70('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1cf2c0[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x35e1bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3e70('0x1f')]=function(_0x58f39f){try{if(this['isNotNull'](_0x58f39f)){logger[_0x3e70('0x4c')](_0x3e70('0x80'),_0x58f39f[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x58f39f,{'showHidden':![],'depth':null}));if(this[_0x3e70('0xe')][_0x58f39f['uniqueid']]){var _0x2d9c67=_['last'](this[_0x3e70('0xe')][_0x58f39f['uniqueid']]);_0x2d9c67[_0x3e70('0x39')]=![];_0x2d9c67[_0x3e70('0x81')]=null;_0x2d9c67[_0x3e70('0x82')]=_0x58f39f['holdtime'];_0x2d9c67[_0x3e70('0x83')]=_0x58f39f['originalposition'];_0x2d9c67['queuecallerabandon']=!![];_0x2d9c67[_0x3e70('0x84')]=moment()['format'](_0x3e70('0x85'));_0x2d9c67[_0x3e70('0x86')]='ABANDONED';_0x2d9c67[_0x3e70('0x87')]=null;logger[_0x3e70('0x7b')](_0x3e70('0x88'),_0x2d9c67['queue'],_0x2d9c67[_0x3e70('0x58')]);this[_0x3e70('0x10')][_0x58f39f[_0x3e70('0x4f')]]=_0x2d9c67;this['emitVoiceQueueChannelRemove'](_0x2d9c67,_0x3e70('0x1e'));}}}catch(_0x4d9894){logger['error'](_0x3e70('0x80'),_0x58f39f['uniqueid'],util[_0x3e70('0x44')](_0x4d9894,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3e70('0x9')][_0x3e70('0x89')]=function(_0x46cf31){try{if(this[_0x3e70('0x74')](_0x46cf31)){logger['debug'](_0x3e70('0x8a'),_0x46cf31[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x46cf31,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x46cf31[_0x3e70('0x4f')]]){var _0x25023f=_[_0x3e70('0x8b')](this[_0x3e70('0xe')][_0x46cf31[_0x3e70('0x4f')]]);_0x25023f[_0x3e70('0x8c')]=moment()[_0x3e70('0x50')](_0x3e70('0x85'));_0x25023f[_0x3e70('0x8d')]=_0x46cf31[_0x3e70('0x8d')];_0x25023f[_0x3e70('0x8e')]=_0x46cf31[_0x3e70('0x8e')];logger['info'](_0x3e70('0x8f'),_0x25023f['queue'],_0x25023f['type'],_0x46cf31[_0x3e70('0x8d')],_0x46cf31['connectedlinename']);this[_0x3e70('0x10')][_0x46cf31['uniqueid']]=_0x25023f;this['emitVoiceQueueChannelSave'](_0x25023f,'queuecallerleave');}}}catch(_0x1a4275){logger[_0x3e70('0x42')](_0x3e70('0x8a'),_0x46cf31[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x1a4275,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3e70('0x9')]['syncAgentConnect']=function(_0x1db955){try{if(this[_0x3e70('0x74')](_0x1db955)){logger['debug'](_0x3e70('0x90'),_0x1db955[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x1db955,{'showHidden':![],'depth':null}));if(this[_0x3e70('0xe')][_0x1db955['uniqueid']]){var _0x4bb603=_[_0x3e70('0x8b')](this['queueReports'][_0x1db955[_0x3e70('0x4f')]]);_0x4bb603[_0x3e70('0x39')]=!![];_0x4bb603[_0x3e70('0x86')]=_0x3e70('0x91');logger[_0x3e70('0x7b')](_0x3e70('0x92'),_0x4bb603['queue'],_0x4bb603[_0x3e70('0x58')]);}}}catch(_0x34a282){logger[_0x3e70('0x42')](_0x3e70('0x90'),_0x1db955[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x34a282,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3e70('0x9')]['syncAgentComplete']=function(_0x394be2){try{if(this[_0x3e70('0x74')](_0x394be2)){logger[_0x3e70('0x4c')](_0x3e70('0x93'),_0x394be2[_0x3e70('0x4f')],util[_0x3e70('0x44')](_0x394be2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x394be2[_0x3e70('0x4f')]]){var _0x2d0e1e=_[_0x3e70('0x8b')](this['queueReports'][_0x394be2['uniqueid']]);_0x2d0e1e[_0x3e70('0x1e')]=![];_0x2d0e1e[_0x3e70('0x84')]=null;_0x2d0e1e[_0x3e70('0x94')]=!![];_0x2d0e1e[_0x3e70('0x87')]=_0x394be2[_0x3e70('0x95')];_0x2d0e1e['holdtime']=_0x394be2[_0x3e70('0x82')];_0x2d0e1e[_0x3e70('0x39')]=!![];_0x2d0e1e[_0x3e70('0x38')]=![];_0x2d0e1e[_0x3e70('0x96')]=null;if(!_0x2d0e1e['transfer']){if(_0x394be2[_0x3e70('0x97')]==_0x3e70('0x98')){_0x2d0e1e[_0x3e70('0x86')]=_0x3e70('0x99');logger[_0x3e70('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2d0e1e[_0x3e70('0x52')],_0x2d0e1e[_0x3e70('0x58')]);}else{if(_[_0x3e70('0x9a')](_0x394be2[_0x3e70('0x3f')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x394be2['linkedid']]){var _0x4149f8=_[_0x3e70('0x8b')](this['queueReports'][_0x394be2[_0x3e70('0x9b')]]);_0x4149f8[_0x3e70('0x39')]=![];_0x4149f8[_0x3e70('0x38')]=!![];_0x4149f8[_0x3e70('0x96')]=moment(_0x2d0e1e[_0x3e70('0x77')])['add'](_0x394be2[_0x3e70('0x82')],_0x3e70('0x9c'))[_0x3e70('0x50')](_0x3e70('0x85'));_0x4149f8[_0x3e70('0x86')]=_0x3e70('0x9d');_0x4149f8['transfer']=!![];_0x4149f8[_0x3e70('0x9e')]=_0x3e70('0x9f');_0x4149f8[_0x3e70('0xa0')]=_0x394be2['destexten'];_0x4149f8['transferuniqueid']=_0x394be2[_0x3e70('0x4f')];logger[_0x3e70('0x7b')](_0x3e70('0xa1'),_0x4149f8['queue'],_0x4149f8[_0x3e70('0x58')]);var _0x5e717f=this['queueReports'][_0x394be2[_0x3e70('0x9b')]];this[_0x3e70('0xe')][_0x394be2['linkedid']]=this[_0x3e70('0xe')][_0x394be2['uniqueid']];this[_0x3e70('0xe')][_0x394be2[_0x3e70('0x4f')]]=_0x5e717f;}}else{_0x2d0e1e[_0x3e70('0x86')]='COMPLETEDBY'+_0x394be2['reason']['toUpperCase']();logger['info'](_0x3e70('0xa2'),_0x2d0e1e['queue'],_0x2d0e1e[_0x3e70('0x58')],_0x2d0e1e[_0x3e70('0x86')]);}}}this[_0x3e70('0x10')][_0x394be2['uniqueid']]=_0x2d0e1e;}}}catch(_0x1936e3){logger[_0x3e70('0x42')](_0x3e70('0x93'),_0x394be2['uniqueid'],util[_0x3e70('0x44')](_0x1936e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3e70('0x26')]=function(_0x49679b){try{if(this[_0x3e70('0x74')](_0x49679b)){logger['debug'](_0x3e70('0xa3'),_0x49679b['uniqueid'],util[_0x3e70('0x44')](_0x49679b,{'showHidden':![],'depth':null}));this[_0x3e70('0xa4')](_0x49679b[_0x3e70('0x4f')],_[_0x3e70('0x7e')](_0x49679b[_0x3e70('0xa5')])[0x0],_0x49679b[_0x3e70('0xa6')]);if(this['queueReports'][_0x49679b['uniqueid']]){var _0xb0608d=_[_0x3e70('0x8b')](this[_0x3e70('0xe')][_0x49679b[_0x3e70('0x4f')]]);if(_0xb0608d){if(this[_0x3e70('0x74')](_0x49679b[_0x3e70('0xa5')])&&this[_0x3e70('0x74')](_0x49679b[_0x3e70('0xa5')]['queuestatus'])){switch(_0x49679b[_0x3e70('0xa6')]){case _0x3e70('0xa7'):_0xb0608d[_0x3e70('0x38')]=![];_0xb0608d[_0x3e70('0x96')]=null;break;case _0x3e70('0xa8'):_0xb0608d[_0x3e70('0xa9')]=_0x3e70('0xaa');_0xb0608d['queuecallerexit']=!![];_0xb0608d[_0x3e70('0x96')]=moment()[_0x3e70('0x50')](_0x3e70('0x85'));_0xb0608d[_0x3e70('0x8c')]=moment()[_0x3e70('0x50')](_0x3e70('0x85'));logger['debug'](_0x3e70('0xab'),_0x49679b['uniqueid'],util['inspect'](_0xb0608d,{'showHidden':![],'depth':null}));ami[_0x3e70('0x4b')]('custom:timeout',_0xb0608d);break;default:_0xb0608d['queuecallerexit']=!![];_0xb0608d['queuecallerexitAt']=moment()[_0x3e70('0x50')](_0x3e70('0x85'));_0xb0608d[_0x3e70('0x8c')]=moment()[_0x3e70('0x50')](_0x3e70('0x85'));}_0xb0608d['queuecallerabandon']=![];_0xb0608d[_0x3e70('0x84')]=null;_0xb0608d[_0x3e70('0x86')]=_0x49679b[_0x3e70('0xa6')];this[_0x3e70('0x10')][_0x49679b[_0x3e70('0x4f')]]=_0xb0608d;this[_0x3e70('0x4a')](_0xb0608d,'varset');}else if(this[_0x3e70('0x74')](_0x49679b[_0x3e70('0xa5')])&&this[_0x3e70('0x74')](_0x49679b[_0x3e70('0xa5')][_0x3e70('0xac')])){if(!_0xb0608d['queuecallerabandon']){_0xb0608d['queuecallerexit']=!![];_0xb0608d[_0x3e70('0x96')]=moment()[_0x3e70('0x50')](_0x3e70('0x85'));_0xb0608d[_0x3e70('0x86')]=_0x3e70('0xad');_0xb0608d['queuecallerleaveAt']=moment()[_0x3e70('0x50')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3e70('0x10')][_0x49679b['uniqueid']]=_0xb0608d;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x49679b[_0x3e70('0x4f')],_0xb0608d[_0x3e70('0x52')],_0xb0608d['type'],_[_0x3e70('0x7e')](_0x49679b[_0x3e70('0xa5')])[0x0],_0x49679b[_0x3e70('0xa6')]);_0xb0608d[_0x3e70('0x46')]=this[_0x3e70('0x46')][_0x49679b['uniqueid']];}}}}catch(_0x1d0f74){logger[_0x3e70('0x42')](_0x3e70('0xa3'),_0x49679b['uniqueid'],util[_0x3e70('0x44')](_0x1d0f74,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3e70('0x9')]['addVariable']=function(_0x33bd69,_0x5f8ca9,_0x422134){var _0x26f278=[_0x3e70('0xae'),_0x3e70('0xaf'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x3e70('0xb0'),_0x3e70('0xb1'),_0x3e70('0xb2'),_0x3e70('0xb3'),_0x3e70('0xb4'),_0x3e70('0xb5'),'bridgepeer',_0x3e70('0xb6'),_0x3e70('0xb7'),_0x3e70('0xb8'),'memberinterface',_0x3e70('0xb9'),'membername',_0x3e70('0xba'),_0x3e70('0xbb')];if(!_[_0x3e70('0x3c')](_0x5f8ca9)&&!_[_0x3e70('0xbc')](_0x26f278,_0x5f8ca9)){if(_[_0x3e70('0x76')](this[_0x3e70('0x46')][_0x33bd69])){this[_0x3e70('0x46')][_0x33bd69]={};}this[_0x3e70('0x46')][_0x33bd69][_0x5f8ca9]=_0x422134;}};VoiceQueueReport['prototype'][_0x3e70('0xbd')]=function(_0x19ce2c,_0x148b69,_0x1f245e){var _0x31ced4={};for(var _0x2bd93a=0x0;_0x2bd93a=0x0?moment(_0x551be5[_0x96cc('0x1b')])[_0x96cc('0xf')](_0x551be5[_0x96cc('0x1a')],'seconds'):null,'data1':_0x96cc('0x1c'),'data2':_0x551be5['accountcode'],'data3':_0x551be5[_0x96cc('0x13')],'data4':_0x551be5[_0x96cc('0x1d')]||null,'role':_0x96cc('0x15'),'internal':_0x551be5[_0x96cc('0x17')]?_[_0x96cc('0x16')](_0x551be5[_0x96cc('0x17')]):undefined,'uniqueid':_0x551be5['uniqueid']},'log':_0x96cc('0x8')});}; \ No newline at end of file +var _0x52e4=['uniqueid','voiceDialReport','membername','TALKING','endtime','starttime','seconds','outbound','accountcode','dialstring','moment','util','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','agent','toNumber'];(function(_0x308904,_0x1650a7){var _0xf6ea2e=function(_0x48ba93){while(--_0x48ba93){_0x308904['push'](_0x308904['shift']());}};_0xf6ea2e(++_0x1650a7);}(_0x52e4,0x106));var _0x452e=function(_0x32b15a,_0x59ce91){_0x32b15a=_0x32b15a-0x0;var _0x265029=_0x52e4[_0x32b15a];return _0x265029;};'use strict';var moment=require(_0x452e('0x0'));var _=require('lodash');var util=require(_0x452e('0x1'));var client=require('../client');exports['voiceQueueReport']=function(_0x47b933){var _0x419799=_0x47b933['queuecallercompleteAt']||_0x47b933[_0x452e('0x2')];return client[_0x452e('0x3')](_0x452e('0x4'),{'body':{'channel':_0x452e('0x5'),'membername':_0x47b933['lastAssignedTo'],'interface':_[_0x452e('0x6')](_0x47b933[_0x452e('0x7')])?util[_0x452e('0x8')](_0x452e('0x9'),_0x47b933['lastAssignedTo']):_0x47b933[_0x452e('0x7')],'type':'TALKING','enterAt':_0x47b933[_0x452e('0xa')],'exitAt':_0x419799,'duration':moment(_0x419799)[_0x452e('0xb')](_0x47b933['queuecallerleaveAt'],'seconds'),'data1':_0x452e('0xc'),'data2':_0x47b933[_0x452e('0xd')],'data3':_0x47b933[_0x452e('0xe')],'data4':null,'data5':_0x47b933[_0x452e('0xf')],'role':_0x452e('0x10'),'internal':_0x47b933['accountcode']?_[_0x452e('0x11')](_0x47b933['accountcode']):undefined,'uniqueid':_0x47b933[_0x452e('0x12')]},'log':_0x452e('0x4')});};exports[_0x452e('0x13')]=function(_0x502d60){return client[_0x452e('0x3')](_0x452e('0x4'),{'body':{'channel':_0x452e('0x5'),'membername':_0x502d60[_0x452e('0x14')],'interface':_0x502d60[_0x452e('0x7')],'type':_0x452e('0x15'),'enterAt':_0x502d60['starttime'],'exitAt':_0x502d60[_0x452e('0x16')],'duration':moment(_0x502d60['endtime'])[_0x452e('0xb')](_0x502d60[_0x452e('0x17')],_0x452e('0x18'))>=0x0?moment(_0x502d60[_0x452e('0x16')])[_0x452e('0xb')](_0x502d60[_0x452e('0x17')],_0x452e('0x18')):null,'data1':_0x452e('0x19'),'data2':_0x502d60[_0x452e('0x1a')],'data3':_0x502d60[_0x452e('0xe')],'data4':_0x502d60[_0x452e('0x1b')]||null,'role':'agent','internal':_0x502d60[_0x452e('0x1a')]?_[_0x452e('0x11')](_0x502d60['accountcode']):undefined,'uniqueid':_0x502d60[_0x452e('0x12')]},'log':_0x452e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 350c177..213f89a 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 _0xa19c=['Request','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x14742f,_0x2bb4dc){var _0x354747=function(_0x5a0751){while(--_0x5a0751){_0x14742f['push'](_0x14742f['shift']());}};_0x354747(++_0x2bb4dc);}(_0xa19c,0xce));var _0xca19=function(_0x2bc077,_0x42b6ee){_0x2bc077=_0x2bc077-0x0;var _0x45aff0=_0xa19c[_0x2bc077];return _0x45aff0;};'use strict';var client=require(_0xca19('0x0'));exports[_0xca19('0x1')]=function(){return client[_0xca19('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xca19('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xb264=['../client','getSettings','ShowSetting','GetSettings'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4b26('0x0'));exports[_0x4b26('0x1')]=function(){return client['Request'](_0x4b26('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x4b26('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0b658f0..b23bf3a 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 _0x52e1=['GetTemplate','../client','getTemplates','Request','name','html'];(function(_0x5acc7b,_0x22adf0){var _0x58d32d=function(_0x36e7df){while(--_0x36e7df){_0x5acc7b['push'](_0x5acc7b['shift']());}};_0x58d32d(++_0x22adf0);}(_0x52e1,0x175));var _0x152e=function(_0x53c3dd,_0x583b9a){_0x53c3dd=_0x53c3dd-0x0;var _0x6dcf16=_0x52e1[_0x53c3dd];return _0x6dcf16;};'use strict';var client=require(_0x152e('0x0'));exports[_0x152e('0x1')]=function(_0x188f4a){return function(_0x53d97c){return client[_0x152e('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x152e('0x3'),_0x152e('0x4')]},'log':_0x152e('0x5')});};}; \ No newline at end of file +var _0xbff1=['GetTemplate','name','../client','Request'];(function(_0x3d3d7b,_0x5c0937){var _0x33e7c8=function(_0xe0ee81){while(--_0xe0ee81){_0x3d3d7b['push'](_0x3d3d7b['shift']());}};_0x33e7c8(++_0x5c0937);}(_0xbff1,0x8a));var _0x1bff=function(_0x530e38,_0x5f1d0f){_0x530e38=_0x530e38-0x0;var _0x4b6a58=_0xbff1[_0x530e38];return _0x4b6a58;};'use strict';var client=require(_0x1bff('0x0'));exports['getTemplates']=function(_0x2e8bd8){return function(_0xf101a5){return client[_0x1bff('0x1')](_0x1bff('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1bff('0x3'),'html']},'log':_0x1bff('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2d97d81..1b3bc4e 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 _0xef47=['field','Action','Actions','data1','data3','data4','data5','data6','data7','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','operator','value'];(function(_0x480fc2,_0x482fba){var _0x540a95=function(_0x4b5a56){while(--_0x4b5a56){_0x480fc2['push'](_0x480fc2['shift']());}};_0x540a95(++_0x482fba);}(_0xef47,0x1b9));var _0x7ef4=function(_0x4a38f0,_0x157ed2){_0x4a38f0=_0x4a38f0-0x0;var _0x40fb0a=_0xef47[_0x4a38f0];return _0x40fb0a;};'use strict';var client=require('../client');exports[_0x7ef4('0x0')]=function(_0x23566e){return function(_0x2ff638){return client['Request'](_0x7ef4('0x1'),{'options':{'raw':![],'attributes':['id',_0x7ef4('0x2'),_0x7ef4('0x3'),_0x7ef4('0x4')],'include':[{'model':_0x7ef4('0x5'),'as':_0x7ef4('0x6'),'attributes':['id','field',_0x7ef4('0x7'),_0x7ef4('0x8')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x7ef4('0x9'),_0x7ef4('0x7'),_0x7ef4('0x8')]},{'model':_0x7ef4('0xa'),'as':_0x7ef4('0xb'),'attributes':['id','action',_0x7ef4('0xc'),'data2',_0x7ef4('0xd'),_0x7ef4('0xe'),_0x7ef4('0xf'),_0x7ef4('0x10'),_0x7ef4('0x11')]}]},'log':_0x7ef4('0x1')});};}; \ No newline at end of file +var _0x2426=['Condition','AllConditions','value','operator','Action','action','data1','data2','data3','data6','GetTrigger','../client','getTriggers','name','status'];(function(_0x26c112,_0x41e2fd){var _0x4933d8=function(_0x5d33ab){while(--_0x5d33ab){_0x26c112['push'](_0x26c112['shift']());}};_0x4933d8(++_0x41e2fd);}(_0x2426,0x1af));var _0x6242=function(_0x5449d9,_0x221248){_0x5449d9=_0x5449d9-0x0;var _0x38849f=_0x2426[_0x5449d9];return _0x38849f;};'use strict';var client=require(_0x6242('0x0'));exports[_0x6242('0x1')]=function(_0x28e37b){return function(_0x323d38){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x6242('0x2'),'channel',_0x6242('0x3')],'include':[{'model':_0x6242('0x4'),'as':_0x6242('0x5'),'attributes':['id','field','operator',_0x6242('0x6')]},{'model':'Condition','as':'AnyConditions','attributes':['id','field',_0x6242('0x7'),'value']},{'model':_0x6242('0x8'),'as':'Actions','attributes':['id',_0x6242('0x9'),_0x6242('0xa'),_0x6242('0xb'),_0x6242('0xc'),'data4','data5',_0x6242('0xd'),'data7']}]},'log':_0x6242('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1073b29..45d80a0 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 _0xa952=['name','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x1bca2e,_0x2e5dbc){var _0x11ab8d=function(_0x3e40d4){while(--_0x3e40d4){_0x1bca2e['push'](_0x1bca2e['shift']());}};_0x11ab8d(++_0x2e5dbc);}(_0xa952,0x1b2));var _0x2a95=function(_0x438578,_0xeccb24){_0x438578=_0x438578-0x0;var _0x55f90b=_0xa952[_0x438578];return _0x55f90b;};'use strict';var client=require(_0x2a95('0x0'));exports[_0x2a95('0x1')]=function(_0x1b8b45){return function(_0x3e7c4){return client[_0x2a95('0x2')](_0x2a95('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2a95('0x4'),'registry',_0x2a95('0x5')]},'log':_0x2a95('0x3')});};}; \ No newline at end of file +var _0x26ed=['defaultuser','../client','GetTrunk','name','registry'];(function(_0x8b3af9,_0x3fe1da){var _0x1e74b7=function(_0x502193){while(--_0x502193){_0x8b3af9['push'](_0x8b3af9['shift']());}};_0x1e74b7(++_0x3fe1da);}(_0x26ed,0x1f0));var _0xd26e=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x26ed[_0x25701b];return _0x3a8a2c;};'use strict';var client=require(_0xd26e('0x0'));exports['getTrunks']=function(_0x29a198){return function(_0x371d95){return client['Request'](_0xd26e('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd26e('0x2'),_0xd26e('0x3'),_0xd26e('0x4')]},'log':_0xd26e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f10f28a..1f525fe 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x59c18a,_0x3703ae){var _0x4132bf=function(_0x812bf6){while(--_0x812bf6){_0x59c18a['push'](_0x59c18a['shift']());}};_0x4132bf(++_0x3703ae);}(_0x34e8,0x12c));var _0x834e=function(_0x239806,_0x45145d){_0x239806=_0x239806-0x0;var _0x2a34d6=_0x34e8[_0x239806];return _0x2a34d6;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 61918c6..3b5effe 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 _0x2ecf=['update','Request','UpdateVoiceAgentReport','create','CreateVoiceAgentReport'];(function(_0x2d31d1,_0x554675){var _0x394f92=function(_0x23da38){while(--_0x23da38){_0x2d31d1['push'](_0x2d31d1['shift']());}};_0x394f92(++_0x554675);}(_0x2ecf,0x15c));var _0xf2ec=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x2ecf[_0x1969a7];return _0x3d665f;};'use strict';var client=require('../client');exports[_0xf2ec('0x0')]=function(_0x39436e){return client['Request'](_0xf2ec('0x1'),{'body':_0x39436e,'log':_0xf2ec('0x1')});};exports[_0xf2ec('0x2')]=function(_0x600b3a,_0x3fcef1,_0x512019){return client[_0xf2ec('0x3')](_0xf2ec('0x4'),{'body':_0x600b3a,'options':{'where':{'uniqueid':_0x3fcef1,'interface':_0x512019,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xf5f3=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3de4c6,_0x1494d1){var _0x2f33a7=function(_0x3e25ec){while(--_0x3e25ec){_0x3de4c6['push'](_0x3de4c6['shift']());}};_0x2f33a7(++_0x1494d1);}(_0xf5f3,0x13a));var _0x3f5f=function(_0x3ab4de,_0x1be9b6){_0x3ab4de=_0x3ab4de-0x0;var _0x36b23d=_0xf5f3[_0x3ab4de];return _0x36b23d;};'use strict';var client=require(_0x3f5f('0x0'));exports['create']=function(_0x4f8be6){return client[_0x3f5f('0x1')](_0x3f5f('0x2'),{'body':_0x4f8be6,'log':_0x3f5f('0x2')});};exports[_0x3f5f('0x3')]=function(_0x4ac42c,_0x1e7e68,_0x589960){return client[_0x3f5f('0x1')](_0x3f5f('0x4'),{'body':_0x4ac42c,'options':{'where':{'uniqueid':_0x1e7e68,'interface':_0x589960,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 31a3e9b..3c10c7d 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 _0xa988=['billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration'];(function(_0xae5354,_0x44cdda){var _0x4ee434=function(_0xa383d9){while(--_0xa383d9){_0xae5354['push'](_0xae5354['shift']());}};_0x4ee434(++_0x44cdda);}(_0xa988,0x17c));var _0x8a98=function(_0x7ec322,_0xc55c5f){_0x7ec322=_0x7ec322-0x0;var _0x45b5db=_0xa988[_0x7ec322];return _0x45b5db;};'use strict';var moment=require(_0x8a98('0x0'));var util=require(_0x8a98('0x1'));var _=require(_0x8a98('0x2'));var client=require(_0x8a98('0x3'));exports['create']=function(_0xf5a03c){return client[_0x8a98('0x4')](_0x8a98('0x5'),{'body':_['merge'](_0xf5a03c,{'source':_0xf5a03c['calleridnum'],'destinationcontext':_0xf5a03c[_0x8a98('0x6')],'callerid':_0xf5a03c[_0x8a98('0x7')],'amaflags':_0x8a98('0x8')}),'log':_0x8a98('0x5')});};exports[_0x8a98('0x9')]=function(){return function(){return client[_0x8a98('0x4')](_0x8a98('0xa'),{'options':{'where':{'type':[_0x8a98('0xb')],'createdAt':{'$between':[moment()[_0x8a98('0xc')]('day')['format'](_0x8a98('0xd')),moment()[_0x8a98('0xe')]('day')[_0x8a98('0xf')](_0x8a98('0xd'))]}},'attributes':[_0x8a98('0x10'),_0x8a98('0x11'),_0x8a98('0x12'),_0x8a98('0x13')]},'log':_0x8a98('0x14')});};}; \ No newline at end of file +var _0x9d52=['context','callerid','DOCUMENTATION','Request','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0x9d52,0x1b1));var _0x29d5=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0x9d52[_0x16eb11];return _0x3ae7ef;};'use strict';var moment=require(_0x29d5('0x0'));var util=require(_0x29d5('0x1'));var _=require(_0x29d5('0x2'));var client=require(_0x29d5('0x3'));exports[_0x29d5('0x4')]=function(_0x44fd38){return client['Request'](_0x29d5('0x5'),{'body':_[_0x29d5('0x6')](_0x44fd38,{'source':_0x44fd38[_0x29d5('0x7')],'destinationcontext':_0x44fd38[_0x29d5('0x8')],'callerid':_0x44fd38[_0x29d5('0x9')],'amaflags':_0x29d5('0xa')}),'log':_0x29d5('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x29d5('0xb')](_0x29d5('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x29d5('0xd')](_0x29d5('0xe'))[_0x29d5('0xf')](_0x29d5('0x10')),moment()[_0x29d5('0x11')](_0x29d5('0xe'))[_0x29d5('0xf')](_0x29d5('0x10'))]}},'attributes':[_0x29d5('0x12'),'disposition',_0x29d5('0x13'),_0x29d5('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 24f7d57..b6d4c2d 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 _0x9967=['create','Request','CreateVoiceDialReport','../client'];(function(_0x3ffaaf,_0x2a0388){var _0x1a4efc=function(_0x46e23c){while(--_0x46e23c){_0x3ffaaf['push'](_0x3ffaaf['shift']());}};_0x1a4efc(++_0x2a0388);}(_0x9967,0xb3));var _0x7996=function(_0x3a4184,_0x4d4439){_0x3a4184=_0x3a4184-0x0;var _0x5c19a8=_0x9967[_0x3a4184];return _0x5c19a8;};'use strict';var client=require(_0x7996('0x0'));exports[_0x7996('0x1')]=function(_0x59d1bc){return client[_0x7996('0x2')]('CreateVoiceDialReport',{'body':_0x59d1bc,'log':_0x7996('0x3')});}; \ No newline at end of file +var _0x4615=['CreateVoiceDialReport','create','Request'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x4615,0xe2));var _0x5461=function(_0x488591,_0x2daa70){_0x488591=_0x488591-0x0;var _0xcb2719=_0x4615[_0x488591];return _0xcb2719;};'use strict';var client=require('../client');exports[_0x5461('0x0')]=function(_0x3c053f){return client[_0x5461('0x1')]('CreateVoiceDialReport',{'body':_0x3c053f,'log':_0x5461('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 4b3d354..1be02e0 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 _0x9e0d=['GetVoiceExtension','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x4d68e1,_0x3cf4e3){var _0x32d1d3=function(_0x363bbe){while(--_0x363bbe){_0x4d68e1['push'](_0x4d68e1['shift']());}};_0x32d1d3(++_0x3cf4e3);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x9e0d[_0x183b97];return _0x629cf7;};'use strict';var client=require(_0xd9e0('0x0'));exports[_0xd9e0('0x1')]=function(){return function(){return client[_0xd9e0('0x2')](_0xd9e0('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xd9e0('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xd9e0('0x1')});};}; \ No newline at end of file +var _0xb248=['GetVoiceExtension','exten','recordingFormat','../client','Request'];(function(_0x3a8268,_0x73312a){var _0x248d05=function(_0x2826b9){while(--_0x2826b9){_0x3a8268['push'](_0x3a8268['shift']());}};_0x248d05(++_0x73312a);}(_0xb248,0xc6));var _0x8b24=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xb248[_0x273c39];return _0x46d6b5;};'use strict';var client=require(_0x8b24('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x8b24('0x1')](_0x8b24('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8b24('0x3'),_0x8b24('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 907e9ff..739dd7e 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 _0xd1b1=['dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd1b1,0x8b));var _0x1d1b=function(_0x79743c,_0x2f9cb9){_0x79743c=_0x79743c-0x0;var _0xae37c=_0xd1b1[_0x79743c];return _0xae37c;};'use strict';var client=require('../client');exports[_0x1d1b('0x0')]=function(){return function(){return client[_0x1d1b('0x1')](_0x1d1b('0x2'),{'options':{'raw':![],'attributes':['id',_0x1d1b('0x3'),_0x1d1b('0x4'),'acwTimeout','autopause','monitor_format','type',_0x1d1b('0x5'),_0x1d1b('0x6'),_0x1d1b('0x7'),'dialLimitQueue',_0x1d1b('0x8'),'dialPredictiveOptimization',_0x1d1b('0x9'),'dialPredictiveInterval',_0x1d1b('0xa'),_0x1d1b('0xb'),'dialOriginateTimeout',_0x1d1b('0xc'),_0x1d1b('0xd'),_0x1d1b('0xe'),_0x1d1b('0xf'),_0x1d1b('0x10'),_0x1d1b('0x11'),_0x1d1b('0x12'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x1d1b('0x13'),_0x1d1b('0x14'),_0x1d1b('0x15'),'dialPrefix','dialCheckDuplicateType',_0x1d1b('0x16'),_0x1d1b('0x17'),_0x1d1b('0x18'),_0x1d1b('0x19'),'dialAMDTotalAnalysisTime',_0x1d1b('0x1a'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x1d1b('0x1b'),'timeout','dialRecallMeTimeout',_0x1d1b('0x1c'),_0x1d1b('0x1d'),_0x1d1b('0x1e'),_0x1d1b('0x1f'),'dialQueueProject2',_0x1d1b('0x20'),'strategy',_0x1d1b('0x21'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x1d1b('0x22'),_0x1d1b('0x23'),_0x1d1b('0x24'),_0x1d1b('0x25'),_0x1d1b('0x26'),_0x1d1b('0x27'),_0x1d1b('0x28'),'dialAgentRejectMaxRetry',_0x1d1b('0x29'),_0x1d1b('0x2a'),_0x1d1b('0x2b'),_0x1d1b('0x2c'),_0x1d1b('0x2d'),_0x1d1b('0x2e')],'include':[{'model':'Trunk','as':_0x1d1b('0x2f'),'attributes':['id',_0x1d1b('0x3'),_0x1d1b('0x30'),_0x1d1b('0x31')]},{'model':'Pause','as':_0x1d1b('0x32'),'attributes':['id','name']},{'model':_0x1d1b('0x2f'),'as':'TrunkBackup','attributes':['id',_0x1d1b('0x3'),_0x1d1b('0x30'),_0x1d1b('0x31')]},{'model':_0x1d1b('0x33'),'as':_0x1d1b('0x33'),'attributes':['id','name'],'include':[{'model':_0x1d1b('0x33'),'as':'Intervals','attributes':['id',_0x1d1b('0x3'),_0x1d1b('0x34')]}]}]},'log':_0x1d1b('0x0')});};}; \ No newline at end of file +var _0x4ebd=['dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue'];(function(_0x208ce2,_0x48255a){var _0x5a7853=function(_0x4d43d8){while(--_0x4d43d8){_0x208ce2['push'](_0x208ce2['shift']());}};_0x5a7853(++_0x48255a);}(_0x4ebd,0x11a));var _0xd4eb=function(_0x56fe59,_0x13d58e){_0x56fe59=_0x56fe59-0x0;var _0x1768a3=_0x4ebd[_0x56fe59];return _0x1768a3;};'use strict';var client=require(_0xd4eb('0x0'));exports[_0xd4eb('0x1')]=function(){return function(){return client[_0xd4eb('0x2')](_0xd4eb('0x3'),{'options':{'raw':![],'attributes':['id',_0xd4eb('0x4'),_0xd4eb('0x5'),_0xd4eb('0x6'),_0xd4eb('0x7'),_0xd4eb('0x8'),_0xd4eb('0x9'),_0xd4eb('0xa'),'dialMethod',_0xd4eb('0xb'),_0xd4eb('0xc'),_0xd4eb('0xd'),_0xd4eb('0xe'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0xd4eb('0xf'),_0xd4eb('0x10'),'dialOriginateTimeout',_0xd4eb('0x11'),_0xd4eb('0x12'),'dialQueueProject',_0xd4eb('0x13'),_0xd4eb('0x14'),_0xd4eb('0x15'),_0xd4eb('0x16'),_0xd4eb('0x17'),'dialNoAnswerRetryFrequency',_0xd4eb('0x18'),'dialTimezone','dialGlobalInterval',_0xd4eb('0x19'),_0xd4eb('0x1a'),_0xd4eb('0x1b'),_0xd4eb('0x1c'),_0xd4eb('0x1d'),'dialAMDAfterGreetingSilence',_0xd4eb('0x1e'),'dialAMDMinWordLength',_0xd4eb('0x1f'),_0xd4eb('0x20'),_0xd4eb('0x21'),_0xd4eb('0x22'),'timeout',_0xd4eb('0x23'),_0xd4eb('0x24'),_0xd4eb('0x25'),_0xd4eb('0x26'),'dialAgiAfterHangupClient','dialQueueProject2',_0xd4eb('0x8'),'strategy',_0xd4eb('0x27'),_0xd4eb('0x28'),_0xd4eb('0x29'),_0xd4eb('0x2a'),_0xd4eb('0x2b'),'dialDropRetryFrequency',_0xd4eb('0x2c'),_0xd4eb('0x2d'),_0xd4eb('0x2e'),_0xd4eb('0x2f'),_0xd4eb('0x30'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xd4eb('0x31'),_0xd4eb('0x32'),_0xd4eb('0x33'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xd4eb('0x34'),'attributes':['id',_0xd4eb('0x4'),_0xd4eb('0x35'),_0xd4eb('0x36')]},{'model':'Pause','as':_0xd4eb('0x37'),'attributes':['id',_0xd4eb('0x4')]},{'model':_0xd4eb('0x34'),'as':_0xd4eb('0x38'),'attributes':['id',_0xd4eb('0x4'),_0xd4eb('0x35'),_0xd4eb('0x36')]},{'model':_0xd4eb('0x39'),'as':_0xd4eb('0x39'),'attributes':['id',_0xd4eb('0x4')],'include':[{'model':_0xd4eb('0x39'),'as':_0xd4eb('0x3a'),'attributes':['id','name','interval']}]}]},'log':_0xd4eb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 2be561f..3ec2740 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(_0x9d16f0,_0x2b662d){var _0x468346=function(_0x31d2dd){while(--_0x31d2dd){_0x9d16f0['push'](_0x9d16f0['shift']());}};_0x468346(++_0x2b662d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x67d76c,_0x21eef0){var _0x4cf136=function(_0x3582ed){while(--_0x3582ed){_0x67d76c['push'](_0x67d76c['shift']());}};_0x4cf136(++_0x21eef0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 a0a8665..26c0838 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 _0x0c5e=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x4f8a36,_0x37224f){var _0x5471e5=function(_0x1ca1ff){while(--_0x1ca1ff){_0x4f8a36['push'](_0x4f8a36['shift']());}};_0x5471e5(++_0x37224f);}(_0x0c5e,0x199));var _0xe0c5=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x0c5e[_0x4d82ea];return _0x257f4a;};'use strict';var client=require(_0xe0c5('0x0'));exports[_0xe0c5('0x1')]=function(_0x44c651){return function(){return client['Request'](_0xe0c5('0x2'),{'options':{'where':{'VoiceQueueId':_0x44c651,'paused':!![]},'raw':!![]},'log':_0xe0c5('0x1')});};}; \ No newline at end of file +var _0xce4e=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3f5781,_0x3dc844){var _0x178e28=function(_0x373201){while(--_0x373201){_0x3f5781['push'](_0x3f5781['shift']());}};_0x178e28(++_0x3dc844);}(_0xce4e,0x1cb));var _0xece4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xce4e[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports[_0xece4('0x0')]=function(_0x257e39){return function(){return client[_0xece4('0x1')](_0xece4('0x2'),{'options':{'where':{'VoiceQueueId':_0x257e39,'paused':!![]},'raw':!![]},'log':_0xece4('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 966e1d0..4eb5534 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x5436f3,_0x1d4061){var _0x3ece25=function(_0x254484){while(--_0x254484){_0x5436f3['push'](_0x5436f3['shift']());}};_0x3ece25(++_0x1d4061);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1160f5,_0x2a36fc){var _0x309318=function(_0x2e4ab3){while(--_0x2e4ab3){_0x1160f5['push'](_0x1160f5['shift']());}};_0x309318(++_0x2a36fc);}(_0x7a54,0x106));var _0x47a5=function(_0xe187fa,_0x3258c8){_0xe187fa=_0xe187fa-0x0;var _0x3eb79b=_0x7a54[_0xe187fa];return _0x3eb79b;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f5eefc6..93b6241 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 _0x05fe=['isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereelinkedid'];(function(_0x11af6c,_0xf0fc16){var _0x2b043f=function(_0x2e5e87){while(--_0x2e5e87){_0x11af6c['push'](_0x11af6c['shift']());}};_0x2b043f(++_0xf0fc16);}(_0x05fe,0x1b1));var _0xe05f=function(_0x4c3314,_0x5b7c1a){_0x4c3314=_0x4c3314-0x0;var _0x3d1c47=_0x05fe[_0x4c3314];return _0x3d1c47;};'use strict';var client=require(_0xe05f('0x0'));exports[_0xe05f('0x1')]={};exports[_0xe05f('0x2')]=function(_0x49ae14){return client[_0xe05f('0x3')](_0xe05f('0x4'),{'body':{'result':_0x49ae14[_0xe05f('0x5')],'transfererchannel':_0x49ae14[_0xe05f('0x6')],'transferercalleridnum':_0x49ae14[_0xe05f('0x7')],'transferercalleridname':_0x49ae14[_0xe05f('0x8')],'transfererconnectedlinenum':_0x49ae14[_0xe05f('0x9')],'transfererconnectedlinename':_0x49ae14['transfererconnectedlinename'],'transfereraccountcode':_0x49ae14[_0xe05f('0xa')],'transferercontext':_0x49ae14[_0xe05f('0xb')],'transfererexten':_0x49ae14[_0xe05f('0xc')],'transfererlinkedid':_0x49ae14['transfererlinkedid'],'transfereechannel':_0x49ae14[_0xe05f('0xd')],'transfereecalleridnum':_0x49ae14[_0xe05f('0xe')],'transfereecalleridname':_0x49ae14[_0xe05f('0xf')],'transfereeconnectedlinenum':_0x49ae14[_0xe05f('0x10')],'transfereeconnectedlinename':_0x49ae14['transfereeconnectedlinename'],'transfereeaccountcode':_0x49ae14['transfereeaccountcode'],'transfereecontext':_0x49ae14['transfereecontext'],'transfereeexten':_0x49ae14['transfereeexten'],'transfereelinkedid':_0x49ae14[_0xe05f('0x11')],'isexternal':_0x49ae14[_0xe05f('0x12')],'context':_0x49ae14[_0xe05f('0x13')],'extension':_0x49ae14[_0xe05f('0x14')],'type':_0xe05f('0x15')},'log':_0xe05f('0x4')});};exports[_0xe05f('0x16')]=function(_0x2ae6c4){return client[_0xe05f('0x3')](_0xe05f('0x4'),{'body':{'result':_0x2ae6c4['result'],'transfererchannel':_0x2ae6c4[_0xe05f('0x17')],'transferercalleridnum':_0x2ae6c4[_0xe05f('0x18')],'transferercalleridname':_0x2ae6c4[_0xe05f('0x19')],'transfererconnectedlinenum':_0x2ae6c4[_0xe05f('0x1a')],'transfererconnectedlinename':_0x2ae6c4[_0xe05f('0x1b')],'transfereraccountcode':_0x2ae6c4[_0xe05f('0x1c')],'transferercontext':_0x2ae6c4['secondtransferercontext'],'transfererexten':_0x2ae6c4[_0xe05f('0x1d')],'transfererlinkedid':_0x2ae6c4[_0xe05f('0x1e')],'transfereechannel':_0x2ae6c4[_0xe05f('0x1f')],'transfereecalleridnum':_0x2ae6c4[_0xe05f('0x20')],'transfereecalleridname':_0x2ae6c4[_0xe05f('0x21')],'transfereeconnectedlinenum':_0x2ae6c4['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2ae6c4[_0xe05f('0x22')],'transfereeaccountcode':_0x2ae6c4['transfertargetaccountcode'],'transfereecontext':_0x2ae6c4[_0xe05f('0x23')],'transfereeexten':_0x2ae6c4[_0xe05f('0x24')],'transfereelinkedid':_0x2ae6c4[_0xe05f('0x25')],'isexternal':_0x2ae6c4[_0xe05f('0x12')],'context':_0x2ae6c4[_0xe05f('0x26')],'extension':_0x2ae6c4[_0xe05f('0x27')],'type':_0xe05f('0x28')},'log':_0xe05f('0x4')});}; \ No newline at end of file +var _0xe227=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers'];(function(_0x492f36,_0x1846fc){var _0x230d0b=function(_0x4a3f77){while(--_0x4a3f77){_0x492f36['push'](_0x492f36['shift']());}};_0x230d0b(++_0x1846fc);}(_0xe227,0x13e));var _0x7e22=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xe227[_0xbeb808];return _0x5d6909;};'use strict';var client=require(_0x7e22('0x0'));exports[_0x7e22('0x1')]={};exports['blindTransfer']=function(_0xcb2414){return client[_0x7e22('0x2')](_0x7e22('0x3'),{'body':{'result':_0xcb2414[_0x7e22('0x4')],'transfererchannel':_0xcb2414[_0x7e22('0x5')],'transferercalleridnum':_0xcb2414['transferercalleridnum'],'transferercalleridname':_0xcb2414[_0x7e22('0x6')],'transfererconnectedlinenum':_0xcb2414['transfererconnectedlinenum'],'transfererconnectedlinename':_0xcb2414[_0x7e22('0x7')],'transfereraccountcode':_0xcb2414[_0x7e22('0x8')],'transferercontext':_0xcb2414[_0x7e22('0x9')],'transfererexten':_0xcb2414[_0x7e22('0xa')],'transfererlinkedid':_0xcb2414[_0x7e22('0xb')],'transfereechannel':_0xcb2414[_0x7e22('0xc')],'transfereecalleridnum':_0xcb2414[_0x7e22('0xd')],'transfereecalleridname':_0xcb2414[_0x7e22('0xe')],'transfereeconnectedlinenum':_0xcb2414[_0x7e22('0xf')],'transfereeconnectedlinename':_0xcb2414['transfereeconnectedlinename'],'transfereeaccountcode':_0xcb2414[_0x7e22('0x10')],'transfereecontext':_0xcb2414[_0x7e22('0x11')],'transfereeexten':_0xcb2414[_0x7e22('0x12')],'transfereelinkedid':_0xcb2414[_0x7e22('0x13')],'isexternal':_0xcb2414['isexternal'],'context':_0xcb2414[_0x7e22('0x14')],'extension':_0xcb2414[_0x7e22('0x15')],'type':_0x7e22('0x16')},'log':_0x7e22('0x3')});};exports[_0x7e22('0x17')]=function(_0x15b8a9){return client[_0x7e22('0x2')](_0x7e22('0x3'),{'body':{'result':_0x15b8a9[_0x7e22('0x4')],'transfererchannel':_0x15b8a9[_0x7e22('0x18')],'transferercalleridnum':_0x15b8a9[_0x7e22('0x19')],'transferercalleridname':_0x15b8a9[_0x7e22('0x1a')],'transfererconnectedlinenum':_0x15b8a9['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x15b8a9[_0x7e22('0x1b')],'transfereraccountcode':_0x15b8a9['origtransfereraccountcode'],'transferercontext':_0x15b8a9[_0x7e22('0x1c')],'transfererexten':_0x15b8a9[_0x7e22('0x1d')],'transfererlinkedid':_0x15b8a9['origtransfererlinkedid'],'transfereechannel':_0x15b8a9['transfertargetchannel'],'transfereecalleridnum':_0x15b8a9[_0x7e22('0x1e')],'transfereecalleridname':_0x15b8a9[_0x7e22('0x1f')],'transfereeconnectedlinenum':_0x15b8a9['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x15b8a9['transfertargetconnectedlinename'],'transfereeaccountcode':_0x15b8a9[_0x7e22('0x20')],'transfereecontext':_0x15b8a9[_0x7e22('0x21')],'transfereeexten':_0x15b8a9[_0x7e22('0x22')],'transfereelinkedid':_0x15b8a9[_0x7e22('0x23')],'isexternal':_0x15b8a9[_0x7e22('0x24')],'context':_0x15b8a9[_0x7e22('0x25')],'extension':_0x15b8a9[_0x7e22('0x26')],'type':_0x7e22('0x27')},'log':_0x7e22('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 9a46018..7c2bbc6 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 _0xc3b5=['filter','count','rows','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','context','telephones','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','join','reload','module','action','Action','then','catch','message','pick','command','Command','content','voiceQueues','push','length','find','omit','undefined','values','channels','ami\x20disconnected','voicechannel','map','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','inbound','outbound','type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x242db9,_0x2fdb28){_0x242db9=_0x242db9-0x0;var _0x26c49e=_0xc3b5[_0x242db9];return _0x26c49e;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x5c3b('0x0'));var schema=require(_0x5c3b('0x1'));var moment=require(_0x5c3b('0x2'));var config=require(_0x5c3b('0x3'));var properties=require(_0x5c3b('0x4'));var ami=require(_0x5c3b('0x5'));var VoiceQueueSummary=require(_0x5c3b('0x6'));exports[_0x5c3b('0x7')]=function(_0x587055,_0x181e5b,_0x6b8a1e){return new Promise(function(_0x56345e,_0x568a28){var _0x30a08f={'QueuePause':function(_0x420839){return new Promise(function(_0x3892ad){var _0x5be9ee=util[_0x5c3b('0x8')](_0x5c3b('0x9'),_0x5c3b('0xa'),_0x420839[_0x5c3b('0xb')]);if(_0x587055['timers']&&_0x587055[_0x5c3b('0xc')][_0x5be9ee]&&_0x587055[_0x5c3b('0xc')][_0x5be9ee][_0x5c3b('0xd')]){_0x587055[_0x5c3b('0xc')][_0x5be9ee][_0x5c3b('0xe')]();}if(_0x587055['agents'][_0x5be9ee]){_0x587055[_0x5c3b('0xf')][_0x5be9ee][_0x5c3b('0x10')]({'statePause':_0x420839['pause']?!![]:![]});}_0x3892ad({'code':0xc8,'message':_0x5c3b('0x11')});});},'Reload':function(_0x3b953d){var _0x507c2e=this;return new Promise(function(_0x24b9d0,_0xbff1cc){if(ami[_0x5c3b('0x12')]()==![]){return _0xbff1cc(_0x507c2e[_0x5c3b('0x13')](0x1f4,[config[_0x5c3b('0x14')]['ip'],config[_0x5c3b('0x14')][_0x5c3b('0x15')],'ami\x20disconnected'][_0x5c3b('0x16')]('\x20')));}_0x3b953d=_['pick'](_0x3b953d,_['keys'](properties[_0x5c3b('0x17')][_0x5c3b('0x18')]));_0x3b953d[_0x5c3b('0x19')]='Reload';return ami[_0x5c3b('0x1a')](_0x3b953d)[_0x5c3b('0x1b')](function(_0x5b5810){_0x24b9d0({'code':0xc8,'message':_0x5b5810['message']});})[_0x5c3b('0x1c')](function(_0x34144d){_0xbff1cc(_0x507c2e['error'](0x1f5,_0x34144d[_0x5c3b('0x1d')]));});});},'Command':function(_0x4658ce){var _0x2b2307=this;return new Promise(function(_0x681ac1,_0x103943){if(ami[_0x5c3b('0x12')]()==![]){return _0x103943(_0x2b2307[_0x5c3b('0x13')](0x1f4,[config[_0x5c3b('0x14')]['ip'],config[_0x5c3b('0x14')][_0x5c3b('0x15')],'ami\x20disconnected']['join']('\x20')));}_0x4658ce=_[_0x5c3b('0x1e')](_0x4658ce,_0x5c3b('0x1f'));_0x4658ce['action']=_0x5c3b('0x20');return ami['Action'](_0x4658ce)[_0x5c3b('0x1b')](function(_0xb8006){_0x681ac1({'code':0xc8,'message':_0xb8006[_0x5c3b('0x21')]});})[_0x5c3b('0x1c')](function(_0x529c39){_0x103943(_0x2b2307[_0x5c3b('0x13')](0x1f5,_0x529c39[_0x5c3b('0x1d')]));});});},'VoiceQueues':function(){return new Promise(function(_0x54ab06){var _0x17f86d=[];for(var _0x2c8682 in _0x587055[_0x5c3b('0x22')]){if(_0x587055[_0x5c3b('0x22')]['hasOwnProperty'](_0x2c8682)){var _0x15ae38=_0x587055[_0x5c3b('0x22')][_0x2c8682];var _0x2099dc=new VoiceQueueSummary(_0x15ae38);_0x17f86d[_0x5c3b('0x23')](_0x2099dc);}}_0x54ab06({'count':_0x17f86d[_0x5c3b('0x24')],'rows':_0x17f86d});});},'UpdateVoiceQueue':function(_0x2a293d){return new Promise(function(_0x511963,_0x51fa32){var _0x4796ab=_[_0x5c3b('0x25')](_0x587055[_0x5c3b('0x22')],{'id':parseInt(_0x2a293d['id'])});var _0x59b640=_[_0x5c3b('0x26')](_0x2a293d,['id']);if(_0x4796ab){for(var _0x15044e in _0x59b640){if(typeof _0x59b640[_0x15044e]!==_0x5c3b('0x27')&&typeof _0x4796ab[_0x15044e]!==_0x5c3b('0x27')){_0x4796ab[_0x15044e]=_0x59b640[_0x15044e];}}_0x511963(_0x4796ab);}else{_0x51fa32();}});},'VoiceChannels':function(){return new Promise(function(_0x19a73d){var _0x35b48e=_[_0x5c3b('0x28')](_0x587055[_0x5c3b('0x29')]);_0x19a73d({'count':_0x35b48e[_0x5c3b('0x24')],'rows':_0x35b48e});});},'VoiceChannelMixMonitor':function(_0x13ca8a){var _0x4765b3=this;return new Promise(function(_0x347b91,_0x5a5d9e){if(ami[_0x5c3b('0x12')]()==![]){return _0x5a5d9e(_0x4765b3[_0x5c3b('0x13')](0x1f4,[config[_0x5c3b('0x14')]['ip'],config[_0x5c3b('0x14')][_0x5c3b('0x15')],_0x5c3b('0x2a')][_0x5c3b('0x16')]('\x20')));}var _0x2e2b9c=schema(properties[_0x5c3b('0x2b')])[_0x5c3b('0x1')](_0x13ca8a);if(_0x2e2b9c[_0x5c3b('0x24')]>0x0){return _0x5a5d9e(_0x4765b3[_0x5c3b('0x13')](0x1f4,_[_0x5c3b('0x2c')](_0x2e2b9c,_0x5c3b('0x1d'))[_0x5c3b('0x16')](',\x20')));}var _0xdd0996=_[_0x5c3b('0x25')](_0x587055['channels'],{'uniqueid':_0x13ca8a[_0x5c3b('0x2d')]});if(_0xdd0996&&_0xdd0996[_0x5c3b('0x2e')]){var _0x389c53=util[_0x5c3b('0x8')]('%s.%s',_0x13ca8a[_0x5c3b('0x2f')]||_0x13ca8a[_0x5c3b('0x2d')],_0x13ca8a['format']||_0x5c3b('0x30'));return ami[_0x5c3b('0x1a')]({'action':_0x5c3b('0x31'),'channel':_0xdd0996[_0x5c3b('0x2e')],'file':_0x389c53,'options':_0x5c3b('0x32')})[_0x5c3b('0x1b')](function(_0x27b34d){var _0x22fe25=_[_0x5c3b('0x25')](_0xdd0996['monitors'],{'filename':_0x5c3b('0x33')+_0x389c53[_0x5c3b('0x34')]()});if(_['isNil'](_0x22fe25)){_0xdd0996['monitors'][_0x5c3b('0x23')]({'filename':_0x5c3b('0x33')+_0x389c53[_0x5c3b('0x34')](),'createdAt':moment()[_0x5c3b('0x8')](_0x5c3b('0x35')),'mixmonitorid':_0x27b34d[_0x5c3b('0x36')],'status':_0x5c3b('0x37')});}else{_0x22fe25['mixmonitorid']=_0x27b34d['mixmonitorid'];_0x22fe25[_0x5c3b('0x38')]=_0x5c3b('0x37');}_0x347b91({'code':0xc8,'message':[_0x13ca8a[_0x5c3b('0x2d')],_0x5c3b('0x39'),_0x27b34d['mixmonitorid']][_0x5c3b('0x16')]('\x20'),'mixmonitorid':_0x27b34d['mixmonitorid']});})[_0x5c3b('0x1c')](function(_0x33f3ac){_0x5a5d9e(_0x4765b3[_0x5c3b('0x13')](0x1f5,[_0x13ca8a[_0x5c3b('0x2d')],_0x33f3ac[_0x5c3b('0x1d')][_0x5c3b('0x34')]()][_0x5c3b('0x16')]('\x20')));});}else{return _0x5a5d9e(_0x4765b3[_0x5c3b('0x13')](0x1f5,_0x5c3b('0x3a')));}});},'VoiceChannelStopMixMonitor':function(_0x546827){var _0x5d2fb3=this;return new Promise(function(_0x345149,_0x34f04b){if(ami[_0x5c3b('0x12')]()==![]){return _0x34f04b(_0x5d2fb3[_0x5c3b('0x13')](0x1f4,[config[_0x5c3b('0x14')]['ip'],config[_0x5c3b('0x14')][_0x5c3b('0x15')],_0x5c3b('0x2a')][_0x5c3b('0x16')]('\x20')));}var _0x56a53e=schema(properties[_0x5c3b('0x2b')])[_0x5c3b('0x1')](_0x546827);if(_0x56a53e[_0x5c3b('0x24')]>0x0){return _0x34f04b(_0x5d2fb3['error'](0x1f4,_[_0x5c3b('0x2c')](_0x56a53e,_0x5c3b('0x1d'))[_0x5c3b('0x16')](',\x20')));}var _0x5addf6=_[_0x5c3b('0x25')](_0x587055[_0x5c3b('0x29')],{'uniqueid':_0x546827[_0x5c3b('0x2d')]});if(_0x5addf6){return Promise[_0x5c3b('0x3b')]()[_0x5c3b('0x1b')](function(){if(_0x5addf6[_0x5c3b('0x2e')]){return ami[_0x5c3b('0x1a')]({'action':'StopMixMonitor','channel':_0x5addf6[_0x5c3b('0x2e')],'mixmonitorid':_0x546827['mixmonitorid']})[_0x5c3b('0x1c')](function(){});}})[_0x5c3b('0x1b')](function(){if(_0x5addf6['destinationchannel']){return ami[_0x5c3b('0x1a')]({'action':_0x5c3b('0x3c'),'channel':_0x5addf6[_0x5c3b('0x3d')],'mixmonitorid':_0x546827['mixmonitorid']})[_0x5c3b('0x1c')](function(){});}})['then'](function(){var _0x176b50=_[_0x5c3b('0x25')](_0x5addf6[_0x5c3b('0x3e')],{'mixmonitorid':_0x546827[_0x5c3b('0x36')]});if(_0x176b50){_0x176b50[_0x5c3b('0x38')]=_0x5c3b('0x3f');}})[_0x5c3b('0x1b')](function(){var _0x3d6034=util[_0x5c3b('0x8')](_0x5c3b('0x40'),_0x546827[_0x5c3b('0x2f')]||_0x546827['uniqueid'],_0x546827[_0x5c3b('0x8')]||'wav');var _0x155b22=_[_0x5c3b('0x25')](_0x5addf6[_0x5c3b('0x3e')],{'filename':'/var/spool/asterisk/monitor/'+_0x3d6034[_0x5c3b('0x34')]()});if(_0x155b22){_0x155b22[_0x5c3b('0x38')]='stop';}})[_0x5c3b('0x1b')](function(){_0x345149({'code':0xc8,'message':[_0x546827[_0x5c3b('0x2d')],_0x5c3b('0x41')][_0x5c3b('0x16')]('\x20')});})[_0x5c3b('0x1c')](function(_0x44aaad){_0x34f04b(_0x5d2fb3[_0x5c3b('0x13')](0x1f5,[_0x546827[_0x5c3b('0x2d')],_0x44aaad[_0x5c3b('0x1d')][_0x5c3b('0x34')]()][_0x5c3b('0x16')]('\x20')));});}else{return _0x34f04b(_0x5d2fb3['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x50fbb6){var _0x434c28=this;return new Promise(function(_0x203ae2){var _0x5f14fa=_[_0x5c3b('0x28')](_0x587055[_0x5c3b('0x42')]);var _0x1a978b={'count':_0x5f14fa[_0x5c3b('0x24')],'rows':_0x5f14fa};if(_0x50fbb6&&_0x50fbb6['type']){if(![_0x5c3b('0x43'),_0x5c3b('0x44')]['includes'](_0x50fbb6[_0x5c3b('0x45')])){return _0x568a28(_0x434c28[_0x5c3b('0x13')](0x190,_0x5c3b('0x46')));}var _0x98bcef=_[_0x5c3b('0x47')](_0x5f14fa,function(_0x1ba2da){return _0x1ba2da[_0x5c3b('0x45')]===_0x50fbb6[_0x5c3b('0x45')];});_0x1a978b[_0x5c3b('0x48')]=_0x98bcef[_0x5c3b('0x24')];_0x1a978b[_0x5c3b('0x49')]=_0x98bcef;}_0x203ae2(_0x1a978b);});},'VoiceQueuesChannel':function(_0x24187d){var _0x42b1d9=this;return new Promise(function(_0x5b07ee,_0x5191b5){var _0x2602ff=schema(properties[_0x5c3b('0x4a')])[_0x5c3b('0x1')](_0x24187d);if(_0x2602ff['length']>0x0){return _0x5191b5(_0x42b1d9['error'](0x1f4,_['map'](_0x2602ff,_0x5c3b('0x1d'))['join'](',\x20')));}var _0x2ddd9d=_[_0x5c3b('0x25')](_0x587055[_0x5c3b('0x42')],{'uniqueid':_0x24187d[_0x5c3b('0x2d')]});if(_0x2ddd9d){_0x5b07ee(_0x2ddd9d);}else{return _0x5191b5(_0x42b1d9[_0x5c3b('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x23d7cb){var _0x4fffb5=this;return new Promise(function(_0x2656da,_0x5e55e4){if(ami[_0x5c3b('0x12')]()==![]){return _0x5e55e4(_0x4fffb5[_0x5c3b('0x13')](0x1f4,[config[_0x5c3b('0x14')]['ip'],config[_0x5c3b('0x14')][_0x5c3b('0x15')],_0x5c3b('0x2a')][_0x5c3b('0x16')]('\x20')));}var _0x409d2e=schema(properties[_0x5c3b('0x4b')])[_0x5c3b('0x1')](_0x23d7cb);if(_0x409d2e[_0x5c3b('0x24')]>0x0){return _0x5e55e4(_0x4fffb5['error'](0x1f4,_['map'](_0x409d2e,'message')[_0x5c3b('0x16')](',\x20')));}var _0x15345e=_[_0x5c3b('0x25')](_0x587055[_0x5c3b('0x42')],{'uniqueid':_0x23d7cb['uniqueid']});if(_0x15345e&&_0x15345e['channel']){return ami[_0x5c3b('0x1a')]({'action':'Hangup','channel':_0x15345e['channel']})[_0x5c3b('0x1b')](function(_0x2b4ea3){_0x2656da({'code':0xc8,'message':[_0x23d7cb[_0x5c3b('0x2d')],_0x2b4ea3[_0x5c3b('0x1d')][_0x5c3b('0x34')]()][_0x5c3b('0x16')]('\x20')});})[_0x5c3b('0x1c')](function(_0x13043b){_0x5e55e4(_0x4fffb5[_0x5c3b('0x13')](0x1f5,[_0x23d7cb[_0x5c3b('0x2d')],_0x13043b[_0x5c3b('0x1d')][_0x5c3b('0x34')]()]['join']('\x20')));});}else{return _0x5e55e4(_0x4fffb5[_0x5c3b('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x80afe9){var _0x35b9f8=this;return new Promise(function(_0x2e0907,_0x237ed2){if(ami[_0x5c3b('0x12')]()==![]){return _0x237ed2(_0x35b9f8[_0x5c3b('0x13')](0x1f4,[config[_0x5c3b('0x14')]['ip'],config[_0x5c3b('0x14')]['username'],_0x5c3b('0x2a')]['join']('\x20')));}var _0x56c5bb=schema(properties[_0x5c3b('0x4c')])[_0x5c3b('0x1')](_0x80afe9);if(_0x56c5bb[_0x5c3b('0x24')]>0x0){return _0x237ed2(_0x35b9f8['error'](0x1f4,_[_0x5c3b('0x2c')](_0x56c5bb,_0x5c3b('0x1d'))[_0x5c3b('0x16')](',\x20')));}var _0x497515=_[_0x5c3b('0x25')](_0x587055['queueChannels'],{'uniqueid':_0x80afe9[_0x5c3b('0x2d')]});if(_0x497515&&_0x497515[_0x5c3b('0x2e')]){return ami[_0x5c3b('0x1a')]({'action':'Redirect','channel':_0x497515[_0x5c3b('0x2e')],'exten':_0x80afe9['exten'],'context':_0x80afe9[_0x5c3b('0x4d')]||_0x497515[_0x5c3b('0x4d')],'priority':0x1})[_0x5c3b('0x1b')](function(_0x5b1028){_0x2e0907({'code':0xc8,'message':[_0x80afe9[_0x5c3b('0x2d')],_0x5b1028['message'][_0x5c3b('0x34')]()][_0x5c3b('0x16')]('\x20')});})[_0x5c3b('0x1c')](function(_0x1c468f){_0x237ed2(_0x35b9f8[_0x5c3b('0x13')](0x1f5,[_0x80afe9[_0x5c3b('0x2d')],_0x1c468f[_0x5c3b('0x1d')][_0x5c3b('0x34')]()][_0x5c3b('0x16')]('\x20')));});}else{return _0x237ed2(_0x35b9f8[_0x5c3b('0x13')](0x1f5,_0x5c3b('0x3a')));}});},'Agents':function(_0x445217){return new Promise(function(_0x467427){var _0x4a07c5=_[_0x5c3b('0x28')](_0x587055[_0x5c3b('0xf')]);if(_0x445217&&_0x445217['id']){var _0x57fda1=_[_0x5c3b('0x25')](_0x4a07c5,function(_0x1ddb1d){return _0x1ddb1d['id']===_0x445217['id'];});_0x467427(_0x57fda1);}else{_0x467427({'count':_0x4a07c5[_0x5c3b('0x24')],'rows':_0x4a07c5});}});},'Telephones':function(){return new Promise(function(_0x40ec2b){var _0x398396=_[_0x5c3b('0x28')](_0x587055[_0x5c3b('0x4e')]);_0x40ec2b({'count':_0x398396[_0x5c3b('0x24')],'rows':_0x398396});});},'Trunks':function(){return new Promise(function(_0x348fc4){var _0x50f6ab=_['values'](_0x587055['trunks']);_0x348fc4({'count':_0x50f6ab['length'],'rows':_0x50f6ab});});},'OutboundChannels':function(){return new Promise(function(_0x5ac5dd){var _0x274b66=_[_0x5c3b('0x28')](_0x587055[_0x5c3b('0x4f')]);_0x5ac5dd({'count':_0x274b66['length'],'rows':_0x274b66});});},'Outbound':function(){return new Promise(function(_0x324525){_0x324525(_0x587055['outbound']);});},'Campaigns':function(){return new Promise(function(_0x328170){var _0x1aa23c=_[_0x5c3b('0x28')](_0x587055[_0x5c3b('0x50')]);_0x328170({'count':_0x1aa23c[_0x5c3b('0x24')],'rows':_0x1aa23c});});},'VoiceQueuesPreview':function(_0xbc0e51){var _0x183fa9=this;return new Promise(function(_0x1db4f0,_0x419955){_0x181e5b[_0x5c3b('0x51')](_0xbc0e51['id'])[_0x5c3b('0x1b')](function(_0x3fc618){_0x1db4f0({'code':0xc8,'message':_0x3fc618['message']});})[_0x5c3b('0x1c')](function(_0x1df72a){_0x419955(_0x183fa9[_0x5c3b('0x13')](0x1f4,_0x1df72a[_0x5c3b('0x1d')]));});});},'EventManager':function(_0x3d2b86){var _0xa84b04=this;return new Promise(function(_0x4b741d,_0x5f14dc){if(!_0x3d2b86[_0x5c3b('0x52')]){return _0x5f14dc(_0xa84b04[_0x5c3b('0x13')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x5c3b('0x53')](_0x5c3b('0x54')+_0x3d2b86[_0x5c3b('0x52')],_0x3d2b86['message']);_0x4b741d({'code':0xc8,'message':_0x3d2b86});});},'FaxAccounts':function(){return new Promise(function(_0x92d28d){var _0x1ca6cb=_[_0x5c3b('0x28')](_0x587055[_0x5c3b('0x55')]);_0x92d28d({'count':_0x1ca6cb['length'],'rows':_0x1ca6cb});});},'SendFax':function(_0x4ba6a0){var _0x1fa3fc=this;return new Promise(function(_0x15550d,_0xfb1dd0){_0x6b8a1e[_0x5c3b('0x56')](_0x4ba6a0)[_0x5c3b('0x1b')](function(_0x1545f2){_0x15550d({'code':0xc8,'message':_0x1545f2[_0x5c3b('0x1d')]});})[_0x5c3b('0x1c')](function(_0x41bc7a){_0xfb1dd0(_0x1fa3fc['error'](0x1f4,_0x41bc7a[_0x5c3b('0x1d')]));});});},'CheckAfterSend':function(_0x2348cb){var _0x394f3e=this;return new Promise(function(_0x30f7ab,_0xd88dc8){_0x6b8a1e[_0x5c3b('0x57')](_0x2348cb)[_0x5c3b('0x1b')](function(_0x36c6cd){_0x30f7ab({'code':0xc8,'message':_0x36c6cd[_0x5c3b('0x1d')]});})['catch'](function(_0x40a3d9){_0xd88dc8(_0x394f3e[_0x5c3b('0x13')](0x1f4,_0x40a3d9[_0x5c3b('0x1d')]));});});}};var _0x39a477=jayson['server'](_0x30a08f)['http']();_0x39a477['on']('error',function(_0x36df93){return _0x568a28(_0x36df93);});_0x39a477[_0x5c3b('0x7')](0x232a,_0x5c3b('0x58'),function(){console['log'](_0x5c3b('0x59'),0x232a);return _0x56345e(_0x5c3b('0x5a')+0x232a);});});}; \ No newline at end of file +var _0x33c5=['omit','undefined','channels','voicechannel','validate','map','uniqueid','channel','monitors','/var/spool/asterisk/monitor/','toLowerCase','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','%s.%s','filename','StopMixMonitor\x20Success','type','inbound','includes','count','rows','voicequeuechannel','queueChannels','Hangup','Redirect','exten','context','values','telephones','trunks','outboundChannels','outbound','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','username','command','Command','voiceQueues','hasOwnProperty','length','find'];(function(_0x890db7,_0x4dcf2c){var _0x46412=function(_0x2685df){while(--_0x2685df){_0x890db7['push'](_0x890db7['shift']());}};_0x46412(++_0x4dcf2c);}(_0x33c5,0xe6));var _0x533c=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x33c5[_0x3b231a];return _0x18d67a;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var jayson=require(_0x533c('0x1'));var schema=require('validate');var moment=require(_0x533c('0x2'));var config=require(_0x533c('0x3'));var properties=require(_0x533c('0x4'));var ami=require(_0x533c('0x5'));var VoiceQueueSummary=require(_0x533c('0x6'));exports['listen']=function(_0x10943d,_0x364b16,_0x31d912){return new Promise(function(_0x151732,_0x34ca89){var _0x1699d5={'QueuePause':function(_0x3a009b){return new Promise(function(_0x36d74e){var _0x2c297c=util[_0x533c('0x7')](_0x533c('0x8'),_0x533c('0x9'),_0x3a009b[_0x533c('0xa')]);if(_0x10943d[_0x533c('0xb')]&&_0x10943d[_0x533c('0xb')][_0x2c297c]&&_0x10943d[_0x533c('0xb')][_0x2c297c]['timer']){_0x10943d[_0x533c('0xb')][_0x2c297c][_0x533c('0xc')]();}if(_0x10943d[_0x533c('0xd')][_0x2c297c]){_0x10943d[_0x533c('0xd')][_0x2c297c][_0x533c('0xe')]({'statePause':_0x3a009b[_0x533c('0xf')]?!![]:![]});}_0x36d74e({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x5c9462){var _0xf93007=this;return new Promise(function(_0x300a63,_0x12ecae){if(ami[_0x533c('0x10')]()==![]){return _0x12ecae(_0xf93007[_0x533c('0x11')](0x1f4,[config[_0x533c('0x12')]['ip'],config[_0x533c('0x12')]['username'],_0x533c('0x13')][_0x533c('0x14')]('\x20')));}_0x5c9462=_[_0x533c('0x15')](_0x5c9462,_[_0x533c('0x16')](properties['reload'][_0x533c('0x17')]));_0x5c9462[_0x533c('0x18')]=_0x533c('0x19');return ami[_0x533c('0x1a')](_0x5c9462)[_0x533c('0x1b')](function(_0x4abaa3){_0x300a63({'code':0xc8,'message':_0x4abaa3[_0x533c('0x1c')]});})[_0x533c('0x1d')](function(_0x1f9f85){_0x12ecae(_0xf93007[_0x533c('0x11')](0x1f5,_0x1f9f85[_0x533c('0x1c')]));});});},'Command':function(_0x2c41e9){var _0x78dd72=this;return new Promise(function(_0x23f970,_0x2f21db){if(ami[_0x533c('0x10')]()==![]){return _0x2f21db(_0x78dd72[_0x533c('0x11')](0x1f4,[config[_0x533c('0x12')]['ip'],config['asterisk'][_0x533c('0x1e')],'ami\x20disconnected']['join']('\x20')));}_0x2c41e9=_[_0x533c('0x15')](_0x2c41e9,_0x533c('0x1f'));_0x2c41e9['action']=_0x533c('0x20');return ami[_0x533c('0x1a')](_0x2c41e9)[_0x533c('0x1b')](function(_0x3dd249){_0x23f970({'code':0xc8,'message':_0x3dd249['content']});})[_0x533c('0x1d')](function(_0x42c87b){_0x2f21db(_0x78dd72[_0x533c('0x11')](0x1f5,_0x42c87b[_0x533c('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x25f6ef){var _0x140269=[];for(var _0xb51a5 in _0x10943d[_0x533c('0x21')]){if(_0x10943d[_0x533c('0x21')][_0x533c('0x22')](_0xb51a5)){var _0x4d47d0=_0x10943d[_0x533c('0x21')][_0xb51a5];var _0xfab4da=new VoiceQueueSummary(_0x4d47d0);_0x140269['push'](_0xfab4da);}}_0x25f6ef({'count':_0x140269[_0x533c('0x23')],'rows':_0x140269});});},'UpdateVoiceQueue':function(_0x4f9f4a){return new Promise(function(_0x21f58d,_0x14d783){var _0x4a0e86=_[_0x533c('0x24')](_0x10943d[_0x533c('0x21')],{'id':parseInt(_0x4f9f4a['id'])});var _0x146a8e=_[_0x533c('0x25')](_0x4f9f4a,['id']);if(_0x4a0e86){for(var _0x38d886 in _0x146a8e){if(typeof _0x146a8e[_0x38d886]!==_0x533c('0x26')&&typeof _0x4a0e86[_0x38d886]!==_0x533c('0x26')){_0x4a0e86[_0x38d886]=_0x146a8e[_0x38d886];}}_0x21f58d(_0x4a0e86);}else{_0x14d783();}});},'VoiceChannels':function(){return new Promise(function(_0x441680){var _0x73c0=_['values'](_0x10943d[_0x533c('0x27')]);_0x441680({'count':_0x73c0['length'],'rows':_0x73c0});});},'VoiceChannelMixMonitor':function(_0x3290de){var _0x11c5e7=this;return new Promise(function(_0x39eda3,_0xa42b78){if(ami[_0x533c('0x10')]()==![]){return _0xa42b78(_0x11c5e7[_0x533c('0x11')](0x1f4,[config[_0x533c('0x12')]['ip'],config[_0x533c('0x12')][_0x533c('0x1e')],_0x533c('0x13')][_0x533c('0x14')]('\x20')));}var _0x3ec4c8=schema(properties[_0x533c('0x28')])[_0x533c('0x29')](_0x3290de);if(_0x3ec4c8[_0x533c('0x23')]>0x0){return _0xa42b78(_0x11c5e7['error'](0x1f4,_[_0x533c('0x2a')](_0x3ec4c8,_0x533c('0x1c'))[_0x533c('0x14')](',\x20')));}var _0x31129f=_['find'](_0x10943d[_0x533c('0x27')],{'uniqueid':_0x3290de[_0x533c('0x2b')]});if(_0x31129f&&_0x31129f[_0x533c('0x2c')]){var _0x40f077=util[_0x533c('0x7')]('%s.%s',_0x3290de['filename']||_0x3290de['uniqueid'],_0x3290de['format']||'wav');return ami[_0x533c('0x1a')]({'action':'MixMonitor','channel':_0x31129f[_0x533c('0x2c')],'file':_0x40f077,'options':'ai(mixmonitorid)'})[_0x533c('0x1b')](function(_0x3cd1e6){var _0x14c121=_['find'](_0x31129f[_0x533c('0x2d')],{'filename':_0x533c('0x2e')+_0x40f077[_0x533c('0x2f')]()});if(_['isNil'](_0x14c121)){_0x31129f[_0x533c('0x2d')][_0x533c('0x30')]({'filename':_0x533c('0x2e')+_0x40f077['toLowerCase'](),'createdAt':moment()[_0x533c('0x7')](_0x533c('0x31')),'mixmonitorid':_0x3cd1e6[_0x533c('0x32')],'status':_0x533c('0x33')});}else{_0x14c121[_0x533c('0x32')]=_0x3cd1e6[_0x533c('0x32')];_0x14c121[_0x533c('0x34')]=_0x533c('0x33');}_0x39eda3({'code':0xc8,'message':[_0x3290de[_0x533c('0x2b')],_0x533c('0x35'),_0x3cd1e6[_0x533c('0x32')]]['join']('\x20'),'mixmonitorid':_0x3cd1e6[_0x533c('0x32')]});})[_0x533c('0x1d')](function(_0x35d5ec){_0xa42b78(_0x11c5e7[_0x533c('0x11')](0x1f5,[_0x3290de[_0x533c('0x2b')],_0x35d5ec[_0x533c('0x1c')]['toLowerCase']()][_0x533c('0x14')]('\x20')));});}else{return _0xa42b78(_0x11c5e7[_0x533c('0x11')](0x1f5,_0x533c('0x36')));}});},'VoiceChannelStopMixMonitor':function(_0x5e462e){var _0x1fb236=this;return new Promise(function(_0x4170e4,_0x315e67){if(ami[_0x533c('0x10')]()==![]){return _0x315e67(_0x1fb236['error'](0x1f4,[config[_0x533c('0x12')]['ip'],config['asterisk'][_0x533c('0x1e')],_0x533c('0x13')]['join']('\x20')));}var _0x3f4015=schema(properties[_0x533c('0x28')])[_0x533c('0x29')](_0x5e462e);if(_0x3f4015['length']>0x0){return _0x315e67(_0x1fb236['error'](0x1f4,_['map'](_0x3f4015,'message')[_0x533c('0x14')](',\x20')));}var _0x5d8206=_[_0x533c('0x24')](_0x10943d['channels'],{'uniqueid':_0x5e462e[_0x533c('0x2b')]});if(_0x5d8206){return Promise['resolve']()[_0x533c('0x1b')](function(){if(_0x5d8206[_0x533c('0x2c')]){return ami['Action']({'action':_0x533c('0x37'),'channel':_0x5d8206[_0x533c('0x2c')],'mixmonitorid':_0x5e462e[_0x533c('0x32')]})[_0x533c('0x1d')](function(){});}})[_0x533c('0x1b')](function(){if(_0x5d8206['destinationchannel']){return ami[_0x533c('0x1a')]({'action':_0x533c('0x37'),'channel':_0x5d8206[_0x533c('0x38')],'mixmonitorid':_0x5e462e[_0x533c('0x32')]})['catch'](function(){});}})[_0x533c('0x1b')](function(){var _0x5080a6=_['find'](_0x5d8206['monitors'],{'mixmonitorid':_0x5e462e[_0x533c('0x32')]});if(_0x5080a6){_0x5080a6['status']=_0x533c('0x39');}})[_0x533c('0x1b')](function(){var _0x19878d=util[_0x533c('0x7')](_0x533c('0x3a'),_0x5e462e[_0x533c('0x3b')]||_0x5e462e[_0x533c('0x2b')],_0x5e462e[_0x533c('0x7')]||'wav');var _0x19ccc0=_[_0x533c('0x24')](_0x5d8206[_0x533c('0x2d')],{'filename':'/var/spool/asterisk/monitor/'+_0x19878d[_0x533c('0x2f')]()});if(_0x19ccc0){_0x19ccc0[_0x533c('0x34')]='stop';}})[_0x533c('0x1b')](function(){_0x4170e4({'code':0xc8,'message':[_0x5e462e['uniqueid'],_0x533c('0x3c')][_0x533c('0x14')]('\x20')});})[_0x533c('0x1d')](function(_0x23b2ef){_0x315e67(_0x1fb236[_0x533c('0x11')](0x1f5,[_0x5e462e[_0x533c('0x2b')],_0x23b2ef[_0x533c('0x1c')]['toLowerCase']()][_0x533c('0x14')]('\x20')));});}else{return _0x315e67(_0x1fb236[_0x533c('0x11')](0x1f5,_0x533c('0x36')));}});},'VoiceQueuesChannels':function(_0x412bfb){var _0x24ca50=this;return new Promise(function(_0x1558ef){var _0x3eb174=_['values'](_0x10943d['queueChannels']);var _0x57efa5={'count':_0x3eb174['length'],'rows':_0x3eb174};if(_0x412bfb&&_0x412bfb[_0x533c('0x3d')]){if(![_0x533c('0x3e'),'outbound'][_0x533c('0x3f')](_0x412bfb[_0x533c('0x3d')])){return _0x34ca89(_0x24ca50[_0x533c('0x11')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x1de19e=_['filter'](_0x3eb174,function(_0x50cfbc){return _0x50cfbc[_0x533c('0x3d')]===_0x412bfb[_0x533c('0x3d')];});_0x57efa5[_0x533c('0x40')]=_0x1de19e[_0x533c('0x23')];_0x57efa5[_0x533c('0x41')]=_0x1de19e;}_0x1558ef(_0x57efa5);});},'VoiceQueuesChannel':function(_0x3bb176){var _0x1b74d7=this;return new Promise(function(_0x51190c,_0x1ec3d0){var _0x4ef71e=schema(properties[_0x533c('0x42')])[_0x533c('0x29')](_0x3bb176);if(_0x4ef71e[_0x533c('0x23')]>0x0){return _0x1ec3d0(_0x1b74d7[_0x533c('0x11')](0x1f4,_[_0x533c('0x2a')](_0x4ef71e,_0x533c('0x1c'))[_0x533c('0x14')](',\x20')));}var _0x1f715c=_['find'](_0x10943d[_0x533c('0x43')],{'uniqueid':_0x3bb176[_0x533c('0x2b')]});if(_0x1f715c){_0x51190c(_0x1f715c);}else{return _0x1ec3d0(_0x1b74d7[_0x533c('0x11')](0x1f5,_0x533c('0x36')));}});},'VoiceQueuesChannelHangup':function(_0x37ea57){var _0x25182f=this;return new Promise(function(_0x534859,_0x123c8f){if(ami['isConnected']()==![]){return _0x123c8f(_0x25182f[_0x533c('0x11')](0x1f4,[config[_0x533c('0x12')]['ip'],config[_0x533c('0x12')][_0x533c('0x1e')],_0x533c('0x13')][_0x533c('0x14')]('\x20')));}var _0x5cc8bc=schema(properties['voicequeuechannelhangup'])[_0x533c('0x29')](_0x37ea57);if(_0x5cc8bc[_0x533c('0x23')]>0x0){return _0x123c8f(_0x25182f[_0x533c('0x11')](0x1f4,_[_0x533c('0x2a')](_0x5cc8bc,'message')[_0x533c('0x14')](',\x20')));}var _0x301cba=_[_0x533c('0x24')](_0x10943d[_0x533c('0x43')],{'uniqueid':_0x37ea57[_0x533c('0x2b')]});if(_0x301cba&&_0x301cba[_0x533c('0x2c')]){return ami[_0x533c('0x1a')]({'action':_0x533c('0x44'),'channel':_0x301cba[_0x533c('0x2c')]})[_0x533c('0x1b')](function(_0x404a93){_0x534859({'code':0xc8,'message':[_0x37ea57[_0x533c('0x2b')],_0x404a93[_0x533c('0x1c')][_0x533c('0x2f')]()][_0x533c('0x14')]('\x20')});})[_0x533c('0x1d')](function(_0x445069){_0x123c8f(_0x25182f['error'](0x1f5,[_0x37ea57[_0x533c('0x2b')],_0x445069['message']['toLowerCase']()][_0x533c('0x14')]('\x20')));});}else{return _0x123c8f(_0x25182f[_0x533c('0x11')](0x1f5,_0x533c('0x36')));}});},'VoiceQueuesChannelRedirect':function(_0x3b8e0b){var _0x417158=this;return new Promise(function(_0x1eaf34,_0x2bfc60){if(ami['isConnected']()==![]){return _0x2bfc60(_0x417158[_0x533c('0x11')](0x1f4,[config[_0x533c('0x12')]['ip'],config['asterisk'][_0x533c('0x1e')],_0x533c('0x13')][_0x533c('0x14')]('\x20')));}var _0x3e3b25=schema(properties['voicequeuechannelredirect'])[_0x533c('0x29')](_0x3b8e0b);if(_0x3e3b25[_0x533c('0x23')]>0x0){return _0x2bfc60(_0x417158['error'](0x1f4,_[_0x533c('0x2a')](_0x3e3b25,_0x533c('0x1c'))['join'](',\x20')));}var _0x115c70=_[_0x533c('0x24')](_0x10943d['queueChannels'],{'uniqueid':_0x3b8e0b[_0x533c('0x2b')]});if(_0x115c70&&_0x115c70['channel']){return ami['Action']({'action':_0x533c('0x45'),'channel':_0x115c70[_0x533c('0x2c')],'exten':_0x3b8e0b[_0x533c('0x46')],'context':_0x3b8e0b[_0x533c('0x47')]||_0x115c70['context'],'priority':0x1})[_0x533c('0x1b')](function(_0x32fd4b){_0x1eaf34({'code':0xc8,'message':[_0x3b8e0b[_0x533c('0x2b')],_0x32fd4b[_0x533c('0x1c')][_0x533c('0x2f')]()]['join']('\x20')});})[_0x533c('0x1d')](function(_0x4d5ad1){_0x2bfc60(_0x417158[_0x533c('0x11')](0x1f5,[_0x3b8e0b['uniqueid'],_0x4d5ad1[_0x533c('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x2bfc60(_0x417158['error'](0x1f5,_0x533c('0x36')));}});},'Agents':function(_0x3f3981){return new Promise(function(_0x191a3b){var _0x52c812=_[_0x533c('0x48')](_0x10943d[_0x533c('0xd')]);if(_0x3f3981&&_0x3f3981['id']){var _0x3fbb08=_[_0x533c('0x24')](_0x52c812,function(_0x18bc43){return _0x18bc43['id']===_0x3f3981['id'];});_0x191a3b(_0x3fbb08);}else{_0x191a3b({'count':_0x52c812['length'],'rows':_0x52c812});}});},'Telephones':function(){return new Promise(function(_0x596cb0){var _0x42c389=_[_0x533c('0x48')](_0x10943d[_0x533c('0x49')]);_0x596cb0({'count':_0x42c389[_0x533c('0x23')],'rows':_0x42c389});});},'Trunks':function(){return new Promise(function(_0x2c3079){var _0x18a22f=_[_0x533c('0x48')](_0x10943d[_0x533c('0x4a')]);_0x2c3079({'count':_0x18a22f[_0x533c('0x23')],'rows':_0x18a22f});});},'OutboundChannels':function(){return new Promise(function(_0x4f0961){var _0x179985=_[_0x533c('0x48')](_0x10943d[_0x533c('0x4b')]);_0x4f0961({'count':_0x179985[_0x533c('0x23')],'rows':_0x179985});});},'Outbound':function(){return new Promise(function(_0x1ca217){_0x1ca217(_0x10943d[_0x533c('0x4c')]);});},'Campaigns':function(){return new Promise(function(_0x1b9816){var _0x49d765=_[_0x533c('0x48')](_0x10943d[_0x533c('0x4d')]);_0x1b9816({'count':_0x49d765[_0x533c('0x23')],'rows':_0x49d765});});},'VoiceQueuesPreview':function(_0x13ae15){var _0x2bf7d6=this;return new Promise(function(_0x452915,_0x61e62f){_0x364b16[_0x533c('0x4e')](_0x13ae15['id'])[_0x533c('0x1b')](function(_0x4b1b98){_0x452915({'code':0xc8,'message':_0x4b1b98[_0x533c('0x1c')]});})[_0x533c('0x1d')](function(_0x4a96da){_0x61e62f(_0x2bf7d6['error'](0x1f4,_0x4a96da[_0x533c('0x1c')]));});});},'EventManager':function(_0x5159af){var _0x1f3646=this;return new Promise(function(_0x307fe5,_0x159803){if(!_0x5159af[_0x533c('0x4f')]){return _0x159803(_0x1f3646[_0x533c('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x533c('0x50')](_0x533c('0x51')+_0x5159af[_0x533c('0x4f')],_0x5159af[_0x533c('0x1c')]);_0x307fe5({'code':0xc8,'message':_0x5159af});});},'FaxAccounts':function(){return new Promise(function(_0x3108c1){var _0x196d15=_[_0x533c('0x48')](_0x10943d[_0x533c('0x52')]);_0x3108c1({'count':_0x196d15[_0x533c('0x23')],'rows':_0x196d15});});},'SendFax':function(_0x104964){var _0x2771f=this;return new Promise(function(_0x4227d7,_0x1a5db5){_0x31d912[_0x533c('0x53')](_0x104964)[_0x533c('0x1b')](function(_0x36722d){_0x4227d7({'code':0xc8,'message':_0x36722d[_0x533c('0x1c')]});})[_0x533c('0x1d')](function(_0x4ce734){_0x1a5db5(_0x2771f[_0x533c('0x11')](0x1f4,_0x4ce734[_0x533c('0x1c')]));});});},'CheckAfterSend':function(_0x247915){var _0x14761a=this;return new Promise(function(_0x5860bb,_0x42f527){_0x31d912[_0x533c('0x54')](_0x247915)['then'](function(_0x411f86){_0x5860bb({'code':0xc8,'message':_0x411f86['message']});})[_0x533c('0x1d')](function(_0x4be94e){_0x42f527(_0x14761a[_0x533c('0x11')](0x1f4,_0x4be94e[_0x533c('0x1c')]));});});}};var _0x3909d2=jayson['server'](_0x1699d5)['http']();_0x3909d2['on']('error',function(_0x1088f9){return _0x34ca89(_0x1088f9);});_0x3909d2['listen'](0x232a,_0x533c('0x55'),function(){console[_0x533c('0x56')](_0x533c('0x57'),0x232a);return _0x151732(_0x533c('0x58')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index d6ab6d0..a54c4b1 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 _0x8e93=['data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','mobile','scheduledAt','updatedAt','union','resolve','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','routeId','calleridname','','Unknown','destcalleridname','then','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','trigger:%s','merge','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1'];(function(_0x28127a,_0x437784){var _0x36e6f8=function(_0x1b9f07){while(--_0x1b9f07){_0x28127a['push'](_0x28127a['shift']());}};_0x36e6f8(++_0x437784);}(_0x8e93,0xba));var _0x38e9=function(_0xb3701a,_0x4c26ac){_0xb3701a=_0xb3701a-0x0;var _0x3f2375=_0x8e93[_0xb3701a];return _0x3f2375;};'use strict';var _=require('lodash');var BPromise=require(_0x38e9('0x0'));var Redis=require(_0x38e9('0x1'));var util=require(_0x38e9('0x2'));var config=require(_0x38e9('0x3'));var logger=require('../../../../config/logger')(_0x38e9('0x4'));var cmContactRpc=require(_0x38e9('0x5'));config[_0x38e9('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x38e9('0x7'))(new Redis(config[_0x38e9('0x6')]));function emit(_0x107001,_0x4a2856,_0x3a3237,_0x4ee09,_0xbf3e86){logger[_0x38e9('0x8')](_0x38e9('0x9'),_0x107001,_0x4a2856['id'],_0x3a3237,_0x4ee09,JSON[_0x38e9('0xa')](_0xbf3e86));io['to'](_0x3a3237)[_0x38e9('0xb')](_0x4ee09,_0xbf3e86);}exports[_0x38e9('0xc')]=function(_0x328bb4,_0x4e18e4,_0x59c0c8,_0xebddf7){var _0x1719cc,_0x1a1a6b;var _0x3ffd40={};var _0x3fe313;var _0x511bc5=Number(_0x59c0c8[_0x38e9('0xd')]);var _0x8976ff=_0x59c0c8[_0x38e9('0xe')]?Boolean(Number(_0x59c0c8[_0x38e9('0xe')])):![];var _0xb3d1ed;var _0x1d721a=![];if(!_[_0x38e9('0xf')](_0x59c0c8[_0x38e9('0x10')])){if(_0x59c0c8[_0x38e9('0x10')]=='1')_0x1d721a=!![];}if(!_0x1d721a){if(_0xebddf7['xmd-contactid']){_0x3ffd40['id']=_0xebddf7[_0x38e9('0x11')];}}if(!_0x3ffd40['id']){_0x3ffd40[_0x38e9('0x12')]=_0x511bc5;_0xb3d1ed=_0x59c0c8[_0x38e9('0x13')]&&_0x59c0c8[_0x38e9('0x13')]!=='0'?_0x59c0c8[_0x38e9('0x13')]['split'](','):[_0x38e9('0x14')];_0x3ffd40[_0x38e9('0x15')]=_[_0x38e9('0x16')](_0xb3d1ed,function(_0x13ae8a){var _0x840302={};_0x840302[_0x13ae8a]=_0xebddf7['routeId']?_0xebddf7[_0x38e9('0x17')]:_0xebddf7[_0x38e9('0x18')];return _0x840302;});_0x3fe313=_0xebddf7['routeId']?_0xebddf7['destcalleridnum']:_0xebddf7[_0x38e9('0x18')];}var _0xfccd24=['id',_0x38e9('0x19'),'lastName',_0x38e9('0x14'),_0x38e9('0x1a'),'fax',_0x38e9('0x12'),'createdAt',_0x38e9('0x1b'),_0x38e9('0x1c')];var _0x1b0b1d=_[_0x38e9('0x1d')](_0xfccd24,_0xb3d1ed);BPromise[_0x38e9('0x1e')]()['then'](cmContactRpc['getContacts']({'attributes':_0x1b0b1d,'where':_0x3ffd40,'phone':_0x3fe313}))['then'](function(_0x4c929b){_0x1a1a6b=_0x4c929b;if(!_[_0x38e9('0x1f')](_0x1a1a6b)){if(_0x1a1a6b[_0x38e9('0x20')]===0x1){_0x1719cc=_0x1a1a6b[0x0];logger[_0x38e9('0x8')](_0x38e9('0x21'),_0xebddf7['uniqueid'],_0x4e18e4['id'],_0x1719cc['id']);}else{logger[_0x38e9('0x8')](_0x38e9('0x22'),_0xebddf7['uniqueid'],_0x4e18e4['id'],_[_0x38e9('0x16')](_0x1a1a6b,'id')['join'](','));}return;}else{logger[_0x38e9('0x8')](_0x38e9('0x23'),_0xebddf7[_0x38e9('0x24')],_0x4e18e4['id']);var _0x10ba5a={'ListId':_0x511bc5};var _0x29c469=_0x59c0c8['data4']&&_0x59c0c8[_0x38e9('0x25')]!=='0'?_0x59c0c8[_0x38e9('0x25')]:_0x38e9('0x14');if(_0x8976ff){logger[_0x38e9('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xebddf7[_0x38e9('0x24')],_0x4e18e4['id']);_0x10ba5a[_0x29c469]=_['isNil'](_0xebddf7[_0x38e9('0x26')])?_0xebddf7['calleridnum']:_0xebddf7[_0x38e9('0x17')];if(_[_0x38e9('0xf')](_0xebddf7['routeId'])){_0x10ba5a[_0x38e9('0x19')]=_0xebddf7['calleridname']&&_0xebddf7[_0x38e9('0x27')]!==_0x38e9('0x28')?_0xebddf7['calleridname']:_0x38e9('0x29');}else{_0x10ba5a[_0x38e9('0x19')]=_0xebddf7['destcalleridname']&&_0xebddf7[_0x38e9('0x2a')]!==_0x38e9('0x28')?_0xebddf7[_0x38e9('0x2a')]:'Unknown';}return BPromise[_0x38e9('0x1e')]()[_0x38e9('0x2b')](cmContactRpc['createContact'](_0x10ba5a))['then'](function(_0x18d5f4){_0x1719cc=_0x18d5f4;_0x1a1a6b[_0x38e9('0x2c')](_0x18d5f4);if(_0x1719cc){logger[_0x38e9('0x8')](_0x38e9('0x2d'),_0xebddf7[_0x38e9('0x24')],_0x4e18e4['id'],_0x1719cc['id']);}return;});}else{logger[_0x38e9('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xebddf7[_0x38e9('0x24')],_0x4e18e4['id']);_0x10ba5a[_0x29c469]=_[_0x38e9('0xf')](_0xebddf7['routeId'])?_0xebddf7[_0x38e9('0x18')]:_0xebddf7[_0x38e9('0x17')];if(_['isNil'](_0xebddf7[_0x38e9('0x26')])){_0x10ba5a[_0x38e9('0x19')]=_0xebddf7[_0x38e9('0x27')]&&_0xebddf7[_0x38e9('0x27')]!==_0x38e9('0x28')?_0xebddf7[_0x38e9('0x27')]:'Unknown';}else{_0x10ba5a['firstName']=_0xebddf7[_0x38e9('0x2a')]&&_0xebddf7[_0x38e9('0x2a')]!==''?_0xebddf7[_0x38e9('0x2a')]:'Unknown';}_0x1719cc=_0x10ba5a;_0x1a1a6b[_0x38e9('0x2c')](_0x10ba5a);return;}}})[_0x38e9('0x2b')](function(){if(_0x328bb4){emit(_0xebddf7[_0x38e9('0x24')],_0x4e18e4,util['format'](_0x38e9('0x2e'),_0x328bb4[_0x38e9('0x2f')]),util['format'](_0x38e9('0x30'),_0x59c0c8['action']['toLowerCase']()),{'evt':_[_0x38e9('0x31')](_0xebddf7,{'autoCreate':_0x8976ff}),'contact':_0x1719cc===undefined?{}:_0x1719cc,'contacts':_0x1a1a6b[_0x38e9('0x20')]===0x0?undefined:_0x1a1a6b});}});}; \ No newline at end of file +var _0xf97b=['data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','merge','length','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1'];(function(_0x3d1367,_0x3d3f67){var _0x8df120=function(_0x457abe){while(--_0x457abe){_0x3d1367['push'](_0x3d1367['shift']());}};_0x8df120(++_0x3d3f67);}(_0xf97b,0x15e));var _0xbf97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf97b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbf97('0x0'));var BPromise=require(_0xbf97('0x1'));var Redis=require('ioredis');var util=require(_0xbf97('0x2'));var config=require(_0xbf97('0x3'));var logger=require(_0xbf97('0x4'))('trigger');var cmContactRpc=require(_0xbf97('0x5'));config['redis']=_[_0xbf97('0x6')](config[_0xbf97('0x7')],{'host':_0xbf97('0x8'),'port':0x18eb});var io=require(_0xbf97('0x9'))(new Redis(config[_0xbf97('0x7')]));function emit(_0x2c8871,_0x14b3a6,_0x1b02ed,_0x4b10d6,_0x2b882e){logger[_0xbf97('0xa')](_0xbf97('0xb'),_0x2c8871,_0x14b3a6['id'],_0x1b02ed,_0x4b10d6,JSON[_0xbf97('0xc')](_0x2b882e));io['to'](_0x1b02ed)[_0xbf97('0xd')](_0x4b10d6,_0x2b882e);}exports[_0xbf97('0xe')]=function(_0x4ab3cd,_0x3c4eba,_0x5c4a65,_0x31653f){var _0x41798e,_0xf0f580;var _0x37d7e5={};var _0x1ba9c6;var _0x13a7e1=Number(_0x5c4a65[_0xbf97('0xf')]);var _0x40e13d=_0x5c4a65[_0xbf97('0x10')]?Boolean(Number(_0x5c4a65['data2'])):![];var _0x53ae01;var _0x4482ac=![];if(!_['isNil'](_0x5c4a65['data5'])){if(_0x5c4a65[_0xbf97('0x11')]=='1')_0x4482ac=!![];}if(!_0x4482ac){if(_0x31653f[_0xbf97('0x12')]){_0x37d7e5['id']=_0x31653f[_0xbf97('0x12')];}}if(!_0x37d7e5['id']){_0x37d7e5[_0xbf97('0x13')]=_0x13a7e1;_0x53ae01=_0x5c4a65['data3']&&_0x5c4a65[_0xbf97('0x14')]!=='0'?_0x5c4a65[_0xbf97('0x14')][_0xbf97('0x15')](','):[_0xbf97('0x16')];_0x37d7e5[_0xbf97('0x17')]=_[_0xbf97('0x18')](_0x53ae01,function(_0x14215a){var _0x533b56={};_0x533b56[_0x14215a]=_0x31653f[_0xbf97('0x19')]?_0x31653f[_0xbf97('0x1a')]:_0x31653f['calleridnum'];return _0x533b56;});_0x1ba9c6=_0x31653f[_0xbf97('0x19')]?_0x31653f['destcalleridnum']:_0x31653f[_0xbf97('0x1b')];}var _0x1fae7b=['id','firstName',_0xbf97('0x1c'),_0xbf97('0x16'),_0xbf97('0x1d'),_0xbf97('0x1e'),_0xbf97('0x13'),'createdAt',_0xbf97('0x1f'),_0xbf97('0x20')];var _0x4f80e0=_[_0xbf97('0x21')](_0x1fae7b,_0x53ae01);BPromise[_0xbf97('0x22')]()[_0xbf97('0x23')](cmContactRpc[_0xbf97('0x24')]({'attributes':_0x4f80e0,'where':_0x37d7e5,'phone':_0x1ba9c6}))[_0xbf97('0x23')](function(_0x249f81){_0xf0f580=_0x249f81;if(!_['isEmpty'](_0xf0f580)){if(_0xf0f580['length']===0x1){_0x41798e=_0xf0f580[0x0];logger[_0xbf97('0xa')](_0xbf97('0x25'),_0x31653f['uniqueid'],_0x3c4eba['id'],_0x41798e['id']);}else{logger[_0xbf97('0xa')](_0xbf97('0x26'),_0x31653f[_0xbf97('0x27')],_0x3c4eba['id'],_[_0xbf97('0x18')](_0xf0f580,'id')[_0xbf97('0x28')](','));}return;}else{logger[_0xbf97('0xa')](_0xbf97('0x29'),_0x31653f[_0xbf97('0x27')],_0x3c4eba['id']);var _0x225642={'ListId':_0x13a7e1};var _0x2b191f=_0x5c4a65[_0xbf97('0x2a')]&&_0x5c4a65[_0xbf97('0x2a')]!=='0'?_0x5c4a65['data4']:_0xbf97('0x16');if(_0x40e13d){logger[_0xbf97('0xa')](_0xbf97('0x2b'),_0x31653f[_0xbf97('0x27')],_0x3c4eba['id']);_0x225642[_0x2b191f]=_[_0xbf97('0x2c')](_0x31653f[_0xbf97('0x19')])?_0x31653f[_0xbf97('0x1b')]:_0x31653f['destcalleridnum'];if(_['isNil'](_0x31653f[_0xbf97('0x19')])){_0x225642[_0xbf97('0x2d')]=_0x31653f[_0xbf97('0x2e')]&&_0x31653f[_0xbf97('0x2e')]!==_0xbf97('0x2f')?_0x31653f[_0xbf97('0x2e')]:_0xbf97('0x30');}else{_0x225642[_0xbf97('0x2d')]=_0x31653f['destcalleridname']&&_0x31653f['destcalleridname']!==_0xbf97('0x2f')?_0x31653f[_0xbf97('0x31')]:_0xbf97('0x30');}return BPromise[_0xbf97('0x22')]()[_0xbf97('0x23')](cmContactRpc[_0xbf97('0x32')](_0x225642))[_0xbf97('0x23')](function(_0x214395){_0x41798e=_0x214395;_0xf0f580[_0xbf97('0x33')](_0x214395);if(_0x41798e){logger['info'](_0xbf97('0x34'),_0x31653f[_0xbf97('0x27')],_0x3c4eba['id'],_0x41798e['id']);}return;});}else{logger['info'](_0xbf97('0x35'),_0x31653f[_0xbf97('0x27')],_0x3c4eba['id']);_0x225642[_0x2b191f]=_[_0xbf97('0x2c')](_0x31653f[_0xbf97('0x19')])?_0x31653f['calleridnum']:_0x31653f[_0xbf97('0x1a')];if(_['isNil'](_0x31653f[_0xbf97('0x19')])){_0x225642[_0xbf97('0x2d')]=_0x31653f['calleridname']&&_0x31653f[_0xbf97('0x2e')]!==_0xbf97('0x2f')?_0x31653f[_0xbf97('0x2e')]:'Unknown';}else{_0x225642[_0xbf97('0x2d')]=_0x31653f['destcalleridname']&&_0x31653f[_0xbf97('0x31')]!==''?_0x31653f['destcalleridname']:_0xbf97('0x30');}_0x41798e=_0x225642;_0xf0f580[_0xbf97('0x33')](_0x225642);return;}}})[_0xbf97('0x23')](function(){if(_0x4ab3cd){emit(_0x31653f[_0xbf97('0x27')],_0x3c4eba,util[_0xbf97('0x36')](_0xbf97('0x37'),_0x4ab3cd[_0xbf97('0x38')]),util[_0xbf97('0x36')]('trigger:%s',_0x5c4a65[_0xbf97('0x39')][_0xbf97('0x3a')]()),{'evt':_[_0xbf97('0x3b')](_0x31653f,{'autoCreate':_0x40e13d}),'contact':_0x41798e===undefined?{}:_0x41798e,'contacts':_0xf0f580[_0xbf97('0x3c')]===0x0?undefined:_0xf0f580});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0547047..e269471 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 _0xc1c5=['redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','length','Actions','action','toLowerCase','popup','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','windowWidth','data5','800','windowHeight','data6','600','winApplication','render','winArguments','name','format','data1','trigger:%s','user:%s','exec','integration','queue','routeId','urlforward','script','parse','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','some','debug','checkTrigger:\x20trigger','field','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','undefined','offlineMessage','equals','exports','util','lodash','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc1c5,0x75));var _0x5c1c=function(_0x5a819f,_0x555175){_0x5a819f=_0x5a819f-0x0;var _0x16701a=_0xc1c5[_0x5a819f];return _0x16701a;};'use strict';var util=require(_0x5c1c('0x0'));var _=require(_0x5c1c('0x1'));var url=require(_0x5c1c('0x2'));var Mustache=require('mustache');var Redis=require(_0x5c1c('0x3'));var urlforward=require(_0x5c1c('0x4'));var integration=require(_0x5c1c('0x5'));var cmContact=require(_0x5c1c('0x6'));var script=require(_0x5c1c('0x7'));var config=require(_0x5c1c('0x8'));var logger=require(_0x5c1c('0x9'))(_0x5c1c('0xa'));var ami=require(_0x5c1c('0xb'));config[_0x5c1c('0xc')]=_[_0x5c1c('0xd')](config[_0x5c1c('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x5c1c('0xe'))(new Redis(config['redis']));var operators={'equals':function(_0x2f9047,_0x452004){return _0x2f9047==_0x452004;},'not_equals':function(_0x34730e,_0x5623a0){return _0x34730e!=_0x5623a0;}};var barAndWebActions=['popup',_0x5c1c('0x2'),_0x5c1c('0xf')];function Trigger(_0x59d087){this[_0x5c1c('0x10')]=_0x59d087[_0x5c1c('0x10')];this['agents']=_0x59d087[_0x5c1c('0x11')];this[_0x5c1c('0x12')]=_0x59d087[_0x5c1c('0x12')];this['templates']=_0x59d087[_0x5c1c('0x13')];this[_0x5c1c('0x14')]=_0x59d087['voiceExtensions'];this[_0x5c1c('0x15')]=_0x59d087[_0x5c1c('0x15')];this[_0x5c1c('0x16')]=_0x59d087['freshdeskAccounts'];this[_0x5c1c('0x17')]=_0x59d087[_0x5c1c('0x17')];this['sugarcrmAccounts']=_0x59d087[_0x5c1c('0x18')];this[_0x5c1c('0x19')]=_0x59d087[_0x5c1c('0x19')];this[_0x5c1c('0x1a')]=_0x59d087[_0x5c1c('0x1a')];this['vtigerAccounts']=_0x59d087[_0x5c1c('0x1b')];this[_0x5c1c('0x1c')]=_0x59d087['servicenowAccounts'];this[_0x5c1c('0x1d')]=_0x59d087[_0x5c1c('0x1d')];this[_0x5c1c('0x1e')]=_0x59d087['freshsalesAccounts'];this[_0x5c1c('0x1f')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x5c1c('0x17')],'freshdesk':this[_0x5c1c('0x16')],'sugarcrm':this[_0x5c1c('0x18')],'zoho':this['zohoAccounts'],'desk':this[_0x5c1c('0x1a')],'vtiger':this[_0x5c1c('0x1b')],'dynamics365':this[_0x5c1c('0x1d')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0x5c1c('0x20'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x23'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on']('custom:agentringnoanswer',this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x24'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x25'),this[_0x5c1c('0x21')]['bind'](this));ami['on'](_0x5c1c('0x26'),this[_0x5c1c('0x21')]['bind'](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x27'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x28'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x29'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5c1c('0x2a'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x2b'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x2c'),this[_0x5c1c('0x2d')][_0x5c1c('0x22')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x2e'),this['syncAgentDial']['bind'](this));ami['on']('custom:newinteraction',this[_0x5c1c('0x21')]['bind'](this));ami['on']('custom:closedinteraction',this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x2f'),this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x30'),this['syncCustomEvent'][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x31'),this[_0x5c1c('0x21')]['bind'](this));ami['on']('custom:acceptmessage',this[_0x5c1c('0x21')][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x32'),this['syncCustomEvent'][_0x5c1c('0x22')](this));ami['on'](_0x5c1c('0x33'),this[_0x5c1c('0x21')]['bind'](this));}Trigger[_0x5c1c('0x34')][_0x5c1c('0x35')]=function(_0x502236,_0xc3ea83,_0x5b2824){logger[_0x5c1c('0x36')](_0x502236,_0xc3ea83,JSON['stringify'](_0x5b2824));io['to'](_0x502236)[_0x5c1c('0x35')](_0xc3ea83,_0x5b2824);};Trigger[_0x5c1c('0x34')][_0x5c1c('0x21')]=function(_0x5979f4){var _0x54d2fc=_[_0x5c1c('0x37')](_0x5979f4);if(typeof _0x54d2fc[_0x5c1c('0x38')]==='undefined'){_0x54d2fc[_0x5c1c('0x38')]='voice';}logger['debug']('syncCustomEvent',util[_0x5c1c('0x39')](_0x54d2fc,{'showHidden':!![],'depth':null}));this[_0x5c1c('0x3a')](_0x54d2fc);};Trigger[_0x5c1c('0x34')][_0x5c1c('0x2d')]=function(_0x1cdb1e){if(this['agents'][_0x1cdb1e[_0x5c1c('0x3b')]]){this[_0x5c1c('0x21')](_0x1cdb1e);}};Trigger['prototype'][_0x5c1c('0x3a')]=function(_0x3fe9f8){var _0x3b74c3;for(var _0x5ed787 in this[_0x5c1c('0x10')]){if(this['triggers'][_0x5c1c('0x3c')](_0x5ed787)){if(this[_0x5c1c('0x10')][_0x5ed787][_0x5c1c('0x3d')]){_0x3b74c3=this[_0x5c1c('0x3e')](this[_0x5c1c('0x10')][_0x5ed787],_0x3fe9f8);if(_0x3b74c3){_[_0x5c1c('0x3f')](_0x3fe9f8,_0x3fe9f8[_0x5c1c('0x40')]);for(var _0x4e3f21=0x0,_0x5d916c,_0x305b11,_0x50f24b;_0x4e3f210x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','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','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x56d76d,_0x16407d){var _0x16bbe7=function(_0x216f53){while(--_0x216f53){_0x56d76d['push'](_0x56d76d['shift']());}};_0x16bbe7(++_0x16407d);}(_0x814b,0x1a2));var _0xb814=function(_0x554047,_0x46ec41){_0x554047=_0x554047-0x0;var _0x5d11e4=_0x814b[_0x554047];return _0x5d11e4;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f14f74f..5493218 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 _0xbf2e=['&$filter=','%2b','value','contactid','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','picklist','nameField','customField','idField','indexOf','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','/systemusers(','callDirection','queue','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','trigger:browser:url','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','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','body','headers','odata-entityid','substring','lastIndexOf','enduserId','message','calleridnum','telephone1','GET','contacts?$select='];(function(_0x4a53e2,_0x13321e){var _0x3f2d76=function(_0x50c5cf){while(--_0x50c5cf){_0x4a53e2['push'](_0x4a53e2['shift']());}};_0x3f2d76(++_0x13321e);}(_0xbf2e,0x1e6));var _0xebf2=function(_0xe3551e,_0x395ed4){_0xe3551e=_0xe3551e-0x0;var _0xaa327c=_0xbf2e[_0xe3551e];return _0xaa327c;};'use strict';var _=require(_0xebf2('0x0'));var rp=require(_0xebf2('0x1'));var util=require(_0xebf2('0x2'));var intUtil=require('./util');var md5=require(_0xebf2('0x3'));var Redis=require(_0xebf2('0x4'));var logger=require(_0xebf2('0x5'))(_0xebf2('0x6'));var config=require('../../../../config/environment');config[_0xebf2('0x7')]=_[_0xebf2('0x8')](config[_0xebf2('0x7')],{'host':_0xebf2('0x9'),'port':0x18eb});var io=require(_0xebf2('0xa'))(new Redis(config['redis']));function getAuthToken(_0x3854d6,_0x386e9e,_0x5992a9){if(_0x3854d6[_0xebf2('0xb')]){_0x3854d6[_0xebf2('0xc')]=_0x3854d6[_0xebf2('0xd')][_0xebf2('0xe')];_0x3854d6[_0xebf2('0xf')]=_0x3854d6[_0xebf2('0xd')][_0xebf2('0x10')];return Promise[_0xebf2('0x11')](_0x3854d6[_0xebf2('0xd')][_0xebf2('0x12')]);}var _0x4b8e11={'method':_0xebf2('0x13'),'uri':_0x386e9e,'form':{'client_id':_0x3854d6['clientId'],'resource':_0x3854d6[_0xebf2('0xc')],'username':_0x3854d6[_0xebf2('0x14')],'password':_0x3854d6['password'],'grant_type':_0xebf2('0x15'),'client_secret':_0x3854d6[_0xebf2('0x16')]},'json':!![]};return rp(_0x4b8e11)[_0xebf2('0x17')](function(_0x26ba9f){return _0x26ba9f[_0xebf2('0x18')];})[_0xebf2('0x19')](function(_0x2edfa6){logger['error']('['+[_0x5992a9[_0xebf2('0x1a')]()]+_0xebf2('0x1b'));return _0x2edfa6['message'];});}function getUser(_0x57a53c,_0x12e2cf,_0x5de17b,_0x1a447c,_0x4aac18,_0x4449fa){return new Promise(function(_0x29f634,_0x37b9f9){return getAuthToken(_0x12e2cf,_0x1a447c,_0x4449fa)[_0xebf2('0x17')](function(_0x2a7e3b){var _0x2ac778={'method':'GET','uri':_0x4aac18+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xebf2('0x1c')+_0x2a7e3b,'OData-Version':_0xebf2('0x1d')},'json':!![]};return rp(_0x2ac778);})[_0xebf2('0x17')](function(_0x4276a5){var _0x12d808=_0x4276a5['value'];var _0x5591fa=![];var _0x241b95=null;if(!_[_0xebf2('0x1e')](_0x5de17b)){if(intUtil[_0xebf2('0x1f')](_0x5de17b[_0xebf2('0x20')])){_0x57a53c[_0xebf2('0x21')]=_0x5de17b[_0xebf2('0x20')];for(_0x241b95=0x0;_0x241b95<_0x12d808[_0xebf2('0x22')];_0x241b95++){if(_0x12d808[_0x241b95][_0xebf2('0x23')]===_0x5de17b['email']&&!_0x12d808[_0x241b95][_0xebf2('0x24')]){_0x5591fa=!![];logger['info']('['+[_0x4449fa[_0xebf2('0x1a')]()]+']\x20Agent\x20found\x20'+_0x12d808[_0x241b95][_0xebf2('0x25')]+'!');_0x57a53c[_0xebf2('0x26')]=_0x12d808[_0x241b95][_0xebf2('0x25')];}}}}if(!_0x5591fa){logger['info']('['+[_0x4449fa[_0xebf2('0x1a')]()]+_0xebf2('0x27'));_0x57a53c[_0xebf2('0x21')]=_0x12e2cf[_0xebf2('0x14')];for(_0x241b95=0x0;_0x241b95<_0x12d808[_0xebf2('0x22')];_0x241b95++){if(_0x12d808[_0x241b95][_0xebf2('0x23')]===_0x12e2cf['username']){_0x57a53c[_0xebf2('0x26')]=_0x12d808[_0x241b95][_0xebf2('0x25')];}}}_0x29f634(_0x57a53c);})['catch'](function(_0x5c78b9){_0x37b9f9(_0x5c78b9['message']);});});}function createEndUser(_0x8c876e,_0x115dac,_0x253396,_0x5f489b,_0x487b98,_0x1a243e,_0x3cb7f0){return new Promise(function(_0x365daf,_0x2b563e){return getAuthToken(_0x115dac,_0x253396,_0x1a243e)[_0xebf2('0x17')](function(_0xe1b60e){var _0xc5d517=_0x1a243e[_0xebf2('0x28')]()===_0xebf2('0x29')?_0x487b98[_0xebf2('0x2a')]:_0x487b98['calleridnum'];var _0x4dc9eb={'method':_0xebf2('0x13'),'uri':_0x5f489b+'contacts','body':{'fullname':_0xc5d517,'firstname':_0xc5d517,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x8c876e['userId']+')'},'headers':{'Authorization':_0xebf2('0x1c')+_0xe1b60e,'OData-Version':_0xebf2('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x4dc9eb[_0xebf2('0x2b')][_0x3cb7f0]=_0xc5d517;return rp(_0x4dc9eb);})[_0xebf2('0x17')](function(_0x3e7920){var _0x5afae4=_0x3e7920[_0xebf2('0x2c')][_0xebf2('0x2d')];var _0x3099ee=_0x5afae4[_0xebf2('0x2e')](_0x5afae4[_0xebf2('0x2f')]('(')+0x1,_0x5afae4['lastIndexOf'](')'));_0x8c876e[_0xebf2('0x30')]=_0x3099ee;_0x365daf(_0x8c876e);})['catch'](function(_0x5e110e){_0x2b563e(_0x5e110e[_0xebf2('0x31')]);});});}function getEndUser(_0x42179a,_0x3b1ded,_0x329749,_0x118a49,_0x2c3a09,_0x5d75ae,_0x960576,_0x38d504){var _0x3c3764=_0x5d75ae[_0xebf2('0x28')]()==='outbound'?_0x2c3a09['destcalleridnum']:_0x2c3a09[_0xebf2('0x32')];return getAuthToken(_0x3b1ded,_0x329749,_0x5d75ae)[_0xebf2('0x17')](function(_0x40925d){_0x38d504=_0x38d504?_0x38d504:_0xebf2('0x33');var _0x495460={'method':_0xebf2('0x34'),'uri':_0x118a49+_0xebf2('0x35')+_0x38d504+_0xebf2('0x36')+_0x38d504+'\x20eq\x20\x27'+_0x3c3764['replace']('+',_0xebf2('0x37'))+'\x27','headers':{'Authorization':_0xebf2('0x1c')+_0x40925d,'If-None-Match':null,'OData-Version':_0xebf2('0x1d')},'json':!![]};return rp(_0x495460);})[_0xebf2('0x17')](function(_0x1e30df){var _0x213ddd=![];if(!_0x1e30df)return _0x213ddd;var _0x1bcec8=_0x1e30df[_0xebf2('0x38')];for(var _0xbcb62b=0x0;_0xbcb62b<_0x1bcec8[_0xebf2('0x22')];_0xbcb62b++){if(_0x1bcec8[_0xbcb62b][_0x38d504]===_0x3c3764){_0x213ddd=!![];_0x42179a['enduserId']=_0x1bcec8[_0xbcb62b][_0xebf2('0x39')];}}return _0x213ddd;})[_0xebf2('0x17')](function(_0x29d3c){if(_0x29d3c)return _0x42179a;if(_0x960576===_0xebf2('0x3a')){logger[_0xebf2('0x3b')]('['+[_0x5d75ae[_0xebf2('0x1a')]()]+_0xebf2('0x3c'));return _0x42179a;}return createEndUser(_0x42179a,_0x3b1ded,_0x329749,_0x118a49,_0x2c3a09,_0x5d75ae,_0x38d504)[_0xebf2('0x17')](function(_0x54da13){logger[_0xebf2('0x3b')]('['+[_0x5d75ae[_0xebf2('0x1a')]()]+_0xebf2('0x3d'),_0x54da13[_0xebf2('0x30')]);return _0x54da13;});});}function getCustomFields(_0x39ff21,_0x190f8d,_0x5142ff){var _0x3c22bd={};if(_0x39ff21[_0xebf2('0x22')]>0x0){_['forEach'](_0x39ff21,function(_0x5a9fab){if(_[_0xebf2('0x3e')](['string',_0xebf2('0x3f')],_0x5a9fab['type'])&&_0x5a9fab[_0xebf2('0x40')]&&!_0x5a9fab[_0xebf2('0x41')]){var _0xaf96e2=_0x5a9fab[_0xebf2('0x42')][_0xebf2('0x28')]();var _0x1f4f0a=_0xaf96e2[_0xebf2('0x2e')](0x0,_0xaf96e2[_0xebf2('0x43')]('_'));var _0x4b5587=_0xaf96e2[_0xebf2('0x2e')](_0xaf96e2[_0xebf2('0x43')]('_')+0x1);if(_0x1f4f0a===_0x5142ff){_0x3c22bd[_0x4b5587]=_0x5a9fab['content'];}}});}return _0x3c22bd;}function getTicket(_0x7e4ea6,_0x25a311,_0x350fdb,_0x537574,_0x16c8d6,_0x5c03dc,_0x30a328){return new Promise(function(_0x15a9ad,_0x115d06){var _0x3650cb;return getAuthToken(_0x25a311,_0x350fdb,_0x30a328)[_0xebf2('0x17')](function(_0x4971bf){if(_0x5c03dc[_0xebf2('0x44')]===_0xebf2('0x45')){_0x3650cb={'method':_0xebf2('0x13'),'uri':_0x537574+'incidents','body':Object[_0xebf2('0x46')]({},{'title':intUtil[_0xebf2('0x47')](_0x5c03dc[_0xebf2('0x48')],_0x16c8d6,'\x20'),'description':intUtil[_0xebf2('0x47')](_0x5c03dc[_0xebf2('0x49')],_0x16c8d6,'\x0a'),'customerid_contact@odata.bind':_0x7e4ea6['enduserId']?_0xebf2('0x4a')+_0x7e4ea6['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x7e4ea6['userId']+')','caseorigincode':'1'},getCustomFields(_0x5c03dc[_0xebf2('0x4b')],_0x16c8d6,_0x5c03dc[_0xebf2('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x4971bf,'OData-Version':_0xebf2('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c03dc[_0xebf2('0x44')]===_0xebf2('0x4c')){var _0x5d21ee=_0x7e4ea6[_0xebf2('0x30')]?[{'partyid_systemuser@odata.bind':_0xebf2('0x4d')+_0x7e4ea6[_0xebf2('0x26')]+')','participationtypemask':_0x7e4ea6[_0xebf2('0x4e')]===_0xebf2('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x7e4ea6[_0xebf2('0x30')]+')','participationtypemask':_0x7e4ea6['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xebf2('0x4d')+_0x7e4ea6[_0xebf2('0x26')]+')','participationtypemask':_0x7e4ea6[_0xebf2('0x4e')]==='queue'?0x2:0x1}];_0x3650cb={'method':_0xebf2('0x13'),'uri':_0x537574+'phonecalls','body':Object[_0xebf2('0x46')]({},{'subject':intUtil[_0xebf2('0x47')](_0x5c03dc[_0xebf2('0x48')],_0x16c8d6,'\x20'),'phonenumber':String(_0x16c8d6[_0xebf2('0x32')]),'description':intUtil['getString'](_0x5c03dc['Descriptions'],_0x16c8d6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7e4ea6[_0xebf2('0x30')]?'/contacts('+_0x7e4ea6[_0xebf2('0x30')]+')':undefined,'ownerid@odata.bind':_0xebf2('0x4d')+_0x7e4ea6[_0xebf2('0x26')]+')','directioncode':_0x7e4ea6['callDirection']===_0xebf2('0x4f')?![]:!![],'phonecall_activity_parties':_0x5d21ee},getCustomFields(_0x5c03dc['Fields'],_0x16c8d6,_0x5c03dc[_0xebf2('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x4971bf,'OData-Version':_0xebf2('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3650cb);})['then'](function(_0x2514a2){var _0x1cafb1=_0x2514a2[_0xebf2('0x2c')]['odata-entityid'];var _0x267994=_0x1cafb1['substring'](_0x1cafb1['lastIndexOf']('(')+0x1,_0x1cafb1[_0xebf2('0x2f')](')'));_0x7e4ea6['ticketId']=_0x267994;_0x15a9ad(_0x7e4ea6);})[_0xebf2('0x19')](function(_0x2167aa){_0x115d06(_0x2167aa[_0xebf2('0x31')]);});});}function emit(_0x387801,_0x5ec9da,_0x5c5283,_0x31b9f4){var _0x1fc2ae={'uri':util['format'](_0xebf2('0x50'),_0x387801,_0x5c5283,_0x31b9f4)};io['to'](util[_0xebf2('0x51')]('user:%s',_0x5ec9da))['emit'](_0xebf2('0x52'),_0x1fc2ae);}exports['cs']=function(_0x2d7f94,_0x3e02cd,_0xe94686,_0x3d7786,_0x163130,_0x5c76e7,_0x27eeb2,_0x16e57a){var _0x1df9b3={};_0x5c76e7[_0xebf2('0xc')]=_0x5c76e7[_0xebf2('0xb')]?intUtil['stripTrailingSlash'](_0x5c76e7['CloudProvider'][_0xebf2('0xe')]):intUtil[_0xebf2('0x53')](_0x5c76e7[_0xebf2('0xc')]);_0x5c76e7[_0xebf2('0x54')]=intUtil[_0xebf2('0x53')](_0x5c76e7[_0xebf2('0x54')]);_0x1df9b3['callDirection']=_0x16e57a===_0xebf2('0x4f')||_0x16e57a===_0xebf2('0x55')?'queue':'outbound';var _0x2cc46a=_0x5c76e7[_0xebf2('0xb')]?util['format'](_0xebf2('0x56'),_0x5c76e7['CloudProvider'][_0xebf2('0xe')]):util[_0xebf2('0x51')](_0xebf2('0x56'),_0x5c76e7[_0xebf2('0xc')]);var _0x22345b=util[_0xebf2('0x51')](_0xebf2('0x57'),_0x5c76e7[_0xebf2('0xf')]);var _0x336186=util[_0xebf2('0x51')](_0xebf2('0x58'),_0x5c76e7['serverUrl'],_0x3e02cd[_0xebf2('0x59')],md5(_0x3e02cd[_0xebf2('0x59')]));if(_0x163130&&_0x163130['monitor_format']){logger['info'](_0xebf2('0x5a'),_0xebf2('0x5b'));_0x3e02cd['recordingURL']=_0x336186;}else if(_0x27eeb2&&_0x27eeb2[_0xebf2('0x5c')]&&_0x27eeb2[_0xebf2('0x5c')]!==_0xebf2('0x5d')){logger[_0xebf2('0x3b')](_0xebf2('0x5e'),_0xebf2('0x5b'));_0x3e02cd[_0xebf2('0x5f')]=_0x336186;}else{_0x3e02cd['recordingURL']='';}return getUser(_0x1df9b3,_0x5c76e7,_0x3d7786,_0x22345b,_0x2cc46a,_0x16e57a)[_0xebf2('0x17')](function(_0x398bc3){logger[_0xebf2('0x3b')]('['+_0x16e57a[_0xebf2('0x1a')]()+_0xebf2('0x60'),_0x398bc3['userId']);logger[_0xebf2('0x3b')]('['+_0x16e57a[_0xebf2('0x1a')]()+']\x20The\x20User\x20email\x20is:',_0x398bc3[_0xebf2('0x21')]);return getEndUser(_0x398bc3,_0x5c76e7,_0x22345b,_0x2cc46a,_0x3e02cd,_0x16e57a,_0xe94686['moduleCreate'],_0xe94686[_0xebf2('0x61')]);})[_0xebf2('0x17')](function(_0x4ab3b0){logger[_0xebf2('0x3b')]('['+_0x16e57a['toUpperCase']()+_0xebf2('0x62'),_0x4ab3b0[_0xebf2('0x30')]);logger[_0xebf2('0x3b')]('['+_0x16e57a[_0xebf2('0x1a')]()+_0xebf2('0x63'),_0x3e02cd[_0xebf2('0x32')]);return getTicket(_0x4ab3b0,_0x5c76e7,_0x22345b,_0x2cc46a,_0x3e02cd,_0xe94686,_0x16e57a);})[_0xebf2('0x17')](function(_0x1ddfb5){logger[_0xebf2('0x3b')](util[_0xebf2('0x51')]('['+_0x16e57a['toUpperCase']()+_0xebf2('0x64'),_0xe94686[_0xebf2('0x44')],_0x1ddfb5[_0xebf2('0x65')]));logger['info'](util['format']('['+_0x16e57a[_0xebf2('0x1a')]()+_0xebf2('0x66'),_0x16e57a));if(_0x16e57a!==_0xebf2('0x55')&&_0xe94686[_0xebf2('0x67')]){logger[_0xebf2('0x3b')]('['+_0x16e57a[_0xebf2('0x1a')]()+']',_0xebf2('0x68'));emit(_0x5c76e7[_0xebf2('0xc')],_0x3d7786['name'],_0xe94686[_0xebf2('0x44')],_0x1ddfb5[_0xebf2('0x65')]);}})['catch'](function(_0x591df6){logger[_0xebf2('0x69')]('['+_0x16e57a[_0xebf2('0x1a')]()+_0xebf2('0x6a'),_0x591df6[_0xebf2('0x31')]);console[_0xebf2('0x69')](_0xebf2('0x6b'),_0x591df6);});}; \ No newline at end of file +var _0x3cb6=['[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','clientSecret','catch',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','toLowerCase','outbound','destcalleridnum','calleridnum','userId','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','idField','content','ticketType','incident','incidents','assign','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','getString','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','[QUEUE]','recordingURL','recordingFormat'];(function(_0x218c0c,_0x2b21e3){var _0xf0347d=function(_0xb3b51c){while(--_0xb3b51c){_0x218c0c['push'](_0x218c0c['shift']());}};_0xf0347d(++_0x2b21e3);}(_0x3cb6,0x7a));var _0x63cb=function(_0x68586a,_0x2fb310){_0x68586a=_0x68586a-0x0;var _0x4dc979=_0x3cb6[_0x68586a];return _0x4dc979;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x63cb('0x0'));var md5=require(_0x63cb('0x1'));var Redis=require(_0x63cb('0x2'));var logger=require(_0x63cb('0x3'))(_0x63cb('0x4'));var config=require(_0x63cb('0x5'));config[_0x63cb('0x6')]=_[_0x63cb('0x7')](config[_0x63cb('0x6')],{'host':_0x63cb('0x8'),'port':0x18eb});var io=require(_0x63cb('0x9'))(new Redis(config['redis']));function getAuthToken(_0x47df7c,_0x27a0b0,_0x1714b6){if(_0x47df7c[_0x63cb('0xa')]){_0x47df7c[_0x63cb('0xb')]=_0x47df7c[_0x63cb('0xc')][_0x63cb('0xd')];_0x47df7c[_0x63cb('0xe')]=_0x47df7c[_0x63cb('0xc')][_0x63cb('0xf')];return Promise[_0x63cb('0x10')](_0x47df7c[_0x63cb('0xc')][_0x63cb('0x11')]);}var _0x157789={'method':_0x63cb('0x12'),'uri':_0x27a0b0,'form':{'client_id':_0x47df7c['clientId'],'resource':_0x47df7c[_0x63cb('0xb')],'username':_0x47df7c[_0x63cb('0x13')],'password':_0x47df7c[_0x63cb('0x14')],'grant_type':_0x63cb('0x14'),'client_secret':_0x47df7c[_0x63cb('0x15')]},'json':!![]};return rp(_0x157789)['then'](function(_0x42e418){return _0x42e418['access_token'];})[_0x63cb('0x16')](function(_0x134345){logger['error']('['+[_0x1714b6['toUpperCase']()]+_0x63cb('0x17'));return _0x134345[_0x63cb('0x18')];});}function getUser(_0x175a48,_0x437df5,_0x506fda,_0x376ded,_0x22cda7,_0x4e0906){return new Promise(function(_0x35b081,_0x5d1281){return getAuthToken(_0x437df5,_0x376ded,_0x4e0906)[_0x63cb('0x19')](function(_0x68d026){var _0x2997a2={'method':_0x63cb('0x1a'),'uri':_0x22cda7+_0x63cb('0x1b'),'headers':{'Authorization':_0x63cb('0x1c')+_0x68d026,'OData-Version':_0x63cb('0x1d')},'json':!![]};return rp(_0x2997a2);})['then'](function(_0x158ca3){var _0x36e5ce=_0x158ca3[_0x63cb('0x1e')];var _0x490c34=![];var _0x1ee5a7=null;if(!_[_0x63cb('0x1f')](_0x506fda)){if(intUtil[_0x63cb('0x20')](_0x506fda[_0x63cb('0x21')])){_0x175a48['userEmail']=_0x506fda[_0x63cb('0x21')];for(_0x1ee5a7=0x0;_0x1ee5a7<_0x36e5ce['length'];_0x1ee5a7++){if(_0x36e5ce[_0x1ee5a7][_0x63cb('0x22')]===_0x506fda['email']&&!_0x36e5ce[_0x1ee5a7][_0x63cb('0x23')]){_0x490c34=!![];logger[_0x63cb('0x24')]('['+[_0x4e0906[_0x63cb('0x25')]()]+_0x63cb('0x26')+_0x36e5ce[_0x1ee5a7][_0x63cb('0x27')]+'!');_0x175a48['userId']=_0x36e5ce[_0x1ee5a7][_0x63cb('0x27')];}}}}if(!_0x490c34){logger[_0x63cb('0x24')]('['+[_0x4e0906[_0x63cb('0x25')]()]+_0x63cb('0x28'));_0x175a48[_0x63cb('0x29')]=_0x437df5['username'];for(_0x1ee5a7=0x0;_0x1ee5a7<_0x36e5ce[_0x63cb('0x2a')];_0x1ee5a7++){if(_0x36e5ce[_0x1ee5a7][_0x63cb('0x22')]===_0x437df5[_0x63cb('0x13')]){_0x175a48['userId']=_0x36e5ce[_0x1ee5a7][_0x63cb('0x27')];}}}_0x35b081(_0x175a48);})['catch'](function(_0x5c8167){_0x5d1281(_0x5c8167['message']);});});}function createEndUser(_0x482dc6,_0x3201e5,_0x1bce1f,_0x71db3c,_0x5bac49,_0x1750d2,_0x5da63b){return new Promise(function(_0x250bc0,_0xc3fbf7){return getAuthToken(_0x3201e5,_0x1bce1f,_0x1750d2)['then'](function(_0x22066c){var _0x41c539=_0x1750d2[_0x63cb('0x2b')]()===_0x63cb('0x2c')?_0x5bac49[_0x63cb('0x2d')]:_0x5bac49[_0x63cb('0x2e')];var _0x285536={'method':_0x63cb('0x12'),'uri':_0x71db3c+'contacts','body':{'fullname':_0x41c539,'firstname':_0x41c539,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x482dc6[_0x63cb('0x2f')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x22066c,'OData-Version':_0x63cb('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x285536[_0x63cb('0x30')][_0x5da63b]=_0x41c539;return rp(_0x285536);})[_0x63cb('0x19')](function(_0x4e695a){var _0x242055=_0x4e695a[_0x63cb('0x31')][_0x63cb('0x32')];var _0x33fdb6=_0x242055['substring'](_0x242055[_0x63cb('0x33')]('(')+0x1,_0x242055['lastIndexOf'](')'));_0x482dc6[_0x63cb('0x34')]=_0x33fdb6;_0x250bc0(_0x482dc6);})[_0x63cb('0x16')](function(_0x38a151){_0xc3fbf7(_0x38a151['message']);});});}function getEndUser(_0x39e2e3,_0x271508,_0x5793f3,_0x1c8614,_0x30c452,_0x36335c,_0x2c4b84,_0x38f8c4){var _0x49b283=_0x36335c['toLowerCase']()==='outbound'?_0x30c452[_0x63cb('0x2d')]:_0x30c452[_0x63cb('0x2e')];return getAuthToken(_0x271508,_0x5793f3,_0x36335c)[_0x63cb('0x19')](function(_0x25b0b5){_0x38f8c4=_0x38f8c4?_0x38f8c4:_0x63cb('0x35');var _0x8ab463={'method':_0x63cb('0x1a'),'uri':_0x1c8614+_0x63cb('0x36')+_0x38f8c4+_0x63cb('0x37')+_0x38f8c4+_0x63cb('0x38')+_0x49b283[_0x63cb('0x39')]('+',_0x63cb('0x3a'))+'\x27','headers':{'Authorization':_0x63cb('0x1c')+_0x25b0b5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x8ab463);})[_0x63cb('0x19')](function(_0x5b2228){var _0x4702c=![];if(!_0x5b2228)return _0x4702c;var _0x48cdf2=_0x5b2228['value'];for(var _0x2fa6d5=0x0;_0x2fa6d5<_0x48cdf2[_0x63cb('0x2a')];_0x2fa6d5++){if(_0x48cdf2[_0x2fa6d5][_0x38f8c4]===_0x49b283){_0x4702c=!![];_0x39e2e3['enduserId']=_0x48cdf2[_0x2fa6d5][_0x63cb('0x3b')];}}return _0x4702c;})[_0x63cb('0x19')](function(_0xe32291){if(_0xe32291)return _0x39e2e3;if(_0x2c4b84===_0x63cb('0x3c')){logger['info']('['+[_0x36335c[_0x63cb('0x25')]()]+_0x63cb('0x3d'));return _0x39e2e3;}return createEndUser(_0x39e2e3,_0x271508,_0x5793f3,_0x1c8614,_0x30c452,_0x36335c,_0x38f8c4)[_0x63cb('0x19')](function(_0x2cf37d){logger[_0x63cb('0x24')]('['+[_0x36335c[_0x63cb('0x25')]()]+']\x20Enduser\x20created!',_0x2cf37d[_0x63cb('0x34')]);return _0x2cf37d;});});}function getCustomFields(_0x4d5cd3,_0x42fc0b,_0x43ca85){var _0x2b6c42={};if(_0x4d5cd3[_0x63cb('0x2a')]>0x0){_[_0x63cb('0x3e')](_0x4d5cd3,function(_0x44de41){if(_[_0x63cb('0x3f')]([_0x63cb('0x40'),_0x63cb('0x41')],_0x44de41[_0x63cb('0x42')])&&_0x44de41[_0x63cb('0x43')]&&!_0x44de41['customField']){var _0x4ae4f0=_0x44de41[_0x63cb('0x44')][_0x63cb('0x2b')]();var _0x22ab41=_0x4ae4f0['substring'](0x0,_0x4ae4f0['indexOf']('_'));var _0x10b521=_0x4ae4f0['substring'](_0x4ae4f0['indexOf']('_')+0x1);if(_0x22ab41===_0x43ca85){_0x2b6c42[_0x10b521]=_0x44de41[_0x63cb('0x45')];}}});}return _0x2b6c42;}function getTicket(_0x2de047,_0x1c44ec,_0x36f6dc,_0x3c262f,_0x366697,_0x29207d,_0x3eb6ea){return new Promise(function(_0x352954,_0x398f69){var _0x1a753a;return getAuthToken(_0x1c44ec,_0x36f6dc,_0x3eb6ea)['then'](function(_0x178c0){if(_0x29207d[_0x63cb('0x46')]===_0x63cb('0x47')){_0x1a753a={'method':_0x63cb('0x12'),'uri':_0x3c262f+_0x63cb('0x48'),'body':Object[_0x63cb('0x49')]({},{'title':intUtil['getString'](_0x29207d[_0x63cb('0x4a')],_0x366697,'\x20'),'description':intUtil['getString'](_0x29207d[_0x63cb('0x4b')],_0x366697,'\x0a'),'customerid_contact@odata.bind':_0x2de047[_0x63cb('0x34')]?_0x63cb('0x4c')+_0x2de047['enduserId']+')':undefined,'ownerid@odata.bind':_0x63cb('0x4d')+_0x2de047[_0x63cb('0x2f')]+')','caseorigincode':'1'},getCustomFields(_0x29207d[_0x63cb('0x4e')],_0x366697,_0x29207d[_0x63cb('0x46')])),'headers':{'Authorization':_0x63cb('0x1c')+_0x178c0,'OData-Version':_0x63cb('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x29207d[_0x63cb('0x46')]===_0x63cb('0x4f')){var _0x4c6882=_0x2de047['enduserId']?[{'partyid_systemuser@odata.bind':_0x63cb('0x4d')+_0x2de047[_0x63cb('0x2f')]+')','participationtypemask':_0x2de047[_0x63cb('0x50')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x63cb('0x4c')+_0x2de047[_0x63cb('0x34')]+')','participationtypemask':_0x2de047['callDirection']===_0x63cb('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2de047['userId']+')','participationtypemask':_0x2de047['callDirection']===_0x63cb('0x51')?0x2:0x1}];_0x1a753a={'method':_0x63cb('0x12'),'uri':_0x3c262f+_0x63cb('0x52'),'body':Object['assign']({},{'subject':intUtil[_0x63cb('0x53')](_0x29207d[_0x63cb('0x4a')],_0x366697,'\x20'),'phonenumber':String(_0x366697[_0x63cb('0x2e')]),'description':intUtil[_0x63cb('0x53')](_0x29207d['Descriptions'],_0x366697,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2de047[_0x63cb('0x34')]?_0x63cb('0x4c')+_0x2de047['enduserId']+')':undefined,'ownerid@odata.bind':_0x63cb('0x4d')+_0x2de047[_0x63cb('0x2f')]+')','directioncode':_0x2de047[_0x63cb('0x50')]===_0x63cb('0x51')?![]:!![],'phonecall_activity_parties':_0x4c6882},getCustomFields(_0x29207d[_0x63cb('0x4e')],_0x366697,_0x29207d[_0x63cb('0x46')])),'headers':{'Authorization':_0x63cb('0x1c')+_0x178c0,'OData-Version':_0x63cb('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1a753a);})[_0x63cb('0x19')](function(_0x3c71f4){var _0x3c9c14=_0x3c71f4[_0x63cb('0x31')]['odata-entityid'];var _0x436e05=_0x3c9c14['substring'](_0x3c9c14[_0x63cb('0x33')]('(')+0x1,_0x3c9c14['lastIndexOf'](')'));_0x2de047[_0x63cb('0x54')]=_0x436e05;_0x352954(_0x2de047);})[_0x63cb('0x16')](function(_0x3dee35){_0x398f69(_0x3dee35[_0x63cb('0x18')]);});});}function emit(_0x79d0eb,_0x47575c,_0x48e291,_0x313523){var _0x364353={'uri':util[_0x63cb('0x55')](_0x63cb('0x56'),_0x79d0eb,_0x48e291,_0x313523)};io['to'](util[_0x63cb('0x55')](_0x63cb('0x57'),_0x47575c))['emit']('trigger:browser:url',_0x364353);}exports['cs']=function(_0x33cde6,_0x340258,_0x2c4587,_0x4eaee3,_0xc463f4,_0x181e6f,_0x1825a4,_0x2fa4d8){var _0x828ad3={};_0x181e6f[_0x63cb('0xb')]=_0x181e6f['modernAuthentication']?intUtil[_0x63cb('0x58')](_0x181e6f[_0x63cb('0xc')][_0x63cb('0xd')]):intUtil[_0x63cb('0x58')](_0x181e6f[_0x63cb('0xb')]);_0x181e6f['serverUrl']=intUtil[_0x63cb('0x58')](_0x181e6f[_0x63cb('0x59')]);_0x828ad3[_0x63cb('0x50')]=_0x2fa4d8===_0x63cb('0x51')||_0x2fa4d8===_0x63cb('0x5a')?_0x63cb('0x51'):_0x63cb('0x2c');var _0x3be041=_0x181e6f[_0x63cb('0xa')]?util['format'](_0x63cb('0x5b'),_0x181e6f[_0x63cb('0xc')][_0x63cb('0xd')]):util[_0x63cb('0x55')](_0x63cb('0x5b'),_0x181e6f[_0x63cb('0xb')]);var _0x6fabbd=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x181e6f['tenantId']);var _0x35c213=util[_0x63cb('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x181e6f[_0x63cb('0x59')],_0x340258[_0x63cb('0x5c')],md5(_0x340258[_0x63cb('0x5c')]));if(_0xc463f4&&_0xc463f4['monitor_format']){logger[_0x63cb('0x24')](_0x63cb('0x5d'),'Recording\x20is\x20enabled!');_0x340258[_0x63cb('0x5e')]=_0x35c213;}else if(_0x1825a4&&_0x1825a4[_0x63cb('0x5f')]&&_0x1825a4[_0x63cb('0x5f')]!=='none'){logger[_0x63cb('0x24')](_0x63cb('0x60'),'Recording\x20is\x20enabled!');_0x340258[_0x63cb('0x5e')]=_0x35c213;}else{_0x340258[_0x63cb('0x5e')]='';}return getUser(_0x828ad3,_0x181e6f,_0x4eaee3,_0x6fabbd,_0x3be041,_0x2fa4d8)['then'](function(_0x49d2f2){logger[_0x63cb('0x24')]('['+_0x2fa4d8[_0x63cb('0x25')]()+_0x63cb('0x61'),_0x49d2f2[_0x63cb('0x2f')]);logger[_0x63cb('0x24')]('['+_0x2fa4d8[_0x63cb('0x25')]()+_0x63cb('0x62'),_0x49d2f2[_0x63cb('0x29')]);return getEndUser(_0x49d2f2,_0x181e6f,_0x6fabbd,_0x3be041,_0x340258,_0x2fa4d8,_0x2c4587['moduleCreate'],_0x2c4587[_0x63cb('0x63')]);})[_0x63cb('0x19')](function(_0x124697){logger[_0x63cb('0x24')]('['+_0x2fa4d8[_0x63cb('0x25')]()+_0x63cb('0x64'),_0x124697[_0x63cb('0x34')]);logger['info']('['+_0x2fa4d8['toUpperCase']()+_0x63cb('0x65'),_0x340258['calleridnum']);return getTicket(_0x124697,_0x181e6f,_0x6fabbd,_0x3be041,_0x340258,_0x2c4587,_0x2fa4d8);})['then'](function(_0x26dbfa){logger[_0x63cb('0x24')](util['format']('['+_0x2fa4d8['toUpperCase']()+_0x63cb('0x66'),_0x2c4587[_0x63cb('0x46')],_0x26dbfa[_0x63cb('0x54')]));logger['info'](util['format']('['+_0x2fa4d8[_0x63cb('0x25')]()+_0x63cb('0x67'),_0x2fa4d8));if(_0x2fa4d8!=='unmanaged'&&_0x2c4587[_0x63cb('0x68')]){logger[_0x63cb('0x24')]('['+_0x2fa4d8[_0x63cb('0x25')]()+']',_0x63cb('0x69'));emit(_0x181e6f[_0x63cb('0xb')],_0x4eaee3[_0x63cb('0x6a')],_0x2c4587['ticketType'],_0x26dbfa[_0x63cb('0x54')]);}})[_0x63cb('0x16')](function(_0x6a908e){logger[_0x63cb('0x6b')]('['+_0x2fa4d8[_0x63cb('0x25')]()+_0x63cb('0x6c'),_0x6a908e['message']);console[_0x63cb('0x6b')]('Error\x20running\x20Dynamics365\x20integration',_0x6a908e);});}; \ 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 c142f89..a94462c 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 _0x78e9=['Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','lastevent','calleridname','catch','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','value','%s/api/v2/tickets','then','Ticket\x20created!','remoteUri','length','Agent\x20found!','find','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','GET','map','forEach','includes','string','nameField','customField','content','picklist','idField','type','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x18329c,_0x5804b7){var _0x19cbc5=function(_0x1732ca){while(--_0x1732ca){_0x18329c['push'](_0x18329c['shift']());}};_0x19cbc5(++_0x5804b7);}(_0x78e9,0x182));var _0x978e=function(_0x469229,_0x4f4270){_0x469229=_0x469229-0x0;var _0x50bf5b=_0x78e9[_0x469229];return _0x50bf5b;};'use strict';var _=require(_0x978e('0x0'));var rp=require(_0x978e('0x1'));var md5=require(_0x978e('0x2'));var util=require('util');var Redis=require(_0x978e('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x978e('0x4'))(_0x978e('0x5'));config[_0x978e('0x6')]=_[_0x978e('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x978e('0x8'))(new Redis(config[_0x978e('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x978e('0x9')};function emit(_0x55d7da,_0x4ce13b,_0x2c9a90){io['to'](_0x55d7da)[_0x978e('0xa')](_0x4ce13b,_0x2c9a90);}function getTicket(_0x28e592,_0x1b11d0,_0x1305cb,_0x1980dc,_0x56f948){logger[_0x978e('0xb')](_0x978e('0xc'));var _0x4bb2e5=_[_0x978e('0xd')]({'responder_id':_0x1b11d0['id'],'requester_id':_0x1305cb['id'],'name':util[_0x978e('0xe')]('Caller\x20-\x20%s',_0x56f948['calleridname']),'phone':_0x56f948[_0x978e('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x978e('0x10')](_0x1980dc[_0x978e('0x11')],_0x56f948,'\x20'),'description':intUtil[_0x978e('0x10')](_0x1980dc[_0x978e('0x12')],_0x56f948,_0x978e('0x13')),'tags':getTags(_0x1980dc['Tags'],_0x978e('0x14'))},getCustomFields(_0x1980dc[_0x978e('0x15')],_0x56f948));_0x4bb2e5[_0x978e('0x16')]=_['mapValues'](_['keyBy'](_0x4bb2e5[_0x978e('0x16')],'id'),_0x978e('0x17'));return request({'uri':util[_0x978e('0xe')](_0x978e('0x18'),_0x28e592['remoteUri']),'method':'POST','body':_0x4bb2e5})[_0x978e('0x19')](function(_0x41f294){logger[_0x978e('0xb')](_0x978e('0x1a'));return _0x41f294;});}function getUser(_0x510bc0,_0x8d863){if(intUtil['validateEmail'](_0x8d863)){return request({'uri':util[_0x978e('0xe')]('%s/api/v2/agents',_0x510bc0[_0x978e('0x1b')]),'qs':{'email':_0x8d863}})['then'](function(_0x3db92e){if(_0x3db92e[_0x978e('0x1c')]){logger['info'](_0x978e('0x1d'));return _[_0x978e('0x1e')](_0x3db92e,function(_0x3291fe){return _0x3291fe[_0x978e('0x1f')][_0x978e('0x20')]===_0x8d863;});}else{logger[_0x978e('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x978e('0xe')]('%s/api/v2/agents/me',_0x510bc0[_0x978e('0x1b')])})[_0x978e('0x19')](function(_0x186333){logger[_0x978e('0xb')](_0x978e('0x21'));return _0x186333;});}});}else{logger['info'](_0x978e('0x22'));return request({'uri':util['format'](_0x978e('0x23'),_0x510bc0[_0x978e('0x1b')])})['then'](function(_0x68d9c){logger['info']('Admin\x20account\x20selected.');return _0x68d9c;});}}function getEndUser(_0x157956,_0x3f0ba6,_0x4b3ae0){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4b3ae0);return request({'uri':util['format'](_0x978e('0x24'),_0x157956[_0x978e('0x1b')]),'qs':{'phone':_0x4b3ae0}})[_0x978e('0x19')](function(_0x521c3c){if(_0x521c3c[_0x978e('0x1c')]){logger['info']('Enduser\x20found!');return _['find'](_0x521c3c,{'phone':_0x4b3ae0});}else{logger['info'](_0x978e('0x25'));return request({'uri':util['format'](_0x978e('0x24'),_0x157956[_0x978e('0x1b')]),'method':_0x978e('0x26'),'body':{'name':_0x3f0ba6,'phone':_0x4b3ae0}})[_0x978e('0x19')](function(_0x2060a6){logger['info'](_0x978e('0x27'));return _0x2060a6;});}});}function getAuth(_0x80109){return util['format'](_0x978e('0x28'),new Buffer(_0x80109[_0x978e('0x29')]+':X')[_0x978e('0x2a')](_0x978e('0x2b')));}function request(_0x5c14f1){logger['debug'](_0x978e('0x2c'),JSON['stringify'](_0x5c14f1));return rp(_[_0x978e('0x7')](_0x5c14f1,{'method':_0x978e('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x5ce80e,_0x78c9be){var _0x2ff16d=[];if(_0x5ce80e&&_0x5ce80e[_0x978e('0x1c')]>0x0){_0x2ff16d=_[_0x978e('0x2e')](_0x5ce80e,_0x78c9be);}return _0x2ff16d;}function getCustomFields(_0x22b9a0,_0xaa83ca){var _0x34b8ba=[];var _0x49ffab={'custom_fields':[]};if(_0x22b9a0[_0x978e('0x1c')]>0x0){_[_0x978e('0x2f')](_0x22b9a0,function(_0x5278cb){if(_[_0x978e('0x30')]([_0x978e('0x31'),'picklist'],_0x5278cb['type'])&&_0x5278cb[_0x978e('0x32')]&&!_0x5278cb[_0x978e('0x33')]){_0x49ffab[_0x5278cb[_0x978e('0x32')]['toLowerCase']()]=_0x5278cb[_0x978e('0x34')]['toString']();}else if(_['includes'](['string',_0x978e('0x35')],_0x5278cb['type'])&&_0x5278cb['idField']&&_0x5278cb['customField']){_0x49ffab['custom_fields']['push']({'id':_0x5278cb[_0x978e('0x36')],'value':_0x5278cb[_0x978e('0x34')][_0x978e('0x2a')]()});}else if(_0x5278cb[_0x978e('0x37')]===_0x978e('0x38')&&_0x5278cb['variableName']&&_0x5278cb['idField']&&_0x5278cb['customField']){_0xaa83ca[_0x5278cb[_0x978e('0x39')]]&&_0x49ffab[_0x978e('0x16')][_0x978e('0x3a')]({'id':_0x5278cb[_0x978e('0x36')],'value':_0xaa83ca[_0x5278cb[_0x978e('0x39')]][_0x978e('0x2a')]()});}else if(_0x5278cb['type']===_0x978e('0x3b')&&_0x5278cb[_0x978e('0x3c')]&&_0x5278cb[_0x978e('0x3c')]['name']&&_0x5278cb[_0x978e('0x36')]&&_0x5278cb[_0x978e('0x33')]){_0xaa83ca[_0x5278cb[_0x978e('0x3c')][_0x978e('0x14')][_0x978e('0x3d')]()]&&_0x49ffab[_0x978e('0x16')][_0x978e('0x3a')]({'id':_0x5278cb[_0x978e('0x36')],'value':_0xaa83ca[_0x5278cb[_0x978e('0x3c')][_0x978e('0x14')][_0x978e('0x3d')]()][_0x978e('0x2a')]()});}});}return _0x49ffab;}exports[_0x978e('0x3e')]=function(_0x410209,_0x253757,_0x5d9e68,_0x5ba4de,_0x34db36,_0x314545){var _0x358ee2,_0x48331c;_0x314545[_0x978e('0x1b')]=intUtil[_0x978e('0x3f')](_0x314545[_0x978e('0x1b')]);_0x314545['serverUrl']=intUtil['stripTrailingSlash'](_0x314545[_0x978e('0x40')]);if(_0x34db36&&_0x34db36[_0x978e('0x41')]){logger[_0x978e('0xb')]('[QUEUE]',_0x978e('0x42'));_0x253757[_0x978e('0x43')]=util[_0x978e('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x314545[_0x978e('0x40')],_0x253757[_0x978e('0x44')],md5(_0x253757[_0x978e('0x44')]));}else{_0x253757[_0x978e('0x43')]='';}headers[_0x978e('0x45')]=getAuth(_0x314545);return getUser(_0x314545,_0x5ba4de['email'])['then'](function(_0x57e290){_0x358ee2=_0x57e290;logger[_0x978e('0xb')](_0x978e('0x46'),_0x358ee2['id']);return getEndUser(_0x314545,_0x253757['calleridname'],_0x253757[_0x978e('0xf')]);})['then'](function(_0x49d14b){_0x48331c=_0x49d14b;logger['info'](_0x978e('0x47'),_0x48331c['id']);return getTicket(_0x314545,_0x358ee2,_0x48331c,_0x5d9e68,_0x253757);})[_0x978e('0x19')](function(_0x297f42){if(_0x297f42&&_0x297f42['id']){logger['info'](_0x978e('0x1a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x297f42['id']);logger[_0x978e('0xb')]('[QUEUE]',_0x978e('0x48'));emit(util[_0x978e('0xe')](_0x978e('0x49'),_0x5ba4de[_0x978e('0x14')]),_0x978e('0x4a'),{'uri':util[_0x978e('0xe')](_0x978e('0x4b'),_0x314545[_0x978e('0x1b')],_0x297f42['id'])});}})['catch'](function(_0x39219d){logger[_0x978e('0x4c')](_0x978e('0x4d'),JSON[_0x978e('0x4e')](_0x39219d));});};exports[_0x978e('0x4f')]=function(_0x461bca,_0xc65be0,_0x563d38,_0x502169,_0x5bc1ad,_0x1b0e0f,_0x3eb8e7){var _0xb93108,_0x4e8cab;_0x1b0e0f['remoteUri']=intUtil[_0x978e('0x3f')](_0x1b0e0f['remoteUri']);_0x1b0e0f[_0x978e('0x40')]=intUtil[_0x978e('0x3f')](_0x1b0e0f[_0x978e('0x40')]);if(_0x3eb8e7&&_0x3eb8e7[_0x978e('0x50')]&&_0x3eb8e7[_0x978e('0x50')]!==_0x978e('0x51')){logger[_0x978e('0xb')](_0x978e('0x52'),_0x978e('0x42'));_0xc65be0[_0x978e('0x43')]=util[_0x978e('0xe')](_0x978e('0x53'),_0x1b0e0f[_0x978e('0x40')],_0xc65be0[_0x978e('0x44')],md5(_0xc65be0[_0x978e('0x44')]));}headers['Authorization']=getAuth(_0x1b0e0f);return getUser(_0x1b0e0f,_0x502169[_0x978e('0x20')])[_0x978e('0x19')](function(_0x59217c){_0xb93108=_0x59217c;logger['info'](_0x978e('0x46'),_0xb93108['id']);return getEndUser(_0x1b0e0f,_0xc65be0[_0x978e('0x54')],_0xc65be0[_0x978e('0x55')]);})[_0x978e('0x19')](function(_0x1d5599){_0x4e8cab=_0x1d5599;logger[_0x978e('0xb')](_0x978e('0x47'),_0x4e8cab['id']);return getTicket(_0x1b0e0f,_0xb93108,_0x4e8cab,_0x563d38,_0xc65be0);})[_0x978e('0x19')](function(_0x507756){if(_0x507756&&_0x507756['id']){logger[_0x978e('0xb')](_0x978e('0x1a'));logger['info'](_0x978e('0x56'),_0x507756['id']);logger[_0x978e('0xb')](_0x978e('0x52'),_0x978e('0x48'));emit(util['format'](_0x978e('0x49'),_0x502169[_0x978e('0x14')]),_0x978e('0x4a'),{'uri':util[_0x978e('0xe')](_0x978e('0x4b'),_0x1b0e0f[_0x978e('0x1b')],_0x507756['id'])});}})['catch'](function(_0x404531){logger[_0x978e('0x4c')](_0x978e('0x52'),JSON['stringify'](_0x404531));});};exports['unmanaged']=function(_0x5e7c33,_0x217b8b,_0x44eb75,_0x1a780d,_0x2cfd3f,_0x4ad609){var _0x4cab69,_0x576ffe;_0x4ad609[_0x978e('0x1b')]=intUtil[_0x978e('0x3f')](_0x4ad609[_0x978e('0x1b')]);_0x4ad609[_0x978e('0x40')]=intUtil[_0x978e('0x3f')](_0x4ad609[_0x978e('0x40')]);if(_0x2cfd3f&&_0x2cfd3f[_0x978e('0x41')]){logger[_0x978e('0xb')]('['+_0x217b8b[_0x978e('0x57')]['toUpperCase']()+']',_0x978e('0x42'));_0x217b8b[_0x978e('0x43')]=util[_0x978e('0xe')](_0x978e('0x53'),_0x4ad609[_0x978e('0x40')],_0x217b8b['uniqueid'],md5(_0x217b8b[_0x978e('0x44')]));}else{_0x217b8b['recordingURL']='';}headers[_0x978e('0x45')]=getAuth(_0x4ad609);return getUser(_0x4ad609,'')[_0x978e('0x19')](function(_0x13660b){_0x4cab69=_0x13660b;logger['info']('The\x20User\x20ID\x20is:',_0x4cab69['id']);return getEndUser(_0x4ad609,_0x217b8b[_0x978e('0x58')],_0x217b8b[_0x978e('0xf')]);})[_0x978e('0x19')](function(_0x503cd1){_0x576ffe=_0x503cd1;logger[_0x978e('0xb')](_0x978e('0x47'),_0x576ffe['id']);return getTicket(_0x4ad609,_0x4cab69,_0x576ffe,_0x44eb75,_0x217b8b);})[_0x978e('0x19')](function(_0x3e03ad){if(_0x3e03ad){logger[_0x978e('0xb')](_0x978e('0x1a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3e03ad['id']);}})[_0x978e('0x59')](function(_0x10d774){logger[_0x978e('0x4c')]('['+_0x217b8b[_0x978e('0x57')][_0x978e('0x5a')]()+']',JSON[_0x978e('0x4e')](_0x10d774));});}; \ No newline at end of file +var _0xc067=['redis','localhost','application/json','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','GET','forEach','includes','string','type','nameField','toLowerCase','content','toString','picklist','idField','customField','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','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','[OUTBOUND]','destcalleridname','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults'];(function(_0xa62004,_0x29f3b4){var _0xf42eaa=function(_0x18da7a){while(--_0x18da7a){_0xa62004['push'](_0xa62004['shift']());}};_0xf42eaa(++_0x29f3b4);}(_0xc067,0x17a));var _0x7c06=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0xc067[_0x29ae80];return _0x5d6d71;};'use strict';var _=require(_0x7c06('0x0'));var rp=require(_0x7c06('0x1'));var md5=require(_0x7c06('0x2'));var util=require(_0x7c06('0x3'));var Redis=require(_0x7c06('0x4'));var intUtil=require(_0x7c06('0x5'));var config=require(_0x7c06('0x6'));var logger=require(_0x7c06('0x7'))(_0x7c06('0x8'));config['redis']=_[_0x7c06('0x9')](config[_0x7c06('0xa')],{'host':_0x7c06('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c06('0xa')]));var headers={'Content-Type':_0x7c06('0xc'),'Accept':_0x7c06('0xc')};function emit(_0x54f916,_0x2b6683,_0x4ddf43){io['to'](_0x54f916)['emit'](_0x2b6683,_0x4ddf43);}function getTicket(_0x2a57d9,_0x163226,_0xaa7ffd,_0x461e7a,_0x182502){logger['info'](_0x7c06('0xd'));var _0x12a378=_['merge']({'responder_id':_0x163226['id'],'requester_id':_0xaa7ffd['id'],'name':util['format'](_0x7c06('0xe'),_0x182502[_0x7c06('0xf')]),'phone':_0x182502[_0x7c06('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7c06('0x11')](_0x461e7a[_0x7c06('0x12')],_0x182502,'\x20'),'description':intUtil[_0x7c06('0x11')](_0x461e7a[_0x7c06('0x13')],_0x182502,_0x7c06('0x14')),'tags':getTags(_0x461e7a[_0x7c06('0x15')],'name')},getCustomFields(_0x461e7a[_0x7c06('0x16')],_0x182502));_0x12a378['custom_fields']=_[_0x7c06('0x17')](_[_0x7c06('0x18')](_0x12a378[_0x7c06('0x19')],'id'),_0x7c06('0x1a'));return request({'uri':util[_0x7c06('0x1b')](_0x7c06('0x1c'),_0x2a57d9['remoteUri']),'method':_0x7c06('0x1d'),'body':_0x12a378})['then'](function(_0x2573b5){logger[_0x7c06('0x1e')](_0x7c06('0x1f'));return _0x2573b5;});}function getUser(_0x5e002a,_0x45308a){if(intUtil[_0x7c06('0x20')](_0x45308a)){return request({'uri':util['format'](_0x7c06('0x21'),_0x5e002a[_0x7c06('0x22')]),'qs':{'email':_0x45308a}})[_0x7c06('0x23')](function(_0x1dcf65){if(_0x1dcf65[_0x7c06('0x24')]){logger[_0x7c06('0x1e')](_0x7c06('0x25'));return _[_0x7c06('0x26')](_0x1dcf65,function(_0x584539){return _0x584539['contact'][_0x7c06('0x27')]===_0x45308a;});}else{logger['info'](_0x7c06('0x28'));return request({'uri':util[_0x7c06('0x1b')](_0x7c06('0x29'),_0x5e002a['remoteUri'])})['then'](function(_0x13894d){logger[_0x7c06('0x1e')](_0x7c06('0x2a'));return _0x13894d;});}});}else{logger['info'](_0x7c06('0x2b'));return request({'uri':util[_0x7c06('0x1b')](_0x7c06('0x29'),_0x5e002a[_0x7c06('0x22')])})[_0x7c06('0x23')](function(_0x5976a3){logger[_0x7c06('0x1e')](_0x7c06('0x2a'));return _0x5976a3;});}}function getEndUser(_0x452b40,_0x39327e,_0x4a0435){logger[_0x7c06('0x1e')]('Searching\x20enduser\x20with\x20phone',_0x4a0435);return request({'uri':util[_0x7c06('0x1b')](_0x7c06('0x2c'),_0x452b40[_0x7c06('0x22')]),'qs':{'phone':_0x4a0435}})[_0x7c06('0x23')](function(_0x30a4b5){if(_0x30a4b5[_0x7c06('0x24')]){logger['info'](_0x7c06('0x2d'));return _[_0x7c06('0x26')](_0x30a4b5,{'phone':_0x4a0435});}else{logger['info'](_0x7c06('0x2e'));return request({'uri':util['format']('%s/api/v2/contacts',_0x452b40[_0x7c06('0x22')]),'method':_0x7c06('0x1d'),'body':{'name':_0x39327e,'phone':_0x4a0435}})[_0x7c06('0x23')](function(_0x865f16){logger['info'](_0x7c06('0x2f'));return _0x865f16;});}});}function getAuth(_0x10d384){return util['format'](_0x7c06('0x30'),new Buffer(_0x10d384[_0x7c06('0x31')]+':X')['toString'](_0x7c06('0x32')));}function request(_0x119819){logger['debug']('[HTTP]',JSON['stringify'](_0x119819));return rp(_[_0x7c06('0x9')](_0x119819,{'method':_0x7c06('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x40acc9,_0x13de40){var _0x48039a=[];if(_0x40acc9&&_0x40acc9[_0x7c06('0x24')]>0x0){_0x48039a=_['map'](_0x40acc9,_0x13de40);}return _0x48039a;}function getCustomFields(_0x596698,_0x19267a){var _0x1cff51=[];var _0x2356bb={'custom_fields':[]};if(_0x596698['length']>0x0){_[_0x7c06('0x34')](_0x596698,function(_0x2a9026){if(_[_0x7c06('0x35')]([_0x7c06('0x36'),'picklist'],_0x2a9026[_0x7c06('0x37')])&&_0x2a9026[_0x7c06('0x38')]&&!_0x2a9026['customField']){_0x2356bb[_0x2a9026[_0x7c06('0x38')][_0x7c06('0x39')]()]=_0x2a9026[_0x7c06('0x3a')][_0x7c06('0x3b')]();}else if(_[_0x7c06('0x35')]([_0x7c06('0x36'),_0x7c06('0x3c')],_0x2a9026['type'])&&_0x2a9026[_0x7c06('0x3d')]&&_0x2a9026[_0x7c06('0x3e')]){_0x2356bb['custom_fields'][_0x7c06('0x3f')]({'id':_0x2a9026[_0x7c06('0x3d')],'value':_0x2a9026[_0x7c06('0x3a')][_0x7c06('0x3b')]()});}else if(_0x2a9026[_0x7c06('0x37')]===_0x7c06('0x40')&&_0x2a9026[_0x7c06('0x41')]&&_0x2a9026['idField']&&_0x2a9026[_0x7c06('0x3e')]){_0x19267a[_0x2a9026[_0x7c06('0x41')]]&&_0x2356bb[_0x7c06('0x19')][_0x7c06('0x3f')]({'id':_0x2a9026[_0x7c06('0x3d')],'value':_0x19267a[_0x2a9026['variableName']]['toString']()});}else if(_0x2a9026[_0x7c06('0x37')]===_0x7c06('0x42')&&_0x2a9026[_0x7c06('0x43')]&&_0x2a9026[_0x7c06('0x43')][_0x7c06('0x44')]&&_0x2a9026[_0x7c06('0x3d')]&&_0x2a9026[_0x7c06('0x3e')]){_0x19267a[_0x2a9026[_0x7c06('0x43')]['name'][_0x7c06('0x39')]()]&&_0x2356bb[_0x7c06('0x19')][_0x7c06('0x3f')]({'id':_0x2a9026[_0x7c06('0x3d')],'value':_0x19267a[_0x2a9026['Variable']['name'][_0x7c06('0x39')]()][_0x7c06('0x3b')]()});}});}return _0x2356bb;}exports[_0x7c06('0x45')]=function(_0x52b50d,_0xa1e930,_0x273ea8,_0x3abf8e,_0x579712,_0x4ebfa4){var _0x216043,_0x447d01;_0x4ebfa4[_0x7c06('0x22')]=intUtil[_0x7c06('0x46')](_0x4ebfa4[_0x7c06('0x22')]);_0x4ebfa4[_0x7c06('0x47')]=intUtil[_0x7c06('0x46')](_0x4ebfa4[_0x7c06('0x47')]);if(_0x579712&&_0x579712[_0x7c06('0x48')]){logger[_0x7c06('0x1e')](_0x7c06('0x49'),_0x7c06('0x4a'));_0xa1e930[_0x7c06('0x4b')]=util[_0x7c06('0x1b')](_0x7c06('0x4c'),_0x4ebfa4['serverUrl'],_0xa1e930[_0x7c06('0x4d')],md5(_0xa1e930[_0x7c06('0x4d')]));}else{_0xa1e930[_0x7c06('0x4b')]='';}headers[_0x7c06('0x4e')]=getAuth(_0x4ebfa4);return getUser(_0x4ebfa4,_0x3abf8e['email'])[_0x7c06('0x23')](function(_0x1c7ef8){_0x216043=_0x1c7ef8;logger[_0x7c06('0x1e')](_0x7c06('0x4f'),_0x216043['id']);return getEndUser(_0x4ebfa4,_0xa1e930[_0x7c06('0xf')],_0xa1e930[_0x7c06('0x10')]);})[_0x7c06('0x23')](function(_0x1751d4){_0x447d01=_0x1751d4;logger[_0x7c06('0x1e')](_0x7c06('0x50'),_0x447d01['id']);return getTicket(_0x4ebfa4,_0x216043,_0x447d01,_0x273ea8,_0xa1e930);})[_0x7c06('0x23')](function(_0x580312){if(_0x580312&&_0x580312['id']){logger[_0x7c06('0x1e')](_0x7c06('0x1f'));logger[_0x7c06('0x1e')](_0x7c06('0x51'),_0x580312['id']);logger[_0x7c06('0x1e')](_0x7c06('0x49'),_0x7c06('0x52'));emit(util['format'](_0x7c06('0x53'),_0x3abf8e[_0x7c06('0x44')]),_0x7c06('0x54'),{'uri':util[_0x7c06('0x1b')](_0x7c06('0x55'),_0x4ebfa4[_0x7c06('0x22')],_0x580312['id'])});}})[_0x7c06('0x56')](function(_0x32011f){logger[_0x7c06('0x57')]('[QUEUE]',JSON[_0x7c06('0x58')](_0x32011f));});};exports[_0x7c06('0x59')]=function(_0x146d70,_0x14997e,_0x56c1c8,_0x98bd05,_0x4f7826,_0x11ccda,_0x19d66d){var _0x396972,_0x12a56c;_0x11ccda[_0x7c06('0x22')]=intUtil[_0x7c06('0x46')](_0x11ccda[_0x7c06('0x22')]);_0x11ccda[_0x7c06('0x47')]=intUtil[_0x7c06('0x46')](_0x11ccda[_0x7c06('0x47')]);if(_0x19d66d&&_0x19d66d[_0x7c06('0x5a')]&&_0x19d66d[_0x7c06('0x5a')]!==_0x7c06('0x5b')){logger[_0x7c06('0x1e')](_0x7c06('0x5c'),_0x7c06('0x4a'));_0x14997e[_0x7c06('0x4b')]=util['format'](_0x7c06('0x4c'),_0x11ccda['serverUrl'],_0x14997e['uniqueid'],md5(_0x14997e[_0x7c06('0x4d')]));}headers[_0x7c06('0x4e')]=getAuth(_0x11ccda);return getUser(_0x11ccda,_0x98bd05[_0x7c06('0x27')])[_0x7c06('0x23')](function(_0xca8ff9){_0x396972=_0xca8ff9;logger[_0x7c06('0x1e')](_0x7c06('0x4f'),_0x396972['id']);return getEndUser(_0x11ccda,_0x14997e[_0x7c06('0x5d')],_0x14997e['destcalleridnum']);})['then'](function(_0x421df7){_0x12a56c=_0x421df7;logger['info'](_0x7c06('0x50'),_0x12a56c['id']);return getTicket(_0x11ccda,_0x396972,_0x12a56c,_0x56c1c8,_0x14997e);})['then'](function(_0xae3d8a){if(_0xae3d8a&&_0xae3d8a['id']){logger[_0x7c06('0x1e')](_0x7c06('0x1f'));logger[_0x7c06('0x1e')](_0x7c06('0x51'),_0xae3d8a['id']);logger[_0x7c06('0x1e')](_0x7c06('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7c06('0x53'),_0x98bd05[_0x7c06('0x44')]),_0x7c06('0x54'),{'uri':util[_0x7c06('0x1b')](_0x7c06('0x55'),_0x11ccda[_0x7c06('0x22')],_0xae3d8a['id'])});}})[_0x7c06('0x56')](function(_0x3cf938){logger[_0x7c06('0x57')](_0x7c06('0x5c'),JSON['stringify'](_0x3cf938));});};exports[_0x7c06('0x5e')]=function(_0x38e270,_0x1acb9a,_0x37da37,_0xeea4ed,_0x2a7185,_0x150ec6){var _0x34017a,_0x2a6cf6;_0x150ec6['remoteUri']=intUtil[_0x7c06('0x46')](_0x150ec6['remoteUri']);_0x150ec6[_0x7c06('0x47')]=intUtil[_0x7c06('0x46')](_0x150ec6['serverUrl']);if(_0x2a7185&&_0x2a7185[_0x7c06('0x48')]){logger['info']('['+_0x1acb9a[_0x7c06('0x5f')][_0x7c06('0x60')]()+']',_0x7c06('0x4a'));_0x1acb9a[_0x7c06('0x4b')]=util[_0x7c06('0x1b')](_0x7c06('0x4c'),_0x150ec6[_0x7c06('0x47')],_0x1acb9a[_0x7c06('0x4d')],md5(_0x1acb9a[_0x7c06('0x4d')]));}else{_0x1acb9a[_0x7c06('0x4b')]='';}headers[_0x7c06('0x4e')]=getAuth(_0x150ec6);return getUser(_0x150ec6,'')['then'](function(_0x42310b){_0x34017a=_0x42310b;logger['info'](_0x7c06('0x4f'),_0x34017a['id']);return getEndUser(_0x150ec6,_0x1acb9a['calleridname'],_0x1acb9a[_0x7c06('0x10')]);})[_0x7c06('0x23')](function(_0xe9518c){_0x2a6cf6=_0xe9518c;logger['info'](_0x7c06('0x50'),_0x2a6cf6['id']);return getTicket(_0x150ec6,_0x34017a,_0x2a6cf6,_0x37da37,_0x1acb9a);})[_0x7c06('0x23')](function(_0x18f017){if(_0x18f017){logger['info'](_0x7c06('0x1f'));logger['info'](_0x7c06('0x51'),_0x18f017['id']);}})[_0x7c06('0x56')](function(_0x457605){logger[_0x7c06('0x57')]('['+_0x1acb9a[_0x7c06('0x5f')][_0x7c06('0x60')]()+']',JSON[_0x7c06('0x58')](_0x457605));});}; \ 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 94676ce..cca33c0 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 _0x379e=['POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','error','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','/api/selector/owners','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','GET','headers','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x379e,0x179));var _0xe379=function(_0x46afff,_0x45011e){_0x46afff=_0x46afff-0x0;var _0x1b376a=_0x379e[_0x46afff];return _0x1b376a;};'use strict';var _=require('lodash');var rp=require(_0xe379('0x0'));var md5=require(_0xe379('0x1'));var util=require(_0xe379('0x2'));var moment=require(_0xe379('0x3'));var Promise=require(_0xe379('0x4'));var Redis=require(_0xe379('0x5'));var intUtil=require(_0xe379('0x6'));var config=require(_0xe379('0x7'));var logger=require(_0xe379('0x8'))('freshsales');config['redis']=_[_0xe379('0x9')](config[_0xe379('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe379('0xa')]));function getAdminId(_0x455823,_0xaa3926,_0x480819,_0x2fd95f){return new Promise(function(_0x2c257f,_0x1a1945){var _0x193f70=![];var _0x1f940a={'method':'GET','uri':_0x2fd95f+_0xe379('0xb'),'json':!![]};_0x1f940a['headers']=_0x480819;logger[_0xe379('0xc')](_0xe379('0xd'));return rp(_0x1f940a)[_0xe379('0xe')](function(_0x280d9f){if(_0x280d9f){var _0x1bb39d=_0x280d9f[_0xe379('0xf')];var _0x411d33=null;for(_0x411d33=0x0;_0x411d33<_0x1bb39d['length'];_0x411d33++){if(_0x1bb39d[_0x411d33][_0xe379('0x10')]===_0x455823['adminEmail']){_0x455823[_0xe379('0x11')]=_0x1bb39d[_0x411d33]['id'];_0x193f70=!![];}}if(_0x193f70){logger[_0xe379('0xc')](_0xe379('0x12'),_0x455823[_0xe379('0x11')]);_0x2c257f(_0x455823);}else{_0x1a1945({'statusCode':0x194,'message':_0xe379('0x13')});}}else{_0x1a1945({'statusCode':0x194,'message':_0xe379('0x13')});}})['catch'](function(_0x12e507){logger['error']('['+[_0xaa3926[_0xe379('0x14')]()]+']',_0x12e507[_0xe379('0x15')]);_0x1a1945(_0x12e507);});});}function getUser(_0x4e3bfa,_0x20fdec,_0x3602b0){return function(_0xc27e2d){return new Promise(function(_0x45bb60,_0x2660ac){var _0x40a743={'method':_0xe379('0x16'),'uri':_0x3602b0+_0xe379('0xb'),'json':!![]};_0x40a743[_0xe379('0x17')]=_0x20fdec;logger[_0xe379('0xc')]('Getting\x20user\x20list');return rp(_0x40a743)['then'](function(_0x28f4ba){if(_0x28f4ba){var _0x26e087=_0x28f4ba[_0xe379('0xf')];var _0x555704=![];var _0x47f8c3=null;if(_0xc27e2d[_0xe379('0x18')]!==null){logger[_0xe379('0xc')]('Getting\x20user\x20with\x20email',_0xc27e2d[_0xe379('0x18')]);_0xc27e2d[_0xe379('0x19')]=_0xc27e2d[_0xe379('0x18')];for(_0x47f8c3=0x0;_0x47f8c3<_0x26e087['length'];_0x47f8c3++){if(_0x26e087[_0x47f8c3]['email']===_0xc27e2d[_0xe379('0x18')]){_0x555704=!![];_0xc27e2d[_0xe379('0x1a')]=_0x26e087[_0x47f8c3]['id'];logger['info'](_0xe379('0x1b'),_0xc27e2d['userId']);}}}if(!_0x555704){logger['info'](_0xe379('0x1c'));_0xc27e2d[_0xe379('0x19')]=_0xc27e2d[_0xe379('0x1d')];_0xc27e2d['userId']=_0xc27e2d[_0xe379('0x11')];_0x555704=!![];}if(_0x555704){_0x45bb60(_0xc27e2d);}else{_0x2660ac({'statusCode':0x194,'message':_0xe379('0x13')});}}else{_0x2660ac({'statusCode':0x194,'message':_0xe379('0x13')});}})[_0xe379('0x1e')](function(_0x5eeb93){logger['error']('['+[_0x4e3bfa[_0xe379('0x14')]()]+']',_0x5eeb93[_0xe379('0x15')]);_0x2660ac(_0x5eeb93);});});};}function searchContact(_0x2048b2,_0x5b45af,_0x33c861,_0x43ed9a){return new Promise(function(_0x4598f7,_0x5da416){var _0x4fea27={'method':_0xe379('0x16'),'headers':_0x5b45af,'uri':_0x2048b2+_0xe379('0x1f')+_0x43ed9a+_0xe379('0x20')+_0x33c861+_0xe379('0x21'),'json':!![]};rp(_0x4fea27)[_0xe379('0xe')](function(_0x369f21){var _0x189698=_[_0xe379('0x22')](_0x369f21[_0xe379('0x23')][_0xe379('0x23')],[_0x33c861,_0x43ed9a]);_0x4598f7(_0x189698);})[_0xe379('0x1e')](function(_0x5c6dfb){_0x5da416(_0x5c6dfb);});});}function getEndUser(_0x22fab3,_0x48212a,_0x5d83e8){return function(_0x28c18a){return new Promise(function(_0x48c462,_0x418b05){logger[_0xe379('0xc')](util[_0xe379('0x24')](_0xe379('0x25'),_0x28c18a[_0xe379('0x26')]));searchContact(_0x5d83e8,_0x48212a,_0xe379('0x27'),_0x28c18a['contactNumber'])[_0xe379('0xe')](function(_0x292094){if(_0x292094){_0x28c18a[_0xe379('0x28')]=_0x292094['id'];logger[_0xe379('0xc')](_0xe379('0x29'),_0x28c18a[_0xe379('0x28')]);return _0x48c462(_0x28c18a);}searchContact(_0x5d83e8,_0x48212a,'work_number',_0x28c18a[_0xe379('0x26')])[_0xe379('0xe')](function(_0x139253){if(_0x139253){_0x28c18a[_0xe379('0x28')]=_0x139253['id'];logger[_0xe379('0xc')](_0xe379('0x2a'),_0x28c18a[_0xe379('0x28')]);return _0x48c462(_0x28c18a);}createEndUser(_0x28c18a,_0x22fab3,_0x48212a,_0x5d83e8)[_0xe379('0xe')](function(_0x9da2c5){logger['info']('Contact\x20created:',_0x9da2c5[_0xe379('0x28')]);return _0x48c462(_0x9da2c5);});});})[_0xe379('0x1e')](function(_0x1bdc7e){_0x418b05(_0x1bdc7e);});});};}function createEndUser(_0x2bc233,_0x322735,_0x119621,_0x23489d){return new Promise(function(_0x261d15,_0x5b986){var _0x57538e=moment();var _0x34d20e={'method':_0xe379('0x2b'),'uri':_0x23489d+_0xe379('0x2c'),'body':{'contact':{'last_name':_0x2bc233[_0xe379('0x26')],'work_number':_0x2bc233[_0xe379('0x26')],'mobile_number':_0x2bc233[_0xe379('0x26')],'owner_id':_0x2bc233[_0xe379('0x1a')],'created_at':_0x57538e[_0xe379('0x24')](_0xe379('0x2d'))}},'json':!![]};_0x34d20e['headers']=_0x119621;logger[_0xe379('0xc')](_0xe379('0x2e'));return rp(_0x34d20e)[_0xe379('0xe')](function(_0x15403c){_0x2bc233[_0xe379('0x28')]=_0x15403c['contact']['id'];_0x261d15(_0x2bc233);})[_0xe379('0x1e')](function(_0x43bc55){logger[_0xe379('0x2f')]('['+[_0x322735['toUpperCase']()]+']',_0x43bc55[_0xe379('0x15')]);_0x5b986(_0x43bc55[_0xe379('0x15')]);});});}function getTicket(_0x1250af,_0x1c40b1,_0x14d884,_0x13a983,_0x471156){return function(_0xa85aae){logger[_0xe379('0xc')](_0xe379('0x30'));return new Promise(function(_0x57d16b,_0x238593){var _0x37dd5b=moment();var _0x4d1754={'method':_0xe379('0x2b'),'uri':_0x14d884+'/api/tasks','body':{'title':intUtil['getString'](_0x13a983[_0xe379('0x31')],_0x471156,'\x20'),'description':intUtil[_0xe379('0x32')](_0x13a983[_0xe379('0x33')],_0x471156,'\x0a'),'owner_id':_0xa85aae[_0xe379('0x1a')],'creater_id':_0xa85aae['adminId'],'targetable_id':_0xa85aae[_0xe379('0x28')],'targetable_type':_0xe379('0x34'),'created_at':_0x37dd5b[_0xe379('0x24')](_0xe379('0x2d')),'due_date':_0x37dd5b[_0xe379('0x35')](0x1e,'m')[_0xe379('0x24')](_0xe379('0x2d'))},'json':!![]};_0x4d1754['headers']=_0x1c40b1;return rp(_0x4d1754)[_0xe379('0xe')](function(_0x12c562){_0xa85aae[_0xe379('0x36')]=_0x12c562['task']['id'];logger[_0xe379('0xc')](_0xe379('0x37'),_0xa85aae['ticketId']);_0x57d16b(_0xa85aae);})[_0xe379('0x1e')](function(_0xce8edd){logger[_0xe379('0x2f')]('['+[_0x1250af[_0xe379('0x14')]()]+']',_0xce8edd[_0xe379('0x15')]);_0x238593(_0xce8edd[_0xe379('0x15')]);});});};}function emit(_0x25eb5f,_0x43a7db,_0x3afbb7){var _0x422608={'uri':_0x25eb5f+_0xe379('0x38')+_0x3afbb7};io['to'](util[_0xe379('0x24')](_0xe379('0x39'),_0x43a7db))['emit'](_0xe379('0x3a'),_0x422608);}exports['cs']=function(_0x53a8bc,_0xfa9a50,_0x4454d8,_0x247cce,_0x345792,_0x1c29b4,_0x2926e9,_0x2fb7e6){var _0x566eea={};var _0x427532={'Authorization':_0xe379('0x3b')+_0x1c29b4[_0xe379('0x3c')]};_0x1c29b4['remoteUri']=intUtil[_0xe379('0x3d')](_0x1c29b4[_0xe379('0x3e')]);_0x1c29b4[_0xe379('0x3f')]=intUtil[_0xe379('0x3d')](_0x1c29b4[_0xe379('0x3f')]);var _0x52cf4a=_0x1c29b4['remoteUri'];_0x566eea[_0xe379('0x1d')]=_0x1c29b4[_0xe379('0x40')];_0x566eea[_0xe379('0x26')]=_0x2fb7e6[_0xe379('0x41')]()===_0xe379('0x42')?_0xfa9a50[_0xe379('0x43')]:_0xfa9a50['calleridnum'];_0x566eea[_0xe379('0x44')]=_0x2fb7e6===_0xe379('0x45')||_0x2fb7e6===_0xe379('0x46')?_0xe379('0x45'):_0xe379('0x42');if(_0x247cce){_0x566eea[_0xe379('0x18')]=_0x247cce[_0xe379('0x10')];}var _0x3d5967=util[_0xe379('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c29b4[_0xe379('0x3f')],_0xfa9a50[_0xe379('0x47')],md5(_0xfa9a50[_0xe379('0x47')]));if(_0x345792&&_0x345792[_0xe379('0x48')]){logger[_0xe379('0xc')](_0xe379('0x49'),_0xe379('0x4a'));_0xfa9a50[_0xe379('0x4b')]=_0x3d5967;}else if(_0x2926e9&&_0x2926e9[_0xe379('0x4c')]&&_0x2926e9[_0xe379('0x4c')]!==_0xe379('0x4d')){logger[_0xe379('0xc')](_0xe379('0x4e'),_0xe379('0x4a'));_0xfa9a50[_0xe379('0x4b')]=_0x3d5967;}else{_0xfa9a50['recordingURL']='';}return getAdminId(_0x566eea,_0x2fb7e6,_0x427532,_0x52cf4a)['then'](getUser(_0x2fb7e6,_0x427532,_0x52cf4a))[_0xe379('0xe')](getEndUser(_0x2fb7e6,_0x427532,_0x52cf4a))['then'](getTicket(_0x2fb7e6,_0x427532,_0x52cf4a,_0x4454d8,_0xfa9a50))[_0xe379('0xe')](function(_0x58ad41){logger[_0xe379('0xc')](util[_0xe379('0x24')](_0xe379('0x4f'),_0x58ad41[_0xe379('0x36')]));if(_0x2fb7e6!=='unmanaged'){logger[_0xe379('0xc')]('['+[_0x2fb7e6[_0xe379('0x14')]()]+']',_0xe379('0x50'));emit(_0x52cf4a,_0x247cce[_0xe379('0x51')],_0x58ad41[_0xe379('0x28')]);}})['catch'](function(_0x4207ee){logger[_0xe379('0x2f')]('['+[_0x2fb7e6['toUpperCase']()]+_0xe379('0x52'),util[_0xe379('0x53')](_0x4207ee,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcc18=['work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','GET','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcc18,0xd8));var _0x8cc1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xcc18[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x8cc1('0x0'));var rp=require(_0x8cc1('0x1'));var md5=require(_0x8cc1('0x2'));var util=require(_0x8cc1('0x3'));var moment=require(_0x8cc1('0x4'));var Promise=require(_0x8cc1('0x5'));var Redis=require(_0x8cc1('0x6'));var intUtil=require(_0x8cc1('0x7'));var config=require(_0x8cc1('0x8'));var logger=require('../../../../config/logger')(_0x8cc1('0x9'));config['redis']=_[_0x8cc1('0xa')](config['redis'],{'host':_0x8cc1('0xb'),'port':0x18eb});var io=require(_0x8cc1('0xc'))(new Redis(config['redis']));function getAdminId(_0x5d6c16,_0x2b83bc,_0x168df3,_0x205226){return new Promise(function(_0x32f226,_0x36cac3){var _0x287381=![];var _0x5f2799={'method':'GET','uri':_0x205226+_0x8cc1('0xd'),'json':!![]};_0x5f2799[_0x8cc1('0xe')]=_0x168df3;logger['info'](_0x8cc1('0xf'));return rp(_0x5f2799)[_0x8cc1('0x10')](function(_0x3d8718){if(_0x3d8718){var _0x37ff5b=_0x3d8718[_0x8cc1('0x11')];var _0x4a5721=null;for(_0x4a5721=0x0;_0x4a5721<_0x37ff5b['length'];_0x4a5721++){if(_0x37ff5b[_0x4a5721][_0x8cc1('0x12')]===_0x5d6c16['adminEmail']){_0x5d6c16[_0x8cc1('0x13')]=_0x37ff5b[_0x4a5721]['id'];_0x287381=!![];}}if(_0x287381){logger[_0x8cc1('0x14')]('Admin\x20found:',_0x5d6c16[_0x8cc1('0x13')]);_0x32f226(_0x5d6c16);}else{_0x36cac3({'statusCode':0x194,'message':_0x8cc1('0x15')});}}else{_0x36cac3({'statusCode':0x194,'message':_0x8cc1('0x15')});}})[_0x8cc1('0x16')](function(_0x217d00){logger[_0x8cc1('0x17')]('['+[_0x2b83bc[_0x8cc1('0x18')]()]+']',_0x217d00[_0x8cc1('0x19')]);_0x36cac3(_0x217d00);});});}function getUser(_0x3c3158,_0x2a682e,_0x1dbf97){return function(_0x380bf3){return new Promise(function(_0x519223,_0x4cddb8){var _0x3fd414={'method':'GET','uri':_0x1dbf97+'/api/selector/owners','json':!![]};_0x3fd414['headers']=_0x2a682e;logger[_0x8cc1('0x14')](_0x8cc1('0x1a'));return rp(_0x3fd414)[_0x8cc1('0x10')](function(_0x412e4f){if(_0x412e4f){var _0x5ab306=_0x412e4f[_0x8cc1('0x11')];var _0x54c2=![];var _0x5c6910=null;if(_0x380bf3['agentEmail']!==null){logger[_0x8cc1('0x14')](_0x8cc1('0x1b'),_0x380bf3[_0x8cc1('0x1c')]);_0x380bf3[_0x8cc1('0x1d')]=_0x380bf3[_0x8cc1('0x1c')];for(_0x5c6910=0x0;_0x5c6910<_0x5ab306[_0x8cc1('0x1e')];_0x5c6910++){if(_0x5ab306[_0x5c6910]['email']===_0x380bf3['agentEmail']){_0x54c2=!![];_0x380bf3[_0x8cc1('0x1f')]=_0x5ab306[_0x5c6910]['id'];logger['info'](_0x8cc1('0x20'),_0x380bf3['userId']);}}}if(!_0x54c2){logger[_0x8cc1('0x14')](_0x8cc1('0x21'));_0x380bf3[_0x8cc1('0x1d')]=_0x380bf3['adminEmail'];_0x380bf3[_0x8cc1('0x1f')]=_0x380bf3[_0x8cc1('0x13')];_0x54c2=!![];}if(_0x54c2){_0x519223(_0x380bf3);}else{_0x4cddb8({'statusCode':0x194,'message':_0x8cc1('0x15')});}}else{_0x4cddb8({'statusCode':0x194,'message':_0x8cc1('0x15')});}})['catch'](function(_0x508e54){logger[_0x8cc1('0x17')]('['+[_0x3c3158[_0x8cc1('0x18')]()]+']',_0x508e54['message']);_0x4cddb8(_0x508e54);});});};}function searchContact(_0xa2805f,_0x435723,_0x213e9f,_0x16a832){return new Promise(function(_0x5d3c1a,_0x10f843){var _0x2b077f={'method':_0x8cc1('0x22'),'headers':_0x435723,'uri':_0xa2805f+_0x8cc1('0x23')+_0x16a832+_0x8cc1('0x24')+_0x213e9f+'&entities=contact','json':!![]};rp(_0x2b077f)[_0x8cc1('0x10')](function(_0x4fe5f9){var _0x1eba6a=_[_0x8cc1('0x25')](_0x4fe5f9[_0x8cc1('0x26')]['contacts'],[_0x213e9f,_0x16a832]);_0x5d3c1a(_0x1eba6a);})['catch'](function(_0x4ef270){_0x10f843(_0x4ef270);});});}function getEndUser(_0x111e28,_0x3989e1,_0x16fa38){return function(_0x4b9c86){return new Promise(function(_0x482d4f,_0x2a52f8){logger[_0x8cc1('0x14')](util[_0x8cc1('0x27')](_0x8cc1('0x28'),_0x4b9c86[_0x8cc1('0x29')]));searchContact(_0x16fa38,_0x3989e1,_0x8cc1('0x2a'),_0x4b9c86[_0x8cc1('0x29')])['then'](function(_0x5d43f8){if(_0x5d43f8){_0x4b9c86[_0x8cc1('0x2b')]=_0x5d43f8['id'];logger[_0x8cc1('0x14')](_0x8cc1('0x2c'),_0x4b9c86[_0x8cc1('0x2b')]);return _0x482d4f(_0x4b9c86);}searchContact(_0x16fa38,_0x3989e1,_0x8cc1('0x2d'),_0x4b9c86[_0x8cc1('0x29')])[_0x8cc1('0x10')](function(_0x40434c){if(_0x40434c){_0x4b9c86[_0x8cc1('0x2b')]=_0x40434c['id'];logger['info'](_0x8cc1('0x2e'),_0x4b9c86[_0x8cc1('0x2b')]);return _0x482d4f(_0x4b9c86);}createEndUser(_0x4b9c86,_0x111e28,_0x3989e1,_0x16fa38)[_0x8cc1('0x10')](function(_0x3d5a7a){logger['info'](_0x8cc1('0x2f'),_0x3d5a7a[_0x8cc1('0x2b')]);return _0x482d4f(_0x3d5a7a);});});})[_0x8cc1('0x16')](function(_0x2338e4){_0x2a52f8(_0x2338e4);});});};}function createEndUser(_0x66aacf,_0x53670e,_0x4d898c,_0x1f1598){return new Promise(function(_0x23dee1,_0x43b6aa){var _0x52ced3=moment();var _0x3eba6f={'method':_0x8cc1('0x30'),'uri':_0x1f1598+_0x8cc1('0x31'),'body':{'contact':{'last_name':_0x66aacf[_0x8cc1('0x29')],'work_number':_0x66aacf[_0x8cc1('0x29')],'mobile_number':_0x66aacf[_0x8cc1('0x29')],'owner_id':_0x66aacf['userId'],'created_at':_0x52ced3[_0x8cc1('0x27')](_0x8cc1('0x32'))}},'json':!![]};_0x3eba6f[_0x8cc1('0xe')]=_0x4d898c;logger[_0x8cc1('0x14')](_0x8cc1('0x33'));return rp(_0x3eba6f)['then'](function(_0x36fc57){_0x66aacf[_0x8cc1('0x2b')]=_0x36fc57['contact']['id'];_0x23dee1(_0x66aacf);})[_0x8cc1('0x16')](function(_0x20b2f8){logger[_0x8cc1('0x17')]('['+[_0x53670e[_0x8cc1('0x18')]()]+']',_0x20b2f8[_0x8cc1('0x19')]);_0x43b6aa(_0x20b2f8[_0x8cc1('0x19')]);});});}function getTicket(_0x511d4c,_0x501581,_0x20cf78,_0x35f355,_0x182ce8){return function(_0x3a0f9f){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x272469,_0x379878){var _0x393311=moment();var _0x5dbabc={'method':_0x8cc1('0x30'),'uri':_0x20cf78+_0x8cc1('0x34'),'body':{'title':intUtil[_0x8cc1('0x35')](_0x35f355[_0x8cc1('0x36')],_0x182ce8,'\x20'),'description':intUtil['getString'](_0x35f355[_0x8cc1('0x37')],_0x182ce8,'\x0a'),'owner_id':_0x3a0f9f[_0x8cc1('0x1f')],'creater_id':_0x3a0f9f[_0x8cc1('0x13')],'targetable_id':_0x3a0f9f[_0x8cc1('0x2b')],'targetable_type':_0x8cc1('0x38'),'created_at':_0x393311[_0x8cc1('0x27')](_0x8cc1('0x32')),'due_date':_0x393311[_0x8cc1('0x39')](0x1e,'m')['format'](_0x8cc1('0x32'))},'json':!![]};_0x5dbabc['headers']=_0x501581;return rp(_0x5dbabc)[_0x8cc1('0x10')](function(_0x366ae3){_0x3a0f9f[_0x8cc1('0x3a')]=_0x366ae3[_0x8cc1('0x3b')]['id'];logger['info'](_0x8cc1('0x3c'),_0x3a0f9f[_0x8cc1('0x3a')]);_0x272469(_0x3a0f9f);})[_0x8cc1('0x16')](function(_0x5798fa){logger[_0x8cc1('0x17')]('['+[_0x511d4c[_0x8cc1('0x18')]()]+']',_0x5798fa[_0x8cc1('0x19')]);_0x379878(_0x5798fa[_0x8cc1('0x19')]);});});};}function emit(_0xd88874,_0x4f0b26,_0x2a1348){var _0x245db7={'uri':_0xd88874+'/contacts/'+_0x2a1348};io['to'](util[_0x8cc1('0x27')](_0x8cc1('0x3d'),_0x4f0b26))[_0x8cc1('0x3e')](_0x8cc1('0x3f'),_0x245db7);}exports['cs']=function(_0x157e94,_0x5a7768,_0x5bb625,_0x569fd0,_0x3d9811,_0x84f604,_0x4c8814,_0x4c6a86){var _0x2256b0={};var _0x5f42ad={'Authorization':_0x8cc1('0x40')+_0x84f604[_0x8cc1('0x41')]};_0x84f604[_0x8cc1('0x42')]=intUtil[_0x8cc1('0x43')](_0x84f604[_0x8cc1('0x42')]);_0x84f604[_0x8cc1('0x44')]=intUtil[_0x8cc1('0x43')](_0x84f604[_0x8cc1('0x44')]);var _0x3b6032=_0x84f604[_0x8cc1('0x42')];_0x2256b0['adminEmail']=_0x84f604[_0x8cc1('0x45')];_0x2256b0[_0x8cc1('0x29')]=_0x4c6a86[_0x8cc1('0x46')]()===_0x8cc1('0x47')?_0x5a7768[_0x8cc1('0x48')]:_0x5a7768['calleridnum'];_0x2256b0[_0x8cc1('0x49')]=_0x4c6a86===_0x8cc1('0x4a')||_0x4c6a86===_0x8cc1('0x4b')?_0x8cc1('0x4a'):_0x8cc1('0x47');if(_0x569fd0){_0x2256b0[_0x8cc1('0x1c')]=_0x569fd0[_0x8cc1('0x12')];}var _0x25e501=util[_0x8cc1('0x27')](_0x8cc1('0x4c'),_0x84f604[_0x8cc1('0x44')],_0x5a7768[_0x8cc1('0x4d')],md5(_0x5a7768[_0x8cc1('0x4d')]));if(_0x3d9811&&_0x3d9811[_0x8cc1('0x4e')]){logger[_0x8cc1('0x14')](_0x8cc1('0x4f'),'Recording\x20is\x20enabled!');_0x5a7768[_0x8cc1('0x50')]=_0x25e501;}else if(_0x4c8814&&_0x4c8814[_0x8cc1('0x51')]&&_0x4c8814[_0x8cc1('0x51')]!==_0x8cc1('0x52')){logger[_0x8cc1('0x14')](_0x8cc1('0x53'),_0x8cc1('0x54'));_0x5a7768[_0x8cc1('0x50')]=_0x25e501;}else{_0x5a7768[_0x8cc1('0x50')]='';}return getAdminId(_0x2256b0,_0x4c6a86,_0x5f42ad,_0x3b6032)[_0x8cc1('0x10')](getUser(_0x4c6a86,_0x5f42ad,_0x3b6032))[_0x8cc1('0x10')](getEndUser(_0x4c6a86,_0x5f42ad,_0x3b6032))['then'](getTicket(_0x4c6a86,_0x5f42ad,_0x3b6032,_0x5bb625,_0x5a7768))[_0x8cc1('0x10')](function(_0x440347){logger[_0x8cc1('0x14')](util[_0x8cc1('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x440347[_0x8cc1('0x3a')]));if(_0x4c6a86!=='unmanaged'){logger[_0x8cc1('0x14')]('['+[_0x4c6a86[_0x8cc1('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3b6032,_0x569fd0['name'],_0x440347[_0x8cc1('0x2b')]);}})[_0x8cc1('0x16')](function(_0x4d5bd9){logger[_0x8cc1('0x17')]('['+[_0x4c6a86[_0x8cc1('0x18')]()]+_0x8cc1('0x55'),util[_0x8cc1('0x56')](_0x4d5bd9,{'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 6f8256f..0c84ff5 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 _0x2e22=['log','EVENT\x20UNKNOWN','zendesk','freshdesk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','format','data3','error','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','salesforce','sugarcrm','zoho','desk','freshsales','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound'];(function(_0x2d24e2,_0x38c3af){var _0x330f61=function(_0x15c233){while(--_0x15c233){_0x2d24e2['push'](_0x2d24e2['shift']());}};_0x330f61(++_0x38c3af);}(_0x2e22,0x199));var _0x22e2=function(_0x4e85f2,_0x1cf40b){_0x4e85f2=_0x4e85f2-0x0;var _0x3ac183=_0x2e22[_0x4e85f2];return _0x3ac183;};'use strict';var _=require(_0x22e2('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x22e2('0x1'));var sugarcrm=require(_0x22e2('0x2'));var freshdesk=require(_0x22e2('0x3'));var zoho=require(_0x22e2('0x4'));var desk=require('./desk');var vtiger=require(_0x22e2('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x22e2('0x6'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x22e2('0x7'),_0x22e2('0x8'),'freshdesk',_0x22e2('0x9'),_0x22e2('0xa'),'vtiger','dynamics365',_0x22e2('0xb'),'servicenow'];exports['exec']=function(_0x5bd816,_0x4cfce3,_0x4a7d7e,_0x3e3de2,_0x32b249,_0x1ec652){if(_0x4a7d7e){if(_['includes'](integrations,_0x5bd816[_0x22e2('0xc')][_0x22e2('0xd')]())){try{var _0x5918c2=null;var _0x2ad92d='';var _0x5528fe=_0x4a7d7e[_0x5bd816[_0x22e2('0xc')][_0x22e2('0xd')]()];if(_0x5528fe){var _0x3e026c=_0x5528fe[_0x5bd816[_0x22e2('0xe')]];if(_0x3e026c){var _0x33f245=_[_0x22e2('0xf')](_0x3e026c[_0x22e2('0x10')],{'id':parseInt(_0x5bd816['data3'],0xa)});if(_0x33f245){if(_0x3e3de2){if(_0x32b249&&_0x4cfce3[_0x22e2('0x11')]){_0x2ad92d='queue';}else if(_0x4cfce3[_0x22e2('0x12')]){_0x2ad92d=_0x22e2('0x13');}else{console[_0x22e2('0x14')](_0x22e2('0x15'),_0x4cfce3);}}else{_0x2ad92d='unmanaged';}switch(_0x5bd816['data1']['toLowerCase']()){case _0x22e2('0x16'):zendesk[_0x2ad92d](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652);break;case _0x22e2('0x7'):salesforce[_0x2ad92d](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652);break;case _0x22e2('0x8'):sugarcrm[_0x2ad92d](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652);break;case _0x22e2('0x17'):freshdesk[_0x2ad92d](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652);break;case _0x22e2('0x9'):zoho[_0x2ad92d](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652);break;case'desk':desk[_0x2ad92d](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652);break;case _0x22e2('0x18'):vtiger[_0x2ad92d](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652);break;case _0x22e2('0xb'):freshsales['cs'](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652,_0x2ad92d);break;case'servicenow':servicenow['cs'](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652,_0x2ad92d);break;case _0x22e2('0x19'):dynamics365['cs'](_0x5bd816,_0x4cfce3,_0x33f245,_0x3e3de2,_0x32b249,_0x3e026c,_0x1ec652,_0x2ad92d);break;default:console[_0x22e2('0x14')](_0x22e2('0x1a'));}}else{_0x5918c2=require(_0x22e2('0x1b'))(_0x5bd816['data1'][_0x22e2('0xd')]());_0x5918c2['error'](_0x22e2('0x1c'),util[_0x22e2('0x1d')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5bd816[_0x22e2('0xc')][_0x22e2('0xd')](),_0x5bd816[_0x22e2('0x1e')]));}}else{_0x5918c2=require(_0x22e2('0x1b'))(_0x5bd816[_0x22e2('0xc')]['toLowerCase']());_0x5918c2[_0x22e2('0x1f')](_0x22e2('0x1c'),util[_0x22e2('0x1d')](_0x22e2('0x20'),_0x5bd816[_0x22e2('0xc')][_0x22e2('0xd')](),_0x5bd816[_0x22e2('0xe')]));}}else{}}catch(_0x3acb33){console['error'](_0x3acb33);}}}}; \ No newline at end of file +var _0xc7ed=['dynamics365','../../../../config/logger','%s\x20configuration\x20#%s\x20not\x20found','error','format','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','zendesk','sugarcrm','desk','vtiger','servicenow','data1','toLowerCase','data2','find','Configurations','data3','outbound','log','EVENT\x20UNKNOWN','salesforce','zoho','freshsales'];(function(_0x379ff0,_0x44bdbe){var _0x3d4fee=function(_0x5aa04d){while(--_0x5aa04d){_0x379ff0['push'](_0x379ff0['shift']());}};_0x3d4fee(++_0x44bdbe);}(_0xc7ed,0xd7));var _0xdc7e=function(_0x11f418,_0x16283a){_0x11f418=_0x11f418-0x0;var _0x5d7f70=_0xc7ed[_0x11f418];return _0x5d7f70;};'use strict';var _=require('lodash');var util=require(_0xdc7e('0x0'));var zendesk=require(_0xdc7e('0x1'));var salesforce=require(_0xdc7e('0x2'));var sugarcrm=require(_0xdc7e('0x3'));var freshdesk=require(_0xdc7e('0x4'));var zoho=require(_0xdc7e('0x5'));var desk=require(_0xdc7e('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xdc7e('0x7'));var freshsales=require('./freshsales');var integrations=[_0xdc7e('0x8'),'salesforce',_0xdc7e('0x9'),'freshdesk','zoho',_0xdc7e('0xa'),_0xdc7e('0xb'),'dynamics365','freshsales',_0xdc7e('0xc')];exports['exec']=function(_0x2a988d,_0x5dacc5,_0x2ebae4,_0x3b00a8,_0x132376,_0x3cf01f){if(_0x2ebae4){if(_['includes'](integrations,_0x2a988d[_0xdc7e('0xd')]['toLowerCase']())){try{var _0x3db560=null;var _0x5d3297='';var _0x5a0b32=_0x2ebae4[_0x2a988d[_0xdc7e('0xd')][_0xdc7e('0xe')]()];if(_0x5a0b32){var _0x5ccd81=_0x5a0b32[_0x2a988d[_0xdc7e('0xf')]];if(_0x5ccd81){var _0x12b97b=_[_0xdc7e('0x10')](_0x5ccd81[_0xdc7e('0x11')],{'id':parseInt(_0x2a988d[_0xdc7e('0x12')],0xa)});if(_0x12b97b){if(_0x3b00a8){if(_0x132376&&_0x5dacc5['queue']){_0x5d3297='queue';}else if(_0x5dacc5['routeId']){_0x5d3297=_0xdc7e('0x13');}else{console[_0xdc7e('0x14')](_0xdc7e('0x15'),_0x5dacc5);}}else{_0x5d3297='unmanaged';}switch(_0x2a988d[_0xdc7e('0xd')][_0xdc7e('0xe')]()){case _0xdc7e('0x8'):zendesk[_0x5d3297](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f);break;case _0xdc7e('0x16'):salesforce[_0x5d3297](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f);break;case _0xdc7e('0x9'):sugarcrm[_0x5d3297](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f);break;case'freshdesk':freshdesk[_0x5d3297](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f);break;case _0xdc7e('0x17'):zoho[_0x5d3297](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f);break;case _0xdc7e('0xa'):desk[_0x5d3297](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f);break;case'vtiger':vtiger[_0x5d3297](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f);break;case _0xdc7e('0x18'):freshsales['cs'](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f,_0x5d3297);break;case _0xdc7e('0xc'):servicenow['cs'](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f,_0x5d3297);break;case _0xdc7e('0x19'):dynamics365['cs'](_0x2a988d,_0x5dacc5,_0x12b97b,_0x3b00a8,_0x132376,_0x5ccd81,_0x3cf01f,_0x5d3297);break;default:console[_0xdc7e('0x14')]('unknown\x20integration');}}else{_0x3db560=require(_0xdc7e('0x1a'))(_0x2a988d[_0xdc7e('0xd')][_0xdc7e('0xe')]());_0x3db560['error']('[EXEC]',util['format'](_0xdc7e('0x1b'),_0x2a988d[_0xdc7e('0xd')][_0xdc7e('0xe')](),_0x2a988d['data3']));}}else{_0x3db560=require(_0xdc7e('0x1a'))(_0x2a988d[_0xdc7e('0xd')][_0xdc7e('0xe')]());_0x3db560[_0xdc7e('0x1c')]('[EXEC]',util[_0xdc7e('0x1d')]('%s\x20account\x20#%s\x20not\x20found',_0x2a988d[_0xdc7e('0xd')][_0xdc7e('0xe')](),_0x2a988d[_0xdc7e('0xf')]));}}else{}}catch(_0x546fc4){console[_0xdc7e('0x1c')](_0x546fc4);}}}}; \ 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 5223617..c54676f 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 _0xdbc7=['additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Contact','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','','upperFirst','forEach','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','contact','endUserType','lead','account','WhatId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep'];(function(_0x3fde0a,_0x4606bb){var _0x3e4ae2=function(_0x21b466){while(--_0x21b466){_0x3fde0a['push'](_0x3fde0a['shift']());}};_0x3e4ae2(++_0x4606bb);}(_0xdbc7,0xcc));var _0x7dbc=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0xdbc7[_0x4c2f30];return _0xb8854d;};'use strict';var _=require(_0x7dbc('0x0'));var rp=require(_0x7dbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x7dbc('0x2'));var jsforce=require(_0x7dbc('0x3'));var util=require(_0x7dbc('0x4'));var Redis=require('ioredis');var intUtil=require(_0x7dbc('0x5'));var config=require(_0x7dbc('0x6'));var logger=require(_0x7dbc('0x7'))(_0x7dbc('0x8'));config['redis']=_[_0x7dbc('0x9')](config[_0x7dbc('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7dbc('0xa')]));function emit(_0x294c2d,_0x450be5,_0x1d3686){io['to'](_0x294c2d)[_0x7dbc('0xb')](_0x450be5,_0x1d3686);}function getTicket(_0x3a4b6e,_0x58d68f,_0x269067,_0x29699f,_0x28c2db,_0x35cd6c,_0x2430ff,_0x407ff2){var _0x480c7d=Object['assign']({},{'OwnerId':_0x58d68f['id'],'Subject':intUtil[_0x7dbc('0xc')](_0x29699f[_0x7dbc('0xd')],_0x28c2db,'\x20'),'Description':intUtil[_0x7dbc('0xc')](_0x29699f[_0x7dbc('0xe')],_0x28c2db,'\x0a')},getCustomFields(_0x35cd6c,_0x28c2db));if(_0x269067){if(_0x29699f[_0x7dbc('0xf')]===_0x7dbc('0x10')){_0x480c7d[_0x7dbc('0x11')]=moment[_0x7dbc('0x12')]();_0x480c7d[_0x7dbc('0x13')]=![];_0x480c7d['IsRecurrence']=![];if(_0x269067['endUserType']===_0x7dbc('0x14')||_0x269067[_0x7dbc('0x15')]===_0x7dbc('0x16')){_0x480c7d['WhoId']=_0x269067['id'];}else if(_0x269067[_0x7dbc('0x15')]===_0x7dbc('0x17')){_0x480c7d[_0x7dbc('0x18')]=_0x269067['id'];}}else if(_0x29699f['ticketType']==='Case'){if(_0x269067[_0x7dbc('0x15')]==='contact'){_0x480c7d['ContactId']=_0x269067['id'];}else if(_0x269067[_0x7dbc('0x15')]==='account'){_0x480c7d[_0x7dbc('0x19')]=_0x269067['id'];}else if(_0x269067['endUserType']===_0x7dbc('0x16')&&_0x29699f[_0x7dbc('0x1a')]){_0x480c7d[_0x29699f[_0x7dbc('0x1a')]]=_0x269067['id'];}else{logger[_0x7dbc('0x1b')](_0x7dbc('0x1c'));}}}return _0x2430ff[_0x7dbc('0x1d')](_0x29699f[_0x7dbc('0xf')])[_0x7dbc('0x1e')](_0x480c7d);}function getUser(_0x2fb52c,_0x101e80,_0x2e8866){if(!_[_0x7dbc('0x1f')](_0x101e80)&&intUtil[_0x7dbc('0x20')](_0x101e80)){var _0xf1b639={'Email':_0x101e80};var _0x2a4217={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2e8866['sobject'](_0x7dbc('0x21'))[_0x7dbc('0x22')](_0xf1b639,_0x2a4217)[_0x7dbc('0x23')]()[_0x7dbc('0x24')](function(_0x239f43){if(_0x239f43[_0x7dbc('0x25')]){var _0x5e13cb=_[_0x7dbc('0x22')](_0x239f43,function(_0xaa15d8){return _0xaa15d8['Email']===_0x101e80;});if(_0x5e13cb){logger[_0x7dbc('0x1b')](_0x7dbc('0x26'),_0x101e80);return BPromise['resolve']({'id':_0x5e13cb['Id'],'name':_0x5e13cb[_0x7dbc('0x27')]});}}else{logger[_0x7dbc('0x1b')](_0x7dbc('0x28'),_0x101e80);return _0x2e8866[_0x7dbc('0x29')]()[_0x7dbc('0x24')](function(_0x5920d7){return BPromise[_0x7dbc('0x2a')]({'id':_0x5920d7[_0x7dbc('0x2b')],'name':_0x5920d7[_0x7dbc('0x2c')]});});}});}else{logger[_0x7dbc('0x1b')](_0x7dbc('0x28'),_0x101e80);return _0x2e8866[_0x7dbc('0x29')]()['then'](function(_0x14485f){return BPromise['resolve']({'id':_0x14485f[_0x7dbc('0x2b')],'name':_0x14485f[_0x7dbc('0x2c')]});});}}function getEndUser(_0x2cc5ea,_0x2a1ddd,_0x54318a,_0xed66a7,_0x4eb843){var _0x6ea192={'$or':{'Phone':_0xed66a7}};var _0x153eec={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7dbc('0x2a')]()['then'](function(){logger[_0x7dbc('0x1b')](_0x7dbc('0x2d'),_0xed66a7,_0x2a1ddd[_0x7dbc('0x2e')]);switch(_0x2a1ddd['moduleSearch']){case'contact_lead':var _0x22e310=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd[_0x7dbc('0x30')]){var _0x415798={};_0x415798[_0x2a1ddd[_0x7dbc('0x30')]]=_0xed66a7;_[_0x7dbc('0x31')](_0x22e310[_0x7dbc('0x32')],_0x415798);}return _0x4eb843['sobject']('Contact')[_0x7dbc('0x22')](_0x22e310,_0x153eec)['execute']()[_0x7dbc('0x24')](function(_0x1d3ebd){if(_0x1d3ebd&&_0x1d3ebd['length']){return _0x1d3ebd;}else{var _0x5467e1=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd['additionalSearchLead']){var _0x508742={};_0x508742[_0x2a1ddd[_0x7dbc('0x33')]]=_0xed66a7;_[_0x7dbc('0x31')](_0x5467e1[_0x7dbc('0x32')],_0x508742);}return _0x4eb843[_0x7dbc('0x1d')](_0x7dbc('0x34'))['find'](_0x5467e1,_0x153eec);}});case _0x7dbc('0x35'):var _0x240af6=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd[_0x7dbc('0x36')]){var _0x415798={};_0x415798[_0x2a1ddd[_0x7dbc('0x36')]]=_0xed66a7;_[_0x7dbc('0x31')](_0x240af6[_0x7dbc('0x32')],_0x415798);}return _0x4eb843[_0x7dbc('0x1d')]('Account')[_0x7dbc('0x22')](_0x240af6,_0x153eec)[_0x7dbc('0x23')]()[_0x7dbc('0x24')](function(_0x133bc0){if(_0x133bc0&&_0x133bc0[_0x7dbc('0x25')]){return _0x133bc0;}else{var _0x3881d1=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd['additionalSearchContact']){var _0x1af731={};_0x1af731[_0x2a1ddd[_0x7dbc('0x30')]]=_0xed66a7;_[_0x7dbc('0x31')](_0x3881d1[_0x7dbc('0x32')],_0x1af731);}return _0x4eb843['sobject'](_0x7dbc('0x37'))[_0x7dbc('0x22')](_0x3881d1,_0x153eec)[_0x7dbc('0x24')](function(_0x5ba9fe){if(_0x5ba9fe&&_0x5ba9fe[_0x7dbc('0x25')]){return _0x5ba9fe;}else{var _0x173130=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd['additionalSearchLead']){var _0x4db926={};_0x4db926[_0x2a1ddd['additionalSearchLead']]=_0xed66a7;_[_0x7dbc('0x31')](_0x173130['$or'],_0x4db926);}return _0x4eb843[_0x7dbc('0x1d')](_0x7dbc('0x34'))[_0x7dbc('0x22')](_0x173130,_0x153eec);}});}});case _0x7dbc('0x14'):var _0x22e310=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd[_0x7dbc('0x30')]){var _0x415798={};_0x415798[_0x2a1ddd[_0x7dbc('0x30')]]=_0xed66a7;_[_0x7dbc('0x31')](_0x22e310[_0x7dbc('0x32')],_0x415798);}return _0x4eb843[_0x7dbc('0x1d')]('Contact')[_0x7dbc('0x22')](_0x22e310,_0x153eec)[_0x7dbc('0x23')]();case _0x7dbc('0x16'):var _0x2ba5f5=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd['additionalSearchLead']){var _0x415798={};_0x415798[_0x2a1ddd['additionalSearchLead']]=_0xed66a7;_[_0x7dbc('0x31')](_0x2ba5f5[_0x7dbc('0x32')],_0x415798);}return _0x4eb843[_0x7dbc('0x1d')](_0x7dbc('0x34'))[_0x7dbc('0x22')](_0x2ba5f5,_0x153eec);case'account':var _0x240af6=_[_0x7dbc('0x2f')](_0x6ea192);if(_0x2a1ddd[_0x7dbc('0x36')]){var _0x415798={};_0x415798[_0x2a1ddd['additionalSearchAccount']]=_0xed66a7;_[_0x7dbc('0x31')](_0x240af6['$or'],_0x415798);}return _0x4eb843[_0x7dbc('0x1d')]('Account')['find'](_0x240af6,_0x153eec);default:return null;}})['then'](function(_0xadbeac){if(_0xadbeac&&_0xadbeac[_0x7dbc('0x25')]){var _0x2dbded=_[_0x7dbc('0x38')](_0xadbeac);if(_0x2dbded){return BPromise[_0x7dbc('0x2a')]({'id':_0x2dbded['Id'],'name':_0x2dbded['Name'],'phone':_0x2dbded['Phone'],'endUserType':_0x2dbded[_0x7dbc('0x39')]['type'][_0x7dbc('0x3a')]()});}}})[_0x7dbc('0x24')](function(_0x7c14a7){if(_0x7c14a7){logger[_0x7dbc('0x1b')](_0x7dbc('0x3b'),_0x7c14a7[_0x7dbc('0x15')],_0xed66a7);return BPromise[_0x7dbc('0x2a')](_0x7c14a7);}else{logger[_0x7dbc('0x1b')](_0x7dbc('0x3c'),_0xed66a7);var _0x34e6e0={'Phone':_0xed66a7};if(_0x2a1ddd[_0x7dbc('0x3d')]){if(_0x2a1ddd[_0x7dbc('0x3d')]==='contact'){logger['info'](_0x7dbc('0x3e'),_0xed66a7,_0x2a1ddd[_0x7dbc('0x3d')]);_0x34e6e0[_0x7dbc('0x3f')]=_0x54318a!==''?_0x54318a:util[_0x7dbc('0x40')](_0x7dbc('0x41'),_0xed66a7);}else if(_0x2a1ddd['moduleCreate']===_0x7dbc('0x16')){logger[_0x7dbc('0x1b')](_0x7dbc('0x3e'),_0xed66a7,_0x2a1ddd['moduleCreate']);_0x34e6e0[_0x7dbc('0x3f')]=_0x54318a!==''?_0x54318a:util['format'](_0x7dbc('0x41'),_0xed66a7);_0x34e6e0[_0x7dbc('0x42')]=_0x7dbc('0x43');}else if(_0x2a1ddd[_0x7dbc('0x3d')]===_0x7dbc('0x17')){logger['info'](_0x7dbc('0x3e'),_0xed66a7,_0x2a1ddd[_0x7dbc('0x3d')]);_0x34e6e0[_0x7dbc('0x27')]=_0x54318a!==_0x7dbc('0x44')?_0x54318a:util[_0x7dbc('0x40')]('Caller\x20-\x20%s',_0xed66a7);}else{return null;}}return _0x4eb843[_0x7dbc('0x1d')](_[_0x7dbc('0x45')](_0x2a1ddd[_0x7dbc('0x3d')]))[_0x7dbc('0x1e')](_0x34e6e0)[_0x7dbc('0x24')](function(_0x2d534b){return BPromise[_0x7dbc('0x2a')]({'id':_0x2d534b['id'],'endUserType':_0x2a1ddd['moduleCreate']});});}});}function getCustomFields(_0x19d369,_0x3dc175){var _0x2dafae={};if(_0x19d369[_0x7dbc('0x25')]>0x0){_[_0x7dbc('0x46')](_0x19d369,function(_0x24a16d){if(_[_0x7dbc('0x47')](['string',_0x7dbc('0x48')],_0x24a16d[_0x7dbc('0x49')])&&_0x24a16d[_0x7dbc('0x4a')]){_0x2dafae[_0x24a16d[_0x7dbc('0x4a')]]=_0x24a16d['content'][_0x7dbc('0x4b')]();}else if(_0x24a16d[_0x7dbc('0x49')]===_0x7dbc('0x4c')&&_0x24a16d[_0x7dbc('0x4d')]&&_0x24a16d[_0x7dbc('0x4a')]){_0x3dc175[_0x24a16d[_0x7dbc('0x4d')]]&&(_0x2dafae[_0x24a16d[_0x7dbc('0x4a')]]=_0x3dc175[_0x24a16d[_0x7dbc('0x4d')]]['toString']());}else if(_0x24a16d[_0x7dbc('0x49')]===_0x7dbc('0x4e')&&_0x24a16d[_0x7dbc('0x4f')]&&_0x24a16d['Variable'][_0x7dbc('0x50')]&&_0x24a16d[_0x7dbc('0x4a')]){_0x3dc175[_0x24a16d[_0x7dbc('0x4f')][_0x7dbc('0x50')][_0x7dbc('0x3a')]()]&&(_0x2dafae[_0x24a16d[_0x7dbc('0x4a')]]=_0x3dc175[_0x24a16d[_0x7dbc('0x4f')][_0x7dbc('0x50')][_0x7dbc('0x3a')]()][_0x7dbc('0x4b')]());}});}return _0x2dafae;}function getConnection(_0x45bcda){var _0x444ca3=_0x45bcda[_0x7dbc('0x51')][_0x7dbc('0x52')](_0x45bcda[_0x7dbc('0x53')]);var _0x5e7ff3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x45bcda[_0x7dbc('0x54')]||_0x7dbc('0x55'),'clientId':_0x45bcda[_0x7dbc('0x56')],'clientSecret':_0x45bcda[_0x7dbc('0x57')]}});return _0x5e7ff3[_0x7dbc('0x58')](_0x45bcda[_0x7dbc('0x59')],_0x444ca3)[_0x7dbc('0x24')](function(){logger[_0x7dbc('0x1b')](_0x7dbc('0x5a'));return _0x5e7ff3;});}exports['queue']=function(_0x5945a1,_0xbe5c8d,_0xd251d0,_0x17e80f,_0x22d986,_0x2adec9){var _0x3a29d6,_0x35cca5,_0x5b89cd,_0x5b5c0d;_0x2adec9[_0x7dbc('0x5b')]=intUtil[_0x7dbc('0x5c')](_0x2adec9[_0x7dbc('0x5b')]);_0x2adec9[_0x7dbc('0x54')]=intUtil[_0x7dbc('0x5c')](_0x2adec9[_0x7dbc('0x54')]);if(_0x22d986&&_0x22d986[_0x7dbc('0x5d')]){logger[_0x7dbc('0x1b')](_0x7dbc('0x5e'),_0x7dbc('0x5f'));_0xbe5c8d[_0x7dbc('0x60')]=util['format'](_0x7dbc('0x61'),_0x2adec9[_0x7dbc('0x5b')],_0xbe5c8d[_0x7dbc('0x62')],md5(_0xbe5c8d['uniqueid']));}else{_0xbe5c8d[_0x7dbc('0x60')]='';}return getConnection(_0x2adec9)[_0x7dbc('0x24')](function(_0x29e38a){_0x5b5c0d=_0x29e38a;return getUser(_0x2adec9,_0x17e80f[_0x7dbc('0x63')],_0x5b5c0d);})[_0x7dbc('0x24')](function(_0x46bf11){_0x3a29d6=_0x46bf11;return getEndUser(_0x2adec9,_0xd251d0,_0xbe5c8d[_0x7dbc('0x64')],_0xbe5c8d[_0x7dbc('0x65')],_0x5b5c0d);})['then'](function(_0x557a44){_0x35cca5=_0x557a44;return getTicket(_0x2adec9,_0x3a29d6,_0x35cca5,_0xd251d0,_0xbe5c8d,_0xd251d0[_0x7dbc('0x66')],_0x5b5c0d,_0x7dbc('0x67'));})['then'](function(_0x27c621){_0x5b89cd=_0x27c621;logger[_0x7dbc('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x5b89cd['id']);logger[_0x7dbc('0x1b')](_0x7dbc('0x68'),_0x5b89cd['id'],_0x17e80f[_0x7dbc('0x50')],_0x2adec9[_0x7dbc('0x49')]);switch(_0x2adec9[_0x7dbc('0x49')]){case _0x7dbc('0x69'):emit(util[_0x7dbc('0x40')](_0x7dbc('0x6a'),_0x17e80f[_0x7dbc('0x50')]),'trigger:salesforce:display',{'recordId':_0x5b89cd['id']});break;case _0x7dbc('0x6b'):emit(util[_0x7dbc('0x40')]('user:%s',_0x17e80f[_0x7dbc('0x50')]),_0x7dbc('0x6c'),{'uri':util[_0x7dbc('0x40')]('%s/%s/e',_0x5b5c0d[_0x7dbc('0x6d')],_0x5b89cd['id'])});break;default:logger[_0x7dbc('0x6e')](_0x7dbc('0x6f'));}})[_0x7dbc('0x70')](function(_0x1bd48e){logger[_0x7dbc('0x6e')](_0x7dbc('0x5e'),_0x1bd48e);});};exports[_0x7dbc('0x71')]=function(_0xe38c80,_0x256922,_0x525654,_0x5dcaf2,_0x3c8ede,_0x561e80,_0x45d991){var _0x4bfb9d,_0x3b0002,_0x588bf0,_0x43a117;_0x561e80['serverUrl']=intUtil[_0x7dbc('0x5c')](_0x561e80[_0x7dbc('0x5b')]);_0x561e80[_0x7dbc('0x54')]=intUtil[_0x7dbc('0x5c')](_0x561e80[_0x7dbc('0x54')]);if(_0x45d991&&_0x45d991['recordingFormat']&&_0x45d991[_0x7dbc('0x72')]!==_0x7dbc('0x73')){logger[_0x7dbc('0x1b')](_0x7dbc('0x74'),_0x7dbc('0x5f'));_0x256922[_0x7dbc('0x60')]=util[_0x7dbc('0x40')](_0x7dbc('0x61'),_0x561e80[_0x7dbc('0x5b')],_0x256922['uniqueid'],md5(_0x256922[_0x7dbc('0x62')]));}return getConnection(_0x561e80)[_0x7dbc('0x24')](function(_0x46eab7){_0x43a117=_0x46eab7;return getUser(_0x561e80,_0x5dcaf2[_0x7dbc('0x63')],_0x43a117);})['then'](function(_0x581b34){_0x4bfb9d=_0x581b34;return getEndUser(_0x561e80,_0x525654,_0x256922[_0x7dbc('0x75')],_0x256922['destcalleridnum'],_0x43a117);})[_0x7dbc('0x24')](function(_0x1c1f49){_0x3b0002=_0x1c1f49;return getTicket(_0x561e80,_0x4bfb9d,_0x3b0002,_0x525654,_0x256922,_0x525654['Fields'],_0x43a117,_0x7dbc('0x71'));})[_0x7dbc('0x24')](function(_0x22db2f){_0x588bf0=_0x22db2f;logger[_0x7dbc('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x588bf0['id']);logger[_0x7dbc('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x588bf0['id'],_0x5dcaf2['name'],_0x561e80[_0x7dbc('0x49')]);switch(_0x561e80[_0x7dbc('0x49')]){case _0x7dbc('0x69'):emit(util['format'](_0x7dbc('0x6a'),_0x5dcaf2[_0x7dbc('0x50')]),_0x7dbc('0x76'),{'recordId':_0x588bf0['id']});break;case'newTab':emit(util[_0x7dbc('0x40')]('user:%s',_0x5dcaf2[_0x7dbc('0x50')]),_0x7dbc('0x6c'),{'uri':util[_0x7dbc('0x40')](_0x7dbc('0x77'),_0x43a117[_0x7dbc('0x6d')],_0x588bf0['id'])});break;default:logger[_0x7dbc('0x6e')](_0x7dbc('0x74'),_0x7dbc('0x78'));}})['catch'](function(_0x1dfe43){logger[_0x7dbc('0x6e')]('[OUTBOUND]',_0x1dfe43);});};exports[_0x7dbc('0x79')]=function(_0x9fce53,_0x5ca2e1,_0x48b9b,_0x2347c1,_0x1b71ab,_0x4000e7){var _0x57974b,_0x39814a,_0x52f46e,_0x229fa1;_0x4000e7[_0x7dbc('0x5b')]=intUtil[_0x7dbc('0x5c')](_0x4000e7[_0x7dbc('0x5b')]);_0x4000e7[_0x7dbc('0x54')]=intUtil[_0x7dbc('0x5c')](_0x4000e7[_0x7dbc('0x54')]);if(_0x1b71ab&&_0x1b71ab['monitor_format']){logger['info']('['+_0x5ca2e1[_0x7dbc('0x7a')][_0x7dbc('0x7b')]()+']',_0x7dbc('0x5f'));_0x5ca2e1[_0x7dbc('0x60')]=util[_0x7dbc('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4000e7['serverUrl'],_0x5ca2e1['uniqueid'],md5(_0x5ca2e1[_0x7dbc('0x62')]));}else{_0x5ca2e1['recordingURL']='';}return getConnection(_0x4000e7)[_0x7dbc('0x24')](function(_0x2ed0d7){_0x229fa1=_0x2ed0d7;if(!_[_0x7dbc('0x1f')](_0x2347c1)){return getUser(_0x4000e7,_0x2347c1[_0x7dbc('0x50')],_0x229fa1);}else{return getUser(_0x4000e7,null,_0x229fa1);}})[_0x7dbc('0x24')](function(_0x3f9c98){_0x57974b=_0x3f9c98;return getEndUser(_0x4000e7,_0x48b9b,_0x5ca2e1[_0x7dbc('0x64')],_0x5ca2e1[_0x7dbc('0x65')],_0x229fa1);})['then'](function(_0x111bdf){_0x39814a=_0x111bdf;return getTicket(_0x4000e7,_0x57974b,_0x39814a,_0x48b9b,_0x5ca2e1,_0x48b9b[_0x7dbc('0x66')],_0x229fa1);})[_0x7dbc('0x24')](function(_0x4f4b1b){_0x52f46e=_0x4f4b1b;logger['info']('['+_0x5ca2e1[_0x7dbc('0x7a')][_0x7dbc('0x7b')]()+_0x7dbc('0x7c'),_0x52f46e['id']);logger[_0x7dbc('0x1b')]('['+_0x5ca2e1['lastevent']['toUpperCase']()+_0x7dbc('0x7d'),_0x4000e7[_0x7dbc('0x49')]);})['catch'](function(_0x1ff4cd){logger[_0x7dbc('0x6e')]('['+_0x5ca2e1['lastevent'][_0x7dbc('0x7b')]()+']',_0x1ff4cd);});}; \ No newline at end of file +var _0xc5cb=['Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','lead','WhoId','endUserType','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','then','length','find','Email','Agent\x20%s\x20found.','identity','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','emit','getString','Subjects','ticketType'];(function(_0x3f6758,_0x5912a7){var _0x5d5064=function(_0x5546ac){while(--_0x5546ac){_0x3f6758['push'](_0x3f6758['shift']());}};_0x5d5064(++_0x5912a7);}(_0xc5cb,0x1ee));var _0xbc5c=function(_0x1a474d,_0x35b2d2){_0x1a474d=_0x1a474d-0x0;var _0x48b7a6=_0xc5cb[_0x1a474d];return _0x48b7a6;};'use strict';var _=require('lodash');var rp=require(_0xbc5c('0x0'));var moment=require('moment');var BPromise=require(_0xbc5c('0x1'));var md5=require(_0xbc5c('0x2'));var jsforce=require(_0xbc5c('0x3'));var util=require(_0xbc5c('0x4'));var Redis=require(_0xbc5c('0x5'));var intUtil=require(_0xbc5c('0x6'));var config=require(_0xbc5c('0x7'));var logger=require('../../../../config/logger')(_0xbc5c('0x8'));config[_0xbc5c('0x9')]=_['defaults'](config[_0xbc5c('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbc5c('0x9')]));function emit(_0x3ac354,_0x15b324,_0x54df97){io['to'](_0x3ac354)[_0xbc5c('0xa')](_0x15b324,_0x54df97);}function getTicket(_0x526d4d,_0x503c3a,_0x12d282,_0x203eb8,_0x11bfc3,_0x373928,_0x36b61a,_0x58293c){var _0x36154a=Object['assign']({},{'OwnerId':_0x503c3a['id'],'Subject':intUtil[_0xbc5c('0xb')](_0x203eb8[_0xbc5c('0xc')],_0x11bfc3,'\x20'),'Description':intUtil['getString'](_0x203eb8['Descriptions'],_0x11bfc3,'\x0a')},getCustomFields(_0x373928,_0x11bfc3));if(_0x12d282){if(_0x203eb8[_0xbc5c('0xd')]===_0xbc5c('0xe')){_0x36154a[_0xbc5c('0xf')]=moment[_0xbc5c('0x10')]();_0x36154a[_0xbc5c('0x11')]=![];_0x36154a[_0xbc5c('0x12')]=![];if(_0x12d282['endUserType']===_0xbc5c('0x13')||_0x12d282['endUserType']===_0xbc5c('0x14')){_0x36154a[_0xbc5c('0x15')]=_0x12d282['id'];}else if(_0x12d282[_0xbc5c('0x16')]===_0xbc5c('0x17')){_0x36154a[_0xbc5c('0x18')]=_0x12d282['id'];}}else if(_0x203eb8[_0xbc5c('0xd')]==='Case'){if(_0x12d282[_0xbc5c('0x16')]==='contact'){_0x36154a[_0xbc5c('0x19')]=_0x12d282['id'];}else if(_0x12d282['endUserType']===_0xbc5c('0x17')){_0x36154a[_0xbc5c('0x1a')]=_0x12d282['id'];}else if(_0x12d282[_0xbc5c('0x16')]===_0xbc5c('0x14')&&_0x203eb8[_0xbc5c('0x1b')]){_0x36154a[_0x203eb8['leadId']]=_0x12d282['id'];}else{logger[_0xbc5c('0x1c')](_0xbc5c('0x1d'));}}}return _0x36b61a[_0xbc5c('0x1e')](_0x203eb8[_0xbc5c('0xd')])[_0xbc5c('0x1f')](_0x36154a);}function getUser(_0x3273b5,_0x25e7ee,_0x15401b){if(!_['isNil'](_0x25e7ee)&&intUtil[_0xbc5c('0x20')](_0x25e7ee)){var _0xa44cfb={'Email':_0x25e7ee};var _0x23e0fc={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x15401b['sobject']('User')['find'](_0xa44cfb,_0x23e0fc)['execute']()[_0xbc5c('0x21')](function(_0x386cc3){if(_0x386cc3[_0xbc5c('0x22')]){var _0x2a3597=_[_0xbc5c('0x23')](_0x386cc3,function(_0xd2ae81){return _0xd2ae81[_0xbc5c('0x24')]===_0x25e7ee;});if(_0x2a3597){logger[_0xbc5c('0x1c')](_0xbc5c('0x25'),_0x25e7ee);return BPromise['resolve']({'id':_0x2a3597['Id'],'name':_0x2a3597['Name']});}}else{logger[_0xbc5c('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x25e7ee);return _0x15401b[_0xbc5c('0x26')]()[_0xbc5c('0x21')](function(_0x125714){return BPromise[_0xbc5c('0x27')]({'id':_0x125714[_0xbc5c('0x28')],'name':_0x125714[_0xbc5c('0x29')]});});}});}else{logger[_0xbc5c('0x1c')](_0xbc5c('0x2a'),_0x25e7ee);return _0x15401b['identity']()['then'](function(_0xa1494e){return BPromise[_0xbc5c('0x27')]({'id':_0xa1494e[_0xbc5c('0x28')],'name':_0xa1494e[_0xbc5c('0x29')]});});}}function getEndUser(_0x4823b5,_0x501849,_0x561900,_0x1939fe,_0x208d78){var _0x847ae5={'$or':{'Phone':_0x1939fe}};var _0x581263={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xbc5c('0x21')](function(){logger[_0xbc5c('0x1c')](_0xbc5c('0x2b'),_0x1939fe,_0x501849[_0xbc5c('0x2c')]);switch(_0x501849['moduleSearch']){case _0xbc5c('0x2d'):var _0x7130bd=_[_0xbc5c('0x2e')](_0x847ae5);if(_0x501849[_0xbc5c('0x2f')]){var _0x63b744={};_0x63b744[_0x501849[_0xbc5c('0x2f')]]=_0x1939fe;_[_0xbc5c('0x30')](_0x7130bd['$or'],_0x63b744);}return _0x208d78['sobject'](_0xbc5c('0x31'))[_0xbc5c('0x23')](_0x7130bd,_0x581263)[_0xbc5c('0x32')]()[_0xbc5c('0x21')](function(_0x3a62f3){if(_0x3a62f3&&_0x3a62f3[_0xbc5c('0x22')]){return _0x3a62f3;}else{var _0xebcd36=_[_0xbc5c('0x2e')](_0x847ae5);if(_0x501849[_0xbc5c('0x33')]){var _0x137ed4={};_0x137ed4[_0x501849['additionalSearchLead']]=_0x1939fe;_[_0xbc5c('0x30')](_0xebcd36[_0xbc5c('0x34')],_0x137ed4);}return _0x208d78[_0xbc5c('0x1e')](_0xbc5c('0x35'))['find'](_0xebcd36,_0x581263);}});case _0xbc5c('0x36'):var _0x8de075=_[_0xbc5c('0x2e')](_0x847ae5);if(_0x501849[_0xbc5c('0x37')]){var _0x63b744={};_0x63b744[_0x501849['additionalSearchAccount']]=_0x1939fe;_[_0xbc5c('0x30')](_0x8de075[_0xbc5c('0x34')],_0x63b744);}return _0x208d78[_0xbc5c('0x1e')](_0xbc5c('0x38'))[_0xbc5c('0x23')](_0x8de075,_0x581263)[_0xbc5c('0x32')]()[_0xbc5c('0x21')](function(_0x58e9a3){if(_0x58e9a3&&_0x58e9a3[_0xbc5c('0x22')]){return _0x58e9a3;}else{var _0x320239=_['cloneDeep'](_0x847ae5);if(_0x501849[_0xbc5c('0x2f')]){var _0x4e0446={};_0x4e0446[_0x501849['additionalSearchContact']]=_0x1939fe;_[_0xbc5c('0x30')](_0x320239['$or'],_0x4e0446);}return _0x208d78[_0xbc5c('0x1e')](_0xbc5c('0x31'))[_0xbc5c('0x23')](_0x320239,_0x581263)[_0xbc5c('0x21')](function(_0x317495){if(_0x317495&&_0x317495['length']){return _0x317495;}else{var _0xa82e3b=_[_0xbc5c('0x2e')](_0x847ae5);if(_0x501849['additionalSearchLead']){var _0x354c21={};_0x354c21[_0x501849['additionalSearchLead']]=_0x1939fe;_[_0xbc5c('0x30')](_0xa82e3b[_0xbc5c('0x34')],_0x354c21);}return _0x208d78[_0xbc5c('0x1e')]('Lead')[_0xbc5c('0x23')](_0xa82e3b,_0x581263);}});}});case _0xbc5c('0x13'):var _0x7130bd=_['cloneDeep'](_0x847ae5);if(_0x501849[_0xbc5c('0x2f')]){var _0x63b744={};_0x63b744[_0x501849['additionalSearchContact']]=_0x1939fe;_[_0xbc5c('0x30')](_0x7130bd['$or'],_0x63b744);}return _0x208d78[_0xbc5c('0x1e')]('Contact')['find'](_0x7130bd,_0x581263)[_0xbc5c('0x32')]();case _0xbc5c('0x14'):var _0x289340=_['cloneDeep'](_0x847ae5);if(_0x501849[_0xbc5c('0x33')]){var _0x63b744={};_0x63b744[_0x501849[_0xbc5c('0x33')]]=_0x1939fe;_['merge'](_0x289340['$or'],_0x63b744);}return _0x208d78[_0xbc5c('0x1e')](_0xbc5c('0x35'))[_0xbc5c('0x23')](_0x289340,_0x581263);case _0xbc5c('0x17'):var _0x8de075=_[_0xbc5c('0x2e')](_0x847ae5);if(_0x501849['additionalSearchAccount']){var _0x63b744={};_0x63b744[_0x501849[_0xbc5c('0x37')]]=_0x1939fe;_[_0xbc5c('0x30')](_0x8de075[_0xbc5c('0x34')],_0x63b744);}return _0x208d78[_0xbc5c('0x1e')]('Account')['find'](_0x8de075,_0x581263);default:return null;}})['then'](function(_0x3df3d9){if(_0x3df3d9&&_0x3df3d9[_0xbc5c('0x22')]){var _0x40f875=_['first'](_0x3df3d9);if(_0x40f875){return BPromise['resolve']({'id':_0x40f875['Id'],'name':_0x40f875[_0xbc5c('0x39')],'phone':_0x40f875[_0xbc5c('0x3a')],'endUserType':_0x40f875[_0xbc5c('0x3b')][_0xbc5c('0x3c')][_0xbc5c('0x3d')]()});}}})[_0xbc5c('0x21')](function(_0x5b3e8f){if(_0x5b3e8f){logger[_0xbc5c('0x1c')](_0xbc5c('0x3e'),_0x5b3e8f[_0xbc5c('0x16')],_0x1939fe);return BPromise[_0xbc5c('0x27')](_0x5b3e8f);}else{logger['info'](_0xbc5c('0x3f'),_0x1939fe);var _0x416960={'Phone':_0x1939fe};if(_0x501849[_0xbc5c('0x40')]){if(_0x501849['moduleCreate']===_0xbc5c('0x13')){logger[_0xbc5c('0x1c')](_0xbc5c('0x41'),_0x1939fe,_0x501849[_0xbc5c('0x40')]);_0x416960[_0xbc5c('0x42')]=_0x561900!==_0xbc5c('0x43')?_0x561900:util[_0xbc5c('0x44')](_0xbc5c('0x45'),_0x1939fe);}else if(_0x501849[_0xbc5c('0x40')]===_0xbc5c('0x14')){logger[_0xbc5c('0x1c')](_0xbc5c('0x41'),_0x1939fe,_0x501849[_0xbc5c('0x40')]);_0x416960[_0xbc5c('0x42')]=_0x561900!==_0xbc5c('0x43')?_0x561900:util[_0xbc5c('0x44')](_0xbc5c('0x45'),_0x1939fe);_0x416960['Company']='No\x20Company';}else if(_0x501849[_0xbc5c('0x40')]===_0xbc5c('0x17')){logger[_0xbc5c('0x1c')](_0xbc5c('0x41'),_0x1939fe,_0x501849[_0xbc5c('0x40')]);_0x416960['Name']=_0x561900!==''?_0x561900:util['format']('Caller\x20-\x20%s',_0x1939fe);}else{return null;}}return _0x208d78['sobject'](_[_0xbc5c('0x46')](_0x501849[_0xbc5c('0x40')]))['create'](_0x416960)[_0xbc5c('0x21')](function(_0x3e5b64){return BPromise[_0xbc5c('0x27')]({'id':_0x3e5b64['id'],'endUserType':_0x501849['moduleCreate']});});}});}function getCustomFields(_0x543e2e,_0x1c962d){var _0x8e91a7={};if(_0x543e2e['length']>0x0){_['forEach'](_0x543e2e,function(_0x120411){if(_[_0xbc5c('0x47')]([_0xbc5c('0x48'),'picklist'],_0x120411[_0xbc5c('0x3c')])&&_0x120411[_0xbc5c('0x49')]){_0x8e91a7[_0x120411['idField']]=_0x120411[_0xbc5c('0x4a')][_0xbc5c('0x4b')]();}else if(_0x120411['type']===_0xbc5c('0x4c')&&_0x120411[_0xbc5c('0x4d')]&&_0x120411[_0xbc5c('0x49')]){_0x1c962d[_0x120411[_0xbc5c('0x4d')]]&&(_0x8e91a7[_0x120411[_0xbc5c('0x49')]]=_0x1c962d[_0x120411[_0xbc5c('0x4d')]][_0xbc5c('0x4b')]());}else if(_0x120411[_0xbc5c('0x3c')]===_0xbc5c('0x4e')&&_0x120411[_0xbc5c('0x4f')]&&_0x120411['Variable'][_0xbc5c('0x50')]&&_0x120411[_0xbc5c('0x49')]){_0x1c962d[_0x120411['Variable'][_0xbc5c('0x50')]['toLowerCase']()]&&(_0x8e91a7[_0x120411['idField']]=_0x1c962d[_0x120411[_0xbc5c('0x4f')][_0xbc5c('0x50')][_0xbc5c('0x3d')]()][_0xbc5c('0x4b')]());}});}return _0x8e91a7;}function getConnection(_0x377fae){var _0x21b9af=_0x377fae[_0xbc5c('0x51')][_0xbc5c('0x52')](_0x377fae[_0xbc5c('0x53')]);var _0x9c909b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x377fae['remoteUri']||_0xbc5c('0x54'),'clientId':_0x377fae[_0xbc5c('0x55')],'clientSecret':_0x377fae[_0xbc5c('0x56')]}});return _0x9c909b[_0xbc5c('0x57')](_0x377fae[_0xbc5c('0x58')],_0x21b9af)[_0xbc5c('0x21')](function(){logger[_0xbc5c('0x1c')]('Connection\x20established.');return _0x9c909b;});}exports[_0xbc5c('0x59')]=function(_0xd90415,_0x24a855,_0x462d00,_0xf7163,_0x4a284d,_0x4ee90c){var _0x128fa5,_0x179eb3,_0x3a00ff,_0x364752;_0x4ee90c[_0xbc5c('0x5a')]=intUtil[_0xbc5c('0x5b')](_0x4ee90c['serverUrl']);_0x4ee90c[_0xbc5c('0x5c')]=intUtil[_0xbc5c('0x5b')](_0x4ee90c['remoteUri']);if(_0x4a284d&&_0x4a284d[_0xbc5c('0x5d')]){logger[_0xbc5c('0x1c')](_0xbc5c('0x5e'),'Recording\x20is\x20enabled!');_0x24a855[_0xbc5c('0x5f')]=util[_0xbc5c('0x44')](_0xbc5c('0x60'),_0x4ee90c['serverUrl'],_0x24a855['uniqueid'],md5(_0x24a855[_0xbc5c('0x61')]));}else{_0x24a855['recordingURL']='';}return getConnection(_0x4ee90c)['then'](function(_0x1745dd){_0x364752=_0x1745dd;return getUser(_0x4ee90c,_0xf7163[_0xbc5c('0x62')],_0x364752);})[_0xbc5c('0x21')](function(_0x13e99e){_0x128fa5=_0x13e99e;return getEndUser(_0x4ee90c,_0x462d00,_0x24a855[_0xbc5c('0x63')],_0x24a855[_0xbc5c('0x64')],_0x364752);})['then'](function(_0x36c921){_0x179eb3=_0x36c921;return getTicket(_0x4ee90c,_0x128fa5,_0x179eb3,_0x462d00,_0x24a855,_0x462d00['Fields'],_0x364752,_0xbc5c('0x59'));})[_0xbc5c('0x21')](function(_0x1bbfa){_0x3a00ff=_0x1bbfa;logger[_0xbc5c('0x1c')](_0xbc5c('0x65'),_0x3a00ff['id']);logger['info'](_0xbc5c('0x66'),_0x3a00ff['id'],_0xf7163[_0xbc5c('0x50')],_0x4ee90c[_0xbc5c('0x3c')]);switch(_0x4ee90c[_0xbc5c('0x3c')]){case _0xbc5c('0x67'):emit(util[_0xbc5c('0x44')](_0xbc5c('0x68'),_0xf7163[_0xbc5c('0x50')]),'trigger:salesforce:display',{'recordId':_0x3a00ff['id']});break;case _0xbc5c('0x69'):emit(util[_0xbc5c('0x44')](_0xbc5c('0x68'),_0xf7163[_0xbc5c('0x50')]),_0xbc5c('0x6a'),{'uri':util[_0xbc5c('0x44')](_0xbc5c('0x6b'),_0x364752[_0xbc5c('0x6c')],_0x3a00ff['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xbc5c('0x6d')](function(_0x56c122){logger[_0xbc5c('0x6e')](_0xbc5c('0x5e'),_0x56c122);});};exports[_0xbc5c('0x6f')]=function(_0x6724d8,_0x2ee1be,_0x1fdb74,_0x1a7d3c,_0x731949,_0x329681,_0x3fae8b){var _0x3269ae,_0x25dfde,_0x492292,_0x12d680;_0x329681[_0xbc5c('0x5a')]=intUtil[_0xbc5c('0x5b')](_0x329681[_0xbc5c('0x5a')]);_0x329681['remoteUri']=intUtil[_0xbc5c('0x5b')](_0x329681[_0xbc5c('0x5c')]);if(_0x3fae8b&&_0x3fae8b[_0xbc5c('0x70')]&&_0x3fae8b[_0xbc5c('0x70')]!==_0xbc5c('0x71')){logger[_0xbc5c('0x1c')](_0xbc5c('0x72'),_0xbc5c('0x73'));_0x2ee1be[_0xbc5c('0x5f')]=util[_0xbc5c('0x44')](_0xbc5c('0x60'),_0x329681[_0xbc5c('0x5a')],_0x2ee1be[_0xbc5c('0x61')],md5(_0x2ee1be[_0xbc5c('0x61')]));}return getConnection(_0x329681)[_0xbc5c('0x21')](function(_0x104fa6){_0x12d680=_0x104fa6;return getUser(_0x329681,_0x1a7d3c[_0xbc5c('0x62')],_0x12d680);})[_0xbc5c('0x21')](function(_0x70c3b9){_0x3269ae=_0x70c3b9;return getEndUser(_0x329681,_0x1fdb74,_0x2ee1be[_0xbc5c('0x74')],_0x2ee1be[_0xbc5c('0x75')],_0x12d680);})[_0xbc5c('0x21')](function(_0x245ce8){_0x25dfde=_0x245ce8;return getTicket(_0x329681,_0x3269ae,_0x25dfde,_0x1fdb74,_0x2ee1be,_0x1fdb74[_0xbc5c('0x76')],_0x12d680,_0xbc5c('0x6f'));})[_0xbc5c('0x21')](function(_0x5a1d77){_0x492292=_0x5a1d77;logger[_0xbc5c('0x1c')](_0xbc5c('0x77'),_0x492292['id']);logger[_0xbc5c('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x492292['id'],_0x1a7d3c[_0xbc5c('0x50')],_0x329681[_0xbc5c('0x3c')]);switch(_0x329681[_0xbc5c('0x3c')]){case _0xbc5c('0x67'):emit(util[_0xbc5c('0x44')](_0xbc5c('0x68'),_0x1a7d3c[_0xbc5c('0x50')]),_0xbc5c('0x78'),{'recordId':_0x492292['id']});break;case _0xbc5c('0x69'):emit(util[_0xbc5c('0x44')](_0xbc5c('0x68'),_0x1a7d3c['name']),_0xbc5c('0x6a'),{'uri':util[_0xbc5c('0x44')]('%s/%s/e',_0x12d680[_0xbc5c('0x6c')],_0x492292['id'])});break;default:logger[_0xbc5c('0x6e')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x16c46c){logger['error']('[OUTBOUND]',_0x16c46c);});};exports[_0xbc5c('0x79')]=function(_0x5c624b,_0x330f96,_0x89b925,_0x1ce0b0,_0x2464bb,_0x446dfd){var _0x4fd22b,_0x1f0a6,_0x9d8628,_0x2bf888;_0x446dfd[_0xbc5c('0x5a')]=intUtil[_0xbc5c('0x5b')](_0x446dfd[_0xbc5c('0x5a')]);_0x446dfd[_0xbc5c('0x5c')]=intUtil['stripTrailingSlash'](_0x446dfd['remoteUri']);if(_0x2464bb&&_0x2464bb[_0xbc5c('0x5d')]){logger['info']('['+_0x330f96[_0xbc5c('0x7a')][_0xbc5c('0x7b')]()+']',_0xbc5c('0x73'));_0x330f96[_0xbc5c('0x5f')]=util[_0xbc5c('0x44')](_0xbc5c('0x60'),_0x446dfd[_0xbc5c('0x5a')],_0x330f96[_0xbc5c('0x61')],md5(_0x330f96[_0xbc5c('0x61')]));}else{_0x330f96[_0xbc5c('0x5f')]='';}return getConnection(_0x446dfd)['then'](function(_0x1f6d6c){_0x2bf888=_0x1f6d6c;if(!_[_0xbc5c('0x7c')](_0x1ce0b0)){return getUser(_0x446dfd,_0x1ce0b0[_0xbc5c('0x50')],_0x2bf888);}else{return getUser(_0x446dfd,null,_0x2bf888);}})[_0xbc5c('0x21')](function(_0x33ad93){_0x4fd22b=_0x33ad93;return getEndUser(_0x446dfd,_0x89b925,_0x330f96[_0xbc5c('0x63')],_0x330f96['calleridnum'],_0x2bf888);})['then'](function(_0x4848aa){_0x1f0a6=_0x4848aa;return getTicket(_0x446dfd,_0x4fd22b,_0x1f0a6,_0x89b925,_0x330f96,_0x89b925['Fields'],_0x2bf888);})[_0xbc5c('0x21')](function(_0x1c5521){_0x9d8628=_0x1c5521;logger[_0xbc5c('0x1c')]('['+_0x330f96[_0xbc5c('0x7a')][_0xbc5c('0x7b')]()+_0xbc5c('0x7d'),_0x9d8628['id']);logger[_0xbc5c('0x1c')]('['+_0x330f96['lastevent'][_0xbc5c('0x7b')]()+_0xbc5c('0x7e'),_0x446dfd[_0xbc5c('0x3c')]);})['catch'](function(_0x326c3c){logger[_0xbc5c('0x6e')]('['+_0x330f96[_0xbc5c('0x7a')][_0xbc5c('0x7b')]()+']',_0x326c3c);});}; \ 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 e10365e..3a5f4e3 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 _0xbae9=['destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','GET','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','active','true','adminEmail','],\x20getUser\x20crm','userId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','error','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email'];(function(_0x4db942,_0x1674bb){var _0x3af92e=function(_0x315c31){while(--_0x315c31){_0x4db942['push'](_0x4db942['shift']());}};_0x3af92e(++_0x1674bb);}(_0xbae9,0xf0));var _0x9bae=function(_0x3bcf9e,_0x148a5d){_0x3bcf9e=_0x3bcf9e-0x0;var _0x1bb37c=_0xbae9[_0x3bcf9e];return _0x1bb37c;};'use strict';var _=require(_0x9bae('0x0'));var Promise=require(_0x9bae('0x1'));var rp=require(_0x9bae('0x2'));var util=require(_0x9bae('0x3'));var md5=require(_0x9bae('0x4'));var Redis=require(_0x9bae('0x5'));var intUtil=require(_0x9bae('0x6'));var config=require(_0x9bae('0x7'));var logger=require(_0x9bae('0x8'))(_0x9bae('0x9'));config[_0x9bae('0xa')]=_['defaults'](config['redis'],{'host':_0x9bae('0xb'),'port':0x18eb});var io=require(_0x9bae('0xc'))(new Redis(config['redis']));function getAdminUser(_0x1766d8,_0x1ad8eb,_0x562d99,_0x326bff,_0x56260c,_0x120349){return new Promise(function(_0x1ffe56,_0x344660){var _0x4e66d4={'method':'GET','uri':_0x326bff+_0x9bae('0xd')+'&'+_0x56260c+'&'+_0x120349,'auth':_0x1ad8eb,'json':!![]};return rp(_0x4e66d4)[_0x9bae('0xe')](function(_0x2bd37e){if(_0x2bd37e[_0x9bae('0xf')][_0x9bae('0x10')]>0x0){_0x562d99[_0x9bae('0x11')]=_0x2bd37e[_0x9bae('0xf')][0x0][_0x9bae('0x12')];}logger['info']('['+[_0x1766d8[_0x9bae('0x13')]()]+_0x9bae('0x14'),_0x562d99);_0x1ffe56(_0x562d99);})[_0x9bae('0x15')](function(_0x243a4a){logger['error']('['+[_0x1766d8[_0x9bae('0x13')]()]+']',_0x243a4a['message']);_0x344660(_0x243a4a[_0x9bae('0x16')]);});});}function getUser(_0x19a62c,_0x4371af,_0x5cc1a3,_0x3b02bb,_0x39cdd2){return function(_0x1b8c07){logger[_0x9bae('0x17')]('['+[_0x19a62c[_0x9bae('0x13')]()]+_0x9bae('0x18'),_0x1b8c07);return new Promise(function(_0x1223d2,_0x3a6f81){if(intUtil[_0x9bae('0x19')](_0x1b8c07['userEmail'])){var _0x2e18b7={'method':_0x9bae('0x1a'),'uri':_0x5cc1a3+_0x9bae('0x1b')+_0x1b8c07[_0x9bae('0x1c')]+'&'+_0x3b02bb+'&'+_0x39cdd2,'auth':_0x4371af,'json':!![]};logger['info']('['+[_0x19a62c['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x2e18b7);return rp(_0x2e18b7)['then'](function(_0x191a78){logger[_0x9bae('0x17')]('['+[_0x19a62c[_0x9bae('0x13')]()]+_0x9bae('0x1d'),_0x191a78);if(_0x191a78['result'][_0x9bae('0x10')]>0x0&&String(_0x191a78[_0x9bae('0xf')][0x0][_0x9bae('0x1e')])===_0x9bae('0x1f')){_0x1b8c07['userId']=_0x191a78[_0x9bae('0xf')][0x0][_0x9bae('0x12')];}else{_0x1b8c07['userId']=_0x1b8c07['adminId'];_0x1b8c07['userEmail']=_0x1b8c07[_0x9bae('0x20')];}logger[_0x9bae('0x17')]('['+[_0x19a62c[_0x9bae('0x13')]()]+_0x9bae('0x21'),_0x1b8c07);_0x1223d2(_0x1b8c07);})['catch'](function(_0x3d2823){logger['error']('['+[_0x19a62c[_0x9bae('0x13')]()]+']',_0x3d2823[_0x9bae('0x16')]);_0x3a6f81(_0x3d2823[_0x9bae('0x16')]);});}else{logger[_0x9bae('0x17')]('['+[_0x19a62c[_0x9bae('0x13')]()]+']\x20using\x20admin\x20profile');_0x1b8c07[_0x9bae('0x22')]=_0x1b8c07[_0x9bae('0x11')];_0x1b8c07['userEmail']=_0x1b8c07[_0x9bae('0x20')];_0x1223d2(_0x1b8c07);}});};}function createEndUser(_0x5ae055,_0x266423,_0x4dc256,_0x2f2dbc,_0x57d5f2){logger[_0x9bae('0x17')]('['+[_0x5ae055[_0x9bae('0x13')]()]+_0x9bae('0x23'),_0x4dc256);return new Promise(function(_0x35bdbd,_0x51912d){var _0x1c0681={'method':_0x9bae('0x24'),'uri':_0x2f2dbc+_0x9bae('0x25')+_0x57d5f2,'body':{'user_name':_0x4dc256[_0x9bae('0x26')],'roles':_0x9bae('0x27'),'first_name':_0x4dc256['endUserNumber'],'active':_0x9bae('0x1f'),'date_format':_0x9bae('0x28'),'phone':_0x4dc256[_0x9bae('0x26')]},'auth':_0x266423,'json':!![]};return rp(_0x1c0681)['then'](function(_0x22d9f8){logger[_0x9bae('0x17')]('['+[_0x5ae055[_0x9bae('0x13')]()]+_0x9bae('0x29'),_0x22d9f8[_0x9bae('0xf')]);_0x4dc256['endUserId']=_0x22d9f8[_0x9bae('0xf')][_0x9bae('0x12')];_0x35bdbd(_0x4dc256);})[_0x9bae('0x15')](function(_0x227888){logger['error']('['+[_0x5ae055[_0x9bae('0x13')]()]+']',_0x227888[_0x9bae('0x16')]);_0x51912d(_0x227888[_0x9bae('0x16')]);});});}function getEndUser(_0x5ad9cb,_0x4d5ffd,_0x5629ef,_0x12b3a5,_0x1a2f68){return function(_0x12b0ea){logger[_0x9bae('0x17')]('['+[_0x5ad9cb[_0x9bae('0x13')]()]+_0x9bae('0x2a'),_0x12b0ea);return new Promise(function(_0x317895,_0xb28f42){var _0x114045={'method':_0x9bae('0x1a'),'uri':_0x5629ef+'sys_user?sysparm_query=phone%3D'+_0x12b0ea[_0x9bae('0x26')]+'&'+_0x12b3a5+'&'+_0x1a2f68,'auth':_0x4d5ffd,'json':!![]};return rp(_0x114045)[_0x9bae('0xe')](function(_0x497196){if(_0x497196[_0x9bae('0xf')][_0x9bae('0x10')]>0x0){_0x12b0ea[_0x9bae('0x2b')]=_0x497196[_0x9bae('0xf')][0x0][_0x9bae('0x12')];logger[_0x9bae('0x17')]('['+[_0x5ad9cb[_0x9bae('0x13')]()]+_0x9bae('0x2c'),_0x12b0ea);_0x317895(_0x12b0ea);}else{return createEndUser(_0x5ad9cb,_0x4d5ffd,_0x12b0ea,_0x5629ef,_0x12b3a5)[_0x9bae('0xe')](function(_0x592192){logger[_0x9bae('0x17')]('['+[_0x5ad9cb[_0x9bae('0x13')]()]+'],\x20createEndUser\x20crm',_0x592192);_0x317895(_0x592192);});}})[_0x9bae('0x15')](function(_0xb4a0b8){logger[_0x9bae('0x2d')]('['+[_0x5ad9cb[_0x9bae('0x13')]()]+']',_0xb4a0b8[_0x9bae('0x16')]);_0xb28f42(_0xb4a0b8['message']);});});};}function getCustomFields(_0x1f0111,_0x4c00f9){var _0x4f5f1d={};if(_0x1f0111[_0x9bae('0x10')]>0x0){_[_0x9bae('0x2e')](_0x1f0111,function(_0x2d220c){if(_[_0x9bae('0x2f')]([_0x9bae('0x30'),_0x9bae('0x31')],_0x2d220c[_0x9bae('0x32')])&&_0x2d220c[_0x9bae('0x33')]&&!_0x2d220c[_0x9bae('0x34')]){_0x4f5f1d[_0x2d220c[_0x9bae('0x33')][_0x9bae('0x35')]()]=_0x2d220c[_0x9bae('0x36')]['toString']();}else if(_['includes']([_0x9bae('0x30'),'picklist'],_0x2d220c[_0x9bae('0x32')])&&_0x2d220c[_0x9bae('0x37')]&&_0x2d220c[_0x9bae('0x34')]){_0x4f5f1d[_0x2d220c[_0x9bae('0x37')][_0x9bae('0x35')]()]=_0x2d220c[_0x9bae('0x36')][_0x9bae('0x38')]();}else if(_0x2d220c[_0x9bae('0x32')]===_0x9bae('0x39')&&_0x2d220c['variableName']&&_0x2d220c[_0x9bae('0x37')]&&_0x2d220c[_0x9bae('0x34')]){_0x4f5f1d[_0x2d220c[_0x9bae('0x37')][_0x9bae('0x35')]()]=_0x4c00f9[_0x2d220c[_0x9bae('0x3a')]]['toString']();}else if(_0x2d220c['type']===_0x9bae('0x3b')&&_0x2d220c[_0x9bae('0x3c')]&&_0x2d220c[_0x9bae('0x3c')][_0x9bae('0x3d')]&&_0x2d220c[_0x9bae('0x37')]&&_0x2d220c['customField']){_0x4f5f1d[_0x2d220c['idField']['toLowerCase']()]=_0x4c00f9[_0x2d220c['Variable']['name'][_0x9bae('0x35')]()][_0x9bae('0x38')]();}});}return _0x4f5f1d;}function getTicket(_0x2725d1,_0x2b1e59,_0x1e6b16,_0x1d6db0,_0x29db82,_0x404820){return function(_0x506707){logger[_0x9bae('0x17')]('['+[_0x2725d1[_0x9bae('0x13')]()]+_0x9bae('0x3e'),_0x506707);return new Promise(function(_0x3bb396,_0x259fe2){var _0x5ef121=_0x2725d1[_0x9bae('0x35')]()===_0x9bae('0x3f')?_0x506707[_0x9bae('0x22')]:_0x506707[_0x9bae('0x2b')];var _0x215664={'method':_0x9bae('0x24'),'uri':_0x1e6b16+'incident'+'?'+_0x404820,'body':Object[_0x9bae('0x40')]({},{'active':_0x9bae('0x1f'),'caller_id':_0x5ef121,'assigned_to':_0x506707['userId'],'short_description':intUtil[_0x9bae('0x41')](_0x1d6db0['Subjects'],_0x29db82,'\x20'),'description':intUtil[_0x9bae('0x41')](_0x1d6db0[_0x9bae('0x42')],_0x29db82,'\x0a')},getCustomFields(_0x1d6db0[_0x9bae('0x43')],_0x29db82)),'auth':_0x2b1e59,'json':!![]};return rp(_0x215664)[_0x9bae('0xe')](function(_0xcf2f48){logger[_0x9bae('0x17')]('['+[_0x2725d1[_0x9bae('0x13')]()]+_0x9bae('0x44'),_0xcf2f48[_0x9bae('0xf')]);_0x506707[_0x9bae('0x45')]=_0xcf2f48[_0x9bae('0xf')][_0x9bae('0x12')];_0x506707[_0x9bae('0x46')]=_0xcf2f48[_0x9bae('0xf')][_0x9bae('0x47')];logger[_0x9bae('0x17')]('['+[_0x2725d1[_0x9bae('0x13')]()]+']\x20getTicket\x20crm',_0x506707);_0x3bb396(_0x506707);})['catch'](function(_0x7ea1ae){logger[_0x9bae('0x2d')]('['+[_0x2725d1[_0x9bae('0x13')]()]+']',_0x7ea1ae[_0x9bae('0x16')]);_0x259fe2(_0x7ea1ae['message']);});});};}function createRemoteTag(_0x2bb6c4,_0x302705,_0x263851,_0x39055e){return new Promise(function(_0x2d496a,_0x497939){var _0x287f8e={'method':_0x9bae('0x24'),'uri':_0x263851+_0x9bae('0x48')+'?'+_0x39055e,'body':{'short_description':_0x2bb6c4,'global':!![],'active':!![],'name':_0x2bb6c4},'auth':_0x302705,'json':!![]};return rp(_0x287f8e)[_0x9bae('0xe')](function(_0x225749){var _0x1b24e3=_0x225749[_0x9bae('0xf')]['sys_id'];_0x2d496a(_0x1b24e3);});});}function getRemoteTag(_0x1dd2d0,_0x48a129,_0xbc73b8,_0x350798,_0x5dbdd2){return new Promise(function(_0x2eb5da,_0x38f398){var _0x3a8c1d={'method':'GET','uri':_0xbc73b8+'label'+_0x9bae('0x49')+_0x1dd2d0+'&'+_0x350798,'auth':_0x48a129,'json':!![]};return rp(_0x3a8c1d)['then'](function(_0x2dbf1b){if(_0x2dbf1b[_0x9bae('0xf')]['length']>0x0){var _0x37f5ce=_0x2dbf1b[_0x9bae('0xf')][0x0][_0x9bae('0x12')];_0x2eb5da(_0x37f5ce);}else{return createRemoteTag(_0x1dd2d0,_0x48a129,_0xbc73b8,_0x350798)[_0x9bae('0xe')](function(_0x447230){_0x2eb5da(_0x447230);});}});});}function assignTagToIncident(_0x12250e,_0x294d52,_0x1dfdf1,_0x59cfca,_0x99e04){return new Promise(function(_0x3f4c8b,_0x211f5e){var _0x38f22c={'method':_0x9bae('0x24'),'uri':_0x1dfdf1+_0x9bae('0x4a')+'?'+_0x99e04,'body':{'label':_0x12250e,'table':_0x9bae('0x4b'),'id_type':_0x9bae('0x4c'),'table_key':_0x59cfca['ticketId'],'title':_0x9bae('0x4d')+_0x59cfca['ticketNumber'],'id_display':_0x59cfca['ticketNumber']},'auth':_0x294d52,'json':!![]};return rp(_0x38f22c)['then'](function(_0x51f9ae){_0x3f4c8b();})[_0x9bae('0x15')](function(){_0x3f4c8b();});});}function manageTags(_0x5a3a35,_0x5b0622,_0x10eb08,_0x9d12f2,_0x455b61,_0x445f18,_0x26836f){return new Promise(function(_0x1626ac,_0xaab52b){var _0xf03de5=[];_0x5b0622['forEach'](function(_0x39116b){_0xf03de5[_0x9bae('0x4e')](getRemoteTag(_0x39116b,_0x10eb08,_0x9d12f2,_0x445f18,_0x26836f));});return Promise[_0x9bae('0x4f')](_0xf03de5)['then'](function(_0x7ebb96){if(_0x7ebb96['length']){logger[_0x9bae('0x17')]('['+[_0x5a3a35[_0x9bae('0x13')]()]+_0x9bae('0x50'),_0x7ebb96);var _0x3a64c9=[];_0x7ebb96[_0x9bae('0x2e')](function(_0x5b6f64){_0x3a64c9[_0x9bae('0x4e')](assignTagToIncident(_0x5b6f64,_0x10eb08,_0x9d12f2,_0x455b61,_0x445f18));});return Promise['all'](_0x3a64c9)['then'](function(){_0x1626ac();})[_0x9bae('0x15')](function(){_0x1626ac();});}else{_0x1626ac();}});});}function getTags(_0x441572,_0x271ac7,_0x48ecdd,_0x16000a,_0x259af5,_0x1e2cf2){return function(_0x14cd18){return new Promise(function(_0x2d706a,_0x351587){var _0xe14e5e=[];var _0x16cd8b=_0x16000a['Tags'];if(_0x16cd8b&&_0x16cd8b[_0x9bae('0x10')]>0x0){_0xe14e5e=_[_0x9bae('0x51')](_0x16cd8b,'name');}if(_0xe14e5e[_0x9bae('0x10')]>0x0){return manageTags(_0x441572,_0xe14e5e,_0x271ac7,_0x48ecdd,_0x14cd18,_0x259af5,_0x1e2cf2)[_0x9bae('0xe')](function(){_0x2d706a(_0x14cd18);});}else{_0x2d706a(_0x14cd18);}});};}function emit(_0x377eb0,_0x24bb70,_0x18d9bc){var _0xe9c989=_0x9bae('0x52')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x9bae('0x53');var _0x52cc34={'uri':_0x377eb0+_0x9bae('0x54')+_0x18d9bc+_0xe9c989};io['to'](util[_0x9bae('0x55')]('user:%s',_0x24bb70))[_0x9bae('0x56')](_0x9bae('0x57'),_0x52cc34);}exports['cs']=function(_0x5c6ef2,_0x410e4a,_0x564f3e,_0x315307,_0x174b02,_0x37323b,_0x5ab154,_0x308fb1){var _0x4d565a={};var _0x5b396e={'user':_0x37323b['username'],'pass':_0x37323b[_0x9bae('0x58')]};var _0x23d110=_0x9bae('0x59');var _0x5515d0=_0x9bae('0x5a');_0x37323b[_0x9bae('0x5b')]=intUtil[_0x9bae('0x5c')](_0x37323b[_0x9bae('0x5b')]);_0x37323b[_0x9bae('0x5d')]=intUtil[_0x9bae('0x5c')](_0x37323b[_0x9bae('0x5d')]);var _0x5ad7f2=util['format']('%s/api/now/table/',_0x37323b[_0x9bae('0x5b')]);_0x4d565a['userEmail']=!_[_0x9bae('0x5e')](_0x315307)?_0x315307[_0x9bae('0x5f')]:null;_0x4d565a[_0x9bae('0x20')]=_0x37323b[_0x9bae('0x5f')];_0x4d565a[_0x9bae('0x26')]=_0x308fb1[_0x9bae('0x35')]()===_0x9bae('0x3f')?_0x410e4a[_0x9bae('0x60')]:_0x410e4a[_0x9bae('0x61')];_0x4d565a[_0x9bae('0x62')]=_0x308fb1===_0x9bae('0x63')||_0x308fb1===_0x9bae('0x64')?_0x9bae('0x63'):'outbound';var _0x41103f=util[_0x9bae('0x55')](_0x9bae('0x65'),_0x37323b[_0x9bae('0x5d')],_0x410e4a[_0x9bae('0x66')],md5(_0x410e4a[_0x9bae('0x66')]));if(_0x174b02&&_0x174b02[_0x9bae('0x67')]){logger[_0x9bae('0x17')](_0x9bae('0x68'),_0x9bae('0x69'));_0x410e4a[_0x9bae('0x6a')]=_0x41103f;}else if(_0x5ab154&&_0x5ab154['recordingFormat']&&_0x5ab154[_0x9bae('0x6b')]!=='none'){logger[_0x9bae('0x17')](_0x9bae('0x6c'),_0x9bae('0x69'));_0x410e4a['recordingURL']=_0x41103f;}else{_0x410e4a[_0x9bae('0x6a')]='';}return getAdminUser(_0x308fb1,_0x5b396e,_0x4d565a,_0x5ad7f2,_0x5515d0,_0x23d110)[_0x9bae('0xe')](getUser(_0x308fb1,_0x5b396e,_0x5ad7f2,_0x5515d0,_0x23d110))[_0x9bae('0xe')](getEndUser(_0x308fb1,_0x5b396e,_0x5ad7f2,_0x5515d0,_0x23d110))['then'](getTicket(_0x308fb1,_0x5b396e,_0x5ad7f2,_0x564f3e,_0x410e4a,_0x5515d0))[_0x9bae('0xe')](function(_0x429280){logger[_0x9bae('0x17')](util[_0x9bae('0x55')]('The\x20ticket\x20ID\x20is:\x20%s',_0x429280[_0x9bae('0x45')]));logger[_0x9bae('0x17')](util[_0x9bae('0x55')]('call\x20direction:\x20%s',_0x308fb1));if(_0x308fb1!==_0x9bae('0x64')){logger['info']('['+[_0x308fb1[_0x9bae('0x13')]()]+']',_0x9bae('0x6d'));emit(_0x37323b[_0x9bae('0x5b')],_0x315307['name'],_0x429280[_0x9bae('0x45')]);}})[_0x9bae('0x15')](function(_0x38c7ca){logger[_0x9bae('0x2d')]('['+[_0x308fb1[_0x9bae('0x13')]()]+_0x9bae('0x6e'),util[_0x9bae('0x6f')](_0x38c7ca,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x549f=['customVariable','Variable','name','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','includes','idField','customField','content','variable','variableName','toString'];(function(_0x1dca17,_0x193be7){var _0x2283ad=function(_0x2b3921){while(--_0x2b3921){_0x1dca17['push'](_0x1dca17['shift']());}};_0x2283ad(++_0x193be7);}(_0x549f,0x11f));var _0xf549=function(_0x4e0914,_0x277013){_0x4e0914=_0x4e0914-0x0;var _0x4edd75=_0x549f[_0x4e0914];return _0x4edd75;};'use strict';var _=require(_0xf549('0x0'));var Promise=require('bluebird');var rp=require(_0xf549('0x1'));var util=require(_0xf549('0x2'));var md5=require(_0xf549('0x3'));var Redis=require(_0xf549('0x4'));var intUtil=require(_0xf549('0x5'));var config=require(_0xf549('0x6'));var logger=require(_0xf549('0x7'))(_0xf549('0x8'));config['redis']=_['defaults'](config[_0xf549('0x9')],{'host':_0xf549('0xa'),'port':0x18eb});var io=require(_0xf549('0xb'))(new Redis(config[_0xf549('0x9')]));function getAdminUser(_0x131435,_0x531650,_0x577738,_0x40f0f2,_0x2fb326,_0x25b0c4){return new Promise(function(_0x15554e,_0x307697){var _0x373528={'method':_0xf549('0xc'),'uri':_0x40f0f2+_0xf549('0xd')+'&'+_0x2fb326+'&'+_0x25b0c4,'auth':_0x531650,'json':!![]};return rp(_0x373528)[_0xf549('0xe')](function(_0x3a6807){if(_0x3a6807[_0xf549('0xf')]['length']>0x0){_0x577738[_0xf549('0x10')]=_0x3a6807[_0xf549('0xf')][0x0]['sys_id'];}logger[_0xf549('0x11')]('['+[_0x131435[_0xf549('0x12')]()]+_0xf549('0x13'),_0x577738);_0x15554e(_0x577738);})[_0xf549('0x14')](function(_0x1c2b8b){logger['error']('['+[_0x131435['toUpperCase']()]+']',_0x1c2b8b[_0xf549('0x15')]);_0x307697(_0x1c2b8b[_0xf549('0x15')]);});});}function getUser(_0x388bf3,_0x4f8ced,_0x289497,_0x398f8e,_0x18692f){return function(_0x17d279){logger['info']('['+[_0x388bf3[_0xf549('0x12')]()]+_0xf549('0x16'),_0x17d279);return new Promise(function(_0x13779c,_0x35e82f){if(intUtil[_0xf549('0x17')](_0x17d279[_0xf549('0x18')])){var _0xaf667={'method':'GET','uri':_0x289497+'sys_user?sysparm_query=email%3D'+_0x17d279['userEmail']+'&'+_0x398f8e+'&'+_0x18692f,'auth':_0x4f8ced,'json':!![]};logger[_0xf549('0x11')]('['+[_0x388bf3[_0xf549('0x12')]()]+_0xf549('0x19'),_0xaf667);return rp(_0xaf667)[_0xf549('0xe')](function(_0x3c9a21){logger[_0xf549('0x11')]('['+[_0x388bf3[_0xf549('0x12')]()]+_0xf549('0x1a'),_0x3c9a21);if(_0x3c9a21[_0xf549('0xf')][_0xf549('0x1b')]>0x0&&String(_0x3c9a21[_0xf549('0xf')][0x0][_0xf549('0x1c')])===_0xf549('0x1d')){_0x17d279[_0xf549('0x1e')]=_0x3c9a21[_0xf549('0xf')][0x0][_0xf549('0x1f')];}else{_0x17d279[_0xf549('0x1e')]=_0x17d279[_0xf549('0x10')];_0x17d279[_0xf549('0x18')]=_0x17d279[_0xf549('0x20')];}logger['info']('['+[_0x388bf3['toUpperCase']()]+_0xf549('0x21'),_0x17d279);_0x13779c(_0x17d279);})['catch'](function(_0x2ba3b8){logger[_0xf549('0x22')]('['+[_0x388bf3[_0xf549('0x12')]()]+']',_0x2ba3b8['message']);_0x35e82f(_0x2ba3b8[_0xf549('0x15')]);});}else{logger[_0xf549('0x11')]('['+[_0x388bf3[_0xf549('0x12')]()]+_0xf549('0x23'));_0x17d279[_0xf549('0x1e')]=_0x17d279['adminId'];_0x17d279[_0xf549('0x18')]=_0x17d279[_0xf549('0x20')];_0x13779c(_0x17d279);}});};}function createEndUser(_0x3510da,_0x55d7cd,_0xd19e7a,_0x35acbd,_0x3434f5){logger['info']('['+[_0x3510da[_0xf549('0x12')]()]+_0xf549('0x24'),_0xd19e7a);return new Promise(function(_0x22f479,_0x190f4){var _0x30d52a={'method':_0xf549('0x25'),'uri':_0x35acbd+_0xf549('0x26')+_0x3434f5,'body':{'user_name':_0xd19e7a[_0xf549('0x27')],'roles':_0xf549('0x28'),'first_name':_0xd19e7a[_0xf549('0x27')],'active':_0xf549('0x1d'),'date_format':_0xf549('0x29'),'phone':_0xd19e7a['endUserNumber']},'auth':_0x55d7cd,'json':!![]};return rp(_0x30d52a)[_0xf549('0xe')](function(_0x3d17a0){logger[_0xf549('0x11')]('['+[_0x3510da[_0xf549('0x12')]()]+_0xf549('0x2a'),_0x3d17a0[_0xf549('0xf')]);_0xd19e7a[_0xf549('0x2b')]=_0x3d17a0[_0xf549('0xf')][_0xf549('0x1f')];_0x22f479(_0xd19e7a);})['catch'](function(_0x58e3b7){logger[_0xf549('0x22')]('['+[_0x3510da['toUpperCase']()]+']',_0x58e3b7[_0xf549('0x15')]);_0x190f4(_0x58e3b7['message']);});});}function getEndUser(_0x33d317,_0x408ea0,_0x32b689,_0x5efac9,_0x56b72b){return function(_0x152f75){logger[_0xf549('0x11')]('['+[_0x33d317[_0xf549('0x12')]()]+_0xf549('0x2c'),_0x152f75);return new Promise(function(_0x2739a1,_0x597c8a){var _0x8e198={'method':_0xf549('0xc'),'uri':_0x32b689+_0xf549('0x2d')+_0x152f75[_0xf549('0x27')]+'&'+_0x5efac9+'&'+_0x56b72b,'auth':_0x408ea0,'json':!![]};return rp(_0x8e198)[_0xf549('0xe')](function(_0x39217a){if(_0x39217a[_0xf549('0xf')][_0xf549('0x1b')]>0x0){_0x152f75[_0xf549('0x2b')]=_0x39217a['result'][0x0]['sys_id'];logger['info']('['+[_0x33d317['toUpperCase']()]+_0xf549('0x2e'),_0x152f75);_0x2739a1(_0x152f75);}else{return createEndUser(_0x33d317,_0x408ea0,_0x152f75,_0x32b689,_0x5efac9)[_0xf549('0xe')](function(_0x526f33){logger[_0xf549('0x11')]('['+[_0x33d317[_0xf549('0x12')]()]+_0xf549('0x2f'),_0x526f33);_0x2739a1(_0x526f33);});}})[_0xf549('0x14')](function(_0x143267){logger[_0xf549('0x22')]('['+[_0x33d317[_0xf549('0x12')]()]+']',_0x143267[_0xf549('0x15')]);_0x597c8a(_0x143267['message']);});});};}function getCustomFields(_0x7aa401,_0x8bb0d4){var _0x13aec3={};if(_0x7aa401[_0xf549('0x1b')]>0x0){_[_0xf549('0x30')](_0x7aa401,function(_0xe5445e){if(_['includes']([_0xf549('0x31'),_0xf549('0x32')],_0xe5445e[_0xf549('0x33')])&&_0xe5445e[_0xf549('0x34')]&&!_0xe5445e['customField']){_0x13aec3[_0xe5445e[_0xf549('0x34')][_0xf549('0x35')]()]=_0xe5445e['content']['toString']();}else if(_[_0xf549('0x36')](['string',_0xf549('0x32')],_0xe5445e[_0xf549('0x33')])&&_0xe5445e[_0xf549('0x37')]&&_0xe5445e[_0xf549('0x38')]){_0x13aec3[_0xe5445e[_0xf549('0x37')][_0xf549('0x35')]()]=_0xe5445e[_0xf549('0x39')]['toString']();}else if(_0xe5445e[_0xf549('0x33')]===_0xf549('0x3a')&&_0xe5445e['variableName']&&_0xe5445e['idField']&&_0xe5445e[_0xf549('0x38')]){_0x13aec3[_0xe5445e['idField'][_0xf549('0x35')]()]=_0x8bb0d4[_0xe5445e[_0xf549('0x3b')]][_0xf549('0x3c')]();}else if(_0xe5445e['type']===_0xf549('0x3d')&&_0xe5445e[_0xf549('0x3e')]&&_0xe5445e[_0xf549('0x3e')][_0xf549('0x3f')]&&_0xe5445e[_0xf549('0x37')]&&_0xe5445e['customField']){_0x13aec3[_0xe5445e['idField'][_0xf549('0x35')]()]=_0x8bb0d4[_0xe5445e[_0xf549('0x3e')]['name']['toLowerCase']()][_0xf549('0x3c')]();}});}return _0x13aec3;}function getTicket(_0x5b64a0,_0x576323,_0x2b2f3d,_0x40a5a5,_0x3034e2,_0x2f0bc8){return function(_0x6f3a32){logger[_0xf549('0x11')]('['+[_0x5b64a0[_0xf549('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x6f3a32);return new Promise(function(_0x49fc3c,_0x2d3cd4){var _0x390cfa=_0x5b64a0[_0xf549('0x35')]()==='outbound'?_0x6f3a32[_0xf549('0x1e')]:_0x6f3a32[_0xf549('0x2b')];var _0x9ab256={'method':'POST','uri':_0x2b2f3d+'incident'+'?'+_0x2f0bc8,'body':Object['assign']({},{'active':_0xf549('0x1d'),'caller_id':_0x390cfa,'assigned_to':_0x6f3a32['userId'],'short_description':intUtil[_0xf549('0x40')](_0x40a5a5[_0xf549('0x41')],_0x3034e2,'\x20'),'description':intUtil[_0xf549('0x40')](_0x40a5a5[_0xf549('0x42')],_0x3034e2,'\x0a')},getCustomFields(_0x40a5a5[_0xf549('0x43')],_0x3034e2)),'auth':_0x576323,'json':!![]};return rp(_0x9ab256)[_0xf549('0xe')](function(_0x3689a8){logger[_0xf549('0x11')]('['+[_0x5b64a0[_0xf549('0x12')]()]+_0xf549('0x44'),_0x3689a8[_0xf549('0xf')]);_0x6f3a32[_0xf549('0x45')]=_0x3689a8[_0xf549('0xf')][_0xf549('0x1f')];_0x6f3a32[_0xf549('0x46')]=_0x3689a8[_0xf549('0xf')][_0xf549('0x47')];logger[_0xf549('0x11')]('['+[_0x5b64a0[_0xf549('0x12')]()]+_0xf549('0x48'),_0x6f3a32);_0x49fc3c(_0x6f3a32);})[_0xf549('0x14')](function(_0x239f7f){logger['error']('['+[_0x5b64a0['toUpperCase']()]+']',_0x239f7f[_0xf549('0x15')]);_0x2d3cd4(_0x239f7f['message']);});});};}function createRemoteTag(_0xad02ac,_0x239dc5,_0x531eae,_0x1ba3c1){return new Promise(function(_0x2cea8c,_0x89b09d){var _0x377e43={'method':_0xf549('0x25'),'uri':_0x531eae+_0xf549('0x49')+'?'+_0x1ba3c1,'body':{'short_description':_0xad02ac,'global':!![],'active':!![],'name':_0xad02ac},'auth':_0x239dc5,'json':!![]};return rp(_0x377e43)[_0xf549('0xe')](function(_0x494843){var _0x340229=_0x494843[_0xf549('0xf')]['sys_id'];_0x2cea8c(_0x340229);});});}function getRemoteTag(_0x1f89b3,_0x3c95af,_0x1d9731,_0x5501cf,_0x3ab48c){return new Promise(function(_0x329692,_0x12348d){var _0x45ce8a={'method':_0xf549('0xc'),'uri':_0x1d9731+_0xf549('0x49')+_0xf549('0x4a')+_0x1f89b3+'&'+_0x5501cf,'auth':_0x3c95af,'json':!![]};return rp(_0x45ce8a)[_0xf549('0xe')](function(_0x46a814){if(_0x46a814[_0xf549('0xf')][_0xf549('0x1b')]>0x0){var _0x4b33b0=_0x46a814[_0xf549('0xf')][0x0][_0xf549('0x1f')];_0x329692(_0x4b33b0);}else{return createRemoteTag(_0x1f89b3,_0x3c95af,_0x1d9731,_0x5501cf)[_0xf549('0xe')](function(_0x44b454){_0x329692(_0x44b454);});}});});}function assignTagToIncident(_0x2a912a,_0x5553f4,_0x562a15,_0xb0569a,_0x2b0b5e){return new Promise(function(_0x3b763f,_0x2ed6e9){var _0x19153a={'method':_0xf549('0x25'),'uri':_0x562a15+_0xf549('0x4b')+'?'+_0x2b0b5e,'body':{'label':_0x2a912a,'table':'incident','id_type':_0xf549('0x4c'),'table_key':_0xb0569a['ticketId'],'title':'Incident\x20-\x20'+_0xb0569a['ticketNumber'],'id_display':_0xb0569a[_0xf549('0x46')]},'auth':_0x5553f4,'json':!![]};return rp(_0x19153a)[_0xf549('0xe')](function(_0x3ebc0d){_0x3b763f();})[_0xf549('0x14')](function(){_0x3b763f();});});}function manageTags(_0x215aa5,_0x19f5a4,_0x319565,_0x43d9eb,_0x570a51,_0x2baa1e,_0x5669ab){return new Promise(function(_0x4e2586,_0x3f0179){var _0x23c5df=[];_0x19f5a4['forEach'](function(_0x46c486){_0x23c5df['push'](getRemoteTag(_0x46c486,_0x319565,_0x43d9eb,_0x2baa1e,_0x5669ab));});return Promise[_0xf549('0x4d')](_0x23c5df)[_0xf549('0xe')](function(_0x53db20){if(_0x53db20['length']){logger[_0xf549('0x11')]('['+[_0x215aa5[_0xf549('0x12')]()]+_0xf549('0x4e'),_0x53db20);var _0x131f25=[];_0x53db20['forEach'](function(_0xe2789d){_0x131f25[_0xf549('0x4f')](assignTagToIncident(_0xe2789d,_0x319565,_0x43d9eb,_0x570a51,_0x2baa1e));});return Promise[_0xf549('0x4d')](_0x131f25)[_0xf549('0xe')](function(){_0x4e2586();})[_0xf549('0x14')](function(){_0x4e2586();});}else{_0x4e2586();}});});}function getTags(_0x3e1d26,_0x546d17,_0x5a79ee,_0x48bbba,_0x4923a8,_0x4ad2a3){return function(_0x3ac67){return new Promise(function(_0x15cffb,_0x73674d){var _0x1faf83=[];var _0x59b77c=_0x48bbba[_0xf549('0x50')];if(_0x59b77c&&_0x59b77c[_0xf549('0x1b')]>0x0){_0x1faf83=_[_0xf549('0x51')](_0x59b77c,'name');}if(_0x1faf83['length']>0x0){return manageTags(_0x3e1d26,_0x1faf83,_0x546d17,_0x5a79ee,_0x3ac67,_0x4923a8,_0x4ad2a3)[_0xf549('0xe')](function(){_0x15cffb(_0x3ac67);});}else{_0x15cffb(_0x3ac67);}});};}function emit(_0x3b2d34,_0x3fe1b1,_0x51f12d){var _0x1088a4=_0xf549('0x52')+_0xf549('0x53')+_0xf549('0x54')+_0xf549('0x55');var _0x6ca1f7={'uri':_0x3b2d34+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x51f12d+_0x1088a4};io['to'](util['format'](_0xf549('0x56'),_0x3fe1b1))[_0xf549('0x57')]('trigger:browser:url',_0x6ca1f7);}exports['cs']=function(_0x21ca38,_0x27832c,_0x2f122b,_0x734e01,_0x39cd72,_0x4ede1f,_0x2615d4,_0x5b5288){var _0x46a6db={};var _0x1af662={'user':_0x4ede1f[_0xf549('0x58')],'pass':_0x4ede1f[_0xf549('0x59')]};var _0x2f5964=_0xf549('0x5a');var _0x27452d=_0xf549('0x5b');_0x4ede1f[_0xf549('0x5c')]=intUtil[_0xf549('0x5d')](_0x4ede1f[_0xf549('0x5c')]);_0x4ede1f[_0xf549('0x5e')]=intUtil[_0xf549('0x5d')](_0x4ede1f['serverUrl']);var _0x2726cf=util[_0xf549('0x5f')]('%s/api/now/table/',_0x4ede1f[_0xf549('0x5c')]);_0x46a6db['userEmail']=!_[_0xf549('0x60')](_0x734e01)?_0x734e01[_0xf549('0x61')]:null;_0x46a6db['adminEmail']=_0x4ede1f['email'];_0x46a6db[_0xf549('0x27')]=_0x5b5288[_0xf549('0x35')]()===_0xf549('0x62')?_0x27832c[_0xf549('0x63')]:_0x27832c['calleridnum'];_0x46a6db[_0xf549('0x64')]=_0x5b5288===_0xf549('0x65')||_0x5b5288===_0xf549('0x66')?_0xf549('0x65'):_0xf549('0x62');var _0x2068c2=util[_0xf549('0x5f')](_0xf549('0x67'),_0x4ede1f[_0xf549('0x5e')],_0x27832c[_0xf549('0x68')],md5(_0x27832c[_0xf549('0x68')]));if(_0x39cd72&&_0x39cd72[_0xf549('0x69')]){logger[_0xf549('0x11')](_0xf549('0x6a'),_0xf549('0x6b'));_0x27832c[_0xf549('0x6c')]=_0x2068c2;}else if(_0x2615d4&&_0x2615d4[_0xf549('0x6d')]&&_0x2615d4['recordingFormat']!==_0xf549('0x6e')){logger[_0xf549('0x11')](_0xf549('0x6f'),_0xf549('0x6b'));_0x27832c[_0xf549('0x6c')]=_0x2068c2;}else{_0x27832c['recordingURL']='';}return getAdminUser(_0x5b5288,_0x1af662,_0x46a6db,_0x2726cf,_0x27452d,_0x2f5964)[_0xf549('0xe')](getUser(_0x5b5288,_0x1af662,_0x2726cf,_0x27452d,_0x2f5964))[_0xf549('0xe')](getEndUser(_0x5b5288,_0x1af662,_0x2726cf,_0x27452d,_0x2f5964))['then'](getTicket(_0x5b5288,_0x1af662,_0x2726cf,_0x2f122b,_0x27832c,_0x27452d))[_0xf549('0xe')](function(_0x5f4567){logger[_0xf549('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x5f4567['ticketId']));logger[_0xf549('0x11')](util[_0xf549('0x5f')](_0xf549('0x70'),_0x5b5288));if(_0x5b5288!==_0xf549('0x66')){logger['info']('['+[_0x5b5288['toUpperCase']()]+']',_0xf549('0x71'));emit(_0x4ede1f[_0xf549('0x5c')],_0x734e01['name'],_0x5f4567[_0xf549('0x45')]);}})[_0xf549('0x14')](function(_0x5e1c65){logger[_0xf549('0x22')]('['+[_0x5b5288[_0xf549('0x12')]()]+_0xf549('0x72'),util[_0xf549('0x73')](_0x5e1c65,{'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 366f4df..a72fe95 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 _0xa07a=['[OUTBOUND]','destcalleridname','version','catch','lastevent','toUpperCase','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xa07a,0x16e));var _0xaa07=function(_0x4f4c67,_0x59332b){_0x4f4c67=_0x4f4c67-0x0;var _0x386698=_0xa07a[_0x4f4c67];return _0x386698;};'use strict';var _=require('lodash');var rp=require(_0xaa07('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xaa07('0x1'));var Redis=require(_0xaa07('0x2'));var intUtil=require(_0xaa07('0x3'));var config=require(_0xaa07('0x4'));var logger=require(_0xaa07('0x5'))(_0xaa07('0x6'));config[_0xaa07('0x7')]=_['defaults'](config[_0xaa07('0x7')],{'host':_0xaa07('0x8'),'port':0x18eb});var io=require(_0xaa07('0x9'))(new Redis(config[_0xaa07('0x7')]));var def={'method':_0xaa07('0xa'),'json':!![]};function emit(_0x26223e,_0x47dbb7,_0x27e93b){io['to'](_0x26223e)['emit'](_0x47dbb7,_0x27e93b);}function getTicket(_0x2a7510,_0xd8b7a0,_0x3d83e5,_0x5118e4,_0x4839a4,_0x1d7c57,_0x572b68,_0x15acc2){logger[_0xaa07('0xb')]('Creating\x20new\x20ticket...');var _0x85fea1=new Date();var _0x48074c=[{'name':_0xaa07('0xc'),'value':intUtil[_0xaa07('0xd')](_0x5118e4[_0xaa07('0xe')],_0x4839a4,'\x20')},{'name':_0xaa07('0xf'),'value':_0xd8b7a0['id']},{'name':'created_by','value':_0xd8b7a0['id']},{'name':_0xaa07('0x10'),'value':intUtil[_0xaa07('0xd')](_0x5118e4[_0xaa07('0x11')],_0x4839a4,'\x0a')},{'name':'date_start','value':_0x85fea1[_0xaa07('0x12')]()[_0xaa07('0x13')](0x0,0x13)[_0xaa07('0x14')]('T','\x20')},{'name':_0xaa07('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xaa07('0x16'),'value':_0x3d83e5['id']},{'name':_0xaa07('0x17'),'value':_0xaa07('0x18')},{'name':_0xaa07('0x19'),'value':_0x3d83e5[_0xaa07('0xc')]},{'name':_0xaa07('0x1a'),'value':_0x15acc2}];if(_0x1d7c57[_0xaa07('0x1b')]){_[_0xaa07('0x1c')](_0x1d7c57,function(_0x3b93db){if(_0x4839a4[_0x3b93db[_0xaa07('0x1d')]]){_0x48074c[_0xaa07('0x1e')]({'name':_0x3b93db[_0xaa07('0x1f')],'value':_0x4839a4[_0x3b93db[_0xaa07('0x1d')]]});}});}return request({'form':{'method':_0xaa07('0x20'),'input_type':'JSON','response_type':_0xaa07('0x21'),'rest_data':JSON[_0xaa07('0x22')]({'session':_0x572b68['id'],'module_name':_0xaa07('0x23'),'name_value_list':_0x48074c})}});}function getAuth(_0x4d9a07){return util[_0xaa07('0x24')](_0xaa07('0x25'),new Buffer(_0x4d9a07[_0xaa07('0x26')]+':X')[_0xaa07('0x27')](_0xaa07('0x28')));}function getServerInfo(_0x29e868){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x29e868['id']})}});}function getUser(_0x4d4a26,_0x1910ce,_0x5ccf2f){if(!_[_0xaa07('0x29')](_0x1910ce)){logger[_0xaa07('0xb')](_0xaa07('0x2a'),_0x1910ce);return request({'form':{'method':_0xaa07('0x2b'),'input_type':_0xaa07('0x21'),'response_type':_0xaa07('0x21'),'rest_data':JSON[_0xaa07('0x22')]({'session':_0x5ccf2f['id'],'module_name':_0xaa07('0x2c'),'query':util['format'](_0xaa07('0x2d'),_0x1910ce),'order_by':'','offset':'0','select_fields':['id','name',_0xaa07('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xaa07('0x2f')](function(_0x13a138){if(_0x13a138[_0xaa07('0x30')][_0xaa07('0x1b')]){var _0xfc0e3f=_[_0xaa07('0x31')](_0x13a138[_0xaa07('0x30')],function(_0x3a2903){return _0x3a2903[_0xaa07('0x32')][_0xaa07('0x2e')][_0xaa07('0x33')]===_0x1910ce;});if(_0xfc0e3f){logger[_0xaa07('0xb')](_0xaa07('0x34'));return BPromise[_0xaa07('0x35')]({'id':_0xfc0e3f[_0xaa07('0x32')]['id'][_0xaa07('0x33')],'name':_0xfc0e3f[_0xaa07('0x32')][_0xaa07('0xc')][_0xaa07('0x33')]});}}logger[_0xaa07('0xb')](_0xaa07('0x36'));return BPromise['resolve']({'id':_0x5ccf2f[_0xaa07('0x32')][_0xaa07('0x37')][_0xaa07('0x33')],'name':_0x5ccf2f['name_value_list'][_0xaa07('0x2e')]['value']});});}else{logger[_0xaa07('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5ccf2f[_0xaa07('0x32')][_0xaa07('0x37')]['value'],'name':_0x5ccf2f[_0xaa07('0x32')][_0xaa07('0x2e')]['value']});}}function getEndUser(_0x10ee84,_0x23d993,_0xb3bdc9,_0x13bcca){logger[_0xaa07('0xb')](_0xaa07('0x38'),_0xb3bdc9);return request({'form':{'method':'get_entry_list','input_type':_0xaa07('0x21'),'response_type':'JSON','rest_data':JSON[_0xaa07('0x22')]({'session':_0x13bcca['id'],'module_name':_0xaa07('0x18'),'query':util[_0xaa07('0x24')](_0xaa07('0x39'),_0xb3bdc9),'order_by':'','offset':'0','select_fields':['id',_0xaa07('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4a8279){if(_0x4a8279[_0xaa07('0x30')][_0xaa07('0x1b')]){var _0x1defc1=_[_0xaa07('0x31')](_0x4a8279[_0xaa07('0x30')],function(_0x3786b4){return _0x3786b4[_0xaa07('0x32')][_0xaa07('0x3a')][_0xaa07('0x33')]===_0xb3bdc9;});if(_0x1defc1){logger[_0xaa07('0xb')](_0xaa07('0x3b'));return BPromise['resolve']({'id':_0x1defc1['name_value_list']['id'][_0xaa07('0x33')],'name':_0x1defc1[_0xaa07('0x32')][_0xaa07('0xc')][_0xaa07('0x33')],'phone':_0x1defc1['name_value_list']['phone_home'][_0xaa07('0x33')]});}}else{logger[_0xaa07('0xb')](_0xaa07('0x3c'));return request({'form':{'method':_0xaa07('0x20'),'input_type':_0xaa07('0x21'),'response_type':_0xaa07('0x21'),'rest_data':JSON[_0xaa07('0x22')]({'session':_0x13bcca['id'],'module_name':_0xaa07('0x18'),'name_value_list':[{'name':'first_name','value':_0x23d993!==_0xaa07('0x3d')?_0x23d993:util[_0xaa07('0x24')](_0xaa07('0x3e'),_0xb3bdc9)},{'name':'phone_home','value':_0xb3bdc9}]})}})[_0xaa07('0x2f')](function(_0x4668d3){logger[_0xaa07('0xb')](_0xaa07('0x3f'));return BPromise[_0xaa07('0x35')]({'id':_0x4668d3['id'],'name':_0x4668d3[_0xaa07('0x30')]['first_name'][_0xaa07('0x33')],'phone':_0x4668d3[_0xaa07('0x30')]['phone_home']['value']});});}});}function request(_0x4d5b21){logger['debug'](_0xaa07('0x40'),JSON[_0xaa07('0x22')](_0x4d5b21));return rp(_[_0xaa07('0x41')](def,_0x4d5b21));}function getTags(_0x56b096,_0x47c48e){var _0x48d388=[];if(_0x56b096&&_0x56b096[_0xaa07('0x1b')]>0x0){_0x48d388=_['map'](_0x56b096,_0x47c48e);}return _0x48d388;}function getCustomFields(_0x4e9ac7,_0x141b46){var _0x24f0f7=[];var _0x4dd582={'custom_fields':[]};if(_0x4e9ac7['length']>0x0){_[_0xaa07('0x1c')](_0x4e9ac7,function(_0x4a7c53){if(_0x4a7c53[_0xaa07('0x42')]===_0xaa07('0x43')&&_0x4a7c53[_0xaa07('0x44')]&&!_0x4a7c53[_0xaa07('0x45')]){_0x4dd582[_0x4a7c53['nameField'][_0xaa07('0x46')]()]=_0x4a7c53[_0xaa07('0x47')][_0xaa07('0x27')]();}else if(_0x4a7c53['type']===_0xaa07('0x43')&&_0x4a7c53[_0xaa07('0x1f')]&&_0x4a7c53[_0xaa07('0x45')]){_0x4dd582[_0xaa07('0x48')][_0xaa07('0x1e')]({'id':_0x4a7c53[_0xaa07('0x1f')],'value':_0x4a7c53[_0xaa07('0x47')][_0xaa07('0x27')]()});}else if(_0x4a7c53[_0xaa07('0x42')]===_0xaa07('0x49')&&_0x4a7c53[_0xaa07('0x1d')]&&_0x4a7c53[_0xaa07('0x1f')]&&_0x4a7c53['customField']){_0x141b46[_0x4a7c53[_0xaa07('0x1d')]]&&_0x4dd582[_0xaa07('0x48')][_0xaa07('0x1e')]({'id':_0x4a7c53[_0xaa07('0x1f')],'value':_0x141b46[_0x4a7c53[_0xaa07('0x1d')]][_0xaa07('0x27')]()});}else if(_0x4a7c53[_0xaa07('0x42')]===_0xaa07('0x4a')&&_0x4a7c53[_0xaa07('0x4b')]&&_0x4a7c53[_0xaa07('0x4b')]['name']&&_0x4a7c53[_0xaa07('0x1f')]&&_0x4a7c53['customField']){_0x141b46[_0x4a7c53[_0xaa07('0x4b')][_0xaa07('0xc')][_0xaa07('0x46')]()]&&_0x4dd582['custom_fields'][_0xaa07('0x1e')]({'id':_0x4a7c53[_0xaa07('0x1f')],'value':_0x141b46[_0x4a7c53['Variable'][_0xaa07('0xc')]['toLowerCase']()][_0xaa07('0x27')]()});}});}return _0x4dd582;}function getConnection(_0x590135){return request({'method':_0xaa07('0xa'),'form':{'method':_0xaa07('0x4c'),'input_type':_0xaa07('0x21'),'response_type':_0xaa07('0x21'),'rest_data':JSON[_0xaa07('0x22')]({'user_auth':{'user_name':_0x590135['username'],'password':_0x590135['password'],'encryption':_0xaa07('0x4d')},'application':_0xaa07('0x4e')})}})[_0xaa07('0x2f')](function(_0x4778b6){var _0x4bf51d=_0x4778b6;if(_0x4bf51d['id']){def[_0xaa07('0x4f')]=_0x4bf51d['id'];return BPromise[_0xaa07('0x35')](_0x4bf51d);}else{throw new Error(util['format'](_0xaa07('0x50'),_0x590135['id']));}});}function setRelationship(_0x37ad04,_0x3e48b4,_0x287adc,_0x3ed4cc){return request({'form':{'method':_0xaa07('0x51'),'input_type':_0xaa07('0x21'),'response_type':_0xaa07('0x21'),'rest_data':JSON[_0xaa07('0x22')]({'session':_0x37ad04['id'],'module_name':_0xaa07('0x23'),'module_id':_0x287adc['id'],'link_field_name':_0x3ed4cc,'related_ids':[_0x3e48b4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xaa07('0x52')]=function(_0x217653,_0x107a80,_0x550dfd,_0x7be440,_0xc322b,_0x584bd2){var _0x324e5b,_0x226ee3,_0x39a8c5,_0x1b4a73;_0x584bd2[_0xaa07('0x53')]=intUtil[_0xaa07('0x54')](_0x584bd2[_0xaa07('0x53')]);_0x584bd2[_0xaa07('0x55')]=intUtil[_0xaa07('0x54')](_0x584bd2[_0xaa07('0x55')]);def[_0xaa07('0x56')]=util['format'](_0xaa07('0x57'),_0x584bd2[_0xaa07('0x53')]);if(_0xc322b&&_0xc322b[_0xaa07('0x58')]){logger[_0xaa07('0xb')]('[QUEUE]',_0xaa07('0x59'));_0x107a80['recordingURL']=util[_0xaa07('0x24')](_0xaa07('0x5a'),_0x584bd2[_0xaa07('0x55')],_0x107a80[_0xaa07('0x5b')],md5(_0x107a80['uniqueid']));}else{_0x107a80[_0xaa07('0x5c')]='';}return getConnection(_0x584bd2)[_0xaa07('0x2f')](function(_0x107c67){_0x1b4a73=_0x107c67;return getUser(_0x584bd2,_0x7be440[_0xaa07('0xc')],_0x1b4a73);})[_0xaa07('0x2f')](function(_0x20ccb8){_0x324e5b=_0x20ccb8;logger[_0xaa07('0xb')](_0xaa07('0x5d'),_0x324e5b['id']);return getEndUser(_0x584bd2,_0x107a80[_0xaa07('0x5e')],_0x107a80[_0xaa07('0x5f')],_0x1b4a73);})[_0xaa07('0x2f')](function(_0x1454e1){_0x226ee3=_0x1454e1;logger[_0xaa07('0xb')](_0xaa07('0x60'),_0x226ee3['id']);return getTicket(_0x584bd2,_0x324e5b,_0x226ee3,_0x550dfd,_0x107a80,_0x550dfd[_0xaa07('0x61')],_0x1b4a73,_0xaa07('0x62'));})['then'](function(_0x4c641f){_0x39a8c5=_0x4c641f;logger['info'](_0xaa07('0x63'));logger['info'](_0xaa07('0x64'),_0x39a8c5['id']);return setRelationship(_0x1b4a73,_0x324e5b,_0x39a8c5,_0xaa07('0x65'));})[_0xaa07('0x2f')](function(){return setRelationship(_0x1b4a73,_0x226ee3,_0x39a8c5,_0xaa07('0x66'));})[_0xaa07('0x2f')](function(){return getServerInfo(_0x1b4a73);})[_0xaa07('0x2f')](function(_0x1b9c3f){var _0x57c0bf=parseInt(_0x1b9c3f['version'][_0xaa07('0x67')](0x0));var _0x573c8c=util['format'](_0xaa07('0x68'),_0x584bd2[_0xaa07('0x53')],_0x39a8c5['id']);if(_0x57c0bf>0x6){_0x573c8c=util[_0xaa07('0x24')](_0xaa07('0x69'),_0x584bd2[_0xaa07('0x53')],_0x39a8c5['id']);}logger['info'](_0xaa07('0x6a'),_0xaa07('0x6b'));emit(util[_0xaa07('0x24')](_0xaa07('0x6c'),_0x7be440[_0xaa07('0xc')]),_0xaa07('0x6d'),{'uri':_0x573c8c});})['catch'](function(_0x3c92e1){logger[_0xaa07('0x6e')](_0xaa07('0x6a'),JSON[_0xaa07('0x22')](_0x3c92e1));});};exports[_0xaa07('0x6f')]=function(_0x53e298,_0x4ad6b0,_0x4f6c9c,_0x53ed02,_0x24e556,_0x16ae48,_0x183e2e){var _0x4cee68,_0x4ff6be,_0x5183e7,_0x453f80;_0x16ae48[_0xaa07('0x53')]=intUtil[_0xaa07('0x54')](_0x16ae48['remoteUri']);_0x16ae48[_0xaa07('0x55')]=intUtil[_0xaa07('0x54')](_0x16ae48['serverUrl']);def[_0xaa07('0x56')]=util[_0xaa07('0x24')](_0xaa07('0x57'),_0x16ae48[_0xaa07('0x53')]);if(_0x183e2e&&_0x183e2e[_0xaa07('0x70')]&&_0x183e2e['recordingFormat']!==_0xaa07('0x71')){logger[_0xaa07('0xb')](_0xaa07('0x72'),_0xaa07('0x59'));_0x4ad6b0[_0xaa07('0x5c')]=util[_0xaa07('0x24')](_0xaa07('0x5a'),_0x16ae48[_0xaa07('0x55')],_0x4ad6b0[_0xaa07('0x5b')],md5(_0x4ad6b0[_0xaa07('0x5b')]));}return getConnection(_0x16ae48)[_0xaa07('0x2f')](function(_0x25c92f){_0x453f80=_0x25c92f;return getUser(_0x16ae48,_0x53ed02[_0xaa07('0xc')],_0x453f80);})[_0xaa07('0x2f')](function(_0x230ee8){_0x4cee68=_0x230ee8;logger[_0xaa07('0xb')](_0xaa07('0x5d'),_0x4cee68['id']);return getEndUser(_0x16ae48,_0x4ad6b0[_0xaa07('0x73')],_0x4ad6b0['destcalleridnum'],_0x453f80);})[_0xaa07('0x2f')](function(_0x2f02e8){_0x4ff6be=_0x2f02e8;logger[_0xaa07('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4ff6be['id']);return getTicket(_0x16ae48,_0x4cee68,_0x4ff6be,_0x4f6c9c,_0x4ad6b0,_0x4f6c9c[_0xaa07('0x61')],_0x453f80,'Outbound');})[_0xaa07('0x2f')](function(_0xbb856b){_0x5183e7=_0xbb856b;logger[_0xaa07('0xb')](_0xaa07('0x63'));logger[_0xaa07('0xb')](_0xaa07('0x64'),_0x5183e7['id']);return setRelationship(_0x453f80,_0x4cee68,_0x5183e7,'users');})[_0xaa07('0x2f')](function(){return setRelationship(_0x453f80,_0x4ff6be,_0x5183e7,_0xaa07('0x66'));})[_0xaa07('0x2f')](function(){return getServerInfo(_0x453f80);})[_0xaa07('0x2f')](function(_0x16d008){var _0x3fc5c3=parseInt(_0x16d008[_0xaa07('0x74')][_0xaa07('0x67')](0x0));var _0x1c89d4=util[_0xaa07('0x24')](_0xaa07('0x68'),_0x16ae48['remoteUri'],_0x5183e7['id']);if(_0x3fc5c3>0x6){_0x1c89d4=util[_0xaa07('0x24')](_0xaa07('0x69'),_0x16ae48[_0xaa07('0x53')],_0x5183e7['id']);}logger[_0xaa07('0xb')](_0xaa07('0x72'),_0xaa07('0x6b'));emit(util[_0xaa07('0x24')](_0xaa07('0x6c'),_0x53ed02[_0xaa07('0xc')]),_0xaa07('0x6d'),{'uri':_0x1c89d4});})[_0xaa07('0x75')](function(_0x482f57){logger['error'](_0xaa07('0x72'),JSON[_0xaa07('0x22')](_0x482f57));});};exports['unmanaged']=function(_0x49b66e,_0x1d1589,_0x2cb9de,_0x1995cb,_0x1253a4,_0x42f20a){var _0xec423c,_0x37c4c0,_0x131dcd,_0x21c740;_0x42f20a[_0xaa07('0x53')]=intUtil[_0xaa07('0x54')](_0x42f20a[_0xaa07('0x53')]);_0x42f20a[_0xaa07('0x55')]=intUtil[_0xaa07('0x54')](_0x42f20a[_0xaa07('0x55')]);def[_0xaa07('0x56')]=util['format']('%s/service/v4_1/rest.php',_0x42f20a['remoteUri']);if(_0x1253a4&&_0x1253a4['monitor_format']){logger[_0xaa07('0xb')]('['+_0x1d1589[_0xaa07('0x76')][_0xaa07('0x77')]()+']',_0xaa07('0x59'));_0x1d1589['recordingURL']=util[_0xaa07('0x24')](_0xaa07('0x5a'),_0x42f20a['serverUrl'],_0x1d1589[_0xaa07('0x5b')],md5(_0x1d1589['uniqueid']));}else{_0x1d1589[_0xaa07('0x5c')]='';}return getConnection(_0x42f20a)[_0xaa07('0x2f')](function(_0x1e32a0){_0x21c740=_0x1e32a0;if(!_[_0xaa07('0x29')](_0x1995cb)){return getUser(_0x42f20a,_0x1995cb[_0xaa07('0xc')],_0x21c740);}else{return getUser(_0x42f20a,null,_0x21c740);}})[_0xaa07('0x2f')](function(_0x16e769){_0xec423c=_0x16e769;logger[_0xaa07('0xb')]('The\x20User\x20ID\x20is:',_0xec423c['id']);return getEndUser(_0x42f20a,_0x1d1589[_0xaa07('0x5e')],_0x1d1589[_0xaa07('0x5f')],_0x21c740);})['then'](function(_0x5db338){_0x37c4c0=_0x5db338;logger[_0xaa07('0xb')](_0xaa07('0x60'),_0x37c4c0['id']);return getTicket(_0x42f20a,_0xec423c,_0x37c4c0,_0x2cb9de,_0x1d1589,_0x2cb9de['Fields'],_0x21c740,_0xaa07('0x62'));})[_0xaa07('0x2f')](function(_0x4f97a3){_0x131dcd=_0x4f97a3;logger[_0xaa07('0xb')](_0xaa07('0x63'));logger[_0xaa07('0xb')](_0xaa07('0x64'),_0x131dcd['id']);return setRelationship(_0x21c740,_0xec423c,_0x131dcd,'users');})[_0xaa07('0x2f')](function(){return setRelationship(_0x21c740,_0x37c4c0,_0x131dcd,_0xaa07('0x66'));})[_0xaa07('0x2f')](function(){return getServerInfo(_0x21c740);})['catch'](function(_0xd729d){logger[_0xaa07('0x6e')]('['+_0x1d1589[_0xaa07('0x76')][_0xaa07('0x77')]()+']',JSON['stringify'](_0xd729d));});}; \ No newline at end of file +var _0xad50=['ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','toString','customField','custom_fields','content','variable','variableName','customVariable','Variable','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','version','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','Inbound','lodash','request-promise','bluebird','md5','util'];(function(_0x2b3934,_0x3fc5e8){var _0x45dfaf=function(_0x30a208){while(--_0x30a208){_0x2b3934['push'](_0x2b3934['shift']());}};_0x45dfaf(++_0x3fc5e8);}(_0xad50,0x16f));var _0x0ad5=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0xad50[_0x55c1f0];return _0x1530fa;};'use strict';var _=require(_0x0ad5('0x0'));var rp=require(_0x0ad5('0x1'));var BPromise=require(_0x0ad5('0x2'));var md5=require(_0x0ad5('0x3'));var util=require(_0x0ad5('0x4'));var Redis=require(_0x0ad5('0x5'));var intUtil=require(_0x0ad5('0x6'));var config=require(_0x0ad5('0x7'));var logger=require(_0x0ad5('0x8'))(_0x0ad5('0x9'));config[_0x0ad5('0xa')]=_[_0x0ad5('0xb')](config['redis'],{'host':_0x0ad5('0xc'),'port':0x18eb});var io=require(_0x0ad5('0xd'))(new Redis(config[_0x0ad5('0xa')]));var def={'method':_0x0ad5('0xe'),'json':!![]};function emit(_0x3c0e0b,_0x50dab5,_0x654cfa){io['to'](_0x3c0e0b)['emit'](_0x50dab5,_0x654cfa);}function getTicket(_0x164d35,_0x4ee4eb,_0x4768e9,_0x1f6834,_0x4b9eba,_0x64ddae,_0x6117d2,_0xe4e98e){logger[_0x0ad5('0xf')](_0x0ad5('0x10'));var _0x3073af=new Date();var _0x40eb8e=[{'name':_0x0ad5('0x11'),'value':intUtil['getString'](_0x1f6834[_0x0ad5('0x12')],_0x4b9eba,'\x20')},{'name':_0x0ad5('0x13'),'value':_0x4ee4eb['id']},{'name':_0x0ad5('0x14'),'value':_0x4ee4eb['id']},{'name':_0x0ad5('0x15'),'value':intUtil[_0x0ad5('0x16')](_0x1f6834[_0x0ad5('0x17')],_0x4b9eba,'\x0a')},{'name':'date_start','value':_0x3073af['toISOString']()[_0x0ad5('0x18')](0x0,0x13)['replace']('T','\x20')},{'name':_0x0ad5('0x19'),'value':'0'},{'name':_0x0ad5('0x1a'),'value':'15'},{'name':_0x0ad5('0x1b'),'value':_0x4768e9['id']},{'name':'parent_type','value':_0x0ad5('0x1c')},{'name':_0x0ad5('0x1d'),'value':_0x4768e9[_0x0ad5('0x11')]},{'name':_0x0ad5('0x1e'),'value':_0xe4e98e}];if(_0x64ddae[_0x0ad5('0x1f')]){_[_0x0ad5('0x20')](_0x64ddae,function(_0x3e2663){if(_0x4b9eba[_0x3e2663['variableName']]){_0x40eb8e[_0x0ad5('0x21')]({'name':_0x3e2663[_0x0ad5('0x22')],'value':_0x4b9eba[_0x3e2663['variableName']]});}});}return request({'form':{'method':_0x0ad5('0x23'),'input_type':_0x0ad5('0x24'),'response_type':_0x0ad5('0x24'),'rest_data':JSON[_0x0ad5('0x25')]({'session':_0x6117d2['id'],'module_name':_0x0ad5('0x26'),'name_value_list':_0x40eb8e})}});}function getAuth(_0x5e9d07){return util[_0x0ad5('0x27')](_0x0ad5('0x28'),new Buffer(_0x5e9d07[_0x0ad5('0x29')]+':X')['toString'](_0x0ad5('0x2a')));}function getServerInfo(_0x1faf4d){return request({'form':{'method':_0x0ad5('0x2b'),'input_type':_0x0ad5('0x24'),'response_type':_0x0ad5('0x24'),'rest_data':JSON['stringify']({'session':_0x1faf4d['id']})}});}function getUser(_0x4b6c81,_0x2b5ce8,_0x3d37cc){if(!_[_0x0ad5('0x2c')](_0x2b5ce8)){logger[_0x0ad5('0xf')]('Getting\x20agent\x20with\x20name',_0x2b5ce8);return request({'form':{'method':'get_entry_list','input_type':_0x0ad5('0x24'),'response_type':_0x0ad5('0x24'),'rest_data':JSON['stringify']({'session':_0x3d37cc['id'],'module_name':_0x0ad5('0x2d'),'query':util[_0x0ad5('0x27')](_0x0ad5('0x2e'),_0x2b5ce8),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0ad5('0x2f')](function(_0x144e20){if(_0x144e20['entry_list']['length']){var _0x21d233=_['find'](_0x144e20['entry_list'],function(_0x196053){return _0x196053[_0x0ad5('0x30')][_0x0ad5('0x31')][_0x0ad5('0x32')]===_0x2b5ce8;});if(_0x21d233){logger[_0x0ad5('0xf')](_0x0ad5('0x33'));return BPromise[_0x0ad5('0x34')]({'id':_0x21d233[_0x0ad5('0x30')]['id'][_0x0ad5('0x32')],'name':_0x21d233[_0x0ad5('0x30')][_0x0ad5('0x11')][_0x0ad5('0x32')]});}}logger[_0x0ad5('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3d37cc['name_value_list'][_0x0ad5('0x35')][_0x0ad5('0x32')],'name':_0x3d37cc['name_value_list'][_0x0ad5('0x31')][_0x0ad5('0x32')]});});}else{logger['info'](_0x0ad5('0x36'));return BPromise[_0x0ad5('0x34')]({'id':_0x3d37cc['name_value_list']['user_id'][_0x0ad5('0x32')],'name':_0x3d37cc['name_value_list'][_0x0ad5('0x31')][_0x0ad5('0x32')]});}}function getEndUser(_0x847b9f,_0x9309,_0x599ea3,_0x9ee9b0){logger['info'](_0x0ad5('0x37'),_0x599ea3);return request({'form':{'method':'get_entry_list','input_type':_0x0ad5('0x24'),'response_type':_0x0ad5('0x24'),'rest_data':JSON[_0x0ad5('0x25')]({'session':_0x9ee9b0['id'],'module_name':_0x0ad5('0x1c'),'query':util[_0x0ad5('0x27')](_0x0ad5('0x38'),_0x599ea3),'order_by':'','offset':'0','select_fields':['id',_0x0ad5('0x11'),_0x0ad5('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x273c30){if(_0x273c30[_0x0ad5('0x3a')][_0x0ad5('0x1f')]){var _0x5c2b78=_['find'](_0x273c30[_0x0ad5('0x3a')],function(_0x37fb76){return _0x37fb76[_0x0ad5('0x30')]['phone_home'][_0x0ad5('0x32')]===_0x599ea3;});if(_0x5c2b78){logger[_0x0ad5('0xf')](_0x0ad5('0x3b'));return BPromise['resolve']({'id':_0x5c2b78[_0x0ad5('0x30')]['id'][_0x0ad5('0x32')],'name':_0x5c2b78[_0x0ad5('0x30')][_0x0ad5('0x11')][_0x0ad5('0x32')],'phone':_0x5c2b78[_0x0ad5('0x30')]['phone_home']['value']});}}else{logger[_0x0ad5('0xf')](_0x0ad5('0x3c'));return request({'form':{'method':_0x0ad5('0x23'),'input_type':_0x0ad5('0x24'),'response_type':_0x0ad5('0x24'),'rest_data':JSON[_0x0ad5('0x25')]({'session':_0x9ee9b0['id'],'module_name':_0x0ad5('0x1c'),'name_value_list':[{'name':'first_name','value':_0x9309!==_0x0ad5('0x3d')?_0x9309:util[_0x0ad5('0x27')](_0x0ad5('0x3e'),_0x599ea3)},{'name':_0x0ad5('0x39'),'value':_0x599ea3}]})}})[_0x0ad5('0x2f')](function(_0xc93787){logger[_0x0ad5('0xf')](_0x0ad5('0x3f'));return BPromise[_0x0ad5('0x34')]({'id':_0xc93787['id'],'name':_0xc93787[_0x0ad5('0x3a')]['first_name'][_0x0ad5('0x32')],'phone':_0xc93787[_0x0ad5('0x3a')][_0x0ad5('0x39')]['value']});});}});}function request(_0x38da37){logger[_0x0ad5('0x40')](_0x0ad5('0x41'),JSON[_0x0ad5('0x25')](_0x38da37));return rp(_[_0x0ad5('0x42')](def,_0x38da37));}function getTags(_0x40b095,_0x90ec14){var _0x2295fa=[];if(_0x40b095&&_0x40b095[_0x0ad5('0x1f')]>0x0){_0x2295fa=_[_0x0ad5('0x43')](_0x40b095,_0x90ec14);}return _0x2295fa;}function getCustomFields(_0x19bea3,_0x617cfe){var _0x3af97f=[];var _0x81a58b={'custom_fields':[]};if(_0x19bea3['length']>0x0){_[_0x0ad5('0x20')](_0x19bea3,function(_0xc47545){if(_0xc47545[_0x0ad5('0x44')]===_0x0ad5('0x45')&&_0xc47545[_0x0ad5('0x46')]&&!_0xc47545['customField']){_0x81a58b[_0xc47545[_0x0ad5('0x46')][_0x0ad5('0x47')]()]=_0xc47545['content'][_0x0ad5('0x48')]();}else if(_0xc47545[_0x0ad5('0x44')]===_0x0ad5('0x45')&&_0xc47545[_0x0ad5('0x22')]&&_0xc47545[_0x0ad5('0x49')]){_0x81a58b[_0x0ad5('0x4a')][_0x0ad5('0x21')]({'id':_0xc47545['idField'],'value':_0xc47545[_0x0ad5('0x4b')]['toString']()});}else if(_0xc47545[_0x0ad5('0x44')]===_0x0ad5('0x4c')&&_0xc47545['variableName']&&_0xc47545['idField']&&_0xc47545['customField']){_0x617cfe[_0xc47545[_0x0ad5('0x4d')]]&&_0x81a58b[_0x0ad5('0x4a')][_0x0ad5('0x21')]({'id':_0xc47545[_0x0ad5('0x22')],'value':_0x617cfe[_0xc47545['variableName']]['toString']()});}else if(_0xc47545['type']===_0x0ad5('0x4e')&&_0xc47545[_0x0ad5('0x4f')]&&_0xc47545[_0x0ad5('0x4f')][_0x0ad5('0x11')]&&_0xc47545['idField']&&_0xc47545[_0x0ad5('0x49')]){_0x617cfe[_0xc47545[_0x0ad5('0x4f')][_0x0ad5('0x11')][_0x0ad5('0x47')]()]&&_0x81a58b[_0x0ad5('0x4a')][_0x0ad5('0x21')]({'id':_0xc47545[_0x0ad5('0x22')],'value':_0x617cfe[_0xc47545[_0x0ad5('0x4f')][_0x0ad5('0x11')]['toLowerCase']()][_0x0ad5('0x48')]()});}});}return _0x81a58b;}function getConnection(_0x4acc89){return request({'method':_0x0ad5('0xe'),'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0ad5('0x25')]({'user_auth':{'user_name':_0x4acc89[_0x0ad5('0x50')],'password':_0x4acc89[_0x0ad5('0x51')],'encryption':_0x0ad5('0x52')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x0ad5('0x2f')](function(_0x17cf24){var _0x381102=_0x17cf24;if(_0x381102['id']){def[_0x0ad5('0x53')]=_0x381102['id'];return BPromise[_0x0ad5('0x34')](_0x381102);}else{throw new Error(util[_0x0ad5('0x27')](_0x0ad5('0x54'),_0x4acc89['id']));}});}function setRelationship(_0x3bcd1e,_0x40fdd8,_0x276e01,_0x1b84ee){return request({'form':{'method':'set_relationship','input_type':_0x0ad5('0x24'),'response_type':_0x0ad5('0x24'),'rest_data':JSON['stringify']({'session':_0x3bcd1e['id'],'module_name':_0x0ad5('0x26'),'module_id':_0x276e01['id'],'link_field_name':_0x1b84ee,'related_ids':[_0x40fdd8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0ad5('0x55')]=function(_0x42caf3,_0x41762e,_0x57caab,_0x22e240,_0x390162,_0x1d468c){var _0x14dff6,_0x4cd387,_0x2f7e06,_0x59b2be;_0x1d468c[_0x0ad5('0x56')]=intUtil['stripTrailingSlash'](_0x1d468c[_0x0ad5('0x56')]);_0x1d468c[_0x0ad5('0x57')]=intUtil['stripTrailingSlash'](_0x1d468c['serverUrl']);def[_0x0ad5('0x58')]=util[_0x0ad5('0x27')]('%s/service/v4_1/rest.php',_0x1d468c[_0x0ad5('0x56')]);if(_0x390162&&_0x390162[_0x0ad5('0x59')]){logger[_0x0ad5('0xf')](_0x0ad5('0x5a'),_0x0ad5('0x5b'));_0x41762e[_0x0ad5('0x5c')]=util[_0x0ad5('0x27')](_0x0ad5('0x5d'),_0x1d468c[_0x0ad5('0x57')],_0x41762e[_0x0ad5('0x5e')],md5(_0x41762e['uniqueid']));}else{_0x41762e[_0x0ad5('0x5c')]='';}return getConnection(_0x1d468c)['then'](function(_0x4a4842){_0x59b2be=_0x4a4842;return getUser(_0x1d468c,_0x22e240[_0x0ad5('0x11')],_0x59b2be);})[_0x0ad5('0x2f')](function(_0x55c0d7){_0x14dff6=_0x55c0d7;logger[_0x0ad5('0xf')]('The\x20User\x20ID\x20is:',_0x14dff6['id']);return getEndUser(_0x1d468c,_0x41762e[_0x0ad5('0x5f')],_0x41762e[_0x0ad5('0x60')],_0x59b2be);})[_0x0ad5('0x2f')](function(_0x3c224e){_0x4cd387=_0x3c224e;logger[_0x0ad5('0xf')]('The\x20Enduser\x20ID\x20is:',_0x4cd387['id']);return getTicket(_0x1d468c,_0x14dff6,_0x4cd387,_0x57caab,_0x41762e,_0x57caab[_0x0ad5('0x61')],_0x59b2be,'Inbound');})['then'](function(_0x17a6a3){_0x2f7e06=_0x17a6a3;logger['info']('Ticket\x20created!');logger[_0x0ad5('0xf')](_0x0ad5('0x62'),_0x2f7e06['id']);return setRelationship(_0x59b2be,_0x14dff6,_0x2f7e06,_0x0ad5('0x63'));})['then'](function(){return setRelationship(_0x59b2be,_0x4cd387,_0x2f7e06,_0x0ad5('0x64'));})[_0x0ad5('0x2f')](function(){return getServerInfo(_0x59b2be);})['then'](function(_0x344119){var _0x15ba9d=parseInt(_0x344119['version'][_0x0ad5('0x65')](0x0));var _0x35fa68=util[_0x0ad5('0x27')](_0x0ad5('0x66'),_0x1d468c[_0x0ad5('0x56')],_0x2f7e06['id']);if(_0x15ba9d>0x6){_0x35fa68=util['format'](_0x0ad5('0x67'),_0x1d468c[_0x0ad5('0x56')],_0x2f7e06['id']);}logger[_0x0ad5('0xf')](_0x0ad5('0x5a'),_0x0ad5('0x68'));emit(util[_0x0ad5('0x27')](_0x0ad5('0x69'),_0x22e240[_0x0ad5('0x11')]),'trigger:browser:url',{'uri':_0x35fa68});})[_0x0ad5('0x6a')](function(_0x49322d){logger[_0x0ad5('0x6b')]('[QUEUE]',JSON[_0x0ad5('0x25')](_0x49322d));});};exports[_0x0ad5('0x6c')]=function(_0x3ad85f,_0x45ef4e,_0x38a9d3,_0x297ded,_0x1ef436,_0xab1ab0,_0x3354ce){var _0x2c0c41,_0x1ee917,_0x207121,_0x54534d;_0xab1ab0[_0x0ad5('0x56')]=intUtil[_0x0ad5('0x6d')](_0xab1ab0[_0x0ad5('0x56')]);_0xab1ab0[_0x0ad5('0x57')]=intUtil['stripTrailingSlash'](_0xab1ab0[_0x0ad5('0x57')]);def[_0x0ad5('0x58')]=util[_0x0ad5('0x27')](_0x0ad5('0x6e'),_0xab1ab0[_0x0ad5('0x56')]);if(_0x3354ce&&_0x3354ce[_0x0ad5('0x6f')]&&_0x3354ce[_0x0ad5('0x6f')]!==_0x0ad5('0x70')){logger[_0x0ad5('0xf')](_0x0ad5('0x71'),'Recording\x20is\x20enabled!');_0x45ef4e['recordingURL']=util['format'](_0x0ad5('0x5d'),_0xab1ab0[_0x0ad5('0x57')],_0x45ef4e[_0x0ad5('0x5e')],md5(_0x45ef4e[_0x0ad5('0x5e')]));}return getConnection(_0xab1ab0)['then'](function(_0x4d5072){_0x54534d=_0x4d5072;return getUser(_0xab1ab0,_0x297ded[_0x0ad5('0x11')],_0x54534d);})[_0x0ad5('0x2f')](function(_0x5d86e6){_0x2c0c41=_0x5d86e6;logger['info'](_0x0ad5('0x72'),_0x2c0c41['id']);return getEndUser(_0xab1ab0,_0x45ef4e[_0x0ad5('0x73')],_0x45ef4e[_0x0ad5('0x74')],_0x54534d);})['then'](function(_0x3e27c9){_0x1ee917=_0x3e27c9;logger[_0x0ad5('0xf')]('The\x20Enduser\x20ID\x20is:',_0x1ee917['id']);return getTicket(_0xab1ab0,_0x2c0c41,_0x1ee917,_0x38a9d3,_0x45ef4e,_0x38a9d3[_0x0ad5('0x61')],_0x54534d,_0x0ad5('0x75'));})['then'](function(_0x30bdf1){_0x207121=_0x30bdf1;logger['info']('Ticket\x20created!');logger[_0x0ad5('0xf')]('The\x20Ticket\x20ID\x20is:',_0x207121['id']);return setRelationship(_0x54534d,_0x2c0c41,_0x207121,_0x0ad5('0x63'));})[_0x0ad5('0x2f')](function(){return setRelationship(_0x54534d,_0x1ee917,_0x207121,_0x0ad5('0x64'));})[_0x0ad5('0x2f')](function(){return getServerInfo(_0x54534d);})['then'](function(_0xcbdbdb){var _0x599228=parseInt(_0xcbdbdb[_0x0ad5('0x76')]['charAt'](0x0));var _0x3ab108=util[_0x0ad5('0x27')](_0x0ad5('0x66'),_0xab1ab0[_0x0ad5('0x56')],_0x207121['id']);if(_0x599228>0x6){_0x3ab108=util[_0x0ad5('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xab1ab0[_0x0ad5('0x56')],_0x207121['id']);}logger['info']('[OUTBOUND]',_0x0ad5('0x68'));emit(util[_0x0ad5('0x27')](_0x0ad5('0x69'),_0x297ded[_0x0ad5('0x11')]),'trigger:browser:url',{'uri':_0x3ab108});})[_0x0ad5('0x6a')](function(_0x3a61ab){logger['error'](_0x0ad5('0x71'),JSON[_0x0ad5('0x25')](_0x3a61ab));});};exports[_0x0ad5('0x77')]=function(_0xcfe2e9,_0x367aa3,_0x4fe02b,_0x110404,_0x1abc79,_0x2c2f6f){var _0xebd4a6,_0x58c2a7,_0x35e523,_0x2e0238;_0x2c2f6f[_0x0ad5('0x56')]=intUtil[_0x0ad5('0x6d')](_0x2c2f6f[_0x0ad5('0x56')]);_0x2c2f6f[_0x0ad5('0x57')]=intUtil['stripTrailingSlash'](_0x2c2f6f[_0x0ad5('0x57')]);def[_0x0ad5('0x58')]=util[_0x0ad5('0x27')]('%s/service/v4_1/rest.php',_0x2c2f6f[_0x0ad5('0x56')]);if(_0x1abc79&&_0x1abc79[_0x0ad5('0x59')]){logger[_0x0ad5('0xf')]('['+_0x367aa3[_0x0ad5('0x78')][_0x0ad5('0x79')]()+']',_0x0ad5('0x5b'));_0x367aa3[_0x0ad5('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c2f6f[_0x0ad5('0x57')],_0x367aa3['uniqueid'],md5(_0x367aa3['uniqueid']));}else{_0x367aa3['recordingURL']='';}return getConnection(_0x2c2f6f)[_0x0ad5('0x2f')](function(_0x354ec6){_0x2e0238=_0x354ec6;if(!_[_0x0ad5('0x2c')](_0x110404)){return getUser(_0x2c2f6f,_0x110404[_0x0ad5('0x11')],_0x2e0238);}else{return getUser(_0x2c2f6f,null,_0x2e0238);}})[_0x0ad5('0x2f')](function(_0x340d3b){_0xebd4a6=_0x340d3b;logger[_0x0ad5('0xf')]('The\x20User\x20ID\x20is:',_0xebd4a6['id']);return getEndUser(_0x2c2f6f,_0x367aa3[_0x0ad5('0x5f')],_0x367aa3[_0x0ad5('0x60')],_0x2e0238);})[_0x0ad5('0x2f')](function(_0xf8e5da){_0x58c2a7=_0xf8e5da;logger[_0x0ad5('0xf')](_0x0ad5('0x7a'),_0x58c2a7['id']);return getTicket(_0x2c2f6f,_0xebd4a6,_0x58c2a7,_0x4fe02b,_0x367aa3,_0x4fe02b[_0x0ad5('0x61')],_0x2e0238,_0x0ad5('0x7b'));})[_0x0ad5('0x2f')](function(_0x4f6348){_0x35e523=_0x4f6348;logger[_0x0ad5('0xf')]('Ticket\x20created!');logger['info'](_0x0ad5('0x62'),_0x35e523['id']);return setRelationship(_0x2e0238,_0xebd4a6,_0x35e523,_0x0ad5('0x63'));})['then'](function(){return setRelationship(_0x2e0238,_0x58c2a7,_0x35e523,'contacts');})['then'](function(){return getServerInfo(_0x2e0238);})[_0x0ad5('0x6a')](function(_0x27f3f4){logger[_0x0ad5('0x6b')]('['+_0x367aa3[_0x0ad5('0x78')]['toUpperCase']()+']',JSON[_0x0ad5('0x25')](_0x27f3f4));});}; \ 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 e223ed2..e4cc36b 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 _0x21cb=['format','keyContent','keyType','slice','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','string','push','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key'];(function(_0x64bef1,_0x5841ee){var _0x32a991=function(_0x5f5c4a){while(--_0x5f5c4a){_0x64bef1['push'](_0x64bef1['shift']());}};_0x32a991(++_0x5841ee);}(_0x21cb,0x1a5));var _0xb21c=function(_0x5d5a38,_0x4cfe6d){_0x5d5a38=_0x5d5a38-0x0;var _0x2f3fd2=_0x21cb[_0x5d5a38];return _0x2f3fd2;};'use strict';var _=require(_0xb21c('0x0'));var util=require(_0xb21c('0x1'));exports[_0xb21c('0x2')]=function(_0x443605,_0x4fe702,_0xffd6e9){var _0x29ea93=[];if(_0x443605[_0xb21c('0x3')]>0x0){var _0x3d900f=_['sortBy'](_0x443605,['id']);for(var _0x1e5f36=0x0;_0x1e5f36<_0x3d900f[_0xb21c('0x3')];_0x1e5f36++){var _0x17f110=_0x3d900f[_0x1e5f36];if(_0x17f110['type']===_0xb21c('0x4')){_0x29ea93[_0xb21c('0x5')](_0x17f110[_0xb21c('0x6')]);}else if(_0x17f110[_0xb21c('0x7')]==='variable'&&_0x17f110[_0xb21c('0x8')]){_0x4fe702[_0x17f110[_0xb21c('0x8')]]&&_0x29ea93['push'](_0x4fe702[_0x17f110[_0xb21c('0x8')]][_0xb21c('0x9')]());}else if(_0x17f110[_0xb21c('0x7')]===_0xb21c('0xa')&&_0x17f110[_0xb21c('0xb')]&&_0x17f110[_0xb21c('0xb')][_0xb21c('0xc')]){_0x4fe702[_0x17f110[_0xb21c('0xb')]['name']['toLowerCase']()]&&_0x29ea93[_0xb21c('0x5')](_0x4fe702[_0x17f110['Variable'][_0xb21c('0xc')][_0xb21c('0xd')]()]['toString']());}else if(_0x17f110[_0xb21c('0x7')]===_0xb21c('0xe')){if(_0x17f110['keyType']==='string'&&_0x17f110[_0xb21c('0xf')]){_0x29ea93[_0xb21c('0x5')](util[_0xb21c('0x10')]('%s:\x20%s',_0x17f110[_0xb21c('0xf')],_0x17f110[_0xb21c('0x11')]));}else if(_0x17f110[_0xb21c('0x12')]==='variable'&&_0x17f110[_0xb21c('0x8')]&&_0x17f110[_0xb21c('0xf')]){_0x4fe702[_0x17f110[_0xb21c('0x8')]]&&_0x29ea93[_0xb21c('0x5')](util[_0xb21c('0x10')]('%s:\x20%s',_0x17f110[_0xb21c('0xf')],_0x4fe702[_0x17f110[_0xb21c('0x8')]]));}else if(_0x17f110[_0xb21c('0x12')]==='customVariable'&&_0x17f110['Variable']&&_0x17f110[_0xb21c('0xb')]['name']&&_0x17f110[_0xb21c('0xf')]){_0x4fe702[_0x17f110[_0xb21c('0xb')][_0xb21c('0xc')][_0xb21c('0xd')]()]&&_0x29ea93['push'](util[_0xb21c('0x10')]('%s:\x20%s',_0x17f110[_0xb21c('0xf')],_0x4fe702[_0x17f110[_0xb21c('0xb')][_0xb21c('0xc')][_0xb21c('0xd')]()]));}}}}return _0x29ea93['join'](_0xffd6e9);};exports['stripTrailingSlash']=function(_0x5974d2){var _0x47697b=_0x5974d2[_0xb21c('0x13')](-0x1);if(_0x47697b==='/'){_0x5974d2=_0x5974d2['substring'](0x0,_0x5974d2[_0xb21c('0x14')](_0x47697b));}return _0x5974d2;};exports[_0xb21c('0x15')]=function(_0x2a0790){if(!_[_0xb21c('0x16')](_0x2a0790)&&_0x2a0790!==''){var _0xc4ba32=/^(([^<>()\[\]\\.,;:\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 _0xc4ba32['test'](String(_0x2a0790)[_0xb21c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x6417=['key','keyContent','variableName','%s:\x20%s','keyType','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variable','toString','Variable','name','toLowerCase','keyValue','format'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6417,0xfe));var _0x7641=function(_0x504568,_0x1e220f){_0x504568=_0x504568-0x0;var _0x3ef6d7=_0x6417[_0x504568];return _0x3ef6d7;};'use strict';var _=require(_0x7641('0x0'));var util=require(_0x7641('0x1'));exports[_0x7641('0x2')]=function(_0x120261,_0x1ea9e2,_0x1fefaa){var _0xaefdf=[];if(_0x120261[_0x7641('0x3')]>0x0){var _0x1cf206=_[_0x7641('0x4')](_0x120261,['id']);for(var _0xa86e61=0x0;_0xa86e61<_0x1cf206[_0x7641('0x3')];_0xa86e61++){var _0x45bfee=_0x1cf206[_0xa86e61];if(_0x45bfee[_0x7641('0x5')]===_0x7641('0x6')){_0xaefdf[_0x7641('0x7')](_0x45bfee[_0x7641('0x8')]);}else if(_0x45bfee['type']===_0x7641('0x9')&&_0x45bfee['variableName']){_0x1ea9e2[_0x45bfee['variableName']]&&_0xaefdf[_0x7641('0x7')](_0x1ea9e2[_0x45bfee['variableName']][_0x7641('0xa')]());}else if(_0x45bfee[_0x7641('0x5')]==='customVariable'&&_0x45bfee[_0x7641('0xb')]&&_0x45bfee[_0x7641('0xb')][_0x7641('0xc')]){_0x1ea9e2[_0x45bfee[_0x7641('0xb')][_0x7641('0xc')][_0x7641('0xd')]()]&&_0xaefdf[_0x7641('0x7')](_0x1ea9e2[_0x45bfee[_0x7641('0xb')][_0x7641('0xc')][_0x7641('0xd')]()][_0x7641('0xa')]());}else if(_0x45bfee['type']===_0x7641('0xe')){if(_0x45bfee['keyType']==='string'&&_0x45bfee['key']){_0xaefdf['push'](util[_0x7641('0xf')]('%s:\x20%s',_0x45bfee[_0x7641('0x10')],_0x45bfee[_0x7641('0x11')]));}else if(_0x45bfee['keyType']===_0x7641('0x9')&&_0x45bfee[_0x7641('0x12')]&&_0x45bfee[_0x7641('0x10')]){_0x1ea9e2[_0x45bfee[_0x7641('0x12')]]&&_0xaefdf[_0x7641('0x7')](util[_0x7641('0xf')](_0x7641('0x13'),_0x45bfee[_0x7641('0x10')],_0x1ea9e2[_0x45bfee[_0x7641('0x12')]]));}else if(_0x45bfee[_0x7641('0x14')]===_0x7641('0x15')&&_0x45bfee['Variable']&&_0x45bfee[_0x7641('0xb')][_0x7641('0xc')]&&_0x45bfee[_0x7641('0x10')]){_0x1ea9e2[_0x45bfee['Variable'][_0x7641('0xc')]['toLowerCase']()]&&_0xaefdf[_0x7641('0x7')](util[_0x7641('0xf')](_0x7641('0x13'),_0x45bfee['key'],_0x1ea9e2[_0x45bfee['Variable'][_0x7641('0xc')][_0x7641('0xd')]()]));}}}}return _0xaefdf[_0x7641('0x16')](_0x1fefaa);};exports[_0x7641('0x17')]=function(_0x550176){var _0x35928d=_0x550176[_0x7641('0x18')](-0x1);if(_0x35928d==='/'){_0x550176=_0x550176[_0x7641('0x19')](0x0,_0x550176[_0x7641('0x1a')](_0x35928d));}return _0x550176;};exports[_0x7641('0x1b')]=function(_0x4ea9eb){if(!_[_0x7641('0x1c')](_0x4ea9eb)&&_0x4ea9eb!==''){var _0xe5f8b6=/^(([^<>()\[\]\\.,;:\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 _0xe5f8b6[_0x7641('0x1d')](String(_0x4ea9eb)[_0x7641('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index f407458..ceecd02 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _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(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 103aecd..fe1f172 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 _0x04cf=['user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/search.json','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','%s/users/me.json','Admin\x20account\x20selected.'];(function(_0x5381ca,_0x3b09fd){var _0x545d09=function(_0x9c03c7){while(--_0x9c03c7){_0x5381ca['push'](_0x5381ca['shift']());}};_0x545d09(++_0x3b09fd);}(_0x04cf,0xb9));var _0xf04c=function(_0x46f3b4,_0x26f2c6){_0x46f3b4=_0x46f3b4-0x0;var _0x641ca8=_0x04cf[_0x46f3b4];return _0x641ca8;};'use strict';var _=require(_0xf04c('0x0'));var rp=require('request-promise');var md5=require(_0xf04c('0x1'));var util=require(_0xf04c('0x2'));var Redis=require(_0xf04c('0x3'));var intUtil=require('./util');var config=require(_0xf04c('0x4'));var logger=require(_0xf04c('0x5'))(_0xf04c('0x6'));config['redis']=_[_0xf04c('0x7')](config[_0xf04c('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf04c('0x9'))(new Redis(config[_0xf04c('0x8')]));function emit(_0x58d4ab,_0x37eef1,_0x2151c3){io['to'](_0x58d4ab)['emit'](_0x37eef1,_0x2151c3);}var headers={'Content-Type':'application/json','Accept':_0xf04c('0xa')};function getTicket(_0x191075,_0x5187f7,_0x463d10,_0x284e85,_0x32e4f0){logger[_0xf04c('0xb')](_0xf04c('0xc'));return request({'uri':util[_0xf04c('0xd')](_0xf04c('0xe'),_0x191075[_0xf04c('0xf')]),'method':_0xf04c('0x10'),'body':{'ticket':_[_0xf04c('0x11')]({'requester_id':_0x463d10['id'],'submitter_id':_0x5187f7?_0x5187f7['id']:undefined,'assignee_id':_0x5187f7?_0x5187f7['id']:undefined,'tags':getTags(_0x284e85[_0xf04c('0x12')],'name'),'subject':intUtil[_0xf04c('0x13')](_0x284e85[_0xf04c('0x14')],_0x32e4f0,'\x20'),'description':intUtil['getString'](_0x284e85[_0xf04c('0x15')],_0x32e4f0,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf04c('0x13')](_0x284e85['Descriptions'],_0x32e4f0,'\x0a')}},getCustomFields(_0x284e85[_0xf04c('0x16')],_0x32e4f0))}})[_0xf04c('0x17')](function(_0x114a6c){logger[_0xf04c('0xb')](_0xf04c('0x18'));return _0x114a6c[_0xf04c('0x19')];});}function getUser(_0x4fa9d4,_0x5b9f1a){if(intUtil[_0xf04c('0x1a')](_0x5b9f1a)){logger[_0xf04c('0xb')](_0xf04c('0x1b'),_0x5b9f1a);return request({'uri':util[_0xf04c('0xd')]('%s/search.json',_0x4fa9d4['remoteUri']),'qs':{'query':util[_0xf04c('0xd')](_0xf04c('0x1c'),_0x5b9f1a)}})['then'](function(_0x48a9fa){if(_0x48a9fa[_0xf04c('0x1d')]){logger['info'](_0xf04c('0x1e'));return _[_0xf04c('0x1f')](_0x48a9fa[_0xf04c('0x20')],{'email':_0x5b9f1a,'role':'agent'});}else{logger[_0xf04c('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf04c('0xd')](_0xf04c('0x21'),_0x4fa9d4[_0xf04c('0xf')])})[_0xf04c('0x17')](function(_0x144314){logger['info'](_0xf04c('0x22'));return _0x144314[_0xf04c('0x23')];});}});}else{logger[_0xf04c('0xb')](_0xf04c('0x24'));return request({'uri':util['format'](_0xf04c('0x21'),_0x4fa9d4['remoteUri'])})['then'](function(_0x3d2dcc){logger['info'](_0xf04c('0x22'));return _0x3d2dcc['user'];});}}function getEndUser(_0x35a3e4,_0x53a8a7,_0x1caeb4){logger[_0xf04c('0xb')]('Searching\x20enduser\x20with\x20phone',_0x1caeb4);return request({'uri':util[_0xf04c('0xd')](_0xf04c('0x25'),_0x35a3e4[_0xf04c('0xf')]),'qs':{'query':util[_0xf04c('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x1caeb4)}})[_0xf04c('0x17')](function(_0x451075){var _0x45e5b0;if(_0x451075['results'][_0xf04c('0x26')]){_0x451075[_0xf04c('0x20')]=_[_0xf04c('0x27')](_0x451075[_0xf04c('0x20')],{'suspended':![],'role':_0xf04c('0x28')});if(_0x451075['results']['length']){_0x45e5b0=_['first'](_0x451075[_0xf04c('0x20')]);}}if(_0x45e5b0){logger['info'](_0xf04c('0x29'));return _0x45e5b0;}else{logger[_0xf04c('0xb')](_0xf04c('0x2a'));return request({'uri':util['format']('%s/users.json',_0x35a3e4[_0xf04c('0xf')]),'method':_0xf04c('0x10'),'body':{'user':{'role':_0xf04c('0x28'),'name':util[_0xf04c('0xd')](_0xf04c('0x2b'),_0x53a8a7||_0x1caeb4),'phone':_0x1caeb4}}})[_0xf04c('0x17')](function(_0x22e54d){logger['info']('Enduser\x20created.');return _0x22e54d[_0xf04c('0x23')];});}});}function getAuth(_0x5573d0){var _0x5c0ac1;if(_0x5573d0['authType']==='password'){_0x5c0ac1=util[_0xf04c('0xd')]('%s:%s',_0x5573d0[_0xf04c('0x2c')],_0x5573d0[_0xf04c('0x2d')]);}else if(_0x5573d0['authType']===_0xf04c('0x2e')){_0x5c0ac1=util[_0xf04c('0xd')](_0xf04c('0x2f'),_0x5573d0[_0xf04c('0x2c')],_0x5573d0['token']);}return util[_0xf04c('0xd')](_0xf04c('0x30'),new Buffer(_0x5c0ac1)[_0xf04c('0x31')](_0xf04c('0x32')));}function request(_0x12055a){logger[_0xf04c('0x33')](_0xf04c('0x34'),JSON['stringify'](_0x12055a));return rp(_['defaults'](_0x12055a,{'method':_0xf04c('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x449ce3,_0x17e22c){var _0x59698f=[];if(_0x449ce3&&_0x449ce3[_0xf04c('0x26')]>0x0){_0x59698f=_[_0xf04c('0x36')](_0x449ce3,_0x17e22c);}return _0x59698f;}function getCustomFields(_0x2fd234,_0x1a6d76){var _0x67651=[];var _0x486ea3={'custom_fields':[]};if(_0x2fd234[_0xf04c('0x26')]>0x0){_['forEach'](_0x2fd234,function(_0xeaf0d2){if(_[_0xf04c('0x37')]([_0xf04c('0x38'),_0xf04c('0x39')],_0xeaf0d2[_0xf04c('0x3a')])&&_0xeaf0d2[_0xf04c('0x3b')]&&!_0xeaf0d2[_0xf04c('0x3c')]){_0x486ea3[_0xeaf0d2[_0xf04c('0x3b')][_0xf04c('0x3d')]()]=_0xeaf0d2[_0xf04c('0x3e')][_0xf04c('0x31')]();}else if(_[_0xf04c('0x37')]([_0xf04c('0x38'),_0xf04c('0x39')],_0xeaf0d2['type'])&&_0xeaf0d2[_0xf04c('0x3f')]&&_0xeaf0d2[_0xf04c('0x3c')]){_0x486ea3[_0xf04c('0x40')][_0xf04c('0x41')]({'id':_0xeaf0d2[_0xf04c('0x3f')],'value':_0xeaf0d2[_0xf04c('0x3e')]['toString']()});}else if(_0xeaf0d2['type']===_0xf04c('0x42')&&_0xeaf0d2[_0xf04c('0x43')]&&_0xeaf0d2[_0xf04c('0x3f')]&&_0xeaf0d2['customField']){_0x1a6d76[_0xeaf0d2['variableName']]&&_0x486ea3[_0xf04c('0x40')][_0xf04c('0x41')]({'id':_0xeaf0d2[_0xf04c('0x3f')],'value':_0x1a6d76[_0xeaf0d2[_0xf04c('0x43')]][_0xf04c('0x31')]()});}else if(_0xeaf0d2[_0xf04c('0x3a')]===_0xf04c('0x44')&&_0xeaf0d2['Variable']&&_0xeaf0d2[_0xf04c('0x45')]['name']&&_0xeaf0d2[_0xf04c('0x3f')]&&_0xeaf0d2['customField']){_0x1a6d76[_0xeaf0d2[_0xf04c('0x45')][_0xf04c('0x46')][_0xf04c('0x3d')]()]&&_0x486ea3[_0xf04c('0x40')]['push']({'id':_0xeaf0d2[_0xf04c('0x3f')],'value':_0x1a6d76[_0xeaf0d2[_0xf04c('0x45')][_0xf04c('0x46')][_0xf04c('0x3d')]()][_0xf04c('0x31')]()});}});}return _0x486ea3;}exports[_0xf04c('0x47')]=function(_0x386558,_0x573c3f,_0x35cde1,_0x1f3b1f,_0x511813,_0x3a4102){var _0x2b38dd,_0x377f0a;_0x3a4102[_0xf04c('0xf')]=intUtil[_0xf04c('0x48')](_0x3a4102[_0xf04c('0xf')]);_0x3a4102['serverUrl']=intUtil['stripTrailingSlash'](_0x3a4102[_0xf04c('0x49')]);if(_0x511813&&_0x511813[_0xf04c('0x4a')]){logger[_0xf04c('0xb')](_0xf04c('0x4b'),_0xf04c('0x4c'));_0x573c3f[_0xf04c('0x4d')]=util['format'](_0xf04c('0x4e'),_0x3a4102['serverUrl'],_0x573c3f[_0xf04c('0x4f')],md5(_0x573c3f[_0xf04c('0x4f')]));}else{_0x573c3f['recordingURL']='';}headers[_0xf04c('0x50')]=getAuth(_0x3a4102);return getUser(_0x3a4102,_0x1f3b1f[_0xf04c('0x51')])[_0xf04c('0x17')](function(_0x473698){_0x2b38dd=_0x473698;logger[_0xf04c('0xb')](_0xf04c('0x52'),_0x2b38dd['id']);return getEndUser(_0x3a4102,_0x573c3f[_0xf04c('0x53')],_0x573c3f['calleridnum']);})['then'](function(_0x49ed10){_0x377f0a=_0x49ed10;logger[_0xf04c('0xb')](_0xf04c('0x54'),_0x377f0a['id']);return getTicket(_0x3a4102,_0x2b38dd,_0x377f0a,_0x35cde1,_0x573c3f);})[_0xf04c('0x17')](function(_0x3c06f7){if(_0x3c06f7){logger[_0xf04c('0xb')](_0xf04c('0x55'),_0x3c06f7['id']);switch(_0x3a4102[_0xf04c('0x3a')]){case _0xf04c('0x56'):logger[_0xf04c('0xb')](_0xf04c('0x4b'),_0xf04c('0x57'));return request({'uri':util[_0xf04c('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3a4102[_0xf04c('0xf')],_0x2b38dd['id'],_0x3c06f7['id']),'method':'POST'});case _0xf04c('0x58'):logger['info'](_0xf04c('0x4b'),_0xf04c('0x59'));emit(util[_0xf04c('0xd')](_0xf04c('0x5a'),_0x1f3b1f[_0xf04c('0x46')]),_0xf04c('0x5b'),{'uri':util[_0xf04c('0xd')]('%s/agent/tickets/%s',_0x3a4102[_0xf04c('0xf')][_0xf04c('0x5c')](_0xf04c('0x5d'),''),_0x3c06f7['id'])});break;default:logger[_0xf04c('0x5e')](_0xf04c('0x4b'),_0xf04c('0x5f'));}}})[_0xf04c('0x60')](function(_0xc2e5e1){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xf04c('0x61')](_0xc2e5e1,{'showHidden':!![],'depth':null}));});};exports[_0xf04c('0x62')]=function(_0x4923a7,_0xb8aecf,_0xa5db71,_0x11db5d,_0x4daabe,_0xff1de8,_0x30de52){var _0x29482f,_0x54b556;_0xff1de8[_0xf04c('0xf')]=intUtil['stripTrailingSlash'](_0xff1de8[_0xf04c('0xf')]);_0xff1de8[_0xf04c('0x49')]=intUtil[_0xf04c('0x48')](_0xff1de8[_0xf04c('0x49')]);if(_0x30de52&&_0x30de52[_0xf04c('0x63')]&&_0x30de52['recordingFormat']!==_0xf04c('0x64')){logger[_0xf04c('0xb')](_0xf04c('0x65'),_0xf04c('0x4c'));_0xb8aecf['recordingURL']=util[_0xf04c('0xd')](_0xf04c('0x4e'),_0xff1de8[_0xf04c('0x49')],_0xb8aecf['uniqueid'],md5(_0xb8aecf[_0xf04c('0x4f')]));}headers[_0xf04c('0x50')]=getAuth(_0xff1de8);return getUser(_0xff1de8,_0x11db5d[_0xf04c('0x51')])['then'](function(_0x43d2b3){_0x29482f=_0x43d2b3;logger['info'](_0xf04c('0x52'),_0x29482f['id']);return getEndUser(_0xff1de8,_0xb8aecf[_0xf04c('0x66')],_0xb8aecf['destcalleridnum']);})[_0xf04c('0x17')](function(_0x560906){_0x54b556=_0x560906;logger[_0xf04c('0xb')](_0xf04c('0x54'),_0x54b556['id']);return getTicket(_0xff1de8,_0x29482f,_0x54b556,_0xa5db71,_0xb8aecf);})['then'](function(_0x52d74b){if(_0x52d74b){logger[_0xf04c('0xb')](_0xf04c('0x55'),_0x52d74b['id']);switch(_0xff1de8['type']){case'integrationTab':logger[_0xf04c('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xf04c('0xd')](_0xf04c('0x67'),_0xff1de8[_0xf04c('0xf')],_0x29482f['id'],_0x52d74b['id']),'method':'POST'});case'newTab':logger[_0xf04c('0xb')](_0xf04c('0x65'),_0xf04c('0x59'));emit(util[_0xf04c('0xd')](_0xf04c('0x5a'),_0x11db5d[_0xf04c('0x46')]),'trigger:browser:url',{'uri':util[_0xf04c('0xd')](_0xf04c('0x68'),_0xff1de8[_0xf04c('0xf')]['replace'](_0xf04c('0x5d'),''),_0x52d74b['id'])});break;default:logger[_0xf04c('0x5e')](_0xf04c('0x65'),_0xf04c('0x5f'));}}})[_0xf04c('0x60')](function(_0x502f71){logger[_0xf04c('0x5e')](_0xf04c('0x69'),util[_0xf04c('0x61')](_0x502f71,{'showHidden':!![],'depth':null}));});};exports[_0xf04c('0x6a')]=function(_0x5b3677,_0x10b7a9,_0x574b91,_0x860a20,_0x4dcf37,_0x2a54de){var _0x9043bb,_0x24a8d6;_0x2a54de[_0xf04c('0xf')]=intUtil[_0xf04c('0x48')](_0x2a54de[_0xf04c('0xf')]);_0x2a54de[_0xf04c('0x49')]=intUtil[_0xf04c('0x48')](_0x2a54de['serverUrl']);if(_0x4dcf37&&_0x4dcf37[_0xf04c('0x4a')]){logger[_0xf04c('0xb')]('['+_0x10b7a9[_0xf04c('0x6b')][_0xf04c('0x6c')]()+']',_0xf04c('0x4c'));_0x10b7a9[_0xf04c('0x4d')]=util[_0xf04c('0xd')](_0xf04c('0x4e'),_0x2a54de[_0xf04c('0x49')],_0x10b7a9['uniqueid'],md5(_0x10b7a9[_0xf04c('0x4f')]));}else{_0x10b7a9['recordingURL']='';}headers[_0xf04c('0x50')]=getAuth(_0x2a54de);return getUser(_0x2a54de)['then'](function(_0x136704){_0x9043bb=_0x136704;logger[_0xf04c('0xb')]('The\x20User\x20ID\x20is:',_0x9043bb['id']);return getEndUser(_0x2a54de,_0x10b7a9[_0xf04c('0x53')],_0x10b7a9['calleridnum']);})[_0xf04c('0x17')](function(_0x5acfd8){_0x24a8d6=_0x5acfd8;logger[_0xf04c('0xb')](_0xf04c('0x54'),_0x24a8d6['id']);return getTicket(_0x2a54de,_0x9043bb,_0x24a8d6,_0x574b91,_0x10b7a9);})['then'](function(_0x341738){if(_0x341738){logger['info']('The\x20Ticket\x20ID\x20is:',_0x341738['id']);}})[_0xf04c('0x60')](function(_0xfb513){logger[_0xf04c('0x5e')]('['+_0x10b7a9[_0xf04c('0x6b')]['toUpperCase']()+']'+_0xf04c('0x6d'),util['inspect'](_0xfb513,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb45d=['[HTTP]','stringify','defaults','map','includes','string','picklist','type','customField','nameField','content','toString','idField','custom_fields','push','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','email','The\x20Enduser\x20ID\x20is:','integrationTab','replace','lastevent','Authorization','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','Tags','name','getString','Subjects','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','remoteUri','then','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','authType','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','base64','debug'];(function(_0x244647,_0x2c24d7){var _0x49bc71=function(_0x58a2cd){while(--_0x58a2cd){_0x244647['push'](_0x244647['shift']());}};_0x49bc71(++_0x2c24d7);}(_0xb45d,0x1f0));var _0xdb45=function(_0x10a212,_0x579d85){_0x10a212=_0x10a212-0x0;var _0x23c82b=_0xb45d[_0x10a212];return _0x23c82b;};'use strict';var _=require(_0xdb45('0x0'));var rp=require(_0xdb45('0x1'));var md5=require(_0xdb45('0x2'));var util=require(_0xdb45('0x3'));var Redis=require(_0xdb45('0x4'));var intUtil=require(_0xdb45('0x5'));var config=require('../../../../config/environment');var logger=require(_0xdb45('0x6'))('zendesk');config[_0xdb45('0x7')]=_['defaults'](config[_0xdb45('0x7')],{'host':_0xdb45('0x8'),'port':0x18eb});var io=require(_0xdb45('0x9'))(new Redis(config[_0xdb45('0x7')]));function emit(_0x104865,_0x116dad,_0x2499da){io['to'](_0x104865)[_0xdb45('0xa')](_0x116dad,_0x2499da);}var headers={'Content-Type':_0xdb45('0xb'),'Accept':'application/json'};function getTicket(_0x3eb211,_0x521df5,_0x474854,_0x1ee90a,_0x273ba4){logger[_0xdb45('0xc')](_0xdb45('0xd'));return request({'uri':util[_0xdb45('0xe')]('%s/tickets.json',_0x3eb211['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x474854['id'],'submitter_id':_0x521df5?_0x521df5['id']:undefined,'assignee_id':_0x521df5?_0x521df5['id']:undefined,'tags':getTags(_0x1ee90a[_0xdb45('0xf')],_0xdb45('0x10')),'subject':intUtil[_0xdb45('0x11')](_0x1ee90a[_0xdb45('0x12')],_0x273ba4,'\x20'),'description':intUtil[_0xdb45('0x11')](_0x1ee90a['Descriptions'],_0x273ba4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xdb45('0x11')](_0x1ee90a['Descriptions'],_0x273ba4,'\x0a')}},getCustomFields(_0x1ee90a[_0xdb45('0x13')],_0x273ba4))}})['then'](function(_0x1006dd){logger['info'](_0xdb45('0x14'));return _0x1006dd[_0xdb45('0x15')];});}function getUser(_0x39debc,_0x269501){if(intUtil['validateEmail'](_0x269501)){logger[_0xdb45('0xc')](_0xdb45('0x16'),_0x269501);return request({'uri':util['format']('%s/search.json',_0x39debc['remoteUri']),'qs':{'query':util[_0xdb45('0xe')](_0xdb45('0x17'),_0x269501)}})['then'](function(_0x5ad860){if(_0x5ad860[_0xdb45('0x18')]){logger[_0xdb45('0xc')](_0xdb45('0x19'));return _[_0xdb45('0x1a')](_0x5ad860[_0xdb45('0x1b')],{'email':_0x269501,'role':_0xdb45('0x1c')});}else{logger[_0xdb45('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xdb45('0x1d'),_0x39debc[_0xdb45('0x1e')])})[_0xdb45('0x1f')](function(_0x186108){logger[_0xdb45('0xc')]('Admin\x20account\x20selected.');return _0x186108[_0xdb45('0x20')];});}});}else{logger['info'](_0xdb45('0x21'));return request({'uri':util[_0xdb45('0xe')]('%s/users/me.json',_0x39debc[_0xdb45('0x1e')])})['then'](function(_0x53cb97){logger[_0xdb45('0xc')](_0xdb45('0x22'));return _0x53cb97[_0xdb45('0x20')];});}}function getEndUser(_0x42aa25,_0x59e2f7,_0x5a5ac6){logger[_0xdb45('0xc')](_0xdb45('0x23'),_0x5a5ac6);return request({'uri':util[_0xdb45('0xe')](_0xdb45('0x24'),_0x42aa25['remoteUri']),'qs':{'query':util['format'](_0xdb45('0x25'),_0x5a5ac6)}})[_0xdb45('0x1f')](function(_0x48b334){var _0x3a74f8;if(_0x48b334[_0xdb45('0x1b')][_0xdb45('0x26')]){_0x48b334[_0xdb45('0x1b')]=_[_0xdb45('0x27')](_0x48b334[_0xdb45('0x1b')],{'suspended':![],'role':_0xdb45('0x28')});if(_0x48b334['results'][_0xdb45('0x26')]){_0x3a74f8=_['first'](_0x48b334[_0xdb45('0x1b')]);}}if(_0x3a74f8){logger[_0xdb45('0xc')](_0xdb45('0x29'));return _0x3a74f8;}else{logger[_0xdb45('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xdb45('0x2a'),_0x42aa25[_0xdb45('0x1e')]),'method':_0xdb45('0x2b'),'body':{'user':{'role':_0xdb45('0x28'),'name':util[_0xdb45('0xe')](_0xdb45('0x2c'),_0x59e2f7||_0x5a5ac6),'phone':_0x5a5ac6}}})[_0xdb45('0x1f')](function(_0x5d91d1){logger[_0xdb45('0xc')]('Enduser\x20created.');return _0x5d91d1[_0xdb45('0x20')];});}});}function getAuth(_0x513e65){var _0x9ab1;if(_0x513e65[_0xdb45('0x2d')]==='password'){_0x9ab1=util[_0xdb45('0xe')](_0xdb45('0x2e'),_0x513e65['username'],_0x513e65[_0xdb45('0x2f')]);}else if(_0x513e65[_0xdb45('0x2d')]===_0xdb45('0x30')){_0x9ab1=util[_0xdb45('0xe')](_0xdb45('0x31'),_0x513e65[_0xdb45('0x32')],_0x513e65[_0xdb45('0x30')]);}return util[_0xdb45('0xe')](_0xdb45('0x33'),new Buffer(_0x9ab1)['toString'](_0xdb45('0x34')));}function request(_0x4c0906){logger[_0xdb45('0x35')](_0xdb45('0x36'),JSON[_0xdb45('0x37')](_0x4c0906));return rp(_[_0xdb45('0x38')](_0x4c0906,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x27c49b,_0x172e44){var _0x4a28f6=[];if(_0x27c49b&&_0x27c49b[_0xdb45('0x26')]>0x0){_0x4a28f6=_[_0xdb45('0x39')](_0x27c49b,_0x172e44);}return _0x4a28f6;}function getCustomFields(_0x15e6e5,_0x462c6f){var _0x128bc3=[];var _0x33b387={'custom_fields':[]};if(_0x15e6e5[_0xdb45('0x26')]>0x0){_['forEach'](_0x15e6e5,function(_0x2efe97){if(_[_0xdb45('0x3a')]([_0xdb45('0x3b'),_0xdb45('0x3c')],_0x2efe97[_0xdb45('0x3d')])&&_0x2efe97['nameField']&&!_0x2efe97[_0xdb45('0x3e')]){_0x33b387[_0x2efe97[_0xdb45('0x3f')]['toLowerCase']()]=_0x2efe97[_0xdb45('0x40')][_0xdb45('0x41')]();}else if(_[_0xdb45('0x3a')]([_0xdb45('0x3b'),_0xdb45('0x3c')],_0x2efe97[_0xdb45('0x3d')])&&_0x2efe97[_0xdb45('0x42')]&&_0x2efe97[_0xdb45('0x3e')]){_0x33b387[_0xdb45('0x43')][_0xdb45('0x44')]({'id':_0x2efe97[_0xdb45('0x42')],'value':_0x2efe97['content'][_0xdb45('0x41')]()});}else if(_0x2efe97[_0xdb45('0x3d')]==='variable'&&_0x2efe97[_0xdb45('0x45')]&&_0x2efe97[_0xdb45('0x42')]&&_0x2efe97[_0xdb45('0x3e')]){_0x462c6f[_0x2efe97[_0xdb45('0x45')]]&&_0x33b387[_0xdb45('0x43')][_0xdb45('0x44')]({'id':_0x2efe97['idField'],'value':_0x462c6f[_0x2efe97[_0xdb45('0x45')]][_0xdb45('0x41')]()});}else if(_0x2efe97[_0xdb45('0x3d')]===_0xdb45('0x46')&&_0x2efe97[_0xdb45('0x47')]&&_0x2efe97[_0xdb45('0x47')][_0xdb45('0x10')]&&_0x2efe97[_0xdb45('0x42')]&&_0x2efe97[_0xdb45('0x3e')]){_0x462c6f[_0x2efe97[_0xdb45('0x47')]['name'][_0xdb45('0x48')]()]&&_0x33b387[_0xdb45('0x43')][_0xdb45('0x44')]({'id':_0x2efe97[_0xdb45('0x42')],'value':_0x462c6f[_0x2efe97['Variable'][_0xdb45('0x10')][_0xdb45('0x48')]()][_0xdb45('0x41')]()});}});}return _0x33b387;}exports[_0xdb45('0x49')]=function(_0x412c86,_0xad2c44,_0x4bfa86,_0xa8f1a6,_0x1282e4,_0x3000dc){var _0xf2c3e6,_0x2fc228;_0x3000dc[_0xdb45('0x1e')]=intUtil['stripTrailingSlash'](_0x3000dc[_0xdb45('0x1e')]);_0x3000dc[_0xdb45('0x4a')]=intUtil['stripTrailingSlash'](_0x3000dc['serverUrl']);if(_0x1282e4&&_0x1282e4[_0xdb45('0x4b')]){logger[_0xdb45('0xc')](_0xdb45('0x4c'),_0xdb45('0x4d'));_0xad2c44['recordingURL']=util['format'](_0xdb45('0x4e'),_0x3000dc[_0xdb45('0x4a')],_0xad2c44[_0xdb45('0x4f')],md5(_0xad2c44[_0xdb45('0x4f')]));}else{_0xad2c44[_0xdb45('0x50')]='';}headers['Authorization']=getAuth(_0x3000dc);return getUser(_0x3000dc,_0xa8f1a6['email'])[_0xdb45('0x1f')](function(_0x2663d1){_0xf2c3e6=_0x2663d1;logger[_0xdb45('0xc')](_0xdb45('0x51'),_0xf2c3e6['id']);return getEndUser(_0x3000dc,_0xad2c44[_0xdb45('0x52')],_0xad2c44['calleridnum']);})[_0xdb45('0x1f')](function(_0xda8512){_0x2fc228=_0xda8512;logger[_0xdb45('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2fc228['id']);return getTicket(_0x3000dc,_0xf2c3e6,_0x2fc228,_0x4bfa86,_0xad2c44);})[_0xdb45('0x1f')](function(_0x4eaf14){if(_0x4eaf14){logger[_0xdb45('0xc')](_0xdb45('0x53'),_0x4eaf14['id']);switch(_0x3000dc['type']){case'integrationTab':logger[_0xdb45('0xc')](_0xdb45('0x4c'),_0xdb45('0x54'));return request({'uri':util[_0xdb45('0xe')](_0xdb45('0x55'),_0x3000dc[_0xdb45('0x1e')],_0xf2c3e6['id'],_0x4eaf14['id']),'method':'POST'});case _0xdb45('0x56'):logger[_0xdb45('0xc')](_0xdb45('0x4c'),_0xdb45('0x57'));emit(util['format'](_0xdb45('0x58'),_0xa8f1a6['name']),_0xdb45('0x59'),{'uri':util[_0xdb45('0xe')](_0xdb45('0x5a'),_0x3000dc[_0xdb45('0x1e')]['replace'](_0xdb45('0x5b'),''),_0x4eaf14['id'])});break;default:logger[_0xdb45('0x5c')](_0xdb45('0x4c'),_0xdb45('0x5d'));}}})[_0xdb45('0x5e')](function(_0x3ca1c6){logger[_0xdb45('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3ca1c6,{'showHidden':!![],'depth':null}));});};exports[_0xdb45('0x5f')]=function(_0xd10221,_0x46c115,_0x3a4f7c,_0x1ccabf,_0x372160,_0x3031fb,_0x13f48b){var _0x1ea5e9,_0x436d4d;_0x3031fb[_0xdb45('0x1e')]=intUtil[_0xdb45('0x60')](_0x3031fb[_0xdb45('0x1e')]);_0x3031fb['serverUrl']=intUtil['stripTrailingSlash'](_0x3031fb[_0xdb45('0x4a')]);if(_0x13f48b&&_0x13f48b[_0xdb45('0x61')]&&_0x13f48b[_0xdb45('0x61')]!==_0xdb45('0x62')){logger['info'](_0xdb45('0x63'),_0xdb45('0x4d'));_0x46c115[_0xdb45('0x50')]=util['format'](_0xdb45('0x4e'),_0x3031fb['serverUrl'],_0x46c115[_0xdb45('0x4f')],md5(_0x46c115[_0xdb45('0x4f')]));}headers['Authorization']=getAuth(_0x3031fb);return getUser(_0x3031fb,_0x1ccabf[_0xdb45('0x64')])[_0xdb45('0x1f')](function(_0x29ffd9){_0x1ea5e9=_0x29ffd9;logger[_0xdb45('0xc')](_0xdb45('0x51'),_0x1ea5e9['id']);return getEndUser(_0x3031fb,_0x46c115['destcalleridname'],_0x46c115['destcalleridnum']);})[_0xdb45('0x1f')](function(_0xc045da){_0x436d4d=_0xc045da;logger[_0xdb45('0xc')](_0xdb45('0x65'),_0x436d4d['id']);return getTicket(_0x3031fb,_0x1ea5e9,_0x436d4d,_0x3a4f7c,_0x46c115);})[_0xdb45('0x1f')](function(_0x54e4c3){if(_0x54e4c3){logger[_0xdb45('0xc')](_0xdb45('0x53'),_0x54e4c3['id']);switch(_0x3031fb[_0xdb45('0x3d')]){case _0xdb45('0x66'):logger[_0xdb45('0xc')](_0xdb45('0x63'),_0xdb45('0x54'));return request({'uri':util[_0xdb45('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3031fb[_0xdb45('0x1e')],_0x1ea5e9['id'],_0x54e4c3['id']),'method':_0xdb45('0x2b')});case _0xdb45('0x56'):logger['info'](_0xdb45('0x63'),_0xdb45('0x57'));emit(util['format']('user:%s',_0x1ccabf[_0xdb45('0x10')]),_0xdb45('0x59'),{'uri':util[_0xdb45('0xe')]('%s/agent/tickets/%s',_0x3031fb[_0xdb45('0x1e')][_0xdb45('0x67')](_0xdb45('0x5b'),''),_0x54e4c3['id'])});break;default:logger[_0xdb45('0x5c')](_0xdb45('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xdb45('0x5e')](function(_0x34cdb1){logger[_0xdb45('0x5c')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x34cdb1,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x514709,_0x574d60,_0x540e35,_0x58daca,_0x57e001,_0x2949c8){var _0x17a360,_0x36d367;_0x2949c8[_0xdb45('0x1e')]=intUtil[_0xdb45('0x60')](_0x2949c8[_0xdb45('0x1e')]);_0x2949c8[_0xdb45('0x4a')]=intUtil[_0xdb45('0x60')](_0x2949c8['serverUrl']);if(_0x57e001&&_0x57e001[_0xdb45('0x4b')]){logger['info']('['+_0x574d60[_0xdb45('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x574d60[_0xdb45('0x50')]=util[_0xdb45('0xe')](_0xdb45('0x4e'),_0x2949c8[_0xdb45('0x4a')],_0x574d60[_0xdb45('0x4f')],md5(_0x574d60['uniqueid']));}else{_0x574d60[_0xdb45('0x50')]='';}headers[_0xdb45('0x69')]=getAuth(_0x2949c8);return getUser(_0x2949c8)['then'](function(_0x351a31){_0x17a360=_0x351a31;logger[_0xdb45('0xc')](_0xdb45('0x51'),_0x17a360['id']);return getEndUser(_0x2949c8,_0x574d60[_0xdb45('0x52')],_0x574d60[_0xdb45('0x6a')]);})['then'](function(_0x103c50){_0x36d367=_0x103c50;logger[_0xdb45('0xc')](_0xdb45('0x65'),_0x36d367['id']);return getTicket(_0x2949c8,_0x17a360,_0x36d367,_0x540e35,_0x574d60);})[_0xdb45('0x1f')](function(_0x171449){if(_0x171449){logger['info'](_0xdb45('0x53'),_0x171449['id']);}})[_0xdb45('0x5e')](function(_0x3919c2){logger['error']('['+_0x574d60[_0xdb45('0x68')][_0xdb45('0x6b')]()+']'+_0xdb45('0x6c'),util[_0xdb45('0x6d')](_0x3919c2,{'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 5cd2377..b692c04 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 _0xdeaf=['toLowerCase','indexOf','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','refresh_token','then','add','expires_in','seconds','Failing\x20creating\x20the\x20access_token','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','profile','Using\x20the\x20admin\x20account!','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','Contacts','uri','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','answertime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','format','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','host','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','destcalleridname','[OUTBOUND]','unmanaged','toUpperCase','lastevent','lodash','request-promise','md5','moment','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','includes','string','picklist','content','variable','variableName','idField','toString','type','customVariable','Variable','name'];(function(_0x16150f,_0x1921f3){var _0x1f46bd=function(_0x5313d){while(--_0x5313d){_0x16150f['push'](_0x16150f['shift']());}};_0x1f46bd(++_0x1921f3);}(_0xdeaf,0x19e));var _0xfdea=function(_0x40174f,_0x3a6751){_0x40174f=_0x40174f-0x0;var _0x40717c=_0xdeaf[_0x40174f];return _0x40717c;};'use strict';var _=require(_0xfdea('0x0'));var rp=require(_0xfdea('0x1'));var md5=require(_0xfdea('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0xfdea('0x3'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfdea('0x4'));config[_0xfdea('0x5')]=_[_0xfdea('0x6')](config[_0xfdea('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xfdea('0x7'))(new Redis(config[_0xfdea('0x5')]));function emit(_0x117bca,_0x473992,_0x4ca109){io['to'](_0x117bca)[_0xfdea('0x8')](_0x473992,_0x4ca109);}function request(_0x4a12ef){logger[_0xfdea('0x9')](_0xfdea('0xa'),JSON[_0xfdea('0xb')](_0x4a12ef));return rp(_0x4a12ef);}function getCustomFields(_0x25efc6,_0x2095bb){var _0x4f0917={};if(_0x25efc6['length']>0x0){_['forEach'](_0x25efc6,function(_0x6da5b0){if(_[_0xfdea('0xc')]([_0xfdea('0xd'),_0xfdea('0xe')],_0x6da5b0['type'])&&_0x6da5b0['idField']){_0x4f0917[_0x6da5b0['idField']]=_0x6da5b0[_0xfdea('0xf')]['toString']();}else if(_0x6da5b0['type']===_0xfdea('0x10')&&_0x6da5b0[_0xfdea('0x11')]&&_0x6da5b0[_0xfdea('0x12')]&&_0x2095bb[_0x6da5b0[_0xfdea('0x11')]]){_0x4f0917[_0x6da5b0[_0xfdea('0x12')]]=_0x2095bb[_0x6da5b0[_0xfdea('0x11')]][_0xfdea('0x13')]();}else if(_0x6da5b0[_0xfdea('0x14')]===_0xfdea('0x15')&&_0x6da5b0[_0xfdea('0x16')]&&_0x6da5b0[_0xfdea('0x16')]['name']&&_0x6da5b0[_0xfdea('0x12')]&&_0x2095bb[_0x6da5b0[_0xfdea('0x16')][_0xfdea('0x17')][_0xfdea('0x18')]()]){_0x4f0917[_0x6da5b0[_0xfdea('0x12')]]=_0x2095bb[_0x6da5b0[_0xfdea('0x16')]['name']['toLowerCase']()][_0xfdea('0x13')]();}});}return _0x4f0917;}function getName(_0x215efa){if(_0x215efa[_0xfdea('0x19')]('\x20')>0x0){var _0x169a4a=_0x215efa['split'](/ (.+)/);if(_0x169a4a[0x1]){return _0x169a4a;}}return[_0x215efa,_0x215efa];}var accountsTokens={};function getAccessToken(_0xd1776e){return new Promise(function(_0x1c7c82,_0x558ba2){if(!_[_0xfdea('0x1a')](accountsTokens[_0xd1776e['id']])&&!_[_0xfdea('0x1a')](accountsTokens[_0xd1776e['id']][_0xfdea('0x1b')])){if(moment()['isBefore'](accountsTokens[_0xd1776e['id']]['expires_in'])){_0x1c7c82(accountsTokens[_0xd1776e['id']]['access_token']);}}var _0x249f4e;switch(_0xd1776e[_0xfdea('0x1c')]){case'US':_0x249f4e=_0xfdea('0x1d');break;case'AU':_0x249f4e=_0xfdea('0x1e');break;case'EU':_0x249f4e=_0xfdea('0x1f');break;case'IN':_0x249f4e='https://accounts.zoho.in';break;case'CN':_0x249f4e='https://accounts.zoho.com.cn';break;default:_0x249f4e=_0xfdea('0x1f');break;}var _0x26edde={'method':_0xfdea('0x20'),'uri':_0x249f4e+_0xfdea('0x21'),'qs':{'refresh_token':_0xd1776e[_0xfdea('0x22')],'client_id':_0xd1776e['clientId'],'client_secret':_0xd1776e['clientSecret'],'grant_type':_0xfdea('0x23')},'json':!![]};return rp(_0x26edde)[_0xfdea('0x24')](function(_0xfb5168){accountsTokens[_0xd1776e['id']]={'access_token':_0xfb5168[_0xfdea('0x1b')],'expires_in':moment()[_0xfdea('0x25')](_0xfb5168[_0xfdea('0x26')],_0xfdea('0x27'))};_0x1c7c82(_0xfb5168[_0xfdea('0x1b')]);})['catch'](function(_0x2b3cf5){logger['error'](_0xfdea('0x28'),_0x2b3cf5['stack']);_0x558ba2(_0x2b3cf5);});});}function getUser(_0x35d15a,_0x5f55a6,_0x2c2a6f,_0x411414){logger[_0xfdea('0x29')](_0xfdea('0x2a'));return request({'method':'GET','uri':util['format'](_0xfdea('0x2b'),_0x5f55a6),'qs':{'type':_0xfdea('0x2c')},'headers':{'Authorization':_0xfdea('0x2d')+_0x35d15a},'json':!![]})[_0xfdea('0x24')](function(_0x54afa9){if(_0x54afa9[_0xfdea('0x2e')]){var _0x32b330=-0x1;if(_[_0xfdea('0x2f')](_0x54afa9[_0xfdea('0x2e')])){if(!_[_0xfdea('0x1a')](_0x411414)){_0x32b330=_[_0xfdea('0x30')](_0x54afa9[_0xfdea('0x2e')],function(_0x3dae41){return _0x3dae41['email']===_0x411414;});}if(_0x32b330>=0x0){logger[_0xfdea('0x29')]('Agent\x20found!');}else{logger['info']('Using\x20the\x20admin\x20account!');_0x32b330=_[_0xfdea('0x30')](_0x54afa9[_0xfdea('0x2e')],function(_0x2ff6a1){return _0x2ff6a1[_0xfdea('0x31')]['name']==='Administrator';});}return _0x54afa9[_0xfdea('0x2e')][_0x32b330];}else{if(_0x54afa9['user'][_0xfdea('0x31')][_0xfdea('0x17')]==='Administrator'){logger[_0xfdea('0x29')](_0xfdea('0x32'));user=_0x54afa9[_0xfdea('0x33')];return user;}else{logger[_0xfdea('0x34')](_0xfdea('0x35'),JSON['stringify'](_0x54afa9));throw new Error(_0xfdea('0x36')+JSON[_0xfdea('0xb')](_0x54afa9));}}}else{logger[_0xfdea('0x34')](_0xfdea('0x35'),JSON['stringify'](_0x54afa9));throw new Error(_0xfdea('0x36')+JSON[_0xfdea('0xb')](_0x54afa9));}})['catch'](function(_0x4163c6){console[_0xfdea('0x34')](_0x4163c6);});}function getZohoUser(_0x575ce7,_0xc269a7){return new BPromise(function(_0x58b401,_0x13ebc6){request(_0x575ce7)[_0xfdea('0x24')](function(_0x4da1f8){var _0x41e123=null;if(_0x4da1f8){_0x41e123=_0x4da1f8[_0xfdea('0x37')][0x0];_0x41e123[_0xfdea('0x38')]=_0xc269a7;}_0x58b401(_0x41e123);})[_0xfdea('0x39')](function(_0x5ebcc9){_0x13ebc6(_0x5ebcc9);});});}function createEndUser(_0x2a5c28,_0x3cfcc4,_0xd0cfac,_0x45d23e,_0x47f5ec,_0x3cd96c){var _0xd0cfac=getName(_0xd0cfac);return request({'method':'POST','uri':_0xfdea('0x3a')+_0x3cfcc4+_0xfdea('0x3b')+_[_0xfdea('0x3c')](_0x3cd96c[_0xfdea('0x3d')])+'s','body':{'data':[{'Last_Name':_0xd0cfac[0x1],'First_Name':_0xd0cfac[0x0],'Phone':_0x45d23e,'Owner':{'name':!_[_0xfdea('0x1a')](_0x47f5ec[_0xfdea('0x3e')][_0xfdea('0x17')])?_0x47f5ec[_0xfdea('0x3e')][_0xfdea('0x17')]:!_[_0xfdea('0x1a')](_0x47f5ec[_0xfdea('0x3f')])?_0x47f5ec[_0xfdea('0x3f')]+'\x20'+_0x47f5ec[_0xfdea('0x40')]:_0x47f5ec['last_name'],'id':_0x47f5ec['id']}}]},'headers':{'Authorization':_0xfdea('0x2d')+_0x2a5c28},'json':!![]})[_0xfdea('0x24')](function(_0x529779){if(_0x529779&&_0x529779[_0xfdea('0x37')][0x0][_0xfdea('0x41')]===_0xfdea('0x42')){var _0x15c2c7=_0x529779[_0xfdea('0x37')][0x0][_0xfdea('0x43')];_0x15c2c7[_0xfdea('0x38')]=_[_0xfdea('0x3c')](_0x3cd96c['moduleCreate'])+'s';return _0x15c2c7;}logger['error'](_0xfdea('0x35'),JSON[_0xfdea('0xb')](data));throw new Error(_0xfdea('0x44')+JSON[_0xfdea('0xb')](data));})[_0xfdea('0x39')](function(_0x8b34aa){console[_0xfdea('0x45')](_0xfdea('0x46'),_0x8b34aa);});}function getEndUser(_0x5eb977,_0x200d0b,_0x39da48,_0x3258d8,_0x2b1e5c,_0x3e56c6,_0x4fa78a){var _0x1a4d30={'method':_0xfdea('0x47'),'uri':'','headers':{'Authorization':_0xfdea('0x2d')+_0x5eb977},'json':!![]};switch(_0x4fa78a[_0xfdea('0x48')]){case _0xfdea('0x49'):_0x1a4d30['uri']=_0xfdea('0x3a')+_0x200d0b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2b1e5c+'))';return getZohoUser(_0x1a4d30,_0xfdea('0x4a'))[_0xfdea('0x24')](function(_0x1c71d7){if(_0x1c71d7)return _0x1c71d7;_0x1a4d30[_0xfdea('0x4b')]=_0xfdea('0x3a')+_0x200d0b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2b1e5c+'))';return getZohoUser(_0x1a4d30,_0xfdea('0x4c'))[_0xfdea('0x24')](function(_0x379b5e){if(_0x379b5e)return _0x379b5e;if(_0x4fa78a[_0xfdea('0x3d')]!=_0xfdea('0x4d')){return createEndUser(_0x5eb977,_0x200d0b,_0x3258d8,_0x2b1e5c,_0x3e56c6,_0x4fa78a);}else{return{};}});});break;case'contact':_0x1a4d30[_0xfdea('0x4b')]=_0xfdea('0x3a')+_0x200d0b+_0xfdea('0x4e')+_0x2b1e5c+'))';return getZohoUser(_0x1a4d30,'Contacts')['then'](function(_0x32e224){if(_0x32e224)return _0x32e224;if(_0x4fa78a[_0xfdea('0x3d')]!=_0xfdea('0x4d')){return createEndUser(_0x5eb977,_0x200d0b,_0x3258d8,_0x2b1e5c,_0x3e56c6,_0x4fa78a);}else{return{};}});break;case _0xfdea('0x4f'):_0x1a4d30[_0xfdea('0x4b')]=_0xfdea('0x3a')+_0x200d0b+_0xfdea('0x50')+_0x2b1e5c+'))';return getZohoUser(_0x1a4d30,_0xfdea('0x4c'))['then'](function(_0x35b33b){if(_0x35b33b)return _0x35b33b;if(_0x4fa78a[_0xfdea('0x3d')]!=_0xfdea('0x4d')){return createEndUser(_0x5eb977,_0x200d0b,_0x3258d8,_0x2b1e5c,_0x3e56c6,_0x4fa78a);}else{return{};}});break;}}function getCall(_0x27570d,_0x1a1403,_0x15ba82,_0x566107,_0xbda88a,_0x3cf776,_0x4252a2,_0x37fc2f){logger[_0xfdea('0x29')](_0xfdea('0x51'));var _0x441ced={};_0x441ced['Owner']={'name':!_['isNil'](_0x566107[_0xfdea('0x3e')][_0xfdea('0x17')])&&!_[_0xfdea('0x1a')](_0x566107[_0xfdea('0x31')][_0xfdea('0x17')])&&_0x566107[_0xfdea('0x31')][_0xfdea('0x17')]==='administrator'?_0x566107[_0xfdea('0x3e')]['name']:!_[_0xfdea('0x1a')](_0x566107['first_name'])?_0x566107['first_name']+'\x20'+_0x566107[_0xfdea('0x40')]:_0x566107[_0xfdea('0x40')],'id':_0x566107['id']};_0x441ced[_0xfdea('0x52')]=intUtil[_0xfdea('0x53')](_0x3cf776[_0xfdea('0x54')],_0x4252a2,'\x20');_0x441ced[_0xfdea('0x55')]=intUtil[_0xfdea('0x53')](_0x3cf776['Descriptions'],_0x4252a2,'\x0a');if(_0xbda88a[_0xfdea('0x38')]===_0xfdea('0x4a')){_0x441ced[_0xfdea('0x56')]={'name':!_[_0xfdea('0x1a')](_0xbda88a[_0xfdea('0x57')])?_0xbda88a[_0xfdea('0x57')]:!_[_0xfdea('0x1a')](_0xbda88a[_0xfdea('0x58')])?_0xbda88a[_0xfdea('0x58')]+'\x20'+_0xbda88a[_0xfdea('0x59')]:_0xbda88a[_0xfdea('0x59')],'id':_0xbda88a['id']};}if(_0xbda88a[_0xfdea('0x38')]===_0xfdea('0x4c')){_0x441ced['What_Id']={'name':!_[_0xfdea('0x1a')](_0xbda88a[_0xfdea('0x57')])?_0xbda88a[_0xfdea('0x57')]:!_[_0xfdea('0x1a')](_0xbda88a[_0xfdea('0x58')])?_0xbda88a['First_Name']+'\x20'+_0xbda88a[_0xfdea('0x59')]:_0xbda88a['Last_Name'],'id':_0xbda88a['id']};_0x441ced[_0xfdea('0x5a')]=_['startCase'](_0xbda88a['enduserType']);}if(_0x4252a2['talktime']){_0x441ced[_0xfdea('0x5b')]=moment[_0xfdea('0x5c')](parseInt(_0x4252a2[_0xfdea('0x5d')])*0x3e8)['format']('mm:ss');}else if(_0x4252a2[_0xfdea('0x5e')]&&_0x4252a2['endtime']){_0x441ced[_0xfdea('0x5b')]=moment[_0xfdea('0x5c')](moment(_0x4252a2['endtime'],_0xfdea('0x5f'))[_0xfdea('0x60')](moment(_0x4252a2[_0xfdea('0x61')],_0xfdea('0x5f'))))['format']('mm:ss');}switch(_0x4252a2['lastevent']){case'called':_0x441ced[_0xfdea('0x62')]=_0xfdea('0x63');break;case _0xfdea('0x64'):case _0xfdea('0x65'):_0x441ced[_0xfdea('0x62')]=_0xfdea('0x66');break;case _0xfdea('0x67'):_0x441ced[_0xfdea('0x62')]=_0xfdea('0x68');break;case _0xfdea('0x69'):_0x441ced[_0xfdea('0x62')]='Abandoned';break;case'timeout':_0x441ced[_0xfdea('0x62')]=_0xfdea('0x6a');default:}_0x441ced[_0xfdea('0x6b')]=(_0x37fc2f===_0xfdea('0x6c')?moment(_0x4252a2[_0xfdea('0x61')])['format'](_0xfdea('0x5f')):moment(_0x4252a2[_0xfdea('0x6d')])[_0xfdea('0x6e')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xfdea('0x6e')](_0xfdea('0x5f'));_0x441ced[_0xfdea('0x6f')]=_0x37fc2f||_0xfdea('0x70');_0x441ced=_[_0xfdea('0x71')](_0x441ced,getCustomFields(_0x3cf776[_0xfdea('0x72')],_0x4252a2));return request({'method':_0xfdea('0x20'),'uri':_0xfdea('0x3a')+_0x1a1403+_0xfdea('0x73'),'headers':{'Authorization':_0xfdea('0x2d')+_0x27570d},'body':{'data':[_0x441ced]},'json':!![]})[_0xfdea('0x24')](function(_0x39a72b){if(_0x39a72b&&_0x39a72b[_0xfdea('0x37')][0x0][_0xfdea('0x41')]==='SUCCESS'){logger[_0xfdea('0x29')](_0xfdea('0x74'));return{'id':_0x39a72b['data'][0x0][_0xfdea('0x43')]['id']};}})[_0xfdea('0x39')](function(_0x4c9bdc){logger[_0xfdea('0x29')](_0xfdea('0x75'),_0x4c9bdc['stack']);console[_0xfdea('0x45')]('err',_0x4c9bdc);});}exports[_0xfdea('0x76')]=function(_0x1be7de,_0x5cc90d,_0x3d963a,_0x2087e9,_0x2c146d,_0x1cefcc){var _0x421253,_0x28c9fd,_0x2fb82c;_0x1cefcc['host']=intUtil[_0xfdea('0x77')](_0x1cefcc['host']);_0x1cefcc['serverUrl']=intUtil['stripTrailingSlash'](_0x1cefcc[_0xfdea('0x78')]);if(_0x2c146d&&_0x2c146d[_0xfdea('0x79')]){logger[_0xfdea('0x29')]('[QUEUE]',_0xfdea('0x7a'));_0x5cc90d[_0xfdea('0x7b')]=_0x1cefcc[_0xfdea('0x78')]+_0xfdea('0x7c')+_0x5cc90d[_0xfdea('0x7d')]+_0xfdea('0x7e')+md5(_0x5cc90d[_0xfdea('0x7d')]);}else{_0x5cc90d['recordingURL']='';}var _0x49b70f=_0x1cefcc['host']===_0xfdea('0x7f')?'eu':_0xfdea('0x80');return getAccessToken(_0x1cefcc)[_0xfdea('0x24')](function(_0x433c39){_0x2fb82c=_0x433c39;return getUser(_0x2fb82c,_0x49b70f,_0x1cefcc,_0x2087e9[_0xfdea('0x81')]);})[_0xfdea('0x24')](function(_0x4dd01e){_0x421253=_0x4dd01e;logger[_0xfdea('0x29')](_0xfdea('0x82'),_0x421253['id']);return getEndUser(_0x2fb82c,_0x49b70f,_0x1cefcc,_0x5cc90d[_0xfdea('0x83')],_0x5cc90d['calleridnum'],_0x421253,_0x3d963a);})[_0xfdea('0x24')](function(_0x2f2236){_0x28c9fd=_0x2f2236;return getCall(_0x2fb82c,_0x49b70f,_0x1cefcc,_0x421253,_0x28c9fd,_0x3d963a,_0x5cc90d,_0xfdea('0x70'));})['then'](function(_0x6141c0){if(_0x6141c0){logger['info'](_0xfdea('0x84'),_0x6141c0['id']);logger[_0xfdea('0x29')](_0xfdea('0x85'),_0xfdea('0x86'));emit(util['format'](_0xfdea('0x87'),_0x2087e9[_0xfdea('0x17')]),_0xfdea('0x88'),{'uri':_0xfdea('0x89')+_0x1cefcc[_0xfdea('0x8a')]+_0xfdea('0x8b')+_0x6141c0['id']});}})[_0xfdea('0x39')](function(_0x4c8dc6){logger['error'](_0xfdea('0x85'),JSON[_0xfdea('0xb')](_0x4c8dc6));});};exports[_0xfdea('0x6c')]=function(_0x2683de,_0x4cc8cd,_0x3e0887,_0x16b51d,_0x1b4e4d,_0x55e25a,_0x228702){var _0x170f20,_0x2335c1,_0xfdf07e;_0x55e25a[_0xfdea('0x8a')]=intUtil[_0xfdea('0x77')](_0x55e25a[_0xfdea('0x8a')]);_0x55e25a[_0xfdea('0x78')]=intUtil[_0xfdea('0x77')](_0x55e25a[_0xfdea('0x78')]);if(_0x228702&&_0x228702[_0xfdea('0x8c')]&&_0x228702[_0xfdea('0x8c')]!=='none'){logger[_0xfdea('0x29')]('[OUTBOUND]',_0xfdea('0x7a'));_0x4cc8cd['recordingURL']=_0x55e25a['serverUrl']+_0xfdea('0x7c')+_0x4cc8cd[_0xfdea('0x7d')]+_0xfdea('0x7e')+md5(_0x4cc8cd[_0xfdea('0x7d')]);}var _0x39ac69=_0x55e25a['host']===_0xfdea('0x7f')?'eu':_0xfdea('0x80');return getAccessToken(_0x55e25a)[_0xfdea('0x24')](function(_0x14b1bc){_0xfdf07e=_0x14b1bc;return getUser(_0xfdf07e,_0x39ac69,_0x55e25a,_0x16b51d[_0xfdea('0x81')]);})['then'](function(_0x2b05c9){_0x170f20=_0x2b05c9;logger[_0xfdea('0x29')](_0xfdea('0x82'),_0x170f20['id']);return getEndUser(_0xfdf07e,_0x39ac69,_0x55e25a,_0x4cc8cd[_0xfdea('0x8d')],_0x4cc8cd['destcalleridnum'],_0x170f20,_0x3e0887);})[_0xfdea('0x24')](function(_0x5cd845){_0x2335c1=_0x5cd845;return getCall(_0xfdf07e,_0x39ac69,_0x55e25a,_0x170f20,_0x2335c1,_0x3e0887,_0x4cc8cd,'Outbound');})[_0xfdea('0x24')](function(_0x2f4ae2){if(_0x2f4ae2){logger[_0xfdea('0x29')](_0xfdea('0x84'),_0x2f4ae2['id']);logger['info'](_0xfdea('0x8e'),_0xfdea('0x86'));emit(util[_0xfdea('0x6e')](_0xfdea('0x87'),_0x16b51d[_0xfdea('0x17')]),_0xfdea('0x88'),{'uri':_0xfdea('0x89')+_0x55e25a[_0xfdea('0x8a')]+_0xfdea('0x8b')+_0x2f4ae2['id']});}})[_0xfdea('0x39')](function(_0x131d03){logger[_0xfdea('0x34')](_0xfdea('0x8e'),JSON[_0xfdea('0xb')](_0x131d03));});};exports[_0xfdea('0x8f')]=function(_0x1eb091,_0x1912db,_0x218ad4,_0x1bbc8d,_0x1a7733,_0x2b2051){var _0x10629c,_0x12b119,_0x23a347;_0x2b2051['host']=intUtil[_0xfdea('0x77')](_0x2b2051[_0xfdea('0x8a')]);_0x2b2051[_0xfdea('0x78')]=intUtil[_0xfdea('0x77')](_0x2b2051[_0xfdea('0x78')]);if(_0x1a7733&&_0x1a7733[_0xfdea('0x79')]){logger['info']('['+_0x1912db['lastevent'][_0xfdea('0x90')]()+']',_0xfdea('0x7a'));_0x1912db[_0xfdea('0x7b')]=_0x2b2051[_0xfdea('0x78')]+_0xfdea('0x7c')+_0x1912db['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x1912db[_0xfdea('0x7d')]);}else{_0x1912db[_0xfdea('0x7b')]='';}var _0x183680=_0x2b2051[_0xfdea('0x8a')]===_0xfdea('0x7f')?'eu':_0xfdea('0x80');return getAccessToken(_0x2b2051)[_0xfdea('0x24')](function(_0x22ef3a){_0x23a347=_0x22ef3a;return getUser(_0x23a347,_0x183680,_0x2b2051);})[_0xfdea('0x24')](function(_0x453270){_0x10629c=_0x453270;logger[_0xfdea('0x29')](_0xfdea('0x82'),_0x10629c['id']);return getEndUser(_0x23a347,_0x183680,_0x2b2051,_0x1912db[_0xfdea('0x83')],_0x1912db['calleridnum'],_0x10629c,_0x218ad4);})[_0xfdea('0x24')](function(_0x1ebcac){_0x12b119=_0x1ebcac;return getCall(_0x23a347,_0x183680,_0x2b2051,_0x10629c,_0x12b119,_0x218ad4,_0x1912db,_0xfdea('0x70'));})['then'](function(_0xab91a9){if(_0xab91a9){logger[_0xfdea('0x29')](_0xfdea('0x84'),_0xab91a9['id']);}})[_0xfdea('0x39')](function(_0x412b9d){logger[_0xfdea('0x34')]('['+_0x1912db[_0xfdea('0x91')]['toUpperCase']()+']',JSON['stringify'](_0x412b9d));});}; \ No newline at end of file +var _0x8f02=['refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','info','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Called','Answered','Call_Result','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','zoho.eu','calleridname','Inbound','lodash','request-promise','md5','util','./util','ioredis','bluebird','zoho','redis','defaults','socket.io-emitter','emit','[HTTP]','forEach','includes','string','picklist','type','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x2b8d76,_0x3ab256){var _0x4af22c=function(_0x279087){while(--_0x279087){_0x2b8d76['push'](_0x2b8d76['shift']());}};_0x4af22c(++_0x3ab256);}(_0x8f02,0x73));var _0x28f0=function(_0x478a19,_0x399c21){_0x478a19=_0x478a19-0x0;var _0x5268d9=_0x8f02[_0x478a19];return _0x5268d9;};'use strict';var _=require(_0x28f0('0x0'));var rp=require(_0x28f0('0x1'));var md5=require(_0x28f0('0x2'));var util=require(_0x28f0('0x3'));var intUtil=require(_0x28f0('0x4'));var moment=require('moment');var Redis=require(_0x28f0('0x5'));var BPromise=require(_0x28f0('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x28f0('0x7'));config[_0x28f0('0x8')]=_[_0x28f0('0x9')](config[_0x28f0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x28f0('0xa'))(new Redis(config[_0x28f0('0x8')]));function emit(_0x56cda7,_0x1c7ef9,_0x2fc0d5){io['to'](_0x56cda7)[_0x28f0('0xb')](_0x1c7ef9,_0x2fc0d5);}function request(_0x24b659){logger['debug'](_0x28f0('0xc'),JSON['stringify'](_0x24b659));return rp(_0x24b659);}function getCustomFields(_0x58268d,_0xbfcde3){var _0x29db0f={};if(_0x58268d['length']>0x0){_[_0x28f0('0xd')](_0x58268d,function(_0x496122){if(_[_0x28f0('0xe')]([_0x28f0('0xf'),_0x28f0('0x10')],_0x496122[_0x28f0('0x11')])&&_0x496122[_0x28f0('0x12')]){_0x29db0f[_0x496122[_0x28f0('0x12')]]=_0x496122['content']['toString']();}else if(_0x496122[_0x28f0('0x11')]===_0x28f0('0x13')&&_0x496122[_0x28f0('0x14')]&&_0x496122[_0x28f0('0x12')]&&_0xbfcde3[_0x496122[_0x28f0('0x14')]]){_0x29db0f[_0x496122['idField']]=_0xbfcde3[_0x496122[_0x28f0('0x14')]][_0x28f0('0x15')]();}else if(_0x496122[_0x28f0('0x11')]===_0x28f0('0x16')&&_0x496122[_0x28f0('0x17')]&&_0x496122[_0x28f0('0x17')][_0x28f0('0x18')]&&_0x496122[_0x28f0('0x12')]&&_0xbfcde3[_0x496122['Variable'][_0x28f0('0x18')][_0x28f0('0x19')]()]){_0x29db0f[_0x496122[_0x28f0('0x12')]]=_0xbfcde3[_0x496122[_0x28f0('0x17')]['name'][_0x28f0('0x19')]()][_0x28f0('0x15')]();}});}return _0x29db0f;}function getName(_0x3f1814){if(_0x3f1814[_0x28f0('0x1a')]('\x20')>0x0){var _0x196773=_0x3f1814[_0x28f0('0x1b')](/ (.+)/);if(_0x196773[0x1]){return _0x196773;}}return[_0x3f1814,_0x3f1814];}var accountsTokens={};function getAccessToken(_0x2cc5b2){return new Promise(function(_0x1ba753,_0x43933c){if(!_[_0x28f0('0x1c')](accountsTokens[_0x2cc5b2['id']])&&!_[_0x28f0('0x1c')](accountsTokens[_0x2cc5b2['id']][_0x28f0('0x1d')])){if(moment()[_0x28f0('0x1e')](accountsTokens[_0x2cc5b2['id']][_0x28f0('0x1f')])){_0x1ba753(accountsTokens[_0x2cc5b2['id']][_0x28f0('0x1d')]);}}var _0x1fe7f3;switch(_0x2cc5b2[_0x28f0('0x20')]){case'US':_0x1fe7f3=_0x28f0('0x21');break;case'AU':_0x1fe7f3=_0x28f0('0x22');break;case'EU':_0x1fe7f3='https://accounts.zoho.eu';break;case'IN':_0x1fe7f3=_0x28f0('0x23');break;case'CN':_0x1fe7f3=_0x28f0('0x24');break;default:_0x1fe7f3=_0x28f0('0x25');break;}var _0x4b6f71={'method':_0x28f0('0x26'),'uri':_0x1fe7f3+_0x28f0('0x27'),'qs':{'refresh_token':_0x2cc5b2[_0x28f0('0x28')],'client_id':_0x2cc5b2[_0x28f0('0x29')],'client_secret':_0x2cc5b2[_0x28f0('0x2a')],'grant_type':_0x28f0('0x2b')},'json':!![]};return rp(_0x4b6f71)['then'](function(_0x16ebe0){accountsTokens[_0x2cc5b2['id']]={'access_token':_0x16ebe0[_0x28f0('0x1d')],'expires_in':moment()[_0x28f0('0x2c')](_0x16ebe0[_0x28f0('0x1f')],'seconds')};_0x1ba753(_0x16ebe0[_0x28f0('0x1d')]);})[_0x28f0('0x2d')](function(_0x2797d0){logger[_0x28f0('0x2e')](_0x28f0('0x2f'),_0x2797d0[_0x28f0('0x30')]);_0x43933c(_0x2797d0);});});}function getUser(_0x2078d2,_0x250a19,_0x4f6711,_0x2e3276){logger['info']('Search\x20user');return request({'method':'GET','uri':util[_0x28f0('0x31')](_0x28f0('0x32'),_0x250a19),'qs':{'type':_0x28f0('0x33')},'headers':{'Authorization':_0x28f0('0x34')+_0x2078d2},'json':!![]})[_0x28f0('0x35')](function(_0x2ed6b9){if(_0x2ed6b9[_0x28f0('0x36')]){var _0xd7d353=-0x1;if(_[_0x28f0('0x37')](_0x2ed6b9[_0x28f0('0x36')])){if(!_[_0x28f0('0x1c')](_0x2e3276)){_0xd7d353=_[_0x28f0('0x38')](_0x2ed6b9[_0x28f0('0x36')],function(_0x225186){return _0x225186[_0x28f0('0x39')]===_0x2e3276;});}if(_0xd7d353>=0x0){logger['info']('Agent\x20found!');}else{logger['info'](_0x28f0('0x3a'));_0xd7d353=_[_0x28f0('0x38')](_0x2ed6b9[_0x28f0('0x36')],function(_0x8e7468){return _0x8e7468[_0x28f0('0x3b')]['name']===_0x28f0('0x3c');});}return _0x2ed6b9[_0x28f0('0x36')][_0xd7d353];}else{if(_0x2ed6b9['user']['profile'][_0x28f0('0x18')]==='Administrator'){logger['info'](_0x28f0('0x3a'));user=_0x2ed6b9[_0x28f0('0x3d')];return user;}else{logger[_0x28f0('0x2e')](_0x28f0('0x3e'),JSON['stringify'](_0x2ed6b9));throw new Error(_0x28f0('0x3f')+JSON[_0x28f0('0x40')](_0x2ed6b9));}}}else{logger[_0x28f0('0x2e')](_0x28f0('0x3e'),JSON[_0x28f0('0x40')](_0x2ed6b9));throw new Error(_0x28f0('0x3f')+JSON[_0x28f0('0x40')](_0x2ed6b9));}})[_0x28f0('0x2d')](function(_0x45c523){console['error'](_0x45c523);});}function getZohoUser(_0x13969b,_0x419044){return new BPromise(function(_0x4a5557,_0x28178b){request(_0x13969b)[_0x28f0('0x35')](function(_0x532bcf){var _0x310e37=null;if(_0x532bcf){_0x310e37=_0x532bcf[_0x28f0('0x41')][0x0];_0x310e37['enduserType']=_0x419044;}_0x4a5557(_0x310e37);})[_0x28f0('0x2d')](function(_0xa0696a){_0x28178b(_0xa0696a);});});}function createEndUser(_0x2ead42,_0x57e8ca,_0x2daf29,_0x24fe2d,_0x55ff79,_0xb896be){var _0x2daf29=getName(_0x2daf29);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x57e8ca+_0x28f0('0x42')+_[_0x28f0('0x43')](_0xb896be[_0x28f0('0x44')])+'s','body':{'data':[{'Last_Name':_0x2daf29[0x1],'First_Name':_0x2daf29[0x0],'Phone':_0x24fe2d,'Owner':{'name':!_[_0x28f0('0x1c')](_0x55ff79[_0x28f0('0x45')][_0x28f0('0x18')])?_0x55ff79[_0x28f0('0x45')]['name']:!_[_0x28f0('0x1c')](_0x55ff79[_0x28f0('0x46')])?_0x55ff79['first_name']+'\x20'+_0x55ff79[_0x28f0('0x47')]:_0x55ff79[_0x28f0('0x47')],'id':_0x55ff79['id']}}]},'headers':{'Authorization':_0x28f0('0x34')+_0x2ead42},'json':!![]})[_0x28f0('0x35')](function(_0x505969){if(_0x505969&&_0x505969[_0x28f0('0x41')][0x0][_0x28f0('0x48')]===_0x28f0('0x49')){var _0x31bfc5=_0x505969['data'][0x0][_0x28f0('0x4a')];_0x31bfc5[_0x28f0('0x4b')]=_[_0x28f0('0x43')](_0xb896be[_0x28f0('0x44')])+'s';return _0x31bfc5;}logger[_0x28f0('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x28f0('0x40')](data));throw new Error(_0x28f0('0x4c')+JSON[_0x28f0('0x40')](data));})['catch'](function(_0x1894d6){console['log']('CREATE\x20ERROR',_0x1894d6);});}function getEndUser(_0x5ad3fb,_0x36d93d,_0x18b582,_0x3201de,_0x462b76,_0x3e8e13,_0x121204){var _0x5432ba={'method':_0x28f0('0x4d'),'uri':'','headers':{'Authorization':_0x28f0('0x34')+_0x5ad3fb},'json':!![]};switch(_0x121204[_0x28f0('0x4e')]){case _0x28f0('0x4f'):_0x5432ba[_0x28f0('0x50')]=_0x28f0('0x51')+_0x36d93d+_0x28f0('0x52')+_0x462b76+'))';return getZohoUser(_0x5432ba,'Contacts')[_0x28f0('0x35')](function(_0x45adb2){if(_0x45adb2)return _0x45adb2;_0x5432ba['uri']=_0x28f0('0x51')+_0x36d93d+_0x28f0('0x53')+_0x462b76+'))';return getZohoUser(_0x5432ba,'Leads')[_0x28f0('0x35')](function(_0x54f7a5){if(_0x54f7a5)return _0x54f7a5;if(_0x121204[_0x28f0('0x44')]!=_0x28f0('0x54')){return createEndUser(_0x5ad3fb,_0x36d93d,_0x3201de,_0x462b76,_0x3e8e13,_0x121204);}else{return{};}});});break;case _0x28f0('0x55'):_0x5432ba[_0x28f0('0x50')]='https://www.zohoapis.'+_0x36d93d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x462b76+'))';return getZohoUser(_0x5432ba,'Contacts')[_0x28f0('0x35')](function(_0x1f139e){if(_0x1f139e)return _0x1f139e;if(_0x121204[_0x28f0('0x44')]!=_0x28f0('0x54')){return createEndUser(_0x5ad3fb,_0x36d93d,_0x3201de,_0x462b76,_0x3e8e13,_0x121204);}else{return{};}});break;case _0x28f0('0x56'):_0x5432ba[_0x28f0('0x50')]=_0x28f0('0x51')+_0x36d93d+_0x28f0('0x53')+_0x462b76+'))';return getZohoUser(_0x5432ba,'Leads')['then'](function(_0x230cc8){if(_0x230cc8)return _0x230cc8;if(_0x121204['moduleCreate']!=_0x28f0('0x54')){return createEndUser(_0x5ad3fb,_0x36d93d,_0x3201de,_0x462b76,_0x3e8e13,_0x121204);}else{return{};}});break;}}function getCall(_0x54494e,_0x13f1ae,_0x38892f,_0x11b088,_0x419307,_0x278bb2,_0x14c760,_0xededfe){logger[_0x28f0('0x57')](_0x28f0('0x58'));var _0x3ac386={};_0x3ac386[_0x28f0('0x59')]={'name':!_[_0x28f0('0x1c')](_0x11b088[_0x28f0('0x45')][_0x28f0('0x18')])&&!_[_0x28f0('0x1c')](_0x11b088[_0x28f0('0x3b')][_0x28f0('0x18')])&&_0x11b088[_0x28f0('0x3b')][_0x28f0('0x18')]===_0x28f0('0x5a')?_0x11b088[_0x28f0('0x45')][_0x28f0('0x18')]:!_['isNil'](_0x11b088[_0x28f0('0x46')])?_0x11b088[_0x28f0('0x46')]+'\x20'+_0x11b088[_0x28f0('0x47')]:_0x11b088[_0x28f0('0x47')],'id':_0x11b088['id']};_0x3ac386[_0x28f0('0x5b')]=intUtil['getString'](_0x278bb2[_0x28f0('0x5c')],_0x14c760,'\x20');_0x3ac386[_0x28f0('0x5d')]=intUtil[_0x28f0('0x5e')](_0x278bb2[_0x28f0('0x5f')],_0x14c760,'\x0a');if(_0x419307[_0x28f0('0x4b')]===_0x28f0('0x60')){_0x3ac386[_0x28f0('0x61')]={'name':!_[_0x28f0('0x1c')](_0x419307[_0x28f0('0x62')])?_0x419307[_0x28f0('0x62')]:!_[_0x28f0('0x1c')](_0x419307[_0x28f0('0x63')])?_0x419307['First_Name']+'\x20'+_0x419307['Last_Name']:_0x419307[_0x28f0('0x64')],'id':_0x419307['id']};}if(_0x419307['enduserType']===_0x28f0('0x65')){_0x3ac386[_0x28f0('0x66')]={'name':!_[_0x28f0('0x1c')](_0x419307[_0x28f0('0x62')])?_0x419307[_0x28f0('0x62')]:!_[_0x28f0('0x1c')](_0x419307[_0x28f0('0x63')])?_0x419307[_0x28f0('0x63')]+'\x20'+_0x419307[_0x28f0('0x64')]:_0x419307[_0x28f0('0x64')],'id':_0x419307['id']};_0x3ac386[_0x28f0('0x67')]=_[_0x28f0('0x43')](_0x419307[_0x28f0('0x4b')]);}if(_0x14c760['talktime']){_0x3ac386[_0x28f0('0x68')]=moment['utc'](parseInt(_0x14c760['talktime'])*0x3e8)['format'](_0x28f0('0x69'));}else if(_0x14c760[_0x28f0('0x6a')]&&_0x14c760[_0x28f0('0x6b')]){_0x3ac386[_0x28f0('0x68')]=moment[_0x28f0('0x6c')](moment(_0x14c760[_0x28f0('0x6b')],_0x28f0('0x6d'))[_0x28f0('0x6e')](moment(_0x14c760['starttime'],_0x28f0('0x6d'))))[_0x28f0('0x31')](_0x28f0('0x69'));}switch(_0x14c760[_0x28f0('0x6f')]){case _0x28f0('0x70'):_0x3ac386['Call_Result']=_0x28f0('0x71');break;case'complete':case'connect':_0x3ac386['Call_Result']=_0x28f0('0x72');break;case'rejected':_0x3ac386[_0x28f0('0x73')]=_0x28f0('0x74');break;case _0x28f0('0x75'):_0x3ac386[_0x28f0('0x73')]=_0x28f0('0x76');break;case'timeout':_0x3ac386[_0x28f0('0x73')]=_0x28f0('0x77');default:}_0x3ac386[_0x28f0('0x78')]=(_0xededfe===_0x28f0('0x79')?moment(_0x14c760['starttime'])['format'](_0x28f0('0x6d')):moment(_0x14c760[_0x28f0('0x7a')])['format'](_0x28f0('0x6d')))||moment()[_0x28f0('0x31')](_0x28f0('0x6d'));_0x3ac386[_0x28f0('0x7b')]=_0xededfe||'Inbound';_0x3ac386=_[_0x28f0('0x7c')](_0x3ac386,getCustomFields(_0x278bb2[_0x28f0('0x7d')],_0x14c760));return request({'method':'POST','uri':_0x28f0('0x51')+_0x13f1ae+_0x28f0('0x7e'),'headers':{'Authorization':_0x28f0('0x34')+_0x54494e},'body':{'data':[_0x3ac386]},'json':!![]})[_0x28f0('0x35')](function(_0x9f9285){if(_0x9f9285&&_0x9f9285['data'][0x0]['code']==='SUCCESS'){logger[_0x28f0('0x57')](_0x28f0('0x7f'));return{'id':_0x9f9285[_0x28f0('0x41')][0x0][_0x28f0('0x4a')]['id']};}})[_0x28f0('0x2d')](function(_0xfb454a){logger[_0x28f0('0x57')](_0x28f0('0x80'),_0xfb454a[_0x28f0('0x30')]);console[_0x28f0('0x81')]('err',_0xfb454a);});}exports[_0x28f0('0x82')]=function(_0x4ae0f7,_0x11d43b,_0x2b0f83,_0x426085,_0x5297d8,_0x20719f){var _0x537147,_0x9c6f7d,_0x585ef7;_0x20719f['host']=intUtil['stripTrailingSlash'](_0x20719f[_0x28f0('0x83')]);_0x20719f[_0x28f0('0x84')]=intUtil[_0x28f0('0x85')](_0x20719f[_0x28f0('0x84')]);if(_0x5297d8&&_0x5297d8[_0x28f0('0x86')]){logger[_0x28f0('0x57')]('[QUEUE]',_0x28f0('0x87'));_0x11d43b[_0x28f0('0x88')]=_0x20719f[_0x28f0('0x84')]+_0x28f0('0x89')+_0x11d43b[_0x28f0('0x8a')]+_0x28f0('0x8b')+md5(_0x11d43b[_0x28f0('0x8a')]);}else{_0x11d43b[_0x28f0('0x88')]='';}var _0x13f391=_0x20719f[_0x28f0('0x83')]==='zoho.eu'?'eu':_0x28f0('0x8c');return getAccessToken(_0x20719f)[_0x28f0('0x35')](function(_0x565b5c){_0x585ef7=_0x565b5c;return getUser(_0x585ef7,_0x13f391,_0x20719f,_0x426085[_0x28f0('0x39')]);})[_0x28f0('0x35')](function(_0x54d472){_0x537147=_0x54d472;logger[_0x28f0('0x57')](_0x28f0('0x8d'),_0x537147['id']);return getEndUser(_0x585ef7,_0x13f391,_0x20719f,_0x11d43b['calleridname'],_0x11d43b[_0x28f0('0x8e')],_0x537147,_0x2b0f83);})[_0x28f0('0x35')](function(_0x32cfe7){_0x9c6f7d=_0x32cfe7;return getCall(_0x585ef7,_0x13f391,_0x20719f,_0x537147,_0x9c6f7d,_0x2b0f83,_0x11d43b,'Inbound');})[_0x28f0('0x35')](function(_0xbe3dd4){if(_0xbe3dd4){logger['info'](_0x28f0('0x8f'),_0xbe3dd4['id']);logger['info'](_0x28f0('0x90'),_0x28f0('0x91'));emit(util[_0x28f0('0x31')](_0x28f0('0x92'),_0x426085['name']),_0x28f0('0x93'),{'uri':_0x28f0('0x94')+_0x20719f[_0x28f0('0x83')]+'/crm/EntityInfo.do?module=Calls&id='+_0xbe3dd4['id']});}})[_0x28f0('0x2d')](function(_0x214f82){logger[_0x28f0('0x2e')](_0x28f0('0x90'),JSON['stringify'](_0x214f82));});};exports['outbound']=function(_0x175145,_0x540295,_0x48b95f,_0x5bd368,_0x206426,_0x16a6db,_0x303968){var _0x4c7fe6,_0x3a1eee,_0x481a7a;_0x16a6db[_0x28f0('0x83')]=intUtil[_0x28f0('0x85')](_0x16a6db[_0x28f0('0x83')]);_0x16a6db[_0x28f0('0x84')]=intUtil[_0x28f0('0x85')](_0x16a6db[_0x28f0('0x84')]);if(_0x303968&&_0x303968['recordingFormat']&&_0x303968[_0x28f0('0x95')]!=='none'){logger[_0x28f0('0x57')]('[OUTBOUND]',_0x28f0('0x87'));_0x540295[_0x28f0('0x88')]=_0x16a6db['serverUrl']+_0x28f0('0x89')+_0x540295[_0x28f0('0x8a')]+_0x28f0('0x8b')+md5(_0x540295[_0x28f0('0x8a')]);}var _0x894819=_0x16a6db[_0x28f0('0x83')]==='zoho.eu'?'eu':_0x28f0('0x8c');return getAccessToken(_0x16a6db)[_0x28f0('0x35')](function(_0x495581){_0x481a7a=_0x495581;return getUser(_0x481a7a,_0x894819,_0x16a6db,_0x5bd368[_0x28f0('0x39')]);})['then'](function(_0x235256){_0x4c7fe6=_0x235256;logger[_0x28f0('0x57')](_0x28f0('0x8d'),_0x4c7fe6['id']);return getEndUser(_0x481a7a,_0x894819,_0x16a6db,_0x540295[_0x28f0('0x96')],_0x540295[_0x28f0('0x97')],_0x4c7fe6,_0x48b95f);})[_0x28f0('0x35')](function(_0x2d7fd0){_0x3a1eee=_0x2d7fd0;return getCall(_0x481a7a,_0x894819,_0x16a6db,_0x4c7fe6,_0x3a1eee,_0x48b95f,_0x540295,'Outbound');})[_0x28f0('0x35')](function(_0x526397){if(_0x526397){logger[_0x28f0('0x57')](_0x28f0('0x8f'),_0x526397['id']);logger[_0x28f0('0x57')](_0x28f0('0x98'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x28f0('0x92'),_0x5bd368[_0x28f0('0x18')]),_0x28f0('0x93'),{'uri':_0x28f0('0x94')+_0x16a6db[_0x28f0('0x83')]+'/crm/EntityInfo.do?module=Calls&id='+_0x526397['id']});}})[_0x28f0('0x2d')](function(_0x5d41c3){logger[_0x28f0('0x2e')](_0x28f0('0x98'),JSON[_0x28f0('0x40')](_0x5d41c3));});};exports[_0x28f0('0x99')]=function(_0x350d93,_0x19b2e1,_0xc2a263,_0xcb54ea,_0x4958d7,_0x2e7d4c){var _0x1736a3,_0x12e2cb,_0x1227ae;_0x2e7d4c[_0x28f0('0x83')]=intUtil[_0x28f0('0x85')](_0x2e7d4c[_0x28f0('0x83')]);_0x2e7d4c[_0x28f0('0x84')]=intUtil[_0x28f0('0x85')](_0x2e7d4c[_0x28f0('0x84')]);if(_0x4958d7&&_0x4958d7[_0x28f0('0x86')]){logger[_0x28f0('0x57')]('['+_0x19b2e1['lastevent'][_0x28f0('0x9a')]()+']','Recording\x20is\x20enabled!');_0x19b2e1['recordingURL']=_0x2e7d4c[_0x28f0('0x84')]+_0x28f0('0x89')+_0x19b2e1[_0x28f0('0x8a')]+_0x28f0('0x8b')+md5(_0x19b2e1[_0x28f0('0x8a')]);}else{_0x19b2e1['recordingURL']='';}var _0xd6d589=_0x2e7d4c[_0x28f0('0x83')]===_0x28f0('0x9b')?'eu':_0x28f0('0x8c');return getAccessToken(_0x2e7d4c)[_0x28f0('0x35')](function(_0xd1dbc7){_0x1227ae=_0xd1dbc7;return getUser(_0x1227ae,_0xd6d589,_0x2e7d4c);})[_0x28f0('0x35')](function(_0xdffdc2){_0x1736a3=_0xdffdc2;logger[_0x28f0('0x57')]('The\x20User\x20ID\x20is:',_0x1736a3['id']);return getEndUser(_0x1227ae,_0xd6d589,_0x2e7d4c,_0x19b2e1[_0x28f0('0x9c')],_0x19b2e1[_0x28f0('0x8e')],_0x1736a3,_0xc2a263);})[_0x28f0('0x35')](function(_0x117209){_0x12e2cb=_0x117209;return getCall(_0x1227ae,_0xd6d589,_0x2e7d4c,_0x1736a3,_0x12e2cb,_0xc2a263,_0x19b2e1,_0x28f0('0x9d'));})[_0x28f0('0x35')](function(_0x1f8a0f){if(_0x1f8a0f){logger[_0x28f0('0x57')]('The\x20Call\x20ID\x20is:',_0x1f8a0f['id']);}})['catch'](function(_0x24d857){logger['error']('['+_0x19b2e1[_0x28f0('0x6f')]['toUpperCase']()+']',JSON[_0x28f0('0x40')](_0x24d857));});}; \ 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 017cfe5..328cafe 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 _0xd3d2=['data3','exec','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger','data2','Script'];(function(_0x4883d4,_0x1b9087){var _0x2de58c=function(_0x30059e){while(--_0x30059e){_0x4883d4['push'](_0x4883d4['shift']());}};_0x2de58c(++_0x1b9087);}(_0xd3d2,0x1aa));var _0x2d3d=function(_0x1d4f24,_0x5ee686){_0x1d4f24=_0x1d4f24-0x0;var _0x43f1fc=_0xd3d2[_0x1d4f24];return _0x43f1fc;};'use strict';var util=require(_0x2d3d('0x0'));var sh=require(_0x2d3d('0x1'));var Mustache=require('mustache');var logger=require(_0x2d3d('0x2'))(_0x2d3d('0x3'));exports['exec']=function(_0x211e60,_0x19bbf1){var _0x34235f=_0x211e60[_0x2d3d('0x4')]?_0x211e60[_0x2d3d('0x4')]:_0x2d3d('0x5');var _0x1b0ca3=_0x211e60[_0x2d3d('0x6')]?Mustache['render'](_0x211e60[_0x2d3d('0x6')],_0x19bbf1):_0x19bbf1;sh[_0x2d3d('0x7')](_0x1b0ca3,function(_0x458da3,_0x42c20d,_0x3166fe){if(_0x458da3!==0x0){logger[_0x2d3d('0x8')](util['format'](_0x2d3d('0x9'),_0x34235f,_0x1b0ca3,_0x458da3,_0x3166fe));}else{logger['info'](util[_0x2d3d('0xa')](_0x2d3d('0xb'),_0x34235f,_0x1b0ca3,_0x42c20d));}});}; \ No newline at end of file +var _0x70f8=['data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','util','shelljs','mustache','trigger','data2'];(function(_0x2ec1cd,_0x2474a0){var _0x37d082=function(_0x1c2fb8){while(--_0x1c2fb8){_0x2ec1cd['push'](_0x2ec1cd['shift']());}};_0x37d082(++_0x2474a0);}(_0x70f8,0xa0));var _0x870f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x70f8[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x870f('0x0'));var sh=require(_0x870f('0x1'));var Mustache=require(_0x870f('0x2'));var logger=require('../../../../config/logger')(_0x870f('0x3'));exports['exec']=function(_0xf22630,_0x254233){var _0xc7ddc2=_0xf22630[_0x870f('0x4')]?_0xf22630['data2']:'Script';var _0x595089=_0xf22630[_0x870f('0x5')]?Mustache[_0x870f('0x6')](_0xf22630['data3'],_0x254233):_0x254233;sh['exec'](_0x595089,function(_0x362f96,_0x344ae6,_0x11c73d){if(_0x362f96!==0x0){logger[_0x870f('0x7')](util['format'](_0x870f('0x8'),_0xc7ddc2,_0x595089,_0x362f96,_0x11c73d));}else{logger[_0x870f('0x9')](util[_0x870f('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0xc7ddc2,_0x595089,_0x344ae6));}});}; \ 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 8298f00..ee2154c 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 _0x35ce=['stringify','statusCode','catch','name','util','lodash','mustache','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object'];(function(_0x413b33,_0x43076a){var _0x3d2916=function(_0x33d654){while(--_0x33d654){_0x413b33['push'](_0x413b33['shift']());}};_0x3d2916(++_0x43076a);}(_0x35ce,0x184));var _0xe35c=function(_0x1629f3,_0x4411e1){_0x1629f3=_0x1629f3-0x0;var _0x12c47a=_0x35ce[_0x1629f3];return _0x12c47a;};'use strict';var rp=require('request-promise');var util=require(_0xe35c('0x0'));var _=require(_0xe35c('0x1'));var Mustache=require(_0xe35c('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x3c8f16,_0x4a21f3){var _0x333517,_0x3dbfa6;var _0x4ac775={'method':_0x3c8f16[_0xe35c('0x3')][_0xe35c('0x4')](),'uri':Mustache[_0xe35c('0x5')](_0x3c8f16[_0xe35c('0x6')],_0x4a21f3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3c8f16[_0xe35c('0x7')])===_0xe35c('0x8')&&parseInt(_0x3c8f16[_0xe35c('0x7')])>=0x1&&parseInt(_0x3c8f16[_0xe35c('0x7')])<=0xa?parseInt(_0x3c8f16['data5'])*0x3e8:0x5*0x3e8};try{_0x4ac775[_0xe35c('0x9')]=_0x3c8f16[_0xe35c('0xa')]?JSON[_0xe35c('0xb')](Mustache['render'](_0x3c8f16[_0xe35c('0xa')],_0x4a21f3)):{};}catch(_0x4dad23){logger['error'](_0x4dad23[_0xe35c('0xc')]);}switch(_0x3c8f16['data1'][_0xe35c('0x4')]()){case _0xe35c('0xd'):case _0xe35c('0xe'):_0x333517=null;_0x4ac775['qs']=_0x4a21f3;break;case _0xe35c('0xf'):case _0xe35c('0x10'):if(_0x3c8f16['data7']){try{_0x333517=JSON[_0xe35c('0xb')](Mustache['render'](_0x3c8f16[_0xe35c('0x11')],_0x4a21f3));_0x4ac775[_0xe35c('0x12')]=_0x333517;}catch(_0x4beae8){logger[_0xe35c('0x13')](_0x4beae8[_0xe35c('0xc')]);logger[_0xe35c('0x13')](_0xe35c('0x14'));}}else{_0x333517=_0x4a21f3;_0x4ac775['body']=_0x333517;}break;}logger[_0xe35c('0x15')](util[_0xe35c('0x16')](_0xe35c('0x17'),_0x3c8f16[_0xe35c('0x3')],_0x3c8f16[_0xe35c('0x6')],JSON['stringify'](_0x4ac775)));rp(_0x4ac775)[_0xe35c('0x18')](function(_0x41b44a){_0x333517=!_[_0xe35c('0x19')](_0x333517)?_0xe35c('0x1a')+_0x333517:'';_0x3dbfa6=typeof _0x41b44a[_0xe35c('0x12')]===_0xe35c('0x1b')?JSON[_0xe35c('0x1c')](_0x41b44a[_0xe35c('0x12')]):_0x41b44a['body'];logger['info'](util[_0xe35c('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3c8f16['data1'],_0x3c8f16[_0xe35c('0x6')],_0x41b44a[_0xe35c('0x1d')],_0x3dbfa6));})[_0xe35c('0x1e')](function(_0x49bdae){logger[_0xe35c('0x13')](util[_0xe35c('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3c8f16[_0xe35c('0x3')],_0x3c8f16[_0xe35c('0x6')],_0x49bdae[_0xe35c('0x1d')],_0x49bdae[_0xe35c('0x1f')],_0x49bdae['message']));});}; \ No newline at end of file +var _0x0737=['../../../../config/logger','exec','data1','render','data2','data5','number','headers','data6','parse','error','stack','toUpperCase','GET','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash'];(function(_0x26ed77,_0x5d3145){var _0x33ef92=function(_0x1c5ec0){while(--_0x1c5ec0){_0x26ed77['push'](_0x26ed77['shift']());}};_0x33ef92(++_0x5d3145);}(_0x0737,0x66));var _0x7073=function(_0x1f0ccc,_0x3d2f42){_0x1f0ccc=_0x1f0ccc-0x0;var _0x7ddf7a=_0x0737[_0x1f0ccc];return _0x7ddf7a;};'use strict';var rp=require(_0x7073('0x0'));var util=require(_0x7073('0x1'));var _=require(_0x7073('0x2'));var Mustache=require('mustache');var logger=require(_0x7073('0x3'))('trigger');exports[_0x7073('0x4')]=function(_0xd482c3,_0x39d062){var _0x5b8efe,_0x446a4f;var _0x309587={'method':_0xd482c3[_0x7073('0x5')]['toUpperCase'](),'uri':Mustache[_0x7073('0x6')](_0xd482c3[_0x7073('0x7')],_0x39d062),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xd482c3[_0x7073('0x8')])===_0x7073('0x9')&&parseInt(_0xd482c3[_0x7073('0x8')])>=0x1&&parseInt(_0xd482c3[_0x7073('0x8')])<=0xa?parseInt(_0xd482c3['data5'])*0x3e8:0x5*0x3e8};try{_0x309587[_0x7073('0xa')]=_0xd482c3[_0x7073('0xb')]?JSON[_0x7073('0xc')](Mustache[_0x7073('0x6')](_0xd482c3['data6'],_0x39d062)):{};}catch(_0x3183af){logger[_0x7073('0xd')](_0x3183af[_0x7073('0xe')]);}switch(_0xd482c3[_0x7073('0x5')][_0x7073('0xf')]()){case _0x7073('0x10'):case'DELETE':_0x5b8efe=null;_0x309587['qs']=_0x39d062;break;case'POST':case _0x7073('0x11'):if(_0xd482c3[_0x7073('0x12')]){try{_0x5b8efe=JSON[_0x7073('0xc')](Mustache[_0x7073('0x6')](_0xd482c3[_0x7073('0x12')],_0x39d062));_0x309587[_0x7073('0x13')]=_0x5b8efe;}catch(_0xe6c44c){logger['error'](_0xe6c44c[_0x7073('0xe')]);logger[_0x7073('0xd')](_0x7073('0x14'));}}else{_0x5b8efe=_0x39d062;_0x309587['body']=_0x5b8efe;}break;}logger[_0x7073('0x15')](util[_0x7073('0x16')](_0x7073('0x17'),_0xd482c3[_0x7073('0x5')],_0xd482c3[_0x7073('0x7')],JSON['stringify'](_0x309587)));rp(_0x309587)[_0x7073('0x18')](function(_0x12a6d7){_0x5b8efe=!_[_0x7073('0x19')](_0x5b8efe)?_0x7073('0x1a')+_0x5b8efe:'';_0x446a4f=typeof _0x12a6d7[_0x7073('0x13')]===_0x7073('0x1b')?JSON[_0x7073('0x1c')](_0x12a6d7[_0x7073('0x13')]):_0x12a6d7[_0x7073('0x13')];logger[_0x7073('0x15')](util[_0x7073('0x16')](_0x7073('0x1d'),_0xd482c3[_0x7073('0x5')],_0xd482c3['data2'],_0x12a6d7[_0x7073('0x1e')],_0x446a4f));})[_0x7073('0x1f')](function(_0xebccd){logger[_0x7073('0xd')](util[_0x7073('0x16')](_0x7073('0x20'),_0xd482c3[_0x7073('0x5')],_0xd482c3[_0x7073('0x7')],_0xebccd[_0x7073('0x1e')],_0xebccd[_0x7073('0x21')],_0xebccd[_0x7073('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index fa11724..084ad7e 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 _0x149b=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x149b,0x8d));var _0xb149=function(_0x5080d3,_0x1995d6){_0x5080d3=_0x5080d3-0x0;var _0x51af9f=_0x149b[_0x5080d3];return _0x51af9f;};'use strict';var jayson=require(_0xb149('0x0'));var BPromise=require(_0xb149('0x1'));var logger=require(_0xb149('0x2'))(_0xb149('0x3'));var client=jayson[_0xb149('0x4')][_0xb149('0x5')]({'port':0x2329});client[_0xb149('0x6')]=function(_0x4b0b7a,_0x3cabf7){return new BPromise(function(_0x44e8fc,_0x5b77a4){return client[_0xb149('0x7')](_0x4b0b7a,_0x3cabf7)[_0xb149('0x8')](function(_0x29f173){logger[_0xb149('0x9')](_0xb149('0xa'),_0xb149('0x3'),_0x4b0b7a,_0x3cabf7,_0x29f173);if(_0x29f173[_0xb149('0xb')]){logger['error'](_0xb149('0xa'),_0xb149('0x3'),_0x4b0b7a,_0x29f173['error']['message'],_0x3cabf7);return _0x5b77a4(_0x29f173['error'][_0xb149('0xc')]);}else{return _0x44e8fc(_0x29f173[_0xb149('0xd')]);}})[_0xb149('0xe')](function(_0x2a338c){logger[_0xb149('0xb')](_0xb149('0xa'),'routing',_0x4b0b7a,_0x2a338c,_0x3cabf7);return _0x5b77a4(_0x2a338c);});});};module[_0xb149('0xf')]=client; \ No newline at end of file +var _0xb441=['http','Request','request','then','debug','rpc','routing','error','message','catch','exports','jayson/promise','../../config/logger','client'];(function(_0xe4194b,_0x4b7ab1){var _0xaae39f=function(_0x4d9cd3){while(--_0x4d9cd3){_0xe4194b['push'](_0xe4194b['shift']());}};_0xaae39f(++_0x4b7ab1);}(_0xb441,0xa5));var _0x1b44=function(_0x2336d4,_0x41ce85){_0x2336d4=_0x2336d4-0x0;var _0x19333e=_0xb441[_0x2336d4];return _0x19333e;};'use strict';var jayson=require(_0x1b44('0x0'));var BPromise=require('bluebird');var logger=require(_0x1b44('0x1'))('routing');var client=jayson[_0x1b44('0x2')][_0x1b44('0x3')]({'port':0x2329});client[_0x1b44('0x4')]=function(_0xd62403,_0x6735f7){return new BPromise(function(_0xf27e76,_0x387db4){return client[_0x1b44('0x5')](_0xd62403,_0x6735f7)[_0x1b44('0x6')](function(_0x47b04c){logger[_0x1b44('0x7')](_0x1b44('0x8'),_0x1b44('0x9'),_0xd62403,_0x6735f7,_0x47b04c);if(_0x47b04c[_0x1b44('0xa')]){logger[_0x1b44('0xa')](_0x1b44('0x8'),_0x1b44('0x9'),_0xd62403,_0x47b04c[_0x1b44('0xa')]['message'],_0x6735f7);return _0x387db4(_0x47b04c[_0x1b44('0xa')][_0x1b44('0xb')]);}else{return _0xf27e76(_0x47b04c['result']);}})[_0x1b44('0xc')](function(_0x55b97d){logger['error'](_0x1b44('0x8'),_0x1b44('0x9'),_0xd62403,_0x55b97d,_0x6735f7);return _0x387db4(_0x55b97d);});});};module[_0x1b44('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2da8b72..89d23c8 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 _0x3190=['listen','getSettings','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x3190,0x1b7));var _0x0319=function(_0x5052e1,_0x2f6ab8){_0x5052e1=_0x5052e1-0x0;var _0x174252=_0x3190[_0x5052e1];return _0x174252;};'use strict';var server=require('./server');var Realtime=require(_0x0319('0x0'));var EmailChannel=require(_0x0319('0x1'));var mailAccount=require(_0x0319('0x2'));var setting=require('./rpc/setting');var logger=require(_0x0319('0x3'))(_0x0319('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0319('0x5')]()[_0x0319('0x6')](mailAccount[_0x0319('0x7')]())[_0x0319('0x6')](realtime[_0x0319('0x8')]())[_0x0319('0x6')](function(){email[_0x0319('0x9')](realtime[_0x0319('0xa')]);return realtime;});}function main(){return server[_0x0319('0xb')](realtime,email)[_0x0319('0x6')](function(){return initRealtime();})[_0x0319('0x6')](function(){return setting[_0x0319('0xc')]();})[_0x0319('0x6')](function(_0x58fa0f){return setInterval(initRealtime,_0x58fa0f['loginMailFrequency']*0x3e8);})['catch'](function(_0x48fb76){logger[_0x0319('0xd')](_0x0319('0xe'),_0x48fb76);});}main(); \ No newline at end of file +var _0xec46=['then','getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve'];(function(_0x54c5ed,_0x27ca67){var _0x4cb286=function(_0x2cbc6b){while(--_0x2cbc6b){_0x54c5ed['push'](_0x54c5ed['shift']());}};_0x4cb286(++_0x27ca67);}(_0xec46,0x1e7));var _0x6ec4=function(_0x5f2829,_0x1918e9){_0x5f2829=_0x5f2829-0x0;var _0x51b4d1=_0xec46[_0x5f2829];return _0x51b4d1;};'use strict';var server=require(_0x6ec4('0x0'));var Realtime=require(_0x6ec4('0x1'));var EmailChannel=require(_0x6ec4('0x2'));var mailAccount=require(_0x6ec4('0x3'));var setting=require(_0x6ec4('0x4'));var logger=require(_0x6ec4('0x5'))(_0x6ec4('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6ec4('0x7')]()[_0x6ec4('0x8')](mailAccount[_0x6ec4('0x9')]())[_0x6ec4('0x8')](realtime[_0x6ec4('0xa')]())[_0x6ec4('0x8')](function(){email[_0x6ec4('0xb')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x6ec4('0x8')](function(){return setting[_0x6ec4('0xc')]();})[_0x6ec4('0x8')](function(_0x2612d2){return setInterval(initRealtime,_0x2612d2[_0x6ec4('0xd')]*0x3e8);})[_0x6ec4('0xe')](function(_0x16b5a8){logger['error']('Email\x20service\x20initialization',_0x16b5a8);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9a70a68..7150db7 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 _0x13c7=['socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','mailAccount:update','hasOwnProperty','service','custom','provider','email','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','status','connected','messages','firstName','lastName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost'];(function(_0x351134,_0x392b05){var _0x5a5278=function(_0x5a4a7f){while(--_0x5a4a7f){_0x351134['push'](_0x351134['shift']());}};_0x5a5278(++_0x392b05);}(_0x13c7,0x11d));var _0x713c=function(_0x4742b4,_0xfb0bb8){_0x4742b4=_0x4742b4-0x0;var _0x3e69e2=_0x13c7[_0x4742b4];return _0x3e69e2;};'use strict';var _=require(_0x713c('0x0'));var moment=require(_0x713c('0x1'));var BPromise=require(_0x713c('0x2'));var md5=require(_0x713c('0x3'));var Redis=require(_0x713c('0x4'));var config=require(_0x713c('0x5'));var logger=require(_0x713c('0x6'))('email');config['redis']=_[_0x713c('0x7')](config[_0x713c('0x8')],{'host':_0x713c('0x9'),'port':0x18eb});var io=require(_0x713c('0xa'))(new Redis(config[_0x713c('0x8')]));var EmailImap=require(_0x713c('0xb'));var EmailSmtp=require(_0x713c('0xc'));var mailAccount=require(_0x713c('0xd'));var md5Accounts={};function EmailChannel(_0x1ba4ad){logger[_0x713c('0xe')](_0x713c('0xf'));this[_0x713c('0x10')]=_0x1ba4ad['mailAccounts'];this[_0x713c('0x11')]={};this[_0x713c('0x12')]=new EmailSmtp();}EmailChannel[_0x713c('0x13')][_0x713c('0x14')]=function(_0x54d262){var _0x15f33d=this[_0x713c('0x10')][_0x54d262];var _0x54428d={'id':_0x15f33d['id'],'name':_0x15f33d[_0x713c('0x15')],'key':_0x15f33d[_0x713c('0x16')],'active':_0x15f33d[_0x713c('0x17')],'Imap':{'status':_0x15f33d[_0x713c('0x18')]['status'],'messageStatus':_0x15f33d[_0x713c('0x18')][_0x713c('0x19')],'total':_0x15f33d['Imap'][_0x713c('0x1a')]}};if(_[_0x713c('0x1b')](md5Accounts[_0x54d262])){md5Accounts[_0x54d262]={};}var _0x18f941=md5(JSON['stringify'](_0x54428d));if(md5Accounts[_0x54d262]['md5']!==_0x18f941){md5Accounts[_0x54d262][_0x713c('0x3')]=_0x18f941;io[_0x713c('0x14')](_0x713c('0x1c'),_0x54428d);}};EmailChannel[_0x713c('0x13')]['refresh']=function(_0x494b6b){for(var _0x4cd6bf in _0x494b6b){if(_0x494b6b[_0x713c('0x1d')](_0x4cd6bf)){if(_0x494b6b[_0x4cd6bf][_0x713c('0x18')]&&_0x494b6b[_0x4cd6bf][_0x713c('0x17')]){var _0x4ddd11=_0x494b6b[_0x4cd6bf][_0x713c('0x18')];if(!_0x4ddd11[_0x713c('0x1e')]&&_0x494b6b[_0x4cd6bf]['provider']!==_0x713c('0x1f'))_0x4ddd11[_0x713c('0x1e')]=_0x494b6b[_0x4cd6bf][_0x713c('0x20')];if(!this[_0x713c('0x11')][_0x713c('0x1d')](_0x4ddd11['id'])){this[_0x713c('0x11')][_0x4ddd11['id']]=new EmailImap(_0x4ddd11,_0x494b6b[_0x4cd6bf][_0x713c('0x21')]);this['imapAccounts'][_0x4ddd11['id']]['on'](_0x713c('0x22'),this[_0x713c('0x23')][_0x713c('0x24')](this,_0x4cd6bf));this[_0x713c('0x11')][_0x4ddd11['id']]['on']('email',this[_0x713c('0x25')][_0x713c('0x24')](this,_0x4cd6bf));this['imapAccounts'][_0x4ddd11['id']]['on']('end',this[_0x713c('0x26')][_0x713c('0x24')](this,_0x4cd6bf));this[_0x713c('0x11')][_0x4ddd11['id']]['on'](_0x713c('0x27'),this[_0x713c('0x28')][_0x713c('0x24')](this,_0x4cd6bf));}}else{if(_[_0x713c('0x1b')](this['mailAccounts'][_0x4cd6bf][_0x713c('0x18')])){this['mailAccounts'][_0x4cd6bf][_0x713c('0x18')]={};}this[_0x713c('0x10')][_0x4cd6bf]['Imap']['status']=_0x713c('0x29');this[_0x713c('0x10')][_0x4cd6bf][_0x713c('0x18')]['messageStatus']='';this[_0x713c('0x14')](_0x4cd6bf);}}}};EmailChannel[_0x713c('0x13')][_0x713c('0x23')]=function(_0x2937b3,_0x5de173){if(this[_0x713c('0x10')][_0x2937b3]){this[_0x713c('0x10')][_0x2937b3][_0x713c('0x18')][_0x713c('0x2a')]=_0x713c('0x2b');this[_0x713c('0x10')][_0x2937b3][_0x713c('0x18')][_0x713c('0x19')]=_0x5de173[_0x713c('0x15')];if(_0x5de173[_0x713c('0x2c')]){this[_0x713c('0x10')][_0x2937b3][_0x713c('0x18')][_0x713c('0x1a')]=_0x5de173[_0x713c('0x2c')]['total'];}return this[_0x713c('0x14')](_0x2937b3);}};EmailChannel[_0x713c('0x13')][_0x713c('0x25')]=function(_0x337553,_0x3cdd1e){logger[_0x713c('0xe')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3cdd1e[_0x713c('0x2d')],_0x3cdd1e[_0x713c('0x2e')],_0x3cdd1e['from'],_0x337553);if(this['mailAccounts'][_0x337553]){return mailAccount['notify'](_0x337553,_0x3cdd1e)[_0x713c('0x2f')](function(_0x8d1de7){if(_0x8d1de7){logger['info'](_0x713c('0x30'));}})[_0x713c('0x31')](function(_0x334a9e){logger['error'](_0x713c('0x32'),JSON[_0x713c('0x33')](_0x334a9e));});}};EmailChannel['prototype'][_0x713c('0x26')]=function(_0x16eb15){if(this[_0x713c('0x10')][_0x16eb15]&&this['mailAccounts'][_0x16eb15]['Imap']){if(this[_0x713c('0x11')][this[_0x713c('0x10')][_0x16eb15]['Imap']['id']]){delete this['imapAccounts'][this[_0x713c('0x10')][_0x16eb15]['Imap']['id']];}this[_0x713c('0x10')][_0x16eb15][_0x713c('0x18')]['lastSync']=moment();this[_0x713c('0x14')](_0x16eb15);}};EmailChannel[_0x713c('0x13')][_0x713c('0x28')]=function(_0x2697d8,_0x27850b){if(this[_0x713c('0x10')][_0x2697d8]){this[_0x713c('0x10')][_0x2697d8][_0x713c('0x18')][_0x713c('0x2a')]=_0x713c('0x27');this['mailAccounts'][_0x2697d8][_0x713c('0x18')]['messageStatus']=_0x27850b;return this[_0x713c('0x14')](_0x2697d8);}};EmailChannel[_0x713c('0x13')][_0x713c('0x34')]=function(_0x5c7e28,_0x218628){return this[_0x713c('0x12')][_0x713c('0x35')](_0x5c7e28,_0x218628);};EmailChannel[_0x713c('0x13')][_0x713c('0x36')]=function(_0x2b9c0f){var _0xe025b0=this;if(this[_0x713c('0x10')][_0x2b9c0f['id']]){if(_[_0x713c('0x1b')](this[_0x713c('0x10')][_0x2b9c0f['id']]['Smtp'])){this[_0x713c('0x10')][_0x2b9c0f['id']]['Smtp']={};}this[_0x713c('0x10')][_0x2b9c0f['id']][_0x713c('0x37')]['lastSync']=moment();return new BPromise(function(_0x4fc970,_0x290bb9){return _0xe025b0[_0x713c('0x12')][_0x713c('0x38')](_0x2b9c0f)[_0x713c('0x2f')](function(_0x5b82c3){_0xe025b0[_0x713c('0x10')][_0x2b9c0f['id']][_0x713c('0x37')][_0x713c('0x2a')]=_0x713c('0x39');_0xe025b0[_0x713c('0x10')][_0x2b9c0f['id']][_0x713c('0x37')][_0x713c('0x19')]='';_0xe025b0['emit'](_0x2b9c0f['id']);_0x4fc970(_0x5b82c3);})[_0x713c('0x31')](function(_0x295305){_0xe025b0[_0x713c('0x10')][_0x2b9c0f['id']][_0x713c('0x37')][_0x713c('0x2a')]=_0x713c('0x27');_0xe025b0[_0x713c('0x10')][_0x2b9c0f['id']][_0x713c('0x37')][_0x713c('0x19')]=_0x295305;_0xe025b0[_0x713c('0x14')](_0x2b9c0f['id']);_0x290bb9(_0x295305);});});}return this[_0x713c('0x12')][_0x713c('0x38')](_0x2b9c0f);};module[_0x713c('0x3a')]=EmailChannel; \ No newline at end of file +var _0x3d81=['Smtp','verify','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','Imap','messageStatus','total','isNil','stringify','emit','mailAccount:update','hasOwnProperty','active','provider','service','email','handleImapBox','bind','handleImapEnd','error','status','disabled','connected','name','messages','handleImapEmail','info','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','verifySmtp'];(function(_0x21647d,_0x3b9b68){var _0x428e9b=function(_0x5cc97d){while(--_0x5cc97d){_0x21647d['push'](_0x21647d['shift']());}};_0x428e9b(++_0x3b9b68);}(_0x3d81,0xd6));var _0x13d8=function(_0x56a333,_0x250839){_0x56a333=_0x56a333-0x0;var _0xf6f3f0=_0x3d81[_0x56a333];return _0xf6f3f0;};'use strict';var _=require(_0x13d8('0x0'));var moment=require('moment');var BPromise=require(_0x13d8('0x1'));var md5=require(_0x13d8('0x2'));var Redis=require(_0x13d8('0x3'));var config=require(_0x13d8('0x4'));var logger=require(_0x13d8('0x5'))('email');config[_0x13d8('0x6')]=_[_0x13d8('0x7')](config[_0x13d8('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x13d8('0x6')]));var EmailImap=require(_0x13d8('0x8'));var EmailSmtp=require(_0x13d8('0x9'));var mailAccount=require(_0x13d8('0xa'));var md5Accounts={};function EmailChannel(_0x44b646){logger['info'](_0x13d8('0xb'));this[_0x13d8('0xc')]=_0x44b646[_0x13d8('0xc')];this[_0x13d8('0xd')]={};this[_0x13d8('0xe')]=new EmailSmtp();}EmailChannel[_0x13d8('0xf')]['emit']=function(_0x1ece03){var _0x5c838e=this[_0x13d8('0xc')][_0x1ece03];var _0x4303b6={'id':_0x5c838e['id'],'name':_0x5c838e['name'],'key':_0x5c838e['key'],'active':_0x5c838e['active'],'Imap':{'status':_0x5c838e[_0x13d8('0x10')]['status'],'messageStatus':_0x5c838e[_0x13d8('0x10')][_0x13d8('0x11')],'total':_0x5c838e[_0x13d8('0x10')][_0x13d8('0x12')]}};if(_[_0x13d8('0x13')](md5Accounts[_0x1ece03])){md5Accounts[_0x1ece03]={};}var _0x130faa=md5(JSON[_0x13d8('0x14')](_0x4303b6));if(md5Accounts[_0x1ece03][_0x13d8('0x2')]!==_0x130faa){md5Accounts[_0x1ece03][_0x13d8('0x2')]=_0x130faa;io[_0x13d8('0x15')](_0x13d8('0x16'),_0x4303b6);}};EmailChannel['prototype']['refresh']=function(_0x45af59){for(var _0x25069c in _0x45af59){if(_0x45af59[_0x13d8('0x17')](_0x25069c)){if(_0x45af59[_0x25069c][_0x13d8('0x10')]&&_0x45af59[_0x25069c][_0x13d8('0x18')]){var _0x275e90=_0x45af59[_0x25069c]['Imap'];if(!_0x275e90['service']&&_0x45af59[_0x25069c][_0x13d8('0x19')]!=='custom')_0x275e90[_0x13d8('0x1a')]=_0x45af59[_0x25069c][_0x13d8('0x19')];if(!this['imapAccounts']['hasOwnProperty'](_0x275e90['id'])){this[_0x13d8('0xd')][_0x275e90['id']]=new EmailImap(_0x275e90,_0x45af59[_0x25069c][_0x13d8('0x1b')]);this[_0x13d8('0xd')][_0x275e90['id']]['on']('box',this[_0x13d8('0x1c')][_0x13d8('0x1d')](this,_0x25069c));this[_0x13d8('0xd')][_0x275e90['id']]['on']('email',this['handleImapEmail'][_0x13d8('0x1d')](this,_0x25069c));this[_0x13d8('0xd')][_0x275e90['id']]['on']('end',this[_0x13d8('0x1e')][_0x13d8('0x1d')](this,_0x25069c));this[_0x13d8('0xd')][_0x275e90['id']]['on'](_0x13d8('0x1f'),this['handleImapError'][_0x13d8('0x1d')](this,_0x25069c));}}else{if(_[_0x13d8('0x13')](this['mailAccounts'][_0x25069c][_0x13d8('0x10')])){this['mailAccounts'][_0x25069c]['Imap']={};}this[_0x13d8('0xc')][_0x25069c][_0x13d8('0x10')][_0x13d8('0x20')]=_0x13d8('0x21');this[_0x13d8('0xc')][_0x25069c][_0x13d8('0x10')][_0x13d8('0x11')]='';this[_0x13d8('0x15')](_0x25069c);}}}};EmailChannel[_0x13d8('0xf')][_0x13d8('0x1c')]=function(_0x5b10f9,_0x232f93){if(this[_0x13d8('0xc')][_0x5b10f9]){this['mailAccounts'][_0x5b10f9][_0x13d8('0x10')][_0x13d8('0x20')]=_0x13d8('0x22');this[_0x13d8('0xc')][_0x5b10f9][_0x13d8('0x10')]['messageStatus']=_0x232f93[_0x13d8('0x23')];if(_0x232f93[_0x13d8('0x24')]){this[_0x13d8('0xc')][_0x5b10f9][_0x13d8('0x10')]['total']=_0x232f93['messages'][_0x13d8('0x12')];}return this[_0x13d8('0x15')](_0x5b10f9);}};EmailChannel[_0x13d8('0xf')][_0x13d8('0x25')]=function(_0x5496ad,_0x6c2827){logger[_0x13d8('0x26')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x6c2827[_0x13d8('0x27')],_0x6c2827[_0x13d8('0x28')],_0x6c2827[_0x13d8('0x29')],_0x5496ad);if(this[_0x13d8('0xc')][_0x5496ad]){return mailAccount[_0x13d8('0x2a')](_0x5496ad,_0x6c2827)[_0x13d8('0x2b')](function(_0x1b81ad){if(_0x1b81ad){logger[_0x13d8('0x26')](_0x13d8('0x2c'));}})[_0x13d8('0x2d')](function(_0x533e3d){logger[_0x13d8('0x1f')](_0x13d8('0x2e'),JSON[_0x13d8('0x14')](_0x533e3d));});}};EmailChannel['prototype'][_0x13d8('0x1e')]=function(_0x29ded2){if(this[_0x13d8('0xc')][_0x29ded2]&&this[_0x13d8('0xc')][_0x29ded2]['Imap']){if(this[_0x13d8('0xd')][this[_0x13d8('0xc')][_0x29ded2][_0x13d8('0x10')]['id']]){delete this[_0x13d8('0xd')][this[_0x13d8('0xc')][_0x29ded2][_0x13d8('0x10')]['id']];}this[_0x13d8('0xc')][_0x29ded2]['Imap'][_0x13d8('0x2f')]=moment();this[_0x13d8('0x15')](_0x29ded2);}};EmailChannel[_0x13d8('0xf')][_0x13d8('0x30')]=function(_0x7f7edc,_0x40c3af){if(this[_0x13d8('0xc')][_0x7f7edc]){this[_0x13d8('0xc')][_0x7f7edc]['Imap'][_0x13d8('0x20')]=_0x13d8('0x1f');this[_0x13d8('0xc')][_0x7f7edc]['Imap'][_0x13d8('0x11')]=_0x40c3af;return this['emit'](_0x7f7edc);}};EmailChannel[_0x13d8('0xf')][_0x13d8('0x31')]=function(_0x5ee088,_0x3c4ce8){return this['smtp']['send'](_0x5ee088,_0x3c4ce8);};EmailChannel[_0x13d8('0xf')][_0x13d8('0x32')]=function(_0x2b326d){var _0x38d38f=this;if(this['mailAccounts'][_0x2b326d['id']]){if(_['isNil'](this[_0x13d8('0xc')][_0x2b326d['id']][_0x13d8('0x33')])){this[_0x13d8('0xc')][_0x2b326d['id']][_0x13d8('0x33')]={};}this[_0x13d8('0xc')][_0x2b326d['id']][_0x13d8('0x33')]['lastSync']=moment();return new BPromise(function(_0x4d15f0,_0xd4992a){return _0x38d38f[_0x13d8('0xe')]['verify'](_0x2b326d)[_0x13d8('0x2b')](function(_0xe666f3){_0x38d38f['mailAccounts'][_0x2b326d['id']][_0x13d8('0x33')]['status']='verified';_0x38d38f[_0x13d8('0xc')][_0x2b326d['id']][_0x13d8('0x33')]['messageStatus']='';_0x38d38f['emit'](_0x2b326d['id']);_0x4d15f0(_0xe666f3);})[_0x13d8('0x2d')](function(_0x477ea0){_0x38d38f[_0x13d8('0xc')][_0x2b326d['id']]['Smtp'][_0x13d8('0x20')]='error';_0x38d38f['mailAccounts'][_0x2b326d['id']]['Smtp']['messageStatus']=_0x477ea0;_0x38d38f[_0x13d8('0x15')](_0x2b326d['id']);_0xd4992a(_0x477ea0);});});}return this[_0x13d8('0xe')][_0x13d8('0x34')](_0x2b326d);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b2ad206..dd2d0c5 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 _0x4489=['email','mailbox','account','getAccount','once','ready','handleReady','end','handleEnd','handleError','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','data5','password','authentication','anonymous@xcally.com','host','port','tls','handleOpenBox','bind','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','error','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger'];(function(_0x3ecbaa,_0xa4d584){var _0x20177c=function(_0x558499){while(--_0x558499){_0x3ecbaa['push'](_0x3ecbaa['shift']());}};_0x20177c(++_0xa4d584);}(_0x4489,0x1cf));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9448('0x0'));var Imap=require(_0x9448('0x1'));var simpleParser=require(_0x9448('0x2'))[_0x9448('0x3')];var Iconv=require(_0x9448('0x4'))[_0x9448('0x5')];var EventEmitter=require('events')[_0x9448('0x6')];var utils=require(_0x9448('0x7'));var logger=require(_0x9448('0x8'))(_0x9448('0x9'));function EmailImap(_0x54fb5b,_0x546c32){this[_0x9448('0xa')]=_0x54fb5b[_0x9448('0xa')];this[_0x9448('0xb')]=this[_0x9448('0xc')](_0x54fb5b,_0x546c32);this[_0x9448('0x1')]=new Imap(this[_0x9448('0xb')]);this['imap'][_0x9448('0xd')](_0x9448('0xe'),this[_0x9448('0xf')]['bind'](this));this['imap'][_0x9448('0xd')](_0x9448('0x10'),this[_0x9448('0x11')]['bind'](this));this[_0x9448('0x1')]['on']('error',this[_0x9448('0x12')]['bind'](this));this[_0x9448('0x1')]['connect']();}util[_0x9448('0x13')](EmailImap,EventEmitter);EmailImap[_0x9448('0x14')]['getAccount']=function(_0x116b86,_0x55e8a3){var _0x506d0a={'connTimeout':_0x116b86[_0x9448('0x15')]?_0x116b86[_0x9448('0x15')]*0x3e8:0x2710,'authTimeout':_0x116b86[_0x9448('0x16')]?_0x116b86[_0x9448('0x16')]*0x3e8:0x1388};if(_0x116b86['service']){_0x506d0a[_0x9448('0x17')]=_0x116b86[_0x9448('0x17')];if(_0x116b86[_0x9448('0x18')]){_0x506d0a[_0x9448('0x19')]=utils['generateXOAuth2Token'](_0x116b86['CloudProvider'][_0x9448('0x1a')],_0x116b86['user']);}else{_0x506d0a[_0x9448('0x1b')]=_0x116b86['password'];}}else{if(_0x116b86[_0x9448('0x1c')]){_0x506d0a[_0x9448('0x17')]=_0x116b86['user'];_0x506d0a[_0x9448('0x1b')]=_0x116b86[_0x9448('0x1b')];}}_0x506d0a[_0x9448('0x9')]=_0x55e8a3||_0x116b86[_0x9448('0x17')]||_0x9448('0x1d');_0x506d0a[_0x9448('0x1e')]=_0x116b86[_0x9448('0x1e')];_0x506d0a[_0x9448('0x1f')]=_0x116b86[_0x9448('0x1f')]||0x3e1;if(_0x116b86[_0x9448('0x20')]){_0x506d0a[_0x9448('0x20')]=!![];}else{_0x506d0a['tls']=![];_0x506d0a['autotls']='required';}return _0x506d0a;};EmailImap[_0x9448('0x14')]['handleReady']=function(){this[_0x9448('0x1')]['openBox'](this[_0x9448('0xa')],![],this[_0x9448('0x21')][_0x9448('0x22')](this));};EmailImap[_0x9448('0x14')][_0x9448('0x21')]=function(_0x64380f,_0x513e75){if(_0x64380f){this['handleError'](_0x64380f,!![]);}else{this[_0x9448('0x23')](_0x9448('0x24'),_0x513e75);this[_0x9448('0x25')]();}};EmailImap[_0x9448('0x14')][_0x9448('0x26')]=function(_0x35dc2a){if(_0x35dc2a){this[_0x9448('0x12')](_0x35dc2a,!![]);}else{this[_0x9448('0x1')][_0x9448('0x10')]();}};EmailImap[_0x9448('0x14')][_0x9448('0x25')]=function(){this['imap'][_0x9448('0x27')]([_0x9448('0x28')],this[_0x9448('0x29')][_0x9448('0x22')](this));};EmailImap[_0x9448('0x14')][_0x9448('0x29')]=function(_0xa3ced8,_0x280545){if(_0xa3ced8){this['handleError'](_0xa3ced8,!![]);}else{if(_0x280545[_0x9448('0x2a')]){try{var _0x2f33b1=this[_0x9448('0x1')][_0x9448('0x2b')](_0x280545,{'bodies':'','markSeen':!![]});_0x2f33b1['on'](_0x9448('0x2c'),this[_0x9448('0x2d')][_0x9448('0x22')](this));_0x2f33b1['once']('error',this['handleFetchError']['bind'](this));_0x2f33b1['once']('end',this[_0x9448('0x2e')]['bind'](this));}catch(_0xd1a140){logger[_0x9448('0x2f')](_0xd1a140);}}else{this['imap'][_0x9448('0x30')](!![],this[_0x9448('0x26')]['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x3c5f4d){_0x3c5f4d['on'](_0x9448('0x31'),this[_0x9448('0x32')][_0x9448('0x22')](this));_0x3c5f4d[_0x9448('0xd')](_0x9448('0x33'),this[_0x9448('0x34')]['bind'](this));_0x3c5f4d[_0x9448('0xd')](_0x9448('0x10'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x9448('0x14')][_0x9448('0x32')]=function(_0x2b980c){simpleParser(_0x2b980c,{'Iconv':Iconv},this[_0x9448('0x35')][_0x9448('0x22')](this));};EmailImap[_0x9448('0x14')][_0x9448('0x34')]=function(){};EmailImap[_0x9448('0x14')][_0x9448('0x36')]=function(){};EmailImap['prototype'][_0x9448('0x35')]=function(_0x41e674,_0x5968af){if(_0x41e674){logger['error'](_0x41e674);}else{var _0x6465c3=this;utils['parser'](this['account'],_0x5968af,function(_0x551710){_0x6465c3[_0x9448('0x23')](_0x9448('0x9'),_0x551710);});}};EmailImap[_0x9448('0x14')][_0x9448('0x2e')]=function(){this[_0x9448('0x1')][_0x9448('0x30')](!![],this['handleCloseBox'][_0x9448('0x22')](this));};EmailImap[_0x9448('0x14')]['handleFetchError']=function(_0x5a95df){this['handleError'](_0x5a95df);this[_0x9448('0x1')][_0x9448('0x30')](!![],this[_0x9448('0x26')][_0x9448('0x22')](this));};EmailImap[_0x9448('0x14')][_0x9448('0x11')]=function(){this['emit'](_0x9448('0x10'));};EmailImap['prototype'][_0x9448('0x12')]=function(_0xb6fa8a,_0x4ba48c){logger[_0x9448('0x2f')](_0x9448('0x12'),this[_0x9448('0xb')][_0x9448('0x9')],JSON['stringify'](_0xb6fa8a));var _0x46af22='';if(_0xb6fa8a){if(_0xb6fa8a[_0x9448('0x37')]){_0x46af22=_0xb6fa8a[_0x9448('0x37')];}else{for(var _0xee1e03 in _0xb6fa8a){if(_0xb6fa8a[_0x9448('0x38')](_0xee1e03)){_0x46af22+=_[_0x9448('0x39')](_0xee1e03)+':\x20'+_0xb6fa8a[_0xee1e03]+'\x0a';}}}}if(_0x4ba48c){this[_0x9448('0x1')][_0x9448('0x10')]();}else{this[_0x9448('0x23')](_0x9448('0x2f'),_0x46af22);this[_0x9448('0x23')](_0x9448('0x10'));}};module[_0x9448('0x3a')]=EmailImap; \ No newline at end of file +var _0x3d36=['handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageAttributes','end','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','once','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','user','password','authentication','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x3d36,0xd1));var _0x63d3=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x3d36[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x63d3('0x0'));var util=require(_0x63d3('0x1'));var Imap=require(_0x63d3('0x2'));var simpleParser=require(_0x63d3('0x3'))['simpleParser'];var Iconv=require(_0x63d3('0x4'))['Iconv'];var EventEmitter=require(_0x63d3('0x5'))[_0x63d3('0x6')];var utils=require(_0x63d3('0x7'));var logger=require('../../../config/logger')(_0x63d3('0x8'));function EmailImap(_0x3ff331,_0x19e8a7){this[_0x63d3('0x9')]=_0x3ff331[_0x63d3('0x9')];this[_0x63d3('0xa')]=this[_0x63d3('0xb')](_0x3ff331,_0x19e8a7);this[_0x63d3('0x2')]=new Imap(this[_0x63d3('0xa')]);this[_0x63d3('0x2')][_0x63d3('0xc')]('ready',this[_0x63d3('0xd')][_0x63d3('0xe')](this));this[_0x63d3('0x2')][_0x63d3('0xc')]('end',this[_0x63d3('0xf')][_0x63d3('0xe')](this));this[_0x63d3('0x2')]['on'](_0x63d3('0x10'),this[_0x63d3('0x11')][_0x63d3('0xe')](this));this[_0x63d3('0x2')][_0x63d3('0x12')]();}util[_0x63d3('0x13')](EmailImap,EventEmitter);EmailImap[_0x63d3('0x14')][_0x63d3('0xb')]=function(_0x5f57dc,_0x312237){var _0x467c73={'connTimeout':_0x5f57dc['connTimeout']?_0x5f57dc[_0x63d3('0x15')]*0x3e8:0x2710,'authTimeout':_0x5f57dc[_0x63d3('0x16')]?_0x5f57dc[_0x63d3('0x16')]*0x3e8:0x1388};if(_0x5f57dc[_0x63d3('0x17')]){_0x467c73['user']=_0x5f57dc['user'];if(_0x5f57dc[_0x63d3('0x18')]){_0x467c73['xoauth2']=utils[_0x63d3('0x19')](_0x5f57dc[_0x63d3('0x1a')][_0x63d3('0x1b')],_0x5f57dc[_0x63d3('0x1c')]);}else{_0x467c73['password']=_0x5f57dc[_0x63d3('0x1d')];}}else{if(_0x5f57dc[_0x63d3('0x1e')]){_0x467c73[_0x63d3('0x1c')]=_0x5f57dc['user'];_0x467c73[_0x63d3('0x1d')]=_0x5f57dc[_0x63d3('0x1d')];}}_0x467c73[_0x63d3('0x8')]=_0x312237||_0x5f57dc[_0x63d3('0x1c')]||'anonymous@xcally.com';_0x467c73[_0x63d3('0x1f')]=_0x5f57dc['host'];_0x467c73['port']=_0x5f57dc[_0x63d3('0x20')]||0x3e1;if(_0x5f57dc[_0x63d3('0x21')]){_0x467c73['tls']=!![];}else{_0x467c73[_0x63d3('0x21')]=![];_0x467c73[_0x63d3('0x22')]='required';}return _0x467c73;};EmailImap['prototype'][_0x63d3('0xd')]=function(){this['imap'][_0x63d3('0x23')](this[_0x63d3('0x9')],![],this['handleOpenBox'][_0x63d3('0xe')](this));};EmailImap[_0x63d3('0x14')][_0x63d3('0x24')]=function(_0x536943,_0xc28c41){if(_0x536943){this[_0x63d3('0x11')](_0x536943,!![]);}else{this[_0x63d3('0x25')](_0x63d3('0x26'),_0xc28c41);this[_0x63d3('0x27')]();}};EmailImap[_0x63d3('0x14')][_0x63d3('0x28')]=function(_0x16b73b){if(_0x16b73b){this[_0x63d3('0x11')](_0x16b73b,!![]);}else{this[_0x63d3('0x2')]['end']();}};EmailImap[_0x63d3('0x14')][_0x63d3('0x27')]=function(){this[_0x63d3('0x2')][_0x63d3('0x29')]([_0x63d3('0x2a')],this[_0x63d3('0x2b')][_0x63d3('0xe')](this));};EmailImap['prototype'][_0x63d3('0x2b')]=function(_0x2c7529,_0x46aec2){if(_0x2c7529){this['handleError'](_0x2c7529,!![]);}else{if(_0x46aec2[_0x63d3('0x2c')]){try{var _0x371fe5=this[_0x63d3('0x2')][_0x63d3('0x2d')](_0x46aec2,{'bodies':'','markSeen':!![]});_0x371fe5['on'](_0x63d3('0x2e'),this[_0x63d3('0x2f')]['bind'](this));_0x371fe5['once'](_0x63d3('0x10'),this[_0x63d3('0x30')]['bind'](this));_0x371fe5[_0x63d3('0xc')]('end',this[_0x63d3('0x31')][_0x63d3('0xe')](this));}catch(_0x2a9fc){logger[_0x63d3('0x10')](_0x2a9fc);}}else{this[_0x63d3('0x2')]['closeBox'](!![],this[_0x63d3('0x28')][_0x63d3('0xe')](this));}}};EmailImap[_0x63d3('0x14')]['handleFetchMessage']=function(_0xbd1c1a){_0xbd1c1a['on'](_0x63d3('0x32'),this[_0x63d3('0x33')][_0x63d3('0xe')](this));_0xbd1c1a['once']('attributes',this[_0x63d3('0x34')][_0x63d3('0xe')](this));_0xbd1c1a[_0x63d3('0xc')](_0x63d3('0x35'),this[_0x63d3('0x36')][_0x63d3('0xe')](this));};EmailImap[_0x63d3('0x14')][_0x63d3('0x33')]=function(_0xe5db88){simpleParser(_0xe5db88,{'Iconv':Iconv},this[_0x63d3('0x37')][_0x63d3('0xe')](this));};EmailImap[_0x63d3('0x14')][_0x63d3('0x34')]=function(){};EmailImap[_0x63d3('0x14')]['handleMessageEnd']=function(){};EmailImap[_0x63d3('0x14')][_0x63d3('0x37')]=function(_0x34c3c3,_0x273af8){if(_0x34c3c3){logger[_0x63d3('0x10')](_0x34c3c3);}else{var _0x4a40c1=this;utils[_0x63d3('0x38')](this['account'],_0x273af8,function(_0xa559c3){_0x4a40c1[_0x63d3('0x25')](_0x63d3('0x8'),_0xa559c3);});}};EmailImap[_0x63d3('0x14')][_0x63d3('0x31')]=function(){this[_0x63d3('0x2')][_0x63d3('0x39')](!![],this[_0x63d3('0x28')]['bind'](this));};EmailImap[_0x63d3('0x14')][_0x63d3('0x30')]=function(_0x5c67e7){this[_0x63d3('0x11')](_0x5c67e7);this[_0x63d3('0x2')][_0x63d3('0x39')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x63d3('0x14')][_0x63d3('0xf')]=function(){this['emit']('end');};EmailImap[_0x63d3('0x14')]['handleError']=function(_0x57903d,_0x73f7f6){logger[_0x63d3('0x10')](_0x63d3('0x11'),this[_0x63d3('0xa')][_0x63d3('0x8')],JSON[_0x63d3('0x3a')](_0x57903d));var _0x7e4d5e='';if(_0x57903d){if(_0x57903d[_0x63d3('0x3b')]){_0x7e4d5e=_0x57903d['textCode'];}else{for(var _0x4f6f9b in _0x57903d){if(_0x57903d[_0x63d3('0x3c')](_0x4f6f9b)){_0x7e4d5e+=_[_0x63d3('0x3d')](_0x4f6f9b)+':\x20'+_0x57903d[_0x4f6f9b]+'\x0a';}}}}if(_0x73f7f6){this[_0x63d3('0x2')][_0x63d3('0x35')]();}else{this[_0x63d3('0x25')](_0x63d3('0x10'),_0x7e4d5e);this[_0x63d3('0x25')](_0x63d3('0x35'));}};module[_0x63d3('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 103bd17..1381184 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 _0x65b7=['sendMail','verify','toString','exports','prototype','compile'];(function(_0x4a7c97,_0x1ceb34){var _0x55f99c=function(_0x569bb5){while(--_0x569bb5){_0x4a7c97['push'](_0x4a7c97['shift']());}};_0x55f99c(++_0x1ceb34);}(_0x65b7,0x178));var _0x765b=function(_0x314ceb,_0x383495){_0x314ceb=_0x314ceb-0x0;var _0x5a3a6a=_0x65b7[_0x314ceb];return _0x5a3a6a;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x765b('0x0')]['send']=function(_0x3d2788,_0x1818be){return new Promise(function(_0x58eecc,_0x2c0b32){var _0xfa78ca=nodemailer['createTransport'](_0x3d2788);_0xfa78ca['use'](_0x765b('0x1'),inlineBase64());_0xfa78ca[_0x765b('0x2')](_0x1818be,function(_0x425607,_0xa6a3f0){if(_0x425607){_0x2c0b32(_0x425607['toString']());}else{_0x58eecc(_0xa6a3f0);}});});};EmailSmtp[_0x765b('0x0')][_0x765b('0x3')]=function(_0xfa9af3){return new Promise(function(_0x2fab80,_0xc1423){var _0x27b89b=nodemailer['createTransport'](_0xfa9af3);_0x27b89b[_0x765b('0x3')](function(_0x1d1923,_0x321d58){if(_0x1d1923){_0xc1423(_0x1d1923[_0x765b('0x4')]());}else{if(_0x321d58){_0x2fab80(_0x321d58);}else{_0xc1423('Not\x20verifired');}}});});};module[_0x765b('0x5')]=EmailSmtp; \ No newline at end of file +var _0x8438=['use','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x486398,_0x370d53){var _0x2d4bc5=function(_0x4013f9){while(--_0x4013f9){_0x486398['push'](_0x486398['shift']());}};_0x2d4bc5(++_0x370d53);}(_0x8438,0x1ea));var _0x8843=function(_0x21f947,_0x4e63c8){_0x21f947=_0x21f947-0x0;var _0x33603b=_0x8438[_0x21f947];return _0x33603b;};'use strict';var nodemailer=require(_0x8843('0x0'));var inlineBase64=require(_0x8843('0x1'));function EmailSmtp(){}EmailSmtp[_0x8843('0x2')][_0x8843('0x3')]=function(_0x89a930,_0x29dc17){return new Promise(function(_0x37ecd9,_0x2a2bef){var _0x5874d2=nodemailer[_0x8843('0x4')](_0x89a930);_0x5874d2[_0x8843('0x5')]('compile',inlineBase64());_0x5874d2['sendMail'](_0x29dc17,function(_0x528659,_0x3c4045){if(_0x528659){_0x2a2bef(_0x528659[_0x8843('0x6')]());}else{_0x37ecd9(_0x3c4045);}});});};EmailSmtp[_0x8843('0x2')]['verify']=function(_0x439ea7){return new Promise(function(_0x3469e0,_0x46dda3){var _0x2b8bc9=nodemailer[_0x8843('0x4')](_0x439ea7);_0x2b8bc9[_0x8843('0x7')](function(_0x4da989,_0x14c179){if(_0x4da989){_0x46dda3(_0x4da989[_0x8843('0x6')]());}else{if(_0x14c179){_0x3469e0(_0x14c179);}else{_0x46dda3(_0x8843('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 275baa6..9dec703 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 _0x7911=['../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','slice','join','Anonymous','split','length','pop','isEmpty','@xcally.com','html','test','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','utf-8','toString','lodash','randomstring','path','node-tnef','email'];(function(_0x362777,_0xb94156){var _0xe4a158=function(_0x4b6285){while(--_0x4b6285){_0x362777['push'](_0x362777['shift']());}};_0xe4a158(++_0xb94156);}(_0x7911,0x1e5));var _0x1791=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x7911[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x1791('0x0'));var moment=require('moment');var random=require(_0x1791('0x1'));var fs=require('fs');var path=require(_0x1791('0x2'));var util=require('util');var tnef=require(_0x1791('0x3'));var logger=require('../../../config/logger')(_0x1791('0x4'));var config=require(_0x1791('0x5'));function getAddress(_0x5022bb){var _0x2616a2=_[_0x1791('0x6')](_0x5022bb[_0x1791('0x7')]);return _0x2616a2&&_0x2616a2['address']?_0x2616a2[_0x1791('0x8')]:_0x1791('0x9')+random[_0x1791('0xa')](0x6)+'@xcally.com';}function getFirstName(_0xc5f7db){var _0x926359=_[_0x1791('0x6')](_0xc5f7db[_0x1791('0x7')]);if(_0x926359&&_0x926359['name']){if(_0x926359[_0x1791('0xb')]==_0x926359[_0x1791('0x8')]){return _0x926359[_0x1791('0xb')][_0x1791('0xc')](0x0,_0x926359[_0x1791('0xb')][_0x1791('0xd')]('@'));}var _0x2f27e5=_0x926359['name']['split'](/\s+/);return _0x2f27e5['length']>0x1?_0x2f27e5[_0x1791('0xe')](0x0,-0x1)[_0x1791('0xf')]('\x20'):_0x926359[_0x1791('0xb')];}return _0x1791('0x10');}function getLastName(_0x376897){var _0x1def7b=_[_0x1791('0x6')](_0x376897[_0x1791('0x7')]);if(_0x1def7b&&_0x1def7b['name']){var _0x2f994e=_0x1def7b['name'][_0x1791('0x11')](/\s+/);return _0x2f994e[_0x1791('0x12')]>0x1?_0x2f994e[_0x1791('0x13')]():'';}return'';}function getMails(_0x453483,_0x4650e3){var _0x426a68='';for(var _0x4c2b7e=0x0;_0x4c2b7e<_0x4650e3['value'][_0x1791('0x12')];_0x4c2b7e+=0x1){if(_0x4650e3[_0x1791('0x7')][_0x4c2b7e]['address']!==_0x453483){if(!_[_0x1791('0x14')](_0x426a68)){_0x426a68+=',';}_0x426a68+=_0x4650e3['value'][_0x4c2b7e]['name']||_0x4650e3[_0x1791('0x7')][_0x4c2b7e][_0x1791('0x8')]||'';_0x426a68+='\x20<';_0x426a68+=_0x4650e3[_0x1791('0x7')][_0x4c2b7e][_0x1791('0x8')]?_0x4650e3[_0x1791('0x7')][_0x4c2b7e][_0x1791('0x8')]:_0x1791('0x9')+random['generate'](0x6)+_0x1791('0x15');_0x426a68+='>';}}return _0x426a68;}function parseEmail(_0x4dad02,_0x2fbaad,_0x444210){if(_0x2fbaad[_0x1791('0x16')]){var _0x1c4442=/)<[^<]*)*<\/script>/gi;while(_0x1c4442[_0x1791('0x17')](_0x2fbaad[_0x1791('0x16')])){_0x2fbaad[_0x1791('0x16')]=_0x2fbaad[_0x1791('0x16')]['replace'](_0x1c4442,'');}if(_0x2fbaad[_0x1791('0x16')][_0x1791('0x18')](_0x1791('0x19'))){var _0x2de179=[];_0x2fbaad[_0x1791('0x1a')][_0x1791('0x1b')](_0x4eb390=>{_0x2de179[_0x1791('0x1c')](_0x4eb390[_0x1791('0x1d')]);});var _0x2e1342=/]+>/g;var _0x4d287b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x11b537=_0x2fbaad[_0x1791('0x16')]['replace'](_0x4d287b,_0x1791('0x1e'));var _0x1e5619=_0x11b537[_0x1791('0x1f')](_0x2e1342,'_IMG');for(let _0xb1c95c=0x0;_0xb1c95c<_0x2de179[_0x1791('0x12')];_0xb1c95c++){var _0x135baf=_0x1e5619[_0x1791('0x1f')](_0x1791('0x20'),_0x1791('0x21')+_0x2de179[_0xb1c95c]+'\x20]');_0x1e5619=_0x135baf;}_0x2fbaad[_0x1791('0x16')]=_0x1e5619;}_0x444210[_0x1791('0x22')]=_0x2fbaad[_0x1791('0x16')];}else{_0x444210['body']=_0x2fbaad[_0x1791('0x23')];}if(_0x444210[_0x1791('0x22')]){_0x444210['body']=_0x444210[_0x1791('0x22')][_0x1791('0x1f')](/0x0){var _0x460532=[_0x1791('0x30'),_0x1791('0x31'),_0x1791('0x32')];for(var _0x4774ba=0x0;_0x4774ba<_0x2fbaad[_0x1791('0x2f')][_0x1791('0x12')];_0x4774ba++){var _0x248f2a=_[_0x1791('0xd')](_0x460532,_0x2fbaad['headerLines'][_0x4774ba][_0x1791('0x33')]);if(_0x248f2a>=0x0){_0x444210['isAutoreply']=!![];}}}return _0x444210;}exports['parser']=function(_0x42bb3b,_0x16726c,_0x56960e){var _0x35c6e0={'from':getAddress(_0x16726c[_0x1791('0x34')]),'firstName':getFirstName(_0x16726c[_0x1791('0x34')]),'lastName':getLastName(_0x16726c['from']),'mapKey':_0x1791('0x4'),'message':{'from':getMails(_0x42bb3b[_0x1791('0x4')],_0x16726c[_0x1791('0x34')]),'to':_0x42bb3b['email'],'cc':'','subject':_0x16726c[_0x1791('0x35')]||'','messageId':_0x16726c[_0x1791('0x36')],'inReplyTo':_0x16726c[_0x1791('0x37')],'sentAt':moment(_0x16726c['date'])[_0x1791('0x38')](_0x1791('0x39')),'attach':![],'attachments':[]}};if(!_0x16726c[_0x1791('0x16')]&&!_0x16726c[_0x1791('0x23')]){var _0x11c1fc=_[_0x1791('0x3a')](_0x16726c[_0x1791('0x1a')],{'contentType':_0x1791('0x3b')});if(_0x11c1fc[_0x1791('0x12')]){logger[_0x1791('0x3c')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x16726c['messageId']));tnef[_0x1791('0x3d')](_['first'](_0x11c1fc)['content'],function(_0x5e8100,_0x24347c){if(_0x24347c){_0x16726c[_0x1791('0x16')]=_0x24347c[_0x1791('0x3e')]||_0x1791('0x3f');if(_0x24347c[_0x1791('0x40')]){for(var _0x1aefbb=0x0;_0x1aefbb<_0x24347c['Attachments'][_0x1791('0x12')];_0x1aefbb++){var _0x3ea8cd=_0x24347c[_0x1791('0x40')][_0x1aefbb];_0x35c6e0[_0x1791('0x25')]['attachments'][_0x1791('0x1c')]({'filename':_0x3ea8cd[_0x1791('0x41')],'content':Buffer[_0x1791('0x34')](_0x3ea8cd['Data'])});}}}_0x56960e(parseEmail(_0x42bb3b,_0x16726c,_0x35c6e0));});}else{_0x16726c[_0x1791('0x16')]=_0x1791('0x3f');_0x56960e(parseEmail(_0x42bb3b,_0x16726c,_0x35c6e0));}}else{_0x56960e(parseEmail(_0x42bb3b,_0x16726c,_0x35c6e0));}};exports[_0x1791('0x42')]=function(_0x58456d,_0x376a09){var _0x313085=[_0x1791('0x43')+(_0x376a09||''),'auth=Bearer\x20'+_0x58456d,'',''];return Buffer[_0x1791('0x34')](_0x313085[_0x1791('0xf')](''),_0x1791('0x44'))[_0x1791('0x45')]('base64');}; \ No newline at end of file +var _0x1358=['join','pop','length','isEmpty','html','test','replace','','textAsHtml','body','0x1?_0x45d195[_0x8135('0xf')](0x0,-0x1)[_0x8135('0x10')]('\x20'):_0x2ce6f8[_0x8135('0xc')];}return'Anonymous';}function getLastName(_0x13c86c){var _0x5d350b=_['head'](_0x13c86c[_0x8135('0x7')]);if(_0x5d350b&&_0x5d350b['name']){var _0x21e5c3=_0x5d350b['name']['split'](/\s+/);return _0x21e5c3['length']>0x1?_0x21e5c3[_0x8135('0x11')]():'';}return'';}function getMails(_0x4d4394,_0x117bb4){var _0x4a58b3='';for(var _0x4746dd=0x0;_0x4746dd<_0x117bb4[_0x8135('0x7')][_0x8135('0x12')];_0x4746dd+=0x1){if(_0x117bb4[_0x8135('0x7')][_0x4746dd][_0x8135('0x8')]!==_0x4d4394){if(!_[_0x8135('0x13')](_0x4a58b3)){_0x4a58b3+=',';}_0x4a58b3+=_0x117bb4['value'][_0x4746dd][_0x8135('0xc')]||_0x117bb4[_0x8135('0x7')][_0x4746dd]['address']||'';_0x4a58b3+='\x20<';_0x4a58b3+=_0x117bb4[_0x8135('0x7')][_0x4746dd][_0x8135('0x8')]?_0x117bb4[_0x8135('0x7')][_0x4746dd][_0x8135('0x8')]:'anonymous'+random[_0x8135('0xa')](0x6)+_0x8135('0xb');_0x4a58b3+='>';}}return _0x4a58b3;}function parseEmail(_0x23dff1,_0x250c00,_0x512ff9){if(_0x250c00[_0x8135('0x14')]){var _0x52b3af=/)<[^<]*)*<\/script>/gi;while(_0x52b3af[_0x8135('0x15')](_0x250c00[_0x8135('0x14')])){_0x250c00[_0x8135('0x14')]=_0x250c00[_0x8135('0x14')][_0x8135('0x16')](_0x52b3af,'');}if(_0x250c00[_0x8135('0x14')]['includes'](_0x8135('0x17'))){var _0xebd930=[];_0x250c00[_0x8135('0x18')][_0x8135('0x19')](_0x4dc46a=>{_0xebd930[_0x8135('0x1a')](_0x4dc46a['filename']);});var _0x216d19=/]+>/g;var _0x1be54e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4d6b6b=_0x250c00['html']['replace'](_0x1be54e,_0x8135('0x1b'));var _0xc6bcb6=_0x4d6b6b[_0x8135('0x16')](_0x216d19,_0x8135('0x1c'));for(let _0x2176b4=0x0;_0x2176b4<_0xebd930['length'];_0x2176b4++){var _0x37a247=_0xc6bcb6[_0x8135('0x16')](_0x8135('0x1c'),'\x20[Attachment:\x20'+_0xebd930[_0x2176b4]+_0x8135('0x1d'));_0xc6bcb6=_0x37a247;}_0x250c00[_0x8135('0x14')]=_0xc6bcb6;}_0x512ff9['body']=_0x250c00[_0x8135('0x14')];}else{_0x512ff9['body']=_0x250c00[_0x8135('0x1e')];}if(_0x512ff9[_0x8135('0x1f')]){_0x512ff9['body']=_0x512ff9[_0x8135('0x1f')]['replace'](/0x0){var _0x5e0601=[_0x8135('0x31'),'X-Auto-Response-Suppress:\x20All',_0x8135('0x32')];for(var _0x3c4f56=0x0;_0x3c4f56<_0x250c00[_0x8135('0x30')][_0x8135('0x12')];_0x3c4f56++){var _0x3e1ef8=_['indexOf'](_0x5e0601,_0x250c00['headerLines'][_0x3c4f56][_0x8135('0x33')]);if(_0x3e1ef8>=0x0){_0x512ff9['isAutoreply']=!![];}}}return _0x512ff9;}exports[_0x8135('0x34')]=function(_0x151e79,_0x324f72,_0x284da6){var _0x67fddc={'from':getAddress(_0x324f72[_0x8135('0x35')]),'firstName':getFirstName(_0x324f72[_0x8135('0x35')]),'lastName':getLastName(_0x324f72['from']),'mapKey':_0x8135('0x4'),'message':{'from':getMails(_0x151e79[_0x8135('0x4')],_0x324f72['from']),'to':_0x151e79['email'],'cc':'','subject':_0x324f72[_0x8135('0x36')]||'','messageId':_0x324f72[_0x8135('0x37')],'inReplyTo':_0x324f72['inReplyTo'],'sentAt':moment(_0x324f72[_0x8135('0x38')])[_0x8135('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x324f72[_0x8135('0x14')]&&!_0x324f72[_0x8135('0x1e')]){var _0x2a0abe=_[_0x8135('0x3a')](_0x324f72[_0x8135('0x18')],{'contentType':'application/ms-tnef'});if(_0x2a0abe[_0x8135('0x12')]){logger[_0x8135('0x3b')](util[_0x8135('0x39')](_0x8135('0x3c'),_0x324f72['messageId']));tnef[_0x8135('0x3d')](_['first'](_0x2a0abe)[_0x8135('0x2e')],function(_0xe0726,_0xd109e4){if(_0xd109e4){_0x324f72[_0x8135('0x14')]=_0xd109e4[_0x8135('0x3e')]||'

Empty\x20message

';if(_0xd109e4[_0x8135('0x3f')]){for(var _0x3a3b6c=0x0;_0x3a3b6c<_0xd109e4[_0x8135('0x3f')][_0x8135('0x12')];_0x3a3b6c++){var _0x13570d=_0xd109e4[_0x8135('0x3f')][_0x3a3b6c];_0x67fddc['message'][_0x8135('0x18')][_0x8135('0x1a')]({'filename':_0x13570d[_0x8135('0x40')],'content':Buffer[_0x8135('0x35')](_0x13570d[_0x8135('0x41')])});}}}_0x284da6(parseEmail(_0x151e79,_0x324f72,_0x67fddc));});}else{_0x324f72[_0x8135('0x14')]='

Empty\x20message

';_0x284da6(parseEmail(_0x151e79,_0x324f72,_0x67fddc));}}else{_0x284da6(parseEmail(_0x151e79,_0x324f72,_0x67fddc));}};exports[_0x8135('0x42')]=function(_0x17fff5,_0x537f34){var _0x28dcbd=[_0x8135('0x43')+(_0x537f34||''),'auth=Bearer\x20'+_0x17fff5,'',''];return Buffer[_0x8135('0x35')](_0x28dcbd[_0x8135('0x10')](''),'utf-8')[_0x8135('0x44')](_0x8135('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index cfd9dfb..91f8ae2 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 _0x90a6=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x180485,_0x5335d4){var _0x3b84ab=function(_0x135f71){while(--_0x135f71){_0x180485['push'](_0x180485['shift']());}};_0x3b84ab(++_0x5335d4);}(_0x90a6,0x95));var _0x690a=function(_0x15009d,_0x1037f2){_0x15009d=_0x15009d-0x0;var _0x50d8e9=_0x90a6[_0x15009d];return _0x50d8e9;};'use strict';var _=require(_0x690a('0x0'));function MailAccount(_0x42af0d){this['id']=_0x42af0d['id']||0x0;this['name']=_0x42af0d[_0x690a('0x1')]||_0x690a('0x2');this[_0x690a('0x3')]=_0x42af0d[_0x690a('0x3')]||_0x690a('0x4');this[_0x690a('0x5')]=_0x42af0d[_0x690a('0x5')]||![];this['Imap']=_0x42af0d[_0x690a('0x6')]||[];this[_0x690a('0x7')]=_0x42af0d[_0x690a('0x7')]||[];}module[_0x690a('0x8')]=MailAccount; \ No newline at end of file +var _0xee86=['key','SERV','active','Imap','Smtp','exports','name','Service'];(function(_0x580e99,_0x32049e){var _0x217605=function(_0x2ddc3f){while(--_0x2ddc3f){_0x580e99['push'](_0x580e99['shift']());}};_0x217605(++_0x32049e);}(_0xee86,0x1c6));var _0x6ee8=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xee86[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');function MailAccount(_0x30cfa8){this['id']=_0x30cfa8['id']||0x0;this[_0x6ee8('0x0')]=_0x30cfa8['name']||_0x6ee8('0x1');this[_0x6ee8('0x2')]=_0x30cfa8[_0x6ee8('0x2')]||_0x6ee8('0x3');this[_0x6ee8('0x4')]=_0x30cfa8['active']||![];this[_0x6ee8('0x5')]=_0x30cfa8[_0x6ee8('0x5')]||[];this[_0x6ee8('0x6')]=_0x30cfa8[_0x6ee8('0x6')]||[];}module[_0x6ee8('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index eafae53..6eff9ab 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 _0x48f3=['isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x48f3,0x183));var _0x348f=function(_0x4480c4,_0x27253d){_0x4480c4=_0x4480c4-0x0;var _0xc9c375=_0x48f3[_0x4480c4];return _0xc9c375;};'use strict';var _=require(_0x348f('0x0'));var MailAccount=require(_0x348f('0x1'));var Realtime=function(){this[_0x348f('0x2')]={};};function freeIsNotKey(_0x2d6881,_0x381b82,_0x183b52){var _0x2e8690=_[_0x348f('0x3')](_0x2d6881,function(_0x1f43e7,_0x283245){return _0x1f43e7[_0x183b52];});for(var _0x28cfcf in _0x381b82){if(_0x381b82[_0x348f('0x4')](_0x28cfcf)){if(!_0x2e8690[_0x28cfcf]){delete _0x381b82[_0x28cfcf];}}}}Realtime[_0x348f('0x5')][_0x348f('0x6')]=function(_0x295de9,_0x3ded88){for(var _0x526df2 in _0x3ded88){if(_0x295de9[_0x348f('0x4')](_0x526df2)){_0x295de9[_0x526df2]=_0x3ded88[_0x526df2];}}};Realtime[_0x348f('0x5')][_0x348f('0x7')]=function(){var _0x5bd5aa=this;return function(_0x49d76a){if(_0x49d76a){freeIsNotKey(_0x49d76a,_0x5bd5aa[_0x348f('0x2')],'id');for(var _0x5a2451=0x0,_0x110393={},_0x3111bb={};_0x5a2451<_0x49d76a[_0x348f('0x8')];_0x5a2451+=0x1){_0x110393=_0x49d76a[_0x5a2451];if(_[_0x348f('0x9')](_0x5bd5aa[_0x348f('0x2')][_0x110393['id']])){_0x5bd5aa[_0x348f('0x2')][_0x110393['id']]=new MailAccount(_0x110393);}else{_[_0x348f('0xa')](_0x5bd5aa[_0x348f('0x2')][_0x110393['id']],_0x110393);}}}return _0x5bd5aa[_0x348f('0x2')];};};module[_0x348f('0xb')]=Realtime; \ No newline at end of file +var _0x8185=['mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','mailAccounts','merge','../model/mailAccount'];(function(_0xff2057,_0x2145d0){var _0x2e125b=function(_0x3390ac){while(--_0x3390ac){_0xff2057['push'](_0xff2057['shift']());}};_0x2e125b(++_0x2145d0);}(_0x8185,0x1ca));var _0x5818=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8185[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var MailAccount=require(_0x5818('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5cf9fe,_0x57332d,_0x78dca9){var _0x10c6df=_[_0x5818('0x1')](_0x5cf9fe,function(_0x2ccc56,_0x545e0a){return _0x2ccc56[_0x78dca9];});for(var _0x214e75 in _0x57332d){if(_0x57332d[_0x5818('0x2')](_0x214e75)){if(!_0x10c6df[_0x214e75]){delete _0x57332d[_0x214e75];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x5a736e,_0x5029df){for(var _0x495c3b in _0x5029df){if(_0x5a736e[_0x5818('0x2')](_0x495c3b)){_0x5a736e[_0x495c3b]=_0x5029df[_0x495c3b];}}};Realtime[_0x5818('0x3')][_0x5818('0x4')]=function(){var _0x112709=this;return function(_0x25cfac){if(_0x25cfac){freeIsNotKey(_0x25cfac,_0x112709['mailAccounts'],'id');for(var _0x2a88b0=0x0,_0x390843={},_0x3eca3f={};_0x2a88b0<_0x25cfac[_0x5818('0x5')];_0x2a88b0+=0x1){_0x390843=_0x25cfac[_0x2a88b0];if(_[_0x5818('0x6')](_0x112709[_0x5818('0x7')][_0x390843['id']])){_0x112709['mailAccounts'][_0x390843['id']]=new MailAccount(_0x390843);}else{_[_0x5818('0x8')](_0x112709['mailAccounts'][_0x390843['id']],_0x390843);}}}return _0x112709[_0x5818('0x7')];};};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 02f28cf..e91391e 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 _0x6eec=['MailServerOut','type','data5','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name'];(function(_0x5f36cd,_0x37d4c9){var _0x49832a=function(_0xa82985){while(--_0xa82985){_0x5f36cd['push'](_0x5f36cd['shift']());}};_0x49832a(++_0x37d4c9);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc6ee('0x0'));exports[_0xc6ee('0x1')]=function(){return function(){return client[_0xc6ee('0x2')](_0xc6ee('0x3'),{'options':{'attributes':['id','name',_0xc6ee('0x4'),_0xc6ee('0x5'),'email',_0xc6ee('0x6'),_0xc6ee('0x7'),_0xc6ee('0x8'),_0xc6ee('0x9')],'raw':![],'include':[{'model':_0xc6ee('0xa'),'as':_0xc6ee('0xb'),'include':[{'model':_0xc6ee('0xc'),'attributes':['id',_0xc6ee('0xd'),_0xc6ee('0x5'),'type','data5'],'as':_0xc6ee('0xc')}]},{'model':_0xc6ee('0xe'),'as':'Smtp','include':[{'model':_0xc6ee('0xc'),'attributes':['id','name',_0xc6ee('0x5'),_0xc6ee('0xf'),_0xc6ee('0x10')],'as':_0xc6ee('0xc')}]}]},'log':'getMailAccount'});};};exports[_0xc6ee('0x11')]=function(_0x1727a7,_0xe87f07){return client['Request'](_0xc6ee('0x12'),{'account':{'id':_0x1727a7},'body':_0xe87f07,'log':_0xc6ee('0x12')});}; \ No newline at end of file +var _0x2542=['NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','email','active','key','ListId','TemplateId','Imap','CloudProvider','name','service','type','data5','MailServerOut','Smtp','getMailAccount'];(function(_0x5c1966,_0x49e22b){var _0x73cafc=function(_0x26831b){while(--_0x26831b){_0x5c1966['push'](_0x5c1966['shift']());}};_0x73cafc(++_0x49e22b);}(_0x2542,0x169));var _0x2254=function(_0x3c6acf,_0x3d53ef){_0x3c6acf=_0x3c6acf-0x0;var _0x298054=_0x2542[_0x3c6acf];return _0x298054;};'use strict';var client=require(_0x2254('0x0'));exports[_0x2254('0x1')]=function(){return function(){return client[_0x2254('0x2')](_0x2254('0x3'),{'options':{'attributes':['id','name',_0x2254('0x4'),'service',_0x2254('0x5'),_0x2254('0x6'),_0x2254('0x7'),_0x2254('0x8'),_0x2254('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x2254('0xa'),'include':[{'model':_0x2254('0xb'),'attributes':['id',_0x2254('0xc'),_0x2254('0xd'),_0x2254('0xe'),_0x2254('0xf')],'as':_0x2254('0xb')}]},{'model':_0x2254('0x10'),'as':_0x2254('0x11'),'include':[{'model':_0x2254('0xb'),'attributes':['id',_0x2254('0xc'),'service',_0x2254('0xe'),_0x2254('0xf')],'as':_0x2254('0xb')}]}]},'log':_0x2254('0x12')});};};exports['notify']=function(_0x524fad,_0xe4fc71){return client[_0x2254('0x2')](_0x2254('0x13'),{'account':{'id':_0x524fad},'body':_0xe4fc71,'log':_0x2254('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index a3b0bb3..7ecb164 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 _0xb393=['getSettings','loginMailFrequency','GetSettings','../client'];(function(_0x5b1c1f,_0xb03c9){var _0x44d610=function(_0x122526){while(--_0x122526){_0x5b1c1f['push'](_0x5b1c1f['shift']());}};_0x44d610(++_0xb03c9);}(_0xb393,0xaf));var _0x3b39=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb393[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3b39('0x0'));exports[_0x3b39('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3b39('0x2')]},'log':_0x3b39('0x3')});}; \ No newline at end of file +var _0x95e7=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x13238a,_0x16a5e7){var _0x58ed32=function(_0x1ce242){while(--_0x1ce242){_0x13238a['push'](_0x13238a['shift']());}};_0x58ed32(++_0x16a5e7);}(_0x95e7,0x18a));var _0x795e=function(_0xba9f98,_0x53468b){_0xba9f98=_0xba9f98-0x0;var _0x24603f=_0x95e7[_0xba9f98];return _0x24603f;};'use strict';var client=require(_0x795e('0x0'));exports[_0x795e('0x1')]=function(){return client[_0x795e('0x2')](_0x795e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x795e('0x4')]},'log':_0x795e('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7d42ea3..824c05c 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 5754b4c..790b473 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 _0x1bde=['log','port','exports','lodash','http','ioredis','../../config/environment','createServer','listen','socket.io','websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening'];(function(_0x106159,_0x5b3f6a){var _0x2eef86=function(_0x5a83de){while(--_0x5a83de){_0x106159['push'](_0x106159['shift']());}};_0x2eef86(++_0x5b3f6a);}(_0x1bde,0x12e));var _0xe1bd=function(_0x1c55f1,_0x3669ca){_0x1c55f1=_0x1c55f1-0x0;var _0x44dd27=_0x1bde[_0x1c55f1];return _0x44dd27;};'use strict';var _=require(_0xe1bd('0x0'));var http=require(_0xe1bd('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xe1bd('0x2'));var config=require(_0xe1bd('0x3'));var app=express();var server=http[_0xe1bd('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xe1bd('0x5')](server,config['port'])){var socketio=require(_0xe1bd('0x6'))(server,{'transports':[_0xe1bd('0x7'),_0xe1bd('0x8')]});config['redis']=_[_0xe1bd('0x9')](config[_0xe1bd('0xa')],{'host':_0xe1bd('0xb'),'port':0x18eb});socketio[_0xe1bd('0xc')](require(_0xe1bd('0xd'))({'pubClient':new Redis(config[_0xe1bd('0xa')]),'subClient':new Redis(config[_0xe1bd('0xa')])}));require(_0xe1bd('0xe'))[_0xe1bd('0xf')]();require(_0xe1bd('0x10'))['default'](socketio);require(_0xe1bd('0x11'))[_0xe1bd('0xf')](app);require('../../routes')['default'](app);}else{server[_0xe1bd('0x12')](_0xe1bd('0x13'),function(){console[_0xe1bd('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe1bd('0x15')]);});}exports=module[_0xe1bd('0x16')]=app; \ No newline at end of file +var _0x8453=['createServer','timeout','port','polling','defaults','redis','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','ioredis','../../config/environment'];(function(_0x571d87,_0x557f42){var _0x514884=function(_0x5ac5a6){while(--_0x5ac5a6){_0x571d87['push'](_0x571d87['shift']());}};_0x514884(++_0x557f42);}(_0x8453,0xf7));var _0x3845=function(_0x11ffd3,_0x3b0cc6){_0x11ffd3=_0x11ffd3-0x0;var _0x42afc4=_0x8453[_0x11ffd3];return _0x42afc4;};'use strict';var _=require(_0x3845('0x0'));var http=require('http');var express=require(_0x3845('0x1'));var sticky=require(_0x3845('0x2'));var Redis=require(_0x3845('0x3'));var config=require(_0x3845('0x4'));var app=express();var server=http[_0x3845('0x5')](app);server[_0x3845('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x3845('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x3845('0x8')]});config['redis']=_[_0x3845('0x9')](config[_0x3845('0xa')],{'host':_0x3845('0xb'),'port':0x18eb});socketio[_0x3845('0xc')](require(_0x3845('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x3845('0xe')]();require(_0x3845('0xf'))[_0x3845('0xe')](socketio);require(_0x3845('0x10'))[_0x3845('0xe')](app);require('../../routes')[_0x3845('0xe')](app);}else{server[_0x3845('0x11')](_0x3845('0x12'),function(){console[_0x3845('0x13')](_0x3845('0x14'),config[_0x3845('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 be12b8f..85be357 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 _0xee57=['request','then','debug','error','rpc','message','result','catch','exports','jayson/promise','bluebird','routing','client','http'];(function(_0x59ab85,_0x4944ba){var _0x512fc8=function(_0x5d0ca6){while(--_0x5d0ca6){_0x59ab85['push'](_0x59ab85['shift']());}};_0x512fc8(++_0x4944ba);}(_0xee57,0xdb));var _0x7ee5=function(_0x440500,_0x2ac2f0){_0x440500=_0x440500-0x0;var _0x27efcd=_0xee57[_0x440500];return _0x27efcd;};'use strict';var jayson=require(_0x7ee5('0x0'));var BPromise=require(_0x7ee5('0x1'));var logger=require('../../config/logger')(_0x7ee5('0x2'));var client=jayson[_0x7ee5('0x3')][_0x7ee5('0x4')]({'port':0x2329});client['Request']=function(_0x34ba53,_0x57421b){return new BPromise(function(_0x144f67,_0x44b074){return client[_0x7ee5('0x5')](_0x34ba53,_0x57421b)[_0x7ee5('0x6')](function(_0x34ef6a){logger[_0x7ee5('0x7')]('rpc',_0x7ee5('0x2'),_0x34ba53,_0x57421b,_0x34ef6a);if(_0x34ef6a[_0x7ee5('0x8')]){logger[_0x7ee5('0x8')](_0x7ee5('0x9'),'routing',_0x34ba53,_0x34ef6a[_0x7ee5('0x8')][_0x7ee5('0xa')],_0x57421b);return _0x44b074(_0x34ef6a[_0x7ee5('0x8')][_0x7ee5('0xa')]);}else{return _0x144f67(_0x34ef6a[_0x7ee5('0xb')]);}})[_0x7ee5('0xc')](function(_0x3be705){logger[_0x7ee5('0x8')]('rpc',_0x7ee5('0x2'),_0x34ba53,_0x3be705,_0x57421b);return _0x44b074(_0x3be705);});});};module[_0x7ee5('0xd')]=client; \ No newline at end of file +var _0xd44b=['result','jayson/promise','client','http','Request','request','debug','routing','error','rpc','message'];(function(_0x5271d3,_0x3cd566){var _0x57a0be=function(_0x29780e){while(--_0x29780e){_0x5271d3['push'](_0x5271d3['shift']());}};_0x57a0be(++_0x3cd566);}(_0xd44b,0x114));var _0xbd44=function(_0x1cdd9f,_0x1c73f3){_0x1cdd9f=_0x1cdd9f-0x0;var _0x210a22=_0xd44b[_0x1cdd9f];return _0x210a22;};'use strict';var jayson=require(_0xbd44('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0xbd44('0x1')][_0xbd44('0x2')]({'port':0x2329});client[_0xbd44('0x3')]=function(_0x1195c9,_0x880399){return new BPromise(function(_0x4abd93,_0xada6da){return client[_0xbd44('0x4')](_0x1195c9,_0x880399)['then'](function(_0x537fc4){logger[_0xbd44('0x5')]('rpc',_0xbd44('0x6'),_0x1195c9,_0x880399,_0x537fc4);if(_0x537fc4[_0xbd44('0x7')]){logger[_0xbd44('0x7')](_0xbd44('0x8'),_0xbd44('0x6'),_0x1195c9,_0x537fc4['error'][_0xbd44('0x9')],_0x880399);return _0xada6da(_0x537fc4[_0xbd44('0x7')]['message']);}else{return _0x4abd93(_0x537fc4[_0xbd44('0xa')]);}})['catch'](function(_0x4b0397){logger[_0xbd44('0x7')](_0xbd44('0x8'),_0xbd44('0x6'),_0x1195c9,_0x4b0397,_0x880399);return _0xada6da(_0x4b0397);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 248a5a3..88e338a 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 _0xa990=['getWhatsappQueues','listen','log','bluebird','./server','./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues'];(function(_0x420e84,_0x1d53b6){var _0x155213=function(_0xef47cf){while(--_0xef47cf){_0x420e84['push'](_0x420e84['shift']());}};_0x155213(++_0x1d53b6);}(_0xa990,0xb2));var _0x0a99=function(_0x516d90,_0x11cbcc){_0x516d90=_0x516d90-0x0;var _0x2a3f4c=_0xa990[_0x516d90];return _0x2a3f4c;};'use strict';var BPromise=require(_0x0a99('0x0'));var server=require(_0x0a99('0x1'));var Realtime=require('./realtime');var user=require(_0x0a99('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x0a99('0x3'));var smsQueue=require(_0x0a99('0x4'));var mailQueue=require(_0x0a99('0x5'));var faxQueue=require(_0x0a99('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x0a99('0x7')]()[_0x0a99('0x8')](user['getAgents']())[_0x0a99('0x8')](realtime[_0x0a99('0x9')]())[_0x0a99('0x8')](interval[_0x0a99('0xa')]())[_0x0a99('0x8')](realtime[_0x0a99('0xb')]())[_0x0a99('0x8')](openchannelQueue[_0x0a99('0xc')]())[_0x0a99('0x8')](realtime[_0x0a99('0xd')]())[_0x0a99('0x8')](chatQueue[_0x0a99('0xe')]())[_0x0a99('0x8')](realtime[_0x0a99('0xf')]())[_0x0a99('0x8')](smsQueue[_0x0a99('0x10')]())[_0x0a99('0x8')](realtime[_0x0a99('0x11')]())[_0x0a99('0x8')](mailQueue[_0x0a99('0x12')]())[_0x0a99('0x8')](realtime[_0x0a99('0x13')]())[_0x0a99('0x8')](faxQueue[_0x0a99('0x14')]())[_0x0a99('0x8')](realtime[_0x0a99('0x15')]())[_0x0a99('0x8')](whatsappQueue[_0x0a99('0x16')]())[_0x0a99('0x8')](realtime['initWhatsappQueues']())[_0x0a99('0x8')](function(){return realtime;});}function main(){return server[_0x0a99('0x17')](realtime)[_0x0a99('0x8')](function(_0xc82d4a){return initRealtime();})[_0x0a99('0x8')](function(_0x1a9f16){return setInterval(initRealtime,0x1388);})['catch'](function(_0x53413f){console[_0x0a99('0x18')](_0x53413f);});}main(); \ No newline at end of file +var _0xeabc=['then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x4005fe,_0x1fc3c1){var _0x50022d=function(_0x2ce718){while(--_0x2ce718){_0x4005fe['push'](_0x4005fe['shift']());}};_0x50022d(++_0x1fc3c1);}(_0xeabc,0x86));var _0xceab=function(_0x44b95c,_0x3e6709){_0x44b95c=_0x44b95c-0x0;var _0x363d0f=_0xeabc[_0x44b95c];return _0x363d0f;};'use strict';var BPromise=require('bluebird');var server=require(_0xceab('0x0'));var Realtime=require(_0xceab('0x1'));var user=require(_0xceab('0x2'));var interval=require(_0xceab('0x3'));var openchannelQueue=require(_0xceab('0x4'));var chatQueue=require(_0xceab('0x5'));var smsQueue=require(_0xceab('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xceab('0x7'));var whatsappQueue=require(_0xceab('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xceab('0x9')]()[_0xceab('0xa')](user[_0xceab('0xb')]())['then'](realtime[_0xceab('0xc')]())['then'](interval[_0xceab('0xd')]())[_0xceab('0xa')](realtime[_0xceab('0xe')]())[_0xceab('0xa')](openchannelQueue[_0xceab('0xf')]())[_0xceab('0xa')](realtime[_0xceab('0x10')]())[_0xceab('0xa')](chatQueue['getChatQueues']())[_0xceab('0xa')](realtime['initChatQueues']())[_0xceab('0xa')](smsQueue['getSmsQueues']())[_0xceab('0xa')](realtime[_0xceab('0x11')]())[_0xceab('0xa')](mailQueue['getMailQueues']())[_0xceab('0xa')](realtime[_0xceab('0x12')]())[_0xceab('0xa')](faxQueue[_0xceab('0x13')]())[_0xceab('0xa')](realtime[_0xceab('0x14')]())[_0xceab('0xa')](whatsappQueue[_0xceab('0x15')]())[_0xceab('0xa')](realtime[_0xceab('0x16')]())[_0xceab('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x16c17a){return initRealtime();})['then'](function(_0x3b3d8f){return setInterval(initRealtime,0x1388);})[_0xceab('0x17')](function(_0x11cb77){console['log'](_0x11cb77);});}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 8252d8f..5d075ff 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x1261[_0x2cc594];return _0x4abff7;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x5b3e85,_0x9a4df4){var _0x5f2b9f=function(_0x5e15e2){while(--_0x5e15e2){_0x5b3e85['push'](_0x5b3e85['shift']());}};_0x5f2b9f(++_0x9a4df4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c195b93..7d3e197 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 _0x47eb=['client','http','request','then','error','message','catch','bluebird','jayson/promise'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x47eb,0x1ae));var _0xb47e=function(_0x43d79c,_0x531a55){_0x43d79c=_0x43d79c-0x0;var _0x4866b0=_0x47eb[_0x43d79c];return _0x4866b0;};'use strict';var BPromise=require(_0xb47e('0x0'));var jayson=require(_0xb47e('0x1'));var client=jayson[_0xb47e('0x2')][_0xb47e('0x3')]({'port':0x232b});function request(_0x2bd25f,_0x29e839){return new BPromise(function(_0x28b144,_0x42afae){return client[_0xb47e('0x4')](_0x2bd25f,_0x29e839)[_0xb47e('0x5')](function(_0x29b2dc){if(_0x29b2dc[_0xb47e('0x6')]){return _0x42afae(_0x29b2dc[_0xb47e('0x6')][_0xb47e('0x7')]);}else{return _0x28b144(_0x29b2dc['result']);}})[_0xb47e('0x8')](function(_0x1d959f){return _0x42afae(_0x1d959f);});});}exports['sendMailMessage']=function(_0x3d99b9,_0x422a0e){return request('SendMail',{'account':_0x3d99b9,'message':_0x422a0e});}; \ No newline at end of file +var _0xc229=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x60369b,_0x525315){var _0x3c9e8e=function(_0x3e7f91){while(--_0x3e7f91){_0x60369b['push'](_0x60369b['shift']());}};_0x3c9e8e(++_0x525315);}(_0xc229,0xb8));var _0x9c22=function(_0xc2e09c,_0x4f1b5f){_0xc2e09c=_0xc2e09c-0x0;var _0x283083=_0xc229[_0xc2e09c];return _0x283083;};'use strict';var BPromise=require(_0x9c22('0x0'));var jayson=require(_0x9c22('0x1'));var client=jayson[_0x9c22('0x2')][_0x9c22('0x3')]({'port':0x232b});function request(_0x2d8662,_0xa73f62){return new BPromise(function(_0x3e7df6,_0x51a798){return client[_0x9c22('0x4')](_0x2d8662,_0xa73f62)[_0x9c22('0x5')](function(_0x3792ac){if(_0x3792ac[_0x9c22('0x6')]){return _0x51a798(_0x3792ac[_0x9c22('0x6')][_0x9c22('0x7')]);}else{return _0x3e7df6(_0x3792ac[_0x9c22('0x8')]);}})[_0x9c22('0x9')](function(_0x306154){return _0x51a798(_0x306154);});});}exports[_0x9c22('0xa')]=function(_0x4a4daf,_0x2d5c4c){return request(_0x9c22('0xb'),{'account':_0x4a4daf,'message':_0x2d5c4c});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 25245f6..f5bab97 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 _0xa79b=['StatusTime','toNumber','format','chatCapacity','chatCurrentCapacity','mailCurrentCapacity','smsStatusTime','whatsappStatus','openchannelCurrentCapacity','faxWaitingInteractions','stringify','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','fax','sms','whatsapp','length','Status'];(function(_0x5d2ad1,_0x1f3057){var _0x2e83ef=function(_0x2dac3d){while(--_0x2dac3d){_0x5d2ad1['push'](_0x5d2ad1['shift']());}};_0x2e83ef(++_0x1f3057);}(_0xa79b,0x1a6));var _0xba79=function(_0x32e215,_0x3a43bc){_0x32e215=_0x32e215-0x0;var _0x14f64e=_0xa79b[_0x32e215];return _0x14f64e;};'use strict';var _=require(_0xba79('0x0'));var moment=require('moment');var md5=require(_0xba79('0x1'));var Redis=require(_0xba79('0x2'));var config=require(_0xba79('0x3'));config[_0xba79('0x4')]=_[_0xba79('0x5')](config[_0xba79('0x4')],{'host':_0xba79('0x6'),'port':0x18eb});var io=require(_0xba79('0x7'))(new Redis(config[_0xba79('0x4')]));function Agent(_0x598e87){this['id']=_0x598e87['id']||0x0;this['name']=_0x598e87[_0xba79('0x8')]||'';this['online']=_0x598e87[_0xba79('0x9')]||!![];this[_0xba79('0xa')]=_0x598e87[_0xba79('0xa')]||![];this[_0xba79('0xb')]=_0x598e87[_0xba79('0xb')]||![];this[_0xba79('0xc')]=_0x598e87[_0xba79('0xc')]||![];this[_0xba79('0xd')]=_0x598e87[_0xba79('0xd')]||![];this[_0xba79('0xe')]=_0x598e87['smsPause']||![];this['openchannelPause']=_0x598e87[_0xba79('0xf')]||![];this[_0xba79('0x10')]=_0xba79('0x11');this[_0xba79('0x12')]=0x0;this['chatCapacity']=_0x598e87['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xba79('0x13')]=_0xba79('0x11');this[_0xba79('0x14')]=0x0;this['mailCapacity']=_0x598e87[_0xba79('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xba79('0x16')]='unknown';this['faxStatusTime']=0x0;this[_0xba79('0x17')]=_0x598e87[_0xba79('0x17')]||0x0;this[_0xba79('0x18')]=0x0;this[_0xba79('0x19')]='unknown';this['smsStatusTime']=0x0;this[_0xba79('0x1a')]=_0x598e87['smsCapacity']||0x0;this[_0xba79('0x1b')]=0x0;this['whatsappStatus']=_0xba79('0x11');this['whatsappStatusTime']=0x0;this[_0xba79('0x1c')]=_0x598e87[_0xba79('0x1c')]||0x0;this[_0xba79('0x1d')]=0x0;this[_0xba79('0x1e')]=_0xba79('0x11');this[_0xba79('0x1f')]=0x0;this['openchannelCapacity']=_0x598e87[_0xba79('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xba79('0x21')]=![];this[_0xba79('0x22')]=undefined;this[_0xba79('0x1')]='';this[_0xba79('0x23')]={};this['faxWaitingInteractions']={};this[_0xba79('0x24')]={};this[_0xba79('0x25')]={};this[_0xba79('0x26')]={};this[_0xba79('0x27')]={};this[_0xba79('0x28')]();}Agent[_0xba79('0x29')][_0xba79('0x2a')]=function(_0x5bb25d){if(this[_0x5bb25d+_0xba79('0x2b')]>0x0){if(this[_0x5bb25d+_0xba79('0x2c')]>0x0&&this[_0x5bb25d+_0xba79('0x2b')]>=this[_0x5bb25d+_0xba79('0x2c')]){return _0xba79('0x2d');}else{return _0xba79('0x2e');}}else{return _0xba79('0x2f');}};Agent['prototype'][_0xba79('0x28')]=function(){var _0x2c7c2b=[_0xba79('0x30'),'chat','openchannel',_0xba79('0x31'),_0xba79('0x32'),_0xba79('0x33')];for(var _0x439511=0x0;_0x439511<_0x2c7c2b[_0xba79('0x34')];_0x439511+=0x1){var _0x2d7898=this[_0xba79('0x2a')](_0x2c7c2b[_0x439511]);if(this[_0x2c7c2b[_0x439511]+_0xba79('0x35')]!==_0x2d7898){this[_0x2c7c2b[_0x439511]+_0xba79('0x36')]=_[_0xba79('0x37')](moment()[_0xba79('0x38')]('x'));}this[_0x2c7c2b[_0x439511]+'Status']=_0x2d7898;}var _0x55516c={'id':this['id'],'name':this[_0xba79('0x8')],'online':this['online'],'voicePause':this[_0xba79('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xba79('0xd')],'openchannelPause':this[_0xba79('0xf')],'chatStatus':this[_0xba79('0x10')],'chatStatusTime':this[_0xba79('0x12')],'chatCapacity':this[_0xba79('0x39')],'chatCurrentCapacity':this[_0xba79('0x3a')],'mailStatus':this[_0xba79('0x13')],'mailStatusTime':this[_0xba79('0x14')],'mailCapacity':this[_0xba79('0x15')],'mailCurrentCapacity':this[_0xba79('0x3b')],'faxStatus':this[_0xba79('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xba79('0x17')],'faxCurrentCapacity':this[_0xba79('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xba79('0x3c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xba79('0x3d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xba79('0x1c')],'whatsappCurrentCapacity':this[_0xba79('0x1d')],'openchannelStatus':this[_0xba79('0x1e')],'openchannelStatusTime':this[_0xba79('0x1f')],'openchannelCapacity':this[_0xba79('0x20')],'openchannelCurrentCapacity':this[_0xba79('0x3e')],'busy':this[_0xba79('0x21')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xba79('0x23')],'faxWaitingInteractions':this[_0xba79('0x3f')],'mailWaitingInteractions':this[_0xba79('0x24')],'openchannelWaitingInteractions':this[_0xba79('0x25')],'smsWaitingInteractions':this[_0xba79('0x26')],'whatsappWaitingInteractions':this[_0xba79('0x27')]};var _0x2a3ffc=md5(JSON[_0xba79('0x40')](_0x55516c));if(this[_0xba79('0x1')]!==_0x2a3ffc){this['md5']=_0x2a3ffc;io[_0xba79('0x41')](_0xba79('0x42'),_0x55516c);}};module[_0xba79('0x43')]=Agent; \ No newline at end of file +var _0x26d5=['chatStatusTime','chatCapacity','chatCurrentCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','sms','whatsapp','toNumber','Status','chatStatus','mailStatus','mailStatusTime','mailCapacity','faxCurrentCapacity','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown'];(function(_0xbe0dd4,_0x53eb2a){var _0x2479d5=function(_0x43d23d){while(--_0x43d23d){_0xbe0dd4['push'](_0xbe0dd4['shift']());}};_0x2479d5(++_0x53eb2a);}(_0x26d5,0x71));var _0x526d=function(_0x589507,_0x19ee56){_0x589507=_0x589507-0x0;var _0xf0cf52=_0x26d5[_0x589507];return _0xf0cf52;};'use strict';var _=require(_0x526d('0x0'));var moment=require(_0x526d('0x1'));var md5=require(_0x526d('0x2'));var Redis=require(_0x526d('0x3'));var config=require(_0x526d('0x4'));config[_0x526d('0x5')]=_[_0x526d('0x6')](config[_0x526d('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x526d('0x7'))(new Redis(config['redis']));function Agent(_0x424574){this['id']=_0x424574['id']||0x0;this[_0x526d('0x8')]=_0x424574[_0x526d('0x8')]||'';this[_0x526d('0x9')]=_0x424574['online']||!![];this[_0x526d('0xa')]=_0x424574[_0x526d('0xa')]||![];this[_0x526d('0xb')]=_0x424574[_0x526d('0xb')]||![];this[_0x526d('0xc')]=_0x424574[_0x526d('0xc')]||![];this['faxPause']=_0x424574[_0x526d('0xd')]||![];this[_0x526d('0xe')]=_0x424574[_0x526d('0xe')]||![];this['openchannelPause']=_0x424574[_0x526d('0xf')]||![];this['chatStatus']=_0x526d('0x10');this[_0x526d('0x11')]=0x0;this[_0x526d('0x12')]=_0x424574[_0x526d('0x12')]||0x0;this[_0x526d('0x13')]=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this['mailCapacity']=_0x424574['mailCapacity']||0x0;this[_0x526d('0x14')]=0x0;this[_0x526d('0x15')]='unknown';this[_0x526d('0x16')]=0x0;this[_0x526d('0x17')]=_0x424574[_0x526d('0x17')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x526d('0x18')]=_0x526d('0x10');this[_0x526d('0x19')]=0x0;this[_0x526d('0x1a')]=_0x424574[_0x526d('0x1a')]||0x0;this[_0x526d('0x1b')]=0x0;this[_0x526d('0x1c')]=_0x526d('0x10');this[_0x526d('0x1d')]=0x0;this[_0x526d('0x1e')]=_0x424574[_0x526d('0x1e')]||0x0;this[_0x526d('0x1f')]=0x0;this[_0x526d('0x20')]=_0x526d('0x10');this['openchannelStatusTime']=0x0;this[_0x526d('0x21')]=_0x424574[_0x526d('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x526d('0x22')]=![];this['busyQueue']=undefined;this[_0x526d('0x2')]='';this['chatWaitingInteractions']={};this[_0x526d('0x23')]={};this[_0x526d('0x24')]={};this[_0x526d('0x25')]={};this[_0x526d('0x26')]={};this[_0x526d('0x27')]={};this['updateRealtime']();}Agent[_0x526d('0x28')][_0x526d('0x29')]=function(_0x20a223){if(this[_0x20a223+'CurrentCapacity']>0x0){if(this[_0x20a223+'Capacity']>0x0&&this[_0x20a223+_0x526d('0x2a')]>=this[_0x20a223+'Capacity']){return _0x526d('0x2b');}else{return _0x526d('0x2c');}}else{return _0x526d('0x2d');}};Agent[_0x526d('0x28')][_0x526d('0x2e')]=function(){var _0x23d429=['mail',_0x526d('0x2f'),_0x526d('0x30'),'fax',_0x526d('0x31'),_0x526d('0x32')];for(var _0x3ee921=0x0;_0x3ee921<_0x23d429['length'];_0x3ee921+=0x1){var _0x69faf0=this['getChannelStatus'](_0x23d429[_0x3ee921]);if(this[_0x23d429[_0x3ee921]+'Status']!==_0x69faf0){this[_0x23d429[_0x3ee921]+'StatusTime']=_[_0x526d('0x33')](moment()['format']('x'));}this[_0x23d429[_0x3ee921]+_0x526d('0x34')]=_0x69faf0;}var _0x405f49={'id':this['id'],'name':this['name'],'online':this[_0x526d('0x9')],'voicePause':this[_0x526d('0xa')],'chatPause':this[_0x526d('0xb')],'mailPause':this[_0x526d('0xc')],'smsPause':this[_0x526d('0xe')],'faxPause':this[_0x526d('0xd')],'openchannelPause':this[_0x526d('0xf')],'chatStatus':this[_0x526d('0x35')],'chatStatusTime':this[_0x526d('0x11')],'chatCapacity':this[_0x526d('0x12')],'chatCurrentCapacity':this[_0x526d('0x13')],'mailStatus':this[_0x526d('0x36')],'mailStatusTime':this[_0x526d('0x37')],'mailCapacity':this[_0x526d('0x38')],'mailCurrentCapacity':this[_0x526d('0x14')],'faxStatus':this[_0x526d('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x526d('0x17')],'faxCurrentCapacity':this[_0x526d('0x39')],'smsStatus':this[_0x526d('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x526d('0x1c')],'whatsappStatusTime':this[_0x526d('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x526d('0x20')],'openchannelStatusTime':this[_0x526d('0x3a')],'openchannelCapacity':this[_0x526d('0x21')],'openchannelCurrentCapacity':this[_0x526d('0x3b')],'busy':this[_0x526d('0x22')],'busyQueue':this[_0x526d('0x3c')],'chatWaitingInteractions':this[_0x526d('0x3d')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x526d('0x24')],'openchannelWaitingInteractions':this[_0x526d('0x25')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x526d('0x27')]};var _0x382b87=md5(JSON[_0x526d('0x3e')](_0x405f49));if(this[_0x526d('0x2')]!==_0x382b87){this['md5']=_0x382b87;io[_0x526d('0x3f')]('user:save',_0x405f49);}};module[_0x526d('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index f15575f..bb462ff 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 _0x80b1=['timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x385f81,_0x394333){var _0x390b9e=function(_0x5541b7){while(--_0x5541b7){_0x385f81['push'](_0x385f81['shift']());}};_0x390b9e(++_0x394333);}(_0x80b1,0x153));var _0x180b=function(_0x3307bd,_0x256dbf){_0x3307bd=_0x3307bd-0x0;var _0x2561be=_0x80b1[_0x3307bd];return _0x2561be;};'use strict';var _=require(_0x180b('0x0'));var md5=require(_0x180b('0x1'));var util=require(_0x180b('0x2'));var Redis=require(_0x180b('0x3'));var config=require(_0x180b('0x4'));config[_0x180b('0x5')]=_[_0x180b('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x180b('0x7'))(new Redis(config[_0x180b('0x5')]));function ChatQueue(_0x310bb6){this['id']=_0x310bb6['id']||0x0;this[_0x180b('0x8')]=_0x310bb6[_0x180b('0x8')]||'';this['timeout']=_0x310bb6[_0x180b('0x9')]||0xa;this[_0x180b('0xa')]=_0x310bb6['strategy']||'beepall';this['Agents']=_0x310bb6[_0x180b('0xb')];this[_0x180b('0xc')]={};this[_0x180b('0xd')]=0x0;this[_0x180b('0x1')]='';this[_0x180b('0xe')]();this['updateRealtime']();}ChatQueue[_0x180b('0xf')][_0x180b('0xe')]=function(){var _0x3db884=this[_0x180b('0xc')][_0x180b('0x10')];this[_0x180b('0xc')]=_[_0x180b('0x11')](this[_0x180b('0xb')],'id');this['mapAgentsId']['_rr']=_0x3db884;};ChatQueue[_0x180b('0xf')][_0x180b('0x12')]=function(){this[_0x180b('0x13')]=0x0;this[_0x180b('0x14')]=0x0;for(var _0x21a974=0x0;_0x21a974=0x0?this[_0x180b('0x17')]:0x0;var _0x48ebaf={'id':this['id'],'available':this['available'],'loggedIn':this[_0x180b('0x13')],'name':this[_0x180b('0x8')],'paused':this[_0x180b('0x14')],'waiting':this[_0x180b('0xd')]};var _0x18d93c=md5(JSON[_0x180b('0x18')](_0x48ebaf));if(this[_0x180b('0x1')]!==_0x18d93c){this[_0x180b('0x1')]=_0x18d93c;io['to'](util[_0x180b('0x19')](_0x180b('0x1a'),_0x48ebaf[_0x180b('0x8')]))[_0x180b('0x1b')]('chat_queue:save',_0x48ebaf);}};module[_0x180b('0x1c')]=ChatQueue; \ No newline at end of file +var _0xc9c0=['exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','chatPause','available','md5','format','chat_queue:save'];(function(_0x2ebf1e,_0x3e90a8){var _0x78f51b=function(_0x56a7b0){while(--_0x56a7b0){_0x2ebf1e['push'](_0x2ebf1e['shift']());}};_0x78f51b(++_0x3e90a8);}(_0xc9c0,0x12a));var _0x0c9c=function(_0x1816df,_0x4f009e){_0x1816df=_0x1816df-0x0;var _0x99f037=_0xc9c0[_0x1816df];return _0x99f037;};'use strict';var _=require(_0x0c9c('0x0'));var md5=require('md5');var util=require(_0x0c9c('0x1'));var Redis=require(_0x0c9c('0x2'));var config=require(_0x0c9c('0x3'));config[_0x0c9c('0x4')]=_[_0x0c9c('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0c9c('0x6'))(new Redis(config['redis']));function ChatQueue(_0x50c28e){this['id']=_0x50c28e['id']||0x0;this[_0x0c9c('0x7')]=_0x50c28e[_0x0c9c('0x7')]||'';this['timeout']=_0x50c28e['timeout']||0xa;this[_0x0c9c('0x8')]=_0x50c28e['strategy']||'beepall';this[_0x0c9c('0x9')]=_0x50c28e['Agents'];this[_0x0c9c('0xa')]={};this[_0x0c9c('0xb')]=0x0;this['md5']='';this[_0x0c9c('0xc')]();this[_0x0c9c('0xd')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x4bba6f=this[_0x0c9c('0xa')][_0x0c9c('0xe')];this[_0x0c9c('0xa')]=_[_0x0c9c('0xf')](this[_0x0c9c('0x9')],'id');this['mapAgentsId']['_rr']=_0x4bba6f;};ChatQueue[_0x0c9c('0x10')]['updateRealtime']=function(){this[_0x0c9c('0x11')]=0x0;this[_0x0c9c('0x12')]=0x0;for(var _0x35f691=0x0;_0x35f691=0x0?this[_0x0c9c('0x16')]:0x0;var _0x5585d5={'id':this['id'],'available':this[_0x0c9c('0x16')],'loggedIn':this[_0x0c9c('0x11')],'name':this[_0x0c9c('0x7')],'paused':this[_0x0c9c('0x12')],'waiting':this[_0x0c9c('0xb')]};var _0x12eff9=md5(JSON['stringify'](_0x5585d5));if(this['md5']!==_0x12eff9){this[_0x0c9c('0x17')]=_0x12eff9;io['to'](util[_0x0c9c('0x18')]('chat:queue:%s',_0x5585d5[_0x0c9c('0x7')]))['emit'](_0x0c9c('0x19'),_0x5585d5);}};module[_0x0c9c('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b9df230..9e6115c 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 _0x7ca4=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','loggedIn','length','online','faxPause','available','paused','stringify','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout'];(function(_0x5cd1c0,_0x172cc1){var _0x26391a=function(_0x2e4c6a){while(--_0x2e4c6a){_0x5cd1c0['push'](_0x5cd1c0['shift']());}};_0x26391a(++_0x172cc1);}(_0x7ca4,0xcf));var _0x47ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ca4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x47ca('0x0'));var md5=require(_0x47ca('0x1'));var util=require(_0x47ca('0x2'));var Redis=require(_0x47ca('0x3'));var config=require(_0x47ca('0x4'));config[_0x47ca('0x5')]=_[_0x47ca('0x6')](config[_0x47ca('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x17be45){this['id']=_0x17be45['id']||0x0;this['name']=_0x17be45[_0x47ca('0x7')]||'';this[_0x47ca('0x8')]=_0x17be45[_0x47ca('0x8')]||0xa;this[_0x47ca('0x9')]=_0x17be45['strategy']||_0x47ca('0xa');this[_0x47ca('0xb')]=_0x17be45[_0x47ca('0xb')];this[_0x47ca('0xc')]={};this['waiting']=0x0;this[_0x47ca('0x1')]='';this[_0x47ca('0xd')]();this[_0x47ca('0xe')]();}FaxQueue['prototype']['updateRouting']=function(){var _0xb62d13=this[_0x47ca('0xc')][_0x47ca('0xf')];this[_0x47ca('0xc')]=_[_0x47ca('0x10')](this[_0x47ca('0xb')],'id');this[_0x47ca('0xc')][_0x47ca('0xf')]=_0xb62d13;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x47ca('0x11')]=0x0;this['paused']=0x0;for(var _0x882cb3=0x0;_0x882cb3=0x0?this[_0x47ca('0x15')]:0x0;var _0x1b454b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x47ca('0x7')],'paused':this[_0x47ca('0x16')],'waiting':this['waiting']};var _0x68bec2=md5(JSON[_0x47ca('0x17')](_0x1b454b));if(this[_0x47ca('0x1')]!==_0x68bec2){this[_0x47ca('0x1')]=_0x68bec2;io['to'](util['format'](_0x47ca('0x18'),_0x1b454b[_0x47ca('0x7')]))['emit'](_0x47ca('0x19'),_0x1b454b);}};module[_0x47ca('0x1a')]=FaxQueue; \ No newline at end of file +var _0x4ecd=['online','available','stringify','format','fax:queue:%s','fax_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length'];(function(_0x33a0a7,_0xab4c3e){var _0x2fd532=function(_0x5ef1e2){while(--_0x5ef1e2){_0x33a0a7['push'](_0x33a0a7['shift']());}};_0x2fd532(++_0xab4c3e);}(_0x4ecd,0x1aa));var _0xd4ec=function(_0x20d805,_0x3ddce9){_0x20d805=_0x20d805-0x0;var _0x2413ab=_0x4ecd[_0x20d805];return _0x2413ab;};'use strict';var _=require(_0xd4ec('0x0'));var md5=require('md5');var util=require(_0xd4ec('0x1'));var Redis=require(_0xd4ec('0x2'));var config=require(_0xd4ec('0x3'));config[_0xd4ec('0x4')]=_[_0xd4ec('0x5')](config[_0xd4ec('0x4')],{'host':_0xd4ec('0x6'),'port':0x18eb});var io=require(_0xd4ec('0x7'))(new Redis(config[_0xd4ec('0x4')]));function FaxQueue(_0x2e39b1){this['id']=_0x2e39b1['id']||0x0;this[_0xd4ec('0x8')]=_0x2e39b1[_0xd4ec('0x8')]||'';this['timeout']=_0x2e39b1[_0xd4ec('0x9')]||0xa;this[_0xd4ec('0xa')]=_0x2e39b1['strategy']||_0xd4ec('0xb');this[_0xd4ec('0xc')]=_0x2e39b1[_0xd4ec('0xc')];this[_0xd4ec('0xd')]={};this[_0xd4ec('0xe')]=0x0;this[_0xd4ec('0xf')]='';this[_0xd4ec('0x10')]();this['updateRealtime']();}FaxQueue[_0xd4ec('0x11')][_0xd4ec('0x10')]=function(){var _0x46fbc3=this['mapAgentsId'][_0xd4ec('0x12')];this[_0xd4ec('0xd')]=_[_0xd4ec('0x13')](this[_0xd4ec('0xc')],'id');this[_0xd4ec('0xd')][_0xd4ec('0x12')]=_0x46fbc3;};FaxQueue['prototype'][_0xd4ec('0x14')]=function(){this[_0xd4ec('0x15')]=0x0;this[_0xd4ec('0x16')]=0x0;for(var _0x4fa0d5=0x0;_0x4fa0d5=0x0?this[_0xd4ec('0x19')]:0x0;var _0x302fbd={'id':this['id'],'available':this[_0xd4ec('0x19')],'loggedIn':this[_0xd4ec('0x15')],'name':this[_0xd4ec('0x8')],'paused':this['paused'],'waiting':this[_0xd4ec('0xe')]};var _0x2faf7e=md5(JSON[_0xd4ec('0x1a')](_0x302fbd));if(this[_0xd4ec('0xf')]!==_0x2faf7e){this[_0xd4ec('0xf')]=_0x2faf7e;io['to'](util[_0xd4ec('0x1b')](_0xd4ec('0x1c'),_0x302fbd[_0xd4ec('0x8')]))['emit'](_0xd4ec('0x1d'),_0x302fbd);}};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 671a00e..3c331e0 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 _0x0402=['exports','name'];(function(_0x179c48,_0x4eaa54){var _0x577174=function(_0x18066f){while(--_0x18066f){_0x179c48['push'](_0x179c48['shift']());}};_0x577174(++_0x4eaa54);}(_0x0402,0xfb));var _0x2040=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0402[_0x513aa5];return _0x1a1a7c;};'use strict';function Interval(_0x232c23){this['id']=_0x232c23['id']||0x0;this['name']=_0x232c23[_0x2040('0x0')]||'';this['Intervals']=_0x232c23['Intervals']||{};}module[_0x2040('0x1')]=Interval; \ No newline at end of file +var _0x14b3=['Intervals','name'];(function(_0x32f776,_0x1bf7e6){var _0xa9f55=function(_0x3a1045){while(--_0x3a1045){_0x32f776['push'](_0x32f776['shift']());}};_0xa9f55(++_0x1bf7e6);}(_0x14b3,0x18d));var _0x314b=function(_0x3116c9,_0x1db034){_0x3116c9=_0x3116c9-0x0;var _0x2ca671=_0x14b3[_0x3116c9];return _0x2ca671;};'use strict';function Interval(_0xc4fff8){this['id']=_0xc4fff8['id']||0x0;this[_0x314b('0x0')]=_0xc4fff8[_0x314b('0x0')]||'';this[_0x314b('0x1')]=_0xc4fff8[_0x314b('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 552b2ea..b36a3f0 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 _0x182d=['mail:queue:%s','emit','mail_queue:save','lodash','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','available','stringify','format'];(function(_0x4f04aa,_0x377e2c){var _0x380249=function(_0x35e5a7){while(--_0x35e5a7){_0x4f04aa['push'](_0x4f04aa['shift']());}};_0x380249(++_0x377e2c);}(_0x182d,0x1ce));var _0xd182=function(_0x3836b1,_0x58d16a){_0x3836b1=_0x3836b1-0x0;var _0x153c53=_0x182d[_0x3836b1];return _0x153c53;};'use strict';var _=require(_0xd182('0x0'));var md5=require('md5');var util=require(_0xd182('0x1'));var Redis=require(_0xd182('0x2'));var config=require(_0xd182('0x3'));config[_0xd182('0x4')]=_['defaults'](config[_0xd182('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd182('0x5'))(new Redis(config['redis']));function MailQueue(_0x37e07a){this['id']=_0x37e07a['id']||0x0;this[_0xd182('0x6')]=_0x37e07a[_0xd182('0x6')]||'';this[_0xd182('0x7')]=_0x37e07a[_0xd182('0x7')]||0xa;this['strategy']=_0x37e07a['strategy']||_0xd182('0x8');this[_0xd182('0x9')]=_0x37e07a[_0xd182('0x9')];this[_0xd182('0xa')]={};this[_0xd182('0xb')]=0x0;this[_0xd182('0xc')]='';this[_0xd182('0xd')]();this[_0xd182('0xe')]();}MailQueue[_0xd182('0xf')][_0xd182('0xd')]=function(){var _0x147f41=this['mapAgentsId']['_rr'];this[_0xd182('0xa')]=_[_0xd182('0x10')](this['Agents'],'id');this[_0xd182('0xa')][_0xd182('0x11')]=_0x147f41;};MailQueue['prototype'][_0xd182('0xe')]=function(){this[_0xd182('0x12')]=0x0;this[_0xd182('0x13')]=0x0;for(var _0x356a25=0x0;_0x356a25=0x0?this['available']:0x0;var _0x4dbdaf={'id':this['id'],'available':this[_0xd182('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xd182('0x6')],'paused':this[_0xd182('0x13')],'waiting':this[_0xd182('0xb')]};var _0x131927=md5(JSON[_0xd182('0x16')](_0x4dbdaf));if(this[_0xd182('0xc')]!==_0x131927){this[_0xd182('0xc')]=_0x131927;io['to'](util[_0xd182('0x17')](_0xd182('0x18'),_0x4dbdaf[_0xd182('0x6')]))[_0xd182('0x19')](_0xd182('0x1a'),_0x4dbdaf);}};module['exports']=MailQueue; \ No newline at end of file +var _0xbe29=['loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x1f2332,_0x2e56e1){var _0x70c31c=function(_0x28735a){while(--_0x28735a){_0x1f2332['push'](_0x1f2332['shift']());}};_0x70c31c(++_0x2e56e1);}(_0xbe29,0x176));var _0x9be2=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0xbe29[_0x1d94d1];return _0x23c397;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x9be2('0x0'));var config=require(_0x9be2('0x1'));config[_0x9be2('0x2')]=_[_0x9be2('0x3')](config[_0x9be2('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x9be2('0x4'))(new Redis(config[_0x9be2('0x2')]));function MailQueue(_0x239072){this['id']=_0x239072['id']||0x0;this[_0x9be2('0x5')]=_0x239072[_0x9be2('0x5')]||'';this[_0x9be2('0x6')]=_0x239072[_0x9be2('0x6')]||0xa;this[_0x9be2('0x7')]=_0x239072[_0x9be2('0x7')]||_0x9be2('0x8');this[_0x9be2('0x9')]=_0x239072[_0x9be2('0x9')];this[_0x9be2('0xa')]={};this[_0x9be2('0xb')]=0x0;this[_0x9be2('0xc')]='';this[_0x9be2('0xd')]();this[_0x9be2('0xe')]();}MailQueue[_0x9be2('0xf')][_0x9be2('0xd')]=function(){var _0x277be8=this[_0x9be2('0xa')][_0x9be2('0x10')];this[_0x9be2('0xa')]=_[_0x9be2('0x11')](this[_0x9be2('0x9')],'id');this[_0x9be2('0xa')][_0x9be2('0x10')]=_0x277be8;};MailQueue[_0x9be2('0xf')]['updateRealtime']=function(){this[_0x9be2('0x12')]=0x0;this[_0x9be2('0x13')]=0x0;for(var _0x5a98ee=0x0;_0x5a98ee=0x0?this[_0x9be2('0x17')]:0x0;var _0x1805e3={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9be2('0x12')],'name':this[_0x9be2('0x5')],'paused':this[_0x9be2('0x13')],'waiting':this[_0x9be2('0xb')]};var _0xe2843d=md5(JSON[_0x9be2('0x18')](_0x1805e3));if(this['md5']!==_0xe2843d){this[_0x9be2('0xc')]=_0xe2843d;io['to'](util[_0x9be2('0x19')](_0x9be2('0x1a'),_0x1805e3['name']))['emit'](_0x9be2('0x1b'),_0x1805e3);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ea0aec3..2431d0c 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x1cfc39,_0x1d3913){var _0x957a28=function(_0x2be930){while(--_0x2be930){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x957a28(++_0x1d3913);}(_0x2ef3,0xba));var _0x32ef=function(_0x4f5670,_0x7f0013){_0x4f5670=_0x4f5670-0x0;var _0x2579aa=_0x2ef3[_0x4f5670];return _0x2579aa;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x39f05c,_0x4d062a){var _0x315251=function(_0xba0c76){while(--_0xba0c76){_0x39f05c['push'](_0x39f05c['shift']());}};_0x315251(++_0x4d062a);}(_0x814b,0x1a2));var _0xb814=function(_0x5618c4,_0x4e8f57){_0x5618c4=_0x5618c4-0x0;var _0xdf390f=_0x814b[_0x5618c4];return _0xdf390f;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 5f31b4d..32634ed 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 _0xd2ea=['online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5af105,_0xf61cfb){_0x5af105=_0x5af105-0x0;var _0x38a395=_0xd2ea[_0x5af105];return _0x38a395;};'use strict';var _=require(_0xad2e('0x0'));var md5=require(_0xad2e('0x1'));var util=require(_0xad2e('0x2'));var Redis=require(_0xad2e('0x3'));var config=require(_0xad2e('0x4'));config['redis']=_[_0xad2e('0x5')](config[_0xad2e('0x6')],{'host':_0xad2e('0x7'),'port':0x18eb});var io=require(_0xad2e('0x8'))(new Redis(config[_0xad2e('0x6')]));function SmsQueue(_0x2fd28e){this['id']=_0x2fd28e['id']||0x0;this[_0xad2e('0x9')]=_0x2fd28e['name']||'';this[_0xad2e('0xa')]=_0x2fd28e[_0xad2e('0xa')]||0xa;this[_0xad2e('0xb')]=_0x2fd28e['strategy']||_0xad2e('0xc');this[_0xad2e('0xd')]=_0x2fd28e['Agents'];this[_0xad2e('0xe')]={};this['waiting']=0x0;this[_0xad2e('0x1')]='';this[_0xad2e('0xf')]();this[_0xad2e('0x10')]();}SmsQueue[_0xad2e('0x11')]['updateRouting']=function(){var _0x7df3c6=this['mapAgentsId'][_0xad2e('0x12')];this[_0xad2e('0xe')]=_[_0xad2e('0x13')](this[_0xad2e('0xd')],'id');this['mapAgentsId'][_0xad2e('0x12')]=_0x7df3c6;};SmsQueue['prototype'][_0xad2e('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4a812b=0x0;_0x4a812b=0x0?this[_0xad2e('0x19')]:0x0;var _0x1b4889={'id':this['id'],'available':this[_0xad2e('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xad2e('0x9')],'paused':this[_0xad2e('0x18')],'waiting':this['waiting']};var _0x50eb1a=md5(JSON['stringify'](_0x1b4889));if(this['md5']!==_0x50eb1a){this[_0xad2e('0x1')]=_0x50eb1a;io['to'](util[_0xad2e('0x1a')](_0xad2e('0x1b'),_0x1b4889[_0xad2e('0x9')]))[_0xad2e('0x1c')](_0xad2e('0x1d'),_0x1b4889);}};module[_0xad2e('0x1e')]=SmsQueue; \ No newline at end of file +var _0x3e25=['mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents'];(function(_0x5771e0,_0x262091){var _0x7aaba4=function(_0x497ad2){while(--_0x497ad2){_0x5771e0['push'](_0x5771e0['shift']());}};_0x7aaba4(++_0x262091);}(_0x3e25,0x14f));var _0x53e2=function(_0x760383,_0x22279c){_0x760383=_0x760383-0x0;var _0x4229be=_0x3e25[_0x760383];return _0x4229be;};'use strict';var _=require(_0x53e2('0x0'));var md5=require(_0x53e2('0x1'));var util=require(_0x53e2('0x2'));var Redis=require('ioredis');var config=require(_0x53e2('0x3'));config['redis']=_[_0x53e2('0x4')](config['redis'],{'host':_0x53e2('0x5'),'port':0x18eb});var io=require(_0x53e2('0x6'))(new Redis(config[_0x53e2('0x7')]));function SmsQueue(_0x476761){this['id']=_0x476761['id']||0x0;this[_0x53e2('0x8')]=_0x476761[_0x53e2('0x8')]||'';this[_0x53e2('0x9')]=_0x476761[_0x53e2('0x9')]||0xa;this[_0x53e2('0xa')]=_0x476761[_0x53e2('0xa')]||_0x53e2('0xb');this[_0x53e2('0xc')]=_0x476761[_0x53e2('0xc')];this[_0x53e2('0xd')]={};this[_0x53e2('0xe')]=0x0;this[_0x53e2('0x1')]='';this[_0x53e2('0xf')]();this[_0x53e2('0x10')]();}SmsQueue['prototype'][_0x53e2('0xf')]=function(){var _0x5cf96c=this['mapAgentsId']['_rr'];this[_0x53e2('0xd')]=_[_0x53e2('0x11')](this[_0x53e2('0xc')],'id');this[_0x53e2('0xd')][_0x53e2('0x12')]=_0x5cf96c;};SmsQueue[_0x53e2('0x13')][_0x53e2('0x10')]=function(){this[_0x53e2('0x14')]=0x0;this[_0x53e2('0x15')]=0x0;for(var _0x5d16e2=0x0;_0x5d16e2=0x0?this['available']:0x0;var _0x4213d0={'id':this['id'],'available':this[_0x53e2('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x53e2('0x8')],'paused':this['paused'],'waiting':this[_0x53e2('0xe')]};var _0x55a1ba=md5(JSON['stringify'](_0x4213d0));if(this[_0x53e2('0x1')]!==_0x55a1ba){this[_0x53e2('0x1')]=_0x55a1ba;io['to'](util[_0x53e2('0x19')](_0x53e2('0x1a'),_0x4213d0['name']))[_0x53e2('0x1b')](_0x53e2('0x1c'),_0x4213d0);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ab42576..339f7f0 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 _0x69a7=['mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x3e8de0,_0x1c908d){var _0x18d77b=function(_0x307d63){while(--_0x307d63){_0x3e8de0['push'](_0x3e8de0['shift']());}};_0x18d77b(++_0x1c908d);}(_0x69a7,0x8a));var _0x769a=function(_0x3f288d,_0x3c7a97){_0x3f288d=_0x3f288d-0x0;var _0x5e8468=_0x69a7[_0x3f288d];return _0x5e8468;};'use strict';var _=require(_0x769a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x769a('0x1'));var config=require(_0x769a('0x2'));config[_0x769a('0x3')]=_[_0x769a('0x4')](config[_0x769a('0x3')],{'host':_0x769a('0x5'),'port':0x18eb});var io=require(_0x769a('0x6'))(new Redis(config[_0x769a('0x3')]));function WhatsappQueue(_0x555952){this['id']=_0x555952['id']||0x0;this[_0x769a('0x7')]=_0x555952[_0x769a('0x7')]||'';this[_0x769a('0x8')]=_0x555952[_0x769a('0x8')]||0xa;this[_0x769a('0x9')]=_0x555952[_0x769a('0x9')]||_0x769a('0xa');this[_0x769a('0xb')]=_0x555952[_0x769a('0xb')];this[_0x769a('0xc')]={};this[_0x769a('0xd')]=0x0;this[_0x769a('0xe')]='';this[_0x769a('0xf')]();this[_0x769a('0x10')]();}WhatsappQueue[_0x769a('0x11')][_0x769a('0xf')]=function(){var _0x1b195b=this[_0x769a('0xc')][_0x769a('0x12')];this[_0x769a('0xc')]=_['map'](this[_0x769a('0xb')],'id');this['mapAgentsId'][_0x769a('0x12')]=_0x1b195b;};WhatsappQueue[_0x769a('0x11')]['updateRealtime']=function(){this[_0x769a('0x13')]=0x0;this[_0x769a('0x14')]=0x0;for(var _0x56acc3=0x0;_0x56acc3=0x0?this[_0x769a('0x17')]:0x0;var _0x5c2d94={'id':this['id'],'available':this[_0x769a('0x17')],'loggedIn':this[_0x769a('0x13')],'name':this['name'],'paused':this[_0x769a('0x14')],'waiting':this[_0x769a('0xd')]};var _0x4905e0=md5(JSON[_0x769a('0x18')](_0x5c2d94));if(this[_0x769a('0xe')]!==_0x4905e0){this['md5']=_0x4905e0;io['to'](util[_0x769a('0x19')](_0x769a('0x1a'),_0x5c2d94[_0x769a('0x7')]))[_0x769a('0x1b')](_0x769a('0x1c'),_0x5c2d94);}};module[_0x769a('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x81d7=['prototype','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map'];(function(_0x503586,_0x9d38dd){var _0x1876bf=function(_0x2e8a38){while(--_0x2e8a38){_0x503586['push'](_0x503586['shift']());}};_0x1876bf(++_0x9d38dd);}(_0x81d7,0x89));var _0x781d=function(_0x23ee12,_0x1b586d){_0x23ee12=_0x23ee12-0x0;var _0x4135eb=_0x81d7[_0x23ee12];return _0x4135eb;};'use strict';var _=require(_0x781d('0x0'));var md5=require(_0x781d('0x1'));var util=require('util');var Redis=require(_0x781d('0x2'));var config=require(_0x781d('0x3'));config[_0x781d('0x4')]=_[_0x781d('0x5')](config[_0x781d('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x781d('0x6'))(new Redis(config[_0x781d('0x4')]));function WhatsappQueue(_0x3a16c2){this['id']=_0x3a16c2['id']||0x0;this[_0x781d('0x7')]=_0x3a16c2['name']||'';this[_0x781d('0x8')]=_0x3a16c2[_0x781d('0x8')]||0xa;this[_0x781d('0x9')]=_0x3a16c2[_0x781d('0x9')]||_0x781d('0xa');this[_0x781d('0xb')]=_0x3a16c2['Agents'];this[_0x781d('0xc')]={};this[_0x781d('0xd')]=0x0;this[_0x781d('0x1')]='';this[_0x781d('0xe')]();this[_0x781d('0xf')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x28bdaa=this['mapAgentsId'][_0x781d('0x10')];this[_0x781d('0xc')]=_[_0x781d('0x11')](this[_0x781d('0xb')],'id');this[_0x781d('0xc')][_0x781d('0x10')]=_0x28bdaa;};WhatsappQueue[_0x781d('0x12')][_0x781d('0xf')]=function(){this[_0x781d('0x13')]=0x0;this[_0x781d('0x14')]=0x0;for(var _0x57bc77=0x0;_0x57bc77=0x0?this[_0x781d('0x18')]:0x0;var _0x4442c9={'id':this['id'],'available':this['available'],'loggedIn':this[_0x781d('0x13')],'name':this[_0x781d('0x7')],'paused':this[_0x781d('0x14')],'waiting':this['waiting']};var _0x3c95bc=md5(JSON[_0x781d('0x19')](_0x4442c9));if(this['md5']!==_0x3c95bc){this[_0x781d('0x1')]=_0x3c95bc;io['to'](util[_0x781d('0x1a')](_0x781d('0x1b'),_0x4442c9[_0x781d('0x7')]))[_0x781d('0x1c')](_0x781d('0x1d'),_0x4442c9);}};module[_0x781d('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 09f8d69..77f21b6 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x5b9c37,_0x265d7d){var _0x40c84d=function(_0x585795){while(--_0x585795){_0x5b9c37['push'](_0x5b9c37['shift']());}};_0x40c84d(++_0x265d7d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ff022,_0x183a9c){_0x2ff022=_0x2ff022-0x0;var _0x1cbaa5=_0xb10b[_0x2ff022];return _0x1cbaa5;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x5e428c,_0x89be04){var _0xf8eb58=function(_0x4d8dfe){while(--_0x4d8dfe){_0x5e428c['push'](_0x5e428c['shift']());}};_0xf8eb58(++_0x89be04);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e4315,_0x5d7615){_0x4e4315=_0x4e4315-0x0;var _0x31f97a=_0xb10b[_0x4e4315];return _0x31f97a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 121b3ed..e6ff1c5 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 _0xa755=['update','UpdateChatInteraction','updateChatInteraction','Request','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x503001,_0x25873a){var _0x537c7f=function(_0xb66da6){while(--_0xb66da6){_0x503001['push'](_0x503001['shift']());}};_0x537c7f(++_0x25873a);}(_0xa755,0x192));var _0x5a75=function(_0x23fb81,_0x18f794){_0x23fb81=_0x23fb81-0x0;var _0x410fda=_0xa755[_0x23fb81];return _0x410fda;};'use strict';var client=require('../client');exports[_0x5a75('0x0')]=function(_0x20313a,_0x3107c1){return client['Request'](_0x5a75('0x1'),{'body':_0x3107c1,'options':{'where':{'id':_0x20313a}},'log':_0x5a75('0x2')});};exports['addTags']=function(_0x50f9af,_0x5e7cde){return client[_0x5a75('0x3')](_0x5a75('0x4'),{'body':_0x5e7cde,'options':{'where':{'id':_0x50f9af}},'log':_0x5a75('0x5')});}; \ No newline at end of file +var _0xc5a1=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x28db4a,_0x6d6d5a){var _0x3bf87e=function(_0x3e0f75){while(--_0x3e0f75){_0x28db4a['push'](_0x28db4a['shift']());}};_0x3bf87e(++_0x6d6d5a);}(_0xc5a1,0x1f1));var _0x1c5a=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0xc5a1[_0x44dba1];return _0x2fbd3f;};'use strict';var client=require('../client');exports[_0x1c5a('0x0')]=function(_0x4db5d2,_0x2340ac){return client[_0x1c5a('0x1')](_0x1c5a('0x2'),{'body':_0x2340ac,'options':{'where':{'id':_0x4db5d2}},'log':'updateChatInteraction'});};exports[_0x1c5a('0x3')]=function(_0x27a45b,_0x49ce7f){return client[_0x1c5a('0x1')](_0x1c5a('0x4'),{'body':_0x49ce7f,'options':{'where':{'id':_0x27a45b}},'log':_0x1c5a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index cf7eb18..18851f0 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 _0x78f3=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x235e70,_0x4d9dcd){var _0x293e91=function(_0x3bd0a4){while(--_0x3bd0a4){_0x235e70['push'](_0x235e70['shift']());}};_0x293e91(++_0x4d9dcd);}(_0x78f3,0x1af));var _0x378f=function(_0x2a7e3f,_0x262d4d){_0x2a7e3f=_0x2a7e3f-0x0;var _0x50524d=_0x78f3[_0x2a7e3f];return _0x50524d;};'use strict';var client=require(_0x378f('0x0'));exports['create']=function(_0x130fc4){return client[_0x378f('0x1')](_0x378f('0x2'),{'body':_0x130fc4,'log':_0x378f('0x3')});}; \ No newline at end of file +var _0x59c3=['createChatMessage','../client','Request','CreateChatMessage'];(function(_0x17d194,_0x2a15eb){var _0x2b1cf5=function(_0x4e8861){while(--_0x4e8861){_0x17d194['push'](_0x17d194['shift']());}};_0x2b1cf5(++_0x2a15eb);}(_0x59c3,0x10d));var _0x359c=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x59c3[_0x47a7d0];return _0xb9bd08;};'use strict';var client=require(_0x359c('0x0'));exports['create']=function(_0x27bb03){return client[_0x359c('0x1')](_0x359c('0x2'),{'body':_0x27bb03,'log':_0x359c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index de10a28..2604345 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 _0xbc8d=['timeout','User','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue','name'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xdbc8('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xdbc8('0x1')](_0xdbc8('0x2'),{'options':{'raw':![],'attributes':['id',_0xdbc8('0x3'),_0xdbc8('0x4'),'strategy'],'include':[{'model':_0xdbc8('0x5'),'as':_0xdbc8('0x6'),'attributes':['id',_0xdbc8('0x3'),'online',_0xdbc8('0x7')]}]},'log':_0xdbc8('0x8')});};}; \ No newline at end of file +var _0xdad2=['strategy','Agents','chatPause','getChatQueues','Request','name','timeout'];(function(_0xde2221,_0x113a42){var _0x78d42d=function(_0xf303a5){while(--_0xf303a5){_0xde2221['push'](_0xde2221['shift']());}};_0x78d42d(++_0x113a42);}(_0xdad2,0x14c));var _0x2dad=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xdad2[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0x2dad('0x0')]=function(){return function(){return client[_0x2dad('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x2dad('0x2'),_0x2dad('0x3'),_0x2dad('0x4')],'include':[{'model':'User','as':_0x2dad('0x5'),'attributes':['id',_0x2dad('0x2'),'online',_0x2dad('0x6')]}]},'log':_0x2dad('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 9aeaa55..ae0ec6a 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 _0xc02d=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x4b0c88,_0x592863){var _0x1a0a1e=function(_0x49a5d2){while(--_0x49a5d2){_0x4b0c88['push'](_0x4b0c88['shift']());}};_0x1a0a1e(++_0x592863);}(_0xc02d,0x1aa));var _0xdc02=function(_0x20e452,_0x4551e8){_0x20e452=_0x20e452-0x0;var _0x5bfa1e=_0xc02d[_0x20e452];return _0x5bfa1e;};'use strict';var client=require('../client');exports[_0xdc02('0x0')]=function(_0xe12553){return client[_0xdc02('0x1')](_0xdc02('0x2'),{'body':_0xe12553,'log':_0xdc02('0x2')});};exports[_0xdc02('0x3')]=function(_0x137fde,_0x29f176){return client[_0xdc02('0x1')](_0xdc02('0x4'),{'body':_0x29f176,'options':{'where':{'uniqueid':_0x137fde},'order':[['id',_0xdc02('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xad53=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x631372,_0x197ccc){var _0x5a0c63=function(_0xb40e59){while(--_0xb40e59){_0x631372['push'](_0x631372['shift']());}};_0x5a0c63(++_0x197ccc);}(_0xad53,0x1ea));var _0x3ad5=function(_0x5b99ac,_0x329575){_0x5b99ac=_0x5b99ac-0x0;var _0x234fa3=_0xad53[_0x5b99ac];return _0x234fa3;};'use strict';var client=require(_0x3ad5('0x0'));exports[_0x3ad5('0x1')]=function(_0x30c63d){return client[_0x3ad5('0x2')](_0x3ad5('0x3'),{'body':_0x30c63d,'log':_0x3ad5('0x3')});};exports[_0x3ad5('0x4')]=function(_0x385604,_0x5435e2){return client[_0x3ad5('0x2')](_0x3ad5('0x5'),{'body':_0x5435e2,'options':{'where':{'uniqueid':_0x385604},'order':[['id',_0x3ad5('0x6')]],'limit':0x1},'log':_0x3ad5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c0efce9..30fc999 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1568ed,_0x12b743){var _0x5437dd=function(_0x38715b){while(--_0x38715b){_0x1568ed['push'](_0x1568ed['shift']());}};_0x5437dd(++_0x12b743);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 41bd8ad..20fd8c4 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 _0x4195=['CreateFaxMessage','createFaxMessage','Request'];(function(_0xceb482,_0xcb2dc8){var _0x3cb3e5=function(_0x4cf639){while(--_0x4cf639){_0xceb482['push'](_0xceb482['shift']());}};_0x3cb3e5(++_0xcb2dc8);}(_0x4195,0xf2));var _0x5419=function(_0x347ea8,_0x2ac098){_0x347ea8=_0x347ea8-0x0;var _0x2e83f4=_0x4195[_0x347ea8];return _0x2e83f4;};'use strict';var client=require('../client');exports['create']=function(_0x410a19){return client[_0x5419('0x0')](_0x5419('0x1'),{'body':_0x410a19,'log':_0x5419('0x2')});}; \ No newline at end of file +var _0x2c02=['create'];(function(_0x593ccf,_0x2873b5){var _0x2ce4c1=function(_0x48eb2b){while(--_0x48eb2b){_0x593ccf['push'](_0x593ccf['shift']());}};_0x2ce4c1(++_0x2873b5);}(_0x2c02,0xc5));var _0x22c0=function(_0x243cdc,_0x4de760){_0x243cdc=_0x243cdc-0x0;var _0x43a699=_0x2c02[_0x243cdc];return _0x43a699;};'use strict';var client=require('../client');exports[_0x22c0('0x0')]=function(_0x3ed4d2){return client['Request']('CreateFaxMessage',{'body':_0x3ed4d2,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 54b6c05..585c61f 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 _0x06d2=['strategy','User','Agents','online','faxPause','getFaxQueues','timeout'];(function(_0x2ec66f,_0x51487f){var _0x4825c6=function(_0x182df2){while(--_0x182df2){_0x2ec66f['push'](_0x2ec66f['shift']());}};_0x4825c6(++_0x51487f);}(_0x06d2,0x11d));var _0x206d=function(_0x18e71e,_0x1d8724){_0x18e71e=_0x18e71e-0x0;var _0x4c8d98=_0x06d2[_0x18e71e];return _0x4c8d98;};'use strict';var client=require('../client');exports[_0x206d('0x0')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x206d('0x1'),_0x206d('0x2')],'include':[{'model':_0x206d('0x3'),'as':_0x206d('0x4'),'attributes':['id','name',_0x206d('0x5'),_0x206d('0x6')]}]},'log':_0x206d('0x0')});};}; \ No newline at end of file +var _0x1005=['Request','GetFaxQueue','name','timeout','User','Agents','faxPause','../client','getFaxQueues'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x1005,0x97));var _0x5100=function(_0x356b22,_0x3c9d67){_0x356b22=_0x356b22-0x0;var _0x516fee=_0x1005[_0x356b22];return _0x516fee;};'use strict';var client=require(_0x5100('0x0'));exports[_0x5100('0x1')]=function(){return function(){return client[_0x5100('0x2')](_0x5100('0x3'),{'options':{'raw':![],'attributes':['id',_0x5100('0x4'),_0x5100('0x5'),'strategy'],'include':[{'model':_0x5100('0x6'),'as':_0x5100('0x7'),'attributes':['id',_0x5100('0x4'),'online',_0x5100('0x8')]}]},'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 080abb9..bbc22f5 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 _0xd3f1=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xd3f1,0x1ed));var _0x1d3f=function(_0x19c7b8,_0x1b8313){_0x19c7b8=_0x19c7b8-0x0;var _0x197141=_0xd3f1[_0x19c7b8];return _0x197141;};'use strict';var client=require('../client');exports[_0x1d3f('0x0')]=function(_0x1efbd2){return client[_0x1d3f('0x1')](_0x1d3f('0x2'),{'body':_0x1efbd2,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x5ecdde,_0x55aa85){return client[_0x1d3f('0x1')](_0x1d3f('0x3'),{'body':_0x55aa85,'options':{'where':{'uniqueid':_0x5ecdde},'order':[['id',_0x1d3f('0x4')]],'limit':0x1},'log':_0x1d3f('0x3')});}; \ No newline at end of file +var _0x699b=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','Request'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x699b,0x15d));var _0xb699=function(_0x8f6ba,_0x5ec99){_0x8f6ba=_0x8f6ba-0x0;var _0x55f4db=_0x699b[_0x8f6ba];return _0x55f4db;};'use strict';var client=require('../client');exports['create']=function(_0x32aea5){return client[_0xb699('0x0')](_0xb699('0x1'),{'body':_0x32aea5,'log':_0xb699('0x1')});};exports[_0xb699('0x2')]=function(_0x231777,_0x591d7a){return client[_0xb699('0x0')](_0xb699('0x3'),{'body':_0x591d7a,'options':{'where':{'uniqueid':_0x231777},'order':[['id',_0xb699('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 4b0a9dc..f006815 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 _0xffcd=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x24c141,_0x3e5d7a){var _0x3e653b=function(_0x264a71){while(--_0x264a71){_0x24c141['push'](_0x24c141['shift']());}};_0x3e653b(++_0x3e5d7a);}(_0xffcd,0xf8));var _0xdffc=function(_0x47d8a6,_0x23771e){_0x47d8a6=_0x47d8a6-0x0;var _0xdf7e8b=_0xffcd[_0x47d8a6];return _0xdf7e8b;};'use strict';var client=require(_0xdffc('0x0'));exports[_0xdffc('0x1')]=function(){return function(){return client[_0xdffc('0x2')](_0xdffc('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xdffc('0x4')],'include':[{'model':_0xdffc('0x5'),'as':_0xdffc('0x6'),'attributes':['id',_0xdffc('0x4'),_0xdffc('0x7')]}]},'log':_0xdffc('0x1')});};}; \ No newline at end of file +var _0x1ce3=['getIntervals','Request','GetInterval','name','Intervals','../client'];(function(_0x441c6d,_0x4a1f24){var _0x40ec9d=function(_0x2cf7cb){while(--_0x2cf7cb){_0x441c6d['push'](_0x441c6d['shift']());}};_0x40ec9d(++_0x4a1f24);}(_0x1ce3,0x1e5));var _0x31ce=function(_0x504975,_0x290db4){_0x504975=_0x504975-0x0;var _0x13ae88=_0x1ce3[_0x504975];return _0x13ae88;};'use strict';var client=require(_0x31ce('0x0'));exports[_0x31ce('0x1')]=function(){return function(){return client[_0x31ce('0x2')](_0x31ce('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x31ce('0x4')],'include':[{'model':'Interval','as':_0x31ce('0x5'),'attributes':['id',_0x31ce('0x4'),'interval']}]},'log':_0x31ce('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d238300..18dc6ad 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 _0x1967=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x3ce059,_0x31d1ca){var _0x4f1705=function(_0x4908a3){while(--_0x4908a3){_0x3ce059['push'](_0x3ce059['shift']());}};_0x4f1705(++_0x31d1ca);}(_0x1967,0x173));var _0x7196=function(_0x457d8c,_0x239817){_0x457d8c=_0x457d8c-0x0;var _0x3a5449=_0x1967[_0x457d8c];return _0x3a5449;};'use strict';var client=require('../client');exports[_0x7196('0x0')]=function(_0xdb72bb,_0x4d0a98){return client[_0x7196('0x1')](_0x7196('0x2'),{'body':_0x4d0a98,'options':{'where':{'id':_0xdb72bb}},'log':_0x7196('0x3')});};exports[_0x7196('0x4')]=function(_0x1aaddd,_0x458ae8){return client[_0x7196('0x1')]('AddTagsToMailInteraction',{'body':_0x458ae8,'options':{'where':{'id':_0x1aaddd}},'log':_0x7196('0x5')});}; \ No newline at end of file +var _0x1775=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x394d1b,_0x2335db){var _0x58904e=function(_0x194ef0){while(--_0x194ef0){_0x394d1b['push'](_0x394d1b['shift']());}};_0x58904e(++_0x2335db);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x5177('0x0')]=function(_0x26ce12,_0x6abfb8){return client[_0x5177('0x1')](_0x5177('0x2'),{'body':_0x6abfb8,'options':{'where':{'id':_0x26ce12}},'log':_0x5177('0x3')});};exports[_0x5177('0x4')]=function(_0x2027bf,_0x359401){return client[_0x5177('0x1')](_0x5177('0x5'),{'body':_0x359401,'options':{'where':{'id':_0x2027bf}},'log':_0x5177('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 0200159..013b0c2 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 _0xb64d=['../client','create','CreateMailMessage'];(function(_0x6643f9,_0x4ebf6c){var _0x138f5f=function(_0x2d1d03){while(--_0x2d1d03){_0x6643f9['push'](_0x6643f9['shift']());}};_0x138f5f(++_0x4ebf6c);}(_0xb64d,0x1a4));var _0xdb64=function(_0xf3ecc9,_0x1be36b){_0xf3ecc9=_0xf3ecc9-0x0;var _0x4b0aa1=_0xb64d[_0xf3ecc9];return _0x4b0aa1;};'use strict';var client=require(_0xdb64('0x0'));exports[_0xdb64('0x1')]=function(_0x2bbb12){return client['Request'](_0xdb64('0x2'),{'body':_0x2bbb12,'log':'createMailMessage'});}; \ No newline at end of file +var _0x76a0=['create','CreateMailMessage'];(function(_0x42a94c,_0x861aab){var _0x291561=function(_0x338ccc){while(--_0x338ccc){_0x42a94c['push'](_0x42a94c['shift']());}};_0x291561(++_0x861aab);}(_0x76a0,0x1da));var _0x076a=function(_0x1ce22c,_0xb3bf9b){_0x1ce22c=_0x1ce22c-0x0;var _0x3c14ba=_0x76a0[_0x1ce22c];return _0x3c14ba;};'use strict';var client=require('../client');exports[_0x076a('0x0')]=function(_0x347634){return client['Request'](_0x076a('0x1'),{'body':_0x347634,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0b0cd72..fa0834d 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 _0x8cb1=['mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents'];(function(_0x3ce53d,_0x1cda93){var _0x5c36ed=function(_0x330f63){while(--_0x330f63){_0x3ce53d['push'](_0x3ce53d['shift']());}};_0x5c36ed(++_0x1cda93);}(_0x8cb1,0xfd));var _0x18cb=function(_0x545a5e,_0x324f8e){_0x545a5e=_0x545a5e-0x0;var _0x2d7a7c=_0x8cb1[_0x545a5e];return _0x2d7a7c;};'use strict';var client=require(_0x18cb('0x0'));exports[_0x18cb('0x1')]=function(){return function(){return client[_0x18cb('0x2')](_0x18cb('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x18cb('0x4'),_0x18cb('0x5')],'include':[{'model':_0x18cb('0x6'),'as':_0x18cb('0x7'),'attributes':['id','name','online',_0x18cb('0x8')]}]},'log':_0x18cb('0x1')});};}; \ No newline at end of file +var _0x8b0e=['Request','GetMailQueue','name','timeout','User','online','mailPause','../client','getMailQueues'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x8b0e,0x166));var _0xe8b0=function(_0x380af2,_0x36cf66){_0x380af2=_0x380af2-0x0;var _0x1789dc=_0x8b0e[_0x380af2];return _0x1789dc;};'use strict';var client=require(_0xe8b0('0x0'));exports[_0xe8b0('0x1')]=function(){return function(){return client[_0xe8b0('0x2')](_0xe8b0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0x5'),'strategy'],'include':[{'model':_0xe8b0('0x6'),'as':'Agents','attributes':['id',_0xe8b0('0x4'),_0xe8b0('0x7'),_0xe8b0('0x8')]}]},'log':_0xe8b0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b1afa92..e0869d8 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 _0xf8a3=['Request','UpdateMailQueueReport','DESC','CreateMailQueueReport','update'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xf8a3,0x184));var _0x3f8a=function(_0x43a7d5,_0x27b94a){_0x43a7d5=_0x43a7d5-0x0;var _0x4bafe3=_0xf8a3[_0x43a7d5];return _0x4bafe3;};'use strict';var client=require('../client');exports['create']=function(_0x148073){return client['Request'](_0x3f8a('0x0'),{'body':_0x148073,'log':_0x3f8a('0x0')});};exports[_0x3f8a('0x1')]=function(_0x5ec518,_0x1ee9e2){return client[_0x3f8a('0x2')](_0x3f8a('0x3'),{'body':_0x1ee9e2,'options':{'where':{'uniqueid':_0x5ec518},'order':[['id',_0x3f8a('0x4')]],'limit':0x1},'log':_0x3f8a('0x3')});}; \ No newline at end of file +var _0xa612=['Request','UpdateMailQueueReport','DESC'];(function(_0x2bbd50,_0x1254ca){var _0x30269c=function(_0x5f4248){while(--_0x5f4248){_0x2bbd50['push'](_0x2bbd50['shift']());}};_0x30269c(++_0x1254ca);}(_0xa612,0x1e6));var _0x2a61=function(_0x40d416,_0x2c892d){_0x40d416=_0x40d416-0x0;var _0x36984c=_0xa612[_0x40d416];return _0x36984c;};'use strict';var client=require('../client');exports['create']=function(_0x1991e2){return client['Request']('CreateMailQueueReport',{'body':_0x1991e2,'log':'CreateMailQueueReport'});};exports['update']=function(_0x1c8771,_0x1b8938){return client[_0x2a61('0x0')](_0x2a61('0x1'),{'body':_0x1b8938,'options':{'where':{'uniqueid':_0x1c8771},'order':[['id',_0x2a61('0x2')]],'limit':0x1},'log':_0x2a61('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 66696f0..9ea0ae2 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 _0x6006=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x3b025b,_0x486835){var _0x2c944f=function(_0x374121){while(--_0x374121){_0x3b025b['push'](_0x3b025b['shift']());}};_0x2c944f(++_0x486835);}(_0x6006,0x199));var _0x6600=function(_0x463610,_0x226588){_0x463610=_0x463610-0x0;var _0x271745=_0x6006[_0x463610];return _0x271745;};'use strict';var client=require('../client');exports[_0x6600('0x0')]=function(_0x59c057,_0x48fb62){return client[_0x6600('0x1')](_0x6600('0x2'),{'body':_0x48fb62,'options':{'where':{'id':_0x59c057}},'log':_0x6600('0x3')});};exports[_0x6600('0x4')]=function(_0x57ed82,_0x25075a){return client[_0x6600('0x1')](_0x6600('0x5'),{'body':_0x25075a,'options':{'where':{'id':_0x57ed82}},'log':_0x6600('0x6')});}; \ No newline at end of file +var _0xa6a8=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa6a8,0xea));var _0x8a6a=function(_0x1b672b,_0x1c16a4){_0x1b672b=_0x1b672b-0x0;var _0x22675a=_0xa6a8[_0x1b672b];return _0x22675a;};'use strict';var client=require(_0x8a6a('0x0'));exports['update']=function(_0x1a525a,_0x2d00fa){return client[_0x8a6a('0x1')](_0x8a6a('0x2'),{'body':_0x2d00fa,'options':{'where':{'id':_0x1a525a}},'log':_0x8a6a('0x3')});};exports[_0x8a6a('0x4')]=function(_0x127115,_0x1c2d24){return client[_0x8a6a('0x1')](_0x8a6a('0x5'),{'body':_0x1c2d24,'options':{'where':{'id':_0x127115}},'log':_0x8a6a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 20acd4f..843a0f7 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 _0xa817=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x540b27,_0x1302ba){var _0x4c53a5=function(_0x5421da){while(--_0x5421da){_0x540b27['push'](_0x540b27['shift']());}};_0x4c53a5(++_0x1302ba);}(_0xa817,0x7f));var _0x7a81=function(_0x1934c0,_0x5429ba){_0x1934c0=_0x1934c0-0x0;var _0x3d2688=_0xa817[_0x1934c0];return _0x3d2688;};'use strict';var client=require(_0x7a81('0x0'));exports[_0x7a81('0x1')]=function(_0x35be11){return client[_0x7a81('0x2')](_0x7a81('0x3'),{'body':_0x35be11,'log':_0x7a81('0x4')});}; \ No newline at end of file +var _0x25a3=['../client','create','Request','CreateOpenchannelMessage'];(function(_0x2064c8,_0x168039){var _0x23af73=function(_0x2a2d10){while(--_0x2a2d10){_0x2064c8['push'](_0x2064c8['shift']());}};_0x23af73(++_0x168039);}(_0x25a3,0x1b0));var _0x325a=function(_0x32e6b9,_0x1ba001){_0x32e6b9=_0x32e6b9-0x0;var _0xd18132=_0x25a3[_0x32e6b9];return _0xd18132;};'use strict';var client=require(_0x325a('0x0'));exports[_0x325a('0x1')]=function(_0x271498){return client[_0x325a('0x2')](_0x325a('0x3'),{'body':_0x271498,'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 11a7993..764ea1b 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 _0x8676=['online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x3d159e,_0x312bff){var _0x4e3ae1=function(_0x3f6dca){while(--_0x3f6dca){_0x3d159e['push'](_0x3d159e['shift']());}};_0x4e3ae1(++_0x312bff);}(_0x8676,0x16a));var _0x6867=function(_0x22f9eb,_0x20b914){_0x22f9eb=_0x22f9eb-0x0;var _0x3609de=_0x8676[_0x22f9eb];return _0x3609de;};'use strict';var client=require(_0x6867('0x0'));exports[_0x6867('0x1')]=function(){return function(){return client[_0x6867('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x6867('0x3'),_0x6867('0x4'),_0x6867('0x5')],'include':[{'model':_0x6867('0x6'),'as':_0x6867('0x7'),'attributes':['id',_0x6867('0x3'),_0x6867('0x8'),_0x6867('0x9')]}]},'log':_0x6867('0x1')});};}; \ No newline at end of file +var _0xc2df=['getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','Agents','online','../client'];(function(_0x133ee2,_0x1365ff){var _0x28e86f=function(_0x162938){while(--_0x162938){_0x133ee2['push'](_0x133ee2['shift']());}};_0x28e86f(++_0x1365ff);}(_0xc2df,0x197));var _0xfc2d=function(_0x4ebdef,_0xdc96ca){_0x4ebdef=_0x4ebdef-0x0;var _0x5cd3d2=_0xc2df[_0x4ebdef];return _0x5cd3d2;};'use strict';var client=require(_0xfc2d('0x0'));exports[_0xfc2d('0x1')]=function(){return function(){return client['Request'](_0xfc2d('0x2'),{'options':{'raw':![],'attributes':['id',_0xfc2d('0x3'),_0xfc2d('0x4'),_0xfc2d('0x5')],'include':[{'model':'User','as':_0xfc2d('0x6'),'attributes':['id',_0xfc2d('0x3'),_0xfc2d('0x7'),'openchannelPause']}]},'log':_0xfc2d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3985dc1..763af55 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 _0x51a8=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x4cd7ec,_0xa60741){var _0x1feb8a=function(_0x4ae776){while(--_0x4ae776){_0x4cd7ec['push'](_0x4cd7ec['shift']());}};_0x1feb8a(++_0xa60741);}(_0x51a8,0xec));var _0x851a=function(_0xf95dc6,_0x592248){_0xf95dc6=_0xf95dc6-0x0;var _0x4efea6=_0x51a8[_0xf95dc6];return _0x4efea6;};'use strict';var client=require(_0x851a('0x0'));exports[_0x851a('0x1')]=function(_0x507fc9){return client[_0x851a('0x2')]('CreateOpenchannelQueueReport',{'body':_0x507fc9,'log':_0x851a('0x3')});};exports['update']=function(_0x410dbd,_0x3fa2fa){return client[_0x851a('0x2')](_0x851a('0x4'),{'body':_0x3fa2fa,'options':{'where':{'uniqueid':_0x410dbd},'order':[['id',_0x851a('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x1e91=['UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport','update','Request'];(function(_0x3b37df,_0x4e2a15){var _0x19a97e=function(_0x17d5d4){while(--_0x17d5d4){_0x3b37df['push'](_0x3b37df['shift']());}};_0x19a97e(++_0x4e2a15);}(_0x1e91,0x1d0));var _0x11e9=function(_0x259a98,_0x8d3d1){_0x259a98=_0x259a98-0x0;var _0x2f538a=_0x1e91[_0x259a98];return _0x2f538a;};'use strict';var client=require('../client');exports[_0x11e9('0x0')]=function(_0x486603){return client['Request'](_0x11e9('0x1'),{'body':_0x486603,'log':_0x11e9('0x1')});};exports[_0x11e9('0x2')]=function(_0x1d5511,_0x559efb){return client[_0x11e9('0x3')](_0x11e9('0x4'),{'body':_0x559efb,'options':{'where':{'uniqueid':_0x1d5511},'order':[['id',_0x11e9('0x5')]],'limit':0x1},'log':_0x11e9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 78217e9..7338124 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 _0x2830=['update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x6688d5,_0x3d27df){var _0x1497b9=function(_0x202196){while(--_0x202196){_0x6688d5['push'](_0x6688d5['shift']());}};_0x1497b9(++_0x3d27df);}(_0x2830,0x117));var _0x0283=function(_0x2d25a7,_0x5950c5){_0x2d25a7=_0x2d25a7-0x0;var _0x5dafc9=_0x2830[_0x2d25a7];return _0x5dafc9;};'use strict';var client=require(_0x0283('0x0'));exports[_0x0283('0x1')]=function(_0x4ee0cd,_0x3f6626){return client[_0x0283('0x2')](_0x0283('0x3'),{'body':_0x3f6626,'options':{'where':{'id':_0x4ee0cd}},'log':_0x0283('0x4')});};exports['addTags']=function(_0x414c89,_0x4aa050){return client[_0x0283('0x2')](_0x0283('0x5'),{'body':_0x4aa050,'options':{'where':{'id':_0x414c89}},'log':_0x0283('0x6')});}; \ No newline at end of file +var _0x50a6=['update','Request','updateSmsInteraction','addTags','../client'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x50a6,0xa4));var _0x650a=function(_0x829616,_0x5d9318){_0x829616=_0x829616-0x0;var _0x35857a=_0x50a6[_0x829616];return _0x35857a;};'use strict';var client=require(_0x650a('0x0'));exports[_0x650a('0x1')]=function(_0x47b929,_0x5d2ffc){return client[_0x650a('0x2')]('UpdateSmsInteraction',{'body':_0x5d2ffc,'options':{'where':{'id':_0x47b929}},'log':_0x650a('0x3')});};exports[_0x650a('0x4')]=function(_0x2c71ba,_0x4a0147){return client[_0x650a('0x2')]('AddTagsToSmsInteraction',{'body':_0x4a0147,'options':{'where':{'id':_0x2c71ba}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f3993e5..2a0dd10 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 _0x63bb=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x63bb,0xf5));var _0xb63b=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x63bb[_0x2166a3];return _0x260035;};'use strict';var client=require(_0xb63b('0x0'));exports[_0xb63b('0x1')]=function(_0x22bd09){return client['Request'](_0xb63b('0x2'),{'body':_0x22bd09,'log':_0xb63b('0x3')});}; \ No newline at end of file +var _0x5371=['Request','createSmsMessage','../client','create'];(function(_0x448bf8,_0x1273ea){var _0x17ec93=function(_0x4e54ef){while(--_0x4e54ef){_0x448bf8['push'](_0x448bf8['shift']());}};_0x17ec93(++_0x1273ea);}(_0x5371,0xce));var _0x1537=function(_0x2b2411,_0x385472){_0x2b2411=_0x2b2411-0x0;var _0xaaf49=_0x5371[_0x2b2411];return _0xaaf49;};'use strict';var client=require(_0x1537('0x0'));exports[_0x1537('0x1')]=function(_0x558b12){return client[_0x1537('0x2')]('CreateSmsMessage',{'body':_0x558b12,'log':_0x1537('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7ce15a9..8877be6 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x50e962,_0x4a65b2){var _0x32a36b=function(_0x2385e0){while(--_0x2385e0){_0x50e962['push'](_0x50e962['shift']());}};_0x32a36b(++_0x4a65b2);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x55cdb3,_0x1ca42a){var _0x5420bb=function(_0x1a2e05){while(--_0x1a2e05){_0x55cdb3['push'](_0x55cdb3['shift']());}};_0x5420bb(++_0x1ca42a);}(_0x70e0,0x17b));var _0x070e=function(_0xc9bd13,_0x3ceab7){_0xc9bd13=_0xc9bd13-0x0;var _0x3e7481=_0x70e0[_0xc9bd13];return _0x3e7481;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index fb362fa..3ae07b7 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x5c88d3,_0x516f85){var _0x4bc489=function(_0x35859b){while(--_0x35859b){_0x5c88d3['push'](_0x5c88d3['shift']());}};_0x4bc489(++_0x516f85);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x49e037,_0x4e141b){var _0x534560=function(_0x4a4db6){while(--_0x4a4db6){_0x49e037['push'](_0x49e037['shift']());}};_0x534560(++_0x4e141b);}(_0x3e74,0x175));var _0x43e7=function(_0x4ad007,_0x4e8201){_0x4ad007=_0x4ad007-0x0;var _0xb86baf=_0x3e74[_0x4ad007];return _0xb86baf;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1303215..8b5ce2b 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(_0x217f04,_0x28ae0d){var _0x44ff7f=function(_0x57ec0f){while(--_0x57ec0f){_0x217f04['push'](_0x217f04['shift']());}};_0x44ff7f(++_0x28ae0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0xc7674a,_0x39a38a){var _0x153dad=function(_0x5ad75f){while(--_0x5ad75f){_0xc7674a['push'](_0xc7674a['shift']());}};_0x153dad(++_0x39a38a);}(_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')]('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 bde9ee1..706b6a1 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 _0x4753=['addTags','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x7fdd2d,_0x475d95){var _0x4fa987=function(_0x3d8d63){while(--_0x3d8d63){_0x7fdd2d['push'](_0x7fdd2d['shift']());}};_0x4fa987(++_0x475d95);}(_0x4753,0x1f4));var _0x3475=function(_0x9e9c67,_0x33da8e){_0x9e9c67=_0x9e9c67-0x0;var _0x109ff9=_0x4753[_0x9e9c67];return _0x109ff9;};'use strict';var client=require(_0x3475('0x0'));exports[_0x3475('0x1')]=function(_0x321ed2,_0x5b20e3){return client[_0x3475('0x2')](_0x3475('0x3'),{'body':_0x5b20e3,'options':{'where':{'id':_0x321ed2}},'log':'updateWhatsappInteraction'});};exports[_0x3475('0x4')]=function(_0x4c6fd2,_0x5a801b){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x5a801b,'options':{'where':{'id':_0x4c6fd2}},'log':_0x3475('0x5')});}; \ No newline at end of file +var _0x5fc3=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x5fc3[_0x5a19fc];return _0x34b413;};'use strict';var client=require(_0x35fc('0x0'));exports[_0x35fc('0x1')]=function(_0x5a8343,_0x253d6e){return client[_0x35fc('0x2')](_0x35fc('0x3'),{'body':_0x253d6e,'options':{'where':{'id':_0x5a8343}},'log':_0x35fc('0x4')});};exports[_0x35fc('0x5')]=function(_0x5e75e6,_0x2d1404){return client[_0x35fc('0x2')](_0x35fc('0x6'),{'body':_0x2d1404,'options':{'where':{'id':_0x5e75e6}},'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 d15e3be..221b394 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 _0xdcb6=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x9f60ee,_0x4d5758){var _0x5445e8=function(_0x4735c8){while(--_0x4735c8){_0x9f60ee['push'](_0x9f60ee['shift']());}};_0x5445e8(++_0x4d5758);}(_0xdcb6,0x77));var _0x6dcb=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xdcb6[_0x17b6e3];return _0x3906f3;};'use strict';var client=require(_0x6dcb('0x0'));exports[_0x6dcb('0x1')]=function(_0x1361c9){return client[_0x6dcb('0x2')](_0x6dcb('0x3'),{'body':_0x1361c9,'log':_0x6dcb('0x4')});}; \ No newline at end of file +var _0x003b=['../client','create','Request','CreateWhatsappMessage'];(function(_0x58ce05,_0x254f19){var _0x56cd53=function(_0x1f22fe){while(--_0x1f22fe){_0x58ce05['push'](_0x58ce05['shift']());}};_0x56cd53(++_0x254f19);}(_0x003b,0x168));var _0xb003=function(_0x47ff95,_0x1a5472){_0x47ff95=_0x47ff95-0x0;var _0x49b135=_0x003b[_0x47ff95];return _0x49b135;};'use strict';var client=require(_0xb003('0x0'));exports[_0xb003('0x1')]=function(_0x385d8c){return client[_0xb003('0x2')](_0xb003('0x3'),{'body':_0x385d8c,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index aeb7d10..60ae681 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 _0x4a37=['User','Agents','online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','strategy'];(function(_0x4b23ea,_0x2d593a){var _0x104169=function(_0xe0c5a2){while(--_0xe0c5a2){_0x4b23ea['push'](_0x4b23ea['shift']());}};_0x104169(++_0x2d593a);}(_0x4a37,0x12e));var _0x74a3=function(_0x31d65f,_0x20e4c3){_0x31d65f=_0x31d65f-0x0;var _0x5b4cc7=_0x4a37[_0x31d65f];return _0x5b4cc7;};'use strict';var client=require(_0x74a3('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x74a3('0x1')](_0x74a3('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x74a3('0x3')],'include':[{'model':_0x74a3('0x4'),'as':_0x74a3('0x5'),'attributes':['id','name',_0x74a3('0x6'),_0x74a3('0x7')]}]},'log':_0x74a3('0x8')});};}; \ No newline at end of file +var _0x9a9d=['online','getWhatsappQueues','../client','GetWhatsappQueue','User','Agents'];(function(_0x21c622,_0x124272){var _0x4fed92=function(_0x2dfe00){while(--_0x2dfe00){_0x21c622['push'](_0x21c622['shift']());}};_0x4fed92(++_0x124272);}(_0x9a9d,0x7a));var _0xd9a9=function(_0x1e8ffc,_0x3c0c4d){_0x1e8ffc=_0x1e8ffc-0x0;var _0x2b98d1=_0x9a9d[_0x1e8ffc];return _0x2b98d1;};'use strict';var client=require(_0xd9a9('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xd9a9('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xd9a9('0x2'),'as':_0xd9a9('0x3'),'attributes':['id','name',_0xd9a9('0x4'),'whatsappPause']}]},'log':_0xd9a9('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e62b172..84f69bb 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 _0x3dbc=['CreateWhatsappQueueReport','Request','DESC','../client','create'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x3dbc,0x13e));var _0xc3db=function(_0x507965,_0x4944f4){_0x507965=_0x507965-0x0;var _0x3608fc=_0x3dbc[_0x507965];return _0x3608fc;};'use strict';var client=require(_0xc3db('0x0'));exports[_0xc3db('0x1')]=function(_0x40ac0a){return client['Request'](_0xc3db('0x2'),{'body':_0x40ac0a,'log':_0xc3db('0x2')});};exports['update']=function(_0x40ee80,_0x4c13b5){return client[_0xc3db('0x3')]('UpdateWhatsappQueueReport',{'body':_0x4c13b5,'options':{'where':{'uniqueid':_0x40ee80},'order':[['id',_0xc3db('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xf53b=['Request','../client','create','CreateWhatsappQueueReport'];(function(_0x80243c,_0x1c79ae){var _0x4b313e=function(_0x3973ca){while(--_0x3973ca){_0x80243c['push'](_0x80243c['shift']());}};_0x4b313e(++_0x1c79ae);}(_0xf53b,0xd1));var _0xbf53=function(_0x30756f,_0x4d6848){_0x30756f=_0x30756f-0x0;var _0x3942e2=_0xf53b[_0x30756f];return _0x3942e2;};'use strict';var client=require(_0xbf53('0x0'));exports[_0xbf53('0x1')]=function(_0x44f5f9){return client['Request']('CreateWhatsappQueueReport',{'body':_0x44f5f9,'log':_0xbf53('0x2')});};exports['update']=function(_0x51ab1a,_0x5a8e76){return client[_0xbf53('0x3')]('UpdateWhatsappQueueReport',{'body':_0x5a8e76,'options':{'where':{'uniqueid':_0x51ab1a},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 75c2597..65719c2 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 _0x0f94=['timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','join','stop','find','name','START:%s','rules','end','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x9872a6,_0x179192){var _0x17c2de=function(_0x40b2b6){while(--_0x40b2b6){_0x9872a6['push'](_0x9872a6['shift']());}};_0x17c2de(++_0x179192);}(_0x0f94,0x107));var _0x40f9=function(_0x438033,_0x1f39da){_0x438033=_0x438033-0x0;var _0x25583f=_0x0f94[_0x438033];return _0x25583f;};'use strict';var schema=require('validate');var _=require(_0x40f9('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x40f9('0x1'))(_0x40f9('0x2'));var strategy=require(_0x40f9('0x3'));var queue=schema({'name':{'type':_0x40f9('0x4'),'required':!![],'message':_0x40f9('0x5')},'timeout':{'type':_0x40f9('0x6'),'message':_0x40f9('0x7')}});function writeLog(_0xe5f17c,_0x46c14f,_0x5e2e36){return logger[_0x40f9('0x8')](util[_0x40f9('0x9')](_0x40f9('0xa'),_0xe5f17c,_0x46c14f['name'],_0x5e2e36));}function handleFindAgent(_0x4c15ce){return function(_0x364366){return _0x364366['name'][_0x40f9('0xb')]()===_0x4c15ce['toLowerCase']();};}exports['consequence']=function(_0x5d5050,_0xe97d55,_0x508320,_0x1320b0){return function(_0xcc4732){try{var _0xaeac66={'name':_0xe97d55[0x0],'timeout':_0xe97d55[0x1]};var _0x5299d2=queue[_0x40f9('0xc')](_0xaeac66,{'typecast':!![]});if(_0x5299d2[_0x40f9('0xd')]){logger[_0x40f9('0xe')](_0x40f9('0xf'),_0x5d5050,_[_0x40f9('0x10')](_0x5299d2,'message')[_0x40f9('0x11')](',\x20'));_0xcc4732[_0x40f9('0x12')]();}else{var _0x3d6456=_[_0x40f9('0x13')](_0x508320['agents'],handleFindAgent(_0xaeac66[_0x40f9('0x14')]));if(_0x3d6456){var _0x1616de=(_0xaeac66['timeout']||0xa)*0x3e8;var _0x3d31ca,_0x44e295;var _0x387256=seqqueue['createQueue'](_0x1616de);_0x387256['id']=_0x5d5050;_0x387256['atimeout']=_0x1616de;_0x387256['channel']=_0x1320b0['channel'];writeLog(_0x5d5050,_0x3d6456,util[_0x40f9('0x9')](_0x40f9('0x15'),_0x1616de));_0x508320[_0x40f9('0x16')][_0x5d5050]['on'](_0x40f9('0x17'),function(){logger[_0x40f9('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5d5050);clearTimeout(_0x44e295);_0x44e295=undefined;_0x387256[_0x40f9('0x18')]();if(_0x508320['rules'][_0x5d5050]){delete _0x508320[_0x40f9('0x16')][_0x5d5050];}_0xcc4732[_0x40f9('0x12')]();});_0x508320[_0x40f9('0x16')][_0x5d5050]['on']('complete',function(){if(_0x508320[_0x40f9('0x16')][_0x5d5050]){delete _0x508320[_0x40f9('0x16')][_0x5d5050];}});_0x44e295=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x5d5050);clearTimeout(_0x44e295);_0x387256[_0x40f9('0x18')]();_0xcc4732['next']();},_0x1616de);strategy[_0x40f9('0x19')](_0x387256,_0x3d6456,_0x508320,_0x1320b0);}else{logger[_0x40f9('0xe')](_0x40f9('0x1a'),_0x5d5050,_0xaeac66[_0x40f9('0x14')]);_0xcc4732['stop']();}}}catch(_0x2b691b){console[_0x40f9('0x1b')](_0x2b691b);logger[_0x40f9('0xe')](_0x40f9('0x1c'),_0x5d5050,_0x2b691b[_0x40f9('0x1d')]);_0xcc4732[_0x40f9('0x12')]();}};}; \ No newline at end of file +var _0x5d85=['[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','join','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x5d85,0x112));var _0x55d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d85[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x55d8('0x0'));var _=require(_0x55d8('0x1'));var util=require(_0x55d8('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x55d8('0x3'));var strategy=require(_0x55d8('0x4'));var queue=schema({'name':{'type':_0x55d8('0x5'),'required':!![],'message':_0x55d8('0x6')},'timeout':{'type':'number','message':_0x55d8('0x7')}});function writeLog(_0x24f20a,_0x2f440d,_0x5e77d8){return logger[_0x55d8('0x8')](util[_0x55d8('0x9')](_0x55d8('0xa'),_0x24f20a,_0x2f440d[_0x55d8('0xb')],_0x5e77d8));}function handleFindAgent(_0x5f5d95){return function(_0x5bc2b8){return _0x5bc2b8[_0x55d8('0xb')]['toLowerCase']()===_0x5f5d95[_0x55d8('0xc')]();};}exports[_0x55d8('0xd')]=function(_0x53259c,_0x461537,_0x2151a4,_0x7ebafe){return function(_0x2b695a){try{var _0xa8b56c={'name':_0x461537[0x0],'timeout':_0x461537[0x1]};var _0x410c7c=queue[_0x55d8('0x0')](_0xa8b56c,{'typecast':!![]});if(_0x410c7c[_0x55d8('0xe')]){logger[_0x55d8('0xf')](_0x55d8('0x10'),_0x53259c,_['map'](_0x410c7c,'message')[_0x55d8('0x11')](',\x20'));_0x2b695a['stop']();}else{var _0x5c34f9=_[_0x55d8('0x12')](_0x2151a4[_0x55d8('0x13')],handleFindAgent(_0xa8b56c[_0x55d8('0xb')]));if(_0x5c34f9){var _0x3002=(_0xa8b56c[_0x55d8('0x14')]||0xa)*0x3e8;var _0x4d8ae2,_0x4b69cf;var _0x2f12f7=seqqueue[_0x55d8('0x15')](_0x3002);_0x2f12f7['id']=_0x53259c;_0x2f12f7[_0x55d8('0x16')]=_0x3002;_0x2f12f7[_0x55d8('0x17')]=_0x7ebafe[_0x55d8('0x17')];writeLog(_0x53259c,_0x5c34f9,util[_0x55d8('0x9')](_0x55d8('0x18'),_0x3002));_0x2151a4[_0x55d8('0x19')][_0x53259c]['on'](_0x55d8('0x1a'),function(){logger['info'](_0x55d8('0x1b'),_0x53259c);clearTimeout(_0x4b69cf);_0x4b69cf=undefined;_0x2f12f7[_0x55d8('0x1c')]();if(_0x2151a4[_0x55d8('0x19')][_0x53259c]){delete _0x2151a4['rules'][_0x53259c];}_0x2b695a['stop']();});_0x2151a4[_0x55d8('0x19')][_0x53259c]['on'](_0x55d8('0x1d'),function(){if(_0x2151a4['rules'][_0x53259c]){delete _0x2151a4[_0x55d8('0x19')][_0x53259c];}});_0x4b69cf=setTimeout(function(){logger['info'](_0x55d8('0x1e'),_0x53259c);clearTimeout(_0x4b69cf);_0x2f12f7[_0x55d8('0x1c')]();_0x2b695a[_0x55d8('0x1f')]();},_0x3002);strategy[_0x55d8('0x20')](_0x2f12f7,_0x5c34f9,_0x2151a4,_0x7ebafe);}else{logger['error'](_0x55d8('0x21'),_0x53259c,_0xa8b56c[_0x55d8('0xb')]);_0x2b695a[_0x55d8('0x22')]();}}}catch(_0x2e31ea){console[_0x55d8('0x23')](_0x2e31ea);logger[_0x55d8('0xf')](_0x55d8('0x24'),_0x53259c,_0x2e31ea[_0x55d8('0x25')]);_0x2b695a[_0x55d8('0x22')]();}};}; \ 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 61a93d6..574e629 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 _0x6f22=['then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','providerName','amazonlex','providerResponse','dialogState','Failed','stop','error','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create'];(function(_0x27054f,_0x457a4d){var _0x15bc6c=function(_0x42db85){while(--_0x42db85){_0x27054f['push'](_0x27054f['shift']());}};_0x15bc6c(++_0x457a4d);}(_0x6f22,0x124));var _0x26f2=function(_0x3a3731,_0x2d573a){_0x3a3731=_0x3a3731-0x0;var _0x23ee93=_0x6f22[_0x3a3731];return _0x23ee93;};'use strict';var _=require('lodash');var moment=require(_0x26f2('0x0'));var AWS=require(_0x26f2('0x1'));var utils=require('./utils');var logger=require(_0x26f2('0x2'))(_0x26f2('0x3'));var rpc={'chatMessage':require(_0x26f2('0x4')),'openchannelMessage':require(_0x26f2('0x5')),'mailMessage':require(_0x26f2('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x26f2('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x26f2('0x8')]=function(_0x177efb,_0x54b2e4){return function(_0x40b715){try{if(!_[_0x26f2('0x9')](this[_0x26f2('0xa')][_0x26f2('0xb')])){logger[_0x26f2('0xc')](_0x26f2('0xd'),_0x177efb,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x40b715[_0x26f2('0xe')]();}var _0x32724d={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x26f2('0xf')),'direction':'out'};if(this[_0x26f2('0x10')]==='sms'||this[_0x26f2('0x10')]===_0x26f2('0x11')){_0x32724d[_0x26f2('0x12')]=this[_0x26f2('0xa')][_0x26f2('0x12')];}var _0x33b689=this[_0x26f2('0x10')];if(_0x33b689==='chat'){_0x32724d[_0x26f2('0x13')]=this['account']['id'];}else{_0x32724d[_[_0x26f2('0x14')](_0x33b689)+_0x26f2('0x15')]=this[_0x26f2('0x16')]['id'];}_0x32724d[_[_0x26f2('0x14')](_0x33b689)+_0x26f2('0x17')]=this[_0x26f2('0xa')]['id'];if(this[_0x26f2('0xa')][_0x26f2('0x18')]){var _0x489099=_0x54b2e4[0x4];if(!_[_0x26f2('0x19')](_0x489099)){_0x32724d[_0x26f2('0x1a')]=utils[_0x26f2('0x1b')](_0x489099,this);return rpc[_0x33b689+_0x26f2('0x1c')][_0x26f2('0x1d')](_0x32724d)[_0x26f2('0x1e')](function(_0x22da62){logger[_0x26f2('0xc')](_0x26f2('0xd'),_0x177efb,_0x32724d['body']);})[_0x26f2('0x1f')](function(_0x34cc4e){logger['error'](_0x26f2('0xd'),_0x177efb,JSON[_0x26f2('0x20')](_0x34cc4e));})['finally'](function(){logger['info'](_0x26f2('0x21'),_0x177efb);_0x40b715['stop']();});}else{logger[_0x26f2('0xc')](_0x26f2('0x22'),_0x177efb);_0x40b715['stop']();}}else{var _0x553425=this;var _0x4f5c3e=new AWS[(_0x26f2('0x23'))]({'accessKeyId':_0x54b2e4[0x0],'secretAccessKey':_0x54b2e4[0x1],'region':_0x54b2e4[0x2]});var _0x3cba67={'botAlias':'$LATEST','botName':_0x54b2e4[0x3],'inputText':this['message']['body'],'userId':this[_0x26f2('0x10')]+':'+this['interaction']['id'][_0x26f2('0x24')]()};_0x4f5c3e[_0x26f2('0x25')](_0x3cba67,function(_0x42eff2,_0x4a4b7c){if(_0x42eff2){logger['error'](_0x26f2('0xd'),_0x177efb,_0x42eff2[_0x26f2('0x26')]);_0x40b715['next']();}else if(_0x4a4b7c&&_0x4a4b7c[_0x26f2('0x26')]){_0x553425['body']['amazonlex']=_0x4a4b7c;_0x32724d[_0x26f2('0x1a')]=_0x4a4b7c[_0x26f2('0x26')];_0x32724d[_0x26f2('0x27')]=_0x26f2('0x28');_0x32724d[_0x26f2('0x29')]=JSON['stringify'](_0x4a4b7c);return rpc[_0x33b689+_0x26f2('0x1c')]['create'](_0x32724d)[_0x26f2('0x1e')](function(_0x1fbdb6){logger['info'](_0x26f2('0xd'),_0x177efb,_0x32724d[_0x26f2('0x1a')]);if(_0x4a4b7c[_0x26f2('0x2a')]==_0x26f2('0x2b')){_0x40b715[_0x26f2('0xe')]();}else{_0x40b715[_0x26f2('0x2c')]();}})[_0x26f2('0x1f')](function(_0x2bef6f){logger[_0x26f2('0x2d')](_0x26f2('0xd'),_0x177efb,JSON[_0x26f2('0x20')](_0x2bef6f));_0x40b715[_0x26f2('0xe')]();});}else{_0x40b715[_0x26f2('0xe')]();}});}}catch(_0x5e1aed){logger[_0x26f2('0x2d')](_0x26f2('0xd'),_0x177efb,JSON[_0x26f2('0x20')](_0x5e1aed));_0x40b715[_0x26f2('0x2c')]();}};}; \ No newline at end of file +var _0x61c5=['moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','isEmpty','body','getMustacheRender','[%s][AMAZONLEX]\x20%s','catch','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','error','amazonlex','providerResponse','stringify','Message','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61c5,0x1c2));var _0x561c=function(_0x5c12ae,_0x29ab56){_0x5c12ae=_0x5c12ae-0x0;var _0x6b60d1=_0x61c5[_0x5c12ae];return _0x6b60d1;};'use strict';var _=require('lodash');var moment=require(_0x561c('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x561c('0x1'))(_0x561c('0x2'));var rpc={'chatMessage':require(_0x561c('0x3')),'openchannelMessage':require(_0x561c('0x4')),'mailMessage':require(_0x561c('0x5')),'smsMessage':require(_0x561c('0x6')),'faxMessage':require(_0x561c('0x7')),'whatsappMessage':require(_0x561c('0x8'))};exports[_0x561c('0x9')]=function(_0x43059b,_0x4d4f4b){return function(_0x29e712){try{if(!_[_0x561c('0xa')](this[_0x561c('0xb')][_0x561c('0xc')])){logger[_0x561c('0xd')]('[%s][AMAZONLEX]\x20%s',_0x43059b,_0x561c('0xe'));return _0x29e712[_0x561c('0xf')]();}var _0x2164a5={'ContactId':this['contact']['id'],'sentAt':moment()[_0x561c('0x10')](_0x561c('0x11')),'direction':_0x561c('0x12')};if(this['channel']===_0x561c('0x13')||this[_0x561c('0x14')]===_0x561c('0x15')){_0x2164a5[_0x561c('0x16')]=this[_0x561c('0xb')][_0x561c('0x16')];}var _0x130e3d=this[_0x561c('0x14')];if(_0x130e3d===_0x561c('0x17')){_0x2164a5[_0x561c('0x18')]=this[_0x561c('0x19')]['id'];}else{_0x2164a5[_['upperFirst'](_0x130e3d)+_0x561c('0x1a')]=this[_0x561c('0x19')]['id'];}_0x2164a5[_[_0x561c('0x1b')](_0x130e3d)+'InteractionId']=this['interaction']['id'];if(this['interaction']['created']){var _0x532bb5=_0x4d4f4b[0x4];if(!_[_0x561c('0x1c')](_0x532bb5)){_0x2164a5[_0x561c('0x1d')]=utils[_0x561c('0x1e')](_0x532bb5,this);return rpc[_0x130e3d+'Message']['create'](_0x2164a5)['then'](function(_0x15321c){logger['info'](_0x561c('0x1f'),_0x43059b,_0x2164a5['body']);})[_0x561c('0x20')](function(_0x513da6){logger['error'](_0x561c('0x1f'),_0x43059b,JSON['stringify'](_0x513da6));})[_0x561c('0x21')](function(){logger[_0x561c('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x43059b);_0x29e712[_0x561c('0x22')]();});}else{logger['info'](_0x561c('0x23'),_0x43059b);_0x29e712[_0x561c('0x22')]();}}else{var _0x5a1b12=this;var _0x46652e=new AWS['LexRuntime']({'accessKeyId':_0x4d4f4b[0x0],'secretAccessKey':_0x4d4f4b[0x1],'region':_0x4d4f4b[0x2]});var _0x39a54c={'botAlias':_0x561c('0x24'),'botName':_0x4d4f4b[0x3],'inputText':this[_0x561c('0x25')][_0x561c('0x1d')],'userId':this[_0x561c('0x14')]+':'+this[_0x561c('0xb')]['id'][_0x561c('0x26')]()};_0x46652e['postText'](_0x39a54c,function(_0xe26bff,_0x37909e){if(_0xe26bff){logger[_0x561c('0x27')](_0x561c('0x1f'),_0x43059b,_0xe26bff['message']);_0x29e712[_0x561c('0xf')]();}else if(_0x37909e&&_0x37909e[_0x561c('0x25')]){_0x5a1b12[_0x561c('0x1d')][_0x561c('0x28')]=_0x37909e;_0x2164a5[_0x561c('0x1d')]=_0x37909e[_0x561c('0x25')];_0x2164a5['providerName']='amazonlex';_0x2164a5[_0x561c('0x29')]=JSON[_0x561c('0x2a')](_0x37909e);return rpc[_0x130e3d+_0x561c('0x2b')]['create'](_0x2164a5)[_0x561c('0x2c')](function(_0x152091){logger[_0x561c('0xd')](_0x561c('0x1f'),_0x43059b,_0x2164a5['body']);if(_0x37909e['dialogState']=='Failed'){_0x29e712[_0x561c('0xf')]();}else{_0x29e712[_0x561c('0x22')]();}})[_0x561c('0x20')](function(_0x581edf){logger['error']('[%s][AMAZONLEX]\x20%s',_0x43059b,JSON[_0x561c('0x2a')](_0x581edf));_0x29e712[_0x561c('0xf')]();});}else{_0x29e712['next']();}});}}catch(_0x217b38){logger['error'](_0x561c('0x1f'),_0x43059b,JSON[_0x561c('0x2a')](_0x217b38));_0x29e712['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 52ec815..3e3b9c8 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 _0x7d2e=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','info','[%s][AUTOREPLY]\x20%s','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','Message','create','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','Interaction','update','catch','finally','stop','moment','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction'];(function(_0x3ec203,_0x4d6848){var _0x317595=function(_0xa0d92e){while(--_0xa0d92e){_0x3ec203['push'](_0x3ec203['shift']());}};_0x317595(++_0x4d6848);}(_0x7d2e,0x79));var _0xe7d2=function(_0x5c81d1,_0x3e1d94){_0x5c81d1=_0x5c81d1-0x0;var _0x275777=_0x7d2e[_0x5c81d1];return _0x275777;};'use strict';var _=require('lodash');var moment=require(_0xe7d2('0x0'));var utils=require(_0xe7d2('0x1'));var logger=require(_0xe7d2('0x2'))(_0xe7d2('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe7d2('0x4')),'smsMessage':require(_0xe7d2('0x5')),'faxMessage':require(_0xe7d2('0x6')),'whatsappMessage':require(_0xe7d2('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xe7d2('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xe7d2('0x9')),'faxInteraction':require(_0xe7d2('0xa')),'whatsappInteraction':require(_0xe7d2('0xb'))};var mailRpc=require(_0xe7d2('0xc'));exports['consequence']=function(_0x25ad6c,_0xa30c3e,_0x249a51,_0x2d3bd7){return function(_0x1002a6){try{var _0x55e1e7=this['channel'];if(_0x55e1e7===_0xe7d2('0xd')&&_0x2d3bd7['body']['isAutoreply']){logger[_0xe7d2('0xe')](_0xe7d2('0xf'),_0x25ad6c,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1002a6[_0xe7d2('0x10')]();}if(_0xa30c3e[0x0]==='1'&&(_[_0xe7d2('0x11')](this['interaction'][_0xe7d2('0x12')])||!this[_0xe7d2('0x13')][_0xe7d2('0x12')])){logger['info'](_0xe7d2('0xf'),_0x25ad6c,_0xe7d2('0x14'));return _0x1002a6['next']();}if(_0xa30c3e[0x0]==='2'&&this['interaction'][_0xe7d2('0x15')]){logger[_0xe7d2('0xe')](_0xe7d2('0x16'),_0x25ad6c,_0xe7d2('0x17'));return _0x1002a6[_0xe7d2('0x10')]();}var _0x4165c1={'ContactId':this[_0xe7d2('0x18')]['id'],'sentAt':moment()[_0xe7d2('0x19')](_0xe7d2('0x1a')),'direction':_0xe7d2('0x1b')};if(this[_0xe7d2('0x1c')]===_0xe7d2('0xd')){_0x4165c1[_0xe7d2('0x1d')]=utils[_0xe7d2('0x1e')](_0xa30c3e[0x2],this);}else{_0x4165c1['body']=utils['getMustacheRender'](_0xa30c3e[0x1],this);}if(this[_0xe7d2('0x1f')]){_0x4165c1['to']=this['message']['from']||'';if(this[_0xe7d2('0x1c')]==='mail'&&_0xa30c3e[0x1]==='1'){_0x4165c1['cc']=this[_0xe7d2('0x1f')]['cc']||'';}_0x4165c1['from']=this[_0xe7d2('0x1f')]['to']||'';_0x4165c1['phone']=this[_0xe7d2('0x1f')][_0xe7d2('0x20')]||'';_0x4165c1[_0xe7d2('0x21')]=!![];if(this[_0xe7d2('0x1f')][_0xe7d2('0x22')]){_0x4165c1[_0xe7d2('0x22')]='';_0x4165c1[_0xe7d2('0x22')]+=_[_0xe7d2('0x23')](this[_0xe7d2('0x1f')][_0xe7d2('0x22')],_0xe7d2('0x24'))?'':_0xe7d2('0x25');_0x4165c1[_0xe7d2('0x22')]+=this[_0xe7d2('0x1f')][_0xe7d2('0x22')];}}if(this['channel']===_0xe7d2('0x26')){_0x4165c1[_0xe7d2('0x27')]=this[_0xe7d2('0x28')]['id'];}else{_0x4165c1[_[_0xe7d2('0x29')](this[_0xe7d2('0x1c')])+_0xe7d2('0x2a')]=this['account']['id'];}_0x4165c1[_[_0xe7d2('0x29')](this[_0xe7d2('0x1c')])+_0xe7d2('0x2b')]=this[_0xe7d2('0x13')]['id'];var _0x1d07c7=this['interaction'];if(rpc[this['channel']+'Message']){if(this[_0xe7d2('0x1c')]===_0xe7d2('0xd')){_0x4165c1['inReplyTo']=this['message'][_0xe7d2('0x2c')];_0x4165c1[_0xe7d2('0x2d')]=_0xe7d2('0x2e')+_[_0xe7d2('0x2f')](_0x4165c1[_0xe7d2('0x1d')],'','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','stringify','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','account','upperFirst'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xa711,0x1cb));var _0x1a71=function(_0x44a3a0,_0x124608){_0x44a3a0=_0x44a3a0-0x0;var _0x43d29e=_0xa711[_0x44a3a0];return _0x43d29e;};'use strict';var _=require(_0x1a71('0x0'));var moment=require(_0x1a71('0x1'));var utils=require(_0x1a71('0x2'));var logger=require(_0x1a71('0x3'))(_0x1a71('0x4'));var rpc={'chatMessage':require(_0x1a71('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1a71('0x6')),'chatInteraction':require(_0x1a71('0x7')),'openchannelInteraction':require(_0x1a71('0x8')),'mailInteraction':require(_0x1a71('0x9')),'smsInteraction':require(_0x1a71('0xa')),'faxInteraction':require(_0x1a71('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x1a71('0xc'));exports['consequence']=function(_0x586e61,_0x2e8c33,_0x5efca1,_0x1d8224){return function(_0x1423a7){try{var _0x32fd8a=this[_0x1a71('0xd')];if(_0x32fd8a===_0x1a71('0xe')&&_0x1d8224[_0x1a71('0xf')][_0x1a71('0x10')]){logger[_0x1a71('0x11')](_0x1a71('0x12'),_0x586e61,_0x1a71('0x13'));return _0x1423a7[_0x1a71('0x14')]();}if(_0x2e8c33[0x0]==='1'&&(_[_0x1a71('0x15')](this['interaction'][_0x1a71('0x16')])||!this['interaction'][_0x1a71('0x16')])){logger['info'](_0x1a71('0x12'),_0x586e61,'Autoreply\x20already\x20sent');return _0x1423a7[_0x1a71('0x14')]();}if(_0x2e8c33[0x0]==='2'&&this[_0x1a71('0x17')]['autoreplyExecuted']){logger['info'](_0x1a71('0x18'),_0x586e61,_0x1a71('0x19'));return _0x1423a7[_0x1a71('0x14')]();}var _0x52b990={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1a71('0x1a')};if(this['channel']===_0x1a71('0xe')){_0x52b990[_0x1a71('0xf')]=utils[_0x1a71('0x1b')](_0x2e8c33[0x2],this);}else{_0x52b990[_0x1a71('0xf')]=utils[_0x1a71('0x1b')](_0x2e8c33[0x1],this);}if(this[_0x1a71('0x1c')]){_0x52b990['to']=this['message'][_0x1a71('0x1d')]||'';if(this[_0x1a71('0xd')]===_0x1a71('0xe')&&_0x2e8c33[0x1]==='1'){_0x52b990['cc']=this['message']['cc']||'';}_0x52b990[_0x1a71('0x1d')]=this[_0x1a71('0x1c')]['to']||'';_0x52b990[_0x1a71('0x1e')]=this[_0x1a71('0x1c')][_0x1a71('0x1e')]||'';_0x52b990[_0x1a71('0x1f')]=!![];if(this[_0x1a71('0x1c')][_0x1a71('0x20')]){_0x52b990[_0x1a71('0x20')]='';_0x52b990['subject']+=_[_0x1a71('0x21')](this[_0x1a71('0x1c')][_0x1a71('0x20')],'Re:')?'':_0x1a71('0x22');_0x52b990[_0x1a71('0x20')]+=this[_0x1a71('0x1c')][_0x1a71('0x20')];}}if(this[_0x1a71('0xd')]==='chat'){_0x52b990['ChatWebsiteId']=this[_0x1a71('0x23')]['id'];}else{_0x52b990[_[_0x1a71('0x24')](this[_0x1a71('0xd')])+'AccountId']=this['account']['id'];}_0x52b990[_[_0x1a71('0x24')](this[_0x1a71('0xd')])+'InteractionId']=this['interaction']['id'];var _0x2ee5a5=this[_0x1a71('0x17')];if(rpc[this['channel']+_0x1a71('0x25')]){if(this[_0x1a71('0xd')]===_0x1a71('0xe')){_0x52b990['inReplyTo']=this[_0x1a71('0x1c')][_0x1a71('0x26')];_0x52b990['html']=''+_[_0x1a71('0x27')](_0x52b990[_0x1a71('0xf')],_0x1a71('0x28'),_0x1a71('0x29'))+_0x1a71('0x2a');_0x52b990[_0x1a71('0x2b')]={'Auto-Submitted':_0x1a71('0x2c'),'X-Auto-Response-Suppress':_0x1a71('0x2d'),'Precedence':_0x1a71('0x2e')};return mailRpc[_0x1a71('0x2f')](this['account'][_0x1a71('0x30')],_0x52b990)[_0x1a71('0x31')](function(_0x145fe8){logger[_0x1a71('0x11')](_0x1a71('0x32'),_0x586e61);_0x52b990[_0x1a71('0x26')]=_0x145fe8[_0x1a71('0x1c')][_0x1a71('0x26')];return rpc[_0x32fd8a+_0x1a71('0x25')]['create'](_0x52b990);})['then'](function(_0x32bb18){logger['info']('[%s][AUTOREPLY]\x20%s',_0x586e61,JSON['stringify'](_0x32bb18));})['catch'](function(_0x4df2fb){logger[_0x1a71('0x33')](_0x1a71('0x34'),_0x586e61,JSON['stringify'](_0x4df2fb));})[_0x1a71('0x35')](function(){Promise[_0x1a71('0x36')]()[_0x1a71('0x31')](function(){if(_0x2e8c33[0x0]!=='2'||_0x2ee5a5[_0x1a71('0x37')])return;return rpc[_0x32fd8a+_0x1a71('0x38')][_0x1a71('0x39')](_0x2ee5a5['id'],{'autoreplyExecuted':!![]})[_0x1a71('0x31')](function(_0x22e0e1){logger[_0x1a71('0x11')](_0x1a71('0x18'),_0x586e61,JSON[_0x1a71('0x3a')](_0x22e0e1));})['catch'](function(_0x2b5ef9){logger[_0x1a71('0x33')](_0x1a71('0x3b'),_0x586e61,JSON[_0x1a71('0x3a')](_0x2b5ef9));});})[_0x1a71('0x31')](function(){_0x1423a7[_0x1a71('0x14')]();});});}else{return rpc[this[_0x1a71('0xd')]+_0x1a71('0x25')][_0x1a71('0x3c')](_0x52b990)['then'](function(){logger[_0x1a71('0x11')](_0x1a71('0x12'),_0x586e61,_0x52b990[_0x1a71('0xf')]);})[_0x1a71('0x3d')](function(_0x4f2599){logger[_0x1a71('0x33')](_0x1a71('0x12'),_0x586e61,JSON[_0x1a71('0x3a')](_0x4f2599));})[_0x1a71('0x35')](function(){Promise[_0x1a71('0x36')]()[_0x1a71('0x31')](function(){if(_0x2e8c33[0x0]!=='2'||_0x2ee5a5[_0x1a71('0x37')])return;return rpc[_0x32fd8a+'Interaction'][_0x1a71('0x39')](_0x2ee5a5['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3606de){logger[_0x1a71('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x586e61,JSON['stringify'](_0x3606de));})[_0x1a71('0x3d')](function(_0xf9e854){logger[_0x1a71('0x33')](_0x1a71('0x3b'),_0x586e61,JSON['stringify'](_0xf9e854));});})['then'](function(){_0x1423a7[_0x1a71('0x14')]();});});}}}catch(_0x48f0d6){logger[_0x1a71('0x33')](_0x1a71('0x12'),_0x586e61,JSON[_0x1a71('0x3a')](_0x48f0d6));_0x1423a7['stop']();}};}; \ 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 1ce84f4..3d3da39 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 _0x357c=['stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x357c,0x10b));var _0xc357=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x357c[_0x361d3f];return _0x320229;};'use strict';var moment=require(_0xc357('0x0'));var logger=require(_0xc357('0x1'))(_0xc357('0x2'));var rpc={'chatInteraction':require(_0xc357('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc357('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xc357('0x5')),'whatsappInteraction':require(_0xc357('0x6'))};exports[_0xc357('0x7')]=function(_0x308805,_0x458522,_0x1b73b0,_0x26467e){return function(_0x424941){try{logger['info'](_0xc357('0x8'),_0x308805,_0x458522[0x0]);var _0x30130c={'closed':0x1,'closedAt':moment()[_0xc357('0x9')](_0xc357('0xa')),'closeReason':_0xc357('0xb'),'disposition':_0x458522[0x0]};if(rpc[_0x26467e[_0xc357('0xc')]+_0xc357('0xd')]){rpc[_0x26467e['channel']+'Interaction'][_0xc357('0xe')](_0x26467e[_0xc357('0xf')]['id'],_0x30130c)['then'](function(_0x3d316d){logger[_0xc357('0x10')](_0xc357('0x11'),_0x308805,_0x26467e[_0xc357('0xf')]['id']);})[_0xc357('0x12')](function(_0x24d8c6){logger[_0xc357('0x13')](_0xc357('0x14'),_0x308805,JSON[_0xc357('0x15')](_0x24d8c6));})[_0xc357('0x16')](function(){_0x424941[_0xc357('0x17')]();});}}catch(_0x3a3f81){logger[_0xc357('0x13')](_0xc357('0x14'),_0x308805,JSON[_0xc357('0x15')](_0x3a3f81));_0x424941['stop']();}};}; \ No newline at end of file +var _0x17e7=['system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x17e7,0x197));var _0x717e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x17e7[_0x30ae5e];return _0x1f2e93;};'use strict';var moment=require('moment');var logger=require(_0x717e('0x0'))('routing');var rpc={'chatInteraction':require(_0x717e('0x1')),'openchannelInteraction':require(_0x717e('0x2')),'smsInteraction':require(_0x717e('0x3')),'mailInteraction':require(_0x717e('0x4')),'faxInteraction':require(_0x717e('0x5')),'whatsappInteraction':require(_0x717e('0x6'))};exports[_0x717e('0x7')]=function(_0x19e0b5,_0x2aaeb2,_0x1e74a6,_0x3689a4){return function(_0x53aa64){try{logger[_0x717e('0x8')](_0x717e('0x9'),_0x19e0b5,_0x2aaeb2[0x0]);var _0x22b7a3={'closed':0x1,'closedAt':moment()['format'](_0x717e('0xa')),'closeReason':_0x717e('0xb'),'disposition':_0x2aaeb2[0x0]};if(rpc[_0x3689a4['channel']+'Interaction']){rpc[_0x3689a4[_0x717e('0xc')]+_0x717e('0xd')]['update'](_0x3689a4[_0x717e('0xe')]['id'],_0x22b7a3)[_0x717e('0xf')](function(_0x4a3ec1){logger['info'](_0x717e('0x10'),_0x19e0b5,_0x3689a4[_0x717e('0xe')]['id']);})[_0x717e('0x11')](function(_0x2595ac){logger['error'](_0x717e('0x12'),_0x19e0b5,JSON[_0x717e('0x13')](_0x2595ac));})[_0x717e('0x14')](function(){_0x53aa64[_0x717e('0x15')]();});}}catch(_0x1e7ba0){logger['error']('[%s][CLOSE]\x20%s',_0x19e0b5,JSON[_0x717e('0x13')](_0x1e7ba0));_0x53aa64[_0x717e('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 229da42..23a4537 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 _0xab36=['whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','[%s][DIALOGFLOW]\x20%s','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','stringify','create','endConversation','stop','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x3291d5,_0x3e0003){var _0x3ebc9f=function(_0x229c9a){while(--_0x229c9a){_0x3291d5['push'](_0x3291d5['shift']());}};_0x3ebc9f(++_0x3e0003);}(_0xab36,0x1df));var _0x6ab3=function(_0x3674b,_0x4576ef){_0x3674b=_0x3674b-0x0;var _0x1a1e77=_0xab36[_0x3674b];return _0x1a1e77;};'use strict';var _=require(_0x6ab3('0x0'));var moment=require(_0x6ab3('0x1'));var apiai=require(_0x6ab3('0x2'));var md5=require(_0x6ab3('0x3'));var utils=require(_0x6ab3('0x4'));var logger=require('../../../../config/logger')(_0x6ab3('0x5'));var rpc={'chatMessage':require(_0x6ab3('0x6')),'openchannelMessage':require(_0x6ab3('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6ab3('0x8')),'faxMessage':require(_0x6ab3('0x9')),'whatsappMessage':require(_0x6ab3('0xa'))};exports[_0x6ab3('0xb')]=function(_0x33fc2a,_0x416eb2){return function(_0x4ba5e3){try{if(!_[_0x6ab3('0xc')](this[_0x6ab3('0xd')]['UserId'])){logger[_0x6ab3('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x33fc2a,_0x6ab3('0xf'));return _0x4ba5e3[_0x6ab3('0x10')]();}var _0x50c276={'ContactId':this[_0x6ab3('0x11')]['id'],'sentAt':moment()[_0x6ab3('0x12')](_0x6ab3('0x13')),'direction':'out'};if(this[_0x6ab3('0x14')]==='sms'||this[_0x6ab3('0x14')]===_0x6ab3('0x15')){_0x50c276[_0x6ab3('0x16')]=this[_0x6ab3('0xd')][_0x6ab3('0x16')];}var _0x494c44=this[_0x6ab3('0x14')];if(_0x494c44===_0x6ab3('0x17')){_0x50c276[_0x6ab3('0x18')]=this[_0x6ab3('0x19')]['id'];}else{_0x50c276[_[_0x6ab3('0x1a')](_0x494c44)+'AccountId']=this[_0x6ab3('0x19')]['id'];}_0x50c276[_['upperFirst'](_0x494c44)+_0x6ab3('0x1b')]=this[_0x6ab3('0xd')]['id'];if(this[_0x6ab3('0xd')][_0x6ab3('0x1c')]){var _0x178a42=_0x416eb2[0x2];if(!_[_0x6ab3('0x1d')](_0x178a42)){_0x50c276[_0x6ab3('0x1e')]=utils[_0x6ab3('0x1f')](_0x178a42,this);return rpc[_0x494c44+_0x6ab3('0x20')]['create'](_0x50c276)[_0x6ab3('0x21')](function(_0x5db46c){logger[_0x6ab3('0xe')](_0x6ab3('0x22'),_0x33fc2a,_0x50c276[_0x6ab3('0x1e')]);})[_0x6ab3('0x23')](function(_0x555c80){logger[_0x6ab3('0x24')](_0x6ab3('0x22'),_0x33fc2a,JSON['stringify'](_0x555c80));})[_0x6ab3('0x25')](function(){logger[_0x6ab3('0xe')](_0x6ab3('0x26'),_0x33fc2a);_0x4ba5e3['stop']();});}else{logger[_0x6ab3('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x33fc2a);_0x4ba5e3['stop']();}}else{var _0x1ac3c6=this;var _0x4e6680=apiai(_0x416eb2[0x0],{'language':_0x416eb2[0x1]||'en'});return _0x4e6680[_0x6ab3('0x27')](this[_0x6ab3('0x28')][_0x6ab3('0x1e')],{'sessionId':md5(this[_0x6ab3('0xd')]['id'])})[_0x6ab3('0x21')](function(_0x30af9e){_0x1ac3c6[_0x6ab3('0x1e')][_0x6ab3('0x29')]=_0x30af9e;_0x50c276[_0x6ab3('0x1e')]=_0x30af9e[_0x6ab3('0x2a')][_0x6ab3('0x2b')][_0x6ab3('0x2c')];_0x50c276[_0x6ab3('0x2d')]=_0x6ab3('0x29');_0x50c276['providerResponse']=JSON[_0x6ab3('0x2e')](_0x30af9e);return rpc[_0x494c44+'Message'][_0x6ab3('0x2f')](_0x50c276)[_0x6ab3('0x21')](function(_0x21b404){logger[_0x6ab3('0xe')](_0x6ab3('0x22'),_0x33fc2a,_0x50c276[_0x6ab3('0x1e')]);if(_0x30af9e['result']['metadata'][_0x6ab3('0x30')]){_0x4ba5e3['next']();}else{_0x4ba5e3['stop']();}})[_0x6ab3('0x23')](function(_0x4001fe){logger[_0x6ab3('0x24')](_0x6ab3('0x22'),_0x33fc2a,JSON[_0x6ab3('0x2e')](_0x4001fe));_0x4ba5e3[_0x6ab3('0x10')]();});})[_0x6ab3('0x23')](function(_0x376e4f){logger['error'](_0x6ab3('0x22'),_0x33fc2a,_0x376e4f[_0x6ab3('0x28')]);_0x4ba5e3[_0x6ab3('0x10')]();});}}catch(_0x2e9f1f){logger[_0x6ab3('0x24')](_0x6ab3('0x22'),_0x33fc2a,JSON[_0x6ab3('0x2e')](_0x2e9f1f));_0x4ba5e3[_0x6ab3('0x31')]();}};}; \ No newline at end of file +var _0x2b29=['body','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','endConversation','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId'];(function(_0x5e5674,_0x582f93){var _0x26d2d8=function(_0x3ccd47){while(--_0x3ccd47){_0x5e5674['push'](_0x5e5674['shift']());}};_0x26d2d8(++_0x582f93);}(_0x2b29,0x163));var _0x92b2=function(_0x179fa1,_0x22a248){_0x179fa1=_0x179fa1-0x0;var _0x23539d=_0x2b29[_0x179fa1];return _0x23539d;};'use strict';var _=require('lodash');var moment=require(_0x92b2('0x0'));var apiai=require(_0x92b2('0x1'));var md5=require(_0x92b2('0x2'));var utils=require(_0x92b2('0x3'));var logger=require('../../../../config/logger')(_0x92b2('0x4'));var rpc={'chatMessage':require(_0x92b2('0x5')),'openchannelMessage':require(_0x92b2('0x6')),'mailMessage':require(_0x92b2('0x7')),'smsMessage':require(_0x92b2('0x8')),'faxMessage':require(_0x92b2('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x92b2('0xa')]=function(_0x536e21,_0x29f183){return function(_0x43a292){try{if(!_['isNil'](this[_0x92b2('0xb')][_0x92b2('0xc')])){logger[_0x92b2('0xd')](_0x92b2('0xe'),_0x536e21,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x43a292[_0x92b2('0xf')]();}var _0x21bbf5={'ContactId':this[_0x92b2('0x10')]['id'],'sentAt':moment()[_0x92b2('0x11')](_0x92b2('0x12')),'direction':_0x92b2('0x13')};if(this[_0x92b2('0x14')]==='sms'||this[_0x92b2('0x14')]===_0x92b2('0x15')){_0x21bbf5[_0x92b2('0x16')]=this['interaction'][_0x92b2('0x16')];}var _0x3e5309=this[_0x92b2('0x14')];if(_0x3e5309===_0x92b2('0x17')){_0x21bbf5[_0x92b2('0x18')]=this[_0x92b2('0x19')]['id'];}else{_0x21bbf5[_['upperFirst'](_0x3e5309)+_0x92b2('0x1a')]=this['account']['id'];}_0x21bbf5[_[_0x92b2('0x1b')](_0x3e5309)+_0x92b2('0x1c')]=this[_0x92b2('0xb')]['id'];if(this['interaction']['created']){var _0xbb9cef=_0x29f183[0x2];if(!_['isEmpty'](_0xbb9cef)){_0x21bbf5[_0x92b2('0x1d')]=utils['getMustacheRender'](_0xbb9cef,this);return rpc[_0x3e5309+_0x92b2('0x1e')][_0x92b2('0x1f')](_0x21bbf5)[_0x92b2('0x20')](function(_0xceaa2f){logger[_0x92b2('0xd')](_0x92b2('0xe'),_0x536e21,_0x21bbf5[_0x92b2('0x1d')]);})[_0x92b2('0x21')](function(_0x21bc07){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,JSON[_0x92b2('0x23')](_0x21bc07));})[_0x92b2('0x24')](function(){logger[_0x92b2('0xd')](_0x92b2('0x25'),_0x536e21);_0x43a292['stop']();});}else{logger[_0x92b2('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x536e21);_0x43a292[_0x92b2('0x26')]();}}else{var _0xe6f05f=this;var _0x2b372c=apiai(_0x29f183[0x0],{'language':_0x29f183[0x1]||'en'});return _0x2b372c[_0x92b2('0x27')](this[_0x92b2('0x28')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x92b2('0x20')](function(_0x31567c){_0xe6f05f[_0x92b2('0x1d')][_0x92b2('0x29')]=_0x31567c;_0x21bbf5[_0x92b2('0x1d')]=_0x31567c[_0x92b2('0x2a')][_0x92b2('0x2b')][_0x92b2('0x2c')];_0x21bbf5[_0x92b2('0x2d')]='dialogflow';_0x21bbf5[_0x92b2('0x2e')]=JSON['stringify'](_0x31567c);return rpc[_0x3e5309+_0x92b2('0x1e')]['create'](_0x21bbf5)['then'](function(_0x105270){logger[_0x92b2('0xd')](_0x92b2('0xe'),_0x536e21,_0x21bbf5['body']);if(_0x31567c[_0x92b2('0x2a')]['metadata'][_0x92b2('0x2f')]){_0x43a292[_0x92b2('0xf')]();}else{_0x43a292[_0x92b2('0x26')]();}})[_0x92b2('0x21')](function(_0x368998){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,JSON['stringify'](_0x368998));_0x43a292['next']();});})['catch'](function(_0xd240ec){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,_0xd240ec['message']);_0x43a292['next']();});}}catch(_0x4039ec){logger[_0x92b2('0x22')](_0x92b2('0xe'),_0x536e21,JSON[_0x92b2('0x23')](_0x4039ec));_0x43a292[_0x92b2('0x26')]();}};}; \ 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 18ce0a0..40b0b89 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 _0x7e2d=['body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','account','upperFirst','InteractionId','isEmpty','Message','finally','stop','sessionPath','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','all','message','stack','lodash','dialogflow','moment','bluebird','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x7e2d,0xc0));var _0xd7e2=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x7e2d[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xd7e2('0x0'));var dialogflow=require(_0xd7e2('0x1'));var md5=require('md5');var moment=require(_0xd7e2('0x2'));var Promise=require(_0xd7e2('0x3'));var logger=require(_0xd7e2('0x4'))('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd7e2('0x5')),'mailMessage':require(_0xd7e2('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd7e2('0x7'))};function createMessage(_0x5d686b,_0x349cad,_0x12f802,_0x4b2873){return new Promise(function(_0x135c5e,_0x2ac882){var _0x16393b=_[_0xd7e2('0x8')](_0x12f802);_0x16393b[_0xd7e2('0x9')]=_0x4b2873;return rpc[_0x349cad+'Message'][_0xd7e2('0xa')](_0x16393b)[_0xd7e2('0xb')](function(){logger[_0xd7e2('0xc')](_0xd7e2('0xd'),_0x5d686b,_0x16393b[_0xd7e2('0x9')]);_0x135c5e();})[_0xd7e2('0xe')](function(_0x56b373){logger[_0xd7e2('0xf')](_0xd7e2('0xd'),_0x5d686b,JSON[_0xd7e2('0x10')](_0x56b373));_0x2ac882(_0x56b373);});});}exports[_0xd7e2('0x11')]=function(_0x40472d,_0x161b61){return function(_0x1e3815){try{if(!_[_0xd7e2('0x12')](this[_0xd7e2('0x13')][_0xd7e2('0x14')])){logger[_0xd7e2('0xc')](_0xd7e2('0xd'),_0x40472d,_0xd7e2('0x15'));return _0x1e3815[_0xd7e2('0x16')]();}var _0x1d7418={'ContactId':this[_0xd7e2('0x17')]['id'],'sentAt':moment()['format'](_0xd7e2('0x18')),'direction':_0xd7e2('0x19')};if(this[_0xd7e2('0x1a')]===_0xd7e2('0x1b')||this['channel']===_0xd7e2('0x1c')){_0x1d7418['phone']=this[_0xd7e2('0x13')]['phone'];}var _0x2b443c=this[_0xd7e2('0x1a')];if(_0x2b443c==='chat'){_0x1d7418['ChatWebsiteId']=this[_0xd7e2('0x1d')]['id'];}else{_0x1d7418[_['upperFirst'](_0x2b443c)+'AccountId']=this[_0xd7e2('0x1d')]['id'];}_0x1d7418[_[_0xd7e2('0x1e')](_0x2b443c)+_0xd7e2('0x1f')]=this[_0xd7e2('0x13')]['id'];if(this[_0xd7e2('0x13')]['created']){var _0x55b0ff=_0x161b61[0x4];if(!_[_0xd7e2('0x20')](_0x55b0ff)){_0x1d7418[_0xd7e2('0x9')]=utils['getMustacheRender'](_0x55b0ff,this);return rpc[_0x2b443c+_0xd7e2('0x21')][_0xd7e2('0xa')](_0x1d7418)['then'](function(_0x5d7db0){logger[_0xd7e2('0xc')](_0xd7e2('0xd'),_0x40472d,_0x1d7418[_0xd7e2('0x9')]);})[_0xd7e2('0xe')](function(_0x126a32){logger[_0xd7e2('0xf')](_0xd7e2('0xd'),_0x40472d,JSON[_0xd7e2('0x10')](_0x126a32));})[_0xd7e2('0x22')](function(){logger[_0xd7e2('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x40472d);_0x1e3815[_0xd7e2('0x23')]();});}else{logger[_0xd7e2('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x40472d);_0x1e3815['stop']();}}else{var _0x4f6462=this;var _0x4bb15b=_0x161b61[0x2]['replace'](/\\n/g,'\x0a');var _0x5b25f1={'credentials':{'private_key':_0x4bb15b,'client_email':_0x161b61[0x1]}};var _0x39a22e=new dialogflow['SessionsClient'](_0x5b25f1);var _0x429682=_0x39a22e[_0xd7e2('0x24')](_0x161b61[0x0],md5(_0x4f6462[_0xd7e2('0x13')]['id']));var _0x2161b8={'session':_0x429682,'queryInput':{'text':{'text':_0x4f6462['message'][_0xd7e2('0x9')],'languageCode':_0x161b61[0x3]||'en'}}};return _0x39a22e[_0xd7e2('0x25')](_0x2161b8)['then'](function(_0x43edd3){if(_0x43edd3&&_0x43edd3[_0xd7e2('0x26')]){_0x4f6462['body'][_0xd7e2('0x27')]=_0x43edd3;var _0x2fc243=_0x43edd3[0x0];var _0x5ebfc0=_0x2fc243['queryResult'][_0xd7e2('0x28')]&&_0x2fc243[_0xd7e2('0x29')]['diagnosticInfo'][_0xd7e2('0x2a')]?_0x2fc243[_0xd7e2('0x29')][_0xd7e2('0x28')][_0xd7e2('0x2a')][_0xd7e2('0x2b')][_0xd7e2('0x2c')]:![];_0x4f6462[_0xd7e2('0x9')][_0xd7e2('0x2d')]=_0x2fc243['queryResult'][_0xd7e2('0x2e')];_0x4f6462[_0xd7e2('0x9')][_0xd7e2('0x2f')]=_0x2fc243[_0xd7e2('0x29')][_0xd7e2('0x30')];_0x4f6462[_0xd7e2('0x9')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x2fc243[_0xd7e2('0x29')][_0xd7e2('0x28')]&&_0x2fc243['queryResult'][_0xd7e2('0x28')][_0xd7e2('0x2a')]?_0x2fc243['queryResult'][_0xd7e2('0x28')][_0xd7e2('0x2a')][_0xd7e2('0x2b')][_0xd7e2('0x2c')]:![];_0x4f6462[_0xd7e2('0x9')][_0xd7e2('0x31')]=_0x2fc243[_0xd7e2('0x29')][_0xd7e2('0x32')][_0xd7e2('0x33')];_0x4f6462[_0xd7e2('0x9')][_0xd7e2('0x34')]=_0x2fc243['queryResult'][_0xd7e2('0x32')][_0xd7e2('0x35')];_0x4f6462[_0xd7e2('0x9')][_0xd7e2('0x36')]=_0x2fc243[_0xd7e2('0x29')][_0xd7e2('0x32')][_0xd7e2('0x37')];_0x4f6462[_0xd7e2('0x9')][_0xd7e2('0x38')]=_0x2fc243['queryResult'][_0xd7e2('0x39')];_0x4f6462['body'][_0xd7e2('0x3a')]=_0x2fc243['queryResult'][_0xd7e2('0x3b')];_0x4f6462['body'][_0xd7e2('0x3c')]=_0x2fc243[_0xd7e2('0x29')]['intentDetectionConfidence'];_0x1d7418[_0xd7e2('0x3d')]=_0xd7e2('0x27');_0x1d7418[_0xd7e2('0x3e')]=JSON[_0xd7e2('0x10')](_0x43edd3);var _0x241621=[];for(var _0x2c223e=0x0;_0x2c223e<_0x43edd3[_0xd7e2('0x26')];_0x2c223e++){var _0x4aaa4e=_0x43edd3[_0x2c223e];if(_0x4aaa4e&&_0x4aaa4e[_0xd7e2('0x29')]&&_0x4aaa4e[_0xd7e2('0x29')][_0xd7e2('0x3f')]){_0x241621['push'](createMessage(_0x40472d,_0x2b443c,_0x1d7418,_0x4aaa4e[_0xd7e2('0x29')][_0xd7e2('0x3f')]));}}return Promise[_0xd7e2('0x40')](_0x241621)[_0xd7e2('0xb')](function(){if(_0x5ebfc0){_0x1e3815[_0xd7e2('0x16')]();}else{_0x1e3815['stop']();}})[_0xd7e2('0xe')](function(_0x2f2c17){logger[_0xd7e2('0xf')](_0xd7e2('0xd'),_0x40472d,JSON[_0xd7e2('0x10')](_0x2f2c17));_0x1e3815[_0xd7e2('0x16')]();});}})[_0xd7e2('0xe')](function(_0x1a2300){logger[_0xd7e2('0xf')](_0xd7e2('0xd'),_0x40472d,_0x1a2300[_0xd7e2('0x41')],_0x1a2300[_0xd7e2('0x42')]);_0x1e3815[_0xd7e2('0x16')]();});}}catch(_0xdb42ad){logger['error'](_0xd7e2('0xd'),_0x40472d,JSON[_0xd7e2('0x10')](_0xdb42ad));_0x1e3815['stop']();}};}; \ No newline at end of file +var _0xaaba=['dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerName','providerResponse','push','all','next','dialogflow','moment','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','contact','format','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length'];(function(_0x57a6ce,_0x3d7316){var _0x38de7e=function(_0x18499b){while(--_0x18499b){_0x57a6ce['push'](_0x57a6ce['shift']());}};_0x38de7e(++_0x3d7316);}(_0xaaba,0x12f));var _0xaaab=function(_0x3d325c,_0x4e4dd4){_0x3d325c=_0x3d325c-0x0;var _0x1a4878=_0xaaba[_0x3d325c];return _0x1a4878;};'use strict';var _=require('lodash');var dialogflow=require(_0xaaab('0x0'));var md5=require('md5');var moment=require(_0xaaab('0x1'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0xaaab('0x2'));var utils=require(_0xaaab('0x3'));var rpc={'chatMessage':require(_0xaaab('0x4')),'openchannelMessage':require(_0xaaab('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xaaab('0x6')),'faxMessage':require(_0xaaab('0x7')),'whatsappMessage':require(_0xaaab('0x8'))};function createMessage(_0x376708,_0x1d866c,_0x4e4b36,_0x3fdd4e){return new Promise(function(_0x46c201,_0x46ae00){var _0x3d89e5=_[_0xaaab('0x9')](_0x4e4b36);_0x3d89e5[_0xaaab('0xa')]=_0x3fdd4e;return rpc[_0x1d866c+_0xaaab('0xb')][_0xaaab('0xc')](_0x3d89e5)['then'](function(){logger[_0xaaab('0xd')](_0xaaab('0xe'),_0x376708,_0x3d89e5[_0xaaab('0xa')]);_0x46c201();})[_0xaaab('0xf')](function(_0x1d0666){logger[_0xaaab('0x10')](_0xaaab('0xe'),_0x376708,JSON[_0xaaab('0x11')](_0x1d0666));_0x46ae00(_0x1d0666);});});}exports[_0xaaab('0x12')]=function(_0x124ab2,_0x1dc7bb){return function(_0x41a27e){try{if(!_[_0xaaab('0x13')](this['interaction'][_0xaaab('0x14')])){logger[_0xaaab('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x124ab2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x41a27e['next']();}var _0x15e8e1={'ContactId':this[_0xaaab('0x15')]['id'],'sentAt':moment()[_0xaaab('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xaaab('0x17')};if(this[_0xaaab('0x18')]===_0xaaab('0x19')||this['channel']===_0xaaab('0x1a')){_0x15e8e1[_0xaaab('0x1b')]=this[_0xaaab('0x1c')][_0xaaab('0x1b')];}var _0x677f6f=this['channel'];if(_0x677f6f===_0xaaab('0x1d')){_0x15e8e1[_0xaaab('0x1e')]=this[_0xaaab('0x1f')]['id'];}else{_0x15e8e1[_[_0xaaab('0x20')](_0x677f6f)+_0xaaab('0x21')]=this[_0xaaab('0x1f')]['id'];}_0x15e8e1[_[_0xaaab('0x20')](_0x677f6f)+_0xaaab('0x22')]=this['interaction']['id'];if(this[_0xaaab('0x1c')][_0xaaab('0x23')]){var _0x58259c=_0x1dc7bb[0x4];if(!_[_0xaaab('0x24')](_0x58259c)){_0x15e8e1[_0xaaab('0xa')]=utils['getMustacheRender'](_0x58259c,this);return rpc[_0x677f6f+_0xaaab('0xb')][_0xaaab('0xc')](_0x15e8e1)[_0xaaab('0x25')](function(_0x1e9be9){logger[_0xaaab('0xd')](_0xaaab('0xe'),_0x124ab2,_0x15e8e1['body']);})[_0xaaab('0xf')](function(_0x124510){logger[_0xaaab('0x10')](_0xaaab('0xe'),_0x124ab2,JSON[_0xaaab('0x11')](_0x124510));})[_0xaaab('0x26')](function(){logger[_0xaaab('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x124ab2);_0x41a27e['stop']();});}else{logger[_0xaaab('0xd')](_0xaaab('0x27'),_0x124ab2);_0x41a27e[_0xaaab('0x28')]();}}else{var _0x56cf3f=this;var _0x2d858d=_0x1dc7bb[0x2][_0xaaab('0x29')](/\\n/g,'\x0a');var _0x59c49e={'credentials':{'private_key':_0x2d858d,'client_email':_0x1dc7bb[0x1]}};var _0x1e089d=new dialogflow[(_0xaaab('0x2a'))](_0x59c49e);var _0x3500c8=_0x1e089d[_0xaaab('0x2b')](_0x1dc7bb[0x0],md5(_0x56cf3f['interaction']['id']));var _0xd6a47f={'session':_0x3500c8,'queryInput':{'text':{'text':_0x56cf3f[_0xaaab('0x2c')][_0xaaab('0xa')],'languageCode':_0x1dc7bb[0x3]||'en'}}};return _0x1e089d[_0xaaab('0x2d')](_0xd6a47f)[_0xaaab('0x25')](function(_0x50f273){if(_0x50f273&&_0x50f273[_0xaaab('0x2e')]){_0x56cf3f[_0xaaab('0xa')][_0xaaab('0x2f')]=_0x50f273;var _0xddf638=_0x50f273[0x0];var _0x2ee12b=_0xddf638[_0xaaab('0x30')][_0xaaab('0x31')]&&_0xddf638[_0xaaab('0x30')]['diagnosticInfo'][_0xaaab('0x32')]?_0xddf638[_0xaaab('0x30')]['diagnosticInfo']['fields'][_0xaaab('0x33')]['boolValue']:![];_0x56cf3f[_0xaaab('0xa')][_0xaaab('0x34')]=_0xddf638['queryResult'][_0xaaab('0x35')];_0x56cf3f[_0xaaab('0xa')][_0xaaab('0x36')]=_0xddf638[_0xaaab('0x30')][_0xaaab('0x37')];_0x56cf3f[_0xaaab('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0xddf638[_0xaaab('0x30')][_0xaaab('0x31')]&&_0xddf638[_0xaaab('0x30')][_0xaaab('0x31')][_0xaaab('0x32')]?_0xddf638['queryResult'][_0xaaab('0x31')][_0xaaab('0x32')]['end_conversation'][_0xaaab('0x38')]:![];_0x56cf3f[_0xaaab('0xa')][_0xaaab('0x39')]=_0xddf638['queryResult'][_0xaaab('0x3a')]['name'];_0x56cf3f[_0xaaab('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0xddf638[_0xaaab('0x30')][_0xaaab('0x3a')]['displayName'];_0x56cf3f[_0xaaab('0xa')][_0xaaab('0x3b')]=_0xddf638[_0xaaab('0x30')]['intent'][_0xaaab('0x3c')];_0x56cf3f['body'][_0xaaab('0x3d')]=_0xddf638[_0xaaab('0x30')][_0xaaab('0x3e')];_0x56cf3f['body'][_0xaaab('0x3f')]=_0xddf638[_0xaaab('0x30')]['queryText'];_0x56cf3f[_0xaaab('0xa')]['DIALOGFLOWV2_SCORE']=_0xddf638[_0xaaab('0x30')][_0xaaab('0x40')];_0x15e8e1[_0xaaab('0x41')]=_0xaaab('0x2f');_0x15e8e1[_0xaaab('0x42')]=JSON[_0xaaab('0x11')](_0x50f273);var _0x155af7=[];for(var _0x2d355b=0x0;_0x2d355b<_0x50f273[_0xaaab('0x2e')];_0x2d355b++){var _0x1c16d8=_0x50f273[_0x2d355b];if(_0x1c16d8&&_0x1c16d8[_0xaaab('0x30')]&&_0x1c16d8['queryResult']['fulfillmentText']){_0x155af7[_0xaaab('0x43')](createMessage(_0x124ab2,_0x677f6f,_0x15e8e1,_0x1c16d8['queryResult']['fulfillmentText']));}}return Promise[_0xaaab('0x44')](_0x155af7)[_0xaaab('0x25')](function(){if(_0x2ee12b){_0x41a27e[_0xaaab('0x45')]();}else{_0x41a27e[_0xaaab('0x28')]();}})[_0xaaab('0xf')](function(_0x26b50f){logger[_0xaaab('0x10')](_0xaaab('0xe'),_0x124ab2,JSON[_0xaaab('0x11')](_0x26b50f));_0x41a27e[_0xaaab('0x45')]();});}})[_0xaaab('0xf')](function(_0x391c4f){logger[_0xaaab('0x10')](_0xaaab('0xe'),_0x124ab2,_0x391c4f[_0xaaab('0x2c')],_0x391c4f['stack']);_0x41a27e[_0xaaab('0x45')]();});}}catch(_0x3e97f6){logger[_0xaaab('0x10')](_0xaaab('0xe'),_0x124ab2,JSON[_0xaaab('0x11')](_0x3e97f6));_0x41a27e[_0xaaab('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index ec8eb58..6baa77b 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 _0x0306=['routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stringify','validate','lodash','html-to-text','./utils'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0306,0x68));var _0x6030=function(_0x10d32f,_0x5cd3aa){_0x10d32f=_0x10d32f-0x0;var _0x67588c=_0x0306[_0x10d32f];return _0x67588c;};'use strict';var schema=require(_0x6030('0x0'));var _=require(_0x6030('0x1'));var htmlToText=require(_0x6030('0x2'));var utils=require(_0x6030('0x3'));var logger=require('../../../../config/logger')(_0x6030('0x4'));var gotoif=schema({'condition':{'type':_0x6030('0x5'),'required':!![],'message':_0x6030('0x6')},'priorityTrue':{'type':_0x6030('0x7'),'message':_0x6030('0x8')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x6030('0x9')]=function(_0x504535,_0x193b7a){return function(_0x11f773){try{var _0x1387d2={'condition':htmlToText[_0x6030('0xa')](utils['getMustacheRender'](_0x193b7a[0x0],this),{'wordwrap':![]})[_0x6030('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x193b7a[0x1],'priorityFalse':_0x193b7a[0x2]};var _0x6e85c4=gotoif[_0x6030('0x0')](_0x1387d2,{'typecast':!![]});if(_0x6e85c4['length']){logger[_0x6030('0xc')](_0x6030('0xd'),_0x504535,_['map'](_0x6e85c4,_0x6030('0xe'))[_0x6030('0xf')](',\x20'));_0x11f773[_0x6030('0x10')]();}else{try{var _0x324d21=eval('('+_0x1387d2[_0x6030('0x11')]+')');var _0x1028cd=_0x324d21?_0x1387d2[_0x6030('0x12')]:_0x1387d2[_0x6030('0x13')];logger['info'](_0x6030('0x14'),_0x504535,_0x1387d2[_0x6030('0x11')],_0x324d21,_0x1028cd||_0x6030('0x15'));if(_0x1028cd){var _0x5c47ea=_[_0x6030('0x16')](_0x11f773[_0x6030('0x17')](),{'p':_0x1028cd});if(_0x5c47ea>=0x0){logger[_0x6030('0x18')](_0x6030('0x19'),_0x504535,_0x1028cd||'next',_0x5c47ea);_0x11f773[_0x6030('0x15')](_0x5c47ea);}else{logger[_0x6030('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x504535,_0x1028cd||_0x6030('0x15'));_0x11f773['stop']();}}else{_0x11f773[_0x6030('0x15')]();}}catch(_0x37ef9d){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x504535,_0x37ef9d[_0x6030('0xe')]);_0x11f773[_0x6030('0x10')]();}}}catch(_0x38306c){logger[_0x6030('0xc')](_0x6030('0xd'),_0x504535,JSON[_0x6030('0x1a')](_0x38306c));_0x11f773[_0x6030('0x10')]();}};}; \ No newline at end of file +var _0x5f20=['stop','condition','priorityTrue','priorityFalse','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','lodash','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x95ca6d,_0x28fbfe){var _0x527da6=function(_0x56c811){while(--_0x56c811){_0x95ca6d['push'](_0x95ca6d['shift']());}};_0x527da6(++_0x28fbfe);}(_0x5f20,0x111));var _0x05f2=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x5f20[_0x2283dc];return _0x16db90;};'use strict';var schema=require('validate');var _=require(_0x05f2('0x0'));var htmlToText=require(_0x05f2('0x1'));var utils=require(_0x05f2('0x2'));var logger=require(_0x05f2('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x05f2('0x4')},'priorityTrue':{'type':_0x05f2('0x5'),'message':_0x05f2('0x6')},'priorityFalse':{'type':_0x05f2('0x5'),'message':_0x05f2('0x7')}});exports['consequence']=function(_0x1680cb,_0x574474){return function(_0x1064d6){try{var _0x57e691={'condition':htmlToText[_0x05f2('0x8')](utils[_0x05f2('0x9')](_0x574474[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x574474[0x1],'priorityFalse':_0x574474[0x2]};var _0x51140e=gotoif['validate'](_0x57e691,{'typecast':!![]});if(_0x51140e[_0x05f2('0xa')]){logger[_0x05f2('0xb')](_0x05f2('0xc'),_0x1680cb,_[_0x05f2('0xd')](_0x51140e,_0x05f2('0xe'))['join'](',\x20'));_0x1064d6[_0x05f2('0xf')]();}else{try{var _0x5c96bb=eval('('+_0x57e691[_0x05f2('0x10')]+')');var _0x168122=_0x5c96bb?_0x57e691[_0x05f2('0x11')]:_0x57e691[_0x05f2('0x12')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1680cb,_0x57e691[_0x05f2('0x10')],_0x5c96bb,_0x168122||_0x05f2('0x13'));if(_0x168122){var _0xb901fc=_['findIndex'](_0x1064d6[_0x05f2('0x14')](),{'p':_0x168122});if(_0xb901fc>=0x0){logger[_0x05f2('0x15')](_0x05f2('0x16'),_0x1680cb,_0x168122||_0x05f2('0x13'),_0xb901fc);_0x1064d6[_0x05f2('0x13')](_0xb901fc);}else{logger[_0x05f2('0x15')](_0x05f2('0x17'),_0x1680cb,_0x168122||_0x05f2('0x13'));_0x1064d6[_0x05f2('0xf')]();}}else{_0x1064d6['next']();}}catch(_0x23a6f6){logger[_0x05f2('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1680cb,_0x23a6f6[_0x05f2('0xe')]);_0x1064d6[_0x05f2('0xf')]();}}}catch(_0xda5219){logger[_0x05f2('0xb')](_0x05f2('0xc'),_0x1680cb,JSON['stringify'](_0xda5219));_0x1064d6[_0x05f2('0xf')]();}};}; \ 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 b5f3242..3bfed42 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 _0x27bb=['[%s][GOTOP]\x20priority\x20%s','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','map','message','join','stop','info'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0x27bb,0x95));var _0xb27b=function(_0x247a7f,_0x3884e2){_0x247a7f=_0x247a7f-0x0;var _0x1f49ae=_0x27bb[_0x247a7f];return _0x1f49ae;};'use strict';var schema=require(_0xb27b('0x0'));var _=require(_0xb27b('0x1'));var logger=require(_0xb27b('0x2'))(_0xb27b('0x3'));var gotop=schema({'priority':{'type':_0xb27b('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xb27b('0x5')]=function(_0x275169,_0x4d5e1b){return function(_0x5bd175){try{var _0x132fd6={'priority':_0x4d5e1b[0x0]};var _0xf00c1d=gotop[_0xb27b('0x0')](_0x132fd6,{'typecast':!![]});if(_0xf00c1d[_0xb27b('0x6')]){logger[_0xb27b('0x7')]('[%s][GOTOP]\x20%s',_0x275169,_[_0xb27b('0x8')](_0xf00c1d,_0xb27b('0x9'))[_0xb27b('0xa')](',\x20'));_0x5bd175[_0xb27b('0xb')]();}else{logger[_0xb27b('0xc')](_0xb27b('0xd'),_0x275169,_0x132fd6[_0xb27b('0xe')]);if(_0x132fd6['priority']){var _0x383681=_['findIndex'](_0x5bd175['rules'](),{'p':_0x132fd6[_0xb27b('0xe')]});if(_0x383681>=0x0){logger[_0xb27b('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x275169,_0x132fd6['priority']||_0xb27b('0xf'),_0x383681);_0x5bd175[_0xb27b('0xf')](_0x383681);}else{logger[_0xb27b('0xc')](_0xb27b('0x10'),_0x275169,_0x132fd6[_0xb27b('0xe')]||'next');_0x5bd175[_0xb27b('0xb')]();}}else{_0x5bd175[_0xb27b('0xf')]();}}}catch(_0x1a3f52){logger['error']('[%s][GOTOP]\x20%s',_0x275169,JSON[_0xb27b('0x11')](_0x1a3f52));_0x5bd175[_0xb27b('0xb')]();}};}; \ No newline at end of file +var _0x2e73=['consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x1bdc3d,_0x40d513){var _0x26561e=function(_0x20e2aa){while(--_0x20e2aa){_0x1bdc3d['push'](_0x1bdc3d['shift']());}};_0x26561e(++_0x40d513);}(_0x2e73,0x1df));var _0x32e7=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x2e73[_0x19159a];return _0xa677f4;};'use strict';var schema=require(_0x32e7('0x0'));var _=require(_0x32e7('0x1'));var logger=require('../../../../config/logger')(_0x32e7('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x32e7('0x3')}});exports[_0x32e7('0x4')]=function(_0xd66359,_0x406d1c){return function(_0xa130eb){try{var _0x6f7325={'priority':_0x406d1c[0x0]};var _0xb9b98c=gotop['validate'](_0x6f7325,{'typecast':!![]});if(_0xb9b98c[_0x32e7('0x5')]){logger['error'](_0x32e7('0x6'),_0xd66359,_[_0x32e7('0x7')](_0xb9b98c,_0x32e7('0x8'))[_0x32e7('0x9')](',\x20'));_0xa130eb[_0x32e7('0xa')]();}else{logger[_0x32e7('0xb')](_0x32e7('0xc'),_0xd66359,_0x6f7325[_0x32e7('0xd')]);if(_0x6f7325[_0x32e7('0xd')]){var _0x304f7b=_[_0x32e7('0xe')](_0xa130eb[_0x32e7('0xf')](),{'p':_0x6f7325['priority']});if(_0x304f7b>=0x0){logger['info'](_0x32e7('0x10'),_0xd66359,_0x6f7325['priority']||_0x32e7('0x11'),_0x304f7b);_0xa130eb[_0x32e7('0x11')](_0x304f7b);}else{logger['info'](_0x32e7('0x12'),_0xd66359,_0x6f7325[_0x32e7('0xd')]||_0x32e7('0x11'));_0xa130eb[_0x32e7('0xa')]();}}else{_0xa130eb[_0x32e7('0x11')]();}}}catch(_0x40dbb5){logger[_0x32e7('0x13')](_0x32e7('0x6'),_0xd66359,JSON[_0x32e7('0x14')](_0x40dbb5));_0xa130eb[_0x32e7('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 9f79df8..3e3ddf3 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 _0xed4b=['create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','Message'];(function(_0x1c05c0,_0x38e872){var _0x4b8d87=function(_0x4eb807){while(--_0x4eb807){_0x1c05c0['push'](_0x1c05c0['shift']());}};_0x4b8d87(++_0x38e872);}(_0xed4b,0x96));var _0xbed4=function(_0x35e7fb,_0x156793){_0x35e7fb=_0x35e7fb-0x0;var _0x45f6a6=_0xed4b[_0x35e7fb];return _0x45f6a6;};'use strict';var _=require(_0xbed4('0x0'));var utils=require(_0xbed4('0x1'));var logger=require(_0xbed4('0x2'))('routing');var rpc={'chatMessage':require(_0xbed4('0x3')),'openchannelMessage':require(_0xbed4('0x4')),'mailMessage':require(_0xbed4('0x5')),'smsMessage':require(_0xbed4('0x6')),'faxMessage':require(_0xbed4('0x7')),'whatsappMessage':require(_0xbed4('0x8'))};exports['consequence']=function(_0x26da19,_0xf71a47){return function(_0x403756){try{var _0x272560={'body':utils[_0xbed4('0x9')](_0xf71a47[0x0],this),'ContactId':this[_0xbed4('0xa')]['id']};if(this[_0xbed4('0xb')]===_0xbed4('0xc')){_0x272560[_0xbed4('0xd')]=this[_0xbed4('0xe')]['id'];}else{_0x272560[_[_0xbed4('0xf')](this[_0xbed4('0xb')])+_0xbed4('0x10')]=this['account']['id'];}_0x272560[_[_0xbed4('0xf')](this[_0xbed4('0xb')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0xbed4('0x11')]){return rpc[this[_0xbed4('0xb')]+_0xbed4('0x11')][_0xbed4('0x12')](_0x272560)[_0xbed4('0x13')](function(_0x24f19e){logger[_0xbed4('0x14')]('[%s][MESSAGE]\x20%s',_0x26da19,_0x272560[_0xbed4('0x15')]);_0x403756[_0xbed4('0x16')]();})[_0xbed4('0x17')](function(_0x4a5c97){logger[_0xbed4('0x18')](_0xbed4('0x19'),_0x26da19,JSON[_0xbed4('0x1a')](_0x4a5c97));_0x403756[_0xbed4('0x1b')]();});}}catch(_0x299bce){logger['error']('[%s][MESSAGE]\x20%s',_0x26da19,JSON['stringify'](_0x299bce));_0x403756[_0xbed4('0x1b')]();}};}; \ No newline at end of file +var _0x5f01=['chat','ChatWebsiteId','account','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','channel'];(function(_0x9ddc3,_0x4e0186){var _0x420b07=function(_0xda2ef9){while(--_0xda2ef9){_0x9ddc3['push'](_0x9ddc3['shift']());}};_0x420b07(++_0x4e0186);}(_0x5f01,0x9e));var _0x15f0=function(_0x5de6bf,_0x5ef3d8){_0x5de6bf=_0x5de6bf-0x0;var _0x1e2275=_0x5f01[_0x5de6bf];return _0x1e2275;};'use strict';var _=require(_0x15f0('0x0'));var utils=require(_0x15f0('0x1'));var logger=require(_0x15f0('0x2'))(_0x15f0('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x15f0('0x4')),'mailMessage':require(_0x15f0('0x5')),'smsMessage':require(_0x15f0('0x6')),'faxMessage':require(_0x15f0('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x557343,_0x8d68c8){return function(_0x5e2870){try{var _0x5f8f6f={'body':utils[_0x15f0('0x8')](_0x8d68c8[0x0],this),'ContactId':this['contact']['id']};if(this[_0x15f0('0x9')]===_0x15f0('0xa')){_0x5f8f6f[_0x15f0('0xb')]=this[_0x15f0('0xc')]['id'];}else{_0x5f8f6f[_['upperFirst'](this[_0x15f0('0x9')])+'AccountId']=this[_0x15f0('0xc')]['id'];}_0x5f8f6f[_[_0x15f0('0xd')](this[_0x15f0('0x9')])+'InteractionId']=this[_0x15f0('0xe')]['id'];if(rpc[this[_0x15f0('0x9')]+_0x15f0('0xf')]){return rpc[this[_0x15f0('0x9')]+_0x15f0('0xf')][_0x15f0('0x10')](_0x5f8f6f)[_0x15f0('0x11')](function(_0xf25907){logger[_0x15f0('0x12')](_0x15f0('0x13'),_0x557343,_0x5f8f6f['body']);_0x5e2870['next']();})[_0x15f0('0x14')](function(_0xae8e82){logger[_0x15f0('0x15')]('[%s][MESSAGE]\x20%s',_0x557343,JSON[_0x15f0('0x16')](_0xae8e82));_0x5e2870[_0x15f0('0x17')]();});}}catch(_0x2ae0b3){logger[_0x15f0('0x15')]('[%s][MESSAGE]\x20%s',_0x557343,JSON[_0x15f0('0x16')](_0x2ae0b3));_0x5e2870[_0x15f0('0x17')]();}};}; \ 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 013106a..8d539b8 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 _0x78b9=['stringify','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error'];(function(_0x272ad3,_0x56f0b2){var _0x1f1ccb=function(_0xf4d6c6){while(--_0xf4d6c6){_0x272ad3['push'](_0x272ad3['shift']());}};_0x1f1ccb(++_0x56f0b2);}(_0x78b9,0x9a));var _0x978b=function(_0x419eb7,_0x19c2ef){_0x419eb7=_0x419eb7-0x0;var _0x15c9f4=_0x78b9[_0x419eb7];return _0x15c9f4;};'use strict';var utils=require(_0x978b('0x0'));var logger=require(_0x978b('0x1'))(_0x978b('0x2'));exports[_0x978b('0x3')]=function(_0x55453c,_0x38519f){return function(_0x11e180){try{logger[_0x978b('0x4')](_0x978b('0x5'),_0x55453c,utils[_0x978b('0x6')](_0x38519f[0x0],this));_0x11e180['next']();}catch(_0x1ce7bd){logger[_0x978b('0x7')](_0x978b('0x5'),_0x55453c,JSON[_0x978b('0x8')](_0x1ce7bd));_0x11e180['stop']();}};}; \ No newline at end of file +var _0x7bbf=['info','[%s][NOOP]\x20%s','error','stringify','stop','../../../../config/logger','routing','consequence'];(function(_0x210b09,_0x3b4c64){var _0x12420b=function(_0x2aad37){while(--_0x2aad37){_0x210b09['push'](_0x210b09['shift']());}};_0x12420b(++_0x3b4c64);}(_0x7bbf,0xfd));var _0xf7bb=function(_0x156d15,_0x2c0f48){_0x156d15=_0x156d15-0x0;var _0x4d9a84=_0x7bbf[_0x156d15];return _0x4d9a84;};'use strict';var utils=require('./utils');var logger=require(_0xf7bb('0x0'))(_0xf7bb('0x1'));exports[_0xf7bb('0x2')]=function(_0x2a4ee5,_0x284e6b){return function(_0x24206a){try{logger[_0xf7bb('0x3')](_0xf7bb('0x4'),_0x2a4ee5,utils['getMustacheRender'](_0x284e6b[0x0],this));_0x24206a['next']();}catch(_0x42ad99){logger[_0xf7bb('0x5')](_0xf7bb('0x4'),_0x2a4ee5,JSON[_0xf7bb('0x6')](_0x42ad99));_0x24206a[_0xf7bb('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index c5523dd..e7a8dd9 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 _0x957f=['upperFirst','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','QueueReport','update','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss','contact','channel','QueueId','interaction'];(function(_0x18e3b3,_0x3e631d){var _0xbb7bc7=function(_0x44c41b){while(--_0x44c41b){_0x18e3b3['push'](_0x18e3b3['shift']());}};_0xbb7bc7(++_0x3e631d);}(_0x957f,0x150));var _0xf957=function(_0x5d8e11,_0x1b2574){_0x5d8e11=_0x5d8e11-0x0;var _0x25fa53=_0x957f[_0x5d8e11];return _0x25fa53;};'use strict';var schema=require('validate');var _=require(_0xf957('0x0'));var util=require(_0xf957('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xf957('0x2'));var Redis=require(_0xf957('0x3'));var config=require(_0xf957('0x4'));var logger=require(_0xf957('0x5'))('routing');var strategy=require(_0xf957('0x6'));config[_0xf957('0x7')]=_[_0xf957('0x8')](config['redis'],{'host':_0xf957('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf957('0x7')]));var attributes=['id',_0xf957('0xa'),_0xf957('0xb'),_0xf957('0xc'),_0xf957('0xd'),'joinAt'];function emit(_0x4127e0,_0x9b057d,_0x3d7813){io['to'](_0x4127e0)[_0xf957('0xe')](_0x9b057d,_0x3d7813);}function emitChannelQueueInteraction(_0x21cea4,_0x2591a4,_0x59bbb1,_0x3bc802,_0x4d658c,_0x436877,_0x10ce0f,_0x6b3aa2){var _0x208f89=_['clone'](_0x59bbb1);_0x208f89[_0xf957('0xa')]=_0x6b3aa2;_0x208f89['queue']=_0x2591a4;_0x208f89['account']=_0x3bc802;_0x208f89['id']=_0x4d658c;if(_0x436877){attributes['push'](_[_0xf957('0xf')](_0x21cea4)+_0xf957('0x10'));_0x10ce0f[util[_0xf957('0x11')](_0xf957('0x12'),_0x21cea4)][_0x4d658c]=_[_0xf957('0x13')](_0x208f89,attributes);}else{delete _0x10ce0f[util[_0xf957('0x11')]('%sQueuesWaitingInteractions',_0x21cea4)][_0x4d658c];}emit(util[_0xf957('0x11')](_0xf957('0x14'),_0x21cea4,_0x2591a4),util[_0xf957('0x11')](_0xf957('0x15'),_0x21cea4,_0x436877?'save':_0xf957('0x16')),_['pick'](_0x208f89,attributes));}var rpc={'openchannelQueueReport':require(_0xf957('0x17')),'mailQueueReport':require(_0xf957('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xf957('0x19'),'required':!![],'message':_0xf957('0x1a')},'timeout':{'type':'number','message':_0xf957('0x1b')}});function startRouting(_0x28b23e,_0x19542f,_0x202d31,_0xd4bb22){if(_0x28b23e&&_0x19542f&&_0x202d31){_0x19542f[_0xf957('0x1c')]+=0x1;var _0x587fce={'uniqueid':_0x28b23e,'from':_0x202d31['body']?_0x202d31['body'][_0xf957('0xd')]:'','joinAt':moment()['format'](_0xf957('0x1d')),'ContactId':_0x202d31[_0xf957('0x1e')]?_0x202d31[_0xf957('0x1e')]['id']:null,'ListId':_0x202d31['list']?_0x202d31['list']['id']:null};_0x587fce[_['upperFirst'](_0x202d31[_0xf957('0x1f')])+_0xf957('0x20')]=_0x19542f['id']||null;_0x587fce[_['upperFirst'](_0x202d31[_0xf957('0x1f')])+_0xf957('0x10')]=_0x202d31[_0xf957('0x21')]?_0x202d31[_0xf957('0x21')]['id']:null;_0x587fce[_[_0xf957('0x22')](_0x202d31[_0xf957('0x1f')])+_0xf957('0x23')]=_0x202d31['message']?_0x202d31[_0xf957('0x24')]['id']:null;_0x587fce[_['upperFirst'](_0x202d31[_0xf957('0x1f')])+(_0x202d31[_0xf957('0x1f')]!=='chat'?'AccountId':_0xf957('0x25'))]=_0x202d31['account']?_0x202d31[_0xf957('0xb')]['id']:null;logger[_0xf957('0x26')](util[_0xf957('0x11')](_0xf957('0x27'),_0x28b23e,_0x19542f[_0xf957('0x28')]));emitChannelQueueInteraction(_0x202d31[_0xf957('0x1f')],_0x19542f[_0xf957('0x28')],_0x587fce,_0x202d31['account'][_0xf957('0x28')],_0x202d31[_0xf957('0x24')]['id'],!![],_0xd4bb22,_0x19542f['id']);if(rpc[_0x202d31[_0xf957('0x1f')]+'QueueReport']){return rpc[_0x202d31[_0xf957('0x1f')]+'QueueReport'][_0xf957('0x29')](_0x587fce)[_0xf957('0x2a')](function(_0x43974){logger[_0xf957('0x2b')](_0xf957('0x2c'));});}}}function stopRouting(_0x1d0c37,_0x4cb5cf,_0x3e6778,_0x45c7fc){if(_0x1d0c37&&_0x4cb5cf){_0x4cb5cf[_0xf957('0x1c')]-=0x1;var _0x1c1b79={'leaveAt':moment()['format'](_0xf957('0x1d')),'acceptAt':moment()['format'](_0xf957('0x1d')),'reason':_0xf957('0x2d')};logger['info'](util[_0xf957('0x11')](_0xf957('0x2e'),_0x1d0c37,_0x4cb5cf[_0xf957('0x28')]));emitChannelQueueInteraction(_0x3e6778[_0xf957('0x1f')],_0x4cb5cf[_0xf957('0x28')],_0x3e6778[_0xf957('0x2f')],_0x3e6778[_0xf957('0xb')][_0xf957('0x28')],_0x3e6778[_0xf957('0x24')]['id'],![],_0x45c7fc,_0x4cb5cf['id']);if(rpc[_0x3e6778[_0xf957('0x1f')]+'QueueReport']){return rpc[_0x3e6778[_0xf957('0x1f')]+'QueueReport']['update'](_0x1d0c37,_0x1c1b79)['catch'](function(_0x4a70cf){logger[_0xf957('0x2b')](_0xf957('0x30'));});}}}function endRouting(_0x5bf542,_0x5a222f,_0x3be3b5,_0x471ff5){if(_0x5bf542&&_0x5a222f){_0x5a222f[_0xf957('0x1c')]-=0x1;var _0x19b112={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xf957('0x1d')),'reason':_0xf957('0x31')};logger[_0xf957('0x26')](util[_0xf957('0x11')](_0xf957('0x32'),_0x5bf542,_0x5a222f['name']));emitChannelQueueInteraction(_0x3be3b5[_0xf957('0x1f')],_0x5a222f[_0xf957('0x28')],_0x3be3b5['body'],_0x3be3b5[_0xf957('0xb')]['name'],_0x3be3b5[_0xf957('0x24')]['id'],![],_0x471ff5);if(rpc[_0x3be3b5['channel']+_0xf957('0x33')]){return rpc[_0x3be3b5[_0xf957('0x1f')]+'QueueReport'][_0xf957('0x34')](_0x5bf542,_0x19b112)[_0xf957('0x2a')](function(_0x3ed485){logger[_0xf957('0x2b')](_0xf957('0x30'));});}}}function handleFindQueue(_0x3265b6){return function(_0x109f41){return _0x109f41['name']['toLowerCase']()===_0x3265b6[_0xf957('0x35')]();};}exports[_0xf957('0x36')]=function(_0x1ba97f,_0x310438,_0x15887a,_0x55092f){return function(_0x27d565){try{var _0xcfd8a3={'name':_0x310438[0x0],'timeout':_0x310438[0x1]};var _0x4079c8=queue[_0xf957('0x37')](_0xcfd8a3,{'typecast':!![]});if(_0x4079c8[_0xf957('0x38')]){logger[_0xf957('0x2b')](_0xf957('0x39'),_0x1ba97f,_[_0xf957('0x3a')](_0x4079c8,_0xf957('0x24'))[_0xf957('0x3b')](',\x20'));_0x27d565[_0xf957('0x3c')]();}else{var _0x3d4e73=_[_0xf957('0x3d')](_0x15887a[_0x55092f[_0xf957('0x1f')]+'Queues'],handleFindQueue(_0xcfd8a3[_0xf957('0x28')]));if(_0x3d4e73){startRouting(_0x1ba97f,_0x3d4e73,_0x55092f,_0x15887a);var _0xf26bf8=(_0x3d4e73[_0xf957('0x31')]||0xa)*0x3e8;var _0x44629a=(_0xcfd8a3[_0xf957('0x31')]||0x14)*0x3e8;var _0x130318;if(_0xf26bf8>_0x44629a){_0x44629a=_0xf26bf8;}var _0x44474e=seqqueue[_0xf957('0x3e')](_0xf26bf8);_0x44474e['id']=_0x1ba97f;_0x44474e['atimeout']=_0xf26bf8;_0x44474e[_0xf957('0x3f')]=_0x44629a;_0x44474e[_0xf957('0x1f')]=_0x55092f[_0xf957('0x1f')];_0x15887a[_0xf957('0x40')][_0x1ba97f]['on'](_0xf957('0x41'),function(){logger[_0xf957('0x26')](_0xf957('0x42'),_0x1ba97f);stopRouting(_0x1ba97f,_0x3d4e73,_0x55092f,_0x15887a);clearTimeout(_0x130318);_0x130318=undefined;_0x44474e['close'](!![]);if(_0x15887a[_0xf957('0x40')][_0x1ba97f]){delete _0x15887a[_0xf957('0x40')][_0x1ba97f];}_0x27d565[_0xf957('0x3c')]();});_0x15887a['rules'][_0x1ba97f]['on']('complete',function(){if(_0x15887a[_0xf957('0x40')][_0x1ba97f]){delete _0x15887a[_0xf957('0x40')][_0x1ba97f];}});_0x130318=setTimeout(function(){logger[_0xf957('0x26')](_0xf957('0x43'),_0x1ba97f);endRouting(_0x1ba97f,_0x3d4e73,_0x55092f,_0x15887a);clearTimeout(_0x130318);_0x44474e[_0xf957('0x44')](!![]);_0x27d565[_0xf957('0x45')]();},_0x44629a);switch(_0x3d4e73['strategy']){case _0xf957('0x46'):strategy['rrmemory'](_0x44474e,_0x3d4e73,_0x15887a,_0x55092f);break;default:strategy['beepall'](_0x44474e,_0x3d4e73,_0x15887a,_0x55092f);}}else{logger[_0xf957('0x2b')](_0xf957('0x47'),_0x1ba97f,_0xcfd8a3[_0xf957('0x28')]);_0x27d565['stop']();}}}catch(_0x3f8bda){console[_0xf957('0x48')](_0x3f8bda);logger[_0xf957('0x2b')]('[%s][QUEUE]\x20%s',_0x1ba97f,_0x3f8bda[_0xf957('0x49')]);_0x27d565[_0xf957('0x3c')]();}};}; \ No newline at end of file +var _0x9f33=['strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','interaction','upperFirst','channel','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END'];(function(_0x3a814f,_0x553e5b){var _0x150de1=function(_0x162bed){while(--_0x162bed){_0x3a814f['push'](_0x3a814f['shift']());}};_0x150de1(++_0x553e5b);}(_0x9f33,0xaf));var _0x39f3=function(_0x1728d1,_0x1994e3){_0x1728d1=_0x1728d1-0x0;var _0x3ca811=_0x9f33[_0x1728d1];return _0x3ca811;};'use strict';var schema=require(_0x39f3('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x39f3('0x1'));var moment=require(_0x39f3('0x2'));var Redis=require(_0x39f3('0x3'));var config=require(_0x39f3('0x4'));var logger=require(_0x39f3('0x5'))(_0x39f3('0x6'));var strategy=require(_0x39f3('0x7'));config[_0x39f3('0x8')]=_[_0x39f3('0x9')](config['redis'],{'host':_0x39f3('0xa'),'port':0x18eb});var io=require(_0x39f3('0xb'))(new Redis(config['redis']));var attributes=['id',_0x39f3('0xc'),_0x39f3('0xd'),_0x39f3('0xe'),_0x39f3('0xf'),'joinAt'];function emit(_0x7c117e,_0x45f52a,_0x5a46ac){io['to'](_0x7c117e)['emit'](_0x45f52a,_0x5a46ac);}function emitChannelQueueInteraction(_0x58cb26,_0x269eca,_0xada429,_0x1c98c1,_0x54e2a1,_0x3703f8,_0x1886e6,_0x14b454){var _0x18ece6=_[_0x39f3('0x10')](_0xada429);_0x18ece6[_0x39f3('0xc')]=_0x14b454;_0x18ece6[_0x39f3('0xe')]=_0x269eca;_0x18ece6[_0x39f3('0xd')]=_0x1c98c1;_0x18ece6['id']=_0x54e2a1;if(_0x3703f8){attributes[_0x39f3('0x11')](_[_0x39f3('0x12')](_0x58cb26)+_0x39f3('0x13'));_0x1886e6[util['format'](_0x39f3('0x14'),_0x58cb26)][_0x54e2a1]=_[_0x39f3('0x15')](_0x18ece6,attributes);}else{delete _0x1886e6[util[_0x39f3('0x16')](_0x39f3('0x14'),_0x58cb26)][_0x54e2a1];}emit(util[_0x39f3('0x16')](_0x39f3('0x17'),_0x58cb26,_0x269eca),util['format'](_0x39f3('0x18'),_0x58cb26,_0x3703f8?_0x39f3('0x19'):_0x39f3('0x1a')),_[_0x39f3('0x15')](_0x18ece6,attributes));}var rpc={'openchannelQueueReport':require(_0x39f3('0x1b')),'mailQueueReport':require(_0x39f3('0x1c')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x39f3('0x1d')),'faxQueueReport':require(_0x39f3('0x1e')),'whatsappQueueReport':require(_0x39f3('0x1f'))};var queue=schema({'name':{'type':_0x39f3('0x20'),'required':!![],'message':_0x39f3('0x21')},'timeout':{'type':_0x39f3('0x22'),'message':_0x39f3('0x23')}});function startRouting(_0x1f2a62,_0x33fc51,_0x301365,_0x35393d){if(_0x1f2a62&&_0x33fc51&&_0x301365){_0x33fc51[_0x39f3('0x24')]+=0x1;var _0x337a23={'uniqueid':_0x1f2a62,'from':_0x301365[_0x39f3('0x25')]?_0x301365[_0x39f3('0x25')][_0x39f3('0xf')]:'','joinAt':moment()[_0x39f3('0x16')](_0x39f3('0x26')),'ContactId':_0x301365[_0x39f3('0x27')]?_0x301365[_0x39f3('0x27')]['id']:null,'ListId':_0x301365['list']?_0x301365[_0x39f3('0x28')]['id']:null};_0x337a23[_['upperFirst'](_0x301365['channel'])+_0x39f3('0x29')]=_0x33fc51['id']||null;_0x337a23[_['upperFirst'](_0x301365['channel'])+_0x39f3('0x13')]=_0x301365[_0x39f3('0x2a')]?_0x301365[_0x39f3('0x2a')]['id']:null;_0x337a23[_[_0x39f3('0x2b')](_0x301365[_0x39f3('0x2c')])+_0x39f3('0x2d')]=_0x301365[_0x39f3('0x2e')]?_0x301365[_0x39f3('0x2e')]['id']:null;_0x337a23[_['upperFirst'](_0x301365[_0x39f3('0x2c')])+(_0x301365['channel']!==_0x39f3('0x2f')?_0x39f3('0x30'):_0x39f3('0x31'))]=_0x301365[_0x39f3('0xd')]?_0x301365[_0x39f3('0xd')]['id']:null;logger['info'](util[_0x39f3('0x16')](_0x39f3('0x32'),_0x1f2a62,_0x33fc51['name']));emitChannelQueueInteraction(_0x301365[_0x39f3('0x2c')],_0x33fc51['name'],_0x337a23,_0x301365[_0x39f3('0xd')][_0x39f3('0x33')],_0x301365['message']['id'],!![],_0x35393d,_0x33fc51['id']);if(rpc[_0x301365['channel']+_0x39f3('0x34')]){return rpc[_0x301365[_0x39f3('0x2c')]+_0x39f3('0x34')][_0x39f3('0x35')](_0x337a23)[_0x39f3('0x36')](function(_0x227e6b){logger[_0x39f3('0x37')](_0x39f3('0x38'));});}}}function stopRouting(_0x183ee2,_0x495300,_0x3d9a5e,_0x172ef0){if(_0x183ee2&&_0x495300){_0x495300['waiting']-=0x1;var _0x170f25={'leaveAt':moment()[_0x39f3('0x16')](_0x39f3('0x26')),'acceptAt':moment()[_0x39f3('0x16')](_0x39f3('0x26')),'reason':_0x39f3('0x39')};logger[_0x39f3('0x3a')](util['format'](_0x39f3('0x3b'),_0x183ee2,_0x495300[_0x39f3('0x33')]));emitChannelQueueInteraction(_0x3d9a5e[_0x39f3('0x2c')],_0x495300[_0x39f3('0x33')],_0x3d9a5e[_0x39f3('0x25')],_0x3d9a5e['account'][_0x39f3('0x33')],_0x3d9a5e[_0x39f3('0x2e')]['id'],![],_0x172ef0,_0x495300['id']);if(rpc[_0x3d9a5e['channel']+_0x39f3('0x34')]){return rpc[_0x3d9a5e['channel']+_0x39f3('0x34')][_0x39f3('0x3c')](_0x183ee2,_0x170f25)['catch'](function(_0x265c53){logger['error'](_0x39f3('0x3d'));});}}}function endRouting(_0x90f329,_0x1a0c80,_0x253e0b,_0x53904b){if(_0x90f329&&_0x1a0c80){_0x1a0c80['waiting']-=0x1;var _0x2ca8ae={'leaveAt':moment()[_0x39f3('0x16')](_0x39f3('0x26')),'exitAt':moment()['format'](_0x39f3('0x26')),'reason':_0x39f3('0x3e')};logger['info'](util[_0x39f3('0x16')](_0x39f3('0x3f'),_0x90f329,_0x1a0c80[_0x39f3('0x33')]));emitChannelQueueInteraction(_0x253e0b[_0x39f3('0x2c')],_0x1a0c80[_0x39f3('0x33')],_0x253e0b[_0x39f3('0x25')],_0x253e0b[_0x39f3('0xd')][_0x39f3('0x33')],_0x253e0b[_0x39f3('0x2e')]['id'],![],_0x53904b);if(rpc[_0x253e0b[_0x39f3('0x2c')]+'QueueReport']){return rpc[_0x253e0b[_0x39f3('0x2c')]+_0x39f3('0x34')][_0x39f3('0x3c')](_0x90f329,_0x2ca8ae)[_0x39f3('0x36')](function(_0x3a384c){logger[_0x39f3('0x37')](_0x39f3('0x3d'));});}}}function handleFindQueue(_0x401837){return function(_0x568a58){return _0x568a58[_0x39f3('0x33')][_0x39f3('0x40')]()===_0x401837[_0x39f3('0x40')]();};}exports[_0x39f3('0x41')]=function(_0x3a2405,_0xbda19c,_0x4bc784,_0x5e318d){return function(_0x2e5b93){try{var _0x4bc495={'name':_0xbda19c[0x0],'timeout':_0xbda19c[0x1]};var _0x1b0095=queue['validate'](_0x4bc495,{'typecast':!![]});if(_0x1b0095[_0x39f3('0x42')]){logger['error'](_0x39f3('0x43'),_0x3a2405,_[_0x39f3('0x44')](_0x1b0095,'message')[_0x39f3('0x45')](',\x20'));_0x2e5b93[_0x39f3('0x46')]();}else{var _0x3e4aa8=_[_0x39f3('0x47')](_0x4bc784[_0x5e318d[_0x39f3('0x2c')]+'Queues'],handleFindQueue(_0x4bc495[_0x39f3('0x33')]));if(_0x3e4aa8){startRouting(_0x3a2405,_0x3e4aa8,_0x5e318d,_0x4bc784);var _0x1a0374=(_0x3e4aa8[_0x39f3('0x3e')]||0xa)*0x3e8;var _0x2eb842=(_0x4bc495[_0x39f3('0x3e')]||0x14)*0x3e8;var _0x31709b;if(_0x1a0374>_0x2eb842){_0x2eb842=_0x1a0374;}var _0x586db7=seqqueue[_0x39f3('0x48')](_0x1a0374);_0x586db7['id']=_0x3a2405;_0x586db7[_0x39f3('0x49')]=_0x1a0374;_0x586db7[_0x39f3('0x4a')]=_0x2eb842;_0x586db7[_0x39f3('0x2c')]=_0x5e318d[_0x39f3('0x2c')];_0x4bc784[_0x39f3('0x4b')][_0x3a2405]['on'](_0x39f3('0x4c'),function(){logger[_0x39f3('0x3a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3a2405);stopRouting(_0x3a2405,_0x3e4aa8,_0x5e318d,_0x4bc784);clearTimeout(_0x31709b);_0x31709b=undefined;_0x586db7[_0x39f3('0x4d')](!![]);if(_0x4bc784['rules'][_0x3a2405]){delete _0x4bc784['rules'][_0x3a2405];}_0x2e5b93[_0x39f3('0x46')]();});_0x4bc784[_0x39f3('0x4b')][_0x3a2405]['on'](_0x39f3('0x4e'),function(){if(_0x4bc784['rules'][_0x3a2405]){delete _0x4bc784['rules'][_0x3a2405];}});_0x31709b=setTimeout(function(){logger[_0x39f3('0x3a')](_0x39f3('0x4f'),_0x3a2405);endRouting(_0x3a2405,_0x3e4aa8,_0x5e318d,_0x4bc784);clearTimeout(_0x31709b);_0x586db7['close'](!![]);_0x2e5b93['next']();},_0x2eb842);switch(_0x3e4aa8[_0x39f3('0x50')]){case'rrmemory':strategy[_0x39f3('0x51')](_0x586db7,_0x3e4aa8,_0x4bc784,_0x5e318d);break;default:strategy['beepall'](_0x586db7,_0x3e4aa8,_0x4bc784,_0x5e318d);}}else{logger[_0x39f3('0x37')](_0x39f3('0x52'),_0x3a2405,_0x4bc495['name']);_0x2e5b93[_0x39f3('0x46')]();}}}catch(_0x159aad){console[_0x39f3('0x53')](_0x159aad);logger[_0x39f3('0x37')]('[%s][QUEUE]\x20%s',_0x3a2405,_0x159aad[_0x39f3('0x54')]);_0x2e5b93[_0x39f3('0x46')]();}};}; \ 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 0325278..45f1d47 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 _0x5178=['isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x5178,0x171));var _0x8517=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5178[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var uuid=require(_0x8517('0x0'));var util=require(_0x8517('0x1'));var logger=require(_0x8517('0x2'))(_0x8517('0x3'));var Agent=function(_0x38d5b3,_0x5e0a44,_0x483381,_0x3ed6a5){this[_0x8517('0x4')]=uuid['v4']();this['squeue']=_0x38d5b3;this[_0x8517('0x5')]=_0x5e0a44;this['realtime']=_0x483381;this[_0x8517('0x3')]=_0x3ed6a5;this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')][_0x8517('0x9')](this),this['handleTimeout'][_0x8517('0x9')](this));this['squeue']['on']('timeout',this[_0x8517('0xa')][_0x8517('0x9')](this));this['squeue']['on'](_0x8517('0xb'),this[_0x8517('0xc')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0x7')]=function(){this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')]['bind'](this),this[_0x8517('0xa')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0xc')]=function(){this[_0x8517('0xa')](!![]);};Agent['prototype'][_0x8517('0x8')]=function(){logger[_0x8517('0xe')](_0x8517('0xf'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);if(_[_0x8517('0x10')](this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']])){logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}else{if(this[_0x8517('0x3')][_0x8517('0x14')]||util[_0x8517('0x15')](this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']],this['squeue']['channel'],![])){this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=!![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x8517('0x17')](this[_0x8517('0x11')],this[_0x8517('0x3')],this[_0x8517('0x5')],this[_0x8517('0x6')][_0x8517('0x18')]);util['showNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],null,this[_0x8517('0x3')]);util['writeLog'](this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x8517('0x19')+(this[_0x8517('0x3')][_0x8517('0x14')]?_0x8517('0x1a'):''));}else{logger['debug'](_0x8517('0x1b'),this['squeue']['id'],this[_0x8517('0x5')]['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}}};Agent[_0x8517('0xd')][_0x8517('0xa')]=function(_0x1b2423){if(_['isNil'](this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']])){return logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);}else{logger[_0x8517('0xe')](_0x8517('0x1c'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);util['hideNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this['agent']['id']],null,this['routing']);this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']][_0x8517('0x1d')]=undefined;util[_0x8517('0x1e')](this[_0x8517('0x11')],this['routing'],this[_0x8517('0x5')],this['squeue'][_0x8517('0x18')]);util[_0x8517('0x1f')](this['squeue']['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x1b2423?_0x8517('0x20'):_0x8517('0x21'));}if(!_0x1b2423){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1){return new Agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1);}module[_0x8517('0x22')]=agent; \ No newline at end of file +var _0x2123=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','showNotification','writeLog','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','removeWaitingNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','timeout','handleTimeout','drained','handleDrained','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime'];(function(_0x31c1c3,_0x412fa9){var _0x588171=function(_0x4caeff){while(--_0x4caeff){_0x31c1c3['push'](_0x31c1c3['shift']());}};_0x588171(++_0x412fa9);}(_0x2123,0x190));var _0x3212=function(_0x4ba739,_0x803227){_0x4ba739=_0x4ba739-0x0;var _0xddb1aa=_0x2123[_0x4ba739];return _0xddb1aa;};'use strict';var _=require(_0x3212('0x0'));var uuid=require(_0x3212('0x1'));var util=require(_0x3212('0x2'));var logger=require(_0x3212('0x3'))(_0x3212('0x4'));var Agent=function(_0x2ff863,_0x8c047,_0x2e951f,_0x304f80){this[_0x3212('0x5')]=uuid['v4']();this[_0x3212('0x6')]=_0x2ff863;this[_0x3212('0x7')]=_0x8c047;this['realtime']=_0x2e951f;this[_0x3212('0x4')]=_0x304f80;this[_0x3212('0x6')][_0x3212('0x8')](this['handleRun'][_0x3212('0x9')](this),this['handleTimeout'][_0x3212('0x9')](this));this[_0x3212('0x6')]['on'](_0x3212('0xa'),this[_0x3212('0xb')]['bind'](this));this['squeue']['on'](_0x3212('0xc'),this[_0x3212('0xd')][_0x3212('0x9')](this));};Agent[_0x3212('0xe')][_0x3212('0x8')]=function(){this[_0x3212('0x6')][_0x3212('0x8')](this[_0x3212('0xf')][_0x3212('0x9')](this),this[_0x3212('0xb')][_0x3212('0x9')](this));};Agent[_0x3212('0xe')][_0x3212('0xd')]=function(){this[_0x3212('0xb')](!![]);};Agent[_0x3212('0xe')][_0x3212('0xf')]=function(){logger[_0x3212('0x10')](_0x3212('0x11'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);if(_[_0x3212('0x12')](this[_0x3212('0x13')]['agents'][this[_0x3212('0x7')]['id']])){logger[_0x3212('0x10')](_0x3212('0x14'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);setTimeout(this[_0x3212('0x8')][_0x3212('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x3212('0x15')](this['squeue']['id'],this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']],this[_0x3212('0x6')][_0x3212('0x17')],![])){this['realtime'][_0x3212('0x16')][this[_0x3212('0x7')]['id']]['busy']=!![];this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this[_0x3212('0x13')],this[_0x3212('0x4')],this[_0x3212('0x7')],this[_0x3212('0x6')][_0x3212('0x17')]);util[_0x3212('0x18')](this['notificationId'],this['squeue']['id'],this[_0x3212('0x13')]['agents'][this[_0x3212('0x7')]['id']],null,this[_0x3212('0x4')]);util[_0x3212('0x19')](this['squeue']['id'],this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']],'RINGING'+(this[_0x3212('0x4')][_0x3212('0x1a')]?_0x3212('0x1b'):''));}else{logger[_0x3212('0x10')](_0x3212('0x1c'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);setTimeout(this[_0x3212('0x8')][_0x3212('0x9')](this),0x3e8);}}};Agent[_0x3212('0xe')][_0x3212('0xb')]=function(_0x3c0b9b){if(_['isNil'](this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']])){return logger[_0x3212('0x10')](_0x3212('0x14'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);}else{logger['debug'](_0x3212('0x1d'),this['squeue']['id'],this[_0x3212('0x7')]['id']);util['hideNotification'](this[_0x3212('0x5')],this['squeue']['id'],this['realtime'][_0x3212('0x16')][this['agent']['id']],null,this[_0x3212('0x4')]);this[_0x3212('0x13')][_0x3212('0x16')][this['agent']['id']][_0x3212('0x1e')]=![];this[_0x3212('0x13')][_0x3212('0x16')][this['agent']['id']][_0x3212('0x1f')]=undefined;util[_0x3212('0x20')](this[_0x3212('0x13')],this[_0x3212('0x4')],this[_0x3212('0x7')],this['squeue'][_0x3212('0x17')]);util[_0x3212('0x19')](this[_0x3212('0x6')]['id'],this['realtime'][_0x3212('0x16')][this[_0x3212('0x7')]['id']],_0x3c0b9b?_0x3212('0x21'):_0x3212('0x22'));}if(!_0x3c0b9b){setTimeout(this['push'][_0x3212('0x9')](this),0x3e8);}};function agent(_0x3f157c,_0xf5d848,_0x39ffd0,_0x5ae0cc){return new Agent(_0x3f157c,_0xf5d848,_0x39ffd0,_0x5ae0cc);}module['exports']=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 a54fb56..8bc9658 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 _0x22bd=['length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','agents','RINGING','busy','busyQueue','name','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','removeWaitingNotification','exports','uuid','./util','routing','queue','realtime','squeue','handleRun','bind','handleTimeout','drained','handleDrained','push','isNil','Agents'];(function(_0x1991af,_0x1adb5a){var _0x5645a4=function(_0x49eb7c){while(--_0x49eb7c){_0x1991af['push'](_0x1991af['shift']());}};_0x5645a4(++_0x1adb5a);}(_0x22bd,0x124));var _0xd22b=function(_0x531b9e,_0x471449){_0x531b9e=_0x531b9e-0x0;var _0x4394fc=_0x22bd[_0x531b9e];return _0x4394fc;};'use strict';var _=require('lodash');var uuid=require(_0xd22b('0x0'));var util=require(_0xd22b('0x1'));var logger=require('../../../../../config/logger')(_0xd22b('0x2'));var Beepall=function(_0x1fe2ac,_0x24f05b,_0x4a2d54,_0x594a5b){this['notificationId']=uuid['v4']();this['squeue']=_0x1fe2ac;this[_0xd22b('0x3')]=_0x24f05b;this[_0xd22b('0x4')]=_0x4a2d54;this[_0xd22b('0x2')]=_0x594a5b;this[_0xd22b('0x5')]['push'](this[_0xd22b('0x6')][_0xd22b('0x7')](this),this[_0xd22b('0x8')]['bind'](this));this['squeue']['on']('timeout',this[_0xd22b('0x8')]['bind'](this));this[_0xd22b('0x5')]['on'](_0xd22b('0x9'),this[_0xd22b('0xa')]['bind'](this));};Beepall['prototype'][_0xd22b('0xb')]=function(){this[_0xd22b('0x5')][_0xd22b('0xb')](this[_0xd22b('0x6')][_0xd22b('0x7')](this),this['handleTimeout'][_0xd22b('0x7')](this));};Beepall['prototype']['handleDrained']=function(){this[_0xd22b('0x8')](!![]);};Beepall['prototype'][_0xd22b('0x6')]=function(){var _0x422dca=!![];if(!_[_0xd22b('0xc')](this[_0xd22b('0x3')])&&!_[_0xd22b('0xc')](this['queue']['Agents'])&&this[_0xd22b('0x3')][_0xd22b('0xd')]['length']>0x0){for(var _0x3b9f15=0x0,_0x1ab969;_0x3b9f150x0){for(var _0x29fd6d=0x0,_0x291652;_0x29fd6d0x0&&_0x1b087c[_0x3d79ff+_0x6dce('0x21')]>=_0x1b087c[_0x3d79ff+_0x6dce('0x20')]){writeLog(_0x27021b,_0x1b087c,_0x3d79ff[_0x6dce('0x22')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6dce('0x23')]=function(_0x129ac2,_0x9a3087,_0x48139c,_0x18de9b,_0xba4869){return sendNotification(!![],_0x129ac2,_0x9a3087,_0x48139c,_0x18de9b,_0xba4869);};exports[_0x6dce('0x24')]=function(_0x1bf5c0,_0x5806c4,_0x4bbf16,_0x10da9d,_0x2726db){return sendNotification(![],_0x1bf5c0,_0x5806c4,_0x4bbf16,_0x10da9d,_0x2726db);};exports[_0x6dce('0x25')]=function(_0x44172e,_0x4246da,_0x1ab235){var _0x546607=_0x4246da['interaction'][_0x6dce('0x26')];if(!_0x546607&&_0x1ab235){_0x546607=_0x1ab235['id'];}var _0x44a716=_[_0x6dce('0x27')](_0x44172e[_0x4246da['channel']+_0x6dce('0x28')],function(_0x38d9d2){var _0x4c1452=_[_0x6dce('0x29')](_0x4246da[_0x6dce('0x2a')])+'InteractionId';return _0x38d9d2[_0x4c1452]===_0x4246da[_0x6dce('0x2b')]['id'];});if(!_0x44a716&&_0x546607){_0x44a716=_['some'](_0x44172e[_0x6dce('0x2c')][_0x546607][_0x4246da[_0x6dce('0x2a')]+_0x6dce('0x2d')],function(_0x3216ca){return _0x3216ca['id']===_0x4246da['interaction']['id'];});}return _0x44a716;};exports[_0x6dce('0x2e')]=function(_0x51a55f,_0x4d6d12,_0x2196db,_0x2b6c89){_0x51a55f[_0x6dce('0x2c')][_0x2196db['id']][_0x2b6c89+'WaitingInteractions'][_0x4d6d12['message']['id']]={'id':_0x4d6d12[_0x6dce('0x2b')]['id']};};exports[_0x6dce('0x2f')]=function(_0x3cec57,_0x8fb495,_0x1d27bc,_0x36046c){delete _0x3cec57[_0x6dce('0x2c')][_0x1d27bc['id']][_0x36046c+_0x6dce('0x2d')][_0x8fb495['message']['id']];};exports[_0x6dce('0x30')]=writeLog; \ No newline at end of file +var _0x8396=['UserId','some','channel','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','lodash','util','ioredis','../../../../../config/environment','../../../../../config/logger','redis','localhost','socket.io-emitter','format','user:%s','name','emit','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','checkWaitingNotifications','interaction'];(function(_0x5e9cde,_0x3dd798){var _0xfd7518=function(_0x35e269){while(--_0x35e269){_0x5e9cde['push'](_0x5e9cde['shift']());}};_0xfd7518(++_0x3dd798);}(_0x8396,0xd4));var _0x6839=function(_0x3e3aa9,_0x34a007){_0x3e3aa9=_0x3e3aa9-0x0;var _0x1ebe9f=_0x8396[_0x3e3aa9];return _0x1ebe9f;};'use strict';var _=require(_0x6839('0x0'));var util=require(_0x6839('0x1'));var utils=require('../utils');var Redis=require(_0x6839('0x2'));var config=require(_0x6839('0x3'));var logger=require(_0x6839('0x4'))('routing');config['redis']=_['defaults'](config[_0x6839('0x5')],{'host':_0x6839('0x6'),'port':0x18eb});var io=require(_0x6839('0x7'))(new Redis(config['redis']));function sendNotification(_0x19d5f4,_0xc0f8b0,_0x598c9d,_0x86f2e7,_0x1608b3,_0x41150f){io['to'](util[_0x6839('0x8')](_0x6839('0x9'),_0x86f2e7[_0x6839('0xa')]))[_0x6839('0xb')]('user:save',_0x86f2e7);var _0x3f8051=_0x41150f||{};var _0x4452a1=_0x598c9d['split']('.');var _0x2ee3bc={'uniqueid':_0xc0f8b0,'channel':_0x4452a1[0x0],'id':_0x4452a1[0x1],'title':_0x4452a1[0x0]+'\x20interaction','interactionId':_0x4452a1[0x2],'queue':_0x1608b3?_0x1608b3['name']:null,'sound':_0x3f8051['account'][_0x6839('0xc')],'shake':_0x3f8051[_0x6839('0xd')][_0x6839('0xe')]};try{if(!_0x3f8051['body']){_0x3f8051[_0x6839('0xf')]={};}if(_0x1608b3){_0x3f8051['body'][_0x6839('0x10')]=_0x1608b3;}else if(_0x3f8051[_0x6839('0xf')][_0x6839('0x10')]){delete _0x3f8051[_0x6839('0xf')][_0x6839('0x10')];}_0x2ee3bc[_0x6839('0x11')]=utils[_0x6839('0x12')](_0x3f8051[_0x6839('0xd')][_0x6839('0x13')],_0x3f8051);}catch(_0x4bc2ee){_0x2ee3bc[_0x6839('0x11')]=_0x6839('0x14');logger[_0x6839('0x15')](util[_0x6839('0x8')](_0x6839('0x16'),_0xc0f8b0,_0x4bc2ee[_0x6839('0x17')]));}io['to'](util[_0x6839('0x8')](_0x6839('0x9'),_0x86f2e7['name']))[_0x6839('0xb')](util[_0x6839('0x8')](_0x6839('0x18'),_0x19d5f4?_0x6839('0x19'):_0x6839('0x1a')),_0x2ee3bc);}function writeLog(_0x3f8967,_0x69afd3,_0x2c6bf9){return logger[_0x6839('0x1b')](util[_0x6839('0x8')](_0x6839('0x1c'),_0x3f8967,_0x69afd3[_0x6839('0xa')],_0x2c6bf9));}exports[_0x6839('0x1d')]=function(_0x599486,_0x1bb014,_0x195a6b,_0x329bd0){if(_0x1bb014[_0x6839('0x1e')]){writeLog(_0x599486,_0x1bb014,_0x6839('0x1f'));return![];}if(!_0x1bb014[_0x6839('0x20')]){writeLog(_0x599486,_0x1bb014,_0x6839('0x21'));return![];}if(_0x1bb014[_0x195a6b+_0x6839('0x22')]){writeLog(_0x599486,_0x1bb014,_0x6839('0x23'));return![];}if(_0x329bd0&&_0x1bb014[_0x6839('0x24')](_0x195a6b+'Capacity')&&_0x1bb014[_0x6839('0x24')](_0x195a6b+_0x6839('0x25'))){if(_0x1bb014[_0x195a6b+_0x6839('0x26')]>0x0&&_0x1bb014[_0x195a6b+_0x6839('0x25')]>=_0x1bb014[_0x195a6b+_0x6839('0x26')]){writeLog(_0x599486,_0x1bb014,_0x195a6b[_0x6839('0x27')]()+_0x6839('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x5f388e,_0x640b7d,_0xa40cb5,_0x1ff799,_0x132e1c){return sendNotification(!![],_0x5f388e,_0x640b7d,_0xa40cb5,_0x1ff799,_0x132e1c);};exports['hideNotification']=function(_0x135ade,_0x177d0b,_0x2897c1,_0x5311d3,_0xeb336a){return sendNotification(![],_0x135ade,_0x177d0b,_0x2897c1,_0x5311d3,_0xeb336a);};exports[_0x6839('0x29')]=function(_0x15d969,_0x13ae05,_0x12eb2d){var _0x58fe7c=_0x13ae05[_0x6839('0x2a')][_0x6839('0x2b')];if(!_0x58fe7c&&_0x12eb2d){_0x58fe7c=_0x12eb2d['id'];}var _0x4d485b=_[_0x6839('0x2c')](_0x15d969[_0x13ae05['channel']+'QueuesWaitingInteractions'],function(_0x5546e8){var _0x177f54=_['capitalize'](_0x13ae05[_0x6839('0x2d')])+_0x6839('0x2e');return _0x5546e8[_0x177f54]===_0x13ae05[_0x6839('0x2a')]['id'];});if(!_0x4d485b&&_0x58fe7c){_0x4d485b=_[_0x6839('0x2c')](_0x15d969['agents'][_0x58fe7c][_0x13ae05[_0x6839('0x2d')]+_0x6839('0x2f')],function(_0x5b794d){return _0x5b794d['id']===_0x13ae05['interaction']['id'];});}return _0x4d485b;};exports[_0x6839('0x30')]=function(_0xfbe08e,_0x4e2f44,_0x53f6e3,_0x4c468f){_0xfbe08e[_0x6839('0x31')][_0x53f6e3['id']][_0x4c468f+_0x6839('0x2f')][_0x4e2f44['message']['id']]={'id':_0x4e2f44[_0x6839('0x2a')]['id']};};exports[_0x6839('0x32')]=function(_0x13eb22,_0x30f114,_0x1e5aaf,_0x54be5d){delete _0x13eb22[_0x6839('0x31')][_0x1e5aaf['id']][_0x54be5d+_0x6839('0x2f')][_0x30f114[_0x6839('0x17')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index cc336d7..4704e31 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 _0x395a=['error','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','body','next','stringify','validate','shelljs','lodash','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x1fdb8e,_0x2add5a){var _0xc6cf45=function(_0x2dc639){while(--_0x2dc639){_0x1fdb8e['push'](_0x1fdb8e['shift']());}};_0xc6cf45(++_0x2add5a);}(_0x395a,0x159));var _0xa395=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x395a[_0x79cd47];return _0x3b9484;};'use strict';var schema=require(_0xa395('0x0'));var sh=require(_0xa395('0x1'));var _=require(_0xa395('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0xa395('0x3'),'required':!![],'message':_0xa395('0x4')}});exports[_0xa395('0x5')]=function(_0x4e7666,_0x33d649){return function(_0x154073){try{var _0x28f745={'command':_0x33d649[0x0]};var _0x4e38ad=system['validate'](_0x28f745,{'typecast':!![]});if(_0x4e38ad[_0xa395('0x6')]){logger[_0xa395('0x7')](_0xa395('0x8'),_0x4e7666,_['map'](_0x4e38ad,_0xa395('0x9'))['join'](',\x20'));logger[_0xa395('0xa')](_0xa395('0xb'),_0x4e7666);_0x154073['next']();}else{var _0x1d0f8f=this;var _0x29c074=utils[_0xa395('0xc')](_0x33d649[0x0],this);logger[_0xa395('0xa')](_0xa395('0xd'),_0x4e7666,_0x29c074);sh[_0xa395('0xe')](_[_0xa395('0xf')](_0x29c074),function(_0x3deb08,_0x283756){logger[_0xa395('0xa')](_0xa395('0x10'),_0x4e7666,_0x3deb08);if(_0x3deb08==0x0){var _0x25c6a4=_0x283756[_0xa395('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x33d649[0x1])||_['isEmpty'](_0x33d649[0x1])){logger[_0xa395('0xa')](_0xa395('0x12'),_0x4e7666);_0x1d0f8f[_0xa395('0x13')][_0x33d649[0x1]]=_0x25c6a4;}else{logger[_0xa395('0xa')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4e7666,_0x33d649[0x1],_0x25c6a4);_0x1d0f8f[_0xa395('0x13')][_0x33d649[0x1]]=_0x25c6a4;}}_0x154073[_0xa395('0x14')]();});}}catch(_0xab9af7){logger['error']('[%s][SYSTEM]\x20%s',_0x4e7666,_['isObject'](_0xab9af7)?JSON[_0xa395('0x15')](_0xab9af7):_0xab9af7);logger[_0xa395('0xa')](_0xa395('0xb'),_0x4e7666);_0x154073[_0xa395('0x14')]();}};}; \ No newline at end of file +var _0xecd5=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xecd5,0x110));var _0x5ecd=function(_0x29a423,_0x5d01b1){_0x29a423=_0x29a423-0x0;var _0x22ac80=_0xecd5[_0x29a423];return _0x22ac80;};'use strict';var schema=require('validate');var sh=require(_0x5ecd('0x0'));var _=require(_0x5ecd('0x1'));var utils=require(_0x5ecd('0x2'));var logger=require('../../../../config/logger')(_0x5ecd('0x3'));var system=schema({'command':{'type':_0x5ecd('0x4'),'required':!![],'message':_0x5ecd('0x5')}});exports[_0x5ecd('0x6')]=function(_0x516d8e,_0x3995e5){return function(_0x4ecb3c){try{var _0x1ddbad={'command':_0x3995e5[0x0]};var _0x492eba=system['validate'](_0x1ddbad,{'typecast':!![]});if(_0x492eba[_0x5ecd('0x7')]){logger[_0x5ecd('0x8')](_0x5ecd('0x9'),_0x516d8e,_[_0x5ecd('0xa')](_0x492eba,_0x5ecd('0xb'))[_0x5ecd('0xc')](',\x20'));logger[_0x5ecd('0xd')](_0x5ecd('0xe'),_0x516d8e);_0x4ecb3c[_0x5ecd('0xf')]();}else{var _0x22781a=this;var _0x317051=utils[_0x5ecd('0x10')](_0x3995e5[0x0],this);logger['info'](_0x5ecd('0x11'),_0x516d8e,_0x317051);sh['exec'](_['trim'](_0x317051),function(_0x3f2e7c,_0x15dec9){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x516d8e,_0x3f2e7c);if(_0x3f2e7c==0x0){var _0x3eaad7=_0x15dec9[_0x5ecd('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x5ecd('0x13')](_0x3995e5[0x1])||_[_0x5ecd('0x14')](_0x3995e5[0x1])){logger['info'](_0x5ecd('0x15'),_0x516d8e);_0x22781a[_0x5ecd('0x16')][_0x3995e5[0x1]]=_0x3eaad7;}else{logger['info'](_0x5ecd('0x17'),_0x516d8e,_0x3995e5[0x1],_0x3eaad7);_0x22781a[_0x5ecd('0x16')][_0x3995e5[0x1]]=_0x3eaad7;}}_0x4ecb3c['next']();});}}catch(_0x458899){logger['error'](_0x5ecd('0x9'),_0x516d8e,_[_0x5ecd('0x18')](_0x458899)?JSON[_0x5ecd('0x19')](_0x458899):_0x458899);logger[_0x5ecd('0xd')](_0x5ecd('0xe'),_0x516d8e);_0x4ecb3c[_0x5ecd('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 93e8a04..63836a8 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 _0xbbca=['interaction','catch','[%s][TAG]\x20%s','stringify','finally','error','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','consequence','validate','length','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x4c56b6,_0x239082){var _0x1ee73a=function(_0x43687e){while(--_0x43687e){_0x4c56b6['push'](_0x4c56b6['shift']());}};_0x1ee73a(++_0x239082);}(_0xbbca,0x19e));var _0xabbc=function(_0x256091,_0x4f06dd){_0x256091=_0x256091-0x0;var _0x404d65=_0xbbca[_0x256091];return _0x404d65;};'use strict';var schema=require('validate');var _=require(_0xabbc('0x0'));var rpc={'chatInteraction':require(_0xabbc('0x1')),'openchannelInteraction':require(_0xabbc('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xabbc('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xabbc('0x4'))};var logger=require(_0xabbc('0x5'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xabbc('0x6')]=function(_0x2ae3e5,_0x2c826e,_0x569012,_0x4fce73){return function(_0x36263a){try{var _0x24abd3={'tag':_0x2c826e[0x0]};var _0x33d21d=tag[_0xabbc('0x7')](_0x24abd3,{'typecast':!![]});if(_0x33d21d[_0xabbc('0x8')]){logger['error']('[%s][TAG]\x20%s',_0x2ae3e5,_['map'](_0x33d21d,_0xabbc('0x9'))['join'](',\x20'));logger[_0xabbc('0xa')](_0xabbc('0xb'),_0x2ae3e5);_0x36263a[_0xabbc('0xc')]();}else{var _0x30e03c={'ids':[_0x2c826e[0x0]]};if(rpc[_0x4fce73[_0xabbc('0xd')]+_0xabbc('0xe')]){rpc[_0x4fce73[_0xabbc('0xd')]+_0xabbc('0xe')][_0xabbc('0xf')](_0x4fce73['interaction']['id'],_0x30e03c)[_0xabbc('0x10')](function(_0x3ac20c){logger[_0xabbc('0xa')](_0xabbc('0x11'),_0x2ae3e5,_0x2c826e[0x1],_0x4fce73['channel'],_0x4fce73[_0xabbc('0x12')]['id']);})[_0xabbc('0x13')](function(_0x5de144){logger['error'](_0xabbc('0x14'),_0x2ae3e5,JSON[_0xabbc('0x15')](_0x5de144));logger[_0xabbc('0xa')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2ae3e5);})[_0xabbc('0x16')](function(){_0x36263a[_0xabbc('0xc')]();});}}}catch(_0x219ce1){logger[_0xabbc('0x17')](_0xabbc('0x14'),_0x2ae3e5,_['isObject'](_0x219ce1)?JSON[_0xabbc('0x15')](_0x219ce1):_0x219ce1);logger[_0xabbc('0xa')](_0xabbc('0xb'),_0x2ae3e5);_0x36263a['next']();}};}; \ No newline at end of file +var _0xdf6b=['[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','info','catch','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xdf6b,0x179));var _0xbdf6=function(_0x52b71f,_0x5118c4){_0x52b71f=_0x52b71f-0x0;var _0x423378=_0xdf6b[_0x52b71f];return _0x423378;};'use strict';var schema=require(_0xbdf6('0x0'));var _=require(_0xbdf6('0x1'));var rpc={'chatInteraction':require(_0xbdf6('0x2')),'openchannelInteraction':require(_0xbdf6('0x3')),'smsInteraction':require(_0xbdf6('0x4')),'mailInteraction':require(_0xbdf6('0x5')),'faxInteraction':require(_0xbdf6('0x6')),'whatsappInteraction':require(_0xbdf6('0x7'))};var logger=require(_0xbdf6('0x8'))(_0xbdf6('0x9'));var tag=schema({'tag':{'type':_0xbdf6('0xa'),'required':!![],'message':_0xbdf6('0xb')}});exports[_0xbdf6('0xc')]=function(_0x4803a7,_0x3f56ef,_0x1a4e26,_0x186812){return function(_0x29dc05){try{var _0x5e6485={'tag':_0x3f56ef[0x0]};var _0xc9f12e=tag[_0xbdf6('0x0')](_0x5e6485,{'typecast':!![]});if(_0xc9f12e[_0xbdf6('0xd')]){logger[_0xbdf6('0xe')](_0xbdf6('0xf'),_0x4803a7,_[_0xbdf6('0x10')](_0xc9f12e,_0xbdf6('0x11'))['join'](',\x20'));logger['info'](_0xbdf6('0x12'),_0x4803a7);_0x29dc05[_0xbdf6('0x13')]();}else{var _0x2701f3={'ids':[_0x3f56ef[0x0]]};if(rpc[_0x186812[_0xbdf6('0x14')]+'Interaction']){rpc[_0x186812[_0xbdf6('0x14')]+_0xbdf6('0x15')][_0xbdf6('0x16')](_0x186812[_0xbdf6('0x17')]['id'],_0x2701f3)['then'](function(_0x42ad85){logger[_0xbdf6('0x18')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x4803a7,_0x3f56ef[0x1],_0x186812[_0xbdf6('0x14')],_0x186812[_0xbdf6('0x17')]['id']);})[_0xbdf6('0x19')](function(_0x43beef){logger[_0xbdf6('0xe')](_0xbdf6('0xf'),_0x4803a7,JSON[_0xbdf6('0x1a')](_0x43beef));logger[_0xbdf6('0x18')](_0xbdf6('0x12'),_0x4803a7);})['finally'](function(){_0x29dc05[_0xbdf6('0x13')]();});}}}catch(_0x56c7f8){logger[_0xbdf6('0xe')]('[%s][TAG]\x20%s',_0x4803a7,_[_0xbdf6('0x1b')](_0x56c7f8)?JSON[_0xbdf6('0x1a')](_0x56c7f8):_0x56c7f8);logger[_0xbdf6('0x18')](_0xbdf6('0x12'),_0x4803a7);_0x29dc05[_0xbdf6('0x13')]();}};}; \ 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 ab2030a..ed1310d 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 _0xd300=['includes','push','?params=','title','jsonrpc','2.0','login','stringify','utf8','application/json-rpc','then','parse','result','logged','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','next','request-promise','../../../../config/logger','lodash','consequence','replace'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xd300,0x1c6));var _0x0d30=function(_0x128715,_0xbad57e){_0x128715=_0x128715-0x0;var _0x5be107=_0xd300[_0x128715];return _0x5be107;};'use strict';var rp=require(_0x0d30('0x0'));var logger=require(_0x0d30('0x1'))('routing');var _=require(_0x0d30('0x2'));var arr=[];exports[_0x0d30('0x3')]=function(_0xb3da08,_0x28a451){return function(_0x1dccca){var _0x5b2b57=_0x28a451[0xa];var _0x2516e5=_0x28a451[0xb];var _0x1d9c85=_0x28a451[0xc];var _0x2201cf=_0x28a451[0xd];var _0x4ec063=_0x28a451[0xe];var _0x3a5890=_0x28a451[0xf][_0x0d30('0x4')](/\n/g,'\x20-\x20');var _0x198b81=_0x28a451[0x10][_0x0d30('0x4')](/\n/g,'\x20');if(!arr[_0x0d30('0x5')](_0x2516e5)){arr[_0x0d30('0x6')](_0x2516e5);var _0x221ed5=_0x28a451[0x3];var _0x2ecc2b=_0x28a451[0x4];var _0x1fbf28=_0x28a451[0x1];var _0x1f8e1c=_0x28a451[0x0];var _0x4b64b1={};_0x4b64b1['urlOnAnswer']=_0x28a451[0x8]+'?params='+_0x1d9c85+'|'+_0x5b2b57+'|'+_0x2201cf+'|'+_0x2516e5+'|'+_0x4ec063;_0x4b64b1['urlOnRing']=_0x28a451[0x7]+_0x0d30('0x7')+_0x1d9c85+'|'+_0x5b2b57+'|'+_0x2201cf+'|'+_0x2516e5+'|'+_0x4ec063+'|'+_0x3a5890+'|'+_0x198b81;_0x4b64b1[_0x0d30('0x8')]=_0x28a451[0x9];var _0x2dccc8={};_0x2dccc8[_0x0d30('0x9')]=_0x0d30('0xa');_0x2dccc8['method']=_0x0d30('0xb');var _0x75012b=[];_0x75012b[_0x0d30('0x6')](_0x28a451[0x2]);_0x75012b[_0x0d30('0x6')](_0x28a451[0x5]);_0x75012b[_0x0d30('0x6')](_0x28a451[0x6]);_0x2dccc8['params']=_0x75012b;_0x2dccc8['id']=0x1;var _0xdf7d83=JSON[_0x0d30('0xc')](_0x2dccc8);var _0x104458={'encoding':_0x0d30('0xd'),'method':'POST','timeout':0x2710,'url':_0x221ed5,'headers':{'Content-Type':_0x0d30('0xe')},'body':_0xdf7d83};return rp(_0x104458)[_0x0d30('0xf')](function(_0x4882f7){const _0x228381=JSON[_0x0d30('0x10')](_0x4882f7);if(!_0x228381[_0x0d30('0x11')][_0x0d30('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x476f3e=_0x2516e5;var _0x2c0eb5='channelId='+_0x1fbf28+'&serviceId='+_0x1f8e1c+_0x0d30('0x13')+_0x476f3e+_0x0d30('0x14')+JSON['stringify'](_0x4b64b1);var _0x14aa65=_0x2ecc2b+'?'+_0x2c0eb5;return rp(_0x14aa65);})[_0x0d30('0xf')](function(_0x532c88){logger['info'](_0x0d30('0x15'),_0xb3da08,_0x532c88);_0x1dccca[_0x0d30('0x16')]();})[_0x0d30('0x17')](function(_0x4f55e8){logger[_0x0d30('0x18')]('[%s][TVOX]\x20%s',_0xb3da08,_[_0x0d30('0x19')](_0x4f55e8)?JSON[_0x0d30('0xc')](_0x4f55e8):_0x4f55e8);_0x1dccca[_0x0d30('0x16')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0xb3da08);_0x1dccca[_0x0d30('0x1a')]();}};}; \ No newline at end of file +var _0x879d=['login','push','params','stringify','utf8','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','consequence','replace','includes','?params=','urlOnRing','title','jsonrpc','2.0'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x879d,0xb0));var _0xd879=function(_0x25e509,_0x246456){_0x25e509=_0x25e509-0x0;var _0x342ab7=_0x879d[_0x25e509];return _0x342ab7;};'use strict';var rp=require('request-promise');var logger=require(_0xd879('0x0'))(_0xd879('0x1'));var _=require('lodash');var arr=[];exports[_0xd879('0x2')]=function(_0x5c5921,_0x4748cc){return function(_0x480571){var _0x567f32=_0x4748cc[0xa];var _0x59c42d=_0x4748cc[0xb];var _0x101e7b=_0x4748cc[0xc];var _0x12b1d6=_0x4748cc[0xd];var _0x34d42d=_0x4748cc[0xe];var _0x7893ea=_0x4748cc[0xf][_0xd879('0x3')](/\n/g,'\x20-\x20');var _0x40cdf9=_0x4748cc[0x10][_0xd879('0x3')](/\n/g,'\x20');if(!arr[_0xd879('0x4')](_0x59c42d)){arr['push'](_0x59c42d);var _0x121232=_0x4748cc[0x3];var _0x1e1ee1=_0x4748cc[0x4];var _0x23c877=_0x4748cc[0x1];var _0x218b94=_0x4748cc[0x0];var _0x33aafd={};_0x33aafd['urlOnAnswer']=_0x4748cc[0x8]+_0xd879('0x5')+_0x101e7b+'|'+_0x567f32+'|'+_0x12b1d6+'|'+_0x59c42d+'|'+_0x34d42d;_0x33aafd[_0xd879('0x6')]=_0x4748cc[0x7]+_0xd879('0x5')+_0x101e7b+'|'+_0x567f32+'|'+_0x12b1d6+'|'+_0x59c42d+'|'+_0x34d42d+'|'+_0x7893ea+'|'+_0x40cdf9;_0x33aafd[_0xd879('0x7')]=_0x4748cc[0x9];var _0x2e705e={};_0x2e705e[_0xd879('0x8')]=_0xd879('0x9');_0x2e705e['method']=_0xd879('0xa');var _0x23b599=[];_0x23b599[_0xd879('0xb')](_0x4748cc[0x2]);_0x23b599['push'](_0x4748cc[0x5]);_0x23b599[_0xd879('0xb')](_0x4748cc[0x6]);_0x2e705e[_0xd879('0xc')]=_0x23b599;_0x2e705e['id']=0x1;var _0x4fb9b3=JSON[_0xd879('0xd')](_0x2e705e);var _0x41b088={'encoding':_0xd879('0xe'),'method':'POST','timeout':0x2710,'url':_0x121232,'headers':{'Content-Type':_0xd879('0xf')},'body':_0x4fb9b3};return rp(_0x41b088)['then'](function(_0x1bb8c1){const _0xf5a37b=JSON[_0xd879('0x10')](_0x1bb8c1);if(!_0xf5a37b[_0xd879('0x11')][_0xd879('0x12')]){throw new Error(_0xd879('0x13'));}var _0x13930b=_0x59c42d;var _0x3f148d=_0xd879('0x14')+_0x23c877+'&serviceId='+_0x218b94+_0xd879('0x15')+_0x13930b+'&data='+JSON[_0xd879('0xd')](_0x33aafd);var _0x5b8d23=_0x1e1ee1+'?'+_0x3f148d;return rp(_0x5b8d23);})['then'](function(_0xa7cfac){logger[_0xd879('0x16')](_0xd879('0x17'),_0x5c5921,_0xa7cfac);_0x480571[_0xd879('0x18')]();})[_0xd879('0x19')](function(_0x2fc043){logger[_0xd879('0x1a')](_0xd879('0x1b'),_0x5c5921,_[_0xd879('0x1c')](_0x2fc043)?JSON[_0xd879('0xd')](_0x2fc043):_0x2fc043);_0x480571['stop']();});}else{logger[_0xd879('0x16')](_0xd879('0x1d'),_0x5c5921);_0x480571[_0xd879('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 56ce38c..7a4ec59 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x333194,_0x48d930){var _0x369f5f=function(_0x1dccfb){while(--_0x1dccfb){_0x333194['push'](_0x333194['shift']());}};_0x369f5f(++_0x48d930);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x52e3ed,_0x1d402f){var _0x5df22b=function(_0x210b22){while(--_0x210b22){_0x52e3ed['push'](_0x52e3ed['shift']());}};_0x5df22b(++_0x1d402f);}(_0xe706,0xa3));var _0x6e70=function(_0x486ab6,_0x257c0a){_0x486ab6=_0x486ab6-0x0;var _0x1ce5ea=_0xe706[_0x486ab6];return _0x1ce5ea;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 68036f5..448704c 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 _0x6f69=['http','stringify','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','checkWaitingNotifications','applications','length','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','message','ContactId','body','./interval','condition','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','.js','execute','Applications\x20executed','matchPath','emit','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x6f69,0x67));var _0x96f6=function(_0x345ffb,_0x2834a0){_0x345ffb=_0x345ffb-0x0;var _0x41522e=_0x6f69[_0x345ffb];return _0x41522e;};'use strict';var _=require('lodash');var util=require(_0x96f6('0x0'));var path=require(_0x96f6('0x1'));var fs=require('fs');var jayson=require(_0x96f6('0x2'));var BPromise=require(_0x96f6('0x3'));var utils=require(_0x96f6('0x4'));var sUtils=require(_0x96f6('0x5'));var logger=require(_0x96f6('0x6'))(_0x96f6('0x7'));var rpc={'openchannelQueueReport':require(_0x96f6('0x8')),'mailQueueReport':require(_0x96f6('0x9')),'chatQueueReport':require(_0x96f6('0xa')),'smsQueueReport':require(_0x96f6('0xb')),'faxQueueReport':require(_0x96f6('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x96f6('0xd'));function getId(_0x5d20d9,_0x3e1a88,_0xc6e277){return util[_0x96f6('0xe')](_0x96f6('0xf'),_0x5d20d9,_0x3e1a88||0x0,_0xc6e277||0x0);}function getIntervals(_0x54cb0,_0x355108){var _0x473d5b=[];if(!_['isNil'](_0x355108['IntervalId'])&&!_[_0x96f6('0x10')](_0x54cb0[_0x355108[_0x96f6('0x11')]])&&!_[_0x96f6('0x10')](_0x54cb0[_0x355108[_0x96f6('0x11')]][_0x96f6('0x12')])){_0x473d5b=_[_0x96f6('0x13')](_0x54cb0[_0x355108[_0x96f6('0x11')]][_0x96f6('0x12')],_0x96f6('0x14'));}else if(!_[_0x96f6('0x10')](_0x355108[_0x96f6('0x14')])){_0x473d5b=[_0x355108[_0x96f6('0x14')]];}return _0x473d5b;}exports[_0x96f6('0x15')]=function(_0x134a11){_0x134a11[_0x96f6('0x16')]={};return new BPromise(function(_0x575016,_0x2bd616){var _0x2b8e75={'Start':function(_0x476e1f){var _0x3d23e1=this;return new Promise(function(_0x1ebb2f,_0x5835ef){if(_0x476e1f){try{var _0x25b2ba=[];var _0x2853cb=getId(_0x476e1f[_0x96f6('0x17')],_0x476e1f['message']?_0x476e1f['message']['id']:0x0,_0x476e1f[_0x96f6('0x18')]?_0x476e1f[_0x96f6('0x18')]['id']:0x0);var _0x1fb08b=sUtils[_0x96f6('0x19')](_0x134a11,_0x476e1f);if(!_0x1fb08b&&_0x476e1f[_0x96f6('0x1a')]&&_['isArray'](_0x476e1f['applications'])&&_0x476e1f[_0x96f6('0x1a')][_0x96f6('0x1b')]){for(var _0x69a12a=0x0;_0x69a12a<_0x476e1f[_0x96f6('0x1a')][_0x96f6('0x1b')];_0x69a12a+=0x1){var _0x3a2b71=_0x476e1f['applications'][_0x69a12a];if(fs['existsSync'](path[_0x96f6('0x1c')](__dirname,_0x96f6('0x1a'),_0x3a2b71[_0x96f6('0x1d')]+'.js'))){var _0x130e57=[];switch(_0x3a2b71[_0x96f6('0x1d')][_0x96f6('0x1e')]()){case _0x96f6('0x1f'):var _0x315252=_0x3a2b71[_0x96f6('0x20')][_0x96f6('0x21')](',');if(_0x476e1f[_0x96f6('0x17')]===_0x96f6('0x22')){_0x130e57['push'](_0x315252[0x0]);_0x130e57[_0x96f6('0x23')](_0x315252[0x1]);_0x130e57[_0x96f6('0x23')](_0x315252[_0x96f6('0x24')](0x2,_0x315252[_0x96f6('0x1b')])['join'](','));}else{_0x130e57[_0x96f6('0x23')](_0x315252[0x0]);_0x130e57['push'](_0x315252[_0x96f6('0x24')](0x1,_0x315252[_0x96f6('0x1b')])[_0x96f6('0x1c')](','));}break;case'dialogflow':var _0x3d7a57=_0x3a2b71['appdata'][_0x96f6('0x21')](',');_0x130e57[_0x96f6('0x23')](_0x3d7a57[0x0]);_0x130e57[_0x96f6('0x23')](_0x3d7a57[0x1]);_0x130e57[_0x96f6('0x23')](_0x3d7a57[_0x96f6('0x24')](0x2,_0x3d7a57[_0x96f6('0x1b')])[_0x96f6('0x1c')](','));break;case'dialogflowv2':var _0x138779=_0x3a2b71['appdata'][_0x96f6('0x21')](',');_0x130e57[_0x96f6('0x23')](_0x138779[0x0]);_0x130e57[_0x96f6('0x23')](_0x138779[0x1]);_0x130e57[_0x96f6('0x23')](_0x138779[0x2]);_0x130e57[_0x96f6('0x23')](_0x138779[0x3]);_0x130e57[_0x96f6('0x23')](_0x138779[_0x96f6('0x24')](0x4,_0x138779['length'])[_0x96f6('0x1c')](','));break;case _0x96f6('0x25'):var _0x23992e=_0x3a2b71['appdata']['split'](',');_0x130e57[_0x96f6('0x23')](_0x23992e[0x0]);_0x130e57['push'](_0x23992e[0x1]);_0x130e57[_0x96f6('0x23')](_0x23992e[0x2]);_0x130e57[_0x96f6('0x23')](_0x23992e[0x3]);_0x130e57[_0x96f6('0x23')](_0x23992e[_0x96f6('0x24')](0x4,_0x23992e['length'])[_0x96f6('0x1c')](','));break;case'message':_0x130e57[_0x96f6('0x23')](_0x3a2b71['appdata']);break;case'tag':_0x130e57['push'](_0x3a2b71[_0x96f6('0x26')]);_0x130e57['push'](_0x3a2b71['appdata']);break;case _0x96f6('0x27'):var _0x2af674=utils[_0x96f6('0x28')](_0x476e1f[_0x96f6('0x29')][_0x96f6('0x2a')],_0x476e1f);var _0x442642=_0x3a2b71[_0x96f6('0x20')][_0x96f6('0x21')](',');_0x130e57[_0x96f6('0x23')](_0x442642[0x0]);_0x130e57[_0x96f6('0x23')](_0x442642[0x1]);_0x130e57[_0x96f6('0x23')](_0x442642[0x2]);_0x130e57[_0x96f6('0x23')](_0x442642[0x3]);_0x130e57[_0x96f6('0x23')](_0x442642[0x4]);_0x130e57[_0x96f6('0x23')](_0x442642[0x5]);_0x130e57[_0x96f6('0x23')](_0x442642[0x6]);_0x130e57[_0x96f6('0x23')](_0x442642[0x7]);_0x130e57['push'](_0x442642[0x8]);_0x130e57[_0x96f6('0x23')](_0x442642[0x9]);_0x130e57['push'](_0x442642[0xa]);_0x130e57[_0x96f6('0x23')](_0x476e1f[_0x96f6('0x18')]['id']);_0x130e57[_0x96f6('0x23')](_0x476e1f[_0x96f6('0x2b')]['id']);_0x130e57[_0x96f6('0x23')](_0x3a2b71['ChatWebsiteId']);_0x130e57[_0x96f6('0x23')](_0x476e1f[_0x96f6('0x18')][_0x96f6('0x2c')]);_0x130e57['push'](_0x476e1f['body'][_0x96f6('0x2d')]);_0x130e57['push'](_0x2af674);break;default:_0x130e57=_['isNil'](_0x3a2b71[_0x96f6('0x20')])?[]:_0x3a2b71[_0x96f6('0x20')][_0x96f6('0x21')](',');}var _0x1529d3={'id':util['format']('%s:%s:%s',_0x2853cb,_0x3a2b71['id'],_0x3a2b71[_0x96f6('0x1d')]),'condition':require(_0x96f6('0x2e'))[_0x96f6('0x2f')](_0x2853cb,getIntervals(_0x134a11['intervals'],_0x3a2b71),_0x134a11),'consequence':require(_0x96f6('0x30')+_0x3a2b71[_0x96f6('0x1d')])[_0x96f6('0x31')](_0x2853cb,_0x130e57,_0x134a11,_0x476e1f),'p':_0x3a2b71['priority']||0x0};logger[_0x96f6('0x32')](_0x96f6('0x33'),_0x1529d3['id'],_0x96f6('0x34'),getIntervals(_0x134a11[_0x96f6('0x35')],_0x3a2b71)[_0x96f6('0x1c')](_0x96f6('0x36')));_0x25b2ba[_0x96f6('0x23')](_0x1529d3);}else{logger[_0x96f6('0x37')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x96f6('0x1c')](__dirname,_0x96f6('0x1a'),_0x3a2b71[_0x96f6('0x1d')]+_0x96f6('0x38')));}}_0x134a11[_0x96f6('0x16')][_0x2853cb]=new RuleEngine(_0x25b2ba);_0x134a11[_0x96f6('0x16')][_0x2853cb][_0x96f6('0x39')](_0x476e1f,function(_0x219c28){logger[_0x96f6('0x32')](_0x96f6('0x3a'),JSON['stringify'](_0x219c28[_0x96f6('0x3b')]));if(_0x134a11['rules'][_0x2853cb]){_0x134a11[_0x96f6('0x16')][_0x2853cb][_0x96f6('0x3c')]('complete');}});return _0x1ebb2f({'code':0xc8,'message':_0x476e1f});}else{if(_0x1fb08b){logger['info'](util[_0x96f6('0xe')]('Skipped\x20routing\x20for\x20%s',_0x2853cb));}else{logger[_0x96f6('0x32')]('No\x20applications\x20to\x20execute');}return _0x1ebb2f({'code':0xc8,'message':_0x476e1f});}}catch(_0x23aa7c){logger['error'](_0x23aa7c[_0x96f6('0x3d')]);return _0x5835ef(_0x3d23e1[_0x96f6('0x37')](0x1f4,_0x23aa7c));}}return _0x5835ef(_0x96f6('0x3e'));});},'AcceptMessage':function(_0x2f0b56){var _0x378905=this;return new Promise(function(_0x41563d,_0x23321e){if(_0x2f0b56[_0x96f6('0x3f')]&&_0x2f0b56['agent']['id']){if(_0x134a11['agents'][_0x2f0b56[_0x96f6('0x3f')]['id']]){_0x134a11[_0x96f6('0x40')][_0x2f0b56['agent']['id']][_0x96f6('0x41')]=![];_0x134a11[_0x96f6('0x40')][_0x2f0b56[_0x96f6('0x3f')]['id']][_0x96f6('0x42')]=undefined;}}if(_0x2f0b56[_0x96f6('0x2b')]&&_0x2f0b56['message']['id']){try{var _0x49a6eb=getId(_0x2f0b56['channel'],_0x2f0b56[_0x96f6('0x2b')]?_0x2f0b56[_0x96f6('0x2b')]['id']:0x0,_0x2f0b56[_0x96f6('0x18')]?_0x2f0b56[_0x96f6('0x18')]['id']:0x0);if(_0x134a11[_0x96f6('0x16')][_0x49a6eb]){_0x134a11[_0x96f6('0x16')][_0x49a6eb][_0x96f6('0x3c')]('end');if(rpc[_0x2f0b56[_0x96f6('0x17')]+'QueueReport']){rpc[_0x2f0b56[_0x96f6('0x17')]+_0x96f6('0x43')][_0x96f6('0x44')](_0x49a6eb,{'UserId':_0x2f0b56[_0x96f6('0x2b')][_0x96f6('0x45')]})['catch'](function(){logger[_0x96f6('0x37')](_0x96f6('0x46'));});}}return _0x41563d({'code':0xc8,'message':_0x2f0b56});}catch(_0x38f28a){logger['error'](_0x38f28a[_0x96f6('0x3d')]);return _0x23321e(_0x378905[_0x96f6('0x37')](0x1f4,_0x38f28a));}}logger[_0x96f6('0x37')](_0x96f6('0x47'));return _0x23321e(_0x378905['error'](0x1f4,_0x96f6('0x47')));});},'RejectMessage':function(_0x4ae92b){var _0x59ce17=this;return new Promise(function(_0x320626,_0x8b0b8d){if(_0x4ae92b['agent']&&_0x4ae92b[_0x96f6('0x3f')]['id']){try{if(_0x134a11[_0x96f6('0x40')][_0x4ae92b['agent']['id']]){_0x134a11[_0x96f6('0x40')][_0x4ae92b[_0x96f6('0x3f')]['id']][_0x96f6('0x41')]=![];_0x134a11['agents'][_0x4ae92b[_0x96f6('0x3f')]['id']]['busyQueue']=undefined;}return _0x320626({'code':0xc8,'message':_0x4ae92b});}catch(_0x19a1f2){logger[_0x96f6('0x37')](_0x19a1f2[_0x96f6('0x3d')]);return _0x8b0b8d(_0x59ce17[_0x96f6('0x37')](0x1f4,_0x19a1f2));}}logger[_0x96f6('0x37')](_0x96f6('0x47'));return _0x8b0b8d(_0x59ce17[_0x96f6('0x37')](0x1f4,_0x96f6('0x47')));});},'AbandonInteraction':function(_0x3198b0){var _0x3bc6ec=this;return new Promise(function(_0x2fd198,_0x2b1ca2){if(_0x3198b0[_0x96f6('0x17')]&&_0x3198b0[_0x96f6('0x18')]&&_0x3198b0[_0x96f6('0x18')]['id']){try{var _0x50c8bb=getId(_0x3198b0[_0x96f6('0x17')],_0x3198b0['message']?_0x3198b0['message']['id']:0x0,_0x3198b0[_0x96f6('0x18')]?_0x3198b0[_0x96f6('0x18')]['id']:0x0);if(_0x134a11['rules'][_0x50c8bb]){_0x134a11['rules'][_0x50c8bb][_0x96f6('0x3c')]('end');}return _0x2fd198({'code':0xc8,'message':_0x3198b0});}catch(_0x2f9e6a){logger['error'](_0x2f9e6a[_0x96f6('0x3d')]);return _0x2b1ca2(_0x3bc6ec['error'](0x1f4,_0x2f9e6a));}}logger[_0x96f6('0x37')]('message\x20is\x20empty');return _0x2b1ca2(_0x3bc6ec[_0x96f6('0x37')](0x1f4,_0x96f6('0x47')));});},'AgentCapacity':function(_0x408f8a){var _0x345b21=this;return new Promise(function(_0x32182d,_0x4694d1){if(_0x134a11['agents'][_0x96f6('0x48')](_0x408f8a['id'])){for(var _0x52d2e0 in _0x408f8a[_0x96f6('0x49')]){if(_0x408f8a[_0x96f6('0x49')][_0x96f6('0x48')](_0x52d2e0)){if(_0x134a11[_0x96f6('0x40')][_0x408f8a['id']][_0x96f6('0x48')](_0x52d2e0+_0x96f6('0x4a'))){_0x134a11[_0x96f6('0x40')][_0x408f8a['id']][_0x52d2e0+_0x96f6('0x4a')]=parseInt(_0x408f8a[_0x96f6('0x49')][_0x52d2e0],0xa);}}}_0x134a11[_0x96f6('0x40')][_0x408f8a['id']][_0x96f6('0x4b')]();return _0x32182d({'code':0xc8,'message':_0x134a11[_0x96f6('0x40')][_0x408f8a['id']]});}else{return _0x4694d1(_0x345b21['error'](0x1f4,_0x96f6('0x4c')));}});},'Agents':function(_0x4e6deb){return new Promise(function(_0x18e11e){var _0xcca2a4=_['values'](_0x134a11[_0x96f6('0x40')]);if(_0x4e6deb&&_0x4e6deb['id']){var _0x200403=_[_0x96f6('0x4d')](_0xcca2a4,function(_0x4298e4){return _0x4298e4['id']===_0x4e6deb['id'];});_0x18e11e(_0x200403);}else{_0x18e11e({'count':_0xcca2a4[_0x96f6('0x1b')],'rows':_0xcca2a4});}});},'ChatQueues':function(){return new Promise(function(_0x517de2){var _0x219cbc=[];for(var _0x3c662a in _0x134a11[_0x96f6('0x4e')]){if(_0x134a11['chatQueues'][_0x96f6('0x48')](_0x3c662a)){var _0x4c2731=_0x134a11[_0x96f6('0x4e')][_0x3c662a];var _0xded583={'id':_0x4c2731['id'],'available':_0x4c2731[_0x96f6('0x4f')],'loggedIn':_0x4c2731['loggedIn'],'name':_0x4c2731[_0x96f6('0x50')],'paused':_0x4c2731[_0x96f6('0x51')],'waiting':_0x4c2731[_0x96f6('0x52')]};_0x219cbc['push'](_0xded583);}}_0x517de2({'count':_0x219cbc['length'],'rows':_0x219cbc});});},'MailQueues':function(){return new Promise(function(_0x1b05e2){var _0xa04dff=[];for(var _0xaca04f in _0x134a11[_0x96f6('0x53')]){if(_0x134a11[_0x96f6('0x53')]['hasOwnProperty'](_0xaca04f)){var _0x4aa95a=_0x134a11['mailQueues'][_0xaca04f];var _0x388ff7={'id':_0x4aa95a['id'],'available':_0x4aa95a[_0x96f6('0x4f')],'loggedIn':_0x4aa95a[_0x96f6('0x54')],'name':_0x4aa95a[_0x96f6('0x50')],'paused':_0x4aa95a[_0x96f6('0x51')],'waiting':_0x4aa95a[_0x96f6('0x52')]};_0xa04dff[_0x96f6('0x23')](_0x388ff7);}}_0x1b05e2({'count':_0xa04dff['length'],'rows':_0xa04dff});});},'OpenchannelQueues':function(){return new Promise(function(_0x2aec86){var _0x58417b=[];for(var _0x5b07a6 in _0x134a11[_0x96f6('0x55')]){if(_0x134a11[_0x96f6('0x55')][_0x96f6('0x48')](_0x5b07a6)){var _0x538256=_0x134a11[_0x96f6('0x55')][_0x5b07a6];var _0x2273bc={'id':_0x538256['id'],'available':_0x538256[_0x96f6('0x4f')],'loggedIn':_0x538256[_0x96f6('0x54')],'name':_0x538256[_0x96f6('0x50')],'paused':_0x538256[_0x96f6('0x51')],'waiting':_0x538256[_0x96f6('0x52')]};_0x58417b['push'](_0x2273bc);}}_0x2aec86({'count':_0x58417b[_0x96f6('0x1b')],'rows':_0x58417b});});},'SmsQueues':function(){return new Promise(function(_0x315d92){var _0x28d11c=[];for(var _0x556007 in _0x134a11[_0x96f6('0x56')]){if(_0x134a11[_0x96f6('0x56')][_0x96f6('0x48')](_0x556007)){var _0x4d67e4=_0x134a11['smsQueues'][_0x556007];var _0x2b6614={'id':_0x4d67e4['id'],'available':_0x4d67e4['available'],'loggedIn':_0x4d67e4[_0x96f6('0x54')],'name':_0x4d67e4[_0x96f6('0x50')],'paused':_0x4d67e4[_0x96f6('0x51')],'waiting':_0x4d67e4[_0x96f6('0x52')]};_0x28d11c[_0x96f6('0x23')](_0x2b6614);}}_0x315d92({'count':_0x28d11c[_0x96f6('0x1b')],'rows':_0x28d11c});});},'FaxQueues':function(){return new Promise(function(_0xc34c16){var _0x5101b9=[];for(var _0x564fc2 in _0x134a11[_0x96f6('0x57')]){if(_0x134a11['faxQueues'][_0x96f6('0x48')](_0x564fc2)){var _0x14b514=_0x134a11[_0x96f6('0x57')][_0x564fc2];var _0x1537fe={'id':_0x14b514['id'],'available':_0x14b514[_0x96f6('0x4f')],'loggedIn':_0x14b514[_0x96f6('0x54')],'name':_0x14b514['name'],'paused':_0x14b514[_0x96f6('0x51')],'waiting':_0x14b514[_0x96f6('0x52')]};_0x5101b9[_0x96f6('0x23')](_0x1537fe);}}_0xc34c16({'count':_0x5101b9[_0x96f6('0x1b')],'rows':_0x5101b9});});},'WhatsappQueues':function(){return new Promise(function(_0x4d0f8a){var _0xb615f3=[];for(var _0x39d401 in _0x134a11['whatsappQueues']){if(_0x134a11[_0x96f6('0x58')][_0x96f6('0x48')](_0x39d401)){var _0x138f6d=_0x134a11[_0x96f6('0x58')][_0x39d401];var _0x17180d={'id':_0x138f6d['id'],'available':_0x138f6d['available'],'loggedIn':_0x138f6d['loggedIn'],'name':_0x138f6d[_0x96f6('0x50')],'paused':_0x138f6d[_0x96f6('0x51')],'waiting':_0x138f6d['waiting']};_0xb615f3['push'](_0x17180d);}}_0x4d0f8a({'count':_0xb615f3['length'],'rows':_0xb615f3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x385a71){var _0x3d4b35=_[_0x96f6('0x59')](_0x134a11[_0x96f6('0x5a')]);_0x385a71({'count':_0x3d4b35[_0x96f6('0x1b')],'rows':_0x3d4b35});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4217d6){var _0x45e832=_['values'](_0x134a11[_0x96f6('0x5b')]);_0x4217d6({'count':_0x45e832[_0x96f6('0x1b')],'rows':_0x45e832});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x28be94){var _0x4ef403=_[_0x96f6('0x59')](_0x134a11['openchannelQueuesWaitingInteractions']);_0x28be94({'count':_0x4ef403[_0x96f6('0x1b')],'rows':_0x4ef403});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2b45b5){var _0x4d7596=_['values'](_0x134a11[_0x96f6('0x5c')]);_0x2b45b5({'count':_0x4d7596[_0x96f6('0x1b')],'rows':_0x4d7596});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3fd5be){var _0x13293e=_['values'](_0x134a11[_0x96f6('0x5d')]);_0x3fd5be({'count':_0x13293e[_0x96f6('0x1b')],'rows':_0x13293e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x403ef){var _0x44f008=_[_0x96f6('0x59')](_0x134a11[_0x96f6('0x5e')]);_0x403ef({'count':_0x44f008[_0x96f6('0x1b')],'rows':_0x44f008});});}};var _0x275b29=jayson['server'](_0x2b8e75)[_0x96f6('0x5f')]();_0x275b29['on'](_0x96f6('0x37'),function(_0x1e76e4){logger[_0x96f6('0x37')](JSON[_0x96f6('0x60')](_0x1e76e4));return _0x2bd616(_0x1e76e4);});_0x275b29[_0x96f6('0x15')](0x232c,'127.0.0.1',function(){console[_0x96f6('0x61')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x575016(_0x96f6('0x62')+0x232c);});});}; \ No newline at end of file +var _0x61e0=['format','%s:%s:%s','app','./interval','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','.js','execute','info','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','toLowerCase','autoreply','appdata','channel','mail','push','slice','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body'];(function(_0x23f665,_0x3be582){var _0x14b607=function(_0x16d7ae){while(--_0x16d7ae){_0x23f665['push'](_0x23f665['shift']());}};_0x14b607(++_0x3be582);}(_0x61e0,0x165));var _0x061e=function(_0xc099c4,_0x15bc7a){_0xc099c4=_0xc099c4-0x0;var _0x196331=_0x61e0[_0xc099c4];return _0x196331;};'use strict';var _=require(_0x061e('0x0'));var util=require(_0x061e('0x1'));var path=require(_0x061e('0x2'));var fs=require('fs');var jayson=require(_0x061e('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x061e('0x4'));var logger=require('../../../config/logger')(_0x061e('0x5'));var rpc={'openchannelQueueReport':require(_0x061e('0x6')),'mailQueueReport':require(_0x061e('0x7')),'chatQueueReport':require(_0x061e('0x8')),'smsQueueReport':require(_0x061e('0x9')),'faxQueueReport':require(_0x061e('0xa')),'whatsappQueueReport':require(_0x061e('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1768e3,_0x15c30a,_0x1d4d65){return util['format']('%s.%s.%s',_0x1768e3,_0x15c30a||0x0,_0x1d4d65||0x0);}function getIntervals(_0x5b8607,_0x1f0dff){var _0x3f998b=[];if(!_[_0x061e('0xc')](_0x1f0dff[_0x061e('0xd')])&&!_[_0x061e('0xc')](_0x5b8607[_0x1f0dff['IntervalId']])&&!_['isNil'](_0x5b8607[_0x1f0dff[_0x061e('0xd')]][_0x061e('0xe')])){_0x3f998b=_['map'](_0x5b8607[_0x1f0dff['IntervalId']]['Intervals'],_0x061e('0xf'));}else if(!_[_0x061e('0xc')](_0x1f0dff['interval'])){_0x3f998b=[_0x1f0dff['interval']];}return _0x3f998b;}exports[_0x061e('0x10')]=function(_0x48d606){_0x48d606[_0x061e('0x11')]={};return new BPromise(function(_0x2d1e18,_0xf87f1b){var _0xab852a={'Start':function(_0x570ba9){var _0x4e642=this;return new Promise(function(_0x404b6e,_0x210075){if(_0x570ba9){try{var _0x3f7baa=[];var _0x1b4395=getId(_0x570ba9['channel'],_0x570ba9[_0x061e('0x12')]?_0x570ba9['message']['id']:0x0,_0x570ba9[_0x061e('0x13')]?_0x570ba9[_0x061e('0x13')]['id']:0x0);var _0x3bf23e=sUtils[_0x061e('0x14')](_0x48d606,_0x570ba9);if(!_0x3bf23e&&_0x570ba9[_0x061e('0x15')]&&_['isArray'](_0x570ba9[_0x061e('0x15')])&&_0x570ba9[_0x061e('0x15')]['length']){for(var _0x298929=0x0;_0x298929<_0x570ba9[_0x061e('0x15')][_0x061e('0x16')];_0x298929+=0x1){var _0x384843=_0x570ba9[_0x061e('0x15')][_0x298929];if(fs[_0x061e('0x17')](path[_0x061e('0x18')](__dirname,'applications',_0x384843['app']+'.js'))){var _0x2f70d0=[];switch(_0x384843['app'][_0x061e('0x19')]()){case _0x061e('0x1a'):var _0x91d4f5=_0x384843[_0x061e('0x1b')]['split'](',');if(_0x570ba9[_0x061e('0x1c')]===_0x061e('0x1d')){_0x2f70d0[_0x061e('0x1e')](_0x91d4f5[0x0]);_0x2f70d0['push'](_0x91d4f5[0x1]);_0x2f70d0['push'](_0x91d4f5[_0x061e('0x1f')](0x2,_0x91d4f5[_0x061e('0x16')])[_0x061e('0x18')](','));}else{_0x2f70d0[_0x061e('0x1e')](_0x91d4f5[0x0]);_0x2f70d0[_0x061e('0x1e')](_0x91d4f5[_0x061e('0x1f')](0x1,_0x91d4f5[_0x061e('0x16')])[_0x061e('0x18')](','));}break;case'dialogflow':var _0x5992ca=_0x384843[_0x061e('0x1b')][_0x061e('0x20')](',');_0x2f70d0[_0x061e('0x1e')](_0x5992ca[0x0]);_0x2f70d0[_0x061e('0x1e')](_0x5992ca[0x1]);_0x2f70d0[_0x061e('0x1e')](_0x5992ca[_0x061e('0x1f')](0x2,_0x5992ca['length'])[_0x061e('0x18')](','));break;case _0x061e('0x21'):var _0x3ef2d6=_0x384843[_0x061e('0x1b')][_0x061e('0x20')](',');_0x2f70d0[_0x061e('0x1e')](_0x3ef2d6[0x0]);_0x2f70d0['push'](_0x3ef2d6[0x1]);_0x2f70d0[_0x061e('0x1e')](_0x3ef2d6[0x2]);_0x2f70d0['push'](_0x3ef2d6[0x3]);_0x2f70d0[_0x061e('0x1e')](_0x3ef2d6[_0x061e('0x1f')](0x4,_0x3ef2d6['length'])['join'](','));break;case _0x061e('0x22'):var _0x4054a5=_0x384843[_0x061e('0x1b')][_0x061e('0x20')](',');_0x2f70d0[_0x061e('0x1e')](_0x4054a5[0x0]);_0x2f70d0[_0x061e('0x1e')](_0x4054a5[0x1]);_0x2f70d0['push'](_0x4054a5[0x2]);_0x2f70d0[_0x061e('0x1e')](_0x4054a5[0x3]);_0x2f70d0[_0x061e('0x1e')](_0x4054a5[_0x061e('0x1f')](0x4,_0x4054a5[_0x061e('0x16')])[_0x061e('0x18')](','));break;case _0x061e('0x12'):_0x2f70d0[_0x061e('0x1e')](_0x384843[_0x061e('0x1b')]);break;case _0x061e('0x23'):_0x2f70d0['push'](_0x384843[_0x061e('0x24')]);_0x2f70d0['push'](_0x384843['appdata']);break;case _0x061e('0x25'):var _0x422858=utils[_0x061e('0x26')](_0x570ba9[_0x061e('0x27')][_0x061e('0x28')],_0x570ba9);var _0x195456=_0x384843['appdata']['split'](',');_0x2f70d0[_0x061e('0x1e')](_0x195456[0x0]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x1]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x2]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x3]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x4]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x5]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x6]);_0x2f70d0['push'](_0x195456[0x7]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x8]);_0x2f70d0[_0x061e('0x1e')](_0x195456[0x9]);_0x2f70d0['push'](_0x195456[0xa]);_0x2f70d0[_0x061e('0x1e')](_0x570ba9[_0x061e('0x13')]['id']);_0x2f70d0[_0x061e('0x1e')](_0x570ba9[_0x061e('0x12')]['id']);_0x2f70d0[_0x061e('0x1e')](_0x384843[_0x061e('0x29')]);_0x2f70d0[_0x061e('0x1e')](_0x570ba9['interaction']['ContactId']);_0x2f70d0[_0x061e('0x1e')](_0x570ba9[_0x061e('0x2a')][_0x061e('0x2a')]);_0x2f70d0[_0x061e('0x1e')](_0x422858);break;default:_0x2f70d0=_[_0x061e('0xc')](_0x384843['appdata'])?[]:_0x384843[_0x061e('0x1b')][_0x061e('0x20')](',');}var _0x5746e9={'id':util[_0x061e('0x2b')](_0x061e('0x2c'),_0x1b4395,_0x384843['id'],_0x384843[_0x061e('0x2d')]),'condition':require(_0x061e('0x2e'))['condition'](_0x1b4395,getIntervals(_0x48d606[_0x061e('0x2f')],_0x384843),_0x48d606),'consequence':require(_0x061e('0x30')+_0x384843[_0x061e('0x2d')])[_0x061e('0x31')](_0x1b4395,_0x2f70d0,_0x48d606,_0x570ba9),'p':_0x384843[_0x061e('0x32')]||0x0};logger['info'](_0x061e('0x33'),_0x5746e9['id'],_0x061e('0x34'),getIntervals(_0x48d606[_0x061e('0x2f')],_0x384843)['join'](_0x061e('0x35')));_0x3f7baa['push'](_0x5746e9);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x061e('0x18')](__dirname,_0x061e('0x15'),_0x384843[_0x061e('0x2d')]+_0x061e('0x36')));}}_0x48d606[_0x061e('0x11')][_0x1b4395]=new RuleEngine(_0x3f7baa);_0x48d606[_0x061e('0x11')][_0x1b4395][_0x061e('0x37')](_0x570ba9,function(_0x3f3faa){logger[_0x061e('0x38')]('Applications\x20executed',JSON['stringify'](_0x3f3faa['matchPath']));if(_0x48d606[_0x061e('0x11')][_0x1b4395]){_0x48d606[_0x061e('0x11')][_0x1b4395][_0x061e('0x39')](_0x061e('0x3a'));}});return _0x404b6e({'code':0xc8,'message':_0x570ba9});}else{if(_0x3bf23e){logger['info'](util[_0x061e('0x2b')](_0x061e('0x3b'),_0x1b4395));}else{logger[_0x061e('0x38')](_0x061e('0x3c'));}return _0x404b6e({'code':0xc8,'message':_0x570ba9});}}catch(_0x4b9dd4){logger[_0x061e('0x3d')](_0x4b9dd4[_0x061e('0x3e')]);return _0x210075(_0x4e642['error'](0x1f4,_0x4b9dd4));}}return _0x210075(_0x061e('0x3f'));});},'AcceptMessage':function(_0x47abc0){var _0x2f0649=this;return new Promise(function(_0x30e77d,_0x27285c){if(_0x47abc0[_0x061e('0x40')]&&_0x47abc0[_0x061e('0x40')]['id']){if(_0x48d606[_0x061e('0x41')][_0x47abc0['agent']['id']]){_0x48d606[_0x061e('0x41')][_0x47abc0[_0x061e('0x40')]['id']][_0x061e('0x42')]=![];_0x48d606[_0x061e('0x41')][_0x47abc0['agent']['id']][_0x061e('0x43')]=undefined;}}if(_0x47abc0[_0x061e('0x12')]&&_0x47abc0[_0x061e('0x12')]['id']){try{var _0x2b2e84=getId(_0x47abc0[_0x061e('0x1c')],_0x47abc0['message']?_0x47abc0[_0x061e('0x12')]['id']:0x0,_0x47abc0['interaction']?_0x47abc0[_0x061e('0x13')]['id']:0x0);if(_0x48d606[_0x061e('0x11')][_0x2b2e84]){_0x48d606[_0x061e('0x11')][_0x2b2e84]['emit'](_0x061e('0x44'));if(rpc[_0x47abc0[_0x061e('0x1c')]+_0x061e('0x45')]){rpc[_0x47abc0[_0x061e('0x1c')]+_0x061e('0x45')]['update'](_0x2b2e84,{'UserId':_0x47abc0[_0x061e('0x12')][_0x061e('0x46')]})[_0x061e('0x47')](function(){logger[_0x061e('0x3d')](_0x061e('0x48'));});}}return _0x30e77d({'code':0xc8,'message':_0x47abc0});}catch(_0x1bd49f){logger[_0x061e('0x3d')](_0x1bd49f[_0x061e('0x3e')]);return _0x27285c(_0x2f0649[_0x061e('0x3d')](0x1f4,_0x1bd49f));}}logger[_0x061e('0x3d')]('message\x20is\x20empty');return _0x27285c(_0x2f0649[_0x061e('0x3d')](0x1f4,_0x061e('0x49')));});},'RejectMessage':function(_0x4423a9){var _0x15080f=this;return new Promise(function(_0x30c2f2,_0x11c8ba){if(_0x4423a9[_0x061e('0x40')]&&_0x4423a9[_0x061e('0x40')]['id']){try{if(_0x48d606[_0x061e('0x41')][_0x4423a9[_0x061e('0x40')]['id']]){_0x48d606[_0x061e('0x41')][_0x4423a9[_0x061e('0x40')]['id']][_0x061e('0x42')]=![];_0x48d606['agents'][_0x4423a9[_0x061e('0x40')]['id']][_0x061e('0x43')]=undefined;}return _0x30c2f2({'code':0xc8,'message':_0x4423a9});}catch(_0x469cc3){logger[_0x061e('0x3d')](_0x469cc3[_0x061e('0x3e')]);return _0x11c8ba(_0x15080f[_0x061e('0x3d')](0x1f4,_0x469cc3));}}logger['error'](_0x061e('0x49'));return _0x11c8ba(_0x15080f[_0x061e('0x3d')](0x1f4,_0x061e('0x49')));});},'AbandonInteraction':function(_0x1461b9){var _0x568512=this;return new Promise(function(_0x457b7d,_0x10addc){if(_0x1461b9[_0x061e('0x1c')]&&_0x1461b9[_0x061e('0x13')]&&_0x1461b9[_0x061e('0x13')]['id']){try{var _0x2994d2=getId(_0x1461b9[_0x061e('0x1c')],_0x1461b9[_0x061e('0x12')]?_0x1461b9['message']['id']:0x0,_0x1461b9[_0x061e('0x13')]?_0x1461b9[_0x061e('0x13')]['id']:0x0);if(_0x48d606[_0x061e('0x11')][_0x2994d2]){_0x48d606[_0x061e('0x11')][_0x2994d2][_0x061e('0x39')](_0x061e('0x44'));}return _0x457b7d({'code':0xc8,'message':_0x1461b9});}catch(_0x37c103){logger[_0x061e('0x3d')](_0x37c103[_0x061e('0x3e')]);return _0x10addc(_0x568512['error'](0x1f4,_0x37c103));}}logger[_0x061e('0x3d')](_0x061e('0x49'));return _0x10addc(_0x568512[_0x061e('0x3d')](0x1f4,_0x061e('0x49')));});},'AgentCapacity':function(_0x3b4c3b){var _0x5b82e2=this;return new Promise(function(_0x4d2d20,_0x2b2977){if(_0x48d606['agents'][_0x061e('0x4a')](_0x3b4c3b['id'])){for(var _0x2bbdd5 in _0x3b4c3b['capacity']){if(_0x3b4c3b[_0x061e('0x4b')]['hasOwnProperty'](_0x2bbdd5)){if(_0x48d606[_0x061e('0x41')][_0x3b4c3b['id']][_0x061e('0x4a')](_0x2bbdd5+_0x061e('0x4c'))){_0x48d606[_0x061e('0x41')][_0x3b4c3b['id']][_0x2bbdd5+_0x061e('0x4c')]=parseInt(_0x3b4c3b[_0x061e('0x4b')][_0x2bbdd5],0xa);}}}_0x48d606[_0x061e('0x41')][_0x3b4c3b['id']]['updateRealtime']();return _0x4d2d20({'code':0xc8,'message':_0x48d606['agents'][_0x3b4c3b['id']]});}else{return _0x2b2977(_0x5b82e2['error'](0x1f4,_0x061e('0x4d')));}});},'Agents':function(_0x256de7){return new Promise(function(_0x519e93){var _0x438e98=_[_0x061e('0x4e')](_0x48d606[_0x061e('0x41')]);if(_0x256de7&&_0x256de7['id']){var _0x514a50=_['find'](_0x438e98,function(_0x5ca5a1){return _0x5ca5a1['id']===_0x256de7['id'];});_0x519e93(_0x514a50);}else{_0x519e93({'count':_0x438e98[_0x061e('0x16')],'rows':_0x438e98});}});},'ChatQueues':function(){return new Promise(function(_0x153a0e){var _0xc81d25=[];for(var _0x5328f9 in _0x48d606[_0x061e('0x4f')]){if(_0x48d606[_0x061e('0x4f')][_0x061e('0x4a')](_0x5328f9)){var _0x16dde4=_0x48d606[_0x061e('0x4f')][_0x5328f9];var _0x34b18d={'id':_0x16dde4['id'],'available':_0x16dde4[_0x061e('0x50')],'loggedIn':_0x16dde4['loggedIn'],'name':_0x16dde4[_0x061e('0x51')],'paused':_0x16dde4[_0x061e('0x52')],'waiting':_0x16dde4[_0x061e('0x53')]};_0xc81d25[_0x061e('0x1e')](_0x34b18d);}}_0x153a0e({'count':_0xc81d25[_0x061e('0x16')],'rows':_0xc81d25});});},'MailQueues':function(){return new Promise(function(_0x199ffc){var _0x2fa1da=[];for(var _0x2a9a4c in _0x48d606['mailQueues']){if(_0x48d606[_0x061e('0x54')][_0x061e('0x4a')](_0x2a9a4c)){var _0x2d6c30=_0x48d606['mailQueues'][_0x2a9a4c];var _0x2b0231={'id':_0x2d6c30['id'],'available':_0x2d6c30[_0x061e('0x50')],'loggedIn':_0x2d6c30[_0x061e('0x55')],'name':_0x2d6c30['name'],'paused':_0x2d6c30['paused'],'waiting':_0x2d6c30[_0x061e('0x53')]};_0x2fa1da[_0x061e('0x1e')](_0x2b0231);}}_0x199ffc({'count':_0x2fa1da[_0x061e('0x16')],'rows':_0x2fa1da});});},'OpenchannelQueues':function(){return new Promise(function(_0x273516){var _0x5140da=[];for(var _0x2e87c6 in _0x48d606[_0x061e('0x56')]){if(_0x48d606[_0x061e('0x56')][_0x061e('0x4a')](_0x2e87c6)){var _0x32604f=_0x48d606[_0x061e('0x56')][_0x2e87c6];var _0x53fba6={'id':_0x32604f['id'],'available':_0x32604f['available'],'loggedIn':_0x32604f[_0x061e('0x55')],'name':_0x32604f[_0x061e('0x51')],'paused':_0x32604f[_0x061e('0x52')],'waiting':_0x32604f[_0x061e('0x53')]};_0x5140da[_0x061e('0x1e')](_0x53fba6);}}_0x273516({'count':_0x5140da['length'],'rows':_0x5140da});});},'SmsQueues':function(){return new Promise(function(_0x143b51){var _0x540fd9=[];for(var _0x14bd23 in _0x48d606[_0x061e('0x57')]){if(_0x48d606[_0x061e('0x57')][_0x061e('0x4a')](_0x14bd23)){var _0x434716=_0x48d606[_0x061e('0x57')][_0x14bd23];var _0x16c8fb={'id':_0x434716['id'],'available':_0x434716[_0x061e('0x50')],'loggedIn':_0x434716[_0x061e('0x55')],'name':_0x434716[_0x061e('0x51')],'paused':_0x434716[_0x061e('0x52')],'waiting':_0x434716[_0x061e('0x53')]};_0x540fd9[_0x061e('0x1e')](_0x16c8fb);}}_0x143b51({'count':_0x540fd9['length'],'rows':_0x540fd9});});},'FaxQueues':function(){return new Promise(function(_0x38498a){var _0x22f847=[];for(var _0x546635 in _0x48d606[_0x061e('0x58')]){if(_0x48d606[_0x061e('0x58')][_0x061e('0x4a')](_0x546635)){var _0xa192bc=_0x48d606[_0x061e('0x58')][_0x546635];var _0xbe3e8c={'id':_0xa192bc['id'],'available':_0xa192bc[_0x061e('0x50')],'loggedIn':_0xa192bc[_0x061e('0x55')],'name':_0xa192bc['name'],'paused':_0xa192bc['paused'],'waiting':_0xa192bc[_0x061e('0x53')]};_0x22f847['push'](_0xbe3e8c);}}_0x38498a({'count':_0x22f847[_0x061e('0x16')],'rows':_0x22f847});});},'WhatsappQueues':function(){return new Promise(function(_0x4781d9){var _0xa2984e=[];for(var _0x3e49f6 in _0x48d606[_0x061e('0x59')]){if(_0x48d606[_0x061e('0x59')][_0x061e('0x4a')](_0x3e49f6)){var _0x1df235=_0x48d606[_0x061e('0x59')][_0x3e49f6];var _0x4ff505={'id':_0x1df235['id'],'available':_0x1df235[_0x061e('0x50')],'loggedIn':_0x1df235[_0x061e('0x55')],'name':_0x1df235[_0x061e('0x51')],'paused':_0x1df235[_0x061e('0x52')],'waiting':_0x1df235[_0x061e('0x53')]};_0xa2984e[_0x061e('0x1e')](_0x4ff505);}}_0x4781d9({'count':_0xa2984e[_0x061e('0x16')],'rows':_0xa2984e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2eaac9){var _0x2a9cf0=_['values'](_0x48d606[_0x061e('0x5a')]);_0x2eaac9({'count':_0x2a9cf0[_0x061e('0x16')],'rows':_0x2a9cf0});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3edb73){var _0x5e6d84=_[_0x061e('0x4e')](_0x48d606[_0x061e('0x5b')]);_0x3edb73({'count':_0x5e6d84[_0x061e('0x16')],'rows':_0x5e6d84});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x343526){var _0x4e35c6=_['values'](_0x48d606[_0x061e('0x5c')]);_0x343526({'count':_0x4e35c6[_0x061e('0x16')],'rows':_0x4e35c6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x45ecda){var _0x3c308c=_[_0x061e('0x4e')](_0x48d606[_0x061e('0x5d')]);_0x45ecda({'count':_0x3c308c['length'],'rows':_0x3c308c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xf73187){var _0x518266=_[_0x061e('0x4e')](_0x48d606[_0x061e('0x5e')]);_0xf73187({'count':_0x518266[_0x061e('0x16')],'rows':_0x518266});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x295712){var _0x30ea00=_[_0x061e('0x4e')](_0x48d606['whatsappQueuesWaitingInteractions']);_0x295712({'count':_0x30ea00[_0x061e('0x16')],'rows':_0x30ea00});});}};var _0x3f4ccb=jayson[_0x061e('0x5f')](_0xab852a)[_0x061e('0x60')]();_0x3f4ccb['on'](_0x061e('0x3d'),function(_0x2986e4){logger[_0x061e('0x3d')](JSON['stringify'](_0x2986e4));return _0xf87f1b(_0x2986e4);});_0x3f4ccb['listen'](0x232c,_0x061e('0x61'),function(){console[_0x061e('0x62')](_0x061e('0x63'),0x232c);return _0x2d1e18('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 694cce9..21aa830 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 _0x84db=['request','then','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','message','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','log','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http'];(function(_0x34b390,_0x11b0bf){var _0x545829=function(_0x315b63){while(--_0x315b63){_0x34b390['push'](_0x34b390['shift']());}};_0x545829(++_0x11b0bf);}(_0x84db,0x138));var _0xb84d=function(_0x12acae,_0x1bc38c){_0x12acae=_0x12acae-0x0;var _0x31fda5=_0x84db[_0x12acae];return _0x31fda5;};'use strict';var util=require(_0xb84d('0x0'));var BPromise=require(_0xb84d('0x1'));var jayson=require(_0xb84d('0x2'));var _=require(_0xb84d('0x3'));var logger=require(_0xb84d('0x4'))('routing');var client=jayson[_0xb84d('0x5')][_0xb84d('0x6')]({'port':0x232a});function request(_0x4407a9,_0x309783){return new BPromise(function(_0x5833e4,_0xd744d2){return client[_0xb84d('0x7')](_0x4407a9,_0x309783)[_0xb84d('0x8')](function(_0x3bc138){if(_0x3bc138[_0xb84d('0x9')]){return _0xd744d2(_0x3bc138['error']['message']);}else{return _0x5833e4(_0x3bc138[_0xb84d('0xa')]);}})[_0xb84d('0xb')](function(_0x53f5ad){return _0xd744d2(_0x53f5ad);});});}exports[_0xb84d('0xc')]=function(_0x44cc34,_0x317e84,_0x214778){return function(_0x4a0ded){if(_0x214778['rules']&&!_0x214778[_0xb84d('0xd')][_0x44cc34]){logger['info'](_0xb84d('0xe'),_0x44cc34);return _0x4a0ded[_0xb84d('0xf')]();}var _0x20d642=[];for(var _0x4fefa8=0x0;_0x4fefa8<_0x317e84[_0xb84d('0x10')];_0x4fefa8+=0x1){_0x20d642[_0xb84d('0x11')](request('Command',{'command':util[_0xb84d('0x12')]('iftime\x20%s',_0x317e84[_0x4fefa8])})[_0xb84d('0x8')](function(_0x1c0e79){return _0x1c0e79&&_0x1c0e79[_0xb84d('0x13')]&&_0x1c0e79[_0xb84d('0x13')][_0xb84d('0x14')]('true')>=0x0?!![]:![];})['catch'](function(_0x3f5e08){logger[_0xb84d('0x9')](_0xb84d('0x15'),_0x44cc34,_0x317e84[_0x4fefa8]);}));}BPromise[_0xb84d('0x16')](_0x20d642)['then'](function(_0x46c15c){var _0x42840c=_[_0xb84d('0x17')](_0x46c15c);logger['info'](_0xb84d('0x18'),_0x44cc34,_0x317e84['join']('\x20|\x20'),_0x42840c);_0x4a0ded['when'](_0x42840c);})[_0xb84d('0xb')](function(_0x32aa47){console[_0xb84d('0x19')](_0x32aa47);logger[_0xb84d('0x9')](_0xb84d('0x18'),_0x44cc34,_0x317e84[_0xb84d('0x1a')](_0xb84d('0x1b')),_0x32aa47[_0xb84d('0x1c')]);_0x4a0ded['stop']();});};}; \ No newline at end of file +var _0x205b=['then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','util','jayson/promise','lodash','../../../config/logger','routing','http','request'];(function(_0x597f96,_0x39bf83){var _0xc04eea=function(_0x195ccb){while(--_0x195ccb){_0x597f96['push'](_0x597f96['shift']());}};_0xc04eea(++_0x39bf83);}(_0x205b,0x149));var _0xb205=function(_0x13feab,_0x4a2ff5){_0x13feab=_0x13feab-0x0;var _0x3cdec2=_0x205b[_0x13feab];return _0x3cdec2;};'use strict';var util=require(_0xb205('0x0'));var BPromise=require('bluebird');var jayson=require(_0xb205('0x1'));var _=require(_0xb205('0x2'));var logger=require(_0xb205('0x3'))(_0xb205('0x4'));var client=jayson['client'][_0xb205('0x5')]({'port':0x232a});function request(_0x3c03b6,_0x383626){return new BPromise(function(_0x809c34,_0x264022){return client[_0xb205('0x6')](_0x3c03b6,_0x383626)[_0xb205('0x7')](function(_0x54dee1){if(_0x54dee1[_0xb205('0x8')]){return _0x264022(_0x54dee1[_0xb205('0x8')][_0xb205('0x9')]);}else{return _0x809c34(_0x54dee1[_0xb205('0xa')]);}})[_0xb205('0xb')](function(_0x2b80c2){return _0x264022(_0x2b80c2);});});}exports['condition']=function(_0x327693,_0x2ce687,_0x103f5e){return function(_0x451c4c){if(_0x103f5e[_0xb205('0xc')]&&!_0x103f5e[_0xb205('0xc')][_0x327693]){logger[_0xb205('0xd')](_0xb205('0xe'),_0x327693);return _0x451c4c[_0xb205('0xf')]();}var _0x3d5f9e=[];for(var _0x342e63=0x0;_0x342e63<_0x2ce687[_0xb205('0x10')];_0x342e63+=0x1){_0x3d5f9e[_0xb205('0x11')](request(_0xb205('0x12'),{'command':util[_0xb205('0x13')](_0xb205('0x14'),_0x2ce687[_0x342e63])})[_0xb205('0x7')](function(_0x2f331a){return _0x2f331a&&_0x2f331a[_0xb205('0x9')]&&_0x2f331a[_0xb205('0x9')][_0xb205('0x15')](_0xb205('0x16'))>=0x0?!![]:![];})[_0xb205('0xb')](function(_0x3425e7){logger[_0xb205('0x8')]('[%s][INTERVAL]\x20%s',_0x327693,_0x2ce687[_0x342e63]);}));}BPromise[_0xb205('0x17')](_0x3d5f9e)[_0xb205('0x7')](function(_0x2c446e){var _0x25d7a1=_['some'](_0x2c446e);logger[_0xb205('0xd')](_0xb205('0x18'),_0x327693,_0x2ce687[_0xb205('0x19')](_0xb205('0x1a')),_0x25d7a1);_0x451c4c[_0xb205('0x1b')](_0x25d7a1);})[_0xb205('0xb')](function(_0x3e4601){console['log'](_0x3e4601);logger[_0xb205('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x327693,_0x2ce687['join'](_0xb205('0x1a')),_0x3e4601['stack']);_0x451c4c['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b0199fb..d877522 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 _0xf45e=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agentcalledAt','ATTENDED','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','ringtime','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','now','connectedlinename','answered_elsewhere','reason','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xf45e,0x115));var _0xef45=function(_0xc67271,_0x13f90a){_0xc67271=_0xc67271-0x0;var _0x48f489=_0xf45e[_0xc67271];return _0x48f489;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var utils=require(_0xef45('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5762da,_0x17b897){utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x4'),_0x5762da[_0xef45('0x5')],_0x5762da[_0xef45('0x6')],_0x5762da[_0xef45('0x7')],_0x5762da[_0xef45('0x8')],_0x5762da[_0xef45('0x9')],_0x5762da[_0xef45('0xa')],_0x5762da[_0xef45('0xb')],_0x5762da[_0xef45('0xc')]));if(_0x5762da[_0xef45('0x7')]){utils[_0xef45('0xd')](_0x5762da[_0xef45('0x7')])[_0xef45('0xe')](function(_0x134c86){if(_0x134c86){_0x5762da[_0xef45('0xf')]=_0x134c86[_0xef45('0xf')];_0x5762da['agentacw']=_0x5762da[_0xef45('0x10')]?_0x134c86[_0xef45('0x11')]:![];_0x5762da[_0xef45('0x12')]=_0x5762da[_0xef45('0x13')]?_0x134c86[_0xef45('0x14')]:0x0;}utils[_0xef45('0x15')]('CreateVoiceAgentReport',_0x5762da);});}else{utils[_0xef45('0x15')](_0xef45('0x16'),_0x5762da);}if(_0x17b897){delete transfers[_0x5762da[_0xef45('0x5')]];}else{delete agents[_0x5762da[_0xef45('0x17')]];}}exports[_0xef45('0x18')]=function(_0x4a6e5c){try{utils['debug'](util[_0xef45('0x3')]('[%s][agents][agentcalled]',_0x4a6e5c[_0xef45('0x5')]),_0x4a6e5c);agents[_0x4a6e5c[_0xef45('0x17')]]=_0x4a6e5c;agents[_0x4a6e5c[_0xef45('0x17')]]['agentcalledAt']=utils['now']();agents[_0x4a6e5c[_0xef45('0x17')]]['lastevent']=_0xef45('0x19');agents[_0x4a6e5c[_0xef45('0x17')]][_0xef45('0xb')]=null;agents[_0x4a6e5c[_0xef45('0x17')]]['connectedlinename']=null;utils['info'](util[_0xef45('0x3')](_0xef45('0x1a'),_0x4a6e5c[_0xef45('0x5')],agents[_0x4a6e5c[_0xef45('0x17')]]['membername'],_0x4a6e5c['destuniqueid']));}catch(_0x2c57fc){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x1c'),_0x4a6e5c[_0xef45('0x5')]),_0x2c57fc);}};exports[_0xef45('0x1d')]=function(_0x375cbd){try{if(!_['isNil'](agents[_0x375cbd[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x1f'),_0x375cbd[_0xef45('0x5')]),_0x375cbd);utils['info'](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x375cbd['uniqueid'],agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x8')],_0x375cbd[_0xef45('0x17')]));agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x1d')]=!![];agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x20')]=utils['now']();agents[_0x375cbd[_0xef45('0x17')]]['lastevent']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['reason']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['holdtime']=_0x375cbd[_0xef45('0x22')]?parseInt(_0x375cbd['ringtime'])/0x3e8:0x0;agents[_0x375cbd['destuniqueid']]['talktime']=0x0;unanswered['push'](_0x375cbd[_0xef45('0x17')]);}}catch(_0x2f72ef){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]',_0x375cbd[_0xef45('0x5')]),_0x2f72ef);}};exports['queuecallerabandon']=function(_0x2525da){try{_['forIn'](agents,function(_0x3e6922,_0x5bfd2d){if(_0x3e6922['uniqueid']==_0x2525da[_0xef45('0x5')]&&!_[_0xef45('0x23')](unanswered,_0x3e6922[_0xef45('0x17')])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da['uniqueid']),_0x2525da);utils['info'](util[_0xef45('0x3')](_0xef45('0x24'),_0x2525da[_0xef45('0x5')],_0x3e6922[_0xef45('0x8')],_0x3e6922[_0xef45('0x17')]));_0x3e6922[_0xef45('0x1d')]=!![];_0x3e6922[_0xef45('0x20')]=utils['now']();_0x3e6922['lastevent']=_0xef45('0x25');_0x3e6922['reason']=_0xef45('0x25');_0x3e6922['holdtime']=_0x2525da[_0xef45('0x26')];_0x3e6922[_0xef45('0x27')]=0x0;writeDB(_0x3e6922);}});}catch(_0x2a7c53){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da[_0xef45('0x5')]),_0x2a7c53);}};exports[_0xef45('0x28')]=function(_0x9df07e){try{if(agents[_0x9df07e['destuniqueid']]){utils['debug'](util[_0xef45('0x3')](_0xef45('0x29'),_0x9df07e['uniqueid']),_0x9df07e);utils[_0xef45('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x9df07e[_0xef45('0x5')],agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x8')],_0x9df07e['destuniqueid']));agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();agents[_0x9df07e[_0xef45('0x17')]]['connectedlinenum']=_0x9df07e['connectedlinenum'];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2c')]=_0x9df07e[_0xef45('0x2c')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0xc')]='connect';_['forIn'](agents,function(_0x13f8b2,_0x35d014){if(_0x13f8b2[_0xef45('0x17')]!=_0x9df07e[_0xef45('0x17')]&&_0x13f8b2[_0xef45('0x5')]==_0x9df07e[_0xef45('0x5')]){_0x13f8b2[_0xef45('0x27')]=0x0;_0x13f8b2[_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];_0x13f8b2[_0xef45('0x1d')]=!![];_0x13f8b2[_0xef45('0x20')]=utils[_0xef45('0x2b')]();_0x13f8b2[_0xef45('0xc')]=_0xef45('0x2d');_0x13f8b2[_0xef45('0x2e')]=_0xef45('0x2d');_0x13f8b2['answeredelsewheredestinationuniqueid']=_0x9df07e[_0xef45('0x17')];_0x13f8b2[_0xef45('0x2f')]=_0x9df07e[_0xef45('0x8')];writeDB(_0x13f8b2);}});}}catch(_0x82c123){utils['error'](util[_0xef45('0x3')]('[%s][agents][agentconnect]',_0x9df07e[_0xef45('0x5')]),_0x82c123);}};exports['agentcomplete']=function(_0x5faf67){try{if(!_[_0xef45('0x30')](agents[_0x5faf67[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x31'),_0x5faf67[_0xef45('0x5')]),_0x5faf67);utils['info'](util[_0xef45('0x3')](_0xef45('0x32'),_0x5faf67[_0xef45('0x5')],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x8')],_0x5faf67[_0xef45('0x17')]));agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x10')]=!![];agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x33')]=utils[_0xef45('0x2b')]();agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x27')]=utils[_0xef45('0x34')](agents[_0x5faf67[_0xef45('0x17')]]['agentcompleteAt'],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x2a')]);agents[_0x5faf67[_0xef45('0x17')]]['reason']=_0x5faf67['reason'];agents[_0x5faf67['destuniqueid']][_0xef45('0xc')]=_0xef45('0x35');writeDB(agents[_0x5faf67[_0xef45('0x17')]]);}}catch(_0x34e9d5){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentcomplete]',_0x5faf67[_0xef45('0x5')]),_0x34e9d5);}};exports[_0xef45('0x36')]=function(_0x2b2419){try{if(!_['isNil'](agents[_0x2b2419['transfereruniqueid']])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][blindtransfer]',_0x2b2419[_0xef45('0x5')]),_0x2b2419);utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x37'),_0x2b2419[_0xef45('0x5')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x8')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')]));agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x39')]=!![];agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x3a')]=_0xef45('0x3b');agents[_0x2b2419['transfereruniqueid']][_0xef45('0x3c')]=_0x2b2419[_0xef45('0x3d')];agents[_0x2b2419[_0xef45('0x38')]]['transferuniqueid']=agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')];}}catch(_0x464bda){utils[_0xef45('0x1b')](util['format'](_0xef45('0x3e'),_0x2b2419[_0xef45('0x5')]),_0x464bda);}};exports[_0xef45('0x3f')]=function(_0x310105){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x310105);if(_0x310105[_0xef45('0x41')]==_0x310105[_0xef45('0x42')]){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x43')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x43')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x43')]]['transfer']=!![];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x3a')]='ATTENDED';agents[_0x310105[_0xef45('0x43')]][_0xef45('0x3c')]=_0x310105[_0xef45('0x45')];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x46')]=_0x310105[_0xef45('0x41')];}if(_0x310105['transfereeuniqueid']&&agents[_0x310105[_0xef45('0x47')]]){agents[_0x310105['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x310105[_0xef45('0x47')]]=_[_0xef45('0x48')](agents[_0x310105[_0xef45('0x47')]]);transfers[_0x310105[_0xef45('0x47')]][_0xef45('0xa')]=agents[_0x310105['secondtransfereruniqueid']][_0xef45('0xa')];transfers[_0x310105[_0xef45('0x47')]]['calleridname']=agents[_0x310105[_0xef45('0x43')]][_0xef45('0x49')];transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105['transfereeuniqueid']][_0xef45('0x26')]=0x0;transfers[_0x310105['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x310105[_0xef45('0x43')]==_0x310105['secondtransfererlinkedid']){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x41')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x41')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x41')]]['transfer']=!![];agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3a')]=_0xef45('0x4b');agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3c')]=_0x310105['secondtransfererexten'];agents[_0x310105[_0xef45('0x41')]]['transferuniqueid']=_0x310105[_0xef45('0x43')];}if(_0x310105[_0xef45('0x4c')]&&agents[_0x310105['transfertargetuniqueid']]){agents[_0x310105[_0xef45('0x4c')]][_0xef45('0x4d')]=0x1;transfers[_0x310105[_0xef45('0x4c')]]=_['clone'](agents[_0x310105['transfertargetuniqueid']]);transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0xa')]=agents[_0x310105[_0xef45('0x41')]]['calleridnum'];transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x49')]=agents[_0x310105['origtransfereruniqueid']][_0xef45('0x49')];transfers[_0x310105['transfertargetuniqueid']][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x26')]=0x0;transfers[_0x310105[_0xef45('0x4c')]]['agententerreason']=0x2;}}}catch(_0x3e6b06){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x3e6b06);}};exports[_0xef45('0x4e')]=function(_0xef7b79){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x4f'),_0xef7b79[_0xef45('0x5')]),_0xef7b79);if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]===_0xef45('0x21')){if(_0xef7b79[_0xef45('0x50')]==='21'){agents[_0xef7b79[_0xef45('0x5')]]['reason']=_0xef45('0x51');agents[_0xef7b79[_0xef45('0x5')]]['lastevent']='rejected';}utils[_0xef45('0x2')](util[_0xef45('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xef7b79['uniqueid'],agents[_0xef7b79['uniqueid']][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]]['reason'],agents[_0xef7b79['uniqueid']][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);var _0x36586a=unanswered[_0xef45('0x52')](_0xef7b79[_0xef45('0x5')]);if(_0x36586a>-0x1){unanswered[_0xef45('0x53')](_0x36586a,0x1);}}if(transfers[_0xef7b79[_0xef45('0x5')]]){transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x10')]=!![];transfers[_0xef7b79['uniqueid']][_0xef45('0x33')]=utils[_0xef45('0x2b')]();transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x27')]=utils[_0xef45('0x34')](transfers[_0xef7b79[_0xef45('0x5')]]['agentcompleteAt'],transfers[_0xef7b79['uniqueid']][_0xef45('0x2a')]);transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=_0xef45('0x54');transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils[_0xef45('0x2')](util['format'](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],transfers[_0xef7b79[_0xef45('0x5')]]['lastevent']));writeDB(transfers[_0xef7b79[_0xef45('0x5')]],!![]);}if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2a')]){agents[_0xef7b79['uniqueid']][_0xef45('0x10')]=!![];agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')]=utils['now']();agents[_0xef7b79[_0xef45('0x5')]]['talktime']=utils[_0xef45('0x34')](agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')],agents[_0xef7b79[_0xef45('0x5')]]['agentconnectAt']);agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=agents[_0xef7b79[_0xef45('0x5')]]['transfer']?_0xef45('0x39'):_0xef45('0x54');agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils['info'](util[_0xef45('0x3')](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);}}catch(_0xd3a51e){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][hangup]',_0xef7b79[_0xef45('0x5')]),_0xd3a51e);}}; \ No newline at end of file +var _0x6cb4=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertype','secondtransfererexten','transfertargetuniqueid','hangup','cause'];(function(_0x40457e,_0x22e4ba){var _0x334471=function(_0x21742b){while(--_0x21742b){_0x40457e['push'](_0x40457e['shift']());}};_0x334471(++_0x22e4ba);}(_0x6cb4,0xff));var _0x46cb=function(_0x28379e,_0x27023f){_0x28379e=_0x28379e-0x0;var _0x1fa93d=_0x6cb4[_0x28379e];return _0x1fa93d;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var utils=require(_0x46cb('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3403fc,_0x375bef){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x5'),_0x3403fc[_0x46cb('0x6')],_0x3403fc['channel'],_0x3403fc[_0x46cb('0x7')],_0x3403fc['membername'],_0x3403fc[_0x46cb('0x8')],_0x3403fc['calleridnum'],_0x3403fc[_0x46cb('0x9')],_0x3403fc[_0x46cb('0xa')]));if(_0x3403fc[_0x46cb('0x7')]){utils[_0x46cb('0xb')](_0x3403fc[_0x46cb('0x7')])[_0x46cb('0xc')](function(_0x56258a){if(_0x56258a){_0x3403fc[_0x46cb('0xd')]=_0x56258a[_0x46cb('0xd')];_0x3403fc['agentacw']=_0x3403fc[_0x46cb('0xe')]?_0x56258a[_0x46cb('0xf')]:![];_0x3403fc['acwtime']=_0x3403fc[_0x46cb('0x10')]?_0x56258a[_0x46cb('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x3403fc);});}else{utils['request'](_0x46cb('0x12'),_0x3403fc);}if(_0x375bef){delete transfers[_0x3403fc[_0x46cb('0x6')]];}else{delete agents[_0x3403fc[_0x46cb('0x13')]];}}exports[_0x46cb('0x14')]=function(_0x553440){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0x553440);agents[_0x553440[_0x46cb('0x13')]]=_0x553440;agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x17')]=utils[_0x46cb('0x18')]();agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x19');agents[_0x553440['destuniqueid']][_0x46cb('0x9')]=null;agents[_0x553440['destuniqueid']][_0x46cb('0x1a')]=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x553440[_0x46cb('0x6')],agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x553440[_0x46cb('0x13')]));}catch(_0xbd488f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0xbd488f);}};exports[_0x46cb('0x1d')]=function(_0x149483){try{if(!_[_0x46cb('0x1e')](agents[_0x149483[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x149483);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x20'),_0x149483[_0x46cb('0x6')],agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x149483[_0x46cb('0x13')]));agents[_0x149483[_0x46cb('0x13')]]['agentringnoanswer']=!![];agents[_0x149483['destuniqueid']][_0x46cb('0x21')]=utils[_0x46cb('0x18')]();agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x22');agents[_0x149483['destuniqueid']][_0x46cb('0x23')]='timeout';agents[_0x149483['destuniqueid']]['holdtime']=_0x149483[_0x46cb('0x24')]?parseInt(_0x149483[_0x46cb('0x24')])/0x3e8:0x0;agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x25')]=0x0;unanswered[_0x46cb('0x26')](_0x149483[_0x46cb('0x13')]);}}catch(_0x378dc7){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x378dc7);}};exports['queuecallerabandon']=function(_0x1ce88f){try{_[_0x46cb('0x27')](agents,function(_0x4c73bd,_0x49e0bc){if(_0x4c73bd[_0x46cb('0x6')]==_0x1ce88f['uniqueid']&&!_[_0x46cb('0x28')](unanswered,_0x4c73bd[_0x46cb('0x13')])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f[_0x46cb('0x6')]),_0x1ce88f);utils['info'](util[_0x46cb('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ce88f[_0x46cb('0x6')],_0x4c73bd[_0x46cb('0x1b')],_0x4c73bd['destuniqueid']));_0x4c73bd[_0x46cb('0x1d')]=!![];_0x4c73bd[_0x46cb('0x21')]=utils[_0x46cb('0x18')]();_0x4c73bd[_0x46cb('0xa')]=_0x46cb('0x2a');_0x4c73bd['reason']=_0x46cb('0x2a');_0x4c73bd['holdtime']=_0x1ce88f[_0x46cb('0x2b')];_0x4c73bd[_0x46cb('0x25')]=0x0;writeDB(_0x4c73bd);}});}catch(_0x2630e0){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f['uniqueid']),_0x2630e0);}};exports[_0x46cb('0x2c')]=function(_0xf8be9){try{if(agents[_0xf8be9[_0x46cb('0x13')]]){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9[_0x46cb('0x6')]),_0xf8be9);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x2e'),_0xf8be9[_0x46cb('0x6')],agents[_0xf8be9['destuniqueid']]['membername'],_0xf8be9['destuniqueid']));agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x2f')]=utils[_0x46cb('0x18')]();agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x9')]=_0xf8be9[_0x46cb('0x9')];agents[_0xf8be9['destuniqueid']][_0x46cb('0x1a')]=_0xf8be9['connectedlinename'];agents[_0xf8be9['destuniqueid']][_0x46cb('0x2b')]=_0xf8be9['ringtime'];agents[_0xf8be9['destuniqueid']][_0x46cb('0xa')]='connect';_['forIn'](agents,function(_0x67bd14,_0x10017d){if(_0x67bd14[_0x46cb('0x13')]!=_0xf8be9[_0x46cb('0x13')]&&_0x67bd14[_0x46cb('0x6')]==_0xf8be9[_0x46cb('0x6')]){_0x67bd14[_0x46cb('0x25')]=0x0;_0x67bd14['holdtime']=_0xf8be9[_0x46cb('0x24')];_0x67bd14['agentringnoanswer']=!![];_0x67bd14[_0x46cb('0x21')]=utils['now']();_0x67bd14[_0x46cb('0xa')]=_0x46cb('0x30');_0x67bd14[_0x46cb('0x23')]='answered_elsewhere';_0x67bd14[_0x46cb('0x31')]=_0xf8be9[_0x46cb('0x13')];_0x67bd14['answeredelsewheremembername']=_0xf8be9[_0x46cb('0x1b')];writeDB(_0x67bd14);}});}}catch(_0x3d0b83){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9['uniqueid']),_0x3d0b83);}};exports['agentcomplete']=function(_0x10bada){try{if(!_['isNil'](agents[_0x10bada[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util['format'](_0x46cb('0x32'),_0x10bada[_0x46cb('0x6')]),_0x10bada);utils[_0x46cb('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x10bada['uniqueid'],agents[_0x10bada['destuniqueid']][_0x46cb('0x1b')],_0x10bada[_0x46cb('0x13')]));agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0xe')]=!![];agents[_0x10bada[_0x46cb('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x25')]=utils['diffTime'](agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x33')],agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x2f')]);agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x23')]=_0x10bada[_0x46cb('0x23')];agents[_0x10bada['destuniqueid']]['lastevent']=_0x46cb('0x34');writeDB(agents[_0x10bada['destuniqueid']]);}}catch(_0x2c4ecb){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')]('[%s][agents][agentcomplete]',_0x10bada[_0x46cb('0x6')]),_0x2c4ecb);}};exports['blindtransfer']=function(_0x5c02c9){try{if(!_[_0x46cb('0x1e')](agents[_0x5c02c9[_0x46cb('0x35')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9[_0x46cb('0x6')]),_0x5c02c9);utils[_0x46cb('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5c02c9[_0x46cb('0x6')],agents[_0x5c02c9[_0x46cb('0x35')]]['membername'],agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x6')]));agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x37')]=!![];agents[_0x5c02c9[_0x46cb('0x35')]]['transfertype']=_0x46cb('0x38');agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x39')]=_0x5c02c9['extension'];agents[_0x5c02c9[_0x46cb('0x35')]]['transferuniqueid']=agents[_0x5c02c9['transfereruniqueid']][_0x46cb('0x6')];}}catch(_0x2cfe6f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9['uniqueid']),_0x2cfe6f);}};exports[_0x46cb('0x3a')]=function(_0xd51a75){try{utils['debug'](util['format'](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0xd51a75);if(_0xd51a75[_0x46cb('0x3c')]==_0xd51a75['origtransfererlinkedid']){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3d')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x1b')]));agents[_0xd51a75[_0x46cb('0x3d')]]['transfer']=!![];agents[_0xd51a75[_0x46cb('0x3d')]]['transfertype']=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x40')];agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3c')];}if(_0xd51a75[_0x46cb('0x42')]&&agents[_0xd51a75[_0x46cb('0x42')]]){agents[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x42')]]=_[_0x46cb('0x44')](agents[_0xd51a75['transfereeuniqueid']]);transfers[_0xd51a75['transfereeuniqueid']]['calleridnum']=agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x42')]]['calleridname']=agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x42')]]['agentcalledAt']=utils['now']();transfers[_0xd51a75[_0x46cb('0x42')]]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x2;}}else if(_0xd51a75[_0x46cb('0x3d')]==_0xd51a75[_0x46cb('0x47')]){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3c')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x1b')]));agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x37')]=!![];agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x48')]=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x49')];agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3d')];}if(_0xd51a75[_0x46cb('0x4a')]&&agents[_0xd51a75[_0x46cb('0x4a')]]){agents[_0xd51a75['transfertargetuniqueid']][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x4a')]]=_[_0x46cb('0x44')](agents[_0xd51a75[_0x46cb('0x4a')]]);transfers[_0xd51a75[_0x46cb('0x4a')]]['calleridnum']=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x46')]=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x17')]=utils['now']();transfers[_0xd51a75['transfertargetuniqueid']]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x43')]=0x2;}}}catch(_0x1e3dca){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0x1e3dca);}};exports[_0x46cb('0x4b')]=function(_0x199dc0){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')]('[%s][agents][hangup]',_0x199dc0[_0x46cb('0x6')]),_0x199dc0);if(agents[_0x199dc0['uniqueid']]&&agents[_0x199dc0[_0x46cb('0x6')]]['reason']===_0x46cb('0x22')){if(_0x199dc0[_0x46cb('0x4c')]==='21'){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='rejected';agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]='rejected';}utils['info'](util[_0x46cb('0x4')](_0x46cb('0x4d'),_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0['uniqueid']]['reason'],agents[_0x199dc0['uniqueid']][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);var _0x30b303=unanswered[_0x46cb('0x4e')](_0x199dc0[_0x46cb('0x6')]);if(_0x30b303>-0x1){unanswered[_0x46cb('0x4f')](_0x30b303,0x1);}}if(transfers[_0x199dc0[_0x46cb('0x6')]]){transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')]=utils['now']();transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](transfers[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x2f')]);transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='agent';transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0['uniqueid'],transfers[_0x199dc0[_0x46cb('0x6')]]['membername'],transfers[_0x199dc0[_0x46cb('0x6')]]['reason'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(transfers[_0x199dc0[_0x46cb('0x6')]],!![]);}if(agents[_0x199dc0[_0x46cb('0x6')]]&&agents[_0x199dc0['uniqueid']][_0x46cb('0x2f')]){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];agents[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt']=utils['now']();agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')],agents[_0x199dc0[_0x46cb('0x6')]]['agentconnectAt']);agents[_0x199dc0['uniqueid']][_0x46cb('0x23')]=agents[_0x199dc0[_0x46cb('0x6')]]['transfer']?_0x46cb('0x37'):_0x46cb('0x51');agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util[_0x46cb('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);}}catch(_0x5567cc){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x52'),_0x199dc0[_0x46cb('0x6')]),_0x5567cc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 064ea3d..d41ecfb 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 _0x0837=['mohtime','varset','variable','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','substring','lastIndexOf','includes','hangup','noop','execif','toLowerCase','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','accountcode','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s'];(function(_0x52e613,_0xb74034){var _0x5e39f2=function(_0x35e469){while(--_0x35e469){_0x52e613['push'](_0x52e613['shift']());}};_0x5e39f2(++_0xb74034);}(_0x0837,0x1db));var _0x7083=function(_0x248495,_0x57ba62){_0x248495=_0x248495-0x0;var _0x5769a6=_0x0837[_0x248495];return _0x5769a6;};'use strict';var _=require(_0x7083('0x0'));var util=require(_0x7083('0x1'));var utils=require(_0x7083('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x7083('0x3'),_0x7083('0x4'),_0x7083('0x4'),_0x7083('0x3'),_0x7083('0x3'),_0x7083('0x3'),_0x7083('0x5'),_0x7083('0x6'),_0x7083('0x4'),'FAILED',_0x7083('0x4')];var channels={};function writeDB(_0x6bff72){var _0x12ccdd;if(transfers[_0x7083('0x7')][_0x6bff72[_0x7083('0x8')]]){_0x12ccdd=_0x6bff72[_0x7083('0x8')];_0x6bff72[_0x7083('0x8')]=transfers[_0x7083('0x7')][_0x6bff72[_0x7083('0x8')]][_0x7083('0x9')];}utils['info'](util['format'](_0x7083('0xa'),_0x6bff72['uniqueid'],_0x6bff72[_0x7083('0xb')],_0x6bff72['queue'],_0x6bff72[_0x7083('0xc')],_0x6bff72[_0x7083('0xd')],_0x6bff72[_0x7083('0xe')],_0x6bff72['connectedlinenum'],_0x6bff72['lastevent']));if(_0x6bff72[_0x7083('0xf')]){utils['getUserByInternal'](_0x6bff72[_0x7083('0xf')])[_0x7083('0x10')](function(_0x51190d){if(_0x51190d){_0x6bff72[_0x7083('0x11')]=_0x51190d['id'];}utils[_0x7083('0x12')](_0x7083('0x13'),_0x6bff72);});}else{utils['request'](_0x7083('0x13'),_0x6bff72);}if(channels[_0x6bff72['uniqueid']]){delete channels[_0x6bff72[_0x7083('0x8')]];}else if(_0x12ccdd&&channels[_0x12ccdd]){if(!transfers[_0x7083('0x7')][_0x12ccdd][_0x7083('0x14')])delete transfers[_0x7083('0x7')][_0x12ccdd];delete channels[_0x12ccdd];}}exports[_0x7083('0x15')]=function(_0x29b973){try{utils[_0x7083('0x16')](util[_0x7083('0x17')](_0x7083('0x18'),_0x29b973['uniqueid']),_0x29b973);if(_0x29b973['uniqueid']==_0x29b973[_0x7083('0x19')]&&_0x29b973[_0x7083('0xb')]!=_0x7083('0x1a')){utils['info'](util[_0x7083('0x17')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x29b973[_0x7083('0x8')],_0x29b973[_0x7083('0x1b')],_0x29b973[_0x7083('0x1c')]));channels[_0x29b973[_0x7083('0x8')]]={'uniqueid':_0x29b973[_0x7083('0x8')],'accountcode':_0x29b973['accountcode'],'source':_0x29b973['calleridnum'],'destination':_0x29b973[_0x7083('0x1c')],'destinationcontext':_0x29b973[_0x7083('0x1b')],'channel':_0x29b973[_0x7083('0xb')],'starttime':utils[_0x7083('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7083('0x3'),'amaflags':_0x7083('0x1e')};}}catch(_0x4749c3){utils[_0x7083('0x1f')](util[_0x7083('0x17')](_0x7083('0x18'),_0x29b973[_0x7083('0x8')]),_0x4749c3);}};exports['newstate']=function(_0x51c1bd){try{utils[_0x7083('0x16')](util[_0x7083('0x17')]('[%s][calls][newstate]',_0x51c1bd[_0x7083('0x8')]),_0x51c1bd);if(!_[_0x7083('0x20')](channels[_0x51c1bd[_0x7083('0x8')]])&&_0x51c1bd[_0x7083('0x21')]==0x6){utils[_0x7083('0x22')](util[_0x7083('0x17')](_0x7083('0x23'),_0x51c1bd['uniqueid'],_0x51c1bd[_0x7083('0x1b')],_0x51c1bd[_0x7083('0xb')]));if(_[_0x7083('0x20')](channels[_0x51c1bd[_0x7083('0x8')]][_0x7083('0x24')])){channels[_0x51c1bd[_0x7083('0x8')]][_0x7083('0x24')]=utils[_0x7083('0x1d')]();}}else if(!_[_0x7083('0x20')](channels[_0x51c1bd[_0x7083('0x19')]])&&_0x51c1bd['channelstate']==0x6&&_0x51c1bd[_0x7083('0x1b')]!=_0x7083('0x25')){utils[_0x7083('0x22')](util[_0x7083('0x17')](_0x7083('0x26'),_0x51c1bd[_0x7083('0x8')],_0x51c1bd['linkedid'],_0x51c1bd[_0x7083('0x1b')],_0x51c1bd['channel']));channels[_0x51c1bd[_0x7083('0x19')]][_0x7083('0xf')]=_0x51c1bd[_0x7083('0xf')];channels[_0x51c1bd[_0x7083('0x19')]][_0x7083('0x27')]=_0x51c1bd[_0x7083('0xb')];if(_['isNil'](channels[_0x51c1bd[_0x7083('0x19')]][_0x7083('0x28')])){channels[_0x51c1bd[_0x7083('0x19')]]['answertime']=utils[_0x7083('0x1d')]();}channels[_0x51c1bd[_0x7083('0x19')]][_0x7083('0x29')]=dispositions[_[_0x7083('0x2a')](_0x51c1bd['channelstate'])]||_0x7083('0x5');}}catch(_0x1a2a63){utils[_0x7083('0x1f')](util[_0x7083('0x17')](_0x7083('0x2b'),_0x51c1bd[_0x7083('0x8')]),_0x1a2a63);}};exports['hangup']=function(_0x100fcb){try{if(!_[_0x7083('0x20')](channels[_0x100fcb[_0x7083('0x8')]])){utils[_0x7083('0x16')](util[_0x7083('0x17')]('[%s][calls][hangup]',_0x100fcb[_0x7083('0x8')]),_0x100fcb);if(_['isNil'](channels[_0x100fcb['uniqueid']][_0x7083('0x2c')])){channels[_0x100fcb[_0x7083('0x8')]]['callerid']=_0x100fcb[_0x7083('0x2d')]+'\x20<'+_0x100fcb[_0x7083('0xe')]+'>';}utils['info'](util['format'](_0x7083('0x2e'),_0x100fcb[_0x7083('0x8')],channels[_0x100fcb[_0x7083('0x8')]][_0x7083('0x2c')],_0x100fcb['cause-txt']));channels[_0x100fcb[_0x7083('0x8')]][_0x7083('0x2f')]=utils[_0x7083('0x1d')]();channels[_0x100fcb[_0x7083('0x8')]][_0x7083('0x30')]=utils[_0x7083('0x31')](channels[_0x100fcb[_0x7083('0x8')]]['endtime'],channels[_0x100fcb[_0x7083('0x8')]][_0x7083('0x32')]);channels[_0x100fcb[_0x7083('0x8')]]['billableseconds']=channels[_0x100fcb[_0x7083('0x8')]][_0x7083('0x28')]?utils[_0x7083('0x31')](channels[_0x100fcb[_0x7083('0x8')]][_0x7083('0x2f')],channels[_0x100fcb['uniqueid']][_0x7083('0x28')]):0x0;writeDB(channels[_0x100fcb[_0x7083('0x8')]]);}}catch(_0x3812e7){utils[_0x7083('0x1f')](util[_0x7083('0x17')](_0x7083('0x33'),_0x100fcb[_0x7083('0x8')]),_0x3812e7);}};exports[_0x7083('0x34')]=function(_0x2fe6bd){try{if(!_['isNil'](channels[_0x2fe6bd[_0x7083('0x35')]])){utils[_0x7083('0x16')](util[_0x7083('0x17')](_0x7083('0x36'),_0x2fe6bd[_0x7083('0x37')]),_0x2fe6bd);if(channels[_0x2fe6bd[_0x7083('0x35')]]['channel']==_0x2fe6bd[_0x7083('0x38')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2fe6bd['origtransfereruniqueid'],_0x2fe6bd[_0x7083('0x35')],_0x2fe6bd[_0x7083('0x39')]));channels[_0x2fe6bd[_0x7083('0x35')]][_0x7083('0x27')]=_0x2fe6bd['secondtransfererchannel'];channels[_0x2fe6bd[_0x7083('0x35')]][_0x7083('0x3a')]=_0x7083('0x3b');}else if(channels[_0x2fe6bd[_0x7083('0x35')]][_0x7083('0xb')]=_0x2fe6bd[_0x7083('0x3c')]){utils['info'](util[_0x7083('0x17')](_0x7083('0x3d'),_0x2fe6bd[_0x7083('0x37')],_0x2fe6bd[_0x7083('0x35')],_0x2fe6bd[_0x7083('0x3e')]));channels[_0x2fe6bd['localtwolinkedid']][_0x7083('0x27')]=_0x2fe6bd[_0x7083('0x3e')];channels[_0x2fe6bd['localtwolinkedid']][_0x7083('0x3a')]=_0x7083('0x3b');}}}catch(_0x5e332a){utils[_0x7083('0x1f')](util[_0x7083('0x17')](_0x7083('0x36'),_0x2fe6bd[_0x7083('0x37')]),_0x5e332a);}};exports[_0x7083('0x3f')]=function(_0x297b36){try{if(!_[_0x7083('0x20')](channels[_0x297b36[_0x7083('0x8')]])){utils[_0x7083('0x16')](util[_0x7083('0x17')](_0x7083('0x40'),_0x297b36[_0x7083('0x8')]),_0x297b36);channels[_0x297b36['uniqueid']][_0x7083('0x41')]=utils['now']();utils[_0x7083('0x22')](util[_0x7083('0x17')](_0x7083('0x42'),_0x297b36[_0x7083('0x8')],channels[_0x297b36[_0x7083('0x8')]][_0x7083('0x41')]));}}catch(_0x19bf42){utils[_0x7083('0x1f')](util[_0x7083('0x17')](_0x7083('0x40'),_0x297b36['uniqueid']),_0x19bf42);}};exports[_0x7083('0x43')]=function(_0x365f2a){try{if(!_[_0x7083('0x20')](channels[_0x365f2a['uniqueid']])){utils[_0x7083('0x16')](util[_0x7083('0x17')](_0x7083('0x44'),_0x365f2a[_0x7083('0x8')]),_0x365f2a);if(!_[_0x7083('0x20')](channels[_0x365f2a[_0x7083('0x8')]][_0x7083('0x41')])){channels[_0x365f2a[_0x7083('0x8')]]['mohtime']+=utils[_0x7083('0x31')](utils[_0x7083('0x1d')](),channels[_0x365f2a[_0x7083('0x8')]][_0x7083('0x41')]);utils[_0x7083('0x22')](util[_0x7083('0x17')](_0x7083('0x45'),_0x365f2a['uniqueid'],channels[_0x365f2a[_0x7083('0x8')]][_0x7083('0x46')]));delete channels[_0x365f2a[_0x7083('0x8')]][_0x7083('0x41')];}}}catch(_0xf6782b){utils[_0x7083('0x1f')](util[_0x7083('0x17')]('[%s][calls][musiconholdstop]',_0x365f2a['uniqueid']),_0xf6782b);}};exports[_0x7083('0x47')]=function(_0x50491d){try{if(!_[_0x7083('0x20')](channels[_0x50491d[_0x7083('0x8')]])){utils[_0x7083('0x16')](util[_0x7083('0x17')]('[%s][calls][varset]',_0x50491d[_0x7083('0x8')]),_0x50491d);if(!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')]['xmd-originatecalleridnum'])){utils[_0x7083('0x22')](util[_0x7083('0x17')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x50491d['uniqueid'],_0x50491d[_0x7083('0x49')]));channels[_0x50491d[_0x7083('0x8')]]['source']=_0x50491d[_0x7083('0x49')];}if(!_[_0x7083('0x20')](_0x50491d['variable'][_0x7083('0x4a')])){utils['info'](util[_0x7083('0x17')](_0x7083('0x4b'),_0x50491d[_0x7083('0x8')],_0x50491d[_0x7083('0x49')]));channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x4c')]=_0x50491d[_0x7083('0x49')];channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x2c')]='\x22'+_0x50491d[_0x7083('0x49')]+_0x7083('0x4d')+_0x50491d[_0x7083('0x49')]+'>';}if(!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')][_0x7083('0x4e')])||!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')]['xmd-callerid'])){utils['info'](util['format'](_0x7083('0x4f'),_0x50491d[_0x7083('0x8')],!_['isNil'](_0x50491d['variable'][_0x7083('0x4e')])?_0x7083('0x4e'):_0x7083('0x50'),_0x50491d[_0x7083('0x49')]));channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x2c')]=_0x50491d[_0x7083('0x49')];}if(!_['isNil'](_0x50491d[_0x7083('0x48')][_0x7083('0x51')])||!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')][_0x7083('0x52')])){utils[_0x7083('0x22')](util[_0x7083('0x17')](_0x7083('0x4f'),_0x50491d[_0x7083('0x8')],!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')][_0x7083('0x51')])?'xmd-queue':_0x7083('0x52'),_0x50491d[_0x7083('0x49')]));channels[_0x50491d['uniqueid']][_0x7083('0x53')]=_0x7083('0x54');channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x55')]=_0x50491d[_0x7083('0x49')];channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x56')]=!![];}if(!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')][_0x7083('0x57')])){utils[_0x7083('0x22')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x50491d[_0x7083('0x8')],_0x50491d[_0x7083('0x49')]));channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x58')]=_0x50491d[_0x7083('0x49')];}if(!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')][_0x7083('0x59')])){utils[_0x7083('0x22')](util[_0x7083('0x17')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x50491d[_0x7083('0x8')],_0x50491d[_0x7083('0x49')]));channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x5a')]=_0x50491d[_0x7083('0x49')];}if(!_[_0x7083('0x20')](_0x50491d[_0x7083('0x48')][_0x7083('0x5b')])){utils[_0x7083('0x22')](util[_0x7083('0x17')](_0x7083('0x5c'),_0x50491d[_0x7083('0x8')],_0x50491d[_0x7083('0x49')]));channels[_0x50491d['uniqueid']]['routeid']=_0x50491d[_0x7083('0x49')];}if(!_[_0x7083('0x20')](_0x50491d['variable']['sipcallid'])){utils[_0x7083('0x22')](util[_0x7083('0x17')](_0x7083('0x5d'),_0x50491d[_0x7083('0x8')],_0x50491d[_0x7083('0x49')]));channels[_0x50491d[_0x7083('0x8')]][_0x7083('0x5e')]=_0x50491d[_0x7083('0x49')];}}}catch(_0x4be3ab){utils[_0x7083('0x1f')](util[_0x7083('0x17')]('[%s][calls][varset]',_0x50491d['uniqueid']),_0x4be3ab);}};exports[_0x7083('0x5f')]=function(_0x48ccfa){try{if(!_[_0x7083('0x20')](channels[_0x48ccfa[_0x7083('0x8')]])){utils[_0x7083('0x16')](util['format']('[%s][calls][newexten]',_0x48ccfa['uniqueid']),_0x48ccfa);utils['info'](util[_0x7083('0x17')](_0x7083('0x60'),_0x48ccfa['uniqueid'],_0x48ccfa[_0x7083('0x61')],_0x48ccfa[_0x7083('0x62')]));if(_0x48ccfa[_0x7083('0x61')]['toLowerCase']()==_0x7083('0x63')&&_[_0x7083('0x64')](_0x48ccfa[_0x7083('0x62')]['toLowerCase'](),'cdr')){var _0x395d0e=_0x48ccfa['appdata']['split']('=');var _0xb576b7=_0x395d0e[0x0][_0x7083('0x65')](_0x395d0e[0x0][_0x7083('0x66')]('(')+0x1,_0x395d0e[0x0]['lastIndexOf'](')'));var _0x41872d=_0x395d0e[0x1];channels[_0x48ccfa['uniqueid']][_0xb576b7]=_0x41872d;}if(!_[_0x7083('0x67')]([_0x7083('0x68'),_0x7083('0x69'),_0x7083('0x6a'),_0x7083('0x63'),'gotoif'],_0x48ccfa['application'][_0x7083('0x6b')]())){channels[_0x48ccfa[_0x7083('0x8')]][_0x7083('0x53')]=_0x48ccfa[_0x7083('0x61')];channels[_0x48ccfa['uniqueid']][_0x7083('0x55')]=_0x48ccfa['appdata'];}}}catch(_0x4a3d09){utils[_0x7083('0x1f')](util[_0x7083('0x17')](_0x7083('0x6c'),_0x48ccfa[_0x7083('0x8')]),_0x4a3d09);}}; \ No newline at end of file +var _0x1217=['request','uniqueid','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','isNil','channelstate','info','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','[%s][calls][newstate]','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','lastIndexOf','includes','noop','execif','gotoif','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','accountcode','getUserByInternal','then','UserId'];(function(_0x34d17a,_0x37a3ae){var _0x56e2be=function(_0x40eb40){while(--_0x40eb40){_0x34d17a['push'](_0x34d17a['shift']());}};_0x56e2be(++_0x37a3ae);}(_0x1217,0xbd));var _0x7121=function(_0x5c9768,_0x31c6da){_0x5c9768=_0x5c9768-0x0;var _0x12df0d=_0x1217[_0x5c9768];return _0x12df0d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x7121('0x0'));var dispositions=[_0x7121('0x1'),'FAILED',_0x7121('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x7121('0x1'),_0x7121('0x3'),_0x7121('0x4'),_0x7121('0x2'),_0x7121('0x2'),'FAILED'];var channels={};function writeDB(_0x42f293){utils['info'](util['format'](_0x7121('0x5'),_0x42f293['uniqueid'],_0x42f293[_0x7121('0x6')],_0x42f293[_0x7121('0x7')],_0x42f293[_0x7121('0x8')],_0x42f293[_0x7121('0x9')],_0x42f293[_0x7121('0xa')],_0x42f293['connectedlinenum'],_0x42f293['lastevent']));if(_0x42f293[_0x7121('0xb')]){utils[_0x7121('0xc')](_0x42f293['accountcode'])[_0x7121('0xd')](function(_0x345f87){if(_0x345f87){_0x42f293[_0x7121('0xe')]=_0x345f87['id'];}utils[_0x7121('0xf')]('CreateVoiceCallReport',_0x42f293);});}else{utils[_0x7121('0xf')]('CreateVoiceCallReport',_0x42f293);}if(channels[_0x42f293[_0x7121('0x10')]]){delete channels[_0x42f293[_0x7121('0x10')]];}}exports['newchannel']=function(_0x5df8){try{utils['debug'](util[_0x7121('0x11')](_0x7121('0x12'),_0x5df8[_0x7121('0x10')]),_0x5df8);if(_0x5df8['uniqueid']==_0x5df8[_0x7121('0x13')]&&_0x5df8[_0x7121('0x6')]!='OutgoingSpoolFailed'){utils['info'](util[_0x7121('0x11')](_0x7121('0x14'),_0x5df8[_0x7121('0x10')],_0x5df8[_0x7121('0x15')],_0x5df8[_0x7121('0x16')]));channels[_0x5df8['uniqueid']]={'uniqueid':_0x5df8[_0x7121('0x10')],'accountcode':_0x5df8['accountcode'],'source':_0x5df8[_0x7121('0xa')],'destination':_0x5df8['exten'],'destinationcontext':_0x5df8['context'],'channel':_0x5df8[_0x7121('0x6')],'starttime':utils[_0x7121('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7121('0x1'),'amaflags':_0x7121('0x18')};}}catch(_0x4e8fa1){utils[_0x7121('0x19')](util[_0x7121('0x11')]('[%s][calls][newchannel]',_0x5df8[_0x7121('0x10')]),_0x4e8fa1);}};exports[_0x7121('0x1a')]=function(_0x561fa4){try{utils[_0x7121('0x1b')](util[_0x7121('0x11')]('[%s][calls][newstate]',_0x561fa4[_0x7121('0x10')]),_0x561fa4);if(!_[_0x7121('0x1c')](channels[_0x561fa4[_0x7121('0x10')]])&&_0x561fa4[_0x7121('0x1d')]==0x6){utils[_0x7121('0x1e')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x561fa4[_0x7121('0x10')],_0x561fa4[_0x7121('0x15')],_0x561fa4[_0x7121('0x6')]));if(_[_0x7121('0x1c')](channels[_0x561fa4[_0x7121('0x10')]]['systemanswertime'])){channels[_0x561fa4[_0x7121('0x10')]]['systemanswertime']=utils[_0x7121('0x17')]();}}else if(!_[_0x7121('0x1c')](channels[_0x561fa4['linkedid']])&&_0x561fa4['channelstate']==0x6&&_0x561fa4[_0x7121('0x15')]!=_0x7121('0x1f')){utils[_0x7121('0x1e')](util[_0x7121('0x11')](_0x7121('0x20'),_0x561fa4['uniqueid'],_0x561fa4['linkedid'],_0x561fa4[_0x7121('0x15')],_0x561fa4[_0x7121('0x6')]));channels[_0x561fa4['linkedid']][_0x7121('0xb')]=_0x561fa4[_0x7121('0xb')];channels[_0x561fa4[_0x7121('0x13')]][_0x7121('0x21')]=_0x561fa4[_0x7121('0x6')];if(_['isNil'](channels[_0x561fa4[_0x7121('0x13')]][_0x7121('0x22')])){channels[_0x561fa4[_0x7121('0x13')]][_0x7121('0x22')]=utils[_0x7121('0x17')]();}channels[_0x561fa4[_0x7121('0x13')]][_0x7121('0x23')]=dispositions[_['toNumber'](_0x561fa4['channelstate'])]||_0x7121('0x3');}}catch(_0x732933){utils['error'](util['format'](_0x7121('0x24'),_0x561fa4[_0x7121('0x10')]),_0x732933);}};exports[_0x7121('0x25')]=function(_0x4787c6){try{if(!_[_0x7121('0x1c')](channels[_0x4787c6[_0x7121('0x10')]])){utils[_0x7121('0x1b')](util[_0x7121('0x11')]('[%s][calls][hangup]',_0x4787c6[_0x7121('0x10')]),_0x4787c6);if(_[_0x7121('0x1c')](channels[_0x4787c6[_0x7121('0x10')]]['callerid'])){channels[_0x4787c6[_0x7121('0x10')]][_0x7121('0x26')]=_0x4787c6[_0x7121('0x27')]+'\x20<'+_0x4787c6[_0x7121('0xa')]+'>';}utils['info'](util[_0x7121('0x11')](_0x7121('0x28'),_0x4787c6[_0x7121('0x10')],channels[_0x4787c6[_0x7121('0x10')]][_0x7121('0x26')],_0x4787c6[_0x7121('0x29')]));channels[_0x4787c6[_0x7121('0x10')]][_0x7121('0x2a')]=utils[_0x7121('0x17')]();channels[_0x4787c6['uniqueid']][_0x7121('0x2b')]=utils[_0x7121('0x2c')](channels[_0x4787c6[_0x7121('0x10')]][_0x7121('0x2a')],channels[_0x4787c6[_0x7121('0x10')]][_0x7121('0x2d')]);channels[_0x4787c6[_0x7121('0x10')]][_0x7121('0x2e')]=channels[_0x4787c6[_0x7121('0x10')]][_0x7121('0x22')]?utils[_0x7121('0x2c')](channels[_0x4787c6[_0x7121('0x10')]]['endtime'],channels[_0x4787c6[_0x7121('0x10')]]['answertime']):0x0;writeDB(channels[_0x4787c6[_0x7121('0x10')]]);}}catch(_0x40e3b1){utils[_0x7121('0x19')](util[_0x7121('0x11')](_0x7121('0x2f'),_0x4787c6[_0x7121('0x10')]),_0x40e3b1);}};exports[_0x7121('0x30')]=function(_0x428c0c){try{if(!_[_0x7121('0x1c')](channels[_0x428c0c[_0x7121('0x31')]])){utils[_0x7121('0x1b')](util[_0x7121('0x11')](_0x7121('0x32'),_0x428c0c[_0x7121('0x33')]),_0x428c0c);if(channels[_0x428c0c[_0x7121('0x31')]][_0x7121('0x6')]==_0x428c0c['transfereechannel']){utils[_0x7121('0x1e')](util[_0x7121('0x11')](_0x7121('0x34'),_0x428c0c[_0x7121('0x33')],_0x428c0c[_0x7121('0x31')],_0x428c0c['secondtransfererchannel']));channels[_0x428c0c[_0x7121('0x31')]]['destinationchannel']=_0x428c0c[_0x7121('0x35')];channels[_0x428c0c['localtwolinkedid']][_0x7121('0x36')]=_0x7121('0x37');}else if(channels[_0x428c0c[_0x7121('0x31')]]['channel']=_0x428c0c[_0x7121('0x38')]){utils['info'](util[_0x7121('0x11')](_0x7121('0x34'),_0x428c0c[_0x7121('0x33')],_0x428c0c[_0x7121('0x31')],_0x428c0c[_0x7121('0x39')]));channels[_0x428c0c[_0x7121('0x31')]][_0x7121('0x21')]=_0x428c0c['origtransfererchannel'];channels[_0x428c0c[_0x7121('0x31')]][_0x7121('0x36')]=_0x7121('0x37');}}}catch(_0x569448){utils['error'](util[_0x7121('0x11')](_0x7121('0x32'),_0x428c0c[_0x7121('0x33')]),_0x569448);}};exports[_0x7121('0x3a')]=function(_0x4e4a0b){try{if(!_[_0x7121('0x1c')](channels[_0x4e4a0b[_0x7121('0x10')]])){utils[_0x7121('0x1b')](util['format'](_0x7121('0x3b'),_0x4e4a0b[_0x7121('0x10')]),_0x4e4a0b);channels[_0x4e4a0b[_0x7121('0x10')]][_0x7121('0x3c')]=utils[_0x7121('0x17')]();utils['info'](util[_0x7121('0x11')](_0x7121('0x3d'),_0x4e4a0b[_0x7121('0x10')],channels[_0x4e4a0b['uniqueid']]['musiconholdstartAt']));}}catch(_0x2cf51d){utils[_0x7121('0x19')](util[_0x7121('0x11')](_0x7121('0x3b'),_0x4e4a0b['uniqueid']),_0x2cf51d);}};exports['musiconholdstop']=function(_0x5a1bea){try{if(!_[_0x7121('0x1c')](channels[_0x5a1bea[_0x7121('0x10')]])){utils[_0x7121('0x1b')](util[_0x7121('0x11')](_0x7121('0x3e'),_0x5a1bea[_0x7121('0x10')]),_0x5a1bea);if(!_[_0x7121('0x1c')](channels[_0x5a1bea['uniqueid']][_0x7121('0x3c')])){channels[_0x5a1bea[_0x7121('0x10')]][_0x7121('0x3f')]+=utils['diffTime'](utils[_0x7121('0x17')](),channels[_0x5a1bea['uniqueid']][_0x7121('0x3c')]);utils[_0x7121('0x1e')](util[_0x7121('0x11')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5a1bea[_0x7121('0x10')],channels[_0x5a1bea[_0x7121('0x10')]][_0x7121('0x3f')]));delete channels[_0x5a1bea['uniqueid']][_0x7121('0x3c')];}}}catch(_0x5290ad){utils[_0x7121('0x19')](util[_0x7121('0x11')](_0x7121('0x3e'),_0x5a1bea[_0x7121('0x10')]),_0x5290ad);}};exports[_0x7121('0x40')]=function(_0xe9abc2){try{if(!_['isNil'](channels[_0xe9abc2[_0x7121('0x10')]])){utils[_0x7121('0x1b')](util['format'](_0x7121('0x41'),_0xe9abc2[_0x7121('0x10')]),_0xe9abc2);if(!_[_0x7121('0x1c')](_0xe9abc2['variable'][_0x7121('0x42')])){utils[_0x7121('0x1e')](util[_0x7121('0x11')](_0x7121('0x43'),_0xe9abc2[_0x7121('0x10')],_0xe9abc2[_0x7121('0x44')]));channels[_0xe9abc2[_0x7121('0x10')]]['source']=_0xe9abc2['value'];}if(!_[_0x7121('0x1c')](_0xe9abc2[_0x7121('0x45')]['xmd-phone'])){utils[_0x7121('0x1e')](util[_0x7121('0x11')](_0x7121('0x46'),_0xe9abc2['uniqueid'],_0xe9abc2[_0x7121('0x44')]));channels[_0xe9abc2['uniqueid']][_0x7121('0x47')]=_0xe9abc2[_0x7121('0x44')];channels[_0xe9abc2[_0x7121('0x10')]][_0x7121('0x26')]='\x22'+_0xe9abc2[_0x7121('0x44')]+_0x7121('0x48')+_0xe9abc2[_0x7121('0x44')]+'>';}if(!_['isNil'](_0xe9abc2['variable'][_0x7121('0x49')])||!_[_0x7121('0x1c')](_0xe9abc2[_0x7121('0x45')][_0x7121('0x4a')])){utils['info'](util[_0x7121('0x11')](_0x7121('0x4b'),_0xe9abc2[_0x7121('0x10')],!_['isNil'](_0xe9abc2[_0x7121('0x45')][_0x7121('0x49')])?'xmd-callerid-preview':_0x7121('0x4a'),_0xe9abc2['value']));channels[_0xe9abc2[_0x7121('0x10')]][_0x7121('0x26')]=_0xe9abc2[_0x7121('0x44')];}if(!_[_0x7121('0x1c')](_0xe9abc2[_0x7121('0x45')][_0x7121('0x4c')])||!_[_0x7121('0x1c')](_0xe9abc2[_0x7121('0x45')][_0x7121('0x4d')])){utils[_0x7121('0x1e')](util[_0x7121('0x11')](_0x7121('0x4b'),_0xe9abc2[_0x7121('0x10')],!_[_0x7121('0x1c')](_0xe9abc2[_0x7121('0x45')][_0x7121('0x4c')])?'xmd-queue':_0x7121('0x4d'),_0xe9abc2['value']));channels[_0xe9abc2[_0x7121('0x10')]][_0x7121('0x4e')]=_0x7121('0x4f');channels[_0xe9abc2[_0x7121('0x10')]][_0x7121('0x50')]=_0xe9abc2[_0x7121('0x44')];channels[_0xe9abc2[_0x7121('0x10')]]['queue']=!![];}if(!_['isNil'](_0xe9abc2['variable'][_0x7121('0x51')])){utils[_0x7121('0x1e')](util['format'](_0x7121('0x52'),_0xe9abc2[_0x7121('0x10')],_0xe9abc2['value']));channels[_0xe9abc2['uniqueid']][_0x7121('0x53')]=_0xe9abc2[_0x7121('0x44')];}if(!_[_0x7121('0x1c')](_0xe9abc2[_0x7121('0x45')]['xmd-cdrtype'])){utils[_0x7121('0x1e')](util[_0x7121('0x11')](_0x7121('0x54'),_0xe9abc2[_0x7121('0x10')],_0xe9abc2[_0x7121('0x44')]));channels[_0xe9abc2[_0x7121('0x10')]][_0x7121('0x55')]=_0xe9abc2[_0x7121('0x44')];}if(!_['isNil'](_0xe9abc2['variable']['outboundrouteid'])){utils[_0x7121('0x1e')](util[_0x7121('0x11')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xe9abc2[_0x7121('0x10')],_0xe9abc2[_0x7121('0x44')]));channels[_0xe9abc2['uniqueid']]['routeid']=_0xe9abc2[_0x7121('0x44')];}if(!_[_0x7121('0x1c')](_0xe9abc2[_0x7121('0x45')][_0x7121('0x56')])){utils[_0x7121('0x1e')](util[_0x7121('0x11')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xe9abc2[_0x7121('0x10')],_0xe9abc2[_0x7121('0x44')]));channels[_0xe9abc2[_0x7121('0x10')]][_0x7121('0x56')]=_0xe9abc2[_0x7121('0x44')];}}}catch(_0x2f135d){utils[_0x7121('0x19')](util[_0x7121('0x11')](_0x7121('0x41'),_0xe9abc2[_0x7121('0x10')]),_0x2f135d);}};exports[_0x7121('0x57')]=function(_0x37e270){try{if(!_[_0x7121('0x1c')](channels[_0x37e270[_0x7121('0x10')]])){utils['debug'](util[_0x7121('0x11')](_0x7121('0x58'),_0x37e270['uniqueid']),_0x37e270);utils[_0x7121('0x1e')](util[_0x7121('0x11')](_0x7121('0x59'),_0x37e270[_0x7121('0x10')],_0x37e270[_0x7121('0x5a')],_0x37e270['appdata']));if(_0x37e270[_0x7121('0x5a')][_0x7121('0x5b')]()==_0x7121('0x5c')&&_[_0x7121('0x5d')](_0x37e270['appdata'][_0x7121('0x5b')](),_0x7121('0x5e'))){var _0x40b104=_0x37e270[_0x7121('0x5f')][_0x7121('0x60')]('=');var _0x3861d5=_0x40b104[0x0]['substring'](_0x40b104[0x0][_0x7121('0x61')]('(')+0x1,_0x40b104[0x0][_0x7121('0x61')](')'));var _0x40f576=_0x40b104[0x1];channels[_0x37e270['uniqueid']][_0x3861d5]=_0x40f576;}if(!_[_0x7121('0x62')](['hangup',_0x7121('0x63'),_0x7121('0x64'),_0x7121('0x5c'),_0x7121('0x65')],_0x37e270[_0x7121('0x5a')][_0x7121('0x5b')]())){channels[_0x37e270[_0x7121('0x10')]][_0x7121('0x4e')]=_0x37e270[_0x7121('0x5a')];channels[_0x37e270[_0x7121('0x10')]][_0x7121('0x50')]=_0x37e270[_0x7121('0x5f')];}}}catch(_0x3e78aa){utils[_0x7121('0x19')](util[_0x7121('0x11')](_0x7121('0x58'),_0x37e270[_0x7121('0x10')]),_0x3e78aa);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ad29edb..519e720 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 _0x47c8=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','info','[core]\x20connected'];(function(_0xfc28ad,_0x5f2924){var _0x2ab04a=function(_0x161f3b){while(--_0x161f3b){_0xfc28ad['push'](_0xfc28ad['shift']());}};_0x2ab04a(++_0x5f2924);}(_0x47c8,0x1cc));var _0x847c=function(_0x17ea2e,_0x30f79f){_0x17ea2e=_0x17ea2e-0x0;var _0x5aef45=_0x47c8[_0x17ea2e];return _0x5aef45;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x847c('0x0')](_0x847c('0x1'));};exports[_0x847c('0x2')]=function(){utils[_0x847c('0x0')](_0x847c('0x3'));};exports[_0x847c('0x4')]=function(){utils['info'](_0x847c('0x5'));};exports[_0x847c('0x6')]=function(_0x240bf0){utils[_0x847c('0x6')](_0x847c('0x7'),_0x240bf0);};exports[_0x847c('0x8')]=function(){utils['info'](_0x847c('0x9'));};exports[_0x847c('0xa')]=function(_0x1a803a){}; \ No newline at end of file +var _0xe382=['[core]\x20fullybooted','close','[core]\x20close','managerevent','connect','info','[core]\x20shutdown'];(function(_0x3ce352,_0x570c65){var _0x3de43a=function(_0x5cc99f){while(--_0x5cc99f){_0x3ce352['push'](_0x3ce352['shift']());}};_0x3de43a(++_0x570c65);}(_0xe382,0x1b6));var _0x2e38=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0xe382[_0x3616bb];return _0x1c0994;};'use strict';var utils=require('./utils');exports[_0x2e38('0x0')]=function(){utils[_0x2e38('0x1')]('[core]\x20connected');};exports['shutdown']=function(){utils['info'](_0x2e38('0x2'));};exports['fullybooted']=function(){utils[_0x2e38('0x1')](_0x2e38('0x3'));};exports['error']=function(_0x34f925){utils['error']('[core]\x20error',_0x34f925);};exports[_0x2e38('0x4')]=function(){utils['info'](_0x2e38('0x5'));};exports[_0x2e38('0x6')]=function(_0x5ca553){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b58514b..a7615f8 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 _0x08a4=['duration','endtime','holdtime','billableseconds','diffTime','[%s][dials][hangup]','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','format','[%s][dials][newexten]','appdata','application','toLowerCase','startsWith','cdr(routeid)','split','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridname','cause-txt','complete'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x08a4,0x1d1));var _0x408a=function(_0x5c386b,_0x2338b7){_0x5c386b=_0x5c386b-0x0;var _0x3d56d3=_0x08a4[_0x5c386b];return _0x3d56d3;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x542934){utils[_0x408a('0x0')](util['format'](_0x408a('0x1'),_0x542934['uniqueid'],_0x542934[_0x408a('0x2')],_0x542934[_0x408a('0x3')],_0x542934[_0x408a('0x4')],_0x542934['connectedlinenum'],_0x542934[_0x408a('0x5')]));utils[_0x408a('0x6')](_0x408a('0x7'),_0x542934);delete dials[_0x542934[_0x408a('0x8')]];}exports[_0x408a('0x9')]=function(_0x125246){try{utils[_0x408a('0xa')](util[_0x408a('0xb')](_0x408a('0xc'),_0x125246[_0x408a('0x8')]),_0x125246);utils[_0x408a('0x0')](util[_0x408a('0xb')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x125246[_0x408a('0x8')],_0x125246['application'],_0x125246[_0x408a('0xd')]));if(_0x125246[_0x408a('0xe')][_0x408a('0xf')]()=='set'&&_[_0x408a('0x10')](_0x125246[_0x408a('0xd')]['toLowerCase'](),_0x408a('0x11'))){var _0x1c8925=_0x125246[_0x408a('0xd')][_0x408a('0x12')]('=');dials[_0x125246['uniqueid']]={'routeId':_0x1c8925[0x1]};}}catch(_0x52d95c){utils['error'](util[_0x408a('0xb')]('[%s][dials][newexten]',_0x125246[_0x408a('0x8')]),_0x52d95c);}};exports['varset']=function(_0x228152){try{utils['debug'](util[_0x408a('0xb')](_0x408a('0x13'),_0x228152['uniqueid']),_0x228152);if(!_['isNil'](_0x228152[_0x408a('0x14')][_0x408a('0x15')])){utils[_0x408a('0x0')](util[_0x408a('0xb')](_0x408a('0x16'),_0x228152['uniqueid'],_0x228152[_0x408a('0x17')]));dials[_0x228152[_0x408a('0x8')]]={'routeId':_0x228152[_0x408a('0x17')]};}}catch(_0x4cf13f){utils['error'](util[_0x408a('0xb')](_0x408a('0x13'),_0x228152[_0x408a('0x8')]),_0x4cf13f);}};exports[_0x408a('0x18')]=function(_0x434d95){try{if(!_[_0x408a('0x19')](dials[_0x434d95[_0x408a('0x8')]])){utils[_0x408a('0xa')](util[_0x408a('0xb')](_0x408a('0x1a'),_0x434d95['uniqueid']),_0x434d95);dials[_0x434d95[_0x408a('0x8')]]=_[_0x408a('0x1b')](dials[_0x434d95[_0x408a('0x8')]],_0x434d95);dials[_0x434d95['uniqueid']][_0x408a('0x1c')]=utils[_0x408a('0x1d')]();dials[_0x434d95[_0x408a('0x8')]][_0x408a('0x1e')]=_0x408a('0x1f');utils[_0x408a('0x0')](util['format'](_0x408a('0x20'),_0x434d95['uniqueid'],dials[_0x434d95[_0x408a('0x8')]][_0x408a('0x1c')]));}}catch(_0x20f56e){utils[_0x408a('0x21')](util[_0x408a('0xb')](_0x408a('0x1a'),_0x434d95['uniqueid']),_0x20f56e);}};exports[_0x408a('0x22')]=function(_0x10b03e){try{if(!_[_0x408a('0x19')](dials[_0x10b03e[_0x408a('0x8')]])){utils[_0x408a('0xa')](util[_0x408a('0xb')](_0x408a('0x23'),_0x10b03e['uniqueid']),_0x10b03e);dials[_0x10b03e[_0x408a('0x8')]][_0x408a('0x5')]=_0x10b03e[_0x408a('0x5')];if(_0x10b03e[_0x408a('0x5')]==_0x408a('0x24')){dials[_0x10b03e[_0x408a('0x8')]]=_['assign'](dials[_0x10b03e[_0x408a('0x8')]],_0x10b03e);dials[_0x10b03e['uniqueid']][_0x408a('0x25')]=utils[_0x408a('0x1d')]();dials[_0x10b03e[_0x408a('0x8')]][_0x408a('0x1e')]=_0x408a('0x26');utils[_0x408a('0x0')](util[_0x408a('0xb')](_0x408a('0x27'),_0x10b03e[_0x408a('0x8')],_0x10b03e[_0x408a('0x5')],dials[_0x10b03e['uniqueid']][_0x408a('0x25')]));}else{utils[_0x408a('0x0')](util[_0x408a('0xb')](_0x408a('0x28'),_0x10b03e[_0x408a('0x8')],_0x10b03e['dialstatus']));}}}catch(_0x46387e){utils['error'](util[_0x408a('0xb')](_0x408a('0x23'),_0x10b03e['uniqueid']),_0x46387e);}};exports[_0x408a('0x29')]=function(_0x51ec0b){try{if(!_[_0x408a('0x19')](dials[_0x51ec0b[_0x408a('0x8')]])){utils[_0x408a('0xa')](util[_0x408a('0xb')]('[%s][dials][hangup]',_0x51ec0b[_0x408a('0x8')]),_0x51ec0b);utils[_0x408a('0x0')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x51ec0b[_0x408a('0x8')],_0x51ec0b[_0x408a('0x4')],_0x51ec0b[_0x408a('0x2a')],_0x51ec0b[_0x408a('0x2b')]));dials[_0x51ec0b['uniqueid']]=_[_0x408a('0x1b')](dials[_0x51ec0b['uniqueid']],{'endtime':utils[_0x408a('0x1d')](),'lastevent':_0x408a('0x2c')});dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x2d')]=utils['diffTime'](dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x2e')],dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x1c')]);dials[_0x51ec0b['uniqueid']][_0x408a('0x2f')]=utils['diffTime'](dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x25')]||dials[_0x51ec0b['uniqueid']][_0x408a('0x2e')],dials[_0x51ec0b['uniqueid']][_0x408a('0x1c')]);dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x30')]=dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x25')]?utils[_0x408a('0x31')](dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x2e')],dials[_0x51ec0b[_0x408a('0x8')]][_0x408a('0x25')]):0x0;writeDB(dials[_0x51ec0b[_0x408a('0x8')]]);}}catch(_0x5c1f86){utils['error'](util[_0x408a('0xb')](_0x408a('0x32'),_0x51ec0b['uniqueid']),_0x5c1f86);}}; \ No newline at end of file +var _0x5e64=['[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','isNil','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','holdtime','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x5e64,0x126));var _0x45e6=function(_0x36fabc,_0x229f6b){_0x36fabc=_0x36fabc-0x0;var _0x45fb61=_0x5e64[_0x36fabc];return _0x45fb61;};'use strict';var _=require(_0x45e6('0x0'));var util=require(_0x45e6('0x1'));var utils=require(_0x45e6('0x2'));var dials={};function writeDB(_0x137bb9){utils[_0x45e6('0x3')](util[_0x45e6('0x4')](_0x45e6('0x5'),_0x137bb9[_0x45e6('0x6')],_0x137bb9[_0x45e6('0x7')],_0x137bb9[_0x45e6('0x8')],_0x137bb9[_0x45e6('0x9')],_0x137bb9[_0x45e6('0xa')],_0x137bb9['dialstatus']));utils[_0x45e6('0xb')](_0x45e6('0xc'),_0x137bb9);delete dials[_0x137bb9['uniqueid']];}exports[_0x45e6('0xd')]=function(_0xe37869){try{utils[_0x45e6('0xe')](util[_0x45e6('0x4')]('[%s][dials][newexten]',_0xe37869[_0x45e6('0x6')]),_0xe37869);utils[_0x45e6('0x3')](util[_0x45e6('0x4')](_0x45e6('0xf'),_0xe37869[_0x45e6('0x6')],_0xe37869[_0x45e6('0x10')],_0xe37869[_0x45e6('0x11')]));if(_0xe37869[_0x45e6('0x10')][_0x45e6('0x12')]()=='set'&&_[_0x45e6('0x13')](_0xe37869[_0x45e6('0x11')][_0x45e6('0x12')](),_0x45e6('0x14'))){var _0x3120ef=_0xe37869[_0x45e6('0x11')][_0x45e6('0x15')]('=');dials[_0xe37869[_0x45e6('0x6')]]={'routeId':_0x3120ef[0x1]};}}catch(_0x3c2bd3){utils[_0x45e6('0x16')](util[_0x45e6('0x4')]('[%s][dials][newexten]',_0xe37869[_0x45e6('0x6')]),_0x3c2bd3);}};exports[_0x45e6('0x17')]=function(_0x4004c1){try{utils[_0x45e6('0xe')](util[_0x45e6('0x4')](_0x45e6('0x18'),_0x4004c1[_0x45e6('0x6')]),_0x4004c1);if(!_['isNil'](_0x4004c1['variable']['outboundrouteid'])){utils[_0x45e6('0x3')](util['format'](_0x45e6('0x19'),_0x4004c1[_0x45e6('0x6')],_0x4004c1['value']));dials[_0x4004c1[_0x45e6('0x6')]]={'routeId':_0x4004c1[_0x45e6('0x1a')]};}}catch(_0x33e60a){utils[_0x45e6('0x16')](util[_0x45e6('0x4')](_0x45e6('0x18'),_0x4004c1['uniqueid']),_0x33e60a);}};exports[_0x45e6('0x1b')]=function(_0x37ff66){try{if(!_['isNil'](dials[_0x37ff66[_0x45e6('0x6')]])){utils[_0x45e6('0xe')](util['format']('[%s][dials][dialbegin]',_0x37ff66['uniqueid']),_0x37ff66);dials[_0x37ff66[_0x45e6('0x6')]]=_[_0x45e6('0x1c')](dials[_0x37ff66[_0x45e6('0x6')]],_0x37ff66);dials[_0x37ff66['uniqueid']][_0x45e6('0x1d')]=utils['now']();dials[_0x37ff66[_0x45e6('0x6')]][_0x45e6('0x1e')]=_0x45e6('0x1f');utils[_0x45e6('0x3')](util[_0x45e6('0x4')](_0x45e6('0x20'),_0x37ff66['uniqueid'],dials[_0x37ff66[_0x45e6('0x6')]][_0x45e6('0x1d')]));}}catch(_0x9dff4){utils[_0x45e6('0x16')](util[_0x45e6('0x4')](_0x45e6('0x21'),_0x37ff66[_0x45e6('0x6')]),_0x9dff4);}};exports[_0x45e6('0x22')]=function(_0x902ebe){try{if(!_[_0x45e6('0x23')](dials[_0x902ebe['uniqueid']])){utils[_0x45e6('0xe')](util[_0x45e6('0x4')](_0x45e6('0x24'),_0x902ebe[_0x45e6('0x6')]),_0x902ebe);dials[_0x902ebe[_0x45e6('0x6')]][_0x45e6('0x25')]=_0x902ebe[_0x45e6('0x25')];if(_0x902ebe[_0x45e6('0x25')]==_0x45e6('0x26')){dials[_0x902ebe[_0x45e6('0x6')]]=_[_0x45e6('0x1c')](dials[_0x902ebe[_0x45e6('0x6')]],_0x902ebe);dials[_0x902ebe[_0x45e6('0x6')]][_0x45e6('0x27')]=utils[_0x45e6('0x28')]();dials[_0x902ebe[_0x45e6('0x6')]][_0x45e6('0x1e')]=_0x45e6('0x29');utils[_0x45e6('0x3')](util[_0x45e6('0x4')](_0x45e6('0x2a'),_0x902ebe[_0x45e6('0x6')],_0x902ebe[_0x45e6('0x25')],dials[_0x902ebe['uniqueid']][_0x45e6('0x27')]));}else{utils[_0x45e6('0x3')](util[_0x45e6('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x902ebe[_0x45e6('0x6')],_0x902ebe[_0x45e6('0x25')]));}}}catch(_0x12d185){utils[_0x45e6('0x16')](util[_0x45e6('0x4')]('[%s][dials][dialend]',_0x902ebe['uniqueid']),_0x12d185);}};exports['hangup']=function(_0x5e66aa){try{if(!_[_0x45e6('0x23')](dials[_0x5e66aa[_0x45e6('0x6')]])){utils[_0x45e6('0xe')](util[_0x45e6('0x4')]('[%s][dials][hangup]',_0x5e66aa[_0x45e6('0x6')]),_0x5e66aa);utils['info'](util[_0x45e6('0x4')](_0x45e6('0x2b'),_0x5e66aa[_0x45e6('0x6')],_0x5e66aa['calleridnum'],_0x5e66aa[_0x45e6('0x2c')],_0x5e66aa[_0x45e6('0x2d')]));dials[_0x5e66aa[_0x45e6('0x6')]]=_[_0x45e6('0x1c')](dials[_0x5e66aa[_0x45e6('0x6')]],{'endtime':utils['now'](),'lastevent':_0x45e6('0x2e')});dials[_0x5e66aa[_0x45e6('0x6')]][_0x45e6('0x2f')]=utils['diffTime'](dials[_0x5e66aa[_0x45e6('0x6')]]['endtime'],dials[_0x5e66aa['uniqueid']][_0x45e6('0x1d')]);dials[_0x5e66aa[_0x45e6('0x6')]][_0x45e6('0x30')]=utils[_0x45e6('0x31')](dials[_0x5e66aa[_0x45e6('0x6')]][_0x45e6('0x27')]||dials[_0x5e66aa[_0x45e6('0x6')]][_0x45e6('0x32')],dials[_0x5e66aa[_0x45e6('0x6')]][_0x45e6('0x1d')]);dials[_0x5e66aa[_0x45e6('0x6')]][_0x45e6('0x33')]=dials[_0x5e66aa['uniqueid']][_0x45e6('0x27')]?utils[_0x45e6('0x31')](dials[_0x5e66aa[_0x45e6('0x6')]][_0x45e6('0x32')],dials[_0x5e66aa['uniqueid']]['answertime']):0x0;writeDB(dials[_0x5e66aa[_0x45e6('0x6')]]);}}catch(_0x433d28){utils['error'](util[_0x45e6('0x4')](_0x45e6('0x34'),_0x5e66aa['uniqueid']),_0x433d28);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1a6f273..bb482bf 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 _0xd06e=['newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','device','[%s][index][devicestatechange]','agentcalled','format','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]','varset'];(function(_0x42fcf1,_0x65ee17){var _0x5af641=function(_0x4f0c44){while(--_0x4f0c44){_0x42fcf1['push'](_0x42fcf1['shift']());}};_0x5af641(++_0x65ee17);}(_0xd06e,0x91));var _0xed06=function(_0x169895,_0x116eb4){_0x169895=_0x169895-0x0;var _0x192798=_0xd06e[_0x169895];return _0x192798;};var AsteriskManager=require('asterisk-manager');var config=require(_0xed06('0x0'));var utils=require('./utils');var util=require(_0xed06('0x1'));var isXDREnabled=config[_0xed06('0x2')]&&config[_0xed06('0x2')][_0xed06('0x3')]?!config[_0xed06('0x2')][_0xed06('0x3')]:!![];var isProduction=config['env']===_0xed06('0x4')||![];var isLocalAsterisk=config[_0xed06('0x2')]&&config[_0xed06('0x2')][_0xed06('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xed06('0x6')][_0xed06('0x7')],config[_0xed06('0x6')]['ip'],config[_0xed06('0x6')][_0xed06('0x8')],config['asterisk'][_0xed06('0x9')],!![]);ami[_0xed06('0xa')]();if(!isXDREnabled){utils[_0xed06('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0xed06('0xc'));var queues=require(_0xed06('0xd'));var recordings=require(_0xed06('0xe'));var members=require(_0xed06('0xf'));var dials=require(_0xed06('0x10'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on']('connect',core[_0xed06('0x11')]);ami['on']('shutdown',core[_0xed06('0x12')]);ami['on'](_0xed06('0x13'),core[_0xed06('0x13')]);ami['on'](_0xed06('0x14'),core[_0xed06('0x14')]);ami['on'](_0xed06('0x15'),core[_0xed06('0x15')]);ami['on'](_0xed06('0x16'),core[_0xed06('0x16')]);ami['on'](_0xed06('0x17'),function(_0x5e66c9){try{utils[_0xed06('0x18')](util['format']('[%s][index][devicestatechange]',_0x5e66c9[_0xed06('0x19')]),_0x5e66c9);members['devicestatechange'](_0x5e66c9);}catch(_0x2ea7f5){utils['error'](util['format'](_0xed06('0x1a'),_0x5e66c9[_0xed06('0x19')]),_0x2ea7f5);}});ami['on'](_0xed06('0x1b'),function(_0x4bc202){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')]('[%s][index][agentcalled]',_0x4bc202[_0xed06('0x1d')]),_0x4bc202);agents[_0xed06('0x1b')](_0x4bc202);}catch(_0x4d4840){utils[_0xed06('0x14')](util['format'](_0xed06('0x1e'),_0x4bc202[_0xed06('0x1d')]),_0x4d4840);}});ami['on']('agentringnoanswer',function(_0x516bc7){try{utils['debug'](util['format'](_0xed06('0x1f'),_0x516bc7[_0xed06('0x1d')]),_0x516bc7);agents[_0xed06('0x20')](_0x516bc7);}catch(_0x443119){utils[_0xed06('0x14')](util[_0xed06('0x1c')](_0xed06('0x1f'),_0x516bc7[_0xed06('0x1d')]),_0x443119);}});ami['on'](_0xed06('0x21'),function(_0xee144c){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')]('[%s][index][agentconnect]',_0xee144c[_0xed06('0x1d')]),_0xee144c);agents[_0xed06('0x21')](_0xee144c);queues['agentconnect'](_0xee144c);}catch(_0x4f6920){utils['error'](util[_0xed06('0x1c')](_0xed06('0x22'),_0xee144c[_0xed06('0x1d')]),_0x4f6920);}});ami['on']('agentcomplete',function(_0x197ace){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x23'),_0x197ace[_0xed06('0x1d')]),_0x197ace);agents[_0xed06('0x24')](_0x197ace);queues[_0xed06('0x24')](_0x197ace);members[_0xed06('0x24')](_0x197ace);}catch(_0x38eb0a){utils[_0xed06('0x14')](util[_0xed06('0x1c')](_0xed06('0x23'),_0x197ace[_0xed06('0x1d')]),_0x38eb0a);}});ami['on']('queuecallerabandon',function(_0x794976){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x25'),_0x794976[_0xed06('0x1d')]),_0x794976);agents[_0xed06('0x26')](_0x794976);queues[_0xed06('0x26')](_0x794976);}catch(_0x2a124f){utils['error'](util[_0xed06('0x1c')]('[%s][index][queuecallerabandon]',_0x794976[_0xed06('0x1d')]),_0x2a124f);}});ami['on'](_0xed06('0x27'),function(_0x7c7267){try{utils['debug'](util[_0xed06('0x1c')]('[%s][index][queuecallerjoin]',_0x7c7267[_0xed06('0x1d')]),_0x7c7267);queues['queuecallerjoin'](_0x7c7267);recordings[_0xed06('0x27')](_0x7c7267);}catch(_0x40161a){utils[_0xed06('0x14')](util[_0xed06('0x1c')]('[%s][index][queuecallerjoin]',_0x7c7267[_0xed06('0x1d')]),_0x40161a);}});ami['on'](_0xed06('0x28'),function(_0x431f6e){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x29'),_0x431f6e[_0xed06('0x1d')]),_0x431f6e);queues[_0xed06('0x28')](_0x431f6e);}catch(_0x22082d){utils['error'](util[_0xed06('0x1c')]('[%s][index][queuecallerleave]',_0x431f6e[_0xed06('0x1d')]),_0x22082d);}});ami['on']('musiconholdstart',function(_0x35a8ed){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x2a'),_0x35a8ed['uniqueid']),_0x35a8ed);queues[_0xed06('0x2b')](_0x35a8ed);calls[_0xed06('0x2b')](_0x35a8ed);}catch(_0x4ab4d1){utils[_0xed06('0x14')](util['format'](_0xed06('0x2a'),_0x35a8ed[_0xed06('0x1d')]),_0x4ab4d1);}});ami['on']('musiconholdstop',function(_0x30541b){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x2c'),_0x30541b[_0xed06('0x1d')]),_0x30541b);queues['musiconholdstop'](_0x30541b);calls[_0xed06('0x2d')](_0x30541b);}catch(_0x21cb61){utils[_0xed06('0x14')](util['format'](_0xed06('0x2c'),_0x30541b['uniqueid']),_0x21cb61);}});ami['on'](_0xed06('0x2e'),function(_0xede325){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x2f'),_0xede325[_0xed06('0x1d')]),_0xede325);calls[_0xed06('0x2e')](_0xede325);recordings[_0xed06('0x2e')](_0xede325);}catch(_0x4b0f88){utils[_0xed06('0x14')](util['format'](_0xed06('0x2f'),_0xede325[_0xed06('0x1d')]),_0x4b0f88);}});ami['on'](_0xed06('0x30'),function(_0x3dd895){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x31'),_0x3dd895[_0xed06('0x1d')]),_0x3dd895);calls[_0xed06('0x30')](_0x3dd895);recordings[_0xed06('0x30')](_0x3dd895);dials[_0xed06('0x30')](_0x3dd895);agents[_0xed06('0x30')](_0x3dd895);queues[_0xed06('0x30')](_0x3dd895);}catch(_0x197ed9){utils[_0xed06('0x14')](util['format'](_0xed06('0x31'),_0x3dd895[_0xed06('0x1d')]),_0x197ed9);}});ami['on'](_0xed06('0x32'),function(_0x451059){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x33'),_0x451059[_0xed06('0x1d')]),_0x451059);members[_0xed06('0x32')](_0x451059);}catch(_0x354be9){utils[_0xed06('0x14')](util[_0xed06('0x1c')](_0xed06('0x33'),_0x451059[_0xed06('0x1d')]),_0x354be9);}});ami['on'](_0xed06('0x34'),function(_0x1ce4ba){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')]('[%s][index][blindtransfer]',_0x1ce4ba[_0xed06('0x1d')]),_0x1ce4ba);queues[_0xed06('0x34')](_0x1ce4ba);agents[_0xed06('0x34')](_0x1ce4ba);transfers[_0xed06('0x34')](_0x1ce4ba);recordings[_0xed06('0x34')](_0x1ce4ba);}catch(_0x59af98){utils['error'](util[_0xed06('0x1c')](_0xed06('0x35'),_0x1ce4ba[_0xed06('0x1d')]),_0x59af98);}});ami['on']('attendedtransfer',function(_0x1e3f3f){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x36'),_0x1e3f3f[_0xed06('0x37')]),_0x1e3f3f);queues[_0xed06('0x38')](_0x1e3f3f);transfers[_0xed06('0x38')](_0x1e3f3f);agents[_0xed06('0x38')](_0x1e3f3f);calls[_0xed06('0x38')](_0x1e3f3f);}catch(_0x4ab4cd){utils[_0xed06('0x14')](util[_0xed06('0x1c')](_0xed06('0x36'),_0x1e3f3f['origtransfereruniqueid']),_0x4ab4cd);}});ami['on']('varset',function(_0x38f37f){try{utils['debug'](util[_0xed06('0x1c')](_0xed06('0x39'),_0x38f37f[_0xed06('0x1d')]),_0x38f37f);queues[_0xed06('0x3a')](_0x38f37f);recordings['varset'](_0x38f37f);calls[_0xed06('0x3a')](_0x38f37f);dials[_0xed06('0x3a')](_0x38f37f);}catch(_0x543265){utils[_0xed06('0x14')](util[_0xed06('0x1c')](_0xed06('0x39'),_0x38f37f['uniqueid']),_0x543265);}});ami['on'](_0xed06('0x3b'),function(_0x43d192){try{utils[_0xed06('0x18')](util[_0xed06('0x1c')](_0xed06('0x3c'),_0x43d192[_0xed06('0x1d')]),_0x43d192);calls[_0xed06('0x3b')](_0x43d192);recordings[_0xed06('0x3b')](_0x43d192);dials[_0xed06('0x3b')](_0x43d192);}catch(_0x28d261){utils['error'](util['format'](_0xed06('0x3c'),_0x43d192[_0xed06('0x1d')]),_0x28d261);}});ami['on'](_0xed06('0x3d'),function(_0x4e432c){try{utils['debug'](util['format'](_0xed06('0x3e'),_0x4e432c[_0xed06('0x1d')]),_0x4e432c);calls[_0xed06('0x3d')](_0x4e432c);recordings[_0xed06('0x3d')](_0x4e432c);}catch(_0x255d8c){utils['error'](util[_0xed06('0x1c')](_0xed06('0x3e'),_0x4e432c['uniqueid']),_0x255d8c);}});ami['on'](_0xed06('0x3f'),function(_0x34d590){try{utils['debug'](util[_0xed06('0x1c')](_0xed06('0x40'),_0x34d590[_0xed06('0x1d')]),_0x34d590);dials[_0xed06('0x3f')](_0x34d590);}catch(_0x3042f3){utils[_0xed06('0x14')](util['format'](_0xed06('0x41'),_0x34d590['uniqueid']),_0x3042f3);}});ami['on'](_0xed06('0x42'),function(_0x2c8d92){try{utils['debug'](util[_0xed06('0x1c')]('[%s][index][dialend]',_0x2c8d92[_0xed06('0x1d')]),_0x2c8d92);dials[_0xed06('0x42')](_0x2c8d92);}catch(_0x5b849e){utils[_0xed06('0x14')](util[_0xed06('0x1c')](_0xed06('0x43'),_0x2c8d92[_0xed06('0x1d')]),_0x5b849e);}});} \ No newline at end of file +var _0xf36b=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','password','keepConnected','XDR\x20DISABLED','info','./agents.controller','./calls.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xf36b,0x173));var _0xbf36=function(_0xd7f808,_0x472576){_0xd7f808=_0xd7f808-0x0;var _0x42d390=_0xf36b[_0xd7f808];return _0x42d390;};var AsteriskManager=require(_0xbf36('0x0'));var config=require(_0xbf36('0x1'));var utils=require(_0xbf36('0x2'));var util=require(_0xbf36('0x3'));var isXDREnabled=config[_0xbf36('0x4')]&&config[_0xbf36('0x4')][_0xbf36('0x5')]?!config[_0xbf36('0x4')][_0xbf36('0x5')]:!![];var isProduction=config[_0xbf36('0x6')]===_0xbf36('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0xbf36('0x4')][_0xbf36('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config['asterisk']['ip'],config[_0xbf36('0x9')][_0xbf36('0xa')],config[_0xbf36('0x9')][_0xbf36('0xb')],!![]);ami[_0xbf36('0xc')]();if(!isXDREnabled){utils['info'](_0xbf36('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xbf36('0xe')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xbf36('0xf'));var calls=require(_0xbf36('0x10'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0xbf36('0x11'),core[_0xbf36('0x11')]);ami['on']('shutdown',core[_0xbf36('0x12')]);ami['on'](_0xbf36('0x13'),core[_0xbf36('0x13')]);ami['on'](_0xbf36('0x14'),core['error']);ami['on'](_0xbf36('0x15'),core[_0xbf36('0x15')]);ami['on'](_0xbf36('0x16'),core[_0xbf36('0x16')]);ami['on'](_0xbf36('0x17'),function(_0x469ea5){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x1a'),_0x469ea5[_0xbf36('0x1b')]),_0x469ea5);members[_0xbf36('0x17')](_0x469ea5);}catch(_0x12d379){utils['error'](util[_0xbf36('0x19')](_0xbf36('0x1a'),_0x469ea5[_0xbf36('0x1b')]),_0x12d379);}});ami['on'](_0xbf36('0x1c'),function(_0x4b04c4){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x1d'),_0x4b04c4['uniqueid']),_0x4b04c4);agents[_0xbf36('0x1c')](_0x4b04c4);}catch(_0x3459f9){utils[_0xbf36('0x14')](util['format'](_0xbf36('0x1d'),_0x4b04c4[_0xbf36('0x1e')]),_0x3459f9);}});ami['on'](_0xbf36('0x1f'),function(_0x1bbdde){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x20'),_0x1bbdde[_0xbf36('0x1e')]),_0x1bbdde);agents[_0xbf36('0x1f')](_0x1bbdde);}catch(_0xf0d2aa){utils[_0xbf36('0x14')](util[_0xbf36('0x19')]('[%s][index][agentringnoanswer]',_0x1bbdde['uniqueid']),_0xf0d2aa);}});ami['on'](_0xbf36('0x21'),function(_0x3117bf){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x22'),_0x3117bf[_0xbf36('0x1e')]),_0x3117bf);agents['agentconnect'](_0x3117bf);queues[_0xbf36('0x21')](_0x3117bf);}catch(_0x5d5690){utils[_0xbf36('0x14')](util['format'](_0xbf36('0x22'),_0x3117bf['uniqueid']),_0x5d5690);}});ami['on'](_0xbf36('0x23'),function(_0x4f386a){try{utils[_0xbf36('0x18')](util['format'](_0xbf36('0x24'),_0x4f386a[_0xbf36('0x1e')]),_0x4f386a);agents['agentcomplete'](_0x4f386a);queues[_0xbf36('0x23')](_0x4f386a);members['agentcomplete'](_0x4f386a);}catch(_0x39db8b){utils[_0xbf36('0x14')](util[_0xbf36('0x19')](_0xbf36('0x24'),_0x4f386a['uniqueid']),_0x39db8b);}});ami['on']('queuecallerabandon',function(_0x22a175){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x25'),_0x22a175[_0xbf36('0x1e')]),_0x22a175);agents[_0xbf36('0x26')](_0x22a175);queues[_0xbf36('0x26')](_0x22a175);}catch(_0x49743b){utils['error'](util[_0xbf36('0x19')](_0xbf36('0x25'),_0x22a175[_0xbf36('0x1e')]),_0x49743b);}});ami['on'](_0xbf36('0x27'),function(_0x5d2b2b){try{utils[_0xbf36('0x18')](util['format']('[%s][index][queuecallerjoin]',_0x5d2b2b[_0xbf36('0x1e')]),_0x5d2b2b);queues[_0xbf36('0x27')](_0x5d2b2b);recordings[_0xbf36('0x27')](_0x5d2b2b);}catch(_0x5e6cec){utils[_0xbf36('0x14')](util[_0xbf36('0x19')](_0xbf36('0x28'),_0x5d2b2b[_0xbf36('0x1e')]),_0x5e6cec);}});ami['on'](_0xbf36('0x29'),function(_0x1f0296){try{utils[_0xbf36('0x18')](util['format'](_0xbf36('0x2a'),_0x1f0296[_0xbf36('0x1e')]),_0x1f0296);queues[_0xbf36('0x29')](_0x1f0296);}catch(_0x2bc8f0){utils['error'](util[_0xbf36('0x19')]('[%s][index][queuecallerleave]',_0x1f0296['uniqueid']),_0x2bc8f0);}});ami['on'](_0xbf36('0x2b'),function(_0x5e442f){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')]('[%s][index][musiconholdstart]',_0x5e442f[_0xbf36('0x1e')]),_0x5e442f);queues[_0xbf36('0x2b')](_0x5e442f);calls[_0xbf36('0x2b')](_0x5e442f);}catch(_0x37e323){utils['error'](util['format'](_0xbf36('0x2c'),_0x5e442f[_0xbf36('0x1e')]),_0x37e323);}});ami['on'](_0xbf36('0x2d'),function(_0x23736b){try{utils['debug'](util[_0xbf36('0x19')]('[%s][index][musiconholdstop]',_0x23736b[_0xbf36('0x1e')]),_0x23736b);queues[_0xbf36('0x2d')](_0x23736b);calls[_0xbf36('0x2d')](_0x23736b);}catch(_0x51cd56){utils[_0xbf36('0x14')](util[_0xbf36('0x19')](_0xbf36('0x2e'),_0x23736b[_0xbf36('0x1e')]),_0x51cd56);}});ami['on'](_0xbf36('0x2f'),function(_0x556ad4){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')]('[%s][index][newstate]',_0x556ad4['uniqueid']),_0x556ad4);calls[_0xbf36('0x2f')](_0x556ad4);recordings[_0xbf36('0x2f')](_0x556ad4);}catch(_0x504368){utils['error'](util[_0xbf36('0x19')](_0xbf36('0x30'),_0x556ad4[_0xbf36('0x1e')]),_0x504368);}});ami['on'](_0xbf36('0x31'),function(_0x324fb3){try{utils['debug'](util['format'](_0xbf36('0x32'),_0x324fb3[_0xbf36('0x1e')]),_0x324fb3);calls[_0xbf36('0x31')](_0x324fb3);recordings[_0xbf36('0x31')](_0x324fb3);dials[_0xbf36('0x31')](_0x324fb3);agents['hangup'](_0x324fb3);queues[_0xbf36('0x31')](_0x324fb3);}catch(_0x490498){utils[_0xbf36('0x14')](util[_0xbf36('0x19')](_0xbf36('0x32'),_0x324fb3[_0xbf36('0x1e')]),_0x490498);}});ami['on'](_0xbf36('0x33'),function(_0x10ad86){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x34'),_0x10ad86['uniqueid']),_0x10ad86);members['cdr'](_0x10ad86);}catch(_0x93d441){utils[_0xbf36('0x14')](util[_0xbf36('0x19')](_0xbf36('0x34'),_0x10ad86[_0xbf36('0x1e')]),_0x93d441);}});ami['on'](_0xbf36('0x35'),function(_0x2196ee){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x36'),_0x2196ee[_0xbf36('0x1e')]),_0x2196ee);queues[_0xbf36('0x35')](_0x2196ee);agents[_0xbf36('0x35')](_0x2196ee);transfers[_0xbf36('0x35')](_0x2196ee);}catch(_0x529e54){utils[_0xbf36('0x14')](util[_0xbf36('0x19')]('[%s][index][blindtransfer]',_0x2196ee[_0xbf36('0x1e')]),_0x529e54);}});ami['on'](_0xbf36('0x37'),function(_0x128e12){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')]('[%s][index][attendedtransfer]',_0x128e12[_0xbf36('0x38')]),_0x128e12);queues[_0xbf36('0x37')](_0x128e12);transfers[_0xbf36('0x37')](_0x128e12);agents[_0xbf36('0x37')](_0x128e12);calls['attendedtransfer'](_0x128e12);}catch(_0x5438f7){utils[_0xbf36('0x14')](util[_0xbf36('0x19')](_0xbf36('0x39'),_0x128e12[_0xbf36('0x38')]),_0x5438f7);}});ami['on'](_0xbf36('0x3a'),function(_0x2524fe){try{utils['debug'](util[_0xbf36('0x19')](_0xbf36('0x3b'),_0x2524fe[_0xbf36('0x1e')]),_0x2524fe);queues[_0xbf36('0x3a')](_0x2524fe);recordings[_0xbf36('0x3a')](_0x2524fe);calls['varset'](_0x2524fe);dials[_0xbf36('0x3a')](_0x2524fe);}catch(_0x47d94d){utils[_0xbf36('0x14')](util[_0xbf36('0x19')]('[%s][index][varset]',_0x2524fe['uniqueid']),_0x47d94d);}});ami['on'](_0xbf36('0x3c'),function(_0x2e9850){try{utils['debug'](util['format'](_0xbf36('0x3d'),_0x2e9850['uniqueid']),_0x2e9850);calls[_0xbf36('0x3c')](_0x2e9850);recordings[_0xbf36('0x3c')](_0x2e9850);dials[_0xbf36('0x3c')](_0x2e9850);}catch(_0x3d4e00){utils[_0xbf36('0x14')](util[_0xbf36('0x19')](_0xbf36('0x3d'),_0x2e9850[_0xbf36('0x1e')]),_0x3d4e00);}});ami['on'](_0xbf36('0x3e'),function(_0x56ef7b){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')]('[%s][index][newchannel]',_0x56ef7b[_0xbf36('0x1e')]),_0x56ef7b);calls[_0xbf36('0x3e')](_0x56ef7b);recordings[_0xbf36('0x3e')](_0x56ef7b);}catch(_0x274b57){utils['error'](util[_0xbf36('0x19')](_0xbf36('0x3f'),_0x56ef7b['uniqueid']),_0x274b57);}});ami['on'](_0xbf36('0x40'),function(_0x16a97c){try{utils['debug'](util[_0xbf36('0x19')](_0xbf36('0x41'),_0x16a97c[_0xbf36('0x1e')]),_0x16a97c);dials[_0xbf36('0x40')](_0x16a97c);}catch(_0x20864c){utils['error'](util[_0xbf36('0x19')](_0xbf36('0x42'),_0x16a97c[_0xbf36('0x1e')]),_0x20864c);}});ami['on']('dialend',function(_0x61b8cf){try{utils[_0xbf36('0x18')](util[_0xbf36('0x19')](_0xbf36('0x43'),_0x61b8cf[_0xbf36('0x1e')]),_0x61b8cf);dials[_0xbf36('0x44')](_0x61b8cf);}catch(_0x5ed671){utils['error'](util['format'](_0xbf36('0x43'),_0x61b8cf[_0xbf36('0x1e')]),_0x5ed671);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8c38070..450c808 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 _0xbcc4=['internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','then','name'];(function(_0x4e924c,_0x16a72c){var _0x32ce75=function(_0x35cae0){while(--_0x35cae0){_0x4e924c['push'](_0x4e924c['shift']());}};_0x32ce75(++_0x16a72c);}(_0xbcc4,0x12b));var _0x4bcc=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbcc4[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x4bcc('0x0'));var util=require('util');var utils=require(_0x4bcc('0x1'));var members={};var exclude=[_0x4bcc('0x2'),_0x4bcc('0x3')];function writeDB(_0x42ed85){utils['info'](util[_0x4bcc('0x4')](_0x4bcc('0x5'),_0x42ed85['uniqueid'],_0x42ed85['interface'],_0x42ed85[_0x4bcc('0x6')],_0x42ed85[_0x4bcc('0x7')],_0x42ed85[_0x4bcc('0x8')],_0x42ed85[_0x4bcc('0x9')]));if(_0x42ed85[_0x4bcc('0xa')]){utils['getUserByInterface'](_0x42ed85[_0x4bcc('0xa')])[_0x4bcc('0xb')](function(_0x200a23){if(_0x200a23){_0x42ed85[_0x4bcc('0x8')]=_0x200a23[_0x4bcc('0xc')];_0x42ed85[_0x4bcc('0xd')]=_0x200a23[_0x4bcc('0xd')];utils['request'](_0x4bcc('0xe'),_0x42ed85);}else{utils[_0x4bcc('0xf')](_0x42ed85['interface'][_0x4bcc('0x10')]('/')[0x1])[_0x4bcc('0xb')](function(_0x185235){if(_0x185235){_0x42ed85['membername']=_0x185235[_0x4bcc('0xc')];_0x42ed85[_0x4bcc('0xd')]=_0x185235[_0x4bcc('0xd')];utils[_0x4bcc('0x11')](_0x4bcc('0xe'),_0x42ed85);}});}})[_0x4bcc('0x12')](function(_0x4fb281){utils[_0x4bcc('0x13')](util[_0x4bcc('0x4')](_0x4bcc('0x14'),_0x42ed85['uniqueid']),_0x4fb281);});}delete members[_0x42ed85[_0x4bcc('0xa')]];}function startsWith(_0x3ab2f2,_0x32a9ad){return _[_0x4bcc('0x15')](_0x3ab2f2,function(_0x1382b0){return _[_0x4bcc('0x16')](_0x32a9ad,_0x1382b0);});}exports[_0x4bcc('0x17')]=function(_0x1077eb){try{utils[_0x4bcc('0x18')](util[_0x4bcc('0x4')](_0x4bcc('0x19'),members[_0x1077eb[_0x4bcc('0x1a')]]?members[_0x1077eb[_0x4bcc('0x1a')]][_0x4bcc('0x1b')]:_0x1077eb[_0x4bcc('0x1a')]),_0x1077eb);utils[_0x4bcc('0x1c')](util[_0x4bcc('0x4')](_0x4bcc('0x1d'),members[_0x1077eb['device']]?members[_0x1077eb[_0x4bcc('0x1a')]]['uniqueid']:_0x1077eb[_0x4bcc('0x1a')],_0x1077eb[_0x4bcc('0x1e')],_0x1077eb['device']));switch(_0x1077eb[_0x4bcc('0x1e')]){case _0x4bcc('0x1f'):case'BUSY':if(!startsWith(exclude,_0x1077eb[_0x4bcc('0x1a')])){members[_0x1077eb['device']]={'channel':'voice','interface':_0x1077eb[_0x4bcc('0x1a')],'type':_0x4bcc('0x20'),'enterAt':utils[_0x4bcc('0x21')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x4bcc('0x22')](members[_0x1077eb[_0x4bcc('0x1a')]])){members[_0x1077eb[_0x4bcc('0x1a')]]['exitAt']=utils[_0x4bcc('0x21')]();members[_0x1077eb[_0x4bcc('0x1a')]][_0x4bcc('0x23')]=utils[_0x4bcc('0x24')](members[_0x1077eb[_0x4bcc('0x1a')]][_0x4bcc('0x25')],members[_0x1077eb[_0x4bcc('0x1a')]][_0x4bcc('0x26')]);if(members[_0x1077eb[_0x4bcc('0x1a')]]['uniqueid']){writeDB(members[_0x1077eb[_0x4bcc('0x1a')]]);}}break;default:break;}}catch(_0x328e18){utils[_0x4bcc('0x13')](util[_0x4bcc('0x4')](_0x4bcc('0x19'),members[_0x1077eb[_0x4bcc('0x1a')]]?members[_0x1077eb['device']][_0x4bcc('0x1b')]:_0x1077eb['device']),_0x328e18);}};exports[_0x4bcc('0x27')]=function(_0x5b5fa9){try{if(!_['isNil'](members[_0x5b5fa9[_0x4bcc('0xa')]])){utils[_0x4bcc('0x18')](util['format'](_0x4bcc('0x28'),_0x5b5fa9[_0x4bcc('0x1b')]),_0x5b5fa9);utils[_0x4bcc('0x1c')](util[_0x4bcc('0x4')](_0x4bcc('0x29'),_0x5b5fa9[_0x4bcc('0x1b')],_0x5b5fa9[_0x4bcc('0xa')],_0x5b5fa9['queue']));members[_0x5b5fa9[_0x4bcc('0xa')]]=_[_0x4bcc('0x2a')](members[_0x5b5fa9[_0x4bcc('0xa')]],{'data4':_0x5b5fa9[_0x4bcc('0x2b')],'uniqueid':_0x5b5fa9[_0x4bcc('0x1b')]});}}catch(_0x2b7e33){utils[_0x4bcc('0x13')](util[_0x4bcc('0x4')](_0x4bcc('0x28'),_0x5b5fa9[_0x4bcc('0x1b')]),_0x2b7e33);}};exports[_0x4bcc('0x2c')]=function(_0xd924ac){try{utils['debug'](util[_0x4bcc('0x4')](_0x4bcc('0x2d'),_0xd924ac[_0x4bcc('0x1b')]),_0xd924ac);if(_0xd924ac['channel']){var _0xdc72cf=_0xd924ac[_0x4bcc('0x6')][_0x4bcc('0x10')]('-')[0x0];if(!_[_0x4bcc('0x22')](members[_0xdc72cf])){members[_0xdc72cf]=_[_0x4bcc('0x2a')](members[_0xdc72cf],{'data1':members[_0xdc72cf]['data1']||_0xd924ac['type'],'data2':members[_0xdc72cf][_0x4bcc('0x7')]||_0xd924ac[_0x4bcc('0x2e')],'data3':members[_0xdc72cf][_0x4bcc('0x2f')]||_0xd924ac[_0x4bcc('0x30')],'uniqueid':members[_0xdc72cf][_0x4bcc('0x1b')]||_0xd924ac['uniqueid']});utils[_0x4bcc('0x1c')](util[_0x4bcc('0x4')](_0x4bcc('0x31'),_0xd924ac[_0x4bcc('0x1b')],members[_0xdc72cf][_0x4bcc('0x32')],members[_0xdc72cf][_0x4bcc('0x7')],members[_0xdc72cf][_0x4bcc('0x2f')]));if(members[_0xdc72cf][_0x4bcc('0x25')]){writeDB(members[_0xdc72cf]);}}}if(_0xd924ac[_0x4bcc('0x33')]){var _0x4f8971=_0xd924ac[_0x4bcc('0x33')][_0x4bcc('0x10')]('-')[0x0];if(!_[_0x4bcc('0x22')](members[_0x4f8971])){members[_0x4f8971]=_[_0x4bcc('0x2a')](members[_0x4f8971],{'data1':members[_0x4f8971][_0x4bcc('0x32')]||_0xd924ac[_0x4bcc('0x9')],'data2':members[_0x4f8971]['data2']||_0xd924ac[_0x4bcc('0x2e')],'data3':members[_0x4f8971][_0x4bcc('0x2f')]||_0xd924ac[_0x4bcc('0x30')],'uniqueid':members[_0x4f8971][_0x4bcc('0x1b')]||_0xd924ac[_0x4bcc('0x1b')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xd924ac['uniqueid'],members[_0x4f8971][_0x4bcc('0x32')],members[_0x4f8971][_0x4bcc('0x7')],members[_0x4f8971][_0x4bcc('0x2f')]));if(members[_0x4f8971][_0x4bcc('0x25')]){writeDB(members[_0x4f8971]);}}}}catch(_0x1034d4){utils['error'](util[_0x4bcc('0x4')](_0x4bcc('0x2d'),_0xd924ac['uniqueid']),_0x1034d4);}}; \ No newline at end of file +var _0x7d56=['agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','source','lodash','util','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','name','internal','request','split','then','CreateMemberReport','catch','error','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]'];(function(_0x2d1029,_0x1add9b){var _0x50889d=function(_0x5a5b7a){while(--_0x5a5b7a){_0x2d1029['push'](_0x2d1029['shift']());}};_0x50889d(++_0x1add9b);}(_0x7d56,0x156));var _0x67d5=function(_0x6c783b,_0x5dd915){_0x6c783b=_0x6c783b-0x0;var _0x3382da=_0x7d56[_0x6c783b];return _0x3382da;};'use strict';var _=require(_0x67d5('0x0'));var util=require(_0x67d5('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x1a777c){utils[_0x67d5('0x2')](util[_0x67d5('0x3')](_0x67d5('0x4'),_0x1a777c[_0x67d5('0x5')],_0x1a777c[_0x67d5('0x6')],_0x1a777c[_0x67d5('0x7')],_0x1a777c[_0x67d5('0x8')],_0x1a777c[_0x67d5('0x9')],_0x1a777c['type']));if(_0x1a777c[_0x67d5('0x6')]){utils['getUserByInterface'](_0x1a777c[_0x67d5('0x6')])['then'](function(_0x12b4f6){if(_0x12b4f6){_0x1a777c['membername']=_0x12b4f6[_0x67d5('0xa')];_0x1a777c[_0x67d5('0xb')]=_0x12b4f6['internal'];utils[_0x67d5('0xc')]('CreateMemberReport',_0x1a777c);}else{utils['getUserByName'](_0x1a777c[_0x67d5('0x6')][_0x67d5('0xd')]('/')[0x1])[_0x67d5('0xe')](function(_0x1c818b){if(_0x1c818b){_0x1a777c[_0x67d5('0x9')]=_0x1c818b['name'];_0x1a777c[_0x67d5('0xb')]=_0x1c818b[_0x67d5('0xb')];utils['request'](_0x67d5('0xf'),_0x1a777c);}});}})[_0x67d5('0x10')](function(_0x11a58f){utils[_0x67d5('0x11')](util[_0x67d5('0x3')]('[%s][members][writeDB]',_0x1a777c['uniqueid']),_0x11a58f);});}delete members[_0x1a777c[_0x67d5('0x6')]];}function startsWith(_0x372614,_0x33c7de){return _[_0x67d5('0x12')](_0x372614,function(_0x1104fa){return _[_0x67d5('0x13')](_0x33c7de,_0x1104fa);});}exports['devicestatechange']=function(_0x1e2e0d){try{utils[_0x67d5('0x14')](util[_0x67d5('0x3')]('[%s][members][devicestatechange]',members[_0x1e2e0d[_0x67d5('0x15')]]?members[_0x1e2e0d[_0x67d5('0x15')]][_0x67d5('0x5')]:_0x1e2e0d[_0x67d5('0x15')]),_0x1e2e0d);utils[_0x67d5('0x2')](util['format'](_0x67d5('0x16'),members[_0x1e2e0d[_0x67d5('0x15')]]?members[_0x1e2e0d[_0x67d5('0x15')]][_0x67d5('0x5')]:_0x1e2e0d[_0x67d5('0x15')],_0x1e2e0d[_0x67d5('0x17')],_0x1e2e0d['device']));switch(_0x1e2e0d['state']){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x1e2e0d[_0x67d5('0x15')])){members[_0x1e2e0d[_0x67d5('0x15')]]={'channel':'voice','interface':_0x1e2e0d['device'],'type':_0x67d5('0x18'),'enterAt':utils[_0x67d5('0x19')](),'role':_0x67d5('0x1a')};}break;case _0x67d5('0x1b'):if(!_[_0x67d5('0x1c')](members[_0x1e2e0d['device']])){members[_0x1e2e0d[_0x67d5('0x15')]][_0x67d5('0x1d')]=utils['now']();members[_0x1e2e0d[_0x67d5('0x15')]][_0x67d5('0x1e')]=utils[_0x67d5('0x1f')](members[_0x1e2e0d[_0x67d5('0x15')]]['exitAt'],members[_0x1e2e0d[_0x67d5('0x15')]][_0x67d5('0x20')]);if(members[_0x1e2e0d[_0x67d5('0x15')]]['uniqueid']){writeDB(members[_0x1e2e0d[_0x67d5('0x15')]]);}}break;default:break;}}catch(_0x3bef23){utils[_0x67d5('0x11')](util['format'](_0x67d5('0x21'),members[_0x1e2e0d[_0x67d5('0x15')]]?members[_0x1e2e0d[_0x67d5('0x15')]][_0x67d5('0x5')]:_0x1e2e0d[_0x67d5('0x15')]),_0x3bef23);}};exports[_0x67d5('0x22')]=function(_0x42d078){try{if(!_[_0x67d5('0x1c')](members[_0x42d078[_0x67d5('0x6')]])){utils[_0x67d5('0x14')](util[_0x67d5('0x3')](_0x67d5('0x23'),_0x42d078[_0x67d5('0x5')]),_0x42d078);utils[_0x67d5('0x2')](util[_0x67d5('0x3')](_0x67d5('0x24'),_0x42d078['uniqueid'],_0x42d078[_0x67d5('0x6')],_0x42d078[_0x67d5('0x25')]));members[_0x42d078[_0x67d5('0x6')]]=_[_0x67d5('0x26')](members[_0x42d078['interface']],{'data4':_0x42d078[_0x67d5('0x25')],'uniqueid':_0x42d078[_0x67d5('0x5')]});}}catch(_0x51a1b3){utils[_0x67d5('0x11')](util[_0x67d5('0x3')](_0x67d5('0x23'),_0x42d078[_0x67d5('0x5')]),_0x51a1b3);}};exports[_0x67d5('0x27')]=function(_0x574cdc){try{utils[_0x67d5('0x14')](util['format'](_0x67d5('0x28'),_0x574cdc[_0x67d5('0x5')]),_0x574cdc);if(_0x574cdc['channel']){var _0x3f761b=_0x574cdc[_0x67d5('0x7')][_0x67d5('0xd')]('-')[0x0];if(!_['isNil'](members[_0x3f761b])){members[_0x3f761b]=_[_0x67d5('0x26')](members[_0x3f761b],{'data1':members[_0x3f761b]['data1']||_0x574cdc['type'],'data2':members[_0x3f761b][_0x67d5('0x8')]||_0x574cdc['source'],'data3':members[_0x3f761b]['data3']||_0x574cdc[_0x67d5('0x29')],'uniqueid':members[_0x3f761b]['uniqueid']||_0x574cdc[_0x67d5('0x5')]});utils[_0x67d5('0x2')](util[_0x67d5('0x3')](_0x67d5('0x2a'),_0x574cdc[_0x67d5('0x5')],members[_0x3f761b][_0x67d5('0x2b')],members[_0x3f761b][_0x67d5('0x8')],members[_0x3f761b][_0x67d5('0x2c')]));if(members[_0x3f761b][_0x67d5('0x1d')]){writeDB(members[_0x3f761b]);}}}if(_0x574cdc[_0x67d5('0x2d')]){var _0x40e419=_0x574cdc[_0x67d5('0x2d')][_0x67d5('0xd')]('-')[0x0];if(!_[_0x67d5('0x1c')](members[_0x40e419])){members[_0x40e419]=_['assign'](members[_0x40e419],{'data1':members[_0x40e419]['data1']||_0x574cdc['type'],'data2':members[_0x40e419]['data2']||_0x574cdc[_0x67d5('0x2e')],'data3':members[_0x40e419]['data3']||_0x574cdc['destination'],'uniqueid':members[_0x40e419]['uniqueid']||_0x574cdc[_0x67d5('0x5')]});utils[_0x67d5('0x2')](util[_0x67d5('0x3')](_0x67d5('0x2a'),_0x574cdc['uniqueid'],members[_0x40e419][_0x67d5('0x2b')],members[_0x40e419][_0x67d5('0x8')],members[_0x40e419][_0x67d5('0x2c')]));if(members[_0x40e419][_0x67d5('0x1d')]){writeDB(members[_0x40e419]);}}}}catch(_0x3a81f0){utils[_0x67d5('0x11')](util['format'](_0x67d5('0x28'),_0x574cdc[_0x67d5('0x5')]),_0x3a81f0);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index fa7dbd3..74324f9 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 _0x9912=['queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','value','toUpperCase','queuecallerabandonAt','queueposition','queuecallerexitAt','EXITWITHKEY','name','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','agentcomplete','queuecallercompleteAt','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9912,0x165));var _0x2991=function(_0x26d376,_0xf43f17){_0x26d376=_0x26d376-0x0;var _0x2accc2=_0x9912[_0x26d376];return _0x2accc2;};'use strict';var _=require('lodash');var util=require(_0x2991('0x0'));var utils=require('./utils');var queues={};function writeDB(_0xf22970){utils['info'](util[_0x2991('0x1')](_0x2991('0x2'),_0xf22970[_0x2991('0x3')],_0xf22970[_0x2991('0x4')],_0xf22970[_0x2991('0x5')],_0xf22970[_0x2991('0x6')],_0xf22970['calleridnum'],_0xf22970[_0x2991('0x7')],_0xf22970[_0x2991('0x8')]));if(_0xf22970[_0x2991('0x5')]){utils[_0x2991('0x9')](_0xf22970[_0x2991('0x5')])[_0x2991('0xa')](function(_0x23eb2e){if(_0x23eb2e){_0xf22970[_0x2991('0xb')]=_0x23eb2e[_0x2991('0xb')];}utils[_0x2991('0xc')](_0x2991('0xd'),_0xf22970);});}else{utils[_0x2991('0xc')](_0x2991('0xd'),_0xf22970);}if(_0xf22970[_0x2991('0xe')]){delete queues[_0xf22970[_0x2991('0xe')]];}else{delete queues[_0xf22970['uniqueid']];}}exports['queuecallerjoin']=function(_0x44e58c){try{utils[_0x2991('0xf')](util[_0x2991('0x1')]('[%s][queues][queuecallerjoin]',_0x44e58c['uniqueid']),_0x44e58c);utils[_0x2991('0x10')](util[_0x2991('0x1')](_0x2991('0x11'),_0x44e58c[_0x2991('0x3')],_0x44e58c[_0x2991('0x5')],_0x44e58c[_0x2991('0x12')]));queues[_0x44e58c[_0x2991('0x3')]]=_[_0x2991('0x13')](_0x44e58c,{'originalposition':_0x44e58c[_0x2991('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x50c9ed){utils[_0x2991('0x14')](util[_0x2991('0x1')](_0x2991('0x15'),_0x44e58c['uniqueid']),_0x50c9ed);}};exports['hangup']=function(_0x43ffcc){try{if(!_[_0x2991('0x16')](queues[_0x43ffcc[_0x2991('0x3')]])){utils[_0x2991('0xf')](util['format'](_0x2991('0x17'),_0x43ffcc['uniqueid']),_0x43ffcc);if(queues[_0x43ffcc[_0x2991('0x3')]][_0x2991('0x18')]){if(!queues[_0x43ffcc[_0x2991('0x3')]][_0x2991('0x19')]&&!queues[_0x43ffcc['uniqueid']][_0x2991('0x1a')]){queues[_0x43ffcc['uniqueid']][_0x2991('0x1b')]=!![];queues[_0x43ffcc[_0x2991('0x3')]]['queuecallercompleteAt']=utils[_0x2991('0x1c')]();queues[_0x43ffcc['uniqueid']][_0x2991('0x8')]=_0x2991('0x1d');}utils[_0x2991('0x10')](util[_0x2991('0x1')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x43ffcc[_0x2991('0x3')],queues[_0x43ffcc[_0x2991('0x3')]]['name'],queues[_0x43ffcc[_0x2991('0x3')]][_0x2991('0x8')]));writeDB(queues[_0x43ffcc['uniqueid']]);}else if(queues[_0x43ffcc['uniqueid']][_0x2991('0xe')]){utils[_0x2991('0x10')](util[_0x2991('0x1')](_0x2991('0x1e'),_0x43ffcc['uniqueid'],queues[_0x43ffcc[_0x2991('0x3')]]['name'],queues[_0x43ffcc['uniqueid']][_0x2991('0xe')]));queues[queues[_0x43ffcc[_0x2991('0x3')]][_0x2991('0xe')]]=queues[_0x43ffcc[_0x2991('0x3')]];queues[queues[_0x43ffcc['uniqueid']]['transfereduniqueid']][_0x2991('0x1f')]=0x2;delete queues[_0x43ffcc[_0x2991('0x3')]];}}}catch(_0x31fd7c){utils[_0x2991('0x14')](util[_0x2991('0x1')]('[%s][queues][hangup]',_0x43ffcc[_0x2991('0x3')]),_0x31fd7c);}};exports['varset']=function(_0x41dfd1){try{utils[_0x2991('0xf')](util[_0x2991('0x1')](_0x2991('0x20'),_0x41dfd1[_0x2991('0x3')]),_0x41dfd1);if(!_[_0x2991('0x16')](_0x41dfd1[_0x2991('0x21')]['queuestatus'])&&_0x41dfd1[_0x2991('0x22')][_0x2991('0x23')]()!=='CONTINUE'){if(!_[_0x2991('0x16')](queues[_0x41dfd1[_0x2991('0x3')]])){queues[_0x41dfd1[_0x2991('0x3')]][_0x2991('0x19')]=![];queues[_0x41dfd1[_0x2991('0x3')]][_0x2991('0x24')]=null;queues[_0x41dfd1[_0x2991('0x3')]][_0x2991('0x1a')]=!![];queues[_0x41dfd1[_0x2991('0x3')]]['queuecallerexitAt']=utils['now']();queues[_0x41dfd1[_0x2991('0x3')]][_0x2991('0x8')]=_0x41dfd1[_0x2991('0x22')][_0x2991('0x23')]();utils[_0x2991('0x10')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x41dfd1[_0x2991('0x3')],queues[_0x41dfd1[_0x2991('0x3')]]['name'],_0x41dfd1[_0x2991('0x22')],queues[_0x41dfd1[_0x2991('0x3')]][_0x2991('0x8')]));writeDB(queues[_0x41dfd1[_0x2991('0x3')]]);}}else if(!_[_0x2991('0x16')](_0x41dfd1[_0x2991('0x21')][_0x2991('0x25')])){if(!_['isNil'](queues[_0x41dfd1[_0x2991('0x3')]])&&!queues[_0x41dfd1[_0x2991('0x3')]]['queuecallerabandon']){queues[_0x41dfd1['uniqueid']][_0x2991('0x19')]=![];queues[_0x41dfd1['uniqueid']][_0x2991('0x24')]=null;queues[_0x41dfd1[_0x2991('0x3')]]['queuecallerexit']=!![];queues[_0x41dfd1['uniqueid']][_0x2991('0x26')]=utils[_0x2991('0x1c')]();queues[_0x41dfd1['uniqueid']][_0x2991('0x8')]=_0x2991('0x27');utils[_0x2991('0x10')](util[_0x2991('0x1')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x41dfd1[_0x2991('0x3')],queues[_0x41dfd1[_0x2991('0x3')]][_0x2991('0x28')],_0x41dfd1[_0x2991('0x22')],queues[_0x41dfd1[_0x2991('0x3')]]['queuecallerexitreason']));}}}catch(_0x4a2fe9){utils['error'](util[_0x2991('0x1')]('[%s][queues][varset]',_0x41dfd1[_0x2991('0x3')]),_0x4a2fe9);}};exports[_0x2991('0x19')]=function(_0x49da05){try{if(!_[_0x2991('0x16')](queues[_0x49da05['uniqueid']])){utils[_0x2991('0xf')](util[_0x2991('0x1')]('[%s][queues][queuecallerabandon]',_0x49da05[_0x2991('0x3')]),_0x49da05);queues[_0x49da05[_0x2991('0x3')]]['queuecallerexit']=![];queues[_0x49da05[_0x2991('0x3')]]['queuecallerexitAt']=null;queues[_0x49da05[_0x2991('0x3')]][_0x2991('0x19')]=!![];queues[_0x49da05['uniqueid']][_0x2991('0x24')]=utils[_0x2991('0x1c')]();queues[_0x49da05[_0x2991('0x3')]][_0x2991('0x8')]=_0x2991('0x29');utils[_0x2991('0x10')](util[_0x2991('0x1')](_0x2991('0x2a'),_0x49da05[_0x2991('0x3')],queues[_0x49da05[_0x2991('0x3')]][_0x2991('0x28')],queues[_0x49da05[_0x2991('0x3')]][_0x2991('0x8')]));}}catch(_0x3e4b27){utils[_0x2991('0x14')](util[_0x2991('0x1')](_0x2991('0x2b'),_0x49da05[_0x2991('0x3')]),_0x3e4b27);}};exports[_0x2991('0x2c')]=function(_0x4dc015){try{if(!_[_0x2991('0x16')](queues[_0x4dc015['uniqueid']])){utils[_0x2991('0xf')](util[_0x2991('0x1')](_0x2991('0x2d'),_0x4dc015[_0x2991('0x3')]),_0x4dc015);utils[_0x2991('0x10')](util[_0x2991('0x1')](_0x2991('0x2e'),_0x4dc015[_0x2991('0x3')],queues[_0x4dc015[_0x2991('0x3')]][_0x2991('0x28')],_0x4dc015['connectedlinenum'],_0x4dc015[_0x2991('0x2f')]));queues[_0x4dc015[_0x2991('0x3')]][_0x2991('0x2c')]=!![];queues[_0x4dc015[_0x2991('0x3')]]['queuecallerleaveAt']=utils['now']();queues[_0x4dc015[_0x2991('0x3')]][_0x2991('0x30')]=utils[_0x2991('0x31')](queues[_0x4dc015['uniqueid']][_0x2991('0x18')],queues[_0x4dc015['uniqueid']][_0x2991('0x32')]);queues[_0x4dc015[_0x2991('0x3')]][_0x2991('0x12')]=_0x4dc015[_0x2991('0x12')];queues[_0x4dc015[_0x2991('0x3')]][_0x2991('0x33')]=_0x4dc015[_0x2991('0x33')];queues[_0x4dc015['uniqueid']]['connectedlinenum']=_0x4dc015['connectedlinenum'];queues[_0x4dc015['uniqueid']][_0x2991('0x2f')]=_0x4dc015[_0x2991('0x2f')];}}catch(_0x405c0a){utils[_0x2991('0x14')](util[_0x2991('0x1')](_0x2991('0x2d'),_0x4dc015['uniqueid']),_0x405c0a);}};exports[_0x2991('0x34')]=function(_0x37c319){try{if(!_['isNil'](queues[_0x37c319[_0x2991('0x3')]])){utils[_0x2991('0xf')](util['format'](_0x2991('0x35'),_0x37c319[_0x2991('0x3')]),_0x37c319);utils['info'](util[_0x2991('0x1')](_0x2991('0x36'),_0x37c319['uniqueid'],queues[_0x37c319[_0x2991('0x3')]][_0x2991('0x28')],_0x37c319['membername'],_0x37c319[_0x2991('0x37')]));queues[_0x37c319[_0x2991('0x3')]]['queuecallerabandon']=![];queues[_0x37c319[_0x2991('0x3')]][_0x2991('0x19')]=![];queues[_0x37c319[_0x2991('0x3')]]['queuecallerabandonAt']=null;queues[_0x37c319[_0x2991('0x3')]][_0x2991('0x1a')]=![];queues[_0x37c319['uniqueid']][_0x2991('0x8')]=null;queues[_0x37c319['uniqueid']][_0x2991('0x26')]=null;queues[_0x37c319[_0x2991('0x3')]]['assigned']=!![];queues[_0x37c319[_0x2991('0x3')]][_0x2991('0x7')]=_0x37c319[_0x2991('0x37')];queues[_0x37c319[_0x2991('0x3')]][_0x2991('0x6')]=_0x37c319[_0x2991('0x38')];}}catch(_0x1de834){utils['error'](util['format'](_0x2991('0x35'),_0x37c319['uniqueid']),_0x1de834);}};exports[_0x2991('0x39')]=function(_0x265796){try{if(!_[_0x2991('0x16')](queues[_0x265796[_0x2991('0x3')]])){if(queues[_0x265796[_0x2991('0x3')]][_0x2991('0x18')]){utils[_0x2991('0xf')](util['format']('[%s][queues][agentcomplete]',_0x265796['uniqueid']),_0x265796);queues[_0x265796[_0x2991('0x3')]][_0x2991('0x19')]=![];queues[_0x265796[_0x2991('0x3')]][_0x2991('0x19')]=![];queues[_0x265796[_0x2991('0x3')]]['queuecallerabandonAt']=null;queues[_0x265796[_0x2991('0x3')]]['queuecallerexit']=![];queues[_0x265796[_0x2991('0x3')]][_0x2991('0x26')]=null;queues[_0x265796['uniqueid']]['assigned']=!![];queues[_0x265796[_0x2991('0x3')]][_0x2991('0x6')]=_0x265796[_0x2991('0x38')];queues[_0x265796['uniqueid']][_0x2991('0x1b')]=!![];queues[_0x265796[_0x2991('0x3')]][_0x2991('0x3a')]=utils[_0x2991('0x1c')]();if(_0x265796['reason']==_0x2991('0x3b')){if(!queues[_0x265796[_0x2991('0x3')]]['transfer']){queues[_0x265796[_0x2991('0x3')]][_0x2991('0x8')]=_0x2991('0x3c');}}else{queues[_0x265796[_0x2991('0x3')]][_0x2991('0x8')]=_0x2991('0x3d')+_0x265796[_0x2991('0x3e')][_0x2991('0x23')]();}utils[_0x2991('0x10')](util['format'](_0x2991('0x3f'),_0x265796[_0x2991('0x3')],queues[_0x265796['uniqueid']]['name'],_0x265796[_0x2991('0x38')],queues[_0x265796[_0x2991('0x3')]][_0x2991('0x8')]));writeDB(queues[_0x265796['uniqueid']]);}}}catch(_0x35f396){utils['error'](util[_0x2991('0x1')](_0x2991('0x40'),_0x265796['uniqueid']),_0x35f396);}};exports[_0x2991('0x41')]=function(_0x3ff56e){try{if(!_[_0x2991('0x16')](queues[_0x3ff56e[_0x2991('0x42')]])){utils[_0x2991('0xf')](util['format']('[%s][queues][blindtransfer]',_0x3ff56e[_0x2991('0x3')]),_0x3ff56e);queues[_0x3ff56e['transfereeuniqueid']]['transfer']=!![];queues[_0x3ff56e[_0x2991('0x42')]]['transfertype']=_0x2991('0x43');queues[_0x3ff56e['transfereeuniqueid']][_0x2991('0x44')]=_0x3ff56e[_0x2991('0x45')];queues[_0x3ff56e[_0x2991('0x42')]]['transferuniqueid']=_0x3ff56e[_0x2991('0x42')];queues[_0x3ff56e[_0x2991('0x42')]][_0x2991('0x8')]='BLINDTRANSFER';utils[_0x2991('0x10')](util[_0x2991('0x1')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3ff56e[_0x2991('0x3')],queues[_0x3ff56e[_0x2991('0x42')]][_0x2991('0x28')],_0x3ff56e[_0x2991('0x42')],_0x3ff56e[_0x2991('0x45')]));}}catch(_0xe3968d){utils[_0x2991('0x14')](util[_0x2991('0x1')]('[%s][queues][blindtransfer]',_0x3ff56e['uniqueid']),_0xe3968d);}};exports[_0x2991('0x46')]=function(_0x1d45af){try{utils['debug'](util['format'](_0x2991('0x47'),_0x1d45af[_0x2991('0x48')]),_0x1d45af);if(_0x1d45af[_0x2991('0x48')]==_0x1d45af['origtransfererlinkedid']){if(!_[_0x2991('0x16')](queues[_0x1d45af[_0x2991('0x49')]])){utils[_0x2991('0x10')](util[_0x2991('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1d45af[_0x2991('0x48')],queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x28')],_0x1d45af['origtransfererexten']));queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x3b')]=!![];queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x4a')]=_0x2991('0x4b');queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x44')]=_0x1d45af[_0x2991('0x4c')];queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x4d')]=_0x1d45af[_0x2991('0x48')];queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x8')]=_0x2991('0x4e');}if(!_[_0x2991('0x16')](queues[_0x1d45af[_0x2991('0x4f')]])){if(_0x1d45af[_0x2991('0x50')]&&queues[_0x1d45af['transfereelinkedid']]){queues[_0x1d45af[_0x2991('0x50')]]['queuecallerenterreason']=0x1;queues[_0x1d45af[_0x2991('0x42')]]=_['clone'](queues[_0x1d45af['transfereelinkedid']]);queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0xe')]=_0x1d45af['transfertargetuniqueid'];queues[_0x1d45af['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0x51')]=queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x51')];queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0x52')]=queues[_0x1d45af[_0x2991('0x49')]]['calleridname'];queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0x32')]=utils[_0x2991('0x1c')]();queues[_0x1d45af['transfereeuniqueid']][_0x2991('0x18')]=utils[_0x2991('0x1c')]();queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0x30')]=0x0;queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0x53')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1d45af[_0x2991('0x48')],queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0x28')],queues[_0x1d45af[_0x2991('0x42')]]['calleridnum'],queues[_0x1d45af[_0x2991('0x42')]][_0x2991('0x52')]));}else{utils[_0x2991('0x10')](util[_0x2991('0x1')](_0x2991('0x54'),_0x1d45af[_0x2991('0x48')],queues[_0x1d45af[_0x2991('0x4f')]][_0x2991('0x28')],_0x1d45af[_0x2991('0x49')]));queues[_0x1d45af[_0x2991('0x4f')]][_0x2991('0xe')]=_0x1d45af[_0x2991('0x49')];}}}else if(_0x1d45af[_0x2991('0x55')]==_0x1d45af[_0x2991('0x49')]){if(!_[_0x2991('0x16')](queues[_0x1d45af[_0x2991('0x4f')]])){utils[_0x2991('0x10')](util[_0x2991('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1d45af[_0x2991('0x48')],queues[_0x1d45af[_0x2991('0x4f')]]['name'],_0x1d45af[_0x2991('0x55')],_0x1d45af[_0x2991('0x56')]));queues[_0x1d45af[_0x2991('0x4f')]]['transfer']=!![];queues[_0x1d45af[_0x2991('0x4f')]][_0x2991('0x4a')]=_0x2991('0x4b');queues[_0x1d45af[_0x2991('0x4f')]]['transferexten']=_0x1d45af['secondtransfererexten'];queues[_0x1d45af['origtransfererlinkedid']][_0x2991('0x4d')]=_0x1d45af[_0x2991('0x55')];queues[_0x1d45af[_0x2991('0x4f')]][_0x2991('0x8')]=_0x2991('0x4e');}if(!_['isNil'](queues[_0x1d45af[_0x2991('0x49')]])){if(_0x1d45af[_0x2991('0x57')]&&queues[_0x1d45af[_0x2991('0x57')]]){queues[_0x1d45af[_0x2991('0x57')]][_0x2991('0x1f')]=0x1;queues[_0x1d45af[_0x2991('0x58')]]=_[_0x2991('0x59')](queues[_0x1d45af[_0x2991('0x57')]]);queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0xe')]=_0x1d45af[_0x2991('0x58')];queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x1f')]=0x2;queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x51')]=queues[_0x1d45af[_0x2991('0x4f')]][_0x2991('0x51')];queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x52')]=queues[_0x1d45af[_0x2991('0x4f')]][_0x2991('0x52')];queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x32')]=utils[_0x2991('0x1c')]();queues[_0x1d45af[_0x2991('0x58')]]['queuecallerleaveAt']=utils[_0x2991('0x1c')]();queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x30')]=0x0;queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x53')]=0x0;utils['info'](util[_0x2991('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1d45af[_0x2991('0x48')],queues[_0x1d45af['transfertargetuniqueid']][_0x2991('0x28')],queues[_0x1d45af[_0x2991('0x58')]]['transfereduniqueid'],queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x51')],queues[_0x1d45af[_0x2991('0x58')]][_0x2991('0x52')]));}else{utils[_0x2991('0x10')](util[_0x2991('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1d45af[_0x2991('0x48')],queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0x28')],_0x1d45af[_0x2991('0x4f')]));queues[_0x1d45af[_0x2991('0x49')]][_0x2991('0xe')]=_0x1d45af[_0x2991('0x4f')];}}}}catch(_0x1f0ec2){utils[_0x2991('0x14')](util[_0x2991('0x1')]('[%s][queues][attendedtransfer]',_0x1d45af[_0x2991('0x48')]),_0x1f0ec2);}};exports[_0x2991('0x5a')]=function(_0x51ed93){try{if(!_[_0x2991('0x16')](queues[_0x51ed93[_0x2991('0x3')]])){utils[_0x2991('0xf')](util['format']('[%s][queues][musiconholdstart]',_0x51ed93[_0x2991('0x3')]),_0x51ed93);queues[_0x51ed93['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0x2991('0x10')](util[_0x2991('0x1')](_0x2991('0x5b'),_0x51ed93[_0x2991('0x3')],queues[_0x51ed93[_0x2991('0x3')]][_0x2991('0x28')],queues[_0x51ed93[_0x2991('0x3')]][_0x2991('0x5c')]));}}catch(_0x1114d4){utils[_0x2991('0x14')](util[_0x2991('0x1')](_0x2991('0x5d'),_0x51ed93['uniqueid']),_0x1114d4);}};exports['musiconholdstop']=function(_0xee4e92){try{if(!_[_0x2991('0x16')](queues[_0xee4e92[_0x2991('0x3')]])){if(!_[_0x2991('0x16')](queues[_0xee4e92['uniqueid']][_0x2991('0x5c')])){utils[_0x2991('0xf')](util[_0x2991('0x1')]('[%s][queues][musiconholdstop]',_0xee4e92[_0x2991('0x3')]),_0xee4e92);queues[_0xee4e92['uniqueid']][_0x2991('0x53')]+=utils[_0x2991('0x31')](utils['now'](),queues[_0xee4e92[_0x2991('0x3')]][_0x2991('0x5c')]);utils[_0x2991('0x10')](util[_0x2991('0x1')](_0x2991('0x5e'),_0xee4e92[_0x2991('0x3')],queues[_0xee4e92['uniqueid']][_0x2991('0x28')],queues[_0xee4e92[_0x2991('0x3')]][_0x2991('0x53')]));delete queues[_0xee4e92[_0x2991('0x3')]]['musiconholdstartAt'];}}}catch(_0x4e24a4){utils['error'](util[_0x2991('0x1')](_0x2991('0x5f'),_0xee4e92[_0x2991('0x3')]),_0x4e24a4);}}; \ No newline at end of file +var _0xd062=['origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','toUpperCase','CONTINUE','queuecallerabandonAt','value','queuecallerexitAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','queuecallerjoinAt','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd062,0x1a2));var _0x2d06=function(_0x7250b2,_0x2baa3f){_0x7250b2=_0x7250b2-0x0;var _0x1bc60a=_0xd062[_0x7250b2];return _0x1bc60a;};'use strict';var _=require(_0x2d06('0x0'));var util=require(_0x2d06('0x1'));var utils=require(_0x2d06('0x2'));var queues={};function writeDB(_0x32e152){utils[_0x2d06('0x3')](util['format'](_0x2d06('0x4'),_0x32e152[_0x2d06('0x5')],_0x32e152[_0x2d06('0x6')],_0x32e152[_0x2d06('0x7')],_0x32e152[_0x2d06('0x8')],_0x32e152[_0x2d06('0x9')],_0x32e152[_0x2d06('0xa')],_0x32e152['queuecallerexitreason']));if(_0x32e152[_0x2d06('0x7')]){utils['getVoiceQueueByName'](_0x32e152['queue'])['then'](function(_0x453fa1){if(_0x453fa1){_0x32e152['type']=_0x453fa1[_0x2d06('0xb')];}utils[_0x2d06('0xc')](_0x2d06('0xd'),_0x32e152);});}else{utils[_0x2d06('0xc')](_0x2d06('0xd'),_0x32e152);}if(_0x32e152[_0x2d06('0xe')]){delete queues[_0x32e152[_0x2d06('0xe')]];}else{delete queues[_0x32e152['uniqueid']];}}exports[_0x2d06('0xf')]=function(_0x518b1b){try{utils['debug'](util[_0x2d06('0x10')](_0x2d06('0x11'),_0x518b1b['uniqueid']),_0x518b1b);utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x12'),_0x518b1b[_0x2d06('0x5')],_0x518b1b['queue'],_0x518b1b[_0x2d06('0x13')]));queues[_0x518b1b[_0x2d06('0x5')]]=_[_0x2d06('0x14')](_0x518b1b,{'originalposition':_0x518b1b[_0x2d06('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x23d093){utils['error'](util[_0x2d06('0x10')](_0x2d06('0x11'),_0x518b1b['uniqueid']),_0x23d093);}};exports[_0x2d06('0x15')]=function(_0x217597){try{if(!_[_0x2d06('0x16')](queues[_0x217597['uniqueid']])){utils[_0x2d06('0x17')](util[_0x2d06('0x10')](_0x2d06('0x18'),_0x217597[_0x2d06('0x5')]),_0x217597);if(queues[_0x217597['uniqueid']][_0x2d06('0x19')]){if(!queues[_0x217597['uniqueid']][_0x2d06('0x1a')]&&!queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0x1b')]){queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0x1c')]=!![];queues[_0x217597['uniqueid']][_0x2d06('0x1d')]=utils[_0x2d06('0x1e')]();queues[_0x217597[_0x2d06('0x5')]]['queuecallerexitreason']=_0x2d06('0x1f');}utils[_0x2d06('0x3')](util[_0x2d06('0x10')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x217597[_0x2d06('0x5')],queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0x20')],queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0x21')]));writeDB(queues[_0x217597[_0x2d06('0x5')]]);}else if(queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0xe')]){utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x22'),_0x217597[_0x2d06('0x5')],queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0x20')],queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0xe')]));queues[queues[_0x217597[_0x2d06('0x5')]][_0x2d06('0xe')]]=queues[_0x217597['uniqueid']];queues[queues[_0x217597[_0x2d06('0x5')]]['transfereduniqueid']][_0x2d06('0x23')]=0x2;delete queues[_0x217597[_0x2d06('0x5')]];}}}catch(_0x83e626){utils[_0x2d06('0x24')](util[_0x2d06('0x10')](_0x2d06('0x18'),_0x217597[_0x2d06('0x5')]),_0x83e626);}};exports[_0x2d06('0x25')]=function(_0x242723){try{utils[_0x2d06('0x17')](util['format'](_0x2d06('0x26'),_0x242723[_0x2d06('0x5')]),_0x242723);if(!_[_0x2d06('0x16')](_0x242723[_0x2d06('0x27')]['queuestatus'])&&_0x242723['value'][_0x2d06('0x28')]()!==_0x2d06('0x29')){if(!_[_0x2d06('0x16')](queues[_0x242723[_0x2d06('0x5')]])){queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x1a')]=![];queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x2a')]=null;queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x1b')]=!![];queues[_0x242723[_0x2d06('0x5')]]['queuecallerexitAt']=utils[_0x2d06('0x1e')]();queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x21')]=_0x242723[_0x2d06('0x2b')][_0x2d06('0x28')]();utils['info'](util[_0x2d06('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x242723[_0x2d06('0x5')],queues[_0x242723['uniqueid']][_0x2d06('0x20')],_0x242723['value'],queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x21')]));writeDB(queues[_0x242723['uniqueid']]);}}else if(!_[_0x2d06('0x16')](_0x242723[_0x2d06('0x27')]['queueposition'])){if(!_[_0x2d06('0x16')](queues[_0x242723[_0x2d06('0x5')]])&&!queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x1a')]){queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x1a')]=![];queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x2a')]=null;queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x1b')]=!![];queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x2c')]=utils[_0x2d06('0x1e')]();queues[_0x242723['uniqueid']][_0x2d06('0x21')]=_0x2d06('0x2d');utils['info'](util[_0x2d06('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x242723[_0x2d06('0x5')],queues[_0x242723['uniqueid']][_0x2d06('0x20')],_0x242723['value'],queues[_0x242723[_0x2d06('0x5')]][_0x2d06('0x21')]));}}}catch(_0x559415){utils[_0x2d06('0x24')](util[_0x2d06('0x10')](_0x2d06('0x26'),_0x242723[_0x2d06('0x5')]),_0x559415);}};exports[_0x2d06('0x1a')]=function(_0x2cdee2){try{if(!_['isNil'](queues[_0x2cdee2['uniqueid']])){utils[_0x2d06('0x17')](util[_0x2d06('0x10')](_0x2d06('0x2e'),_0x2cdee2[_0x2d06('0x5')]),_0x2cdee2);queues[_0x2cdee2['uniqueid']][_0x2d06('0x1b')]=![];queues[_0x2cdee2[_0x2d06('0x5')]][_0x2d06('0x2c')]=null;queues[_0x2cdee2[_0x2d06('0x5')]]['queuecallerabandon']=!![];queues[_0x2cdee2['uniqueid']][_0x2d06('0x2a')]=utils[_0x2d06('0x1e')]();queues[_0x2cdee2[_0x2d06('0x5')]][_0x2d06('0x21')]=_0x2d06('0x2f');utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x30'),_0x2cdee2['uniqueid'],queues[_0x2cdee2[_0x2d06('0x5')]][_0x2d06('0x20')],queues[_0x2cdee2['uniqueid']]['queuecallerexitreason']));}}catch(_0x206e54){utils[_0x2d06('0x24')](util[_0x2d06('0x10')]('[%s][queues][queuecallerabandon]',_0x2cdee2['uniqueid']),_0x206e54);}};exports[_0x2d06('0x31')]=function(_0x55ee33){try{if(!_['isNil'](queues[_0x55ee33[_0x2d06('0x5')]])){utils[_0x2d06('0x17')](util[_0x2d06('0x10')](_0x2d06('0x32'),_0x55ee33[_0x2d06('0x5')]),_0x55ee33);utils[_0x2d06('0x3')](util[_0x2d06('0x10')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x55ee33[_0x2d06('0x5')],queues[_0x55ee33['uniqueid']][_0x2d06('0x20')],_0x55ee33['connectedlinenum'],_0x55ee33['connectedlinename']));queues[_0x55ee33[_0x2d06('0x5')]][_0x2d06('0x31')]=!![];queues[_0x55ee33['uniqueid']][_0x2d06('0x19')]=utils[_0x2d06('0x1e')]();queues[_0x55ee33['uniqueid']]['holdtime']=utils['diffTime'](queues[_0x55ee33[_0x2d06('0x5')]]['queuecallerleaveAt'],queues[_0x55ee33[_0x2d06('0x5')]][_0x2d06('0x33')]);queues[_0x55ee33['uniqueid']][_0x2d06('0x13')]=_0x55ee33[_0x2d06('0x13')];queues[_0x55ee33[_0x2d06('0x5')]]['count']=_0x55ee33['count'];queues[_0x55ee33[_0x2d06('0x5')]]['connectedlinenum']=_0x55ee33[_0x2d06('0x34')];queues[_0x55ee33['uniqueid']]['connectedlinename']=_0x55ee33[_0x2d06('0x35')];}}catch(_0x1814df){utils[_0x2d06('0x24')](util['format'](_0x2d06('0x32'),_0x55ee33[_0x2d06('0x5')]),_0x1814df);}};exports[_0x2d06('0x36')]=function(_0xe1beda){try{if(!_[_0x2d06('0x16')](queues[_0xe1beda[_0x2d06('0x5')]])){utils[_0x2d06('0x17')](util[_0x2d06('0x10')]('[%s][queues][agentconnect]',_0xe1beda[_0x2d06('0x5')]),_0xe1beda);utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x37'),_0xe1beda[_0x2d06('0x5')],queues[_0xe1beda['uniqueid']][_0x2d06('0x20')],_0xe1beda['membername'],_0xe1beda[_0x2d06('0x38')]));queues[_0xe1beda['uniqueid']][_0x2d06('0x1a')]=![];queues[_0xe1beda[_0x2d06('0x5')]][_0x2d06('0x1a')]=![];queues[_0xe1beda[_0x2d06('0x5')]]['queuecallerabandonAt']=null;queues[_0xe1beda['uniqueid']][_0x2d06('0x1b')]=![];queues[_0xe1beda['uniqueid']][_0x2d06('0x21')]=null;queues[_0xe1beda['uniqueid']][_0x2d06('0x2c')]=null;queues[_0xe1beda[_0x2d06('0x5')]][_0x2d06('0x39')]=!![];queues[_0xe1beda[_0x2d06('0x5')]]['accountcode']=_0xe1beda[_0x2d06('0x38')];queues[_0xe1beda[_0x2d06('0x5')]][_0x2d06('0x8')]=_0xe1beda[_0x2d06('0x3a')];}}catch(_0x53a120){utils['error'](util['format'](_0x2d06('0x3b'),_0xe1beda[_0x2d06('0x5')]),_0x53a120);}};exports[_0x2d06('0x3c')]=function(_0x1243f2){try{if(!_[_0x2d06('0x16')](queues[_0x1243f2['uniqueid']])){if(queues[_0x1243f2[_0x2d06('0x5')]][_0x2d06('0x19')]){utils[_0x2d06('0x17')](util[_0x2d06('0x10')](_0x2d06('0x3d'),_0x1243f2['uniqueid']),_0x1243f2);queues[_0x1243f2[_0x2d06('0x5')]][_0x2d06('0x1a')]=![];queues[_0x1243f2[_0x2d06('0x5')]][_0x2d06('0x1a')]=![];queues[_0x1243f2[_0x2d06('0x5')]][_0x2d06('0x2a')]=null;queues[_0x1243f2['uniqueid']][_0x2d06('0x1b')]=![];queues[_0x1243f2['uniqueid']][_0x2d06('0x2c')]=null;queues[_0x1243f2['uniqueid']][_0x2d06('0x39')]=!![];queues[_0x1243f2[_0x2d06('0x5')]]['lastAssignedTo']=_0x1243f2[_0x2d06('0x3a')];queues[_0x1243f2[_0x2d06('0x5')]]['queuecallercomplete']=!![];queues[_0x1243f2['uniqueid']]['queuecallercompleteAt']=utils[_0x2d06('0x1e')]();if(_0x1243f2['reason']==_0x2d06('0x3e')){if(!queues[_0x1243f2[_0x2d06('0x5')]][_0x2d06('0x3e')]){queues[_0x1243f2[_0x2d06('0x5')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x1243f2[_0x2d06('0x5')]][_0x2d06('0x21')]='COMPLETEDBY'+_0x1243f2[_0x2d06('0x3f')]['toUpperCase']();}utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x40'),_0x1243f2[_0x2d06('0x5')],queues[_0x1243f2['uniqueid']][_0x2d06('0x20')],_0x1243f2[_0x2d06('0x3a')],queues[_0x1243f2['uniqueid']][_0x2d06('0x21')]));writeDB(queues[_0x1243f2['uniqueid']]);}}}catch(_0x188fb0){utils[_0x2d06('0x24')](util['format']('[%s][queues][agentcomplete]',_0x1243f2[_0x2d06('0x5')]),_0x188fb0);}};exports['blindtransfer']=function(_0x5153d4){try{if(!_[_0x2d06('0x16')](queues[_0x5153d4[_0x2d06('0x41')]])){utils[_0x2d06('0x17')](util[_0x2d06('0x10')]('[%s][queues][blindtransfer]',_0x5153d4[_0x2d06('0x5')]),_0x5153d4);queues[_0x5153d4['transfereeuniqueid']]['transfer']=!![];queues[_0x5153d4[_0x2d06('0x41')]][_0x2d06('0x42')]=_0x2d06('0x43');queues[_0x5153d4[_0x2d06('0x41')]][_0x2d06('0x44')]=_0x5153d4['extension'];queues[_0x5153d4[_0x2d06('0x41')]][_0x2d06('0x45')]=_0x5153d4[_0x2d06('0x41')];queues[_0x5153d4['transfereeuniqueid']]['queuecallerexitreason']=_0x2d06('0x46');utils[_0x2d06('0x3')](util['format'](_0x2d06('0x47'),_0x5153d4[_0x2d06('0x5')],queues[_0x5153d4[_0x2d06('0x41')]][_0x2d06('0x20')],_0x5153d4[_0x2d06('0x41')],_0x5153d4[_0x2d06('0x48')]));}}catch(_0x1734da){utils['error'](util[_0x2d06('0x10')](_0x2d06('0x49'),_0x5153d4['uniqueid']),_0x1734da);}};exports[_0x2d06('0x4a')]=function(_0x3a60d7){try{utils[_0x2d06('0x17')](util[_0x2d06('0x10')](_0x2d06('0x4b'),_0x3a60d7[_0x2d06('0x4c')]),_0x3a60d7);if(_0x3a60d7[_0x2d06('0x4c')]==_0x3a60d7[_0x2d06('0x4d')]){if(!_['isNil'](queues[_0x3a60d7[_0x2d06('0x4e')]])){utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x4f'),_0x3a60d7[_0x2d06('0x4c')],queues[_0x3a60d7[_0x2d06('0x4e')]]['name'],_0x3a60d7[_0x2d06('0x50')]));queues[_0x3a60d7[_0x2d06('0x4e')]][_0x2d06('0x3e')]=!![];queues[_0x3a60d7['secondtransfererlinkedid']][_0x2d06('0x42')]='ATTENDED';queues[_0x3a60d7[_0x2d06('0x4e')]][_0x2d06('0x44')]=_0x3a60d7[_0x2d06('0x50')];queues[_0x3a60d7[_0x2d06('0x4e')]][_0x2d06('0x45')]=_0x3a60d7[_0x2d06('0x4c')];queues[_0x3a60d7['secondtransfererlinkedid']][_0x2d06('0x21')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3a60d7['origtransfererlinkedid']])){if(_0x3a60d7[_0x2d06('0x51')]&&queues[_0x3a60d7['transfereelinkedid']]){queues[_0x3a60d7['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x3a60d7[_0x2d06('0x41')]]=_[_0x2d06('0x52')](queues[_0x3a60d7[_0x2d06('0x51')]]);queues[_0x3a60d7[_0x2d06('0x41')]]['transfereduniqueid']=_0x3a60d7[_0x2d06('0x53')];queues[_0x3a60d7['transfereeuniqueid']][_0x2d06('0x23')]=0x2;queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x9')]=queues[_0x3a60d7['secondtransfererlinkedid']][_0x2d06('0x9')];queues[_0x3a60d7['transfereeuniqueid']][_0x2d06('0x54')]=queues[_0x3a60d7[_0x2d06('0x4e')]][_0x2d06('0x54')];queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x33')]=utils[_0x2d06('0x1e')]();queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x19')]=utils[_0x2d06('0x1e')]();queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x55')]=0x0;queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x56')]=0x0;utils['info'](util[_0x2d06('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3a60d7[_0x2d06('0x4c')],queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x20')],queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x9')],queues[_0x3a60d7[_0x2d06('0x41')]][_0x2d06('0x54')]));}else{utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x57'),_0x3a60d7[_0x2d06('0x4c')],queues[_0x3a60d7[_0x2d06('0x4d')]][_0x2d06('0x20')],_0x3a60d7[_0x2d06('0x4e')]));queues[_0x3a60d7[_0x2d06('0x4d')]][_0x2d06('0xe')]=_0x3a60d7[_0x2d06('0x4e')];}}}else if(_0x3a60d7[_0x2d06('0x58')]==_0x3a60d7[_0x2d06('0x4e')]){if(!_['isNil'](queues[_0x3a60d7[_0x2d06('0x4d')]])){utils[_0x2d06('0x3')](util[_0x2d06('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3a60d7['origtransfereruniqueid'],queues[_0x3a60d7['origtransfererlinkedid']]['name'],_0x3a60d7[_0x2d06('0x58')],_0x3a60d7[_0x2d06('0x59')]));queues[_0x3a60d7[_0x2d06('0x4d')]][_0x2d06('0x3e')]=!![];queues[_0x3a60d7[_0x2d06('0x4d')]][_0x2d06('0x42')]='ATTENDED';queues[_0x3a60d7[_0x2d06('0x4d')]][_0x2d06('0x44')]=_0x3a60d7['secondtransfererexten'];queues[_0x3a60d7[_0x2d06('0x4d')]][_0x2d06('0x45')]=_0x3a60d7['secondtransfereruniqueid'];queues[_0x3a60d7[_0x2d06('0x4d')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x2d06('0x16')](queues[_0x3a60d7[_0x2d06('0x4e')]])){if(_0x3a60d7['transfertargetlinkedid']&&queues[_0x3a60d7[_0x2d06('0x5a')]]){queues[_0x3a60d7[_0x2d06('0x5a')]][_0x2d06('0x23')]=0x1;queues[_0x3a60d7[_0x2d06('0x53')]]=_[_0x2d06('0x52')](queues[_0x3a60d7[_0x2d06('0x5a')]]);queues[_0x3a60d7[_0x2d06('0x53')]][_0x2d06('0xe')]=_0x3a60d7[_0x2d06('0x53')];queues[_0x3a60d7['transfertargetuniqueid']][_0x2d06('0x23')]=0x2;queues[_0x3a60d7[_0x2d06('0x53')]][_0x2d06('0x9')]=queues[_0x3a60d7[_0x2d06('0x4d')]]['calleridnum'];queues[_0x3a60d7[_0x2d06('0x53')]][_0x2d06('0x54')]=queues[_0x3a60d7[_0x2d06('0x4d')]][_0x2d06('0x54')];queues[_0x3a60d7[_0x2d06('0x53')]][_0x2d06('0x33')]=utils[_0x2d06('0x1e')]();queues[_0x3a60d7[_0x2d06('0x53')]][_0x2d06('0x19')]=utils['now']();queues[_0x3a60d7[_0x2d06('0x53')]][_0x2d06('0x55')]=0x0;queues[_0x3a60d7[_0x2d06('0x53')]]['mohtime']=0x0;utils['info'](util[_0x2d06('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x3a60d7[_0x2d06('0x4c')],queues[_0x3a60d7['transfertargetuniqueid']]['name'],queues[_0x3a60d7[_0x2d06('0x53')]][_0x2d06('0xe')],queues[_0x3a60d7[_0x2d06('0x53')]]['calleridnum'],queues[_0x3a60d7['transfertargetuniqueid']][_0x2d06('0x54')]));}else{utils[_0x2d06('0x3')](util['format'](_0x2d06('0x57'),_0x3a60d7['origtransfereruniqueid'],queues[_0x3a60d7[_0x2d06('0x4e')]]['name'],_0x3a60d7[_0x2d06('0x4d')]));queues[_0x3a60d7[_0x2d06('0x4e')]]['transfereduniqueid']=_0x3a60d7['origtransfererlinkedid'];}}}}catch(_0x57aa4d){utils[_0x2d06('0x24')](util[_0x2d06('0x10')](_0x2d06('0x4b'),_0x3a60d7[_0x2d06('0x4c')]),_0x57aa4d);}};exports[_0x2d06('0x5b')]=function(_0x468ca9){try{if(!_[_0x2d06('0x16')](queues[_0x468ca9[_0x2d06('0x5')]])){utils['debug'](util[_0x2d06('0x10')](_0x2d06('0x5c'),_0x468ca9['uniqueid']),_0x468ca9);queues[_0x468ca9[_0x2d06('0x5')]][_0x2d06('0x5d')]=utils['now']();utils[_0x2d06('0x3')](util['format'](_0x2d06('0x5e'),_0x468ca9[_0x2d06('0x5')],queues[_0x468ca9[_0x2d06('0x5')]][_0x2d06('0x20')],queues[_0x468ca9[_0x2d06('0x5')]][_0x2d06('0x5d')]));}}catch(_0x42179b){utils[_0x2d06('0x24')](util[_0x2d06('0x10')](_0x2d06('0x5c'),_0x468ca9[_0x2d06('0x5')]),_0x42179b);}};exports[_0x2d06('0x5f')]=function(_0x3f537b){try{if(!_['isNil'](queues[_0x3f537b[_0x2d06('0x5')]])){if(!_['isNil'](queues[_0x3f537b[_0x2d06('0x5')]][_0x2d06('0x5d')])){utils[_0x2d06('0x17')](util[_0x2d06('0x10')](_0x2d06('0x60'),_0x3f537b[_0x2d06('0x5')]),_0x3f537b);queues[_0x3f537b['uniqueid']][_0x2d06('0x56')]+=utils[_0x2d06('0x61')](utils[_0x2d06('0x1e')](),queues[_0x3f537b['uniqueid']]['musiconholdstartAt']);utils[_0x2d06('0x3')](util[_0x2d06('0x10')](_0x2d06('0x62'),_0x3f537b['uniqueid'],queues[_0x3f537b[_0x2d06('0x5')]][_0x2d06('0x20')],queues[_0x3f537b['uniqueid']]['mohtime']));delete queues[_0x3f537b['uniqueid']][_0x2d06('0x5d')];}}}catch(_0xe7e596){utils[_0x2d06('0x24')](util[_0x2d06('0x10')](_0x2d06('0x60'),_0x3f537b[_0x2d06('0x5')]),_0xe7e596);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 8d195d3..770a311 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 _0x97a1=['calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','error','hangup','[%s][recordings][hangup]','calleridname','cause-txt'];(function(_0x24fae6,_0x350392){var _0x58da28=function(_0x51d126){while(--_0x51d126){_0x24fae6['push'](_0x24fae6['shift']());}};_0x58da28(++_0x350392);}(_0x97a1,0xa3));var _0x197a=function(_0x3980e5,_0x590de7){_0x3980e5=_0x3980e5-0x0;var _0x4aa039=_0x97a1[_0x3980e5];return _0x4aa039;};'use strict';var _=require(_0x197a('0x0'));var util=require(_0x197a('0x1'));var utils=require('./utils');var transfers=require(_0x197a('0x2'));var recordings={};function writeDB(_0x58c58e){var _0x124866;utils[_0x197a('0x3')](util[_0x197a('0x4')]('[%s][recordings][writeDB]',_0x58c58e['uniqueid']));if(transfers['blinds'][_0x58c58e[_0x197a('0x5')]]){_0x124866=_0x58c58e[_0x197a('0x5')];_0x58c58e['uniqueid']=transfers[_0x197a('0x6')][_0x58c58e[_0x197a('0x5')]][_0x197a('0x7')];}if(_0x58c58e[_0x197a('0x8')]){utils[_0x197a('0x9')](_0x58c58e[_0x197a('0x8')])[_0x197a('0xa')](function(_0xd520f9){if(_0xd520f9){_0x58c58e[_0x197a('0xb')]=_0xd520f9['name'];_0x58c58e[_0x197a('0xc')]=_0xd520f9['id'];}utils['request'](_0x197a('0xd'),_0x58c58e);});}else{utils[_0x197a('0xe')](_0x197a('0xd'),_0x58c58e);}if(_0x124866)delete transfers[_0x197a('0x6')][_0x124866];}exports[_0x197a('0xf')]=function(_0x2dbbea){try{utils[_0x197a('0x10')](util[_0x197a('0x4')](_0x197a('0x11'),_0x2dbbea[_0x197a('0x5')]),_0x2dbbea);if(_0x2dbbea['uniqueid']==_0x2dbbea[_0x197a('0x12')]){utils[_0x197a('0x3')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2dbbea['uniqueid'],_0x2dbbea[_0x197a('0x13')],_0x2dbbea[_0x197a('0x14')]));recordings[_0x2dbbea[_0x197a('0x5')]]={'uniqueid':_0x2dbbea[_0x197a('0x5')],'accountcode':_0x2dbbea[_0x197a('0x8')],'exten':_0x2dbbea['exten'],'context':_0x2dbbea[_0x197a('0x13')],'channel':_0x2dbbea[_0x197a('0x15')],'monitors':[]};}}catch(_0x3e664d){utils['error'](util[_0x197a('0x4')](_0x197a('0x11'),_0x2dbbea[_0x197a('0x5')]),_0x3e664d);}};exports['newstate']=function(_0x48669d){try{utils[_0x197a('0x10')](util[_0x197a('0x4')](_0x197a('0x16'),_0x48669d[_0x197a('0x5')]),_0x48669d);if(!_[_0x197a('0x17')](recordings[_0x48669d[_0x197a('0x5')]])&&_0x48669d['channelstate']==0x6){utils[_0x197a('0x3')](util[_0x197a('0x4')](_0x197a('0x18'),_0x48669d[_0x197a('0x5')],_0x48669d[_0x197a('0x13')],_0x48669d[_0x197a('0x15')]));}else if(!_[_0x197a('0x17')](recordings[_0x48669d[_0x197a('0x12')]])&&_0x48669d['channelstate']==0x6&&_0x48669d[_0x197a('0x13')]!='transfer'){utils[_0x197a('0x3')](util[_0x197a('0x4')](_0x197a('0x19'),_0x48669d[_0x197a('0x5')],_0x48669d[_0x197a('0x12')],_0x48669d[_0x197a('0x13')],_0x48669d['channel']));recordings[_0x48669d[_0x197a('0x12')]][_0x197a('0x8')]=_0x48669d[_0x197a('0x8')];}}catch(_0x2f37cf){utils['error'](util[_0x197a('0x4')]('[%s][recordings][newstate]',_0x48669d['uniqueid']),_0x2f37cf);}};exports['varset']=function(_0x4e8ace){try{if(!_['isNil'](_0x4e8ace['variable'])&&!_[_0x197a('0x17')](_0x4e8ace[_0x197a('0x1a')][_0x197a('0x1b')])){utils[_0x197a('0x10')](util[_0x197a('0x4')](_0x197a('0x1c'),_0x4e8ace[_0x197a('0x5')]),_0x4e8ace);utils['info'](util['format'](_0x197a('0x1d'),_0x4e8ace[_0x197a('0x5')],_0x4e8ace[_0x197a('0x1a')],_0x4e8ace[_0x197a('0x1e')]));if(_[_0x197a('0x1f')](_0x4e8ace['value'],_0x197a('0x20'))){_0x4e8ace[_0x197a('0x1e')]=_0x4e8ace[_0x197a('0x1e')]['replace'](_0x197a('0x20'),_0x197a('0x21'));}if(recordings[_0x4e8ace['linkedid']]){var _0x3617ef=_[_0x197a('0x22')](recordings[_0x4e8ace['linkedid']][_0x197a('0x23')],{'value':_0x4e8ace['value']});if(_[_0x197a('0x17')](_0x3617ef)){recordings[_0x4e8ace[_0x197a('0x12')]]['monitors']['push']({'value':_0x4e8ace[_0x197a('0x1e')]});}}}}catch(_0x1dec27){utils[_0x197a('0x24')](util[_0x197a('0x4')](_0x197a('0x1c'),_0x4e8ace['uniqueid']),_0x1dec27);}};exports[_0x197a('0x25')]=function(_0x1964b7){try{if(!_[_0x197a('0x17')](recordings[_0x1964b7[_0x197a('0x5')]])){utils['debug'](util[_0x197a('0x4')](_0x197a('0x26'),_0x1964b7[_0x197a('0x5')]),_0x1964b7);utils['info'](util[_0x197a('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1964b7[_0x197a('0x5')],_0x1964b7['calleridnum'],_0x1964b7[_0x197a('0x27')],_0x1964b7[_0x197a('0x28')]));recordings[_0x1964b7['uniqueid']][_0x197a('0x29')]=_0x1964b7['calleridnum'];recordings[_0x1964b7[_0x197a('0x5')]]['calleridname']=_0x1964b7[_0x197a('0x27')];recordings[_0x1964b7[_0x197a('0x5')]]['connectedlinenum']=_0x1964b7[_0x197a('0x2a')];recordings[_0x1964b7['uniqueid']]['connectedlinename']=_0x1964b7[_0x197a('0x2b')];if(recordings[_0x1964b7[_0x197a('0x5')]][_0x197a('0x2c')]==_0x197a('0x2d')&&recordings[_0x1964b7[_0x197a('0x5')]][_0x197a('0x8')]){recordings[_0x1964b7[_0x197a('0x5')]][_0x197a('0x2a')]=recordings[_0x1964b7['uniqueid']][_0x197a('0x8')];recordings[_0x1964b7['uniqueid']][_0x197a('0x2b')]='';}recordings[_0x1964b7[_0x197a('0x5')]][_0x197a('0x23')][_0x197a('0x2e')](function(_0x43c4b9){var _0x5dabc2=_['clone'](recordings[_0x1964b7[_0x197a('0x5')]]);_0x5dabc2['value']=_0x43c4b9[_0x197a('0x1e')];writeDB(_0x5dabc2);});delete recordings[_0x1964b7[_0x197a('0x5')]];}}catch(_0x9eec00){utils[_0x197a('0x24')](util[_0x197a('0x4')](_0x197a('0x26'),_0x1964b7['uniqueid']),_0x9eec00);}};exports[_0x197a('0x2f')]=function(_0xaf88c4){try{if(!_['isNil'](recordings[_0xaf88c4[_0x197a('0x5')]])){utils[_0x197a('0x10')](util[_0x197a('0x4')]('[%s][recordings][newexten]',_0xaf88c4[_0x197a('0x5')]),_0xaf88c4);utils[_0x197a('0x3')](util[_0x197a('0x4')](_0x197a('0x30'),_0xaf88c4[_0x197a('0x5')],_0xaf88c4['application'],_0xaf88c4[_0x197a('0x31')]));if(_0xaf88c4[_0x197a('0x32')][_0x197a('0x33')]()==_0x197a('0x34')&&_[_0x197a('0x35')](_0xaf88c4[_0x197a('0x31')][_0x197a('0x33')](),_0x197a('0x36'))){var _0x39b165=_0xaf88c4['appdata']['split']('=');var _0x34d853=_0x39b165[0x0][_0x197a('0x37')](_0x39b165[0x0][_0x197a('0x38')]('(')+0x1,_0x39b165[0x0][_0x197a('0x38')](')'));var _0x464317=_0x39b165[0x1];recordings[_0xaf88c4[_0x197a('0x5')]][_0x34d853]=_0x464317;}}}catch(_0x4cc8e5){utils[_0x197a('0x24')](util['format'](_0x197a('0x39'),_0xaf88c4[_0x197a('0x5')]),_0x4cc8e5);}};exports['queuecallerjoin']=function(_0x4bafa){try{if(!_[_0x197a('0x17')](recordings[_0x4bafa['uniqueid']])){utils[_0x197a('0x10')](util[_0x197a('0x4')](_0x197a('0x3a'),_0x4bafa[_0x197a('0x5')]),_0x4bafa);utils[_0x197a('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x4bafa[_0x197a('0x5')],_0x4bafa['queue']));recordings[_0x4bafa[_0x197a('0x5')]][_0x197a('0x3b')]=_0x4bafa[_0x197a('0x3b')];}}catch(_0x42f288){utils[_0x197a('0x24')](util['format'](_0x197a('0x3a'),_0x4bafa['uniqueid']),_0x42f288);}};exports[_0x197a('0x3c')]=function(_0x918c8b){try{utils[_0x197a('0x10')](util['format'](_0x197a('0x3d'),_0x918c8b[_0x197a('0x5')]),_0x918c8b);utils['info'](util[_0x197a('0x4')](_0x197a('0x3e'),_0x918c8b[_0x197a('0x5')],_0x918c8b[_0x197a('0x3f')],_0x918c8b[_0x197a('0x40')],_0x918c8b[_0x197a('0x41')],_0x918c8b[_0x197a('0x42')]));if(recordings[_0x918c8b['transfereruniqueid']]&&transfers[_0x197a('0x6')][_0x918c8b[_0x197a('0x43')]]){transfers[_0x197a('0x6')][_0x918c8b[_0x197a('0x43')]]['recording']=!![];}}catch(_0x367035){utils[_0x197a('0x24')](util[_0x197a('0x4')](_0x197a('0x3d'),_0x918c8b[_0x197a('0x5')]),_0x367035);}}; \ No newline at end of file +var _0xfef3=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','util','./utils','info','format','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename'];(function(_0x40bcf,_0x724c44){var _0x153af4=function(_0x3bbe0e){while(--_0x3bbe0e){_0x40bcf['push'](_0x40bcf['shift']());}};_0x153af4(++_0x724c44);}(_0xfef3,0x1e2));var _0x3fef=function(_0x2b733f,_0x1559bb){_0x2b733f=_0x2b733f-0x0;var _0x2ecebe=_0xfef3[_0x2b733f];return _0x2ecebe;};'use strict';var _=require('lodash');var util=require(_0x3fef('0x0'));var utils=require(_0x3fef('0x1'));var recordings={};function writeDB(_0x5b9444){utils[_0x3fef('0x2')](util[_0x3fef('0x3')]('[%s][recordings][writeDB]',_0x5b9444['uniqueid']));if(_0x5b9444[_0x3fef('0x4')]){utils[_0x3fef('0x5')](_0x5b9444[_0x3fef('0x4')])[_0x3fef('0x6')](function(_0x21bd9d){if(_0x21bd9d){_0x5b9444[_0x3fef('0x7')]=_0x21bd9d[_0x3fef('0x8')];_0x5b9444[_0x3fef('0x9')]=_0x21bd9d['id'];}utils[_0x3fef('0xa')](_0x3fef('0xb'),_0x5b9444);});}else{utils[_0x3fef('0xa')](_0x3fef('0xb'),_0x5b9444);}}exports[_0x3fef('0xc')]=function(_0x390752){try{utils[_0x3fef('0xd')](util['format'](_0x3fef('0xe'),_0x390752[_0x3fef('0xf')]),_0x390752);if(_0x390752[_0x3fef('0xf')]==_0x390752[_0x3fef('0x10')]){utils[_0x3fef('0x2')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x390752[_0x3fef('0xf')],_0x390752[_0x3fef('0x11')],_0x390752[_0x3fef('0x12')]));recordings[_0x390752[_0x3fef('0xf')]]={'uniqueid':_0x390752[_0x3fef('0xf')],'accountcode':_0x390752[_0x3fef('0x4')],'exten':_0x390752['exten'],'context':_0x390752['context'],'channel':_0x390752[_0x3fef('0x13')],'monitors':[]};}}catch(_0x469f83){utils[_0x3fef('0x14')](util[_0x3fef('0x3')](_0x3fef('0xe'),_0x390752[_0x3fef('0xf')]),_0x469f83);}};exports[_0x3fef('0x15')]=function(_0x27ef81){try{utils['debug'](util[_0x3fef('0x3')](_0x3fef('0x16'),_0x27ef81[_0x3fef('0xf')]),_0x27ef81);if(!_[_0x3fef('0x17')](recordings[_0x27ef81[_0x3fef('0xf')]])&&_0x27ef81['channelstate']==0x6){utils[_0x3fef('0x2')](util[_0x3fef('0x3')](_0x3fef('0x18'),_0x27ef81[_0x3fef('0xf')],_0x27ef81['context'],_0x27ef81[_0x3fef('0x13')]));}else if(!_[_0x3fef('0x17')](recordings[_0x27ef81['linkedid']])&&_0x27ef81['channelstate']==0x6&&_0x27ef81['context']!=_0x3fef('0x19')){utils['info'](util[_0x3fef('0x3')](_0x3fef('0x1a'),_0x27ef81[_0x3fef('0xf')],_0x27ef81[_0x3fef('0x10')],_0x27ef81['context'],_0x27ef81[_0x3fef('0x13')]));recordings[_0x27ef81['linkedid']]['accountcode']=_0x27ef81['accountcode'];}}catch(_0x4c2a01){utils['error'](util[_0x3fef('0x3')](_0x3fef('0x16'),_0x27ef81[_0x3fef('0xf')]),_0x4c2a01);}};exports[_0x3fef('0x1b')]=function(_0x5c7f30){try{if(!_['isNil'](_0x5c7f30['variable'])&&!_[_0x3fef('0x17')](_0x5c7f30[_0x3fef('0x1c')][_0x3fef('0x1d')])){utils[_0x3fef('0xd')](util['format'](_0x3fef('0x1e'),_0x5c7f30[_0x3fef('0xf')]),_0x5c7f30);utils[_0x3fef('0x2')](util[_0x3fef('0x3')](_0x3fef('0x1f'),_0x5c7f30[_0x3fef('0xf')],_0x5c7f30['variable'],_0x5c7f30[_0x3fef('0x20')]));if(_[_0x3fef('0x21')](_0x5c7f30[_0x3fef('0x20')],'.wav49')){_0x5c7f30[_0x3fef('0x20')]=_0x5c7f30[_0x3fef('0x20')][_0x3fef('0x22')](_0x3fef('0x23'),_0x3fef('0x24'));}if(recordings[_0x5c7f30[_0x3fef('0x10')]]){var _0x3384f5=_['find'](recordings[_0x5c7f30['linkedid']][_0x3fef('0x25')],{'value':_0x5c7f30[_0x3fef('0x20')]});if(_[_0x3fef('0x17')](_0x3384f5)){recordings[_0x5c7f30[_0x3fef('0x10')]][_0x3fef('0x25')][_0x3fef('0x26')]({'value':_0x5c7f30[_0x3fef('0x20')]});}}}}catch(_0x1a7517){utils[_0x3fef('0x14')](util['format'](_0x3fef('0x1e'),_0x5c7f30['uniqueid']),_0x1a7517);}};exports['hangup']=function(_0x5ed66e){try{if(!_[_0x3fef('0x17')](recordings[_0x5ed66e[_0x3fef('0xf')]])){utils[_0x3fef('0xd')](util[_0x3fef('0x3')]('[%s][recordings][hangup]',_0x5ed66e[_0x3fef('0xf')]),_0x5ed66e);utils[_0x3fef('0x2')](util[_0x3fef('0x3')](_0x3fef('0x27'),_0x5ed66e[_0x3fef('0xf')],_0x5ed66e[_0x3fef('0x28')],_0x5ed66e[_0x3fef('0x29')],_0x5ed66e[_0x3fef('0x2a')]));recordings[_0x5ed66e[_0x3fef('0xf')]]['calleridnum']=_0x5ed66e['calleridnum'];recordings[_0x5ed66e['uniqueid']][_0x3fef('0x29')]=_0x5ed66e[_0x3fef('0x29')];recordings[_0x5ed66e[_0x3fef('0xf')]][_0x3fef('0x2b')]=_0x5ed66e['connectedlinenum'];recordings[_0x5ed66e['uniqueid']]['connectedlinename']=_0x5ed66e[_0x3fef('0x2c')];if(recordings[_0x5ed66e[_0x3fef('0xf')]][_0x3fef('0x2d')]==_0x3fef('0x2e')&&recordings[_0x5ed66e[_0x3fef('0xf')]]['accountcode']){recordings[_0x5ed66e[_0x3fef('0xf')]][_0x3fef('0x2b')]=recordings[_0x5ed66e[_0x3fef('0xf')]]['accountcode'];recordings[_0x5ed66e[_0x3fef('0xf')]][_0x3fef('0x2c')]='';}recordings[_0x5ed66e['uniqueid']][_0x3fef('0x25')][_0x3fef('0x2f')](function(_0x143dac){var _0x26231c=_[_0x3fef('0x30')](recordings[_0x5ed66e['uniqueid']]);_0x26231c[_0x3fef('0x20')]=_0x143dac[_0x3fef('0x20')];writeDB(_0x26231c);});delete recordings[_0x5ed66e['uniqueid']];}}catch(_0x2f7283){utils[_0x3fef('0x14')](util[_0x3fef('0x3')](_0x3fef('0x31'),_0x5ed66e['uniqueid']),_0x2f7283);}};exports[_0x3fef('0x32')]=function(_0x52e580){try{if(!_[_0x3fef('0x17')](recordings[_0x52e580[_0x3fef('0xf')]])){utils['debug'](util[_0x3fef('0x3')](_0x3fef('0x33'),_0x52e580[_0x3fef('0xf')]),_0x52e580);utils[_0x3fef('0x2')](util[_0x3fef('0x3')](_0x3fef('0x34'),_0x52e580[_0x3fef('0xf')],_0x52e580[_0x3fef('0x35')],_0x52e580[_0x3fef('0x36')]));if(_0x52e580[_0x3fef('0x35')][_0x3fef('0x37')]()==_0x3fef('0x38')&&_[_0x3fef('0x39')](_0x52e580[_0x3fef('0x36')]['toLowerCase'](),_0x3fef('0x3a'))){var _0x54e471=_0x52e580[_0x3fef('0x36')]['split']('=');var _0x3206bd=_0x54e471[0x0][_0x3fef('0x3b')](_0x54e471[0x0][_0x3fef('0x3c')]('(')+0x1,_0x54e471[0x0][_0x3fef('0x3c')](')'));var _0x3e2454=_0x54e471[0x1];recordings[_0x52e580[_0x3fef('0xf')]][_0x3206bd]=_0x3e2454;}}}catch(_0x5541f3){utils['error'](util[_0x3fef('0x3')](_0x3fef('0x33'),_0x52e580[_0x3fef('0xf')]),_0x5541f3);}};exports[_0x3fef('0x3d')]=function(_0x262b8f){try{if(!_[_0x3fef('0x17')](recordings[_0x262b8f['uniqueid']])){utils[_0x3fef('0xd')](util['format'](_0x3fef('0x3e'),_0x262b8f[_0x3fef('0xf')]),_0x262b8f);utils['info'](util[_0x3fef('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x262b8f[_0x3fef('0xf')],_0x262b8f[_0x3fef('0x3f')]));recordings[_0x262b8f[_0x3fef('0xf')]][_0x3fef('0x3f')]=_0x262b8f[_0x3fef('0x3f')];}}catch(_0x3cb36b){utils[_0x3fef('0x14')](util[_0x3fef('0x3')](_0x3fef('0x3e'),_0x262b8f[_0x3fef('0xf')]),_0x3cb36b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bd215bd..bfe9721 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 _0x5ac0=['transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5ac0,0x1df));var _0x05ac=function(_0x56a2f2,_0x5c1825){_0x56a2f2=_0x56a2f2-0x0;var _0x2f1195=_0x5ac0[_0x56a2f2];return _0x2f1195;};'use strict';var _=require('lodash');var util=require(_0x05ac('0x0'));var utils=require(_0x05ac('0x1'));function writeDB(_0x1700d0){utils['info'](util[_0x05ac('0x2')](_0x05ac('0x3'),_0x1700d0[_0x05ac('0x4')]===_0x05ac('0x5')?_0x1700d0[_0x05ac('0x6')]:_0x1700d0[_0x05ac('0x7')],_0x1700d0['type']));utils[_0x05ac('0x8')](_0x05ac('0x9'),_0x1700d0);}exports[_0x05ac('0xa')]={};exports[_0x05ac('0xb')]=function(_0xd3685d){try{utils[_0x05ac('0xc')](util[_0x05ac('0x2')](_0x05ac('0xd'),_0xd3685d[_0x05ac('0x7')]),_0xd3685d);utils[_0x05ac('0xe')](util[_0x05ac('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xd3685d[_0x05ac('0x7')],_0xd3685d[_0x05ac('0xf')],_0xd3685d[_0x05ac('0x10')],_0xd3685d[_0x05ac('0x11')],_0xd3685d[_0x05ac('0x12')]));_0xd3685d[_0x05ac('0x4')]=_0x05ac('0x13');exports['blinds'][_0xd3685d[_0x05ac('0x14')]]=_0xd3685d;writeDB(_0xd3685d);}catch(_0x5c025d){utils[_0x05ac('0x15')](util[_0x05ac('0x2')]('[%s][transfers][blindtransfer]',_0xd3685d[_0x05ac('0x7')]),_0x5c025d);}};exports[_0x05ac('0x16')]=function(_0x3854ed){try{utils[_0x05ac('0xc')](util[_0x05ac('0x2')](_0x05ac('0x17'),_0x3854ed[_0x05ac('0x6')]),_0x3854ed);utils[_0x05ac('0xe')](util[_0x05ac('0x2')](_0x05ac('0x18'),_0x3854ed[_0x05ac('0x6')],_0x3854ed[_0x05ac('0x19')],_0x3854ed[_0x05ac('0x1a')],_0x3854ed['transfertargetcalleridnum'],_0x3854ed[_0x05ac('0x1b')]));_0x3854ed=_[_0x05ac('0x1c')](_0x3854ed,{'transfererchannel':_0x3854ed[_0x05ac('0x1d')],'transferercalleridnum':_0x3854ed[_0x05ac('0x19')],'transferercalleridname':_0x3854ed['origtransferercalleridname'],'transfererconnectedlinenum':_0x3854ed[_0x05ac('0x1e')],'transfererconnectedlinename':_0x3854ed[_0x05ac('0x1f')],'transfereraccountcode':_0x3854ed['origtransfereraccountcode'],'transferercontext':_0x3854ed['secondtransferercontext'],'transfererexten':_0x3854ed[_0x05ac('0x20')],'transfererlinkedid':_0x3854ed['origtransfererlinkedid'],'context':_0x3854ed[_0x05ac('0x21')],'extension':_0x3854ed[_0x05ac('0x22')],'type':_0x05ac('0x5')});if(_[_0x05ac('0x23')](_0x3854ed[_0x05ac('0x24')])){_0x3854ed=_[_0x05ac('0x1c')](_0x3854ed,{'transfereechannel':_0x3854ed[_0x05ac('0x25')],'transfereecalleridnum':_0x3854ed[_0x05ac('0x26')],'transfereecalleridname':_0x3854ed[_0x05ac('0x1b')],'transfereeconnectedlinenum':_0x3854ed['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3854ed[_0x05ac('0x27')],'transfereeaccountcode':_0x3854ed[_0x05ac('0x28')],'transfereecontext':_0x3854ed[_0x05ac('0x29')],'transfereeexten':_0x3854ed[_0x05ac('0x2a')],'transfereelinkedid':_0x3854ed['transfertargetlinkedid']});}writeDB(_0x3854ed);}catch(_0x265f6c){utils['error'](util[_0x05ac('0x2')]('[%s][transfers][attendedtransfer]',_0x3854ed['origtransfereruniqueid']),_0x265f6c);}}; \ No newline at end of file +var _0xaa6d=['transferercalleridnum','transferercalleridname','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x3200a8,_0x31132f){var _0x21f956=function(_0x13eb01){while(--_0x13eb01){_0x3200a8['push'](_0x3200a8['shift']());}};_0x21f956(++_0x31132f);}(_0xaa6d,0x9b));var _0xdaa6=function(_0x5e0529,_0x5285ea){_0x5e0529=_0x5e0529-0x0;var _0x988744=_0xaa6d[_0x5e0529];return _0x988744;};'use strict';var _=require(_0xdaa6('0x0'));var util=require(_0xdaa6('0x1'));var utils=require(_0xdaa6('0x2'));function writeDB(_0x33bdd7){utils[_0xdaa6('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x33bdd7[_0xdaa6('0x4')]==='attended'?_0x33bdd7[_0xdaa6('0x5')]:_0x33bdd7[_0xdaa6('0x6')],_0x33bdd7['type']));utils[_0xdaa6('0x7')](_0xdaa6('0x8'),_0x33bdd7);}exports['blindtransfer']=function(_0x230cb9){try{utils[_0xdaa6('0x9')](util[_0xdaa6('0xa')](_0xdaa6('0xb'),_0x230cb9[_0xdaa6('0x6')]),_0x230cb9);utils['info'](util['format'](_0xdaa6('0xc'),_0x230cb9[_0xdaa6('0x6')],_0x230cb9[_0xdaa6('0xd')],_0x230cb9[_0xdaa6('0xe')],_0x230cb9['transfereecalleridnum'],_0x230cb9[_0xdaa6('0xf')]));_0x230cb9[_0xdaa6('0x4')]=_0xdaa6('0x10');writeDB(_0x230cb9);}catch(_0x3aafd1){utils[_0xdaa6('0x11')](util[_0xdaa6('0xa')](_0xdaa6('0xb'),_0x230cb9[_0xdaa6('0x6')]),_0x3aafd1);}};exports[_0xdaa6('0x12')]=function(_0x49555f){try{utils['debug'](util[_0xdaa6('0xa')](_0xdaa6('0x13'),_0x49555f['origtransfereruniqueid']),_0x49555f);utils['info'](util['format'](_0xdaa6('0x14'),_0x49555f[_0xdaa6('0x5')],_0x49555f[_0xdaa6('0x15')],_0x49555f[_0xdaa6('0x16')],_0x49555f[_0xdaa6('0x17')],_0x49555f[_0xdaa6('0x18')]));_0x49555f=_['assign'](_0x49555f,{'transfererchannel':_0x49555f[_0xdaa6('0x19')],'transferercalleridnum':_0x49555f[_0xdaa6('0x15')],'transferercalleridname':_0x49555f['origtransferercalleridname'],'transfererconnectedlinenum':_0x49555f[_0xdaa6('0x1a')],'transfererconnectedlinename':_0x49555f[_0xdaa6('0x1b')],'transfereraccountcode':_0x49555f['origtransfereraccountcode'],'transferercontext':_0x49555f[_0xdaa6('0x1c')],'transfererexten':_0x49555f[_0xdaa6('0x1d')],'transfererlinkedid':_0x49555f[_0xdaa6('0x1e')],'context':_0x49555f[_0xdaa6('0x1f')],'extension':_0x49555f[_0xdaa6('0x20')],'type':_0xdaa6('0x21')});if(_[_0xdaa6('0x22')](_0x49555f['transfereechannel'])){_0x49555f=_[_0xdaa6('0x23')](_0x49555f,{'transfereechannel':_0x49555f[_0xdaa6('0x24')],'transfereecalleridnum':_0x49555f['transfertargetcalleridnum'],'transfereecalleridname':_0x49555f[_0xdaa6('0x18')],'transfereeconnectedlinenum':_0x49555f[_0xdaa6('0x25')],'transfereeconnectedlinename':_0x49555f[_0xdaa6('0x26')],'transfereeaccountcode':_0x49555f[_0xdaa6('0x27')],'transfereecontext':_0x49555f[_0xdaa6('0x28')],'transfereeexten':_0x49555f['transfertargetexten'],'transfereelinkedid':_0x49555f[_0xdaa6('0x29')]});}writeDB(_0x49555f);}catch(_0xafd511){utils['error'](util[_0xdaa6('0xa')](_0xdaa6('0x13'),_0x49555f[_0xdaa6('0x5')]),_0xafd511);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 6fd13ee..1d51c57 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 _0x2e2c=['inspect','debug','request','then','[utils][request]\x20name:%s','error','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','format','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info'];(function(_0x1488d6,_0x5c5ef0){var _0x3af56f=function(_0x99e2d9){while(--_0x99e2d9){_0x1488d6['push'](_0x1488d6['shift']());}};_0x3af56f(++_0x5c5ef0);}(_0x2e2c,0x160));var _0xc2e2=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0x2e2c[_0x4459b8];return _0x4a4b07;};'use strict';var BPromise=require(_0xc2e2('0x0'));var jayson=require(_0xc2e2('0x1'));var moment=require(_0xc2e2('0x2'));var util=require(_0xc2e2('0x3'));var client=jayson[_0xc2e2('0x4')][_0xc2e2('0x5')]({'port':0x2329});var logger=require(_0xc2e2('0x6'))('xdr');exports['info']=function(_0x4f112b,_0x38aada){logger[_0xc2e2('0x7')](_0x4f112b,_0x38aada?util[_0xc2e2('0x8')](_0x38aada,{'showHidden':![],'depth':null}):'');};exports[_0xc2e2('0x9')]=function(_0x3a57a5,_0x36303d){logger['debug'](_0x3a57a5,_0x36303d?util[_0xc2e2('0x8')](_0x36303d,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x462c86,_0x19cdad){logger['error'](_0x462c86,_0x19cdad?util[_0xc2e2('0x8')](_0x19cdad,{'showHidden':![],'depth':null}):'');};exports[_0xc2e2('0xa')]=function(_0x4fcfe2,_0x145d79){return client['request'](_0x4fcfe2,{'body':_0x145d79})[_0xc2e2('0xb')](function(_0x43eb83){logger[_0xc2e2('0x9')](_0xc2e2('0xc'),_0x4fcfe2,_0x43eb83?util['inspect'](_0x43eb83,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2fe3ea){logger[_0xc2e2('0xd')]('[utils][request]\x20name:%s',_0x4fcfe2,_0x2fe3ea?util[_0xc2e2('0x8')](_0x2fe3ea,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5f4e45){return client['request'](_0xc2e2('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xc2e2('0xf'),_0xc2e2('0x10')],'where':_0x5f4e45,'limit':0x1}})[_0xc2e2('0xb')](function(_0x110e00){logger[_0xc2e2('0x9')](_0xc2e2('0x11'),JSON[_0xc2e2('0x12')](_0x5f4e45),_0x110e00?util[_0xc2e2('0x8')](_0x110e00,{'showHidden':![],'depth':null}):'');return _0x110e00[_0xc2e2('0x13')][_0xc2e2('0x14')]?_0x110e00[_0xc2e2('0x13')][0x0]:null;});}exports[_0xc2e2('0x15')]=function(_0x49618a){return new BPromise(function(_0x426160,_0x1e59ce){if(_0x49618a){return getUser({'internal':_0x49618a})[_0xc2e2('0xb')](function(_0x30daf6){logger['info'](_0xc2e2('0x16'),_0x49618a,_0x30daf6?_0xc2e2('0x17'):'notfound');return _0x426160(_0x30daf6);})[_0xc2e2('0x18')](function(_0x43a1fa){logger[_0xc2e2('0xd')](_0xc2e2('0x19'),_0x43a1fa?util[_0xc2e2('0x8')](_0x43a1fa,{'showHidden':![],'depth':null}):'');return _0x426160(null);});}return _0x426160(null);});};exports[_0xc2e2('0x1a')]=function(_0x14af8e){return new BPromise(function(_0x2b06a6,_0x229a47){if(_0x14af8e){return getUser({'interface':_0x14af8e})['then'](function(_0x2f1ecf){logger['info'](_0xc2e2('0x1b'),_0x14af8e,_0x2f1ecf?_0xc2e2('0x17'):'notfound');return _0x2b06a6(_0x2f1ecf);})[_0xc2e2('0x18')](function(_0x82ed71){logger[_0xc2e2('0xd')]('[utils][getUserByInterface]',_0x82ed71?util[_0xc2e2('0x8')](_0x82ed71,{'showHidden':![],'depth':null}):'');return _0x2b06a6(null);});}return _0x2b06a6(null);});};exports['getUserByName']=function(_0x58fc4d){return new BPromise(function(_0x1a7301,_0x569164){if(_0x58fc4d){return getUser({'name':_0x58fc4d})[_0xc2e2('0xb')](function(_0x5d7ae0){logger[_0xc2e2('0x7')](_0xc2e2('0x1c'),_0x58fc4d,_0x5d7ae0?_0xc2e2('0x17'):_0xc2e2('0x1d'));return _0x1a7301(_0x5d7ae0);})[_0xc2e2('0x18')](function(_0x14d5cc){logger['error'](_0xc2e2('0x1e'),_0x14d5cc?util[_0xc2e2('0x8')](_0x14d5cc,{'showHidden':![],'depth':null}):'');return _0x1a7301(null);});}return _0x1a7301(null);});};exports['getVoiceQueueByName']=function(_0x3a151d){return new BPromise(function(_0x3ea59b,_0x4d4db8){if(_0x3a151d){return client[_0xc2e2('0xa')](_0xc2e2('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xc2e2('0xf'),_0xc2e2('0x20'),'acw',_0xc2e2('0x21')],'where':{'name':_0x3a151d},'limit':0x1}})[_0xc2e2('0xb')](function(_0x454279){logger['debug'](_0xc2e2('0x22'),_0x3a151d,_0x454279?util[_0xc2e2('0x8')](_0x454279,{'showHidden':![],'depth':null}):'');logger['info'](_0xc2e2('0x23'),_0x3a151d,_0x454279?_0xc2e2('0x17'):'notfound');return _0x3ea59b(_0x454279[_0xc2e2('0x13')][_0xc2e2('0x14')]?_0x454279[_0xc2e2('0x13')][0x0]:null);})[_0xc2e2('0x18')](function(_0x14c425){logger['error'](_0xc2e2('0x24'),_0x14c425?util['inspect'](_0x14c425,{'showHidden':![],'depth':null}):'');return _0x3ea59b(null);});}return _0x3ea59b(null);});};exports[_0xc2e2('0x25')]=function(_0x3e3182,_0x5b7e46){return moment(_0x3e3182)['add'](_0x5b7e46,_0xc2e2('0x26'))['format'](_0xc2e2('0x27'));};exports['subtractTime']=function(_0x38e791,_0x53e3c1){return moment(_0x38e791)['subtract'](_0x53e3c1,'seconds')[_0xc2e2('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x574b3a,_0x1f1c6f){return moment(_0x574b3a)[_0xc2e2('0x29')](moment(_0x1f1c6f),'seconds');};exports['sumTime']=function(_0x21552f,_0x30b2f7){return parseInt(_0x21552f,0xa)+parseInt(_0x30b2f7,0xa);};exports[_0xc2e2('0x2a')]=function(){return moment()[_0xc2e2('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc2e2('0x2b')]=function(_0x24cb62,_0x3cda8b){if(_0x3cda8b){return moment(_0x24cb62)['isAfter'](_0x3cda8b);}return!![];};exports[_0xc2e2('0x2c')]=function(_0x84994,_0x4ed583){if(_0x4ed583){return moment(_0x84994)['isBefore'](_0x4ed583);}else if(_0x84994){return!![];}return![];}; \ No newline at end of file +var _0xb540=['internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','GetVoiceQueue','name','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','error','inspect','request','then','[utils][request]\x20name:%s'];(function(_0x1732be,_0x55bcd3){var _0x548603=function(_0x304373){while(--_0x304373){_0x1732be['push'](_0x1732be['shift']());}};_0x548603(++_0x55bcd3);}(_0xb540,0x179));var _0x0b54=function(_0x3d2597,_0x587dc0){_0x3d2597=_0x3d2597-0x0;var _0x3fef32=_0xb540[_0x3d2597];return _0x3fef32;};'use strict';var BPromise=require(_0x0b54('0x0'));var jayson=require(_0x0b54('0x1'));var moment=require(_0x0b54('0x2'));var util=require(_0x0b54('0x3'));var client=jayson[_0x0b54('0x4')][_0x0b54('0x5')]({'port':0x2329});var logger=require(_0x0b54('0x6'))(_0x0b54('0x7'));exports[_0x0b54('0x8')]=function(_0x9d7892,_0x137e31){logger[_0x0b54('0x8')](_0x9d7892,_0x137e31?util['inspect'](_0x137e31,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5f53da,_0x543f3c){logger[_0x0b54('0x9')](_0x5f53da,_0x543f3c?util['inspect'](_0x543f3c,{'showHidden':![],'depth':null}):'');};exports[_0x0b54('0xa')]=function(_0x10453b,_0x1284bb){logger[_0x0b54('0xa')](_0x10453b,_0x1284bb?util[_0x0b54('0xb')](_0x1284bb,{'showHidden':![],'depth':null}):'');};exports[_0x0b54('0xc')]=function(_0x2a48e3,_0x49f296){return client[_0x0b54('0xc')](_0x2a48e3,{'body':_0x49f296})[_0x0b54('0xd')](function(_0x2acb01){logger[_0x0b54('0x9')](_0x0b54('0xe'),_0x2a48e3,_0x2acb01?util[_0x0b54('0xb')](_0x2acb01,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x271007){logger[_0x0b54('0xa')]('[utils][request]\x20name:%s',_0x2a48e3,_0x271007?util[_0x0b54('0xb')](_0x271007,{'showHidden':![],'depth':null}):'');});};function getUser(_0x20453b){return client[_0x0b54('0xc')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0b54('0xf'),'name',_0x0b54('0x10')],'where':_0x20453b,'limit':0x1}})[_0x0b54('0xd')](function(_0x2a1bf6){logger[_0x0b54('0x9')](_0x0b54('0x11'),JSON[_0x0b54('0x12')](_0x20453b),_0x2a1bf6?util[_0x0b54('0xb')](_0x2a1bf6,{'showHidden':![],'depth':null}):'');return _0x2a1bf6[_0x0b54('0x13')][_0x0b54('0x14')]?_0x2a1bf6[_0x0b54('0x13')][0x0]:null;});}exports[_0x0b54('0x15')]=function(_0x3cd449){return new BPromise(function(_0xff26d1,_0x3d0bfb){if(_0x3cd449){return getUser({'internal':_0x3cd449})[_0x0b54('0xd')](function(_0x56bc0e){logger['info'](_0x0b54('0x16'),_0x3cd449,_0x56bc0e?_0x0b54('0x17'):'notfound');return _0xff26d1(_0x56bc0e);})[_0x0b54('0x18')](function(_0xbced8b){logger[_0x0b54('0xa')](_0x0b54('0x19'),_0xbced8b?util[_0x0b54('0xb')](_0xbced8b,{'showHidden':![],'depth':null}):'');return _0xff26d1(null);});}return _0xff26d1(null);});};exports[_0x0b54('0x1a')]=function(_0x393ba9){return new BPromise(function(_0x41a98f,_0x3580bd){if(_0x393ba9){return getUser({'interface':_0x393ba9})[_0x0b54('0xd')](function(_0x42b093){logger[_0x0b54('0x8')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x393ba9,_0x42b093?'found':'notfound');return _0x41a98f(_0x42b093);})[_0x0b54('0x18')](function(_0x5539f0){logger['error'](_0x0b54('0x1b'),_0x5539f0?util[_0x0b54('0xb')](_0x5539f0,{'showHidden':![],'depth':null}):'');return _0x41a98f(null);});}return _0x41a98f(null);});};exports[_0x0b54('0x1c')]=function(_0x35af55){return new BPromise(function(_0x28b0a5,_0x16a769){if(_0x35af55){return getUser({'name':_0x35af55})[_0x0b54('0xd')](function(_0x23ba8){logger['info'](_0x0b54('0x1d'),_0x35af55,_0x23ba8?_0x0b54('0x17'):_0x0b54('0x1e'));return _0x28b0a5(_0x23ba8);})['catch'](function(_0x19a5ee){logger[_0x0b54('0xa')]('[utils][getUserByName]',_0x19a5ee?util[_0x0b54('0xb')](_0x19a5ee,{'showHidden':![],'depth':null}):'');return _0x28b0a5(null);});}return _0x28b0a5(null);});};exports['getVoiceQueueByName']=function(_0x594219){return new BPromise(function(_0x4d7332,_0x3a871d){if(_0x594219){return client['request'](_0x0b54('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x0b54('0x20'),_0x0b54('0x21'),_0x0b54('0x22'),'acwTimeout'],'where':{'name':_0x594219},'limit':0x1}})[_0x0b54('0xd')](function(_0x5426b9){logger[_0x0b54('0x9')](_0x0b54('0x23'),_0x594219,_0x5426b9?util['inspect'](_0x5426b9,{'showHidden':![],'depth':null}):'');logger[_0x0b54('0x8')](_0x0b54('0x24'),_0x594219,_0x5426b9?_0x0b54('0x17'):_0x0b54('0x1e'));return _0x4d7332(_0x5426b9[_0x0b54('0x13')][_0x0b54('0x14')]?_0x5426b9[_0x0b54('0x13')][0x0]:null);})[_0x0b54('0x18')](function(_0x144572){logger[_0x0b54('0xa')](_0x0b54('0x25'),_0x144572?util[_0x0b54('0xb')](_0x144572,{'showHidden':![],'depth':null}):'');return _0x4d7332(null);});}return _0x4d7332(null);});};exports[_0x0b54('0x26')]=function(_0xf71ec0,_0x2f2f27){return moment(_0xf71ec0)['add'](_0x2f2f27,'seconds')['format'](_0x0b54('0x27'));};exports[_0x0b54('0x28')]=function(_0xec7f12,_0x5516d7){return moment(_0xec7f12)[_0x0b54('0x29')](_0x5516d7,_0x0b54('0x2a'))[_0x0b54('0x2b')](_0x0b54('0x27'));};exports[_0x0b54('0x2c')]=function(_0x594b28,_0x38e8bb){return moment(_0x594b28)['diff'](moment(_0x38e8bb),'seconds');};exports[_0x0b54('0x2d')]=function(_0xd3cd54,_0x37fab5){return parseInt(_0xd3cd54,0xa)+parseInt(_0x37fab5,0xa);};exports[_0x0b54('0x2e')]=function(){return moment()[_0x0b54('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0b54('0x2f')]=function(_0x7dfb03,_0x158f1d){if(_0x158f1d){return moment(_0x7dfb03)[_0x0b54('0x2f')](_0x158f1d);}return!![];};exports[_0x0b54('0x30')]=function(_0x9a4b9,_0x3b9d5c){if(_0x3b9d5c){return moment(_0x9a4b9)[_0x0b54('0x30')](_0x3b9d5c);}else if(_0x9a4b9){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 427a8d8..545149c 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 _0x34cc=['\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','responseTime','other','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','./safe-template','safeTemplate','maskSensitiveData','/var','log','xcally','join','role','name','ensureDir','catch','user','then','no-user','data','timestamp','client','error','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body'];(function(_0x8af245,_0x368074){var _0x36e49b=function(_0x25dab1){while(--_0x25dab1){_0x8af245['push'](_0x8af245['shift']());}};_0x36e49b(++_0x368074);}(_0x34cc,0x12b));var _0xc34c=function(_0x1c3f47,_0x19b8e7){_0x1c3f47=_0x1c3f47-0x0;var _0x42b621=_0x34cc[_0x1c3f47];return _0x42b621;};var fs=require(_0xc34c('0x0'));var _=require(_0xc34c('0x1'));var ewinston=require(_0xc34c('0x2'));var path=require('path');var util=require(_0xc34c('0x3'));var fileLogger=require(_0xc34c('0x4'))['fileLogger'];var safeTemplate=require(_0xc34c('0x5'))[_0xc34c('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0xc34c('0x7')];function ClientSideLogger(){function _0x291ef4(_0xa0626f){var _0x128985=path['join'](_0xc34c('0x8'),_0xc34c('0x9'),_0xc34c('0xa'));var _0x39a42c=path[_0xc34c('0xb')]('client',_0xa0626f[_0xc34c('0xc')]+'-'+_0xa0626f[_0xc34c('0xd')]);return fs[_0xc34c('0xe')](path[_0xc34c('0xb')](_0x128985,_0x39a42c))['then'](function(){var _0x1d9194=fileLogger('client',path[_0xc34c('0xb')](_0x128985,_0x39a42c));return _0x1d9194;})[_0xc34c('0xf')](function(_0x4bbb04){throw _0x4bbb04;});}this[_0xc34c('0x9')]=function(_0x2df85a,_0x3f53f0,_0x5ea2b2,_0x453257){return _0x291ef4(_0x2df85a[_0xc34c('0x10')])[_0xc34c('0x11')](function(_0x2fcd25){var _0x150194=_0x2fcd25[_0x3f53f0];return _0x150194;})[_0xc34c('0x11')](function(_0x2af135){var _0x46c901=_0x2df85a['user']?_0x2df85a[_0xc34c('0x10')]['id']:_0xc34c('0x12');var _0x33f616=_0x453257[_0xc34c('0x13')];var _0x51f37e=_0x453257[_0xc34c('0x14')];var _0x1df544=new Date(Number(_0x51f37e));return _0x2af135(_0x46c901,_0x1df544,_0x5ea2b2,_0x33f616);})['catch'](function(_0x3d19c3){fileLogger(_0xc34c('0x15'))[_0xc34c('0x16')](_0x3d19c3);});};}function setupLoggers(_0x52ff59){return new Promise(function(_0x2b6fce){var _0x11f1ce=new ClientSideLogger();var _0x1c0086=fileLogger('api');var _0x2539a8=fileLogger(_0xc34c('0x17'));_0x52ff59[_0xc34c('0x18')](_0xc34c('0x19'),_0x11f1ce);_0x52ff59[_0xc34c('0x1a')](ewinston[_0xc34c('0x1b')]({'winstonInstance':_0x1c0086,'meta':![],'statusLevels':!![],'msg':function(_0x4dae20,_0xb0f991){var _0x390ca7=_0xc34c('0x1c');if(!_['isEmpty'](_0x4dae20[_0xc34c('0x1d')])){_0x390ca7+=_0xc34c('0x1e');var _0x51837d=_0x4dae20[_0xc34c('0x1d')];maskSensitiveData(_0x51837d);}return safeTemplate(util['format'](_0x390ca7,_0x4dae20[_0xc34c('0x1f')],_0x4dae20[_0xc34c('0x20')][_0xc34c('0x21')]?_0x4dae20[_0xc34c('0x20')][_0xc34c('0x21')]:_0x4dae20[_0xc34c('0x22')][_0xc34c('0x23')]||_0x4dae20['ip'],_0x4dae20[_0xc34c('0x24')],_0xb0f991[_0xc34c('0x25')],_0xb0f991['responseTime'],_0x4dae20[_0xc34c('0x10')]?_0x4dae20[_0xc34c('0x10')]['id']:null,_0x4dae20['user']?_0x4dae20[_0xc34c('0x10')][_0xc34c('0xd')]:null,_0x4dae20[_0xc34c('0x10')]?_0x4dae20[_0xc34c('0x10')]['role']:null,_0x51837d?util[_0xc34c('0x26')](_0x51837d,![],null):''));}}));_0x52ff59[_0xc34c('0x1a')](ewinston[_0xc34c('0x1b')]({'winstonInstance':_0x2539a8,'meta':![],'statusLevels':!![],'msg':function(_0x12ddd0,_0x42048d){var _0x1d7c11=_0xc34c('0x27');if(_0x12ddd0['body']&&_0x12ddd0[_0xc34c('0x1d')][_0xc34c('0x28')]&&_0x12ddd0[_0xc34c('0x1d')][_0xc34c('0x29')]){_0x1d7c11='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xc34c('0x2a')](_0x1d7c11,_0x12ddd0[_0xc34c('0x1f')],_0x12ddd0[_0xc34c('0x20')][_0xc34c('0x21')]?_0x12ddd0['headers']['x-forwarded-for']:_0x12ddd0['connection'][_0xc34c('0x23')]||_0x12ddd0['ip'],_0x12ddd0[_0xc34c('0x24')],_0x42048d[_0xc34c('0x25')],_0x42048d[_0xc34c('0x2b')],_0x12ddd0[_0xc34c('0x10')]?_0x12ddd0[_0xc34c('0x10')]['id']:null,_0x12ddd0[_0xc34c('0x10')]?_0x12ddd0[_0xc34c('0x10')][_0xc34c('0xd')]:null,_0x12ddd0[_0xc34c('0x10')]?_0x12ddd0[_0xc34c('0x10')][_0xc34c('0xc')]:null,_0x12ddd0['body']&&_0x12ddd0[_0xc34c('0x1d')][_0xc34c('0x28')]?_0x12ddd0[_0xc34c('0x1d')]['device']:_0xc34c('0x2c'),_0x12ddd0['body']&&_0x12ddd0[_0xc34c('0x1d')]['agent_id']?_0x12ddd0[_0xc34c('0x1d')][_0xc34c('0x29')]:'',_0x12ddd0[_0xc34c('0x1d')]&&_0x12ddd0[_0xc34c('0x1d')]['agent_name']?_0x12ddd0[_0xc34c('0x1d')]['agent_name']:'');},'ignoreRoute':function(_0x7958b7){var _0x4bfd43=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4bfd43[_0xc34c('0x2d')](_0x7958b7[_0xc34c('0x24')]);}}));return _0x2b6fce();});}exports[_0xc34c('0x2e')]=setupLoggers; \ No newline at end of file +var _0x31b5=['other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','role','name','then','catch','user','no-user','data','timestamp','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','agent_id','device'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x31b5,0x1bb));var _0x531b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x31b5[_0x6131cd];return _0x47e916;};var fs=require(_0x531b('0x0'));var _=require(_0x531b('0x1'));var ewinston=require(_0x531b('0x2'));var path=require(_0x531b('0x3'));var util=require(_0x531b('0x4'));var fileLogger=require(_0x531b('0x5'))['fileLogger'];var safeTemplate=require(_0x531b('0x6'))[_0x531b('0x7')];var maskSensitiveData=require(_0x531b('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x279349(_0x315484){var _0x3b587b=path[_0x531b('0x9')](_0x531b('0xa'),_0x531b('0xb'),_0x531b('0xc'));var _0xd6fa98=path['join']('client',_0x315484[_0x531b('0xd')]+'-'+_0x315484[_0x531b('0xe')]);return fs['ensureDir'](path[_0x531b('0x9')](_0x3b587b,_0xd6fa98))[_0x531b('0xf')](function(){var _0x136213=fileLogger('client',path[_0x531b('0x9')](_0x3b587b,_0xd6fa98));return _0x136213;})[_0x531b('0x10')](function(_0x1f0cf2){throw _0x1f0cf2;});}this[_0x531b('0xb')]=function(_0x395030,_0x150d41,_0x15ba62,_0x423cdf){return _0x279349(_0x395030[_0x531b('0x11')])[_0x531b('0xf')](function(_0x47fa2d){var _0x2b181f=_0x47fa2d[_0x150d41];return _0x2b181f;})[_0x531b('0xf')](function(_0x1daa51){var _0x215637=_0x395030[_0x531b('0x11')]?_0x395030[_0x531b('0x11')]['id']:_0x531b('0x12');var _0x330306=_0x423cdf[_0x531b('0x13')];var _0x13e728=_0x423cdf[_0x531b('0x14')];var _0x3e6491=new Date(Number(_0x13e728));return _0x1daa51(_0x215637,_0x3e6491,_0x15ba62,_0x330306);})[_0x531b('0x10')](function(_0xf7fc8b){fileLogger('client')['error'](_0xf7fc8b);});};}function setupLoggers(_0x214478){return new Promise(function(_0x28a328){var _0x22ce6e=new ClientSideLogger();var _0x59e42d=fileLogger('api');var _0x3d31db=fileLogger(_0x531b('0x15'));_0x214478[_0x531b('0x16')](_0x531b('0x17'),_0x22ce6e);_0x214478[_0x531b('0x18')](ewinston[_0x531b('0x19')]({'winstonInstance':_0x59e42d,'meta':![],'statusLevels':!![],'msg':function(_0x5b16fb,_0x32c689){var _0x567245=_0x531b('0x1a');if(!_[_0x531b('0x1b')](_0x5b16fb['body'])){_0x567245+=_0x531b('0x1c');var _0x5c6c37=_0x5b16fb[_0x531b('0x1d')];maskSensitiveData(_0x5c6c37);}return safeTemplate(util[_0x531b('0x1e')](_0x567245,_0x5b16fb[_0x531b('0x1f')],_0x5b16fb['headers'][_0x531b('0x20')]?_0x5b16fb[_0x531b('0x21')][_0x531b('0x20')]:_0x5b16fb[_0x531b('0x22')][_0x531b('0x23')]||_0x5b16fb['ip'],_0x5b16fb[_0x531b('0x24')],_0x32c689[_0x531b('0x25')],_0x32c689[_0x531b('0x26')],_0x5b16fb[_0x531b('0x11')]?_0x5b16fb[_0x531b('0x11')]['id']:null,_0x5b16fb[_0x531b('0x11')]?_0x5b16fb[_0x531b('0x11')]['name']:null,_0x5b16fb[_0x531b('0x11')]?_0x5b16fb[_0x531b('0x11')]['role']:null,_0x5c6c37?util['inspect'](_0x5c6c37,![],null):''));}}));_0x214478[_0x531b('0x18')](ewinston[_0x531b('0x19')]({'winstonInstance':_0x3d31db,'meta':![],'statusLevels':!![],'msg':function(_0x5c6f0e,_0x554739){var _0xc0096a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x5c6f0e[_0x531b('0x1d')]&&_0x5c6f0e[_0x531b('0x1d')]['device']&&_0x5c6f0e[_0x531b('0x1d')][_0x531b('0x27')]){_0xc0096a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x531b('0x1e')](_0xc0096a,_0x5c6f0e[_0x531b('0x1f')],_0x5c6f0e[_0x531b('0x21')][_0x531b('0x20')]?_0x5c6f0e[_0x531b('0x21')]['x-forwarded-for']:_0x5c6f0e[_0x531b('0x22')][_0x531b('0x23')]||_0x5c6f0e['ip'],_0x5c6f0e[_0x531b('0x24')],_0x554739['statusCode'],_0x554739['responseTime'],_0x5c6f0e[_0x531b('0x11')]?_0x5c6f0e[_0x531b('0x11')]['id']:null,_0x5c6f0e['user']?_0x5c6f0e['user'][_0x531b('0xe')]:null,_0x5c6f0e[_0x531b('0x11')]?_0x5c6f0e[_0x531b('0x11')][_0x531b('0xd')]:null,_0x5c6f0e['body']&&_0x5c6f0e[_0x531b('0x1d')][_0x531b('0x28')]?_0x5c6f0e[_0x531b('0x1d')][_0x531b('0x28')]:_0x531b('0x29'),_0x5c6f0e[_0x531b('0x1d')]&&_0x5c6f0e[_0x531b('0x1d')]['agent_id']?_0x5c6f0e[_0x531b('0x1d')][_0x531b('0x27')]:'',_0x5c6f0e[_0x531b('0x1d')]&&_0x5c6f0e[_0x531b('0x1d')][_0x531b('0x2a')]?_0x5c6f0e['body'][_0x531b('0x2a')]:'');},'ignoreRoute':function(_0x3eaafd){var _0x2ee3ae=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2ee3ae['test'](_0x3eaafd[_0x531b('0x24')]);}}));return _0x28a328();});}exports[_0x531b('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index de18ba6..6439011 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb89=['locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','includes','date','daysInMonth','max','min','domCompare','MMM','guess','test','isMoment','padStart','length','iftime','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split'];(function(_0x594168,_0x3ac22f){var _0x31645f=function(_0x47f9a3){while(--_0x47f9a3){_0x594168['push'](_0x594168['shift']());}};_0x31645f(++_0x3ac22f);}(_0xcb89,0x190));var _0x9cb8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xcb89[_0x25e7cb];return _0x375d92;};var _=require('lodash');var moment=require(_0x9cb8('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9cb8('0x1')](function(_0x71f7d6){return _0x71f7d6[_0x9cb8('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9cb8('0x3');var EINVALID_DATE=_0x9cb8('0x4');function throwIfDateNotValid(_0x2ad72f){if(!_0x2ad72f[_0x9cb8('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x36a576){var _0x5c1df9=_0x36a576[_0x9cb8('0x6')](':')[_0x9cb8('0x1')](function(_0x1ca6a7){return parseInt(_0x1ca6a7,0xa);});var _0x448ff3=_0x5c1df9[0x0];var _0x508e9c=_0x5c1df9[0x1];if(_0x448ff3<0x0||_0x448ff3>0x17||_0x508e9c<0x0||_0x508e9c>0x3b){throw new Error(EINVALID_DATE);}return[_0x448ff3,_0x508e9c];}function circularDoWInterval(_0x5d717c,_0x15d057){if(_0x5d717c===_0x15d057){return[_0x5d717c];}else{var _0x26b14f=moment[_0x9cb8('0x7')]();moment[_0x9cb8('0x7')]('en');var _0x3aed9f=moment['weekdaysShort']()[_0x9cb8('0x1')](function(_0x5b3df8){return _0x5b3df8[_0x9cb8('0x8')]();});moment[_0x9cb8('0x7')](_0x26b14f);var _0x1ee678=_0x3aed9f[_0x9cb8('0x9')](_0x5d717c);var _0x2b587b=_0x3aed9f[_0x9cb8('0x9')](_0x15d057);if(_0x2b587b>_0x1ee678){return _0x3aed9f[_0x9cb8('0xa')](_0x1ee678,_0x2b587b+0x1);}else{var _0x2bafcb=_0x3aed9f['slice'](0x0,_0x2b587b+0x1);var _0x1baaa4=_0x3aed9f[_0x9cb8('0xa')](_0x1ee678);return _0x1baaa4[_0x9cb8('0xb')](_0x2bafcb);}}}module[_0x9cb8('0xc')][_0x9cb8('0xd')]=circularDoWInterval;function circularMonthInterval(_0x1b0c96,_0xe5ae68){if(_0x1b0c96===_0xe5ae68){return[_0x1b0c96];}else{var _0x1da354=moment['locale']();moment[_0x9cb8('0x7')]('en');var _0x4b701c=moment[_0x9cb8('0xe')]()[_0x9cb8('0x1')](function(_0x55ae97){return _0x55ae97[_0x9cb8('0x8')]();});moment[_0x9cb8('0x7')](_0x1da354);var _0x5dc707=_0x4b701c[_0x9cb8('0x9')](_0x1b0c96);var _0x3c59c3=_0x4b701c[_0x9cb8('0x9')](_0xe5ae68);if(_0x3c59c3>_0x5dc707){return _0x4b701c[_0x9cb8('0xa')](_0x5dc707,_0x3c59c3+0x1);}else{var _0x56247d=_0x4b701c['slice'](0x0,_0x3c59c3+0x1);var _0x2ab448=_0x4b701c[_0x9cb8('0xa')](_0x5dc707);return _0x2ab448[_0x9cb8('0xb')](_0x56247d);}}}module[_0x9cb8('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x308931){var _0x4ed80c=parseInt(_0x308931,0xa);if(_0x4ed80c<0x1||_0x4ed80c>0x1f){throw new Error(EINVALID_DATE);}return _0x4ed80c;}function timeCompare(_0x7ce216,_0x5c19a6,_0x3d931e){var _0x10a4d4=_0x7ce216['clone']();var _0x53bd8d=extractTime(_0x5c19a6);var _0x41973f=_0x53bd8d[0x0];var _0x18c873=_0x53bd8d[0x1];var _0x4bb3ca=_0x7ce216[_0x9cb8('0xf')]()[_0x9cb8('0x10')](_0x41973f)[_0x9cb8('0x11')](_0x18c873);throwIfDateNotValid(_0x4bb3ca);var _0x4297bf=extractTime(_0x3d931e);var _0x14d3a0=_0x4297bf[0x0];var _0x4548b6=_0x4297bf[0x1];var _0x3fadb0=_0x7ce216[_0x9cb8('0xf')]()['hours'](_0x14d3a0)[_0x9cb8('0x11')](_0x4548b6);throwIfDateNotValid(_0x3fadb0);if(_0x3fadb0[_0x9cb8('0x12')](_0x4bb3ca)){var _0x3e5681=_0x10a4d4['clone']()[_0x9cb8('0x13')](_0x9cb8('0x14'));var _0x57493f=_0x10a4d4[_0x9cb8('0xf')]()[_0x9cb8('0x15')](_0x9cb8('0x14'));return _0x10a4d4['isBetween'](_0x4bb3ca,_0x57493f,undefined,'[]')||_0x10a4d4[_0x9cb8('0x16')](_0x3e5681,_0x3fadb0,undefined,'[]');}else{return _0x10a4d4[_0x9cb8('0x16')](_0x4bb3ca,_0x3fadb0,undefined,'[]');}}module[_0x9cb8('0xc')][_0x9cb8('0x17')]=timeCompare;function dowCompare(_0x5aba9b,_0x14f0d9,_0x1434b8){var _0x416120=_0x5aba9b[_0x9cb8('0x7')]('en')['format']('ddd')[_0x9cb8('0x8')]();return circularDoWInterval(_0x14f0d9,_0x1434b8)[_0x9cb8('0x18')](_0x416120);}module[_0x9cb8('0xc')]['dowCompare']=dowCompare;function domCompare(_0x385949,_0x4b0ee0,_0xd3febb){var _0x51c59b=_0x385949[_0x9cb8('0x19')]();if(_0x4b0ee0===_0xd3febb){return _0x51c59b===_0x4b0ee0;}else{var _0x15e88f=_0x385949[_0x9cb8('0x1a')]();var _0x20e99d=_0x4b0ee0<_0xd3febb;let _0x1d8d1b=![];var _0x52dbf9=0x0;var _0x23fa12=0x0;if(_0x20e99d){_0x52dbf9=Math[_0x9cb8('0x1b')](0x1,_0x4b0ee0);_0x23fa12=Math['min'](_0xd3febb,_0x15e88f);_0x1d8d1b=_0x51c59b>=_0x52dbf9&&_0x51c59b<=_0x23fa12;}else{_0x52dbf9=Math[_0x9cb8('0x1c')](_0x4b0ee0,_0x15e88f);_0x23fa12=Math[_0x9cb8('0x1b')](0x1,_0xd3febb);_0x1d8d1b=_0x51c59b>=_0x52dbf9||_0x51c59b<=_0x23fa12;}return _0x1d8d1b;}}module['exports'][_0x9cb8('0x1d')]=domCompare;function monthCompare(_0x36823e,_0x47a355,_0x14b1ae){var _0x4cc3f6=_0x36823e[_0x9cb8('0x7')]('en')['format'](_0x9cb8('0x1e'))['toLowerCase']();return circularMonthInterval(_0x47a355,_0x14b1ae)['includes'](_0x4cc3f6);}module[_0x9cb8('0xc')]['monthCompare']=monthCompare;function iftime(_0x5545b8,_0x29cf20=moment['tz'][_0x9cb8('0x1f')](),_0x4d342f=moment()){if(!validateRx[_0x9cb8('0x20')](_0x5545b8)){throw new Error(EINVALID_STRING);}else{var _0x49486e=(moment[_0x9cb8('0x21')](_0x4d342f)?_0x4d342f[_0x9cb8('0xf')]():moment(_0x4d342f))['tz'](_0x29cf20)[_0x9cb8('0x7')]('en');throwIfDateNotValid(_0x49486e);var _0x15df13=_0x5545b8[_0x9cb8('0x6')](',');var _0x590bbc=_0x15df13[0x0];var _0x1f84bb=_0x15df13[0x1];var _0x2fe6e6=_0x15df13[0x2];var _0x38b517=_0x15df13[0x3];let _0x160029=!![];if(_0x590bbc!=='*'){var _0x1c213b=_0x590bbc['split']('-');var _0x47c6b4=_[_0x9cb8('0x22')](_0x1c213b[0x0],0x5,'0');var _0x1895f5=_0x1c213b['length']===0x2?_['padStart'](_0x1c213b[0x1],0x5,'0'):_0x47c6b4;_0x160029=timeCompare(_0x49486e,_0x47c6b4,_0x1895f5);}let _0x5a52ee=!![];if(_0x1f84bb!=='*'){var _0x1125be=_0x1f84bb[_0x9cb8('0x6')]('-');var _0x3b4da5=_0x1125be[0x0];var _0x3d45ac=_0x1125be['length']===0x2?_0x1125be[0x1]:_0x3b4da5;_0x5a52ee=dowCompare(_0x49486e,_0x3b4da5,_0x3d45ac);}let _0x158f8f=!![];if(_0x2fe6e6!=='*'){var _0x2fda90=_0x2fe6e6[_0x9cb8('0x6')]('-');var _0x325aa0=parseDom(_0x2fda90[0x0]);var _0x20e40d=_0x2fda90[_0x9cb8('0x23')]===0x2?parseDom(_0x2fda90[0x1]):_0x325aa0;_0x158f8f=domCompare(_0x49486e,_0x325aa0,_0x20e40d);}let _0x43f3e7=!![];if(_0x38b517!=='*'){var _0x186735=_0x38b517['split']('-');var _0x247a07=_0x186735[0x0];var _0x1f8b58=_0x186735['length']===0x2?_0x186735[0x1]:_0x186735[0x0];_0x43f3e7=monthCompare(_0x49486e,_0x247a07,_0x1f8b58);}return _0x160029&&_0x5a52ee&&_0x158f8f&&_0x43f3e7;}}module[_0x9cb8('0xc')][_0x9cb8('0x24')]=iftime; \ No newline at end of file +var _0x2ac3=['minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','ddd','includes','date','daysInMonth','max','min','format','MMM','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','map','toLowerCase','circularMonthInterval','clone','hours'];(function(_0x506a15,_0x5d54ae){var _0x3cae1b=function(_0x9e7ef3){while(--_0x9e7ef3){_0x506a15['push'](_0x506a15['shift']());}};_0x3cae1b(++_0x5d54ae);}(_0x2ac3,0xe7));var _0x32ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2ac3[_0x20a584];return _0x4b41a8;};var _=require(_0x32ac('0x0'));var moment=require(_0x32ac('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x241e3d){return _0x241e3d[_0x32ac('0x2')];})[_0x32ac('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x32ac('0x4');var EINVALID_DATE=_0x32ac('0x5');function throwIfDateNotValid(_0x5c8c36){if(!_0x5c8c36[_0x32ac('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x551416){var _0x5da0c6=_0x551416[_0x32ac('0x7')](':')['map'](function(_0x4edae2){return parseInt(_0x4edae2,0xa);});var _0x5934e8=_0x5da0c6[0x0];var _0x524d25=_0x5da0c6[0x1];if(_0x5934e8<0x0||_0x5934e8>0x17||_0x524d25<0x0||_0x524d25>0x3b){throw new Error(EINVALID_DATE);}return[_0x5934e8,_0x524d25];}function circularDoWInterval(_0x968bed,_0xddbcf6){if(_0x968bed===_0xddbcf6){return[_0x968bed];}else{var _0x312c1e=moment[_0x32ac('0x8')]();moment['locale']('en');var _0x483ab7=moment[_0x32ac('0x9')]()['map'](function(_0x4d2936){return _0x4d2936['toLowerCase']();});moment[_0x32ac('0x8')](_0x312c1e);var _0x32d23e=_0x483ab7[_0x32ac('0xa')](_0x968bed);var _0x5c964a=_0x483ab7[_0x32ac('0xa')](_0xddbcf6);if(_0x5c964a>_0x32d23e){return _0x483ab7[_0x32ac('0xb')](_0x32d23e,_0x5c964a+0x1);}else{var _0x5881e1=_0x483ab7[_0x32ac('0xb')](0x0,_0x5c964a+0x1);var _0x1dbb56=_0x483ab7[_0x32ac('0xb')](_0x32d23e);return _0x1dbb56[_0x32ac('0xc')](_0x5881e1);}}}module[_0x32ac('0xd')][_0x32ac('0xe')]=circularDoWInterval;function circularMonthInterval(_0x5dc1a3,_0x462839){if(_0x5dc1a3===_0x462839){return[_0x5dc1a3];}else{var _0x58628c=moment[_0x32ac('0x8')]();moment['locale']('en');var _0x35eae5=moment[_0x32ac('0xf')]()[_0x32ac('0x10')](function(_0x234f3b){return _0x234f3b[_0x32ac('0x11')]();});moment['locale'](_0x58628c);var _0x53aace=_0x35eae5[_0x32ac('0xa')](_0x5dc1a3);var _0x590016=_0x35eae5[_0x32ac('0xa')](_0x462839);if(_0x590016>_0x53aace){return _0x35eae5[_0x32ac('0xb')](_0x53aace,_0x590016+0x1);}else{var _0x48cc64=_0x35eae5[_0x32ac('0xb')](0x0,_0x590016+0x1);var _0x335b92=_0x35eae5[_0x32ac('0xb')](_0x53aace);return _0x335b92[_0x32ac('0xc')](_0x48cc64);}}}module[_0x32ac('0xd')][_0x32ac('0x12')]=circularMonthInterval;function parseDom(_0x5f1f26){var _0x2f3eeb=parseInt(_0x5f1f26,0xa);if(_0x2f3eeb<0x1||_0x2f3eeb>0x1f){throw new Error(EINVALID_DATE);}return _0x2f3eeb;}function timeCompare(_0x205dfd,_0x376fb3,_0x256a51){var _0x8f01d8=_0x205dfd[_0x32ac('0x13')]();var _0x17a62b=extractTime(_0x376fb3);var _0xb0c90d=_0x17a62b[0x0];var _0x1e81a1=_0x17a62b[0x1];var _0x3c9cbc=_0x205dfd[_0x32ac('0x13')]()[_0x32ac('0x14')](_0xb0c90d)[_0x32ac('0x15')](_0x1e81a1);throwIfDateNotValid(_0x3c9cbc);var _0x273a61=extractTime(_0x256a51);var _0x239f3d=_0x273a61[0x0];var _0x1526ff=_0x273a61[0x1];var _0x15f280=_0x205dfd[_0x32ac('0x13')]()['hours'](_0x239f3d)[_0x32ac('0x15')](_0x1526ff);throwIfDateNotValid(_0x15f280);if(_0x15f280[_0x32ac('0x16')](_0x3c9cbc)){var _0x2cb6ea=_0x8f01d8[_0x32ac('0x13')]()[_0x32ac('0x17')](_0x32ac('0x18'));var _0x5d63f7=_0x8f01d8[_0x32ac('0x13')]()[_0x32ac('0x19')](_0x32ac('0x18'));return _0x8f01d8[_0x32ac('0x1a')](_0x3c9cbc,_0x5d63f7,undefined,'[]')||_0x8f01d8['isBetween'](_0x2cb6ea,_0x15f280,undefined,'[]');}else{return _0x8f01d8['isBetween'](_0x3c9cbc,_0x15f280,undefined,'[]');}}module[_0x32ac('0xd')][_0x32ac('0x1b')]=timeCompare;function dowCompare(_0x5b39b3,_0x28ba84,_0x41b4dd){var _0x202f3e=_0x5b39b3['locale']('en')['format'](_0x32ac('0x1c'))[_0x32ac('0x11')]();return circularDoWInterval(_0x28ba84,_0x41b4dd)[_0x32ac('0x1d')](_0x202f3e);}module[_0x32ac('0xd')]['dowCompare']=dowCompare;function domCompare(_0x4369c2,_0x4b5eaa,_0x1bf067){var _0x1248c4=_0x4369c2[_0x32ac('0x1e')]();if(_0x4b5eaa===_0x1bf067){return _0x1248c4===_0x4b5eaa;}else{var _0xa7e39f=_0x4369c2[_0x32ac('0x1f')]();var _0x118a73=_0x4b5eaa<_0x1bf067;let _0x279b55=![];var _0x2311a9=0x0;var _0xafa6a9=0x0;if(_0x118a73){_0x2311a9=Math[_0x32ac('0x20')](0x1,_0x4b5eaa);_0xafa6a9=Math['min'](_0x1bf067,_0xa7e39f);_0x279b55=_0x1248c4>=_0x2311a9&&_0x1248c4<=_0xafa6a9;}else{_0x2311a9=Math[_0x32ac('0x21')](_0x4b5eaa,_0xa7e39f);_0xafa6a9=Math[_0x32ac('0x20')](0x1,_0x1bf067);_0x279b55=_0x1248c4>=_0x2311a9||_0x1248c4<=_0xafa6a9;}return _0x279b55;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x5bdc31,_0x2fc8af,_0x5a3f24){var _0x2e3c4f=_0x5bdc31['locale']('en')[_0x32ac('0x22')](_0x32ac('0x23'))[_0x32ac('0x11')]();return circularMonthInterval(_0x2fc8af,_0x5a3f24)[_0x32ac('0x1d')](_0x2e3c4f);}module[_0x32ac('0xd')][_0x32ac('0x24')]=monthCompare;function iftime(_0x183223,_0x4d5f4f=moment['tz']['guess'](),_0x269c07=moment()){if(!validateRx[_0x32ac('0x25')](_0x183223)){throw new Error(EINVALID_STRING);}else{var _0x914d50=(moment[_0x32ac('0x26')](_0x269c07)?_0x269c07[_0x32ac('0x13')]():moment(_0x269c07))['tz'](_0x4d5f4f)[_0x32ac('0x8')]('en');throwIfDateNotValid(_0x914d50);var _0x509c7d=_0x183223['split'](',');var _0x499905=_0x509c7d[0x0];var _0x2fdcf3=_0x509c7d[0x1];var _0x32ec71=_0x509c7d[0x2];var _0x245677=_0x509c7d[0x3];let _0x576bd5=!![];if(_0x499905!=='*'){var _0x47d6d3=_0x499905[_0x32ac('0x7')]('-');var _0x4ee0d3=_[_0x32ac('0x27')](_0x47d6d3[0x0],0x5,'0');var _0x490e65=_0x47d6d3[_0x32ac('0x28')]===0x2?_['padStart'](_0x47d6d3[0x1],0x5,'0'):_0x4ee0d3;_0x576bd5=timeCompare(_0x914d50,_0x4ee0d3,_0x490e65);}let _0x168ae2=!![];if(_0x2fdcf3!=='*'){var _0xc747a1=_0x2fdcf3[_0x32ac('0x7')]('-');var _0xf2db5=_0xc747a1[0x0];var _0x3bdc25=_0xc747a1[_0x32ac('0x28')]===0x2?_0xc747a1[0x1]:_0xf2db5;_0x168ae2=dowCompare(_0x914d50,_0xf2db5,_0x3bdc25);}let _0x35069a=!![];if(_0x32ec71!=='*'){var _0x121db0=_0x32ec71[_0x32ac('0x7')]('-');var _0x51e26f=parseDom(_0x121db0[0x0]);var _0x305914=_0x121db0[_0x32ac('0x28')]===0x2?parseDom(_0x121db0[0x1]):_0x51e26f;_0x35069a=domCompare(_0x914d50,_0x51e26f,_0x305914);}let _0x4a5c5b=!![];if(_0x245677!=='*'){var _0x46bb51=_0x245677[_0x32ac('0x7')]('-');var _0x53c1d0=_0x46bb51[0x0];var _0x49e3d0=_0x46bb51['length']===0x2?_0x46bb51[0x1]:_0x46bb51[0x0];_0x4a5c5b=monthCompare(_0x914d50,_0x53c1d0,_0x49e3d0);}return _0x576bd5&&_0x168ae2&&_0x35069a&&_0x4a5c5b;}}module['exports'][_0x32ac('0x29')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 7c2e200..1d41c58 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c30=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','stringify','Logger','Console','warn','transports','%s-%s','error','File','fileLogger','path','moment','winston','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','message','{{{','}}}','replace','format'];(function(_0x2bf845,_0x19bbff){var _0x185aa6=function(_0x2aa0fe){while(--_0x2aa0fe){_0x2bf845['push'](_0x2bf845['shift']());}};_0x185aa6(++_0x19bbff);}(_0x3c30,0x162));var _0x03c3=function(_0x30fcc8,_0xb1f24a){_0x30fcc8=_0x30fcc8-0x0;var _0x44c02d=_0x3c30[_0x30fcc8];return _0x44c02d;};'use strict';var path=require(_0x03c3('0x0'));var util=require('util');var moment=require(_0x03c3('0x1'));var winston=require(_0x03c3('0x2'));var config=require('../config/environment');var debugLevel=config[_0x03c3('0x3')]?config[_0x03c3('0x3')][_0x03c3('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x03c3('0x5'),'error':_0x03c3('0x6'),'warn':_0x03c3('0x7'),'info':'white','print':_0x03c3('0x8'),'success':'bold\x20green','http':'gray','verbose':_0x03c3('0x9'),'debug':_0x03c3('0xa'),'silly':_0x03c3('0xb')};winston[_0x03c3('0xc')](XC_LOG_COLORS);function getLogFileName(_0x547f9a,_0xce8e5d,_0x128939){var _0x38e9b5=_0x547f9a||_0x03c3('0xd');return path[_0x03c3('0xe')](_0x38e9b5,util['format']('%s-%s.log',_0xce8e5d,_0x128939));}function formatter(_0x3fd71d,_0x55bbb0){_0x55bbb0[_0x03c3('0xf')]=_0x55bbb0['message']['replace'](/@@{/g,_0x03c3('0x10'))['replace'](/}@@/g,_0x03c3('0x11'))[_0x03c3('0x12')](/@{/g,'{{')[_0x03c3('0x12')](/}@/g,'}}');return util[_0x03c3('0x13')](_0x03c3('0x14'),moment()[_0x03c3('0x13')](_0x03c3('0x15')),_0x55bbb0[_0x03c3('0x16')][_0x03c3('0x17')](),_0x3fd71d,_0x55bbb0[_0x03c3('0xf')]);}function fileFormat(_0x200503,_0x11ffb7){_0x11ffb7['message']=_0x11ffb7[_0x03c3('0xf')][_0x03c3('0x12')](/@@{/g,_0x03c3('0x10'))['replace'](/}@@/g,_0x03c3('0x11'))[_0x03c3('0x12')](/@{/g,'{{')[_0x03c3('0x12')](/}@/g,'}}');var _0x3ccff9=_0x11ffb7[_0x03c3('0x18')]&&Object['keys'](_0x11ffb7['meta'])['length']?'\x0a\x09'+JSON[_0x03c3('0x19')](_0x11ffb7[_0x03c3('0x18')]):'';return util[_0x03c3('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x03c3('0x15')),_0x11ffb7['level'][_0x03c3('0x17')](),_0x200503,_0x11ffb7[_0x03c3('0xf')],_0x3ccff9);}function consoleLogger(){var _0x5b064e=new winston[(_0x03c3('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x03c3('0x1b'))]({'level':_0x03c3('0x1c'),'json':![],'formatter':function(_0x34ffbc){return formatter('',_0x34ffbc);}})]});return _0x5b064e;}function fileLogger(_0x36e7b9,_0x589287){var _0x474567=new winston[(_0x03c3('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x03c3('0x1d'))]['File']({'name':util[_0x03c3('0x13')](_0x03c3('0x1e'),_0x36e7b9,_0x03c3('0x1f')),'filename':getLogFileName(_0x589287,_0x36e7b9,'error'),'level':_0x03c3('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x333add){return fileFormat(_0x36e7b9,_0x333add);}}),new winston[(_0x03c3('0x1d'))][(_0x03c3('0x20'))]({'name':util[_0x03c3('0x13')](_0x03c3('0x1e'),_0x36e7b9,debugLevel),'filename':getLogFileName(_0x589287,_0x36e7b9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28b01e){return fileFormat(_0x36e7b9,_0x28b01e);}}),new winston[(_0x03c3('0x1d'))][(_0x03c3('0x1b'))]({'level':_0x03c3('0x1c'),'json':![],'formatter':function(_0x2966e6){return fileFormat(_0x36e7b9,_0x2966e6);}})]});return _0x474567;}exports['consoleLogger']=consoleLogger;exports[_0x03c3('0x21')]=fileLogger; \ No newline at end of file +var _0xa219=['Console','warn','File','error','%s-%s','consoleLogger','fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports'];(function(_0x26f141,_0xf133b1){var _0xe74ec7=function(_0xb2db81){while(--_0xb2db81){_0x26f141['push'](_0x26f141['shift']());}};_0xe74ec7(++_0xf133b1);}(_0xa219,0x1b4));var _0x9a21=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0xa219[_0x17bb31];return _0x505c71;};'use strict';var path=require('path');var util=require(_0x9a21('0x0'));var moment=require(_0x9a21('0x1'));var winston=require(_0x9a21('0x2'));var config=require(_0x9a21('0x3'));var debugLevel=config[_0x9a21('0x4')]?config[_0x9a21('0x4')][_0x9a21('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x9a21('0x6'),'warn':_0x9a21('0x7'),'info':_0x9a21('0x8'),'print':_0x9a21('0x9'),'success':_0x9a21('0xa'),'http':_0x9a21('0xb'),'verbose':_0x9a21('0xc'),'debug':_0x9a21('0xd'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x51ae91,_0x4bc78d,_0x426c05){var _0x201f1b=_0x51ae91||_0x9a21('0xe');return path[_0x9a21('0xf')](_0x201f1b,util[_0x9a21('0x10')](_0x9a21('0x11'),_0x4bc78d,_0x426c05));}function formatter(_0x47570b,_0x17a6f7){_0x17a6f7[_0x9a21('0x12')]=_0x17a6f7[_0x9a21('0x12')][_0x9a21('0x13')](/@@{/g,_0x9a21('0x14'))[_0x9a21('0x13')](/}@@/g,_0x9a21('0x15'))['replace'](/@{/g,'{{')[_0x9a21('0x13')](/}@/g,'}}');return util[_0x9a21('0x10')](_0x9a21('0x16'),moment()[_0x9a21('0x10')](_0x9a21('0x17')),_0x17a6f7[_0x9a21('0x18')][_0x9a21('0x19')](),_0x47570b,_0x17a6f7['message']);}function fileFormat(_0x5e8ab4,_0x38997c){_0x38997c[_0x9a21('0x12')]=_0x38997c['message'][_0x9a21('0x13')](/@@{/g,_0x9a21('0x14'))['replace'](/}@@/g,_0x9a21('0x15'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x2e915c=_0x38997c[_0x9a21('0x1a')]&&Object[_0x9a21('0x1b')](_0x38997c[_0x9a21('0x1a')])[_0x9a21('0x1c')]?'\x0a\x09'+JSON['stringify'](_0x38997c[_0x9a21('0x1a')]):'';return util['format'](_0x9a21('0x1d'),moment()[_0x9a21('0x10')](_0x9a21('0x17')),_0x38997c[_0x9a21('0x18')][_0x9a21('0x19')](),_0x5e8ab4,_0x38997c[_0x9a21('0x12')],_0x2e915c);}function consoleLogger(){var _0xaa794=new winston[(_0x9a21('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9a21('0x1f'))][(_0x9a21('0x20'))]({'level':_0x9a21('0x21'),'json':![],'formatter':function(_0xf1eb27){return formatter('',_0xf1eb27);}})]});return _0xaa794;}function fileLogger(_0x1627d6,_0x5de12d){var _0x5b06cd=new winston[(_0x9a21('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x9a21('0x1f'))][(_0x9a21('0x22'))]({'name':util['format']('%s-%s',_0x1627d6,_0x9a21('0x23')),'filename':getLogFileName(_0x5de12d,_0x1627d6,_0x9a21('0x23')),'level':_0x9a21('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x42f352){return fileFormat(_0x1627d6,_0x42f352);}}),new winston['transports'][(_0x9a21('0x22'))]({'name':util['format'](_0x9a21('0x24'),_0x1627d6,debugLevel),'filename':getLogFileName(_0x5de12d,_0x1627d6,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b14db){return fileFormat(_0x1627d6,_0x1b14db);}}),new winston[(_0x9a21('0x1f'))]['Console']({'level':_0x9a21('0x21'),'json':![],'formatter':function(_0x2356d1){return fileFormat(_0x1627d6,_0x2356d1);}})]});return _0x5b06cd;}exports[_0x9a21('0x25')]=consoleLogger;exports[_0x9a21('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 f138b50..69ebe81 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1a85,0x178));var _0x51a8=function(_0x15a26e,_0x334582){_0x15a26e=_0x15a26e-0x0;var _0x25bef6=_0x1a85[_0x15a26e];return _0x25bef6;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x1967,0x173));var _0x7196=function(_0x3674e5,_0x12c569){_0x3674e5=_0x3674e5-0x0;var _0x404d81=_0x1967[_0x3674e5];return _0x404d81;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index f9cf24a..68b0a44 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 _0x36ee=['replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','{\x20{\x20','string'];(function(_0x50e149,_0x385cd6){var _0x1d9503=function(_0x5393af){while(--_0x5393af){_0x50e149['push'](_0x50e149['shift']());}};_0x1d9503(++_0x385cd6);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4889d8){return _0x4889d8==='{{'?_0xe36e('0x0'):'\x20}\x20}';}function safeTemplate(_0xf6b517){var _0x4018bf=_0xf6b517;if(typeof _0xf6b517===_0xe36e('0x1')){_0x4018bf=_0xf6b517[_0xe36e('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe36e('0x3')](_0xf6b517)){_0x4018bf=_0xf6b517[_0xe36e('0x4')](function(_0x29e692){return safeTemplate(_0x29e692);});}else if(_[_0xe36e('0x5')](_0xf6b517)){_0x4018bf=Object[_0xe36e('0x6')](_0xf6b517)[_0xe36e('0x7')](function(_0x21be0b,_0x1aa596){_0x21be0b[_0x1aa596]=safeTemplate(_0xf6b517[_0x1aa596]);return _0x21be0b;},{});}return _0x4018bf;}module['exports'][_0xe36e('0x8')]=safeTemplate; \ No newline at end of file +var _0x80ed=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x80ed,0x11c));var _0xd80e=function(_0x46163f,_0x51039b){_0x46163f=_0x46163f-0x0;var _0x474302=_0x80ed[_0x46163f];return _0x474302;};var _=require(_0xd80e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5a14b2){return _0x5a14b2==='{{'?_0xd80e('0x1'):_0xd80e('0x2');}function safeTemplate(_0x4329e5){var _0x5052d7=_0x4329e5;if(typeof _0x4329e5===_0xd80e('0x3')){_0x5052d7=_0x4329e5[_0xd80e('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xd80e('0x5')](_0x4329e5)){_0x5052d7=_0x4329e5[_0xd80e('0x6')](function(_0x5ae6c6){return safeTemplate(_0x5ae6c6);});}else if(_[_0xd80e('0x7')](_0x4329e5)){_0x5052d7=Object[_0xd80e('0x8')](_0x4329e5)[_0xd80e('0x9')](function(_0x51c361,_0x411b3a){_0x51c361[_0x411b3a]=safeTemplate(_0x4329e5[_0x411b3a]);return _0x51c361;},{});}return _0x5052d7;}module[_0xd80e('0xa')][_0xd80e('0xb')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 3071384..5706ecb 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 _0xec7f=['root','resolve','isArray','apps','findIndex','name','motion2','env','NODE_PATH','readJSON','updated','info','Updating\x20app.json','exports','fs-extra','path'];(function(_0x14f1bd,_0x2f27e2){var _0x238c4b=function(_0x1d1cea){while(--_0x1d1cea){_0x14f1bd['push'](_0x14f1bd['shift']());}};_0x238c4b(++_0x2f27e2);}(_0xec7f,0xae));var _0xfec7=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xec7f[_0x4b055c];return _0x4b62bb;};var fs=require(_0xfec7('0x0'));var path=require(_0xfec7('0x1'));var config=require('../config/environment');var root=config[_0xfec7('0x2')];var APP_JSON_PATH=path[_0xfec7('0x3')](root,'server/app.json');var NODEPATH=path[_0xfec7('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x2c1179){let _0x4b8bfc=![];if(Array[_0xfec7('0x4')](_0x2c1179[_0xfec7('0x5')])){var _0x4aed55=_0x2c1179[_0xfec7('0x5')][_0xfec7('0x6')](function(_0x2e6f08){return _0x2e6f08[_0xfec7('0x7')]===_0xfec7('0x8');});if(_0x4aed55>-0x1){var _0xb55057=_0x2c1179[_0xfec7('0x5')][_0x4aed55];if(typeof _0xb55057[_0xfec7('0x9')][_0xfec7('0xa')]!=='string'){_0xb55057[_0xfec7('0x9')][_0xfec7('0xa')]=NODEPATH;_0x4b8bfc=!![];}}return{'appConfig':_0x2c1179,'updated':_0x4b8bfc};}}function updateAppConfig(_0x279198){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x523e52){if(_0x523e52){return fs[_0xfec7('0xb')](APP_JSON_PATH)['then'](function(_0x5280e0){var _0x37216a=setLegacyLibsNodeEnvPath(_0x5280e0);if(_0x37216a[_0xfec7('0xc')]){_0x279198[_0xfec7('0xd')](_0xfec7('0xe'));return fs['writeJSON'](APP_JSON_PATH,_0x5280e0,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise['resolve']();}});}module[_0xfec7('0xf')]=updateAppConfig; \ No newline at end of file +var _0x00b0=['name','motion2','env','string','NODE_PATH','pathExists','then','readJSON','info','fs-extra','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex'];(function(_0x11faca,_0x392ba2){var _0x13552a=function(_0x10b647){while(--_0x10b647){_0x11faca['push'](_0x11faca['shift']());}};_0x13552a(++_0x392ba2);}(_0x00b0,0x1c3));var _0x000b=function(_0x1b2d5a,_0x4cf35d){_0x1b2d5a=_0x1b2d5a-0x0;var _0xe72ee2=_0x00b0[_0x1b2d5a];return _0xe72ee2;};var fs=require(_0x000b('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0x000b('0x1')];var APP_JSON_PATH=path[_0x000b('0x2')](root,_0x000b('0x3'));var NODEPATH=path[_0x000b('0x2')](root,_0x000b('0x4'));function setLegacyLibsNodeEnvPath(_0x345a25){let _0x1b562b=![];if(Array[_0x000b('0x5')](_0x345a25['apps'])){var _0x1d83ca=_0x345a25[_0x000b('0x6')][_0x000b('0x7')](function(_0x5336eb){return _0x5336eb[_0x000b('0x8')]===_0x000b('0x9');});if(_0x1d83ca>-0x1){var _0x1e48bf=_0x345a25[_0x000b('0x6')][_0x1d83ca];if(typeof _0x1e48bf[_0x000b('0xa')]['NODE_PATH']!==_0x000b('0xb')){_0x1e48bf[_0x000b('0xa')][_0x000b('0xc')]=NODEPATH;_0x1b562b=!![];}}return{'appConfig':_0x345a25,'updated':_0x1b562b};}}function updateAppConfig(_0x397ba1){return fs[_0x000b('0xd')](APP_JSON_PATH)[_0x000b('0xe')](function(_0x4969cd){if(_0x4969cd){return fs[_0x000b('0xf')](APP_JSON_PATH)[_0x000b('0xe')](function(_0x1613d6){var _0x4baa82=setLegacyLibsNodeEnvPath(_0x1613d6);if(_0x4baa82['updated']){_0x397ba1[_0x000b('0x10')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x1613d6,{'spaces':0x2});}else{return Promise[_0x000b('0x2')]();}});}else{return Promise[_0x000b('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file